From: Andrea Amorese Date: Tue, 18 Jan 2022 09:06:16 +0000 (+0100) Subject: Built motion from commit 8aeb62e4.|2.5.48 X-Git-Url: http://repos.xcallymotion.com/base/%22angular-material.themes.css/%22javascript:;//%22%7B%7Blicense.mail?a=commitdiff_plain;h=816300affe0dec8591ef526e1b8cfc4c95d6fc4d;p=motion2.git Built motion from commit 8aeb62e4.|2.5.48 --- diff --git a/apidoc/api_data.js b/apidoc/api_data.js index 96fa16c..dac56d8 100644 --- a/apidoc/api_data.js +++ b/apidoc/api_data.js @@ -13,8 +13,8 @@ define({ "api": [ "name": "getTimezone", "version": "0.0.0", "filename": "server/api/cmHopper/index.js", - "group": "/Users/andreabianco/Documents/Developments/motion-v2/server/api/cmHopper/index.js", - "groupTitle": "/Users/andreabianco/Documents/Developments/motion-v2/server/api/cmHopper/index.js" + "group": "/home/aamorese/v2/motion-v2/server/api/cmHopper/index.js", + "groupTitle": "/home/aamorese/v2/motion-v2/server/api/cmHopper/index.js" }, { "type": "delete", diff --git a/apidoc/api_data.json b/apidoc/api_data.json index 4600dba..31970f0 100644 --- a/apidoc/api_data.json +++ b/apidoc/api_data.json @@ -13,8 +13,8 @@ "name": "getTimezone", "version": "0.0.0", "filename": "server/api/cmHopper/index.js", - "group": "/Users/andreabianco/Documents/Developments/motion-v2/server/api/cmHopper/index.js", - "groupTitle": "/Users/andreabianco/Documents/Developments/motion-v2/server/api/cmHopper/index.js" + "group": "/home/aamorese/v2/motion-v2/server/api/cmHopper/index.js", + "groupTitle": "/home/aamorese/v2/motion-v2/server/api/cmHopper/index.js" }, { "type": "delete", diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 99ef6cb..b73b732 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-01-17T22:04:49.121Z", + "time": "2022-01-18T08:32:58.639Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 4916ecc..af5da7e 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-01-17T22:04:49.121Z", + "time": "2022-01-18T08:32:58.639Z", "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 be72294..ee8f18a 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 _0xd4ec=['getDataValue','action','STRING','contactManager','integration','jscripty','urlForward','browser','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','TEXT','urlForward[body]','sequelize','exports','VIRTUAL'];(function(_0x1660c3,_0x3ea35b){var _0x4709d3=function(_0x453bfe){while(--_0x453bfe){_0x1660c3['push'](_0x1660c3['shift']());}};_0x4709d3(++_0x3ea35b);}(_0xd4ec,0x1eb));var _0xcd4e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd4ec[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xcd4e('0x0'));module[_0xcd4e('0x1')]={'name':{'type':Sequelize[_0xcd4e('0x2')],'get':function(_0x1022c1){return this[_0xcd4e('0x3')](_0xcd4e('0x4'));}},'action':{'type':Sequelize[_0xcd4e('0x5')],'allowNull':![],'validate':{'isIn':{'args':[[_0xcd4e('0x6'),_0xcd4e('0x7'),'motionbar',_0xcd4e('0x8'),_0xcd4e('0x9'),_0xcd4e('0xa'),'bot',_0xcd4e('0xb')]],'msg':_0xcd4e('0xc')}},'comment':_0xcd4e('0xc')},'data1':{'type':Sequelize['STRING'](0x1000),'comment':_0xcd4e('0xd')},'data2':{'type':Sequelize['STRING'](0x1000),'comment':'contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]'},'data3':{'type':Sequelize['STRING'](0x1000),'comment':_0xcd4e('0xe')},'data4':{'type':Sequelize[_0xcd4e('0x5')](0x1000),'comments':_0xcd4e('0xf')},'data5':{'type':Sequelize[_0xcd4e('0x5')](0x1000),'comments':_0xcd4e('0x10')},'data6':{'type':Sequelize[_0xcd4e('0x5')],'comments':'urlForward[headers],\x20browser[wsindowHeight]'},'data7':{'type':Sequelize[_0xcd4e('0x11')],'comments':_0xcd4e('0x12')}}; \ No newline at end of file +var _0x7fcf=['action','contactManager','jscripty','urlForward','browser','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','STRING','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]','exports','VIRTUAL'];(function(_0x49ee70,_0x115b1e){var _0x3a7254=function(_0x1bc688){while(--_0x1bc688){_0x49ee70['push'](_0x49ee70['shift']());}};_0x3a7254(++_0x115b1e);}(_0x7fcf,0xce));var _0xf7fc=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0x7fcf[_0xc6be3a];return _0x56a310;};'use strict';var Sequelize=require('sequelize');module[_0xf7fc('0x0')]={'name':{'type':Sequelize[_0xf7fc('0x1')],'get':function(_0x340c94){return this['getDataValue'](_0xf7fc('0x2'));}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[[_0xf7fc('0x3'),'integration','motionbar',_0xf7fc('0x4'),_0xf7fc('0x5'),_0xf7fc('0x6'),'bot',_0xf7fc('0x7')]],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':_0xf7fc('0x8')},'data1':{'type':Sequelize[_0xf7fc('0x9')](0x1000),'comment':_0xf7fc('0xa')},'data2':{'type':Sequelize[_0xf7fc('0x9')](0x1000),'comment':'contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]'},'data3':{'type':Sequelize[_0xf7fc('0x9')](0x1000),'comment':_0xf7fc('0xb')},'data4':{'type':Sequelize[_0xf7fc('0x9')](0x1000),'comments':'browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]'},'data5':{'type':Sequelize[_0xf7fc('0x9')](0x1000),'comments':_0xf7fc('0xc')},'data6':{'type':Sequelize[_0xf7fc('0x9')],'comments':_0xf7fc('0xd')},'data7':{'type':Sequelize[_0xf7fc('0xe')],'comments':_0xf7fc('0xf')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 4b0eb11..2376e7e 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 _0x1a57=['ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','update','then','sendStatus','error','stack','name','body','Action','find','params','destroy','catch','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js'];(function(_0x10d619,_0x5da8f6){var _0x54cb7f=function(_0x5388db){while(--_0x5388db){_0x10d619['push'](_0x10d619['shift']());}};_0x54cb7f(++_0x5da8f6);}(_0x1a57,0x186));var _0x71a5=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x1a57[_0x413feb];return _0x40ee88;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x71a5('0x0'));var zipdir=require(_0x71a5('0x1'));var jsonpatch=require(_0x71a5('0x2'));var rp=require(_0x71a5('0x3'));var moment=require(_0x71a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x71a5('0x5'));var util=require(_0x71a5('0x6'));var path=require(_0x71a5('0x7'));var sox=require(_0x71a5('0x8'));var csv=require(_0x71a5('0x9'));var ejs=require(_0x71a5('0xa'));var fs=require('fs');var fs_extra=require(_0x71a5('0xb'));var _=require('lodash');var squel=require(_0x71a5('0xc'));var crypto=require(_0x71a5('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x71a5('0xe'));var toCsv=require(_0x71a5('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x71a5('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x71a5('0x10'));var as=require(_0x71a5('0x11'));var hardwareService=require(_0x71a5('0x12'));var logger=require(_0x71a5('0x13'))(_0x71a5('0x14'));var utils=require(_0x71a5('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x71a5('0x16'));var db=require(_0x71a5('0x17'))['db'];function respondWithStatusCode(_0x4d6b90,_0x3fa483){_0x3fa483=_0x3fa483||0xcc;return function(_0x22f236){if(_0x22f236){return _0x4d6b90['sendStatus'](_0x3fa483);}return _0x4d6b90[_0x71a5('0x18')](_0x3fa483)[_0x71a5('0x19')]();};}function respondWithResult(_0xc3af1c,_0x282f57){_0x282f57=_0x282f57||0xc8;return function(_0x448b05){if(_0x448b05){return _0xc3af1c['status'](_0x282f57)[_0x71a5('0x1a')](_0x448b05);}};}function respondWithFilteredResult(_0x42f72d,_0x33ddb7){return function(_0x27bd28){if(_0x27bd28){var _0x1b9013=typeof _0x33ddb7['offset']===_0x71a5('0x1b')&&typeof _0x33ddb7[_0x71a5('0x1c')]==='undefined';var _0x2e2488=_0x27bd28[_0x71a5('0x1d')];var _0x518a21=_0x1b9013?0x0:_0x33ddb7[_0x71a5('0x1e')];var _0x3758b0=_0x1b9013?_0x27bd28[_0x71a5('0x1d')]:_0x33ddb7[_0x71a5('0x1e')]+_0x33ddb7[_0x71a5('0x1c')];var _0x5bdbbf;if(_0x3758b0>=_0x2e2488){_0x3758b0=_0x2e2488;_0x5bdbbf=0xc8;}else{_0x5bdbbf=0xce;}_0x42f72d[_0x71a5('0x18')](_0x5bdbbf);return _0x42f72d[_0x71a5('0x1f')](_0x71a5('0x20'),_0x518a21+'-'+_0x3758b0+'/'+_0x2e2488)['json'](_0x27bd28);}return null;};}function patchUpdates(_0xe1737d){return function(_0x295eb1){try{jsonpatch['apply'](_0x295eb1,_0xe1737d,!![]);}catch(_0x4e253b){return BPromise['reject'](_0x4e253b);}return _0x295eb1['save']();};}function saveUpdates(_0x2f0205,_0x5216d2){return function(_0x36103a){if(_0x36103a){return _0x36103a[_0x71a5('0x21')](_0x2f0205)[_0x71a5('0x22')](function(_0x1d6969){return _0x1d6969;});}return null;};}function removeEntity(_0x532c44,_0x368d28){return function(_0xd9e0f3){if(_0xd9e0f3){return _0xd9e0f3['destroy']()[_0x71a5('0x22')](function(){_0x532c44[_0x71a5('0x18')](0xcc)[_0x71a5('0x19')]();});}};}function handleEntityNotFound(_0x1d3085,_0x2732ba){return function(_0x4324a7){if(!_0x4324a7){_0x1d3085[_0x71a5('0x23')](0x194);}return _0x4324a7;};}function handleError(_0x52fd53,_0x562cbe){_0x562cbe=_0x562cbe||0x1f4;return function(_0x2ba906){logger[_0x71a5('0x24')](_0x2ba906[_0x71a5('0x25')]);if(_0x2ba906[_0x71a5('0x26')]){delete _0x2ba906[_0x71a5('0x26')];}_0x52fd53[_0x71a5('0x18')](_0x562cbe)['send'](_0x2ba906);};}exports[_0x71a5('0x21')]=function(_0x3a648b,_0x49e565){if(_0x3a648b[_0x71a5('0x27')]['id']){delete _0x3a648b[_0x71a5('0x27')]['id'];}return db[_0x71a5('0x28')][_0x71a5('0x29')]({'where':{'id':_0x3a648b[_0x71a5('0x2a')]['id']}})['then'](handleEntityNotFound(_0x49e565,null))['then'](saveUpdates(_0x3a648b[_0x71a5('0x27')],null))[_0x71a5('0x22')](respondWithResult(_0x49e565,null))['catch'](handleError(_0x49e565,null));};exports[_0x71a5('0x2b')]=function(_0x4acdb9,_0x35bf08){return db[_0x71a5('0x28')][_0x71a5('0x29')]({'where':{'id':_0x4acdb9['params']['id']}})['then'](handleEntityNotFound(_0x35bf08,null))[_0x71a5('0x22')](removeEntity(_0x35bf08,null))[_0x71a5('0x2c')](handleError(_0x35bf08,null));}; \ No newline at end of file +var _0xf622=['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','undefined','limit','count','offset','Content-Range','apply','reject','then','destroy','sendStatus','error','stack','name','send','update','body','Action','find','params','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x21f7c2,_0x1b2426){var _0x3f3279=function(_0xaa480f){while(--_0xaa480f){_0x21f7c2['push'](_0x21f7c2['shift']());}};_0x3f3279(++_0x1b2426);}(_0xf622,0xfa));var _0x2f62=function(_0x3d9956,_0x3afd72){_0x3d9956=_0x3d9956-0x0;var _0x7cf682=_0xf622[_0x3d9956];return _0x7cf682;};'use strict';var emlformat=require(_0x2f62('0x0'));var rimraf=require(_0x2f62('0x1'));var zipdir=require(_0x2f62('0x2'));var jsonpatch=require(_0x2f62('0x3'));var rp=require(_0x2f62('0x4'));var moment=require(_0x2f62('0x5'));var BPromise=require(_0x2f62('0x6'));var Mustache=require('mustache');var util=require(_0x2f62('0x7'));var path=require(_0x2f62('0x8'));var sox=require(_0x2f62('0x9'));var csv=require(_0x2f62('0xa'));var ejs=require(_0x2f62('0xb'));var fs=require('fs');var fs_extra=require(_0x2f62('0xc'));var _=require(_0x2f62('0xd'));var squel=require(_0x2f62('0xe'));var crypto=require(_0x2f62('0xf'));var jsforce=require(_0x2f62('0x10'));var deskjs=require(_0x2f62('0x11'));var toCsv=require('to-csv');var querystring=require(_0x2f62('0x12'));var Papa=require(_0x2f62('0x13'));var Redis=require(_0x2f62('0x14'));var authService=require(_0x2f62('0x15'));var qs=require(_0x2f62('0x16'));var as=require(_0x2f62('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2f62('0x18'))(_0x2f62('0x19'));var utils=require(_0x2f62('0x1a'));var config=require(_0x2f62('0x1b'));var licenseUtil=require(_0x2f62('0x1c'));var db=require(_0x2f62('0x1d'))['db'];function respondWithStatusCode(_0x58345c,_0x39f8fa){_0x39f8fa=_0x39f8fa||0xcc;return function(_0x4a2315){if(_0x4a2315){return _0x58345c['sendStatus'](_0x39f8fa);}return _0x58345c[_0x2f62('0x1e')](_0x39f8fa)[_0x2f62('0x1f')]();};}function respondWithResult(_0xc5077c,_0x20bfe3){_0x20bfe3=_0x20bfe3||0xc8;return function(_0x15043c){if(_0x15043c){return _0xc5077c[_0x2f62('0x1e')](_0x20bfe3)[_0x2f62('0x20')](_0x15043c);}};}function respondWithFilteredResult(_0x27000f,_0x480a57){return function(_0x59cff0){if(_0x59cff0){var _0x1ae546=typeof _0x480a57['offset']===_0x2f62('0x21')&&typeof _0x480a57[_0x2f62('0x22')]===_0x2f62('0x21');var _0xbfd199=_0x59cff0[_0x2f62('0x23')];var _0x5bbe94=_0x1ae546?0x0:_0x480a57[_0x2f62('0x24')];var _0x3c35c9=_0x1ae546?_0x59cff0[_0x2f62('0x23')]:_0x480a57['offset']+_0x480a57[_0x2f62('0x22')];var _0xce062b;if(_0x3c35c9>=_0xbfd199){_0x3c35c9=_0xbfd199;_0xce062b=0xc8;}else{_0xce062b=0xce;}_0x27000f[_0x2f62('0x1e')](_0xce062b);return _0x27000f['set'](_0x2f62('0x25'),_0x5bbe94+'-'+_0x3c35c9+'/'+_0xbfd199)[_0x2f62('0x20')](_0x59cff0);}return null;};}function patchUpdates(_0x2dcaa2){return function(_0x2fc5d8){try{jsonpatch[_0x2f62('0x26')](_0x2fc5d8,_0x2dcaa2,!![]);}catch(_0x114a6a){return BPromise[_0x2f62('0x27')](_0x114a6a);}return _0x2fc5d8['save']();};}function saveUpdates(_0x18b34d,_0x37d4c3){return function(_0x2e34d7){if(_0x2e34d7){return _0x2e34d7['update'](_0x18b34d)[_0x2f62('0x28')](function(_0x1f6203){return _0x1f6203;});}return null;};}function removeEntity(_0x1b9771,_0x68a9d1){return function(_0x417e79){if(_0x417e79){return _0x417e79[_0x2f62('0x29')]()[_0x2f62('0x28')](function(){_0x1b9771[_0x2f62('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x243da7,_0x25260b){return function(_0x46016a){if(!_0x46016a){_0x243da7[_0x2f62('0x2a')](0x194);}return _0x46016a;};}function handleError(_0xa20a80,_0x52ae02){_0x52ae02=_0x52ae02||0x1f4;return function(_0x7706b9){logger[_0x2f62('0x2b')](_0x7706b9[_0x2f62('0x2c')]);if(_0x7706b9['name']){delete _0x7706b9[_0x2f62('0x2d')];}_0xa20a80[_0x2f62('0x1e')](_0x52ae02)[_0x2f62('0x2e')](_0x7706b9);};}exports[_0x2f62('0x2f')]=function(_0x5c5cf8,_0x3d9ad7){if(_0x5c5cf8['body']['id']){delete _0x5c5cf8[_0x2f62('0x30')]['id'];}return db[_0x2f62('0x31')][_0x2f62('0x32')]({'where':{'id':_0x5c5cf8[_0x2f62('0x33')]['id']}})[_0x2f62('0x28')](handleEntityNotFound(_0x3d9ad7,null))[_0x2f62('0x28')](saveUpdates(_0x5c5cf8[_0x2f62('0x30')],null))[_0x2f62('0x28')](respondWithResult(_0x3d9ad7,null))[_0x2f62('0x34')](handleError(_0x3d9ad7,null));};exports[_0x2f62('0x29')]=function(_0x4daae7,_0xa5fb67){return db[_0x2f62('0x31')][_0x2f62('0x32')]({'where':{'id':_0x4daae7['params']['id']}})[_0x2f62('0x28')](handleEntityNotFound(_0xa5fb67,null))['then'](removeEntity(_0xa5fb67,null))[_0x2f62('0x34')](handleError(_0xa5fb67,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 85706f4..b91a172 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 _0x4442=['exports','define','tools_actions','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x5c058a,_0x266884){var _0x419fa7=function(_0x5892ed){while(--_0x5892ed){_0x5c058a['push'](_0x5c058a['shift']());}};_0x419fa7(++_0x266884);}(_0x4442,0x1cb));var _0x2444=function(_0x408035,_0x202850){_0x408035=_0x408035-0x0;var _0x192cd5=_0x4442[_0x408035];return _0x192cd5;};'use strict';var _=require(_0x2444('0x0'));var util=require(_0x2444('0x1'));var logger=require(_0x2444('0x2'))(_0x2444('0x3'));var moment=require(_0x2444('0x4'));var BPromise=require(_0x2444('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2444('0x6'));var rimraf=require(_0x2444('0x7'));var config=require(_0x2444('0x8'));var attributes=require('./action.attributes');module[_0x2444('0x9')]=function(_0x3e5562,_0x390677){return _0x3e5562[_0x2444('0xa')]('Action',attributes,{'tableName':_0x2444('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x18b1=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./action.attributes','exports','define','tools_actions'];(function(_0x253f2a,_0x2c51f2){var _0x1c15f5=function(_0x446493){while(--_0x446493){_0x253f2a['push'](_0x253f2a['shift']());}};_0x1c15f5(++_0x2c51f2);}(_0x18b1,0x9a));var _0x118b=function(_0x257642,_0x270a80){_0x257642=_0x257642-0x0;var _0x3d813b=_0x18b1[_0x257642];return _0x3d813b;};'use strict';var _=require(_0x118b('0x0'));var util=require(_0x118b('0x1'));var logger=require(_0x118b('0x2'))(_0x118b('0x3'));var moment=require(_0x118b('0x4'));var BPromise=require(_0x118b('0x5'));var rp=require(_0x118b('0x6'));var fs=require('fs');var path=require(_0x118b('0x7'));var rimraf=require(_0x118b('0x8'));var config=require(_0x118b('0x9'));var attributes=require(_0x118b('0xa'));module[_0x118b('0xb')]=function(_0x5f5084,_0x3d63ef){return _0x5f5084[_0x118b('0xc')]('Action',attributes,{'tableName':_0x118b('0xd'),'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 397bf01..0e4822e 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 _0x814b=['info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0x4bb66f,_0x3cd682){var _0xf2772f=function(_0x2e3698){while(--_0x2e3698){_0x4bb66f['push'](_0x4bb66f['shift']());}};_0xf2772f(++_0x3cd682);}(_0x814b,0x1a2));var _0xb814=function(_0x407461,_0x1cf61c){_0x407461=_0x407461-0x0;var _0x2b3ffa=_0x814b[_0x407461];return _0x2b3ffa;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var moment=require(_0xb814('0x2'));var BPromise=require(_0xb814('0x3'));var rs=require(_0xb814('0x4'));var fs=require('fs');var Redis=require(_0xb814('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb814('0x6'));var logger=require(_0xb814('0x7'))(_0xb814('0x8'));var config=require(_0xb814('0x9'));var jayson=require(_0xb814('0xa'));var client=jayson[_0xb814('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b0829,_0x2e6272,_0x5c8539){return new BPromise(function(_0x271af9,_0x2913a6){return client[_0xb814('0xc')](_0x3b0829,_0x5c8539)[_0xb814('0xd')](function(_0x1fea33){logger[_0xb814('0xe')](_0xb814('0xf'),_0x2e6272,_0xb814('0x10'));logger[_0xb814('0x11')](_0xb814('0x12'),_0x2e6272,_0xb814('0x10'),JSON['stringify'](_0x1fea33));if(_0x1fea33[_0xb814('0x13')]){if(_0x1fea33['error'][_0xb814('0x14')]===0x1f4){logger[_0xb814('0x13')](_0xb814('0xf'),_0x2e6272,_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);return _0x2913a6(_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);}logger[_0xb814('0x13')](_0xb814('0xf'),_0x2e6272,_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);return _0x271af9(_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);}else{logger[_0xb814('0xe')](_0xb814('0xf'),_0x2e6272,_0xb814('0x10'));_0x271af9(_0x1fea33[_0xb814('0x16')][_0xb814('0x15')]);}})[_0xb814('0x17')](function(_0x21b73f){logger[_0xb814('0x13')]('Action,\x20%s,\x20%s',_0x2e6272,_0x21b73f);_0x2913a6(_0x21b73f);});});} \ No newline at end of file +var _0x5fc3=['../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','stringify','error','code','message','Action,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x52f934,_0x424005){var _0x41dcad=function(_0x31d98c){while(--_0x31d98c){_0x52f934['push'](_0x52f934['shift']());}};_0x41dcad(++_0x424005);}(_0x5fc3,0xa8));var _0x35fc=function(_0x136a0d,_0x476fe2){_0x136a0d=_0x136a0d-0x0;var _0x212ea5=_0x5fc3[_0x136a0d];return _0x212ea5;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var moment=require('moment');var BPromise=require(_0x35fc('0x2'));var rs=require(_0x35fc('0x3'));var fs=require('fs');var Redis=require(_0x35fc('0x4'));var db=require(_0x35fc('0x5'))['db'];var utils=require(_0x35fc('0x6'));var logger=require('../../config/logger')(_0x35fc('0x7'));var config=require(_0x35fc('0x8'));var jayson=require(_0x35fc('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x19a0d1,_0x508b32,_0x16e153){return new BPromise(function(_0x27524f,_0xc72d93){return client[_0x35fc('0xa')](_0x19a0d1,_0x16e153)[_0x35fc('0xb')](function(_0xf9d3a6){logger[_0x35fc('0xc')]('Action,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'));logger[_0x35fc('0xe')]('Action,\x20%s,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'),JSON[_0x35fc('0xf')](_0xf9d3a6));if(_0xf9d3a6['error']){if(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x11')]===0x1f4){logger['error']('Action,\x20%s,\x20%s',_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0xc72d93(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x12')]);}logger[_0x35fc('0x10')](_0x35fc('0x13'),_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0x27524f(_0xf9d3a6['error']['message']);}else{logger['info'](_0x35fc('0x13'),_0x508b32,_0x35fc('0xd'));_0x27524f(_0xf9d3a6[_0x35fc('0x14')][_0x35fc('0x12')]);}})[_0x35fc('0x15')](function(_0x1121fa){logger['error'](_0x35fc('0x13'),_0x508b32,_0x1121fa);_0xc72d93(_0x1121fa);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 127ddd3..42810ce 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 _0x8c37=['../../config/environment','./action.controller','put','/:id','isAuthenticated','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x4571a3,_0x29eb8b){var _0x1ba007=function(_0x2e0a45){while(--_0x2e0a45){_0x4571a3['push'](_0x4571a3['shift']());}};_0x1ba007(++_0x29eb8b);}(_0x8c37,0x157));var _0x78c3=function(_0xa3764c,_0x56490d){_0xa3764c=_0xa3764c-0x0;var _0x141301=_0x8c37[_0xa3764c];return _0x141301;};'use strict';var multer=require(_0x78c3('0x0'));var util=require(_0x78c3('0x1'));var path=require('path');var timeout=require(_0x78c3('0x2'));var express=require(_0x78c3('0x3'));var router=express[_0x78c3('0x4')]();var fs_extra=require(_0x78c3('0x5'));var auth=require(_0x78c3('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x78c3('0x7'));var controller=require(_0x78c3('0x8'));router[_0x78c3('0x9')](_0x78c3('0xa'),auth[_0x78c3('0xb')](),controller['update']);router[_0x78c3('0xc')](_0x78c3('0xa'),auth[_0x78c3('0xb')](),controller['destroy']);module[_0x78c3('0xd')]=router; \ No newline at end of file +var _0xbb18=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','put','/:id','isAuthenticated','update','exports','util','path'];(function(_0x2ad7fb,_0x457a39){var _0x4e63d1=function(_0x45fd63){while(--_0x45fd63){_0x2ad7fb['push'](_0x2ad7fb['shift']());}};_0x4e63d1(++_0x457a39);}(_0xbb18,0x16a));var _0x8bb1=function(_0x4f96b4,_0x22cc57){_0x4f96b4=_0x4f96b4-0x0;var _0x67821b=_0xbb18[_0x4f96b4];return _0x67821b;};'use strict';var multer=require('multer');var util=require(_0x8bb1('0x0'));var path=require(_0x8bb1('0x1'));var timeout=require('connect-timeout');var express=require(_0x8bb1('0x2'));var router=express['Router']();var fs_extra=require(_0x8bb1('0x3'));var auth=require(_0x8bb1('0x4'));var interaction=require(_0x8bb1('0x5'));var config=require(_0x8bb1('0x6'));var controller=require(_0x8bb1('0x7'));router[_0x8bb1('0x8')](_0x8bb1('0x9'),auth[_0x8bb1('0xa')](),controller[_0x8bb1('0xb')]);router['delete'](_0x8bb1('0x9'),auth[_0x8bb1('0xa')](),controller['destroy']);module[_0x8bb1('0xc')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 39697db..0a6dc68 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 _0xac9d=['TEXT','sequelize','exports','STRING'];(function(_0x1e2a97,_0x156023){var _0xd6dcf0=function(_0x50fea0){while(--_0x50fea0){_0x1e2a97['push'](_0x1e2a97['shift']());}};_0xd6dcf0(++_0x156023);}(_0xac9d,0x14d));var _0xdac9=function(_0x412342,_0x180734){_0x412342=_0x412342-0x0;var _0x3e62cb=_0xac9d[_0x412342];return _0x3e62cb;};'use strict';var Sequelize=require(_0xdac9('0x0'));module[_0xdac9('0x1')]={'name':{'type':Sequelize[_0xdac9('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xdac9('0x2')]},'parent':{'type':Sequelize[_0xdac9('0x2')]},'table':{'type':Sequelize[_0xdac9('0x2')]},'conditions':{'type':Sequelize[_0xdac9('0x3')]},'joins':{'type':Sequelize[_0xdac9('0x3')]}}; \ No newline at end of file +var _0x4819=['TEXT','exports','STRING'];(function(_0x24f862,_0x4b645a){var _0x198aa4=function(_0x131195){while(--_0x131195){_0x24f862['push'](_0x24f862['shift']());}};_0x198aa4(++_0x4b645a);}(_0x4819,0xcd));var _0x9481=function(_0x344e99,_0x530098){_0x344e99=_0x344e99-0x0;var _0x172d28=_0x4819[_0x344e99];return _0x172d28;};'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/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index fd45553..fb4bb28 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 _0x0bda=['table','MetricId','function','format','replace','groupBy','orderBy','DESC','alias','joins','parentKey','foreignTable','foreignKey','conditions','debug','toString','sequelize','QueryTypes','left_join','right_join','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','DATE(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20EMPTY','IS\x20NOT\x20EMPTY','findAll','metric','%s.%s\x20=\x20%s.%s','parse','clone','output','fullPath','%s-%s.%s','randomstring','generate','csv','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','select','countTable','COUNT(*)','SELECT','runReport','Limited\x20Query:','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','lodash','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','dbH','sendStatus','status','json','offset','limit','undefined','set','Content-Range','apply','reject','save','update','destroy','then','get','CustomReports','UserProfileResource','end','error','name','send','index','map','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','AnalyticCustomReport','rows','catch','params','keys','find','create','body','role','Reports','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','HOUR(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','rules','operator','group','field','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','from'];(function(_0x39de34,_0xf7f030){var _0x3dfd2c=function(_0x3b4399){while(--_0x3b4399){_0x39de34['push'](_0x39de34['shift']());}};_0x3dfd2c(++_0xf7f030);}(_0x0bda,0xda));var _0xa0bd=function(_0x248093,_0x4d9d63){_0x248093=_0x248093-0x0;var _0x23de45=_0x0bda[_0x248093];return _0x23de45;};'use strict';var emlformat=require(_0xa0bd('0x0'));var rimraf=require(_0xa0bd('0x1'));var zipdir=require(_0xa0bd('0x2'));var jsonpatch=require(_0xa0bd('0x3'));var rp=require(_0xa0bd('0x4'));var moment=require(_0xa0bd('0x5'));var BPromise=require(_0xa0bd('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xa0bd('0x7'));var sox=require(_0xa0bd('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa0bd('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa0bd('0xa'));var deskjs=require(_0xa0bd('0xb'));var toCsv=require(_0xa0bd('0xc'));var querystring=require(_0xa0bd('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa0bd('0xe'));var qs=require(_0xa0bd('0xf'));var as=require(_0xa0bd('0x10'));var hardwareService=require(_0xa0bd('0x11'));var logger=require(_0xa0bd('0x12'))(_0xa0bd('0x13'));var utils=require(_0xa0bd('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xa0bd('0x15'));var db=require(_0xa0bd('0x16'))['db'];var dbH=require(_0xa0bd('0x16'))[_0xa0bd('0x17')];function respondWithStatusCode(_0x12365b,_0x5808f3){_0x5808f3=_0x5808f3||0xcc;return function(_0x2942e8){if(_0x2942e8){return _0x12365b[_0xa0bd('0x18')](_0x5808f3);}return _0x12365b['status'](_0x5808f3)['end']();};}function respondWithResult(_0x5046bc,_0x54ee28){_0x54ee28=_0x54ee28||0xc8;return function(_0x57f0ea){if(_0x57f0ea){return _0x5046bc[_0xa0bd('0x19')](_0x54ee28)[_0xa0bd('0x1a')](_0x57f0ea);}};}function respondWithFilteredResult(_0x273f3e,_0x4c6e04){return function(_0x4f6af3){if(_0x4f6af3){var _0x1a0fa8=typeof _0x4c6e04[_0xa0bd('0x1b')]==='undefined'&&typeof _0x4c6e04[_0xa0bd('0x1c')]===_0xa0bd('0x1d');var _0x37ae54=_0x4f6af3['count'];var _0x31c3a9=_0x1a0fa8?0x0:_0x4c6e04[_0xa0bd('0x1b')];var _0x38644d=_0x1a0fa8?_0x4f6af3['count']:_0x4c6e04[_0xa0bd('0x1b')]+_0x4c6e04[_0xa0bd('0x1c')];var _0x2f0af5;if(_0x38644d>=_0x37ae54){_0x38644d=_0x37ae54;_0x2f0af5=0xc8;}else{_0x2f0af5=0xce;}_0x273f3e[_0xa0bd('0x19')](_0x2f0af5);return _0x273f3e[_0xa0bd('0x1e')](_0xa0bd('0x1f'),_0x31c3a9+'-'+_0x38644d+'/'+_0x37ae54)[_0xa0bd('0x1a')](_0x4f6af3);}return null;};}function patchUpdates(_0x4cde14){return function(_0x1bd627){try{jsonpatch[_0xa0bd('0x20')](_0x1bd627,_0x4cde14,!![]);}catch(_0xc12aae){return BPromise[_0xa0bd('0x21')](_0xc12aae);}return _0x1bd627[_0xa0bd('0x22')]();};}function saveUpdates(_0x4bf2ad,_0x21076e){return function(_0x35041e){if(_0x35041e){return _0x35041e[_0xa0bd('0x23')](_0x4bf2ad)['then'](function(_0x1d8864){return _0x1d8864;});}return null;};}function removeEntity(_0x50fae7,_0x1678e3){return function(_0x2f6b5a){if(_0x2f6b5a){return _0x2f6b5a[_0xa0bd('0x24')]()[_0xa0bd('0x25')](function(){var _0x4bbfd8=_0x2f6b5a[_0xa0bd('0x26')]({'plain':!![]});var _0x50a1eb=_0xa0bd('0x27');return db[_0xa0bd('0x28')][_0xa0bd('0x24')]({'where':{'type':_0x50a1eb,'resourceId':_0x4bbfd8['id']}})[_0xa0bd('0x25')](function(){return _0x2f6b5a;});})[_0xa0bd('0x25')](function(){_0x50fae7[_0xa0bd('0x19')](0xcc)[_0xa0bd('0x29')]();});}};}function handleEntityNotFound(_0x435316,_0x356869){return function(_0x126d9b){if(!_0x126d9b){_0x435316['sendStatus'](0x194);}return _0x126d9b;};}function handleError(_0x76deb6,_0xb1c1c3){_0xb1c1c3=_0xb1c1c3||0x1f4;return function(_0x16a3fb){logger[_0xa0bd('0x2a')](_0x16a3fb['stack']);if(_0x16a3fb[_0xa0bd('0x2b')]){delete _0x16a3fb[_0xa0bd('0x2b')];}_0x76deb6['status'](_0xb1c1c3)[_0xa0bd('0x2c')](_0x16a3fb);};}exports[_0xa0bd('0x2d')]=function(_0x1f7338,_0x47d199){var _0x5c9ec1={},_0x2c3ae7={},_0x22a8d5={'count':0x0,'rows':[]};var _0x459cdb=_[_0xa0bd('0x2e')](db['AnalyticCustomReport']['rawAttributes'],function(_0x971e70){return{'name':_0x971e70['fieldName'],'type':_0x971e70[_0xa0bd('0x2f')][_0xa0bd('0x30')]};});_0x2c3ae7[_0xa0bd('0x31')]=_[_0xa0bd('0x2e')](_0x459cdb,_0xa0bd('0x2b'));_0x2c3ae7['query']=_['keys'](_0x1f7338[_0xa0bd('0x32')]);_0x2c3ae7[_0xa0bd('0x33')]=_[_0xa0bd('0x34')](_0x2c3ae7['model'],_0x2c3ae7[_0xa0bd('0x32')]);_0x5c9ec1[_0xa0bd('0x35')]=_[_0xa0bd('0x34')](_0x2c3ae7[_0xa0bd('0x31')],qs['fields'](_0x1f7338[_0xa0bd('0x32')][_0xa0bd('0x36')]));_0x5c9ec1['attributes']=_0x5c9ec1[_0xa0bd('0x35')][_0xa0bd('0x37')]?_0x5c9ec1[_0xa0bd('0x35')]:_0x2c3ae7['model'];if(!_0x1f7338[_0xa0bd('0x32')][_0xa0bd('0x38')]('nolimit')){_0x5c9ec1[_0xa0bd('0x1c')]=qs[_0xa0bd('0x1c')](_0x1f7338[_0xa0bd('0x32')][_0xa0bd('0x1c')]);_0x5c9ec1[_0xa0bd('0x1b')]=qs[_0xa0bd('0x1b')](_0x1f7338[_0xa0bd('0x32')][_0xa0bd('0x1b')]);}_0x5c9ec1[_0xa0bd('0x39')]=qs['sort'](_0x1f7338['query'][_0xa0bd('0x3a')]);_0x5c9ec1[_0xa0bd('0x3b')]=qs[_0xa0bd('0x33')](_[_0xa0bd('0x3c')](_0x1f7338['query'],_0x2c3ae7['filters']),_0x459cdb);if(_0x1f7338[_0xa0bd('0x32')][_0xa0bd('0x3d')]){_0x5c9ec1[_0xa0bd('0x3b')]=_[_0xa0bd('0x3e')](_0x5c9ec1[_0xa0bd('0x3b')],{'$or':_['map'](_0x459cdb,function(_0x42f6b3){if(_0x42f6b3['type']!==_0xa0bd('0x3f')){var _0x33fc06={};_0x33fc06[_0x42f6b3[_0xa0bd('0x2b')]]={'$like':'%'+_0x1f7338[_0xa0bd('0x32')]['filter']+'%'};return _0x33fc06;}})});}_0x5c9ec1=_[_0xa0bd('0x3e')]({},_0x5c9ec1,_0x1f7338[_0xa0bd('0x40')]);var _0x57a645={'where':_0x5c9ec1[_0xa0bd('0x3b')]};return db['AnalyticCustomReport'][_0xa0bd('0x41')](_0x57a645)[_0xa0bd('0x25')](function(_0x514f04){_0x22a8d5[_0xa0bd('0x41')]=_0x514f04;if(_0x1f7338['query'][_0xa0bd('0x42')]){_0x5c9ec1[_0xa0bd('0x43')]=[{'all':!![]}];}return db[_0xa0bd('0x44')]['findAll'](_0x5c9ec1);})[_0xa0bd('0x25')](function(_0x2290ac){_0x22a8d5[_0xa0bd('0x45')]=_0x2290ac;return _0x22a8d5;})['then'](respondWithFilteredResult(_0x47d199,_0x5c9ec1))[_0xa0bd('0x46')](handleError(_0x47d199,null));};exports['show']=function(_0x331065,_0x395cad){var _0x119fa6={'raw':![],'where':{'id':_0x331065[_0xa0bd('0x47')]['id']}},_0x230983={};_0x230983['model']=_['keys'](db[_0xa0bd('0x44')]['rawAttributes']);_0x230983['query']=_[_0xa0bd('0x48')](_0x331065['query']);_0x230983[_0xa0bd('0x33')]=_[_0xa0bd('0x34')](_0x230983[_0xa0bd('0x31')],_0x230983[_0xa0bd('0x32')]);_0x119fa6[_0xa0bd('0x35')]=_[_0xa0bd('0x34')](_0x230983[_0xa0bd('0x31')],qs[_0xa0bd('0x36')](_0x331065[_0xa0bd('0x32')][_0xa0bd('0x36')]));_0x119fa6['attributes']=_0x119fa6['attributes'][_0xa0bd('0x37')]?_0x119fa6[_0xa0bd('0x35')]:_0x230983[_0xa0bd('0x31')];if(_0x331065['query']['includeAll']){_0x119fa6[_0xa0bd('0x43')]=[{'all':!![]}];}_0x119fa6=_[_0xa0bd('0x3e')]({},_0x119fa6,_0x331065[_0xa0bd('0x40')]);return db[_0xa0bd('0x44')][_0xa0bd('0x49')](_0x119fa6)[_0xa0bd('0x25')](handleEntityNotFound(_0x395cad,null))[_0xa0bd('0x25')](respondWithResult(_0x395cad,null))[_0xa0bd('0x46')](handleError(_0x395cad,null));};exports[_0xa0bd('0x4a')]=function(_0x4e852b,_0x307106){return db[_0xa0bd('0x44')][_0xa0bd('0x4a')](_0x4e852b[_0xa0bd('0x4b')],{})[_0xa0bd('0x25')](function(_0x50bc6b){var _0x145631=_0x4e852b['user'][_0xa0bd('0x26')]({'plain':!![]});if(!_0x145631)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x145631[_0xa0bd('0x4c')]==='user'){var _0x41ead6=_0x50bc6b[_0xa0bd('0x26')]({'plain':!![]});var _0x1002ae=_0xa0bd('0x4d');return db['UserProfileSection'][_0xa0bd('0x49')]({'where':{'name':_0x1002ae,'userProfileId':_0x145631[_0xa0bd('0x4e')]},'raw':!![]})[_0xa0bd('0x25')](function(_0x3b071b){if(_0x3b071b&&_0x3b071b['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x41ead6['name'],'resourceId':_0x41ead6['id'],'type':_0xa0bd('0x27'),'sectionId':_0x3b071b['id']},{})[_0xa0bd('0x25')](function(){return _0x50bc6b;});}else{return _0x50bc6b;}})[_0xa0bd('0x46')](function(_0xb397e){logger[_0xa0bd('0x2a')](_0xa0bd('0x4f'),_0xb397e);throw _0xb397e;});}return _0x50bc6b;})[_0xa0bd('0x25')](respondWithResult(_0x307106,0xc9))[_0xa0bd('0x46')](handleError(_0x307106,null));};exports[_0xa0bd('0x23')]=function(_0x58a4ab,_0x4cd199){if(_0x58a4ab[_0xa0bd('0x4b')]['id']){delete _0x58a4ab[_0xa0bd('0x4b')]['id'];}return db[_0xa0bd('0x44')]['find']({'where':{'id':_0x58a4ab[_0xa0bd('0x47')]['id']}})[_0xa0bd('0x25')](handleEntityNotFound(_0x4cd199,null))[_0xa0bd('0x25')](saveUpdates(_0x58a4ab['body'],null))['then'](respondWithResult(_0x4cd199,null))[_0xa0bd('0x46')](handleError(_0x4cd199,null));};exports[_0xa0bd('0x24')]=function(_0x373c9b,_0x501c91){return db[_0xa0bd('0x44')][_0xa0bd('0x49')]({'where':{'id':_0x373c9b['params']['id']}})[_0xa0bd('0x25')](handleEntityNotFound(_0x501c91,null))[_0xa0bd('0x25')](removeEntity(_0x501c91,null))['catch'](handleError(_0x501c91,null));};exports[_0xa0bd('0x50')]=function(_0x4d03a4,_0x28074a){var _0xee2e41=0xa;var _0x5a5973=[_0xa0bd('0x51'),'left_join','right_join',_0xa0bd('0x52')];var _0x1c6cc0={'SUM':_0xa0bd('0x53'),'COUNT':_0xa0bd('0x54'),'COUNT DISTINCT':_0xa0bd('0x55'),'MAX':_0xa0bd('0x56'),'MIN':_0xa0bd('0x57'),'AVG':_0xa0bd('0x58'),'GROUP_CONCAT':_0xa0bd('0x59'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xa0bd('0x5a')};var _0x1829d3={'SEC_TO_TIME':_0xa0bd('0x5b'),'DATE':'DATE(%s)','HOUR':_0xa0bd('0x5c'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x58dc09=function(_0x266a67){return!_[_0xa0bd('0x5d')]([_0xa0bd('0x5e'),_0xa0bd('0x5f'),'IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0x266a67);};var _0x1353fd=function(_0x58d31f){if(!_0x58d31f||!_0x58d31f['rules'][_0xa0bd('0x37')]){return'';}for(var _0x1b6f83='(',_0x5de1fc=0x0;_0x5de1fc<_0x58d31f[_0xa0bd('0x60')][_0xa0bd('0x37')];_0x5de1fc+=0x1){_0x5de1fc>0x0&&(_0x1b6f83+='\x20'+_0x58d31f[_0xa0bd('0x61')]+'\x20');_0x1b6f83+=_0x58d31f[_0xa0bd('0x60')][_0x5de1fc][_0xa0bd('0x62')]?_0x1353fd(_0x58d31f[_0xa0bd('0x60')][_0x5de1fc][_0xa0bd('0x62')]):_0x58d31f[_0xa0bd('0x60')][_0x5de1fc][_0xa0bd('0x63')]+'\x20'+_0x58d31f[_0xa0bd('0x60')][_0x5de1fc][_0xa0bd('0x64')]+(_0x58dc09(_0x58d31f[_0xa0bd('0x60')][_0x5de1fc]['condition'])?'\x20'+_0x58d31f[_0xa0bd('0x60')][_0x5de1fc][_0xa0bd('0x65')]:'');}return _0x1b6f83+')';};var _0x24feff={'where':{'id':_0x4d03a4[_0xa0bd('0x47')]['id']}},_0x3133a1,_0x42f75c,_0x1f3935,_0x6d65fd,_0x7c975c;_0x24feff=_[_0xa0bd('0x3e')]({},_0x24feff,_0x4d03a4['options']);return db['AnalyticCustomReport'][_0xa0bd('0x49')](_0x24feff)['then'](function(_0x4aa3e3){if(_0x4aa3e3){_0x3133a1=_0x4aa3e3;return _0x4aa3e3[_0xa0bd('0x66')]();}return null;})['then'](function(_0x31efcb){if(_0x31efcb){if(!_0x31efcb[_0xa0bd('0x37')]){throw new db[(_0xa0bd('0x67'))][(_0xa0bd('0x68'))](_0xa0bd('0x69'),0x193);}_0x42f75c=_0x31efcb;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0xa0bd('0x25')](function(_0x45e864){if(_0x45e864){_0x1f3935=_[_0xa0bd('0x6a')](_0x45e864,'id');var _0x4d3beb;var _0xcf3bc9=squel['select']();_0xcf3bc9[_0xa0bd('0x6b')](_0x3133a1[_0xa0bd('0x6c')]);for(var _0x17528c=0x0;_0x17528c<_0x42f75c['length'];_0x17528c+=0x1){_0x4d3beb=_0x42f75c[_0x17528c][_0xa0bd('0x6d')]?_0x1f3935[_0x42f75c[_0x17528c]['MetricId']]['metric']:_0x42f75c[_0x17528c][_0xa0bd('0x63')];_0x4d3beb=_0x42f75c[_0x17528c]['function']?_['replace'](_0x1c6cc0[_0x42f75c[_0x17528c][_0xa0bd('0x6e')]],'%s',_0x4d3beb):_0x4d3beb;_0x4d3beb=_0x42f75c[_0x17528c][_0xa0bd('0x6f')]?_[_0xa0bd('0x70')](_0x1829d3[_0x42f75c[_0x17528c][_0xa0bd('0x6f')]],'%s',_0x4d3beb):_0x4d3beb;if(_0x42f75c[_0x17528c][_0xa0bd('0x71')]){_0xcf3bc9[_0xa0bd('0x62')](_0x4d3beb);}_0x42f75c[_0x17528c]['orderBy']&&_0xcf3bc9[_0xa0bd('0x39')](_0x4d3beb,_0x42f75c[_0x17528c][_0xa0bd('0x72')]===_0xa0bd('0x73')?![]:!![]);_0xcf3bc9[_0xa0bd('0x63')](_0x4d3beb,_0x42f75c[_0x17528c][_0xa0bd('0x74')]||_0x4d3beb);}if(_0x3133a1[_0xa0bd('0x75')]){_0x3133a1[_0xa0bd('0x75')]=JSON['parse'](_0x3133a1[_0xa0bd('0x75')]);for(var _0x1c5397=0x0;_0x1c5397<_0x3133a1[_0xa0bd('0x75')][_0xa0bd('0x37')];_0x1c5397+=0x1){if(_0x3133a1['joins'][_0x1c5397][_0xa0bd('0x2f')]&&_[_0xa0bd('0x5d')](_0x5a5973,_0x3133a1[_0xa0bd('0x75')][_0x1c5397]['type'])&&_0x3133a1['joins'][_0x1c5397][_0xa0bd('0x76')]&&_0x3133a1[_0xa0bd('0x75')][_0x1c5397]['foreignTable']&&_0x3133a1[_0xa0bd('0x75')][_0x1c5397]['foreignKey']){_0xcf3bc9[_0x3133a1['joins'][_0x1c5397][_0xa0bd('0x2f')]](_0x3133a1[_0xa0bd('0x75')][_0x1c5397][_0xa0bd('0x77')],null,util[_0xa0bd('0x6f')]('%s.%s\x20=\x20%s.%s',_0x3133a1['table'],_0x3133a1['joins'][_0x1c5397]['parentKey'],_0x3133a1[_0xa0bd('0x75')][_0x1c5397][_0xa0bd('0x77')],_0x3133a1[_0xa0bd('0x75')][_0x1c5397][_0xa0bd('0x78')]));}}}if(_0x3133a1[_0xa0bd('0x79')]){_0x3133a1['conditions']=JSON['parse'](_0x3133a1[_0xa0bd('0x79')]);_0xcf3bc9[_0xa0bd('0x3b')](_0x1353fd(_0x3133a1[_0xa0bd('0x79')][_0xa0bd('0x62')]));}_0x7c975c=_0xcf3bc9['clone']();_0xcf3bc9[_0xa0bd('0x1c')](_0xee2e41);_0xcf3bc9['offset'](0x0);logger[_0xa0bd('0x7a')]('Limited\x20Query:',_0xcf3bc9[_0xa0bd('0x7b')]());return dbH[_0xa0bd('0x7c')][_0xa0bd('0x32')](_0xcf3bc9['toString'](),{'type':dbH[_0xa0bd('0x7c')][_0xa0bd('0x7d')]['SELECT']});}})['then'](respondWithResult(_0x28074a,null))[_0xa0bd('0x46')](handleError(_0x28074a,null));};function runReport(_0x52a2c4,_0x1d3c9c,_0x3d168b){var _0x744f26=_0x1d3c9c['name'];var _0x188b6f=0xa;var _0x24dd01=[_0xa0bd('0x51'),_0xa0bd('0x7e'),_0xa0bd('0x7f'),_0xa0bd('0x52')];var _0xa1d3a={'SUM':_0xa0bd('0x53'),'COUNT':_0xa0bd('0x54'),'COUNT DISTINCT':_0xa0bd('0x55'),'MAX':_0xa0bd('0x56'),'MIN':'MIN(%s)','AVG':_0xa0bd('0x58'),'GROUP_CONCAT':_0xa0bd('0x59'),'GROUP_CONCAT ASC':_0xa0bd('0x80'),'GROUP_CONCAT DESC':_0xa0bd('0x5a')};var _0x3336ac={'SEC_TO_TIME':_0xa0bd('0x5b'),'DATE':_0xa0bd('0x81'),'HOUR':_0xa0bd('0x5c'),'ROUND':_0xa0bd('0x82'),'UNIX_TIMESTAMP':_0xa0bd('0x83')};var _0x10be38=function(_0x4f32ad){return!_['includes']([_0xa0bd('0x5e'),_0xa0bd('0x5f'),_0xa0bd('0x84'),_0xa0bd('0x85')],_0x4f32ad);};var _0x3e42e=function(_0x4967f1){if(!_0x4967f1||!_0x4967f1[_0xa0bd('0x60')][_0xa0bd('0x37')]){return'';}for(var _0x53f4a1='(',_0xbf5f44=0x0;_0xbf5f44<_0x4967f1[_0xa0bd('0x60')][_0xa0bd('0x37')];_0xbf5f44+=0x1){_0xbf5f44>0x0&&(_0x53f4a1+='\x20'+_0x4967f1['operator']+'\x20');_0x53f4a1+=_0x4967f1[_0xa0bd('0x60')][_0xbf5f44][_0xa0bd('0x62')]?_0x3e42e(_0x4967f1[_0xa0bd('0x60')][_0xbf5f44][_0xa0bd('0x62')]):_0x4967f1['rules'][_0xbf5f44][_0xa0bd('0x63')]+'\x20'+_0x4967f1[_0xa0bd('0x60')][_0xbf5f44][_0xa0bd('0x64')]+(_0x10be38(_0x4967f1[_0xa0bd('0x60')][_0xbf5f44]['condition'])?'\x20'+_0x4967f1[_0xa0bd('0x60')][_0xbf5f44][_0xa0bd('0x65')]:'');}return _0x53f4a1+')';};var _0x4b917d={'where':{'id':_0x52a2c4['id']}},_0x22d752,_0x225c08,_0x1231ce,_0x5bcb3f,_0x13edff;_0x4b917d=_['merge']({},_0x4b917d,_0x3d168b);return db[_0xa0bd('0x44')]['find'](_0x4b917d)['then'](function(_0x597562){if(_0x597562){_0x22d752=_0x597562;return _0x597562['getFields']();}return null;})[_0xa0bd('0x25')](function(_0xbd6e3a){if(_0xbd6e3a){if(!_0xbd6e3a[_0xa0bd('0x37')]){throw new db[(_0xa0bd('0x67'))][(_0xa0bd('0x68'))](_0xa0bd('0x69'),0x193);}_0x225c08=_0xbd6e3a;return db['AnalyticMetric'][_0xa0bd('0x86')]({'raw':!![]});}return null;})['then'](function(_0x242c69){if(_0x242c69){_0x1231ce=_[_0xa0bd('0x6a')](_0x242c69,'id');var _0xf239e9;var _0x3ada6=squel['select']();_0x3ada6['from'](_0x22d752[_0xa0bd('0x6c')]);for(var _0x174611=0x0;_0x174611<_0x225c08[_0xa0bd('0x37')];_0x174611+=0x1){_0xf239e9=_0x225c08[_0x174611][_0xa0bd('0x6d')]?_0x1231ce[_0x225c08[_0x174611][_0xa0bd('0x6d')]][_0xa0bd('0x87')]:_0x225c08[_0x174611]['field'];_0xf239e9=_0x225c08[_0x174611][_0xa0bd('0x6e')]?_[_0xa0bd('0x70')](_0xa1d3a[_0x225c08[_0x174611][_0xa0bd('0x6e')]],'%s',_0xf239e9):_0xf239e9;_0xf239e9=_0x225c08[_0x174611][_0xa0bd('0x6f')]?_[_0xa0bd('0x70')](_0x3336ac[_0x225c08[_0x174611]['format']],'%s',_0xf239e9):_0xf239e9;if(_0x225c08[_0x174611][_0xa0bd('0x71')]){_0x3ada6[_0xa0bd('0x62')](_0xf239e9);}_0x225c08[_0x174611][_0xa0bd('0x72')]&&_0x3ada6[_0xa0bd('0x39')](_0xf239e9,_0x225c08[_0x174611]['orderBy']===_0xa0bd('0x73')?![]:!![]);_0x3ada6[_0xa0bd('0x63')](_0xf239e9,_0x225c08[_0x174611][_0xa0bd('0x74')]||_0xf239e9);}if(_0x22d752[_0xa0bd('0x75')]){_0x22d752[_0xa0bd('0x75')]=JSON['parse'](_0x22d752['joins']);for(var _0x313ff7=0x0;_0x313ff7<_0x22d752[_0xa0bd('0x75')]['length'];_0x313ff7+=0x1){if(_0x22d752[_0xa0bd('0x75')][_0x313ff7][_0xa0bd('0x2f')]&&_['includes'](_0x24dd01,_0x22d752[_0xa0bd('0x75')][_0x313ff7][_0xa0bd('0x2f')])&&_0x22d752['joins'][_0x313ff7][_0xa0bd('0x76')]&&_0x22d752[_0xa0bd('0x75')][_0x313ff7][_0xa0bd('0x77')]&&_0x22d752['joins'][_0x313ff7]['foreignKey']){_0x3ada6[_0x22d752[_0xa0bd('0x75')][_0x313ff7][_0xa0bd('0x2f')]](_0x22d752[_0xa0bd('0x75')][_0x313ff7]['foreignTable'],null,util[_0xa0bd('0x6f')](_0xa0bd('0x88'),_0x22d752['table'],_0x22d752['joins'][_0x313ff7][_0xa0bd('0x76')],_0x22d752[_0xa0bd('0x75')][_0x313ff7][_0xa0bd('0x77')],_0x22d752[_0xa0bd('0x75')][_0x313ff7]['foreignKey']));}}}if(_0x22d752['conditions']){_0x22d752[_0xa0bd('0x79')]=JSON[_0xa0bd('0x89')](_0x22d752[_0xa0bd('0x79')]);_0x3ada6[_0xa0bd('0x3b')](_0x3e42e(_0x22d752['conditions'][_0xa0bd('0x62')]));}_0x13edff=_0x3ada6[_0xa0bd('0x8a')]();_0x3ada6[_0xa0bd('0x1c')](_0x188b6f);_0x3ada6[_0xa0bd('0x1b')](0x0);return;}})[_0xa0bd('0x25')](function(){if(_0x1d3c9c[_0xa0bd('0x8b')]==='web'){return null;}var _0xc654f9=_[_0xa0bd('0x3e')](_0x1d3c9c,{'name':_0x1d3c9c[_0xa0bd('0x8c')]||_0x1d3c9c[_0xa0bd('0x2b')]||_0x22d752[_0xa0bd('0x2b')],'basename':_0x744f26,'savename':util[_0xa0bd('0x6f')](_0xa0bd('0x8d'),_0x1d3c9c['name']||_0x22d752[_0xa0bd('0x2b')],require(_0xa0bd('0x8e'))[_0xa0bd('0x8f')](0x4),_0x1d3c9c[_0xa0bd('0x8b')]||_0xa0bd('0x90')),'reportId':_0x22d752['id'],'reportType':_0xa0bd('0x91')});return db[_0xa0bd('0x92')][_0xa0bd('0x4a')](_0xc654f9,{'raw':!![]});})[_0xa0bd('0x25')](function(_0x13087e){if(_0x22d752[_0xa0bd('0x6c')]===_0xa0bd('0x93')){_0x13edff[_0xa0bd('0x3b')](_0x22d752[_0xa0bd('0x6c')]+_0xa0bd('0x94'),_0x1d3c9c[_0xa0bd('0x95')],_0x1d3c9c[_0xa0bd('0x96')]);}else{_0x13edff['where'](_0x22d752[_0xa0bd('0x6c')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x1d3c9c[_0xa0bd('0x95')],_0x1d3c9c[_0xa0bd('0x96')]);}if(_0x13087e){logger[_0xa0bd('0x97')](_0xa0bd('0x98'),_0x13edff[_0xa0bd('0x7b')]());require(_0xa0bd('0x99'))[_0xa0bd('0x9a')](path[_0xa0bd('0x51')](__dirname,_0xa0bd('0x9b'),_0x13087e[_0xa0bd('0x8b')]),[_0x13087e['id'],_0x13edff['toString'](),path['join'](__dirname,_0xa0bd('0x9c'),_0x13087e['savename']),_0x744f26]);return _0x13087e;}else{var _0x21e0b4=squel[_0xa0bd('0x9d')]();_0x21e0b4[_0xa0bd('0x6b')]('('+_0x13edff[_0xa0bd('0x7b')]()+')',_0xa0bd('0x9e'));_0x21e0b4['field'](_0xa0bd('0x9f'),_0xa0bd('0x41'));_0x13edff[_0xa0bd('0x1c')](_0x1d3c9c[_0xa0bd('0x1c')]||_0x188b6f);_0x13edff[_0xa0bd('0x1b')](_0x1d3c9c['offset']||0x0);return dbH['sequelize'][_0xa0bd('0x32')](_0x21e0b4[_0xa0bd('0x7b')](),{'type':dbH[_0xa0bd('0x7c')][_0xa0bd('0x7d')][_0xa0bd('0xa0')]})[_0xa0bd('0x25')](function(_0x37e30d){if(!_0x37e30d[_0xa0bd('0x37')]){_0x5bcb3f=0x0;}else{_0x5bcb3f=_0x37e30d[0x0][_0xa0bd('0x41')]||0x0;}return dbH[_0xa0bd('0x7c')][_0xa0bd('0x32')](_0x13edff[_0xa0bd('0x7b')](),{'type':dbH[_0xa0bd('0x7c')][_0xa0bd('0x7d')]['SELECT']});})[_0xa0bd('0x25')](function(_0x55332d){return{'rows':_0x55332d||[],'count':_0x5bcb3f};});}});}exports['run']=function(_0x239c86,_0x22d88f){return runReport(_0x239c86[_0xa0bd('0x47')],_0x239c86[_0xa0bd('0x32')],_0x239c86[_0xa0bd('0x40')])[_0xa0bd('0x25')](respondWithResult(_0x22d88f,null))[_0xa0bd('0x46')](handleError(_0x22d88f,null));};exports[_0xa0bd('0xa1')]=runReport;exports[_0xa0bd('0x32')]=function(_0x4fa91c,_0x3d521d){var _0x10027d=0xa;var _0x1f34b3=[_0xa0bd('0x51'),'left_join','right_join',_0xa0bd('0x52')];var _0x354d2c={'SUM':_0xa0bd('0x53'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':_0xa0bd('0x58'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xa0bd('0x80'),'GROUP_CONCAT DESC':_0xa0bd('0x5a')};var _0x13996a={'SEC_TO_TIME':_0xa0bd('0x5b'),'DATE':_0xa0bd('0x81'),'HOUR':'HOUR(%s)','ROUND':_0xa0bd('0x82'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x3740f3=function(_0x275435){return!_['includes'](['IS\x20NULL',_0xa0bd('0x5f'),_0xa0bd('0x84'),'IS\x20NOT\x20EMPTY'],_0x275435);};var _0x5b32b3=function(_0x3f64eb){if(!_0x3f64eb||!_0x3f64eb[_0xa0bd('0x60')][_0xa0bd('0x37')]){return'';}for(var _0x2f2edf='(',_0x1c461a=0x0;_0x1c461a<_0x3f64eb['rules'][_0xa0bd('0x37')];_0x1c461a+=0x1){_0x1c461a>0x0&&(_0x2f2edf+='\x20'+_0x3f64eb[_0xa0bd('0x61')]+'\x20');_0x2f2edf+=_0x3f64eb[_0xa0bd('0x60')][_0x1c461a][_0xa0bd('0x62')]?_0x5b32b3(_0x3f64eb[_0xa0bd('0x60')][_0x1c461a][_0xa0bd('0x62')]):_0x3f64eb['rules'][_0x1c461a][_0xa0bd('0x63')]+'\x20'+_0x3f64eb[_0xa0bd('0x60')][_0x1c461a]['condition']+(_0x3740f3(_0x3f64eb[_0xa0bd('0x60')][_0x1c461a][_0xa0bd('0x64')])?'\x20'+_0x3f64eb[_0xa0bd('0x60')][_0x1c461a]['value']:'');}return _0x2f2edf+')';};var _0x1c0e30={'where':{'id':_0x4fa91c[_0xa0bd('0x47')]['id']}},_0x339e4e,_0x575d2f,_0x1397bb,_0x5b2d7a,_0x521a1f;_0x1c0e30=_[_0xa0bd('0x3e')]({},_0x1c0e30,_0x4fa91c['options']);return db[_0xa0bd('0x44')]['find'](_0x1c0e30)[_0xa0bd('0x25')](function(_0x581f1e){if(_0x581f1e){_0x339e4e=_0x581f1e;return _0x581f1e[_0xa0bd('0x66')]();}return null;})[_0xa0bd('0x25')](function(_0x11be76){if(_0x11be76){if(!_0x11be76['length']){throw new db[(_0xa0bd('0x67'))][(_0xa0bd('0x68'))](_0xa0bd('0x69'),0x193);}_0x575d2f=_0x11be76;return db['AnalyticMetric'][_0xa0bd('0x86')]({'raw':!![]});}return null;})['then'](function(_0x6a74ef){if(_0x6a74ef){_0x1397bb=_[_0xa0bd('0x6a')](_0x6a74ef,'id');var _0xb6ec47;var _0x2eaf99=squel[_0xa0bd('0x9d')]();_0x2eaf99['from'](_0x339e4e[_0xa0bd('0x6c')]);for(var _0x44203f=0x0;_0x44203f<_0x575d2f['length'];_0x44203f+=0x1){_0xb6ec47=_0x575d2f[_0x44203f]['MetricId']?_0x1397bb[_0x575d2f[_0x44203f][_0xa0bd('0x6d')]][_0xa0bd('0x87')]:_0x575d2f[_0x44203f][_0xa0bd('0x63')];_0xb6ec47=_0x575d2f[_0x44203f][_0xa0bd('0x6e')]?_[_0xa0bd('0x70')](_0x354d2c[_0x575d2f[_0x44203f][_0xa0bd('0x6e')]],'%s',_0xb6ec47):_0xb6ec47;_0xb6ec47=_0x575d2f[_0x44203f][_0xa0bd('0x6f')]?_[_0xa0bd('0x70')](_0x13996a[_0x575d2f[_0x44203f][_0xa0bd('0x6f')]],'%s',_0xb6ec47):_0xb6ec47;if(_0x575d2f[_0x44203f][_0xa0bd('0x71')]){_0x2eaf99[_0xa0bd('0x62')](_0xb6ec47);}_0x575d2f[_0x44203f]['orderBy']&&_0x2eaf99[_0xa0bd('0x39')](_0xb6ec47,_0x575d2f[_0x44203f]['orderBy']===_0xa0bd('0x73')?![]:!![]);_0x2eaf99[_0xa0bd('0x63')](_0xb6ec47,_0x575d2f[_0x44203f][_0xa0bd('0x74')]||_0xb6ec47);}if(_0x339e4e['joins']){_0x339e4e[_0xa0bd('0x75')]=JSON['parse'](_0x339e4e[_0xa0bd('0x75')]);for(var _0x560a45=0x0;_0x560a45<_0x339e4e[_0xa0bd('0x75')][_0xa0bd('0x37')];_0x560a45+=0x1){if(_0x339e4e[_0xa0bd('0x75')][_0x560a45][_0xa0bd('0x2f')]&&_[_0xa0bd('0x5d')](_0x1f34b3,_0x339e4e[_0xa0bd('0x75')][_0x560a45][_0xa0bd('0x2f')])&&_0x339e4e[_0xa0bd('0x75')][_0x560a45][_0xa0bd('0x76')]&&_0x339e4e[_0xa0bd('0x75')][_0x560a45]['foreignTable']&&_0x339e4e[_0xa0bd('0x75')][_0x560a45][_0xa0bd('0x78')]){_0x2eaf99[_0x339e4e['joins'][_0x560a45][_0xa0bd('0x2f')]](_0x339e4e[_0xa0bd('0x75')][_0x560a45][_0xa0bd('0x77')],null,util[_0xa0bd('0x6f')]('%s.%s\x20=\x20%s.%s',_0x339e4e[_0xa0bd('0x6c')],_0x339e4e[_0xa0bd('0x75')][_0x560a45][_0xa0bd('0x76')],_0x339e4e[_0xa0bd('0x75')][_0x560a45][_0xa0bd('0x77')],_0x339e4e['joins'][_0x560a45][_0xa0bd('0x78')]));}}}if(_0x339e4e[_0xa0bd('0x79')]){_0x339e4e[_0xa0bd('0x79')]=JSON[_0xa0bd('0x89')](_0x339e4e['conditions']);_0x2eaf99['where'](_0x5b32b3(_0x339e4e[_0xa0bd('0x79')]['group']));}_0x521a1f=_0x2eaf99[_0xa0bd('0x8a')]();_0x2eaf99[_0xa0bd('0x1c')](_0x10027d);_0x2eaf99[_0xa0bd('0x1b')](0x0);logger['debug'](_0xa0bd('0xa2'),_0x2eaf99[_0xa0bd('0x7b')]());return dbH['sequelize'][_0xa0bd('0x32')](_0x2eaf99[_0xa0bd('0x7b')](),{'type':dbH[_0xa0bd('0x7c')]['QueryTypes'][_0xa0bd('0xa0')]});}})[_0xa0bd('0x25')](function(){return{'sql':_0x521a1f['toString']()};})['then'](respondWithResult(_0x3d521d,null))[_0xa0bd('0x46')](handleError(_0x3d521d,null));}; \ No newline at end of file +var _0xeae6=['sequelize','SELECT','join','cross_join','COUNT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','DATE(%s)','Sequelize','from','MetricId','output','web','%s-%s.%s','randomstring','generate','AnalyticExtractedReport','cdr','startDate','endDate','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','QueryTypes','run','runReport','ROUND(%s)','keyBy','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','api','../../config/utils','../../config/license/util','../../mysqldb','dbH','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','CustomReports','sendStatus','error','name','send','index','map','AnalyticCustomReport','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','show','length','options','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','Reports','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','left_join','right_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','operator','rules','group','field','condition','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','select','metric','function','replace','format','groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','table','conditions','clone','debug','Limited\x20Query:','toString'];(function(_0x5783f4,_0x4a9e0a){var _0x28e380=function(_0x1ffc49){while(--_0x1ffc49){_0x5783f4['push'](_0x5783f4['shift']());}};_0x28e380(++_0x4a9e0a);}(_0xeae6,0xc3));var _0x6eae=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xeae6[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x6eae('0x0'));var rimraf=require(_0x6eae('0x1'));var zipdir=require(_0x6eae('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6eae('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x6eae('0x4'));var util=require(_0x6eae('0x5'));var path=require(_0x6eae('0x6'));var sox=require(_0x6eae('0x7'));var csv=require(_0x6eae('0x8'));var ejs=require(_0x6eae('0x9'));var fs=require('fs');var fs_extra=require(_0x6eae('0xa'));var _=require(_0x6eae('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x6eae('0xc'));var deskjs=require(_0x6eae('0xd'));var toCsv=require('to-csv');var querystring=require(_0x6eae('0xe'));var Papa=require(_0x6eae('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6eae('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6eae('0x11'));var utils=require(_0x6eae('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x6eae('0x13'));var db=require(_0x6eae('0x14'))['db'];var dbH=require(_0x6eae('0x14'))[_0x6eae('0x15')];function respondWithStatusCode(_0x118bc0,_0x1d86ac){_0x1d86ac=_0x1d86ac||0xcc;return function(_0x18f2ee){if(_0x18f2ee){return _0x118bc0['sendStatus'](_0x1d86ac);}return _0x118bc0[_0x6eae('0x16')](_0x1d86ac)[_0x6eae('0x17')]();};}function respondWithResult(_0x147b90,_0x275024){_0x275024=_0x275024||0xc8;return function(_0x18c008){if(_0x18c008){return _0x147b90[_0x6eae('0x16')](_0x275024)[_0x6eae('0x18')](_0x18c008);}};}function respondWithFilteredResult(_0x350393,_0x1157c1){return function(_0x18cb2d){if(_0x18cb2d){var _0x36b0fd=typeof _0x1157c1[_0x6eae('0x19')]===_0x6eae('0x1a')&&typeof _0x1157c1[_0x6eae('0x1b')]===_0x6eae('0x1a');var _0x455a62=_0x18cb2d[_0x6eae('0x1c')];var _0x220e49=_0x36b0fd?0x0:_0x1157c1[_0x6eae('0x19')];var _0x227e4d=_0x36b0fd?_0x18cb2d[_0x6eae('0x1c')]:_0x1157c1[_0x6eae('0x19')]+_0x1157c1[_0x6eae('0x1b')];var _0x1834b8;if(_0x227e4d>=_0x455a62){_0x227e4d=_0x455a62;_0x1834b8=0xc8;}else{_0x1834b8=0xce;}_0x350393[_0x6eae('0x16')](_0x1834b8);return _0x350393[_0x6eae('0x1d')](_0x6eae('0x1e'),_0x220e49+'-'+_0x227e4d+'/'+_0x455a62)[_0x6eae('0x18')](_0x18cb2d);}return null;};}function patchUpdates(_0x4ecd58){return function(_0x2ca50c){try{jsonpatch[_0x6eae('0x1f')](_0x2ca50c,_0x4ecd58,!![]);}catch(_0xbf38cc){return BPromise[_0x6eae('0x20')](_0xbf38cc);}return _0x2ca50c[_0x6eae('0x21')]();};}function saveUpdates(_0x1b3061,_0x5a43c1){return function(_0x1d89c4){if(_0x1d89c4){return _0x1d89c4[_0x6eae('0x22')](_0x1b3061)[_0x6eae('0x23')](function(_0x15adf2){return _0x15adf2;});}return null;};}function removeEntity(_0x39e6d0,_0x4468db){return function(_0x4367eb){if(_0x4367eb){return _0x4367eb[_0x6eae('0x24')]()[_0x6eae('0x23')](function(){var _0x34b2b8=_0x4367eb['get']({'plain':!![]});var _0x15628e=_0x6eae('0x25');return db['UserProfileResource'][_0x6eae('0x24')]({'where':{'type':_0x15628e,'resourceId':_0x34b2b8['id']}})['then'](function(){return _0x4367eb;});})[_0x6eae('0x23')](function(){_0x39e6d0['status'](0xcc)[_0x6eae('0x17')]();});}};}function handleEntityNotFound(_0x3242b1,_0x152cb3){return function(_0x399b1e){if(!_0x399b1e){_0x3242b1[_0x6eae('0x26')](0x194);}return _0x399b1e;};}function handleError(_0x18e50b,_0x501143){_0x501143=_0x501143||0x1f4;return function(_0x4d1253){logger[_0x6eae('0x27')](_0x4d1253['stack']);if(_0x4d1253['name']){delete _0x4d1253[_0x6eae('0x28')];}_0x18e50b['status'](_0x501143)[_0x6eae('0x29')](_0x4d1253);};}exports[_0x6eae('0x2a')]=function(_0x4b3bb6,_0x5931fc){var _0x433c13={},_0x510800={},_0x3421a7={'count':0x0,'rows':[]};var _0x32a0ea=_[_0x6eae('0x2b')](db[_0x6eae('0x2c')][_0x6eae('0x2d')],function(_0x33bd3a){return{'name':_0x33bd3a[_0x6eae('0x2e')],'type':_0x33bd3a['type'][_0x6eae('0x2f')]};});_0x510800[_0x6eae('0x30')]=_[_0x6eae('0x2b')](_0x32a0ea,_0x6eae('0x28'));_0x510800[_0x6eae('0x31')]=_[_0x6eae('0x32')](_0x4b3bb6[_0x6eae('0x31')]);_0x510800['filters']=_[_0x6eae('0x33')](_0x510800[_0x6eae('0x30')],_0x510800[_0x6eae('0x31')]);_0x433c13['attributes']=_['intersection'](_0x510800[_0x6eae('0x30')],qs[_0x6eae('0x34')](_0x4b3bb6['query'][_0x6eae('0x34')]));_0x433c13[_0x6eae('0x35')]=_0x433c13[_0x6eae('0x35')]['length']?_0x433c13[_0x6eae('0x35')]:_0x510800[_0x6eae('0x30')];if(!_0x4b3bb6[_0x6eae('0x31')]['hasOwnProperty']('nolimit')){_0x433c13['limit']=qs['limit'](_0x4b3bb6[_0x6eae('0x31')][_0x6eae('0x1b')]);_0x433c13[_0x6eae('0x19')]=qs[_0x6eae('0x19')](_0x4b3bb6[_0x6eae('0x31')][_0x6eae('0x19')]);}_0x433c13[_0x6eae('0x36')]=qs['sort'](_0x4b3bb6[_0x6eae('0x31')][_0x6eae('0x37')]);_0x433c13[_0x6eae('0x38')]=qs[_0x6eae('0x39')](_[_0x6eae('0x3a')](_0x4b3bb6['query'],_0x510800['filters']),_0x32a0ea);if(_0x4b3bb6[_0x6eae('0x31')][_0x6eae('0x3b')]){_0x433c13[_0x6eae('0x38')]=_[_0x6eae('0x3c')](_0x433c13[_0x6eae('0x38')],{'$or':_[_0x6eae('0x2b')](_0x32a0ea,function(_0x17a4a6){if(_0x17a4a6[_0x6eae('0x3d')]!==_0x6eae('0x3e')){var _0x36eb46={};_0x36eb46[_0x17a4a6[_0x6eae('0x28')]]={'$like':'%'+_0x4b3bb6['query'][_0x6eae('0x3b')]+'%'};return _0x36eb46;}})});}_0x433c13=_[_0x6eae('0x3c')]({},_0x433c13,_0x4b3bb6['options']);var _0x38b269={'where':_0x433c13['where']};return db[_0x6eae('0x2c')][_0x6eae('0x1c')](_0x38b269)['then'](function(_0x5b53eb){_0x3421a7[_0x6eae('0x1c')]=_0x5b53eb;if(_0x4b3bb6[_0x6eae('0x31')][_0x6eae('0x3f')]){_0x433c13[_0x6eae('0x40')]=[{'all':!![]}];}return db[_0x6eae('0x2c')][_0x6eae('0x41')](_0x433c13);})[_0x6eae('0x23')](function(_0x579b68){_0x3421a7[_0x6eae('0x42')]=_0x579b68;return _0x3421a7;})[_0x6eae('0x23')](respondWithFilteredResult(_0x5931fc,_0x433c13))[_0x6eae('0x43')](handleError(_0x5931fc,null));};exports[_0x6eae('0x44')]=function(_0xf7c81f,_0x3fa6e6){var _0x4ab749={'raw':![],'where':{'id':_0xf7c81f['params']['id']}},_0x268632={};_0x268632[_0x6eae('0x30')]=_[_0x6eae('0x32')](db[_0x6eae('0x2c')][_0x6eae('0x2d')]);_0x268632[_0x6eae('0x31')]=_['keys'](_0xf7c81f[_0x6eae('0x31')]);_0x268632[_0x6eae('0x39')]=_['intersection'](_0x268632[_0x6eae('0x30')],_0x268632['query']);_0x4ab749[_0x6eae('0x35')]=_['intersection'](_0x268632['model'],qs[_0x6eae('0x34')](_0xf7c81f[_0x6eae('0x31')][_0x6eae('0x34')]));_0x4ab749['attributes']=_0x4ab749[_0x6eae('0x35')][_0x6eae('0x45')]?_0x4ab749['attributes']:_0x268632[_0x6eae('0x30')];if(_0xf7c81f[_0x6eae('0x31')]['includeAll']){_0x4ab749[_0x6eae('0x40')]=[{'all':!![]}];}_0x4ab749=_[_0x6eae('0x3c')]({},_0x4ab749,_0xf7c81f[_0x6eae('0x46')]);return db[_0x6eae('0x2c')]['find'](_0x4ab749)[_0x6eae('0x23')](handleEntityNotFound(_0x3fa6e6,null))[_0x6eae('0x23')](respondWithResult(_0x3fa6e6,null))['catch'](handleError(_0x3fa6e6,null));};exports['create']=function(_0x2ff08e,_0x2adfcd){return db[_0x6eae('0x2c')][_0x6eae('0x47')](_0x2ff08e[_0x6eae('0x48')],{})['then'](function(_0x3644a0){var _0x1fb293=_0x2ff08e[_0x6eae('0x49')][_0x6eae('0x4a')]({'plain':!![]});if(!_0x1fb293)throw new Error(_0x6eae('0x4b'));if(_0x1fb293['role']===_0x6eae('0x49')){var _0xd6d447=_0x3644a0[_0x6eae('0x4a')]({'plain':!![]});var _0x4dfbca=_0x6eae('0x4c');return db['UserProfileSection'][_0x6eae('0x4d')]({'where':{'name':_0x4dfbca,'userProfileId':_0x1fb293[_0x6eae('0x4e')]},'raw':!![]})[_0x6eae('0x23')](function(_0x570ea3){if(_0x570ea3&&_0x570ea3[_0x6eae('0x4f')]===0x0){return db[_0x6eae('0x50')]['create']({'name':_0xd6d447['name'],'resourceId':_0xd6d447['id'],'type':_0x6eae('0x25'),'sectionId':_0x570ea3['id']},{})[_0x6eae('0x23')](function(){return _0x3644a0;});}else{return _0x3644a0;}})[_0x6eae('0x43')](function(_0x22cce2){logger[_0x6eae('0x27')](_0x6eae('0x51'),_0x22cce2);throw _0x22cce2;});}return _0x3644a0;})['then'](respondWithResult(_0x2adfcd,0xc9))['catch'](handleError(_0x2adfcd,null));};exports[_0x6eae('0x22')]=function(_0x3cdc31,_0x4358d7){if(_0x3cdc31[_0x6eae('0x48')]['id']){delete _0x3cdc31[_0x6eae('0x48')]['id'];}return db[_0x6eae('0x2c')][_0x6eae('0x4d')]({'where':{'id':_0x3cdc31[_0x6eae('0x52')]['id']}})[_0x6eae('0x23')](handleEntityNotFound(_0x4358d7,null))[_0x6eae('0x23')](saveUpdates(_0x3cdc31[_0x6eae('0x48')],null))[_0x6eae('0x23')](respondWithResult(_0x4358d7,null))['catch'](handleError(_0x4358d7,null));};exports[_0x6eae('0x24')]=function(_0x45922a,_0x435c89){return db['AnalyticCustomReport'][_0x6eae('0x4d')]({'where':{'id':_0x45922a['params']['id']}})[_0x6eae('0x23')](handleEntityNotFound(_0x435c89,null))[_0x6eae('0x23')](removeEntity(_0x435c89,null))[_0x6eae('0x43')](handleError(_0x435c89,null));};exports['preview']=function(_0x16d57a,_0x315f29){var _0xe312bd=0xa;var _0x45a9e6=['join',_0x6eae('0x53'),_0x6eae('0x54'),'cross_join'];var _0x4fca10={'SUM':_0x6eae('0x55'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x6eae('0x56'),'MAX':_0x6eae('0x57'),'MIN':_0x6eae('0x58'),'AVG':_0x6eae('0x59'),'GROUP_CONCAT':_0x6eae('0x5a'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x6eae('0x5b')};var _0x4568b4={'SEC_TO_TIME':_0x6eae('0x5c'),'DATE':'DATE(%s)','HOUR':_0x6eae('0x5d'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x6eae('0x5e')};var _0x30a4a=function(_0x3af90c){return!_[_0x6eae('0x5f')]([_0x6eae('0x60'),_0x6eae('0x61'),_0x6eae('0x62'),'IS\x20NOT\x20EMPTY'],_0x3af90c);};var _0xb9f0a1=function(_0x1e97ad){if(!_0x1e97ad||!_0x1e97ad['rules'][_0x6eae('0x45')]){return'';}for(var _0x6af0ba='(',_0x33086e=0x0;_0x33086e<_0x1e97ad['rules'][_0x6eae('0x45')];_0x33086e+=0x1){_0x33086e>0x0&&(_0x6af0ba+='\x20'+_0x1e97ad[_0x6eae('0x63')]+'\x20');_0x6af0ba+=_0x1e97ad[_0x6eae('0x64')][_0x33086e][_0x6eae('0x65')]?_0xb9f0a1(_0x1e97ad[_0x6eae('0x64')][_0x33086e]['group']):_0x1e97ad[_0x6eae('0x64')][_0x33086e][_0x6eae('0x66')]+'\x20'+_0x1e97ad[_0x6eae('0x64')][_0x33086e][_0x6eae('0x67')]+(_0x30a4a(_0x1e97ad[_0x6eae('0x64')][_0x33086e]['condition'])?'\x20'+_0x1e97ad[_0x6eae('0x64')][_0x33086e]['value']:'');}return _0x6af0ba+')';};var _0x27b20d={'where':{'id':_0x16d57a[_0x6eae('0x52')]['id']}},_0x5356ab,_0x532118,_0x285b58,_0x3e8d10,_0xa895f8;_0x27b20d=_[_0x6eae('0x3c')]({},_0x27b20d,_0x16d57a[_0x6eae('0x46')]);return db[_0x6eae('0x2c')][_0x6eae('0x4d')](_0x27b20d)['then'](function(_0x4f94ab){if(_0x4f94ab){_0x5356ab=_0x4f94ab;return _0x4f94ab[_0x6eae('0x68')]();}return null;})[_0x6eae('0x23')](function(_0x4adfaa){if(_0x4adfaa){if(!_0x4adfaa[_0x6eae('0x45')]){throw new db['Sequelize'][(_0x6eae('0x69'))](_0x6eae('0x6a'),0x193);}_0x532118=_0x4adfaa;return db[_0x6eae('0x6b')][_0x6eae('0x41')]({'raw':!![]});}return null;})[_0x6eae('0x23')](function(_0xdb991c){if(_0xdb991c){_0x285b58=_['keyBy'](_0xdb991c,'id');var _0xe741e0;var _0xa42ac7=squel[_0x6eae('0x6c')]();_0xa42ac7['from'](_0x5356ab['table']);for(var _0x422ac1=0x0;_0x422ac1<_0x532118[_0x6eae('0x45')];_0x422ac1+=0x1){_0xe741e0=_0x532118[_0x422ac1]['MetricId']?_0x285b58[_0x532118[_0x422ac1]['MetricId']][_0x6eae('0x6d')]:_0x532118[_0x422ac1][_0x6eae('0x66')];_0xe741e0=_0x532118[_0x422ac1][_0x6eae('0x6e')]?_[_0x6eae('0x6f')](_0x4fca10[_0x532118[_0x422ac1]['function']],'%s',_0xe741e0):_0xe741e0;_0xe741e0=_0x532118[_0x422ac1][_0x6eae('0x70')]?_[_0x6eae('0x6f')](_0x4568b4[_0x532118[_0x422ac1]['format']],'%s',_0xe741e0):_0xe741e0;if(_0x532118[_0x422ac1][_0x6eae('0x71')]){_0xa42ac7[_0x6eae('0x65')](_0xe741e0);}_0x532118[_0x422ac1][_0x6eae('0x72')]&&_0xa42ac7[_0x6eae('0x36')](_0xe741e0,_0x532118[_0x422ac1][_0x6eae('0x72')]===_0x6eae('0x73')?![]:!![]);_0xa42ac7[_0x6eae('0x66')](_0xe741e0,_0x532118[_0x422ac1][_0x6eae('0x74')]||_0xe741e0);}if(_0x5356ab[_0x6eae('0x75')]){_0x5356ab[_0x6eae('0x75')]=JSON[_0x6eae('0x76')](_0x5356ab[_0x6eae('0x75')]);for(var _0x162ae7=0x0;_0x162ae7<_0x5356ab[_0x6eae('0x75')][_0x6eae('0x45')];_0x162ae7+=0x1){if(_0x5356ab[_0x6eae('0x75')][_0x162ae7][_0x6eae('0x3d')]&&_['includes'](_0x45a9e6,_0x5356ab[_0x6eae('0x75')][_0x162ae7]['type'])&&_0x5356ab[_0x6eae('0x75')][_0x162ae7][_0x6eae('0x77')]&&_0x5356ab[_0x6eae('0x75')][_0x162ae7][_0x6eae('0x78')]&&_0x5356ab[_0x6eae('0x75')][_0x162ae7][_0x6eae('0x79')]){_0xa42ac7[_0x5356ab[_0x6eae('0x75')][_0x162ae7][_0x6eae('0x3d')]](_0x5356ab[_0x6eae('0x75')][_0x162ae7][_0x6eae('0x78')],null,util[_0x6eae('0x70')](_0x6eae('0x7a'),_0x5356ab[_0x6eae('0x7b')],_0x5356ab[_0x6eae('0x75')][_0x162ae7]['parentKey'],_0x5356ab[_0x6eae('0x75')][_0x162ae7]['foreignTable'],_0x5356ab[_0x6eae('0x75')][_0x162ae7][_0x6eae('0x79')]));}}}if(_0x5356ab[_0x6eae('0x7c')]){_0x5356ab[_0x6eae('0x7c')]=JSON[_0x6eae('0x76')](_0x5356ab[_0x6eae('0x7c')]);_0xa42ac7[_0x6eae('0x38')](_0xb9f0a1(_0x5356ab[_0x6eae('0x7c')][_0x6eae('0x65')]));}_0xa895f8=_0xa42ac7[_0x6eae('0x7d')]();_0xa42ac7[_0x6eae('0x1b')](_0xe312bd);_0xa42ac7[_0x6eae('0x19')](0x0);logger[_0x6eae('0x7e')](_0x6eae('0x7f'),_0xa42ac7[_0x6eae('0x80')]());return dbH[_0x6eae('0x81')][_0x6eae('0x31')](_0xa42ac7[_0x6eae('0x80')](),{'type':dbH['sequelize']['QueryTypes'][_0x6eae('0x82')]});}})['then'](respondWithResult(_0x315f29,null))[_0x6eae('0x43')](handleError(_0x315f29,null));};function runReport(_0x189e05,_0x486b4c,_0x1b7f76){var _0x2d7bde=_0x486b4c['name'];var _0x4b1992=0xa;var _0x2eeee4=[_0x6eae('0x83'),'left_join',_0x6eae('0x54'),_0x6eae('0x84')];var _0x341ddd={'SUM':_0x6eae('0x55'),'COUNT':_0x6eae('0x85'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x6eae('0x57'),'MIN':_0x6eae('0x58'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x6eae('0x5a'),'GROUP_CONCAT ASC':_0x6eae('0x86'),'GROUP_CONCAT DESC':_0x6eae('0x5b')};var _0x5f3fa6={'SEC_TO_TIME':_0x6eae('0x5c'),'DATE':_0x6eae('0x87'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x6eae('0x5e')};var _0x588184=function(_0x53fac3){return!_[_0x6eae('0x5f')]([_0x6eae('0x60'),_0x6eae('0x61'),_0x6eae('0x62'),'IS\x20NOT\x20EMPTY'],_0x53fac3);};var _0x4323d7=function(_0x5158a2){if(!_0x5158a2||!_0x5158a2[_0x6eae('0x64')][_0x6eae('0x45')]){return'';}for(var _0x335b54='(',_0x527999=0x0;_0x527999<_0x5158a2['rules'][_0x6eae('0x45')];_0x527999+=0x1){_0x527999>0x0&&(_0x335b54+='\x20'+_0x5158a2[_0x6eae('0x63')]+'\x20');_0x335b54+=_0x5158a2[_0x6eae('0x64')][_0x527999]['group']?_0x4323d7(_0x5158a2['rules'][_0x527999][_0x6eae('0x65')]):_0x5158a2[_0x6eae('0x64')][_0x527999][_0x6eae('0x66')]+'\x20'+_0x5158a2[_0x6eae('0x64')][_0x527999][_0x6eae('0x67')]+(_0x588184(_0x5158a2['rules'][_0x527999][_0x6eae('0x67')])?'\x20'+_0x5158a2['rules'][_0x527999]['value']:'');}return _0x335b54+')';};var _0x2689d4={'where':{'id':_0x189e05['id']}},_0x486145,_0x224a01,_0x23eba8,_0x708638,_0x4107f0;_0x2689d4=_[_0x6eae('0x3c')]({},_0x2689d4,_0x1b7f76);return db[_0x6eae('0x2c')]['find'](_0x2689d4)[_0x6eae('0x23')](function(_0x196133){if(_0x196133){_0x486145=_0x196133;return _0x196133[_0x6eae('0x68')]();}return null;})[_0x6eae('0x23')](function(_0x4bc4de){if(_0x4bc4de){if(!_0x4bc4de[_0x6eae('0x45')]){throw new db[(_0x6eae('0x88'))][(_0x6eae('0x69'))](_0x6eae('0x6a'),0x193);}_0x224a01=_0x4bc4de;return db[_0x6eae('0x6b')][_0x6eae('0x41')]({'raw':!![]});}return null;})[_0x6eae('0x23')](function(_0x1568b3){if(_0x1568b3){_0x23eba8=_['keyBy'](_0x1568b3,'id');var _0x1dff82;var _0x5e4ed0=squel[_0x6eae('0x6c')]();_0x5e4ed0[_0x6eae('0x89')](_0x486145[_0x6eae('0x7b')]);for(var _0x525b25=0x0;_0x525b25<_0x224a01[_0x6eae('0x45')];_0x525b25+=0x1){_0x1dff82=_0x224a01[_0x525b25]['MetricId']?_0x23eba8[_0x224a01[_0x525b25][_0x6eae('0x8a')]][_0x6eae('0x6d')]:_0x224a01[_0x525b25][_0x6eae('0x66')];_0x1dff82=_0x224a01[_0x525b25]['function']?_[_0x6eae('0x6f')](_0x341ddd[_0x224a01[_0x525b25]['function']],'%s',_0x1dff82):_0x1dff82;_0x1dff82=_0x224a01[_0x525b25][_0x6eae('0x70')]?_[_0x6eae('0x6f')](_0x5f3fa6[_0x224a01[_0x525b25][_0x6eae('0x70')]],'%s',_0x1dff82):_0x1dff82;if(_0x224a01[_0x525b25][_0x6eae('0x71')]){_0x5e4ed0[_0x6eae('0x65')](_0x1dff82);}_0x224a01[_0x525b25][_0x6eae('0x72')]&&_0x5e4ed0[_0x6eae('0x36')](_0x1dff82,_0x224a01[_0x525b25]['orderBy']===_0x6eae('0x73')?![]:!![]);_0x5e4ed0['field'](_0x1dff82,_0x224a01[_0x525b25][_0x6eae('0x74')]||_0x1dff82);}if(_0x486145['joins']){_0x486145[_0x6eae('0x75')]=JSON['parse'](_0x486145[_0x6eae('0x75')]);for(var _0x507c62=0x0;_0x507c62<_0x486145[_0x6eae('0x75')][_0x6eae('0x45')];_0x507c62+=0x1){if(_0x486145[_0x6eae('0x75')][_0x507c62][_0x6eae('0x3d')]&&_['includes'](_0x2eeee4,_0x486145[_0x6eae('0x75')][_0x507c62][_0x6eae('0x3d')])&&_0x486145[_0x6eae('0x75')][_0x507c62]['parentKey']&&_0x486145[_0x6eae('0x75')][_0x507c62][_0x6eae('0x78')]&&_0x486145[_0x6eae('0x75')][_0x507c62]['foreignKey']){_0x5e4ed0[_0x486145[_0x6eae('0x75')][_0x507c62][_0x6eae('0x3d')]](_0x486145['joins'][_0x507c62][_0x6eae('0x78')],null,util[_0x6eae('0x70')](_0x6eae('0x7a'),_0x486145[_0x6eae('0x7b')],_0x486145['joins'][_0x507c62][_0x6eae('0x77')],_0x486145[_0x6eae('0x75')][_0x507c62][_0x6eae('0x78')],_0x486145[_0x6eae('0x75')][_0x507c62]['foreignKey']));}}}if(_0x486145[_0x6eae('0x7c')]){_0x486145[_0x6eae('0x7c')]=JSON[_0x6eae('0x76')](_0x486145[_0x6eae('0x7c')]);_0x5e4ed0['where'](_0x4323d7(_0x486145[_0x6eae('0x7c')]['group']));}_0x4107f0=_0x5e4ed0[_0x6eae('0x7d')]();_0x5e4ed0['limit'](_0x4b1992);_0x5e4ed0[_0x6eae('0x19')](0x0);return;}})['then'](function(){if(_0x486b4c[_0x6eae('0x8b')]===_0x6eae('0x8c')){return null;}var _0x3d9412=_['merge'](_0x486b4c,{'name':_0x486b4c['fullPath']||_0x486b4c[_0x6eae('0x28')]||_0x486145['name'],'basename':_0x2d7bde,'savename':util[_0x6eae('0x70')](_0x6eae('0x8d'),_0x486b4c['name']||_0x486145['name'],require(_0x6eae('0x8e'))[_0x6eae('0x8f')](0x4),_0x486b4c[_0x6eae('0x8b')]||'csv'),'reportId':_0x486145['id'],'reportType':'custom'});return db[_0x6eae('0x90')][_0x6eae('0x47')](_0x3d9412,{'raw':!![]});})['then'](function(_0x1d639f){if(_0x486145[_0x6eae('0x7b')]===_0x6eae('0x91')){_0x4107f0[_0x6eae('0x38')](_0x486145[_0x6eae('0x7b')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x486b4c[_0x6eae('0x92')],_0x486b4c[_0x6eae('0x93')]);}else{_0x4107f0[_0x6eae('0x38')](_0x486145[_0x6eae('0x7b')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x486b4c[_0x6eae('0x92')],_0x486b4c[_0x6eae('0x93')]);}if(_0x1d639f){logger[_0x6eae('0x94')](_0x6eae('0x95'),_0x4107f0[_0x6eae('0x80')]());require(_0x6eae('0x96'))[_0x6eae('0x97')](path[_0x6eae('0x83')](__dirname,_0x6eae('0x98'),_0x1d639f['output']),[_0x1d639f['id'],_0x4107f0['toString'](),path[_0x6eae('0x83')](__dirname,_0x6eae('0x99'),_0x1d639f[_0x6eae('0x9a')]),_0x2d7bde]);return _0x1d639f;}else{var _0x20c13c=squel[_0x6eae('0x6c')]();_0x20c13c[_0x6eae('0x89')]('('+_0x4107f0[_0x6eae('0x80')]()+')',_0x6eae('0x9b'));_0x20c13c[_0x6eae('0x66')](_0x6eae('0x9c'),_0x6eae('0x1c'));_0x4107f0['limit'](_0x486b4c[_0x6eae('0x1b')]||_0x4b1992);_0x4107f0[_0x6eae('0x19')](_0x486b4c[_0x6eae('0x19')]||0x0);return dbH[_0x6eae('0x81')][_0x6eae('0x31')](_0x20c13c[_0x6eae('0x80')](),{'type':dbH[_0x6eae('0x81')]['QueryTypes'][_0x6eae('0x82')]})[_0x6eae('0x23')](function(_0x5644f9){if(!_0x5644f9[_0x6eae('0x45')]){_0x708638=0x0;}else{_0x708638=_0x5644f9[0x0][_0x6eae('0x1c')]||0x0;}return dbH[_0x6eae('0x81')]['query'](_0x4107f0[_0x6eae('0x80')](),{'type':dbH[_0x6eae('0x81')][_0x6eae('0x9d')]['SELECT']});})[_0x6eae('0x23')](function(_0x136f3){return{'rows':_0x136f3||[],'count':_0x708638};});}});}exports[_0x6eae('0x9e')]=function(_0x101e3d,_0x2f6a0b){return runReport(_0x101e3d[_0x6eae('0x52')],_0x101e3d[_0x6eae('0x31')],_0x101e3d['options'])[_0x6eae('0x23')](respondWithResult(_0x2f6a0b,null))[_0x6eae('0x43')](handleError(_0x2f6a0b,null));};exports[_0x6eae('0x9f')]=runReport;exports['query']=function(_0x11ff36,_0x33e1ae){var _0xd61c4d=0xa;var _0x1c062d=[_0x6eae('0x83'),_0x6eae('0x53'),_0x6eae('0x54'),'cross_join'];var _0x241c69={'SUM':_0x6eae('0x55'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x6eae('0x56'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':_0x6eae('0x59'),'GROUP_CONCAT':_0x6eae('0x5a'),'GROUP_CONCAT ASC':_0x6eae('0x86'),'GROUP_CONCAT DESC':_0x6eae('0x5b')};var _0x52aea1={'SEC_TO_TIME':_0x6eae('0x5c'),'DATE':_0x6eae('0x87'),'HOUR':'HOUR(%s)','ROUND':_0x6eae('0xa0'),'UNIX_TIMESTAMP':_0x6eae('0x5e')};var _0x5613e1=function(_0x5cd75c){return!_[_0x6eae('0x5f')]([_0x6eae('0x60'),_0x6eae('0x61'),'IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0x5cd75c);};var _0x2483f8=function(_0x2b62d4){if(!_0x2b62d4||!_0x2b62d4[_0x6eae('0x64')][_0x6eae('0x45')]){return'';}for(var _0x4c3a6e='(',_0xd41514=0x0;_0xd41514<_0x2b62d4[_0x6eae('0x64')][_0x6eae('0x45')];_0xd41514+=0x1){_0xd41514>0x0&&(_0x4c3a6e+='\x20'+_0x2b62d4[_0x6eae('0x63')]+'\x20');_0x4c3a6e+=_0x2b62d4[_0x6eae('0x64')][_0xd41514][_0x6eae('0x65')]?_0x2483f8(_0x2b62d4[_0x6eae('0x64')][_0xd41514][_0x6eae('0x65')]):_0x2b62d4[_0x6eae('0x64')][_0xd41514]['field']+'\x20'+_0x2b62d4[_0x6eae('0x64')][_0xd41514][_0x6eae('0x67')]+(_0x5613e1(_0x2b62d4[_0x6eae('0x64')][_0xd41514]['condition'])?'\x20'+_0x2b62d4[_0x6eae('0x64')][_0xd41514]['value']:'');}return _0x4c3a6e+')';};var _0x536252={'where':{'id':_0x11ff36[_0x6eae('0x52')]['id']}},_0x5216e9,_0x456c00,_0xfb2b5a,_0x5ca9d9,_0x127f08;_0x536252=_[_0x6eae('0x3c')]({},_0x536252,_0x11ff36[_0x6eae('0x46')]);return db[_0x6eae('0x2c')][_0x6eae('0x4d')](_0x536252)[_0x6eae('0x23')](function(_0x1df945){if(_0x1df945){_0x5216e9=_0x1df945;return _0x1df945[_0x6eae('0x68')]();}return null;})[_0x6eae('0x23')](function(_0x19097b){if(_0x19097b){if(!_0x19097b[_0x6eae('0x45')]){throw new db[(_0x6eae('0x88'))][(_0x6eae('0x69'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x456c00=_0x19097b;return db[_0x6eae('0x6b')][_0x6eae('0x41')]({'raw':!![]});}return null;})[_0x6eae('0x23')](function(_0x45fb75){if(_0x45fb75){_0xfb2b5a=_[_0x6eae('0xa1')](_0x45fb75,'id');var _0x55664e;var _0x249e30=squel[_0x6eae('0x6c')]();_0x249e30[_0x6eae('0x89')](_0x5216e9[_0x6eae('0x7b')]);for(var _0x409207=0x0;_0x409207<_0x456c00[_0x6eae('0x45')];_0x409207+=0x1){_0x55664e=_0x456c00[_0x409207][_0x6eae('0x8a')]?_0xfb2b5a[_0x456c00[_0x409207][_0x6eae('0x8a')]][_0x6eae('0x6d')]:_0x456c00[_0x409207][_0x6eae('0x66')];_0x55664e=_0x456c00[_0x409207][_0x6eae('0x6e')]?_[_0x6eae('0x6f')](_0x241c69[_0x456c00[_0x409207]['function']],'%s',_0x55664e):_0x55664e;_0x55664e=_0x456c00[_0x409207][_0x6eae('0x70')]?_[_0x6eae('0x6f')](_0x52aea1[_0x456c00[_0x409207][_0x6eae('0x70')]],'%s',_0x55664e):_0x55664e;if(_0x456c00[_0x409207][_0x6eae('0x71')]){_0x249e30[_0x6eae('0x65')](_0x55664e);}_0x456c00[_0x409207][_0x6eae('0x72')]&&_0x249e30[_0x6eae('0x36')](_0x55664e,_0x456c00[_0x409207][_0x6eae('0x72')]==='DESC'?![]:!![]);_0x249e30[_0x6eae('0x66')](_0x55664e,_0x456c00[_0x409207][_0x6eae('0x74')]||_0x55664e);}if(_0x5216e9['joins']){_0x5216e9['joins']=JSON[_0x6eae('0x76')](_0x5216e9['joins']);for(var _0x3f7919=0x0;_0x3f7919<_0x5216e9['joins']['length'];_0x3f7919+=0x1){if(_0x5216e9[_0x6eae('0x75')][_0x3f7919]['type']&&_[_0x6eae('0x5f')](_0x1c062d,_0x5216e9[_0x6eae('0x75')][_0x3f7919]['type'])&&_0x5216e9['joins'][_0x3f7919][_0x6eae('0x77')]&&_0x5216e9[_0x6eae('0x75')][_0x3f7919][_0x6eae('0x78')]&&_0x5216e9['joins'][_0x3f7919][_0x6eae('0x79')]){_0x249e30[_0x5216e9[_0x6eae('0x75')][_0x3f7919][_0x6eae('0x3d')]](_0x5216e9['joins'][_0x3f7919]['foreignTable'],null,util[_0x6eae('0x70')](_0x6eae('0x7a'),_0x5216e9[_0x6eae('0x7b')],_0x5216e9[_0x6eae('0x75')][_0x3f7919][_0x6eae('0x77')],_0x5216e9[_0x6eae('0x75')][_0x3f7919][_0x6eae('0x78')],_0x5216e9[_0x6eae('0x75')][_0x3f7919][_0x6eae('0x79')]));}}}if(_0x5216e9['conditions']){_0x5216e9[_0x6eae('0x7c')]=JSON[_0x6eae('0x76')](_0x5216e9[_0x6eae('0x7c')]);_0x249e30['where'](_0x2483f8(_0x5216e9[_0x6eae('0x7c')][_0x6eae('0x65')]));}_0x127f08=_0x249e30[_0x6eae('0x7d')]();_0x249e30[_0x6eae('0x1b')](_0xd61c4d);_0x249e30[_0x6eae('0x19')](0x0);logger[_0x6eae('0x7e')](_0x6eae('0x7f'),_0x249e30[_0x6eae('0x80')]());return dbH[_0x6eae('0x81')][_0x6eae('0x31')](_0x249e30['toString'](),{'type':dbH[_0x6eae('0x81')][_0x6eae('0x9d')][_0x6eae('0x82')]});}})['then'](function(){return{'sql':_0x127f08[_0x6eae('0x80')]()};})[_0x6eae('0x23')](respondWithResult(_0x33e1ae,null))[_0x6eae('0x43')](handleError(_0x33e1ae,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 4100dfd..6f1da1a 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 _0xf6ce=['rimraf','../../config/environment','exports','define','AnalyticCustomReport','analytics_custom_reports','util','api','moment','bluebird','path'];(function(_0x246f43,_0x18a2a0){var _0x10edfe=function(_0x187e48){while(--_0x187e48){_0x246f43['push'](_0x246f43['shift']());}};_0x10edfe(++_0x18a2a0);}(_0xf6ce,0x69));var _0xef6c=function(_0x4f296e,_0x2632f9){_0x4f296e=_0x4f296e-0x0;var _0x457d05=_0xf6ce[_0x4f296e];return _0x457d05;};'use strict';var _=require('lodash');var util=require(_0xef6c('0x0'));var logger=require('../../config/logger')(_0xef6c('0x1'));var moment=require(_0xef6c('0x2'));var BPromise=require(_0xef6c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xef6c('0x4'));var rimraf=require(_0xef6c('0x5'));var config=require(_0xef6c('0x6'));var attributes=require('./analyticCustomReport.attributes');module[_0xef6c('0x7')]=function(_0x545226,_0x88f153){return _0x545226[_0xef6c('0x8')](_0xef6c('0x9'),attributes,{'tableName':_0xef6c('0xa'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7e58=['../../config/environment','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','analytics_custom_reports','util','../../config/logger','api','bluebird','request-promise','rimraf'];(function(_0x168dfe,_0x300f07){var _0x2e00c9=function(_0x30fc67){while(--_0x30fc67){_0x168dfe['push'](_0x168dfe['shift']());}};_0x2e00c9(++_0x300f07);}(_0x7e58,0x1f2));var _0x87e5=function(_0x403314,_0x18c1d3){_0x403314=_0x403314-0x0;var _0x48731c=_0x7e58[_0x403314];return _0x48731c;};'use strict';var _=require('lodash');var util=require(_0x87e5('0x0'));var logger=require(_0x87e5('0x1'))(_0x87e5('0x2'));var moment=require('moment');var BPromise=require(_0x87e5('0x3'));var rp=require(_0x87e5('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x87e5('0x5'));var config=require(_0x87e5('0x6'));var attributes=require(_0x87e5('0x7'));module[_0x87e5('0x8')]=function(_0x5a8621,_0x3df93a){return _0x5a8621[_0x87e5('0x9')](_0x87e5('0xa'),attributes,{'tableName':_0x87e5('0xb'),'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 c4c548d..3e2c543 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 _0x5588=['error','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s'];(function(_0x63875f,_0xfea539){var _0x4b74c5=function(_0xba35cd){while(--_0xba35cd){_0x63875f['push'](_0x63875f['shift']());}};_0x4b74c5(++_0xfea539);}(_0x5588,0x139));var _0x8558=function(_0x5a46e5,_0x2e5217){_0x5a46e5=_0x5a46e5-0x0;var _0x23d53f=_0x5588[_0x5a46e5];return _0x23d53f;};'use strict';var _=require(_0x8558('0x0'));var util=require('util');var moment=require(_0x8558('0x1'));var BPromise=require(_0x8558('0x2'));var rs=require(_0x8558('0x3'));var fs=require('fs');var Redis=require(_0x8558('0x4'));var db=require(_0x8558('0x5'))['db'];var utils=require(_0x8558('0x6'));var logger=require(_0x8558('0x7'))(_0x8558('0x8'));var config=require(_0x8558('0x9'));var jayson=require(_0x8558('0xa'));var client=jayson['client'][_0x8558('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3df632,_0x36d236,_0x4ddd1d){return new BPromise(function(_0x365444,_0x1e5243){return client['request'](_0x3df632,_0x4ddd1d)[_0x8558('0xc')](function(_0x521d44){logger['info'](_0x8558('0xd'),_0x36d236,_0x8558('0xe'));logger[_0x8558('0xf')](_0x8558('0x10'),_0x36d236,_0x8558('0xe'),JSON['stringify'](_0x521d44));if(_0x521d44[_0x8558('0x11')]){if(_0x521d44[_0x8558('0x11')]['code']===0x1f4){logger[_0x8558('0x11')](_0x8558('0xd'),_0x36d236,_0x521d44['error'][_0x8558('0x12')]);return _0x1e5243(_0x521d44['error'][_0x8558('0x12')]);}logger[_0x8558('0x11')](_0x8558('0xd'),_0x36d236,_0x521d44[_0x8558('0x11')][_0x8558('0x12')]);return _0x365444(_0x521d44[_0x8558('0x11')][_0x8558('0x12')]);}else{logger[_0x8558('0x13')](_0x8558('0xd'),_0x36d236,_0x8558('0xe'));_0x365444(_0x521d44[_0x8558('0x14')][_0x8558('0x12')]);}})[_0x8558('0x15')](function(_0x13a089){logger[_0x8558('0x11')](_0x8558('0xd'),_0x36d236,_0x13a089);_0x1e5243(_0x13a089);});});} \ No newline at end of file +var _0xf887=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','util','moment','randomstring','ioredis'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf887,0x73));var _0x7f88=function(_0x4c1c5a,_0xcf5444){_0x4c1c5a=_0x4c1c5a-0x0;var _0x2896f0=_0xf887[_0x4c1c5a];return _0x2896f0;};'use strict';var _=require(_0x7f88('0x0'));var util=require(_0x7f88('0x1'));var moment=require(_0x7f88('0x2'));var BPromise=require('bluebird');var rs=require(_0x7f88('0x3'));var fs=require('fs');var Redis=require(_0x7f88('0x4'));var db=require(_0x7f88('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x7f88('0x6'))(_0x7f88('0x7'));var config=require(_0x7f88('0x8'));var jayson=require(_0x7f88('0x9'));var client=jayson[_0x7f88('0xa')][_0x7f88('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x231bb1,_0x3b0be3,_0x214e3a){return new BPromise(function(_0x21f261,_0x5e0dd6){return client[_0x7f88('0xc')](_0x231bb1,_0x214e3a)[_0x7f88('0xd')](function(_0x5cdb35){logger['info'](_0x7f88('0xe'),_0x3b0be3,_0x7f88('0xf'));logger[_0x7f88('0x10')](_0x7f88('0x11'),_0x3b0be3,_0x7f88('0xf'),JSON['stringify'](_0x5cdb35));if(_0x5cdb35[_0x7f88('0x12')]){if(_0x5cdb35[_0x7f88('0x12')][_0x7f88('0x13')]===0x1f4){logger[_0x7f88('0x12')](_0x7f88('0xe'),_0x3b0be3,_0x5cdb35[_0x7f88('0x12')][_0x7f88('0x14')]);return _0x5e0dd6(_0x5cdb35[_0x7f88('0x12')][_0x7f88('0x14')]);}logger['error'](_0x7f88('0xe'),_0x3b0be3,_0x5cdb35[_0x7f88('0x12')]['message']);return _0x21f261(_0x5cdb35['error']['message']);}else{logger[_0x7f88('0x15')](_0x7f88('0xe'),_0x3b0be3,_0x7f88('0xf'));_0x21f261(_0x5cdb35[_0x7f88('0x16')][_0x7f88('0x14')]);}})[_0x7f88('0x17')](function(_0x59dc37){logger[_0x7f88('0x12')](_0x7f88('0xe'),_0x3b0be3,_0x59dc37);_0x5e0dd6(_0x59dc37);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 693c892..f963ca0 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 _0xc4ee=['exports','multer','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','/:id/preview','preview','/:id/run','isAuthenticated','run','query','post','put','update','delete','destroy'];(function(_0xe3e0af,_0x4564ed){var _0x4828e9=function(_0x55c7a7){while(--_0x55c7a7){_0xe3e0af['push'](_0xe3e0af['shift']());}};_0x4828e9(++_0x4564ed);}(_0xc4ee,0x18d));var _0xec4e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc4ee[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xec4e('0x0'));var util=require('util');var path=require(_0xec4e('0x1'));var timeout=require('connect-timeout');var express=require(_0xec4e('0x2'));var router=express['Router']();var fs_extra=require(_0xec4e('0x3'));var auth=require(_0xec4e('0x4'));var interaction=require(_0xec4e('0x5'));var config=require(_0xec4e('0x6'));var controller=require('./analyticCustomReport.controller');router[_0xec4e('0x7')]('/',auth['isAuthenticated'](),controller[_0xec4e('0x8')]);router[_0xec4e('0x7')](_0xec4e('0x9'),auth['isAuthenticated'](),controller['show']);router['get'](_0xec4e('0xa'),auth['isAuthenticated'](),controller[_0xec4e('0xb')]);router[_0xec4e('0x7')](_0xec4e('0xc'),auth[_0xec4e('0xd')](),controller[_0xec4e('0xe')]);router[_0xec4e('0x7')]('/:id/query',auth[_0xec4e('0xd')](),controller[_0xec4e('0xf')]);router[_0xec4e('0x10')]('/',auth[_0xec4e('0xd')](),controller['create']);router[_0xec4e('0x11')](_0xec4e('0x9'),auth[_0xec4e('0xd')](),controller[_0xec4e('0x12')]);router[_0xec4e('0x13')](_0xec4e('0x9'),auth[_0xec4e('0xd')](),controller[_0xec4e('0x14')]);module[_0xec4e('0x15')]=router; \ No newline at end of file +var _0x1a3c=['/:id/run','/:id/query','query','create','put','/:id','update','delete','destroy','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','get','isAuthenticated','/:id/preview','preview'];(function(_0x285d8f,_0x3c464e){var _0x2a3a2d=function(_0x57b7c0){while(--_0x57b7c0){_0x285d8f['push'](_0x285d8f['shift']());}};_0x2a3a2d(++_0x3c464e);}(_0x1a3c,0x69));var _0xc1a3=function(_0x2c8783,_0x50955d){_0x2c8783=_0x2c8783-0x0;var _0x129d02=_0x1a3c[_0x2c8783];return _0x129d02;};'use strict';var multer=require('multer');var util=require(_0xc1a3('0x0'));var path=require('path');var timeout=require(_0xc1a3('0x1'));var express=require('express');var router=express[_0xc1a3('0x2')]();var fs_extra=require(_0xc1a3('0x3'));var auth=require(_0xc1a3('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./analyticCustomReport.controller');router[_0xc1a3('0x5')]('/',auth[_0xc1a3('0x6')](),controller['index']);router[_0xc1a3('0x5')]('/:id',auth[_0xc1a3('0x6')](),controller['show']);router[_0xc1a3('0x5')](_0xc1a3('0x7'),auth['isAuthenticated'](),controller[_0xc1a3('0x8')]);router[_0xc1a3('0x5')](_0xc1a3('0x9'),auth[_0xc1a3('0x6')](),controller['run']);router[_0xc1a3('0x5')](_0xc1a3('0xa'),auth[_0xc1a3('0x6')](),controller[_0xc1a3('0xb')]);router['post']('/',auth[_0xc1a3('0x6')](),controller[_0xc1a3('0xc')]);router[_0xc1a3('0xd')](_0xc1a3('0xe'),auth[_0xc1a3('0x6')](),controller[_0xc1a3('0xf')]);router[_0xc1a3('0x10')](_0xc1a3('0xe'),auth[_0xc1a3('0x6')](),controller[_0xc1a3('0x11')]);module[_0xc1a3('0x12')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index b02bf72..0957ef1 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 _0xda19=['exports','STRING','TEXT'];(function(_0x31872e,_0x283ebd){var _0x39f624=function(_0xd2bb3b){while(--_0xd2bb3b){_0x31872e['push'](_0x31872e['shift']());}};_0x39f624(++_0x283ebd);}(_0xda19,0xd5));var _0x9da1=function(_0x27f1dd,_0x243958){_0x27f1dd=_0x27f1dd-0x0;var _0x5589f4=_0xda19[_0x27f1dd];return _0x5589f4;};'use strict';var Sequelize=require('sequelize');module[_0x9da1('0x0')]={'name':{'type':Sequelize[_0x9da1('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x9da1('0x1')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0x9da1('0x2')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x24ca=['sequelize','STRING','TEXT'];(function(_0xf61c79,_0x43c6fa){var _0x127d26=function(_0x598bf6){while(--_0x598bf6){_0xf61c79['push'](_0xf61c79['shift']());}};_0x127d26(++_0x43c6fa);}(_0x24ca,0x1bc));var _0xa24c=function(_0x4843f9,_0x4af459){_0x4843f9=_0x4843f9-0x0;var _0x193c6a=_0x24ca[_0x4843f9];return _0x193c6a;};'use strict';var Sequelize=require(_0xa24c('0x0'));module['exports']={'name':{'type':Sequelize[_0xa24c('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xa24c('0x1')]},'parent':{'type':Sequelize[_0xa24c('0x1')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0xa24c('0x2')]},'joins':{'type':Sequelize[_0xa24c('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index dc24807..c717167 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 _0x46ed=['SEC_TO_TIME(%s)','value','AnalyticMetric','select','DESC','output','fullPath','%s-%s.%s','randomstring','csv','default','AnalyticExtractedReport','cdr','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','info','Run\x20Query:','child_process','../../files/reports','savename','countTable','COUNT(*)','sequelize','runReport','left_join','COUNT(%s)','MIN(%s)','AVG(%s)','Limited\x20Query:','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','get','DefaultReports','UserProfileResource','destroy','sendStatus','error','stack','name','send','index','map','AnalyticDefaultReport','rawAttributes','fieldName','type','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','catch','params','find','create','body','user','Reports','UserProfileSection','userProfileId','autoAssociation','preview','join','right_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','from','table','MetricId','metric','function','replace','format','groupBy','orderBy','order','alias','joins','parentKey','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','parse','clone','toString','QueryTypes','SELECT'];(function(_0x18811b,_0x6bede4){var _0x2fbee4=function(_0x4dcf84){while(--_0x4dcf84){_0x18811b['push'](_0x18811b['shift']());}};_0x2fbee4(++_0x6bede4);}(_0x46ed,0x168));var _0xd46e=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x46ed[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0xd46e('0x0'));var rimraf=require(_0xd46e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd46e('0x2'));var rp=require(_0xd46e('0x3'));var moment=require(_0xd46e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd46e('0x5'));var util=require(_0xd46e('0x6'));var path=require('path');var sox=require(_0xd46e('0x7'));var csv=require(_0xd46e('0x8'));var ejs=require(_0xd46e('0x9'));var fs=require('fs');var fs_extra=require(_0xd46e('0xa'));var _=require(_0xd46e('0xb'));var squel=require(_0xd46e('0xc'));var crypto=require(_0xd46e('0xd'));var jsforce=require(_0xd46e('0xe'));var deskjs=require(_0xd46e('0xf'));var toCsv=require(_0xd46e('0x8'));var querystring=require(_0xd46e('0x10'));var Papa=require('papaparse');var Redis=require(_0xd46e('0x11'));var authService=require(_0xd46e('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xd46e('0x13'));var hardwareService=require(_0xd46e('0x14'));var logger=require(_0xd46e('0x15'))(_0xd46e('0x16'));var utils=require(_0xd46e('0x17'));var config=require(_0xd46e('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xd46e('0x19'))['db'];var dbH=require('../../mysqldb')['dbH'];function respondWithStatusCode(_0xf3048c,_0x27dbfb){_0x27dbfb=_0x27dbfb||0xcc;return function(_0x53b309){if(_0x53b309){return _0xf3048c['sendStatus'](_0x27dbfb);}return _0xf3048c[_0xd46e('0x1a')](_0x27dbfb)[_0xd46e('0x1b')]();};}function respondWithResult(_0x1e9aae,_0x3fdf88){_0x3fdf88=_0x3fdf88||0xc8;return function(_0x50c7c3){if(_0x50c7c3){return _0x1e9aae[_0xd46e('0x1a')](_0x3fdf88)[_0xd46e('0x1c')](_0x50c7c3);}};}function respondWithFilteredResult(_0x417402,_0x3d72ce){return function(_0x36a317){if(_0x36a317){var _0x47fa8f=typeof _0x3d72ce[_0xd46e('0x1d')]===_0xd46e('0x1e')&&typeof _0x3d72ce[_0xd46e('0x1f')]==='undefined';var _0x5ddd04=_0x36a317[_0xd46e('0x20')];var _0x1bd574=_0x47fa8f?0x0:_0x3d72ce['offset'];var _0x4fd1f2=_0x47fa8f?_0x36a317[_0xd46e('0x20')]:_0x3d72ce[_0xd46e('0x1d')]+_0x3d72ce[_0xd46e('0x1f')];var _0x2273c5;if(_0x4fd1f2>=_0x5ddd04){_0x4fd1f2=_0x5ddd04;_0x2273c5=0xc8;}else{_0x2273c5=0xce;}_0x417402[_0xd46e('0x1a')](_0x2273c5);return _0x417402[_0xd46e('0x21')](_0xd46e('0x22'),_0x1bd574+'-'+_0x4fd1f2+'/'+_0x5ddd04)[_0xd46e('0x1c')](_0x36a317);}return null;};}function patchUpdates(_0xb4940){return function(_0x3c7e91){try{jsonpatch[_0xd46e('0x23')](_0x3c7e91,_0xb4940,!![]);}catch(_0x5ba94d){return BPromise[_0xd46e('0x24')](_0x5ba94d);}return _0x3c7e91[_0xd46e('0x25')]();};}function saveUpdates(_0x79aa51,_0x45ce0b){return function(_0x128246){if(_0x128246){return _0x128246[_0xd46e('0x26')](_0x79aa51)[_0xd46e('0x27')](function(_0x8a1be){return _0x8a1be;});}return null;};}function removeEntity(_0x62dea5,_0x4cf899){return function(_0x314570){if(_0x314570){return _0x314570['destroy']()['then'](function(){var _0x371054=_0x314570[_0xd46e('0x28')]({'plain':!![]});var _0x21135f=_0xd46e('0x29');return db[_0xd46e('0x2a')][_0xd46e('0x2b')]({'where':{'type':_0x21135f,'resourceId':_0x371054['id']}})[_0xd46e('0x27')](function(){return _0x314570;});})['then'](function(){_0x62dea5[_0xd46e('0x1a')](0xcc)[_0xd46e('0x1b')]();});}};}function handleEntityNotFound(_0xddbce9,_0x17db79){return function(_0x96f15c){if(!_0x96f15c){_0xddbce9[_0xd46e('0x2c')](0x194);}return _0x96f15c;};}function handleError(_0x58aeef,_0x465d54){_0x465d54=_0x465d54||0x1f4;return function(_0x3a1ced){logger[_0xd46e('0x2d')](_0x3a1ced[_0xd46e('0x2e')]);if(_0x3a1ced[_0xd46e('0x2f')]){delete _0x3a1ced[_0xd46e('0x2f')];}_0x58aeef[_0xd46e('0x1a')](_0x465d54)[_0xd46e('0x30')](_0x3a1ced);};}exports[_0xd46e('0x31')]=function(_0x45ea47,_0x2ff785){var _0x504324={},_0x2f4a1b={},_0x5ed8dc={'count':0x0,'rows':[]};var _0x1248ce=_[_0xd46e('0x32')](db[_0xd46e('0x33')][_0xd46e('0x34')],function(_0x5ef248){return{'name':_0x5ef248[_0xd46e('0x35')],'type':_0x5ef248[_0xd46e('0x36')]['key']};});_0x2f4a1b[_0xd46e('0x37')]=_[_0xd46e('0x32')](_0x1248ce,'name');_0x2f4a1b[_0xd46e('0x38')]=_[_0xd46e('0x39')](_0x45ea47[_0xd46e('0x38')]);_0x2f4a1b['filters']=_['intersection'](_0x2f4a1b[_0xd46e('0x37')],_0x2f4a1b[_0xd46e('0x38')]);_0x504324[_0xd46e('0x3a')]=_[_0xd46e('0x3b')](_0x2f4a1b[_0xd46e('0x37')],qs[_0xd46e('0x3c')](_0x45ea47[_0xd46e('0x38')][_0xd46e('0x3c')]));_0x504324['attributes']=_0x504324[_0xd46e('0x3a')][_0xd46e('0x3d')]?_0x504324[_0xd46e('0x3a')]:_0x2f4a1b[_0xd46e('0x37')];if(!_0x45ea47[_0xd46e('0x38')][_0xd46e('0x3e')](_0xd46e('0x3f'))){_0x504324['limit']=qs[_0xd46e('0x1f')](_0x45ea47[_0xd46e('0x38')]['limit']);_0x504324[_0xd46e('0x1d')]=qs[_0xd46e('0x1d')](_0x45ea47[_0xd46e('0x38')][_0xd46e('0x1d')]);}_0x504324['order']=qs[_0xd46e('0x40')](_0x45ea47[_0xd46e('0x38')][_0xd46e('0x40')]);_0x504324[_0xd46e('0x41')]=qs[_0xd46e('0x42')](_[_0xd46e('0x43')](_0x45ea47[_0xd46e('0x38')],_0x2f4a1b[_0xd46e('0x42')]),_0x1248ce);if(_0x45ea47['query'][_0xd46e('0x44')]){_0x504324[_0xd46e('0x41')]=_[_0xd46e('0x45')](_0x504324[_0xd46e('0x41')],{'$or':_[_0xd46e('0x32')](_0x1248ce,function(_0x56f99c){if(_0x56f99c[_0xd46e('0x36')]!=='VIRTUAL'){var _0x55230d={};_0x55230d[_0x56f99c['name']]={'$like':'%'+_0x45ea47['query'][_0xd46e('0x44')]+'%'};return _0x55230d;}})});}_0x504324=_['merge']({},_0x504324,_0x45ea47[_0xd46e('0x46')]);var _0x40720e={'where':_0x504324['where']};return db[_0xd46e('0x33')][_0xd46e('0x20')](_0x40720e)[_0xd46e('0x27')](function(_0x31ba12){_0x5ed8dc[_0xd46e('0x20')]=_0x31ba12;if(_0x45ea47[_0xd46e('0x38')][_0xd46e('0x47')]){_0x504324[_0xd46e('0x48')]=[{'all':!![]}];}return db[_0xd46e('0x33')][_0xd46e('0x49')](_0x504324);})[_0xd46e('0x27')](function(_0x5ea048){_0x5ed8dc['rows']=_0x5ea048;return _0x5ed8dc;})['then'](respondWithFilteredResult(_0x2ff785,_0x504324))[_0xd46e('0x4a')](handleError(_0x2ff785,null));};exports['show']=function(_0x168d35,_0x272f5f){var _0x3fdf67={'raw':!![],'where':{'id':_0x168d35[_0xd46e('0x4b')]['id']}},_0x416505={};_0x416505[_0xd46e('0x37')]=_[_0xd46e('0x39')](db[_0xd46e('0x33')]['rawAttributes']);_0x416505[_0xd46e('0x38')]=_['keys'](_0x168d35[_0xd46e('0x38')]);_0x416505[_0xd46e('0x42')]=_[_0xd46e('0x3b')](_0x416505[_0xd46e('0x37')],_0x416505[_0xd46e('0x38')]);_0x3fdf67['attributes']=_[_0xd46e('0x3b')](_0x416505[_0xd46e('0x37')],qs[_0xd46e('0x3c')](_0x168d35[_0xd46e('0x38')][_0xd46e('0x3c')]));_0x3fdf67['attributes']=_0x3fdf67[_0xd46e('0x3a')][_0xd46e('0x3d')]?_0x3fdf67[_0xd46e('0x3a')]:_0x416505[_0xd46e('0x37')];if(_0x168d35[_0xd46e('0x38')]['includeAll']){_0x3fdf67[_0xd46e('0x48')]=[{'all':!![]}];}_0x3fdf67=_[_0xd46e('0x45')]({},_0x3fdf67,_0x168d35[_0xd46e('0x46')]);return db[_0xd46e('0x33')][_0xd46e('0x4c')](_0x3fdf67)[_0xd46e('0x27')](handleEntityNotFound(_0x272f5f,null))[_0xd46e('0x27')](respondWithResult(_0x272f5f,null))[_0xd46e('0x4a')](handleError(_0x272f5f,null));};exports['create']=function(_0xf9dab,_0x71a8dc){return db[_0xd46e('0x33')][_0xd46e('0x4d')](_0xf9dab[_0xd46e('0x4e')],{})['then'](function(_0x4ae314){var _0x3a94cf=_0xf9dab[_0xd46e('0x4f')][_0xd46e('0x28')]({'plain':!![]});if(!_0x3a94cf)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3a94cf['role']===_0xd46e('0x4f')){var _0x9d8638=_0x4ae314['get']({'plain':!![]});var _0x2eee92=_0xd46e('0x50');return db[_0xd46e('0x51')][_0xd46e('0x4c')]({'where':{'name':_0x2eee92,'userProfileId':_0x3a94cf[_0xd46e('0x52')]},'raw':!![]})[_0xd46e('0x27')](function(_0x80ed51){if(_0x80ed51&&_0x80ed51[_0xd46e('0x53')]===0x0){return db['UserProfileResource'][_0xd46e('0x4d')]({'name':_0x9d8638[_0xd46e('0x2f')],'resourceId':_0x9d8638['id'],'type':_0xd46e('0x29'),'sectionId':_0x80ed51['id']},{})[_0xd46e('0x27')](function(){return _0x4ae314;});}else{return _0x4ae314;}})['catch'](function(_0x56dd9a){logger[_0xd46e('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x56dd9a);throw _0x56dd9a;});}return _0x4ae314;})[_0xd46e('0x27')](respondWithResult(_0x71a8dc,0xc9))[_0xd46e('0x4a')](handleError(_0x71a8dc,null));};exports[_0xd46e('0x26')]=function(_0x31f7eb,_0x5a7870){if(_0x31f7eb[_0xd46e('0x4e')]['id']){delete _0x31f7eb['body']['id'];}return db[_0xd46e('0x33')][_0xd46e('0x4c')]({'where':{'id':_0x31f7eb[_0xd46e('0x4b')]['id']}})['then'](handleEntityNotFound(_0x5a7870,null))[_0xd46e('0x27')](saveUpdates(_0x31f7eb[_0xd46e('0x4e')],null))[_0xd46e('0x27')](respondWithResult(_0x5a7870,null))[_0xd46e('0x4a')](handleError(_0x5a7870,null));};exports[_0xd46e('0x2b')]=function(_0x2cc676,_0x2760ef){return db[_0xd46e('0x33')][_0xd46e('0x4c')]({'where':{'id':_0x2cc676[_0xd46e('0x4b')]['id']}})[_0xd46e('0x27')](handleEntityNotFound(_0x2760ef,null))[_0xd46e('0x27')](removeEntity(_0x2760ef,null))[_0xd46e('0x4a')](handleError(_0x2760ef,null));};exports[_0xd46e('0x54')]=function(_0x47a86c,_0x3ec709){var _0x37a22f=0xa;var _0xe0cd61=[_0xd46e('0x55'),'left_join',_0xd46e('0x56'),_0xd46e('0x57')];var _0xaf9641={'SUM':_0xd46e('0x58'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xd46e('0x59'),'MAX':_0xd46e('0x5a'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0xd46e('0x5b'),'GROUP_CONCAT ASC':_0xd46e('0x5c'),'GROUP_CONCAT DESC':_0xd46e('0x5d')};var _0x481dce={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xd46e('0x5e'),'HOUR':_0xd46e('0x5f'),'ROUND':_0xd46e('0x60'),'UNIX_TIMESTAMP':_0xd46e('0x61')};var _0x2dacb4=function(_0x2f9fcb){return!_[_0xd46e('0x62')]([_0xd46e('0x63'),_0xd46e('0x64'),_0xd46e('0x65'),_0xd46e('0x66')],_0x2f9fcb);};var _0x1aaa99=function(_0x272514){if(!_0x272514||!_0x272514[_0xd46e('0x67')][_0xd46e('0x3d')]){return'';}for(var _0x476f09='(',_0x5067b7=0x0;_0x5067b7<_0x272514[_0xd46e('0x67')][_0xd46e('0x3d')];_0x5067b7+=0x1){_0x5067b7>0x0&&(_0x476f09+='\x20'+_0x272514[_0xd46e('0x68')]+'\x20');_0x476f09+=_0x272514['rules'][_0x5067b7][_0xd46e('0x69')]?_0x1aaa99(_0x272514[_0xd46e('0x67')][_0x5067b7]['group']):_0x272514[_0xd46e('0x67')][_0x5067b7][_0xd46e('0x6a')]+'\x20'+_0x272514[_0xd46e('0x67')][_0x5067b7]['condition']+(_0x2dacb4(_0x272514[_0xd46e('0x67')][_0x5067b7][_0xd46e('0x6b')])?'\x20'+_0x272514[_0xd46e('0x67')][_0x5067b7]['value']:'');}return _0x476f09+')';};var _0xe5f8cd={'where':{'id':_0x47a86c[_0xd46e('0x4b')]['id']}},_0x516e7d,_0x32eed0,_0x148187,_0x35db1b,_0x4f3ba0;_0xe5f8cd=_[_0xd46e('0x45')]({},_0xe5f8cd,_0x47a86c[_0xd46e('0x46')]);return db[_0xd46e('0x33')][_0xd46e('0x4c')](_0xe5f8cd)[_0xd46e('0x27')](function(_0x16f906){if(_0x16f906){_0x516e7d=_0x16f906;return _0x16f906[_0xd46e('0x6c')]();}return null;})[_0xd46e('0x27')](function(_0x3e55a3){if(_0x3e55a3){if(!_0x3e55a3[_0xd46e('0x3d')]){throw new db[(_0xd46e('0x6d'))][(_0xd46e('0x6e'))](_0xd46e('0x6f'),0x193);}_0x32eed0=_0x3e55a3;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0xd46e('0x27')](function(_0x3e0ed5){if(_0x3e0ed5){_0x148187=_[_0xd46e('0x70')](_0x3e0ed5,'id');var _0x2fff69;var _0x249938=squel['select']();_0x249938[_0xd46e('0x71')](_0x516e7d[_0xd46e('0x72')]);for(var _0xfb4073=0x0;_0xfb4073<_0x32eed0[_0xd46e('0x3d')];_0xfb4073+=0x1){_0x2fff69=_0x32eed0[_0xfb4073]['MetricId']?_0x148187[_0x32eed0[_0xfb4073][_0xd46e('0x73')]][_0xd46e('0x74')]:_0x32eed0[_0xfb4073]['field'];_0x2fff69=_0x32eed0[_0xfb4073][_0xd46e('0x75')]?_[_0xd46e('0x76')](_0xaf9641[_0x32eed0[_0xfb4073]['function']],'%s',_0x2fff69):_0x2fff69;_0x2fff69=_0x32eed0[_0xfb4073][_0xd46e('0x77')]?_[_0xd46e('0x76')](_0x481dce[_0x32eed0[_0xfb4073]['format']],'%s',_0x2fff69):_0x2fff69;if(_0x32eed0[_0xfb4073][_0xd46e('0x78')]){_0x249938['group'](_0x2fff69);}_0x32eed0[_0xfb4073][_0xd46e('0x79')]&&_0x249938[_0xd46e('0x7a')](_0x2fff69,_0x32eed0[_0xfb4073]['orderBy']==='DESC'?![]:!![]);_0x249938[_0xd46e('0x6a')](_0x2fff69,_0x32eed0[_0xfb4073][_0xd46e('0x7b')]||_0x2fff69);}if(_0x516e7d[_0xd46e('0x7c')]){_0x516e7d[_0xd46e('0x7c')]=JSON['parse'](_0x516e7d[_0xd46e('0x7c')]);for(var _0x372509=0x0;_0x372509<_0x516e7d['joins'][_0xd46e('0x3d')];_0x372509+=0x1){if(_0x516e7d[_0xd46e('0x7c')][_0x372509][_0xd46e('0x36')]&&_[_0xd46e('0x62')](_0xe0cd61,_0x516e7d[_0xd46e('0x7c')][_0x372509][_0xd46e('0x36')])&&_0x516e7d[_0xd46e('0x7c')][_0x372509][_0xd46e('0x7d')]&&_0x516e7d[_0xd46e('0x7c')][_0x372509]['foreignTable']&&_0x516e7d[_0xd46e('0x7c')][_0x372509][_0xd46e('0x7e')]){_0x249938[_0x516e7d['joins'][_0x372509][_0xd46e('0x36')]](_0x516e7d[_0xd46e('0x7c')][_0x372509][_0xd46e('0x7f')],null,util[_0xd46e('0x77')](_0xd46e('0x80'),_0x516e7d[_0xd46e('0x72')],_0x516e7d['joins'][_0x372509]['parentKey'],_0x516e7d[_0xd46e('0x7c')][_0x372509][_0xd46e('0x7f')],_0x516e7d['joins'][_0x372509]['foreignKey']));}}}if(_0x516e7d['conditions']){_0x516e7d[_0xd46e('0x81')]=JSON[_0xd46e('0x82')](_0x516e7d[_0xd46e('0x81')]);_0x249938['where'](_0x1aaa99(_0x516e7d[_0xd46e('0x81')][_0xd46e('0x69')]));}_0x4f3ba0=_0x249938[_0xd46e('0x83')]();_0x249938['limit'](_0x37a22f);_0x249938['offset'](0x0);logger['debug']('Limited\x20Query:',_0x249938[_0xd46e('0x84')]());return dbH['sequelize'][_0xd46e('0x38')](_0x249938['toString'](),{'type':dbH['sequelize'][_0xd46e('0x85')][_0xd46e('0x86')]});}})[_0xd46e('0x27')](respondWithResult(_0x3ec709,null))[_0xd46e('0x4a')](handleError(_0x3ec709,null));};function runReport(_0xf16d87,_0x99872a,_0x57a7cc){var _0x586024=_0x99872a[_0xd46e('0x2f')];var _0x383919=0xa;var _0x114f2c=[_0xd46e('0x55'),'left_join',_0xd46e('0x56'),_0xd46e('0x57')];var _0x4ca21f={'SUM':_0xd46e('0x58'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xd46e('0x59'),'MAX':_0xd46e('0x5a'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0xd46e('0x5b'),'GROUP_CONCAT ASC':_0xd46e('0x5c'),'GROUP_CONCAT DESC':_0xd46e('0x5d')};var _0x5ef4cc={'SEC_TO_TIME':_0xd46e('0x87'),'DATE':_0xd46e('0x5e'),'HOUR':_0xd46e('0x5f'),'ROUND':_0xd46e('0x60'),'UNIX_TIMESTAMP':_0xd46e('0x61')};var _0x88460a=function(_0x3a3744){return!_[_0xd46e('0x62')]([_0xd46e('0x63'),_0xd46e('0x64'),_0xd46e('0x65'),_0xd46e('0x66')],_0x3a3744);};var _0x3c476d=function(_0x1b2a6d){if(!_0x1b2a6d||!_0x1b2a6d[_0xd46e('0x67')][_0xd46e('0x3d')]){return'';}for(var _0x441f73='(',_0x1d2738=0x0;_0x1d2738<_0x1b2a6d['rules'][_0xd46e('0x3d')];_0x1d2738+=0x1){_0x1d2738>0x0&&(_0x441f73+='\x20'+_0x1b2a6d['operator']+'\x20');_0x441f73+=_0x1b2a6d[_0xd46e('0x67')][_0x1d2738][_0xd46e('0x69')]?_0x3c476d(_0x1b2a6d['rules'][_0x1d2738][_0xd46e('0x69')]):_0x1b2a6d[_0xd46e('0x67')][_0x1d2738][_0xd46e('0x6a')]+'\x20'+_0x1b2a6d[_0xd46e('0x67')][_0x1d2738][_0xd46e('0x6b')]+(_0x88460a(_0x1b2a6d[_0xd46e('0x67')][_0x1d2738][_0xd46e('0x6b')])?'\x20'+_0x1b2a6d[_0xd46e('0x67')][_0x1d2738][_0xd46e('0x88')]:'');}return _0x441f73+')';};var _0x3fa34d={'where':{'id':_0xf16d87['id']}},_0xc098c9,_0x5f5ba7,_0x493df5,_0x18e140,_0x459a0c;_0x3fa34d=_[_0xd46e('0x45')]({},_0x3fa34d,_0x57a7cc);return db[_0xd46e('0x33')][_0xd46e('0x4c')](_0x3fa34d)[_0xd46e('0x27')](function(_0x5b554e){if(_0x5b554e){_0xc098c9=_0x5b554e;return _0x5b554e[_0xd46e('0x6c')]();}return null;})[_0xd46e('0x27')](function(_0xa254f5){if(_0xa254f5){if(!_0xa254f5[_0xd46e('0x3d')]){throw new db[(_0xd46e('0x6d'))][(_0xd46e('0x6e'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x5f5ba7=_0xa254f5;return db[_0xd46e('0x89')][_0xd46e('0x49')]({'raw':!![]});}return null;})['then'](function(_0x3c8d68){if(_0x3c8d68){_0x493df5=_[_0xd46e('0x70')](_0x3c8d68,'id');var _0x9e222d;var _0x3da17e=squel[_0xd46e('0x8a')]();_0x3da17e[_0xd46e('0x71')](_0xc098c9[_0xd46e('0x72')]);for(var _0x282f71=0x0;_0x282f71<_0x5f5ba7[_0xd46e('0x3d')];_0x282f71+=0x1){_0x9e222d=_0x5f5ba7[_0x282f71][_0xd46e('0x73')]?_0x493df5[_0x5f5ba7[_0x282f71][_0xd46e('0x73')]][_0xd46e('0x74')]:_0x5f5ba7[_0x282f71][_0xd46e('0x6a')];_0x9e222d=_0x5f5ba7[_0x282f71][_0xd46e('0x75')]?_['replace'](_0x4ca21f[_0x5f5ba7[_0x282f71]['function']],'%s',_0x9e222d):_0x9e222d;_0x9e222d=_0x5f5ba7[_0x282f71][_0xd46e('0x77')]?_[_0xd46e('0x76')](_0x5ef4cc[_0x5f5ba7[_0x282f71][_0xd46e('0x77')]],'%s',_0x9e222d):_0x9e222d;if(_0x5f5ba7[_0x282f71][_0xd46e('0x78')]){_0x3da17e[_0xd46e('0x69')](_0x9e222d);}_0x5f5ba7[_0x282f71][_0xd46e('0x79')]&&_0x3da17e['order'](_0x9e222d,_0x5f5ba7[_0x282f71][_0xd46e('0x79')]===_0xd46e('0x8b')?![]:!![]);_0x3da17e[_0xd46e('0x6a')](_0x9e222d,_0x5f5ba7[_0x282f71][_0xd46e('0x7b')]||_0x9e222d);}if(_0xc098c9['joins']){_0xc098c9[_0xd46e('0x7c')]=JSON[_0xd46e('0x82')](_0xc098c9['joins']);for(var _0xdf967c=0x0;_0xdf967c<_0xc098c9['joins']['length'];_0xdf967c+=0x1){if(_0xc098c9[_0xd46e('0x7c')][_0xdf967c][_0xd46e('0x36')]&&_[_0xd46e('0x62')](_0x114f2c,_0xc098c9[_0xd46e('0x7c')][_0xdf967c]['type'])&&_0xc098c9['joins'][_0xdf967c][_0xd46e('0x7d')]&&_0xc098c9['joins'][_0xdf967c][_0xd46e('0x7f')]&&_0xc098c9['joins'][_0xdf967c]['foreignKey']){_0x3da17e[_0xc098c9[_0xd46e('0x7c')][_0xdf967c][_0xd46e('0x36')]](_0xc098c9['joins'][_0xdf967c]['foreignTable'],null,util[_0xd46e('0x77')](_0xd46e('0x80'),_0xc098c9[_0xd46e('0x72')],_0xc098c9[_0xd46e('0x7c')][_0xdf967c]['parentKey'],_0xc098c9[_0xd46e('0x7c')][_0xdf967c][_0xd46e('0x7f')],_0xc098c9['joins'][_0xdf967c][_0xd46e('0x7e')]));}}}if(_0xc098c9[_0xd46e('0x81')]){_0xc098c9[_0xd46e('0x81')]=JSON[_0xd46e('0x82')](_0xc098c9[_0xd46e('0x81')]);_0x3da17e[_0xd46e('0x41')](_0x3c476d(_0xc098c9['conditions'][_0xd46e('0x69')]));}_0x459a0c=_0x3da17e[_0xd46e('0x83')]();_0x3da17e['limit'](_0x383919);_0x3da17e['offset'](0x0);return;}})[_0xd46e('0x27')](function(){if(_0x99872a[_0xd46e('0x8c')]==='web'){return null;}var _0x5e637d=_[_0xd46e('0x45')](_0x99872a,{'name':_0x99872a[_0xd46e('0x8d')]||_0x99872a['name']||_0xc098c9[_0xd46e('0x2f')],'basename':_0x586024,'savename':util[_0xd46e('0x77')](_0xd46e('0x8e'),_0x99872a[_0xd46e('0x2f')]||_0xc098c9[_0xd46e('0x2f')],require(_0xd46e('0x8f'))['generate'](0x4),_0x99872a[_0xd46e('0x8c')]||_0xd46e('0x90')),'reportId':_0xc098c9['id'],'reportType':_0xd46e('0x91')});return db[_0xd46e('0x92')][_0xd46e('0x4d')](_0x5e637d,{'raw':!![]});})[_0xd46e('0x27')](function(_0x3311a6){if(_0xc098c9[_0xd46e('0x72')]===_0xd46e('0x93')){_0x459a0c[_0xd46e('0x41')](_0xc098c9[_0xd46e('0x72')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x99872a[_0xd46e('0x94')],_0x99872a['endDate']);}else{_0x459a0c['where'](_0xc098c9[_0xd46e('0x72')]+_0xd46e('0x95'),_0x99872a[_0xd46e('0x94')],_0x99872a[_0xd46e('0x96')]);}if(_0x3311a6){logger[_0xd46e('0x97')](_0xd46e('0x98'),_0x459a0c[_0xd46e('0x84')]());require(_0xd46e('0x99'))['fork'](path[_0xd46e('0x55')](__dirname,'../../components/export/',_0x3311a6[_0xd46e('0x8c')]),[_0x3311a6['id'],_0x459a0c[_0xd46e('0x84')](),path[_0xd46e('0x55')](__dirname,_0xd46e('0x9a'),_0x3311a6[_0xd46e('0x9b')]),_0x586024]);return _0x3311a6;}else{var _0x399918=squel[_0xd46e('0x8a')]();_0x399918[_0xd46e('0x71')]('('+_0x459a0c['toString']()+')',_0xd46e('0x9c'));_0x399918[_0xd46e('0x6a')](_0xd46e('0x9d'),'count');_0x459a0c[_0xd46e('0x1f')](_0x99872a[_0xd46e('0x1f')]||_0x383919);_0x459a0c[_0xd46e('0x1d')](_0x99872a['offset']||0x0);return dbH[_0xd46e('0x9e')][_0xd46e('0x38')](_0x399918[_0xd46e('0x84')](),{'type':dbH[_0xd46e('0x9e')][_0xd46e('0x85')][_0xd46e('0x86')]})['then'](function(_0x4967ff){if(!_0x4967ff[_0xd46e('0x3d')]){_0x18e140=0x0;}else{_0x18e140=_0x4967ff[0x0][_0xd46e('0x20')]||0x0;}return dbH['sequelize'][_0xd46e('0x38')](_0x459a0c[_0xd46e('0x84')](),{'type':dbH[_0xd46e('0x9e')][_0xd46e('0x85')][_0xd46e('0x86')]});})[_0xd46e('0x27')](function(_0x4bb76b){return{'rows':_0x4bb76b||[],'count':_0x18e140};});}});}exports['run']=function(_0x204a9f,_0x52ca5a){return runReport(_0x204a9f[_0xd46e('0x4b')],_0x204a9f[_0xd46e('0x38')],_0x204a9f['options'])[_0xd46e('0x27')](respondWithResult(_0x52ca5a,null))[_0xd46e('0x4a')](handleError(_0x52ca5a,null));};exports[_0xd46e('0x9f')]=runReport;exports[_0xd46e('0x38')]=function(_0x786ae,_0x537c73){var _0x1610bd=0xa;var _0x20cc4c=[_0xd46e('0x55'),_0xd46e('0xa0'),_0xd46e('0x56'),_0xd46e('0x57')];var _0x368742={'SUM':_0xd46e('0x58'),'COUNT':_0xd46e('0xa1'),'COUNT DISTINCT':_0xd46e('0x59'),'MAX':_0xd46e('0x5a'),'MIN':_0xd46e('0xa2'),'AVG':_0xd46e('0xa3'),'GROUP_CONCAT':_0xd46e('0x5b'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xd46e('0x5d')};var _0x285cf8={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xd46e('0x5e'),'HOUR':_0xd46e('0x5f'),'ROUND':_0xd46e('0x60'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0xc87da2=function(_0x195f02){return!_[_0xd46e('0x62')]([_0xd46e('0x63'),'IS\x20NOT\x20NULL',_0xd46e('0x65'),_0xd46e('0x66')],_0x195f02);};var _0x44322f=function(_0x49959f){if(!_0x49959f||!_0x49959f['rules'][_0xd46e('0x3d')]){return'';}for(var _0x2094e5='(',_0x85aac1=0x0;_0x85aac1<_0x49959f[_0xd46e('0x67')][_0xd46e('0x3d')];_0x85aac1+=0x1){_0x85aac1>0x0&&(_0x2094e5+='\x20'+_0x49959f[_0xd46e('0x68')]+'\x20');_0x2094e5+=_0x49959f['rules'][_0x85aac1][_0xd46e('0x69')]?_0x44322f(_0x49959f['rules'][_0x85aac1][_0xd46e('0x69')]):_0x49959f['rules'][_0x85aac1][_0xd46e('0x6a')]+'\x20'+_0x49959f['rules'][_0x85aac1]['condition']+(_0xc87da2(_0x49959f[_0xd46e('0x67')][_0x85aac1][_0xd46e('0x6b')])?'\x20'+_0x49959f[_0xd46e('0x67')][_0x85aac1][_0xd46e('0x88')]:'');}return _0x2094e5+')';};var _0x101a29={'where':{'id':_0x786ae[_0xd46e('0x4b')]['id']}},_0x3a44da,_0x417068,_0x52e73e,_0x206077,_0xe729b6;_0x101a29=_[_0xd46e('0x45')]({},_0x101a29,_0x786ae[_0xd46e('0x46')]);return db['AnalyticDefaultReport'][_0xd46e('0x4c')](_0x101a29)[_0xd46e('0x27')](function(_0x1d08bb){if(_0x1d08bb){_0x3a44da=_0x1d08bb;return _0x1d08bb['getFields']();}return null;})[_0xd46e('0x27')](function(_0x8c6ed1){if(_0x8c6ed1){if(!_0x8c6ed1['length']){throw new db['Sequelize']['ValidationErrorItem'](_0xd46e('0x6f'),0x193);}_0x417068=_0x8c6ed1;return db[_0xd46e('0x89')]['findAll']({'raw':!![]});}return null;})[_0xd46e('0x27')](function(_0x3a13f8){if(_0x3a13f8){_0x52e73e=_['keyBy'](_0x3a13f8,'id');var _0x5a8661;var _0x157fb0=squel[_0xd46e('0x8a')]();_0x157fb0[_0xd46e('0x71')](_0x3a44da[_0xd46e('0x72')]);for(var _0x50750f=0x0;_0x50750f<_0x417068['length'];_0x50750f+=0x1){_0x5a8661=_0x417068[_0x50750f][_0xd46e('0x73')]?_0x52e73e[_0x417068[_0x50750f][_0xd46e('0x73')]][_0xd46e('0x74')]:_0x417068[_0x50750f][_0xd46e('0x6a')];_0x5a8661=_0x417068[_0x50750f][_0xd46e('0x75')]?_[_0xd46e('0x76')](_0x368742[_0x417068[_0x50750f][_0xd46e('0x75')]],'%s',_0x5a8661):_0x5a8661;_0x5a8661=_0x417068[_0x50750f]['format']?_[_0xd46e('0x76')](_0x285cf8[_0x417068[_0x50750f][_0xd46e('0x77')]],'%s',_0x5a8661):_0x5a8661;if(_0x417068[_0x50750f]['groupBy']){_0x157fb0[_0xd46e('0x69')](_0x5a8661);}_0x417068[_0x50750f][_0xd46e('0x79')]&&_0x157fb0[_0xd46e('0x7a')](_0x5a8661,_0x417068[_0x50750f][_0xd46e('0x79')]===_0xd46e('0x8b')?![]:!![]);_0x157fb0[_0xd46e('0x6a')](_0x5a8661,_0x417068[_0x50750f][_0xd46e('0x7b')]||_0x5a8661);}if(_0x3a44da[_0xd46e('0x7c')]){_0x3a44da['joins']=JSON[_0xd46e('0x82')](_0x3a44da[_0xd46e('0x7c')]);for(var _0x3c819b=0x0;_0x3c819b<_0x3a44da[_0xd46e('0x7c')][_0xd46e('0x3d')];_0x3c819b+=0x1){if(_0x3a44da['joins'][_0x3c819b][_0xd46e('0x36')]&&_[_0xd46e('0x62')](_0x20cc4c,_0x3a44da[_0xd46e('0x7c')][_0x3c819b][_0xd46e('0x36')])&&_0x3a44da[_0xd46e('0x7c')][_0x3c819b][_0xd46e('0x7d')]&&_0x3a44da[_0xd46e('0x7c')][_0x3c819b][_0xd46e('0x7f')]&&_0x3a44da[_0xd46e('0x7c')][_0x3c819b]['foreignKey']){_0x157fb0[_0x3a44da[_0xd46e('0x7c')][_0x3c819b][_0xd46e('0x36')]](_0x3a44da[_0xd46e('0x7c')][_0x3c819b][_0xd46e('0x7f')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x3a44da[_0xd46e('0x72')],_0x3a44da['joins'][_0x3c819b][_0xd46e('0x7d')],_0x3a44da[_0xd46e('0x7c')][_0x3c819b][_0xd46e('0x7f')],_0x3a44da[_0xd46e('0x7c')][_0x3c819b]['foreignKey']));}}}if(_0x3a44da[_0xd46e('0x81')]){_0x3a44da[_0xd46e('0x81')]=JSON[_0xd46e('0x82')](_0x3a44da[_0xd46e('0x81')]);_0x157fb0[_0xd46e('0x41')](_0x44322f(_0x3a44da[_0xd46e('0x81')][_0xd46e('0x69')]));}_0xe729b6=_0x157fb0[_0xd46e('0x83')]();_0x157fb0[_0xd46e('0x1f')](_0x1610bd);_0x157fb0['offset'](0x0);logger['debug'](_0xd46e('0xa4'),_0x157fb0['toString']());return dbH[_0xd46e('0x9e')][_0xd46e('0x38')](_0x157fb0[_0xd46e('0x84')](),{'type':dbH['sequelize'][_0xd46e('0x85')][_0xd46e('0x86')]});}})[_0xd46e('0x27')](function(){return{'sql':_0xe729b6['toString']()};})['then'](respondWithResult(_0x537c73,null))[_0xd46e('0x4a')](handleError(_0x537c73,null));}; \ No newline at end of file +var _0xabce=['where','findAll','show','includeAll','options','find','catch','create','body','user','role','Reports','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%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)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','condition','value','getFields','Please\x20insert\x20at\x20least\x20one\x20field','table','MetricId','field','function','replace','format','groupBy','orderBy','joins','parse','includes','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','debug','Limited\x20Query:','toString','SELECT','COUNT(DISTINCT\x20%s)','MAX(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','ValidationErrorItem','AnalyticMetric','keyBy','select','metric','DESC','foreignKey','output','web','%s-%s.%s','default','cdr','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','from','countTable','COUNT(*)','sequelize','QueryTypes','run','runReport','Sequelize','alias','clone','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','offset','limit','undefined','count','set','json','apply','save','update','then','get','DefaultReports','UserProfileResource','destroy','error','stack','name','send','index','map','AnalyticDefaultReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','filter','merge'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xabce,0x103));var _0xeabc=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0xabce[_0x2b5eae];return _0x5f3ac9;};'use strict';var emlformat=require(_0xeabc('0x0'));var rimraf=require(_0xeabc('0x1'));var zipdir=require(_0xeabc('0x2'));var jsonpatch=require(_0xeabc('0x3'));var rp=require(_0xeabc('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xeabc('0x5'));var util=require(_0xeabc('0x6'));var path=require(_0xeabc('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xeabc('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xeabc('0x9'));var squel=require('squel');var crypto=require(_0xeabc('0xa'));var jsforce=require(_0xeabc('0xb'));var deskjs=require(_0xeabc('0xc'));var toCsv=require('to-csv');var querystring=require(_0xeabc('0xd'));var Papa=require(_0xeabc('0xe'));var Redis=require(_0xeabc('0xf'));var authService=require(_0xeabc('0x10'));var qs=require(_0xeabc('0x11'));var as=require(_0xeabc('0x12'));var hardwareService=require(_0xeabc('0x13'));var logger=require(_0xeabc('0x14'))(_0xeabc('0x15'));var utils=require(_0xeabc('0x16'));var config=require(_0xeabc('0x17'));var licenseUtil=require(_0xeabc('0x18'));var db=require(_0xeabc('0x19'))['db'];var dbH=require(_0xeabc('0x19'))[_0xeabc('0x1a')];function respondWithStatusCode(_0xcfbf06,_0x53df9c){_0x53df9c=_0x53df9c||0xcc;return function(_0x235c2d){if(_0x235c2d){return _0xcfbf06[_0xeabc('0x1b')](_0x53df9c);}return _0xcfbf06[_0xeabc('0x1c')](_0x53df9c)['end']();};}function respondWithResult(_0x5f4ee8,_0x3170ea){_0x3170ea=_0x3170ea||0xc8;return function(_0x3ae954){if(_0x3ae954){return _0x5f4ee8[_0xeabc('0x1c')](_0x3170ea)['json'](_0x3ae954);}};}function respondWithFilteredResult(_0xf913d7,_0x638976){return function(_0x49f2d8){if(_0x49f2d8){var _0x53fe28=typeof _0x638976[_0xeabc('0x1d')]==='undefined'&&typeof _0x638976[_0xeabc('0x1e')]===_0xeabc('0x1f');var _0x58a3c0=_0x49f2d8[_0xeabc('0x20')];var _0x31dd53=_0x53fe28?0x0:_0x638976[_0xeabc('0x1d')];var _0x384be5=_0x53fe28?_0x49f2d8[_0xeabc('0x20')]:_0x638976['offset']+_0x638976[_0xeabc('0x1e')];var _0x4d68ea;if(_0x384be5>=_0x58a3c0){_0x384be5=_0x58a3c0;_0x4d68ea=0xc8;}else{_0x4d68ea=0xce;}_0xf913d7[_0xeabc('0x1c')](_0x4d68ea);return _0xf913d7[_0xeabc('0x21')]('Content-Range',_0x31dd53+'-'+_0x384be5+'/'+_0x58a3c0)[_0xeabc('0x22')](_0x49f2d8);}return null;};}function patchUpdates(_0x41d67a){return function(_0x254590){try{jsonpatch[_0xeabc('0x23')](_0x254590,_0x41d67a,!![]);}catch(_0x3c9611){return BPromise['reject'](_0x3c9611);}return _0x254590[_0xeabc('0x24')]();};}function saveUpdates(_0x10c675,_0x91ab00){return function(_0x5bdd57){if(_0x5bdd57){return _0x5bdd57[_0xeabc('0x25')](_0x10c675)[_0xeabc('0x26')](function(_0x214953){return _0x214953;});}return null;};}function removeEntity(_0x319119,_0x5b8838){return function(_0x109e1d){if(_0x109e1d){return _0x109e1d['destroy']()[_0xeabc('0x26')](function(){var _0x4d4e29=_0x109e1d[_0xeabc('0x27')]({'plain':!![]});var _0x12acbd=_0xeabc('0x28');return db[_0xeabc('0x29')][_0xeabc('0x2a')]({'where':{'type':_0x12acbd,'resourceId':_0x4d4e29['id']}})[_0xeabc('0x26')](function(){return _0x109e1d;});})[_0xeabc('0x26')](function(){_0x319119['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x459c8a,_0x5bf8f2){return function(_0x3c1b5b){if(!_0x3c1b5b){_0x459c8a[_0xeabc('0x1b')](0x194);}return _0x3c1b5b;};}function handleError(_0x48fb52,_0x2163e6){_0x2163e6=_0x2163e6||0x1f4;return function(_0x38572d){logger[_0xeabc('0x2b')](_0x38572d[_0xeabc('0x2c')]);if(_0x38572d[_0xeabc('0x2d')]){delete _0x38572d[_0xeabc('0x2d')];}_0x48fb52[_0xeabc('0x1c')](_0x2163e6)[_0xeabc('0x2e')](_0x38572d);};}exports[_0xeabc('0x2f')]=function(_0x5ebb86,_0x5b34dd){var _0x5bb1f1={},_0x2f03e8={},_0x2d027e={'count':0x0,'rows':[]};var _0x98b445=_[_0xeabc('0x30')](db[_0xeabc('0x31')][_0xeabc('0x32')],function(_0x61c0af){return{'name':_0x61c0af['fieldName'],'type':_0x61c0af[_0xeabc('0x33')][_0xeabc('0x34')]};});_0x2f03e8[_0xeabc('0x35')]=_['map'](_0x98b445,_0xeabc('0x2d'));_0x2f03e8[_0xeabc('0x36')]=_[_0xeabc('0x37')](_0x5ebb86['query']);_0x2f03e8[_0xeabc('0x38')]=_[_0xeabc('0x39')](_0x2f03e8[_0xeabc('0x35')],_0x2f03e8['query']);_0x5bb1f1[_0xeabc('0x3a')]=_[_0xeabc('0x39')](_0x2f03e8['model'],qs['fields'](_0x5ebb86[_0xeabc('0x36')][_0xeabc('0x3b')]));_0x5bb1f1['attributes']=_0x5bb1f1[_0xeabc('0x3a')][_0xeabc('0x3c')]?_0x5bb1f1[_0xeabc('0x3a')]:_0x2f03e8[_0xeabc('0x35')];if(!_0x5ebb86[_0xeabc('0x36')]['hasOwnProperty'](_0xeabc('0x3d'))){_0x5bb1f1['limit']=qs[_0xeabc('0x1e')](_0x5ebb86[_0xeabc('0x36')][_0xeabc('0x1e')]);_0x5bb1f1['offset']=qs['offset'](_0x5ebb86[_0xeabc('0x36')]['offset']);}_0x5bb1f1[_0xeabc('0x3e')]=qs['sort'](_0x5ebb86['query']['sort']);_0x5bb1f1['where']=qs[_0xeabc('0x38')](_['pick'](_0x5ebb86[_0xeabc('0x36')],_0x2f03e8[_0xeabc('0x38')]),_0x98b445);if(_0x5ebb86['query'][_0xeabc('0x3f')]){_0x5bb1f1['where']=_[_0xeabc('0x40')](_0x5bb1f1['where'],{'$or':_[_0xeabc('0x30')](_0x98b445,function(_0xf1b7ef){if(_0xf1b7ef[_0xeabc('0x33')]!=='VIRTUAL'){var _0x5a00d0={};_0x5a00d0[_0xf1b7ef['name']]={'$like':'%'+_0x5ebb86[_0xeabc('0x36')][_0xeabc('0x3f')]+'%'};return _0x5a00d0;}})});}_0x5bb1f1=_[_0xeabc('0x40')]({},_0x5bb1f1,_0x5ebb86['options']);var _0x4f1897={'where':_0x5bb1f1[_0xeabc('0x41')]};return db[_0xeabc('0x31')]['count'](_0x4f1897)[_0xeabc('0x26')](function(_0x5e0b78){_0x2d027e[_0xeabc('0x20')]=_0x5e0b78;if(_0x5ebb86['query']['includeAll']){_0x5bb1f1['include']=[{'all':!![]}];}return db[_0xeabc('0x31')][_0xeabc('0x42')](_0x5bb1f1);})[_0xeabc('0x26')](function(_0x3eeeb5){_0x2d027e['rows']=_0x3eeeb5;return _0x2d027e;})[_0xeabc('0x26')](respondWithFilteredResult(_0x5b34dd,_0x5bb1f1))['catch'](handleError(_0x5b34dd,null));};exports[_0xeabc('0x43')]=function(_0x1a4bbe,_0x3a7807){var _0x17a0df={'raw':!![],'where':{'id':_0x1a4bbe['params']['id']}},_0xc849c9={};_0xc849c9['model']=_[_0xeabc('0x37')](db['AnalyticDefaultReport'][_0xeabc('0x32')]);_0xc849c9[_0xeabc('0x36')]=_['keys'](_0x1a4bbe[_0xeabc('0x36')]);_0xc849c9[_0xeabc('0x38')]=_[_0xeabc('0x39')](_0xc849c9[_0xeabc('0x35')],_0xc849c9[_0xeabc('0x36')]);_0x17a0df[_0xeabc('0x3a')]=_[_0xeabc('0x39')](_0xc849c9['model'],qs[_0xeabc('0x3b')](_0x1a4bbe[_0xeabc('0x36')][_0xeabc('0x3b')]));_0x17a0df[_0xeabc('0x3a')]=_0x17a0df[_0xeabc('0x3a')][_0xeabc('0x3c')]?_0x17a0df[_0xeabc('0x3a')]:_0xc849c9[_0xeabc('0x35')];if(_0x1a4bbe[_0xeabc('0x36')][_0xeabc('0x44')]){_0x17a0df['include']=[{'all':!![]}];}_0x17a0df=_[_0xeabc('0x40')]({},_0x17a0df,_0x1a4bbe[_0xeabc('0x45')]);return db[_0xeabc('0x31')][_0xeabc('0x46')](_0x17a0df)[_0xeabc('0x26')](handleEntityNotFound(_0x3a7807,null))[_0xeabc('0x26')](respondWithResult(_0x3a7807,null))[_0xeabc('0x47')](handleError(_0x3a7807,null));};exports['create']=function(_0x766743,_0x32e09b){return db[_0xeabc('0x31')][_0xeabc('0x48')](_0x766743[_0xeabc('0x49')],{})['then'](function(_0x305946){var _0x2b2b9c=_0x766743[_0xeabc('0x4a')][_0xeabc('0x27')]({'plain':!![]});if(!_0x2b2b9c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2b2b9c[_0xeabc('0x4b')]===_0xeabc('0x4a')){var _0x568847=_0x305946[_0xeabc('0x27')]({'plain':!![]});var _0x5a0d4d=_0xeabc('0x4c');return db['UserProfileSection'][_0xeabc('0x46')]({'where':{'name':_0x5a0d4d,'userProfileId':_0x2b2b9c[_0xeabc('0x4d')]},'raw':!![]})[_0xeabc('0x26')](function(_0x1524c3){if(_0x1524c3&&_0x1524c3[_0xeabc('0x4e')]===0x0){return db[_0xeabc('0x29')][_0xeabc('0x48')]({'name':_0x568847[_0xeabc('0x2d')],'resourceId':_0x568847['id'],'type':_0xeabc('0x28'),'sectionId':_0x1524c3['id']},{})[_0xeabc('0x26')](function(){return _0x305946;});}else{return _0x305946;}})['catch'](function(_0x180a14){logger[_0xeabc('0x2b')](_0xeabc('0x4f'),_0x180a14);throw _0x180a14;});}return _0x305946;})[_0xeabc('0x26')](respondWithResult(_0x32e09b,0xc9))['catch'](handleError(_0x32e09b,null));};exports[_0xeabc('0x25')]=function(_0x392913,_0x10d56f){if(_0x392913[_0xeabc('0x49')]['id']){delete _0x392913['body']['id'];}return db[_0xeabc('0x31')][_0xeabc('0x46')]({'where':{'id':_0x392913[_0xeabc('0x50')]['id']}})[_0xeabc('0x26')](handleEntityNotFound(_0x10d56f,null))[_0xeabc('0x26')](saveUpdates(_0x392913[_0xeabc('0x49')],null))[_0xeabc('0x26')](respondWithResult(_0x10d56f,null))[_0xeabc('0x47')](handleError(_0x10d56f,null));};exports[_0xeabc('0x2a')]=function(_0x58ab08,_0x4546c4){return db['AnalyticDefaultReport']['find']({'where':{'id':_0x58ab08['params']['id']}})[_0xeabc('0x26')](handleEntityNotFound(_0x4546c4,null))[_0xeabc('0x26')](removeEntity(_0x4546c4,null))[_0xeabc('0x47')](handleError(_0x4546c4,null));};exports[_0xeabc('0x51')]=function(_0xe89728,_0x2f78f3){var _0x4a2ad6=0xa;var _0x4358d7=[_0xeabc('0x52'),_0xeabc('0x53'),_0xeabc('0x54'),_0xeabc('0x55')];var _0x2c7b4e={'SUM':_0xeabc('0x56'),'COUNT':_0xeabc('0x57'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0xeabc('0x58'),'AVG':_0xeabc('0x59'),'GROUP_CONCAT':_0xeabc('0x5a'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xeabc('0x5b')};var _0x536f42={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xeabc('0x5c'),'HOUR':_0xeabc('0x5d'),'ROUND':_0xeabc('0x5e'),'UNIX_TIMESTAMP':_0xeabc('0x5f')};var _0x26c784=function(_0xc2ef0c){return!_['includes']([_0xeabc('0x60'),_0xeabc('0x61'),_0xeabc('0x62'),_0xeabc('0x63')],_0xc2ef0c);};var _0x11cc1f=function(_0x514787){if(!_0x514787||!_0x514787['rules'][_0xeabc('0x3c')]){return'';}for(var _0x7b659f='(',_0x1b6675=0x0;_0x1b6675<_0x514787[_0xeabc('0x64')][_0xeabc('0x3c')];_0x1b6675+=0x1){_0x1b6675>0x0&&(_0x7b659f+='\x20'+_0x514787[_0xeabc('0x65')]+'\x20');_0x7b659f+=_0x514787[_0xeabc('0x64')][_0x1b6675][_0xeabc('0x66')]?_0x11cc1f(_0x514787[_0xeabc('0x64')][_0x1b6675]['group']):_0x514787[_0xeabc('0x64')][_0x1b6675]['field']+'\x20'+_0x514787[_0xeabc('0x64')][_0x1b6675][_0xeabc('0x67')]+(_0x26c784(_0x514787[_0xeabc('0x64')][_0x1b6675][_0xeabc('0x67')])?'\x20'+_0x514787[_0xeabc('0x64')][_0x1b6675][_0xeabc('0x68')]:'');}return _0x7b659f+')';};var _0xf48062={'where':{'id':_0xe89728[_0xeabc('0x50')]['id']}},_0xb59a2a,_0x5d4bc2,_0x24d0e5,_0x5702cb,_0x3fa31b;_0xf48062=_[_0xeabc('0x40')]({},_0xf48062,_0xe89728[_0xeabc('0x45')]);return db['AnalyticDefaultReport'][_0xeabc('0x46')](_0xf48062)['then'](function(_0x54e7d6){if(_0x54e7d6){_0xb59a2a=_0x54e7d6;return _0x54e7d6[_0xeabc('0x69')]();}return null;})[_0xeabc('0x26')](function(_0x23270a){if(_0x23270a){if(!_0x23270a[_0xeabc('0x3c')]){throw new db['Sequelize']['ValidationErrorItem'](_0xeabc('0x6a'),0x193);}_0x5d4bc2=_0x23270a;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0xeabc('0x26')](function(_0x4f1a4f){if(_0x4f1a4f){_0x24d0e5=_['keyBy'](_0x4f1a4f,'id');var _0xa44f2d;var _0x1c84b5=squel['select']();_0x1c84b5['from'](_0xb59a2a[_0xeabc('0x6b')]);for(var _0x5d183a=0x0;_0x5d183a<_0x5d4bc2[_0xeabc('0x3c')];_0x5d183a+=0x1){_0xa44f2d=_0x5d4bc2[_0x5d183a][_0xeabc('0x6c')]?_0x24d0e5[_0x5d4bc2[_0x5d183a]['MetricId']]['metric']:_0x5d4bc2[_0x5d183a][_0xeabc('0x6d')];_0xa44f2d=_0x5d4bc2[_0x5d183a][_0xeabc('0x6e')]?_[_0xeabc('0x6f')](_0x2c7b4e[_0x5d4bc2[_0x5d183a][_0xeabc('0x6e')]],'%s',_0xa44f2d):_0xa44f2d;_0xa44f2d=_0x5d4bc2[_0x5d183a][_0xeabc('0x70')]?_['replace'](_0x536f42[_0x5d4bc2[_0x5d183a]['format']],'%s',_0xa44f2d):_0xa44f2d;if(_0x5d4bc2[_0x5d183a][_0xeabc('0x71')]){_0x1c84b5['group'](_0xa44f2d);}_0x5d4bc2[_0x5d183a][_0xeabc('0x72')]&&_0x1c84b5['order'](_0xa44f2d,_0x5d4bc2[_0x5d183a][_0xeabc('0x72')]==='DESC'?![]:!![]);_0x1c84b5[_0xeabc('0x6d')](_0xa44f2d,_0x5d4bc2[_0x5d183a]['alias']||_0xa44f2d);}if(_0xb59a2a[_0xeabc('0x73')]){_0xb59a2a[_0xeabc('0x73')]=JSON[_0xeabc('0x74')](_0xb59a2a[_0xeabc('0x73')]);for(var _0x5e121c=0x0;_0x5e121c<_0xb59a2a[_0xeabc('0x73')]['length'];_0x5e121c+=0x1){if(_0xb59a2a[_0xeabc('0x73')][_0x5e121c][_0xeabc('0x33')]&&_[_0xeabc('0x75')](_0x4358d7,_0xb59a2a[_0xeabc('0x73')][_0x5e121c][_0xeabc('0x33')])&&_0xb59a2a['joins'][_0x5e121c][_0xeabc('0x76')]&&_0xb59a2a[_0xeabc('0x73')][_0x5e121c][_0xeabc('0x77')]&&_0xb59a2a[_0xeabc('0x73')][_0x5e121c]['foreignKey']){_0x1c84b5[_0xb59a2a[_0xeabc('0x73')][_0x5e121c][_0xeabc('0x33')]](_0xb59a2a[_0xeabc('0x73')][_0x5e121c][_0xeabc('0x77')],null,util['format'](_0xeabc('0x78'),_0xb59a2a[_0xeabc('0x6b')],_0xb59a2a[_0xeabc('0x73')][_0x5e121c][_0xeabc('0x76')],_0xb59a2a['joins'][_0x5e121c]['foreignTable'],_0xb59a2a[_0xeabc('0x73')][_0x5e121c]['foreignKey']));}}}if(_0xb59a2a['conditions']){_0xb59a2a[_0xeabc('0x79')]=JSON[_0xeabc('0x74')](_0xb59a2a[_0xeabc('0x79')]);_0x1c84b5['where'](_0x11cc1f(_0xb59a2a[_0xeabc('0x79')][_0xeabc('0x66')]));}_0x3fa31b=_0x1c84b5['clone']();_0x1c84b5[_0xeabc('0x1e')](_0x4a2ad6);_0x1c84b5[_0xeabc('0x1d')](0x0);logger[_0xeabc('0x7a')](_0xeabc('0x7b'),_0x1c84b5[_0xeabc('0x7c')]());return dbH['sequelize'][_0xeabc('0x36')](_0x1c84b5['toString'](),{'type':dbH['sequelize']['QueryTypes'][_0xeabc('0x7d')]});}})[_0xeabc('0x26')](respondWithResult(_0x2f78f3,null))[_0xeabc('0x47')](handleError(_0x2f78f3,null));};function runReport(_0x4424ce,_0x33fa74,_0x51368f){var _0x39f961=_0x33fa74['name'];var _0x1795fe=0xa;var _0x2f95c7=['join',_0xeabc('0x53'),'right_join','cross_join'];var _0x952dc7={'SUM':_0xeabc('0x56'),'COUNT':_0xeabc('0x57'),'COUNT DISTINCT':_0xeabc('0x7e'),'MAX':_0xeabc('0x7f'),'MIN':'MIN(%s)','AVG':_0xeabc('0x59'),'GROUP_CONCAT':_0xeabc('0x5a'),'GROUP_CONCAT ASC':_0xeabc('0x80'),'GROUP_CONCAT DESC':_0xeabc('0x5b')};var _0x348064={'SEC_TO_TIME':_0xeabc('0x81'),'DATE':_0xeabc('0x5c'),'HOUR':_0xeabc('0x5d'),'ROUND':_0xeabc('0x5e'),'UNIX_TIMESTAMP':_0xeabc('0x5f')};var _0x522c6e=function(_0x436f8e){return!_[_0xeabc('0x75')]([_0xeabc('0x60'),'IS\x20NOT\x20NULL','IS\x20EMPTY',_0xeabc('0x63')],_0x436f8e);};var _0x273ca5=function(_0xe90200){if(!_0xe90200||!_0xe90200[_0xeabc('0x64')][_0xeabc('0x3c')]){return'';}for(var _0x5f5a47='(',_0x289f98=0x0;_0x289f98<_0xe90200['rules']['length'];_0x289f98+=0x1){_0x289f98>0x0&&(_0x5f5a47+='\x20'+_0xe90200[_0xeabc('0x65')]+'\x20');_0x5f5a47+=_0xe90200[_0xeabc('0x64')][_0x289f98]['group']?_0x273ca5(_0xe90200[_0xeabc('0x64')][_0x289f98][_0xeabc('0x66')]):_0xe90200[_0xeabc('0x64')][_0x289f98][_0xeabc('0x6d')]+'\x20'+_0xe90200[_0xeabc('0x64')][_0x289f98][_0xeabc('0x67')]+(_0x522c6e(_0xe90200[_0xeabc('0x64')][_0x289f98][_0xeabc('0x67')])?'\x20'+_0xe90200[_0xeabc('0x64')][_0x289f98][_0xeabc('0x68')]:'');}return _0x5f5a47+')';};var _0x1f8197={'where':{'id':_0x4424ce['id']}},_0x485c13,_0xb54c35,_0x5c9d6f,_0x1caaa7,_0x3e764a;_0x1f8197=_[_0xeabc('0x40')]({},_0x1f8197,_0x51368f);return db[_0xeabc('0x31')][_0xeabc('0x46')](_0x1f8197)[_0xeabc('0x26')](function(_0x40f51e){if(_0x40f51e){_0x485c13=_0x40f51e;return _0x40f51e[_0xeabc('0x69')]();}return null;})[_0xeabc('0x26')](function(_0x156e20){if(_0x156e20){if(!_0x156e20[_0xeabc('0x3c')]){throw new db['Sequelize'][(_0xeabc('0x82'))](_0xeabc('0x6a'),0x193);}_0xb54c35=_0x156e20;return db[_0xeabc('0x83')][_0xeabc('0x42')]({'raw':!![]});}return null;})['then'](function(_0x26c595){if(_0x26c595){_0x5c9d6f=_[_0xeabc('0x84')](_0x26c595,'id');var _0x580661;var _0x3de927=squel[_0xeabc('0x85')]();_0x3de927['from'](_0x485c13['table']);for(var _0x489b1d=0x0;_0x489b1d<_0xb54c35['length'];_0x489b1d+=0x1){_0x580661=_0xb54c35[_0x489b1d][_0xeabc('0x6c')]?_0x5c9d6f[_0xb54c35[_0x489b1d][_0xeabc('0x6c')]][_0xeabc('0x86')]:_0xb54c35[_0x489b1d][_0xeabc('0x6d')];_0x580661=_0xb54c35[_0x489b1d][_0xeabc('0x6e')]?_[_0xeabc('0x6f')](_0x952dc7[_0xb54c35[_0x489b1d][_0xeabc('0x6e')]],'%s',_0x580661):_0x580661;_0x580661=_0xb54c35[_0x489b1d][_0xeabc('0x70')]?_[_0xeabc('0x6f')](_0x348064[_0xb54c35[_0x489b1d][_0xeabc('0x70')]],'%s',_0x580661):_0x580661;if(_0xb54c35[_0x489b1d]['groupBy']){_0x3de927[_0xeabc('0x66')](_0x580661);}_0xb54c35[_0x489b1d][_0xeabc('0x72')]&&_0x3de927['order'](_0x580661,_0xb54c35[_0x489b1d][_0xeabc('0x72')]===_0xeabc('0x87')?![]:!![]);_0x3de927[_0xeabc('0x6d')](_0x580661,_0xb54c35[_0x489b1d]['alias']||_0x580661);}if(_0x485c13[_0xeabc('0x73')]){_0x485c13['joins']=JSON[_0xeabc('0x74')](_0x485c13[_0xeabc('0x73')]);for(var _0x1841f0=0x0;_0x1841f0<_0x485c13[_0xeabc('0x73')][_0xeabc('0x3c')];_0x1841f0+=0x1){if(_0x485c13['joins'][_0x1841f0]['type']&&_['includes'](_0x2f95c7,_0x485c13['joins'][_0x1841f0][_0xeabc('0x33')])&&_0x485c13[_0xeabc('0x73')][_0x1841f0][_0xeabc('0x76')]&&_0x485c13['joins'][_0x1841f0][_0xeabc('0x77')]&&_0x485c13[_0xeabc('0x73')][_0x1841f0][_0xeabc('0x88')]){_0x3de927[_0x485c13[_0xeabc('0x73')][_0x1841f0][_0xeabc('0x33')]](_0x485c13[_0xeabc('0x73')][_0x1841f0][_0xeabc('0x77')],null,util[_0xeabc('0x70')](_0xeabc('0x78'),_0x485c13[_0xeabc('0x6b')],_0x485c13[_0xeabc('0x73')][_0x1841f0][_0xeabc('0x76')],_0x485c13['joins'][_0x1841f0]['foreignTable'],_0x485c13[_0xeabc('0x73')][_0x1841f0]['foreignKey']));}}}if(_0x485c13[_0xeabc('0x79')]){_0x485c13[_0xeabc('0x79')]=JSON[_0xeabc('0x74')](_0x485c13['conditions']);_0x3de927[_0xeabc('0x41')](_0x273ca5(_0x485c13[_0xeabc('0x79')][_0xeabc('0x66')]));}_0x3e764a=_0x3de927['clone']();_0x3de927['limit'](_0x1795fe);_0x3de927[_0xeabc('0x1d')](0x0);return;}})[_0xeabc('0x26')](function(){if(_0x33fa74[_0xeabc('0x89')]===_0xeabc('0x8a')){return null;}var _0x2cc9b3=_[_0xeabc('0x40')](_0x33fa74,{'name':_0x33fa74['fullPath']||_0x33fa74['name']||_0x485c13[_0xeabc('0x2d')],'basename':_0x39f961,'savename':util[_0xeabc('0x70')](_0xeabc('0x8b'),_0x33fa74[_0xeabc('0x2d')]||_0x485c13['name'],require('randomstring')['generate'](0x4),_0x33fa74[_0xeabc('0x89')]||'csv'),'reportId':_0x485c13['id'],'reportType':_0xeabc('0x8c')});return db['AnalyticExtractedReport'][_0xeabc('0x48')](_0x2cc9b3,{'raw':!![]});})['then'](function(_0x6e6ab2){if(_0x485c13[_0xeabc('0x6b')]===_0xeabc('0x8d')){_0x3e764a[_0xeabc('0x41')](_0x485c13[_0xeabc('0x6b')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x33fa74[_0xeabc('0x8e')],_0x33fa74[_0xeabc('0x8f')]);}else{_0x3e764a[_0xeabc('0x41')](_0x485c13['table']+_0xeabc('0x90'),_0x33fa74[_0xeabc('0x8e')],_0x33fa74[_0xeabc('0x8f')]);}if(_0x6e6ab2){logger[_0xeabc('0x91')](_0xeabc('0x92'),_0x3e764a['toString']());require(_0xeabc('0x93'))[_0xeabc('0x94')](path['join'](__dirname,_0xeabc('0x95'),_0x6e6ab2[_0xeabc('0x89')]),[_0x6e6ab2['id'],_0x3e764a['toString'](),path[_0xeabc('0x52')](__dirname,_0xeabc('0x96'),_0x6e6ab2[_0xeabc('0x97')]),_0x39f961]);return _0x6e6ab2;}else{var _0x307d26=squel[_0xeabc('0x85')]();_0x307d26[_0xeabc('0x98')]('('+_0x3e764a[_0xeabc('0x7c')]()+')',_0xeabc('0x99'));_0x307d26[_0xeabc('0x6d')](_0xeabc('0x9a'),_0xeabc('0x20'));_0x3e764a[_0xeabc('0x1e')](_0x33fa74[_0xeabc('0x1e')]||_0x1795fe);_0x3e764a['offset'](_0x33fa74['offset']||0x0);return dbH[_0xeabc('0x9b')][_0xeabc('0x36')](_0x307d26[_0xeabc('0x7c')](),{'type':dbH[_0xeabc('0x9b')]['QueryTypes'][_0xeabc('0x7d')]})['then'](function(_0x49fba2){if(!_0x49fba2['length']){_0x1caaa7=0x0;}else{_0x1caaa7=_0x49fba2[0x0]['count']||0x0;}return dbH['sequelize']['query'](_0x3e764a[_0xeabc('0x7c')](),{'type':dbH[_0xeabc('0x9b')][_0xeabc('0x9c')][_0xeabc('0x7d')]});})[_0xeabc('0x26')](function(_0xe27492){return{'rows':_0xe27492||[],'count':_0x1caaa7};});}});}exports[_0xeabc('0x9d')]=function(_0x3eaedf,_0x44dc85){return runReport(_0x3eaedf['params'],_0x3eaedf[_0xeabc('0x36')],_0x3eaedf[_0xeabc('0x45')])[_0xeabc('0x26')](respondWithResult(_0x44dc85,null))[_0xeabc('0x47')](handleError(_0x44dc85,null));};exports[_0xeabc('0x9e')]=runReport;exports[_0xeabc('0x36')]=function(_0x2a29d7,_0x5bb5d6){var _0x3513ce=0xa;var _0x58cb5d=[_0xeabc('0x52'),_0xeabc('0x53'),'right_join',_0xeabc('0x55')];var _0x4c8bf3={'SUM':_0xeabc('0x56'),'COUNT':_0xeabc('0x57'),'COUNT DISTINCT':_0xeabc('0x7e'),'MAX':_0xeabc('0x7f'),'MIN':_0xeabc('0x58'),'AVG':_0xeabc('0x59'),'GROUP_CONCAT':_0xeabc('0x5a'),'GROUP_CONCAT ASC':_0xeabc('0x80'),'GROUP_CONCAT DESC':_0xeabc('0x5b')};var _0x484c75={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xeabc('0x5c'),'HOUR':_0xeabc('0x5d'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xeabc('0x5f')};var _0x580f72=function(_0x37907a){return!_[_0xeabc('0x75')]([_0xeabc('0x60'),_0xeabc('0x61'),_0xeabc('0x62'),_0xeabc('0x63')],_0x37907a);};var _0x57db6d=function(_0x13cc55){if(!_0x13cc55||!_0x13cc55['rules'][_0xeabc('0x3c')]){return'';}for(var _0x43b88e='(',_0x1fa464=0x0;_0x1fa464<_0x13cc55[_0xeabc('0x64')]['length'];_0x1fa464+=0x1){_0x1fa464>0x0&&(_0x43b88e+='\x20'+_0x13cc55[_0xeabc('0x65')]+'\x20');_0x43b88e+=_0x13cc55[_0xeabc('0x64')][_0x1fa464][_0xeabc('0x66')]?_0x57db6d(_0x13cc55['rules'][_0x1fa464][_0xeabc('0x66')]):_0x13cc55[_0xeabc('0x64')][_0x1fa464][_0xeabc('0x6d')]+'\x20'+_0x13cc55['rules'][_0x1fa464]['condition']+(_0x580f72(_0x13cc55['rules'][_0x1fa464]['condition'])?'\x20'+_0x13cc55[_0xeabc('0x64')][_0x1fa464][_0xeabc('0x68')]:'');}return _0x43b88e+')';};var _0x52e84f={'where':{'id':_0x2a29d7[_0xeabc('0x50')]['id']}},_0x12f024,_0x1d35da,_0x2695a4,_0x199251,_0x1899d6;_0x52e84f=_[_0xeabc('0x40')]({},_0x52e84f,_0x2a29d7[_0xeabc('0x45')]);return db[_0xeabc('0x31')]['find'](_0x52e84f)[_0xeabc('0x26')](function(_0x5bb015){if(_0x5bb015){_0x12f024=_0x5bb015;return _0x5bb015[_0xeabc('0x69')]();}return null;})[_0xeabc('0x26')](function(_0x438ce3){if(_0x438ce3){if(!_0x438ce3[_0xeabc('0x3c')]){throw new db[(_0xeabc('0x9f'))][(_0xeabc('0x82'))](_0xeabc('0x6a'),0x193);}_0x1d35da=_0x438ce3;return db['AnalyticMetric'][_0xeabc('0x42')]({'raw':!![]});}return null;})['then'](function(_0x475160){if(_0x475160){_0x2695a4=_['keyBy'](_0x475160,'id');var _0x10d66b;var _0x12a042=squel[_0xeabc('0x85')]();_0x12a042[_0xeabc('0x98')](_0x12f024[_0xeabc('0x6b')]);for(var _0x49bf0f=0x0;_0x49bf0f<_0x1d35da[_0xeabc('0x3c')];_0x49bf0f+=0x1){_0x10d66b=_0x1d35da[_0x49bf0f][_0xeabc('0x6c')]?_0x2695a4[_0x1d35da[_0x49bf0f][_0xeabc('0x6c')]][_0xeabc('0x86')]:_0x1d35da[_0x49bf0f][_0xeabc('0x6d')];_0x10d66b=_0x1d35da[_0x49bf0f]['function']?_[_0xeabc('0x6f')](_0x4c8bf3[_0x1d35da[_0x49bf0f][_0xeabc('0x6e')]],'%s',_0x10d66b):_0x10d66b;_0x10d66b=_0x1d35da[_0x49bf0f][_0xeabc('0x70')]?_[_0xeabc('0x6f')](_0x484c75[_0x1d35da[_0x49bf0f][_0xeabc('0x70')]],'%s',_0x10d66b):_0x10d66b;if(_0x1d35da[_0x49bf0f]['groupBy']){_0x12a042[_0xeabc('0x66')](_0x10d66b);}_0x1d35da[_0x49bf0f]['orderBy']&&_0x12a042[_0xeabc('0x3e')](_0x10d66b,_0x1d35da[_0x49bf0f][_0xeabc('0x72')]===_0xeabc('0x87')?![]:!![]);_0x12a042[_0xeabc('0x6d')](_0x10d66b,_0x1d35da[_0x49bf0f][_0xeabc('0xa0')]||_0x10d66b);}if(_0x12f024[_0xeabc('0x73')]){_0x12f024[_0xeabc('0x73')]=JSON[_0xeabc('0x74')](_0x12f024[_0xeabc('0x73')]);for(var _0x223a3=0x0;_0x223a3<_0x12f024['joins'][_0xeabc('0x3c')];_0x223a3+=0x1){if(_0x12f024[_0xeabc('0x73')][_0x223a3][_0xeabc('0x33')]&&_[_0xeabc('0x75')](_0x58cb5d,_0x12f024['joins'][_0x223a3][_0xeabc('0x33')])&&_0x12f024['joins'][_0x223a3]['parentKey']&&_0x12f024[_0xeabc('0x73')][_0x223a3][_0xeabc('0x77')]&&_0x12f024[_0xeabc('0x73')][_0x223a3]['foreignKey']){_0x12a042[_0x12f024[_0xeabc('0x73')][_0x223a3][_0xeabc('0x33')]](_0x12f024[_0xeabc('0x73')][_0x223a3][_0xeabc('0x77')],null,util[_0xeabc('0x70')]('%s.%s\x20=\x20%s.%s',_0x12f024[_0xeabc('0x6b')],_0x12f024[_0xeabc('0x73')][_0x223a3]['parentKey'],_0x12f024['joins'][_0x223a3][_0xeabc('0x77')],_0x12f024[_0xeabc('0x73')][_0x223a3][_0xeabc('0x88')]));}}}if(_0x12f024[_0xeabc('0x79')]){_0x12f024[_0xeabc('0x79')]=JSON[_0xeabc('0x74')](_0x12f024[_0xeabc('0x79')]);_0x12a042[_0xeabc('0x41')](_0x57db6d(_0x12f024[_0xeabc('0x79')]['group']));}_0x1899d6=_0x12a042[_0xeabc('0xa1')]();_0x12a042['limit'](_0x3513ce);_0x12a042[_0xeabc('0x1d')](0x0);logger['debug'](_0xeabc('0x7b'),_0x12a042[_0xeabc('0x7c')]());return dbH[_0xeabc('0x9b')][_0xeabc('0x36')](_0x12a042[_0xeabc('0x7c')](),{'type':dbH[_0xeabc('0x9b')][_0xeabc('0x9c')][_0xeabc('0x7d')]});}})[_0xeabc('0x26')](function(){return{'sql':_0x1899d6[_0xeabc('0x7c')]()};})['then'](respondWithResult(_0x5bb5d6,null))['catch'](handleError(_0x5bb5d6,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 63d815f..992b273 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 _0x9efd=['analytics_default_reports','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./analyticDefaultReport.attributes','define','AnalyticDefaultReport'];(function(_0x6cc730,_0x4415ee){var _0x18f448=function(_0x727f9c){while(--_0x727f9c){_0x6cc730['push'](_0x6cc730['shift']());}};_0x18f448(++_0x4415ee);}(_0x9efd,0x83));var _0xd9ef=function(_0x4d2021,_0x251ed8){_0x4d2021=_0x4d2021-0x0;var _0x542d0f=_0x9efd[_0x4d2021];return _0x542d0f;};'use strict';var _=require(_0xd9ef('0x0'));var util=require(_0xd9ef('0x1'));var logger=require(_0xd9ef('0x2'))(_0xd9ef('0x3'));var moment=require(_0xd9ef('0x4'));var BPromise=require(_0xd9ef('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd9ef('0x6'));var rimraf=require(_0xd9ef('0x7'));var config=require(_0xd9ef('0x8'));var attributes=require(_0xd9ef('0x9'));module['exports']=function(_0x38a937,_0x2c8758){return _0x38a937[_0xd9ef('0xa')](_0xd9ef('0xb'),attributes,{'tableName':_0xd9ef('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x69b4=['../../config/environment','./analyticDefaultReport.attributes','AnalyticDefaultReport','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x255850,_0x5511dd){var _0x5ceacf=function(_0x260ecf){while(--_0x260ecf){_0x255850['push'](_0x255850['shift']());}};_0x5ceacf(++_0x5511dd);}(_0x69b4,0xd5));var _0x469b=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x69b4[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x469b('0x0'));var util=require(_0x469b('0x1'));var logger=require(_0x469b('0x2'))(_0x469b('0x3'));var moment=require('moment');var BPromise=require(_0x469b('0x4'));var rp=require(_0x469b('0x5'));var fs=require('fs');var path=require(_0x469b('0x6'));var rimraf=require('rimraf');var config=require(_0x469b('0x7'));var attributes=require(_0x469b('0x8'));module['exports']=function(_0x4be5ca,_0x509527){return _0x4be5ca['define'](_0x469b('0x9'),attributes,{'tableName':'analytics_default_reports','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 1c97e31..ca5ce20 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 _0xd377=['result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','error','code','message','AnalyticDefaultReport,\x20%s,\x20%s'];(function(_0xb30cbf,_0x385a9c){var _0x22c6c3=function(_0x261681){while(--_0x261681){_0xb30cbf['push'](_0xb30cbf['shift']());}};_0x22c6c3(++_0x385a9c);}(_0xd377,0xa9));var _0x7d37=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xd377[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x7d37('0x0'));var util=require(_0x7d37('0x1'));var moment=require(_0x7d37('0x2'));var BPromise=require('bluebird');var rs=require(_0x7d37('0x3'));var fs=require('fs');var Redis=require(_0x7d37('0x4'));var db=require(_0x7d37('0x5'))['db'];var utils=require(_0x7d37('0x6'));var logger=require(_0x7d37('0x7'))(_0x7d37('0x8'));var config=require(_0x7d37('0x9'));var jayson=require(_0x7d37('0xa'));var client=jayson[_0x7d37('0xb')][_0x7d37('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2b18ba,_0x331cb7,_0xea793e){return new BPromise(function(_0x5f0a0d,_0x4694be){return client[_0x7d37('0xd')](_0x2b18ba,_0xea793e)[_0x7d37('0xe')](function(_0xbf3251){logger[_0x7d37('0xf')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x331cb7,_0x7d37('0x10'));logger[_0x7d37('0x11')](_0x7d37('0x12'),_0x331cb7,_0x7d37('0x10'),JSON['stringify'](_0xbf3251));if(_0xbf3251['error']){if(_0xbf3251[_0x7d37('0x13')][_0x7d37('0x14')]===0x1f4){logger[_0x7d37('0x13')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x331cb7,_0xbf3251[_0x7d37('0x13')][_0x7d37('0x15')]);return _0x4694be(_0xbf3251[_0x7d37('0x13')][_0x7d37('0x15')]);}logger[_0x7d37('0x13')](_0x7d37('0x16'),_0x331cb7,_0xbf3251['error']['message']);return _0x5f0a0d(_0xbf3251[_0x7d37('0x13')]['message']);}else{logger[_0x7d37('0xf')](_0x7d37('0x16'),_0x331cb7,'request\x20sent');_0x5f0a0d(_0xbf3251[_0x7d37('0x17')][_0x7d37('0x15')]);}})['catch'](function(_0x1da301){logger[_0x7d37('0x13')](_0x7d37('0x16'),_0x331cb7,_0x1da301);_0x4694be(_0x1da301);});});} \ No newline at end of file +var _0x262b=['jayson/promise','client','http','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x262b,0x91));var _0xb262=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x262b[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0xb262('0x0'));var moment=require(_0xb262('0x1'));var BPromise=require(_0xb262('0x2'));var rs=require(_0xb262('0x3'));var fs=require('fs');var Redis=require(_0xb262('0x4'));var db=require(_0xb262('0x5'))['db'];var utils=require(_0xb262('0x6'));var logger=require(_0xb262('0x7'))('rpc');var config=require(_0xb262('0x8'));var jayson=require(_0xb262('0x9'));var client=jayson[_0xb262('0xa')][_0xb262('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xa5e3e0,_0x3a2d14,_0x3ff761){return new BPromise(function(_0x209fd3,_0x3e738f){return client['request'](_0xa5e3e0,_0x3ff761)[_0xb262('0xc')](function(_0x599903){logger[_0xb262('0xd')](_0xb262('0xe'),_0x3a2d14,_0xb262('0xf'));logger[_0xb262('0x10')](_0xb262('0x11'),_0x3a2d14,'request\x20sent',JSON[_0xb262('0x12')](_0x599903));if(_0x599903[_0xb262('0x13')]){if(_0x599903[_0xb262('0x13')]['code']===0x1f4){logger[_0xb262('0x13')](_0xb262('0xe'),_0x3a2d14,_0x599903[_0xb262('0x13')][_0xb262('0x14')]);return _0x3e738f(_0x599903[_0xb262('0x13')][_0xb262('0x14')]);}logger['error']('AnalyticDefaultReport,\x20%s,\x20%s',_0x3a2d14,_0x599903[_0xb262('0x13')]['message']);return _0x209fd3(_0x599903[_0xb262('0x13')]['message']);}else{logger[_0xb262('0xd')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x3a2d14,'request\x20sent');_0x209fd3(_0x599903[_0xb262('0x15')][_0xb262('0x14')]);}})['catch'](function(_0x353bf6){logger['error'](_0xb262('0xe'),_0x3a2d14,_0x353bf6);_0x3e738f(_0x353bf6);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index cd6d4e4..ec4da07 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 _0xa723=['connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/preview','preview','/:id/run','run','/:id/query','query','post','create','put','update','delete','destroy','util','path'];(function(_0x2e1777,_0x1f056a){var _0x35628f=function(_0x50499e){while(--_0x50499e){_0x2e1777['push'](_0x2e1777['shift']());}};_0x35628f(++_0x1f056a);}(_0xa723,0x185));var _0x3a72=function(_0x3eb630,_0x552586){_0x3eb630=_0x3eb630-0x0;var _0x1b840d=_0xa723[_0x3eb630];return _0x1b840d;};'use strict';var multer=require('multer');var util=require(_0x3a72('0x0'));var path=require(_0x3a72('0x1'));var timeout=require(_0x3a72('0x2'));var express=require('express');var router=express[_0x3a72('0x3')]();var fs_extra=require(_0x3a72('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3a72('0x5'));var config=require(_0x3a72('0x6'));var controller=require('./analyticDefaultReport.controller');router[_0x3a72('0x7')]('/',auth[_0x3a72('0x8')](),controller[_0x3a72('0x9')]);router[_0x3a72('0x7')](_0x3a72('0xa'),auth[_0x3a72('0x8')](),controller['show']);router[_0x3a72('0x7')](_0x3a72('0xb'),auth['isAuthenticated'](),controller[_0x3a72('0xc')]);router[_0x3a72('0x7')](_0x3a72('0xd'),auth['isAuthenticated'](),controller[_0x3a72('0xe')]);router[_0x3a72('0x7')](_0x3a72('0xf'),auth[_0x3a72('0x8')](),controller[_0x3a72('0x10')]);router[_0x3a72('0x11')]('/',auth[_0x3a72('0x8')](),controller[_0x3a72('0x12')]);router[_0x3a72('0x13')](_0x3a72('0xa'),auth[_0x3a72('0x8')](),controller[_0x3a72('0x14')]);router[_0x3a72('0x15')](_0x3a72('0xa'),auth[_0x3a72('0x8')](),controller[_0x3a72('0x16')]);module['exports']=router; \ No newline at end of file +var _0xf11e=['put','update','destroy','multer','path','connect-timeout','express','../../components/auth/service','./analyticDefaultReport.controller','get','isAuthenticated','index','/:id','/:id/preview','preview','/:id/run','/:id/query','query','post','create'];(function(_0x43dec6,_0x39ef22){var _0x5b9e47=function(_0xfb75a4){while(--_0xfb75a4){_0x43dec6['push'](_0x43dec6['shift']());}};_0x5b9e47(++_0x39ef22);}(_0xf11e,0x11b));var _0xef11=function(_0x5d375c,_0x3ccb1e){_0x5d375c=_0x5d375c-0x0;var _0x1fd6ed=_0xf11e[_0x5d375c];return _0x1fd6ed;};'use strict';var multer=require(_0xef11('0x0'));var util=require('util');var path=require(_0xef11('0x1'));var timeout=require(_0xef11('0x2'));var express=require(_0xef11('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xef11('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xef11('0x5'));router[_0xef11('0x6')]('/',auth[_0xef11('0x7')](),controller[_0xef11('0x8')]);router[_0xef11('0x6')](_0xef11('0x9'),auth[_0xef11('0x7')](),controller['show']);router[_0xef11('0x6')](_0xef11('0xa'),auth[_0xef11('0x7')](),controller[_0xef11('0xb')]);router[_0xef11('0x6')](_0xef11('0xc'),auth['isAuthenticated'](),controller['run']);router[_0xef11('0x6')](_0xef11('0xd'),auth['isAuthenticated'](),controller[_0xef11('0xe')]);router[_0xef11('0xf')]('/',auth['isAuthenticated'](),controller[_0xef11('0x10')]);router[_0xef11('0x11')](_0xef11('0x9'),auth[_0xef11('0x7')](),controller[_0xef11('0x12')]);router['delete'](_0xef11('0x9'),auth['isAuthenticated'](),controller[_0xef11('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index d78a337..892f952 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 _0x7d2a=['sequelize','moment','exports','STRING','ENUM','csv','pdf','xlsx','DATE','INTEGER','UNSIGNED'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x7d2a,0x14a));var _0xa7d2=function(_0x4e49d2,_0x12a180){_0x4e49d2=_0x4e49d2-0x0;var _0x39ce1d=_0x7d2a[_0x4e49d2];return _0x39ce1d;};'use strict';var Sequelize=require(_0xa7d2('0x0'));var moment=require(_0xa7d2('0x1'));module[_0xa7d2('0x2')]={'name':{'type':Sequelize[_0xa7d2('0x3')],'allowNull':![]},'basename':{'type':Sequelize[_0xa7d2('0x3')],'allowNull':![]},'output':{'type':Sequelize[_0xa7d2('0x4')](_0xa7d2('0x5'),_0xa7d2('0x6'),_0xa7d2('0x7')),'allowNull':![],'defaultValue':_0xa7d2('0x5')},'savename':{'type':Sequelize[_0xa7d2('0x3')],'allowNull':![]},'startDate':{'type':Sequelize[_0xa7d2('0x8')]},'endDate':{'type':Sequelize[_0xa7d2('0x8')]},'status':{'type':Sequelize[_0xa7d2('0x3')],'defaultValue':'Loading'},'type':{'type':Sequelize[_0xa7d2('0x4')]('manual','scheduled'),'allowNull':![],'defaultValue':'manual'},'reportId':{'type':Sequelize[_0xa7d2('0x9')](0xb)[_0xa7d2('0xa')]},'reportType':{'type':Sequelize[_0xa7d2('0x3')]}}; \ No newline at end of file +var _0x3f1c=['csv','pdf','DATE','Loading','manual','scheduled','INTEGER','UNSIGNED','STRING','ENUM'];(function(_0x53eff4,_0x55b2c0){var _0x1fa828=function(_0x50da64){while(--_0x50da64){_0x53eff4['push'](_0x53eff4['shift']());}};_0x1fa828(++_0x55b2c0);}(_0x3f1c,0x6c));var _0xc3f1=function(_0x595b93,_0x1c35e9){_0x595b93=_0x595b93-0x0;var _0x12133a=_0x3f1c[_0x595b93];return _0x12133a;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize[_0xc3f1('0x0')],'allowNull':![]},'output':{'type':Sequelize[_0xc3f1('0x1')](_0xc3f1('0x2'),_0xc3f1('0x3'),'xlsx'),'allowNull':![],'defaultValue':'csv'},'savename':{'type':Sequelize['STRING'],'allowNull':![]},'startDate':{'type':Sequelize[_0xc3f1('0x4')]},'endDate':{'type':Sequelize[_0xc3f1('0x4')]},'status':{'type':Sequelize[_0xc3f1('0x0')],'defaultValue':_0xc3f1('0x5')},'type':{'type':Sequelize[_0xc3f1('0x1')](_0xc3f1('0x6'),_0xc3f1('0x7')),'allowNull':![],'defaultValue':'manual'},'reportId':{'type':Sequelize[_0xc3f1('0x8')](0xb)[_0xc3f1('0x9')]},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 865fb53..7af405b 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 _0xbb9c=['jsforce','desk.js','querystring','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','count','set','Content-Range','reject','save','then','destroy','get','ExtractedReports','UserProfileResource','error','name','send','index','map','AnalyticExtractedReport','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','catch','show','params','includeAll','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','savename','output','existsSync','join','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','download','root','format','%s.%s','basename','toLowerCase','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','fs-extra','lodash'];(function(_0x3e3bee,_0x4f91fe){var _0x3ae14c=function(_0x3861a0){while(--_0x3861a0){_0x3e3bee['push'](_0x3e3bee['shift']());}};_0x3ae14c(++_0x4f91fe);}(_0xbb9c,0xb6));var _0xcbb9=function(_0x4d674b,_0x176474){_0x4d674b=_0x4d674b-0x0;var _0x535a1f=_0xbb9c[_0x4d674b];return _0x535a1f;};'use strict';var emlformat=require(_0xcbb9('0x0'));var rimraf=require(_0xcbb9('0x1'));var zipdir=require(_0xcbb9('0x2'));var jsonpatch=require(_0xcbb9('0x3'));var rp=require(_0xcbb9('0x4'));var moment=require('moment');var BPromise=require(_0xcbb9('0x5'));var Mustache=require(_0xcbb9('0x6'));var util=require(_0xcbb9('0x7'));var path=require(_0xcbb9('0x8'));var sox=require('sox');var csv=require(_0xcbb9('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcbb9('0xa'));var _=require(_0xcbb9('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xcbb9('0xc'));var deskjs=require(_0xcbb9('0xd'));var toCsv=require(_0xcbb9('0x9'));var querystring=require(_0xcbb9('0xe'));var Papa=require(_0xcbb9('0xf'));var Redis=require('ioredis');var authService=require(_0xcbb9('0x10'));var qs=require(_0xcbb9('0x11'));var as=require(_0xcbb9('0x12'));var hardwareService=require(_0xcbb9('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xcbb9('0x14'));var config=require(_0xcbb9('0x15'));var licenseUtil=require(_0xcbb9('0x16'));var db=require(_0xcbb9('0x17'))['db'];function respondWithStatusCode(_0x30608f,_0xe5c0bd){_0xe5c0bd=_0xe5c0bd||0xcc;return function(_0x5bde44){if(_0x5bde44){return _0x30608f[_0xcbb9('0x18')](_0xe5c0bd);}return _0x30608f[_0xcbb9('0x19')](_0xe5c0bd)[_0xcbb9('0x1a')]();};}function respondWithResult(_0x365c34,_0x55eeb7){_0x55eeb7=_0x55eeb7||0xc8;return function(_0x5cc06a){if(_0x5cc06a){return _0x365c34[_0xcbb9('0x19')](_0x55eeb7)[_0xcbb9('0x1b')](_0x5cc06a);}};}function respondWithFilteredResult(_0x16e25c,_0x1ab7d4){return function(_0x48884c){if(_0x48884c){var _0x2ccd2a=typeof _0x1ab7d4[_0xcbb9('0x1c')]===_0xcbb9('0x1d')&&typeof _0x1ab7d4[_0xcbb9('0x1e')]===_0xcbb9('0x1d');var _0x51fdb6=_0x48884c[_0xcbb9('0x1f')];var _0x52c959=_0x2ccd2a?0x0:_0x1ab7d4[_0xcbb9('0x1c')];var _0x52e2f4=_0x2ccd2a?_0x48884c[_0xcbb9('0x1f')]:_0x1ab7d4[_0xcbb9('0x1c')]+_0x1ab7d4[_0xcbb9('0x1e')];var _0x45c7e9;if(_0x52e2f4>=_0x51fdb6){_0x52e2f4=_0x51fdb6;_0x45c7e9=0xc8;}else{_0x45c7e9=0xce;}_0x16e25c[_0xcbb9('0x19')](_0x45c7e9);return _0x16e25c[_0xcbb9('0x20')](_0xcbb9('0x21'),_0x52c959+'-'+_0x52e2f4+'/'+_0x51fdb6)[_0xcbb9('0x1b')](_0x48884c);}return null;};}function patchUpdates(_0x3d6a25){return function(_0x5c36e0){try{jsonpatch['apply'](_0x5c36e0,_0x3d6a25,!![]);}catch(_0xdc6fe2){return BPromise[_0xcbb9('0x22')](_0xdc6fe2);}return _0x5c36e0[_0xcbb9('0x23')]();};}function saveUpdates(_0x5d2f20,_0x5745a5){return function(_0x3d6c86){if(_0x3d6c86){return _0x3d6c86['update'](_0x5d2f20)[_0xcbb9('0x24')](function(_0x193700){return _0x193700;});}return null;};}function removeEntity(_0x44f615,_0x3323c4){return function(_0x305243){if(_0x305243){return _0x305243[_0xcbb9('0x25')]()[_0xcbb9('0x24')](function(){var _0x1ecc8e=_0x305243[_0xcbb9('0x26')]({'plain':!![]});var _0x48caaa=_0xcbb9('0x27');return db[_0xcbb9('0x28')]['destroy']({'where':{'type':_0x48caaa,'resourceId':_0x1ecc8e['id']}})[_0xcbb9('0x24')](function(){return _0x305243;});})[_0xcbb9('0x24')](function(){_0x44f615[_0xcbb9('0x19')](0xcc)[_0xcbb9('0x1a')]();});}};}function handleEntityNotFound(_0x8444be,_0x5e621d){return function(_0x9aa480){if(!_0x9aa480){_0x8444be['sendStatus'](0x194);}return _0x9aa480;};}function handleError(_0x556e10,_0x5cdb2e){_0x5cdb2e=_0x5cdb2e||0x1f4;return function(_0x3ab270){logger[_0xcbb9('0x29')](_0x3ab270['stack']);if(_0x3ab270[_0xcbb9('0x2a')]){delete _0x3ab270[_0xcbb9('0x2a')];}_0x556e10[_0xcbb9('0x19')](_0x5cdb2e)[_0xcbb9('0x2b')](_0x3ab270);};}exports[_0xcbb9('0x2c')]=function(_0x3781dc,_0x999f43){var _0x400963={},_0x4accea={},_0x3e7f56={'count':0x0,'rows':[]};var _0x2de35c=_[_0xcbb9('0x2d')](db[_0xcbb9('0x2e')][_0xcbb9('0x2f')],function(_0x48465f){return{'name':_0x48465f['fieldName'],'type':_0x48465f['type'][_0xcbb9('0x30')]};});_0x4accea[_0xcbb9('0x31')]=_[_0xcbb9('0x2d')](_0x2de35c,_0xcbb9('0x2a'));_0x4accea[_0xcbb9('0x32')]=_[_0xcbb9('0x33')](_0x3781dc[_0xcbb9('0x32')]);_0x4accea[_0xcbb9('0x34')]=_[_0xcbb9('0x35')](_0x4accea['model'],_0x4accea[_0xcbb9('0x32')]);_0x400963[_0xcbb9('0x36')]=_[_0xcbb9('0x35')](_0x4accea['model'],qs[_0xcbb9('0x37')](_0x3781dc[_0xcbb9('0x32')][_0xcbb9('0x37')]));_0x400963['attributes']=_0x400963[_0xcbb9('0x36')]['length']?_0x400963[_0xcbb9('0x36')]:_0x4accea[_0xcbb9('0x31')];if(!_0x3781dc[_0xcbb9('0x32')][_0xcbb9('0x38')](_0xcbb9('0x39'))){_0x400963[_0xcbb9('0x1e')]=qs[_0xcbb9('0x1e')](_0x3781dc[_0xcbb9('0x32')][_0xcbb9('0x1e')]);_0x400963['offset']=qs['offset'](_0x3781dc[_0xcbb9('0x32')][_0xcbb9('0x1c')]);}_0x400963[_0xcbb9('0x3a')]=qs[_0xcbb9('0x3b')](_0x3781dc[_0xcbb9('0x32')][_0xcbb9('0x3b')]);_0x400963[_0xcbb9('0x3c')]=qs['filters'](_[_0xcbb9('0x3d')](_0x3781dc[_0xcbb9('0x32')],_0x4accea[_0xcbb9('0x34')]),_0x2de35c);if(_0x3781dc[_0xcbb9('0x32')]['filter']){_0x400963[_0xcbb9('0x3c')]=_[_0xcbb9('0x3e')](_0x400963[_0xcbb9('0x3c')],{'$or':_['map'](_0x2de35c,function(_0x251719){if(_0x251719['type']!==_0xcbb9('0x3f')){var _0x1b81dc={};_0x1b81dc[_0x251719['name']]={'$like':'%'+_0x3781dc[_0xcbb9('0x32')][_0xcbb9('0x40')]+'%'};return _0x1b81dc;}})});}_0x400963=_['merge']({},_0x400963,_0x3781dc[_0xcbb9('0x41')]);var _0x202505={'where':_0x400963[_0xcbb9('0x3c')]};return db[_0xcbb9('0x2e')][_0xcbb9('0x1f')](_0x202505)[_0xcbb9('0x24')](function(_0x21c965){_0x3e7f56['count']=_0x21c965;if(_0x3781dc['query']['includeAll']){_0x400963[_0xcbb9('0x42')]=[{'all':!![]}];}return db['AnalyticExtractedReport'][_0xcbb9('0x43')](_0x400963);})[_0xcbb9('0x24')](function(_0x2370ea){_0x3e7f56['rows']=_0x2370ea;return _0x3e7f56;})[_0xcbb9('0x24')](respondWithFilteredResult(_0x999f43,_0x400963))[_0xcbb9('0x44')](handleError(_0x999f43,null));};exports[_0xcbb9('0x45')]=function(_0xc51c2f,_0x4d2510){var _0x2107a1={'raw':!![],'where':{'id':_0xc51c2f[_0xcbb9('0x46')]['id']}},_0x403b19={};_0x403b19[_0xcbb9('0x31')]=_['keys'](db[_0xcbb9('0x2e')]['rawAttributes']);_0x403b19[_0xcbb9('0x32')]=_[_0xcbb9('0x33')](_0xc51c2f[_0xcbb9('0x32')]);_0x403b19[_0xcbb9('0x34')]=_['intersection'](_0x403b19[_0xcbb9('0x31')],_0x403b19['query']);_0x2107a1['attributes']=_[_0xcbb9('0x35')](_0x403b19[_0xcbb9('0x31')],qs[_0xcbb9('0x37')](_0xc51c2f[_0xcbb9('0x32')][_0xcbb9('0x37')]));_0x2107a1[_0xcbb9('0x36')]=_0x2107a1[_0xcbb9('0x36')]['length']?_0x2107a1[_0xcbb9('0x36')]:_0x403b19[_0xcbb9('0x31')];if(_0xc51c2f['query'][_0xcbb9('0x47')]){_0x2107a1[_0xcbb9('0x42')]=[{'all':!![]}];}_0x2107a1=_[_0xcbb9('0x3e')]({},_0x2107a1,_0xc51c2f[_0xcbb9('0x41')]);return db[_0xcbb9('0x2e')]['find'](_0x2107a1)['then'](handleEntityNotFound(_0x4d2510,null))[_0xcbb9('0x24')](respondWithResult(_0x4d2510,null))[_0xcbb9('0x44')](handleError(_0x4d2510,null));};exports[_0xcbb9('0x48')]=function(_0xc08f00,_0x5c7931){return db['AnalyticExtractedReport']['create'](_0xc08f00[_0xcbb9('0x49')],{})[_0xcbb9('0x24')](function(_0x4935b6){var _0xf74f40=_0xc08f00['user']['get']({'plain':!![]});if(!_0xf74f40)throw new Error(_0xcbb9('0x4a'));if(_0xf74f40['role']===_0xcbb9('0x4b')){var _0x36287a=_0x4935b6[_0xcbb9('0x26')]({'plain':!![]});var _0x558c44='ExtractedReports';return db[_0xcbb9('0x4c')][_0xcbb9('0x4d')]({'where':{'name':_0x558c44,'userProfileId':_0xf74f40[_0xcbb9('0x4e')]},'raw':!![]})['then'](function(_0x4b2b85){if(_0x4b2b85&&_0x4b2b85[_0xcbb9('0x4f')]===0x0){return db[_0xcbb9('0x28')][_0xcbb9('0x48')]({'name':_0x36287a['name'],'resourceId':_0x36287a['id'],'type':_0x4b2b85[_0xcbb9('0x2a')],'sectionId':_0x4b2b85['id']},{})[_0xcbb9('0x24')](function(){return _0x4935b6;});}else{return _0x4935b6;}})[_0xcbb9('0x44')](function(_0x23c5d8){logger['error'](_0xcbb9('0x50'),_0x23c5d8);throw _0x23c5d8;});}return _0x4935b6;})[_0xcbb9('0x24')](respondWithResult(_0x5c7931,0xc9))['catch'](handleError(_0x5c7931,null));};exports[_0xcbb9('0x51')]=function(_0x6741d8,_0x22a16f){if(_0x6741d8[_0xcbb9('0x49')]['id']){delete _0x6741d8[_0xcbb9('0x49')]['id'];}return db[_0xcbb9('0x2e')]['find']({'where':{'id':_0x6741d8[_0xcbb9('0x46')]['id']}})[_0xcbb9('0x24')](handleEntityNotFound(_0x22a16f,null))[_0xcbb9('0x24')](saveUpdates(_0x6741d8[_0xcbb9('0x49')],null))[_0xcbb9('0x24')](respondWithResult(_0x22a16f,null))[_0xcbb9('0x44')](handleError(_0x22a16f,null));};exports[_0xcbb9('0x25')]=function(_0x39e2b2,_0x42a5f7){return db['AnalyticExtractedReport']['find']({'where':{'id':_0x39e2b2[_0xcbb9('0x46')]['id']}})[_0xcbb9('0x24')](handleEntityNotFound(_0x42a5f7,null))[_0xcbb9('0x24')](removeEntity(_0x42a5f7,null))[_0xcbb9('0x44')](handleError(_0x42a5f7,null));};exports['download']=function(_0x49e7b8,_0x3ee2d3,_0x1f4c1f){return db[_0xcbb9('0x2e')]['find']({'where':{'id':_0x49e7b8[_0xcbb9('0x46')]['id']},'attributes':[_0xcbb9('0x2a'),'basename',_0xcbb9('0x52'),_0xcbb9('0x53')],'raw':!![]})[_0xcbb9('0x24')](handleEntityNotFound(_0x3ee2d3,null))[_0xcbb9('0x24')](function(_0x29a1b7){if(_0x29a1b7){if(!fs[_0xcbb9('0x54')](path[_0xcbb9('0x55')](config['root'],_0xcbb9('0x56'),_0x29a1b7['savename']))){throw new db[(_0xcbb9('0x57'))][(_0xcbb9('0x58'))](_0xcbb9('0x59'));}if(_0x49e7b8[_0xcbb9('0x32')][_0xcbb9('0x5a')]){return _0x3ee2d3[_0xcbb9('0x18')](0xc8);}return _0x3ee2d3[_0xcbb9('0x5b')](path[_0xcbb9('0x55')](config[_0xcbb9('0x5c')],_0xcbb9('0x56'),_0x29a1b7[_0xcbb9('0x52')]),util[_0xcbb9('0x5d')](_0xcbb9('0x5e'),_0x29a1b7[_0xcbb9('0x5f')]||_0x29a1b7[_0xcbb9('0x2a')],_0x29a1b7[_0xcbb9('0x53')][_0xcbb9('0x60')]()));}})['catch'](handleError(_0x3ee2d3,null));}; \ No newline at end of file +var _0xee13=['ValidationError','exists','root','format','%s.%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','save','then','destroy','ExtractedReports','end','stack','name','send','index','map','AnalyticExtractedReport','type','key','model','query','keys','intersection','fields','attributes','length','nolimit','sort','filters','pick','filter','merge','where','VIRTUAL','options','includeAll','findAll','rows','catch','params','rawAttributes','include','find','create','body','user','get','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','download','basename','savename','output','existsSync','join','server/files/reports'];(function(_0x425051,_0x3c1854){var _0x126b92=function(_0x3d3702){while(--_0x3d3702){_0x425051['push'](_0x425051['shift']());}};_0x126b92(++_0x3c1854);}(_0xee13,0x1e5));var _0x3ee1=function(_0xe9ca7c,_0x45f2d3){_0xe9ca7c=_0xe9ca7c-0x0;var _0x17775e=_0xee13[_0xe9ca7c];return _0x17775e;};'use strict';var emlformat=require(_0x3ee1('0x0'));var rimraf=require(_0x3ee1('0x1'));var zipdir=require(_0x3ee1('0x2'));var jsonpatch=require(_0x3ee1('0x3'));var rp=require(_0x3ee1('0x4'));var moment=require(_0x3ee1('0x5'));var BPromise=require(_0x3ee1('0x6'));var Mustache=require(_0x3ee1('0x7'));var util=require(_0x3ee1('0x8'));var path=require(_0x3ee1('0x9'));var sox=require(_0x3ee1('0xa'));var csv=require(_0x3ee1('0xb'));var ejs=require(_0x3ee1('0xc'));var fs=require('fs');var fs_extra=require(_0x3ee1('0xd'));var _=require(_0x3ee1('0xe'));var squel=require(_0x3ee1('0xf'));var crypto=require(_0x3ee1('0x10'));var jsforce=require('jsforce');var deskjs=require(_0x3ee1('0x11'));var toCsv=require(_0x3ee1('0xb'));var querystring=require('querystring');var Papa=require(_0x3ee1('0x12'));var Redis=require(_0x3ee1('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x3ee1('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x3ee1('0x15'))(_0x3ee1('0x16'));var utils=require(_0x3ee1('0x17'));var config=require(_0x3ee1('0x18'));var licenseUtil=require(_0x3ee1('0x19'));var db=require(_0x3ee1('0x1a'))['db'];function respondWithStatusCode(_0x1a035f,_0x572a58){_0x572a58=_0x572a58||0xcc;return function(_0x18c304){if(_0x18c304){return _0x1a035f[_0x3ee1('0x1b')](_0x572a58);}return _0x1a035f[_0x3ee1('0x1c')](_0x572a58)['end']();};}function respondWithResult(_0x1eb87c,_0x4b92fc){_0x4b92fc=_0x4b92fc||0xc8;return function(_0x4f63f3){if(_0x4f63f3){return _0x1eb87c[_0x3ee1('0x1c')](_0x4b92fc)[_0x3ee1('0x1d')](_0x4f63f3);}};}function respondWithFilteredResult(_0x526ddc,_0x31a7d2){return function(_0x326c14){if(_0x326c14){var _0x39328e=typeof _0x31a7d2[_0x3ee1('0x1e')]===_0x3ee1('0x1f')&&typeof _0x31a7d2['limit']===_0x3ee1('0x1f');var _0x2849a0=_0x326c14[_0x3ee1('0x20')];var _0x3fea7a=_0x39328e?0x0:_0x31a7d2['offset'];var _0x34a5c5=_0x39328e?_0x326c14['count']:_0x31a7d2[_0x3ee1('0x1e')]+_0x31a7d2[_0x3ee1('0x21')];var _0x20e39f;if(_0x34a5c5>=_0x2849a0){_0x34a5c5=_0x2849a0;_0x20e39f=0xc8;}else{_0x20e39f=0xce;}_0x526ddc[_0x3ee1('0x1c')](_0x20e39f);return _0x526ddc[_0x3ee1('0x22')](_0x3ee1('0x23'),_0x3fea7a+'-'+_0x34a5c5+'/'+_0x2849a0)[_0x3ee1('0x1d')](_0x326c14);}return null;};}function patchUpdates(_0x383599){return function(_0x1480d6){try{jsonpatch[_0x3ee1('0x24')](_0x1480d6,_0x383599,!![]);}catch(_0x501ada){return BPromise['reject'](_0x501ada);}return _0x1480d6[_0x3ee1('0x25')]();};}function saveUpdates(_0x3fc493,_0x5ddd9a){return function(_0x157940){if(_0x157940){return _0x157940['update'](_0x3fc493)[_0x3ee1('0x26')](function(_0x32890c){return _0x32890c;});}return null;};}function removeEntity(_0x58e419,_0x268813){return function(_0x30714f){if(_0x30714f){return _0x30714f[_0x3ee1('0x27')]()['then'](function(){var _0x5c51ae=_0x30714f['get']({'plain':!![]});var _0x2d3cd0=_0x3ee1('0x28');return db['UserProfileResource'][_0x3ee1('0x27')]({'where':{'type':_0x2d3cd0,'resourceId':_0x5c51ae['id']}})[_0x3ee1('0x26')](function(){return _0x30714f;});})[_0x3ee1('0x26')](function(){_0x58e419[_0x3ee1('0x1c')](0xcc)[_0x3ee1('0x29')]();});}};}function handleEntityNotFound(_0x1b84b0,_0x5a9b5b){return function(_0x532abd){if(!_0x532abd){_0x1b84b0[_0x3ee1('0x1b')](0x194);}return _0x532abd;};}function handleError(_0xfa06a2,_0x2c18a7){_0x2c18a7=_0x2c18a7||0x1f4;return function(_0x329d08){logger['error'](_0x329d08[_0x3ee1('0x2a')]);if(_0x329d08[_0x3ee1('0x2b')]){delete _0x329d08[_0x3ee1('0x2b')];}_0xfa06a2[_0x3ee1('0x1c')](_0x2c18a7)[_0x3ee1('0x2c')](_0x329d08);};}exports[_0x3ee1('0x2d')]=function(_0x30ded3,_0x156998){var _0x3fe690={},_0x5d235a={},_0x55ced1={'count':0x0,'rows':[]};var _0x3bbbb3=_[_0x3ee1('0x2e')](db[_0x3ee1('0x2f')]['rawAttributes'],function(_0x4f674c){return{'name':_0x4f674c['fieldName'],'type':_0x4f674c[_0x3ee1('0x30')][_0x3ee1('0x31')]};});_0x5d235a[_0x3ee1('0x32')]=_[_0x3ee1('0x2e')](_0x3bbbb3,'name');_0x5d235a[_0x3ee1('0x33')]=_[_0x3ee1('0x34')](_0x30ded3['query']);_0x5d235a['filters']=_[_0x3ee1('0x35')](_0x5d235a[_0x3ee1('0x32')],_0x5d235a['query']);_0x3fe690['attributes']=_[_0x3ee1('0x35')](_0x5d235a['model'],qs[_0x3ee1('0x36')](_0x30ded3[_0x3ee1('0x33')]['fields']));_0x3fe690[_0x3ee1('0x37')]=_0x3fe690[_0x3ee1('0x37')][_0x3ee1('0x38')]?_0x3fe690[_0x3ee1('0x37')]:_0x5d235a[_0x3ee1('0x32')];if(!_0x30ded3['query']['hasOwnProperty'](_0x3ee1('0x39'))){_0x3fe690['limit']=qs['limit'](_0x30ded3[_0x3ee1('0x33')]['limit']);_0x3fe690[_0x3ee1('0x1e')]=qs[_0x3ee1('0x1e')](_0x30ded3[_0x3ee1('0x33')]['offset']);}_0x3fe690['order']=qs[_0x3ee1('0x3a')](_0x30ded3['query'][_0x3ee1('0x3a')]);_0x3fe690['where']=qs[_0x3ee1('0x3b')](_[_0x3ee1('0x3c')](_0x30ded3['query'],_0x5d235a['filters']),_0x3bbbb3);if(_0x30ded3['query'][_0x3ee1('0x3d')]){_0x3fe690['where']=_[_0x3ee1('0x3e')](_0x3fe690[_0x3ee1('0x3f')],{'$or':_[_0x3ee1('0x2e')](_0x3bbbb3,function(_0x66c8d1){if(_0x66c8d1['type']!==_0x3ee1('0x40')){var _0x32d482={};_0x32d482[_0x66c8d1['name']]={'$like':'%'+_0x30ded3[_0x3ee1('0x33')][_0x3ee1('0x3d')]+'%'};return _0x32d482;}})});}_0x3fe690=_[_0x3ee1('0x3e')]({},_0x3fe690,_0x30ded3[_0x3ee1('0x41')]);var _0x4f8923={'where':_0x3fe690['where']};return db[_0x3ee1('0x2f')][_0x3ee1('0x20')](_0x4f8923)[_0x3ee1('0x26')](function(_0x165ab0){_0x55ced1[_0x3ee1('0x20')]=_0x165ab0;if(_0x30ded3['query'][_0x3ee1('0x42')]){_0x3fe690['include']=[{'all':!![]}];}return db[_0x3ee1('0x2f')][_0x3ee1('0x43')](_0x3fe690);})[_0x3ee1('0x26')](function(_0x19c9f9){_0x55ced1[_0x3ee1('0x44')]=_0x19c9f9;return _0x55ced1;})[_0x3ee1('0x26')](respondWithFilteredResult(_0x156998,_0x3fe690))[_0x3ee1('0x45')](handleError(_0x156998,null));};exports['show']=function(_0x4fb825,_0x2c2760){var _0x3d2d41={'raw':!![],'where':{'id':_0x4fb825[_0x3ee1('0x46')]['id']}},_0x10996d={};_0x10996d['model']=_[_0x3ee1('0x34')](db[_0x3ee1('0x2f')][_0x3ee1('0x47')]);_0x10996d[_0x3ee1('0x33')]=_['keys'](_0x4fb825[_0x3ee1('0x33')]);_0x10996d[_0x3ee1('0x3b')]=_['intersection'](_0x10996d[_0x3ee1('0x32')],_0x10996d[_0x3ee1('0x33')]);_0x3d2d41[_0x3ee1('0x37')]=_['intersection'](_0x10996d[_0x3ee1('0x32')],qs[_0x3ee1('0x36')](_0x4fb825[_0x3ee1('0x33')][_0x3ee1('0x36')]));_0x3d2d41['attributes']=_0x3d2d41[_0x3ee1('0x37')][_0x3ee1('0x38')]?_0x3d2d41[_0x3ee1('0x37')]:_0x10996d[_0x3ee1('0x32')];if(_0x4fb825[_0x3ee1('0x33')][_0x3ee1('0x42')]){_0x3d2d41[_0x3ee1('0x48')]=[{'all':!![]}];}_0x3d2d41=_[_0x3ee1('0x3e')]({},_0x3d2d41,_0x4fb825[_0x3ee1('0x41')]);return db['AnalyticExtractedReport'][_0x3ee1('0x49')](_0x3d2d41)['then'](handleEntityNotFound(_0x2c2760,null))[_0x3ee1('0x26')](respondWithResult(_0x2c2760,null))['catch'](handleError(_0x2c2760,null));};exports[_0x3ee1('0x4a')]=function(_0x25fda7,_0x2ed3ac){return db[_0x3ee1('0x2f')][_0x3ee1('0x4a')](_0x25fda7[_0x3ee1('0x4b')],{})['then'](function(_0x104d05){var _0x46493e=_0x25fda7[_0x3ee1('0x4c')][_0x3ee1('0x4d')]({'plain':!![]});if(!_0x46493e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x46493e['role']===_0x3ee1('0x4c')){var _0x21cbbb=_0x104d05[_0x3ee1('0x4d')]({'plain':!![]});var _0x48997c=_0x3ee1('0x28');return db['UserProfileSection'][_0x3ee1('0x49')]({'where':{'name':_0x48997c,'userProfileId':_0x46493e[_0x3ee1('0x4e')]},'raw':!![]})[_0x3ee1('0x26')](function(_0x4e484c){if(_0x4e484c&&_0x4e484c[_0x3ee1('0x4f')]===0x0){return db[_0x3ee1('0x50')][_0x3ee1('0x4a')]({'name':_0x21cbbb[_0x3ee1('0x2b')],'resourceId':_0x21cbbb['id'],'type':_0x4e484c[_0x3ee1('0x2b')],'sectionId':_0x4e484c['id']},{})[_0x3ee1('0x26')](function(){return _0x104d05;});}else{return _0x104d05;}})[_0x3ee1('0x45')](function(_0xf744b7){logger[_0x3ee1('0x51')](_0x3ee1('0x52'),_0xf744b7);throw _0xf744b7;});}return _0x104d05;})[_0x3ee1('0x26')](respondWithResult(_0x2ed3ac,0xc9))['catch'](handleError(_0x2ed3ac,null));};exports[_0x3ee1('0x53')]=function(_0x40fd7f,_0x1ddb10){if(_0x40fd7f[_0x3ee1('0x4b')]['id']){delete _0x40fd7f[_0x3ee1('0x4b')]['id'];}return db[_0x3ee1('0x2f')]['find']({'where':{'id':_0x40fd7f[_0x3ee1('0x46')]['id']}})[_0x3ee1('0x26')](handleEntityNotFound(_0x1ddb10,null))[_0x3ee1('0x26')](saveUpdates(_0x40fd7f[_0x3ee1('0x4b')],null))[_0x3ee1('0x26')](respondWithResult(_0x1ddb10,null))[_0x3ee1('0x45')](handleError(_0x1ddb10,null));};exports['destroy']=function(_0x18049a,_0x1a0cb5){return db['AnalyticExtractedReport'][_0x3ee1('0x49')]({'where':{'id':_0x18049a[_0x3ee1('0x46')]['id']}})[_0x3ee1('0x26')](handleEntityNotFound(_0x1a0cb5,null))['then'](removeEntity(_0x1a0cb5,null))[_0x3ee1('0x45')](handleError(_0x1a0cb5,null));};exports[_0x3ee1('0x54')]=function(_0x5a936f,_0x31464a,_0xac3d9a){return db[_0x3ee1('0x2f')][_0x3ee1('0x49')]({'where':{'id':_0x5a936f[_0x3ee1('0x46')]['id']},'attributes':[_0x3ee1('0x2b'),_0x3ee1('0x55'),_0x3ee1('0x56'),_0x3ee1('0x57')],'raw':!![]})['then'](handleEntityNotFound(_0x31464a,null))[_0x3ee1('0x26')](function(_0x2bc0f0){if(_0x2bc0f0){if(!fs[_0x3ee1('0x58')](path[_0x3ee1('0x59')](config['root'],_0x3ee1('0x5a'),_0x2bc0f0[_0x3ee1('0x56')]))){throw new db['Sequelize'][(_0x3ee1('0x5b'))]('Report\x20not\x20found\x20or\x20empty');}if(_0x5a936f[_0x3ee1('0x33')][_0x3ee1('0x5c')]){return _0x31464a['sendStatus'](0xc8);}return _0x31464a[_0x3ee1('0x54')](path[_0x3ee1('0x59')](config[_0x3ee1('0x5d')],_0x3ee1('0x5a'),_0x2bc0f0['savename']),util[_0x3ee1('0x5e')](_0x3ee1('0x5f'),_0x2bc0f0[_0x3ee1('0x55')]||_0x2bc0f0[_0x3ee1('0x2b')],_0x2bc0f0[_0x3ee1('0x57')]['toLowerCase']()));}})[_0x3ee1('0x45')](handleError(_0x31464a,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index e9dd322..bc6d1a3 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 _0x7274=['lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','AnalyticExtractedReport'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7274,0x136));var _0x4727=function(_0x3401ff,_0x465a74){_0x3401ff=_0x3401ff-0x0;var _0x2cb407=_0x7274[_0x3401ff];return _0x2cb407;};'use strict';var _=require(_0x4727('0x0'));var util=require(_0x4727('0x1'));var logger=require('../../config/logger')(_0x4727('0x2'));var moment=require(_0x4727('0x3'));var BPromise=require(_0x4727('0x4'));var rp=require(_0x4727('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4727('0x6'));var config=require(_0x4727('0x7'));var attributes=require('./analyticExtractedReport.attributes');module[_0x4727('0x8')]=function(_0x549df7,_0x532af3){return _0x549df7['define'](_0x4727('0x9'),attributes,{'tableName':'analytics_extracted_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x25e9=['../../config/environment','./analyticExtractedReport.attributes','exports','define','analytics_extracted_reports','api','moment','request-promise','path','rimraf'];(function(_0x25900d,_0x1d3576){var _0x292ad9=function(_0x4a7ccc){while(--_0x4a7ccc){_0x25900d['push'](_0x25900d['shift']());}};_0x292ad9(++_0x1d3576);}(_0x25e9,0xaf));var _0x925e=function(_0x1147ab,_0x10e72b){_0x1147ab=_0x1147ab-0x0;var _0x55cb5a=_0x25e9[_0x1147ab];return _0x55cb5a;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x925e('0x0'));var moment=require(_0x925e('0x1'));var BPromise=require('bluebird');var rp=require(_0x925e('0x2'));var fs=require('fs');var path=require(_0x925e('0x3'));var rimraf=require(_0x925e('0x4'));var config=require(_0x925e('0x5'));var attributes=require(_0x925e('0x6'));module[_0x925e('0x7')]=function(_0x1049d5,_0x12e5f1){return _0x1049d5[_0x925e('0x8')]('AnalyticExtractedReport',attributes,{'tableName':_0x925e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js b/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js index ce2096c..50d667f 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 _0x5635=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','AnalyticExtractedReport,\x20%s,\x20%s','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','util','bluebird'];(function(_0x24dc8f,_0x14b7e8){var _0x189c9b=function(_0x25b498){while(--_0x25b498){_0x24dc8f['push'](_0x24dc8f['shift']());}};_0x189c9b(++_0x14b7e8);}(_0x5635,0xbb));var _0x5563=function(_0x144045,_0x3b68b1){_0x144045=_0x144045-0x0;var _0x12a942=_0x5635[_0x144045];return _0x12a942;};'use strict';var _=require('lodash');var util=require(_0x5563('0x0'));var moment=require('moment');var BPromise=require(_0x5563('0x1'));var rs=require(_0x5563('0x2'));var fs=require('fs');var Redis=require(_0x5563('0x3'));var db=require(_0x5563('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x5563('0x5'))(_0x5563('0x6'));var config=require(_0x5563('0x7'));var jayson=require(_0x5563('0x8'));var client=jayson[_0x5563('0x9')][_0x5563('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x477c7b,_0x307f1a,_0x2dcf5b){return new BPromise(function(_0x36d77f,_0x479c2f){return client['request'](_0x477c7b,_0x2dcf5b)[_0x5563('0xb')](function(_0x89306f){logger[_0x5563('0xc')](_0x5563('0xd'),_0x307f1a,'request\x20sent');logger[_0x5563('0xe')](_0x5563('0xf'),_0x307f1a,'request\x20sent',JSON[_0x5563('0x10')](_0x89306f));if(_0x89306f[_0x5563('0x11')]){if(_0x89306f[_0x5563('0x11')][_0x5563('0x12')]===0x1f4){logger[_0x5563('0x11')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x307f1a,_0x89306f[_0x5563('0x11')][_0x5563('0x13')]);return _0x479c2f(_0x89306f['error'][_0x5563('0x13')]);}logger[_0x5563('0x11')](_0x5563('0xd'),_0x307f1a,_0x89306f[_0x5563('0x11')][_0x5563('0x13')]);return _0x36d77f(_0x89306f[_0x5563('0x11')][_0x5563('0x13')]);}else{logger[_0x5563('0xc')](_0x5563('0xd'),_0x307f1a,_0x5563('0x14'));_0x36d77f(_0x89306f['result'][_0x5563('0x13')]);}})['catch'](function(_0x211b09){logger[_0x5563('0x11')](_0x5563('0xd'),_0x307f1a,_0x211b09);_0x479c2f(_0x211b09);});});} \ No newline at end of file +var _0xa71a=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','AnalyticExtractedReport,\x20%s,\x20%s','message','info','catch','lodash'];(function(_0x3873b0,_0x455688){var _0x6fa204=function(_0x560e95){while(--_0x560e95){_0x3873b0['push'](_0x3873b0['shift']());}};_0x6fa204(++_0x455688);}(_0xa71a,0xf1));var _0xaa71=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa71a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xaa71('0x0'));var util=require(_0xaa71('0x1'));var moment=require(_0xaa71('0x2'));var BPromise=require(_0xaa71('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xaa71('0x4'));var db=require(_0xaa71('0x5'))['db'];var utils=require(_0xaa71('0x6'));var logger=require('../../config/logger')(_0xaa71('0x7'));var config=require('../../config/environment');var jayson=require(_0xaa71('0x8'));var client=jayson[_0xaa71('0x9')][_0xaa71('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5893aa,_0x274dce,_0x35b8cf){return new BPromise(function(_0x5a0dca,_0x50ad8f){return client[_0xaa71('0xb')](_0x5893aa,_0x35b8cf)[_0xaa71('0xc')](function(_0xc26148){logger['info']('AnalyticExtractedReport,\x20%s,\x20%s',_0x274dce,_0xaa71('0xd'));logger[_0xaa71('0xe')](_0xaa71('0xf'),_0x274dce,_0xaa71('0xd'),JSON[_0xaa71('0x10')](_0xc26148));if(_0xc26148[_0xaa71('0x11')]){if(_0xc26148['error']['code']===0x1f4){logger['error'](_0xaa71('0x12'),_0x274dce,_0xc26148[_0xaa71('0x11')][_0xaa71('0x13')]);return _0x50ad8f(_0xc26148['error'][_0xaa71('0x13')]);}logger[_0xaa71('0x11')](_0xaa71('0x12'),_0x274dce,_0xc26148[_0xaa71('0x11')][_0xaa71('0x13')]);return _0x5a0dca(_0xc26148[_0xaa71('0x11')]['message']);}else{logger[_0xaa71('0x14')](_0xaa71('0x12'),_0x274dce,_0xaa71('0xd'));_0x5a0dca(_0xc26148['result'][_0xaa71('0x13')]);}})[_0xaa71('0x15')](function(_0x25a7ac){logger[_0xaa71('0x11')](_0xaa71('0x12'),_0x274dce,_0x25a7ac);_0x50ad8f(_0x25a7ac);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 2e540eb..68d5e0a 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 _0x9f8b=['/:id/download','post','create','update','delete','exports','multer','util','connect-timeout','Router','fs-extra','../../config/environment','./analyticExtractedReport.controller','get','/:id','isAuthenticated'];(function(_0x261cfc,_0x3fe3d3){var _0x5cb3eb=function(_0x3cb4f3){while(--_0x3cb4f3){_0x261cfc['push'](_0x261cfc['shift']());}};_0x5cb3eb(++_0x3fe3d3);}(_0x9f8b,0x106));var _0xb9f8=function(_0x109371,_0x441c8e){_0x109371=_0x109371-0x0;var _0x4fd858=_0x9f8b[_0x109371];return _0x4fd858;};'use strict';var multer=require(_0xb9f8('0x0'));var util=require(_0xb9f8('0x1'));var path=require('path');var timeout=require(_0xb9f8('0x2'));var express=require('express');var router=express[_0xb9f8('0x3')]();var fs_extra=require(_0xb9f8('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb9f8('0x5'));var controller=require(_0xb9f8('0x6'));router[_0xb9f8('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xb9f8('0x8'),auth[_0xb9f8('0x9')](),controller['show']);router[_0xb9f8('0x7')](_0xb9f8('0xa'),auth['isAuthenticated'](),controller['download']);router[_0xb9f8('0xb')]('/',auth[_0xb9f8('0x9')](),controller[_0xb9f8('0xc')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xb9f8('0xd')]);router[_0xb9f8('0xe')](_0xb9f8('0x8'),auth[_0xb9f8('0x9')](),controller['destroy']);module[_0xb9f8('0xf')]=router; \ No newline at end of file +var _0x599f=['get','isAuthenticated','index','/:id','show','/:id/download','download','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller'];(function(_0x12aa5b,_0x36424a){var _0x34fb62=function(_0x59fa6d){while(--_0x59fa6d){_0x12aa5b['push'](_0x12aa5b['shift']());}};_0x34fb62(++_0x36424a);}(_0x599f,0x167));var _0xf599=function(_0x57f6db,_0x28c6c5){_0x57f6db=_0x57f6db-0x0;var _0x44d061=_0x599f[_0x57f6db];return _0x44d061;};'use strict';var multer=require(_0xf599('0x0'));var util=require(_0xf599('0x1'));var path=require('path');var timeout=require(_0xf599('0x2'));var express=require(_0xf599('0x3'));var router=express[_0xf599('0x4')]();var fs_extra=require(_0xf599('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xf599('0x6'));var config=require(_0xf599('0x7'));var controller=require(_0xf599('0x8'));router[_0xf599('0x9')]('/',auth[_0xf599('0xa')](),controller[_0xf599('0xb')]);router['get'](_0xf599('0xc'),auth[_0xf599('0xa')](),controller[_0xf599('0xd')]);router[_0xf599('0x9')](_0xf599('0xe'),auth['isAuthenticated'](),controller[_0xf599('0xf')]);router[_0xf599('0x10')]('/',auth[_0xf599('0xa')](),controller[_0xf599('0x11')]);router[_0xf599('0x12')](_0xf599('0xc'),auth[_0xf599('0xa')](),controller[_0xf599('0x13')]);router[_0xf599('0x14')](_0xf599('0xc'),auth[_0xf599('0xa')](),controller[_0xf599('0x15')]);module[_0xf599('0x16')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index ca919dd..900eeb0 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 _0x81a1=['sequelize','exports','STRING','BOOLEAN'];(function(_0x10071d,_0x4c5399){var _0x128675=function(_0x378827){while(--_0x378827){_0x10071d['push'](_0x10071d['shift']());}};_0x128675(++_0x4c5399);}(_0x81a1,0x110));var _0x181a=function(_0x56b3fe,_0x3f1224){_0x56b3fe=_0x56b3fe-0x0;var _0x998277=_0x81a1[_0x56b3fe];return _0x998277;};'use strict';var Sequelize=require(_0x181a('0x0'));module[_0x181a('0x1')]={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize[_0x181a('0x2')]},'function':{'type':Sequelize[_0x181a('0x2')]},'format':{'type':Sequelize['STRING']},'groupBy':{'type':Sequelize[_0x181a('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x181a('0x2')]},'custom':{'type':Sequelize[_0x181a('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xc582=['sequelize','exports','TEXT','STRING','BOOLEAN'];(function(_0xe84d45,_0x59d7cf){var _0x41d88e=function(_0x270741){while(--_0x270741){_0xe84d45['push'](_0xe84d45['shift']());}};_0x41d88e(++_0x59d7cf);}(_0xc582,0x7d));var _0x2c58=function(_0x725b8e,_0xc22b48){_0x725b8e=_0x725b8e-0x0;var _0x43ac45=_0xc582[_0x725b8e];return _0x43ac45;};'use strict';var Sequelize=require(_0x2c58('0x0'));module[_0x2c58('0x1')]={'field':{'type':Sequelize[_0x2c58('0x2')]},'alias':{'type':Sequelize[_0x2c58('0x3')]},'function':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x2c58('0x3')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x2c58('0x3')]},'custom':{'type':Sequelize[_0x2c58('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index c8cd50c..7f9387f 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 _0xb582=['ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','AnalyticFieldReport','rawAttributes','fieldName','query','keys','intersection','model','attributes','length','order','sort','where','filters','pick','filter','type','merge','options','includeAll','include','findAll','rows','params','find','create','body','catch','bulkCreate','ids','addFields','AnalyticCustomReport','findOne','CustomReportId','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x5a6e3c,_0x28faa0){var _0x3bc48c=function(_0x5ccacf){while(--_0x5ccacf){_0x5a6e3c['push'](_0x5a6e3c['shift']());}};_0x3bc48c(++_0x28faa0);}(_0xb582,0xda));var _0x2b58=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0xb582[_0x1d1779];return _0x2377e9;};'use strict';var emlformat=require(_0x2b58('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2b58('0x1'));var jsonpatch=require(_0x2b58('0x2'));var rp=require(_0x2b58('0x3'));var moment=require(_0x2b58('0x4'));var BPromise=require(_0x2b58('0x5'));var Mustache=require('mustache');var util=require(_0x2b58('0x6'));var path=require(_0x2b58('0x7'));var sox=require('sox');var csv=require(_0x2b58('0x8'));var ejs=require(_0x2b58('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2b58('0xa'));var squel=require('squel');var crypto=require(_0x2b58('0xb'));var jsforce=require(_0x2b58('0xc'));var deskjs=require(_0x2b58('0xd'));var toCsv=require(_0x2b58('0x8'));var querystring=require(_0x2b58('0xe'));var Papa=require(_0x2b58('0xf'));var Redis=require(_0x2b58('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x2b58('0x11'));var as=require(_0x2b58('0x12'));var hardwareService=require(_0x2b58('0x13'));var logger=require('../../config/logger')(_0x2b58('0x14'));var utils=require(_0x2b58('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x2b58('0x16'));var db=require(_0x2b58('0x17'))['db'];function respondWithStatusCode(_0x435470,_0x522994){_0x522994=_0x522994||0xcc;return function(_0x1d6988){if(_0x1d6988){return _0x435470[_0x2b58('0x18')](_0x522994);}return _0x435470[_0x2b58('0x19')](_0x522994)[_0x2b58('0x1a')]();};}function respondWithResult(_0x124610,_0x1c9fa8){_0x1c9fa8=_0x1c9fa8||0xc8;return function(_0x410535){if(_0x410535){return _0x124610['status'](_0x1c9fa8)[_0x2b58('0x1b')](_0x410535);}};}function respondWithFilteredResult(_0x4993f7,_0x42b9cb){return function(_0x543cfa){if(_0x543cfa){var _0x2fda73=typeof _0x42b9cb[_0x2b58('0x1c')]==='undefined'&&typeof _0x42b9cb[_0x2b58('0x1d')]==='undefined';var _0x4ac18f=_0x543cfa[_0x2b58('0x1e')];var _0x5c9ea1=_0x2fda73?0x0:_0x42b9cb[_0x2b58('0x1c')];var _0x51cd21=_0x2fda73?_0x543cfa[_0x2b58('0x1e')]:_0x42b9cb[_0x2b58('0x1c')]+_0x42b9cb[_0x2b58('0x1d')];var _0x2a8d62;if(_0x51cd21>=_0x4ac18f){_0x51cd21=_0x4ac18f;_0x2a8d62=0xc8;}else{_0x2a8d62=0xce;}_0x4993f7[_0x2b58('0x19')](_0x2a8d62);return _0x4993f7[_0x2b58('0x1f')](_0x2b58('0x20'),_0x5c9ea1+'-'+_0x51cd21+'/'+_0x4ac18f)['json'](_0x543cfa);}return null;};}function patchUpdates(_0x3ced3a){return function(_0x4b1837){try{jsonpatch[_0x2b58('0x21')](_0x4b1837,_0x3ced3a,!![]);}catch(_0x3efee5){return BPromise[_0x2b58('0x22')](_0x3efee5);}return _0x4b1837[_0x2b58('0x23')]();};}function saveUpdates(_0x24af76,_0x17b8ae){return function(_0x3d87b0){if(_0x3d87b0){return _0x3d87b0[_0x2b58('0x24')](_0x24af76)[_0x2b58('0x25')](function(_0x297ecd){return _0x297ecd;});}return null;};}function removeEntity(_0x736a36,_0x50fdbd){return function(_0x5482f1){if(_0x5482f1){return _0x5482f1[_0x2b58('0x26')]()[_0x2b58('0x25')](function(){_0x736a36[_0x2b58('0x19')](0xcc)[_0x2b58('0x1a')]();});}};}function handleEntityNotFound(_0x56fca5,_0x4c11ab){return function(_0x294884){if(!_0x294884){_0x56fca5[_0x2b58('0x18')](0x194);}return _0x294884;};}function handleError(_0x496615,_0x54bf0b){_0x54bf0b=_0x54bf0b||0x1f4;return function(_0x1f1c18){logger[_0x2b58('0x27')](_0x1f1c18[_0x2b58('0x28')]);if(_0x1f1c18['name']){delete _0x1f1c18[_0x2b58('0x29')];}_0x496615[_0x2b58('0x19')](_0x54bf0b)[_0x2b58('0x2a')](_0x1f1c18);};}exports[_0x2b58('0x2b')]=function(_0xc0dceb,_0x1c6d3a){var _0x3728ae={},_0x168e65={},_0x1454d9={'count':0x0,'rows':[]};var _0x362069=_[_0x2b58('0x2c')](db[_0x2b58('0x2d')][_0x2b58('0x2e')],function(_0x577aa1){return{'name':_0x577aa1[_0x2b58('0x2f')],'type':_0x577aa1['type']['key']};});_0x168e65['model']=_['map'](_0x362069,'name');_0x168e65[_0x2b58('0x30')]=_[_0x2b58('0x31')](_0xc0dceb[_0x2b58('0x30')]);_0x168e65['filters']=_[_0x2b58('0x32')](_0x168e65[_0x2b58('0x33')],_0x168e65[_0x2b58('0x30')]);_0x3728ae[_0x2b58('0x34')]=_[_0x2b58('0x32')](_0x168e65[_0x2b58('0x33')],qs['fields'](_0xc0dceb[_0x2b58('0x30')]['fields']));_0x3728ae['attributes']=_0x3728ae[_0x2b58('0x34')][_0x2b58('0x35')]?_0x3728ae[_0x2b58('0x34')]:_0x168e65[_0x2b58('0x33')];if(!_0xc0dceb[_0x2b58('0x30')]['hasOwnProperty']('nolimit')){_0x3728ae[_0x2b58('0x1d')]=qs[_0x2b58('0x1d')](_0xc0dceb['query'][_0x2b58('0x1d')]);_0x3728ae['offset']=qs[_0x2b58('0x1c')](_0xc0dceb[_0x2b58('0x30')][_0x2b58('0x1c')]);}_0x3728ae[_0x2b58('0x36')]=qs[_0x2b58('0x37')](_0xc0dceb['query']['sort']);_0x3728ae[_0x2b58('0x38')]=qs[_0x2b58('0x39')](_[_0x2b58('0x3a')](_0xc0dceb['query'],_0x168e65[_0x2b58('0x39')]),_0x362069);if(_0xc0dceb[_0x2b58('0x30')][_0x2b58('0x3b')]){_0x3728ae[_0x2b58('0x38')]=_['merge'](_0x3728ae[_0x2b58('0x38')],{'$or':_[_0x2b58('0x2c')](_0x362069,function(_0x275aeb){if(_0x275aeb[_0x2b58('0x3c')]!=='VIRTUAL'){var _0x3d8f1c={};_0x3d8f1c[_0x275aeb[_0x2b58('0x29')]]={'$like':'%'+_0xc0dceb[_0x2b58('0x30')][_0x2b58('0x3b')]+'%'};return _0x3d8f1c;}})});}_0x3728ae=_[_0x2b58('0x3d')]({},_0x3728ae,_0xc0dceb[_0x2b58('0x3e')]);var _0x4afbc4={'where':_0x3728ae['where']};return db[_0x2b58('0x2d')][_0x2b58('0x1e')](_0x4afbc4)[_0x2b58('0x25')](function(_0x482fb1){_0x1454d9[_0x2b58('0x1e')]=_0x482fb1;if(_0xc0dceb[_0x2b58('0x30')][_0x2b58('0x3f')]){_0x3728ae[_0x2b58('0x40')]=[{'all':!![]}];}return db[_0x2b58('0x2d')][_0x2b58('0x41')](_0x3728ae);})['then'](function(_0x322f59){_0x1454d9[_0x2b58('0x42')]=_0x322f59;return _0x1454d9;})[_0x2b58('0x25')](respondWithFilteredResult(_0x1c6d3a,_0x3728ae))['catch'](handleError(_0x1c6d3a,null));};exports['show']=function(_0x3924d2,_0x183a3c){var _0x1bfc4f={'raw':![],'where':{'id':_0x3924d2[_0x2b58('0x43')]['id']}},_0x100efd={};_0x100efd['model']=_[_0x2b58('0x31')](db[_0x2b58('0x2d')][_0x2b58('0x2e')]);_0x100efd['query']=_['keys'](_0x3924d2[_0x2b58('0x30')]);_0x100efd['filters']=_[_0x2b58('0x32')](_0x100efd[_0x2b58('0x33')],_0x100efd[_0x2b58('0x30')]);_0x1bfc4f[_0x2b58('0x34')]=_[_0x2b58('0x32')](_0x100efd['model'],qs['fields'](_0x3924d2[_0x2b58('0x30')]['fields']));_0x1bfc4f[_0x2b58('0x34')]=_0x1bfc4f[_0x2b58('0x34')][_0x2b58('0x35')]?_0x1bfc4f['attributes']:_0x100efd['model'];if(_0x3924d2[_0x2b58('0x30')][_0x2b58('0x3f')]){_0x1bfc4f['include']=[{'all':!![]}];}_0x1bfc4f=_[_0x2b58('0x3d')]({},_0x1bfc4f,_0x3924d2[_0x2b58('0x3e')]);return db[_0x2b58('0x2d')][_0x2b58('0x44')](_0x1bfc4f)[_0x2b58('0x25')](handleEntityNotFound(_0x183a3c,null))[_0x2b58('0x25')](respondWithResult(_0x183a3c,null))['catch'](handleError(_0x183a3c,null));};exports[_0x2b58('0x45')]=function(_0x1b51b4,_0x5b4cd7){return db[_0x2b58('0x2d')][_0x2b58('0x45')](_0x1b51b4[_0x2b58('0x46')],{})['then'](respondWithResult(_0x5b4cd7,0xc9))[_0x2b58('0x47')](handleError(_0x5b4cd7,null));};exports[_0x2b58('0x48')]=function(_0x39cb74,_0x19e59e){return db[_0x2b58('0x2d')][_0x2b58('0x48')](_0x39cb74[_0x2b58('0x46')],{'raw':![],'individualHooks':!![]})[_0x2b58('0x25')](respondWithResult(_0x19e59e,0xc9))['catch'](handleError(_0x19e59e,null));};exports[_0x2b58('0x24')]=function(_0x42aadf,_0xb4862){if(_0x42aadf[_0x2b58('0x46')]['id']){delete _0x42aadf['body']['id'];}return db['AnalyticFieldReport']['find']({'where':{'id':_0x42aadf[_0x2b58('0x43')]['id']}})[_0x2b58('0x25')](handleEntityNotFound(_0xb4862,null))['then'](saveUpdates(_0x42aadf[_0x2b58('0x46')],null))[_0x2b58('0x25')](respondWithResult(_0xb4862,null))[_0x2b58('0x47')](handleError(_0xb4862,null));};exports[_0x2b58('0x26')]=function(_0x5afa77,_0x517663){return db[_0x2b58('0x2d')]['find']({'where':{'id':_0x5afa77[_0x2b58('0x43')]['id']}})[_0x2b58('0x25')](handleEntityNotFound(_0x517663,null))[_0x2b58('0x25')](removeEntity(_0x517663,null))[_0x2b58('0x47')](handleError(_0x517663,null));};exports['bulkDestroy']=function(_0x30442f,_0x5a4fa0){return db[_0x2b58('0x2d')][_0x2b58('0x26')]({'where':{'id':_0x30442f['query'][_0x2b58('0x49')]||[]},'raw':![],'individualHooks':!![]})[_0x2b58('0x25')](respondWithResult(_0x5a4fa0,0xcc))[_0x2b58('0x47')](handleError(_0x5a4fa0,null));};exports[_0x2b58('0x4a')]=function(_0x3eb9ff,_0x166797,_0x143bc0){return db[_0x2b58('0x4b')][_0x2b58('0x4c')]({'where':{'id':_0x3eb9ff[_0x2b58('0x43')]['id']}})['then'](handleEntityNotFound(_0x166797,null))[_0x2b58('0x25')](function(_0x2f31df){if(_0x2f31df){return db['sequelize']['transaction'](function(_0x1b89a6){return db['AnalyticFieldReport'][_0x2b58('0x26')]({'where':{'CustomReportId':_0x3eb9ff[_0x2b58('0x43')]['id']},'transaction':_0x1b89a6})['then'](function(_0x5abb73){var _0x3b9209=_[_0x2b58('0x2c')](_0x3eb9ff[_0x2b58('0x46')],function(_0x10c692){delete _0x10c692['id'];_0x10c692[_0x2b58('0x4d')]=_0x3eb9ff[_0x2b58('0x43')]['id'];return _0x10c692;});return db[_0x2b58('0x2d')][_0x2b58('0x48')](_0x3b9209,{'transaction':_0x1b89a6});});})['then'](function(){return db[_0x2b58('0x2d')][_0x2b58('0x41')]({'where':{'CustomReportId':_0x3eb9ff[_0x2b58('0x43')]['id']}});});}})['then'](respondWithResult(_0x166797,null))[_0x2b58('0x47')](handleError(_0x166797,null));}; \ No newline at end of file +var _0x1b89=['apply','save','update','destroy','error','send','index','map','AnalyticFieldReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','merge','VIRTUAL','name','options','where','then','include','findAll','catch','show','params','fields','includeAll','find','create','body','bulkCreate','bulkDestroy','ids','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','count'];(function(_0x3392df,_0x53b20f){var _0x3e5a91=function(_0xb90478){while(--_0xb90478){_0x3392df['push'](_0x3392df['shift']());}};_0x3e5a91(++_0x53b20f);}(_0x1b89,0xd4));var _0x91b8=function(_0x53b78f,_0x397490){_0x53b78f=_0x53b78f-0x0;var _0x2241a9=_0x1b89[_0x53b78f];return _0x2241a9;};'use strict';var emlformat=require(_0x91b8('0x0'));var rimraf=require(_0x91b8('0x1'));var zipdir=require(_0x91b8('0x2'));var jsonpatch=require(_0x91b8('0x3'));var rp=require('request-promise');var moment=require(_0x91b8('0x4'));var BPromise=require(_0x91b8('0x5'));var Mustache=require(_0x91b8('0x6'));var util=require(_0x91b8('0x7'));var path=require(_0x91b8('0x8'));var sox=require(_0x91b8('0x9'));var csv=require(_0x91b8('0xa'));var ejs=require(_0x91b8('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x91b8('0xc'));var crypto=require(_0x91b8('0xd'));var jsforce=require(_0x91b8('0xe'));var deskjs=require(_0x91b8('0xf'));var toCsv=require(_0x91b8('0xa'));var querystring=require(_0x91b8('0x10'));var Papa=require(_0x91b8('0x11'));var Redis=require(_0x91b8('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x91b8('0x13'));var as=require(_0x91b8('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x91b8('0x15'));var utils=require(_0x91b8('0x16'));var config=require(_0x91b8('0x17'));var licenseUtil=require(_0x91b8('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2b095f,_0x2cb198){_0x2cb198=_0x2cb198||0xcc;return function(_0x2d5e0f){if(_0x2d5e0f){return _0x2b095f[_0x91b8('0x19')](_0x2cb198);}return _0x2b095f[_0x91b8('0x1a')](_0x2cb198)[_0x91b8('0x1b')]();};}function respondWithResult(_0x5461e9,_0x291607){_0x291607=_0x291607||0xc8;return function(_0x12c107){if(_0x12c107){return _0x5461e9[_0x91b8('0x1a')](_0x291607)['json'](_0x12c107);}};}function respondWithFilteredResult(_0x4522e6,_0x1f7dff){return function(_0x16a4fb){if(_0x16a4fb){var _0x3b5b7e=typeof _0x1f7dff[_0x91b8('0x1c')]===_0x91b8('0x1d')&&typeof _0x1f7dff['limit']===_0x91b8('0x1d');var _0x34a60a=_0x16a4fb[_0x91b8('0x1e')];var _0x5e7e93=_0x3b5b7e?0x0:_0x1f7dff[_0x91b8('0x1c')];var _0x3f5881=_0x3b5b7e?_0x16a4fb[_0x91b8('0x1e')]:_0x1f7dff['offset']+_0x1f7dff['limit'];var _0x5eb50a;if(_0x3f5881>=_0x34a60a){_0x3f5881=_0x34a60a;_0x5eb50a=0xc8;}else{_0x5eb50a=0xce;}_0x4522e6[_0x91b8('0x1a')](_0x5eb50a);return _0x4522e6['set']('Content-Range',_0x5e7e93+'-'+_0x3f5881+'/'+_0x34a60a)['json'](_0x16a4fb);}return null;};}function patchUpdates(_0x50a20e){return function(_0x3b22b0){try{jsonpatch[_0x91b8('0x1f')](_0x3b22b0,_0x50a20e,!![]);}catch(_0x5c7195){return BPromise['reject'](_0x5c7195);}return _0x3b22b0[_0x91b8('0x20')]();};}function saveUpdates(_0x46f5f8,_0x191dd2){return function(_0x168644){if(_0x168644){return _0x168644[_0x91b8('0x21')](_0x46f5f8)['then'](function(_0x1e9a9f){return _0x1e9a9f;});}return null;};}function removeEntity(_0x1710b4,_0x41d557){return function(_0xe1d4e5){if(_0xe1d4e5){return _0xe1d4e5[_0x91b8('0x22')]()['then'](function(){_0x1710b4[_0x91b8('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f2129,_0x505430){return function(_0x14efb2){if(!_0x14efb2){_0x4f2129[_0x91b8('0x19')](0x194);}return _0x14efb2;};}function handleError(_0x5a6d3c,_0x26ff69){_0x26ff69=_0x26ff69||0x1f4;return function(_0x2e2d2d){logger[_0x91b8('0x23')](_0x2e2d2d['stack']);if(_0x2e2d2d['name']){delete _0x2e2d2d['name'];}_0x5a6d3c['status'](_0x26ff69)[_0x91b8('0x24')](_0x2e2d2d);};}exports[_0x91b8('0x25')]=function(_0x4fa69e,_0x3557e9){var _0x4114b2={},_0x3daa35={},_0x2d6570={'count':0x0,'rows':[]};var _0x498832=_[_0x91b8('0x26')](db[_0x91b8('0x27')][_0x91b8('0x28')],function(_0x5d0b8d){return{'name':_0x5d0b8d[_0x91b8('0x29')],'type':_0x5d0b8d[_0x91b8('0x2a')]['key']};});_0x3daa35[_0x91b8('0x2b')]=_[_0x91b8('0x26')](_0x498832,'name');_0x3daa35[_0x91b8('0x2c')]=_[_0x91b8('0x2d')](_0x4fa69e[_0x91b8('0x2c')]);_0x3daa35[_0x91b8('0x2e')]=_[_0x91b8('0x2f')](_0x3daa35[_0x91b8('0x2b')],_0x3daa35[_0x91b8('0x2c')]);_0x4114b2[_0x91b8('0x30')]=_[_0x91b8('0x2f')](_0x3daa35[_0x91b8('0x2b')],qs['fields'](_0x4fa69e[_0x91b8('0x2c')]['fields']));_0x4114b2[_0x91b8('0x30')]=_0x4114b2['attributes'][_0x91b8('0x31')]?_0x4114b2[_0x91b8('0x30')]:_0x3daa35[_0x91b8('0x2b')];if(!_0x4fa69e['query'][_0x91b8('0x32')](_0x91b8('0x33'))){_0x4114b2['limit']=qs[_0x91b8('0x34')](_0x4fa69e[_0x91b8('0x2c')][_0x91b8('0x34')]);_0x4114b2[_0x91b8('0x1c')]=qs[_0x91b8('0x1c')](_0x4fa69e[_0x91b8('0x2c')]['offset']);}_0x4114b2[_0x91b8('0x35')]=qs['sort'](_0x4fa69e['query'][_0x91b8('0x36')]);_0x4114b2['where']=qs[_0x91b8('0x2e')](_[_0x91b8('0x37')](_0x4fa69e['query'],_0x3daa35['filters']),_0x498832);if(_0x4fa69e['query'][_0x91b8('0x38')]){_0x4114b2['where']=_[_0x91b8('0x39')](_0x4114b2['where'],{'$or':_[_0x91b8('0x26')](_0x498832,function(_0x2dafc1){if(_0x2dafc1[_0x91b8('0x2a')]!==_0x91b8('0x3a')){var _0xa1b59e={};_0xa1b59e[_0x2dafc1[_0x91b8('0x3b')]]={'$like':'%'+_0x4fa69e[_0x91b8('0x2c')][_0x91b8('0x38')]+'%'};return _0xa1b59e;}})});}_0x4114b2=_[_0x91b8('0x39')]({},_0x4114b2,_0x4fa69e[_0x91b8('0x3c')]);var _0x162a3e={'where':_0x4114b2[_0x91b8('0x3d')]};return db[_0x91b8('0x27')][_0x91b8('0x1e')](_0x162a3e)[_0x91b8('0x3e')](function(_0x47b1db){_0x2d6570['count']=_0x47b1db;if(_0x4fa69e['query']['includeAll']){_0x4114b2[_0x91b8('0x3f')]=[{'all':!![]}];}return db[_0x91b8('0x27')][_0x91b8('0x40')](_0x4114b2);})[_0x91b8('0x3e')](function(_0x5afcdb){_0x2d6570['rows']=_0x5afcdb;return _0x2d6570;})[_0x91b8('0x3e')](respondWithFilteredResult(_0x3557e9,_0x4114b2))[_0x91b8('0x41')](handleError(_0x3557e9,null));};exports[_0x91b8('0x42')]=function(_0x5b3cfb,_0x2d7671){var _0x206bc6={'raw':![],'where':{'id':_0x5b3cfb[_0x91b8('0x43')]['id']}},_0x407b0e={};_0x407b0e[_0x91b8('0x2b')]=_[_0x91b8('0x2d')](db[_0x91b8('0x27')][_0x91b8('0x28')]);_0x407b0e[_0x91b8('0x2c')]=_[_0x91b8('0x2d')](_0x5b3cfb[_0x91b8('0x2c')]);_0x407b0e['filters']=_['intersection'](_0x407b0e['model'],_0x407b0e[_0x91b8('0x2c')]);_0x206bc6[_0x91b8('0x30')]=_['intersection'](_0x407b0e['model'],qs['fields'](_0x5b3cfb[_0x91b8('0x2c')][_0x91b8('0x44')]));_0x206bc6[_0x91b8('0x30')]=_0x206bc6[_0x91b8('0x30')]['length']?_0x206bc6['attributes']:_0x407b0e[_0x91b8('0x2b')];if(_0x5b3cfb['query'][_0x91b8('0x45')]){_0x206bc6['include']=[{'all':!![]}];}_0x206bc6=_[_0x91b8('0x39')]({},_0x206bc6,_0x5b3cfb[_0x91b8('0x3c')]);return db[_0x91b8('0x27')][_0x91b8('0x46')](_0x206bc6)[_0x91b8('0x3e')](handleEntityNotFound(_0x2d7671,null))[_0x91b8('0x3e')](respondWithResult(_0x2d7671,null))[_0x91b8('0x41')](handleError(_0x2d7671,null));};exports[_0x91b8('0x47')]=function(_0x16db68,_0x1c8e8c){return db[_0x91b8('0x27')][_0x91b8('0x47')](_0x16db68[_0x91b8('0x48')],{})[_0x91b8('0x3e')](respondWithResult(_0x1c8e8c,0xc9))[_0x91b8('0x41')](handleError(_0x1c8e8c,null));};exports[_0x91b8('0x49')]=function(_0x192469,_0x4b1419){return db[_0x91b8('0x27')]['bulkCreate'](_0x192469[_0x91b8('0x48')],{'raw':![],'individualHooks':!![]})[_0x91b8('0x3e')](respondWithResult(_0x4b1419,0xc9))[_0x91b8('0x41')](handleError(_0x4b1419,null));};exports['update']=function(_0x4b957c,_0x7c30e3){if(_0x4b957c['body']['id']){delete _0x4b957c['body']['id'];}return db[_0x91b8('0x27')][_0x91b8('0x46')]({'where':{'id':_0x4b957c[_0x91b8('0x43')]['id']}})[_0x91b8('0x3e')](handleEntityNotFound(_0x7c30e3,null))[_0x91b8('0x3e')](saveUpdates(_0x4b957c[_0x91b8('0x48')],null))['then'](respondWithResult(_0x7c30e3,null))['catch'](handleError(_0x7c30e3,null));};exports['destroy']=function(_0x471827,_0x5989bc){return db[_0x91b8('0x27')]['find']({'where':{'id':_0x471827['params']['id']}})[_0x91b8('0x3e')](handleEntityNotFound(_0x5989bc,null))[_0x91b8('0x3e')](removeEntity(_0x5989bc,null))[_0x91b8('0x41')](handleError(_0x5989bc,null));};exports[_0x91b8('0x4a')]=function(_0x1fe784,_0x1cb0f2){return db[_0x91b8('0x27')][_0x91b8('0x22')]({'where':{'id':_0x1fe784[_0x91b8('0x2c')][_0x91b8('0x4b')]||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x1cb0f2,0xcc))['catch'](handleError(_0x1cb0f2,null));};exports['addFields']=function(_0x1c5866,_0x7ff183,_0x5a63fc){return db[_0x91b8('0x4c')][_0x91b8('0x4d')]({'where':{'id':_0x1c5866[_0x91b8('0x43')]['id']}})[_0x91b8('0x3e')](handleEntityNotFound(_0x7ff183,null))[_0x91b8('0x3e')](function(_0x3d5272){if(_0x3d5272){return db[_0x91b8('0x4e')][_0x91b8('0x4f')](function(_0x4c24a0){return db[_0x91b8('0x27')][_0x91b8('0x22')]({'where':{'CustomReportId':_0x1c5866[_0x91b8('0x43')]['id']},'transaction':_0x4c24a0})['then'](function(_0x48821b){var _0x180631=_[_0x91b8('0x26')](_0x1c5866['body'],function(_0x400380){delete _0x400380['id'];_0x400380[_0x91b8('0x50')]=_0x1c5866[_0x91b8('0x43')]['id'];return _0x400380;});return db[_0x91b8('0x27')][_0x91b8('0x49')](_0x180631,{'transaction':_0x4c24a0});});})['then'](function(){return db[_0x91b8('0x27')][_0x91b8('0x40')]({'where':{'CustomReportId':_0x1c5866['params']['id']}});});}})[_0x91b8('0x3e')](respondWithResult(_0x7ff183,null))[_0x91b8('0x41')](handleError(_0x7ff183,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 2acec07..c5181e0 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 _0xd33f=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticFieldReport.attributes','define','AnalyticFieldReport','analytics_report_fields','lodash'];(function(_0x47ab40,_0x110b58){var _0x1b0a50=function(_0x3f0d4b){while(--_0x3f0d4b){_0x47ab40['push'](_0x47ab40['shift']());}};_0x1b0a50(++_0x110b58);}(_0xd33f,0x197));var _0xfd33=function(_0x375b13,_0x56813b){_0x375b13=_0x375b13-0x0;var _0x114f8f=_0xd33f[_0x375b13];return _0x114f8f;};'use strict';var _=require(_0xfd33('0x0'));var util=require('util');var logger=require(_0xfd33('0x1'))('api');var moment=require(_0xfd33('0x2'));var BPromise=require(_0xfd33('0x3'));var rp=require(_0xfd33('0x4'));var fs=require('fs');var path=require(_0xfd33('0x5'));var rimraf=require(_0xfd33('0x6'));var config=require(_0xfd33('0x7'));var attributes=require(_0xfd33('0x8'));module['exports']=function(_0x228aa5,_0x122eff){return _0x228aa5[_0xfd33('0x9')](_0xfd33('0xa'),attributes,{'tableName':_0xfd33('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8ae4=['exports','define','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./analyticFieldReport.attributes'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x8ae4,0x199));var _0x48ae=function(_0x519040,_0x297eeb){_0x519040=_0x519040-0x0;var _0x4a107b=_0x8ae4[_0x519040];return _0x4a107b;};'use strict';var _=require('lodash');var util=require(_0x48ae('0x0'));var logger=require(_0x48ae('0x1'))(_0x48ae('0x2'));var moment=require(_0x48ae('0x3'));var BPromise=require('bluebird');var rp=require(_0x48ae('0x4'));var fs=require('fs');var path=require(_0x48ae('0x5'));var rimraf=require(_0x48ae('0x6'));var config=require(_0x48ae('0x7'));var attributes=require(_0x48ae('0x8'));module[_0x48ae('0x9')]=function(_0x46037a,_0x5c5b6f){return _0x46037a[_0x48ae('0xa')]('AnalyticFieldReport',attributes,{'tableName':'analytics_report_fields','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 68707fc..1f1909b 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 _0x1818=['http','request','then','info','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','error','code','AnalyticFieldReport,\x20%s,\x20%s','message','result','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x1ce442,_0x52ab4e){var _0x3f9c63=function(_0x23edc1){while(--_0x23edc1){_0x1ce442['push'](_0x1ce442['shift']());}};_0x3f9c63(++_0x52ab4e);}(_0x1818,0x19b));var _0x8181=function(_0x1562a2,_0x2e4655){_0x1562a2=_0x1562a2-0x0;var _0x39a636=_0x1818[_0x1562a2];return _0x39a636;};'use strict';var _=require('lodash');var util=require(_0x8181('0x0'));var moment=require(_0x8181('0x1'));var BPromise=require(_0x8181('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8181('0x3'));var db=require(_0x8181('0x4'))['db'];var utils=require(_0x8181('0x5'));var logger=require(_0x8181('0x6'))(_0x8181('0x7'));var config=require(_0x8181('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8181('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x381fa4,_0x579bd9,_0x1b0ed4){return new BPromise(function(_0x5adb6d,_0x388ddd){return client[_0x8181('0xa')](_0x381fa4,_0x1b0ed4)[_0x8181('0xb')](function(_0x24ae7e){logger[_0x8181('0xc')]('AnalyticFieldReport,\x20%s,\x20%s',_0x579bd9,_0x8181('0xd'));logger[_0x8181('0xe')](_0x8181('0xf'),_0x579bd9,'request\x20sent',JSON['stringify'](_0x24ae7e));if(_0x24ae7e[_0x8181('0x10')]){if(_0x24ae7e[_0x8181('0x10')][_0x8181('0x11')]===0x1f4){logger[_0x8181('0x10')](_0x8181('0x12'),_0x579bd9,_0x24ae7e[_0x8181('0x10')]['message']);return _0x388ddd(_0x24ae7e[_0x8181('0x10')][_0x8181('0x13')]);}logger[_0x8181('0x10')]('AnalyticFieldReport,\x20%s,\x20%s',_0x579bd9,_0x24ae7e[_0x8181('0x10')][_0x8181('0x13')]);return _0x5adb6d(_0x24ae7e[_0x8181('0x10')]['message']);}else{logger[_0x8181('0xc')](_0x8181('0x12'),_0x579bd9,_0x8181('0xd'));_0x5adb6d(_0x24ae7e[_0x8181('0x14')]['message']);}})['catch'](function(_0x1ab70b){logger[_0x8181('0x10')](_0x8181('0x12'),_0x579bd9,_0x1ab70b);_0x388ddd(_0x1ab70b);});});} \ No newline at end of file +var _0x9f39=['rpc','jayson/promise','client','http','request','then','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','AnalyticFieldReport,\x20%s,\x20%s','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0xa5302,_0x356b3c){var _0x45dc96=function(_0x390c6d){while(--_0x390c6d){_0xa5302['push'](_0xa5302['shift']());}};_0x45dc96(++_0x356b3c);}(_0x9f39,0x181));var _0x99f3=function(_0x20cfe8,_0x2c0b5b){_0x20cfe8=_0x20cfe8-0x0;var _0x3c4d66=_0x9f39[_0x20cfe8];return _0x3c4d66;};'use strict';var _=require(_0x99f3('0x0'));var util=require(_0x99f3('0x1'));var moment=require(_0x99f3('0x2'));var BPromise=require('bluebird');var rs=require(_0x99f3('0x3'));var fs=require('fs');var Redis=require(_0x99f3('0x4'));var db=require(_0x99f3('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x99f3('0x6'));var config=require('../../config/environment');var jayson=require(_0x99f3('0x7'));var client=jayson[_0x99f3('0x8')][_0x99f3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x12ab8e,_0x143a47,_0x2f77e5){return new BPromise(function(_0x3244d0,_0x1e601a){return client[_0x99f3('0xa')](_0x12ab8e,_0x2f77e5)[_0x99f3('0xb')](function(_0x29ea88){logger['info']('AnalyticFieldReport,\x20%s,\x20%s',_0x143a47,_0x99f3('0xc'));logger[_0x99f3('0xd')](_0x99f3('0xe'),_0x143a47,_0x99f3('0xc'),JSON[_0x99f3('0xf')](_0x29ea88));if(_0x29ea88['error']){if(_0x29ea88['error'][_0x99f3('0x10')]===0x1f4){logger[_0x99f3('0x11')]('AnalyticFieldReport,\x20%s,\x20%s',_0x143a47,_0x29ea88['error'][_0x99f3('0x12')]);return _0x1e601a(_0x29ea88[_0x99f3('0x11')]['message']);}logger[_0x99f3('0x11')](_0x99f3('0x13'),_0x143a47,_0x29ea88['error'][_0x99f3('0x12')]);return _0x3244d0(_0x29ea88['error'][_0x99f3('0x12')]);}else{logger[_0x99f3('0x14')](_0x99f3('0x13'),_0x143a47,'request\x20sent');_0x3244d0(_0x29ea88[_0x99f3('0x15')][_0x99f3('0x12')]);}})[_0x99f3('0x16')](function(_0x3d3df8){logger['error'](_0x99f3('0x13'),_0x143a47,_0x3d3df8);_0x1e601a(_0x3d3df8);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index d47230c..7db6517 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(_0x20efe3,_0x48ad9f){var _0xa8aa36=function(_0x590de8){while(--_0x590de8){_0x20efe3['push'](_0x20efe3['shift']());}};_0xa8aa36(++_0x48ad9f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0xa9e0[_0x3899d1];return _0xeb4a7d;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('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(_0x50c11b,_0x848d6f){var _0x46d2d0=function(_0x18061c){while(--_0x18061c){_0x50c11b['push'](_0x50c11b['shift']());}};_0x46d2d0(++_0x848d6f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xa9e0[_0x2a6809];return _0x11c371;};'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 2c1acfa..aeab067 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 _0x76bc=['exports','STRING','name','sequelize'];(function(_0x171fdc,_0x16ae91){var _0x3782ea=function(_0x58b691){while(--_0x58b691){_0x171fdc['push'](_0x171fdc['shift']());}};_0x3782ea(++_0x16ae91);}(_0x76bc,0x17f));var _0xc76b=function(_0x1f8053,_0x111077){_0x1f8053=_0x1f8053-0x0;var _0x174fd8=_0x76bc[_0x1f8053];return _0x174fd8;};'use strict';var Sequelize=require(_0xc76b('0x0'));module[_0xc76b('0x1')]={'name':{'type':Sequelize[_0xc76b('0x2')],'allowNull':![],'unique':_0xc76b('0x3')},'table':{'type':Sequelize[_0xc76b('0x2')]},'metric':{'type':Sequelize['TEXT']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd136=['TEXT','exports','STRING'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xd136,0x94));var _0x6d13=function(_0xc3cd30,_0x49fce6){_0xc3cd30=_0xc3cd30-0x0;var _0x87cfdb=_0xd136[_0xc3cd30];return _0x87cfdb;};'use strict';var Sequelize=require('sequelize');module[_0x6d13('0x0')]={'name':{'type':Sequelize[_0x6d13('0x1')],'allowNull':![],'unique':'name'},'table':{'type':Sequelize[_0x6d13('0x1')]},'metric':{'type':Sequelize[_0x6d13('0x2')]},'description':{'type':Sequelize[_0x6d13('0x1')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 9b282aa..bfcbdd8 100644 --- a/server/api/analyticMetric/analyticMetric.controller.js +++ b/server/api/analyticMetric/analyticMetric.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c5a=['update','then','get','Metrics','UserProfileResource','destroy','error','stack','name','send','AnalyticMetric','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','length','include','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','body','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','save'];(function(_0x5182bd,_0xff8120){var _0x3b902d=function(_0x7fdcbc){while(--_0x7fdcbc){_0x5182bd['push'](_0x5182bd['shift']());}};_0x3b902d(++_0xff8120);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x5c600b,_0x24a29d){_0x5c600b=_0x5c600b-0x0;var _0x4df353=_0x9c5a[_0x5c600b];return _0x4df353;};'use strict';var emlformat=require(_0xa9c5('0x0'));var rimraf=require(_0xa9c5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa9c5('0x2'));var rp=require(_0xa9c5('0x3'));var moment=require(_0xa9c5('0x4'));var BPromise=require(_0xa9c5('0x5'));var Mustache=require('mustache');var util=require(_0xa9c5('0x6'));var path=require(_0xa9c5('0x7'));var sox=require('sox');var csv=require(_0xa9c5('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa9c5('0x9'));var _=require(_0xa9c5('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa9c5('0xb'));var deskjs=require(_0xa9c5('0xc'));var toCsv=require('to-csv');var querystring=require(_0xa9c5('0xd'));var Papa=require(_0xa9c5('0xe'));var Redis=require('ioredis');var authService=require(_0xa9c5('0xf'));var qs=require(_0xa9c5('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xa9c5('0x11'))(_0xa9c5('0x12'));var utils=require(_0xa9c5('0x13'));var config=require(_0xa9c5('0x14'));var licenseUtil=require(_0xa9c5('0x15'));var db=require(_0xa9c5('0x16'))['db'];function respondWithStatusCode(_0x51c8d,_0x42d5cf){_0x42d5cf=_0x42d5cf||0xcc;return function(_0x3c5ac7){if(_0x3c5ac7){return _0x51c8d[_0xa9c5('0x17')](_0x42d5cf);}return _0x51c8d['status'](_0x42d5cf)[_0xa9c5('0x18')]();};}function respondWithResult(_0x1276d2,_0x7df76d){_0x7df76d=_0x7df76d||0xc8;return function(_0x3806c4){if(_0x3806c4){return _0x1276d2[_0xa9c5('0x19')](_0x7df76d)[_0xa9c5('0x1a')](_0x3806c4);}};}function respondWithFilteredResult(_0x251099,_0x40b001){return function(_0x19a43e){if(_0x19a43e){var _0xcf13f2=typeof _0x40b001['offset']===_0xa9c5('0x1b')&&typeof _0x40b001[_0xa9c5('0x1c')]===_0xa9c5('0x1b');var _0x55cce5=_0x19a43e[_0xa9c5('0x1d')];var _0x1142d9=_0xcf13f2?0x0:_0x40b001[_0xa9c5('0x1e')];var _0x3b8cf7=_0xcf13f2?_0x19a43e[_0xa9c5('0x1d')]:_0x40b001[_0xa9c5('0x1e')]+_0x40b001[_0xa9c5('0x1c')];var _0x1e5ce6;if(_0x3b8cf7>=_0x55cce5){_0x3b8cf7=_0x55cce5;_0x1e5ce6=0xc8;}else{_0x1e5ce6=0xce;}_0x251099[_0xa9c5('0x19')](_0x1e5ce6);return _0x251099[_0xa9c5('0x1f')](_0xa9c5('0x20'),_0x1142d9+'-'+_0x3b8cf7+'/'+_0x55cce5)[_0xa9c5('0x1a')](_0x19a43e);}return null;};}function patchUpdates(_0x54f8b9){return function(_0x1115ad){try{jsonpatch[_0xa9c5('0x21')](_0x1115ad,_0x54f8b9,!![]);}catch(_0x541c77){return BPromise['reject'](_0x541c77);}return _0x1115ad[_0xa9c5('0x22')]();};}function saveUpdates(_0x366f5c,_0x10b208){return function(_0x3b497a){if(_0x3b497a){return _0x3b497a[_0xa9c5('0x23')](_0x366f5c)[_0xa9c5('0x24')](function(_0x48e2cb){return _0x48e2cb;});}return null;};}function removeEntity(_0x4fa280,_0x3d4e1b){return function(_0x11d395){if(_0x11d395){return _0x11d395['destroy']()[_0xa9c5('0x24')](function(){var _0x424b4c=_0x11d395[_0xa9c5('0x25')]({'plain':!![]});var _0x32fc7d=_0xa9c5('0x26');return db[_0xa9c5('0x27')][_0xa9c5('0x28')]({'where':{'type':_0x32fc7d,'resourceId':_0x424b4c['id']}})['then'](function(){return _0x11d395;});})['then'](function(){_0x4fa280[_0xa9c5('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1762ac,_0x830bad){return function(_0x4caefa){if(!_0x4caefa){_0x1762ac[_0xa9c5('0x17')](0x194);}return _0x4caefa;};}function handleError(_0x320dc0,_0x5f468b){_0x5f468b=_0x5f468b||0x1f4;return function(_0x413edf){logger[_0xa9c5('0x29')](_0x413edf[_0xa9c5('0x2a')]);if(_0x413edf[_0xa9c5('0x2b')]){delete _0x413edf[_0xa9c5('0x2b')];}_0x320dc0['status'](_0x5f468b)[_0xa9c5('0x2c')](_0x413edf);};}exports['index']=function(_0x3c3da7,_0x1ef388){var _0x2eeed1={},_0x541475={},_0xc6d0c1={'count':0x0,'rows':[]};var _0xbe29c5=_['map'](db[_0xa9c5('0x2d')][_0xa9c5('0x2e')],function(_0x431e07){return{'name':_0x431e07[_0xa9c5('0x2f')],'type':_0x431e07[_0xa9c5('0x30')][_0xa9c5('0x31')]};});_0x541475[_0xa9c5('0x32')]=_['map'](_0xbe29c5,_0xa9c5('0x2b'));_0x541475[_0xa9c5('0x33')]=_[_0xa9c5('0x34')](_0x3c3da7[_0xa9c5('0x33')]);_0x541475[_0xa9c5('0x35')]=_[_0xa9c5('0x36')](_0x541475[_0xa9c5('0x32')],_0x541475[_0xa9c5('0x33')]);_0x2eeed1['attributes']=_['intersection'](_0x541475[_0xa9c5('0x32')],qs[_0xa9c5('0x37')](_0x3c3da7[_0xa9c5('0x33')][_0xa9c5('0x37')]));_0x2eeed1[_0xa9c5('0x38')]=_0x2eeed1[_0xa9c5('0x38')]['length']?_0x2eeed1['attributes']:_0x541475['model'];if(!_0x3c3da7[_0xa9c5('0x33')][_0xa9c5('0x39')]('nolimit')){_0x2eeed1[_0xa9c5('0x1c')]=qs['limit'](_0x3c3da7[_0xa9c5('0x33')][_0xa9c5('0x1c')]);_0x2eeed1[_0xa9c5('0x1e')]=qs[_0xa9c5('0x1e')](_0x3c3da7['query'][_0xa9c5('0x1e')]);}_0x2eeed1[_0xa9c5('0x3a')]=qs[_0xa9c5('0x3b')](_0x3c3da7[_0xa9c5('0x33')][_0xa9c5('0x3b')]);_0x2eeed1[_0xa9c5('0x3c')]=qs[_0xa9c5('0x35')](_[_0xa9c5('0x3d')](_0x3c3da7['query'],_0x541475[_0xa9c5('0x35')]),_0xbe29c5);if(_0x3c3da7[_0xa9c5('0x33')][_0xa9c5('0x3e')]){_0x2eeed1[_0xa9c5('0x3c')]=_[_0xa9c5('0x3f')](_0x2eeed1[_0xa9c5('0x3c')],{'$or':_['map'](_0xbe29c5,function(_0x307736){if(_0x307736['type']!==_0xa9c5('0x40')){var _0x5c89e7={};_0x5c89e7[_0x307736[_0xa9c5('0x2b')]]={'$like':'%'+_0x3c3da7[_0xa9c5('0x33')][_0xa9c5('0x3e')]+'%'};return _0x5c89e7;}})});}_0x2eeed1=_['merge']({},_0x2eeed1,_0x3c3da7[_0xa9c5('0x41')]);var _0x1ddd72={'where':_0x2eeed1[_0xa9c5('0x3c')]};return db[_0xa9c5('0x2d')]['count'](_0x1ddd72)[_0xa9c5('0x24')](function(_0x97803f){_0xc6d0c1[_0xa9c5('0x1d')]=_0x97803f;if(_0x3c3da7[_0xa9c5('0x33')][_0xa9c5('0x42')]){_0x2eeed1['include']=[{'all':!![]}];}return db[_0xa9c5('0x2d')]['findAll'](_0x2eeed1);})[_0xa9c5('0x24')](function(_0x397614){_0xc6d0c1[_0xa9c5('0x43')]=_0x397614;return _0xc6d0c1;})[_0xa9c5('0x24')](respondWithFilteredResult(_0x1ef388,_0x2eeed1))[_0xa9c5('0x44')](handleError(_0x1ef388,null));};exports[_0xa9c5('0x45')]=function(_0xf35cb3,_0x3e8633){var _0x1f895a={'raw':!![],'where':{'id':_0xf35cb3['params']['id']}},_0xc28b1a={};_0xc28b1a[_0xa9c5('0x32')]=_[_0xa9c5('0x34')](db[_0xa9c5('0x2d')][_0xa9c5('0x2e')]);_0xc28b1a[_0xa9c5('0x33')]=_[_0xa9c5('0x34')](_0xf35cb3['query']);_0xc28b1a[_0xa9c5('0x35')]=_[_0xa9c5('0x36')](_0xc28b1a['model'],_0xc28b1a['query']);_0x1f895a['attributes']=_['intersection'](_0xc28b1a['model'],qs[_0xa9c5('0x37')](_0xf35cb3[_0xa9c5('0x33')][_0xa9c5('0x37')]));_0x1f895a[_0xa9c5('0x38')]=_0x1f895a[_0xa9c5('0x38')][_0xa9c5('0x46')]?_0x1f895a[_0xa9c5('0x38')]:_0xc28b1a[_0xa9c5('0x32')];if(_0xf35cb3[_0xa9c5('0x33')][_0xa9c5('0x42')]){_0x1f895a[_0xa9c5('0x47')]=[{'all':!![]}];}_0x1f895a=_[_0xa9c5('0x3f')]({},_0x1f895a,_0xf35cb3[_0xa9c5('0x41')]);return db['AnalyticMetric'][_0xa9c5('0x48')](_0x1f895a)['then'](handleEntityNotFound(_0x3e8633,null))[_0xa9c5('0x24')](respondWithResult(_0x3e8633,null))[_0xa9c5('0x44')](handleError(_0x3e8633,null));};exports['create']=function(_0x5cbd33,_0xf00970){return db[_0xa9c5('0x2d')][_0xa9c5('0x49')](_0x5cbd33['body'],{})['then'](function(_0x2333c4){var _0xd03cec=_0x5cbd33['user'][_0xa9c5('0x25')]({'plain':!![]});if(!_0xd03cec)throw new Error(_0xa9c5('0x4a'));if(_0xd03cec[_0xa9c5('0x4b')]===_0xa9c5('0x4c')){var _0x34020f=_0x2333c4[_0xa9c5('0x25')]({'plain':!![]});var _0x4b6fc9='Metrics';return db['UserProfileSection'][_0xa9c5('0x48')]({'where':{'name':_0x4b6fc9,'userProfileId':_0xd03cec[_0xa9c5('0x4d')]},'raw':!![]})[_0xa9c5('0x24')](function(_0xef4d2){if(_0xef4d2&&_0xef4d2[_0xa9c5('0x4e')]===0x0){return db[_0xa9c5('0x27')]['create']({'name':_0x34020f[_0xa9c5('0x2b')],'resourceId':_0x34020f['id'],'type':_0xef4d2[_0xa9c5('0x2b')],'sectionId':_0xef4d2['id']},{})[_0xa9c5('0x24')](function(){return _0x2333c4;});}else{return _0x2333c4;}})[_0xa9c5('0x44')](function(_0xa0b458){logger[_0xa9c5('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xa0b458);throw _0xa0b458;});}return _0x2333c4;})['then'](respondWithResult(_0xf00970,0xc9))[_0xa9c5('0x44')](handleError(_0xf00970,null));};exports['update']=function(_0x1b158f,_0x5ea9b0){if(_0x1b158f[_0xa9c5('0x4f')]['id']){delete _0x1b158f[_0xa9c5('0x4f')]['id'];}return db[_0xa9c5('0x2d')]['find']({'where':{'id':_0x1b158f[_0xa9c5('0x50')]['id']}})[_0xa9c5('0x24')](handleEntityNotFound(_0x5ea9b0,null))[_0xa9c5('0x24')](saveUpdates(_0x1b158f[_0xa9c5('0x4f')],null))['then'](respondWithResult(_0x5ea9b0,null))['catch'](handleError(_0x5ea9b0,null));};exports[_0xa9c5('0x28')]=function(_0x2b66ee,_0x3205f2){return db['AnalyticMetric'][_0xa9c5('0x48')]({'where':{'id':_0x2b66ee[_0xa9c5('0x50')]['id']}})[_0xa9c5('0x24')](handleEntityNotFound(_0x3205f2,null))[_0xa9c5('0x24')](removeEntity(_0x3205f2,null))[_0xa9c5('0x44')](handleError(_0x3205f2,null));}; \ No newline at end of file +var _0x8d0e=['then','get','Metrics','UserProfileResource','end','sendStatus','error','stack','name','send','AnalyticMetric','fieldName','type','key','model','query','keys','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','rawAttributes','fields','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','limit','offset','count','set','apply','reject','save','update','destroy'];(function(_0x27fdcc,_0x421cb5){var _0x17c2de=function(_0x2fa372){while(--_0x2fa372){_0x27fdcc['push'](_0x27fdcc['shift']());}};_0x17c2de(++_0x421cb5);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x5833aa,_0x2cc4b1){_0x5833aa=_0x5833aa-0x0;var _0x3a76cd=_0x8d0e[_0x5833aa];return _0x3a76cd;};'use strict';var emlformat=require(_0xe8d0('0x0'));var rimraf=require(_0xe8d0('0x1'));var zipdir=require(_0xe8d0('0x2'));var jsonpatch=require(_0xe8d0('0x3'));var rp=require(_0xe8d0('0x4'));var moment=require(_0xe8d0('0x5'));var BPromise=require(_0xe8d0('0x6'));var Mustache=require(_0xe8d0('0x7'));var util=require(_0xe8d0('0x8'));var path=require('path');var sox=require(_0xe8d0('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe8d0('0xa'));var _=require(_0xe8d0('0xb'));var squel=require(_0xe8d0('0xc'));var crypto=require(_0xe8d0('0xd'));var jsforce=require(_0xe8d0('0xe'));var deskjs=require(_0xe8d0('0xf'));var toCsv=require(_0xe8d0('0x10'));var querystring=require(_0xe8d0('0x11'));var Papa=require('papaparse');var Redis=require(_0xe8d0('0x12'));var authService=require(_0xe8d0('0x13'));var qs=require(_0xe8d0('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe8d0('0x15'))(_0xe8d0('0x16'));var utils=require(_0xe8d0('0x17'));var config=require(_0xe8d0('0x18'));var licenseUtil=require(_0xe8d0('0x19'));var db=require(_0xe8d0('0x1a'))['db'];function respondWithStatusCode(_0x5934b2,_0x38fac0){_0x38fac0=_0x38fac0||0xcc;return function(_0x15b9e5){if(_0x15b9e5){return _0x5934b2['sendStatus'](_0x38fac0);}return _0x5934b2[_0xe8d0('0x1b')](_0x38fac0)['end']();};}function respondWithResult(_0x59b4b7,_0x90a1ea){_0x90a1ea=_0x90a1ea||0xc8;return function(_0x2aa906){if(_0x2aa906){return _0x59b4b7[_0xe8d0('0x1b')](_0x90a1ea)[_0xe8d0('0x1c')](_0x2aa906);}};}function respondWithFilteredResult(_0x15d3a1,_0x7151c6){return function(_0x52818a){if(_0x52818a){var _0x6ccffa=typeof _0x7151c6['offset']===_0xe8d0('0x1d')&&typeof _0x7151c6[_0xe8d0('0x1e')]===_0xe8d0('0x1d');var _0x4d1db4=_0x52818a['count'];var _0x47c67a=_0x6ccffa?0x0:_0x7151c6[_0xe8d0('0x1f')];var _0x384854=_0x6ccffa?_0x52818a[_0xe8d0('0x20')]:_0x7151c6[_0xe8d0('0x1f')]+_0x7151c6[_0xe8d0('0x1e')];var _0x588133;if(_0x384854>=_0x4d1db4){_0x384854=_0x4d1db4;_0x588133=0xc8;}else{_0x588133=0xce;}_0x15d3a1[_0xe8d0('0x1b')](_0x588133);return _0x15d3a1[_0xe8d0('0x21')]('Content-Range',_0x47c67a+'-'+_0x384854+'/'+_0x4d1db4)['json'](_0x52818a);}return null;};}function patchUpdates(_0x554402){return function(_0x384a60){try{jsonpatch[_0xe8d0('0x22')](_0x384a60,_0x554402,!![]);}catch(_0x25363b){return BPromise[_0xe8d0('0x23')](_0x25363b);}return _0x384a60[_0xe8d0('0x24')]();};}function saveUpdates(_0x23a945,_0x1bd25c){return function(_0x28a6b5){if(_0x28a6b5){return _0x28a6b5[_0xe8d0('0x25')](_0x23a945)['then'](function(_0xed8f2e){return _0xed8f2e;});}return null;};}function removeEntity(_0x9f747,_0x572c25){return function(_0x106614){if(_0x106614){return _0x106614[_0xe8d0('0x26')]()[_0xe8d0('0x27')](function(){var _0xd86c76=_0x106614[_0xe8d0('0x28')]({'plain':!![]});var _0x149dfd=_0xe8d0('0x29');return db[_0xe8d0('0x2a')][_0xe8d0('0x26')]({'where':{'type':_0x149dfd,'resourceId':_0xd86c76['id']}})[_0xe8d0('0x27')](function(){return _0x106614;});})[_0xe8d0('0x27')](function(){_0x9f747['status'](0xcc)[_0xe8d0('0x2b')]();});}};}function handleEntityNotFound(_0x26dd52,_0x10dec2){return function(_0x486f49){if(!_0x486f49){_0x26dd52[_0xe8d0('0x2c')](0x194);}return _0x486f49;};}function handleError(_0x343b08,_0x526240){_0x526240=_0x526240||0x1f4;return function(_0x1519e2){logger[_0xe8d0('0x2d')](_0x1519e2[_0xe8d0('0x2e')]);if(_0x1519e2[_0xe8d0('0x2f')]){delete _0x1519e2[_0xe8d0('0x2f')];}_0x343b08['status'](_0x526240)[_0xe8d0('0x30')](_0x1519e2);};}exports['index']=function(_0x5d3276,_0x50ad3c){var _0x547a2b={},_0x13cd4c={},_0x36ccec={'count':0x0,'rows':[]};var _0x5151fa=_['map'](db[_0xe8d0('0x31')]['rawAttributes'],function(_0x3b5d31){return{'name':_0x3b5d31[_0xe8d0('0x32')],'type':_0x3b5d31[_0xe8d0('0x33')][_0xe8d0('0x34')]};});_0x13cd4c[_0xe8d0('0x35')]=_['map'](_0x5151fa,_0xe8d0('0x2f'));_0x13cd4c[_0xe8d0('0x36')]=_[_0xe8d0('0x37')](_0x5d3276[_0xe8d0('0x36')]);_0x13cd4c['filters']=_[_0xe8d0('0x38')](_0x13cd4c[_0xe8d0('0x35')],_0x13cd4c['query']);_0x547a2b[_0xe8d0('0x39')]=_['intersection'](_0x13cd4c[_0xe8d0('0x35')],qs['fields'](_0x5d3276[_0xe8d0('0x36')]['fields']));_0x547a2b[_0xe8d0('0x39')]=_0x547a2b[_0xe8d0('0x39')][_0xe8d0('0x3a')]?_0x547a2b[_0xe8d0('0x39')]:_0x13cd4c['model'];if(!_0x5d3276[_0xe8d0('0x36')][_0xe8d0('0x3b')](_0xe8d0('0x3c'))){_0x547a2b['limit']=qs[_0xe8d0('0x1e')](_0x5d3276[_0xe8d0('0x36')][_0xe8d0('0x1e')]);_0x547a2b[_0xe8d0('0x1f')]=qs[_0xe8d0('0x1f')](_0x5d3276['query'][_0xe8d0('0x1f')]);}_0x547a2b[_0xe8d0('0x3d')]=qs[_0xe8d0('0x3e')](_0x5d3276[_0xe8d0('0x36')][_0xe8d0('0x3e')]);_0x547a2b[_0xe8d0('0x3f')]=qs[_0xe8d0('0x40')](_[_0xe8d0('0x41')](_0x5d3276['query'],_0x13cd4c['filters']),_0x5151fa);if(_0x5d3276[_0xe8d0('0x36')][_0xe8d0('0x42')]){_0x547a2b[_0xe8d0('0x3f')]=_[_0xe8d0('0x43')](_0x547a2b[_0xe8d0('0x3f')],{'$or':_['map'](_0x5151fa,function(_0x2e4362){if(_0x2e4362['type']!==_0xe8d0('0x44')){var _0x458294={};_0x458294[_0x2e4362[_0xe8d0('0x2f')]]={'$like':'%'+_0x5d3276['query'][_0xe8d0('0x42')]+'%'};return _0x458294;}})});}_0x547a2b=_[_0xe8d0('0x43')]({},_0x547a2b,_0x5d3276[_0xe8d0('0x45')]);var _0x230a90={'where':_0x547a2b[_0xe8d0('0x3f')]};return db['AnalyticMetric']['count'](_0x230a90)['then'](function(_0x4cf0da){_0x36ccec[_0xe8d0('0x20')]=_0x4cf0da;if(_0x5d3276['query'][_0xe8d0('0x46')]){_0x547a2b[_0xe8d0('0x47')]=[{'all':!![]}];}return db[_0xe8d0('0x31')][_0xe8d0('0x48')](_0x547a2b);})[_0xe8d0('0x27')](function(_0x1156da){_0x36ccec[_0xe8d0('0x49')]=_0x1156da;return _0x36ccec;})[_0xe8d0('0x27')](respondWithFilteredResult(_0x50ad3c,_0x547a2b))['catch'](handleError(_0x50ad3c,null));};exports[_0xe8d0('0x4a')]=function(_0x1da8b2,_0x4a3740){var _0x4bcdff={'raw':!![],'where':{'id':_0x1da8b2[_0xe8d0('0x4b')]['id']}},_0x3825a1={};_0x3825a1[_0xe8d0('0x35')]=_['keys'](db[_0xe8d0('0x31')][_0xe8d0('0x4c')]);_0x3825a1['query']=_[_0xe8d0('0x37')](_0x1da8b2[_0xe8d0('0x36')]);_0x3825a1['filters']=_[_0xe8d0('0x38')](_0x3825a1[_0xe8d0('0x35')],_0x3825a1[_0xe8d0('0x36')]);_0x4bcdff[_0xe8d0('0x39')]=_[_0xe8d0('0x38')](_0x3825a1[_0xe8d0('0x35')],qs[_0xe8d0('0x4d')](_0x1da8b2[_0xe8d0('0x36')]['fields']));_0x4bcdff[_0xe8d0('0x39')]=_0x4bcdff[_0xe8d0('0x39')][_0xe8d0('0x3a')]?_0x4bcdff[_0xe8d0('0x39')]:_0x3825a1[_0xe8d0('0x35')];if(_0x1da8b2[_0xe8d0('0x36')][_0xe8d0('0x46')]){_0x4bcdff[_0xe8d0('0x47')]=[{'all':!![]}];}_0x4bcdff=_[_0xe8d0('0x43')]({},_0x4bcdff,_0x1da8b2[_0xe8d0('0x45')]);return db[_0xe8d0('0x31')][_0xe8d0('0x4e')](_0x4bcdff)['then'](handleEntityNotFound(_0x4a3740,null))[_0xe8d0('0x27')](respondWithResult(_0x4a3740,null))[_0xe8d0('0x4f')](handleError(_0x4a3740,null));};exports[_0xe8d0('0x50')]=function(_0xad7d94,_0x34047c){return db[_0xe8d0('0x31')][_0xe8d0('0x50')](_0xad7d94['body'],{})[_0xe8d0('0x27')](function(_0x424764){var _0x151cf4=_0xad7d94[_0xe8d0('0x51')]['get']({'plain':!![]});if(!_0x151cf4)throw new Error(_0xe8d0('0x52'));if(_0x151cf4['role']===_0xe8d0('0x51')){var _0x382ae9=_0x424764[_0xe8d0('0x28')]({'plain':!![]});var _0x158d24=_0xe8d0('0x29');return db[_0xe8d0('0x53')][_0xe8d0('0x4e')]({'where':{'name':_0x158d24,'userProfileId':_0x151cf4['userProfileId']},'raw':!![]})[_0xe8d0('0x27')](function(_0x55f93d){if(_0x55f93d&&_0x55f93d['autoAssociation']===0x0){return db[_0xe8d0('0x2a')]['create']({'name':_0x382ae9[_0xe8d0('0x2f')],'resourceId':_0x382ae9['id'],'type':_0x55f93d['name'],'sectionId':_0x55f93d['id']},{})[_0xe8d0('0x27')](function(){return _0x424764;});}else{return _0x424764;}})[_0xe8d0('0x4f')](function(_0x13713c){logger[_0xe8d0('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x13713c);throw _0x13713c;});}return _0x424764;})[_0xe8d0('0x27')](respondWithResult(_0x34047c,0xc9))[_0xe8d0('0x4f')](handleError(_0x34047c,null));};exports[_0xe8d0('0x25')]=function(_0x2e3f1d,_0x18cc14){if(_0x2e3f1d['body']['id']){delete _0x2e3f1d[_0xe8d0('0x54')]['id'];}return db[_0xe8d0('0x31')][_0xe8d0('0x4e')]({'where':{'id':_0x2e3f1d['params']['id']}})[_0xe8d0('0x27')](handleEntityNotFound(_0x18cc14,null))['then'](saveUpdates(_0x2e3f1d['body'],null))[_0xe8d0('0x27')](respondWithResult(_0x18cc14,null))[_0xe8d0('0x4f')](handleError(_0x18cc14,null));};exports['destroy']=function(_0xcb6ce2,_0x3a8074){return db['AnalyticMetric'][_0xe8d0('0x4e')]({'where':{'id':_0xcb6ce2[_0xe8d0('0x4b')]['id']}})[_0xe8d0('0x27')](handleEntityNotFound(_0x3a8074,null))[_0xe8d0('0x27')](removeEntity(_0x3a8074,null))['catch'](handleError(_0x3a8074,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 418b57b..da61479 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 _0x0a6b=['request-promise','path','rimraf','./analyticMetric.attributes','AnalyticMetric','analytics_metrics','lodash','moment'];(function(_0x5f6c8e,_0x4b240a){var _0x5c5e16=function(_0x32a063){while(--_0x32a063){_0x5f6c8e['push'](_0x5f6c8e['shift']());}};_0x5c5e16(++_0x4b240a);}(_0x0a6b,0x18e));var _0xb0a6=function(_0x189305,_0x46c43f){_0x189305=_0x189305-0x0;var _0xea3406=_0x0a6b[_0x189305];return _0xea3406;};'use strict';var _=require(_0xb0a6('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xb0a6('0x1'));var BPromise=require('bluebird');var rp=require(_0xb0a6('0x2'));var fs=require('fs');var path=require(_0xb0a6('0x3'));var rimraf=require(_0xb0a6('0x4'));var config=require('../../config/environment');var attributes=require(_0xb0a6('0x5'));module['exports']=function(_0xbbdf89,_0x415e9e){return _0xbbdf89['define'](_0xb0a6('0x6'),attributes,{'tableName':_0xb0a6('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc029=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticMetric.attributes','exports','define','AnalyticMetric','analytics_metrics','lodash'];(function(_0x5d370a,_0x55fa3f){var _0x3777a0=function(_0x9c9467){while(--_0x9c9467){_0x5d370a['push'](_0x5d370a['shift']());}};_0x3777a0(++_0x55fa3f);}(_0xc029,0x1df));var _0x9c02=function(_0x242d17,_0x30a922){_0x242d17=_0x242d17-0x0;var _0x501a6d=_0xc029[_0x242d17];return _0x501a6d;};'use strict';var _=require(_0x9c02('0x0'));var util=require(_0x9c02('0x1'));var logger=require(_0x9c02('0x2'))(_0x9c02('0x3'));var moment=require(_0x9c02('0x4'));var BPromise=require(_0x9c02('0x5'));var rp=require(_0x9c02('0x6'));var fs=require('fs');var path=require(_0x9c02('0x7'));var rimraf=require(_0x9c02('0x8'));var config=require(_0x9c02('0x9'));var attributes=require(_0x9c02('0xa'));module[_0x9c02('0xb')]=function(_0x18792d,_0x14c7f8){return _0x18792d[_0x9c02('0xc')](_0x9c02('0xd'),attributes,{'tableName':_0x9c02('0xe'),'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 507e46c..0128c58 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 _0xc9f7=['client','http','request','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x3ec1da,_0x1e36f5){var _0x472358=function(_0x1d41b1){while(--_0x1d41b1){_0x3ec1da['push'](_0x3ec1da['shift']());}};_0x472358(++_0x1e36f5);}(_0xc9f7,0xfd));var _0x7c9f=function(_0x3346d8,_0x1e2e46){_0x3346d8=_0x3346d8-0x0;var _0x4ad342=_0xc9f7[_0x3346d8];return _0x4ad342;};'use strict';var _=require(_0x7c9f('0x0'));var util=require(_0x7c9f('0x1'));var moment=require(_0x7c9f('0x2'));var BPromise=require(_0x7c9f('0x3'));var rs=require(_0x7c9f('0x4'));var fs=require('fs');var Redis=require(_0x7c9f('0x5'));var db=require(_0x7c9f('0x6'))['db'];var utils=require(_0x7c9f('0x7'));var logger=require(_0x7c9f('0x8'))(_0x7c9f('0x9'));var config=require('../../config/environment');var jayson=require(_0x7c9f('0xa'));var client=jayson[_0x7c9f('0xb')][_0x7c9f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x996b2c,_0x41d018,_0x1dd4aa){return new BPromise(function(_0x213c89,_0x39bbbf){return client[_0x7c9f('0xd')](_0x996b2c,_0x1dd4aa)[_0x7c9f('0xe')](function(_0x2db949){logger[_0x7c9f('0xf')](_0x7c9f('0x10'),_0x41d018,_0x7c9f('0x11'));logger[_0x7c9f('0x12')](_0x7c9f('0x13'),_0x41d018,_0x7c9f('0x11'),JSON[_0x7c9f('0x14')](_0x2db949));if(_0x2db949['error']){if(_0x2db949[_0x7c9f('0x15')]['code']===0x1f4){logger[_0x7c9f('0x15')](_0x7c9f('0x10'),_0x41d018,_0x2db949[_0x7c9f('0x15')][_0x7c9f('0x16')]);return _0x39bbbf(_0x2db949[_0x7c9f('0x15')][_0x7c9f('0x16')]);}logger['error'](_0x7c9f('0x10'),_0x41d018,_0x2db949[_0x7c9f('0x15')]['message']);return _0x213c89(_0x2db949[_0x7c9f('0x15')]['message']);}else{logger[_0x7c9f('0xf')]('AnalyticMetric,\x20%s,\x20%s',_0x41d018,_0x7c9f('0x11'));_0x213c89(_0x2db949['result'][_0x7c9f('0x16')]);}})[_0x7c9f('0x17')](function(_0x1eee33){logger[_0x7c9f('0x15')]('AnalyticMetric,\x20%s,\x20%s',_0x41d018,_0x1eee33);_0x39bbbf(_0x1eee33);});});} \ No newline at end of file +var _0xf762=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util'];(function(_0x43daa8,_0x2b964e){var _0x42a182=function(_0x16a94b){while(--_0x16a94b){_0x43daa8['push'](_0x43daa8['shift']());}};_0x42a182(++_0x2b964e);}(_0xf762,0xc4));var _0x2f76=function(_0x5d1ab5,_0x10d200){_0x5d1ab5=_0x5d1ab5-0x0;var _0x5a8844=_0xf762[_0x5d1ab5];return _0x5a8844;};'use strict';var _=require(_0x2f76('0x0'));var util=require(_0x2f76('0x1'));var moment=require(_0x2f76('0x2'));var BPromise=require(_0x2f76('0x3'));var rs=require(_0x2f76('0x4'));var fs=require('fs');var Redis=require(_0x2f76('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x2f76('0x6'));var logger=require(_0x2f76('0x7'))(_0x2f76('0x8'));var config=require(_0x2f76('0x9'));var jayson=require(_0x2f76('0xa'));var client=jayson['client'][_0x2f76('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xacff24,_0x27dcd2,_0x54fce7){return new BPromise(function(_0x5327c6,_0x32ee8d){return client[_0x2f76('0xc')](_0xacff24,_0x54fce7)[_0x2f76('0xd')](function(_0x54dc6a){logger[_0x2f76('0xe')](_0x2f76('0xf'),_0x27dcd2,_0x2f76('0x10'));logger['debug']('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x27dcd2,_0x2f76('0x10'),JSON[_0x2f76('0x11')](_0x54dc6a));if(_0x54dc6a[_0x2f76('0x12')]){if(_0x54dc6a[_0x2f76('0x12')][_0x2f76('0x13')]===0x1f4){logger['error'](_0x2f76('0xf'),_0x27dcd2,_0x54dc6a[_0x2f76('0x12')][_0x2f76('0x14')]);return _0x32ee8d(_0x54dc6a[_0x2f76('0x12')]['message']);}logger[_0x2f76('0x12')]('AnalyticMetric,\x20%s,\x20%s',_0x27dcd2,_0x54dc6a[_0x2f76('0x12')]['message']);return _0x5327c6(_0x54dc6a[_0x2f76('0x12')]['message']);}else{logger['info']('AnalyticMetric,\x20%s,\x20%s',_0x27dcd2,'request\x20sent');_0x5327c6(_0x54dc6a['result']['message']);}})[_0x2f76('0x15')](function(_0x804a23){logger[_0x2f76('0x12')](_0x2f76('0xf'),_0x27dcd2,_0x804a23);_0x32ee8d(_0x804a23);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index f557e7b..e8b55d2 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 _0x4a9c=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','create','put'];(function(_0x5103a4,_0x4b7f5c){var _0x4f99e0=function(_0x1fb571){while(--_0x1fb571){_0x5103a4['push'](_0x5103a4['shift']());}};_0x4f99e0(++_0x4b7f5c);}(_0x4a9c,0xcc));var _0xc4a9=function(_0x2669ba,_0x4b2c24){_0x2669ba=_0x2669ba-0x0;var _0x1eccce=_0x4a9c[_0x2669ba];return _0x1eccce;};'use strict';var multer=require(_0xc4a9('0x0'));var util=require(_0xc4a9('0x1'));var path=require(_0xc4a9('0x2'));var timeout=require(_0xc4a9('0x3'));var express=require(_0xc4a9('0x4'));var router=express[_0xc4a9('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc4a9('0x6'));var interaction=require(_0xc4a9('0x7'));var config=require(_0xc4a9('0x8'));var controller=require('./analyticMetric.controller');router['get']('/',auth[_0xc4a9('0x9')](),controller[_0xc4a9('0xa')]);router[_0xc4a9('0xb')](_0xc4a9('0xc'),auth['isAuthenticated'](),controller[_0xc4a9('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xc4a9('0xe')]);router[_0xc4a9('0xf')](_0xc4a9('0xc'),auth[_0xc4a9('0x9')](),controller[_0xc4a9('0x10')]);router[_0xc4a9('0x11')](_0xc4a9('0xc'),auth[_0xc4a9('0x9')](),controller[_0xc4a9('0x12')]);module[_0xc4a9('0x13')]=router; \ No newline at end of file +var _0x8ba0=['util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','/:id','show','post','create','update','delete','destroy','exports','multer'];(function(_0x545df9,_0x316006){var _0x1e9330=function(_0x3643a5){while(--_0x3643a5){_0x545df9['push'](_0x545df9['shift']());}};_0x1e9330(++_0x316006);}(_0x8ba0,0x1c7));var _0x08ba=function(_0x3e8455,_0x401fa1){_0x3e8455=_0x3e8455-0x0;var _0x5537bf=_0x8ba0[_0x3e8455];return _0x5537bf;};'use strict';var multer=require(_0x08ba('0x0'));var util=require(_0x08ba('0x1'));var path=require(_0x08ba('0x2'));var timeout=require(_0x08ba('0x3'));var express=require(_0x08ba('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x08ba('0x5'));var interaction=require(_0x08ba('0x6'));var config=require(_0x08ba('0x7'));var controller=require(_0x08ba('0x8'));router[_0x08ba('0x9')]('/',auth[_0x08ba('0xa')](),controller['index']);router[_0x08ba('0x9')](_0x08ba('0xb'),auth[_0x08ba('0xa')](),controller[_0x08ba('0xc')]);router[_0x08ba('0xd')]('/',auth['isAuthenticated'](),controller[_0x08ba('0xe')]);router['put'](_0x08ba('0xb'),auth['isAuthenticated'](),controller[_0x08ba('0xf')]);router[_0x08ba('0x10')](_0x08ba('0xb'),auth[_0x08ba('0xa')](),controller[_0x08ba('0x11')]);module[_0x08ba('0x12')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index c00a393..0710458 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 _0x9f92=['TEXT','sequelize'];(function(_0x3a21c0,_0x348451){var _0x411e84=function(_0xdd7b02){while(--_0xdd7b02){_0x3a21c0['push'](_0x3a21c0['shift']());}};_0x411e84(++_0x348451);}(_0x9f92,0x125));var _0x29f9=function(_0x2a31b9,_0x4a634d){_0x2a31b9=_0x2a31b9-0x0;var _0x5cda05=_0x9f92[_0x2a31b9];return _0x5cda05;};'use strict';var Sequelize=require(_0x29f9('0x0'));module['exports']={'tree':{'type':Sequelize[_0x29f9('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x056e=['exports'];(function(_0x55b7f5,_0x156133){var _0x16e474=function(_0x5951ad){while(--_0x5951ad){_0x55b7f5['push'](_0x55b7f5['shift']());}};_0x16e474(++_0x156133);}(_0x056e,0xb9));var _0xe056=function(_0x243217,_0x522951){_0x243217=_0x243217-0x0;var _0x478029=_0x056e[_0x243217];return _0x478029;};'use strict';var Sequelize=require('sequelize');module[_0xe056('0x0')]={'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 83f7ec6..a4a1d4a 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 _0x04ba=['AnalyticTreeReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','params','include','create','body','find','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','set','Content-Range','json','apply','reject','update','then','destroy','end','error','stack','name','send','index','map'];(function(_0x3c1f0a,_0x1422d5){var _0x22453e=function(_0x17451f){while(--_0x17451f){_0x3c1f0a['push'](_0x3c1f0a['shift']());}};_0x22453e(++_0x1422d5);}(_0x04ba,0x15c));var _0xa04b=function(_0x2780aa,_0x2fdb35){_0x2780aa=_0x2780aa-0x0;var _0x454f91=_0x04ba[_0x2780aa];return _0x454f91;};'use strict';var emlformat=require(_0xa04b('0x0'));var rimraf=require(_0xa04b('0x1'));var zipdir=require(_0xa04b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa04b('0x3'));var moment=require('moment');var BPromise=require(_0xa04b('0x4'));var Mustache=require(_0xa04b('0x5'));var util=require(_0xa04b('0x6'));var path=require(_0xa04b('0x7'));var sox=require(_0xa04b('0x8'));var csv=require('to-csv');var ejs=require(_0xa04b('0x9'));var fs=require('fs');var fs_extra=require(_0xa04b('0xa'));var _=require(_0xa04b('0xb'));var squel=require(_0xa04b('0xc'));var crypto=require('crypto');var jsforce=require(_0xa04b('0xd'));var deskjs=require(_0xa04b('0xe'));var toCsv=require(_0xa04b('0xf'));var querystring=require(_0xa04b('0x10'));var Papa=require(_0xa04b('0x11'));var Redis=require(_0xa04b('0x12'));var authService=require(_0xa04b('0x13'));var qs=require(_0xa04b('0x14'));var as=require(_0xa04b('0x15'));var hardwareService=require(_0xa04b('0x16'));var logger=require(_0xa04b('0x17'))('api');var utils=require('../../config/utils');var config=require(_0xa04b('0x18'));var licenseUtil=require(_0xa04b('0x19'));var db=require(_0xa04b('0x1a'))['db'];function respondWithStatusCode(_0x394adf,_0xb100ff){_0xb100ff=_0xb100ff||0xcc;return function(_0x23fd9d){if(_0x23fd9d){return _0x394adf[_0xa04b('0x1b')](_0xb100ff);}return _0x394adf[_0xa04b('0x1c')](_0xb100ff)['end']();};}function respondWithResult(_0x5a335e,_0x48dacb){_0x48dacb=_0x48dacb||0xc8;return function(_0x59d0ba){if(_0x59d0ba){return _0x5a335e[_0xa04b('0x1c')](_0x48dacb)['json'](_0x59d0ba);}};}function respondWithFilteredResult(_0x305672,_0x2717a3){return function(_0x15f27b){if(_0x15f27b){var _0x2b3b83=typeof _0x2717a3[_0xa04b('0x1d')]===_0xa04b('0x1e')&&typeof _0x2717a3['limit']===_0xa04b('0x1e');var _0x2dea51=_0x15f27b[_0xa04b('0x1f')];var _0x4fe132=_0x2b3b83?0x0:_0x2717a3[_0xa04b('0x1d')];var _0x5376ea=_0x2b3b83?_0x15f27b['count']:_0x2717a3[_0xa04b('0x1d')]+_0x2717a3['limit'];var _0x1e350a;if(_0x5376ea>=_0x2dea51){_0x5376ea=_0x2dea51;_0x1e350a=0xc8;}else{_0x1e350a=0xce;}_0x305672[_0xa04b('0x1c')](_0x1e350a);return _0x305672[_0xa04b('0x20')](_0xa04b('0x21'),_0x4fe132+'-'+_0x5376ea+'/'+_0x2dea51)[_0xa04b('0x22')](_0x15f27b);}return null;};}function patchUpdates(_0x37c48f){return function(_0x56a473){try{jsonpatch[_0xa04b('0x23')](_0x56a473,_0x37c48f,!![]);}catch(_0x491572){return BPromise[_0xa04b('0x24')](_0x491572);}return _0x56a473['save']();};}function saveUpdates(_0x4ff5a3,_0x1f7370){return function(_0x2ca8aa){if(_0x2ca8aa){return _0x2ca8aa[_0xa04b('0x25')](_0x4ff5a3)[_0xa04b('0x26')](function(_0x54a6dd){return _0x54a6dd;});}return null;};}function removeEntity(_0x16303a,_0x1ef6a1){return function(_0x214d2c){if(_0x214d2c){return _0x214d2c[_0xa04b('0x27')]()[_0xa04b('0x26')](function(){_0x16303a[_0xa04b('0x1c')](0xcc)[_0xa04b('0x28')]();});}};}function handleEntityNotFound(_0x2ccfe1,_0x54e7bf){return function(_0x244481){if(!_0x244481){_0x2ccfe1[_0xa04b('0x1b')](0x194);}return _0x244481;};}function handleError(_0xb465e9,_0xbac081){_0xbac081=_0xbac081||0x1f4;return function(_0x1ca571){logger[_0xa04b('0x29')](_0x1ca571[_0xa04b('0x2a')]);if(_0x1ca571['name']){delete _0x1ca571[_0xa04b('0x2b')];}_0xb465e9[_0xa04b('0x1c')](_0xbac081)[_0xa04b('0x2c')](_0x1ca571);};}exports[_0xa04b('0x2d')]=function(_0x5459fe,_0x20f4b3){var _0x495ea6={},_0x28e261={},_0xa0ed13={'count':0x0,'rows':[]};var _0x39e176=_[_0xa04b('0x2e')](db[_0xa04b('0x2f')][_0xa04b('0x30')],function(_0x1f1712){return{'name':_0x1f1712[_0xa04b('0x31')],'type':_0x1f1712['type'][_0xa04b('0x32')]};});_0x28e261[_0xa04b('0x33')]=_['map'](_0x39e176,_0xa04b('0x2b'));_0x28e261[_0xa04b('0x34')]=_[_0xa04b('0x35')](_0x5459fe['query']);_0x28e261[_0xa04b('0x36')]=_[_0xa04b('0x37')](_0x28e261[_0xa04b('0x33')],_0x28e261[_0xa04b('0x34')]);_0x495ea6[_0xa04b('0x38')]=_['intersection'](_0x28e261[_0xa04b('0x33')],qs[_0xa04b('0x39')](_0x5459fe['query'][_0xa04b('0x39')]));_0x495ea6[_0xa04b('0x38')]=_0x495ea6['attributes'][_0xa04b('0x3a')]?_0x495ea6[_0xa04b('0x38')]:_0x28e261[_0xa04b('0x33')];if(!_0x5459fe[_0xa04b('0x34')][_0xa04b('0x3b')](_0xa04b('0x3c'))){_0x495ea6[_0xa04b('0x3d')]=qs[_0xa04b('0x3d')](_0x5459fe[_0xa04b('0x34')]['limit']);_0x495ea6[_0xa04b('0x1d')]=qs[_0xa04b('0x1d')](_0x5459fe[_0xa04b('0x34')][_0xa04b('0x1d')]);}_0x495ea6[_0xa04b('0x3e')]=qs[_0xa04b('0x3f')](_0x5459fe[_0xa04b('0x34')][_0xa04b('0x3f')]);_0x495ea6[_0xa04b('0x40')]=qs[_0xa04b('0x36')](_['pick'](_0x5459fe[_0xa04b('0x34')],_0x28e261[_0xa04b('0x36')]),_0x39e176);if(_0x5459fe[_0xa04b('0x34')][_0xa04b('0x41')]){_0x495ea6['where']=_[_0xa04b('0x42')](_0x495ea6[_0xa04b('0x40')],{'$or':_[_0xa04b('0x2e')](_0x39e176,function(_0x179308){if(_0x179308[_0xa04b('0x43')]!==_0xa04b('0x44')){var _0x3d8473={};_0x3d8473[_0x179308[_0xa04b('0x2b')]]={'$like':'%'+_0x5459fe[_0xa04b('0x34')]['filter']+'%'};return _0x3d8473;}})});}_0x495ea6=_[_0xa04b('0x42')]({},_0x495ea6,_0x5459fe[_0xa04b('0x45')]);var _0x57a0c3={'where':_0x495ea6[_0xa04b('0x40')]};return db['AnalyticTreeReport'][_0xa04b('0x1f')](_0x57a0c3)['then'](function(_0x40d09a){_0xa0ed13['count']=_0x40d09a;if(_0x5459fe['query'][_0xa04b('0x46')]){_0x495ea6['include']=[{'all':!![]}];}return db[_0xa04b('0x2f')][_0xa04b('0x47')](_0x495ea6);})[_0xa04b('0x26')](function(_0x215db6){_0xa0ed13[_0xa04b('0x48')]=_0x215db6;return _0xa0ed13;})[_0xa04b('0x26')](respondWithFilteredResult(_0x20f4b3,_0x495ea6))[_0xa04b('0x49')](handleError(_0x20f4b3,null));};exports['show']=function(_0x1210e7,_0x143d57){var _0x3c17af={'raw':!![],'where':{'id':_0x1210e7[_0xa04b('0x4a')]['id']}},_0x164559={};_0x164559['model']=_[_0xa04b('0x35')](db[_0xa04b('0x2f')]['rawAttributes']);_0x164559[_0xa04b('0x34')]=_[_0xa04b('0x35')](_0x1210e7[_0xa04b('0x34')]);_0x164559[_0xa04b('0x36')]=_['intersection'](_0x164559['model'],_0x164559[_0xa04b('0x34')]);_0x3c17af[_0xa04b('0x38')]=_['intersection'](_0x164559[_0xa04b('0x33')],qs[_0xa04b('0x39')](_0x1210e7[_0xa04b('0x34')][_0xa04b('0x39')]));_0x3c17af[_0xa04b('0x38')]=_0x3c17af['attributes'][_0xa04b('0x3a')]?_0x3c17af[_0xa04b('0x38')]:_0x164559[_0xa04b('0x33')];if(_0x1210e7[_0xa04b('0x34')][_0xa04b('0x46')]){_0x3c17af[_0xa04b('0x4b')]=[{'all':!![]}];}_0x3c17af=_[_0xa04b('0x42')]({},_0x3c17af,_0x1210e7[_0xa04b('0x45')]);return db['AnalyticTreeReport']['find'](_0x3c17af)['then'](handleEntityNotFound(_0x143d57,null))['then'](respondWithResult(_0x143d57,null))[_0xa04b('0x49')](handleError(_0x143d57,null));};exports['create']=function(_0x254b88,_0x1bf799){return db[_0xa04b('0x2f')][_0xa04b('0x4c')](_0x254b88['body'],{})[_0xa04b('0x26')](respondWithResult(_0x1bf799,0xc9))[_0xa04b('0x49')](handleError(_0x1bf799,null));};exports['update']=function(_0x11c9ef,_0x131244){if(_0x11c9ef[_0xa04b('0x4d')]['id']){delete _0x11c9ef['body']['id'];}return db[_0xa04b('0x2f')][_0xa04b('0x4e')]({'where':{'id':_0x11c9ef[_0xa04b('0x4a')]['id']}})[_0xa04b('0x26')](handleEntityNotFound(_0x131244,null))['then'](saveUpdates(_0x11c9ef['body'],null))[_0xa04b('0x26')](respondWithResult(_0x131244,null))[_0xa04b('0x49')](handleError(_0x131244,null));};exports[_0xa04b('0x27')]=function(_0x4511eb,_0x5883e9){return db[_0xa04b('0x2f')][_0xa04b('0x4e')]({'where':{'id':_0x4511eb[_0xa04b('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5883e9,null))[_0xa04b('0x26')](removeEntity(_0x5883e9,null))[_0xa04b('0x49')](handleError(_0x5883e9,null));}; \ No newline at end of file +var _0x2920=['to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','stack','name','index','map','AnalyticTreeReport','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox'];(function(_0x462805,_0x330178){var _0x13a39e=function(_0xbbaaa7){while(--_0xbbaaa7){_0x462805['push'](_0x462805['shift']());}};_0x13a39e(++_0x330178);}(_0x2920,0x11f));var _0x0292=function(_0x5896bb,_0x6e6003){_0x5896bb=_0x5896bb-0x0;var _0xebb9d1=_0x2920[_0x5896bb];return _0xebb9d1;};'use strict';var emlformat=require(_0x0292('0x0'));var rimraf=require(_0x0292('0x1'));var zipdir=require(_0x0292('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0292('0x3'));var moment=require(_0x0292('0x4'));var BPromise=require(_0x0292('0x5'));var Mustache=require(_0x0292('0x6'));var util=require('util');var path=require(_0x0292('0x7'));var sox=require(_0x0292('0x8'));var csv=require(_0x0292('0x9'));var ejs=require(_0x0292('0xa'));var fs=require('fs');var fs_extra=require(_0x0292('0xb'));var _=require(_0x0292('0xc'));var squel=require(_0x0292('0xd'));var crypto=require('crypto');var jsforce=require(_0x0292('0xe'));var deskjs=require(_0x0292('0xf'));var toCsv=require('to-csv');var querystring=require(_0x0292('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0292('0x11'));var hardwareService=require(_0x0292('0x12'));var logger=require(_0x0292('0x13'))(_0x0292('0x14'));var utils=require(_0x0292('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x0292('0x16'));var db=require(_0x0292('0x17'))['db'];function respondWithStatusCode(_0x3596e7,_0x1b00f9){_0x1b00f9=_0x1b00f9||0xcc;return function(_0x52cb0d){if(_0x52cb0d){return _0x3596e7[_0x0292('0x18')](_0x1b00f9);}return _0x3596e7['status'](_0x1b00f9)[_0x0292('0x19')]();};}function respondWithResult(_0x331bff,_0x4a6713){_0x4a6713=_0x4a6713||0xc8;return function(_0x8e9fb2){if(_0x8e9fb2){return _0x331bff[_0x0292('0x1a')](_0x4a6713)[_0x0292('0x1b')](_0x8e9fb2);}};}function respondWithFilteredResult(_0x64a46b,_0x12f046){return function(_0x45aff3){if(_0x45aff3){var _0x3d46f6=typeof _0x12f046[_0x0292('0x1c')]===_0x0292('0x1d')&&typeof _0x12f046[_0x0292('0x1e')]==='undefined';var _0x235f97=_0x45aff3[_0x0292('0x1f')];var _0x322aab=_0x3d46f6?0x0:_0x12f046[_0x0292('0x1c')];var _0x12ce10=_0x3d46f6?_0x45aff3[_0x0292('0x1f')]:_0x12f046[_0x0292('0x1c')]+_0x12f046[_0x0292('0x1e')];var _0x294834;if(_0x12ce10>=_0x235f97){_0x12ce10=_0x235f97;_0x294834=0xc8;}else{_0x294834=0xce;}_0x64a46b[_0x0292('0x1a')](_0x294834);return _0x64a46b[_0x0292('0x20')](_0x0292('0x21'),_0x322aab+'-'+_0x12ce10+'/'+_0x235f97)['json'](_0x45aff3);}return null;};}function patchUpdates(_0x198652){return function(_0x1a682c){try{jsonpatch['apply'](_0x1a682c,_0x198652,!![]);}catch(_0x6e494c){return BPromise[_0x0292('0x22')](_0x6e494c);}return _0x1a682c[_0x0292('0x23')]();};}function saveUpdates(_0x5872fb,_0x280644){return function(_0x12e420){if(_0x12e420){return _0x12e420[_0x0292('0x24')](_0x5872fb)[_0x0292('0x25')](function(_0x5dc40e){return _0x5dc40e;});}return null;};}function removeEntity(_0x135d84,_0x2af1bc){return function(_0x2972e9){if(_0x2972e9){return _0x2972e9[_0x0292('0x26')]()[_0x0292('0x25')](function(){_0x135d84[_0x0292('0x1a')](0xcc)[_0x0292('0x19')]();});}};}function handleEntityNotFound(_0x3600d4,_0x77cf35){return function(_0xc6236f){if(!_0xc6236f){_0x3600d4[_0x0292('0x18')](0x194);}return _0xc6236f;};}function handleError(_0x274bb0,_0x2d598e){_0x2d598e=_0x2d598e||0x1f4;return function(_0x1e1a6e){logger['error'](_0x1e1a6e[_0x0292('0x27')]);if(_0x1e1a6e[_0x0292('0x28')]){delete _0x1e1a6e[_0x0292('0x28')];}_0x274bb0[_0x0292('0x1a')](_0x2d598e)['send'](_0x1e1a6e);};}exports[_0x0292('0x29')]=function(_0x55175a,_0xbd676a){var _0x199bb1={},_0x2d398e={},_0x4c0dd0={'count':0x0,'rows':[]};var _0x4fab88=_[_0x0292('0x2a')](db[_0x0292('0x2b')]['rawAttributes'],function(_0x6b94a9){return{'name':_0x6b94a9[_0x0292('0x2c')],'type':_0x6b94a9[_0x0292('0x2d')][_0x0292('0x2e')]};});_0x2d398e[_0x0292('0x2f')]=_['map'](_0x4fab88,_0x0292('0x28'));_0x2d398e['query']=_[_0x0292('0x30')](_0x55175a[_0x0292('0x31')]);_0x2d398e[_0x0292('0x32')]=_[_0x0292('0x33')](_0x2d398e[_0x0292('0x2f')],_0x2d398e['query']);_0x199bb1[_0x0292('0x34')]=_[_0x0292('0x33')](_0x2d398e['model'],qs[_0x0292('0x35')](_0x55175a[_0x0292('0x31')][_0x0292('0x35')]));_0x199bb1['attributes']=_0x199bb1[_0x0292('0x34')]['length']?_0x199bb1[_0x0292('0x34')]:_0x2d398e[_0x0292('0x2f')];if(!_0x55175a[_0x0292('0x31')][_0x0292('0x36')](_0x0292('0x37'))){_0x199bb1[_0x0292('0x1e')]=qs[_0x0292('0x1e')](_0x55175a[_0x0292('0x31')]['limit']);_0x199bb1[_0x0292('0x1c')]=qs[_0x0292('0x1c')](_0x55175a[_0x0292('0x31')][_0x0292('0x1c')]);}_0x199bb1['order']=qs[_0x0292('0x38')](_0x55175a[_0x0292('0x31')]['sort']);_0x199bb1[_0x0292('0x39')]=qs[_0x0292('0x32')](_[_0x0292('0x3a')](_0x55175a['query'],_0x2d398e[_0x0292('0x32')]),_0x4fab88);if(_0x55175a['query'][_0x0292('0x3b')]){_0x199bb1[_0x0292('0x39')]=_['merge'](_0x199bb1[_0x0292('0x39')],{'$or':_['map'](_0x4fab88,function(_0x1d18af){if(_0x1d18af[_0x0292('0x2d')]!==_0x0292('0x3c')){var _0x20e6bf={};_0x20e6bf[_0x1d18af[_0x0292('0x28')]]={'$like':'%'+_0x55175a['query'][_0x0292('0x3b')]+'%'};return _0x20e6bf;}})});}_0x199bb1=_[_0x0292('0x3d')]({},_0x199bb1,_0x55175a[_0x0292('0x3e')]);var _0x3c700c={'where':_0x199bb1[_0x0292('0x39')]};return db[_0x0292('0x2b')]['count'](_0x3c700c)[_0x0292('0x25')](function(_0x49fcd1){_0x4c0dd0[_0x0292('0x1f')]=_0x49fcd1;if(_0x55175a['query'][_0x0292('0x3f')]){_0x199bb1[_0x0292('0x40')]=[{'all':!![]}];}return db['AnalyticTreeReport'][_0x0292('0x41')](_0x199bb1);})['then'](function(_0x4eec88){_0x4c0dd0[_0x0292('0x42')]=_0x4eec88;return _0x4c0dd0;})[_0x0292('0x25')](respondWithFilteredResult(_0xbd676a,_0x199bb1))[_0x0292('0x43')](handleError(_0xbd676a,null));};exports[_0x0292('0x44')]=function(_0x5174aa,_0x22f98){var _0x403067={'raw':!![],'where':{'id':_0x5174aa[_0x0292('0x45')]['id']}},_0x54aaf1={};_0x54aaf1[_0x0292('0x2f')]=_[_0x0292('0x30')](db[_0x0292('0x2b')]['rawAttributes']);_0x54aaf1[_0x0292('0x31')]=_['keys'](_0x5174aa['query']);_0x54aaf1[_0x0292('0x32')]=_[_0x0292('0x33')](_0x54aaf1[_0x0292('0x2f')],_0x54aaf1[_0x0292('0x31')]);_0x403067[_0x0292('0x34')]=_[_0x0292('0x33')](_0x54aaf1[_0x0292('0x2f')],qs[_0x0292('0x35')](_0x5174aa[_0x0292('0x31')][_0x0292('0x35')]));_0x403067[_0x0292('0x34')]=_0x403067[_0x0292('0x34')][_0x0292('0x46')]?_0x403067[_0x0292('0x34')]:_0x54aaf1[_0x0292('0x2f')];if(_0x5174aa['query']['includeAll']){_0x403067[_0x0292('0x40')]=[{'all':!![]}];}_0x403067=_['merge']({},_0x403067,_0x5174aa[_0x0292('0x3e')]);return db[_0x0292('0x2b')][_0x0292('0x47')](_0x403067)[_0x0292('0x25')](handleEntityNotFound(_0x22f98,null))['then'](respondWithResult(_0x22f98,null))[_0x0292('0x43')](handleError(_0x22f98,null));};exports[_0x0292('0x48')]=function(_0xa46447,_0x4bb355){return db[_0x0292('0x2b')][_0x0292('0x48')](_0xa46447[_0x0292('0x49')],{})['then'](respondWithResult(_0x4bb355,0xc9))[_0x0292('0x43')](handleError(_0x4bb355,null));};exports['update']=function(_0x3dab1c,_0x18d2d4){if(_0x3dab1c[_0x0292('0x49')]['id']){delete _0x3dab1c[_0x0292('0x49')]['id'];}return db[_0x0292('0x2b')][_0x0292('0x47')]({'where':{'id':_0x3dab1c[_0x0292('0x45')]['id']}})['then'](handleEntityNotFound(_0x18d2d4,null))[_0x0292('0x25')](saveUpdates(_0x3dab1c[_0x0292('0x49')],null))['then'](respondWithResult(_0x18d2d4,null))[_0x0292('0x43')](handleError(_0x18d2d4,null));};exports[_0x0292('0x26')]=function(_0x509125,_0x4869f6){return db['AnalyticTreeReport']['find']({'where':{'id':_0x509125[_0x0292('0x45')]['id']}})[_0x0292('0x25')](handleEntityNotFound(_0x4869f6,null))[_0x0292('0x25')](removeEntity(_0x4869f6,null))[_0x0292('0x43')](handleError(_0x4869f6,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 93df8c5..09bebeb 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 _0x2707=['./analyticTreeReport.attributes','exports','analytics_report_trees','lodash','util','../../config/logger','api','request-promise','path','../../config/environment'];(function(_0x48961c,_0x280e9d){var _0x1d895d=function(_0x248ffa){while(--_0x248ffa){_0x48961c['push'](_0x48961c['shift']());}};_0x1d895d(++_0x280e9d);}(_0x2707,0x1cf));var _0x7270=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0x2707[_0x2dadb9];return _0x2f0097;};'use strict';var _=require(_0x7270('0x0'));var util=require(_0x7270('0x1'));var logger=require(_0x7270('0x2'))(_0x7270('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x7270('0x4'));var fs=require('fs');var path=require(_0x7270('0x5'));var rimraf=require('rimraf');var config=require(_0x7270('0x6'));var attributes=require(_0x7270('0x7'));module[_0x7270('0x8')]=function(_0x486089,_0x20168c){return _0x486089['define']('AnalyticTreeReport',attributes,{'tableName':_0x7270('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf8eb=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./analyticTreeReport.attributes','exports','define','AnalyticTreeReport','lodash'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf8eb,0x167));var _0xbf8e=function(_0x4f926d,_0x10b231){_0x4f926d=_0x4f926d-0x0;var _0x4982a0=_0xf8eb[_0x4f926d];return _0x4982a0;};'use strict';var _=require(_0xbf8e('0x0'));var util=require('util');var logger=require(_0xbf8e('0x1'))(_0xbf8e('0x2'));var moment=require(_0xbf8e('0x3'));var BPromise=require(_0xbf8e('0x4'));var rp=require(_0xbf8e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbf8e('0x6'));var config=require(_0xbf8e('0x7'));var attributes=require(_0xbf8e('0x8'));module[_0xbf8e('0x9')]=function(_0x6edd01,_0x277aef){return _0x6edd01[_0xbf8e('0xa')](_0xbf8e('0xb'),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 6f2166d..334a53a 100644 --- a/server/api/analyticTreeReport/analyticTreeReport.rpc.js +++ b/server/api/analyticTreeReport/analyticTreeReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f66=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','stringify','code','message','error','info','catch','util','bluebird','randomstring','ioredis'];(function(_0x5969fa,_0x5c40ae){var _0x410842=function(_0xca7d89){while(--_0xca7d89){_0x5969fa['push'](_0x5969fa['shift']());}};_0x410842(++_0x5c40ae);}(_0x5f66,0x1a0));var _0x65f6=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x5f66[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var moment=require('moment');var BPromise=require(_0x65f6('0x1'));var rs=require(_0x65f6('0x2'));var fs=require('fs');var Redis=require(_0x65f6('0x3'));var db=require(_0x65f6('0x4'))['db'];var utils=require(_0x65f6('0x5'));var logger=require('../../config/logger')(_0x65f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x7'));var client=jayson[_0x65f6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ed98f,_0x1c0e12,_0x2c6571){return new BPromise(function(_0x112079,_0x8f6451){return client[_0x65f6('0x9')](_0x4ed98f,_0x2c6571)[_0x65f6('0xa')](function(_0x48d85c){logger['info'](_0x65f6('0xb'),_0x1c0e12,_0x65f6('0xc'));logger[_0x65f6('0xd')](_0x65f6('0xe'),_0x1c0e12,'request\x20sent',JSON[_0x65f6('0xf')](_0x48d85c));if(_0x48d85c['error']){if(_0x48d85c['error'][_0x65f6('0x10')]===0x1f4){logger['error'](_0x65f6('0xb'),_0x1c0e12,_0x48d85c['error'][_0x65f6('0x11')]);return _0x8f6451(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);return _0x112079(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}else{logger[_0x65f6('0x13')]('AnalyticTreeReport,\x20%s,\x20%s',_0x1c0e12,_0x65f6('0xc'));_0x112079(_0x48d85c['result']['message']);}})[_0x65f6('0x14')](function(_0x5c69f8){logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x5c69f8);_0x8f6451(_0x5c69f8);});});} \ No newline at end of file +var _0x1261=['then','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x40bc19,_0x51be0c){var _0x5b575a=function(_0x12d7a1){while(--_0x12d7a1){_0x40bc19['push'](_0x40bc19['shift']());}};_0x5b575a(++_0x51be0c);}(_0x1261,0x144));var _0x1126=function(_0x15fa77,_0x93eaff){_0x15fa77=_0x15fa77-0x0;var _0x1385ff=_0x1261[_0x15fa77];return _0x1385ff;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x907180,_0x4f239c,_0x17e5f0){return new BPromise(function(_0x28772d,_0x245be9){return client[_0x1126('0xb')](_0x907180,_0x17e5f0)[_0x1126('0xc')](function(_0x59cfa1){logger[_0x1126('0xd')](_0x1126('0xe'),_0x4f239c,_0x1126('0xf'));logger['debug'](_0x1126('0x10'),_0x4f239c,'request\x20sent',JSON['stringify'](_0x59cfa1));if(_0x59cfa1[_0x1126('0x11')]){if(_0x59cfa1['error'][_0x1126('0x12')]===0x1f4){logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);return _0x245be9(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1['error']['message']);return _0x28772d(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}else{logger[_0x1126('0xd')]('AnalyticTreeReport,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index c49b174..1fd6409 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 _0xec49=['util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','isAuthenticated','index','/:id','create','put','update','delete','destroy','multer'];(function(_0xc74254,_0x6822fe){var _0x27c986=function(_0x3fa38f){while(--_0x3fa38f){_0xc74254['push'](_0xc74254['shift']());}};_0x27c986(++_0x6822fe);}(_0xec49,0x1c1));var _0x9ec4=function(_0x1a3c9a,_0x44cbc9){_0x1a3c9a=_0x1a3c9a-0x0;var _0x12689f=_0xec49[_0x1a3c9a];return _0x12689f;};'use strict';var multer=require(_0x9ec4('0x0'));var util=require(_0x9ec4('0x1'));var path=require(_0x9ec4('0x2'));var timeout=require(_0x9ec4('0x3'));var express=require(_0x9ec4('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x9ec4('0x5'));var interaction=require(_0x9ec4('0x6'));var config=require(_0x9ec4('0x7'));var controller=require(_0x9ec4('0x8'));router[_0x9ec4('0x9')]('/',auth[_0x9ec4('0xa')](),controller[_0x9ec4('0xb')]);router[_0x9ec4('0x9')](_0x9ec4('0xc'),auth[_0x9ec4('0xa')](),controller['show']);router['post']('/',auth[_0x9ec4('0xa')](),controller[_0x9ec4('0xd')]);router[_0x9ec4('0xe')](_0x9ec4('0xc'),auth[_0x9ec4('0xa')](),controller[_0x9ec4('0xf')]);router[_0x9ec4('0x10')](_0x9ec4('0xc'),auth[_0x9ec4('0xa')](),controller[_0x9ec4('0x11')]);module['exports']=router; \ No newline at end of file +var _0xc87b=['destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','get','isAuthenticated','index','show','post','create','put','/:id','update','delete'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc87b,0x1a0));var _0xbc87=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xc87b[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require(_0xbc87('0x0'));var util=require('util');var path=require(_0xbc87('0x1'));var timeout=require(_0xbc87('0x2'));var express=require('express');var router=express[_0xbc87('0x3')]();var fs_extra=require(_0xbc87('0x4'));var auth=require(_0xbc87('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./analyticTreeReport.controller');router[_0xbc87('0x6')]('/',auth[_0xbc87('0x7')](),controller[_0xbc87('0x8')]);router[_0xbc87('0x6')]('/:id',auth[_0xbc87('0x7')](),controller[_0xbc87('0x9')]);router[_0xbc87('0xa')]('/',auth[_0xbc87('0x7')](),controller[_0xbc87('0xb')]);router[_0xbc87('0xc')](_0xbc87('0xd'),auth['isAuthenticated'](),controller[_0xbc87('0xe')]);router[_0xbc87('0xf')](_0xbc87('0xd'),auth['isAuthenticated'](),controller[_0xbc87('0x10')]);module[_0xbc87('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 d133b42..5a52716 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 _0x3667=['STRING','sequelize','exports'];(function(_0x26fa5,_0x182714){var _0x564e52=function(_0x1a8f18){while(--_0x1a8f18){_0x26fa5['push'](_0x26fa5['shift']());}};_0x564e52(++_0x182714);}(_0x3667,0xcd));var _0x7366=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3667[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x7366('0x0'));module[_0x7366('0x1')]={'name':{'type':Sequelize[_0x7366('0x2')]},'basename':{'type':Sequelize[_0x7366('0x2')]},'type':{'type':Sequelize[_0x7366('0x2')]}}; \ No newline at end of file +var _0x0487=['exports','STRING','sequelize'];(function(_0x5d21d1,_0x18196d){var _0x5dbb7a=function(_0x3c993d){while(--_0x3c993d){_0x5d21d1['push'](_0x5d21d1['shift']());}};_0x5dbb7a(++_0x18196d);}(_0x0487,0x14f));var _0x7048=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x0487[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0x7048('0x0'));module[_0x7048('0x1')]={'name':{'type':Sequelize[_0x7048('0x2')]},'basename':{'type':Sequelize[_0x7048('0x2')]},'type':{'type':Sequelize[_0x7048('0x2')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index d129832..1d9219d 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 _0x7986=['lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','offset','undefined','limit','count','json','apply','reject','save','update','then','sendStatus','error','stack','name','send','index','map','Attachment','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','catch','show','params','includeAll','find','get','omit','createdAt','updatedAt','body','destroy','file','originalname','basename','filename','mimetype','create','download','findOne','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','eml-format','rimraf','zip-dir','fast-json-patch','util','sox','to-csv'];(function(_0x7aa744,_0x450c0d){var _0x3ef3cb=function(_0x44cc93){while(--_0x44cc93){_0x7aa744['push'](_0x7aa744['shift']());}};_0x3ef3cb(++_0x450c0d);}(_0x7986,0xab));var _0x6798=function(_0x1146ca,_0x50249a){_0x1146ca=_0x1146ca-0x0;var _0xce8354=_0x7986[_0x1146ca];return _0xce8354;};'use strict';var emlformat=require(_0x6798('0x0'));var rimraf=require(_0x6798('0x1'));var zipdir=require(_0x6798('0x2'));var jsonpatch=require(_0x6798('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6798('0x4'));var path=require('path');var sox=require(_0x6798('0x5'));var csv=require(_0x6798('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6798('0x7'));var squel=require(_0x6798('0x8'));var crypto=require(_0x6798('0x9'));var jsforce=require(_0x6798('0xa'));var deskjs=require(_0x6798('0xb'));var toCsv=require(_0x6798('0x6'));var querystring=require(_0x6798('0xc'));var Papa=require(_0x6798('0xd'));var Redis=require(_0x6798('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x6798('0xf'));var as=require(_0x6798('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6798('0x11'))(_0x6798('0x12'));var utils=require(_0x6798('0x13'));var config=require(_0x6798('0x14'));var licenseUtil=require(_0x6798('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x12a0d8,_0x4c146c){_0x4c146c=_0x4c146c||0xcc;return function(_0x29cfa7){if(_0x29cfa7){return _0x12a0d8['sendStatus'](_0x4c146c);}return _0x12a0d8[_0x6798('0x16')](_0x4c146c)[_0x6798('0x17')]();};}function respondWithResult(_0xd96afe,_0x25ad8a){_0x25ad8a=_0x25ad8a||0xc8;return function(_0x181199){if(_0x181199){return _0xd96afe['status'](_0x25ad8a)['json'](_0x181199);}};}function respondWithFilteredResult(_0x5b959c,_0x5adbcb){return function(_0x1c9f15){if(_0x1c9f15){var _0x4c6596=typeof _0x5adbcb[_0x6798('0x18')]===_0x6798('0x19')&&typeof _0x5adbcb[_0x6798('0x1a')]==='undefined';var _0x39164b=_0x1c9f15['count'];var _0x3d7e33=_0x4c6596?0x0:_0x5adbcb['offset'];var _0x426b42=_0x4c6596?_0x1c9f15[_0x6798('0x1b')]:_0x5adbcb[_0x6798('0x18')]+_0x5adbcb['limit'];var _0x37441e;if(_0x426b42>=_0x39164b){_0x426b42=_0x39164b;_0x37441e=0xc8;}else{_0x37441e=0xce;}_0x5b959c[_0x6798('0x16')](_0x37441e);return _0x5b959c['set']('Content-Range',_0x3d7e33+'-'+_0x426b42+'/'+_0x39164b)[_0x6798('0x1c')](_0x1c9f15);}return null;};}function patchUpdates(_0x42c96a){return function(_0x1eb16d){try{jsonpatch[_0x6798('0x1d')](_0x1eb16d,_0x42c96a,!![]);}catch(_0x496f3b){return BPromise[_0x6798('0x1e')](_0x496f3b);}return _0x1eb16d[_0x6798('0x1f')]();};}function saveUpdates(_0x59aaa7,_0x57be28){return function(_0x99aac3){if(_0x99aac3){return _0x99aac3[_0x6798('0x20')](_0x59aaa7)[_0x6798('0x21')](function(_0x382454){return _0x382454;});}return null;};}function removeEntity(_0x5a2b41,_0x8398bb){return function(_0x3567f7){if(_0x3567f7){return _0x3567f7['destroy']()[_0x6798('0x21')](function(){_0x5a2b41[_0x6798('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x420c9c,_0x817d2f){return function(_0x42d358){if(!_0x42d358){_0x420c9c[_0x6798('0x22')](0x194);}return _0x42d358;};}function handleError(_0x1c995b,_0xca2090){_0xca2090=_0xca2090||0x1f4;return function(_0x4d017c){logger[_0x6798('0x23')](_0x4d017c[_0x6798('0x24')]);if(_0x4d017c[_0x6798('0x25')]){delete _0x4d017c[_0x6798('0x25')];}_0x1c995b[_0x6798('0x16')](_0xca2090)[_0x6798('0x26')](_0x4d017c);};}exports[_0x6798('0x27')]=function(_0x357852,_0x3d3d59){var _0x5405ae={},_0x10f589={},_0x3bc348={'count':0x0,'rows':[]};var _0x102158=_[_0x6798('0x28')](db[_0x6798('0x29')][_0x6798('0x2a')],function(_0x46fda1){return{'name':_0x46fda1['fieldName'],'type':_0x46fda1[_0x6798('0x2b')][_0x6798('0x2c')]};});_0x10f589[_0x6798('0x2d')]=_['map'](_0x102158,'name');_0x10f589[_0x6798('0x2e')]=_[_0x6798('0x2f')](_0x357852[_0x6798('0x2e')]);_0x10f589[_0x6798('0x30')]=_[_0x6798('0x31')](_0x10f589[_0x6798('0x2d')],_0x10f589[_0x6798('0x2e')]);_0x5405ae[_0x6798('0x32')]=_[_0x6798('0x31')](_0x10f589['model'],qs[_0x6798('0x33')](_0x357852[_0x6798('0x2e')][_0x6798('0x33')]));_0x5405ae[_0x6798('0x32')]=_0x5405ae[_0x6798('0x32')][_0x6798('0x34')]?_0x5405ae[_0x6798('0x32')]:_0x10f589[_0x6798('0x2d')];if(!_0x357852['query'][_0x6798('0x35')](_0x6798('0x36'))){_0x5405ae[_0x6798('0x1a')]=qs[_0x6798('0x1a')](_0x357852[_0x6798('0x2e')][_0x6798('0x1a')]);_0x5405ae[_0x6798('0x18')]=qs[_0x6798('0x18')](_0x357852[_0x6798('0x2e')][_0x6798('0x18')]);}_0x5405ae[_0x6798('0x37')]=qs['sort'](_0x357852[_0x6798('0x2e')][_0x6798('0x38')]);_0x5405ae[_0x6798('0x39')]=qs[_0x6798('0x30')](_[_0x6798('0x3a')](_0x357852[_0x6798('0x2e')],_0x10f589[_0x6798('0x30')]),_0x102158);if(_0x357852['query'][_0x6798('0x3b')]){_0x5405ae[_0x6798('0x39')]=_[_0x6798('0x3c')](_0x5405ae['where'],{'$or':_['map'](_0x102158,function(_0x4b1ea2){if(_0x4b1ea2[_0x6798('0x2b')]!==_0x6798('0x3d')){var _0x217d67={};_0x217d67[_0x4b1ea2['name']]={'$like':'%'+_0x357852[_0x6798('0x2e')][_0x6798('0x3b')]+'%'};return _0x217d67;}})});}_0x5405ae=_[_0x6798('0x3c')]({},_0x5405ae,_0x357852[_0x6798('0x3e')]);var _0x57134c={'where':_0x5405ae[_0x6798('0x39')]};return db['Attachment'][_0x6798('0x1b')](_0x57134c)['then'](function(_0x4b3b1d){_0x3bc348[_0x6798('0x1b')]=_0x4b3b1d;if(_0x357852[_0x6798('0x2e')]['includeAll']){_0x5405ae['include']=[{'all':!![]}];}return db[_0x6798('0x29')][_0x6798('0x3f')](_0x5405ae);})['then'](function(_0x5e8efb){_0x3bc348[_0x6798('0x40')]=_0x5e8efb;return _0x3bc348;})['then'](respondWithFilteredResult(_0x3d3d59,_0x5405ae))[_0x6798('0x41')](handleError(_0x3d3d59,null));};exports[_0x6798('0x42')]=function(_0x428dab,_0x3445d1){var _0x3f4b2a={'raw':!![],'where':{'id':_0x428dab[_0x6798('0x43')]['id']}},_0x13e25d={};_0x13e25d['model']=_[_0x6798('0x2f')](db[_0x6798('0x29')][_0x6798('0x2a')]);_0x13e25d['query']=_[_0x6798('0x2f')](_0x428dab['query']);_0x13e25d[_0x6798('0x30')]=_[_0x6798('0x31')](_0x13e25d[_0x6798('0x2d')],_0x13e25d[_0x6798('0x2e')]);_0x3f4b2a[_0x6798('0x32')]=_[_0x6798('0x31')](_0x13e25d[_0x6798('0x2d')],qs['fields'](_0x428dab[_0x6798('0x2e')][_0x6798('0x33')]));_0x3f4b2a[_0x6798('0x32')]=_0x3f4b2a[_0x6798('0x32')]['length']?_0x3f4b2a['attributes']:_0x13e25d['model'];if(_0x428dab['query'][_0x6798('0x44')]){_0x3f4b2a['include']=[{'all':!![]}];}_0x3f4b2a=_[_0x6798('0x3c')]({},_0x3f4b2a,_0x428dab[_0x6798('0x3e')]);return db[_0x6798('0x29')][_0x6798('0x45')](_0x3f4b2a)['then'](handleEntityNotFound(_0x3445d1,null))[_0x6798('0x21')](respondWithResult(_0x3445d1,null))['catch'](handleError(_0x3445d1,null));};exports['clone']=function(_0x839b9c,_0x1c467d){var _0x14735e={'where':{'id':_0x839b9c[_0x6798('0x43')]['id']}},_0x51eb41={};_0x51eb41[_0x6798('0x2d')]=_[_0x6798('0x2f')](db['Attachment'][_0x6798('0x2a')]);_0x14735e[_0x6798('0x32')]=_[_0x6798('0x31')](_0x51eb41['model'],qs[_0x6798('0x33')](_0x839b9c['query'][_0x6798('0x33')]));_0x14735e[_0x6798('0x32')]=_0x14735e[_0x6798('0x32')]['length']?_0x14735e[_0x6798('0x32')]:_0x51eb41['model'];if(_0x839b9c[_0x6798('0x2e')]['includeAll']){_0x14735e['include']=[{'all':!![]}];}_0x14735e=_[_0x6798('0x3c')]({},_0x14735e,_0x839b9c[_0x6798('0x3e')]);return db[_0x6798('0x29')]['find'](_0x14735e)[_0x6798('0x21')](handleEntityNotFound(_0x1c467d,null))[_0x6798('0x21')](function(_0x10ab10){if(_0x10ab10){var _0x24ec06=_0x10ab10[_0x6798('0x46')]({'plain':!![]});_0x24ec06=qs[_0x6798('0x47')](_0x24ec06,['id',_0x6798('0x48'),_0x6798('0x49')]);_0x839b9c[_0x6798('0x4a')]=_[_0x6798('0x47')](_0x839b9c[_0x6798('0x4a')],['id',_0x6798('0x48'),'updatedAt']);return db[_0x6798('0x29')]['create'](_[_0x6798('0x3c')](_0x24ec06,_0x839b9c['body']),{'include':_0x839b9c[_0x6798('0x2e')][_0x6798('0x44')]?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0x1c467d,0xc9))[_0x6798('0x41')](handleError(_0x1c467d,null));};exports['update']=function(_0x278d5c,_0x8a40fe){if(_0x278d5c[_0x6798('0x4a')]['id']){delete _0x278d5c[_0x6798('0x4a')]['id'];}return db['Attachment']['find']({'where':{'id':_0x278d5c[_0x6798('0x43')]['id']}})[_0x6798('0x21')](handleEntityNotFound(_0x8a40fe,null))[_0x6798('0x21')](saveUpdates(_0x278d5c[_0x6798('0x4a')],null))[_0x6798('0x21')](respondWithResult(_0x8a40fe,null))[_0x6798('0x41')](handleError(_0x8a40fe,null));};exports[_0x6798('0x4b')]=function(_0x3e6a80,_0x40a9a5){return db[_0x6798('0x29')]['find']({'where':{'id':_0x3e6a80[_0x6798('0x43')]['id']}})[_0x6798('0x21')](handleEntityNotFound(_0x40a9a5,null))['then'](removeEntity(_0x40a9a5,null))[_0x6798('0x41')](handleError(_0x40a9a5,null));};exports['create']=function(_0x1d97a2,_0x90c533,_0x4f0841){_0x1d97a2[_0x6798('0x4a')]['name']=_0x1d97a2[_0x6798('0x4c')][_0x6798('0x4d')];_0x1d97a2['body'][_0x6798('0x4e')]=_0x1d97a2['file'][_0x6798('0x4f')];_0x1d97a2[_0x6798('0x4a')][_0x6798('0x2b')]=_0x1d97a2[_0x6798('0x4c')][_0x6798('0x50')];return db[_0x6798('0x29')][_0x6798('0x51')](_0x1d97a2[_0x6798('0x4a')])[_0x6798('0x21')](respondWithResult(_0x90c533,0xc9))[_0x6798('0x41')](handleError(_0x90c533,null));};exports[_0x6798('0x52')]=function(_0x2cf192,_0x586f68,_0x62dc07){return db[_0x6798('0x29')][_0x6798('0x53')]({'where':{'id':_0x2cf192[_0x6798('0x43')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x586f68,null))[_0x6798('0x21')](function(_0x2d19ea){if(_0x2d19ea){var _0x48d51b=_0x2d19ea[_0x6798('0x54')]!==null;var _0x1d24ac=path[_0x6798('0x55')](config[_0x6798('0x56')],_0x6798('0x57'));if(_0x48d51b){_0x1d24ac=path[_0x6798('0x55')](_0x1d24ac,_0x6798('0x58'));}var _0xaf2426=path[_0x6798('0x55')](_0x1d24ac,_0x2d19ea[_0x6798('0x4e')]);return _0x586f68['download'](_0xaf2426);}})[_0x6798('0x41')](handleError(_0x586f68,null));}; \ No newline at end of file +var _0x7ed1=['includeAll','include','findAll','show','length','find','catch','clone','get','createdAt','updatedAt','omit','body','create','update','params','file','originalname','basename','filename','mimetype','download','join','root','server/files/attachments/','offline-chat/','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','json','limit','undefined','offset','count','set','Content-Range','apply','reject','save','then','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','Attachment'];(function(_0xda1099,_0x53d61c){var _0x23661e=function(_0x198d25){while(--_0x198d25){_0xda1099['push'](_0xda1099['shift']());}};_0x23661e(++_0x53d61c);}(_0x7ed1,0x75));var _0x17ed=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0x7ed1[_0x1caf6a];return _0x1bf493;};'use strict';var emlformat=require(_0x17ed('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x17ed('0x1'));var jsonpatch=require(_0x17ed('0x2'));var rp=require(_0x17ed('0x3'));var moment=require(_0x17ed('0x4'));var BPromise=require(_0x17ed('0x5'));var Mustache=require(_0x17ed('0x6'));var util=require('util');var path=require(_0x17ed('0x7'));var sox=require(_0x17ed('0x8'));var csv=require(_0x17ed('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x17ed('0xa'));var squel=require(_0x17ed('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x17ed('0xc'));var toCsv=require(_0x17ed('0x9'));var querystring=require(_0x17ed('0xd'));var Papa=require('papaparse');var Redis=require(_0x17ed('0xe'));var authService=require(_0x17ed('0xf'));var qs=require(_0x17ed('0x10'));var as=require(_0x17ed('0x11'));var hardwareService=require(_0x17ed('0x12'));var logger=require(_0x17ed('0x13'))(_0x17ed('0x14'));var utils=require('../../config/utils');var config=require(_0x17ed('0x15'));var licenseUtil=require(_0x17ed('0x16'));var db=require(_0x17ed('0x17'))['db'];function respondWithStatusCode(_0x4d12d5,_0x397d6d){_0x397d6d=_0x397d6d||0xcc;return function(_0x100c96){if(_0x100c96){return _0x4d12d5['sendStatus'](_0x397d6d);}return _0x4d12d5[_0x17ed('0x18')](_0x397d6d)['end']();};}function respondWithResult(_0x2de563,_0x3ee7f5){_0x3ee7f5=_0x3ee7f5||0xc8;return function(_0x51719e){if(_0x51719e){return _0x2de563[_0x17ed('0x18')](_0x3ee7f5)[_0x17ed('0x19')](_0x51719e);}};}function respondWithFilteredResult(_0x4fb02f,_0x4f3d62){return function(_0xf6bc9e){if(_0xf6bc9e){var _0x16c84a=typeof _0x4f3d62['offset']==='undefined'&&typeof _0x4f3d62[_0x17ed('0x1a')]===_0x17ed('0x1b');var _0x514a42=_0xf6bc9e['count'];var _0x1a32f3=_0x16c84a?0x0:_0x4f3d62[_0x17ed('0x1c')];var _0x2b788d=_0x16c84a?_0xf6bc9e[_0x17ed('0x1d')]:_0x4f3d62['offset']+_0x4f3d62[_0x17ed('0x1a')];var _0x391c21;if(_0x2b788d>=_0x514a42){_0x2b788d=_0x514a42;_0x391c21=0xc8;}else{_0x391c21=0xce;}_0x4fb02f['status'](_0x391c21);return _0x4fb02f[_0x17ed('0x1e')](_0x17ed('0x1f'),_0x1a32f3+'-'+_0x2b788d+'/'+_0x514a42)[_0x17ed('0x19')](_0xf6bc9e);}return null;};}function patchUpdates(_0xec308f){return function(_0x35e692){try{jsonpatch[_0x17ed('0x20')](_0x35e692,_0xec308f,!![]);}catch(_0x14f0c8){return BPromise[_0x17ed('0x21')](_0x14f0c8);}return _0x35e692[_0x17ed('0x22')]();};}function saveUpdates(_0x1ee76c,_0x5c9b6c){return function(_0x3d6cfe){if(_0x3d6cfe){return _0x3d6cfe['update'](_0x1ee76c)[_0x17ed('0x23')](function(_0x358c4e){return _0x358c4e;});}return null;};}function removeEntity(_0x2f0460,_0xf332cf){return function(_0x20c38b){if(_0x20c38b){return _0x20c38b[_0x17ed('0x24')]()[_0x17ed('0x23')](function(){_0x2f0460[_0x17ed('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x218b1d,_0x297dac){return function(_0x2baa56){if(!_0x2baa56){_0x218b1d[_0x17ed('0x25')](0x194);}return _0x2baa56;};}function handleError(_0x58b5eb,_0x7f2ca4){_0x7f2ca4=_0x7f2ca4||0x1f4;return function(_0x2260f8){logger[_0x17ed('0x26')](_0x2260f8[_0x17ed('0x27')]);if(_0x2260f8['name']){delete _0x2260f8[_0x17ed('0x28')];}_0x58b5eb['status'](_0x7f2ca4)[_0x17ed('0x29')](_0x2260f8);};}exports[_0x17ed('0x2a')]=function(_0x128c53,_0x26f616){var _0x2652b5={},_0x113b17={},_0x28acc6={'count':0x0,'rows':[]};var _0x34a5a4=_[_0x17ed('0x2b')](db['Attachment'][_0x17ed('0x2c')],function(_0x46e521){return{'name':_0x46e521['fieldName'],'type':_0x46e521[_0x17ed('0x2d')][_0x17ed('0x2e')]};});_0x113b17[_0x17ed('0x2f')]=_['map'](_0x34a5a4,_0x17ed('0x28'));_0x113b17[_0x17ed('0x30')]=_[_0x17ed('0x31')](_0x128c53[_0x17ed('0x30')]);_0x113b17[_0x17ed('0x32')]=_[_0x17ed('0x33')](_0x113b17['model'],_0x113b17[_0x17ed('0x30')]);_0x2652b5['attributes']=_[_0x17ed('0x33')](_0x113b17['model'],qs[_0x17ed('0x34')](_0x128c53[_0x17ed('0x30')]['fields']));_0x2652b5['attributes']=_0x2652b5[_0x17ed('0x35')]['length']?_0x2652b5[_0x17ed('0x35')]:_0x113b17[_0x17ed('0x2f')];if(!_0x128c53['query'][_0x17ed('0x36')](_0x17ed('0x37'))){_0x2652b5[_0x17ed('0x1a')]=qs[_0x17ed('0x1a')](_0x128c53[_0x17ed('0x30')][_0x17ed('0x1a')]);_0x2652b5[_0x17ed('0x1c')]=qs[_0x17ed('0x1c')](_0x128c53[_0x17ed('0x30')]['offset']);}_0x2652b5[_0x17ed('0x38')]=qs[_0x17ed('0x39')](_0x128c53[_0x17ed('0x30')][_0x17ed('0x39')]);_0x2652b5[_0x17ed('0x3a')]=qs[_0x17ed('0x32')](_[_0x17ed('0x3b')](_0x128c53[_0x17ed('0x30')],_0x113b17['filters']),_0x34a5a4);if(_0x128c53[_0x17ed('0x30')][_0x17ed('0x3c')]){_0x2652b5[_0x17ed('0x3a')]=_['merge'](_0x2652b5[_0x17ed('0x3a')],{'$or':_['map'](_0x34a5a4,function(_0x3a28b9){if(_0x3a28b9[_0x17ed('0x2d')]!==_0x17ed('0x3d')){var _0x359373={};_0x359373[_0x3a28b9['name']]={'$like':'%'+_0x128c53[_0x17ed('0x30')][_0x17ed('0x3c')]+'%'};return _0x359373;}})});}_0x2652b5=_[_0x17ed('0x3e')]({},_0x2652b5,_0x128c53[_0x17ed('0x3f')]);var _0x35e53c={'where':_0x2652b5[_0x17ed('0x3a')]};return db[_0x17ed('0x40')]['count'](_0x35e53c)['then'](function(_0x4fdce3){_0x28acc6[_0x17ed('0x1d')]=_0x4fdce3;if(_0x128c53['query'][_0x17ed('0x41')]){_0x2652b5[_0x17ed('0x42')]=[{'all':!![]}];}return db['Attachment'][_0x17ed('0x43')](_0x2652b5);})[_0x17ed('0x23')](function(_0x318d1d){_0x28acc6['rows']=_0x318d1d;return _0x28acc6;})[_0x17ed('0x23')](respondWithFilteredResult(_0x26f616,_0x2652b5))['catch'](handleError(_0x26f616,null));};exports[_0x17ed('0x44')]=function(_0x4edc7a,_0x4843f3){var _0x5b6e00={'raw':!![],'where':{'id':_0x4edc7a['params']['id']}},_0x55fbf2={};_0x55fbf2[_0x17ed('0x2f')]=_['keys'](db[_0x17ed('0x40')][_0x17ed('0x2c')]);_0x55fbf2[_0x17ed('0x30')]=_[_0x17ed('0x31')](_0x4edc7a[_0x17ed('0x30')]);_0x55fbf2[_0x17ed('0x32')]=_['intersection'](_0x55fbf2[_0x17ed('0x2f')],_0x55fbf2[_0x17ed('0x30')]);_0x5b6e00[_0x17ed('0x35')]=_['intersection'](_0x55fbf2[_0x17ed('0x2f')],qs[_0x17ed('0x34')](_0x4edc7a[_0x17ed('0x30')][_0x17ed('0x34')]));_0x5b6e00[_0x17ed('0x35')]=_0x5b6e00[_0x17ed('0x35')][_0x17ed('0x45')]?_0x5b6e00['attributes']:_0x55fbf2[_0x17ed('0x2f')];if(_0x4edc7a[_0x17ed('0x30')][_0x17ed('0x41')]){_0x5b6e00[_0x17ed('0x42')]=[{'all':!![]}];}_0x5b6e00=_['merge']({},_0x5b6e00,_0x4edc7a[_0x17ed('0x3f')]);return db[_0x17ed('0x40')][_0x17ed('0x46')](_0x5b6e00)[_0x17ed('0x23')](handleEntityNotFound(_0x4843f3,null))[_0x17ed('0x23')](respondWithResult(_0x4843f3,null))[_0x17ed('0x47')](handleError(_0x4843f3,null));};exports[_0x17ed('0x48')]=function(_0x5ef02f,_0x47df27){var _0xa1a40d={'where':{'id':_0x5ef02f['params']['id']}},_0x2dcb71={};_0x2dcb71['model']=_[_0x17ed('0x31')](db[_0x17ed('0x40')][_0x17ed('0x2c')]);_0xa1a40d[_0x17ed('0x35')]=_[_0x17ed('0x33')](_0x2dcb71[_0x17ed('0x2f')],qs[_0x17ed('0x34')](_0x5ef02f[_0x17ed('0x30')]['fields']));_0xa1a40d[_0x17ed('0x35')]=_0xa1a40d[_0x17ed('0x35')][_0x17ed('0x45')]?_0xa1a40d['attributes']:_0x2dcb71[_0x17ed('0x2f')];if(_0x5ef02f[_0x17ed('0x30')][_0x17ed('0x41')]){_0xa1a40d[_0x17ed('0x42')]=[{'all':!![]}];}_0xa1a40d=_[_0x17ed('0x3e')]({},_0xa1a40d,_0x5ef02f[_0x17ed('0x3f')]);return db['Attachment'][_0x17ed('0x46')](_0xa1a40d)[_0x17ed('0x23')](handleEntityNotFound(_0x47df27,null))[_0x17ed('0x23')](function(_0x2bae98){if(_0x2bae98){var _0x564ca7=_0x2bae98[_0x17ed('0x49')]({'plain':!![]});_0x564ca7=qs['omit'](_0x564ca7,['id',_0x17ed('0x4a'),_0x17ed('0x4b')]);_0x5ef02f['body']=_[_0x17ed('0x4c')](_0x5ef02f[_0x17ed('0x4d')],['id',_0x17ed('0x4a'),_0x17ed('0x4b')]);return db['Attachment'][_0x17ed('0x4e')](_[_0x17ed('0x3e')](_0x564ca7,_0x5ef02f[_0x17ed('0x4d')]),{'include':_0x5ef02f['query']['includeAll']?[{'all':!![]}]:undefined});}})[_0x17ed('0x23')](respondWithResult(_0x47df27,0xc9))[_0x17ed('0x47')](handleError(_0x47df27,null));};exports[_0x17ed('0x4f')]=function(_0x5d68c8,_0x376580){if(_0x5d68c8[_0x17ed('0x4d')]['id']){delete _0x5d68c8['body']['id'];}return db[_0x17ed('0x40')][_0x17ed('0x46')]({'where':{'id':_0x5d68c8[_0x17ed('0x50')]['id']}})['then'](handleEntityNotFound(_0x376580,null))[_0x17ed('0x23')](saveUpdates(_0x5d68c8[_0x17ed('0x4d')],null))[_0x17ed('0x23')](respondWithResult(_0x376580,null))['catch'](handleError(_0x376580,null));};exports[_0x17ed('0x24')]=function(_0x3af35d,_0x4c8d0a){return db[_0x17ed('0x40')]['find']({'where':{'id':_0x3af35d['params']['id']}})[_0x17ed('0x23')](handleEntityNotFound(_0x4c8d0a,null))[_0x17ed('0x23')](removeEntity(_0x4c8d0a,null))[_0x17ed('0x47')](handleError(_0x4c8d0a,null));};exports[_0x17ed('0x4e')]=function(_0x26d374,_0x37c50c,_0x488539){_0x26d374[_0x17ed('0x4d')][_0x17ed('0x28')]=_0x26d374[_0x17ed('0x51')][_0x17ed('0x52')];_0x26d374[_0x17ed('0x4d')][_0x17ed('0x53')]=_0x26d374['file'][_0x17ed('0x54')];_0x26d374[_0x17ed('0x4d')]['type']=_0x26d374[_0x17ed('0x51')][_0x17ed('0x55')];return db[_0x17ed('0x40')][_0x17ed('0x4e')](_0x26d374[_0x17ed('0x4d')])[_0x17ed('0x23')](respondWithResult(_0x37c50c,0xc9))[_0x17ed('0x47')](handleError(_0x37c50c,null));};exports[_0x17ed('0x56')]=function(_0x26b826,_0x3b7882,_0x18d900){return db[_0x17ed('0x40')]['findOne']({'where':{'id':_0x26b826['params']['id']},'raw':!![]})['then'](handleEntityNotFound(_0x3b7882,null))[_0x17ed('0x23')](function(_0x18c23b){if(_0x18c23b){var _0x296af6=_0x18c23b['ChatOfflineMessageId']!==null;var _0x40c64c=path[_0x17ed('0x57')](config[_0x17ed('0x58')],_0x17ed('0x59'));if(_0x296af6){_0x40c64c=path['join'](_0x40c64c,_0x17ed('0x5a'));}var _0x309ea0=path[_0x17ed('0x57')](_0x40c64c,_0x18c23b[_0x17ed('0x53')]);return _0x3b7882[_0x17ed('0x56')](_0x309ea0);}})[_0x17ed('0x47')](handleError(_0x3b7882,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 5bdb69c..644fce2 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 _0xd12c=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./attachment.attributes','exports','define','attachments','lodash'];(function(_0x4f9204,_0x5c4f49){var _0x3780b3=function(_0xea99a9){while(--_0xea99a9){_0x4f9204['push'](_0x4f9204['shift']());}};_0x3780b3(++_0x5c4f49);}(_0xd12c,0x16b));var _0xcd12=function(_0xeaf2ab,_0x59c9b8){_0xeaf2ab=_0xeaf2ab-0x0;var _0x33422a=_0xd12c[_0xeaf2ab];return _0x33422a;};'use strict';var _=require(_0xcd12('0x0'));var util=require(_0xcd12('0x1'));var logger=require(_0xcd12('0x2'))(_0xcd12('0x3'));var moment=require(_0xcd12('0x4'));var BPromise=require(_0xcd12('0x5'));var rp=require(_0xcd12('0x6'));var fs=require('fs');var path=require(_0xcd12('0x7'));var rimraf=require(_0xcd12('0x8'));var config=require(_0xcd12('0x9'));var attributes=require(_0xcd12('0xa'));module[_0xcd12('0xb')]=function(_0x516db7,_0x11c0d6){return _0x516db7[_0xcd12('0xc')]('Attachment',attributes,{'tableName':_0xcd12('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb911=['exports','define','Attachment','attachments','lodash','util','../../config/logger','api','../../config/environment'];(function(_0x122c2e,_0x4a0110){var _0x560a4e=function(_0x55fb16){while(--_0x55fb16){_0x122c2e['push'](_0x122c2e['shift']());}};_0x560a4e(++_0x4a0110);}(_0xb911,0x79));var _0x1b91=function(_0x243b2f,_0x30aa15){_0x243b2f=_0x243b2f-0x0;var _0xcb3c2d=_0xb911[_0x243b2f];return _0xcb3c2d;};'use strict';var _=require(_0x1b91('0x0'));var util=require(_0x1b91('0x1'));var logger=require(_0x1b91('0x2'))(_0x1b91('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1b91('0x4'));var attributes=require('./attachment.attributes');module[_0x1b91('0x5')]=function(_0x11c6d0,_0x5a79bf){return _0x11c6d0[_0x1b91('0x6')](_0x1b91('0x7'),attributes,{'tableName':_0x1b91('0x8'),'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 6501f30..7670291 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 _0x00b3=['Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','CreateAttachment','create','body','options','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x1e2321,_0x3ae1c5){var _0x1d346d=function(_0x24f171){while(--_0x24f171){_0x1e2321['push'](_0x1e2321['shift']());}};_0x1d346d(++_0x3ae1c5);}(_0x00b3,0x17a));var _0x300b=function(_0x257df1,_0xd301fd){_0x257df1=_0x257df1-0x0;var _0x2e5d03=_0x00b3[_0x257df1];return _0x2e5d03;};'use strict';var _=require('lodash');var util=require(_0x300b('0x0'));var moment=require(_0x300b('0x1'));var BPromise=require(_0x300b('0x2'));var rs=require(_0x300b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x300b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x300b('0x5'))('rpc');var config=require(_0x300b('0x6'));var jayson=require(_0x300b('0x7'));var client=jayson[_0x300b('0x8')][_0x300b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5af470,_0x5dabb9,_0x30b3fe){return new BPromise(function(_0x590c4d,_0x5e283c){return client[_0x300b('0xa')](_0x5af470,_0x30b3fe)[_0x300b('0xb')](function(_0x457aa3){logger['info'](_0x300b('0xc'),_0x5dabb9,_0x300b('0xd'));logger[_0x300b('0xe')](_0x300b('0xf'),_0x5dabb9,'request\x20sent',JSON[_0x300b('0x10')](_0x457aa3));if(_0x457aa3[_0x300b('0x11')]){if(_0x457aa3[_0x300b('0x11')]['code']===0x1f4){logger[_0x300b('0x11')](_0x300b('0xc'),_0x5dabb9,_0x457aa3[_0x300b('0x11')][_0x300b('0x12')]);return _0x5e283c(_0x457aa3[_0x300b('0x11')][_0x300b('0x12')]);}logger[_0x300b('0x11')](_0x300b('0xc'),_0x5dabb9,_0x457aa3['error']['message']);return _0x590c4d(_0x457aa3['error']['message']);}else{logger[_0x300b('0x13')](_0x300b('0xc'),_0x5dabb9,_0x300b('0xd'));_0x590c4d(_0x457aa3[_0x300b('0x14')]['message']);}})['catch'](function(_0x35b1d7){logger[_0x300b('0x11')](_0x300b('0xc'),_0x5dabb9,_0x35b1d7);_0x5e283c(_0x35b1d7);});});}exports[_0x300b('0x15')]=function(_0x4d2024){var _0x1fbf16=this;return new Promise(function(_0x2a7d96,_0xb4b3fa){return db['Attachment'][_0x300b('0x16')](_0x4d2024[_0x300b('0x17')],{'raw':_0x4d2024[_0x300b('0x18')]?_0x4d2024[_0x300b('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x300b('0xb')](function(_0x16bfc6){logger[_0x300b('0x13')]('CreateAttachment',_0x4d2024);logger[_0x300b('0xe')](_0x300b('0x15'),_0x4d2024,JSON[_0x300b('0x10')](_0x16bfc6));_0x2a7d96(_0x16bfc6);})[_0x300b('0x19')](function(_0x26913f){logger['error']('CreateAttachment',_0x26913f[_0x300b('0x12')],_0x4d2024);_0xb4b3fa(_0x1fbf16[_0x300b('0x11')](0x1f4,_0x26913f[_0x300b('0x12')]));});});}; \ No newline at end of file +var _0xc964=['request\x20sent','stringify','error','Attachment,\x20%s,\x20%s','message','result','Attachment','create','body','options','raw','then','catch','CreateAttachment','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','Attachment,\x20%s,\x20%s,\x20%s'];(function(_0x5b101b,_0xfc548d){var _0xa1eae7=function(_0x15e59){while(--_0x15e59){_0x5b101b['push'](_0x5b101b['shift']());}};_0xa1eae7(++_0xfc548d);}(_0xc964,0x7e));var _0x4c96=function(_0x32f4d5,_0x3f4ed6){_0x32f4d5=_0x32f4d5-0x0;var _0x79f05c=_0xc964[_0x32f4d5];return _0x79f05c;};'use strict';var _=require(_0x4c96('0x0'));var util=require(_0x4c96('0x1'));var moment=require('moment');var BPromise=require(_0x4c96('0x2'));var rs=require(_0x4c96('0x3'));var fs=require('fs');var Redis=require(_0x4c96('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4c96('0x5'));var logger=require('../../config/logger')(_0x4c96('0x6'));var config=require(_0x4c96('0x7'));var jayson=require(_0x4c96('0x8'));var client=jayson[_0x4c96('0x9')][_0x4c96('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1fa8a0,_0x4070a5,_0x493618){return new BPromise(function(_0x19ed76,_0xaa3f20){return client[_0x4c96('0xb')](_0x1fa8a0,_0x493618)['then'](function(_0x208911){logger[_0x4c96('0xc')]('Attachment,\x20%s,\x20%s',_0x4070a5,'request\x20sent');logger['debug'](_0x4c96('0xd'),_0x4070a5,_0x4c96('0xe'),JSON[_0x4c96('0xf')](_0x208911));if(_0x208911['error']){if(_0x208911[_0x4c96('0x10')]['code']===0x1f4){logger['error'](_0x4c96('0x11'),_0x4070a5,_0x208911[_0x4c96('0x10')][_0x4c96('0x12')]);return _0xaa3f20(_0x208911['error']['message']);}logger[_0x4c96('0x10')](_0x4c96('0x11'),_0x4070a5,_0x208911[_0x4c96('0x10')]['message']);return _0x19ed76(_0x208911[_0x4c96('0x10')][_0x4c96('0x12')]);}else{logger[_0x4c96('0xc')](_0x4c96('0x11'),_0x4070a5,_0x4c96('0xe'));_0x19ed76(_0x208911[_0x4c96('0x13')][_0x4c96('0x12')]);}})['catch'](function(_0x388237){logger['error'](_0x4c96('0x11'),_0x4070a5,_0x388237);_0xaa3f20(_0x388237);});});}exports['CreateAttachment']=function(_0x2453e0){var _0x494a26=this;return new Promise(function(_0x17891b,_0x1807b6){return db[_0x4c96('0x14')][_0x4c96('0x15')](_0x2453e0[_0x4c96('0x16')],{'raw':_0x2453e0[_0x4c96('0x17')]?_0x2453e0[_0x4c96('0x17')][_0x4c96('0x18')]===undefined?!![]:![]:!![]})[_0x4c96('0x19')](function(_0x9546c5){logger[_0x4c96('0xc')]('CreateAttachment',_0x2453e0);logger['debug']('CreateAttachment',_0x2453e0,JSON[_0x4c96('0xf')](_0x9546c5));_0x17891b(_0x9546c5);})[_0x4c96('0x1a')](function(_0x29f3a3){logger[_0x4c96('0x10')](_0x4c96('0x1b'),_0x29f3a3[_0x4c96('0x12')],_0x2453e0);_0x1807b6(_0x494a26['error'](0x1f4,_0x29f3a3[_0x4c96('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index a00d655..a929d2b 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 _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(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0x5f66,0x1a0));var _0x65f6=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0x5f66[_0x122096];return _0x3d1966;};'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 +var _0xb10b=['originalname','replace','single','file','create','put','/:id','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','index','isAuthenticated','show','/:id/download','download','post','/:id/clone','diskStorage','join','server/files/attachments/','format','%s-%s'];(function(_0x1058bc,_0x42c035){var _0x3b50b4=function(_0x51aa51){while(--_0x51aa51){_0x1058bc['push'](_0x1058bc['shift']());}};_0x3b50b4(++_0x42c035);}(_0xb10b,0x12a));var _0xbb10=function(_0x15c068,_0x441624){_0x15c068=_0x15c068-0x0;var _0x369daf=_0xb10b[_0x15c068];return _0x369daf;};'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('0xf')](_0xbb10('0x10'),auth['isAuthenticated'](),controller['clone']);var upload=multer({'storage':multer[_0xbb10('0x11')]({'destination':function(_0x118a74,_0xce64f3,_0x5e136d){_0x5e136d(null,path[_0xbb10('0x12')](config['root'],_0xbb10('0x13')));},'filename':function(_0x916a32,_0x285009,_0x193a27){_0x193a27(null,util[_0xbb10('0x14')](_0xbb10('0x15'),Date['now'](),_0x285009[_0xbb10('0x16')][_0xbb10('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xbb10('0xf')]('/',upload[_0xbb10('0x18')](_0xbb10('0x19')),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')](_0xbb10('0x1c'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1d')]);router['delete'](_0xbb10('0x1c'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);module[_0xbb10('0x1f')]=router; \ No newline at end of file diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index 9d3bb68..cefc9a4 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 _0xa793=['domain','authenticate','Error\x20authenticate\x20%s:\x20%s','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','adSsoEnabled','blockDuration','then','error','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','findOne','name','password','salt','role','disabled','blockedAt','online','admin','user','agent','blocked','add','clearBlockUser','getLicense','status','send','message','ad-login','json','use','User','passport-local','moment','activedirectory2','bluebird','util','../../mysqldb','../../config/environment','../../config/logger','api','activedirectory','undefined','baseDN','url'];(function(_0x398a18,_0xe73c44){var _0x388956=function(_0x44ff0d){while(--_0x44ff0d){_0x398a18['push'](_0x398a18['shift']());}};_0x388956(++_0xe73c44);}(_0xa793,0x101));var _0x3a79=function(_0x5a6961,_0xd41ca6){_0x5a6961=_0x5a6961-0x0;var _0x4af0a6=_0xa793[_0x5a6961];return _0x4af0a6;};'use strict';var passport=require('passport');var LocalStrategy=require(_0x3a79('0x0'))['Strategy'];var moment=require(_0x3a79('0x1'));var ActiveDirectory=require(_0x3a79('0x2'));var BPromise=require(_0x3a79('0x3'));var util=require(_0x3a79('0x4'));var db=require(_0x3a79('0x5'))['db'];var authService=require('../../components/auth/service');var utils=require('../../config/utils');var config=require(_0x3a79('0x6'));var logger=require(_0x3a79('0x7'))(_0x3a79('0x8'));function isActiveDirectoryConfigured(_0x4f472c){var _0x1b85e7=![];if(typeof _0x4f472c[_0x3a79('0x9')]!==_0x3a79('0xa')){_0x1b85e7=_0x4f472c[_0x3a79('0x9')][_0x3a79('0xb')]&&_0x4f472c['activedirectory'][_0x3a79('0xc')]&&_0x4f472c[_0x3a79('0x9')][_0x3a79('0xd')];}return _0x1b85e7;}function adAuthenticate(_0xba653a,_0x2759eb,_0x110ed9){return new BPromise(function(_0x2eb752,_0x53875c){try{var _0x190095=new ActiveDirectory(_0xba653a);_0x190095[_0x3a79('0xe')](_0x2759eb,_0x110ed9,function(_0x1c318a,_0x2aa4d8){if(_0x1c318a){logger['error'](_0x3a79('0xf'),_0x2759eb,util['inspect'](_0x1c318a,{'showHidden':![],'depth':null}));_0x53875c(_0x3a79('0x10'));}else if(!_0x2aa4d8){logger['error'](_0x3a79('0x11'),_0x2759eb);_0x53875c(_0x3a79('0x10'));}else{_0x2eb752(_0x2aa4d8);}});}catch(_0x4b5214){_0x53875c(_0x4b5214);}});}function ActiveDirectoryAuthenticate(_0x2c3081,_0x1e68f2,_0x173c7e,_0x303e70){var _0xaff34d,_0x317a25;if(!isActiveDirectoryConfigured(config)){logger['error']('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured',_0x1e68f2);return _0x303e70(null,![],{'message':_0x3a79('0x10')});}return db['Setting']['findOne']({'where':{'id':0x1},'attributes':[_0x3a79('0x12'),_0x3a79('0x13')],'raw':!![]})[_0x3a79('0x14')](function(_0x4747eb){_0xaff34d=_0x4747eb;if(!_0xaff34d[_0x3a79('0x12')]){logger[_0x3a79('0x15')](_0x3a79('0x16'),_0x1e68f2);throw new Error(_0x3a79('0x10'));}return _0x2c3081[_0x3a79('0x17')]({'logging':!![],'attributes':['id',_0x3a79('0x18'),_0x3a79('0x19'),_0x3a79('0x1a'),_0x3a79('0x1b'),_0x3a79('0x1c'),'blocked',_0x3a79('0x1d'),_0x3a79('0x1e')],'where':{'name':_0x1e68f2,'role':{'$or':[_0x3a79('0x1f'),_0x3a79('0x20'),_0x3a79('0x21')]},'adSsoEnabled':!![]}});})['then'](function(_0x1da20a){if(!_0x1da20a||_0x1da20a&&_0x1da20a['name']!==_0x1e68f2){throw new Error(_0x3a79('0x10'));}_0x317a25=_0x1da20a;var _0x37936f=_0x317a25[_0x3a79('0x18')]+'@'+config['activedirectory'][_0x3a79('0xd')];return adAuthenticate(config['activedirectory'],_0x37936f,_0x173c7e);})['then'](function(_0x5d0c0d){if(_0x317a25[_0x3a79('0x1c')]){throw new Error(_0x3a79('0x10'));}if(_0xaff34d[_0x3a79('0x13')]>0x0){if(_0x317a25[_0x3a79('0x22')]){if(moment(_0x317a25[_0x3a79('0x1d')])[_0x3a79('0x23')](_0xaff34d[_0x3a79('0x13')],'minutes')>moment()){throw new Error(_0x3a79('0x10'));}return utils[_0x3a79('0x24')](_0x317a25,0x0,![],null)[_0x3a79('0x14')](function(){return utils[_0x3a79('0x25')](_0x317a25);})[_0x3a79('0x14')](function(){return _0x303e70(null,_0x317a25);});}else{return utils[_0x3a79('0x25')](_0x317a25)['then'](function(){return _0x303e70(null,_0x317a25);});}}else{return utils[_0x3a79('0x25')](_0x317a25)[_0x3a79('0x14')](function(){return _0x303e70(null,_0x317a25);});}})['catch'](function(_0x2c47e6){return _0x303e70(null,![],_0x2c47e6);});}function handleError(_0x2d1476,_0x145054,_0x3a1a50){return _0x2d1476[_0x3a79('0x26')](_0x145054||0x1f4)[_0x3a79('0x27')]({'message':_0x3a1a50?_0x3a1a50[_0x3a79('0x28')]||_0x3a1a50:''});}exports['login']=function(_0x535d53,_0x225669,_0x231c0e){passport[_0x3a79('0xe')](_0x3a79('0x29'),function(_0xfb7024,_0x505b87,_0xf8181b){var _0x3feaed=_0xfb7024||_0xf8181b;if(_0x3feaed){return handleError(_0x225669,0x191,_0x3feaed);}if(!_0x505b87){return handleError(_0x225669,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x525cf2={'payload':{'id':_0x505b87['id'],'role':_0x505b87['role']},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x525cf2)['then'](function(_0x5ef893){_0x225669[_0x3a79('0x2a')]({'id':_0x505b87['id'],'token':_0x5ef893,'statusCall':'','isAlreadyLogged':_0x505b87[_0x3a79('0x1e')]});});}})(_0x535d53,_0x225669,_0x231c0e);};passport[_0x3a79('0x2b')](_0x3a79('0x29'),new LocalStrategy({'usernameField':'name','passwordField':'password'},function(_0x55870b,_0x1c85e6,_0x11bc76){return ActiveDirectoryAuthenticate(db[_0x3a79('0x2c')],_0x55870b,_0x1c85e6,_0x11bc76);})); \ No newline at end of file +var _0xc503=['admin','user','agent','domain','blocked','minutes','clearBlockUser','getLicense','status','send','ad-login','role','online','use','User','passport','passport-local','moment','activedirectory2','bluebird','util','../../components/auth/service','../../config/utils','../../config/logger','activedirectory','undefined','baseDN','url','authenticate','inspect','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','error','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','adSsoEnabled','blockDuration','then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','findOne','name','password','salt','disabled','blockedAt'];(function(_0x23fdb2,_0x1e71e9){var _0x353754=function(_0x2f1b63){while(--_0x2f1b63){_0x23fdb2['push'](_0x23fdb2['shift']());}};_0x353754(++_0x1e71e9);}(_0xc503,0x111));var _0x3c50=function(_0x31e5cb,_0x2f5adf){_0x31e5cb=_0x31e5cb-0x0;var _0x4170df=_0xc503[_0x31e5cb];return _0x4170df;};'use strict';var passport=require(_0x3c50('0x0'));var LocalStrategy=require(_0x3c50('0x1'))['Strategy'];var moment=require(_0x3c50('0x2'));var ActiveDirectory=require(_0x3c50('0x3'));var BPromise=require(_0x3c50('0x4'));var util=require(_0x3c50('0x5'));var db=require('../../mysqldb')['db'];var authService=require(_0x3c50('0x6'));var utils=require(_0x3c50('0x7'));var config=require('../../config/environment');var logger=require(_0x3c50('0x8'))('api');function isActiveDirectoryConfigured(_0x2bf1a9){var _0x2b76ac=![];if(typeof _0x2bf1a9[_0x3c50('0x9')]!==_0x3c50('0xa')){_0x2b76ac=_0x2bf1a9[_0x3c50('0x9')][_0x3c50('0xb')]&&_0x2bf1a9['activedirectory'][_0x3c50('0xc')]&&_0x2bf1a9[_0x3c50('0x9')]['domain'];}return _0x2b76ac;}function adAuthenticate(_0x201d1b,_0x1d92e1,_0x4cbe21){return new BPromise(function(_0x2a21bd,_0x63d884){try{var _0x1eb63a=new ActiveDirectory(_0x201d1b);_0x1eb63a[_0x3c50('0xd')](_0x1d92e1,_0x4cbe21,function(_0x375805,_0x2c7da9){if(_0x375805){logger['error']('Error\x20authenticate\x20%s:\x20%s',_0x1d92e1,util[_0x3c50('0xe')](_0x375805,{'showHidden':![],'depth':null}));_0x63d884('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(!_0x2c7da9){logger['error'](_0x3c50('0xf'),_0x1d92e1);_0x63d884('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x2a21bd(_0x2c7da9);}});}catch(_0x5cff26){_0x63d884(_0x5cff26);}});}function ActiveDirectoryAuthenticate(_0x3ff04d,_0x4f6249,_0x438ba5,_0x5094ff){var _0x542b8a,_0xcad7ec;if(!isActiveDirectoryConfigured(config)){logger[_0x3c50('0x10')]('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured',_0x4f6249);return _0x5094ff(null,![],{'message':_0x3c50('0x11')});}return db['Setting']['findOne']({'where':{'id':0x1},'attributes':[_0x3c50('0x12'),_0x3c50('0x13')],'raw':!![]})[_0x3c50('0x14')](function(_0x1631d0){_0x542b8a=_0x1631d0;if(!_0x542b8a[_0x3c50('0x12')]){logger['error'](_0x3c50('0x15'),_0x4f6249);throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return _0x3ff04d[_0x3c50('0x16')]({'logging':!![],'attributes':['id',_0x3c50('0x17'),_0x3c50('0x18'),_0x3c50('0x19'),'role',_0x3c50('0x1a'),'blocked',_0x3c50('0x1b'),'online'],'where':{'name':_0x4f6249,'role':{'$or':[_0x3c50('0x1c'),_0x3c50('0x1d'),_0x3c50('0x1e')]},'adSsoEnabled':!![]}});})[_0x3c50('0x14')](function(_0x30fc2b){if(!_0x30fc2b||_0x30fc2b&&_0x30fc2b['name']!==_0x4f6249){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}_0xcad7ec=_0x30fc2b;var _0x1f0944=_0xcad7ec[_0x3c50('0x17')]+'@'+config[_0x3c50('0x9')][_0x3c50('0x1f')];return adAuthenticate(config[_0x3c50('0x9')],_0x1f0944,_0x438ba5);})[_0x3c50('0x14')](function(_0x50338c){if(_0xcad7ec[_0x3c50('0x1a')]){throw new Error(_0x3c50('0x11'));}if(_0x542b8a['blockDuration']>0x0){if(_0xcad7ec[_0x3c50('0x20')]){if(moment(_0xcad7ec['blockedAt'])['add'](_0x542b8a[_0x3c50('0x13')],_0x3c50('0x21'))>moment()){throw new Error(_0x3c50('0x11'));}return utils[_0x3c50('0x22')](_0xcad7ec,0x0,![],null)[_0x3c50('0x14')](function(){return utils['getLicense'](_0xcad7ec);})['then'](function(){return _0x5094ff(null,_0xcad7ec);});}else{return utils[_0x3c50('0x23')](_0xcad7ec)[_0x3c50('0x14')](function(){return _0x5094ff(null,_0xcad7ec);});}}else{return utils['getLicense'](_0xcad7ec)[_0x3c50('0x14')](function(){return _0x5094ff(null,_0xcad7ec);});}})['catch'](function(_0x449cfa){return _0x5094ff(null,![],_0x449cfa);});}function handleError(_0x3c0b62,_0x8f671d,_0x1dd0bc){return _0x3c0b62[_0x3c50('0x24')](_0x8f671d||0x1f4)[_0x3c50('0x25')]({'message':_0x1dd0bc?_0x1dd0bc['message']||_0x1dd0bc:''});}exports['login']=function(_0x53b3e7,_0x427882,_0x102640){passport['authenticate'](_0x3c50('0x26'),function(_0x224082,_0x411e04,_0x184342){var _0x136e1a=_0x224082||_0x184342;if(_0x136e1a){return handleError(_0x427882,0x191,_0x136e1a);}if(!_0x411e04){return handleError(_0x427882,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x2c6878={'payload':{'id':_0x411e04['id'],'role':_0x411e04[_0x3c50('0x27')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x2c6878)[_0x3c50('0x14')](function(_0x2268f7){_0x427882['json']({'id':_0x411e04['id'],'token':_0x2268f7,'statusCall':'','isAlreadyLogged':_0x411e04[_0x3c50('0x28')]});});}})(_0x53b3e7,_0x427882,_0x102640);};passport[_0x3c50('0x29')]('ad-login',new LocalStrategy({'usernameField':_0x3c50('0x17'),'passwordField':_0x3c50('0x18')},function(_0x3f4831,_0x2babc9,_0x30e6de){return ActiveDirectoryAuthenticate(db[_0x3c50('0x2a')],_0x3f4831,_0x2babc9,_0x30e6de);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index 5756b3b..95d91d5 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 _0x70ae=['Router','post'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x70ae,0x182));var _0xe70a=function(_0x339854,_0x5cae3f){_0x339854=_0x339854-0x0;var _0x4b10aa=_0x70ae[_0x339854];return _0x4b10aa;};'use strict';var express=require('express');var router=express[_0xe70a('0x0')]();var controller=require('./authActiveDirectory.controller');router[_0xe70a('0x1')]('/',controller['login']);module['exports']=router; \ No newline at end of file +var _0xb5f6=['login','exports','express','Router'];(function(_0x591e16,_0x5aefc1){var _0x543b35=function(_0x81e3be){while(--_0x81e3be){_0x591e16['push'](_0x591e16['shift']());}};_0x543b35(++_0x5aefc1);}(_0xb5f6,0x96));var _0x6b5f=function(_0x149ca0,_0x2ac7f5){_0x149ca0=_0x149ca0-0x0;var _0x56b6b9=_0xb5f6[_0x149ca0];return _0x56b6b9;};'use strict';var express=require(_0x6b5f('0x0'));var router=express[_0x6b5f('0x1')]();var controller=require('./authActiveDirectory.controller');router['post']('/',controller[_0x6b5f('0x2')]);module[_0x6b5f('0x3')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 0fb0f79..ffdec93 100644 --- a/server/api/authGoogle/authGoogle.controller.js +++ b/server/api/authGoogle/authGoogle.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['../../config/environment','../../config/utils','login','google','/login','profile','email','callback','authenticate','use','clientID','clientSecret','secret','callbackURL','Setting','findOne','allowedLoginAttempts','User','find','map','emails','value','admin','user','then','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','blocked','blockedAt','add','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','../../mysqldb'];(function(_0x50641e,_0x3bc2fe){var _0x426fa1=function(_0x509a53){while(--_0x509a53){_0x50641e['push'](_0x50641e['shift']());}};_0x426fa1(++_0x3bc2fe);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x7995('0x0'));var passport=require(_0x7995('0x1'));var GoogleStrategy=require(_0x7995('0x2'))[_0x7995('0x3')];var moment=require('moment');var db=require(_0x7995('0x4'))['db'];var config=require(_0x7995('0x5'));var utils=require(_0x7995('0x6'));exports[_0x7995('0x7')]=passport['authenticate'](_0x7995('0x8'),{'failureRedirect':_0x7995('0x9'),'scope':[_0x7995('0xa'),_0x7995('0xb')],'session':![]});exports[_0x7995('0xc')]=passport[_0x7995('0xd')]('google',{'failureRedirect':_0x7995('0x9'),'session':![]});passport[_0x7995('0xe')](new GoogleStrategy({'clientID':config['google']?config[_0x7995('0x8')][_0x7995('0xf')]:'id','clientSecret':config[_0x7995('0x8')]?config[_0x7995('0x8')][_0x7995('0x10')]:_0x7995('0x11'),'callbackURL':config[_0x7995('0x8')]?config['google'][_0x7995('0x12')]:''},function(_0x41c652,_0x581f22,_0xb0c872,_0x2cb37a){var _0x19a27e,_0x385f00;return db[_0x7995('0x13')][_0x7995('0x14')]({'where':{'id':0x1},'attributes':[_0x7995('0x15'),'blockDuration'],'raw':!![]})['then'](function(_0x2b4e94){_0x19a27e=_0x2b4e94;return db[_0x7995('0x16')][_0x7995('0x17')]({'where':{'email':_[_0x7995('0x18')](_0xb0c872[_0x7995('0x19')],_0x7995('0x1a')),'role':{'$or':[_0x7995('0x1b'),_0x7995('0x1c'),'agent']}}});})[_0x7995('0x1d')](function(_0x565d97){_0x385f00=_0x565d97;if(_0x385f00){if(_0x385f00[_0x7995('0x1e')]){return _0x2cb37a(_0x7995('0x1f'));}else if(_0x19a27e[_0x7995('0x20')]>0x0){if(_0x385f00[_0x7995('0x21')]){if(moment(_0x385f00[_0x7995('0x22')])[_0x7995('0x23')](_0x19a27e['blockDuration'],'minutes')>moment()){return _0x2cb37a(_0x7995('0x1f'));}else{return utils['clearBlockUser'](_0x385f00,0x0,![],null)['then'](function(){return utils[_0x7995('0x24')](_0x385f00);})[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)['then'](function(){return _0x2cb37a(null,_0x385f00);});}}return _0x2cb37a(_0x7995('0x1f'));})[_0x7995('0x25')](function(_0x350fd9){_0x2cb37a(_0x350fd9);});})); \ No newline at end of file +var _0x7a54=['blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','moment','../../mysqldb','../../config/utils','login','authenticate','google','/login','email','use','secret','callbackURL','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','value','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x7a54,0x106));var _0x47a5=function(_0x27125b,_0x2ea463){_0x27125b=_0x27125b-0x0;var _0x183f15=_0x7a54[_0x27125b];return _0x183f15;};'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 df8c7a6..1a51c4a 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 _0x5294=['./authGoogle.controller','../user/user.controller.js','../../components/auth/service','login','get','/callback','isMiddleware','setTokenCookie','exports','express','passport','Router'];(function(_0x39e5a8,_0x367273){var _0x5c9feb=function(_0x5a372e){while(--_0x5a372e){_0x39e5a8['push'](_0x39e5a8['shift']());}};_0x5c9feb(++_0x367273);}(_0x5294,0x111));var _0x4529=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x5294[_0x501510];return _0x1e6ee5;};'use strict';var express=require(_0x4529('0x0'));var passport=require(_0x4529('0x1'));var router=express[_0x4529('0x2')]();var controller=require(_0x4529('0x3'));var userController=require(_0x4529('0x4'));var authService=require(_0x4529('0x5'));router['get']('/',controller[_0x4529('0x6')]);router[_0x4529('0x7')](_0x4529('0x8'),controller['callback'],authService[_0x4529('0x9')],userController[_0x4529('0x6')],authService[_0x4529('0xa')]);module[_0x4529('0xb')]=router; \ No newline at end of file +var _0x2d48=['login','callback','isMiddleware','exports','express','passport','Router','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','get'];(function(_0x2f0f22,_0x3f4b8d){var _0x44f705=function(_0x187475){while(--_0x187475){_0x2f0f22['push'](_0x2f0f22['shift']());}};_0x44f705(++_0x3f4b8d);}(_0x2d48,0x143));var _0x82d4=function(_0x14a54a,_0x38a5c0){_0x14a54a=_0x14a54a-0x0;var _0x4d1dbe=_0x2d48[_0x14a54a];return _0x4d1dbe;};'use strict';var express=require(_0x82d4('0x0'));var passport=require(_0x82d4('0x1'));var router=express[_0x82d4('0x2')]();var controller=require(_0x82d4('0x3'));var userController=require(_0x82d4('0x4'));var authService=require(_0x82d4('0x5'));router[_0x82d4('0x6')]('/',controller[_0x82d4('0x7')]);router[_0x82d4('0x6')]('/callback',controller[_0x82d4('0x8')],authService[_0x82d4('0x9')],userController[_0x82d4('0x7')],authService['setTokenCookie']);module[_0x82d4('0xa')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 32b573a..3d83522 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 _0x1915=['minutes','clearBlockUser','getLicense','catch','MailAccount','MailServerOut','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','merge','format','user','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','status','send','login','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','body','Email\x20parameter\x20is\x20missing','generate','email','trim','User','find','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','now','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','host','/reset/','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','enforcePasswordHistory','passwordHistoryLimit','securePassword','validatePasswordPattern','previousPasswords','resetPasswordExpires','Password\x20reset!','util','passport','passport-local','lodash','moment','../../mysqldb','../../components/auth/service','../../config/utils','http','Setting','findOne','allowedLoginAttempts','blockDuration','password','salt','role','disabled','blockedAt','loginAttempts','admin','agent','name','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','then','authenticate','blocked','add'];(function(_0x6489f3,_0x4f479c){var _0x5583f5=function(_0x1fbfe5){while(--_0x1fbfe5){_0x6489f3['push'](_0x6489f3['shift']());}};_0x5583f5(++_0x4f479c);}(_0x1915,0xd8));var _0x5191=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x1915[_0x40a045];return _0x1a687c;};'use strict';var util=require(_0x5191('0x0'));var passport=require(_0x5191('0x1'));var LocalStrategy=require(_0x5191('0x2'))['Strategy'];var jayson=require('jayson/promise');var _=require(_0x5191('0x3'));var rs=require('randomstring');var moment=require(_0x5191('0x4'));var db=require(_0x5191('0x5'))['db'];var authService=require(_0x5191('0x6'));var utils=require(_0x5191('0x7'));var client=jayson['client'][_0x5191('0x8')]({'port':0x232b});function localAuthenticate(_0x13eec1,_0x48af03,_0x2b3e3b,_0x31afe5){var _0x5ead24,_0x10b972;return db[_0x5191('0x9')][_0x5191('0xa')]({'where':{'id':0x1},'attributes':[_0x5191('0xb'),_0x5191('0xc')],'raw':!![]})['then'](function(_0x30cb3d){_0x5ead24=_0x30cb3d;return _0x13eec1[_0x5191('0xa')]({'attributes':['id','name',_0x5191('0xd'),_0x5191('0xe'),_0x5191('0xf'),_0x5191('0x10'),'blocked',_0x5191('0x11'),_0x5191('0x12')],'where':{'name':_0x48af03,'role':{'$or':[_0x5191('0x13'),'user',_0x5191('0x14')]}}});})['then'](function(_0x39b916){if(!_0x39b916||_0x39b916&&_0x39b916[_0x5191('0x15')]!==_0x48af03){throw new Error(_0x5191('0x16'));}else{_0x10b972=_0x39b916;return _0x10b972;}})[_0x5191('0x17')](function(){_0x10b972[_0x5191('0x18')](_0x2b3e3b,function(_0x41ecbb,_0x4ef982){var _0x5d2452=_0x10b972[_0x5191('0x12')]+0x1;if(_0x41ecbb){return _0x31afe5(_0x41ecbb);}else if(!_0x4ef982){if(_0x10b972[_0x5191('0x10')]){return _0x31afe5(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x5ead24[_0x5191('0xb')]>0x0){if(_0x10b972[_0x5191('0x19')]){if(_0x5ead24[_0x5191('0xc')]>0x0){if(moment(_0x10b972['blockedAt'])[_0x5191('0x1a')](_0x5ead24[_0x5191('0xc')],_0x5191('0x1b'))>moment()){return _0x31afe5(null,![],{'message':_0x5191('0x16')});}else{return utils[_0x5191('0x1c')](_0x10b972,_0x5d2452,![],null)[_0x5191('0x17')](function(){return _0x31afe5(null,![],{'message':_0x5191('0x16')});});}}else{return _0x31afe5(null,![],{'message':_0x5191('0x16')});}}else{if(_0x5d2452>=_0x5ead24['allowedLoginAttempts']){return utils[_0x5191('0x1c')](_0x10b972,0x0,!![],moment())[_0x5191('0x17')](function(){return _0x31afe5(null,![],{'message':_0x5191('0x16')});});}else{return utils[_0x5191('0x1c')](_0x10b972,_0x5d2452,![],null)[_0x5191('0x17')](function(){return _0x31afe5(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}}else{return _0x31afe5(null,![],{'message':_0x5191('0x16')});}}else{if(_0x10b972[_0x5191('0x10')]){return _0x31afe5(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x5ead24[_0x5191('0xb')]>0x0){if(_0x10b972[_0x5191('0x19')]){if(_0x5ead24[_0x5191('0xc')]>0x0){if(moment(_0x10b972[_0x5191('0x11')])[_0x5191('0x1a')](_0x5ead24[_0x5191('0xc')],_0x5191('0x1b'))>moment()){return _0x31afe5(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x5191('0x1c')](_0x10b972,0x0,![],null)[_0x5191('0x17')](function(){return utils[_0x5191('0x1d')](_0x10b972);})[_0x5191('0x17')](function(){return _0x31afe5(null,_0x10b972);});}}else{return _0x31afe5(null,![],{'message':_0x5191('0x16')});}}else{return utils[_0x5191('0x1c')](_0x10b972,0x0,![],null)['then'](function(){return utils[_0x5191('0x1d')](_0x10b972);})[_0x5191('0x17')](function(){return _0x31afe5(null,_0x10b972);})[_0x5191('0x1e')](function(_0xd9066e){return _0x31afe5(null,![],_0xd9066e);});}}else{if(_0x10b972[_0x5191('0x19')]){return _0x31afe5(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils['getLicense'](_0x10b972)[_0x5191('0x17')](function(){return _0x31afe5(null,_0x10b972);});}}}});})[_0x5191('0x1e')](function(_0x15985a){return _0x31afe5(null,![],_0x15985a);});}function sendServiceMail(_0x14b05c){return db[_0x5191('0x1f')]['find']({'where':{'service':!![]},'attributes':['id',_0x5191('0x15'),'email'],'include':[{'model':db[_0x5191('0x20')],'as':_0x5191('0x21'),'include':[{'model':db[_0x5191('0x22')],'as':_0x5191('0x22')}]}]})['then'](function(_0x5933e6){if(!_0x5933e6){throw new Error(_0x5191('0x23'));}var _0x44f57e=_0x5933e6[_0x5191('0x24')]();var _0x38e72c={'account':_0x44f57e,'message':_[_0x5191('0x25')]({'from':util[_0x5191('0x26')]('\x22%s\x22\x20<%s>',_0x5933e6[_0x5191('0x15')],_0x5933e6['email']||_0x5933e6[_0x5191('0x21')][_0x5191('0x27')])},_0x14b05c)};return client[_0x5191('0x28')](_0x5191('0x29'),_0x38e72c);})[_0x5191('0x17')](function(_0x286f15){if(_0x286f15[_0x5191('0x2a')]){throw new Error(util['format'](_0x5191('0x2b'),_0x286f15[_0x5191('0x2a')][_0x5191('0x2c')]||JSON['stringify'](_0x286f15[_0x5191('0x2a')])));}return!![];});}function handleError(_0x358817,_0x5488e8,_0x518c8d){return _0x358817[_0x5191('0x2d')](_0x5488e8||0x1f4)[_0x5191('0x2e')]({'message':_0x518c8d?_0x518c8d[_0x5191('0x2c')]||_0x518c8d:''});}exports[_0x5191('0x2f')]=function(_0x5f49a8,_0x55f8f3,_0x2a04c3){passport[_0x5191('0x18')](_0x5191('0x30'),function(_0x56c4bf,_0x13fa40,_0x28196a){var _0x4ba50f=_0x56c4bf||_0x28196a;if(_0x4ba50f){return handleError(_0x55f8f3,0x191,_0x4ba50f);}if(!_0x13fa40){return handleError(_0x55f8f3,0x194,{'message':_0x5191('0x31')});}else{var _0x2291ff={'payload':{'id':_0x13fa40['id'],'role':_0x13fa40[_0x5191('0xf')]},'options':{'expiresIn':0x15180}};return authService[_0x5191('0x32')](_0x2291ff)[_0x5191('0x17')](function(_0x2adba0){_0x55f8f3[_0x5191('0x33')]({'id':_0x13fa40['id'],'token':_0x2adba0,'statusCall':'','isAlreadyLogged':_0x13fa40['online']});});}})(_0x5f49a8,_0x55f8f3,_0x2a04c3);};exports['forgot']=function(_0x200c67,_0x243a8d){if(!_0x200c67[_0x5191('0x34')]['email']){return handleError(_0x243a8d,0x1f4,{'message':_0x5191('0x35')});}var _0x7d4ac3=rs[_0x5191('0x36')]();_0x200c67[_0x5191('0x34')][_0x5191('0x37')]=_0x200c67[_0x5191('0x34')][_0x5191('0x37')][_0x5191('0x38')]()['toLowerCase']();var _0x39d0d3;return db[_0x5191('0x9')][_0x5191('0xa')]({'where':{'id':0x1},'attributes':[_0x5191('0xb'),_0x5191('0xc')],'raw':!![]})['then'](function(_0x5e8c8b){_0x39d0d3=_0x5e8c8b;return db[_0x5191('0x39')][_0x5191('0x3a')]({'where':{'email':_0x200c67[_0x5191('0x34')][_0x5191('0x37')]}});})[_0x5191('0x17')](function(_0x13d10a){if(!_0x13d10a){throw new Error(_0x5191('0x3b'));}if(_0x13d10a[_0x5191('0x10')]){throw new Error('The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.');}if(_0x13d10a[_0x5191('0x19')]){if(moment(_0x13d10a[_0x5191('0x11')])[_0x5191('0x1a')](_0x39d0d3[_0x5191('0xc')],'minutes')>moment()){throw new Error(_0x5191('0x3c'));}else{_0x13d10a[_0x5191('0x19')]=![];_0x13d10a[_0x5191('0x11')]=null;}}_0x13d10a[_0x5191('0x3d')]=_0x7d4ac3;_0x13d10a['resetPasswordExpires']=Date[_0x5191('0x3e')]()+0x36ee80;return _0x13d10a[_0x5191('0x3f')]();})[_0x5191('0x17')](function(){return sendServiceMail({'to':_0x200c67[_0x5191('0x34')][_0x5191('0x37')],'subject':_0x5191('0x40'),'text':_0x5191('0x41')+_0x5191('0x42')+_0x5191('0x43')+_0x200c67[_0x5191('0x44')][_0x5191('0x45')]+_0x5191('0x46')+_0x7d4ac3+'\x0a\x0a'+'If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a'});})[_0x5191('0x17')](function(){_0x243a8d[_0x5191('0x2d')](0xc8)[_0x5191('0x2e')]({'message':'Reset\x20Email\x20sent!'});})[_0x5191('0x1e')](function(_0x122c38){return handleError(_0x243a8d,0x1f4,_0x122c38);});};exports['reset']=function(_0x4b3050,_0x2c8e09){return db[_0x5191('0x39')][_0x5191('0x3a')]({'where':{'resetPasswordToken':_0x4b3050[_0x5191('0x47')][_0x5191('0x48')],'resetPasswordExpires':{'$gt':Date[_0x5191('0x3e')]()}}})[_0x5191('0x17')](function(_0x500c5a){if(!_0x500c5a){throw new Error(_0x5191('0x49'));}return db[_0x5191('0x9')][_0x5191('0xa')]({'attributes':['id','securePassword',_0x5191('0x4a'),_0x5191('0x4b')]})[_0x5191('0x17')](function(_0x41459b){if(_0x41459b[_0x5191('0x4c')])authService[_0x5191('0x4d')](_0x4b3050[_0x5191('0x34')]['password']);if(!_0x41459b[_0x5191('0x4a')]||!_0x500c5a['previousPasswords'])return _0x500c5a;authService['validatePasswordHistory'](_0x4b3050[_0x5191('0x34')][_0x5191('0xd')],_0x500c5a[_0x5191('0x4e')],_0x41459b[_0x5191('0x4b')]);return _0x500c5a;})[_0x5191('0x17')](function(){_0x500c5a['password']=_0x4b3050[_0x5191('0x34')][_0x5191('0xd')];_0x500c5a[_0x5191('0x3d')]=null;_0x500c5a[_0x5191('0x4f')]=null;return _0x500c5a[_0x5191('0x3f')]();});})['then'](function(){_0x2c8e09[_0x5191('0x2d')](0xc8)[_0x5191('0x2e')]({'message':_0x5191('0x50')});})[_0x5191('0x1e')](function(_0x232ed5){return handleError(_0x2c8e09,0x1f4,_0x232ed5);});};passport['use'](_0x5191('0x30'),new LocalStrategy({'usernameField':_0x5191('0x15'),'passwordField':_0x5191('0xd')},function(_0x3e31c0,_0xd862bb,_0x3f4fe9){return localAuthenticate(db[_0x5191('0x39')],_0x3e31c0,_0xd862bb,_0x3f4fe9);})); \ No newline at end of file +var _0xb7d6=['blocked','add','blockDuration','minutes','clearBlockUser','getLicense','catch','MailAccount','find','MailServerOut','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','format','email','user','request','error','message','send','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','online','forgot','body','Email\x20parameter\x20is\x20missing','trim','toLowerCase','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','resetPasswordExpires','now','save','https://','headers','host','/reset/','status','Reset\x20Email\x20sent!','reset','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','validatePasswordPattern','password','previousPasswords','validatePasswordHistory','resetPasswordToken','use','Strategy','jayson/promise','lodash','moment','../../mysqldb','../../components/auth/service','../../config/utils','http','Setting','findOne','allowedLoginAttempts','name','role','disabled','blockedAt','loginAttempts','agent','then','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate'];(function(_0x16f04e,_0x379d5d){var _0x51735a=function(_0x391a14){while(--_0x391a14){_0x16f04e['push'](_0x16f04e['shift']());}};_0x51735a(++_0x379d5d);}(_0xb7d6,0xca));var _0x6b7d=function(_0x1e79d8,_0x3f2aa7){_0x1e79d8=_0x1e79d8-0x0;var _0x3c2e1c=_0xb7d6[_0x1e79d8];return _0x3c2e1c;};'use strict';var util=require('util');var passport=require('passport');var LocalStrategy=require('passport-local')[_0x6b7d('0x0')];var jayson=require(_0x6b7d('0x1'));var _=require(_0x6b7d('0x2'));var rs=require('randomstring');var moment=require(_0x6b7d('0x3'));var db=require(_0x6b7d('0x4'))['db'];var authService=require(_0x6b7d('0x5'));var utils=require(_0x6b7d('0x6'));var client=jayson['client'][_0x6b7d('0x7')]({'port':0x232b});function localAuthenticate(_0x34bd61,_0x2452d3,_0x3aaf9e,_0x36be9d){var _0x10b6df,_0x4c1bce;return db[_0x6b7d('0x8')][_0x6b7d('0x9')]({'where':{'id':0x1},'attributes':[_0x6b7d('0xa'),'blockDuration'],'raw':!![]})['then'](function(_0x5919b3){_0x10b6df=_0x5919b3;return _0x34bd61[_0x6b7d('0x9')]({'attributes':['id',_0x6b7d('0xb'),'password','salt',_0x6b7d('0xc'),_0x6b7d('0xd'),'blocked',_0x6b7d('0xe'),_0x6b7d('0xf')],'where':{'name':_0x2452d3,'role':{'$or':['admin','user',_0x6b7d('0x10')]}}});})[_0x6b7d('0x11')](function(_0x16dd6){if(!_0x16dd6||_0x16dd6&&_0x16dd6[_0x6b7d('0xb')]!==_0x2452d3){throw new Error(_0x6b7d('0x12'));}else{_0x4c1bce=_0x16dd6;return _0x4c1bce;}})[_0x6b7d('0x11')](function(){_0x4c1bce[_0x6b7d('0x13')](_0x3aaf9e,function(_0x3af0cd,_0xc34722){var _0x524d8a=_0x4c1bce[_0x6b7d('0xf')]+0x1;if(_0x3af0cd){return _0x36be9d(_0x3af0cd);}else if(!_0xc34722){if(_0x4c1bce['disabled']){return _0x36be9d(null,![],{'message':_0x6b7d('0x12')});}else if(_0x10b6df[_0x6b7d('0xa')]>0x0){if(_0x4c1bce[_0x6b7d('0x14')]){if(_0x10b6df['blockDuration']>0x0){if(moment(_0x4c1bce[_0x6b7d('0xe')])[_0x6b7d('0x15')](_0x10b6df[_0x6b7d('0x16')],_0x6b7d('0x17'))>moment()){return _0x36be9d(null,![],{'message':_0x6b7d('0x12')});}else{return utils[_0x6b7d('0x18')](_0x4c1bce,_0x524d8a,![],null)[_0x6b7d('0x11')](function(){return _0x36be9d(null,![],{'message':_0x6b7d('0x12')});});}}else{return _0x36be9d(null,![],{'message':_0x6b7d('0x12')});}}else{if(_0x524d8a>=_0x10b6df[_0x6b7d('0xa')]){return utils[_0x6b7d('0x18')](_0x4c1bce,0x0,!![],moment())[_0x6b7d('0x11')](function(){return _0x36be9d(null,![],{'message':_0x6b7d('0x12')});});}else{return utils[_0x6b7d('0x18')](_0x4c1bce,_0x524d8a,![],null)[_0x6b7d('0x11')](function(){return _0x36be9d(null,![],{'message':_0x6b7d('0x12')});});}}}else{return _0x36be9d(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x4c1bce['disabled']){return _0x36be9d(null,![],{'message':_0x6b7d('0x12')});}else if(_0x10b6df['allowedLoginAttempts']>0x0){if(_0x4c1bce[_0x6b7d('0x14')]){if(_0x10b6df[_0x6b7d('0x16')]>0x0){if(moment(_0x4c1bce[_0x6b7d('0xe')])[_0x6b7d('0x15')](_0x10b6df['blockDuration'],_0x6b7d('0x17'))>moment()){return _0x36be9d(null,![],{'message':_0x6b7d('0x12')});}else{return utils[_0x6b7d('0x18')](_0x4c1bce,0x0,![],null)[_0x6b7d('0x11')](function(){return utils[_0x6b7d('0x19')](_0x4c1bce);})[_0x6b7d('0x11')](function(){return _0x36be9d(null,_0x4c1bce);});}}else{return _0x36be9d(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{return utils[_0x6b7d('0x18')](_0x4c1bce,0x0,![],null)[_0x6b7d('0x11')](function(){return utils[_0x6b7d('0x19')](_0x4c1bce);})['then'](function(){return _0x36be9d(null,_0x4c1bce);})[_0x6b7d('0x1a')](function(_0x2701de){return _0x36be9d(null,![],_0x2701de);});}}else{if(_0x4c1bce[_0x6b7d('0x14')]){return _0x36be9d(null,![],{'message':_0x6b7d('0x12')});}else{return utils[_0x6b7d('0x19')](_0x4c1bce)['then'](function(){return _0x36be9d(null,_0x4c1bce);});}}}});})[_0x6b7d('0x1a')](function(_0x45ade3){return _0x36be9d(null,![],_0x45ade3);});}function sendServiceMail(_0xc2aef){return db[_0x6b7d('0x1b')][_0x6b7d('0x1c')]({'where':{'service':!![]},'attributes':['id',_0x6b7d('0xb'),'email'],'include':[{'model':db[_0x6b7d('0x1d')],'as':_0x6b7d('0x1e'),'include':[{'model':db[_0x6b7d('0x1f')],'as':_0x6b7d('0x1f')}]}]})[_0x6b7d('0x11')](function(_0x55d341){if(!_0x55d341){throw new Error(_0x6b7d('0x20'));}var _0x5056e8=_0x55d341[_0x6b7d('0x21')]();var _0x38130c={'account':_0x5056e8,'message':_['merge']({'from':util[_0x6b7d('0x22')]('\x22%s\x22\x20<%s>',_0x55d341[_0x6b7d('0xb')],_0x55d341[_0x6b7d('0x23')]||_0x55d341[_0x6b7d('0x1e')][_0x6b7d('0x24')])},_0xc2aef)};return client[_0x6b7d('0x25')]('SendMail',_0x38130c);})[_0x6b7d('0x11')](function(_0xd25b2b){if(_0xd25b2b[_0x6b7d('0x26')]){throw new Error(util[_0x6b7d('0x22')]('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0xd25b2b[_0x6b7d('0x26')][_0x6b7d('0x27')]||JSON['stringify'](_0xd25b2b[_0x6b7d('0x26')])));}return!![];});}function handleError(_0x30db81,_0x36fdeb,_0xe54b7e){return _0x30db81['status'](_0x36fdeb||0x1f4)[_0x6b7d('0x28')]({'message':_0xe54b7e?_0xe54b7e[_0x6b7d('0x27')]||_0xe54b7e:''});}exports['login']=function(_0x4f2894,_0x10d6fd,_0x5bb6ee){passport[_0x6b7d('0x13')](_0x6b7d('0x29'),function(_0x4e5e42,_0x337af8,_0x390146){var _0x3ae271=_0x4e5e42||_0x390146;if(_0x3ae271){return handleError(_0x10d6fd,0x191,_0x3ae271);}if(!_0x337af8){return handleError(_0x10d6fd,0x194,{'message':_0x6b7d('0x2a')});}else{var _0x5a71b2={'payload':{'id':_0x337af8['id'],'role':_0x337af8['role']},'options':{'expiresIn':0x15180}};return authService[_0x6b7d('0x2b')](_0x5a71b2)[_0x6b7d('0x11')](function(_0x15b7d7){_0x10d6fd['json']({'id':_0x337af8['id'],'token':_0x15b7d7,'statusCall':'','isAlreadyLogged':_0x337af8[_0x6b7d('0x2c')]});});}})(_0x4f2894,_0x10d6fd,_0x5bb6ee);};exports[_0x6b7d('0x2d')]=function(_0x148a9f,_0x4cefd0){if(!_0x148a9f[_0x6b7d('0x2e')][_0x6b7d('0x23')]){return handleError(_0x4cefd0,0x1f4,{'message':_0x6b7d('0x2f')});}var _0x8bb2ff=rs['generate']();_0x148a9f[_0x6b7d('0x2e')][_0x6b7d('0x23')]=_0x148a9f['body']['email'][_0x6b7d('0x30')]()[_0x6b7d('0x31')]();var _0x38e9e0;return db[_0x6b7d('0x8')]['findOne']({'where':{'id':0x1},'attributes':[_0x6b7d('0xa'),_0x6b7d('0x16')],'raw':!![]})[_0x6b7d('0x11')](function(_0x10d40c){_0x38e9e0=_0x10d40c;return db[_0x6b7d('0x32')]['find']({'where':{'email':_0x148a9f[_0x6b7d('0x2e')]['email']}});})['then'](function(_0x42e9dd){if(!_0x42e9dd){throw new Error(_0x6b7d('0x33'));}if(_0x42e9dd['disabled']){throw new Error(_0x6b7d('0x34'));}if(_0x42e9dd[_0x6b7d('0x14')]){if(moment(_0x42e9dd[_0x6b7d('0xe')])[_0x6b7d('0x15')](_0x38e9e0[_0x6b7d('0x16')],'minutes')>moment()){throw new Error('The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.');}else{_0x42e9dd[_0x6b7d('0x14')]=![];_0x42e9dd[_0x6b7d('0xe')]=null;}}_0x42e9dd['resetPasswordToken']=_0x8bb2ff;_0x42e9dd[_0x6b7d('0x35')]=Date[_0x6b7d('0x36')]()+0x36ee80;return _0x42e9dd[_0x6b7d('0x37')]();})[_0x6b7d('0x11')](function(){return sendServiceMail({'to':_0x148a9f['body'][_0x6b7d('0x23')],'subject':'xCally\x20Motion\x20Password\x20Reset','text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+_0x6b7d('0x38')+_0x148a9f[_0x6b7d('0x39')][_0x6b7d('0x3a')]+_0x6b7d('0x3b')+_0x8bb2ff+'\x0a\x0a'+'If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a'});})[_0x6b7d('0x11')](function(){_0x4cefd0[_0x6b7d('0x3c')](0xc8)[_0x6b7d('0x28')]({'message':_0x6b7d('0x3d')});})[_0x6b7d('0x1a')](function(_0x8b5e2e){return handleError(_0x4cefd0,0x1f4,_0x8b5e2e);});};exports[_0x6b7d('0x3e')]=function(_0x3e2751,_0x5793c3){return db[_0x6b7d('0x32')][_0x6b7d('0x1c')]({'where':{'resetPasswordToken':_0x3e2751[_0x6b7d('0x3f')][_0x6b7d('0x40')],'resetPasswordExpires':{'$gt':Date[_0x6b7d('0x36')]()}}})['then'](function(_0x144e8d){if(!_0x144e8d){throw new Error(_0x6b7d('0x41'));}return db[_0x6b7d('0x8')]['findOne']({'attributes':['id',_0x6b7d('0x42'),_0x6b7d('0x43'),'passwordHistoryLimit']})[_0x6b7d('0x11')](function(_0x10c167){if(_0x10c167[_0x6b7d('0x42')])authService[_0x6b7d('0x44')](_0x3e2751[_0x6b7d('0x2e')][_0x6b7d('0x45')]);if(!_0x10c167[_0x6b7d('0x43')]||!_0x144e8d[_0x6b7d('0x46')])return _0x144e8d;authService[_0x6b7d('0x47')](_0x3e2751[_0x6b7d('0x2e')][_0x6b7d('0x45')],_0x144e8d[_0x6b7d('0x46')],_0x10c167['passwordHistoryLimit']);return _0x144e8d;})[_0x6b7d('0x11')](function(){_0x144e8d[_0x6b7d('0x45')]=_0x3e2751['body'][_0x6b7d('0x45')];_0x144e8d[_0x6b7d('0x48')]=null;_0x144e8d['resetPasswordExpires']=null;return _0x144e8d[_0x6b7d('0x37')]();});})[_0x6b7d('0x11')](function(){_0x5793c3[_0x6b7d('0x3c')](0xc8)[_0x6b7d('0x28')]({'message':'Password\x20reset!'});})[_0x6b7d('0x1a')](function(_0x44ff3f){return handleError(_0x5793c3,0x1f4,_0x44ff3f);});};passport[_0x6b7d('0x49')](_0x6b7d('0x29'),new LocalStrategy({'usernameField':_0x6b7d('0xb'),'passwordField':_0x6b7d('0x45')},function(_0x6e765c,_0x53aae2,_0xc95376){return localAuthenticate(db['User'],_0x6e765c,_0x53aae2,_0xc95376);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 735df69..7f22007 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 _0xe566=['/forgot','post','reset','exports','Router','./authLocal.controller','login'];(function(_0x46b0ce,_0x16acc7){var _0x295ece=function(_0x2d6194){while(--_0x2d6194){_0x46b0ce['push'](_0x46b0ce['shift']());}};_0x295ece(++_0x16acc7);}(_0xe566,0x82));var _0x6e56=function(_0x5a6e7b,_0x18905f){_0x5a6e7b=_0x5a6e7b-0x0;var _0x4af6ff=_0xe566[_0x5a6e7b];return _0x4af6ff;};'use strict';var express=require('express');var router=express[_0x6e56('0x0')]();var controller=require(_0x6e56('0x1'));router['post']('/',controller[_0x6e56('0x2')]);router['post'](_0x6e56('0x3'),controller['forgot']);router[_0x6e56('0x4')]('/reset/:token',controller[_0x6e56('0x5')]);module[_0x6e56('0x6')]=router; \ No newline at end of file +var _0x5c2d=['/forgot','/reset/:token','reset','Router','./authLocal.controller','post'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0x5c2d,0x135));var _0xd5c2=function(_0x4429aa,_0x72d291){_0x4429aa=_0x4429aa-0x0;var _0x480074=_0x5c2d[_0x4429aa];return _0x480074;};'use strict';var express=require('express');var router=express[_0xd5c2('0x0')]();var controller=require(_0xd5c2('0x1'));router[_0xd5c2('0x2')]('/',controller['login']);router['post'](_0xd5c2('0x3'),controller['forgot']);router[_0xd5c2('0x2')](_0xd5c2('0x4'),controller[_0xd5c2('0x5')]);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 7fdf4ba..da0c608 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 _0x5e76=['STRING','BOOLEAN','INTEGER','sequelize','exports'];(function(_0x329664,_0x130748){var _0x4e346e=function(_0x172b0d){while(--_0x172b0d){_0x329664['push'](_0x329664['shift']());}};_0x4e346e(++_0x130748);}(_0x5e76,0x80));var _0x65e7=function(_0x48bff0,_0x5ec28d){_0x48bff0=_0x48bff0-0x0;var _0x5520c7=_0x5e76[_0x48bff0];return _0x5520c7;};'use strict';var Sequelize=require(_0x65e7('0x0'));module[_0x65e7('0x1')]={'name':{'type':Sequelize[_0x65e7('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0x65e7('0x2')]},'description':{'type':Sequelize[_0x65e7('0x2')]},'status':{'type':Sequelize[_0x65e7('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x65e7('0x4')],'defaultValue':0xa}}; \ No newline at end of file +var _0xed20=['STRING','INTEGER','sequelize','exports'];(function(_0x24e952,_0x4850cb){var _0xc8c26d=function(_0x11c8d0){while(--_0x11c8d0){_0x24e952['push'](_0x24e952['shift']());}};_0xc8c26d(++_0x4850cb);}(_0xed20,0x14e));var _0x0ed2=function(_0x1db2f5,_0x42111e){_0x1db2f5=_0x1db2f5-0x0;var _0x5ec281=_0xed20[_0x1db2f5];return _0x5ec281;};'use strict';var Sequelize=require(_0x0ed2('0x0'));module[_0x0ed2('0x1')]={'name':{'type':Sequelize[_0x0ed2('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0x0ed2('0x2')]},'description':{'type':Sequelize[_0x0ed2('0x2')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize[_0x0ed2('0x3')],'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 3460c46..7f585d9 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 _0x868e=['eml-format','zip-dir','request-promise','bluebird','path','ejs','lodash','jsforce','to-csv','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','save','update','then','destroy','name','send','index','map','Automation','rawAttributes','fieldName','key','keys','query','intersection','fields','attributes','length','model','nolimit','order','sort','filters','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','params','find','catch','create','body','addConditions','Condition','ids','getConditions','findOne','addActions','omit','getActions','hasOwnProperty'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x868e,0x128));var _0xe868=function(_0x37e597,_0x3569a8){_0x37e597=_0x37e597-0x0;var _0x14fe81=_0x868e[_0x37e597];return _0x14fe81;};'use strict';var emlformat=require(_0xe868('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe868('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe868('0x2'));var moment=require('moment');var BPromise=require(_0xe868('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0xe868('0x4'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xe868('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe868('0x6'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe868('0x7'));var deskjs=require('desk.js');var toCsv=require(_0xe868('0x8'));var querystring=require('querystring');var Papa=require(_0xe868('0x9'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xe868('0xa'));var as=require(_0xe868('0xb'));var hardwareService=require(_0xe868('0xc'));var logger=require(_0xe868('0xd'))(_0xe868('0xe'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xe868('0xf'))['db'];function respondWithStatusCode(_0x342529,_0x3e1065){_0x3e1065=_0x3e1065||0xcc;return function(_0x459404){if(_0x459404){return _0x342529[_0xe868('0x10')](_0x3e1065);}return _0x342529[_0xe868('0x11')](_0x3e1065)[_0xe868('0x12')]();};}function respondWithResult(_0x4b7181,_0x4f9f47){_0x4f9f47=_0x4f9f47||0xc8;return function(_0x1d5a18){if(_0x1d5a18){return _0x4b7181[_0xe868('0x11')](_0x4f9f47)[_0xe868('0x13')](_0x1d5a18);}};}function respondWithFilteredResult(_0xe2f0cc,_0x5a442f){return function(_0x4dad6c){if(_0x4dad6c){var _0x3c9a2f=typeof _0x5a442f[_0xe868('0x14')]==='undefined'&&typeof _0x5a442f[_0xe868('0x15')]==='undefined';var _0x5a2885=_0x4dad6c['count'];var _0x28f4c8=_0x3c9a2f?0x0:_0x5a442f[_0xe868('0x14')];var _0x3c7211=_0x3c9a2f?_0x4dad6c[_0xe868('0x16')]:_0x5a442f[_0xe868('0x14')]+_0x5a442f['limit'];var _0x3e68d4;if(_0x3c7211>=_0x5a2885){_0x3c7211=_0x5a2885;_0x3e68d4=0xc8;}else{_0x3e68d4=0xce;}_0xe2f0cc[_0xe868('0x11')](_0x3e68d4);return _0xe2f0cc[_0xe868('0x17')](_0xe868('0x18'),_0x28f4c8+'-'+_0x3c7211+'/'+_0x5a2885)['json'](_0x4dad6c);}return null;};}function patchUpdates(_0x81aad1){return function(_0x387102){try{jsonpatch[_0xe868('0x19')](_0x387102,_0x81aad1,!![]);}catch(_0x28cd53){return BPromise['reject'](_0x28cd53);}return _0x387102[_0xe868('0x1a')]();};}function saveUpdates(_0x4d77a6,_0x4fdf9d){return function(_0x372af6){if(_0x372af6){return _0x372af6[_0xe868('0x1b')](_0x4d77a6)[_0xe868('0x1c')](function(_0x4ba0ab){return _0x4ba0ab;});}return null;};}function removeEntity(_0x46bfd3,_0x20fdc8){return function(_0x5c8f34){if(_0x5c8f34){return _0x5c8f34[_0xe868('0x1d')]()['then'](function(){_0x46bfd3[_0xe868('0x11')](0xcc)['end']();});}};}function handleEntityNotFound(_0x6c1e2e,_0x458be3){return function(_0x3b25cc){if(!_0x3b25cc){_0x6c1e2e[_0xe868('0x10')](0x194);}return _0x3b25cc;};}function handleError(_0x153048,_0x18123e){_0x18123e=_0x18123e||0x1f4;return function(_0x57cd99){logger['error'](_0x57cd99['stack']);if(_0x57cd99[_0xe868('0x1e')]){delete _0x57cd99[_0xe868('0x1e')];}_0x153048['status'](_0x18123e)[_0xe868('0x1f')](_0x57cd99);};}exports[_0xe868('0x20')]=function(_0x9322d7,_0x853f53){var _0x33a4e2={},_0x57e171={},_0x5548b5={'count':0x0,'rows':[]};var _0x6df6cf=_[_0xe868('0x21')](db[_0xe868('0x22')][_0xe868('0x23')],function(_0x1074da){return{'name':_0x1074da[_0xe868('0x24')],'type':_0x1074da['type'][_0xe868('0x25')]};});_0x57e171['model']=_[_0xe868('0x21')](_0x6df6cf,_0xe868('0x1e'));_0x57e171['query']=_[_0xe868('0x26')](_0x9322d7[_0xe868('0x27')]);_0x57e171['filters']=_[_0xe868('0x28')](_0x57e171['model'],_0x57e171['query']);_0x33a4e2['attributes']=_[_0xe868('0x28')](_0x57e171['model'],qs[_0xe868('0x29')](_0x9322d7[_0xe868('0x27')][_0xe868('0x29')]));_0x33a4e2[_0xe868('0x2a')]=_0x33a4e2[_0xe868('0x2a')][_0xe868('0x2b')]?_0x33a4e2[_0xe868('0x2a')]:_0x57e171[_0xe868('0x2c')];if(!_0x9322d7['query']['hasOwnProperty'](_0xe868('0x2d'))){_0x33a4e2[_0xe868('0x15')]=qs['limit'](_0x9322d7[_0xe868('0x27')][_0xe868('0x15')]);_0x33a4e2[_0xe868('0x14')]=qs[_0xe868('0x14')](_0x9322d7['query'][_0xe868('0x14')]);}_0x33a4e2[_0xe868('0x2e')]=qs['sort'](_0x9322d7[_0xe868('0x27')][_0xe868('0x2f')]);_0x33a4e2['where']=qs[_0xe868('0x30')](_[_0xe868('0x31')](_0x9322d7['query'],_0x57e171['filters']),_0x6df6cf);if(_0x9322d7[_0xe868('0x27')][_0xe868('0x32')]){_0x33a4e2[_0xe868('0x33')]=_[_0xe868('0x34')](_0x33a4e2[_0xe868('0x33')],{'$or':_[_0xe868('0x21')](_0x6df6cf,function(_0x5595a8){if(_0x5595a8[_0xe868('0x35')]!==_0xe868('0x36')){var _0x11f11c={};_0x11f11c[_0x5595a8[_0xe868('0x1e')]]={'$like':'%'+_0x9322d7[_0xe868('0x27')][_0xe868('0x32')]+'%'};return _0x11f11c;}})});}_0x33a4e2=_[_0xe868('0x34')]({},_0x33a4e2,_0x9322d7[_0xe868('0x37')]);var _0x19e6c9={'where':_0x33a4e2[_0xe868('0x33')]};return db['Automation'][_0xe868('0x16')](_0x19e6c9)['then'](function(_0x5e1930){_0x5548b5[_0xe868('0x16')]=_0x5e1930;if(_0x9322d7['query'][_0xe868('0x38')]){_0x33a4e2[_0xe868('0x39')]=[{'all':!![]}];}return db[_0xe868('0x22')][_0xe868('0x3a')](_0x33a4e2);})['then'](function(_0x415b4b){_0x5548b5[_0xe868('0x3b')]=_0x415b4b;return _0x5548b5;})[_0xe868('0x1c')](respondWithFilteredResult(_0x853f53,_0x33a4e2))['catch'](handleError(_0x853f53,null));};exports['show']=function(_0x2f56e4,_0x3f20b6){var _0x51bc34={'raw':![],'where':{'id':_0x2f56e4[_0xe868('0x3c')]['id']}},_0x476342={};_0x476342[_0xe868('0x2c')]=_[_0xe868('0x26')](db['Automation']['rawAttributes']);_0x476342[_0xe868('0x27')]=_[_0xe868('0x26')](_0x2f56e4[_0xe868('0x27')]);_0x476342[_0xe868('0x30')]=_[_0xe868('0x28')](_0x476342[_0xe868('0x2c')],_0x476342[_0xe868('0x27')]);_0x51bc34[_0xe868('0x2a')]=_['intersection'](_0x476342['model'],qs[_0xe868('0x29')](_0x2f56e4[_0xe868('0x27')][_0xe868('0x29')]));_0x51bc34['attributes']=_0x51bc34[_0xe868('0x2a')][_0xe868('0x2b')]?_0x51bc34[_0xe868('0x2a')]:_0x476342['model'];if(_0x2f56e4['query'][_0xe868('0x38')]){_0x51bc34[_0xe868('0x39')]=[{'all':!![]}];}_0x51bc34=_[_0xe868('0x34')]({},_0x51bc34,_0x2f56e4[_0xe868('0x37')]);return db[_0xe868('0x22')][_0xe868('0x3d')](_0x51bc34)[_0xe868('0x1c')](handleEntityNotFound(_0x3f20b6,null))[_0xe868('0x1c')](respondWithResult(_0x3f20b6,null))[_0xe868('0x3e')](handleError(_0x3f20b6,null));};exports[_0xe868('0x3f')]=function(_0x477850,_0x489bf3){return db['Automation']['create'](_0x477850[_0xe868('0x40')],{})[_0xe868('0x1c')](respondWithResult(_0x489bf3,0xc9))[_0xe868('0x3e')](handleError(_0x489bf3,null));};exports[_0xe868('0x1b')]=function(_0x2545c0,_0x46abb9){if(_0x2545c0[_0xe868('0x40')]['id']){delete _0x2545c0[_0xe868('0x40')]['id'];}return db['Automation'][_0xe868('0x3d')]({'where':{'id':_0x2545c0[_0xe868('0x3c')]['id']}})['then'](handleEntityNotFound(_0x46abb9,null))[_0xe868('0x1c')](saveUpdates(_0x2545c0[_0xe868('0x40')],null))[_0xe868('0x1c')](respondWithResult(_0x46abb9,null))[_0xe868('0x3e')](handleError(_0x46abb9,null));};exports[_0xe868('0x1d')]=function(_0x14fcae,_0x504754){return db[_0xe868('0x22')]['find']({'where':{'id':_0x14fcae[_0xe868('0x3c')]['id']}})[_0xe868('0x1c')](handleEntityNotFound(_0x504754,null))[_0xe868('0x1c')](removeEntity(_0x504754,null))[_0xe868('0x3e')](handleError(_0x504754,null));};exports[_0xe868('0x41')]=function(_0x49840a,_0xe41d6f,_0x42934d){return db[_0xe868('0x42')][_0xe868('0x3d')]({'where':{'id':_0x49840a['params']['id']}})['then'](handleEntityNotFound(_0xe41d6f,null))[_0xe868('0x1c')](function(_0x4ea561){if(_0x4ea561){return _0x4ea561[_0xe868('0x41')](_0x49840a['body'][_0xe868('0x43')],_['omit'](_0x49840a['body'],[_0xe868('0x43'),'id'])||{});}})[_0xe868('0x1c')](respondWithResult(_0xe41d6f,null))[_0xe868('0x3e')](handleError(_0xe41d6f,null));};exports[_0xe868('0x44')]=function(_0x4b7f35,_0x29743d,_0x35be34){var _0x3d7db={};var _0x241d27={};var _0x2c3bc6;var _0x1055da;return db[_0xe868('0x22')][_0xe868('0x45')]({'where':{'id':_0x4b7f35['params']['id']}})[_0xe868('0x1c')](handleEntityNotFound(_0x29743d,null))['then'](function(_0x4a71ff){if(_0x4a71ff){_0x2c3bc6=_0x4a71ff;_0x241d27[_0xe868('0x2c')]=_['keys'](db[_0xe868('0x42')]['rawAttributes']);_0x241d27[_0xe868('0x27')]=_[_0xe868('0x26')](_0x4b7f35['query']);_0x241d27[_0xe868('0x30')]=_[_0xe868('0x28')](_0x241d27['model'],_0x241d27['query']);_0x3d7db[_0xe868('0x2a')]=_['intersection'](_0x241d27['model'],qs[_0xe868('0x29')](_0x4b7f35[_0xe868('0x27')]['fields']));_0x3d7db[_0xe868('0x2a')]=_0x3d7db[_0xe868('0x2a')][_0xe868('0x2b')]?_0x3d7db[_0xe868('0x2a')]:_0x241d27[_0xe868('0x2c')];_0x3d7db[_0xe868('0x2e')]=qs[_0xe868('0x2f')](_0x4b7f35[_0xe868('0x27')][_0xe868('0x2f')]);_0x3d7db[_0xe868('0x33')]=qs['filters'](_[_0xe868('0x31')](_0x4b7f35[_0xe868('0x27')],_0x241d27[_0xe868('0x30')]));if(_0x4b7f35[_0xe868('0x27')][_0xe868('0x32')]){_0x3d7db[_0xe868('0x33')]=_['merge'](_0x3d7db[_0xe868('0x33')],{'$or':_[_0xe868('0x21')](_0x3d7db['attributes'],function(_0x5ae1e7){var _0x4dcc5e={};_0x4dcc5e[_0x5ae1e7]={'$like':'%'+_0x4b7f35[_0xe868('0x27')][_0xe868('0x32')]+'%'};return _0x4dcc5e;})});}_0x3d7db=_[_0xe868('0x34')]({},_0x3d7db,_0x4b7f35['options']);return _0x2c3bc6['getConditions'](_0x3d7db);}})[_0xe868('0x1c')](function(_0x1c275e){if(_0x1c275e){_0x1055da=_0x1c275e[_0xe868('0x2b')];if(!_0x4b7f35[_0xe868('0x27')]['hasOwnProperty'](_0xe868('0x2d'))){_0x3d7db[_0xe868('0x15')]=qs[_0xe868('0x15')](_0x4b7f35[_0xe868('0x27')][_0xe868('0x15')]);_0x3d7db[_0xe868('0x14')]=qs['offset'](_0x4b7f35[_0xe868('0x27')]['offset']);}return _0x2c3bc6['getConditions'](_0x3d7db);}})['then'](function(_0x29db43){if(_0x29db43){return _0x29db43?{'count':_0x1055da,'rows':_0x29db43}:null;}})[_0xe868('0x1c')](respondWithResult(_0x29743d,null))[_0xe868('0x3e')](handleError(_0x29743d,null));};exports[_0xe868('0x46')]=function(_0x1f9687,_0x13b609,_0x4c4316){return db['Action']['find']({'where':{'id':_0x1f9687['params']['id']}})[_0xe868('0x1c')](handleEntityNotFound(_0x13b609,null))['then'](function(_0x2d5722){if(_0x2d5722){return _0x2d5722[_0xe868('0x46')](_0x1f9687[_0xe868('0x40')][_0xe868('0x43')],_[_0xe868('0x47')](_0x1f9687['body'],[_0xe868('0x43'),'id'])||{});}})['then'](respondWithResult(_0x13b609,null))[_0xe868('0x3e')](handleError(_0x13b609,null));};exports['getActions']=function(_0x5dd4a0,_0x2cac53,_0x498ce4){var _0x1f7d47={};var _0x454e32={};var _0x14d78c;var _0x13bad5;return db['Automation'][_0xe868('0x45')]({'where':{'id':_0x5dd4a0[_0xe868('0x3c')]['id']}})[_0xe868('0x1c')](handleEntityNotFound(_0x2cac53,null))['then'](function(_0x36de2e){if(_0x36de2e){_0x14d78c=_0x36de2e;_0x454e32[_0xe868('0x2c')]=_['keys'](db['Action']['rawAttributes']);_0x454e32[_0xe868('0x27')]=_['keys'](_0x5dd4a0['query']);_0x454e32['filters']=_[_0xe868('0x28')](_0x454e32[_0xe868('0x2c')],_0x454e32[_0xe868('0x27')]);_0x1f7d47[_0xe868('0x2a')]=_['intersection'](_0x454e32[_0xe868('0x2c')],qs[_0xe868('0x29')](_0x5dd4a0[_0xe868('0x27')][_0xe868('0x29')]));_0x1f7d47[_0xe868('0x2a')]=_0x1f7d47['attributes']['length']?_0x1f7d47[_0xe868('0x2a')]:_0x454e32[_0xe868('0x2c')];_0x1f7d47[_0xe868('0x2e')]=qs[_0xe868('0x2f')](_0x5dd4a0[_0xe868('0x27')][_0xe868('0x2f')]);_0x1f7d47[_0xe868('0x33')]=qs['filters'](_[_0xe868('0x31')](_0x5dd4a0[_0xe868('0x27')],_0x454e32[_0xe868('0x30')]));if(_0x5dd4a0[_0xe868('0x27')][_0xe868('0x32')]){_0x1f7d47[_0xe868('0x33')]=_['merge'](_0x1f7d47[_0xe868('0x33')],{'$or':_[_0xe868('0x21')](_0x1f7d47['attributes'],function(_0x23ddee){var _0x22059a={};_0x22059a[_0x23ddee]={'$like':'%'+_0x5dd4a0['query'][_0xe868('0x32')]+'%'};return _0x22059a;})});}_0x1f7d47=_[_0xe868('0x34')]({},_0x1f7d47,_0x5dd4a0['options']);return _0x14d78c[_0xe868('0x48')](_0x1f7d47);}})[_0xe868('0x1c')](function(_0x534b82){if(_0x534b82){_0x13bad5=_0x534b82[_0xe868('0x2b')];if(!_0x5dd4a0['query'][_0xe868('0x49')]('nolimit')){_0x1f7d47[_0xe868('0x15')]=qs[_0xe868('0x15')](_0x5dd4a0[_0xe868('0x27')][_0xe868('0x15')]);_0x1f7d47[_0xe868('0x14')]=qs['offset'](_0x5dd4a0[_0xe868('0x27')][_0xe868('0x14')]);}return _0x14d78c[_0xe868('0x48')](_0x1f7d47);}})[_0xe868('0x1c')](function(_0x1db7d6){if(_0x1db7d6){return _0x1db7d6?{'count':_0x13bad5,'rows':_0x1db7d6}:null;}})[_0xe868('0x1c')](respondWithResult(_0x2cac53,null))['catch'](handleError(_0x2cac53,null));}; \ No newline at end of file +var _0x2bf6=['addActions','Action','order','getActions','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','stack','name','send','index','map','Automation','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','then','includeAll','include','findAll','rows','catch','show','params','keys','length','find','create','body','addConditions','Condition','omit','ids','findOne','getConditions'];(function(_0x37d90a,_0xd8683e){var _0x365635=function(_0xcbcd2a){while(--_0xcbcd2a){_0x37d90a['push'](_0x37d90a['shift']());}};_0x365635(++_0xd8683e);}(_0x2bf6,0xae));var _0x62bf=function(_0x257951,_0x1e0bcf){_0x257951=_0x257951-0x0;var _0x23a7fa=_0x2bf6[_0x257951];return _0x23a7fa;};'use strict';var emlformat=require(_0x62bf('0x0'));var rimraf=require(_0x62bf('0x1'));var zipdir=require(_0x62bf('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x62bf('0x3'));var moment=require(_0x62bf('0x4'));var BPromise=require(_0x62bf('0x5'));var Mustache=require('mustache');var util=require(_0x62bf('0x6'));var path=require('path');var sox=require(_0x62bf('0x7'));var csv=require(_0x62bf('0x8'));var ejs=require(_0x62bf('0x9'));var fs=require('fs');var fs_extra=require(_0x62bf('0xa'));var _=require('lodash');var squel=require(_0x62bf('0xb'));var crypto=require('crypto');var jsforce=require(_0x62bf('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x62bf('0x8'));var querystring=require(_0x62bf('0xd'));var Papa=require(_0x62bf('0xe'));var Redis=require(_0x62bf('0xf'));var authService=require(_0x62bf('0x10'));var qs=require(_0x62bf('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x62bf('0x12'));var logger=require(_0x62bf('0x13'))(_0x62bf('0x14'));var utils=require(_0x62bf('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x62bf('0x16'));var db=require(_0x62bf('0x17'))['db'];function respondWithStatusCode(_0x34d5da,_0x3ace1d){_0x3ace1d=_0x3ace1d||0xcc;return function(_0xfccae2){if(_0xfccae2){return _0x34d5da[_0x62bf('0x18')](_0x3ace1d);}return _0x34d5da[_0x62bf('0x19')](_0x3ace1d)[_0x62bf('0x1a')]();};}function respondWithResult(_0x2716f3,_0x4e89cb){_0x4e89cb=_0x4e89cb||0xc8;return function(_0x209b95){if(_0x209b95){return _0x2716f3[_0x62bf('0x19')](_0x4e89cb)[_0x62bf('0x1b')](_0x209b95);}};}function respondWithFilteredResult(_0xa27d01,_0x430871){return function(_0x3ecaaf){if(_0x3ecaaf){var _0x1883a1=typeof _0x430871[_0x62bf('0x1c')]===_0x62bf('0x1d')&&typeof _0x430871[_0x62bf('0x1e')]===_0x62bf('0x1d');var _0x2e0e88=_0x3ecaaf[_0x62bf('0x1f')];var _0x1f05c5=_0x1883a1?0x0:_0x430871[_0x62bf('0x1c')];var _0x2c6656=_0x1883a1?_0x3ecaaf[_0x62bf('0x1f')]:_0x430871['offset']+_0x430871[_0x62bf('0x1e')];var _0x51d64d;if(_0x2c6656>=_0x2e0e88){_0x2c6656=_0x2e0e88;_0x51d64d=0xc8;}else{_0x51d64d=0xce;}_0xa27d01[_0x62bf('0x19')](_0x51d64d);return _0xa27d01[_0x62bf('0x20')](_0x62bf('0x21'),_0x1f05c5+'-'+_0x2c6656+'/'+_0x2e0e88)[_0x62bf('0x1b')](_0x3ecaaf);}return null;};}function patchUpdates(_0x4aa49a){return function(_0x3c21c9){try{jsonpatch[_0x62bf('0x22')](_0x3c21c9,_0x4aa49a,!![]);}catch(_0x450c1d){return BPromise[_0x62bf('0x23')](_0x450c1d);}return _0x3c21c9['save']();};}function saveUpdates(_0x16e2e5,_0x141743){return function(_0x1994e3){if(_0x1994e3){return _0x1994e3[_0x62bf('0x24')](_0x16e2e5)['then'](function(_0x12bd62){return _0x12bd62;});}return null;};}function removeEntity(_0x2b9d41,_0xd00e66){return function(_0x4d1c37){if(_0x4d1c37){return _0x4d1c37[_0x62bf('0x25')]()['then'](function(){_0x2b9d41[_0x62bf('0x19')](0xcc)[_0x62bf('0x1a')]();});}};}function handleEntityNotFound(_0x3a8b71,_0x1ec4c9){return function(_0x53f3ee){if(!_0x53f3ee){_0x3a8b71[_0x62bf('0x18')](0x194);}return _0x53f3ee;};}function handleError(_0x4ee477,_0x4682a4){_0x4682a4=_0x4682a4||0x1f4;return function(_0x142ec9){logger['error'](_0x142ec9[_0x62bf('0x26')]);if(_0x142ec9[_0x62bf('0x27')]){delete _0x142ec9[_0x62bf('0x27')];}_0x4ee477[_0x62bf('0x19')](_0x4682a4)[_0x62bf('0x28')](_0x142ec9);};}exports[_0x62bf('0x29')]=function(_0x4ea586,_0x2a295c){var _0x4b3170={},_0x25eeaf={},_0x337643={'count':0x0,'rows':[]};var _0x2e4a7f=_[_0x62bf('0x2a')](db[_0x62bf('0x2b')][_0x62bf('0x2c')],function(_0x689901){return{'name':_0x689901[_0x62bf('0x2d')],'type':_0x689901[_0x62bf('0x2e')][_0x62bf('0x2f')]};});_0x25eeaf[_0x62bf('0x30')]=_[_0x62bf('0x2a')](_0x2e4a7f,'name');_0x25eeaf[_0x62bf('0x31')]=_['keys'](_0x4ea586[_0x62bf('0x31')]);_0x25eeaf[_0x62bf('0x32')]=_[_0x62bf('0x33')](_0x25eeaf[_0x62bf('0x30')],_0x25eeaf['query']);_0x4b3170['attributes']=_[_0x62bf('0x33')](_0x25eeaf['model'],qs[_0x62bf('0x34')](_0x4ea586['query'][_0x62bf('0x34')]));_0x4b3170[_0x62bf('0x35')]=_0x4b3170[_0x62bf('0x35')]['length']?_0x4b3170['attributes']:_0x25eeaf[_0x62bf('0x30')];if(!_0x4ea586[_0x62bf('0x31')][_0x62bf('0x36')](_0x62bf('0x37'))){_0x4b3170['limit']=qs[_0x62bf('0x1e')](_0x4ea586['query']['limit']);_0x4b3170[_0x62bf('0x1c')]=qs['offset'](_0x4ea586['query']['offset']);}_0x4b3170['order']=qs[_0x62bf('0x38')](_0x4ea586['query'][_0x62bf('0x38')]);_0x4b3170[_0x62bf('0x39')]=qs[_0x62bf('0x32')](_[_0x62bf('0x3a')](_0x4ea586['query'],_0x25eeaf[_0x62bf('0x32')]),_0x2e4a7f);if(_0x4ea586[_0x62bf('0x31')][_0x62bf('0x3b')]){_0x4b3170[_0x62bf('0x39')]=_['merge'](_0x4b3170[_0x62bf('0x39')],{'$or':_['map'](_0x2e4a7f,function(_0x291081){if(_0x291081[_0x62bf('0x2e')]!=='VIRTUAL'){var _0x418598={};_0x418598[_0x291081[_0x62bf('0x27')]]={'$like':'%'+_0x4ea586[_0x62bf('0x31')][_0x62bf('0x3b')]+'%'};return _0x418598;}})});}_0x4b3170=_[_0x62bf('0x3c')]({},_0x4b3170,_0x4ea586[_0x62bf('0x3d')]);var _0x477fbd={'where':_0x4b3170[_0x62bf('0x39')]};return db[_0x62bf('0x2b')][_0x62bf('0x1f')](_0x477fbd)[_0x62bf('0x3e')](function(_0x22c2b6){_0x337643[_0x62bf('0x1f')]=_0x22c2b6;if(_0x4ea586[_0x62bf('0x31')][_0x62bf('0x3f')]){_0x4b3170[_0x62bf('0x40')]=[{'all':!![]}];}return db[_0x62bf('0x2b')][_0x62bf('0x41')](_0x4b3170);})['then'](function(_0x258fc2){_0x337643[_0x62bf('0x42')]=_0x258fc2;return _0x337643;})[_0x62bf('0x3e')](respondWithFilteredResult(_0x2a295c,_0x4b3170))[_0x62bf('0x43')](handleError(_0x2a295c,null));};exports[_0x62bf('0x44')]=function(_0x5e5461,_0x1e61ec){var _0x36b15b={'raw':![],'where':{'id':_0x5e5461[_0x62bf('0x45')]['id']}},_0x3176e9={};_0x3176e9[_0x62bf('0x30')]=_['keys'](db[_0x62bf('0x2b')][_0x62bf('0x2c')]);_0x3176e9['query']=_[_0x62bf('0x46')](_0x5e5461[_0x62bf('0x31')]);_0x3176e9[_0x62bf('0x32')]=_[_0x62bf('0x33')](_0x3176e9[_0x62bf('0x30')],_0x3176e9['query']);_0x36b15b['attributes']=_[_0x62bf('0x33')](_0x3176e9[_0x62bf('0x30')],qs[_0x62bf('0x34')](_0x5e5461[_0x62bf('0x31')]['fields']));_0x36b15b[_0x62bf('0x35')]=_0x36b15b[_0x62bf('0x35')][_0x62bf('0x47')]?_0x36b15b['attributes']:_0x3176e9['model'];if(_0x5e5461['query'][_0x62bf('0x3f')]){_0x36b15b[_0x62bf('0x40')]=[{'all':!![]}];}_0x36b15b=_['merge']({},_0x36b15b,_0x5e5461[_0x62bf('0x3d')]);return db['Automation'][_0x62bf('0x48')](_0x36b15b)[_0x62bf('0x3e')](handleEntityNotFound(_0x1e61ec,null))['then'](respondWithResult(_0x1e61ec,null))[_0x62bf('0x43')](handleError(_0x1e61ec,null));};exports[_0x62bf('0x49')]=function(_0x4e92b6,_0x5abce7){return db[_0x62bf('0x2b')][_0x62bf('0x49')](_0x4e92b6[_0x62bf('0x4a')],{})[_0x62bf('0x3e')](respondWithResult(_0x5abce7,0xc9))[_0x62bf('0x43')](handleError(_0x5abce7,null));};exports[_0x62bf('0x24')]=function(_0x4ee924,_0x521648){if(_0x4ee924[_0x62bf('0x4a')]['id']){delete _0x4ee924[_0x62bf('0x4a')]['id'];}return db['Automation'][_0x62bf('0x48')]({'where':{'id':_0x4ee924[_0x62bf('0x45')]['id']}})[_0x62bf('0x3e')](handleEntityNotFound(_0x521648,null))[_0x62bf('0x3e')](saveUpdates(_0x4ee924[_0x62bf('0x4a')],null))[_0x62bf('0x3e')](respondWithResult(_0x521648,null))[_0x62bf('0x43')](handleError(_0x521648,null));};exports[_0x62bf('0x25')]=function(_0x3f71d5,_0x25dc99){return db['Automation']['find']({'where':{'id':_0x3f71d5[_0x62bf('0x45')]['id']}})['then'](handleEntityNotFound(_0x25dc99,null))[_0x62bf('0x3e')](removeEntity(_0x25dc99,null))[_0x62bf('0x43')](handleError(_0x25dc99,null));};exports[_0x62bf('0x4b')]=function(_0x263ab2,_0x5d8217,_0x3bf47c){return db[_0x62bf('0x4c')][_0x62bf('0x48')]({'where':{'id':_0x263ab2[_0x62bf('0x45')]['id']}})[_0x62bf('0x3e')](handleEntityNotFound(_0x5d8217,null))['then'](function(_0x1c3aba){if(_0x1c3aba){return _0x1c3aba[_0x62bf('0x4b')](_0x263ab2[_0x62bf('0x4a')]['ids'],_[_0x62bf('0x4d')](_0x263ab2['body'],[_0x62bf('0x4e'),'id'])||{});}})[_0x62bf('0x3e')](respondWithResult(_0x5d8217,null))[_0x62bf('0x43')](handleError(_0x5d8217,null));};exports['getConditions']=function(_0x5e1add,_0x1d9f49,_0x168a73){var _0x300067={};var _0x2679c4={};var _0x2dcd99;var _0x182566;return db[_0x62bf('0x2b')][_0x62bf('0x4f')]({'where':{'id':_0x5e1add[_0x62bf('0x45')]['id']}})[_0x62bf('0x3e')](handleEntityNotFound(_0x1d9f49,null))[_0x62bf('0x3e')](function(_0x4e1e33){if(_0x4e1e33){_0x2dcd99=_0x4e1e33;_0x2679c4['model']=_[_0x62bf('0x46')](db[_0x62bf('0x4c')][_0x62bf('0x2c')]);_0x2679c4['query']=_[_0x62bf('0x46')](_0x5e1add[_0x62bf('0x31')]);_0x2679c4['filters']=_['intersection'](_0x2679c4['model'],_0x2679c4[_0x62bf('0x31')]);_0x300067[_0x62bf('0x35')]=_['intersection'](_0x2679c4[_0x62bf('0x30')],qs[_0x62bf('0x34')](_0x5e1add[_0x62bf('0x31')]['fields']));_0x300067[_0x62bf('0x35')]=_0x300067['attributes']['length']?_0x300067[_0x62bf('0x35')]:_0x2679c4[_0x62bf('0x30')];_0x300067['order']=qs['sort'](_0x5e1add[_0x62bf('0x31')][_0x62bf('0x38')]);_0x300067[_0x62bf('0x39')]=qs[_0x62bf('0x32')](_[_0x62bf('0x3a')](_0x5e1add[_0x62bf('0x31')],_0x2679c4[_0x62bf('0x32')]));if(_0x5e1add[_0x62bf('0x31')][_0x62bf('0x3b')]){_0x300067[_0x62bf('0x39')]=_[_0x62bf('0x3c')](_0x300067[_0x62bf('0x39')],{'$or':_['map'](_0x300067[_0x62bf('0x35')],function(_0x2bf91b){var _0x3f84ea={};_0x3f84ea[_0x2bf91b]={'$like':'%'+_0x5e1add[_0x62bf('0x31')][_0x62bf('0x3b')]+'%'};return _0x3f84ea;})});}_0x300067=_['merge']({},_0x300067,_0x5e1add[_0x62bf('0x3d')]);return _0x2dcd99[_0x62bf('0x50')](_0x300067);}})['then'](function(_0x36745b){if(_0x36745b){_0x182566=_0x36745b[_0x62bf('0x47')];if(!_0x5e1add['query']['hasOwnProperty']('nolimit')){_0x300067[_0x62bf('0x1e')]=qs[_0x62bf('0x1e')](_0x5e1add[_0x62bf('0x31')][_0x62bf('0x1e')]);_0x300067[_0x62bf('0x1c')]=qs[_0x62bf('0x1c')](_0x5e1add[_0x62bf('0x31')][_0x62bf('0x1c')]);}return _0x2dcd99[_0x62bf('0x50')](_0x300067);}})[_0x62bf('0x3e')](function(_0x2931e4){if(_0x2931e4){return _0x2931e4?{'count':_0x182566,'rows':_0x2931e4}:null;}})[_0x62bf('0x3e')](respondWithResult(_0x1d9f49,null))[_0x62bf('0x43')](handleError(_0x1d9f49,null));};exports[_0x62bf('0x51')]=function(_0x4ba6ec,_0x4a800d,_0x1cb261){return db['Action'][_0x62bf('0x48')]({'where':{'id':_0x4ba6ec[_0x62bf('0x45')]['id']}})[_0x62bf('0x3e')](handleEntityNotFound(_0x4a800d,null))[_0x62bf('0x3e')](function(_0x4ef3c5){if(_0x4ef3c5){return _0x4ef3c5[_0x62bf('0x51')](_0x4ba6ec[_0x62bf('0x4a')][_0x62bf('0x4e')],_[_0x62bf('0x4d')](_0x4ba6ec[_0x62bf('0x4a')],[_0x62bf('0x4e'),'id'])||{});}})[_0x62bf('0x3e')](respondWithResult(_0x4a800d,null))[_0x62bf('0x43')](handleError(_0x4a800d,null));};exports['getActions']=function(_0x1b88b8,_0x48c24a,_0x17a395){var _0xd78c58={};var _0x302894={};var _0x25f8e0;var _0x4d5835;return db[_0x62bf('0x2b')][_0x62bf('0x4f')]({'where':{'id':_0x1b88b8[_0x62bf('0x45')]['id']}})[_0x62bf('0x3e')](handleEntityNotFound(_0x48c24a,null))['then'](function(_0x3fc299){if(_0x3fc299){_0x25f8e0=_0x3fc299;_0x302894[_0x62bf('0x30')]=_[_0x62bf('0x46')](db[_0x62bf('0x52')][_0x62bf('0x2c')]);_0x302894[_0x62bf('0x31')]=_[_0x62bf('0x46')](_0x1b88b8[_0x62bf('0x31')]);_0x302894[_0x62bf('0x32')]=_[_0x62bf('0x33')](_0x302894[_0x62bf('0x30')],_0x302894['query']);_0xd78c58[_0x62bf('0x35')]=_['intersection'](_0x302894['model'],qs[_0x62bf('0x34')](_0x1b88b8[_0x62bf('0x31')][_0x62bf('0x34')]));_0xd78c58[_0x62bf('0x35')]=_0xd78c58[_0x62bf('0x35')][_0x62bf('0x47')]?_0xd78c58[_0x62bf('0x35')]:_0x302894[_0x62bf('0x30')];_0xd78c58[_0x62bf('0x53')]=qs[_0x62bf('0x38')](_0x1b88b8['query'][_0x62bf('0x38')]);_0xd78c58['where']=qs[_0x62bf('0x32')](_[_0x62bf('0x3a')](_0x1b88b8[_0x62bf('0x31')],_0x302894[_0x62bf('0x32')]));if(_0x1b88b8[_0x62bf('0x31')][_0x62bf('0x3b')]){_0xd78c58[_0x62bf('0x39')]=_[_0x62bf('0x3c')](_0xd78c58[_0x62bf('0x39')],{'$or':_['map'](_0xd78c58['attributes'],function(_0x410893){var _0x3a0734={};_0x3a0734[_0x410893]={'$like':'%'+_0x1b88b8[_0x62bf('0x31')][_0x62bf('0x3b')]+'%'};return _0x3a0734;})});}_0xd78c58=_[_0x62bf('0x3c')]({},_0xd78c58,_0x1b88b8[_0x62bf('0x3d')]);return _0x25f8e0[_0x62bf('0x54')](_0xd78c58);}})['then'](function(_0x2eee6a){if(_0x2eee6a){_0x4d5835=_0x2eee6a[_0x62bf('0x47')];if(!_0x1b88b8[_0x62bf('0x31')][_0x62bf('0x36')](_0x62bf('0x37'))){_0xd78c58[_0x62bf('0x1e')]=qs['limit'](_0x1b88b8[_0x62bf('0x31')][_0x62bf('0x1e')]);_0xd78c58[_0x62bf('0x1c')]=qs[_0x62bf('0x1c')](_0x1b88b8[_0x62bf('0x31')][_0x62bf('0x1c')]);}return _0x25f8e0['getActions'](_0xd78c58);}})[_0x62bf('0x3e')](function(_0x3f2db8){if(_0x3f2db8){return _0x3f2db8?{'count':_0x4d5835,'rows':_0x3f2db8}:null;}})[_0x62bf('0x3e')](respondWithResult(_0x48c24a,null))['catch'](handleError(_0x48c24a,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 23f7a1b..00894ec 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 _0x129e=['exports','define','Automation','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./automation.attributes'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x129e,0x12e));var _0xe129=function(_0x264917,_0x98e348){_0x264917=_0x264917-0x0;var _0x182b5a=_0x129e[_0x264917];return _0x182b5a;};'use strict';var _=require(_0xe129('0x0'));var util=require(_0xe129('0x1'));var logger=require(_0xe129('0x2'))(_0xe129('0x3'));var moment=require(_0xe129('0x4'));var BPromise=require(_0xe129('0x5'));var rp=require(_0xe129('0x6'));var fs=require('fs');var path=require(_0xe129('0x7'));var rimraf=require(_0xe129('0x8'));var config=require('../../config/environment');var attributes=require(_0xe129('0x9'));module[_0xe129('0xa')]=function(_0x44ad13,_0x23eea5){return _0x44ad13[_0xe129('0xb')](_0xe129('0xc'),attributes,{'tableName':'tools_automations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x942c=['path','rimraf','../../config/environment','./automation.attributes','exports','define','tools_automations','lodash','../../config/logger','moment','request-promise'];(function(_0x565d65,_0x436914){var _0x3797e1=function(_0x113817){while(--_0x113817){_0x565d65['push'](_0x565d65['shift']());}};_0x3797e1(++_0x436914);}(_0x942c,0x10f));var _0xc942=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x942c[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xc942('0x0'));var util=require('util');var logger=require(_0xc942('0x1'))('api');var moment=require(_0xc942('0x2'));var BPromise=require('bluebird');var rp=require(_0xc942('0x3'));var fs=require('fs');var path=require(_0xc942('0x4'));var rimraf=require(_0xc942('0x5'));var config=require(_0xc942('0x6'));var attributes=require(_0xc942('0x7'));module[_0xc942('0x8')]=function(_0x2ba0b9,_0x366a15){return _0x2ba0b9[_0xc942('0x9')]('Automation',attributes,{'tableName':_0xc942('0xa'),'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 cee7b29..d70e1c3 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 _0x5204=['rpc','jayson/promise','client','http','request','info','Automation,\x20%s,\x20%s','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5204,0xdf));var _0x4520=function(_0x13f980,_0x1e1c56){_0x13f980=_0x13f980-0x0;var _0x27153c=_0x5204[_0x13f980];return _0x27153c;};'use strict';var _=require(_0x4520('0x0'));var util=require(_0x4520('0x1'));var moment=require('moment');var BPromise=require(_0x4520('0x2'));var rs=require(_0x4520('0x3'));var fs=require('fs');var Redis=require(_0x4520('0x4'));var db=require(_0x4520('0x5'))['db'];var utils=require(_0x4520('0x6'));var logger=require('../../config/logger')(_0x4520('0x7'));var config=require('../../config/environment');var jayson=require(_0x4520('0x8'));var client=jayson[_0x4520('0x9')][_0x4520('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe741c2,_0x396d29,_0x446dc9){return new BPromise(function(_0x27890f,_0x55b44f){return client[_0x4520('0xb')](_0xe741c2,_0x446dc9)['then'](function(_0x168e62){logger[_0x4520('0xc')](_0x4520('0xd'),_0x396d29,_0x4520('0xe'));logger[_0x4520('0xf')](_0x4520('0x10'),_0x396d29,_0x4520('0xe'),JSON[_0x4520('0x11')](_0x168e62));if(_0x168e62[_0x4520('0x12')]){if(_0x168e62[_0x4520('0x12')][_0x4520('0x13')]===0x1f4){logger[_0x4520('0x12')](_0x4520('0xd'),_0x396d29,_0x168e62[_0x4520('0x12')][_0x4520('0x14')]);return _0x55b44f(_0x168e62[_0x4520('0x12')][_0x4520('0x14')]);}logger[_0x4520('0x12')](_0x4520('0xd'),_0x396d29,_0x168e62[_0x4520('0x12')][_0x4520('0x14')]);return _0x27890f(_0x168e62['error'][_0x4520('0x14')]);}else{logger[_0x4520('0xc')](_0x4520('0xd'),_0x396d29,_0x4520('0xe'));_0x27890f(_0x168e62[_0x4520('0x15')]['message']);}})[_0x4520('0x16')](function(_0x33ac29){logger[_0x4520('0x12')](_0x4520('0xd'),_0x396d29,_0x33ac29);_0x55b44f(_0x33ac29);});});} \ No newline at end of file +var _0x3f72=['request\x20sent','Automation,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','Automation,\x20%s,\x20%s'];(function(_0x381606,_0x53382c){var _0x31c4ca=function(_0x310493){while(--_0x310493){_0x381606['push'](_0x381606['shift']());}};_0x31c4ca(++_0x53382c);}(_0x3f72,0xaf));var _0x23f7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3f72[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x23f7('0x0'));var util=require(_0x23f7('0x1'));var moment=require(_0x23f7('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x23f7('0x3'));var db=require(_0x23f7('0x4'))['db'];var utils=require(_0x23f7('0x5'));var logger=require(_0x23f7('0x6'))(_0x23f7('0x7'));var config=require('../../config/environment');var jayson=require(_0x23f7('0x8'));var client=jayson['client'][_0x23f7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5cc54a,_0x23e468,_0x2db48b){return new BPromise(function(_0x412d29,_0x258026){return client[_0x23f7('0xa')](_0x5cc54a,_0x2db48b)[_0x23f7('0xb')](function(_0x3a048c){logger[_0x23f7('0xc')](_0x23f7('0xd'),_0x23e468,_0x23f7('0xe'));logger['debug'](_0x23f7('0xf'),_0x23e468,_0x23f7('0xe'),JSON[_0x23f7('0x10')](_0x3a048c));if(_0x3a048c['error']){if(_0x3a048c['error'][_0x23f7('0x11')]===0x1f4){logger[_0x23f7('0x12')](_0x23f7('0xd'),_0x23e468,_0x3a048c[_0x23f7('0x12')][_0x23f7('0x13')]);return _0x258026(_0x3a048c['error'][_0x23f7('0x13')]);}logger[_0x23f7('0x12')](_0x23f7('0xd'),_0x23e468,_0x3a048c[_0x23f7('0x12')]['message']);return _0x412d29(_0x3a048c[_0x23f7('0x12')][_0x23f7('0x13')]);}else{logger[_0x23f7('0xc')](_0x23f7('0xd'),_0x23e468,_0x23f7('0xe'));_0x412d29(_0x3a048c[_0x23f7('0x14')][_0x23f7('0x13')]);}})['catch'](function(_0x2669ab){logger[_0x23f7('0x12')]('Automation,\x20%s,\x20%s',_0x23e468,_0x2669ab);_0x258026(_0x2669ab);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 71edccf..d56bf2e 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 _0x8bc3=['create','update','destroy','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','isAuthenticated','index','get','/:id','/:id/conditions','getConditions','/:id/actions','getActions','post'];(function(_0x119da2,_0x1651ee){var _0x5724ec=function(_0x388b79){while(--_0x388b79){_0x119da2['push'](_0x119da2['shift']());}};_0x5724ec(++_0x1651ee);}(_0x8bc3,0x82));var _0x38bc=function(_0x38d4ac,_0x19cf87){_0x38d4ac=_0x38d4ac-0x0;var _0x3497fb=_0x8bc3[_0x38d4ac];return _0x3497fb;};'use strict';var multer=require(_0x38bc('0x0'));var util=require('util');var path=require(_0x38bc('0x1'));var timeout=require('connect-timeout');var express=require(_0x38bc('0x2'));var router=express[_0x38bc('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x38bc('0x4'));var interaction=require(_0x38bc('0x5'));var config=require(_0x38bc('0x6'));var controller=require(_0x38bc('0x7'));router['get']('/',auth[_0x38bc('0x8')](),controller[_0x38bc('0x9')]);router[_0x38bc('0xa')](_0x38bc('0xb'),auth[_0x38bc('0x8')](),controller['show']);router['get'](_0x38bc('0xc'),auth[_0x38bc('0x8')](),controller[_0x38bc('0xd')]);router[_0x38bc('0xa')](_0x38bc('0xe'),auth[_0x38bc('0x8')](),controller[_0x38bc('0xf')]);router[_0x38bc('0x10')]('/',auth[_0x38bc('0x8')](),controller[_0x38bc('0x11')]);router['post']('/:id/conditions',auth['isAuthenticated'](),controller['addConditions']);router[_0x38bc('0x10')]('/:id/actions',auth['isAuthenticated'](),controller['addActions']);router['put'](_0x38bc('0xb'),auth[_0x38bc('0x8')](),controller[_0x38bc('0x12')]);router['delete'](_0x38bc('0xb'),auth[_0x38bc('0x8')](),controller[_0x38bc('0x13')]);module[_0x38bc('0x14')]=router; \ No newline at end of file +var _0xb0b4=['create','addConditions','addActions','update','delete','exports','multer','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./automation.controller','get','isAuthenticated','index','/:id','show','/:id/conditions','getConditions','/:id/actions','post'];(function(_0x80bc0f,_0x2f084a){var _0x29685c=function(_0x377326){while(--_0x377326){_0x80bc0f['push'](_0x80bc0f['shift']());}};_0x29685c(++_0x2f084a);}(_0xb0b4,0xb6));var _0x4b0b=function(_0x2eabb7,_0x57cb12){_0x2eabb7=_0x2eabb7-0x0;var _0x27186f=_0xb0b4[_0x2eabb7];return _0x27186f;};'use strict';var multer=require(_0x4b0b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x4b0b('0x1'));var express=require(_0x4b0b('0x2'));var router=express['Router']();var fs_extra=require(_0x4b0b('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x4b0b('0x4'));var config=require(_0x4b0b('0x5'));var controller=require(_0x4b0b('0x6'));router[_0x4b0b('0x7')]('/',auth[_0x4b0b('0x8')](),controller[_0x4b0b('0x9')]);router[_0x4b0b('0x7')](_0x4b0b('0xa'),auth[_0x4b0b('0x8')](),controller[_0x4b0b('0xb')]);router[_0x4b0b('0x7')](_0x4b0b('0xc'),auth[_0x4b0b('0x8')](),controller[_0x4b0b('0xd')]);router[_0x4b0b('0x7')](_0x4b0b('0xe'),auth[_0x4b0b('0x8')](),controller['getActions']);router[_0x4b0b('0xf')]('/',auth['isAuthenticated'](),controller[_0x4b0b('0x10')]);router[_0x4b0b('0xf')]('/:id/conditions',auth[_0x4b0b('0x8')](),controller[_0x4b0b('0x11')]);router[_0x4b0b('0xf')](_0x4b0b('0xe'),auth[_0x4b0b('0x8')](),controller[_0x4b0b('0x12')]);router['put'](_0x4b0b('0xa'),auth[_0x4b0b('0x8')](),controller[_0x4b0b('0x13')]);router[_0x4b0b('0x14')](_0x4b0b('0xa'),auth[_0x4b0b('0x8')](),controller['destroy']);module[_0x4b0b('0x15')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index af38eca..6f82fcd 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 _0x6ce5=['#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Maximum\x20Word\x20Length','ASC','#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\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)','sequelize','exports','STRING','name','ENUM','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)'];(function(_0x3bb06c,_0x2e3a24){var _0x4e1722=function(_0x502ab7){while(--_0x502ab7){_0x3bb06c['push'](_0x3bb06c['shift']());}};_0x4e1722(++_0x2e3a24);}(_0x6ce5,0x1b9));var _0x56ce=function(_0x2d1f90,_0x522ec3){_0x2d1f90=_0x2d1f90-0x0;var _0x3927f5=_0x6ce5[_0x2d1f90];return _0x3927f5;};'use strict';var Sequelize=require(_0x56ce('0x0'));module[_0x56ce('0x1')]={'name':{'type':Sequelize[_0x56ce('0x2')],'unique':_0x56ce('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x56ce('0x4')]('ivr'),'allowNull':![],'defaultValue':'ivr'},'description':{'type':Sequelize[_0x56ce('0x2')]},'active':{'type':Sequelize[_0x56ce('0x5')],'defaultValue':0x0,'comment':_0x56ce('0x6')},'limitCalls':{'type':Sequelize[_0x56ce('0x7')](0x4)[_0x56ce('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x56ce('0x9')},'dialOriginateCallerIdName':{'type':Sequelize[_0x56ce('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x56ce('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x56ce('0x7')](0x3)[_0x56ce('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x56ce('0xa')},'dialCongestionMaxRetry':{'type':Sequelize[_0x56ce('0x7')](0x3)[_0x56ce('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x56ce('0xb')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x56ce('0x7')](0x5)[_0x56ce('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x56ce('0xc')},'dialBusyMaxRetry':{'type':Sequelize[_0x56ce('0x7')](0x3)[_0x56ce('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0x56ce('0x7')](0x5)[_0x56ce('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x56ce('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0x56ce('0xd')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x56ce('0x7')](0x5)[_0x56ce('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0x56ce('0x7')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x56ce('0xe')},'dialTimezone':{'type':Sequelize[_0x56ce('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x56ce('0x2')],'defaultValue':_0x56ce('0xf')},'dialCheckDuplicateType':{'type':Sequelize[_0x56ce('0x4')](_0x56ce('0x10'),_0x56ce('0x11'),_0x56ce('0x12')),'defaultValue':_0x56ce('0x10')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x56ce('0x13')},'dialAMDInitialSilence':{'type':Sequelize[_0x56ce('0x7')](0x9)[_0x56ce('0x8')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x56ce('0x14')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x56ce('0x15')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x56ce('0x7')](0x9)[_0x56ce('0x8')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0x56ce('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x56ce('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x56ce('0x16')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x56ce('0x7')](0x9)[_0x56ce('0x8')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x56ce('0x17')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x56ce('0x7')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x56ce('0x18')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0x56ce('0x8')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0x56ce('0x7')](0x9)[_0x56ce('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x56ce('0x19')},'dialOrderByScheduledAt':{'type':Sequelize[_0x56ce('0x4')]('DESC',_0x56ce('0x1a')),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize[_0x56ce('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x56ce('0x7')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0x56ce('0x7')](0x3)[_0x56ce('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x56ce('0x7')](0x3)[_0x56ce('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x56ce('0x1b')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x56ce('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x56ce('0x1c')},'dialDropMaxRetry':{'type':Sequelize[_0x56ce('0x7')](0x3)[_0x56ce('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x56ce('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x56ce('0x1d')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x56ce('0x7')](0x3)[_0x56ce('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x56ce('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x56ce('0x1e')},'dialMachineMaxRetry':{'type':Sequelize[_0x56ce('0x7')](0x3)[_0x56ce('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x56ce('0x1f')},'dialMachineRetryFrequency':{'type':Sequelize[_0x56ce('0x7')](0x5)[_0x56ce('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x56ce('0x20')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x56ce('0x7')](0x3)[_0x56ce('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x56ce('0x21')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x56ce('0x7')](0x5)[_0x56ce('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x56ce('0x22')}}; \ No newline at end of file +var _0xd027=['#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','exports','ENUM','ivr','STRING','BOOLEAN','Active/Disactive\x20Campaign','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)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words'];(function(_0x144a2e,_0x341bfc){var _0x590814=function(_0x55f82e){while(--_0x55f82e){_0x144a2e['push'](_0x144a2e['shift']());}};_0x590814(++_0x341bfc);}(_0xd027,0x197));var _0x7d02=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xd027[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');module[_0x7d02('0x0')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x7d02('0x1')](_0x7d02('0x2')),'allowNull':![],'defaultValue':_0x7d02('0x2')},'description':{'type':Sequelize[_0x7d02('0x3')]},'active':{'type':Sequelize[_0x7d02('0x4')],'defaultValue':0x0,'comment':_0x7d02('0x5')},'limitCalls':{'type':Sequelize[_0x7d02('0x6')](0x4)[_0x7d02('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':'Max\x20200\x20calls.'},'dialOriginateCallerIdName':{'type':Sequelize[_0x7d02('0x3')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x7d02('0x3')]},'dialOriginateTimeout':{'type':Sequelize[_0x7d02('0x6')](0x3)[_0x7d02('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7d02('0x8')},'dialCongestionMaxRetry':{'type':Sequelize[_0x7d02('0x6')](0x3)[_0x7d02('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7d02('0x9')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x7d02('0x6')](0x5)[_0x7d02('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7d02('0xa')},'dialBusyMaxRetry':{'type':Sequelize[_0x7d02('0x6')](0x3)[_0x7d02('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0x7d02('0x6')](0x5)[_0x7d02('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x7d02('0x6')](0x3)[_0x7d02('0x7')],'defaultValue':0x3,'comment':_0x7d02('0xb')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x7d02('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7d02('0xc')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x7d02('0x7')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x7d02('0xd')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x7d02('0x3')],'defaultValue':_0x7d02('0xe')},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x7d02('0xf'),_0x7d02('0x10'),_0x7d02('0x11')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x7d02('0x4')],'defaultValue':0x0,'comment':_0x7d02('0x12')},'dialAMDInitialSilence':{'type':Sequelize[_0x7d02('0x6')](0x9)[_0x7d02('0x7')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x7d02('0x13')},'dialAMDGreeting':{'type':Sequelize[_0x7d02('0x6')](0x9)[_0x7d02('0x7')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x7d02('0x14')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x7d02('0x6')](0x9)[_0x7d02('0x7')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x7d02('0x15')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x7d02('0x6')](0x9)[_0x7d02('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x7d02('0x16')},'dialAMDMinWordLength':{'type':Sequelize[_0x7d02('0x6')](0x9)[_0x7d02('0x7')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x7d02('0x6')](0x9)[_0x7d02('0x7')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x7d02('0x17')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x7d02('0x6')](0x9)[_0x7d02('0x7')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x7d02('0x18')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x7d02('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x7d02('0x19')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x7d02('0x6')](0x9)[_0x7d02('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x7d02('0x1a')},'dialOrderByScheduledAt':{'type':Sequelize[_0x7d02('0x1')](_0x7d02('0x1b'),_0x7d02('0x1c')),'defaultValue':_0x7d02('0x1b')},'dialPrefix':{'type':Sequelize[_0x7d02('0x3')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x7d02('0x6')](0x3)[_0x7d02('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0x7d02('0x6')](0x3)[_0x7d02('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x7d02('0x1d')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7d02('0x1e')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x7d02('0x6')](0x5)[_0x7d02('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7d02('0x1f')},'dialDropMaxRetry':{'type':Sequelize[_0x7d02('0x6')](0x3)[_0x7d02('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7d02('0x20')},'dialDropRetryFrequency':{'type':Sequelize[_0x7d02('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x7d02('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7d02('0x21')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x7d02('0x6')](0x5)[_0x7d02('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0x7d02('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x7d02('0x6')](0x5)[_0x7d02('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7d02('0x22')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x7d02('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7d02('0x23')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x7d02('0x6')](0x5)[_0x7d02('0x7')],'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 ae711e3..3e38e21 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 _0x1d63=['attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','rows','catch','params','length','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','IvrCampaigns','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','fields','omit','createdAt','updatedAt','UserProfileSection','getHoppers','findOne','CmHopper','CampaignId','findAll','CmHopperHistory','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','addLists','ids','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','select','field','phone','NOW()','CmListId','toString','ListId','from','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','onlyIfOpen','cm_contacts','deletedAt\x20IS\x20NULL','CampaignId\x20=\x20?','push','all','removeLists','getBlackLists','addBlackLists','cm_hopper_black','sequelize','removeBlackLists','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','end','offset','undefined','limit','count','status','set','Content-Range','apply','reject','update','destroy','get','UserProfileResource','then','error','name','index','map','Campaign','rawAttributes','type','key','query','keys','filters','intersection','model'];(function(_0x286a1c,_0x11c207){var _0x52f18b=function(_0x55677e){while(--_0x55677e){_0x286a1c['push'](_0x286a1c['shift']());}};_0x52f18b(++_0x11c207);}(_0x1d63,0x14f));var _0x31d6=function(_0x138e88,_0x559802){_0x138e88=_0x138e88-0x0;var _0x452f20=_0x1d63[_0x138e88];return _0x452f20;};'use strict';var emlformat=require(_0x31d6('0x0'));var rimraf=require(_0x31d6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x31d6('0x2'));var rp=require(_0x31d6('0x3'));var moment=require(_0x31d6('0x4'));var BPromise=require(_0x31d6('0x5'));var Mustache=require(_0x31d6('0x6'));var util=require(_0x31d6('0x7'));var path=require(_0x31d6('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x31d6('0x9'));var _=require(_0x31d6('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x31d6('0xb'));var deskjs=require(_0x31d6('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x31d6('0xd'));var Redis=require(_0x31d6('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x31d6('0xf'));var logger=require(_0x31d6('0x10'))(_0x31d6('0x11'));var utils=require(_0x31d6('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x31d6('0x13'))['db'];function respondWithStatusCode(_0x38f302,_0x4fd486){_0x4fd486=_0x4fd486||0xcc;return function(_0x4cf6b4){if(_0x4cf6b4){return _0x38f302[_0x31d6('0x14')](_0x4fd486);}return _0x38f302['status'](_0x4fd486)[_0x31d6('0x15')]();};}function respondWithResult(_0x1ae053,_0x292b84){_0x292b84=_0x292b84||0xc8;return function(_0xed8063){if(_0xed8063){return _0x1ae053['status'](_0x292b84)['json'](_0xed8063);}};}function respondWithFilteredResult(_0xb5bb6,_0x2af5d1){return function(_0x48628b){if(_0x48628b){var _0x104649=typeof _0x2af5d1[_0x31d6('0x16')]===_0x31d6('0x17')&&typeof _0x2af5d1[_0x31d6('0x18')]===_0x31d6('0x17');var _0x31d80b=_0x48628b[_0x31d6('0x19')];var _0x4554fa=_0x104649?0x0:_0x2af5d1['offset'];var _0x27d283=_0x104649?_0x48628b[_0x31d6('0x19')]:_0x2af5d1[_0x31d6('0x16')]+_0x2af5d1[_0x31d6('0x18')];var _0x2c0552;if(_0x27d283>=_0x31d80b){_0x27d283=_0x31d80b;_0x2c0552=0xc8;}else{_0x2c0552=0xce;}_0xb5bb6[_0x31d6('0x1a')](_0x2c0552);return _0xb5bb6[_0x31d6('0x1b')](_0x31d6('0x1c'),_0x4554fa+'-'+_0x27d283+'/'+_0x31d80b)['json'](_0x48628b);}return null;};}function patchUpdates(_0xe9feaa){return function(_0x1aecde){try{jsonpatch[_0x31d6('0x1d')](_0x1aecde,_0xe9feaa,!![]);}catch(_0x588e42){return BPromise[_0x31d6('0x1e')](_0x588e42);}return _0x1aecde['save']();};}function saveUpdates(_0x441c1a,_0x515619){return function(_0x44db6f){if(_0x44db6f){return _0x44db6f[_0x31d6('0x1f')](_0x441c1a)['then'](function(_0x244bcc){return _0x244bcc;});}return null;};}function removeEntity(_0x16fdcd,_0x10f01b){return function(_0x3a202c){if(_0x3a202c){return _0x3a202c[_0x31d6('0x20')]()['then'](function(){var _0x2c866f=_0x3a202c[_0x31d6('0x21')]({'plain':!![]});var _0x846a4b='IvrCampaigns';return db[_0x31d6('0x22')]['destroy']({'where':{'type':_0x846a4b,'resourceId':_0x2c866f['id']}})[_0x31d6('0x23')](function(){return _0x3a202c;});})[_0x31d6('0x23')](function(){_0x16fdcd[_0x31d6('0x1a')](0xcc)[_0x31d6('0x15')]();});}};}function handleEntityNotFound(_0x27868a,_0x3356f2){return function(_0x238226){if(!_0x238226){_0x27868a[_0x31d6('0x14')](0x194);}return _0x238226;};}function handleError(_0x56af42,_0x18a63e){_0x18a63e=_0x18a63e||0x1f4;return function(_0x10373d){logger[_0x31d6('0x24')](_0x10373d['stack']);if(_0x10373d[_0x31d6('0x25')]){delete _0x10373d['name'];}_0x56af42[_0x31d6('0x1a')](_0x18a63e)['send'](_0x10373d);};}exports[_0x31d6('0x26')]=function(_0xa6b215,_0x4a30ce){var _0x540202={},_0xeaa5b9={},_0x206234={'count':0x0,'rows':[]};var _0x1efce4=_[_0x31d6('0x27')](db[_0x31d6('0x28')][_0x31d6('0x29')],function(_0x1bf6c9){return{'name':_0x1bf6c9['fieldName'],'type':_0x1bf6c9[_0x31d6('0x2a')][_0x31d6('0x2b')]};});_0xeaa5b9['model']=_[_0x31d6('0x27')](_0x1efce4,_0x31d6('0x25'));_0xeaa5b9[_0x31d6('0x2c')]=_[_0x31d6('0x2d')](_0xa6b215[_0x31d6('0x2c')]);_0xeaa5b9[_0x31d6('0x2e')]=_[_0x31d6('0x2f')](_0xeaa5b9[_0x31d6('0x30')],_0xeaa5b9['query']);_0x540202[_0x31d6('0x31')]=_[_0x31d6('0x2f')](_0xeaa5b9['model'],qs['fields'](_0xa6b215[_0x31d6('0x2c')]['fields']));_0x540202['attributes']=_0x540202[_0x31d6('0x31')]['length']?_0x540202['attributes']:_0xeaa5b9[_0x31d6('0x30')];if(!_0xa6b215['query'][_0x31d6('0x32')](_0x31d6('0x33'))){_0x540202[_0x31d6('0x18')]=qs[_0x31d6('0x18')](_0xa6b215[_0x31d6('0x2c')]['limit']);_0x540202[_0x31d6('0x16')]=qs[_0x31d6('0x16')](_0xa6b215[_0x31d6('0x2c')][_0x31d6('0x16')]);}_0x540202[_0x31d6('0x34')]=qs[_0x31d6('0x35')](_0xa6b215[_0x31d6('0x2c')][_0x31d6('0x35')]);_0x540202[_0x31d6('0x36')]=qs[_0x31d6('0x2e')](_[_0x31d6('0x37')](_0xa6b215[_0x31d6('0x2c')],_0xeaa5b9[_0x31d6('0x2e')]),_0x1efce4);if(_0xa6b215[_0x31d6('0x2c')][_0x31d6('0x38')]){_0x540202['where']=_['merge'](_0x540202['where'],{'$or':_[_0x31d6('0x27')](_0x1efce4,function(_0x705a28){if(_0x705a28['type']!==_0x31d6('0x39')){var _0x1f178c={};_0x1f178c[_0x705a28[_0x31d6('0x25')]]={'$like':'%'+_0xa6b215[_0x31d6('0x2c')][_0x31d6('0x38')]+'%'};return _0x1f178c;}})});}_0x540202=_['merge']({},_0x540202,_0xa6b215[_0x31d6('0x3a')]);var _0x3f10a9={'where':_0x540202[_0x31d6('0x36')]};return db[_0x31d6('0x28')]['count'](_0x3f10a9)[_0x31d6('0x23')](function(_0x2e0744){_0x206234[_0x31d6('0x19')]=_0x2e0744;if(_0xa6b215['query'][_0x31d6('0x3b')]){_0x540202[_0x31d6('0x3c')]=[{'all':!![]}];}return db[_0x31d6('0x28')]['findAll'](_0x540202);})[_0x31d6('0x23')](function(_0x53c65f){_0x206234[_0x31d6('0x3d')]=_0x53c65f;return _0x206234;})[_0x31d6('0x23')](respondWithFilteredResult(_0x4a30ce,_0x540202))[_0x31d6('0x3e')](handleError(_0x4a30ce,null));};exports['show']=function(_0x2e03f7,_0x2ad9a5){var _0x2b290d={'raw':![],'where':{'id':_0x2e03f7[_0x31d6('0x3f')]['id']}},_0x32a3a1={};_0x32a3a1[_0x31d6('0x30')]=_[_0x31d6('0x2d')](db[_0x31d6('0x28')][_0x31d6('0x29')]);_0x32a3a1['query']=_[_0x31d6('0x2d')](_0x2e03f7['query']);_0x32a3a1[_0x31d6('0x2e')]=_[_0x31d6('0x2f')](_0x32a3a1[_0x31d6('0x30')],_0x32a3a1['query']);_0x2b290d[_0x31d6('0x31')]=_[_0x31d6('0x2f')](_0x32a3a1['model'],qs['fields'](_0x2e03f7[_0x31d6('0x2c')]['fields']));_0x2b290d[_0x31d6('0x31')]=_0x2b290d[_0x31d6('0x31')][_0x31d6('0x40')]?_0x2b290d[_0x31d6('0x31')]:_0x32a3a1[_0x31d6('0x30')];if(_0x2e03f7[_0x31d6('0x2c')][_0x31d6('0x3b')]){_0x2b290d[_0x31d6('0x3c')]=[{'all':!![]}];}_0x2b290d=_[_0x31d6('0x41')]({},_0x2b290d,_0x2e03f7[_0x31d6('0x3a')]);return db[_0x31d6('0x28')][_0x31d6('0x42')](_0x2b290d)[_0x31d6('0x23')](handleEntityNotFound(_0x2ad9a5,null))[_0x31d6('0x23')](respondWithResult(_0x2ad9a5,null))[_0x31d6('0x3e')](handleError(_0x2ad9a5,null));};exports[_0x31d6('0x43')]=function(_0xd93b61,_0x4b7251){return db[_0x31d6('0x28')][_0x31d6('0x43')](_0xd93b61[_0x31d6('0x44')],{})[_0x31d6('0x23')](function(_0x5bb0a9){var _0x3a1014=_0xd93b61[_0x31d6('0x45')][_0x31d6('0x21')]({'plain':!![]});if(!_0x3a1014)throw new Error(_0x31d6('0x46'));if(_0x3a1014[_0x31d6('0x47')]===_0x31d6('0x45')){var _0x3e237f=_0x5bb0a9[_0x31d6('0x21')]({'plain':!![]});var _0x38861e=_0x31d6('0x48');return db['UserProfileSection']['find']({'where':{'name':_0x38861e,'userProfileId':_0x3a1014[_0x31d6('0x49')]},'raw':!![]})[_0x31d6('0x23')](function(_0x51d869){if(_0x51d869&&_0x51d869[_0x31d6('0x4a')]===0x0){return db[_0x31d6('0x22')]['create']({'name':_0x3e237f[_0x31d6('0x25')],'resourceId':_0x3e237f['id'],'type':_0x51d869[_0x31d6('0x25')],'sectionId':_0x51d869['id']},{})[_0x31d6('0x23')](function(){return _0x5bb0a9;});}else{return _0x5bb0a9;}})[_0x31d6('0x3e')](function(_0x30f833){logger['error'](_0x31d6('0x4b'),_0x30f833);throw _0x30f833;});}return _0x5bb0a9;})[_0x31d6('0x23')](respondWithResult(_0x4b7251,0xc9))['catch'](handleError(_0x4b7251,null));};exports[_0x31d6('0x4c')]=function(_0x22c49d,_0x27df26){var _0x5a5363={'where':{'id':_0x22c49d[_0x31d6('0x3f')]['id']}},_0x797a9d={};_0x797a9d[_0x31d6('0x30')]=_['keys'](db[_0x31d6('0x28')][_0x31d6('0x29')]);_0x5a5363[_0x31d6('0x31')]=_['intersection'](_0x797a9d[_0x31d6('0x30')],qs[_0x31d6('0x4d')](_0x22c49d[_0x31d6('0x2c')][_0x31d6('0x4d')]));_0x5a5363[_0x31d6('0x31')]=_0x5a5363['attributes']['length']?_0x5a5363[_0x31d6('0x31')]:_0x797a9d[_0x31d6('0x30')];if(_0x22c49d['query'][_0x31d6('0x3b')]){_0x5a5363['include']=[{'all':!![]}];}_0x5a5363=_[_0x31d6('0x41')]({},_0x5a5363,_0x22c49d[_0x31d6('0x3a')]);return db[_0x31d6('0x28')][_0x31d6('0x42')](_0x5a5363)['then'](handleEntityNotFound(_0x27df26,null))[_0x31d6('0x23')](function(_0x551803){if(_0x551803){var _0x4d198b=_0x551803[_0x31d6('0x21')]({'plain':!![]});_0x4d198b=qs[_0x31d6('0x4e')](_0x4d198b,['id',_0x31d6('0x4f'),_0x31d6('0x50')]);_0x22c49d[_0x31d6('0x44')]=_[_0x31d6('0x4e')](_0x22c49d[_0x31d6('0x44')],['id','createdAt',_0x31d6('0x50')]);return db[_0x31d6('0x28')][_0x31d6('0x43')](_[_0x31d6('0x41')](_0x4d198b,_0x22c49d[_0x31d6('0x44')]),{'include':_0x22c49d[_0x31d6('0x2c')]['includeAll']?[{'all':!![]}]:undefined})[_0x31d6('0x23')](function(_0x356509){var _0x4c1872=_0x22c49d[_0x31d6('0x45')][_0x31d6('0x21')]({'plain':!![]});if(!_0x4c1872)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4c1872[_0x31d6('0x47')]===_0x31d6('0x45')){var _0x346c92=_0x356509[_0x31d6('0x21')]({'plain':!![]});var _0x2bba38=_0x31d6('0x48');return db[_0x31d6('0x51')]['find']({'where':{'name':_0x2bba38,'userProfileId':_0x4c1872[_0x31d6('0x49')]},'raw':!![]})[_0x31d6('0x23')](function(_0x2921c7){if(_0x2921c7&&_0x2921c7['autoAssociation']===0x0){return db[_0x31d6('0x22')][_0x31d6('0x43')]({'name':_0x346c92['name'],'resourceId':_0x346c92['id'],'type':_0x2921c7[_0x31d6('0x25')],'sectionId':_0x2921c7['id']},{})['then'](function(){return _0x356509;});}else{return _0x356509;}})[_0x31d6('0x3e')](function(_0x12c0d0){logger[_0x31d6('0x24')](_0x31d6('0x4b'),_0x12c0d0);throw _0x12c0d0;});}return _0x356509;});}})[_0x31d6('0x23')](respondWithResult(_0x27df26,0xc9))[_0x31d6('0x3e')](handleError(_0x27df26,null));};exports[_0x31d6('0x1f')]=function(_0x21e58e,_0x23d830){if(_0x21e58e[_0x31d6('0x44')]['id']){delete _0x21e58e[_0x31d6('0x44')]['id'];}return db[_0x31d6('0x28')][_0x31d6('0x42')]({'where':{'id':_0x21e58e[_0x31d6('0x3f')]['id']}})[_0x31d6('0x23')](handleEntityNotFound(_0x23d830,null))[_0x31d6('0x23')](saveUpdates(_0x21e58e['body'],null))['then'](respondWithResult(_0x23d830,null))[_0x31d6('0x3e')](handleError(_0x23d830,null));};exports[_0x31d6('0x20')]=function(_0x1d82ca,_0x78eba5){return db[_0x31d6('0x28')][_0x31d6('0x42')]({'where':{'id':_0x1d82ca['params']['id']}})['then'](handleEntityNotFound(_0x78eba5,null))[_0x31d6('0x23')](removeEntity(_0x78eba5,null))[_0x31d6('0x3e')](handleError(_0x78eba5,null));};exports[_0x31d6('0x52')]=function(_0x320219,_0x4f8a59,_0x3f71f9){var _0x403898={'raw':!![],'where':{}};var _0x1d1807={};var _0x1cbb96={'count':0x0,'rows':[]};return db[_0x31d6('0x28')][_0x31d6('0x53')]({'where':{'id':_0x320219[_0x31d6('0x3f')]['id']}})[_0x31d6('0x23')](handleEntityNotFound(_0x4f8a59,null))[_0x31d6('0x23')](function(_0x4fa786){if(_0x4fa786){_0x1d1807[_0x31d6('0x30')]=_[_0x31d6('0x2d')](db[_0x31d6('0x54')][_0x31d6('0x29')]);_0x1d1807['query']=_[_0x31d6('0x2d')](_0x320219['query']);_0x1d1807['filters']=_[_0x31d6('0x2f')](_0x1d1807[_0x31d6('0x30')],_0x1d1807[_0x31d6('0x2c')]);_0x403898[_0x31d6('0x31')]=_[_0x31d6('0x2f')](_0x1d1807[_0x31d6('0x30')],qs['fields'](_0x320219[_0x31d6('0x2c')][_0x31d6('0x4d')]));_0x403898[_0x31d6('0x31')]=_0x403898[_0x31d6('0x31')][_0x31d6('0x40')]?_0x403898[_0x31d6('0x31')]:_0x1d1807[_0x31d6('0x30')];if(!_0x320219[_0x31d6('0x2c')][_0x31d6('0x32')](_0x31d6('0x33'))){_0x403898[_0x31d6('0x18')]=qs[_0x31d6('0x18')](_0x320219[_0x31d6('0x2c')][_0x31d6('0x18')]);_0x403898[_0x31d6('0x16')]=qs[_0x31d6('0x16')](_0x320219[_0x31d6('0x2c')][_0x31d6('0x16')]);}_0x403898[_0x31d6('0x34')]=qs['sort'](_0x320219[_0x31d6('0x2c')][_0x31d6('0x35')]);_0x403898[_0x31d6('0x36')]=qs[_0x31d6('0x2e')](_[_0x31d6('0x37')](_0x320219['query'],_0x1d1807[_0x31d6('0x2e')]));_0x403898[_0x31d6('0x36')][_0x31d6('0x55')]=_0x4fa786['id'];if(_0x320219[_0x31d6('0x2c')][_0x31d6('0x38')]){_0x403898[_0x31d6('0x36')]=_['merge'](_0x403898['where'],{'$or':_[_0x31d6('0x27')](_0x403898[_0x31d6('0x31')],function(_0x4437b1){var _0x5c929a={};_0x5c929a[_0x4437b1]={'$like':'%'+_0x320219['query'][_0x31d6('0x38')]+'%'};return _0x5c929a;})});}_0x403898=_[_0x31d6('0x41')]({},_0x403898,_0x320219['options']);return db[_0x31d6('0x54')][_0x31d6('0x19')]({'where':_0x403898['where']})[_0x31d6('0x23')](function(_0x1b1b30){_0x1cbb96[_0x31d6('0x19')]=_0x1b1b30;if(_0x320219[_0x31d6('0x2c')]['includeAll']){_0x403898[_0x31d6('0x3c')]=[{'all':!![]}];}return db[_0x31d6('0x54')][_0x31d6('0x56')](_0x403898);})[_0x31d6('0x23')](function(_0x48834a){_0x1cbb96['rows']=_0x48834a;return _0x1cbb96;});}})[_0x31d6('0x23')](respondWithFilteredResult(_0x4f8a59,_0x403898))[_0x31d6('0x3e')](handleError(_0x4f8a59,null));};exports['getHopperHistories']=function(_0x5b8631,_0x2842cd,_0x2dea83){var _0x7071a9={'raw':!![],'where':{}};var _0x1f87dd={};var _0x2fd215={'count':0x0,'rows':[]};return db[_0x31d6('0x28')][_0x31d6('0x53')]({'where':{'id':_0x5b8631[_0x31d6('0x3f')]['id']}})[_0x31d6('0x23')](handleEntityNotFound(_0x2842cd,null))['then'](function(_0x167f08){if(_0x167f08){_0x1f87dd[_0x31d6('0x30')]=_[_0x31d6('0x2d')](db[_0x31d6('0x57')][_0x31d6('0x29')]);_0x1f87dd['query']=_[_0x31d6('0x2d')](_0x5b8631[_0x31d6('0x2c')]);_0x1f87dd['filters']=_['intersection'](_0x1f87dd['model'],_0x1f87dd[_0x31d6('0x2c')]);_0x7071a9['attributes']=_[_0x31d6('0x2f')](_0x1f87dd[_0x31d6('0x30')],qs[_0x31d6('0x4d')](_0x5b8631[_0x31d6('0x2c')][_0x31d6('0x4d')]));_0x7071a9[_0x31d6('0x31')]=_0x7071a9[_0x31d6('0x31')][_0x31d6('0x40')]?_0x7071a9[_0x31d6('0x31')]:_0x1f87dd['model'];if(!_0x5b8631['query'][_0x31d6('0x32')]('nolimit')){_0x7071a9[_0x31d6('0x18')]=qs[_0x31d6('0x18')](_0x5b8631['query'][_0x31d6('0x18')]);_0x7071a9['offset']=qs[_0x31d6('0x16')](_0x5b8631['query'][_0x31d6('0x16')]);}_0x7071a9['order']=qs[_0x31d6('0x35')](_0x5b8631[_0x31d6('0x2c')]['sort']);_0x7071a9[_0x31d6('0x36')]=qs['filters'](_[_0x31d6('0x37')](_0x5b8631[_0x31d6('0x2c')],_0x1f87dd[_0x31d6('0x2e')]));_0x7071a9[_0x31d6('0x36')][_0x31d6('0x55')]=_0x167f08['id'];if(_0x5b8631['query'][_0x31d6('0x38')]){_0x7071a9['where']=_[_0x31d6('0x41')](_0x7071a9['where'],{'$or':_['map'](_0x7071a9['attributes'],function(_0x3456d4){var _0x59db63={};_0x59db63[_0x3456d4]={'$like':'%'+_0x5b8631['query'][_0x31d6('0x38')]+'%'};return _0x59db63;})});}_0x7071a9=_['merge']({},_0x7071a9,_0x5b8631[_0x31d6('0x3a')]);return db[_0x31d6('0x57')]['count']({'where':_0x7071a9[_0x31d6('0x36')]})[_0x31d6('0x23')](function(_0x5aba69){_0x2fd215[_0x31d6('0x19')]=_0x5aba69;if(_0x5b8631[_0x31d6('0x2c')]['includeAll']){_0x7071a9[_0x31d6('0x3c')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x31d6('0x56')](_0x7071a9);})[_0x31d6('0x23')](function(_0x72dd06){_0x2fd215[_0x31d6('0x3d')]=_0x72dd06;return _0x2fd215;});}})[_0x31d6('0x23')](respondWithFilteredResult(_0x2842cd,_0x7071a9))['catch'](handleError(_0x2842cd,null));};exports['getHopperFinals']=function(_0xbcce78,_0x1fa85b,_0x1768c1){var _0x453a8e={'raw':!![],'where':{}};var _0x248de6={};var _0x2e9302={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0xbcce78[_0x31d6('0x3f')]['id']}})[_0x31d6('0x23')](handleEntityNotFound(_0x1fa85b,null))[_0x31d6('0x23')](function(_0x35c501){if(_0x35c501){_0x248de6['model']=_[_0x31d6('0x2d')](db[_0x31d6('0x58')][_0x31d6('0x29')]);_0x248de6[_0x31d6('0x2c')]=_['keys'](_0xbcce78['query']);_0x248de6[_0x31d6('0x2e')]=_['intersection'](_0x248de6[_0x31d6('0x30')],_0x248de6[_0x31d6('0x2c')]);_0x453a8e[_0x31d6('0x31')]=_[_0x31d6('0x2f')](_0x248de6[_0x31d6('0x30')],qs['fields'](_0xbcce78[_0x31d6('0x2c')]['fields']));_0x453a8e[_0x31d6('0x31')]=_0x453a8e[_0x31d6('0x31')][_0x31d6('0x40')]?_0x453a8e[_0x31d6('0x31')]:_0x248de6[_0x31d6('0x30')];if(!_0xbcce78[_0x31d6('0x2c')]['hasOwnProperty'](_0x31d6('0x33'))){_0x453a8e[_0x31d6('0x18')]=qs[_0x31d6('0x18')](_0xbcce78[_0x31d6('0x2c')][_0x31d6('0x18')]);_0x453a8e[_0x31d6('0x16')]=qs[_0x31d6('0x16')](_0xbcce78['query']['offset']);}_0x453a8e[_0x31d6('0x34')]=qs[_0x31d6('0x35')](_0xbcce78[_0x31d6('0x2c')]['sort']);_0x453a8e[_0x31d6('0x36')]=qs['filters'](_[_0x31d6('0x37')](_0xbcce78[_0x31d6('0x2c')],_0x248de6['filters']));_0x453a8e[_0x31d6('0x36')][_0x31d6('0x55')]=_0x35c501['id'];if(_0xbcce78[_0x31d6('0x2c')][_0x31d6('0x38')]){_0x453a8e[_0x31d6('0x36')]=_['merge'](_0x453a8e[_0x31d6('0x36')],{'$or':_[_0x31d6('0x27')](_0x453a8e['attributes'],function(_0x52fb8b){var _0x1d7696={};_0x1d7696[_0x52fb8b]={'$like':'%'+_0xbcce78[_0x31d6('0x2c')][_0x31d6('0x38')]+'%'};return _0x1d7696;})});}_0x453a8e=_[_0x31d6('0x41')]({},_0x453a8e,_0xbcce78['options']);return db['CmHopperFinal'][_0x31d6('0x19')]({'where':_0x453a8e[_0x31d6('0x36')]})[_0x31d6('0x23')](function(_0x2e8591){_0x2e9302['count']=_0x2e8591;if(_0xbcce78[_0x31d6('0x2c')][_0x31d6('0x3b')]){_0x453a8e[_0x31d6('0x3c')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x31d6('0x56')](_0x453a8e);})['then'](function(_0x2450b2){_0x2e9302[_0x31d6('0x3d')]=_0x2450b2;return _0x2e9302;});}})[_0x31d6('0x23')](respondWithFilteredResult(_0x1fa85b,_0x453a8e))[_0x31d6('0x3e')](handleError(_0x1fa85b,null));};exports[_0x31d6('0x59')]=function(_0x160156,_0x44f4ef,_0x1f799b){var _0x2f0035={'raw':!![],'where':{}};var _0x586399={};var _0xda715b={'count':0x0,'rows':[]};return db[_0x31d6('0x28')][_0x31d6('0x53')]({'where':{'id':_0x160156['params']['id']}})[_0x31d6('0x23')](handleEntityNotFound(_0x44f4ef,null))[_0x31d6('0x23')](function(_0x1e667b){if(_0x1e667b){_0x586399[_0x31d6('0x30')]=_[_0x31d6('0x2d')](db[_0x31d6('0x5a')][_0x31d6('0x29')]);_0x586399['query']=_[_0x31d6('0x2d')](_0x160156[_0x31d6('0x2c')]);_0x586399[_0x31d6('0x2e')]=_[_0x31d6('0x2f')](_0x586399[_0x31d6('0x30')],_0x586399[_0x31d6('0x2c')]);_0x2f0035[_0x31d6('0x31')]=_[_0x31d6('0x2f')](_0x586399[_0x31d6('0x30')],qs['fields'](_0x160156[_0x31d6('0x2c')][_0x31d6('0x4d')]));_0x2f0035[_0x31d6('0x31')]=_0x2f0035[_0x31d6('0x31')][_0x31d6('0x40')]?_0x2f0035['attributes']:_0x586399[_0x31d6('0x30')];if(!_0x160156[_0x31d6('0x2c')][_0x31d6('0x32')](_0x31d6('0x33'))){_0x2f0035['limit']=qs[_0x31d6('0x18')](_0x160156['query']['limit']);_0x2f0035['offset']=qs['offset'](_0x160156[_0x31d6('0x2c')][_0x31d6('0x16')]);}_0x2f0035[_0x31d6('0x34')]=qs[_0x31d6('0x35')](_0x160156['query'][_0x31d6('0x35')]);_0x2f0035[_0x31d6('0x36')]=qs[_0x31d6('0x2e')](_['pick'](_0x160156['query'],_0x586399[_0x31d6('0x2e')]));_0x2f0035[_0x31d6('0x36')][_0x31d6('0x55')]=_0x1e667b['id'];if(_0x160156['query'][_0x31d6('0x38')]){_0x2f0035[_0x31d6('0x36')]=_[_0x31d6('0x41')](_0x2f0035[_0x31d6('0x36')],{'$or':_[_0x31d6('0x27')](_0x2f0035[_0x31d6('0x31')],function(_0x182413){var _0x1149bd={};_0x1149bd[_0x182413]={'$like':'%'+_0x160156[_0x31d6('0x2c')][_0x31d6('0x38')]+'%'};return _0x1149bd;})});}_0x2f0035=_['merge']({},_0x2f0035,_0x160156[_0x31d6('0x3a')]);return db[_0x31d6('0x5a')][_0x31d6('0x19')]({'where':_0x2f0035[_0x31d6('0x36')]})['then'](function(_0x1cdae0){_0xda715b['count']=_0x1cdae0;if(_0x160156['query'][_0x31d6('0x3b')]){_0x2f0035[_0x31d6('0x3c')]=[{'all':!![]}];}return db[_0x31d6('0x5a')][_0x31d6('0x56')](_0x2f0035);})[_0x31d6('0x23')](function(_0x48715){_0xda715b[_0x31d6('0x3d')]=_0x48715;return _0xda715b;});}})[_0x31d6('0x23')](respondWithFilteredResult(_0x44f4ef,_0x2f0035))[_0x31d6('0x3e')](handleError(_0x44f4ef,null));};exports['getLists']=function(_0x156438,_0x34ab84,_0x46b42e){var _0x5221f4={};var _0xb8481c={};var _0xfef001;var _0x3e7c3a;return db[_0x31d6('0x28')][_0x31d6('0x53')]({'where':{'id':_0x156438['params']['id']}})[_0x31d6('0x23')](handleEntityNotFound(_0x34ab84,null))[_0x31d6('0x23')](function(_0x33138e){if(_0x33138e){_0xfef001=_0x33138e;_0xb8481c[_0x31d6('0x30')]=_[_0x31d6('0x2d')](db['CmList'][_0x31d6('0x29')]);_0xb8481c[_0x31d6('0x2c')]=_['keys'](_0x156438[_0x31d6('0x2c')]);_0xb8481c[_0x31d6('0x2e')]=_[_0x31d6('0x2f')](_0xb8481c[_0x31d6('0x30')],_0xb8481c[_0x31d6('0x2c')]);_0x5221f4['attributes']=_['intersection'](_0xb8481c[_0x31d6('0x30')],qs['fields'](_0x156438[_0x31d6('0x2c')][_0x31d6('0x4d')]));_0x5221f4[_0x31d6('0x31')]=_0x5221f4[_0x31d6('0x31')][_0x31d6('0x40')]?_0x5221f4['attributes']:_0xb8481c['model'];_0x5221f4[_0x31d6('0x34')]=qs[_0x31d6('0x35')](_0x156438['query']['sort']);_0x5221f4[_0x31d6('0x36')]=qs['filters'](_[_0x31d6('0x37')](_0x156438['query'],_0xb8481c[_0x31d6('0x2e')]));if(_0x156438[_0x31d6('0x2c')][_0x31d6('0x38')]){_0x5221f4[_0x31d6('0x36')]=_[_0x31d6('0x41')](_0x5221f4[_0x31d6('0x36')],{'$or':_[_0x31d6('0x27')](_0x5221f4[_0x31d6('0x31')],function(_0xf61b07){var _0x7cef0f={};_0x7cef0f[_0xf61b07]={'$like':'%'+_0x156438[_0x31d6('0x2c')]['filter']+'%'};return _0x7cef0f;})});}_0x5221f4=_['merge']({},_0x5221f4,_0x156438['options']);return _0xfef001[_0x31d6('0x5b')](_0x5221f4);}})['then'](function(_0x3839ba){if(_0x3839ba){_0x3e7c3a=_0x3839ba[_0x31d6('0x40')];if(!_0x156438[_0x31d6('0x2c')][_0x31d6('0x32')](_0x31d6('0x33'))){_0x5221f4[_0x31d6('0x18')]=qs[_0x31d6('0x18')](_0x156438['query'][_0x31d6('0x18')]);_0x5221f4[_0x31d6('0x16')]=qs[_0x31d6('0x16')](_0x156438[_0x31d6('0x2c')][_0x31d6('0x16')]);}return _0xfef001['getLists'](_0x5221f4);}})[_0x31d6('0x23')](function(_0x5bc7a1){if(_0x5bc7a1){return _0x5bc7a1?{'count':_0x3e7c3a,'rows':_0x5bc7a1}:null;}})[_0x31d6('0x23')](respondWithResult(_0x34ab84,null))[_0x31d6('0x3e')](handleError(_0x34ab84,null));};exports[_0x31d6('0x5c')]=function(_0x5af015,_0x11f8af,_0x5d5e50){var _0x29ab01,_0x188836;return db['Campaign']['find']({'where':{'id':_0x5af015[_0x31d6('0x3f')]['id']}})[_0x31d6('0x23')](handleEntityNotFound(_0x11f8af,null))[_0x31d6('0x23')](function(_0x226381){if(_0x226381){_0x188836=_0x226381;return _0x226381['addLists'](_0x5af015['body']['ids'],_[_0x31d6('0x4e')](_0x5af015[_0x31d6('0x44')],[_0x31d6('0x5d'),'id'])||{});}return null;})['spread'](function(_0x4c2a69){var _0x89b101;_0x29ab01=_0x4c2a69||[];var _0x46ac63=[];if(_0x4c2a69){for(var _0x2503ae=0x0;_0x2503ae<_0x4c2a69[_0x31d6('0x40')];_0x2503ae+=0x1){var _0x322f04=_0x4c2a69[_0x2503ae][_0x31d6('0x21')]({'plain':!![]});_0x188836['dialCheckDuplicateType']=_0x5af015[_0x31d6('0x44')][_0x31d6('0x5e')]?_0x5af015['body'][_0x31d6('0x5e')]:_0x188836[_0x31d6('0x5e')];switch(_0x188836[_0x31d6('0x5e')]){case _0x31d6('0x5f'):_0x89b101=squel[_0x31d6('0x60')]()[_0x31d6('0x61')](_0x31d6('0x62'))[_0x31d6('0x63')](['phone',_0x31d6('0x64'),_0x31d6('0x65'),'ListId',_0x31d6('0x55'),_0x31d6('0x4f'),_0x31d6('0x50')],squel[_0x31d6('0x66')]()[_0x31d6('0x67')](_0x31d6('0x68'),_0x31d6('0x68'))['field'](_0x31d6('0x69'),_0x31d6('0x64'))[_0x31d6('0x67')]('id',_0x31d6('0x65'))['field'](_0x322f04[_0x31d6('0x6a')][_0x31d6('0x6b')](),_0x31d6('0x6c'))['field'](_0x5af015[_0x31d6('0x3f')]['id'][_0x31d6('0x6b')](),'CampaignId')[_0x31d6('0x67')]('NOW()',_0x31d6('0x4f'))['field'](_0x31d6('0x69'),_0x31d6('0x50'))[_0x31d6('0x6d')]('cm_contacts')[_0x31d6('0x36')]('deletedAt\x20IS\x20NULL')[_0x31d6('0x36')](_0x31d6('0x6e'),_0x322f04[_0x31d6('0x6a')][_0x31d6('0x6b')]())['where'](_0x31d6('0x6f'))[_0x31d6('0x36')]('phone\x20NOT\x20IN\x20(?)',squel[_0x31d6('0x66')]()['field'](_0x31d6('0x70'))['from'](_0x31d6('0x71'))['where']('CampaignId\x20=\x20?',_0x5af015[_0x31d6('0x3f')]['id'][_0x31d6('0x6b')]()))[_0x31d6('0x36')](_0x31d6('0x72'),squel[_0x31d6('0x66')]()[_0x31d6('0x67')](_0x31d6('0x73'))[_0x31d6('0x6d')]('cm_hopper')['where']('CampaignId\x20=\x20?',_0x5af015['params']['id'][_0x31d6('0x6b')]())))[_0x31d6('0x6b')]();break;case _0x31d6('0x74'):_0x89b101=squel['insert']()[_0x31d6('0x61')](_0x31d6('0x62'))['fromQuery']([_0x31d6('0x68'),'scheduledAt',_0x31d6('0x65'),_0x31d6('0x6c'),_0x31d6('0x55'),_0x31d6('0x4f'),_0x31d6('0x50')],squel[_0x31d6('0x66')]()[_0x31d6('0x67')](_0x31d6('0x68'),_0x31d6('0x68'))[_0x31d6('0x67')](_0x31d6('0x69'),_0x31d6('0x64'))['field']('id',_0x31d6('0x65'))['field'](_0x322f04[_0x31d6('0x6a')][_0x31d6('0x6b')](),_0x31d6('0x6c'))[_0x31d6('0x67')](_0x5af015[_0x31d6('0x3f')]['id']['toString'](),_0x31d6('0x55'))['field']('NOW()',_0x31d6('0x4f'))[_0x31d6('0x67')](_0x31d6('0x69'),'updatedAt')[_0x31d6('0x6d')](_0x31d6('0x75'))[_0x31d6('0x36')](_0x31d6('0x76'))[_0x31d6('0x36')](_0x31d6('0x6e'),_0x322f04[_0x31d6('0x6a')][_0x31d6('0x6b')]())['where'](_0x31d6('0x6f'))[_0x31d6('0x36')]('phone\x20NOT\x20IN\x20(?)',squel[_0x31d6('0x66')]()[_0x31d6('0x67')](_0x31d6('0x73'))[_0x31d6('0x6d')](_0x31d6('0x62'))[_0x31d6('0x36')](_0x31d6('0x77'),_0x5af015['params']['id'][_0x31d6('0x6b')]())))[_0x31d6('0x6b')]();break;default:_0x89b101=squel[_0x31d6('0x60')]()[_0x31d6('0x61')](_0x31d6('0x62'))[_0x31d6('0x63')]([_0x31d6('0x68'),'scheduledAt','ContactId',_0x31d6('0x6c'),_0x31d6('0x55'),_0x31d6('0x4f'),_0x31d6('0x50')],squel[_0x31d6('0x66')]()['field'](_0x31d6('0x68'),_0x31d6('0x68'))[_0x31d6('0x67')](_0x31d6('0x69'),_0x31d6('0x64'))[_0x31d6('0x67')]('id',_0x31d6('0x65'))[_0x31d6('0x67')](_0x322f04[_0x31d6('0x6a')][_0x31d6('0x6b')](),_0x31d6('0x6c'))[_0x31d6('0x67')](_0x5af015[_0x31d6('0x3f')]['id'][_0x31d6('0x6b')](),_0x31d6('0x55'))[_0x31d6('0x67')]('NOW()','createdAt')[_0x31d6('0x67')]('NOW()',_0x31d6('0x50'))['from'](_0x31d6('0x75'))[_0x31d6('0x36')](_0x31d6('0x76'))['where']('ListId\x20=\x20?',_0x322f04[_0x31d6('0x6a')][_0x31d6('0x6b')]())[_0x31d6('0x36')]('phone\x20IS\x20NOT\x20NULL'))[_0x31d6('0x6b')]();}_0x46ac63[_0x31d6('0x78')](db['sequelize'][_0x31d6('0x2c')](_0x89b101));}return BPromise[_0x31d6('0x79')](_0x46ac63);}})['then'](function(){return _0x29ab01;})['then'](respondWithResult(_0x11f8af,null))['catch'](handleError(_0x11f8af,null));};exports[_0x31d6('0x7a')]=function(_0x2cdfcd,_0x10e2c0,_0x5b49e6){return db[_0x31d6('0x28')][_0x31d6('0x42')]({'where':{'id':_0x2cdfcd[_0x31d6('0x3f')]['id']}})[_0x31d6('0x23')](handleEntityNotFound(_0x10e2c0,null))[_0x31d6('0x23')](function(_0x2024b3){if(_0x2024b3){return _0x2024b3[_0x31d6('0x7a')](_0x2cdfcd['query'][_0x31d6('0x5d')]);}})[_0x31d6('0x23')](function(_0x4efb55){if(_0x4efb55){return db[_0x31d6('0x54')][_0x31d6('0x20')]({'where':{'ListId':_0x2cdfcd[_0x31d6('0x2c')]['ids'],'CampaignId':_0x2cdfcd[_0x31d6('0x3f')]['id']}})[_0x31d6('0x23')](function(){return _0x4efb55;});}})[_0x31d6('0x23')](respondWithStatusCode(_0x10e2c0,null))[_0x31d6('0x3e')](handleError(_0x10e2c0,null));};exports[_0x31d6('0x7b')]=function(_0x50fc83,_0xc526b4,_0x3cdc53){var _0x432fca={};var _0x149f10={};var _0x1bdb0e;var _0xf65e76;return db[_0x31d6('0x28')]['findOne']({'where':{'id':_0x50fc83[_0x31d6('0x3f')]['id']}})['then'](handleEntityNotFound(_0xc526b4,null))[_0x31d6('0x23')](function(_0xda0a03){if(_0xda0a03){_0x1bdb0e=_0xda0a03;_0x149f10['model']=_[_0x31d6('0x2d')](db['CmList'][_0x31d6('0x29')]);_0x149f10[_0x31d6('0x2c')]=_[_0x31d6('0x2d')](_0x50fc83[_0x31d6('0x2c')]);_0x149f10['filters']=_['intersection'](_0x149f10[_0x31d6('0x30')],_0x149f10[_0x31d6('0x2c')]);_0x432fca[_0x31d6('0x31')]=_[_0x31d6('0x2f')](_0x149f10['model'],qs['fields'](_0x50fc83[_0x31d6('0x2c')][_0x31d6('0x4d')]));_0x432fca[_0x31d6('0x31')]=_0x432fca[_0x31d6('0x31')][_0x31d6('0x40')]?_0x432fca[_0x31d6('0x31')]:_0x149f10[_0x31d6('0x30')];_0x432fca[_0x31d6('0x34')]=qs['sort'](_0x50fc83[_0x31d6('0x2c')][_0x31d6('0x35')]);_0x432fca['where']=qs[_0x31d6('0x2e')](_[_0x31d6('0x37')](_0x50fc83['query'],_0x149f10[_0x31d6('0x2e')]));if(_0x50fc83['query'][_0x31d6('0x38')]){_0x432fca['where']=_['merge'](_0x432fca['where'],{'$or':_['map'](_0x432fca['attributes'],function(_0x490d93){var _0x50f2b2={};_0x50f2b2[_0x490d93]={'$like':'%'+_0x50fc83[_0x31d6('0x2c')]['filter']+'%'};return _0x50f2b2;})});}_0x432fca=_[_0x31d6('0x41')]({},_0x432fca,_0x50fc83[_0x31d6('0x3a')]);return _0x1bdb0e[_0x31d6('0x7b')](_0x432fca);}})[_0x31d6('0x23')](function(_0x2efcda){if(_0x2efcda){_0xf65e76=_0x2efcda[_0x31d6('0x40')];if(!_0x50fc83[_0x31d6('0x2c')]['hasOwnProperty'](_0x31d6('0x33'))){_0x432fca[_0x31d6('0x18')]=qs['limit'](_0x50fc83[_0x31d6('0x2c')][_0x31d6('0x18')]);_0x432fca[_0x31d6('0x16')]=qs['offset'](_0x50fc83[_0x31d6('0x2c')][_0x31d6('0x16')]);}return _0x1bdb0e[_0x31d6('0x7b')](_0x432fca);}})[_0x31d6('0x23')](function(_0x390fd7){if(_0x390fd7){return _0x390fd7?{'count':_0xf65e76,'rows':_0x390fd7}:null;}})[_0x31d6('0x23')](respondWithResult(_0xc526b4,null))[_0x31d6('0x3e')](handleError(_0xc526b4,null));};exports[_0x31d6('0x7c')]=function(_0x4b7afe,_0x1da08c,_0x1b5515){var _0x5cd950,_0x3f7bfe;return db[_0x31d6('0x28')][_0x31d6('0x42')]({'where':{'id':_0x4b7afe[_0x31d6('0x3f')]['id']}})['then'](handleEntityNotFound(_0x1da08c,null))['then'](function(_0x4eb783){if(_0x4eb783){_0x3f7bfe=_0x4eb783;return _0x4eb783[_0x31d6('0x7c')](_0x4b7afe['body'][_0x31d6('0x5d')],_['omit'](_0x4b7afe['body'],['ids','id'])||{});}return null;})['spread'](function(_0x5e7d62){var _0x4ecbb3;_0x5cd950=_0x5e7d62||[];var _0x1950f2=[];if(_0x5e7d62){for(var _0x3ffb84=0x0;_0x3ffb84<_0x5e7d62[_0x31d6('0x40')];_0x3ffb84+=0x1){var _0x542b62=_0x5e7d62[_0x3ffb84]['get']({'plain':!![]});_0x4ecbb3=squel[_0x31d6('0x60')]()[_0x31d6('0x61')](_0x31d6('0x7d'))[_0x31d6('0x63')]([_0x31d6('0x68'),_0x31d6('0x65'),'ListId',_0x31d6('0x55'),_0x31d6('0x4f'),_0x31d6('0x50')],squel['select']()['field']('phone',_0x31d6('0x68'))[_0x31d6('0x67')]('id',_0x31d6('0x65'))[_0x31d6('0x67')](_0x542b62[_0x31d6('0x6a')][_0x31d6('0x6b')](),'ListId')[_0x31d6('0x67')](_0x4b7afe['params']['id'][_0x31d6('0x6b')](),_0x31d6('0x55'))[_0x31d6('0x67')](_0x31d6('0x69'),_0x31d6('0x4f'))[_0x31d6('0x67')](_0x31d6('0x69'),'updatedAt')['from'](_0x31d6('0x75'))[_0x31d6('0x36')]('deletedAt\x20IS\x20NULL')[_0x31d6('0x36')](_0x31d6('0x6e'),_0x542b62[_0x31d6('0x6a')][_0x31d6('0x6b')]())[_0x31d6('0x36')]('phone\x20IS\x20NOT\x20NULL'))[_0x31d6('0x6b')]();_0x1950f2['push'](db[_0x31d6('0x7e')]['query'](_0x4ecbb3));}return BPromise['all'](_0x1950f2);}})[_0x31d6('0x23')](function(){return _0x5cd950;})[_0x31d6('0x23')](respondWithResult(_0x1da08c,null))[_0x31d6('0x3e')](handleError(_0x1da08c,null));};exports[_0x31d6('0x7f')]=function(_0x1e2b51,_0xc3419b,_0x274d60){return db['Campaign'][_0x31d6('0x42')]({'where':{'id':_0x1e2b51[_0x31d6('0x3f')]['id']}})[_0x31d6('0x23')](handleEntityNotFound(_0xc3419b,null))[_0x31d6('0x23')](function(_0x156dd4){if(_0x156dd4){return _0x156dd4['removeBlackLists'](_0x1e2b51[_0x31d6('0x2c')][_0x31d6('0x5d')]);}})[_0x31d6('0x23')](function(_0x3d0218){if(_0x3d0218){return db[_0x31d6('0x5a')][_0x31d6('0x20')]({'where':{'ListId':_0x1e2b51[_0x31d6('0x2c')][_0x31d6('0x5d')],'CampaignId':_0x1e2b51[_0x31d6('0x3f')]['id']}})['then'](function(){return _0x3d0218;});}})[_0x31d6('0x23')](respondWithStatusCode(_0xc3419b,null))[_0x31d6('0x3e')](handleError(_0xc3419b,null));}; \ No newline at end of file +var _0xd48a=['count','limit','set','Content-Range','reject','save','update','then','destroy','get','IvrCampaigns','error','name','send','index','map','Campaign','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','findAll','catch','show','params','rawAttributes','include','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','body','updatedAt','user','role','findOne','CmHopper','hasOwnProperty','CampaignId','rows','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','ids','spread','dialCheckDuplicateType','always','insert','cm_hopper','fromQuery','phone','scheduledAt','ListId','select','field','toString','NOW()','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','CmListId','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','onlyIfOpen','into','ContactId','phone\x20IS\x20NOT\x20NULL','push','sequelize','all','removeLists','getBlackLists','addBlackLists','removeBlackLists','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','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','end','status','json','offset','undefined'];(function(_0x484060,_0xce9823){var _0x295784=function(_0x312b8a){while(--_0x312b8a){_0x484060['push'](_0x484060['shift']());}};_0x295784(++_0xce9823);}(_0xd48a,0x6b));var _0xad48=function(_0x5617f4,_0x2ef726){_0x5617f4=_0x5617f4-0x0;var _0x1fd7ab=_0xd48a[_0x5617f4];return _0x1fd7ab;};'use strict';var emlformat=require(_0xad48('0x0'));var rimraf=require(_0xad48('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xad48('0x2'));var rp=require(_0xad48('0x3'));var moment=require(_0xad48('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xad48('0x5'));var util=require(_0xad48('0x6'));var path=require(_0xad48('0x7'));var sox=require(_0xad48('0x8'));var csv=require(_0xad48('0x9'));var ejs=require(_0xad48('0xa'));var fs=require('fs');var fs_extra=require(_0xad48('0xb'));var _=require(_0xad48('0xc'));var squel=require('squel');var crypto=require(_0xad48('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xad48('0xe'));var toCsv=require('to-csv');var querystring=require(_0xad48('0xf'));var Papa=require(_0xad48('0x10'));var Redis=require(_0xad48('0x11'));var authService=require(_0xad48('0x12'));var qs=require(_0xad48('0x13'));var as=require(_0xad48('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xad48('0x15'))('api');var utils=require(_0xad48('0x16'));var config=require(_0xad48('0x17'));var licenseUtil=require(_0xad48('0x18'));var db=require(_0xad48('0x19'))['db'];function respondWithStatusCode(_0x1675b2,_0x6aae75){_0x6aae75=_0x6aae75||0xcc;return function(_0x2f26c0){if(_0x2f26c0){return _0x1675b2[_0xad48('0x1a')](_0x6aae75);}return _0x1675b2['status'](_0x6aae75)[_0xad48('0x1b')]();};}function respondWithResult(_0x4f0f8f,_0x6636db){_0x6636db=_0x6636db||0xc8;return function(_0x513c5e){if(_0x513c5e){return _0x4f0f8f[_0xad48('0x1c')](_0x6636db)[_0xad48('0x1d')](_0x513c5e);}};}function respondWithFilteredResult(_0x5da27d,_0x37e221){return function(_0x1474bb){if(_0x1474bb){var _0x45087d=typeof _0x37e221[_0xad48('0x1e')]===_0xad48('0x1f')&&typeof _0x37e221['limit']===_0xad48('0x1f');var _0x545eaa=_0x1474bb[_0xad48('0x20')];var _0x4fa318=_0x45087d?0x0:_0x37e221[_0xad48('0x1e')];var _0x22eb94=_0x45087d?_0x1474bb[_0xad48('0x20')]:_0x37e221[_0xad48('0x1e')]+_0x37e221[_0xad48('0x21')];var _0x3109fc;if(_0x22eb94>=_0x545eaa){_0x22eb94=_0x545eaa;_0x3109fc=0xc8;}else{_0x3109fc=0xce;}_0x5da27d['status'](_0x3109fc);return _0x5da27d[_0xad48('0x22')](_0xad48('0x23'),_0x4fa318+'-'+_0x22eb94+'/'+_0x545eaa)[_0xad48('0x1d')](_0x1474bb);}return null;};}function patchUpdates(_0x55e627){return function(_0x3cf2d9){try{jsonpatch['apply'](_0x3cf2d9,_0x55e627,!![]);}catch(_0x5e0e88){return BPromise[_0xad48('0x24')](_0x5e0e88);}return _0x3cf2d9[_0xad48('0x25')]();};}function saveUpdates(_0x4c122b,_0x364a23){return function(_0x18750e){if(_0x18750e){return _0x18750e[_0xad48('0x26')](_0x4c122b)[_0xad48('0x27')](function(_0x25b44c){return _0x25b44c;});}return null;};}function removeEntity(_0x3c800d,_0x5cefa3){return function(_0x573ede){if(_0x573ede){return _0x573ede[_0xad48('0x28')]()['then'](function(){var _0x4bfa73=_0x573ede[_0xad48('0x29')]({'plain':!![]});var _0x1fb0be=_0xad48('0x2a');return db['UserProfileResource'][_0xad48('0x28')]({'where':{'type':_0x1fb0be,'resourceId':_0x4bfa73['id']}})['then'](function(){return _0x573ede;});})[_0xad48('0x27')](function(){_0x3c800d[_0xad48('0x1c')](0xcc)[_0xad48('0x1b')]();});}};}function handleEntityNotFound(_0x19d45c,_0xe83e14){return function(_0x64577d){if(!_0x64577d){_0x19d45c[_0xad48('0x1a')](0x194);}return _0x64577d;};}function handleError(_0x29ef74,_0x56c654){_0x56c654=_0x56c654||0x1f4;return function(_0x36cb14){logger[_0xad48('0x2b')](_0x36cb14['stack']);if(_0x36cb14['name']){delete _0x36cb14[_0xad48('0x2c')];}_0x29ef74[_0xad48('0x1c')](_0x56c654)[_0xad48('0x2d')](_0x36cb14);};}exports[_0xad48('0x2e')]=function(_0x216d8e,_0x209bcc){var _0x434d9d={},_0x36b646={},_0x822b0a={'count':0x0,'rows':[]};var _0x3be64f=_[_0xad48('0x2f')](db[_0xad48('0x30')]['rawAttributes'],function(_0x189d39){return{'name':_0x189d39[_0xad48('0x31')],'type':_0x189d39[_0xad48('0x32')]['key']};});_0x36b646[_0xad48('0x33')]=_[_0xad48('0x2f')](_0x3be64f,_0xad48('0x2c'));_0x36b646[_0xad48('0x34')]=_[_0xad48('0x35')](_0x216d8e['query']);_0x36b646[_0xad48('0x36')]=_['intersection'](_0x36b646['model'],_0x36b646[_0xad48('0x34')]);_0x434d9d[_0xad48('0x37')]=_[_0xad48('0x38')](_0x36b646[_0xad48('0x33')],qs[_0xad48('0x39')](_0x216d8e[_0xad48('0x34')][_0xad48('0x39')]));_0x434d9d[_0xad48('0x37')]=_0x434d9d['attributes'][_0xad48('0x3a')]?_0x434d9d['attributes']:_0x36b646[_0xad48('0x33')];if(!_0x216d8e[_0xad48('0x34')]['hasOwnProperty'](_0xad48('0x3b'))){_0x434d9d[_0xad48('0x21')]=qs[_0xad48('0x21')](_0x216d8e[_0xad48('0x34')][_0xad48('0x21')]);_0x434d9d[_0xad48('0x1e')]=qs['offset'](_0x216d8e[_0xad48('0x34')][_0xad48('0x1e')]);}_0x434d9d[_0xad48('0x3c')]=qs[_0xad48('0x3d')](_0x216d8e[_0xad48('0x34')][_0xad48('0x3d')]);_0x434d9d[_0xad48('0x3e')]=qs[_0xad48('0x36')](_[_0xad48('0x3f')](_0x216d8e[_0xad48('0x34')],_0x36b646[_0xad48('0x36')]),_0x3be64f);if(_0x216d8e[_0xad48('0x34')]['filter']){_0x434d9d[_0xad48('0x3e')]=_['merge'](_0x434d9d[_0xad48('0x3e')],{'$or':_[_0xad48('0x2f')](_0x3be64f,function(_0x39e6c8){if(_0x39e6c8[_0xad48('0x32')]!==_0xad48('0x40')){var _0x37303a={};_0x37303a[_0x39e6c8['name']]={'$like':'%'+_0x216d8e[_0xad48('0x34')][_0xad48('0x41')]+'%'};return _0x37303a;}})});}_0x434d9d=_[_0xad48('0x42')]({},_0x434d9d,_0x216d8e[_0xad48('0x43')]);var _0x281cf1={'where':_0x434d9d[_0xad48('0x3e')]};return db[_0xad48('0x30')][_0xad48('0x20')](_0x281cf1)[_0xad48('0x27')](function(_0x235bba){_0x822b0a['count']=_0x235bba;if(_0x216d8e['query'][_0xad48('0x44')]){_0x434d9d['include']=[{'all':!![]}];}return db['Campaign'][_0xad48('0x45')](_0x434d9d);})[_0xad48('0x27')](function(_0x3926ec){_0x822b0a['rows']=_0x3926ec;return _0x822b0a;})[_0xad48('0x27')](respondWithFilteredResult(_0x209bcc,_0x434d9d))[_0xad48('0x46')](handleError(_0x209bcc,null));};exports[_0xad48('0x47')]=function(_0x517c82,_0xff0554){var _0x19d352={'raw':![],'where':{'id':_0x517c82[_0xad48('0x48')]['id']}},_0x51523e={};_0x51523e[_0xad48('0x33')]=_['keys'](db[_0xad48('0x30')][_0xad48('0x49')]);_0x51523e[_0xad48('0x34')]=_[_0xad48('0x35')](_0x517c82[_0xad48('0x34')]);_0x51523e['filters']=_[_0xad48('0x38')](_0x51523e[_0xad48('0x33')],_0x51523e[_0xad48('0x34')]);_0x19d352[_0xad48('0x37')]=_[_0xad48('0x38')](_0x51523e[_0xad48('0x33')],qs['fields'](_0x517c82['query']['fields']));_0x19d352['attributes']=_0x19d352['attributes'][_0xad48('0x3a')]?_0x19d352[_0xad48('0x37')]:_0x51523e[_0xad48('0x33')];if(_0x517c82['query']['includeAll']){_0x19d352[_0xad48('0x4a')]=[{'all':!![]}];}_0x19d352=_['merge']({},_0x19d352,_0x517c82[_0xad48('0x43')]);return db['Campaign']['find'](_0x19d352)[_0xad48('0x27')](handleEntityNotFound(_0xff0554,null))['then'](respondWithResult(_0xff0554,null))['catch'](handleError(_0xff0554,null));};exports['create']=function(_0x30aab3,_0x43a804){return db[_0xad48('0x30')]['create'](_0x30aab3['body'],{})[_0xad48('0x27')](function(_0x32ab78){var _0x54403f=_0x30aab3['user']['get']({'plain':!![]});if(!_0x54403f)throw new Error(_0xad48('0x4b'));if(_0x54403f['role']==='user'){var _0x4061f8=_0x32ab78[_0xad48('0x29')]({'plain':!![]});var _0xb39084=_0xad48('0x2a');return db[_0xad48('0x4c')][_0xad48('0x4d')]({'where':{'name':_0xb39084,'userProfileId':_0x54403f[_0xad48('0x4e')]},'raw':!![]})['then'](function(_0x2ff50c){if(_0x2ff50c&&_0x2ff50c[_0xad48('0x4f')]===0x0){return db[_0xad48('0x50')][_0xad48('0x51')]({'name':_0x4061f8['name'],'resourceId':_0x4061f8['id'],'type':_0x2ff50c[_0xad48('0x2c')],'sectionId':_0x2ff50c['id']},{})['then'](function(){return _0x32ab78;});}else{return _0x32ab78;}})['catch'](function(_0x21ff2a){logger[_0xad48('0x2b')](_0xad48('0x52'),_0x21ff2a);throw _0x21ff2a;});}return _0x32ab78;})[_0xad48('0x27')](respondWithResult(_0x43a804,0xc9))[_0xad48('0x46')](handleError(_0x43a804,null));};exports[_0xad48('0x53')]=function(_0x5a75e9,_0x31ec70){var _0x2eea17={'where':{'id':_0x5a75e9[_0xad48('0x48')]['id']}},_0x4cc2c5={};_0x4cc2c5[_0xad48('0x33')]=_['keys'](db[_0xad48('0x30')]['rawAttributes']);_0x2eea17[_0xad48('0x37')]=_[_0xad48('0x38')](_0x4cc2c5[_0xad48('0x33')],qs[_0xad48('0x39')](_0x5a75e9[_0xad48('0x34')]['fields']));_0x2eea17[_0xad48('0x37')]=_0x2eea17[_0xad48('0x37')]['length']?_0x2eea17[_0xad48('0x37')]:_0x4cc2c5[_0xad48('0x33')];if(_0x5a75e9[_0xad48('0x34')]['includeAll']){_0x2eea17[_0xad48('0x4a')]=[{'all':!![]}];}_0x2eea17=_[_0xad48('0x42')]({},_0x2eea17,_0x5a75e9[_0xad48('0x43')]);return db[_0xad48('0x30')][_0xad48('0x4d')](_0x2eea17)['then'](handleEntityNotFound(_0x31ec70,null))[_0xad48('0x27')](function(_0x4fefe2){if(_0x4fefe2){var _0x29e03a=_0x4fefe2[_0xad48('0x29')]({'plain':!![]});_0x29e03a=qs[_0xad48('0x54')](_0x29e03a,['id',_0xad48('0x55'),'updatedAt']);_0x5a75e9[_0xad48('0x56')]=_[_0xad48('0x54')](_0x5a75e9[_0xad48('0x56')],['id',_0xad48('0x55'),_0xad48('0x57')]);return db[_0xad48('0x30')]['create'](_[_0xad48('0x42')](_0x29e03a,_0x5a75e9['body']),{'include':_0x5a75e9['query'][_0xad48('0x44')]?[{'all':!![]}]:undefined})[_0xad48('0x27')](function(_0x37e763){var _0x5e1dfa=_0x5a75e9[_0xad48('0x58')][_0xad48('0x29')]({'plain':!![]});if(!_0x5e1dfa)throw new Error(_0xad48('0x4b'));if(_0x5e1dfa[_0xad48('0x59')]===_0xad48('0x58')){var _0x1a9329=_0x37e763['get']({'plain':!![]});var _0x422b92=_0xad48('0x2a');return db[_0xad48('0x4c')][_0xad48('0x4d')]({'where':{'name':_0x422b92,'userProfileId':_0x5e1dfa[_0xad48('0x4e')]},'raw':!![]})['then'](function(_0x4f8cb6){if(_0x4f8cb6&&_0x4f8cb6['autoAssociation']===0x0){return db[_0xad48('0x50')][_0xad48('0x51')]({'name':_0x1a9329[_0xad48('0x2c')],'resourceId':_0x1a9329['id'],'type':_0x4f8cb6['name'],'sectionId':_0x4f8cb6['id']},{})[_0xad48('0x27')](function(){return _0x37e763;});}else{return _0x37e763;}})[_0xad48('0x46')](function(_0x4c509f){logger[_0xad48('0x2b')](_0xad48('0x52'),_0x4c509f);throw _0x4c509f;});}return _0x37e763;});}})[_0xad48('0x27')](respondWithResult(_0x31ec70,0xc9))['catch'](handleError(_0x31ec70,null));};exports['update']=function(_0xf6fe84,_0x241fd3){if(_0xf6fe84['body']['id']){delete _0xf6fe84[_0xad48('0x56')]['id'];}return db[_0xad48('0x30')][_0xad48('0x4d')]({'where':{'id':_0xf6fe84[_0xad48('0x48')]['id']}})[_0xad48('0x27')](handleEntityNotFound(_0x241fd3,null))['then'](saveUpdates(_0xf6fe84['body'],null))[_0xad48('0x27')](respondWithResult(_0x241fd3,null))[_0xad48('0x46')](handleError(_0x241fd3,null));};exports[_0xad48('0x28')]=function(_0x5ccc87,_0x2997ea){return db[_0xad48('0x30')][_0xad48('0x4d')]({'where':{'id':_0x5ccc87[_0xad48('0x48')]['id']}})['then'](handleEntityNotFound(_0x2997ea,null))[_0xad48('0x27')](removeEntity(_0x2997ea,null))[_0xad48('0x46')](handleError(_0x2997ea,null));};exports['getHoppers']=function(_0xa9b7b0,_0x209ea6,_0x44950e){var _0x4eb292={'raw':!![],'where':{}};var _0x1bd650={};var _0xbb643d={'count':0x0,'rows':[]};return db[_0xad48('0x30')][_0xad48('0x5a')]({'where':{'id':_0xa9b7b0[_0xad48('0x48')]['id']}})[_0xad48('0x27')](handleEntityNotFound(_0x209ea6,null))['then'](function(_0x347d63){if(_0x347d63){_0x1bd650[_0xad48('0x33')]=_[_0xad48('0x35')](db[_0xad48('0x5b')]['rawAttributes']);_0x1bd650['query']=_['keys'](_0xa9b7b0[_0xad48('0x34')]);_0x1bd650[_0xad48('0x36')]=_['intersection'](_0x1bd650[_0xad48('0x33')],_0x1bd650[_0xad48('0x34')]);_0x4eb292[_0xad48('0x37')]=_[_0xad48('0x38')](_0x1bd650[_0xad48('0x33')],qs[_0xad48('0x39')](_0xa9b7b0['query'][_0xad48('0x39')]));_0x4eb292['attributes']=_0x4eb292[_0xad48('0x37')][_0xad48('0x3a')]?_0x4eb292[_0xad48('0x37')]:_0x1bd650['model'];if(!_0xa9b7b0[_0xad48('0x34')][_0xad48('0x5c')](_0xad48('0x3b'))){_0x4eb292[_0xad48('0x21')]=qs[_0xad48('0x21')](_0xa9b7b0[_0xad48('0x34')][_0xad48('0x21')]);_0x4eb292[_0xad48('0x1e')]=qs[_0xad48('0x1e')](_0xa9b7b0[_0xad48('0x34')][_0xad48('0x1e')]);}_0x4eb292[_0xad48('0x3c')]=qs['sort'](_0xa9b7b0[_0xad48('0x34')][_0xad48('0x3d')]);_0x4eb292[_0xad48('0x3e')]=qs[_0xad48('0x36')](_[_0xad48('0x3f')](_0xa9b7b0['query'],_0x1bd650[_0xad48('0x36')]));_0x4eb292['where'][_0xad48('0x5d')]=_0x347d63['id'];if(_0xa9b7b0['query'][_0xad48('0x41')]){_0x4eb292[_0xad48('0x3e')]=_[_0xad48('0x42')](_0x4eb292['where'],{'$or':_[_0xad48('0x2f')](_0x4eb292['attributes'],function(_0x40587d){var _0x5d62e9={};_0x5d62e9[_0x40587d]={'$like':'%'+_0xa9b7b0['query'][_0xad48('0x41')]+'%'};return _0x5d62e9;})});}_0x4eb292=_[_0xad48('0x42')]({},_0x4eb292,_0xa9b7b0[_0xad48('0x43')]);return db[_0xad48('0x5b')]['count']({'where':_0x4eb292[_0xad48('0x3e')]})[_0xad48('0x27')](function(_0x16e5b4){_0xbb643d[_0xad48('0x20')]=_0x16e5b4;if(_0xa9b7b0[_0xad48('0x34')][_0xad48('0x44')]){_0x4eb292[_0xad48('0x4a')]=[{'all':!![]}];}return db['CmHopper'][_0xad48('0x45')](_0x4eb292);})[_0xad48('0x27')](function(_0x5f471a){_0xbb643d[_0xad48('0x5e')]=_0x5f471a;return _0xbb643d;});}})[_0xad48('0x27')](respondWithFilteredResult(_0x209ea6,_0x4eb292))[_0xad48('0x46')](handleError(_0x209ea6,null));};exports[_0xad48('0x5f')]=function(_0x439294,_0x3580ab,_0x405388){var _0x588fb8={'raw':!![],'where':{}};var _0x27dd1f={};var _0x1a136c={'count':0x0,'rows':[]};return db[_0xad48('0x30')][_0xad48('0x5a')]({'where':{'id':_0x439294['params']['id']}})[_0xad48('0x27')](handleEntityNotFound(_0x3580ab,null))[_0xad48('0x27')](function(_0x1ac4e6){if(_0x1ac4e6){_0x27dd1f[_0xad48('0x33')]=_['keys'](db[_0xad48('0x60')]['rawAttributes']);_0x27dd1f[_0xad48('0x34')]=_[_0xad48('0x35')](_0x439294[_0xad48('0x34')]);_0x27dd1f['filters']=_[_0xad48('0x38')](_0x27dd1f[_0xad48('0x33')],_0x27dd1f['query']);_0x588fb8[_0xad48('0x37')]=_[_0xad48('0x38')](_0x27dd1f['model'],qs[_0xad48('0x39')](_0x439294['query'][_0xad48('0x39')]));_0x588fb8[_0xad48('0x37')]=_0x588fb8[_0xad48('0x37')]['length']?_0x588fb8[_0xad48('0x37')]:_0x27dd1f['model'];if(!_0x439294[_0xad48('0x34')]['hasOwnProperty'](_0xad48('0x3b'))){_0x588fb8[_0xad48('0x21')]=qs[_0xad48('0x21')](_0x439294[_0xad48('0x34')]['limit']);_0x588fb8[_0xad48('0x1e')]=qs[_0xad48('0x1e')](_0x439294['query'][_0xad48('0x1e')]);}_0x588fb8[_0xad48('0x3c')]=qs[_0xad48('0x3d')](_0x439294['query'][_0xad48('0x3d')]);_0x588fb8['where']=qs[_0xad48('0x36')](_['pick'](_0x439294[_0xad48('0x34')],_0x27dd1f[_0xad48('0x36')]));_0x588fb8['where'][_0xad48('0x5d')]=_0x1ac4e6['id'];if(_0x439294[_0xad48('0x34')][_0xad48('0x41')]){_0x588fb8[_0xad48('0x3e')]=_[_0xad48('0x42')](_0x588fb8['where'],{'$or':_[_0xad48('0x2f')](_0x588fb8[_0xad48('0x37')],function(_0x2ee9c1){var _0x37aa36={};_0x37aa36[_0x2ee9c1]={'$like':'%'+_0x439294[_0xad48('0x34')]['filter']+'%'};return _0x37aa36;})});}_0x588fb8=_[_0xad48('0x42')]({},_0x588fb8,_0x439294['options']);return db[_0xad48('0x60')][_0xad48('0x20')]({'where':_0x588fb8[_0xad48('0x3e')]})[_0xad48('0x27')](function(_0x20478e){_0x1a136c[_0xad48('0x20')]=_0x20478e;if(_0x439294[_0xad48('0x34')][_0xad48('0x44')]){_0x588fb8[_0xad48('0x4a')]=[{'all':!![]}];}return db[_0xad48('0x60')][_0xad48('0x45')](_0x588fb8);})['then'](function(_0x28c34d){_0x1a136c[_0xad48('0x5e')]=_0x28c34d;return _0x1a136c;});}})['then'](respondWithFilteredResult(_0x3580ab,_0x588fb8))[_0xad48('0x46')](handleError(_0x3580ab,null));};exports[_0xad48('0x61')]=function(_0x17e623,_0x4dfc9b,_0x40ed2d){var _0x2f29cc={'raw':!![],'where':{}};var _0x41d956={};var _0x34f81c={'count':0x0,'rows':[]};return db[_0xad48('0x30')][_0xad48('0x5a')]({'where':{'id':_0x17e623[_0xad48('0x48')]['id']}})[_0xad48('0x27')](handleEntityNotFound(_0x4dfc9b,null))['then'](function(_0x21c771){if(_0x21c771){_0x41d956[_0xad48('0x33')]=_[_0xad48('0x35')](db[_0xad48('0x62')][_0xad48('0x49')]);_0x41d956['query']=_[_0xad48('0x35')](_0x17e623[_0xad48('0x34')]);_0x41d956[_0xad48('0x36')]=_[_0xad48('0x38')](_0x41d956['model'],_0x41d956[_0xad48('0x34')]);_0x2f29cc[_0xad48('0x37')]=_[_0xad48('0x38')](_0x41d956[_0xad48('0x33')],qs['fields'](_0x17e623['query'][_0xad48('0x39')]));_0x2f29cc[_0xad48('0x37')]=_0x2f29cc[_0xad48('0x37')][_0xad48('0x3a')]?_0x2f29cc[_0xad48('0x37')]:_0x41d956[_0xad48('0x33')];if(!_0x17e623[_0xad48('0x34')][_0xad48('0x5c')]('nolimit')){_0x2f29cc[_0xad48('0x21')]=qs['limit'](_0x17e623[_0xad48('0x34')]['limit']);_0x2f29cc[_0xad48('0x1e')]=qs['offset'](_0x17e623[_0xad48('0x34')][_0xad48('0x1e')]);}_0x2f29cc['order']=qs['sort'](_0x17e623[_0xad48('0x34')][_0xad48('0x3d')]);_0x2f29cc[_0xad48('0x3e')]=qs['filters'](_[_0xad48('0x3f')](_0x17e623[_0xad48('0x34')],_0x41d956[_0xad48('0x36')]));_0x2f29cc[_0xad48('0x3e')]['CampaignId']=_0x21c771['id'];if(_0x17e623[_0xad48('0x34')][_0xad48('0x41')]){_0x2f29cc[_0xad48('0x3e')]=_[_0xad48('0x42')](_0x2f29cc[_0xad48('0x3e')],{'$or':_[_0xad48('0x2f')](_0x2f29cc[_0xad48('0x37')],function(_0x253f26){var _0x145ed0={};_0x145ed0[_0x253f26]={'$like':'%'+_0x17e623[_0xad48('0x34')][_0xad48('0x41')]+'%'};return _0x145ed0;})});}_0x2f29cc=_[_0xad48('0x42')]({},_0x2f29cc,_0x17e623[_0xad48('0x43')]);return db[_0xad48('0x62')][_0xad48('0x20')]({'where':_0x2f29cc['where']})['then'](function(_0x1f52f6){_0x34f81c['count']=_0x1f52f6;if(_0x17e623[_0xad48('0x34')][_0xad48('0x44')]){_0x2f29cc[_0xad48('0x4a')]=[{'all':!![]}];}return db[_0xad48('0x62')][_0xad48('0x45')](_0x2f29cc);})[_0xad48('0x27')](function(_0x387cb5){_0x34f81c['rows']=_0x387cb5;return _0x34f81c;});}})[_0xad48('0x27')](respondWithFilteredResult(_0x4dfc9b,_0x2f29cc))[_0xad48('0x46')](handleError(_0x4dfc9b,null));};exports[_0xad48('0x63')]=function(_0x75e9c8,_0x12c1bc,_0x4c0c6b){var _0x1d8028={'raw':!![],'where':{}};var _0xc6193={};var _0x57651a={'count':0x0,'rows':[]};return db['Campaign'][_0xad48('0x5a')]({'where':{'id':_0x75e9c8[_0xad48('0x48')]['id']}})[_0xad48('0x27')](handleEntityNotFound(_0x12c1bc,null))[_0xad48('0x27')](function(_0x213567){if(_0x213567){_0xc6193[_0xad48('0x33')]=_[_0xad48('0x35')](db[_0xad48('0x64')][_0xad48('0x49')]);_0xc6193['query']=_[_0xad48('0x35')](_0x75e9c8['query']);_0xc6193[_0xad48('0x36')]=_[_0xad48('0x38')](_0xc6193[_0xad48('0x33')],_0xc6193[_0xad48('0x34')]);_0x1d8028[_0xad48('0x37')]=_[_0xad48('0x38')](_0xc6193[_0xad48('0x33')],qs[_0xad48('0x39')](_0x75e9c8[_0xad48('0x34')][_0xad48('0x39')]));_0x1d8028['attributes']=_0x1d8028[_0xad48('0x37')][_0xad48('0x3a')]?_0x1d8028['attributes']:_0xc6193['model'];if(!_0x75e9c8[_0xad48('0x34')][_0xad48('0x5c')](_0xad48('0x3b'))){_0x1d8028[_0xad48('0x21')]=qs['limit'](_0x75e9c8[_0xad48('0x34')][_0xad48('0x21')]);_0x1d8028[_0xad48('0x1e')]=qs[_0xad48('0x1e')](_0x75e9c8['query']['offset']);}_0x1d8028[_0xad48('0x3c')]=qs['sort'](_0x75e9c8[_0xad48('0x34')][_0xad48('0x3d')]);_0x1d8028[_0xad48('0x3e')]=qs[_0xad48('0x36')](_['pick'](_0x75e9c8['query'],_0xc6193['filters']));_0x1d8028['where'][_0xad48('0x5d')]=_0x213567['id'];if(_0x75e9c8[_0xad48('0x34')][_0xad48('0x41')]){_0x1d8028[_0xad48('0x3e')]=_[_0xad48('0x42')](_0x1d8028[_0xad48('0x3e')],{'$or':_[_0xad48('0x2f')](_0x1d8028[_0xad48('0x37')],function(_0x791a22){var _0xe4e7dd={};_0xe4e7dd[_0x791a22]={'$like':'%'+_0x75e9c8[_0xad48('0x34')][_0xad48('0x41')]+'%'};return _0xe4e7dd;})});}_0x1d8028=_['merge']({},_0x1d8028,_0x75e9c8[_0xad48('0x43')]);return db[_0xad48('0x64')][_0xad48('0x20')]({'where':_0x1d8028[_0xad48('0x3e')]})[_0xad48('0x27')](function(_0x1cebe6){_0x57651a[_0xad48('0x20')]=_0x1cebe6;if(_0x75e9c8[_0xad48('0x34')]['includeAll']){_0x1d8028[_0xad48('0x4a')]=[{'all':!![]}];}return db['CmHopperBlack'][_0xad48('0x45')](_0x1d8028);})[_0xad48('0x27')](function(_0x428077){_0x57651a[_0xad48('0x5e')]=_0x428077;return _0x57651a;});}})[_0xad48('0x27')](respondWithFilteredResult(_0x12c1bc,_0x1d8028))[_0xad48('0x46')](handleError(_0x12c1bc,null));};exports[_0xad48('0x65')]=function(_0x374723,_0x343025,_0x473ef0){var _0x5886ff={};var _0xa7764a={};var _0x30cebd;var _0x48f32e;return db[_0xad48('0x30')][_0xad48('0x5a')]({'where':{'id':_0x374723['params']['id']}})[_0xad48('0x27')](handleEntityNotFound(_0x343025,null))[_0xad48('0x27')](function(_0x226690){if(_0x226690){_0x30cebd=_0x226690;_0xa7764a['model']=_[_0xad48('0x35')](db[_0xad48('0x66')][_0xad48('0x49')]);_0xa7764a['query']=_[_0xad48('0x35')](_0x374723[_0xad48('0x34')]);_0xa7764a[_0xad48('0x36')]=_[_0xad48('0x38')](_0xa7764a[_0xad48('0x33')],_0xa7764a[_0xad48('0x34')]);_0x5886ff[_0xad48('0x37')]=_[_0xad48('0x38')](_0xa7764a['model'],qs[_0xad48('0x39')](_0x374723[_0xad48('0x34')]['fields']));_0x5886ff[_0xad48('0x37')]=_0x5886ff[_0xad48('0x37')][_0xad48('0x3a')]?_0x5886ff[_0xad48('0x37')]:_0xa7764a['model'];_0x5886ff['order']=qs['sort'](_0x374723[_0xad48('0x34')]['sort']);_0x5886ff[_0xad48('0x3e')]=qs['filters'](_[_0xad48('0x3f')](_0x374723['query'],_0xa7764a[_0xad48('0x36')]));if(_0x374723[_0xad48('0x34')][_0xad48('0x41')]){_0x5886ff[_0xad48('0x3e')]=_[_0xad48('0x42')](_0x5886ff[_0xad48('0x3e')],{'$or':_['map'](_0x5886ff[_0xad48('0x37')],function(_0x3c43e0){var _0x576320={};_0x576320[_0x3c43e0]={'$like':'%'+_0x374723['query'][_0xad48('0x41')]+'%'};return _0x576320;})});}_0x5886ff=_[_0xad48('0x42')]({},_0x5886ff,_0x374723[_0xad48('0x43')]);return _0x30cebd[_0xad48('0x65')](_0x5886ff);}})[_0xad48('0x27')](function(_0x543492){if(_0x543492){_0x48f32e=_0x543492['length'];if(!_0x374723[_0xad48('0x34')][_0xad48('0x5c')](_0xad48('0x3b'))){_0x5886ff[_0xad48('0x21')]=qs[_0xad48('0x21')](_0x374723[_0xad48('0x34')][_0xad48('0x21')]);_0x5886ff['offset']=qs['offset'](_0x374723['query'][_0xad48('0x1e')]);}return _0x30cebd['getLists'](_0x5886ff);}})[_0xad48('0x27')](function(_0x5025e6){if(_0x5025e6){return _0x5025e6?{'count':_0x48f32e,'rows':_0x5025e6}:null;}})['then'](respondWithResult(_0x343025,null))[_0xad48('0x46')](handleError(_0x343025,null));};exports[_0xad48('0x67')]=function(_0x4145d4,_0x1289c6,_0x544028){var _0x43d7e3,_0x4c4734;return db[_0xad48('0x30')][_0xad48('0x4d')]({'where':{'id':_0x4145d4[_0xad48('0x48')]['id']}})['then'](handleEntityNotFound(_0x1289c6,null))[_0xad48('0x27')](function(_0x1b48b3){if(_0x1b48b3){_0x4c4734=_0x1b48b3;return _0x1b48b3['addLists'](_0x4145d4[_0xad48('0x56')]['ids'],_[_0xad48('0x54')](_0x4145d4[_0xad48('0x56')],[_0xad48('0x68'),'id'])||{});}return null;})[_0xad48('0x69')](function(_0x49b608){var _0x5c4a78;_0x43d7e3=_0x49b608||[];var _0x11de19=[];if(_0x49b608){for(var _0xac3803=0x0;_0xac3803<_0x49b608[_0xad48('0x3a')];_0xac3803+=0x1){var _0x3967d6=_0x49b608[_0xac3803][_0xad48('0x29')]({'plain':!![]});_0x4c4734[_0xad48('0x6a')]=_0x4145d4[_0xad48('0x56')]['dialCheckDuplicateType']?_0x4145d4['body'][_0xad48('0x6a')]:_0x4c4734['dialCheckDuplicateType'];switch(_0x4c4734['dialCheckDuplicateType']){case _0xad48('0x6b'):_0x5c4a78=squel[_0xad48('0x6c')]()['into'](_0xad48('0x6d'))[_0xad48('0x6e')]([_0xad48('0x6f'),_0xad48('0x70'),'ContactId',_0xad48('0x71'),_0xad48('0x5d'),_0xad48('0x55'),_0xad48('0x57')],squel[_0xad48('0x72')]()[_0xad48('0x73')](_0xad48('0x6f'),_0xad48('0x6f'))[_0xad48('0x73')]('NOW()',_0xad48('0x70'))[_0xad48('0x73')]('id','ContactId')['field'](_0x3967d6['CmListId'][_0xad48('0x74')](),_0xad48('0x71'))[_0xad48('0x73')](_0x4145d4['params']['id']['toString'](),'CampaignId')[_0xad48('0x73')]('NOW()','createdAt')['field'](_0xad48('0x75'),_0xad48('0x57'))[_0xad48('0x76')](_0xad48('0x77'))['where'](_0xad48('0x78'))[_0xad48('0x3e')](_0xad48('0x79'),_0x3967d6[_0xad48('0x7a')][_0xad48('0x74')]())[_0xad48('0x3e')]('phone\x20IS\x20NOT\x20NULL')[_0xad48('0x3e')]('phone\x20NOT\x20IN\x20(?)',squel[_0xad48('0x72')]()[_0xad48('0x73')](_0xad48('0x7b'))[_0xad48('0x76')](_0xad48('0x7c'))[_0xad48('0x3e')](_0xad48('0x7d'),_0x4145d4[_0xad48('0x48')]['id'][_0xad48('0x74')]()))[_0xad48('0x3e')](_0xad48('0x7e'),squel['select']()[_0xad48('0x73')](_0xad48('0x7f'))[_0xad48('0x76')](_0xad48('0x6d'))[_0xad48('0x3e')](_0xad48('0x7d'),_0x4145d4[_0xad48('0x48')]['id'][_0xad48('0x74')]())))[_0xad48('0x74')]();break;case _0xad48('0x80'):_0x5c4a78=squel['insert']()[_0xad48('0x81')](_0xad48('0x6d'))[_0xad48('0x6e')]([_0xad48('0x6f'),_0xad48('0x70'),_0xad48('0x82'),_0xad48('0x71'),_0xad48('0x5d'),'createdAt',_0xad48('0x57')],squel[_0xad48('0x72')]()[_0xad48('0x73')]('phone',_0xad48('0x6f'))['field'](_0xad48('0x75'),_0xad48('0x70'))['field']('id',_0xad48('0x82'))['field'](_0x3967d6['CmListId'][_0xad48('0x74')](),'ListId')[_0xad48('0x73')](_0x4145d4[_0xad48('0x48')]['id'][_0xad48('0x74')](),'CampaignId')[_0xad48('0x73')](_0xad48('0x75'),_0xad48('0x55'))[_0xad48('0x73')](_0xad48('0x75'),_0xad48('0x57'))[_0xad48('0x76')](_0xad48('0x77'))[_0xad48('0x3e')](_0xad48('0x78'))[_0xad48('0x3e')](_0xad48('0x79'),_0x3967d6[_0xad48('0x7a')]['toString']())[_0xad48('0x3e')](_0xad48('0x83'))[_0xad48('0x3e')](_0xad48('0x7e'),squel['select']()[_0xad48('0x73')](_0xad48('0x7f'))[_0xad48('0x76')](_0xad48('0x6d'))[_0xad48('0x3e')](_0xad48('0x7d'),_0x4145d4[_0xad48('0x48')]['id'][_0xad48('0x74')]())))[_0xad48('0x74')]();break;default:_0x5c4a78=squel[_0xad48('0x6c')]()[_0xad48('0x81')]('cm_hopper')[_0xad48('0x6e')](['phone',_0xad48('0x70'),_0xad48('0x82'),'ListId',_0xad48('0x5d'),_0xad48('0x55'),_0xad48('0x57')],squel[_0xad48('0x72')]()[_0xad48('0x73')](_0xad48('0x6f'),_0xad48('0x6f'))[_0xad48('0x73')](_0xad48('0x75'),_0xad48('0x70'))[_0xad48('0x73')]('id','ContactId')['field'](_0x3967d6['CmListId']['toString'](),_0xad48('0x71'))[_0xad48('0x73')](_0x4145d4['params']['id'][_0xad48('0x74')](),_0xad48('0x5d'))[_0xad48('0x73')]('NOW()',_0xad48('0x55'))['field'](_0xad48('0x75'),'updatedAt')[_0xad48('0x76')](_0xad48('0x77'))[_0xad48('0x3e')](_0xad48('0x78'))[_0xad48('0x3e')](_0xad48('0x79'),_0x3967d6[_0xad48('0x7a')][_0xad48('0x74')]())[_0xad48('0x3e')](_0xad48('0x83')))[_0xad48('0x74')]();}_0x11de19[_0xad48('0x84')](db[_0xad48('0x85')][_0xad48('0x34')](_0x5c4a78));}return BPromise[_0xad48('0x86')](_0x11de19);}})['then'](function(){return _0x43d7e3;})[_0xad48('0x27')](respondWithResult(_0x1289c6,null))[_0xad48('0x46')](handleError(_0x1289c6,null));};exports[_0xad48('0x87')]=function(_0x4eb165,_0x357ae6,_0x11d576){return db[_0xad48('0x30')][_0xad48('0x4d')]({'where':{'id':_0x4eb165[_0xad48('0x48')]['id']}})[_0xad48('0x27')](handleEntityNotFound(_0x357ae6,null))['then'](function(_0x2daab1){if(_0x2daab1){return _0x2daab1[_0xad48('0x87')](_0x4eb165['query'][_0xad48('0x68')]);}})[_0xad48('0x27')](function(_0x4da66d){if(_0x4da66d){return db[_0xad48('0x5b')][_0xad48('0x28')]({'where':{'ListId':_0x4eb165[_0xad48('0x34')][_0xad48('0x68')],'CampaignId':_0x4eb165['params']['id']}})[_0xad48('0x27')](function(){return _0x4da66d;});}})[_0xad48('0x27')](respondWithStatusCode(_0x357ae6,null))[_0xad48('0x46')](handleError(_0x357ae6,null));};exports[_0xad48('0x88')]=function(_0x189605,_0x2751ad,_0x4ca0b8){var _0x226786={};var _0x11be61={};var _0x5f089a;var _0x29beea;return db[_0xad48('0x30')][_0xad48('0x5a')]({'where':{'id':_0x189605[_0xad48('0x48')]['id']}})[_0xad48('0x27')](handleEntityNotFound(_0x2751ad,null))['then'](function(_0x4f2283){if(_0x4f2283){_0x5f089a=_0x4f2283;_0x11be61[_0xad48('0x33')]=_[_0xad48('0x35')](db[_0xad48('0x66')][_0xad48('0x49')]);_0x11be61[_0xad48('0x34')]=_['keys'](_0x189605[_0xad48('0x34')]);_0x11be61[_0xad48('0x36')]=_[_0xad48('0x38')](_0x11be61['model'],_0x11be61['query']);_0x226786['attributes']=_[_0xad48('0x38')](_0x11be61[_0xad48('0x33')],qs[_0xad48('0x39')](_0x189605[_0xad48('0x34')][_0xad48('0x39')]));_0x226786[_0xad48('0x37')]=_0x226786['attributes'][_0xad48('0x3a')]?_0x226786[_0xad48('0x37')]:_0x11be61['model'];_0x226786['order']=qs[_0xad48('0x3d')](_0x189605[_0xad48('0x34')][_0xad48('0x3d')]);_0x226786['where']=qs['filters'](_[_0xad48('0x3f')](_0x189605['query'],_0x11be61[_0xad48('0x36')]));if(_0x189605[_0xad48('0x34')][_0xad48('0x41')]){_0x226786[_0xad48('0x3e')]=_[_0xad48('0x42')](_0x226786[_0xad48('0x3e')],{'$or':_[_0xad48('0x2f')](_0x226786[_0xad48('0x37')],function(_0x4d144d){var _0x393507={};_0x393507[_0x4d144d]={'$like':'%'+_0x189605[_0xad48('0x34')][_0xad48('0x41')]+'%'};return _0x393507;})});}_0x226786=_[_0xad48('0x42')]({},_0x226786,_0x189605['options']);return _0x5f089a[_0xad48('0x88')](_0x226786);}})[_0xad48('0x27')](function(_0x348621){if(_0x348621){_0x29beea=_0x348621['length'];if(!_0x189605[_0xad48('0x34')]['hasOwnProperty']('nolimit')){_0x226786[_0xad48('0x21')]=qs[_0xad48('0x21')](_0x189605[_0xad48('0x34')][_0xad48('0x21')]);_0x226786[_0xad48('0x1e')]=qs[_0xad48('0x1e')](_0x189605['query'][_0xad48('0x1e')]);}return _0x5f089a[_0xad48('0x88')](_0x226786);}})[_0xad48('0x27')](function(_0xe3955){if(_0xe3955){return _0xe3955?{'count':_0x29beea,'rows':_0xe3955}:null;}})[_0xad48('0x27')](respondWithResult(_0x2751ad,null))[_0xad48('0x46')](handleError(_0x2751ad,null));};exports[_0xad48('0x89')]=function(_0x112501,_0x1b6243,_0x21b9e3){var _0x30dd81,_0xd8ae5;return db['Campaign'][_0xad48('0x4d')]({'where':{'id':_0x112501[_0xad48('0x48')]['id']}})['then'](handleEntityNotFound(_0x1b6243,null))[_0xad48('0x27')](function(_0x3432f9){if(_0x3432f9){_0xd8ae5=_0x3432f9;return _0x3432f9['addBlackLists'](_0x112501[_0xad48('0x56')][_0xad48('0x68')],_[_0xad48('0x54')](_0x112501[_0xad48('0x56')],[_0xad48('0x68'),'id'])||{});}return null;})[_0xad48('0x69')](function(_0x364d0b){var _0x1bf56a;_0x30dd81=_0x364d0b||[];var _0x2f241c=[];if(_0x364d0b){for(var _0x5a8951=0x0;_0x5a8951<_0x364d0b[_0xad48('0x3a')];_0x5a8951+=0x1){var _0x81589d=_0x364d0b[_0x5a8951][_0xad48('0x29')]({'plain':!![]});_0x1bf56a=squel[_0xad48('0x6c')]()[_0xad48('0x81')]('cm_hopper_black')[_0xad48('0x6e')]([_0xad48('0x6f'),_0xad48('0x82'),_0xad48('0x71'),'CampaignId',_0xad48('0x55'),_0xad48('0x57')],squel['select']()[_0xad48('0x73')]('phone','phone')['field']('id',_0xad48('0x82'))['field'](_0x81589d[_0xad48('0x7a')][_0xad48('0x74')](),_0xad48('0x71'))[_0xad48('0x73')](_0x112501[_0xad48('0x48')]['id']['toString'](),_0xad48('0x5d'))[_0xad48('0x73')](_0xad48('0x75'),_0xad48('0x55'))[_0xad48('0x73')](_0xad48('0x75'),_0xad48('0x57'))[_0xad48('0x76')](_0xad48('0x77'))[_0xad48('0x3e')]('deletedAt\x20IS\x20NULL')[_0xad48('0x3e')](_0xad48('0x79'),_0x81589d[_0xad48('0x7a')][_0xad48('0x74')]())['where'](_0xad48('0x83')))[_0xad48('0x74')]();_0x2f241c[_0xad48('0x84')](db['sequelize'][_0xad48('0x34')](_0x1bf56a));}return BPromise[_0xad48('0x86')](_0x2f241c);}})[_0xad48('0x27')](function(){return _0x30dd81;})['then'](respondWithResult(_0x1b6243,null))[_0xad48('0x46')](handleError(_0x1b6243,null));};exports[_0xad48('0x8a')]=function(_0x4de900,_0x1d013e,_0x5ab481){return db[_0xad48('0x30')][_0xad48('0x4d')]({'where':{'id':_0x4de900[_0xad48('0x48')]['id']}})['then'](handleEntityNotFound(_0x1d013e,null))[_0xad48('0x27')](function(_0x270546){if(_0x270546){return _0x270546[_0xad48('0x8a')](_0x4de900[_0xad48('0x34')]['ids']);}})[_0xad48('0x27')](function(_0x2e7e49){if(_0x2e7e49){return db[_0xad48('0x64')]['destroy']({'where':{'ListId':_0x4de900['query'][_0xad48('0x68')],'CampaignId':_0x4de900[_0xad48('0x48')]['id']}})[_0xad48('0x27')](function(){return _0x2e7e49;});}})[_0xad48('0x27')](respondWithStatusCode(_0x1d013e,null))['catch'](handleError(_0x1d013e,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 735c60c..1713365 100644 --- a/server/api/campaign/campaign.model.js +++ b/server/api/campaign/campaign.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x40b7ec,_0x307707){var _0x72b976=function(_0x5bfcc3){while(--_0x5bfcc3){_0x40b7ec['push'](_0x40b7ec['shift']());}};_0x72b976(++_0x307707);}(_0x7a54,0x106));var _0x47a5=function(_0x4e02a1,_0x43b5d0){_0x4e02a1=_0x4e02a1-0x0;var _0x30d550=_0x7a54[_0x4e02a1];return _0x30d550;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9957=['exports','define','Campaign','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./campaign.attributes'];(function(_0x19b3f9,_0xade753){var _0x18c3f6=function(_0x21439f){while(--_0x21439f){_0x19b3f9['push'](_0x19b3f9['shift']());}};_0x18c3f6(++_0xade753);}(_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':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index c4c27e7..dc9286b 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 _0x2bd6=['where','attributes','include','map','model','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','then','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','GetCampaign','Campaign','findAll','options','raw'];(function(_0x3d92e3,_0x4a8dcf){var _0x4150dc=function(_0x58f184){while(--_0x58f184){_0x3d92e3['push'](_0x3d92e3['shift']());}};_0x4150dc(++_0x4a8dcf);}(_0x2bd6,0x1f4));var _0x62bd=function(_0x1e2321,_0x3ae1c5){_0x1e2321=_0x1e2321-0x0;var _0x1d346d=_0x2bd6[_0x1e2321];return _0x1d346d;};'use strict';var _=require(_0x62bd('0x0'));var util=require(_0x62bd('0x1'));var moment=require(_0x62bd('0x2'));var BPromise=require(_0x62bd('0x3'));var rs=require(_0x62bd('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x62bd('0x5'))['db'];var utils=require(_0x62bd('0x6'));var logger=require(_0x62bd('0x7'))('rpc');var config=require(_0x62bd('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x62bd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x39af04,_0x55d811,_0x3d0d8b){return new BPromise(function(_0x11af94,_0x4ff8b8){return client[_0x62bd('0xa')](_0x39af04,_0x3d0d8b)[_0x62bd('0xb')](function(_0x1e2413){logger[_0x62bd('0xc')](_0x62bd('0xd'),_0x55d811,_0x62bd('0xe'));logger[_0x62bd('0xf')](_0x62bd('0x10'),_0x55d811,_0x62bd('0xe'),JSON[_0x62bd('0x11')](_0x1e2413));if(_0x1e2413['error']){if(_0x1e2413['error'][_0x62bd('0x12')]===0x1f4){logger[_0x62bd('0x13')](_0x62bd('0xd'),_0x55d811,_0x1e2413[_0x62bd('0x13')][_0x62bd('0x14')]);return _0x4ff8b8(_0x1e2413[_0x62bd('0x13')]['message']);}logger[_0x62bd('0x13')]('Campaign,\x20%s,\x20%s',_0x55d811,_0x1e2413[_0x62bd('0x13')]['message']);return _0x11af94(_0x1e2413['error'][_0x62bd('0x14')]);}else{logger[_0x62bd('0xc')](_0x62bd('0xd'),_0x55d811,_0x62bd('0xe'));_0x11af94(_0x1e2413[_0x62bd('0x15')][_0x62bd('0x14')]);}})[_0x62bd('0x16')](function(_0x16f723){logger['error'](_0x62bd('0xd'),_0x55d811,_0x16f723);_0x4ff8b8(_0x16f723);});});}exports[_0x62bd('0x17')]=function(_0x1e0b6a){var _0x38eb80=this;return new Promise(function(_0x59a648,_0x3d050b){return db[_0x62bd('0x18')][_0x62bd('0x19')]({'raw':_0x1e0b6a[_0x62bd('0x1a')]?_0x1e0b6a['options'][_0x62bd('0x1b')]===undefined?!![]:![]:!![],'where':_0x1e0b6a[_0x62bd('0x1a')]?_0x1e0b6a[_0x62bd('0x1a')][_0x62bd('0x1c')]||null:null,'attributes':_0x1e0b6a['options']?_0x1e0b6a[_0x62bd('0x1a')][_0x62bd('0x1d')]||null:null,'limit':_0x1e0b6a[_0x62bd('0x1a')]?_0x1e0b6a[_0x62bd('0x1a')]['limit']||null:null,'include':_0x1e0b6a[_0x62bd('0x1a')]?_0x1e0b6a[_0x62bd('0x1a')][_0x62bd('0x1e')]?_[_0x62bd('0x1f')](_0x1e0b6a[_0x62bd('0x1a')][_0x62bd('0x1e')],function(_0x245628){return{'model':db[_0x245628[_0x62bd('0x20')]],'as':_0x245628['as'],'attributes':_0x245628[_0x62bd('0x1d')],'include':_0x245628[_0x62bd('0x1e')]?_[_0x62bd('0x1f')](_0x245628[_0x62bd('0x1e')],function(_0x45e4f2){return{'model':db[_0x45e4f2['model']],'as':_0x45e4f2['as'],'attributes':_0x45e4f2[_0x62bd('0x1d')],'include':_0x45e4f2[_0x62bd('0x1e')]?_['map'](_0x45e4f2[_0x62bd('0x1e')],function(_0x3c6761){return{'model':db[_0x3c6761[_0x62bd('0x20')]],'as':_0x3c6761['as'],'attributes':_0x3c6761['attributes']};}):[]};}):[]};}):[]:[]})[_0x62bd('0xb')](function(_0x205d78){logger[_0x62bd('0xc')](_0x62bd('0x17'),_0x1e0b6a);logger[_0x62bd('0xf')](_0x62bd('0x17'),_0x1e0b6a,JSON[_0x62bd('0x11')](_0x205d78));_0x59a648(_0x205d78);})[_0x62bd('0x16')](function(_0x532515){logger['error'](_0x62bd('0x17'),_0x532515[_0x62bd('0x14')],_0x1e0b6a);_0x3d050b(_0x38eb80[_0x62bd('0x13')](0x1f4,_0x532515[_0x62bd('0x14')]));});});}; \ No newline at end of file +var _0x0834=['attributes','limit','map','model','include','GetCampaign','moment','bluebird','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','findAll','options','raw'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0834,0x18e));var _0x4083=function(_0x2ef8ad,_0x1d81cd){_0x2ef8ad=_0x2ef8ad-0x0;var _0x4fec0a=_0x0834[_0x2ef8ad];return _0x4fec0a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4083('0x0'));var BPromise=require(_0x4083('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4083('0x2'));var logger=require(_0x4083('0x3'))('rpc');var config=require(_0x4083('0x4'));var jayson=require(_0x4083('0x5'));var client=jayson['client'][_0x4083('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x5c5a54,_0x31c7ef,_0x26ed53){return new BPromise(function(_0x2c42bb,_0x1d56dd){return client[_0x4083('0x7')](_0x5c5a54,_0x26ed53)[_0x4083('0x8')](function(_0x3cee37){logger[_0x4083('0x9')](_0x4083('0xa'),_0x31c7ef,_0x4083('0xb'));logger[_0x4083('0xc')](_0x4083('0xd'),_0x31c7ef,_0x4083('0xb'),JSON[_0x4083('0xe')](_0x3cee37));if(_0x3cee37[_0x4083('0xf')]){if(_0x3cee37['error']['code']===0x1f4){logger[_0x4083('0xf')](_0x4083('0xa'),_0x31c7ef,_0x3cee37['error'][_0x4083('0x10')]);return _0x1d56dd(_0x3cee37[_0x4083('0xf')][_0x4083('0x10')]);}logger['error']('Campaign,\x20%s,\x20%s',_0x31c7ef,_0x3cee37[_0x4083('0xf')][_0x4083('0x10')]);return _0x2c42bb(_0x3cee37['error'][_0x4083('0x10')]);}else{logger[_0x4083('0x9')](_0x4083('0xa'),_0x31c7ef,_0x4083('0xb'));_0x2c42bb(_0x3cee37[_0x4083('0x11')]['message']);}})[_0x4083('0x12')](function(_0x10cadd){logger[_0x4083('0xf')](_0x4083('0xa'),_0x31c7ef,_0x10cadd);_0x1d56dd(_0x10cadd);});});}exports['GetCampaign']=function(_0x4e7d59){var _0x4d6089=this;return new Promise(function(_0xafda0c,_0x53d525){return db['Campaign'][_0x4083('0x13')]({'raw':_0x4e7d59['options']?_0x4e7d59[_0x4083('0x14')][_0x4083('0x15')]===undefined?!![]:![]:!![],'where':_0x4e7d59[_0x4083('0x14')]?_0x4e7d59[_0x4083('0x14')]['where']||null:null,'attributes':_0x4e7d59[_0x4083('0x14')]?_0x4e7d59['options'][_0x4083('0x16')]||null:null,'limit':_0x4e7d59[_0x4083('0x14')]?_0x4e7d59[_0x4083('0x14')][_0x4083('0x17')]||null:null,'include':_0x4e7d59['options']?_0x4e7d59[_0x4083('0x14')]['include']?_[_0x4083('0x18')](_0x4e7d59[_0x4083('0x14')]['include'],function(_0x52a440){return{'model':db[_0x52a440[_0x4083('0x19')]],'as':_0x52a440['as'],'attributes':_0x52a440['attributes'],'include':_0x52a440['include']?_['map'](_0x52a440[_0x4083('0x1a')],function(_0xb2fbb5){return{'model':db[_0xb2fbb5[_0x4083('0x19')]],'as':_0xb2fbb5['as'],'attributes':_0xb2fbb5['attributes'],'include':_0xb2fbb5[_0x4083('0x1a')]?_[_0x4083('0x18')](_0xb2fbb5[_0x4083('0x1a')],function(_0x552534){return{'model':db[_0x552534[_0x4083('0x19')]],'as':_0x552534['as'],'attributes':_0x552534[_0x4083('0x16')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x315458){logger[_0x4083('0x9')](_0x4083('0x1b'),_0x4e7d59);logger[_0x4083('0xc')](_0x4083('0x1b'),_0x4e7d59,JSON[_0x4083('0xe')](_0x315458));_0xafda0c(_0x315458);})[_0x4083('0x12')](function(_0x1534e9){logger[_0x4083('0xf')]('GetCampaign',_0x1534e9['message'],_0x4e7d59);_0x53d525(_0x4d6089[_0x4083('0xf')](0x1f4,_0x1534e9[_0x4083('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 7bcb27f..5d1a891 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 _0x9fb1=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_black','/:id/lists','getLists','getBlackLists','post','/:id/clone','clone','addLists','/:id/blacklists','addBlackLists','put','update','delete','destroy','removeLists','exports','multer','util','path'];(function(_0x5b9259,_0x198473){var _0x5bbf28=function(_0x392f8e){while(--_0x392f8e){_0x5b9259['push'](_0x5b9259['shift']());}};_0x5bbf28(++_0x198473);}(_0x9fb1,0x11d));var _0x19fb=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0x9fb1[_0x5037ab];return _0x512adb;};'use strict';var multer=require(_0x19fb('0x0'));var util=require(_0x19fb('0x1'));var path=require(_0x19fb('0x2'));var timeout=require(_0x19fb('0x3'));var express=require(_0x19fb('0x4'));var router=express[_0x19fb('0x5')]();var fs_extra=require(_0x19fb('0x6'));var auth=require(_0x19fb('0x7'));var interaction=require(_0x19fb('0x8'));var config=require('../../config/environment');var controller=require('./campaign.controller');router[_0x19fb('0x9')]('/',auth[_0x19fb('0xa')](),controller['index']);router[_0x19fb('0x9')](_0x19fb('0xb'),auth[_0x19fb('0xa')](),controller[_0x19fb('0xc')]);router[_0x19fb('0x9')](_0x19fb('0xd'),auth['isAuthenticated'](),controller[_0x19fb('0xe')]);router[_0x19fb('0x9')](_0x19fb('0xf'),auth[_0x19fb('0xa')](),controller['getHopperHistories']);router[_0x19fb('0x9')]('/:id/hopper_finals',auth[_0x19fb('0xa')](),controller['getHopperFinals']);router[_0x19fb('0x9')](_0x19fb('0x10'),auth[_0x19fb('0xa')](),controller['getHopperBlacks']);router['get'](_0x19fb('0x11'),auth[_0x19fb('0xa')](),controller[_0x19fb('0x12')]);router[_0x19fb('0x9')]('/:id/blacklists',auth[_0x19fb('0xa')](),controller[_0x19fb('0x13')]);router[_0x19fb('0x14')]('/',auth['isAuthenticated'](),controller['create']);router[_0x19fb('0x14')](_0x19fb('0x15'),auth[_0x19fb('0xa')](),controller[_0x19fb('0x16')]);router['post'](_0x19fb('0x11'),auth[_0x19fb('0xa')](),controller[_0x19fb('0x17')]);router['post'](_0x19fb('0x18'),auth[_0x19fb('0xa')](),controller[_0x19fb('0x19')]);router[_0x19fb('0x1a')](_0x19fb('0xb'),auth[_0x19fb('0xa')](),controller[_0x19fb('0x1b')]);router[_0x19fb('0x1c')](_0x19fb('0xb'),auth[_0x19fb('0xa')](),controller[_0x19fb('0x1d')]);router['delete'](_0x19fb('0x11'),auth[_0x19fb('0xa')](),controller[_0x19fb('0x1e')]);router[_0x19fb('0x1c')](_0x19fb('0x18'),auth['isAuthenticated'](),controller['removeBlackLists']);module[_0x19fb('0x1f')]=router; \ No newline at end of file +var _0xa93a=['exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./campaign.controller','isAuthenticated','index','get','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getLists','/:id/blacklists','getBlackLists','post','create','clone','/:id/lists','addLists','/:id','delete','removeLists','removeBlackLists'];(function(_0xa1de8d,_0x1399a8){var _0x478b44=function(_0x3c8db7){while(--_0x3c8db7){_0xa1de8d['push'](_0xa1de8d['shift']());}};_0x478b44(++_0x1399a8);}(_0xa93a,0x16c));var _0xaa93=function(_0xc662e0,_0x34bc95){_0xc662e0=_0xc662e0-0x0;var _0x5c7c2c=_0xa93a[_0xc662e0];return _0x5c7c2c;};'use strict';var multer=require(_0xaa93('0x0'));var util=require(_0xaa93('0x1'));var path=require(_0xaa93('0x2'));var timeout=require('connect-timeout');var express=require(_0xaa93('0x3'));var router=express[_0xaa93('0x4')]();var fs_extra=require(_0xaa93('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xaa93('0x6'));var config=require(_0xaa93('0x7'));var controller=require(_0xaa93('0x8'));router['get']('/',auth[_0xaa93('0x9')](),controller[_0xaa93('0xa')]);router[_0xaa93('0xb')]('/:id',auth[_0xaa93('0x9')](),controller[_0xaa93('0xc')]);router['get'](_0xaa93('0xd'),auth[_0xaa93('0x9')](),controller[_0xaa93('0xe')]);router['get'](_0xaa93('0xf'),auth['isAuthenticated'](),controller[_0xaa93('0x10')]);router['get'](_0xaa93('0x11'),auth[_0xaa93('0x9')](),controller[_0xaa93('0x12')]);router['get'](_0xaa93('0x13'),auth[_0xaa93('0x9')](),controller['getHopperBlacks']);router[_0xaa93('0xb')]('/:id/lists',auth[_0xaa93('0x9')](),controller[_0xaa93('0x14')]);router[_0xaa93('0xb')](_0xaa93('0x15'),auth[_0xaa93('0x9')](),controller[_0xaa93('0x16')]);router[_0xaa93('0x17')]('/',auth['isAuthenticated'](),controller[_0xaa93('0x18')]);router[_0xaa93('0x17')]('/:id/clone',auth[_0xaa93('0x9')](),controller[_0xaa93('0x19')]);router[_0xaa93('0x17')](_0xaa93('0x1a'),auth[_0xaa93('0x9')](),controller[_0xaa93('0x1b')]);router[_0xaa93('0x17')]('/:id/blacklists',auth[_0xaa93('0x9')](),controller['addBlackLists']);router['put'](_0xaa93('0x1c'),auth[_0xaa93('0x9')](),controller['update']);router[_0xaa93('0x1d')]('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0xaa93('0x1d')](_0xaa93('0x1a'),auth[_0xaa93('0x9')](),controller[_0xaa93('0x1e')]);router[_0xaa93('0x1d')]('/:id/blacklists',auth['isAuthenticated'](),controller[_0xaa93('0x1f')]);module[_0xaa93('0x20')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 2f1618e..6db5bd5 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 _0x716c=['getDataValue','sequelize','exports','STRING','TEXT','VIRTUAL'];(function(_0x15ddec,_0x3a1bbe){var _0x129d60=function(_0x779b50){while(--_0x779b50){_0x15ddec['push'](_0x15ddec['shift']());}};_0x129d60(++_0x3a1bbe);}(_0x716c,0x6d));var _0xc716=function(_0x429dd7,_0x3d7e15){_0x429dd7=_0x429dd7-0x0;var _0x1888ae=_0x716c[_0x429dd7];return _0x1888ae;};'use strict';var Sequelize=require(_0xc716('0x0'));module[_0xc716('0x1')]={'key':{'type':Sequelize[_0xc716('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0xc716('0x3')],'allowNull':![]},'description':{'type':Sequelize[_0xc716('0x2')]},'name':{'type':Sequelize[_0xc716('0x4')],'get':function(){return this[_0xc716('0x5')]('key');}}}; \ No newline at end of file +var _0xe0f3=['VIRTUAL','key','sequelize','STRING','TEXT'];(function(_0x1df796,_0x4394c1){var _0x5df53f=function(_0x144a68){while(--_0x144a68){_0x1df796['push'](_0x1df796['shift']());}};_0x5df53f(++_0x4394c1);}(_0xe0f3,0x142));var _0x3e0f=function(_0x577b01,_0x3770f0){_0x577b01=_0x577b01-0x0;var _0x380469=_0xe0f3[_0x577b01];return _0x380469;};'use strict';var Sequelize=require(_0x3e0f('0x0'));module['exports']={'key':{'type':Sequelize[_0x3e0f('0x1')],'allowNull':![]},'value':{'type':Sequelize[_0x3e0f('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x3e0f('0x1')]},'name':{'type':Sequelize[_0x3e0f('0x3')],'get':function(){return this['getDataValue'](_0x3e0f('0x4'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 28f6f01..d1ad8c9 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 _0xe420=['destroy','error','name','send','index','CannedAnswer','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','catch','body','find','params','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','get','CannedAnswers'];(function(_0x24f484,_0x1621ec){var _0x32f642=function(_0x1961bb){while(--_0x1961bb){_0x24f484['push'](_0x24f484['shift']());}};_0x32f642(++_0x1621ec);}(_0xe420,0x149));var _0x0e42=function(_0x47cd8b,_0x982a8e){_0x47cd8b=_0x47cd8b-0x0;var _0x36b69c=_0xe420[_0x47cd8b];return _0x36b69c;};'use strict';var emlformat=require(_0x0e42('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0e42('0x1'));var jsonpatch=require(_0x0e42('0x2'));var rp=require('request-promise');var moment=require(_0x0e42('0x3'));var BPromise=require(_0x0e42('0x4'));var Mustache=require(_0x0e42('0x5'));var util=require('util');var path=require(_0x0e42('0x6'));var sox=require(_0x0e42('0x7'));var csv=require('to-csv');var ejs=require(_0x0e42('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0e42('0x9'));var squel=require(_0x0e42('0xa'));var crypto=require(_0x0e42('0xb'));var jsforce=require(_0x0e42('0xc'));var deskjs=require(_0x0e42('0xd'));var toCsv=require(_0x0e42('0xe'));var querystring=require(_0x0e42('0xf'));var Papa=require(_0x0e42('0x10'));var Redis=require(_0x0e42('0x11'));var authService=require(_0x0e42('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x0e42('0x13'));var hardwareService=require(_0x0e42('0x14'));var logger=require(_0x0e42('0x15'))('api');var utils=require(_0x0e42('0x16'));var config=require(_0x0e42('0x17'));var licenseUtil=require(_0x0e42('0x18'));var db=require(_0x0e42('0x19'))['db'];function respondWithStatusCode(_0x413273,_0x4d125c){_0x4d125c=_0x4d125c||0xcc;return function(_0x274e0d){if(_0x274e0d){return _0x413273[_0x0e42('0x1a')](_0x4d125c);}return _0x413273[_0x0e42('0x1b')](_0x4d125c)[_0x0e42('0x1c')]();};}function respondWithResult(_0x30b280,_0x8c8b82){_0x8c8b82=_0x8c8b82||0xc8;return function(_0x1d71c8){if(_0x1d71c8){return _0x30b280[_0x0e42('0x1b')](_0x8c8b82)[_0x0e42('0x1d')](_0x1d71c8);}};}function respondWithFilteredResult(_0x3ec2c8,_0x3be9ea){return function(_0x4bcc41){if(_0x4bcc41){var _0x5b4245=typeof _0x3be9ea['offset']===_0x0e42('0x1e')&&typeof _0x3be9ea['limit']===_0x0e42('0x1e');var _0x138b41=_0x4bcc41[_0x0e42('0x1f')];var _0x2d0b2e=_0x5b4245?0x0:_0x3be9ea[_0x0e42('0x20')];var _0x4b6443=_0x5b4245?_0x4bcc41['count']:_0x3be9ea[_0x0e42('0x20')]+_0x3be9ea[_0x0e42('0x21')];var _0x3cf82e;if(_0x4b6443>=_0x138b41){_0x4b6443=_0x138b41;_0x3cf82e=0xc8;}else{_0x3cf82e=0xce;}_0x3ec2c8[_0x0e42('0x1b')](_0x3cf82e);return _0x3ec2c8[_0x0e42('0x22')](_0x0e42('0x23'),_0x2d0b2e+'-'+_0x4b6443+'/'+_0x138b41)['json'](_0x4bcc41);}return null;};}function patchUpdates(_0x59f1cb){return function(_0x2038ff){try{jsonpatch[_0x0e42('0x24')](_0x2038ff,_0x59f1cb,!![]);}catch(_0x349151){return BPromise[_0x0e42('0x25')](_0x349151);}return _0x2038ff[_0x0e42('0x26')]();};}function saveUpdates(_0x1ffbae,_0x35a8de){return function(_0x1e1464){if(_0x1e1464){return _0x1e1464[_0x0e42('0x27')](_0x1ffbae)[_0x0e42('0x28')](function(_0x219dbe){return _0x219dbe;});}return null;};}function removeEntity(_0x553a80,_0x5468e9){return function(_0x3e051b){if(_0x3e051b){return _0x3e051b['destroy']()[_0x0e42('0x28')](function(){var _0x2fb5c8=_0x3e051b[_0x0e42('0x29')]({'plain':!![]});var _0x11e9c6=_0x0e42('0x2a');return db['UserProfileResource'][_0x0e42('0x2b')]({'where':{'type':_0x11e9c6,'resourceId':_0x2fb5c8['id']}})[_0x0e42('0x28')](function(){return _0x3e051b;});})['then'](function(){_0x553a80[_0x0e42('0x1b')](0xcc)[_0x0e42('0x1c')]();});}};}function handleEntityNotFound(_0x15e1e3,_0x372ba4){return function(_0x5d734e){if(!_0x5d734e){_0x15e1e3[_0x0e42('0x1a')](0x194);}return _0x5d734e;};}function handleError(_0x3e7acf,_0x2504bb){_0x2504bb=_0x2504bb||0x1f4;return function(_0x26f356){logger[_0x0e42('0x2c')](_0x26f356['stack']);if(_0x26f356['name']){delete _0x26f356[_0x0e42('0x2d')];}_0x3e7acf[_0x0e42('0x1b')](_0x2504bb)[_0x0e42('0x2e')](_0x26f356);};}exports[_0x0e42('0x2f')]=function(_0x2622ba,_0x51816e){var _0x22d459={},_0x2adcbb={},_0x4f47db={'count':0x0,'rows':[]};var _0x30f8c9=_['map'](db[_0x0e42('0x30')][_0x0e42('0x31')],function(_0x560b37){return{'name':_0x560b37[_0x0e42('0x32')],'type':_0x560b37[_0x0e42('0x33')][_0x0e42('0x34')]};});_0x2adcbb['model']=_['map'](_0x30f8c9,_0x0e42('0x2d'));_0x2adcbb[_0x0e42('0x35')]=_[_0x0e42('0x36')](_0x2622ba['query']);_0x2adcbb[_0x0e42('0x37')]=_[_0x0e42('0x38')](_0x2adcbb[_0x0e42('0x39')],_0x2adcbb['query']);_0x22d459['attributes']=_[_0x0e42('0x38')](_0x2adcbb[_0x0e42('0x39')],qs[_0x0e42('0x3a')](_0x2622ba[_0x0e42('0x35')]['fields']));_0x22d459[_0x0e42('0x3b')]=_0x22d459[_0x0e42('0x3b')][_0x0e42('0x3c')]?_0x22d459[_0x0e42('0x3b')]:_0x2adcbb['model'];if(!_0x2622ba[_0x0e42('0x35')][_0x0e42('0x3d')](_0x0e42('0x3e'))){_0x22d459['limit']=qs[_0x0e42('0x21')](_0x2622ba[_0x0e42('0x35')]['limit']);_0x22d459[_0x0e42('0x20')]=qs[_0x0e42('0x20')](_0x2622ba[_0x0e42('0x35')][_0x0e42('0x20')]);}_0x22d459[_0x0e42('0x3f')]=qs[_0x0e42('0x40')](_0x2622ba[_0x0e42('0x35')][_0x0e42('0x40')]);_0x22d459[_0x0e42('0x41')]=qs[_0x0e42('0x37')](_[_0x0e42('0x42')](_0x2622ba['query'],_0x2adcbb['filters']),_0x30f8c9);if(_0x2622ba[_0x0e42('0x35')][_0x0e42('0x43')]){_0x22d459['where']=_[_0x0e42('0x44')](_0x22d459[_0x0e42('0x41')],{'$or':[{'key':{'$like':'%'+_0x2622ba[_0x0e42('0x35')][_0x0e42('0x43')]+'%'}},{'value':{'$like':'%'+_0x2622ba['query']['filter']+'%'}}]});}_0x22d459=_[_0x0e42('0x44')]({},_0x22d459,_0x2622ba[_0x0e42('0x45')]);var _0x195516={'where':_0x22d459[_0x0e42('0x41')]};return db[_0x0e42('0x30')][_0x0e42('0x1f')](_0x195516)['then'](function(_0x24e817){_0x4f47db[_0x0e42('0x1f')]=_0x24e817;if(_0x2622ba[_0x0e42('0x35')][_0x0e42('0x46')]){_0x22d459[_0x0e42('0x47')]=[{'all':!![]}];}return db[_0x0e42('0x30')][_0x0e42('0x48')](_0x22d459);})['then'](function(_0x13db90){_0x4f47db[_0x0e42('0x49')]=_0x13db90;return _0x4f47db;})[_0x0e42('0x28')](respondWithFilteredResult(_0x51816e,_0x22d459))['catch'](handleError(_0x51816e,null));};exports[_0x0e42('0x4a')]=function(_0x53bc3c,_0x474f20){var _0x455ec7={'raw':!![],'where':{'id':_0x53bc3c['params']['id']}},_0x39afa0={};_0x39afa0['model']=_[_0x0e42('0x36')](db[_0x0e42('0x30')][_0x0e42('0x31')]);_0x39afa0['query']=_[_0x0e42('0x36')](_0x53bc3c[_0x0e42('0x35')]);_0x39afa0[_0x0e42('0x37')]=_[_0x0e42('0x38')](_0x39afa0[_0x0e42('0x39')],_0x39afa0[_0x0e42('0x35')]);_0x455ec7['attributes']=_['intersection'](_0x39afa0[_0x0e42('0x39')],qs[_0x0e42('0x3a')](_0x53bc3c[_0x0e42('0x35')][_0x0e42('0x3a')]));_0x455ec7[_0x0e42('0x3b')]=_0x455ec7[_0x0e42('0x3b')][_0x0e42('0x3c')]?_0x455ec7[_0x0e42('0x3b')]:_0x39afa0[_0x0e42('0x39')];if(_0x53bc3c[_0x0e42('0x35')]['includeAll']){_0x455ec7[_0x0e42('0x47')]=[{'all':!![]}];}_0x455ec7=_[_0x0e42('0x44')]({},_0x455ec7,_0x53bc3c['options']);return db[_0x0e42('0x30')]['find'](_0x455ec7)[_0x0e42('0x28')](handleEntityNotFound(_0x474f20,null))[_0x0e42('0x28')](respondWithResult(_0x474f20,null))[_0x0e42('0x4b')](handleError(_0x474f20,null));};exports[_0x0e42('0x27')]=function(_0xefad3e,_0x3f2727){if(_0xefad3e[_0x0e42('0x4c')]['id']){delete _0xefad3e[_0x0e42('0x4c')]['id'];}return db[_0x0e42('0x30')][_0x0e42('0x4d')]({'where':{'id':_0xefad3e['params']['id']}})[_0x0e42('0x28')](handleEntityNotFound(_0x3f2727,null))['then'](saveUpdates(_0xefad3e['body'],null))['then'](respondWithResult(_0x3f2727,null))[_0x0e42('0x4b')](handleError(_0x3f2727,null));};exports['destroy']=function(_0x38e31f,_0x58a5c3){return db['CannedAnswer']['find']({'where':{'id':_0x38e31f[_0x0e42('0x4e')]['id']}})[_0x0e42('0x28')](handleEntityNotFound(_0x58a5c3,null))[_0x0e42('0x28')](removeEntity(_0x58a5c3,null))[_0x0e42('0x4b')](handleError(_0x58a5c3,null));};exports[_0x0e42('0x4f')]=function(_0x5579dc,_0x361aae){var _0x3ea812={'key':_0x5579dc['body'][_0x0e42('0x34')]};if(_0x5579dc['body'][_0x0e42('0x50')]){_0x3ea812[_0x0e42('0x50')]=_0x5579dc[_0x0e42('0x4c')][_0x0e42('0x50')];}else if(_0x5579dc['body']['SmsAccountId']){_0x3ea812[_0x0e42('0x51')]=_0x5579dc[_0x0e42('0x4c')][_0x0e42('0x51')];}else if(_0x5579dc[_0x0e42('0x4c')][_0x0e42('0x52')]){_0x3ea812[_0x0e42('0x52')]=_0x5579dc['body'][_0x0e42('0x52')];}else if(_0x5579dc[_0x0e42('0x4c')][_0x0e42('0x53')]){_0x3ea812[_0x0e42('0x53')]=_0x5579dc['body'][_0x0e42('0x53')];}return db[_0x0e42('0x30')][_0x0e42('0x4d')]({'where':_0x3ea812})[_0x0e42('0x28')](function(_0x473315){if(_0x473315){throw new db['Sequelize'][(_0x0e42('0x54'))](_0x0e42('0x55'));}return db[_0x0e42('0x30')]['create'](_0x5579dc['body']);})[_0x0e42('0x28')](function(_0x5e9c78){var _0x5a67a2=_0x5579dc[_0x0e42('0x56')][_0x0e42('0x29')]({'plain':!![]});if(!_0x5a67a2)throw new Error(_0x0e42('0x57'));if(_0x5a67a2[_0x0e42('0x58')]===_0x0e42('0x56')){var _0x231255=_0x5e9c78['get']({'plain':!![]});return db[_0x0e42('0x59')][_0x0e42('0x4d')]({'where':{'name':_0x0e42('0x2a'),'userProfileId':_0x5a67a2['userProfileId']},'raw':!![]})[_0x0e42('0x28')](function(_0x5eeced){if(_0x5eeced&&_0x5eeced[_0x0e42('0x5a')]===0x0){return db[_0x0e42('0x5b')][_0x0e42('0x4f')]({'name':_0x231255[_0x0e42('0x2d')],'resourceId':_0x231255['id'],'type':_0x5eeced[_0x0e42('0x2d')],'sectionId':_0x5eeced['id']},{})[_0x0e42('0x28')](function(){return _0x5e9c78;});}else{return _0x5e9c78;}})['catch'](function(_0x32186c){logger[_0x0e42('0x2c')](_0x0e42('0x5c'),_0x32186c);throw _0x32186c;});}return _0x5e9c78;})[_0x0e42('0x28')](respondWithResult(_0x361aae,0xc9))[_0x0e42('0x4b')](handleError(_0x361aae,null));}; \ No newline at end of file +var _0x246b=['query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','CannedAnswer','includeAll','include','findAll','rows','catch','show','keys','length','find','body','params','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','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/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','get','CannedAnswers','then','error','name','send','index','fieldName','key','model'];(function(_0x3b4c8f,_0xa8bb0c){var _0x4a580f=function(_0x137d62){while(--_0x137d62){_0x3b4c8f['push'](_0x3b4c8f['shift']());}};_0x4a580f(++_0xa8bb0c);}(_0x246b,0x88));var _0xb246=function(_0x1fb3de,_0x175d08){_0x1fb3de=_0x1fb3de-0x0;var _0x2769d9=_0x246b[_0x1fb3de];return _0x2769d9;};'use strict';var emlformat=require(_0xb246('0x0'));var rimraf=require(_0xb246('0x1'));var zipdir=require(_0xb246('0x2'));var jsonpatch=require(_0xb246('0x3'));var rp=require(_0xb246('0x4'));var moment=require('moment');var BPromise=require(_0xb246('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xb246('0x6'));var sox=require(_0xb246('0x7'));var csv=require('to-csv');var ejs=require(_0xb246('0x8'));var fs=require('fs');var fs_extra=require(_0xb246('0x9'));var _=require(_0xb246('0xa'));var squel=require(_0xb246('0xb'));var crypto=require(_0xb246('0xc'));var jsforce=require(_0xb246('0xd'));var deskjs=require(_0xb246('0xe'));var toCsv=require(_0xb246('0xf'));var querystring=require(_0xb246('0x10'));var Papa=require(_0xb246('0x11'));var Redis=require(_0xb246('0x12'));var authService=require(_0xb246('0x13'));var qs=require(_0xb246('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb246('0x15'));var logger=require(_0xb246('0x16'))(_0xb246('0x17'));var utils=require(_0xb246('0x18'));var config=require(_0xb246('0x19'));var licenseUtil=require(_0xb246('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5cc60a,_0x174e98){_0x174e98=_0x174e98||0xcc;return function(_0x2597f3){if(_0x2597f3){return _0x5cc60a[_0xb246('0x1b')](_0x174e98);}return _0x5cc60a[_0xb246('0x1c')](_0x174e98)[_0xb246('0x1d')]();};}function respondWithResult(_0x26370e,_0x3d0184){_0x3d0184=_0x3d0184||0xc8;return function(_0x18de52){if(_0x18de52){return _0x26370e[_0xb246('0x1c')](_0x3d0184)[_0xb246('0x1e')](_0x18de52);}};}function respondWithFilteredResult(_0x3d865c,_0x32ff18){return function(_0xd7a294){if(_0xd7a294){var _0x479e02=typeof _0x32ff18[_0xb246('0x1f')]===_0xb246('0x20')&&typeof _0x32ff18[_0xb246('0x21')]==='undefined';var _0x31bfc6=_0xd7a294['count'];var _0x44c33d=_0x479e02?0x0:_0x32ff18[_0xb246('0x1f')];var _0x5c8ec8=_0x479e02?_0xd7a294[_0xb246('0x22')]:_0x32ff18['offset']+_0x32ff18[_0xb246('0x21')];var _0x4081a1;if(_0x5c8ec8>=_0x31bfc6){_0x5c8ec8=_0x31bfc6;_0x4081a1=0xc8;}else{_0x4081a1=0xce;}_0x3d865c['status'](_0x4081a1);return _0x3d865c[_0xb246('0x23')](_0xb246('0x24'),_0x44c33d+'-'+_0x5c8ec8+'/'+_0x31bfc6)['json'](_0xd7a294);}return null;};}function patchUpdates(_0x4d392f){return function(_0x507074){try{jsonpatch[_0xb246('0x25')](_0x507074,_0x4d392f,!![]);}catch(_0x1511af){return BPromise[_0xb246('0x26')](_0x1511af);}return _0x507074[_0xb246('0x27')]();};}function saveUpdates(_0x2d73b,_0x401928){return function(_0x280a71){if(_0x280a71){return _0x280a71[_0xb246('0x28')](_0x2d73b)['then'](function(_0x3ef9cb){return _0x3ef9cb;});}return null;};}function removeEntity(_0x442f75,_0x14de86){return function(_0x2d8c15){if(_0x2d8c15){return _0x2d8c15[_0xb246('0x29')]()['then'](function(){var _0x2eb348=_0x2d8c15[_0xb246('0x2a')]({'plain':!![]});var _0x57d96d=_0xb246('0x2b');return db['UserProfileResource'][_0xb246('0x29')]({'where':{'type':_0x57d96d,'resourceId':_0x2eb348['id']}})[_0xb246('0x2c')](function(){return _0x2d8c15;});})[_0xb246('0x2c')](function(){_0x442f75['status'](0xcc)[_0xb246('0x1d')]();});}};}function handleEntityNotFound(_0x5bb0ad,_0x1bee28){return function(_0x5603f5){if(!_0x5603f5){_0x5bb0ad[_0xb246('0x1b')](0x194);}return _0x5603f5;};}function handleError(_0x4d862b,_0x4533be){_0x4533be=_0x4533be||0x1f4;return function(_0x1f3970){logger[_0xb246('0x2d')](_0x1f3970['stack']);if(_0x1f3970[_0xb246('0x2e')]){delete _0x1f3970[_0xb246('0x2e')];}_0x4d862b[_0xb246('0x1c')](_0x4533be)[_0xb246('0x2f')](_0x1f3970);};}exports[_0xb246('0x30')]=function(_0x38fe7b,_0x54ba28){var _0x5666de={},_0x30bffb={},_0x40d1b7={'count':0x0,'rows':[]};var _0x33e030=_['map'](db['CannedAnswer']['rawAttributes'],function(_0x5ddaca){return{'name':_0x5ddaca[_0xb246('0x31')],'type':_0x5ddaca['type'][_0xb246('0x32')]};});_0x30bffb[_0xb246('0x33')]=_['map'](_0x33e030,'name');_0x30bffb[_0xb246('0x34')]=_['keys'](_0x38fe7b['query']);_0x30bffb[_0xb246('0x35')]=_[_0xb246('0x36')](_0x30bffb[_0xb246('0x33')],_0x30bffb['query']);_0x5666de[_0xb246('0x37')]=_[_0xb246('0x36')](_0x30bffb[_0xb246('0x33')],qs['fields'](_0x38fe7b['query'][_0xb246('0x38')]));_0x5666de['attributes']=_0x5666de[_0xb246('0x37')]['length']?_0x5666de['attributes']:_0x30bffb['model'];if(!_0x38fe7b[_0xb246('0x34')][_0xb246('0x39')](_0xb246('0x3a'))){_0x5666de['limit']=qs[_0xb246('0x21')](_0x38fe7b[_0xb246('0x34')][_0xb246('0x21')]);_0x5666de['offset']=qs[_0xb246('0x1f')](_0x38fe7b[_0xb246('0x34')][_0xb246('0x1f')]);}_0x5666de[_0xb246('0x3b')]=qs['sort'](_0x38fe7b[_0xb246('0x34')][_0xb246('0x3c')]);_0x5666de[_0xb246('0x3d')]=qs[_0xb246('0x35')](_[_0xb246('0x3e')](_0x38fe7b[_0xb246('0x34')],_0x30bffb[_0xb246('0x35')]),_0x33e030);if(_0x38fe7b['query'][_0xb246('0x3f')]){_0x5666de[_0xb246('0x3d')]=_[_0xb246('0x40')](_0x5666de[_0xb246('0x3d')],{'$or':[{'key':{'$like':'%'+_0x38fe7b[_0xb246('0x34')][_0xb246('0x3f')]+'%'}},{'value':{'$like':'%'+_0x38fe7b[_0xb246('0x34')][_0xb246('0x3f')]+'%'}}]});}_0x5666de=_[_0xb246('0x40')]({},_0x5666de,_0x38fe7b[_0xb246('0x41')]);var _0x894c27={'where':_0x5666de[_0xb246('0x3d')]};return db[_0xb246('0x42')][_0xb246('0x22')](_0x894c27)[_0xb246('0x2c')](function(_0x53f6f3){_0x40d1b7[_0xb246('0x22')]=_0x53f6f3;if(_0x38fe7b[_0xb246('0x34')][_0xb246('0x43')]){_0x5666de[_0xb246('0x44')]=[{'all':!![]}];}return db[_0xb246('0x42')][_0xb246('0x45')](_0x5666de);})[_0xb246('0x2c')](function(_0x35eb3a){_0x40d1b7[_0xb246('0x46')]=_0x35eb3a;return _0x40d1b7;})[_0xb246('0x2c')](respondWithFilteredResult(_0x54ba28,_0x5666de))[_0xb246('0x47')](handleError(_0x54ba28,null));};exports[_0xb246('0x48')]=function(_0x29fdb0,_0x5bb20b){var _0x225cc4={'raw':!![],'where':{'id':_0x29fdb0['params']['id']}},_0x3d93b5={};_0x3d93b5[_0xb246('0x33')]=_[_0xb246('0x49')](db[_0xb246('0x42')]['rawAttributes']);_0x3d93b5['query']=_[_0xb246('0x49')](_0x29fdb0['query']);_0x3d93b5['filters']=_[_0xb246('0x36')](_0x3d93b5[_0xb246('0x33')],_0x3d93b5[_0xb246('0x34')]);_0x225cc4[_0xb246('0x37')]=_[_0xb246('0x36')](_0x3d93b5['model'],qs[_0xb246('0x38')](_0x29fdb0[_0xb246('0x34')][_0xb246('0x38')]));_0x225cc4['attributes']=_0x225cc4[_0xb246('0x37')][_0xb246('0x4a')]?_0x225cc4[_0xb246('0x37')]:_0x3d93b5[_0xb246('0x33')];if(_0x29fdb0[_0xb246('0x34')][_0xb246('0x43')]){_0x225cc4[_0xb246('0x44')]=[{'all':!![]}];}_0x225cc4=_[_0xb246('0x40')]({},_0x225cc4,_0x29fdb0[_0xb246('0x41')]);return db['CannedAnswer'][_0xb246('0x4b')](_0x225cc4)[_0xb246('0x2c')](handleEntityNotFound(_0x5bb20b,null))[_0xb246('0x2c')](respondWithResult(_0x5bb20b,null))['catch'](handleError(_0x5bb20b,null));};exports[_0xb246('0x28')]=function(_0x4edfe1,_0x2139d0){if(_0x4edfe1[_0xb246('0x4c')]['id']){delete _0x4edfe1['body']['id'];}return db[_0xb246('0x42')][_0xb246('0x4b')]({'where':{'id':_0x4edfe1[_0xb246('0x4d')]['id']}})[_0xb246('0x2c')](handleEntityNotFound(_0x2139d0,null))[_0xb246('0x2c')](saveUpdates(_0x4edfe1[_0xb246('0x4c')],null))[_0xb246('0x2c')](respondWithResult(_0x2139d0,null))[_0xb246('0x47')](handleError(_0x2139d0,null));};exports[_0xb246('0x29')]=function(_0x3727f7,_0x2042ac){return db[_0xb246('0x42')]['find']({'where':{'id':_0x3727f7[_0xb246('0x4d')]['id']}})[_0xb246('0x2c')](handleEntityNotFound(_0x2042ac,null))[_0xb246('0x2c')](removeEntity(_0x2042ac,null))[_0xb246('0x47')](handleError(_0x2042ac,null));};exports[_0xb246('0x4e')]=function(_0x464ffe,_0x452b14){var _0x434a5a={'key':_0x464ffe[_0xb246('0x4c')][_0xb246('0x32')]};if(_0x464ffe[_0xb246('0x4c')][_0xb246('0x4f')]){_0x434a5a[_0xb246('0x4f')]=_0x464ffe[_0xb246('0x4c')][_0xb246('0x4f')];}else if(_0x464ffe[_0xb246('0x4c')][_0xb246('0x50')]){_0x434a5a[_0xb246('0x50')]=_0x464ffe[_0xb246('0x4c')][_0xb246('0x50')];}else if(_0x464ffe[_0xb246('0x4c')][_0xb246('0x51')]){_0x434a5a[_0xb246('0x51')]=_0x464ffe[_0xb246('0x4c')][_0xb246('0x51')];}else if(_0x464ffe[_0xb246('0x4c')][_0xb246('0x52')]){_0x434a5a['ChatWebsiteId']=_0x464ffe[_0xb246('0x4c')][_0xb246('0x52')];}return db[_0xb246('0x42')]['find']({'where':_0x434a5a})[_0xb246('0x2c')](function(_0x4492cb){if(_0x4492cb){throw new db[(_0xb246('0x53'))][(_0xb246('0x54'))](_0xb246('0x55'));}return db[_0xb246('0x42')][_0xb246('0x4e')](_0x464ffe[_0xb246('0x4c')]);})[_0xb246('0x2c')](function(_0x43be5c){var _0x51188c=_0x464ffe[_0xb246('0x56')]['get']({'plain':!![]});if(!_0x51188c)throw new Error(_0xb246('0x57'));if(_0x51188c[_0xb246('0x58')]===_0xb246('0x56')){var _0x43ddc2=_0x43be5c[_0xb246('0x2a')]({'plain':!![]});return db[_0xb246('0x59')][_0xb246('0x4b')]({'where':{'name':'CannedAnswers','userProfileId':_0x51188c[_0xb246('0x5a')]},'raw':!![]})[_0xb246('0x2c')](function(_0x5d67f9){if(_0x5d67f9&&_0x5d67f9[_0xb246('0x5b')]===0x0){return db[_0xb246('0x5c')][_0xb246('0x4e')]({'name':_0x43ddc2['name'],'resourceId':_0x43ddc2['id'],'type':_0x5d67f9[_0xb246('0x2e')],'sectionId':_0x5d67f9['id']},{})[_0xb246('0x2c')](function(){return _0x43be5c;});}else{return _0x43be5c;}})[_0xb246('0x47')](function(_0x533186){logger[_0xb246('0x2d')](_0xb246('0x5d'),_0x533186);throw _0x533186;});}return _0x43be5c;})[_0xb246('0x2c')](respondWithResult(_0x452b14,0xc9))[_0xb246('0x47')](handleError(_0x452b14,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index ee4c56b..21b7505 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 _0x6599=['bluebird','path','../../config/environment','exports','tools_canned_answers','utf8mb4','util','../../config/logger','api','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6599,0xb0));var _0x9659=function(_0x996bc8,_0x291e01){_0x996bc8=_0x996bc8-0x0;var _0x20b0ea=_0x6599[_0x996bc8];return _0x20b0ea;};'use strict';var _=require('lodash');var util=require(_0x9659('0x0'));var logger=require(_0x9659('0x1'))(_0x9659('0x2'));var moment=require(_0x9659('0x3'));var BPromise=require(_0x9659('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9659('0x5'));var rimraf=require('rimraf');var config=require(_0x9659('0x6'));var attributes=require('./cannedAnswer.attributes');module[_0x9659('0x7')]=function(_0xb08ede,_0x159ac2){return _0xb08ede['define']('CannedAnswer',attributes,{'tableName':_0x9659('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x9659('0x9'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x987f=['utf8mb4_unicode_ci','lodash','../../config/logger','api','request-promise','path','../../config/environment','define','tools_canned_answers','utf8mb4'];(function(_0x2d4421,_0x15a84f){var _0x2d3b01=function(_0xb9e94c){while(--_0xb9e94c){_0x2d4421['push'](_0x2d4421['shift']());}};_0x2d3b01(++_0x15a84f);}(_0x987f,0x169));var _0xf987=function(_0x3ec122,_0x55150a){_0x3ec122=_0x3ec122-0x0;var _0x4ecf41=_0x987f[_0x3ec122];return _0x4ecf41;};'use strict';var _=require(_0xf987('0x0'));var util=require('util');var logger=require(_0xf987('0x1'))(_0xf987('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf987('0x3'));var fs=require('fs');var path=require(_0xf987('0x4'));var rimraf=require('rimraf');var config=require(_0xf987('0x5'));var attributes=require('./cannedAnswer.attributes');module['exports']=function(_0x4765dd,_0xc48d78){return _0x4765dd[_0xf987('0x6')]('CannedAnswer',attributes,{'tableName':_0xf987('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf987('0x8'),'collate':_0xf987('0x9')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 96cdf72..eee6dd0 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(_0x31bc64,_0x315baa){var _0x312095=function(_0x3f14af){while(--_0x3f14af){_0x31bc64['push'](_0x31bc64['shift']());}};_0x312095(++_0x315baa);}(_0xa9e0,0x123));var _0x0a9e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa9e0[_0x30ae5e];return _0x1f2e93;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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(_0x2bed02,_0x45ac1a){var _0x471c08=function(_0x5f0fe1){while(--_0x5f0fe1){_0x2bed02['push'](_0x2bed02['shift']());}};_0x471c08(++_0x45ac1a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0xa9e0[_0x1cfa0d];return _0xe33279;};'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 669d393..7ceca76 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 _0xdeba=['./cannedAnswer.controller','get','isAuthenticated','index','/:id','show','put','update','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0xe456dc,_0x5662de){var _0x304d45=function(_0x68f858){while(--_0x68f858){_0xe456dc['push'](_0xe456dc['shift']());}};_0x304d45(++_0x5662de);}(_0xdeba,0x171));var _0xadeb=function(_0x10afb8,_0x167b07){_0x10afb8=_0x10afb8-0x0;var _0xdb4d6a=_0xdeba[_0x10afb8];return _0xdb4d6a;};'use strict';var multer=require(_0xadeb('0x0'));var util=require(_0xadeb('0x1'));var path=require(_0xadeb('0x2'));var timeout=require(_0xadeb('0x3'));var express=require(_0xadeb('0x4'));var router=express[_0xadeb('0x5')]();var fs_extra=require(_0xadeb('0x6'));var auth=require(_0xadeb('0x7'));var interaction=require(_0xadeb('0x8'));var config=require('../../config/environment');var controller=require(_0xadeb('0x9'));router[_0xadeb('0xa')]('/',auth[_0xadeb('0xb')](),controller[_0xadeb('0xc')]);router['get'](_0xadeb('0xd'),auth[_0xadeb('0xb')](),controller[_0xadeb('0xe')]);router['post']('/',auth[_0xadeb('0xb')](),controller['create']);router[_0xadeb('0xf')](_0xadeb('0xd'),auth[_0xadeb('0xb')](),controller[_0xadeb('0x10')]);router['delete'](_0xadeb('0xd'),auth[_0xadeb('0xb')](),controller[_0xadeb('0x11')]);module['exports']=router; \ No newline at end of file +var _0xa81d=['exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./cannedAnswer.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy'];(function(_0x44db7c,_0x5d9498){var _0x1dbd04=function(_0x1efecb){while(--_0x1efecb){_0x44db7c['push'](_0x44db7c['shift']());}};_0x1dbd04(++_0x5d9498);}(_0xa81d,0x65));var _0xda81=function(_0x38a162,_0x4396b2){_0x38a162=_0x38a162-0x0;var _0x1f622b=_0xa81d[_0x38a162];return _0x1f622b;};'use strict';var multer=require(_0xda81('0x0'));var util=require(_0xda81('0x1'));var path=require(_0xda81('0x2'));var timeout=require(_0xda81('0x3'));var express=require(_0xda81('0x4'));var router=express['Router']();var fs_extra=require(_0xda81('0x5'));var auth=require(_0xda81('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xda81('0x7'));var controller=require(_0xda81('0x8'));router[_0xda81('0x9')]('/',auth[_0xda81('0xa')](),controller[_0xda81('0xb')]);router[_0xda81('0x9')](_0xda81('0xc'),auth[_0xda81('0xa')](),controller[_0xda81('0xd')]);router[_0xda81('0xe')]('/',auth[_0xda81('0xa')](),controller[_0xda81('0xf')]);router['put'](_0xda81('0xc'),auth[_0xda81('0xa')](),controller[_0xda81('0x10')]);router[_0xda81('0x11')](_0xda81('0xc'),auth[_0xda81('0xa')](),controller[_0xda81('0x12')]);module[_0xda81('0x13')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 3164730..2564466 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 _0xf78d=['exports','DATE','1970-01-01\x2000:00:01','STRING','INTEGER'];(function(_0x2a6ac9,_0x1da3cd){var _0x332cc2=function(_0xdacd78){while(--_0xdacd78){_0x2a6ac9['push'](_0x2a6ac9['shift']());}};_0x332cc2(++_0x1da3cd);}(_0xf78d,0x1c7));var _0xdf78=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf78d[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0xdf78('0x0')]={'calldate':{'type':Sequelize[_0xdf78('0x1')],'allowNull':![],'defaultValue':_0xdf78('0x2')},'clid':{'type':Sequelize[_0xdf78('0x3')]},'src':{'type':Sequelize[_0xdf78('0x3')]},'dst':{'type':Sequelize[_0xdf78('0x3')]},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'dstchannel':{'type':Sequelize[_0xdf78('0x3')]},'lastapp':{'type':Sequelize[_0xdf78('0x3')]},'lastdata':{'type':Sequelize[_0xdf78('0x3')]},'duration':{'type':Sequelize[_0xdf78('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xdf78('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xdf78('0x3')]},'amaflags':{'type':Sequelize[_0xdf78('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xdf78('0x3')]},'linkedid':{'type':Sequelize[_0xdf78('0x3')]},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize[_0xdf78('0x3')]},'type':{'type':Sequelize[_0xdf78('0x3')]},'tag':{'type':Sequelize[_0xdf78('0x3')]}}; \ No newline at end of file +var _0x3294=['INTEGER','1970-01-01\x2000:00:01','STRING'];(function(_0x52802a,_0x108434){var _0x35f54e=function(_0x17be04){while(--_0x17be04){_0x52802a['push'](_0x52802a['shift']());}};_0x35f54e(++_0x108434);}(_0x3294,0x1db));var _0x4329=function(_0x1ca701,_0x3360ae){_0x1ca701=_0x1ca701-0x0;var _0x1bf070=_0x3294[_0x1ca701];return _0x1bf070;};'use strict';var Sequelize=require('sequelize');module['exports']={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':_0x4329('0x0')},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize[_0x4329('0x1')]},'dst':{'type':Sequelize[_0x4329('0x1')]},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x4329('0x1')]},'dstchannel':{'type':Sequelize[_0x4329('0x1')]},'lastapp':{'type':Sequelize[_0x4329('0x1')]},'lastdata':{'type':Sequelize[_0x4329('0x1')]},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x4329('0x2')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0x4329('0x1')]},'uniqueid':{'type':Sequelize[_0x4329('0x1')]},'linkedid':{'type':Sequelize[_0x4329('0x1')]},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize[_0x4329('0x1')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 64155f8..b830150 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 _0xcd59=['includeAll','include','findAll','rows','catch','show','params','keys','intersection','options','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','error','name','index','map','Cdr','rawAttributes','fieldName','type','key','model','query','filters','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL'];(function(_0x2db82d,_0x2576f7){var _0x424948=function(_0x20d583){while(--_0x20d583){_0x2db82d['push'](_0x2db82d['shift']());}};_0x424948(++_0x2576f7);}(_0xcd59,0x14b));var _0x9cd5=function(_0x919445,_0x5467dc){_0x919445=_0x919445-0x0;var _0x511b3e=_0xcd59[_0x919445];return _0x511b3e;};'use strict';var emlformat=require(_0x9cd5('0x0'));var rimraf=require(_0x9cd5('0x1'));var zipdir=require(_0x9cd5('0x2'));var jsonpatch=require(_0x9cd5('0x3'));var rp=require(_0x9cd5('0x4'));var moment=require(_0x9cd5('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x9cd5('0x6'));var util=require(_0x9cd5('0x7'));var path=require(_0x9cd5('0x8'));var sox=require(_0x9cd5('0x9'));var csv=require(_0x9cd5('0xa'));var ejs=require(_0x9cd5('0xb'));var fs=require('fs');var fs_extra=require(_0x9cd5('0xc'));var _=require(_0x9cd5('0xd'));var squel=require(_0x9cd5('0xe'));var crypto=require(_0x9cd5('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x9cd5('0x10'));var toCsv=require(_0x9cd5('0xa'));var querystring=require(_0x9cd5('0x11'));var Papa=require(_0x9cd5('0x12'));var Redis=require(_0x9cd5('0x13'));var authService=require(_0x9cd5('0x14'));var qs=require(_0x9cd5('0x15'));var as=require(_0x9cd5('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9cd5('0x17'))(_0x9cd5('0x18'));var utils=require(_0x9cd5('0x19'));var config=require(_0x9cd5('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2c9cf1,_0x172e29){_0x172e29=_0x172e29||0xcc;return function(_0x44518d){if(_0x44518d){return _0x2c9cf1[_0x9cd5('0x1b')](_0x172e29);}return _0x2c9cf1[_0x9cd5('0x1c')](_0x172e29)[_0x9cd5('0x1d')]();};}function respondWithResult(_0x52698b,_0x15b639){_0x15b639=_0x15b639||0xc8;return function(_0x1445c0){if(_0x1445c0){return _0x52698b[_0x9cd5('0x1c')](_0x15b639)['json'](_0x1445c0);}};}function respondWithFilteredResult(_0x541cb8,_0x5c4f3d){return function(_0x258305){if(_0x258305){var _0x1ea3f7=typeof _0x5c4f3d['offset']===_0x9cd5('0x1e')&&typeof _0x5c4f3d[_0x9cd5('0x1f')]===_0x9cd5('0x1e');var _0x57b986=_0x258305[_0x9cd5('0x20')];var _0x2d1863=_0x1ea3f7?0x0:_0x5c4f3d[_0x9cd5('0x21')];var _0x3a6f01=_0x1ea3f7?_0x258305[_0x9cd5('0x20')]:_0x5c4f3d[_0x9cd5('0x21')]+_0x5c4f3d['limit'];var _0x37ea13;if(_0x3a6f01>=_0x57b986){_0x3a6f01=_0x57b986;_0x37ea13=0xc8;}else{_0x37ea13=0xce;}_0x541cb8[_0x9cd5('0x1c')](_0x37ea13);return _0x541cb8[_0x9cd5('0x22')](_0x9cd5('0x23'),_0x2d1863+'-'+_0x3a6f01+'/'+_0x57b986)[_0x9cd5('0x24')](_0x258305);}return null;};}function patchUpdates(_0x4ed8b9){return function(_0x16c4e9){try{jsonpatch[_0x9cd5('0x25')](_0x16c4e9,_0x4ed8b9,!![]);}catch(_0x3f1f5c){return BPromise[_0x9cd5('0x26')](_0x3f1f5c);}return _0x16c4e9[_0x9cd5('0x27')]();};}function saveUpdates(_0x1185d7,_0x1cf603){return function(_0x2238ec){if(_0x2238ec){return _0x2238ec[_0x9cd5('0x28')](_0x1185d7)['then'](function(_0x297f0e){return _0x297f0e;});}return null;};}function removeEntity(_0xba8ee9,_0x1a88e3){return function(_0x43f47d){if(_0x43f47d){return _0x43f47d['destroy']()[_0x9cd5('0x29')](function(){_0xba8ee9[_0x9cd5('0x1c')](0xcc)[_0x9cd5('0x1d')]();});}};}function handleEntityNotFound(_0xe36f86,_0x297776){return function(_0x4509e7){if(!_0x4509e7){_0xe36f86[_0x9cd5('0x1b')](0x194);}return _0x4509e7;};}function handleError(_0x4a245f,_0x1dcb6f){_0x1dcb6f=_0x1dcb6f||0x1f4;return function(_0x64a1c4){logger[_0x9cd5('0x2a')](_0x64a1c4['stack']);if(_0x64a1c4['name']){delete _0x64a1c4[_0x9cd5('0x2b')];}_0x4a245f['status'](_0x1dcb6f)['send'](_0x64a1c4);};}exports[_0x9cd5('0x2c')]=function(_0x2a20d2,_0x13e0d3){var _0x5184b9={},_0x40461a={},_0xc0104b={'count':0x0,'rows':[]};var _0x27e1fd=_[_0x9cd5('0x2d')](db[_0x9cd5('0x2e')][_0x9cd5('0x2f')],function(_0x1dbddc){return{'name':_0x1dbddc[_0x9cd5('0x30')],'type':_0x1dbddc[_0x9cd5('0x31')][_0x9cd5('0x32')]};});_0x40461a[_0x9cd5('0x33')]=_[_0x9cd5('0x2d')](_0x27e1fd,_0x9cd5('0x2b'));_0x40461a[_0x9cd5('0x34')]=_['keys'](_0x2a20d2[_0x9cd5('0x34')]);_0x40461a[_0x9cd5('0x35')]=_['intersection'](_0x40461a['model'],_0x40461a[_0x9cd5('0x34')]);_0x5184b9[_0x9cd5('0x36')]=_['intersection'](_0x40461a[_0x9cd5('0x33')],qs['fields'](_0x2a20d2['query'][_0x9cd5('0x37')]));_0x5184b9[_0x9cd5('0x36')]=_0x5184b9[_0x9cd5('0x36')][_0x9cd5('0x38')]?_0x5184b9['attributes']:_0x40461a[_0x9cd5('0x33')];if(!_0x2a20d2[_0x9cd5('0x34')][_0x9cd5('0x39')]('nolimit')){_0x5184b9[_0x9cd5('0x1f')]=qs[_0x9cd5('0x1f')](_0x2a20d2[_0x9cd5('0x34')][_0x9cd5('0x1f')]);_0x5184b9[_0x9cd5('0x21')]=qs[_0x9cd5('0x21')](_0x2a20d2[_0x9cd5('0x34')][_0x9cd5('0x21')]);}_0x5184b9[_0x9cd5('0x3a')]=qs[_0x9cd5('0x3b')](_0x2a20d2[_0x9cd5('0x34')]['sort']);_0x5184b9[_0x9cd5('0x3c')]=qs['filters'](_['pick'](_0x2a20d2[_0x9cd5('0x34')],_0x40461a[_0x9cd5('0x35')]),_0x27e1fd);if(_0x2a20d2[_0x9cd5('0x34')][_0x9cd5('0x3d')]){_0x5184b9['where']=_[_0x9cd5('0x3e')](_0x5184b9[_0x9cd5('0x3c')],{'$or':_[_0x9cd5('0x2d')](_0x27e1fd,function(_0x458a6a){if(_0x458a6a['type']!==_0x9cd5('0x3f')){var _0x3f50de={};_0x3f50de[_0x458a6a[_0x9cd5('0x2b')]]={'$like':'%'+_0x2a20d2[_0x9cd5('0x34')][_0x9cd5('0x3d')]+'%'};return _0x3f50de;}})});}_0x5184b9=_[_0x9cd5('0x3e')]({},_0x5184b9,_0x2a20d2['options']);var _0x26cf61={'where':_0x5184b9[_0x9cd5('0x3c')]};return db[_0x9cd5('0x2e')][_0x9cd5('0x20')](_0x26cf61)[_0x9cd5('0x29')](function(_0x4182bd){_0xc0104b[_0x9cd5('0x20')]=_0x4182bd;if(_0x2a20d2[_0x9cd5('0x34')][_0x9cd5('0x40')]){_0x5184b9[_0x9cd5('0x41')]=[{'all':!![]}];}return db[_0x9cd5('0x2e')][_0x9cd5('0x42')](_0x5184b9);})[_0x9cd5('0x29')](function(_0xa12319){_0xc0104b[_0x9cd5('0x43')]=_0xa12319;return _0xc0104b;})[_0x9cd5('0x29')](respondWithFilteredResult(_0x13e0d3,_0x5184b9))[_0x9cd5('0x44')](handleError(_0x13e0d3,null));};exports[_0x9cd5('0x45')]=function(_0x4ba72c,_0x13d4b8){var _0x58ae2e={'raw':!![],'where':{'id':_0x4ba72c[_0x9cd5('0x46')]['id']}},_0x427d78={};_0x427d78[_0x9cd5('0x33')]=_[_0x9cd5('0x47')](db[_0x9cd5('0x2e')]['rawAttributes']);_0x427d78[_0x9cd5('0x34')]=_[_0x9cd5('0x47')](_0x4ba72c[_0x9cd5('0x34')]);_0x427d78['filters']=_[_0x9cd5('0x48')](_0x427d78[_0x9cd5('0x33')],_0x427d78[_0x9cd5('0x34')]);_0x58ae2e[_0x9cd5('0x36')]=_['intersection'](_0x427d78[_0x9cd5('0x33')],qs[_0x9cd5('0x37')](_0x4ba72c[_0x9cd5('0x34')][_0x9cd5('0x37')]));_0x58ae2e[_0x9cd5('0x36')]=_0x58ae2e[_0x9cd5('0x36')][_0x9cd5('0x38')]?_0x58ae2e[_0x9cd5('0x36')]:_0x427d78[_0x9cd5('0x33')];if(_0x4ba72c[_0x9cd5('0x34')][_0x9cd5('0x40')]){_0x58ae2e[_0x9cd5('0x41')]=[{'all':!![]}];}_0x58ae2e=_[_0x9cd5('0x3e')]({},_0x58ae2e,_0x4ba72c[_0x9cd5('0x49')]);return db[_0x9cd5('0x2e')][_0x9cd5('0x4a')](_0x58ae2e)[_0x9cd5('0x29')](handleEntityNotFound(_0x13d4b8,null))[_0x9cd5('0x29')](respondWithResult(_0x13d4b8,null))['catch'](handleError(_0x13d4b8,null));};exports[_0x9cd5('0x4b')]=function(_0x1c581a,_0x3fead7){return db[_0x9cd5('0x2e')]['create'](_0x1c581a[_0x9cd5('0x4c')],{})[_0x9cd5('0x29')](respondWithResult(_0x3fead7,0xc9))['catch'](handleError(_0x3fead7,null));};exports[_0x9cd5('0x28')]=function(_0x155652,_0x152b17){if(_0x155652[_0x9cd5('0x4c')]['id']){delete _0x155652[_0x9cd5('0x4c')]['id'];}return db[_0x9cd5('0x2e')][_0x9cd5('0x4a')]({'where':{'id':_0x155652[_0x9cd5('0x46')]['id']}})['then'](handleEntityNotFound(_0x152b17,null))['then'](saveUpdates(_0x155652[_0x9cd5('0x4c')],null))[_0x9cd5('0x29')](respondWithResult(_0x152b17,null))[_0x9cd5('0x44')](handleError(_0x152b17,null));};exports[_0x9cd5('0x4d')]=function(_0x5a933a,_0xf6e17b){return db['Cdr']['find']({'where':{'id':_0x5a933a[_0x9cd5('0x46')]['id']}})[_0x9cd5('0x29')](handleEntityNotFound(_0xf6e17b,null))[_0x9cd5('0x29')](removeEntity(_0xf6e17b,null))['catch'](handleError(_0xf6e17b,null));};exports[_0x9cd5('0x4e')]=function(_0x30c80f,_0x310e4a){return db[_0x9cd5('0x2e')][_0x9cd5('0x4e')]()[_0x9cd5('0x29')](respondWithResult(_0x310e4a,null))['catch'](handleError(_0x310e4a,null));}; \ No newline at end of file +var _0x25fa=['json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','Cdr','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','body','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x25fa,0x109));var _0xa25f=function(_0x3c5a5a,_0x4b2212){_0x3c5a5a=_0x3c5a5a-0x0;var _0x288b40=_0x25fa[_0x3c5a5a];return _0x288b40;};'use strict';var emlformat=require(_0xa25f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa25f('0x1'));var jsonpatch=require(_0xa25f('0x2'));var rp=require('request-promise');var moment=require(_0xa25f('0x3'));var BPromise=require(_0xa25f('0x4'));var Mustache=require(_0xa25f('0x5'));var util=require('util');var path=require('path');var sox=require(_0xa25f('0x6'));var csv=require('to-csv');var ejs=require(_0xa25f('0x7'));var fs=require('fs');var fs_extra=require(_0xa25f('0x8'));var _=require(_0xa25f('0x9'));var squel=require(_0xa25f('0xa'));var crypto=require(_0xa25f('0xb'));var jsforce=require(_0xa25f('0xc'));var deskjs=require(_0xa25f('0xd'));var toCsv=require(_0xa25f('0xe'));var querystring=require(_0xa25f('0xf'));var Papa=require('papaparse');var Redis=require(_0xa25f('0x10'));var authService=require(_0xa25f('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xa25f('0x12'));var hardwareService=require(_0xa25f('0x13'));var logger=require(_0xa25f('0x14'))(_0xa25f('0x15'));var utils=require('../../config/utils');var config=require(_0xa25f('0x16'));var licenseUtil=require(_0xa25f('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3e970c,_0x465e41){_0x465e41=_0x465e41||0xcc;return function(_0x50bb78){if(_0x50bb78){return _0x3e970c[_0xa25f('0x18')](_0x465e41);}return _0x3e970c[_0xa25f('0x19')](_0x465e41)[_0xa25f('0x1a')]();};}function respondWithResult(_0x4b3792,_0x199e18){_0x199e18=_0x199e18||0xc8;return function(_0x2a627f){if(_0x2a627f){return _0x4b3792[_0xa25f('0x19')](_0x199e18)[_0xa25f('0x1b')](_0x2a627f);}};}function respondWithFilteredResult(_0x465809,_0x2d2417){return function(_0x1e5836){if(_0x1e5836){var _0x1859ba=typeof _0x2d2417['offset']===_0xa25f('0x1c')&&typeof _0x2d2417[_0xa25f('0x1d')]===_0xa25f('0x1c');var _0x451a6e=_0x1e5836[_0xa25f('0x1e')];var _0x427105=_0x1859ba?0x0:_0x2d2417['offset'];var _0x292171=_0x1859ba?_0x1e5836['count']:_0x2d2417[_0xa25f('0x1f')]+_0x2d2417['limit'];var _0x559c89;if(_0x292171>=_0x451a6e){_0x292171=_0x451a6e;_0x559c89=0xc8;}else{_0x559c89=0xce;}_0x465809[_0xa25f('0x19')](_0x559c89);return _0x465809['set'](_0xa25f('0x20'),_0x427105+'-'+_0x292171+'/'+_0x451a6e)[_0xa25f('0x1b')](_0x1e5836);}return null;};}function patchUpdates(_0x2aaf3a){return function(_0x3c2665){try{jsonpatch[_0xa25f('0x21')](_0x3c2665,_0x2aaf3a,!![]);}catch(_0x504135){return BPromise[_0xa25f('0x22')](_0x504135);}return _0x3c2665[_0xa25f('0x23')]();};}function saveUpdates(_0x371716,_0x14b7f6){return function(_0x5d2803){if(_0x5d2803){return _0x5d2803[_0xa25f('0x24')](_0x371716)[_0xa25f('0x25')](function(_0x248c0c){return _0x248c0c;});}return null;};}function removeEntity(_0x3675b5,_0x4c6f4d){return function(_0x2b710f){if(_0x2b710f){return _0x2b710f[_0xa25f('0x26')]()[_0xa25f('0x25')](function(){_0x3675b5[_0xa25f('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2812d7,_0x898446){return function(_0x53f011){if(!_0x53f011){_0x2812d7[_0xa25f('0x18')](0x194);}return _0x53f011;};}function handleError(_0x51dbf8,_0x2df893){_0x2df893=_0x2df893||0x1f4;return function(_0x4eb7b7){logger[_0xa25f('0x27')](_0x4eb7b7[_0xa25f('0x28')]);if(_0x4eb7b7['name']){delete _0x4eb7b7[_0xa25f('0x29')];}_0x51dbf8[_0xa25f('0x19')](_0x2df893)['send'](_0x4eb7b7);};}exports[_0xa25f('0x2a')]=function(_0x5d39c7,_0x1030c4){var _0x41a847={},_0x472114={},_0x208518={'count':0x0,'rows':[]};var _0x334629=_['map'](db[_0xa25f('0x2b')][_0xa25f('0x2c')],function(_0x119ffc){return{'name':_0x119ffc[_0xa25f('0x2d')],'type':_0x119ffc[_0xa25f('0x2e')]['key']};});_0x472114[_0xa25f('0x2f')]=_[_0xa25f('0x30')](_0x334629,_0xa25f('0x29'));_0x472114[_0xa25f('0x31')]=_[_0xa25f('0x32')](_0x5d39c7[_0xa25f('0x31')]);_0x472114[_0xa25f('0x33')]=_[_0xa25f('0x34')](_0x472114[_0xa25f('0x2f')],_0x472114['query']);_0x41a847['attributes']=_['intersection'](_0x472114[_0xa25f('0x2f')],qs[_0xa25f('0x35')](_0x5d39c7[_0xa25f('0x31')][_0xa25f('0x35')]));_0x41a847[_0xa25f('0x36')]=_0x41a847[_0xa25f('0x36')][_0xa25f('0x37')]?_0x41a847[_0xa25f('0x36')]:_0x472114[_0xa25f('0x2f')];if(!_0x5d39c7[_0xa25f('0x31')][_0xa25f('0x38')]('nolimit')){_0x41a847['limit']=qs[_0xa25f('0x1d')](_0x5d39c7[_0xa25f('0x31')][_0xa25f('0x1d')]);_0x41a847['offset']=qs['offset'](_0x5d39c7['query'][_0xa25f('0x1f')]);}_0x41a847[_0xa25f('0x39')]=qs[_0xa25f('0x3a')](_0x5d39c7['query']['sort']);_0x41a847[_0xa25f('0x3b')]=qs[_0xa25f('0x33')](_['pick'](_0x5d39c7['query'],_0x472114[_0xa25f('0x33')]),_0x334629);if(_0x5d39c7[_0xa25f('0x31')][_0xa25f('0x3c')]){_0x41a847['where']=_[_0xa25f('0x3d')](_0x41a847[_0xa25f('0x3b')],{'$or':_[_0xa25f('0x30')](_0x334629,function(_0x49556e){if(_0x49556e['type']!==_0xa25f('0x3e')){var _0x44c9c8={};_0x44c9c8[_0x49556e[_0xa25f('0x29')]]={'$like':'%'+_0x5d39c7[_0xa25f('0x31')][_0xa25f('0x3c')]+'%'};return _0x44c9c8;}})});}_0x41a847=_[_0xa25f('0x3d')]({},_0x41a847,_0x5d39c7[_0xa25f('0x3f')]);var _0x3382f4={'where':_0x41a847['where']};return db[_0xa25f('0x2b')][_0xa25f('0x1e')](_0x3382f4)[_0xa25f('0x25')](function(_0x2e886f){_0x208518[_0xa25f('0x1e')]=_0x2e886f;if(_0x5d39c7[_0xa25f('0x31')][_0xa25f('0x40')]){_0x41a847[_0xa25f('0x41')]=[{'all':!![]}];}return db[_0xa25f('0x2b')][_0xa25f('0x42')](_0x41a847);})[_0xa25f('0x25')](function(_0x3267a0){_0x208518[_0xa25f('0x43')]=_0x3267a0;return _0x208518;})['then'](respondWithFilteredResult(_0x1030c4,_0x41a847))[_0xa25f('0x44')](handleError(_0x1030c4,null));};exports['show']=function(_0xace015,_0x320119){var _0x36afe4={'raw':!![],'where':{'id':_0xace015[_0xa25f('0x45')]['id']}},_0x559874={};_0x559874[_0xa25f('0x2f')]=_[_0xa25f('0x32')](db[_0xa25f('0x2b')]['rawAttributes']);_0x559874[_0xa25f('0x31')]=_[_0xa25f('0x32')](_0xace015[_0xa25f('0x31')]);_0x559874[_0xa25f('0x33')]=_[_0xa25f('0x34')](_0x559874[_0xa25f('0x2f')],_0x559874['query']);_0x36afe4[_0xa25f('0x36')]=_[_0xa25f('0x34')](_0x559874['model'],qs[_0xa25f('0x35')](_0xace015[_0xa25f('0x31')][_0xa25f('0x35')]));_0x36afe4[_0xa25f('0x36')]=_0x36afe4[_0xa25f('0x36')][_0xa25f('0x37')]?_0x36afe4[_0xa25f('0x36')]:_0x559874[_0xa25f('0x2f')];if(_0xace015[_0xa25f('0x31')][_0xa25f('0x40')]){_0x36afe4[_0xa25f('0x41')]=[{'all':!![]}];}_0x36afe4=_[_0xa25f('0x3d')]({},_0x36afe4,_0xace015[_0xa25f('0x3f')]);return db['Cdr'][_0xa25f('0x46')](_0x36afe4)[_0xa25f('0x25')](handleEntityNotFound(_0x320119,null))[_0xa25f('0x25')](respondWithResult(_0x320119,null))[_0xa25f('0x44')](handleError(_0x320119,null));};exports['create']=function(_0x34717c,_0x43888b){return db[_0xa25f('0x2b')]['create'](_0x34717c[_0xa25f('0x47')],{})[_0xa25f('0x25')](respondWithResult(_0x43888b,0xc9))[_0xa25f('0x44')](handleError(_0x43888b,null));};exports[_0xa25f('0x24')]=function(_0x18c9f2,_0x3b6d34){if(_0x18c9f2[_0xa25f('0x47')]['id']){delete _0x18c9f2[_0xa25f('0x47')]['id'];}return db['Cdr'][_0xa25f('0x46')]({'where':{'id':_0x18c9f2[_0xa25f('0x45')]['id']}})[_0xa25f('0x25')](handleEntityNotFound(_0x3b6d34,null))[_0xa25f('0x25')](saveUpdates(_0x18c9f2[_0xa25f('0x47')],null))[_0xa25f('0x25')](respondWithResult(_0x3b6d34,null))[_0xa25f('0x44')](handleError(_0x3b6d34,null));};exports[_0xa25f('0x26')]=function(_0x26a096,_0xe04d67){return db[_0xa25f('0x2b')][_0xa25f('0x46')]({'where':{'id':_0x26a096[_0xa25f('0x45')]['id']}})[_0xa25f('0x25')](handleEntityNotFound(_0xe04d67,null))[_0xa25f('0x25')](removeEntity(_0xe04d67,null))[_0xa25f('0x44')](handleError(_0xe04d67,null));};exports[_0xa25f('0x48')]=function(_0x2fedba,_0x32f719){return db[_0xa25f('0x2b')][_0xa25f('0x48')]()[_0xa25f('0x25')](respondWithResult(_0x32f719,null))['catch'](handleError(_0x32f719,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 21928bc..fd5525a 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(_0x3d3690,_0x5c3131){var _0x5ea78b=function(_0x53ce9e){while(--_0x53ce9e){_0x3d3690['push'](_0x3d3690['shift']());}};_0x5ea78b(++_0x5c3131);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xc')]},{'name':'calldate','fields':[_0x7995('0xd')]},{'name':_0x7995('0xe'),'fields':[_0x7995('0xe')]},{'name':_0x7995('0xf'),'fields':[_0x7995('0xf')]},{'name':_0x7995('0x10'),'fields':[_0x7995('0x10')]},{'name':'uniqueid','fields':[_0x7995('0x11')]}],'timestamps':![]});}; \ No newline at end of file +var _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0x49e762,_0x4593f3){var _0x2bbfaa=function(_0x531645){while(--_0x531645){_0x49e762['push'](_0x49e762['shift']());}};_0x2bbfaa(++_0x4593f3);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xc')]},{'name':'calldate','fields':[_0x7995('0xd')]},{'name':_0x7995('0xe'),'fields':[_0x7995('0xe')]},{'name':_0x7995('0xf'),'fields':[_0x7995('0xf')]},{'name':_0x7995('0x10'),'fields':[_0x7995('0x10')]},{'name':'uniqueid','fields':[_0x7995('0x11')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index df9f894..7d64ca0 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 _0xf1df=['jayson/promise','client','http','request','then','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x5169ca,_0x2356e5){var _0x13f00d=function(_0xd31006){while(--_0xd31006){_0x5169ca['push'](_0x5169ca['shift']());}};_0x13f00d(++_0x2356e5);}(_0xf1df,0x186));var _0xff1d=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xf1df[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0xff1d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xff1d('0x1'));var rs=require(_0xff1d('0x2'));var fs=require('fs');var Redis=require(_0xff1d('0x3'));var db=require(_0xff1d('0x4'))['db'];var utils=require(_0xff1d('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xff1d('0x6'));var client=jayson[_0xff1d('0x7')][_0xff1d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xd42abf,_0x4a01d9,_0x2f6af8){return new BPromise(function(_0x4843ce,_0x43b6d5){return client[_0xff1d('0x9')](_0xd42abf,_0x2f6af8)[_0xff1d('0xa')](function(_0x20ad8c){logger[_0xff1d('0xb')](_0xff1d('0xc'),_0x4a01d9,_0xff1d('0xd'));logger[_0xff1d('0xe')](_0xff1d('0xf'),_0x4a01d9,_0xff1d('0xd'),JSON[_0xff1d('0x10')](_0x20ad8c));if(_0x20ad8c['error']){if(_0x20ad8c['error'][_0xff1d('0x11')]===0x1f4){logger[_0xff1d('0x12')]('Cdr,\x20%s,\x20%s',_0x4a01d9,_0x20ad8c['error'][_0xff1d('0x13')]);return _0x43b6d5(_0x20ad8c[_0xff1d('0x12')][_0xff1d('0x13')]);}logger[_0xff1d('0x12')](_0xff1d('0xc'),_0x4a01d9,_0x20ad8c[_0xff1d('0x12')]['message']);return _0x4843ce(_0x20ad8c[_0xff1d('0x12')][_0xff1d('0x13')]);}else{logger[_0xff1d('0xb')](_0xff1d('0xc'),_0x4a01d9,_0xff1d('0xd'));_0x4843ce(_0x20ad8c[_0xff1d('0x14')][_0xff1d('0x13')]);}})[_0xff1d('0x15')](function(_0x3cfcb7){logger['error'](_0xff1d('0xc'),_0x4a01d9,_0x3cfcb7);_0x43b6d5(_0x3cfcb7);});});} \ No newline at end of file +var _0x1735=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','code','error','message','util','moment'];(function(_0x48b810,_0x173a5e){var _0x23c17d=function(_0x38531e){while(--_0x38531e){_0x48b810['push'](_0x48b810['shift']());}};_0x23c17d(++_0x173a5e);}(_0x1735,0x140));var _0x5173=function(_0x833b9,_0x59368e){_0x833b9=_0x833b9-0x0;var _0x36fd8f=_0x1735[_0x833b9];return _0x36fd8f;};'use strict';var _=require('lodash');var util=require(_0x5173('0x0'));var moment=require(_0x5173('0x1'));var BPromise=require(_0x5173('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5173('0x3'));var db=require(_0x5173('0x4'))['db'];var utils=require(_0x5173('0x5'));var logger=require(_0x5173('0x6'))(_0x5173('0x7'));var config=require(_0x5173('0x8'));var jayson=require(_0x5173('0x9'));var client=jayson[_0x5173('0xa')][_0x5173('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1d841b,_0x120f7f,_0x477d03){return new BPromise(function(_0x1d134a,_0x4383ff){return client[_0x5173('0xc')](_0x1d841b,_0x477d03)[_0x5173('0xd')](function(_0x5080d0){logger[_0x5173('0xe')](_0x5173('0xf'),_0x120f7f,_0x5173('0x10'));logger[_0x5173('0x11')](_0x5173('0x12'),_0x120f7f,_0x5173('0x10'),JSON[_0x5173('0x13')](_0x5080d0));if(_0x5080d0['error']){if(_0x5080d0['error'][_0x5173('0x14')]===0x1f4){logger[_0x5173('0x15')]('Cdr,\x20%s,\x20%s',_0x120f7f,_0x5080d0['error'][_0x5173('0x16')]);return _0x4383ff(_0x5080d0[_0x5173('0x15')][_0x5173('0x16')]);}logger[_0x5173('0x15')](_0x5173('0xf'),_0x120f7f,_0x5080d0[_0x5173('0x15')][_0x5173('0x16')]);return _0x1d134a(_0x5080d0[_0x5173('0x15')][_0x5173('0x16')]);}else{logger[_0x5173('0xe')](_0x5173('0xf'),_0x120f7f,_0x5173('0x10'));_0x1d134a(_0x5080d0['result'][_0x5173('0x16')]);}})['catch'](function(_0x43732e){logger['error'](_0x5173('0xf'),_0x120f7f,_0x43732e);_0x4383ff(_0x43732e);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index a2f54cb..646dec4 100644 --- a/server/api/cdr/index.js +++ b/server/api/cdr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x2b3d1f,_0x40c8b6){var _0x187469=function(_0x23f359){while(--_0x23f359){_0x2b3d1f['push'](_0x2b3d1f['shift']());}};_0x187469(++_0x40c8b6);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file +var _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cdr.controller','get','index','/describe','show','post'];(function(_0x297c55,_0x34fa75){var _0x120389=function(_0x595108){while(--_0x595108){_0x297c55['push'](_0x297c55['shift']());}};_0x120389(++_0x34fa75);}(_0xa9e0,0x123));var _0x0a9e=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xa9e0[_0x28947d];return _0x12d2ee;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);module[_0x0a9e('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index a361f60..0130083 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 _0xeddb=['INTEGER','STRING','noop','*,*,*,*','sequelize'];(function(_0x1bb812,_0x23eacc){var _0x372adb=function(_0x5ad456){while(--_0x5ad456){_0x1bb812['push'](_0x1bb812['shift']());}};_0x372adb(++_0x23eacc);}(_0xeddb,0x9a));var _0xbedd=function(_0x323430,_0x3d2b6d){_0x323430=_0x323430-0x0;var _0x9eecd1=_0xeddb[_0x323430];return _0x9eecd1;};'use strict';var Sequelize=require(_0xbedd('0x0'));module['exports']={'priority':{'type':Sequelize[_0xbedd('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xbedd('0x2')],'allowNull':![],'defaultValue':_0xbedd('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xbedd('0x2')],'defaultValue':_0xbedd('0x4')}}; \ No newline at end of file +var _0x4e9b=['sequelize','exports','STRING','noop','TEXT','*,*,*,*'];(function(_0x1cea7e,_0x4e9be8){var _0xdb85fa=function(_0x356113){while(--_0x356113){_0x1cea7e['push'](_0x1cea7e['shift']());}};_0xdb85fa(++_0x4e9be8);}(_0x4e9b,0x11a));var _0xb4e9=function(_0x2642cb,_0x4b917f){_0x2642cb=_0x2642cb-0x0;var _0xe6e41=_0x4e9b[_0x2642cb];return _0xe6e41;};'use strict';var Sequelize=require(_0xb4e9('0x0'));module[_0xb4e9('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xb4e9('0x2')],'allowNull':![],'defaultValue':_0xb4e9('0x3')},'appdata':{'type':Sequelize[_0xb4e9('0x4')]()},'description':{'type':Sequelize[_0xb4e9('0x2')]},'interval':{'type':Sequelize[_0xb4e9('0x2')],'defaultValue':_0xb4e9('0x5')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 5151f21..49c0060 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 _0x8a9a=['jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','then','end','sendStatus','stack','name','send','show','params','model','keys','ChatApplication','rawAttributes','query','filters','intersection','attributes','fields','includeAll','include','merge','options','catch','body','destroy','find','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8a9a,0x193));var _0xa8a9=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x8a9a[_0x550d12];return _0x12103d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xa8a9('0x0'));var jsonpatch=require(_0xa8a9('0x1'));var rp=require(_0xa8a9('0x2'));var moment=require('moment');var BPromise=require(_0xa8a9('0x3'));var Mustache=require(_0xa8a9('0x4'));var util=require('util');var path=require('path');var sox=require(_0xa8a9('0x5'));var csv=require(_0xa8a9('0x6'));var ejs=require(_0xa8a9('0x7'));var fs=require('fs');var fs_extra=require(_0xa8a9('0x8'));var _=require(_0xa8a9('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa8a9('0xa'));var deskjs=require(_0xa8a9('0xb'));var toCsv=require(_0xa8a9('0x6'));var querystring=require(_0xa8a9('0xc'));var Papa=require(_0xa8a9('0xd'));var Redis=require(_0xa8a9('0xe'));var authService=require(_0xa8a9('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xa8a9('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa8a9('0x11'))('api');var utils=require(_0xa8a9('0x12'));var config=require(_0xa8a9('0x13'));var licenseUtil=require(_0xa8a9('0x14'));var db=require(_0xa8a9('0x15'))['db'];function respondWithStatusCode(_0x3e962a,_0x16d838){_0x16d838=_0x16d838||0xcc;return function(_0x53fbc5){if(_0x53fbc5){return _0x3e962a['sendStatus'](_0x16d838);}return _0x3e962a[_0xa8a9('0x16')](_0x16d838)['end']();};}function respondWithResult(_0x3bb559,_0x34bec9){_0x34bec9=_0x34bec9||0xc8;return function(_0x3a0e08){if(_0x3a0e08){return _0x3bb559[_0xa8a9('0x16')](_0x34bec9)[_0xa8a9('0x17')](_0x3a0e08);}};}function respondWithFilteredResult(_0x4c448c,_0x3593fa){return function(_0x5c2cde){if(_0x5c2cde){var _0x1c7d52=typeof _0x3593fa['offset']===_0xa8a9('0x18')&&typeof _0x3593fa[_0xa8a9('0x19')]==='undefined';var _0x25285c=_0x5c2cde['count'];var _0x2c4fe7=_0x1c7d52?0x0:_0x3593fa[_0xa8a9('0x1a')];var _0xce2084=_0x1c7d52?_0x5c2cde[_0xa8a9('0x1b')]:_0x3593fa['offset']+_0x3593fa['limit'];var _0x34b6d1;if(_0xce2084>=_0x25285c){_0xce2084=_0x25285c;_0x34b6d1=0xc8;}else{_0x34b6d1=0xce;}_0x4c448c['status'](_0x34b6d1);return _0x4c448c[_0xa8a9('0x1c')](_0xa8a9('0x1d'),_0x2c4fe7+'-'+_0xce2084+'/'+_0x25285c)[_0xa8a9('0x17')](_0x5c2cde);}return null;};}function patchUpdates(_0x39384c){return function(_0x126648){try{jsonpatch[_0xa8a9('0x1e')](_0x126648,_0x39384c,!![]);}catch(_0x20381c){return BPromise[_0xa8a9('0x1f')](_0x20381c);}return _0x126648[_0xa8a9('0x20')]();};}function saveUpdates(_0x390011,_0x1cc77a){return function(_0x2fd285){if(_0x2fd285){return _0x2fd285[_0xa8a9('0x21')](_0x390011)['then'](function(_0x481a29){return _0x481a29;});}return null;};}function removeEntity(_0x4343f4,_0xa4c41a){return function(_0x32e784){if(_0x32e784){return _0x32e784['destroy']()[_0xa8a9('0x22')](function(){_0x4343f4[_0xa8a9('0x16')](0xcc)[_0xa8a9('0x23')]();});}};}function handleEntityNotFound(_0x233fe1,_0x488791){return function(_0x20fb5a){if(!_0x20fb5a){_0x233fe1[_0xa8a9('0x24')](0x194);}return _0x20fb5a;};}function handleError(_0x2f7a56,_0x1aef34){_0x1aef34=_0x1aef34||0x1f4;return function(_0x5f0c62){logger['error'](_0x5f0c62[_0xa8a9('0x25')]);if(_0x5f0c62[_0xa8a9('0x26')]){delete _0x5f0c62[_0xa8a9('0x26')];}_0x2f7a56[_0xa8a9('0x16')](_0x1aef34)[_0xa8a9('0x27')](_0x5f0c62);};}exports[_0xa8a9('0x28')]=function(_0x2abeb7,_0x155527){var _0x4c87d4={'raw':!![],'where':{'id':_0x2abeb7[_0xa8a9('0x29')]['id']}},_0x45714a={};_0x45714a[_0xa8a9('0x2a')]=_[_0xa8a9('0x2b')](db[_0xa8a9('0x2c')][_0xa8a9('0x2d')]);_0x45714a[_0xa8a9('0x2e')]=_[_0xa8a9('0x2b')](_0x2abeb7[_0xa8a9('0x2e')]);_0x45714a[_0xa8a9('0x2f')]=_[_0xa8a9('0x30')](_0x45714a[_0xa8a9('0x2a')],_0x45714a[_0xa8a9('0x2e')]);_0x4c87d4[_0xa8a9('0x31')]=_[_0xa8a9('0x30')](_0x45714a[_0xa8a9('0x2a')],qs['fields'](_0x2abeb7[_0xa8a9('0x2e')][_0xa8a9('0x32')]));_0x4c87d4[_0xa8a9('0x31')]=_0x4c87d4[_0xa8a9('0x31')]['length']?_0x4c87d4[_0xa8a9('0x31')]:_0x45714a[_0xa8a9('0x2a')];if(_0x2abeb7['query'][_0xa8a9('0x33')]){_0x4c87d4[_0xa8a9('0x34')]=[{'all':!![]}];}_0x4c87d4=_[_0xa8a9('0x35')]({},_0x4c87d4,_0x2abeb7[_0xa8a9('0x36')]);return db[_0xa8a9('0x2c')]['find'](_0x4c87d4)[_0xa8a9('0x22')](handleEntityNotFound(_0x155527,null))[_0xa8a9('0x22')](respondWithResult(_0x155527,null))[_0xa8a9('0x37')](handleError(_0x155527,null));};exports[_0xa8a9('0x21')]=function(_0x2c09b2,_0x44524d){if(_0x2c09b2['body']['id']){delete _0x2c09b2[_0xa8a9('0x38')]['id'];}return db['ChatApplication']['find']({'where':{'id':_0x2c09b2['params']['id']}})['then'](handleEntityNotFound(_0x44524d,null))[_0xa8a9('0x22')](saveUpdates(_0x2c09b2['body'],null))[_0xa8a9('0x22')](respondWithResult(_0x44524d,null))['catch'](handleError(_0x44524d,null));};exports[_0xa8a9('0x39')]=function(_0x15801f,_0xbc61c0){return db[_0xa8a9('0x2c')][_0xa8a9('0x3a')]({'where':{'id':_0x15801f[_0xa8a9('0x29')]['id']}})[_0xa8a9('0x22')](handleEntityNotFound(_0xbc61c0,null))[_0xa8a9('0x22')](removeEntity(_0xbc61c0,null))['catch'](handleError(_0xbc61c0,null));}; \ No newline at end of file +var _0xb98f=['lodash','crypto','ioredis','../../components/auth/service','../../config/license/hardware','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','error','name','send','query','keys','intersection','model','attributes','fields','includeAll','include','merge','options','ChatApplication','find','catch','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','fs-extra'];(function(_0x3ed225,_0x1f57fb){var _0x5f46fa=function(_0x59dd4e){while(--_0x59dd4e){_0x3ed225['push'](_0x3ed225['shift']());}};_0x5f46fa(++_0x1f57fb);}(_0xb98f,0xce));var _0xfb98=function(_0x3e061d,_0xbcdea2){_0x3e061d=_0x3e061d-0x0;var _0x4e8fcd=_0xb98f[_0x3e061d];return _0x4e8fcd;};'use strict';var emlformat=require(_0xfb98('0x0'));var rimraf=require(_0xfb98('0x1'));var zipdir=require(_0xfb98('0x2'));var jsonpatch=require(_0xfb98('0x3'));var rp=require(_0xfb98('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xfb98('0x5'));var path=require(_0xfb98('0x6'));var sox=require(_0xfb98('0x7'));var csv=require(_0xfb98('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfb98('0x9'));var _=require(_0xfb98('0xa'));var squel=require('squel');var crypto=require(_0xfb98('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xfb98('0xc'));var authService=require(_0xfb98('0xd'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfb98('0xe'));var logger=require('../../config/logger')(_0xfb98('0xf'));var utils=require(_0xfb98('0x10'));var config=require(_0xfb98('0x11'));var licenseUtil=require(_0xfb98('0x12'));var db=require(_0xfb98('0x13'))['db'];function respondWithStatusCode(_0x3cc48e,_0x77a949){_0x77a949=_0x77a949||0xcc;return function(_0x1c9933){if(_0x1c9933){return _0x3cc48e[_0xfb98('0x14')](_0x77a949);}return _0x3cc48e[_0xfb98('0x15')](_0x77a949)[_0xfb98('0x16')]();};}function respondWithResult(_0x3cdeb9,_0x14c9a3){_0x14c9a3=_0x14c9a3||0xc8;return function(_0x201b04){if(_0x201b04){return _0x3cdeb9['status'](_0x14c9a3)[_0xfb98('0x17')](_0x201b04);}};}function respondWithFilteredResult(_0x515864,_0x3e7e25){return function(_0x2d4efd){if(_0x2d4efd){var _0x3c6ca5=typeof _0x3e7e25[_0xfb98('0x18')]===_0xfb98('0x19')&&typeof _0x3e7e25['limit']===_0xfb98('0x19');var _0x174e4d=_0x2d4efd[_0xfb98('0x1a')];var _0x14b206=_0x3c6ca5?0x0:_0x3e7e25[_0xfb98('0x18')];var _0x15c4fa=_0x3c6ca5?_0x2d4efd[_0xfb98('0x1a')]:_0x3e7e25[_0xfb98('0x18')]+_0x3e7e25[_0xfb98('0x1b')];var _0x15932f;if(_0x15c4fa>=_0x174e4d){_0x15c4fa=_0x174e4d;_0x15932f=0xc8;}else{_0x15932f=0xce;}_0x515864[_0xfb98('0x15')](_0x15932f);return _0x515864[_0xfb98('0x1c')](_0xfb98('0x1d'),_0x14b206+'-'+_0x15c4fa+'/'+_0x174e4d)[_0xfb98('0x17')](_0x2d4efd);}return null;};}function patchUpdates(_0x23bc24){return function(_0x46a120){try{jsonpatch[_0xfb98('0x1e')](_0x46a120,_0x23bc24,!![]);}catch(_0x50c0d6){return BPromise[_0xfb98('0x1f')](_0x50c0d6);}return _0x46a120[_0xfb98('0x20')]();};}function saveUpdates(_0x14eaff,_0x284b59){return function(_0x4c3f10){if(_0x4c3f10){return _0x4c3f10[_0xfb98('0x21')](_0x14eaff)[_0xfb98('0x22')](function(_0xfa10fc){return _0xfa10fc;});}return null;};}function removeEntity(_0x5078aa,_0x568d6c){return function(_0x433fce){if(_0x433fce){return _0x433fce[_0xfb98('0x23')]()['then'](function(){_0x5078aa[_0xfb98('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x383057,_0x3f97fb){return function(_0x5727b4){if(!_0x5727b4){_0x383057['sendStatus'](0x194);}return _0x5727b4;};}function handleError(_0x25480d,_0x18e638){_0x18e638=_0x18e638||0x1f4;return function(_0x5136a3){logger[_0xfb98('0x24')](_0x5136a3['stack']);if(_0x5136a3[_0xfb98('0x25')]){delete _0x5136a3[_0xfb98('0x25')];}_0x25480d[_0xfb98('0x15')](_0x18e638)[_0xfb98('0x26')](_0x5136a3);};}exports['show']=function(_0x239705,_0x106602){var _0x5cdb18={'raw':!![],'where':{'id':_0x239705['params']['id']}},_0x3c6e77={};_0x3c6e77['model']=_['keys'](db['ChatApplication']['rawAttributes']);_0x3c6e77[_0xfb98('0x27')]=_[_0xfb98('0x28')](_0x239705[_0xfb98('0x27')]);_0x3c6e77['filters']=_[_0xfb98('0x29')](_0x3c6e77[_0xfb98('0x2a')],_0x3c6e77['query']);_0x5cdb18[_0xfb98('0x2b')]=_[_0xfb98('0x29')](_0x3c6e77[_0xfb98('0x2a')],qs[_0xfb98('0x2c')](_0x239705['query'][_0xfb98('0x2c')]));_0x5cdb18[_0xfb98('0x2b')]=_0x5cdb18[_0xfb98('0x2b')]['length']?_0x5cdb18['attributes']:_0x3c6e77[_0xfb98('0x2a')];if(_0x239705['query'][_0xfb98('0x2d')]){_0x5cdb18[_0xfb98('0x2e')]=[{'all':!![]}];}_0x5cdb18=_[_0xfb98('0x2f')]({},_0x5cdb18,_0x239705[_0xfb98('0x30')]);return db[_0xfb98('0x31')][_0xfb98('0x32')](_0x5cdb18)[_0xfb98('0x22')](handleEntityNotFound(_0x106602,null))[_0xfb98('0x22')](respondWithResult(_0x106602,null))[_0xfb98('0x33')](handleError(_0x106602,null));};exports[_0xfb98('0x21')]=function(_0x35bbd4,_0x35100d){if(_0x35bbd4[_0xfb98('0x34')]['id']){delete _0x35bbd4['body']['id'];}return db[_0xfb98('0x31')][_0xfb98('0x32')]({'where':{'id':_0x35bbd4[_0xfb98('0x35')]['id']}})[_0xfb98('0x22')](handleEntityNotFound(_0x35100d,null))[_0xfb98('0x22')](saveUpdates(_0x35bbd4[_0xfb98('0x34')],null))['then'](respondWithResult(_0x35100d,null))['catch'](handleError(_0x35100d,null));};exports[_0xfb98('0x23')]=function(_0x5063aa,_0x538782){return db['ChatApplication']['find']({'where':{'id':_0x5063aa[_0xfb98('0x35')]['id']}})[_0xfb98('0x22')](handleEntityNotFound(_0x538782,null))['then'](removeEntity(_0x538782,null))[_0xfb98('0x33')](handleError(_0x538782,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 30776b8..94d0b60 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 _0x0fc2=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./chatApplication.attributes','exports','define','ChatApplication','chat_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x1e18a8,_0x4f715f){var _0x21a158=function(_0x21976d){while(--_0x21976d){_0x1e18a8['push'](_0x1e18a8['shift']());}};_0x21a158(++_0x4f715f);}(_0x0fc2,0x6e));var _0x20fc=function(_0x38a642,_0x2cf3dd){_0x38a642=_0x38a642-0x0;var _0x2bda49=_0x0fc2[_0x38a642];return _0x2bda49;};'use strict';var _=require(_0x20fc('0x0'));var util=require(_0x20fc('0x1'));var logger=require(_0x20fc('0x2'))(_0x20fc('0x3'));var moment=require('moment');var BPromise=require(_0x20fc('0x4'));var rp=require(_0x20fc('0x5'));var fs=require('fs');var path=require(_0x20fc('0x6'));var rimraf=require(_0x20fc('0x7'));var config=require(_0x20fc('0x8'));var attributes=require(_0x20fc('0x9'));module[_0x20fc('0xa')]=function(_0x13f2d5,_0x10f6ad){return _0x13f2d5[_0x20fc('0xb')](_0x20fc('0xc'),attributes,{'tableName':_0x20fc('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x20fc('0xe'),'collate':_0x20fc('0xf')});}; \ No newline at end of file +var _0xa854=['request-promise','rimraf','./chatApplication.attributes','exports','define','chat_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment'];(function(_0x2a6809,_0x44edde){var _0x11c371=function(_0x1a4888){while(--_0x1a4888){_0x2a6809['push'](_0x2a6809['shift']());}};_0x11c371(++_0x44edde);}(_0xa854,0x103));var _0x4a85=function(_0x3a5683,_0x185ca2){_0x3a5683=_0x3a5683-0x0;var _0x1e3c0d=_0xa854[_0x3a5683];return _0x1e3c0d;};'use strict';var _=require(_0x4a85('0x0'));var util=require(_0x4a85('0x1'));var logger=require(_0x4a85('0x2'))(_0x4a85('0x3'));var moment=require(_0x4a85('0x4'));var BPromise=require('bluebird');var rp=require(_0x4a85('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4a85('0x6'));var config=require('../../config/environment');var attributes=require(_0x4a85('0x7'));module[_0x4a85('0x8')]=function(_0x494d91,_0x445a95){return _0x494d91[_0x4a85('0x9')]('ChatApplication',attributes,{'tableName':_0x4a85('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x4a85('0xb')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 6ee430a..a11fbe3 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 _0xfca9=['ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x2bf1fb,_0x10022d){var _0x5e7e68=function(_0x287fbb){while(--_0x287fbb){_0x2bf1fb['push'](_0x2bf1fb['shift']());}};_0x5e7e68(++_0x10022d);}(_0xfca9,0xd8));var _0x9fca=function(_0x5b80dd,_0x233be0){_0x5b80dd=_0x5b80dd-0x0;var _0x1db308=_0xfca9[_0x5b80dd];return _0x1db308;};'use strict';var _=require(_0x9fca('0x0'));var util=require(_0x9fca('0x1'));var moment=require(_0x9fca('0x2'));var BPromise=require(_0x9fca('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9fca('0x4'));var db=require(_0x9fca('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9fca('0x6'))(_0x9fca('0x7'));var config=require('../../config/environment');var jayson=require(_0x9fca('0x8'));var client=jayson[_0x9fca('0x9')][_0x9fca('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x221f35,_0x2e2110,_0x4dbc62){return new BPromise(function(_0x42eb58,_0x284f32){return client['request'](_0x221f35,_0x4dbc62)[_0x9fca('0xb')](function(_0x5dcc7b){logger[_0x9fca('0xc')](_0x9fca('0xd'),_0x2e2110,_0x9fca('0xe'));logger['debug'](_0x9fca('0xf'),_0x2e2110,_0x9fca('0xe'),JSON[_0x9fca('0x10')](_0x5dcc7b));if(_0x5dcc7b[_0x9fca('0x11')]){if(_0x5dcc7b[_0x9fca('0x11')][_0x9fca('0x12')]===0x1f4){logger[_0x9fca('0x11')]('ChatApplication,\x20%s,\x20%s',_0x2e2110,_0x5dcc7b['error'][_0x9fca('0x13')]);return _0x284f32(_0x5dcc7b[_0x9fca('0x11')][_0x9fca('0x13')]);}logger[_0x9fca('0x11')](_0x9fca('0xd'),_0x2e2110,_0x5dcc7b['error'][_0x9fca('0x13')]);return _0x42eb58(_0x5dcc7b['error'][_0x9fca('0x13')]);}else{logger[_0x9fca('0xc')](_0x9fca('0xd'),_0x2e2110,_0x9fca('0xe'));_0x42eb58(_0x5dcc7b[_0x9fca('0x14')]['message']);}})[_0x9fca('0x15')](function(_0x4a7050){logger[_0x9fca('0x11')](_0x9fca('0xd'),_0x2e2110,_0x4a7050);_0x284f32(_0x4a7050);});});} \ No newline at end of file +var _0x2f16=['../../config/environment','jayson/promise','client','http','request','then','info','ChatApplication,\x20%s,\x20%s','debug','ChatApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','bluebird','ioredis','../../mysqldb'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x2f16,0x13f));var _0x62f1=function(_0x688c0e,_0xc9e8e8){_0x688c0e=_0x688c0e-0x0;var _0x351de9=_0x2f16[_0x688c0e];return _0x351de9;};'use strict';var _=require(_0x62f1('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x62f1('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x62f1('0x2'));var db=require(_0x62f1('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x62f1('0x4'));var jayson=require(_0x62f1('0x5'));var client=jayson[_0x62f1('0x6')][_0x62f1('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3b18e1,_0x19db9f,_0x53d811){return new BPromise(function(_0x4af4eb,_0x548d47){return client[_0x62f1('0x8')](_0x3b18e1,_0x53d811)[_0x62f1('0x9')](function(_0x1f49d0){logger[_0x62f1('0xa')](_0x62f1('0xb'),_0x19db9f,'request\x20sent');logger[_0x62f1('0xc')](_0x62f1('0xd'),_0x19db9f,'request\x20sent',JSON['stringify'](_0x1f49d0));if(_0x1f49d0['error']){if(_0x1f49d0[_0x62f1('0xe')][_0x62f1('0xf')]===0x1f4){logger[_0x62f1('0xe')](_0x62f1('0xb'),_0x19db9f,_0x1f49d0['error']['message']);return _0x548d47(_0x1f49d0[_0x62f1('0xe')]['message']);}logger[_0x62f1('0xe')]('ChatApplication,\x20%s,\x20%s',_0x19db9f,_0x1f49d0[_0x62f1('0xe')][_0x62f1('0x10')]);return _0x4af4eb(_0x1f49d0['error']['message']);}else{logger['info'](_0x62f1('0xb'),_0x19db9f,'request\x20sent');_0x4af4eb(_0x1f49d0[_0x62f1('0x11')][_0x62f1('0x10')]);}})[_0x62f1('0x12')](function(_0x540f48){logger['error']('ChatApplication,\x20%s,\x20%s',_0x19db9f,_0x540f48);_0x548d47(_0x540f48);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index c60ac4a..64a2a2d 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 _0xbadd=['path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','put','/:id','update','delete','exports','multer','util'];(function(_0x35920b,_0xa2169f){var _0x5ce2e1=function(_0x153c94){while(--_0x153c94){_0x35920b['push'](_0x35920b['shift']());}};_0x5ce2e1(++_0xa2169f);}(_0xbadd,0x12a));var _0xdbad=function(_0xf8886b,_0x504891){_0xf8886b=_0xf8886b-0x0;var _0x321bd5=_0xbadd[_0xf8886b];return _0x321bd5;};'use strict';var multer=require(_0xdbad('0x0'));var util=require(_0xdbad('0x1'));var path=require(_0xdbad('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xdbad('0x3')]();var fs_extra=require(_0xdbad('0x4'));var auth=require(_0xdbad('0x5'));var interaction=require(_0xdbad('0x6'));var config=require(_0xdbad('0x7'));var controller=require('./chatApplication.controller');router[_0xdbad('0x8')]('/:id',auth[_0xdbad('0x9')](),controller['show']);router[_0xdbad('0xa')](_0xdbad('0xb'),auth['isAuthenticated'](),controller[_0xdbad('0xc')]);router[_0xdbad('0xd')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xdbad('0xe')]=router; \ No newline at end of file +var _0x6590=['./chatApplication.controller','get','/:id','isAuthenticated','show','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x6590,0x127));var _0x0659=function(_0x215dc8,_0x52c245){_0x215dc8=_0x215dc8-0x0;var _0x583ea3=_0x6590[_0x215dc8];return _0x583ea3;};'use strict';var multer=require(_0x0659('0x0'));var util=require(_0x0659('0x1'));var path=require(_0x0659('0x2'));var timeout=require('connect-timeout');var express=require(_0x0659('0x3'));var router=express[_0x0659('0x4')]();var fs_extra=require(_0x0659('0x5'));var auth=require(_0x0659('0x6'));var interaction=require(_0x0659('0x7'));var config=require(_0x0659('0x8'));var controller=require(_0x0659('0x9'));router[_0x0659('0xa')](_0x0659('0xb'),auth[_0x0659('0xc')](),controller[_0x0659('0xd')]);router[_0x0659('0xe')](_0x0659('0xb'),auth[_0x0659('0xc')](),controller[_0x0659('0xf')]);router[_0x0659('0x10')](_0x0659('0xb'),auth[_0x0659('0xc')](),controller[_0x0659('0x11')]);module[_0x0659('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 c1d5d33..9fd228e 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 _0x855f=['BOOLEAN','sequelize','STRING'];(function(_0xf27b1,_0x29bae7){var _0x188b0b=function(_0x2f57cc){while(--_0x2f57cc){_0xf27b1['push'](_0xf27b1['shift']());}};_0x188b0b(++_0x29bae7);}(_0x855f,0x145));var _0xf855=function(_0x18f891,_0xbd3c84){_0x18f891=_0x18f891-0x0;var _0x241742=_0x855f[_0x18f891];return _0x241742;};'use strict';var Sequelize=require(_0xf855('0x0'));module['exports']={'name':{'type':Sequelize[_0xf855('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xf855('0x1')]},'write':{'type':Sequelize[_0xf855('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0x649e=['BOOLEAN','sequelize','exports','STRING'];(function(_0x4c837a,_0x49e506){var _0x32864a=function(_0x82a74){while(--_0x82a74){_0x4c837a['push'](_0x4c837a['shift']());}};_0x32864a(++_0x49e506);}(_0x649e,0xdd));var _0xe649=function(_0x13680f,_0x5cb289){_0x13680f=_0x13680f-0x0;var _0x1573f1=_0x649e[_0x13680f];return _0x1573f1;};'use strict';var Sequelize=require(_0xe649('0x0'));module[_0xe649('0x1')]={'name':{'type':Sequelize[_0xe649('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xe649('0x2')]},'write':{'type':Sequelize[_0xe649('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 369e6e4..8a1147b 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 _0xb1fa=['status','end','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','fieldName','type','model','map','filters','intersection','attributes','fields','query','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','ChatGroup','includeAll','include','findAll','rows','catch','keys','rawAttributes','find','create','body','destroy','params','describe','getUnread','ChatInternalMessage','user','addMembers','ids','findOne','getMembers','removeMembers','addMessage','ChatGroupId','getMessages','$gte','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./chatGroup.socket','sendStatus'];(function(_0x4323d4,_0x42b60e){var _0xbff5e6=function(_0xdefe85){while(--_0xdefe85){_0x4323d4['push'](_0x4323d4['shift']());}};_0xbff5e6(++_0x42b60e);}(_0xb1fa,0x9c));var _0xab1f=function(_0x4d0c54,_0x3fdbee){_0x4d0c54=_0x4d0c54-0x0;var _0x5b834f=_0xb1fa[_0x4d0c54];return _0x5b834f;};'use strict';var emlformat=require(_0xab1f('0x0'));var rimraf=require(_0xab1f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xab1f('0x2'));var rp=require(_0xab1f('0x3'));var moment=require(_0xab1f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xab1f('0x5'));var util=require(_0xab1f('0x6'));var path=require(_0xab1f('0x7'));var sox=require(_0xab1f('0x8'));var csv=require(_0xab1f('0x9'));var ejs=require(_0xab1f('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xab1f('0xb'));var squel=require(_0xab1f('0xc'));var crypto=require(_0xab1f('0xd'));var jsforce=require(_0xab1f('0xe'));var deskjs=require(_0xab1f('0xf'));var toCsv=require(_0xab1f('0x9'));var querystring=require(_0xab1f('0x10'));var Papa=require(_0xab1f('0x11'));var Redis=require('ioredis');var authService=require(_0xab1f('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xab1f('0x13'));var hardwareService=require(_0xab1f('0x14'));var logger=require(_0xab1f('0x15'))(_0xab1f('0x16'));var utils=require(_0xab1f('0x17'));var config=require(_0xab1f('0x18'));var licenseUtil=require(_0xab1f('0x19'));var db=require(_0xab1f('0x1a'))['db'];config[_0xab1f('0x1b')]=_[_0xab1f('0x1c')](config[_0xab1f('0x1b')],{'host':_0xab1f('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xab1f('0x1e'))['register'](socket);function respondWithStatusCode(_0x5c17d6,_0x32667f){_0x32667f=_0x32667f||0xcc;return function(_0x72c258){if(_0x72c258){return _0x5c17d6[_0xab1f('0x1f')](_0x32667f);}return _0x5c17d6[_0xab1f('0x20')](_0x32667f)[_0xab1f('0x21')]();};}function respondWithResult(_0x1308d6,_0x1d268d){_0x1d268d=_0x1d268d||0xc8;return function(_0x4e940e){if(_0x4e940e){return _0x1308d6[_0xab1f('0x20')](_0x1d268d)['json'](_0x4e940e);}};}function respondWithFilteredResult(_0x4d8979,_0x5d56a1){return function(_0x36cd7b){if(_0x36cd7b){var _0x5462e2=typeof _0x5d56a1[_0xab1f('0x22')]===_0xab1f('0x23')&&typeof _0x5d56a1['limit']===_0xab1f('0x23');var _0x45c081=_0x36cd7b[_0xab1f('0x24')];var _0x52b883=_0x5462e2?0x0:_0x5d56a1['offset'];var _0x2e3d06=_0x5462e2?_0x36cd7b[_0xab1f('0x24')]:_0x5d56a1[_0xab1f('0x22')]+_0x5d56a1[_0xab1f('0x25')];var _0x27d176;if(_0x2e3d06>=_0x45c081){_0x2e3d06=_0x45c081;_0x27d176=0xc8;}else{_0x27d176=0xce;}_0x4d8979[_0xab1f('0x20')](_0x27d176);return _0x4d8979[_0xab1f('0x26')](_0xab1f('0x27'),_0x52b883+'-'+_0x2e3d06+'/'+_0x45c081)['json'](_0x36cd7b);}return null;};}function patchUpdates(_0x310a0d){return function(_0x4e7388){try{jsonpatch[_0xab1f('0x28')](_0x4e7388,_0x310a0d,!![]);}catch(_0x3b67c9){return BPromise[_0xab1f('0x29')](_0x3b67c9);}return _0x4e7388[_0xab1f('0x2a')]();};}function saveUpdates(_0x523d15,_0x53ae7f){return function(_0x5d0239){if(_0x5d0239){return _0x5d0239[_0xab1f('0x2b')](_0x523d15)['then'](function(_0x3c826f){return _0x3c826f;});}return null;};}function removeEntity(_0x532031,_0x3ab185){return function(_0x5dad0c){if(_0x5dad0c){return _0x5dad0c['destroy']()[_0xab1f('0x2c')](function(){_0x532031[_0xab1f('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d6bc3,_0x3e4827){return function(_0x4cb0ce){if(!_0x4cb0ce){_0x2d6bc3[_0xab1f('0x1f')](0x194);}return _0x4cb0ce;};}function handleError(_0x5388ae,_0x28aea8){_0x28aea8=_0x28aea8||0x1f4;return function(_0x1fb567){logger[_0xab1f('0x2d')](_0x1fb567[_0xab1f('0x2e')]);if(_0x1fb567[_0xab1f('0x2f')]){delete _0x1fb567[_0xab1f('0x2f')];}_0x5388ae[_0xab1f('0x20')](_0x28aea8)['send'](_0x1fb567);};}exports['index']=function(_0x3caf95,_0xd739f4){var _0x599542={},_0x2605a3={},_0x4636d7={'count':0x0,'rows':[]};var _0xcd9d90=_['map'](db['ChatGroup']['rawAttributes'],function(_0x42e5db){return{'name':_0x42e5db[_0xab1f('0x30')],'type':_0x42e5db[_0xab1f('0x31')]['key']};});_0x2605a3[_0xab1f('0x32')]=_[_0xab1f('0x33')](_0xcd9d90,_0xab1f('0x2f'));_0x2605a3['query']=_['keys'](_0x3caf95['query']);_0x2605a3[_0xab1f('0x34')]=_[_0xab1f('0x35')](_0x2605a3[_0xab1f('0x32')],_0x2605a3['query']);_0x599542[_0xab1f('0x36')]=_['intersection'](_0x2605a3[_0xab1f('0x32')],qs[_0xab1f('0x37')](_0x3caf95[_0xab1f('0x38')][_0xab1f('0x37')]));_0x599542[_0xab1f('0x36')]=_0x599542['attributes'][_0xab1f('0x39')]?_0x599542[_0xab1f('0x36')]:_0x2605a3[_0xab1f('0x32')];if(!_0x3caf95[_0xab1f('0x38')][_0xab1f('0x3a')](_0xab1f('0x3b'))){_0x599542[_0xab1f('0x25')]=qs[_0xab1f('0x25')](_0x3caf95[_0xab1f('0x38')][_0xab1f('0x25')]);_0x599542[_0xab1f('0x22')]=qs['offset'](_0x3caf95[_0xab1f('0x38')][_0xab1f('0x22')]);}_0x599542[_0xab1f('0x3c')]=qs[_0xab1f('0x3d')](_0x3caf95[_0xab1f('0x38')][_0xab1f('0x3d')]);_0x599542['where']=qs['filters'](_[_0xab1f('0x3e')](_0x3caf95[_0xab1f('0x38')],_0x2605a3['filters']),_0xcd9d90);if(_0x3caf95[_0xab1f('0x38')][_0xab1f('0x3f')]){_0x599542[_0xab1f('0x40')]=_['merge'](_0x599542[_0xab1f('0x40')],{'$or':_[_0xab1f('0x33')](_0xcd9d90,function(_0x3d36c5){if(_0x3d36c5[_0xab1f('0x31')]!==_0xab1f('0x41')){var _0x13df76={};_0x13df76[_0x3d36c5['name']]={'$like':'%'+_0x3caf95['query'][_0xab1f('0x3f')]+'%'};return _0x13df76;}})});}_0x599542=_[_0xab1f('0x42')]({},_0x599542,_0x3caf95[_0xab1f('0x43')]);var _0x45667f={'where':_0x599542[_0xab1f('0x40')]};return db[_0xab1f('0x44')][_0xab1f('0x24')](_0x45667f)[_0xab1f('0x2c')](function(_0x5c1079){_0x4636d7[_0xab1f('0x24')]=_0x5c1079;if(_0x3caf95['query'][_0xab1f('0x45')]){_0x599542[_0xab1f('0x46')]=[{'all':!![]}];}return db['ChatGroup'][_0xab1f('0x47')](_0x599542);})['then'](function(_0x4e87f2){_0x4636d7[_0xab1f('0x48')]=_0x4e87f2;return _0x4636d7;})[_0xab1f('0x2c')](respondWithFilteredResult(_0xd739f4,_0x599542))[_0xab1f('0x49')](handleError(_0xd739f4,null));};exports['show']=function(_0x225fe0,_0xbf012){var _0x59146d={'raw':!![],'where':{'id':_0x225fe0['params']['id']}},_0x370239={};_0x370239[_0xab1f('0x32')]=_[_0xab1f('0x4a')](db[_0xab1f('0x44')][_0xab1f('0x4b')]);_0x370239[_0xab1f('0x38')]=_[_0xab1f('0x4a')](_0x225fe0[_0xab1f('0x38')]);_0x370239[_0xab1f('0x34')]=_['intersection'](_0x370239[_0xab1f('0x32')],_0x370239[_0xab1f('0x38')]);_0x59146d['attributes']=_[_0xab1f('0x35')](_0x370239['model'],qs[_0xab1f('0x37')](_0x225fe0[_0xab1f('0x38')]['fields']));_0x59146d[_0xab1f('0x36')]=_0x59146d[_0xab1f('0x36')][_0xab1f('0x39')]?_0x59146d[_0xab1f('0x36')]:_0x370239[_0xab1f('0x32')];if(_0x225fe0[_0xab1f('0x38')][_0xab1f('0x45')]){_0x59146d[_0xab1f('0x46')]=[{'all':!![]}];}_0x59146d=_[_0xab1f('0x42')]({},_0x59146d,_0x225fe0[_0xab1f('0x43')]);return db[_0xab1f('0x44')][_0xab1f('0x4c')](_0x59146d)[_0xab1f('0x2c')](handleEntityNotFound(_0xbf012,null))['then'](respondWithResult(_0xbf012,null))[_0xab1f('0x49')](handleError(_0xbf012,null));};exports[_0xab1f('0x4d')]=function(_0x331c67,_0x52195c){return db[_0xab1f('0x44')]['create'](_0x331c67['body'],{})[_0xab1f('0x2c')](respondWithResult(_0x52195c,0xc9))[_0xab1f('0x49')](handleError(_0x52195c,null));};exports[_0xab1f('0x2b')]=function(_0x19f27f,_0x1d6adf){if(_0x19f27f[_0xab1f('0x4e')]['id']){delete _0x19f27f[_0xab1f('0x4e')]['id'];}return db[_0xab1f('0x44')][_0xab1f('0x4c')]({'where':{'id':_0x19f27f['params']['id']}})[_0xab1f('0x2c')](handleEntityNotFound(_0x1d6adf,null))[_0xab1f('0x2c')](saveUpdates(_0x19f27f[_0xab1f('0x4e')],null))[_0xab1f('0x2c')](respondWithResult(_0x1d6adf,null))['catch'](handleError(_0x1d6adf,null));};exports[_0xab1f('0x4f')]=function(_0x594428,_0x55a748){return db[_0xab1f('0x44')][_0xab1f('0x4c')]({'where':{'id':_0x594428[_0xab1f('0x50')]['id']}})[_0xab1f('0x2c')](handleEntityNotFound(_0x55a748,null))[_0xab1f('0x2c')](removeEntity(_0x55a748,null))[_0xab1f('0x49')](handleError(_0x55a748,null));};exports['describe']=function(_0x4de6b2,_0x368cd9){return db[_0xab1f('0x44')][_0xab1f('0x51')]()[_0xab1f('0x2c')](respondWithResult(_0x368cd9,null))[_0xab1f('0x49')](handleError(_0x368cd9,null));};exports[_0xab1f('0x52')]=function(_0x5d8fea,_0x4711c3,_0x17ef9a){return db[_0xab1f('0x53')][_0xab1f('0x24')]({'where':{'ChatGroupId':_0x5d8fea[_0xab1f('0x50')]['id'],'ToId':_0x5d8fea[_0xab1f('0x54')]['id'],'read':![]}})[_0xab1f('0x2c')](function(_0xc63b8e){return{'id':_['toInteger'](_0x5d8fea[_0xab1f('0x50')]['id']),'count':_0xc63b8e};})[_0xab1f('0x2c')](respondWithResult(_0x4711c3,null))['catch'](handleError(_0x4711c3,null));};exports[_0xab1f('0x55')]=function(_0x4656b5,_0x308eb5,_0x10780e){return db[_0xab1f('0x44')][_0xab1f('0x4c')]({'where':{'id':_0x4656b5[_0xab1f('0x50')]['id']}})[_0xab1f('0x2c')](handleEntityNotFound(_0x308eb5,null))[_0xab1f('0x2c')](function(_0x212ca4){if(_0x212ca4){return _0x212ca4[_0xab1f('0x55')](_0x4656b5['body'][_0xab1f('0x56')],_['omit'](_0x4656b5[_0xab1f('0x4e')],[_0xab1f('0x56'),'id'])||{});}})['then'](respondWithResult(_0x308eb5,null))[_0xab1f('0x49')](handleError(_0x308eb5,null));};exports['getMembers']=function(_0x442aa8,_0x5f9aaf,_0x3b2e59){var _0x38bb6e={};var _0x3f9b00={};var _0x3669da;var _0x44b91d;return db['ChatGroup'][_0xab1f('0x57')]({'where':{'id':_0x442aa8[_0xab1f('0x50')]['id']}})[_0xab1f('0x2c')](handleEntityNotFound(_0x5f9aaf,null))[_0xab1f('0x2c')](function(_0x177cd2){if(_0x177cd2){_0x3669da=_0x177cd2;_0x3f9b00[_0xab1f('0x32')]=_['keys'](db['User'][_0xab1f('0x4b')]);_0x3f9b00[_0xab1f('0x38')]=_['keys'](_0x442aa8[_0xab1f('0x38')]);_0x3f9b00[_0xab1f('0x34')]=_[_0xab1f('0x35')](_0x3f9b00[_0xab1f('0x32')],_0x3f9b00[_0xab1f('0x38')]);_0x38bb6e['attributes']=_['intersection'](_0x3f9b00[_0xab1f('0x32')],qs[_0xab1f('0x37')](_0x442aa8[_0xab1f('0x38')]['fields']));_0x38bb6e[_0xab1f('0x36')]=_0x38bb6e['attributes'][_0xab1f('0x39')]?_0x38bb6e[_0xab1f('0x36')]:_0x3f9b00[_0xab1f('0x32')];_0x38bb6e[_0xab1f('0x3c')]=qs[_0xab1f('0x3d')](_0x442aa8[_0xab1f('0x38')][_0xab1f('0x3d')]);_0x38bb6e[_0xab1f('0x40')]=qs[_0xab1f('0x34')](_[_0xab1f('0x3e')](_0x442aa8[_0xab1f('0x38')],_0x3f9b00[_0xab1f('0x34')]));if(_0x442aa8[_0xab1f('0x38')]['filter']){_0x38bb6e[_0xab1f('0x40')]=_['merge'](_0x38bb6e[_0xab1f('0x40')],{'$or':_[_0xab1f('0x33')](_0x38bb6e[_0xab1f('0x36')],function(_0x421035){var _0x2d1757={};_0x2d1757[_0x421035]={'$like':'%'+_0x442aa8[_0xab1f('0x38')][_0xab1f('0x3f')]+'%'};return _0x2d1757;})});}_0x38bb6e=_[_0xab1f('0x42')]({},_0x38bb6e,_0x442aa8['options']);return _0x3669da[_0xab1f('0x58')](_0x38bb6e);}})['then'](function(_0x58fe57){if(_0x58fe57){_0x44b91d=_0x58fe57[_0xab1f('0x39')];if(!_0x442aa8[_0xab1f('0x38')][_0xab1f('0x3a')](_0xab1f('0x3b'))){_0x38bb6e[_0xab1f('0x25')]=qs[_0xab1f('0x25')](_0x442aa8[_0xab1f('0x38')][_0xab1f('0x25')]);_0x38bb6e[_0xab1f('0x22')]=qs[_0xab1f('0x22')](_0x442aa8[_0xab1f('0x38')][_0xab1f('0x22')]);}return _0x3669da[_0xab1f('0x58')](_0x38bb6e);}})[_0xab1f('0x2c')](function(_0x92551e){if(_0x92551e){return _0x92551e?{'count':_0x44b91d,'rows':_0x92551e}:null;}})[_0xab1f('0x2c')](respondWithResult(_0x5f9aaf,null))[_0xab1f('0x49')](handleError(_0x5f9aaf,null));};exports[_0xab1f('0x59')]=function(_0x33cbeb,_0x1202b5,_0x22cf12){return db[_0xab1f('0x44')]['find']({'where':{'id':_0x33cbeb['params']['id']}})[_0xab1f('0x2c')](handleEntityNotFound(_0x1202b5,null))[_0xab1f('0x2c')](function(_0x29b247){if(_0x29b247){return _0x29b247[_0xab1f('0x59')](_0x33cbeb[_0xab1f('0x38')][_0xab1f('0x56')]);}})[_0xab1f('0x2c')](respondWithStatusCode(_0x1202b5,null))[_0xab1f('0x49')](handleError(_0x1202b5,null));};exports[_0xab1f('0x5a')]=function(_0x557e15,_0xf76938,_0xc27e25){if(_0x557e15[_0xab1f('0x4e')]['id']){delete _0x557e15[_0xab1f('0x4e')]['id'];}return db[_0xab1f('0x44')][_0xab1f('0x4c')]({'where':{'id':_0x557e15['params']['id']}})[_0xab1f('0x2c')](handleEntityNotFound(_0xf76938,null))[_0xab1f('0x2c')](function(_0x53ba74){if(_0x53ba74){_0x557e15[_0xab1f('0x4e')][_0xab1f('0x5b')]=_0x53ba74['id'];return db['ChatInternalMessage'][_0xab1f('0x4d')](_0x557e15[_0xab1f('0x4e')]);}})['then'](respondWithResult(_0xf76938,null))[_0xab1f('0x49')](handleError(_0xf76938,null));};exports[_0xab1f('0x5c')]=function(_0x40aec3,_0x56f346,_0x1ba6c4){var _0xd07fcd={};var _0x344420={};var _0x5be7ea;var _0x343ef8;return db[_0xab1f('0x44')]['findOne']({'where':{'id':_0x40aec3[_0xab1f('0x50')]['id']}})[_0xab1f('0x2c')](handleEntityNotFound(_0x56f346,null))[_0xab1f('0x2c')](function(_0x4dfa9e){if(_0x4dfa9e){_0x5be7ea=_0x4dfa9e;_0x344420[_0xab1f('0x32')]=_[_0xab1f('0x4a')](db[_0xab1f('0x53')]['rawAttributes']);_0x344420[_0xab1f('0x38')]=_['keys'](_0x40aec3[_0xab1f('0x38')]);_0x344420[_0xab1f('0x34')]=_[_0xab1f('0x35')](_0x344420['model'],_0x344420['query']);_0xd07fcd[_0xab1f('0x36')]=_[_0xab1f('0x35')](_0x344420[_0xab1f('0x32')],qs[_0xab1f('0x37')](_0x40aec3[_0xab1f('0x38')][_0xab1f('0x37')]));_0xd07fcd['attributes']=_0xd07fcd[_0xab1f('0x36')][_0xab1f('0x39')]?_0xd07fcd[_0xab1f('0x36')]:_0x344420[_0xab1f('0x32')];_0xd07fcd[_0xab1f('0x3c')]=qs[_0xab1f('0x3d')](_0x40aec3[_0xab1f('0x38')]['sort']);_0xd07fcd[_0xab1f('0x40')]=qs[_0xab1f('0x34')](_[_0xab1f('0x3e')](_0x40aec3['query'],_0x344420[_0xab1f('0x34')]));if(_0x40aec3['query'][_0xab1f('0x3f')]){_0xd07fcd[_0xab1f('0x40')]=_['merge'](_0xd07fcd[_0xab1f('0x40')],{'$or':_[_0xab1f('0x33')](_0xd07fcd['attributes'],function(_0x436ab8){var _0x1203f5={};_0x1203f5[_0x436ab8]={'$like':'%'+_0x40aec3[_0xab1f('0x38')][_0xab1f('0x3f')]+'%'};return _0x1203f5;})});}if(_0x40aec3[_0xab1f('0x38')][_0xab1f('0x5d')]){var _0x27735b=_0x40aec3[_0xab1f('0x38')]['$gte']['split'](',');var _0x24de27={};_0x24de27[_0x27735b[0x0]]={'$gte':moment(_0x27735b[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0xd07fcd[_0xab1f('0x40')]=_['merge'](_0xd07fcd[_0xab1f('0x40')],_0x24de27);}_0xd07fcd=_['merge']({},_0xd07fcd,_0x40aec3[_0xab1f('0x43')]);return _0x5be7ea[_0xab1f('0x5c')](_0xd07fcd);}})[_0xab1f('0x2c')](function(_0x12f46f){if(_0x12f46f){_0x343ef8=_0x12f46f[_0xab1f('0x39')];if(!_0x40aec3[_0xab1f('0x38')]['hasOwnProperty'](_0xab1f('0x3b'))){_0xd07fcd[_0xab1f('0x25')]=qs[_0xab1f('0x25')](_0x40aec3[_0xab1f('0x38')][_0xab1f('0x25')]);_0xd07fcd[_0xab1f('0x22')]=qs[_0xab1f('0x22')](_0x40aec3[_0xab1f('0x38')][_0xab1f('0x22')]);}return _0x5be7ea['getMessages'](_0xd07fcd);}})['then'](function(_0x329dca){if(_0x329dca){return _0x329dca?{'count':_0x343ef8,'rows':_0x329dca}:null;}})[_0xab1f('0x2c')](respondWithResult(_0x56f346,null))[_0xab1f('0x49')](handleError(_0x56f346,null));}; \ No newline at end of file +var _0x975e=['options','includeAll','include','rows','catch','params','fields','find','create','body','destroy','describe','ChatInternalMessage','toInteger','addMembers','omit','ids','getMembers','findOne','User','removeMembers','addMessage','ChatGroupId','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','getMessages','eml-format','rimraf','zip-dir','moment','mustache','util','path','fs-extra','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','redis','socket.io-emitter','./chatGroup.socket','sendStatus','status','json','offset','limit','count','Content-Range','apply','reject','save','then','error','stack','name','index','map','ChatGroup','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL'];(function(_0x1ff4e5,_0x350e42){var _0x7adf31=function(_0x4756ed){while(--_0x4756ed){_0x1ff4e5['push'](_0x1ff4e5['shift']());}};_0x7adf31(++_0x350e42);}(_0x975e,0xd0));var _0xe975=function(_0x1c5629,_0x5a0b4b){_0x1c5629=_0x1c5629-0x0;var _0x2c9f01=_0x975e[_0x1c5629];return _0x2c9f01;};'use strict';var emlformat=require(_0xe975('0x0'));var rimraf=require(_0xe975('0x1'));var zipdir=require(_0xe975('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xe975('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xe975('0x4'));var util=require(_0xe975('0x5'));var path=require(_0xe975('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe975('0x7'));var _=require('lodash');var squel=require(_0xe975('0x8'));var crypto=require(_0xe975('0x9'));var jsforce=require(_0xe975('0xa'));var deskjs=require(_0xe975('0xb'));var toCsv=require(_0xe975('0xc'));var querystring=require(_0xe975('0xd'));var Papa=require(_0xe975('0xe'));var Redis=require(_0xe975('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xe975('0x10'));var as=require(_0xe975('0x11'));var hardwareService=require(_0xe975('0x12'));var logger=require(_0xe975('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xe975('0x14'));var db=require(_0xe975('0x15'))['db'];config['redis']=_['defaults'](config[_0xe975('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0xe975('0x17'))(new Redis(config[_0xe975('0x16')]));require(_0xe975('0x18'))['register'](socket);function respondWithStatusCode(_0x33e699,_0x1496c5){_0x1496c5=_0x1496c5||0xcc;return function(_0x52a36a){if(_0x52a36a){return _0x33e699[_0xe975('0x19')](_0x1496c5);}return _0x33e699['status'](_0x1496c5)['end']();};}function respondWithResult(_0x3fe5bd,_0x6d280f){_0x6d280f=_0x6d280f||0xc8;return function(_0x35bb4c){if(_0x35bb4c){return _0x3fe5bd[_0xe975('0x1a')](_0x6d280f)[_0xe975('0x1b')](_0x35bb4c);}};}function respondWithFilteredResult(_0x59edbd,_0x56a4ec){return function(_0x5866fe){if(_0x5866fe){var _0x34acdc=typeof _0x56a4ec[_0xe975('0x1c')]==='undefined'&&typeof _0x56a4ec[_0xe975('0x1d')]==='undefined';var _0x2f25fc=_0x5866fe[_0xe975('0x1e')];var _0x111882=_0x34acdc?0x0:_0x56a4ec['offset'];var _0x3a8b99=_0x34acdc?_0x5866fe['count']:_0x56a4ec['offset']+_0x56a4ec['limit'];var _0x2563d3;if(_0x3a8b99>=_0x2f25fc){_0x3a8b99=_0x2f25fc;_0x2563d3=0xc8;}else{_0x2563d3=0xce;}_0x59edbd['status'](_0x2563d3);return _0x59edbd['set'](_0xe975('0x1f'),_0x111882+'-'+_0x3a8b99+'/'+_0x2f25fc)[_0xe975('0x1b')](_0x5866fe);}return null;};}function patchUpdates(_0x82c825){return function(_0x6c896a){try{jsonpatch[_0xe975('0x20')](_0x6c896a,_0x82c825,!![]);}catch(_0x127ca6){return BPromise[_0xe975('0x21')](_0x127ca6);}return _0x6c896a[_0xe975('0x22')]();};}function saveUpdates(_0x5557c4,_0x397266){return function(_0x2ba823){if(_0x2ba823){return _0x2ba823['update'](_0x5557c4)[_0xe975('0x23')](function(_0x20aaf8){return _0x20aaf8;});}return null;};}function removeEntity(_0x4f55bf,_0x1a737e){return function(_0x40eca0){if(_0x40eca0){return _0x40eca0['destroy']()[_0xe975('0x23')](function(){_0x4f55bf['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xe5e512,_0x48add6){return function(_0x48fb33){if(!_0x48fb33){_0xe5e512[_0xe975('0x19')](0x194);}return _0x48fb33;};}function handleError(_0x2dec32,_0x245bb1){_0x245bb1=_0x245bb1||0x1f4;return function(_0x28ff85){logger[_0xe975('0x24')](_0x28ff85[_0xe975('0x25')]);if(_0x28ff85['name']){delete _0x28ff85[_0xe975('0x26')];}_0x2dec32[_0xe975('0x1a')](_0x245bb1)['send'](_0x28ff85);};}exports[_0xe975('0x27')]=function(_0x3adf0d,_0x40e753){var _0x17abc8={},_0x30ed6e={},_0x26f702={'count':0x0,'rows':[]};var _0x5d88b7=_[_0xe975('0x28')](db[_0xe975('0x29')][_0xe975('0x2a')],function(_0x2b1908){return{'name':_0x2b1908[_0xe975('0x2b')],'type':_0x2b1908[_0xe975('0x2c')][_0xe975('0x2d')]};});_0x30ed6e[_0xe975('0x2e')]=_[_0xe975('0x28')](_0x5d88b7,'name');_0x30ed6e[_0xe975('0x2f')]=_[_0xe975('0x30')](_0x3adf0d[_0xe975('0x2f')]);_0x30ed6e[_0xe975('0x31')]=_[_0xe975('0x32')](_0x30ed6e['model'],_0x30ed6e['query']);_0x17abc8[_0xe975('0x33')]=_[_0xe975('0x32')](_0x30ed6e[_0xe975('0x2e')],qs['fields'](_0x3adf0d[_0xe975('0x2f')]['fields']));_0x17abc8[_0xe975('0x33')]=_0x17abc8[_0xe975('0x33')][_0xe975('0x34')]?_0x17abc8[_0xe975('0x33')]:_0x30ed6e[_0xe975('0x2e')];if(!_0x3adf0d[_0xe975('0x2f')][_0xe975('0x35')](_0xe975('0x36'))){_0x17abc8[_0xe975('0x1d')]=qs[_0xe975('0x1d')](_0x3adf0d['query']['limit']);_0x17abc8[_0xe975('0x1c')]=qs[_0xe975('0x1c')](_0x3adf0d[_0xe975('0x2f')]['offset']);}_0x17abc8[_0xe975('0x37')]=qs[_0xe975('0x38')](_0x3adf0d['query'][_0xe975('0x38')]);_0x17abc8['where']=qs[_0xe975('0x31')](_[_0xe975('0x39')](_0x3adf0d['query'],_0x30ed6e['filters']),_0x5d88b7);if(_0x3adf0d[_0xe975('0x2f')][_0xe975('0x3a')]){_0x17abc8[_0xe975('0x3b')]=_[_0xe975('0x3c')](_0x17abc8[_0xe975('0x3b')],{'$or':_[_0xe975('0x28')](_0x5d88b7,function(_0x527fc0){if(_0x527fc0[_0xe975('0x2c')]!==_0xe975('0x3d')){var _0x2f37d5={};_0x2f37d5[_0x527fc0['name']]={'$like':'%'+_0x3adf0d[_0xe975('0x2f')][_0xe975('0x3a')]+'%'};return _0x2f37d5;}})});}_0x17abc8=_[_0xe975('0x3c')]({},_0x17abc8,_0x3adf0d[_0xe975('0x3e')]);var _0x122163={'where':_0x17abc8[_0xe975('0x3b')]};return db[_0xe975('0x29')]['count'](_0x122163)[_0xe975('0x23')](function(_0x318528){_0x26f702['count']=_0x318528;if(_0x3adf0d[_0xe975('0x2f')][_0xe975('0x3f')]){_0x17abc8[_0xe975('0x40')]=[{'all':!![]}];}return db[_0xe975('0x29')]['findAll'](_0x17abc8);})[_0xe975('0x23')](function(_0x56976b){_0x26f702[_0xe975('0x41')]=_0x56976b;return _0x26f702;})[_0xe975('0x23')](respondWithFilteredResult(_0x40e753,_0x17abc8))[_0xe975('0x42')](handleError(_0x40e753,null));};exports['show']=function(_0xebdce2,_0x51f9a0){var _0x988699={'raw':!![],'where':{'id':_0xebdce2[_0xe975('0x43')]['id']}},_0x5e9c28={};_0x5e9c28[_0xe975('0x2e')]=_[_0xe975('0x30')](db[_0xe975('0x29')]['rawAttributes']);_0x5e9c28[_0xe975('0x2f')]=_[_0xe975('0x30')](_0xebdce2[_0xe975('0x2f')]);_0x5e9c28[_0xe975('0x31')]=_[_0xe975('0x32')](_0x5e9c28[_0xe975('0x2e')],_0x5e9c28['query']);_0x988699[_0xe975('0x33')]=_[_0xe975('0x32')](_0x5e9c28[_0xe975('0x2e')],qs[_0xe975('0x44')](_0xebdce2['query'][_0xe975('0x44')]));_0x988699[_0xe975('0x33')]=_0x988699[_0xe975('0x33')][_0xe975('0x34')]?_0x988699[_0xe975('0x33')]:_0x5e9c28[_0xe975('0x2e')];if(_0xebdce2[_0xe975('0x2f')]['includeAll']){_0x988699[_0xe975('0x40')]=[{'all':!![]}];}_0x988699=_['merge']({},_0x988699,_0xebdce2[_0xe975('0x3e')]);return db['ChatGroup'][_0xe975('0x45')](_0x988699)['then'](handleEntityNotFound(_0x51f9a0,null))[_0xe975('0x23')](respondWithResult(_0x51f9a0,null))['catch'](handleError(_0x51f9a0,null));};exports[_0xe975('0x46')]=function(_0x2b95d8,_0x142c93){return db[_0xe975('0x29')][_0xe975('0x46')](_0x2b95d8[_0xe975('0x47')],{})[_0xe975('0x23')](respondWithResult(_0x142c93,0xc9))['catch'](handleError(_0x142c93,null));};exports['update']=function(_0x4d1eb0,_0x5211b3){if(_0x4d1eb0[_0xe975('0x47')]['id']){delete _0x4d1eb0[_0xe975('0x47')]['id'];}return db['ChatGroup'][_0xe975('0x45')]({'where':{'id':_0x4d1eb0['params']['id']}})[_0xe975('0x23')](handleEntityNotFound(_0x5211b3,null))[_0xe975('0x23')](saveUpdates(_0x4d1eb0[_0xe975('0x47')],null))[_0xe975('0x23')](respondWithResult(_0x5211b3,null))[_0xe975('0x42')](handleError(_0x5211b3,null));};exports[_0xe975('0x48')]=function(_0x1fa51e,_0x302677){return db['ChatGroup'][_0xe975('0x45')]({'where':{'id':_0x1fa51e[_0xe975('0x43')]['id']}})[_0xe975('0x23')](handleEntityNotFound(_0x302677,null))[_0xe975('0x23')](removeEntity(_0x302677,null))['catch'](handleError(_0x302677,null));};exports[_0xe975('0x49')]=function(_0x25d66a,_0x215ca3){return db['ChatGroup'][_0xe975('0x49')]()[_0xe975('0x23')](respondWithResult(_0x215ca3,null))[_0xe975('0x42')](handleError(_0x215ca3,null));};exports['getUnread']=function(_0x38f034,_0x39ce2a,_0x21ef59){return db[_0xe975('0x4a')][_0xe975('0x1e')]({'where':{'ChatGroupId':_0x38f034[_0xe975('0x43')]['id'],'ToId':_0x38f034['user']['id'],'read':![]}})[_0xe975('0x23')](function(_0x1a814a){return{'id':_[_0xe975('0x4b')](_0x38f034[_0xe975('0x43')]['id']),'count':_0x1a814a};})[_0xe975('0x23')](respondWithResult(_0x39ce2a,null))['catch'](handleError(_0x39ce2a,null));};exports[_0xe975('0x4c')]=function(_0xe614fe,_0x1630b9,_0x5070f9){return db[_0xe975('0x29')][_0xe975('0x45')]({'where':{'id':_0xe614fe[_0xe975('0x43')]['id']}})[_0xe975('0x23')](handleEntityNotFound(_0x1630b9,null))[_0xe975('0x23')](function(_0x1264d3){if(_0x1264d3){return _0x1264d3[_0xe975('0x4c')](_0xe614fe['body']['ids'],_[_0xe975('0x4d')](_0xe614fe['body'],[_0xe975('0x4e'),'id'])||{});}})[_0xe975('0x23')](respondWithResult(_0x1630b9,null))[_0xe975('0x42')](handleError(_0x1630b9,null));};exports[_0xe975('0x4f')]=function(_0x19a51b,_0x3adea1,_0x4f7656){var _0x120064={};var _0x4b3cff={};var _0x5dfd2f;var _0x183555;return db[_0xe975('0x29')][_0xe975('0x50')]({'where':{'id':_0x19a51b[_0xe975('0x43')]['id']}})[_0xe975('0x23')](handleEntityNotFound(_0x3adea1,null))[_0xe975('0x23')](function(_0x214485){if(_0x214485){_0x5dfd2f=_0x214485;_0x4b3cff['model']=_[_0xe975('0x30')](db[_0xe975('0x51')][_0xe975('0x2a')]);_0x4b3cff[_0xe975('0x2f')]=_['keys'](_0x19a51b['query']);_0x4b3cff[_0xe975('0x31')]=_[_0xe975('0x32')](_0x4b3cff[_0xe975('0x2e')],_0x4b3cff[_0xe975('0x2f')]);_0x120064[_0xe975('0x33')]=_[_0xe975('0x32')](_0x4b3cff[_0xe975('0x2e')],qs[_0xe975('0x44')](_0x19a51b['query'][_0xe975('0x44')]));_0x120064[_0xe975('0x33')]=_0x120064[_0xe975('0x33')][_0xe975('0x34')]?_0x120064['attributes']:_0x4b3cff[_0xe975('0x2e')];_0x120064[_0xe975('0x37')]=qs[_0xe975('0x38')](_0x19a51b[_0xe975('0x2f')][_0xe975('0x38')]);_0x120064[_0xe975('0x3b')]=qs[_0xe975('0x31')](_[_0xe975('0x39')](_0x19a51b[_0xe975('0x2f')],_0x4b3cff[_0xe975('0x31')]));if(_0x19a51b[_0xe975('0x2f')][_0xe975('0x3a')]){_0x120064['where']=_[_0xe975('0x3c')](_0x120064[_0xe975('0x3b')],{'$or':_[_0xe975('0x28')](_0x120064[_0xe975('0x33')],function(_0x2db5bc){var _0x302689={};_0x302689[_0x2db5bc]={'$like':'%'+_0x19a51b['query']['filter']+'%'};return _0x302689;})});}_0x120064=_[_0xe975('0x3c')]({},_0x120064,_0x19a51b[_0xe975('0x3e')]);return _0x5dfd2f[_0xe975('0x4f')](_0x120064);}})['then'](function(_0x41fe4d){if(_0x41fe4d){_0x183555=_0x41fe4d[_0xe975('0x34')];if(!_0x19a51b[_0xe975('0x2f')][_0xe975('0x35')](_0xe975('0x36'))){_0x120064[_0xe975('0x1d')]=qs[_0xe975('0x1d')](_0x19a51b[_0xe975('0x2f')]['limit']);_0x120064[_0xe975('0x1c')]=qs['offset'](_0x19a51b[_0xe975('0x2f')][_0xe975('0x1c')]);}return _0x5dfd2f[_0xe975('0x4f')](_0x120064);}})[_0xe975('0x23')](function(_0x1190fe){if(_0x1190fe){return _0x1190fe?{'count':_0x183555,'rows':_0x1190fe}:null;}})[_0xe975('0x23')](respondWithResult(_0x3adea1,null))[_0xe975('0x42')](handleError(_0x3adea1,null));};exports[_0xe975('0x52')]=function(_0x3157dc,_0x5c335e,_0x17ac6e){return db[_0xe975('0x29')][_0xe975('0x45')]({'where':{'id':_0x3157dc[_0xe975('0x43')]['id']}})[_0xe975('0x23')](handleEntityNotFound(_0x5c335e,null))[_0xe975('0x23')](function(_0x1ecb74){if(_0x1ecb74){return _0x1ecb74[_0xe975('0x52')](_0x3157dc[_0xe975('0x2f')]['ids']);}})['then'](respondWithStatusCode(_0x5c335e,null))[_0xe975('0x42')](handleError(_0x5c335e,null));};exports[_0xe975('0x53')]=function(_0x3a758d,_0x2706f4,_0x5cb8b6){if(_0x3a758d[_0xe975('0x47')]['id']){delete _0x3a758d[_0xe975('0x47')]['id'];}return db['ChatGroup'][_0xe975('0x45')]({'where':{'id':_0x3a758d[_0xe975('0x43')]['id']}})[_0xe975('0x23')](handleEntityNotFound(_0x2706f4,null))[_0xe975('0x23')](function(_0x5cef6a){if(_0x5cef6a){_0x3a758d[_0xe975('0x47')][_0xe975('0x54')]=_0x5cef6a['id'];return db['ChatInternalMessage'][_0xe975('0x46')](_0x3a758d[_0xe975('0x47')]);}})['then'](respondWithResult(_0x2706f4,null))['catch'](handleError(_0x2706f4,null));};exports['getMessages']=function(_0x38ecab,_0xfa1616,_0x4bb304){var _0xd48106={};var _0x388f39={};var _0x204c5a;var _0x3d8573;return db[_0xe975('0x29')][_0xe975('0x50')]({'where':{'id':_0x38ecab[_0xe975('0x43')]['id']}})[_0xe975('0x23')](handleEntityNotFound(_0xfa1616,null))[_0xe975('0x23')](function(_0x3be28b){if(_0x3be28b){_0x204c5a=_0x3be28b;_0x388f39[_0xe975('0x2e')]=_['keys'](db[_0xe975('0x4a')][_0xe975('0x2a')]);_0x388f39[_0xe975('0x2f')]=_[_0xe975('0x30')](_0x38ecab[_0xe975('0x2f')]);_0x388f39[_0xe975('0x31')]=_['intersection'](_0x388f39[_0xe975('0x2e')],_0x388f39[_0xe975('0x2f')]);_0xd48106[_0xe975('0x33')]=_[_0xe975('0x32')](_0x388f39['model'],qs[_0xe975('0x44')](_0x38ecab[_0xe975('0x2f')][_0xe975('0x44')]));_0xd48106[_0xe975('0x33')]=_0xd48106['attributes'][_0xe975('0x34')]?_0xd48106[_0xe975('0x33')]:_0x388f39[_0xe975('0x2e')];_0xd48106[_0xe975('0x37')]=qs['sort'](_0x38ecab['query'][_0xe975('0x38')]);_0xd48106[_0xe975('0x3b')]=qs['filters'](_['pick'](_0x38ecab[_0xe975('0x2f')],_0x388f39[_0xe975('0x31')]));if(_0x38ecab[_0xe975('0x2f')][_0xe975('0x3a')]){_0xd48106[_0xe975('0x3b')]=_[_0xe975('0x3c')](_0xd48106['where'],{'$or':_['map'](_0xd48106[_0xe975('0x33')],function(_0x2ec25f){var _0x5a10e5={};_0x5a10e5[_0x2ec25f]={'$like':'%'+_0x38ecab[_0xe975('0x2f')][_0xe975('0x3a')]+'%'};return _0x5a10e5;})});}if(_0x38ecab[_0xe975('0x2f')][_0xe975('0x55')]){var _0x11e41b=_0x38ecab['query'][_0xe975('0x55')][_0xe975('0x56')](',');var _0x21d32e={};_0x21d32e[_0x11e41b[0x0]]={'$gte':moment(_0x11e41b[0x1])[_0xe975('0x57')](_0xe975('0x58'))};_0xd48106[_0xe975('0x3b')]=_['merge'](_0xd48106['where'],_0x21d32e);}_0xd48106=_[_0xe975('0x3c')]({},_0xd48106,_0x38ecab[_0xe975('0x3e')]);return _0x204c5a[_0xe975('0x59')](_0xd48106);}})[_0xe975('0x23')](function(_0x48400f){if(_0x48400f){_0x3d8573=_0x48400f[_0xe975('0x34')];if(!_0x38ecab[_0xe975('0x2f')][_0xe975('0x35')]('nolimit')){_0xd48106[_0xe975('0x1d')]=qs[_0xe975('0x1d')](_0x38ecab[_0xe975('0x2f')][_0xe975('0x1d')]);_0xd48106[_0xe975('0x1c')]=qs[_0xe975('0x1c')](_0x38ecab[_0xe975('0x2f')][_0xe975('0x1c')]);}return _0x204c5a[_0xe975('0x59')](_0xd48106);}})['then'](function(_0x6cdcaa){if(_0x6cdcaa){return _0x6cdcaa?{'count':_0x3d8573,'rows':_0x6cdcaa}:null;}})[_0xe975('0x23')](respondWithResult(_0xfa1616,null))[_0xe975('0x42')](handleError(_0xfa1616,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 46e9738..885e5e1 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 _0x2ace=['emit','hasOwnProperty','hook','exports','../../mysqldb','ChatGroup','setMaxListeners','update','remove'];(function(_0x393caf,_0x234484){var _0x3ad823=function(_0x1585b7){while(--_0x1585b7){_0x393caf['push'](_0x393caf['shift']());}};_0x3ad823(++_0x234484);}(_0x2ace,0x17e));var _0xe2ac=function(_0x86337d,_0x2b57c3){_0x86337d=_0x86337d-0x0;var _0x22b2c6=_0x2ace[_0x86337d];return _0x22b2c6;};'use strict';var EventEmitter=require('events');var ChatGroup=require(_0xe2ac('0x0'))['db'][_0xe2ac('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xe2ac('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xe2ac('0x3'),'afterDestroy':_0xe2ac('0x4')};function emitEvent(_0x47c3a2){return function(_0x171092,_0x464ec4,_0x240663){ChatGroupEvents[_0xe2ac('0x5')](_0x47c3a2+':'+_0x171092['id'],_0x171092);ChatGroupEvents[_0xe2ac('0x5')](_0x47c3a2,_0x171092);_0x240663(null);};}for(var e in events){if(events[_0xe2ac('0x6')](e)){var event=events[e];ChatGroup[_0xe2ac('0x7')](e,emitEvent(event));}}module[_0xe2ac('0x8')]=ChatGroupEvents; \ No newline at end of file +var _0x4d1d=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatGroup'];(function(_0x3d4774,_0x498991){var _0x187f99=function(_0x34079f){while(--_0x34079f){_0x3d4774['push'](_0x3d4774['shift']());}};_0x187f99(++_0x498991);}(_0x4d1d,0x1cb));var _0xd4d1=function(_0x2368ed,_0x52e15a){_0x2368ed=_0x2368ed-0x0;var _0xfdccbd=_0x4d1d[_0x2368ed];return _0xfdccbd;};'use strict';var EventEmitter=require(_0xd4d1('0x0'));var ChatGroup=require(_0xd4d1('0x1'))['db'][_0xd4d1('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xd4d1('0x3')](0x0);var events={'afterCreate':_0xd4d1('0x4'),'afterUpdate':_0xd4d1('0x5'),'afterDestroy':_0xd4d1('0x6')};function emitEvent(_0x372ea9){return function(_0x4191ca,_0x4845c6,_0x57ad17){ChatGroupEvents[_0xd4d1('0x7')](_0x372ea9+':'+_0x4191ca['id'],_0x4191ca);ChatGroupEvents[_0xd4d1('0x7')](_0x372ea9,_0x4191ca);_0x57ad17(null);};}for(var e in events){if(events[_0xd4d1('0x8')](e)){var event=events[e];ChatGroup[_0xd4d1('0x9')](e,emitEvent(event));}}module[_0xd4d1('0xa')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 6e1cbe0..facb409 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 _0xbd78=['../../config/environment','./chatGroup.attributes','define','ChatGroup','chat_groups','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x3bde7b,_0x5c98d0){var _0x30df0f=function(_0x11389b){while(--_0x11389b){_0x3bde7b['push'](_0x3bde7b['shift']());}};_0x30df0f(++_0x5c98d0);}(_0xbd78,0xfc));var _0x8bd7=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xbd78[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0x8bd7('0x0'));var util=require(_0x8bd7('0x1'));var logger=require(_0x8bd7('0x2'))(_0x8bd7('0x3'));var moment=require('moment');var BPromise=require(_0x8bd7('0x4'));var rp=require(_0x8bd7('0x5'));var fs=require('fs');var path=require(_0x8bd7('0x6'));var rimraf=require(_0x8bd7('0x7'));var config=require(_0x8bd7('0x8'));var attributes=require(_0x8bd7('0x9'));module['exports']=function(_0x16c76d,_0x351123){return _0x16c76d[_0x8bd7('0xa')](_0x8bd7('0xb'),attributes,{'tableName':_0x8bd7('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfdfd=['util','../../config/logger','api','request-promise','path','../../config/environment','./chatGroup.attributes','exports','define','ChatGroup','chat_groups','lodash'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0xfdfd,0x14f));var _0xdfdf=function(_0x47bc6f,_0x17205b){_0x47bc6f=_0x47bc6f-0x0;var _0x168545=_0xfdfd[_0x47bc6f];return _0x168545;};'use strict';var _=require(_0xdfdf('0x0'));var util=require(_0xdfdf('0x1'));var logger=require(_0xdfdf('0x2'))(_0xdfdf('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xdfdf('0x4'));var fs=require('fs');var path=require(_0xdfdf('0x5'));var rimraf=require('rimraf');var config=require(_0xdfdf('0x6'));var attributes=require(_0xdfdf('0x7'));module[_0xdfdf('0x8')]=function(_0x559d10,_0x2e6e1e){return _0x559d10[_0xdfdf('0x9')](_0xdfdf('0xa'),attributes,{'tableName':_0xdfdf('0xb'),'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 5b4c559..bab27a6 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 _0xe799=['jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x2111bc,_0x2d65d5){var _0x1ff93b=function(_0x2cfb28){while(--_0x2cfb28){_0x2111bc['push'](_0x2111bc['shift']());}};_0x1ff93b(++_0x2d65d5);}(_0xe799,0x170));var _0x9e79=function(_0x4532c0,_0x18bf16){_0x4532c0=_0x4532c0-0x0;var _0x598927=_0xe799[_0x4532c0];return _0x598927;};'use strict';var _=require(_0x9e79('0x0'));var util=require('util');var moment=require(_0x9e79('0x1'));var BPromise=require('bluebird');var rs=require(_0x9e79('0x2'));var fs=require('fs');var Redis=require(_0x9e79('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x9e79('0x4'));var logger=require(_0x9e79('0x5'))(_0x9e79('0x6'));var config=require('../../config/environment');var jayson=require(_0x9e79('0x7'));var client=jayson['client'][_0x9e79('0x8')]({'port':0x232a});config[_0x9e79('0x9')]=_[_0x9e79('0xa')](config['redis'],{'host':_0x9e79('0xb'),'port':0x18eb});var socket=require(_0x9e79('0xc'))(new Redis(config['redis']));require(_0x9e79('0xd'))[_0x9e79('0xe')](socket);function respondWithRpcPromise(_0xc46eed,_0x6464d6,_0x502f36){return new BPromise(function(_0x43bd7a,_0x15efc4){return client['request'](_0xc46eed,_0x502f36)[_0x9e79('0xf')](function(_0x127c92){logger[_0x9e79('0x10')](_0x9e79('0x11'),_0x6464d6,_0x9e79('0x12'));logger['debug'](_0x9e79('0x13'),_0x6464d6,_0x9e79('0x12'),JSON[_0x9e79('0x14')](_0x127c92));if(_0x127c92[_0x9e79('0x15')]){if(_0x127c92[_0x9e79('0x15')][_0x9e79('0x16')]===0x1f4){logger[_0x9e79('0x15')](_0x9e79('0x11'),_0x6464d6,_0x127c92[_0x9e79('0x15')][_0x9e79('0x17')]);return _0x15efc4(_0x127c92[_0x9e79('0x15')][_0x9e79('0x17')]);}logger['error'](_0x9e79('0x11'),_0x6464d6,_0x127c92['error'][_0x9e79('0x17')]);return _0x43bd7a(_0x127c92[_0x9e79('0x15')]['message']);}else{logger[_0x9e79('0x10')](_0x9e79('0x11'),_0x6464d6,'request\x20sent');_0x43bd7a(_0x127c92['result'][_0x9e79('0x17')]);}})[_0x9e79('0x18')](function(_0x33e7a2){logger[_0x9e79('0x15')](_0x9e79('0x11'),_0x6464d6,_0x33e7a2);_0x15efc4(_0x33e7a2);});});} \ No newline at end of file +var _0x1f89=['socket.io-emitter','register','request','ChatGroup,\x20%s,\x20%s','ChatGroup,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults'];(function(_0x3a9534,_0x104c89){var _0x15c911=function(_0x472617){while(--_0x472617){_0x3a9534['push'](_0x3a9534['shift']());}};_0x15c911(++_0x104c89);}(_0x1f89,0x14c));var _0x91f8=function(_0x44a9cf,_0x11ddb5){_0x44a9cf=_0x44a9cf-0x0;var _0x5d67c2=_0x1f89[_0x44a9cf];return _0x5d67c2;};'use strict';var _=require(_0x91f8('0x0'));var util=require(_0x91f8('0x1'));var moment=require(_0x91f8('0x2'));var BPromise=require(_0x91f8('0x3'));var rs=require(_0x91f8('0x4'));var fs=require('fs');var Redis=require(_0x91f8('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x91f8('0x6'));var logger=require('../../config/logger')(_0x91f8('0x7'));var config=require(_0x91f8('0x8'));var jayson=require(_0x91f8('0x9'));var client=jayson['client'][_0x91f8('0xa')]({'port':0x232a});config[_0x91f8('0xb')]=_[_0x91f8('0xc')](config[_0x91f8('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x91f8('0xd'))(new Redis(config[_0x91f8('0xb')]));require('./chatGroup.socket')[_0x91f8('0xe')](socket);function respondWithRpcPromise(_0x5a508e,_0x43d6ad,_0x38a402){return new BPromise(function(_0x3dc8b0,_0x103ed5){return client[_0x91f8('0xf')](_0x5a508e,_0x38a402)['then'](function(_0x1c25e7){logger['info'](_0x91f8('0x10'),_0x43d6ad,'request\x20sent');logger['debug'](_0x91f8('0x11'),_0x43d6ad,_0x91f8('0x12'),JSON['stringify'](_0x1c25e7));if(_0x1c25e7[_0x91f8('0x13')]){if(_0x1c25e7[_0x91f8('0x13')][_0x91f8('0x14')]===0x1f4){logger[_0x91f8('0x13')]('ChatGroup,\x20%s,\x20%s',_0x43d6ad,_0x1c25e7['error']['message']);return _0x103ed5(_0x1c25e7['error'][_0x91f8('0x15')]);}logger[_0x91f8('0x13')](_0x91f8('0x10'),_0x43d6ad,_0x1c25e7[_0x91f8('0x13')][_0x91f8('0x15')]);return _0x3dc8b0(_0x1c25e7[_0x91f8('0x13')]['message']);}else{logger['info'](_0x91f8('0x10'),_0x43d6ad,_0x91f8('0x12'));_0x3dc8b0(_0x1c25e7['result']['message']);}})[_0x91f8('0x16')](function(_0x2ad8e8){logger[_0x91f8('0x13')](_0x91f8('0x10'),_0x43d6ad,_0x2ad8e8);_0x103ed5(_0x2ad8e8);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 273aab6..6d66bfa 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 _0x383a=['register','length','./chatGroup.events','save','remove','emit','removeListener'];(function(_0x2ef076,_0x7e4f75){var _0x202f26=function(_0x277542){while(--_0x277542){_0x2ef076['push'](_0x2ef076['shift']());}};_0x202f26(++_0x7e4f75);}(_0x383a,0xb1));var _0xa383=function(_0x315216,_0x15d0cc){_0x315216=_0x315216-0x0;var _0x4dfb84=_0x383a[_0x315216];return _0x4dfb84;};'use strict';var ChatGroupEvents=require(_0xa383('0x0'));var events=[_0xa383('0x1'),_0xa383('0x2'),'update'];function createListener(_0x4c5afb,_0x5f0fd1){return function(_0x422361){_0x5f0fd1[_0xa383('0x3')](_0x4c5afb,_0x422361);};}function removeListener(_0xd98016,_0x126341){return function(){ChatGroupEvents[_0xa383('0x4')](_0xd98016,_0x126341);};}exports[_0xa383('0x5')]=function(_0x4fd756){for(var _0x1bbcef=0x0,_0x75d54c=events[_0xa383('0x6')];_0x1bbcef<_0x75d54c;_0x1bbcef++){var _0x2d1c43=events[_0x1bbcef];var _0x3fe5a4=createListener('chatGroup:'+_0x2d1c43,_0x4fd756);ChatGroupEvents['on'](_0x2d1c43,_0x3fe5a4);}}; \ No newline at end of file +var _0x4889=['save','emit','removeListener','register','length'];(function(_0x2ec6ce,_0x1a22f8){var _0x528b51=function(_0x2546c1){while(--_0x2546c1){_0x2ec6ce['push'](_0x2ec6ce['shift']());}};_0x528b51(++_0x1a22f8);}(_0x4889,0x1ef));var _0x9488=function(_0x149db1,_0x25f28b){_0x149db1=_0x149db1-0x0;var _0x2059a8=_0x4889[_0x149db1];return _0x2059a8;};'use strict';var ChatGroupEvents=require('./chatGroup.events');var events=[_0x9488('0x0'),'remove','update'];function createListener(_0xa9af12,_0xe5b843){return function(_0x428dcb){_0xe5b843[_0x9488('0x1')](_0xa9af12,_0x428dcb);};}function removeListener(_0x3d1ab7,_0x193a6c){return function(){ChatGroupEvents[_0x9488('0x2')](_0x3d1ab7,_0x193a6c);};}exports[_0x9488('0x3')]=function(_0x1f55ff){for(var _0x6a381=0x0,_0x43f02e=events[_0x9488('0x4')];_0x6a381<_0x43f02e;_0x6a381++){var _0x55ff41=events[_0x6a381];var _0x44e589=createListener('chatGroup:'+_0x55ff41,_0x1f55ff);ChatGroupEvents['on'](_0x55ff41,_0x44e589);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 9dc4e30..ab0fc87 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 _0x2a72=['delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./chatGroup.controller','get','isAuthenticated','index','describe','/:id','/:id/unread','getUnread','/:id/members','getMembers','/:id/messages','post','create','addMembers','addMessage','put'];(function(_0x473463,_0x21da73){var _0x42f406=function(_0x34a5be){while(--_0x34a5be){_0x473463['push'](_0x473463['shift']());}};_0x42f406(++_0x21da73);}(_0x2a72,0x121));var _0x22a7=function(_0x42b7b3,_0x2e0015){_0x42b7b3=_0x42b7b3-0x0;var _0x4284e7=_0x2a72[_0x42b7b3];return _0x4284e7;};'use strict';var multer=require(_0x22a7('0x0'));var util=require(_0x22a7('0x1'));var path=require(_0x22a7('0x2'));var timeout=require(_0x22a7('0x3'));var express=require('express');var router=express[_0x22a7('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x22a7('0x5'));var interaction=require(_0x22a7('0x6'));var config=require('../../config/environment');var controller=require(_0x22a7('0x7'));router[_0x22a7('0x8')]('/',auth[_0x22a7('0x9')](),controller[_0x22a7('0xa')]);router[_0x22a7('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x22a7('0xb')]);router[_0x22a7('0x8')](_0x22a7('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x22a7('0x8')](_0x22a7('0xd'),auth[_0x22a7('0x9')](),controller[_0x22a7('0xe')]);router[_0x22a7('0x8')](_0x22a7('0xf'),auth[_0x22a7('0x9')](),controller[_0x22a7('0x10')]);router[_0x22a7('0x8')](_0x22a7('0x11'),auth[_0x22a7('0x9')](),controller['getMessages']);router[_0x22a7('0x12')]('/',auth[_0x22a7('0x9')](),controller[_0x22a7('0x13')]);router[_0x22a7('0x12')]('/:id/members',auth[_0x22a7('0x9')](),controller[_0x22a7('0x14')]);router[_0x22a7('0x12')](_0x22a7('0x11'),auth[_0x22a7('0x9')](),controller[_0x22a7('0x15')]);router[_0x22a7('0x16')](_0x22a7('0xc'),auth[_0x22a7('0x9')](),controller['update']);router[_0x22a7('0x17')](_0x22a7('0xc'),auth[_0x22a7('0x9')](),controller[_0x22a7('0x18')]);router[_0x22a7('0x17')]('/:id/members',auth[_0x22a7('0x9')](),controller['removeMembers']);module[_0x22a7('0x19')]=router; \ No newline at end of file +var _0x3a56=['getMembers','/:id/messages','getMessages','post','create','addMembers','addMessage','put','/:id','update','delete','destroy','removeMembers','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/describe','isAuthenticated','describe','show','/:id/unread','getUnread','/:id/members'];(function(_0x4e135d,_0x5f54d1){var _0x466163=function(_0x26d68b){while(--_0x26d68b){_0x4e135d['push'](_0x4e135d['shift']());}};_0x466163(++_0x5f54d1);}(_0x3a56,0x143));var _0x63a5=function(_0x513aa5,_0x1fba79){_0x513aa5=_0x513aa5-0x0;var _0x1a1a7c=_0x3a56[_0x513aa5];return _0x1a1a7c;};'use strict';var multer=require(_0x63a5('0x0'));var util=require('util');var path=require(_0x63a5('0x1'));var timeout=require(_0x63a5('0x2'));var express=require(_0x63a5('0x3'));var router=express[_0x63a5('0x4')]();var fs_extra=require(_0x63a5('0x5'));var auth=require(_0x63a5('0x6'));var interaction=require(_0x63a5('0x7'));var config=require(_0x63a5('0x8'));var controller=require('./chatGroup.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x63a5('0x9')]);router[_0x63a5('0xa')](_0x63a5('0xb'),auth[_0x63a5('0xc')](),controller[_0x63a5('0xd')]);router[_0x63a5('0xa')]('/:id',auth[_0x63a5('0xc')](),controller[_0x63a5('0xe')]);router[_0x63a5('0xa')](_0x63a5('0xf'),auth['isAuthenticated'](),controller[_0x63a5('0x10')]);router['get'](_0x63a5('0x11'),auth['isAuthenticated'](),controller[_0x63a5('0x12')]);router['get'](_0x63a5('0x13'),auth[_0x63a5('0xc')](),controller[_0x63a5('0x14')]);router[_0x63a5('0x15')]('/',auth[_0x63a5('0xc')](),controller[_0x63a5('0x16')]);router[_0x63a5('0x15')](_0x63a5('0x11'),auth['isAuthenticated'](),controller[_0x63a5('0x17')]);router[_0x63a5('0x15')](_0x63a5('0x13'),auth[_0x63a5('0xc')](),controller[_0x63a5('0x18')]);router[_0x63a5('0x19')](_0x63a5('0x1a'),auth['isAuthenticated'](),controller[_0x63a5('0x1b')]);router[_0x63a5('0x1c')](_0x63a5('0x1a'),auth[_0x63a5('0xc')](),controller[_0x63a5('0x1d')]);router[_0x63a5('0x1c')](_0x63a5('0x11'),auth[_0x63a5('0xc')](),controller[_0x63a5('0x1e')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index b3a9037..1d05bf4 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 _0x8a5c=['DATE','long','sequelize','exports','BOOLEAN','INTEGER','ENUM','star','thumb','TEXT','STRING'];(function(_0x240a17,_0x4a0bf8){var _0x58b5a4=function(_0x30e869){while(--_0x30e869){_0x240a17['push'](_0x240a17['shift']());}};_0x58b5a4(++_0x4a0bf8);}(_0x8a5c,0x136));var _0xc8a5=function(_0x5e01c6,_0x30bc2c){_0x5e01c6=_0x5e01c6-0x0;var _0x5d7383=_0x8a5c[_0x5e01c6];return _0x5d7383;};'use strict';var Sequelize=require(_0xc8a5('0x0'));module[_0xc8a5('0x1')]={'closed':{'type':Sequelize[_0xc8a5('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xc8a5('0x3')]},'ratingType':{'type':Sequelize[_0xc8a5('0x4')](_0xc8a5('0x5'),_0xc8a5('0x6')),'defaultValue':_0xc8a5('0x5')},'ratingMessage':{'type':Sequelize[_0xc8a5('0x7')]},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize[_0xc8a5('0x8')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xc8a5('0x9')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xc8a5('0x8')]},'thirdDisposition':{'type':Sequelize[_0xc8a5('0x8')]},'note':{'type':Sequelize[_0xc8a5('0x8')]},'browserName':{'type':Sequelize[_0xc8a5('0x8')]},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize[_0xc8a5('0x8')]},'osVersion':{'type':Sequelize[_0xc8a5('0x8')]},'deviceModel':{'type':Sequelize[_0xc8a5('0x8')]},'deviceVendor':{'type':Sequelize[_0xc8a5('0x8')]},'deviceType':{'type':Sequelize[_0xc8a5('0x8')]},'referer':{'type':Sequelize[_0xc8a5('0x7')]},'customerIp':{'type':Sequelize[_0xc8a5('0x8')]},'formData':{'type':Sequelize[_0xc8a5('0x7')](_0xc8a5('0xa'))},'read1stAt':{'type':Sequelize['DATE']},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xc8a5('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xc8a5('0x8')]},'customerPort':{'type':Sequelize[_0xc8a5('0x8')]},'vidaooSessionId':{'type':Sequelize[_0xc8a5('0x7')]},'autoreplyExecuted':{'type':Sequelize[_0xc8a5('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0xe511=['DATE','long','ENUM','out','sequelize','exports','INTEGER','star','thumb','TEXT','STRING'];(function(_0xb42aba,_0x5c15fc){var _0x4cf479=function(_0x543b57){while(--_0x543b57){_0xb42aba['push'](_0xb42aba['shift']());}};_0x4cf479(++_0x5c15fc);}(_0xe511,0x16f));var _0x1e51=function(_0x272d90,_0x5e70ff){_0x272d90=_0x272d90-0x0;var _0x2bf4a2=_0xe511[_0x272d90];return _0x2bf4a2;};'use strict';var Sequelize=require(_0x1e51('0x0'));module[_0x1e51('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x1e51('0x2')]},'ratingType':{'type':Sequelize['ENUM'](_0x1e51('0x3'),_0x1e51('0x4')),'defaultValue':'star'},'ratingMessage':{'type':Sequelize[_0x1e51('0x5')]},'pathTranscript':{'type':Sequelize[_0x1e51('0x5')]},'mailTranscript':{'type':Sequelize[_0x1e51('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x1e51('0x7')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x1e51('0x6')]},'thirdDisposition':{'type':Sequelize[_0x1e51('0x6')]},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize[_0x1e51('0x6')]},'osName':{'type':Sequelize[_0x1e51('0x6')]},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize[_0x1e51('0x6')]},'deviceType':{'type':Sequelize[_0x1e51('0x6')]},'referer':{'type':Sequelize[_0x1e51('0x5')]},'customerIp':{'type':Sequelize[_0x1e51('0x6')]},'formData':{'type':Sequelize[_0x1e51('0x5')](_0x1e51('0x8'))},'read1stAt':{'type':Sequelize['DATE']},'lastMsgAt':{'type':Sequelize[_0x1e51('0x7')]},'lastMsgDirection':{'type':Sequelize[_0x1e51('0x9')]('in',_0x1e51('0xa')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x1e51('0x6')]},'customerPort':{'type':Sequelize[_0x1e51('0x6')]},'vidaooSessionId':{'type':Sequelize[_0x1e51('0x5')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 5227d15..32a4210 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 _0x153f=['sendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','YYYY-MM-DD\x20HH:mm:ss','include','findAll','getMyMessages','setTags','spread','emit','chatInteractionTags:save','unix','server','files','tmp','attachments','transcript-%d-%s.zip','Attachment','secret','read','Account','Owner','get','mkdirSync','Chat','N.A.','browserName','referer','customerIp','customerPort','tail','existsSync','createReadStream','createWriteStream','lastName','renderFile','views','transcript-','err','unlinkSync','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','ejs','squel','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','jayson/promise','client','http','request','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','update','then','destroy','stack','name','send','render','merge','contact','agent','interaction','account','Users','map','TagIds','split','Tags','push','catch','waiting','talking','answered','unmanaged','closed','UserId','disposition','abandoned','total','index','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','sort','where','pick','select','field','color','from','tools_tags','u.id','u.fullname','ui.ChatInteractionId','user_has_chat_interactions','left_join','users','u.id\x20=\x20ui.UserId','chat_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','chat_websites','a.id\x20=\x20i.ChatWebsiteId','chat_messages','me.ChatInteractionId\x20=\x20i.id','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','length','find','value','`\x20=\x200','having','Contact','operator','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','Tag','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','buildExpression','start','body','some','compact','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','concat','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','isNumeric','i.id\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','Sequelize','QueryTypes','SELECT','clone','i.id','unreadMessages','order','contactName','DESC','isEmpty','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','role','sequelize','toString','keyBy','ChatInteraction','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','Account.key','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','Owner.fullname','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','ChatInteractionId','rows','show','params','fields','includeAll','options','create','describe','createVidaooSession','findOne','ChatWebsite','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','email','isNull','vidaooMetadata','metadata','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','customUpdate','CmContact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','Interaction\x20already\x20assigned','attachmentUpload','file','originalname','basename','filename','mimetype','attachmentDownload','Unauthorized','attachId','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','download','close','mailTranscript','server/files/chat/upload/','pathTranscript','Messages','%s%d','agentAlias','System','customer','format','Visitor','agentIdentifier','website_alias','agent_alias','alias','fullname','[%s]\x20%s:\x20%s\x0a','createdAt','direction','appendFileSync','Smtp','CloudProvider','getSmtpOptions','SendMail'];(function(_0x1dc0b9,_0x43ffca){var _0x20013a=function(_0x147ffa){while(--_0x147ffa){_0x1dc0b9['push'](_0x1dc0b9['shift']());}};_0x20013a(++_0x43ffca);}(_0x153f,0x15b));var _0xf153=function(_0x1cff93,_0x1d1ead){_0x1cff93=_0x1cff93-0x0;var _0x12d1e6=_0x153f[_0x1cff93];return _0x12d1e6;};'use strict';var rimraf=require(_0xf153('0x0'));var zipdir=require(_0xf153('0x1'));var rp=require(_0xf153('0x2'));var moment=require(_0xf153('0x3'));var BPromise=require(_0xf153('0x4'));var Mustache=require(_0xf153('0x5'));var util=require(_0xf153('0x6'));var path=require('path');var ejs=require(_0xf153('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0xf153('0x8'));var Redis=require(_0xf153('0x9'));var qs=require(_0xf153('0xa'));var as=require(_0xf153('0xb'));var pdf=require(_0xf153('0xc'));var logger=require('../../config/logger')(_0xf153('0xd'));var config=require(_0xf153('0xe'));var db=require(_0xf153('0xf'))['db'];config[_0xf153('0x10')]=_[_0xf153('0x11')](config[_0xf153('0x10')],{'host':_0xf153('0x12'),'port':0x18eb});var socket=require(_0xf153('0x13'))(new Redis(config[_0xf153('0x10')]));require(_0xf153('0x14'))['register'](socket);var jayson=require(_0xf153('0x15'));var client=jayson[_0xf153('0x16')][_0xf153('0x17')]({'port':0x232b});var client9004=jayson['client'][_0xf153('0x17')]({'port':0x232c});function respondWithRpcPromise(_0x292f89,_0x65756d,_0x1cc666,_0x256b7d){return new BPromise(function(_0x107d31,_0x3f915c){var _0x1d54c4=_0x256b7d||client;return _0x1d54c4[_0xf153('0x18')](_0x292f89,_0x1cc666)['then'](function(_0x18be7e){logger[_0xf153('0x19')](_0xf153('0x1a'),_0x65756d,_0xf153('0x1b'));logger[_0xf153('0x1c')](_0xf153('0x1d'),_0x65756d,_0xf153('0x1b'),JSON[_0xf153('0x1e')](_0x18be7e));if(_0x18be7e['error']){if(_0x18be7e[_0xf153('0x1f')]['code']===0x1f4){logger[_0xf153('0x1f')](_0xf153('0x1a'),_0x65756d,_0x18be7e[_0xf153('0x1f')][_0xf153('0x20')]);return _0x3f915c(_0x18be7e['error'][_0xf153('0x20')]);}logger[_0xf153('0x1f')](_0xf153('0x1a'),_0x65756d,_0x18be7e[_0xf153('0x1f')][_0xf153('0x20')]);return _0x107d31(_0x18be7e[_0xf153('0x1f')][_0xf153('0x20')]);}else{logger[_0xf153('0x19')](_0xf153('0x1a'),_0x65756d,_0xf153('0x1b'));_0x107d31(_0x18be7e[_0xf153('0x21')][_0xf153('0x20')]);}})['catch'](function(_0xcd5762){logger[_0xf153('0x1f')](_0xf153('0x1a'),_0x65756d,_0xcd5762);_0x3f915c(_0xcd5762);});});}function respondWithStatusCode(_0x32e759,_0x5c9f44){_0x5c9f44=_0x5c9f44||0xcc;return function(_0x3e94b5){if(_0x3e94b5){return _0x32e759[_0xf153('0x22')](_0x5c9f44);}return _0x32e759[_0xf153('0x23')](_0x5c9f44)[_0xf153('0x24')]();};}function respondWithResult(_0x38190c,_0x1570fc){_0x1570fc=_0x1570fc||0xc8;return function(_0x39f3ed){if(_0x39f3ed){return _0x38190c[_0xf153('0x23')](_0x1570fc)[_0xf153('0x25')](_0x39f3ed);}};}function respondWithFilteredResult(_0xe490f8,_0x35f9da){return function(_0x141ef4){if(_0x141ef4){var _0x703adb=typeof _0x35f9da[_0xf153('0x26')]===_0xf153('0x27')&&typeof _0x35f9da['limit']===_0xf153('0x27');var _0x3f1c6f=_0x141ef4['count'];var _0x16cdcd=_0x703adb?0x0:_0x35f9da[_0xf153('0x26')];var _0x4e45f9=_0x703adb?_0x141ef4[_0xf153('0x28')]:_0x35f9da[_0xf153('0x26')]+_0x35f9da[_0xf153('0x29')];var _0x2b9a9c;if(_0x4e45f9>=_0x3f1c6f){_0x4e45f9=_0x3f1c6f;_0x2b9a9c=0xc8;}else{_0x2b9a9c=0xce;}_0xe490f8[_0xf153('0x23')](_0x2b9a9c);return _0xe490f8[_0xf153('0x2a')](_0xf153('0x2b'),_0x16cdcd+'-'+_0x4e45f9+'/'+_0x3f1c6f)[_0xf153('0x25')](_0x141ef4);}return null;};}function saveUpdates(_0x19a568){return function(_0x8e31bf){if(_0x8e31bf){return _0x8e31bf[_0xf153('0x2c')](_0x19a568)[_0xf153('0x2d')](function(_0x5b5237){return _0x5b5237;});}return null;};}function removeEntity(_0x258fb0){return function(_0xbb3619){if(_0xbb3619){return _0xbb3619[_0xf153('0x2e')]()[_0xf153('0x2d')](function(){_0x258fb0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x28433d){return function(_0x4c6ea0){if(!_0x4c6ea0){_0x28433d['sendStatus'](0x194);}return _0x4c6ea0;};}function handleError(_0x2473d0,_0x4ab958){_0x4ab958=_0x4ab958||0x1f4;return function(_0x2b9623){logger['error'](_0x2b9623[_0xf153('0x2f')]);if(_0x2b9623[_0xf153('0x30')]){delete _0x2b9623['name'];}_0x2473d0[_0xf153('0x23')](_0x4ab958)[_0xf153('0x31')](_0x2b9623);};}function getMustacheRender(_0x538069,_0x40be52){return Mustache[_0xf153('0x32')](_0x538069,_[_0xf153('0x33')](_0x40be52['body'],{'contact':_0x40be52[_0xf153('0x34')],'message':_0x40be52['message'],'agent':_0x40be52[_0xf153('0x35')],'interaction':_0x40be52[_0xf153('0x36')],'account':_0x40be52[_0xf153('0x37')]}))||'';}function getInteractionUsers(_0x1820c3,_0x274bcc){return new BPromise(function(_0x284fe8,_0x4becf3){try{if(_0x274bcc[_0x1820c3['id']]){_0x1820c3[_0xf153('0x38')]=_[_0xf153('0x39')](_0x274bcc[_0x1820c3['id']],function(_0x332809){return{'id':_0x332809['id'],'fullname':_0x332809['fullname']};});}}catch(_0x244172){_0x4becf3(_0x244172);}_0x284fe8(_0x1820c3);});}function getInteractionTags(_0x17d60c,_0xd2a763){return new BPromise(function(_0x254692,_0x36c5cd){try{if(_0x17d60c[_0xf153('0x3a')]){_0x17d60c['Tags']=[];_0x17d60c[_0xf153('0x3a')][_0xf153('0x3b')](',')['forEach'](function(_0x14b2e3){_0x17d60c[_0xf153('0x3c')][_0xf153('0x3d')](_0xd2a763[_0x14b2e3]);});}delete _0x17d60c[_0xf153('0x3a')];}catch(_0x103b91){_0x36c5cd(_0x103b91);}_0x254692(_0x17d60c);});}function updateChatInteraction(_0x42360a,_0xef1510,_0x4d90c1){return new BPromise(function(_0x355131,_0x2f63d6){return getInteractionUsers(_0x42360a,_0x4d90c1)[_0xf153('0x2d')](function(_0x352e7c){return getInteractionTags(_0x352e7c,_0xef1510);})[_0xf153('0x2d')](function(_0x1ee606){return getStateInteraction(_0x1ee606);})['then'](function(_0x4b108e){_0x355131(_0x4b108e);})[_0xf153('0x3e')](function(_0x5051f3){_0x2f63d6(_0x5051f3);});});}function getStateInteraction(_0x46dd09){return new BPromise(function(_0x36c456){_0x46dd09[_0xf153('0x3f')]=0x0;_0x46dd09[_0xf153('0x40')]=0x0;_0x46dd09[_0xf153('0x41')]=0x0;_0x46dd09[_0xf153('0x42')]=0x0;_0x46dd09['abandoned']=0x0;_0x46dd09['total']=0x0;if(!_0x46dd09[_0xf153('0x43')]&&!_0x46dd09[_0xf153('0x44')]){_0x46dd09['waiting']+=0x1;}if(!_0x46dd09[_0xf153('0x43')]&&_0x46dd09[_0xf153('0x44')]){_0x46dd09[_0xf153('0x40')]+=0x1;if(_0x46dd09[_0xf153('0x3f')]){_0x46dd09[_0xf153('0x3f')]-=0x1;}}if(_0x46dd09[_0xf153('0x43')]&&_0x46dd09[_0xf153('0x45')]===_0xf153('0x46')){_0x46dd09[_0xf153('0x46')]+=0x1;if(_0x46dd09[_0xf153('0x3f')]){_0x46dd09[_0xf153('0x3f')]-=0x1;}}else if(_0x46dd09[_0xf153('0x43')]&&!_0x46dd09['UserId']&&_0x46dd09[_0xf153('0x45')]){_0x46dd09[_0xf153('0x42')]+=0x1;if(_0x46dd09[_0xf153('0x3f')]){_0x46dd09['waiting']-=0x1;}}else if(_0x46dd09[_0xf153('0x43')]&&_0x46dd09[_0xf153('0x44')]){_0x46dd09['answered']+=0x1;if(_0x46dd09[_0xf153('0x40')]){_0x46dd09['talking']-=0x1;}}_0x46dd09[_0xf153('0x47')]+=0x1;_0x36c456(_0x46dd09);});}exports[_0xf153('0x48')]=function(_0x17fb10,_0x550d45){var _0x1f540b={},_0x209048={},_0x1426eb={'count':0x0,'rows':[]};var _0x1bece2=_[_0xf153('0x39')](db['ChatInteraction'][_0xf153('0x49')],function(_0x3bc265){return{'name':_0x3bc265['fieldName'],'type':_0x3bc265[_0xf153('0x4a')][_0xf153('0x4b')]};});_0x209048[_0xf153('0x4c')]=_['map'](_0x1bece2,_0xf153('0x30'));_0x209048[_0xf153('0x4d')]=_[_0xf153('0x4e')](_0x17fb10[_0xf153('0x4d')]);_0x209048[_0xf153('0x4f')]=_[_0xf153('0x50')](_0x209048[_0xf153('0x4c')],_0x209048[_0xf153('0x4d')]);_0x1f540b[_0xf153('0x51')]=_['intersection'](_0x209048[_0xf153('0x4c')],qs['fields'](_0x17fb10['query']['fields']));_0x1f540b[_0xf153('0x51')]=_0x1f540b[_0xf153('0x51')]['length']?_0x1f540b[_0xf153('0x51')]:_0x209048[_0xf153('0x4c')];if(!_0x17fb10['query'][_0xf153('0x52')](_0xf153('0x53'))){_0x1f540b[_0xf153('0x29')]=qs[_0xf153('0x29')](_0x17fb10[_0xf153('0x4d')][_0xf153('0x29')]);_0x1f540b['offset']=qs[_0xf153('0x26')](_0x17fb10[_0xf153('0x4d')]['offset']);}_0x1f540b['order']=qs[_0xf153('0x54')](_0x17fb10[_0xf153('0x4d')][_0xf153('0x54')]);_0x1f540b[_0xf153('0x55')]=qs[_0xf153('0x4f')](_[_0xf153('0x56')](_0x17fb10['query'],_0x209048[_0xf153('0x4f')]),_0x1bece2);var _0x51d813=[];var _0x340aba=squel[_0xf153('0x57')]()[_0xf153('0x58')]('id')['field'](_0xf153('0x30'))[_0xf153('0x58')](_0xf153('0x59'))[_0xf153('0x5a')](_0xf153('0x5b'));var _0x18d0ce=squel[_0xf153('0x57')]()['field'](_0xf153('0x5c'))[_0xf153('0x58')](_0xf153('0x5d'))['field'](_0xf153('0x5e'))[_0xf153('0x5a')](_0xf153('0x5f'),'ui')[_0xf153('0x60')](_0xf153('0x61'),'u',_0xf153('0x62'));var _0x245124=squel[_0xf153('0x57')]()['from'](_0xf153('0x63'),'i')[_0xf153('0x60')]('cm_contacts','c',_0xf153('0x64'))[_0xf153('0x60')](_0xf153('0x61'),'o',_0xf153('0x65'))[_0xf153('0x60')](_0xf153('0x66'),'a',_0xf153('0x67'))[_0xf153('0x60')](_0xf153('0x68'),'me',_0xf153('0x69'))[_0xf153('0x60')]('chat_interaction_has_tags','it',_0xf153('0x6a'))[_0xf153('0x60')]('tools_tags','t',_0xf153('0x6b'));var _0x25e66e=squel[_0xf153('0x6c')]();var _0x147d3a=[];var _0x603892=squel[_0xf153('0x6c')]();var _0x2736e3;if(_0x17fb10['query'][_0xf153('0x6d')]){_0x2736e3=as[_0xf153('0x6e')](_0x17fb10[_0xf153('0x4d')][_0xf153('0x6d')]);var _0x17f58d=_0x2736e3[_0xf153('0x6f')];for(var _0x19ec0b=0x0;_0x19ec0b<_0x2736e3[_0xf153('0x70')][_0xf153('0x71')];_0x19ec0b++){var _0x4c9157=_0x2736e3[_0xf153('0x70')][_0x19ec0b];var _0x433566='i';var _0x4afdc4=_[_0xf153('0x72')](_0x1bece2,['name',_0x4c9157[_0xf153('0x58')]]);if(!_0x4afdc4){switch(_0x4c9157[_0xf153('0x58')]){case'unreadMessages':if(_0x4c9157[_0xf153('0x73')]==0x1){_0x245124['having']('`'+_0x4c9157[_0xf153('0x58')]+_0xf153('0x74'));}else{_0x245124[_0xf153('0x75')]('`'+_0x4c9157[_0xf153('0x58')]+'`\x20>\x200');}break;case _0xf153('0x76'):if(_0x4c9157[_0xf153('0x77')]==='$substring'){if(_0x4c9157[_0xf153('0x73')][_0xf153('0x3b')]('\x20')[_0xf153('0x71')]>0x1){_0x25e66e[_0x17f58d](_0xf153('0x78'),qs[_0xf153('0x79')](_0x4c9157['value']),null);}else{var _0xf4a542='%'+_0x4c9157['value']+'%';_0x25e66e[_0x17f58d](_0xf153('0x7a'),_0xf4a542,_0xf4a542,_0xf4a542);}}else{_0x4afdc4=_[_0xf153('0x72')](_0x1bece2,['name','ContactId']);_0x4c9157[_0xf153('0x58')]=_0xf153('0x7b');_0x44da13=as['buildExpression'](_0x433566,_0x4afdc4[_0xf153('0x4a')],_0x4c9157);_0x25e66e[_0x17f58d](_0x44da13[_0xf153('0x7c')],_0x44da13[_0xf153('0x73')]['start'],_0x44da13[_0xf153('0x73')][_0xf153('0x24')]);}break;case _0xf153('0x7d'):var _0x1e5e95=_0x4c9157[_0xf153('0x73')][_0xf153('0x3b')](',')[_0xf153('0x39')](function(_0x364957){return Number(_0x364957);});_0x1e5e95[_0xf153('0x7e')](function(_0x858289){_0x603892['or'](_0xf153('0x7f'),'%,'+_0x858289+',%');});_0x147d3a=_[_0xf153('0x80')](_0x147d3a,_0x1e5e95);break;case _0xf153('0x81'):if(_0x4c9157[_0xf153('0x77')]===_0xf153('0x82')){_0x25e66e[_0x17f58d](_0xf153('0x83'),'%'+_0x4c9157['value']+'%',null);}else{_0x4afdc4=_[_0xf153('0x72')](_0x1bece2,['name','UserId']);_0x4c9157[_0xf153('0x58')]='UserId';_0x44da13=as[_0xf153('0x84')](_0x433566,_0x4afdc4[_0xf153('0x4a')],_0x4c9157);_0x25e66e[_0x17f58d](_0x44da13[_0xf153('0x7c')],_0x44da13[_0xf153('0x73')][_0xf153('0x85')],_0x44da13[_0xf153('0x73')]['end']);}break;case _0xf153('0x86'):_0x44da13=as[_0xf153('0x84')]('me',null,_0x4c9157);_0x25e66e[_0x17f58d](_0x44da13[_0xf153('0x7c')],_0x44da13['value']['start'],_0x44da13[_0xf153('0x73')][_0xf153('0x24')]);break;}}else{var _0x44da13=as['buildExpression'](_0x433566,_0x4afdc4[_0xf153('0x4a')],_0x4c9157);_0x25e66e[_0x17f58d](_0x44da13['text'],_0x44da13['value'][_0xf153('0x85')],_0x44da13[_0xf153('0x73')][_0xf153('0x24')]);}}}else{var _0x583dbf=_(_0x17fb10[_0xf153('0x4d')])[_0xf153('0x4e')]()['map'](function(_0x193c8c){return _[_0xf153('0x87')](_0x1bece2,[_0xf153('0x30'),_0x193c8c])?_0x193c8c:undefined;})[_0xf153('0x88')]()[_0xf153('0x73')]();if(!_['isEmpty'](_0x583dbf)){_0x583dbf[_0xf153('0x7e')](function(_0xf791a1){if(_0xf791a1===_0xf153('0x89')){_0x245124[_0xf153('0x55')](_0xf153('0x8a'),[][_0xf153('0x8b')](_0x17fb10[_0xf153('0x4d')][_0xf791a1]));}else if(_0xf791a1==='createdAt'){var _0x756f52=JSON[_0xf153('0x8c')](_0x17fb10[_0xf153('0x4d')][_0xf791a1])[_0xf153('0x8d')];var _0x269102=JSON[_0xf153('0x8c')](_0x17fb10['query'][_0xf791a1])[_0xf153('0x8e')];_0x245124[_0xf153('0x55')](_0xf153('0x8f'),_0x756f52,_0x269102);}else{if(_0x17fb10[_0xf153('0x4d')][_0xf791a1]===_0xf153('0x90')){_0x245124[_0xf153('0x55')]('i.'+_0xf791a1+_0xf153('0x91'));}else{_0x245124[_0xf153('0x55')]('i.'+_0xf791a1+_0xf153('0x92'),_0x17fb10[_0xf153('0x4d')][_0xf791a1]);}}});}if(_0x17fb10['query']['read']){if(_0x17fb10['query']['read']==0x1){_0x245124[_0xf153('0x75')](_0xf153('0x93'));}else{_0x245124[_0xf153('0x75')](_0xf153('0x94'));}}if(_0x17fb10[_0xf153('0x4d')]['tag']){_0x147d3a=_[_0xf153('0x95')](_0x17fb10[_0xf153('0x4d')][_0xf153('0x96')])?_0x17fb10[_0xf153('0x4d')]['tag']:new Array(_0x17fb10[_0xf153('0x4d')][_0xf153('0x96')]);_0x147d3a[_0xf153('0x7e')](function(_0x4a5f54){_0x603892['or'](_0xf153('0x7f'),'%,'+_0x4a5f54+',%');});}if(_0x17fb10['query'][_0xf153('0x97')]){var _0x25ab76=_0x17fb10[_0xf153('0x4d')]['filter']['replace']('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0xf153('0x98')](_0x25ab76)){_0x25e66e['or'](_0xf153('0x99'),_0x25ab76+'%');}else{_0x25e66e['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x25ab76))['or'](_0xf153('0x9a'),_0x25ab76+'%');}}}_0x245124['where'](_0x25e66e);_0x245124[_0xf153('0x9b')]('i.id');var _0xb3632c={'type':db[_0xf153('0x9c')][_0xf153('0x9d')][_0xf153('0x9e')],'raw':!![]};var _0x303dcf=_0x245124[_0xf153('0x9f')]();_0x303dcf['field'](_0xf153('0xa0'));_0x303dcf[_0xf153('0x58')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xf153('0xa1'));if(_0x1f540b[_0xf153('0xa2')]){_0x1f540b[_0xf153('0xa2')][_0xf153('0x7e')](function(_0x5c6ac2){var _0x3e36fc=_0x5c6ac2[0x0]===_0xf153('0xa3')?_0x5c6ac2[0x0]:'i.'+_0x5c6ac2[0x0];_0x245124['order'](_0x3e36fc,_0x5c6ac2[0x1]===_0xf153('0xa4')?![]:!![]);});}if(!_[_0xf153('0xa5')](_0x147d3a)){_0x245124[_0xf153('0x75')](_0x603892);_0x303dcf[_0xf153('0x55')]('t.id\x20IN\x20?',_0x147d3a);}BPromise[_0xf153('0xa6')]()[_0xf153('0x2d')](function(){if(!_0x2736e3){if(_0x17fb10[_0xf153('0x4d')][_0xf153('0x89')])return;_0x303dcf[_0xf153('0x55')](_0xf153('0xa7'));_0x245124[_0xf153('0x55')](_0xf153('0xa7'));return;}if(_0x17fb10[_0xf153('0xa8')]['role']!==_0xf153('0x35'))return;return _0x17fb10[_0xf153('0xa8')][_0xf153('0xa9')]({'attributes':['id'],'raw':!![]})['then'](function(_0x4d24b5){if(_[_0xf153('0xa5')](_0x4d24b5)){_0x303dcf['where'](_0xf153('0xaa'));_0x245124[_0xf153('0x55')](_0xf153('0xaa'));}else{_0x303dcf['where']('i.ChatWebsiteId\x20IN\x20?',_[_0xf153('0x39')](_0x4d24b5,'id'));_0x245124[_0xf153('0x55')](_0xf153('0x8a'),_['map'](_0x4d24b5,'id'));}});})[_0xf153('0x2d')](function(){if(_0x17fb10[_0xf153('0xa8')][_0xf153('0xab')]===_0xf153('0x35')&&!_0x2736e3&&!_0x17fb10[_0xf153('0x4d')][_0xf153('0x89')])return[];return db[_0xf153('0xac')][_0xf153('0x4d')](_0x303dcf[_0xf153('0xad')](),_0xb3632c);})[_0xf153('0x2d')](function(_0x347859){_0x1426eb[_0xf153('0x28')]=_0x347859[_0xf153('0x71')];if(_0x1426eb['count']===0x0)return[];return db[_0xf153('0xac')][_0xf153('0x4d')](_0x340aba[_0xf153('0xad')](),_0xb3632c)['then'](function(_0x573032){_0x51d813=_[_0xf153('0xae')](_0x573032,'id');_0xb3632c=_['merge'](_0xb3632c,{'model':db[_0xf153('0xaf')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x17fb10[_0xf153('0x4d')]['fields']){_0x1f540b[_0xf153('0x51')][_0xf153('0x7e')](function(_0x3b0b94){_0x245124[_0xf153('0x58')]('i.'+_0x3b0b94);});}else{_0x245124[_0xf153('0x58')](_0xf153('0xb0'),_0xf153('0xa1'));_0x245124[_0xf153('0x58')]('a.key',_0xf153('0xb1'));_0x245124[_0xf153('0x58')]('a.mandatoryDisposition','Account.mandatoryDisposition');_0x245124[_0xf153('0x58')]('CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName');_0x245124[_0xf153('0x58')](_0xf153('0xb2'));_0x245124['field'](_0xf153('0xb3'),_0xf153('0xb4'));_0x245124[_0xf153('0x58')](_0xf153('0xb5'),_0xf153('0xb6'));_0x245124[_0xf153('0x58')](_0xf153('0xb7'),_0xf153('0xb8'));_0x245124[_0xf153('0x58')]('c.phone',_0xf153('0xb9'));_0x245124['field'](_0xf153('0xba'),'Contact.mobile');_0x245124[_0xf153('0x58')]('c.fax','Contact.fax');_0x245124[_0xf153('0x58')]('o.fullname',_0xf153('0xbb'));_0x245124[_0xf153('0x58')]('o.internal','Owner.internal');_0x245124[_0xf153('0x58')](_0xf153('0xbc'),_0xf153('0x3a'));}if(_0x1f540b['limit'])_0x245124[_0xf153('0x29')](_0x1f540b[_0xf153('0x29')]);if(_0x1f540b[_0xf153('0x26')])_0x245124[_0xf153('0x26')](_0x1f540b['offset']);return db[_0xf153('0xac')][_0xf153('0x4d')](_0x245124[_0xf153('0xad')](),_0xb3632c);})[_0xf153('0x2d')](function(_0x1022c5){if(_0x1022c5[_0xf153('0x71')]>0x0)_0x18d0ce[_0xf153('0x55')](_0xf153('0xbd'),_[_0xf153('0x39')](_0x1022c5,'id'));return db[_0xf153('0xac')][_0xf153('0x4d')](_0x18d0ce[_0xf153('0xad')](),_0xb3632c)['then'](function(_0x1aebab){var _0x192708=_['groupBy'](_0x1aebab,_0xf153('0xbe'));var _0x4525e1=[];_0x1022c5[_0xf153('0x7e')](function(_0x449f8d){_0x4525e1[_0xf153('0x3d')](updateChatInteraction(_0x449f8d,_0x51d813,_0x192708));});return BPromise['all'](_0x4525e1);});});})[_0xf153('0x2d')](function(_0xa13662){_0x1426eb[_0xf153('0xbf')]=_0xa13662;return _0x1426eb;})[_0xf153('0x2d')](respondWithFilteredResult(_0x550d45,_0x1f540b))[_0xf153('0x3e')](handleError(_0x550d45,null));};exports[_0xf153('0xc0')]=function(_0x2e55f4,_0x1098b7){var _0x29d492={'raw':![],'where':{'id':_0x2e55f4[_0xf153('0xc1')]['id']}},_0x3f7938={};_0x3f7938[_0xf153('0x4c')]=_[_0xf153('0x4e')](db[_0xf153('0xaf')][_0xf153('0x49')]);_0x3f7938['query']=_[_0xf153('0x4e')](_0x2e55f4[_0xf153('0x4d')]);_0x3f7938[_0xf153('0x4f')]=_[_0xf153('0x50')](_0x3f7938[_0xf153('0x4c')],_0x3f7938[_0xf153('0x4d')]);_0x29d492[_0xf153('0x51')]=_[_0xf153('0x50')](_0x3f7938['model'],qs[_0xf153('0xc2')](_0x2e55f4[_0xf153('0x4d')][_0xf153('0xc2')]));_0x29d492[_0xf153('0x51')]=_0x29d492[_0xf153('0x51')]['length']?_0x29d492[_0xf153('0x51')]:_0x3f7938[_0xf153('0x4c')];if(_0x2e55f4[_0xf153('0x4d')][_0xf153('0xc3')]){_0x29d492['include']=[{'all':!![]}];}_0x29d492=_['merge']({},_0x29d492,_0x2e55f4[_0xf153('0xc4')]);return db[_0xf153('0xaf')]['find'](_0x29d492)['then'](handleEntityNotFound(_0x1098b7,null))[_0xf153('0x2d')](respondWithResult(_0x1098b7,null))[_0xf153('0x3e')](handleError(_0x1098b7,null));};exports[_0xf153('0xc5')]=function(_0x339e9e,_0x31a019){return db[_0xf153('0xaf')][_0xf153('0xc5')](_0x339e9e[_0xf153('0x86')],{})[_0xf153('0x2d')](respondWithResult(_0x31a019,0xc9))['catch'](handleError(_0x31a019,null));};exports[_0xf153('0x2c')]=function(_0x110f72,_0x527cce){if(_0x110f72[_0xf153('0x86')]['id']){delete _0x110f72[_0xf153('0x86')]['id'];}return db[_0xf153('0xaf')][_0xf153('0x72')]({'where':{'id':_0x110f72['params']['id']}})['then'](handleEntityNotFound(_0x527cce,null))[_0xf153('0x2d')](saveUpdates(_0x110f72[_0xf153('0x86')],null))[_0xf153('0x2d')](respondWithResult(_0x527cce,null))['catch'](handleError(_0x527cce,null));};exports[_0xf153('0x2e')]=function(_0x45c835,_0x3ca774){return db[_0xf153('0xaf')][_0xf153('0x72')]({'where':{'id':_0x45c835[_0xf153('0xc1')]['id']}})[_0xf153('0x2d')](handleEntityNotFound(_0x3ca774,null))['then'](removeEntity(_0x3ca774,null))[_0xf153('0x3e')](handleError(_0x3ca774,null));};exports[_0xf153('0xc6')]=function(_0x3451e9,_0x3af786){return db[_0xf153('0xaf')][_0xf153('0xc6')]()[_0xf153('0x2d')](respondWithResult(_0x3af786,null))[_0xf153('0x3e')](handleError(_0x3af786,null));};exports[_0xf153('0xc7')]=function(_0x53eee4,_0x2dd1d8){var _0x2c3f76=_0x53eee4[_0xf153('0xc1')]['id'];var _0x374ba4;var _0x1b4f50;var _0x40c1d1;return db['ChatInteraction'][_0xf153('0xc8')]({'where':{'id':_0x2c3f76}})[_0xf153('0x2d')](function(_0x8711eb){_0x374ba4=_0x8711eb;return db[_0xf153('0xc9')]['findOne']({'where':{'id':_0x8711eb[_0xf153('0x89')]},'attributes':['id',_0xf153('0xca'),_0xf153('0xcb'),_0xf153('0xcc'),_0xf153('0xcd'),'vidaooMetadata'],'raw':!![]});})[_0xf153('0x2d')](function(_0x2e908a){if(_0x2e908a&&_0x2e908a['vidaooApiKey']&&_0x2e908a[_0xf153('0xcb')]){_0x1b4f50=_0x2e908a;var _0x57d320={'interaction':{'id':_0x2c3f76},'agent':{'id':_0x53eee4[_0xf153('0xa8')]['id'],'name':_0x53eee4[_0xf153('0xa8')][_0xf153('0x30')],'fullname':_0x53eee4[_0xf153('0xa8')]['fullname'],'email':_0x53eee4[_0xf153('0xa8')][_0xf153('0xce')]},'contact':_0x53eee4['body'][_0xf153('0x34')],'account':_0x53eee4['body'][_0xf153('0x37')]};var _0x30ae3c={'rejectUnauthorized':![],'method':'POST','url':'https://api-vidaoo.xcally.com/api/v1/meetings','headers':{'X-APIKEY':_0x2e908a['vidaooApiKey']},'body':{'duration':null,'scheduledAt':null,'participants':[_0x53eee4[_0xf153('0xa8')][_0xf153('0xce')]],'buttons':null,'topic':_0x1b4f50['vidaooTopic'],'note':_[_0xf153('0xcf')](_0x1b4f50[_0xf153('0xcd')])?null:getMustacheRender(_0x1b4f50['vidaooNote'],_0x57d320),'metadata':null},'redirect':'follow','json':!![]};try{if(!_[_0xf153('0xcf')](_0x1b4f50[_0xf153('0xd0')])){var _0x32971d=getMustacheRender(_0x1b4f50[_0xf153('0xd0')],_0x57d320);var _0x1a4825=JSON[_0xf153('0x8c')](_0x32971d);_0x30ae3c[_0xf153('0x86')][_0xf153('0xd1')]=_0x1a4825;}}catch(_0xb03f70){throw new db[(_0xf153('0x9c'))]['ValidationError'](_0xf153('0xd2'));}return rp(_0x30ae3c);}else{throw new db['Sequelize']['ValidationError'](_0xf153('0xd3'));}})[_0xf153('0x2d')](function(_0x264968){_0x40c1d1=_0x264968;if(_0x40c1d1['id']){var _0xe61167={'body':_0x40c1d1['join_url'],'ChatWebsiteId':_0x1b4f50['id'],'ChatInteractionId':_0x374ba4['id'],'direction':_0xf153('0xd4'),'UserId':_0x53eee4['user']['id']};return db[_0xf153('0xd5')][_0xf153('0xc5')](_0xe61167,{});}else{throw new db[(_0xf153('0x9c'))]['ValidationError'](_0xf153('0xd6'));}})[_0xf153('0x2d')](function(){return _0x374ba4['updateAttributes']({'vidaooSessionId':_0x40c1d1['id']});})[_0xf153('0x2d')](respondWithResult(_0x2dd1d8,null))['catch'](handleError(_0x2dd1d8,null));};exports[_0xf153('0xd7')]=function(_0x1ba174,_0xab67b7){if(_0x1ba174['body']['id']){delete _0x1ba174['body']['id'];}return db[_0xf153('0xaf')]['find']({'where':{'id':_0x1ba174[_0xf153('0xc1')]['id']},'include':[{'model':db[_0xf153('0xd8')],'as':_0xf153('0x76')}]})[_0xf153('0x2d')](handleEntityNotFound(_0xab67b7,null))[_0xf153('0x2d')](saveUpdates(_0x1ba174[_0xf153('0x86')],null))[_0xf153('0x2d')](respondWithResult(_0xab67b7,null))[_0xf153('0x3e')](handleError(_0xab67b7,null));};exports[_0xf153('0xd9')]=function(_0x40ade6,_0x1a9bfb){if(_0x40ade6[_0xf153('0x86')]['id']){delete _0x40ade6[_0xf153('0x86')]['id'];}return db[_0xf153('0xaf')][_0xf153('0x72')]({'where':{'id':_0x40ade6[_0xf153('0xc1')]['id']}})[_0xf153('0x2d')](function(_0x50dd96){if(!_0x50dd96){logger[_0xf153('0x1f')](_0xf153('0xda'),_0xf153('0xd9'),0x194,'entity\x20not\x20found');_0x1a9bfb[_0xf153('0x22')](0x194);}else{if(_0x50dd96[_0xf153('0x44')]){throw new db[(_0xf153('0x9c'))]['ValidationError'](_0xf153('0xdb'));}}return _0x50dd96;})[_0xf153('0x2d')](function(_0xeebd4f){if(_0xeebd4f){return _0xeebd4f[_0xf153('0x2c')]({'closed':_0x40ade6[_0xf153('0x86')]['closed'],'disposition':_0x40ade6[_0xf153('0x86')]['disposition']})[_0xf153('0x2d')](function(_0x4fe273){return _0x4fe273;});}})['then'](function(){return respondWithRpcPromise('AbandonInteraction',_0xf153('0xd9'),_0x40ade6['body'],client9004);})[_0xf153('0x2d')](respondWithResult(_0x1a9bfb,null))['catch'](handleError(_0x1a9bfb,null));};exports[_0xf153('0xdc')]=function(_0x25543b,_0x3c1ae6){_0x25543b[_0xf153('0x86')]['name']=_0x25543b[_0xf153('0xdd')][_0xf153('0xde')];_0x25543b['body'][_0xf153('0xdf')]=_0x25543b[_0xf153('0xdd')][_0xf153('0xe0')];_0x25543b[_0xf153('0x86')][_0xf153('0x4a')]=_0x25543b[_0xf153('0xdd')][_0xf153('0xe1')];return db['Attachment'][_0xf153('0xc5')](_0x25543b[_0xf153('0x86')])[_0xf153('0x2d')](respondWithResult(_0x3c1ae6,0xc9))[_0xf153('0x3e')](handleError(_0x3c1ae6,null));};exports[_0xf153('0xe2')]=function(_0x2c8401,_0x41ef70){return db['ChatInteraction'][_0xf153('0xc8')]({'where':{'id':_0x2c8401[_0xf153('0xc1')]['id']},'raw':!![]})[_0xf153('0x2d')](handleEntityNotFound(_0x41ef70,null))[_0xf153('0x2d')](function(_0x283f9e){if(_0x283f9e){if(_0x283f9e['closed']){return _0x41ef70['status'](0x193)[_0xf153('0x25')]({'status':0x193,'message':_0xf153('0xe3')});}return db['Attachment'][_0xf153('0xc8')]({'where':{'id':_0x2c8401[_0xf153('0x4d')][_0xf153('0xe4')]},'raw':!![]})['then'](handleEntityNotFound(_0x41ef70,null));}})['then'](function(_0x13b7e2){if(_0x13b7e2){var _0x25222f=_0x13b7e2[_0xf153('0xe5')]!==null;var _0x4b2cdd=path[_0xf153('0xe6')](config[_0xf153('0xe7')],_0xf153('0xe8'));if(_0x25222f){_0x4b2cdd=path[_0xf153('0xe6')](_0x4b2cdd,_0xf153('0xe9'));}var _0x1ac5ff=path[_0xf153('0xe6')](_0x4b2cdd,_0x13b7e2[_0xf153('0xdf')]);return _0x41ef70[_0xf153('0xea')](_0x1ac5ff);}})[_0xf153('0x3e')](handleError(_0x41ef70,null));};exports[_0xf153('0xeb')]=function(_0x126535,_0x392c8e){var _0x203143=null;var _0x173f12=null;var _0x1f8794=null;if(_0x126535[_0xf153('0x86')]['id']){delete _0x126535[_0xf153('0x86')]['id'];}if(_0x126535['body'][_0xf153('0xec')]){_0x1f8794=path['join'](config[_0xf153('0xe7')],_0xf153('0xed'),util['format']('transcript-%s.txt',Date['now']()));_0x126535[_0xf153('0x86')][_0xf153('0xee')]=_0x1f8794;}return db[_0xf153('0xaf')][_0xf153('0x72')]({'where':{'id':_0x126535['params']['id']},'include':[{'model':db[_0xf153('0xd5')],'as':_0xf153('0xef'),'include':[{'model':db[_0xf153('0x81')],'as':_0xf153('0x81')}]}]})[_0xf153('0x2d')](handleEntityNotFound(_0x392c8e,null))[_0xf153('0x2d')](saveUpdates(_0x126535[_0xf153('0x86')],null))[_0xf153('0x2d')](function(_0x4c2b50){if(_0x4c2b50){_0x203143=_0x4c2b50;return db[_0xf153('0xc9')][_0xf153('0x72')]({'where':{'id':_0x203143['ChatWebsiteId']}});}})['then'](function(_0x3021e6){if(_0x3021e6){_0x173f12=_0x3021e6;return db[_0xf153('0xd8')]['find']({'where':{'id':_0x203143[_0xf153('0x7b')]}});}})['then'](function(_0x3057f1){if(_0x3057f1){if(_0x1f8794){var _0x207255=null;for(var _0xd8cd84=0x1;_0xd8cd84<_0x203143[_0xf153('0xef')][_0xf153('0x71')];++_0xd8cd84){_0x207255=_0x203143['Messages'][_0xd8cd84];var _0xb4dbdd=_0x207255['UserId']?util['format'](_0xf153('0xf0'),_0x173f12[_0xf153('0xf1')],_0x207255[_0xf153('0x44')]):_0xf153('0xf2');var _0x5b1a91=_0x126535[_0xf153('0x86')][_0xf153('0xf3')]||util[_0xf153('0xf4')](_0xf153('0xf0'),_0xf153('0xf5'),_0x207255[_0xf153('0x7b')]);switch(_0x173f12[_0xf153('0xf6')]){case _0xf153('0xf7'):_0xb4dbdd=_0x207255['UserId']?util[_0xf153('0xf4')](_0xf153('0xf0'),_0x173f12[_0xf153('0xf1')],_0x207255[_0xf153('0x44')]):_0xf153('0xf2');break;case _0xf153('0xf8'):_0xb4dbdd=_0x207255[_0xf153('0x44')]?_0x207255[_0xf153('0x81')][_0xf153('0xf9')]||_0x207255[_0xf153('0x81')][_0xf153('0xfa')]:_0xf153('0xf2');break;case'agent_fullname':_0xb4dbdd=_0x207255[_0xf153('0x44')]?_0x207255[_0xf153('0x81')]['fullname']:_0xf153('0xf2');break;default:_0xb4dbdd=_0x207255[_0xf153('0x44')]?util[_0xf153('0xf4')](_0xf153('0xf0'),_0x173f12[_0xf153('0xf1')],_0x207255[_0xf153('0x44')]):_0xf153('0xf2');}var _0x4b8d5c=util[_0xf153('0xf4')](_0xf153('0xfb'),moment(_0x207255[_0xf153('0xfc')])[_0xf153('0xf4')]('MM/DD/YYYY\x20HH:mm:ss'),_0x207255[_0xf153('0xfd')]==='in'?_0x5b1a91:_0xb4dbdd,_0x207255[_0xf153('0x86')]);if(!_0x207255['secret']){fs[_0xf153('0xfe')](_0x1f8794,_0x4b8d5c);}}return db['MailAccount'][_0xf153('0xc8')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0xf153('0xff'),'raw':!![],'include':[{'model':db[_0xf153('0x100')],'as':_0xf153('0x100'),'raw':!![]}]}]});}}})[_0xf153('0x2d')](function(_0x5a8d13){if(!_0x5a8d13||!_0x5a8d13[_0xf153('0xff')]||!_0x126535['body'])return _0x203143;var _0x21285e=_0x5a8d13[_0xf153('0x101')]();return respondWithRpcPromise(_0xf153('0x102'),_0xf153('0x103'),{'account':_0x21285e,'message':{'from':util[_0xf153('0xf4')](_0xf153('0x104'),_0x5a8d13['name'],_0x5a8d13[_0xf153('0xce')]||_0x5a8d13['Smtp'][_0xf153('0xa8')]),'to':_0x126535['body'][_0xf153('0xec')],'subject':_0xf153('0x105'),'text':util[_0xf153('0xf4')](_0xf153('0x106'),_0x126535['body'][_0xf153('0xec')]),'attachments':[{'path':_0x1f8794}]}})['then'](function(){return _0x203143;})[_0xf153('0x3e')](function(_0x5c32d1){logger[_0xf153('0x1f')](_0x5c32d1);});})[_0xf153('0x2d')](respondWithStatusCode(_0x392c8e,0xc8))[_0xf153('0x3e')](handleError(_0x392c8e,null));};exports[_0xf153('0x107')]=function(_0x273b03,_0x3165e5){return db[_0xf153('0xd5')][_0xf153('0x72')]({'where':{'id':_0x273b03['params']['id']}})[_0xf153('0x2d')](handleEntityNotFound(_0x3165e5,null))[_0xf153('0x2d')](function(_0x48c9e4){if(_0x48c9e4){return _0x48c9e4[_0xf153('0x107')](_0x273b03[_0xf153('0x86')][_0xf153('0x108')],_[_0xf153('0x109')](_0x273b03[_0xf153('0x86')],[_0xf153('0x108'),'id'])||{});}})[_0xf153('0x2d')](respondWithResult(_0x3165e5,null))['catch'](handleError(_0x3165e5,null));};exports['getMessages']=function(_0x550c10,_0x3e8153){var _0x1fb83a={'raw':![],'where':{}};var _0x10f948={};var _0x5cc922={'count':0x0,'rows':[]};return db['ChatInteraction'][_0xf153('0xc8')]({'where':{'id':_0x550c10['params']['id']}})[_0xf153('0x2d')](handleEntityNotFound(_0x3e8153,null))[_0xf153('0x2d')](function(_0x21a1c9){if(_0x21a1c9){_0x10f948[_0xf153('0x4c')]=_[_0xf153('0x4e')](db['ChatMessage'][_0xf153('0x49')]);_0x10f948[_0xf153('0x4d')]=_[_0xf153('0x4e')](_0x550c10['query']);_0x10f948[_0xf153('0x4f')]=_[_0xf153('0x50')](_0x10f948[_0xf153('0x4c')],_0x10f948[_0xf153('0x4d')]);_0x1fb83a[_0xf153('0x51')]=_[_0xf153('0x50')](_0x10f948[_0xf153('0x4c')],qs[_0xf153('0xc2')](_0x550c10[_0xf153('0x4d')][_0xf153('0xc2')]));_0x1fb83a[_0xf153('0x51')]=_0x1fb83a[_0xf153('0x51')][_0xf153('0x71')]?_0x1fb83a[_0xf153('0x51')]:_0x10f948[_0xf153('0x4c')];if(!_0x550c10[_0xf153('0x4d')][_0xf153('0x52')]('nolimit')){_0x1fb83a[_0xf153('0x29')]=qs[_0xf153('0x29')](_0x550c10[_0xf153('0x4d')][_0xf153('0x29')]);_0x1fb83a['offset']=qs[_0xf153('0x26')](_0x550c10[_0xf153('0x4d')][_0xf153('0x26')]);}_0x1fb83a[_0xf153('0xa2')]=qs[_0xf153('0x54')](_0x550c10[_0xf153('0x4d')]['sort']);_0x1fb83a[_0xf153('0x55')]=qs[_0xf153('0x4f')](_['pick'](_0x550c10[_0xf153('0x4d')],_0x10f948[_0xf153('0x4f')]));_0x1fb83a[_0xf153('0x55')][_0xf153('0xbe')]=_0x21a1c9['id'];if(_0x550c10[_0xf153('0x4d')][_0xf153('0x97')]){_0x1fb83a[_0xf153('0x55')]=_[_0xf153('0x33')](_0x1fb83a[_0xf153('0x55')],{'$or':_[_0xf153('0x39')](_0x1fb83a[_0xf153('0x51')],function(_0x4538be){var _0x63ad32={};_0x63ad32[_0x4538be]={'$like':'%'+_0x550c10['query'][_0xf153('0x97')]+'%'};return _0x63ad32;})});}if(_0x550c10[_0xf153('0x4d')][_0xf153('0x8d')]){var _0x9503e=_0x550c10[_0xf153('0x4d')][_0xf153('0x8d')]['split'](',');var _0x49ea9a={};_0x49ea9a[_0x9503e[0x0]]={'$gte':moment(_0x9503e[0x1])[_0xf153('0xf4')](_0xf153('0x10a'))};_0x1fb83a[_0xf153('0x55')]=_['merge'](_0x1fb83a[_0xf153('0x55')],_0x49ea9a);}_0x1fb83a=_[_0xf153('0x33')]({},_0x1fb83a,_0x550c10[_0xf153('0xc4')]);return db[_0xf153('0xd5')][_0xf153('0x28')]({'where':_0x1fb83a[_0xf153('0x55')]})[_0xf153('0x2d')](function(_0x921b52){_0x5cc922['count']=_0x921b52;if(_0x550c10['query'][_0xf153('0xc3')]){_0x1fb83a[_0xf153('0x10b')]=[{'all':!![]}];}return db[_0xf153('0xd5')][_0xf153('0x10c')](_0x1fb83a);})[_0xf153('0x2d')](function(_0x577fc7){_0x5cc922[_0xf153('0xbf')]=_0x577fc7;return _0x5cc922;});}})[_0xf153('0x2d')](respondWithFilteredResult(_0x3e8153,_0x1fb83a))[_0xf153('0x3e')](handleError(_0x3e8153,null));};exports[_0xf153('0x10d')]=function(_0x283af8,_0x58be79){var _0x1d0d1a={'where':{}},_0x5397a8={},_0x466386={'count':0x0,'rows':[]};return db[_0xf153('0xaf')][_0xf153('0xc8')]({'where':{'id':_0x283af8[_0xf153('0xc1')]['id']}})[_0xf153('0x2d')](handleEntityNotFound(_0x58be79,null))['then'](function(_0x5efd23){if(_0x5efd23){_0x5397a8[_0xf153('0x4c')]=_[_0xf153('0x4e')](db[_0xf153('0xd5')][_0xf153('0x49')]);_0x5397a8[_0xf153('0x4d')]=_[_0xf153('0x4e')](_0x283af8[_0xf153('0x4d')]);_0x5397a8[_0xf153('0x4f')]=_[_0xf153('0x50')](_0x5397a8[_0xf153('0x4c')],_0x5397a8[_0xf153('0x4d')]);_0x1d0d1a[_0xf153('0x51')]=_[_0xf153('0x50')](_0x5397a8[_0xf153('0x4c')],qs[_0xf153('0xc2')](_0x283af8[_0xf153('0x4d')][_0xf153('0xc2')]));_0x1d0d1a[_0xf153('0x51')]=_0x1d0d1a[_0xf153('0x51')][_0xf153('0x71')]?_0x1d0d1a[_0xf153('0x51')]:_0x5397a8[_0xf153('0x4c')];if(!_0x283af8['query']['hasOwnProperty'](_0xf153('0x53'))){_0x1d0d1a[_0xf153('0x29')]=qs[_0xf153('0x29')](_0x283af8['query'][_0xf153('0x29')]);_0x1d0d1a[_0xf153('0x26')]=qs[_0xf153('0x26')](_0x283af8['query'][_0xf153('0x26')]);}_0x1d0d1a[_0xf153('0xa2')]=qs[_0xf153('0x54')](_0x283af8[_0xf153('0x4d')]['sort']);_0x1d0d1a[_0xf153('0x55')]=qs['filters'](_[_0xf153('0x56')](_0x283af8[_0xf153('0x4d')],_0x5397a8[_0xf153('0x4f')]));_0x1d0d1a[_0xf153('0x55')]['ChatInteractionId']=_0x5efd23['id'];if(_0x283af8[_0xf153('0x4d')]['filter']){_0x1d0d1a[_0xf153('0x55')]=_[_0xf153('0x33')](_0x1d0d1a[_0xf153('0x55')],{'$or':_[_0xf153('0x39')](_0x1d0d1a[_0xf153('0x51')],function(_0x397ee2){var _0x17e62e={};_0x17e62e[_0x397ee2]={'$like':'%'+_0x283af8[_0xf153('0x4d')][_0xf153('0x97')]+'%'};return _0x17e62e;})});}_0x1d0d1a['where']['secret']=![];if(_0x283af8[_0xf153('0x4d')]['id']){_0x1d0d1a[_0xf153('0x55')]['id']={'$gt':_0x283af8[_0xf153('0x4d')]['id']};}_0x1d0d1a=_['merge']({},_0x1d0d1a,_0x283af8[_0xf153('0xc4')]);return db[_0xf153('0xd5')][_0xf153('0x28')]({'where':_0x1d0d1a['where']})[_0xf153('0x2d')](function(_0x100f48){_0x466386[_0xf153('0x28')]=_0x100f48;_0x1d0d1a[_0xf153('0x10b')]=[];if(_0x283af8['query']['includeAgent']){_0x1d0d1a[_0xf153('0x10b')][_0xf153('0x3d')]({'model':db[_0xf153('0x81')],'as':_0xf153('0x81'),'attributes':['id','fullname',_0xf153('0xf9')]});}if(_0x283af8[_0xf153('0x4d')][_0xf153('0xc3')]){_0x1d0d1a[_0xf153('0x10b')]=[{'all':!![]}];}return db[_0xf153('0xd5')][_0xf153('0x10c')](_0x1d0d1a);})[_0xf153('0x2d')](function(_0x3a94c5){_0x466386[_0xf153('0xbf')]=_0x3a94c5;return _0x466386;});}})[_0xf153('0x2d')](respondWithFilteredResult(_0x58be79,_0x1d0d1a))['catch'](handleError(_0x58be79,null));};exports['addTags']=function(_0x11997d,_0x74943){return db[_0xf153('0xaf')]['find']({'where':{'id':_0x11997d[_0xf153('0xc1')]['id']}})[_0xf153('0x2d')](handleEntityNotFound(_0x74943,null))['then'](function(_0x3f7eb6){if(_0x3f7eb6){return _0x3f7eb6[_0xf153('0x10e')](_0x11997d['body']['ids'],_[_0xf153('0x109')](_0x11997d['body'],[_0xf153('0x108'),'id'])||{})[_0xf153('0x10f')](function(){return db[_0xf153('0x7d')]['findAll']({'attributes':['id',_0xf153('0x30'),_0xf153('0x59')],'where':{'id':_0x11997d['body'][_0xf153('0x108')]}});})['then'](function(_0x5742a6){socket[_0xf153('0x110')](_0xf153('0x111'),{'id':Number(_0x11997d[_0xf153('0xc1')]['id']),'tags':_0x5742a6||[]});return{'id':Number(_0x11997d[_0xf153('0xc1')]['id']),'tags':_0x5742a6||[]};});}})[_0xf153('0x2d')](respondWithResult(_0x74943,null))[_0xf153('0x3e')](handleError(_0x74943,null));};exports['removeTags']=function(_0x9d9d65,_0x301675){return db[_0xf153('0xaf')][_0xf153('0x72')]({'where':{'id':_0x9d9d65[_0xf153('0xc1')]['id']}})[_0xf153('0x2d')](handleEntityNotFound(_0x301675,null))[_0xf153('0x2d')](function(_0x4a5c86){if(_0x4a5c86){return _0x4a5c86['removeTags'](_0x9d9d65[_0xf153('0x4d')][_0xf153('0x108')]);}})['then'](respondWithStatusCode(_0x301675,null))[_0xf153('0x3e')](handleError(_0x301675,null));};exports[_0xf153('0xea')]=function(_0x252e74,_0x48f9ff){var _0x2180ec=moment()[_0xf153('0x112')]()[_0xf153('0xad')]();var _0x265407=path[_0xf153('0xe6')](config[_0xf153('0xe7')],_0xf153('0x113'),_0xf153('0x114'),_0xf153('0x115'));var _0x2a39ae=path[_0xf153('0xe6')](config['root'],_0xf153('0x113'),_0xf153('0x114'),_0xf153('0x116'));var _0x154c3c=path[_0xf153('0xe6')](_0x265407,_0x2180ec);var _0x5b9c=util[_0xf153('0xf4')](_0xf153('0x117'),_0x252e74[_0xf153('0xc1')]['id'],_0x2180ec);var _0x304d66=path['join'](_0x265407,_0x5b9c);var _0x444f68=[];_0x444f68[_0xf153('0x3d')]({'model':db[_0xf153('0x81')],'as':_0xf153('0x81'),'attributes':['id',_0xf153('0xfa')],'raw':!![]});_0x444f68[_0xf153('0x3d')]({'model':db[_0xf153('0xd8')],'as':_0xf153('0x76'),'attributes':['id','firstName','lastName'],'raw':!![]});if(_0x252e74[_0xf153('0x4d')]['attachments']){_0x444f68[_0xf153('0x3d')]({'model':db[_0xf153('0x118')],'as':_0xf153('0x118'),'raw':!![]});}var _0x3d553d=[{'model':db['ChatMessage'],'as':'Messages','attributes':['id',_0xf153('0x86'),_0xf153('0xfc'),_0xf153('0xfd'),_0xf153('0x119'),_0xf153('0x11a')],'include':_0x444f68}];_0x3d553d[_0xf153('0x3d')]({'model':db[_0xf153('0xc9')],'as':_0xf153('0x11b'),'attributes':['id',_0xf153('0x30')]});_0x3d553d[_0xf153('0x3d')]({'model':db[_0xf153('0x81')],'as':_0xf153('0x11c'),'attributes':['id',_0xf153('0xfa')]});return db[_0xf153('0xaf')]['find']({'where':{'id':_0x252e74[_0xf153('0xc1')]['id']},'include':_0x3d553d})[_0xf153('0x2d')](handleEntityNotFound(_0x48f9ff,null))[_0xf153('0x2d')](function(_0xf53fc6){if(_0xf53fc6){var _0x45112b=_0xf53fc6[_0xf153('0x11d')]({'plain':!![]});fs[_0xf153('0x11e')](_0x154c3c);var _0x1435bd={'channel':_0xf153('0x11f'),'account':_0x45112b[_0xf153('0x11b')]['name'],'agent':_0x45112b[_0xf153('0x11c')]?_0x45112b[_0xf153('0x11c')][_0xf153('0xfa')]:_0xf153('0x120'),'createdAt':moment(_0x45112b['createdAt'])[_0xf153('0xf4')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0x45112b['closed']?moment(_0x45112b['closedAt'])[_0xf153('0xf4')](_0xf153('0x10a'))[_0xf153('0xad')]():'','disposition':_0x45112b[_0xf153('0x45')],'chatInfo':{'browser':_0x45112b[_0xf153('0x121')],'os':_0x45112b['osName'],'referer':_0x45112b[_0xf153('0x122')],'customerIp':_0x45112b[_0xf153('0x123')],'customerPort':_0x45112b['customerPort']?_0x45112b[_0xf153('0x124')]:_0xf153('0x120')},'messages':_(_0x45112b['Messages'])[_0xf153('0x125')]()['filter']({'secret':![]})[_0xf153('0x39')](function(_0x5aa0bf){if(_0x5aa0bf[_0xf153('0x118')]){var _0x5ec77c=path[_0xf153('0xe6')](_0x2a39ae,_0x5aa0bf[_0xf153('0x118')][_0xf153('0xdf')]);if(fs[_0xf153('0x126')](_0x5ec77c)){fs[_0xf153('0x127')](_0x5ec77c)['pipe'](fs[_0xf153('0x128')](path[_0xf153('0xe6')](_0x154c3c,_0x5aa0bf[_0xf153('0x118')][_0xf153('0xdf')])));}}return{'date':moment(_0x5aa0bf['createdAt'])[_0xf153('0xf4')](_0xf153('0x10a'))[_0xf153('0xad')](),'sender':_0x5aa0bf[_0xf153('0xfd')]===_0xf153('0xd4')?_0x5aa0bf['User']?_0x5aa0bf[_0xf153('0x81')][_0xf153('0xfa')]:_0xf153('0xf2'):_0x5aa0bf[_0xf153('0x76')]['firstName']+(_0x5aa0bf[_0xf153('0x76')][_0xf153('0x129')]?'\x20'+_0x5aa0bf[_0xf153('0x76')][_0xf153('0x129')]:''),'body':_0x5aa0bf[_0xf153('0x118')]?_0x5aa0bf['Attachment'][_0xf153('0xdf')]:_0x5aa0bf[_0xf153('0x86')],'direction':_0x5aa0bf[_0xf153('0xfd')]===_0xf153('0xd4')?'A':'C','secret':_0x5aa0bf[_0xf153('0x119')],'read':_0x5aa0bf[_0xf153('0x11a')],'attachment':_0x5aa0bf['Attachment']};})['value']()};return ejs[_0xf153('0x12a')](path[_0xf153('0xe6')](config[_0xf153('0xe7')],_0xf153('0x113'),_0xf153('0x12b'),'downloadInteraction.ejs'),{'interaction':_0x1435bd})[_0xf153('0x2d')](function(_0x415d13){var _0xb2f8e0=path[_0xf153('0xe6')](_0x154c3c,_0xf153('0x12c')+_0x45112b['id']+'-'+_0x2180ec+'.pdf');var _0x3b6a0e={'path':_0xb2f8e0,'channel':_0xf153('0x11f'),'interactionId':_0x45112b['id']};return pdf['createPdfFromHTML'](_0x415d13,_0x3b6a0e);})[_0xf153('0x2d')](function(){return new Promise(function(_0x19de76,_0x5912d8){zipdir(_0x154c3c,{'saveTo':_0x304d66},function(_0x426db4,_0x52677c){if(_0x426db4)return _0x5912d8(_0x426db4);return _0x19de76(_0x52677c);});})[_0xf153('0x2d')](function(){return new BPromise(function(_0x200d37,_0x393d95){rimraf(_0x154c3c,function(_0x30a638){if(_0x30a638)_0x393d95(_0x30a638);return _0x200d37();});});})[_0xf153('0x2d')](function(){return _0x48f9ff['download'](_0x304d66,_0x5b9c,function(_0x416a91){if(_0x416a91){logger['error'](_0xf153('0x12d'),_0x416a91);}else{fs[_0xf153('0x12e')](_0x304d66);}});});});}else{return _0x48f9ff[_0xf153('0x22')](0xc8);}})[_0xf153('0x3e')](handleError(_0x48f9ff,null));}; \ No newline at end of file +var _0x34e8=['ejs','lodash','squel','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','jayson/promise','client','http','request','info','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','error','code','ChatInteraction,\x20%s,\x20%s','message','result','catch','status','end','offset','limit','undefined','count','set','json','update','then','destroy','sendStatus','stack','name','send','render','body','contact','account','Users','TagIds','split','forEach','Tags','talking','unmanaged','abandoned','UserId','waiting','closed','disposition','answered','total','index','map','ChatInteraction','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','field','color','select','u.fullname','ui.ChatInteractionId','from','user_has_chat_interactions','left_join','users','chat_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','chat_websites','chat_messages','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','having','`\x20=\x200','`\x20>\x200','Contact','operator','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','type','text','start','Tag','$substring','some','compact','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','concat','parse','$gte','$lte','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','group','i.id','Sequelize','QueryTypes','SELECT','clone','contactName','DESC','t.id\x20IN\x20?','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','role','agent','getChatWebsites','isEmpty','i.ChatWebsiteId\x20IS\x20NULL','sequelize','toString','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','groupBy','ChatInteractionId','push','show','params','includeAll','include','options','create','describe','createVidaooSession','findOne','ChatWebsite','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','fullname','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','vidaooApiKey','follow','isNull','Error\x20in\x20conversion\x20vidaooMetadata','ValidationError','Error\x20in\x20Vidaoo\x20configuration','out','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','Interaction\x20already\x20assigned','attachmentUpload','file','filename','mimetype','Attachment','Unauthorized','attachId','join','root','offline-chat/','basename','download','close','mailTranscript','server/files/chat/upload/','transcript-%s.txt','pathTranscript','ChatMessage','User','Messages','format','%s%d','agentAlias','System','customer','Visitor','agentIdentifier','website_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','createdAt','direction','secret','appendFileSync','MailAccount','MailServerOut','Smtp','CloudProvider','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','addMessage','ids','omit','getMessages','nolimit','YYYY-MM-DD\x20HH:mm:ss','rows','getMyMessages','includeAgent','findAll','addTags','setTags','spread','emit','chatInteractionTags:save','removeTags','unix','tmp','server','files','attachments','transcript-%d-%s.zip','firstName','lastName','Account','Owner','get','mkdirSync','Chat','N.A.','closedAt','referer','customerIp','customerPort','tail','existsSync','pipe','createWriteStream','views','downloadInteraction.ejs','.pdf','createPdfFromHTML','rimraf','zip-dir','request-promise','moment','mustache','util','path'];(function(_0x384695,_0x24e26f){var _0x3b4309=function(_0x2fb958){while(--_0x2fb958){_0x384695['push'](_0x384695['shift']());}};_0x3b4309(++_0x24e26f);}(_0x34e8,0x12c));var _0x834e=function(_0x6f9174,_0x48e9c3){_0x6f9174=_0x6f9174-0x0;var _0x5c904a=_0x34e8[_0x6f9174];return _0x5c904a;};'use strict';var rimraf=require(_0x834e('0x0'));var zipdir=require(_0x834e('0x1'));var rp=require(_0x834e('0x2'));var moment=require(_0x834e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x834e('0x4'));var util=require(_0x834e('0x5'));var path=require(_0x834e('0x6'));var ejs=require(_0x834e('0x7'));var fs=require('fs');var _=require(_0x834e('0x8'));var squel=require(_0x834e('0x9'));var Redis=require(_0x834e('0xa'));var qs=require('../../components/parsers/qs');var as=require(_0x834e('0xb'));var pdf=require('../../components/export/pdf');var logger=require(_0x834e('0xc'))(_0x834e('0xd'));var config=require(_0x834e('0xe'));var db=require(_0x834e('0xf'))['db'];config[_0x834e('0x10')]=_[_0x834e('0x11')](config[_0x834e('0x10')],{'host':_0x834e('0x12'),'port':0x18eb});var socket=require(_0x834e('0x13'))(new Redis(config[_0x834e('0x10')]));require(_0x834e('0x14'))[_0x834e('0x15')](socket);var jayson=require(_0x834e('0x16'));var client=jayson[_0x834e('0x17')][_0x834e('0x18')]({'port':0x232b});var client9004=jayson[_0x834e('0x17')][_0x834e('0x18')]({'port':0x232c});function respondWithRpcPromise(_0x538bb3,_0x5e5b6d,_0x6cd9b9,_0x58a27e){return new BPromise(function(_0x23848e,_0x2d95f2){var _0x28e659=_0x58a27e||client;return _0x28e659[_0x834e('0x19')](_0x538bb3,_0x6cd9b9)['then'](function(_0x43156c){logger[_0x834e('0x1a')]('ChatInteraction,\x20%s,\x20%s',_0x5e5b6d,_0x834e('0x1b'));logger['debug'](_0x834e('0x1c'),_0x5e5b6d,_0x834e('0x1b'),JSON['stringify'](_0x43156c));if(_0x43156c[_0x834e('0x1d')]){if(_0x43156c[_0x834e('0x1d')][_0x834e('0x1e')]===0x1f4){logger['error'](_0x834e('0x1f'),_0x5e5b6d,_0x43156c[_0x834e('0x1d')][_0x834e('0x20')]);return _0x2d95f2(_0x43156c[_0x834e('0x1d')][_0x834e('0x20')]);}logger[_0x834e('0x1d')](_0x834e('0x1f'),_0x5e5b6d,_0x43156c['error'][_0x834e('0x20')]);return _0x23848e(_0x43156c[_0x834e('0x1d')][_0x834e('0x20')]);}else{logger[_0x834e('0x1a')]('ChatInteraction,\x20%s,\x20%s',_0x5e5b6d,_0x834e('0x1b'));_0x23848e(_0x43156c[_0x834e('0x21')]['message']);}})[_0x834e('0x22')](function(_0x28d687){logger[_0x834e('0x1d')]('ChatInteraction,\x20%s,\x20%s',_0x5e5b6d,_0x28d687);_0x2d95f2(_0x28d687);});});}function respondWithStatusCode(_0x4e3f48,_0x231619){_0x231619=_0x231619||0xcc;return function(_0x34563b){if(_0x34563b){return _0x4e3f48['sendStatus'](_0x231619);}return _0x4e3f48[_0x834e('0x23')](_0x231619)[_0x834e('0x24')]();};}function respondWithResult(_0x58f4fd,_0x3bc4f7){_0x3bc4f7=_0x3bc4f7||0xc8;return function(_0x2e1983){if(_0x2e1983){return _0x58f4fd[_0x834e('0x23')](_0x3bc4f7)['json'](_0x2e1983);}};}function respondWithFilteredResult(_0x24fcf7,_0x3e310f){return function(_0x5e1cc5){if(_0x5e1cc5){var _0x5bef62=typeof _0x3e310f[_0x834e('0x25')]==='undefined'&&typeof _0x3e310f[_0x834e('0x26')]===_0x834e('0x27');var _0x3db026=_0x5e1cc5[_0x834e('0x28')];var _0x3cd928=_0x5bef62?0x0:_0x3e310f[_0x834e('0x25')];var _0x491919=_0x5bef62?_0x5e1cc5['count']:_0x3e310f['offset']+_0x3e310f['limit'];var _0x2c7a8d;if(_0x491919>=_0x3db026){_0x491919=_0x3db026;_0x2c7a8d=0xc8;}else{_0x2c7a8d=0xce;}_0x24fcf7[_0x834e('0x23')](_0x2c7a8d);return _0x24fcf7[_0x834e('0x29')]('Content-Range',_0x3cd928+'-'+_0x491919+'/'+_0x3db026)[_0x834e('0x2a')](_0x5e1cc5);}return null;};}function saveUpdates(_0x11f1ce){return function(_0x1f3671){if(_0x1f3671){return _0x1f3671[_0x834e('0x2b')](_0x11f1ce)[_0x834e('0x2c')](function(_0x390119){return _0x390119;});}return null;};}function removeEntity(_0x3d149d){return function(_0xfaf716){if(_0xfaf716){return _0xfaf716[_0x834e('0x2d')]()['then'](function(){_0x3d149d[_0x834e('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2c75c2){return function(_0x3787b0){if(!_0x3787b0){_0x2c75c2[_0x834e('0x2e')](0x194);}return _0x3787b0;};}function handleError(_0x2b3418,_0x444366){_0x444366=_0x444366||0x1f4;return function(_0x4689c2){logger[_0x834e('0x1d')](_0x4689c2[_0x834e('0x2f')]);if(_0x4689c2[_0x834e('0x30')]){delete _0x4689c2[_0x834e('0x30')];}_0x2b3418['status'](_0x444366)[_0x834e('0x31')](_0x4689c2);};}function getMustacheRender(_0x2f408a,_0x24a9df){return Mustache[_0x834e('0x32')](_0x2f408a,_['merge'](_0x24a9df[_0x834e('0x33')],{'contact':_0x24a9df[_0x834e('0x34')],'message':_0x24a9df['message'],'agent':_0x24a9df['agent'],'interaction':_0x24a9df['interaction'],'account':_0x24a9df[_0x834e('0x35')]}))||'';}function getInteractionUsers(_0x41bf4d,_0x20c6ae){return new BPromise(function(_0x34fefb,_0x339e28){try{if(_0x20c6ae[_0x41bf4d['id']]){_0x41bf4d[_0x834e('0x36')]=_['map'](_0x20c6ae[_0x41bf4d['id']],function(_0x2c2d94){return{'id':_0x2c2d94['id'],'fullname':_0x2c2d94['fullname']};});}}catch(_0xe103fe){_0x339e28(_0xe103fe);}_0x34fefb(_0x41bf4d);});}function getInteractionTags(_0x6a3ac,_0x47abed){return new BPromise(function(_0x18ac3b,_0x2f56c7){try{if(_0x6a3ac['TagIds']){_0x6a3ac['Tags']=[];_0x6a3ac[_0x834e('0x37')][_0x834e('0x38')](',')[_0x834e('0x39')](function(_0x130c23){_0x6a3ac[_0x834e('0x3a')]['push'](_0x47abed[_0x130c23]);});}delete _0x6a3ac[_0x834e('0x37')];}catch(_0x548d1d){_0x2f56c7(_0x548d1d);}_0x18ac3b(_0x6a3ac);});}function updateChatInteraction(_0x50c243,_0x1b2edf,_0x4a7f76){return new BPromise(function(_0x2e5239,_0x1ba66d){return getInteractionUsers(_0x50c243,_0x4a7f76)[_0x834e('0x2c')](function(_0x3c59af){return getInteractionTags(_0x3c59af,_0x1b2edf);})[_0x834e('0x2c')](function(_0x574ea8){return getStateInteraction(_0x574ea8);})[_0x834e('0x2c')](function(_0x26b847){_0x2e5239(_0x26b847);})[_0x834e('0x22')](function(_0x58c5fb){_0x1ba66d(_0x58c5fb);});});}function getStateInteraction(_0x35380e){return new BPromise(function(_0x16ac45){_0x35380e['waiting']=0x0;_0x35380e[_0x834e('0x3b')]=0x0;_0x35380e['answered']=0x0;_0x35380e[_0x834e('0x3c')]=0x0;_0x35380e[_0x834e('0x3d')]=0x0;_0x35380e['total']=0x0;if(!_0x35380e['closed']&&!_0x35380e[_0x834e('0x3e')]){_0x35380e[_0x834e('0x3f')]+=0x1;}if(!_0x35380e[_0x834e('0x40')]&&_0x35380e[_0x834e('0x3e')]){_0x35380e[_0x834e('0x3b')]+=0x1;if(_0x35380e[_0x834e('0x3f')]){_0x35380e[_0x834e('0x3f')]-=0x1;}}if(_0x35380e['closed']&&_0x35380e[_0x834e('0x41')]==='abandoned'){_0x35380e[_0x834e('0x3d')]+=0x1;if(_0x35380e['waiting']){_0x35380e[_0x834e('0x3f')]-=0x1;}}else if(_0x35380e['closed']&&!_0x35380e[_0x834e('0x3e')]&&_0x35380e[_0x834e('0x41')]){_0x35380e['unmanaged']+=0x1;if(_0x35380e[_0x834e('0x3f')]){_0x35380e[_0x834e('0x3f')]-=0x1;}}else if(_0x35380e[_0x834e('0x40')]&&_0x35380e[_0x834e('0x3e')]){_0x35380e[_0x834e('0x42')]+=0x1;if(_0x35380e[_0x834e('0x3b')]){_0x35380e[_0x834e('0x3b')]-=0x1;}}_0x35380e[_0x834e('0x43')]+=0x1;_0x16ac45(_0x35380e);});}exports[_0x834e('0x44')]=function(_0x279ea1,_0x5f3943){var _0x3124be={},_0x6fff27={},_0x47a8a9={'count':0x0,'rows':[]};var _0x112306=_[_0x834e('0x45')](db[_0x834e('0x46')][_0x834e('0x47')],function(_0x19b5ef){return{'name':_0x19b5ef[_0x834e('0x48')],'type':_0x19b5ef['type']['key']};});_0x6fff27[_0x834e('0x49')]=_[_0x834e('0x45')](_0x112306,_0x834e('0x30'));_0x6fff27[_0x834e('0x4a')]=_[_0x834e('0x4b')](_0x279ea1[_0x834e('0x4a')]);_0x6fff27[_0x834e('0x4c')]=_[_0x834e('0x4d')](_0x6fff27[_0x834e('0x49')],_0x6fff27[_0x834e('0x4a')]);_0x3124be[_0x834e('0x4e')]=_[_0x834e('0x4d')](_0x6fff27[_0x834e('0x49')],qs[_0x834e('0x4f')](_0x279ea1[_0x834e('0x4a')][_0x834e('0x4f')]));_0x3124be[_0x834e('0x4e')]=_0x3124be[_0x834e('0x4e')][_0x834e('0x50')]?_0x3124be[_0x834e('0x4e')]:_0x6fff27['model'];if(!_0x279ea1[_0x834e('0x4a')][_0x834e('0x51')]('nolimit')){_0x3124be[_0x834e('0x26')]=qs[_0x834e('0x26')](_0x279ea1['query'][_0x834e('0x26')]);_0x3124be[_0x834e('0x25')]=qs[_0x834e('0x25')](_0x279ea1[_0x834e('0x4a')][_0x834e('0x25')]);}_0x3124be[_0x834e('0x52')]=qs[_0x834e('0x53')](_0x279ea1['query'][_0x834e('0x53')]);_0x3124be[_0x834e('0x54')]=qs[_0x834e('0x4c')](_[_0x834e('0x55')](_0x279ea1[_0x834e('0x4a')],_0x6fff27[_0x834e('0x4c')]),_0x112306);var _0x344b51=[];var _0x1bc975=squel['select']()[_0x834e('0x56')]('id')['field'](_0x834e('0x30'))['field'](_0x834e('0x57'))['from']('tools_tags');var _0x6c0b29=squel[_0x834e('0x58')]()['field']('u.id')[_0x834e('0x56')](_0x834e('0x59'))[_0x834e('0x56')](_0x834e('0x5a'))[_0x834e('0x5b')](_0x834e('0x5c'),'ui')[_0x834e('0x5d')](_0x834e('0x5e'),'u','u.id\x20=\x20ui.UserId');var _0x142334=squel[_0x834e('0x58')]()['from'](_0x834e('0x5f'),'i')['left_join'](_0x834e('0x60'),'c',_0x834e('0x61'))['left_join'](_0x834e('0x5e'),'o',_0x834e('0x62'))[_0x834e('0x5d')](_0x834e('0x63'),'a','a.id\x20=\x20i.ChatWebsiteId')[_0x834e('0x5d')](_0x834e('0x64'),'me',_0x834e('0x65'))['left_join'](_0x834e('0x66'),'it',_0x834e('0x67'))[_0x834e('0x5d')](_0x834e('0x68'),'t',_0x834e('0x69'));var _0x125f37=squel[_0x834e('0x6a')]();var _0x1def00=[];var _0x208c21=squel[_0x834e('0x6a')]();var _0x1e4310;if(_0x279ea1[_0x834e('0x4a')][_0x834e('0x6b')]){_0x1e4310=as[_0x834e('0x6c')](_0x279ea1[_0x834e('0x4a')][_0x834e('0x6b')]);var _0x297cce=_0x1e4310[_0x834e('0x6d')];for(var _0x193a15=0x0;_0x193a15<_0x1e4310[_0x834e('0x6e')][_0x834e('0x50')];_0x193a15++){var _0x2cb233=_0x1e4310['conditions'][_0x193a15];var _0x2145cf='i';var _0x25d6f4=_[_0x834e('0x6f')](_0x112306,[_0x834e('0x30'),_0x2cb233['field']]);if(!_0x25d6f4){switch(_0x2cb233[_0x834e('0x56')]){case'unreadMessages':if(_0x2cb233['value']==0x1){_0x142334[_0x834e('0x70')]('`'+_0x2cb233[_0x834e('0x56')]+_0x834e('0x71'));}else{_0x142334[_0x834e('0x70')]('`'+_0x2cb233[_0x834e('0x56')]+_0x834e('0x72'));}break;case _0x834e('0x73'):if(_0x2cb233[_0x834e('0x74')]==='$substring'){if(_0x2cb233[_0x834e('0x75')]['split']('\x20')[_0x834e('0x50')]>0x1){_0x125f37[_0x297cce](_0x834e('0x76'),qs['getFullTextValue'](_0x2cb233['value']),null);}else{var _0x4a4def='%'+_0x2cb233[_0x834e('0x75')]+'%';_0x125f37[_0x297cce](_0x834e('0x77'),_0x4a4def,_0x4a4def,_0x4a4def);}}else{_0x25d6f4=_[_0x834e('0x6f')](_0x112306,[_0x834e('0x30'),'ContactId']);_0x2cb233[_0x834e('0x56')]=_0x834e('0x78');_0x11f6f0=as[_0x834e('0x79')](_0x2145cf,_0x25d6f4[_0x834e('0x7a')],_0x2cb233);_0x125f37[_0x297cce](_0x11f6f0[_0x834e('0x7b')],_0x11f6f0[_0x834e('0x75')][_0x834e('0x7c')],_0x11f6f0[_0x834e('0x75')][_0x834e('0x24')]);}break;case _0x834e('0x7d'):var _0x5b2bf6=_0x2cb233[_0x834e('0x75')][_0x834e('0x38')](',')[_0x834e('0x45')](function(_0x5b5d6f){return Number(_0x5b5d6f);});_0x5b2bf6['forEach'](function(_0x46fa0d){_0x208c21['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x46fa0d+',%');});_0x1def00=_['union'](_0x1def00,_0x5b2bf6);break;case'User':if(_0x2cb233[_0x834e('0x74')]===_0x834e('0x7e')){_0x125f37[_0x297cce]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x2cb233[_0x834e('0x75')]+'%',null);}else{_0x25d6f4=_[_0x834e('0x6f')](_0x112306,['name',_0x834e('0x3e')]);_0x2cb233[_0x834e('0x56')]='UserId';_0x11f6f0=as['buildExpression'](_0x2145cf,_0x25d6f4[_0x834e('0x7a')],_0x2cb233);_0x125f37[_0x297cce](_0x11f6f0[_0x834e('0x7b')],_0x11f6f0[_0x834e('0x75')][_0x834e('0x7c')],_0x11f6f0[_0x834e('0x75')]['end']);}break;case _0x834e('0x33'):_0x11f6f0=as['buildExpression']('me',null,_0x2cb233);_0x125f37[_0x297cce](_0x11f6f0[_0x834e('0x7b')],_0x11f6f0[_0x834e('0x75')][_0x834e('0x7c')],_0x11f6f0['value'][_0x834e('0x24')]);break;}}else{var _0x11f6f0=as['buildExpression'](_0x2145cf,_0x25d6f4[_0x834e('0x7a')],_0x2cb233);_0x125f37[_0x297cce](_0x11f6f0[_0x834e('0x7b')],_0x11f6f0[_0x834e('0x75')]['start'],_0x11f6f0[_0x834e('0x75')][_0x834e('0x24')]);}}}else{var _0x402692=_(_0x279ea1[_0x834e('0x4a')])[_0x834e('0x4b')]()[_0x834e('0x45')](function(_0x1372dd){return _[_0x834e('0x7f')](_0x112306,[_0x834e('0x30'),_0x1372dd])?_0x1372dd:undefined;})[_0x834e('0x80')]()['value']();if(!_['isEmpty'](_0x402692)){_0x402692['forEach'](function(_0x36ede9){if(_0x36ede9===_0x834e('0x81')){_0x142334[_0x834e('0x54')](_0x834e('0x82'),[][_0x834e('0x83')](_0x279ea1['query'][_0x36ede9]));}else if(_0x36ede9==='createdAt'){var _0x4520fc=JSON[_0x834e('0x84')](_0x279ea1[_0x834e('0x4a')][_0x36ede9])[_0x834e('0x85')];var _0x40a705=JSON['parse'](_0x279ea1[_0x834e('0x4a')][_0x36ede9])[_0x834e('0x86')];_0x142334[_0x834e('0x54')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x4520fc,_0x40a705);}else{if(_0x279ea1[_0x834e('0x4a')][_0x36ede9]===_0x834e('0x87')){_0x142334[_0x834e('0x54')]('i.'+_0x36ede9+_0x834e('0x88'));}else{_0x142334[_0x834e('0x54')]('i.'+_0x36ede9+'\x20=\x20?',_0x279ea1['query'][_0x36ede9]);}}});}if(_0x279ea1[_0x834e('0x4a')][_0x834e('0x89')]){if(_0x279ea1['query'][_0x834e('0x89')]==0x1){_0x142334['having'](_0x834e('0x8a'));}else{_0x142334[_0x834e('0x70')](_0x834e('0x8b'));}}if(_0x279ea1['query'][_0x834e('0x8c')]){_0x1def00=_['isArray'](_0x279ea1['query']['tag'])?_0x279ea1[_0x834e('0x4a')][_0x834e('0x8c')]:new Array(_0x279ea1[_0x834e('0x4a')][_0x834e('0x8c')]);_0x1def00[_0x834e('0x39')](function(_0x2dad55){_0x208c21['or'](_0x834e('0x8d'),'%,'+_0x2dad55+',%');});}if(_0x279ea1[_0x834e('0x4a')][_0x834e('0x8e')]){var _0x53f6e3=_0x279ea1[_0x834e('0x4a')]['filter'][_0x834e('0x8f')]('\x5c','\x5c\x5c')[_0x834e('0x8f')](/'/g,'\x27\x27');if(qs[_0x834e('0x90')](_0x53f6e3)){_0x125f37['or'](_0x834e('0x91'),_0x53f6e3+'%');}else{_0x125f37['or'](_0x834e('0x92'),qs[_0x834e('0x93')](_0x53f6e3))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x53f6e3+'%');}}}_0x142334['where'](_0x125f37);_0x142334[_0x834e('0x94')](_0x834e('0x95'));var _0x4eff8d={'type':db[_0x834e('0x96')][_0x834e('0x97')][_0x834e('0x98')],'raw':!![]};var _0x1e225f=_0x142334[_0x834e('0x99')]();_0x1e225f['field'](_0x834e('0x95'));_0x1e225f[_0x834e('0x56')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');if(_0x3124be['order']){_0x3124be[_0x834e('0x52')][_0x834e('0x39')](function(_0x4f716d){var _0x23ce49=_0x4f716d[0x0]===_0x834e('0x9a')?_0x4f716d[0x0]:'i.'+_0x4f716d[0x0];_0x142334['order'](_0x23ce49,_0x4f716d[0x1]===_0x834e('0x9b')?![]:!![]);});}if(!_['isEmpty'](_0x1def00)){_0x142334['having'](_0x208c21);_0x1e225f[_0x834e('0x54')](_0x834e('0x9c'),_0x1def00);}BPromise[_0x834e('0x9d')]()[_0x834e('0x2c')](function(){if(!_0x1e4310){if(_0x279ea1['query'][_0x834e('0x81')])return;_0x1e225f[_0x834e('0x54')](_0x834e('0x9e'));_0x142334[_0x834e('0x54')](_0x834e('0x9e'));return;}if(_0x279ea1[_0x834e('0x9f')][_0x834e('0xa0')]!==_0x834e('0xa1'))return;return _0x279ea1[_0x834e('0x9f')][_0x834e('0xa2')]({'attributes':['id'],'raw':!![]})[_0x834e('0x2c')](function(_0x261e3d){if(_[_0x834e('0xa3')](_0x261e3d)){_0x1e225f[_0x834e('0x54')](_0x834e('0xa4'));_0x142334[_0x834e('0x54')](_0x834e('0xa4'));}else{_0x1e225f[_0x834e('0x54')](_0x834e('0x82'),_[_0x834e('0x45')](_0x261e3d,'id'));_0x142334[_0x834e('0x54')](_0x834e('0x82'),_['map'](_0x261e3d,'id'));}});})[_0x834e('0x2c')](function(){if(_0x279ea1[_0x834e('0x9f')][_0x834e('0xa0')]===_0x834e('0xa1')&&!_0x1e4310&&!_0x279ea1[_0x834e('0x4a')][_0x834e('0x81')])return[];return db[_0x834e('0xa5')][_0x834e('0x4a')](_0x1e225f[_0x834e('0xa6')](),_0x4eff8d);})['then'](function(_0x5ce790){_0x47a8a9['count']=_0x5ce790[_0x834e('0x50')];if(_0x47a8a9['count']===0x0)return[];return db[_0x834e('0xa5')][_0x834e('0x4a')](_0x1bc975[_0x834e('0xa6')](),_0x4eff8d)['then'](function(_0xae00f){_0x344b51=_[_0x834e('0xa7')](_0xae00f,'id');_0x4eff8d=_[_0x834e('0xa8')](_0x4eff8d,{'model':db[_0x834e('0x46')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x279ea1[_0x834e('0x4a')][_0x834e('0x4f')]){_0x3124be['attributes'][_0x834e('0x39')](function(_0x27bd2e){_0x142334[_0x834e('0x56')]('i.'+_0x27bd2e);});}else{_0x142334[_0x834e('0x56')](_0x834e('0xa9'),'unreadMessages');_0x142334['field']('a.key','Account.key');_0x142334[_0x834e('0x56')](_0x834e('0xaa'),'Account.mandatoryDisposition');_0x142334[_0x834e('0x56')](_0x834e('0xab'),'contactName');_0x142334[_0x834e('0x56')](_0x834e('0xac'));_0x142334[_0x834e('0x56')](_0x834e('0xad'),_0x834e('0xae'));_0x142334[_0x834e('0x56')]('c.lastName','Contact.lastName');_0x142334[_0x834e('0x56')](_0x834e('0xaf'),_0x834e('0xb0'));_0x142334['field'](_0x834e('0xb1'),_0x834e('0xb2'));_0x142334['field'](_0x834e('0xb3'),_0x834e('0xb4'));_0x142334[_0x834e('0x56')](_0x834e('0xb5'),'Contact.fax');_0x142334[_0x834e('0x56')]('o.fullname','Owner.fullname');_0x142334[_0x834e('0x56')](_0x834e('0xb6'),_0x834e('0xb7'));_0x142334[_0x834e('0x56')](_0x834e('0xb8'),_0x834e('0x37'));}if(_0x3124be['limit'])_0x142334['limit'](_0x3124be[_0x834e('0x26')]);if(_0x3124be[_0x834e('0x25')])_0x142334[_0x834e('0x25')](_0x3124be[_0x834e('0x25')]);return db[_0x834e('0xa5')][_0x834e('0x4a')](_0x142334[_0x834e('0xa6')](),_0x4eff8d);})['then'](function(_0x435a75){if(_0x435a75[_0x834e('0x50')]>0x0)_0x6c0b29['where'](_0x834e('0xb9'),_[_0x834e('0x45')](_0x435a75,'id'));return db[_0x834e('0xa5')][_0x834e('0x4a')](_0x6c0b29[_0x834e('0xa6')](),_0x4eff8d)[_0x834e('0x2c')](function(_0x231f0b){var _0x3b44f3=_[_0x834e('0xba')](_0x231f0b,_0x834e('0xbb'));var _0x496709=[];_0x435a75[_0x834e('0x39')](function(_0x17e922){_0x496709[_0x834e('0xbc')](updateChatInteraction(_0x17e922,_0x344b51,_0x3b44f3));});return BPromise['all'](_0x496709);});});})[_0x834e('0x2c')](function(_0x20fdfd){_0x47a8a9['rows']=_0x20fdfd;return _0x47a8a9;})[_0x834e('0x2c')](respondWithFilteredResult(_0x5f3943,_0x3124be))['catch'](handleError(_0x5f3943,null));};exports[_0x834e('0xbd')]=function(_0x53c483,_0x16a42b){var _0x560d10={'raw':![],'where':{'id':_0x53c483[_0x834e('0xbe')]['id']}},_0x2b6d1={};_0x2b6d1[_0x834e('0x49')]=_[_0x834e('0x4b')](db['ChatInteraction'][_0x834e('0x47')]);_0x2b6d1[_0x834e('0x4a')]=_[_0x834e('0x4b')](_0x53c483[_0x834e('0x4a')]);_0x2b6d1[_0x834e('0x4c')]=_[_0x834e('0x4d')](_0x2b6d1[_0x834e('0x49')],_0x2b6d1[_0x834e('0x4a')]);_0x560d10[_0x834e('0x4e')]=_[_0x834e('0x4d')](_0x2b6d1[_0x834e('0x49')],qs[_0x834e('0x4f')](_0x53c483[_0x834e('0x4a')][_0x834e('0x4f')]));_0x560d10[_0x834e('0x4e')]=_0x560d10[_0x834e('0x4e')][_0x834e('0x50')]?_0x560d10['attributes']:_0x2b6d1['model'];if(_0x53c483[_0x834e('0x4a')][_0x834e('0xbf')]){_0x560d10[_0x834e('0xc0')]=[{'all':!![]}];}_0x560d10=_[_0x834e('0xa8')]({},_0x560d10,_0x53c483[_0x834e('0xc1')]);return db[_0x834e('0x46')][_0x834e('0x6f')](_0x560d10)[_0x834e('0x2c')](handleEntityNotFound(_0x16a42b,null))[_0x834e('0x2c')](respondWithResult(_0x16a42b,null))[_0x834e('0x22')](handleError(_0x16a42b,null));};exports[_0x834e('0xc2')]=function(_0x32645e,_0x513d9e){return db[_0x834e('0x46')]['create'](_0x32645e[_0x834e('0x33')],{})[_0x834e('0x2c')](respondWithResult(_0x513d9e,0xc9))[_0x834e('0x22')](handleError(_0x513d9e,null));};exports['update']=function(_0x1a65b4,_0x23a386){if(_0x1a65b4['body']['id']){delete _0x1a65b4['body']['id'];}return db[_0x834e('0x46')][_0x834e('0x6f')]({'where':{'id':_0x1a65b4['params']['id']}})[_0x834e('0x2c')](handleEntityNotFound(_0x23a386,null))[_0x834e('0x2c')](saveUpdates(_0x1a65b4[_0x834e('0x33')],null))[_0x834e('0x2c')](respondWithResult(_0x23a386,null))[_0x834e('0x22')](handleError(_0x23a386,null));};exports['destroy']=function(_0x4e7545,_0x453e58){return db['ChatInteraction']['find']({'where':{'id':_0x4e7545['params']['id']}})[_0x834e('0x2c')](handleEntityNotFound(_0x453e58,null))[_0x834e('0x2c')](removeEntity(_0x453e58,null))['catch'](handleError(_0x453e58,null));};exports[_0x834e('0xc3')]=function(_0x66cbdc,_0x470568){return db[_0x834e('0x46')]['describe']()[_0x834e('0x2c')](respondWithResult(_0x470568,null))[_0x834e('0x22')](handleError(_0x470568,null));};exports[_0x834e('0xc4')]=function(_0x5633f4,_0x3d8af7){var _0x5f3b7d=_0x5633f4[_0x834e('0xbe')]['id'];var _0x4af2a2;var _0x461420;var _0x108100;return db['ChatInteraction'][_0x834e('0xc5')]({'where':{'id':_0x5f3b7d}})[_0x834e('0x2c')](function(_0x41e7a8){_0x4af2a2=_0x41e7a8;return db[_0x834e('0xc6')][_0x834e('0xc5')]({'where':{'id':_0x41e7a8[_0x834e('0x81')]},'attributes':['id','vidaooApiKey',_0x834e('0xc7'),_0x834e('0xc8'),_0x834e('0xc9'),_0x834e('0xca')],'raw':!![]});})[_0x834e('0x2c')](function(_0x1b8e67){if(_0x1b8e67&&_0x1b8e67['vidaooApiKey']&&_0x1b8e67[_0x834e('0xc7')]){_0x461420=_0x1b8e67;var _0x490a57={'interaction':{'id':_0x5f3b7d},'agent':{'id':_0x5633f4['user']['id'],'name':_0x5633f4[_0x834e('0x9f')]['name'],'fullname':_0x5633f4['user'][_0x834e('0xcb')],'email':_0x5633f4[_0x834e('0x9f')][_0x834e('0xcc')]},'contact':_0x5633f4[_0x834e('0x33')][_0x834e('0x34')],'account':_0x5633f4[_0x834e('0x33')][_0x834e('0x35')]};var _0x155f2d={'rejectUnauthorized':![],'method':_0x834e('0xcd'),'url':_0x834e('0xce'),'headers':{'X-APIKEY':_0x1b8e67[_0x834e('0xcf')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x5633f4[_0x834e('0x9f')][_0x834e('0xcc')]],'buttons':null,'topic':_0x461420[_0x834e('0xc8')],'note':_['isNull'](_0x461420[_0x834e('0xc9')])?null:getMustacheRender(_0x461420['vidaooNote'],_0x490a57),'metadata':null},'redirect':_0x834e('0xd0'),'json':!![]};try{if(!_[_0x834e('0xd1')](_0x461420[_0x834e('0xca')])){var _0x2cdbe0=getMustacheRender(_0x461420['vidaooMetadata'],_0x490a57);var _0x5f558a=JSON[_0x834e('0x84')](_0x2cdbe0);_0x155f2d[_0x834e('0x33')]['metadata']=_0x5f558a;}}catch(_0x375c35){throw new db[(_0x834e('0x96'))]['ValidationError'](_0x834e('0xd2'));}return rp(_0x155f2d);}else{throw new db[(_0x834e('0x96'))][(_0x834e('0xd3'))](_0x834e('0xd4'));}})['then'](function(_0x57ff06){_0x108100=_0x57ff06;if(_0x108100['id']){var _0x4ead1d={'body':_0x108100['join_url'],'ChatWebsiteId':_0x461420['id'],'ChatInteractionId':_0x4af2a2['id'],'direction':_0x834e('0xd5'),'UserId':_0x5633f4[_0x834e('0x9f')]['id']};return db['ChatMessage'][_0x834e('0xc2')](_0x4ead1d,{});}else{throw new db['Sequelize'][(_0x834e('0xd3'))](_0x834e('0xd6'));}})[_0x834e('0x2c')](function(){return _0x4af2a2[_0x834e('0xd7')]({'vidaooSessionId':_0x108100['id']});})[_0x834e('0x2c')](respondWithResult(_0x3d8af7,null))[_0x834e('0x22')](handleError(_0x3d8af7,null));};exports[_0x834e('0xd8')]=function(_0x4fc61d,_0x12a0f3){if(_0x4fc61d[_0x834e('0x33')]['id']){delete _0x4fc61d['body']['id'];}return db[_0x834e('0x46')][_0x834e('0x6f')]({'where':{'id':_0x4fc61d['params']['id']},'include':[{'model':db['CmContact'],'as':'Contact'}]})[_0x834e('0x2c')](handleEntityNotFound(_0x12a0f3,null))[_0x834e('0x2c')](saveUpdates(_0x4fc61d[_0x834e('0x33')],null))['then'](respondWithResult(_0x12a0f3,null))[_0x834e('0x22')](handleError(_0x12a0f3,null));};exports[_0x834e('0xd9')]=function(_0xbd0346,_0x17e729){if(_0xbd0346[_0x834e('0x33')]['id']){delete _0xbd0346[_0x834e('0x33')]['id'];}return db[_0x834e('0x46')][_0x834e('0x6f')]({'where':{'id':_0xbd0346[_0x834e('0xbe')]['id']}})[_0x834e('0x2c')](function(_0x48b6c4){if(!_0x48b6c4){logger['error'](_0x834e('0xda'),_0x834e('0xd9'),0x194,_0x834e('0xdb'));_0x17e729[_0x834e('0x2e')](0x194);}else{if(_0x48b6c4[_0x834e('0x3e')]){throw new db[(_0x834e('0x96'))][(_0x834e('0xd3'))](_0x834e('0xdc'));}}return _0x48b6c4;})[_0x834e('0x2c')](function(_0x97a4b2){if(_0x97a4b2){return _0x97a4b2[_0x834e('0x2b')]({'closed':_0xbd0346[_0x834e('0x33')][_0x834e('0x40')],'disposition':_0xbd0346['body'][_0x834e('0x41')]})[_0x834e('0x2c')](function(_0x3f5b2e){return _0x3f5b2e;});}})[_0x834e('0x2c')](function(){return respondWithRpcPromise('AbandonInteraction','abandon',_0xbd0346['body'],client9004);})[_0x834e('0x2c')](respondWithResult(_0x17e729,null))[_0x834e('0x22')](handleError(_0x17e729,null));};exports[_0x834e('0xdd')]=function(_0x23d7e6,_0x181ecd){_0x23d7e6[_0x834e('0x33')][_0x834e('0x30')]=_0x23d7e6[_0x834e('0xde')]['originalname'];_0x23d7e6['body']['basename']=_0x23d7e6['file'][_0x834e('0xdf')];_0x23d7e6[_0x834e('0x33')][_0x834e('0x7a')]=_0x23d7e6[_0x834e('0xde')][_0x834e('0xe0')];return db[_0x834e('0xe1')][_0x834e('0xc2')](_0x23d7e6[_0x834e('0x33')])[_0x834e('0x2c')](respondWithResult(_0x181ecd,0xc9))['catch'](handleError(_0x181ecd,null));};exports['attachmentDownload']=function(_0x4d1545,_0x5dc651){return db[_0x834e('0x46')][_0x834e('0xc5')]({'where':{'id':_0x4d1545[_0x834e('0xbe')]['id']},'raw':!![]})[_0x834e('0x2c')](handleEntityNotFound(_0x5dc651,null))[_0x834e('0x2c')](function(_0xcb9751){if(_0xcb9751){if(_0xcb9751[_0x834e('0x40')]){return _0x5dc651[_0x834e('0x23')](0x193)[_0x834e('0x2a')]({'status':0x193,'message':_0x834e('0xe2')});}return db[_0x834e('0xe1')][_0x834e('0xc5')]({'where':{'id':_0x4d1545[_0x834e('0x4a')][_0x834e('0xe3')]},'raw':!![]})[_0x834e('0x2c')](handleEntityNotFound(_0x5dc651,null));}})[_0x834e('0x2c')](function(_0x5022f2){if(_0x5022f2){var _0x13f473=_0x5022f2['ChatOfflineMessageId']!==null;var _0x1f6bb9=path[_0x834e('0xe4')](config[_0x834e('0xe5')],'server/files/attachments/');if(_0x13f473){_0x1f6bb9=path[_0x834e('0xe4')](_0x1f6bb9,_0x834e('0xe6'));}var _0x4d7fef=path['join'](_0x1f6bb9,_0x5022f2[_0x834e('0xe7')]);return _0x5dc651[_0x834e('0xe8')](_0x4d7fef);}})[_0x834e('0x22')](handleError(_0x5dc651,null));};exports[_0x834e('0xe9')]=function(_0x12d468,_0x2e9116){var _0x3eb2e8=null;var _0x239a4e=null;var _0x569a80=null;if(_0x12d468[_0x834e('0x33')]['id']){delete _0x12d468[_0x834e('0x33')]['id'];}if(_0x12d468[_0x834e('0x33')][_0x834e('0xea')]){_0x569a80=path[_0x834e('0xe4')](config[_0x834e('0xe5')],_0x834e('0xeb'),util['format'](_0x834e('0xec'),Date['now']()));_0x12d468['body'][_0x834e('0xed')]=_0x569a80;}return db[_0x834e('0x46')]['find']({'where':{'id':_0x12d468[_0x834e('0xbe')]['id']},'include':[{'model':db[_0x834e('0xee')],'as':'Messages','include':[{'model':db[_0x834e('0xef')],'as':_0x834e('0xef')}]}]})['then'](handleEntityNotFound(_0x2e9116,null))['then'](saveUpdates(_0x12d468[_0x834e('0x33')],null))[_0x834e('0x2c')](function(_0x4e6525){if(_0x4e6525){_0x3eb2e8=_0x4e6525;return db['ChatWebsite'][_0x834e('0x6f')]({'where':{'id':_0x3eb2e8[_0x834e('0x81')]}});}})['then'](function(_0x480290){if(_0x480290){_0x239a4e=_0x480290;return db['CmContact']['find']({'where':{'id':_0x3eb2e8[_0x834e('0x78')]}});}})['then'](function(_0x3be4c3){if(_0x3be4c3){if(_0x569a80){var _0x52cdcc=null;for(var _0x343348=0x1;_0x343348<_0x3eb2e8[_0x834e('0xf0')][_0x834e('0x50')];++_0x343348){_0x52cdcc=_0x3eb2e8[_0x834e('0xf0')][_0x343348];var _0x4fabe6=_0x52cdcc[_0x834e('0x3e')]?util[_0x834e('0xf1')](_0x834e('0xf2'),_0x239a4e[_0x834e('0xf3')],_0x52cdcc[_0x834e('0x3e')]):_0x834e('0xf4');var _0x3d8abb=_0x12d468[_0x834e('0x33')][_0x834e('0xf5')]||util[_0x834e('0xf1')]('%s%d',_0x834e('0xf6'),_0x52cdcc['ContactId']);switch(_0x239a4e[_0x834e('0xf7')]){case _0x834e('0xf8'):_0x4fabe6=_0x52cdcc[_0x834e('0x3e')]?util[_0x834e('0xf1')](_0x834e('0xf2'),_0x239a4e['agentAlias'],_0x52cdcc[_0x834e('0x3e')]):'System';break;case'agent_alias':_0x4fabe6=_0x52cdcc[_0x834e('0x3e')]?_0x52cdcc[_0x834e('0xef')][_0x834e('0xf9')]||_0x52cdcc['User'][_0x834e('0xcb')]:_0x834e('0xf4');break;case _0x834e('0xfa'):_0x4fabe6=_0x52cdcc[_0x834e('0x3e')]?_0x52cdcc[_0x834e('0xef')][_0x834e('0xcb')]:_0x834e('0xf4');break;default:_0x4fabe6=_0x52cdcc[_0x834e('0x3e')]?util[_0x834e('0xf1')](_0x834e('0xf2'),_0x239a4e[_0x834e('0xf3')],_0x52cdcc['UserId']):_0x834e('0xf4');}var _0x121d87=util[_0x834e('0xf1')](_0x834e('0xfb'),moment(_0x52cdcc[_0x834e('0xfc')])[_0x834e('0xf1')]('MM/DD/YYYY\x20HH:mm:ss'),_0x52cdcc[_0x834e('0xfd')]==='in'?_0x3d8abb:_0x4fabe6,_0x52cdcc[_0x834e('0x33')]);if(!_0x52cdcc[_0x834e('0xfe')]){fs[_0x834e('0xff')](_0x569a80,_0x121d87);}}return db[_0x834e('0x100')][_0x834e('0xc5')]({'where':{'service':!![]},'include':[{'model':db[_0x834e('0x101')],'as':_0x834e('0x102'),'raw':!![],'include':[{'model':db[_0x834e('0x103')],'as':_0x834e('0x103'),'raw':!![]}]}]});}}})['then'](function(_0x571645){if(!_0x571645||!_0x571645[_0x834e('0x102')]||!_0x12d468['body'])return _0x3eb2e8;var _0x4094d5=_0x571645[_0x834e('0x104')]();return respondWithRpcPromise(_0x834e('0x105'),_0x834e('0x106'),{'account':_0x4094d5,'message':{'from':util[_0x834e('0xf1')](_0x834e('0x107'),_0x571645['name'],_0x571645[_0x834e('0xcc')]||_0x571645['Smtp']['user']),'to':_0x12d468['body'][_0x834e('0xea')],'subject':_0x834e('0x108'),'text':util['format']('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x12d468['body'][_0x834e('0xea')]),'attachments':[{'path':_0x569a80}]}})[_0x834e('0x2c')](function(){return _0x3eb2e8;})[_0x834e('0x22')](function(_0x5e0bfe){logger[_0x834e('0x1d')](_0x5e0bfe);});})[_0x834e('0x2c')](respondWithStatusCode(_0x2e9116,0xc8))[_0x834e('0x22')](handleError(_0x2e9116,null));};exports[_0x834e('0x109')]=function(_0xb9635a,_0x3c1a19){return db['ChatMessage']['find']({'where':{'id':_0xb9635a['params']['id']}})['then'](handleEntityNotFound(_0x3c1a19,null))[_0x834e('0x2c')](function(_0xf82ca8){if(_0xf82ca8){return _0xf82ca8[_0x834e('0x109')](_0xb9635a[_0x834e('0x33')][_0x834e('0x10a')],_[_0x834e('0x10b')](_0xb9635a[_0x834e('0x33')],[_0x834e('0x10a'),'id'])||{});}})[_0x834e('0x2c')](respondWithResult(_0x3c1a19,null))[_0x834e('0x22')](handleError(_0x3c1a19,null));};exports[_0x834e('0x10c')]=function(_0x18735a,_0x3446ff){var _0x1e11e0={'raw':![],'where':{}};var _0x38796c={};var _0x59bd0e={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x834e('0xc5')]({'where':{'id':_0x18735a[_0x834e('0xbe')]['id']}})[_0x834e('0x2c')](handleEntityNotFound(_0x3446ff,null))['then'](function(_0xf89b9e){if(_0xf89b9e){_0x38796c[_0x834e('0x49')]=_[_0x834e('0x4b')](db[_0x834e('0xee')][_0x834e('0x47')]);_0x38796c[_0x834e('0x4a')]=_[_0x834e('0x4b')](_0x18735a[_0x834e('0x4a')]);_0x38796c[_0x834e('0x4c')]=_['intersection'](_0x38796c[_0x834e('0x49')],_0x38796c[_0x834e('0x4a')]);_0x1e11e0[_0x834e('0x4e')]=_[_0x834e('0x4d')](_0x38796c['model'],qs[_0x834e('0x4f')](_0x18735a[_0x834e('0x4a')][_0x834e('0x4f')]));_0x1e11e0[_0x834e('0x4e')]=_0x1e11e0[_0x834e('0x4e')][_0x834e('0x50')]?_0x1e11e0[_0x834e('0x4e')]:_0x38796c[_0x834e('0x49')];if(!_0x18735a[_0x834e('0x4a')]['hasOwnProperty'](_0x834e('0x10d'))){_0x1e11e0['limit']=qs[_0x834e('0x26')](_0x18735a['query'][_0x834e('0x26')]);_0x1e11e0[_0x834e('0x25')]=qs[_0x834e('0x25')](_0x18735a[_0x834e('0x4a')][_0x834e('0x25')]);}_0x1e11e0['order']=qs[_0x834e('0x53')](_0x18735a[_0x834e('0x4a')]['sort']);_0x1e11e0['where']=qs[_0x834e('0x4c')](_['pick'](_0x18735a['query'],_0x38796c['filters']));_0x1e11e0[_0x834e('0x54')][_0x834e('0xbb')]=_0xf89b9e['id'];if(_0x18735a[_0x834e('0x4a')][_0x834e('0x8e')]){_0x1e11e0[_0x834e('0x54')]=_[_0x834e('0xa8')](_0x1e11e0[_0x834e('0x54')],{'$or':_['map'](_0x1e11e0[_0x834e('0x4e')],function(_0x278052){var _0x4a428c={};_0x4a428c[_0x278052]={'$like':'%'+_0x18735a['query'][_0x834e('0x8e')]+'%'};return _0x4a428c;})});}if(_0x18735a[_0x834e('0x4a')]['$gte']){var _0x5920f3=_0x18735a[_0x834e('0x4a')][_0x834e('0x85')][_0x834e('0x38')](',');var _0x599664={};_0x599664[_0x5920f3[0x0]]={'$gte':moment(_0x5920f3[0x1])[_0x834e('0xf1')](_0x834e('0x10e'))};_0x1e11e0[_0x834e('0x54')]=_['merge'](_0x1e11e0[_0x834e('0x54')],_0x599664);}_0x1e11e0=_['merge']({},_0x1e11e0,_0x18735a[_0x834e('0xc1')]);return db[_0x834e('0xee')][_0x834e('0x28')]({'where':_0x1e11e0[_0x834e('0x54')]})[_0x834e('0x2c')](function(_0x516a53){_0x59bd0e[_0x834e('0x28')]=_0x516a53;if(_0x18735a[_0x834e('0x4a')][_0x834e('0xbf')]){_0x1e11e0[_0x834e('0xc0')]=[{'all':!![]}];}return db[_0x834e('0xee')]['findAll'](_0x1e11e0);})['then'](function(_0x2ca127){_0x59bd0e[_0x834e('0x10f')]=_0x2ca127;return _0x59bd0e;});}})[_0x834e('0x2c')](respondWithFilteredResult(_0x3446ff,_0x1e11e0))['catch'](handleError(_0x3446ff,null));};exports[_0x834e('0x110')]=function(_0x2e3294,_0x28d9c3){var _0x386b73={'where':{}},_0x53faec={},_0x3cc563={'count':0x0,'rows':[]};return db[_0x834e('0x46')]['findOne']({'where':{'id':_0x2e3294[_0x834e('0xbe')]['id']}})[_0x834e('0x2c')](handleEntityNotFound(_0x28d9c3,null))[_0x834e('0x2c')](function(_0x3e408c){if(_0x3e408c){_0x53faec['model']=_[_0x834e('0x4b')](db['ChatMessage'][_0x834e('0x47')]);_0x53faec[_0x834e('0x4a')]=_[_0x834e('0x4b')](_0x2e3294[_0x834e('0x4a')]);_0x53faec[_0x834e('0x4c')]=_[_0x834e('0x4d')](_0x53faec['model'],_0x53faec['query']);_0x386b73[_0x834e('0x4e')]=_[_0x834e('0x4d')](_0x53faec['model'],qs[_0x834e('0x4f')](_0x2e3294['query'][_0x834e('0x4f')]));_0x386b73[_0x834e('0x4e')]=_0x386b73[_0x834e('0x4e')][_0x834e('0x50')]?_0x386b73[_0x834e('0x4e')]:_0x53faec[_0x834e('0x49')];if(!_0x2e3294[_0x834e('0x4a')]['hasOwnProperty'](_0x834e('0x10d'))){_0x386b73[_0x834e('0x26')]=qs[_0x834e('0x26')](_0x2e3294[_0x834e('0x4a')][_0x834e('0x26')]);_0x386b73['offset']=qs[_0x834e('0x25')](_0x2e3294[_0x834e('0x4a')][_0x834e('0x25')]);}_0x386b73['order']=qs['sort'](_0x2e3294['query'][_0x834e('0x53')]);_0x386b73[_0x834e('0x54')]=qs[_0x834e('0x4c')](_[_0x834e('0x55')](_0x2e3294[_0x834e('0x4a')],_0x53faec[_0x834e('0x4c')]));_0x386b73[_0x834e('0x54')][_0x834e('0xbb')]=_0x3e408c['id'];if(_0x2e3294[_0x834e('0x4a')][_0x834e('0x8e')]){_0x386b73[_0x834e('0x54')]=_['merge'](_0x386b73[_0x834e('0x54')],{'$or':_[_0x834e('0x45')](_0x386b73[_0x834e('0x4e')],function(_0x26534d){var _0x4081a1={};_0x4081a1[_0x26534d]={'$like':'%'+_0x2e3294[_0x834e('0x4a')][_0x834e('0x8e')]+'%'};return _0x4081a1;})});}_0x386b73[_0x834e('0x54')]['secret']=![];if(_0x2e3294[_0x834e('0x4a')]['id']){_0x386b73[_0x834e('0x54')]['id']={'$gt':_0x2e3294['query']['id']};}_0x386b73=_[_0x834e('0xa8')]({},_0x386b73,_0x2e3294[_0x834e('0xc1')]);return db[_0x834e('0xee')][_0x834e('0x28')]({'where':_0x386b73['where']})['then'](function(_0x3d37c8){_0x3cc563['count']=_0x3d37c8;_0x386b73[_0x834e('0xc0')]=[];if(_0x2e3294[_0x834e('0x4a')][_0x834e('0x111')]){_0x386b73[_0x834e('0xc0')][_0x834e('0xbc')]({'model':db['User'],'as':_0x834e('0xef'),'attributes':['id','fullname','alias']});}if(_0x2e3294[_0x834e('0x4a')][_0x834e('0xbf')]){_0x386b73[_0x834e('0xc0')]=[{'all':!![]}];}return db[_0x834e('0xee')][_0x834e('0x112')](_0x386b73);})[_0x834e('0x2c')](function(_0x5912ee){_0x3cc563[_0x834e('0x10f')]=_0x5912ee;return _0x3cc563;});}})[_0x834e('0x2c')](respondWithFilteredResult(_0x28d9c3,_0x386b73))['catch'](handleError(_0x28d9c3,null));};exports[_0x834e('0x113')]=function(_0x3b4264,_0x4b070a){return db[_0x834e('0x46')][_0x834e('0x6f')]({'where':{'id':_0x3b4264['params']['id']}})[_0x834e('0x2c')](handleEntityNotFound(_0x4b070a,null))[_0x834e('0x2c')](function(_0x164170){if(_0x164170){return _0x164170[_0x834e('0x114')](_0x3b4264[_0x834e('0x33')][_0x834e('0x10a')],_[_0x834e('0x10b')](_0x3b4264[_0x834e('0x33')],[_0x834e('0x10a'),'id'])||{})[_0x834e('0x115')](function(){return db['Tag'][_0x834e('0x112')]({'attributes':['id',_0x834e('0x30'),_0x834e('0x57')],'where':{'id':_0x3b4264[_0x834e('0x33')][_0x834e('0x10a')]}});})[_0x834e('0x2c')](function(_0x2d61c1){socket[_0x834e('0x116')](_0x834e('0x117'),{'id':Number(_0x3b4264[_0x834e('0xbe')]['id']),'tags':_0x2d61c1||[]});return{'id':Number(_0x3b4264[_0x834e('0xbe')]['id']),'tags':_0x2d61c1||[]};});}})[_0x834e('0x2c')](respondWithResult(_0x4b070a,null))['catch'](handleError(_0x4b070a,null));};exports[_0x834e('0x118')]=function(_0x1cd122,_0x49be08){return db['ChatInteraction']['find']({'where':{'id':_0x1cd122[_0x834e('0xbe')]['id']}})[_0x834e('0x2c')](handleEntityNotFound(_0x49be08,null))[_0x834e('0x2c')](function(_0x3530bc){if(_0x3530bc){return _0x3530bc[_0x834e('0x118')](_0x1cd122[_0x834e('0x4a')][_0x834e('0x10a')]);}})['then'](respondWithStatusCode(_0x49be08,null))['catch'](handleError(_0x49be08,null));};exports['download']=function(_0x47947b,_0x684a97){var _0x3c8fc2=moment()[_0x834e('0x119')]()['toString']();var _0x5776c5=path['join'](config[_0x834e('0xe5')],'server','files',_0x834e('0x11a'));var _0x378bf3=path[_0x834e('0xe4')](config[_0x834e('0xe5')],_0x834e('0x11b'),_0x834e('0x11c'),_0x834e('0x11d'));var _0x59a706=path[_0x834e('0xe4')](_0x5776c5,_0x3c8fc2);var _0x11f472=util[_0x834e('0xf1')](_0x834e('0x11e'),_0x47947b[_0x834e('0xbe')]['id'],_0x3c8fc2);var _0x488f82=path[_0x834e('0xe4')](_0x5776c5,_0x11f472);var _0x5a3876=[];_0x5a3876[_0x834e('0xbc')]({'model':db[_0x834e('0xef')],'as':_0x834e('0xef'),'attributes':['id','fullname'],'raw':!![]});_0x5a3876['push']({'model':db['CmContact'],'as':'Contact','attributes':['id',_0x834e('0x11f'),_0x834e('0x120')],'raw':!![]});if(_0x47947b['query']['attachments']){_0x5a3876[_0x834e('0xbc')]({'model':db[_0x834e('0xe1')],'as':_0x834e('0xe1'),'raw':!![]});}var _0x51f527=[{'model':db[_0x834e('0xee')],'as':_0x834e('0xf0'),'attributes':['id',_0x834e('0x33'),'createdAt',_0x834e('0xfd'),_0x834e('0xfe'),_0x834e('0x89')],'include':_0x5a3876}];_0x51f527[_0x834e('0xbc')]({'model':db[_0x834e('0xc6')],'as':_0x834e('0x121'),'attributes':['id',_0x834e('0x30')]});_0x51f527['push']({'model':db[_0x834e('0xef')],'as':_0x834e('0x122'),'attributes':['id',_0x834e('0xcb')]});return db['ChatInteraction'][_0x834e('0x6f')]({'where':{'id':_0x47947b[_0x834e('0xbe')]['id']},'include':_0x51f527})[_0x834e('0x2c')](handleEntityNotFound(_0x684a97,null))[_0x834e('0x2c')](function(_0x2bbb1a){if(_0x2bbb1a){var _0x1ffed9=_0x2bbb1a[_0x834e('0x123')]({'plain':!![]});fs[_0x834e('0x124')](_0x59a706);var _0x25fa75={'channel':_0x834e('0x125'),'account':_0x1ffed9[_0x834e('0x121')][_0x834e('0x30')],'agent':_0x1ffed9['Owner']?_0x1ffed9[_0x834e('0x122')]['fullname']:_0x834e('0x126'),'createdAt':moment(_0x1ffed9['createdAt'])[_0x834e('0xf1')](_0x834e('0x10e'))[_0x834e('0xa6')](),'closedAt':_0x1ffed9[_0x834e('0x40')]?moment(_0x1ffed9[_0x834e('0x127')])[_0x834e('0xf1')](_0x834e('0x10e'))[_0x834e('0xa6')]():'','disposition':_0x1ffed9['disposition'],'chatInfo':{'browser':_0x1ffed9['browserName'],'os':_0x1ffed9['osName'],'referer':_0x1ffed9[_0x834e('0x128')],'customerIp':_0x1ffed9[_0x834e('0x129')],'customerPort':_0x1ffed9[_0x834e('0x12a')]?_0x1ffed9[_0x834e('0x12a')]:_0x834e('0x126')},'messages':_(_0x1ffed9[_0x834e('0xf0')])[_0x834e('0x12b')]()[_0x834e('0x8e')]({'secret':![]})['map'](function(_0x5a312e){if(_0x5a312e[_0x834e('0xe1')]){var _0x42e5ee=path[_0x834e('0xe4')](_0x378bf3,_0x5a312e['Attachment']['basename']);if(fs[_0x834e('0x12c')](_0x42e5ee)){fs['createReadStream'](_0x42e5ee)[_0x834e('0x12d')](fs[_0x834e('0x12e')](path[_0x834e('0xe4')](_0x59a706,_0x5a312e['Attachment'][_0x834e('0xe7')])));}}return{'date':moment(_0x5a312e[_0x834e('0xfc')])[_0x834e('0xf1')](_0x834e('0x10e'))[_0x834e('0xa6')](),'sender':_0x5a312e[_0x834e('0xfd')]===_0x834e('0xd5')?_0x5a312e['User']?_0x5a312e[_0x834e('0xef')][_0x834e('0xcb')]:_0x834e('0xf4'):_0x5a312e[_0x834e('0x73')][_0x834e('0x11f')]+(_0x5a312e[_0x834e('0x73')][_0x834e('0x120')]?'\x20'+_0x5a312e['Contact']['lastName']:''),'body':_0x5a312e[_0x834e('0xe1')]?_0x5a312e['Attachment']['basename']:_0x5a312e[_0x834e('0x33')],'direction':_0x5a312e[_0x834e('0xfd')]==='out'?'A':'C','secret':_0x5a312e[_0x834e('0xfe')],'read':_0x5a312e['read'],'attachment':_0x5a312e['Attachment']};})[_0x834e('0x75')]()};return ejs['renderFile'](path[_0x834e('0xe4')](config[_0x834e('0xe5')],_0x834e('0x11b'),_0x834e('0x12f'),_0x834e('0x130')),{'interaction':_0x25fa75})[_0x834e('0x2c')](function(_0x1a48f9){var _0x196f86=path[_0x834e('0xe4')](_0x59a706,'transcript-'+_0x1ffed9['id']+'-'+_0x3c8fc2+_0x834e('0x131'));var _0x19a42c={'path':_0x196f86,'channel':_0x834e('0x125'),'interactionId':_0x1ffed9['id']};return pdf[_0x834e('0x132')](_0x1a48f9,_0x19a42c);})['then'](function(){return new Promise(function(_0x4b1178,_0x46e533){zipdir(_0x59a706,{'saveTo':_0x488f82},function(_0x13a7e1,_0x5d801a){if(_0x13a7e1)return _0x46e533(_0x13a7e1);return _0x4b1178(_0x5d801a);});})[_0x834e('0x2c')](function(){return new BPromise(function(_0x505821,_0x2f46cf){rimraf(_0x59a706,function(_0x884f38){if(_0x884f38)_0x2f46cf(_0x884f38);return _0x505821();});});})[_0x834e('0x2c')](function(){return _0x684a97[_0x834e('0xe8')](_0x488f82,_0x11f472,function(_0xd7026f){if(_0xd7026f){logger[_0x834e('0x1d')]('err',_0xd7026f);}else{fs['unlinkSync'](_0x488f82);}});});});}else{return _0x684a97['sendStatus'](0xc8);}})[_0x834e('0x22')](handleError(_0x684a97,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 127db86..2f9a2a1 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 _0xeb87=['then','setDataValue','map','findAll','unreadMessages','length','emit','catch','hook','exports','events','ChatMessage','update','remove'];(function(_0x502598,_0x1e95c8){var _0xbdee21=function(_0x140feb){while(--_0x140feb){_0x502598['push'](_0x502598['shift']());}};_0xbdee21(++_0x1e95c8);}(_0xeb87,0xc0));var _0x7eb8=function(_0xe617cc,_0x59ded5){_0xe617cc=_0xe617cc-0x0;var _0x3d1c51=_0xeb87[_0xe617cc];return _0x3d1c51;};'use strict';var EventEmitter=require(_0x7eb8('0x0'));var ChatInteraction=require('../../mysqldb')['db']['ChatInteraction'];var ChatMessage=require('../../mysqldb')['db'][_0x7eb8('0x1')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x7eb8('0x2'),'afterDestroy':_0x7eb8('0x3')};function emitEvent(_0x4baa3d){return function(_0x5182a8,_0x18463e,_0x4c7915){_0x5182a8['getUsers']({'attributes':['id'],'raw':!![]})[_0x7eb8('0x4')](function(_0x4a5ea4){_0x5182a8[_0x7eb8('0x5')]('Users',_0x4a5ea4[_0x7eb8('0x6')](function(_0x3ad5eb){return{'id':_0x3ad5eb['id']};}));return ChatMessage[_0x7eb8('0x7')]({'where':{'ChatInteractionId':_0x5182a8['id'],'direction':'in','read':![]},'raw':!![]});})[_0x7eb8('0x4')](function(_0x899fe0){_0x5182a8[_0x7eb8('0x5')](_0x7eb8('0x8'),_0x899fe0[_0x7eb8('0x9')]);ChatInteractionEvents[_0x7eb8('0xa')](_0x4baa3d+':'+_0x5182a8['id'],_0x5182a8);ChatInteractionEvents[_0x7eb8('0xa')](_0x4baa3d,_0x5182a8);_0x4c7915(null);})[_0x7eb8('0xb')](_0x4c7915(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction[_0x7eb8('0xc')](e,emitEvent(event));}}module[_0x7eb8('0xd')]=ChatInteractionEvents; \ No newline at end of file +var _0xbbab=['catch','hook','exports','events','../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners','save','update','remove','getUsers','then','Users','map','findAll','setDataValue','unreadMessages','emit'];(function(_0x5e0823,_0x146024){var _0x592fbb=function(_0x5ec112){while(--_0x5ec112){_0x5e0823['push'](_0x5e0823['shift']());}};_0x592fbb(++_0x146024);}(_0xbbab,0xe7));var _0xbbba=function(_0x1fd732,_0x1c33ff){_0x1fd732=_0x1fd732-0x0;var _0x5d2cda=_0xbbab[_0x1fd732];return _0x5d2cda;};'use strict';var EventEmitter=require(_0xbbba('0x0'));var ChatInteraction=require(_0xbbba('0x1'))['db'][_0xbbba('0x2')];var ChatMessage=require(_0xbbba('0x1'))['db'][_0xbbba('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xbbba('0x4')](0x0);var events={'afterCreate':_0xbbba('0x5'),'afterUpdate':_0xbbba('0x6'),'afterDestroy':_0xbbba('0x7')};function emitEvent(_0x835182){return function(_0x30dd5b,_0x3d134b,_0x1dd068){_0x30dd5b[_0xbbba('0x8')]({'attributes':['id'],'raw':!![]})[_0xbbba('0x9')](function(_0x5c473b){_0x30dd5b['setDataValue'](_0xbbba('0xa'),_0x5c473b[_0xbbba('0xb')](function(_0x3a1589){return{'id':_0x3a1589['id']};}));return ChatMessage[_0xbbba('0xc')]({'where':{'ChatInteractionId':_0x30dd5b['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x5eaad1){_0x30dd5b[_0xbbba('0xd')](_0xbbba('0xe'),_0x5eaad1['length']);ChatInteractionEvents[_0xbbba('0xf')](_0x835182+':'+_0x30dd5b['id'],_0x30dd5b);ChatInteractionEvents[_0xbbba('0xf')](_0x835182,_0x30dd5b);_0x1dd068(null);})[_0xbbba('0x10')](_0x1dd068(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction[_0xbbba('0x11')](e,emitEvent(event));}}module[_0xbbba('0x12')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index c74b4f2..70b16a3 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 _0xa160=['closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment','exports','chat_interactions','changed'];(function(_0x48d8c4,_0x1556e6){var _0x36c652=function(_0x4fb0ad){while(--_0x4fb0ad){_0x48d8c4['push'](_0x48d8c4['shift']());}};_0x36c652(++_0x1556e6);}(_0xa160,0xb6));var _0x0a16=function(_0x1c529b,_0x17dc54){_0x1c529b=_0x1c529b-0x0;var _0x5e64ca=_0xa160[_0x1c529b];return _0x5e64ca;};'use strict';var _=require(_0x0a16('0x0'));var util=require(_0x0a16('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0a16('0x2'));var rp=require(_0x0a16('0x3'));var fs=require('fs');var path=require(_0x0a16('0x4'));var rimraf=require(_0x0a16('0x5'));var config=require(_0x0a16('0x6'));var attributes=require('./chatInteraction.attributes');module[_0x0a16('0x7')]=function(_0x3b5e69,_0x42c030){return _0x3b5e69['define']('ChatInteraction',attributes,{'tableName':_0x0a16('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x116e7b,_0x45697a,_0x4edfb4){if(_0x116e7b[_0x0a16('0x9')](_0x0a16('0xa'))){_0x116e7b[_0x0a16('0xb')]=moment()[_0x0a16('0xc')](_0x0a16('0xd'));}_0x4edfb4(null,_0x116e7b);}},'charset':_0x0a16('0xe'),'collate':_0x0a16('0xf')});}; \ No newline at end of file +var _0xaed7=['./chatInteraction.attributes','ChatInteraction','closed','closedAt','format','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x5d6d8f,_0x4ae47d){var _0x4e27cf=function(_0x467f58){while(--_0x467f58){_0x5d6d8f['push'](_0x5d6d8f['shift']());}};_0x4e27cf(++_0x4ae47d);}(_0xaed7,0x147));var _0x7aed=function(_0x340d92,_0x4722a3){_0x340d92=_0x340d92-0x0;var _0x1b86db=_0xaed7[_0x340d92];return _0x1b86db;};'use strict';var _=require(_0x7aed('0x0'));var util=require(_0x7aed('0x1'));var logger=require(_0x7aed('0x2'))(_0x7aed('0x3'));var moment=require(_0x7aed('0x4'));var BPromise=require(_0x7aed('0x5'));var rp=require(_0x7aed('0x6'));var fs=require('fs');var path=require(_0x7aed('0x7'));var rimraf=require('rimraf');var config=require(_0x7aed('0x8'));var attributes=require(_0x7aed('0x9'));module['exports']=function(_0x44f3fc,_0xe897b8){return _0x44f3fc['define'](_0x7aed('0xa'),attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3331f3,_0x8851a5,_0x51ddd3){if(_0x3331f3['changed'](_0x7aed('0xb'))){_0x3331f3[_0x7aed('0xc')]=moment()[_0x7aed('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}_0x51ddd3(null,_0x3331f3);}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 48dfde8..fdd25ed 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 _0x1d98=['ids','omit','spread','AddTags','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','UpdateChatInteraction','ChatInteraction','body','options','where','limit','AddTagsToChatInteraction','find','addTags'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1d98,0x1bd));var _0x81d9=function(_0x4e3be8,_0x194867){_0x4e3be8=_0x4e3be8-0x0;var _0x496611=_0x1d98[_0x4e3be8];return _0x496611;};'use strict';var _=require(_0x81d9('0x0'));var util=require(_0x81d9('0x1'));var moment=require(_0x81d9('0x2'));var BPromise=require('bluebird');var rs=require(_0x81d9('0x3'));var fs=require('fs');var Redis=require(_0x81d9('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x81d9('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x81d9('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x81d9('0x7')][_0x81d9('0x8')]({'port':0x232a});config[_0x81d9('0x9')]=_[_0x81d9('0xa')](config[_0x81d9('0x9')],{'host':_0x81d9('0xb'),'port':0x18eb});var socket=require(_0x81d9('0xc'))(new Redis(config[_0x81d9('0x9')]));require(_0x81d9('0xd'))['register'](socket);function respondWithRpcPromise(_0x9b5238,_0x2d0577,_0x5e60c6){return new BPromise(function(_0x5cb3b3,_0x88ae91){return client[_0x81d9('0xe')](_0x9b5238,_0x5e60c6)[_0x81d9('0xf')](function(_0x4b4efb){logger[_0x81d9('0x10')](_0x81d9('0x11'),_0x2d0577,_0x81d9('0x12'));logger[_0x81d9('0x13')](_0x81d9('0x14'),_0x2d0577,_0x81d9('0x12'),JSON[_0x81d9('0x15')](_0x4b4efb));if(_0x4b4efb[_0x81d9('0x16')]){if(_0x4b4efb[_0x81d9('0x16')][_0x81d9('0x17')]===0x1f4){logger[_0x81d9('0x16')](_0x81d9('0x11'),_0x2d0577,_0x4b4efb['error'][_0x81d9('0x18')]);return _0x88ae91(_0x4b4efb[_0x81d9('0x16')][_0x81d9('0x18')]);}logger['error'](_0x81d9('0x11'),_0x2d0577,_0x4b4efb[_0x81d9('0x16')]['message']);return _0x5cb3b3(_0x4b4efb['error'][_0x81d9('0x18')]);}else{logger[_0x81d9('0x10')](_0x81d9('0x11'),_0x2d0577,'request\x20sent');_0x5cb3b3(_0x4b4efb[_0x81d9('0x19')][_0x81d9('0x18')]);}})['catch'](function(_0x5640ad){logger['error'](_0x81d9('0x11'),_0x2d0577,_0x5640ad);_0x88ae91(_0x5640ad);});});}exports[_0x81d9('0x1a')]=function(_0xb8b52){var _0x14bfd3=this;return new Promise(function(_0x5302dd,_0x1fed45){return db[_0x81d9('0x1b')]['update'](_0xb8b52[_0x81d9('0x1c')],{'raw':_0xb8b52[_0x81d9('0x1d')]?_0xb8b52['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xb8b52['options']?_0xb8b52[_0x81d9('0x1d')][_0x81d9('0x1e')]||null:null,'attributes':_0xb8b52[_0x81d9('0x1d')]?_0xb8b52[_0x81d9('0x1d')]['attributes']||null:null,'limit':_0xb8b52[_0x81d9('0x1d')]?_0xb8b52[_0x81d9('0x1d')][_0x81d9('0x1f')]||null:null})['then'](function(_0x3d7fc2){logger[_0x81d9('0x10')](_0x81d9('0x1a'),_0xb8b52);logger['debug'](_0x81d9('0x1a'),_0xb8b52,JSON[_0x81d9('0x15')](_0x3d7fc2));_0x5302dd(_0x3d7fc2);})['catch'](function(_0x40e1bb){logger[_0x81d9('0x16')](_0x81d9('0x1a'),_0x40e1bb[_0x81d9('0x18')],_0xb8b52);_0x1fed45(_0x14bfd3[_0x81d9('0x16')](0x1f4,_0x40e1bb[_0x81d9('0x18')]));});});};exports[_0x81d9('0x20')]=function(_0x34701e){return new Promise(function(_0x2bc672,_0x41e6cc){return db[_0x81d9('0x1b')][_0x81d9('0x21')]({'where':_0x34701e[_0x81d9('0x1d')]?_0x34701e[_0x81d9('0x1d')][_0x81d9('0x1e')]||null:null})[_0x81d9('0xf')](function(_0x294c28){if(_0x294c28){return _0x294c28[_0x81d9('0x22')](_0x34701e['body'][_0x81d9('0x23')],_[_0x81d9('0x24')](_0x34701e[_0x81d9('0x1c')],[_0x81d9('0x23'),'id'])||{});}})[_0x81d9('0x25')](function(_0x37e2e2){logger[_0x81d9('0x10')]('AddTags',_0x34701e);logger[_0x81d9('0x13')](_0x81d9('0x26'),_0x34701e,JSON[_0x81d9('0x15')](_0x37e2e2));_0x2bc672(_0x37e2e2);})[_0x81d9('0x27')](function(_0x6eec96){logger[_0x81d9('0x16')](_0x81d9('0x26'),_0x6eec96[_0x81d9('0x18')],_0x34701e);_0x41e6cc(_this[_0x81d9('0x16')](0x1f4,_0x6eec96['message']));});});}; \ No newline at end of file +var _0xd20d=['lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','defaults','redis','socket.io-emitter','register','request','then','ChatInteraction,\x20%s,\x20%s','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','ChatInteraction','update','body','options','raw','where','attributes','UpdateChatInteraction','find','addTags','ids','omit','spread','AddTags'];(function(_0x2905c,_0x408ef3){var _0x5631e0=function(_0x5e7d24){while(--_0x5e7d24){_0x2905c['push'](_0x2905c['shift']());}};_0x5631e0(++_0x408ef3);}(_0xd20d,0x118));var _0xdd20=function(_0x4ebae2,_0x236be8){_0x4ebae2=_0x4ebae2-0x0;var _0x4586ae=_0xd20d[_0x4ebae2];return _0x4586ae;};'use strict';var _=require(_0xdd20('0x0'));var util=require(_0xdd20('0x1'));var moment=require('moment');var BPromise=require(_0xdd20('0x2'));var rs=require(_0xdd20('0x3'));var fs=require('fs');var Redis=require(_0xdd20('0x4'));var db=require(_0xdd20('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xdd20('0x6'))(_0xdd20('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xdd20('0x8')]['http']({'port':0x232a});config['redis']=_[_0xdd20('0x9')](config[_0xdd20('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xdd20('0xb'))(new Redis(config[_0xdd20('0xa')]));require('./chatInteraction.socket')[_0xdd20('0xc')](socket);function respondWithRpcPromise(_0x58aa37,_0x33faa2,_0xa918ab){return new BPromise(function(_0x3beb01,_0x204846){return client[_0xdd20('0xd')](_0x58aa37,_0xa918ab)[_0xdd20('0xe')](function(_0x52c062){logger['info'](_0xdd20('0xf'),_0x33faa2,'request\x20sent');logger[_0xdd20('0x10')](_0xdd20('0x11'),_0x33faa2,_0xdd20('0x12'),JSON[_0xdd20('0x13')](_0x52c062));if(_0x52c062['error']){if(_0x52c062[_0xdd20('0x14')][_0xdd20('0x15')]===0x1f4){logger[_0xdd20('0x14')]('ChatInteraction,\x20%s,\x20%s',_0x33faa2,_0x52c062[_0xdd20('0x14')][_0xdd20('0x16')]);return _0x204846(_0x52c062[_0xdd20('0x14')][_0xdd20('0x16')]);}logger[_0xdd20('0x14')](_0xdd20('0xf'),_0x33faa2,_0x52c062[_0xdd20('0x14')][_0xdd20('0x16')]);return _0x3beb01(_0x52c062[_0xdd20('0x14')][_0xdd20('0x16')]);}else{logger[_0xdd20('0x17')](_0xdd20('0xf'),_0x33faa2,_0xdd20('0x12'));_0x3beb01(_0x52c062[_0xdd20('0x18')][_0xdd20('0x16')]);}})[_0xdd20('0x19')](function(_0x43a756){logger[_0xdd20('0x14')](_0xdd20('0xf'),_0x33faa2,_0x43a756);_0x204846(_0x43a756);});});}exports['UpdateChatInteraction']=function(_0x14a949){var _0x3cf728=this;return new Promise(function(_0x3e8ec0,_0x5cd7ba){return db[_0xdd20('0x1a')][_0xdd20('0x1b')](_0x14a949[_0xdd20('0x1c')],{'raw':_0x14a949[_0xdd20('0x1d')]?_0x14a949['options'][_0xdd20('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x14a949['options']?_0x14a949[_0xdd20('0x1d')][_0xdd20('0x1f')]||null:null,'attributes':_0x14a949[_0xdd20('0x1d')]?_0x14a949['options'][_0xdd20('0x20')]||null:null,'limit':_0x14a949[_0xdd20('0x1d')]?_0x14a949['options']['limit']||null:null})[_0xdd20('0xe')](function(_0x3f3411){logger[_0xdd20('0x17')](_0xdd20('0x21'),_0x14a949);logger[_0xdd20('0x10')]('UpdateChatInteraction',_0x14a949,JSON[_0xdd20('0x13')](_0x3f3411));_0x3e8ec0(_0x3f3411);})[_0xdd20('0x19')](function(_0x536736){logger[_0xdd20('0x14')](_0xdd20('0x21'),_0x536736['message'],_0x14a949);_0x5cd7ba(_0x3cf728[_0xdd20('0x14')](0x1f4,_0x536736[_0xdd20('0x16')]));});});};exports['AddTagsToChatInteraction']=function(_0x350703){return new Promise(function(_0x16af6d,_0x4f315b){return db[_0xdd20('0x1a')][_0xdd20('0x22')]({'where':_0x350703[_0xdd20('0x1d')]?_0x350703[_0xdd20('0x1d')][_0xdd20('0x1f')]||null:null})[_0xdd20('0xe')](function(_0x3a67b5){if(_0x3a67b5){return _0x3a67b5[_0xdd20('0x23')](_0x350703[_0xdd20('0x1c')][_0xdd20('0x24')],_[_0xdd20('0x25')](_0x350703['body'],[_0xdd20('0x24'),'id'])||{});}})[_0xdd20('0x26')](function(_0x1b0351){logger[_0xdd20('0x17')](_0xdd20('0x27'),_0x350703);logger[_0xdd20('0x10')](_0xdd20('0x27'),_0x350703,JSON[_0xdd20('0x13')](_0x1b0351));_0x16af6d(_0x1b0351);})[_0xdd20('0x19')](function(_0x4397b8){logger['error']('AddTags',_0x4397b8[_0xdd20('0x16')],_0x350703);_0x4f315b(_this[_0xdd20('0x14')](0x1f4,_0x4397b8[_0xdd20('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index ca41b1d..ccf6373 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 _0x0922=['./chatInteraction.events','remove','update','emit','removeListener','register','length','chatInteraction:'];(function(_0x16a52e,_0xc67a21){var _0x2397e2=function(_0x5201ae){while(--_0x5201ae){_0x16a52e['push'](_0x16a52e['shift']());}};_0x2397e2(++_0xc67a21);}(_0x0922,0x90));var _0x2092=function(_0x1ff575,_0xdba21f){_0x1ff575=_0x1ff575-0x0;var _0x48fc9e=_0x0922[_0x1ff575];return _0x48fc9e;};'use strict';var ChatInteractionEvents=require(_0x2092('0x0'));var events=['save',_0x2092('0x1'),_0x2092('0x2')];function createListener(_0x5347d4,_0x1a3c12){return function(_0x1fe6d5){_0x1a3c12[_0x2092('0x3')](_0x5347d4,_0x1fe6d5);};}function removeListener(_0x29bab6,_0x3c9776){return function(){ChatInteractionEvents[_0x2092('0x4')](_0x29bab6,_0x3c9776);};}exports[_0x2092('0x5')]=function(_0x19f3f6){for(var _0xbf44b6=0x0,_0x16a6a2=events[_0x2092('0x6')];_0xbf44b6<_0x16a6a2;_0xbf44b6++){var _0x2349a3=events[_0xbf44b6];var _0x330a3f=createListener(_0x2092('0x7')+_0x2349a3,_0x19f3f6);ChatInteractionEvents['on'](_0x2349a3,_0x330a3f);}}; \ No newline at end of file +var _0x5ddc=['emit','removeListener','register','length','chatInteraction:','save','remove','update'];(function(_0x2b305c,_0x5ae303){var _0x5d8c85=function(_0x33129f){while(--_0x33129f){_0x2b305c['push'](_0x2b305c['shift']());}};_0x5d8c85(++_0x5ae303);}(_0x5ddc,0x13d));var _0xc5dd=function(_0x1d1281,_0x1b3c7d){_0x1d1281=_0x1d1281-0x0;var _0x5e8c2e=_0x5ddc[_0x1d1281];return _0x5e8c2e;};'use strict';var ChatInteractionEvents=require('./chatInteraction.events');var events=[_0xc5dd('0x0'),_0xc5dd('0x1'),_0xc5dd('0x2')];function createListener(_0x224962,_0x38ece4){return function(_0x1282b3){_0x38ece4[_0xc5dd('0x3')](_0x224962,_0x1282b3);};}function removeListener(_0x363b02,_0x205800){return function(){ChatInteractionEvents[_0xc5dd('0x4')](_0x363b02,_0x205800);};}exports[_0xc5dd('0x5')]=function(_0x3d64a8){for(var _0x2bfe44=0x0,_0x71db7b=events[_0xc5dd('0x6')];_0x2bfe44<_0x71db7b;_0x2bfe44++){var _0x42a979=events[_0x2bfe44];var _0xc9d03a=createListener(_0xc5dd('0x7')+_0x42a979,_0x3d64a8);ChatInteractionEvents['on'](_0x42a979,_0xc9d03a);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 3aeae88..66da13b 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 _0x9175=['chatinteraction:update','/:id/custom_update','customUpdate','put','/:id/close','close','delete','destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','index','describe','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','post','/:id/vidaoo','createVidaooSession','diskStorage','root','server/files/attachments/','now','originalname','replace','/:id/attachment_upload','single','file','attachmentUpload','/:id/tags','tracked','chat','chatinteraction:addtags','addTags'];(function(_0x5e56d2,_0x69a9d9){var _0x382751=function(_0x44c5ef){while(--_0x44c5ef){_0x5e56d2['push'](_0x5e56d2['shift']());}};_0x382751(++_0x69a9d9);}(_0x9175,0x184));var _0x5917=function(_0x397ce6,_0x2ee6f8){_0x397ce6=_0x397ce6-0x0;var _0x31db01=_0x9175[_0x397ce6];return _0x31db01;};'use strict';var multer=require(_0x5917('0x0'));var util=require(_0x5917('0x1'));var path=require(_0x5917('0x2'));var timeout=require(_0x5917('0x3'));var express=require(_0x5917('0x4'));var router=express[_0x5917('0x5')]();var fs_extra=require(_0x5917('0x6'));var auth=require(_0x5917('0x7'));var interaction=require(_0x5917('0x8'));var config=require(_0x5917('0x9'));var controller=require(_0x5917('0xa'));router[_0x5917('0xb')]('/',auth[_0x5917('0xc')](),controller[_0x5917('0xd')]);router[_0x5917('0xb')]('/describe',auth[_0x5917('0xc')](),controller[_0x5917('0xe')]);router[_0x5917('0xb')](_0x5917('0xf'),auth[_0x5917('0x10')](),controller[_0x5917('0x11')]);router[_0x5917('0xb')](_0x5917('0x12'),auth[_0x5917('0x10')](),controller[_0x5917('0x13')]);router[_0x5917('0xb')](_0x5917('0x14'),auth['isAuthenticated'](),controller[_0x5917('0x15')]);router['get'](_0x5917('0x16'),auth[_0x5917('0x10')](),controller[_0x5917('0x17')]);router[_0x5917('0xb')](_0x5917('0x18'),auth[_0x5917('0xc')](),controller[_0x5917('0x19')]);router[_0x5917('0x1a')]('/',auth[_0x5917('0xc')](),controller['create']);router[_0x5917('0x1a')](_0x5917('0x1b'),auth[_0x5917('0xc')](),controller[_0x5917('0x1c')]);var upload=multer({'storage':multer[_0x5917('0x1d')]({'destination':function(_0x3c2768,_0x3fc463,_0x6d6f61){_0x6d6f61(null,path['join'](config[_0x5917('0x1e')],_0x5917('0x1f')));},'filename':function(_0x75fe01,_0x1d7214,_0x122e4a){_0x122e4a(null,util['format']('%s-%s',Date[_0x5917('0x20')](),_0x1d7214[_0x5917('0x21')][_0x5917('0x22')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post'](_0x5917('0x23'),upload[_0x5917('0x24')](_0x5917('0x25')),controller[_0x5917('0x26')]);router[_0x5917('0x1a')](_0x5917('0x14'),auth[_0x5917('0x10')](),controller['addMessage']);router[_0x5917('0x1a')](_0x5917('0x27'),auth['isAuthenticated'](),interaction[_0x5917('0x28')](_0x5917('0x29'),_0x5917('0x2a')),controller[_0x5917('0x2b')]);router['put'](_0x5917('0xf'),auth[_0x5917('0xc')](),interaction[_0x5917('0x28')]('chat',_0x5917('0x2c')),controller['update']);router['put'](_0x5917('0x2d'),controller[_0x5917('0x2e')]);router[_0x5917('0x2f')]('/:id/abandon',auth[_0x5917('0x10')](),controller['abandon']);router[_0x5917('0x2f')](_0x5917('0x30'),controller[_0x5917('0x31')]);router[_0x5917('0x32')](_0x5917('0xf'),auth[_0x5917('0xc')](),interaction['tracked'](_0x5917('0x29'),'chatinteraction:destroy'),controller[_0x5917('0x33')]);router[_0x5917('0x32')](_0x5917('0x27'),auth[_0x5917('0xc')](),controller[_0x5917('0x34')]);module[_0x5917('0x35')]=router; \ No newline at end of file +var _0x86a8=['util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatInteraction.controller','isAuthenticated','/describe','describe','isChatInteractionAuthorized','show','get','/:id/attachment_download','attachmentDownload','/:id/messages','/:id/my_messages','getMyMessages','/:id/download','download','post','create','createVidaooSession','root','server/files/attachments/','format','%s-%s','now','originalname','replace','/:id/attachment_upload','single','file','attachmentUpload','addMessage','/:id/tags','tracked','chatinteraction:addtags','addTags','put','/:id','chat','chatinteraction:update','customUpdate','/:id/abandon','abandon','/:id/close','close','chatinteraction:destroy','delete','removeTags','exports','multer'];(function(_0x8b76d8,_0x3b4a33){var _0x124649=function(_0x3fa55c){while(--_0x3fa55c){_0x8b76d8['push'](_0x8b76d8['shift']());}};_0x124649(++_0x3b4a33);}(_0x86a8,0xa1));var _0x886a=function(_0x457f1e,_0x5c883b){_0x457f1e=_0x457f1e-0x0;var _0x2afbbe=_0x86a8[_0x457f1e];return _0x2afbbe;};'use strict';var multer=require(_0x886a('0x0'));var util=require(_0x886a('0x1'));var path=require(_0x886a('0x2'));var timeout=require('connect-timeout');var express=require(_0x886a('0x3'));var router=express[_0x886a('0x4')]();var fs_extra=require(_0x886a('0x5'));var auth=require(_0x886a('0x6'));var interaction=require(_0x886a('0x7'));var config=require('../../config/environment');var controller=require(_0x886a('0x8'));router['get']('/',auth[_0x886a('0x9')](),controller['index']);router['get'](_0x886a('0xa'),auth[_0x886a('0x9')](),controller[_0x886a('0xb')]);router['get']('/:id',auth[_0x886a('0xc')](),controller[_0x886a('0xd')]);router[_0x886a('0xe')](_0x886a('0xf'),auth[_0x886a('0xc')](),controller[_0x886a('0x10')]);router[_0x886a('0xe')](_0x886a('0x11'),auth['isAuthenticated'](),controller['getMessages']);router[_0x886a('0xe')](_0x886a('0x12'),auth[_0x886a('0xc')](),controller[_0x886a('0x13')]);router[_0x886a('0xe')](_0x886a('0x14'),auth[_0x886a('0x9')](),controller[_0x886a('0x15')]);router[_0x886a('0x16')]('/',auth[_0x886a('0x9')](),controller[_0x886a('0x17')]);router[_0x886a('0x16')]('/:id/vidaoo',auth[_0x886a('0x9')](),controller[_0x886a('0x18')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4f270d,_0x6d564c,_0x1840ae){_0x1840ae(null,path['join'](config[_0x886a('0x19')],_0x886a('0x1a')));},'filename':function(_0x2ad188,_0xbf11e6,_0x1a679e){_0x1a679e(null,util[_0x886a('0x1b')](_0x886a('0x1c'),Date[_0x886a('0x1d')](),_0xbf11e6[_0x886a('0x1e')][_0x886a('0x1f')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x886a('0x16')](_0x886a('0x20'),upload[_0x886a('0x21')](_0x886a('0x22')),controller[_0x886a('0x23')]);router['post']('/:id/messages',auth[_0x886a('0xc')](),controller[_0x886a('0x24')]);router[_0x886a('0x16')](_0x886a('0x25'),auth[_0x886a('0x9')](),interaction[_0x886a('0x26')]('chat',_0x886a('0x27')),controller[_0x886a('0x28')]);router[_0x886a('0x29')](_0x886a('0x2a'),auth[_0x886a('0x9')](),interaction[_0x886a('0x26')](_0x886a('0x2b'),_0x886a('0x2c')),controller['update']);router['put']('/:id/custom_update',controller[_0x886a('0x2d')]);router[_0x886a('0x29')](_0x886a('0x2e'),auth[_0x886a('0xc')](),controller[_0x886a('0x2f')]);router[_0x886a('0x29')](_0x886a('0x30'),controller[_0x886a('0x31')]);router['delete'](_0x886a('0x2a'),auth[_0x886a('0x9')](),interaction[_0x886a('0x26')](_0x886a('0x2b'),_0x886a('0x32')),controller['destroy']);router[_0x886a('0x33')](_0x886a('0x25'),auth[_0x886a('0x9')](),controller[_0x886a('0x34')]);module[_0x886a('0x35')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index b6ec768..7bdfb60 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 _0xe826=['BOOLEAN','INTEGER','sequelize','exports','TEXT','medium'];(function(_0x316725,_0x560533){var _0x201762=function(_0x5756f1){while(--_0x5756f1){_0x316725['push'](_0x316725['shift']());}};_0x201762(++_0x560533);}(_0xe826,0x16a));var _0x6e82=function(_0x7732b9,_0x54bbd1){_0x7732b9=_0x7732b9-0x0;var _0x3b5af9=_0xe826[_0x7732b9];return _0x3b5af9;};'use strict';var Sequelize=require(_0x6e82('0x0'));module[_0x6e82('0x1')]={'body':{'type':Sequelize[_0x6e82('0x2')](_0x6e82('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x6e82('0x4')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x6e82('0x5')]}}; \ No newline at end of file +var _0x1237=['medium','BOOLEAN','sequelize','exports','TEXT'];(function(_0x370841,_0x1eb3bf){var _0x282f9a=function(_0x3b6ea4){while(--_0x3b6ea4){_0x370841['push'](_0x370841['shift']());}};_0x282f9a(++_0x1eb3bf);}(_0x1237,0x19c));var _0x7123=function(_0x341dd3,_0x458bce){_0x341dd3=_0x341dd3-0x0;var _0x21c6f2=_0x1237[_0x341dd3];return _0x21c6f2;};'use strict';var Sequelize=require(_0x7123('0x0'));module[_0x7123('0x1')]={'body':{'type':Sequelize[_0x7123('0x2')](_0x7123('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x7123('0x4')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 11da3c1..5311dd9 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 _0x0386=['agent','resourceId','push','createdAt','FromId','ToId','read','-createdAt','all','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','register','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','save','update','error','stack','name','index','map','ChatInternalMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','then','includeAll','include','catch','show','options','find','create','body','params','destroy','describe','lastMessageAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','User','admin','user','role','internal','lastLoginAt','allowmessenger','showWebBar','VoiceQueue','VoiceQueues','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','UserProfileResource','findAll','isEmpty'];(function(_0x4b174a,_0x33a017){var _0x3cd7bf=function(_0x44ccd9){while(--_0x44ccd9){_0x4b174a['push'](_0x4b174a['shift']());}};_0x3cd7bf(++_0x33a017);}(_0x0386,0x153));var _0x6038=function(_0x3bcf4f,_0x507a7b){_0x3bcf4f=_0x3bcf4f-0x0;var _0x26d549=_0x0386[_0x3bcf4f];return _0x26d549;};'use strict';var emlformat=require(_0x6038('0x0'));var rimraf=require(_0x6038('0x1'));var zipdir=require(_0x6038('0x2'));var jsonpatch=require(_0x6038('0x3'));var rp=require(_0x6038('0x4'));var moment=require(_0x6038('0x5'));var BPromise=require(_0x6038('0x6'));var Mustache=require(_0x6038('0x7'));var util=require('util');var path=require(_0x6038('0x8'));var sox=require(_0x6038('0x9'));var csv=require('to-csv');var ejs=require(_0x6038('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6038('0xb'));var squel=require(_0x6038('0xc'));var crypto=require(_0x6038('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x6038('0xe'));var toCsv=require(_0x6038('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6038('0x10'));var authService=require(_0x6038('0x11'));var qs=require(_0x6038('0x12'));var as=require(_0x6038('0x13'));var hardwareService=require(_0x6038('0x14'));var logger=require(_0x6038('0x15'))('api');var utils=require(_0x6038('0x16'));var config=require(_0x6038('0x17'));var licenseUtil=require(_0x6038('0x18'));var db=require(_0x6038('0x19'))['db'];config[_0x6038('0x1a')]=_[_0x6038('0x1b')](config[_0x6038('0x1a')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6038('0x1a')]));require('./chatInternalMessage.socket')[_0x6038('0x1c')](socket);function respondWithStatusCode(_0x294860,_0xacc34b){_0xacc34b=_0xacc34b||0xcc;return function(_0x4a77b1){if(_0x4a77b1){return _0x294860[_0x6038('0x1d')](_0xacc34b);}return _0x294860[_0x6038('0x1e')](_0xacc34b)[_0x6038('0x1f')]();};}function respondWithResult(_0x471295,_0x335690){_0x335690=_0x335690||0xc8;return function(_0x5e7e2a){if(_0x5e7e2a){return _0x471295[_0x6038('0x1e')](_0x335690)[_0x6038('0x20')](_0x5e7e2a);}};}function respondWithFilteredResult(_0x40ee3a,_0x330c56){return function(_0x5c346e){if(_0x5c346e){var _0x4d48d5=typeof _0x330c56[_0x6038('0x21')]==='undefined'&&typeof _0x330c56['limit']===_0x6038('0x22');var _0x34ab7f=_0x5c346e[_0x6038('0x23')];var _0x1a03db=_0x4d48d5?0x0:_0x330c56[_0x6038('0x21')];var _0x3b4f68=_0x4d48d5?_0x5c346e[_0x6038('0x23')]:_0x330c56[_0x6038('0x21')]+_0x330c56[_0x6038('0x24')];var _0x2558a5;if(_0x3b4f68>=_0x34ab7f){_0x3b4f68=_0x34ab7f;_0x2558a5=0xc8;}else{_0x2558a5=0xce;}_0x40ee3a[_0x6038('0x1e')](_0x2558a5);return _0x40ee3a['set'](_0x6038('0x25'),_0x1a03db+'-'+_0x3b4f68+'/'+_0x34ab7f)['json'](_0x5c346e);}return null;};}function patchUpdates(_0x2e764e){return function(_0x2872be){try{jsonpatch[_0x6038('0x26')](_0x2872be,_0x2e764e,!![]);}catch(_0x39b049){return BPromise['reject'](_0x39b049);}return _0x2872be[_0x6038('0x27')]();};}function saveUpdates(_0x5da1fb,_0x4b86cc){return function(_0x374ef9){if(_0x374ef9){return _0x374ef9[_0x6038('0x28')](_0x5da1fb)['then'](function(_0x3dc302){return _0x3dc302;});}return null;};}function removeEntity(_0x11e5fc,_0x3e94eb){return function(_0x159f49){if(_0x159f49){return _0x159f49['destroy']()['then'](function(){_0x11e5fc[_0x6038('0x1e')](0xcc)[_0x6038('0x1f')]();});}};}function handleEntityNotFound(_0x3af6f8,_0x1d0996){return function(_0x55904b){if(!_0x55904b){_0x3af6f8['sendStatus'](0x194);}return _0x55904b;};}function handleError(_0x339757,_0x2c4155){_0x2c4155=_0x2c4155||0x1f4;return function(_0x53ad90){logger[_0x6038('0x29')](_0x53ad90[_0x6038('0x2a')]);if(_0x53ad90[_0x6038('0x2b')]){delete _0x53ad90[_0x6038('0x2b')];}_0x339757['status'](_0x2c4155)['send'](_0x53ad90);};}exports[_0x6038('0x2c')]=function(_0x123c41,_0x456522){var _0x14a1e9={},_0x1abbb9={},_0x1e338d={'count':0x0,'rows':[]};var _0x578e6d=_[_0x6038('0x2d')](db[_0x6038('0x2e')][_0x6038('0x2f')],function(_0x4e94d2){return{'name':_0x4e94d2[_0x6038('0x30')],'type':_0x4e94d2[_0x6038('0x31')][_0x6038('0x32')]};});_0x1abbb9[_0x6038('0x33')]=_[_0x6038('0x2d')](_0x578e6d,'name');_0x1abbb9[_0x6038('0x34')]=_[_0x6038('0x35')](_0x123c41['query']);_0x1abbb9[_0x6038('0x36')]=_[_0x6038('0x37')](_0x1abbb9['model'],_0x1abbb9[_0x6038('0x34')]);_0x14a1e9[_0x6038('0x38')]=_['intersection'](_0x1abbb9[_0x6038('0x33')],qs[_0x6038('0x39')](_0x123c41[_0x6038('0x34')][_0x6038('0x39')]));_0x14a1e9['attributes']=_0x14a1e9['attributes'][_0x6038('0x3a')]?_0x14a1e9[_0x6038('0x38')]:_0x1abbb9[_0x6038('0x33')];if(!_0x123c41[_0x6038('0x34')][_0x6038('0x3b')](_0x6038('0x3c'))){_0x14a1e9[_0x6038('0x24')]=qs[_0x6038('0x24')](_0x123c41[_0x6038('0x34')][_0x6038('0x24')]);_0x14a1e9[_0x6038('0x21')]=qs[_0x6038('0x21')](_0x123c41[_0x6038('0x34')][_0x6038('0x21')]);}_0x14a1e9[_0x6038('0x3d')]=qs[_0x6038('0x3e')](_0x123c41[_0x6038('0x34')][_0x6038('0x3e')]);_0x14a1e9[_0x6038('0x3f')]=qs[_0x6038('0x36')](_[_0x6038('0x40')](_0x123c41['query'],_0x1abbb9['filters']),_0x578e6d);if(_0x123c41[_0x6038('0x34')][_0x6038('0x41')]){_0x14a1e9['where']=_[_0x6038('0x42')](_0x14a1e9[_0x6038('0x3f')],{'$or':_['map'](_0x578e6d,function(_0x528187){if(_0x528187[_0x6038('0x31')]!==_0x6038('0x43')){var _0x46c8bf={};_0x46c8bf[_0x528187[_0x6038('0x2b')]]={'$like':'%'+_0x123c41['query'][_0x6038('0x41')]+'%'};return _0x46c8bf;}})});}_0x14a1e9=_['merge']({},_0x14a1e9,_0x123c41['options']);var _0x3e421b={'where':_0x14a1e9[_0x6038('0x3f')]};return db[_0x6038('0x2e')][_0x6038('0x23')](_0x3e421b)[_0x6038('0x44')](function(_0x3d47b0){_0x1e338d['count']=_0x3d47b0;if(_0x123c41[_0x6038('0x34')][_0x6038('0x45')]){_0x14a1e9[_0x6038('0x46')]=[{'all':!![]}];}return db[_0x6038('0x2e')]['findAll'](_0x14a1e9);})[_0x6038('0x44')](function(_0x359311){_0x1e338d['rows']=_0x359311;return _0x1e338d;})[_0x6038('0x44')](respondWithFilteredResult(_0x456522,_0x14a1e9))[_0x6038('0x47')](handleError(_0x456522,null));};exports[_0x6038('0x48')]=function(_0x243103,_0x17bda4){var _0xd9f2f8={'raw':!![],'where':{'id':_0x243103['params']['id']}},_0x6c1589={};_0x6c1589['model']=_[_0x6038('0x35')](db[_0x6038('0x2e')][_0x6038('0x2f')]);_0x6c1589[_0x6038('0x34')]=_[_0x6038('0x35')](_0x243103['query']);_0x6c1589[_0x6038('0x36')]=_[_0x6038('0x37')](_0x6c1589[_0x6038('0x33')],_0x6c1589[_0x6038('0x34')]);_0xd9f2f8[_0x6038('0x38')]=_['intersection'](_0x6c1589['model'],qs[_0x6038('0x39')](_0x243103[_0x6038('0x34')][_0x6038('0x39')]));_0xd9f2f8[_0x6038('0x38')]=_0xd9f2f8[_0x6038('0x38')]['length']?_0xd9f2f8[_0x6038('0x38')]:_0x6c1589['model'];if(_0x243103[_0x6038('0x34')][_0x6038('0x45')]){_0xd9f2f8[_0x6038('0x46')]=[{'all':!![]}];}_0xd9f2f8=_['merge']({},_0xd9f2f8,_0x243103[_0x6038('0x49')]);return db[_0x6038('0x2e')][_0x6038('0x4a')](_0xd9f2f8)[_0x6038('0x44')](handleEntityNotFound(_0x17bda4,null))[_0x6038('0x44')](respondWithResult(_0x17bda4,null))[_0x6038('0x47')](handleError(_0x17bda4,null));};exports[_0x6038('0x4b')]=function(_0xc751cf,_0x4366a8){return db[_0x6038('0x2e')][_0x6038('0x4b')](_0xc751cf[_0x6038('0x4c')],{})[_0x6038('0x44')](respondWithResult(_0x4366a8,0xc9))[_0x6038('0x47')](handleError(_0x4366a8,null));};exports[_0x6038('0x28')]=function(_0x5231cc,_0x57b209){if(_0x5231cc[_0x6038('0x4c')]['id']){delete _0x5231cc[_0x6038('0x4c')]['id'];}return db[_0x6038('0x2e')][_0x6038('0x4a')]({'where':{'id':_0x5231cc[_0x6038('0x4d')]['id']}})[_0x6038('0x44')](handleEntityNotFound(_0x57b209,null))['then'](saveUpdates(_0x5231cc[_0x6038('0x4c')],null))['then'](respondWithResult(_0x57b209,null))[_0x6038('0x47')](handleError(_0x57b209,null));};exports[_0x6038('0x4e')]=function(_0x3d8985,_0x4a24b1){return db['ChatInternalMessage'][_0x6038('0x4a')]({'where':{'id':_0x3d8985[_0x6038('0x4d')]['id']}})['then'](handleEntityNotFound(_0x4a24b1,null))[_0x6038('0x44')](removeEntity(_0x4a24b1,null))[_0x6038('0x47')](handleError(_0x4a24b1,null));};exports[_0x6038('0x4f')]=function(_0x368933,_0x34e932){return db['ChatInternalMessage'][_0x6038('0x4f')]()[_0x6038('0x44')](respondWithResult(_0x34e932,null))[_0x6038('0x47')](handleError(_0x34e932,null));};function wrapUser(_0x5198d2){return function(_0x182d0d){var _0x1dd450=_0x5198d2['get']({'plain':!![]});_0x1dd450['messages']=[];if(_0x182d0d){_0x1dd450[_0x6038('0x50')]=_0x182d0d['createdAt'];_0x1dd450[_0x6038('0x51')]=_0x182d0d;}else{_0x1dd450[_0x6038('0x50')]=moment(0x0)[_0x6038('0x52')](_0x6038('0x53'));_0x1dd450[_0x6038('0x51')]={};}return _0x1dd450;};}exports['getUsers']=function(_0x1fa1f6,_0x37ad51,_0x51adfb){var _0x29f683=[];return db[_0x6038('0x54')]['findAll']({'where':{'role':['agent',_0x6038('0x55'),_0x6038('0x56')]},'attributes':['id','fullname',_0x6038('0x2b'),_0x6038('0x57'),'userpic',_0x6038('0x58'),'online',_0x6038('0x59'),_0x6038('0x5a'),_0x6038('0x5b')],'order':qs[_0x6038('0x3e')]('-online'),'include':[{'model':db[_0x6038('0x5c')],'as':_0x6038('0x5d'),'attributes':['id',_0x6038('0x2b'),_0x6038('0x31')],'through':{'attributes':[]}}]})[_0x6038('0x44')](function(_0x5b054a){if(_0x5b054a){var _0x568cc0=_0x1fa1f6[_0x6038('0x56')][_0x6038('0x5e')]({'plain':!![]});if(!_0x568cc0)throw new Error(_0x6038('0x5f'));if(_0x568cc0[_0x6038('0x57')]===_0x6038('0x56')){return db['UserProfileSection'][_0x6038('0x4a')]({'where':{'name':'Agents','userProfileId':_0x568cc0[_0x6038('0x60')]},'raw':!![]})[_0x6038('0x44')](function(_0x4fd5a2){if(_0x4fd5a2){if(_0x4fd5a2[_0x6038('0x61')]===0x0){return db[_0x6038('0x62')][_0x6038('0x63')]({'where':{'sectionId':_0x4fd5a2['id']},'raw':!![]})[_0x6038('0x44')](function(_0x4a72a3){var _0x37ba5b=[];if(_[_0x6038('0x64')](_0x4a72a3)){_0x37ba5b=_[_0x6038('0x41')](_0x5b054a,function(_0x5a3dfd){if(_0x5a3dfd[_0x6038('0x57')]!==_0x6038('0x65')){return _0x5a3dfd;}});return _0x37ba5b;}else{for(var _0xe39d54=0x0;_0xe39d54<_0x5b054a[_0x6038('0x3a')];_0xe39d54++){var _0xe3543f=_0x5b054a[_0xe39d54];if(_0xe3543f[_0x6038('0x57')]===_0x6038('0x65')){var _0x5c1af1=_['find'](_0x4a72a3,function(_0x40a2d3){return _0x40a2d3[_0x6038('0x66')]===_0xe3543f['id'];});if(_0x5c1af1)_0x37ba5b[_0x6038('0x67')](_0xe3543f);}else{_0x37ba5b[_0x6038('0x67')](_0xe3543f);}}return _0x37ba5b;}});}else{return _0x5b054a;}}else{var _0x58d89e=_[_0x6038('0x41')](_0x5b054a,function(_0x57c4cb){if(_0x57c4cb[_0x6038('0x57')]!==_0x6038('0x65')){return _0x57c4cb;}});return _0x58d89e;}});}else{return _0x5b054a;}}})[_0x6038('0x44')](function(_0x39aad6){var _0x130353=[];if(_0x39aad6){_0x29f683=_0x39aad6;for(var _0x4186cf=0x0;_0x4186cf<_0x39aad6['length'];_0x4186cf+=0x1){_0x29f683[_0x4186cf]['messages']=[];_0x130353['push'](db[_0x6038('0x2e')]['find']({'where':{'FromId':[_0x1fa1f6[_0x6038('0x56')]['id'],_0x39aad6[_0x4186cf]['id']],'ToId':[_0x1fa1f6[_0x6038('0x56')]['id'],_0x39aad6[_0x4186cf]['id']],'ChatGroupId':null},'attributes':['id',_0x6038('0x68'),_0x6038('0x69'),_0x6038('0x6a'),_0x6038('0x6b'),_0x6038('0x4c')],'order':qs[_0x6038('0x3e')](_0x6038('0x6c')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x6038('0x44')](wrapUser(_0x39aad6[_0x4186cf])));}return BPromise[_0x6038('0x6d')](_0x130353);}return[];})[_0x6038('0x44')](function(_0x2adcd2){return{'rows':_0x2adcd2,'count':_0x2adcd2['length']};})['then'](respondWithResult(_0x37ad51,null))[_0x6038('0x47')](handleError(_0x37ad51,null));}; \ No newline at end of file +var _0x63d5=['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','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','ChatInternalMessage','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','include','findAll','rows','catch','params','rawAttributes','includeAll','options','find','create','body','describe','get','lastMessageAt','createdAt','lastMessage','User','agent','admin','fullname','userpic','internal','online','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueue','VoiceQueues','user','role','UserProfileSection','Agents','userProfileId','UserProfileResource','isEmpty','resourceId','push','read','-createdAt','all','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x63d5,0x155));var _0x563d=function(_0x50faaa,_0x59d114){_0x50faaa=_0x50faaa-0x0;var _0x48300e=_0x63d5[_0x50faaa];return _0x48300e;};'use strict';var emlformat=require(_0x563d('0x0'));var rimraf=require(_0x563d('0x1'));var zipdir=require(_0x563d('0x2'));var jsonpatch=require(_0x563d('0x3'));var rp=require(_0x563d('0x4'));var moment=require(_0x563d('0x5'));var BPromise=require(_0x563d('0x6'));var Mustache=require('mustache');var util=require(_0x563d('0x7'));var path=require('path');var sox=require(_0x563d('0x8'));var csv=require(_0x563d('0x9'));var ejs=require(_0x563d('0xa'));var fs=require('fs');var fs_extra=require(_0x563d('0xb'));var _=require(_0x563d('0xc'));var squel=require(_0x563d('0xd'));var crypto=require(_0x563d('0xe'));var jsforce=require(_0x563d('0xf'));var deskjs=require(_0x563d('0x10'));var toCsv=require(_0x563d('0x9'));var querystring=require(_0x563d('0x11'));var Papa=require(_0x563d('0x12'));var Redis=require(_0x563d('0x13'));var authService=require(_0x563d('0x14'));var qs=require(_0x563d('0x15'));var as=require(_0x563d('0x16'));var hardwareService=require(_0x563d('0x17'));var logger=require(_0x563d('0x18'))(_0x563d('0x19'));var utils=require(_0x563d('0x1a'));var config=require(_0x563d('0x1b'));var licenseUtil=require(_0x563d('0x1c'));var db=require(_0x563d('0x1d'))['db'];config[_0x563d('0x1e')]=_['defaults'](config[_0x563d('0x1e')],{'host':_0x563d('0x1f'),'port':0x18eb});var socket=require(_0x563d('0x20'))(new Redis(config[_0x563d('0x1e')]));require(_0x563d('0x21'))[_0x563d('0x22')](socket);function respondWithStatusCode(_0x2c779e,_0x3dcf2d){_0x3dcf2d=_0x3dcf2d||0xcc;return function(_0x1f8ca4){if(_0x1f8ca4){return _0x2c779e[_0x563d('0x23')](_0x3dcf2d);}return _0x2c779e[_0x563d('0x24')](_0x3dcf2d)[_0x563d('0x25')]();};}function respondWithResult(_0x54d57c,_0x9d84b1){_0x9d84b1=_0x9d84b1||0xc8;return function(_0x11209d){if(_0x11209d){return _0x54d57c['status'](_0x9d84b1)[_0x563d('0x26')](_0x11209d);}};}function respondWithFilteredResult(_0x2591a2,_0x5da478){return function(_0x5bf130){if(_0x5bf130){var _0x451d38=typeof _0x5da478[_0x563d('0x27')]==='undefined'&&typeof _0x5da478[_0x563d('0x28')]===_0x563d('0x29');var _0x3c37bd=_0x5bf130[_0x563d('0x2a')];var _0x2b4260=_0x451d38?0x0:_0x5da478[_0x563d('0x27')];var _0xb97bdc=_0x451d38?_0x5bf130['count']:_0x5da478[_0x563d('0x27')]+_0x5da478[_0x563d('0x28')];var _0x441738;if(_0xb97bdc>=_0x3c37bd){_0xb97bdc=_0x3c37bd;_0x441738=0xc8;}else{_0x441738=0xce;}_0x2591a2[_0x563d('0x24')](_0x441738);return _0x2591a2[_0x563d('0x2b')](_0x563d('0x2c'),_0x2b4260+'-'+_0xb97bdc+'/'+_0x3c37bd)['json'](_0x5bf130);}return null;};}function patchUpdates(_0x4c40b5){return function(_0x49c12d){try{jsonpatch[_0x563d('0x2d')](_0x49c12d,_0x4c40b5,!![]);}catch(_0xcde284){return BPromise[_0x563d('0x2e')](_0xcde284);}return _0x49c12d[_0x563d('0x2f')]();};}function saveUpdates(_0x35686f,_0x41ed08){return function(_0x24a7fb){if(_0x24a7fb){return _0x24a7fb[_0x563d('0x30')](_0x35686f)[_0x563d('0x31')](function(_0x19269d){return _0x19269d;});}return null;};}function removeEntity(_0x33c404,_0x5ac9a7){return function(_0x22e2a6){if(_0x22e2a6){return _0x22e2a6[_0x563d('0x32')]()['then'](function(){_0x33c404[_0x563d('0x24')](0xcc)[_0x563d('0x25')]();});}};}function handleEntityNotFound(_0xa666ba,_0x1fc8c4){return function(_0x5de75c){if(!_0x5de75c){_0xa666ba[_0x563d('0x23')](0x194);}return _0x5de75c;};}function handleError(_0x2493b0,_0x2e2427){_0x2e2427=_0x2e2427||0x1f4;return function(_0x46b1d9){logger[_0x563d('0x33')](_0x46b1d9[_0x563d('0x34')]);if(_0x46b1d9[_0x563d('0x35')]){delete _0x46b1d9[_0x563d('0x35')];}_0x2493b0[_0x563d('0x24')](_0x2e2427)[_0x563d('0x36')](_0x46b1d9);};}exports[_0x563d('0x37')]=function(_0x3d36bc,_0x42f30f){var _0x3db5b1={},_0x4863f2={},_0x3c922b={'count':0x0,'rows':[]};var _0x3aed99=_[_0x563d('0x38')](db[_0x563d('0x39')]['rawAttributes'],function(_0x3a9094){return{'name':_0x3a9094['fieldName'],'type':_0x3a9094[_0x563d('0x3a')]['key']};});_0x4863f2[_0x563d('0x3b')]=_['map'](_0x3aed99,_0x563d('0x35'));_0x4863f2[_0x563d('0x3c')]=_[_0x563d('0x3d')](_0x3d36bc[_0x563d('0x3c')]);_0x4863f2[_0x563d('0x3e')]=_[_0x563d('0x3f')](_0x4863f2[_0x563d('0x3b')],_0x4863f2[_0x563d('0x3c')]);_0x3db5b1[_0x563d('0x40')]=_[_0x563d('0x3f')](_0x4863f2['model'],qs[_0x563d('0x41')](_0x3d36bc['query'][_0x563d('0x41')]));_0x3db5b1['attributes']=_0x3db5b1[_0x563d('0x40')][_0x563d('0x42')]?_0x3db5b1[_0x563d('0x40')]:_0x4863f2[_0x563d('0x3b')];if(!_0x3d36bc['query'][_0x563d('0x43')](_0x563d('0x44'))){_0x3db5b1['limit']=qs['limit'](_0x3d36bc[_0x563d('0x3c')]['limit']);_0x3db5b1[_0x563d('0x27')]=qs[_0x563d('0x27')](_0x3d36bc[_0x563d('0x3c')][_0x563d('0x27')]);}_0x3db5b1[_0x563d('0x45')]=qs['sort'](_0x3d36bc[_0x563d('0x3c')][_0x563d('0x46')]);_0x3db5b1[_0x563d('0x47')]=qs[_0x563d('0x3e')](_[_0x563d('0x48')](_0x3d36bc[_0x563d('0x3c')],_0x4863f2['filters']),_0x3aed99);if(_0x3d36bc[_0x563d('0x3c')][_0x563d('0x49')]){_0x3db5b1['where']=_[_0x563d('0x4a')](_0x3db5b1[_0x563d('0x47')],{'$or':_[_0x563d('0x38')](_0x3aed99,function(_0x1d1fbd){if(_0x1d1fbd[_0x563d('0x3a')]!=='VIRTUAL'){var _0x182613={};_0x182613[_0x1d1fbd[_0x563d('0x35')]]={'$like':'%'+_0x3d36bc[_0x563d('0x3c')][_0x563d('0x49')]+'%'};return _0x182613;}})});}_0x3db5b1=_['merge']({},_0x3db5b1,_0x3d36bc['options']);var _0x29feb4={'where':_0x3db5b1[_0x563d('0x47')]};return db['ChatInternalMessage'][_0x563d('0x2a')](_0x29feb4)[_0x563d('0x31')](function(_0x41a798){_0x3c922b[_0x563d('0x2a')]=_0x41a798;if(_0x3d36bc[_0x563d('0x3c')]['includeAll']){_0x3db5b1[_0x563d('0x4b')]=[{'all':!![]}];}return db['ChatInternalMessage'][_0x563d('0x4c')](_0x3db5b1);})[_0x563d('0x31')](function(_0x34d9d4){_0x3c922b[_0x563d('0x4d')]=_0x34d9d4;return _0x3c922b;})['then'](respondWithFilteredResult(_0x42f30f,_0x3db5b1))[_0x563d('0x4e')](handleError(_0x42f30f,null));};exports['show']=function(_0x1acbc4,_0x2ed804){var _0x381af4={'raw':!![],'where':{'id':_0x1acbc4[_0x563d('0x4f')]['id']}},_0x4b2e21={};_0x4b2e21['model']=_[_0x563d('0x3d')](db[_0x563d('0x39')][_0x563d('0x50')]);_0x4b2e21[_0x563d('0x3c')]=_[_0x563d('0x3d')](_0x1acbc4[_0x563d('0x3c')]);_0x4b2e21['filters']=_[_0x563d('0x3f')](_0x4b2e21[_0x563d('0x3b')],_0x4b2e21[_0x563d('0x3c')]);_0x381af4[_0x563d('0x40')]=_[_0x563d('0x3f')](_0x4b2e21[_0x563d('0x3b')],qs['fields'](_0x1acbc4[_0x563d('0x3c')][_0x563d('0x41')]));_0x381af4['attributes']=_0x381af4[_0x563d('0x40')][_0x563d('0x42')]?_0x381af4[_0x563d('0x40')]:_0x4b2e21[_0x563d('0x3b')];if(_0x1acbc4['query'][_0x563d('0x51')]){_0x381af4['include']=[{'all':!![]}];}_0x381af4=_[_0x563d('0x4a')]({},_0x381af4,_0x1acbc4[_0x563d('0x52')]);return db[_0x563d('0x39')][_0x563d('0x53')](_0x381af4)[_0x563d('0x31')](handleEntityNotFound(_0x2ed804,null))[_0x563d('0x31')](respondWithResult(_0x2ed804,null))[_0x563d('0x4e')](handleError(_0x2ed804,null));};exports[_0x563d('0x54')]=function(_0x111cfe,_0x106db7){return db['ChatInternalMessage'][_0x563d('0x54')](_0x111cfe['body'],{})['then'](respondWithResult(_0x106db7,0xc9))[_0x563d('0x4e')](handleError(_0x106db7,null));};exports['update']=function(_0x1c3f21,_0x56b2a5){if(_0x1c3f21[_0x563d('0x55')]['id']){delete _0x1c3f21[_0x563d('0x55')]['id'];}return db[_0x563d('0x39')][_0x563d('0x53')]({'where':{'id':_0x1c3f21['params']['id']}})['then'](handleEntityNotFound(_0x56b2a5,null))[_0x563d('0x31')](saveUpdates(_0x1c3f21[_0x563d('0x55')],null))[_0x563d('0x31')](respondWithResult(_0x56b2a5,null))[_0x563d('0x4e')](handleError(_0x56b2a5,null));};exports[_0x563d('0x32')]=function(_0x3e9f96,_0x1bb095){return db[_0x563d('0x39')]['find']({'where':{'id':_0x3e9f96[_0x563d('0x4f')]['id']}})[_0x563d('0x31')](handleEntityNotFound(_0x1bb095,null))['then'](removeEntity(_0x1bb095,null))[_0x563d('0x4e')](handleError(_0x1bb095,null));};exports['describe']=function(_0x117b2e,_0x4cda51){return db[_0x563d('0x39')][_0x563d('0x56')]()[_0x563d('0x31')](respondWithResult(_0x4cda51,null))['catch'](handleError(_0x4cda51,null));};function wrapUser(_0xb40c87){return function(_0x4e7bb4){var _0x2ca552=_0xb40c87[_0x563d('0x57')]({'plain':!![]});_0x2ca552['messages']=[];if(_0x4e7bb4){_0x2ca552[_0x563d('0x58')]=_0x4e7bb4[_0x563d('0x59')];_0x2ca552[_0x563d('0x5a')]=_0x4e7bb4;}else{_0x2ca552[_0x563d('0x58')]=moment(0x0)['format']('YYYY-MM-DD\x20HH:mm:ss');_0x2ca552['lastMessage']={};}return _0x2ca552;};}exports['getUsers']=function(_0x59f546,_0x18023a,_0x10a13a){var _0x3530a4=[];return db[_0x563d('0x5b')][_0x563d('0x4c')]({'where':{'role':[_0x563d('0x5c'),_0x563d('0x5d'),'user']},'attributes':['id',_0x563d('0x5e'),_0x563d('0x35'),'role',_0x563d('0x5f'),_0x563d('0x60'),_0x563d('0x61'),_0x563d('0x62'),_0x563d('0x63'),_0x563d('0x64')],'order':qs[_0x563d('0x46')](_0x563d('0x65')),'include':[{'model':db[_0x563d('0x66')],'as':_0x563d('0x67'),'attributes':['id','name',_0x563d('0x3a')],'through':{'attributes':[]}}]})[_0x563d('0x31')](function(_0x6bf38e){if(_0x6bf38e){var _0x2a627a=_0x59f546[_0x563d('0x68')][_0x563d('0x57')]({'plain':!![]});if(!_0x2a627a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2a627a[_0x563d('0x69')]===_0x563d('0x68')){return db[_0x563d('0x6a')][_0x563d('0x53')]({'where':{'name':_0x563d('0x6b'),'userProfileId':_0x2a627a[_0x563d('0x6c')]},'raw':!![]})[_0x563d('0x31')](function(_0x3019c9){if(_0x3019c9){if(_0x3019c9['autoAssociation']===0x0){return db[_0x563d('0x6d')][_0x563d('0x4c')]({'where':{'sectionId':_0x3019c9['id']},'raw':!![]})['then'](function(_0x357a20){var _0x4f06b8=[];if(_[_0x563d('0x6e')](_0x357a20)){_0x4f06b8=_[_0x563d('0x49')](_0x6bf38e,function(_0x3e209c){if(_0x3e209c['role']!==_0x563d('0x5c')){return _0x3e209c;}});return _0x4f06b8;}else{for(var _0x146686=0x0;_0x146686<_0x6bf38e[_0x563d('0x42')];_0x146686++){var _0x5cfa03=_0x6bf38e[_0x146686];if(_0x5cfa03[_0x563d('0x69')]===_0x563d('0x5c')){var _0x235528=_[_0x563d('0x53')](_0x357a20,function(_0x2d943f){return _0x2d943f[_0x563d('0x6f')]===_0x5cfa03['id'];});if(_0x235528)_0x4f06b8[_0x563d('0x70')](_0x5cfa03);}else{_0x4f06b8[_0x563d('0x70')](_0x5cfa03);}}return _0x4f06b8;}});}else{return _0x6bf38e;}}else{var _0x2bcd7d=_[_0x563d('0x49')](_0x6bf38e,function(_0x1f93e2){if(_0x1f93e2[_0x563d('0x69')]!==_0x563d('0x5c')){return _0x1f93e2;}});return _0x2bcd7d;}});}else{return _0x6bf38e;}}})['then'](function(_0x182422){var _0x58dcd6=[];if(_0x182422){_0x3530a4=_0x182422;for(var _0x4bf460=0x0;_0x4bf460<_0x182422[_0x563d('0x42')];_0x4bf460+=0x1){_0x3530a4[_0x4bf460]['messages']=[];_0x58dcd6['push'](db['ChatInternalMessage'][_0x563d('0x53')]({'where':{'FromId':[_0x59f546[_0x563d('0x68')]['id'],_0x182422[_0x4bf460]['id']],'ToId':[_0x59f546[_0x563d('0x68')]['id'],_0x182422[_0x4bf460]['id']],'ChatGroupId':null},'attributes':['id',_0x563d('0x59'),'FromId','ToId',_0x563d('0x71'),'body'],'order':qs[_0x563d('0x46')](_0x563d('0x72')),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0x182422[_0x4bf460])));}return BPromise[_0x563d('0x73')](_0x58dcd6);}return[];})[_0x563d('0x31')](function(_0x1fb434){return{'rows':_0x1fb434,'count':_0x1fb434[_0x563d('0x42')]};})[_0x563d('0x31')](respondWithResult(_0x18023a,null))['catch'](handleError(_0x18023a,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index fb5f0ff..17672a3 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 _0x62a8=['setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events','ChatInternalMessage'];(function(_0x21ec2b,_0x1feca4){var _0x246e9e=function(_0x3cca26){while(--_0x3cca26){_0x21ec2b['push'](_0x21ec2b['shift']());}};_0x246e9e(++_0x1feca4);}(_0x62a8,0x142));var _0x862a=function(_0x4c27ee,_0x404762){_0x4c27ee=_0x4c27ee-0x0;var _0x2e2150=_0x62a8[_0x4c27ee];return _0x2e2150;};'use strict';var EventEmitter=require(_0x862a('0x0'));var ChatInternalMessage=require('../../mysqldb')['db'][_0x862a('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x862a('0x2')](0x0);var events={'afterCreate':_0x862a('0x3'),'afterUpdate':_0x862a('0x4'),'afterDestroy':_0x862a('0x5')};function emitEvent(_0x3931ef){return function(_0x728534,_0x3c3409,_0x1cc4b5){ChatInternalMessageEvents[_0x862a('0x6')](_0x3931ef+':'+_0x728534['id'],_0x728534);ChatInternalMessageEvents['emit'](_0x3931ef,_0x728534);_0x1cc4b5(null);};}for(var e in events){if(events[_0x862a('0x7')](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module[_0x862a('0x8')]=ChatInternalMessageEvents; \ No newline at end of file +var _0x1666=['emit','exports','events','ChatInternalMessage','setMaxListeners','save','update'];(function(_0x235e66,_0x4bef96){var _0x36019b=function(_0x3674f3){while(--_0x3674f3){_0x235e66['push'](_0x235e66['shift']());}};_0x36019b(++_0x4bef96);}(_0x1666,0xbf));var _0x6166=function(_0x160c44,_0x1deaf1){_0x160c44=_0x160c44-0x0;var _0x518efd=_0x1666[_0x160c44];return _0x518efd;};'use strict';var EventEmitter=require(_0x6166('0x0'));var ChatInternalMessage=require('../../mysqldb')['db'][_0x6166('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x6166('0x2')](0x0);var events={'afterCreate':_0x6166('0x3'),'afterUpdate':_0x6166('0x4'),'afterDestroy':'remove'};function emitEvent(_0x489f2d){return function(_0x255767,_0x411db1,_0x55c2b5){ChatInternalMessageEvents[_0x6166('0x5')](_0x489f2d+':'+_0x255767['id'],_0x255767);ChatInternalMessageEvents[_0x6166('0x5')](_0x489f2d,_0x255767);_0x55c2b5(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module[_0x6166('0x6')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 28afb11..30a4e10 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 _0x3ca0=['ChatInternalMessage','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./chatInternalMessage.attributes','exports','define'];(function(_0x903d0d,_0x51f65b){var _0x1ba526=function(_0x3f09c3){while(--_0x3f09c3){_0x903d0d['push'](_0x903d0d['shift']());}};_0x1ba526(++_0x51f65b);}(_0x3ca0,0x11c));var _0x03ca=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3ca0[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x03ca('0x0'));var util=require('util');var logger=require(_0x03ca('0x1'))(_0x03ca('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x03ca('0x3'));var fs=require('fs');var path=require(_0x03ca('0x4'));var rimraf=require(_0x03ca('0x5'));var config=require(_0x03ca('0x6'));var attributes=require(_0x03ca('0x7'));module[_0x03ca('0x8')]=function(_0x4cd543,_0x412f8b){return _0x4cd543[_0x03ca('0x9')](_0x03ca('0xa'),attributes,{'tableName':_0x03ca('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x03ca('0xc'),'collate':_0x03ca('0xd')});}; \ No newline at end of file +var _0xe90b=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','ChatInternalMessage','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api'];(function(_0x5175b8,_0x20b486){var _0x25085d=function(_0x407b08){while(--_0x407b08){_0x5175b8['push'](_0x5175b8['shift']());}};_0x25085d(++_0x20b486);}(_0xe90b,0x107));var _0xbe90=function(_0xf89ad3,_0x4a4a05){_0xf89ad3=_0xf89ad3-0x0;var _0x324449=_0xe90b[_0xf89ad3];return _0x324449;};'use strict';var _=require(_0xbe90('0x0'));var util=require('util');var logger=require(_0xbe90('0x1'))(_0xbe90('0x2'));var moment=require(_0xbe90('0x3'));var BPromise=require(_0xbe90('0x4'));var rp=require(_0xbe90('0x5'));var fs=require('fs');var path=require(_0xbe90('0x6'));var rimraf=require(_0xbe90('0x7'));var config=require(_0xbe90('0x8'));var attributes=require('./chatInternalMessage.attributes');module[_0xbe90('0x9')]=function(_0x2a2c5e,_0x450bff){return _0x2a2c5e['define'](_0xbe90('0xa'),attributes,{'tableName':_0xbe90('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xbe90('0xc'),'collate':_0xbe90('0xd')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index ce35c87..b4c60f1 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 _0xe0eb=['localhost','socket.io-emitter','request','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','defaults','redis'];(function(_0x1aba79,_0x335da1){var _0x3d2058=function(_0x3cf3a5){while(--_0x3cf3a5){_0x1aba79['push'](_0x1aba79['shift']());}};_0x3d2058(++_0x335da1);}(_0xe0eb,0x71));var _0xbe0e=function(_0xe3839f,_0x555463){_0xe3839f=_0xe3839f-0x0;var _0x43c987=_0xe0eb[_0xe3839f];return _0x43c987;};'use strict';var _=require(_0xbe0e('0x0'));var util=require(_0xbe0e('0x1'));var moment=require('moment');var BPromise=require(_0xbe0e('0x2'));var rs=require(_0xbe0e('0x3'));var fs=require('fs');var Redis=require(_0xbe0e('0x4'));var db=require(_0xbe0e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xbe0e('0x6'))(_0xbe0e('0x7'));var config=require(_0xbe0e('0x8'));var jayson=require(_0xbe0e('0x9'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0xbe0e('0xa')](config[_0xbe0e('0xb')],{'host':_0xbe0e('0xc'),'port':0x18eb});var socket=require(_0xbe0e('0xd'))(new Redis(config[_0xbe0e('0xb')]));require('./chatInternalMessage.socket')['register'](socket);function respondWithRpcPromise(_0x2de8ff,_0x59bd72,_0x219e5c){return new BPromise(function(_0x5ea57b,_0x1b0a61){return client[_0xbe0e('0xe')](_0x2de8ff,_0x219e5c)['then'](function(_0x59c89a){logger[_0xbe0e('0xf')](_0xbe0e('0x10'),_0x59bd72,_0xbe0e('0x11'));logger[_0xbe0e('0x12')](_0xbe0e('0x13'),_0x59bd72,'request\x20sent',JSON[_0xbe0e('0x14')](_0x59c89a));if(_0x59c89a['error']){if(_0x59c89a['error'][_0xbe0e('0x15')]===0x1f4){logger['error'](_0xbe0e('0x10'),_0x59bd72,_0x59c89a[_0xbe0e('0x16')][_0xbe0e('0x17')]);return _0x1b0a61(_0x59c89a['error'][_0xbe0e('0x17')]);}logger[_0xbe0e('0x16')](_0xbe0e('0x10'),_0x59bd72,_0x59c89a[_0xbe0e('0x16')]['message']);return _0x5ea57b(_0x59c89a[_0xbe0e('0x16')][_0xbe0e('0x17')]);}else{logger['info'](_0xbe0e('0x10'),_0x59bd72,_0xbe0e('0x11'));_0x5ea57b(_0x59c89a['result'][_0xbe0e('0x17')]);}})[_0xbe0e('0x18')](function(_0x3dabc4){logger[_0xbe0e('0x16')]('ChatInternalMessage,\x20%s,\x20%s',_0x59bd72,_0x3dabc4);_0x1b0a61(_0x3dabc4);});});} \ No newline at end of file +var _0x093d=['result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','defaults','redis','socket.io-emitter','request','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','info'];(function(_0x58482e,_0x370ce6){var _0x43e87d=function(_0x5ddda8){while(--_0x5ddda8){_0x58482e['push'](_0x58482e['shift']());}};_0x43e87d(++_0x370ce6);}(_0x093d,0x1c9));var _0xd093=function(_0x5be46a,_0x2fb035){_0x5be46a=_0x5be46a-0x0;var _0x1ce3b8=_0x093d[_0x5be46a];return _0x1ce3b8;};'use strict';var _=require(_0xd093('0x0'));var util=require(_0xd093('0x1'));var moment=require(_0xd093('0x2'));var BPromise=require(_0xd093('0x3'));var rs=require(_0xd093('0x4'));var fs=require('fs');var Redis=require(_0xd093('0x5'));var db=require(_0xd093('0x6'))['db'];var utils=require(_0xd093('0x7'));var logger=require(_0xd093('0x8'))(_0xd093('0x9'));var config=require(_0xd093('0xa'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0xd093('0xb')](config[_0xd093('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xd093('0xd'))(new Redis(config[_0xd093('0xc')]));require('./chatInternalMessage.socket')['register'](socket);function respondWithRpcPromise(_0x3b7f9e,_0x27f19b,_0x354827){return new BPromise(function(_0x93a722,_0x55939d){return client[_0xd093('0xe')](_0x3b7f9e,_0x354827)['then'](function(_0xc77895){logger['info'](_0xd093('0xf'),_0x27f19b,_0xd093('0x10'));logger[_0xd093('0x11')](_0xd093('0x12'),_0x27f19b,_0xd093('0x10'),JSON[_0xd093('0x13')](_0xc77895));if(_0xc77895['error']){if(_0xc77895[_0xd093('0x14')]['code']===0x1f4){logger[_0xd093('0x14')](_0xd093('0xf'),_0x27f19b,_0xc77895[_0xd093('0x14')][_0xd093('0x15')]);return _0x55939d(_0xc77895[_0xd093('0x14')]['message']);}logger['error'](_0xd093('0xf'),_0x27f19b,_0xc77895[_0xd093('0x14')]['message']);return _0x93a722(_0xc77895[_0xd093('0x14')][_0xd093('0x15')]);}else{logger[_0xd093('0x16')](_0xd093('0xf'),_0x27f19b,_0xd093('0x10'));_0x93a722(_0xc77895[_0xd093('0x17')]['message']);}})['catch'](function(_0x2f19a9){logger[_0xd093('0x14')](_0xd093('0xf'),_0x27f19b,_0x2f19a9);_0x55939d(_0x2f19a9);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 0625873..e9de56a 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 _0xada1=['register','length','chatInternalMessage:','./chatInternalMessage.events','save','update','emit','removeListener'];(function(_0x308213,_0x224541){var _0x2e1619=function(_0x972b51){while(--_0x972b51){_0x308213['push'](_0x308213['shift']());}};_0x2e1619(++_0x224541);}(_0xada1,0x12b));var _0x1ada=function(_0x411017,_0x4a8117){_0x411017=_0x411017-0x0;var _0x2adeea=_0xada1[_0x411017];return _0x2adeea;};'use strict';var ChatInternalMessageEvents=require(_0x1ada('0x0'));var events=[_0x1ada('0x1'),'remove',_0x1ada('0x2')];function createListener(_0x3a329a,_0x4010c2){return function(_0xf01bdf){_0x4010c2[_0x1ada('0x3')](_0x3a329a,_0xf01bdf);};}function removeListener(_0x1f286a,_0x39be5f){return function(){ChatInternalMessageEvents[_0x1ada('0x4')](_0x1f286a,_0x39be5f);};}exports[_0x1ada('0x5')]=function(_0xaf6740){for(var _0x2a2f06=0x0,_0x1ed1e2=events[_0x1ada('0x6')];_0x2a2f06<_0x1ed1e2;_0x2a2f06++){var _0x3c123e=events[_0x2a2f06];var _0xcc8f48=createListener(_0x1ada('0x7')+_0x3c123e,_0xaf6740);ChatInternalMessageEvents['on'](_0x3c123e,_0xcc8f48);}}; \ No newline at end of file +var _0xb175=['remove','emit','removeListener','register','length','chatInternalMessage:','save'];(function(_0x4c0619,_0x58dd6b){var _0x40ee84=function(_0x507ec6){while(--_0x507ec6){_0x4c0619['push'](_0x4c0619['shift']());}};_0x40ee84(++_0x58dd6b);}(_0xb175,0x1e9));var _0x5b17=function(_0x12f1e9,_0x5e4b21){_0x12f1e9=_0x12f1e9-0x0;var _0x2dc2de=_0xb175[_0x12f1e9];return _0x2dc2de;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=[_0x5b17('0x0'),_0x5b17('0x1'),'update'];function createListener(_0x15f6fa,_0x363647){return function(_0x316e2f){_0x363647[_0x5b17('0x2')](_0x15f6fa,_0x316e2f);};}function removeListener(_0x1be9da,_0x3e190d){return function(){ChatInternalMessageEvents[_0x5b17('0x3')](_0x1be9da,_0x3e190d);};}exports[_0x5b17('0x4')]=function(_0x5c560a){for(var _0x51006a=0x0,_0xd49f93=events[_0x5b17('0x5')];_0x51006a<_0xd49f93;_0x51006a++){var _0x59d155=events[_0x51006a];var _0x5d81d6=createListener(_0x5b17('0x6')+_0x59d155,_0x5c560a);ChatInternalMessageEvents['on'](_0x59d155,_0x5d81d6);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 12b016b..d1d27c2 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 _0x5aa1=['/describe','isAuthenticated','describe','/users','getUsers','show','create','put','/:id','update','delete','destroy','multer','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','index'];(function(_0x525ca3,_0x17acb7){var _0x2b6804=function(_0x292646){while(--_0x292646){_0x525ca3['push'](_0x525ca3['shift']());}};_0x2b6804(++_0x17acb7);}(_0x5aa1,0x12a));var _0x15aa=function(_0xe5b539,_0x467802){_0xe5b539=_0xe5b539-0x0;var _0x4bd185=_0x5aa1[_0xe5b539];return _0x4bd185;};'use strict';var multer=require(_0x15aa('0x0'));var util=require(_0x15aa('0x1'));var path=require('path');var timeout=require(_0x15aa('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x15aa('0x3'));var auth=require(_0x15aa('0x4'));var interaction=require(_0x15aa('0x5'));var config=require(_0x15aa('0x6'));var controller=require(_0x15aa('0x7'));router[_0x15aa('0x8')]('/',auth['isAuthenticated'](),controller[_0x15aa('0x9')]);router['get'](_0x15aa('0xa'),auth[_0x15aa('0xb')](),controller[_0x15aa('0xc')]);router[_0x15aa('0x8')](_0x15aa('0xd'),auth[_0x15aa('0xb')](),controller[_0x15aa('0xe')]);router['get']('/:id',auth[_0x15aa('0xb')](),controller[_0x15aa('0xf')]);router['post']('/',auth[_0x15aa('0xb')](),controller[_0x15aa('0x10')]);router[_0x15aa('0x11')](_0x15aa('0x12'),controller[_0x15aa('0x13')]);router[_0x15aa('0x14')](_0x15aa('0x12'),auth[_0x15aa('0xb')](),controller[_0x15aa('0x15')]);module['exports']=router; \ No newline at end of file +var _0x4beb=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','index','/describe','isAuthenticated','/users','getUsers','/:id','post','create','put','update','destroy','exports','util','express','Router'];(function(_0x59556b,_0x3db7cb){var _0x3f3150=function(_0x22fed7){while(--_0x22fed7){_0x59556b['push'](_0x59556b['shift']());}};_0x3f3150(++_0x3db7cb);}(_0x4beb,0x14d));var _0xb4be=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4beb[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0xb4be('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb4be('0x1'));var router=express[_0xb4be('0x2')]();var fs_extra=require(_0xb4be('0x3'));var auth=require(_0xb4be('0x4'));var interaction=require(_0xb4be('0x5'));var config=require(_0xb4be('0x6'));var controller=require(_0xb4be('0x7'));router[_0xb4be('0x8')]('/',auth['isAuthenticated'](),controller[_0xb4be('0x9')]);router[_0xb4be('0x8')](_0xb4be('0xa'),auth[_0xb4be('0xb')](),controller['describe']);router['get'](_0xb4be('0xc'),auth['isAuthenticated'](),controller[_0xb4be('0xd')]);router[_0xb4be('0x8')](_0xb4be('0xe'),auth[_0xb4be('0xb')](),controller['show']);router[_0xb4be('0xf')]('/',auth[_0xb4be('0xb')](),controller[_0xb4be('0x10')]);router[_0xb4be('0x11')]('/:id',controller[_0xb4be('0x12')]);router['delete'](_0xb4be('0xe'),auth[_0xb4be('0xb')](),controller[_0xb4be('0x13')]);module[_0xb4be('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index eaa0cb6..494f32f 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 _0x6a95=['ENUM','DATE','STRING','sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0x38cb64,_0x3cf237){var _0x543a29=function(_0x3d1503){while(--_0x3d1503){_0x38cb64['push'](_0x38cb64['shift']());}};_0x543a29(++_0x3cf237);}(_0x6a95,0x1db));var _0x56a9=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x6a95[_0x550d12];return _0x12103d;};'use strict';var Sequelize=require(_0x56a9('0x0'));module[_0x56a9('0x1')]={'body':{'type':Sequelize[_0x56a9('0x2')](_0x56a9('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x56a9('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0x56a9('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x56a9('0x5')]('in','out'),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x56a9('0x6')]},'providerName':{'type':Sequelize[_0x56a9('0x7')]},'providerResponse':{'type':Sequelize[_0x56a9('0x2')]}}; \ No newline at end of file +var _0xbcff=['TEXT','BOOLEAN','ENUM','out','DATE','STRING','sequelize','exports'];(function(_0x1aae33,_0x110a80){var _0x2e91e9=function(_0x218767){while(--_0x218767){_0x1aae33['push'](_0x1aae33['shift']());}};_0x2e91e9(++_0x110a80);}(_0xbcff,0x12e));var _0xfbcf=function(_0x541037,_0x582f95){_0x541037=_0x541037-0x0;var _0x225dd7=_0xbcff[_0x541037];return _0x225dd7;};'use strict';var Sequelize=require(_0xfbcf('0x0'));module[_0xfbcf('0x1')]={'body':{'type':Sequelize[_0xfbcf('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xfbcf('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0xfbcf('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xfbcf('0x4')]('in','out'),'defaultValue':_0xfbcf('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0xfbcf('0x6')]},'providerName':{'type':Sequelize[_0xfbcf('0x7')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 02dd7f3..13ad7a7 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 _0x4d1c=['ejs','fs-extra','squel','crypto','desk.js','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','http','ChatMessage,\x20%s,\x20%s','debug','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','update','then','destroy','name','index','map','ChatMessage','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','options','includeAll','include','rows','catch','show','params','find','create','body','describe','chat-interactions','accept','chat','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','ChatInteractionId','read1stAt','interaction','info','role','null','AcceptMessage','acceptMessage','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','interface','channel','motionChannel','EventManager','acceptmessage','parse','formData','reject','ChatInteraction','RejectMessage','ContactId','SIP/%s','event','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4d1c,0xfa));var _0xc4d1=function(_0x2af021,_0x195fdd){_0x2af021=_0x2af021-0x0;var _0x2e057e=_0x4d1c[_0x2af021];return _0x2e057e;};'use strict';var emlformat=require(_0xc4d1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc4d1('0x1'));var jsonpatch=require(_0xc4d1('0x2'));var rp=require('request-promise');var moment=require(_0xc4d1('0x3'));var BPromise=require(_0xc4d1('0x4'));var Mustache=require(_0xc4d1('0x5'));var util=require(_0xc4d1('0x6'));var path=require(_0xc4d1('0x7'));var sox=require(_0xc4d1('0x8'));var csv=require(_0xc4d1('0x9'));var ejs=require(_0xc4d1('0xa'));var fs=require('fs');var fs_extra=require(_0xc4d1('0xb'));var _=require('lodash');var squel=require(_0xc4d1('0xc'));var crypto=require(_0xc4d1('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xc4d1('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xc4d1('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xc4d1('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xc4d1('0x11'))(_0xc4d1('0x12'));var utils=require(_0xc4d1('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xc4d1('0x14'));var db=require(_0xc4d1('0x15'))['db'];config[_0xc4d1('0x16')]=_[_0xc4d1('0x17')](config[_0xc4d1('0x16')],{'host':_0xc4d1('0x18'),'port':0x18eb});var socket=require(_0xc4d1('0x19'))(new Redis(config[_0xc4d1('0x16')]));require(_0xc4d1('0x1a'))[_0xc4d1('0x1b')](socket);var jayson=require(_0xc4d1('0x1c'));var client=jayson[_0xc4d1('0x1d')][_0xc4d1('0x1e')]({'port':0x232c});var client9002=jayson[_0xc4d1('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x25fba5,_0x25375d,_0x220381,_0x551594){return new BPromise(function(_0x13b4a7,_0x40f908){var _0x2ed25d=_0x551594||client;return _0x2ed25d['request'](_0x25fba5,_0x220381)['then'](function(_0x346a5f){logger['info'](_0xc4d1('0x1f'),_0x25375d,'request\x20sent');logger[_0xc4d1('0x20')](_0xc4d1('0x21'),_0x25375d,_0xc4d1('0x22'),JSON[_0xc4d1('0x23')](_0x346a5f));if(_0x346a5f[_0xc4d1('0x24')]){if(_0x346a5f[_0xc4d1('0x24')][_0xc4d1('0x25')]===0x1f4){logger[_0xc4d1('0x24')](_0xc4d1('0x1f'),_0x25375d,_0x346a5f[_0xc4d1('0x24')][_0xc4d1('0x26')]);return _0x40f908(_0x346a5f['error'][_0xc4d1('0x26')]);}logger['error']('ChatMessage,\x20%s,\x20%s',_0x25375d,_0x346a5f[_0xc4d1('0x24')][_0xc4d1('0x26')]);return _0x13b4a7(_0x346a5f[_0xc4d1('0x24')][_0xc4d1('0x26')]);}else{logger['info'](_0xc4d1('0x1f'),_0x25375d,'request\x20sent');_0x13b4a7(_0x346a5f[_0xc4d1('0x27')][_0xc4d1('0x26')]);}})['catch'](function(_0x4a164d){logger[_0xc4d1('0x24')](_0xc4d1('0x1f'),_0x25375d,_0x4a164d);_0x40f908(_0x4a164d);});});}function respondWithStatusCode(_0x4837d8,_0x487010){_0x487010=_0x487010||0xcc;return function(_0x37a1db){if(_0x37a1db){return _0x4837d8[_0xc4d1('0x28')](_0x487010);}return _0x4837d8[_0xc4d1('0x29')](_0x487010)[_0xc4d1('0x2a')]();};}function respondWithResult(_0x52f770,_0x174e0b){_0x174e0b=_0x174e0b||0xc8;return function(_0x35c256){if(_0x35c256){return _0x52f770[_0xc4d1('0x29')](_0x174e0b)['json'](_0x35c256);}};}function respondWithFilteredResult(_0x1061dc,_0x29a852){return function(_0x153c61){if(_0x153c61){var _0x570723=typeof _0x29a852[_0xc4d1('0x2b')]==='undefined'&&typeof _0x29a852[_0xc4d1('0x2c')]===_0xc4d1('0x2d');var _0x4f598c=_0x153c61[_0xc4d1('0x2e')];var _0x305c12=_0x570723?0x0:_0x29a852[_0xc4d1('0x2b')];var _0xa986a3=_0x570723?_0x153c61[_0xc4d1('0x2e')]:_0x29a852[_0xc4d1('0x2b')]+_0x29a852['limit'];var _0x1b9206;if(_0xa986a3>=_0x4f598c){_0xa986a3=_0x4f598c;_0x1b9206=0xc8;}else{_0x1b9206=0xce;}_0x1061dc['status'](_0x1b9206);return _0x1061dc[_0xc4d1('0x2f')](_0xc4d1('0x30'),_0x305c12+'-'+_0xa986a3+'/'+_0x4f598c)[_0xc4d1('0x31')](_0x153c61);}return null;};}function patchUpdates(_0x30bfcf){return function(_0x345afd){try{jsonpatch[_0xc4d1('0x32')](_0x345afd,_0x30bfcf,!![]);}catch(_0x447739){return BPromise['reject'](_0x447739);}return _0x345afd['save']();};}function saveUpdates(_0x2b8af8,_0x155ec3){return function(_0x25057a){if(_0x25057a){return _0x25057a[_0xc4d1('0x33')](_0x2b8af8)[_0xc4d1('0x34')](function(_0x36825e){return _0x36825e;});}return null;};}function removeEntity(_0x33b125,_0xc8dec){return function(_0x15f85a){if(_0x15f85a){return _0x15f85a[_0xc4d1('0x35')]()[_0xc4d1('0x34')](function(){_0x33b125['status'](0xcc)[_0xc4d1('0x2a')]();});}};}function handleEntityNotFound(_0x3317eb,_0x1397d6){return function(_0x2d3dff){if(!_0x2d3dff){_0x3317eb['sendStatus'](0x194);}return _0x2d3dff;};}function handleError(_0x1730b8,_0x41a00c){_0x41a00c=_0x41a00c||0x1f4;return function(_0x9d782c){logger[_0xc4d1('0x24')](_0x9d782c['stack']);if(_0x9d782c[_0xc4d1('0x36')]){delete _0x9d782c[_0xc4d1('0x36')];}_0x1730b8['status'](_0x41a00c)['send'](_0x9d782c);};}exports[_0xc4d1('0x37')]=function(_0x41bf54,_0x43ce8d){var _0x38c9d1={},_0x442170={},_0x2bf297={'count':0x0,'rows':[]};var _0x843cc5=_[_0xc4d1('0x38')](db[_0xc4d1('0x39')][_0xc4d1('0x3a')],function(_0x18bb6d){return{'name':_0x18bb6d['fieldName'],'type':_0x18bb6d[_0xc4d1('0x3b')][_0xc4d1('0x3c')]};});_0x442170[_0xc4d1('0x3d')]=_[_0xc4d1('0x38')](_0x843cc5,_0xc4d1('0x36'));_0x442170[_0xc4d1('0x3e')]=_[_0xc4d1('0x3f')](_0x41bf54[_0xc4d1('0x3e')]);_0x442170['filters']=_[_0xc4d1('0x40')](_0x442170[_0xc4d1('0x3d')],_0x442170['query']);_0x38c9d1[_0xc4d1('0x41')]=_['intersection'](_0x442170[_0xc4d1('0x3d')],qs[_0xc4d1('0x42')](_0x41bf54[_0xc4d1('0x3e')]['fields']));_0x38c9d1[_0xc4d1('0x41')]=_0x38c9d1[_0xc4d1('0x41')][_0xc4d1('0x43')]?_0x38c9d1[_0xc4d1('0x41')]:_0x442170[_0xc4d1('0x3d')];if(!_0x41bf54[_0xc4d1('0x3e')][_0xc4d1('0x44')](_0xc4d1('0x45'))){_0x38c9d1[_0xc4d1('0x2c')]=qs[_0xc4d1('0x2c')](_0x41bf54[_0xc4d1('0x3e')]['limit']);_0x38c9d1[_0xc4d1('0x2b')]=qs['offset'](_0x41bf54['query'][_0xc4d1('0x2b')]);}_0x38c9d1[_0xc4d1('0x46')]=qs[_0xc4d1('0x47')](_0x41bf54['query'][_0xc4d1('0x47')]);_0x38c9d1['where']=qs[_0xc4d1('0x48')](_[_0xc4d1('0x49')](_0x41bf54[_0xc4d1('0x3e')],_0x442170[_0xc4d1('0x48')]),_0x843cc5);if(_0x41bf54[_0xc4d1('0x3e')][_0xc4d1('0x4a')]){_0x38c9d1[_0xc4d1('0x4b')]=_[_0xc4d1('0x4c')](_0x38c9d1[_0xc4d1('0x4b')],{'$or':_[_0xc4d1('0x38')](_0x843cc5,function(_0x3ace86){if(_0x3ace86[_0xc4d1('0x3b')]!=='VIRTUAL'){var _0x7ac3d1={};_0x7ac3d1[_0x3ace86[_0xc4d1('0x36')]]={'$like':'%'+_0x41bf54['query'][_0xc4d1('0x4a')]+'%'};return _0x7ac3d1;}})});}_0x38c9d1=_[_0xc4d1('0x4c')]({},_0x38c9d1,_0x41bf54[_0xc4d1('0x4d')]);var _0x2ae786={'where':_0x38c9d1[_0xc4d1('0x4b')]};return db[_0xc4d1('0x39')][_0xc4d1('0x2e')](_0x2ae786)[_0xc4d1('0x34')](function(_0x5673f3){_0x2bf297[_0xc4d1('0x2e')]=_0x5673f3;if(_0x41bf54[_0xc4d1('0x3e')][_0xc4d1('0x4e')]){_0x38c9d1[_0xc4d1('0x4f')]=[{'all':!![]}];}return db['ChatMessage']['findAll'](_0x38c9d1);})['then'](function(_0x35c858){_0x2bf297[_0xc4d1('0x50')]=_0x35c858;return _0x2bf297;})[_0xc4d1('0x34')](respondWithFilteredResult(_0x43ce8d,_0x38c9d1))[_0xc4d1('0x51')](handleError(_0x43ce8d,null));};exports[_0xc4d1('0x52')]=function(_0x44343e,_0x1e97ab){var _0x7af4f0={'raw':!![],'where':{'id':_0x44343e[_0xc4d1('0x53')]['id']}},_0x457c53={};_0x457c53[_0xc4d1('0x3d')]=_[_0xc4d1('0x3f')](db['ChatMessage'][_0xc4d1('0x3a')]);_0x457c53[_0xc4d1('0x3e')]=_[_0xc4d1('0x3f')](_0x44343e[_0xc4d1('0x3e')]);_0x457c53['filters']=_['intersection'](_0x457c53[_0xc4d1('0x3d')],_0x457c53[_0xc4d1('0x3e')]);_0x7af4f0[_0xc4d1('0x41')]=_[_0xc4d1('0x40')](_0x457c53['model'],qs[_0xc4d1('0x42')](_0x44343e['query']['fields']));_0x7af4f0[_0xc4d1('0x41')]=_0x7af4f0[_0xc4d1('0x41')][_0xc4d1('0x43')]?_0x7af4f0[_0xc4d1('0x41')]:_0x457c53[_0xc4d1('0x3d')];if(_0x44343e['query']['includeAll']){_0x7af4f0[_0xc4d1('0x4f')]=[{'all':!![]}];}_0x7af4f0=_[_0xc4d1('0x4c')]({},_0x7af4f0,_0x44343e[_0xc4d1('0x4d')]);return db['ChatMessage'][_0xc4d1('0x54')](_0x7af4f0)[_0xc4d1('0x34')](handleEntityNotFound(_0x1e97ab,null))[_0xc4d1('0x34')](respondWithResult(_0x1e97ab,null))['catch'](handleError(_0x1e97ab,null));};exports[_0xc4d1('0x55')]=function(_0x49da25,_0x450feb){return db['ChatMessage'][_0xc4d1('0x55')](_0x49da25['body'],{})['then'](respondWithResult(_0x450feb,0xc9))[_0xc4d1('0x51')](handleError(_0x450feb,null));};exports[_0xc4d1('0x33')]=function(_0x30034b,_0x17dfef){if(_0x30034b['body']['id']){delete _0x30034b[_0xc4d1('0x56')]['id'];}return db[_0xc4d1('0x39')][_0xc4d1('0x54')]({'where':{'id':_0x30034b[_0xc4d1('0x53')]['id']}})[_0xc4d1('0x34')](handleEntityNotFound(_0x17dfef,null))[_0xc4d1('0x34')](saveUpdates(_0x30034b[_0xc4d1('0x56')],null))[_0xc4d1('0x34')](respondWithResult(_0x17dfef,null))['catch'](handleError(_0x17dfef,null));};exports[_0xc4d1('0x35')]=function(_0x15efd1,_0x8d7cc3){return db[_0xc4d1('0x39')][_0xc4d1('0x54')]({'where':{'id':_0x15efd1[_0xc4d1('0x53')]['id']}})[_0xc4d1('0x34')](handleEntityNotFound(_0x8d7cc3,null))[_0xc4d1('0x34')](removeEntity(_0x8d7cc3,null))['catch'](handleError(_0x8d7cc3,null));};exports[_0xc4d1('0x57')]=function(_0x1637ee,_0x5ea89b){return db[_0xc4d1('0x39')][_0xc4d1('0x57')]()['then'](respondWithResult(_0x5ea89b,null))[_0xc4d1('0x51')](handleError(_0x5ea89b,null));};var interaction_log=require(_0xc4d1('0x11'))(_0xc4d1('0x58'));exports[_0xc4d1('0x59')]=function(_0x4881d8,_0x382271,_0x341a8a){var _0x2a2836={'agent':{},'channel':_0xc4d1('0x5a')};if(_0x4881d8['body']['id']){delete _0x4881d8[_0xc4d1('0x56')]['id'];}_0x4881d8[_0xc4d1('0x56')][_0xc4d1('0x5b')]=!![];_0x4881d8[_0xc4d1('0x56')][_0xc4d1('0x5c')]=moment()[_0xc4d1('0x5d')](_0xc4d1('0x5e'));_0x4881d8[_0xc4d1('0x56')][_0xc4d1('0x5f')]=_0x4881d8[_0xc4d1('0x56')][_0xc4d1('0x5f')]||_0x4881d8[_0xc4d1('0x60')]['id'];_0x2a2836[_0xc4d1('0x61')]['id']=_0x4881d8[_0xc4d1('0x56')][_0xc4d1('0x5f')];return db[_0xc4d1('0x39')][_0xc4d1('0x54')]({'where':{'id':_0x4881d8[_0xc4d1('0x53')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x382271,null))[_0xc4d1('0x34')](saveUpdates(_0x4881d8[_0xc4d1('0x56')],null))['then'](function(_0x4e8699){if(_0x4e8699){_0x2a2836[_0xc4d1('0x26')]=_0x4e8699[_0xc4d1('0x62')]({'plain':!![]});return db['ChatInteraction'][_0xc4d1('0x54')]({'where':{'id':_0x4e8699[_0xc4d1('0x63')]}});}return null;})[_0xc4d1('0x34')](handleEntityNotFound(_0x382271,null))['then'](function(_0x44c6b1){if(_0x44c6b1){return _0x44c6b1[_0xc4d1('0x33')]({'UserId':_0x4881d8[_0xc4d1('0x56')]['UserId'],'read1stAt':_['isNil'](_0x44c6b1[_0xc4d1('0x64')])?moment()[_0xc4d1('0x5d')](_0xc4d1('0x5e')):undefined});}return null;})[_0xc4d1('0x34')](function(_0x84c879){if(_0x84c879){_0x2a2836[_0xc4d1('0x65')]=_0x84c879[_0xc4d1('0x62')]({'plain':!![]});interaction_log[_0xc4d1('0x66')]('[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4881d8[_0xc4d1('0x60')]['id'],_0x4881d8[_0xc4d1('0x60')]['name'],_0x4881d8['user'][_0xc4d1('0x67')],_0x2a2836['interaction']['id'],_0x4881d8[_0xc4d1('0x56')]?JSON['stringify'](_0x4881d8['body']):_0xc4d1('0x68'));return respondWithRpcPromise(_0xc4d1('0x69'),_0xc4d1('0x6a'),_0x2a2836);}return null;})[_0xc4d1('0x34')](function(_0x48147a){var _0x3fb791='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x48147a[_0xc4d1('0x26')]['ContactId'];return db[_0xc4d1('0x6b')][_0xc4d1('0x3e')](_0x3fb791,{'type':db[_0xc4d1('0x6c')][_0xc4d1('0x6d')][_0xc4d1('0x6e')],'raw':!![]})[_0xc4d1('0x34')](function(_0x5c6acd){return _0x5c6acd;});})['then'](function(_0x55f1e1){if(_0x55f1e1){_0x2a2836['message'][_0xc4d1('0x6f')]=_0x55f1e1[0x0];if(!_0x4881d8[_0xc4d1('0x56')][_0xc4d1('0x5f')])return;return db[_0xc4d1('0x70')][_0xc4d1('0x54')]({'where':{'id':_0x4881d8[_0xc4d1('0x56')][_0xc4d1('0x5f')],'role':'agent'},'attributes':['id','name',_0xc4d1('0x71'),_0xc4d1('0x72'),_0xc4d1('0x73')],'raw':!![]});}return null;})[_0xc4d1('0x34')](function(_0x2c06d4){if(!_0x2c06d4)return null;_0x2a2836[_0xc4d1('0x26')][_0xc4d1('0x61')]=_0x2c06d4;return _0x2a2836;})['then'](function(_0xc9dd0a){if(_0xc9dd0a){if(_0x4881d8[_0xc4d1('0x56')][_0xc4d1('0x74')]){_0x2a2836['message'][_0xc4d1('0x75')]=util[_0xc4d1('0x5d')]('SIP/%s',_0x4881d8[_0xc4d1('0x60')][_0xc4d1('0x36')]);_0x2a2836[_0xc4d1('0x26')][_0xc4d1('0x76')]=_0x2a2836[_0xc4d1('0x76')];_0x2a2836[_0xc4d1('0x26')][_0xc4d1('0x77')]=_0x2a2836[_0xc4d1('0x76')];_0x2a2836[_0xc4d1('0x26')]['event']=_0xc4d1('0x59');return respondWithRpcPromise(_0xc4d1('0x78'),'EventManager',{'event':_0xc4d1('0x79'),'message':_[_0xc4d1('0x4c')](_0x2a2836[_0xc4d1('0x26')],JSON[_0xc4d1('0x7a')](_0x2a2836[_0xc4d1('0x65')][_0xc4d1('0x7b')]))},client9002)['then'](function(){return _0x2a2836;});}return _0x2a2836;}return null;})[_0xc4d1('0x34')](respondWithResult(_0x382271,null))[_0xc4d1('0x51')](handleError(_0x382271,null));};var interaction_log=require(_0xc4d1('0x11'))(_0xc4d1('0x58'));exports[_0xc4d1('0x7c')]=function(_0x2bef6f,_0x154180,_0x128745){var _0x4d39e3={'agent':{},'channel':'chat'};if(_0x2bef6f['body']['id']){delete _0x2bef6f[_0xc4d1('0x56')]['id'];}_0x2bef6f[_0xc4d1('0x56')][_0xc4d1('0x5f')]=_0x2bef6f['body'][_0xc4d1('0x5f')]||_0x2bef6f[_0xc4d1('0x60')]['id'];_0x4d39e3[_0xc4d1('0x61')]['id']=_0x2bef6f[_0xc4d1('0x56')][_0xc4d1('0x5f')];return db['ChatMessage']['find']({'where':{'id':_0x2bef6f[_0xc4d1('0x53')]['id'],'UserId':null}})[_0xc4d1('0x34')](handleEntityNotFound(_0x154180,null))['then'](function(_0x553a86){if(_0x553a86){_0x4d39e3['message']=_0x553a86[_0xc4d1('0x62')]({'plain':!![]});return db[_0xc4d1('0x7d')][_0xc4d1('0x54')]({'where':{'id':_0x553a86[_0xc4d1('0x63')]}});}return null;})[_0xc4d1('0x34')](handleEntityNotFound(_0x154180,null))['then'](function(_0x4ef974){if(_0x4ef974){_0x4d39e3[_0xc4d1('0x65')]=_0x4ef974['get']({'plain':!![]});interaction_log[_0xc4d1('0x66')]('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2bef6f[_0xc4d1('0x60')]['id'],_0x2bef6f[_0xc4d1('0x60')][_0xc4d1('0x36')],_0x2bef6f[_0xc4d1('0x60')][_0xc4d1('0x67')],_0x4d39e3[_0xc4d1('0x65')]['id'],_0x2bef6f[_0xc4d1('0x56')]?JSON[_0xc4d1('0x23')](_0x2bef6f[_0xc4d1('0x56')]):_0xc4d1('0x68'));return respondWithRpcPromise(_0xc4d1('0x7e'),'rejectMessage',_0x4d39e3);}return null;})[_0xc4d1('0x34')](function(_0x3bc7f1){var _0x4dac22='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x3bc7f1[_0xc4d1('0x26')][_0xc4d1('0x7f')];return db['sequelize'][_0xc4d1('0x3e')](_0x4dac22,{'type':db[_0xc4d1('0x6c')][_0xc4d1('0x6d')]['SELECT'],'raw':!![]})['then'](function(_0x514f92){return _0x514f92;});})[_0xc4d1('0x34')](function(_0x1e3529){if(_0x1e3529){_0x4d39e3[_0xc4d1('0x26')]['contact']=_0x1e3529[0x0];if(!_0x2bef6f[_0xc4d1('0x56')][_0xc4d1('0x5f')])return;return db[_0xc4d1('0x70')]['find']({'where':{'id':_0x2bef6f[_0xc4d1('0x56')][_0xc4d1('0x5f')],'role':'agent'},'attributes':['id',_0xc4d1('0x36'),'fullname','email',_0xc4d1('0x73')],'raw':!![]});}return null;})[_0xc4d1('0x34')](function(_0x209880){if(!_0x209880)return null;_0x4d39e3[_0xc4d1('0x26')][_0xc4d1('0x61')]=_0x209880;return _0x4d39e3;})['then'](function(_0x2f87a3){if(_0x2f87a3){_0x2f87a3['message'][_0xc4d1('0x75')]=util['format'](_0xc4d1('0x80'),_0x2bef6f['user'][_0xc4d1('0x36')]);_0x2f87a3['message'][_0xc4d1('0x76')]=_0x4d39e3[_0xc4d1('0x76')];_0x2f87a3['message'][_0xc4d1('0x77')]=_0x4d39e3[_0xc4d1('0x76')];_0x2f87a3[_0xc4d1('0x26')][_0xc4d1('0x81')]=_0xc4d1('0x7c');respondWithRpcPromise(_0xc4d1('0x78'),_0xc4d1('0x78'),{'event':'rejectmessage','message':_['merge'](_0x4d39e3[_0xc4d1('0x26')],JSON[_0xc4d1('0x7a')](_0x4d39e3['interaction'][_0xc4d1('0x7b')]))},client9002);return _0x4d39e3;}return null;})[_0xc4d1('0x34')](respondWithResult(_0x154180,null))[_0xc4d1('0x51')](handleError(_0x154180,null));}; \ No newline at end of file +var _0xae0d=['order','sort','merge','where','VIRTUAL','filter','ChatMessage','findAll','rows','catch','show','keys','rawAttributes','length','includeAll','include','find','create','body','params','describe','chat-interactions','accept','chat','read','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','ChatInteraction','ChatInteractionId','read1stAt','format','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','ContactId','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','interaction','formData','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','interface','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','jayson/promise','client','http','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit'];(function(_0x385472,_0x194f20){var _0x2dc2f0=function(_0x5580ca){while(--_0x5580ca){_0x385472['push'](_0x385472['shift']());}};_0x2dc2f0(++_0x194f20);}(_0xae0d,0x14e));var _0xdae0=function(_0x4f3f68,_0x2a4010){_0x4f3f68=_0x4f3f68-0x0;var _0x141010=_0xae0d[_0x4f3f68];return _0x141010;};'use strict';var emlformat=require(_0xdae0('0x0'));var rimraf=require(_0xdae0('0x1'));var zipdir=require(_0xdae0('0x2'));var jsonpatch=require(_0xdae0('0x3'));var rp=require('request-promise');var moment=require(_0xdae0('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xdae0('0x5'));var util=require(_0xdae0('0x6'));var path=require(_0xdae0('0x7'));var sox=require('sox');var csv=require(_0xdae0('0x8'));var ejs=require(_0xdae0('0x9'));var fs=require('fs');var fs_extra=require(_0xdae0('0xa'));var _=require(_0xdae0('0xb'));var squel=require('squel');var crypto=require(_0xdae0('0xc'));var jsforce=require(_0xdae0('0xd'));var deskjs=require(_0xdae0('0xe'));var toCsv=require(_0xdae0('0x8'));var querystring=require('querystring');var Papa=require(_0xdae0('0xf'));var Redis=require(_0xdae0('0x10'));var authService=require(_0xdae0('0x11'));var qs=require(_0xdae0('0x12'));var as=require(_0xdae0('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdae0('0x14'))(_0xdae0('0x15'));var utils=require('../../config/utils');var config=require(_0xdae0('0x16'));var licenseUtil=require(_0xdae0('0x17'));var db=require(_0xdae0('0x18'))['db'];config[_0xdae0('0x19')]=_['defaults'](config[_0xdae0('0x19')],{'host':_0xdae0('0x1a'),'port':0x18eb});var socket=require(_0xdae0('0x1b'))(new Redis(config['redis']));require('./chatMessage.socket')[_0xdae0('0x1c')](socket);var jayson=require(_0xdae0('0x1d'));var client=jayson[_0xdae0('0x1e')][_0xdae0('0x1f')]({'port':0x232c});var client9002=jayson[_0xdae0('0x1e')][_0xdae0('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x4d7bce,_0x42c54c,_0x7f388a,_0x3db4c1){return new BPromise(function(_0xc43acb,_0x1983fc){var _0x22bccf=_0x3db4c1||client;return _0x22bccf['request'](_0x4d7bce,_0x7f388a)[_0xdae0('0x20')](function(_0x4c4637){logger[_0xdae0('0x21')](_0xdae0('0x22'),_0x42c54c,_0xdae0('0x23'));logger['debug'](_0xdae0('0x24'),_0x42c54c,'request\x20sent',JSON[_0xdae0('0x25')](_0x4c4637));if(_0x4c4637['error']){if(_0x4c4637['error']['code']===0x1f4){logger['error']('ChatMessage,\x20%s,\x20%s',_0x42c54c,_0x4c4637[_0xdae0('0x26')]['message']);return _0x1983fc(_0x4c4637['error'][_0xdae0('0x27')]);}logger[_0xdae0('0x26')]('ChatMessage,\x20%s,\x20%s',_0x42c54c,_0x4c4637[_0xdae0('0x26')][_0xdae0('0x27')]);return _0xc43acb(_0x4c4637[_0xdae0('0x26')][_0xdae0('0x27')]);}else{logger['info'](_0xdae0('0x22'),_0x42c54c,_0xdae0('0x23'));_0xc43acb(_0x4c4637[_0xdae0('0x28')][_0xdae0('0x27')]);}})['catch'](function(_0x163605){logger[_0xdae0('0x26')]('ChatMessage,\x20%s,\x20%s',_0x42c54c,_0x163605);_0x1983fc(_0x163605);});});}function respondWithStatusCode(_0x4ae881,_0x2a81fd){_0x2a81fd=_0x2a81fd||0xcc;return function(_0x3f718e){if(_0x3f718e){return _0x4ae881[_0xdae0('0x29')](_0x2a81fd);}return _0x4ae881[_0xdae0('0x2a')](_0x2a81fd)[_0xdae0('0x2b')]();};}function respondWithResult(_0x1c404c,_0x6f49de){_0x6f49de=_0x6f49de||0xc8;return function(_0x9c0df7){if(_0x9c0df7){return _0x1c404c['status'](_0x6f49de)[_0xdae0('0x2c')](_0x9c0df7);}};}function respondWithFilteredResult(_0xd55123,_0x233b04){return function(_0xebd483){if(_0xebd483){var _0x49f72b=typeof _0x233b04[_0xdae0('0x2d')]==='undefined'&&typeof _0x233b04[_0xdae0('0x2e')]===_0xdae0('0x2f');var _0x4ff905=_0xebd483['count'];var _0x3f7188=_0x49f72b?0x0:_0x233b04['offset'];var _0x4174ba=_0x49f72b?_0xebd483[_0xdae0('0x30')]:_0x233b04[_0xdae0('0x2d')]+_0x233b04['limit'];var _0x1a2e9a;if(_0x4174ba>=_0x4ff905){_0x4174ba=_0x4ff905;_0x1a2e9a=0xc8;}else{_0x1a2e9a=0xce;}_0xd55123[_0xdae0('0x2a')](_0x1a2e9a);return _0xd55123['set'](_0xdae0('0x31'),_0x3f7188+'-'+_0x4174ba+'/'+_0x4ff905)[_0xdae0('0x2c')](_0xebd483);}return null;};}function patchUpdates(_0x116921){return function(_0x5ac294){try{jsonpatch[_0xdae0('0x32')](_0x5ac294,_0x116921,!![]);}catch(_0x1101e7){return BPromise[_0xdae0('0x33')](_0x1101e7);}return _0x5ac294[_0xdae0('0x34')]();};}function saveUpdates(_0x29089e,_0x1db575){return function(_0x4308df){if(_0x4308df){return _0x4308df[_0xdae0('0x35')](_0x29089e)['then'](function(_0x2b4a18){return _0x2b4a18;});}return null;};}function removeEntity(_0x5b9600,_0x321818){return function(_0x1ba6b0){if(_0x1ba6b0){return _0x1ba6b0[_0xdae0('0x36')]()['then'](function(){_0x5b9600['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c26f0,_0x477ae7){return function(_0x5067ba){if(!_0x5067ba){_0x1c26f0[_0xdae0('0x29')](0x194);}return _0x5067ba;};}function handleError(_0x46d113,_0x166d60){_0x166d60=_0x166d60||0x1f4;return function(_0x4b2b33){logger['error'](_0x4b2b33[_0xdae0('0x37')]);if(_0x4b2b33[_0xdae0('0x38')]){delete _0x4b2b33[_0xdae0('0x38')];}_0x46d113[_0xdae0('0x2a')](_0x166d60)[_0xdae0('0x39')](_0x4b2b33);};}exports[_0xdae0('0x3a')]=function(_0x542900,_0x896cc4){var _0x2e8a27={},_0x5c876f={},_0x21c502={'count':0x0,'rows':[]};var _0x2c159f=_[_0xdae0('0x3b')](db['ChatMessage']['rawAttributes'],function(_0x2ecf0e){return{'name':_0x2ecf0e[_0xdae0('0x3c')],'type':_0x2ecf0e[_0xdae0('0x3d')][_0xdae0('0x3e')]};});_0x5c876f[_0xdae0('0x3f')]=_[_0xdae0('0x3b')](_0x2c159f,_0xdae0('0x38'));_0x5c876f[_0xdae0('0x40')]=_['keys'](_0x542900['query']);_0x5c876f[_0xdae0('0x41')]=_[_0xdae0('0x42')](_0x5c876f[_0xdae0('0x3f')],_0x5c876f[_0xdae0('0x40')]);_0x2e8a27['attributes']=_[_0xdae0('0x42')](_0x5c876f[_0xdae0('0x3f')],qs[_0xdae0('0x43')](_0x542900['query'][_0xdae0('0x43')]));_0x2e8a27[_0xdae0('0x44')]=_0x2e8a27[_0xdae0('0x44')]['length']?_0x2e8a27[_0xdae0('0x44')]:_0x5c876f[_0xdae0('0x3f')];if(!_0x542900[_0xdae0('0x40')][_0xdae0('0x45')](_0xdae0('0x46'))){_0x2e8a27['limit']=qs[_0xdae0('0x2e')](_0x542900[_0xdae0('0x40')]['limit']);_0x2e8a27[_0xdae0('0x2d')]=qs[_0xdae0('0x2d')](_0x542900['query'][_0xdae0('0x2d')]);}_0x2e8a27[_0xdae0('0x47')]=qs['sort'](_0x542900[_0xdae0('0x40')][_0xdae0('0x48')]);_0x2e8a27['where']=qs[_0xdae0('0x41')](_['pick'](_0x542900[_0xdae0('0x40')],_0x5c876f[_0xdae0('0x41')]),_0x2c159f);if(_0x542900[_0xdae0('0x40')]['filter']){_0x2e8a27['where']=_[_0xdae0('0x49')](_0x2e8a27[_0xdae0('0x4a')],{'$or':_['map'](_0x2c159f,function(_0x903bab){if(_0x903bab[_0xdae0('0x3d')]!==_0xdae0('0x4b')){var _0x36d81d={};_0x36d81d[_0x903bab[_0xdae0('0x38')]]={'$like':'%'+_0x542900[_0xdae0('0x40')][_0xdae0('0x4c')]+'%'};return _0x36d81d;}})});}_0x2e8a27=_[_0xdae0('0x49')]({},_0x2e8a27,_0x542900['options']);var _0x4081d6={'where':_0x2e8a27[_0xdae0('0x4a')]};return db[_0xdae0('0x4d')][_0xdae0('0x30')](_0x4081d6)[_0xdae0('0x20')](function(_0x530392){_0x21c502[_0xdae0('0x30')]=_0x530392;if(_0x542900['query']['includeAll']){_0x2e8a27['include']=[{'all':!![]}];}return db[_0xdae0('0x4d')][_0xdae0('0x4e')](_0x2e8a27);})[_0xdae0('0x20')](function(_0x2589f4){_0x21c502[_0xdae0('0x4f')]=_0x2589f4;return _0x21c502;})[_0xdae0('0x20')](respondWithFilteredResult(_0x896cc4,_0x2e8a27))[_0xdae0('0x50')](handleError(_0x896cc4,null));};exports[_0xdae0('0x51')]=function(_0x29b981,_0x33ee45){var _0x37624f={'raw':!![],'where':{'id':_0x29b981['params']['id']}},_0x173d6c={};_0x173d6c[_0xdae0('0x3f')]=_[_0xdae0('0x52')](db[_0xdae0('0x4d')][_0xdae0('0x53')]);_0x173d6c[_0xdae0('0x40')]=_[_0xdae0('0x52')](_0x29b981[_0xdae0('0x40')]);_0x173d6c[_0xdae0('0x41')]=_[_0xdae0('0x42')](_0x173d6c[_0xdae0('0x3f')],_0x173d6c[_0xdae0('0x40')]);_0x37624f[_0xdae0('0x44')]=_[_0xdae0('0x42')](_0x173d6c[_0xdae0('0x3f')],qs[_0xdae0('0x43')](_0x29b981[_0xdae0('0x40')][_0xdae0('0x43')]));_0x37624f[_0xdae0('0x44')]=_0x37624f[_0xdae0('0x44')][_0xdae0('0x54')]?_0x37624f[_0xdae0('0x44')]:_0x173d6c[_0xdae0('0x3f')];if(_0x29b981['query'][_0xdae0('0x55')]){_0x37624f[_0xdae0('0x56')]=[{'all':!![]}];}_0x37624f=_[_0xdae0('0x49')]({},_0x37624f,_0x29b981['options']);return db['ChatMessage'][_0xdae0('0x57')](_0x37624f)[_0xdae0('0x20')](handleEntityNotFound(_0x33ee45,null))[_0xdae0('0x20')](respondWithResult(_0x33ee45,null))[_0xdae0('0x50')](handleError(_0x33ee45,null));};exports[_0xdae0('0x58')]=function(_0x36f46e,_0x50375e){return db[_0xdae0('0x4d')][_0xdae0('0x58')](_0x36f46e[_0xdae0('0x59')],{})[_0xdae0('0x20')](respondWithResult(_0x50375e,0xc9))[_0xdae0('0x50')](handleError(_0x50375e,null));};exports[_0xdae0('0x35')]=function(_0x108b11,_0x16fc7c){if(_0x108b11[_0xdae0('0x59')]['id']){delete _0x108b11[_0xdae0('0x59')]['id'];}return db[_0xdae0('0x4d')][_0xdae0('0x57')]({'where':{'id':_0x108b11[_0xdae0('0x5a')]['id']}})[_0xdae0('0x20')](handleEntityNotFound(_0x16fc7c,null))[_0xdae0('0x20')](saveUpdates(_0x108b11[_0xdae0('0x59')],null))[_0xdae0('0x20')](respondWithResult(_0x16fc7c,null))[_0xdae0('0x50')](handleError(_0x16fc7c,null));};exports[_0xdae0('0x36')]=function(_0x295f91,_0x2370b1){return db[_0xdae0('0x4d')][_0xdae0('0x57')]({'where':{'id':_0x295f91[_0xdae0('0x5a')]['id']}})['then'](handleEntityNotFound(_0x2370b1,null))['then'](removeEntity(_0x2370b1,null))[_0xdae0('0x50')](handleError(_0x2370b1,null));};exports[_0xdae0('0x5b')]=function(_0x24eee7,_0x86dd92){return db[_0xdae0('0x4d')]['describe']()[_0xdae0('0x20')](respondWithResult(_0x86dd92,null))[_0xdae0('0x50')](handleError(_0x86dd92,null));};var interaction_log=require(_0xdae0('0x14'))(_0xdae0('0x5c'));exports[_0xdae0('0x5d')]=function(_0x2204de,_0x2b303b,_0x61d75b){var _0x4d76e7={'agent':{},'channel':_0xdae0('0x5e')};if(_0x2204de[_0xdae0('0x59')]['id']){delete _0x2204de[_0xdae0('0x59')]['id'];}_0x2204de[_0xdae0('0x59')][_0xdae0('0x5f')]=!![];_0x2204de['body']['readAt']=moment()['format'](_0xdae0('0x60'));_0x2204de[_0xdae0('0x59')][_0xdae0('0x61')]=_0x2204de[_0xdae0('0x59')][_0xdae0('0x61')]||_0x2204de[_0xdae0('0x62')]['id'];_0x4d76e7[_0xdae0('0x63')]['id']=_0x2204de[_0xdae0('0x59')]['UserId'];return db[_0xdae0('0x4d')]['find']({'where':{'id':_0x2204de['params']['id'],'UserId':null}})[_0xdae0('0x20')](handleEntityNotFound(_0x2b303b,null))['then'](saveUpdates(_0x2204de[_0xdae0('0x59')],null))[_0xdae0('0x20')](function(_0x310189){if(_0x310189){_0x4d76e7['message']=_0x310189[_0xdae0('0x64')]({'plain':!![]});return db[_0xdae0('0x65')][_0xdae0('0x57')]({'where':{'id':_0x310189[_0xdae0('0x66')]}});}return null;})['then'](handleEntityNotFound(_0x2b303b,null))[_0xdae0('0x20')](function(_0x5add62){if(_0x5add62){return _0x5add62[_0xdae0('0x35')]({'UserId':_0x2204de[_0xdae0('0x59')][_0xdae0('0x61')],'read1stAt':_['isNil'](_0x5add62[_0xdae0('0x67')])?moment()[_0xdae0('0x68')](_0xdae0('0x60')):undefined});}return null;})['then'](function(_0x1eff88){if(_0x1eff88){_0x4d76e7['interaction']=_0x1eff88[_0xdae0('0x64')]({'plain':!![]});interaction_log[_0xdae0('0x21')](_0xdae0('0x69'),_0x2204de[_0xdae0('0x62')]['id'],_0x2204de[_0xdae0('0x62')]['name'],_0x2204de[_0xdae0('0x62')][_0xdae0('0x6a')],_0x4d76e7['interaction']['id'],_0x2204de[_0xdae0('0x59')]?JSON['stringify'](_0x2204de[_0xdae0('0x59')]):_0xdae0('0x6b'));return respondWithRpcPromise(_0xdae0('0x6c'),_0xdae0('0x6d'),_0x4d76e7);}return null;})[_0xdae0('0x20')](function(_0x179e2a){var _0x136e1e='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x179e2a[_0xdae0('0x27')][_0xdae0('0x6e')];return db['sequelize'][_0xdae0('0x40')](_0x136e1e,{'type':db[_0xdae0('0x6f')][_0xdae0('0x70')][_0xdae0('0x71')],'raw':!![]})[_0xdae0('0x20')](function(_0x44b4ba){return _0x44b4ba;});})['then'](function(_0x679c9){if(_0x679c9){_0x4d76e7[_0xdae0('0x27')][_0xdae0('0x72')]=_0x679c9[0x0];if(!_0x2204de['body'][_0xdae0('0x61')])return;return db[_0xdae0('0x73')][_0xdae0('0x57')]({'where':{'id':_0x2204de['body'][_0xdae0('0x61')],'role':'agent'},'attributes':['id',_0xdae0('0x38'),_0xdae0('0x74'),_0xdae0('0x75'),_0xdae0('0x76')],'raw':!![]});}return null;})[_0xdae0('0x20')](function(_0x3015ae){if(!_0x3015ae)return null;_0x4d76e7['message']['agent']=_0x3015ae;return _0x4d76e7;})[_0xdae0('0x20')](function(_0x39dc44){if(_0x39dc44){if(_0x2204de['body'][_0xdae0('0x77')]){_0x4d76e7['message']['interface']=util[_0xdae0('0x68')](_0xdae0('0x78'),_0x2204de[_0xdae0('0x62')][_0xdae0('0x38')]);_0x4d76e7[_0xdae0('0x27')]['channel']=_0x4d76e7[_0xdae0('0x79')];_0x4d76e7[_0xdae0('0x27')][_0xdae0('0x7a')]=_0x4d76e7['channel'];_0x4d76e7[_0xdae0('0x27')][_0xdae0('0x7b')]=_0xdae0('0x5d');return respondWithRpcPromise(_0xdae0('0x7c'),_0xdae0('0x7c'),{'event':_0xdae0('0x7d'),'message':_['merge'](_0x4d76e7[_0xdae0('0x27')],JSON['parse'](_0x4d76e7[_0xdae0('0x7e')][_0xdae0('0x7f')]))},client9002)[_0xdae0('0x20')](function(){return _0x4d76e7;});}return _0x4d76e7;}return null;})[_0xdae0('0x20')](respondWithResult(_0x2b303b,null))[_0xdae0('0x50')](handleError(_0x2b303b,null));};var interaction_log=require(_0xdae0('0x14'))(_0xdae0('0x5c'));exports[_0xdae0('0x33')]=function(_0x346503,_0x364ff0,_0x15859b){var _0x1a171d={'agent':{},'channel':_0xdae0('0x5e')};if(_0x346503[_0xdae0('0x59')]['id']){delete _0x346503['body']['id'];}_0x346503[_0xdae0('0x59')][_0xdae0('0x61')]=_0x346503[_0xdae0('0x59')][_0xdae0('0x61')]||_0x346503[_0xdae0('0x62')]['id'];_0x1a171d[_0xdae0('0x63')]['id']=_0x346503[_0xdae0('0x59')][_0xdae0('0x61')];return db[_0xdae0('0x4d')][_0xdae0('0x57')]({'where':{'id':_0x346503['params']['id'],'UserId':null}})[_0xdae0('0x20')](handleEntityNotFound(_0x364ff0,null))[_0xdae0('0x20')](function(_0x431244){if(_0x431244){_0x1a171d[_0xdae0('0x27')]=_0x431244[_0xdae0('0x64')]({'plain':!![]});return db['ChatInteraction'][_0xdae0('0x57')]({'where':{'id':_0x431244['ChatInteractionId']}});}return null;})[_0xdae0('0x20')](handleEntityNotFound(_0x364ff0,null))[_0xdae0('0x20')](function(_0x134a71){if(_0x134a71){_0x1a171d[_0xdae0('0x7e')]=_0x134a71[_0xdae0('0x64')]({'plain':!![]});interaction_log[_0xdae0('0x21')](_0xdae0('0x80'),_0x346503[_0xdae0('0x62')]['id'],_0x346503[_0xdae0('0x62')][_0xdae0('0x38')],_0x346503[_0xdae0('0x62')][_0xdae0('0x6a')],_0x1a171d[_0xdae0('0x7e')]['id'],_0x346503[_0xdae0('0x59')]?JSON['stringify'](_0x346503[_0xdae0('0x59')]):_0xdae0('0x6b'));return respondWithRpcPromise(_0xdae0('0x81'),_0xdae0('0x82'),_0x1a171d);}return null;})['then'](function(_0x2bd4bd){var _0x2e7854=_0xdae0('0x83')+_0x2bd4bd['message']['ContactId'];return db[_0xdae0('0x84')][_0xdae0('0x40')](_0x2e7854,{'type':db['Sequelize'][_0xdae0('0x70')][_0xdae0('0x71')],'raw':!![]})[_0xdae0('0x20')](function(_0x2ec906){return _0x2ec906;});})[_0xdae0('0x20')](function(_0x5718ca){if(_0x5718ca){_0x1a171d[_0xdae0('0x27')][_0xdae0('0x72')]=_0x5718ca[0x0];if(!_0x346503[_0xdae0('0x59')][_0xdae0('0x61')])return;return db[_0xdae0('0x73')][_0xdae0('0x57')]({'where':{'id':_0x346503['body']['UserId'],'role':_0xdae0('0x63')},'attributes':['id',_0xdae0('0x38'),_0xdae0('0x74'),_0xdae0('0x75'),_0xdae0('0x76')],'raw':!![]});}return null;})[_0xdae0('0x20')](function(_0x4936ae){if(!_0x4936ae)return null;_0x1a171d[_0xdae0('0x27')][_0xdae0('0x63')]=_0x4936ae;return _0x1a171d;})[_0xdae0('0x20')](function(_0x173bdf){if(_0x173bdf){_0x173bdf['message'][_0xdae0('0x85')]=util[_0xdae0('0x68')](_0xdae0('0x78'),_0x346503['user']['name']);_0x173bdf[_0xdae0('0x27')][_0xdae0('0x79')]=_0x1a171d['channel'];_0x173bdf[_0xdae0('0x27')][_0xdae0('0x7a')]=_0x1a171d[_0xdae0('0x79')];_0x173bdf[_0xdae0('0x27')][_0xdae0('0x7b')]=_0xdae0('0x33');respondWithRpcPromise(_0xdae0('0x7c'),'EventManager',{'event':_0xdae0('0x86'),'message':_[_0xdae0('0x49')](_0x1a171d['message'],JSON['parse'](_0x1a171d[_0xdae0('0x7e')]['formData']))},client9002);return _0x1a171d;}return null;})[_0xdae0('0x20')](respondWithResult(_0x364ff0,null))[_0xdae0('0x50')](handleError(_0x364ff0,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 824649a..3d0d259 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 _0xb828=['events','ChatMessage','setMaxListeners','update','emit','hasOwnProperty','hook'];(function(_0x1b33bc,_0x282af6){var _0x23b81c=function(_0x67994a){while(--_0x67994a){_0x1b33bc['push'](_0x1b33bc['shift']());}};_0x23b81c(++_0x282af6);}(_0xb828,0xfc));var _0x8b82=function(_0x38af48,_0x400460){_0x38af48=_0x38af48-0x0;var _0x445384=_0xb828[_0x38af48];return _0x445384;};'use strict';var EventEmitter=require(_0x8b82('0x0'));var ChatMessage=require('../../mysqldb')['db'][_0x8b82('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x8b82('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8b82('0x3'),'afterDestroy':'remove'};function emitEvent(_0x16022e){return function(_0x905780,_0x509612,_0xf09c66){ChatMessageEvents[_0x8b82('0x4')](_0x16022e+':'+_0x905780['id'],_0x905780);ChatMessageEvents[_0x8b82('0x4')](_0x16022e,_0x905780);_0xf09c66(null);};}for(var e in events){if(events[_0x8b82('0x5')](e)){var event=events[e];ChatMessage[_0x8b82('0x6')](e,emitEvent(event));}}module['exports']=ChatMessageEvents; \ No newline at end of file +var _0xda9b=['save','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','ChatMessage','setMaxListeners'];(function(_0x3b134c,_0x15d0d0){var _0x7def28=function(_0x208b6c){while(--_0x208b6c){_0x3b134c['push'](_0x3b134c['shift']());}};_0x7def28(++_0x15d0d0);}(_0xda9b,0x7e));var _0xbda9=function(_0x38df46,_0x477780){_0x38df46=_0x38df46-0x0;var _0x47dace=_0xda9b[_0x38df46];return _0x47dace;};'use strict';var EventEmitter=require(_0xbda9('0x0'));var ChatMessage=require(_0xbda9('0x1'))['db'][_0xbda9('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xbda9('0x3')](0x0);var events={'afterCreate':_0xbda9('0x4'),'afterUpdate':_0xbda9('0x5'),'afterDestroy':_0xbda9('0x6')};function emitEvent(_0x5a4a28){return function(_0x34d820,_0x518aed,_0xc1e14e){ChatMessageEvents[_0xbda9('0x7')](_0x5a4a28+':'+_0x34d820['id'],_0x34d820);ChatMessageEvents[_0xbda9('0x7')](_0x5a4a28,_0x34d820);_0xc1e14e(null);};}for(var e in events){if(events[_0xbda9('0x8')](e)){var event=events[e];ChatMessage['hook'](e,emitEvent(event));}}module[_0xbda9('0x9')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index 2a0b5b2..4261453 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 _0xc52f=['ChatInteractionId','then','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','bluebird','request-promise','path','./chatMessage.attributes','exports','define','ChatMessage','chat_messages','fti_chat_messages','body','FULLTEXT','models','direction','toLowerCase','out','secret','isNil','UserId','findOne'];(function(_0x3c7000,_0x43db6e){var _0x8f22f1=function(_0x240bd0){while(--_0x240bd0){_0x3c7000['push'](_0x3c7000['shift']());}};_0x8f22f1(++_0x43db6e);}(_0xc52f,0x1e3));var _0xfc52=function(_0x121bb9,_0x3d8455){_0x121bb9=_0x121bb9-0x0;var _0x443350=_0xc52f[_0x121bb9];return _0x443350;};'use strict';var _=require(_0xfc52('0x0'));var util=require(_0xfc52('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xfc52('0x2'));var rp=require(_0xfc52('0x3'));var fs=require('fs');var path=require(_0xfc52('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xfc52('0x5'));module[_0xfc52('0x6')]=function(_0x29636f,_0x5cb478){return _0x29636f[_0xfc52('0x7')](_0xfc52('0x8'),attributes,{'tableName':_0xfc52('0x9'),'paranoid':![],'indexes':[{'name':_0xfc52('0xa'),'fields':[_0xfc52('0xb')],'type':_0xfc52('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x30a878,_0x286ca3,_0x3f5b8e){var _0x15001a=_0x29636f[_0xfc52('0xd')];var _0x16aa7a=_0x30a878['get']({'plain':!![]});if(_0x16aa7a[_0xfc52('0xe')]['toLowerCase']()==='in'||_0x16aa7a[_0xfc52('0xe')][_0xfc52('0xf')]()===_0xfc52('0x10')&&!_0x16aa7a[_0xfc52('0x11')]&&!_[_0xfc52('0x12')](_0x16aa7a[_0xfc52('0x13')])){_0x15001a['ChatInteraction'][_0xfc52('0x14')]({'where':{'id':_0x16aa7a[_0xfc52('0x15')]}})[_0xfc52('0x16')](function(_0x24cf4f){if(_0x24cf4f){_0x24cf4f['update']({'lastMsgAt':_0x16aa7a[_0xfc52('0x17')],'lastMsgDirection':_0x16aa7a[_0xfc52('0xe')][_0xfc52('0xf')]()});}})[_0xfc52('0x18')](function(_0x30c8f3){console[_0xfc52('0x19')](_0x30c8f3);});}_0x3f5b8e();}},'charset':_0xfc52('0x1a'),'collate':_0xfc52('0x1b')});}; \ No newline at end of file +var _0xfc7b=['moment','path','../../config/environment','./chatMessage.attributes','exports','define','ChatMessage','chat_messages','fti_chat_messages','body','FULLTEXT','get','direction','out','secret','isNil','UserId','ChatInteraction','ChatInteractionId','then','update','createdAt','catch','error','utf8mb4','lodash','util','api'];(function(_0x3fbdde,_0x2b5a7a){var _0x10bf7b=function(_0x4ef0aa){while(--_0x4ef0aa){_0x3fbdde['push'](_0x3fbdde['shift']());}};_0x10bf7b(++_0x2b5a7a);}(_0xfc7b,0xc1));var _0xbfc7=function(_0xc4a89a,_0x322f6a){_0xc4a89a=_0xc4a89a-0x0;var _0x13f7bc=_0xfc7b[_0xc4a89a];return _0x13f7bc;};'use strict';var _=require(_0xbfc7('0x0'));var util=require(_0xbfc7('0x1'));var logger=require('../../config/logger')(_0xbfc7('0x2'));var moment=require(_0xbfc7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xbfc7('0x4'));var rimraf=require('rimraf');var config=require(_0xbfc7('0x5'));var attributes=require(_0xbfc7('0x6'));module[_0xbfc7('0x7')]=function(_0x56b76b,_0x243a2f){return _0x56b76b[_0xbfc7('0x8')](_0xbfc7('0x9'),attributes,{'tableName':_0xbfc7('0xa'),'paranoid':![],'indexes':[{'name':_0xbfc7('0xb'),'fields':[_0xbfc7('0xc')],'type':_0xbfc7('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x597b35,_0x15857e,_0x296553){var _0x4afdaf=_0x56b76b['models'];var _0x1dc9a4=_0x597b35[_0xbfc7('0xe')]({'plain':!![]});if(_0x1dc9a4['direction']['toLowerCase']()==='in'||_0x1dc9a4[_0xbfc7('0xf')]['toLowerCase']()===_0xbfc7('0x10')&&!_0x1dc9a4[_0xbfc7('0x11')]&&!_[_0xbfc7('0x12')](_0x1dc9a4[_0xbfc7('0x13')])){_0x4afdaf[_0xbfc7('0x14')]['findOne']({'where':{'id':_0x1dc9a4[_0xbfc7('0x15')]}})[_0xbfc7('0x16')](function(_0x1d566b){if(_0x1d566b){_0x1d566b[_0xbfc7('0x17')]({'lastMsgAt':_0x1dc9a4[_0xbfc7('0x18')],'lastMsgDirection':_0x1dc9a4[_0xbfc7('0xf')]['toLowerCase']()});}})[_0xbfc7('0x19')](function(_0x5b5c62){console[_0xbfc7('0x1a')](_0x5b5c62);});}_0x296553();}},'charset':_0xbfc7('0x1b'),'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 b270c6e..e9b1653 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 _0xff1c=['rpc','../../config/environment','jayson/promise','client','http','defaults','socket.io-emitter','redis','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','CreateChatMessage','ChatMessage','create','options','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x2a4a99,_0x64b4a){var _0x1cef2f=function(_0x43beef){while(--_0x43beef){_0x2a4a99['push'](_0x2a4a99['shift']());}};_0x1cef2f(++_0x64b4a);}(_0xff1c,0xdf));var _0xcff1=function(_0x4bd35b,_0x19525b){_0x4bd35b=_0x4bd35b-0x0;var _0x2d498b=_0xff1c[_0x4bd35b];return _0x2d498b;};'use strict';var _=require(_0xcff1('0x0'));var util=require('util');var moment=require(_0xcff1('0x1'));var BPromise=require(_0xcff1('0x2'));var rs=require(_0xcff1('0x3'));var fs=require('fs');var Redis=require(_0xcff1('0x4'));var db=require(_0xcff1('0x5'))['db'];var utils=require(_0xcff1('0x6'));var logger=require(_0xcff1('0x7'))(_0xcff1('0x8'));var config=require(_0xcff1('0x9'));var jayson=require(_0xcff1('0xa'));var client=jayson[_0xcff1('0xb')][_0xcff1('0xc')]({'port':0x232a});config['redis']=_[_0xcff1('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xcff1('0xe'))(new Redis(config[_0xcff1('0xf')]));require('./chatMessage.socket')['register'](socket);function respondWithRpcPromise(_0x192f5a,_0xbf6dcc,_0x72e082){return new BPromise(function(_0x4a4d26,_0x532f99){return client[_0xcff1('0x10')](_0x192f5a,_0x72e082)[_0xcff1('0x11')](function(_0x3bf230){logger[_0xcff1('0x12')](_0xcff1('0x13'),_0xbf6dcc,_0xcff1('0x14'));logger[_0xcff1('0x15')](_0xcff1('0x16'),_0xbf6dcc,_0xcff1('0x14'),JSON[_0xcff1('0x17')](_0x3bf230));if(_0x3bf230['error']){if(_0x3bf230['error'][_0xcff1('0x18')]===0x1f4){logger[_0xcff1('0x19')]('ChatMessage,\x20%s,\x20%s',_0xbf6dcc,_0x3bf230[_0xcff1('0x19')][_0xcff1('0x1a')]);return _0x532f99(_0x3bf230[_0xcff1('0x19')]['message']);}logger[_0xcff1('0x19')](_0xcff1('0x13'),_0xbf6dcc,_0x3bf230[_0xcff1('0x19')][_0xcff1('0x1a')]);return _0x4a4d26(_0x3bf230[_0xcff1('0x19')][_0xcff1('0x1a')]);}else{logger[_0xcff1('0x12')](_0xcff1('0x13'),_0xbf6dcc,_0xcff1('0x14'));_0x4a4d26(_0x3bf230[_0xcff1('0x1b')][_0xcff1('0x1a')]);}})[_0xcff1('0x1c')](function(_0x4ac8c8){logger[_0xcff1('0x19')]('ChatMessage,\x20%s,\x20%s',_0xbf6dcc,_0x4ac8c8);_0x532f99(_0x4ac8c8);});});}exports[_0xcff1('0x1d')]=function(_0x140f31){var _0x419995=this;return new Promise(function(_0x57e128,_0x33e8e5){return db[_0xcff1('0x1e')][_0xcff1('0x1f')](_0x140f31['body'],{'raw':_0x140f31[_0xcff1('0x20')]?_0x140f31['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x568ee5){logger[_0xcff1('0x12')]('CreateChatMessage',_0x140f31);logger[_0xcff1('0x15')](_0xcff1('0x1d'),_0x140f31,JSON[_0xcff1('0x17')](_0x568ee5));_0x57e128(_0x568ee5);})[_0xcff1('0x1c')](function(_0x15cca6){logger[_0xcff1('0x19')](_0xcff1('0x1d'),_0x15cca6[_0xcff1('0x1a')],_0x140f31);_0x33e8e5(_0x419995['error'](0x1f4,_0x15cca6[_0xcff1('0x1a')]));});});}; \ No newline at end of file +var _0x1d34=['raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','register','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateChatMessage','ChatMessage','body','options'];(function(_0x4a411b,_0xa4fbb1){var _0x4f415f=function(_0x494204){while(--_0x494204){_0x4a411b['push'](_0x4a411b['shift']());}};_0x4f415f(++_0xa4fbb1);}(_0x1d34,0x1c8));var _0x41d3=function(_0x367f08,_0x37adf2){_0x367f08=_0x367f08-0x0;var _0x2382a4=_0x1d34[_0x367f08];return _0x2382a4;};'use strict';var _=require(_0x41d3('0x0'));var util=require(_0x41d3('0x1'));var moment=require(_0x41d3('0x2'));var BPromise=require(_0x41d3('0x3'));var rs=require(_0x41d3('0x4'));var fs=require('fs');var Redis=require(_0x41d3('0x5'));var db=require(_0x41d3('0x6'))['db'];var utils=require(_0x41d3('0x7'));var logger=require(_0x41d3('0x8'))(_0x41d3('0x9'));var config=require(_0x41d3('0xa'));var jayson=require(_0x41d3('0xb'));var client=jayson[_0x41d3('0xc')][_0x41d3('0xd')]({'port':0x232a});config[_0x41d3('0xe')]=_[_0x41d3('0xf')](config['redis'],{'host':_0x41d3('0x10'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./chatMessage.socket')[_0x41d3('0x11')](socket);function respondWithRpcPromise(_0x37d82d,_0x2da160,_0x3dbc88){return new BPromise(function(_0x584117,_0x242788){return client[_0x41d3('0x12')](_0x37d82d,_0x3dbc88)[_0x41d3('0x13')](function(_0x87b09d){logger[_0x41d3('0x14')](_0x41d3('0x15'),_0x2da160,_0x41d3('0x16'));logger[_0x41d3('0x17')](_0x41d3('0x18'),_0x2da160,_0x41d3('0x16'),JSON[_0x41d3('0x19')](_0x87b09d));if(_0x87b09d[_0x41d3('0x1a')]){if(_0x87b09d['error']['code']===0x1f4){logger[_0x41d3('0x1a')](_0x41d3('0x15'),_0x2da160,_0x87b09d[_0x41d3('0x1a')][_0x41d3('0x1b')]);return _0x242788(_0x87b09d['error'][_0x41d3('0x1b')]);}logger[_0x41d3('0x1a')](_0x41d3('0x15'),_0x2da160,_0x87b09d[_0x41d3('0x1a')][_0x41d3('0x1b')]);return _0x584117(_0x87b09d[_0x41d3('0x1a')][_0x41d3('0x1b')]);}else{logger[_0x41d3('0x14')]('ChatMessage,\x20%s,\x20%s',_0x2da160,_0x41d3('0x16'));_0x584117(_0x87b09d[_0x41d3('0x1c')][_0x41d3('0x1b')]);}})[_0x41d3('0x1d')](function(_0x1d3690){logger[_0x41d3('0x1a')]('ChatMessage,\x20%s,\x20%s',_0x2da160,_0x1d3690);_0x242788(_0x1d3690);});});}exports[_0x41d3('0x1e')]=function(_0x4bec68){var _0x34e676=this;return new Promise(function(_0x1ee1c0,_0x1da237){return db[_0x41d3('0x1f')]['create'](_0x4bec68[_0x41d3('0x20')],{'raw':_0x4bec68['options']?_0x4bec68[_0x41d3('0x21')][_0x41d3('0x22')]===undefined?!![]:![]:!![]})[_0x41d3('0x13')](function(_0x51fa58){logger['info'](_0x41d3('0x1e'),_0x4bec68);logger[_0x41d3('0x17')]('CreateChatMessage',_0x4bec68,JSON[_0x41d3('0x19')](_0x51fa58));_0x1ee1c0(_0x51fa58);})['catch'](function(_0x2937d8){logger['error'](_0x41d3('0x1e'),_0x2937d8[_0x41d3('0x1b')],_0x4bec68);_0x1da237(_0x34e676[_0x41d3('0x1a')](0x1f4,_0x2937d8[_0x41d3('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index c109749..bb5ad7f 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 _0xa630=['removeListener','register','length','chatMessage:','./chatMessage.events','save'];(function(_0x2e2fa7,_0x1b7721){var _0x261dad=function(_0x457dfa){while(--_0x457dfa){_0x2e2fa7['push'](_0x2e2fa7['shift']());}};_0x261dad(++_0x1b7721);}(_0xa630,0xbe));var _0x0a63=function(_0x2fc67c,_0xac72f0){_0x2fc67c=_0x2fc67c-0x0;var _0x4a0c12=_0xa630[_0x2fc67c];return _0x4a0c12;};'use strict';var ChatMessageEvents=require(_0x0a63('0x0'));var events=[_0x0a63('0x1'),'remove','update'];function createListener(_0x1a9586,_0x4f6b34){return function(_0xd0a045){_0x4f6b34['emit'](_0x1a9586,_0xd0a045);};}function removeListener(_0x91a747,_0x3bcb90){return function(){ChatMessageEvents[_0x0a63('0x2')](_0x91a747,_0x3bcb90);};}exports[_0x0a63('0x3')]=function(_0x37b4c9){for(var _0x4b7474=0x0,_0x2760b0=events[_0x0a63('0x4')];_0x4b7474<_0x2760b0;_0x4b7474++){var _0xc2dcd7=events[_0x4b7474];var _0x41d21d=createListener(_0x0a63('0x5')+_0xc2dcd7,_0x37b4c9);ChatMessageEvents['on'](_0xc2dcd7,_0x41d21d);}}; \ No newline at end of file +var _0xd9ef=['emit','removeListener','register','length','chatMessage:','./chatMessage.events','save','update'];(function(_0x25f3bd,_0x508d5a){var _0x2581ff=function(_0x5a1cd9){while(--_0x5a1cd9){_0x25f3bd['push'](_0x25f3bd['shift']());}};_0x2581ff(++_0x508d5a);}(_0xd9ef,0x95));var _0xfd9e=function(_0x394cb0,_0x5c4eee){_0x394cb0=_0x394cb0-0x0;var _0x3f2409=_0xd9ef[_0x394cb0];return _0x3f2409;};'use strict';var ChatMessageEvents=require(_0xfd9e('0x0'));var events=[_0xfd9e('0x1'),'remove',_0xfd9e('0x2')];function createListener(_0x55d1e2,_0x57c743){return function(_0x505f7f){_0x57c743[_0xfd9e('0x3')](_0x55d1e2,_0x505f7f);};}function removeListener(_0x28cfac,_0xe6990b){return function(){ChatMessageEvents[_0xfd9e('0x4')](_0x28cfac,_0xe6990b);};}exports[_0xfd9e('0x5')]=function(_0x178ceb){for(var _0x2d549f=0x0,_0x3c3dec=events[_0xfd9e('0x6')];_0x2d549f<_0x3c3dec;_0x2d549f++){var _0x302795=events[_0x2d549f];var _0xb61585=createListener(_0xfd9e('0x7')+_0x302795,_0x178ceb);ChatMessageEvents['on'](_0x302795,_0xb61585);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 5d4e101..8bccb76 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 _0x5602=['show','post','tracked','chat','chatmessage:create','put','/:id','update','/:id/accept','delete','destroy','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','isAuthenticated','index','/describe','describe','get'];(function(_0x301393,_0x3a0fcc){var _0x5f2e66=function(_0x535427){while(--_0x535427){_0x301393['push'](_0x301393['shift']());}};_0x5f2e66(++_0x3a0fcc);}(_0x5602,0xba));var _0x2560=function(_0x57eae4,_0x2d6405){_0x57eae4=_0x57eae4-0x0;var _0x5313ec=_0x5602[_0x57eae4];return _0x5313ec;};'use strict';var multer=require(_0x2560('0x0'));var util=require(_0x2560('0x1'));var path=require(_0x2560('0x2'));var timeout=require(_0x2560('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x2560('0x4'));var auth=require(_0x2560('0x5'));var interaction=require(_0x2560('0x6'));var config=require(_0x2560('0x7'));var controller=require(_0x2560('0x8'));router['get']('/',auth[_0x2560('0x9')](),controller[_0x2560('0xa')]);router['get'](_0x2560('0xb'),auth[_0x2560('0x9')](),controller[_0x2560('0xc')]);router[_0x2560('0xd')]('/:id',auth[_0x2560('0x9')](),controller[_0x2560('0xe')]);router[_0x2560('0xf')]('/',auth[_0x2560('0x9')](),interaction[_0x2560('0x10')](_0x2560('0x11'),_0x2560('0x12')),controller['create']);router[_0x2560('0x13')](_0x2560('0x14'),controller[_0x2560('0x15')]);router[_0x2560('0x13')](_0x2560('0x16'),auth[_0x2560('0x9')](),controller['accept']);router[_0x2560('0x13')]('/:id/reject',auth[_0x2560('0x9')](),controller['reject']);router[_0x2560('0x17')]('/:id',auth[_0x2560('0x9')](),controller[_0x2560('0x18')]);module['exports']=router; \ No newline at end of file +var _0xf4ae=['/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','chatmessage:create','put','update','/:id/accept'];(function(_0x2cc86e,_0x5e9be8){var _0x3c43e1=function(_0x522ecc){while(--_0x522ecc){_0x2cc86e['push'](_0x2cc86e['shift']());}};_0x3c43e1(++_0x5e9be8);}(_0xf4ae,0x75));var _0xef4a=function(_0x263f76,_0x2ee49f){_0x263f76=_0x263f76-0x0;var _0x4112de=_0xf4ae[_0x263f76];return _0x4112de;};'use strict';var multer=require(_0xef4a('0x0'));var util=require(_0xef4a('0x1'));var path=require(_0xef4a('0x2'));var timeout=require(_0xef4a('0x3'));var express=require(_0xef4a('0x4'));var router=express[_0xef4a('0x5')]();var fs_extra=require(_0xef4a('0x6'));var auth=require(_0xef4a('0x7'));var interaction=require(_0xef4a('0x8'));var config=require('../../config/environment');var controller=require(_0xef4a('0x9'));router[_0xef4a('0xa')]('/',auth[_0xef4a('0xb')](),controller[_0xef4a('0xc')]);router[_0xef4a('0xa')](_0xef4a('0xd'),auth['isAuthenticated'](),controller[_0xef4a('0xe')]);router[_0xef4a('0xa')](_0xef4a('0xf'),auth[_0xef4a('0xb')](),controller[_0xef4a('0x10')]);router[_0xef4a('0x11')]('/',auth[_0xef4a('0xb')](),interaction[_0xef4a('0x12')]('chat',_0xef4a('0x13')),controller['create']);router[_0xef4a('0x14')](_0xef4a('0xf'),controller[_0xef4a('0x15')]);router[_0xef4a('0x14')](_0xef4a('0x16'),auth['isAuthenticated'](),controller['accept']);router[_0xef4a('0x14')](_0xef4a('0x17'),auth[_0xef4a('0xb')](),controller[_0xef4a('0x18')]);router[_0xef4a('0x19')](_0xef4a('0xf'),auth[_0xef4a('0xb')](),controller[_0xef4a('0x1a')]);module[_0xef4a('0x1b')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 1f606e4..a63853a 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f66=['medium','TEXT','exports'];(function(_0xc56785,_0x5531a9){var _0xeaf7d0=function(_0x474676){while(--_0x474676){_0xc56785['push'](_0xc56785['shift']());}};_0xeaf7d0(++_0x5531a9);}(_0x5f66,0x1a0));var _0x65f6=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0x5f66[_0x278e3c];return _0x3e2d9b;};'use strict';var Sequelize=require('sequelize');module[_0x65f6('0x0')]={'body':{'type':Sequelize['TEXT'](_0x65f6('0x1')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x65f6('0x2')](_0x65f6('0x1')),'allowNull':![]}}; \ No newline at end of file +var _0x5f66=['medium','TEXT','exports'];(function(_0x484cf3,_0x511df2){var _0x38173e=function(_0x5db4af){while(--_0x5db4af){_0x484cf3['push'](_0x484cf3['shift']());}};_0x38173e(++_0x511df2);}(_0x5f66,0x1a0));var _0x65f6=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x5f66[_0x173441];return _0x2423a8;};'use strict';var Sequelize=require('sequelize');module[_0x65f6('0x0')]={'body':{'type':Sequelize['TEXT'](_0x65f6('0x1')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x65f6('0x2')](_0x65f6('0x1')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 6295a14..4fc70fa 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(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0x7a54,0x106));var _0x47a5=function(_0x497ad0,_0x369c22){_0x497ad0=_0x497ad0-0x0;var _0x33c245=_0x7a54[_0x497ad0];return _0x33c245;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));}; \ No newline at end of file +var _0x7a54=['filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','Attachment','join','server','attachments','offline-chat','basename','remove','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','ChatOfflineMessage','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0xa6cc5c,_0x239c99){var _0x44803d=function(_0x515b6e){while(--_0x515b6e){_0xa6cc5c['push'](_0xa6cc5c['shift']());}};_0x44803d(++_0x239c99);}(_0x7a54,0x106));var _0x47a5=function(_0x35187b,_0x5e1982){_0x35187b=_0x35187b-0x0;var _0x5be486=_0x7a54[_0x35187b];return _0x5be486;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.events.js b/server/api/chatOfflineMessage/chatOfflineMessage.events.js index 350d24f..bf151f2 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 _0x0a9e=['emit','hook','exports','events','../../mysqldb','ChatOfflineMessage','save','update','remove'];(function(_0x3528f8,_0x23b9cf){var _0x143401=function(_0x4dad8b){while(--_0x4dad8b){_0x3528f8['push'](_0x3528f8['shift']());}};_0x143401(++_0x23b9cf);}(_0x0a9e,0x1c5));var _0xe0a9=function(_0x20867d,_0x5f54ed){_0x20867d=_0x20867d-0x0;var _0x53fa30=_0x0a9e[_0x20867d];return _0x53fa30;};'use strict';var EventEmitter=require(_0xe0a9('0x0'));var ChatOfflineMessage=require(_0xe0a9('0x1'))['db'][_0xe0a9('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe0a9('0x3'),'afterUpdate':_0xe0a9('0x4'),'afterDestroy':_0xe0a9('0x5')};function emitEvent(_0x5c7f2b){return function(_0x106a6a,_0x53af0a,_0x31b53c){ChatOfflineMessageEvents[_0xe0a9('0x6')](_0x5c7f2b+':'+_0x106a6a['id'],_0x106a6a);ChatOfflineMessageEvents['emit'](_0x5c7f2b,_0x106a6a);_0x31b53c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatOfflineMessage[_0xe0a9('0x7')](e,emitEvent(event));}}module[_0xe0a9('0x8')]=ChatOfflineMessageEvents; \ No newline at end of file +var _0x15a0=['hook','events','ChatOfflineMessage','setMaxListeners','save','remove','emit'];(function(_0x54c71e,_0x5a2938){var _0x572e6d=function(_0x260b79){while(--_0x260b79){_0x54c71e['push'](_0x54c71e['shift']());}};_0x572e6d(++_0x5a2938);}(_0x15a0,0x8d));var _0x015a=function(_0x2f8530,_0x5cbd67){_0x2f8530=_0x2f8530-0x0;var _0x5e814e=_0x15a0[_0x2f8530];return _0x5e814e;};'use strict';var EventEmitter=require(_0x015a('0x0'));var ChatOfflineMessage=require('../../mysqldb')['db'][_0x015a('0x1')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x015a('0x2')](0x0);var events={'afterCreate':_0x015a('0x3'),'afterUpdate':'update','afterDestroy':_0x015a('0x4')};function emitEvent(_0x6bec6f){return function(_0x47e028,_0x346473,_0x24b1ba){ChatOfflineMessageEvents[_0x015a('0x5')](_0x6bec6f+':'+_0x47e028['id'],_0x47e028);ChatOfflineMessageEvents[_0x015a('0x5')](_0x6bec6f,_0x47e028);_0x24b1ba(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatOfflineMessage[_0x015a('0x6')](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 361ad77..51c3a62 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 _0x24d8=['define','ChatOfflineMessage','utf8mb4','utf8mb4_unicode_ci','./chatOfflineMessage.attributes','exports'];(function(_0x38f3e9,_0x53ce92){var _0xe8ee0a=function(_0x1280cf){while(--_0x1280cf){_0x38f3e9['push'](_0x38f3e9['shift']());}};_0xe8ee0a(++_0x53ce92);}(_0x24d8,0x118));var _0x824d=function(_0x172747,_0x1732bd){_0x172747=_0x172747-0x0;var _0x509692=_0x24d8[_0x172747];return _0x509692;};'use strict';var attributes=require(_0x824d('0x0'));module[_0x824d('0x1')]=function(_0x3b63f4){return _0x3b63f4[_0x824d('0x2')](_0x824d('0x3'),attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x824d('0x4'),'collate':_0x824d('0x5')});}; \ No newline at end of file +var _0x29bf=['chat_offline_messages','utf8mb4','./chatOfflineMessage.attributes','exports','define','ChatOfflineMessage'];(function(_0x5ea797,_0x2d39dd){var _0x500783=function(_0x4923f2){while(--_0x4923f2){_0x5ea797['push'](_0x5ea797['shift']());}};_0x500783(++_0x2d39dd);}(_0x29bf,0x6e));var _0xf29b=function(_0x4dc3d0,_0xf6dbe1){_0x4dc3d0=_0x4dc3d0-0x0;var _0x2c7cd8=_0x29bf[_0x4dc3d0];return _0x2c7cd8;};'use strict';var attributes=require(_0xf29b('0x0'));module[_0xf29b('0x1')]=function(_0xa310de){return _0xa310de[_0xf29b('0x2')](_0xf29b('0x3'),attributes,{'tableName':_0xf29b('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf29b('0x5'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index c84c460..2444b5e 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 _0x9400=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','ChatOfflineMessage,\x20%s,\x20%s','message'];(function(_0x16812f,_0x4f4060){var _0x407004=function(_0x2823a4){while(--_0x2823a4){_0x16812f['push'](_0x16812f['shift']());}};_0x407004(++_0x4f4060);}(_0x9400,0x152));var _0x0940=function(_0x569631,_0x5b4875){_0x569631=_0x569631-0x0;var _0x242ad7=_0x9400[_0x569631];return _0x242ad7;};'use strict';var _=require(_0x0940('0x0'));var util=require(_0x0940('0x1'));var moment=require(_0x0940('0x2'));var BPromise=require(_0x0940('0x3'));var rs=require(_0x0940('0x4'));var fs=require('fs');var Redis=require(_0x0940('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x0940('0x6'));var logger=require(_0x0940('0x7'))(_0x0940('0x8'));var config=require(_0x0940('0x9'));var jayson=require(_0x0940('0xa'));var client=jayson[_0x0940('0xb')][_0x0940('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2585f3,_0x8445e4,_0x193c30){return new BPromise(function(_0x138e81,_0xa53bed){return client['request'](_0x2585f3,_0x193c30)[_0x0940('0xd')](function(_0x46acbb){logger[_0x0940('0xe')]('ChatOfflineMessage,\x20%s,\x20%s',_0x8445e4,_0x0940('0xf'));logger[_0x0940('0x10')](_0x0940('0x11'),_0x8445e4,'request\x20sent',JSON[_0x0940('0x12')](_0x46acbb));if(_0x46acbb[_0x0940('0x13')]){if(_0x46acbb['error']['code']===0x1f4){logger[_0x0940('0x13')](_0x0940('0x14'),_0x8445e4,_0x46acbb[_0x0940('0x13')][_0x0940('0x15')]);return _0xa53bed(_0x46acbb[_0x0940('0x13')]['message']);}logger[_0x0940('0x13')](_0x0940('0x14'),_0x8445e4,_0x46acbb[_0x0940('0x13')]['message']);return _0x138e81(_0x46acbb[_0x0940('0x13')]['message']);}else{logger[_0x0940('0xe')](_0x0940('0x14'),_0x8445e4,_0x0940('0xf'));_0x138e81(_0x46acbb[_0x0940('0x16')]['message']);}})[_0x0940('0x17')](function(_0x24c604){logger['error'](_0x0940('0x14'),_0x8445e4,_0x24c604);_0xa53bed(_0x24c604);});});} \ No newline at end of file +var _0x01ad=['then','info','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','ChatOfflineMessage,\x20%s,\x20%s','message','catch','lodash','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x3791a3,_0x237ad1){var _0x5e5d6f=function(_0x171b91){while(--_0x171b91){_0x3791a3['push'](_0x3791a3['shift']());}};_0x5e5d6f(++_0x237ad1);}(_0x01ad,0xd2));var _0xd01a=function(_0x23c2b7,_0x57b41a){_0x23c2b7=_0x23c2b7-0x0;var _0x4c7225=_0x01ad[_0x23c2b7];return _0x4c7225;};'use strict';var _=require(_0xd01a('0x0'));var util=require('util');var moment=require(_0xd01a('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd01a('0x2'));var db=require(_0xd01a('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xd01a('0x4'))(_0xd01a('0x5'));var config=require(_0xd01a('0x6'));var jayson=require(_0xd01a('0x7'));var client=jayson['client'][_0xd01a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x26f150,_0x1df345,_0x5be6a1){return new BPromise(function(_0x24895f,_0x4f1b67){return client[_0xd01a('0x9')](_0x26f150,_0x5be6a1)[_0xd01a('0xa')](function(_0x3087d7){logger[_0xd01a('0xb')]('ChatOfflineMessage,\x20%s,\x20%s',_0x1df345,_0xd01a('0xc'));logger[_0xd01a('0xd')](_0xd01a('0xe'),_0x1df345,_0xd01a('0xc'),JSON[_0xd01a('0xf')](_0x3087d7));if(_0x3087d7[_0xd01a('0x10')]){if(_0x3087d7[_0xd01a('0x10')]['code']===0x1f4){logger[_0xd01a('0x10')](_0xd01a('0x11'),_0x1df345,_0x3087d7['error'][_0xd01a('0x12')]);return _0x4f1b67(_0x3087d7[_0xd01a('0x10')][_0xd01a('0x12')]);}logger[_0xd01a('0x10')](_0xd01a('0x11'),_0x1df345,_0x3087d7[_0xd01a('0x10')][_0xd01a('0x12')]);return _0x24895f(_0x3087d7[_0xd01a('0x10')][_0xd01a('0x12')]);}else{logger[_0xd01a('0xb')]('ChatOfflineMessage,\x20%s,\x20%s',_0x1df345,'request\x20sent');_0x24895f(_0x3087d7['result'][_0xd01a('0x12')]);}})[_0xd01a('0x13')](function(_0x1bf3a7){logger['error']('ChatOfflineMessage,\x20%s,\x20%s',_0x1df345,_0x1bf3a7);_0x4f1b67(_0x1bf3a7);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index bc10d6e..5f9b234 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 _0x2464=['/describe','/:id','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatOfflineMessage.controller','get','isAuthenticated','index'];(function(_0x41d9a7,_0x43843a){var _0x5bbb89=function(_0x520c26){while(--_0x520c26){_0x41d9a7['push'](_0x41d9a7['shift']());}};_0x5bbb89(++_0x43843a);}(_0x2464,0xba));var _0x4246=function(_0x50394d,_0x135d68){_0x50394d=_0x50394d-0x0;var _0x54773b=_0x2464[_0x50394d];return _0x54773b;};'use strict';var multer=require('multer');var util=require(_0x4246('0x0'));var path=require(_0x4246('0x1'));var timeout=require(_0x4246('0x2'));var express=require(_0x4246('0x3'));var router=express[_0x4246('0x4')]();var fs_extra=require(_0x4246('0x5'));var auth=require(_0x4246('0x6'));var interaction=require(_0x4246('0x7'));var config=require('../../config/environment');var controller=require(_0x4246('0x8'));router[_0x4246('0x9')]('/',auth[_0x4246('0xa')](),controller[_0x4246('0xb')]);router[_0x4246('0x9')](_0x4246('0xc'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x4246('0xd'),auth[_0x4246('0xa')](),controller[_0x4246('0xe')]);router[_0x4246('0xf')]('/',auth[_0x4246('0xa')](),controller[_0x4246('0x10')]);router[_0x4246('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x4246('0x12')]);router[_0x4246('0x13')](_0x4246('0xd'),auth[_0x4246('0xa')](),controller[_0x4246('0x14')]);module[_0x4246('0x15')]=router; \ No newline at end of file +var _0x5785=['get','isAuthenticated','/describe','describe','show','post','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x5785,0xd2));var _0x5578=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0x5785[_0x40220a];return _0x3903cc;};'use strict';var multer=require(_0x5578('0x0'));var util=require(_0x5578('0x1'));var path=require(_0x5578('0x2'));var timeout=require(_0x5578('0x3'));var express=require(_0x5578('0x4'));var router=express[_0x5578('0x5')]();var fs_extra=require(_0x5578('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x5578('0x7'));var config=require(_0x5578('0x8'));var controller=require(_0x5578('0x9'));router[_0x5578('0xa')]('/',auth[_0x5578('0xb')](),controller['index']);router[_0x5578('0xa')](_0x5578('0xc'),auth['isAuthenticated'](),controller[_0x5578('0xd')]);router[_0x5578('0xa')]('/:id',auth[_0x5578('0xb')](),controller[_0x5578('0xe')]);router[_0x5578('0xf')]('/',auth[_0x5578('0xb')](),controller['create']);router[_0x5578('0x10')](_0x5578('0x11'),auth[_0x5578('0xb')](),controller[_0x5578('0x12')]);router[_0x5578('0x13')](_0x5578('0x11'),auth[_0x5578('0xb')](),controller[_0x5578('0x14')]);module[_0x5578('0x15')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index de49b0e..0d63aef 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 _0xa7bc=['STRING','ENUM','mouseOver','timeout','sequelize','exports'];(function(_0x578a78,_0xfdd763){var _0x5b517b=function(_0x30e4e1){while(--_0x30e4e1){_0x578a78['push'](_0x578a78['shift']());}};_0x5b517b(++_0xfdd763);}(_0xa7bc,0x12a));var _0xca7b=function(_0x3b3545,_0x1f46ed){_0x3b3545=_0x3b3545-0x0;var _0x6dc734=_0xa7bc[_0x3b3545];return _0x6dc734;};'use strict';var Sequelize=require(_0xca7b('0x0'));module[_0xca7b('0x1')]={'name':{'type':Sequelize[_0xca7b('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xca7b('0x3')](_0xca7b('0x4'),_0xca7b('0x5')),'defaultValue':_0xca7b('0x4')},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x6c71=['ENUM','mouseOver','exports','STRING'];(function(_0x5c090b,_0x2d5e53){var _0x13e6b6=function(_0xcf49f9){while(--_0xcf49f9){_0x5c090b['push'](_0x5c090b['shift']());}};_0x13e6b6(++_0x2d5e53);}(_0x6c71,0x8e));var _0x16c7=function(_0x3a4c3d,_0x2cca41){_0x3a4c3d=_0x3a4c3d-0x0;var _0x3d7710=_0x6c71[_0x3a4c3d];return _0x3d7710;};'use strict';var Sequelize=require('sequelize');module[_0x16c7('0x0')]={'name':{'type':Sequelize[_0x16c7('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x16c7('0x2')](_0x16c7('0x3'),'timeout'),'defaultValue':_0x16c7('0x3')},'selector':{'type':Sequelize[_0x16c7('0x1')]},'timeout':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 05b8e31..1721498 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 _0xa990=['offset','limit','json','save','update','then','error','stack','name','send','params','model','keys','ChatProactiveAction','rawAttributes','query','filters','intersection','fields','attributes','length','include','merge','options','find','body','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','undefined','count'];(function(_0x115eec,_0x1c3866){var _0x2ce914=function(_0x44dc63){while(--_0x44dc63){_0x115eec['push'](_0x115eec['shift']());}};_0x2ce914(++_0x1c3866);}(_0xa990,0xc9));var _0x0a99=function(_0x473cd6,_0x40672f){_0x473cd6=_0x473cd6-0x0;var _0x1bbbdd=_0xa990[_0x473cd6];return _0x1bbbdd;};'use strict';var emlformat=require(_0x0a99('0x0'));var rimraf=require(_0x0a99('0x1'));var zipdir=require(_0x0a99('0x2'));var jsonpatch=require(_0x0a99('0x3'));var rp=require(_0x0a99('0x4'));var moment=require(_0x0a99('0x5'));var BPromise=require(_0x0a99('0x6'));var Mustache=require(_0x0a99('0x7'));var util=require('util');var path=require('path');var sox=require(_0x0a99('0x8'));var csv=require(_0x0a99('0x9'));var ejs=require(_0x0a99('0xa'));var fs=require('fs');var fs_extra=require(_0x0a99('0xb'));var _=require(_0x0a99('0xc'));var squel=require(_0x0a99('0xd'));var crypto=require(_0x0a99('0xe'));var jsforce=require(_0x0a99('0xf'));var deskjs=require(_0x0a99('0x10'));var toCsv=require(_0x0a99('0x9'));var querystring=require(_0x0a99('0x11'));var Papa=require('papaparse');var Redis=require(_0x0a99('0x12'));var authService=require(_0x0a99('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0a99('0x14'));var logger=require(_0x0a99('0x15'))(_0x0a99('0x16'));var utils=require(_0x0a99('0x17'));var config=require(_0x0a99('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x0a99('0x19'))['db'];function respondWithStatusCode(_0x3aaaad,_0x57ab88){_0x57ab88=_0x57ab88||0xcc;return function(_0xb6a34d){if(_0xb6a34d){return _0x3aaaad[_0x0a99('0x1a')](_0x57ab88);}return _0x3aaaad[_0x0a99('0x1b')](_0x57ab88)[_0x0a99('0x1c')]();};}function respondWithResult(_0x346061,_0x23d018){_0x23d018=_0x23d018||0xc8;return function(_0x18c124){if(_0x18c124){return _0x346061[_0x0a99('0x1b')](_0x23d018)['json'](_0x18c124);}};}function respondWithFilteredResult(_0x5a17e1,_0x2c40db){return function(_0x3ac17e){if(_0x3ac17e){var _0xb7356c=typeof _0x2c40db['offset']===_0x0a99('0x1d')&&typeof _0x2c40db['limit']==='undefined';var _0x20104c=_0x3ac17e[_0x0a99('0x1e')];var _0x3de006=_0xb7356c?0x0:_0x2c40db[_0x0a99('0x1f')];var _0x572ce5=_0xb7356c?_0x3ac17e['count']:_0x2c40db[_0x0a99('0x1f')]+_0x2c40db[_0x0a99('0x20')];var _0xbe23f3;if(_0x572ce5>=_0x20104c){_0x572ce5=_0x20104c;_0xbe23f3=0xc8;}else{_0xbe23f3=0xce;}_0x5a17e1[_0x0a99('0x1b')](_0xbe23f3);return _0x5a17e1['set']('Content-Range',_0x3de006+'-'+_0x572ce5+'/'+_0x20104c)[_0x0a99('0x21')](_0x3ac17e);}return null;};}function patchUpdates(_0x4d0c78){return function(_0x1e8d30){try{jsonpatch['apply'](_0x1e8d30,_0x4d0c78,!![]);}catch(_0x191ee4){return BPromise['reject'](_0x191ee4);}return _0x1e8d30[_0x0a99('0x22')]();};}function saveUpdates(_0x356681,_0x3b1d60){return function(_0x1c1e5c){if(_0x1c1e5c){return _0x1c1e5c[_0x0a99('0x23')](_0x356681)[_0x0a99('0x24')](function(_0x19c870){return _0x19c870;});}return null;};}function removeEntity(_0x1d803c,_0x398dd2){return function(_0x5745ca){if(_0x5745ca){return _0x5745ca['destroy']()[_0x0a99('0x24')](function(){_0x1d803c[_0x0a99('0x1b')](0xcc)[_0x0a99('0x1c')]();});}};}function handleEntityNotFound(_0x518617,_0x5d917c){return function(_0x371b31){if(!_0x371b31){_0x518617[_0x0a99('0x1a')](0x194);}return _0x371b31;};}function handleError(_0x1b0e94,_0x40e765){_0x40e765=_0x40e765||0x1f4;return function(_0x10e70f){logger[_0x0a99('0x25')](_0x10e70f[_0x0a99('0x26')]);if(_0x10e70f[_0x0a99('0x27')]){delete _0x10e70f[_0x0a99('0x27')];}_0x1b0e94['status'](_0x40e765)[_0x0a99('0x28')](_0x10e70f);};}exports['show']=function(_0x47bc34,_0x4e597b){var _0x223bdb={'raw':!![],'where':{'id':_0x47bc34[_0x0a99('0x29')]['id']}},_0x379c7e={};_0x379c7e[_0x0a99('0x2a')]=_[_0x0a99('0x2b')](db[_0x0a99('0x2c')][_0x0a99('0x2d')]);_0x379c7e['query']=_[_0x0a99('0x2b')](_0x47bc34[_0x0a99('0x2e')]);_0x379c7e[_0x0a99('0x2f')]=_[_0x0a99('0x30')](_0x379c7e['model'],_0x379c7e['query']);_0x223bdb['attributes']=_[_0x0a99('0x30')](_0x379c7e[_0x0a99('0x2a')],qs[_0x0a99('0x31')](_0x47bc34['query'][_0x0a99('0x31')]));_0x223bdb[_0x0a99('0x32')]=_0x223bdb[_0x0a99('0x32')][_0x0a99('0x33')]?_0x223bdb[_0x0a99('0x32')]:_0x379c7e[_0x0a99('0x2a')];if(_0x47bc34[_0x0a99('0x2e')]['includeAll']){_0x223bdb[_0x0a99('0x34')]=[{'all':!![]}];}_0x223bdb=_[_0x0a99('0x35')]({},_0x223bdb,_0x47bc34[_0x0a99('0x36')]);return db[_0x0a99('0x2c')][_0x0a99('0x37')](_0x223bdb)['then'](handleEntityNotFound(_0x4e597b,null))[_0x0a99('0x24')](respondWithResult(_0x4e597b,null))['catch'](handleError(_0x4e597b,null));};exports['create']=function(_0x5f20d0,_0x51b4ec){return db[_0x0a99('0x2c')]['create'](_0x5f20d0[_0x0a99('0x38')],{})[_0x0a99('0x24')](respondWithResult(_0x51b4ec,0xc9))[_0x0a99('0x39')](handleError(_0x51b4ec,null));};exports[_0x0a99('0x23')]=function(_0x414a0f,_0x43614d){if(_0x414a0f[_0x0a99('0x38')]['id']){delete _0x414a0f[_0x0a99('0x38')]['id'];}return db[_0x0a99('0x2c')][_0x0a99('0x37')]({'where':{'id':_0x414a0f[_0x0a99('0x29')]['id']}})[_0x0a99('0x24')](handleEntityNotFound(_0x43614d,null))[_0x0a99('0x24')](saveUpdates(_0x414a0f['body'],null))[_0x0a99('0x24')](respondWithResult(_0x43614d,null))[_0x0a99('0x39')](handleError(_0x43614d,null));};exports['destroy']=function(_0x3f0a9,_0x549bb9){return db[_0x0a99('0x2c')]['find']({'where':{'id':_0x3f0a9[_0x0a99('0x29')]['id']}})[_0x0a99('0x24')](handleEntityNotFound(_0x549bb9,null))[_0x0a99('0x24')](removeEntity(_0x549bb9,null))[_0x0a99('0x39')](handleError(_0x549bb9,null));}; \ No newline at end of file +var _0xdbf7=['params','model','keys','ChatProactiveAction','rawAttributes','query','filters','intersection','attributes','fields','includeAll','include','options','catch','create','body','find','eml-format','rimraf','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/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','end','stack','name','show'];(function(_0xac0a6f,_0x55ae26){var _0x4a1e61=function(_0x46a679){while(--_0x46a679){_0xac0a6f['push'](_0xac0a6f['shift']());}};_0x4a1e61(++_0x55ae26);}(_0xdbf7,0x8d));var _0x7dbf=function(_0xe36578,_0x167e63){_0xe36578=_0xe36578-0x0;var _0x55b8ad=_0xdbf7[_0xe36578];return _0x55b8ad;};'use strict';var emlformat=require(_0x7dbf('0x0'));var rimraf=require(_0x7dbf('0x1'));var zipdir=require(_0x7dbf('0x2'));var jsonpatch=require(_0x7dbf('0x3'));var rp=require(_0x7dbf('0x4'));var moment=require(_0x7dbf('0x5'));var BPromise=require(_0x7dbf('0x6'));var Mustache=require(_0x7dbf('0x7'));var util=require('util');var path=require(_0x7dbf('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7dbf('0x9'));var fs=require('fs');var fs_extra=require(_0x7dbf('0xa'));var _=require(_0x7dbf('0xb'));var squel=require(_0x7dbf('0xc'));var crypto=require(_0x7dbf('0xd'));var jsforce=require(_0x7dbf('0xe'));var deskjs=require(_0x7dbf('0xf'));var toCsv=require(_0x7dbf('0x10'));var querystring=require(_0x7dbf('0x11'));var Papa=require(_0x7dbf('0x12'));var Redis=require(_0x7dbf('0x13'));var authService=require(_0x7dbf('0x14'));var qs=require(_0x7dbf('0x15'));var as=require(_0x7dbf('0x16'));var hardwareService=require(_0x7dbf('0x17'));var logger=require('../../config/logger')(_0x7dbf('0x18'));var utils=require(_0x7dbf('0x19'));var config=require(_0x7dbf('0x1a'));var licenseUtil=require(_0x7dbf('0x1b'));var db=require(_0x7dbf('0x1c'))['db'];function respondWithStatusCode(_0x2254d7,_0x50bddb){_0x50bddb=_0x50bddb||0xcc;return function(_0x54bb0a){if(_0x54bb0a){return _0x2254d7['sendStatus'](_0x50bddb);}return _0x2254d7['status'](_0x50bddb)['end']();};}function respondWithResult(_0x524ed4,_0x201d38){_0x201d38=_0x201d38||0xc8;return function(_0x35686a){if(_0x35686a){return _0x524ed4[_0x7dbf('0x1d')](_0x201d38)['json'](_0x35686a);}};}function respondWithFilteredResult(_0x3dd291,_0x4492c8){return function(_0x38be73){if(_0x38be73){var _0x4a3cd3=typeof _0x4492c8[_0x7dbf('0x1e')]===_0x7dbf('0x1f')&&typeof _0x4492c8[_0x7dbf('0x20')]===_0x7dbf('0x1f');var _0x1d6b88=_0x38be73[_0x7dbf('0x21')];var _0xc47749=_0x4a3cd3?0x0:_0x4492c8['offset'];var _0x3abe64=_0x4a3cd3?_0x38be73['count']:_0x4492c8[_0x7dbf('0x1e')]+_0x4492c8['limit'];var _0x3dfcb8;if(_0x3abe64>=_0x1d6b88){_0x3abe64=_0x1d6b88;_0x3dfcb8=0xc8;}else{_0x3dfcb8=0xce;}_0x3dd291[_0x7dbf('0x1d')](_0x3dfcb8);return _0x3dd291[_0x7dbf('0x22')](_0x7dbf('0x23'),_0xc47749+'-'+_0x3abe64+'/'+_0x1d6b88)['json'](_0x38be73);}return null;};}function patchUpdates(_0xe2b82){return function(_0x104025){try{jsonpatch[_0x7dbf('0x24')](_0x104025,_0xe2b82,!![]);}catch(_0x56d108){return BPromise[_0x7dbf('0x25')](_0x56d108);}return _0x104025[_0x7dbf('0x26')]();};}function saveUpdates(_0x8b988d,_0xd2460c){return function(_0x4638b8){if(_0x4638b8){return _0x4638b8['update'](_0x8b988d)[_0x7dbf('0x27')](function(_0x26a5e2){return _0x26a5e2;});}return null;};}function removeEntity(_0x29f89f,_0x502014){return function(_0x48d753){if(_0x48d753){return _0x48d753[_0x7dbf('0x28')]()[_0x7dbf('0x27')](function(){_0x29f89f[_0x7dbf('0x1d')](0xcc)[_0x7dbf('0x29')]();});}};}function handleEntityNotFound(_0x205a70,_0x2360a3){return function(_0x35d4d2){if(!_0x35d4d2){_0x205a70['sendStatus'](0x194);}return _0x35d4d2;};}function handleError(_0x5a68fb,_0xba1115){_0xba1115=_0xba1115||0x1f4;return function(_0x2403d7){logger['error'](_0x2403d7[_0x7dbf('0x2a')]);if(_0x2403d7[_0x7dbf('0x2b')]){delete _0x2403d7[_0x7dbf('0x2b')];}_0x5a68fb[_0x7dbf('0x1d')](_0xba1115)['send'](_0x2403d7);};}exports[_0x7dbf('0x2c')]=function(_0x5dcdf4,_0x36d433){var _0x55c1f6={'raw':!![],'where':{'id':_0x5dcdf4[_0x7dbf('0x2d')]['id']}},_0x3c0515={};_0x3c0515[_0x7dbf('0x2e')]=_[_0x7dbf('0x2f')](db[_0x7dbf('0x30')][_0x7dbf('0x31')]);_0x3c0515[_0x7dbf('0x32')]=_[_0x7dbf('0x2f')](_0x5dcdf4[_0x7dbf('0x32')]);_0x3c0515[_0x7dbf('0x33')]=_[_0x7dbf('0x34')](_0x3c0515[_0x7dbf('0x2e')],_0x3c0515[_0x7dbf('0x32')]);_0x55c1f6[_0x7dbf('0x35')]=_[_0x7dbf('0x34')](_0x3c0515['model'],qs[_0x7dbf('0x36')](_0x5dcdf4[_0x7dbf('0x32')][_0x7dbf('0x36')]));_0x55c1f6[_0x7dbf('0x35')]=_0x55c1f6[_0x7dbf('0x35')]['length']?_0x55c1f6[_0x7dbf('0x35')]:_0x3c0515[_0x7dbf('0x2e')];if(_0x5dcdf4[_0x7dbf('0x32')][_0x7dbf('0x37')]){_0x55c1f6[_0x7dbf('0x38')]=[{'all':!![]}];}_0x55c1f6=_['merge']({},_0x55c1f6,_0x5dcdf4[_0x7dbf('0x39')]);return db[_0x7dbf('0x30')]['find'](_0x55c1f6)[_0x7dbf('0x27')](handleEntityNotFound(_0x36d433,null))['then'](respondWithResult(_0x36d433,null))[_0x7dbf('0x3a')](handleError(_0x36d433,null));};exports[_0x7dbf('0x3b')]=function(_0x431c00,_0x4ab0eb){return db[_0x7dbf('0x30')][_0x7dbf('0x3b')](_0x431c00['body'],{})[_0x7dbf('0x27')](respondWithResult(_0x4ab0eb,0xc9))[_0x7dbf('0x3a')](handleError(_0x4ab0eb,null));};exports['update']=function(_0x1a1362,_0x4fda6f){if(_0x1a1362[_0x7dbf('0x3c')]['id']){delete _0x1a1362['body']['id'];}return db[_0x7dbf('0x30')][_0x7dbf('0x3d')]({'where':{'id':_0x1a1362[_0x7dbf('0x2d')]['id']}})[_0x7dbf('0x27')](handleEntityNotFound(_0x4fda6f,null))[_0x7dbf('0x27')](saveUpdates(_0x1a1362[_0x7dbf('0x3c')],null))['then'](respondWithResult(_0x4fda6f,null))['catch'](handleError(_0x4fda6f,null));};exports[_0x7dbf('0x28')]=function(_0x1d2d5d,_0x5dda39){return db[_0x7dbf('0x30')][_0x7dbf('0x3d')]({'where':{'id':_0x1d2d5d[_0x7dbf('0x2d')]['id']}})['then'](handleEntityNotFound(_0x5dda39,null))[_0x7dbf('0x27')](removeEntity(_0x5dda39,null))[_0x7dbf('0x3a')](handleError(_0x5dda39,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 59a5b99..1aebc03 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 _0x3a68=['./chatProactiveAction.attributes','exports','ChatProactiveAction','chat_proactive_actions','lodash','util','../../config/logger','moment','request-promise','path','../../config/environment'];(function(_0xde3560,_0x4fdc30){var _0xc57df7=function(_0x4328b2){while(--_0x4328b2){_0xde3560['push'](_0xde3560['shift']());}};_0xc57df7(++_0x4fdc30);}(_0x3a68,0x1d2));var _0x83a6=function(_0x57b30c,_0x3013aa){_0x57b30c=_0x57b30c-0x0;var _0x11a5fd=_0x3a68[_0x57b30c];return _0x11a5fd;};'use strict';var _=require(_0x83a6('0x0'));var util=require(_0x83a6('0x1'));var logger=require(_0x83a6('0x2'))('api');var moment=require(_0x83a6('0x3'));var BPromise=require('bluebird');var rp=require(_0x83a6('0x4'));var fs=require('fs');var path=require(_0x83a6('0x5'));var rimraf=require('rimraf');var config=require(_0x83a6('0x6'));var attributes=require(_0x83a6('0x7'));module[_0x83a6('0x8')]=function(_0x17e08f,_0x1f6c80){return _0x17e08f['define'](_0x83a6('0x9'),attributes,{'tableName':_0x83a6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8498=['moment','request-promise','path','rimraf','../../config/environment','./chatProactiveAction.attributes','exports','define','ChatProactiveAction','chat_proactive_actions','lodash','api'];(function(_0x53b659,_0x445f5f){var _0x57e1fd=function(_0x170be3){while(--_0x170be3){_0x53b659['push'](_0x53b659['shift']());}};_0x57e1fd(++_0x445f5f);}(_0x8498,0x9a));var _0x8849=function(_0x353736,_0x2a1699){_0x353736=_0x353736-0x0;var _0x3764eb=_0x8498[_0x353736];return _0x3764eb;};'use strict';var _=require(_0x8849('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x8849('0x1'));var moment=require(_0x8849('0x2'));var BPromise=require('bluebird');var rp=require(_0x8849('0x3'));var fs=require('fs');var path=require(_0x8849('0x4'));var rimraf=require(_0x8849('0x5'));var config=require(_0x8849('0x6'));var attributes=require(_0x8849('0x7'));module[_0x8849('0x8')]=function(_0x1accc0,_0x16a447){return _0x1accc0[_0x8849('0x9')](_0x8849('0xa'),attributes,{'tableName':_0x8849('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.rpc.js b/server/api/chatProactiveAction/chatProactiveAction.rpc.js index caf6e2f..296ebcb 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 _0xe189=['stringify','error','code','message','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s'];(function(_0x388e6c,_0x2ca243){var _0x3dc6de=function(_0x1dfd84){while(--_0x1dfd84){_0x388e6c['push'](_0x388e6c['shift']());}};_0x3dc6de(++_0x2ca243);}(_0xe189,0x194));var _0x9e18=function(_0x2e3992,_0x4322fa){_0x2e3992=_0x2e3992-0x0;var _0x724b7b=_0xe189[_0x2e3992];return _0x724b7b;};'use strict';var _=require(_0x9e18('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x9e18('0x1'));var rs=require(_0x9e18('0x2'));var fs=require('fs');var Redis=require(_0x9e18('0x3'));var db=require(_0x9e18('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9e18('0x5'));var config=require(_0x9e18('0x6'));var jayson=require(_0x9e18('0x7'));var client=jayson[_0x9e18('0x8')][_0x9e18('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5e6097,_0x3153cf,_0x2e4691){return new BPromise(function(_0x4656a4,_0x50a0ce){return client[_0x9e18('0xa')](_0x5e6097,_0x2e4691)[_0x9e18('0xb')](function(_0x33e9cd){logger['info'](_0x9e18('0xc'),_0x3153cf,_0x9e18('0xd'));logger[_0x9e18('0xe')](_0x9e18('0xf'),_0x3153cf,_0x9e18('0xd'),JSON[_0x9e18('0x10')](_0x33e9cd));if(_0x33e9cd[_0x9e18('0x11')]){if(_0x33e9cd[_0x9e18('0x11')][_0x9e18('0x12')]===0x1f4){logger['error'](_0x9e18('0xc'),_0x3153cf,_0x33e9cd['error'][_0x9e18('0x13')]);return _0x50a0ce(_0x33e9cd[_0x9e18('0x11')]['message']);}logger[_0x9e18('0x11')](_0x9e18('0xc'),_0x3153cf,_0x33e9cd[_0x9e18('0x11')][_0x9e18('0x13')]);return _0x4656a4(_0x33e9cd['error'][_0x9e18('0x13')]);}else{logger['info']('ChatProactiveAction,\x20%s,\x20%s',_0x3153cf,_0x9e18('0xd'));_0x4656a4(_0x33e9cd['result'][_0x9e18('0x13')]);}})[_0x9e18('0x14')](function(_0x1f71fc){logger[_0x9e18('0x11')]('ChatProactiveAction,\x20%s,\x20%s',_0x3153cf,_0x1f71fc);_0x50a0ce(_0x1f71fc);});});} \ No newline at end of file +var _0x61c2=['result','catch','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','ChatProactiveAction,\x20%s,\x20%s,\x20%s','error','code','ChatProactiveAction,\x20%s,\x20%s','message'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x61c2,0x1a6));var _0x261c=function(_0x3136ed,_0x123cc0){_0x3136ed=_0x3136ed-0x0;var _0x3d7fd4=_0x61c2[_0x3136ed];return _0x3d7fd4;};'use strict';var _=require(_0x261c('0x0'));var util=require('util');var moment=require(_0x261c('0x1'));var BPromise=require(_0x261c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x261c('0x3'))['db'];var utils=require(_0x261c('0x4'));var logger=require(_0x261c('0x5'))(_0x261c('0x6'));var config=require(_0x261c('0x7'));var jayson=require(_0x261c('0x8'));var client=jayson[_0x261c('0x9')][_0x261c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5470f7,_0x1eb0ae,_0x980710){return new BPromise(function(_0x59f685,_0x2cf803){return client[_0x261c('0xb')](_0x5470f7,_0x980710)['then'](function(_0x53fce5){logger[_0x261c('0xc')]('ChatProactiveAction,\x20%s,\x20%s',_0x1eb0ae,_0x261c('0xd'));logger['debug'](_0x261c('0xe'),_0x1eb0ae,_0x261c('0xd'),JSON['stringify'](_0x53fce5));if(_0x53fce5['error']){if(_0x53fce5[_0x261c('0xf')][_0x261c('0x10')]===0x1f4){logger[_0x261c('0xf')](_0x261c('0x11'),_0x1eb0ae,_0x53fce5['error']['message']);return _0x2cf803(_0x53fce5[_0x261c('0xf')][_0x261c('0x12')]);}logger[_0x261c('0xf')](_0x261c('0x11'),_0x1eb0ae,_0x53fce5[_0x261c('0xf')]['message']);return _0x59f685(_0x53fce5[_0x261c('0xf')]['message']);}else{logger[_0x261c('0xc')](_0x261c('0x11'),_0x1eb0ae,'request\x20sent');_0x59f685(_0x53fce5[_0x261c('0x13')][_0x261c('0x12')]);}})[_0x261c('0x14')](function(_0x25207d){logger[_0x261c('0xf')](_0x261c('0x11'),_0x1eb0ae,_0x25207d);_0x2cf803(_0x25207d);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 144ecd7..d1e010b 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 _0xed1f=['../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','/:id','isAuthenticated','show','post','create','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x2ee172,_0x278363){var _0x2106e7=function(_0x54f214){while(--_0x54f214){_0x2ee172['push'](_0x2ee172['shift']());}};_0x2106e7(++_0x278363);}(_0xed1f,0x6a));var _0xfed1=function(_0x346737,_0x3e6081){_0x346737=_0x346737-0x0;var _0x1ade2e=_0xed1f[_0x346737];return _0x1ade2e;};'use strict';var multer=require(_0xfed1('0x0'));var util=require(_0xfed1('0x1'));var path=require(_0xfed1('0x2'));var timeout=require(_0xfed1('0x3'));var express=require(_0xfed1('0x4'));var router=express[_0xfed1('0x5')]();var fs_extra=require(_0xfed1('0x6'));var auth=require(_0xfed1('0x7'));var interaction=require(_0xfed1('0x8'));var config=require(_0xfed1('0x9'));var controller=require(_0xfed1('0xa'));router[_0xfed1('0xb')](_0xfed1('0xc'),auth[_0xfed1('0xd')](),controller[_0xfed1('0xe')]);router[_0xfed1('0xf')]('/',auth[_0xfed1('0xd')](),controller[_0xfed1('0x10')]);router['put'](_0xfed1('0xc'),auth[_0xfed1('0xd')](),controller['update']);router[_0xfed1('0x11')](_0xfed1('0xc'),auth['isAuthenticated'](),controller[_0xfed1('0x12')]);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(_0x5280b0,_0x17a850){var _0x490826=function(_0x2cc0fe){while(--_0x2cc0fe){_0x5280b0['push'](_0x5280b0['shift']());}};_0x490826(++_0x17a850);}(_0xf494,0x1c6));var _0x4f49=function(_0x449041,_0x5d1a18){_0x449041=_0x449041-0x0;var _0x26dc8b=_0xf494[_0x449041];return _0x26dc8b;};'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 0e3c363..62bbe0c 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 _0xecc6=['STRING','INTEGER','ENUM','rrmemory','roundrobin','sequelize','exports','name'];(function(_0x32b645,_0x38267b){var _0xa82341=function(_0xa91833){while(--_0xa91833){_0x32b645['push'](_0x32b645['shift']());}};_0xa82341(++_0x38267b);}(_0xecc6,0x15d));var _0x6ecc=function(_0x2326ff,_0x27e552){_0x2326ff=_0x2326ff-0x0;var _0x54bd8d=_0xecc6[_0x2326ff];return _0x54bd8d;};'use strict';var Sequelize=require(_0x6ecc('0x0'));module[_0x6ecc('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x6ecc('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x6ecc('0x3')]},'timeout':{'type':Sequelize[_0x6ecc('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x6ecc('0x5')](_0x6ecc('0x6'),'beepall',_0x6ecc('0x7'))}}; \ No newline at end of file +var _0xd7a7=['roundrobin','sequelize','exports','STRING','INTEGER','rrmemory','beepall'];(function(_0x19e58e,_0x540b5a){var _0x5c4d79=function(_0xad26a){while(--_0xad26a){_0x19e58e['push'](_0x19e58e['shift']());}};_0x5c4d79(++_0x540b5a);}(_0xd7a7,0xb0));var _0x7d7a=function(_0x480760,_0x5689df){_0x480760=_0x480760-0x0;var _0x429b49=_0xd7a7[_0x480760];return _0x429b49;};'use strict';var Sequelize=require(_0x7d7a('0x0'));module[_0x7d7a('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x7d7a('0x2')]},'timeout':{'type':Sequelize[_0x7d7a('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x7d7a('0x4'),_0x7d7a('0x5'),_0x7d7a('0x6'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 04aa949..2eb140a 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 _0x732d=['clone','push','toString','QueryTypes','every','TeamId','includes','all','union','compact','value','removeAgents','addAgents','userChatQueue:save','isArray','userChatQueue:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./chatQueue.socket','jayson/promise','client','http','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','get','ChatQueues','destroy','sendStatus','stack','name','index','map','ChatQueue','rawAttributes','type','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','options','includeAll','include','show','params','create','body','user','role','UserProfileSection','find','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','findOne','UserChatQueue','sort','ChatQueueId','findAll','User','findAndCountAll','UserId','agent','chatPause','updatedAt','createdAt','rows','%s/%s','getTeams','Team','addTeams','ids','online','voicePause','flatMap','sequelize','transaction','findOrCreate','emit','removeTeams','Agents','select','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?'];(function(_0x2125f0,_0x2f23b9){var _0x12d6eb=function(_0x7a43ea){while(--_0x7a43ea){_0x2125f0['push'](_0x2125f0['shift']());}};_0x12d6eb(++_0x2f23b9);}(_0x732d,0xaa));var _0xd732=function(_0x3be646,_0x1083f3){_0x3be646=_0x3be646-0x0;var _0x86ea57=_0x732d[_0x3be646];return _0x86ea57;};'use strict';var emlformat=require(_0xd732('0x0'));var rimraf=require(_0xd732('0x1'));var zipdir=require(_0xd732('0x2'));var jsonpatch=require(_0xd732('0x3'));var rp=require(_0xd732('0x4'));var moment=require('moment');var BPromise=require(_0xd732('0x5'));var Mustache=require(_0xd732('0x6'));var util=require(_0xd732('0x7'));var path=require(_0xd732('0x8'));var sox=require(_0xd732('0x9'));var csv=require(_0xd732('0xa'));var ejs=require(_0xd732('0xb'));var fs=require('fs');var fs_extra=require(_0xd732('0xc'));var _=require(_0xd732('0xd'));var squel=require(_0xd732('0xe'));var crypto=require(_0xd732('0xf'));var jsforce=require(_0xd732('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd732('0x11'));var Papa=require(_0xd732('0x12'));var Redis=require(_0xd732('0x13'));var authService=require(_0xd732('0x14'));var qs=require(_0xd732('0x15'));var as=require(_0xd732('0x16'));var hardwareService=require(_0xd732('0x17'));var logger=require(_0xd732('0x18'))(_0xd732('0x19'));var utils=require(_0xd732('0x1a'));var config=require(_0xd732('0x1b'));var licenseUtil=require(_0xd732('0x1c'));var db=require(_0xd732('0x1d'))['db'];config[_0xd732('0x1e')]=_['defaults'](config[_0xd732('0x1e')],{'host':_0xd732('0x1f'),'port':0x18eb});var socket=require(_0xd732('0x20'))(new Redis(config[_0xd732('0x1e')]));require(_0xd732('0x21'))['register'](socket);var jayson=require(_0xd732('0x22'));var client=jayson[_0xd732('0x23')][_0xd732('0x24')]({'port':0x232a});function respondWithRpcPromise(_0x249ca6,_0x5a2422,_0x246e21,_0x799b93){return new BPromise(function(_0x532122,_0x389fab){var _0x1f83c3=_0x799b93||client;return _0x1f83c3['request'](_0x249ca6,_0x246e21)[_0xd732('0x25')](function(_0x3fb5f8){logger[_0xd732('0x26')](_0xd732('0x27'),_0x5a2422,_0xd732('0x28'));logger['debug'](_0xd732('0x29'),_0x5a2422,'request\x20sent',JSON[_0xd732('0x2a')](_0x3fb5f8));if(_0x3fb5f8[_0xd732('0x2b')]){if(_0x3fb5f8[_0xd732('0x2b')][_0xd732('0x2c')]===0x1f4){logger[_0xd732('0x2b')]('ChatQueue,\x20%s,\x20%s',_0x5a2422,_0x3fb5f8[_0xd732('0x2b')][_0xd732('0x2d')]);return _0x389fab(_0x3fb5f8[_0xd732('0x2b')]['message']);}logger['error'](_0xd732('0x27'),_0x5a2422,_0x3fb5f8[_0xd732('0x2b')]['message']);return _0x532122(_0x3fb5f8[_0xd732('0x2b')][_0xd732('0x2d')]);}else{logger['info'](_0xd732('0x27'),_0x5a2422,_0xd732('0x28'));_0x532122(_0x3fb5f8[_0xd732('0x2e')][_0xd732('0x2d')]);}})[_0xd732('0x2f')](function(_0x2e926b){logger['error']('ChatQueue,\x20%s,\x20%s',_0x5a2422,_0x2e926b);_0x389fab(_0x2e926b);});});}function respondWithStatusCode(_0x5c0593,_0xc25d56){_0xc25d56=_0xc25d56||0xcc;return function(_0x3bcaa7){if(_0x3bcaa7){return _0x5c0593['sendStatus'](_0xc25d56);}return _0x5c0593[_0xd732('0x30')](_0xc25d56)[_0xd732('0x31')]();};}function respondWithResult(_0x3e8d97,_0x277007){_0x277007=_0x277007||0xc8;return function(_0x5a6bdb){if(_0x5a6bdb){return _0x3e8d97['status'](_0x277007)[_0xd732('0x32')](_0x5a6bdb);}};}function respondWithFilteredResult(_0x21e6e9,_0x46a007){return function(_0x480177){if(_0x480177){var _0x23ff36=typeof _0x46a007[_0xd732('0x33')]===_0xd732('0x34')&&typeof _0x46a007[_0xd732('0x35')]===_0xd732('0x34');var _0x4be270=_0x480177[_0xd732('0x36')];var _0x229370=_0x23ff36?0x0:_0x46a007[_0xd732('0x33')];var _0xd6a9c9=_0x23ff36?_0x480177[_0xd732('0x36')]:_0x46a007['offset']+_0x46a007[_0xd732('0x35')];var _0x58e0e5;if(_0xd6a9c9>=_0x4be270){_0xd6a9c9=_0x4be270;_0x58e0e5=0xc8;}else{_0x58e0e5=0xce;}_0x21e6e9[_0xd732('0x30')](_0x58e0e5);return _0x21e6e9['set'](_0xd732('0x37'),_0x229370+'-'+_0xd6a9c9+'/'+_0x4be270)['json'](_0x480177);}return null;};}function patchUpdates(_0x53fed4){return function(_0x2f4ea1){try{jsonpatch['apply'](_0x2f4ea1,_0x53fed4,!![]);}catch(_0x2d8a0b){return BPromise[_0xd732('0x38')](_0x2d8a0b);}return _0x2f4ea1[_0xd732('0x39')]();};}function saveUpdates(_0x132678,_0x17896c){return function(_0x18ad6c){if(_0x18ad6c){return _0x18ad6c['update'](_0x132678)[_0xd732('0x25')](function(_0x3db4af){return _0x3db4af;});}return null;};}function removeEntity(_0xeb16a3,_0x1678b6){return function(_0x3f5ddd){if(_0x3f5ddd){return _0x3f5ddd['destroy']()[_0xd732('0x25')](function(){var _0x20b6f4=_0x3f5ddd[_0xd732('0x3a')]({'plain':!![]});var _0x1322f1=_0xd732('0x3b');return db['UserProfileResource'][_0xd732('0x3c')]({'where':{'type':_0x1322f1,'resourceId':_0x20b6f4['id']}})[_0xd732('0x25')](function(){return _0x3f5ddd;});})[_0xd732('0x25')](function(){_0xeb16a3['status'](0xcc)[_0xd732('0x31')]();});}};}function handleEntityNotFound(_0x4fd284,_0x41f4d2){return function(_0x502ade){if(!_0x502ade){_0x4fd284[_0xd732('0x3d')](0x194);}return _0x502ade;};}function handleError(_0x286331,_0x4d07f4){_0x4d07f4=_0x4d07f4||0x1f4;return function(_0x2f1e5b){logger[_0xd732('0x2b')](_0x2f1e5b[_0xd732('0x3e')]);if(_0x2f1e5b[_0xd732('0x3f')]){delete _0x2f1e5b[_0xd732('0x3f')];}_0x286331['status'](_0x4d07f4)['send'](_0x2f1e5b);};}exports[_0xd732('0x40')]=function(_0x1f1fda,_0x46f646){var _0x3d144b={},_0x334e66={},_0x1f556c={'count':0x0,'rows':[]};var _0xf1756f=_[_0xd732('0x41')](db[_0xd732('0x42')][_0xd732('0x43')],function(_0x2b8bd7){return{'name':_0x2b8bd7['fieldName'],'type':_0x2b8bd7[_0xd732('0x44')]['key']};});_0x334e66[_0xd732('0x45')]=_[_0xd732('0x41')](_0xf1756f,_0xd732('0x3f'));_0x334e66['query']=_[_0xd732('0x46')](_0x1f1fda[_0xd732('0x47')]);_0x334e66[_0xd732('0x48')]=_['intersection'](_0x334e66['model'],_0x334e66[_0xd732('0x47')]);_0x3d144b[_0xd732('0x49')]=_[_0xd732('0x4a')](_0x334e66[_0xd732('0x45')],qs[_0xd732('0x4b')](_0x1f1fda[_0xd732('0x47')][_0xd732('0x4b')]));_0x3d144b[_0xd732('0x49')]=_0x3d144b[_0xd732('0x49')][_0xd732('0x4c')]?_0x3d144b[_0xd732('0x49')]:_0x334e66[_0xd732('0x45')];if(!_0x1f1fda[_0xd732('0x47')][_0xd732('0x4d')](_0xd732('0x4e'))){_0x3d144b['limit']=qs[_0xd732('0x35')](_0x1f1fda['query']['limit']);_0x3d144b[_0xd732('0x33')]=qs['offset'](_0x1f1fda[_0xd732('0x47')]['offset']);}_0x3d144b[_0xd732('0x4f')]=qs['sort'](_0x1f1fda[_0xd732('0x47')]['sort']);_0x3d144b[_0xd732('0x50')]=qs[_0xd732('0x48')](_[_0xd732('0x51')](_0x1f1fda[_0xd732('0x47')],_0x334e66['filters']),_0xf1756f);if(_0x1f1fda[_0xd732('0x47')][_0xd732('0x52')]){_0x3d144b[_0xd732('0x50')]=_[_0xd732('0x53')](_0x3d144b[_0xd732('0x50')],{'$or':_[_0xd732('0x41')](_0xf1756f,function(_0x214762){if(_0x214762['type']!==_0xd732('0x54')){var _0x547065={};_0x547065[_0x214762['name']]={'$like':'%'+_0x1f1fda['query']['filter']+'%'};return _0x547065;}})});}_0x3d144b=_[_0xd732('0x53')]({},_0x3d144b,_0x1f1fda[_0xd732('0x55')]);var _0x5d6e5c={'where':_0x3d144b[_0xd732('0x50')]};return db[_0xd732('0x42')][_0xd732('0x36')](_0x5d6e5c)[_0xd732('0x25')](function(_0x5c0649){_0x1f556c['count']=_0x5c0649;if(_0x1f1fda[_0xd732('0x47')][_0xd732('0x56')]){_0x3d144b[_0xd732('0x57')]=[{'all':!![]}];}return db['ChatQueue']['findAll'](_0x3d144b);})[_0xd732('0x25')](function(_0x18b1ed){_0x1f556c['rows']=_0x18b1ed;return _0x1f556c;})[_0xd732('0x25')](respondWithFilteredResult(_0x46f646,_0x3d144b))[_0xd732('0x2f')](handleError(_0x46f646,null));};exports[_0xd732('0x58')]=function(_0x3c07ed,_0x2cc095){var _0x47aedd={'raw':!![],'where':{'id':_0x3c07ed[_0xd732('0x59')]['id']}},_0x190f07={};_0x190f07['model']=_[_0xd732('0x46')](db[_0xd732('0x42')][_0xd732('0x43')]);_0x190f07[_0xd732('0x47')]=_[_0xd732('0x46')](_0x3c07ed[_0xd732('0x47')]);_0x190f07[_0xd732('0x48')]=_[_0xd732('0x4a')](_0x190f07['model'],_0x190f07[_0xd732('0x47')]);_0x47aedd['attributes']=_[_0xd732('0x4a')](_0x190f07[_0xd732('0x45')],qs[_0xd732('0x4b')](_0x3c07ed[_0xd732('0x47')][_0xd732('0x4b')]));_0x47aedd[_0xd732('0x49')]=_0x47aedd['attributes'][_0xd732('0x4c')]?_0x47aedd['attributes']:_0x190f07[_0xd732('0x45')];if(_0x3c07ed['query'][_0xd732('0x56')]){_0x47aedd['include']=[{'all':!![]}];}_0x47aedd=_[_0xd732('0x53')]({},_0x47aedd,_0x3c07ed[_0xd732('0x55')]);return db[_0xd732('0x42')]['find'](_0x47aedd)[_0xd732('0x25')](handleEntityNotFound(_0x2cc095,null))[_0xd732('0x25')](respondWithResult(_0x2cc095,null))['catch'](handleError(_0x2cc095,null));};exports['create']=function(_0x54aa66,_0x4186d9){return db[_0xd732('0x42')][_0xd732('0x5a')](_0x54aa66[_0xd732('0x5b')],{})[_0xd732('0x25')](function(_0x58a89d){var _0x35cca5=_0x54aa66[_0xd732('0x5c')][_0xd732('0x3a')]({'plain':!![]});if(!_0x35cca5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x35cca5[_0xd732('0x5d')]==='user'){var _0x23bea6=_0x58a89d['get']({'plain':!![]});var _0x2ba03b=_0xd732('0x3b');return db[_0xd732('0x5e')][_0xd732('0x5f')]({'where':{'name':_0x2ba03b,'userProfileId':_0x35cca5['userProfileId']},'raw':!![]})[_0xd732('0x25')](function(_0x3ecc3a){if(_0x3ecc3a&&_0x3ecc3a[_0xd732('0x60')]===0x0){return db[_0xd732('0x61')][_0xd732('0x5a')]({'name':_0x23bea6['name'],'resourceId':_0x23bea6['id'],'type':_0x3ecc3a[_0xd732('0x3f')],'sectionId':_0x3ecc3a['id']},{})[_0xd732('0x25')](function(){return _0x58a89d;});}else{return _0x58a89d;}})['catch'](function(_0xe2017f){logger[_0xd732('0x2b')](_0xd732('0x62'),_0xe2017f);throw _0xe2017f;});}return _0x58a89d;})['then'](respondWithResult(_0x4186d9,0xc9))[_0xd732('0x2f')](handleError(_0x4186d9,null));};exports[_0xd732('0x63')]=function(_0x10bb0e,_0x1488a4){if(_0x10bb0e[_0xd732('0x5b')]['id']){delete _0x10bb0e['body']['id'];}return db['ChatQueue']['find']({'where':{'id':_0x10bb0e[_0xd732('0x59')]['id']}})[_0xd732('0x25')](handleEntityNotFound(_0x1488a4,null))[_0xd732('0x25')](saveUpdates(_0x10bb0e[_0xd732('0x5b')],null))['then'](respondWithResult(_0x1488a4,null))[_0xd732('0x2f')](handleError(_0x1488a4,null));};exports[_0xd732('0x3c')]=function(_0x201981,_0x2acaff){return db['ChatQueue'][_0xd732('0x5f')]({'where':{'id':_0x201981[_0xd732('0x59')]['id']}})['then'](handleEntityNotFound(_0x2acaff,null))[_0xd732('0x25')](removeEntity(_0x2acaff,null))[_0xd732('0x2f')](handleError(_0x2acaff,null));};exports[_0xd732('0x64')]=function(_0x434a0f,_0x27fb70){return db['ChatQueue'][_0xd732('0x64')]()[_0xd732('0x25')](respondWithResult(_0x27fb70,null))['catch'](handleError(_0x27fb70,null));};exports['getMembers']=function(_0x31a7bb,_0x3bb041,_0x1ef16c){var _0x49fcb2={'raw':!![],'where':{}},_0x19d72b={},_0x1b6629;return db[_0xd732('0x42')][_0xd732('0x65')]({'where':{'id':_0x31a7bb[_0xd732('0x59')]['id']}})[_0xd732('0x25')](handleEntityNotFound(_0x3bb041,null))[_0xd732('0x25')](function(_0x2b4488){if(_0x2b4488){_0x1b6629=_0x2b4488[_0xd732('0x3a')]({'plain':!![]});_0x19d72b['model']=_['keys'](db[_0xd732('0x66')]['rawAttributes']);_0x19d72b[_0xd732('0x47')]=_[_0xd732('0x46')](_0x31a7bb['query']);_0x19d72b[_0xd732('0x48')]=_[_0xd732('0x4a')](_0x19d72b[_0xd732('0x45')],_0x19d72b[_0xd732('0x47')]);_0x49fcb2[_0xd732('0x49')]=_[_0xd732('0x4a')](_0x19d72b[_0xd732('0x45')],qs[_0xd732('0x4b')](_0x31a7bb['query'][_0xd732('0x4b')]));_0x49fcb2[_0xd732('0x49')]=_0x49fcb2[_0xd732('0x49')][_0xd732('0x4c')]?_0x49fcb2[_0xd732('0x49')]:_0x19d72b[_0xd732('0x45')];if(!_0x31a7bb[_0xd732('0x47')][_0xd732('0x4d')]('nolimit')){_0x49fcb2[_0xd732('0x35')]=qs['limit'](_0x31a7bb[_0xd732('0x47')]['limit']);_0x49fcb2[_0xd732('0x33')]=qs[_0xd732('0x33')](_0x31a7bb[_0xd732('0x47')]['offset']);}_0x49fcb2['order']=qs['sort'](_0x31a7bb[_0xd732('0x47')][_0xd732('0x67')]);_0x49fcb2['where']=qs[_0xd732('0x48')](_[_0xd732('0x51')](_0x31a7bb['query'],_0x19d72b[_0xd732('0x48')]));_0x49fcb2[_0xd732('0x50')][_0xd732('0x68')]=_0x2b4488['id'];if(_0x31a7bb[_0xd732('0x47')][_0xd732('0x52')]){_0x49fcb2['where']=_[_0xd732('0x53')](_0x49fcb2[_0xd732('0x50')],{'$or':_[_0xd732('0x41')](_0x49fcb2[_0xd732('0x49')],function(_0x5a0f8b){var _0x5bb3cd={};_0x5bb3cd[_0x5a0f8b]={'$like':'%'+_0x31a7bb[_0xd732('0x47')][_0xd732('0x52')]+'%'};return _0x5bb3cd;})});}_0x49fcb2=_[_0xd732('0x53')]({},_0x49fcb2,_0x31a7bb[_0xd732('0x55')]);return db['UserChatQueue'][_0xd732('0x69')](_0x49fcb2);}})['then'](function(_0x77350e){if(_0x77350e){return db[_0xd732('0x6a')][_0xd732('0x6b')]({'where':{'id':_[_0xd732('0x41')](_0x77350e,_0xd732('0x6c')),'role':_0xd732('0x6d')},'attributes':['id',_0xd732('0x3f'),_0xd732('0x6e'),_0xd732('0x6f'),_0xd732('0x70')]});}})[_0xd732('0x25')](function(_0x395a6f){if(_0x395a6f){return{'count':_0x395a6f['count'],'rows':_[_0xd732('0x41')](_0x395a6f[_0xd732('0x71')],function(_0x209dfd){return{'membername':_0x209dfd[_0xd732('0x3f')],'UserId':_0x209dfd['id'],'queue_name':_0x1b6629[_0xd732('0x3f')],'ChatQueueId':_0x1b6629['id'],'interface':util['format'](_0xd732('0x72'),'SIP',_0x209dfd['name']),'penalty':0x0,'paused':_0x209dfd['chatPause'],'createdAt':_0x209dfd['createdAt'],'updatedAt':_0x209dfd['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xd732('0x25')](respondWithFilteredResult(_0x3bb041,_0x49fcb2))[_0xd732('0x2f')](handleError(_0x3bb041,null));};exports[_0xd732('0x73')]=function(_0x411061,_0x3c3c74,_0x72f456){var _0x452a08={};var _0x246713={};var _0x32c801;var _0xc66546;return db['ChatQueue'][_0xd732('0x65')]({'where':{'id':_0x411061['params']['id']}})[_0xd732('0x25')](handleEntityNotFound(_0x3c3c74,null))['then'](function(_0x2d588d){if(_0x2d588d){_0x32c801=_0x2d588d;_0x246713['model']=_['keys'](db[_0xd732('0x74')]['rawAttributes']);_0x246713[_0xd732('0x47')]=_[_0xd732('0x46')](_0x411061[_0xd732('0x47')]);_0x246713[_0xd732('0x48')]=_['intersection'](_0x246713[_0xd732('0x45')],_0x246713[_0xd732('0x47')]);_0x452a08[_0xd732('0x49')]=_['intersection'](_0x246713['model'],qs[_0xd732('0x4b')](_0x411061['query'][_0xd732('0x4b')]));_0x452a08[_0xd732('0x49')]=_0x452a08[_0xd732('0x49')][_0xd732('0x4c')]?_0x452a08[_0xd732('0x49')]:_0x246713[_0xd732('0x45')];_0x452a08['order']=qs[_0xd732('0x67')](_0x411061[_0xd732('0x47')][_0xd732('0x67')]);_0x452a08[_0xd732('0x50')]=qs[_0xd732('0x48')](_['pick'](_0x411061[_0xd732('0x47')],_0x246713[_0xd732('0x48')]));if(_0x411061[_0xd732('0x47')][_0xd732('0x52')]){_0x452a08[_0xd732('0x50')]=_['merge'](_0x452a08['where'],{'$or':_[_0xd732('0x41')](_0x452a08['attributes'],function(_0x3c9bde){var _0x73190b={};_0x73190b[_0x3c9bde]={'$like':'%'+_0x411061[_0xd732('0x47')][_0xd732('0x52')]+'%'};return _0x73190b;})});}_0x452a08=_[_0xd732('0x53')]({},_0x452a08,_0x411061[_0xd732('0x55')]);return _0x32c801[_0xd732('0x73')](_0x452a08);}})[_0xd732('0x25')](function(_0x3401ea){if(_0x3401ea){_0xc66546=_0x3401ea['length'];if(!_0x411061[_0xd732('0x47')][_0xd732('0x4d')](_0xd732('0x4e'))){_0x452a08[_0xd732('0x35')]=qs[_0xd732('0x35')](_0x411061[_0xd732('0x47')]['limit']);_0x452a08[_0xd732('0x33')]=qs[_0xd732('0x33')](_0x411061[_0xd732('0x47')][_0xd732('0x33')]);}return _0x32c801[_0xd732('0x73')](_0x452a08);}})[_0xd732('0x25')](function(_0x2574c9){if(_0x2574c9){return _0x2574c9?{'count':_0xc66546,'rows':_0x2574c9}:null;}})[_0xd732('0x25')](respondWithResult(_0x3c3c74,null))['catch'](handleError(_0x3c3c74,null));};exports[_0xd732('0x75')]=function(_0x3ddfdc,_0x4f57e6,_0x33ffd7){var _0x33024b=_0x3ddfdc['body'][_0xd732('0x76')];return db['Team']['findAll']({'where':{'id':_0x33024b},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0xd732('0x3f'),_0xd732('0x77'),_0xd732('0x78'),'interface'],'raw':!![]}]})[_0xd732('0x25')](function(_0x3a13cc){if(_0x3a13cc){var _0x2eb168=_[_0xd732('0x79')](_0x3a13cc,function(_0x12d005){var _0x37dd96=_0x12d005[_0xd732('0x3a')]({'plain':!![]});return _0x37dd96['Agents'];});return db[_0xd732('0x42')][_0xd732('0x5f')]({'where':{'id':_0x3ddfdc['params']['id']}})['then'](function(_0x49c2a7){return db[_0xd732('0x7a')][_0xd732('0x7b')](function(_0x28f4f8){return _0x49c2a7[_0xd732('0x75')](_0x33024b,{'transaction':_0x28f4f8})[_0xd732('0x25')](function(){return BPromise['each'](_0x2eb168,function(_0x9f4191){return db[_0xd732('0x66')][_0xd732('0x7c')]({'where':{'UserId':_0x9f4191['id'],'ChatQueueId':_0x3ddfdc[_0xd732('0x59')]['id']},'transaction':_0x28f4f8});});})[_0xd732('0x25')](function(){_0x2eb168['forEach'](function(_0x426de3){socket[_0xd732('0x7d')]('userChatQueue:save',{'UserId':_0x426de3['id'],'ChatQueueId':_0x49c2a7['id']});});});});});}})[_0xd732('0x25')](respondWithStatusCode(_0x4f57e6,null))['catch'](handleError(_0x4f57e6,null));};exports[_0xd732('0x7e')]=function(_0xb62ad8,_0x1b99b8,_0xf14c1f){return db['Team']['findAll']({'where':{'id':_0xb62ad8[_0xd732('0x47')]['ids']},'attributes':['id'],'include':[{'model':db[_0xd732('0x6a')],'as':_0xd732('0x7f'),'attributes':['id'],'raw':!![]}]})[_0xd732('0x25')](handleEntityNotFound(_0x1b99b8,null))['then'](function(_0x33f738){var _0x3eb2a1=_[_0xd732('0x41')](_0x33f738,'id');var _0x30d68a=[];var _0x5141a7=[];var _0x26a5cd=squel[_0xd732('0x80')]();_0x26a5cd[_0xd732('0x81')](_0xd732('0x82'))[_0xd732('0x83')]('team_has_chat_queues','tq')[_0xd732('0x84')](_0xd732('0x85'),'ut',_0xd732('0x86'))[_0xd732('0x50')](_0xd732('0x87'),_0xb62ad8[_0xd732('0x59')]['id']);for(var _0xcc39f2=0x0;_0xcc39f2<_0x33f738['length'];_0xcc39f2+=0x1){let _0x5f3843=_0x33f738[_0xcc39f2];for(var _0x40f96d=0x0;_0x40f96d<_0x5f3843['Agents'][_0xd732('0x4c')];_0x40f96d+=0x1){let _0x1c8c88=_0x5f3843[_0xd732('0x7f')][_0x40f96d];var _0x24d231=_0x26a5cd[_0xd732('0x88')]();_0x24d231['where']('ut.UserId\x20=\x20?',_0x1c8c88['id']);_0x5141a7[_0xd732('0x89')](db[_0xd732('0x7a')]['query'](_0x24d231[_0xd732('0x8a')](),{'type':db[_0xd732('0x7a')][_0xd732('0x8b')]['SELECT']})['then'](function(_0x2c84be){if(_0x2c84be[_0xd732('0x4c')]===0x1){return _0x1c8c88['id'];}else{var _0x41e83f=_[_0xd732('0x8c')](_[_0xd732('0x41')](_0x2c84be,_0xd732('0x8d')),function(_0x385e12){return _[_0xd732('0x8e')](_0x3eb2a1,_0x385e12);});if(_0x41e83f){return _0x1c8c88['id'];}}}));}}return BPromise[_0xd732('0x8f')](_0x5141a7)[_0xd732('0x25')](function(_0x1adba9){_0x30d68a=_(_0x30d68a)[_0xd732('0x90')](_0x1adba9)[_0xd732('0x91')]()[_0xd732('0x92')]();return db['ChatQueue']['find']({'where':{'id':_0xb62ad8['params']['id']}})['then'](function(_0x9eae3){return db['sequelize'][_0xd732('0x7b')](function(_0x473b9c){return _0x9eae3['removeTeams'](_0xb62ad8[_0xd732('0x47')][_0xd732('0x76')],{'transaction':_0x473b9c})[_0xd732('0x25')](function(){if(!_['isEmpty'](_0x30d68a)){return _0x9eae3[_0xd732('0x93')](_0x30d68a,{'transaction':_0x473b9c});}})[_0xd732('0x25')](function(){_0x30d68a['forEach'](function(_0x34178d){socket['emit']('userChatQueue:remove',{'UserId':_0x34178d,'ChatQueueId':_0x9eae3['id']});});});});});});})[_0xd732('0x25')](respondWithStatusCode(_0x1b99b8,null))[_0xd732('0x2f')](handleError(_0x1b99b8,null));};exports[_0xd732('0x94')]=function(_0x42221e,_0x4657a4,_0x560265){return db['ChatQueue'][_0xd732('0x5f')]({'where':{'id':_0x42221e[_0xd732('0x59')]['id']}})[_0xd732('0x25')](handleEntityNotFound(_0x4657a4,null))[_0xd732('0x25')](function(_0x2fdb0a){if(_0x2fdb0a){return _0x2fdb0a[_0xd732('0x94')](_0x42221e['body']['ids'],_['omit'](_0x42221e[_0xd732('0x5b')],[_0xd732('0x76'),'id'])||{})['spread'](function(_0xc661b6){for(var _0x34e6da=0x0;_0x34e6da<_0x42221e[_0xd732('0x5b')][_0xd732('0x76')][_0xd732('0x4c')];_0x34e6da+=0x1){socket[_0xd732('0x7d')](_0xd732('0x95'),{'UserId':Number(_0x42221e[_0xd732('0x5b')][_0xd732('0x76')][_0x34e6da]),'ChatQueueId':Number(_0x42221e[_0xd732('0x59')]['id'])});}return _0xc661b6;});}})[_0xd732('0x25')](respondWithResult(_0x4657a4,null))['catch'](handleError(_0x4657a4,null));};exports['removeAgents']=function(_0x20a3dc,_0x51b4b5,_0x90128c){return db['ChatQueue'][_0xd732('0x5f')]({'where':{'id':_0x20a3dc[_0xd732('0x59')]['id']}})['then'](handleEntityNotFound(_0x51b4b5,null))[_0xd732('0x25')](function(_0x5b0eec){if(_0x5b0eec){return _0x5b0eec[_0xd732('0x93')](_0x20a3dc[_0xd732('0x47')][_0xd732('0x76')])[_0xd732('0x25')](function(){if(_[_0xd732('0x96')](_0x20a3dc[_0xd732('0x47')][_0xd732('0x76')])){for(var _0x3f257d=0x0;_0x3f257d<_0x20a3dc[_0xd732('0x47')]['ids']['length'];_0x3f257d+=0x1){socket[_0xd732('0x7d')](_0xd732('0x97'),{'UserId':Number(_0x20a3dc[_0xd732('0x47')]['ids'][_0x3f257d]),'ChatQueueId':Number(_0x20a3dc[_0xd732('0x59')]['id'])});}}else{socket[_0xd732('0x7d')](_0xd732('0x97'),{'UserId':Number(_0x20a3dc['query'][_0xd732('0x76')]),'ChatQueueId':Number(_0x20a3dc[_0xd732('0x59')]['id'])});}});}})[_0xd732('0x25')](respondWithStatusCode(_0x51b4b5,null))[_0xd732('0x2f')](handleError(_0x51b4b5,null));};exports[_0xd732('0x98')]=function(_0x5131d7,_0xe001eb,_0x3541af){var _0xdfe7d9={};var _0x58c85e={};var _0x4b7590;var _0x2a39ac;return db[_0xd732('0x42')]['findOne']({'where':{'id':_0x5131d7['params']['id']}})[_0xd732('0x25')](handleEntityNotFound(_0xe001eb,null))[_0xd732('0x25')](function(_0x3261af){if(_0x3261af){_0x4b7590=_0x3261af;_0x58c85e[_0xd732('0x45')]=_['keys'](db[_0xd732('0x6a')][_0xd732('0x43')]);_0x58c85e[_0xd732('0x47')]=_[_0xd732('0x46')](_0x5131d7['query']);_0x58c85e[_0xd732('0x48')]=_[_0xd732('0x4a')](_0x58c85e['model'],_0x58c85e[_0xd732('0x47')]);_0xdfe7d9['attributes']=_[_0xd732('0x4a')](_0x58c85e[_0xd732('0x45')],qs[_0xd732('0x4b')](_0x5131d7[_0xd732('0x47')][_0xd732('0x4b')]));_0xdfe7d9[_0xd732('0x49')]=_0xdfe7d9[_0xd732('0x49')][_0xd732('0x4c')]?_0xdfe7d9[_0xd732('0x49')]:_0x58c85e[_0xd732('0x45')];_0xdfe7d9['order']=qs[_0xd732('0x67')](_0x5131d7['query']['sort']);_0xdfe7d9['where']=qs[_0xd732('0x48')](_['pick'](_0x5131d7[_0xd732('0x47')],_0x58c85e[_0xd732('0x48')]));if(_0x5131d7[_0xd732('0x47')][_0xd732('0x52')]){_0xdfe7d9['where']=_['merge'](_0xdfe7d9[_0xd732('0x50')],{'$or':_[_0xd732('0x41')](_0xdfe7d9['attributes'],function(_0x320977){var _0x3ce90e={};_0x3ce90e[_0x320977]={'$like':'%'+_0x5131d7[_0xd732('0x47')][_0xd732('0x52')]+'%'};return _0x3ce90e;})});}_0xdfe7d9=_['merge']({},_0xdfe7d9,_0x5131d7[_0xd732('0x55')]);return _0x4b7590[_0xd732('0x98')](_0xdfe7d9);}})[_0xd732('0x25')](function(_0x4db66d){if(_0x4db66d){_0x2a39ac=_0x4db66d[_0xd732('0x4c')];if(!_0x5131d7[_0xd732('0x47')][_0xd732('0x4d')]('nolimit')){_0xdfe7d9['limit']=qs[_0xd732('0x35')](_0x5131d7[_0xd732('0x47')][_0xd732('0x35')]);_0xdfe7d9[_0xd732('0x33')]=qs[_0xd732('0x33')](_0x5131d7[_0xd732('0x47')][_0xd732('0x33')]);}return _0x4b7590[_0xd732('0x98')](_0xdfe7d9);}})[_0xd732('0x25')](function(_0x4e21a5){if(_0x4e21a5){return _0x4e21a5?{'count':_0x2a39ac,'rows':_0x4e21a5}:null;}})[_0xd732('0x25')](respondWithResult(_0xe001eb,null))[_0xd732('0x2f')](handleError(_0xe001eb,null));}; \ No newline at end of file +var _0xacd9=['ids','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','push','sequelize','QueryTypes','every','TeamId','all','union','compact','value','isEmpty','removeAgents','addAgents','omit','spread','isArray','userChatQueue:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','jayson/promise','client','http','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','destroy','ChatQueues','UserProfileResource','name','index','map','ChatQueue','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','rows','show','params','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','update','body','describe','getMembers','findOne','UserChatQueue','findAll','User','findAndCountAll','UserId','agent','chatPause','%s/%s','SIP','createdAt','updatedAt','Team','getTeams','addTeams','Agents','online','voicePause','interface','flatMap','transaction','each','findOrCreate','forEach','emit','userChatQueue:save','removeTeams'];(function(_0x810e4d,_0x909ef4){var _0x13f01c=function(_0x12fd89){while(--_0x12fd89){_0x810e4d['push'](_0x810e4d['shift']());}};_0x13f01c(++_0x909ef4);}(_0xacd9,0x150));var _0x9acd=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0xacd9[_0x934425];return _0x31d596;};'use strict';var emlformat=require(_0x9acd('0x0'));var rimraf=require(_0x9acd('0x1'));var zipdir=require(_0x9acd('0x2'));var jsonpatch=require(_0x9acd('0x3'));var rp=require(_0x9acd('0x4'));var moment=require(_0x9acd('0x5'));var BPromise=require(_0x9acd('0x6'));var Mustache=require(_0x9acd('0x7'));var util=require(_0x9acd('0x8'));var path=require(_0x9acd('0x9'));var sox=require('sox');var csv=require(_0x9acd('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9acd('0xb'));var _=require(_0x9acd('0xc'));var squel=require('squel');var crypto=require(_0x9acd('0xd'));var jsforce=require(_0x9acd('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x9acd('0xa'));var querystring=require('querystring');var Papa=require(_0x9acd('0xf'));var Redis=require(_0x9acd('0x10'));var authService=require(_0x9acd('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x9acd('0x12'));var hardwareService=require(_0x9acd('0x13'));var logger=require(_0x9acd('0x14'))(_0x9acd('0x15'));var utils=require(_0x9acd('0x16'));var config=require(_0x9acd('0x17'));var licenseUtil=require(_0x9acd('0x18'));var db=require(_0x9acd('0x19'))['db'];config[_0x9acd('0x1a')]=_[_0x9acd('0x1b')](config[_0x9acd('0x1a')],{'host':_0x9acd('0x1c'),'port':0x18eb});var socket=require(_0x9acd('0x1d'))(new Redis(config[_0x9acd('0x1a')]));require(_0x9acd('0x1e'))['register'](socket);var jayson=require(_0x9acd('0x1f'));var client=jayson[_0x9acd('0x20')][_0x9acd('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x56293b,_0x4c369b,_0x436e3f,_0x726eb9){return new BPromise(function(_0x115a5b,_0x394993){var _0x14d92c=_0x726eb9||client;return _0x14d92c[_0x9acd('0x22')](_0x56293b,_0x436e3f)[_0x9acd('0x23')](function(_0x5afed0){logger[_0x9acd('0x24')](_0x9acd('0x25'),_0x4c369b,_0x9acd('0x26'));logger[_0x9acd('0x27')](_0x9acd('0x28'),_0x4c369b,_0x9acd('0x26'),JSON[_0x9acd('0x29')](_0x5afed0));if(_0x5afed0[_0x9acd('0x2a')]){if(_0x5afed0[_0x9acd('0x2a')][_0x9acd('0x2b')]===0x1f4){logger['error']('ChatQueue,\x20%s,\x20%s',_0x4c369b,_0x5afed0[_0x9acd('0x2a')][_0x9acd('0x2c')]);return _0x394993(_0x5afed0['error'][_0x9acd('0x2c')]);}logger['error']('ChatQueue,\x20%s,\x20%s',_0x4c369b,_0x5afed0[_0x9acd('0x2a')][_0x9acd('0x2c')]);return _0x115a5b(_0x5afed0['error']['message']);}else{logger[_0x9acd('0x24')](_0x9acd('0x25'),_0x4c369b,_0x9acd('0x26'));_0x115a5b(_0x5afed0['result'][_0x9acd('0x2c')]);}})[_0x9acd('0x2d')](function(_0x5cb1fb){logger[_0x9acd('0x2a')](_0x9acd('0x25'),_0x4c369b,_0x5cb1fb);_0x394993(_0x5cb1fb);});});}function respondWithStatusCode(_0x2487b2,_0x2ba3c5){_0x2ba3c5=_0x2ba3c5||0xcc;return function(_0x1c15aa){if(_0x1c15aa){return _0x2487b2['sendStatus'](_0x2ba3c5);}return _0x2487b2[_0x9acd('0x2e')](_0x2ba3c5)[_0x9acd('0x2f')]();};}function respondWithResult(_0x3a4c0a,_0x5eea3f){_0x5eea3f=_0x5eea3f||0xc8;return function(_0x1225ac){if(_0x1225ac){return _0x3a4c0a['status'](_0x5eea3f)[_0x9acd('0x30')](_0x1225ac);}};}function respondWithFilteredResult(_0x2f8132,_0x3245c5){return function(_0x3f8d3b){if(_0x3f8d3b){var _0x3fb80f=typeof _0x3245c5[_0x9acd('0x31')]===_0x9acd('0x32')&&typeof _0x3245c5[_0x9acd('0x33')]===_0x9acd('0x32');var _0x36400a=_0x3f8d3b[_0x9acd('0x34')];var _0x209d58=_0x3fb80f?0x0:_0x3245c5['offset'];var _0x55c31b=_0x3fb80f?_0x3f8d3b[_0x9acd('0x34')]:_0x3245c5[_0x9acd('0x31')]+_0x3245c5[_0x9acd('0x33')];var _0x1e94e6;if(_0x55c31b>=_0x36400a){_0x55c31b=_0x36400a;_0x1e94e6=0xc8;}else{_0x1e94e6=0xce;}_0x2f8132['status'](_0x1e94e6);return _0x2f8132[_0x9acd('0x35')](_0x9acd('0x36'),_0x209d58+'-'+_0x55c31b+'/'+_0x36400a)[_0x9acd('0x30')](_0x3f8d3b);}return null;};}function patchUpdates(_0x4599a9){return function(_0x5a59c4){try{jsonpatch[_0x9acd('0x37')](_0x5a59c4,_0x4599a9,!![]);}catch(_0x50b2d2){return BPromise[_0x9acd('0x38')](_0x50b2d2);}return _0x5a59c4['save']();};}function saveUpdates(_0x3c639c,_0x49df31){return function(_0x21b84e){if(_0x21b84e){return _0x21b84e['update'](_0x3c639c)[_0x9acd('0x23')](function(_0x2d3a79){return _0x2d3a79;});}return null;};}function removeEntity(_0x1f1847,_0x270b61){return function(_0x11a0cf){if(_0x11a0cf){return _0x11a0cf[_0x9acd('0x39')]()[_0x9acd('0x23')](function(){var _0x25d9e4=_0x11a0cf['get']({'plain':!![]});var _0x141659=_0x9acd('0x3a');return db[_0x9acd('0x3b')][_0x9acd('0x39')]({'where':{'type':_0x141659,'resourceId':_0x25d9e4['id']}})[_0x9acd('0x23')](function(){return _0x11a0cf;});})[_0x9acd('0x23')](function(){_0x1f1847[_0x9acd('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b646c,_0x4fe471){return function(_0x17064d){if(!_0x17064d){_0x2b646c['sendStatus'](0x194);}return _0x17064d;};}function handleError(_0x17a31a,_0x545c47){_0x545c47=_0x545c47||0x1f4;return function(_0x11867e){logger['error'](_0x11867e['stack']);if(_0x11867e[_0x9acd('0x3c')]){delete _0x11867e[_0x9acd('0x3c')];}_0x17a31a[_0x9acd('0x2e')](_0x545c47)['send'](_0x11867e);};}exports[_0x9acd('0x3d')]=function(_0x3a9e41,_0x11c0e1){var _0x3a7033={},_0x52e40a={},_0xf0aa8f={'count':0x0,'rows':[]};var _0x145bd0=_[_0x9acd('0x3e')](db[_0x9acd('0x3f')][_0x9acd('0x40')],function(_0x330516){return{'name':_0x330516[_0x9acd('0x41')],'type':_0x330516[_0x9acd('0x42')][_0x9acd('0x43')]};});_0x52e40a[_0x9acd('0x44')]=_['map'](_0x145bd0,_0x9acd('0x3c'));_0x52e40a[_0x9acd('0x45')]=_[_0x9acd('0x46')](_0x3a9e41[_0x9acd('0x45')]);_0x52e40a[_0x9acd('0x47')]=_[_0x9acd('0x48')](_0x52e40a[_0x9acd('0x44')],_0x52e40a[_0x9acd('0x45')]);_0x3a7033['attributes']=_['intersection'](_0x52e40a[_0x9acd('0x44')],qs[_0x9acd('0x49')](_0x3a9e41[_0x9acd('0x45')][_0x9acd('0x49')]));_0x3a7033[_0x9acd('0x4a')]=_0x3a7033[_0x9acd('0x4a')][_0x9acd('0x4b')]?_0x3a7033[_0x9acd('0x4a')]:_0x52e40a[_0x9acd('0x44')];if(!_0x3a9e41[_0x9acd('0x45')][_0x9acd('0x4c')](_0x9acd('0x4d'))){_0x3a7033[_0x9acd('0x33')]=qs[_0x9acd('0x33')](_0x3a9e41[_0x9acd('0x45')][_0x9acd('0x33')]);_0x3a7033[_0x9acd('0x31')]=qs[_0x9acd('0x31')](_0x3a9e41['query'][_0x9acd('0x31')]);}_0x3a7033[_0x9acd('0x4e')]=qs[_0x9acd('0x4f')](_0x3a9e41[_0x9acd('0x45')][_0x9acd('0x4f')]);_0x3a7033[_0x9acd('0x50')]=qs[_0x9acd('0x47')](_[_0x9acd('0x51')](_0x3a9e41[_0x9acd('0x45')],_0x52e40a[_0x9acd('0x47')]),_0x145bd0);if(_0x3a9e41[_0x9acd('0x45')][_0x9acd('0x52')]){_0x3a7033[_0x9acd('0x50')]=_[_0x9acd('0x53')](_0x3a7033[_0x9acd('0x50')],{'$or':_['map'](_0x145bd0,function(_0x35680a){if(_0x35680a[_0x9acd('0x42')]!=='VIRTUAL'){var _0x5793d1={};_0x5793d1[_0x35680a[_0x9acd('0x3c')]]={'$like':'%'+_0x3a9e41['query']['filter']+'%'};return _0x5793d1;}})});}_0x3a7033=_[_0x9acd('0x53')]({},_0x3a7033,_0x3a9e41[_0x9acd('0x54')]);var _0x45d17c={'where':_0x3a7033['where']};return db['ChatQueue'][_0x9acd('0x34')](_0x45d17c)['then'](function(_0x31b63e){_0xf0aa8f['count']=_0x31b63e;if(_0x3a9e41[_0x9acd('0x45')][_0x9acd('0x55')]){_0x3a7033[_0x9acd('0x56')]=[{'all':!![]}];}return db['ChatQueue']['findAll'](_0x3a7033);})[_0x9acd('0x23')](function(_0x12c66d){_0xf0aa8f[_0x9acd('0x57')]=_0x12c66d;return _0xf0aa8f;})['then'](respondWithFilteredResult(_0x11c0e1,_0x3a7033))[_0x9acd('0x2d')](handleError(_0x11c0e1,null));};exports[_0x9acd('0x58')]=function(_0x5ab0be,_0x4a7b4f){var _0x437b33={'raw':!![],'where':{'id':_0x5ab0be[_0x9acd('0x59')]['id']}},_0x2b95a2={};_0x2b95a2[_0x9acd('0x44')]=_[_0x9acd('0x46')](db[_0x9acd('0x3f')][_0x9acd('0x40')]);_0x2b95a2[_0x9acd('0x45')]=_[_0x9acd('0x46')](_0x5ab0be['query']);_0x2b95a2[_0x9acd('0x47')]=_[_0x9acd('0x48')](_0x2b95a2['model'],_0x2b95a2[_0x9acd('0x45')]);_0x437b33[_0x9acd('0x4a')]=_['intersection'](_0x2b95a2['model'],qs[_0x9acd('0x49')](_0x5ab0be[_0x9acd('0x45')][_0x9acd('0x49')]));_0x437b33['attributes']=_0x437b33[_0x9acd('0x4a')][_0x9acd('0x4b')]?_0x437b33['attributes']:_0x2b95a2['model'];if(_0x5ab0be['query'][_0x9acd('0x55')]){_0x437b33[_0x9acd('0x56')]=[{'all':!![]}];}_0x437b33=_[_0x9acd('0x53')]({},_0x437b33,_0x5ab0be[_0x9acd('0x54')]);return db[_0x9acd('0x3f')][_0x9acd('0x5a')](_0x437b33)[_0x9acd('0x23')](handleEntityNotFound(_0x4a7b4f,null))[_0x9acd('0x23')](respondWithResult(_0x4a7b4f,null))[_0x9acd('0x2d')](handleError(_0x4a7b4f,null));};exports['create']=function(_0xedf774,_0x366815){return db[_0x9acd('0x3f')][_0x9acd('0x5b')](_0xedf774['body'],{})[_0x9acd('0x23')](function(_0x5628ac){var _0x24fcef=_0xedf774[_0x9acd('0x5c')][_0x9acd('0x5d')]({'plain':!![]});if(!_0x24fcef)throw new Error(_0x9acd('0x5e'));if(_0x24fcef['role']===_0x9acd('0x5c')){var _0x1a10f5=_0x5628ac[_0x9acd('0x5d')]({'plain':!![]});var _0x4958f5=_0x9acd('0x3a');return db[_0x9acd('0x5f')]['find']({'where':{'name':_0x4958f5,'userProfileId':_0x24fcef[_0x9acd('0x60')]},'raw':!![]})['then'](function(_0x4c02db){if(_0x4c02db&&_0x4c02db[_0x9acd('0x61')]===0x0){return db['UserProfileResource'][_0x9acd('0x5b')]({'name':_0x1a10f5[_0x9acd('0x3c')],'resourceId':_0x1a10f5['id'],'type':_0x4c02db['name'],'sectionId':_0x4c02db['id']},{})[_0x9acd('0x23')](function(){return _0x5628ac;});}else{return _0x5628ac;}})[_0x9acd('0x2d')](function(_0x249ee5){logger[_0x9acd('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x249ee5);throw _0x249ee5;});}return _0x5628ac;})[_0x9acd('0x23')](respondWithResult(_0x366815,0xc9))[_0x9acd('0x2d')](handleError(_0x366815,null));};exports[_0x9acd('0x62')]=function(_0xa4faa6,_0x388ae2){if(_0xa4faa6[_0x9acd('0x63')]['id']){delete _0xa4faa6[_0x9acd('0x63')]['id'];}return db[_0x9acd('0x3f')]['find']({'where':{'id':_0xa4faa6[_0x9acd('0x59')]['id']}})[_0x9acd('0x23')](handleEntityNotFound(_0x388ae2,null))[_0x9acd('0x23')](saveUpdates(_0xa4faa6['body'],null))[_0x9acd('0x23')](respondWithResult(_0x388ae2,null))[_0x9acd('0x2d')](handleError(_0x388ae2,null));};exports['destroy']=function(_0xbaa1fd,_0x2ca32c){return db[_0x9acd('0x3f')][_0x9acd('0x5a')]({'where':{'id':_0xbaa1fd[_0x9acd('0x59')]['id']}})[_0x9acd('0x23')](handleEntityNotFound(_0x2ca32c,null))[_0x9acd('0x23')](removeEntity(_0x2ca32c,null))['catch'](handleError(_0x2ca32c,null));};exports[_0x9acd('0x64')]=function(_0x5e24e3,_0x327dce){return db[_0x9acd('0x3f')]['describe']()[_0x9acd('0x23')](respondWithResult(_0x327dce,null))[_0x9acd('0x2d')](handleError(_0x327dce,null));};exports[_0x9acd('0x65')]=function(_0x28071c,_0x2a7df0,_0x331bb2){var _0x341333={'raw':!![],'where':{}},_0x519fd9={},_0x4dc4e8;return db[_0x9acd('0x3f')][_0x9acd('0x66')]({'where':{'id':_0x28071c['params']['id']}})[_0x9acd('0x23')](handleEntityNotFound(_0x2a7df0,null))[_0x9acd('0x23')](function(_0x4d39cd){if(_0x4d39cd){_0x4dc4e8=_0x4d39cd['get']({'plain':!![]});_0x519fd9[_0x9acd('0x44')]=_[_0x9acd('0x46')](db[_0x9acd('0x67')][_0x9acd('0x40')]);_0x519fd9[_0x9acd('0x45')]=_[_0x9acd('0x46')](_0x28071c[_0x9acd('0x45')]);_0x519fd9['filters']=_[_0x9acd('0x48')](_0x519fd9['model'],_0x519fd9[_0x9acd('0x45')]);_0x341333[_0x9acd('0x4a')]=_[_0x9acd('0x48')](_0x519fd9[_0x9acd('0x44')],qs['fields'](_0x28071c[_0x9acd('0x45')][_0x9acd('0x49')]));_0x341333['attributes']=_0x341333[_0x9acd('0x4a')][_0x9acd('0x4b')]?_0x341333[_0x9acd('0x4a')]:_0x519fd9[_0x9acd('0x44')];if(!_0x28071c['query'][_0x9acd('0x4c')](_0x9acd('0x4d'))){_0x341333['limit']=qs[_0x9acd('0x33')](_0x28071c['query'][_0x9acd('0x33')]);_0x341333[_0x9acd('0x31')]=qs['offset'](_0x28071c['query'][_0x9acd('0x31')]);}_0x341333[_0x9acd('0x4e')]=qs[_0x9acd('0x4f')](_0x28071c['query'][_0x9acd('0x4f')]);_0x341333['where']=qs[_0x9acd('0x47')](_[_0x9acd('0x51')](_0x28071c[_0x9acd('0x45')],_0x519fd9[_0x9acd('0x47')]));_0x341333[_0x9acd('0x50')]['ChatQueueId']=_0x4d39cd['id'];if(_0x28071c[_0x9acd('0x45')][_0x9acd('0x52')]){_0x341333[_0x9acd('0x50')]=_['merge'](_0x341333[_0x9acd('0x50')],{'$or':_[_0x9acd('0x3e')](_0x341333['attributes'],function(_0xfcb899){var _0x1ab597={};_0x1ab597[_0xfcb899]={'$like':'%'+_0x28071c[_0x9acd('0x45')][_0x9acd('0x52')]+'%'};return _0x1ab597;})});}_0x341333=_[_0x9acd('0x53')]({},_0x341333,_0x28071c[_0x9acd('0x54')]);return db[_0x9acd('0x67')][_0x9acd('0x68')](_0x341333);}})[_0x9acd('0x23')](function(_0x5c6b7d){if(_0x5c6b7d){return db[_0x9acd('0x69')][_0x9acd('0x6a')]({'where':{'id':_['map'](_0x5c6b7d,_0x9acd('0x6b')),'role':_0x9acd('0x6c')},'attributes':['id',_0x9acd('0x3c'),_0x9acd('0x6d'),'updatedAt','createdAt']});}})[_0x9acd('0x23')](function(_0x37b046){if(_0x37b046){return{'count':_0x37b046['count'],'rows':_['map'](_0x37b046[_0x9acd('0x57')],function(_0x3b3466){return{'membername':_0x3b3466[_0x9acd('0x3c')],'UserId':_0x3b3466['id'],'queue_name':_0x4dc4e8[_0x9acd('0x3c')],'ChatQueueId':_0x4dc4e8['id'],'interface':util['format'](_0x9acd('0x6e'),_0x9acd('0x6f'),_0x3b3466[_0x9acd('0x3c')]),'penalty':0x0,'paused':_0x3b3466[_0x9acd('0x6d')],'createdAt':_0x3b3466[_0x9acd('0x70')],'updatedAt':_0x3b3466[_0x9acd('0x71')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x9acd('0x23')](respondWithFilteredResult(_0x2a7df0,_0x341333))[_0x9acd('0x2d')](handleError(_0x2a7df0,null));};exports['getTeams']=function(_0x3a8ed6,_0x3523c6,_0xadffb7){var _0x282418={};var _0x25027e={};var _0x1f29ca;var _0x4479f9;return db[_0x9acd('0x3f')][_0x9acd('0x66')]({'where':{'id':_0x3a8ed6[_0x9acd('0x59')]['id']}})[_0x9acd('0x23')](handleEntityNotFound(_0x3523c6,null))[_0x9acd('0x23')](function(_0xd9a09c){if(_0xd9a09c){_0x1f29ca=_0xd9a09c;_0x25027e[_0x9acd('0x44')]=_[_0x9acd('0x46')](db[_0x9acd('0x72')][_0x9acd('0x40')]);_0x25027e[_0x9acd('0x45')]=_[_0x9acd('0x46')](_0x3a8ed6[_0x9acd('0x45')]);_0x25027e['filters']=_[_0x9acd('0x48')](_0x25027e[_0x9acd('0x44')],_0x25027e['query']);_0x282418[_0x9acd('0x4a')]=_[_0x9acd('0x48')](_0x25027e[_0x9acd('0x44')],qs[_0x9acd('0x49')](_0x3a8ed6[_0x9acd('0x45')]['fields']));_0x282418[_0x9acd('0x4a')]=_0x282418['attributes'][_0x9acd('0x4b')]?_0x282418['attributes']:_0x25027e[_0x9acd('0x44')];_0x282418[_0x9acd('0x4e')]=qs[_0x9acd('0x4f')](_0x3a8ed6[_0x9acd('0x45')][_0x9acd('0x4f')]);_0x282418[_0x9acd('0x50')]=qs[_0x9acd('0x47')](_[_0x9acd('0x51')](_0x3a8ed6[_0x9acd('0x45')],_0x25027e[_0x9acd('0x47')]));if(_0x3a8ed6[_0x9acd('0x45')][_0x9acd('0x52')]){_0x282418[_0x9acd('0x50')]=_[_0x9acd('0x53')](_0x282418[_0x9acd('0x50')],{'$or':_[_0x9acd('0x3e')](_0x282418['attributes'],function(_0x13d9d8){var _0x2d456b={};_0x2d456b[_0x13d9d8]={'$like':'%'+_0x3a8ed6[_0x9acd('0x45')][_0x9acd('0x52')]+'%'};return _0x2d456b;})});}_0x282418=_[_0x9acd('0x53')]({},_0x282418,_0x3a8ed6['options']);return _0x1f29ca['getTeams'](_0x282418);}})[_0x9acd('0x23')](function(_0x5aef6e){if(_0x5aef6e){_0x4479f9=_0x5aef6e[_0x9acd('0x4b')];if(!_0x3a8ed6[_0x9acd('0x45')][_0x9acd('0x4c')]('nolimit')){_0x282418[_0x9acd('0x33')]=qs[_0x9acd('0x33')](_0x3a8ed6[_0x9acd('0x45')][_0x9acd('0x33')]);_0x282418[_0x9acd('0x31')]=qs[_0x9acd('0x31')](_0x3a8ed6[_0x9acd('0x45')][_0x9acd('0x31')]);}return _0x1f29ca[_0x9acd('0x73')](_0x282418);}})['then'](function(_0x14974e){if(_0x14974e){return _0x14974e?{'count':_0x4479f9,'rows':_0x14974e}:null;}})[_0x9acd('0x23')](respondWithResult(_0x3523c6,null))[_0x9acd('0x2d')](handleError(_0x3523c6,null));};exports[_0x9acd('0x74')]=function(_0x272271,_0x59c36a,_0x293461){var _0x5dad9a=_0x272271[_0x9acd('0x63')]['ids'];return db[_0x9acd('0x72')][_0x9acd('0x68')]({'where':{'id':_0x5dad9a},'attributes':['id'],'include':[{'model':db[_0x9acd('0x69')],'as':_0x9acd('0x75'),'attributes':['id',_0x9acd('0x3c'),_0x9acd('0x76'),_0x9acd('0x77'),_0x9acd('0x78')],'raw':!![]}]})[_0x9acd('0x23')](function(_0x5b0c13){if(_0x5b0c13){var _0x3d64ef=_[_0x9acd('0x79')](_0x5b0c13,function(_0x42f8b7){var _0x4b999d=_0x42f8b7['get']({'plain':!![]});return _0x4b999d[_0x9acd('0x75')];});return db[_0x9acd('0x3f')][_0x9acd('0x5a')]({'where':{'id':_0x272271[_0x9acd('0x59')]['id']}})[_0x9acd('0x23')](function(_0x25bcd4){return db['sequelize'][_0x9acd('0x7a')](function(_0x4d52f0){return _0x25bcd4[_0x9acd('0x74')](_0x5dad9a,{'transaction':_0x4d52f0})[_0x9acd('0x23')](function(){return BPromise[_0x9acd('0x7b')](_0x3d64ef,function(_0xbbaf19){return db['UserChatQueue'][_0x9acd('0x7c')]({'where':{'UserId':_0xbbaf19['id'],'ChatQueueId':_0x272271[_0x9acd('0x59')]['id']},'transaction':_0x4d52f0});});})[_0x9acd('0x23')](function(){_0x3d64ef[_0x9acd('0x7d')](function(_0x581b2c){socket[_0x9acd('0x7e')](_0x9acd('0x7f'),{'UserId':_0x581b2c['id'],'ChatQueueId':_0x25bcd4['id']});});});});});}})[_0x9acd('0x23')](respondWithStatusCode(_0x59c36a,null))[_0x9acd('0x2d')](handleError(_0x59c36a,null));};exports[_0x9acd('0x80')]=function(_0x5af89f,_0x1e8b2b,_0x3183b5){return db[_0x9acd('0x72')]['findAll']({'where':{'id':_0x5af89f[_0x9acd('0x45')][_0x9acd('0x81')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x9acd('0x75'),'attributes':['id'],'raw':!![]}]})[_0x9acd('0x23')](handleEntityNotFound(_0x1e8b2b,null))['then'](function(_0x8c0163){var _0x21a02b=_['map'](_0x8c0163,'id');var _0x978369=[];var _0x46bef8=[];var _0x521666=squel['select']();_0x521666[_0x9acd('0x82')](_0x9acd('0x83'))[_0x9acd('0x84')]('team_has_chat_queues','tq')[_0x9acd('0x85')](_0x9acd('0x86'),'ut',_0x9acd('0x87'))[_0x9acd('0x50')](_0x9acd('0x88'),_0x5af89f[_0x9acd('0x59')]['id']);for(var _0x1c27eb=0x0;_0x1c27eb<_0x8c0163[_0x9acd('0x4b')];_0x1c27eb+=0x1){let _0x15e778=_0x8c0163[_0x1c27eb];for(var _0x5483f5=0x0;_0x5483f5<_0x15e778['Agents']['length'];_0x5483f5+=0x1){let _0x188da7=_0x15e778['Agents'][_0x5483f5];var _0x386552=_0x521666[_0x9acd('0x89')]();_0x386552[_0x9acd('0x50')]('ut.UserId\x20=\x20?',_0x188da7['id']);_0x46bef8[_0x9acd('0x8a')](db[_0x9acd('0x8b')][_0x9acd('0x45')](_0x386552['toString'](),{'type':db['sequelize'][_0x9acd('0x8c')]['SELECT']})[_0x9acd('0x23')](function(_0x10f8b6){if(_0x10f8b6[_0x9acd('0x4b')]===0x1){return _0x188da7['id'];}else{var _0x4c8fea=_[_0x9acd('0x8d')](_[_0x9acd('0x3e')](_0x10f8b6,_0x9acd('0x8e')),function(_0x2788cb){return _['includes'](_0x21a02b,_0x2788cb);});if(_0x4c8fea){return _0x188da7['id'];}}}));}}return BPromise[_0x9acd('0x8f')](_0x46bef8)['then'](function(_0x12f589){_0x978369=_(_0x978369)[_0x9acd('0x90')](_0x12f589)[_0x9acd('0x91')]()[_0x9acd('0x92')]();return db[_0x9acd('0x3f')]['find']({'where':{'id':_0x5af89f[_0x9acd('0x59')]['id']}})['then'](function(_0x284b0a){return db['sequelize'][_0x9acd('0x7a')](function(_0x29a830){return _0x284b0a[_0x9acd('0x80')](_0x5af89f['query'][_0x9acd('0x81')],{'transaction':_0x29a830})[_0x9acd('0x23')](function(){if(!_[_0x9acd('0x93')](_0x978369)){return _0x284b0a[_0x9acd('0x94')](_0x978369,{'transaction':_0x29a830});}})['then'](function(){_0x978369[_0x9acd('0x7d')](function(_0x2c578e){socket[_0x9acd('0x7e')]('userChatQueue:remove',{'UserId':_0x2c578e,'ChatQueueId':_0x284b0a['id']});});});});});});})[_0x9acd('0x23')](respondWithStatusCode(_0x1e8b2b,null))[_0x9acd('0x2d')](handleError(_0x1e8b2b,null));};exports[_0x9acd('0x95')]=function(_0x5ec909,_0x5f1189,_0x9d5db7){return db[_0x9acd('0x3f')][_0x9acd('0x5a')]({'where':{'id':_0x5ec909[_0x9acd('0x59')]['id']}})['then'](handleEntityNotFound(_0x5f1189,null))['then'](function(_0xa3038c){if(_0xa3038c){return _0xa3038c[_0x9acd('0x95')](_0x5ec909[_0x9acd('0x63')][_0x9acd('0x81')],_[_0x9acd('0x96')](_0x5ec909[_0x9acd('0x63')],[_0x9acd('0x81'),'id'])||{})[_0x9acd('0x97')](function(_0x514e24){for(var _0x3029ca=0x0;_0x3029ca<_0x5ec909['body'][_0x9acd('0x81')]['length'];_0x3029ca+=0x1){socket[_0x9acd('0x7e')](_0x9acd('0x7f'),{'UserId':Number(_0x5ec909[_0x9acd('0x63')][_0x9acd('0x81')][_0x3029ca]),'ChatQueueId':Number(_0x5ec909[_0x9acd('0x59')]['id'])});}return _0x514e24;});}})[_0x9acd('0x23')](respondWithResult(_0x5f1189,null))[_0x9acd('0x2d')](handleError(_0x5f1189,null));};exports['removeAgents']=function(_0x6b594,_0x2a5a83,_0x548bbf){return db[_0x9acd('0x3f')][_0x9acd('0x5a')]({'where':{'id':_0x6b594[_0x9acd('0x59')]['id']}})[_0x9acd('0x23')](handleEntityNotFound(_0x2a5a83,null))[_0x9acd('0x23')](function(_0x78ee31){if(_0x78ee31){return _0x78ee31['removeAgents'](_0x6b594[_0x9acd('0x45')][_0x9acd('0x81')])['then'](function(){if(_[_0x9acd('0x98')](_0x6b594[_0x9acd('0x45')]['ids'])){for(var _0x431ea3=0x0;_0x431ea3<_0x6b594[_0x9acd('0x45')][_0x9acd('0x81')][_0x9acd('0x4b')];_0x431ea3+=0x1){socket['emit'](_0x9acd('0x99'),{'UserId':Number(_0x6b594[_0x9acd('0x45')][_0x9acd('0x81')][_0x431ea3]),'ChatQueueId':Number(_0x6b594['params']['id'])});}}else{socket[_0x9acd('0x7e')]('userChatQueue:remove',{'UserId':Number(_0x6b594[_0x9acd('0x45')][_0x9acd('0x81')]),'ChatQueueId':Number(_0x6b594[_0x9acd('0x59')]['id'])});}});}})[_0x9acd('0x23')](respondWithStatusCode(_0x2a5a83,null))[_0x9acd('0x2d')](handleError(_0x2a5a83,null));};exports[_0x9acd('0x9a')]=function(_0xc6dbac,_0x394970,_0x22a4cc){var _0x166ff5={};var _0x1b4420={};var _0x4d470f;var _0x2c3594;return db[_0x9acd('0x3f')][_0x9acd('0x66')]({'where':{'id':_0xc6dbac[_0x9acd('0x59')]['id']}})['then'](handleEntityNotFound(_0x394970,null))[_0x9acd('0x23')](function(_0x182edd){if(_0x182edd){_0x4d470f=_0x182edd;_0x1b4420[_0x9acd('0x44')]=_[_0x9acd('0x46')](db[_0x9acd('0x69')]['rawAttributes']);_0x1b4420[_0x9acd('0x45')]=_[_0x9acd('0x46')](_0xc6dbac[_0x9acd('0x45')]);_0x1b4420[_0x9acd('0x47')]=_['intersection'](_0x1b4420['model'],_0x1b4420[_0x9acd('0x45')]);_0x166ff5[_0x9acd('0x4a')]=_['intersection'](_0x1b4420[_0x9acd('0x44')],qs[_0x9acd('0x49')](_0xc6dbac[_0x9acd('0x45')][_0x9acd('0x49')]));_0x166ff5[_0x9acd('0x4a')]=_0x166ff5[_0x9acd('0x4a')][_0x9acd('0x4b')]?_0x166ff5[_0x9acd('0x4a')]:_0x1b4420[_0x9acd('0x44')];_0x166ff5[_0x9acd('0x4e')]=qs['sort'](_0xc6dbac[_0x9acd('0x45')][_0x9acd('0x4f')]);_0x166ff5[_0x9acd('0x50')]=qs[_0x9acd('0x47')](_['pick'](_0xc6dbac[_0x9acd('0x45')],_0x1b4420['filters']));if(_0xc6dbac[_0x9acd('0x45')][_0x9acd('0x52')]){_0x166ff5[_0x9acd('0x50')]=_[_0x9acd('0x53')](_0x166ff5[_0x9acd('0x50')],{'$or':_['map'](_0x166ff5[_0x9acd('0x4a')],function(_0x1eafec){var _0x374cfe={};_0x374cfe[_0x1eafec]={'$like':'%'+_0xc6dbac[_0x9acd('0x45')][_0x9acd('0x52')]+'%'};return _0x374cfe;})});}_0x166ff5=_[_0x9acd('0x53')]({},_0x166ff5,_0xc6dbac[_0x9acd('0x54')]);return _0x4d470f[_0x9acd('0x9a')](_0x166ff5);}})[_0x9acd('0x23')](function(_0x3e50a4){if(_0x3e50a4){_0x2c3594=_0x3e50a4[_0x9acd('0x4b')];if(!_0xc6dbac[_0x9acd('0x45')]['hasOwnProperty']('nolimit')){_0x166ff5[_0x9acd('0x33')]=qs[_0x9acd('0x33')](_0xc6dbac[_0x9acd('0x45')][_0x9acd('0x33')]);_0x166ff5[_0x9acd('0x31')]=qs['offset'](_0xc6dbac['query'][_0x9acd('0x31')]);}return _0x4d470f[_0x9acd('0x9a')](_0x166ff5);}})['then'](function(_0x1eb21c){if(_0x1eb21c){return _0x1eb21c?{'count':_0x2c3594,'rows':_0x1eb21c}:null;}})['then'](respondWithResult(_0x394970,null))['catch'](handleError(_0x394970,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 3d98ee5..eb1a52f 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 _0xe10c=['emit','hasOwnProperty','hook','events','../../mysqldb','ChatQueue','save','remove'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xe10c,0x153));var _0xce10=function(_0x1dbff8,_0x224859){_0x1dbff8=_0x1dbff8-0x0;var _0x5b3885=_0xe10c[_0x1dbff8];return _0x5b3885;};'use strict';var EventEmitter=require(_0xce10('0x0'));var ChatQueue=require(_0xce10('0x1'))['db'][_0xce10('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xce10('0x3'),'afterUpdate':'update','afterDestroy':_0xce10('0x4')};function emitEvent(_0x2295e5){return function(_0x411b5a,_0x59d1c6,_0x5d72b0){ChatQueueEvents[_0xce10('0x5')](_0x2295e5+':'+_0x411b5a['id'],_0x411b5a);ChatQueueEvents[_0xce10('0x5')](_0x2295e5,_0x411b5a);_0x5d72b0(null);};}for(var e in events){if(events[_0xce10('0x6')](e)){var event=events[e];ChatQueue[_0xce10('0x7')](e,emitEvent(event));}}module['exports']=ChatQueueEvents; \ No newline at end of file +var _0xc9b7=['emit','exports','events','ChatQueue','setMaxListeners','save','update','remove'];(function(_0x43bcbf,_0x4d6833){var _0x5af252=function(_0x97043b){while(--_0x97043b){_0x43bcbf['push'](_0x43bcbf['shift']());}};_0x5af252(++_0x4d6833);}(_0xc9b7,0x1f2));var _0x7c9b=function(_0x5459b0,_0x4d2ef8){_0x5459b0=_0x5459b0-0x0;var _0x675a35=_0xc9b7[_0x5459b0];return _0x675a35;};'use strict';var EventEmitter=require(_0x7c9b('0x0'));var ChatQueue=require('../../mysqldb')['db'][_0x7c9b('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x7c9b('0x2')](0x0);var events={'afterCreate':_0x7c9b('0x3'),'afterUpdate':_0x7c9b('0x4'),'afterDestroy':_0x7c9b('0x5')};function emitEvent(_0x7be78a){return function(_0x3077f3,_0x30ab65,_0x2118b9){ChatQueueEvents[_0x7c9b('0x6')](_0x7be78a+':'+_0x3077f3['id'],_0x3077f3);ChatQueueEvents[_0x7c9b('0x6')](_0x7be78a,_0x3077f3);_0x2118b9(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatQueue['hook'](e,emitEvent(event));}}module[_0x7c9b('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 6b27e58..e070772 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 _0xd5be=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','ChatQueue','chat_queues','util','../../config/logger'];(function(_0x264009,_0x466fe4){var _0x6de28=function(_0x34a32b){while(--_0x34a32b){_0x264009['push'](_0x264009['shift']());}};_0x6de28(++_0x466fe4);}(_0xd5be,0x1c5));var _0xed5b=function(_0xfd495c,_0x4a3c1a){_0xfd495c=_0xfd495c-0x0;var _0x561dd8=_0xd5be[_0xfd495c];return _0x561dd8;};'use strict';var _=require('lodash');var util=require(_0xed5b('0x0'));var logger=require(_0xed5b('0x1'))(_0xed5b('0x2'));var moment=require(_0xed5b('0x3'));var BPromise=require(_0xed5b('0x4'));var rp=require(_0xed5b('0x5'));var fs=require('fs');var path=require(_0xed5b('0x6'));var rimraf=require(_0xed5b('0x7'));var config=require(_0xed5b('0x8'));var attributes=require('./chatQueue.attributes');module[_0xed5b('0x9')]=function(_0x43f18e,_0x3d99e1){return _0x43f18e[_0xed5b('0xa')](_0xed5b('0xb'),attributes,{'tableName':_0xed5b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x506e=['chat_queues','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','define','ChatQueue'];(function(_0x47fb85,_0xdc3d2e){var _0x26f4fe=function(_0x35cd1d){while(--_0x35cd1d){_0x47fb85['push'](_0x47fb85['shift']());}};_0x26f4fe(++_0xdc3d2e);}(_0x506e,0x85));var _0xe506=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x506e[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0xe506('0x0'));var util=require(_0xe506('0x1'));var logger=require(_0xe506('0x2'))('api');var moment=require(_0xe506('0x3'));var BPromise=require(_0xe506('0x4'));var rp=require(_0xe506('0x5'));var fs=require('fs');var path=require(_0xe506('0x6'));var rimraf=require(_0xe506('0x7'));var config=require('../../config/environment');var attributes=require('./chatQueue.attributes');module['exports']=function(_0x3ce62b,_0x3a7637){return _0x3ce62b[_0xe506('0x8')](_0xe506('0x9'),attributes,{'tableName':_0xe506('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.rpc.js b/server/api/chatQueue/chatQueue.rpc.js index 64901f5..e2b3f00 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 _0x51d7=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','request','then','info','ChatQueue,\x20%s,\x20%s','debug','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','findAll','options','raw','where','attributes','include','map','model','GetChatQueue','stringify','ShowChatQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x579aeb,_0x5c1bb0){var _0x769607=function(_0x21bf40){while(--_0x21bf40){_0x579aeb['push'](_0x579aeb['shift']());}};_0x769607(++_0x5c1bb0);}(_0x51d7,0xcf));var _0x751d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x51d7[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x751d('0x0'));var util=require(_0x751d('0x1'));var moment=require(_0x751d('0x2'));var BPromise=require(_0x751d('0x3'));var rs=require(_0x751d('0x4'));var fs=require('fs');var Redis=require(_0x751d('0x5'));var db=require(_0x751d('0x6'))['db'];var utils=require(_0x751d('0x7'));var logger=require(_0x751d('0x8'))(_0x751d('0x9'));var config=require(_0x751d('0xa'));var jayson=require(_0x751d('0xb'));var client=jayson[_0x751d('0xc')][_0x751d('0xd')]({'port':0x232a});config[_0x751d('0xe')]=_[_0x751d('0xf')](config[_0x751d('0xe')],{'host':_0x751d('0x10'),'port':0x18eb});var socket=require(_0x751d('0x11'))(new Redis(config[_0x751d('0xe')]));require(_0x751d('0x12'))[_0x751d('0x13')](socket);function respondWithRpcPromise(_0x3bb87a,_0x10cce6,_0x3b712a){return new BPromise(function(_0x2ab84c,_0x47e380){return client[_0x751d('0x14')](_0x3bb87a,_0x3b712a)[_0x751d('0x15')](function(_0x2c6e5d){logger[_0x751d('0x16')](_0x751d('0x17'),_0x10cce6,'request\x20sent');logger[_0x751d('0x18')](_0x751d('0x19'),_0x10cce6,_0x751d('0x1a'),JSON['stringify'](_0x2c6e5d));if(_0x2c6e5d[_0x751d('0x1b')]){if(_0x2c6e5d['error'][_0x751d('0x1c')]===0x1f4){logger[_0x751d('0x1b')]('ChatQueue,\x20%s,\x20%s',_0x10cce6,_0x2c6e5d[_0x751d('0x1b')][_0x751d('0x1d')]);return _0x47e380(_0x2c6e5d[_0x751d('0x1b')][_0x751d('0x1d')]);}logger['error'](_0x751d('0x17'),_0x10cce6,_0x2c6e5d[_0x751d('0x1b')][_0x751d('0x1d')]);return _0x2ab84c(_0x2c6e5d[_0x751d('0x1b')][_0x751d('0x1d')]);}else{logger['info']('ChatQueue,\x20%s,\x20%s',_0x10cce6,_0x751d('0x1a'));_0x2ab84c(_0x2c6e5d[_0x751d('0x1e')]['message']);}})[_0x751d('0x1f')](function(_0x3272b1){logger[_0x751d('0x1b')](_0x751d('0x17'),_0x10cce6,_0x3272b1);_0x47e380(_0x3272b1);});});}exports['GetChatQueue']=function(_0x2ecc9f){var _0x445289=this;return new Promise(function(_0x11a825,_0x13a062){return db['ChatQueue'][_0x751d('0x20')]({'raw':_0x2ecc9f[_0x751d('0x21')]?_0x2ecc9f[_0x751d('0x21')][_0x751d('0x22')]===undefined?!![]:![]:!![],'where':_0x2ecc9f[_0x751d('0x21')]?_0x2ecc9f[_0x751d('0x21')][_0x751d('0x23')]||null:null,'attributes':_0x2ecc9f[_0x751d('0x21')]?_0x2ecc9f[_0x751d('0x21')][_0x751d('0x24')]||null:null,'limit':_0x2ecc9f[_0x751d('0x21')]?_0x2ecc9f[_0x751d('0x21')]['limit']||null:null,'include':_0x2ecc9f[_0x751d('0x21')]?_0x2ecc9f['options'][_0x751d('0x25')]?_[_0x751d('0x26')](_0x2ecc9f[_0x751d('0x21')][_0x751d('0x25')],function(_0x31882e){return{'model':db[_0x31882e[_0x751d('0x27')]],'as':_0x31882e['as'],'attributes':_0x31882e[_0x751d('0x24')],'include':_0x31882e[_0x751d('0x25')]?_['map'](_0x31882e['include'],function(_0x278015){return{'model':db[_0x278015[_0x751d('0x27')]],'as':_0x278015['as'],'attributes':_0x278015[_0x751d('0x24')],'include':_0x278015[_0x751d('0x25')]?_[_0x751d('0x26')](_0x278015[_0x751d('0x25')],function(_0x2acfea){return{'model':db[_0x2acfea[_0x751d('0x27')]],'as':_0x2acfea['as'],'attributes':_0x2acfea[_0x751d('0x24')]};}):[]};}):[]};}):[]:[]})[_0x751d('0x15')](function(_0x105224){logger['info'](_0x751d('0x28'),_0x2ecc9f);logger[_0x751d('0x18')](_0x751d('0x28'),_0x2ecc9f,JSON[_0x751d('0x29')](_0x105224));_0x11a825(_0x105224);})['catch'](function(_0x531890){logger[_0x751d('0x1b')](_0x751d('0x28'),_0x531890[_0x751d('0x1d')],_0x2ecc9f);_0x13a062(_0x445289[_0x751d('0x1b')](0x1f4,_0x531890[_0x751d('0x1d')]));});});};exports[_0x751d('0x2a')]=function(_0x2ffbfc){var _0x380028=this;return new Promise(function(_0x2dbd70,_0x34d92d){return db['ChatQueue']['find']({'raw':_0x2ffbfc[_0x751d('0x21')]?_0x2ffbfc['options'][_0x751d('0x22')]===undefined?!![]:![]:!![],'where':_0x2ffbfc[_0x751d('0x21')]?_0x2ffbfc[_0x751d('0x21')][_0x751d('0x23')]||null:null,'attributes':_0x2ffbfc[_0x751d('0x21')]?_0x2ffbfc[_0x751d('0x21')][_0x751d('0x24')]||null:null,'include':_0x2ffbfc[_0x751d('0x21')]?_0x2ffbfc[_0x751d('0x21')][_0x751d('0x25')]?_['map'](_0x2ffbfc[_0x751d('0x21')][_0x751d('0x25')],function(_0x5c7d67){return{'model':db[_0x5c7d67['model']],'as':_0x5c7d67['as'],'attributes':_0x5c7d67[_0x751d('0x24')],'include':_0x5c7d67[_0x751d('0x25')]?_[_0x751d('0x26')](_0x5c7d67['include'],function(_0x94c096){return{'model':db[_0x94c096[_0x751d('0x27')]],'as':_0x94c096['as'],'attributes':_0x94c096[_0x751d('0x24')],'include':_0x94c096['include']?_['map'](_0x94c096['include'],function(_0x522a8d){return{'model':db[_0x522a8d[_0x751d('0x27')]],'as':_0x522a8d['as'],'attributes':_0x522a8d[_0x751d('0x24')]};}):[]};}):[]};}):[]:[]})[_0x751d('0x15')](function(_0x2bbf65){logger[_0x751d('0x16')](_0x751d('0x2a'),_0x2ffbfc);logger[_0x751d('0x18')](_0x751d('0x2a'),_0x2ffbfc,JSON[_0x751d('0x29')](_0x2bbf65));_0x2dbd70(_0x2bbf65);})[_0x751d('0x1f')](function(_0x4ce32d){logger[_0x751d('0x1b')](_0x751d('0x2a'),_0x4ce32d['message'],_0x2ffbfc);_0x34d92d(_0x380028[_0x751d('0x1b')](0x1f4,_0x4ce32d[_0x751d('0x1d')]));});});}; \ No newline at end of file +var _0x0cfa=['moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','GetChatQueue','findAll','options','raw','where','attributes','limit','include','map','catch','model','ShowChatQueue','lodash','util'];(function(_0x329389,_0x468c67){var _0x56182f=function(_0xe14c9){while(--_0xe14c9){_0x329389['push'](_0x329389['shift']());}};_0x56182f(++_0x468c67);}(_0x0cfa,0x73));var _0xa0cf=function(_0x2e6db3,_0xb1a20e){_0x2e6db3=_0x2e6db3-0x0;var _0x3d08e6=_0x0cfa[_0x2e6db3];return _0x3d08e6;};'use strict';var _=require(_0xa0cf('0x0'));var util=require(_0xa0cf('0x1'));var moment=require(_0xa0cf('0x2'));var BPromise=require(_0xa0cf('0x3'));var rs=require(_0xa0cf('0x4'));var fs=require('fs');var Redis=require(_0xa0cf('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xa0cf('0x6'));var logger=require('../../config/logger')(_0xa0cf('0x7'));var config=require(_0xa0cf('0x8'));var jayson=require(_0xa0cf('0x9'));var client=jayson[_0xa0cf('0xa')][_0xa0cf('0xb')]({'port':0x232a});config[_0xa0cf('0xc')]=_[_0xa0cf('0xd')](config[_0xa0cf('0xc')],{'host':_0xa0cf('0xe'),'port':0x18eb});var socket=require(_0xa0cf('0xf'))(new Redis(config[_0xa0cf('0xc')]));require(_0xa0cf('0x10'))[_0xa0cf('0x11')](socket);function respondWithRpcPromise(_0x369815,_0xdab099,_0x4e8490){return new BPromise(function(_0x21c01f,_0x2b2424){return client['request'](_0x369815,_0x4e8490)[_0xa0cf('0x12')](function(_0x434795){logger[_0xa0cf('0x13')](_0xa0cf('0x14'),_0xdab099,_0xa0cf('0x15'));logger[_0xa0cf('0x16')](_0xa0cf('0x17'),_0xdab099,_0xa0cf('0x15'),JSON[_0xa0cf('0x18')](_0x434795));if(_0x434795[_0xa0cf('0x19')]){if(_0x434795['error']['code']===0x1f4){logger[_0xa0cf('0x19')](_0xa0cf('0x14'),_0xdab099,_0x434795[_0xa0cf('0x19')][_0xa0cf('0x1a')]);return _0x2b2424(_0x434795[_0xa0cf('0x19')][_0xa0cf('0x1a')]);}logger[_0xa0cf('0x19')](_0xa0cf('0x14'),_0xdab099,_0x434795['error'][_0xa0cf('0x1a')]);return _0x21c01f(_0x434795['error']['message']);}else{logger[_0xa0cf('0x13')](_0xa0cf('0x14'),_0xdab099,_0xa0cf('0x15'));_0x21c01f(_0x434795['result'][_0xa0cf('0x1a')]);}})['catch'](function(_0x3732fb){logger[_0xa0cf('0x19')](_0xa0cf('0x14'),_0xdab099,_0x3732fb);_0x2b2424(_0x3732fb);});});}exports[_0xa0cf('0x1b')]=function(_0x213a6a){var _0x1837b3=this;return new Promise(function(_0x103600,_0x3fa556){return db['ChatQueue'][_0xa0cf('0x1c')]({'raw':_0x213a6a['options']?_0x213a6a[_0xa0cf('0x1d')][_0xa0cf('0x1e')]===undefined?!![]:![]:!![],'where':_0x213a6a[_0xa0cf('0x1d')]?_0x213a6a[_0xa0cf('0x1d')][_0xa0cf('0x1f')]||null:null,'attributes':_0x213a6a[_0xa0cf('0x1d')]?_0x213a6a['options'][_0xa0cf('0x20')]||null:null,'limit':_0x213a6a[_0xa0cf('0x1d')]?_0x213a6a['options'][_0xa0cf('0x21')]||null:null,'include':_0x213a6a[_0xa0cf('0x1d')]?_0x213a6a[_0xa0cf('0x1d')][_0xa0cf('0x22')]?_[_0xa0cf('0x23')](_0x213a6a['options'][_0xa0cf('0x22')],function(_0x5dc98c){return{'model':db[_0x5dc98c['model']],'as':_0x5dc98c['as'],'attributes':_0x5dc98c[_0xa0cf('0x20')],'include':_0x5dc98c[_0xa0cf('0x22')]?_[_0xa0cf('0x23')](_0x5dc98c['include'],function(_0x4d2aab){return{'model':db[_0x4d2aab['model']],'as':_0x4d2aab['as'],'attributes':_0x4d2aab[_0xa0cf('0x20')],'include':_0x4d2aab[_0xa0cf('0x22')]?_['map'](_0x4d2aab[_0xa0cf('0x22')],function(_0xf58a40){return{'model':db[_0xf58a40['model']],'as':_0xf58a40['as'],'attributes':_0xf58a40['attributes']};}):[]};}):[]};}):[]:[]})[_0xa0cf('0x12')](function(_0x5d837d){logger[_0xa0cf('0x13')]('GetChatQueue',_0x213a6a);logger['debug'](_0xa0cf('0x1b'),_0x213a6a,JSON[_0xa0cf('0x18')](_0x5d837d));_0x103600(_0x5d837d);})[_0xa0cf('0x24')](function(_0x1c1770){logger[_0xa0cf('0x19')](_0xa0cf('0x1b'),_0x1c1770[_0xa0cf('0x1a')],_0x213a6a);_0x3fa556(_0x1837b3['error'](0x1f4,_0x1c1770[_0xa0cf('0x1a')]));});});};exports['ShowChatQueue']=function(_0x40764f){var _0x9b8f78=this;return new Promise(function(_0x493768,_0x109dd7){return db['ChatQueue']['find']({'raw':_0x40764f[_0xa0cf('0x1d')]?_0x40764f[_0xa0cf('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x40764f[_0xa0cf('0x1d')]?_0x40764f[_0xa0cf('0x1d')]['where']||null:null,'attributes':_0x40764f['options']?_0x40764f[_0xa0cf('0x1d')][_0xa0cf('0x20')]||null:null,'include':_0x40764f[_0xa0cf('0x1d')]?_0x40764f[_0xa0cf('0x1d')]['include']?_[_0xa0cf('0x23')](_0x40764f[_0xa0cf('0x1d')]['include'],function(_0x4cb083){return{'model':db[_0x4cb083[_0xa0cf('0x25')]],'as':_0x4cb083['as'],'attributes':_0x4cb083[_0xa0cf('0x20')],'include':_0x4cb083[_0xa0cf('0x22')]?_[_0xa0cf('0x23')](_0x4cb083[_0xa0cf('0x22')],function(_0x1bc4e9){return{'model':db[_0x1bc4e9[_0xa0cf('0x25')]],'as':_0x1bc4e9['as'],'attributes':_0x1bc4e9[_0xa0cf('0x20')],'include':_0x1bc4e9[_0xa0cf('0x22')]?_[_0xa0cf('0x23')](_0x1bc4e9[_0xa0cf('0x22')],function(_0x58c111){return{'model':db[_0x58c111[_0xa0cf('0x25')]],'as':_0x58c111['as'],'attributes':_0x58c111['attributes']};}):[]};}):[]};}):[]:[]})[_0xa0cf('0x12')](function(_0x1bbec7){logger[_0xa0cf('0x13')](_0xa0cf('0x26'),_0x40764f);logger[_0xa0cf('0x16')](_0xa0cf('0x26'),_0x40764f,JSON[_0xa0cf('0x18')](_0x1bbec7));_0x493768(_0x1bbec7);})[_0xa0cf('0x24')](function(_0x42e51){logger['error']('ShowChatQueue',_0x42e51[_0xa0cf('0x1a')],_0x40764f);_0x109dd7(_0x9b8f78['error'](0x1f4,_0x42e51[_0xa0cf('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 7fe0400..84bb570 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 _0x68fc=['emit','removeListener','register','chatQueue:','./chatQueue.events','save','remove'];(function(_0x5c6a78,_0x5c0503){var _0x236c5e=function(_0x44ef45){while(--_0x44ef45){_0x5c6a78['push'](_0x5c6a78['shift']());}};_0x236c5e(++_0x5c0503);}(_0x68fc,0xa5));var _0xc68f=function(_0x3dca1e,_0x1161b8){_0x3dca1e=_0x3dca1e-0x0;var _0x3b10d2=_0x68fc[_0x3dca1e];return _0x3b10d2;};'use strict';var ChatQueueEvents=require(_0xc68f('0x0'));var events=[_0xc68f('0x1'),_0xc68f('0x2'),'update'];function createListener(_0x49aa95,_0x26513f){return function(_0x506fb5){_0x26513f[_0xc68f('0x3')](_0x49aa95,_0x506fb5);};}function removeListener(_0x593648,_0x5899ea){return function(){ChatQueueEvents[_0xc68f('0x4')](_0x593648,_0x5899ea);};}exports[_0xc68f('0x5')]=function(_0x1c6df9){for(var _0x363cdf=0x0,_0x4fcce4=events['length'];_0x363cdf<_0x4fcce4;_0x363cdf++){var _0x9f2705=events[_0x363cdf];var _0x2bf3fd=createListener(_0xc68f('0x6')+_0x9f2705,_0x1c6df9);ChatQueueEvents['on'](_0x9f2705,_0x2bf3fd);}}; \ No newline at end of file +var _0x5089=['length','chatQueue:','./chatQueue.events','save','update','emit','register'];(function(_0x1a0054,_0x4f93b6){var _0x1b3084=function(_0x1b1efc){while(--_0x1b1efc){_0x1a0054['push'](_0x1a0054['shift']());}};_0x1b3084(++_0x4f93b6);}(_0x5089,0x1bb));var _0x9508=function(_0x21af3a,_0x386e1d){_0x21af3a=_0x21af3a-0x0;var _0x268a49=_0x5089[_0x21af3a];return _0x268a49;};'use strict';var ChatQueueEvents=require(_0x9508('0x0'));var events=[_0x9508('0x1'),'remove',_0x9508('0x2')];function createListener(_0x35878a,_0x7dd13d){return function(_0x100d7e){_0x7dd13d[_0x9508('0x3')](_0x35878a,_0x100d7e);};}function removeListener(_0x59d3ee,_0x86540d){return function(){ChatQueueEvents['removeListener'](_0x59d3ee,_0x86540d);};}exports[_0x9508('0x4')]=function(_0x4538dd){for(var _0x257318=0x0,_0x4ab3c6=events[_0x9508('0x5')];_0x257318<_0x4ab3c6;_0x257318++){var _0x42d13a=events[_0x257318];var _0x55a5de=createListener(_0x9508('0x6')+_0x42d13a,_0x4538dd);ChatQueueEvents['on'](_0x42d13a,_0x55a5de);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 8b7a8fb..dd255e1 100644 --- a/server/api/chatQueue/index.js +++ b/server/api/chatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x008c=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','show','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','update','delete','/:id','removeTeams','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x29ce77,_0x2c60a2){var _0x4d6d31=function(_0x3e8668){while(--_0x3e8668){_0x29ce77['push'](_0x29ce77['shift']());}};_0x4d6d31(++_0x2c60a2);}(_0x008c,0x188));var _0xc008=function(_0x5f035f,_0x5300d1){_0x5f035f=_0x5f035f-0x0;var _0xad281e=_0x008c[_0x5f035f];return _0xad281e;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/describe',auth[_0xc008('0xb')](),controller['describe']);router[_0xc008('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xc008('0xd')]);router[_0xc008('0xa')]('/:id/members',auth['isAuthenticated'](),controller['getMembers']);router[_0xc008('0xa')](_0xc008('0xe'),auth['isAuthenticated'](),controller[_0xc008('0xf')]);router[_0xc008('0xa')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x11')]);router[_0xc008('0x12')]('/',auth[_0xc008('0xb')](),controller['create']);router['post'](_0xc008('0xe'),auth['isAuthenticated'](),controller[_0xc008('0x13')]);router[_0xc008('0x12')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x14')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xc008('0x15')]);router[_0xc008('0x16')](_0xc008('0x17'),auth[_0xc008('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth['isAuthenticated'](),controller[_0xc008('0x18')]);router[_0xc008('0x16')]('/:id/users',auth[_0xc008('0xb')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _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(_0x5d9df0,_0x5ee28f){var _0x446354=function(_0x24474f){while(--_0x24474f){_0x5d9df0['push'](_0x5d9df0['shift']());}};_0x446354(++_0x5ee28f);}(_0x7217,0x19e));var _0x7721=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0x7217[_0x3c2a69];return _0x596bc8;};'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 diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 6d3bb93..8e69ce3 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 _0x4986=['moment','sequelize','exports','DATE','STRING'];(function(_0x4ec7d2,_0x509e4e){var _0x2ed1ff=function(_0x36582c){while(--_0x36582c){_0x4ec7d2['push'](_0x4ec7d2['shift']());}};_0x2ed1ff(++_0x509e4e);}(_0x4986,0x6e));var _0x6498=function(_0x3ecc23,_0x1b1b15){_0x3ecc23=_0x3ecc23-0x0;var _0x54500b=_0x4986[_0x3ecc23];return _0x54500b;};'use strict';var moment=require(_0x6498('0x0'));var Sequelize=require(_0x6498('0x1'));module[_0x6498('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x6498('0x3')]},'leaveAt':{'type':Sequelize[_0x6498('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x6498('0x3')]},'reason':{'type':Sequelize[_0x6498('0x4')]}}; \ No newline at end of file +var _0x43b0=['moment','sequelize','STRING','DATE'];(function(_0x339a72,_0x30e232){var _0xe76438=function(_0x1c42b3){while(--_0x1c42b3){_0x339a72['push'](_0x339a72['shift']());}};_0xe76438(++_0x30e232);}(_0x43b0,0x19c));var _0x043b=function(_0x6eb608,_0x4bfdcb){_0x6eb608=_0x6eb608-0x0;var _0x142f47=_0x43b0[_0x6eb608];return _0x142f47;};'use strict';var moment=require(_0x043b('0x0'));var Sequelize=require(_0x043b('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x043b('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x043b('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x043b('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 419a431..1f86ca2 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 _0x084b=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','name','send','index','ChatQueueReport','rawAttributes','fieldName','type','model','map','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','findAll','catch','show','params','keys','fields','include','create','body','find','describe','eml-format','request-promise','moment','mustache','util','path','to-csv','fs-extra','lodash','squel','desk.js','querystring'];(function(_0xd09502,_0x493218){var _0x8fcf6e=function(_0x32ee03){while(--_0x32ee03){_0xd09502['push'](_0xd09502['shift']());}};_0x8fcf6e(++_0x493218);}(_0x084b,0xd5));var _0xb084=function(_0x512506,_0x4e22ca){_0x512506=_0x512506-0x0;var _0x19c580=_0x084b[_0x512506];return _0x19c580;};'use strict';var emlformat=require(_0xb084('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb084('0x1'));var moment=require(_0xb084('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xb084('0x3'));var util=require(_0xb084('0x4'));var path=require(_0xb084('0x5'));var sox=require('sox');var csv=require(_0xb084('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb084('0x7'));var _=require(_0xb084('0x8'));var squel=require(_0xb084('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xb084('0xa'));var toCsv=require(_0xb084('0x6'));var querystring=require(_0xb084('0xb'));var Papa=require(_0xb084('0xc'));var Redis=require(_0xb084('0xd'));var authService=require(_0xb084('0xe'));var qs=require(_0xb084('0xf'));var as=require(_0xb084('0x10'));var hardwareService=require(_0xb084('0x11'));var logger=require(_0xb084('0x12'))(_0xb084('0x13'));var utils=require(_0xb084('0x14'));var config=require(_0xb084('0x15'));var licenseUtil=require(_0xb084('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x51aee2,_0x3582a0){_0x3582a0=_0x3582a0||0xcc;return function(_0x514829){if(_0x514829){return _0x51aee2['sendStatus'](_0x3582a0);}return _0x51aee2[_0xb084('0x17')](_0x3582a0)[_0xb084('0x18')]();};}function respondWithResult(_0x5bae3a,_0x4da0fb){_0x4da0fb=_0x4da0fb||0xc8;return function(_0x44be03){if(_0x44be03){return _0x5bae3a[_0xb084('0x17')](_0x4da0fb)[_0xb084('0x19')](_0x44be03);}};}function respondWithFilteredResult(_0x28ad2d,_0xc6df71){return function(_0x5a5d11){if(_0x5a5d11){var _0x240838=typeof _0xc6df71[_0xb084('0x1a')]===_0xb084('0x1b')&&typeof _0xc6df71[_0xb084('0x1c')]===_0xb084('0x1b');var _0x2cce88=_0x5a5d11[_0xb084('0x1d')];var _0x42657a=_0x240838?0x0:_0xc6df71[_0xb084('0x1a')];var _0x19d426=_0x240838?_0x5a5d11['count']:_0xc6df71['offset']+_0xc6df71['limit'];var _0x5b076b;if(_0x19d426>=_0x2cce88){_0x19d426=_0x2cce88;_0x5b076b=0xc8;}else{_0x5b076b=0xce;}_0x28ad2d[_0xb084('0x17')](_0x5b076b);return _0x28ad2d['set'](_0xb084('0x1e'),_0x42657a+'-'+_0x19d426+'/'+_0x2cce88)[_0xb084('0x19')](_0x5a5d11);}return null;};}function patchUpdates(_0x228ef1){return function(_0x2e8789){try{jsonpatch[_0xb084('0x1f')](_0x2e8789,_0x228ef1,!![]);}catch(_0x434690){return BPromise[_0xb084('0x20')](_0x434690);}return _0x2e8789[_0xb084('0x21')]();};}function saveUpdates(_0x517dc0,_0x5dfc7f){return function(_0x171dd5){if(_0x171dd5){return _0x171dd5[_0xb084('0x22')](_0x517dc0)[_0xb084('0x23')](function(_0x28d074){return _0x28d074;});}return null;};}function removeEntity(_0x5dced1,_0x4795d9){return function(_0x3ef50e){if(_0x3ef50e){return _0x3ef50e[_0xb084('0x24')]()['then'](function(){_0x5dced1[_0xb084('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f4983,_0x22059f){return function(_0x5d9314){if(!_0x5d9314){_0x1f4983[_0xb084('0x25')](0x194);}return _0x5d9314;};}function handleError(_0x3d467e,_0x1ecb58){_0x1ecb58=_0x1ecb58||0x1f4;return function(_0x4ce54c){logger[_0xb084('0x26')](_0x4ce54c['stack']);if(_0x4ce54c[_0xb084('0x27')]){delete _0x4ce54c[_0xb084('0x27')];}_0x3d467e['status'](_0x1ecb58)[_0xb084('0x28')](_0x4ce54c);};}exports[_0xb084('0x29')]=function(_0x49cbd6,_0x4587e7){var _0x1a7726={},_0x57406f={},_0x1ad27b={'count':0x0,'rows':[]};var _0x2795cf=_['map'](db[_0xb084('0x2a')][_0xb084('0x2b')],function(_0x330a35){return{'name':_0x330a35[_0xb084('0x2c')],'type':_0x330a35[_0xb084('0x2d')]['key']};});_0x57406f[_0xb084('0x2e')]=_[_0xb084('0x2f')](_0x2795cf,_0xb084('0x27'));_0x57406f[_0xb084('0x30')]=_['keys'](_0x49cbd6[_0xb084('0x30')]);_0x57406f[_0xb084('0x31')]=_[_0xb084('0x32')](_0x57406f[_0xb084('0x2e')],_0x57406f[_0xb084('0x30')]);_0x1a7726['attributes']=_['intersection'](_0x57406f[_0xb084('0x2e')],qs['fields'](_0x49cbd6[_0xb084('0x30')]['fields']));_0x1a7726[_0xb084('0x33')]=_0x1a7726[_0xb084('0x33')][_0xb084('0x34')]?_0x1a7726[_0xb084('0x33')]:_0x57406f['model'];if(!_0x49cbd6[_0xb084('0x30')][_0xb084('0x35')](_0xb084('0x36'))){_0x1a7726[_0xb084('0x1c')]=qs[_0xb084('0x1c')](_0x49cbd6['query'][_0xb084('0x1c')]);_0x1a7726[_0xb084('0x1a')]=qs['offset'](_0x49cbd6['query'][_0xb084('0x1a')]);}_0x1a7726[_0xb084('0x37')]=qs[_0xb084('0x38')](_0x49cbd6[_0xb084('0x30')][_0xb084('0x38')]);_0x1a7726[_0xb084('0x39')]=qs[_0xb084('0x31')](_[_0xb084('0x3a')](_0x49cbd6['query'],_0x57406f[_0xb084('0x31')]),_0x2795cf);if(_0x49cbd6[_0xb084('0x30')]['filter']){_0x1a7726[_0xb084('0x39')]=_['merge'](_0x1a7726[_0xb084('0x39')],{'$or':_[_0xb084('0x2f')](_0x2795cf,function(_0xad9187){if(_0xad9187[_0xb084('0x2d')]!==_0xb084('0x3b')){var _0x2254a3={};_0x2254a3[_0xad9187[_0xb084('0x27')]]={'$like':'%'+_0x49cbd6[_0xb084('0x30')][_0xb084('0x3c')]+'%'};return _0x2254a3;}})});}_0x1a7726=_[_0xb084('0x3d')]({},_0x1a7726,_0x49cbd6[_0xb084('0x3e')]);var _0x77b2cc={'where':_0x1a7726[_0xb084('0x39')]};return db[_0xb084('0x2a')][_0xb084('0x1d')](_0x77b2cc)[_0xb084('0x23')](function(_0x584b34){_0x1ad27b['count']=_0x584b34;if(_0x49cbd6[_0xb084('0x30')][_0xb084('0x3f')]){_0x1a7726['include']=[{'all':!![]}];}return db['ChatQueueReport'][_0xb084('0x40')](_0x1a7726);})[_0xb084('0x23')](function(_0x1de365){_0x1ad27b['rows']=_0x1de365;return _0x1ad27b;})[_0xb084('0x23')](respondWithFilteredResult(_0x4587e7,_0x1a7726))[_0xb084('0x41')](handleError(_0x4587e7,null));};exports[_0xb084('0x42')]=function(_0x526c47,_0xc63ca9){var _0x13b059={'raw':!![],'where':{'id':_0x526c47[_0xb084('0x43')]['id']}},_0x3f38f9={};_0x3f38f9['model']=_[_0xb084('0x44')](db[_0xb084('0x2a')][_0xb084('0x2b')]);_0x3f38f9[_0xb084('0x30')]=_['keys'](_0x526c47[_0xb084('0x30')]);_0x3f38f9[_0xb084('0x31')]=_[_0xb084('0x32')](_0x3f38f9[_0xb084('0x2e')],_0x3f38f9[_0xb084('0x30')]);_0x13b059[_0xb084('0x33')]=_[_0xb084('0x32')](_0x3f38f9[_0xb084('0x2e')],qs[_0xb084('0x45')](_0x526c47[_0xb084('0x30')][_0xb084('0x45')]));_0x13b059[_0xb084('0x33')]=_0x13b059[_0xb084('0x33')][_0xb084('0x34')]?_0x13b059[_0xb084('0x33')]:_0x3f38f9['model'];if(_0x526c47[_0xb084('0x30')][_0xb084('0x3f')]){_0x13b059[_0xb084('0x46')]=[{'all':!![]}];}_0x13b059=_[_0xb084('0x3d')]({},_0x13b059,_0x526c47[_0xb084('0x3e')]);return db[_0xb084('0x2a')]['find'](_0x13b059)[_0xb084('0x23')](handleEntityNotFound(_0xc63ca9,null))[_0xb084('0x23')](respondWithResult(_0xc63ca9,null))[_0xb084('0x41')](handleError(_0xc63ca9,null));};exports[_0xb084('0x47')]=function(_0x1a95e4,_0x305f4a){return db[_0xb084('0x2a')]['create'](_0x1a95e4[_0xb084('0x48')],{})[_0xb084('0x23')](respondWithResult(_0x305f4a,0xc9))[_0xb084('0x41')](handleError(_0x305f4a,null));};exports[_0xb084('0x22')]=function(_0x32014e,_0xb1fdeb){if(_0x32014e[_0xb084('0x48')]['id']){delete _0x32014e[_0xb084('0x48')]['id'];}return db['ChatQueueReport'][_0xb084('0x49')]({'where':{'id':_0x32014e[_0xb084('0x43')]['id']}})['then'](handleEntityNotFound(_0xb1fdeb,null))[_0xb084('0x23')](saveUpdates(_0x32014e[_0xb084('0x48')],null))[_0xb084('0x23')](respondWithResult(_0xb1fdeb,null))[_0xb084('0x41')](handleError(_0xb1fdeb,null));};exports[_0xb084('0x24')]=function(_0x4bad1b,_0x2d5ebd){return db['ChatQueueReport'][_0xb084('0x49')]({'where':{'id':_0x4bad1b[_0xb084('0x43')]['id']}})[_0xb084('0x23')](handleEntityNotFound(_0x2d5ebd,null))[_0xb084('0x23')](removeEntity(_0x2d5ebd,null))[_0xb084('0x41')](handleError(_0x2d5ebd,null));};exports[_0xb084('0x4a')]=function(_0x2d9239,_0x557649){return db['ChatQueueReport']['describe']()[_0xb084('0x23')](respondWithResult(_0x557649,null))[_0xb084('0x41')](handleError(_0x557649,null));}; \ No newline at end of file +var _0xaee6=['filter','merge','where','VIRTUAL','options','includeAll','include','findAll','show','params','find','create','body','catch','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','error','stack','name','send','index','ChatQueueReport','rawAttributes','fieldName','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort'];(function(_0x1f2b0e,_0xc804dc){var _0x23b334=function(_0x138ed9){while(--_0x138ed9){_0x1f2b0e['push'](_0x1f2b0e['shift']());}};_0x23b334(++_0xc804dc);}(_0xaee6,0x187));var _0x6aee=function(_0x4620e3,_0x1e0755){_0x4620e3=_0x4620e3-0x0;var _0xbbc011=_0xaee6[_0x4620e3];return _0xbbc011;};'use strict';var emlformat=require(_0x6aee('0x0'));var rimraf=require(_0x6aee('0x1'));var zipdir=require(_0x6aee('0x2'));var jsonpatch=require(_0x6aee('0x3'));var rp=require(_0x6aee('0x4'));var moment=require(_0x6aee('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x6aee('0x6'));var util=require(_0x6aee('0x7'));var path=require(_0x6aee('0x8'));var sox=require('sox');var csv=require(_0x6aee('0x9'));var ejs=require(_0x6aee('0xa'));var fs=require('fs');var fs_extra=require(_0x6aee('0xb'));var _=require(_0x6aee('0xc'));var squel=require(_0x6aee('0xd'));var crypto=require(_0x6aee('0xe'));var jsforce=require(_0x6aee('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6aee('0x10'));var Papa=require('papaparse');var Redis=require(_0x6aee('0x11'));var authService=require(_0x6aee('0x12'));var qs=require(_0x6aee('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6aee('0x14'));var logger=require(_0x6aee('0x15'))(_0x6aee('0x16'));var utils=require(_0x6aee('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x6aee('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5b4551,_0x46e458){_0x46e458=_0x46e458||0xcc;return function(_0x25eddf){if(_0x25eddf){return _0x5b4551[_0x6aee('0x19')](_0x46e458);}return _0x5b4551[_0x6aee('0x1a')](_0x46e458)['end']();};}function respondWithResult(_0x2d13f5,_0x238b4d){_0x238b4d=_0x238b4d||0xc8;return function(_0x5a7fc5){if(_0x5a7fc5){return _0x2d13f5['status'](_0x238b4d)[_0x6aee('0x1b')](_0x5a7fc5);}};}function respondWithFilteredResult(_0x10a0c8,_0x658ef){return function(_0x18b259){if(_0x18b259){var _0x16cc61=typeof _0x658ef[_0x6aee('0x1c')]===_0x6aee('0x1d')&&typeof _0x658ef[_0x6aee('0x1e')]==='undefined';var _0x124794=_0x18b259[_0x6aee('0x1f')];var _0x511486=_0x16cc61?0x0:_0x658ef[_0x6aee('0x1c')];var _0x29f71c=_0x16cc61?_0x18b259['count']:_0x658ef[_0x6aee('0x1c')]+_0x658ef[_0x6aee('0x1e')];var _0x39a9c1;if(_0x29f71c>=_0x124794){_0x29f71c=_0x124794;_0x39a9c1=0xc8;}else{_0x39a9c1=0xce;}_0x10a0c8[_0x6aee('0x1a')](_0x39a9c1);return _0x10a0c8[_0x6aee('0x20')](_0x6aee('0x21'),_0x511486+'-'+_0x29f71c+'/'+_0x124794)[_0x6aee('0x1b')](_0x18b259);}return null;};}function patchUpdates(_0x5969b2){return function(_0x25c43f){try{jsonpatch['apply'](_0x25c43f,_0x5969b2,!![]);}catch(_0x495ec5){return BPromise[_0x6aee('0x22')](_0x495ec5);}return _0x25c43f[_0x6aee('0x23')]();};}function saveUpdates(_0x409295,_0x4619b1){return function(_0x2f9a08){if(_0x2f9a08){return _0x2f9a08[_0x6aee('0x24')](_0x409295)[_0x6aee('0x25')](function(_0x1ffa47){return _0x1ffa47;});}return null;};}function removeEntity(_0x57b997,_0xc1b66c){return function(_0x511ea6){if(_0x511ea6){return _0x511ea6['destroy']()[_0x6aee('0x25')](function(){_0x57b997[_0x6aee('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3445b1,_0x166dcd){return function(_0x56716f){if(!_0x56716f){_0x3445b1[_0x6aee('0x19')](0x194);}return _0x56716f;};}function handleError(_0x43f0bb,_0x1c110c){_0x1c110c=_0x1c110c||0x1f4;return function(_0x1f1b19){logger[_0x6aee('0x26')](_0x1f1b19[_0x6aee('0x27')]);if(_0x1f1b19[_0x6aee('0x28')]){delete _0x1f1b19[_0x6aee('0x28')];}_0x43f0bb[_0x6aee('0x1a')](_0x1c110c)[_0x6aee('0x29')](_0x1f1b19);};}exports[_0x6aee('0x2a')]=function(_0x3376d1,_0x3d06bb){var _0x7327d4={},_0x15e0db={},_0x2fc285={'count':0x0,'rows':[]};var _0x52244f=_['map'](db[_0x6aee('0x2b')][_0x6aee('0x2c')],function(_0x2822b9){return{'name':_0x2822b9[_0x6aee('0x2d')],'type':_0x2822b9['type'][_0x6aee('0x2e')]};});_0x15e0db['model']=_[_0x6aee('0x2f')](_0x52244f,_0x6aee('0x28'));_0x15e0db[_0x6aee('0x30')]=_[_0x6aee('0x31')](_0x3376d1[_0x6aee('0x30')]);_0x15e0db[_0x6aee('0x32')]=_[_0x6aee('0x33')](_0x15e0db[_0x6aee('0x34')],_0x15e0db[_0x6aee('0x30')]);_0x7327d4[_0x6aee('0x35')]=_[_0x6aee('0x33')](_0x15e0db[_0x6aee('0x34')],qs[_0x6aee('0x36')](_0x3376d1['query'][_0x6aee('0x36')]));_0x7327d4[_0x6aee('0x35')]=_0x7327d4[_0x6aee('0x35')][_0x6aee('0x37')]?_0x7327d4[_0x6aee('0x35')]:_0x15e0db[_0x6aee('0x34')];if(!_0x3376d1[_0x6aee('0x30')][_0x6aee('0x38')]('nolimit')){_0x7327d4[_0x6aee('0x1e')]=qs[_0x6aee('0x1e')](_0x3376d1[_0x6aee('0x30')][_0x6aee('0x1e')]);_0x7327d4[_0x6aee('0x1c')]=qs[_0x6aee('0x1c')](_0x3376d1[_0x6aee('0x30')][_0x6aee('0x1c')]);}_0x7327d4[_0x6aee('0x39')]=qs[_0x6aee('0x3a')](_0x3376d1[_0x6aee('0x30')]['sort']);_0x7327d4['where']=qs[_0x6aee('0x32')](_['pick'](_0x3376d1['query'],_0x15e0db[_0x6aee('0x32')]),_0x52244f);if(_0x3376d1[_0x6aee('0x30')][_0x6aee('0x3b')]){_0x7327d4['where']=_[_0x6aee('0x3c')](_0x7327d4[_0x6aee('0x3d')],{'$or':_[_0x6aee('0x2f')](_0x52244f,function(_0x39784e){if(_0x39784e['type']!==_0x6aee('0x3e')){var _0x3b8fda={};_0x3b8fda[_0x39784e[_0x6aee('0x28')]]={'$like':'%'+_0x3376d1[_0x6aee('0x30')][_0x6aee('0x3b')]+'%'};return _0x3b8fda;}})});}_0x7327d4=_['merge']({},_0x7327d4,_0x3376d1[_0x6aee('0x3f')]);var _0x43fbd={'where':_0x7327d4[_0x6aee('0x3d')]};return db[_0x6aee('0x2b')][_0x6aee('0x1f')](_0x43fbd)['then'](function(_0x3e01e1){_0x2fc285['count']=_0x3e01e1;if(_0x3376d1[_0x6aee('0x30')][_0x6aee('0x40')]){_0x7327d4[_0x6aee('0x41')]=[{'all':!![]}];}return db[_0x6aee('0x2b')][_0x6aee('0x42')](_0x7327d4);})[_0x6aee('0x25')](function(_0x5ba53b){_0x2fc285['rows']=_0x5ba53b;return _0x2fc285;})[_0x6aee('0x25')](respondWithFilteredResult(_0x3d06bb,_0x7327d4))['catch'](handleError(_0x3d06bb,null));};exports[_0x6aee('0x43')]=function(_0x2cfa2a,_0x285b9f){var _0x3c58a3={'raw':!![],'where':{'id':_0x2cfa2a[_0x6aee('0x44')]['id']}},_0x5029d3={};_0x5029d3['model']=_[_0x6aee('0x31')](db['ChatQueueReport'][_0x6aee('0x2c')]);_0x5029d3[_0x6aee('0x30')]=_[_0x6aee('0x31')](_0x2cfa2a[_0x6aee('0x30')]);_0x5029d3[_0x6aee('0x32')]=_[_0x6aee('0x33')](_0x5029d3[_0x6aee('0x34')],_0x5029d3[_0x6aee('0x30')]);_0x3c58a3['attributes']=_[_0x6aee('0x33')](_0x5029d3[_0x6aee('0x34')],qs['fields'](_0x2cfa2a['query'][_0x6aee('0x36')]));_0x3c58a3[_0x6aee('0x35')]=_0x3c58a3['attributes'][_0x6aee('0x37')]?_0x3c58a3['attributes']:_0x5029d3[_0x6aee('0x34')];if(_0x2cfa2a[_0x6aee('0x30')][_0x6aee('0x40')]){_0x3c58a3[_0x6aee('0x41')]=[{'all':!![]}];}_0x3c58a3=_['merge']({},_0x3c58a3,_0x2cfa2a['options']);return db[_0x6aee('0x2b')][_0x6aee('0x45')](_0x3c58a3)[_0x6aee('0x25')](handleEntityNotFound(_0x285b9f,null))[_0x6aee('0x25')](respondWithResult(_0x285b9f,null))['catch'](handleError(_0x285b9f,null));};exports[_0x6aee('0x46')]=function(_0x573005,_0x40ea5e){return db[_0x6aee('0x2b')][_0x6aee('0x46')](_0x573005[_0x6aee('0x47')],{})['then'](respondWithResult(_0x40ea5e,0xc9))[_0x6aee('0x48')](handleError(_0x40ea5e,null));};exports[_0x6aee('0x24')]=function(_0x316f51,_0x23a7ed){if(_0x316f51[_0x6aee('0x47')]['id']){delete _0x316f51[_0x6aee('0x47')]['id'];}return db[_0x6aee('0x2b')][_0x6aee('0x45')]({'where':{'id':_0x316f51['params']['id']}})[_0x6aee('0x25')](handleEntityNotFound(_0x23a7ed,null))[_0x6aee('0x25')](saveUpdates(_0x316f51['body'],null))[_0x6aee('0x25')](respondWithResult(_0x23a7ed,null))[_0x6aee('0x48')](handleError(_0x23a7ed,null));};exports[_0x6aee('0x49')]=function(_0x132aa9,_0x5b9036){return db['ChatQueueReport'][_0x6aee('0x45')]({'where':{'id':_0x132aa9[_0x6aee('0x44')]['id']}})[_0x6aee('0x25')](handleEntityNotFound(_0x5b9036,null))[_0x6aee('0x25')](removeEntity(_0x5b9036,null))['catch'](handleError(_0x5b9036,null));};exports[_0x6aee('0x4a')]=function(_0x56587e,_0x44e3ea){return db['ChatQueueReport'][_0x6aee('0x4a')]()[_0x6aee('0x25')](respondWithResult(_0x44e3ea,null))[_0x6aee('0x48')](handleError(_0x44e3ea,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 73d48eb..16a881b 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 _0xb10b=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','report_chat_queue','uniqueid','lodash'];(function(_0x15f8ad,_0x5275c3){var _0xc0238a=function(_0x5550c8){while(--_0x5550c8){_0x15f8ad['push'](_0x15f8ad['shift']());}};_0xc0238a(++_0x5275c3);}(_0xb10b,0x12a));var _0xbb10=function(_0x471268,_0x5ce885){_0x471268=_0x471268-0x0;var _0x1298f3=_0xb10b[_0x471268];return _0x1298f3;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var logger=require(_0xbb10('0x1'))(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var BPromise=require('bluebird');var rp=require(_0xbb10('0x4'));var fs=require('fs');var path=require(_0xbb10('0x5'));var rimraf=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var attributes=require(_0xbb10('0x8'));module[_0xbb10('0x9')]=function(_0x481979,_0x328583){return _0x481979[_0xbb10('0xa')]('ChatQueueReport',attributes,{'tableName':_0xbb10('0xb'),'paranoid':![],'indexes':[{'name':_0xbb10('0xc'),'fields':[_0xbb10('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd8b0=['define','report_chat_queue','uniqueid','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x156c49,_0x421fef){var _0x3fcf3f=function(_0x2dfd82){while(--_0x2dfd82){_0x156c49['push'](_0x156c49['shift']());}};_0x3fcf3f(++_0x421fef);}(_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('./chatQueueReport.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('ChatQueueReport',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[{'name':_0x0d8b('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 93ad20a..ebe9229 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 _0x0b94=['info','catch','ChatQueueReport','create','body','options','raw','then','CreateChatQueueReport','stringify','UpdateChatQueueReport','update','where','attributes','limit','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','error','message'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0x0b94,0xaf));var _0x40b9=function(_0x2ad946,_0x19e233){_0x2ad946=_0x2ad946-0x0;var _0x278869=_0x0b94[_0x2ad946];return _0x278869;};'use strict';var _=require(_0x40b9('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x40b9('0x1'));var rs=require(_0x40b9('0x2'));var fs=require('fs');var Redis=require(_0x40b9('0x3'));var db=require(_0x40b9('0x4'))['db'];var utils=require(_0x40b9('0x5'));var logger=require(_0x40b9('0x6'))('rpc');var config=require(_0x40b9('0x7'));var jayson=require(_0x40b9('0x8'));var client=jayson[_0x40b9('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4625d1,_0x126e16,_0x36f834){return new BPromise(function(_0x230c1f,_0x244c8f){return client[_0x40b9('0xa')](_0x4625d1,_0x36f834)['then'](function(_0x18e683){logger['info'](_0x40b9('0xb'),_0x126e16,_0x40b9('0xc'));logger[_0x40b9('0xd')](_0x40b9('0xe'),_0x126e16,_0x40b9('0xc'),JSON['stringify'](_0x18e683));if(_0x18e683[_0x40b9('0xf')]){if(_0x18e683[_0x40b9('0xf')]['code']===0x1f4){logger['error'](_0x40b9('0xb'),_0x126e16,_0x18e683[_0x40b9('0xf')]['message']);return _0x244c8f(_0x18e683['error'][_0x40b9('0x10')]);}logger[_0x40b9('0xf')]('ChatQueueReport,\x20%s,\x20%s',_0x126e16,_0x18e683[_0x40b9('0xf')]['message']);return _0x230c1f(_0x18e683[_0x40b9('0xf')][_0x40b9('0x10')]);}else{logger[_0x40b9('0x11')]('ChatQueueReport,\x20%s,\x20%s',_0x126e16,_0x40b9('0xc'));_0x230c1f(_0x18e683['result'][_0x40b9('0x10')]);}})[_0x40b9('0x12')](function(_0x36678c){logger[_0x40b9('0xf')](_0x40b9('0xb'),_0x126e16,_0x36678c);_0x244c8f(_0x36678c);});});}exports['CreateChatQueueReport']=function(_0x4dd18f){var _0x53dabc=this;return new Promise(function(_0x13b697,_0x34ae51){return db[_0x40b9('0x13')][_0x40b9('0x14')](_0x4dd18f[_0x40b9('0x15')],{'raw':_0x4dd18f['options']?_0x4dd18f[_0x40b9('0x16')][_0x40b9('0x17')]===undefined?!![]:![]:!![]})[_0x40b9('0x18')](function(_0x60530){logger[_0x40b9('0x11')](_0x40b9('0x19'),_0x4dd18f);logger[_0x40b9('0xd')]('CreateChatQueueReport',_0x4dd18f,JSON[_0x40b9('0x1a')](_0x60530));_0x13b697(_0x60530);})[_0x40b9('0x12')](function(_0x55193d){logger['error']('CreateChatQueueReport',_0x55193d['message'],_0x4dd18f);_0x34ae51(_0x53dabc['error'](0x1f4,_0x55193d[_0x40b9('0x10')]));});});};exports[_0x40b9('0x1b')]=function(_0x3119c0){var _0x4c9165=this;return new Promise(function(_0x20888e,_0x12d953){return db['ChatQueueReport'][_0x40b9('0x1c')](_0x3119c0['body'],{'raw':_0x3119c0[_0x40b9('0x16')]?_0x3119c0[_0x40b9('0x16')][_0x40b9('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3119c0[_0x40b9('0x16')]?_0x3119c0['options'][_0x40b9('0x1d')]||null:null,'attributes':_0x3119c0[_0x40b9('0x16')]?_0x3119c0[_0x40b9('0x16')][_0x40b9('0x1e')]||null:null,'limit':_0x3119c0[_0x40b9('0x16')]?_0x3119c0[_0x40b9('0x16')][_0x40b9('0x1f')]||null:null})[_0x40b9('0x18')](function(_0x19a3df){logger['info'](_0x40b9('0x1b'),_0x3119c0);logger['debug']('UpdateChatQueueReport',_0x3119c0,JSON[_0x40b9('0x1a')](_0x19a3df));_0x20888e(_0x19a3df);})[_0x40b9('0x12')](function(_0x2ce6d9){logger['error'](_0x40b9('0x1b'),_0x2ce6d9[_0x40b9('0x10')],_0x3119c0);_0x12d953(_0x4c9165['error'](0x1f4,_0x2ce6d9[_0x40b9('0x10')]));});});}; \ No newline at end of file +var _0xd4a4=['../../config/utils','jayson/promise','http','request','then','info','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','ChatQueueReport,\x20%s,\x20%s','result','catch','CreateChatQueueReport','ChatQueueReport','create','body','options','raw','stringify','UpdateChatQueueReport','update','where','attributes','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x4756c7,_0x1e9983){var _0x59e006=function(_0x7d08ad){while(--_0x7d08ad){_0x4756c7['push'](_0x4756c7['shift']());}};_0x59e006(++_0x1e9983);}(_0xd4a4,0x112));var _0x4d4a=function(_0x549a81,_0x28f9c7){_0x549a81=_0x549a81-0x0;var _0x514df1=_0xd4a4[_0x549a81];return _0x514df1;};'use strict';var _=require(_0x4d4a('0x0'));var util=require('util');var moment=require(_0x4d4a('0x1'));var BPromise=require(_0x4d4a('0x2'));var rs=require(_0x4d4a('0x3'));var fs=require('fs');var Redis=require(_0x4d4a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4d4a('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x4d4a('0x6'));var client=jayson['client'][_0x4d4a('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x34c2f0,_0x374dbf,_0x185c6c){return new BPromise(function(_0xccd933,_0x3f2621){return client[_0x4d4a('0x8')](_0x34c2f0,_0x185c6c)[_0x4d4a('0x9')](function(_0x438da5){logger[_0x4d4a('0xa')]('ChatQueueReport,\x20%s,\x20%s',_0x374dbf,_0x4d4a('0xb'));logger[_0x4d4a('0xc')](_0x4d4a('0xd'),_0x374dbf,_0x4d4a('0xb'),JSON['stringify'](_0x438da5));if(_0x438da5[_0x4d4a('0xe')]){if(_0x438da5['error'][_0x4d4a('0xf')]===0x1f4){logger[_0x4d4a('0xe')]('ChatQueueReport,\x20%s,\x20%s',_0x374dbf,_0x438da5[_0x4d4a('0xe')][_0x4d4a('0x10')]);return _0x3f2621(_0x438da5[_0x4d4a('0xe')][_0x4d4a('0x10')]);}logger[_0x4d4a('0xe')](_0x4d4a('0x11'),_0x374dbf,_0x438da5[_0x4d4a('0xe')][_0x4d4a('0x10')]);return _0xccd933(_0x438da5['error'][_0x4d4a('0x10')]);}else{logger[_0x4d4a('0xa')]('ChatQueueReport,\x20%s,\x20%s',_0x374dbf,'request\x20sent');_0xccd933(_0x438da5[_0x4d4a('0x12')][_0x4d4a('0x10')]);}})[_0x4d4a('0x13')](function(_0x4f2117){logger[_0x4d4a('0xe')](_0x4d4a('0x11'),_0x374dbf,_0x4f2117);_0x3f2621(_0x4f2117);});});}exports[_0x4d4a('0x14')]=function(_0x1b194a){var _0x4b721a=this;return new Promise(function(_0x16f543,_0x519c10){return db[_0x4d4a('0x15')][_0x4d4a('0x16')](_0x1b194a[_0x4d4a('0x17')],{'raw':_0x1b194a[_0x4d4a('0x18')]?_0x1b194a[_0x4d4a('0x18')][_0x4d4a('0x19')]===undefined?!![]:![]:!![]})[_0x4d4a('0x9')](function(_0xeb6656){logger[_0x4d4a('0xa')]('CreateChatQueueReport',_0x1b194a);logger[_0x4d4a('0xc')](_0x4d4a('0x14'),_0x1b194a,JSON[_0x4d4a('0x1a')](_0xeb6656));_0x16f543(_0xeb6656);})[_0x4d4a('0x13')](function(_0x1c0fa4){logger['error']('CreateChatQueueReport',_0x1c0fa4['message'],_0x1b194a);_0x519c10(_0x4b721a[_0x4d4a('0xe')](0x1f4,_0x1c0fa4[_0x4d4a('0x10')]));});});};exports[_0x4d4a('0x1b')]=function(_0x3f20e4){var _0xf625b8=this;return new Promise(function(_0x1e4859,_0x1707b8){return db[_0x4d4a('0x15')][_0x4d4a('0x1c')](_0x3f20e4[_0x4d4a('0x17')],{'raw':_0x3f20e4[_0x4d4a('0x18')]?_0x3f20e4[_0x4d4a('0x18')][_0x4d4a('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3f20e4['options']?_0x3f20e4['options'][_0x4d4a('0x1d')]||null:null,'attributes':_0x3f20e4[_0x4d4a('0x18')]?_0x3f20e4['options'][_0x4d4a('0x1e')]||null:null,'limit':_0x3f20e4[_0x4d4a('0x18')]?_0x3f20e4[_0x4d4a('0x18')]['limit']||null:null})[_0x4d4a('0x9')](function(_0x40c3b0){logger[_0x4d4a('0xa')](_0x4d4a('0x1b'),_0x3f20e4);logger[_0x4d4a('0xc')](_0x4d4a('0x1b'),_0x3f20e4,JSON[_0x4d4a('0x1a')](_0x40c3b0));_0x1e4859(_0x40c3b0);})[_0x4d4a('0x13')](function(_0x283b27){logger[_0x4d4a('0xe')](_0x4d4a('0x1b'),_0x283b27[_0x4d4a('0x10')],_0x3f20e4);_0x1707b8(_0xf625b8[_0x4d4a('0xe')](0x1f4,_0x283b27[_0x4d4a('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 4c337df..8e8aea7 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 _0x7bf4=['../../components/auth/service','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','delete','multer','util','path','Router'];(function(_0x3047f7,_0x326044){var _0x331118=function(_0x5f3942){while(--_0x5f3942){_0x3047f7['push'](_0x3047f7['shift']());}};_0x331118(++_0x326044);}(_0x7bf4,0x16c));var _0x47bf=function(_0x60be6e,_0x4abac6){_0x60be6e=_0x60be6e-0x0;var _0x515da0=_0x7bf4[_0x60be6e];return _0x515da0;};'use strict';var multer=require(_0x47bf('0x0'));var util=require(_0x47bf('0x1'));var path=require(_0x47bf('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x47bf('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x47bf('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./chatQueueReport.controller');router[_0x47bf('0x5')]('/',auth[_0x47bf('0x6')](),controller[_0x47bf('0x7')]);router[_0x47bf('0x5')](_0x47bf('0x8'),auth[_0x47bf('0x6')](),controller[_0x47bf('0x9')]);router[_0x47bf('0x5')](_0x47bf('0xa'),auth[_0x47bf('0x6')](),controller[_0x47bf('0xb')]);router[_0x47bf('0xc')]('/',auth[_0x47bf('0x6')](),controller[_0x47bf('0xd')]);router['put'](_0x47bf('0xa'),auth[_0x47bf('0x6')](),controller[_0x47bf('0xe')]);router[_0x47bf('0xf')](_0x47bf('0xa'),auth[_0x47bf('0x6')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x9637=['isAuthenticated','index','/describe','describe','/:id','show','put','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x45ba02,_0x557589){var _0x176288=function(_0x43bcdd){while(--_0x43bcdd){_0x45ba02['push'](_0x45ba02['shift']());}};_0x176288(++_0x557589);}(_0x9637,0x6e));var _0x7963=function(_0xac6b8a,_0xe7f580){_0xac6b8a=_0xac6b8a-0x0;var _0x551ae7=_0x9637[_0xac6b8a];return _0x551ae7;};'use strict';var multer=require(_0x7963('0x0'));var util=require(_0x7963('0x1'));var path=require('path');var timeout=require(_0x7963('0x2'));var express=require(_0x7963('0x3'));var router=express[_0x7963('0x4')]();var fs_extra=require(_0x7963('0x5'));var auth=require(_0x7963('0x6'));var interaction=require(_0x7963('0x7'));var config=require(_0x7963('0x8'));var controller=require('./chatQueueReport.controller');router[_0x7963('0x9')]('/',auth[_0x7963('0xa')](),controller[_0x7963('0xb')]);router[_0x7963('0x9')](_0x7963('0xc'),auth[_0x7963('0xa')](),controller[_0x7963('0xd')]);router[_0x7963('0x9')](_0x7963('0xe'),auth[_0x7963('0xa')](),controller[_0x7963('0xf')]);router['post']('/',auth[_0x7963('0xa')](),controller['create']);router[_0x7963('0x10')](_0x7963('0xe'),auth[_0x7963('0xa')](),controller[_0x7963('0x11')]);router[_0x7963('0x12')](_0x7963('0xe'),auth[_0x7963('0xa')](),controller['destroy']);module[_0x7963('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 2f610fd..2e38b03 100644 --- a/server/api/chatTransferReport/chatTransferReport.attributes.js +++ b/server/api/chatTransferReport/chatTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0x15bc81,_0x4d4f77){var _0x59440e=function(_0x1b60f2){while(--_0x1b60f2){_0x15bc81['push'](_0x15bc81['shift']());}};_0x59440e(++_0x4d4f77);}(_0xb43b,0x1b2));var _0xbb43=function(_0x188540,_0x3ed948){_0x188540=_0x188540-0x0;var _0x1f8384=_0xb43b[_0x188540];return _0x1f8384;};'use strict';var moment=require(_0xbb43('0x0'));var Sequelize=require(_0xbb43('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xbb43('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbb43('0x3')](_0xbb43('0x4'),'agent',_0xbb43('0x5')),'allowNull':![],'defaultValue':_0xbb43('0x5')},'transferredAt':{'type':Sequelize[_0xbb43('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xbb43('0x7')]}}; \ No newline at end of file +var _0x008c=['ENUM','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x139a25,_0x1707d7){var _0x330a62=function(_0x3092b4){while(--_0x3092b4){_0x139a25['push'](_0x139a25['shift']());}};_0x330a62(++_0x1707d7);}(_0x008c,0x188));var _0xc008=function(_0x575a38,_0x2e83d7){_0x575a38=_0x575a38-0x0;var _0x5a7bdd=_0x008c[_0x575a38];return _0x5a7bdd;};'use strict';var moment=require(_0xc008('0x0'));var Sequelize=require(_0xc008('0x1'));module[_0xc008('0x2')]={'uniqueid':{'type':Sequelize[_0xc008('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xc008('0x4')]('account',_0xc008('0x5'),_0xc008('0x6')),'allowNull':![],'defaultValue':_0xc008('0x6')},'transferredAt':{'type':Sequelize[_0xc008('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xc008('0x8')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 604b8d2..5a10d00 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 _0x33f8=['api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','length','includeAll','ChatTransferReport','find','create','body','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger'];(function(_0x41e6fa,_0x2dc57e){var _0x56bceb=function(_0x4950b1){while(--_0x4950b1){_0x41e6fa['push'](_0x41e6fa['shift']());}};_0x56bceb(++_0x2dc57e);}(_0x33f8,0x177));var _0x833f=function(_0x2cfd7f,_0x517c76){_0x2cfd7f=_0x2cfd7f-0x0;var _0x302d2a=_0x33f8[_0x2cfd7f];return _0x302d2a;};'use strict';var emlformat=require(_0x833f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x833f('0x1'));var jsonpatch=require(_0x833f('0x2'));var rp=require('request-promise');var moment=require(_0x833f('0x3'));var BPromise=require(_0x833f('0x4'));var Mustache=require(_0x833f('0x5'));var util=require('util');var path=require(_0x833f('0x6'));var sox=require(_0x833f('0x7'));var csv=require(_0x833f('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x833f('0x9'));var _=require(_0x833f('0xa'));var squel=require('squel');var crypto=require(_0x833f('0xb'));var jsforce=require(_0x833f('0xc'));var deskjs=require(_0x833f('0xd'));var toCsv=require(_0x833f('0x8'));var querystring=require(_0x833f('0xe'));var Papa=require(_0x833f('0xf'));var Redis=require(_0x833f('0x10'));var authService=require(_0x833f('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x833f('0x12'));var logger=require(_0x833f('0x13'))(_0x833f('0x14'));var utils=require('../../config/utils');var config=require(_0x833f('0x15'));var licenseUtil=require(_0x833f('0x16'));var db=require(_0x833f('0x17'))['db'];function respondWithStatusCode(_0x229331,_0x45f63f){_0x45f63f=_0x45f63f||0xcc;return function(_0x5711b2){if(_0x5711b2){return _0x229331[_0x833f('0x18')](_0x45f63f);}return _0x229331['status'](_0x45f63f)[_0x833f('0x19')]();};}function respondWithResult(_0x464952,_0x195a64){_0x195a64=_0x195a64||0xc8;return function(_0x161dd4){if(_0x161dd4){return _0x464952[_0x833f('0x1a')](_0x195a64)[_0x833f('0x1b')](_0x161dd4);}};}function respondWithFilteredResult(_0x446a80,_0x2100c3){return function(_0x334bed){if(_0x334bed){var _0x2ccd5d=typeof _0x2100c3['offset']==='undefined'&&typeof _0x2100c3[_0x833f('0x1c')]===_0x833f('0x1d');var _0x328a01=_0x334bed[_0x833f('0x1e')];var _0x4c58c5=_0x2ccd5d?0x0:_0x2100c3[_0x833f('0x1f')];var _0x46e7ed=_0x2ccd5d?_0x334bed['count']:_0x2100c3[_0x833f('0x1f')]+_0x2100c3[_0x833f('0x1c')];var _0x2055bc;if(_0x46e7ed>=_0x328a01){_0x46e7ed=_0x328a01;_0x2055bc=0xc8;}else{_0x2055bc=0xce;}_0x446a80[_0x833f('0x1a')](_0x2055bc);return _0x446a80[_0x833f('0x20')](_0x833f('0x21'),_0x4c58c5+'-'+_0x46e7ed+'/'+_0x328a01)[_0x833f('0x1b')](_0x334bed);}return null;};}function patchUpdates(_0x4bb941){return function(_0x4f52f0){try{jsonpatch[_0x833f('0x22')](_0x4f52f0,_0x4bb941,!![]);}catch(_0x5a5e2e){return BPromise[_0x833f('0x23')](_0x5a5e2e);}return _0x4f52f0[_0x833f('0x24')]();};}function saveUpdates(_0x331a28,_0xdb1a29){return function(_0x280fd5){if(_0x280fd5){return _0x280fd5[_0x833f('0x25')](_0x331a28)[_0x833f('0x26')](function(_0x27d573){return _0x27d573;});}return null;};}function removeEntity(_0x336f65,_0x4b6a72){return function(_0x5df83f){if(_0x5df83f){return _0x5df83f[_0x833f('0x27')]()[_0x833f('0x26')](function(){_0x336f65[_0x833f('0x1a')](0xcc)[_0x833f('0x19')]();});}};}function handleEntityNotFound(_0x1c82e1,_0x11ebfe){return function(_0x3f0a4f){if(!_0x3f0a4f){_0x1c82e1['sendStatus'](0x194);}return _0x3f0a4f;};}function handleError(_0x9403ae,_0x3e41e8){_0x3e41e8=_0x3e41e8||0x1f4;return function(_0x8c32c5){logger[_0x833f('0x28')](_0x8c32c5[_0x833f('0x29')]);if(_0x8c32c5['name']){delete _0x8c32c5[_0x833f('0x2a')];}_0x9403ae[_0x833f('0x1a')](_0x3e41e8)[_0x833f('0x2b')](_0x8c32c5);};}exports[_0x833f('0x2c')]=function(_0x555718,_0x30c8e1){var _0xb26093={},_0x2df0aa={},_0x466aff={'count':0x0,'rows':[]};var _0x484d77=_[_0x833f('0x2d')](db['ChatTransferReport'][_0x833f('0x2e')],function(_0x1ae5ed){return{'name':_0x1ae5ed[_0x833f('0x2f')],'type':_0x1ae5ed[_0x833f('0x30')]['key']};});_0x2df0aa[_0x833f('0x31')]=_[_0x833f('0x2d')](_0x484d77,_0x833f('0x2a'));_0x2df0aa['query']=_[_0x833f('0x32')](_0x555718[_0x833f('0x33')]);_0x2df0aa[_0x833f('0x34')]=_[_0x833f('0x35')](_0x2df0aa[_0x833f('0x31')],_0x2df0aa['query']);_0xb26093[_0x833f('0x36')]=_[_0x833f('0x35')](_0x2df0aa[_0x833f('0x31')],qs[_0x833f('0x37')](_0x555718[_0x833f('0x33')][_0x833f('0x37')]));_0xb26093[_0x833f('0x36')]=_0xb26093[_0x833f('0x36')]['length']?_0xb26093['attributes']:_0x2df0aa[_0x833f('0x31')];if(!_0x555718['query'][_0x833f('0x38')](_0x833f('0x39'))){_0xb26093[_0x833f('0x1c')]=qs[_0x833f('0x1c')](_0x555718[_0x833f('0x33')]['limit']);_0xb26093[_0x833f('0x1f')]=qs['offset'](_0x555718[_0x833f('0x33')]['offset']);}_0xb26093[_0x833f('0x3a')]=qs[_0x833f('0x3b')](_0x555718[_0x833f('0x33')][_0x833f('0x3b')]);_0xb26093[_0x833f('0x3c')]=qs[_0x833f('0x34')](_[_0x833f('0x3d')](_0x555718['query'],_0x2df0aa[_0x833f('0x34')]),_0x484d77);if(_0x555718[_0x833f('0x33')][_0x833f('0x3e')]){_0xb26093['where']=_[_0x833f('0x3f')](_0xb26093[_0x833f('0x3c')],{'$or':_[_0x833f('0x2d')](_0x484d77,function(_0x2d87b5){if(_0x2d87b5['type']!==_0x833f('0x40')){var _0x23ab1c={};_0x23ab1c[_0x2d87b5[_0x833f('0x2a')]]={'$like':'%'+_0x555718['query'][_0x833f('0x3e')]+'%'};return _0x23ab1c;}})});}_0xb26093=_[_0x833f('0x3f')]({},_0xb26093,_0x555718[_0x833f('0x41')]);var _0x32ee2f={'where':_0xb26093['where']};return db['ChatTransferReport']['count'](_0x32ee2f)[_0x833f('0x26')](function(_0x225f4d){_0x466aff[_0x833f('0x1e')]=_0x225f4d;if(_0x555718[_0x833f('0x33')]['includeAll']){_0xb26093[_0x833f('0x42')]=[{'all':!![]}];}return db['ChatTransferReport'][_0x833f('0x43')](_0xb26093);})['then'](function(_0x25c7a6){_0x466aff[_0x833f('0x44')]=_0x25c7a6;return _0x466aff;})[_0x833f('0x26')](respondWithFilteredResult(_0x30c8e1,_0xb26093))[_0x833f('0x45')](handleError(_0x30c8e1,null));};exports[_0x833f('0x46')]=function(_0x2d61e7,_0x391ec1){var _0x4365e2={'raw':!![],'where':{'id':_0x2d61e7[_0x833f('0x47')]['id']}},_0x49588b={};_0x49588b[_0x833f('0x31')]=_['keys'](db['ChatTransferReport'][_0x833f('0x2e')]);_0x49588b['query']=_[_0x833f('0x32')](_0x2d61e7[_0x833f('0x33')]);_0x49588b[_0x833f('0x34')]=_[_0x833f('0x35')](_0x49588b['model'],_0x49588b[_0x833f('0x33')]);_0x4365e2[_0x833f('0x36')]=_[_0x833f('0x35')](_0x49588b['model'],qs[_0x833f('0x37')](_0x2d61e7[_0x833f('0x33')][_0x833f('0x37')]));_0x4365e2[_0x833f('0x36')]=_0x4365e2[_0x833f('0x36')][_0x833f('0x48')]?_0x4365e2[_0x833f('0x36')]:_0x49588b[_0x833f('0x31')];if(_0x2d61e7['query'][_0x833f('0x49')]){_0x4365e2['include']=[{'all':!![]}];}_0x4365e2=_['merge']({},_0x4365e2,_0x2d61e7['options']);return db[_0x833f('0x4a')][_0x833f('0x4b')](_0x4365e2)[_0x833f('0x26')](handleEntityNotFound(_0x391ec1,null))[_0x833f('0x26')](respondWithResult(_0x391ec1,null))[_0x833f('0x45')](handleError(_0x391ec1,null));};exports[_0x833f('0x4c')]=function(_0x4fce8a,_0x6cd73b){return db[_0x833f('0x4a')][_0x833f('0x4c')](_0x4fce8a[_0x833f('0x4d')],{})[_0x833f('0x26')](respondWithResult(_0x6cd73b,0xc9))['catch'](handleError(_0x6cd73b,null));};exports['update']=function(_0x270693,_0x5235c4){if(_0x270693[_0x833f('0x4d')]['id']){delete _0x270693[_0x833f('0x4d')]['id'];}return db['ChatTransferReport'][_0x833f('0x4b')]({'where':{'id':_0x270693[_0x833f('0x47')]['id']}})[_0x833f('0x26')](handleEntityNotFound(_0x5235c4,null))[_0x833f('0x26')](saveUpdates(_0x270693[_0x833f('0x4d')],null))[_0x833f('0x26')](respondWithResult(_0x5235c4,null))[_0x833f('0x45')](handleError(_0x5235c4,null));};exports[_0x833f('0x27')]=function(_0x4d2f59,_0x1333a8){return db[_0x833f('0x4a')]['find']({'where':{'id':_0x4d2f59['params']['id']}})[_0x833f('0x26')](handleEntityNotFound(_0x1333a8,null))[_0x833f('0x26')](removeEntity(_0x1333a8,null))[_0x833f('0x45')](handleError(_0x1333a8,null));};exports[_0x833f('0x4e')]=function(_0x5bedf1,_0x4c1fad){return db['ChatTransferReport']['describe']()[_0x833f('0x26')](respondWithResult(_0x4c1fad,null))[_0x833f('0x45')](handleError(_0x4c1fad,null));}; \ No newline at end of file +var _0xd6ff=['destroy','error','stack','name','send','index','map','ChatTransferReport','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','options','includeAll','include','rows','catch','show','params','rawAttributes','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','save','update','then'];(function(_0x37b23c,_0x33b39e){var _0x59dd00=function(_0x5dc82c){while(--_0x5dc82c){_0x37b23c['push'](_0x37b23c['shift']());}};_0x59dd00(++_0x33b39e);}(_0xd6ff,0xbf));var _0xfd6f=function(_0x4e69c6,_0x5878eb){_0x4e69c6=_0x4e69c6-0x0;var _0x2643ac=_0xd6ff[_0x4e69c6];return _0x2643ac;};'use strict';var emlformat=require(_0xfd6f('0x0'));var rimraf=require(_0xfd6f('0x1'));var zipdir=require(_0xfd6f('0x2'));var jsonpatch=require(_0xfd6f('0x3'));var rp=require(_0xfd6f('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xfd6f('0x5'));var path=require(_0xfd6f('0x6'));var sox=require(_0xfd6f('0x7'));var csv=require(_0xfd6f('0x8'));var ejs=require(_0xfd6f('0x9'));var fs=require('fs');var fs_extra=require(_0xfd6f('0xa'));var _=require(_0xfd6f('0xb'));var squel=require(_0xfd6f('0xc'));var crypto=require('crypto');var jsforce=require(_0xfd6f('0xd'));var deskjs=require(_0xfd6f('0xe'));var toCsv=require(_0xfd6f('0x8'));var querystring=require(_0xfd6f('0xf'));var Papa=require(_0xfd6f('0x10'));var Redis=require(_0xfd6f('0x11'));var authService=require(_0xfd6f('0x12'));var qs=require(_0xfd6f('0x13'));var as=require(_0xfd6f('0x14'));var hardwareService=require(_0xfd6f('0x15'));var logger=require(_0xfd6f('0x16'))(_0xfd6f('0x17'));var utils=require(_0xfd6f('0x18'));var config=require(_0xfd6f('0x19'));var licenseUtil=require(_0xfd6f('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5185de,_0x559ecd){_0x559ecd=_0x559ecd||0xcc;return function(_0x5ec60c){if(_0x5ec60c){return _0x5185de['sendStatus'](_0x559ecd);}return _0x5185de['status'](_0x559ecd)[_0xfd6f('0x1b')]();};}function respondWithResult(_0x510adb,_0x312a38){_0x312a38=_0x312a38||0xc8;return function(_0x4169f7){if(_0x4169f7){return _0x510adb['status'](_0x312a38)[_0xfd6f('0x1c')](_0x4169f7);}};}function respondWithFilteredResult(_0x247a51,_0x134151){return function(_0x5202f5){if(_0x5202f5){var _0x161795=typeof _0x134151[_0xfd6f('0x1d')]===_0xfd6f('0x1e')&&typeof _0x134151[_0xfd6f('0x1f')]===_0xfd6f('0x1e');var _0x28d1f7=_0x5202f5[_0xfd6f('0x20')];var _0x5a3633=_0x161795?0x0:_0x134151[_0xfd6f('0x1d')];var _0x2e8dbf=_0x161795?_0x5202f5['count']:_0x134151[_0xfd6f('0x1d')]+_0x134151['limit'];var _0x4fd616;if(_0x2e8dbf>=_0x28d1f7){_0x2e8dbf=_0x28d1f7;_0x4fd616=0xc8;}else{_0x4fd616=0xce;}_0x247a51[_0xfd6f('0x21')](_0x4fd616);return _0x247a51[_0xfd6f('0x22')](_0xfd6f('0x23'),_0x5a3633+'-'+_0x2e8dbf+'/'+_0x28d1f7)['json'](_0x5202f5);}return null;};}function patchUpdates(_0x4e2561){return function(_0x2492ef){try{jsonpatch[_0xfd6f('0x24')](_0x2492ef,_0x4e2561,!![]);}catch(_0x49f145){return BPromise['reject'](_0x49f145);}return _0x2492ef[_0xfd6f('0x25')]();};}function saveUpdates(_0x367a5a,_0x25b23f){return function(_0x8bd20){if(_0x8bd20){return _0x8bd20[_0xfd6f('0x26')](_0x367a5a)[_0xfd6f('0x27')](function(_0xcbbfd3){return _0xcbbfd3;});}return null;};}function removeEntity(_0x5541c6,_0x363a61){return function(_0x527cb7){if(_0x527cb7){return _0x527cb7[_0xfd6f('0x28')]()['then'](function(){_0x5541c6[_0xfd6f('0x21')](0xcc)[_0xfd6f('0x1b')]();});}};}function handleEntityNotFound(_0x579971,_0x4baf41){return function(_0x1684f7){if(!_0x1684f7){_0x579971['sendStatus'](0x194);}return _0x1684f7;};}function handleError(_0x51edc6,_0x457035){_0x457035=_0x457035||0x1f4;return function(_0x3909ad){logger[_0xfd6f('0x29')](_0x3909ad[_0xfd6f('0x2a')]);if(_0x3909ad[_0xfd6f('0x2b')]){delete _0x3909ad[_0xfd6f('0x2b')];}_0x51edc6[_0xfd6f('0x21')](_0x457035)[_0xfd6f('0x2c')](_0x3909ad);};}exports[_0xfd6f('0x2d')]=function(_0x348a88,_0x5e532e){var _0x2587f9={},_0x24e139={},_0x200ce={'count':0x0,'rows':[]};var _0x3e0071=_[_0xfd6f('0x2e')](db[_0xfd6f('0x2f')]['rawAttributes'],function(_0x8d0c6b){return{'name':_0x8d0c6b[_0xfd6f('0x30')],'type':_0x8d0c6b[_0xfd6f('0x31')][_0xfd6f('0x32')]};});_0x24e139['model']=_[_0xfd6f('0x2e')](_0x3e0071,_0xfd6f('0x2b'));_0x24e139[_0xfd6f('0x33')]=_[_0xfd6f('0x34')](_0x348a88[_0xfd6f('0x33')]);_0x24e139[_0xfd6f('0x35')]=_[_0xfd6f('0x36')](_0x24e139['model'],_0x24e139['query']);_0x2587f9[_0xfd6f('0x37')]=_[_0xfd6f('0x36')](_0x24e139[_0xfd6f('0x38')],qs[_0xfd6f('0x39')](_0x348a88[_0xfd6f('0x33')]['fields']));_0x2587f9['attributes']=_0x2587f9[_0xfd6f('0x37')][_0xfd6f('0x3a')]?_0x2587f9['attributes']:_0x24e139[_0xfd6f('0x38')];if(!_0x348a88['query'][_0xfd6f('0x3b')](_0xfd6f('0x3c'))){_0x2587f9[_0xfd6f('0x1f')]=qs[_0xfd6f('0x1f')](_0x348a88[_0xfd6f('0x33')][_0xfd6f('0x1f')]);_0x2587f9[_0xfd6f('0x1d')]=qs['offset'](_0x348a88[_0xfd6f('0x33')][_0xfd6f('0x1d')]);}_0x2587f9[_0xfd6f('0x3d')]=qs[_0xfd6f('0x3e')](_0x348a88[_0xfd6f('0x33')][_0xfd6f('0x3e')]);_0x2587f9[_0xfd6f('0x3f')]=qs['filters'](_['pick'](_0x348a88[_0xfd6f('0x33')],_0x24e139[_0xfd6f('0x35')]),_0x3e0071);if(_0x348a88[_0xfd6f('0x33')]['filter']){_0x2587f9[_0xfd6f('0x3f')]=_[_0xfd6f('0x40')](_0x2587f9[_0xfd6f('0x3f')],{'$or':_[_0xfd6f('0x2e')](_0x3e0071,function(_0x259b6c){if(_0x259b6c[_0xfd6f('0x31')]!=='VIRTUAL'){var _0x4011f1={};_0x4011f1[_0x259b6c[_0xfd6f('0x2b')]]={'$like':'%'+_0x348a88[_0xfd6f('0x33')]['filter']+'%'};return _0x4011f1;}})});}_0x2587f9=_[_0xfd6f('0x40')]({},_0x2587f9,_0x348a88[_0xfd6f('0x41')]);var _0x40542b={'where':_0x2587f9[_0xfd6f('0x3f')]};return db['ChatTransferReport']['count'](_0x40542b)[_0xfd6f('0x27')](function(_0x5046c7){_0x200ce[_0xfd6f('0x20')]=_0x5046c7;if(_0x348a88[_0xfd6f('0x33')][_0xfd6f('0x42')]){_0x2587f9[_0xfd6f('0x43')]=[{'all':!![]}];}return db['ChatTransferReport']['findAll'](_0x2587f9);})[_0xfd6f('0x27')](function(_0x2677b9){_0x200ce[_0xfd6f('0x44')]=_0x2677b9;return _0x200ce;})[_0xfd6f('0x27')](respondWithFilteredResult(_0x5e532e,_0x2587f9))[_0xfd6f('0x45')](handleError(_0x5e532e,null));};exports[_0xfd6f('0x46')]=function(_0x3eb2af,_0x2a89ec){var _0x2ed6b0={'raw':!![],'where':{'id':_0x3eb2af[_0xfd6f('0x47')]['id']}},_0x5122a0={};_0x5122a0[_0xfd6f('0x38')]=_['keys'](db['ChatTransferReport'][_0xfd6f('0x48')]);_0x5122a0['query']=_[_0xfd6f('0x34')](_0x3eb2af[_0xfd6f('0x33')]);_0x5122a0[_0xfd6f('0x35')]=_[_0xfd6f('0x36')](_0x5122a0[_0xfd6f('0x38')],_0x5122a0[_0xfd6f('0x33')]);_0x2ed6b0['attributes']=_['intersection'](_0x5122a0['model'],qs[_0xfd6f('0x39')](_0x3eb2af[_0xfd6f('0x33')][_0xfd6f('0x39')]));_0x2ed6b0[_0xfd6f('0x37')]=_0x2ed6b0[_0xfd6f('0x37')][_0xfd6f('0x3a')]?_0x2ed6b0['attributes']:_0x5122a0[_0xfd6f('0x38')];if(_0x3eb2af[_0xfd6f('0x33')][_0xfd6f('0x42')]){_0x2ed6b0[_0xfd6f('0x43')]=[{'all':!![]}];}_0x2ed6b0=_['merge']({},_0x2ed6b0,_0x3eb2af[_0xfd6f('0x41')]);return db[_0xfd6f('0x2f')][_0xfd6f('0x49')](_0x2ed6b0)['then'](handleEntityNotFound(_0x2a89ec,null))[_0xfd6f('0x27')](respondWithResult(_0x2a89ec,null))[_0xfd6f('0x45')](handleError(_0x2a89ec,null));};exports[_0xfd6f('0x4a')]=function(_0x1df252,_0x28ef06){return db[_0xfd6f('0x2f')][_0xfd6f('0x4a')](_0x1df252['body'],{})[_0xfd6f('0x27')](respondWithResult(_0x28ef06,0xc9))[_0xfd6f('0x45')](handleError(_0x28ef06,null));};exports[_0xfd6f('0x26')]=function(_0x4c0fcb,_0x288cb6){if(_0x4c0fcb[_0xfd6f('0x4b')]['id']){delete _0x4c0fcb[_0xfd6f('0x4b')]['id'];}return db[_0xfd6f('0x2f')][_0xfd6f('0x49')]({'where':{'id':_0x4c0fcb[_0xfd6f('0x47')]['id']}})[_0xfd6f('0x27')](handleEntityNotFound(_0x288cb6,null))[_0xfd6f('0x27')](saveUpdates(_0x4c0fcb[_0xfd6f('0x4b')],null))[_0xfd6f('0x27')](respondWithResult(_0x288cb6,null))[_0xfd6f('0x45')](handleError(_0x288cb6,null));};exports[_0xfd6f('0x28')]=function(_0x5d0328,_0x22fb78){return db[_0xfd6f('0x2f')][_0xfd6f('0x49')]({'where':{'id':_0x5d0328[_0xfd6f('0x47')]['id']}})[_0xfd6f('0x27')](handleEntityNotFound(_0x22fb78,null))[_0xfd6f('0x27')](removeEntity(_0x22fb78,null))[_0xfd6f('0x45')](handleError(_0x22fb78,null));};exports[_0xfd6f('0x4c')]=function(_0x2d3956,_0x394633){return db[_0xfd6f('0x2f')]['describe']()[_0xfd6f('0x27')](respondWithResult(_0x394633,null))[_0xfd6f('0x45')](handleError(_0x394633,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 87c2256..85482b2 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 _0xb746=['ChatTransferReport','report_chat_transfer','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./chatTransferReport.attributes','exports'];(function(_0x2a642d,_0x2df503){var _0x4adf7d=function(_0x5c3068){while(--_0x5c3068){_0x2a642d['push'](_0x2a642d['shift']());}};_0x4adf7d(++_0x2df503);}(_0xb746,0x162));var _0x6b74=function(_0x4ceec9,_0x16057d){_0x4ceec9=_0x4ceec9-0x0;var _0x4e2033=_0xb746[_0x4ceec9];return _0x4e2033;};'use strict';var _=require(_0x6b74('0x0'));var util=require('util');var logger=require(_0x6b74('0x1'))(_0x6b74('0x2'));var moment=require(_0x6b74('0x3'));var BPromise=require(_0x6b74('0x4'));var rp=require(_0x6b74('0x5'));var fs=require('fs');var path=require(_0x6b74('0x6'));var rimraf=require('rimraf');var config=require(_0x6b74('0x7'));var attributes=require(_0x6b74('0x8'));module[_0x6b74('0x9')]=function(_0x12a443,_0x26cedb){return _0x12a443['define'](_0x6b74('0xa'),attributes,{'tableName':_0x6b74('0xb'),'paranoid':![],'indexes':[{'name':_0x6b74('0xc'),'fields':[_0x6b74('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8d74=['report_chat_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatTransferReport.attributes','exports','define','ChatTransferReport'];(function(_0x11ac40,_0x375c63){var _0x45b544=function(_0x1e41c2){while(--_0x1e41c2){_0x11ac40['push'](_0x11ac40['shift']());}};_0x45b544(++_0x375c63);}(_0x8d74,0x152));var _0x48d7=function(_0x34b63b,_0x3601e0){_0x34b63b=_0x34b63b-0x0;var _0x3fc0b9=_0x8d74[_0x34b63b];return _0x3fc0b9;};'use strict';var _=require(_0x48d7('0x0'));var util=require(_0x48d7('0x1'));var logger=require(_0x48d7('0x2'))(_0x48d7('0x3'));var moment=require(_0x48d7('0x4'));var BPromise=require(_0x48d7('0x5'));var rp=require(_0x48d7('0x6'));var fs=require('fs');var path=require(_0x48d7('0x7'));var rimraf=require(_0x48d7('0x8'));var config=require(_0x48d7('0x9'));var attributes=require(_0x48d7('0xa'));module[_0x48d7('0xb')]=function(_0x5af388,_0x3ee7d6){return _0x5af388[_0x48d7('0xc')](_0x48d7('0xd'),attributes,{'tableName':_0x48d7('0xe'),'paranoid':![],'indexes':[{'name':_0x48d7('0xf'),'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 bd40b9e..43c57d8 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 _0xc11e=['ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then'];(function(_0x5f3031,_0x350e0f){var _0x3879e6=function(_0x337da7){while(--_0x337da7){_0x5f3031['push'](_0x5f3031['shift']());}};_0x3879e6(++_0x350e0f);}(_0xc11e,0x153));var _0xec11=function(_0xd4636c,_0x34dbf6){_0xd4636c=_0xd4636c-0x0;var _0x5ee17d=_0xc11e[_0xd4636c];return _0x5ee17d;};'use strict';var _=require(_0xec11('0x0'));var util=require(_0xec11('0x1'));var moment=require('moment');var BPromise=require(_0xec11('0x2'));var rs=require(_0xec11('0x3'));var fs=require('fs');var Redis=require(_0xec11('0x4'));var db=require(_0xec11('0x5'))['db'];var utils=require(_0xec11('0x6'));var logger=require(_0xec11('0x7'))(_0xec11('0x8'));var config=require('../../config/environment');var jayson=require(_0xec11('0x9'));var client=jayson['client'][_0xec11('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2faf25,_0x209007,_0xbf648f){return new BPromise(function(_0x4e0d05,_0x366d7b){return client[_0xec11('0xb')](_0x2faf25,_0xbf648f)[_0xec11('0xc')](function(_0x37fd71){logger['info'](_0xec11('0xd'),_0x209007,_0xec11('0xe'));logger[_0xec11('0xf')](_0xec11('0x10'),_0x209007,_0xec11('0xe'),JSON[_0xec11('0x11')](_0x37fd71));if(_0x37fd71[_0xec11('0x12')]){if(_0x37fd71[_0xec11('0x12')]['code']===0x1f4){logger['error']('ChatTransferReport,\x20%s,\x20%s',_0x209007,_0x37fd71[_0xec11('0x12')][_0xec11('0x13')]);return _0x366d7b(_0x37fd71[_0xec11('0x12')][_0xec11('0x13')]);}logger[_0xec11('0x12')](_0xec11('0xd'),_0x209007,_0x37fd71[_0xec11('0x12')][_0xec11('0x13')]);return _0x4e0d05(_0x37fd71['error'][_0xec11('0x13')]);}else{logger[_0xec11('0x14')](_0xec11('0xd'),_0x209007,_0xec11('0xe'));_0x4e0d05(_0x37fd71[_0xec11('0x15')][_0xec11('0x13')]);}})['catch'](function(_0x228978){logger['error']('ChatTransferReport,\x20%s,\x20%s',_0x209007,_0x228978);_0x366d7b(_0x228978);});});} \ No newline at end of file +var _0xa9ff=['jayson/promise','client','http','request','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','lodash','util','randomstring','ioredis','../../mysqldb','rpc'];(function(_0x52af14,_0x450fa2){var _0x5068b0=function(_0x18a797){while(--_0x18a797){_0x52af14['push'](_0x52af14['shift']());}};_0x5068b0(++_0x450fa2);}(_0xa9ff,0x1f2));var _0xfa9f=function(_0x46a38b,_0x16ffb5){_0x46a38b=_0x46a38b-0x0;var _0x346e75=_0xa9ff[_0x46a38b];return _0x346e75;};'use strict';var _=require(_0xfa9f('0x0'));var util=require(_0xfa9f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xfa9f('0x2'));var fs=require('fs');var Redis=require(_0xfa9f('0x3'));var db=require(_0xfa9f('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xfa9f('0x5'));var config=require('../../config/environment');var jayson=require(_0xfa9f('0x6'));var client=jayson[_0xfa9f('0x7')][_0xfa9f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2b5c3b,_0x42c426,_0x48cdc7){return new BPromise(function(_0x2ceefa,_0xdc8fb4){return client[_0xfa9f('0x9')](_0x2b5c3b,_0x48cdc7)[_0xfa9f('0xa')](function(_0x32d9fe){logger[_0xfa9f('0xb')](_0xfa9f('0xc'),_0x42c426,_0xfa9f('0xd'));logger[_0xfa9f('0xe')](_0xfa9f('0xf'),_0x42c426,'request\x20sent',JSON[_0xfa9f('0x10')](_0x32d9fe));if(_0x32d9fe['error']){if(_0x32d9fe['error'][_0xfa9f('0x11')]===0x1f4){logger[_0xfa9f('0x12')]('ChatTransferReport,\x20%s,\x20%s',_0x42c426,_0x32d9fe['error'][_0xfa9f('0x13')]);return _0xdc8fb4(_0x32d9fe[_0xfa9f('0x12')][_0xfa9f('0x13')]);}logger[_0xfa9f('0x12')](_0xfa9f('0xc'),_0x42c426,_0x32d9fe['error'][_0xfa9f('0x13')]);return _0x2ceefa(_0x32d9fe[_0xfa9f('0x12')][_0xfa9f('0x13')]);}else{logger[_0xfa9f('0xb')](_0xfa9f('0xc'),_0x42c426,'request\x20sent');_0x2ceefa(_0x32d9fe[_0xfa9f('0x14')][_0xfa9f('0x13')]);}})['catch'](function(_0x432c62){logger['error'](_0xfa9f('0xc'),_0x42c426,_0x432c62);_0xdc8fb4(_0x432c62);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 9b8793e..4d50dff 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 _0x368e=['get','isAuthenticated','index','describe','/:id','show','post','put','update','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','./chatTransferReport.controller'];(function(_0xbaae28,_0x5657f5){var _0x542e54=function(_0x24e247){while(--_0x24e247){_0xbaae28['push'](_0xbaae28['shift']());}};_0x542e54(++_0x5657f5);}(_0x368e,0x196));var _0xe368=function(_0x3337b6,_0x42c7f9){_0x3337b6=_0x3337b6-0x0;var _0x568270=_0x368e[_0x3337b6];return _0x568270;};'use strict';var multer=require(_0xe368('0x0'));var util=require(_0xe368('0x1'));var path=require(_0xe368('0x2'));var timeout=require(_0xe368('0x3'));var express=require('express');var router=express[_0xe368('0x4')]();var fs_extra=require(_0xe368('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xe368('0x6'));var config=require('../../config/environment');var controller=require(_0xe368('0x7'));router[_0xe368('0x8')]('/',auth[_0xe368('0x9')](),controller[_0xe368('0xa')]);router[_0xe368('0x8')]('/describe',auth['isAuthenticated'](),controller[_0xe368('0xb')]);router[_0xe368('0x8')](_0xe368('0xc'),auth[_0xe368('0x9')](),controller[_0xe368('0xd')]);router[_0xe368('0xe')]('/',auth[_0xe368('0x9')](),controller['create']);router[_0xe368('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xe368('0x10')]);router['delete'](_0xe368('0xc'),auth[_0xe368('0x9')](),controller['destroy']);module[_0xe368('0x11')]=router; \ No newline at end of file +var _0x038e=['express','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','delete','util','path'];(function(_0x1559ca,_0x3242fc){var _0x603f00=function(_0x3134cc){while(--_0x3134cc){_0x1559ca['push'](_0x1559ca['shift']());}};_0x603f00(++_0x3242fc);}(_0x038e,0x1ce));var _0xe038=function(_0x38ae35,_0x16c078){_0x38ae35=_0x38ae35-0x0;var _0x4b3e8f=_0x038e[_0x38ae35];return _0x4b3e8f;};'use strict';var multer=require('multer');var util=require(_0xe038('0x0'));var path=require(_0xe038('0x1'));var timeout=require('connect-timeout');var express=require(_0xe038('0x2'));var router=express[_0xe038('0x3')]();var fs_extra=require(_0xe038('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xe038('0x5'));var config=require('../../config/environment');var controller=require('./chatTransferReport.controller');router[_0xe038('0x6')]('/',auth[_0xe038('0x7')](),controller[_0xe038('0x8')]);router['get'](_0xe038('0x9'),auth[_0xe038('0x7')](),controller[_0xe038('0xa')]);router[_0xe038('0x6')](_0xe038('0xb'),auth[_0xe038('0x7')](),controller[_0xe038('0xc')]);router[_0xe038('0xd')]('/',auth[_0xe038('0x7')](),controller['create']);router[_0xe038('0xe')](_0xe038('0xb'),auth['isAuthenticated'](),controller['update']);router[_0xe038('0xf')]('/:id',auth['isAuthenticated'](),controller['destroy']);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 2c90e86..5a609a8 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 _0x5b03=['TEXT','name','text','input','getDataValue','onlineForm','setDataValue','stringify','textarea','Comments','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.','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','website_alias','bottom_right','CHAT','#fafafa','System','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','sequelize','randomstring','exports','STRING','address','email','Agent','#011F6A','ENUM','rounded','squared','We\x20are\x20here!','Chat','Send','Contact\x20us','BOOLEAN','INTEGER','Powered\x20by\x20xCALLY','Form\x20properly\x20submitted','Note','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','star','thumb'];(function(_0x3272e3,_0x2db4a5){var _0xb2f245=function(_0x4fe8a1){while(--_0x4fe8a1){_0x3272e3['push'](_0x3272e3['shift']());}};_0xb2f245(++_0x2db4a5);}(_0x5b03,0x145));var _0x35b0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5b03[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x35b0('0x0'));var rs=require(_0x35b0('0x1'));module[_0x35b0('0x2')]={'name':{'type':Sequelize[_0x35b0('0x3')],'allowNull':![]},'address':{'type':Sequelize[_0x35b0('0x3')],'allowNull':![],'unique':_0x35b0('0x4')},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize['STRING'],'defaultValue':_0x35b0('0x5')},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':'email'},'key':{'type':Sequelize[_0x35b0('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':_0x35b0('0x6')},'customerAlias':{'type':Sequelize['STRING'],'defaultValue':'Me'},'color':{'type':Sequelize[_0x35b0('0x3')],'allowNull':![],'defaultValue':_0x35b0('0x7'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x35b0('0x3')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x35b0('0x3')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x35b0('0x8')](_0x35b0('0x9'),_0x35b0('0xa')),'defaultValue':_0x35b0('0x9')},'header_online':{'type':Sequelize[_0x35b0('0x3')],'defaultValue':_0x35b0('0xb')},'start_chat_button':{'type':Sequelize[_0x35b0('0x3')],'defaultValue':_0x35b0('0xc')},'offline_chat_button':{'type':Sequelize[_0x35b0('0x3')],'defaultValue':_0x35b0('0xd')},'header_offline':{'type':Sequelize[_0x35b0('0x3')],'defaultValue':_0x35b0('0xe')},'download_transcript':{'type':Sequelize[_0x35b0('0xf')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x35b0('0x10')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x35b0('0x3')],'defaultValue':_0x35b0('0x11')},'defaultWhiteLabel':{'type':Sequelize[_0x35b0('0xf')],'defaultValue':!![]},'sitepic':{'type':Sequelize['TEXT']},'closingQuestion':{'type':Sequelize[_0x35b0('0x3')],'defaultValue':'Do\x20you\x20want\x20to\x20close\x20the\x20interaction?'},'formSubmitSuccessMessage':{'type':Sequelize[_0x35b0('0x3')],'defaultValue':_0x35b0('0x12')},'formSubmitFailureMessage':{'type':Sequelize[_0x35b0('0x3')],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize[_0x35b0('0x3')],'defaultValue':_0x35b0('0x13')},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x35b0('0x14')},'closingMessageButton':{'type':Sequelize[_0x35b0('0x3')],'defaultValue':_0x35b0('0xd')},'skipMessageButton':{'type':Sequelize[_0x35b0('0x3')],'defaultValue':_0x35b0('0x15')},'conditionAgreement':{'type':Sequelize[_0x35b0('0xf')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x35b0('0xf')],'defaultValue':![]},'enableFeedback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x35b0('0xf')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x35b0('0x3')],'defaultValue':_0x35b0('0x16')},'ratingType':{'type':Sequelize[_0x35b0('0x8')](_0x35b0('0x17'),_0x35b0('0x18')),'defaultValue':_0x35b0('0x17')},'ratingStarsNumber':{'type':Sequelize[_0x35b0('0x10')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x35b0('0x19')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':'input','variable':null,'config':{'placeholder':_0x35b0('0x1a'),'type':_0x35b0('0x1b'),'required':!![]},'props':{'title':'name','helpText':''}},{'type':_0x35b0('0x1c'),'props':{'title':_0x35b0('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0x35b0('0x5'),'type':_0x35b0('0x5')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x35b0('0x1d')](_0x35b0('0x1e'))?JSON['parse'](this[_0x35b0('0x1d')](_0x35b0('0x1e'))):{};},'set':function(_0x886d1c){return this[_0x35b0('0x1f')]('onlineForm',JSON[_0x35b0('0x20')](_0x886d1c));}},'offlineForm':{'type':Sequelize[_0x35b0('0x19')],'defaultValue':function(){return JSON[_0x35b0('0x20')]({'items':[{'type':_0x35b0('0x1c'),'props':{'title':_0x35b0('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0x35b0('0x5'),'type':'email'},'variable':null},{'type':_0x35b0('0x21'),'config':{'placeholder':'Comments'},'props':{'title':_0x35b0('0x22'),'helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this[_0x35b0('0x1d')]('offlineForm')?JSON[_0x35b0('0x23')](this['getDataValue'](_0x35b0('0x24'))):{};},'set':function(_0x550f10){return this['setDataValue'](_0x35b0('0x24'),JSON[_0x35b0('0x20')](_0x550f10));}},'token':{'type':Sequelize[_0x35b0('0x3')],'defaultValue':function(){return rs[_0x35b0('0x25')]();}},'autoclose':{'type':Sequelize[_0x35b0('0xf')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x35b0('0xf')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x35b0('0xf')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x35b0('0x3')]},'forwardOffline':{'type':Sequelize[_0x35b0('0xf')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x35b0('0x3')]},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':_0x35b0('0x26')},'waitingMessage':{'type':Sequelize[_0x35b0('0x3')],'defaultValue':_0x35b0('0x27')},'offlineMessageSubject':{'type':Sequelize['STRING'],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize[_0x35b0('0x3')],'defaultValue':_0x35b0('0x28')},'enableUnmanagedNote':{'type':Sequelize[_0x35b0('0xf')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x35b0('0x3')],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x35b0('0x15')},'sendUnmanaged':{'type':Sequelize[_0x35b0('0x3')],'defaultValue':_0x35b0('0xd')},'enableCustomerAttachment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x35b0('0xf')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x35b0('0x19')]},'showAgentAvatar':{'type':Sequelize[_0x35b0('0xf')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x35b0('0x3')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x35b0('0xf')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x35b0('0xf')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x35b0('0x3')],'defaultValue':_0x35b0('0x29')},'waitForTheAssignedAgent':{'type':Sequelize[_0x35b0('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x35b0('0x3')],'defaultValue':_0x35b0('0x2a')},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x35b0('0x3')],'defaultValue':_0x35b0('0x2b')},'messagesAlignment':{'type':Sequelize[_0x35b0('0x3')],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize[_0x35b0('0x3')]},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x35b0('0x3')],'allowNull':![],'defaultValue':_0x35b0('0x2c'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x35b0('0xf')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x35b0('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x35b0('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x35b0('0x3')],'defaultValue':_0x35b0('0x2d')},'systemAvatar':{'type':Sequelize[_0x35b0('0x19')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x35b0('0x2e'),'set':function(_0x4d654e){if(!_0x4d654e)this[_0x35b0('0x1f')](_0x35b0('0x2f'),null);this['setDataValue'](_0x35b0('0x30'),_0x4d654e);}},'vidaooEscalation':{'type':Sequelize[_0x35b0('0xf')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x35b0('0x3')]},'vidaooTopic':{'type':Sequelize[_0x35b0('0x3')],'allowNull':![],'defaultValue':_0x35b0('0x31')},'vidaooNote':{'type':Sequelize[_0x35b0('0x3')],'defaultValue':function(){return'Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}';}},'vidaooMetadata':{'type':Sequelize[_0x35b0('0x19')],'defaultValue':null},'openNewInteraction':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x2745=['TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','star','INTEGER','stringify','input','name','text','getDataValue','onlineForm','parse','textarea','Comments','Leave\x20your\x20comments','offlineForm','setDataValue','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','website_alias','CHAT','System','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','sequelize','randomstring','exports','STRING','address','email','Agent','#011F6A','BOOLEAN','ENUM','rounded','squared','We\x20are\x20here!','Send','Contact\x20us'];(function(_0x243b84,_0x57739f){var _0x57ee61=function(_0x28db02){while(--_0x28db02){_0x243b84['push'](_0x243b84['shift']());}};_0x57ee61(++_0x57739f);}(_0x2745,0x13a));var _0x5274=function(_0x59d25d,_0x56affa){_0x59d25d=_0x59d25d-0x0;var _0x2f9508=_0x2745[_0x59d25d];return _0x2f9508;};'use strict';var Sequelize=require(_0x5274('0x0'));var rs=require(_0x5274('0x1'));module[_0x5274('0x2')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'address':{'type':Sequelize[_0x5274('0x3')],'allowNull':![],'unique':_0x5274('0x4')},'description':{'type':Sequelize[_0x5274('0x3')]},'mapKey':{'type':Sequelize[_0x5274('0x3')],'defaultValue':_0x5274('0x5')},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0x5274('0x5')},'key':{'type':Sequelize[_0x5274('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x5274('0x3')],'defaultValue':_0x5274('0x6')},'customerAlias':{'type':Sequelize[_0x5274('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x5274('0x3')],'allowNull':![],'defaultValue':_0x5274('0x7'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x5274('0x3')],'allowNull':![],'defaultValue':_0x5274('0x7'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x5274('0x3')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize[_0x5274('0x3')]},'animation':{'type':Sequelize[_0x5274('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x5274('0x9')](_0x5274('0xa'),_0x5274('0xb')),'defaultValue':_0x5274('0xa')},'header_online':{'type':Sequelize[_0x5274('0x3')],'defaultValue':_0x5274('0xc')},'start_chat_button':{'type':Sequelize[_0x5274('0x3')],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize[_0x5274('0x3')],'defaultValue':_0x5274('0xd')},'header_offline':{'type':Sequelize['STRING'],'defaultValue':_0x5274('0xe')},'download_transcript':{'type':Sequelize[_0x5274('0x8')],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x5274('0xf')]},'closingQuestion':{'type':Sequelize[_0x5274('0x3')],'defaultValue':_0x5274('0x10')},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':_0x5274('0x11')},'formSubmitFailureMessage':{'type':Sequelize[_0x5274('0x3')],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize[_0x5274('0x3')],'defaultValue':_0x5274('0x12')},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':_0x5274('0x13')},'closingMessage':{'type':Sequelize[_0x5274('0x3')],'defaultValue':_0x5274('0x14')},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0x5274('0xd')},'skipMessageButton':{'type':Sequelize[_0x5274('0x3')],'defaultValue':_0x5274('0x15')},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x5274('0x8')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x5274('0x8')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x5274('0x8')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize['STRING'],'defaultValue':_0x5274('0x16')},'ratingType':{'type':Sequelize[_0x5274('0x9')]('star','thumb'),'defaultValue':_0x5274('0x17')},'ratingStarsNumber':{'type':Sequelize[_0x5274('0x18')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x5274('0xf')],'defaultValue':function(){return JSON[_0x5274('0x19')]({'items':[{'type':_0x5274('0x1a'),'variable':null,'config':{'placeholder':_0x5274('0x1b'),'type':_0x5274('0x1c'),'required':!![]},'props':{'title':'name','helpText':''}},{'type':_0x5274('0x1a'),'props':{'title':_0x5274('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0x5274('0x5'),'type':_0x5274('0x5')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x5274('0x1d')](_0x5274('0x1e'))?JSON[_0x5274('0x1f')](this[_0x5274('0x1d')](_0x5274('0x1e'))):{};},'set':function(_0x3577ea){return this['setDataValue'](_0x5274('0x1e'),JSON[_0x5274('0x19')](_0x3577ea));}},'offlineForm':{'type':Sequelize[_0x5274('0xf')],'defaultValue':function(){return JSON[_0x5274('0x19')]({'items':[{'type':_0x5274('0x1a'),'props':{'title':_0x5274('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0x5274('0x5'),'type':_0x5274('0x5')},'variable':null},{'type':_0x5274('0x20'),'config':{'placeholder':_0x5274('0x21')},'props':{'title':_0x5274('0x21'),'helpText':_0x5274('0x22')}}],'fromKey':0x0});},'get':function(){return this[_0x5274('0x1d')](_0x5274('0x23'))?JSON[_0x5274('0x1f')](this['getDataValue']('offlineForm')):{};},'set':function(_0x5dd222){return this[_0x5274('0x24')](_0x5274('0x23'),JSON[_0x5274('0x19')](_0x5dd222));}},'token':{'type':Sequelize[_0x5274('0x3')],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize[_0x5274('0x8')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x5274('0x8')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x5274('0x8')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x5274('0x3')]},'forwardOffline':{'type':Sequelize[_0x5274('0x8')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x5274('0x3')]},'waitingTitle':{'type':Sequelize[_0x5274('0x3')],'defaultValue':_0x5274('0x25')},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize[_0x5274('0x3')],'defaultValue':_0x5274('0x26')},'offlineMessageBody':{'type':Sequelize[_0x5274('0x3')],'defaultValue':_0x5274('0x27')},'enableUnmanagedNote':{'type':Sequelize[_0x5274('0x8')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':_0x5274('0x28')},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x5274('0x15')},'sendUnmanaged':{'type':Sequelize[_0x5274('0x3')],'defaultValue':_0x5274('0xd')},'enableCustomerAttachment':{'type':Sequelize[_0x5274('0x8')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x5274('0x8')],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x5274('0xf')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x5274('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x5274('0x8')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x5274('0x8')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x5274('0x3')],'defaultValue':_0x5274('0x29')},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize['STRING'],'defaultValue':'bottom_right'},'verticalAlignment':{'type':Sequelize[_0x5274('0x18')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x5274('0x3')],'defaultValue':_0x5274('0x2a')},'messagesAlignment':{'type':Sequelize[_0x5274('0x3')],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize[_0x5274('0x3')]},'customerAvatar':{'type':Sequelize[_0x5274('0xf')]},'showCustomerAvatar':{'type':Sequelize[_0x5274('0x8')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x5274('0x18')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x5274('0x3')],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x5274('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x5274('0x18')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x5274('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x5274('0x18')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x5274('0x3')],'defaultValue':_0x5274('0x2b')},'systemAvatar':{'type':Sequelize[_0x5274('0xf')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x2d9b49){if(!_0x2d9b49)this['setDataValue'](_0x5274('0x2c'),null);this[_0x5274('0x24')](_0x5274('0x2d'),_0x2d9b49);}},'vidaooEscalation':{'type':Sequelize[_0x5274('0x8')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x5274('0x3')]},'vidaooTopic':{'type':Sequelize[_0x5274('0x3')],'allowNull':![],'defaultValue':_0x5274('0x2e')},'vidaooNote':{'type':Sequelize[_0x5274('0x3')],'defaultValue':function(){return'Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}';}},'vidaooMetadata':{'type':Sequelize[_0x5274('0xf')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x5274('0x8')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x5274('0xf')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index bf6dfd1..a66ae81 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 _0xd2ce=['Disposition','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','sitepic','file','filename','agentAvatar','customerAvatar','addSystemAvatar','getLogo','root','../../config/license/util','getLicense','custom','isNil','existsSync','join','server/files/images/logos/','download','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','server/files/images/avatars/system_avatar.png','systemAvatar','notify','setUA','headers','user-agent','getResult','chat','CmContact','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','Sequelize','ValidationError','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','ChatApplication','Applications','list','applications','orderBy','priority','asc','account','from','contact','cf-connecting-ip','x-forwarded-for','split','firstName','lastName','x-real-port','browser','version','%s\x20%s','unknown','format','device','vendor','%s\x20%s\x20%s','stringify','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','messageId','created','autoclose','push','close','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','User','unshift','waitForTheAssignedAgent','Start','startRouting','EventManager','offline','files','CompanyId','send','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','server/files/templates/chatOfflineMessage.ejs','render','toPairs','ChatOfflineMessage','originalname','mimetype','server','attachments','basename','openNewInteraction','sequelize','transaction','Attachment','bulkCreate','MailServerOut','CloudProvider','Smtp','forwardOffline','forwardOfflineAddress','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','user','MailAccountId','subjectOffline','toPairsIn','mapValues','email','offlineMessageSubject','Chat','NotifyMailAccount','notifyMail','offline-chat','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','color','tag','Command','getSnippet','timezone','iftime\x20%s,%s','iftime\x20%s','interval','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','No\x20timezone','Interval','getProactiveActions','virtual','License','increment','chatLicenseExceeded','Intervals','all','some','readFileSync','utf8','remote','x-real-ip','connection','remoteAddress','referer','alignment','verticalAlignment','labelText','color_button','backgroundColor','hideWhenOffline','IntervalId','addApplications','READ_COMMITTED','findAndCountAll','stack','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','getFields','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','addAgents','emit','removeAgents','isArray','userChatWebsite:remove','getAgents','bluebird','mustache','util','path','ejs','fs-extra','lodash','querystring','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','jayson/promise','client','http','request','then','info','request\x20sent','debug','error','code','ChatWebsite,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','update','destroy','ChatWebsites','name','index','Pause','mandatoryDispositionPause','ChatWebsite','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','pick','filter','where','merge','includeAll','findAll','show','params','include','options','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','UserProfileResource','describe','addDisposition','ChatWebsiteId','findOne','nolimit','order','map'];(function(_0x348fa1,_0x1f815c){var _0xe177d3=function(_0x2cd736){while(--_0x2cd736){_0x348fa1['push'](_0x348fa1['shift']());}};_0xe177d3(++_0x1f815c);}(_0xd2ce,0xd1));var _0xed2c=function(_0x28d18d,_0x55896b){_0x28d18d=_0x28d18d-0x0;var _0x470640=_0xd2ce[_0x28d18d];return _0x470640;};'use strict';var BPromise=require(_0xed2c('0x0'));var Mustache=require(_0xed2c('0x1'));var util=require(_0xed2c('0x2'));var path=require(_0xed2c('0x3'));var ejs=require(_0xed2c('0x4'));var fs=require('fs');var fs_extra=require(_0xed2c('0x5'));var _=require(_0xed2c('0x6'));var querystring=require(_0xed2c('0x7'));var Redis=require('ioredis');var qs=require(_0xed2c('0x8'));var logger=require(_0xed2c('0x9'))(_0xed2c('0xa'));var config=require(_0xed2c('0xb'));var db=require(_0xed2c('0xc'))['db'];config[_0xed2c('0xd')]=_[_0xed2c('0xe')](config[_0xed2c('0xd')],{'host':_0xed2c('0xf'),'port':0x18eb});var socket=require(_0xed2c('0x10'))(new Redis(config[_0xed2c('0xd')]));require(_0xed2c('0x11'))['register'](socket);var htmlToText=require('html-to-text');var jayson=require(_0xed2c('0x12'));var client=jayson[_0xed2c('0x13')][_0xed2c('0x14')]({'port':0x232c});var client9002=jayson[_0xed2c('0x13')][_0xed2c('0x14')]({'port':0x232a});var client9003=jayson[_0xed2c('0x13')][_0xed2c('0x14')]({'port':0x232b});var client9001=jayson[_0xed2c('0x13')][_0xed2c('0x14')]({'port':0x2329});function respondWithRpcPromise(_0x26388f,_0x194185,_0x2d4e0e,_0x29dcd9){return new BPromise(function(_0x57c6b2,_0x1585e5){var _0x45ed01=_0x29dcd9||client;return _0x45ed01[_0xed2c('0x15')](_0x26388f,_0x2d4e0e)[_0xed2c('0x16')](function(_0x9871ae){logger[_0xed2c('0x17')]('ChatWebsite,\x20%s,\x20%s',_0x194185,_0xed2c('0x18'));logger[_0xed2c('0x19')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x194185,_0xed2c('0x18'),JSON['stringify'](_0x9871ae));if(_0x9871ae[_0xed2c('0x1a')]){if(_0x9871ae[_0xed2c('0x1a')][_0xed2c('0x1b')]===0x1f4){logger[_0xed2c('0x1a')](_0xed2c('0x1c'),_0x194185,_0x9871ae['error'][_0xed2c('0x1d')]);return _0x1585e5(_0x9871ae[_0xed2c('0x1a')][_0xed2c('0x1d')]);}logger[_0xed2c('0x1a')]('ChatWebsite,\x20%s,\x20%s',_0x194185,_0x9871ae['error'][_0xed2c('0x1d')]);return _0x57c6b2(_0x9871ae[_0xed2c('0x1a')][_0xed2c('0x1d')]);}else{logger[_0xed2c('0x17')](_0xed2c('0x1c'),_0x194185,_0xed2c('0x18'));_0x57c6b2(_0x9871ae[_0xed2c('0x1e')][_0xed2c('0x1d')]);}})[_0xed2c('0x1f')](function(_0x129401){logger['error'](_0xed2c('0x1c'),_0x194185,_0x129401);_0x1585e5(_0x129401);});});}function respondWithStatusCode(_0x3f724d,_0x2331d0){_0x2331d0=_0x2331d0||0xcc;return function(_0x1386c4){if(_0x1386c4){return _0x3f724d[_0xed2c('0x20')](_0x2331d0);}return _0x3f724d[_0xed2c('0x21')](_0x2331d0)[_0xed2c('0x22')]();};}function respondWithResult(_0x35f70e,_0x51088c){_0x51088c=_0x51088c||0xc8;return function(_0x5bf75e){if(_0x5bf75e){return _0x35f70e[_0xed2c('0x21')](_0x51088c)[_0xed2c('0x23')](_0x5bf75e);}};}function respondWithFilteredResult(_0x33a29e,_0x4438c1){return function(_0x22fd91){if(_0x22fd91){var _0x265c36=typeof _0x4438c1[_0xed2c('0x24')]==='undefined'&&typeof _0x4438c1[_0xed2c('0x25')]===_0xed2c('0x26');var _0x5ab86b=_0x22fd91[_0xed2c('0x27')];var _0x4d5d7c=_0x265c36?0x0:_0x4438c1[_0xed2c('0x24')];var _0x495008=_0x265c36?_0x22fd91['count']:_0x4438c1[_0xed2c('0x24')]+_0x4438c1['limit'];var _0x4e969f;if(_0x495008>=_0x5ab86b){_0x495008=_0x5ab86b;_0x4e969f=0xc8;}else{_0x4e969f=0xce;}_0x33a29e[_0xed2c('0x21')](_0x4e969f);return _0x33a29e[_0xed2c('0x28')](_0xed2c('0x29'),_0x4d5d7c+'-'+_0x495008+'/'+_0x5ab86b)[_0xed2c('0x23')](_0x22fd91);}return null;};}function saveUpdates(_0x53db46){return function(_0x6a0ee6){if(_0x6a0ee6){return _0x6a0ee6[_0xed2c('0x2a')](_0x53db46)['then'](function(_0x23256f){return _0x23256f;});}return null;};}function removeEntity(_0x2ce2ce){return function(_0x1b62d3){if(_0x1b62d3){return _0x1b62d3[_0xed2c('0x2b')]()['then'](function(){var _0x3bb243=_0x1b62d3['get']({'plain':!![]});var _0x1c6c00=_0xed2c('0x2c');return db['UserProfileResource'][_0xed2c('0x2b')]({'where':{'type':_0x1c6c00,'resourceId':_0x3bb243['id']}})[_0xed2c('0x16')](function(){return _0x1b62d3;});})[_0xed2c('0x16')](function(){_0x2ce2ce[_0xed2c('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x318ff1){return function(_0x272daf){if(!_0x272daf){_0x318ff1['sendStatus'](0x194);}return _0x272daf;};}function handleError(_0x292340,_0x5b634f){_0x5b634f=_0x5b634f||0x1f4;return function(_0x2d58bb){logger[_0xed2c('0x1a')](_0x2d58bb['stack']);if(_0x2d58bb['name']){delete _0x2d58bb[_0xed2c('0x2d')];}_0x292340[_0xed2c('0x21')](_0x5b634f)['send'](_0x2d58bb);};}exports[_0xed2c('0x2e')]=function(_0x544e68,_0x2e477c){var _0x44cfdf={'include':[{'model':db[_0xed2c('0x2f')],'as':_0xed2c('0x30')}]},_0x40c392={},_0x381a3d={'count':0x0,'rows':[]};var _0x1afb34=_['map'](db[_0xed2c('0x31')][_0xed2c('0x32')],function(_0x3155a4){return{'name':_0x3155a4[_0xed2c('0x33')],'type':_0x3155a4[_0xed2c('0x34')]['key']};});_0x40c392[_0xed2c('0x35')]=_['map'](_0x1afb34,_0xed2c('0x2d'));_0x40c392[_0xed2c('0x36')]=_[_0xed2c('0x37')](_0x544e68[_0xed2c('0x36')]);_0x40c392[_0xed2c('0x38')]=_[_0xed2c('0x39')](_0x40c392[_0xed2c('0x35')],_0x40c392[_0xed2c('0x36')]);_0x44cfdf[_0xed2c('0x3a')]=_[_0xed2c('0x39')](_0x40c392[_0xed2c('0x35')],qs[_0xed2c('0x3b')](_0x544e68[_0xed2c('0x36')][_0xed2c('0x3b')]));_0x44cfdf[_0xed2c('0x3a')]=_0x44cfdf[_0xed2c('0x3a')][_0xed2c('0x3c')]?_0x44cfdf['attributes']:_0x40c392[_0xed2c('0x35')];if(!_0x544e68[_0xed2c('0x36')][_0xed2c('0x3d')]('nolimit')){_0x44cfdf[_0xed2c('0x25')]=qs[_0xed2c('0x25')](_0x544e68[_0xed2c('0x36')][_0xed2c('0x25')]);_0x44cfdf['offset']=qs[_0xed2c('0x24')](_0x544e68[_0xed2c('0x36')][_0xed2c('0x24')]);}_0x44cfdf['order']=qs[_0xed2c('0x3e')](_0x544e68[_0xed2c('0x36')]['sort']);_0x44cfdf['where']=qs[_0xed2c('0x38')](_[_0xed2c('0x3f')](_0x544e68['query'],_0x40c392['filters']),_0x1afb34);if(_0x544e68[_0xed2c('0x36')][_0xed2c('0x40')]){_0x44cfdf[_0xed2c('0x41')]=_[_0xed2c('0x42')](_0x44cfdf[_0xed2c('0x41')],{'$or':_['map'](_0x1afb34,function(_0x44e92a){if(_0x44e92a[_0xed2c('0x34')]!=='VIRTUAL'){var _0x5490f0={};_0x5490f0[_0x44e92a[_0xed2c('0x2d')]]={'$like':'%'+_0x544e68[_0xed2c('0x36')][_0xed2c('0x40')]+'%'};return _0x5490f0;}})});}_0x44cfdf=_[_0xed2c('0x42')]({},_0x44cfdf,_0x544e68['options']);var _0x26dc6e={'where':_0x44cfdf['where']};return db[_0xed2c('0x31')][_0xed2c('0x27')](_0x26dc6e)[_0xed2c('0x16')](function(_0x2ddf6e){_0x381a3d[_0xed2c('0x27')]=_0x2ddf6e;if(_0x544e68[_0xed2c('0x36')][_0xed2c('0x43')]){_0x44cfdf['include']=[{'all':!![]}];}return db[_0xed2c('0x31')][_0xed2c('0x44')](_0x44cfdf);})[_0xed2c('0x16')](function(_0x3b8dc7){_0x381a3d['rows']=_0x3b8dc7;return _0x381a3d;})[_0xed2c('0x16')](respondWithFilteredResult(_0x2e477c,_0x44cfdf))[_0xed2c('0x1f')](handleError(_0x2e477c,null));};exports[_0xed2c('0x45')]=function(_0x2963d4,_0x1501e3){var _0x42a42a={'raw':![],'where':{'id':_0x2963d4[_0xed2c('0x46')]['id']},'include':[{'model':db[_0xed2c('0x2f')],'as':_0xed2c('0x30')}]},_0x48e252={};_0x48e252[_0xed2c('0x35')]=_[_0xed2c('0x37')](db[_0xed2c('0x31')][_0xed2c('0x32')]);_0x48e252[_0xed2c('0x36')]=_[_0xed2c('0x37')](_0x2963d4['query']);_0x48e252[_0xed2c('0x38')]=_[_0xed2c('0x39')](_0x48e252[_0xed2c('0x35')],_0x48e252[_0xed2c('0x36')]);_0x42a42a[_0xed2c('0x3a')]=_[_0xed2c('0x39')](_0x48e252[_0xed2c('0x35')],qs[_0xed2c('0x3b')](_0x2963d4['query'][_0xed2c('0x3b')]));_0x42a42a[_0xed2c('0x3a')]=_0x42a42a[_0xed2c('0x3a')][_0xed2c('0x3c')]?_0x42a42a[_0xed2c('0x3a')]:_0x48e252[_0xed2c('0x35')];if(_0x2963d4[_0xed2c('0x36')][_0xed2c('0x43')]){_0x42a42a[_0xed2c('0x47')]=[{'all':!![]}];}_0x42a42a=_[_0xed2c('0x42')]({},_0x42a42a,_0x2963d4[_0xed2c('0x48')]);return db[_0xed2c('0x31')]['find'](_0x42a42a)[_0xed2c('0x16')](handleEntityNotFound(_0x1501e3,null))['then'](respondWithResult(_0x1501e3,null))[_0xed2c('0x1f')](handleError(_0x1501e3,null));};exports['create']=function(_0x2ce08b,_0xd9d431){return db[_0xed2c('0x31')][_0xed2c('0x49')](_0x2ce08b[_0xed2c('0x4a')],{})[_0xed2c('0x16')](function(_0x295164){var _0x28b4dc=_0x2ce08b['user'][_0xed2c('0x4b')]({'plain':!![]});if(!_0x28b4dc)throw new Error(_0xed2c('0x4c'));if(_0x28b4dc[_0xed2c('0x4d')]==='user'){var _0x3bf8f5=_0x295164[_0xed2c('0x4b')]({'plain':!![]});var _0x1a39df=_0xed2c('0x2c');return db['UserProfileSection'][_0xed2c('0x4e')]({'where':{'name':_0x1a39df,'userProfileId':_0x28b4dc[_0xed2c('0x4f')]},'raw':!![]})[_0xed2c('0x16')](function(_0x2256f4){if(_0x2256f4&&_0x2256f4['autoAssociation']===0x0){return db[_0xed2c('0x50')][_0xed2c('0x49')]({'name':_0x3bf8f5['name'],'resourceId':_0x3bf8f5['id'],'type':_0x2256f4[_0xed2c('0x2d')],'sectionId':_0x2256f4['id']},{})[_0xed2c('0x16')](function(){return _0x295164;});}else{return _0x295164;}})[_0xed2c('0x1f')](function(_0x26b912){logger[_0xed2c('0x1a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x26b912);throw _0x26b912;});}return _0x295164;})[_0xed2c('0x16')](respondWithResult(_0xd9d431,0xc9))[_0xed2c('0x1f')](handleError(_0xd9d431,null));};exports[_0xed2c('0x2a')]=function(_0x40ebd2,_0x4733c1){if(_0x40ebd2[_0xed2c('0x4a')]['id']){delete _0x40ebd2['body']['id'];}return db['ChatWebsite'][_0xed2c('0x4e')]({'where':{'id':_0x40ebd2[_0xed2c('0x46')]['id']},'include':[{'model':db[_0xed2c('0x2f')],'as':_0xed2c('0x30')}]})[_0xed2c('0x16')](handleEntityNotFound(_0x4733c1,null))[_0xed2c('0x16')](saveUpdates(_0x40ebd2[_0xed2c('0x4a')],null))[_0xed2c('0x16')](respondWithResult(_0x4733c1,null))[_0xed2c('0x1f')](handleError(_0x4733c1,null));};exports[_0xed2c('0x2b')]=function(_0x52bba2,_0x589737){return db[_0xed2c('0x31')][_0xed2c('0x4e')]({'where':{'id':_0x52bba2[_0xed2c('0x46')]['id']}})['then'](handleEntityNotFound(_0x589737,null))[_0xed2c('0x16')](removeEntity(_0x589737,null))['catch'](handleError(_0x589737,null));};exports[_0xed2c('0x51')]=function(_0x1b53ba,_0x409da0){return db[_0xed2c('0x31')][_0xed2c('0x51')]()['then'](respondWithResult(_0x409da0,null))[_0xed2c('0x1f')](handleError(_0x409da0,null));};exports[_0xed2c('0x52')]=function(_0x9ebef5,_0x5b806e){if(_0x9ebef5['body']['id']){delete _0x9ebef5[_0xed2c('0x4a')]['id'];}return db[_0xed2c('0x31')]['find']({'where':{'id':_0x9ebef5['params']['id']}})[_0xed2c('0x16')](handleEntityNotFound(_0x5b806e,null))[_0xed2c('0x16')](function(_0x2dc76d){if(_0x2dc76d){_0x9ebef5[_0xed2c('0x4a')][_0xed2c('0x53')]=_0x2dc76d['id'];return db['Disposition'][_0xed2c('0x49')](_0x9ebef5[_0xed2c('0x4a')]);}})[_0xed2c('0x16')](respondWithResult(_0x5b806e,null))['catch'](handleError(_0x5b806e,null));};exports['getDispositions']=function(_0x2bd18b,_0x5212ac){var _0x9bdb7c={'raw':![],'where':{}};var _0x15a1da={};var _0x540727={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xed2c('0x54')]({'where':{'id':_0x2bd18b[_0xed2c('0x46')]['id']}})[_0xed2c('0x16')](handleEntityNotFound(_0x5212ac,null))[_0xed2c('0x16')](function(_0x1237ec){if(_0x1237ec){_0x15a1da[_0xed2c('0x35')]=_[_0xed2c('0x37')](db['Disposition'][_0xed2c('0x32')]);_0x15a1da[_0xed2c('0x36')]=_[_0xed2c('0x37')](_0x2bd18b['query']);_0x15a1da['filters']=_[_0xed2c('0x39')](_0x15a1da[_0xed2c('0x35')],_0x15a1da['query']);_0x9bdb7c[_0xed2c('0x3a')]=_[_0xed2c('0x39')](_0x15a1da['model'],qs[_0xed2c('0x3b')](_0x2bd18b[_0xed2c('0x36')][_0xed2c('0x3b')]));_0x9bdb7c[_0xed2c('0x3a')]=_0x9bdb7c[_0xed2c('0x3a')]['length']?_0x9bdb7c[_0xed2c('0x3a')]:_0x15a1da['model'];if(!_0x2bd18b[_0xed2c('0x36')]['hasOwnProperty'](_0xed2c('0x55'))){_0x9bdb7c['limit']=qs[_0xed2c('0x25')](_0x2bd18b['query'][_0xed2c('0x25')]);_0x9bdb7c[_0xed2c('0x24')]=qs[_0xed2c('0x24')](_0x2bd18b['query']['offset']);}_0x9bdb7c[_0xed2c('0x56')]=qs[_0xed2c('0x3e')](_0x2bd18b['query'][_0xed2c('0x3e')]);_0x9bdb7c['where']=qs[_0xed2c('0x38')](_[_0xed2c('0x3f')](_0x2bd18b[_0xed2c('0x36')],_0x15a1da['filters']));_0x9bdb7c[_0xed2c('0x41')]['ChatWebsiteId']=_0x1237ec['id'];if(_0x2bd18b['query'][_0xed2c('0x40')]){_0x9bdb7c[_0xed2c('0x41')]=_['merge'](_0x9bdb7c[_0xed2c('0x41')],{'$or':_[_0xed2c('0x57')](_0x9bdb7c['attributes'],function(_0x18b309){var _0x8577b6={};_0x8577b6[_0x18b309]={'$like':'%'+_0x2bd18b[_0xed2c('0x36')][_0xed2c('0x40')]+'%'};return _0x8577b6;})});}_0x9bdb7c=_[_0xed2c('0x42')]({},_0x9bdb7c,_0x2bd18b['options']);return db[_0xed2c('0x58')]['count']({'where':_0x9bdb7c[_0xed2c('0x41')]})[_0xed2c('0x16')](function(_0x15f18c){_0x540727['count']=_0x15f18c;if(_0x2bd18b[_0xed2c('0x36')][_0xed2c('0x43')]){_0x9bdb7c[_0xed2c('0x47')]=[{'all':!![]}];}return db[_0xed2c('0x58')][_0xed2c('0x44')](_0x9bdb7c);})['then'](function(_0x10c7fe){_0x540727[_0xed2c('0x59')]=_0x10c7fe;return _0x540727;});}})[_0xed2c('0x16')](respondWithFilteredResult(_0x5212ac,_0x9bdb7c))[_0xed2c('0x1f')](handleError(_0x5212ac,null));};exports['removeDispositions']=function(_0x23e6ef,_0x2731b5){return db['ChatWebsite'][_0xed2c('0x4e')]({'where':{'id':_0x23e6ef[_0xed2c('0x46')]['id']}})[_0xed2c('0x16')](handleEntityNotFound(_0x2731b5,null))[_0xed2c('0x16')](function(_0x55a57f){if(_0x55a57f){return _0x55a57f[_0xed2c('0x5a')](_0x23e6ef[_0xed2c('0x36')][_0xed2c('0x5b')]);}})[_0xed2c('0x16')](respondWithStatusCode(_0x2731b5,null))[_0xed2c('0x1f')](handleError(_0x2731b5,null));};exports[_0xed2c('0x5c')]=function(_0x54fdb5,_0x14b694){if(_0x54fdb5[_0xed2c('0x4a')]['id']){delete _0x54fdb5[_0xed2c('0x4a')]['id'];}return db['ChatWebsite'][_0xed2c('0x4e')]({'where':{'id':_0x54fdb5['params']['id']}})['then'](handleEntityNotFound(_0x14b694,null))[_0xed2c('0x16')](function(_0x5b6a5c){if(_0x5b6a5c){_0x54fdb5[_0xed2c('0x4a')][_0xed2c('0x53')]=_0x5b6a5c['id'];return db[_0xed2c('0x5d')][_0xed2c('0x49')](_0x54fdb5[_0xed2c('0x4a')]);}})[_0xed2c('0x16')](respondWithResult(_0x14b694,null))[_0xed2c('0x1f')](handleError(_0x14b694,null));};exports[_0xed2c('0x5e')]=function(_0x13b184,_0x3ea9f7){var _0x783172={'raw':![],'where':{}};var _0x3264ef={};var _0x5aa810={'count':0x0,'rows':[]};return db[_0xed2c('0x31')]['findOne']({'where':{'id':_0x13b184[_0xed2c('0x46')]['id']}})[_0xed2c('0x16')](handleEntityNotFound(_0x3ea9f7,null))[_0xed2c('0x16')](function(_0x1e9f31){if(_0x1e9f31){_0x3264ef[_0xed2c('0x35')]=_[_0xed2c('0x37')](db[_0xed2c('0x5d')][_0xed2c('0x32')]);_0x3264ef[_0xed2c('0x36')]=_['keys'](_0x13b184['query']);_0x3264ef[_0xed2c('0x38')]=_[_0xed2c('0x39')](_0x3264ef['model'],_0x3264ef[_0xed2c('0x36')]);_0x783172[_0xed2c('0x3a')]=_[_0xed2c('0x39')](_0x3264ef[_0xed2c('0x35')],qs[_0xed2c('0x3b')](_0x13b184[_0xed2c('0x36')]['fields']));_0x783172[_0xed2c('0x3a')]=_0x783172[_0xed2c('0x3a')][_0xed2c('0x3c')]?_0x783172[_0xed2c('0x3a')]:_0x3264ef[_0xed2c('0x35')];if(!_0x13b184[_0xed2c('0x36')][_0xed2c('0x3d')](_0xed2c('0x55'))){_0x783172[_0xed2c('0x25')]=qs[_0xed2c('0x25')](_0x13b184[_0xed2c('0x36')][_0xed2c('0x25')]);_0x783172[_0xed2c('0x24')]=qs['offset'](_0x13b184[_0xed2c('0x36')]['offset']);}_0x783172['order']=qs[_0xed2c('0x3e')](_0x13b184['query']['sort']);_0x783172[_0xed2c('0x41')]=qs[_0xed2c('0x38')](_[_0xed2c('0x3f')](_0x13b184['query'],_0x3264ef[_0xed2c('0x38')]));_0x783172[_0xed2c('0x41')]['ChatWebsiteId']=_0x1e9f31['id'];if(_0x13b184[_0xed2c('0x36')]['filter']){_0x783172[_0xed2c('0x41')]=_['merge'](_0x783172[_0xed2c('0x41')],{'$or':_[_0xed2c('0x57')](_0x783172[_0xed2c('0x3a')],function(_0x4c3c0d){var _0x2461ed={};_0x2461ed[_0x4c3c0d]={'$like':'%'+_0x13b184[_0xed2c('0x36')][_0xed2c('0x40')]+'%'};return _0x2461ed;})});}_0x783172=_['merge']({},_0x783172,_0x13b184['options']);return db[_0xed2c('0x5d')]['count']({'where':_0x783172[_0xed2c('0x41')]})['then'](function(_0x175133){_0x5aa810[_0xed2c('0x27')]=_0x175133;if(_0x13b184[_0xed2c('0x36')]['includeAll']){_0x783172['include']=[{'all':!![]}];}return db[_0xed2c('0x5d')][_0xed2c('0x44')](_0x783172);})[_0xed2c('0x16')](function(_0x3ab23c){_0x5aa810['rows']=_0x3ab23c;return _0x5aa810;});}})[_0xed2c('0x16')](respondWithFilteredResult(_0x3ea9f7,_0x783172))[_0xed2c('0x1f')](handleError(_0x3ea9f7,null));};exports['removeAnswers']=function(_0x4a45b5,_0x3352e7){return db['ChatWebsite'][_0xed2c('0x4e')]({'where':{'id':_0x4a45b5[_0xed2c('0x46')]['id']}})[_0xed2c('0x16')](handleEntityNotFound(_0x3352e7,null))[_0xed2c('0x16')](function(_0x5a9a5b){if(_0x5a9a5b){return _0x5a9a5b[_0xed2c('0x5f')](_0x4a45b5[_0xed2c('0x36')][_0xed2c('0x5b')]);}})[_0xed2c('0x16')](respondWithStatusCode(_0x3352e7,null))[_0xed2c('0x1f')](handleError(_0x3352e7,null));};exports['addLogo']=function(_0x2562e3,_0x61960f){_0x2562e3['body'][_0xed2c('0x60')]=_0x2562e3[_0xed2c('0x61')][_0xed2c('0x62')];return db[_0xed2c('0x31')][_0xed2c('0x4e')]({'where':{'id':_0x2562e3['params']['id']}})[_0xed2c('0x16')](handleEntityNotFound(_0x61960f,null))[_0xed2c('0x16')](saveUpdates(_0x2562e3[_0xed2c('0x4a')],null))[_0xed2c('0x16')](respondWithResult(_0x61960f,null))['catch'](handleError(_0x61960f,null));};exports['addAvatar']=function(_0x4b3b81,_0x5e1440){_0x4b3b81[_0xed2c('0x4a')][_0xed2c('0x63')]=_0x4b3b81[_0xed2c('0x61')][_0xed2c('0x62')];return db['ChatWebsite'][_0xed2c('0x4e')]({'where':{'id':_0x4b3b81[_0xed2c('0x46')]['id']}})[_0xed2c('0x16')](handleEntityNotFound(_0x5e1440,null))[_0xed2c('0x16')](saveUpdates(_0x4b3b81[_0xed2c('0x4a')],null))[_0xed2c('0x16')](respondWithResult(_0x5e1440,null))[_0xed2c('0x1f')](handleError(_0x5e1440,null));};exports['addCustomerAvatar']=function(_0x31fefb,_0x906449){_0x31fefb[_0xed2c('0x4a')][_0xed2c('0x64')]=_0x31fefb[_0xed2c('0x61')][_0xed2c('0x62')];return db[_0xed2c('0x31')]['find']({'where':{'id':_0x31fefb[_0xed2c('0x46')]['id']}})[_0xed2c('0x16')](handleEntityNotFound(_0x906449,null))[_0xed2c('0x16')](saveUpdates(_0x31fefb[_0xed2c('0x4a')],null))['then'](respondWithResult(_0x906449,null))[_0xed2c('0x1f')](handleError(_0x906449,null));};exports[_0xed2c('0x65')]=function(_0x4520db,_0x1b92ab){_0x4520db[_0xed2c('0x4a')]['systemAvatar']=_0x4520db[_0xed2c('0x61')][_0xed2c('0x62')];return db[_0xed2c('0x31')]['find']({'where':{'id':_0x4520db['params']['id']}})[_0xed2c('0x16')](handleEntityNotFound(_0x1b92ab,null))[_0xed2c('0x16')](saveUpdates(_0x4520db[_0xed2c('0x4a')],null))['then'](respondWithResult(_0x1b92ab,null))[_0xed2c('0x1f')](handleError(_0x1b92ab,null));};exports[_0xed2c('0x66')]=function(_0xc55ed8,_0xab8ab1){var _0x20d65c=path['join'](config[_0xed2c('0x67')],'server/files/images/logos/default_logo.svg');var _0xb39d5b={'where':{'id':_0xc55ed8[_0xed2c('0x46')]['id']},'attributes':['id',_0xed2c('0x60')],'raw':!![]};var _0x3cc498=![];return require(_0xed2c('0x68'))[_0xed2c('0x69')]()[_0xed2c('0x16')](function(_0x1c2a77){if(_0x1c2a77){_0x3cc498=_0x1c2a77[_0xed2c('0x6a')];}})[_0xed2c('0x16')](function(){return db[_0xed2c('0x31')][_0xed2c('0x4e')](_0xb39d5b);})[_0xed2c('0x16')](handleEntityNotFound(_0xab8ab1,null))['then'](function(_0x5ce687){if(_0x5ce687){if(!_[_0xed2c('0x6b')](_0x5ce687[_0xed2c('0x60')])){if(fs[_0xed2c('0x6c')](path[_0xed2c('0x6d')](config[_0xed2c('0x67')],_0xed2c('0x6e'),_0x5ce687[_0xed2c('0x60')]))&&_0x3cc498){_0x20d65c=path[_0xed2c('0x6d')](config[_0xed2c('0x67')],_0xed2c('0x6e'),_0x5ce687[_0xed2c('0x60')]);}}return _0xab8ab1[_0xed2c('0x6f')](_0x20d65c);}})[_0xed2c('0x1f')](handleError(_0xab8ab1,null));};exports['getAvatar']=function(_0x2ccda7,_0x250b37){var _0x1e18a7=path[_0xed2c('0x6d')](config['root'],_0xed2c('0x70'));var _0x2e5266={'where':{'id':_0x2ccda7['params']['id']},'attributes':['id',_0xed2c('0x63')],'raw':!![]};return db['ChatWebsite'][_0xed2c('0x4e')](_0x2e5266)[_0xed2c('0x16')](handleEntityNotFound(_0x250b37,null))[_0xed2c('0x16')](function(_0x2fb96b){if(_0x2fb96b){if(!_[_0xed2c('0x6b')](_0x2fb96b['agentAvatar'])){if(fs['existsSync'](path[_0xed2c('0x6d')](config['root'],_0xed2c('0x71'),_0x2fb96b[_0xed2c('0x63')]))){_0x1e18a7=path[_0xed2c('0x6d')](config[_0xed2c('0x67')],_0xed2c('0x71'),_0x2fb96b['agentAvatar']);}}return _0x250b37[_0xed2c('0x6f')](_0x1e18a7);}})['catch'](handleError(_0x250b37,null));};exports[_0xed2c('0x72')]=function(_0x3b78e4,_0x5644c2){var _0x966824=path[_0xed2c('0x6d')](config['root'],_0xed2c('0x73'));var _0x501dca={'where':{'id':_0x3b78e4['params']['id']},'attributes':['id','customerAvatar','showCustomerAvatar'],'raw':!![]};return db[_0xed2c('0x31')][_0xed2c('0x4e')](_0x501dca)[_0xed2c('0x16')](handleEntityNotFound(_0x5644c2,null))[_0xed2c('0x16')](function(_0x57f876){if(_0x57f876){if(!_['isNil'](_0x57f876[_0xed2c('0x64')])){if(fs['existsSync'](path[_0xed2c('0x6d')](config[_0xed2c('0x67')],_0xed2c('0x71'),_0x57f876[_0xed2c('0x64')]))&&_0x57f876[_0xed2c('0x74')]){_0x966824=path[_0xed2c('0x6d')](config[_0xed2c('0x67')],'server/files/images/avatars/',_0x57f876[_0xed2c('0x64')]);}}return _0x5644c2[_0xed2c('0x6f')](_0x966824);}})[_0xed2c('0x1f')](handleError(_0x5644c2,null));};exports['getSystemAvatar']=function(_0x270150,_0x52a2de){var _0x446d53=path[_0xed2c('0x6d')](config[_0xed2c('0x67')],_0xed2c('0x75'));var _0x3fab0c={'where':{'id':_0x270150[_0xed2c('0x46')]['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db[_0xed2c('0x31')][_0xed2c('0x4e')](_0x3fab0c)[_0xed2c('0x16')](handleEntityNotFound(_0x52a2de,null))['then'](function(_0x5a8652){if(_0x5a8652){if(!_['isNil'](_0x5a8652[_0xed2c('0x76')])){if(fs[_0xed2c('0x6c')](path[_0xed2c('0x6d')](config[_0xed2c('0x67')],_0xed2c('0x71'),_0x5a8652[_0xed2c('0x76')]))){_0x446d53=path['join'](config[_0xed2c('0x67')],_0xed2c('0x71'),_0x5a8652[_0xed2c('0x76')]);}}return _0x52a2de[_0xed2c('0x6f')](_0x446d53);}})['catch'](handleError(_0x52a2de,null));};exports[_0xed2c('0x77')]=function(_0x2b69d8,_0x17be26){var _0x1eb252=require('user-agent-parser');var _0x4033aa=new _0x1eb252();var _0x288ec1=_0x4033aa[_0xed2c('0x78')](_0x2b69d8[_0xed2c('0x79')][_0xed2c('0x7a')])[_0xed2c('0x7b')]();var _0xe00116={'body':_0x2b69d8['body'],'channel':_0xed2c('0x7c')};var _0x5a73ac=[];var _0x3cf43a=[];var _0x34eea9={};var _0x5832de=![];return db[_0xed2c('0x7d')][_0xed2c('0x51')]()[_0xed2c('0x16')](function(_0x4001f2){if(!_0x4001f2){throw new db['Sequelize']['ValidationError'](_0xed2c('0x7e'));}_0x5a73ac=_[_0xed2c('0x7f')](_[_0xed2c('0x37')](_0x4001f2),[_0xed2c('0x80'),'updatedAt']);_0x3cf43a=_[_0xed2c('0x7f')](_[_0xed2c('0x37')](_0x4001f2),[_0xed2c('0x80'),_0xed2c('0x81'),'CompanyId',_0xed2c('0x82')]);if(_0x2b69d8[_0xed2c('0x4a')]['id']){delete _0x2b69d8[_0xed2c('0x4a')]['id'];}if(_[_0xed2c('0x6b')](_0x2b69d8[_0xed2c('0x4a')]['from'])){throw new db[(_0xed2c('0x83'))][(_0xed2c('0x84'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x2b69d8[_0xed2c('0x4a')][_0xed2c('0x4a')])||_0x2b69d8[_0xed2c('0x4a')][_0xed2c('0x4a')]===''){throw new db[(_0xed2c('0x83'))][(_0xed2c('0x84'))](_0xed2c('0x85'));}if(_[_0xed2c('0x6b')](_0x2b69d8[_0xed2c('0x4a')]['mapKey'])){throw new db[(_0xed2c('0x83'))][(_0xed2c('0x84'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3cf43a);}if(!_['includes'](_0x3cf43a,_0x2b69d8[_0xed2c('0x4a')][_0xed2c('0x86')])){throw new db['Sequelize'][(_0xed2c('0x84'))](_0xed2c('0x87')+_0x3cf43a);}_0x34eea9[_0x2b69d8['body'][_0xed2c('0x86')]]=_0x2b69d8[_0xed2c('0x4a')]['from'];})[_0xed2c('0x16')](function(){return db[_0xed2c('0x31')][_0xed2c('0x4e')]({'where':{'id':_0x2b69d8[_0xed2c('0x46')]['id']},'include':[{'model':db[_0xed2c('0x88')],'as':_0xed2c('0x89'),'include':[{'model':db[_0xed2c('0x7d')],'as':_0xed2c('0x8a'),'where':_0x34eea9,'limit':0x1,'order':[[_0xed2c('0x81'),'DESC']]}]},{'model':db[_0xed2c('0x8b')],'as':_0xed2c('0x8c')}]});})[_0xed2c('0x16')](handleEntityNotFound(_0x17be26,null))[_0xed2c('0x16')](function(_0x2ff81d){if(_0x2ff81d&&_0x2ff81d[_0xed2c('0x89')]){_0xe00116['account']=_0x2ff81d;_0xe00116['applications']=_0x2ff81d['Applications'];_0xe00116[_0xed2c('0x8d')]=_0x2ff81d[_0xed2c('0x89')];_0xe00116[_0xed2c('0x8e')]=_[_0xed2c('0x8f')](_0xe00116[_0xed2c('0x8e')],[_0xed2c('0x90')],[_0xed2c('0x91')]);if(_0xe00116[_0xed2c('0x92')][_0xed2c('0x8c')]){delete _0xe00116[_0xed2c('0x92')][_0xed2c('0x8c')];}if(_0xe00116[_0xed2c('0x92')][_0xed2c('0x89')]&&_0xe00116[_0xed2c('0x92')][_0xed2c('0x89')][_0xed2c('0x8a')][_0xed2c('0x3c')]){return _0xe00116[_0xed2c('0x92')][_0xed2c('0x89')][_0xed2c('0x8a')][0x0];}var _0x2fb00d=_[_0xed2c('0xe')](_0x2b69d8[_0xed2c('0x4a')],{'firstName':_0x2b69d8['body'][_0xed2c('0x93')],'ListId':_0x2ff81d[_0xed2c('0x82')]});_0x2fb00d[_0x2b69d8[_0xed2c('0x4a')][_0xed2c('0x86')]]=_0x2b69d8['body']['from'];return db[_0xed2c('0x7d')][_0xed2c('0x49')](_0x2fb00d,{'fields':_0x5a73ac,'raw':!![]});}})['then'](handleEntityNotFound(_0x17be26,null))[_0xed2c('0x16')](function(_0x2cdfd3){_0xe00116[_0xed2c('0x94')]=_0x2cdfd3;var _0x5e86d5=_0x2b69d8['body']['customerIp'];if(_0x2b69d8[_0xed2c('0x79')]['cf-connecting-ip']){_0x5e86d5=_0x2b69d8[_0xed2c('0x79')][_0xed2c('0x95')];}else if(_0x2b69d8[_0xed2c('0x79')]['x-forwarded-for']){_0x5e86d5=_['first'](_0x2b69d8['headers'][_0xed2c('0x96')][_0xed2c('0x97')](','));}if(_0x2cdfd3){var _0x837254={'ContactId':_0x2cdfd3['id'],'ChatWebsiteId':_0x2b69d8[_0xed2c('0x46')]['id'],'from':(_0x2cdfd3[_0xed2c('0x98')]||'')+'\x20'+(_0x2cdfd3[_0xed2c('0x99')]||''),'customerIp':_0x5e86d5,'customerPort':_0x2b69d8[_0xed2c('0x79')][_0xed2c('0x9a')]?_0x2b69d8[_0xed2c('0x79')][_0xed2c('0x9a')]:null,'referer':_0x2b69d8['body']['referer'],'browserName':_0x288ec1[_0xed2c('0x9b')][_0xed2c('0x2d')]&&_0x288ec1[_0xed2c('0x9b')][_0xed2c('0x9c')]?util['format'](_0xed2c('0x9d'),_0x288ec1[_0xed2c('0x9b')][_0xed2c('0x2d')],_0x288ec1[_0xed2c('0x9b')][_0xed2c('0x9c')]):_0xed2c('0x9e'),'browserVersion':_0x288ec1[_0xed2c('0x9b')][_0xed2c('0x9c')]||'unknown','osName':util[_0xed2c('0x9f')](_0xed2c('0x9d'),_0x288ec1['os']['name'],_0x288ec1['os'][_0xed2c('0x9c')]),'osVersion':_0x288ec1['os'][_0xed2c('0x9c')],'deviceModel':_0x288ec1[_0xed2c('0xa0')][_0xed2c('0x35')]&&_0x288ec1[_0xed2c('0xa0')][_0xed2c('0xa1')]?util[_0xed2c('0x9f')](_0xed2c('0xa2'),_0x288ec1[_0xed2c('0xa0')][_0xed2c('0x35')],_0x288ec1[_0xed2c('0xa0')][_0xed2c('0xa1')],_0x288ec1['device'][_0xed2c('0x34')]):null,'deviceVendor':_0x288ec1[_0xed2c('0xa0')][_0xed2c('0xa1')],'deviceType':_0x288ec1[_0xed2c('0xa0')][_0xed2c('0x34')],'formData':JSON[_0xed2c('0xa3')](_0x2b69d8[_0xed2c('0x4a')])};var _0x1aa150={'ChatWebsiteId':_0x2b69d8[_0xed2c('0x46')]['id'],'closed':![]};if(_0x2b69d8['body'][_0xed2c('0xa4')]){_0x1aa150[_0xed2c('0xa4')]=_0x2b69d8[_0xed2c('0x4a')][_0xed2c('0xa4')];return db[_0xed2c('0xa5')][_0xed2c('0x4e')]({'where':_0x1aa150})[_0xed2c('0x16')](function(_0x5e78b8){if(_0x5e78b8){return[_0x5e78b8,![]];}_0x837254[_0xed2c('0xa4')]=_0x2b69d8[_0xed2c('0x4a')][_0xed2c('0xa4')];_0x837254[_0xed2c('0xa6')]=_0x2b69d8[_0xed2c('0x4a')][_0xed2c('0xa6')];return db[_0xed2c('0xa5')][_0xed2c('0x49')](_0x837254)['then'](function(_0x4dca4a){return[_0x4dca4a,!![]];});});}_0x1aa150[_0xed2c('0xa7')]=_0x2cdfd3['id'];if(_0x2b69d8[_0xed2c('0x4a')][_0xed2c('0xa8')]&&_0x2b69d8[_0xed2c('0x4a')][_0xed2c('0xa8')]['id']){_0x1aa150['id']=_0x2b69d8[_0xed2c('0x4a')]['interaction']['id'];return db['ChatInteraction'][_0xed2c('0x4e')]({'where':_0x1aa150})['then'](function(_0x32708d){if(_0x32708d){return[_0x32708d,![]];}return db[_0xed2c('0xa5')]['create'](_0x837254)[_0xed2c('0x16')](function(_0x247c6b){return[_0x247c6b,!![]];});});}return db['ChatInteraction'][_0xed2c('0x49')](_0x837254)[_0xed2c('0x16')](function(_0xe0dcc0){return[_0xe0dcc0,!![]];});}})[_0xed2c('0xa9')](function(_0x496fb7,_0x3bf42f){if(_0x496fb7){_0x5832de=_0x3bf42f;if(!_0x3bf42f){var _0x2d0381={'from':(_0xe00116[_0xed2c('0x94')][_0xed2c('0x98')]||'')+'\x20'+(_0xe00116[_0xed2c('0x94')][_0xed2c('0x99')]||'')};if(_0x2b69d8[_0xed2c('0x4a')]['threadId']&&_0x2b69d8[_0xed2c('0x4a')][_0xed2c('0xaa')]&&_0x2b69d8[_0xed2c('0x4a')][_0xed2c('0xa4')]!=_0x2b69d8[_0xed2c('0x4a')][_0xed2c('0xaa')]){_0x2d0381[_0xed2c('0xa4')]=_0x2b69d8[_0xed2c('0x4a')][_0xed2c('0xaa')];}return _0x496fb7['update'](_0x2d0381);}else{return _0x496fb7;}}})[_0xed2c('0x16')](function(_0x43c627){_0xe00116[_0xed2c('0xa8')]=_0x43c627[_0xed2c('0x4b')]({'plain':!![]});_0xe00116[_0xed2c('0xa8')][_0xed2c('0xab')]=_0x5832de;if(_0xe00116[_0xed2c('0xa8')]['created']){if(_0xe00116[_0xed2c('0x92')][_0xed2c('0xac')]){_0xe00116['applications'][_0xed2c('0xad')]({'id':0x0,'priority':_0xe00116[_0xed2c('0x8e')][_0xed2c('0x3c')]+0x1,'app':_0xed2c('0xae'),'appdata':_0xed2c('0xaf'),'interval':_0xed2c('0xb0')});}}return db[_0xed2c('0xb1')][_0xed2c('0x49')]({'body':_0x2b69d8[_0xed2c('0x4a')][_0xed2c('0x4a')],'ChatWebsiteId':_0x2b69d8['params']['id'],'ChatInteractionId':_0x43c627['id'],'direction':'in','ContactId':_0xe00116[_0xed2c('0x94')]['id'],'AttachmentId':_0x2b69d8['body'][_0xed2c('0xb2')]});})[_0xed2c('0x16')](function(_0x3fd0da){_0xe00116['message']=_0x3fd0da;if(_0xe00116['interaction'][_0xed2c('0xb3')]){return db[_0xed2c('0xb4')][_0xed2c('0x4e')]({'attributes':['id',_0xed2c('0x2d')],'where':{'id':_0xe00116['interaction'][_0xed2c('0xb3')]}})[_0xed2c('0x16')](function(_0x1a8d6f){if(_0x1a8d6f){_0xe00116[_0xed2c('0x8e')][_0xed2c('0xb5')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x1a8d6f[_0xed2c('0x2d')]+','+(_0xe00116['account'][_0xed2c('0xb6')]||0xa),'interval':_0xed2c('0xb0')});_0xe00116['forcedOwnership']=!![];}return respondWithRpcPromise(_0xed2c('0xb7'),_0xed2c('0xb8'),_0xe00116);});}return respondWithRpcPromise(_0xed2c('0xb7'),_0xed2c('0xb8'),_0xe00116);})['then'](function(_0x254f31){respondWithRpcPromise(_0xed2c('0xb9'),'EventManager',{'event':_0xed2c('0x77'),'message':_0x254f31},client9002);return _0x254f31;})[_0xed2c('0x16')](respondWithResult(_0x17be26,null))[_0xed2c('0x1f')](handleError(_0x17be26,null));};exports[_0xed2c('0xba')]=function(_0x2da941,_0x3c5da6){var _0x118e22,_0x17426a,_0x382b79;var _0x2e94bb=[];var _0x481aa5={};var _0x4a2ae4=_0x2da941[_0xed2c('0xbb')]||[];var _0x449f20=[];var _0x410c3a;return db[_0xed2c('0x7d')][_0xed2c('0x51')]()['then'](function(_0x264689){if(!_0x264689){throw new db[(_0xed2c('0x83'))][(_0xed2c('0x84'))]('no\x20available\x20attributes');}_0x2e94bb=_[_0xed2c('0x7f')](_[_0xed2c('0x37')](_0x264689),[_0xed2c('0x80'),_0xed2c('0x81'),_0xed2c('0xbc'),_0xed2c('0x82')]);if(_0x2da941['body']['id']){delete _0x2da941[_0xed2c('0x4a')]['id'];}if(_[_0xed2c('0x6b')](_0x2da941['body'][_0xed2c('0x93')])){throw _0x3c5da6[_0xed2c('0x21')](0x1f4)[_0xed2c('0xbd')](new db['Sequelize'][(_0xed2c('0x84'))]('from\x20is\x20mandatory'));}if(_[_0xed2c('0x6b')](_0x2da941[_0xed2c('0x4a')][_0xed2c('0x4a')])||_0x2da941['body'][_0xed2c('0x4a')]===''){throw _0x3c5da6[_0xed2c('0x21')](0x1f4)[_0xed2c('0xbd')](new db[(_0xed2c('0x83'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0xed2c('0x6b')](_0x2da941['body'][_0xed2c('0xbe')])){throw _0x3c5da6[_0xed2c('0x21')](0x1f4)[_0xed2c('0xbd')](new db['Sequelize'][(_0xed2c('0x84'))](_0xed2c('0xbf')+_0x2e94bb));}if(!_[_0xed2c('0xc0')](_0x2e94bb,_0x2da941[_0xed2c('0x4a')][_0xed2c('0xbe')])){throw _0x3c5da6[_0xed2c('0x21')](0x1f4)[_0xed2c('0xbd')](new db['Sequelize']['ValidationError'](_0xed2c('0xc1')+_0x2e94bb));}_0x481aa5[_0x2da941[_0xed2c('0x4a')][_0xed2c('0xbe')]]=_0x2da941[_0xed2c('0x4a')]['from'];})[_0xed2c('0x16')](function(){return db[_0xed2c('0x31')][_0xed2c('0x4e')]({'where':{'id':_0x2da941[_0xed2c('0x46')]['id']},'include':[{'model':db[_0xed2c('0x88')],'as':_0xed2c('0x89')},{'model':db[_0xed2c('0xc2')],'as':_0xed2c('0xc2')}]});})[_0xed2c('0x16')](handleEntityNotFound(_0x3c5da6,null))[_0xed2c('0x16')](function(_0x39b165){if(_0x39b165&&_0x39b165[_0xed2c('0x89')]){_0x17426a=_0x39b165;var _0x16b357=_[_0xed2c('0xe')](_0x2da941[_0xed2c('0x4a')],{'firstName':_0x2da941['body'][_0xed2c('0x93')],'phone':_0x2da941[_0xed2c('0x4a')]['from'],'ListId':_0x39b165[_0xed2c('0x82')]});_0x16b357[_0x2da941[_0xed2c('0x4a')][_0xed2c('0xbe')]]=_0x2da941[_0xed2c('0x4a')][_0xed2c('0x93')];return db[_0xed2c('0x7d')]['findOrCreate']({'where':_0x481aa5,'defaults':_0x16b357});}})[_0xed2c('0xa9')](function(_0x36da32){if(_0x36da32){_0x382b79=_0x36da32;var _0x4781e4=fs['readFileSync'](path['join'](config[_0xed2c('0x67')],_0xed2c('0xc3')),'utf8');var _0x4cc773=ejs[_0xed2c('0xc4')](_0x4781e4,{'body':_[_0xed2c('0xc5')](_0x2da941[_0xed2c('0x4a')]['body']),'bodyTitle':_0x17426a['offlineMessageBody']});return db[_0xed2c('0xc6')][_0xed2c('0x49')]({'body':_0x4cc773,'plainBody':htmlToText['fromString'](_0x4cc773),'ContactId':_0x36da32['id'],'ChatWebsiteId':_0x17426a['id']});}})[_0xed2c('0x16')](function(_0x53c6d2){_0x410c3a=_0x53c6d2;if(_0x4a2ae4[_0xed2c('0x3c')]){var _0x12aa08=_0x4a2ae4['map'](function(_0x212293){return{'name':_0x212293[_0xed2c('0xc7')],'basename':_0x212293['filename'],'type':_0x212293[_0xed2c('0xc8')],'ChatOfflineMessageId':_0x53c6d2['id']};});_0x449f20=_0x12aa08[_0xed2c('0x57')](_0x4e5dff=>{var _0x43cdab={'filename':_0x4e5dff[_0xed2c('0x2d')],'path':path[_0xed2c('0x6d')](config[_0xed2c('0x67')],_0xed2c('0xc9'),'files',_0xed2c('0xca'),'offline-chat',_0x4e5dff[_0xed2c('0xcb')])};return _0x43cdab;});if(!_0x17426a[_0xed2c('0xcc')]){return db[_0xed2c('0xcd')][_0xed2c('0xce')](function(_0x5126b4){return db[_0xed2c('0xcf')][_0xed2c('0xd0')](_0x12aa08,{'transaction':_0x5126b4});});}}})[_0xed2c('0x16')](function(){if(_0x410c3a){_0x118e22=_0x410c3a;return db[_0xed2c('0xc2')][_0xed2c('0x54')]({'where':{'active':!![]},'include':[{'model':db[_0xed2c('0xd1')],'as':'Smtp','raw':!![],'include':[{'model':db['CloudProvider'],'as':_0xed2c('0xd2'),'raw':!![]}]}]});}})[_0xed2c('0x16')](function(_0x4ac39d){if(_0x4ac39d&&_0x4ac39d[_0xed2c('0xd3')]&&_0x17426a[_0xed2c('0xd4')]&&_0x17426a[_0xed2c('0xd5')]){var _0xe2266f=_0x4ac39d[_0xed2c('0xd6')]();return respondWithRpcPromise(_0xed2c('0xd7'),_0xed2c('0xd8'),{'account':_0xe2266f,'message':{'from':util[_0xed2c('0x9f')](_0xed2c('0xd9'),_0x4ac39d[_0xed2c('0x2d')],_0x4ac39d['email']||_0x4ac39d[_0xed2c('0xd3')][_0xed2c('0xda')]),'to':_0x17426a[_0xed2c('0xd5')],'subject':_0x17426a['offlineMessageSubject'],'html':_0x118e22[_0xed2c('0x4a')],'attachments':_0x449f20}},client9003)[_0xed2c('0x16')](function(){return _0x118e22;})[_0xed2c('0x1f')](function(_0x21743d){logger['error'](_0x21743d);});}})[_0xed2c('0x16')](function(){if(_0x17426a&&_0x17426a[_0xed2c('0xcc')]&&_0x17426a[_0xed2c('0xdb')]){var _0x13aeb1=[];if(_0x4a2ae4['length']){_0x13aeb1=_0x4a2ae4['map'](function(_0x50bdb2){return{'name':_0x50bdb2[_0xed2c('0xc7')],'basename':_0x50bdb2[_0xed2c('0x62')],'type':_0x50bdb2[_0xed2c('0xc8')],'ChatOfflineMessageId':_0x410c3a['id']};});}var _0x3ad984;if(!_[_0xed2c('0x6b')](_0x17426a[_0xed2c('0xdc')])){var _0x18a516=_[_0xed2c('0x57')](_0x2da941[_0xed2c('0x4a')],function(_0x4d20ef){return _0x4d20ef;});var _0x1ebabd=_[_0xed2c('0xdd')](_0x18a516)[0x0];var _0x40abfe=_[_0xed2c('0xde')](_0x1ebabd,function(_0x24ebed){return _0x24ebed;});_0x3ad984=_0x40abfe[0x1][_0x17426a[_0xed2c('0xdc')]];}var _0x556247={'from':_0x382b79[_0xed2c('0xdf')],'firstName':_0x382b79[_0xed2c('0x98')],'lastName':_0x382b79[_0xed2c('0x99')],'mapKey':_0xed2c('0xdf'),'message':{'from':_0x382b79[_0xed2c('0xdf')],'to':_0x17426a[_0xed2c('0xc2')][_0xed2c('0xdf')],'cc':'','subject':_[_0xed2c('0x6b')](_0x3ad984)?_0x17426a[_0xed2c('0xe0')]:_0x3ad984,'messageId':'','sentAt':new Date(),'attach':_0x13aeb1[_0xed2c('0x3c')],'attachments':_0x13aeb1,'originChannel':_0xed2c('0xe1'),'ChatWebsiteId':_0x17426a['id'],'ChatOfflineMessageId':_0x118e22['id'],'originTo':_0x17426a[_0xed2c('0xc2')]['email']},'body':_0x118e22[_0xed2c('0x4a')]};var _0x55fb88={'account':{'id':_0x17426a[_0xed2c('0xdb')]},'body':_0x556247,'log':_0xed2c('0xe2')};return respondWithRpcPromise(_0xed2c('0xe2'),_0xed2c('0xe3'),_0x55fb88,client9001)[_0xed2c('0x16')](function(){return _0x118e22;})[_0xed2c('0x1f')](function(_0x2ef5f5){logger['error'](_0x2ef5f5);});}return;})['then'](function(){if(_0x118e22){return _0x118e22;}})['then'](respondWithResult(_0x3c5da6,null))[_0xed2c('0x1f')](function(_0x34ea16){logger[_0xed2c('0x1a')](_0xed2c('0x1f'),_0x34ea16);for(var _0x53b6fc of _0x4a2ae4){var _0xa6048a=path[_0xed2c('0x6d')](config[_0xed2c('0x67')],_0xed2c('0xc9'),_0xed2c('0xbb'),'attachments',_0xed2c('0xe4'),_0x53b6fc[_0xed2c('0x62')]);fs_extra[_0xed2c('0xe5')](_0xa6048a)[_0xed2c('0x1f')](function(_0x5ea21a){logger[_0xed2c('0x1a')](_0xed2c('0xe6'),_0xa6048a,_0x5ea21a);});}});};exports[_0xed2c('0xe7')]=function(_0x1dc313,_0x492558){return db[_0xed2c('0xa5')]['find']({'where':{'id':_0x1dc313[_0xed2c('0x46')]['id']}})[_0xed2c('0x16')](handleEntityNotFound(_0x492558,null))[_0xed2c('0x16')](function(_0x46f6d5){if(_0x46f6d5){return _0x46f6d5[_0xed2c('0xe7')](_0x1dc313['body'][_0xed2c('0x5b')],_[_0xed2c('0xe8')](_0x1dc313[_0xed2c('0x4a')],[_0xed2c('0x5b'),'id'])||{});}})['then'](respondWithResult(_0x492558,null))[_0xed2c('0x1f')](handleError(_0x492558,null));};exports[_0xed2c('0xe9')]=function(_0x4cf396,_0x1c7787){var _0x452817={'raw':![],'where':{}};var _0x178b48={};var _0x4ae2d2={'count':0x0,'rows':[]};return db[_0xed2c('0x31')]['findOne']({'where':{'id':_0x4cf396[_0xed2c('0x46')]['id']}})[_0xed2c('0x16')](handleEntityNotFound(_0x1c7787,null))[_0xed2c('0x16')](function(_0xe09e6b){if(_0xe09e6b){_0x178b48[_0xed2c('0x35')]=_['keys'](db['ChatInteraction'][_0xed2c('0x32')]);_0x178b48['query']=_[_0xed2c('0x37')](_0x4cf396[_0xed2c('0x36')]);_0x178b48['filters']=_[_0xed2c('0x39')](_0x178b48['model'],_0x178b48['query']);_0x452817['attributes']=_[_0xed2c('0x39')](_0x178b48[_0xed2c('0x35')],qs['fields'](_0x4cf396['query'][_0xed2c('0x3b')]));_0x452817['attributes']=_0x452817['attributes']['length']?_0x452817['attributes']:_0x178b48[_0xed2c('0x35')];if(!_0x4cf396['query'][_0xed2c('0x3d')](_0xed2c('0x55'))){_0x452817[_0xed2c('0x25')]=qs[_0xed2c('0x25')](_0x4cf396['query']['limit']);_0x452817[_0xed2c('0x24')]=qs['offset'](_0x4cf396[_0xed2c('0x36')]['offset']);}_0x452817[_0xed2c('0x56')]=qs[_0xed2c('0x3e')](_0x4cf396[_0xed2c('0x36')]['sort']);_0x452817[_0xed2c('0x41')]=qs[_0xed2c('0x38')](_[_0xed2c('0x3f')](_0x4cf396['query'],_0x178b48['filters']));_0x452817[_0xed2c('0x41')][_0xed2c('0x53')]=_0xe09e6b['id'];if(_0x4cf396[_0xed2c('0x36')][_0xed2c('0x40')]){_0x452817[_0xed2c('0x41')]=_[_0xed2c('0x42')](_0x452817[_0xed2c('0x41')],{'$or':_[_0xed2c('0x57')](_0x452817['attributes'],function(_0x5968fd){var _0x2005ed={};_0x2005ed[_0x5968fd]={'$like':'%'+_0x4cf396[_0xed2c('0x36')][_0xed2c('0x40')]+'%'};return _0x2005ed;})});}_0x452817=_[_0xed2c('0x42')]({},_0x452817,_0x4cf396[_0xed2c('0x48')]);return db[_0xed2c('0xa5')]['count']({'where':_0x452817[_0xed2c('0x41')]})[_0xed2c('0x16')](function(_0x37d466){_0x4ae2d2['count']=_0x37d466;if(_0x4cf396[_0xed2c('0x36')]['includeAll']){_0x452817['include']=[{'model':db[_0xed2c('0x7d')],'as':_0xed2c('0xea'),'required':![]},{'model':db[_0xed2c('0xb4')],'as':_0xed2c('0xeb'),'attributes':[_0xed2c('0x2d'),_0xed2c('0xec'),_0xed2c('0xed')],'required':![]},{'model':db[_0xed2c('0xee')],'as':_0xed2c('0xef'),'attributes':['id',_0xed2c('0x2d'),_0xed2c('0xf0')],'where':_0x4cf396[_0xed2c('0x36')][_0xed2c('0xf1')]?{'id':_0x4cf396[_0xed2c('0x36')]['tag']}:undefined,'required':_0x4cf396['query'][_0xed2c('0xf1')]?!![]:![]}];}return db[_0xed2c('0xa5')][_0xed2c('0x44')](_0x452817);})[_0xed2c('0x16')](function(_0x335854){_0x4ae2d2[_0xed2c('0x59')]=_0x335854;return _0x4ae2d2;});}})[_0xed2c('0x16')](respondWithFilteredResult(_0x1c7787,_0x452817))[_0xed2c('0x1f')](handleError(_0x1c7787,null));};function iftimePromise(_0x44926a,_0x2f041c){return respondWithRpcPromise(_0xed2c('0xf2'),_0xed2c('0xf3'),{'command':_0x2f041c[_0xed2c('0xf4')]?util[_0xed2c('0x9f')](_0xed2c('0xf5'),_0x44926a['interval'],_0x2f041c['timezone']):util[_0xed2c('0x9f')](_0xed2c('0xf6'),_0x44926a[_0xed2c('0xf7')])},client9002)['then'](function(_0x3ee60f){var _0x1a9c7d=_0x3ee60f&&_0x3ee60f[_0xed2c('0xf8')](_0xed2c('0xf9'))>=0x0?!![]:![];logger[_0xed2c('0x17')](_0xed2c('0xfa'),_0x2f041c['id'],_0x44926a['id'],_0x44926a[_0xed2c('0xf7')],_0x1a9c7d?_0xed2c('0xfb'):'OFFLINE',_0x2f041c['timezone']?_0x2f041c[_0xed2c('0xf4')]:_0xed2c('0xfc'));return _0x1a9c7d;})['catch'](function(_0x4527b6){logger['error'](_0xed2c('0xfa'),_0x2f041c['id'],_0x44926a['id'],_0x44926a[_0xed2c('0xf7')],util['inspect'](_0x4527b6,{'showHidden':![],'depth':null}),_0x2f041c[_0xed2c('0xf4')]?_0x2f041c['timezone']:'No\x20timezone');return![];});}exports['getSnippet']=function(_0x2b1b34,_0x2385ea){var _0x1f6c3b=0x0;var _0x3d199b=0x0;var _0x50212f=![];var _0x433510;var _0x2c1636;return db[_0xed2c('0x31')]['find']({'where':{'id':_0x2b1b34[_0xed2c('0x46')]['id']},'include':[{'model':db[_0xed2c('0xfd')],'as':_0xed2c('0xfd'),'include':[{'model':db[_0xed2c('0xfd')],'as':'Intervals','attributes':['id',_0xed2c('0xf7')],'raw':!![]}]}]})[_0xed2c('0x16')](handleEntityNotFound(_0x2385ea,null))[_0xed2c('0x16')](function(_0x5b25d6){if(_0x5b25d6){_0x433510=_0x5b25d6;return _0x5b25d6[_0xed2c('0xfe')]({'raw':!![]});}})[_0xed2c('0x16')](function(_0x4a1cd4){if(_0x433510){if(_0x4a1cd4){_0x2c1636=_0x4a1cd4;}}return require(_0xed2c('0x68'))[_0xed2c('0x69')]();})[_0xed2c('0x16')](function(_0x36dc63){if(_0x36dc63){_0x3d199b=_0x36dc63[_0xed2c('0xff')];_0x50212f=_0x36dc63[_0xed2c('0x6a')];}})['then'](function(){return db['ChatInteraction'][_0xed2c('0x27')]({'where':{'closed':![]}});})[_0xed2c('0x16')](function(_0x56e392){_0x1f6c3b=_0x56e392;if(_0x3d199b&&_0x56e392>_0x3d199b){return db[_0xed2c('0x100')][_0xed2c('0x54')]({'where':{'id':0x1}})[_0xed2c('0x16')](function(_0x2ed30f){if(_0x2ed30f){_0x2ed30f[_0xed2c('0x101')](_0xed2c('0x102'));}});}})['then'](function(){if(_0x433510[_0xed2c('0xfd')]&&_0x433510[_0xed2c('0xfd')][_0xed2c('0x103')]){var _0x30d1c9=[];for(var _0x29e3f2=0x0;_0x29e3f2<_0x433510[_0xed2c('0xfd')][_0xed2c('0x103')][_0xed2c('0x3c')];_0x29e3f2++){var _0x3259a2=_0x433510[_0xed2c('0xfd')]['Intervals'][_0x29e3f2][_0xed2c('0x4b')]({'plain':!![]});_0x30d1c9[_0xed2c('0xad')](iftimePromise(_0x3259a2,_0x433510));}return BPromise[_0xed2c('0x104')](_0x30d1c9)['then'](function(_0x2ecc7e){return _[_0xed2c('0x105')](_0x2ecc7e);});}else{return!![];}})['then'](function(_0x3cafe6){var _0x20039a=fs[_0xed2c('0x106')](path[_0xed2c('0x6d')](config[_0xed2c('0x67')],'server/files/chat/iframe.ejs'),_0xed2c('0x107'));var _0x987e6b={'remote':_0x433510[_0xed2c('0x108')],'query':querystring[_0xed2c('0xa3')](_[_0xed2c('0x42')](_0x433510[_0xed2c('0x4b')]({'plain':!![]}),{'customerIp':_0x2b1b34[_0xed2c('0x79')][_0xed2c('0x96')]||_0x2b1b34[_0xed2c('0x79')][_0xed2c('0x109')]||_0x2b1b34[_0xed2c('0x10a')][_0xed2c('0x10b')]||_0x2b1b34['ip'],'referer':_0x2b1b34[_0xed2c('0x79')][_0xed2c('0x10c')],'openedInteractions':_0x1f6c3b,'maxInteractions':_0x3d199b,'virtual':_0x50212f[_0xed2c('0xff')],'online':_0x3cafe6,'custom':_0x50212f}))['replace'](/'/g,'\x5c\x27')};_0x2385ea[_0xed2c('0xbd')](ejs[_0xed2c('0xc4')](Mustache[_0xed2c('0xc4')](_0x20039a,_0x987e6b),{'proactiveActions':_0x2c1636,'alignment':_0x433510[_0xed2c('0x10d')],'verticalAlignment':_0x433510[_0xed2c('0x10e')],'div_color':_0x433510[_0xed2c('0xf0')],'labelText':_0x433510[_0xed2c('0x10f')],'text_color':_0x433510['textColor'],'button_color':_0x433510[_0xed2c('0x110')],'background_color':_0x433510[_0xed2c('0x111')],'hideWhenOffline':_0x433510[_0xed2c('0x112')],'interval':_0x433510[_0xed2c('0x113')]}));})[_0xed2c('0x1f')](handleError(_0x2385ea,null));};exports[_0xed2c('0x114')]=function(_0x216084,_0xe52497){var _0x44198a=_0x216084[_0xed2c('0x46')]['id'];var _0x9e2ade=_0x216084[_0xed2c('0x4a')];var _0x2047cb=0xc8;var _0x1f2788=null;return db[_0xed2c('0xcd')][_0xed2c('0xce')]({'isolationLevel':db[_0xed2c('0xcd')]['Transaction']['ISOLATION_LEVELS'][_0xed2c('0x115')]},function(_0x506c48){return db[_0xed2c('0x31')][_0xed2c('0x54')]({'where':{'id':_0x44198a},'transaction':_0x506c48})['then'](function(_0x22ef1c){if(_0x22ef1c){return db[_0xed2c('0x8b')]['destroy']({'where':{'ChatWebsiteId':_0x44198a},'transaction':_0x506c48})['then'](function(){var _0xb30562=_[_0xed2c('0x57')](_0x9e2ade,function(_0x19ef49){_0x19ef49[_0xed2c('0x53')]=_0x44198a;return _0x19ef49;});return db['ChatApplication'][_0xed2c('0xd0')](_0xb30562,{'transaction':_0x506c48});});}else{_0x2047cb=0x194;_0x1f2788=[];}});})[_0xed2c('0x16')](function(){if(_0x2047cb!==0x194){return db[_0xed2c('0x8b')][_0xed2c('0x116')]({'where':{'ChatWebsiteId':_0x44198a},'order':_0xed2c('0x90')})['then'](function(_0x14360a){_0x1f2788=_0x14360a;});}})[_0xed2c('0x1f')](function(_0x55a6d0){_0x2047cb=0x1f4;logger[_0xed2c('0x1a')](_0x55a6d0[_0xed2c('0x117')]);if(_0x55a6d0[_0xed2c('0x2d')]){delete _0x55a6d0[_0xed2c('0x2d')];}_0x1f2788=_0x55a6d0;})['finally'](function(){if(_0x1f2788===null){_0xe52497['sendStatus'](_0x2047cb);}else{if(_0x2047cb===0x1f4){_0xe52497[_0xed2c('0x21')](_0x2047cb)['send'](_0x1f2788);}else{_0xe52497[_0xed2c('0x21')](_0x2047cb)['json'](_0x1f2788);}}});};exports[_0xed2c('0x118')]=function(_0x43522a,_0x5a7864){var _0x1ec3a2={};var _0x343e3b={};var _0xda07c3;var _0x5ceb43;return db['ChatWebsite'][_0xed2c('0x54')]({'where':{'id':_0x43522a[_0xed2c('0x46')]['id']}})['then'](handleEntityNotFound(_0x5a7864,null))[_0xed2c('0x16')](function(_0x563e99){if(_0x563e99){_0xda07c3=_0x563e99;_0x343e3b[_0xed2c('0x35')]=_['keys'](db[_0xed2c('0x8b')][_0xed2c('0x32')]);_0x343e3b[_0xed2c('0x36')]=_[_0xed2c('0x37')](_0x43522a['query']);_0x343e3b[_0xed2c('0x38')]=_[_0xed2c('0x39')](_0x343e3b[_0xed2c('0x35')],_0x343e3b['query']);_0x1ec3a2['attributes']=_[_0xed2c('0x39')](_0x343e3b['model'],qs[_0xed2c('0x3b')](_0x43522a[_0xed2c('0x36')]['fields']));_0x1ec3a2[_0xed2c('0x3a')]=_0x1ec3a2[_0xed2c('0x3a')][_0xed2c('0x3c')]?_0x1ec3a2['attributes']:_0x343e3b[_0xed2c('0x35')];_0x1ec3a2[_0xed2c('0x56')]=qs[_0xed2c('0x3e')](_0x43522a[_0xed2c('0x36')][_0xed2c('0x3e')]);_0x1ec3a2[_0xed2c('0x41')]=qs[_0xed2c('0x38')](_[_0xed2c('0x3f')](_0x43522a[_0xed2c('0x36')],_0x343e3b[_0xed2c('0x38')]));if(_0x43522a[_0xed2c('0x36')][_0xed2c('0x40')]){_0x1ec3a2[_0xed2c('0x41')]=_[_0xed2c('0x42')](_0x1ec3a2[_0xed2c('0x41')],{'$or':_[_0xed2c('0x57')](_0x1ec3a2[_0xed2c('0x3a')],function(_0x5ac036){var _0x10b6c0={};_0x10b6c0[_0x5ac036]={'$like':'%'+_0x43522a['query']['filter']+'%'};return _0x10b6c0;})});}_0x1ec3a2=_[_0xed2c('0x42')]({},_0x1ec3a2,_0x43522a[_0xed2c('0x48')]);return _0xda07c3['getApplications'](_0x1ec3a2);}})['then'](function(_0x52f4f7){if(_0x52f4f7){_0x5ceb43=_0x52f4f7[_0xed2c('0x3c')];if(!_0x43522a[_0xed2c('0x36')]['hasOwnProperty'](_0xed2c('0x55'))){_0x1ec3a2[_0xed2c('0x25')]=qs['limit'](_0x43522a[_0xed2c('0x36')][_0xed2c('0x25')]);_0x1ec3a2[_0xed2c('0x24')]=qs[_0xed2c('0x24')](_0x43522a[_0xed2c('0x36')][_0xed2c('0x24')]);}return _0xda07c3['getApplications'](_0x1ec3a2);}})[_0xed2c('0x16')](function(_0x11c194){if(_0x11c194){return _0x11c194?{'count':_0x5ceb43,'rows':_0x11c194}:null;}})[_0xed2c('0x16')](respondWithResult(_0x5a7864,null))['catch'](handleError(_0x5a7864,null));};exports[_0xed2c('0x119')]=function(_0x572f09,_0x263be3){return db[_0xed2c('0x11a')][_0xed2c('0x4e')]({'where':{'id':_0x572f09[_0xed2c('0x46')]['id']}})[_0xed2c('0x16')](handleEntityNotFound(_0x263be3,null))[_0xed2c('0x16')](function(_0x206b73){if(_0x206b73){return _0x206b73['addProactiveActions'](_0x572f09[_0xed2c('0x4a')][_0xed2c('0x5b')],_[_0xed2c('0xe8')](_0x572f09[_0xed2c('0x4a')],[_0xed2c('0x5b'),'id'])||{});}})[_0xed2c('0x16')](respondWithResult(_0x263be3,null))['catch'](handleError(_0x263be3,null));};exports['getProactiveActions']=function(_0xe54018,_0x5b5018){var _0x6550a4={};var _0x11661f={};var _0x5e1e93;var _0x28a7a4;return db['ChatWebsite'][_0xed2c('0x54')]({'where':{'id':_0xe54018[_0xed2c('0x46')]['id']}})['then'](handleEntityNotFound(_0x5b5018,null))['then'](function(_0x492f05){if(_0x492f05){_0x5e1e93=_0x492f05;_0x11661f[_0xed2c('0x35')]=_[_0xed2c('0x37')](db[_0xed2c('0x11b')][_0xed2c('0x32')]);_0x11661f[_0xed2c('0x36')]=_[_0xed2c('0x37')](_0xe54018[_0xed2c('0x36')]);_0x11661f['filters']=_[_0xed2c('0x39')](_0x11661f['model'],_0x11661f['query']);_0x6550a4[_0xed2c('0x3a')]=_[_0xed2c('0x39')](_0x11661f['model'],qs[_0xed2c('0x3b')](_0xe54018['query'][_0xed2c('0x3b')]));_0x6550a4[_0xed2c('0x3a')]=_0x6550a4['attributes'][_0xed2c('0x3c')]?_0x6550a4[_0xed2c('0x3a')]:_0x11661f['model'];_0x6550a4[_0xed2c('0x56')]=qs[_0xed2c('0x3e')](_0xe54018[_0xed2c('0x36')][_0xed2c('0x3e')]);_0x6550a4[_0xed2c('0x41')]=qs['filters'](_[_0xed2c('0x3f')](_0xe54018['query'],_0x11661f[_0xed2c('0x38')]));if(_0xe54018[_0xed2c('0x36')][_0xed2c('0x40')]){_0x6550a4['where']=_[_0xed2c('0x42')](_0x6550a4[_0xed2c('0x41')],{'$or':_[_0xed2c('0x57')](_0x6550a4[_0xed2c('0x3a')],function(_0x5a5fca){var _0x516013={};_0x516013[_0x5a5fca]={'$like':'%'+_0xe54018[_0xed2c('0x36')][_0xed2c('0x40')]+'%'};return _0x516013;})});}_0x6550a4=_['merge']({},_0x6550a4,_0xe54018['options']);return _0x5e1e93[_0xed2c('0xfe')](_0x6550a4);}})[_0xed2c('0x16')](function(_0x311da3){if(_0x311da3){_0x28a7a4=_0x311da3[_0xed2c('0x3c')];if(!_0xe54018['query'][_0xed2c('0x3d')](_0xed2c('0x55'))){_0x6550a4[_0xed2c('0x25')]=qs[_0xed2c('0x25')](_0xe54018['query'][_0xed2c('0x25')]);_0x6550a4[_0xed2c('0x24')]=qs[_0xed2c('0x24')](_0xe54018[_0xed2c('0x36')]['offset']);}return _0x5e1e93[_0xed2c('0xfe')](_0x6550a4);}})[_0xed2c('0x16')](function(_0x3ebceb){if(_0x3ebceb){return _0x3ebceb?{'count':_0x28a7a4,'rows':_0x3ebceb}:null;}})[_0xed2c('0x16')](respondWithResult(_0x5b5018,null))[_0xed2c('0x1f')](handleError(_0x5b5018,null));};exports[_0xed2c('0x11c')]=function(_0x1c779c,_0xc66d56){var _0x12fade=_0x1c779c[_0xed2c('0x36')]['online']===_0xed2c('0x11d')?_0xed2c('0x11e'):_0xed2c('0x11f');return db[_0xed2c('0x31')][_0xed2c('0x4e')]({'attributes':['id',_0x12fade],'where':{'id':_0x1c779c[_0xed2c('0x46')]['id']}})[_0xed2c('0x16')](handleEntityNotFound(_0xc66d56,null))[_0xed2c('0x16')](function(_0x5568b2){if(_0x5568b2){var _0x1db71a=_0x5568b2[_0x12fade];var _0x50eacb=_0x1db71a&&_0x1db71a[_0xed2c('0x120')]?_0x1db71a[_0xed2c('0x120')]:[];_0xc66d56[_0xed2c('0xbd')]({'fromKey':_[_0xed2c('0x6b')](_0x1db71a['fromKey'])?undefined:_0x1db71a[_0xed2c('0x121')],'count':_0x50eacb[_0xed2c('0x3c')],'rows':_0x50eacb});}})['catch'](handleError(_0xc66d56,null));};exports[_0xed2c('0x122')]=function(_0x41c9f7,_0x5ab51a){var _0x2152fd={'raw':![],'where':{}};var _0x26b59c={};var _0x116886={'count':0x0,'rows':[]};return db[_0xed2c('0x31')][_0xed2c('0x54')]({'where':{'id':_0x41c9f7['params']['id']}})[_0xed2c('0x16')](handleEntityNotFound(_0x5ab51a,null))[_0xed2c('0x16')](function(_0x256ab3){if(_0x256ab3){_0x26b59c[_0xed2c('0x35')]=_[_0xed2c('0x37')](db['ChatOfflineMessage'][_0xed2c('0x32')]);_0x26b59c[_0xed2c('0x36')]=_[_0xed2c('0x37')](_0x41c9f7[_0xed2c('0x36')]);_0x26b59c[_0xed2c('0x38')]=_[_0xed2c('0x39')](_0x26b59c[_0xed2c('0x35')],_0x26b59c[_0xed2c('0x36')]);_0x2152fd[_0xed2c('0x3a')]=_[_0xed2c('0x39')](_0x26b59c[_0xed2c('0x35')],qs[_0xed2c('0x3b')](_0x41c9f7[_0xed2c('0x36')][_0xed2c('0x3b')]));_0x2152fd[_0xed2c('0x3a')]=_0x2152fd[_0xed2c('0x3a')][_0xed2c('0x3c')]?_0x2152fd[_0xed2c('0x3a')]:_0x26b59c['model'];if(!_0x41c9f7[_0xed2c('0x36')][_0xed2c('0x3d')](_0xed2c('0x55'))){_0x2152fd['limit']=qs[_0xed2c('0x25')](_0x41c9f7[_0xed2c('0x36')][_0xed2c('0x25')]);_0x2152fd[_0xed2c('0x24')]=qs[_0xed2c('0x24')](_0x41c9f7[_0xed2c('0x36')][_0xed2c('0x24')]);}_0x2152fd[_0xed2c('0x56')]=qs[_0xed2c('0x3e')](_0x41c9f7[_0xed2c('0x36')][_0xed2c('0x3e')]);_0x2152fd[_0xed2c('0x41')]=qs[_0xed2c('0x38')](_[_0xed2c('0x3f')](_0x41c9f7[_0xed2c('0x36')],_0x26b59c[_0xed2c('0x38')]));_0x2152fd[_0xed2c('0x41')][_0xed2c('0x53')]=_0x256ab3['id'];if(_0x41c9f7[_0xed2c('0x36')][_0xed2c('0x40')]){_0x2152fd[_0xed2c('0x41')]=_[_0xed2c('0x42')](_0x2152fd['where'],{'$or':_[_0xed2c('0x57')](_0x2152fd[_0xed2c('0x3a')],function(_0x1fff28){var _0xd62043={};_0xd62043[_0x1fff28]={'$like':'%'+_0x41c9f7[_0xed2c('0x36')][_0xed2c('0x40')]+'%'};return _0xd62043;})});}_0x2152fd=_['merge']({},_0x2152fd,_0x41c9f7[_0xed2c('0x48')]);return db['ChatOfflineMessage']['count']({'where':_0x2152fd[_0xed2c('0x41')]})['then'](function(_0xd9cb82){_0x116886[_0xed2c('0x27')]=_0xd9cb82;if(_0x41c9f7[_0xed2c('0x36')][_0xed2c('0x43')]){_0x2152fd[_0xed2c('0x47')]=[{'all':!![]}];}else{_0x2152fd[_0xed2c('0x47')]=[{'model':db[_0xed2c('0x7d')],'as':_0xed2c('0xea'),'required':![]},{'model':db[_0xed2c('0xcf')],'as':'Attachments','required':![]}];}return db[_0xed2c('0xc6')][_0xed2c('0x44')](_0x2152fd);})['then'](function(_0xac6af0){_0x116886['rows']=_0xac6af0;return _0x116886;});}})[_0xed2c('0x16')](respondWithFilteredResult(_0x5ab51a,_0x2152fd))['catch'](handleError(_0x5ab51a,null));};exports[_0xed2c('0x123')]=function(_0x25ad40,_0x285048){return db[_0xed2c('0x31')]['find']({'where':{'id':_0x25ad40[_0xed2c('0x46')]['id']}})[_0xed2c('0x16')](handleEntityNotFound(_0x285048,null))[_0xed2c('0x16')](function(_0x2c2f23){if(_0x2c2f23){return _0x2c2f23[_0xed2c('0x123')](_0x25ad40[_0xed2c('0x4a')][_0xed2c('0x5b')],_[_0xed2c('0xe8')](_0x25ad40[_0xed2c('0x4a')],[_0xed2c('0x5b'),'id'])||{})[_0xed2c('0xa9')](function(_0x5f137f){for(var _0x4ec26a=0x0;_0x4ec26a<_0x25ad40[_0xed2c('0x4a')][_0xed2c('0x5b')][_0xed2c('0x3c')];_0x4ec26a+=0x1){socket[_0xed2c('0x124')]('userChatWebsite:save',{'UserId':Number(_0x25ad40[_0xed2c('0x4a')][_0xed2c('0x5b')][_0x4ec26a]),'ChatWebsiteId':Number(_0x25ad40['params']['id'])});}return _0x5f137f;});}})[_0xed2c('0x16')](respondWithResult(_0x285048,null))[_0xed2c('0x1f')](handleError(_0x285048,null));};exports['removeAgents']=function(_0x1fd1a9,_0x3da0f0){return db[_0xed2c('0x31')][_0xed2c('0x4e')]({'where':{'id':_0x1fd1a9[_0xed2c('0x46')]['id']}})[_0xed2c('0x16')](handleEntityNotFound(_0x3da0f0,null))[_0xed2c('0x16')](function(_0x2c0e07){if(_0x2c0e07){return _0x2c0e07[_0xed2c('0x125')](_0x1fd1a9[_0xed2c('0x36')][_0xed2c('0x5b')])['then'](function(){if(_[_0xed2c('0x126')](_0x1fd1a9[_0xed2c('0x36')][_0xed2c('0x5b')])){for(var _0xe167a1=0x0;_0xe167a1<_0x1fd1a9['query'][_0xed2c('0x5b')][_0xed2c('0x3c')];_0xe167a1+=0x1){socket[_0xed2c('0x124')]('userChatWebsite:remove',{'UserId':Number(_0x1fd1a9[_0xed2c('0x36')][_0xed2c('0x5b')][_0xe167a1]),'ChatWebsiteId':Number(_0x1fd1a9[_0xed2c('0x46')]['id'])});}}else{socket[_0xed2c('0x124')](_0xed2c('0x127'),{'UserId':Number(_0x1fd1a9['query']['ids']),'ChatWebsiteId':Number(_0x1fd1a9[_0xed2c('0x46')]['id'])});}});}})[_0xed2c('0x16')](respondWithStatusCode(_0x3da0f0,null))[_0xed2c('0x1f')](handleError(_0x3da0f0,null));};exports[_0xed2c('0x128')]=function(_0x297394,_0x98520b){var _0x2ff311={};var _0xc5bce8={};var _0x5bf311;var _0x3bc928;return db[_0xed2c('0x31')][_0xed2c('0x54')]({'where':{'id':_0x297394['params']['id']}})['then'](handleEntityNotFound(_0x98520b,null))[_0xed2c('0x16')](function(_0x2488e1){if(_0x2488e1){_0x5bf311=_0x2488e1;_0xc5bce8[_0xed2c('0x35')]=_[_0xed2c('0x37')](db[_0xed2c('0xb4')][_0xed2c('0x32')]);_0xc5bce8[_0xed2c('0x36')]=_[_0xed2c('0x37')](_0x297394['query']);_0xc5bce8[_0xed2c('0x38')]=_['intersection'](_0xc5bce8['model'],_0xc5bce8[_0xed2c('0x36')]);_0x2ff311[_0xed2c('0x3a')]=_[_0xed2c('0x39')](_0xc5bce8[_0xed2c('0x35')],qs[_0xed2c('0x3b')](_0x297394[_0xed2c('0x36')][_0xed2c('0x3b')]));_0x2ff311[_0xed2c('0x3a')]=_0x2ff311[_0xed2c('0x3a')][_0xed2c('0x3c')]?_0x2ff311[_0xed2c('0x3a')]:_0xc5bce8['model'];_0x2ff311[_0xed2c('0x56')]=qs[_0xed2c('0x3e')](_0x297394[_0xed2c('0x36')][_0xed2c('0x3e')]);_0x2ff311[_0xed2c('0x41')]=qs[_0xed2c('0x38')](_[_0xed2c('0x3f')](_0x297394[_0xed2c('0x36')],_0xc5bce8[_0xed2c('0x38')]));if(_0x297394['query'][_0xed2c('0x40')]){_0x2ff311[_0xed2c('0x41')]=_[_0xed2c('0x42')](_0x2ff311[_0xed2c('0x41')],{'$or':_[_0xed2c('0x57')](_0x2ff311['attributes'],function(_0x23871b){var _0x1f6484={};_0x1f6484[_0x23871b]={'$like':'%'+_0x297394[_0xed2c('0x36')][_0xed2c('0x40')]+'%'};return _0x1f6484;})});}_0x2ff311=_[_0xed2c('0x42')]({},_0x2ff311,_0x297394[_0xed2c('0x48')]);return _0x5bf311[_0xed2c('0x128')](_0x2ff311);}})[_0xed2c('0x16')](function(_0x3d7a69){if(_0x3d7a69){_0x3bc928=_0x3d7a69[_0xed2c('0x3c')];if(!_0x297394['query']['hasOwnProperty']('nolimit')){_0x2ff311[_0xed2c('0x25')]=qs['limit'](_0x297394['query']['limit']);_0x2ff311[_0xed2c('0x24')]=qs[_0xed2c('0x24')](_0x297394[_0xed2c('0x36')][_0xed2c('0x24')]);}return _0x5bf311[_0xed2c('0x128')](_0x2ff311);}})[_0xed2c('0x16')](function(_0x1f8523){if(_0x1f8523){return _0x1f8523?{'count':_0x3bc928,'rows':_0x1f8523}:null;}})[_0xed2c('0x16')](respondWithResult(_0x98520b,null))[_0xed2c('0x1f')](handleError(_0x98520b,null));}; \ No newline at end of file +var _0x00b8=['ids','addAnswer','getAnswers','CannedAnswer','options','removeAnswers','sitepic','file','filename','addAvatar','agentAvatar','addCustomerAvatar','addSystemAvatar','systemAvatar','root','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','isNil','join','server/files/images/logos/','download','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','customerAvatar','showCustomerAvatar','existsSync','getSystemAvatar','server/files/images/avatars/system_avatar.png','user-agent-parser','setUA','headers','getResult','CmContact','Sequelize','ValidationError','difference','createdAt','updatedAt','CompanyId','ListId','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','from','CmList','Contacts','DESC','ChatApplication','Applications','List','account','applications','list','orderBy','priority','asc','contact','customerIp','cf-connecting-ip','x-forwarded-for','firstName','lastName','x-real-port','referer','browser','format','version','unknown','%s\x20%s','device','vendor','threadId','externalUrl','ChatInteraction','ContactId','interaction','spread','messageId','created','autoclose','push','unmanaged','*,*,*,*','AttachmentId','UserId','User','unshift','waitForTheAssignedAgent','forcedOwnership','Start','EventManager','notify','offline','files','no\x20available\x20attributes','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKeyOffline','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','findOrCreate','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','offlineMessageBody','originalname','mimetype','server','attachments','offline-chat','basename','openNewInteraction','sequelize','Attachment','bulkCreate','MailAccount','MailServerOut','Smtp','forwardOffline','forwardOfflineAddress','getSmtpOptions','sendMail','\x22%s\x22\x20<%s>','email','user','offlineMessageSubject','MailAccountId','subjectOffline','toPairsIn','mapValues','NotifyMailAccount','notifyMail','addInteraction','omit','getInteractions','Owner','Tag','Tags','color','tag','getSnippet','timezone','iftime\x20%s,%s','interval','iftime\x20%s','true','ONLINE','OFFLINE','No\x20timezone','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','inspect','Interval','Intervals','getProactiveActions','virtual','License','increment','chatLicenseExceeded','all','readFileSync','remote','x-real-ip','remoteAddress','replace','labelText','color_button','backgroundColor','IntervalId','addApplications','transaction','Transaction','READ_COMMITTED','findAndCountAll','getApplications','chatProactiveAction','online','false','onlineForm','items','fromKey','getOfflineMessages','ChatOfflineMessage','Contact','Attachments','addAgents','removeAgents','isArray','emit','userChatWebsite:remove','getAgents','bluebird','mustache','util','path','ejs','fs-extra','querystring','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','ChatWebsite,\x20%s,\x20%s','message','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','update','destroy','get','ChatWebsites','stack','name','send','Pause','ChatWebsite','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','map','type','VIRTUAL','rows','catch','params','mandatoryDispositionPause','keys','includeAll','include','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','autoAssociation','UserProfileResource','describe','addDisposition','ChatWebsiteId','Disposition','findOne','findAll','removeDispositions'];(function(_0x2c3b7f,_0x4e448a){var _0x22d6b6=function(_0x179b98){while(--_0x179b98){_0x2c3b7f['push'](_0x2c3b7f['shift']());}};_0x22d6b6(++_0x4e448a);}(_0x00b8,0x1e0));var _0x800b=function(_0x16a25e,_0x500f8c){_0x16a25e=_0x16a25e-0x0;var _0x342478=_0x00b8[_0x16a25e];return _0x342478;};'use strict';var BPromise=require(_0x800b('0x0'));var Mustache=require(_0x800b('0x1'));var util=require(_0x800b('0x2'));var path=require(_0x800b('0x3'));var ejs=require(_0x800b('0x4'));var fs=require('fs');var fs_extra=require(_0x800b('0x5'));var _=require('lodash');var querystring=require(_0x800b('0x6'));var Redis=require('ioredis');var qs=require(_0x800b('0x7'));var logger=require(_0x800b('0x8'))(_0x800b('0x9'));var config=require(_0x800b('0xa'));var db=require(_0x800b('0xb'))['db'];config[_0x800b('0xc')]=_[_0x800b('0xd')](config[_0x800b('0xc')],{'host':_0x800b('0xe'),'port':0x18eb});var socket=require(_0x800b('0xf'))(new Redis(config[_0x800b('0xc')]));require(_0x800b('0x10'))[_0x800b('0x11')](socket);var htmlToText=require('html-to-text');var jayson=require(_0x800b('0x12'));var client=jayson[_0x800b('0x13')][_0x800b('0x14')]({'port':0x232c});var client9002=jayson[_0x800b('0x13')]['http']({'port':0x232a});var client9003=jayson[_0x800b('0x13')][_0x800b('0x14')]({'port':0x232b});var client9001=jayson[_0x800b('0x13')][_0x800b('0x14')]({'port':0x2329});function respondWithRpcPromise(_0x355ed8,_0x471316,_0x363ec0,_0x1512e8){return new BPromise(function(_0x1d7520,_0x1e6964){var _0x149764=_0x1512e8||client;return _0x149764[_0x800b('0x15')](_0x355ed8,_0x363ec0)[_0x800b('0x16')](function(_0x1c4546){logger[_0x800b('0x17')]('ChatWebsite,\x20%s,\x20%s',_0x471316,_0x800b('0x18'));logger[_0x800b('0x19')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x471316,_0x800b('0x18'),JSON[_0x800b('0x1a')](_0x1c4546));if(_0x1c4546[_0x800b('0x1b')]){if(_0x1c4546[_0x800b('0x1b')][_0x800b('0x1c')]===0x1f4){logger[_0x800b('0x1b')](_0x800b('0x1d'),_0x471316,_0x1c4546['error'][_0x800b('0x1e')]);return _0x1e6964(_0x1c4546[_0x800b('0x1b')]['message']);}logger[_0x800b('0x1b')](_0x800b('0x1d'),_0x471316,_0x1c4546[_0x800b('0x1b')][_0x800b('0x1e')]);return _0x1d7520(_0x1c4546['error'][_0x800b('0x1e')]);}else{logger[_0x800b('0x17')](_0x800b('0x1d'),_0x471316,_0x800b('0x18'));_0x1d7520(_0x1c4546['result']['message']);}})['catch'](function(_0x78dbff){logger[_0x800b('0x1b')](_0x800b('0x1d'),_0x471316,_0x78dbff);_0x1e6964(_0x78dbff);});});}function respondWithStatusCode(_0x4611e5,_0x1d1bd7){_0x1d1bd7=_0x1d1bd7||0xcc;return function(_0x279dd9){if(_0x279dd9){return _0x4611e5[_0x800b('0x1f')](_0x1d1bd7);}return _0x4611e5[_0x800b('0x20')](_0x1d1bd7)[_0x800b('0x21')]();};}function respondWithResult(_0xcde909,_0x2713f4){_0x2713f4=_0x2713f4||0xc8;return function(_0x252c96){if(_0x252c96){return _0xcde909['status'](_0x2713f4)[_0x800b('0x22')](_0x252c96);}};}function respondWithFilteredResult(_0x52d4cd,_0x1aa519){return function(_0x59ea97){if(_0x59ea97){var _0xa0e7e5=typeof _0x1aa519[_0x800b('0x23')]===_0x800b('0x24')&&typeof _0x1aa519['limit']===_0x800b('0x24');var _0x3fa609=_0x59ea97[_0x800b('0x25')];var _0x26e23b=_0xa0e7e5?0x0:_0x1aa519[_0x800b('0x23')];var _0x447b2e=_0xa0e7e5?_0x59ea97[_0x800b('0x25')]:_0x1aa519['offset']+_0x1aa519['limit'];var _0x5dcd20;if(_0x447b2e>=_0x3fa609){_0x447b2e=_0x3fa609;_0x5dcd20=0xc8;}else{_0x5dcd20=0xce;}_0x52d4cd['status'](_0x5dcd20);return _0x52d4cd[_0x800b('0x26')](_0x800b('0x27'),_0x26e23b+'-'+_0x447b2e+'/'+_0x3fa609)['json'](_0x59ea97);}return null;};}function saveUpdates(_0x5d560a){return function(_0x3e3d8e){if(_0x3e3d8e){return _0x3e3d8e[_0x800b('0x28')](_0x5d560a)[_0x800b('0x16')](function(_0x1cad56){return _0x1cad56;});}return null;};}function removeEntity(_0x1a57bd){return function(_0x1072c2){if(_0x1072c2){return _0x1072c2[_0x800b('0x29')]()['then'](function(){var _0x43d0f9=_0x1072c2[_0x800b('0x2a')]({'plain':!![]});var _0x5dd92e=_0x800b('0x2b');return db['UserProfileResource']['destroy']({'where':{'type':_0x5dd92e,'resourceId':_0x43d0f9['id']}})[_0x800b('0x16')](function(){return _0x1072c2;});})[_0x800b('0x16')](function(){_0x1a57bd[_0x800b('0x20')](0xcc)[_0x800b('0x21')]();});}};}function handleEntityNotFound(_0x2c72d0){return function(_0x5445c1){if(!_0x5445c1){_0x2c72d0[_0x800b('0x1f')](0x194);}return _0x5445c1;};}function handleError(_0x2afe8c,_0x408d9a){_0x408d9a=_0x408d9a||0x1f4;return function(_0x238108){logger[_0x800b('0x1b')](_0x238108[_0x800b('0x2c')]);if(_0x238108[_0x800b('0x2d')]){delete _0x238108[_0x800b('0x2d')];}_0x2afe8c[_0x800b('0x20')](_0x408d9a)[_0x800b('0x2e')](_0x238108);};}exports['index']=function(_0x48d20b,_0x55dc33){var _0x3e24a4={'include':[{'model':db[_0x800b('0x2f')],'as':'mandatoryDispositionPause'}]},_0x357fa={},_0x94f0eb={'count':0x0,'rows':[]};var _0xf462d3=_['map'](db[_0x800b('0x30')][_0x800b('0x31')],function(_0x780563){return{'name':_0x780563[_0x800b('0x32')],'type':_0x780563['type'][_0x800b('0x33')]};});_0x357fa[_0x800b('0x34')]=_['map'](_0xf462d3,_0x800b('0x2d'));_0x357fa[_0x800b('0x35')]=_['keys'](_0x48d20b[_0x800b('0x35')]);_0x357fa[_0x800b('0x36')]=_[_0x800b('0x37')](_0x357fa[_0x800b('0x34')],_0x357fa[_0x800b('0x35')]);_0x3e24a4['attributes']=_[_0x800b('0x37')](_0x357fa[_0x800b('0x34')],qs[_0x800b('0x38')](_0x48d20b[_0x800b('0x35')]['fields']));_0x3e24a4[_0x800b('0x39')]=_0x3e24a4[_0x800b('0x39')][_0x800b('0x3a')]?_0x3e24a4['attributes']:_0x357fa[_0x800b('0x34')];if(!_0x48d20b[_0x800b('0x35')][_0x800b('0x3b')](_0x800b('0x3c'))){_0x3e24a4[_0x800b('0x3d')]=qs[_0x800b('0x3d')](_0x48d20b['query'][_0x800b('0x3d')]);_0x3e24a4['offset']=qs['offset'](_0x48d20b[_0x800b('0x35')][_0x800b('0x23')]);}_0x3e24a4[_0x800b('0x3e')]=qs[_0x800b('0x3f')](_0x48d20b[_0x800b('0x35')][_0x800b('0x3f')]);_0x3e24a4[_0x800b('0x40')]=qs['filters'](_[_0x800b('0x41')](_0x48d20b[_0x800b('0x35')],_0x357fa[_0x800b('0x36')]),_0xf462d3);if(_0x48d20b[_0x800b('0x35')][_0x800b('0x42')]){_0x3e24a4[_0x800b('0x40')]=_[_0x800b('0x43')](_0x3e24a4[_0x800b('0x40')],{'$or':_[_0x800b('0x44')](_0xf462d3,function(_0x410599){if(_0x410599[_0x800b('0x45')]!==_0x800b('0x46')){var _0x4e7db2={};_0x4e7db2[_0x410599[_0x800b('0x2d')]]={'$like':'%'+_0x48d20b[_0x800b('0x35')][_0x800b('0x42')]+'%'};return _0x4e7db2;}})});}_0x3e24a4=_['merge']({},_0x3e24a4,_0x48d20b['options']);var _0x24cd57={'where':_0x3e24a4[_0x800b('0x40')]};return db['ChatWebsite'][_0x800b('0x25')](_0x24cd57)[_0x800b('0x16')](function(_0x5c2f40){_0x94f0eb[_0x800b('0x25')]=_0x5c2f40;if(_0x48d20b[_0x800b('0x35')]['includeAll']){_0x3e24a4['include']=[{'all':!![]}];}return db[_0x800b('0x30')]['findAll'](_0x3e24a4);})['then'](function(_0x2482a4){_0x94f0eb[_0x800b('0x47')]=_0x2482a4;return _0x94f0eb;})[_0x800b('0x16')](respondWithFilteredResult(_0x55dc33,_0x3e24a4))[_0x800b('0x48')](handleError(_0x55dc33,null));};exports['show']=function(_0x5b89d9,_0x3837fc){var _0x2b799f={'raw':![],'where':{'id':_0x5b89d9[_0x800b('0x49')]['id']},'include':[{'model':db[_0x800b('0x2f')],'as':_0x800b('0x4a')}]},_0x314d45={};_0x314d45[_0x800b('0x34')]=_[_0x800b('0x4b')](db['ChatWebsite']['rawAttributes']);_0x314d45['query']=_['keys'](_0x5b89d9['query']);_0x314d45[_0x800b('0x36')]=_[_0x800b('0x37')](_0x314d45[_0x800b('0x34')],_0x314d45[_0x800b('0x35')]);_0x2b799f[_0x800b('0x39')]=_[_0x800b('0x37')](_0x314d45[_0x800b('0x34')],qs[_0x800b('0x38')](_0x5b89d9[_0x800b('0x35')][_0x800b('0x38')]));_0x2b799f['attributes']=_0x2b799f[_0x800b('0x39')][_0x800b('0x3a')]?_0x2b799f[_0x800b('0x39')]:_0x314d45['model'];if(_0x5b89d9[_0x800b('0x35')][_0x800b('0x4c')]){_0x2b799f[_0x800b('0x4d')]=[{'all':!![]}];}_0x2b799f=_[_0x800b('0x43')]({},_0x2b799f,_0x5b89d9['options']);return db['ChatWebsite']['find'](_0x2b799f)['then'](handleEntityNotFound(_0x3837fc,null))[_0x800b('0x16')](respondWithResult(_0x3837fc,null))['catch'](handleError(_0x3837fc,null));};exports['create']=function(_0x432e2d,_0x5e8ae3){return db[_0x800b('0x30')][_0x800b('0x4e')](_0x432e2d[_0x800b('0x4f')],{})['then'](function(_0x5d02c5){var _0x3aa513=_0x432e2d['user'][_0x800b('0x2a')]({'plain':!![]});if(!_0x3aa513)throw new Error(_0x800b('0x50'));if(_0x3aa513[_0x800b('0x51')]==='user'){var _0x2b13fd=_0x5d02c5['get']({'plain':!![]});var _0x56ca50=_0x800b('0x2b');return db['UserProfileSection'][_0x800b('0x52')]({'where':{'name':_0x56ca50,'userProfileId':_0x3aa513['userProfileId']},'raw':!![]})[_0x800b('0x16')](function(_0x2e7d96){if(_0x2e7d96&&_0x2e7d96[_0x800b('0x53')]===0x0){return db[_0x800b('0x54')][_0x800b('0x4e')]({'name':_0x2b13fd[_0x800b('0x2d')],'resourceId':_0x2b13fd['id'],'type':_0x2e7d96[_0x800b('0x2d')],'sectionId':_0x2e7d96['id']},{})['then'](function(){return _0x5d02c5;});}else{return _0x5d02c5;}})[_0x800b('0x48')](function(_0x29dd3d){logger[_0x800b('0x1b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x29dd3d);throw _0x29dd3d;});}return _0x5d02c5;})[_0x800b('0x16')](respondWithResult(_0x5e8ae3,0xc9))[_0x800b('0x48')](handleError(_0x5e8ae3,null));};exports[_0x800b('0x28')]=function(_0x5dea28,_0x33311c){if(_0x5dea28[_0x800b('0x4f')]['id']){delete _0x5dea28[_0x800b('0x4f')]['id'];}return db[_0x800b('0x30')]['find']({'where':{'id':_0x5dea28['params']['id']},'include':[{'model':db['Pause'],'as':_0x800b('0x4a')}]})[_0x800b('0x16')](handleEntityNotFound(_0x33311c,null))[_0x800b('0x16')](saveUpdates(_0x5dea28[_0x800b('0x4f')],null))[_0x800b('0x16')](respondWithResult(_0x33311c,null))[_0x800b('0x48')](handleError(_0x33311c,null));};exports[_0x800b('0x29')]=function(_0x4e3d93,_0xbc2ae){return db[_0x800b('0x30')][_0x800b('0x52')]({'where':{'id':_0x4e3d93[_0x800b('0x49')]['id']}})[_0x800b('0x16')](handleEntityNotFound(_0xbc2ae,null))['then'](removeEntity(_0xbc2ae,null))['catch'](handleError(_0xbc2ae,null));};exports[_0x800b('0x55')]=function(_0x514c0d,_0x3cc55e){return db[_0x800b('0x30')][_0x800b('0x55')]()[_0x800b('0x16')](respondWithResult(_0x3cc55e,null))['catch'](handleError(_0x3cc55e,null));};exports[_0x800b('0x56')]=function(_0x1cce6b,_0x18fc10){if(_0x1cce6b[_0x800b('0x4f')]['id']){delete _0x1cce6b[_0x800b('0x4f')]['id'];}return db[_0x800b('0x30')][_0x800b('0x52')]({'where':{'id':_0x1cce6b['params']['id']}})[_0x800b('0x16')](handleEntityNotFound(_0x18fc10,null))[_0x800b('0x16')](function(_0x18d4d8){if(_0x18d4d8){_0x1cce6b[_0x800b('0x4f')][_0x800b('0x57')]=_0x18d4d8['id'];return db[_0x800b('0x58')][_0x800b('0x4e')](_0x1cce6b[_0x800b('0x4f')]);}})[_0x800b('0x16')](respondWithResult(_0x18fc10,null))[_0x800b('0x48')](handleError(_0x18fc10,null));};exports['getDispositions']=function(_0x5a12da,_0xe5f554){var _0x5a7041={'raw':![],'where':{}};var _0x4c2ec6={};var _0x1b20a1={'count':0x0,'rows':[]};return db[_0x800b('0x30')][_0x800b('0x59')]({'where':{'id':_0x5a12da[_0x800b('0x49')]['id']}})['then'](handleEntityNotFound(_0xe5f554,null))[_0x800b('0x16')](function(_0x4291a5){if(_0x4291a5){_0x4c2ec6[_0x800b('0x34')]=_[_0x800b('0x4b')](db['Disposition']['rawAttributes']);_0x4c2ec6['query']=_[_0x800b('0x4b')](_0x5a12da[_0x800b('0x35')]);_0x4c2ec6[_0x800b('0x36')]=_[_0x800b('0x37')](_0x4c2ec6['model'],_0x4c2ec6[_0x800b('0x35')]);_0x5a7041[_0x800b('0x39')]=_[_0x800b('0x37')](_0x4c2ec6['model'],qs[_0x800b('0x38')](_0x5a12da[_0x800b('0x35')][_0x800b('0x38')]));_0x5a7041[_0x800b('0x39')]=_0x5a7041[_0x800b('0x39')][_0x800b('0x3a')]?_0x5a7041[_0x800b('0x39')]:_0x4c2ec6[_0x800b('0x34')];if(!_0x5a12da[_0x800b('0x35')][_0x800b('0x3b')](_0x800b('0x3c'))){_0x5a7041[_0x800b('0x3d')]=qs['limit'](_0x5a12da[_0x800b('0x35')]['limit']);_0x5a7041['offset']=qs[_0x800b('0x23')](_0x5a12da[_0x800b('0x35')][_0x800b('0x23')]);}_0x5a7041[_0x800b('0x3e')]=qs[_0x800b('0x3f')](_0x5a12da[_0x800b('0x35')][_0x800b('0x3f')]);_0x5a7041[_0x800b('0x40')]=qs[_0x800b('0x36')](_[_0x800b('0x41')](_0x5a12da[_0x800b('0x35')],_0x4c2ec6['filters']));_0x5a7041[_0x800b('0x40')][_0x800b('0x57')]=_0x4291a5['id'];if(_0x5a12da[_0x800b('0x35')]['filter']){_0x5a7041['where']=_['merge'](_0x5a7041['where'],{'$or':_[_0x800b('0x44')](_0x5a7041['attributes'],function(_0x3dbd96){var _0x1723e4={};_0x1723e4[_0x3dbd96]={'$like':'%'+_0x5a12da[_0x800b('0x35')][_0x800b('0x42')]+'%'};return _0x1723e4;})});}_0x5a7041=_[_0x800b('0x43')]({},_0x5a7041,_0x5a12da['options']);return db[_0x800b('0x58')]['count']({'where':_0x5a7041[_0x800b('0x40')]})[_0x800b('0x16')](function(_0x27ae64){_0x1b20a1[_0x800b('0x25')]=_0x27ae64;if(_0x5a12da['query'][_0x800b('0x4c')]){_0x5a7041[_0x800b('0x4d')]=[{'all':!![]}];}return db[_0x800b('0x58')][_0x800b('0x5a')](_0x5a7041);})[_0x800b('0x16')](function(_0x131a55){_0x1b20a1[_0x800b('0x47')]=_0x131a55;return _0x1b20a1;});}})[_0x800b('0x16')](respondWithFilteredResult(_0xe5f554,_0x5a7041))[_0x800b('0x48')](handleError(_0xe5f554,null));};exports[_0x800b('0x5b')]=function(_0x85c124,_0x24545e){return db[_0x800b('0x30')][_0x800b('0x52')]({'where':{'id':_0x85c124[_0x800b('0x49')]['id']}})[_0x800b('0x16')](handleEntityNotFound(_0x24545e,null))[_0x800b('0x16')](function(_0xe9497c){if(_0xe9497c){return _0xe9497c[_0x800b('0x5b')](_0x85c124['query'][_0x800b('0x5c')]);}})[_0x800b('0x16')](respondWithStatusCode(_0x24545e,null))[_0x800b('0x48')](handleError(_0x24545e,null));};exports[_0x800b('0x5d')]=function(_0xa90ce1,_0x1d906b){if(_0xa90ce1[_0x800b('0x4f')]['id']){delete _0xa90ce1['body']['id'];}return db['ChatWebsite'][_0x800b('0x52')]({'where':{'id':_0xa90ce1[_0x800b('0x49')]['id']}})['then'](handleEntityNotFound(_0x1d906b,null))[_0x800b('0x16')](function(_0x393cb7){if(_0x393cb7){_0xa90ce1['body'][_0x800b('0x57')]=_0x393cb7['id'];return db['CannedAnswer'][_0x800b('0x4e')](_0xa90ce1[_0x800b('0x4f')]);}})[_0x800b('0x16')](respondWithResult(_0x1d906b,null))[_0x800b('0x48')](handleError(_0x1d906b,null));};exports[_0x800b('0x5e')]=function(_0x1c1dda,_0x586e27){var _0x26e3fa={'raw':![],'where':{}};var _0x2495ea={};var _0x2caff3={'count':0x0,'rows':[]};return db[_0x800b('0x30')]['findOne']({'where':{'id':_0x1c1dda[_0x800b('0x49')]['id']}})[_0x800b('0x16')](handleEntityNotFound(_0x586e27,null))['then'](function(_0x5adb08){if(_0x5adb08){_0x2495ea[_0x800b('0x34')]=_['keys'](db[_0x800b('0x5f')][_0x800b('0x31')]);_0x2495ea[_0x800b('0x35')]=_[_0x800b('0x4b')](_0x1c1dda[_0x800b('0x35')]);_0x2495ea[_0x800b('0x36')]=_[_0x800b('0x37')](_0x2495ea[_0x800b('0x34')],_0x2495ea['query']);_0x26e3fa['attributes']=_[_0x800b('0x37')](_0x2495ea[_0x800b('0x34')],qs['fields'](_0x1c1dda[_0x800b('0x35')][_0x800b('0x38')]));_0x26e3fa[_0x800b('0x39')]=_0x26e3fa[_0x800b('0x39')]['length']?_0x26e3fa[_0x800b('0x39')]:_0x2495ea[_0x800b('0x34')];if(!_0x1c1dda[_0x800b('0x35')][_0x800b('0x3b')](_0x800b('0x3c'))){_0x26e3fa['limit']=qs['limit'](_0x1c1dda[_0x800b('0x35')][_0x800b('0x3d')]);_0x26e3fa['offset']=qs[_0x800b('0x23')](_0x1c1dda[_0x800b('0x35')][_0x800b('0x23')]);}_0x26e3fa[_0x800b('0x3e')]=qs[_0x800b('0x3f')](_0x1c1dda['query']['sort']);_0x26e3fa[_0x800b('0x40')]=qs['filters'](_['pick'](_0x1c1dda['query'],_0x2495ea[_0x800b('0x36')]));_0x26e3fa['where'][_0x800b('0x57')]=_0x5adb08['id'];if(_0x1c1dda[_0x800b('0x35')][_0x800b('0x42')]){_0x26e3fa['where']=_['merge'](_0x26e3fa[_0x800b('0x40')],{'$or':_[_0x800b('0x44')](_0x26e3fa['attributes'],function(_0x16014b){var _0x2a6e8d={};_0x2a6e8d[_0x16014b]={'$like':'%'+_0x1c1dda['query'][_0x800b('0x42')]+'%'};return _0x2a6e8d;})});}_0x26e3fa=_[_0x800b('0x43')]({},_0x26e3fa,_0x1c1dda[_0x800b('0x60')]);return db[_0x800b('0x5f')][_0x800b('0x25')]({'where':_0x26e3fa[_0x800b('0x40')]})[_0x800b('0x16')](function(_0x250ae7){_0x2caff3[_0x800b('0x25')]=_0x250ae7;if(_0x1c1dda[_0x800b('0x35')]['includeAll']){_0x26e3fa[_0x800b('0x4d')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x26e3fa);})[_0x800b('0x16')](function(_0x14f713){_0x2caff3['rows']=_0x14f713;return _0x2caff3;});}})[_0x800b('0x16')](respondWithFilteredResult(_0x586e27,_0x26e3fa))[_0x800b('0x48')](handleError(_0x586e27,null));};exports[_0x800b('0x61')]=function(_0x231a0d,_0x558bcb){return db['ChatWebsite'][_0x800b('0x52')]({'where':{'id':_0x231a0d['params']['id']}})[_0x800b('0x16')](handleEntityNotFound(_0x558bcb,null))[_0x800b('0x16')](function(_0x3081dd){if(_0x3081dd){return _0x3081dd['removeAnswers'](_0x231a0d[_0x800b('0x35')]['ids']);}})[_0x800b('0x16')](respondWithStatusCode(_0x558bcb,null))[_0x800b('0x48')](handleError(_0x558bcb,null));};exports['addLogo']=function(_0x3df3c3,_0x804ef7){_0x3df3c3['body'][_0x800b('0x62')]=_0x3df3c3[_0x800b('0x63')][_0x800b('0x64')];return db[_0x800b('0x30')]['find']({'where':{'id':_0x3df3c3[_0x800b('0x49')]['id']}})[_0x800b('0x16')](handleEntityNotFound(_0x804ef7,null))[_0x800b('0x16')](saveUpdates(_0x3df3c3[_0x800b('0x4f')],null))[_0x800b('0x16')](respondWithResult(_0x804ef7,null))[_0x800b('0x48')](handleError(_0x804ef7,null));};exports[_0x800b('0x65')]=function(_0x48d37f,_0x3f654b){_0x48d37f[_0x800b('0x4f')][_0x800b('0x66')]=_0x48d37f[_0x800b('0x63')][_0x800b('0x64')];return db[_0x800b('0x30')][_0x800b('0x52')]({'where':{'id':_0x48d37f[_0x800b('0x49')]['id']}})[_0x800b('0x16')](handleEntityNotFound(_0x3f654b,null))['then'](saveUpdates(_0x48d37f[_0x800b('0x4f')],null))[_0x800b('0x16')](respondWithResult(_0x3f654b,null))['catch'](handleError(_0x3f654b,null));};exports[_0x800b('0x67')]=function(_0xd53d86,_0xc111d3){_0xd53d86['body']['customerAvatar']=_0xd53d86[_0x800b('0x63')]['filename'];return db[_0x800b('0x30')][_0x800b('0x52')]({'where':{'id':_0xd53d86[_0x800b('0x49')]['id']}})['then'](handleEntityNotFound(_0xc111d3,null))[_0x800b('0x16')](saveUpdates(_0xd53d86['body'],null))[_0x800b('0x16')](respondWithResult(_0xc111d3,null))[_0x800b('0x48')](handleError(_0xc111d3,null));};exports[_0x800b('0x68')]=function(_0x387cef,_0x38e24e){_0x387cef[_0x800b('0x4f')][_0x800b('0x69')]=_0x387cef[_0x800b('0x63')]['filename'];return db[_0x800b('0x30')]['find']({'where':{'id':_0x387cef['params']['id']}})['then'](handleEntityNotFound(_0x38e24e,null))[_0x800b('0x16')](saveUpdates(_0x387cef[_0x800b('0x4f')],null))[_0x800b('0x16')](respondWithResult(_0x38e24e,null))[_0x800b('0x48')](handleError(_0x38e24e,null));};exports['getLogo']=function(_0x49208c,_0x7c31eb){var _0x5cf398=path['join'](config[_0x800b('0x6a')],_0x800b('0x6b'));var _0x513b8a={'where':{'id':_0x49208c[_0x800b('0x49')]['id']},'attributes':['id',_0x800b('0x62')],'raw':!![]};var _0x50e641=![];return require(_0x800b('0x6c'))[_0x800b('0x6d')]()['then'](function(_0x46c24d){if(_0x46c24d){_0x50e641=_0x46c24d['custom'];}})[_0x800b('0x16')](function(){return db['ChatWebsite'][_0x800b('0x52')](_0x513b8a);})[_0x800b('0x16')](handleEntityNotFound(_0x7c31eb,null))[_0x800b('0x16')](function(_0x22baf4){if(_0x22baf4){if(!_[_0x800b('0x6e')](_0x22baf4[_0x800b('0x62')])){if(fs['existsSync'](path[_0x800b('0x6f')](config[_0x800b('0x6a')],'server/files/images/logos/',_0x22baf4[_0x800b('0x62')]))&&_0x50e641){_0x5cf398=path['join'](config[_0x800b('0x6a')],_0x800b('0x70'),_0x22baf4['sitepic']);}}return _0x7c31eb[_0x800b('0x71')](_0x5cf398);}})[_0x800b('0x48')](handleError(_0x7c31eb,null));};exports['getAvatar']=function(_0x84b1ef,_0x18c365){var _0x3cfe61=path[_0x800b('0x6f')](config['root'],_0x800b('0x72'));var _0x2ead07={'where':{'id':_0x84b1ef[_0x800b('0x49')]['id']},'attributes':['id',_0x800b('0x66')],'raw':!![]};return db['ChatWebsite'][_0x800b('0x52')](_0x2ead07)[_0x800b('0x16')](handleEntityNotFound(_0x18c365,null))['then'](function(_0x4dc27b){if(_0x4dc27b){if(!_[_0x800b('0x6e')](_0x4dc27b[_0x800b('0x66')])){if(fs['existsSync'](path['join'](config[_0x800b('0x6a')],_0x800b('0x73'),_0x4dc27b['agentAvatar']))){_0x3cfe61=path[_0x800b('0x6f')](config['root'],_0x800b('0x73'),_0x4dc27b['agentAvatar']);}}return _0x18c365[_0x800b('0x71')](_0x3cfe61);}})[_0x800b('0x48')](handleError(_0x18c365,null));};exports[_0x800b('0x74')]=function(_0x506d0d,_0x1b0503){var _0x24c25a=path[_0x800b('0x6f')](config[_0x800b('0x6a')],_0x800b('0x75'));var _0x9068a2={'where':{'id':_0x506d0d[_0x800b('0x49')]['id']},'attributes':['id',_0x800b('0x76'),_0x800b('0x77')],'raw':!![]};return db['ChatWebsite'][_0x800b('0x52')](_0x9068a2)[_0x800b('0x16')](handleEntityNotFound(_0x1b0503,null))[_0x800b('0x16')](function(_0x62c5c6){if(_0x62c5c6){if(!_[_0x800b('0x6e')](_0x62c5c6[_0x800b('0x76')])){if(fs[_0x800b('0x78')](path[_0x800b('0x6f')](config[_0x800b('0x6a')],'server/files/images/avatars/',_0x62c5c6['customerAvatar']))&&_0x62c5c6[_0x800b('0x77')]){_0x24c25a=path[_0x800b('0x6f')](config[_0x800b('0x6a')],_0x800b('0x73'),_0x62c5c6[_0x800b('0x76')]);}}return _0x1b0503[_0x800b('0x71')](_0x24c25a);}})['catch'](handleError(_0x1b0503,null));};exports[_0x800b('0x79')]=function(_0x211ac,_0x150e42){var _0x537fb7=path['join'](config[_0x800b('0x6a')],_0x800b('0x7a'));var _0x38c053={'where':{'id':_0x211ac[_0x800b('0x49')]['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db[_0x800b('0x30')]['find'](_0x38c053)['then'](handleEntityNotFound(_0x150e42,null))[_0x800b('0x16')](function(_0x1bc8e1){if(_0x1bc8e1){if(!_[_0x800b('0x6e')](_0x1bc8e1['systemAvatar'])){if(fs[_0x800b('0x78')](path[_0x800b('0x6f')](config['root'],_0x800b('0x73'),_0x1bc8e1['systemAvatar']))){_0x537fb7=path[_0x800b('0x6f')](config['root'],_0x800b('0x73'),_0x1bc8e1[_0x800b('0x69')]);}}return _0x150e42[_0x800b('0x71')](_0x537fb7);}})[_0x800b('0x48')](handleError(_0x150e42,null));};exports['notify']=function(_0x271716,_0x281807){var _0x7e8e95=require(_0x800b('0x7b'));var _0x4afd16=new _0x7e8e95();var _0x6f6ac=_0x4afd16[_0x800b('0x7c')](_0x271716[_0x800b('0x7d')]['user-agent'])[_0x800b('0x7e')]();var _0x3c8349={'body':_0x271716[_0x800b('0x4f')],'channel':'chat'};var _0x8f246c=[];var _0x5d949e=[];var _0x1e9505={};var _0x1aa349=![];return db[_0x800b('0x7f')][_0x800b('0x55')]()['then'](function(_0x21ea27){if(!_0x21ea27){throw new db[(_0x800b('0x80'))][(_0x800b('0x81'))]('no\x20available\x20attributes');}_0x8f246c=_[_0x800b('0x82')](_[_0x800b('0x4b')](_0x21ea27),[_0x800b('0x83'),_0x800b('0x84')]);_0x5d949e=_[_0x800b('0x82')](_[_0x800b('0x4b')](_0x21ea27),[_0x800b('0x83'),'updatedAt',_0x800b('0x85'),_0x800b('0x86')]);if(_0x271716[_0x800b('0x4f')]['id']){delete _0x271716[_0x800b('0x4f')]['id'];}if(_[_0x800b('0x6e')](_0x271716[_0x800b('0x4f')]['from'])){throw new db[(_0x800b('0x80'))][(_0x800b('0x81'))](_0x800b('0x87'));}if(_[_0x800b('0x6e')](_0x271716[_0x800b('0x4f')]['body'])||_0x271716[_0x800b('0x4f')][_0x800b('0x4f')]===''){throw new db[(_0x800b('0x80'))][(_0x800b('0x81'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x800b('0x6e')](_0x271716[_0x800b('0x4f')][_0x800b('0x88')])){throw new db[(_0x800b('0x80'))][(_0x800b('0x81'))](_0x800b('0x89')+_0x5d949e);}if(!_['includes'](_0x5d949e,_0x271716[_0x800b('0x4f')][_0x800b('0x88')])){throw new db[(_0x800b('0x80'))][(_0x800b('0x81'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5d949e);}_0x1e9505[_0x271716['body'][_0x800b('0x88')]]=_0x271716[_0x800b('0x4f')][_0x800b('0x8a')];})['then'](function(){return db[_0x800b('0x30')]['find']({'where':{'id':_0x271716['params']['id']},'include':[{'model':db[_0x800b('0x8b')],'as':'List','include':[{'model':db[_0x800b('0x7f')],'as':_0x800b('0x8c'),'where':_0x1e9505,'limit':0x1,'order':[[_0x800b('0x84'),_0x800b('0x8d')]]}]},{'model':db[_0x800b('0x8e')],'as':_0x800b('0x8f')}]});})[_0x800b('0x16')](handleEntityNotFound(_0x281807,null))[_0x800b('0x16')](function(_0x4d0812){if(_0x4d0812&&_0x4d0812[_0x800b('0x90')]){_0x3c8349[_0x800b('0x91')]=_0x4d0812;_0x3c8349[_0x800b('0x92')]=_0x4d0812[_0x800b('0x8f')];_0x3c8349[_0x800b('0x93')]=_0x4d0812[_0x800b('0x90')];_0x3c8349['applications']=_[_0x800b('0x94')](_0x3c8349[_0x800b('0x92')],[_0x800b('0x95')],[_0x800b('0x96')]);if(_0x3c8349['account'][_0x800b('0x8f')]){delete _0x3c8349['account']['Applications'];}if(_0x3c8349[_0x800b('0x91')][_0x800b('0x90')]&&_0x3c8349[_0x800b('0x91')]['List'][_0x800b('0x8c')][_0x800b('0x3a')]){return _0x3c8349[_0x800b('0x91')]['List'][_0x800b('0x8c')][0x0];}var _0x3c4705=_[_0x800b('0xd')](_0x271716[_0x800b('0x4f')],{'firstName':_0x271716[_0x800b('0x4f')][_0x800b('0x8a')],'ListId':_0x4d0812[_0x800b('0x86')]});_0x3c4705[_0x271716[_0x800b('0x4f')][_0x800b('0x88')]]=_0x271716[_0x800b('0x4f')][_0x800b('0x8a')];return db[_0x800b('0x7f')][_0x800b('0x4e')](_0x3c4705,{'fields':_0x8f246c,'raw':!![]});}})[_0x800b('0x16')](handleEntityNotFound(_0x281807,null))[_0x800b('0x16')](function(_0x54ae6d){_0x3c8349[_0x800b('0x97')]=_0x54ae6d;var _0x268e0a=_0x271716[_0x800b('0x4f')][_0x800b('0x98')];if(_0x271716[_0x800b('0x7d')][_0x800b('0x99')]){_0x268e0a=_0x271716[_0x800b('0x7d')][_0x800b('0x99')];}else if(_0x271716[_0x800b('0x7d')][_0x800b('0x9a')]){_0x268e0a=_['first'](_0x271716[_0x800b('0x7d')]['x-forwarded-for']['split'](','));}if(_0x54ae6d){var _0xb696d4={'ContactId':_0x54ae6d['id'],'ChatWebsiteId':_0x271716[_0x800b('0x49')]['id'],'from':(_0x54ae6d[_0x800b('0x9b')]||'')+'\x20'+(_0x54ae6d[_0x800b('0x9c')]||''),'customerIp':_0x268e0a,'customerPort':_0x271716[_0x800b('0x7d')][_0x800b('0x9d')]?_0x271716[_0x800b('0x7d')][_0x800b('0x9d')]:null,'referer':_0x271716[_0x800b('0x4f')][_0x800b('0x9e')],'browserName':_0x6f6ac[_0x800b('0x9f')][_0x800b('0x2d')]&&_0x6f6ac[_0x800b('0x9f')]['version']?util[_0x800b('0xa0')]('%s\x20%s',_0x6f6ac['browser'][_0x800b('0x2d')],_0x6f6ac['browser'][_0x800b('0xa1')]):'unknown','browserVersion':_0x6f6ac[_0x800b('0x9f')]['version']||_0x800b('0xa2'),'osName':util[_0x800b('0xa0')](_0x800b('0xa3'),_0x6f6ac['os'][_0x800b('0x2d')],_0x6f6ac['os'][_0x800b('0xa1')]),'osVersion':_0x6f6ac['os'][_0x800b('0xa1')],'deviceModel':_0x6f6ac[_0x800b('0xa4')]['model']&&_0x6f6ac[_0x800b('0xa4')][_0x800b('0xa5')]?util[_0x800b('0xa0')]('%s\x20%s\x20%s',_0x6f6ac['device']['model'],_0x6f6ac[_0x800b('0xa4')][_0x800b('0xa5')],_0x6f6ac['device'][_0x800b('0x45')]):null,'deviceVendor':_0x6f6ac[_0x800b('0xa4')][_0x800b('0xa5')],'deviceType':_0x6f6ac[_0x800b('0xa4')][_0x800b('0x45')],'formData':JSON[_0x800b('0x1a')](_0x271716['body'])};var _0x5dc1a3={'ChatWebsiteId':_0x271716[_0x800b('0x49')]['id'],'closed':![]};if(_0x271716[_0x800b('0x4f')][_0x800b('0xa6')]){_0x5dc1a3[_0x800b('0xa6')]=_0x271716[_0x800b('0x4f')][_0x800b('0xa6')];return db['ChatInteraction'][_0x800b('0x52')]({'where':_0x5dc1a3})[_0x800b('0x16')](function(_0x468c6b){if(_0x468c6b){return[_0x468c6b,![]];}_0xb696d4['threadId']=_0x271716[_0x800b('0x4f')][_0x800b('0xa6')];_0xb696d4['externalUrl']=_0x271716['body'][_0x800b('0xa7')];return db[_0x800b('0xa8')][_0x800b('0x4e')](_0xb696d4)['then'](function(_0x39b323){return[_0x39b323,!![]];});});}_0x5dc1a3[_0x800b('0xa9')]=_0x54ae6d['id'];if(_0x271716['body']['interaction']&&_0x271716[_0x800b('0x4f')][_0x800b('0xaa')]['id']){_0x5dc1a3['id']=_0x271716[_0x800b('0x4f')][_0x800b('0xaa')]['id'];return db[_0x800b('0xa8')]['find']({'where':_0x5dc1a3})[_0x800b('0x16')](function(_0x5217d7){if(_0x5217d7){return[_0x5217d7,![]];}return db[_0x800b('0xa8')][_0x800b('0x4e')](_0xb696d4)[_0x800b('0x16')](function(_0x1f58e4){return[_0x1f58e4,!![]];});});}return db[_0x800b('0xa8')][_0x800b('0x4e')](_0xb696d4)[_0x800b('0x16')](function(_0x4b12b4){return[_0x4b12b4,!![]];});}})[_0x800b('0xab')](function(_0x4e2b1c,_0x6ede9f){if(_0x4e2b1c){_0x1aa349=_0x6ede9f;if(!_0x6ede9f){var _0x221634={'from':(_0x3c8349[_0x800b('0x97')]['firstName']||'')+'\x20'+(_0x3c8349[_0x800b('0x97')][_0x800b('0x9c')]||'')};if(_0x271716[_0x800b('0x4f')][_0x800b('0xa6')]&&_0x271716[_0x800b('0x4f')][_0x800b('0xac')]&&_0x271716[_0x800b('0x4f')]['threadId']!=_0x271716[_0x800b('0x4f')][_0x800b('0xac')]){_0x221634[_0x800b('0xa6')]=_0x271716[_0x800b('0x4f')][_0x800b('0xac')];}return _0x4e2b1c[_0x800b('0x28')](_0x221634);}else{return _0x4e2b1c;}}})[_0x800b('0x16')](function(_0x41a1c7){_0x3c8349[_0x800b('0xaa')]=_0x41a1c7['get']({'plain':!![]});_0x3c8349[_0x800b('0xaa')][_0x800b('0xad')]=_0x1aa349;if(_0x3c8349[_0x800b('0xaa')]['created']){if(_0x3c8349['account'][_0x800b('0xae')]){_0x3c8349[_0x800b('0x92')][_0x800b('0xaf')]({'id':0x0,'priority':_0x3c8349[_0x800b('0x92')][_0x800b('0x3a')]+0x1,'app':'close','appdata':_0x800b('0xb0'),'interval':_0x800b('0xb1')});}}return db['ChatMessage'][_0x800b('0x4e')]({'body':_0x271716[_0x800b('0x4f')][_0x800b('0x4f')],'ChatWebsiteId':_0x271716[_0x800b('0x49')]['id'],'ChatInteractionId':_0x41a1c7['id'],'direction':'in','ContactId':_0x3c8349[_0x800b('0x97')]['id'],'AttachmentId':_0x271716[_0x800b('0x4f')][_0x800b('0xb2')]});})[_0x800b('0x16')](function(_0x2d2a15){_0x3c8349['message']=_0x2d2a15;if(_0x3c8349[_0x800b('0xaa')][_0x800b('0xb3')]){return db[_0x800b('0xb4')][_0x800b('0x52')]({'attributes':['id',_0x800b('0x2d')],'where':{'id':_0x3c8349[_0x800b('0xaa')]['UserId']}})[_0x800b('0x16')](function(_0x3fd231){if(_0x3fd231){_0x3c8349[_0x800b('0x92')][_0x800b('0xb5')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x3fd231['name']+','+(_0x3c8349[_0x800b('0x91')][_0x800b('0xb6')]||0xa),'interval':_0x800b('0xb1')});_0x3c8349[_0x800b('0xb7')]=!![];}return respondWithRpcPromise(_0x800b('0xb8'),'startRouting',_0x3c8349);});}return respondWithRpcPromise(_0x800b('0xb8'),'startRouting',_0x3c8349);})[_0x800b('0x16')](function(_0x1feef3){respondWithRpcPromise(_0x800b('0xb9'),'EventManager',{'event':_0x800b('0xba'),'message':_0x1feef3},client9002);return _0x1feef3;})[_0x800b('0x16')](respondWithResult(_0x281807,null))['catch'](handleError(_0x281807,null));};exports[_0x800b('0xbb')]=function(_0x4b680c,_0x366fe9){var _0x10b52d,_0x53cc76,_0x56f939;var _0x46ce6f=[];var _0x5accf8={};var _0x27a628=_0x4b680c[_0x800b('0xbc')]||[];var _0xe92df1=[];var _0x3554cb;return db[_0x800b('0x7f')][_0x800b('0x55')]()['then'](function(_0xf50179){if(!_0xf50179){throw new db['Sequelize'][(_0x800b('0x81'))](_0x800b('0xbd'));}_0x46ce6f=_[_0x800b('0x82')](_[_0x800b('0x4b')](_0xf50179),[_0x800b('0x83'),'updatedAt','CompanyId',_0x800b('0x86')]);if(_0x4b680c[_0x800b('0x4f')]['id']){delete _0x4b680c[_0x800b('0x4f')]['id'];}if(_[_0x800b('0x6e')](_0x4b680c[_0x800b('0x4f')]['from'])){throw _0x366fe9['status'](0x1f4)[_0x800b('0x2e')](new db[(_0x800b('0x80'))][(_0x800b('0x81'))](_0x800b('0x87')));}if(_[_0x800b('0x6e')](_0x4b680c[_0x800b('0x4f')][_0x800b('0x4f')])||_0x4b680c[_0x800b('0x4f')][_0x800b('0x4f')]===''){throw _0x366fe9[_0x800b('0x20')](0x1f4)[_0x800b('0x2e')](new db[(_0x800b('0x80'))]['ValidationError'](_0x800b('0xbe')));}if(_[_0x800b('0x6e')](_0x4b680c[_0x800b('0x4f')]['mapKeyOffline'])){throw _0x366fe9[_0x800b('0x20')](0x1f4)[_0x800b('0x2e')](new db[(_0x800b('0x80'))][(_0x800b('0x81'))](_0x800b('0xbf')+_0x46ce6f));}if(!_[_0x800b('0xc0')](_0x46ce6f,_0x4b680c[_0x800b('0x4f')][_0x800b('0xc1')])){throw _0x366fe9[_0x800b('0x20')](0x1f4)[_0x800b('0x2e')](new db['Sequelize'][(_0x800b('0x81'))](_0x800b('0xc2')+_0x46ce6f));}_0x5accf8[_0x4b680c[_0x800b('0x4f')][_0x800b('0xc1')]]=_0x4b680c[_0x800b('0x4f')][_0x800b('0x8a')];})[_0x800b('0x16')](function(){return db[_0x800b('0x30')]['find']({'where':{'id':_0x4b680c[_0x800b('0x49')]['id']},'include':[{'model':db[_0x800b('0x8b')],'as':_0x800b('0x90')},{'model':db['MailAccount'],'as':'MailAccount'}]});})[_0x800b('0x16')](handleEntityNotFound(_0x366fe9,null))[_0x800b('0x16')](function(_0x2a282c){if(_0x2a282c&&_0x2a282c[_0x800b('0x90')]){_0x53cc76=_0x2a282c;var _0x3971d9=_['defaults'](_0x4b680c['body'],{'firstName':_0x4b680c['body'][_0x800b('0x8a')],'phone':_0x4b680c[_0x800b('0x4f')][_0x800b('0x8a')],'ListId':_0x2a282c[_0x800b('0x86')]});_0x3971d9[_0x4b680c[_0x800b('0x4f')]['mapKeyOffline']]=_0x4b680c[_0x800b('0x4f')][_0x800b('0x8a')];return db[_0x800b('0x7f')][_0x800b('0xc3')]({'where':_0x5accf8,'defaults':_0x3971d9});}})['spread'](function(_0x3b2517){if(_0x3b2517){_0x56f939=_0x3b2517;var _0x2af5b9=fs['readFileSync'](path['join'](config['root'],_0x800b('0xc4')),_0x800b('0xc5'));var _0x21c93f=ejs[_0x800b('0xc6')](_0x2af5b9,{'body':_[_0x800b('0xc7')](_0x4b680c[_0x800b('0x4f')][_0x800b('0x4f')]),'bodyTitle':_0x53cc76[_0x800b('0xc8')]});return db['ChatOfflineMessage'][_0x800b('0x4e')]({'body':_0x21c93f,'plainBody':htmlToText['fromString'](_0x21c93f),'ContactId':_0x3b2517['id'],'ChatWebsiteId':_0x53cc76['id']});}})[_0x800b('0x16')](function(_0x2a9f39){_0x3554cb=_0x2a9f39;if(_0x27a628['length']){var _0x1e05cb=_0x27a628[_0x800b('0x44')](function(_0x15bf69){return{'name':_0x15bf69[_0x800b('0xc9')],'basename':_0x15bf69[_0x800b('0x64')],'type':_0x15bf69[_0x800b('0xca')],'ChatOfflineMessageId':_0x2a9f39['id']};});_0xe92df1=_0x1e05cb[_0x800b('0x44')](_0x209c20=>{var _0xc8519c={'filename':_0x209c20[_0x800b('0x2d')],'path':path['join'](config[_0x800b('0x6a')],_0x800b('0xcb'),_0x800b('0xbc'),_0x800b('0xcc'),_0x800b('0xcd'),_0x209c20[_0x800b('0xce')])};return _0xc8519c;});if(!_0x53cc76[_0x800b('0xcf')]){return db[_0x800b('0xd0')]['transaction'](function(_0x19b1c7){return db[_0x800b('0xd1')][_0x800b('0xd2')](_0x1e05cb,{'transaction':_0x19b1c7});});}}})[_0x800b('0x16')](function(){if(_0x3554cb){_0x10b52d=_0x3554cb;return db[_0x800b('0xd3')][_0x800b('0x59')]({'where':{'active':!![]},'include':[{'model':db[_0x800b('0xd4')],'as':_0x800b('0xd5'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':'CloudProvider','raw':!![]}]}]});}})[_0x800b('0x16')](function(_0x20de10){if(_0x20de10&&_0x20de10['Smtp']&&_0x53cc76[_0x800b('0xd6')]&&_0x53cc76[_0x800b('0xd7')]){var _0x35feae=_0x20de10[_0x800b('0xd8')]();return respondWithRpcPromise('SendMail',_0x800b('0xd9'),{'account':_0x35feae,'message':{'from':util[_0x800b('0xa0')](_0x800b('0xda'),_0x20de10[_0x800b('0x2d')],_0x20de10[_0x800b('0xdb')]||_0x20de10[_0x800b('0xd5')][_0x800b('0xdc')]),'to':_0x53cc76[_0x800b('0xd7')],'subject':_0x53cc76[_0x800b('0xdd')],'html':_0x10b52d['body'],'attachments':_0xe92df1}},client9003)[_0x800b('0x16')](function(){return _0x10b52d;})[_0x800b('0x48')](function(_0x597348){logger[_0x800b('0x1b')](_0x597348);});}})[_0x800b('0x16')](function(){if(_0x53cc76&&_0x53cc76[_0x800b('0xcf')]&&_0x53cc76[_0x800b('0xde')]){var _0x3538ef=[];if(_0x27a628['length']){_0x3538ef=_0x27a628[_0x800b('0x44')](function(_0x1a5426){return{'name':_0x1a5426[_0x800b('0xc9')],'basename':_0x1a5426['filename'],'type':_0x1a5426[_0x800b('0xca')],'ChatOfflineMessageId':_0x3554cb['id']};});}var _0x37c33e;if(!_[_0x800b('0x6e')](_0x53cc76[_0x800b('0xdf')])){var _0x435b0d=_['map'](_0x4b680c[_0x800b('0x4f')],function(_0x3b5279){return _0x3b5279;});var _0x1a5c6f=_[_0x800b('0xe0')](_0x435b0d)[0x0];var _0x155b35=_[_0x800b('0xe1')](_0x1a5c6f,function(_0x460709){return _0x460709;});_0x37c33e=_0x155b35[0x1][_0x53cc76[_0x800b('0xdf')]];}var _0x895c26={'from':_0x56f939['email'],'firstName':_0x56f939[_0x800b('0x9b')],'lastName':_0x56f939[_0x800b('0x9c')],'mapKey':'email','message':{'from':_0x56f939[_0x800b('0xdb')],'to':_0x53cc76[_0x800b('0xd3')][_0x800b('0xdb')],'cc':'','subject':_['isNil'](_0x37c33e)?_0x53cc76[_0x800b('0xdd')]:_0x37c33e,'messageId':'','sentAt':new Date(),'attach':_0x3538ef[_0x800b('0x3a')],'attachments':_0x3538ef,'originChannel':'Chat','ChatWebsiteId':_0x53cc76['id'],'ChatOfflineMessageId':_0x10b52d['id'],'originTo':_0x53cc76[_0x800b('0xd3')][_0x800b('0xdb')]},'body':_0x10b52d[_0x800b('0x4f')]};var _0x106dd6={'account':{'id':_0x53cc76[_0x800b('0xde')]},'body':_0x895c26,'log':'NotifyMailAccount'};return respondWithRpcPromise(_0x800b('0xe2'),_0x800b('0xe3'),_0x106dd6,client9001)['then'](function(){return _0x10b52d;})[_0x800b('0x48')](function(_0x4c3435){logger['error'](_0x4c3435);});}return;})['then'](function(){if(_0x10b52d){return _0x10b52d;}})[_0x800b('0x16')](respondWithResult(_0x366fe9,null))[_0x800b('0x48')](function(_0x3175a7){logger[_0x800b('0x1b')]('catch',_0x3175a7);for(var _0x35d5db of _0x27a628){var _0x49f18b=path[_0x800b('0x6f')](config[_0x800b('0x6a')],'server',_0x800b('0xbc'),'attachments',_0x800b('0xcd'),_0x35d5db['filename']);fs_extra['remove'](_0x49f18b)[_0x800b('0x48')](function(_0x453c2e){logger['error']('Could\x20not\x20remove\x20attachment\x20file',_0x49f18b,_0x453c2e);});}});};exports[_0x800b('0xe4')]=function(_0x35424d,_0x3c4c51){return db['ChatInteraction'][_0x800b('0x52')]({'where':{'id':_0x35424d[_0x800b('0x49')]['id']}})[_0x800b('0x16')](handleEntityNotFound(_0x3c4c51,null))[_0x800b('0x16')](function(_0x3d823f){if(_0x3d823f){return _0x3d823f[_0x800b('0xe4')](_0x35424d[_0x800b('0x4f')][_0x800b('0x5c')],_[_0x800b('0xe5')](_0x35424d[_0x800b('0x4f')],[_0x800b('0x5c'),'id'])||{});}})['then'](respondWithResult(_0x3c4c51,null))['catch'](handleError(_0x3c4c51,null));};exports[_0x800b('0xe6')]=function(_0x53de7f,_0x2b2ded){var _0x164164={'raw':![],'where':{}};var _0x4e1c21={};var _0x6c616={'count':0x0,'rows':[]};return db[_0x800b('0x30')]['findOne']({'where':{'id':_0x53de7f['params']['id']}})['then'](handleEntityNotFound(_0x2b2ded,null))[_0x800b('0x16')](function(_0xe674b7){if(_0xe674b7){_0x4e1c21['model']=_[_0x800b('0x4b')](db['ChatInteraction'][_0x800b('0x31')]);_0x4e1c21[_0x800b('0x35')]=_[_0x800b('0x4b')](_0x53de7f[_0x800b('0x35')]);_0x4e1c21['filters']=_[_0x800b('0x37')](_0x4e1c21[_0x800b('0x34')],_0x4e1c21[_0x800b('0x35')]);_0x164164[_0x800b('0x39')]=_[_0x800b('0x37')](_0x4e1c21[_0x800b('0x34')],qs[_0x800b('0x38')](_0x53de7f[_0x800b('0x35')][_0x800b('0x38')]));_0x164164['attributes']=_0x164164[_0x800b('0x39')][_0x800b('0x3a')]?_0x164164[_0x800b('0x39')]:_0x4e1c21[_0x800b('0x34')];if(!_0x53de7f[_0x800b('0x35')]['hasOwnProperty'](_0x800b('0x3c'))){_0x164164['limit']=qs['limit'](_0x53de7f['query'][_0x800b('0x3d')]);_0x164164['offset']=qs[_0x800b('0x23')](_0x53de7f[_0x800b('0x35')][_0x800b('0x23')]);}_0x164164[_0x800b('0x3e')]=qs[_0x800b('0x3f')](_0x53de7f[_0x800b('0x35')]['sort']);_0x164164[_0x800b('0x40')]=qs['filters'](_[_0x800b('0x41')](_0x53de7f[_0x800b('0x35')],_0x4e1c21['filters']));_0x164164[_0x800b('0x40')][_0x800b('0x57')]=_0xe674b7['id'];if(_0x53de7f[_0x800b('0x35')][_0x800b('0x42')]){_0x164164[_0x800b('0x40')]=_[_0x800b('0x43')](_0x164164[_0x800b('0x40')],{'$or':_[_0x800b('0x44')](_0x164164['attributes'],function(_0xadbc1c){var _0x57bea8={};_0x57bea8[_0xadbc1c]={'$like':'%'+_0x53de7f[_0x800b('0x35')][_0x800b('0x42')]+'%'};return _0x57bea8;})});}_0x164164=_[_0x800b('0x43')]({},_0x164164,_0x53de7f[_0x800b('0x60')]);return db[_0x800b('0xa8')]['count']({'where':_0x164164[_0x800b('0x40')]})[_0x800b('0x16')](function(_0x1d4e07){_0x6c616[_0x800b('0x25')]=_0x1d4e07;if(_0x53de7f[_0x800b('0x35')]['includeAll']){_0x164164[_0x800b('0x4d')]=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0x800b('0xb4')],'as':_0x800b('0xe7'),'attributes':[_0x800b('0x2d'),'fullname','internal'],'required':![]},{'model':db[_0x800b('0xe8')],'as':_0x800b('0xe9'),'attributes':['id',_0x800b('0x2d'),_0x800b('0xea')],'where':_0x53de7f['query'][_0x800b('0xeb')]?{'id':_0x53de7f[_0x800b('0x35')]['tag']}:undefined,'required':_0x53de7f[_0x800b('0x35')][_0x800b('0xeb')]?!![]:![]}];}return db[_0x800b('0xa8')][_0x800b('0x5a')](_0x164164);})[_0x800b('0x16')](function(_0x11dd48){_0x6c616[_0x800b('0x47')]=_0x11dd48;return _0x6c616;});}})[_0x800b('0x16')](respondWithFilteredResult(_0x2b2ded,_0x164164))[_0x800b('0x48')](handleError(_0x2b2ded,null));};function iftimePromise(_0x31cb03,_0x537cab){return respondWithRpcPromise('Command',_0x800b('0xec'),{'command':_0x537cab[_0x800b('0xed')]?util['format'](_0x800b('0xee'),_0x31cb03[_0x800b('0xef')],_0x537cab[_0x800b('0xed')]):util[_0x800b('0xa0')](_0x800b('0xf0'),_0x31cb03[_0x800b('0xef')])},client9002)[_0x800b('0x16')](function(_0x578892){var _0x476d90=_0x578892&&_0x578892['indexOf'](_0x800b('0xf1'))>=0x0?!![]:![];logger[_0x800b('0x17')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x537cab['id'],_0x31cb03['id'],_0x31cb03['interval'],_0x476d90?_0x800b('0xf2'):_0x800b('0xf3'),_0x537cab[_0x800b('0xed')]?_0x537cab['timezone']:_0x800b('0xf4'));return _0x476d90;})['catch'](function(_0x5b51b9){logger[_0x800b('0x1b')](_0x800b('0xf5'),_0x537cab['id'],_0x31cb03['id'],_0x31cb03[_0x800b('0xef')],util[_0x800b('0xf6')](_0x5b51b9,{'showHidden':![],'depth':null}),_0x537cab['timezone']?_0x537cab[_0x800b('0xed')]:_0x800b('0xf4'));return![];});}exports[_0x800b('0xec')]=function(_0x6113f7,_0x593408){var _0x5e6064=0x0;var _0x319f5d=0x0;var _0x1c5a0f=![];var _0x5a677f;var _0x504b94;return db[_0x800b('0x30')][_0x800b('0x52')]({'where':{'id':_0x6113f7[_0x800b('0x49')]['id']},'include':[{'model':db[_0x800b('0xf7')],'as':'Interval','include':[{'model':db['Interval'],'as':_0x800b('0xf8'),'attributes':['id',_0x800b('0xef')],'raw':!![]}]}]})[_0x800b('0x16')](handleEntityNotFound(_0x593408,null))[_0x800b('0x16')](function(_0x588e6c){if(_0x588e6c){_0x5a677f=_0x588e6c;return _0x588e6c[_0x800b('0xf9')]({'raw':!![]});}})[_0x800b('0x16')](function(_0x1db454){if(_0x5a677f){if(_0x1db454){_0x504b94=_0x1db454;}}return require(_0x800b('0x6c'))[_0x800b('0x6d')]();})['then'](function(_0x3e4e68){if(_0x3e4e68){_0x319f5d=_0x3e4e68[_0x800b('0xfa')];_0x1c5a0f=_0x3e4e68['custom'];}})[_0x800b('0x16')](function(){return db[_0x800b('0xa8')]['count']({'where':{'closed':![]}});})[_0x800b('0x16')](function(_0x1d0e75){_0x5e6064=_0x1d0e75;if(_0x319f5d&&_0x1d0e75>_0x319f5d){return db[_0x800b('0xfb')][_0x800b('0x59')]({'where':{'id':0x1}})[_0x800b('0x16')](function(_0x16e7f2){if(_0x16e7f2){_0x16e7f2[_0x800b('0xfc')](_0x800b('0xfd'));}});}})[_0x800b('0x16')](function(){if(_0x5a677f[_0x800b('0xf7')]&&_0x5a677f[_0x800b('0xf7')][_0x800b('0xf8')]){var _0x554d34=[];for(var _0x3c0888=0x0;_0x3c0888<_0x5a677f[_0x800b('0xf7')]['Intervals'][_0x800b('0x3a')];_0x3c0888++){var _0x28ed30=_0x5a677f['Interval'][_0x800b('0xf8')][_0x3c0888][_0x800b('0x2a')]({'plain':!![]});_0x554d34[_0x800b('0xaf')](iftimePromise(_0x28ed30,_0x5a677f));}return BPromise[_0x800b('0xfe')](_0x554d34)[_0x800b('0x16')](function(_0x7c427f){return _['some'](_0x7c427f);});}else{return!![];}})[_0x800b('0x16')](function(_0x12fa53){var _0x44077c=fs[_0x800b('0xff')](path[_0x800b('0x6f')](config[_0x800b('0x6a')],'server/files/chat/iframe.ejs'),'utf8');var _0x199d52={'remote':_0x5a677f[_0x800b('0x100')],'query':querystring[_0x800b('0x1a')](_[_0x800b('0x43')](_0x5a677f[_0x800b('0x2a')]({'plain':!![]}),{'customerIp':_0x6113f7[_0x800b('0x7d')][_0x800b('0x9a')]||_0x6113f7[_0x800b('0x7d')][_0x800b('0x101')]||_0x6113f7['connection'][_0x800b('0x102')]||_0x6113f7['ip'],'referer':_0x6113f7['headers'][_0x800b('0x9e')],'openedInteractions':_0x5e6064,'maxInteractions':_0x319f5d,'virtual':_0x1c5a0f[_0x800b('0xfa')],'online':_0x12fa53,'custom':_0x1c5a0f}))[_0x800b('0x103')](/'/g,'\x5c\x27')};_0x593408[_0x800b('0x2e')](ejs['render'](Mustache[_0x800b('0xc6')](_0x44077c,_0x199d52),{'proactiveActions':_0x504b94,'alignment':_0x5a677f['alignment'],'verticalAlignment':_0x5a677f['verticalAlignment'],'div_color':_0x5a677f[_0x800b('0xea')],'labelText':_0x5a677f[_0x800b('0x104')],'text_color':_0x5a677f['textColor'],'button_color':_0x5a677f[_0x800b('0x105')],'background_color':_0x5a677f[_0x800b('0x106')],'hideWhenOffline':_0x5a677f['hideWhenOffline'],'interval':_0x5a677f[_0x800b('0x107')]}));})[_0x800b('0x48')](handleError(_0x593408,null));};exports[_0x800b('0x108')]=function(_0x1f213c,_0x4d5288){var _0x353ecc=_0x1f213c['params']['id'];var _0x2e5301=_0x1f213c['body'];var _0x1fed60=0xc8;var _0x5220d7=null;return db[_0x800b('0xd0')][_0x800b('0x109')]({'isolationLevel':db[_0x800b('0xd0')][_0x800b('0x10a')]['ISOLATION_LEVELS'][_0x800b('0x10b')]},function(_0x46d4b6){return db[_0x800b('0x30')]['findOne']({'where':{'id':_0x353ecc},'transaction':_0x46d4b6})[_0x800b('0x16')](function(_0x3af3db){if(_0x3af3db){return db['ChatApplication'][_0x800b('0x29')]({'where':{'ChatWebsiteId':_0x353ecc},'transaction':_0x46d4b6})[_0x800b('0x16')](function(){var _0x19d9d7=_['map'](_0x2e5301,function(_0x3529ee){_0x3529ee[_0x800b('0x57')]=_0x353ecc;return _0x3529ee;});return db[_0x800b('0x8e')]['bulkCreate'](_0x19d9d7,{'transaction':_0x46d4b6});});}else{_0x1fed60=0x194;_0x5220d7=[];}});})[_0x800b('0x16')](function(){if(_0x1fed60!==0x194){return db[_0x800b('0x8e')][_0x800b('0x10c')]({'where':{'ChatWebsiteId':_0x353ecc},'order':_0x800b('0x95')})[_0x800b('0x16')](function(_0x1fbfe5){_0x5220d7=_0x1fbfe5;});}})[_0x800b('0x48')](function(_0x1e36f9){_0x1fed60=0x1f4;logger[_0x800b('0x1b')](_0x1e36f9[_0x800b('0x2c')]);if(_0x1e36f9[_0x800b('0x2d')]){delete _0x1e36f9['name'];}_0x5220d7=_0x1e36f9;})['finally'](function(){if(_0x5220d7===null){_0x4d5288[_0x800b('0x1f')](_0x1fed60);}else{if(_0x1fed60===0x1f4){_0x4d5288[_0x800b('0x20')](_0x1fed60)[_0x800b('0x2e')](_0x5220d7);}else{_0x4d5288['status'](_0x1fed60)[_0x800b('0x22')](_0x5220d7);}}});};exports[_0x800b('0x10d')]=function(_0xde8e90,_0xf0a301){var _0x2bbe9e={};var _0x1786b0={};var _0x341030;var _0x1472a8;return db[_0x800b('0x30')][_0x800b('0x59')]({'where':{'id':_0xde8e90[_0x800b('0x49')]['id']}})[_0x800b('0x16')](handleEntityNotFound(_0xf0a301,null))[_0x800b('0x16')](function(_0xf575a2){if(_0xf575a2){_0x341030=_0xf575a2;_0x1786b0['model']=_['keys'](db[_0x800b('0x8e')][_0x800b('0x31')]);_0x1786b0[_0x800b('0x35')]=_['keys'](_0xde8e90[_0x800b('0x35')]);_0x1786b0[_0x800b('0x36')]=_['intersection'](_0x1786b0[_0x800b('0x34')],_0x1786b0['query']);_0x2bbe9e[_0x800b('0x39')]=_['intersection'](_0x1786b0[_0x800b('0x34')],qs[_0x800b('0x38')](_0xde8e90[_0x800b('0x35')][_0x800b('0x38')]));_0x2bbe9e[_0x800b('0x39')]=_0x2bbe9e[_0x800b('0x39')][_0x800b('0x3a')]?_0x2bbe9e[_0x800b('0x39')]:_0x1786b0[_0x800b('0x34')];_0x2bbe9e[_0x800b('0x3e')]=qs[_0x800b('0x3f')](_0xde8e90[_0x800b('0x35')]['sort']);_0x2bbe9e['where']=qs[_0x800b('0x36')](_[_0x800b('0x41')](_0xde8e90[_0x800b('0x35')],_0x1786b0[_0x800b('0x36')]));if(_0xde8e90[_0x800b('0x35')][_0x800b('0x42')]){_0x2bbe9e[_0x800b('0x40')]=_[_0x800b('0x43')](_0x2bbe9e[_0x800b('0x40')],{'$or':_[_0x800b('0x44')](_0x2bbe9e[_0x800b('0x39')],function(_0x3a9c9c){var _0x3de1fa={};_0x3de1fa[_0x3a9c9c]={'$like':'%'+_0xde8e90[_0x800b('0x35')]['filter']+'%'};return _0x3de1fa;})});}_0x2bbe9e=_[_0x800b('0x43')]({},_0x2bbe9e,_0xde8e90[_0x800b('0x60')]);return _0x341030[_0x800b('0x10d')](_0x2bbe9e);}})[_0x800b('0x16')](function(_0x389f97){if(_0x389f97){_0x1472a8=_0x389f97[_0x800b('0x3a')];if(!_0xde8e90['query'][_0x800b('0x3b')](_0x800b('0x3c'))){_0x2bbe9e[_0x800b('0x3d')]=qs['limit'](_0xde8e90[_0x800b('0x35')][_0x800b('0x3d')]);_0x2bbe9e[_0x800b('0x23')]=qs['offset'](_0xde8e90[_0x800b('0x35')][_0x800b('0x23')]);}return _0x341030['getApplications'](_0x2bbe9e);}})[_0x800b('0x16')](function(_0x64fbd5){if(_0x64fbd5){return _0x64fbd5?{'count':_0x1472a8,'rows':_0x64fbd5}:null;}})[_0x800b('0x16')](respondWithResult(_0xf0a301,null))[_0x800b('0x48')](handleError(_0xf0a301,null));};exports['addProactiveActions']=function(_0x1e99e6,_0xbfbf63){return db[_0x800b('0x10e')]['find']({'where':{'id':_0x1e99e6[_0x800b('0x49')]['id']}})[_0x800b('0x16')](handleEntityNotFound(_0xbfbf63,null))['then'](function(_0x33b434){if(_0x33b434){return _0x33b434['addProactiveActions'](_0x1e99e6['body']['ids'],_[_0x800b('0xe5')](_0x1e99e6[_0x800b('0x4f')],['ids','id'])||{});}})[_0x800b('0x16')](respondWithResult(_0xbfbf63,null))['catch'](handleError(_0xbfbf63,null));};exports[_0x800b('0xf9')]=function(_0x7d912,_0x4346a5){var _0x1708f8={};var _0x47e662={};var _0x464897;var _0x588e41;return db['ChatWebsite']['findOne']({'where':{'id':_0x7d912['params']['id']}})[_0x800b('0x16')](handleEntityNotFound(_0x4346a5,null))['then'](function(_0x31dc89){if(_0x31dc89){_0x464897=_0x31dc89;_0x47e662['model']=_[_0x800b('0x4b')](db['ChatProactiveAction']['rawAttributes']);_0x47e662['query']=_[_0x800b('0x4b')](_0x7d912[_0x800b('0x35')]);_0x47e662[_0x800b('0x36')]=_[_0x800b('0x37')](_0x47e662[_0x800b('0x34')],_0x47e662[_0x800b('0x35')]);_0x1708f8[_0x800b('0x39')]=_[_0x800b('0x37')](_0x47e662['model'],qs['fields'](_0x7d912[_0x800b('0x35')][_0x800b('0x38')]));_0x1708f8['attributes']=_0x1708f8[_0x800b('0x39')][_0x800b('0x3a')]?_0x1708f8[_0x800b('0x39')]:_0x47e662[_0x800b('0x34')];_0x1708f8['order']=qs[_0x800b('0x3f')](_0x7d912[_0x800b('0x35')][_0x800b('0x3f')]);_0x1708f8[_0x800b('0x40')]=qs['filters'](_['pick'](_0x7d912['query'],_0x47e662[_0x800b('0x36')]));if(_0x7d912['query'][_0x800b('0x42')]){_0x1708f8[_0x800b('0x40')]=_[_0x800b('0x43')](_0x1708f8[_0x800b('0x40')],{'$or':_[_0x800b('0x44')](_0x1708f8['attributes'],function(_0x41c20e){var _0x2af076={};_0x2af076[_0x41c20e]={'$like':'%'+_0x7d912[_0x800b('0x35')][_0x800b('0x42')]+'%'};return _0x2af076;})});}_0x1708f8=_[_0x800b('0x43')]({},_0x1708f8,_0x7d912[_0x800b('0x60')]);return _0x464897['getProactiveActions'](_0x1708f8);}})[_0x800b('0x16')](function(_0x1c4138){if(_0x1c4138){_0x588e41=_0x1c4138[_0x800b('0x3a')];if(!_0x7d912[_0x800b('0x35')][_0x800b('0x3b')](_0x800b('0x3c'))){_0x1708f8['limit']=qs[_0x800b('0x3d')](_0x7d912[_0x800b('0x35')]['limit']);_0x1708f8['offset']=qs[_0x800b('0x23')](_0x7d912[_0x800b('0x35')][_0x800b('0x23')]);}return _0x464897['getProactiveActions'](_0x1708f8);}})[_0x800b('0x16')](function(_0x27b428){if(_0x27b428){return _0x27b428?{'count':_0x588e41,'rows':_0x27b428}:null;}})[_0x800b('0x16')](respondWithResult(_0x4346a5,null))[_0x800b('0x48')](handleError(_0x4346a5,null));};exports['getFields']=function(_0x156804,_0x2f8253){var _0x5c5f70=_0x156804['query'][_0x800b('0x10f')]===_0x800b('0x110')?'offlineForm':_0x800b('0x111');return db['ChatWebsite'][_0x800b('0x52')]({'attributes':['id',_0x5c5f70],'where':{'id':_0x156804[_0x800b('0x49')]['id']}})[_0x800b('0x16')](handleEntityNotFound(_0x2f8253,null))[_0x800b('0x16')](function(_0x516777){if(_0x516777){var _0x15e5f0=_0x516777[_0x5c5f70];var _0x45385d=_0x15e5f0&&_0x15e5f0[_0x800b('0x112')]?_0x15e5f0['items']:[];_0x2f8253[_0x800b('0x2e')]({'fromKey':_['isNil'](_0x15e5f0['fromKey'])?undefined:_0x15e5f0[_0x800b('0x113')],'count':_0x45385d[_0x800b('0x3a')],'rows':_0x45385d});}})[_0x800b('0x48')](handleError(_0x2f8253,null));};exports[_0x800b('0x114')]=function(_0x527ede,_0x1c9860){var _0x102f61={'raw':![],'where':{}};var _0x1dcd7a={};var _0x1e5e34={'count':0x0,'rows':[]};return db[_0x800b('0x30')]['findOne']({'where':{'id':_0x527ede[_0x800b('0x49')]['id']}})['then'](handleEntityNotFound(_0x1c9860,null))[_0x800b('0x16')](function(_0x309b52){if(_0x309b52){_0x1dcd7a[_0x800b('0x34')]=_[_0x800b('0x4b')](db[_0x800b('0x115')]['rawAttributes']);_0x1dcd7a[_0x800b('0x35')]=_[_0x800b('0x4b')](_0x527ede[_0x800b('0x35')]);_0x1dcd7a[_0x800b('0x36')]=_['intersection'](_0x1dcd7a[_0x800b('0x34')],_0x1dcd7a[_0x800b('0x35')]);_0x102f61['attributes']=_[_0x800b('0x37')](_0x1dcd7a[_0x800b('0x34')],qs[_0x800b('0x38')](_0x527ede[_0x800b('0x35')]['fields']));_0x102f61['attributes']=_0x102f61['attributes'][_0x800b('0x3a')]?_0x102f61[_0x800b('0x39')]:_0x1dcd7a[_0x800b('0x34')];if(!_0x527ede[_0x800b('0x35')][_0x800b('0x3b')](_0x800b('0x3c'))){_0x102f61['limit']=qs['limit'](_0x527ede[_0x800b('0x35')]['limit']);_0x102f61[_0x800b('0x23')]=qs[_0x800b('0x23')](_0x527ede[_0x800b('0x35')][_0x800b('0x23')]);}_0x102f61[_0x800b('0x3e')]=qs[_0x800b('0x3f')](_0x527ede['query'][_0x800b('0x3f')]);_0x102f61[_0x800b('0x40')]=qs[_0x800b('0x36')](_['pick'](_0x527ede['query'],_0x1dcd7a[_0x800b('0x36')]));_0x102f61[_0x800b('0x40')]['ChatWebsiteId']=_0x309b52['id'];if(_0x527ede['query']['filter']){_0x102f61[_0x800b('0x40')]=_[_0x800b('0x43')](_0x102f61[_0x800b('0x40')],{'$or':_['map'](_0x102f61[_0x800b('0x39')],function(_0xc5e418){var _0x3c9ec7={};_0x3c9ec7[_0xc5e418]={'$like':'%'+_0x527ede['query'][_0x800b('0x42')]+'%'};return _0x3c9ec7;})});}_0x102f61=_[_0x800b('0x43')]({},_0x102f61,_0x527ede[_0x800b('0x60')]);return db[_0x800b('0x115')][_0x800b('0x25')]({'where':_0x102f61[_0x800b('0x40')]})[_0x800b('0x16')](function(_0x558f51){_0x1e5e34[_0x800b('0x25')]=_0x558f51;if(_0x527ede[_0x800b('0x35')][_0x800b('0x4c')]){_0x102f61[_0x800b('0x4d')]=[{'all':!![]}];}else{_0x102f61['include']=[{'model':db[_0x800b('0x7f')],'as':_0x800b('0x116'),'required':![]},{'model':db[_0x800b('0xd1')],'as':_0x800b('0x117'),'required':![]}];}return db[_0x800b('0x115')][_0x800b('0x5a')](_0x102f61);})['then'](function(_0x5dce72){_0x1e5e34[_0x800b('0x47')]=_0x5dce72;return _0x1e5e34;});}})['then'](respondWithFilteredResult(_0x1c9860,_0x102f61))[_0x800b('0x48')](handleError(_0x1c9860,null));};exports[_0x800b('0x118')]=function(_0x4e615b,_0x205bb7){return db[_0x800b('0x30')]['find']({'where':{'id':_0x4e615b[_0x800b('0x49')]['id']}})['then'](handleEntityNotFound(_0x205bb7,null))[_0x800b('0x16')](function(_0x125970){if(_0x125970){return _0x125970[_0x800b('0x118')](_0x4e615b[_0x800b('0x4f')][_0x800b('0x5c')],_[_0x800b('0xe5')](_0x4e615b[_0x800b('0x4f')],['ids','id'])||{})[_0x800b('0xab')](function(_0xd974c5){for(var _0x40d1a2=0x0;_0x40d1a2<_0x4e615b[_0x800b('0x4f')]['ids'][_0x800b('0x3a')];_0x40d1a2+=0x1){socket['emit']('userChatWebsite:save',{'UserId':Number(_0x4e615b['body'][_0x800b('0x5c')][_0x40d1a2]),'ChatWebsiteId':Number(_0x4e615b[_0x800b('0x49')]['id'])});}return _0xd974c5;});}})[_0x800b('0x16')](respondWithResult(_0x205bb7,null))[_0x800b('0x48')](handleError(_0x205bb7,null));};exports[_0x800b('0x119')]=function(_0x372429,_0xaa5ee5){return db['ChatWebsite'][_0x800b('0x52')]({'where':{'id':_0x372429[_0x800b('0x49')]['id']}})[_0x800b('0x16')](handleEntityNotFound(_0xaa5ee5,null))[_0x800b('0x16')](function(_0x272535){if(_0x272535){return _0x272535[_0x800b('0x119')](_0x372429[_0x800b('0x35')][_0x800b('0x5c')])['then'](function(){if(_[_0x800b('0x11a')](_0x372429['query'][_0x800b('0x5c')])){for(var _0x3ee256=0x0;_0x3ee256<_0x372429['query'][_0x800b('0x5c')][_0x800b('0x3a')];_0x3ee256+=0x1){socket[_0x800b('0x11b')](_0x800b('0x11c'),{'UserId':Number(_0x372429[_0x800b('0x35')][_0x800b('0x5c')][_0x3ee256]),'ChatWebsiteId':Number(_0x372429[_0x800b('0x49')]['id'])});}}else{socket[_0x800b('0x11b')](_0x800b('0x11c'),{'UserId':Number(_0x372429['query'][_0x800b('0x5c')]),'ChatWebsiteId':Number(_0x372429[_0x800b('0x49')]['id'])});}});}})[_0x800b('0x16')](respondWithStatusCode(_0xaa5ee5,null))['catch'](handleError(_0xaa5ee5,null));};exports[_0x800b('0x11d')]=function(_0x55c699,_0x337e8e){var _0x437c59={};var _0x171303={};var _0x3056d9;var _0x290889;return db[_0x800b('0x30')]['findOne']({'where':{'id':_0x55c699['params']['id']}})['then'](handleEntityNotFound(_0x337e8e,null))[_0x800b('0x16')](function(_0x20f8c8){if(_0x20f8c8){_0x3056d9=_0x20f8c8;_0x171303['model']=_[_0x800b('0x4b')](db['User'][_0x800b('0x31')]);_0x171303[_0x800b('0x35')]=_[_0x800b('0x4b')](_0x55c699[_0x800b('0x35')]);_0x171303['filters']=_[_0x800b('0x37')](_0x171303[_0x800b('0x34')],_0x171303['query']);_0x437c59[_0x800b('0x39')]=_[_0x800b('0x37')](_0x171303[_0x800b('0x34')],qs[_0x800b('0x38')](_0x55c699[_0x800b('0x35')][_0x800b('0x38')]));_0x437c59[_0x800b('0x39')]=_0x437c59[_0x800b('0x39')][_0x800b('0x3a')]?_0x437c59[_0x800b('0x39')]:_0x171303[_0x800b('0x34')];_0x437c59['order']=qs[_0x800b('0x3f')](_0x55c699[_0x800b('0x35')][_0x800b('0x3f')]);_0x437c59['where']=qs[_0x800b('0x36')](_[_0x800b('0x41')](_0x55c699[_0x800b('0x35')],_0x171303[_0x800b('0x36')]));if(_0x55c699['query'][_0x800b('0x42')]){_0x437c59[_0x800b('0x40')]=_[_0x800b('0x43')](_0x437c59['where'],{'$or':_[_0x800b('0x44')](_0x437c59[_0x800b('0x39')],function(_0x4e7d4f){var _0x5e60ad={};_0x5e60ad[_0x4e7d4f]={'$like':'%'+_0x55c699[_0x800b('0x35')][_0x800b('0x42')]+'%'};return _0x5e60ad;})});}_0x437c59=_[_0x800b('0x43')]({},_0x437c59,_0x55c699[_0x800b('0x60')]);return _0x3056d9[_0x800b('0x11d')](_0x437c59);}})[_0x800b('0x16')](function(_0x59224d){if(_0x59224d){_0x290889=_0x59224d[_0x800b('0x3a')];if(!_0x55c699['query'][_0x800b('0x3b')](_0x800b('0x3c'))){_0x437c59['limit']=qs[_0x800b('0x3d')](_0x55c699[_0x800b('0x35')][_0x800b('0x3d')]);_0x437c59['offset']=qs['offset'](_0x55c699[_0x800b('0x35')][_0x800b('0x23')]);}return _0x3056d9[_0x800b('0x11d')](_0x437c59);}})[_0x800b('0x16')](function(_0x1c7f7e){if(_0x1c7f7e){return _0x1c7f7e?{'count':_0x290889,'rows':_0x1c7f7e}:null;}})['then'](respondWithResult(_0x337e8e,null))[_0x800b('0x48')](handleError(_0x337e8e,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 2214626..7dbeff7 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 _0xba6c=['remove','emit','hasOwnProperty','hook','exports','events','ChatWebsite','setMaxListeners','save','update'];(function(_0x40001a,_0x57f2ae){var _0x4cec45=function(_0x5e4166){while(--_0x5e4166){_0x40001a['push'](_0x40001a['shift']());}};_0x4cec45(++_0x57f2ae);}(_0xba6c,0x113));var _0xcba6=function(_0x5a9c0c,_0x4ec485){_0x5a9c0c=_0x5a9c0c-0x0;var _0x53c77d=_0xba6c[_0x5a9c0c];return _0x53c77d;};'use strict';var EventEmitter=require(_0xcba6('0x0'));var ChatWebsite=require('../../mysqldb')['db'][_0xcba6('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xcba6('0x2')](0x0);var events={'afterCreate':_0xcba6('0x3'),'afterUpdate':_0xcba6('0x4'),'afterDestroy':_0xcba6('0x5')};function emitEvent(_0x3e9fb9){return function(_0x2b34a3,_0x5c911d,_0x57b9b2){ChatWebsiteEvents[_0xcba6('0x6')](_0x3e9fb9+':'+_0x2b34a3['id'],_0x2b34a3);ChatWebsiteEvents[_0xcba6('0x6')](_0x3e9fb9,_0x2b34a3);_0x57b9b2(null);};}for(var e in events){if(events[_0xcba6('0x7')](e)){var event=events[e];ChatWebsite[_0xcba6('0x8')](e,emitEvent(event));}}module[_0xcba6('0x9')]=ChatWebsiteEvents; \ No newline at end of file +var _0xd5b2=['update','remove','hasOwnProperty','exports','../../mysqldb','ChatWebsite','save'];(function(_0x29afc6,_0x37118f){var _0x23fb71=function(_0x2f435c){while(--_0x2f435c){_0x29afc6['push'](_0x29afc6['shift']());}};_0x23fb71(++_0x37118f);}(_0xd5b2,0x10e));var _0x2d5b=function(_0x24061a,_0x1c9f4d){_0x24061a=_0x24061a-0x0;var _0x82054e=_0xd5b2[_0x24061a];return _0x82054e;};'use strict';var EventEmitter=require('events');var ChatWebsite=require(_0x2d5b('0x0'))['db'][_0x2d5b('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2d5b('0x2'),'afterUpdate':_0x2d5b('0x3'),'afterDestroy':_0x2d5b('0x4')};function emitEvent(_0x2846a3){return function(_0x5c31d3,_0x39ef3,_0x4f4491){ChatWebsiteEvents['emit'](_0x2846a3+':'+_0x5c31d3['id'],_0x5c31d3);ChatWebsiteEvents['emit'](_0x2846a3,_0x5c31d3);_0x4f4491(null);};}for(var e in events){if(events[_0x2d5b('0x5')](e)){var event=events[e];ChatWebsite['hook'](e,emitEvent(event));}}module[_0x2d5b('0x6')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 35d913e..28c0ff2 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 _0xb451=['request-promise','path','rimraf','../../config/environment','./chatWebsite.attributes','exports','define','ChatWebsite','lodash','../../config/logger','api','moment','bluebird'];(function(_0x4a67ae,_0x50a957){var _0x37f94a=function(_0x10b491){while(--_0x10b491){_0x4a67ae['push'](_0x4a67ae['shift']());}};_0x37f94a(++_0x50a957);}(_0xb451,0x119));var _0x1b45=function(_0x382e89,_0x4768c0){_0x382e89=_0x382e89-0x0;var _0x3a1318=_0xb451[_0x382e89];return _0x3a1318;};'use strict';var _=require(_0x1b45('0x0'));var util=require('util');var logger=require(_0x1b45('0x1'))(_0x1b45('0x2'));var moment=require(_0x1b45('0x3'));var BPromise=require(_0x1b45('0x4'));var rp=require(_0x1b45('0x5'));var fs=require('fs');var path=require(_0x1b45('0x6'));var rimraf=require(_0x1b45('0x7'));var config=require(_0x1b45('0x8'));var attributes=require(_0x1b45('0x9'));module[_0x1b45('0xa')]=function(_0x5581da,_0x19c8b5){return _0x5581da[_0x1b45('0xb')](_0x1b45('0xc'),attributes,{'tableName':'chat_websites','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2912=['ChatWebsite','chat_websites','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','define'];(function(_0x5cda82,_0x9b5ed5){var _0x2115c3=function(_0x4f0126){while(--_0x4f0126){_0x5cda82['push'](_0x5cda82['shift']());}};_0x2115c3(++_0x9b5ed5);}(_0x2912,0xac));var _0x2291=function(_0x32e717,_0x303a61){_0x32e717=_0x32e717-0x0;var _0xb3c72=_0x2912[_0x32e717];return _0xb3c72;};'use strict';var _=require('lodash');var util=require(_0x2291('0x0'));var logger=require(_0x2291('0x1'))(_0x2291('0x2'));var moment=require(_0x2291('0x3'));var BPromise=require('bluebird');var rp=require(_0x2291('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2291('0x5'));var config=require(_0x2291('0x6'));var attributes=require('./chatWebsite.attributes');module['exports']=function(_0x1167fd,_0x545468){return _0x1167fd[_0x2291('0x7')](_0x2291('0x8'),attributes,{'tableName':_0x2291('0x9'),'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 0bdfbaf..ca69290 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 _0x77e1=['./chatWebsite.socket','register','request','then','ChatWebsite,\x20%s,\x20%s','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter'];(function(_0x5b7f04,_0x4b5ff8){var _0x580493=function(_0x4ee188){while(--_0x4ee188){_0x5b7f04['push'](_0x5b7f04['shift']());}};_0x580493(++_0x4b5ff8);}(_0x77e1,0xe4));var _0x177e=function(_0x17019d,_0x4c6c3c){_0x17019d=_0x17019d-0x0;var _0x14c24c=_0x77e1[_0x17019d];return _0x14c24c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x177e('0x0'));var BPromise=require('bluebird');var rs=require(_0x177e('0x1'));var fs=require('fs');var Redis=require(_0x177e('0x2'));var db=require(_0x177e('0x3'))['db'];var utils=require(_0x177e('0x4'));var logger=require(_0x177e('0x5'))('rpc');var config=require(_0x177e('0x6'));var jayson=require(_0x177e('0x7'));var client=jayson['client'][_0x177e('0x8')]({'port':0x232a});config[_0x177e('0x9')]=_['defaults'](config['redis'],{'host':_0x177e('0xa'),'port':0x18eb});var socket=require(_0x177e('0xb'))(new Redis(config[_0x177e('0x9')]));require(_0x177e('0xc'))[_0x177e('0xd')](socket);function respondWithRpcPromise(_0x5a686f,_0x455330,_0x1fc0e9){return new BPromise(function(_0x8d6d68,_0x1f7d16){return client[_0x177e('0xe')](_0x5a686f,_0x1fc0e9)[_0x177e('0xf')](function(_0x285e45){logger['info'](_0x177e('0x10'),_0x455330,'request\x20sent');logger[_0x177e('0x11')](_0x177e('0x12'),_0x455330,_0x177e('0x13'),JSON[_0x177e('0x14')](_0x285e45));if(_0x285e45[_0x177e('0x15')]){if(_0x285e45['error']['code']===0x1f4){logger[_0x177e('0x15')](_0x177e('0x10'),_0x455330,_0x285e45[_0x177e('0x15')][_0x177e('0x16')]);return _0x1f7d16(_0x285e45[_0x177e('0x15')][_0x177e('0x16')]);}logger[_0x177e('0x15')](_0x177e('0x10'),_0x455330,_0x285e45[_0x177e('0x15')][_0x177e('0x16')]);return _0x8d6d68(_0x285e45[_0x177e('0x15')][_0x177e('0x16')]);}else{logger['info'](_0x177e('0x10'),_0x455330,_0x177e('0x13'));_0x8d6d68(_0x285e45[_0x177e('0x17')][_0x177e('0x16')]);}})['catch'](function(_0x5a1a9c){logger[_0x177e('0x15')](_0x177e('0x10'),_0x455330,_0x5a1a9c);_0x1f7d16(_0x5a1a9c);});});} \ No newline at end of file +var _0x0c38=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','redis','defaults','localhost','./chatWebsite.socket','register','request','info','ChatWebsite,\x20%s,\x20%s','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result'];(function(_0x1ae78f,_0x122ed2){var _0x5baf80=function(_0x28a303){while(--_0x28a303){_0x1ae78f['push'](_0x1ae78f['shift']());}};_0x5baf80(++_0x122ed2);}(_0x0c38,0x145));var _0x80c3=function(_0x56aba9,_0x1f0f43){_0x56aba9=_0x56aba9-0x0;var _0x5746a0=_0x0c38[_0x56aba9];return _0x5746a0;};'use strict';var _=require(_0x80c3('0x0'));var util=require(_0x80c3('0x1'));var moment=require(_0x80c3('0x2'));var BPromise=require(_0x80c3('0x3'));var rs=require(_0x80c3('0x4'));var fs=require('fs');var Redis=require(_0x80c3('0x5'));var db=require(_0x80c3('0x6'))['db'];var utils=require(_0x80c3('0x7'));var logger=require(_0x80c3('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x80c3('0x9'));var client=jayson['client'][_0x80c3('0xa')]({'port':0x232a});config[_0x80c3('0xb')]=_[_0x80c3('0xc')](config[_0x80c3('0xb')],{'host':_0x80c3('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x80c3('0xe'))[_0x80c3('0xf')](socket);function respondWithRpcPromise(_0x106a93,_0x50716e,_0x550454){return new BPromise(function(_0x48bf81,_0x1ed6e0){return client[_0x80c3('0x10')](_0x106a93,_0x550454)['then'](function(_0x59b701){logger[_0x80c3('0x11')](_0x80c3('0x12'),_0x50716e,'request\x20sent');logger[_0x80c3('0x13')](_0x80c3('0x14'),_0x50716e,_0x80c3('0x15'),JSON['stringify'](_0x59b701));if(_0x59b701[_0x80c3('0x16')]){if(_0x59b701['error'][_0x80c3('0x17')]===0x1f4){logger[_0x80c3('0x16')](_0x80c3('0x12'),_0x50716e,_0x59b701['error'][_0x80c3('0x18')]);return _0x1ed6e0(_0x59b701[_0x80c3('0x16')][_0x80c3('0x18')]);}logger[_0x80c3('0x16')](_0x80c3('0x12'),_0x50716e,_0x59b701[_0x80c3('0x16')]['message']);return _0x48bf81(_0x59b701[_0x80c3('0x16')][_0x80c3('0x18')]);}else{logger[_0x80c3('0x11')](_0x80c3('0x12'),_0x50716e,_0x80c3('0x15'));_0x48bf81(_0x59b701[_0x80c3('0x19')][_0x80c3('0x18')]);}})[_0x80c3('0x1a')](function(_0x5a4771){logger[_0x80c3('0x16')]('ChatWebsite,\x20%s,\x20%s',_0x50716e,_0x5a4771);_0x1ed6e0(_0x5a4771);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index ec1cba8..4f674a9 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 _0xcd53=['register','length','chatWebsite:','./chatWebsite.events','save','update','emit'];(function(_0x4d6dec,_0xd3abf3){var _0x343485=function(_0x2b627a){while(--_0x2b627a){_0x4d6dec['push'](_0x4d6dec['shift']());}};_0x343485(++_0xd3abf3);}(_0xcd53,0x106));var _0x3cd5=function(_0x575b72,_0x1a7eb1){_0x575b72=_0x575b72-0x0;var _0x561c57=_0xcd53[_0x575b72];return _0x561c57;};'use strict';var ChatWebsiteEvents=require(_0x3cd5('0x0'));var events=[_0x3cd5('0x1'),'remove',_0x3cd5('0x2')];function createListener(_0x109b75,_0x1fb9fb){return function(_0x20b65c){_0x1fb9fb[_0x3cd5('0x3')](_0x109b75,_0x20b65c);};}function removeListener(_0x49513d,_0x26490d){return function(){ChatWebsiteEvents['removeListener'](_0x49513d,_0x26490d);};}exports[_0x3cd5('0x4')]=function(_0x352fb6){for(var _0x540e80=0x0,_0x2e18b7=events[_0x3cd5('0x5')];_0x540e80<_0x2e18b7;_0x540e80++){var _0x3860e0=events[_0x540e80];var _0x59f84f=createListener(_0x3cd5('0x6')+_0x3860e0,_0x352fb6);ChatWebsiteEvents['on'](_0x3860e0,_0x59f84f);}}; \ No newline at end of file +var _0x652f=['register','chatWebsite:','./chatWebsite.events','save','remove','emit','removeListener'];(function(_0x83af7f,_0x49c6fd){var _0x32d85c=function(_0xf0e8bc){while(--_0xf0e8bc){_0x83af7f['push'](_0x83af7f['shift']());}};_0x32d85c(++_0x49c6fd);}(_0x652f,0x1c9));var _0xf652=function(_0x1c28e6,_0x2e3710){_0x1c28e6=_0x1c28e6-0x0;var _0x6727cb=_0x652f[_0x1c28e6];return _0x6727cb;};'use strict';var ChatWebsiteEvents=require(_0xf652('0x0'));var events=[_0xf652('0x1'),_0xf652('0x2'),'update'];function createListener(_0x35bbdb,_0x1d0be3){return function(_0x10d5b5){_0x1d0be3[_0xf652('0x3')](_0x35bbdb,_0x10d5b5);};}function removeListener(_0x578a0b,_0x582c85){return function(){ChatWebsiteEvents[_0xf652('0x4')](_0x578a0b,_0x582c85);};}exports[_0xf652('0x5')]=function(_0x2e7353){for(var _0x38f765=0x0,_0x105092=events['length'];_0x38f765<_0x105092;_0x38f765++){var _0xfc3733=events[_0x38f765];var _0x117741=createListener(_0xf652('0x6')+_0xfc3733,_0x2e7353);ChatWebsiteEvents['on'](_0xfc3733,_0x117741);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 111642a..97748fc 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 _0x2c52=['addAgents','put','update','delete','destroy','removeDispositions','removeAgents','multer','util','connect-timeout','express','fs-extra','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','describe','/:id','/:id/canned_answers','/:id/logo','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','/:id/system_avatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','/:id/dispositions','addDisposition','addAnswer','diskStorage','root','now','single','join','server/files/images/avatars/','format','%s-%s','file','addCustomerAvatar','originalname','notify','server/files','attachments','offline-chat','replace','extname','/:id/offline','offline','addInteraction','addApplications','addProactiveActions'];(function(_0x2c47ad,_0x41c0d8){var _0x3ae667=function(_0x2ea183){while(--_0x2ea183){_0x2c47ad['push'](_0x2c47ad['shift']());}};_0x3ae667(++_0x41c0d8);}(_0x2c52,0xca));var _0x22c5=function(_0x543371,_0xea894){_0x543371=_0x543371-0x0;var _0x2e0303=_0x2c52[_0x543371];return _0x2e0303;};'use strict';var multer=require(_0x22c5('0x0'));var util=require(_0x22c5('0x1'));var path=require('path');var timeout=require(_0x22c5('0x2'));var express=require(_0x22c5('0x3'));var router=express['Router']();var fs_extra=require(_0x22c5('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x22c5('0x5'));var controller=require(_0x22c5('0x6'));router[_0x22c5('0x7')]('/',auth[_0x22c5('0x8')](),controller[_0x22c5('0x9')]);router[_0x22c5('0x7')]('/describe',auth[_0x22c5('0x8')](),controller[_0x22c5('0xa')]);router[_0x22c5('0x7')](_0x22c5('0xb'),auth['isAuthenticated'](),controller['show']);router['get']('/:id/dispositions',auth[_0x22c5('0x8')](),controller['getDispositions']);router[_0x22c5('0x7')](_0x22c5('0xc'),auth[_0x22c5('0x8')](),controller['getAnswers']);router[_0x22c5('0x7')](_0x22c5('0xd'),controller[_0x22c5('0xe')]);router[_0x22c5('0x7')](_0x22c5('0xf'),controller[_0x22c5('0x10')]);router[_0x22c5('0x7')](_0x22c5('0x11'),controller['getCustomerAvatar']);router[_0x22c5('0x7')](_0x22c5('0x12'),controller['getSystemAvatar']);router[_0x22c5('0x7')](_0x22c5('0x13'),auth[_0x22c5('0x8')](),controller[_0x22c5('0x14')]);router[_0x22c5('0x7')](_0x22c5('0x15'),controller[_0x22c5('0x16')]);router[_0x22c5('0x7')](_0x22c5('0x17'),auth['isAuthenticated'](),controller[_0x22c5('0x18')]);router['get'](_0x22c5('0x19'),auth[_0x22c5('0x8')](),controller[_0x22c5('0x1a')]);router[_0x22c5('0x7')]('/:id/fields',controller[_0x22c5('0x1b')]);router[_0x22c5('0x7')](_0x22c5('0x1c'),auth[_0x22c5('0x8')](),controller[_0x22c5('0x1d')]);router['get'](_0x22c5('0x1e'),auth[_0x22c5('0x8')](),controller[_0x22c5('0x1f')]);router[_0x22c5('0x20')]('/',auth[_0x22c5('0x8')](),controller['create']);router['post'](_0x22c5('0x21'),auth[_0x22c5('0x8')](),controller[_0x22c5('0x22')]);router[_0x22c5('0x20')](_0x22c5('0xc'),auth[_0x22c5('0x8')](),controller[_0x22c5('0x23')]);var upload=multer({'storage':multer[_0x22c5('0x24')]({'destination':function(_0x74a058,_0x392d87,_0x3e4d65){_0x3e4d65(null,path['join'](config[_0x22c5('0x25')],'server/files/images/logos/'));},'filename':function(_0x224c15,_0x398c2f,_0x18baad){_0x18baad(null,util['format']('%s-%s',Date[_0x22c5('0x26')](),_0x398c2f['originalname']));}})});router[_0x22c5('0x20')](_0x22c5('0xd'),upload[_0x22c5('0x27')]('file'),controller['addLogo']);var upload=multer({'storage':multer[_0x22c5('0x24')]({'destination':function(_0x220f8a,_0x43353d,_0x25df43){_0x25df43(null,path[_0x22c5('0x28')](config[_0x22c5('0x25')],_0x22c5('0x29')));},'filename':function(_0x40368f,_0x3b22cd,_0x4afccc){_0x4afccc(null,util[_0x22c5('0x2a')](_0x22c5('0x2b'),Date[_0x22c5('0x26')](),_0x3b22cd['originalname']));}})});router[_0x22c5('0x20')]('/:id/avatar',upload['single'](_0x22c5('0x2c')),controller['addAvatar']);var upload=multer({'storage':multer[_0x22c5('0x24')]({'destination':function(_0x54c975,_0x4dbbb7,_0x19e2df){_0x19e2df(null,path[_0x22c5('0x28')](config[_0x22c5('0x25')],_0x22c5('0x29')));},'filename':function(_0x4b1529,_0x3d514c,_0xb9707b){_0xb9707b(null,util[_0x22c5('0x2a')]('%s-%s',Date['now'](),_0x3d514c['originalname']));}})});router[_0x22c5('0x20')](_0x22c5('0x11'),upload['single']('file'),controller[_0x22c5('0x2d')]);var upload=multer({'storage':multer[_0x22c5('0x24')]({'destination':function(_0x18c291,_0x4af732,_0x491231){_0x491231(null,path[_0x22c5('0x28')](config[_0x22c5('0x25')],_0x22c5('0x29')));},'filename':function(_0x8123e,_0x3d2e18,_0x3f9601){_0x3f9601(null,util[_0x22c5('0x2a')](_0x22c5('0x2b'),Date[_0x22c5('0x26')](),_0x3d2e18[_0x22c5('0x2e')]));}})});router['post'](_0x22c5('0x12'),upload['single'](_0x22c5('0x2c')),controller['addSystemAvatar']);router[_0x22c5('0x20')]('/:id/notify',controller[_0x22c5('0x2f')]);const offlineUploadMulter=multer({'storage':multer[_0x22c5('0x24')]({'destination':function(_0x14ffe4,_0x58bbfb,_0x10e25e){const _0xdd982c=path['join'](config['root'],_0x22c5('0x30'),_0x22c5('0x31'),_0x22c5('0x32'));fs_extra['ensureDir'](_0xdd982c,function(){_0x10e25e(null,_0xdd982c);});},'filename':function(_0x4b9b3f,_0x25b96e,_0x7f7696){const _0x203e41=_0x25b96e[_0x22c5('0x2e')][_0x22c5('0x33')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0xbc5394=path[_0x22c5('0x34')](_0x203e41);const _0x4bf118=Date['now']()+'-'+_0x203e41[_0x22c5('0x33')](_0xbc5394,'')+_0xbc5394;_0x7f7696(null,_0x4bf118);}})});router[_0x22c5('0x20')](_0x22c5('0x35'),offlineUploadMulter['any'](),controller[_0x22c5('0x36')]);router[_0x22c5('0x20')](_0x22c5('0x13'),auth['isAuthenticated'](),controller[_0x22c5('0x37')]);router[_0x22c5('0x20')](_0x22c5('0x17'),auth[_0x22c5('0x8')](),controller[_0x22c5('0x38')]);router['post']('/:id/proactive_actions',auth[_0x22c5('0x8')](),controller[_0x22c5('0x39')]);router[_0x22c5('0x20')](_0x22c5('0x1e'),auth['isAuthenticated'](),controller[_0x22c5('0x3a')]);router[_0x22c5('0x3b')]('/:id',auth[_0x22c5('0x8')](),controller[_0x22c5('0x3c')]);router[_0x22c5('0x3d')]('/:id',auth[_0x22c5('0x8')](),controller[_0x22c5('0x3e')]);router[_0x22c5('0x3d')](_0x22c5('0x21'),auth[_0x22c5('0x8')](),controller[_0x22c5('0x3f')]);router[_0x22c5('0x3d')](_0x22c5('0xc'),auth[_0x22c5('0x8')](),controller['removeAnswers']);router[_0x22c5('0x3d')]('/:id/users',auth['isAuthenticated'](),controller[_0x22c5('0x40')]);module['exports']=router; \ No newline at end of file +var _0x8e9f=['addApplications','addProactiveActions','put','update','delete','/:id','destroy','removeAnswers','/:id/users','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','./chatWebsite.controller','get','isAuthenticated','describe','show','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','getAgents','post','create','/:id/dispositions','addAnswer','diskStorage','join','root','server/files/images/logos/','format','now','file','addLogo','server/files/images/avatars/','%s-%s','single','originalname','addCustomerAvatar','addSystemAvatar','/:id/notify','notify','server/files','attachments','offline-chat','ensureDir','replace','/:id/offline','any','offline','addInteraction'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8e9f,0x1d3));var _0xf8e9=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x8e9f[_0x13d07a];return _0x5ee0ee;};'use strict';var multer=require(_0xf8e9('0x0'));var util=require(_0xf8e9('0x1'));var path=require('path');var timeout=require(_0xf8e9('0x2'));var express=require(_0xf8e9('0x3'));var router=express[_0xf8e9('0x4')]();var fs_extra=require(_0xf8e9('0x5'));var auth=require(_0xf8e9('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf8e9('0x7'));router[_0xf8e9('0x8')]('/',auth[_0xf8e9('0x9')](),controller['index']);router[_0xf8e9('0x8')]('/describe',auth[_0xf8e9('0x9')](),controller[_0xf8e9('0xa')]);router[_0xf8e9('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xf8e9('0xb')]);router[_0xf8e9('0x8')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0xf8e9('0xc')]);router[_0xf8e9('0x8')](_0xf8e9('0xd'),auth[_0xf8e9('0x9')](),controller[_0xf8e9('0xe')]);router[_0xf8e9('0x8')](_0xf8e9('0xf'),controller[_0xf8e9('0x10')]);router[_0xf8e9('0x8')](_0xf8e9('0x11'),controller[_0xf8e9('0x12')]);router[_0xf8e9('0x8')](_0xf8e9('0x13'),controller[_0xf8e9('0x14')]);router[_0xf8e9('0x8')](_0xf8e9('0x15'),controller[_0xf8e9('0x16')]);router[_0xf8e9('0x8')](_0xf8e9('0x17'),auth[_0xf8e9('0x9')](),controller[_0xf8e9('0x18')]);router[_0xf8e9('0x8')](_0xf8e9('0x19'),controller[_0xf8e9('0x1a')]);router[_0xf8e9('0x8')](_0xf8e9('0x1b'),auth[_0xf8e9('0x9')](),controller[_0xf8e9('0x1c')]);router[_0xf8e9('0x8')](_0xf8e9('0x1d'),auth[_0xf8e9('0x9')](),controller[_0xf8e9('0x1e')]);router['get'](_0xf8e9('0x1f'),controller[_0xf8e9('0x20')]);router['get'](_0xf8e9('0x21'),auth[_0xf8e9('0x9')](),controller[_0xf8e9('0x22')]);router[_0xf8e9('0x8')]('/:id/users',auth[_0xf8e9('0x9')](),controller[_0xf8e9('0x23')]);router[_0xf8e9('0x24')]('/',auth[_0xf8e9('0x9')](),controller[_0xf8e9('0x25')]);router['post'](_0xf8e9('0x26'),auth[_0xf8e9('0x9')](),controller['addDisposition']);router[_0xf8e9('0x24')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0xf8e9('0x27')]);var upload=multer({'storage':multer[_0xf8e9('0x28')]({'destination':function(_0x4af8ca,_0x2ea766,_0x4545f6){_0x4545f6(null,path[_0xf8e9('0x29')](config[_0xf8e9('0x2a')],_0xf8e9('0x2b')));},'filename':function(_0x38fc96,_0x3d0952,_0x3324b1){_0x3324b1(null,util[_0xf8e9('0x2c')]('%s-%s',Date[_0xf8e9('0x2d')](),_0x3d0952['originalname']));}})});router['post'](_0xf8e9('0xf'),upload['single'](_0xf8e9('0x2e')),controller[_0xf8e9('0x2f')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1bb55f,_0x2c9a74,_0x45467a){_0x45467a(null,path[_0xf8e9('0x29')](config[_0xf8e9('0x2a')],_0xf8e9('0x30')));},'filename':function(_0x265f72,_0x763d92,_0x8f739d){_0x8f739d(null,util[_0xf8e9('0x2c')](_0xf8e9('0x31'),Date[_0xf8e9('0x2d')](),_0x763d92['originalname']));}})});router['post'](_0xf8e9('0x11'),upload[_0xf8e9('0x32')]('file'),controller['addAvatar']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5dcf8c,_0x5b5956,_0xdf7ce1){_0xdf7ce1(null,path[_0xf8e9('0x29')](config[_0xf8e9('0x2a')],_0xf8e9('0x30')));},'filename':function(_0x406a37,_0x80f1ca,_0x411fd9){_0x411fd9(null,util[_0xf8e9('0x2c')]('%s-%s',Date[_0xf8e9('0x2d')](),_0x80f1ca[_0xf8e9('0x33')]));}})});router[_0xf8e9('0x24')](_0xf8e9('0x13'),upload[_0xf8e9('0x32')](_0xf8e9('0x2e')),controller[_0xf8e9('0x34')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3694fd,_0x439552,_0x203df8){_0x203df8(null,path[_0xf8e9('0x29')](config['root'],_0xf8e9('0x30')));},'filename':function(_0x27ffa5,_0x8848fd,_0x67f7e4){_0x67f7e4(null,util['format'](_0xf8e9('0x31'),Date[_0xf8e9('0x2d')](),_0x8848fd[_0xf8e9('0x33')]));}})});router[_0xf8e9('0x24')]('/:id/system_avatar',upload[_0xf8e9('0x32')](_0xf8e9('0x2e')),controller[_0xf8e9('0x35')]);router[_0xf8e9('0x24')](_0xf8e9('0x36'),controller[_0xf8e9('0x37')]);const offlineUploadMulter=multer({'storage':multer[_0xf8e9('0x28')]({'destination':function(_0x1b29fc,_0x58981a,_0x258fc3){const _0x5d797b=path[_0xf8e9('0x29')](config[_0xf8e9('0x2a')],_0xf8e9('0x38'),_0xf8e9('0x39'),_0xf8e9('0x3a'));fs_extra[_0xf8e9('0x3b')](_0x5d797b,function(){_0x258fc3(null,_0x5d797b);});},'filename':function(_0x2440da,_0x3a69d0,_0x14607a){const _0x57ac21=_0x3a69d0[_0xf8e9('0x33')][_0xf8e9('0x3c')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x4a4774=path['extname'](_0x57ac21);const _0x59aa07=Date[_0xf8e9('0x2d')]()+'-'+_0x57ac21[_0xf8e9('0x3c')](_0x4a4774,'')+_0x4a4774;_0x14607a(null,_0x59aa07);}})});router['post'](_0xf8e9('0x3d'),offlineUploadMulter[_0xf8e9('0x3e')](),controller[_0xf8e9('0x3f')]);router[_0xf8e9('0x24')](_0xf8e9('0x17'),auth[_0xf8e9('0x9')](),controller[_0xf8e9('0x40')]);router['post']('/:id/applications',auth[_0xf8e9('0x9')](),controller[_0xf8e9('0x41')]);router[_0xf8e9('0x24')](_0xf8e9('0x1d'),auth[_0xf8e9('0x9')](),controller[_0xf8e9('0x42')]);router['post']('/:id/users',auth[_0xf8e9('0x9')](),controller['addAgents']);router[_0xf8e9('0x43')]('/:id',auth[_0xf8e9('0x9')](),controller[_0xf8e9('0x44')]);router[_0xf8e9('0x45')](_0xf8e9('0x46'),auth[_0xf8e9('0x9')](),controller[_0xf8e9('0x47')]);router[_0xf8e9('0x45')](_0xf8e9('0x26'),auth[_0xf8e9('0x9')](),controller['removeDispositions']);router[_0xf8e9('0x45')](_0xf8e9('0xd'),auth[_0xf8e9('0x9')](),controller[_0xf8e9('0x48')]);router[_0xf8e9('0x45')](_0xf8e9('0x49'),auth[_0xf8e9('0x9')](),controller[_0xf8e9('0x4a')]);module[_0xf8e9('0x4b')]=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index c2224ed..846ccdd 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 _0xeb05=['get','Client-Side\x20logger\x20not\x20found!','expressEndpoint','exports','beaver-logger/server','express','Router','env','production','app'];(function(_0x51d211,_0x21bab9){var _0x53d316=function(_0xe1efd0){while(--_0xe1efd0){_0x51d211['push'](_0x51d211['shift']());}};_0x53d316(++_0x21bab9);}(_0xeb05,0x90));var _0x5eb0=function(_0x36b8de,_0x4085c1){_0x36b8de=_0x36b8de-0x0;var _0x4ce4e5=_0xeb05[_0x36b8de];return _0x4ce4e5;};var beaverLogger=require(_0x5eb0('0x0'));var express=require(_0x5eb0('0x1'));var auth=require('../components/auth/service');var config=require('../config/environment');var router=express[_0x5eb0('0x2')]();var isProduction=config[_0x5eb0('0x3')]===_0x5eb0('0x4')||![];function clientSideLogs(_0x5e64e7,_0x4b6bb4,_0x89a8bf){var _0x3cb733=_0x5e64e7[_0x5eb0('0x5')][_0x5eb0('0x6')]('client-side-logger');if(!_0x3cb733){throw new Error(_0x5eb0('0x7'));}return beaverLogger[_0x5eb0('0x8')]({'uri':'/client-logs','logger':_0x3cb733,'enableCors':!isProduction})(_0x5e64e7,_0x4b6bb4,_0x89a8bf);}router['use'](auth['isAuthenticated'](),clientSideLogs);module[_0x5eb0('0x9')]=router; \ No newline at end of file +var _0x22ef=['/client-logs','use','isAuthenticated','exports','beaver-logger/server','express','../components/auth/service','../config/environment','Router','env','production','app','get','client-side-logger','Client-Side\x20logger\x20not\x20found!'];(function(_0x3de9ad,_0x2a0d99){var _0x3b7676=function(_0x541c88){while(--_0x541c88){_0x3de9ad['push'](_0x3de9ad['shift']());}};_0x3b7676(++_0x2a0d99);}(_0x22ef,0x1e4));var _0xf22e=function(_0x3af98d,_0x5822e5){_0x3af98d=_0x3af98d-0x0;var _0x491d90=_0x22ef[_0x3af98d];return _0x491d90;};var beaverLogger=require(_0xf22e('0x0'));var express=require(_0xf22e('0x1'));var auth=require(_0xf22e('0x2'));var config=require(_0xf22e('0x3'));var router=express[_0xf22e('0x4')]();var isProduction=config[_0xf22e('0x5')]===_0xf22e('0x6')||![];function clientSideLogs(_0x182234,_0x339591,_0x16929c){var _0x3f72f5=_0x182234[_0xf22e('0x7')][_0xf22e('0x8')](_0xf22e('0x9'));if(!_0x3f72f5){throw new Error(_0xf22e('0xa'));}return beaverLogger['expressEndpoint']({'uri':_0xf22e('0xb'),'logger':_0x3f72f5,'enableCors':!isProduction})(_0x182234,_0x339591,_0x16929c);}router[_0xf22e('0xc')](auth[_0xf22e('0xd')](),clientSideLogs);module[_0xf22e('0xe')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 36faf24..0639ad4 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 _0x797e=['Dynamics365','STRING','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','exports','ENUM','Google','MicrosoftAzure','Outlook365'];(function(_0x5ec03f,_0x4ca34b){var _0x162000=function(_0x473078){while(--_0x473078){_0x5ec03f['push'](_0x5ec03f['shift']());}};_0x162000(++_0x4ca34b);}(_0x797e,0x158));var _0xe797=function(_0x3aadce,_0x455a70){_0x3aadce=_0x3aadce-0x0;var _0x2db10b=_0x797e[_0x3aadce];return _0x2db10b;};'use strict';var Sequelize=require(_0xe797('0x0'));module[_0xe797('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xe797('0x2')]('AmazonAWS',_0xe797('0x3'),_0xe797('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0xe797('0x2')](_0xe797('0x5'),_0xe797('0x6'))},'data1':{'type':Sequelize[_0xe797('0x7')],'comment':_0xe797('0x8')},'data2':{'type':Sequelize[_0xe797('0x7')],'comment':'MicrosoftAzure\x20=>\x20tenant'},'data3':{'type':Sequelize['STRING'],'comment':_0xe797('0x9')},'data4':{'type':Sequelize[_0xe797('0x7')],'comment':_0xe797('0xa')},'data5':{'type':Sequelize[_0xe797('0xb')],'comment':_0xe797('0xc')},'data6':{'type':Sequelize['TEXT'],'comment':'MicrosoftAzure\x20=>\x20refresh_token'},'data7':{'type':Sequelize[_0xe797('0xb')],'comment':_0xe797('0xd')}}; \ No newline at end of file +var _0x432a=['ENUM','AmazonAWS','Google','Outlook365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','STRING'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x432a,0x1c5));var _0xa432=function(_0x4ec15e,_0x3040d8){_0x4ec15e=_0x4ec15e-0x0;var _0x408b47=_0x432a[_0x4ec15e];return _0x408b47;};'use strict';var Sequelize=require(_0xa432('0x0'));module['exports']={'name':{'type':Sequelize[_0xa432('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xa432('0x2')](_0xa432('0x3'),_0xa432('0x4'),'MicrosoftAzure'),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0xa432('0x2')](_0xa432('0x5'),'Dynamics365')},'data1':{'type':Sequelize[_0xa432('0x1')],'comment':_0xa432('0x6')},'data2':{'type':Sequelize[_0xa432('0x1')],'comment':_0xa432('0x7')},'data3':{'type':Sequelize[_0xa432('0x1')],'comment':_0xa432('0x8')},'data4':{'type':Sequelize['STRING'],'comment':_0xa432('0x9')},'data5':{'type':Sequelize[_0xa432('0xa')],'comment':_0xa432('0xb')},'data6':{'type':Sequelize[_0xa432('0xa')],'comment':'MicrosoftAzure\x20=>\x20refresh_token'},'data7':{'type':Sequelize[_0xa432('0xa')],'comment':_0xa432('0xc')}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index dddafcc..9aa6c97 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 _0x2b27=['includeAll','include','findAll','rows','MicrosoftAzure','decryptString','data3','catch','params','keys','find','create','Name\x20parameter\x20not\x20specified','body','service','Service\x20parameter\x20not\x20specified','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','oauth2MicrosoftAuthorize','findOne','user','oauth2MicrosoftCallback','get','state','parse','toString','ascii','isValidIdToken','oauth2Claims','Unable\x20to\x20validate\x20id_token','getOauth2MicrosoftAccessToken','code','data5','access_token','data6','refresh_token','startRefreshInterval','emit','microsoftAuthorization:success','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','lodash','ioredis','../../components/parsers/qs','../../components/encryptor','../../config/logger','api','../../mysqldb','./cloudProvider.oauth','defaults','redis','socket.io-emitter','sendStatus','status','end','json','undefined','count','offset','limit','update','then','destroy','error','stack','name','send','slice','index','map','CloudProvider','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options'];(function(_0x5265c7,_0x2bdcd4){var _0x38f9c2=function(_0x6ba70f){while(--_0x6ba70f){_0x5265c7['push'](_0x5265c7['shift']());}};_0x38f9c2(++_0x2bdcd4);}(_0x2b27,0x1aa));var _0x72b2=function(_0x228ac9,_0x42f065){_0x228ac9=_0x228ac9-0x0;var _0x69fe02=_0x2b27[_0x228ac9];return _0x69fe02;};'use strict';var _=require(_0x72b2('0x0'));var Redis=require(_0x72b2('0x1'));var qs=require(_0x72b2('0x2'));var encryptor=require(_0x72b2('0x3'));var config=require('../../config/environment');var logger=require(_0x72b2('0x4'))(_0x72b2('0x5'));var db=require(_0x72b2('0x6'))['db'];var oauth=require(_0x72b2('0x7'));config['redis']=_[_0x72b2('0x8')](config[_0x72b2('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x72b2('0xa'))(new Redis(config['redis']));var redis=new Redis(config[_0x72b2('0x9')]);function respondWithStatusCode(_0x5e2915,_0x36938f){_0x36938f=_0x36938f||0xcc;return function(_0x146098){if(_0x146098){return _0x5e2915[_0x72b2('0xb')](_0x36938f);}return _0x5e2915[_0x72b2('0xc')](_0x36938f)[_0x72b2('0xd')]();};}function respondWithResult(_0x3c33cf,_0x2d2d1b){_0x2d2d1b=_0x2d2d1b||0xc8;return function(_0x180c3f){if(_0x180c3f){return _0x3c33cf['status'](_0x2d2d1b)[_0x72b2('0xe')](_0x180c3f);}};}function respondWithFilteredResult(_0x50f925,_0xb2bf0a){return function(_0x6a5bca){if(_0x6a5bca){var _0x2e2e13=typeof _0xb2bf0a['offset']==='undefined'&&typeof _0xb2bf0a['limit']===_0x72b2('0xf');var _0x55243e=_0x6a5bca[_0x72b2('0x10')];var _0x325934=_0x2e2e13?0x0:_0xb2bf0a[_0x72b2('0x11')];var _0x454cc9=_0x2e2e13?_0x6a5bca[_0x72b2('0x10')]:_0xb2bf0a[_0x72b2('0x11')]+_0xb2bf0a[_0x72b2('0x12')];var _0x44792a;if(_0x454cc9>=_0x55243e){_0x454cc9=_0x55243e;_0x44792a=0xc8;}else{_0x44792a=0xce;}_0x50f925[_0x72b2('0xc')](_0x44792a);return _0x50f925['set']('Content-Range',_0x325934+'-'+_0x454cc9+'/'+_0x55243e)[_0x72b2('0xe')](_0x6a5bca);}return null;};}function saveUpdates(_0x168c0a){return function(_0x1f9106){if(_0x1f9106){return _0x1f9106[_0x72b2('0x13')](_0x168c0a)[_0x72b2('0x14')](function(_0x228ba1){return _0x228ba1;});}return null;};}function removeEntity(_0x40ab8f){return function(_0x446f68){if(_0x446f68){return _0x446f68[_0x72b2('0x15')]()['then'](function(){_0x40ab8f['status'](0xcc)[_0x72b2('0xd')]();});}};}function handleEntityNotFound(_0x46b7e5){return function(_0x176c38){if(!_0x176c38){_0x46b7e5[_0x72b2('0xb')](0x194);}return _0x176c38;};}function handleError(_0x42f270,_0x2819b6){_0x2819b6=_0x2819b6||0x1f4;return function(_0x1eb8df){logger[_0x72b2('0x16')](_0x1eb8df[_0x72b2('0x17')]);if(_0x1eb8df[_0x72b2('0x18')]){delete _0x1eb8df[_0x72b2('0x18')];}_0x42f270[_0x72b2('0xc')](_0x2819b6)[_0x72b2('0x19')](_0x1eb8df);};}function maskClientSecret(_0x1c6792){return _['padEnd'](_0x1c6792[_0x72b2('0x1a')](0x0,0x3),0x14,'*');}exports[_0x72b2('0x1b')]=function(_0x724c06,_0x4e50fa){var _0x35e04e={},_0x288c99={},_0x561fcc={'count':0x0,'rows':[]};var _0x2b8bfe=_[_0x72b2('0x1c')](db[_0x72b2('0x1d')][_0x72b2('0x1e')],function(_0x4a9665){return{'name':_0x4a9665['fieldName'],'type':_0x4a9665[_0x72b2('0x1f')][_0x72b2('0x20')]};});_0x288c99[_0x72b2('0x21')]=_[_0x72b2('0x1c')](_0x2b8bfe,_0x72b2('0x18'));_0x288c99[_0x72b2('0x22')]=_['keys'](_0x724c06['query']);_0x288c99[_0x72b2('0x23')]=_[_0x72b2('0x24')](_0x288c99['model'],_0x288c99['query']);_0x35e04e[_0x72b2('0x25')]=_[_0x72b2('0x24')](_0x288c99[_0x72b2('0x21')],qs[_0x72b2('0x26')](_0x724c06[_0x72b2('0x22')][_0x72b2('0x26')]));_0x35e04e['attributes']=_0x35e04e['attributes'][_0x72b2('0x27')]?_0x35e04e[_0x72b2('0x25')]:_0x288c99[_0x72b2('0x21')];if(!_0x724c06[_0x72b2('0x22')][_0x72b2('0x28')](_0x72b2('0x29'))){_0x35e04e[_0x72b2('0x12')]=qs[_0x72b2('0x12')](_0x724c06[_0x72b2('0x22')][_0x72b2('0x12')]);_0x35e04e['offset']=qs[_0x72b2('0x11')](_0x724c06[_0x72b2('0x22')]['offset']);}_0x35e04e[_0x72b2('0x2a')]=qs[_0x72b2('0x2b')](_0x724c06[_0x72b2('0x22')][_0x72b2('0x2b')]);_0x35e04e['where']=qs['filters'](_[_0x72b2('0x2c')](_0x724c06[_0x72b2('0x22')],_0x288c99[_0x72b2('0x23')]),_0x2b8bfe);if(_0x724c06[_0x72b2('0x22')][_0x72b2('0x2d')]){_0x35e04e[_0x72b2('0x2e')]=_[_0x72b2('0x2f')](_0x35e04e[_0x72b2('0x2e')],{'$or':_[_0x72b2('0x1c')](_0x2b8bfe,function(_0x51a173){if(_0x51a173['type']!=='VIRTUAL'){var _0x3c7209={};_0x3c7209[_0x51a173[_0x72b2('0x18')]]={'$like':'%'+_0x724c06[_0x72b2('0x22')][_0x72b2('0x2d')]+'%'};return _0x3c7209;}})});}_0x35e04e=_[_0x72b2('0x2f')]({},_0x35e04e,_0x724c06[_0x72b2('0x30')]);var _0x46179d={'where':_0x35e04e[_0x72b2('0x2e')]};return db['CloudProvider'][_0x72b2('0x10')](_0x46179d)[_0x72b2('0x14')](function(_0x30d166){_0x561fcc[_0x72b2('0x10')]=_0x30d166;if(_0x724c06[_0x72b2('0x22')][_0x72b2('0x31')]){_0x35e04e[_0x72b2('0x32')]=[{'all':!![]}];}return db[_0x72b2('0x1d')][_0x72b2('0x33')](_0x35e04e);})[_0x72b2('0x14')](function(_0x5a8786){_0x561fcc[_0x72b2('0x34')]=_[_0x72b2('0x1c')](_0x5a8786,function(_0x5d6a27){if(_0x5d6a27['service']===_0x72b2('0x35')){var _0x1d6ece=encryptor[_0x72b2('0x36')](_0x5d6a27['data3']);_0x5d6a27[_0x72b2('0x37')]=maskClientSecret(_0x1d6ece);}return _0x5d6a27;});return _0x561fcc;})[_0x72b2('0x14')](respondWithFilteredResult(_0x4e50fa,_0x35e04e))[_0x72b2('0x38')](handleError(_0x4e50fa,null));};exports['show']=function(_0x475650,_0xdb889c){var _0x121086={'raw':!![],'where':{'id':_0x475650[_0x72b2('0x39')]['id']}},_0x1cfa82={};_0x1cfa82[_0x72b2('0x21')]=_['keys'](db[_0x72b2('0x1d')]['rawAttributes']);_0x1cfa82['query']=_[_0x72b2('0x3a')](_0x475650[_0x72b2('0x22')]);_0x1cfa82[_0x72b2('0x23')]=_['intersection'](_0x1cfa82[_0x72b2('0x21')],_0x1cfa82['query']);_0x121086['attributes']=_[_0x72b2('0x24')](_0x1cfa82[_0x72b2('0x21')],qs[_0x72b2('0x26')](_0x475650[_0x72b2('0x22')][_0x72b2('0x26')]));_0x121086[_0x72b2('0x25')]=_0x121086[_0x72b2('0x25')][_0x72b2('0x27')]?_0x121086[_0x72b2('0x25')]:_0x1cfa82[_0x72b2('0x21')];if(_0x475650['query']['includeAll']){_0x121086[_0x72b2('0x32')]=[{'all':!![]}];}_0x121086=_[_0x72b2('0x2f')]({},_0x121086,_0x475650['options']);return db[_0x72b2('0x1d')][_0x72b2('0x3b')](_0x121086)[_0x72b2('0x14')](handleEntityNotFound(_0xdb889c,null))[_0x72b2('0x14')](function(_0x62b423){if(_0x62b423['service']===_0x72b2('0x35')){var _0x9e9245=encryptor[_0x72b2('0x36')](_0x62b423[_0x72b2('0x37')]);_0x62b423[_0x72b2('0x37')]=maskClientSecret(_0x9e9245);}return _0x62b423;})[_0x72b2('0x14')](respondWithResult(_0xdb889c,null))[_0x72b2('0x38')](handleError(_0xdb889c,null));};exports[_0x72b2('0x3c')]=function(_0x3d81e0,_0x2b4975){if(!_0x3d81e0['body'][_0x72b2('0x18')])throw new Error(_0x72b2('0x3d'));if(!_0x3d81e0[_0x72b2('0x3e')][_0x72b2('0x3f')])throw new Error(_0x72b2('0x40'));var _0x2b09fc=db[_0x72b2('0x1d')]['rawAttributes'][_0x72b2('0x3f')][_0x72b2('0x41')];if(!_0x2b09fc[_0x72b2('0x42')](_0x3d81e0[_0x72b2('0x3e')]['service']))throw new Error(_0x72b2('0x43')+_0x2b09fc[_0x72b2('0x44')](',\x20'));if(_0x3d81e0['body'][_0x72b2('0x3f')]===_0x72b2('0x35')&&_0x3d81e0[_0x72b2('0x3e')][_0x72b2('0x37')]){_0x3d81e0['body'][_0x72b2('0x37')]=encryptor['encryptString'](_0x3d81e0[_0x72b2('0x3e')][_0x72b2('0x37')]);}return db[_0x72b2('0x1d')]['create'](_0x3d81e0[_0x72b2('0x3e')],{})['then'](respondWithResult(_0x2b4975,0xc9))[_0x72b2('0x38')](handleError(_0x2b4975,null));};exports['update']=function(_0x3dbac3,_0x29d698){if(_0x3dbac3[_0x72b2('0x3e')]['id']){delete _0x3dbac3[_0x72b2('0x3e')]['id'];}return db[_0x72b2('0x1d')]['find']({'where':{'id':_0x3dbac3[_0x72b2('0x39')]['id']}})['then'](handleEntityNotFound(_0x29d698,null))[_0x72b2('0x14')](function(_0x218225){if(_0x218225['service']===_0x72b2('0x35')&&_0x3dbac3[_0x72b2('0x3e')][_0x72b2('0x37')]){_0x3dbac3[_0x72b2('0x3e')][_0x72b2('0x37')]=encryptor['encryptString'](_0x3dbac3['body']['data3']);}return _0x218225;})[_0x72b2('0x14')](saveUpdates(_0x3dbac3[_0x72b2('0x3e')],null))['then'](respondWithResult(_0x29d698,null))[_0x72b2('0x38')](handleError(_0x29d698,null));};exports[_0x72b2('0x15')]=function(_0x4c4f44,_0x1b8d65){return db[_0x72b2('0x1d')][_0x72b2('0x3b')]({'where':{'id':_0x4c4f44['params']['id']}})[_0x72b2('0x14')](handleEntityNotFound(_0x1b8d65,null))[_0x72b2('0x14')](removeEntity(_0x1b8d65,null))[_0x72b2('0x38')](handleError(_0x1b8d65,null));};exports[_0x72b2('0x45')]=function(_0x270d42,_0x19533f){return db[_0x72b2('0x1d')][_0x72b2('0x46')]({'where':{'id':_0x270d42[_0x72b2('0x39')]['id']},'raw':!![]})[_0x72b2('0x14')](function(_0x995682){if(!_0x995682)return _0x19533f[_0x72b2('0xb')](0x194);return{'url':oauth['generateMicrosoftAuthorizationUrl'](_0x995682,_0x270d42[_0x72b2('0x47')]['id'])};})[_0x72b2('0x14')](respondWithResult(_0x19533f,null))['catch'](handleError(_0x19533f,null));};exports[_0x72b2('0x48')]=function(_0x468f60,_0x1ced5a){var _0x10300d=_0x468f60[_0x72b2('0x3e')];var _0x500be8;var _0x55c6d8;if(_0x10300d[_0x72b2('0x16')])throw _0x10300d;redis[_0x72b2('0x49')](_0x10300d[_0x72b2('0x4a')])[_0x72b2('0x14')](function(_0x2fcef9){if(!_0x2fcef9)throw new Error('Invalid\x20state\x20parameter');_0x500be8=JSON[_0x72b2('0x4b')](_0x2fcef9);var _0x2052a8=Buffer['from'](_0x10300d['state'],'base64')[_0x72b2('0x4c')](_0x72b2('0x4d'));_0x55c6d8=JSON[_0x72b2('0x4b')](_0x2052a8);if(!oauth[_0x72b2('0x4e')](_0x10300d['id_token'],_0x500be8[_0x72b2('0x4f')]))throw new Error(_0x72b2('0x50'));redis['del'](_0x10300d[_0x72b2('0x4a')]);return oauth[_0x72b2('0x51')](_0x10300d[_0x72b2('0x52')],_0x500be8);})[_0x72b2('0x14')](function(_0x1c47a5){_0x500be8[_0x72b2('0x53')]=_0x1c47a5[_0x72b2('0x54')];_0x500be8[_0x72b2('0x55')]=_0x1c47a5[_0x72b2('0x56')];return db['CloudProvider'][_0x72b2('0x13')]({'data5':_0x500be8['data5'],'data6':_0x500be8['data6']},{'where':{'id':_0x500be8['id']}});})[_0x72b2('0x14')](function(){oauth[_0x72b2('0x57')](_0x500be8);socket[_0x72b2('0x58')](_0x72b2('0x59'),{'id':_0x55c6d8['id']});return;})[_0x72b2('0x14')](respondWithStatusCode(_0x1ced5a,null))[_0x72b2('0x38')](function(_0x17db04){if(_0x55c6d8){socket['emit'](_0x72b2('0x5a'),{'id':_0x55c6d8['id']});}if(!_0x500be8){logger[_0x72b2('0x16')](_0x72b2('0x5b'),_0x17db04);return _0x1ced5a[_0x72b2('0xc')](0x1f4)['send'](_0x17db04[_0x72b2('0x5c')]);}logger[_0x72b2('0x16')](_0x72b2('0x5d'),_0x500be8['id'],JSON[_0x72b2('0x5e')](_0x17db04));});}; \ No newline at end of file +var _0x9b7b=['oauth2MicrosoftAuthorize','generateMicrosoftAuthorizationUrl','oauth2MicrosoftCallback','get','parse','from','state','toString','isValidIdToken','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','del','getOauth2MicrosoftAccessToken','code','data5','access_token','data6','startRefreshInterval','emit','microsoftAuthorization:success','Invalid\x20authentication\x20state\x20parameter','stringify','../../components/encryptor','../../config/environment','../../config/logger','api','../../mysqldb','./cloudProvider.oauth','redis','defaults','localhost','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','update','then','error','stack','name','send','slice','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','CloudProvider','includeAll','include','findAll','rows','decryptString','data3','show','find','service','MicrosoftAzure','catch','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','body','encryptString','create','params'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0x9b7b,0x76));var _0xb9b7=function(_0x21cdee,_0x4301e4){_0x21cdee=_0x21cdee-0x0;var _0x994295=_0x9b7b[_0x21cdee];return _0x994295;};'use strict';var _=require('lodash');var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var encryptor=require(_0xb9b7('0x0'));var config=require(_0xb9b7('0x1'));var logger=require(_0xb9b7('0x2'))(_0xb9b7('0x3'));var db=require(_0xb9b7('0x4'))['db'];var oauth=require(_0xb9b7('0x5'));config[_0xb9b7('0x6')]=_[_0xb9b7('0x7')](config['redis'],{'host':_0xb9b7('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb9b7('0x6')]));var redis=new Redis(config[_0xb9b7('0x6')]);function respondWithStatusCode(_0x31c918,_0x174ddc){_0x174ddc=_0x174ddc||0xcc;return function(_0x2ab90f){if(_0x2ab90f){return _0x31c918[_0xb9b7('0x9')](_0x174ddc);}return _0x31c918[_0xb9b7('0xa')](_0x174ddc)[_0xb9b7('0xb')]();};}function respondWithResult(_0x457f1f,_0x5726c5){_0x5726c5=_0x5726c5||0xc8;return function(_0x245389){if(_0x245389){return _0x457f1f['status'](_0x5726c5)[_0xb9b7('0xc')](_0x245389);}};}function respondWithFilteredResult(_0xcd7b53,_0x250000){return function(_0x77a6a3){if(_0x77a6a3){var _0x22e13a=typeof _0x250000[_0xb9b7('0xd')]==='undefined'&&typeof _0x250000[_0xb9b7('0xe')]===_0xb9b7('0xf');var _0x3016e0=_0x77a6a3['count'];var _0x47eba0=_0x22e13a?0x0:_0x250000[_0xb9b7('0xd')];var _0x93d644=_0x22e13a?_0x77a6a3[_0xb9b7('0x10')]:_0x250000[_0xb9b7('0xd')]+_0x250000[_0xb9b7('0xe')];var _0x5c9dd9;if(_0x93d644>=_0x3016e0){_0x93d644=_0x3016e0;_0x5c9dd9=0xc8;}else{_0x5c9dd9=0xce;}_0xcd7b53[_0xb9b7('0xa')](_0x5c9dd9);return _0xcd7b53[_0xb9b7('0x11')](_0xb9b7('0x12'),_0x47eba0+'-'+_0x93d644+'/'+_0x3016e0)[_0xb9b7('0xc')](_0x77a6a3);}return null;};}function saveUpdates(_0x21f055){return function(_0x8bdd94){if(_0x8bdd94){return _0x8bdd94[_0xb9b7('0x13')](_0x21f055)[_0xb9b7('0x14')](function(_0x26bd10){return _0x26bd10;});}return null;};}function removeEntity(_0x185d34){return function(_0x2294ea){if(_0x2294ea){return _0x2294ea['destroy']()[_0xb9b7('0x14')](function(){_0x185d34[_0xb9b7('0xa')](0xcc)[_0xb9b7('0xb')]();});}};}function handleEntityNotFound(_0x32efa3){return function(_0x2eb177){if(!_0x2eb177){_0x32efa3['sendStatus'](0x194);}return _0x2eb177;};}function handleError(_0x6af412,_0x27a7d2){_0x27a7d2=_0x27a7d2||0x1f4;return function(_0x404fc4){logger[_0xb9b7('0x15')](_0x404fc4[_0xb9b7('0x16')]);if(_0x404fc4['name']){delete _0x404fc4[_0xb9b7('0x17')];}_0x6af412[_0xb9b7('0xa')](_0x27a7d2)[_0xb9b7('0x18')](_0x404fc4);};}function maskClientSecret(_0x282851){return _['padEnd'](_0x282851[_0xb9b7('0x19')](0x0,0x3),0x14,'*');}exports[_0xb9b7('0x1a')]=function(_0x41eb6c,_0x17368f){var _0x5f4e7c={},_0x2c678f={},_0x110e5e={'count':0x0,'rows':[]};var _0x3f923d=_[_0xb9b7('0x1b')](db['CloudProvider'][_0xb9b7('0x1c')],function(_0x22f9dd){return{'name':_0x22f9dd[_0xb9b7('0x1d')],'type':_0x22f9dd[_0xb9b7('0x1e')][_0xb9b7('0x1f')]};});_0x2c678f[_0xb9b7('0x20')]=_[_0xb9b7('0x1b')](_0x3f923d,_0xb9b7('0x17'));_0x2c678f[_0xb9b7('0x21')]=_[_0xb9b7('0x22')](_0x41eb6c['query']);_0x2c678f[_0xb9b7('0x23')]=_['intersection'](_0x2c678f[_0xb9b7('0x20')],_0x2c678f['query']);_0x5f4e7c[_0xb9b7('0x24')]=_[_0xb9b7('0x25')](_0x2c678f[_0xb9b7('0x20')],qs['fields'](_0x41eb6c[_0xb9b7('0x21')][_0xb9b7('0x26')]));_0x5f4e7c[_0xb9b7('0x24')]=_0x5f4e7c['attributes'][_0xb9b7('0x27')]?_0x5f4e7c[_0xb9b7('0x24')]:_0x2c678f[_0xb9b7('0x20')];if(!_0x41eb6c['query'][_0xb9b7('0x28')](_0xb9b7('0x29'))){_0x5f4e7c['limit']=qs['limit'](_0x41eb6c['query']['limit']);_0x5f4e7c['offset']=qs[_0xb9b7('0xd')](_0x41eb6c[_0xb9b7('0x21')][_0xb9b7('0xd')]);}_0x5f4e7c[_0xb9b7('0x2a')]=qs[_0xb9b7('0x2b')](_0x41eb6c[_0xb9b7('0x21')][_0xb9b7('0x2b')]);_0x5f4e7c[_0xb9b7('0x2c')]=qs[_0xb9b7('0x23')](_[_0xb9b7('0x2d')](_0x41eb6c['query'],_0x2c678f[_0xb9b7('0x23')]),_0x3f923d);if(_0x41eb6c[_0xb9b7('0x21')][_0xb9b7('0x2e')]){_0x5f4e7c[_0xb9b7('0x2c')]=_[_0xb9b7('0x2f')](_0x5f4e7c['where'],{'$or':_[_0xb9b7('0x1b')](_0x3f923d,function(_0x1f6d8a){if(_0x1f6d8a[_0xb9b7('0x1e')]!==_0xb9b7('0x30')){var _0x3dc48a={};_0x3dc48a[_0x1f6d8a['name']]={'$like':'%'+_0x41eb6c[_0xb9b7('0x21')][_0xb9b7('0x2e')]+'%'};return _0x3dc48a;}})});}_0x5f4e7c=_[_0xb9b7('0x2f')]({},_0x5f4e7c,_0x41eb6c[_0xb9b7('0x31')]);var _0x4af2e8={'where':_0x5f4e7c[_0xb9b7('0x2c')]};return db[_0xb9b7('0x32')][_0xb9b7('0x10')](_0x4af2e8)['then'](function(_0x1c726a){_0x110e5e['count']=_0x1c726a;if(_0x41eb6c[_0xb9b7('0x21')][_0xb9b7('0x33')]){_0x5f4e7c[_0xb9b7('0x34')]=[{'all':!![]}];}return db[_0xb9b7('0x32')][_0xb9b7('0x35')](_0x5f4e7c);})['then'](function(_0x36b33f){_0x110e5e[_0xb9b7('0x36')]=_[_0xb9b7('0x1b')](_0x36b33f,function(_0x868f85){if(_0x868f85['service']==='MicrosoftAzure'){var _0x48bf1e=encryptor[_0xb9b7('0x37')](_0x868f85[_0xb9b7('0x38')]);_0x868f85[_0xb9b7('0x38')]=maskClientSecret(_0x48bf1e);}return _0x868f85;});return _0x110e5e;})[_0xb9b7('0x14')](respondWithFilteredResult(_0x17368f,_0x5f4e7c))['catch'](handleError(_0x17368f,null));};exports[_0xb9b7('0x39')]=function(_0x970060,_0x5583ce){var _0x5e92bd={'raw':!![],'where':{'id':_0x970060['params']['id']}},_0x15ad80={};_0x15ad80[_0xb9b7('0x20')]=_[_0xb9b7('0x22')](db[_0xb9b7('0x32')]['rawAttributes']);_0x15ad80[_0xb9b7('0x21')]=_[_0xb9b7('0x22')](_0x970060[_0xb9b7('0x21')]);_0x15ad80[_0xb9b7('0x23')]=_[_0xb9b7('0x25')](_0x15ad80[_0xb9b7('0x20')],_0x15ad80[_0xb9b7('0x21')]);_0x5e92bd[_0xb9b7('0x24')]=_[_0xb9b7('0x25')](_0x15ad80[_0xb9b7('0x20')],qs['fields'](_0x970060[_0xb9b7('0x21')][_0xb9b7('0x26')]));_0x5e92bd[_0xb9b7('0x24')]=_0x5e92bd[_0xb9b7('0x24')]['length']?_0x5e92bd[_0xb9b7('0x24')]:_0x15ad80[_0xb9b7('0x20')];if(_0x970060['query'][_0xb9b7('0x33')]){_0x5e92bd['include']=[{'all':!![]}];}_0x5e92bd=_[_0xb9b7('0x2f')]({},_0x5e92bd,_0x970060[_0xb9b7('0x31')]);return db[_0xb9b7('0x32')][_0xb9b7('0x3a')](_0x5e92bd)[_0xb9b7('0x14')](handleEntityNotFound(_0x5583ce,null))[_0xb9b7('0x14')](function(_0x2689cd){if(_0x2689cd[_0xb9b7('0x3b')]===_0xb9b7('0x3c')){var _0x430ddc=encryptor[_0xb9b7('0x37')](_0x2689cd[_0xb9b7('0x38')]);_0x2689cd['data3']=maskClientSecret(_0x430ddc);}return _0x2689cd;})[_0xb9b7('0x14')](respondWithResult(_0x5583ce,null))[_0xb9b7('0x3d')](handleError(_0x5583ce,null));};exports['create']=function(_0x2b8cca,_0x14e2ca){if(!_0x2b8cca['body'][_0xb9b7('0x17')])throw new Error(_0xb9b7('0x3e'));if(!_0x2b8cca['body'][_0xb9b7('0x3b')])throw new Error(_0xb9b7('0x3f'));var _0x125498=db[_0xb9b7('0x32')][_0xb9b7('0x1c')]['service'][_0xb9b7('0x40')];if(!_0x125498[_0xb9b7('0x41')](_0x2b8cca['body']['service']))throw new Error(_0xb9b7('0x42')+_0x125498[_0xb9b7('0x43')](',\x20'));if(_0x2b8cca[_0xb9b7('0x44')]['service']===_0xb9b7('0x3c')&&_0x2b8cca[_0xb9b7('0x44')][_0xb9b7('0x38')]){_0x2b8cca[_0xb9b7('0x44')][_0xb9b7('0x38')]=encryptor[_0xb9b7('0x45')](_0x2b8cca[_0xb9b7('0x44')][_0xb9b7('0x38')]);}return db[_0xb9b7('0x32')][_0xb9b7('0x46')](_0x2b8cca[_0xb9b7('0x44')],{})[_0xb9b7('0x14')](respondWithResult(_0x14e2ca,0xc9))[_0xb9b7('0x3d')](handleError(_0x14e2ca,null));};exports['update']=function(_0x57fe34,_0x2b09d0){if(_0x57fe34['body']['id']){delete _0x57fe34[_0xb9b7('0x44')]['id'];}return db['CloudProvider']['find']({'where':{'id':_0x57fe34[_0xb9b7('0x47')]['id']}})[_0xb9b7('0x14')](handleEntityNotFound(_0x2b09d0,null))[_0xb9b7('0x14')](function(_0x34026f){if(_0x34026f['service']===_0xb9b7('0x3c')&&_0x57fe34['body'][_0xb9b7('0x38')]){_0x57fe34[_0xb9b7('0x44')][_0xb9b7('0x38')]=encryptor['encryptString'](_0x57fe34['body'][_0xb9b7('0x38')]);}return _0x34026f;})['then'](saveUpdates(_0x57fe34[_0xb9b7('0x44')],null))['then'](respondWithResult(_0x2b09d0,null))['catch'](handleError(_0x2b09d0,null));};exports['destroy']=function(_0x5974c,_0x31a414){return db[_0xb9b7('0x32')]['find']({'where':{'id':_0x5974c[_0xb9b7('0x47')]['id']}})[_0xb9b7('0x14')](handleEntityNotFound(_0x31a414,null))[_0xb9b7('0x14')](removeEntity(_0x31a414,null))[_0xb9b7('0x3d')](handleError(_0x31a414,null));};exports[_0xb9b7('0x48')]=function(_0x490d3c,_0x1bbddf){return db['CloudProvider']['findOne']({'where':{'id':_0x490d3c[_0xb9b7('0x47')]['id']},'raw':!![]})[_0xb9b7('0x14')](function(_0x23c21e){if(!_0x23c21e)return _0x1bbddf[_0xb9b7('0x9')](0x194);return{'url':oauth[_0xb9b7('0x49')](_0x23c21e,_0x490d3c['user']['id'])};})[_0xb9b7('0x14')](respondWithResult(_0x1bbddf,null))['catch'](handleError(_0x1bbddf,null));};exports[_0xb9b7('0x4a')]=function(_0x412ee8,_0x33229d){var _0x427d48=_0x412ee8[_0xb9b7('0x44')];var _0xc450be;var _0x5ec404;if(_0x427d48[_0xb9b7('0x15')])throw _0x427d48;redis[_0xb9b7('0x4b')](_0x427d48['state'])[_0xb9b7('0x14')](function(_0x1ed5bd){if(!_0x1ed5bd)throw new Error('Invalid\x20state\x20parameter');_0xc450be=JSON[_0xb9b7('0x4c')](_0x1ed5bd);var _0x1d46e7=Buffer[_0xb9b7('0x4d')](_0x427d48[_0xb9b7('0x4e')],'base64')[_0xb9b7('0x4f')]('ascii');_0x5ec404=JSON[_0xb9b7('0x4c')](_0x1d46e7);if(!oauth[_0xb9b7('0x50')](_0x427d48[_0xb9b7('0x51')],_0xc450be[_0xb9b7('0x52')]))throw new Error(_0xb9b7('0x53'));redis[_0xb9b7('0x54')](_0x427d48[_0xb9b7('0x4e')]);return oauth[_0xb9b7('0x55')](_0x427d48[_0xb9b7('0x56')],_0xc450be);})['then'](function(_0x37b342){_0xc450be[_0xb9b7('0x57')]=_0x37b342[_0xb9b7('0x58')];_0xc450be[_0xb9b7('0x59')]=_0x37b342['refresh_token'];return db[_0xb9b7('0x32')]['update']({'data5':_0xc450be[_0xb9b7('0x57')],'data6':_0xc450be['data6']},{'where':{'id':_0xc450be['id']}});})[_0xb9b7('0x14')](function(){oauth[_0xb9b7('0x5a')](_0xc450be);socket[_0xb9b7('0x5b')](_0xb9b7('0x5c'),{'id':_0x5ec404['id']});return;})[_0xb9b7('0x14')](respondWithStatusCode(_0x33229d,null))[_0xb9b7('0x3d')](function(_0x4db7a9){if(_0x5ec404){socket[_0xb9b7('0x5b')]('microsoftAuthorization:error',{'id':_0x5ec404['id']});}if(!_0xc450be){logger[_0xb9b7('0x15')](_0xb9b7('0x5d'),_0x4db7a9);return _0x33229d['status'](0x1f4)['send'](_0x4db7a9['message']);}logger['error']('Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s',_0xc450be['id'],JSON[_0xb9b7('0x5e')](_0x4db7a9));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 344be23..c50a442 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 _0x26eb=['rimraf','../../config/environment','./cloudProvider.attributes','exports','define','CloudProvider','cloud_providers','util','../../config/logger','api','bluebird','path'];(function(_0x140c8c,_0xca8737){var _0xf1a4c0=function(_0x227fe6){while(--_0x227fe6){_0x140c8c['push'](_0x140c8c['shift']());}};_0xf1a4c0(++_0xca8737);}(_0x26eb,0xf7));var _0xb26e=function(_0xe38db,_0x489ec9){_0xe38db=_0xe38db-0x0;var _0x4f764c=_0x26eb[_0xe38db];return _0x4f764c;};'use strict';var _=require('lodash');var util=require(_0xb26e('0x0'));var logger=require(_0xb26e('0x1'))(_0xb26e('0x2'));var moment=require('moment');var BPromise=require(_0xb26e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb26e('0x4'));var rimraf=require(_0xb26e('0x5'));var config=require(_0xb26e('0x6'));var attributes=require(_0xb26e('0x7'));module[_0xb26e('0x8')]=function(_0x37f651,_0x300121){return _0x37f651[_0xb26e('0x9')](_0xb26e('0xa'),attributes,{'tableName':_0xb26e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xba00=['exports','define','cloud_providers','util','../../config/logger','api','path','rimraf','../../config/environment'];(function(_0x16528b,_0xcf7f9d){var _0x38f906=function(_0x1c4350){while(--_0x1c4350){_0x16528b['push'](_0x16528b['shift']());}};_0x38f906(++_0xcf7f9d);}(_0xba00,0xd2));var _0x0ba0=function(_0x114c42,_0x1c03a9){_0x114c42=_0x114c42-0x0;var _0x4b7f93=_0xba00[_0x114c42];return _0x4b7f93;};'use strict';var _=require('lodash');var util=require(_0x0ba0('0x0'));var logger=require(_0x0ba0('0x1'))(_0x0ba0('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x0ba0('0x3'));var rimraf=require(_0x0ba0('0x4'));var config=require(_0x0ba0('0x5'));var attributes=require('./cloudProvider.attributes');module[_0x0ba0('0x6')]=function(_0x3c692d,_0x44d63b){return _0x3c692d[_0x0ba0('0x7')]('CloudProvider',attributes,{'tableName':_0x0ba0('0x8'),'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 ae28f14..6406afd 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 _0xcfc4=['client_id','data1','response_type','data4','response_mode','state','nonce','prompt','login','key','value','oauth2Claims','oauth2/','decode','payload','issuer','aud','audience','isAfter','unix','exp','resolve','data3','CloudProvider','findOne','then','refresh_token','data6','decryptString','POST','data5','catch','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','intervals','bind','all','inspect','exports','lodash','jsonwebtoken','request-promise','util','../../config/environment','../../config/logger','api','../../config/schedule/cloud-provider','../../mysqldb','defaults','redis','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','email','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','/authorize','map','type','Dynamics365','push','join','data7','/.default','replace','{TENANT_ID}','data2','id_token','stringify','toString','base64','hex'];(function(_0x3a2225,_0xb6600){var _0x5c8040=function(_0x2bdb09){while(--_0x2bdb09){_0x3a2225['push'](_0x3a2225['shift']());}};_0x5c8040(++_0xb6600);}(_0xcfc4,0x199));var _0x4cfc=function(_0x6a93d1,_0x308671){_0x6a93d1=_0x6a93d1-0x0;var _0x48bec9=_0xcfc4[_0x6a93d1];return _0x48bec9;};'use strict';var _=require(_0x4cfc('0x0'));var crypto=require('crypto');var jwt=require(_0x4cfc('0x1'));var moment=require('moment');var Redis=require('ioredis');var rp=require(_0x4cfc('0x2'));var util=require(_0x4cfc('0x3'));var encryptor=require('../../components/encryptor');var config=require(_0x4cfc('0x4'));var logger=require(_0x4cfc('0x5'))(_0x4cfc('0x6'));var schedule=require(_0x4cfc('0x7'));var db=require(_0x4cfc('0x8'))['db'];config['redis']=_[_0x4cfc('0x9')](config[_0x4cfc('0xa')],{'host':_0x4cfc('0xb'),'port':0x18eb});var redis=new Redis(config[_0x4cfc('0xa')]);var MICROSOFT_AUTH_URL=_0x4cfc('0xc');var AZURE_AUTH_SCOPES={'Outlook365':[_0x4cfc('0xd'),'profile',_0x4cfc('0xe'),_0x4cfc('0xf'),_0x4cfc('0x10'),_0x4cfc('0x11'),_0x4cfc('0x12')],'Dynamics365':['openid',_0x4cfc('0xf')]};var MICROSOFT_AUTH_ENDPOINT=_0x4cfc('0x13');var MICROSOFT_TOKEN_ENDPOINT='/token';var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x19c647){var _0x5db77c=_[_0x4cfc('0x14')](AZURE_AUTH_SCOPES[_0x19c647['type']]);if(_0x19c647[_0x4cfc('0x15')]===_0x4cfc('0x16'))_0x5db77c[_0x4cfc('0x17')](_0x19c647['data7']+'/.default');return _0x5db77c[_0x4cfc('0x18')]('\x20');}function getAccessTokenScope(_0xde6aa9){if(_0xde6aa9['type']==='Outlook365')return _0x4cfc('0x10');if(_0xde6aa9['type']==='Dynamics365')return _0xde6aa9[_0x4cfc('0x19')]+_0x4cfc('0x1a');}function generateMicrosoftAuthorizationUrl(_0x40ee18,_0x14043f){var _0x42c891=MICROSOFT_AUTH_URL[_0x4cfc('0x1b')](_0x4cfc('0x1c'),_0x40ee18[_0x4cfc('0x1d')]);var _0x46bc83=['code',_0x4cfc('0x1e')];var _0x192e61=Buffer['from'](JSON[_0x4cfc('0x1f')]({'id':_0x14043f}))[_0x4cfc('0x20')](_0x4cfc('0x21'));var _0x5f2c36=crypto['randomBytes'](0x10)[_0x4cfc('0x20')](_0x4cfc('0x22'));var _0x104024=getAuthorizationScopes(_0x40ee18);var _0x4623da=[{'key':_0x4cfc('0x23'),'value':_0x40ee18[_0x4cfc('0x24')]},{'key':_0x4cfc('0x25'),'value':encodeURIComponent(_0x46bc83[_0x4cfc('0x18')]('\x20'))},{'key':'redirect_uri','value':_0x40ee18[_0x4cfc('0x26')]},{'key':_0x4cfc('0x27'),'value':'form_post'},{'key':'scope','value':encodeURIComponent(_0x104024)},{'key':_0x4cfc('0x28'),'value':_0x192e61},{'key':_0x4cfc('0x29'),'value':_0x5f2c36},{'key':_0x4cfc('0x2a'),'value':_0x4cfc('0x2b')}];var _0x5cf7bd=_0x42c891+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x4cfc('0x14')](_0x4623da,function(_0x363aa6){return _0x363aa6[_0x4cfc('0x2c')]+'='+_0x363aa6[_0x4cfc('0x2d')];})[_0x4cfc('0x18')]('&');_0x40ee18[_0x4cfc('0x2e')]={'issuer':_0x42c891[_0x4cfc('0x1b')](_0x4cfc('0x2f'),''),'audience':_0x40ee18[_0x4cfc('0x24')],'state':_0x192e61,'nonce':_0x5f2c36};redis['set'](_0x192e61,JSON[_0x4cfc('0x1f')](_0x40ee18));return _0x5cf7bd;}function isValidIdToken(_0x669ac8,_0x28f196){try{var _0x336b24=jwt[_0x4cfc('0x30')](_0x669ac8,{'complete':!![]});var _0x5a5d6a=_0x336b24[_0x4cfc('0x31')];if(_0x5a5d6a['iss']!==_0x28f196[_0x4cfc('0x32')])return![];if(_0x5a5d6a[_0x4cfc('0x33')]!==_0x28f196[_0x4cfc('0x34')])return![];if(_0x5a5d6a[_0x4cfc('0x29')]!==_0x28f196['nonce'])return![];if(moment()[_0x4cfc('0x35')](moment[_0x4cfc('0x36')](_0x5a5d6a[_0x4cfc('0x37')])))return![];return!![];}catch(_0x4f1ef4){throw _0x4f1ef4;}}function refreshOauth2MicrosoftAccessToken(_0x56f1d8){return Promise[_0x4cfc('0x38')]()['then'](function(){if(_0x56f1d8[_0x4cfc('0x39')])return _0x56f1d8;return db[_0x4cfc('0x3a')][_0x4cfc('0x3b')]({'where':{'id':_0x56f1d8['id']},'raw':!![]});})[_0x4cfc('0x3c')](function(_0x2893d3){var _0x3ca7e2={'grant_type':_0x4cfc('0x3d'),'refresh_token':_0x2893d3[_0x4cfc('0x3e')],'scope':getAccessTokenScope(_0x2893d3),'redirect_uri':_0x2893d3[_0x4cfc('0x26')],'client_id':_0x2893d3['data1'],'client_secret':encryptor[_0x4cfc('0x3f')](_0x2893d3[_0x4cfc('0x39')])};var _0x49b3a6={'method':_0x4cfc('0x40'),'uri':MICROSOFT_AUTH_URL[_0x4cfc('0x1b')](_0x4cfc('0x1c'),_0x2893d3['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x3ca7e2,'json':!![]};return rp(_0x49b3a6);})[_0x4cfc('0x3c')](function(_0x41f2cb){_0x56f1d8[_0x4cfc('0x41')]=_0x41f2cb['access_token'];_0x56f1d8[_0x4cfc('0x3e')]=_0x41f2cb[_0x4cfc('0x3d')];return db[_0x4cfc('0x3a')]['update']({'data5':_0x56f1d8[_0x4cfc('0x41')],'data6':_0x56f1d8[_0x4cfc('0x3e')]},{'where':{'id':_0x56f1d8['id']}});})[_0x4cfc('0x3c')](function(){return _0x56f1d8;})[_0x4cfc('0x42')](function(_0x379e20){logger[_0x4cfc('0x43')](_0x4cfc('0x44'),_0x56f1d8['id'],_0x379e20);});}function getOauth2MicrosoftAccessToken(_0x55abdf,_0x41153d){var _0x2b2db6={'grant_type':'authorization_code','code':_0x55abdf,'scope':getAccessTokenScope(_0x41153d),'redirect_uri':_0x41153d[_0x4cfc('0x26')],'client_id':_0x41153d[_0x4cfc('0x24')],'client_secret':encryptor[_0x4cfc('0x3f')](_0x41153d[_0x4cfc('0x39')])};var _0x915ecc={'method':_0x4cfc('0x40'),'uri':MICROSOFT_AUTH_URL[_0x4cfc('0x1b')](_0x4cfc('0x1c'),_0x41153d[_0x4cfc('0x1d')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x2b2db6,'json':!![]};return rp(_0x915ecc);}function startRefreshInterval(_0xaf2987){var _0x33c75=schedule[_0x4cfc('0x45')];if(_0x33c75[_0xaf2987['id']])clearInterval(_0x33c75[_0xaf2987['id']]);_0x33c75[_0xaf2987['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x4cfc('0x46')](this,{'id':_0xaf2987['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0x4cfc('0x45')]=_0x33c75;}function startAllRefreshIntervals(){return db[_0x4cfc('0x3a')]['findAll']({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x4cfc('0x3c')](function(_0x1f75b0){var _0x4a52e8=_0x1f75b0[_0x4cfc('0x14')](function(_0x44078d){return refreshOauth2MicrosoftAccessToken(_0x44078d)[_0x4cfc('0x3c')](function(_0x17a030){startRefreshInterval(_0x17a030);});});return Promise[_0x4cfc('0x47')](_0x4a52e8);})[_0x4cfc('0x42')](function(_0xea6184){var _0x146882=_0xea6184?util[_0x4cfc('0x48')](_0xea6184,{'showHidden':![],'depth':null}):'';logger[_0x4cfc('0x43')]('[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s',_0x146882);});}module[_0x4cfc('0x49')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0xdbd5=['[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','lodash','jsonwebtoken','moment','request-promise','../../components/encryptor','../../config/environment','../../config/logger','../../config/schedule/cloud-provider','../../mysqldb','redis','defaults','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','profile','email','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','openid','offline_access','/token','map','type','Dynamics365','push','join','Outlook365','/.default','replace','data2','code','id_token','stringify','toString','base64','randomBytes','hex','response_type','redirect_uri','data4','response_mode','state','key','value','oauth2Claims','oauth2/','data1','set','decode','payload','iss','issuer','aud','audience','nonce','isAfter','unix','exp','resolve','then','data3','CloudProvider','findOne','refresh_token','data6','decryptString','POST','{TENANT_ID}','data5','access_token','update','catch','error','intervals','bind','findAll','all'];(function(_0x57ebb0,_0x3e878f){var _0x87cffd=function(_0x50b110){while(--_0x50b110){_0x57ebb0['push'](_0x57ebb0['shift']());}};_0x87cffd(++_0x3e878f);}(_0xdbd5,0xa0));var _0x5dbd=function(_0x4ed32d,_0x327695){_0x4ed32d=_0x4ed32d-0x0;var _0xf624df=_0xdbd5[_0x4ed32d];return _0xf624df;};'use strict';var _=require(_0x5dbd('0x0'));var crypto=require('crypto');var jwt=require(_0x5dbd('0x1'));var moment=require(_0x5dbd('0x2'));var Redis=require('ioredis');var rp=require(_0x5dbd('0x3'));var util=require('util');var encryptor=require(_0x5dbd('0x4'));var config=require(_0x5dbd('0x5'));var logger=require(_0x5dbd('0x6'))('api');var schedule=require(_0x5dbd('0x7'));var db=require(_0x5dbd('0x8'))['db'];config[_0x5dbd('0x9')]=_[_0x5dbd('0xa')](config[_0x5dbd('0x9')],{'host':_0x5dbd('0xb'),'port':0x18eb});var redis=new Redis(config[_0x5dbd('0x9')]);var MICROSOFT_AUTH_URL=_0x5dbd('0xc');var AZURE_AUTH_SCOPES={'Outlook365':['openid',_0x5dbd('0xd'),_0x5dbd('0xe'),'offline_access',_0x5dbd('0xf'),_0x5dbd('0x10'),_0x5dbd('0x11')],'Dynamics365':[_0x5dbd('0x12'),_0x5dbd('0x13')]};var MICROSOFT_AUTH_ENDPOINT='/authorize';var MICROSOFT_TOKEN_ENDPOINT=_0x5dbd('0x14');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x183a82){var _0x1afcdd=_[_0x5dbd('0x15')](AZURE_AUTH_SCOPES[_0x183a82['type']]);if(_0x183a82[_0x5dbd('0x16')]===_0x5dbd('0x17'))_0x1afcdd[_0x5dbd('0x18')](_0x183a82['data7']+'/.default');return _0x1afcdd[_0x5dbd('0x19')]('\x20');}function getAccessTokenScope(_0x50279d){if(_0x50279d[_0x5dbd('0x16')]===_0x5dbd('0x1a'))return _0x5dbd('0xf');if(_0x50279d['type']===_0x5dbd('0x17'))return _0x50279d['data7']+_0x5dbd('0x1b');}function generateMicrosoftAuthorizationUrl(_0x30f28f,_0x5a9354){var _0x4e199d=MICROSOFT_AUTH_URL[_0x5dbd('0x1c')]('{TENANT_ID}',_0x30f28f[_0x5dbd('0x1d')]);var _0x328fc6=[_0x5dbd('0x1e'),_0x5dbd('0x1f')];var _0xd902d8=Buffer['from'](JSON[_0x5dbd('0x20')]({'id':_0x5a9354}))[_0x5dbd('0x21')](_0x5dbd('0x22'));var _0x1e88eb=crypto[_0x5dbd('0x23')](0x10)[_0x5dbd('0x21')](_0x5dbd('0x24'));var _0x5e677e=getAuthorizationScopes(_0x30f28f);var _0x395fe5=[{'key':'client_id','value':_0x30f28f['data1']},{'key':_0x5dbd('0x25'),'value':encodeURIComponent(_0x328fc6[_0x5dbd('0x19')]('\x20'))},{'key':_0x5dbd('0x26'),'value':_0x30f28f[_0x5dbd('0x27')]},{'key':_0x5dbd('0x28'),'value':'form_post'},{'key':'scope','value':encodeURIComponent(_0x5e677e)},{'key':_0x5dbd('0x29'),'value':_0xd902d8},{'key':'nonce','value':_0x1e88eb},{'key':'prompt','value':'login'}];var _0x3df714=_0x4e199d+MICROSOFT_AUTH_ENDPOINT+'?'+_['map'](_0x395fe5,function(_0xaca15d){return _0xaca15d[_0x5dbd('0x2a')]+'='+_0xaca15d[_0x5dbd('0x2b')];})[_0x5dbd('0x19')]('&');_0x30f28f[_0x5dbd('0x2c')]={'issuer':_0x4e199d[_0x5dbd('0x1c')](_0x5dbd('0x2d'),''),'audience':_0x30f28f[_0x5dbd('0x2e')],'state':_0xd902d8,'nonce':_0x1e88eb};redis[_0x5dbd('0x2f')](_0xd902d8,JSON[_0x5dbd('0x20')](_0x30f28f));return _0x3df714;}function isValidIdToken(_0x5d7e39,_0x3a37e1){try{var _0x3a2466=jwt[_0x5dbd('0x30')](_0x5d7e39,{'complete':!![]});var _0x709e88=_0x3a2466[_0x5dbd('0x31')];if(_0x709e88[_0x5dbd('0x32')]!==_0x3a37e1[_0x5dbd('0x33')])return![];if(_0x709e88[_0x5dbd('0x34')]!==_0x3a37e1[_0x5dbd('0x35')])return![];if(_0x709e88[_0x5dbd('0x36')]!==_0x3a37e1[_0x5dbd('0x36')])return![];if(moment()[_0x5dbd('0x37')](moment[_0x5dbd('0x38')](_0x709e88[_0x5dbd('0x39')])))return![];return!![];}catch(_0x6ff3ad){throw _0x6ff3ad;}}function refreshOauth2MicrosoftAccessToken(_0x321632){return Promise[_0x5dbd('0x3a')]()[_0x5dbd('0x3b')](function(){if(_0x321632[_0x5dbd('0x3c')])return _0x321632;return db[_0x5dbd('0x3d')][_0x5dbd('0x3e')]({'where':{'id':_0x321632['id']},'raw':!![]});})[_0x5dbd('0x3b')](function(_0x42ef3d){var _0x2159d2={'grant_type':_0x5dbd('0x3f'),'refresh_token':_0x42ef3d[_0x5dbd('0x40')],'scope':getAccessTokenScope(_0x42ef3d),'redirect_uri':_0x42ef3d[_0x5dbd('0x27')],'client_id':_0x42ef3d[_0x5dbd('0x2e')],'client_secret':encryptor[_0x5dbd('0x41')](_0x42ef3d[_0x5dbd('0x3c')])};var _0x1eb87d={'method':_0x5dbd('0x42'),'uri':MICROSOFT_AUTH_URL[_0x5dbd('0x1c')](_0x5dbd('0x43'),_0x42ef3d[_0x5dbd('0x1d')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x2159d2,'json':!![]};return rp(_0x1eb87d);})[_0x5dbd('0x3b')](function(_0xcdfd92){_0x321632[_0x5dbd('0x44')]=_0xcdfd92[_0x5dbd('0x45')];_0x321632[_0x5dbd('0x40')]=_0xcdfd92['refresh_token'];return db[_0x5dbd('0x3d')][_0x5dbd('0x46')]({'data5':_0x321632[_0x5dbd('0x44')],'data6':_0x321632['data6']},{'where':{'id':_0x321632['id']}});})[_0x5dbd('0x3b')](function(){return _0x321632;})[_0x5dbd('0x47')](function(_0x309568){logger[_0x5dbd('0x48')]('Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s',_0x321632['id'],_0x309568);});}function getOauth2MicrosoftAccessToken(_0x5caef8,_0x13dda7){var _0x1b41b2={'grant_type':'authorization_code','code':_0x5caef8,'scope':getAccessTokenScope(_0x13dda7),'redirect_uri':_0x13dda7[_0x5dbd('0x27')],'client_id':_0x13dda7[_0x5dbd('0x2e')],'client_secret':encryptor[_0x5dbd('0x41')](_0x13dda7['data3'])};var _0x34ffa2={'method':_0x5dbd('0x42'),'uri':MICROSOFT_AUTH_URL[_0x5dbd('0x1c')](_0x5dbd('0x43'),_0x13dda7[_0x5dbd('0x1d')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x1b41b2,'json':!![]};return rp(_0x34ffa2);}function startRefreshInterval(_0xf71e55){var _0x410e93=schedule[_0x5dbd('0x49')];if(_0x410e93[_0xf71e55['id']])clearInterval(_0x410e93[_0xf71e55['id']]);_0x410e93[_0xf71e55['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x5dbd('0x4a')](this,{'id':_0xf71e55['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule['intervals']=_0x410e93;}function startAllRefreshIntervals(){return db[_0x5dbd('0x3d')][_0x5dbd('0x4b')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x5dbd('0x3b')](function(_0x15ab83){var _0xebed1f=_0x15ab83[_0x5dbd('0x15')](function(_0x5df020){return refreshOauth2MicrosoftAccessToken(_0x5df020)[_0x5dbd('0x3b')](function(_0x14f0e9){startRefreshInterval(_0x14f0e9);});});return Promise[_0x5dbd('0x4c')](_0xebed1f);})['catch'](function(_0x14e752){var _0x3b73ff=_0x14e752?util['inspect'](_0x14e752,{'showHidden':![],'depth':null}):'';logger['error'](_0x5dbd('0x4d'),_0x3b73ff);});}module[_0x5dbd('0x4e')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.rpc.js b/server/api/cloudProvider/cloudProvider.rpc.js index 998e6d1..46d4cce 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 _0x3e22=['http','request','then','info','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','code','error','CloudProvider,\x20%s,\x20%s','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client'];(function(_0x2ddb6d,_0x25d45b){var _0x56c103=function(_0x4f73c4){while(--_0x4f73c4){_0x2ddb6d['push'](_0x2ddb6d['shift']());}};_0x56c103(++_0x25d45b);}(_0x3e22,0xa8));var _0x23e2=function(_0x4cb8e7,_0x2e1d22){_0x4cb8e7=_0x4cb8e7-0x0;var _0x3d0188=_0x3e22[_0x4cb8e7];return _0x3d0188;};'use strict';var _=require('lodash');var util=require(_0x23e2('0x0'));var moment=require('moment');var BPromise=require(_0x23e2('0x1'));var rs=require(_0x23e2('0x2'));var fs=require('fs');var Redis=require(_0x23e2('0x3'));var db=require(_0x23e2('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x23e2('0x5'));var config=require(_0x23e2('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x23e2('0x7')][_0x23e2('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3a8351,_0x927fbb,_0xb71434){return new BPromise(function(_0x4c13ae,_0x64c91b){return client[_0x23e2('0x9')](_0x3a8351,_0xb71434)[_0x23e2('0xa')](function(_0x75da0a){logger[_0x23e2('0xb')]('CloudProvider,\x20%s,\x20%s',_0x927fbb,_0x23e2('0xc'));logger[_0x23e2('0xd')](_0x23e2('0xe'),_0x927fbb,_0x23e2('0xc'),JSON[_0x23e2('0xf')](_0x75da0a));if(_0x75da0a['error']){if(_0x75da0a['error'][_0x23e2('0x10')]===0x1f4){logger[_0x23e2('0x11')](_0x23e2('0x12'),_0x927fbb,_0x75da0a[_0x23e2('0x11')][_0x23e2('0x13')]);return _0x64c91b(_0x75da0a[_0x23e2('0x11')][_0x23e2('0x13')]);}logger[_0x23e2('0x11')](_0x23e2('0x12'),_0x927fbb,_0x75da0a[_0x23e2('0x11')][_0x23e2('0x13')]);return _0x4c13ae(_0x75da0a[_0x23e2('0x11')][_0x23e2('0x13')]);}else{logger[_0x23e2('0xb')]('CloudProvider,\x20%s,\x20%s',_0x927fbb,_0x23e2('0xc'));_0x4c13ae(_0x75da0a[_0x23e2('0x14')][_0x23e2('0x13')]);}})[_0x23e2('0x15')](function(_0x276c2d){logger[_0x23e2('0x11')](_0x23e2('0x12'),_0x927fbb,_0x276c2d);_0x64c91b(_0x276c2d);});});} \ No newline at end of file +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(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x6ac2,0x184));var _0x26ac=function(_0xa348e,_0xed07dc){_0xa348e=_0xa348e-0x0;var _0x10a57e=_0x6ac2[_0xa348e];return _0x10a57e;};'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 093d2ce..bfdd361 100644 --- a/server/api/cloudProvider/index.js +++ b/server/api/cloudProvider/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['isAuthenticated','/:id','show','post','create','delete','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','oauth2MicrosoftCallback','exports','express','Router','../../components/auth/service','get'];(function(_0x411add,_0x1aed38){var _0x238242=function(_0x4a1cd5){while(--_0x4a1cd5){_0x411add['push'](_0x411add['shift']());}};_0x238242(++_0x1aed38);}(_0x7a54,0x106));var _0x47a5=function(_0x19b2b6,_0x2dec56){_0x19b2b6=_0x19b2b6-0x0;var _0xf478bc=_0x7a54[_0x19b2b6];return _0xf478bc;};'use strict';var express=require(_0x47a5('0x0'));var router=express[_0x47a5('0x1')]();var auth=require(_0x47a5('0x2'));var controller=require('./cloudProvider.controller');router[_0x47a5('0x3')]('/',auth[_0x47a5('0x4')](),controller['index']);router[_0x47a5('0x3')](_0x47a5('0x5'),auth[_0x47a5('0x4')](),controller[_0x47a5('0x6')]);router[_0x47a5('0x7')]('/',auth['isAuthenticated'](),controller[_0x47a5('0x8')]);router['put'](_0x47a5('0x5'),auth[_0x47a5('0x4')](),controller['update']);router[_0x47a5('0x9')]('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0x47a5('0x3')](_0x47a5('0xa'),auth['isAuthenticated'](),controller[_0x47a5('0xb')]);router['post']('/oauth2/microsoft/callback',controller[_0x47a5('0xc')]);module[_0x47a5('0xd')]=router; \ No newline at end of file +var _0x5f2f=['exports','express','Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','destroy','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','oauth2MicrosoftCallback'];(function(_0x5c7e53,_0x174ce5){var _0x1c9af9=function(_0x38895d){while(--_0x38895d){_0x5c7e53['push'](_0x5c7e53['shift']());}};_0x1c9af9(++_0x174ce5);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2b93e1,_0x10e1d3){_0x2b93e1=_0x2b93e1-0x0;var _0x40f612=_0x5f2f[_0x2b93e1];return _0x40f612;};'use strict';var express=require(_0xf5f2('0x0'));var router=express[_0xf5f2('0x1')]();var auth=require(_0xf5f2('0x2'));var controller=require(_0xf5f2('0x3'));router[_0xf5f2('0x4')]('/',auth[_0xf5f2('0x5')](),controller[_0xf5f2('0x6')]);router[_0xf5f2('0x4')]('/:id',auth['isAuthenticated'](),controller[_0xf5f2('0x7')]);router[_0xf5f2('0x8')]('/',auth[_0xf5f2('0x5')](),controller[_0xf5f2('0x9')]);router[_0xf5f2('0xa')](_0xf5f2('0xb'),auth['isAuthenticated'](),controller[_0xf5f2('0xc')]);router[_0xf5f2('0xd')](_0xf5f2('0xb'),auth['isAuthenticated'](),controller[_0xf5f2('0xe')]);router[_0xf5f2('0x4')](_0xf5f2('0xf'),auth['isAuthenticated'](),controller[_0xf5f2('0x10')]);router['post']('/oauth2/microsoft/callback',controller[_0xf5f2('0x11')]);module[_0xf5f2('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 60bdb37..cb62ac5 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 _0x3c14=['sequelize','STRING','name'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0x3c14,0x186));var _0x43c1=function(_0x258b93,_0x188ccc){_0x258b93=_0x258b93-0x0;var _0x35484b=_0x3c14[_0x258b93];return _0x35484b;};'use strict';var Sequelize=require(_0x43c1('0x0'));module['exports']={'name':{'type':Sequelize[_0x43c1('0x1')],'unique':_0x43c1('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x43c1('0x1')]},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize[_0x43c1('0x1')]},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x43c1('0x1')]},'type':{'type':Sequelize[_0x43c1('0x1')]},'street':{'type':Sequelize[_0x43c1('0x1')]},'postalCode':{'type':Sequelize[_0x43c1('0x1')]},'city':{'type':Sequelize[_0x43c1('0x1')]},'country':{'type':Sequelize[_0x43c1('0x1')]},'email':{'type':Sequelize[_0x43c1('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x43c1('0x1')]}}; \ No newline at end of file +var _0x38ca=['STRING','name','sequelize'];(function(_0x128ee7,_0xbfbe00){var _0x38450a=function(_0x570931){while(--_0x570931){_0x128ee7['push'](_0x128ee7['shift']());}};_0x38450a(++_0xbfbe00);}(_0x38ca,0xb0));var _0xa38c=function(_0xa46cc9,_0x327f7d){_0xa46cc9=_0xa46cc9-0x0;var _0x5683ed=_0x38ca[_0xa46cc9];return _0x5683ed;};'use strict';var Sequelize=require(_0xa38c('0x0'));module['exports']={'name':{'type':Sequelize[_0xa38c('0x1')],'unique':_0xa38c('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xa38c('0x1')]},'companyId':{'type':Sequelize[_0xa38c('0x1')]},'website':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xa38c('0x1')]},'fax':{'type':Sequelize[_0xa38c('0x1')]},'type':{'type':Sequelize[_0xa38c('0x1')]},'street':{'type':Sequelize[_0xa38c('0x1')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0xa38c('0x1')]},'country':{'type':Sequelize[_0xa38c('0x1')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize[_0xa38c('0x1')]},'sPostalCode':{'type':Sequelize[_0xa38c('0x1')]},'sCity':{'type':Sequelize[_0xa38c('0x1')]},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa38c('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index c0945b7..48c5328 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 _0xe0ae=['intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','sort','where','filters','pick','filter','map','merge','includeAll','include','rows','catch','params','rawAttributes','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','addContacts','CmContact','ids','omit','getContacts','order','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','undefined','limit','count','set','Content-Range','apply','reject','then','get','Companies','UserProfileResource','destroy','end','error','stack','name','send','index','CmCompany','describe','model','keys','query'];(function(_0x3bcdb1,_0xcda140){var _0x40f0ec=function(_0x44ba03){while(--_0x44ba03){_0x3bcdb1['push'](_0x3bcdb1['shift']());}};_0x40f0ec(++_0xcda140);}(_0xe0ae,0x18d));var _0xee0a=function(_0x4d40dd,_0x39592b){_0x4d40dd=_0x4d40dd-0x0;var _0x1c51f2=_0xe0ae[_0x4d40dd];return _0x1c51f2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xee0a('0x0'));var zipdir=require(_0xee0a('0x1'));var jsonpatch=require(_0xee0a('0x2'));var rp=require(_0xee0a('0x3'));var moment=require(_0xee0a('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xee0a('0x5'));var util=require('util');var path=require(_0xee0a('0x6'));var sox=require(_0xee0a('0x7'));var csv=require('to-csv');var ejs=require(_0xee0a('0x8'));var fs=require('fs');var fs_extra=require(_0xee0a('0x9'));var _=require(_0xee0a('0xa'));var squel=require(_0xee0a('0xb'));var crypto=require(_0xee0a('0xc'));var jsforce=require(_0xee0a('0xd'));var deskjs=require(_0xee0a('0xe'));var toCsv=require(_0xee0a('0xf'));var querystring=require(_0xee0a('0x10'));var Papa=require(_0xee0a('0x11'));var Redis=require(_0xee0a('0x12'));var authService=require(_0xee0a('0x13'));var qs=require(_0xee0a('0x14'));var as=require(_0xee0a('0x15'));var hardwareService=require(_0xee0a('0x16'));var logger=require(_0xee0a('0x17'))(_0xee0a('0x18'));var utils=require(_0xee0a('0x19'));var config=require(_0xee0a('0x1a'));var licenseUtil=require(_0xee0a('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4b8d2d,_0x125f7a){_0x125f7a=_0x125f7a||0xcc;return function(_0x1571bd){if(_0x1571bd){return _0x4b8d2d[_0xee0a('0x1c')](_0x125f7a);}return _0x4b8d2d['status'](_0x125f7a)['end']();};}function respondWithResult(_0x319a55,_0x1be524){_0x1be524=_0x1be524||0xc8;return function(_0x5a18c7){if(_0x5a18c7){return _0x319a55[_0xee0a('0x1d')](_0x1be524)['json'](_0x5a18c7);}};}function respondWithFilteredResult(_0x2f27a4,_0x164e37){return function(_0x3d1ed0){if(_0x3d1ed0){var _0x46cdcd=typeof _0x164e37['offset']===_0xee0a('0x1e')&&typeof _0x164e37[_0xee0a('0x1f')]===_0xee0a('0x1e');var _0x1726ce=_0x3d1ed0[_0xee0a('0x20')];var _0x58e20b=_0x46cdcd?0x0:_0x164e37['offset'];var _0xbf627=_0x46cdcd?_0x3d1ed0[_0xee0a('0x20')]:_0x164e37['offset']+_0x164e37[_0xee0a('0x1f')];var _0x5a4341;if(_0xbf627>=_0x1726ce){_0xbf627=_0x1726ce;_0x5a4341=0xc8;}else{_0x5a4341=0xce;}_0x2f27a4[_0xee0a('0x1d')](_0x5a4341);return _0x2f27a4[_0xee0a('0x21')](_0xee0a('0x22'),_0x58e20b+'-'+_0xbf627+'/'+_0x1726ce)['json'](_0x3d1ed0);}return null;};}function patchUpdates(_0x4c3034){return function(_0x236353){try{jsonpatch[_0xee0a('0x23')](_0x236353,_0x4c3034,!![]);}catch(_0xb462af){return BPromise[_0xee0a('0x24')](_0xb462af);}return _0x236353['save']();};}function saveUpdates(_0x3fca79,_0x8a3794){return function(_0x145084){if(_0x145084){return _0x145084['update'](_0x3fca79)[_0xee0a('0x25')](function(_0x2a9310){return _0x2a9310;});}return null;};}function removeEntity(_0x33e798,_0x25af37){return function(_0x40ab10){if(_0x40ab10){return _0x40ab10['destroy']()['then'](function(){var _0xf089c0=_0x40ab10[_0xee0a('0x26')]({'plain':!![]});var _0x312099=_0xee0a('0x27');return db[_0xee0a('0x28')][_0xee0a('0x29')]({'where':{'type':_0x312099,'resourceId':_0xf089c0['id']}})['then'](function(){return _0x40ab10;});})['then'](function(){_0x33e798[_0xee0a('0x1d')](0xcc)[_0xee0a('0x2a')]();});}};}function handleEntityNotFound(_0x47ef0f,_0x2aa9a0){return function(_0x29ee24){if(!_0x29ee24){_0x47ef0f[_0xee0a('0x1c')](0x194);}return _0x29ee24;};}function handleError(_0x2a2ee0,_0x24d5ee){_0x24d5ee=_0x24d5ee||0x1f4;return function(_0x2dd2b1){logger[_0xee0a('0x2b')](_0x2dd2b1[_0xee0a('0x2c')]);if(_0x2dd2b1[_0xee0a('0x2d')]){delete _0x2dd2b1[_0xee0a('0x2d')];}_0x2a2ee0[_0xee0a('0x1d')](_0x24d5ee)[_0xee0a('0x2e')](_0x2dd2b1);};}exports[_0xee0a('0x2f')]=function(_0x2100d8,_0x3743bf){var _0x1761e9={},_0x5869c5={},_0x40f821={'count':0x0,'rows':[]};return db[_0xee0a('0x30')][_0xee0a('0x31')]()[_0xee0a('0x25')](function(_0x2cdb93){_0x5869c5[_0xee0a('0x32')]=_[_0xee0a('0x33')](_0x2cdb93);_0x5869c5[_0xee0a('0x34')]=_['keys'](_0x2100d8[_0xee0a('0x34')]);_0x5869c5['filters']=_[_0xee0a('0x35')](_0x5869c5[_0xee0a('0x32')],_0x5869c5[_0xee0a('0x34')]);_0x1761e9[_0xee0a('0x36')]=_[_0xee0a('0x35')](_0x5869c5['model'],qs['fields'](_0x2100d8[_0xee0a('0x34')][_0xee0a('0x37')]));_0x1761e9[_0xee0a('0x36')]=_0x1761e9[_0xee0a('0x36')][_0xee0a('0x38')]?_0x1761e9[_0xee0a('0x36')]:_0x5869c5[_0xee0a('0x32')];if(!_0x2100d8[_0xee0a('0x34')][_0xee0a('0x39')](_0xee0a('0x3a'))){_0x1761e9[_0xee0a('0x1f')]=qs[_0xee0a('0x1f')](_0x2100d8['query'][_0xee0a('0x1f')]);_0x1761e9[_0xee0a('0x3b')]=qs[_0xee0a('0x3b')](_0x2100d8[_0xee0a('0x34')][_0xee0a('0x3b')]);}_0x1761e9['order']=qs[_0xee0a('0x3c')](_0x2100d8[_0xee0a('0x34')][_0xee0a('0x3c')]);_0x1761e9[_0xee0a('0x3d')]=qs[_0xee0a('0x3e')](_[_0xee0a('0x3f')](_0x2100d8[_0xee0a('0x34')],_0x5869c5[_0xee0a('0x3e')]),_0x2cdb93);if(_0x2100d8[_0xee0a('0x34')][_0xee0a('0x40')]){_0x1761e9[_0xee0a('0x3d')]=_['merge'](_0x1761e9['where'],{'$or':_[_0xee0a('0x41')](_0x1761e9['attributes'],function(_0x285753){var _0x390c31={};_0x390c31[_0x285753]={'$like':'%'+_0x2100d8[_0xee0a('0x34')]['filter']+'%'};return _0x390c31;})});}_0x1761e9=_[_0xee0a('0x42')]({},_0x1761e9,_0x2100d8['options']);var _0x1a5fbf={'where':_0x1761e9[_0xee0a('0x3d')]};return db[_0xee0a('0x30')]['count'](_0x1a5fbf)[_0xee0a('0x25')](function(_0x42b12){_0x40f821[_0xee0a('0x20')]=_0x42b12;if(_0x2100d8[_0xee0a('0x34')][_0xee0a('0x43')]){_0x1761e9[_0xee0a('0x44')]=[{'all':!![]}];}return db['CmCompany']['findAll'](_0x1761e9);})['then'](function(_0x9ec47b){_0x40f821[_0xee0a('0x45')]=_0x9ec47b;return _0x40f821;})[_0xee0a('0x25')](respondWithFilteredResult(_0x3743bf,_0x1761e9))[_0xee0a('0x46')](handleError(_0x3743bf,null));})[_0xee0a('0x46')](handleError(_0x3743bf,null));};exports['show']=function(_0x5ae865,_0x16829e){var _0x448b1e={'raw':![],'where':{'id':_0x5ae865[_0xee0a('0x47')]['id']}},_0x359c72={};_0x359c72[_0xee0a('0x32')]=_[_0xee0a('0x33')](db[_0xee0a('0x30')][_0xee0a('0x48')]);_0x359c72[_0xee0a('0x34')]=_[_0xee0a('0x33')](_0x5ae865['query']);_0x359c72[_0xee0a('0x3e')]=_[_0xee0a('0x35')](_0x359c72[_0xee0a('0x32')],_0x359c72[_0xee0a('0x34')]);_0x448b1e[_0xee0a('0x36')]=_['intersection'](_0x359c72['model'],qs[_0xee0a('0x37')](_0x5ae865[_0xee0a('0x34')][_0xee0a('0x37')]));_0x448b1e[_0xee0a('0x36')]=_0x448b1e['attributes'][_0xee0a('0x38')]?_0x448b1e['attributes']:_0x359c72[_0xee0a('0x32')];if(_0x5ae865[_0xee0a('0x34')][_0xee0a('0x43')]){_0x448b1e[_0xee0a('0x44')]=[{'all':!![]}];}_0x448b1e=_[_0xee0a('0x42')]({},_0x448b1e,_0x5ae865[_0xee0a('0x49')]);return db['CmCompany']['find'](_0x448b1e)[_0xee0a('0x25')](handleEntityNotFound(_0x16829e,null))[_0xee0a('0x25')](respondWithResult(_0x16829e,null))[_0xee0a('0x46')](handleError(_0x16829e,null));};exports['create']=function(_0xfd70a2,_0x5a6dc0){return db['CmCompany'][_0xee0a('0x4a')](_0xfd70a2[_0xee0a('0x4b')],{})[_0xee0a('0x25')](function(_0x3763d9){var _0x49fee1=_0xfd70a2[_0xee0a('0x4c')][_0xee0a('0x26')]({'plain':!![]});if(!_0x49fee1)throw new Error(_0xee0a('0x4d'));if(_0x49fee1['role']===_0xee0a('0x4c')){var _0xa2c069=_0x3763d9['get']({'plain':!![]});var _0x26a7ad='Companies';return db[_0xee0a('0x4e')][_0xee0a('0x4f')]({'where':{'name':_0x26a7ad,'userProfileId':_0x49fee1[_0xee0a('0x50')]},'raw':!![]})['then'](function(_0x2dffdf){if(_0x2dffdf&&_0x2dffdf[_0xee0a('0x51')]===0x0){return db['UserProfileResource'][_0xee0a('0x4a')]({'name':_0xa2c069[_0xee0a('0x2d')],'resourceId':_0xa2c069['id'],'type':_0x2dffdf[_0xee0a('0x2d')],'sectionId':_0x2dffdf['id']},{})[_0xee0a('0x25')](function(){return _0x3763d9;});}else{return _0x3763d9;}})[_0xee0a('0x46')](function(_0x160ab6){logger['error'](_0xee0a('0x52'),_0x160ab6);throw _0x160ab6;});}return _0x3763d9;})[_0xee0a('0x25')](respondWithResult(_0x5a6dc0,0xc9))[_0xee0a('0x46')](handleError(_0x5a6dc0,null));};exports[_0xee0a('0x53')]=function(_0x35705f,_0x20cb11){if(_0x35705f[_0xee0a('0x4b')]['id']){delete _0x35705f[_0xee0a('0x4b')]['id'];}return db[_0xee0a('0x30')][_0xee0a('0x4f')]({'where':{'id':_0x35705f[_0xee0a('0x47')]['id']}})['then'](handleEntityNotFound(_0x20cb11,null))['then'](saveUpdates(_0x35705f['body'],null))[_0xee0a('0x25')](respondWithResult(_0x20cb11,null))[_0xee0a('0x46')](handleError(_0x20cb11,null));};exports[_0xee0a('0x29')]=function(_0x5c2462,_0x1e5c52){return db[_0xee0a('0x30')][_0xee0a('0x4f')]({'where':{'id':_0x5c2462[_0xee0a('0x47')]['id']}})[_0xee0a('0x25')](handleEntityNotFound(_0x1e5c52,null))[_0xee0a('0x25')](removeEntity(_0x1e5c52,null))[_0xee0a('0x46')](handleError(_0x1e5c52,null));};exports[_0xee0a('0x31')]=function(_0x43e146,_0x4e2402){return db[_0xee0a('0x30')]['describe']()[_0xee0a('0x25')](respondWithResult(_0x4e2402,null))[_0xee0a('0x46')](handleError(_0x4e2402,null));};exports[_0xee0a('0x54')]=function(_0x38bf51,_0x485613,_0x29200b){return db[_0xee0a('0x55')]['find']({'where':{'id':_0x38bf51[_0xee0a('0x47')]['id']}})[_0xee0a('0x25')](handleEntityNotFound(_0x485613,null))[_0xee0a('0x25')](function(_0x350d0c){if(_0x350d0c){return _0x350d0c[_0xee0a('0x54')](_0x38bf51[_0xee0a('0x4b')][_0xee0a('0x56')],_[_0xee0a('0x57')](_0x38bf51[_0xee0a('0x4b')],[_0xee0a('0x56'),'id'])||{});}})[_0xee0a('0x25')](respondWithResult(_0x485613,null))[_0xee0a('0x46')](handleError(_0x485613,null));};exports[_0xee0a('0x58')]=function(_0x23f08c,_0x3c94c8,_0x599971){var _0x5f0225={};var _0x46a214={};var _0xe9a978;var _0x59a7c7;return db[_0xee0a('0x30')]['findOne']({'where':{'id':_0x23f08c[_0xee0a('0x47')]['id']}})[_0xee0a('0x25')](handleEntityNotFound(_0x3c94c8,null))['then'](function(_0x44214e){if(_0x44214e){_0xe9a978=_0x44214e;_0x46a214['model']=_[_0xee0a('0x33')](db[_0xee0a('0x55')]['rawAttributes']);_0x46a214[_0xee0a('0x34')]=_['keys'](_0x23f08c[_0xee0a('0x34')]);_0x46a214[_0xee0a('0x3e')]=_['intersection'](_0x46a214['model'],_0x46a214[_0xee0a('0x34')]);_0x5f0225[_0xee0a('0x36')]=_['intersection'](_0x46a214[_0xee0a('0x32')],qs[_0xee0a('0x37')](_0x23f08c['query']['fields']));_0x5f0225['attributes']=_0x5f0225[_0xee0a('0x36')]['length']?_0x5f0225[_0xee0a('0x36')]:_0x46a214['model'];_0x5f0225[_0xee0a('0x59')]=qs[_0xee0a('0x3c')](_0x23f08c[_0xee0a('0x34')][_0xee0a('0x3c')]);_0x5f0225[_0xee0a('0x3d')]=qs['filters'](_[_0xee0a('0x3f')](_0x23f08c[_0xee0a('0x34')],_0x46a214[_0xee0a('0x3e')]));if(_0x23f08c[_0xee0a('0x34')][_0xee0a('0x40')]){_0x5f0225[_0xee0a('0x3d')]=_['merge'](_0x5f0225['where'],{'$or':_['map'](_0x5f0225['attributes'],function(_0x57e83a){var _0x4435dd={};_0x4435dd[_0x57e83a]={'$like':'%'+_0x23f08c['query'][_0xee0a('0x40')]+'%'};return _0x4435dd;})});}_0x5f0225=_[_0xee0a('0x42')]({},_0x5f0225,_0x23f08c['options']);return _0xe9a978[_0xee0a('0x58')](_0x5f0225);}})[_0xee0a('0x25')](function(_0x56139d){if(_0x56139d){_0x59a7c7=_0x56139d[_0xee0a('0x38')];if(!_0x23f08c['query']['hasOwnProperty'](_0xee0a('0x3a'))){_0x5f0225[_0xee0a('0x1f')]=qs[_0xee0a('0x1f')](_0x23f08c[_0xee0a('0x34')]['limit']);_0x5f0225['offset']=qs[_0xee0a('0x3b')](_0x23f08c[_0xee0a('0x34')][_0xee0a('0x3b')]);}return _0xe9a978[_0xee0a('0x58')](_0x5f0225);}})['then'](function(_0x380c5b){if(_0x380c5b){return _0x380c5b?{'count':_0x59a7c7,'rows':_0x380c5b}:null;}})[_0xee0a('0x25')](respondWithResult(_0x3c94c8,null))[_0xee0a('0x46')](handleError(_0x3c94c8,null));}; \ No newline at end of file +var _0xc9e7=['moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','crypto','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','get','Companies','UserProfileResource','error','stack','name','send','index','CmCompany','keys','query','filters','model','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','include','rows','catch','show','params','rawAttributes','length','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','describe','addContacts','CmContact','ids','omit','getContacts','findOne','order','map','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x1599a0,_0x34b3f8){var _0x4f57ed=function(_0x1822d8){while(--_0x1822d8){_0x1599a0['push'](_0x1599a0['shift']());}};_0x4f57ed(++_0x34b3f8);}(_0xc9e7,0xb5));var _0x7c9e=function(_0x1ddcbe,_0x203dfb){_0x1ddcbe=_0x1ddcbe-0x0;var _0x29741d=_0xc9e7[_0x1ddcbe];return _0x29741d;};'use strict';var emlformat=require(_0x7c9e('0x0'));var rimraf=require(_0x7c9e('0x1'));var zipdir=require(_0x7c9e('0x2'));var jsonpatch=require(_0x7c9e('0x3'));var rp=require(_0x7c9e('0x4'));var moment=require(_0x7c9e('0x5'));var BPromise=require(_0x7c9e('0x6'));var Mustache=require(_0x7c9e('0x7'));var util=require(_0x7c9e('0x8'));var path=require('path');var sox=require(_0x7c9e('0x9'));var csv=require('to-csv');var ejs=require(_0x7c9e('0xa'));var fs=require('fs');var fs_extra=require(_0x7c9e('0xb'));var _=require(_0x7c9e('0xc'));var squel=require('squel');var crypto=require(_0x7c9e('0xd'));var jsforce=require(_0x7c9e('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x7c9e('0xf'));var querystring=require(_0x7c9e('0x10'));var Papa=require('papaparse');var Redis=require(_0x7c9e('0x11'));var authService=require(_0x7c9e('0x12'));var qs=require(_0x7c9e('0x13'));var as=require(_0x7c9e('0x14'));var hardwareService=require(_0x7c9e('0x15'));var logger=require(_0x7c9e('0x16'))(_0x7c9e('0x17'));var utils=require(_0x7c9e('0x18'));var config=require(_0x7c9e('0x19'));var licenseUtil=require(_0x7c9e('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x337582,_0x563893){_0x563893=_0x563893||0xcc;return function(_0xaba2e8){if(_0xaba2e8){return _0x337582['sendStatus'](_0x563893);}return _0x337582['status'](_0x563893)[_0x7c9e('0x1b')]();};}function respondWithResult(_0x5a2188,_0x434eee){_0x434eee=_0x434eee||0xc8;return function(_0x12c6e3){if(_0x12c6e3){return _0x5a2188[_0x7c9e('0x1c')](_0x434eee)[_0x7c9e('0x1d')](_0x12c6e3);}};}function respondWithFilteredResult(_0x56aa79,_0x106391){return function(_0x289638){if(_0x289638){var _0x4ff7ea=typeof _0x106391['offset']===_0x7c9e('0x1e')&&typeof _0x106391[_0x7c9e('0x1f')]==='undefined';var _0x5ae28e=_0x289638[_0x7c9e('0x20')];var _0x4c32a2=_0x4ff7ea?0x0:_0x106391['offset'];var _0x41e69a=_0x4ff7ea?_0x289638['count']:_0x106391[_0x7c9e('0x21')]+_0x106391[_0x7c9e('0x1f')];var _0x49f445;if(_0x41e69a>=_0x5ae28e){_0x41e69a=_0x5ae28e;_0x49f445=0xc8;}else{_0x49f445=0xce;}_0x56aa79[_0x7c9e('0x1c')](_0x49f445);return _0x56aa79[_0x7c9e('0x22')](_0x7c9e('0x23'),_0x4c32a2+'-'+_0x41e69a+'/'+_0x5ae28e)[_0x7c9e('0x1d')](_0x289638);}return null;};}function patchUpdates(_0x62e2b8){return function(_0x50c1ca){try{jsonpatch[_0x7c9e('0x24')](_0x50c1ca,_0x62e2b8,!![]);}catch(_0x1f26ec){return BPromise[_0x7c9e('0x25')](_0x1f26ec);}return _0x50c1ca[_0x7c9e('0x26')]();};}function saveUpdates(_0xb527f,_0x3d8217){return function(_0x36365c){if(_0x36365c){return _0x36365c[_0x7c9e('0x27')](_0xb527f)[_0x7c9e('0x28')](function(_0x54075a){return _0x54075a;});}return null;};}function removeEntity(_0x31fb6b,_0x4d0c6a){return function(_0xe4e1a8){if(_0xe4e1a8){return _0xe4e1a8['destroy']()[_0x7c9e('0x28')](function(){var _0x40bd2b=_0xe4e1a8[_0x7c9e('0x29')]({'plain':!![]});var _0x316f31=_0x7c9e('0x2a');return db[_0x7c9e('0x2b')]['destroy']({'where':{'type':_0x316f31,'resourceId':_0x40bd2b['id']}})['then'](function(){return _0xe4e1a8;});})[_0x7c9e('0x28')](function(){_0x31fb6b[_0x7c9e('0x1c')](0xcc)[_0x7c9e('0x1b')]();});}};}function handleEntityNotFound(_0x3956fe,_0x44d35f){return function(_0x274eae){if(!_0x274eae){_0x3956fe['sendStatus'](0x194);}return _0x274eae;};}function handleError(_0xb97807,_0x7a5a19){_0x7a5a19=_0x7a5a19||0x1f4;return function(_0x2e3ce5){logger[_0x7c9e('0x2c')](_0x2e3ce5[_0x7c9e('0x2d')]);if(_0x2e3ce5[_0x7c9e('0x2e')]){delete _0x2e3ce5[_0x7c9e('0x2e')];}_0xb97807[_0x7c9e('0x1c')](_0x7a5a19)[_0x7c9e('0x2f')](_0x2e3ce5);};}exports[_0x7c9e('0x30')]=function(_0x1ad25a,_0x5ccd46){var _0x15d7c2={},_0x2395e7={},_0x52ba68={'count':0x0,'rows':[]};return db[_0x7c9e('0x31')]['describe']()[_0x7c9e('0x28')](function(_0x5d8e81){_0x2395e7['model']=_[_0x7c9e('0x32')](_0x5d8e81);_0x2395e7['query']=_['keys'](_0x1ad25a[_0x7c9e('0x33')]);_0x2395e7[_0x7c9e('0x34')]=_['intersection'](_0x2395e7[_0x7c9e('0x35')],_0x2395e7[_0x7c9e('0x33')]);_0x15d7c2['attributes']=_[_0x7c9e('0x36')](_0x2395e7[_0x7c9e('0x35')],qs['fields'](_0x1ad25a['query'][_0x7c9e('0x37')]));_0x15d7c2['attributes']=_0x15d7c2['attributes']['length']?_0x15d7c2[_0x7c9e('0x38')]:_0x2395e7['model'];if(!_0x1ad25a[_0x7c9e('0x33')][_0x7c9e('0x39')](_0x7c9e('0x3a'))){_0x15d7c2[_0x7c9e('0x1f')]=qs[_0x7c9e('0x1f')](_0x1ad25a[_0x7c9e('0x33')]['limit']);_0x15d7c2[_0x7c9e('0x21')]=qs[_0x7c9e('0x21')](_0x1ad25a[_0x7c9e('0x33')][_0x7c9e('0x21')]);}_0x15d7c2['order']=qs[_0x7c9e('0x3b')](_0x1ad25a[_0x7c9e('0x33')][_0x7c9e('0x3b')]);_0x15d7c2[_0x7c9e('0x3c')]=qs[_0x7c9e('0x34')](_[_0x7c9e('0x3d')](_0x1ad25a[_0x7c9e('0x33')],_0x2395e7['filters']),_0x5d8e81);if(_0x1ad25a[_0x7c9e('0x33')][_0x7c9e('0x3e')]){_0x15d7c2[_0x7c9e('0x3c')]=_[_0x7c9e('0x3f')](_0x15d7c2[_0x7c9e('0x3c')],{'$or':_['map'](_0x15d7c2[_0x7c9e('0x38')],function(_0x1b28a4){var _0x5e741f={};_0x5e741f[_0x1b28a4]={'$like':'%'+_0x1ad25a[_0x7c9e('0x33')]['filter']+'%'};return _0x5e741f;})});}_0x15d7c2=_['merge']({},_0x15d7c2,_0x1ad25a[_0x7c9e('0x40')]);var _0xa074c6={'where':_0x15d7c2['where']};return db[_0x7c9e('0x31')][_0x7c9e('0x20')](_0xa074c6)[_0x7c9e('0x28')](function(_0x3dcace){_0x52ba68[_0x7c9e('0x20')]=_0x3dcace;if(_0x1ad25a[_0x7c9e('0x33')]['includeAll']){_0x15d7c2[_0x7c9e('0x41')]=[{'all':!![]}];}return db['CmCompany']['findAll'](_0x15d7c2);})[_0x7c9e('0x28')](function(_0x515381){_0x52ba68[_0x7c9e('0x42')]=_0x515381;return _0x52ba68;})[_0x7c9e('0x28')](respondWithFilteredResult(_0x5ccd46,_0x15d7c2))[_0x7c9e('0x43')](handleError(_0x5ccd46,null));})[_0x7c9e('0x43')](handleError(_0x5ccd46,null));};exports[_0x7c9e('0x44')]=function(_0x4bb89d,_0x2e9050){var _0x10e579={'raw':![],'where':{'id':_0x4bb89d[_0x7c9e('0x45')]['id']}},_0x10db06={};_0x10db06[_0x7c9e('0x35')]=_[_0x7c9e('0x32')](db[_0x7c9e('0x31')][_0x7c9e('0x46')]);_0x10db06['query']=_['keys'](_0x4bb89d['query']);_0x10db06[_0x7c9e('0x34')]=_[_0x7c9e('0x36')](_0x10db06[_0x7c9e('0x35')],_0x10db06[_0x7c9e('0x33')]);_0x10e579['attributes']=_[_0x7c9e('0x36')](_0x10db06[_0x7c9e('0x35')],qs[_0x7c9e('0x37')](_0x4bb89d['query'][_0x7c9e('0x37')]));_0x10e579[_0x7c9e('0x38')]=_0x10e579['attributes'][_0x7c9e('0x47')]?_0x10e579[_0x7c9e('0x38')]:_0x10db06['model'];if(_0x4bb89d[_0x7c9e('0x33')][_0x7c9e('0x48')]){_0x10e579[_0x7c9e('0x41')]=[{'all':!![]}];}_0x10e579=_['merge']({},_0x10e579,_0x4bb89d['options']);return db[_0x7c9e('0x31')][_0x7c9e('0x49')](_0x10e579)[_0x7c9e('0x28')](handleEntityNotFound(_0x2e9050,null))[_0x7c9e('0x28')](respondWithResult(_0x2e9050,null))[_0x7c9e('0x43')](handleError(_0x2e9050,null));};exports[_0x7c9e('0x4a')]=function(_0x46bccd,_0x2c27a2){return db[_0x7c9e('0x31')]['create'](_0x46bccd[_0x7c9e('0x4b')],{})[_0x7c9e('0x28')](function(_0x27d6b4){var _0x14dc94=_0x46bccd[_0x7c9e('0x4c')]['get']({'plain':!![]});if(!_0x14dc94)throw new Error(_0x7c9e('0x4d'));if(_0x14dc94[_0x7c9e('0x4e')]===_0x7c9e('0x4c')){var _0x4f1903=_0x27d6b4[_0x7c9e('0x29')]({'plain':!![]});var _0x47a6c2=_0x7c9e('0x2a');return db[_0x7c9e('0x4f')][_0x7c9e('0x49')]({'where':{'name':_0x47a6c2,'userProfileId':_0x14dc94[_0x7c9e('0x50')]},'raw':!![]})[_0x7c9e('0x28')](function(_0xf9223d){if(_0xf9223d&&_0xf9223d[_0x7c9e('0x51')]===0x0){return db[_0x7c9e('0x2b')][_0x7c9e('0x4a')]({'name':_0x4f1903[_0x7c9e('0x2e')],'resourceId':_0x4f1903['id'],'type':_0xf9223d['name'],'sectionId':_0xf9223d['id']},{})[_0x7c9e('0x28')](function(){return _0x27d6b4;});}else{return _0x27d6b4;}})['catch'](function(_0x2a6ae2){logger[_0x7c9e('0x2c')](_0x7c9e('0x52'),_0x2a6ae2);throw _0x2a6ae2;});}return _0x27d6b4;})[_0x7c9e('0x28')](respondWithResult(_0x2c27a2,0xc9))[_0x7c9e('0x43')](handleError(_0x2c27a2,null));};exports[_0x7c9e('0x27')]=function(_0x4d124b,_0x7f3ca6){if(_0x4d124b['body']['id']){delete _0x4d124b['body']['id'];}return db[_0x7c9e('0x31')]['find']({'where':{'id':_0x4d124b['params']['id']}})[_0x7c9e('0x28')](handleEntityNotFound(_0x7f3ca6,null))['then'](saveUpdates(_0x4d124b['body'],null))[_0x7c9e('0x28')](respondWithResult(_0x7f3ca6,null))['catch'](handleError(_0x7f3ca6,null));};exports[_0x7c9e('0x53')]=function(_0x190414,_0x1bf474){return db[_0x7c9e('0x31')][_0x7c9e('0x49')]({'where':{'id':_0x190414[_0x7c9e('0x45')]['id']}})[_0x7c9e('0x28')](handleEntityNotFound(_0x1bf474,null))['then'](removeEntity(_0x1bf474,null))[_0x7c9e('0x43')](handleError(_0x1bf474,null));};exports[_0x7c9e('0x54')]=function(_0x5cca40,_0x5977cf){return db[_0x7c9e('0x31')][_0x7c9e('0x54')]()[_0x7c9e('0x28')](respondWithResult(_0x5977cf,null))[_0x7c9e('0x43')](handleError(_0x5977cf,null));};exports[_0x7c9e('0x55')]=function(_0x5d5d1f,_0x264c93,_0x28655d){return db[_0x7c9e('0x56')][_0x7c9e('0x49')]({'where':{'id':_0x5d5d1f[_0x7c9e('0x45')]['id']}})[_0x7c9e('0x28')](handleEntityNotFound(_0x264c93,null))['then'](function(_0x430a69){if(_0x430a69){return _0x430a69[_0x7c9e('0x55')](_0x5d5d1f['body'][_0x7c9e('0x57')],_[_0x7c9e('0x58')](_0x5d5d1f[_0x7c9e('0x4b')],[_0x7c9e('0x57'),'id'])||{});}})[_0x7c9e('0x28')](respondWithResult(_0x264c93,null))['catch'](handleError(_0x264c93,null));};exports[_0x7c9e('0x59')]=function(_0x4d4a71,_0x35c892,_0x543840){var _0x87ade={};var _0x5f268b={};var _0x4b7f38;var _0x218cae;return db[_0x7c9e('0x31')][_0x7c9e('0x5a')]({'where':{'id':_0x4d4a71[_0x7c9e('0x45')]['id']}})['then'](handleEntityNotFound(_0x35c892,null))[_0x7c9e('0x28')](function(_0x96b627){if(_0x96b627){_0x4b7f38=_0x96b627;_0x5f268b['model']=_[_0x7c9e('0x32')](db[_0x7c9e('0x56')][_0x7c9e('0x46')]);_0x5f268b[_0x7c9e('0x33')]=_[_0x7c9e('0x32')](_0x4d4a71[_0x7c9e('0x33')]);_0x5f268b['filters']=_[_0x7c9e('0x36')](_0x5f268b[_0x7c9e('0x35')],_0x5f268b[_0x7c9e('0x33')]);_0x87ade[_0x7c9e('0x38')]=_[_0x7c9e('0x36')](_0x5f268b['model'],qs[_0x7c9e('0x37')](_0x4d4a71['query'][_0x7c9e('0x37')]));_0x87ade[_0x7c9e('0x38')]=_0x87ade['attributes'][_0x7c9e('0x47')]?_0x87ade[_0x7c9e('0x38')]:_0x5f268b[_0x7c9e('0x35')];_0x87ade[_0x7c9e('0x5b')]=qs[_0x7c9e('0x3b')](_0x4d4a71[_0x7c9e('0x33')][_0x7c9e('0x3b')]);_0x87ade[_0x7c9e('0x3c')]=qs[_0x7c9e('0x34')](_[_0x7c9e('0x3d')](_0x4d4a71['query'],_0x5f268b['filters']));if(_0x4d4a71['query']['filter']){_0x87ade[_0x7c9e('0x3c')]=_[_0x7c9e('0x3f')](_0x87ade[_0x7c9e('0x3c')],{'$or':_[_0x7c9e('0x5c')](_0x87ade[_0x7c9e('0x38')],function(_0x1383e9){var _0x54cf41={};_0x54cf41[_0x1383e9]={'$like':'%'+_0x4d4a71['query'][_0x7c9e('0x3e')]+'%'};return _0x54cf41;})});}_0x87ade=_['merge']({},_0x87ade,_0x4d4a71[_0x7c9e('0x40')]);return _0x4b7f38['getContacts'](_0x87ade);}})[_0x7c9e('0x28')](function(_0x38d023){if(_0x38d023){_0x218cae=_0x38d023[_0x7c9e('0x47')];if(!_0x4d4a71[_0x7c9e('0x33')][_0x7c9e('0x39')](_0x7c9e('0x3a'))){_0x87ade[_0x7c9e('0x1f')]=qs['limit'](_0x4d4a71[_0x7c9e('0x33')]['limit']);_0x87ade[_0x7c9e('0x21')]=qs[_0x7c9e('0x21')](_0x4d4a71[_0x7c9e('0x33')][_0x7c9e('0x21')]);}return _0x4b7f38[_0x7c9e('0x59')](_0x87ade);}})[_0x7c9e('0x28')](function(_0x5be71e){if(_0x5be71e){return _0x5be71e?{'count':_0x218cae,'rows':_0x5be71e}:null;}})[_0x7c9e('0x28')](respondWithResult(_0x35c892,null))['catch'](handleError(_0x35c892,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 979f310..f110f20 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 _0xda61=['moment','bluebird','request-promise','path','../../config/environment','./cmCompany.attributes','exports','define','CmCompany','cm_companies','lodash','util','../../config/logger'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xda61,0x65));var _0x1da6=function(_0x42ae90,_0xc9e59b){_0x42ae90=_0x42ae90-0x0;var _0x5c4f06=_0xda61[_0x42ae90];return _0x5c4f06;};'use strict';var _=require(_0x1da6('0x0'));var util=require(_0x1da6('0x1'));var logger=require(_0x1da6('0x2'))('api');var moment=require(_0x1da6('0x3'));var BPromise=require(_0x1da6('0x4'));var rp=require(_0x1da6('0x5'));var fs=require('fs');var path=require(_0x1da6('0x6'));var rimraf=require('rimraf');var config=require(_0x1da6('0x7'));var attributes=require(_0x1da6('0x8'));module[_0x1da6('0x9')]=function(_0x2e258f,_0x4dc9d8){return _0x2e258f[_0x1da6('0xa')](_0x1da6('0xb'),attributes,{'tableName':_0x1da6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2fc0=['request-promise','rimraf','../../config/environment','./cmCompany.attributes','define','CmCompany','cm_companies','../../config/logger','api','moment','bluebird'];(function(_0x3a465a,_0x3e8001){var _0x1ed244=function(_0x1349e9){while(--_0x1349e9){_0x3a465a['push'](_0x3a465a['shift']());}};_0x1ed244(++_0x3e8001);}(_0x2fc0,0x188));var _0x02fc=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x2fc0[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x02fc('0x0'))(_0x02fc('0x1'));var moment=require(_0x02fc('0x2'));var BPromise=require(_0x02fc('0x3'));var rp=require(_0x02fc('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x02fc('0x5'));var config=require(_0x02fc('0x6'));var attributes=require(_0x02fc('0x7'));module['exports']=function(_0x53c27e,_0x504a95){return _0x53c27e[_0x02fc('0x8')](_0x02fc('0x9'),attributes,{'tableName':_0x02fc('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.rpc.js b/server/api/cmCompany/cmCompany.rpc.js index 96fa416..bdff505 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 _0xe560=['../../config/environment','jayson/promise','request','then','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0xb9c7d5,_0x1d1dbc){var _0x1fe79e=function(_0x1d0265){while(--_0x1d0265){_0xb9c7d5['push'](_0xb9c7d5['shift']());}};_0x1fe79e(++_0x1d1dbc);}(_0xe560,0x7a));var _0x0e56=function(_0x431dd3,_0x1581d8){_0x431dd3=_0x431dd3-0x0;var _0x2058b4=_0xe560[_0x431dd3];return _0x2058b4;};'use strict';var _=require(_0x0e56('0x0'));var util=require(_0x0e56('0x1'));var moment=require(_0x0e56('0x2'));var BPromise=require(_0x0e56('0x3'));var rs=require(_0x0e56('0x4'));var fs=require('fs');var Redis=require(_0x0e56('0x5'));var db=require(_0x0e56('0x6'))['db'];var utils=require(_0x0e56('0x7'));var logger=require(_0x0e56('0x8'))(_0x0e56('0x9'));var config=require(_0x0e56('0xa'));var jayson=require(_0x0e56('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1e6a46,_0x8e037,_0x1718dd){return new BPromise(function(_0x8845bf,_0x3673ad){return client[_0x0e56('0xc')](_0x1e6a46,_0x1718dd)[_0x0e56('0xd')](function(_0x5512e9){logger[_0x0e56('0xe')](_0x0e56('0xf'),_0x8e037,_0x0e56('0x10'));logger[_0x0e56('0x11')]('CmCompany,\x20%s,\x20%s,\x20%s',_0x8e037,'request\x20sent',JSON[_0x0e56('0x12')](_0x5512e9));if(_0x5512e9['error']){if(_0x5512e9['error'][_0x0e56('0x13')]===0x1f4){logger[_0x0e56('0x14')]('CmCompany,\x20%s,\x20%s',_0x8e037,_0x5512e9[_0x0e56('0x14')][_0x0e56('0x15')]);return _0x3673ad(_0x5512e9[_0x0e56('0x14')][_0x0e56('0x15')]);}logger[_0x0e56('0x14')](_0x0e56('0xf'),_0x8e037,_0x5512e9[_0x0e56('0x14')][_0x0e56('0x15')]);return _0x8845bf(_0x5512e9[_0x0e56('0x14')][_0x0e56('0x15')]);}else{logger[_0x0e56('0xe')](_0x0e56('0xf'),_0x8e037,_0x0e56('0x10'));_0x8845bf(_0x5512e9['result'][_0x0e56('0x15')]);}})['catch'](function(_0x3a78fb){logger[_0x0e56('0x14')]('CmCompany,\x20%s,\x20%s',_0x8e037,_0x3a78fb);_0x3673ad(_0x3a78fb);});});} \ No newline at end of file +var _0xfa3b=['../../config/environment','jayson/promise','client','request','CmCompany,\x20%s,\x20%s','request\x20sent','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x5cd253,_0x4162da){var _0x36e179=function(_0x597977){while(--_0x597977){_0x5cd253['push'](_0x5cd253['shift']());}};_0x36e179(++_0x4162da);}(_0xfa3b,0x1c5));var _0xbfa3=function(_0x474035,_0x41e639){_0x474035=_0x474035-0x0;var _0x1b58e0=_0xfa3b[_0x474035];return _0x1b58e0;};'use strict';var _=require(_0xbfa3('0x0'));var util=require(_0xbfa3('0x1'));var moment=require(_0xbfa3('0x2'));var BPromise=require(_0xbfa3('0x3'));var rs=require(_0xbfa3('0x4'));var fs=require('fs');var Redis=require(_0xbfa3('0x5'));var db=require(_0xbfa3('0x6'))['db'];var utils=require(_0xbfa3('0x7'));var logger=require(_0xbfa3('0x8'))('rpc');var config=require(_0xbfa3('0x9'));var jayson=require(_0xbfa3('0xa'));var client=jayson[_0xbfa3('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x262cf0,_0xe8c5b4,_0x3a32b4){return new BPromise(function(_0x53a7d9,_0x21a4c3){return client[_0xbfa3('0xc')](_0x262cf0,_0x3a32b4)['then'](function(_0x206b9d){logger['info'](_0xbfa3('0xd'),_0xe8c5b4,_0xbfa3('0xe'));logger['debug'](_0xbfa3('0xf'),_0xe8c5b4,_0xbfa3('0xe'),JSON[_0xbfa3('0x10')](_0x206b9d));if(_0x206b9d[_0xbfa3('0x11')]){if(_0x206b9d[_0xbfa3('0x11')][_0xbfa3('0x12')]===0x1f4){logger[_0xbfa3('0x11')]('CmCompany,\x20%s,\x20%s',_0xe8c5b4,_0x206b9d[_0xbfa3('0x11')][_0xbfa3('0x13')]);return _0x21a4c3(_0x206b9d[_0xbfa3('0x11')][_0xbfa3('0x13')]);}logger[_0xbfa3('0x11')](_0xbfa3('0xd'),_0xe8c5b4,_0x206b9d[_0xbfa3('0x11')]['message']);return _0x53a7d9(_0x206b9d[_0xbfa3('0x11')][_0xbfa3('0x13')]);}else{logger[_0xbfa3('0x14')]('CmCompany,\x20%s,\x20%s',_0xe8c5b4,_0xbfa3('0xe'));_0x53a7d9(_0x206b9d[_0xbfa3('0x15')][_0xbfa3('0x13')]);}})['catch'](function(_0x2cd260){logger[_0xbfa3('0x11')](_0xbfa3('0xd'),_0xe8c5b4,_0x2cd260);_0x21a4c3(_0x2cd260);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 6e51a8c..513f07c 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 _0x2293=['/:id/contacts','getContacts','post','create','addContacts','put','update','delete','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','index','/describe','describe','get','/:id','isAuthenticated','show'];(function(_0x4b8d18,_0x51cf18){var _0x47aa67=function(_0x17679f){while(--_0x17679f){_0x4b8d18['push'](_0x4b8d18['shift']());}};_0x47aa67(++_0x51cf18);}(_0x2293,0x6d));var _0x3229=function(_0x2a31e4,_0x484990){_0x2a31e4=_0x2a31e4-0x0;var _0x39c146=_0x2293[_0x2a31e4];return _0x39c146;};'use strict';var multer=require(_0x3229('0x0'));var util=require(_0x3229('0x1'));var path=require(_0x3229('0x2'));var timeout=require(_0x3229('0x3'));var express=require('express');var router=express[_0x3229('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x3229('0x5'));var interaction=require(_0x3229('0x6'));var config=require(_0x3229('0x7'));var controller=require(_0x3229('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x3229('0x9')]);router['get'](_0x3229('0xa'),auth['isAuthenticated'](),controller[_0x3229('0xb')]);router[_0x3229('0xc')](_0x3229('0xd'),auth[_0x3229('0xe')](),controller[_0x3229('0xf')]);router[_0x3229('0xc')](_0x3229('0x10'),auth[_0x3229('0xe')](),controller[_0x3229('0x11')]);router[_0x3229('0x12')]('/',auth['isAuthenticated'](),controller[_0x3229('0x13')]);router['post'](_0x3229('0x10'),auth['isAuthenticated'](),controller[_0x3229('0x14')]);router[_0x3229('0x15')](_0x3229('0xd'),auth['isAuthenticated'](),controller[_0x3229('0x16')]);router[_0x3229('0x17')]('/:id',auth[_0x3229('0xe')](),controller[_0x3229('0x18')]);module['exports']=router; \ No newline at end of file +var _0xf820=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','isAuthenticated','index','get','/describe','show','/:id/contacts','getContacts','create','post','addContacts','/:id','delete','destroy','multer','util','path','express'];(function(_0x37d77c,_0x4317e0){var _0x50c8f1=function(_0x20644b){while(--_0x20644b){_0x37d77c['push'](_0x37d77c['shift']());}};_0x50c8f1(++_0x4317e0);}(_0xf820,0x86));var _0x0f82=function(_0x33668d,_0x364922){_0x33668d=_0x33668d-0x0;var _0x1346e2=_0xf820[_0x33668d];return _0x1346e2;};'use strict';var multer=require(_0x0f82('0x0'));var util=require(_0x0f82('0x1'));var path=require(_0x0f82('0x2'));var timeout=require('connect-timeout');var express=require(_0x0f82('0x3'));var router=express[_0x0f82('0x4')]();var fs_extra=require(_0x0f82('0x5'));var auth=require(_0x0f82('0x6'));var interaction=require(_0x0f82('0x7'));var config=require(_0x0f82('0x8'));var controller=require(_0x0f82('0x9'));router['get']('/',auth[_0x0f82('0xa')](),controller[_0x0f82('0xb')]);router[_0x0f82('0xc')](_0x0f82('0xd'),auth['isAuthenticated'](),controller['describe']);router[_0x0f82('0xc')]('/:id',auth[_0x0f82('0xa')](),controller[_0x0f82('0xe')]);router['get'](_0x0f82('0xf'),auth[_0x0f82('0xa')](),controller[_0x0f82('0x10')]);router['post']('/',auth[_0x0f82('0xa')](),controller[_0x0f82('0x11')]);router[_0x0f82('0x12')]('/:id/contacts',auth[_0x0f82('0xa')](),controller[_0x0f82('0x13')]);router['put'](_0x0f82('0x14'),auth['isAuthenticated'](),controller['update']);router[_0x0f82('0x15')](_0x0f82('0x14'),auth[_0x0f82('0xa')](),controller[_0x0f82('0x16')]);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 604581b..dde9600 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 _0x0b0e=['exports','STRING','TEXT','INTEGER','DATE','NOW','lodash'];(function(_0x3485c9,_0x1b2e25){var _0x382b23=function(_0x3a6895){while(--_0x3a6895){_0x3485c9['push'](_0x3485c9['shift']());}};_0x382b23(++_0x1b2e25);}(_0x0b0e,0x187));var _0xe0b0=function(_0x419e17,_0x7fe78c){_0x419e17=_0x419e17-0x0;var _0x1f2044=_0x0b0e[_0x419e17];return _0x1f2044;};'use strict';var _=require(_0xe0b0('0x0'));var Sequelize=require('sequelize');module[_0xe0b0('0x1')]={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize[_0xe0b0('0x2')]},'street':{'type':Sequelize[_0xe0b0('0x2')]},'postalCode':{'type':Sequelize[_0xe0b0('0x2')]},'city':{'type':Sequelize[_0xe0b0('0x2')]},'country':{'type':Sequelize[_0xe0b0('0x2')]},'dateOfBirth':{'type':Sequelize[_0xe0b0('0x2')]},'description':{'type':Sequelize[_0xe0b0('0x3')]},'phone':{'type':Sequelize[_0xe0b0('0x2')]},'mobile':{'type':Sequelize[_0xe0b0('0x2')]},'fax':{'type':Sequelize[_0xe0b0('0x2')]},'email':{'type':Sequelize[_0xe0b0('0x2')]},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize['STRING']},'fb_data':{'type':Sequelize[_0xe0b0('0x2')]},'twitter':{'type':Sequelize[_0xe0b0('0x2')]},'skype':{'type':Sequelize[_0xe0b0('0x2')]},'teams':{'type':Sequelize[_0xe0b0('0x2')]},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize[_0xe0b0('0x2')]},'wechat':{'type':Sequelize[_0xe0b0('0x2')]},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize[_0xe0b0('0x4')]},'priority':{'type':Sequelize[_0xe0b0('0x4')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xe0b0('0x5')],'defaultValue':Sequelize[_0xe0b0('0x6')]},'dialTimezone':{'type':Sequelize[_0xe0b0('0x2')]},'utcOffset':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x2032=['sequelize','exports','STRING','TEXT','INTEGER','UNSIGNED','NOW'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0x2032,0xd9));var _0x2203=function(_0x49c099,_0x3e6dde){_0x49c099=_0x49c099-0x0;var _0x5ab6cb=_0x2032[_0x49c099];return _0x5ab6cb;};'use strict';var _=require('lodash');var Sequelize=require(_0x2203('0x0'));module[_0x2203('0x1')]={'firstName':{'type':Sequelize[_0x2203('0x2')],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0x2203('0x2')]},'postalCode':{'type':Sequelize[_0x2203('0x2')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x2203('0x2')]},'dateOfBirth':{'type':Sequelize[_0x2203('0x2')]},'description':{'type':Sequelize[_0x2203('0x3')]},'phone':{'type':Sequelize[_0x2203('0x2')]},'mobile':{'type':Sequelize[_0x2203('0x2')]},'fax':{'type':Sequelize[_0x2203('0x2')]},'email':{'type':Sequelize[_0x2203('0x2')]},'url':{'type':Sequelize[_0x2203('0x2')]},'facebook':{'type':Sequelize[_0x2203('0x2')]},'fb_data':{'type':Sequelize[_0x2203('0x2')]},'twitter':{'type':Sequelize[_0x2203('0x2')]},'skype':{'type':Sequelize['STRING']},'teams':{'type':Sequelize['STRING']},'viber':{'type':Sequelize[_0x2203('0x2')]},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize[_0x2203('0x2')]},'telegram':{'type':Sequelize[_0x2203('0x2')]},'UserId':{'type':Sequelize[_0x2203('0x4')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x2203('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':Sequelize[_0x2203('0x6')]},'dialTimezone':{'type':Sequelize['STRING']},'utcOffset':{'type':Sequelize[_0x2203('0x4')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 07e22d1..b3fdf49 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 _0x43fe=['ratingValue','referer','subject','substatus','openchannel','externalUrl','Interaction','fullname','sortBy','slice','moment','bluebird','util','path','lodash','squel','papaparse','ioredis','../../config/logger','api','../../config/environment/shared','../../mysqldb','defaults','localhost','socket.io-emitter','redis','register','status','json','undefined','limit','count','offset','Content-Range','update','destroy','then','end','sendStatus','error','name','send','index','CmContact','keys','length','startsWith','cf_','push','CmCustomField','findOne','trimStart','all','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','select','field','color','from','tools_tags','cm_contacts','left_join','uc.CmContactId\x20=\x20c.id','cm_contact_has_tags','ct.CmContactId\x20=\x20c.id','t.id\x20=\x20ct.TagId','c.deletedAt\x20IS\x20NULL','expr','parseSearch','search','sqlOperator','conditions','find','Tag','value','split','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','and','uc.UserId\x20=\x20?','dateOfBirth','fieldType','DATE','buildExpression','text','start','map','filter','isNil','Contact','isEmpty','ListId','c.ListId\x20IN\x20?','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','tag','isArray','replace','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.lastName\x20LIKE\x20?','group','c.id','QueryTypes','clone','DESC','having','t.id\x20IN\x20?','resolve','role','agent','some','c.ListId\x20IS\x20NULL','toString','keyBy','merge','c.firstName','c.lastName','c.phone','c.ListId','c.createdAt','c.deletedAt','c.CompanyId','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','sequelize','Tags','rows','catch','params','columnName','displayName','analytics','findAll','alias','custom','values','body','get','mergeWith','tags','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmHopperFinal','ReportAgentPreview','VoiceCallReport','ChatQueueReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','dialTimezone','timezones','utcOffset','bulkCreate','each','duplicates','$or','spread','show','describe','$and','cf_%d','omit','format','table','setFields','id\x20=\x20?','toParam','phone','getTags','rawAttributes','options','setTags','ids','getHoppers','pick','ContactId','includeAll','include','getHopperHistories','CmHopperHistory','getHopperFinals','uploadCsv','No\x20ListId\x20specified','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','binding_keys','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','file','0777','child_process','fork','../../components/import/cm/csv','pid','upload','createReadStream','parse','meta','import','binding','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','exit','getJourney','mail','sms','fax','whatsapp','-createdAt','channel','includes','Invalid\x20channel','toLowerCase','range','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','voice','uniqueid','destination','starttime','endtime','duration','note','createdAt','userDisposition','UserId','findAndCountAll','startCase','Website','Account','closedAt','disposition','secondDisposition','thirdDisposition','key','Owner','browserName','customerIp','customerPort','deviceModel','osName','ratingType'];(function(_0x15a4db,_0xd1c9f0){var _0x2a3d4a=function(_0x558c42){while(--_0x558c42){_0x15a4db['push'](_0x15a4db['shift']());}};_0x2a3d4a(++_0xd1c9f0);}(_0x43fe,0x12c));var _0xe43f=function(_0x29bdf8,_0x42eff4){_0x29bdf8=_0x29bdf8-0x0;var _0x56005f=_0x43fe[_0x29bdf8];return _0x56005f;};'use strict';var moment=require(_0xe43f('0x0'));var BPromise=require(_0xe43f('0x1'));var util=require(_0xe43f('0x2'));var path=require(_0xe43f('0x3'));var fs=require('fs');var _=require(_0xe43f('0x4'));var squel=require(_0xe43f('0x5'));var Papa=require(_0xe43f('0x6'));var Redis=require(_0xe43f('0x7'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var logger=require(_0xe43f('0x8'))(_0xe43f('0x9'));var config=require('../../config/environment');var shared=require(_0xe43f('0xa'));var db=require(_0xe43f('0xb'))['db'];config['redis']=_[_0xe43f('0xc')](config['redis'],{'host':_0xe43f('0xd'),'port':0x18eb});var socket=require(_0xe43f('0xe'))(new Redis(config[_0xe43f('0xf')]));require('./cmContact.socket')[_0xe43f('0x10')](socket);function respondWithResult(_0x4adb54,_0x36b63c){_0x36b63c=_0x36b63c||0xc8;return function(_0x4bae64){if(_0x4bae64){return _0x4adb54[_0xe43f('0x11')](_0x36b63c)[_0xe43f('0x12')](_0x4bae64);}};}function respondWithFilteredResult(_0x158ece,_0x4ffe00){return function(_0x3ec1e5){if(_0x3ec1e5){var _0x3a821b=typeof _0x4ffe00['offset']===_0xe43f('0x13')&&typeof _0x4ffe00[_0xe43f('0x14')]===_0xe43f('0x13');var _0x824a68=_0x3ec1e5[_0xe43f('0x15')];var _0x45f5db=_0x3a821b?0x0:_0x4ffe00[_0xe43f('0x16')];var _0x43f71f=_0x3a821b?_0x3ec1e5[_0xe43f('0x15')]:_0x4ffe00[_0xe43f('0x16')]+_0x4ffe00['limit'];var _0x3b4283;if(_0x43f71f>=_0x824a68){_0x43f71f=_0x824a68;_0x3b4283=0xc8;}else{_0x3b4283=0xce;}_0x158ece[_0xe43f('0x11')](_0x3b4283);return _0x158ece['set'](_0xe43f('0x17'),_0x45f5db+'-'+_0x43f71f+'/'+_0x824a68)[_0xe43f('0x12')](_0x3ec1e5);}return null;};}function saveUpdates(_0x9be2fe){return function(_0x442189){if(_0x442189){return _0x442189[_0xe43f('0x18')](_0x9be2fe)['then'](function(_0x217d74){return _0x217d74;});}return null;};}function removeEntity(_0x396c99){return function(_0x1d0f6b){if(_0x1d0f6b){return _0x1d0f6b[_0xe43f('0x19')]()[_0xe43f('0x1a')](function(){_0x396c99['status'](0xcc)[_0xe43f('0x1b')]();});}};}function handleEntityNotFound(_0x2cba66){return function(_0x4d3a5b){if(!_0x4d3a5b){_0x2cba66[_0xe43f('0x1c')](0x194);}return _0x4d3a5b;};}function handleError(_0x398f28,_0x5d1a9b){_0x5d1a9b=_0x5d1a9b||0x1f4;return function(_0x3a7678){logger[_0xe43f('0x1d')](_0x3a7678['stack']);if(_0x3a7678[_0xe43f('0x1e')]){delete _0x3a7678[_0xe43f('0x1e')];}_0x398f28[_0xe43f('0x11')](_0x5d1a9b)[_0xe43f('0x1f')](_0x3a7678);};}exports[_0xe43f('0x20')]=function(_0x500930,_0x1bd1cf){var _0x44e14a={},_0x29b914={},_0x1851cd={'count':0x0,'rows':[]};return db[_0xe43f('0x21')]['describe']()[_0xe43f('0x1a')](function(_0x526a89){var _0x4f15de=[];for(var _0x128415=0x0;_0x1284150x1){_0xc9eb74['or'](_0xe43f('0x63'),qs[_0xe43f('0x64')](_0x27b1c9),null);}else{if(qs[_0xe43f('0x65')](_0x27b1c9)){_0xc9eb74['or'](_0xe43f('0x66'),_0x27b1c9+'%');_0xc9eb74['or'](_0xe43f('0x67'),_0x27b1c9+'%');_0xc9eb74['or'](_0xe43f('0x68'),_0x27b1c9+'%');_0xc9eb74['or'](_0xe43f('0x69'),_0x27b1c9+'%');}else if(qs[_0xe43f('0x6a')](_0x27b1c9)){_0xc9eb74['or'](_0xe43f('0x6b'),_0x27b1c9+'%');}else{_0xc9eb74['or']('c.firstName\x20LIKE\x20?','%'+_0x27b1c9+'%');_0xc9eb74['or'](_0xe43f('0x6c'),'%'+_0x27b1c9+'%');_0xc9eb74['or'](_0xe43f('0x6b'),'%'+_0x27b1c9+'%');}}}}_0x5f441f[_0xe43f('0x36')](_0xc9eb74);_0x5f441f[_0xe43f('0x6d')](_0xe43f('0x6e'));var _0x5cbcd6={'type':db['Sequelize'][_0xe43f('0x6f')]['SELECT'],'raw':!![]};var _0xc4612d=_0x5f441f[_0xe43f('0x70')]()[_0xe43f('0x38')](_0xe43f('0x6e'));if(_0x44e14a[_0xe43f('0x34')]){_0x44e14a[_0xe43f('0x34')][_0xe43f('0x4c')](function(_0x9390c1){_0x5f441f[_0xe43f('0x34')]('c.'+_0x9390c1[0x0],_0x9390c1[0x1]===_0xe43f('0x71')?![]:!![]);});}if(!_[_0xe43f('0x5b')](_0x58381d)){_0x5f441f[_0xe43f('0x72')](_0x1707de);_0xc4612d[_0xe43f('0x36')](_0xe43f('0x73'),_0x58381d);}BPromise[_0xe43f('0x74')]()['then'](function(){if(!_0x583bda)return;if(_0x500930['user'][_0xe43f('0x75')]!==_0xe43f('0x76'))return;if(!_[_0xe43f('0x77')](_0x583bda['conditions'],[_0xe43f('0x38'),_0xe43f('0x4e')])){return _0x500930['user']['getLists']({'attributes':['id'],'raw':!![]})['then'](function(_0x18cef4){if(_['isEmpty'](_0x18cef4)){_0xc4612d[_0xe43f('0x36')]('c.ListId\x20IS\x20NULL');_0x5f441f[_0xe43f('0x36')](_0xe43f('0x78'));}else{_0xc4612d[_0xe43f('0x36')]('c.ListId\x20IN\x20?',_[_0xe43f('0x57')](_0x18cef4,'id'));_0x5f441f['where']('c.ListId\x20IN\x20?',_[_0xe43f('0x57')](_0x18cef4,'id'));}});}})['then'](function(){if(_0x500930['user'][_0xe43f('0x75')]==='agent'&&!_0x583bda&&!_0x500930['query'][_0xe43f('0x5c')])return[];return db['sequelize'][_0xe43f('0x2d')](_0xc4612d['toString'](),_0x5cbcd6);})[_0xe43f('0x1a')](function(_0x120880){_0x1851cd['count']=_0x120880[_0xe43f('0x23')];if(_0x1851cd[_0xe43f('0x15')]===0x0)return[];return db['sequelize']['query'](_0xd97e93[_0xe43f('0x79')](),_0x5cbcd6)[_0xe43f('0x1a')](function(_0x25521c){_0xbd3f12=_[_0xe43f('0x7a')](_0x25521c,'id');_0x5cbcd6=_[_0xe43f('0x7b')](_0x5cbcd6,{'model':db[_0xe43f('0x21')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x500930[_0xe43f('0x2d')][_0xe43f('0x31')]){_0x44e14a[_0xe43f('0x30')][_0xe43f('0x4c')](function(_0x1f0987){_0x5f441f['field']('c.'+_0x1f0987);});}else{_0x5f441f[_0xe43f('0x38')](_0xe43f('0x6e'));_0x5f441f[_0xe43f('0x38')](_0xe43f('0x7c'));_0x5f441f[_0xe43f('0x38')](_0xe43f('0x7d'));_0x5f441f[_0xe43f('0x38')](_0xe43f('0x7e'));_0x5f441f[_0xe43f('0x38')]('c.mobile');_0x5f441f[_0xe43f('0x38')]('c.fax');_0x5f441f[_0xe43f('0x38')]('c.email');_0x5f441f[_0xe43f('0x38')](_0xe43f('0x7f'));_0x5f441f[_0xe43f('0x38')](_0xe43f('0x80'));_0x5f441f[_0xe43f('0x38')](_0xe43f('0x81'));_0x5f441f[_0xe43f('0x38')](_0xe43f('0x82'));_0x5f441f[_0xe43f('0x38')](_0xe43f('0x83'),_0xe43f('0x84'));}if(_0x44e14a[_0xe43f('0x14')])_0x5f441f[_0xe43f('0x14')](_0x44e14a[_0xe43f('0x14')]);if(_0x44e14a[_0xe43f('0x16')])_0x5f441f[_0xe43f('0x16')](_0x44e14a[_0xe43f('0x16')]);return db[_0xe43f('0x85')][_0xe43f('0x2d')](_0x5f441f[_0xe43f('0x79')](),_0x5cbcd6);});})[_0xe43f('0x1a')](function(_0x46b68a){_0x46b68a[_0xe43f('0x4c')](function(_0x52a357){if(_0x52a357[_0xe43f('0x84')]){_0x52a357[_0xe43f('0x86')]=[];_0x52a357[_0xe43f('0x84')]['split'](',')[_0xe43f('0x4c')](function(_0x3a7dd2){_0x52a357[_0xe43f('0x86')][_0xe43f('0x26')](_0xbd3f12[_0x3a7dd2]);});}delete _0x52a357['TagIds'];});_0x1851cd[_0xe43f('0x87')]=_0x46b68a;return _0x1851cd;})[_0xe43f('0x1a')](respondWithFilteredResult(_0x1bd1cf,_0x44e14a));})[_0xe43f('0x88')](handleError(_0x1bd1cf,null));};exports[_0xe43f('0x19')]=function(_0xf9b6b1,_0x1a8925){return db[_0xe43f('0x21')][_0xe43f('0x48')]({'where':{'id':_0xf9b6b1[_0xe43f('0x89')]['id']}})[_0xe43f('0x1a')](handleEntityNotFound(_0x1a8925,null))[_0xe43f('0x1a')](removeEntity(_0x1a8925,null))[_0xe43f('0x88')](handleError(_0x1a8925,null));};exports['describe']=function(_0xbed09d,_0x2c9b0b){return db['CmContact']['describe']()['then'](function(_0x5c29ce){delete _0x5c29ce['tags'];for(var _0x5709f5=0x0;_0x5709f5=_0x19741d){_0x2e405d=_0x19741d;_0xa4a093=0xc8;}else{_0xa4a093=0xce;}_0xeddf17[_0x33da('0x12')](_0xa4a093);return _0xeddf17[_0x33da('0x18')](_0x33da('0x19'),_0x24b722+'-'+_0x2e405d+'/'+_0x19741d)[_0x33da('0x13')](_0x165687);}return null;};}function saveUpdates(_0x1eb739){return function(_0x168d01){if(_0x168d01){return _0x168d01[_0x33da('0x1a')](_0x1eb739)[_0x33da('0x1b')](function(_0x29131b){return _0x29131b;});}return null;};}function removeEntity(_0x20dec6){return function(_0x3e4609){if(_0x3e4609){return _0x3e4609[_0x33da('0x1c')]()[_0x33da('0x1b')](function(){_0x20dec6['status'](0xcc)[_0x33da('0x1d')]();});}};}function handleEntityNotFound(_0x2dc585){return function(_0x41350c){if(!_0x41350c){_0x2dc585[_0x33da('0x1e')](0x194);}return _0x41350c;};}function handleError(_0xf4add0,_0x525335){_0x525335=_0x525335||0x1f4;return function(_0x1aa252){logger['error'](_0x1aa252[_0x33da('0x1f')]);if(_0x1aa252[_0x33da('0x20')]){delete _0x1aa252['name'];}_0xf4add0['status'](_0x525335)[_0x33da('0x21')](_0x1aa252);};}exports[_0x33da('0x22')]=function(_0x1786c2,_0x5682a7){var _0x5a94d2={},_0x35b15a={},_0x340a46={'count':0x0,'rows':[]};return db[_0x33da('0x23')][_0x33da('0x24')]()[_0x33da('0x1b')](function(_0x1b53f8){var _0x42ac02=[];for(var _0x4a483f=0x0;_0x4a483f0x1){_0x7cfa4a['or'](_0x33da('0x63'),qs[_0x33da('0x64')](_0x36d075),null);}else{if(qs[_0x33da('0x65')](_0x36d075)){_0x7cfa4a['or'](_0x33da('0x66'),_0x36d075+'%');_0x7cfa4a['or'](_0x33da('0x67'),_0x36d075+'%');_0x7cfa4a['or'](_0x33da('0x68'),_0x36d075+'%');_0x7cfa4a['or'](_0x33da('0x69'),_0x36d075+'%');}else if(qs[_0x33da('0x6a')](_0x36d075)){_0x7cfa4a['or']('c.email\x20LIKE\x20?',_0x36d075+'%');}else{_0x7cfa4a['or'](_0x33da('0x6b'),'%'+_0x36d075+'%');_0x7cfa4a['or'](_0x33da('0x6c'),'%'+_0x36d075+'%');_0x7cfa4a['or'](_0x33da('0x6d'),'%'+_0x36d075+'%');}}}}_0x4f27c1[_0x33da('0x39')](_0x7cfa4a);_0x4f27c1[_0x33da('0x6e')](_0x33da('0x6f'));var _0x4acb02={'type':db['Sequelize'][_0x33da('0x70')][_0x33da('0x71')],'raw':!![]};var _0x31f5de=_0x4f27c1[_0x33da('0x72')]()[_0x33da('0x3a')](_0x33da('0x6f'));if(_0x5a94d2[_0x33da('0x37')]){_0x5a94d2[_0x33da('0x37')][_0x33da('0x51')](function(_0x510c49){_0x4f27c1['order']('c.'+_0x510c49[0x0],_0x510c49[0x1]===_0x33da('0x73')?![]:!![]);});}if(!_[_0x33da('0x5c')](_0x50f7c3)){_0x4f27c1['having'](_0x447eaa);_0x31f5de[_0x33da('0x39')](_0x33da('0x74'),_0x50f7c3);}BPromise[_0x33da('0x75')]()[_0x33da('0x1b')](function(){if(!_0xb46d55)return;if(_0x1786c2[_0x33da('0x76')][_0x33da('0x77')]!=='agent')return;if(!_[_0x33da('0x78')](_0xb46d55[_0x33da('0x4b')],['field',_0x33da('0x79')])){return _0x1786c2[_0x33da('0x76')][_0x33da('0x7a')]({'attributes':['id'],'raw':!![]})[_0x33da('0x1b')](function(_0xc867f){if(_[_0x33da('0x5c')](_0xc867f)){_0x31f5de[_0x33da('0x39')]('c.ListId\x20IS\x20NULL');_0x4f27c1[_0x33da('0x39')](_0x33da('0x7b'));}else{_0x31f5de[_0x33da('0x39')](_0x33da('0x7c'),_[_0x33da('0x50')](_0xc867f,'id'));_0x4f27c1[_0x33da('0x39')]('c.ListId\x20IN\x20?',_[_0x33da('0x50')](_0xc867f,'id'));}});}})['then'](function(){if(_0x1786c2['user'][_0x33da('0x77')]===_0x33da('0x7d')&&!_0xb46d55&&!_0x1786c2[_0x33da('0x31')][_0x33da('0x5d')])return[];return db['sequelize']['query'](_0x31f5de[_0x33da('0x7e')](),_0x4acb02);})[_0x33da('0x1b')](function(_0x275c6c){_0x340a46[_0x33da('0x17')]=_0x275c6c[_0x33da('0x2d')];if(_0x340a46[_0x33da('0x17')]===0x0)return[];return db[_0x33da('0x7f')][_0x33da('0x31')](_0x3dbcc5['toString'](),_0x4acb02)[_0x33da('0x1b')](function(_0x45abb8){_0x366303=_[_0x33da('0x80')](_0x45abb8,'id');_0x4acb02=_[_0x33da('0x81')](_0x4acb02,{'model':db[_0x33da('0x23')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1786c2['query'][_0x33da('0x34')]){_0x5a94d2[_0x33da('0x35')]['forEach'](function(_0x2ca2c8){_0x4f27c1['field']('c.'+_0x2ca2c8);});}else{_0x4f27c1[_0x33da('0x3a')](_0x33da('0x6f'));_0x4f27c1['field'](_0x33da('0x82'));_0x4f27c1[_0x33da('0x3a')]('c.lastName');_0x4f27c1[_0x33da('0x3a')](_0x33da('0x83'));_0x4f27c1[_0x33da('0x3a')](_0x33da('0x84'));_0x4f27c1['field'](_0x33da('0x85'));_0x4f27c1[_0x33da('0x3a')]('c.email');_0x4f27c1[_0x33da('0x3a')](_0x33da('0x86'));_0x4f27c1['field'](_0x33da('0x87'));_0x4f27c1[_0x33da('0x3a')]('c.deletedAt');_0x4f27c1['field'](_0x33da('0x88'));_0x4f27c1['field'](_0x33da('0x89'),'TagIds');}if(_0x5a94d2[_0x33da('0x15')])_0x4f27c1[_0x33da('0x15')](_0x5a94d2[_0x33da('0x15')]);if(_0x5a94d2[_0x33da('0x16')])_0x4f27c1[_0x33da('0x16')](_0x5a94d2['offset']);return db['sequelize'][_0x33da('0x31')](_0x4f27c1[_0x33da('0x7e')](),_0x4acb02);});})[_0x33da('0x1b')](function(_0x12dff0){_0x12dff0[_0x33da('0x51')](function(_0x4ad5c3){if(_0x4ad5c3[_0x33da('0x8a')]){_0x4ad5c3[_0x33da('0x8b')]=[];_0x4ad5c3['TagIds'][_0x33da('0x4f')](',')[_0x33da('0x51')](function(_0x7b23b9){_0x4ad5c3['Tags']['push'](_0x366303[_0x7b23b9]);});}delete _0x4ad5c3[_0x33da('0x8a')];});_0x340a46[_0x33da('0x8c')]=_0x12dff0;return _0x340a46;})['then'](respondWithFilteredResult(_0x5682a7,_0x5a94d2));})[_0x33da('0x8d')](handleError(_0x5682a7,null));};exports[_0x33da('0x1c')]=function(_0x3e4c29,_0x238c58){return db[_0x33da('0x23')]['find']({'where':{'id':_0x3e4c29[_0x33da('0x8e')]['id']}})[_0x33da('0x1b')](handleEntityNotFound(_0x238c58,null))['then'](removeEntity(_0x238c58,null))['catch'](handleError(_0x238c58,null));};exports[_0x33da('0x24')]=function(_0x1bb992,_0x5ab93f){return db[_0x33da('0x23')]['describe']()['then'](function(_0x3c786f){delete _0x3c786f[_0x33da('0x8f')];for(var _0x528a97=0x0;_0x528a97{}\s\\|]/g,'-');_0xc4cbc6(null,util['format'](_0xbc3d('0x25'),path[_0xbc3d('0x26')](_0x46ff71[_0xbc3d('0x23')],path['extname'](_0x46ff71[_0xbc3d('0x23')])),Date['now'](),path[_0xbc3d('0x27')](_0x46ff71[_0xbc3d('0x23')])));}})});router['post']('/csv',upload[_0xbc3d('0x28')](_0xbc3d('0x29')),controller[_0xbc3d('0x2a')]);var upload=multer({'storage':multer[_0xbc3d('0x21')]({'destination':function(_0x2295ec,_0x485c19,_0x29d353){_0x29d353(null,path[_0xbc3d('0x22')](config[_0xbc3d('0x2b')],_0xbc3d('0x2c')));},'filename':function(_0x3ce172,_0x3399c0,_0x41e011){_0x3399c0[_0xbc3d('0x23')]=_0x3399c0[_0xbc3d('0x23')][_0xbc3d('0x24')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x41e011(null,util['format']('%s-%s%s',path[_0xbc3d('0x26')](_0x3399c0['originalname'],path[_0xbc3d('0x27')](_0x3399c0[_0xbc3d('0x23')])),Date[_0xbc3d('0x2d')](),path['extname'](_0x3399c0[_0xbc3d('0x23')])));}})});router[_0xbc3d('0x1c')](_0xbc3d('0x2e'),upload[_0xbc3d('0x28')](_0xbc3d('0x29')),controller[_0xbc3d('0x2f')]);router['post'](_0xbc3d('0x30'),auth[_0xbc3d('0x9')](),controller[_0xbc3d('0x31')]);router[_0xbc3d('0x32')]('/:id',auth[_0xbc3d('0x9')](),controller[_0xbc3d('0x33')]);router[_0xbc3d('0x34')](_0xbc3d('0xd'),auth[_0xbc3d('0x9')](),controller[_0xbc3d('0x35')]);module[_0xbc3d('0x36')]=router; \ No newline at end of file +var _0xe964=['/upload','upload','import','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','get','/describe','describe','/:id','show','/:id/tags','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','/:id/journey','getJourney','post','/merge','merge','create','/create_many','bulkCreate','setTags','diskStorage','join','server/files/tmp','originalname','replace','%s-%s%s','now','extname','/csv','single','file','format','basename'];(function(_0x57fc34,_0x12aa24){var _0x55b06d=function(_0x5b92b5){while(--_0x5b92b5){_0x57fc34['push'](_0x57fc34['shift']());}};_0x55b06d(++_0x12aa24);}(_0xe964,0x174));var _0x4e96=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe964[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x4e96('0x0'));var util=require(_0x4e96('0x1'));var path=require(_0x4e96('0x2'));var timeout=require(_0x4e96('0x3'));var express=require(_0x4e96('0x4'));var router=express[_0x4e96('0x5')]();var fs_extra=require(_0x4e96('0x6'));var auth=require(_0x4e96('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x4e96('0x8'));var controller=require('./cmContact.controller');router['get']('/',auth[_0x4e96('0x9')](),controller['index']);router[_0x4e96('0xa')](_0x4e96('0xb'),auth['isAuthenticated'](),controller[_0x4e96('0xc')]);router['get'](_0x4e96('0xd'),auth[_0x4e96('0x9')](),controller[_0x4e96('0xe')]);router[_0x4e96('0xa')](_0x4e96('0xf'),auth['isAuthenticated'](),controller['getTags']);router[_0x4e96('0xa')]('/:id/hoppers',auth[_0x4e96('0x9')](),controller[_0x4e96('0x10')]);router[_0x4e96('0xa')](_0x4e96('0x11'),auth[_0x4e96('0x9')](),controller['getHopperHistories']);router[_0x4e96('0xa')](_0x4e96('0x12'),auth[_0x4e96('0x9')](),controller[_0x4e96('0x13')]);router['get'](_0x4e96('0x14'),auth['isAuthenticated'](),controller[_0x4e96('0x15')]);router[_0x4e96('0xa')](_0x4e96('0x16'),auth[_0x4e96('0x9')](),controller[_0x4e96('0x17')]);router[_0x4e96('0x18')](_0x4e96('0x19'),auth['isAuthenticated'](),controller[_0x4e96('0x1a')]);router[_0x4e96('0x18')]('/',auth[_0x4e96('0x9')](),controller[_0x4e96('0x1b')]);router['post'](_0x4e96('0x1c'),auth[_0x4e96('0x9')](),controller[_0x4e96('0x1d')]);router[_0x4e96('0x18')]('/:id/tags',auth[_0x4e96('0x9')](),controller[_0x4e96('0x1e')]);var upload=multer({'storage':multer[_0x4e96('0x1f')]({'destination':function(_0x212468,_0x9eef34,_0x325a8a){_0x325a8a(null,path[_0x4e96('0x20')](config['root'],_0x4e96('0x21')));},'filename':function(_0x3405f5,_0x424fe0,_0x58edff){_0x424fe0[_0x4e96('0x22')]=_0x424fe0[_0x4e96('0x22')][_0x4e96('0x23')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x58edff(null,util['format'](_0x4e96('0x24'),path['basename'](_0x424fe0[_0x4e96('0x22')],path['extname'](_0x424fe0[_0x4e96('0x22')])),Date[_0x4e96('0x25')](),path[_0x4e96('0x26')](_0x424fe0['originalname'])));}})});router['post'](_0x4e96('0x27'),upload[_0x4e96('0x28')](_0x4e96('0x29')),controller['uploadCsv']);var upload=multer({'storage':multer[_0x4e96('0x1f')]({'destination':function(_0xc5dfc6,_0x2c6fa4,_0x3d5fad){_0x3d5fad(null,path[_0x4e96('0x20')](config['root'],_0x4e96('0x21')));},'filename':function(_0x4a4f8e,_0x387025,_0x176a83){_0x387025[_0x4e96('0x22')]=_0x387025[_0x4e96('0x22')][_0x4e96('0x23')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x176a83(null,util[_0x4e96('0x2a')](_0x4e96('0x24'),path[_0x4e96('0x2b')](_0x387025[_0x4e96('0x22')],path['extname'](_0x387025['originalname'])),Date[_0x4e96('0x25')](),path[_0x4e96('0x26')](_0x387025['originalname'])));}})});router[_0x4e96('0x18')](_0x4e96('0x2c'),upload[_0x4e96('0x28')]('file'),controller[_0x4e96('0x2d')]);router[_0x4e96('0x18')]('/upload/:id',auth[_0x4e96('0x9')](),controller[_0x4e96('0x2e')]);router[_0x4e96('0x2f')](_0x4e96('0xd'),auth[_0x4e96('0x9')](),controller[_0x4e96('0x30')]);router[_0x4e96('0x31')]('/:id',auth[_0x4e96('0x9')](),controller[_0x4e96('0x32')]);module[_0x4e96('0x33')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index a3de83c..56433af 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 _0x6242=['lodash','exports','VIRTUAL','getDataValue','alias','setDataValue','name','STRING','TEXT','type','select','parse','values','isArray','stringify','ENUM','voice'];(function(_0x585234,_0x3ae470){var _0x28b8a7=function(_0x9081e1){while(--_0x9081e1){_0x585234['push'](_0x585234['shift']());}};_0x28b8a7(++_0x3ae470);}(_0x6242,0xff));var _0x2624=function(_0x213e8a,_0x13e070){_0x213e8a=_0x213e8a-0x0;var _0x1316b1=_0x6242[_0x213e8a];return _0x1316b1;};'use strict';var Sequelize=require('sequelize');var _=require(_0x2624('0x0'));module[_0x2624('0x1')]={'name':{'type':Sequelize[_0x2624('0x2')],'get':function(_0x278ad7){return this[_0x2624('0x3')](_0x2624('0x4'));}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x349f3e){this[_0x2624('0x5')](_0x2624('0x4'),_0x349f3e?_0x349f3e:this[_0x2624('0x3')](_0x2624('0x6')));}},'type':{'type':Sequelize[_0x2624('0x7')],'allowNull':![]},'values':{'type':Sequelize[_0x2624('0x8')]('long'),'get':function(){if(this[_0x2624('0x3')](_0x2624('0x9'))===_0x2624('0xa')){return JSON[_0x2624('0xb')](this[_0x2624('0x3')](_0x2624('0xc')));}else{return this[_0x2624('0x3')](_0x2624('0xc'));}},'set':function(_0x5a83e2){if(Array[_0x2624('0xd')](_0x5a83e2)){this['setDataValue']('values',JSON[_0x2624('0xe')](_0x5a83e2));}else{this[_0x2624('0x5')](_0x2624('0xc'),_0x5a83e2);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clickToAction':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'actionType':{'type':Sequelize[_0x2624('0xf')](_0x2624('0x10'))}}; \ No newline at end of file +var _0x0264=['lodash','exports','VIRTUAL','alias','getDataValue','STRING','TEXT','long','type','select','parse','values','setDataValue','stringify','BOOLEAN','voice','sequelize'];(function(_0x413c3c,_0x485627){var _0x489543=function(_0x2542df){while(--_0x2542df){_0x413c3c['push'](_0x413c3c['shift']());}};_0x489543(++_0x485627);}(_0x0264,0x131));var _0x4026=function(_0x52c81c,_0x1193a0){_0x52c81c=_0x52c81c-0x0;var _0x933222=_0x0264[_0x52c81c];return _0x933222;};'use strict';var Sequelize=require(_0x4026('0x0'));var _=require(_0x4026('0x1'));module[_0x4026('0x2')]={'name':{'type':Sequelize[_0x4026('0x3')],'get':function(_0xcf8a0b){return this['getDataValue'](_0x4026('0x4'));}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x5b6633){this['setDataValue'](_0x4026('0x4'),_0x5b6633?_0x5b6633:this[_0x4026('0x5')]('name'));}},'type':{'type':Sequelize[_0x4026('0x6')],'allowNull':![]},'values':{'type':Sequelize[_0x4026('0x7')](_0x4026('0x8')),'get':function(){if(this[_0x4026('0x5')](_0x4026('0x9'))===_0x4026('0xa')){return JSON[_0x4026('0xb')](this[_0x4026('0x5')](_0x4026('0xc')));}else{return this['getDataValue']('values');}},'set':function(_0x51e1c5){if(Array['isArray'](_0x51e1c5)){this[_0x4026('0xd')](_0x4026('0xc'),JSON[_0x4026('0xe')](_0x51e1c5));}else{this[_0x4026('0xd')](_0x4026('0xc'),_0x51e1c5);}}},'required':{'type':Sequelize[_0x4026('0xf')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x4026('0xf')],'defaultValue':![]},'actionType':{'type':Sequelize['ENUM'](_0x4026('0x10'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index cf4c441..a72b8dd 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 _0x8d8a=['../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','json','offset','undefined','limit','count','set','reject','save','update','then','status','end','stack','name','index','map','CmCustomField','rawAttributes','fieldName','type','key','model','differenceBy','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','include','findAll','rows','catch','params','options','find','body','destroy','sequelize','transaction','text','Sequelize','TEXT','number','INTEGER','defaultValue','queryInterface','addColumn','format','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis'];(function(_0x5990d1,_0xdebf08){var _0x263b56=function(_0x3bef28){while(--_0x3bef28){_0x5990d1['push'](_0x5990d1['shift']());}};_0x263b56(++_0xdebf08);}(_0x8d8a,0x18f));var _0xa8d8=function(_0x4d333a,_0x3622b1){_0x4d333a=_0x4d333a-0x0;var _0x8b49c5=_0x8d8a[_0x4d333a];return _0x8b49c5;};'use strict';var emlformat=require(_0xa8d8('0x0'));var rimraf=require(_0xa8d8('0x1'));var zipdir=require(_0xa8d8('0x2'));var jsonpatch=require(_0xa8d8('0x3'));var rp=require('request-promise');var moment=require(_0xa8d8('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa8d8('0x5'));var util=require(_0xa8d8('0x6'));var path=require(_0xa8d8('0x7'));var sox=require(_0xa8d8('0x8'));var csv=require(_0xa8d8('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa8d8('0xa'));var _=require(_0xa8d8('0xb'));var squel=require(_0xa8d8('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa8d8('0xd'));var toCsv=require(_0xa8d8('0x9'));var querystring=require('querystring');var Papa=require(_0xa8d8('0xe'));var Redis=require(_0xa8d8('0xf'));var authService=require(_0xa8d8('0x10'));var qs=require(_0xa8d8('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa8d8('0x12'));var logger=require(_0xa8d8('0x13'))(_0xa8d8('0x14'));var utils=require(_0xa8d8('0x15'));var config=require(_0xa8d8('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xa8d8('0x17'))['db'];function respondWithStatusCode(_0x544d6f,_0x418b12){_0x418b12=_0x418b12||0xcc;return function(_0x5ab2f3){if(_0x5ab2f3){return _0x544d6f[_0xa8d8('0x18')](_0x418b12);}return _0x544d6f['status'](_0x418b12)['end']();};}function respondWithResult(_0x1366b4,_0x13045b){_0x13045b=_0x13045b||0xc8;return function(_0x389268){if(_0x389268){return _0x1366b4['status'](_0x13045b)[_0xa8d8('0x19')](_0x389268);}};}function respondWithFilteredResult(_0x25f5c6,_0x3a94ce){return function(_0x12b847){if(_0x12b847){var _0x2d78c8=typeof _0x3a94ce[_0xa8d8('0x1a')]===_0xa8d8('0x1b')&&typeof _0x3a94ce[_0xa8d8('0x1c')]===_0xa8d8('0x1b');var _0x35ed21=_0x12b847[_0xa8d8('0x1d')];var _0x1f2292=_0x2d78c8?0x0:_0x3a94ce['offset'];var _0x41f2a4=_0x2d78c8?_0x12b847['count']:_0x3a94ce['offset']+_0x3a94ce[_0xa8d8('0x1c')];var _0x20a270;if(_0x41f2a4>=_0x35ed21){_0x41f2a4=_0x35ed21;_0x20a270=0xc8;}else{_0x20a270=0xce;}_0x25f5c6['status'](_0x20a270);return _0x25f5c6[_0xa8d8('0x1e')]('Content-Range',_0x1f2292+'-'+_0x41f2a4+'/'+_0x35ed21)[_0xa8d8('0x19')](_0x12b847);}return null;};}function patchUpdates(_0x5e3edf){return function(_0x51a616){try{jsonpatch['apply'](_0x51a616,_0x5e3edf,!![]);}catch(_0xe58c34){return BPromise[_0xa8d8('0x1f')](_0xe58c34);}return _0x51a616[_0xa8d8('0x20')]();};}function saveUpdates(_0x3a851f,_0x4a7022){return function(_0x1148f9){if(_0x1148f9){return _0x1148f9[_0xa8d8('0x21')](_0x3a851f)['then'](function(_0x395aa8){return _0x395aa8;});}return null;};}function removeEntity(_0x26a03c,_0x4d2400){return function(_0x24f06c){if(_0x24f06c){return _0x24f06c['destroy']()[_0xa8d8('0x22')](function(){_0x26a03c[_0xa8d8('0x23')](0xcc)[_0xa8d8('0x24')]();});}};}function handleEntityNotFound(_0x4bbbbc,_0x110213){return function(_0x2dd805){if(!_0x2dd805){_0x4bbbbc[_0xa8d8('0x18')](0x194);}return _0x2dd805;};}function handleError(_0x5d7d45,_0x3bd6b5){_0x3bd6b5=_0x3bd6b5||0x1f4;return function(_0xaa4fbc){logger['error'](_0xaa4fbc[_0xa8d8('0x25')]);if(_0xaa4fbc[_0xa8d8('0x26')]){delete _0xaa4fbc['name'];}_0x5d7d45[_0xa8d8('0x23')](_0x3bd6b5)['send'](_0xaa4fbc);};}exports[_0xa8d8('0x27')]=function(_0x551e8e,_0x378466){var _0x31b300={},_0xfb5ba4={},_0x40e5b2={'count':0x0,'rows':[]};var _0x4834d5=_[_0xa8d8('0x28')](db[_0xa8d8('0x29')][_0xa8d8('0x2a')],function(_0x4aa4b3){return{'name':_0x4aa4b3[_0xa8d8('0x2b')],'type':_0x4aa4b3[_0xa8d8('0x2c')][_0xa8d8('0x2d')]};});_0xfb5ba4[_0xa8d8('0x2e')]=_[_0xa8d8('0x2f')](_[_0xa8d8('0x28')](_0x4834d5,_0xa8d8('0x26')),[_0xa8d8('0x26')]);_0xfb5ba4[_0xa8d8('0x30')]=_[_0xa8d8('0x31')](_0x551e8e['query']);_0xfb5ba4[_0xa8d8('0x32')]=_[_0xa8d8('0x33')](_0xfb5ba4[_0xa8d8('0x2e')],_0xfb5ba4['query']);_0x31b300[_0xa8d8('0x34')]=_['intersection'](_0xfb5ba4[_0xa8d8('0x2e')],qs[_0xa8d8('0x35')](_0x551e8e[_0xa8d8('0x30')][_0xa8d8('0x35')]));_0x31b300[_0xa8d8('0x34')]=_0x31b300[_0xa8d8('0x34')][_0xa8d8('0x36')]?_0x31b300['attributes']:_0xfb5ba4[_0xa8d8('0x2e')];if(!_0x551e8e[_0xa8d8('0x30')][_0xa8d8('0x37')](_0xa8d8('0x38'))){_0x31b300[_0xa8d8('0x1c')]=qs[_0xa8d8('0x1c')](_0x551e8e[_0xa8d8('0x30')][_0xa8d8('0x1c')]);_0x31b300[_0xa8d8('0x1a')]=qs[_0xa8d8('0x1a')](_0x551e8e[_0xa8d8('0x30')][_0xa8d8('0x1a')]);}_0x31b300[_0xa8d8('0x39')]=qs[_0xa8d8('0x3a')](_0x551e8e[_0xa8d8('0x30')][_0xa8d8('0x3a')]);_0x31b300['where']=qs['filters'](_[_0xa8d8('0x3b')](_0x551e8e[_0xa8d8('0x30')],_0xfb5ba4[_0xa8d8('0x32')]),_0x4834d5);if(_0x551e8e['query'][_0xa8d8('0x3c')]){_0x31b300[_0xa8d8('0x3d')]=_[_0xa8d8('0x3e')](_0x31b300[_0xa8d8('0x3d')],{'$or':_['map'](_0x4834d5,function(_0x1360ae){if(_0x1360ae[_0xa8d8('0x2c')]!=='VIRTUAL'){var _0x57f5fb={};_0x57f5fb[_0x1360ae[_0xa8d8('0x26')]]={'$like':'%'+_0x551e8e[_0xa8d8('0x30')][_0xa8d8('0x3c')]+'%'};return _0x57f5fb;}})});}_0x31b300=_[_0xa8d8('0x3e')]({},_0x31b300,_0x551e8e['options']);var _0x515abd={'where':_0x31b300['where']};return db[_0xa8d8('0x29')][_0xa8d8('0x1d')](_0x515abd)[_0xa8d8('0x22')](function(_0x2472f5){_0x40e5b2[_0xa8d8('0x1d')]=_0x2472f5;if(_0x551e8e[_0xa8d8('0x30')]['includeAll']){_0x31b300[_0xa8d8('0x3f')]=[{'all':!![]}];}return db[_0xa8d8('0x29')][_0xa8d8('0x40')](_0x31b300);})[_0xa8d8('0x22')](function(_0x388fd5){_0x40e5b2[_0xa8d8('0x41')]=_0x388fd5;return _0x40e5b2;})['then'](respondWithFilteredResult(_0x378466,_0x31b300))[_0xa8d8('0x42')](handleError(_0x378466,null));};exports['show']=function(_0x457b2e,_0x548950){var _0x30dd2c={'raw':!![],'where':{'id':_0x457b2e[_0xa8d8('0x43')]['id']}},_0x46d6ff={};_0x46d6ff[_0xa8d8('0x2e')]=_[_0xa8d8('0x31')](db[_0xa8d8('0x29')][_0xa8d8('0x2a')]);_0x46d6ff[_0xa8d8('0x30')]=_[_0xa8d8('0x31')](_0x457b2e[_0xa8d8('0x30')]);_0x46d6ff[_0xa8d8('0x32')]=_[_0xa8d8('0x33')](_0x46d6ff[_0xa8d8('0x2e')],_0x46d6ff[_0xa8d8('0x30')]);_0x30dd2c[_0xa8d8('0x34')]=_[_0xa8d8('0x33')](_0x46d6ff[_0xa8d8('0x2e')],qs[_0xa8d8('0x35')](_0x457b2e[_0xa8d8('0x30')][_0xa8d8('0x35')]));_0x30dd2c['attributes']=_0x30dd2c[_0xa8d8('0x34')]['length']?_0x30dd2c[_0xa8d8('0x34')]:_0x46d6ff[_0xa8d8('0x2e')];if(_0x457b2e[_0xa8d8('0x30')]['includeAll']){_0x30dd2c[_0xa8d8('0x3f')]=[{'all':!![]}];}_0x30dd2c=_[_0xa8d8('0x3e')]({},_0x30dd2c,_0x457b2e[_0xa8d8('0x44')]);return db[_0xa8d8('0x29')][_0xa8d8('0x45')](_0x30dd2c)[_0xa8d8('0x22')](handleEntityNotFound(_0x548950,null))[_0xa8d8('0x22')](respondWithResult(_0x548950,null))[_0xa8d8('0x42')](handleError(_0x548950,null));};exports[_0xa8d8('0x21')]=function(_0x377fdd,_0x473d91){if(_0x377fdd[_0xa8d8('0x46')]['id']){delete _0x377fdd[_0xa8d8('0x46')]['id'];}return db['CmCustomField'][_0xa8d8('0x45')]({'where':{'id':_0x377fdd['params']['id']}})[_0xa8d8('0x22')](handleEntityNotFound(_0x473d91,null))['then'](saveUpdates(_0x377fdd['body'],null))[_0xa8d8('0x22')](respondWithResult(_0x473d91,null))[_0xa8d8('0x42')](handleError(_0x473d91,null));};exports[_0xa8d8('0x47')]=function(_0xca7cca,_0x4bcc96){return db[_0xa8d8('0x29')][_0xa8d8('0x45')]({'where':{'id':_0xca7cca[_0xa8d8('0x43')]['id']}})['then'](handleEntityNotFound(_0x4bcc96,null))[_0xa8d8('0x22')](removeEntity(_0x4bcc96,null))[_0xa8d8('0x42')](handleError(_0x4bcc96,null));};exports['create']=function(_0x18f8ab,_0x326c86){var _0x5bd21a;return db[_0xa8d8('0x48')][_0xa8d8('0x49')](function(_0x55bdf2){return db[_0xa8d8('0x29')]['create'](_0x18f8ab[_0xa8d8('0x46')],{'transaction':_0x55bdf2})[_0xa8d8('0x22')](function(_0x2ef707){_0x5bd21a=_0x2ef707;var _0x37f3dc={'type':db['Sequelize']['TEXT'],'transaction':_0x55bdf2};switch(_0x18f8ab[_0xa8d8('0x46')][_0xa8d8('0x2c')]){case _0xa8d8('0x4a'):_0x37f3dc[_0xa8d8('0x2c')]=db[_0xa8d8('0x4b')][_0xa8d8('0x4c')];break;case _0xa8d8('0x4d'):_0x37f3dc[_0xa8d8('0x2c')]=db['Sequelize'][_0xa8d8('0x4e')];break;case'switch':_0x37f3dc[_0xa8d8('0x2c')]=db['Sequelize']['BOOLEAN'];_0x37f3dc[_0xa8d8('0x4f')]=![];break;default:}return db['sequelize'][_0xa8d8('0x50')][_0xa8d8('0x51')]('cm_contacts',util[_0xa8d8('0x52')]('cf_%d',_0x5bd21a['id']),_0x37f3dc);})[_0xa8d8('0x22')](function(){return _0x5bd21a;});})['then'](respondWithResult(_0x326c86,0xc9))['catch'](handleError(_0x326c86,null));}; \ No newline at end of file +var _0x1843=['../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','Content-Range','json','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','differenceBy','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','VIRTUAL','merge','options','CmCustomField','findAll','rows','catch','show','params','includeAll','include','find','sequelize','transaction','create','body','Sequelize','TEXT','text','number','INTEGER','BOOLEAN','defaultValue','cm_contacts','format','cf_%d','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api'];(function(_0x5090d4,_0x1950a7){var _0x56c310=function(_0x3d3d5c){while(--_0x3d3d5c){_0x5090d4['push'](_0x5090d4['shift']());}};_0x56c310(++_0x1950a7);}(_0x1843,0x9c));var _0x3184=function(_0x324931,_0xd6ae3f){_0x324931=_0x324931-0x0;var _0x2289d1=_0x1843[_0x324931];return _0x2289d1;};'use strict';var emlformat=require(_0x3184('0x0'));var rimraf=require(_0x3184('0x1'));var zipdir=require(_0x3184('0x2'));var jsonpatch=require(_0x3184('0x3'));var rp=require(_0x3184('0x4'));var moment=require('moment');var BPromise=require(_0x3184('0x5'));var Mustache=require(_0x3184('0x6'));var util=require(_0x3184('0x7'));var path=require(_0x3184('0x8'));var sox=require(_0x3184('0x9'));var csv=require('to-csv');var ejs=require(_0x3184('0xa'));var fs=require('fs');var fs_extra=require(_0x3184('0xb'));var _=require(_0x3184('0xc'));var squel=require(_0x3184('0xd'));var crypto=require(_0x3184('0xe'));var jsforce=require(_0x3184('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x3184('0x10'));var querystring=require(_0x3184('0x11'));var Papa=require(_0x3184('0x12'));var Redis=require(_0x3184('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x3184('0x14'));var as=require(_0x3184('0x15'));var hardwareService=require(_0x3184('0x16'));var logger=require('../../config/logger')(_0x3184('0x17'));var utils=require('../../config/utils');var config=require(_0x3184('0x18'));var licenseUtil=require(_0x3184('0x19'));var db=require(_0x3184('0x1a'))['db'];function respondWithStatusCode(_0x55b0e2,_0x1eb2b4){_0x1eb2b4=_0x1eb2b4||0xcc;return function(_0x268292){if(_0x268292){return _0x55b0e2['sendStatus'](_0x1eb2b4);}return _0x55b0e2[_0x3184('0x1b')](_0x1eb2b4)[_0x3184('0x1c')]();};}function respondWithResult(_0x5c5059,_0xbf5bed){_0xbf5bed=_0xbf5bed||0xc8;return function(_0xa51463){if(_0xa51463){return _0x5c5059[_0x3184('0x1b')](_0xbf5bed)['json'](_0xa51463);}};}function respondWithFilteredResult(_0x21e5d3,_0x401232){return function(_0xf8e34e){if(_0xf8e34e){var _0xce8a33=typeof _0x401232[_0x3184('0x1d')]===_0x3184('0x1e')&&typeof _0x401232[_0x3184('0x1f')]==='undefined';var _0x19272d=_0xf8e34e[_0x3184('0x20')];var _0x3ad371=_0xce8a33?0x0:_0x401232[_0x3184('0x1d')];var _0x5018c7=_0xce8a33?_0xf8e34e[_0x3184('0x20')]:_0x401232[_0x3184('0x1d')]+_0x401232[_0x3184('0x1f')];var _0x3568af;if(_0x5018c7>=_0x19272d){_0x5018c7=_0x19272d;_0x3568af=0xc8;}else{_0x3568af=0xce;}_0x21e5d3[_0x3184('0x1b')](_0x3568af);return _0x21e5d3['set'](_0x3184('0x21'),_0x3ad371+'-'+_0x5018c7+'/'+_0x19272d)[_0x3184('0x22')](_0xf8e34e);}return null;};}function patchUpdates(_0x141516){return function(_0x1cfafa){try{jsonpatch['apply'](_0x1cfafa,_0x141516,!![]);}catch(_0x19b8ee){return BPromise['reject'](_0x19b8ee);}return _0x1cfafa[_0x3184('0x23')]();};}function saveUpdates(_0x731d25,_0x36a770){return function(_0x52302c){if(_0x52302c){return _0x52302c[_0x3184('0x24')](_0x731d25)[_0x3184('0x25')](function(_0x5e3070){return _0x5e3070;});}return null;};}function removeEntity(_0x2ece9e,_0x3751be){return function(_0x144f92){if(_0x144f92){return _0x144f92[_0x3184('0x26')]()[_0x3184('0x25')](function(){_0x2ece9e[_0x3184('0x1b')](0xcc)[_0x3184('0x1c')]();});}};}function handleEntityNotFound(_0xc59b15,_0x3fbb27){return function(_0x1a511e){if(!_0x1a511e){_0xc59b15['sendStatus'](0x194);}return _0x1a511e;};}function handleError(_0x306145,_0x13b4bf){_0x13b4bf=_0x13b4bf||0x1f4;return function(_0x5e0950){logger[_0x3184('0x27')](_0x5e0950[_0x3184('0x28')]);if(_0x5e0950[_0x3184('0x29')]){delete _0x5e0950[_0x3184('0x29')];}_0x306145[_0x3184('0x1b')](_0x13b4bf)[_0x3184('0x2a')](_0x5e0950);};}exports[_0x3184('0x2b')]=function(_0x26b3ca,_0x3d065a){var _0x4f0d62={},_0x2cd8c2={},_0x5dd0ac={'count':0x0,'rows':[]};var _0x24dbd3=_[_0x3184('0x2c')](db['CmCustomField'][_0x3184('0x2d')],function(_0x26d1f0){return{'name':_0x26d1f0[_0x3184('0x2e')],'type':_0x26d1f0[_0x3184('0x2f')][_0x3184('0x30')]};});_0x2cd8c2[_0x3184('0x31')]=_[_0x3184('0x32')](_[_0x3184('0x2c')](_0x24dbd3,'name'),['name']);_0x2cd8c2[_0x3184('0x33')]=_[_0x3184('0x34')](_0x26b3ca[_0x3184('0x33')]);_0x2cd8c2[_0x3184('0x35')]=_[_0x3184('0x36')](_0x2cd8c2[_0x3184('0x31')],_0x2cd8c2[_0x3184('0x33')]);_0x4f0d62[_0x3184('0x37')]=_[_0x3184('0x36')](_0x2cd8c2['model'],qs[_0x3184('0x38')](_0x26b3ca[_0x3184('0x33')][_0x3184('0x38')]));_0x4f0d62[_0x3184('0x37')]=_0x4f0d62[_0x3184('0x37')][_0x3184('0x39')]?_0x4f0d62['attributes']:_0x2cd8c2[_0x3184('0x31')];if(!_0x26b3ca[_0x3184('0x33')][_0x3184('0x3a')](_0x3184('0x3b'))){_0x4f0d62[_0x3184('0x1f')]=qs['limit'](_0x26b3ca['query'][_0x3184('0x1f')]);_0x4f0d62[_0x3184('0x1d')]=qs[_0x3184('0x1d')](_0x26b3ca[_0x3184('0x33')][_0x3184('0x1d')]);}_0x4f0d62['order']=qs[_0x3184('0x3c')](_0x26b3ca[_0x3184('0x33')]['sort']);_0x4f0d62['where']=qs['filters'](_[_0x3184('0x3d')](_0x26b3ca[_0x3184('0x33')],_0x2cd8c2['filters']),_0x24dbd3);if(_0x26b3ca['query'][_0x3184('0x3e')]){_0x4f0d62[_0x3184('0x3f')]=_['merge'](_0x4f0d62[_0x3184('0x3f')],{'$or':_[_0x3184('0x2c')](_0x24dbd3,function(_0x5d3ee6){if(_0x5d3ee6['type']!==_0x3184('0x40')){var _0xde741c={};_0xde741c[_0x5d3ee6[_0x3184('0x29')]]={'$like':'%'+_0x26b3ca['query'][_0x3184('0x3e')]+'%'};return _0xde741c;}})});}_0x4f0d62=_[_0x3184('0x41')]({},_0x4f0d62,_0x26b3ca[_0x3184('0x42')]);var _0x5e3c41={'where':_0x4f0d62[_0x3184('0x3f')]};return db['CmCustomField']['count'](_0x5e3c41)['then'](function(_0x20fb4f){_0x5dd0ac[_0x3184('0x20')]=_0x20fb4f;if(_0x26b3ca[_0x3184('0x33')]['includeAll']){_0x4f0d62['include']=[{'all':!![]}];}return db[_0x3184('0x43')][_0x3184('0x44')](_0x4f0d62);})[_0x3184('0x25')](function(_0x2be54c){_0x5dd0ac[_0x3184('0x45')]=_0x2be54c;return _0x5dd0ac;})[_0x3184('0x25')](respondWithFilteredResult(_0x3d065a,_0x4f0d62))[_0x3184('0x46')](handleError(_0x3d065a,null));};exports[_0x3184('0x47')]=function(_0x8084bd,_0xf6bca0){var _0x1feb2c={'raw':!![],'where':{'id':_0x8084bd[_0x3184('0x48')]['id']}},_0x525ba4={};_0x525ba4[_0x3184('0x31')]=_[_0x3184('0x34')](db[_0x3184('0x43')][_0x3184('0x2d')]);_0x525ba4['query']=_[_0x3184('0x34')](_0x8084bd[_0x3184('0x33')]);_0x525ba4[_0x3184('0x35')]=_['intersection'](_0x525ba4[_0x3184('0x31')],_0x525ba4[_0x3184('0x33')]);_0x1feb2c[_0x3184('0x37')]=_[_0x3184('0x36')](_0x525ba4[_0x3184('0x31')],qs['fields'](_0x8084bd[_0x3184('0x33')]['fields']));_0x1feb2c[_0x3184('0x37')]=_0x1feb2c['attributes'][_0x3184('0x39')]?_0x1feb2c[_0x3184('0x37')]:_0x525ba4['model'];if(_0x8084bd['query'][_0x3184('0x49')]){_0x1feb2c[_0x3184('0x4a')]=[{'all':!![]}];}_0x1feb2c=_['merge']({},_0x1feb2c,_0x8084bd[_0x3184('0x42')]);return db[_0x3184('0x43')][_0x3184('0x4b')](_0x1feb2c)['then'](handleEntityNotFound(_0xf6bca0,null))[_0x3184('0x25')](respondWithResult(_0xf6bca0,null))[_0x3184('0x46')](handleError(_0xf6bca0,null));};exports['update']=function(_0x5798cb,_0x44771d){if(_0x5798cb['body']['id']){delete _0x5798cb['body']['id'];}return db[_0x3184('0x43')]['find']({'where':{'id':_0x5798cb[_0x3184('0x48')]['id']}})['then'](handleEntityNotFound(_0x44771d,null))[_0x3184('0x25')](saveUpdates(_0x5798cb['body'],null))[_0x3184('0x25')](respondWithResult(_0x44771d,null))[_0x3184('0x46')](handleError(_0x44771d,null));};exports[_0x3184('0x26')]=function(_0x440f10,_0x58ba29){return db[_0x3184('0x43')][_0x3184('0x4b')]({'where':{'id':_0x440f10['params']['id']}})[_0x3184('0x25')](handleEntityNotFound(_0x58ba29,null))[_0x3184('0x25')](removeEntity(_0x58ba29,null))['catch'](handleError(_0x58ba29,null));};exports['create']=function(_0x4a7bae,_0x50a467){var _0x153615;return db[_0x3184('0x4c')][_0x3184('0x4d')](function(_0xa207fd){return db[_0x3184('0x43')][_0x3184('0x4e')](_0x4a7bae[_0x3184('0x4f')],{'transaction':_0xa207fd})[_0x3184('0x25')](function(_0x222b66){_0x153615=_0x222b66;var _0x208ced={'type':db[_0x3184('0x50')][_0x3184('0x51')],'transaction':_0xa207fd};switch(_0x4a7bae[_0x3184('0x4f')][_0x3184('0x2f')]){case _0x3184('0x52'):_0x208ced['type']=db[_0x3184('0x50')][_0x3184('0x51')];break;case _0x3184('0x53'):_0x208ced[_0x3184('0x2f')]=db['Sequelize'][_0x3184('0x54')];break;case'switch':_0x208ced[_0x3184('0x2f')]=db[_0x3184('0x50')][_0x3184('0x55')];_0x208ced[_0x3184('0x56')]=![];break;default:}return db[_0x3184('0x4c')]['queryInterface']['addColumn'](_0x3184('0x57'),util[_0x3184('0x58')](_0x3184('0x59'),_0x153615['id']),_0x208ced);})[_0x3184('0x25')](function(){return _0x153615;});})['then'](respondWithResult(_0x50a467,0xc9))[_0x3184('0x46')](handleError(_0x50a467,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index c2b6778..4c6425c 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 _0x635d=['exports','define','cm_custom_fields','lodash','util','request-promise','path','rimraf','../../config/environment','./cmCustomField.attributes'];(function(_0x268fdd,_0x46b228){var _0x5ce50c=function(_0x37c598){while(--_0x37c598){_0x268fdd['push'](_0x268fdd['shift']());}};_0x5ce50c(++_0x46b228);}(_0x635d,0x1cf));var _0xd635=function(_0xbf6d20,_0x55d1b1){_0xbf6d20=_0xbf6d20-0x0;var _0x1e6b38=_0x635d[_0xbf6d20];return _0x1e6b38;};'use strict';var _=require(_0xd635('0x0'));var util=require(_0xd635('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd635('0x2'));var fs=require('fs');var path=require(_0xd635('0x3'));var rimraf=require(_0xd635('0x4'));var config=require(_0xd635('0x5'));var attributes=require(_0xd635('0x6'));module[_0xd635('0x7')]=function(_0x198aa6,_0x49aecd){return _0x198aa6[_0xd635('0x8')]('CmCustomField',attributes,{'tableName':_0xd635('0x9'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfb20=['../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./cmCustomField.attributes','exports','define','CmCustomField','cm_custom_fields','util'];(function(_0x1ca25a,_0x4edf94){var _0x4a390a=function(_0x5e6e1e){while(--_0x5e6e1e){_0x1ca25a['push'](_0x1ca25a['shift']());}};_0x4a390a(++_0x4edf94);}(_0xfb20,0x143));var _0x0fb2=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0xfb20[_0x13b8f3];return _0x1a6d06;};'use strict';var _=require('lodash');var util=require(_0x0fb2('0x0'));var logger=require(_0x0fb2('0x1'))('api');var moment=require(_0x0fb2('0x2'));var BPromise=require(_0x0fb2('0x3'));var rp=require(_0x0fb2('0x4'));var fs=require('fs');var path=require(_0x0fb2('0x5'));var rimraf=require('rimraf');var config=require(_0x0fb2('0x6'));var attributes=require(_0x0fb2('0x7'));module[_0x0fb2('0x8')]=function(_0x39009a,_0x3cd8bb){return _0x39009a[_0x0fb2('0x9')](_0x0fb2('0xa'),attributes,{'tableName':_0x0fb2('0xb'),'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 facd362..c66723d 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 _0x49ec=['catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0xfb211d,_0x469369){var _0xdeed13=function(_0x3e08b1){while(--_0x3e08b1){_0xfb211d['push'](_0xfb211d['shift']());}};_0xdeed13(++_0x469369);}(_0x49ec,0x188));var _0xc49e=function(_0xe9bbaa,_0x2c4410){_0xe9bbaa=_0xe9bbaa-0x0;var _0x556272=_0x49ec[_0xe9bbaa];return _0x556272;};'use strict';var _=require(_0xc49e('0x0'));var util=require(_0xc49e('0x1'));var moment=require(_0xc49e('0x2'));var BPromise=require(_0xc49e('0x3'));var rs=require(_0xc49e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc49e('0x5'))['db'];var utils=require(_0xc49e('0x6'));var logger=require(_0xc49e('0x7'))(_0xc49e('0x8'));var config=require(_0xc49e('0x9'));var jayson=require(_0xc49e('0xa'));var client=jayson[_0xc49e('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2d3bb4,_0x10176d,_0x4b9752){return new BPromise(function(_0x4d06fb,_0x2a1018){return client['request'](_0x2d3bb4,_0x4b9752)[_0xc49e('0xc')](function(_0x304a84){logger['info'](_0xc49e('0xd'),_0x10176d,_0xc49e('0xe'));logger[_0xc49e('0xf')](_0xc49e('0x10'),_0x10176d,_0xc49e('0xe'),JSON[_0xc49e('0x11')](_0x304a84));if(_0x304a84[_0xc49e('0x12')]){if(_0x304a84['error'][_0xc49e('0x13')]===0x1f4){logger[_0xc49e('0x12')]('CmCustomField,\x20%s,\x20%s',_0x10176d,_0x304a84[_0xc49e('0x12')][_0xc49e('0x14')]);return _0x2a1018(_0x304a84[_0xc49e('0x12')][_0xc49e('0x14')]);}logger[_0xc49e('0x12')](_0xc49e('0xd'),_0x10176d,_0x304a84[_0xc49e('0x12')][_0xc49e('0x14')]);return _0x4d06fb(_0x304a84[_0xc49e('0x12')][_0xc49e('0x14')]);}else{logger['info']('CmCustomField,\x20%s,\x20%s',_0x10176d,_0xc49e('0xe'));_0x4d06fb(_0x304a84[_0xc49e('0x15')][_0xc49e('0x14')]);}})[_0xc49e('0x16')](function(_0xb2f3cf){logger['error'](_0xc49e('0xd'),_0x10176d,_0xb2f3cf);_0x2a1018(_0xb2f3cf);});});} \ No newline at end of file +var _0xe3ba=['request','info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','rpc'];(function(_0x1bce3b,_0x5c2e60){var _0x268859=function(_0xa0ecc8){while(--_0xa0ecc8){_0x1bce3b['push'](_0x1bce3b['shift']());}};_0x268859(++_0x5c2e60);}(_0xe3ba,0xf5));var _0xae3b=function(_0x55af86,_0x5c8ff6){_0x55af86=_0x55af86-0x0;var _0x58df3b=_0xe3ba[_0x55af86];return _0x58df3b;};'use strict';var _=require(_0xae3b('0x0'));var util=require(_0xae3b('0x1'));var moment=require('moment');var BPromise=require(_0xae3b('0x2'));var rs=require(_0xae3b('0x3'));var fs=require('fs');var Redis=require(_0xae3b('0x4'));var db=require(_0xae3b('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xae3b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5d013c,_0x5cc4d5,_0x3b33ba){return new BPromise(function(_0x53c585,_0x128b1d){return client[_0xae3b('0x7')](_0x5d013c,_0x3b33ba)['then'](function(_0x225b15){logger[_0xae3b('0x8')](_0xae3b('0x9'),_0x5cc4d5,_0xae3b('0xa'));logger[_0xae3b('0xb')](_0xae3b('0xc'),_0x5cc4d5,_0xae3b('0xa'),JSON[_0xae3b('0xd')](_0x225b15));if(_0x225b15['error']){if(_0x225b15[_0xae3b('0xe')]['code']===0x1f4){logger[_0xae3b('0xe')]('CmCustomField,\x20%s,\x20%s',_0x5cc4d5,_0x225b15['error']['message']);return _0x128b1d(_0x225b15[_0xae3b('0xe')][_0xae3b('0xf')]);}logger[_0xae3b('0xe')](_0xae3b('0x9'),_0x5cc4d5,_0x225b15[_0xae3b('0xe')][_0xae3b('0xf')]);return _0x53c585(_0x225b15[_0xae3b('0xe')][_0xae3b('0xf')]);}else{logger[_0xae3b('0x8')]('CmCustomField,\x20%s,\x20%s',_0x5cc4d5,_0xae3b('0xa'));_0x53c585(_0x225b15[_0xae3b('0x10')][_0xae3b('0xf')]);}})[_0xae3b('0x11')](function(_0x545210){logger[_0xae3b('0xe')](_0xae3b('0x9'),_0x5cc4d5,_0x545210);_0x128b1d(_0x545210);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index e9cfeeb..14f2182 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 _0x36eb=['isAuthenticated','show','post','create','put','delete','destroy','multer','path','express','fs-extra','./cmCustomField.controller','get','/:id'];(function(_0x1fdb40,_0x51351c){var _0x281f93=function(_0x35eebe){while(--_0x35eebe){_0x1fdb40['push'](_0x1fdb40['shift']());}};_0x281f93(++_0x51351c);}(_0x36eb,0x111));var _0xb36e=function(_0x3bba67,_0x198327){_0x3bba67=_0x3bba67-0x0;var _0x6ff30a=_0x36eb[_0x3bba67];return _0x6ff30a;};'use strict';var multer=require(_0xb36e('0x0'));var util=require('util');var path=require(_0xb36e('0x1'));var timeout=require('connect-timeout');var express=require(_0xb36e('0x2'));var router=express['Router']();var fs_extra=require(_0xb36e('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb36e('0x4'));router[_0xb36e('0x5')]('/',auth['isAuthenticated'](),controller['index']);router[_0xb36e('0x5')](_0xb36e('0x6'),auth[_0xb36e('0x7')](),controller[_0xb36e('0x8')]);router[_0xb36e('0x9')]('/',auth['isAuthenticated'](),controller[_0xb36e('0xa')]);router[_0xb36e('0xb')]('/:id',auth[_0xb36e('0x7')](),controller['update']);router[_0xb36e('0xc')](_0xb36e('0x6'),auth[_0xb36e('0x7')](),controller[_0xb36e('0xd')]);module['exports']=router; \ No newline at end of file +var _0x9fce=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','multer'];(function(_0x4bbe24,_0x49a013){var _0x4387d8=function(_0x4266e1){while(--_0x4266e1){_0x4bbe24['push'](_0x4bbe24['shift']());}};_0x4387d8(++_0x49a013);}(_0x9fce,0x99));var _0xe9fc=function(_0x95942,_0x85da80){_0x95942=_0x95942-0x0;var _0x6d7f81=_0x9fce[_0x95942];return _0x6d7f81;};'use strict';var multer=require(_0xe9fc('0x0'));var util=require(_0xe9fc('0x1'));var path=require(_0xe9fc('0x2'));var timeout=require(_0xe9fc('0x3'));var express=require(_0xe9fc('0x4'));var router=express[_0xe9fc('0x5')]();var fs_extra=require(_0xe9fc('0x6'));var auth=require(_0xe9fc('0x7'));var interaction=require(_0xe9fc('0x8'));var config=require(_0xe9fc('0x9'));var controller=require(_0xe9fc('0xa'));router[_0xe9fc('0xb')]('/',auth[_0xe9fc('0xc')](),controller[_0xe9fc('0xd')]);router['get'](_0xe9fc('0xe'),auth[_0xe9fc('0xc')](),controller[_0xe9fc('0xf')]);router[_0xe9fc('0x10')]('/',auth[_0xe9fc('0xc')](),controller[_0xe9fc('0x11')]);router[_0xe9fc('0x12')](_0xe9fc('0xe'),auth[_0xe9fc('0xc')](),controller[_0xe9fc('0x13')]);router[_0xe9fc('0x14')](_0xe9fc('0xe'),auth[_0xe9fc('0xc')](),controller[_0xe9fc('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 536c452..5112581 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 _0x524e=['STRING','BOOLEAN','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED','contactListQueue','exports'];(function(_0x1e8982,_0x37bfc7){var _0x115066=function(_0x202cb1){while(--_0x202cb1){_0x1e8982['push'](_0x1e8982['shift']());}};_0x115066(++_0x37bfc7);}(_0x524e,0x15e));var _0xe524=function(_0x31f256,_0x512984){_0x31f256=_0x31f256-0x0;var _0x557c19=_0x524e[_0x31f256];return _0x557c19;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0xe524('0x0')]={'phone':{'type':Sequelize[_0xe524('0x1')],'allowNull':![]},'active':{'type':Sequelize[_0xe524('0x2')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xe524('0x3')],'defaultValue':moment()[_0xe524('0x4')](_0xe524('0x5'))},'countbusyretry':{'type':Sequelize[_0xe524('0x6')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xe524('0x6')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xe524('0x6')],'defaultValue':0x0},'callback':{'type':Sequelize[_0xe524('0x2')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0xe524('0x3')]},'priority':{'type':Sequelize[_0xe524('0x6')](0x2)[_0xe524('0x7')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xe524('0x6')],'unique':_0xe524('0x8')},'ListId':{'type':Sequelize[_0xe524('0x6')],'unique':_0xe524('0x8')},'UserId':{'type':Sequelize[_0xe524('0x6')]},'VoiceQueueId':{'type':Sequelize[_0xe524('0x6')],'unique':_0xe524('0x8')},'CampaignId':{'type':Sequelize[_0xe524('0x6')]},'countnosuchnumberretry':{'type':Sequelize[_0xe524('0x6')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xe524('0x6')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xe524('0x6')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xe524('0x6')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xe524('0x6')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xe524('0x1')]},'recallmeNotifiedDate':{'type':Sequelize[_0xe524('0x3')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0xef0f=['moment','exports','STRING','BOOLEAN','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','DATE','UNSIGNED','contactListQueue'];(function(_0x489fe3,_0x5ebb81){var _0x592190=function(_0x1612a7){while(--_0x1612a7){_0x489fe3['push'](_0x489fe3['shift']());}};_0x592190(++_0x5ebb81);}(_0xef0f,0x168));var _0xfef0=function(_0x36e220,_0x1fdd49){_0x36e220=_0x36e220-0x0;var _0x430551=_0xef0f[_0x36e220];return _0x430551;};'use strict';var moment=require(_0xfef0('0x0'));var Sequelize=require('sequelize');module[_0xfef0('0x1')]={'phone':{'type':Sequelize[_0xfef0('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0xfef0('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0xfef0('0x4')](_0xfef0('0x5'))},'countbusyretry':{'type':Sequelize[_0xfef0('0x6')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xfef0('0x6')],'defaultValue':0x0},'callback':{'type':Sequelize[_0xfef0('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xfef0('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xfef0('0x7')]},'priority':{'type':Sequelize[_0xfef0('0x6')](0x2)[_0xfef0('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xfef0('0x6')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0xfef0('0x6')],'unique':_0xfef0('0x9')},'UserId':{'type':Sequelize[_0xfef0('0x6')]},'VoiceQueueId':{'type':Sequelize[_0xfef0('0x6')],'unique':_0xfef0('0x9')},'CampaignId':{'type':Sequelize[_0xfef0('0x6')]},'countnosuchnumberretry':{'type':Sequelize[_0xfef0('0x6')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xfef0('0x6')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xfef0('0x6')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xfef0('0x6')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xfef0('0x6')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xfef0('0x2')]},'recallmeNotifiedDate':{'type':Sequelize[_0xfef0('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 f706a18..4dd7ab4 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 _0xdb06=['includeAll','find','create','body','describe','VoiceQueueId','CampaignId','VoiceQueue','Campaign','dataValues','createdAt','updatedAt','state','statedesc','deleted','membername','user','UserId','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','queue','ivr','CmContact','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','getPreview','getVoiceQueues','outbound','transaction','dialPreviewAutoRecallMe','value','direction','prev','isEmpty','hopperIds','dialOrderByScheduledAt','ASC','DESC','sequelize','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','priority','scheduledAt','scheduledat','Contact','CmCompany','CmList','List','Queue','dialActive','getPreviewRecall','preview','hopperId','findOne','recallme','LOCK','UPDATE','Company','getOpenContacts','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','getTimezones','timezones','utcOffset','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','Content-Range','reject','save','update','destroy','then','error','stack','name','send','index','map','CmHopper','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','concat','$or','$gt','$gte','$lt','$lte','$ne','$eq','$not','$between','$notBetween','$notIn','$notLike','$iLike','$notILike','$like','$overlap','$any','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','rows','catch','show','params'];(function(_0x4ab311,_0x51ac35){var _0x2c56c0=function(_0x17186d){while(--_0x17186d){_0x4ab311['push'](_0x4ab311['shift']());}};_0x2c56c0(++_0x51ac35);}(_0xdb06,0x194));var _0x6db0=function(_0x317d82,_0x526684){_0x317d82=_0x317d82-0x0;var _0x349785=_0xdb06[_0x317d82];return _0x349785;};'use strict';var emlformat=require(_0x6db0('0x0'));var rimraf=require(_0x6db0('0x1'));var zipdir=require(_0x6db0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6db0('0x3'));var moment=require(_0x6db0('0x4'));var BPromise=require(_0x6db0('0x5'));var Mustache=require(_0x6db0('0x6'));var util=require('util');var path=require(_0x6db0('0x7'));var sox=require(_0x6db0('0x8'));var csv=require('to-csv');var ejs=require(_0x6db0('0x9'));var fs=require('fs');var fs_extra=require(_0x6db0('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x6db0('0xb'));var jsforce=require(_0x6db0('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x6db0('0xd'));var querystring=require(_0x6db0('0xe'));var Papa=require(_0x6db0('0xf'));var Redis=require(_0x6db0('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x6db0('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6db0('0x12'));var logger=require(_0x6db0('0x13'))('api');var utils=require(_0x6db0('0x14'));var config=require(_0x6db0('0x15'));var shared=require(_0x6db0('0x15'));var licenseUtil=require(_0x6db0('0x16'));var db=require(_0x6db0('0x17'))['db'];function respondWithStatusCode(_0x5806d0,_0x445d1f){_0x445d1f=_0x445d1f||0xcc;return function(_0x1e1427){if(_0x1e1427){return _0x5806d0[_0x6db0('0x18')](_0x445d1f);}return _0x5806d0['status'](_0x445d1f)[_0x6db0('0x19')]();};}function respondWithResult(_0x181421,_0x1f12dd){_0x1f12dd=_0x1f12dd||0xc8;return function(_0x378d53){if(_0x378d53){return _0x181421['status'](_0x1f12dd)[_0x6db0('0x1a')](_0x378d53);}};}function respondWithFilteredResult(_0x41deee,_0x5ce005){return function(_0x234e37){if(_0x234e37){var _0xc9074=typeof _0x5ce005[_0x6db0('0x1b')]===_0x6db0('0x1c')&&typeof _0x5ce005[_0x6db0('0x1d')]==='undefined';var _0x95ef1c=_0x234e37['count'];var _0x1efde7=_0xc9074?0x0:_0x5ce005['offset'];var _0x27f7b6=_0xc9074?_0x234e37[_0x6db0('0x1e')]:_0x5ce005[_0x6db0('0x1b')]+_0x5ce005[_0x6db0('0x1d')];var _0x2b1f75;if(_0x27f7b6>=_0x95ef1c){_0x27f7b6=_0x95ef1c;_0x2b1f75=0xc8;}else{_0x2b1f75=0xce;}_0x41deee[_0x6db0('0x1f')](_0x2b1f75);return _0x41deee['set'](_0x6db0('0x20'),_0x1efde7+'-'+_0x27f7b6+'/'+_0x95ef1c)[_0x6db0('0x1a')](_0x234e37);}return null;};}function patchUpdates(_0x1fd268){return function(_0x2dfa8b){try{jsonpatch['apply'](_0x2dfa8b,_0x1fd268,!![]);}catch(_0x328ef7){return BPromise[_0x6db0('0x21')](_0x328ef7);}return _0x2dfa8b[_0x6db0('0x22')]();};}function saveUpdates(_0x5c81e7,_0x4c45ad){return function(_0x489839){if(_0x489839){return _0x489839[_0x6db0('0x23')](_0x5c81e7)['then'](function(_0x21d907){return _0x21d907;});}return null;};}function removeEntity(_0x4d4162,_0x2671d0){return function(_0x4b97d3){if(_0x4b97d3){return _0x4b97d3[_0x6db0('0x24')]()[_0x6db0('0x25')](function(){_0x4d4162[_0x6db0('0x1f')](0xcc)[_0x6db0('0x19')]();});}};}function handleEntityNotFound(_0x4fa792,_0x227ec0){return function(_0x549591){if(!_0x549591){_0x4fa792[_0x6db0('0x18')](0x194);}return _0x549591;};}function handleError(_0x364b53,_0x146e46){_0x146e46=_0x146e46||0x1f4;return function(_0x4b4ebb){logger[_0x6db0('0x26')](_0x4b4ebb[_0x6db0('0x27')]);if(_0x4b4ebb[_0x6db0('0x28')]){delete _0x4b4ebb[_0x6db0('0x28')];}_0x364b53['status'](_0x146e46)[_0x6db0('0x29')](_0x4b4ebb);};}exports[_0x6db0('0x2a')]=function(_0x509437,_0x403ec3){var _0x22eb49={},_0x391a46={},_0x2a10fa={'count':0x0,'rows':[]};var _0x4d9225=_[_0x6db0('0x2b')](db[_0x6db0('0x2c')][_0x6db0('0x2d')],function(_0x4c31f4){return{'name':_0x4c31f4[_0x6db0('0x2e')],'type':_0x4c31f4[_0x6db0('0x2f')][_0x6db0('0x30')]};});_0x391a46['model']=_[_0x6db0('0x2b')](_0x4d9225,'name');_0x391a46[_0x6db0('0x31')]=_[_0x6db0('0x32')](_0x509437['query']);_0x391a46[_0x6db0('0x33')]=_[_0x6db0('0x34')](_0x391a46[_0x6db0('0x35')],_0x391a46[_0x6db0('0x31')]);_0x391a46[_0x6db0('0x33')]=_[_0x6db0('0x36')](_0x391a46[_0x6db0('0x33')],['$and',_0x6db0('0x37'),_0x6db0('0x38'),_0x6db0('0x39'),_0x6db0('0x3a'),_0x6db0('0x3b'),_0x6db0('0x3c'),_0x6db0('0x3d'),_0x6db0('0x3e'),_0x6db0('0x3f'),_0x6db0('0x40'),'$in',_0x6db0('0x41'),'$like',_0x6db0('0x42'),_0x6db0('0x43'),_0x6db0('0x44'),_0x6db0('0x45'),_0x6db0('0x46'),'$contains','$contained',_0x6db0('0x47')]);_0x22eb49[_0x6db0('0x48')]=_[_0x6db0('0x34')](_0x391a46[_0x6db0('0x35')],qs[_0x6db0('0x49')](_0x509437[_0x6db0('0x31')][_0x6db0('0x49')]));_0x22eb49[_0x6db0('0x48')]=_0x22eb49[_0x6db0('0x48')][_0x6db0('0x4a')]?_0x22eb49['attributes']:_0x391a46['model'];if(!_0x509437[_0x6db0('0x31')][_0x6db0('0x4b')](_0x6db0('0x4c'))){_0x22eb49[_0x6db0('0x1d')]=qs[_0x6db0('0x1d')](_0x509437[_0x6db0('0x31')][_0x6db0('0x1d')]);_0x22eb49[_0x6db0('0x1b')]=qs['offset'](_0x509437[_0x6db0('0x31')][_0x6db0('0x1b')]);}_0x22eb49[_0x6db0('0x4d')]=qs['sort'](_0x509437[_0x6db0('0x31')][_0x6db0('0x4e')]);_0x22eb49[_0x6db0('0x4f')]=qs[_0x6db0('0x33')](_[_0x6db0('0x50')](_0x509437[_0x6db0('0x31')],_0x391a46[_0x6db0('0x33')]),_0x4d9225);if(_0x509437[_0x6db0('0x31')]['filter']){_0x22eb49[_0x6db0('0x4f')]=_[_0x6db0('0x51')](_0x22eb49[_0x6db0('0x4f')],{'$or':_['map'](_0x4d9225,function(_0x9c70db){if(_0x9c70db[_0x6db0('0x2f')]!==_0x6db0('0x52')){var _0x3680d5={};_0x3680d5[_0x9c70db[_0x6db0('0x28')]]={'$like':'%'+_0x509437[_0x6db0('0x31')][_0x6db0('0x53')]+'%'};return _0x3680d5;}})});}_0x22eb49=_[_0x6db0('0x51')]({},_0x22eb49,_0x509437[_0x6db0('0x54')]);var _0x3f4359={'where':_0x22eb49[_0x6db0('0x4f')]};return db[_0x6db0('0x2c')][_0x6db0('0x1e')](_0x3f4359)[_0x6db0('0x25')](function(_0x17facb){_0x2a10fa[_0x6db0('0x1e')]=_0x17facb;if(_0x509437[_0x6db0('0x31')]['includeAll']){_0x22eb49[_0x6db0('0x55')]=[{'all':!![]}];}return db[_0x6db0('0x2c')][_0x6db0('0x56')](_0x22eb49);})[_0x6db0('0x25')](function(_0x47cf84){_0x2a10fa[_0x6db0('0x57')]=_0x47cf84;return _0x2a10fa;})[_0x6db0('0x25')](respondWithFilteredResult(_0x403ec3,_0x22eb49))[_0x6db0('0x58')](handleError(_0x403ec3,null));};exports[_0x6db0('0x59')]=function(_0x2f6e52,_0x7412c7){var _0x392363={'raw':!![],'where':{'id':_0x2f6e52[_0x6db0('0x5a')]['id']}},_0x149b65={};_0x149b65['model']=_['keys'](db[_0x6db0('0x2c')][_0x6db0('0x2d')]);_0x149b65[_0x6db0('0x31')]=_[_0x6db0('0x32')](_0x2f6e52[_0x6db0('0x31')]);_0x149b65['filters']=_[_0x6db0('0x34')](_0x149b65[_0x6db0('0x35')],_0x149b65[_0x6db0('0x31')]);_0x392363[_0x6db0('0x48')]=_[_0x6db0('0x34')](_0x149b65[_0x6db0('0x35')],qs[_0x6db0('0x49')](_0x2f6e52[_0x6db0('0x31')][_0x6db0('0x49')]));_0x392363[_0x6db0('0x48')]=_0x392363[_0x6db0('0x48')]['length']?_0x392363[_0x6db0('0x48')]:_0x149b65[_0x6db0('0x35')];if(_0x2f6e52[_0x6db0('0x31')][_0x6db0('0x5b')]){_0x392363[_0x6db0('0x55')]=[{'all':!![]}];}_0x392363=_['merge']({},_0x392363,_0x2f6e52['options']);return db[_0x6db0('0x2c')][_0x6db0('0x5c')](_0x392363)[_0x6db0('0x25')](handleEntityNotFound(_0x7412c7,null))['then'](respondWithResult(_0x7412c7,null))['catch'](handleError(_0x7412c7,null));};exports[_0x6db0('0x5d')]=function(_0x599cc2,_0x52c496){return db[_0x6db0('0x2c')][_0x6db0('0x5d')](_0x599cc2[_0x6db0('0x5e')],{})['then'](respondWithResult(_0x52c496,0xc9))[_0x6db0('0x58')](handleError(_0x52c496,null));};exports[_0x6db0('0x23')]=function(_0x4cea54,_0x3fbbe3){if(_0x4cea54[_0x6db0('0x5e')]['id']){delete _0x4cea54['body']['id'];}return db[_0x6db0('0x2c')][_0x6db0('0x5c')]({'where':{'id':_0x4cea54['params']['id']}})[_0x6db0('0x25')](handleEntityNotFound(_0x3fbbe3,null))['then'](saveUpdates(_0x4cea54[_0x6db0('0x5e')],null))['then'](respondWithResult(_0x3fbbe3,null))[_0x6db0('0x58')](handleError(_0x3fbbe3,null));};exports[_0x6db0('0x5f')]=function(_0x18be8e,_0x5c1cc8){return db[_0x6db0('0x2c')][_0x6db0('0x5f')]()[_0x6db0('0x25')](respondWithResult(_0x5c1cc8,null))[_0x6db0('0x58')](handleError(_0x5c1cc8,null));};exports[_0x6db0('0x24')]=function(_0x457f77,_0x592b24){var _0x5ec572;return db['CmHopper'][_0x6db0('0x5c')]({'where':{'id':_0x457f77['params']['id']}})[_0x6db0('0x25')](handleEntityNotFound(_0x592b24,null))[_0x6db0('0x25')](function(_0x2defb0){if(_0x2defb0){return _0x2defb0[_0x6db0('0x24')]()[_0x6db0('0x25')](function(_0x15762f){return _0x15762f;});}})[_0x6db0('0x25')](function(_0xe83d15){_0x5ec572=_0xe83d15;if(_0xe83d15){if(_0xe83d15[_0x6db0('0x60')]||_0xe83d15[_0x6db0('0x61')]){return db[_0xe83d15[_0x6db0('0x60')]?_0x6db0('0x62'):_0x6db0('0x63')]['find']({'where':{'id':_0xe83d15[_0x6db0('0x60')]?_0xe83d15['VoiceQueueId']:_0xe83d15[_0x6db0('0x61')]},'attributes':['id',_0x6db0('0x28')],'raw':!![]});}}})[_0x6db0('0x25')](function(_0x28e235){var _0x4e0dc0={};if(_0x28e235){_[_0x6db0('0x51')](_0x4e0dc0,_['omit'](_0x5ec572[_0x6db0('0x64')],[_0x6db0('0x65'),_0x6db0('0x66'),'id']));_0x4e0dc0[_0x6db0('0x67')]=0x15;_0x4e0dc0[_0x6db0('0x68')]=_0x6db0('0x69');_0x4e0dc0['campaign']=_0x28e235[_0x6db0('0x28')];_0x4e0dc0[_0x6db0('0x6a')]=_0x457f77[_0x6db0('0x6b')][_0x6db0('0x28')];_0x4e0dc0[_0x6db0('0x6c')]=_0x457f77[_0x6db0('0x6b')]['id'];_0x4e0dc0[_0x6db0('0x69')]=!![];_0x4e0dc0[_0x6db0('0x6d')]=moment()[_0x6db0('0x6e')](_0x6db0('0x6f'));_0x4e0dc0[_0x6db0('0x70')]=_0x5ec572[_0x6db0('0x71')];_0x4e0dc0[_0x6db0('0x72')]=_0x5ec572['VoiceQueueId']?_0x6db0('0x73'):_0x6db0('0x74');return db[_0x6db0('0x75')][_0x6db0('0x5c')]({'where':{'id':_0x4e0dc0[_0x6db0('0x76')]},'attributes':[_0x6db0('0x77'),_0x6db0('0x78')]})[_0x6db0('0x25')](function(_0x41cf50){if(!_[_0x6db0('0x79')](_0x592b24)&&!_[_0x6db0('0x79')](_0x41cf50['firstName'])){_0x4e0dc0[_0x6db0('0x7a')]=_0x41cf50[_0x6db0('0x77')];if(!_[_0x6db0('0x79')](_0x41cf50[_0x6db0('0x78')])){_0x4e0dc0['calleridname']+='\x20'+_0x41cf50[_0x6db0('0x78')];}}})[_0x6db0('0x7b')](function(){return db[_0x6db0('0x7c')][_0x6db0('0x5d')](_0x4e0dc0);});}})[_0x6db0('0x25')](function(){return _0x592b24[_0x6db0('0x1f')](0xcc)['end']();})[_0x6db0('0x58')](handleError(_0x592b24,null));};exports[_0x6db0('0x7d')]=function(_0x1f46a4,_0x4dc2c2,_0x29ac84){var _0x199b55=[];return db[_0x6db0('0x75')]['describe']()[_0x6db0('0x25')](function(_0x42837c){_0x199b55=_[_0x6db0('0x32')](_0x42837c);return _0x1f46a4[_0x6db0('0x6b')][_0x6db0('0x7e')]({'where':{'type':_0x6db0('0x7f'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id','dialOrderByScheduledAt','dialPreviewAutoRecallMe'],'raw':!![]});})['then'](function(_0x2ffba5){if(_0x2ffba5&&_0x2ffba5['length']){return db['sequelize'][_0x6db0('0x80')](function(_0x26cd9e){var _0x5c87d3={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x6db0('0x6e')](_0x6db0('0x6f'))},'VoiceQueueId':{'$in':_['map'](_0x2ffba5,'id')},'$or':[{'UserId':null},{'UserId':_0x1f46a4[_0x6db0('0x6b')]['id']}]};var _0x64fb2e={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x2ffba5)[_0x6db0('0x53')]([_0x6db0('0x81'),0x0])[_0x6db0('0x2b')]('id')[_0x6db0('0x82')]()},'$or':[{'UserId':null},{'UserId':_0x1f46a4[_0x6db0('0x6b')]['id']}]};var _0x4e0f3b={'$or':[_0x5c87d3,_0x64fb2e]};var _0x3e70fe=[];if(_0x1f46a4[_0x6db0('0x5e')][_0x6db0('0x83')]&&_0x1f46a4[_0x6db0('0x5e')][_0x6db0('0x83')]===_0x6db0('0x84')){if(!_[_0x6db0('0x85')](_0x1f46a4[_0x6db0('0x5e')][_0x6db0('0x86')])){_0x4e0f3b['id']={'$in':_0x1f46a4[_0x6db0('0x5e')][_0x6db0('0x86')]};}_0x3e70fe=[['priority','ASC'],['scheduledAt',_0x2ffba5[0x0][_0x6db0('0x87')]===_0x6db0('0x88')?_0x6db0('0x89'):_0x6db0('0x88')],db[_0x6db0('0x8a')][_0x6db0('0x8b')](_0x6db0('0x8c')),['id',_0x6db0('0x89')]];}else{if(!_[_0x6db0('0x85')](_0x1f46a4[_0x6db0('0x5e')][_0x6db0('0x86')])){_0x4e0f3b['id']={'$notIn':_0x1f46a4[_0x6db0('0x5e')]['hopperIds']};}_0x3e70fe=[[_0x6db0('0x8d'),_0x6db0('0x89')],[_0x6db0('0x8e'),_0x2ffba5[0x0][_0x6db0('0x87')]],db[_0x6db0('0x8a')][_0x6db0('0x8b')]('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id',_0x6db0('0x88')]];}return db['CmHopper']['findOne']({'attributes':['id',_0x6db0('0x8f'),'recallme'],'where':_0x4e0f3b,'order':_0x3e70fe,'transaction':_0x26cd9e,'lock':_0x26cd9e['LOCK']['UPDATE'],'include':[{'model':db['CmContact'],'as':_0x6db0('0x90'),'attributes':_0x199b55,'include':[{'model':db[_0x6db0('0x91')],'as':'Company','attributes':['id',_0x6db0('0x28')]}]},{'model':db[_0x6db0('0x92')],'as':_0x6db0('0x93'),'attributes':['id',_0x6db0('0x28')]},{'model':db[_0x6db0('0x62')],'as':_0x6db0('0x94'),'attributes':['id',_0x6db0('0x28'),_0x6db0('0x95')]}]})['then'](function(_0x4ad66a){if(_0x4ad66a){return _0x4ad66a['update']({'UserId':_0x1f46a4['user']['id']},{'transaction':_0x26cd9e});}});});}})[_0x6db0('0x25')](handleEntityNotFound(_0x4dc2c2,null))[_0x6db0('0x25')](respondWithResult(_0x4dc2c2,null))[_0x6db0('0x58')](handleError(_0x4dc2c2,null));};exports[_0x6db0('0x96')]=function(_0xf5fd12,_0x52fe99,_0x36f6c5){var _0x3eadd9=[];return db[_0x6db0('0x75')][_0x6db0('0x5f')]()[_0x6db0('0x25')](function(_0x10b703){_0x3eadd9=_[_0x6db0('0x32')](_0x10b703);return _0xf5fd12['user'][_0x6db0('0x7e')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0x6db0('0x97')},'attributes':['id','dialOrderByScheduledAt',_0x6db0('0x81')],'raw':!![]});})[_0x6db0('0x25')](function(_0x5312e4){if(_0x5312e4&&_0x5312e4['length']){return db[_0x6db0('0x8a')][_0x6db0('0x80')](function(_0x43e570){var _0x4661e7={'active':![],'recallme':!![],'id':_0xf5fd12[_0x6db0('0x5e')][_0x6db0('0x98')]};return db['CmHopper'][_0x6db0('0x99')]({'attributes':['id',_0x6db0('0x8f'),_0x6db0('0x9a')],'where':_0x4661e7,'transaction':_0x43e570,'lock':_0x43e570[_0x6db0('0x9b')][_0x6db0('0x9c')],'include':[{'model':db[_0x6db0('0x75')],'as':_0x6db0('0x90'),'attributes':_0x3eadd9,'include':[{'model':db[_0x6db0('0x91')],'as':_0x6db0('0x9d'),'attributes':['id',_0x6db0('0x28')]}]},{'model':db['CmList'],'as':_0x6db0('0x93'),'attributes':['id','name']},{'model':db['VoiceQueue'],'as':_0x6db0('0x94'),'attributes':['id',_0x6db0('0x28'),_0x6db0('0x95')]}]})[_0x6db0('0x25')](function(_0x5cac11){if(_0x5cac11){return _0x5cac11['update']({'UserId':_0xf5fd12[_0x6db0('0x6b')]['id']},{'transaction':_0x43e570});}});});}})[_0x6db0('0x25')](handleEntityNotFound(_0x52fe99,null))[_0x6db0('0x25')](respondWithResult(_0x52fe99,null))[_0x6db0('0x58')](handleError(_0x52fe99,null));};exports[_0x6db0('0x9e')]=function(_0x180b0d,_0x30feb9,_0x1d3a11){return _0x180b0d[_0x6db0('0x6b')][_0x6db0('0x7e')]({'where':{'type':_0x6db0('0x7f'),'dialActive':!![],'dialMethod':_0x6db0('0x97')},'attributes':['id'],'raw':!![]})['then'](function(_0x404ba7){if(_0x404ba7&&_0x404ba7[_0x6db0('0x4a')]){return db[_0x6db0('0x2c')]['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0x6db0('0x2b')](_0x404ba7,'id')},'$or':[{'UserId':null},{'UserId':_0x180b0d[_0x6db0('0x6b')]['id']}]}});}return 0x0;})[_0x6db0('0x25')](function(_0x12e193){if(!_[_0x6db0('0x79')](_0x12e193)&&_[_0x6db0('0x9f')](_0x12e193)){return _0x30feb9['status'](0xc8)['json']({'contacts':_0x12e193});}else{logger['error'](_0x6db0('0xa0'),_0x6db0('0x9e'),0x194,_0x6db0('0xa1'));_0x30feb9[_0x6db0('0x18')](0x194);}})[_0x6db0('0x58')](handleError(_0x30feb9,null));};exports[_0x6db0('0xa2')]=function(_0x3a60d2,_0x44e115,_0x1bc18f){var _0x406103=shared[_0x6db0('0xa3')];var _0xfd713c=[];_['map'](_0x406103,function(_0x344981){_0xfd713c['push']({'id':_0x344981[_0x6db0('0x28')],'name':_0x344981[_0x6db0('0x28')],'utcOffset':_0x344981[_0x6db0('0xa4')]});});return _0x44e115[_0x6db0('0x1f')](0xc8)[_0x6db0('0x1a')]({'tz':_0xfd713c});};exports['getTimezone']=function(_0x3d353d,_0x4751d0,_0xcb9a0f){var _0x266549=shared[_0x6db0('0xa3')];var _0xc53636={};if(!_[_0x6db0('0x79')](_0x266549[_0x3d353d[_0x6db0('0x5e')]['id']]))_0xc53636=_0x266549[_0x3d353d['body']['id']];return _0x4751d0[_0x6db0('0x1f')](0xc8)[_0x6db0('0x1a')](_0xc53636);}; \ No newline at end of file +var _0xc0d3=['$not','$between','$notBetween','$in','$notIn','$notLike','$iLike','$notILike','$like','$overlap','$contains','$contained','$any','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','includeAll','include','findAll','show','params','keys','length','find','catch','create','body','update','describe','destroy','VoiceQueueId','CampaignId','Campaign','omit','dataValues','createdAt','updatedAt','state','statedesc','deleted','campaign','user','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','queue','CmContact','ContactId','firstName','lastName','isNil','calleridname','CmHopperFinal','getPreview','getVoiceQueues','preview','sequelize','transaction','dialPreviewAutoRecallMe','value','direction','isEmpty','priority','ASC','scheduledAt','dialOrderByScheduledAt','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','DESC','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','recallme','LOCK','Contact','CmCompany','Company','List','VoiceQueue','Queue','dialActive','getPreviewRecall','hopperId','scheduledat','UPDATE','getOpenContacts','isNumber','error','entity\x20not\x20found','getTimezones','timezones','push','utcOffset','getTimezone','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','then','sendStatus','name','send','index','map','CmHopper','rawAttributes','fieldName','type','query','intersection','model','filters','concat','$and','$or','$gt','$gte','$lt','$lte','$ne'];(function(_0xa26aa3,_0x2da21d){var _0x4d9874=function(_0x1ab137){while(--_0x1ab137){_0xa26aa3['push'](_0xa26aa3['shift']());}};_0x4d9874(++_0x2da21d);}(_0xc0d3,0x107));var _0x3c0d=function(_0x87ace,_0x51303e){_0x87ace=_0x87ace-0x0;var _0x1d0246=_0xc0d3[_0x87ace];return _0x1d0246;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3c0d('0x0'));var jsonpatch=require(_0x3c0d('0x1'));var rp=require(_0x3c0d('0x2'));var moment=require(_0x3c0d('0x3'));var BPromise=require(_0x3c0d('0x4'));var Mustache=require(_0x3c0d('0x5'));var util=require(_0x3c0d('0x6'));var path=require(_0x3c0d('0x7'));var sox=require(_0x3c0d('0x8'));var csv=require(_0x3c0d('0x9'));var ejs=require(_0x3c0d('0xa'));var fs=require('fs');var fs_extra=require(_0x3c0d('0xb'));var _=require(_0x3c0d('0xc'));var squel=require('squel');var crypto=require(_0x3c0d('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x3c0d('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x3c0d('0xf'));var qs=require(_0x3c0d('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x3c0d('0x11'))(_0x3c0d('0x12'));var utils=require('../../config/utils');var config=require(_0x3c0d('0x13'));var shared=require(_0x3c0d('0x13'));var licenseUtil=require(_0x3c0d('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x58d476,_0x1c28cb){_0x1c28cb=_0x1c28cb||0xcc;return function(_0x4cb085){if(_0x4cb085){return _0x58d476['sendStatus'](_0x1c28cb);}return _0x58d476[_0x3c0d('0x15')](_0x1c28cb)[_0x3c0d('0x16')]();};}function respondWithResult(_0x1b8d41,_0x609eee){_0x609eee=_0x609eee||0xc8;return function(_0x278b97){if(_0x278b97){return _0x1b8d41['status'](_0x609eee)['json'](_0x278b97);}};}function respondWithFilteredResult(_0xc4ffbb,_0x4bfe86){return function(_0x2777d2){if(_0x2777d2){var _0x108fd3=typeof _0x4bfe86[_0x3c0d('0x17')]===_0x3c0d('0x18')&&typeof _0x4bfe86[_0x3c0d('0x19')]===_0x3c0d('0x18');var _0x43bfff=_0x2777d2[_0x3c0d('0x1a')];var _0x4b5d59=_0x108fd3?0x0:_0x4bfe86[_0x3c0d('0x17')];var _0x44f08b=_0x108fd3?_0x2777d2[_0x3c0d('0x1a')]:_0x4bfe86[_0x3c0d('0x17')]+_0x4bfe86[_0x3c0d('0x19')];var _0x3f5183;if(_0x44f08b>=_0x43bfff){_0x44f08b=_0x43bfff;_0x3f5183=0xc8;}else{_0x3f5183=0xce;}_0xc4ffbb['status'](_0x3f5183);return _0xc4ffbb[_0x3c0d('0x1b')](_0x3c0d('0x1c'),_0x4b5d59+'-'+_0x44f08b+'/'+_0x43bfff)[_0x3c0d('0x1d')](_0x2777d2);}return null;};}function patchUpdates(_0x3a9a49){return function(_0x5c3df0){try{jsonpatch[_0x3c0d('0x1e')](_0x5c3df0,_0x3a9a49,!![]);}catch(_0x3f3aff){return BPromise[_0x3c0d('0x1f')](_0x3f3aff);}return _0x5c3df0[_0x3c0d('0x20')]();};}function saveUpdates(_0x27654c,_0x2b55dd){return function(_0x1d3716){if(_0x1d3716){return _0x1d3716['update'](_0x27654c)[_0x3c0d('0x21')](function(_0x374643){return _0x374643;});}return null;};}function removeEntity(_0x2a8e4a,_0x1cc91f){return function(_0x134a10){if(_0x134a10){return _0x134a10['destroy']()[_0x3c0d('0x21')](function(){_0x2a8e4a[_0x3c0d('0x15')](0xcc)[_0x3c0d('0x16')]();});}};}function handleEntityNotFound(_0x5544e3,_0x4ef368){return function(_0x5ccd98){if(!_0x5ccd98){_0x5544e3[_0x3c0d('0x22')](0x194);}return _0x5ccd98;};}function handleError(_0x38bb2f,_0x4b3aa1){_0x4b3aa1=_0x4b3aa1||0x1f4;return function(_0x368857){logger['error'](_0x368857['stack']);if(_0x368857[_0x3c0d('0x23')]){delete _0x368857[_0x3c0d('0x23')];}_0x38bb2f[_0x3c0d('0x15')](_0x4b3aa1)[_0x3c0d('0x24')](_0x368857);};}exports[_0x3c0d('0x25')]=function(_0x5aecc1,_0x1f58da){var _0x48fbdc={},_0x3132f8={},_0x143562={'count':0x0,'rows':[]};var _0x1e127d=_[_0x3c0d('0x26')](db[_0x3c0d('0x27')][_0x3c0d('0x28')],function(_0x129151){return{'name':_0x129151[_0x3c0d('0x29')],'type':_0x129151[_0x3c0d('0x2a')]['key']};});_0x3132f8['model']=_['map'](_0x1e127d,_0x3c0d('0x23'));_0x3132f8[_0x3c0d('0x2b')]=_['keys'](_0x5aecc1['query']);_0x3132f8['filters']=_[_0x3c0d('0x2c')](_0x3132f8[_0x3c0d('0x2d')],_0x3132f8[_0x3c0d('0x2b')]);_0x3132f8[_0x3c0d('0x2e')]=_[_0x3c0d('0x2f')](_0x3132f8[_0x3c0d('0x2e')],[_0x3c0d('0x30'),_0x3c0d('0x31'),_0x3c0d('0x32'),_0x3c0d('0x33'),_0x3c0d('0x34'),_0x3c0d('0x35'),_0x3c0d('0x36'),'$eq',_0x3c0d('0x37'),_0x3c0d('0x38'),_0x3c0d('0x39'),_0x3c0d('0x3a'),_0x3c0d('0x3b'),'$like',_0x3c0d('0x3c'),_0x3c0d('0x3d'),_0x3c0d('0x3e'),_0x3c0d('0x3f'),_0x3c0d('0x40'),_0x3c0d('0x41'),_0x3c0d('0x42'),_0x3c0d('0x43')]);_0x48fbdc[_0x3c0d('0x44')]=_[_0x3c0d('0x2c')](_0x3132f8[_0x3c0d('0x2d')],qs['fields'](_0x5aecc1[_0x3c0d('0x2b')][_0x3c0d('0x45')]));_0x48fbdc['attributes']=_0x48fbdc[_0x3c0d('0x44')]['length']?_0x48fbdc['attributes']:_0x3132f8[_0x3c0d('0x2d')];if(!_0x5aecc1[_0x3c0d('0x2b')][_0x3c0d('0x46')](_0x3c0d('0x47'))){_0x48fbdc['limit']=qs[_0x3c0d('0x19')](_0x5aecc1[_0x3c0d('0x2b')][_0x3c0d('0x19')]);_0x48fbdc[_0x3c0d('0x17')]=qs['offset'](_0x5aecc1[_0x3c0d('0x2b')][_0x3c0d('0x17')]);}_0x48fbdc[_0x3c0d('0x48')]=qs[_0x3c0d('0x49')](_0x5aecc1['query']['sort']);_0x48fbdc['where']=qs[_0x3c0d('0x2e')](_[_0x3c0d('0x4a')](_0x5aecc1[_0x3c0d('0x2b')],_0x3132f8[_0x3c0d('0x2e')]),_0x1e127d);if(_0x5aecc1[_0x3c0d('0x2b')][_0x3c0d('0x4b')]){_0x48fbdc[_0x3c0d('0x4c')]=_['merge'](_0x48fbdc[_0x3c0d('0x4c')],{'$or':_[_0x3c0d('0x26')](_0x1e127d,function(_0x4367e6){if(_0x4367e6[_0x3c0d('0x2a')]!==_0x3c0d('0x4d')){var _0x48458c={};_0x48458c[_0x4367e6[_0x3c0d('0x23')]]={'$like':'%'+_0x5aecc1[_0x3c0d('0x2b')][_0x3c0d('0x4b')]+'%'};return _0x48458c;}})});}_0x48fbdc=_[_0x3c0d('0x4e')]({},_0x48fbdc,_0x5aecc1['options']);var _0x226d8d={'where':_0x48fbdc[_0x3c0d('0x4c')]};return db[_0x3c0d('0x27')][_0x3c0d('0x1a')](_0x226d8d)['then'](function(_0x2babb3){_0x143562[_0x3c0d('0x1a')]=_0x2babb3;if(_0x5aecc1[_0x3c0d('0x2b')][_0x3c0d('0x4f')]){_0x48fbdc[_0x3c0d('0x50')]=[{'all':!![]}];}return db[_0x3c0d('0x27')][_0x3c0d('0x51')](_0x48fbdc);})[_0x3c0d('0x21')](function(_0x5f5902){_0x143562['rows']=_0x5f5902;return _0x143562;})['then'](respondWithFilteredResult(_0x1f58da,_0x48fbdc))['catch'](handleError(_0x1f58da,null));};exports[_0x3c0d('0x52')]=function(_0x4927b9,_0x4a5b28){var _0x472a5d={'raw':!![],'where':{'id':_0x4927b9[_0x3c0d('0x53')]['id']}},_0x4613fd={};_0x4613fd[_0x3c0d('0x2d')]=_[_0x3c0d('0x54')](db[_0x3c0d('0x27')][_0x3c0d('0x28')]);_0x4613fd[_0x3c0d('0x2b')]=_[_0x3c0d('0x54')](_0x4927b9[_0x3c0d('0x2b')]);_0x4613fd[_0x3c0d('0x2e')]=_['intersection'](_0x4613fd[_0x3c0d('0x2d')],_0x4613fd[_0x3c0d('0x2b')]);_0x472a5d[_0x3c0d('0x44')]=_[_0x3c0d('0x2c')](_0x4613fd[_0x3c0d('0x2d')],qs[_0x3c0d('0x45')](_0x4927b9[_0x3c0d('0x2b')][_0x3c0d('0x45')]));_0x472a5d[_0x3c0d('0x44')]=_0x472a5d[_0x3c0d('0x44')][_0x3c0d('0x55')]?_0x472a5d[_0x3c0d('0x44')]:_0x4613fd['model'];if(_0x4927b9['query']['includeAll']){_0x472a5d[_0x3c0d('0x50')]=[{'all':!![]}];}_0x472a5d=_['merge']({},_0x472a5d,_0x4927b9['options']);return db[_0x3c0d('0x27')][_0x3c0d('0x56')](_0x472a5d)[_0x3c0d('0x21')](handleEntityNotFound(_0x4a5b28,null))[_0x3c0d('0x21')](respondWithResult(_0x4a5b28,null))[_0x3c0d('0x57')](handleError(_0x4a5b28,null));};exports[_0x3c0d('0x58')]=function(_0x221f88,_0x402935){return db[_0x3c0d('0x27')]['create'](_0x221f88[_0x3c0d('0x59')],{})[_0x3c0d('0x21')](respondWithResult(_0x402935,0xc9))[_0x3c0d('0x57')](handleError(_0x402935,null));};exports[_0x3c0d('0x5a')]=function(_0x4b32a2,_0xc61921){if(_0x4b32a2['body']['id']){delete _0x4b32a2[_0x3c0d('0x59')]['id'];}return db[_0x3c0d('0x27')][_0x3c0d('0x56')]({'where':{'id':_0x4b32a2[_0x3c0d('0x53')]['id']}})[_0x3c0d('0x21')](handleEntityNotFound(_0xc61921,null))[_0x3c0d('0x21')](saveUpdates(_0x4b32a2[_0x3c0d('0x59')],null))[_0x3c0d('0x21')](respondWithResult(_0xc61921,null))[_0x3c0d('0x57')](handleError(_0xc61921,null));};exports[_0x3c0d('0x5b')]=function(_0x19ad1d,_0x340f4b){return db[_0x3c0d('0x27')]['describe']()[_0x3c0d('0x21')](respondWithResult(_0x340f4b,null))[_0x3c0d('0x57')](handleError(_0x340f4b,null));};exports['destroy']=function(_0x2fb106,_0x452147){var _0x563db5;return db[_0x3c0d('0x27')][_0x3c0d('0x56')]({'where':{'id':_0x2fb106['params']['id']}})[_0x3c0d('0x21')](handleEntityNotFound(_0x452147,null))[_0x3c0d('0x21')](function(_0x434f6c){if(_0x434f6c){return _0x434f6c[_0x3c0d('0x5c')]()[_0x3c0d('0x21')](function(_0x43cccb){return _0x43cccb;});}})[_0x3c0d('0x21')](function(_0x86e4c8){_0x563db5=_0x86e4c8;if(_0x86e4c8){if(_0x86e4c8[_0x3c0d('0x5d')]||_0x86e4c8[_0x3c0d('0x5e')]){return db[_0x86e4c8[_0x3c0d('0x5d')]?'VoiceQueue':_0x3c0d('0x5f')][_0x3c0d('0x56')]({'where':{'id':_0x86e4c8[_0x3c0d('0x5d')]?_0x86e4c8['VoiceQueueId']:_0x86e4c8[_0x3c0d('0x5e')]},'attributes':['id','name'],'raw':!![]});}}})[_0x3c0d('0x21')](function(_0x3bfa6c){var _0x19eed8={};if(_0x3bfa6c){_[_0x3c0d('0x4e')](_0x19eed8,_[_0x3c0d('0x60')](_0x563db5[_0x3c0d('0x61')],[_0x3c0d('0x62'),_0x3c0d('0x63'),'id']));_0x19eed8[_0x3c0d('0x64')]=0x15;_0x19eed8[_0x3c0d('0x65')]=_0x3c0d('0x66');_0x19eed8[_0x3c0d('0x67')]=_0x3bfa6c[_0x3c0d('0x23')];_0x19eed8['membername']=_0x2fb106['user']['name'];_0x19eed8['UserId']=_0x2fb106[_0x3c0d('0x68')]['id'];_0x19eed8[_0x3c0d('0x66')]=!![];_0x19eed8[_0x3c0d('0x69')]=moment()[_0x3c0d('0x6a')](_0x3c0d('0x6b'));_0x19eed8[_0x3c0d('0x6c')]=_0x563db5[_0x3c0d('0x6d')];_0x19eed8[_0x3c0d('0x6e')]=_0x563db5[_0x3c0d('0x5d')]?_0x3c0d('0x6f'):'ivr';return db[_0x3c0d('0x70')][_0x3c0d('0x56')]({'where':{'id':_0x19eed8[_0x3c0d('0x71')]},'attributes':[_0x3c0d('0x72'),_0x3c0d('0x73')]})['then'](function(_0x3d5b67){if(!_[_0x3c0d('0x74')](_0x452147)&&!_['isNil'](_0x3d5b67['firstName'])){_0x19eed8[_0x3c0d('0x75')]=_0x3d5b67['firstName'];if(!_[_0x3c0d('0x74')](_0x3d5b67[_0x3c0d('0x73')])){_0x19eed8['calleridname']+='\x20'+_0x3d5b67[_0x3c0d('0x73')];}}})['finally'](function(){return db[_0x3c0d('0x76')][_0x3c0d('0x58')](_0x19eed8);});}})[_0x3c0d('0x21')](function(){return _0x452147[_0x3c0d('0x15')](0xcc)[_0x3c0d('0x16')]();})['catch'](handleError(_0x452147,null));};exports[_0x3c0d('0x77')]=function(_0x703e3c,_0x29cafb,_0x3e1646){var _0x252a2d=[];return db[_0x3c0d('0x70')][_0x3c0d('0x5b')]()[_0x3c0d('0x21')](function(_0x198821){_0x252a2d=_[_0x3c0d('0x54')](_0x198821);return _0x703e3c[_0x3c0d('0x68')][_0x3c0d('0x78')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0x3c0d('0x79')},'attributes':['id','dialOrderByScheduledAt','dialPreviewAutoRecallMe'],'raw':!![]});})['then'](function(_0x22e3be){if(_0x22e3be&&_0x22e3be['length']){return db[_0x3c0d('0x7a')][_0x3c0d('0x7b')](function(_0x248d97){var _0x3a5cb2={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x3c0d('0x6a')](_0x3c0d('0x6b'))},'VoiceQueueId':{'$in':_['map'](_0x22e3be,'id')},'$or':[{'UserId':null},{'UserId':_0x703e3c[_0x3c0d('0x68')]['id']}]};var _0x3d73f4={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x22e3be)[_0x3c0d('0x4b')]([_0x3c0d('0x7c'),0x0])[_0x3c0d('0x26')]('id')[_0x3c0d('0x7d')]()},'$or':[{'UserId':null},{'UserId':_0x703e3c[_0x3c0d('0x68')]['id']}]};var _0x275ffd={'$or':[_0x3a5cb2,_0x3d73f4]};var _0x423aa6=[];if(_0x703e3c[_0x3c0d('0x59')][_0x3c0d('0x7e')]&&_0x703e3c['body']['direction']==='prev'){if(!_[_0x3c0d('0x7f')](_0x703e3c[_0x3c0d('0x59')]['hopperIds'])){_0x275ffd['id']={'$in':_0x703e3c[_0x3c0d('0x59')]['hopperIds']};}_0x423aa6=[[_0x3c0d('0x80'),_0x3c0d('0x81')],[_0x3c0d('0x82'),_0x22e3be[0x0][_0x3c0d('0x83')]===_0x3c0d('0x81')?'DESC':'ASC'],db[_0x3c0d('0x7a')][_0x3c0d('0x84')](_0x3c0d('0x85')),['id',_0x3c0d('0x86')]];}else{if(!_[_0x3c0d('0x7f')](_0x703e3c[_0x3c0d('0x59')]['hopperIds'])){_0x275ffd['id']={'$notIn':_0x703e3c[_0x3c0d('0x59')]['hopperIds']};}_0x423aa6=[['priority','DESC'],[_0x3c0d('0x82'),_0x22e3be[0x0][_0x3c0d('0x83')]],db[_0x3c0d('0x7a')][_0x3c0d('0x84')](_0x3c0d('0x87')),['id',_0x3c0d('0x81')]];}return db['CmHopper'][_0x3c0d('0x88')]({'attributes':['id','scheduledat',_0x3c0d('0x89')],'where':_0x275ffd,'order':_0x423aa6,'transaction':_0x248d97,'lock':_0x248d97[_0x3c0d('0x8a')]['UPDATE'],'include':[{'model':db[_0x3c0d('0x70')],'as':_0x3c0d('0x8b'),'attributes':_0x252a2d,'include':[{'model':db[_0x3c0d('0x8c')],'as':_0x3c0d('0x8d'),'attributes':['id',_0x3c0d('0x23')]}]},{'model':db['CmList'],'as':_0x3c0d('0x8e'),'attributes':['id','name']},{'model':db[_0x3c0d('0x8f')],'as':_0x3c0d('0x90'),'attributes':['id',_0x3c0d('0x23'),_0x3c0d('0x91')]}]})[_0x3c0d('0x21')](function(_0x2aded2){if(_0x2aded2){return _0x2aded2[_0x3c0d('0x5a')]({'UserId':_0x703e3c[_0x3c0d('0x68')]['id']},{'transaction':_0x248d97});}});});}})['then'](handleEntityNotFound(_0x29cafb,null))['then'](respondWithResult(_0x29cafb,null))[_0x3c0d('0x57')](handleError(_0x29cafb,null));};exports[_0x3c0d('0x92')]=function(_0x4e1ce8,_0x4a5a56,_0x2e97ff){var _0x46faee=[];return db[_0x3c0d('0x70')][_0x3c0d('0x5b')]()[_0x3c0d('0x21')](function(_0x555484){_0x46faee=_['keys'](_0x555484);return _0x4e1ce8['user'][_0x3c0d('0x78')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':'preview'},'attributes':['id','dialOrderByScheduledAt','dialPreviewAutoRecallMe'],'raw':!![]});})[_0x3c0d('0x21')](function(_0x84662b){if(_0x84662b&&_0x84662b['length']){return db[_0x3c0d('0x7a')][_0x3c0d('0x7b')](function(_0x559a5a){var _0x4290cb={'active':![],'recallme':!![],'id':_0x4e1ce8[_0x3c0d('0x59')][_0x3c0d('0x93')]};return db['CmHopper'][_0x3c0d('0x88')]({'attributes':['id',_0x3c0d('0x94'),'recallme'],'where':_0x4290cb,'transaction':_0x559a5a,'lock':_0x559a5a['LOCK'][_0x3c0d('0x95')],'include':[{'model':db[_0x3c0d('0x70')],'as':_0x3c0d('0x8b'),'attributes':_0x46faee,'include':[{'model':db[_0x3c0d('0x8c')],'as':'Company','attributes':['id',_0x3c0d('0x23')]}]},{'model':db['CmList'],'as':_0x3c0d('0x8e'),'attributes':['id',_0x3c0d('0x23')]},{'model':db[_0x3c0d('0x8f')],'as':'Queue','attributes':['id',_0x3c0d('0x23'),'dialActive']}]})['then'](function(_0xa8296a){if(_0xa8296a){return _0xa8296a['update']({'UserId':_0x4e1ce8['user']['id']},{'transaction':_0x559a5a});}});});}})['then'](handleEntityNotFound(_0x4a5a56,null))['then'](respondWithResult(_0x4a5a56,null))[_0x3c0d('0x57')](handleError(_0x4a5a56,null));};exports[_0x3c0d('0x96')]=function(_0x11581a,_0x5ced9c,_0x1c8771){return _0x11581a['user'][_0x3c0d('0x78')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0x3c0d('0x79')},'attributes':['id'],'raw':!![]})['then'](function(_0x3779d8){if(_0x3779d8&&_0x3779d8[_0x3c0d('0x55')]){return db['CmHopper'][_0x3c0d('0x1a')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x3c0d('0x6a')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_['map'](_0x3779d8,'id')},'$or':[{'UserId':null},{'UserId':_0x11581a['user']['id']}]}});}return 0x0;})[_0x3c0d('0x21')](function(_0x5eebcf){if(!_[_0x3c0d('0x74')](_0x5eebcf)&&_[_0x3c0d('0x97')](_0x5eebcf)){return _0x5ced9c[_0x3c0d('0x15')](0xc8)[_0x3c0d('0x1d')]({'contacts':_0x5eebcf});}else{logger[_0x3c0d('0x98')]('CmHopper,\x20%s,\x20%s,\x20%s',_0x3c0d('0x96'),0x194,_0x3c0d('0x99'));_0x5ced9c[_0x3c0d('0x22')](0x194);}})[_0x3c0d('0x57')](handleError(_0x5ced9c,null));};exports[_0x3c0d('0x9a')]=function(_0x2b7622,_0x4e7559,_0x53ad7a){var _0x472079=shared[_0x3c0d('0x9b')];var _0x25e3a8=[];_[_0x3c0d('0x26')](_0x472079,function(_0x8d9dfe){_0x25e3a8[_0x3c0d('0x9c')]({'id':_0x8d9dfe['name'],'name':_0x8d9dfe['name'],'utcOffset':_0x8d9dfe[_0x3c0d('0x9d')]});});return _0x4e7559[_0x3c0d('0x15')](0xc8)[_0x3c0d('0x1d')]({'tz':_0x25e3a8});};exports[_0x3c0d('0x9e')]=function(_0x52aa39,_0x771611,_0x19e338){var _0x4e4fbc=shared[_0x3c0d('0x9b')];var _0x34213f={};if(!_[_0x3c0d('0x74')](_0x4e4fbc[_0x52aa39[_0x3c0d('0x59')]['id']]))_0x34213f=_0x4e4fbc[_0x52aa39[_0x3c0d('0x59')]['id']];return _0x771611['status'](0xc8)[_0x3c0d('0x1d')](_0x34213f);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 9dcb738..84cc996 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 _0xd117=['bluebird','request-promise','path','rimraf','../../config/environment','./cmHopper.attributes','exports','define','CmHopper','scheduledat','phone','priority','lodash','util','../../config/logger','api','moment'];(function(_0x235482,_0x14b833){var _0x5f5bea=function(_0x17a254){while(--_0x17a254){_0x235482['push'](_0x235482['shift']());}};_0x5f5bea(++_0x14b833);}(_0xd117,0x182));var _0x7d11=function(_0x544099,_0x372b30){_0x544099=_0x544099-0x0;var _0x20ab09=_0xd117[_0x544099];return _0x20ab09;};'use strict';var _=require(_0x7d11('0x0'));var util=require(_0x7d11('0x1'));var logger=require(_0x7d11('0x2'))(_0x7d11('0x3'));var moment=require(_0x7d11('0x4'));var BPromise=require(_0x7d11('0x5'));var rp=require(_0x7d11('0x6'));var fs=require('fs');var path=require(_0x7d11('0x7'));var rimraf=require(_0x7d11('0x8'));var config=require(_0x7d11('0x9'));var attributes=require(_0x7d11('0xa'));module[_0x7d11('0xb')]=function(_0x27d7e8,_0x40c3c4){return _0x27d7e8[_0x7d11('0xc')](_0x7d11('0xd'),attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':_0x7d11('0xe'),'fields':[_0x7d11('0xe')]},{'name':_0x7d11('0xf'),'fields':['phone']},{'name':_0x7d11('0x10'),'fields':[_0x7d11('0x10')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4819=['request-promise','path','rimraf','../../config/environment','./cmHopper.attributes','CmHopper','cm_hopper','scheduledat','phone','priority','util','../../config/logger','api','moment','bluebird'];(function(_0x39338d,_0x19b64b){var _0x273a6a=function(_0x15a7bf){while(--_0x15a7bf){_0x39338d['push'](_0x39338d['shift']());}};_0x273a6a(++_0x19b64b);}(_0x4819,0xcd));var _0x9481=function(_0x70dc3f,_0xfc371b){_0x70dc3f=_0x70dc3f-0x0;var _0x447aa4=_0x4819[_0x70dc3f];return _0x447aa4;};'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'));module['exports']=function(_0x4d9e3a,_0x5def07){return _0x4d9e3a['define'](_0x9481('0xa'),attributes,{'tableName':_0x9481('0xb'),'paranoid':![],'indexes':[{'name':_0x9481('0xc'),'fields':[_0x9481('0xc')]},{'name':_0x9481('0xd'),'fields':['phone']},{'name':_0x9481('0xe'),'fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index e2453e4..bca2432 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 _0x1b52=['phone','dialTimezone','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','CmList','List','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','info','CmHopper,\x20%s,\x20%s','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetCmHopper','findAll','options','raw','where','attributes','limit','include','model','map','then','stringify','CmHopper','find','ShowCmHopper','create','body','CreateCmHopper','UpdateCmHopper','update','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','destroy','CmContact','describe','sequelize','transaction','Contact','keys','User','Agent','name','voicePause','length','UserId','push','includes','GetContactDialer','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','MoveContactManagedDialer','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','contactsRescheduled','GetContactRecallMe','UPDATE','GetCmHopperPreview','GetContactByPhone','findOne'];(function(_0x264585,_0xe94438){var _0x304257=function(_0x5e9f25){while(--_0x5e9f25){_0x264585['push'](_0x264585['shift']());}};_0x304257(++_0xe94438);}(_0x1b52,0x165));var _0x21b5=function(_0x57486e,_0x32283b){_0x57486e=_0x57486e-0x0;var _0x5f110b=_0x1b52[_0x57486e];return _0x5f110b;};'use strict';var _=require(_0x21b5('0x0'));var util=require(_0x21b5('0x1'));var moment=require(_0x21b5('0x2'));var BPromise=require('bluebird');var rs=require(_0x21b5('0x3'));var fs=require('fs');var Redis=require(_0x21b5('0x4'));var db=require(_0x21b5('0x5'))['db'];var utils=require(_0x21b5('0x6'));var logger=require('../../config/logger')(_0x21b5('0x7'));var config=require(_0x21b5('0x8'));var jayson=require('jayson/promise');const {validateExpressRequest}=require('twilio/lib/webhooks/webhooks');var client=jayson[_0x21b5('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3f8f0b,_0xc1107a,_0x19fa03){return new BPromise(function(_0x406b24,_0x56e681){return client['request'](_0x3f8f0b,_0x19fa03)['then'](function(_0x4f1355){logger[_0x21b5('0xa')](_0x21b5('0xb'),_0xc1107a,_0x21b5('0xc'));logger[_0x21b5('0xd')](_0x21b5('0xe'),_0xc1107a,_0x21b5('0xc'),JSON['stringify'](_0x4f1355));if(_0x4f1355[_0x21b5('0xf')]){if(_0x4f1355[_0x21b5('0xf')][_0x21b5('0x10')]===0x1f4){logger['error'](_0x21b5('0xb'),_0xc1107a,_0x4f1355[_0x21b5('0xf')][_0x21b5('0x11')]);return _0x56e681(_0x4f1355['error'][_0x21b5('0x11')]);}logger[_0x21b5('0xf')](_0x21b5('0xb'),_0xc1107a,_0x4f1355[_0x21b5('0xf')][_0x21b5('0x11')]);return _0x406b24(_0x4f1355[_0x21b5('0xf')][_0x21b5('0x11')]);}else{logger[_0x21b5('0xa')](_0x21b5('0xb'),_0xc1107a,'request\x20sent');_0x406b24(_0x4f1355[_0x21b5('0x12')][_0x21b5('0x11')]);}})[_0x21b5('0x13')](function(_0x49f58a){logger[_0x21b5('0xf')]('CmHopper,\x20%s,\x20%s',_0xc1107a,_0x49f58a);_0x56e681(_0x49f58a);});});}exports[_0x21b5('0x14')]=function(_0x12ad29){var _0x5267ab=this;return new Promise(function(_0x280629,_0x74af6e){return db['CmHopper'][_0x21b5('0x15')]({'raw':_0x12ad29[_0x21b5('0x16')]?_0x12ad29[_0x21b5('0x16')][_0x21b5('0x17')]===undefined?!![]:![]:!![],'where':_0x12ad29[_0x21b5('0x16')]?_0x12ad29['options'][_0x21b5('0x18')]||null:null,'attributes':_0x12ad29[_0x21b5('0x16')]?_0x12ad29[_0x21b5('0x16')][_0x21b5('0x19')]||null:null,'limit':_0x12ad29['options']?_0x12ad29['options'][_0x21b5('0x1a')]||null:null,'include':_0x12ad29[_0x21b5('0x16')]?_0x12ad29[_0x21b5('0x16')][_0x21b5('0x1b')]?_['map'](_0x12ad29[_0x21b5('0x16')][_0x21b5('0x1b')],function(_0x2801a8){return{'model':db[_0x2801a8[_0x21b5('0x1c')]],'as':_0x2801a8['as'],'attributes':_0x2801a8[_0x21b5('0x19')],'include':_0x2801a8[_0x21b5('0x1b')]?_[_0x21b5('0x1d')](_0x2801a8[_0x21b5('0x1b')],function(_0x1ec6cd){return{'model':db[_0x1ec6cd['model']],'as':_0x1ec6cd['as'],'attributes':_0x1ec6cd[_0x21b5('0x19')],'include':_0x1ec6cd[_0x21b5('0x1b')]?_[_0x21b5('0x1d')](_0x1ec6cd[_0x21b5('0x1b')],function(_0x19a45e){return{'model':db[_0x19a45e[_0x21b5('0x1c')]],'as':_0x19a45e['as'],'attributes':_0x19a45e[_0x21b5('0x19')]};}):[]};}):[]};}):[]:[]})[_0x21b5('0x1e')](function(_0xa55da2){logger[_0x21b5('0xa')](_0x21b5('0x14'),_0x12ad29);logger['debug'](_0x21b5('0x14'),_0x12ad29,JSON[_0x21b5('0x1f')](_0xa55da2));_0x280629(_0xa55da2);})[_0x21b5('0x13')](function(_0xa21c69){logger['error'](_0x21b5('0x14'),_0xa21c69[_0x21b5('0x11')],_0x12ad29);_0x74af6e(_0x5267ab[_0x21b5('0xf')](0x1f4,_0xa21c69[_0x21b5('0x11')]));});});};exports['ShowCmHopper']=function(_0x4b20ea){var _0xe06f6a=this;return new Promise(function(_0xfce606,_0x1df18b){return db[_0x21b5('0x20')][_0x21b5('0x21')]({'raw':_0x4b20ea[_0x21b5('0x16')]?_0x4b20ea[_0x21b5('0x16')][_0x21b5('0x17')]===undefined?!![]:![]:!![],'where':_0x4b20ea['options']?_0x4b20ea[_0x21b5('0x16')][_0x21b5('0x18')]||null:null,'attributes':_0x4b20ea[_0x21b5('0x16')]?_0x4b20ea['options']['attributes']||null:null,'include':_0x4b20ea['options']?_0x4b20ea[_0x21b5('0x16')][_0x21b5('0x1b')]?_[_0x21b5('0x1d')](_0x4b20ea['options']['include'],function(_0x3e24d5){return{'model':db[_0x3e24d5['model']],'as':_0x3e24d5['as'],'attributes':_0x3e24d5[_0x21b5('0x19')],'include':_0x3e24d5[_0x21b5('0x1b')]?_['map'](_0x3e24d5['include'],function(_0x51a497){return{'model':db[_0x51a497[_0x21b5('0x1c')]],'as':_0x51a497['as'],'attributes':_0x51a497[_0x21b5('0x19')],'include':_0x51a497[_0x21b5('0x1b')]?_[_0x21b5('0x1d')](_0x51a497['include'],function(_0x6cc21f){return{'model':db[_0x6cc21f['model']],'as':_0x6cc21f['as'],'attributes':_0x6cc21f[_0x21b5('0x19')]};}):[]};}):[]};}):[]:[]})[_0x21b5('0x1e')](function(_0x29b5d8){logger[_0x21b5('0xa')]('ShowCmHopper',_0x4b20ea);logger[_0x21b5('0xd')](_0x21b5('0x22'),_0x4b20ea,JSON[_0x21b5('0x1f')](_0x29b5d8));_0xfce606(_0x29b5d8);})['catch'](function(_0x205bfc){logger[_0x21b5('0xf')](_0x21b5('0x22'),_0x205bfc[_0x21b5('0x11')],_0x4b20ea);_0x1df18b(_0xe06f6a['error'](0x1f4,_0x205bfc['message']));});});};exports['CreateCmHopper']=function(_0x555668){var _0x51ad02=this;return new Promise(function(_0x43c776,_0x368f50){return db[_0x21b5('0x20')][_0x21b5('0x23')](_0x555668[_0x21b5('0x24')],{'raw':_0x555668[_0x21b5('0x16')]?_0x555668[_0x21b5('0x16')]['raw']===undefined?!![]:![]:!![]})[_0x21b5('0x1e')](function(_0x3fb439){logger[_0x21b5('0xa')](_0x21b5('0x25'),_0x555668);logger[_0x21b5('0xd')]('CreateCmHopper',_0x555668,JSON[_0x21b5('0x1f')](_0x3fb439));_0x43c776(_0x3fb439);})[_0x21b5('0x13')](function(_0x1ffdf7){logger['error']('CreateCmHopper',_0x1ffdf7[_0x21b5('0x11')],_0x555668);_0x368f50(_0x51ad02[_0x21b5('0xf')](0x1f4,_0x1ffdf7['message']));});});};exports[_0x21b5('0x26')]=function(_0x16585){var _0x39d3c4=this;return new Promise(function(_0x4795a4,_0x1cfafa){return db['CmHopper'][_0x21b5('0x27')](_0x16585['body'],{'raw':_0x16585[_0x21b5('0x16')]?_0x16585[_0x21b5('0x16')][_0x21b5('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x16585[_0x21b5('0x16')]?_0x16585['options'][_0x21b5('0x18')]||null:null,'attributes':_0x16585['options']?_0x16585[_0x21b5('0x16')][_0x21b5('0x19')]||null:null,'limit':_0x16585['options']?_0x16585['options'][_0x21b5('0x1a')]||null:null})['then'](function(_0x6d9361){logger[_0x21b5('0xa')](_0x21b5('0x26'),_0x16585);logger[_0x21b5('0xa')](_0x21b5('0x28'),JSON['stringify'](_0x16585[_0x21b5('0x16')][_0x21b5('0x18')]),_0x16585[_0x21b5('0x24')][_0x21b5('0x29')]);logger[_0x21b5('0xd')](_0x21b5('0x26'),_0x16585,JSON['stringify'](_0x6d9361));_0x4795a4(_0x6d9361);})[_0x21b5('0x13')](function(_0x1dc451){logger['error'](_0x21b5('0x26'),_0x1dc451[_0x21b5('0x11')],_0x16585);_0x1cfafa(_0x39d3c4[_0x21b5('0xf')](0x1f4,_0x1dc451[_0x21b5('0x11')]));});});};exports[_0x21b5('0x2a')]=function(_0x6462ff){var _0x3124c2=this;return new Promise(function(_0x5ac946,_0x590be2){return db[_0x21b5('0x20')][_0x21b5('0x2b')]({'where':_0x6462ff[_0x21b5('0x16')]?_0x6462ff['options'][_0x21b5('0x18')]||null:null})[_0x21b5('0x1e')](function(_0x2b0000){logger[_0x21b5('0xa')](_0x21b5('0x2a'),_0x6462ff);logger[_0x21b5('0xd')]('DestroyCmHopper',_0x6462ff,JSON[_0x21b5('0x1f')](_0x2b0000));_0x5ac946(_0x2b0000);})[_0x21b5('0x13')](function(_0x3f2f22){logger[_0x21b5('0xf')](_0x21b5('0x2a'),_0x3f2f22['message'],_0x6462ff);_0x590be2(_0x3124c2['error'](0x1f4,_0x3f2f22[_0x21b5('0x11')]));});});};exports['GetContactDialer']=function(_0x4f97dc){var _0x12e3f3=this;return new Promise(function(_0xf43431,_0x1d5433){return db[_0x21b5('0x2c')][_0x21b5('0x2d')]()[_0x21b5('0x1e')](function(_0x4be55d){return db[_0x21b5('0x2e')][_0x21b5('0x2f')](function(_0x37b80d){return db[_0x21b5('0x20')]['findAll']({'where':_0x4f97dc[_0x21b5('0x16')]?_0x4f97dc[_0x21b5('0x16')][_0x21b5('0x18')]||null:null,'attributes':_0x4f97dc[_0x21b5('0x16')]?_0x4f97dc[_0x21b5('0x16')][_0x21b5('0x19')]||null:null,'limit':_0x4f97dc[_0x21b5('0x16')]?_0x4f97dc[_0x21b5('0x16')]['limit']||null:null,'order':_0x4f97dc[_0x21b5('0x16')]?_0x4f97dc[_0x21b5('0x16')]['order']||null:null,'transaction':_0x37b80d,'lock':_0x37b80d['LOCK']['UPDATE'],'include':[{'model':db[_0x21b5('0x2c')],'as':_0x21b5('0x30'),'attributes':_[_0x21b5('0x31')](_0x4be55d)},{'model':db[_0x21b5('0x32')],'as':_0x21b5('0x33'),'attributes':['id',_0x21b5('0x34'),_0x21b5('0x35')]}]})[_0x21b5('0x1e')](function(_0x2f96b4){var _0x550184=[];var _0x5e35ee=[];for(var _0x58cab9=0x0;_0x58cab9<_0x2f96b4[_0x21b5('0x36')];_0x58cab9+=0x1){var _0x11f18c=_0x2f96b4[_0x58cab9][_0x21b5('0x37')];if(_0x11f18c===null){_0x550184[_0x21b5('0x38')](_0x2f96b4[_0x58cab9][_0x21b5('0x27')](_0x4f97dc[_0x21b5('0x24')],{'transaction':_0x37b80d}));}else if(!_0x5e35ee[_0x21b5('0x39')](_0x11f18c)){_0x5e35ee[_0x21b5('0x38')](_0x11f18c);_0x550184[_0x21b5('0x38')](_0x2f96b4[_0x58cab9]['update'](_0x4f97dc[_0x21b5('0x24')],{'transaction':_0x37b80d}));}}return BPromise['all'](_0x550184);});})[_0x21b5('0x1e')](function(_0x583b01){logger[_0x21b5('0xa')](_0x21b5('0x3a'),_0x4f97dc);if(_0x583b01[_0x21b5('0x36')]>0x0){logger[_0x21b5('0xa')](_0x21b5('0x3b'),_0x583b01[0x0][_0x21b5('0x3c')]['id'],_0x583b01[0x0][_0x21b5('0x3c')][_0x21b5('0x3d')],_0x583b01[0x0][_0x21b5('0x3c')][_0x21b5('0x29')]);}logger[_0x21b5('0xd')](_0x21b5('0x3a'),_0x4f97dc,JSON[_0x21b5('0x1f')](_0x583b01));_0xf43431(_0x583b01);})['catch'](function(_0x52f7ad){logger['error'](_0x21b5('0x3a'),_0x52f7ad[_0x21b5('0x11')],_0x4f97dc);_0x1d5433(_0x12e3f3[_0x21b5('0xf')](0x1f4,_0x52f7ad[_0x21b5('0x11')]));});});});};exports[_0x21b5('0x3e')]=function(_0x2ee10c){var _0xb91ca2=this;return new Promise(function(_0x10f73d,_0x1c5304){return db['sequelize'][_0x21b5('0x2f')](function(_0x11ad95){return db[_0x21b5('0x3f')][_0x21b5('0x23')](_0x2ee10c[_0x21b5('0x24')],{'raw':_0x2ee10c[_0x21b5('0x16')]?_0x2ee10c[_0x21b5('0x16')][_0x21b5('0x17')]===undefined?!![]:![]:!![],'transaction':_0x11ad95})[_0x21b5('0x1e')](function(){logger[_0x21b5('0xa')](_0x21b5('0x40'),JSON['stringify'](_0x2ee10c['options'][_0x21b5('0x18')]),_0x2ee10c['options'][_0x21b5('0x18')][_0x21b5('0x29')]);return db[_0x21b5('0x20')][_0x21b5('0x2b')]({'where':_0x2ee10c[_0x21b5('0x16')]?_0x2ee10c[_0x21b5('0x16')]['where']||null:null,'transaction':_0x11ad95});});})[_0x21b5('0x1e')](function(_0x24a333){logger[_0x21b5('0xa')](_0x21b5('0x3e'),_0x2ee10c);logger[_0x21b5('0xd')]('MoveContactManagedDialer',_0x2ee10c,JSON[_0x21b5('0x1f')](_0x24a333));_0x10f73d(_0x24a333);})[_0x21b5('0x13')](function(_0x482be0){logger['error'](_0x21b5('0x3e'),_0x482be0['message'],_0x2ee10c);_0x1c5304(_0xb91ca2[_0x21b5('0xf')](0x1f4,_0x482be0[_0x21b5('0x11')]));});});};exports[_0x21b5('0x41')]=function(_0x3ca7e1){var _0xa0c7c0=this;return new Promise(function(_0x16e468,_0x8da82d){return db[_0x21b5('0x20')][_0x21b5('0x15')]({'raw':_0x3ca7e1['options']?_0x3ca7e1[_0x21b5('0x16')][_0x21b5('0x17')]===undefined?!![]:![]:!![],'where':_0x3ca7e1[_0x21b5('0x16')]?_0x3ca7e1[_0x21b5('0x16')][_0x21b5('0x18')]||null:null,'attributes':[[db[_0x21b5('0x2e')]['fn'](_0x21b5('0x42'),db[_0x21b5('0x2e')]['fn']('IF',db[_0x21b5('0x2e')][_0x21b5('0x43')](_0x21b5('0x44')+util[_0x21b5('0x45')](_0x21b5('0x46'),moment()[_0x21b5('0x45')](_0x21b5('0x47')))+'\x20,\x201,\x20null'))),_0x21b5('0x48')]]})[_0x21b5('0x1e')](function(_0x2126e2){logger[_0x21b5('0xa')](_0x21b5('0x41'),_0x3ca7e1);logger[_0x21b5('0xd')]('CountReScheduled',_0x3ca7e1,JSON[_0x21b5('0x1f')](_0x2126e2));_0x16e468(_0x2126e2);})[_0x21b5('0x13')](function(_0x48594d){logger[_0x21b5('0xf')]('CountReScheduled',_0x48594d[_0x21b5('0x11')],_0x3ca7e1);_0x8da82d(_0xa0c7c0[_0x21b5('0xf')](0x1f4,_0x48594d[_0x21b5('0x11')]));});});};exports[_0x21b5('0x49')]=function(_0x4d6150){var _0x32038f=this;return new Promise(function(_0x5fa0a6,_0x6cd996){return db[_0x21b5('0x2c')][_0x21b5('0x2d')]()[_0x21b5('0x1e')](function(_0x3b9b2b){return db[_0x21b5('0x2e')]['transaction'](function(_0x5e6fe1){return db[_0x21b5('0x20')][_0x21b5('0x15')]({'where':_0x4d6150[_0x21b5('0x16')]?_0x4d6150['options'][_0x21b5('0x18')]||null:null,'attributes':_0x4d6150['options']?_0x4d6150[_0x21b5('0x16')][_0x21b5('0x19')]||null:null,'limit':0x1,'order':_0x4d6150['options']?_0x4d6150[_0x21b5('0x16')]['order']||null:null,'group':db[_0x21b5('0x20')][_0x21b5('0x37')],'transaction':_0x5e6fe1,'lock':_0x5e6fe1['LOCK'][_0x21b5('0x4a')],'include':_0x4d6150[_0x21b5('0x16')]?_0x4d6150[_0x21b5('0x16')]['include']?_[_0x21b5('0x1d')](_0x4d6150[_0x21b5('0x16')][_0x21b5('0x1b')],function(_0x577617){return{'model':db[_0x577617[_0x21b5('0x1c')]],'as':_0x577617['as'],'attributes':_0x577617['attributes'],'include':_0x577617[_0x21b5('0x1b')]?_[_0x21b5('0x1d')](_0x577617[_0x21b5('0x1b')],function(_0x35c41d){return{'model':db[_0x35c41d['model']],'as':_0x35c41d['as'],'attributes':_0x35c41d[_0x21b5('0x19')],'include':_0x35c41d[_0x21b5('0x1b')]?_[_0x21b5('0x1d')](_0x35c41d[_0x21b5('0x1b')],function(_0x496a32){return{'model':db[_0x496a32[_0x21b5('0x1c')]],'as':_0x496a32['as'],'attributes':_0x496a32[_0x21b5('0x19')]};}):[]};}):[]};}):[]:[]})[_0x21b5('0x1e')](function(_0x45fbc9){var _0x169e57=[];for(var _0x1fd5b3=0x0;_0x1fd5b3<_0x45fbc9['length'];_0x1fd5b3+=0x1){_0x169e57['push'](_0x45fbc9[_0x1fd5b3]['update'](_0x4d6150[_0x21b5('0x24')],{'transaction':_0x5e6fe1}));}return BPromise['all'](_0x169e57);});})[_0x21b5('0x1e')](function(_0x28e2e3){logger[_0x21b5('0xa')](_0x21b5('0x49'),_0x4d6150);logger['debug']('GetContactRecallMe',_0x4d6150,JSON[_0x21b5('0x1f')](_0x28e2e3));_0x5fa0a6(_0x28e2e3);})[_0x21b5('0x13')](function(_0x395f31){logger[_0x21b5('0xf')](_0x21b5('0x49'),_0x395f31[_0x21b5('0x11')],_0x4d6150);_0x6cd996(_0x32038f[_0x21b5('0xf')](0x1f4,_0x395f31[_0x21b5('0x11')]));});});});};exports[_0x21b5('0x4b')]=function(_0xa765a){var _0x1aec0b=this;return new Promise(function(_0x2c8f02,_0x7b861e){db['CmContact'][_0x21b5('0x2d')]()[_0x21b5('0x1e')](function(_0xb6734a){return db['CmHopper']['findAll']({'raw':_0xa765a['options']?_0xa765a[_0x21b5('0x16')][_0x21b5('0x17')]===undefined?!![]:![]:!![],'where':_0xa765a[_0x21b5('0x16')]?_0xa765a[_0x21b5('0x16')]['where']||null:null,'attributes':_0xa765a[_0x21b5('0x16')]?_0xa765a[_0x21b5('0x16')][_0x21b5('0x19')]||null:null,'limit':_0xa765a[_0x21b5('0x16')]?_0xa765a[_0x21b5('0x16')][_0x21b5('0x1a')]||null:null,'include':_0xa765a[_0x21b5('0x16')]?_0xa765a[_0x21b5('0x16')][_0x21b5('0x1b')]?_[_0x21b5('0x1d')](_0xa765a['options'][_0x21b5('0x1b')],function(_0x51120e){return{'model':db[_0x51120e[_0x21b5('0x1c')]],'as':_0x51120e['as'],'attributes':_0x51120e['as']===_0x21b5('0x30')?_['keys'](_0xb6734a):_0x51120e[_0x21b5('0x19')],'include':_0x51120e[_0x21b5('0x1b')]?_['map'](_0x51120e[_0x21b5('0x1b')],function(_0x1d39fd){return{'model':db[_0x1d39fd[_0x21b5('0x1c')]],'as':_0x1d39fd['as'],'attributes':_0x1d39fd[_0x21b5('0x19')],'include':_0x1d39fd[_0x21b5('0x1b')]?_['map'](_0x1d39fd[_0x21b5('0x1b')],function(_0x59c5ac){return{'model':db[_0x59c5ac[_0x21b5('0x1c')]],'as':_0x59c5ac['as'],'attributes':_0x59c5ac[_0x21b5('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x15a780){logger['info'](_0x21b5('0x14'),_0xa765a);logger['debug']('GetCmHopper',_0xa765a,JSON[_0x21b5('0x1f')](_0x15a780));_0x2c8f02(_0x15a780);})[_0x21b5('0x13')](function(_0x2b5203){logger[_0x21b5('0xf')](_0x21b5('0x14'),_0x2b5203[_0x21b5('0x11')],_0xa765a);_0x7b861e(_0x1aec0b[_0x21b5('0xf')](0x1f4,_0x2b5203[_0x21b5('0x11')]));});});});};exports[_0x21b5('0x4c')]=function(_0x59a9c8){var _0xad0728=this;return new Promise(function(_0x3d3446,_0x2af2b5){return db[_0x21b5('0x2c')][_0x21b5('0x4d')]({'raw':!![],'where':{'phone':_0x59a9c8['options'][_0x21b5('0x18')][_0x21b5('0x4e')]},'attributes':['id',_0x21b5('0x4f')],'order':[['id','DESC']]})[_0x21b5('0x1e')](function(_0x263f54){logger['info'](_0x21b5('0x50'),_0x59a9c8);logger['debug'](_0x21b5('0x50'),_0x59a9c8,JSON[_0x21b5('0x1f')](_0x263f54));_0x3d3446(_0x263f54);})[_0x21b5('0x13')](function(_0x252e85){logger[_0x21b5('0xf')](_0x21b5('0x50'),_0x252e85[_0x21b5('0x11')],_0x59a9c8);_0x2af2b5(_0xad0728[_0x21b5('0xf')](0x1f4,_0x252e85[_0x21b5('0x11')]));});});};exports[_0x21b5('0x51')]=function(_0xc3c77d){var _0x39b82d=this;return new Promise(function(_0x2e3f0c,_0x29da3e){return db[_0x21b5('0x2e')][_0x21b5('0x2f')](function(_0x2a56dc){return db[_0x21b5('0x20')]['update']({'active':![]},{'where':{},'transaction':_0x2a56dc})[_0x21b5('0x1e')](function(_0xd5803d){logger[_0x21b5('0xa')]('ResetActiveCalls',_0xc3c77d);logger[_0x21b5('0xd')]('ResetActiveCalls',_0xc3c77d,JSON[_0x21b5('0x1f')](_0xd5803d));_0x2e3f0c(_0xd5803d);})[_0x21b5('0x13')](function(_0x3a131f){logger['error'](_0x21b5('0x51'),_0x3a131f[_0x21b5('0x11')],_0xc3c77d);_0x29da3e(_0x39b82d[_0x21b5('0xf')](0x1f4,_0x3a131f[_0x21b5('0x11')]));});});});};exports[_0x21b5('0x52')]=function(_0x208cb1){var _0x455a58=this;var _0xe3942e=_0x208cb1[_0x21b5('0x24')][_0x21b5('0x18')]['voiceQueueId'];var _0x4ff325=_0x208cb1[_0x21b5('0x24')][_0x21b5('0x18')]['interval'];return new Promise(function(_0x480f7,_0x1a710d){return db['CmHopper'][_0x21b5('0x15')]({'where':{'voiceQueueId':_0xe3942e,'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$lte':db[_0x21b5('0x2e')][_0x21b5('0x43')](_0x21b5('0x53')+_0x4ff325+_0x21b5('0x54'))}},'include':[{'model':db[_0x21b5('0x2c')],'as':_0x21b5('0x30')},{'model':db['User'],'as':_0x21b5('0x33'),'attributes':['id','name',_0x21b5('0x35')]},{'model':db[_0x21b5('0x55')],'as':_0x21b5('0x56')}]})[_0x21b5('0x1e')](function(_0x4a4087){return db['sequelize'][_0x21b5('0x2f')](function(_0x4f0e4d){return db[_0x21b5('0x20')][_0x21b5('0x27')]({'recallmeNotifiedDate':new Date()},{'where':{'voiceQueueId':_0xe3942e,'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$lte':db[_0x21b5('0x2e')][_0x21b5('0x43')]('NOW()\x20+\x20INTERVAL\x20'+_0x4ff325+_0x21b5('0x54'))}},'transaction':_0x4f0e4d})[_0x21b5('0x1e')](function(_0x53ef8c){_0x480f7(_0x4a4087);})[_0x21b5('0x13')](function(_0x3dbbc2){logger[_0x21b5('0xf')](_0x21b5('0x52'),_0x3dbbc2[_0x21b5('0x11')],_0x208cb1);_0x1a710d(validateExpressRequest);});});})[_0x21b5('0x13')](function(_0x593ecd){logger['error'](_0x21b5('0x52'),_0x593ecd[_0x21b5('0x11')],_0x208cb1);_0x1a710d(_0x455a58[_0x21b5('0xf')](0x1f4,_0x593ecd[_0x21b5('0x11')]));});});}; \ No newline at end of file +var _0xaaf0=['UpdateCmHopper','update','DestroyCmHopper','destroy','CmContact','describe','LOCK','Contact','keys','User','name','voicePause','length','UserId','push','all','GetContactDialer','dataValues','ContactId','active','sequelize','CmHopperFinal','MoveContactManagedDialer','CountReScheduled','literal','format','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','transaction','UPDATE','GetCmHopperPreview','findOne','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueId','interval','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','Agent','CmList','List','util','moment','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','info','CmHopper,\x20%s,\x20%s','request\x20sent','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetCmHopper','CmHopper','findAll','options','raw','where','attributes','limit','include','map','model','ShowCmHopper','find','debug','CreateCmHopper','create','body','then'];(function(_0x2c84e5,_0x58a7c7){var _0x4990ec=function(_0x5b02b0){while(--_0x5b02b0){_0x2c84e5['push'](_0x2c84e5['shift']());}};_0x4990ec(++_0x58a7c7);}(_0xaaf0,0x1c7));var _0x0aaf=function(_0x11c510,_0x37ecc3){_0x11c510=_0x11c510-0x0;var _0x2f23a8=_0xaaf0[_0x11c510];return _0x2f23a8;};'use strict';var _=require('lodash');var util=require(_0x0aaf('0x0'));var moment=require(_0x0aaf('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0aaf('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x0aaf('0x3'));var logger=require('../../config/logger')(_0x0aaf('0x4'));var config=require(_0x0aaf('0x5'));var jayson=require(_0x0aaf('0x6'));const {validateExpressRequest}=require('twilio/lib/webhooks/webhooks');var client=jayson[_0x0aaf('0x7')][_0x0aaf('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x326b60,_0x39b561,_0x277bf7){return new BPromise(function(_0x242285,_0x25077e){return client['request'](_0x326b60,_0x277bf7)['then'](function(_0x2dc152){logger[_0x0aaf('0x9')](_0x0aaf('0xa'),_0x39b561,_0x0aaf('0xb'));logger['debug'](_0x0aaf('0xc'),_0x39b561,_0x0aaf('0xb'),JSON[_0x0aaf('0xd')](_0x2dc152));if(_0x2dc152[_0x0aaf('0xe')]){if(_0x2dc152[_0x0aaf('0xe')][_0x0aaf('0xf')]===0x1f4){logger[_0x0aaf('0xe')](_0x0aaf('0xa'),_0x39b561,_0x2dc152[_0x0aaf('0xe')][_0x0aaf('0x10')]);return _0x25077e(_0x2dc152[_0x0aaf('0xe')][_0x0aaf('0x10')]);}logger[_0x0aaf('0xe')](_0x0aaf('0xa'),_0x39b561,_0x2dc152[_0x0aaf('0xe')][_0x0aaf('0x10')]);return _0x242285(_0x2dc152['error'][_0x0aaf('0x10')]);}else{logger[_0x0aaf('0x9')](_0x0aaf('0xa'),_0x39b561,_0x0aaf('0xb'));_0x242285(_0x2dc152[_0x0aaf('0x11')][_0x0aaf('0x10')]);}})[_0x0aaf('0x12')](function(_0x37da6d){logger['error'](_0x0aaf('0xa'),_0x39b561,_0x37da6d);_0x25077e(_0x37da6d);});});}exports[_0x0aaf('0x13')]=function(_0x24f459){var _0x3e7700=this;return new Promise(function(_0x1fb7a2,_0xedafc8){return db[_0x0aaf('0x14')][_0x0aaf('0x15')]({'raw':_0x24f459['options']?_0x24f459[_0x0aaf('0x16')][_0x0aaf('0x17')]===undefined?!![]:![]:!![],'where':_0x24f459[_0x0aaf('0x16')]?_0x24f459[_0x0aaf('0x16')][_0x0aaf('0x18')]||null:null,'attributes':_0x24f459[_0x0aaf('0x16')]?_0x24f459['options'][_0x0aaf('0x19')]||null:null,'limit':_0x24f459[_0x0aaf('0x16')]?_0x24f459[_0x0aaf('0x16')][_0x0aaf('0x1a')]||null:null,'include':_0x24f459[_0x0aaf('0x16')]?_0x24f459[_0x0aaf('0x16')][_0x0aaf('0x1b')]?_[_0x0aaf('0x1c')](_0x24f459['options'][_0x0aaf('0x1b')],function(_0x2a4979){return{'model':db[_0x2a4979['model']],'as':_0x2a4979['as'],'attributes':_0x2a4979[_0x0aaf('0x19')],'include':_0x2a4979[_0x0aaf('0x1b')]?_['map'](_0x2a4979['include'],function(_0x37c9e1){return{'model':db[_0x37c9e1[_0x0aaf('0x1d')]],'as':_0x37c9e1['as'],'attributes':_0x37c9e1['attributes'],'include':_0x37c9e1[_0x0aaf('0x1b')]?_[_0x0aaf('0x1c')](_0x37c9e1['include'],function(_0x3cbf60){return{'model':db[_0x3cbf60[_0x0aaf('0x1d')]],'as':_0x3cbf60['as'],'attributes':_0x3cbf60['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3d92e2){logger[_0x0aaf('0x9')](_0x0aaf('0x13'),_0x24f459);logger['debug'](_0x0aaf('0x13'),_0x24f459,JSON[_0x0aaf('0xd')](_0x3d92e2));_0x1fb7a2(_0x3d92e2);})['catch'](function(_0x467c85){logger[_0x0aaf('0xe')](_0x0aaf('0x13'),_0x467c85['message'],_0x24f459);_0xedafc8(_0x3e7700[_0x0aaf('0xe')](0x1f4,_0x467c85[_0x0aaf('0x10')]));});});};exports[_0x0aaf('0x1e')]=function(_0x10d2e5){var _0x1f4cd2=this;return new Promise(function(_0x32709d,_0x44dc45){return db[_0x0aaf('0x14')][_0x0aaf('0x1f')]({'raw':_0x10d2e5[_0x0aaf('0x16')]?_0x10d2e5[_0x0aaf('0x16')][_0x0aaf('0x17')]===undefined?!![]:![]:!![],'where':_0x10d2e5[_0x0aaf('0x16')]?_0x10d2e5[_0x0aaf('0x16')]['where']||null:null,'attributes':_0x10d2e5[_0x0aaf('0x16')]?_0x10d2e5[_0x0aaf('0x16')][_0x0aaf('0x19')]||null:null,'include':_0x10d2e5[_0x0aaf('0x16')]?_0x10d2e5['options'][_0x0aaf('0x1b')]?_[_0x0aaf('0x1c')](_0x10d2e5['options'][_0x0aaf('0x1b')],function(_0x1b3beb){return{'model':db[_0x1b3beb[_0x0aaf('0x1d')]],'as':_0x1b3beb['as'],'attributes':_0x1b3beb[_0x0aaf('0x19')],'include':_0x1b3beb[_0x0aaf('0x1b')]?_[_0x0aaf('0x1c')](_0x1b3beb[_0x0aaf('0x1b')],function(_0x3a49da){return{'model':db[_0x3a49da['model']],'as':_0x3a49da['as'],'attributes':_0x3a49da['attributes'],'include':_0x3a49da[_0x0aaf('0x1b')]?_[_0x0aaf('0x1c')](_0x3a49da[_0x0aaf('0x1b')],function(_0x2f3643){return{'model':db[_0x2f3643[_0x0aaf('0x1d')]],'as':_0x2f3643['as'],'attributes':_0x2f3643[_0x0aaf('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x34510a){logger['info'](_0x0aaf('0x1e'),_0x10d2e5);logger[_0x0aaf('0x20')]('ShowCmHopper',_0x10d2e5,JSON['stringify'](_0x34510a));_0x32709d(_0x34510a);})[_0x0aaf('0x12')](function(_0x218c4b){logger[_0x0aaf('0xe')](_0x0aaf('0x1e'),_0x218c4b[_0x0aaf('0x10')],_0x10d2e5);_0x44dc45(_0x1f4cd2[_0x0aaf('0xe')](0x1f4,_0x218c4b[_0x0aaf('0x10')]));});});};exports[_0x0aaf('0x21')]=function(_0x1cac8d){var _0x1b9139=this;return new Promise(function(_0x22c7da,_0x1f8222){return db[_0x0aaf('0x14')][_0x0aaf('0x22')](_0x1cac8d[_0x0aaf('0x23')],{'raw':_0x1cac8d['options']?_0x1cac8d[_0x0aaf('0x16')]['raw']===undefined?!![]:![]:!![]})[_0x0aaf('0x24')](function(_0x4fc7c0){logger[_0x0aaf('0x9')](_0x0aaf('0x21'),_0x1cac8d);logger['debug'](_0x0aaf('0x21'),_0x1cac8d,JSON[_0x0aaf('0xd')](_0x4fc7c0));_0x22c7da(_0x4fc7c0);})['catch'](function(_0x49f589){logger[_0x0aaf('0xe')](_0x0aaf('0x21'),_0x49f589[_0x0aaf('0x10')],_0x1cac8d);_0x1f8222(_0x1b9139['error'](0x1f4,_0x49f589[_0x0aaf('0x10')]));});});};exports[_0x0aaf('0x25')]=function(_0x34141b){var _0x4ed8c7=this;return new Promise(function(_0x4f265c,_0x4bbc43){return db[_0x0aaf('0x14')][_0x0aaf('0x26')](_0x34141b[_0x0aaf('0x23')],{'raw':_0x34141b[_0x0aaf('0x16')]?_0x34141b[_0x0aaf('0x16')][_0x0aaf('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x34141b[_0x0aaf('0x16')]?_0x34141b[_0x0aaf('0x16')][_0x0aaf('0x18')]||null:null,'attributes':_0x34141b[_0x0aaf('0x16')]?_0x34141b[_0x0aaf('0x16')][_0x0aaf('0x19')]||null:null,'limit':_0x34141b['options']?_0x34141b[_0x0aaf('0x16')][_0x0aaf('0x1a')]||null:null})[_0x0aaf('0x24')](function(_0x1bc6cc){logger['info'](_0x0aaf('0x25'),_0x34141b);logger[_0x0aaf('0x9')]('UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0x0aaf('0xd')](_0x34141b[_0x0aaf('0x16')]['where']),_0x34141b[_0x0aaf('0x23')]['active']);logger['debug'](_0x0aaf('0x25'),_0x34141b,JSON['stringify'](_0x1bc6cc));_0x4f265c(_0x1bc6cc);})[_0x0aaf('0x12')](function(_0x2fcd82){logger[_0x0aaf('0xe')](_0x0aaf('0x25'),_0x2fcd82[_0x0aaf('0x10')],_0x34141b);_0x4bbc43(_0x4ed8c7[_0x0aaf('0xe')](0x1f4,_0x2fcd82['message']));});});};exports[_0x0aaf('0x27')]=function(_0x151c69){var _0x93daee=this;return new Promise(function(_0x52cd4c,_0xc05578){return db[_0x0aaf('0x14')][_0x0aaf('0x28')]({'where':_0x151c69[_0x0aaf('0x16')]?_0x151c69[_0x0aaf('0x16')][_0x0aaf('0x18')]||null:null})['then'](function(_0x5d39d8){logger[_0x0aaf('0x9')](_0x0aaf('0x27'),_0x151c69);logger[_0x0aaf('0x20')](_0x0aaf('0x27'),_0x151c69,JSON[_0x0aaf('0xd')](_0x5d39d8));_0x52cd4c(_0x5d39d8);})['catch'](function(_0x51df9a){logger[_0x0aaf('0xe')](_0x0aaf('0x27'),_0x51df9a[_0x0aaf('0x10')],_0x151c69);_0xc05578(_0x93daee[_0x0aaf('0xe')](0x1f4,_0x51df9a[_0x0aaf('0x10')]));});});};exports['GetContactDialer']=function(_0x170b80){var _0x590ee6=this;return new Promise(function(_0x3a068b,_0x48ba06){return db[_0x0aaf('0x29')][_0x0aaf('0x2a')]()[_0x0aaf('0x24')](function(_0x20d67d){return db['sequelize']['transaction'](function(_0x3646fb){return db[_0x0aaf('0x14')]['findAll']({'where':_0x170b80[_0x0aaf('0x16')]?_0x170b80[_0x0aaf('0x16')][_0x0aaf('0x18')]||null:null,'attributes':_0x170b80[_0x0aaf('0x16')]?_0x170b80[_0x0aaf('0x16')][_0x0aaf('0x19')]||null:null,'limit':_0x170b80[_0x0aaf('0x16')]?_0x170b80[_0x0aaf('0x16')][_0x0aaf('0x1a')]||null:null,'order':_0x170b80['options']?_0x170b80[_0x0aaf('0x16')]['order']||null:null,'transaction':_0x3646fb,'lock':_0x3646fb[_0x0aaf('0x2b')]['UPDATE'],'include':[{'model':db[_0x0aaf('0x29')],'as':_0x0aaf('0x2c'),'attributes':_[_0x0aaf('0x2d')](_0x20d67d)},{'model':db[_0x0aaf('0x2e')],'as':'Agent','attributes':['id',_0x0aaf('0x2f'),_0x0aaf('0x30')]}]})[_0x0aaf('0x24')](function(_0x1b89e8){var _0x43c74f=[];var _0x539638=[];for(var _0x96bfc9=0x0;_0x96bfc9<_0x1b89e8[_0x0aaf('0x31')];_0x96bfc9+=0x1){var _0x17f591=_0x1b89e8[_0x96bfc9][_0x0aaf('0x32')];if(_0x17f591===null){_0x43c74f[_0x0aaf('0x33')](_0x1b89e8[_0x96bfc9]['update'](_0x170b80[_0x0aaf('0x23')],{'transaction':_0x3646fb}));}else if(!_0x539638['includes'](_0x17f591)){_0x539638[_0x0aaf('0x33')](_0x17f591);_0x43c74f[_0x0aaf('0x33')](_0x1b89e8[_0x96bfc9][_0x0aaf('0x26')](_0x170b80[_0x0aaf('0x23')],{'transaction':_0x3646fb}));}}return BPromise[_0x0aaf('0x34')](_0x43c74f);});})[_0x0aaf('0x24')](function(_0x35b406){logger[_0x0aaf('0x9')](_0x0aaf('0x35'),_0x170b80);if(_0x35b406[_0x0aaf('0x31')]>0x0){logger['info']('GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]',_0x35b406[0x0][_0x0aaf('0x36')]['id'],_0x35b406[0x0][_0x0aaf('0x36')][_0x0aaf('0x37')],_0x35b406[0x0][_0x0aaf('0x36')][_0x0aaf('0x38')]);}logger[_0x0aaf('0x20')]('GetContactDialer',_0x170b80,JSON[_0x0aaf('0xd')](_0x35b406));_0x3a068b(_0x35b406);})['catch'](function(_0x57d9d3){logger[_0x0aaf('0xe')](_0x0aaf('0x35'),_0x57d9d3[_0x0aaf('0x10')],_0x170b80);_0x48ba06(_0x590ee6['error'](0x1f4,_0x57d9d3[_0x0aaf('0x10')]));});});});};exports['MoveContactManagedDialer']=function(_0x56fe32){var _0x338f67=this;return new Promise(function(_0xfa2f75,_0x2b56be){return db[_0x0aaf('0x39')]['transaction'](function(_0x4ffb8b){return db[_0x0aaf('0x3a')][_0x0aaf('0x22')](_0x56fe32['body'],{'raw':_0x56fe32['options']?_0x56fe32[_0x0aaf('0x16')]['raw']===undefined?!![]:![]:!![],'transaction':_0x4ffb8b})[_0x0aaf('0x24')](function(){logger[_0x0aaf('0x9')]('MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0x0aaf('0xd')](_0x56fe32[_0x0aaf('0x16')]['where']),_0x56fe32[_0x0aaf('0x16')][_0x0aaf('0x18')]['active']);return db['CmHopper']['destroy']({'where':_0x56fe32[_0x0aaf('0x16')]?_0x56fe32[_0x0aaf('0x16')]['where']||null:null,'transaction':_0x4ffb8b});});})[_0x0aaf('0x24')](function(_0x48c6e8){logger[_0x0aaf('0x9')]('MoveContactManagedDialer',_0x56fe32);logger[_0x0aaf('0x20')](_0x0aaf('0x3b'),_0x56fe32,JSON[_0x0aaf('0xd')](_0x48c6e8));_0xfa2f75(_0x48c6e8);})['catch'](function(_0x961ab6){logger[_0x0aaf('0xe')](_0x0aaf('0x3b'),_0x961ab6['message'],_0x56fe32);_0x2b56be(_0x338f67['error'](0x1f4,_0x961ab6[_0x0aaf('0x10')]));});});};exports[_0x0aaf('0x3c')]=function(_0x23cc12){var _0x15a5ce=this;return new Promise(function(_0x27d966,_0x3179f3){return db[_0x0aaf('0x14')][_0x0aaf('0x15')]({'raw':_0x23cc12[_0x0aaf('0x16')]?_0x23cc12['options'][_0x0aaf('0x17')]===undefined?!![]:![]:!![],'where':_0x23cc12[_0x0aaf('0x16')]?_0x23cc12['options'][_0x0aaf('0x18')]||null:null,'attributes':[[db['sequelize']['fn']('COUNT',db[_0x0aaf('0x39')]['fn']('IF',db[_0x0aaf('0x39')][_0x0aaf('0x3d')]('`scheduledat`\x20>=\x20'+util[_0x0aaf('0x3e')]('\x22%s\x22',moment()[_0x0aaf('0x3e')](_0x0aaf('0x3f')))+_0x0aaf('0x40')))),_0x0aaf('0x41')]]})['then'](function(_0x40f6a9){logger[_0x0aaf('0x9')](_0x0aaf('0x3c'),_0x23cc12);logger[_0x0aaf('0x20')](_0x0aaf('0x3c'),_0x23cc12,JSON['stringify'](_0x40f6a9));_0x27d966(_0x40f6a9);})[_0x0aaf('0x12')](function(_0x140848){logger[_0x0aaf('0xe')](_0x0aaf('0x3c'),_0x140848['message'],_0x23cc12);_0x3179f3(_0x15a5ce['error'](0x1f4,_0x140848[_0x0aaf('0x10')]));});});};exports[_0x0aaf('0x42')]=function(_0x58259b){var _0x3edda0=this;return new Promise(function(_0x271615,_0x2959b5){return db[_0x0aaf('0x29')][_0x0aaf('0x2a')]()[_0x0aaf('0x24')](function(_0x566d8c){return db[_0x0aaf('0x39')][_0x0aaf('0x43')](function(_0x310592){return db[_0x0aaf('0x14')][_0x0aaf('0x15')]({'where':_0x58259b['options']?_0x58259b['options'][_0x0aaf('0x18')]||null:null,'attributes':_0x58259b[_0x0aaf('0x16')]?_0x58259b['options'][_0x0aaf('0x19')]||null:null,'limit':0x1,'order':_0x58259b[_0x0aaf('0x16')]?_0x58259b[_0x0aaf('0x16')]['order']||null:null,'group':db['CmHopper'][_0x0aaf('0x32')],'transaction':_0x310592,'lock':_0x310592[_0x0aaf('0x2b')][_0x0aaf('0x44')],'include':_0x58259b[_0x0aaf('0x16')]?_0x58259b[_0x0aaf('0x16')][_0x0aaf('0x1b')]?_[_0x0aaf('0x1c')](_0x58259b[_0x0aaf('0x16')][_0x0aaf('0x1b')],function(_0x43d58f){return{'model':db[_0x43d58f[_0x0aaf('0x1d')]],'as':_0x43d58f['as'],'attributes':_0x43d58f[_0x0aaf('0x19')],'include':_0x43d58f[_0x0aaf('0x1b')]?_[_0x0aaf('0x1c')](_0x43d58f['include'],function(_0x36cccc){return{'model':db[_0x36cccc[_0x0aaf('0x1d')]],'as':_0x36cccc['as'],'attributes':_0x36cccc[_0x0aaf('0x19')],'include':_0x36cccc[_0x0aaf('0x1b')]?_[_0x0aaf('0x1c')](_0x36cccc['include'],function(_0x40a1c2){return{'model':db[_0x40a1c2[_0x0aaf('0x1d')]],'as':_0x40a1c2['as'],'attributes':_0x40a1c2['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2e7147){var _0x173b3b=[];for(var _0x5ceb9f=0x0;_0x5ceb9f<_0x2e7147['length'];_0x5ceb9f+=0x1){_0x173b3b['push'](_0x2e7147[_0x5ceb9f][_0x0aaf('0x26')](_0x58259b['body'],{'transaction':_0x310592}));}return BPromise['all'](_0x173b3b);});})[_0x0aaf('0x24')](function(_0xd02f9d){logger[_0x0aaf('0x9')](_0x0aaf('0x42'),_0x58259b);logger[_0x0aaf('0x20')](_0x0aaf('0x42'),_0x58259b,JSON['stringify'](_0xd02f9d));_0x271615(_0xd02f9d);})[_0x0aaf('0x12')](function(_0x2f9604){logger[_0x0aaf('0xe')](_0x0aaf('0x42'),_0x2f9604[_0x0aaf('0x10')],_0x58259b);_0x2959b5(_0x3edda0[_0x0aaf('0xe')](0x1f4,_0x2f9604[_0x0aaf('0x10')]));});});});};exports[_0x0aaf('0x45')]=function(_0x3a9ab6){var _0x45c458=this;return new Promise(function(_0x4afecd,_0x53eb2c){db[_0x0aaf('0x29')][_0x0aaf('0x2a')]()[_0x0aaf('0x24')](function(_0x189be7){return db[_0x0aaf('0x14')][_0x0aaf('0x15')]({'raw':_0x3a9ab6[_0x0aaf('0x16')]?_0x3a9ab6[_0x0aaf('0x16')][_0x0aaf('0x17')]===undefined?!![]:![]:!![],'where':_0x3a9ab6['options']?_0x3a9ab6[_0x0aaf('0x16')]['where']||null:null,'attributes':_0x3a9ab6[_0x0aaf('0x16')]?_0x3a9ab6[_0x0aaf('0x16')][_0x0aaf('0x19')]||null:null,'limit':_0x3a9ab6[_0x0aaf('0x16')]?_0x3a9ab6[_0x0aaf('0x16')]['limit']||null:null,'include':_0x3a9ab6['options']?_0x3a9ab6['options'][_0x0aaf('0x1b')]?_[_0x0aaf('0x1c')](_0x3a9ab6[_0x0aaf('0x16')][_0x0aaf('0x1b')],function(_0x353721){return{'model':db[_0x353721[_0x0aaf('0x1d')]],'as':_0x353721['as'],'attributes':_0x353721['as']===_0x0aaf('0x2c')?_['keys'](_0x189be7):_0x353721[_0x0aaf('0x19')],'include':_0x353721['include']?_[_0x0aaf('0x1c')](_0x353721[_0x0aaf('0x1b')],function(_0x4e52e7){return{'model':db[_0x4e52e7[_0x0aaf('0x1d')]],'as':_0x4e52e7['as'],'attributes':_0x4e52e7[_0x0aaf('0x19')],'include':_0x4e52e7[_0x0aaf('0x1b')]?_[_0x0aaf('0x1c')](_0x4e52e7[_0x0aaf('0x1b')],function(_0x1c84c0){return{'model':db[_0x1c84c0[_0x0aaf('0x1d')]],'as':_0x1c84c0['as'],'attributes':_0x1c84c0[_0x0aaf('0x19')]};}):[]};}):[]};}):[]:[]})[_0x0aaf('0x24')](function(_0x4d1e62){logger[_0x0aaf('0x9')](_0x0aaf('0x13'),_0x3a9ab6);logger[_0x0aaf('0x20')](_0x0aaf('0x13'),_0x3a9ab6,JSON[_0x0aaf('0xd')](_0x4d1e62));_0x4afecd(_0x4d1e62);})[_0x0aaf('0x12')](function(_0x47430c){logger[_0x0aaf('0xe')](_0x0aaf('0x13'),_0x47430c[_0x0aaf('0x10')],_0x3a9ab6);_0x53eb2c(_0x45c458[_0x0aaf('0xe')](0x1f4,_0x47430c[_0x0aaf('0x10')]));});});});};exports['GetContactByPhone']=function(_0x5cc925){var _0x4a706a=this;return new Promise(function(_0x55d807,_0xa88552){return db[_0x0aaf('0x29')][_0x0aaf('0x46')]({'raw':!![],'where':{'phone':_0x5cc925[_0x0aaf('0x16')][_0x0aaf('0x18')]['phone']},'attributes':['id','dialTimezone'],'order':[['id',_0x0aaf('0x47')]]})[_0x0aaf('0x24')](function(_0x420450){logger[_0x0aaf('0x9')](_0x0aaf('0x48'),_0x5cc925);logger['debug'](_0x0aaf('0x48'),_0x5cc925,JSON['stringify'](_0x420450));_0x55d807(_0x420450);})[_0x0aaf('0x12')](function(_0x50b4c6){logger[_0x0aaf('0xe')](_0x0aaf('0x48'),_0x50b4c6['message'],_0x5cc925);_0xa88552(_0x4a706a[_0x0aaf('0xe')](0x1f4,_0x50b4c6[_0x0aaf('0x10')]));});});};exports['ResetActiveCalls']=function(_0x5f0c36){var _0xb94c04=this;return new Promise(function(_0x1d89f9,_0x554bdd){return db[_0x0aaf('0x39')][_0x0aaf('0x43')](function(_0x42f694){return db[_0x0aaf('0x14')][_0x0aaf('0x26')]({'active':![]},{'where':{},'transaction':_0x42f694})[_0x0aaf('0x24')](function(_0x15213f){logger[_0x0aaf('0x9')]('ResetActiveCalls',_0x5f0c36);logger[_0x0aaf('0x20')](_0x0aaf('0x49'),_0x5f0c36,JSON['stringify'](_0x15213f));_0x1d89f9(_0x15213f);})[_0x0aaf('0x12')](function(_0x1a88d4){logger['error'](_0x0aaf('0x49'),_0x1a88d4[_0x0aaf('0x10')],_0x5f0c36);_0x554bdd(_0xb94c04['error'](0x1f4,_0x1a88d4[_0x0aaf('0x10')]));});});});};exports[_0x0aaf('0x4a')]=function(_0xe850b3){var _0x4bbe7a=this;var _0x2d0a7a=_0xe850b3['body'][_0x0aaf('0x18')][_0x0aaf('0x4b')];var _0x323b0f=_0xe850b3[_0x0aaf('0x23')][_0x0aaf('0x18')][_0x0aaf('0x4c')];return new Promise(function(_0x3ce550,_0x27e610){return db[_0x0aaf('0x14')][_0x0aaf('0x15')]({'where':{'voiceQueueId':_0x2d0a7a,'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$lte':db['sequelize']['literal'](_0x0aaf('0x4d')+_0x323b0f+_0x0aaf('0x4e'))}},'include':[{'model':db[_0x0aaf('0x29')],'as':_0x0aaf('0x2c')},{'model':db[_0x0aaf('0x2e')],'as':_0x0aaf('0x4f'),'attributes':['id','name',_0x0aaf('0x30')]},{'model':db[_0x0aaf('0x50')],'as':_0x0aaf('0x51')}]})[_0x0aaf('0x24')](function(_0x18284f){return db[_0x0aaf('0x39')][_0x0aaf('0x43')](function(_0x596bc3){return db[_0x0aaf('0x14')][_0x0aaf('0x26')]({'recallmeNotifiedDate':new Date()},{'where':{'voiceQueueId':_0x2d0a7a,'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$lte':db[_0x0aaf('0x39')][_0x0aaf('0x3d')](_0x0aaf('0x4d')+_0x323b0f+_0x0aaf('0x4e'))}},'transaction':_0x596bc3})[_0x0aaf('0x24')](function(_0x42d47d){_0x3ce550(_0x18284f);})[_0x0aaf('0x12')](function(_0x312b83){logger['error']('CmHopperHandlePreviewRecallNotifications',_0x312b83[_0x0aaf('0x10')],_0xe850b3);_0x27e610(validateExpressRequest);});});})[_0x0aaf('0x12')](function(_0x15912a){logger[_0x0aaf('0xe')](_0x0aaf('0x4a'),_0x15912a[_0x0aaf('0x10')],_0xe850b3);_0x27e610(_0x4bbe7a[_0x0aaf('0xe')](0x1f4,_0x15912a['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index fc8400e..9118f94 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 _0x4059=['put','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopper.controller','isAuthenticated','index','/describe','get','/opencontacts','getOpenContacts','getTimezones','show','post','create','/preview','getPreview','/timezone','/previewrecall','getPreviewRecall'];(function(_0x3d6632,_0x3f1495){var _0x2a7ec4=function(_0x5a09b1){while(--_0x5a09b1){_0x3d6632['push'](_0x3d6632['shift']());}};_0x2a7ec4(++_0x3f1495);}(_0x4059,0xb2));var _0x9405=function(_0x43fb69,_0x584019){_0x43fb69=_0x43fb69-0x0;var _0x68be8b=_0x4059[_0x43fb69];return _0x68be8b;};'use strict';var multer=require(_0x9405('0x0'));var util=require(_0x9405('0x1'));var path=require(_0x9405('0x2'));var timeout=require(_0x9405('0x3'));var express=require(_0x9405('0x4'));var router=express['Router']();var fs_extra=require(_0x9405('0x5'));var auth=require(_0x9405('0x6'));var interaction=require(_0x9405('0x7'));var config=require(_0x9405('0x8'));var controller=require(_0x9405('0x9'));router['get']('/',auth[_0x9405('0xa')](),controller[_0x9405('0xb')]);router['get'](_0x9405('0xc'),auth[_0x9405('0xa')](),controller['describe']);router[_0x9405('0xd')](_0x9405('0xe'),auth[_0x9405('0xa')](),controller[_0x9405('0xf')]);router[_0x9405('0xd')]('/timezones',auth[_0x9405('0xa')](),controller[_0x9405('0x10')]);router[_0x9405('0xd')]('/:id',auth[_0x9405('0xa')](),controller[_0x9405('0x11')]);router[_0x9405('0x12')]('/',auth[_0x9405('0xa')](),controller[_0x9405('0x13')]);router['post'](_0x9405('0x14'),auth[_0x9405('0xa')](),controller[_0x9405('0x15')]);router['post'](_0x9405('0x16'),auth[_0x9405('0xa')](),controller['getTimezone']);router[_0x9405('0x12')](_0x9405('0x17'),auth[_0x9405('0xa')](),controller[_0x9405('0x18')]);router[_0x9405('0x19')]('/:id',auth[_0x9405('0xa')](),controller['update']);router[_0x9405('0x1a')]('/:id',auth[_0x9405('0xa')](),controller[_0x9405('0x1b')]);module[_0x9405('0x1c')]=router; \ No newline at end of file +var _0x1fc5=['describe','getOpenContacts','/timezones','getTimezones','/:id','post','/preview','/timezone','getTimezone','getPreviewRecall','put','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','index'];(function(_0x54444e,_0x4c2055){var _0x5b88d4=function(_0x42b330){while(--_0x42b330){_0x54444e['push'](_0x54444e['shift']());}};_0x5b88d4(++_0x4c2055);}(_0x1fc5,0x98));var _0x51fc=function(_0x41c7ff,_0x5be7b5){_0x41c7ff=_0x41c7ff-0x0;var _0xb41c85=_0x1fc5[_0x41c7ff];return _0xb41c85;};'use strict';var multer=require('multer');var util=require(_0x51fc('0x0'));var path=require('path');var timeout=require(_0x51fc('0x1'));var express=require(_0x51fc('0x2'));var router=express[_0x51fc('0x3')]();var fs_extra=require(_0x51fc('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x51fc('0x5'));var config=require('../../config/environment');var controller=require('./cmHopper.controller');router[_0x51fc('0x6')]('/',auth[_0x51fc('0x7')](),controller[_0x51fc('0x8')]);router[_0x51fc('0x6')]('/describe',auth[_0x51fc('0x7')](),controller[_0x51fc('0x9')]);router[_0x51fc('0x6')]('/opencontacts',auth['isAuthenticated'](),controller[_0x51fc('0xa')]);router[_0x51fc('0x6')](_0x51fc('0xb'),auth['isAuthenticated'](),controller[_0x51fc('0xc')]);router[_0x51fc('0x6')](_0x51fc('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x51fc('0xe')]('/',auth[_0x51fc('0x7')](),controller['create']);router[_0x51fc('0xe')](_0x51fc('0xf'),auth['isAuthenticated'](),controller['getPreview']);router['post'](_0x51fc('0x10'),auth[_0x51fc('0x7')](),controller[_0x51fc('0x11')]);router['post']('/previewrecall',auth[_0x51fc('0x7')](),controller[_0x51fc('0x12')]);router[_0x51fc('0x13')](_0x51fc('0xd'),auth[_0x51fc('0x7')](),controller['update']);router[_0x51fc('0x14')](_0x51fc('0xd'),auth[_0x51fc('0x7')](),controller[_0x51fc('0x15')]);module[_0x51fc('0x16')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 970bc7e..e4e740e 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 _0x995a=['INTEGER','contactListQueue','moment','sequelize','exports','STRING'];(function(_0x310231,_0x4bb6a5){var _0x120fa4=function(_0x27c995){while(--_0x27c995){_0x310231['push'](_0x310231['shift']());}};_0x120fa4(++_0x4bb6a5);}(_0x995a,0x176));var _0xa995=function(_0x5f1137,_0x4bdc99){_0x5f1137=_0x5f1137-0x0;var _0x5290e9=_0x995a[_0x5f1137];return _0x5290e9;};'use strict';var moment=require(_0xa995('0x0'));var Sequelize=require(_0xa995('0x1'));module[_0xa995('0x2')]={'phone':{'type':Sequelize[_0xa995('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0xa995('0x4')],'unique':_0xa995('0x5')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0xa995('0x5')},'VoiceQueueId':{'type':Sequelize[_0xa995('0x4')],'unique':_0xa995('0x5')}}; \ No newline at end of file +var _0x3cd8=['moment','sequelize','exports','STRING','INTEGER','contactListQueue'];(function(_0x2ac116,_0x50ca5a){var _0xb7b33b=function(_0x59c867){while(--_0x59c867){_0x2ac116['push'](_0x2ac116['shift']());}};_0xb7b33b(++_0x50ca5a);}(_0x3cd8,0x150));var _0x83cd=function(_0x2defb5,_0x1cda14){_0x2defb5=_0x2defb5-0x0;var _0x229c53=_0x3cd8[_0x2defb5];return _0x229c53;};'use strict';var moment=require(_0x83cd('0x0'));var Sequelize=require(_0x83cd('0x1'));module[_0x83cd('0x2')]={'phone':{'type':Sequelize[_0x83cd('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x83cd('0x4')],'unique':_0x83cd('0x5')},'ListId':{'type':Sequelize[_0x83cd('0x4')],'unique':_0x83cd('0x5')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0x83cd('0x5')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 989d276..f9f3409 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 _0xd260=['find','catch','body','describe','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','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','update','then','destroy','error','stack','name','send','index','map','CmHopperBlack','rawAttributes','fieldName','type','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','rows','show','params','include'];(function(_0x1ce233,_0x48fbad){var _0x554ccd=function(_0x18654d){while(--_0x18654d){_0x1ce233['push'](_0x1ce233['shift']());}};_0x554ccd(++_0x48fbad);}(_0xd260,0xf1));var _0x0d26=function(_0x17406e,_0x1049fd){_0x17406e=_0x17406e-0x0;var _0x2bfc5a=_0xd260[_0x17406e];return _0x2bfc5a;};'use strict';var emlformat=require(_0x0d26('0x0'));var rimraf=require(_0x0d26('0x1'));var zipdir=require(_0x0d26('0x2'));var jsonpatch=require(_0x0d26('0x3'));var rp=require(_0x0d26('0x4'));var moment=require(_0x0d26('0x5'));var BPromise=require(_0x0d26('0x6'));var Mustache=require(_0x0d26('0x7'));var util=require(_0x0d26('0x8'));var path=require(_0x0d26('0x9'));var sox=require(_0x0d26('0xa'));var csv=require(_0x0d26('0xb'));var ejs=require(_0x0d26('0xc'));var fs=require('fs');var fs_extra=require(_0x0d26('0xd'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x0d26('0xe'));var jsforce=require(_0x0d26('0xf'));var deskjs=require(_0x0d26('0x10'));var toCsv=require(_0x0d26('0xb'));var querystring=require(_0x0d26('0x11'));var Papa=require(_0x0d26('0x12'));var Redis=require(_0x0d26('0x13'));var authService=require(_0x0d26('0x14'));var qs=require(_0x0d26('0x15'));var as=require(_0x0d26('0x16'));var hardwareService=require(_0x0d26('0x17'));var logger=require(_0x0d26('0x18'))(_0x0d26('0x19'));var utils=require(_0x0d26('0x1a'));var config=require(_0x0d26('0x1b'));var licenseUtil=require(_0x0d26('0x1c'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x54bd12,_0x5b3c7a){_0x5b3c7a=_0x5b3c7a||0xcc;return function(_0x17c4d0){if(_0x17c4d0){return _0x54bd12[_0x0d26('0x1d')](_0x5b3c7a);}return _0x54bd12[_0x0d26('0x1e')](_0x5b3c7a)[_0x0d26('0x1f')]();};}function respondWithResult(_0x382e14,_0x4b7152){_0x4b7152=_0x4b7152||0xc8;return function(_0x130f98){if(_0x130f98){return _0x382e14[_0x0d26('0x1e')](_0x4b7152)[_0x0d26('0x20')](_0x130f98);}};}function respondWithFilteredResult(_0x563e7f,_0xce39e4){return function(_0x26509a){if(_0x26509a){var _0x56bf4b=typeof _0xce39e4[_0x0d26('0x21')]===_0x0d26('0x22')&&typeof _0xce39e4[_0x0d26('0x23')]===_0x0d26('0x22');var _0x509ead=_0x26509a[_0x0d26('0x24')];var _0x2795a6=_0x56bf4b?0x0:_0xce39e4[_0x0d26('0x21')];var _0x96aaad=_0x56bf4b?_0x26509a[_0x0d26('0x24')]:_0xce39e4[_0x0d26('0x21')]+_0xce39e4[_0x0d26('0x23')];var _0x38c53b;if(_0x96aaad>=_0x509ead){_0x96aaad=_0x509ead;_0x38c53b=0xc8;}else{_0x38c53b=0xce;}_0x563e7f[_0x0d26('0x1e')](_0x38c53b);return _0x563e7f['set']('Content-Range',_0x2795a6+'-'+_0x96aaad+'/'+_0x509ead)['json'](_0x26509a);}return null;};}function patchUpdates(_0x36406c){return function(_0x51b55a){try{jsonpatch[_0x0d26('0x25')](_0x51b55a,_0x36406c,!![]);}catch(_0x1cc25a){return BPromise[_0x0d26('0x26')](_0x1cc25a);}return _0x51b55a['save']();};}function saveUpdates(_0x51f352,_0x55bb24){return function(_0x12bca0){if(_0x12bca0){return _0x12bca0[_0x0d26('0x27')](_0x51f352)[_0x0d26('0x28')](function(_0x5b3b1a){return _0x5b3b1a;});}return null;};}function removeEntity(_0x278b69,_0x5b2274){return function(_0x12ee37){if(_0x12ee37){return _0x12ee37[_0x0d26('0x29')]()[_0x0d26('0x28')](function(){_0x278b69[_0x0d26('0x1e')](0xcc)[_0x0d26('0x1f')]();});}};}function handleEntityNotFound(_0x9b97f3,_0x12d2e5){return function(_0x50f78b){if(!_0x50f78b){_0x9b97f3['sendStatus'](0x194);}return _0x50f78b;};}function handleError(_0x5d68b4,_0x49b20d){_0x49b20d=_0x49b20d||0x1f4;return function(_0x4db6bc){logger[_0x0d26('0x2a')](_0x4db6bc[_0x0d26('0x2b')]);if(_0x4db6bc[_0x0d26('0x2c')]){delete _0x4db6bc[_0x0d26('0x2c')];}_0x5d68b4[_0x0d26('0x1e')](_0x49b20d)[_0x0d26('0x2d')](_0x4db6bc);};}exports[_0x0d26('0x2e')]=function(_0x4ca790,_0x5b480e){var _0x363f50={},_0x124cde={},_0x49ad22={'count':0x0,'rows':[]};var _0x101a83=_[_0x0d26('0x2f')](db[_0x0d26('0x30')][_0x0d26('0x31')],function(_0xe7fce2){return{'name':_0xe7fce2[_0x0d26('0x32')],'type':_0xe7fce2[_0x0d26('0x33')]['key']};});_0x124cde[_0x0d26('0x34')]=_[_0x0d26('0x2f')](_0x101a83,'name');_0x124cde[_0x0d26('0x35')]=_[_0x0d26('0x36')](_0x4ca790[_0x0d26('0x35')]);_0x124cde['filters']=_['intersection'](_0x124cde[_0x0d26('0x34')],_0x124cde[_0x0d26('0x35')]);_0x363f50[_0x0d26('0x37')]=_[_0x0d26('0x38')](_0x124cde['model'],qs[_0x0d26('0x39')](_0x4ca790[_0x0d26('0x35')][_0x0d26('0x39')]));_0x363f50[_0x0d26('0x37')]=_0x363f50['attributes'][_0x0d26('0x3a')]?_0x363f50[_0x0d26('0x37')]:_0x124cde[_0x0d26('0x34')];if(!_0x4ca790['query'][_0x0d26('0x3b')](_0x0d26('0x3c'))){_0x363f50[_0x0d26('0x23')]=qs[_0x0d26('0x23')](_0x4ca790[_0x0d26('0x35')][_0x0d26('0x23')]);_0x363f50[_0x0d26('0x21')]=qs[_0x0d26('0x21')](_0x4ca790[_0x0d26('0x35')][_0x0d26('0x21')]);}_0x363f50[_0x0d26('0x3d')]=qs[_0x0d26('0x3e')](_0x4ca790[_0x0d26('0x35')][_0x0d26('0x3e')]);_0x363f50[_0x0d26('0x3f')]=qs[_0x0d26('0x40')](_[_0x0d26('0x41')](_0x4ca790[_0x0d26('0x35')],_0x124cde['filters']),_0x101a83);if(_0x4ca790['query']['filter']){_0x363f50[_0x0d26('0x3f')]=_[_0x0d26('0x42')](_0x363f50[_0x0d26('0x3f')],{'$or':_[_0x0d26('0x2f')](_0x101a83,function(_0x42d8da){if(_0x42d8da[_0x0d26('0x33')]!==_0x0d26('0x43')){var _0x258006={};_0x258006[_0x42d8da[_0x0d26('0x2c')]]={'$like':'%'+_0x4ca790[_0x0d26('0x35')][_0x0d26('0x44')]+'%'};return _0x258006;}})});}_0x363f50=_[_0x0d26('0x42')]({},_0x363f50,_0x4ca790[_0x0d26('0x45')]);var _0x2fea27={'where':_0x363f50[_0x0d26('0x3f')]};return db[_0x0d26('0x30')]['count'](_0x2fea27)[_0x0d26('0x28')](function(_0x53adcb){_0x49ad22[_0x0d26('0x24')]=_0x53adcb;if(_0x4ca790[_0x0d26('0x35')][_0x0d26('0x46')]){_0x363f50['include']=[{'all':!![]}];}return db[_0x0d26('0x30')]['findAll'](_0x363f50);})[_0x0d26('0x28')](function(_0x299be4){_0x49ad22[_0x0d26('0x47')]=_0x299be4;return _0x49ad22;})[_0x0d26('0x28')](respondWithFilteredResult(_0x5b480e,_0x363f50))['catch'](handleError(_0x5b480e,null));};exports[_0x0d26('0x48')]=function(_0x5ac5c5,_0x481a0d){var _0x15bb49={'raw':!![],'where':{'id':_0x5ac5c5[_0x0d26('0x49')]['id']}},_0x574f94={};_0x574f94[_0x0d26('0x34')]=_[_0x0d26('0x36')](db[_0x0d26('0x30')][_0x0d26('0x31')]);_0x574f94[_0x0d26('0x35')]=_[_0x0d26('0x36')](_0x5ac5c5[_0x0d26('0x35')]);_0x574f94[_0x0d26('0x40')]=_[_0x0d26('0x38')](_0x574f94[_0x0d26('0x34')],_0x574f94[_0x0d26('0x35')]);_0x15bb49[_0x0d26('0x37')]=_['intersection'](_0x574f94[_0x0d26('0x34')],qs[_0x0d26('0x39')](_0x5ac5c5[_0x0d26('0x35')]['fields']));_0x15bb49[_0x0d26('0x37')]=_0x15bb49[_0x0d26('0x37')]['length']?_0x15bb49[_0x0d26('0x37')]:_0x574f94['model'];if(_0x5ac5c5[_0x0d26('0x35')][_0x0d26('0x46')]){_0x15bb49[_0x0d26('0x4a')]=[{'all':!![]}];}_0x15bb49=_[_0x0d26('0x42')]({},_0x15bb49,_0x5ac5c5[_0x0d26('0x45')]);return db[_0x0d26('0x30')][_0x0d26('0x4b')](_0x15bb49)['then'](handleEntityNotFound(_0x481a0d,null))[_0x0d26('0x28')](respondWithResult(_0x481a0d,null))[_0x0d26('0x4c')](handleError(_0x481a0d,null));};exports[_0x0d26('0x27')]=function(_0x5e32d4,_0x16d037){if(_0x5e32d4['body']['id']){delete _0x5e32d4['body']['id'];}return db[_0x0d26('0x30')][_0x0d26('0x4b')]({'where':{'id':_0x5e32d4[_0x0d26('0x49')]['id']}})[_0x0d26('0x28')](handleEntityNotFound(_0x16d037,null))[_0x0d26('0x28')](saveUpdates(_0x5e32d4[_0x0d26('0x4d')],null))[_0x0d26('0x28')](respondWithResult(_0x16d037,null))[_0x0d26('0x4c')](handleError(_0x16d037,null));};exports[_0x0d26('0x29')]=function(_0x1b2d71,_0x2915a2){return db['CmHopperBlack']['find']({'where':{'id':_0x1b2d71['params']['id']}})[_0x0d26('0x28')](handleEntityNotFound(_0x2915a2,null))['then'](removeEntity(_0x2915a2,null))[_0x0d26('0x4c')](handleError(_0x2915a2,null));};exports['describe']=function(_0x433b20,_0x3f176e){return db['CmHopperBlack'][_0x0d26('0x4e')]()[_0x0d26('0x28')](respondWithResult(_0x3f176e,null))[_0x0d26('0x4c')](handleError(_0x3f176e,null));}; \ No newline at end of file +var _0x0360=['ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','limit','set','Content-Range','json','apply','save','then','destroy','error','stack','name','send','index','map','CmHopperBlack','fieldName','type','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','keys','rawAttributes','find','catch','body','params','describe','rimraf','zip-dir','fast-json-patch','bluebird','util','path'];(function(_0x377543,_0xb72c5c){var _0x419eae=function(_0x10acac){while(--_0x10acac){_0x377543['push'](_0x377543['shift']());}};_0x419eae(++_0xb72c5c);}(_0x0360,0x11e));var _0x0036=function(_0x34b709,_0x5dc8af){_0x34b709=_0x34b709-0x0;var _0x20dda4=_0x0360[_0x34b709];return _0x20dda4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0036('0x0'));var zipdir=require(_0x0036('0x1'));var jsonpatch=require(_0x0036('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0036('0x3'));var Mustache=require('mustache');var util=require(_0x0036('0x4'));var path=require(_0x0036('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0036('0x6'));var fs=require('fs');var fs_extra=require(_0x0036('0x7'));var _=require(_0x0036('0x8'));var squel=require(_0x0036('0x9'));var crypto=require(_0x0036('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x0036('0xb'));var toCsv=require(_0x0036('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x0036('0xd'));var authService=require(_0x0036('0xe'));var qs=require(_0x0036('0xf'));var as=require(_0x0036('0x10'));var hardwareService=require(_0x0036('0x11'));var logger=require(_0x0036('0x12'))(_0x0036('0x13'));var utils=require(_0x0036('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x0036('0x15'));var db=require(_0x0036('0x16'))['db'];function respondWithStatusCode(_0x5f5171,_0x156dd5){_0x156dd5=_0x156dd5||0xcc;return function(_0x21edd3){if(_0x21edd3){return _0x5f5171[_0x0036('0x17')](_0x156dd5);}return _0x5f5171[_0x0036('0x18')](_0x156dd5)['end']();};}function respondWithResult(_0x211a1c,_0x592dbd){_0x592dbd=_0x592dbd||0xc8;return function(_0xdb094a){if(_0xdb094a){return _0x211a1c[_0x0036('0x18')](_0x592dbd)['json'](_0xdb094a);}};}function respondWithFilteredResult(_0x37c9eb,_0x350eb9){return function(_0x680435){if(_0x680435){var _0x12d05c=typeof _0x350eb9[_0x0036('0x19')]===_0x0036('0x1a')&&typeof _0x350eb9['limit']===_0x0036('0x1a');var _0x31a2f8=_0x680435['count'];var _0x42980d=_0x12d05c?0x0:_0x350eb9[_0x0036('0x19')];var _0xf4638c=_0x12d05c?_0x680435[_0x0036('0x1b')]:_0x350eb9[_0x0036('0x19')]+_0x350eb9[_0x0036('0x1c')];var _0x448249;if(_0xf4638c>=_0x31a2f8){_0xf4638c=_0x31a2f8;_0x448249=0xc8;}else{_0x448249=0xce;}_0x37c9eb[_0x0036('0x18')](_0x448249);return _0x37c9eb[_0x0036('0x1d')](_0x0036('0x1e'),_0x42980d+'-'+_0xf4638c+'/'+_0x31a2f8)[_0x0036('0x1f')](_0x680435);}return null;};}function patchUpdates(_0x1ebc27){return function(_0x3daecc){try{jsonpatch[_0x0036('0x20')](_0x3daecc,_0x1ebc27,!![]);}catch(_0x4e5e0d){return BPromise['reject'](_0x4e5e0d);}return _0x3daecc[_0x0036('0x21')]();};}function saveUpdates(_0x17476b,_0x5cd374){return function(_0x275bfa){if(_0x275bfa){return _0x275bfa['update'](_0x17476b)[_0x0036('0x22')](function(_0x351ac9){return _0x351ac9;});}return null;};}function removeEntity(_0x20c301,_0x418ac0){return function(_0x1c1523){if(_0x1c1523){return _0x1c1523[_0x0036('0x23')]()['then'](function(){_0x20c301[_0x0036('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x32070e,_0x1cc2d8){return function(_0x58c9de){if(!_0x58c9de){_0x32070e['sendStatus'](0x194);}return _0x58c9de;};}function handleError(_0x310e1b,_0x364dca){_0x364dca=_0x364dca||0x1f4;return function(_0x22028d){logger[_0x0036('0x24')](_0x22028d[_0x0036('0x25')]);if(_0x22028d[_0x0036('0x26')]){delete _0x22028d[_0x0036('0x26')];}_0x310e1b['status'](_0x364dca)[_0x0036('0x27')](_0x22028d);};}exports[_0x0036('0x28')]=function(_0x42d692,_0x39490b){var _0xacfec4={},_0x1fb2f3={},_0x441bef={'count':0x0,'rows':[]};var _0x2bfcac=_[_0x0036('0x29')](db[_0x0036('0x2a')]['rawAttributes'],function(_0x175fcf){return{'name':_0x175fcf[_0x0036('0x2b')],'type':_0x175fcf[_0x0036('0x2c')][_0x0036('0x2d')]};});_0x1fb2f3[_0x0036('0x2e')]=_[_0x0036('0x29')](_0x2bfcac,_0x0036('0x26'));_0x1fb2f3[_0x0036('0x2f')]=_['keys'](_0x42d692[_0x0036('0x2f')]);_0x1fb2f3['filters']=_[_0x0036('0x30')](_0x1fb2f3[_0x0036('0x2e')],_0x1fb2f3[_0x0036('0x2f')]);_0xacfec4[_0x0036('0x31')]=_[_0x0036('0x30')](_0x1fb2f3['model'],qs[_0x0036('0x32')](_0x42d692['query'][_0x0036('0x32')]));_0xacfec4[_0x0036('0x31')]=_0xacfec4[_0x0036('0x31')]['length']?_0xacfec4[_0x0036('0x31')]:_0x1fb2f3[_0x0036('0x2e')];if(!_0x42d692[_0x0036('0x2f')][_0x0036('0x33')](_0x0036('0x34'))){_0xacfec4['limit']=qs['limit'](_0x42d692[_0x0036('0x2f')][_0x0036('0x1c')]);_0xacfec4[_0x0036('0x19')]=qs[_0x0036('0x19')](_0x42d692[_0x0036('0x2f')][_0x0036('0x19')]);}_0xacfec4[_0x0036('0x35')]=qs[_0x0036('0x36')](_0x42d692[_0x0036('0x2f')][_0x0036('0x36')]);_0xacfec4[_0x0036('0x37')]=qs['filters'](_['pick'](_0x42d692[_0x0036('0x2f')],_0x1fb2f3[_0x0036('0x38')]),_0x2bfcac);if(_0x42d692[_0x0036('0x2f')]['filter']){_0xacfec4[_0x0036('0x37')]=_[_0x0036('0x39')](_0xacfec4[_0x0036('0x37')],{'$or':_[_0x0036('0x29')](_0x2bfcac,function(_0x46b0fd){if(_0x46b0fd[_0x0036('0x2c')]!==_0x0036('0x3a')){var _0x9b4b55={};_0x9b4b55[_0x46b0fd['name']]={'$like':'%'+_0x42d692[_0x0036('0x2f')][_0x0036('0x3b')]+'%'};return _0x9b4b55;}})});}_0xacfec4=_['merge']({},_0xacfec4,_0x42d692[_0x0036('0x3c')]);var _0x1c3ba0={'where':_0xacfec4[_0x0036('0x37')]};return db[_0x0036('0x2a')]['count'](_0x1c3ba0)[_0x0036('0x22')](function(_0xfb44b6){_0x441bef[_0x0036('0x1b')]=_0xfb44b6;if(_0x42d692[_0x0036('0x2f')][_0x0036('0x3d')]){_0xacfec4[_0x0036('0x3e')]=[{'all':!![]}];}return db[_0x0036('0x2a')][_0x0036('0x3f')](_0xacfec4);})[_0x0036('0x22')](function(_0xbf78e6){_0x441bef[_0x0036('0x40')]=_0xbf78e6;return _0x441bef;})[_0x0036('0x22')](respondWithFilteredResult(_0x39490b,_0xacfec4))['catch'](handleError(_0x39490b,null));};exports[_0x0036('0x41')]=function(_0x58d162,_0x202c0a){var _0x2bb512={'raw':!![],'where':{'id':_0x58d162['params']['id']}},_0x4ea214={};_0x4ea214[_0x0036('0x2e')]=_[_0x0036('0x42')](db[_0x0036('0x2a')][_0x0036('0x43')]);_0x4ea214[_0x0036('0x2f')]=_[_0x0036('0x42')](_0x58d162[_0x0036('0x2f')]);_0x4ea214['filters']=_[_0x0036('0x30')](_0x4ea214['model'],_0x4ea214[_0x0036('0x2f')]);_0x2bb512['attributes']=_[_0x0036('0x30')](_0x4ea214[_0x0036('0x2e')],qs[_0x0036('0x32')](_0x58d162[_0x0036('0x2f')]['fields']));_0x2bb512[_0x0036('0x31')]=_0x2bb512['attributes']['length']?_0x2bb512[_0x0036('0x31')]:_0x4ea214[_0x0036('0x2e')];if(_0x58d162[_0x0036('0x2f')][_0x0036('0x3d')]){_0x2bb512[_0x0036('0x3e')]=[{'all':!![]}];}_0x2bb512=_['merge']({},_0x2bb512,_0x58d162[_0x0036('0x3c')]);return db['CmHopperBlack'][_0x0036('0x44')](_0x2bb512)['then'](handleEntityNotFound(_0x202c0a,null))[_0x0036('0x22')](respondWithResult(_0x202c0a,null))[_0x0036('0x45')](handleError(_0x202c0a,null));};exports['update']=function(_0x5c9d95,_0x264d93){if(_0x5c9d95['body']['id']){delete _0x5c9d95[_0x0036('0x46')]['id'];}return db['CmHopperBlack'][_0x0036('0x44')]({'where':{'id':_0x5c9d95[_0x0036('0x47')]['id']}})[_0x0036('0x22')](handleEntityNotFound(_0x264d93,null))[_0x0036('0x22')](saveUpdates(_0x5c9d95[_0x0036('0x46')],null))[_0x0036('0x22')](respondWithResult(_0x264d93,null))[_0x0036('0x45')](handleError(_0x264d93,null));};exports['destroy']=function(_0x2ffcae,_0x1e52ca){return db[_0x0036('0x2a')][_0x0036('0x44')]({'where':{'id':_0x2ffcae[_0x0036('0x47')]['id']}})[_0x0036('0x22')](handleEntityNotFound(_0x1e52ca,null))[_0x0036('0x22')](removeEntity(_0x1e52ca,null))[_0x0036('0x45')](handleError(_0x1e52ca,null));};exports['describe']=function(_0x326b6,_0x3f4d1b){return db['CmHopperBlack'][_0x0036('0x48')]()[_0x0036('0x22')](respondWithResult(_0x3f4d1b,null))['catch'](handleError(_0x3f4d1b,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 5150c67..3256ea0 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 _0xb716=['../../config/environment','exports','CmHopperBlack','cm_hopper_black','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x4fae81,_0x5e0107){var _0x2b28af=function(_0x47fd9f){while(--_0x47fd9f){_0x4fae81['push'](_0x4fae81['shift']());}};_0x2b28af(++_0x5e0107);}(_0xb716,0x1bc));var _0x6b71=function(_0x1630b3,_0x56559d){_0x1630b3=_0x1630b3-0x0;var _0x4acaa3=_0xb716[_0x1630b3];return _0x4acaa3;};'use strict';var _=require(_0x6b71('0x0'));var util=require(_0x6b71('0x1'));var logger=require(_0x6b71('0x2'))(_0x6b71('0x3'));var moment=require(_0x6b71('0x4'));var BPromise=require(_0x6b71('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6b71('0x6'));var attributes=require('./cmHopperBlack.attributes');module[_0x6b71('0x7')]=function(_0x5f09af,_0x127f08){return _0x5f09af['define'](_0x6b71('0x8'),attributes,{'tableName':_0x6b71('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9f11=['../../config/logger','rimraf','exports','CmHopperBlack','cm_hopper_black','lodash','util'];(function(_0x41931e,_0x3249bd){var _0x3b6dff=function(_0x115723){while(--_0x115723){_0x41931e['push'](_0x41931e['shift']());}};_0x3b6dff(++_0x3249bd);}(_0x9f11,0x101));var _0x19f1=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9f11[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x19f1('0x0'));var util=require(_0x19f1('0x1'));var logger=require(_0x19f1('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x19f1('0x3'));var config=require('../../config/environment');var attributes=require('./cmHopperBlack.attributes');module[_0x19f1('0x4')]=function(_0x573689,_0x1e1a13){return _0x573689['define'](_0x19f1('0x5'),attributes,{'tableName':_0x19f1('0x6'),'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 1f52334..7681d3d 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 _0xade5=['findAll','options','raw','where','attributes','limit','include','map','model','UpdateCmHopperBlack','update','body','DestroyCmHopperBlack','destroy','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','CmHopperBlack,\x20%s,\x20%s','debug','stringify','error','message','request\x20sent','result','catch','GetCmHopperBlack','CmHopperBlack'];(function(_0x4ae309,_0x5b5f56){var _0x4a7ebe=function(_0x26e1c0){while(--_0x26e1c0){_0x4ae309['push'](_0x4ae309['shift']());}};_0x4a7ebe(++_0x5b5f56);}(_0xade5,0x7d));var _0x5ade=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xade5[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x5ade('0x0'));var moment=require(_0x5ade('0x1'));var BPromise=require(_0x5ade('0x2'));var rs=require(_0x5ade('0x3'));var fs=require('fs');var Redis=require(_0x5ade('0x4'));var db=require(_0x5ade('0x5'))['db'];var utils=require(_0x5ade('0x6'));var logger=require(_0x5ade('0x7'))('rpc');var config=require(_0x5ade('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x5ade('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x538031,_0x43f44a,_0x31d0bf){return new BPromise(function(_0x57f047,_0x4e1f22){return client[_0x5ade('0xa')](_0x538031,_0x31d0bf)[_0x5ade('0xb')](function(_0x1b4254){logger[_0x5ade('0xc')](_0x5ade('0xd'),_0x43f44a,'request\x20sent');logger[_0x5ade('0xe')]('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x43f44a,'request\x20sent',JSON[_0x5ade('0xf')](_0x1b4254));if(_0x1b4254[_0x5ade('0x10')]){if(_0x1b4254[_0x5ade('0x10')]['code']===0x1f4){logger[_0x5ade('0x10')](_0x5ade('0xd'),_0x43f44a,_0x1b4254[_0x5ade('0x10')]['message']);return _0x4e1f22(_0x1b4254[_0x5ade('0x10')][_0x5ade('0x11')]);}logger['error'](_0x5ade('0xd'),_0x43f44a,_0x1b4254['error'][_0x5ade('0x11')]);return _0x57f047(_0x1b4254[_0x5ade('0x10')][_0x5ade('0x11')]);}else{logger[_0x5ade('0xc')]('CmHopperBlack,\x20%s,\x20%s',_0x43f44a,_0x5ade('0x12'));_0x57f047(_0x1b4254[_0x5ade('0x13')]['message']);}})[_0x5ade('0x14')](function(_0x565c64){logger[_0x5ade('0x10')](_0x5ade('0xd'),_0x43f44a,_0x565c64);_0x4e1f22(_0x565c64);});});}exports[_0x5ade('0x15')]=function(_0x101e45){var _0x4dd4df=this;return new Promise(function(_0x55b796,_0x3652a5){return db[_0x5ade('0x16')][_0x5ade('0x17')]({'raw':_0x101e45[_0x5ade('0x18')]?_0x101e45['options'][_0x5ade('0x19')]===undefined?!![]:![]:!![],'where':_0x101e45[_0x5ade('0x18')]?_0x101e45[_0x5ade('0x18')][_0x5ade('0x1a')]||null:null,'attributes':_0x101e45[_0x5ade('0x18')]?_0x101e45[_0x5ade('0x18')][_0x5ade('0x1b')]||null:null,'limit':_0x101e45[_0x5ade('0x18')]?_0x101e45['options'][_0x5ade('0x1c')]||null:null,'include':_0x101e45['options']?_0x101e45[_0x5ade('0x18')][_0x5ade('0x1d')]?_[_0x5ade('0x1e')](_0x101e45['options'][_0x5ade('0x1d')],function(_0x6af6ba){return{'model':db[_0x6af6ba[_0x5ade('0x1f')]],'as':_0x6af6ba['as'],'attributes':_0x6af6ba[_0x5ade('0x1b')],'include':_0x6af6ba[_0x5ade('0x1d')]?_['map'](_0x6af6ba[_0x5ade('0x1d')],function(_0x31326d){return{'model':db[_0x31326d[_0x5ade('0x1f')]],'as':_0x31326d['as'],'attributes':_0x31326d[_0x5ade('0x1b')],'include':_0x31326d[_0x5ade('0x1d')]?_[_0x5ade('0x1e')](_0x31326d[_0x5ade('0x1d')],function(_0x311f15){return{'model':db[_0x311f15[_0x5ade('0x1f')]],'as':_0x311f15['as'],'attributes':_0x311f15[_0x5ade('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x5ade('0xb')](function(_0x521169){logger[_0x5ade('0xc')]('GetCmHopperBlack',_0x101e45);logger[_0x5ade('0xe')](_0x5ade('0x15'),_0x101e45,JSON[_0x5ade('0xf')](_0x521169));_0x55b796(_0x521169);})[_0x5ade('0x14')](function(_0x43b040){logger[_0x5ade('0x10')]('GetCmHopperBlack',_0x43b040[_0x5ade('0x11')],_0x101e45);_0x3652a5(_0x4dd4df[_0x5ade('0x10')](0x1f4,_0x43b040[_0x5ade('0x11')]));});});};exports[_0x5ade('0x20')]=function(_0x56f8bf){var _0x1eee2f=this;return new Promise(function(_0x1cdacc,_0x15c377){return db[_0x5ade('0x16')][_0x5ade('0x21')](_0x56f8bf[_0x5ade('0x22')],{'raw':_0x56f8bf[_0x5ade('0x18')]?_0x56f8bf[_0x5ade('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x56f8bf[_0x5ade('0x18')]?_0x56f8bf['options'][_0x5ade('0x1a')]||null:null,'attributes':_0x56f8bf[_0x5ade('0x18')]?_0x56f8bf[_0x5ade('0x18')][_0x5ade('0x1b')]||null:null,'limit':_0x56f8bf['options']?_0x56f8bf[_0x5ade('0x18')][_0x5ade('0x1c')]||null:null})[_0x5ade('0xb')](function(_0x7a9790){logger[_0x5ade('0xc')]('UpdateCmHopperBlack',_0x56f8bf);logger['debug'](_0x5ade('0x20'),_0x56f8bf,JSON[_0x5ade('0xf')](_0x7a9790));_0x1cdacc(_0x7a9790);})[_0x5ade('0x14')](function(_0x40e995){logger['error'](_0x5ade('0x20'),_0x40e995[_0x5ade('0x11')],_0x56f8bf);_0x15c377(_0x1eee2f[_0x5ade('0x10')](0x1f4,_0x40e995['message']));});});};exports[_0x5ade('0x23')]=function(_0x2bd13b){var _0x4889ae=this;return new Promise(function(_0x1fedad,_0x51ac18){return db[_0x5ade('0x16')][_0x5ade('0x24')]({'where':_0x2bd13b[_0x5ade('0x18')]?_0x2bd13b['options']['where']||null:null})['then'](function(_0x558195){logger['info'](_0x5ade('0x23'),_0x2bd13b);logger['debug']('DestroyCmHopperBlack',_0x2bd13b,JSON[_0x5ade('0xf')](_0x558195));_0x1fedad(_0x558195);})[_0x5ade('0x14')](function(_0x18196c){logger[_0x5ade('0x10')](_0x5ade('0x23'),_0x18196c[_0x5ade('0x11')],_0x2bd13b);_0x51ac18(_0x4889ae['error'](0x1f4,_0x18196c[_0x5ade('0x11')]));});});}; \ No newline at end of file +var _0x4c7c=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetCmHopperBlack','CmHopperBlack','findAll','raw','options','where','limit','include','map','model','attributes','UpdateCmHopperBlack','body','DestroyCmHopperBlack','destroy','lodash','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x51c5f1,_0xdd129e){var _0xaa23ed=function(_0x2911c0){while(--_0x2911c0){_0x51c5f1['push'](_0x51c5f1['shift']());}};_0xaa23ed(++_0xdd129e);}(_0x4c7c,0x112));var _0xc4c7=function(_0x3cb6dc,_0x120dd3){_0x3cb6dc=_0x3cb6dc-0x0;var _0x47ec89=_0x4c7c[_0x3cb6dc];return _0x47ec89;};'use strict';var _=require(_0xc4c7('0x0'));var util=require(_0xc4c7('0x1'));var moment=require('moment');var BPromise=require(_0xc4c7('0x2'));var rs=require(_0xc4c7('0x3'));var fs=require('fs');var Redis=require(_0xc4c7('0x4'));var db=require(_0xc4c7('0x5'))['db'];var utils=require(_0xc4c7('0x6'));var logger=require('../../config/logger')(_0xc4c7('0x7'));var config=require(_0xc4c7('0x8'));var jayson=require(_0xc4c7('0x9'));var client=jayson[_0xc4c7('0xa')][_0xc4c7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x40f3bf,_0x41a41b,_0xc28bae){return new BPromise(function(_0x3c40f8,_0x492633){return client[_0xc4c7('0xc')](_0x40f3bf,_0xc28bae)[_0xc4c7('0xd')](function(_0x297a14){logger['info'](_0xc4c7('0xe'),_0x41a41b,_0xc4c7('0xf'));logger[_0xc4c7('0x10')](_0xc4c7('0x11'),_0x41a41b,_0xc4c7('0xf'),JSON[_0xc4c7('0x12')](_0x297a14));if(_0x297a14[_0xc4c7('0x13')]){if(_0x297a14['error'][_0xc4c7('0x14')]===0x1f4){logger[_0xc4c7('0x13')](_0xc4c7('0xe'),_0x41a41b,_0x297a14[_0xc4c7('0x13')][_0xc4c7('0x15')]);return _0x492633(_0x297a14[_0xc4c7('0x13')]['message']);}logger[_0xc4c7('0x13')](_0xc4c7('0xe'),_0x41a41b,_0x297a14[_0xc4c7('0x13')][_0xc4c7('0x15')]);return _0x3c40f8(_0x297a14[_0xc4c7('0x13')][_0xc4c7('0x15')]);}else{logger[_0xc4c7('0x16')]('CmHopperBlack,\x20%s,\x20%s',_0x41a41b,_0xc4c7('0xf'));_0x3c40f8(_0x297a14[_0xc4c7('0x17')]['message']);}})[_0xc4c7('0x18')](function(_0x1c1470){logger[_0xc4c7('0x13')](_0xc4c7('0xe'),_0x41a41b,_0x1c1470);_0x492633(_0x1c1470);});});}exports[_0xc4c7('0x19')]=function(_0x65539c){var _0xffd463=this;return new Promise(function(_0xd19b15,_0x257f86){return db[_0xc4c7('0x1a')][_0xc4c7('0x1b')]({'raw':_0x65539c['options']?_0x65539c['options'][_0xc4c7('0x1c')]===undefined?!![]:![]:!![],'where':_0x65539c[_0xc4c7('0x1d')]?_0x65539c['options'][_0xc4c7('0x1e')]||null:null,'attributes':_0x65539c[_0xc4c7('0x1d')]?_0x65539c[_0xc4c7('0x1d')]['attributes']||null:null,'limit':_0x65539c[_0xc4c7('0x1d')]?_0x65539c['options'][_0xc4c7('0x1f')]||null:null,'include':_0x65539c['options']?_0x65539c[_0xc4c7('0x1d')][_0xc4c7('0x20')]?_[_0xc4c7('0x21')](_0x65539c['options'][_0xc4c7('0x20')],function(_0x27810a){return{'model':db[_0x27810a[_0xc4c7('0x22')]],'as':_0x27810a['as'],'attributes':_0x27810a[_0xc4c7('0x23')],'include':_0x27810a[_0xc4c7('0x20')]?_[_0xc4c7('0x21')](_0x27810a[_0xc4c7('0x20')],function(_0x439bef){return{'model':db[_0x439bef['model']],'as':_0x439bef['as'],'attributes':_0x439bef['attributes'],'include':_0x439bef[_0xc4c7('0x20')]?_[_0xc4c7('0x21')](_0x439bef['include'],function(_0x32a642){return{'model':db[_0x32a642['model']],'as':_0x32a642['as'],'attributes':_0x32a642[_0xc4c7('0x23')]};}):[]};}):[]};}):[]:[]})[_0xc4c7('0xd')](function(_0x5888d6){logger['info']('GetCmHopperBlack',_0x65539c);logger[_0xc4c7('0x10')]('GetCmHopperBlack',_0x65539c,JSON[_0xc4c7('0x12')](_0x5888d6));_0xd19b15(_0x5888d6);})[_0xc4c7('0x18')](function(_0x56c526){logger['error'](_0xc4c7('0x19'),_0x56c526[_0xc4c7('0x15')],_0x65539c);_0x257f86(_0xffd463[_0xc4c7('0x13')](0x1f4,_0x56c526[_0xc4c7('0x15')]));});});};exports[_0xc4c7('0x24')]=function(_0x585499){var _0x3f220c=this;return new Promise(function(_0x41251a,_0x934334){return db[_0xc4c7('0x1a')]['update'](_0x585499[_0xc4c7('0x25')],{'raw':_0x585499[_0xc4c7('0x1d')]?_0x585499[_0xc4c7('0x1d')][_0xc4c7('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x585499[_0xc4c7('0x1d')]?_0x585499['options'][_0xc4c7('0x1e')]||null:null,'attributes':_0x585499['options']?_0x585499[_0xc4c7('0x1d')][_0xc4c7('0x23')]||null:null,'limit':_0x585499[_0xc4c7('0x1d')]?_0x585499[_0xc4c7('0x1d')][_0xc4c7('0x1f')]||null:null})['then'](function(_0x223606){logger[_0xc4c7('0x16')](_0xc4c7('0x24'),_0x585499);logger[_0xc4c7('0x10')]('UpdateCmHopperBlack',_0x585499,JSON[_0xc4c7('0x12')](_0x223606));_0x41251a(_0x223606);})['catch'](function(_0x46e446){logger[_0xc4c7('0x13')](_0xc4c7('0x24'),_0x46e446[_0xc4c7('0x15')],_0x585499);_0x934334(_0x3f220c[_0xc4c7('0x13')](0x1f4,_0x46e446['message']));});});};exports[_0xc4c7('0x26')]=function(_0x1456db){var _0x2a6835=this;return new Promise(function(_0x5ea2ee,_0x742246){return db[_0xc4c7('0x1a')][_0xc4c7('0x27')]({'where':_0x1456db[_0xc4c7('0x1d')]?_0x1456db[_0xc4c7('0x1d')][_0xc4c7('0x1e')]||null:null})['then'](function(_0x16bcec){logger[_0xc4c7('0x16')](_0xc4c7('0x26'),_0x1456db);logger[_0xc4c7('0x10')](_0xc4c7('0x26'),_0x1456db,JSON[_0xc4c7('0x12')](_0x16bcec));_0x5ea2ee(_0x16bcec);})[_0xc4c7('0x18')](function(_0xbf9f3b){logger['error']('DestroyCmHopperBlack',_0xbf9f3b[_0xc4c7('0x15')],_0x1456db);_0x742246(_0x2a6835['error'](0x1f4,_0xbf9f3b[_0xc4c7('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 6ea558b..33883c9 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 _0xa6b0=['update','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated','index','/describe','describe','/:id','put'];(function(_0x465d35,_0x540f6e){var _0x208cb5=function(_0x337c2c){while(--_0x337c2c){_0x465d35['push'](_0x465d35['shift']());}};_0x208cb5(++_0x540f6e);}(_0xa6b0,0xaf));var _0x0a6b=function(_0x16fc2a,_0x545bfd){_0x16fc2a=_0x16fc2a-0x0;var _0x28d677=_0xa6b0[_0x16fc2a];return _0x28d677;};'use strict';var multer=require(_0x0a6b('0x0'));var util=require(_0x0a6b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0a6b('0x2'));var router=express[_0x0a6b('0x3')]();var fs_extra=require(_0x0a6b('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x0a6b('0x5'));var config=require(_0x0a6b('0x6'));var controller=require(_0x0a6b('0x7'));router[_0x0a6b('0x8')]('/',auth[_0x0a6b('0x9')](),controller[_0x0a6b('0xa')]);router[_0x0a6b('0x8')](_0x0a6b('0xb'),auth[_0x0a6b('0x9')](),controller[_0x0a6b('0xc')]);router[_0x0a6b('0x8')](_0x0a6b('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x0a6b('0xe')](_0x0a6b('0xd'),auth[_0x0a6b('0x9')](),controller[_0x0a6b('0xf')]);router[_0x0a6b('0x10')](_0x0a6b('0xd'),auth[_0x0a6b('0x9')](),controller[_0x0a6b('0x11')]);module[_0x0a6b('0x12')]=router; \ No newline at end of file +var _0x6455=['index','/describe','/:id','show','put','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated'];(function(_0xabbd2f,_0x44d05a){var _0x34a040=function(_0x3736d9){while(--_0x3736d9){_0xabbd2f['push'](_0xabbd2f['shift']());}};_0x34a040(++_0x44d05a);}(_0x6455,0x97));var _0x5645=function(_0x364ad0,_0x5183b4){_0x364ad0=_0x364ad0-0x0;var _0x1f8b07=_0x6455[_0x364ad0];return _0x1f8b07;};'use strict';var multer=require(_0x5645('0x0'));var util=require('util');var path=require(_0x5645('0x1'));var timeout=require(_0x5645('0x2'));var express=require(_0x5645('0x3'));var router=express[_0x5645('0x4')]();var fs_extra=require(_0x5645('0x5'));var auth=require(_0x5645('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5645('0x7'));var controller=require(_0x5645('0x8'));router[_0x5645('0x9')]('/',auth[_0x5645('0xa')](),controller[_0x5645('0xb')]);router[_0x5645('0x9')](_0x5645('0xc'),auth[_0x5645('0xa')](),controller['describe']);router['get'](_0x5645('0xd'),auth[_0x5645('0xa')](),controller[_0x5645('0xe')]);router[_0x5645('0xf')](_0x5645('0xd'),auth[_0x5645('0xa')](),controller['update']);router[_0x5645('0x10')](_0x5645('0xd'),auth[_0x5645('0xa')](),controller[_0x5645('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index c156db0..7030947 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 _0x31ec=['seconds','dispositionat','BOOLEAN','exports','INTEGER','STRING','DATE','getDataValue','endtime','setDataValue','followuptime','diff'];(function(_0x270f18,_0x8155e9){var _0x39d745=function(_0x294bdd){while(--_0x294bdd){_0x270f18['push'](_0x270f18['shift']());}};_0x39d745(++_0x8155e9);}(_0x31ec,0xf3));var _0xc31e=function(_0x3a7f4b,_0x46ab83){_0x3a7f4b=_0x3a7f4b-0x0;var _0x1c6d63=_0x31ec[_0x3a7f4b];return _0x1c6d63;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0xc31e('0x0')]={'state':{'type':Sequelize[_0xc31e('0x1')](0x2)},'statedesc':{'type':Sequelize[_0xc31e('0x2')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0xc31e('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xc31e('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xc31e('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xc31e('0x2')]},'originatecalleridnum':{'type':Sequelize[_0xc31e('0x2')]},'originatecalleridname':{'type':Sequelize[_0xc31e('0x2')]},'calleridnum':{'type':Sequelize[_0xc31e('0x2')]},'calleridname':{'type':Sequelize[_0xc31e('0x2')]},'starttime':{'type':Sequelize[_0xc31e('0x3')]},'responsetime':{'type':Sequelize[_0xc31e('0x3')]},'answertime':{'type':Sequelize[_0xc31e('0x3')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xc31e('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xc31e('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xc31e('0x2')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0xc31e('0x2')]},'membername':{'type':Sequelize[_0xc31e('0x2')]},'reason':{'type':Sequelize[_0xc31e('0x2')]},'disposition':{'type':Sequelize[_0xc31e('0x2')]},'secondDisposition':{'type':Sequelize[_0xc31e('0x2')]},'thirdDisposition':{'type':Sequelize[_0xc31e('0x2')]},'dispositionat':{'type':Sequelize[_0xc31e('0x3')],'set':function(_0x325e71){var _0x3bb32c=this[_0xc31e('0x4')](_0xc31e('0x5'));if(_0x3bb32c&&_0x325e71){this[_0xc31e('0x6')](_0xc31e('0x7'),moment(_0x325e71)[_0xc31e('0x8')](moment(_0x3bb32c),_0xc31e('0x9')));}return this[_0xc31e('0x6')](_0xc31e('0xa'),_0x325e71);}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize[_0xc31e('0xb')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0xc31e('0x3')]},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0xc31e('0xb')],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize[_0xc31e('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xc31e('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xc31e('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xc31e('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x8ccb=['DATE','getDataValue','endtime','setDataValue','followuptime','seconds','dispositionat','BOOLEAN','sequelize','moment','INTEGER','STRING'];(function(_0x55e6f8,_0x545b8d){var _0x350cf9=function(_0x3c1e03){while(--_0x3c1e03){_0x55e6f8['push'](_0x55e6f8['shift']());}};_0x350cf9(++_0x545b8d);}(_0x8ccb,0x1c4));var _0xb8cc=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0x8ccb[_0x45d55e];return _0x29812a;};'use strict';var Sequelize=require(_0xb8cc('0x0'));var moment=require(_0xb8cc('0x1'));module['exports']={'state':{'type':Sequelize[_0xb8cc('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xb8cc('0x3')]},'scheduledat':{'type':Sequelize[_0xb8cc('0x4')]},'countbusyretry':{'type':Sequelize[_0xb8cc('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xb8cc('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xb8cc('0x3')]},'originatecalleridnum':{'type':Sequelize[_0xb8cc('0x3')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xb8cc('0x3')]},'calleridname':{'type':Sequelize[_0xb8cc('0x3')]},'starttime':{'type':Sequelize[_0xb8cc('0x4')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xb8cc('0x4')]},'droptime':{'type':Sequelize[_0xb8cc('0x4')]},'endtime':{'type':Sequelize[_0xb8cc('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xb8cc('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xb8cc('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0xb8cc('0x3')]},'campaigntype':{'type':Sequelize[_0xb8cc('0x3')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0xb8cc('0x3')]},'secondDisposition':{'type':Sequelize[_0xb8cc('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize[_0xb8cc('0x4')],'set':function(_0x2c1cbc){var _0xfd89e0=this[_0xb8cc('0x5')](_0xb8cc('0x6'));if(_0xfd89e0&&_0x2c1cbc){this[_0xb8cc('0x7')](_0xb8cc('0x8'),moment(_0x2c1cbc)['diff'](moment(_0xfd89e0),_0xb8cc('0x9')));}return this['setDataValue'](_0xb8cc('0xa'),_0x2c1cbc);}},'amd':{'type':Sequelize[_0xb8cc('0xb')],'defaultValue':![]},'fax':{'type':Sequelize[_0xb8cc('0xb')],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xb8cc('0xb')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xb8cc('0x4')]},'callback':{'type':Sequelize[_0xb8cc('0xb')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0xb8cc('0x4')]},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize[_0xb8cc('0x4')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xb8cc('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0xb8cc('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xb8cc('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xb8cc('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xb8cc('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index 4f0b769..28fabe5 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 _0x33af=['end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','map','CmHopperFinal','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','order','sort','where','merge','VIRTUAL','filter','includeAll','findAll','rows','catch','show','params','length','include','describe','body','uniqueid','find','countContactsQueueCampaignHopperFinal','COUNT','sequelize','`state`\x20=\x200,\x201,\x20null','noSuchContacts','literal','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','busyContacts','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','countContactsIvrCampaignHopperFinal','noAnswerContacts','`state`\x20=\x208,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','answeringMachine','moveContactsQueueCampaignHopperFinal','cm_hopper','phone','scheduledAt','ContactId','ListId','VoiceQueueId','select','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(VoiceQueueId)','createdAt','updatedAt','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','insert','fromQuery','CampaignId','ANY_VALUE(ListId)','CampaignId\x20=\x20?','checkContactHopper','CmHopper','findOne','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x51a5d8,_0x3d48d4){var _0x1f15a0=function(_0x1eb08e){while(--_0x1eb08e){_0x51a5d8['push'](_0x51a5d8['shift']());}};_0x1f15a0(++_0x3d48d4);}(_0x33af,0xec));var _0xf33a=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0x33af[_0xea8947];return _0x2455e9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf33a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf33a('0x1'));var rp=require(_0xf33a('0x2'));var moment=require(_0xf33a('0x3'));var BPromise=require(_0xf33a('0x4'));var Mustache=require(_0xf33a('0x5'));var util=require(_0xf33a('0x6'));var path=require('path');var sox=require(_0xf33a('0x7'));var csv=require(_0xf33a('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf33a('0x9'));var _=require(_0xf33a('0xa'));var squel=require(_0xf33a('0xb'));var crypto=require(_0xf33a('0xc'));var jsforce=require(_0xf33a('0xd'));var deskjs=require(_0xf33a('0xe'));var toCsv=require('to-csv');var querystring=require(_0xf33a('0xf'));var Papa=require(_0xf33a('0x10'));var Redis=require(_0xf33a('0x11'));var authService=require(_0xf33a('0x12'));var qs=require(_0xf33a('0x13'));var as=require(_0xf33a('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf33a('0x15'));var utils=require(_0xf33a('0x16'));var config=require(_0xf33a('0x17'));var licenseUtil=require(_0xf33a('0x18'));var db=require(_0xf33a('0x19'))['db'];function respondWithStatusCode(_0x5959c9,_0x9f87bc){_0x9f87bc=_0x9f87bc||0xcc;return function(_0x21b80e){if(_0x21b80e){return _0x5959c9['sendStatus'](_0x9f87bc);}return _0x5959c9['status'](_0x9f87bc)[_0xf33a('0x1a')]();};}function respondWithResult(_0x1b3bf0,_0x17043){_0x17043=_0x17043||0xc8;return function(_0x153bda){if(_0x153bda){return _0x1b3bf0[_0xf33a('0x1b')](_0x17043)[_0xf33a('0x1c')](_0x153bda);}};}function respondWithFilteredResult(_0x45e311,_0x1f2b1b){return function(_0x507cb9){if(_0x507cb9){var _0x441f59=typeof _0x1f2b1b['offset']===_0xf33a('0x1d')&&typeof _0x1f2b1b[_0xf33a('0x1e')]==='undefined';var _0x37e76c=_0x507cb9[_0xf33a('0x1f')];var _0x524109=_0x441f59?0x0:_0x1f2b1b[_0xf33a('0x20')];var _0x23d9e2=_0x441f59?_0x507cb9[_0xf33a('0x1f')]:_0x1f2b1b[_0xf33a('0x20')]+_0x1f2b1b['limit'];var _0x11efa0;if(_0x23d9e2>=_0x37e76c){_0x23d9e2=_0x37e76c;_0x11efa0=0xc8;}else{_0x11efa0=0xce;}_0x45e311[_0xf33a('0x1b')](_0x11efa0);return _0x45e311[_0xf33a('0x21')](_0xf33a('0x22'),_0x524109+'-'+_0x23d9e2+'/'+_0x37e76c)[_0xf33a('0x1c')](_0x507cb9);}return null;};}function patchUpdates(_0x6cdf7b){return function(_0x19986f){try{jsonpatch[_0xf33a('0x23')](_0x19986f,_0x6cdf7b,!![]);}catch(_0x19055e){return BPromise[_0xf33a('0x24')](_0x19055e);}return _0x19986f['save']();};}function saveUpdates(_0x3854b4,_0x272e60){return function(_0x1bf9bc){if(_0x1bf9bc){return _0x1bf9bc[_0xf33a('0x25')](_0x3854b4)[_0xf33a('0x26')](function(_0x51d3fd){return _0x51d3fd;});}return null;};}function removeEntity(_0x44654c,_0x5882ba){return function(_0x492986){if(_0x492986){return _0x492986[_0xf33a('0x27')]()[_0xf33a('0x26')](function(){_0x44654c[_0xf33a('0x1b')](0xcc)[_0xf33a('0x1a')]();});}};}function handleEntityNotFound(_0x4b9801,_0x57cb1d){return function(_0x393005){if(!_0x393005){_0x4b9801['sendStatus'](0x194);}return _0x393005;};}function handleError(_0x4af24a,_0x16ef31){_0x16ef31=_0x16ef31||0x1f4;return function(_0x5f0a53){logger['error'](_0x5f0a53[_0xf33a('0x28')]);if(_0x5f0a53['name']){delete _0x5f0a53[_0xf33a('0x29')];}_0x4af24a['status'](_0x16ef31)[_0xf33a('0x2a')](_0x5f0a53);};}exports[_0xf33a('0x2b')]=function(_0x469741,_0x729fca){var _0x4552c9={},_0x3068a9={},_0x1d19ee={'count':0x0,'rows':[]};var _0x1246ff=_[_0xf33a('0x2c')](db[_0xf33a('0x2d')][_0xf33a('0x2e')],function(_0x8f8ddc){return{'name':_0x8f8ddc[_0xf33a('0x2f')],'type':_0x8f8ddc[_0xf33a('0x30')][_0xf33a('0x31')]};});_0x3068a9['model']=_[_0xf33a('0x2c')](_0x1246ff,_0xf33a('0x29'));_0x3068a9[_0xf33a('0x32')]=_[_0xf33a('0x33')](_0x469741['query']);_0x3068a9[_0xf33a('0x34')]=_[_0xf33a('0x35')](_0x3068a9[_0xf33a('0x36')],_0x3068a9[_0xf33a('0x32')]);_0x4552c9[_0xf33a('0x37')]=_[_0xf33a('0x35')](_0x3068a9['model'],qs[_0xf33a('0x38')](_0x469741[_0xf33a('0x32')][_0xf33a('0x38')]));_0x4552c9[_0xf33a('0x37')]=_0x4552c9[_0xf33a('0x37')]['length']?_0x4552c9['attributes']:_0x3068a9[_0xf33a('0x36')];if(!_0x469741['query']['hasOwnProperty']('nolimit')){_0x4552c9[_0xf33a('0x1e')]=qs[_0xf33a('0x1e')](_0x469741['query'][_0xf33a('0x1e')]);_0x4552c9['offset']=qs[_0xf33a('0x20')](_0x469741[_0xf33a('0x32')][_0xf33a('0x20')]);}_0x4552c9[_0xf33a('0x39')]=qs[_0xf33a('0x3a')](_0x469741[_0xf33a('0x32')]['sort']);_0x4552c9[_0xf33a('0x3b')]=qs[_0xf33a('0x34')](_['pick'](_0x469741[_0xf33a('0x32')],_0x3068a9[_0xf33a('0x34')]),_0x1246ff);if(_0x469741[_0xf33a('0x32')]['filter']){_0x4552c9[_0xf33a('0x3b')]=_[_0xf33a('0x3c')](_0x4552c9[_0xf33a('0x3b')],{'$or':_[_0xf33a('0x2c')](_0x1246ff,function(_0x3ec562){if(_0x3ec562[_0xf33a('0x30')]!==_0xf33a('0x3d')){var _0x128baf={};_0x128baf[_0x3ec562[_0xf33a('0x29')]]={'$like':'%'+_0x469741['query'][_0xf33a('0x3e')]+'%'};return _0x128baf;}})});}_0x4552c9=_[_0xf33a('0x3c')]({},_0x4552c9,_0x469741['options']);var _0x1e8800={'where':_0x4552c9['where']};return db['CmHopperFinal'][_0xf33a('0x1f')](_0x1e8800)[_0xf33a('0x26')](function(_0x4dada1){_0x1d19ee[_0xf33a('0x1f')]=_0x4dada1;if(_0x469741[_0xf33a('0x32')][_0xf33a('0x3f')]){_0x4552c9['include']=[{'all':!![]}];}return db[_0xf33a('0x2d')][_0xf33a('0x40')](_0x4552c9);})['then'](function(_0x1e9748){_0x1d19ee[_0xf33a('0x41')]=_0x1e9748;return _0x1d19ee;})[_0xf33a('0x26')](respondWithFilteredResult(_0x729fca,_0x4552c9))[_0xf33a('0x42')](handleError(_0x729fca,null));};exports[_0xf33a('0x43')]=function(_0x5044f9,_0x45ae15){var _0x1722e5={'raw':!![],'where':{'id':_0x5044f9[_0xf33a('0x44')]['id']}},_0x2325eb={};_0x2325eb[_0xf33a('0x36')]=_['keys'](db[_0xf33a('0x2d')][_0xf33a('0x2e')]);_0x2325eb[_0xf33a('0x32')]=_['keys'](_0x5044f9[_0xf33a('0x32')]);_0x2325eb[_0xf33a('0x34')]=_[_0xf33a('0x35')](_0x2325eb[_0xf33a('0x36')],_0x2325eb[_0xf33a('0x32')]);_0x1722e5[_0xf33a('0x37')]=_['intersection'](_0x2325eb[_0xf33a('0x36')],qs[_0xf33a('0x38')](_0x5044f9[_0xf33a('0x32')][_0xf33a('0x38')]));_0x1722e5[_0xf33a('0x37')]=_0x1722e5['attributes'][_0xf33a('0x45')]?_0x1722e5[_0xf33a('0x37')]:_0x2325eb[_0xf33a('0x36')];if(_0x5044f9['query'][_0xf33a('0x3f')]){_0x1722e5[_0xf33a('0x46')]=[{'all':!![]}];}_0x1722e5=_['merge']({},_0x1722e5,_0x5044f9['options']);return db[_0xf33a('0x2d')]['find'](_0x1722e5)[_0xf33a('0x26')](handleEntityNotFound(_0x45ae15,null))[_0xf33a('0x26')](respondWithResult(_0x45ae15,null))[_0xf33a('0x42')](handleError(_0x45ae15,null));};exports[_0xf33a('0x47')]=function(_0xecc82f,_0x1a98f9){return db[_0xf33a('0x2d')][_0xf33a('0x47')]()[_0xf33a('0x26')](respondWithResult(_0x1a98f9,null))[_0xf33a('0x42')](handleError(_0x1a98f9,null));};exports[_0xf33a('0x25')]=function(_0x4107b1,_0x190a2b){if(_0x4107b1[_0xf33a('0x48')][_0xf33a('0x49')]){delete _0x4107b1[_0xf33a('0x48')][_0xf33a('0x49')];}return db[_0xf33a('0x2d')][_0xf33a('0x4a')]({'where':{'uniqueid':_0x4107b1[_0xf33a('0x44')]['id']}})[_0xf33a('0x26')](handleEntityNotFound(_0x190a2b,null))[_0xf33a('0x26')](saveUpdates(_0x4107b1[_0xf33a('0x48')],null))[_0xf33a('0x26')](respondWithResult(_0x190a2b,null))[_0xf33a('0x42')](handleError(_0x190a2b,null));};exports[_0xf33a('0x4b')]=function(_0x3bab07,_0x1f7d8c,_0x57815c){return db['CmHopperFinal'][_0xf33a('0x40')]({'raw':![],'where':{'VoiceQueueId':_0x3bab07[_0xf33a('0x44')]['id']},'attributes':[[db['sequelize']['fn'](_0xf33a('0x4c'),db[_0xf33a('0x4d')]['fn']('IF',db[_0xf33a('0x4d')]['literal'](_0xf33a('0x4e')))),_0xf33a('0x4f')],[db[_0xf33a('0x4d')]['fn']('COUNT',db[_0xf33a('0x4d')]['fn']('IF',db['sequelize'][_0xf33a('0x50')](_0xf33a('0x51')))),'noAnswerContacts'],[db['sequelize']['fn'](_0xf33a('0x4c'),db[_0xf33a('0x4d')]['fn']('IF',db[_0xf33a('0x4d')]['literal'](_0xf33a('0x52')))),_0xf33a('0x53')],[db[_0xf33a('0x4d')]['fn'](_0xf33a('0x4c'),db[_0xf33a('0x4d')]['fn']('IF',db[_0xf33a('0x4d')][_0xf33a('0x50')]('`state`\x20=\x208,\x201,\x20null'))),_0xf33a('0x54')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xf33a('0x4d')][_0xf33a('0x50')](_0xf33a('0x55')))),'dropContacts'],[db[_0xf33a('0x4d')]['fn'](_0xf33a('0x4c'),db[_0xf33a('0x4d')]['fn']('IF',db[_0xf33a('0x4d')][_0xf33a('0x50')]('`state`\x20=\x2011\x20,\x201,\x20null'))),'abandonedContacts'],[db['sequelize']['fn'](_0xf33a('0x4c'),db['sequelize']['fn']('IF',db[_0xf33a('0x4d')][_0xf33a('0x50')](_0xf33a('0x56')))),_0xf33a('0x57')],[db[_0xf33a('0x4d')]['fn'](_0xf33a('0x4c'),db['sequelize']['fn']('IF',db[_0xf33a('0x4d')][_0xf33a('0x50')](_0xf33a('0x58')))),'answeringMachine']]})[_0xf33a('0x26')](handleEntityNotFound(_0x1f7d8c,null))[_0xf33a('0x26')](respondWithResult(_0x1f7d8c,null))[_0xf33a('0x42')](handleError(_0x1f7d8c,null));};exports[_0xf33a('0x59')]=function(_0x2f1fef,_0x129229,_0x473484){return db[_0xf33a('0x2d')][_0xf33a('0x40')]({'raw':![],'where':{'CampaignId':_0x2f1fef[_0xf33a('0x44')]['id']},'attributes':[[db[_0xf33a('0x4d')]['fn'](_0xf33a('0x4c'),db[_0xf33a('0x4d')]['fn']('IF',db[_0xf33a('0x4d')]['literal']('`state`\x20=\x200,\x201,\x20null'))),_0xf33a('0x4f')],[db[_0xf33a('0x4d')]['fn'](_0xf33a('0x4c'),db[_0xf33a('0x4d')]['fn']('IF',db[_0xf33a('0x4d')][_0xf33a('0x50')](_0xf33a('0x51')))),_0xf33a('0x5a')],[db[_0xf33a('0x4d')]['fn'](_0xf33a('0x4c'),db[_0xf33a('0x4d')]['fn']('IF',db['sequelize'][_0xf33a('0x50')](_0xf33a('0x52')))),_0xf33a('0x53')],[db[_0xf33a('0x4d')]['fn'](_0xf33a('0x4c'),db[_0xf33a('0x4d')]['fn']('IF',db[_0xf33a('0x4d')][_0xf33a('0x50')](_0xf33a('0x5b')))),'congestionContacts'],[db[_0xf33a('0x4d')]['fn'](_0xf33a('0x4c'),db['sequelize']['fn']('IF',db[_0xf33a('0x4d')][_0xf33a('0x50')](_0xf33a('0x55')))),_0xf33a('0x5c')],[db[_0xf33a('0x4d')]['fn'](_0xf33a('0x4c'),db['sequelize']['fn']('IF',db[_0xf33a('0x4d')][_0xf33a('0x50')](_0xf33a('0x5d')))),_0xf33a('0x5e')],[db[_0xf33a('0x4d')]['fn'](_0xf33a('0x4c'),db[_0xf33a('0x4d')]['fn']('IF',db['sequelize'][_0xf33a('0x50')](_0xf33a('0x56')))),'reCallContacts'],[db['sequelize']['fn']('COUNT',db[_0xf33a('0x4d')]['fn']('IF',db[_0xf33a('0x4d')][_0xf33a('0x50')](_0xf33a('0x58')))),_0xf33a('0x5f')]]})[_0xf33a('0x26')](handleEntityNotFound(_0x129229,null))[_0xf33a('0x26')](respondWithResult(_0x129229,null))[_0xf33a('0x42')](handleError(_0x129229,null));};exports[_0xf33a('0x60')]=function(_0x3bebca,_0x40bb02,_0x10a271){return db['VoiceQueue'][_0xf33a('0x4a')]({'where':{'id':_0x3bebca['params']['id']}})['then'](handleEntityNotFound(_0x40bb02,null))[_0xf33a('0x26')](function(_0x25cc49){var _0x132764;if(_0x25cc49){_0x132764=squel['insert']()['into'](_0xf33a('0x61'))['fromQuery']([_0xf33a('0x62'),_0xf33a('0x63'),_0xf33a('0x64'),_0xf33a('0x65'),_0xf33a('0x66'),'createdAt','updatedAt'],squel[_0xf33a('0x67')]()[_0xf33a('0x68')](_0xf33a('0x69'),_0xf33a('0x62'))['field'](_0xf33a('0x6a'),_0xf33a('0x63'))['field'](_0xf33a('0x6b'),_0xf33a('0x64'))[_0xf33a('0x68')]('ANY_VALUE(ListId)',_0xf33a('0x65'))[_0xf33a('0x68')](_0xf33a('0x6c'),_0xf33a('0x66'))['field'](_0xf33a('0x6a'),_0xf33a('0x6d'))[_0xf33a('0x68')]('NOW()',_0xf33a('0x6e'))[_0xf33a('0x6f')](_0xf33a('0x70'))[_0xf33a('0x3b')](_0xf33a('0x71'),_0x3bebca[_0xf33a('0x44')]['id'][_0xf33a('0x72')]())[_0xf33a('0x3b')](_0xf33a('0x73'),_0x3bebca[_0xf33a('0x48')][_0xf33a('0x74')][_0xf33a('0x72')]())[_0xf33a('0x3b')](_0xf33a('0x75'))[_0xf33a('0x3b')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0xf33a('0x67')]()[_0xf33a('0x68')](_0xf33a('0x62'))[_0xf33a('0x6f')](_0xf33a('0x61'))[_0xf33a('0x3b')](_0xf33a('0x71'),_0x3bebca[_0xf33a('0x44')]['id'][_0xf33a('0x72')]()))[_0xf33a('0x3b')](_0xf33a('0x76'),squel[_0xf33a('0x67')]()[_0xf33a('0x68')](_0xf33a('0x77'))['from'](_0xf33a('0x70'))[_0xf33a('0x3b')](_0xf33a('0x71'),_0x3bebca[_0xf33a('0x44')]['id']['toString']())[_0xf33a('0x3b')](_0xf33a('0x78')))[_0xf33a('0x79')](_0xf33a('0x64')))[_0xf33a('0x72')]();return db[_0xf33a('0x4d')][_0xf33a('0x32')](_0x132764);}return[];})[_0xf33a('0x26')](respondWithResult(_0x40bb02,null))['catch'](handleError(_0x40bb02,null));};exports[_0xf33a('0x7a')]=function(_0x1dfb59,_0x9c0b99,_0x17b2fa){return db['Campaign']['find']({'where':{'id':_0x1dfb59[_0xf33a('0x44')]['id']}})['then'](handleEntityNotFound(_0x9c0b99,null))[_0xf33a('0x26')](function(_0x1595b7){var _0x3d8dbe;if(_0x1595b7){_0x3d8dbe=squel[_0xf33a('0x7b')]()['into']('cm_hopper')[_0xf33a('0x7c')](['phone',_0xf33a('0x63'),_0xf33a('0x64'),_0xf33a('0x65'),_0xf33a('0x7d'),_0xf33a('0x6d'),_0xf33a('0x6e')],squel[_0xf33a('0x67')]()[_0xf33a('0x68')](_0xf33a('0x69'),_0xf33a('0x62'))[_0xf33a('0x68')](_0xf33a('0x6a'),_0xf33a('0x63'))[_0xf33a('0x68')](_0xf33a('0x6b'),_0xf33a('0x64'))['field'](_0xf33a('0x7e'),'ListId')[_0xf33a('0x68')]('ANY_VALUE(CampaignId)','CampaignId')['field'](_0xf33a('0x6a'),_0xf33a('0x6d'))['field'](_0xf33a('0x6a'),_0xf33a('0x6e'))[_0xf33a('0x6f')](_0xf33a('0x70'))[_0xf33a('0x3b')](_0xf33a('0x7f'),_0x1dfb59['params']['id'][_0xf33a('0x72')]())[_0xf33a('0x3b')]('state\x20=\x20?',_0x1dfb59[_0xf33a('0x48')][_0xf33a('0x74')][_0xf33a('0x72')]())['where'](_0xf33a('0x75'))[_0xf33a('0x3b')](_0xf33a('0x76'),squel[_0xf33a('0x67')]()[_0xf33a('0x68')]('phone')[_0xf33a('0x6f')](_0xf33a('0x61'))[_0xf33a('0x3b')](_0xf33a('0x7f'),_0x1dfb59[_0xf33a('0x44')]['id']['toString']()))[_0xf33a('0x3b')](_0xf33a('0x76'),squel[_0xf33a('0x67')]()[_0xf33a('0x68')](_0xf33a('0x77'))['from'](_0xf33a('0x70'))['where']('CampaignId\x20=\x20?',_0x1dfb59[_0xf33a('0x44')]['id']['toString']())[_0xf33a('0x3b')](_0xf33a('0x78')))['group'](_0xf33a('0x64')))[_0xf33a('0x72')]();return db[_0xf33a('0x4d')][_0xf33a('0x32')](_0x3d8dbe);}return[];})[_0xf33a('0x26')](respondWithResult(_0x9c0b99,null))[_0xf33a('0x42')](handleError(_0x9c0b99,null));};exports[_0xf33a('0x80')]=function(_0x4abd84,_0x1205d1,_0x1d83a0){return db[_0xf33a('0x81')][_0xf33a('0x82')]({'where':{'VoiceQueueId':_0x4abd84['body'][_0xf33a('0x66')],'CampaignId':_0x4abd84['body'][_0xf33a('0x7d')],'ContactId':_0x4abd84[_0xf33a('0x48')][_0xf33a('0x64')]}})[_0xf33a('0x26')](handleEntityNotFound(_0x1205d1,null))[_0xf33a('0x26')](function(_0x49c40a){if(_0x49c40a){return _0x49c40a;}return null;})[_0xf33a('0x26')](respondWithResult(_0x1205d1,null))[_0xf33a('0x42')](handleError(_0x1205d1,null));}; \ No newline at end of file +var _0xe3da=['COUNT','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','noSuchContacts','congestionContacts','answeringMachine','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','phone','ContactId','select','field','NOW()','scheduledAt','ANY_VALUE(ContactId)','ListId','ANY_VALUE(VoiceQueueId)','VoiceQueueId','cm_hopper_final','toString','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','cm_hopper','VoiceQueueId\x20=\x20?','from','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','fromQuery','CampaignId','createdAt','updatedAt','ANY_VALUE(calleridnum)','ANY_VALUE(ListId)','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','calleridnum','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','CmHopperFinal','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','order','sort','where','pick','map','VIRTUAL','filter','merge','options','count','include','findAll','rows','catch','show','params','length','includeAll','find','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','sequelize','literal','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','noAnswerContacts'];(function(_0x2afb3a,_0x563228){var _0x382182=function(_0x4548b5){while(--_0x4548b5){_0x2afb3a['push'](_0x2afb3a['shift']());}};_0x382182(++_0x563228);}(_0xe3da,0x1cd));var _0xae3d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe3da[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0xae3d('0x0'));var rimraf=require(_0xae3d('0x1'));var zipdir=require(_0xae3d('0x2'));var jsonpatch=require(_0xae3d('0x3'));var rp=require(_0xae3d('0x4'));var moment=require(_0xae3d('0x5'));var BPromise=require(_0xae3d('0x6'));var Mustache=require(_0xae3d('0x7'));var util=require(_0xae3d('0x8'));var path=require(_0xae3d('0x9'));var sox=require(_0xae3d('0xa'));var csv=require(_0xae3d('0xb'));var ejs=require(_0xae3d('0xc'));var fs=require('fs');var fs_extra=require(_0xae3d('0xd'));var _=require(_0xae3d('0xe'));var squel=require(_0xae3d('0xf'));var crypto=require('crypto');var jsforce=require(_0xae3d('0x10'));var deskjs=require(_0xae3d('0x11'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xae3d('0x12'));var Redis=require(_0xae3d('0x13'));var authService=require(_0xae3d('0x14'));var qs=require(_0xae3d('0x15'));var as=require(_0xae3d('0x16'));var hardwareService=require(_0xae3d('0x17'));var logger=require('../../config/logger')(_0xae3d('0x18'));var utils=require('../../config/utils');var config=require(_0xae3d('0x19'));var licenseUtil=require(_0xae3d('0x1a'));var db=require(_0xae3d('0x1b'))['db'];function respondWithStatusCode(_0x172f7a,_0x48aa74){_0x48aa74=_0x48aa74||0xcc;return function(_0xfb7869){if(_0xfb7869){return _0x172f7a[_0xae3d('0x1c')](_0x48aa74);}return _0x172f7a[_0xae3d('0x1d')](_0x48aa74)[_0xae3d('0x1e')]();};}function respondWithResult(_0x2afdd3,_0x430659){_0x430659=_0x430659||0xc8;return function(_0x31498d){if(_0x31498d){return _0x2afdd3['status'](_0x430659)[_0xae3d('0x1f')](_0x31498d);}};}function respondWithFilteredResult(_0x42f4b4,_0x46295b){return function(_0x230afb){if(_0x230afb){var _0x192c13=typeof _0x46295b[_0xae3d('0x20')]==='undefined'&&typeof _0x46295b[_0xae3d('0x21')]===_0xae3d('0x22');var _0x2e31f1=_0x230afb['count'];var _0x3f8cf9=_0x192c13?0x0:_0x46295b[_0xae3d('0x20')];var _0x558e42=_0x192c13?_0x230afb['count']:_0x46295b[_0xae3d('0x20')]+_0x46295b[_0xae3d('0x21')];var _0x19c44d;if(_0x558e42>=_0x2e31f1){_0x558e42=_0x2e31f1;_0x19c44d=0xc8;}else{_0x19c44d=0xce;}_0x42f4b4[_0xae3d('0x1d')](_0x19c44d);return _0x42f4b4[_0xae3d('0x23')]('Content-Range',_0x3f8cf9+'-'+_0x558e42+'/'+_0x2e31f1)[_0xae3d('0x1f')](_0x230afb);}return null;};}function patchUpdates(_0x48f00e){return function(_0x4a09c2){try{jsonpatch[_0xae3d('0x24')](_0x4a09c2,_0x48f00e,!![]);}catch(_0x1415e8){return BPromise[_0xae3d('0x25')](_0x1415e8);}return _0x4a09c2[_0xae3d('0x26')]();};}function saveUpdates(_0x3e7afc,_0x26c419){return function(_0x155099){if(_0x155099){return _0x155099[_0xae3d('0x27')](_0x3e7afc)[_0xae3d('0x28')](function(_0x300be8){return _0x300be8;});}return null;};}function removeEntity(_0x9bf34a,_0x37f5ff){return function(_0x1b2acb){if(_0x1b2acb){return _0x1b2acb[_0xae3d('0x29')]()[_0xae3d('0x28')](function(){_0x9bf34a[_0xae3d('0x1d')](0xcc)[_0xae3d('0x1e')]();});}};}function handleEntityNotFound(_0x2131e9,_0x1b1217){return function(_0x5d45db){if(!_0x5d45db){_0x2131e9[_0xae3d('0x1c')](0x194);}return _0x5d45db;};}function handleError(_0x185e71,_0xb5940){_0xb5940=_0xb5940||0x1f4;return function(_0x52df0f){logger[_0xae3d('0x2a')](_0x52df0f[_0xae3d('0x2b')]);if(_0x52df0f[_0xae3d('0x2c')]){delete _0x52df0f['name'];}_0x185e71['status'](_0xb5940)[_0xae3d('0x2d')](_0x52df0f);};}exports[_0xae3d('0x2e')]=function(_0x3a5840,_0x3114f9){var _0xb69ec9={},_0x561371={},_0x1d1483={'count':0x0,'rows':[]};var _0x3a2434=_['map'](db[_0xae3d('0x2f')][_0xae3d('0x30')],function(_0x2cf750){return{'name':_0x2cf750[_0xae3d('0x31')],'type':_0x2cf750[_0xae3d('0x32')][_0xae3d('0x33')]};});_0x561371['model']=_['map'](_0x3a2434,'name');_0x561371[_0xae3d('0x34')]=_[_0xae3d('0x35')](_0x3a5840[_0xae3d('0x34')]);_0x561371[_0xae3d('0x36')]=_['intersection'](_0x561371[_0xae3d('0x37')],_0x561371[_0xae3d('0x34')]);_0xb69ec9[_0xae3d('0x38')]=_[_0xae3d('0x39')](_0x561371[_0xae3d('0x37')],qs[_0xae3d('0x3a')](_0x3a5840[_0xae3d('0x34')]['fields']));_0xb69ec9[_0xae3d('0x38')]=_0xb69ec9['attributes']['length']?_0xb69ec9[_0xae3d('0x38')]:_0x561371['model'];if(!_0x3a5840[_0xae3d('0x34')]['hasOwnProperty']('nolimit')){_0xb69ec9[_0xae3d('0x21')]=qs[_0xae3d('0x21')](_0x3a5840[_0xae3d('0x34')]['limit']);_0xb69ec9[_0xae3d('0x20')]=qs['offset'](_0x3a5840[_0xae3d('0x34')][_0xae3d('0x20')]);}_0xb69ec9[_0xae3d('0x3b')]=qs[_0xae3d('0x3c')](_0x3a5840[_0xae3d('0x34')][_0xae3d('0x3c')]);_0xb69ec9[_0xae3d('0x3d')]=qs[_0xae3d('0x36')](_[_0xae3d('0x3e')](_0x3a5840[_0xae3d('0x34')],_0x561371[_0xae3d('0x36')]),_0x3a2434);if(_0x3a5840['query']['filter']){_0xb69ec9[_0xae3d('0x3d')]=_['merge'](_0xb69ec9[_0xae3d('0x3d')],{'$or':_[_0xae3d('0x3f')](_0x3a2434,function(_0x1db3c1){if(_0x1db3c1[_0xae3d('0x32')]!==_0xae3d('0x40')){var _0x35db44={};_0x35db44[_0x1db3c1[_0xae3d('0x2c')]]={'$like':'%'+_0x3a5840[_0xae3d('0x34')][_0xae3d('0x41')]+'%'};return _0x35db44;}})});}_0xb69ec9=_[_0xae3d('0x42')]({},_0xb69ec9,_0x3a5840[_0xae3d('0x43')]);var _0x549db8={'where':_0xb69ec9[_0xae3d('0x3d')]};return db[_0xae3d('0x2f')][_0xae3d('0x44')](_0x549db8)['then'](function(_0x4df102){_0x1d1483[_0xae3d('0x44')]=_0x4df102;if(_0x3a5840[_0xae3d('0x34')]['includeAll']){_0xb69ec9[_0xae3d('0x45')]=[{'all':!![]}];}return db[_0xae3d('0x2f')][_0xae3d('0x46')](_0xb69ec9);})[_0xae3d('0x28')](function(_0x436a04){_0x1d1483[_0xae3d('0x47')]=_0x436a04;return _0x1d1483;})['then'](respondWithFilteredResult(_0x3114f9,_0xb69ec9))[_0xae3d('0x48')](handleError(_0x3114f9,null));};exports[_0xae3d('0x49')]=function(_0xce7f34,_0x938811){var _0x1fef90={'raw':!![],'where':{'id':_0xce7f34[_0xae3d('0x4a')]['id']}},_0x515220={};_0x515220['model']=_[_0xae3d('0x35')](db[_0xae3d('0x2f')][_0xae3d('0x30')]);_0x515220[_0xae3d('0x34')]=_['keys'](_0xce7f34['query']);_0x515220['filters']=_[_0xae3d('0x39')](_0x515220[_0xae3d('0x37')],_0x515220['query']);_0x1fef90['attributes']=_['intersection'](_0x515220[_0xae3d('0x37')],qs[_0xae3d('0x3a')](_0xce7f34[_0xae3d('0x34')][_0xae3d('0x3a')]));_0x1fef90[_0xae3d('0x38')]=_0x1fef90[_0xae3d('0x38')][_0xae3d('0x4b')]?_0x1fef90['attributes']:_0x515220['model'];if(_0xce7f34['query'][_0xae3d('0x4c')]){_0x1fef90['include']=[{'all':!![]}];}_0x1fef90=_[_0xae3d('0x42')]({},_0x1fef90,_0xce7f34[_0xae3d('0x43')]);return db[_0xae3d('0x2f')][_0xae3d('0x4d')](_0x1fef90)[_0xae3d('0x28')](handleEntityNotFound(_0x938811,null))[_0xae3d('0x28')](respondWithResult(_0x938811,null))[_0xae3d('0x48')](handleError(_0x938811,null));};exports[_0xae3d('0x4e')]=function(_0x38f92d,_0x4ed0f9){return db[_0xae3d('0x2f')]['describe']()['then'](respondWithResult(_0x4ed0f9,null))['catch'](handleError(_0x4ed0f9,null));};exports[_0xae3d('0x27')]=function(_0xc8f551,_0x39f213){if(_0xc8f551[_0xae3d('0x4f')]['uniqueid']){delete _0xc8f551['body'][_0xae3d('0x50')];}return db[_0xae3d('0x2f')][_0xae3d('0x4d')]({'where':{'uniqueid':_0xc8f551[_0xae3d('0x4a')]['id']}})['then'](handleEntityNotFound(_0x39f213,null))[_0xae3d('0x28')](saveUpdates(_0xc8f551[_0xae3d('0x4f')],null))[_0xae3d('0x28')](respondWithResult(_0x39f213,null))[_0xae3d('0x48')](handleError(_0x39f213,null));};exports[_0xae3d('0x51')]=function(_0x38ccf1,_0x3e30ea,_0x291c7d){return db[_0xae3d('0x2f')][_0xae3d('0x46')]({'raw':![],'where':{'VoiceQueueId':_0x38ccf1[_0xae3d('0x4a')]['id']},'attributes':[[db[_0xae3d('0x52')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0xae3d('0x53')](_0xae3d('0x54')))),'noSuchContacts'],[db[_0xae3d('0x52')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xae3d('0x52')][_0xae3d('0x53')](_0xae3d('0x55')))),_0xae3d('0x56')],[db[_0xae3d('0x52')]['fn'](_0xae3d('0x57'),db[_0xae3d('0x52')]['fn']('IF',db['sequelize'][_0xae3d('0x53')](_0xae3d('0x58')))),_0xae3d('0x59')],[db[_0xae3d('0x52')]['fn']('COUNT',db[_0xae3d('0x52')]['fn']('IF',db[_0xae3d('0x52')][_0xae3d('0x53')](_0xae3d('0x5a')))),'congestionContacts'],[db['sequelize']['fn']('COUNT',db[_0xae3d('0x52')]['fn']('IF',db['sequelize']['literal'](_0xae3d('0x5b')))),_0xae3d('0x5c')],[db[_0xae3d('0x52')]['fn'](_0xae3d('0x57'),db[_0xae3d('0x52')]['fn']('IF',db[_0xae3d('0x52')]['literal'](_0xae3d('0x5d')))),_0xae3d('0x5e')],[db[_0xae3d('0x52')]['fn'](_0xae3d('0x57'),db[_0xae3d('0x52')]['fn']('IF',db[_0xae3d('0x52')]['literal'](_0xae3d('0x5f')))),_0xae3d('0x60')],[db[_0xae3d('0x52')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0xae3d('0x53')](_0xae3d('0x61')))),'answeringMachine']]})[_0xae3d('0x28')](handleEntityNotFound(_0x3e30ea,null))[_0xae3d('0x28')](respondWithResult(_0x3e30ea,null))[_0xae3d('0x48')](handleError(_0x3e30ea,null));};exports['countContactsIvrCampaignHopperFinal']=function(_0x3a39ed,_0x31b362,_0x253ee4){return db[_0xae3d('0x2f')][_0xae3d('0x46')]({'raw':![],'where':{'CampaignId':_0x3a39ed[_0xae3d('0x4a')]['id']},'attributes':[[db[_0xae3d('0x52')]['fn'](_0xae3d('0x57'),db['sequelize']['fn']('IF',db['sequelize'][_0xae3d('0x53')](_0xae3d('0x54')))),_0xae3d('0x62')],[db['sequelize']['fn']('COUNT',db[_0xae3d('0x52')]['fn']('IF',db[_0xae3d('0x52')][_0xae3d('0x53')](_0xae3d('0x55')))),'noAnswerContacts'],[db[_0xae3d('0x52')]['fn'](_0xae3d('0x57'),db['sequelize']['fn']('IF',db[_0xae3d('0x52')][_0xae3d('0x53')](_0xae3d('0x58')))),_0xae3d('0x59')],[db[_0xae3d('0x52')]['fn'](_0xae3d('0x57'),db[_0xae3d('0x52')]['fn']('IF',db['sequelize'][_0xae3d('0x53')](_0xae3d('0x5a')))),_0xae3d('0x63')],[db[_0xae3d('0x52')]['fn'](_0xae3d('0x57'),db['sequelize']['fn']('IF',db[_0xae3d('0x52')][_0xae3d('0x53')](_0xae3d('0x5b')))),_0xae3d('0x5c')],[db[_0xae3d('0x52')]['fn'](_0xae3d('0x57'),db['sequelize']['fn']('IF',db[_0xae3d('0x52')][_0xae3d('0x53')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0xae3d('0x5e')],[db[_0xae3d('0x52')]['fn'](_0xae3d('0x57'),db['sequelize']['fn']('IF',db['sequelize'][_0xae3d('0x53')](_0xae3d('0x5f')))),_0xae3d('0x60')],[db[_0xae3d('0x52')]['fn'](_0xae3d('0x57'),db[_0xae3d('0x52')]['fn']('IF',db[_0xae3d('0x52')]['literal'](_0xae3d('0x61')))),_0xae3d('0x64')]]})['then'](handleEntityNotFound(_0x31b362,null))[_0xae3d('0x28')](respondWithResult(_0x31b362,null))['catch'](handleError(_0x31b362,null));};exports[_0xae3d('0x65')]=function(_0x115e99,_0x26c409,_0x4709ea){return db[_0xae3d('0x66')]['find']({'where':{'id':_0x115e99[_0xae3d('0x4a')]['id']}})[_0xae3d('0x28')](handleEntityNotFound(_0x26c409,null))[_0xae3d('0x28')](function(_0x5f1e9c){var _0x546991;if(_0x5f1e9c){_0x546991=squel[_0xae3d('0x67')]()[_0xae3d('0x68')]('cm_hopper')['fromQuery']([_0xae3d('0x69'),'scheduledAt',_0xae3d('0x6a'),'ListId','VoiceQueueId','createdAt','updatedAt'],squel[_0xae3d('0x6b')]()[_0xae3d('0x6c')]('ANY_VALUE(calleridnum)','phone')[_0xae3d('0x6c')](_0xae3d('0x6d'),_0xae3d('0x6e'))[_0xae3d('0x6c')](_0xae3d('0x6f'),_0xae3d('0x6a'))[_0xae3d('0x6c')]('ANY_VALUE(ListId)',_0xae3d('0x70'))[_0xae3d('0x6c')](_0xae3d('0x71'),_0xae3d('0x72'))[_0xae3d('0x6c')](_0xae3d('0x6d'),'createdAt')[_0xae3d('0x6c')](_0xae3d('0x6d'),'updatedAt')['from'](_0xae3d('0x73'))[_0xae3d('0x3d')]('VoiceQueueId\x20=\x20?',_0x115e99[_0xae3d('0x4a')]['id'][_0xae3d('0x74')]())[_0xae3d('0x3d')]('state\x20=\x20?',_0x115e99[_0xae3d('0x4f')][_0xae3d('0x75')]['toString']())['where'](_0xae3d('0x76'))[_0xae3d('0x3d')](_0xae3d('0x77'),squel['select']()[_0xae3d('0x6c')](_0xae3d('0x69'))['from'](_0xae3d('0x78'))[_0xae3d('0x3d')](_0xae3d('0x79'),_0x115e99['params']['id'][_0xae3d('0x74')]()))[_0xae3d('0x3d')](_0xae3d('0x77'),squel['select']()[_0xae3d('0x6c')]('calleridnum')[_0xae3d('0x7a')]('cm_hopper_final')['where'](_0xae3d('0x79'),_0x115e99['params']['id'][_0xae3d('0x74')]())[_0xae3d('0x3d')](_0xae3d('0x7b')))[_0xae3d('0x7c')]('ContactId'))[_0xae3d('0x74')]();return db[_0xae3d('0x52')][_0xae3d('0x34')](_0x546991);}return[];})[_0xae3d('0x28')](respondWithResult(_0x26c409,null))[_0xae3d('0x48')](handleError(_0x26c409,null));};exports[_0xae3d('0x7d')]=function(_0x1c5f67,_0xa083d0,_0x26e422){return db[_0xae3d('0x7e')][_0xae3d('0x4d')]({'where':{'id':_0x1c5f67[_0xae3d('0x4a')]['id']}})[_0xae3d('0x28')](handleEntityNotFound(_0xa083d0,null))[_0xae3d('0x28')](function(_0xf281f5){var _0x3261e5;if(_0xf281f5){_0x3261e5=squel[_0xae3d('0x67')]()['into'](_0xae3d('0x78'))[_0xae3d('0x7f')]([_0xae3d('0x69'),_0xae3d('0x6e'),_0xae3d('0x6a'),'ListId',_0xae3d('0x80'),_0xae3d('0x81'),_0xae3d('0x82')],squel[_0xae3d('0x6b')]()[_0xae3d('0x6c')](_0xae3d('0x83'),_0xae3d('0x69'))[_0xae3d('0x6c')]('NOW()',_0xae3d('0x6e'))[_0xae3d('0x6c')](_0xae3d('0x6f'),'ContactId')[_0xae3d('0x6c')](_0xae3d('0x84'),_0xae3d('0x70'))['field'](_0xae3d('0x85'),_0xae3d('0x80'))['field'](_0xae3d('0x6d'),'createdAt')[_0xae3d('0x6c')]('NOW()',_0xae3d('0x82'))[_0xae3d('0x7a')](_0xae3d('0x73'))[_0xae3d('0x3d')](_0xae3d('0x86'),_0x1c5f67['params']['id'][_0xae3d('0x74')]())[_0xae3d('0x3d')]('state\x20=\x20?',_0x1c5f67['body'][_0xae3d('0x75')][_0xae3d('0x74')]())[_0xae3d('0x3d')](_0xae3d('0x76'))['where'](_0xae3d('0x77'),squel[_0xae3d('0x6b')]()[_0xae3d('0x6c')]('phone')['from'](_0xae3d('0x78'))['where'](_0xae3d('0x86'),_0x1c5f67['params']['id'][_0xae3d('0x74')]()))[_0xae3d('0x3d')](_0xae3d('0x77'),squel[_0xae3d('0x6b')]()['field'](_0xae3d('0x87'))[_0xae3d('0x7a')](_0xae3d('0x73'))['where'](_0xae3d('0x86'),_0x1c5f67['params']['id'][_0xae3d('0x74')]())[_0xae3d('0x3d')]('state\x20=\x204'))['group'](_0xae3d('0x6a')))['toString']();return db['sequelize'][_0xae3d('0x34')](_0x3261e5);}return[];})['then'](respondWithResult(_0xa083d0,null))[_0xae3d('0x48')](handleError(_0xa083d0,null));};exports['checkContactHopper']=function(_0x31f606,_0x47aa7a,_0x27c0ff){return db['CmHopper'][_0xae3d('0x88')]({'where':{'VoiceQueueId':_0x31f606['body'][_0xae3d('0x72')],'CampaignId':_0x31f606[_0xae3d('0x4f')][_0xae3d('0x80')],'ContactId':_0x31f606[_0xae3d('0x4f')][_0xae3d('0x6a')]}})[_0xae3d('0x28')](handleEntityNotFound(_0x47aa7a,null))[_0xae3d('0x28')](function(_0x95c4ce){if(_0x95c4ce){return _0x95c4ce;}return null;})[_0xae3d('0x28')](respondWithResult(_0x47aa7a,null))['catch'](handleError(_0x47aa7a,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index b3e86f8..206d0ff 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 _0xc78a=['exports','define','cm_hopper_final','calleridnum','uniqueid','lodash','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./cmHopperFinal.attributes'];(function(_0x55ff79,_0x3d45e7){var _0x579067=function(_0x3650e4){while(--_0x3650e4){_0x55ff79['push'](_0x55ff79['shift']());}};_0x579067(++_0x3d45e7);}(_0xc78a,0x13d));var _0xac78=function(_0x30f87a,_0x2cce5a){_0x30f87a=_0x30f87a-0x0;var _0x3a8efc=_0xc78a[_0x30f87a];return _0x3a8efc;};'use strict';var _=require(_0xac78('0x0'));var util=require('util');var logger=require(_0xac78('0x1'))('api');var moment=require(_0xac78('0x2'));var BPromise=require('bluebird');var rp=require(_0xac78('0x3'));var fs=require('fs');var path=require(_0xac78('0x4'));var rimraf=require(_0xac78('0x5'));var config=require(_0xac78('0x6'));var attributes=require(_0xac78('0x7'));module[_0xac78('0x8')]=function(_0x4a4a94,_0x5bf10a){return _0x4a4a94[_0xac78('0x9')]('CmHopperFinal',attributes,{'tableName':_0xac78('0xa'),'paranoid':![],'indexes':[{'name':_0xac78('0xb'),'fields':[_0xac78('0xb')]},{'name':_0xac78('0xc'),'fields':[_0xac78('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd79f=['cm_hopper_final','calleridnum','uniqueid','lodash','util','moment','path','../../config/environment','./cmHopperFinal.attributes','exports','CmHopperFinal'];(function(_0x2075f8,_0x43fba4){var _0x5ed2f6=function(_0x53c4f7){while(--_0x53c4f7){_0x2075f8['push'](_0x2075f8['shift']());}};_0x5ed2f6(++_0x43fba4);}(_0xd79f,0x71));var _0xfd79=function(_0x6a2f2,_0x453534){_0x6a2f2=_0x6a2f2-0x0;var _0x121340=_0xd79f[_0x6a2f2];return _0x121340;};'use strict';var _=require(_0xfd79('0x0'));var util=require(_0xfd79('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xfd79('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xfd79('0x3'));var rimraf=require('rimraf');var config=require(_0xfd79('0x4'));var attributes=require(_0xfd79('0x5'));module[_0xfd79('0x6')]=function(_0x3d46fe,_0x5474f7){return _0x3d46fe['define'](_0xfd79('0x7'),attributes,{'tableName':_0xfd79('0x8'),'paranoid':![],'indexes':[{'name':_0xfd79('0x9'),'fields':[_0xfd79('0x9')]},{'name':_0xfd79('0xa'),'fields':[_0xfd79('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index f150ebc..b24694a 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.rpc.js +++ b/server/api/cmHopperFinal/cmHopperFinal.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['../../config/environment','jayson/promise','http','info','CmHopperFinal,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CmHopperFinal','create','body','options','raw','CreateCmHopperFinal','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x3416df,_0x517940){var _0x2b089b=function(_0x33b9ad){while(--_0x33b9ad){_0x3416df['push'](_0x3416df['shift']());}};_0x2b089b(++_0x517940);}(_0x7a54,0x106));var _0x47a5=function(_0xa5c3f6,_0x345645){_0xa5c3f6=_0xa5c3f6-0x0;var _0x55146b=_0x7a54[_0xa5c3f6];return _0x55146b;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateCmHopperFinal']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateCmHopperFinal',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _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(_0x3129c4,_0xe7d5af){var _0x329bf4=function(_0x208ffc){while(--_0x208ffc){_0x3129c4['push'](_0x3129c4['shift']());}};_0x329bf4(++_0xe7d5af);}(_0xb10b,0x12a));var _0xbb10=function(_0x47327a,_0xa744ab){_0x47327a=_0x47327a-0x0;var _0x258c4c=_0xb10b[_0x47327a];return _0x258c4c;};'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 401065a..ba6ba27 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 _0xc428=['/campaign/countAttributes/:id','moveContactsQueueCampaignHopperFinal','post','checkContactHopper','put','update','exports','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','index','/describe','/:id','show'];(function(_0x450e32,_0x1f4f6a){var _0x3041e0=function(_0x42bba5){while(--_0x42bba5){_0x450e32['push'](_0x450e32['shift']());}};_0x3041e0(++_0x1f4f6a);}(_0xc428,0x85));var _0x8c42=function(_0x507dd8,_0x3519e7){_0x507dd8=_0x507dd8-0x0;var _0x8e90b1=_0xc428[_0x507dd8];return _0x8e90b1;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x8c42('0x0'));var express=require(_0x8c42('0x1'));var router=express[_0x8c42('0x2')]();var fs_extra=require(_0x8c42('0x3'));var auth=require(_0x8c42('0x4'));var interaction=require(_0x8c42('0x5'));var config=require(_0x8c42('0x6'));var controller=require(_0x8c42('0x7'));router[_0x8c42('0x8')]('/',auth[_0x8c42('0x9')](),controller[_0x8c42('0xa')]);router[_0x8c42('0x8')](_0x8c42('0xb'),auth[_0x8c42('0x9')](),controller['describe']);router[_0x8c42('0x8')](_0x8c42('0xc'),auth['isAuthenticated'](),controller[_0x8c42('0xd')]);router[_0x8c42('0x8')]('/voice/queue/countAttributes/:id',auth[_0x8c42('0x9')](),controller['countContactsQueueCampaignHopperFinal']);router['get'](_0x8c42('0xe'),auth[_0x8c42('0x9')](),controller['countContactsIvrCampaignHopperFinal']);router['post']('/voice/queue/moveContacts/:id',auth[_0x8c42('0x9')](),controller[_0x8c42('0xf')]);router['post']('/voice/campaign/moveContacts/:id',auth['isAuthenticated'](),controller['moveContactsIvrCampaignHopperFinal']);router[_0x8c42('0x10')]('/checkContactHopper',auth[_0x8c42('0x9')](),controller[_0x8c42('0x11')]);router[_0x8c42('0x12')](_0x8c42('0xc'),auth[_0x8c42('0x9')](),controller[_0x8c42('0x13')]);module[_0x8c42('0x14')]=router; \ No newline at end of file +var _0x7ce8=['../../config/environment','./cmHopperFinal.controller','isAuthenticated','get','describe','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x4faa15,_0x26f2e1){var _0x2b7113=function(_0x415c8f){while(--_0x415c8f){_0x4faa15['push'](_0x4faa15['shift']());}};_0x2b7113(++_0x26f2e1);}(_0x7ce8,0x165));var _0x87ce=function(_0x3e961c,_0x5747e7){_0x3e961c=_0x3e961c-0x0;var _0x474f9c=_0x7ce8[_0x3e961c];return _0x474f9c;};'use strict';var multer=require(_0x87ce('0x0'));var util=require(_0x87ce('0x1'));var path=require(_0x87ce('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x87ce('0x3')]();var fs_extra=require(_0x87ce('0x4'));var auth=require(_0x87ce('0x5'));var interaction=require(_0x87ce('0x6'));var config=require(_0x87ce('0x7'));var controller=require(_0x87ce('0x8'));router['get']('/',auth[_0x87ce('0x9')](),controller['index']);router[_0x87ce('0xa')]('/describe',auth['isAuthenticated'](),controller[_0x87ce('0xb')]);router[_0x87ce('0xa')](_0x87ce('0xc'),auth[_0x87ce('0x9')](),controller[_0x87ce('0xd')]);router['get'](_0x87ce('0xe'),auth['isAuthenticated'](),controller[_0x87ce('0xf')]);router[_0x87ce('0xa')](_0x87ce('0x10'),auth[_0x87ce('0x9')](),controller[_0x87ce('0x11')]);router[_0x87ce('0x12')]('/voice/queue/moveContacts/:id',auth['isAuthenticated'](),controller[_0x87ce('0x13')]);router[_0x87ce('0x12')](_0x87ce('0x14'),auth['isAuthenticated'](),controller[_0x87ce('0x15')]);router['post'](_0x87ce('0x16'),auth[_0x87ce('0x9')](),controller[_0x87ce('0x17')]);router[_0x87ce('0x18')](_0x87ce('0xc'),auth[_0x87ce('0x9')](),controller['update']);module[_0x87ce('0x19')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 58a917a..b170a21 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 _0xeca9=['STRING','DATE','INTEGER','BOOLEAN','exports'];(function(_0x46edeb,_0x4cd458){var _0x1cc555=function(_0x5409cb){while(--_0x5409cb){_0x46edeb['push'](_0x46edeb['shift']());}};_0x1cc555(++_0x4cd458);}(_0xeca9,0x1da));var _0x9eca=function(_0x556707,_0xbc3a43){_0x556707=_0x556707-0x0;var _0x336815=_0xeca9[_0x556707];return _0x336815;};'use strict';var Sequelize=require('sequelize');module[_0x9eca('0x0')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x9eca('0x1')]},'scheduledat':{'type':Sequelize[_0x9eca('0x2')]},'countbusyretry':{'type':Sequelize[_0x9eca('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x9eca('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x9eca('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x9eca('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x9eca('0x1')]},'originatecalleridnum':{'type':Sequelize[_0x9eca('0x1')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x9eca('0x1')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x9eca('0x2')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x9eca('0x2')]},'endtime':{'type':Sequelize[_0x9eca('0x2')]},'ringtime':{'type':Sequelize[_0x9eca('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x9eca('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x9eca('0x1')]},'campaign':{'type':Sequelize[_0x9eca('0x1')]},'campaigntype':{'type':Sequelize[_0x9eca('0x1')]},'membername':{'type':Sequelize[_0x9eca('0x1')]},'reason':{'type':Sequelize[_0x9eca('0x1')]},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x9eca('0x4')],'defaultValue':![]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x9eca('0x1')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x9eca('0x2')]},'recallme':{'type':Sequelize[_0x9eca('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize[_0x9eca('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x9eca('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x9eca('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x9eca('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x9eca('0x3')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x9eca('0x1')]}}; \ No newline at end of file +var _0x5a51=['DATE','BOOLEAN','sequelize','exports','INTEGER','STRING'];(function(_0x20b208,_0x32a927){var _0x561628=function(_0x1016de){while(--_0x1016de){_0x20b208['push'](_0x20b208['shift']());}};_0x561628(++_0x32a927);}(_0x5a51,0x164));var _0x15a5=function(_0x2f6d48,_0x2d0183){_0x2f6d48=_0x2f6d48-0x0;var _0x1a6ab2=_0x5a51[_0x2f6d48];return _0x1a6ab2;};'use strict';var Sequelize=require(_0x15a5('0x0'));module[_0x15a5('0x1')]={'state':{'type':Sequelize[_0x15a5('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x15a5('0x3')]},'scheduledat':{'type':Sequelize[_0x15a5('0x4')]},'countbusyretry':{'type':Sequelize[_0x15a5('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x15a5('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x15a5('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x15a5('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x15a5('0x3')]},'originatecalleridname':{'type':Sequelize[_0x15a5('0x3')]},'calleridnum':{'type':Sequelize[_0x15a5('0x3')]},'calleridname':{'type':Sequelize[_0x15a5('0x3')]},'starttime':{'type':Sequelize[_0x15a5('0x4')]},'responsetime':{'type':Sequelize[_0x15a5('0x4')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x15a5('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x15a5('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x15a5('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x15a5('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x15a5('0x3')]},'campaign':{'type':Sequelize[_0x15a5('0x3')]},'campaigntype':{'type':Sequelize[_0x15a5('0x3')]},'membername':{'type':Sequelize[_0x15a5('0x3')]},'reason':{'type':Sequelize[_0x15a5('0x3')]},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize[_0x15a5('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x15a5('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x15a5('0x4')]},'recallme':{'type':Sequelize[_0x15a5('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x15a5('0x4')]},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x15a5('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x15a5('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x15a5('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x15a5('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x15a5('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index a146988..2a983da 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 _0x1208=['status','json','limit','count','offset','set','Content-Range','save','then','destroy','error','stack','name','send','index','CmHopperHistory','rawAttributes','fieldName','type','map','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','params','create','body','describe','uniqueid','find','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end'];(function(_0x21e607,_0x30c8ca){var _0x14912a=function(_0x2a595c){while(--_0x2a595c){_0x21e607['push'](_0x21e607['shift']());}};_0x14912a(++_0x30c8ca);}(_0x1208,0x1a1));var _0x8120=function(_0x57db19,_0x6b6722){_0x57db19=_0x57db19-0x0;var _0x1a410d=_0x1208[_0x57db19];return _0x1a410d;};'use strict';var emlformat=require(_0x8120('0x0'));var rimraf=require(_0x8120('0x1'));var zipdir=require(_0x8120('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8120('0x3'));var moment=require(_0x8120('0x4'));var BPromise=require(_0x8120('0x5'));var Mustache=require(_0x8120('0x6'));var util=require(_0x8120('0x7'));var path=require(_0x8120('0x8'));var sox=require(_0x8120('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8120('0xa'));var _=require(_0x8120('0xb'));var squel=require(_0x8120('0xc'));var crypto=require(_0x8120('0xd'));var jsforce=require(_0x8120('0xe'));var deskjs=require(_0x8120('0xf'));var toCsv=require('to-csv');var querystring=require(_0x8120('0x10'));var Papa=require(_0x8120('0x11'));var Redis=require(_0x8120('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x8120('0x13'));var as=require(_0x8120('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8120('0x15'))(_0x8120('0x16'));var utils=require(_0x8120('0x17'));var config=require(_0x8120('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x25c01b,_0x5602aa){_0x5602aa=_0x5602aa||0xcc;return function(_0x415139){if(_0x415139){return _0x25c01b[_0x8120('0x19')](_0x5602aa);}return _0x25c01b['status'](_0x5602aa)[_0x8120('0x1a')]();};}function respondWithResult(_0x204379,_0x319865){_0x319865=_0x319865||0xc8;return function(_0x119a7d){if(_0x119a7d){return _0x204379[_0x8120('0x1b')](_0x319865)[_0x8120('0x1c')](_0x119a7d);}};}function respondWithFilteredResult(_0x38d57b,_0x213fcb){return function(_0x28a348){if(_0x28a348){var _0x4d4a39=typeof _0x213fcb['offset']==='undefined'&&typeof _0x213fcb[_0x8120('0x1d')]==='undefined';var _0x2ff0f2=_0x28a348['count'];var _0x57e627=_0x4d4a39?0x0:_0x213fcb['offset'];var _0x21b0b6=_0x4d4a39?_0x28a348[_0x8120('0x1e')]:_0x213fcb[_0x8120('0x1f')]+_0x213fcb['limit'];var _0x2decab;if(_0x21b0b6>=_0x2ff0f2){_0x21b0b6=_0x2ff0f2;_0x2decab=0xc8;}else{_0x2decab=0xce;}_0x38d57b[_0x8120('0x1b')](_0x2decab);return _0x38d57b[_0x8120('0x20')](_0x8120('0x21'),_0x57e627+'-'+_0x21b0b6+'/'+_0x2ff0f2)[_0x8120('0x1c')](_0x28a348);}return null;};}function patchUpdates(_0x143360){return function(_0x273f41){try{jsonpatch['apply'](_0x273f41,_0x143360,!![]);}catch(_0x9d8d2a){return BPromise['reject'](_0x9d8d2a);}return _0x273f41[_0x8120('0x22')]();};}function saveUpdates(_0x157c09,_0x1dda4b){return function(_0x337199){if(_0x337199){return _0x337199['update'](_0x157c09)[_0x8120('0x23')](function(_0x472d51){return _0x472d51;});}return null;};}function removeEntity(_0x3e835b,_0x8cff34){return function(_0x4de468){if(_0x4de468){return _0x4de468[_0x8120('0x24')]()[_0x8120('0x23')](function(){_0x3e835b[_0x8120('0x1b')](0xcc)[_0x8120('0x1a')]();});}};}function handleEntityNotFound(_0x3ecf82,_0x5879c0){return function(_0x289e8){if(!_0x289e8){_0x3ecf82['sendStatus'](0x194);}return _0x289e8;};}function handleError(_0x42bc31,_0x5992b0){_0x5992b0=_0x5992b0||0x1f4;return function(_0x2f5019){logger[_0x8120('0x25')](_0x2f5019[_0x8120('0x26')]);if(_0x2f5019['name']){delete _0x2f5019[_0x8120('0x27')];}_0x42bc31[_0x8120('0x1b')](_0x5992b0)[_0x8120('0x28')](_0x2f5019);};}exports[_0x8120('0x29')]=function(_0x221200,_0x429167){var _0x17e684={},_0x2c5ce7={},_0x4e68a3={'count':0x0,'rows':[]};var _0x17069d=_['map'](db[_0x8120('0x2a')][_0x8120('0x2b')],function(_0x5cbcb9){return{'name':_0x5cbcb9[_0x8120('0x2c')],'type':_0x5cbcb9[_0x8120('0x2d')]['key']};});_0x2c5ce7['model']=_[_0x8120('0x2e')](_0x17069d,_0x8120('0x27'));_0x2c5ce7[_0x8120('0x2f')]=_[_0x8120('0x30')](_0x221200[_0x8120('0x2f')]);_0x2c5ce7[_0x8120('0x31')]=_['intersection'](_0x2c5ce7[_0x8120('0x32')],_0x2c5ce7['query']);_0x17e684[_0x8120('0x33')]=_[_0x8120('0x34')](_0x2c5ce7[_0x8120('0x32')],qs[_0x8120('0x35')](_0x221200['query'][_0x8120('0x35')]));_0x17e684['attributes']=_0x17e684['attributes'][_0x8120('0x36')]?_0x17e684['attributes']:_0x2c5ce7[_0x8120('0x32')];if(!_0x221200['query'][_0x8120('0x37')]('nolimit')){_0x17e684['limit']=qs['limit'](_0x221200[_0x8120('0x2f')][_0x8120('0x1d')]);_0x17e684[_0x8120('0x1f')]=qs[_0x8120('0x1f')](_0x221200[_0x8120('0x2f')][_0x8120('0x1f')]);}_0x17e684['order']=qs[_0x8120('0x38')](_0x221200[_0x8120('0x2f')][_0x8120('0x38')]);_0x17e684[_0x8120('0x39')]=qs['filters'](_[_0x8120('0x3a')](_0x221200[_0x8120('0x2f')],_0x2c5ce7[_0x8120('0x31')]),_0x17069d);if(_0x221200['query']['filter']){_0x17e684['where']=_[_0x8120('0x3b')](_0x17e684[_0x8120('0x39')],{'$or':_[_0x8120('0x2e')](_0x17069d,function(_0x5ceef7){if(_0x5ceef7['type']!==_0x8120('0x3c')){var _0x42fa11={};_0x42fa11[_0x5ceef7[_0x8120('0x27')]]={'$like':'%'+_0x221200[_0x8120('0x2f')][_0x8120('0x3d')]+'%'};return _0x42fa11;}})});}_0x17e684=_[_0x8120('0x3b')]({},_0x17e684,_0x221200[_0x8120('0x3e')]);var _0xe648e8={'where':_0x17e684[_0x8120('0x39')]};return db[_0x8120('0x2a')][_0x8120('0x1e')](_0xe648e8)[_0x8120('0x23')](function(_0x12c0e3){_0x4e68a3['count']=_0x12c0e3;if(_0x221200['query'][_0x8120('0x3f')]){_0x17e684[_0x8120('0x40')]=[{'all':!![]}];}return db[_0x8120('0x2a')][_0x8120('0x41')](_0x17e684);})[_0x8120('0x23')](function(_0x133e8d){_0x4e68a3['rows']=_0x133e8d;return _0x4e68a3;})[_0x8120('0x23')](respondWithFilteredResult(_0x429167,_0x17e684))[_0x8120('0x42')](handleError(_0x429167,null));};exports[_0x8120('0x43')]=function(_0x5afc3b,_0x8f6267){var _0xe5f909={'raw':!![],'where':{'id':_0x5afc3b[_0x8120('0x44')]['id']}},_0x170792={};_0x170792[_0x8120('0x32')]=_[_0x8120('0x30')](db[_0x8120('0x2a')]['rawAttributes']);_0x170792['query']=_['keys'](_0x5afc3b[_0x8120('0x2f')]);_0x170792[_0x8120('0x31')]=_[_0x8120('0x34')](_0x170792[_0x8120('0x32')],_0x170792[_0x8120('0x2f')]);_0xe5f909[_0x8120('0x33')]=_['intersection'](_0x170792['model'],qs[_0x8120('0x35')](_0x5afc3b[_0x8120('0x2f')][_0x8120('0x35')]));_0xe5f909[_0x8120('0x33')]=_0xe5f909['attributes']['length']?_0xe5f909[_0x8120('0x33')]:_0x170792[_0x8120('0x32')];if(_0x5afc3b[_0x8120('0x2f')][_0x8120('0x3f')]){_0xe5f909[_0x8120('0x40')]=[{'all':!![]}];}_0xe5f909=_[_0x8120('0x3b')]({},_0xe5f909,_0x5afc3b[_0x8120('0x3e')]);return db[_0x8120('0x2a')]['find'](_0xe5f909)['then'](handleEntityNotFound(_0x8f6267,null))[_0x8120('0x23')](respondWithResult(_0x8f6267,null))['catch'](handleError(_0x8f6267,null));};exports[_0x8120('0x45')]=function(_0x1d99a6,_0x32f8db){return db[_0x8120('0x2a')][_0x8120('0x45')](_0x1d99a6[_0x8120('0x46')],{})[_0x8120('0x23')](respondWithResult(_0x32f8db,0xc9))[_0x8120('0x42')](handleError(_0x32f8db,null));};exports['describe']=function(_0x5cc7b8,_0x5df4b7){return db[_0x8120('0x2a')][_0x8120('0x47')]()['then'](respondWithResult(_0x5df4b7,null))[_0x8120('0x42')](handleError(_0x5df4b7,null));};exports['update']=function(_0x5c1048,_0x2e3f3e){if(_0x5c1048[_0x8120('0x46')]['uniqueid']){delete _0x5c1048['body'][_0x8120('0x48')];}return db[_0x8120('0x2a')][_0x8120('0x49')]({'where':{'uniqueid':_0x5c1048[_0x8120('0x44')]['id']}})[_0x8120('0x23')](handleEntityNotFound(_0x2e3f3e,null))[_0x8120('0x23')](saveUpdates(_0x5c1048[_0x8120('0x46')],null))[_0x8120('0x23')](respondWithResult(_0x2e3f3e,null))[_0x8120('0x42')](handleError(_0x2e3f3e,null));}; \ No newline at end of file +var _0x39a9=['count','set','Content-Range','apply','reject','update','then','end','sendStatus','error','stack','send','CmHopperHistory','rawAttributes','fieldName','type','key','model','name','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','map','VIRTUAL','includeAll','include','rows','catch','show','params','options','find','create','body','describe','uniqueid','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','status','json','offset','limit','undefined'];(function(_0x65c50e,_0x1aa926){var _0x4573e7=function(_0x5bc049){while(--_0x5bc049){_0x65c50e['push'](_0x65c50e['shift']());}};_0x4573e7(++_0x1aa926);}(_0x39a9,0x1aa));var _0x939a=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x39a9[_0x4a9fb1];return _0x348672;};'use strict';var emlformat=require(_0x939a('0x0'));var rimraf=require(_0x939a('0x1'));var zipdir=require(_0x939a('0x2'));var jsonpatch=require(_0x939a('0x3'));var rp=require('request-promise');var moment=require(_0x939a('0x4'));var BPromise=require(_0x939a('0x5'));var Mustache=require(_0x939a('0x6'));var util=require(_0x939a('0x7'));var path=require(_0x939a('0x8'));var sox=require(_0x939a('0x9'));var csv=require(_0x939a('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x939a('0xb'));var _=require(_0x939a('0xc'));var squel=require(_0x939a('0xd'));var crypto=require(_0x939a('0xe'));var jsforce=require(_0x939a('0xf'));var deskjs=require(_0x939a('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x939a('0x11'));var Redis=require(_0x939a('0x12'));var authService=require(_0x939a('0x13'));var qs=require(_0x939a('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x939a('0x15'))('api');var utils=require(_0x939a('0x16'));var config=require(_0x939a('0x17'));var licenseUtil=require(_0x939a('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5b4b67,_0x53efe6){_0x53efe6=_0x53efe6||0xcc;return function(_0x3d3d98){if(_0x3d3d98){return _0x5b4b67['sendStatus'](_0x53efe6);}return _0x5b4b67[_0x939a('0x19')](_0x53efe6)['end']();};}function respondWithResult(_0x2ca977,_0x2eaae0){_0x2eaae0=_0x2eaae0||0xc8;return function(_0x423aea){if(_0x423aea){return _0x2ca977['status'](_0x2eaae0)[_0x939a('0x1a')](_0x423aea);}};}function respondWithFilteredResult(_0x29a005,_0x3fe936){return function(_0x46a30c){if(_0x46a30c){var _0x27e486=typeof _0x3fe936[_0x939a('0x1b')]==='undefined'&&typeof _0x3fe936[_0x939a('0x1c')]===_0x939a('0x1d');var _0x97e393=_0x46a30c['count'];var _0x53952b=_0x27e486?0x0:_0x3fe936['offset'];var _0x32f186=_0x27e486?_0x46a30c[_0x939a('0x1e')]:_0x3fe936['offset']+_0x3fe936[_0x939a('0x1c')];var _0x10035c;if(_0x32f186>=_0x97e393){_0x32f186=_0x97e393;_0x10035c=0xc8;}else{_0x10035c=0xce;}_0x29a005[_0x939a('0x19')](_0x10035c);return _0x29a005[_0x939a('0x1f')](_0x939a('0x20'),_0x53952b+'-'+_0x32f186+'/'+_0x97e393)[_0x939a('0x1a')](_0x46a30c);}return null;};}function patchUpdates(_0x4b711b){return function(_0x7c2f5c){try{jsonpatch[_0x939a('0x21')](_0x7c2f5c,_0x4b711b,!![]);}catch(_0x4f85db){return BPromise[_0x939a('0x22')](_0x4f85db);}return _0x7c2f5c['save']();};}function saveUpdates(_0x5c836,_0x38e3c7){return function(_0x5abf71){if(_0x5abf71){return _0x5abf71[_0x939a('0x23')](_0x5c836)['then'](function(_0x56b871){return _0x56b871;});}return null;};}function removeEntity(_0x1b42c0,_0x22c098){return function(_0x2d01cf){if(_0x2d01cf){return _0x2d01cf['destroy']()[_0x939a('0x24')](function(){_0x1b42c0[_0x939a('0x19')](0xcc)[_0x939a('0x25')]();});}};}function handleEntityNotFound(_0x177609,_0xd7c382){return function(_0x111734){if(!_0x111734){_0x177609[_0x939a('0x26')](0x194);}return _0x111734;};}function handleError(_0xde99ba,_0x41b604){_0x41b604=_0x41b604||0x1f4;return function(_0x5e694b){logger[_0x939a('0x27')](_0x5e694b[_0x939a('0x28')]);if(_0x5e694b['name']){delete _0x5e694b['name'];}_0xde99ba['status'](_0x41b604)[_0x939a('0x29')](_0x5e694b);};}exports['index']=function(_0x8e8a66,_0x2c9d6e){var _0x23026d={},_0x11c457={},_0x53a61a={'count':0x0,'rows':[]};var _0x4b2dc0=_['map'](db[_0x939a('0x2a')][_0x939a('0x2b')],function(_0x255c8b){return{'name':_0x255c8b[_0x939a('0x2c')],'type':_0x255c8b[_0x939a('0x2d')][_0x939a('0x2e')]};});_0x11c457[_0x939a('0x2f')]=_['map'](_0x4b2dc0,_0x939a('0x30'));_0x11c457[_0x939a('0x31')]=_[_0x939a('0x32')](_0x8e8a66[_0x939a('0x31')]);_0x11c457['filters']=_[_0x939a('0x33')](_0x11c457[_0x939a('0x2f')],_0x11c457[_0x939a('0x31')]);_0x23026d[_0x939a('0x34')]=_[_0x939a('0x33')](_0x11c457[_0x939a('0x2f')],qs[_0x939a('0x35')](_0x8e8a66[_0x939a('0x31')][_0x939a('0x35')]));_0x23026d['attributes']=_0x23026d['attributes']['length']?_0x23026d['attributes']:_0x11c457['model'];if(!_0x8e8a66[_0x939a('0x31')][_0x939a('0x36')](_0x939a('0x37'))){_0x23026d[_0x939a('0x1c')]=qs[_0x939a('0x1c')](_0x8e8a66[_0x939a('0x31')][_0x939a('0x1c')]);_0x23026d[_0x939a('0x1b')]=qs[_0x939a('0x1b')](_0x8e8a66[_0x939a('0x31')][_0x939a('0x1b')]);}_0x23026d[_0x939a('0x38')]=qs[_0x939a('0x39')](_0x8e8a66['query'][_0x939a('0x39')]);_0x23026d[_0x939a('0x3a')]=qs[_0x939a('0x3b')](_['pick'](_0x8e8a66['query'],_0x11c457[_0x939a('0x3b')]),_0x4b2dc0);if(_0x8e8a66['query'][_0x939a('0x3c')]){_0x23026d[_0x939a('0x3a')]=_[_0x939a('0x3d')](_0x23026d['where'],{'$or':_[_0x939a('0x3e')](_0x4b2dc0,function(_0xa934f7){if(_0xa934f7['type']!==_0x939a('0x3f')){var _0x2b8c4f={};_0x2b8c4f[_0xa934f7['name']]={'$like':'%'+_0x8e8a66[_0x939a('0x31')][_0x939a('0x3c')]+'%'};return _0x2b8c4f;}})});}_0x23026d=_[_0x939a('0x3d')]({},_0x23026d,_0x8e8a66['options']);var _0x2aa281={'where':_0x23026d['where']};return db['CmHopperHistory'][_0x939a('0x1e')](_0x2aa281)[_0x939a('0x24')](function(_0x39034b){_0x53a61a[_0x939a('0x1e')]=_0x39034b;if(_0x8e8a66[_0x939a('0x31')][_0x939a('0x40')]){_0x23026d[_0x939a('0x41')]=[{'all':!![]}];}return db[_0x939a('0x2a')]['findAll'](_0x23026d);})['then'](function(_0x14170c){_0x53a61a[_0x939a('0x42')]=_0x14170c;return _0x53a61a;})[_0x939a('0x24')](respondWithFilteredResult(_0x2c9d6e,_0x23026d))[_0x939a('0x43')](handleError(_0x2c9d6e,null));};exports[_0x939a('0x44')]=function(_0x37afbb,_0x33a644){var _0x176920={'raw':!![],'where':{'id':_0x37afbb[_0x939a('0x45')]['id']}},_0x50c5b5={};_0x50c5b5[_0x939a('0x2f')]=_[_0x939a('0x32')](db[_0x939a('0x2a')][_0x939a('0x2b')]);_0x50c5b5[_0x939a('0x31')]=_[_0x939a('0x32')](_0x37afbb['query']);_0x50c5b5[_0x939a('0x3b')]=_['intersection'](_0x50c5b5[_0x939a('0x2f')],_0x50c5b5[_0x939a('0x31')]);_0x176920[_0x939a('0x34')]=_[_0x939a('0x33')](_0x50c5b5[_0x939a('0x2f')],qs[_0x939a('0x35')](_0x37afbb[_0x939a('0x31')][_0x939a('0x35')]));_0x176920[_0x939a('0x34')]=_0x176920['attributes']['length']?_0x176920['attributes']:_0x50c5b5['model'];if(_0x37afbb['query'][_0x939a('0x40')]){_0x176920[_0x939a('0x41')]=[{'all':!![]}];}_0x176920=_[_0x939a('0x3d')]({},_0x176920,_0x37afbb[_0x939a('0x46')]);return db[_0x939a('0x2a')][_0x939a('0x47')](_0x176920)['then'](handleEntityNotFound(_0x33a644,null))[_0x939a('0x24')](respondWithResult(_0x33a644,null))[_0x939a('0x43')](handleError(_0x33a644,null));};exports[_0x939a('0x48')]=function(_0x427fa3,_0x5ce455){return db[_0x939a('0x2a')][_0x939a('0x48')](_0x427fa3[_0x939a('0x49')],{})[_0x939a('0x24')](respondWithResult(_0x5ce455,0xc9))[_0x939a('0x43')](handleError(_0x5ce455,null));};exports[_0x939a('0x4a')]=function(_0x37fa71,_0x267416){return db[_0x939a('0x2a')][_0x939a('0x4a')]()[_0x939a('0x24')](respondWithResult(_0x267416,null))['catch'](handleError(_0x267416,null));};exports[_0x939a('0x23')]=function(_0x3352ad,_0x222f0c){if(_0x3352ad[_0x939a('0x49')]['uniqueid']){delete _0x3352ad[_0x939a('0x49')][_0x939a('0x4b')];}return db['CmHopperHistory'][_0x939a('0x47')]({'where':{'uniqueid':_0x3352ad['params']['id']}})[_0x939a('0x24')](handleEntityNotFound(_0x222f0c,null))[_0x939a('0x24')](saveUpdates(_0x3352ad['body'],null))[_0x939a('0x24')](respondWithResult(_0x222f0c,null))['catch'](handleError(_0x222f0c,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index a02269b..b573e29 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 _0x9f37=['uniqueid','lodash','util','api','request-promise','path','rimraf','./cmHopperHistory.attributes','exports','define','CmHopperHistory','cm_hopper_history','endtime'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0x9f37,0xd1));var _0x79f3=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x9f37[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x79f3('0x0'));var util=require(_0x79f3('0x1'));var logger=require('../../config/logger')(_0x79f3('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x79f3('0x3'));var fs=require('fs');var path=require(_0x79f3('0x4'));var rimraf=require(_0x79f3('0x5'));var config=require('../../config/environment');var attributes=require(_0x79f3('0x6'));module[_0x79f3('0x7')]=function(_0x594d87,_0x5db84b){return _0x594d87[_0x79f3('0x8')](_0x79f3('0x9'),attributes,{'tableName':_0x79f3('0xa'),'paranoid':![],'indexes':[{'name':_0x79f3('0xb'),'fields':['endtime']},{'name':_0x79f3('0xc'),'fields':[_0x79f3('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2542=['uniqueid','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./cmHopperHistory.attributes','exports','define','CmHopperHistory','cm_hopper_history','endtime'];(function(_0x110fda,_0x313727){var _0x5ca9e2=function(_0x350053){while(--_0x350053){_0x110fda['push'](_0x110fda['shift']());}};_0x5ca9e2(++_0x313727);}(_0x2542,0x169));var _0x2254=function(_0x1407e4,_0x549875){_0x1407e4=_0x1407e4-0x0;var _0xa5b40b=_0x2542[_0x1407e4];return _0xa5b40b;};'use strict';var _=require(_0x2254('0x0'));var util=require(_0x2254('0x1'));var logger=require(_0x2254('0x2'))(_0x2254('0x3'));var moment=require('moment');var BPromise=require(_0x2254('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2254('0x5'));var rimraf=require(_0x2254('0x6'));var config=require(_0x2254('0x7'));var attributes=require(_0x2254('0x8'));module[_0x2254('0x9')]=function(_0x508183,_0x19ad3c){return _0x508183[_0x2254('0xa')](_0x2254('0xb'),attributes,{'tableName':_0x2254('0xc'),'paranoid':![],'indexes':[{'name':_0x2254('0xd'),'fields':[_0x2254('0xd')]},{'name':_0x2254('0xe'),'fields':[_0x2254('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 8bdb243..ea13b1a 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 _0xa9be=['message','result','catch','CreateCmHopperHistory','CmHopperHistory','create','body','options','stringify','AvgHandleTime','raw','where','sequelize','COUNT','col','predictiveIntervalTotalCalls','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','literal','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','outboundNoAnswerCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundUnknownCallsDay','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','findAll','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','error','code'];(function(_0x2ba17d,_0x168f47){var _0x142eef=function(_0x4f1f3d){while(--_0x4f1f3d){_0x2ba17d['push'](_0x2ba17d['shift']());}};_0x142eef(++_0x168f47);}(_0xa9be,0x1eb));var _0xea9b=function(_0x4b8744,_0x2b0446){_0x4b8744=_0x4b8744-0x0;var _0x2699a3=_0xa9be[_0x4b8744];return _0x2699a3;};'use strict';var _=require(_0xea9b('0x0'));var util=require(_0xea9b('0x1'));var moment=require(_0xea9b('0x2'));var BPromise=require(_0xea9b('0x3'));var rs=require(_0xea9b('0x4'));var fs=require('fs');var Redis=require(_0xea9b('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xea9b('0x6'));var logger=require(_0xea9b('0x7'))(_0xea9b('0x8'));var config=require(_0xea9b('0x9'));var jayson=require(_0xea9b('0xa'));var client=jayson[_0xea9b('0xb')][_0xea9b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4f1c0e,_0x10e567,_0x1197c1){return new BPromise(function(_0x4f513f,_0x156dfb){return client['request'](_0x4f1c0e,_0x1197c1)[_0xea9b('0xd')](function(_0x2bacbc){logger[_0xea9b('0xe')](_0xea9b('0xf'),_0x10e567,_0xea9b('0x10'));logger[_0xea9b('0x11')]('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0x10e567,_0xea9b('0x10'),JSON['stringify'](_0x2bacbc));if(_0x2bacbc[_0xea9b('0x12')]){if(_0x2bacbc[_0xea9b('0x12')][_0xea9b('0x13')]===0x1f4){logger[_0xea9b('0x12')](_0xea9b('0xf'),_0x10e567,_0x2bacbc[_0xea9b('0x12')]['message']);return _0x156dfb(_0x2bacbc[_0xea9b('0x12')][_0xea9b('0x14')]);}logger[_0xea9b('0x12')](_0xea9b('0xf'),_0x10e567,_0x2bacbc[_0xea9b('0x12')][_0xea9b('0x14')]);return _0x4f513f(_0x2bacbc['error'][_0xea9b('0x14')]);}else{logger[_0xea9b('0xe')](_0xea9b('0xf'),_0x10e567,'request\x20sent');_0x4f513f(_0x2bacbc[_0xea9b('0x15')][_0xea9b('0x14')]);}})[_0xea9b('0x16')](function(_0x1c2dd8){logger[_0xea9b('0x12')](_0xea9b('0xf'),_0x10e567,_0x1c2dd8);_0x156dfb(_0x1c2dd8);});});}exports[_0xea9b('0x17')]=function(_0x1de758){var _0x49dd19=this;return new Promise(function(_0x4c1b81,_0xc033e0){return db[_0xea9b('0x18')][_0xea9b('0x19')](_0x1de758[_0xea9b('0x1a')],{'raw':_0x1de758[_0xea9b('0x1b')]?_0x1de758[_0xea9b('0x1b')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x20f52f){logger[_0xea9b('0xe')](_0xea9b('0x17'),_0x1de758);logger[_0xea9b('0x11')](_0xea9b('0x17'),_0x1de758,JSON[_0xea9b('0x1c')](_0x20f52f));_0x4c1b81(_0x20f52f);})['catch'](function(_0x419586){logger['error'](_0xea9b('0x17'),_0x419586[_0xea9b('0x14')],_0x1de758);_0xc033e0(_0x49dd19[_0xea9b('0x12')](0x1f4,_0x419586[_0xea9b('0x14')]));});});};exports[_0xea9b('0x1d')]=function(_0x5037dc){var _0x4e556d=this;return new Promise(function(_0x3fb675,_0x6f82cf){return db[_0xea9b('0x18')]['findAll']({'raw':_0x5037dc['options']?_0x5037dc[_0xea9b('0x1b')][_0xea9b('0x1e')]===undefined?!![]:![]:!![],'where':_0x5037dc[_0xea9b('0x1b')]?_0x5037dc[_0xea9b('0x1b')][_0xea9b('0x1f')]||null:null,'attributes':[[db[_0xea9b('0x20')]['fn'](_0xea9b('0x21'),db[_0xea9b('0x20')][_0xea9b('0x22')]('id')),_0xea9b('0x23')],[db[_0xea9b('0x20')]['fn'](_0xea9b('0x21'),db[_0xea9b('0x20')]['fn']('IF',db[_0xea9b('0x20')]['literal'](_0xea9b('0x24')))),_0xea9b('0x25')],[db[_0xea9b('0x20')]['fn'](_0xea9b('0x21'),db['sequelize']['fn']('IF',db['sequelize'][_0xea9b('0x26')]('`state`\x20=\x2010,\x201,\x20null'))),'predictiveIntervalDroppedCallsTimeout'],[db[_0xea9b('0x20')]['fn']('COUNT',db[_0xea9b('0x20')]['fn']('IF',db['sequelize'][_0xea9b('0x26')](_0xea9b('0x27')))),_0xea9b('0x28')],[db[_0xea9b('0x20')]['fn'](_0xea9b('0x29'),db[_0xea9b('0x20')]['fn']('IF',db['sequelize'][_0xea9b('0x26')](_0xea9b('0x2a')))),_0xea9b('0x2b')],[db[_0xea9b('0x20')]['fn'](_0xea9b('0x29'),db[_0xea9b('0x20')]['fn']('IF',db['sequelize']['literal'](_0xea9b('0x2c')))),_0xea9b('0x2d')]]})[_0xea9b('0xd')](function(_0x3487c7){logger[_0xea9b('0xe')](_0xea9b('0x1d'),_0x5037dc);logger[_0xea9b('0x11')](_0xea9b('0x1d'),_0x5037dc,JSON['stringify'](_0x3487c7));_0x3fb675(_0x3487c7);})[_0xea9b('0x16')](function(_0x38f012){logger['error'](_0xea9b('0x1d'),_0x38f012[_0xea9b('0x14')],_0x5037dc);_0x6f82cf(_0x4e556d[_0xea9b('0x12')](0x1f4,_0x38f012[_0xea9b('0x14')]));});});};exports[_0xea9b('0x2e')]=function(_0x28c888){var _0x119565=this;return new Promise(function(_0x12e93e,_0x2ad5b4){return db[_0xea9b('0x18')]['findAll']({'raw':_0x28c888[_0xea9b('0x1b')]?_0x28c888[_0xea9b('0x1b')][_0xea9b('0x1e')]===undefined?!![]:![]:!![],'where':_0x28c888[_0xea9b('0x1b')]?_0x28c888[_0xea9b('0x1b')][_0xea9b('0x1f')]||null:null,'attributes':[[_0xea9b('0x2f'),_0xea9b('0x30')],[db[_0xea9b('0x20')]['fn'](_0xea9b('0x21'),db[_0xea9b('0x20')]['fn']('IF',db[_0xea9b('0x20')][_0xea9b('0x26')](_0xea9b('0x31')))),_0xea9b('0x32')],[db[_0xea9b('0x20')]['fn'](_0xea9b('0x21'),db[_0xea9b('0x20')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x203,\x201,\x20null'))),_0xea9b('0x33')],[db[_0xea9b('0x20')]['fn'](_0xea9b('0x21'),db[_0xea9b('0x20')]['fn']('IF',db[_0xea9b('0x20')]['literal']('`state`\x20=\x204,\x201,\x20null'))),_0xea9b('0x34')],[db['sequelize']['fn']('COUNT',db[_0xea9b('0x20')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x205,\x201,\x20null'))),_0xea9b('0x35')],[db['sequelize']['fn'](_0xea9b('0x21'),db[_0xea9b('0x20')]['fn']('IF',db[_0xea9b('0x20')][_0xea9b('0x26')](_0xea9b('0x36')))),_0xea9b('0x37')],[db[_0xea9b('0x20')]['fn'](_0xea9b('0x21'),db[_0xea9b('0x20')]['fn']('IF',db[_0xea9b('0x20')][_0xea9b('0x26')](_0xea9b('0x38')))),_0xea9b('0x39')],[db[_0xea9b('0x20')]['fn'](_0xea9b('0x21'),db[_0xea9b('0x20')]['fn']('IF',db['sequelize'][_0xea9b('0x26')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0xea9b('0x3a')],[db[_0xea9b('0x20')]['fn'](_0xea9b('0x21'),db[_0xea9b('0x20')]['fn']('IF',db['sequelize'][_0xea9b('0x26')]('`state`\x20=\x2012,\x201,\x20null'))),_0xea9b('0x3b')],[db[_0xea9b('0x20')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xea9b('0x20')][_0xea9b('0x26')]('`state`\x20=\x2013,\x201,\x20null'))),_0xea9b('0x3c')],[db[_0xea9b('0x20')]['fn']('COUNT',db[_0xea9b('0x20')]['fn']('IF',db[_0xea9b('0x20')][_0xea9b('0x26')](_0xea9b('0x3d')))),_0xea9b('0x3e')],[db['sequelize']['fn'](_0xea9b('0x21'),db[_0xea9b('0x20')]['fn']('IF',db[_0xea9b('0x20')][_0xea9b('0x26')](_0xea9b('0x3f')))),_0xea9b('0x40')],[db[_0xea9b('0x20')]['fn']('COUNT',db[_0xea9b('0x20')]['fn']('IF',db[_0xea9b('0x20')][_0xea9b('0x26')](_0xea9b('0x41')))),_0xea9b('0x42')],[db[_0xea9b('0x20')]['fn']('COUNT',db[_0xea9b('0x20')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2020,\x201,\x20null'))),_0xea9b('0x40')],[db[_0xea9b('0x20')]['fn'](_0xea9b('0x21'),db[_0xea9b('0x20')]['fn']('IF',db[_0xea9b('0x20')]['literal'](_0xea9b('0x43')))),_0xea9b('0x44')]],'group':[_0xea9b('0x2f')]})[_0xea9b('0xd')](function(_0x56ad5f){logger[_0xea9b('0xe')](_0xea9b('0x2e'),_0x28c888);logger[_0xea9b('0x11')]('GetVoiceQueueHopperHistory',_0x28c888,JSON['stringify'](_0x56ad5f));_0x12e93e(_0x56ad5f);})[_0xea9b('0x16')](function(_0x399072){logger[_0xea9b('0x12')]('GetVoiceQueueHopperHistory',_0x399072[_0xea9b('0x14')],_0x28c888);_0x2ad5b4(_0x119565[_0xea9b('0x12')](0x1f4,_0x399072[_0xea9b('0x14')]));});});};exports[_0xea9b('0x45')]=function(_0x988bc){var _0x1ac804=this;return new Promise(function(_0x51fb81,_0x153b03){return db[_0xea9b('0x18')][_0xea9b('0x46')]({'raw':_0x988bc['options']?_0x988bc[_0xea9b('0x1b')][_0xea9b('0x1e')]===undefined?!![]:![]:!![],'where':_0x988bc[_0xea9b('0x1b')]?_0x988bc[_0xea9b('0x1b')][_0xea9b('0x1f')]||null:null,'attributes':[['campaign',_0xea9b('0x30')],[db[_0xea9b('0x20')]['fn'](_0xea9b('0x21'),db[_0xea9b('0x20')][_0xea9b('0x22')]('id')),_0xea9b('0x47')],[db[_0xea9b('0x20')]['fn'](_0xea9b('0x21'),db[_0xea9b('0x20')]['fn']('IF',db[_0xea9b('0x20')]['literal']('`state`\x20=\x204,\x201,\x20null'))),_0xea9b('0x48')]],'group':[_0xea9b('0x2f')]})[_0xea9b('0xd')](function(_0x551d94){logger[_0xea9b('0xe')](_0xea9b('0x45'),_0x988bc);logger[_0xea9b('0x11')]('GetCampaignHopperHistory',_0x988bc,JSON[_0xea9b('0x1c')](_0x551d94));_0x51fb81(_0x551d94);})[_0xea9b('0x16')](function(_0x31746a){logger[_0xea9b('0x12')](_0xea9b('0x45'),_0x31746a[_0xea9b('0x14')],_0x988bc);_0x153b03(_0x1ac804[_0xea9b('0x12')](0x1f4,_0x31746a['message']));});});}; \ No newline at end of file +var _0xfd6f=['outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','catch','GetCampaignHopperHistory','name','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','CmHopperHistory,\x20%s,\x20%s','debug','stringify','error','message','request\x20sent','CreateCmHopperHistory','CmHopperHistory','create','options','AvgHandleTime','findAll','raw','where','sequelize','col','predictiveIntervalTotalCalls','COUNT','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','GetVoiceQueueHopperHistory','campaign','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','`state`\x20=\x2014,\x201,\x20null'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfd6f,0x19d));var _0xffd6=function(_0x5b1760,_0x1e4494){_0x5b1760=_0x5b1760-0x0;var _0x41be80=_0xfd6f[_0x5b1760];return _0x41be80;};'use strict';var _=require(_0xffd6('0x0'));var util=require(_0xffd6('0x1'));var moment=require(_0xffd6('0x2'));var BPromise=require(_0xffd6('0x3'));var rs=require(_0xffd6('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xffd6('0x5'))['db'];var utils=require(_0xffd6('0x6'));var logger=require(_0xffd6('0x7'))(_0xffd6('0x8'));var config=require('../../config/environment');var jayson=require(_0xffd6('0x9'));var client=jayson[_0xffd6('0xa')][_0xffd6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x10b335,_0x5c19ee,_0x3f9538){return new BPromise(function(_0x534a1b,_0x54d793){return client['request'](_0x10b335,_0x3f9538)[_0xffd6('0xc')](function(_0x4267fc){logger[_0xffd6('0xd')](_0xffd6('0xe'),_0x5c19ee,'request\x20sent');logger[_0xffd6('0xf')]('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0x5c19ee,'request\x20sent',JSON[_0xffd6('0x10')](_0x4267fc));if(_0x4267fc[_0xffd6('0x11')]){if(_0x4267fc[_0xffd6('0x11')]['code']===0x1f4){logger[_0xffd6('0x11')](_0xffd6('0xe'),_0x5c19ee,_0x4267fc['error'][_0xffd6('0x12')]);return _0x54d793(_0x4267fc[_0xffd6('0x11')][_0xffd6('0x12')]);}logger[_0xffd6('0x11')]('CmHopperHistory,\x20%s,\x20%s',_0x5c19ee,_0x4267fc['error'][_0xffd6('0x12')]);return _0x534a1b(_0x4267fc[_0xffd6('0x11')][_0xffd6('0x12')]);}else{logger['info'](_0xffd6('0xe'),_0x5c19ee,_0xffd6('0x13'));_0x534a1b(_0x4267fc['result'][_0xffd6('0x12')]);}})['catch'](function(_0x1881a1){logger[_0xffd6('0x11')](_0xffd6('0xe'),_0x5c19ee,_0x1881a1);_0x54d793(_0x1881a1);});});}exports[_0xffd6('0x14')]=function(_0x1c96dc){var _0x57af76=this;return new Promise(function(_0xe2f572,_0x39938d){return db[_0xffd6('0x15')][_0xffd6('0x16')](_0x1c96dc['body'],{'raw':_0x1c96dc['options']?_0x1c96dc[_0xffd6('0x17')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x453e4e){logger[_0xffd6('0xd')](_0xffd6('0x14'),_0x1c96dc);logger[_0xffd6('0xf')](_0xffd6('0x14'),_0x1c96dc,JSON[_0xffd6('0x10')](_0x453e4e));_0xe2f572(_0x453e4e);})['catch'](function(_0x44e5f5){logger[_0xffd6('0x11')]('CreateCmHopperHistory',_0x44e5f5[_0xffd6('0x12')],_0x1c96dc);_0x39938d(_0x57af76['error'](0x1f4,_0x44e5f5[_0xffd6('0x12')]));});});};exports[_0xffd6('0x18')]=function(_0x18fd0f){var _0x5e0e4c=this;return new Promise(function(_0x564623,_0x4b75c6){return db[_0xffd6('0x15')][_0xffd6('0x19')]({'raw':_0x18fd0f[_0xffd6('0x17')]?_0x18fd0f['options'][_0xffd6('0x1a')]===undefined?!![]:![]:!![],'where':_0x18fd0f[_0xffd6('0x17')]?_0x18fd0f[_0xffd6('0x17')][_0xffd6('0x1b')]||null:null,'attributes':[[db[_0xffd6('0x1c')]['fn']('COUNT',db[_0xffd6('0x1c')][_0xffd6('0x1d')]('id')),_0xffd6('0x1e')],[db[_0xffd6('0x1c')]['fn'](_0xffd6('0x1f'),db[_0xffd6('0x1c')]['fn']('IF',db[_0xffd6('0x1c')][_0xffd6('0x20')](_0xffd6('0x21')))),_0xffd6('0x22')],[db[_0xffd6('0x1c')]['fn']('COUNT',db[_0xffd6('0x1c')]['fn']('IF',db[_0xffd6('0x1c')][_0xffd6('0x20')](_0xffd6('0x23')))),_0xffd6('0x24')],[db[_0xffd6('0x1c')]['fn']('COUNT',db[_0xffd6('0x1c')]['fn']('IF',db[_0xffd6('0x1c')][_0xffd6('0x20')](_0xffd6('0x25')))),_0xffd6('0x26')],[db[_0xffd6('0x1c')]['fn'](_0xffd6('0x27'),db[_0xffd6('0x1c')]['fn']('IF',db[_0xffd6('0x1c')][_0xffd6('0x20')](_0xffd6('0x28')))),_0xffd6('0x29')],[db['sequelize']['fn'](_0xffd6('0x27'),db[_0xffd6('0x1c')]['fn']('IF',db[_0xffd6('0x1c')]['literal']('`state`\x20=\x204,\x20`talktime`,\x20null'))),'predictiveIntervalAvgTalktime']]})[_0xffd6('0xc')](function(_0x34c83a){logger[_0xffd6('0xd')](_0xffd6('0x18'),_0x18fd0f);logger[_0xffd6('0xf')](_0xffd6('0x18'),_0x18fd0f,JSON[_0xffd6('0x10')](_0x34c83a));_0x564623(_0x34c83a);})['catch'](function(_0x4655e7){logger['error'](_0xffd6('0x18'),_0x4655e7[_0xffd6('0x12')],_0x18fd0f);_0x4b75c6(_0x5e0e4c[_0xffd6('0x11')](0x1f4,_0x4655e7['message']));});});};exports[_0xffd6('0x2a')]=function(_0x2a38b9){var _0x5373dc=this;return new Promise(function(_0x3459f3,_0x504f7b){return db[_0xffd6('0x15')][_0xffd6('0x19')]({'raw':_0x2a38b9[_0xffd6('0x17')]?_0x2a38b9[_0xffd6('0x17')][_0xffd6('0x1a')]===undefined?!![]:![]:!![],'where':_0x2a38b9[_0xffd6('0x17')]?_0x2a38b9[_0xffd6('0x17')][_0xffd6('0x1b')]||null:null,'attributes':[[_0xffd6('0x2b'),'name'],[db[_0xffd6('0x1c')]['fn'](_0xffd6('0x1f'),db[_0xffd6('0x1c')]['fn']('IF',db[_0xffd6('0x1c')][_0xffd6('0x20')](_0xffd6('0x2c')))),_0xffd6('0x2d')],[db[_0xffd6('0x1c')]['fn'](_0xffd6('0x1f'),db[_0xffd6('0x1c')]['fn']('IF',db[_0xffd6('0x1c')]['literal']('`state`\x20=\x203,\x201,\x20null'))),_0xffd6('0x2e')],[db[_0xffd6('0x1c')]['fn']('COUNT',db[_0xffd6('0x1c')]['fn']('IF',db[_0xffd6('0x1c')][_0xffd6('0x20')](_0xffd6('0x21')))),_0xffd6('0x2f')],[db[_0xffd6('0x1c')]['fn'](_0xffd6('0x1f'),db[_0xffd6('0x1c')]['fn']('IF',db[_0xffd6('0x1c')][_0xffd6('0x20')](_0xffd6('0x30')))),_0xffd6('0x31')],[db[_0xffd6('0x1c')]['fn'](_0xffd6('0x1f'),db[_0xffd6('0x1c')]['fn']('IF',db[_0xffd6('0x1c')]['literal']('`state`\x20=\x208,\x201,\x20null'))),'outboundCongestionCallsDay'],[db[_0xffd6('0x1c')]['fn'](_0xffd6('0x1f'),db[_0xffd6('0x1c')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2010\x20,\x201,\x20null'))),'outboundDropCallsDayTimeout'],[db[_0xffd6('0x1c')]['fn'](_0xffd6('0x1f'),db[_0xffd6('0x1c')]['fn']('IF',db[_0xffd6('0x1c')][_0xffd6('0x20')](_0xffd6('0x32')))),_0xffd6('0x33')],[db[_0xffd6('0x1c')]['fn'](_0xffd6('0x1f'),db[_0xffd6('0x1c')]['fn']('IF',db[_0xffd6('0x1c')][_0xffd6('0x20')](_0xffd6('0x34')))),_0xffd6('0x35')],[db['sequelize']['fn'](_0xffd6('0x1f'),db[_0xffd6('0x1c')]['fn']('IF',db[_0xffd6('0x1c')][_0xffd6('0x20')](_0xffd6('0x36')))),'outboundBlacklistCallsDay'],[db[_0xffd6('0x1c')]['fn'](_0xffd6('0x1f'),db['sequelize']['fn']('IF',db[_0xffd6('0x1c')][_0xffd6('0x20')](_0xffd6('0x37')))),_0xffd6('0x38')],[db[_0xffd6('0x1c')]['fn'](_0xffd6('0x1f'),db[_0xffd6('0x1c')]['fn']('IF',db[_0xffd6('0x1c')][_0xffd6('0x20')]('`state`\x20=\x2018,\x201,\x20null'))),_0xffd6('0x39')],[db[_0xffd6('0x1c')]['fn']('COUNT',db[_0xffd6('0x1c')]['fn']('IF',db[_0xffd6('0x1c')][_0xffd6('0x20')]('`state`\x20=\x2016,\x201,\x20null'))),_0xffd6('0x3a')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xffd6('0x1c')]['literal'](_0xffd6('0x3b')))),_0xffd6('0x39')],[db[_0xffd6('0x1c')]['fn']('COUNT',db[_0xffd6('0x1c')]['fn']('IF',db['sequelize'][_0xffd6('0x20')](_0xffd6('0x3c')))),_0xffd6('0x3d')]],'group':[_0xffd6('0x2b')]})[_0xffd6('0xc')](function(_0x2a27d9){logger[_0xffd6('0xd')]('GetVoiceQueueHopperHistory',_0x2a38b9);logger[_0xffd6('0xf')](_0xffd6('0x2a'),_0x2a38b9,JSON[_0xffd6('0x10')](_0x2a27d9));_0x3459f3(_0x2a27d9);})[_0xffd6('0x3e')](function(_0x459cbe){logger[_0xffd6('0x11')](_0xffd6('0x2a'),_0x459cbe['message'],_0x2a38b9);_0x504f7b(_0x5373dc[_0xffd6('0x11')](0x1f4,_0x459cbe[_0xffd6('0x12')]));});});};exports[_0xffd6('0x3f')]=function(_0x3fbaaf){var _0x59eba5=this;return new Promise(function(_0x25f15e,_0x3a0cb5){return db[_0xffd6('0x15')][_0xffd6('0x19')]({'raw':_0x3fbaaf[_0xffd6('0x17')]?_0x3fbaaf[_0xffd6('0x17')][_0xffd6('0x1a')]===undefined?!![]:![]:!![],'where':_0x3fbaaf[_0xffd6('0x17')]?_0x3fbaaf[_0xffd6('0x17')]['where']||null:null,'attributes':[[_0xffd6('0x2b'),_0xffd6('0x40')],[db[_0xffd6('0x1c')]['fn'](_0xffd6('0x1f'),db[_0xffd6('0x1c')][_0xffd6('0x1d')]('id')),_0xffd6('0x41')],[db['sequelize']['fn'](_0xffd6('0x1f'),db[_0xffd6('0x1c')]['fn']('IF',db[_0xffd6('0x1c')][_0xffd6('0x20')](_0xffd6('0x21')))),_0xffd6('0x42')]],'group':['campaign']})[_0xffd6('0xc')](function(_0x39b2fd){logger[_0xffd6('0xd')](_0xffd6('0x3f'),_0x3fbaaf);logger[_0xffd6('0xf')](_0xffd6('0x3f'),_0x3fbaaf,JSON[_0xffd6('0x10')](_0x39b2fd));_0x25f15e(_0x39b2fd);})[_0xffd6('0x3e')](function(_0x1b0bfa){logger[_0xffd6('0x11')](_0xffd6('0x3f'),_0x1b0bfa['message'],_0x3fbaaf);_0x3a0cb5(_0x59eba5[_0xffd6('0x11')](0x1f4,_0x1b0bfa['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 34e5205..e5fcbf2 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 _0xe2c9=['post','isAuthenticated','create','/:id','update','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','/describe','describe'];(function(_0x3588f7,_0x318d8f){var _0x4b96d5=function(_0xd0b6a3){while(--_0xd0b6a3){_0x3588f7['push'](_0x3588f7['shift']());}};_0x4b96d5(++_0x318d8f);}(_0xe2c9,0x114));var _0x9e2c=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xe2c9[_0x47b58b];return _0x46bebe;};'use strict';var multer=require(_0x9e2c('0x0'));var util=require(_0x9e2c('0x1'));var path=require(_0x9e2c('0x2'));var timeout=require('connect-timeout');var express=require(_0x9e2c('0x3'));var router=express[_0x9e2c('0x4')]();var fs_extra=require(_0x9e2c('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x9e2c('0x6'));var config=require(_0x9e2c('0x7'));var controller=require(_0x9e2c('0x8'));router[_0x9e2c('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x9e2c('0x9')](_0x9e2c('0xa'),auth['isAuthenticated'](),controller[_0x9e2c('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x9e2c('0xc')]('/',auth[_0x9e2c('0xd')](),controller[_0x9e2c('0xe')]);router['put'](_0x9e2c('0xf'),auth[_0x9e2c('0xd')](),controller[_0x9e2c('0x10')]);module[_0x9e2c('0x11')]=router; \ No newline at end of file +var _0x7b74=['/:id','put','update','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','/describe'];(function(_0x21fd45,_0x32e491){var _0x537a12=function(_0x5d446c){while(--_0x5d446c){_0x21fd45['push'](_0x21fd45['shift']());}};_0x537a12(++_0x32e491);}(_0x7b74,0x123));var _0x47b7=function(_0x5431cd,_0x2b1187){_0x5431cd=_0x5431cd-0x0;var _0x7f67a5=_0x7b74[_0x5431cd];return _0x7f67a5;};'use strict';var multer=require(_0x47b7('0x0'));var util=require('util');var path=require(_0x47b7('0x1'));var timeout=require(_0x47b7('0x2'));var express=require(_0x47b7('0x3'));var router=express[_0x47b7('0x4')]();var fs_extra=require(_0x47b7('0x5'));var auth=require(_0x47b7('0x6'));var interaction=require(_0x47b7('0x7'));var config=require(_0x47b7('0x8'));var controller=require(_0x47b7('0x9'));router[_0x47b7('0xa')]('/',auth[_0x47b7('0xb')](),controller['index']);router[_0x47b7('0xa')](_0x47b7('0xc'),auth[_0x47b7('0xb')](),controller['describe']);router[_0x47b7('0xa')](_0x47b7('0xd'),auth[_0x47b7('0xb')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x47b7('0xe')](_0x47b7('0xd'),auth[_0x47b7('0xb')](),controller[_0x47b7('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 70d601b..6a4f342 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 _0x9ef8=['exports','name','STRING','sequelize'];(function(_0x77b525,_0xd4dc1e){var _0xa83673=function(_0x133b1f){while(--_0x133b1f){_0x77b525['push'](_0x77b525['shift']());}};_0xa83673(++_0xd4dc1e);}(_0x9ef8,0x17f));var _0x89ef=function(_0x5a2d95,_0xb362e5){_0x5a2d95=_0x5a2d95-0x0;var _0x2c3986=_0x9ef8[_0x5a2d95];return _0x2c3986;};'use strict';var Sequelize=require(_0x89ef('0x0'));module[_0x89ef('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x89ef('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x89ef('0x3')]},'dialPrefix':{'type':Sequelize[_0x89ef('0x3')]}}; \ No newline at end of file +var _0xadf0=['name','exports','STRING'];(function(_0x2b901d,_0x3fe24e){var _0x38f9bf=function(_0xe0142a){while(--_0xe0142a){_0x2b901d['push'](_0x2b901d['shift']());}};_0x38f9bf(++_0x3fe24e);}(_0xadf0,0x12d));var _0x0adf=function(_0x7e7da4,_0x2596f4){_0x7e7da4=_0x7e7da4-0x0;var _0x3f1d5b=_0xadf0[_0x7e7da4];return _0x3f1d5b;};'use strict';var Sequelize=require('sequelize');module[_0x0adf('0x0')]={'name':{'type':Sequelize[_0x0adf('0x1')],'unique':_0x0adf('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x0adf('0x1')]},'dialPrefix':{'type':Sequelize[_0x0adf('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index eb7c6f6..1b79f2a 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 _0x4bc0=['index','map','CmList','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','order','sort','pick','filter','merge','where','type','VIRTUAL','includeAll','findAll','show','params','fields','options','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Lists','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','Disposition','getDispositions','findOne','nolimit','ListId','rows','addContacts','CmContact','isArray','tags','join','each','omit','success','push','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','concat','format','cf_%d','raw','getContactsCsv','isEmpty','writeFileSync','setHeader','Content-disposition','list_%d_%s.csv','Content-type','text/csv','download','/tmp/list_%d_%s.csv','addCustomField','sequelize','transaction','addCustomFields','Sequelize','TEXT','text','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','findAndCountAll','addAgents','ids','spread','emit','userCmList:save','removeAgents','userCmList:remove','User','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','defaults','socket.io-emitter','redis','./cmList.socket','register','status','end','json','offset','count','limit','apply','reject','update','then','get','UserProfileResource','destroy','sendStatus','error','stack','name'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x4bc0,0xf6));var _0x04bc=function(_0x22f11e,_0xe64bc6){_0x22f11e=_0x22f11e-0x0;var _0x51f8c9=_0x4bc0[_0x22f11e];return _0x51f8c9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x04bc('0x0'));var zipdir=require(_0x04bc('0x1'));var jsonpatch=require(_0x04bc('0x2'));var rp=require(_0x04bc('0x3'));var moment=require(_0x04bc('0x4'));var BPromise=require(_0x04bc('0x5'));var Mustache=require(_0x04bc('0x6'));var util=require(_0x04bc('0x7'));var path=require('path');var sox=require(_0x04bc('0x8'));var csv=require(_0x04bc('0x9'));var ejs=require(_0x04bc('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x04bc('0xb'));var crypto=require(_0x04bc('0xc'));var jsforce=require(_0x04bc('0xd'));var deskjs=require(_0x04bc('0xe'));var toCsv=require(_0x04bc('0x9'));var querystring=require('querystring');var Papa=require(_0x04bc('0xf'));var Redis=require('ioredis');var authService=require(_0x04bc('0x10'));var qs=require(_0x04bc('0x11'));var as=require(_0x04bc('0x12'));var hardwareService=require(_0x04bc('0x13'));var logger=require('../../config/logger')(_0x04bc('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x04bc('0x15'))['db'];config['redis']=_[_0x04bc('0x16')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x04bc('0x17'))(new Redis(config[_0x04bc('0x18')]));require(_0x04bc('0x19'))[_0x04bc('0x1a')](socket);function respondWithStatusCode(_0x3dac97,_0x155188){_0x155188=_0x155188||0xcc;return function(_0x194fd6){if(_0x194fd6){return _0x3dac97['sendStatus'](_0x155188);}return _0x3dac97[_0x04bc('0x1b')](_0x155188)[_0x04bc('0x1c')]();};}function respondWithResult(_0x25715e,_0x3e4b09){_0x3e4b09=_0x3e4b09||0xc8;return function(_0x8c8e84){if(_0x8c8e84){return _0x25715e[_0x04bc('0x1b')](_0x3e4b09)[_0x04bc('0x1d')](_0x8c8e84);}};}function respondWithFilteredResult(_0x27d63c,_0x522f60){return function(_0x32ede6){if(_0x32ede6){var _0x53a983=typeof _0x522f60[_0x04bc('0x1e')]==='undefined'&&typeof _0x522f60['limit']==='undefined';var _0x2a7f2b=_0x32ede6[_0x04bc('0x1f')];var _0x2815dc=_0x53a983?0x0:_0x522f60[_0x04bc('0x1e')];var _0x5268cf=_0x53a983?_0x32ede6[_0x04bc('0x1f')]:_0x522f60[_0x04bc('0x1e')]+_0x522f60[_0x04bc('0x20')];var _0x476027;if(_0x5268cf>=_0x2a7f2b){_0x5268cf=_0x2a7f2b;_0x476027=0xc8;}else{_0x476027=0xce;}_0x27d63c[_0x04bc('0x1b')](_0x476027);return _0x27d63c['set']('Content-Range',_0x2815dc+'-'+_0x5268cf+'/'+_0x2a7f2b)[_0x04bc('0x1d')](_0x32ede6);}return null;};}function patchUpdates(_0x2e8b38){return function(_0x2ad47b){try{jsonpatch[_0x04bc('0x21')](_0x2ad47b,_0x2e8b38,!![]);}catch(_0x38430a){return BPromise[_0x04bc('0x22')](_0x38430a);}return _0x2ad47b['save']();};}function saveUpdates(_0x25a9e6,_0x5e7d66){return function(_0x5d05c1){if(_0x5d05c1){return _0x5d05c1[_0x04bc('0x23')](_0x25a9e6)['then'](function(_0x45727a){return _0x45727a;});}return null;};}function removeEntity(_0x8a4f43,_0x549e2a){return function(_0x4b45ac){if(_0x4b45ac){return _0x4b45ac['destroy']()[_0x04bc('0x24')](function(){var _0x963bce=_0x4b45ac[_0x04bc('0x25')]({'plain':!![]});var _0x521c16='Lists';return db[_0x04bc('0x26')][_0x04bc('0x27')]({'where':{'type':_0x521c16,'resourceId':_0x963bce['id']}})[_0x04bc('0x24')](function(){return _0x4b45ac;});})[_0x04bc('0x24')](function(){_0x8a4f43['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1dc071,_0x222101){return function(_0x2e14be){if(!_0x2e14be){_0x1dc071[_0x04bc('0x28')](0x194);}return _0x2e14be;};}function handleError(_0x10e9d0,_0x2cef5a){_0x2cef5a=_0x2cef5a||0x1f4;return function(_0x417997){logger[_0x04bc('0x29')](_0x417997[_0x04bc('0x2a')]);if(_0x417997[_0x04bc('0x2b')]){delete _0x417997[_0x04bc('0x2b')];}_0x10e9d0[_0x04bc('0x1b')](_0x2cef5a)['send'](_0x417997);};}exports[_0x04bc('0x2c')]=function(_0x4c74f8,_0x59d4a8){var _0x3ed90b={},_0x2314c6={},_0x1285bf={'count':0x0,'rows':[]};var _0x397cea=_[_0x04bc('0x2d')](db[_0x04bc('0x2e')][_0x04bc('0x2f')],function(_0x9395ad){return{'name':_0x9395ad[_0x04bc('0x30')],'type':_0x9395ad['type'][_0x04bc('0x31')]};});_0x2314c6[_0x04bc('0x32')]=_[_0x04bc('0x2d')](_0x397cea,_0x04bc('0x2b'));_0x2314c6[_0x04bc('0x33')]=_[_0x04bc('0x34')](_0x4c74f8[_0x04bc('0x33')]);_0x2314c6[_0x04bc('0x35')]=_[_0x04bc('0x36')](_0x2314c6[_0x04bc('0x32')],_0x2314c6['query']);_0x3ed90b[_0x04bc('0x37')]=_[_0x04bc('0x36')](_0x2314c6[_0x04bc('0x32')],qs['fields'](_0x4c74f8[_0x04bc('0x33')]['fields']));_0x3ed90b[_0x04bc('0x37')]=_0x3ed90b[_0x04bc('0x37')][_0x04bc('0x38')]?_0x3ed90b['attributes']:_0x2314c6['model'];if(!_0x4c74f8[_0x04bc('0x33')][_0x04bc('0x39')]('nolimit')){_0x3ed90b['limit']=qs[_0x04bc('0x20')](_0x4c74f8[_0x04bc('0x33')][_0x04bc('0x20')]);_0x3ed90b[_0x04bc('0x1e')]=qs[_0x04bc('0x1e')](_0x4c74f8['query'][_0x04bc('0x1e')]);}_0x3ed90b[_0x04bc('0x3a')]=qs[_0x04bc('0x3b')](_0x4c74f8['query']['sort']);_0x3ed90b['where']=qs[_0x04bc('0x35')](_[_0x04bc('0x3c')](_0x4c74f8[_0x04bc('0x33')],_0x2314c6[_0x04bc('0x35')]),_0x397cea);if(_0x4c74f8[_0x04bc('0x33')][_0x04bc('0x3d')]){_0x3ed90b['where']=_[_0x04bc('0x3e')](_0x3ed90b[_0x04bc('0x3f')],{'$or':_['map'](_0x397cea,function(_0x562dc4){if(_0x562dc4[_0x04bc('0x40')]!==_0x04bc('0x41')){var _0x2feb6d={};_0x2feb6d[_0x562dc4[_0x04bc('0x2b')]]={'$like':'%'+_0x4c74f8['query'][_0x04bc('0x3d')]+'%'};return _0x2feb6d;}})});}_0x3ed90b=_['merge']({},_0x3ed90b,_0x4c74f8['options']);var _0x55ce17={'where':_0x3ed90b['where']};return db[_0x04bc('0x2e')][_0x04bc('0x1f')](_0x55ce17)[_0x04bc('0x24')](function(_0x15ac52){_0x1285bf['count']=_0x15ac52;if(_0x4c74f8[_0x04bc('0x33')][_0x04bc('0x42')]){_0x3ed90b['include']=[{'all':!![]}];}return db[_0x04bc('0x2e')][_0x04bc('0x43')](_0x3ed90b);})['then'](function(_0x462d51){_0x1285bf['rows']=_0x462d51;return _0x1285bf;})[_0x04bc('0x24')](respondWithFilteredResult(_0x59d4a8,_0x3ed90b))['catch'](handleError(_0x59d4a8,null));};exports[_0x04bc('0x44')]=function(_0x734c6e,_0x3190fc){var _0x5a0608={'raw':![],'where':{'id':_0x734c6e[_0x04bc('0x45')]['id']}},_0x5b5249={};_0x5b5249[_0x04bc('0x32')]=_['keys'](db[_0x04bc('0x2e')]['rawAttributes']);_0x5b5249['query']=_[_0x04bc('0x34')](_0x734c6e['query']);_0x5b5249[_0x04bc('0x35')]=_[_0x04bc('0x36')](_0x5b5249[_0x04bc('0x32')],_0x5b5249[_0x04bc('0x33')]);_0x5a0608[_0x04bc('0x37')]=_['intersection'](_0x5b5249[_0x04bc('0x32')],qs[_0x04bc('0x46')](_0x734c6e[_0x04bc('0x33')][_0x04bc('0x46')]));_0x5a0608[_0x04bc('0x37')]=_0x5a0608[_0x04bc('0x37')][_0x04bc('0x38')]?_0x5a0608[_0x04bc('0x37')]:_0x5b5249['model'];if(_0x734c6e[_0x04bc('0x33')][_0x04bc('0x42')]){_0x5a0608['include']=[{'all':!![]}];}_0x5a0608=_[_0x04bc('0x3e')]({},_0x5a0608,_0x734c6e[_0x04bc('0x47')]);return db['CmList'][_0x04bc('0x48')](_0x5a0608)[_0x04bc('0x24')](handleEntityNotFound(_0x3190fc,null))[_0x04bc('0x24')](respondWithResult(_0x3190fc,null))[_0x04bc('0x49')](handleError(_0x3190fc,null));};exports[_0x04bc('0x4a')]=function(_0x3dabdd,_0x321dd1){return db[_0x04bc('0x2e')][_0x04bc('0x4a')](_0x3dabdd[_0x04bc('0x4b')],{})[_0x04bc('0x24')](function(_0x4e93a7){var _0x3d3986=_0x3dabdd[_0x04bc('0x4c')][_0x04bc('0x25')]({'plain':!![]});if(!_0x3d3986)throw new Error(_0x04bc('0x4d'));if(_0x3d3986[_0x04bc('0x4e')]==='user'){var _0x435645=_0x4e93a7[_0x04bc('0x25')]({'plain':!![]});var _0xc92a5=_0x04bc('0x4f');return db[_0x04bc('0x50')][_0x04bc('0x48')]({'where':{'name':_0xc92a5,'userProfileId':_0x3d3986[_0x04bc('0x51')]},'raw':!![]})[_0x04bc('0x24')](function(_0x2a72e0){if(_0x2a72e0&&_0x2a72e0[_0x04bc('0x52')]===0x0){return db[_0x04bc('0x26')][_0x04bc('0x4a')]({'name':_0x435645['name'],'resourceId':_0x435645['id'],'type':_0x2a72e0[_0x04bc('0x2b')],'sectionId':_0x2a72e0['id']},{})[_0x04bc('0x24')](function(){return _0x4e93a7;});}else{return _0x4e93a7;}})[_0x04bc('0x49')](function(_0x1c9ca2){logger['error'](_0x04bc('0x53'),_0x1c9ca2);throw _0x1c9ca2;});}return _0x4e93a7;})['then'](respondWithResult(_0x321dd1,0xc9))[_0x04bc('0x49')](handleError(_0x321dd1,null));};exports[_0x04bc('0x23')]=function(_0x54ede7,_0x350e3d){if(_0x54ede7[_0x04bc('0x4b')]['id']){delete _0x54ede7[_0x04bc('0x4b')]['id'];}return db[_0x04bc('0x2e')][_0x04bc('0x48')]({'where':{'id':_0x54ede7['params']['id']}})[_0x04bc('0x24')](handleEntityNotFound(_0x350e3d,null))[_0x04bc('0x24')](saveUpdates(_0x54ede7[_0x04bc('0x4b')],null))[_0x04bc('0x24')](respondWithResult(_0x350e3d,null))['catch'](handleError(_0x350e3d,null));};exports[_0x04bc('0x27')]=function(_0x1aec40,_0x47f2b9){return db[_0x04bc('0x2e')][_0x04bc('0x48')]({'where':{'id':_0x1aec40['params']['id']}})[_0x04bc('0x24')](handleEntityNotFound(_0x47f2b9,null))[_0x04bc('0x24')](removeEntity(_0x47f2b9,null))[_0x04bc('0x49')](handleError(_0x47f2b9,null));};exports[_0x04bc('0x54')]=function(_0x33ec22,_0x263560){return db[_0x04bc('0x2e')]['describe']()['then'](respondWithResult(_0x263560,null))[_0x04bc('0x49')](handleError(_0x263560,null));};exports[_0x04bc('0x55')]=function(_0x2bb982,_0x2b9f05,_0x516127){if(_0x2bb982['body']['id']){delete _0x2bb982[_0x04bc('0x4b')]['id'];}return db[_0x04bc('0x2e')][_0x04bc('0x48')]({'where':{'id':_0x2bb982['params']['id']}})['then'](handleEntityNotFound(_0x2b9f05,null))[_0x04bc('0x24')](function(_0x5efb3c){if(_0x5efb3c){_0x2bb982['body']['ListId']=_0x5efb3c['id'];return db[_0x04bc('0x56')][_0x04bc('0x4a')](_0x2bb982[_0x04bc('0x4b')]);}})[_0x04bc('0x24')](respondWithResult(_0x2b9f05,null))['catch'](handleError(_0x2b9f05,null));};exports[_0x04bc('0x57')]=function(_0x2e0388,_0x59f654,_0x35c5b1){var _0xad8933={'raw':![],'where':{}};var _0x1fb362={};var _0x315915={'count':0x0,'rows':[]};return db['CmList'][_0x04bc('0x58')]({'where':{'id':_0x2e0388[_0x04bc('0x45')]['id']}})['then'](handleEntityNotFound(_0x59f654,null))['then'](function(_0xc0afbe){if(_0xc0afbe){_0x1fb362[_0x04bc('0x32')]=_[_0x04bc('0x34')](db['Disposition'][_0x04bc('0x2f')]);_0x1fb362[_0x04bc('0x33')]=_[_0x04bc('0x34')](_0x2e0388['query']);_0x1fb362[_0x04bc('0x35')]=_['intersection'](_0x1fb362[_0x04bc('0x32')],_0x1fb362[_0x04bc('0x33')]);_0xad8933[_0x04bc('0x37')]=_[_0x04bc('0x36')](_0x1fb362[_0x04bc('0x32')],qs[_0x04bc('0x46')](_0x2e0388['query']['fields']));_0xad8933['attributes']=_0xad8933[_0x04bc('0x37')][_0x04bc('0x38')]?_0xad8933['attributes']:_0x1fb362[_0x04bc('0x32')];if(!_0x2e0388[_0x04bc('0x33')]['hasOwnProperty'](_0x04bc('0x59'))){_0xad8933['limit']=qs[_0x04bc('0x20')](_0x2e0388[_0x04bc('0x33')][_0x04bc('0x20')]);_0xad8933[_0x04bc('0x1e')]=qs[_0x04bc('0x1e')](_0x2e0388[_0x04bc('0x33')][_0x04bc('0x1e')]);}_0xad8933[_0x04bc('0x3a')]=qs[_0x04bc('0x3b')](_0x2e0388[_0x04bc('0x33')]['sort']);_0xad8933['where']=qs[_0x04bc('0x35')](_['pick'](_0x2e0388[_0x04bc('0x33')],_0x1fb362[_0x04bc('0x35')]));_0xad8933[_0x04bc('0x3f')][_0x04bc('0x5a')]=_0xc0afbe['id'];if(_0x2e0388[_0x04bc('0x33')]['filter']){_0xad8933[_0x04bc('0x3f')]=_[_0x04bc('0x3e')](_0xad8933[_0x04bc('0x3f')],{'$or':_[_0x04bc('0x2d')](_0xad8933[_0x04bc('0x37')],function(_0x8599b1){var _0x3dd431={};_0x3dd431[_0x8599b1]={'$like':'%'+_0x2e0388[_0x04bc('0x33')]['filter']+'%'};return _0x3dd431;})});}_0xad8933=_[_0x04bc('0x3e')]({},_0xad8933,_0x2e0388[_0x04bc('0x47')]);return db[_0x04bc('0x56')][_0x04bc('0x1f')]({'where':_0xad8933[_0x04bc('0x3f')]})[_0x04bc('0x24')](function(_0xad009e){_0x315915[_0x04bc('0x1f')]=_0xad009e;if(_0x2e0388['query'][_0x04bc('0x42')]){_0xad8933['include']=[{'all':!![]}];}return db['Disposition'][_0x04bc('0x43')](_0xad8933);})['then'](function(_0x344283){_0x315915[_0x04bc('0x5b')]=_0x344283;return _0x315915;});}})[_0x04bc('0x24')](respondWithFilteredResult(_0x59f654,_0xad8933))[_0x04bc('0x49')](handleError(_0x59f654,null));};exports['removeDispositions']=function(_0x2c48d1,_0x4733ae,_0x49cafe){return db[_0x04bc('0x2e')][_0x04bc('0x48')]({'where':{'id':_0x2c48d1[_0x04bc('0x45')]['id']}})[_0x04bc('0x24')](handleEntityNotFound(_0x4733ae,null))['then'](function(_0xed2c28){if(_0xed2c28){return _0xed2c28['removeDispositions'](_0x2c48d1[_0x04bc('0x33')]['ids']);}})['then'](respondWithStatusCode(_0x4733ae,null))[_0x04bc('0x49')](handleError(_0x4733ae,null));};exports[_0x04bc('0x5c')]=function(_0x610233,_0x276bb4,_0x3e937a){return db[_0x04bc('0x2e')][_0x04bc('0x48')]({'where':{'id':_0x610233[_0x04bc('0x45')]['id']}})[_0x04bc('0x24')](handleEntityNotFound(_0x276bb4,null))[_0x04bc('0x24')](function(_0xf61409){if(_0xf61409){var _0x4bd4fc=[];var _0x43e87e={'success':[],'errors':[]};return db[_0x04bc('0x5d')][_0x04bc('0x54')]()['then'](function(_0x271c5e){if(_0x610233[_0x04bc('0x4b')]['tags']&&_[_0x04bc('0x5e')](_0x610233[_0x04bc('0x4b')]['tags'])){if(_0x610233[_0x04bc('0x4b')][_0x04bc('0x5f')][_0x04bc('0x38')]){_0x610233[_0x04bc('0x4b')][_0x04bc('0x5f')]=_0x610233[_0x04bc('0x4b')][_0x04bc('0x5f')][_0x04bc('0x60')](';')+';';}else{_0x610233[_0x04bc('0x4b')][_0x04bc('0x5f')]=null;}}else{_0x610233[_0x04bc('0x4b')][_0x04bc('0x5f')]=null;}if(_0x610233['body']&&_[_0x04bc('0x5e')](_0x610233[_0x04bc('0x4b')])){for(var _0x319246=0x0;_0x319246<_0x610233['body']['length'];_0x319246+=0x1){_0x610233[_0x04bc('0x4b')][_0x319246][_0x04bc('0x5a')]=_0x610233[_0x04bc('0x45')]['id'];_0x4bd4fc['push'](_0x610233[_0x04bc('0x4b')][_0x319246]);}return BPromise[_0x04bc('0x61')](_0x4bd4fc,function(_0x50282b){return db[_0x04bc('0x5d')]['create'](_[_0x04bc('0x62')](_0x50282b,['ids','id'])||{},{'fields':_['keys'](_0x271c5e),'raw':!![]})[_0x04bc('0x24')](function(_0x3d5887){_0x43e87e[_0x04bc('0x63')][_0x04bc('0x64')](_0x3d5887['dataValues']);})[_0x04bc('0x49')](function(_0x568b0a){_0x43e87e['errors']['push']({'data':_0x50282b,'error':_0x568b0a[_0x04bc('0x65')]});});})[_0x04bc('0x24')](function(_0x5a5401){return _0x43e87e;})['catch'](function(_0x156b57){return _0x156b57;});}else{_0x276bb4[_0x04bc('0x1b')](0x190)[_0x04bc('0x1d')]({'message':_0x04bc('0x66')});}});}})[_0x04bc('0x24')](respondWithResult(_0x276bb4,null))[_0x04bc('0x49')](handleError(_0x276bb4,null));};exports[_0x04bc('0x67')]=function(_0x232dc8,_0x59f3d2,_0x13bd02){var _0x3b4a35;return db['CmList'][_0x04bc('0x48')]({'where':{'id':_0x232dc8[_0x04bc('0x45')]['id']},'include':[{'model':db[_0x04bc('0x68')],'as':_0x04bc('0x69')}]})['then'](handleEntityNotFound(_0x59f3d2,null))[_0x04bc('0x24')](function(_0x2e5009){if(_0x2e5009){_0x3b4a35=_0x2e5009;return db[_0x04bc('0x5d')][_0x04bc('0x2f')];}})[_0x04bc('0x24')](function(_0x52f038){if(_0x52f038){var _0xeb4aaa={};var _0x2af043={};_0x2af043[_0x04bc('0x32')]=_[_0x04bc('0x6a')](_[_0x04bc('0x34')](_0x52f038),_[_0x04bc('0x2d')](_0x3b4a35[_0x04bc('0x69')],function(_0x2c110e){return util[_0x04bc('0x6b')](_0x04bc('0x6c'),_0x2c110e['id']);}));_0x2af043[_0x04bc('0x33')]=_[_0x04bc('0x34')](_0x232dc8[_0x04bc('0x33')]);_0x2af043[_0x04bc('0x35')]=_[_0x04bc('0x36')](_0x2af043[_0x04bc('0x32')],_0x2af043['query']);_0xeb4aaa['attributes']=_['intersection'](_0x2af043[_0x04bc('0x32')],qs[_0x04bc('0x46')](_0x232dc8['query']['fields']));_0xeb4aaa[_0x04bc('0x37')]=_0xeb4aaa[_0x04bc('0x37')]['length']?_0xeb4aaa[_0x04bc('0x37')]:_0x2af043['model'];if(!_0x232dc8[_0x04bc('0x33')]['hasOwnProperty'](_0x04bc('0x59'))){_0xeb4aaa[_0x04bc('0x20')]=qs[_0x04bc('0x20')](_0x232dc8['query']['limit']);_0xeb4aaa[_0x04bc('0x1e')]=qs['offset'](_0x232dc8[_0x04bc('0x33')][_0x04bc('0x1e')]);}_0xeb4aaa[_0x04bc('0x3a')]=qs[_0x04bc('0x3b')](_0x232dc8[_0x04bc('0x33')][_0x04bc('0x3b')]);_0xeb4aaa[_0x04bc('0x3f')]=qs[_0x04bc('0x35')](_[_0x04bc('0x3c')](_0x232dc8[_0x04bc('0x33')],_0x2af043[_0x04bc('0x35')]));_0xeb4aaa[_0x04bc('0x6d')]=!![];if(_0x232dc8[_0x04bc('0x33')]['filter']){_0xeb4aaa[_0x04bc('0x3f')]=_[_0x04bc('0x3e')](_0xeb4aaa['where'],{'$or':_[_0x04bc('0x2d')](_0xeb4aaa[_0x04bc('0x37')],function(_0x2809a0){var _0x4784d4={};_0x4784d4[_0x2809a0]={'$like':'%'+_0x232dc8[_0x04bc('0x33')][_0x04bc('0x3d')]+'%'};return _0x4784d4;})});}_0xeb4aaa=_[_0x04bc('0x3e')]({},_0xeb4aaa,_0x232dc8[_0x04bc('0x47')]);return _0x3b4a35[_0x04bc('0x67')](_0xeb4aaa);}})['then'](respondWithResult(_0x59f3d2,null))['catch'](handleError(_0x59f3d2,null));};exports[_0x04bc('0x6e')]=function(_0x5f4cd3,_0xed9fe0,_0x3c087c){var _0x145929;return db[_0x04bc('0x2e')]['find']({'where':{'id':_0x5f4cd3[_0x04bc('0x45')]['id']},'include':[{'model':db[_0x04bc('0x68')],'as':_0x04bc('0x69')}]})[_0x04bc('0x24')](handleEntityNotFound(_0xed9fe0,null))[_0x04bc('0x24')](function(_0x50fef6){if(_0x50fef6){_0x145929=_0x50fef6;return db[_0x04bc('0x5d')][_0x04bc('0x2f')];}})[_0x04bc('0x24')](function(_0x4ba5be){if(_0x4ba5be){var _0x3bb91d={};var _0x20437e={};_0x20437e[_0x04bc('0x32')]=_[_0x04bc('0x6a')](_[_0x04bc('0x34')](_0x4ba5be),_['map'](_0x145929[_0x04bc('0x69')],function(_0x35ef1){return util[_0x04bc('0x6b')](_0x04bc('0x6c'),_0x35ef1['id']);}));_0x20437e[_0x04bc('0x33')]=_[_0x04bc('0x34')](_0x5f4cd3[_0x04bc('0x33')]);_0x20437e[_0x04bc('0x35')]=_[_0x04bc('0x36')](_0x20437e['model'],_0x20437e[_0x04bc('0x33')]);_0x3bb91d[_0x04bc('0x37')]=_[_0x04bc('0x36')](_0x20437e[_0x04bc('0x32')],qs[_0x04bc('0x46')](_0x5f4cd3[_0x04bc('0x33')]['fields']));_0x3bb91d['attributes']=_0x3bb91d[_0x04bc('0x37')][_0x04bc('0x38')]?_0x3bb91d[_0x04bc('0x37')]:_0x20437e[_0x04bc('0x32')];if(!_0x5f4cd3[_0x04bc('0x33')]['hasOwnProperty']('nolimit')){_0x3bb91d[_0x04bc('0x20')]=qs['limit'](_0x5f4cd3[_0x04bc('0x33')][_0x04bc('0x20')]);_0x3bb91d['offset']=qs[_0x04bc('0x1e')](_0x5f4cd3['query']['offset']);}_0x3bb91d[_0x04bc('0x3a')]=qs['sort'](_0x5f4cd3[_0x04bc('0x33')][_0x04bc('0x3b')]);_0x3bb91d[_0x04bc('0x3f')]=qs['filters'](_['pick'](_0x5f4cd3[_0x04bc('0x33')],_0x20437e['filters']));_0x3bb91d[_0x04bc('0x6d')]=!![];if(_0x5f4cd3[_0x04bc('0x33')]['filter']){_0x3bb91d[_0x04bc('0x3f')]=_[_0x04bc('0x3e')](_0x3bb91d[_0x04bc('0x3f')],{'$or':_[_0x04bc('0x2d')](_0x3bb91d[_0x04bc('0x37')],function(_0x2bc674){var _0x35f5ab={};_0x35f5ab[_0x2bc674]={'$like':'%'+_0x5f4cd3[_0x04bc('0x33')][_0x04bc('0x3d')]+'%'};return _0x35f5ab;})});}_0x3bb91d=_[_0x04bc('0x3e')]({},_0x3bb91d,_0x5f4cd3[_0x04bc('0x47')]);return _0x145929[_0x04bc('0x67')](_0x3bb91d);}})['then'](function(_0x32ad36){if(!_[_0x04bc('0x6f')](_0x32ad36)){var _0x5c2c15=toCsv(_0x32ad36);var _0x36ef22=Date['now']();fs[_0x04bc('0x70')](util['format']('/tmp/list_%d_%s.csv',_0x145929['id'],_0x36ef22),_0x5c2c15);_0xed9fe0[_0x04bc('0x71')](_0x04bc('0x72'),'attachment;\x20filename='+util[_0x04bc('0x6b')](_0x04bc('0x73'),_0x145929['id'],_0x36ef22));_0xed9fe0['setHeader'](_0x04bc('0x74'),_0x04bc('0x75'));return _0xed9fe0[_0x04bc('0x76')](util[_0x04bc('0x6b')](_0x04bc('0x77'),_0x145929['id'],_0x36ef22));}else{return _0xed9fe0[_0x04bc('0x28')](0xcc);}})[_0x04bc('0x49')](handleError(_0xed9fe0,null));};exports[_0x04bc('0x78')]=function(_0x12d363,_0x1cc1e0,_0x211759){var _0x4bc4bb;delete _0x12d363[_0x04bc('0x4b')]['id'];return db[_0x04bc('0x2e')][_0x04bc('0x58')]({'where':{'id':_0x12d363[_0x04bc('0x45')]['id']}})[_0x04bc('0x24')](handleEntityNotFound(_0x1cc1e0,null))['then'](function(_0x2f99bc){if(_0x2f99bc){return db[_0x04bc('0x79')][_0x04bc('0x7a')](function(_0x36dca6){return db[_0x04bc('0x68')][_0x04bc('0x4a')](_0x12d363[_0x04bc('0x4b')],{'transaction':_0x36dca6})[_0x04bc('0x24')](function(_0x384fcc){_0x4bc4bb=_0x384fcc;return _0x2f99bc[_0x04bc('0x7b')](_0x384fcc,{'transaction':_0x36dca6});})[_0x04bc('0x24')](function(){var _0x1f9fc6={'type':db[_0x04bc('0x7c')][_0x04bc('0x7d')],'transaction':_0x36dca6};switch(_0x12d363[_0x04bc('0x4b')][_0x04bc('0x40')]){case _0x04bc('0x7e'):_0x1f9fc6[_0x04bc('0x40')]=db[_0x04bc('0x7c')]['TEXT'];break;case _0x04bc('0x7f'):_0x1f9fc6['type']=db[_0x04bc('0x7c')][_0x04bc('0x80')];break;case _0x04bc('0x81'):_0x1f9fc6[_0x04bc('0x40')]=db[_0x04bc('0x7c')][_0x04bc('0x82')];_0x1f9fc6[_0x04bc('0x83')]=![];break;default:}return db[_0x04bc('0x79')][_0x04bc('0x84')][_0x04bc('0x85')](_0x04bc('0x86'),util['format']('cf_%s',_0x4bc4bb['id']),_0x1f9fc6);})['then'](function(){return _0x4bc4bb;});});}})[_0x04bc('0x24')](respondWithResult(_0x1cc1e0,null))['catch'](handleError(_0x1cc1e0,null));};exports['getCustomFields']=function(_0x399a17,_0x3a2d6b,_0x152f35){var _0x4c2b0e={};var _0x19824d={};var _0x2875c5;var _0x2f95d7;return db[_0x04bc('0x2e')][_0x04bc('0x58')]({'where':{'id':_0x399a17[_0x04bc('0x45')]['id']}})[_0x04bc('0x24')](handleEntityNotFound(_0x3a2d6b,null))['then'](function(_0x3ecd4f){if(_0x3ecd4f){_0x2875c5=_0x3ecd4f;_0x19824d['model']=_[_0x04bc('0x34')](db['CmCustomField']['rawAttributes']);_0x19824d['query']=_[_0x04bc('0x34')](_0x399a17[_0x04bc('0x33')]);_0x19824d['filters']=_[_0x04bc('0x36')](_0x19824d['model'],_0x19824d[_0x04bc('0x33')]);_0x4c2b0e[_0x04bc('0x37')]=_['intersection'](_0x19824d[_0x04bc('0x32')],qs[_0x04bc('0x46')](_0x399a17['query'][_0x04bc('0x46')]));_0x4c2b0e['attributes']=_0x4c2b0e[_0x04bc('0x37')][_0x04bc('0x38')]?_0x4c2b0e['attributes']:_0x19824d[_0x04bc('0x32')];_0x4c2b0e[_0x04bc('0x3a')]=qs[_0x04bc('0x3b')](_0x399a17[_0x04bc('0x33')][_0x04bc('0x3b')]);_0x4c2b0e['where']=qs[_0x04bc('0x35')](_[_0x04bc('0x3c')](_0x399a17[_0x04bc('0x33')],_0x19824d[_0x04bc('0x35')]));_0x4c2b0e[_0x04bc('0x3f')]=_['merge'](_0x4c2b0e[_0x04bc('0x3f')],{'$or':[{'ListId':_0x3ecd4f['id']},{'ListId':null}]});if(_0x399a17[_0x04bc('0x33')][_0x04bc('0x3d')]){_0x4c2b0e[_0x04bc('0x3f')]=_[_0x04bc('0x3e')](_0x4c2b0e[_0x04bc('0x3f')],{'$or':_[_0x04bc('0x2d')](_0x4c2b0e['attributes'],function(_0x48c19b){var _0x3db07a={};_0x3db07a[_0x48c19b]={'$like':'%'+_0x399a17[_0x04bc('0x33')][_0x04bc('0x3d')]+'%'};return _0x3db07a;})});}_0x4c2b0e=_[_0x04bc('0x3e')]({},_0x4c2b0e,_0x399a17[_0x04bc('0x47')]);return db[_0x04bc('0x68')][_0x04bc('0x87')](_0x4c2b0e);}})[_0x04bc('0x24')](respondWithResult(_0x3a2d6b,null))[_0x04bc('0x49')](handleError(_0x3a2d6b,null));};exports[_0x04bc('0x88')]=function(_0xf26561,_0x417215,_0x10e419){return db['CmList']['find']({'where':{'id':_0xf26561[_0x04bc('0x45')]['id']}})[_0x04bc('0x24')](handleEntityNotFound(_0x417215,null))['then'](function(_0x2a0fab){if(_0x2a0fab){return _0x2a0fab[_0x04bc('0x88')](_0xf26561['body'][_0x04bc('0x89')],_['omit'](_0xf26561['body'],['ids','id'])||{})[_0x04bc('0x8a')](function(_0x2cd41e){for(var _0x2caaba=0x0;_0x2caaba<_0xf26561[_0x04bc('0x4b')][_0x04bc('0x89')][_0x04bc('0x38')];_0x2caaba+=0x1){socket[_0x04bc('0x8b')](_0x04bc('0x8c'),{'UserId':Number(_0xf26561[_0x04bc('0x4b')][_0x04bc('0x89')][_0x2caaba]),'CmListId':Number(_0xf26561[_0x04bc('0x45')]['id'])});}return _0x2cd41e;});}})[_0x04bc('0x24')](respondWithResult(_0x417215,null))[_0x04bc('0x49')](handleError(_0x417215,null));};exports['removeAgents']=function(_0x5b2695,_0x45909e,_0x1edbd8){return db[_0x04bc('0x2e')][_0x04bc('0x48')]({'where':{'id':_0x5b2695[_0x04bc('0x45')]['id']}})[_0x04bc('0x24')](handleEntityNotFound(_0x45909e,null))['then'](function(_0x3e1e73){if(_0x3e1e73){return _0x3e1e73[_0x04bc('0x8d')](_0x5b2695[_0x04bc('0x33')]['ids'])['then'](function(){if(_[_0x04bc('0x5e')](_0x5b2695[_0x04bc('0x33')]['ids'])){for(var _0x3f65b7=0x0;_0x3f65b7<_0x5b2695[_0x04bc('0x33')]['ids'][_0x04bc('0x38')];_0x3f65b7+=0x1){socket[_0x04bc('0x8b')](_0x04bc('0x8e'),{'UserId':Number(_0x5b2695[_0x04bc('0x33')][_0x04bc('0x89')][_0x3f65b7]),'CmListId':Number(_0x5b2695['params']['id'])});}}else{socket[_0x04bc('0x8b')](_0x04bc('0x8e'),{'UserId':Number(_0x5b2695[_0x04bc('0x33')]['ids']),'CmListId':Number(_0x5b2695[_0x04bc('0x45')]['id'])});}});}})[_0x04bc('0x24')](respondWithStatusCode(_0x45909e,null))[_0x04bc('0x49')](handleError(_0x45909e,null));};exports['getAgents']=function(_0x2ccd91,_0x209c00,_0x506bda){var _0x10635d={};var _0x4ad676={};var _0x391fd9;var _0x689cc;return db[_0x04bc('0x2e')][_0x04bc('0x58')]({'where':{'id':_0x2ccd91[_0x04bc('0x45')]['id']}})[_0x04bc('0x24')](handleEntityNotFound(_0x209c00,null))[_0x04bc('0x24')](function(_0x2cdd87){if(_0x2cdd87){_0x391fd9=_0x2cdd87;_0x4ad676['model']=_[_0x04bc('0x34')](db[_0x04bc('0x8f')][_0x04bc('0x2f')]);_0x4ad676[_0x04bc('0x33')]=_[_0x04bc('0x34')](_0x2ccd91['query']);_0x4ad676[_0x04bc('0x35')]=_[_0x04bc('0x36')](_0x4ad676['model'],_0x4ad676[_0x04bc('0x33')]);_0x10635d[_0x04bc('0x37')]=_['intersection'](_0x4ad676[_0x04bc('0x32')],qs['fields'](_0x2ccd91[_0x04bc('0x33')]['fields']));_0x10635d['attributes']=_0x10635d['attributes'][_0x04bc('0x38')]?_0x10635d[_0x04bc('0x37')]:_0x4ad676[_0x04bc('0x32')];_0x10635d[_0x04bc('0x3a')]=qs[_0x04bc('0x3b')](_0x2ccd91[_0x04bc('0x33')][_0x04bc('0x3b')]);_0x10635d[_0x04bc('0x3f')]=qs[_0x04bc('0x35')](_['pick'](_0x2ccd91[_0x04bc('0x33')],_0x4ad676['filters']));if(_0x2ccd91[_0x04bc('0x33')][_0x04bc('0x3d')]){_0x10635d['where']=_['merge'](_0x10635d[_0x04bc('0x3f')],{'$or':_[_0x04bc('0x2d')](_0x10635d[_0x04bc('0x37')],function(_0x226a2d){var _0x118583={};_0x118583[_0x226a2d]={'$like':'%'+_0x2ccd91[_0x04bc('0x33')][_0x04bc('0x3d')]+'%'};return _0x118583;})});}_0x10635d=_[_0x04bc('0x3e')]({},_0x10635d,_0x2ccd91[_0x04bc('0x47')]);return _0x391fd9[_0x04bc('0x90')](_0x10635d);}})['then'](function(_0x18e8c3){if(_0x18e8c3){_0x689cc=_0x18e8c3[_0x04bc('0x38')];if(!_0x2ccd91[_0x04bc('0x33')][_0x04bc('0x39')](_0x04bc('0x59'))){_0x10635d[_0x04bc('0x20')]=qs[_0x04bc('0x20')](_0x2ccd91[_0x04bc('0x33')]['limit']);_0x10635d['offset']=qs[_0x04bc('0x1e')](_0x2ccd91[_0x04bc('0x33')][_0x04bc('0x1e')]);}return _0x391fd9[_0x04bc('0x90')](_0x10635d);}})['then'](function(_0xd65c3f){if(_0xd65c3f){return _0xd65c3f?{'count':_0x689cc,'rows':_0xd65c3f}:null;}})[_0x04bc('0x24')](respondWithResult(_0x209c00,null))['catch'](handleError(_0x209c00,null));}; \ No newline at end of file +var _0x1c9c=['stack','name','send','index','map','CmList','rawAttributes','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','count','include','rows','catch','show','params','includeAll','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','Disposition','getDispositions','findOne','ListId','findAll','removeDispositions','addContacts','CmContact','isArray','tags','push','each','omit','dataValues','errors','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','concat','format','cf_%d','raw','getContactsCsv','now','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv','download','addCustomField','sequelize','addCustomFields','Sequelize','TEXT','type','text','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cf_%s','addAgents','ids','spread','userCmList:save','removeAgents','emit','userCmList:remove','User','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./cmList.socket','register','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','reject','save','then','destroy','Lists'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0x1c9c,0x67));var _0xc1c9=function(_0x32b4aa,_0x12eba6){_0x32b4aa=_0x32b4aa-0x0;var _0x473160=_0x1c9c[_0x32b4aa];return _0x473160;};'use strict';var emlformat=require(_0xc1c9('0x0'));var rimraf=require(_0xc1c9('0x1'));var zipdir=require(_0xc1c9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc1c9('0x3'));var moment=require(_0xc1c9('0x4'));var BPromise=require(_0xc1c9('0x5'));var Mustache=require(_0xc1c9('0x6'));var util=require('util');var path=require(_0xc1c9('0x7'));var sox=require(_0xc1c9('0x8'));var csv=require(_0xc1c9('0x9'));var ejs=require(_0xc1c9('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc1c9('0xb'));var squel=require(_0xc1c9('0xc'));var crypto=require(_0xc1c9('0xd'));var jsforce=require(_0xc1c9('0xe'));var deskjs=require(_0xc1c9('0xf'));var toCsv=require('to-csv');var querystring=require(_0xc1c9('0x10'));var Papa=require(_0xc1c9('0x11'));var Redis=require(_0xc1c9('0x12'));var authService=require(_0xc1c9('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xc1c9('0x14'));var hardwareService=require(_0xc1c9('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0xc1c9('0x16'));var config=require(_0xc1c9('0x17'));var licenseUtil=require(_0xc1c9('0x18'));var db=require(_0xc1c9('0x19'))['db'];config[_0xc1c9('0x1a')]=_[_0xc1c9('0x1b')](config[_0xc1c9('0x1a')],{'host':_0xc1c9('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc1c9('0x1a')]));require(_0xc1c9('0x1d'))[_0xc1c9('0x1e')](socket);function respondWithStatusCode(_0xa4c9b8,_0x4d3702){_0x4d3702=_0x4d3702||0xcc;return function(_0x5024c4){if(_0x5024c4){return _0xa4c9b8[_0xc1c9('0x1f')](_0x4d3702);}return _0xa4c9b8[_0xc1c9('0x20')](_0x4d3702)[_0xc1c9('0x21')]();};}function respondWithResult(_0x240b04,_0x315f35){_0x315f35=_0x315f35||0xc8;return function(_0x2de13a){if(_0x2de13a){return _0x240b04[_0xc1c9('0x20')](_0x315f35)[_0xc1c9('0x22')](_0x2de13a);}};}function respondWithFilteredResult(_0x9e3234,_0x43941a){return function(_0x3747e3){if(_0x3747e3){var _0x2ae228=typeof _0x43941a[_0xc1c9('0x23')]===_0xc1c9('0x24')&&typeof _0x43941a['limit']==='undefined';var _0xc79e8=_0x3747e3['count'];var _0x3e45a9=_0x2ae228?0x0:_0x43941a[_0xc1c9('0x23')];var _0x16d928=_0x2ae228?_0x3747e3['count']:_0x43941a[_0xc1c9('0x23')]+_0x43941a[_0xc1c9('0x25')];var _0x2bad5b;if(_0x16d928>=_0xc79e8){_0x16d928=_0xc79e8;_0x2bad5b=0xc8;}else{_0x2bad5b=0xce;}_0x9e3234[_0xc1c9('0x20')](_0x2bad5b);return _0x9e3234[_0xc1c9('0x26')](_0xc1c9('0x27'),_0x3e45a9+'-'+_0x16d928+'/'+_0xc79e8)[_0xc1c9('0x22')](_0x3747e3);}return null;};}function patchUpdates(_0x2fe089){return function(_0xcddf31){try{jsonpatch['apply'](_0xcddf31,_0x2fe089,!![]);}catch(_0x54673b){return BPromise[_0xc1c9('0x28')](_0x54673b);}return _0xcddf31[_0xc1c9('0x29')]();};}function saveUpdates(_0x5e1b7e,_0x12e297){return function(_0x5d07b4){if(_0x5d07b4){return _0x5d07b4['update'](_0x5e1b7e)[_0xc1c9('0x2a')](function(_0x58d760){return _0x58d760;});}return null;};}function removeEntity(_0x510b79,_0x30f816){return function(_0x4e43ab){if(_0x4e43ab){return _0x4e43ab[_0xc1c9('0x2b')]()['then'](function(){var _0x2c37e9=_0x4e43ab['get']({'plain':!![]});var _0x32f31b=_0xc1c9('0x2c');return db['UserProfileResource'][_0xc1c9('0x2b')]({'where':{'type':_0x32f31b,'resourceId':_0x2c37e9['id']}})[_0xc1c9('0x2a')](function(){return _0x4e43ab;});})['then'](function(){_0x510b79[_0xc1c9('0x20')](0xcc)[_0xc1c9('0x21')]();});}};}function handleEntityNotFound(_0x2db696,_0x306d4d){return function(_0x50e22f){if(!_0x50e22f){_0x2db696[_0xc1c9('0x1f')](0x194);}return _0x50e22f;};}function handleError(_0x503a0c,_0x521c91){_0x521c91=_0x521c91||0x1f4;return function(_0x81d856){logger['error'](_0x81d856[_0xc1c9('0x2d')]);if(_0x81d856[_0xc1c9('0x2e')]){delete _0x81d856[_0xc1c9('0x2e')];}_0x503a0c[_0xc1c9('0x20')](_0x521c91)[_0xc1c9('0x2f')](_0x81d856);};}exports[_0xc1c9('0x30')]=function(_0x320117,_0x109c0f){var _0x473a47={},_0xf8d412={},_0x3755f9={'count':0x0,'rows':[]};var _0x4504a4=_[_0xc1c9('0x31')](db[_0xc1c9('0x32')][_0xc1c9('0x33')],function(_0x524ddb){return{'name':_0x524ddb['fieldName'],'type':_0x524ddb['type']['key']};});_0xf8d412['model']=_['map'](_0x4504a4,_0xc1c9('0x2e'));_0xf8d412[_0xc1c9('0x34')]=_[_0xc1c9('0x35')](_0x320117[_0xc1c9('0x34')]);_0xf8d412[_0xc1c9('0x36')]=_[_0xc1c9('0x37')](_0xf8d412[_0xc1c9('0x38')],_0xf8d412[_0xc1c9('0x34')]);_0x473a47[_0xc1c9('0x39')]=_[_0xc1c9('0x37')](_0xf8d412[_0xc1c9('0x38')],qs[_0xc1c9('0x3a')](_0x320117[_0xc1c9('0x34')][_0xc1c9('0x3a')]));_0x473a47['attributes']=_0x473a47['attributes'][_0xc1c9('0x3b')]?_0x473a47[_0xc1c9('0x39')]:_0xf8d412[_0xc1c9('0x38')];if(!_0x320117[_0xc1c9('0x34')][_0xc1c9('0x3c')](_0xc1c9('0x3d'))){_0x473a47[_0xc1c9('0x25')]=qs[_0xc1c9('0x25')](_0x320117[_0xc1c9('0x34')]['limit']);_0x473a47[_0xc1c9('0x23')]=qs[_0xc1c9('0x23')](_0x320117[_0xc1c9('0x34')][_0xc1c9('0x23')]);}_0x473a47[_0xc1c9('0x3e')]=qs[_0xc1c9('0x3f')](_0x320117['query'][_0xc1c9('0x3f')]);_0x473a47[_0xc1c9('0x40')]=qs[_0xc1c9('0x36')](_[_0xc1c9('0x41')](_0x320117[_0xc1c9('0x34')],_0xf8d412['filters']),_0x4504a4);if(_0x320117[_0xc1c9('0x34')][_0xc1c9('0x42')]){_0x473a47['where']=_[_0xc1c9('0x43')](_0x473a47[_0xc1c9('0x40')],{'$or':_['map'](_0x4504a4,function(_0x10b51b){if(_0x10b51b['type']!=='VIRTUAL'){var _0x350f92={};_0x350f92[_0x10b51b[_0xc1c9('0x2e')]]={'$like':'%'+_0x320117[_0xc1c9('0x34')][_0xc1c9('0x42')]+'%'};return _0x350f92;}})});}_0x473a47=_[_0xc1c9('0x43')]({},_0x473a47,_0x320117[_0xc1c9('0x44')]);var _0x4a4707={'where':_0x473a47[_0xc1c9('0x40')]};return db[_0xc1c9('0x32')][_0xc1c9('0x45')](_0x4a4707)[_0xc1c9('0x2a')](function(_0x35a850){_0x3755f9[_0xc1c9('0x45')]=_0x35a850;if(_0x320117[_0xc1c9('0x34')]['includeAll']){_0x473a47[_0xc1c9('0x46')]=[{'all':!![]}];}return db['CmList']['findAll'](_0x473a47);})[_0xc1c9('0x2a')](function(_0x45c51a){_0x3755f9[_0xc1c9('0x47')]=_0x45c51a;return _0x3755f9;})[_0xc1c9('0x2a')](respondWithFilteredResult(_0x109c0f,_0x473a47))[_0xc1c9('0x48')](handleError(_0x109c0f,null));};exports[_0xc1c9('0x49')]=function(_0x23eb93,_0x1ac293){var _0x39a6e5={'raw':![],'where':{'id':_0x23eb93[_0xc1c9('0x4a')]['id']}},_0xf1ec54={};_0xf1ec54[_0xc1c9('0x38')]=_[_0xc1c9('0x35')](db[_0xc1c9('0x32')]['rawAttributes']);_0xf1ec54[_0xc1c9('0x34')]=_[_0xc1c9('0x35')](_0x23eb93[_0xc1c9('0x34')]);_0xf1ec54[_0xc1c9('0x36')]=_[_0xc1c9('0x37')](_0xf1ec54[_0xc1c9('0x38')],_0xf1ec54[_0xc1c9('0x34')]);_0x39a6e5[_0xc1c9('0x39')]=_[_0xc1c9('0x37')](_0xf1ec54['model'],qs[_0xc1c9('0x3a')](_0x23eb93[_0xc1c9('0x34')][_0xc1c9('0x3a')]));_0x39a6e5[_0xc1c9('0x39')]=_0x39a6e5[_0xc1c9('0x39')][_0xc1c9('0x3b')]?_0x39a6e5[_0xc1c9('0x39')]:_0xf1ec54[_0xc1c9('0x38')];if(_0x23eb93[_0xc1c9('0x34')][_0xc1c9('0x4b')]){_0x39a6e5[_0xc1c9('0x46')]=[{'all':!![]}];}_0x39a6e5=_['merge']({},_0x39a6e5,_0x23eb93[_0xc1c9('0x44')]);return db[_0xc1c9('0x32')][_0xc1c9('0x4c')](_0x39a6e5)[_0xc1c9('0x2a')](handleEntityNotFound(_0x1ac293,null))[_0xc1c9('0x2a')](respondWithResult(_0x1ac293,null))[_0xc1c9('0x48')](handleError(_0x1ac293,null));};exports['create']=function(_0xbeb1bb,_0xa70803){return db['CmList'][_0xc1c9('0x4d')](_0xbeb1bb[_0xc1c9('0x4e')],{})[_0xc1c9('0x2a')](function(_0x1023cc){var _0x5334a5=_0xbeb1bb[_0xc1c9('0x4f')][_0xc1c9('0x50')]({'plain':!![]});if(!_0x5334a5)throw new Error(_0xc1c9('0x51'));if(_0x5334a5[_0xc1c9('0x52')]===_0xc1c9('0x4f')){var _0x21cdf6=_0x1023cc['get']({'plain':!![]});var _0x2414b9=_0xc1c9('0x2c');return db['UserProfileSection'][_0xc1c9('0x4c')]({'where':{'name':_0x2414b9,'userProfileId':_0x5334a5[_0xc1c9('0x53')]},'raw':!![]})[_0xc1c9('0x2a')](function(_0xb44c4d){if(_0xb44c4d&&_0xb44c4d[_0xc1c9('0x54')]===0x0){return db[_0xc1c9('0x55')][_0xc1c9('0x4d')]({'name':_0x21cdf6[_0xc1c9('0x2e')],'resourceId':_0x21cdf6['id'],'type':_0xb44c4d['name'],'sectionId':_0xb44c4d['id']},{})[_0xc1c9('0x2a')](function(){return _0x1023cc;});}else{return _0x1023cc;}})[_0xc1c9('0x48')](function(_0x2cb09c){logger[_0xc1c9('0x56')](_0xc1c9('0x57'),_0x2cb09c);throw _0x2cb09c;});}return _0x1023cc;})['then'](respondWithResult(_0xa70803,0xc9))[_0xc1c9('0x48')](handleError(_0xa70803,null));};exports[_0xc1c9('0x58')]=function(_0x58c2cc,_0x3cf5e8){if(_0x58c2cc[_0xc1c9('0x4e')]['id']){delete _0x58c2cc[_0xc1c9('0x4e')]['id'];}return db[_0xc1c9('0x32')][_0xc1c9('0x4c')]({'where':{'id':_0x58c2cc[_0xc1c9('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3cf5e8,null))[_0xc1c9('0x2a')](saveUpdates(_0x58c2cc[_0xc1c9('0x4e')],null))[_0xc1c9('0x2a')](respondWithResult(_0x3cf5e8,null))[_0xc1c9('0x48')](handleError(_0x3cf5e8,null));};exports[_0xc1c9('0x2b')]=function(_0x14a9ce,_0x14d7bf){return db['CmList'][_0xc1c9('0x4c')]({'where':{'id':_0x14a9ce[_0xc1c9('0x4a')]['id']}})[_0xc1c9('0x2a')](handleEntityNotFound(_0x14d7bf,null))[_0xc1c9('0x2a')](removeEntity(_0x14d7bf,null))[_0xc1c9('0x48')](handleError(_0x14d7bf,null));};exports[_0xc1c9('0x59')]=function(_0x3617cb,_0x3825f1){return db[_0xc1c9('0x32')]['describe']()[_0xc1c9('0x2a')](respondWithResult(_0x3825f1,null))[_0xc1c9('0x48')](handleError(_0x3825f1,null));};exports['addDisposition']=function(_0x4a2ccd,_0x56744a,_0x3229d1){if(_0x4a2ccd[_0xc1c9('0x4e')]['id']){delete _0x4a2ccd[_0xc1c9('0x4e')]['id'];}return db['CmList'][_0xc1c9('0x4c')]({'where':{'id':_0x4a2ccd['params']['id']}})['then'](handleEntityNotFound(_0x56744a,null))['then'](function(_0x66ca25){if(_0x66ca25){_0x4a2ccd['body']['ListId']=_0x66ca25['id'];return db[_0xc1c9('0x5a')][_0xc1c9('0x4d')](_0x4a2ccd[_0xc1c9('0x4e')]);}})[_0xc1c9('0x2a')](respondWithResult(_0x56744a,null))[_0xc1c9('0x48')](handleError(_0x56744a,null));};exports[_0xc1c9('0x5b')]=function(_0x273dad,_0x2a3394,_0x5cda12){var _0x7ee89a={'raw':![],'where':{}};var _0x2112a1={};var _0x24f511={'count':0x0,'rows':[]};return db[_0xc1c9('0x32')][_0xc1c9('0x5c')]({'where':{'id':_0x273dad[_0xc1c9('0x4a')]['id']}})[_0xc1c9('0x2a')](handleEntityNotFound(_0x2a3394,null))['then'](function(_0x2f50ee){if(_0x2f50ee){_0x2112a1[_0xc1c9('0x38')]=_[_0xc1c9('0x35')](db['Disposition']['rawAttributes']);_0x2112a1['query']=_['keys'](_0x273dad['query']);_0x2112a1[_0xc1c9('0x36')]=_[_0xc1c9('0x37')](_0x2112a1['model'],_0x2112a1[_0xc1c9('0x34')]);_0x7ee89a['attributes']=_['intersection'](_0x2112a1['model'],qs['fields'](_0x273dad['query'][_0xc1c9('0x3a')]));_0x7ee89a['attributes']=_0x7ee89a[_0xc1c9('0x39')]['length']?_0x7ee89a[_0xc1c9('0x39')]:_0x2112a1[_0xc1c9('0x38')];if(!_0x273dad[_0xc1c9('0x34')][_0xc1c9('0x3c')](_0xc1c9('0x3d'))){_0x7ee89a[_0xc1c9('0x25')]=qs[_0xc1c9('0x25')](_0x273dad[_0xc1c9('0x34')][_0xc1c9('0x25')]);_0x7ee89a[_0xc1c9('0x23')]=qs[_0xc1c9('0x23')](_0x273dad['query'][_0xc1c9('0x23')]);}_0x7ee89a[_0xc1c9('0x3e')]=qs[_0xc1c9('0x3f')](_0x273dad[_0xc1c9('0x34')]['sort']);_0x7ee89a[_0xc1c9('0x40')]=qs[_0xc1c9('0x36')](_[_0xc1c9('0x41')](_0x273dad[_0xc1c9('0x34')],_0x2112a1[_0xc1c9('0x36')]));_0x7ee89a[_0xc1c9('0x40')][_0xc1c9('0x5d')]=_0x2f50ee['id'];if(_0x273dad['query'][_0xc1c9('0x42')]){_0x7ee89a[_0xc1c9('0x40')]=_['merge'](_0x7ee89a[_0xc1c9('0x40')],{'$or':_['map'](_0x7ee89a[_0xc1c9('0x39')],function(_0x5d4194){var _0x1dcf2e={};_0x1dcf2e[_0x5d4194]={'$like':'%'+_0x273dad[_0xc1c9('0x34')][_0xc1c9('0x42')]+'%'};return _0x1dcf2e;})});}_0x7ee89a=_[_0xc1c9('0x43')]({},_0x7ee89a,_0x273dad['options']);return db['Disposition'][_0xc1c9('0x45')]({'where':_0x7ee89a['where']})['then'](function(_0x4c4929){_0x24f511[_0xc1c9('0x45')]=_0x4c4929;if(_0x273dad[_0xc1c9('0x34')][_0xc1c9('0x4b')]){_0x7ee89a[_0xc1c9('0x46')]=[{'all':!![]}];}return db[_0xc1c9('0x5a')][_0xc1c9('0x5e')](_0x7ee89a);})[_0xc1c9('0x2a')](function(_0x27277c){_0x24f511[_0xc1c9('0x47')]=_0x27277c;return _0x24f511;});}})[_0xc1c9('0x2a')](respondWithFilteredResult(_0x2a3394,_0x7ee89a))['catch'](handleError(_0x2a3394,null));};exports['removeDispositions']=function(_0x1a6c4b,_0x6d6e01,_0x4277ba){return db[_0xc1c9('0x32')][_0xc1c9('0x4c')]({'where':{'id':_0x1a6c4b[_0xc1c9('0x4a')]['id']}})[_0xc1c9('0x2a')](handleEntityNotFound(_0x6d6e01,null))[_0xc1c9('0x2a')](function(_0x1a7fd5){if(_0x1a7fd5){return _0x1a7fd5[_0xc1c9('0x5f')](_0x1a6c4b[_0xc1c9('0x34')]['ids']);}})['then'](respondWithStatusCode(_0x6d6e01,null))[_0xc1c9('0x48')](handleError(_0x6d6e01,null));};exports[_0xc1c9('0x60')]=function(_0x5c9f9f,_0xa96d80,_0xc3457a){return db[_0xc1c9('0x32')][_0xc1c9('0x4c')]({'where':{'id':_0x5c9f9f['params']['id']}})[_0xc1c9('0x2a')](handleEntityNotFound(_0xa96d80,null))[_0xc1c9('0x2a')](function(_0x285e3b){if(_0x285e3b){var _0x1d07ec=[];var _0x3a9677={'success':[],'errors':[]};return db[_0xc1c9('0x61')][_0xc1c9('0x59')]()[_0xc1c9('0x2a')](function(_0xa8fbff){if(_0x5c9f9f[_0xc1c9('0x4e')]['tags']&&_[_0xc1c9('0x62')](_0x5c9f9f[_0xc1c9('0x4e')]['tags'])){if(_0x5c9f9f[_0xc1c9('0x4e')][_0xc1c9('0x63')][_0xc1c9('0x3b')]){_0x5c9f9f['body'][_0xc1c9('0x63')]=_0x5c9f9f[_0xc1c9('0x4e')]['tags']['join'](';')+';';}else{_0x5c9f9f[_0xc1c9('0x4e')]['tags']=null;}}else{_0x5c9f9f['body']['tags']=null;}if(_0x5c9f9f[_0xc1c9('0x4e')]&&_[_0xc1c9('0x62')](_0x5c9f9f[_0xc1c9('0x4e')])){for(var _0x1d8731=0x0;_0x1d8731<_0x5c9f9f['body'][_0xc1c9('0x3b')];_0x1d8731+=0x1){_0x5c9f9f[_0xc1c9('0x4e')][_0x1d8731][_0xc1c9('0x5d')]=_0x5c9f9f[_0xc1c9('0x4a')]['id'];_0x1d07ec[_0xc1c9('0x64')](_0x5c9f9f[_0xc1c9('0x4e')][_0x1d8731]);}return BPromise[_0xc1c9('0x65')](_0x1d07ec,function(_0x3b16a4){return db[_0xc1c9('0x61')][_0xc1c9('0x4d')](_[_0xc1c9('0x66')](_0x3b16a4,['ids','id'])||{},{'fields':_[_0xc1c9('0x35')](_0xa8fbff),'raw':!![]})[_0xc1c9('0x2a')](function(_0x477824){_0x3a9677['success'][_0xc1c9('0x64')](_0x477824[_0xc1c9('0x67')]);})[_0xc1c9('0x48')](function(_0x997218){_0x3a9677[_0xc1c9('0x68')][_0xc1c9('0x64')]({'data':_0x3b16a4,'error':_0x997218[_0xc1c9('0x69')]});});})[_0xc1c9('0x2a')](function(_0xaf2025){return _0x3a9677;})[_0xc1c9('0x48')](function(_0x1b7474){return _0x1b7474;});}else{_0xa96d80[_0xc1c9('0x20')](0x190)[_0xc1c9('0x22')]({'message':_0xc1c9('0x6a')});}});}})[_0xc1c9('0x2a')](respondWithResult(_0xa96d80,null))[_0xc1c9('0x48')](handleError(_0xa96d80,null));};exports[_0xc1c9('0x6b')]=function(_0x29c5ac,_0x265d97,_0x1eba49){var _0x23d9a1;return db[_0xc1c9('0x32')][_0xc1c9('0x4c')]({'where':{'id':_0x29c5ac['params']['id']},'include':[{'model':db[_0xc1c9('0x6c')],'as':_0xc1c9('0x6d')}]})['then'](handleEntityNotFound(_0x265d97,null))[_0xc1c9('0x2a')](function(_0x140f9c){if(_0x140f9c){_0x23d9a1=_0x140f9c;return db[_0xc1c9('0x61')][_0xc1c9('0x33')];}})[_0xc1c9('0x2a')](function(_0x42e884){if(_0x42e884){var _0x383a04={};var _0x22b42c={};_0x22b42c['model']=_[_0xc1c9('0x6e')](_[_0xc1c9('0x35')](_0x42e884),_['map'](_0x23d9a1[_0xc1c9('0x6d')],function(_0x2b570f){return util[_0xc1c9('0x6f')](_0xc1c9('0x70'),_0x2b570f['id']);}));_0x22b42c[_0xc1c9('0x34')]=_['keys'](_0x29c5ac[_0xc1c9('0x34')]);_0x22b42c[_0xc1c9('0x36')]=_[_0xc1c9('0x37')](_0x22b42c[_0xc1c9('0x38')],_0x22b42c['query']);_0x383a04[_0xc1c9('0x39')]=_[_0xc1c9('0x37')](_0x22b42c[_0xc1c9('0x38')],qs[_0xc1c9('0x3a')](_0x29c5ac['query']['fields']));_0x383a04[_0xc1c9('0x39')]=_0x383a04[_0xc1c9('0x39')][_0xc1c9('0x3b')]?_0x383a04[_0xc1c9('0x39')]:_0x22b42c[_0xc1c9('0x38')];if(!_0x29c5ac[_0xc1c9('0x34')][_0xc1c9('0x3c')]('nolimit')){_0x383a04[_0xc1c9('0x25')]=qs[_0xc1c9('0x25')](_0x29c5ac[_0xc1c9('0x34')][_0xc1c9('0x25')]);_0x383a04[_0xc1c9('0x23')]=qs[_0xc1c9('0x23')](_0x29c5ac['query'][_0xc1c9('0x23')]);}_0x383a04[_0xc1c9('0x3e')]=qs[_0xc1c9('0x3f')](_0x29c5ac[_0xc1c9('0x34')]['sort']);_0x383a04[_0xc1c9('0x40')]=qs['filters'](_['pick'](_0x29c5ac['query'],_0x22b42c['filters']));_0x383a04[_0xc1c9('0x71')]=!![];if(_0x29c5ac['query'][_0xc1c9('0x42')]){_0x383a04[_0xc1c9('0x40')]=_[_0xc1c9('0x43')](_0x383a04[_0xc1c9('0x40')],{'$or':_[_0xc1c9('0x31')](_0x383a04[_0xc1c9('0x39')],function(_0x4b510d){var _0x1439ad={};_0x1439ad[_0x4b510d]={'$like':'%'+_0x29c5ac[_0xc1c9('0x34')][_0xc1c9('0x42')]+'%'};return _0x1439ad;})});}_0x383a04=_['merge']({},_0x383a04,_0x29c5ac[_0xc1c9('0x44')]);return _0x23d9a1[_0xc1c9('0x6b')](_0x383a04);}})[_0xc1c9('0x2a')](respondWithResult(_0x265d97,null))['catch'](handleError(_0x265d97,null));};exports[_0xc1c9('0x72')]=function(_0x2394bc,_0x11c66f,_0x4af6d7){var _0x54449d;return db[_0xc1c9('0x32')]['find']({'where':{'id':_0x2394bc[_0xc1c9('0x4a')]['id']},'include':[{'model':db[_0xc1c9('0x6c')],'as':_0xc1c9('0x6d')}]})[_0xc1c9('0x2a')](handleEntityNotFound(_0x11c66f,null))['then'](function(_0x5e2f61){if(_0x5e2f61){_0x54449d=_0x5e2f61;return db['CmContact']['rawAttributes'];}})[_0xc1c9('0x2a')](function(_0x382038){if(_0x382038){var _0x288d97={};var _0x21f6d6={};_0x21f6d6[_0xc1c9('0x38')]=_[_0xc1c9('0x6e')](_[_0xc1c9('0x35')](_0x382038),_['map'](_0x54449d[_0xc1c9('0x6d')],function(_0x1adb43){return util['format']('cf_%d',_0x1adb43['id']);}));_0x21f6d6[_0xc1c9('0x34')]=_[_0xc1c9('0x35')](_0x2394bc['query']);_0x21f6d6[_0xc1c9('0x36')]=_[_0xc1c9('0x37')](_0x21f6d6[_0xc1c9('0x38')],_0x21f6d6['query']);_0x288d97['attributes']=_[_0xc1c9('0x37')](_0x21f6d6['model'],qs[_0xc1c9('0x3a')](_0x2394bc[_0xc1c9('0x34')][_0xc1c9('0x3a')]));_0x288d97[_0xc1c9('0x39')]=_0x288d97[_0xc1c9('0x39')][_0xc1c9('0x3b')]?_0x288d97[_0xc1c9('0x39')]:_0x21f6d6[_0xc1c9('0x38')];if(!_0x2394bc[_0xc1c9('0x34')][_0xc1c9('0x3c')](_0xc1c9('0x3d'))){_0x288d97['limit']=qs['limit'](_0x2394bc[_0xc1c9('0x34')][_0xc1c9('0x25')]);_0x288d97['offset']=qs['offset'](_0x2394bc['query']['offset']);}_0x288d97[_0xc1c9('0x3e')]=qs[_0xc1c9('0x3f')](_0x2394bc[_0xc1c9('0x34')][_0xc1c9('0x3f')]);_0x288d97[_0xc1c9('0x40')]=qs[_0xc1c9('0x36')](_[_0xc1c9('0x41')](_0x2394bc[_0xc1c9('0x34')],_0x21f6d6[_0xc1c9('0x36')]));_0x288d97['raw']=!![];if(_0x2394bc[_0xc1c9('0x34')][_0xc1c9('0x42')]){_0x288d97[_0xc1c9('0x40')]=_[_0xc1c9('0x43')](_0x288d97['where'],{'$or':_[_0xc1c9('0x31')](_0x288d97[_0xc1c9('0x39')],function(_0x31ebb9){var _0xa5840c={};_0xa5840c[_0x31ebb9]={'$like':'%'+_0x2394bc[_0xc1c9('0x34')][_0xc1c9('0x42')]+'%'};return _0xa5840c;})});}_0x288d97=_[_0xc1c9('0x43')]({},_0x288d97,_0x2394bc['options']);return _0x54449d['getContacts'](_0x288d97);}})['then'](function(_0x724de2){if(!_['isEmpty'](_0x724de2)){var _0x29023f=toCsv(_0x724de2);var _0x57d5d1=Date[_0xc1c9('0x73')]();fs['writeFileSync'](util[_0xc1c9('0x6f')](_0xc1c9('0x74'),_0x54449d['id'],_0x57d5d1),_0x29023f);_0x11c66f[_0xc1c9('0x75')](_0xc1c9('0x76'),_0xc1c9('0x77')+util[_0xc1c9('0x6f')](_0xc1c9('0x78'),_0x54449d['id'],_0x57d5d1));_0x11c66f['setHeader'](_0xc1c9('0x79'),_0xc1c9('0x7a'));return _0x11c66f[_0xc1c9('0x7b')](util[_0xc1c9('0x6f')](_0xc1c9('0x74'),_0x54449d['id'],_0x57d5d1));}else{return _0x11c66f[_0xc1c9('0x1f')](0xcc);}})[_0xc1c9('0x48')](handleError(_0x11c66f,null));};exports[_0xc1c9('0x7c')]=function(_0x1c5591,_0x2ef6af,_0x1057c5){var _0x28fff1;delete _0x1c5591[_0xc1c9('0x4e')]['id'];return db[_0xc1c9('0x32')]['findOne']({'where':{'id':_0x1c5591[_0xc1c9('0x4a')]['id']}})[_0xc1c9('0x2a')](handleEntityNotFound(_0x2ef6af,null))[_0xc1c9('0x2a')](function(_0x2300c2){if(_0x2300c2){return db[_0xc1c9('0x7d')]['transaction'](function(_0x80d35c){return db[_0xc1c9('0x6c')][_0xc1c9('0x4d')](_0x1c5591[_0xc1c9('0x4e')],{'transaction':_0x80d35c})[_0xc1c9('0x2a')](function(_0xa5d6c9){_0x28fff1=_0xa5d6c9;return _0x2300c2[_0xc1c9('0x7e')](_0xa5d6c9,{'transaction':_0x80d35c});})[_0xc1c9('0x2a')](function(){var _0x16b129={'type':db[_0xc1c9('0x7f')][_0xc1c9('0x80')],'transaction':_0x80d35c};switch(_0x1c5591[_0xc1c9('0x4e')][_0xc1c9('0x81')]){case _0xc1c9('0x82'):_0x16b129[_0xc1c9('0x81')]=db[_0xc1c9('0x7f')][_0xc1c9('0x80')];break;case _0xc1c9('0x83'):_0x16b129[_0xc1c9('0x81')]=db[_0xc1c9('0x7f')][_0xc1c9('0x84')];break;case _0xc1c9('0x85'):_0x16b129[_0xc1c9('0x81')]=db[_0xc1c9('0x7f')][_0xc1c9('0x86')];_0x16b129[_0xc1c9('0x87')]=![];break;default:}return db[_0xc1c9('0x7d')][_0xc1c9('0x88')][_0xc1c9('0x89')]('cm_contacts',util['format'](_0xc1c9('0x8a'),_0x28fff1['id']),_0x16b129);})[_0xc1c9('0x2a')](function(){return _0x28fff1;});});}})['then'](respondWithResult(_0x2ef6af,null))['catch'](handleError(_0x2ef6af,null));};exports['getCustomFields']=function(_0x3e3265,_0x2e2699,_0x578ff5){var _0x23054f={};var _0x1a0b88={};var _0x33f05b;var _0x1a5719;return db[_0xc1c9('0x32')][_0xc1c9('0x5c')]({'where':{'id':_0x3e3265[_0xc1c9('0x4a')]['id']}})[_0xc1c9('0x2a')](handleEntityNotFound(_0x2e2699,null))[_0xc1c9('0x2a')](function(_0x113cbd){if(_0x113cbd){_0x33f05b=_0x113cbd;_0x1a0b88[_0xc1c9('0x38')]=_[_0xc1c9('0x35')](db[_0xc1c9('0x6c')][_0xc1c9('0x33')]);_0x1a0b88[_0xc1c9('0x34')]=_[_0xc1c9('0x35')](_0x3e3265[_0xc1c9('0x34')]);_0x1a0b88[_0xc1c9('0x36')]=_['intersection'](_0x1a0b88[_0xc1c9('0x38')],_0x1a0b88['query']);_0x23054f['attributes']=_[_0xc1c9('0x37')](_0x1a0b88['model'],qs[_0xc1c9('0x3a')](_0x3e3265[_0xc1c9('0x34')][_0xc1c9('0x3a')]));_0x23054f[_0xc1c9('0x39')]=_0x23054f[_0xc1c9('0x39')][_0xc1c9('0x3b')]?_0x23054f[_0xc1c9('0x39')]:_0x1a0b88[_0xc1c9('0x38')];_0x23054f[_0xc1c9('0x3e')]=qs['sort'](_0x3e3265['query']['sort']);_0x23054f[_0xc1c9('0x40')]=qs['filters'](_[_0xc1c9('0x41')](_0x3e3265['query'],_0x1a0b88['filters']));_0x23054f['where']=_[_0xc1c9('0x43')](_0x23054f['where'],{'$or':[{'ListId':_0x113cbd['id']},{'ListId':null}]});if(_0x3e3265[_0xc1c9('0x34')][_0xc1c9('0x42')]){_0x23054f[_0xc1c9('0x40')]=_[_0xc1c9('0x43')](_0x23054f['where'],{'$or':_[_0xc1c9('0x31')](_0x23054f[_0xc1c9('0x39')],function(_0x82d6e9){var _0xbe3529={};_0xbe3529[_0x82d6e9]={'$like':'%'+_0x3e3265['query']['filter']+'%'};return _0xbe3529;})});}_0x23054f=_['merge']({},_0x23054f,_0x3e3265[_0xc1c9('0x44')]);return db[_0xc1c9('0x6c')]['findAndCountAll'](_0x23054f);}})[_0xc1c9('0x2a')](respondWithResult(_0x2e2699,null))[_0xc1c9('0x48')](handleError(_0x2e2699,null));};exports[_0xc1c9('0x8b')]=function(_0x558231,_0x545673,_0x34dc1e){return db[_0xc1c9('0x32')][_0xc1c9('0x4c')]({'where':{'id':_0x558231[_0xc1c9('0x4a')]['id']}})[_0xc1c9('0x2a')](handleEntityNotFound(_0x545673,null))[_0xc1c9('0x2a')](function(_0x1df121){if(_0x1df121){return _0x1df121[_0xc1c9('0x8b')](_0x558231[_0xc1c9('0x4e')]['ids'],_[_0xc1c9('0x66')](_0x558231[_0xc1c9('0x4e')],[_0xc1c9('0x8c'),'id'])||{})[_0xc1c9('0x8d')](function(_0x336de8){for(var _0x2177f4=0x0;_0x2177f4<_0x558231[_0xc1c9('0x4e')][_0xc1c9('0x8c')][_0xc1c9('0x3b')];_0x2177f4+=0x1){socket['emit'](_0xc1c9('0x8e'),{'UserId':Number(_0x558231[_0xc1c9('0x4e')][_0xc1c9('0x8c')][_0x2177f4]),'CmListId':Number(_0x558231['params']['id'])});}return _0x336de8;});}})[_0xc1c9('0x2a')](respondWithResult(_0x545673,null))[_0xc1c9('0x48')](handleError(_0x545673,null));};exports[_0xc1c9('0x8f')]=function(_0x2951b4,_0x2453f2,_0x33a997){return db[_0xc1c9('0x32')]['find']({'where':{'id':_0x2951b4[_0xc1c9('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2453f2,null))['then'](function(_0x2df445){if(_0x2df445){return _0x2df445[_0xc1c9('0x8f')](_0x2951b4[_0xc1c9('0x34')]['ids'])['then'](function(){if(_[_0xc1c9('0x62')](_0x2951b4['query'][_0xc1c9('0x8c')])){for(var _0x4de038=0x0;_0x4de038<_0x2951b4[_0xc1c9('0x34')]['ids'][_0xc1c9('0x3b')];_0x4de038+=0x1){socket[_0xc1c9('0x90')]('userCmList:remove',{'UserId':Number(_0x2951b4[_0xc1c9('0x34')]['ids'][_0x4de038]),'CmListId':Number(_0x2951b4[_0xc1c9('0x4a')]['id'])});}}else{socket[_0xc1c9('0x90')](_0xc1c9('0x91'),{'UserId':Number(_0x2951b4[_0xc1c9('0x34')][_0xc1c9('0x8c')]),'CmListId':Number(_0x2951b4['params']['id'])});}});}})[_0xc1c9('0x2a')](respondWithStatusCode(_0x2453f2,null))[_0xc1c9('0x48')](handleError(_0x2453f2,null));};exports['getAgents']=function(_0x4f0ddd,_0x315060,_0x1c5d45){var _0x1c36e0={};var _0x144f61={};var _0x285cf9;var _0x61f690;return db['CmList'][_0xc1c9('0x5c')]({'where':{'id':_0x4f0ddd[_0xc1c9('0x4a')]['id']}})['then'](handleEntityNotFound(_0x315060,null))[_0xc1c9('0x2a')](function(_0x45510e){if(_0x45510e){_0x285cf9=_0x45510e;_0x144f61[_0xc1c9('0x38')]=_[_0xc1c9('0x35')](db[_0xc1c9('0x92')][_0xc1c9('0x33')]);_0x144f61[_0xc1c9('0x34')]=_['keys'](_0x4f0ddd[_0xc1c9('0x34')]);_0x144f61[_0xc1c9('0x36')]=_[_0xc1c9('0x37')](_0x144f61[_0xc1c9('0x38')],_0x144f61[_0xc1c9('0x34')]);_0x1c36e0[_0xc1c9('0x39')]=_[_0xc1c9('0x37')](_0x144f61[_0xc1c9('0x38')],qs[_0xc1c9('0x3a')](_0x4f0ddd['query'][_0xc1c9('0x3a')]));_0x1c36e0[_0xc1c9('0x39')]=_0x1c36e0[_0xc1c9('0x39')][_0xc1c9('0x3b')]?_0x1c36e0[_0xc1c9('0x39')]:_0x144f61['model'];_0x1c36e0[_0xc1c9('0x3e')]=qs[_0xc1c9('0x3f')](_0x4f0ddd[_0xc1c9('0x34')][_0xc1c9('0x3f')]);_0x1c36e0[_0xc1c9('0x40')]=qs[_0xc1c9('0x36')](_[_0xc1c9('0x41')](_0x4f0ddd[_0xc1c9('0x34')],_0x144f61[_0xc1c9('0x36')]));if(_0x4f0ddd[_0xc1c9('0x34')][_0xc1c9('0x42')]){_0x1c36e0[_0xc1c9('0x40')]=_[_0xc1c9('0x43')](_0x1c36e0[_0xc1c9('0x40')],{'$or':_[_0xc1c9('0x31')](_0x1c36e0[_0xc1c9('0x39')],function(_0x364eba){var _0x591858={};_0x591858[_0x364eba]={'$like':'%'+_0x4f0ddd[_0xc1c9('0x34')][_0xc1c9('0x42')]+'%'};return _0x591858;})});}_0x1c36e0=_[_0xc1c9('0x43')]({},_0x1c36e0,_0x4f0ddd['options']);return _0x285cf9[_0xc1c9('0x93')](_0x1c36e0);}})[_0xc1c9('0x2a')](function(_0x4d01e3){if(_0x4d01e3){_0x61f690=_0x4d01e3['length'];if(!_0x4f0ddd[_0xc1c9('0x34')][_0xc1c9('0x3c')](_0xc1c9('0x3d'))){_0x1c36e0[_0xc1c9('0x25')]=qs[_0xc1c9('0x25')](_0x4f0ddd[_0xc1c9('0x34')][_0xc1c9('0x25')]);_0x1c36e0[_0xc1c9('0x23')]=qs[_0xc1c9('0x23')](_0x4f0ddd['query'][_0xc1c9('0x23')]);}return _0x285cf9['getAgents'](_0x1c36e0);}})[_0xc1c9('0x2a')](function(_0x599477){if(_0x599477){return _0x599477?{'count':_0x61f690,'rows':_0x599477}:null;}})[_0xc1c9('0x2a')](respondWithResult(_0x315060,null))[_0xc1c9('0x48')](handleError(_0x315060,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index cf6c24f..5a1eb1c 100644 --- a/server/api/cmList/cmList.events.js +++ b/server/api/cmList/cmList.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe14b=['hasOwnProperty','hook','exports','events','../../mysqldb','save','update','emit'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xe14b,0x93));var _0xbe14=function(_0x12ec5b,_0x492207){_0x12ec5b=_0x12ec5b-0x0;var _0x6cf7a4=_0xe14b[_0x12ec5b];return _0x6cf7a4;};'use strict';var EventEmitter=require(_0xbe14('0x0'));var CmList=require(_0xbe14('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbe14('0x2'),'afterUpdate':_0xbe14('0x3'),'afterDestroy':'remove'};function emitEvent(_0x7d3665){return function(_0x5ce8fb,_0x496c04,_0x1833e3){CmListEvents[_0xbe14('0x4')](_0x7d3665+':'+_0x5ce8fb['id'],_0x5ce8fb);CmListEvents[_0xbe14('0x4')](_0x7d3665,_0x5ce8fb);_0x1833e3(null);};}for(var e in events){if(events[_0xbe14('0x5')](e)){var event=events[e];CmList[_0xbe14('0x6')](e,emitEvent(event));}}module[_0xbe14('0x7')]=CmListEvents; \ No newline at end of file +var _0x5fc3=['events','../../mysqldb','setMaxListeners','save','update','remove','emit','hook'];(function(_0x15dbca,_0x1d7c3c){var _0x326533=function(_0x507ee2){while(--_0x507ee2){_0x15dbca['push'](_0x15dbca['shift']());}};_0x326533(++_0x1d7c3c);}(_0x5fc3,0xa8));var _0x35fc=function(_0x204ad4,_0x502841){_0x204ad4=_0x204ad4-0x0;var _0x50675f=_0x5fc3[_0x204ad4];return _0x50675f;};'use strict';var EventEmitter=require(_0x35fc('0x0'));var CmList=require(_0x35fc('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents[_0x35fc('0x2')](0x0);var events={'afterCreate':_0x35fc('0x3'),'afterUpdate':_0x35fc('0x4'),'afterDestroy':_0x35fc('0x5')};function emitEvent(_0xb4f9ce){return function(_0x5e75e6,_0x2d1404,_0x1d5fec){CmListEvents[_0x35fc('0x6')](_0xb4f9ce+':'+_0x5e75e6['id'],_0x5e75e6);CmListEvents['emit'](_0xb4f9ce,_0x5e75e6);_0x1d5fec(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0x35fc('0x7')](e,emitEvent(event));}}module['exports']=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 4a698f7..20337fd 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 _0x1be1=['define','cm_lists','../../config/logger','api','bluebird','request-promise','path','rimraf','./cmList.attributes','exports'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0x1be1,0x192));var _0x11be=function(_0x419ffa,_0x304167){_0x419ffa=_0x419ffa-0x0;var _0x2472ed=_0x1be1[_0x419ffa];return _0x2472ed;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x11be('0x0'))(_0x11be('0x1'));var moment=require('moment');var BPromise=require(_0x11be('0x2'));var rp=require(_0x11be('0x3'));var fs=require('fs');var path=require(_0x11be('0x4'));var rimraf=require(_0x11be('0x5'));var config=require('../../config/environment');var attributes=require(_0x11be('0x6'));module[_0x11be('0x7')]=function(_0x11f793,_0x479719){return _0x11f793[_0x11be('0x8')]('CmList',attributes,{'tableName':_0x11be('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x22fb=['define','CmList','../../config/logger','moment','bluebird','request-promise','path','rimraf','./cmList.attributes','exports'];(function(_0x7fe2ec,_0x3d72e2){var _0x52d656=function(_0x2033c7){while(--_0x2033c7){_0x7fe2ec['push'](_0x7fe2ec['shift']());}};_0x52d656(++_0x3d72e2);}(_0x22fb,0x192));var _0xb22f=function(_0x10741f,_0x3da3f3){_0x10741f=_0x10741f-0x0;var _0x42385f=_0x22fb[_0x10741f];return _0x42385f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb22f('0x0'))('api');var moment=require(_0xb22f('0x1'));var BPromise=require(_0xb22f('0x2'));var rp=require(_0xb22f('0x3'));var fs=require('fs');var path=require(_0xb22f('0x4'));var rimraf=require(_0xb22f('0x5'));var config=require('../../config/environment');var attributes=require(_0xb22f('0x6'));module[_0xb22f('0x7')]=function(_0x2d1fb3,_0xc3ffcc){return _0x2d1fb3[_0xb22f('0x8')](_0xb22f('0x9'),attributes,{'tableName':'cm_lists','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 4b354c6..e69548d 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 _0x443b=['socket.io-emitter','./cmList.socket','register','info','CmList,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','lodash','moment','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','defaults','localhost'];(function(_0x2f4e7a,_0x4c3f4e){var _0x3299a0=function(_0x422bd1){while(--_0x422bd1){_0x2f4e7a['push'](_0x2f4e7a['shift']());}};_0x3299a0(++_0x4c3f4e);}(_0x443b,0x155));var _0xb443=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x443b[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xb443('0x0'));var util=require('util');var moment=require(_0xb443('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb443('0x2'))['db'];var utils=require(_0xb443('0x3'));var logger=require('../../config/logger')(_0xb443('0x4'));var config=require('../../config/environment');var jayson=require(_0xb443('0x5'));var client=jayson[_0xb443('0x6')][_0xb443('0x7')]({'port':0x232a});config[_0xb443('0x8')]=_[_0xb443('0x9')](config['redis'],{'host':_0xb443('0xa'),'port':0x18eb});var socket=require(_0xb443('0xb'))(new Redis(config[_0xb443('0x8')]));require(_0xb443('0xc'))[_0xb443('0xd')](socket);function respondWithRpcPromise(_0x5b1e0f,_0xb9a2af,_0x5a4d16){return new BPromise(function(_0x149811,_0x36cc5f){return client['request'](_0x5b1e0f,_0x5a4d16)['then'](function(_0x470839){logger[_0xb443('0xe')](_0xb443('0xf'),_0xb9a2af,_0xb443('0x10'));logger[_0xb443('0x11')]('CmList,\x20%s,\x20%s,\x20%s',_0xb9a2af,_0xb443('0x10'),JSON[_0xb443('0x12')](_0x470839));if(_0x470839['error']){if(_0x470839[_0xb443('0x13')]['code']===0x1f4){logger[_0xb443('0x13')](_0xb443('0xf'),_0xb9a2af,_0x470839['error'][_0xb443('0x14')]);return _0x36cc5f(_0x470839[_0xb443('0x13')]['message']);}logger[_0xb443('0x13')](_0xb443('0xf'),_0xb9a2af,_0x470839['error']['message']);return _0x149811(_0x470839[_0xb443('0x13')][_0xb443('0x14')]);}else{logger[_0xb443('0xe')](_0xb443('0xf'),_0xb9a2af,'request\x20sent');_0x149811(_0x470839[_0xb443('0x15')][_0xb443('0x14')]);}})['catch'](function(_0x28c977){logger[_0xb443('0x13')](_0xb443('0xf'),_0xb9a2af,_0x28c977);_0x36cc5f(_0x28c977);});});} \ No newline at end of file +var _0x3bf9=['localhost','socket.io-emitter','./cmList.socket','request','info','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis'];(function(_0x4c1f35,_0x4f76cc){var _0x2f612a=function(_0x55f664){while(--_0x55f664){_0x4c1f35['push'](_0x4c1f35['shift']());}};_0x2f612a(++_0x4f76cc);}(_0x3bf9,0x112));var _0x93bf=function(_0x3bf1e0,_0x1580be){_0x3bf1e0=_0x3bf1e0-0x0;var _0x5a9ded=_0x3bf9[_0x3bf1e0];return _0x5a9ded;};'use strict';var _=require(_0x93bf('0x0'));var util=require(_0x93bf('0x1'));var moment=require(_0x93bf('0x2'));var BPromise=require(_0x93bf('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x93bf('0x4'))['db'];var utils=require(_0x93bf('0x5'));var logger=require('../../config/logger')(_0x93bf('0x6'));var config=require(_0x93bf('0x7'));var jayson=require(_0x93bf('0x8'));var client=jayson[_0x93bf('0x9')][_0x93bf('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0x93bf('0xb')],{'host':_0x93bf('0xc'),'port':0x18eb});var socket=require(_0x93bf('0xd'))(new Redis(config[_0x93bf('0xb')]));require(_0x93bf('0xe'))['register'](socket);function respondWithRpcPromise(_0x232a12,_0x2c2f2e,_0x32d287){return new BPromise(function(_0x348c49,_0x144bee){return client[_0x93bf('0xf')](_0x232a12,_0x32d287)['then'](function(_0x9620d7){logger[_0x93bf('0x10')](_0x93bf('0x11'),_0x2c2f2e,_0x93bf('0x12'));logger[_0x93bf('0x13')](_0x93bf('0x14'),_0x2c2f2e,_0x93bf('0x12'),JSON[_0x93bf('0x15')](_0x9620d7));if(_0x9620d7[_0x93bf('0x16')]){if(_0x9620d7[_0x93bf('0x16')][_0x93bf('0x17')]===0x1f4){logger[_0x93bf('0x16')]('CmList,\x20%s,\x20%s',_0x2c2f2e,_0x9620d7[_0x93bf('0x16')]['message']);return _0x144bee(_0x9620d7['error'][_0x93bf('0x18')]);}logger[_0x93bf('0x16')](_0x93bf('0x11'),_0x2c2f2e,_0x9620d7[_0x93bf('0x16')][_0x93bf('0x18')]);return _0x348c49(_0x9620d7[_0x93bf('0x16')][_0x93bf('0x18')]);}else{logger[_0x93bf('0x10')](_0x93bf('0x11'),_0x2c2f2e,'request\x20sent');_0x348c49(_0x9620d7[_0x93bf('0x19')][_0x93bf('0x18')]);}})['catch'](function(_0x35850d){logger['error'](_0x93bf('0x11'),_0x2c2f2e,_0x35850d);_0x144bee(_0x35850d);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 29d4307..b97efa4 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 _0x698e=['remove','removeListener','register','cmList:','./cmList.events','save'];(function(_0x277ded,_0x830a66){var _0xf3081b=function(_0x1a5d25){while(--_0x1a5d25){_0x277ded['push'](_0x277ded['shift']());}};_0xf3081b(++_0x830a66);}(_0x698e,0x130));var _0xe698=function(_0x2604bd,_0x49db71){_0x2604bd=_0x2604bd-0x0;var _0xea15ed=_0x698e[_0x2604bd];return _0xea15ed;};'use strict';var CmListEvents=require(_0xe698('0x0'));var events=[_0xe698('0x1'),_0xe698('0x2'),'update'];function createListener(_0x4e6ef9,_0x5b66bd){return function(_0x1f79a1){_0x5b66bd['emit'](_0x4e6ef9,_0x1f79a1);};}function removeListener(_0x41dc18,_0x24333a){return function(){CmListEvents[_0xe698('0x3')](_0x41dc18,_0x24333a);};}exports[_0xe698('0x4')]=function(_0x2fee4a){for(var _0x343379=0x0,_0x47d2ef=events['length'];_0x343379<_0x47d2ef;_0x343379++){var _0x473c89=events[_0x343379];var _0x278300=createListener(_0xe698('0x5')+_0x473c89,_0x2fee4a);CmListEvents['on'](_0x473c89,_0x278300);}}; \ No newline at end of file +var _0xf9eb=['removeListener','length','cmList:','save','update','emit'];(function(_0x1ef44f,_0x51cc09){var _0x57c070=function(_0x41393c){while(--_0x41393c){_0x1ef44f['push'](_0x1ef44f['shift']());}};_0x57c070(++_0x51cc09);}(_0xf9eb,0x1b3));var _0xbf9e=function(_0x2ccb52,_0xc3664c){_0x2ccb52=_0x2ccb52-0x0;var _0x505033=_0xf9eb[_0x2ccb52];return _0x505033;};'use strict';var CmListEvents=require('./cmList.events');var events=[_0xbf9e('0x0'),'remove',_0xbf9e('0x1')];function createListener(_0x407631,_0x5c666){return function(_0x419d52){_0x5c666[_0xbf9e('0x2')](_0x407631,_0x419d52);};}function removeListener(_0x4c2e2c,_0x1cae9a){return function(){CmListEvents[_0xbf9e('0x3')](_0x4c2e2c,_0x1cae9a);};}exports['register']=function(_0x19fd99){for(var _0x3a18a5=0x0,_0x51dedb=events[_0xbf9e('0x4')];_0x3a18a5<_0x51dedb;_0x3a18a5++){var _0x37524a=events[_0x3a18a5];var _0x4ee6cc=createListener(_0xbf9e('0x5')+_0x37524a,_0x19fd99);CmListEvents['on'](_0x37524a,_0x4ee6cc);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 69cea03..6a7351d 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 _0x891b=['get','index','describe','/:id','isAuthenticated','show','/:id/dispositions','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','/:id/users','getAgents','post','create','addDisposition','addCustomField','addAgents','put','update','delete','removeDispositions','removeAgents','exports','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmList.controller'];(function(_0x47f63d,_0x13f702){var _0x31bafd=function(_0x3e5a0f){while(--_0x3e5a0f){_0x47f63d['push'](_0x47f63d['shift']());}};_0x31bafd(++_0x13f702);}(_0x891b,0xc5));var _0xb891=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x891b[_0x14add3];return _0x4a174f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb891('0x0'));var timeout=require(_0xb891('0x1'));var express=require('express');var router=express[_0xb891('0x2')]();var fs_extra=require(_0xb891('0x3'));var auth=require(_0xb891('0x4'));var interaction=require(_0xb891('0x5'));var config=require('../../config/environment');var controller=require(_0xb891('0x6'));router[_0xb891('0x7')]('/',auth['isAuthenticated'](),controller[_0xb891('0x8')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0xb891('0x9')]);router[_0xb891('0x7')](_0xb891('0xa'),auth[_0xb891('0xb')](),controller[_0xb891('0xc')]);router[_0xb891('0x7')](_0xb891('0xd'),auth['isAuthenticated'](),controller[_0xb891('0xe')]);router[_0xb891('0x7')](_0xb891('0xf'),auth[_0xb891('0xb')](),controller[_0xb891('0x10')]);router[_0xb891('0x7')](_0xb891('0x11'),auth[_0xb891('0xb')](),controller[_0xb891('0x12')]);router[_0xb891('0x7')](_0xb891('0x13'),auth['isAuthenticated'](),controller[_0xb891('0x14')]);router[_0xb891('0x7')](_0xb891('0x15'),auth['isAuthenticated'](),controller[_0xb891('0x16')]);router[_0xb891('0x17')]('/',auth['isAuthenticated'](),controller[_0xb891('0x18')]);router['post'](_0xb891('0xd'),auth[_0xb891('0xb')](),controller[_0xb891('0x19')]);router[_0xb891('0x17')](_0xb891('0xf'),auth[_0xb891('0xb')](),controller['addContacts']);router['post'](_0xb891('0x13'),auth[_0xb891('0xb')](),controller[_0xb891('0x1a')]);router[_0xb891('0x17')](_0xb891('0x15'),auth[_0xb891('0xb')](),controller[_0xb891('0x1b')]);router[_0xb891('0x1c')]('/:id',auth['isAuthenticated'](),controller[_0xb891('0x1d')]);router['delete'](_0xb891('0xa'),auth[_0xb891('0xb')](),controller['destroy']);router[_0xb891('0x1e')]('/:id/dispositions',auth[_0xb891('0xb')](),controller[_0xb891('0x1f')]);router[_0xb891('0x1e')](_0xb891('0x15'),auth[_0xb891('0xb')](),controller[_0xb891('0x20')]);module[_0xb891('0x21')]=router; \ No newline at end of file +var _0xc440=['/:id/users','getAgents','post','create','addDisposition','addContacts','/:id/fields','addCustomField','addAgents','update','delete','destroy','removeDispositions','removeAgents','exports','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./cmList.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/dispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','getCustomFields'];(function(_0x1af98d,_0x3c608e){var _0x3553ea=function(_0x5668a4){while(--_0x5668a4){_0x1af98d['push'](_0x1af98d['shift']());}};_0x3553ea(++_0x3c608e);}(_0xc440,0x104));var _0x0c44=function(_0x1f49c2,_0xeb4570){_0x1f49c2=_0x1f49c2-0x0;var _0x11bb4d=_0xc440[_0x1f49c2];return _0x11bb4d;};'use strict';var multer=require('multer');var util=require(_0x0c44('0x0'));var path=require(_0x0c44('0x1'));var timeout=require(_0x0c44('0x2'));var express=require(_0x0c44('0x3'));var router=express[_0x0c44('0x4')]();var fs_extra=require(_0x0c44('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x0c44('0x6'));var controller=require(_0x0c44('0x7'));router[_0x0c44('0x8')]('/',auth[_0x0c44('0x9')](),controller['index']);router[_0x0c44('0x8')](_0x0c44('0xa'),auth[_0x0c44('0x9')](),controller[_0x0c44('0xb')]);router[_0x0c44('0x8')](_0x0c44('0xc'),auth[_0x0c44('0x9')](),controller[_0x0c44('0xd')]);router[_0x0c44('0x8')](_0x0c44('0xe'),auth[_0x0c44('0x9')](),controller['getDispositions']);router[_0x0c44('0x8')](_0x0c44('0xf'),auth[_0x0c44('0x9')](),controller[_0x0c44('0x10')]);router['get'](_0x0c44('0x11'),auth[_0x0c44('0x9')](),controller[_0x0c44('0x12')]);router[_0x0c44('0x8')]('/:id/fields',auth[_0x0c44('0x9')](),controller[_0x0c44('0x13')]);router[_0x0c44('0x8')](_0x0c44('0x14'),auth[_0x0c44('0x9')](),controller[_0x0c44('0x15')]);router[_0x0c44('0x16')]('/',auth[_0x0c44('0x9')](),controller[_0x0c44('0x17')]);router[_0x0c44('0x16')](_0x0c44('0xe'),auth[_0x0c44('0x9')](),controller[_0x0c44('0x18')]);router[_0x0c44('0x16')](_0x0c44('0xf'),auth[_0x0c44('0x9')](),controller[_0x0c44('0x19')]);router[_0x0c44('0x16')](_0x0c44('0x1a'),auth[_0x0c44('0x9')](),controller[_0x0c44('0x1b')]);router[_0x0c44('0x16')](_0x0c44('0x14'),auth[_0x0c44('0x9')](),controller[_0x0c44('0x1c')]);router['put'](_0x0c44('0xc'),auth[_0x0c44('0x9')](),controller[_0x0c44('0x1d')]);router[_0x0c44('0x1e')](_0x0c44('0xc'),auth['isAuthenticated'](),controller[_0x0c44('0x1f')]);router['delete'](_0x0c44('0xe'),auth[_0x0c44('0x9')](),controller[_0x0c44('0x20')]);router['delete'](_0x0c44('0x14'),auth[_0x0c44('0x9')](),controller[_0x0c44('0x21')]);module[_0x0c44('0x22')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index a6d9157..fdaf211 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 _0x136e=['STRING','sequelize','VIRTUAL','getDataValue','field'];(function(_0x1ac0f7,_0x46e477){var _0x2b36e3=function(_0x2e71f2){while(--_0x2e71f2){_0x1ac0f7['push'](_0x1ac0f7['shift']());}};_0x2b36e3(++_0x46e477);}(_0x136e,0xd8));var _0xe136=function(_0x56aaed,_0x408e35){_0x56aaed=_0x56aaed-0x0;var _0x154eba=_0x136e[_0x56aaed];return _0x154eba;};'use strict';var Sequelize=require(_0xe136('0x0'));module['exports']={'name':{'type':Sequelize[_0xe136('0x1')],'get':function(_0x52f3f8){return this[_0xe136('0x2')](_0xe136('0x3'));}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0xe136('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0xe136('0x4')],'allowNull':![]}}; \ No newline at end of file +var _0x0858=['STRING','sequelize','exports','getDataValue','field'];(function(_0xa91c44,_0x2906a8){var _0x23d63c=function(_0x976d7){while(--_0x976d7){_0xa91c44['push'](_0xa91c44['shift']());}};_0x23d63c(++_0x2906a8);}(_0x0858,0x150));var _0x8085=function(_0x364add,_0xf47b65){_0x364add=_0x364add-0x0;var _0x5c9d55=_0x0858[_0x364add];return _0x5c9d55;};'use strict';var Sequelize=require(_0x8085('0x0'));module[_0x8085('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x5201ee){return this[_0x8085('0x2')](_0x8085('0x3'));}},'field':{'type':Sequelize[_0x8085('0x4')],'allowNull':![]},'operator':{'type':Sequelize['STRING'],'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 17be20d..084865d 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(_0x48ba0a,_0x4b5223){var _0x56397e=function(_0x1b353d){while(--_0x1b353d){_0x48ba0a['push'](_0x48ba0a['shift']());}};_0x56397e(++_0x4b5223);}(_0x9957,0x93));var _0x7995=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x9957[_0x19e35c];return _0x3e1fe8;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){if(_0x4b6f99['body']['id']){delete _0x4b6f99[_0x7995('0x2c')]['id'];}return db[_0x7995('0x2d')][_0x7995('0x2e')]({'where':{'id':_0x4b6f99['params']['id']}})['then'](handleEntityNotFound(_0x9b2a15,null))['then'](saveUpdates(_0x4b6f99[_0x7995('0x2c')],null))[_0x7995('0x26')](respondWithResult(_0x9b2a15,null))[_0x7995('0x2f')](handleError(_0x9b2a15,null));};exports[_0x7995('0x27')]=function(_0x2e3493,_0x1ca460){return db['Condition']['find']({'where':{'id':_0x2e3493[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x1ca460,null))[_0x7995('0x26')](removeEntity(_0x1ca460,null))[_0x7995('0x2f')](handleError(_0x1ca460,null));}; \ No newline at end of file +var _0x7a54=['sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','body','Condition','find','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path'];(function(_0x3d820e,_0x5d557e){var _0x2a3333=function(_0x36681e){while(--_0x36681e){_0x3d820e['push'](_0x3d820e['shift']());}};_0x2a3333(++_0x5d557e);}(_0x7a54,0x106));var _0x47a5=function(_0x3dab10,_0x5c6177){_0x3dab10=_0x3dab10-0x0;var _0x83ebc8=_0x7a54[_0x3dab10];return _0x83ebc8;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index 06ec857..a8f25cf 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 _0x2794=['request-promise','path','../../config/environment','./condition.attributes','exports','define','Condition','tools_conditions','util','../../config/logger','api','moment','bluebird'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x2794,0x181));var _0x4279=function(_0x3fd7ec,_0x568221){_0x3fd7ec=_0x3fd7ec-0x0;var _0x4ff270=_0x2794[_0x3fd7ec];return _0x4ff270;};'use strict';var _=require('lodash');var util=require(_0x4279('0x0'));var logger=require(_0x4279('0x1'))(_0x4279('0x2'));var moment=require(_0x4279('0x3'));var BPromise=require(_0x4279('0x4'));var rp=require(_0x4279('0x5'));var fs=require('fs');var path=require(_0x4279('0x6'));var rimraf=require('rimraf');var config=require(_0x4279('0x7'));var attributes=require(_0x4279('0x8'));module[_0x4279('0x9')]=function(_0x3b8486,_0x593dd5){return _0x3b8486[_0x4279('0xa')](_0x4279('0xb'),attributes,{'tableName':_0x4279('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa49b=['rimraf','../../config/environment','exports','define','Condition','lodash','util','moment','request-promise','path'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0xa49b,0x18b));var _0xba49=function(_0x4c1f56,_0x2b376b){_0x4c1f56=_0x4c1f56-0x0;var _0x1be32c=_0xa49b[_0x4c1f56];return _0x1be32c;};'use strict';var _=require(_0xba49('0x0'));var util=require(_0xba49('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xba49('0x2'));var BPromise=require('bluebird');var rp=require(_0xba49('0x3'));var fs=require('fs');var path=require(_0xba49('0x4'));var rimraf=require(_0xba49('0x5'));var config=require(_0xba49('0x6'));var attributes=require('./condition.attributes');module[_0xba49('0x7')]=function(_0x128497,_0x5af337){return _0x128497[_0xba49('0x8')](_0xba49('0x9'),attributes,{'tableName':'tools_conditions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/condition/condition.rpc.js b/server/api/condition/condition.rpc.js index 390ffd6..2495489 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 _0x41d6=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','ioredis'];(function(_0x3fee26,_0xf93364){var _0x491205=function(_0x37d0cb){while(--_0x37d0cb){_0x3fee26['push'](_0x3fee26['shift']());}};_0x491205(++_0xf93364);}(_0x41d6,0x154));var _0x641d=function(_0x380320,_0x278bb5){_0x380320=_0x380320-0x0;var _0x58e944=_0x41d6[_0x380320];return _0x58e944;};'use strict';var _=require(_0x641d('0x0'));var util=require(_0x641d('0x1'));var moment=require(_0x641d('0x2'));var BPromise=require(_0x641d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x641d('0x4'));var db=require(_0x641d('0x5'))['db'];var utils=require(_0x641d('0x6'));var logger=require('../../config/logger')(_0x641d('0x7'));var config=require(_0x641d('0x8'));var jayson=require(_0x641d('0x9'));var client=jayson[_0x641d('0xa')][_0x641d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x383117,_0x4bb9ac,_0x394b15){return new BPromise(function(_0x672a77,_0x343632){return client['request'](_0x383117,_0x394b15)[_0x641d('0xc')](function(_0x31abe0){logger[_0x641d('0xd')](_0x641d('0xe'),_0x4bb9ac,_0x641d('0xf'));logger[_0x641d('0x10')](_0x641d('0x11'),_0x4bb9ac,_0x641d('0xf'),JSON[_0x641d('0x12')](_0x31abe0));if(_0x31abe0[_0x641d('0x13')]){if(_0x31abe0[_0x641d('0x13')]['code']===0x1f4){logger['error'](_0x641d('0xe'),_0x4bb9ac,_0x31abe0[_0x641d('0x13')][_0x641d('0x14')]);return _0x343632(_0x31abe0['error'][_0x641d('0x14')]);}logger[_0x641d('0x13')]('Condition,\x20%s,\x20%s',_0x4bb9ac,_0x31abe0[_0x641d('0x13')][_0x641d('0x14')]);return _0x672a77(_0x31abe0['error'][_0x641d('0x14')]);}else{logger['info']('Condition,\x20%s,\x20%s',_0x4bb9ac,_0x641d('0xf'));_0x672a77(_0x31abe0[_0x641d('0x15')][_0x641d('0x14')]);}})[_0x641d('0x16')](function(_0x30fe62){logger[_0x641d('0x13')](_0x641d('0xe'),_0x4bb9ac,_0x30fe62);_0x343632(_0x30fe62);});});} \ No newline at end of file +var _0x6cf4=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Condition,\x20%s,\x20%s','request\x20sent','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','util','moment','randomstring'];(function(_0xbba9bd,_0x18145c){var _0x550337=function(_0x2f4c62){while(--_0x2f4c62){_0xbba9bd['push'](_0xbba9bd['shift']());}};_0x550337(++_0x18145c);}(_0x6cf4,0x1e0));var _0x46cf=function(_0x1ca9eb,_0x99a10b){_0x1ca9eb=_0x1ca9eb-0x0;var _0x2e284e=_0x6cf4[_0x1ca9eb];return _0x2e284e;};'use strict';var _=require('lodash');var util=require(_0x46cf('0x0'));var moment=require(_0x46cf('0x1'));var BPromise=require('bluebird');var rs=require(_0x46cf('0x2'));var fs=require('fs');var Redis=require(_0x46cf('0x3'));var db=require(_0x46cf('0x4'))['db'];var utils=require(_0x46cf('0x5'));var logger=require(_0x46cf('0x6'))(_0x46cf('0x7'));var config=require(_0x46cf('0x8'));var jayson=require(_0x46cf('0x9'));var client=jayson[_0x46cf('0xa')][_0x46cf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xdc859c,_0x3ecbdd,_0x361860){return new BPromise(function(_0x3f11a2,_0x9e057f){return client[_0x46cf('0xc')](_0xdc859c,_0x361860)[_0x46cf('0xd')](function(_0x1341dc){logger['info'](_0x46cf('0xe'),_0x3ecbdd,_0x46cf('0xf'));logger['debug'](_0x46cf('0x10'),_0x3ecbdd,'request\x20sent',JSON[_0x46cf('0x11')](_0x1341dc));if(_0x1341dc[_0x46cf('0x12')]){if(_0x1341dc[_0x46cf('0x12')][_0x46cf('0x13')]===0x1f4){logger['error'](_0x46cf('0xe'),_0x3ecbdd,_0x1341dc[_0x46cf('0x12')][_0x46cf('0x14')]);return _0x9e057f(_0x1341dc[_0x46cf('0x12')][_0x46cf('0x14')]);}logger['error']('Condition,\x20%s,\x20%s',_0x3ecbdd,_0x1341dc[_0x46cf('0x12')]['message']);return _0x3f11a2(_0x1341dc[_0x46cf('0x12')][_0x46cf('0x14')]);}else{logger[_0x46cf('0x15')]('Condition,\x20%s,\x20%s',_0x3ecbdd,_0x46cf('0xf'));_0x3f11a2(_0x1341dc['result']['message']);}})[_0x46cf('0x16')](function(_0x464ea7){logger[_0x46cf('0x12')]('Condition,\x20%s,\x20%s',_0x3ecbdd,_0x464ea7);_0x9e057f(_0x464ea7);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 3c7ac42..c9d748d 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 _0xc5c6=['../../config/environment','./condition.controller','isAuthenticated','update','delete','/:id','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra'];(function(_0xdb647a,_0x4ee8a5){var _0x152504=function(_0x38f9e5){while(--_0x38f9e5){_0xdb647a['push'](_0xdb647a['shift']());}};_0x152504(++_0x4ee8a5);}(_0xc5c6,0x1e4));var _0x6c5c=function(_0x40a825,_0x3bac79){_0x40a825=_0x40a825-0x0;var _0x273a54=_0xc5c6[_0x40a825];return _0x273a54;};'use strict';var multer=require(_0x6c5c('0x0'));var util=require(_0x6c5c('0x1'));var path=require('path');var timeout=require(_0x6c5c('0x2'));var express=require(_0x6c5c('0x3'));var router=express[_0x6c5c('0x4')]();var fs_extra=require(_0x6c5c('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x6c5c('0x6'));var controller=require(_0x6c5c('0x7'));router['put']('/:id',auth[_0x6c5c('0x8')](),controller[_0x6c5c('0x9')]);router[_0x6c5c('0xa')](_0x6c5c('0xb'),auth['isAuthenticated'](),controller[_0x6c5c('0xc')]);module[_0x6c5c('0xd')]=router; \ No newline at end of file +var _0x1236=['delete','/:id','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./condition.controller','isAuthenticated','update'];(function(_0xed45fc,_0x472179){var _0x30c449=function(_0x23244a){while(--_0x23244a){_0xed45fc['push'](_0xed45fc['shift']());}};_0x30c449(++_0x472179);}(_0x1236,0xab));var _0x6123=function(_0x3555c4,_0x21d437){_0x3555c4=_0x3555c4-0x0;var _0x19f680=_0x1236[_0x3555c4];return _0x19f680;};'use strict';var multer=require(_0x6123('0x0'));var util=require(_0x6123('0x1'));var path=require(_0x6123('0x2'));var timeout=require(_0x6123('0x3'));var express=require(_0x6123('0x4'));var router=express['Router']();var fs_extra=require(_0x6123('0x5'));var auth=require(_0x6123('0x6'));var interaction=require(_0x6123('0x7'));var config=require('../../config/environment');var controller=require(_0x6123('0x8'));router['put']('/:id',auth[_0x6123('0x9')](),controller[_0x6123('0xa')]);router[_0x6123('0xb')](_0x6123('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x6123('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 a61b5dd..f9c6f21 100644 --- a/server/api/dashboard/dashboard.attributes.js +++ b/server/api/dashboard/dashboard.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['exports','sequelize'];(function(_0x41e766,_0x174107){var _0x290e0d=function(_0x1d037c){while(--_0x1d037c){_0x41e766['push'](_0x41e766['shift']());}};_0x290e0d(++_0x174107);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xbaf0=['name','exports','STRING'];(function(_0x3a94e1,_0x22e4fd){var _0x6a09d5=function(_0x2d6d1c){while(--_0x2d6d1c){_0x3a94e1['push'](_0x3a94e1['shift']());}};_0x6a09d5(++_0x22e4fd);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xbaf0[_0x6c993a];return _0x27f547;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'name':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'unique':_0x0baf('0x2')},'description':{'type':Sequelize[_0x0baf('0x1')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 952721a..6f0ee28 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 _0x6f4a=['pick','filter','merge','where','type','VIRTUAL','options','includeAll','rows','catch','show','params','include','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CustomDashboards','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rawAttributes','omit','updatedAt','body','createdAt','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','getItems','findOne','DashboardItem','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./dashboard.socket','status','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then','UserProfileResource','destroy','sendStatus','error','stack','name','send','index','map','Dashboard','fieldName','key','keys','query','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','filters'];(function(_0x562e31,_0x108992){var _0x4014ff=function(_0x32c69d){while(--_0x32c69d){_0x562e31['push'](_0x562e31['shift']());}};_0x4014ff(++_0x108992);}(_0x6f4a,0xcc));var _0xa6f4=function(_0x29e30a,_0xe6dfc8){_0x29e30a=_0x29e30a-0x0;var _0x16417f=_0x6f4a[_0x29e30a];return _0x16417f;};'use strict';var emlformat=require(_0xa6f4('0x0'));var rimraf=require(_0xa6f4('0x1'));var zipdir=require(_0xa6f4('0x2'));var jsonpatch=require(_0xa6f4('0x3'));var rp=require(_0xa6f4('0x4'));var moment=require(_0xa6f4('0x5'));var BPromise=require(_0xa6f4('0x6'));var Mustache=require(_0xa6f4('0x7'));var util=require(_0xa6f4('0x8'));var path=require(_0xa6f4('0x9'));var sox=require(_0xa6f4('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa6f4('0xb'));var _=require(_0xa6f4('0xc'));var squel=require(_0xa6f4('0xd'));var crypto=require('crypto');var jsforce=require(_0xa6f4('0xe'));var deskjs=require(_0xa6f4('0xf'));var toCsv=require('to-csv');var querystring=require(_0xa6f4('0x10'));var Papa=require(_0xa6f4('0x11'));var Redis=require(_0xa6f4('0x12'));var authService=require(_0xa6f4('0x13'));var qs=require(_0xa6f4('0x14'));var as=require(_0xa6f4('0x15'));var hardwareService=require(_0xa6f4('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0xa6f4('0x17'));var config=require(_0xa6f4('0x18'));var licenseUtil=require(_0xa6f4('0x19'));var db=require(_0xa6f4('0x1a'))['db'];config[_0xa6f4('0x1b')]=_['defaults'](config['redis'],{'host':_0xa6f4('0x1c'),'port':0x18eb});var socket=require(_0xa6f4('0x1d'))(new Redis(config[_0xa6f4('0x1b')]));require(_0xa6f4('0x1e'))['register'](socket);function respondWithStatusCode(_0x3d6da2,_0x9f7f3){_0x9f7f3=_0x9f7f3||0xcc;return function(_0x289e7b){if(_0x289e7b){return _0x3d6da2['sendStatus'](_0x9f7f3);}return _0x3d6da2['status'](_0x9f7f3)['end']();};}function respondWithResult(_0x354ae1,_0x640e2a){_0x640e2a=_0x640e2a||0xc8;return function(_0x2fe784){if(_0x2fe784){return _0x354ae1[_0xa6f4('0x1f')](_0x640e2a)['json'](_0x2fe784);}};}function respondWithFilteredResult(_0xe3ceaf,_0x11542f){return function(_0x4a3d12){if(_0x4a3d12){var _0x3398e4=typeof _0x11542f[_0xa6f4('0x20')]===_0xa6f4('0x21')&&typeof _0x11542f[_0xa6f4('0x22')]==='undefined';var _0x518bdf=_0x4a3d12['count'];var _0x3e5951=_0x3398e4?0x0:_0x11542f['offset'];var _0x566238=_0x3398e4?_0x4a3d12[_0xa6f4('0x23')]:_0x11542f['offset']+_0x11542f['limit'];var _0x321b40;if(_0x566238>=_0x518bdf){_0x566238=_0x518bdf;_0x321b40=0xc8;}else{_0x321b40=0xce;}_0xe3ceaf[_0xa6f4('0x1f')](_0x321b40);return _0xe3ceaf[_0xa6f4('0x24')](_0xa6f4('0x25'),_0x3e5951+'-'+_0x566238+'/'+_0x518bdf)[_0xa6f4('0x26')](_0x4a3d12);}return null;};}function patchUpdates(_0x2bdfc7){return function(_0x4aef5f){try{jsonpatch[_0xa6f4('0x27')](_0x4aef5f,_0x2bdfc7,!![]);}catch(_0x5ba94c){return BPromise['reject'](_0x5ba94c);}return _0x4aef5f[_0xa6f4('0x28')]();};}function saveUpdates(_0x3610d9,_0x4370f5){return function(_0x563f35){if(_0x563f35){return _0x563f35[_0xa6f4('0x29')](_0x3610d9)[_0xa6f4('0x2a')](function(_0x4d1e22){return _0x4d1e22;});}return null;};}function removeEntity(_0x32fe71,_0x46bedb){return function(_0x496e98){if(_0x496e98){return _0x496e98['destroy']()[_0xa6f4('0x2a')](function(){var _0xfef44a=_0x496e98['get']({'plain':!![]});var _0x549139='CustomDashboards';return db[_0xa6f4('0x2b')][_0xa6f4('0x2c')]({'where':{'type':_0x549139,'resourceId':_0xfef44a['id']}})[_0xa6f4('0x2a')](function(){return _0x496e98;});})['then'](function(){_0x32fe71[_0xa6f4('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0xfadde8,_0x5d0f4a){return function(_0x1a82c7){if(!_0x1a82c7){_0xfadde8[_0xa6f4('0x2d')](0x194);}return _0x1a82c7;};}function handleError(_0x593617,_0x29080d){_0x29080d=_0x29080d||0x1f4;return function(_0x2f1be0){logger[_0xa6f4('0x2e')](_0x2f1be0[_0xa6f4('0x2f')]);if(_0x2f1be0['name']){delete _0x2f1be0[_0xa6f4('0x30')];}_0x593617[_0xa6f4('0x1f')](_0x29080d)[_0xa6f4('0x31')](_0x2f1be0);};}exports[_0xa6f4('0x32')]=function(_0x548be7,_0x519dab){var _0xac09e5={},_0x41d70f={},_0xb07c92={'count':0x0,'rows':[]};var _0x1a6774=_[_0xa6f4('0x33')](db[_0xa6f4('0x34')]['rawAttributes'],function(_0x309460){return{'name':_0x309460[_0xa6f4('0x35')],'type':_0x309460['type'][_0xa6f4('0x36')]};});_0x41d70f['model']=_['map'](_0x1a6774,_0xa6f4('0x30'));_0x41d70f['query']=_[_0xa6f4('0x37')](_0x548be7[_0xa6f4('0x38')]);_0x41d70f['filters']=_[_0xa6f4('0x39')](_0x41d70f[_0xa6f4('0x3a')],_0x41d70f[_0xa6f4('0x38')]);_0xac09e5[_0xa6f4('0x3b')]=_[_0xa6f4('0x39')](_0x41d70f[_0xa6f4('0x3a')],qs[_0xa6f4('0x3c')](_0x548be7[_0xa6f4('0x38')][_0xa6f4('0x3c')]));_0xac09e5[_0xa6f4('0x3b')]=_0xac09e5['attributes'][_0xa6f4('0x3d')]?_0xac09e5[_0xa6f4('0x3b')]:_0x41d70f[_0xa6f4('0x3a')];if(!_0x548be7[_0xa6f4('0x38')][_0xa6f4('0x3e')]('nolimit')){_0xac09e5['limit']=qs[_0xa6f4('0x22')](_0x548be7[_0xa6f4('0x38')][_0xa6f4('0x22')]);_0xac09e5['offset']=qs['offset'](_0x548be7[_0xa6f4('0x38')][_0xa6f4('0x20')]);}_0xac09e5[_0xa6f4('0x3f')]=qs[_0xa6f4('0x40')](_0x548be7[_0xa6f4('0x38')][_0xa6f4('0x40')]);_0xac09e5['where']=qs[_0xa6f4('0x41')](_[_0xa6f4('0x42')](_0x548be7[_0xa6f4('0x38')],_0x41d70f[_0xa6f4('0x41')]),_0x1a6774);if(_0x548be7['query'][_0xa6f4('0x43')]){_0xac09e5['where']=_[_0xa6f4('0x44')](_0xac09e5[_0xa6f4('0x45')],{'$or':_[_0xa6f4('0x33')](_0x1a6774,function(_0x49536b){if(_0x49536b[_0xa6f4('0x46')]!==_0xa6f4('0x47')){var _0x51f8e2={};_0x51f8e2[_0x49536b[_0xa6f4('0x30')]]={'$like':'%'+_0x548be7[_0xa6f4('0x38')]['filter']+'%'};return _0x51f8e2;}})});}_0xac09e5=_[_0xa6f4('0x44')]({},_0xac09e5,_0x548be7[_0xa6f4('0x48')]);var _0x24aede={'where':_0xac09e5[_0xa6f4('0x45')]};return db[_0xa6f4('0x34')][_0xa6f4('0x23')](_0x24aede)[_0xa6f4('0x2a')](function(_0x5be323){_0xb07c92[_0xa6f4('0x23')]=_0x5be323;if(_0x548be7[_0xa6f4('0x38')][_0xa6f4('0x49')]){_0xac09e5['include']=[{'all':!![]}];}return db[_0xa6f4('0x34')]['findAll'](_0xac09e5);})['then'](function(_0x1d4d56){_0xb07c92[_0xa6f4('0x4a')]=_0x1d4d56;return _0xb07c92;})[_0xa6f4('0x2a')](respondWithFilteredResult(_0x519dab,_0xac09e5))[_0xa6f4('0x4b')](handleError(_0x519dab,null));};exports[_0xa6f4('0x4c')]=function(_0x35e0f5,_0x56c339){var _0x4b041c={'raw':![],'where':{'id':_0x35e0f5[_0xa6f4('0x4d')]['id']}},_0x5866fe={};_0x5866fe[_0xa6f4('0x3a')]=_[_0xa6f4('0x37')](db['Dashboard']['rawAttributes']);_0x5866fe[_0xa6f4('0x38')]=_[_0xa6f4('0x37')](_0x35e0f5[_0xa6f4('0x38')]);_0x5866fe['filters']=_[_0xa6f4('0x39')](_0x5866fe['model'],_0x5866fe[_0xa6f4('0x38')]);_0x4b041c[_0xa6f4('0x3b')]=_['intersection'](_0x5866fe[_0xa6f4('0x3a')],qs[_0xa6f4('0x3c')](_0x35e0f5[_0xa6f4('0x38')][_0xa6f4('0x3c')]));_0x4b041c[_0xa6f4('0x3b')]=_0x4b041c[_0xa6f4('0x3b')][_0xa6f4('0x3d')]?_0x4b041c['attributes']:_0x5866fe['model'];if(_0x35e0f5['query'][_0xa6f4('0x49')]){_0x4b041c[_0xa6f4('0x4e')]=[{'all':!![]}];}_0x4b041c=_[_0xa6f4('0x44')]({},_0x4b041c,_0x35e0f5['options']);return db[_0xa6f4('0x34')]['find'](_0x4b041c)[_0xa6f4('0x2a')](handleEntityNotFound(_0x56c339,null))[_0xa6f4('0x2a')](respondWithResult(_0x56c339,null))[_0xa6f4('0x4b')](handleError(_0x56c339,null));};exports['create']=function(_0x8c4a29,_0x307569){return db[_0xa6f4('0x34')][_0xa6f4('0x4f')](_0x8c4a29['body'],{})[_0xa6f4('0x2a')](function(_0x4b79a8){var _0xfb46f0=_0x8c4a29[_0xa6f4('0x50')][_0xa6f4('0x51')]({'plain':!![]});if(!_0xfb46f0)throw new Error(_0xa6f4('0x52'));if(_0xfb46f0[_0xa6f4('0x53')]===_0xa6f4('0x50')){var _0x133afd=_0x4b79a8[_0xa6f4('0x51')]({'plain':!![]});var _0x187dc3=_0xa6f4('0x54');return db[_0xa6f4('0x55')][_0xa6f4('0x56')]({'where':{'name':_0x187dc3,'userProfileId':_0xfb46f0[_0xa6f4('0x57')]},'raw':!![]})['then'](function(_0x25f669){if(_0x25f669&&_0x25f669[_0xa6f4('0x58')]===0x0){return db[_0xa6f4('0x2b')][_0xa6f4('0x4f')]({'name':_0x133afd[_0xa6f4('0x30')],'resourceId':_0x133afd['id'],'type':_0x25f669[_0xa6f4('0x30')],'sectionId':_0x25f669['id']},{})['then'](function(){return _0x4b79a8;});}else{return _0x4b79a8;}})[_0xa6f4('0x4b')](function(_0x23aaaf){logger['error'](_0xa6f4('0x59'),_0x23aaaf);throw _0x23aaaf;});}return _0x4b79a8;})['then'](respondWithResult(_0x307569,0xc9))[_0xa6f4('0x4b')](handleError(_0x307569,null));};exports['clone']=function(_0x5e04ad,_0x1d9063){var _0x5d3c29={'where':{'id':_0x5e04ad[_0xa6f4('0x4d')]['id']}},_0x33286d={};_0x33286d[_0xa6f4('0x3a')]=_[_0xa6f4('0x37')](db[_0xa6f4('0x34')][_0xa6f4('0x5a')]);_0x5d3c29['attributes']=_[_0xa6f4('0x39')](_0x33286d['model'],qs[_0xa6f4('0x3c')](_0x5e04ad[_0xa6f4('0x38')][_0xa6f4('0x3c')]));_0x5d3c29[_0xa6f4('0x3b')]=_0x5d3c29[_0xa6f4('0x3b')][_0xa6f4('0x3d')]?_0x5d3c29['attributes']:_0x33286d[_0xa6f4('0x3a')];if(_0x5e04ad[_0xa6f4('0x38')][_0xa6f4('0x49')]){_0x5d3c29['include']=[{'all':!![]}];}_0x5d3c29=_[_0xa6f4('0x44')]({},_0x5d3c29,_0x5e04ad[_0xa6f4('0x48')]);return db['Dashboard'][_0xa6f4('0x56')](_0x5d3c29)['then'](handleEntityNotFound(_0x1d9063,null))[_0xa6f4('0x2a')](function(_0x29e3ff){if(_0x29e3ff){var _0x323a61=_0x29e3ff['get']({'plain':!![]});_0x323a61=qs[_0xa6f4('0x5b')](_0x323a61,['id','createdAt',_0xa6f4('0x5c')]);_0x5e04ad[_0xa6f4('0x5d')]=_[_0xa6f4('0x5b')](_0x5e04ad[_0xa6f4('0x5d')],['id',_0xa6f4('0x5e'),'updatedAt']);return db[_0xa6f4('0x34')]['create'](_[_0xa6f4('0x44')](_0x323a61,_0x5e04ad[_0xa6f4('0x5d')]),{'include':_0x5e04ad[_0xa6f4('0x38')][_0xa6f4('0x49')]?[{'all':!![]}]:undefined})[_0xa6f4('0x2a')](function(_0xb46c4a){var _0x40c226=_0x5e04ad['user'][_0xa6f4('0x51')]({'plain':!![]});if(!_0x40c226)throw new Error(_0xa6f4('0x52'));if(_0x40c226['role']===_0xa6f4('0x50')){var _0x25533f=_0xb46c4a[_0xa6f4('0x51')]({'plain':!![]});var _0x3a8f4a=_0xa6f4('0x54');return db['UserProfileSection'][_0xa6f4('0x56')]({'where':{'name':_0x3a8f4a,'userProfileId':_0x40c226[_0xa6f4('0x57')]},'raw':!![]})['then'](function(_0x44b15c){if(_0x44b15c&&_0x44b15c['autoAssociation']===0x0){return db[_0xa6f4('0x2b')][_0xa6f4('0x4f')]({'name':_0x25533f[_0xa6f4('0x30')],'resourceId':_0x25533f['id'],'type':_0x44b15c[_0xa6f4('0x30')],'sectionId':_0x44b15c['id']},{})[_0xa6f4('0x2a')](function(){return _0xb46c4a;});}else{return _0xb46c4a;}})[_0xa6f4('0x4b')](function(_0x3d161e){logger[_0xa6f4('0x2e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3d161e);throw _0x3d161e;});}return _0xb46c4a;});}})[_0xa6f4('0x2a')](respondWithResult(_0x1d9063,0xc9))[_0xa6f4('0x4b')](handleError(_0x1d9063,null));};exports['update']=function(_0x1df377,_0x265ea9){if(_0x1df377['body']['id']){delete _0x1df377[_0xa6f4('0x5d')]['id'];}return db['Dashboard'][_0xa6f4('0x56')]({'where':{'id':_0x1df377[_0xa6f4('0x4d')]['id']}})[_0xa6f4('0x2a')](handleEntityNotFound(_0x265ea9,null))[_0xa6f4('0x2a')](saveUpdates(_0x1df377[_0xa6f4('0x5d')],null))[_0xa6f4('0x2a')](respondWithResult(_0x265ea9,null))['catch'](handleError(_0x265ea9,null));};exports['destroy']=function(_0x1c65a5,_0x3033ce){return db[_0xa6f4('0x34')]['find']({'where':{'id':_0x1c65a5[_0xa6f4('0x4d')]['id']}})[_0xa6f4('0x2a')](handleEntityNotFound(_0x3033ce,null))['then'](removeEntity(_0x3033ce,null))[_0xa6f4('0x4b')](handleError(_0x3033ce,null));};function widgetAttributes(_0x3d3012){try{switch(_0x3d3012[_0xa6f4('0x46')]){case _0xa6f4('0x5f'):return[{'name':_0xa6f4('0x60'),'value':_0x3d3012[_0xa6f4('0x60')]||(_0x3d3012[_0xa6f4('0x61')]&&_0x3d3012[_0xa6f4('0x61')][0x0]?_0x3d3012[_0xa6f4('0x61')][0x0][_0xa6f4('0x62')]:undefined)||_0xa6f4('0x63')}];case _0xa6f4('0x64'):return[{'name':_0xa6f4('0x65'),'value':_0x3d3012['attrPath']||(_0x3d3012[_0xa6f4('0x61')]&&_0x3d3012[_0xa6f4('0x61')][0x0]?_0x3d3012[_0xa6f4('0x61')][0x0][_0xa6f4('0x62')]:undefined)||''}];case _0xa6f4('0x66'):return[{'name':_0xa6f4('0x67'),'value':_0x3d3012['attrHourFormat']||(_0x3d3012[_0xa6f4('0x61')]&&_0x3d3012['attrs'][0x0]?_0x3d3012[_0xa6f4('0x61')][0x0][_0xa6f4('0x62')]:undefined)||_0xa6f4('0x68')},{'name':_0xa6f4('0x69'),'value':_0x3d3012[_0xa6f4('0x69')]||(_0x3d3012['attrs']&&_0x3d3012[_0xa6f4('0x61')][0x1]?_0x3d3012['attrs'][0x1]['value']:undefined)||_0xa6f4('0x6a')},{'name':_0xa6f4('0x6b'),'value':_0x3d3012[_0xa6f4('0x6b')]||(_0x3d3012[_0xa6f4('0x61')]&&_0x3d3012[_0xa6f4('0x61')][0x2]?_0x3d3012[_0xa6f4('0x61')][0x2]['value']:undefined)||0xc}];case _0xa6f4('0x6c'):return[{'name':'attrMetric','value':_0x3d3012[_0xa6f4('0x6d')]||(_0x3d3012[_0xa6f4('0x61')]&&_0x3d3012[_0xa6f4('0x61')][0x0]?_0x3d3012['attrs'][0x0][_0xa6f4('0x62')]:undefined)||_0xa6f4('0x6e')},{'name':_0xa6f4('0x6f'),'value':_0x3d3012[_0xa6f4('0x6f')]||(_0x3d3012[_0xa6f4('0x61')]&&_0x3d3012[_0xa6f4('0x61')][0x1]?_0x3d3012[_0xa6f4('0x61')][0x1][_0xa6f4('0x62')]:undefined)||[]},{'name':'attrFontSize','value':_0x3d3012[_0xa6f4('0x6b')]||(_0x3d3012[_0xa6f4('0x61')]&&_0x3d3012[_0xa6f4('0x61')][0x2]?_0x3d3012[_0xa6f4('0x61')][0x2][_0xa6f4('0x62')]:undefined)||0x14},{'name':_0xa6f4('0x70'),'value':_0x3d3012['attrChannel']||(_0x3d3012[_0xa6f4('0x61')]&&_0x3d3012['attrs'][0x3]?_0x3d3012[_0xa6f4('0x61')][0x3]['value']:undefined)||_0xa6f4('0x71')},{'name':_0xa6f4('0x72'),'value':_0x3d3012[_0xa6f4('0x72')]||(_0x3d3012['attrs']&&_0x3d3012[_0xa6f4('0x61')][0x4]?_0x3d3012['attrs'][0x4][_0xa6f4('0x62')]:undefined)||''},{'name':_0xa6f4('0x73'),'value':_0x3d3012[_0xa6f4('0x73')]||(_0x3d3012[_0xa6f4('0x61')]&&_0x3d3012[_0xa6f4('0x61')][0x5]?_0x3d3012[_0xa6f4('0x61')][0x5][_0xa6f4('0x62')]:undefined)||''},{'name':_0xa6f4('0x74'),'value':_0x3d3012['attrSmsAccounts']||(_0x3d3012['attrs']&&_0x3d3012[_0xa6f4('0x61')][0x6]?_0x3d3012['attrs'][0x6]['value']:undefined)||''},{'name':_0xa6f4('0x75'),'value':_0x3d3012[_0xa6f4('0x75')]||(_0x3d3012[_0xa6f4('0x61')]&&_0x3d3012[_0xa6f4('0x61')][0x7]?_0x3d3012['attrs'][0x7][_0xa6f4('0x62')]:undefined)||''},{'name':_0xa6f4('0x76'),'value':_0x3d3012['attrWhatsappAccounts']||(_0x3d3012[_0xa6f4('0x61')]&&_0x3d3012[_0xa6f4('0x61')][0x8]?_0x3d3012[_0xa6f4('0x61')][0x8][_0xa6f4('0x62')]:undefined)||''},{'name':_0xa6f4('0x77'),'value':_0x3d3012['attrChatWebsites']||(_0x3d3012[_0xa6f4('0x61')]&&_0x3d3012[_0xa6f4('0x61')][0x9]?_0x3d3012[_0xa6f4('0x61')][0x9]['value']:undefined)||''}];case _0xa6f4('0x78'):case'pie-chart':return[{'name':'attrSerie1','value':_0x3d3012['attrSerie1']||(_0x3d3012[_0xa6f4('0x61')]&&_0x3d3012[_0xa6f4('0x61')][0x0]?_0x3d3012[_0xa6f4('0x61')][0x0]['value']:undefined)||_0xa6f4('0x6e')},{'name':_0xa6f4('0x79'),'value':_0x3d3012[_0xa6f4('0x79')]||(_0x3d3012[_0xa6f4('0x61')]&&_0x3d3012[_0xa6f4('0x61')][0x1]?_0x3d3012['attrs'][0x1][_0xa6f4('0x62')]:undefined)||null},{'name':_0xa6f4('0x7a'),'value':_0x3d3012[_0xa6f4('0x7a')]||(_0x3d3012['attrs']&&_0x3d3012['attrs'][0x2]?_0x3d3012[_0xa6f4('0x61')][0x2][_0xa6f4('0x62')]:undefined)||null},{'name':_0xa6f4('0x6f'),'value':_0x3d3012[_0xa6f4('0x6f')]||(_0x3d3012[_0xa6f4('0x61')]&&_0x3d3012[_0xa6f4('0x61')][0x3]?_0x3d3012[_0xa6f4('0x61')][0x3][_0xa6f4('0x62')]:undefined)||[]},{'name':'attrChannel','value':_0x3d3012[_0xa6f4('0x70')]||(_0x3d3012[_0xa6f4('0x61')]&&_0x3d3012[_0xa6f4('0x61')][0x4]?_0x3d3012['attrs'][0x4][_0xa6f4('0x62')]:undefined)||_0xa6f4('0x71')},{'name':_0xa6f4('0x72'),'value':_0x3d3012[_0xa6f4('0x72')]||(_0x3d3012[_0xa6f4('0x61')]&&_0x3d3012[_0xa6f4('0x61')][0x5]?_0x3d3012[_0xa6f4('0x61')][0x5]['value']:undefined)||''},{'name':_0xa6f4('0x73'),'value':_0x3d3012[_0xa6f4('0x73')]||(_0x3d3012[_0xa6f4('0x61')]&&_0x3d3012['attrs'][0x6]?_0x3d3012[_0xa6f4('0x61')][0x6][_0xa6f4('0x62')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x3d3012[_0xa6f4('0x74')]||(_0x3d3012[_0xa6f4('0x61')]&&_0x3d3012[_0xa6f4('0x61')][0x7]?_0x3d3012['attrs'][0x7][_0xa6f4('0x62')]:undefined)||''},{'name':_0xa6f4('0x75'),'value':_0x3d3012[_0xa6f4('0x75')]||(_0x3d3012[_0xa6f4('0x61')]&&_0x3d3012['attrs'][0x8]?_0x3d3012['attrs'][0x8]['value']:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x3d3012[_0xa6f4('0x76')]||(_0x3d3012[_0xa6f4('0x61')]&&_0x3d3012[_0xa6f4('0x61')][0x9]?_0x3d3012['attrs'][0x9][_0xa6f4('0x62')]:undefined)||''},{'name':_0xa6f4('0x77'),'value':_0x3d3012[_0xa6f4('0x77')]||(_0x3d3012[_0xa6f4('0x61')]&&_0x3d3012['attrs'][0xa]?_0x3d3012[_0xa6f4('0x61')][0xa][_0xa6f4('0x62')]:undefined)||''}];case _0xa6f4('0x7b'):return[{'name':_0xa6f4('0x7c'),'type':_0x3d3012[_0xa6f4('0x7d')]||(_0x3d3012[_0xa6f4('0x61')]&&_0x3d3012[_0xa6f4('0x61')][0x0]?_0x3d3012[_0xa6f4('0x61')][0x0][_0xa6f4('0x46')]:undefined)||null,'value':_0x3d3012[_0xa6f4('0x7c')]||(_0x3d3012[_0xa6f4('0x61')]&&_0x3d3012[_0xa6f4('0x61')][0x0]?_0x3d3012[_0xa6f4('0x61')][0x0]['value']:undefined)||null},{'name':_0xa6f4('0x7e'),'value':_0x3d3012[_0xa6f4('0x7e')]||(_0x3d3012[_0xa6f4('0x61')]&&_0x3d3012['attrs'][0x1]?_0x3d3012['attrs'][0x1][_0xa6f4('0x62')]:undefined)||0x0}];default:return[];}}catch(_0x292984){logger['error'](_0xa6f4('0x7f'),JSON[_0xa6f4('0x80')](_0x292984));return[];}}exports[_0xa6f4('0x81')]=function(_0x13b70f,_0x2ed12a,_0x1e78f6){if(_0x13b70f[_0xa6f4('0x5d')]['id']){delete _0x13b70f[_0xa6f4('0x5d')]['id'];}return db[_0xa6f4('0x34')]['find']({'where':{'id':_0x13b70f[_0xa6f4('0x4d')]['id']}})[_0xa6f4('0x2a')](handleEntityNotFound(_0x2ed12a,null))[_0xa6f4('0x2a')](function(_0x343efc){if(_0x343efc){_0x13b70f[_0xa6f4('0x5d')][_0xa6f4('0x82')]=_0x343efc['id'];_0x13b70f[_0xa6f4('0x5d')][_0xa6f4('0x61')]=widgetAttributes(_0x13b70f['body']);return db['DashboardItem'][_0xa6f4('0x4f')](_0x13b70f['body']);}})[_0xa6f4('0x2a')](respondWithResult(_0x2ed12a,null))[_0xa6f4('0x4b')](handleError(_0x2ed12a,null));};exports[_0xa6f4('0x83')]=function(_0x181e5a,_0x5b374d,_0x468a38){var _0x317609={};var _0x30812f={};var _0x52957b;var _0x5bd283;return db[_0xa6f4('0x34')][_0xa6f4('0x84')]({'where':{'id':_0x181e5a[_0xa6f4('0x4d')]['id']}})[_0xa6f4('0x2a')](handleEntityNotFound(_0x5b374d,null))[_0xa6f4('0x2a')](function(_0x24075f){if(_0x24075f){_0x52957b=_0x24075f;_0x30812f[_0xa6f4('0x3a')]=_['keys'](db[_0xa6f4('0x85')][_0xa6f4('0x5a')]);_0x30812f[_0xa6f4('0x38')]=_[_0xa6f4('0x37')](_0x181e5a[_0xa6f4('0x38')]);_0x30812f[_0xa6f4('0x41')]=_[_0xa6f4('0x39')](_0x30812f[_0xa6f4('0x3a')],_0x30812f[_0xa6f4('0x38')]);_0x317609['attributes']=_['intersection'](_0x30812f[_0xa6f4('0x3a')],qs['fields'](_0x181e5a[_0xa6f4('0x38')][_0xa6f4('0x3c')]));_0x317609['attributes']=_0x317609['attributes'][_0xa6f4('0x3d')]?_0x317609[_0xa6f4('0x3b')]:_0x30812f[_0xa6f4('0x3a')];_0x317609[_0xa6f4('0x3f')]=qs['sort'](_0x181e5a[_0xa6f4('0x38')][_0xa6f4('0x40')]);_0x317609[_0xa6f4('0x45')]=qs['filters'](_[_0xa6f4('0x42')](_0x181e5a[_0xa6f4('0x38')],_0x30812f[_0xa6f4('0x41')]));if(_0x181e5a[_0xa6f4('0x38')][_0xa6f4('0x43')]){_0x317609[_0xa6f4('0x45')]=_[_0xa6f4('0x44')](_0x317609['where'],{'$or':_['map'](_0x317609[_0xa6f4('0x3b')],function(_0xc5782c){var _0x35f3e7={};_0x35f3e7[_0xc5782c]={'$like':'%'+_0x181e5a[_0xa6f4('0x38')]['filter']+'%'};return _0x35f3e7;})});}_0x317609=_[_0xa6f4('0x44')]({},_0x317609,_0x181e5a[_0xa6f4('0x48')]);return _0x52957b[_0xa6f4('0x83')](_0x317609);}})[_0xa6f4('0x2a')](function(_0x4bf581){if(_0x4bf581){_0x5bd283=_0x4bf581[_0xa6f4('0x3d')];if(!_0x181e5a[_0xa6f4('0x38')][_0xa6f4('0x3e')](_0xa6f4('0x86'))){_0x317609[_0xa6f4('0x22')]=qs[_0xa6f4('0x22')](_0x181e5a['query'][_0xa6f4('0x22')]);_0x317609[_0xa6f4('0x20')]=qs['offset'](_0x181e5a['query'][_0xa6f4('0x20')]);}return _0x52957b[_0xa6f4('0x83')](_0x317609);}})[_0xa6f4('0x2a')](function(_0x282e16){if(_0x282e16){return _0x282e16?{'count':_0x5bd283,'rows':_0x282e16}:null;}})[_0xa6f4('0x2a')](respondWithResult(_0x5b374d,null))[_0xa6f4('0x4b')](handleError(_0x5b374d,null));}; \ No newline at end of file +var _0xb456=['filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','options','include','findAll','rows','show','params','length','includeAll','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','clone','omit','createdAt','updatedAt','body','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','iframe','attrUrl','attrs','https://','custom','value','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','attrSerie1','attrSerie2','web-report','reportType','attrReport','attrRefresh','widgetAttributes:\x20%s','addItem','DashboardItem','getItems','findOne','filter','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','redis','./dashboard.socket','register','status','end','json','offset','undefined','limit','count','set','apply','reject','destroy','get','CustomDashboards','UserProfileResource','then','sendStatus','error','name','Dashboard','rawAttributes','fieldName','type','key','model','map','keys','query'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xb456,0x1b9));var _0x6b45=function(_0x1b05fa,_0x50b463){_0x1b05fa=_0x1b05fa-0x0;var _0x50740a=_0xb456[_0x1b05fa];return _0x50740a;};'use strict';var emlformat=require(_0x6b45('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6b45('0x1'));var jsonpatch=require(_0x6b45('0x2'));var rp=require(_0x6b45('0x3'));var moment=require(_0x6b45('0x4'));var BPromise=require(_0x6b45('0x5'));var Mustache=require(_0x6b45('0x6'));var util=require('util');var path=require(_0x6b45('0x7'));var sox=require('sox');var csv=require(_0x6b45('0x8'));var ejs=require(_0x6b45('0x9'));var fs=require('fs');var fs_extra=require(_0x6b45('0xa'));var _=require(_0x6b45('0xb'));var squel=require(_0x6b45('0xc'));var crypto=require('crypto');var jsforce=require(_0x6b45('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x6b45('0x8'));var querystring=require('querystring');var Papa=require(_0x6b45('0xe'));var Redis=require(_0x6b45('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x6b45('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6b45('0x11'));var logger=require(_0x6b45('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x6b45('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x6b45('0x14'))['db'];config[_0x6b45('0x15')]=_['defaults'](config[_0x6b45('0x15')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6b45('0x15')]));require(_0x6b45('0x16'))[_0x6b45('0x17')](socket);function respondWithStatusCode(_0x5ac42c,_0x1bb2ed){_0x1bb2ed=_0x1bb2ed||0xcc;return function(_0x4f3dd0){if(_0x4f3dd0){return _0x5ac42c['sendStatus'](_0x1bb2ed);}return _0x5ac42c[_0x6b45('0x18')](_0x1bb2ed)[_0x6b45('0x19')]();};}function respondWithResult(_0x379f0f,_0x182a8a){_0x182a8a=_0x182a8a||0xc8;return function(_0x421781){if(_0x421781){return _0x379f0f[_0x6b45('0x18')](_0x182a8a)[_0x6b45('0x1a')](_0x421781);}};}function respondWithFilteredResult(_0x35d546,_0x1d4d9e){return function(_0x17a78d){if(_0x17a78d){var _0x147d68=typeof _0x1d4d9e[_0x6b45('0x1b')]===_0x6b45('0x1c')&&typeof _0x1d4d9e[_0x6b45('0x1d')]===_0x6b45('0x1c');var _0xa78920=_0x17a78d['count'];var _0x3ef902=_0x147d68?0x0:_0x1d4d9e[_0x6b45('0x1b')];var _0x5798f5=_0x147d68?_0x17a78d[_0x6b45('0x1e')]:_0x1d4d9e[_0x6b45('0x1b')]+_0x1d4d9e[_0x6b45('0x1d')];var _0x15d10b;if(_0x5798f5>=_0xa78920){_0x5798f5=_0xa78920;_0x15d10b=0xc8;}else{_0x15d10b=0xce;}_0x35d546[_0x6b45('0x18')](_0x15d10b);return _0x35d546[_0x6b45('0x1f')]('Content-Range',_0x3ef902+'-'+_0x5798f5+'/'+_0xa78920)[_0x6b45('0x1a')](_0x17a78d);}return null;};}function patchUpdates(_0x3d203f){return function(_0x920b48){try{jsonpatch[_0x6b45('0x20')](_0x920b48,_0x3d203f,!![]);}catch(_0xaac6e2){return BPromise[_0x6b45('0x21')](_0xaac6e2);}return _0x920b48['save']();};}function saveUpdates(_0x1fdcaf,_0x13da24){return function(_0x48219a){if(_0x48219a){return _0x48219a['update'](_0x1fdcaf)['then'](function(_0x10a304){return _0x10a304;});}return null;};}function removeEntity(_0x30bb10,_0x2dcad7){return function(_0x3a0612){if(_0x3a0612){return _0x3a0612[_0x6b45('0x22')]()['then'](function(){var _0x32a2a5=_0x3a0612[_0x6b45('0x23')]({'plain':!![]});var _0x4dfebd=_0x6b45('0x24');return db[_0x6b45('0x25')]['destroy']({'where':{'type':_0x4dfebd,'resourceId':_0x32a2a5['id']}})['then'](function(){return _0x3a0612;});})[_0x6b45('0x26')](function(){_0x30bb10[_0x6b45('0x18')](0xcc)[_0x6b45('0x19')]();});}};}function handleEntityNotFound(_0x346bc8,_0x38faf8){return function(_0x42124d){if(!_0x42124d){_0x346bc8[_0x6b45('0x27')](0x194);}return _0x42124d;};}function handleError(_0x2ab56e,_0x1f2975){_0x1f2975=_0x1f2975||0x1f4;return function(_0x277d7a){logger[_0x6b45('0x28')](_0x277d7a['stack']);if(_0x277d7a['name']){delete _0x277d7a[_0x6b45('0x29')];}_0x2ab56e[_0x6b45('0x18')](_0x1f2975)['send'](_0x277d7a);};}exports['index']=function(_0x52b121,_0xcf23cf){var _0xfadd9b={},_0x10a564={},_0x3acd67={'count':0x0,'rows':[]};var _0x3dd0f0=_['map'](db[_0x6b45('0x2a')][_0x6b45('0x2b')],function(_0x176222){return{'name':_0x176222[_0x6b45('0x2c')],'type':_0x176222[_0x6b45('0x2d')][_0x6b45('0x2e')]};});_0x10a564[_0x6b45('0x2f')]=_[_0x6b45('0x30')](_0x3dd0f0,_0x6b45('0x29'));_0x10a564['query']=_[_0x6b45('0x31')](_0x52b121[_0x6b45('0x32')]);_0x10a564[_0x6b45('0x33')]=_['intersection'](_0x10a564[_0x6b45('0x2f')],_0x10a564[_0x6b45('0x32')]);_0xfadd9b['attributes']=_[_0x6b45('0x34')](_0x10a564['model'],qs['fields'](_0x52b121[_0x6b45('0x32')][_0x6b45('0x35')]));_0xfadd9b[_0x6b45('0x36')]=_0xfadd9b[_0x6b45('0x36')]['length']?_0xfadd9b[_0x6b45('0x36')]:_0x10a564['model'];if(!_0x52b121['query'][_0x6b45('0x37')]('nolimit')){_0xfadd9b[_0x6b45('0x1d')]=qs['limit'](_0x52b121['query']['limit']);_0xfadd9b[_0x6b45('0x1b')]=qs['offset'](_0x52b121[_0x6b45('0x32')][_0x6b45('0x1b')]);}_0xfadd9b[_0x6b45('0x38')]=qs[_0x6b45('0x39')](_0x52b121[_0x6b45('0x32')][_0x6b45('0x39')]);_0xfadd9b[_0x6b45('0x3a')]=qs[_0x6b45('0x33')](_[_0x6b45('0x3b')](_0x52b121[_0x6b45('0x32')],_0x10a564[_0x6b45('0x33')]),_0x3dd0f0);if(_0x52b121['query']['filter']){_0xfadd9b[_0x6b45('0x3a')]=_[_0x6b45('0x3c')](_0xfadd9b['where'],{'$or':_[_0x6b45('0x30')](_0x3dd0f0,function(_0x33b7a2){if(_0x33b7a2[_0x6b45('0x2d')]!==_0x6b45('0x3d')){var _0x20fe67={};_0x20fe67[_0x33b7a2[_0x6b45('0x29')]]={'$like':'%'+_0x52b121['query']['filter']+'%'};return _0x20fe67;}})});}_0xfadd9b=_[_0x6b45('0x3c')]({},_0xfadd9b,_0x52b121[_0x6b45('0x3e')]);var _0x2d2c8c={'where':_0xfadd9b[_0x6b45('0x3a')]};return db[_0x6b45('0x2a')][_0x6b45('0x1e')](_0x2d2c8c)[_0x6b45('0x26')](function(_0x4aba13){_0x3acd67[_0x6b45('0x1e')]=_0x4aba13;if(_0x52b121[_0x6b45('0x32')]['includeAll']){_0xfadd9b[_0x6b45('0x3f')]=[{'all':!![]}];}return db['Dashboard'][_0x6b45('0x40')](_0xfadd9b);})[_0x6b45('0x26')](function(_0x33797d){_0x3acd67[_0x6b45('0x41')]=_0x33797d;return _0x3acd67;})['then'](respondWithFilteredResult(_0xcf23cf,_0xfadd9b))['catch'](handleError(_0xcf23cf,null));};exports[_0x6b45('0x42')]=function(_0x4fd9b2,_0xa7b2e5){var _0x1c5804={'raw':![],'where':{'id':_0x4fd9b2[_0x6b45('0x43')]['id']}},_0x2b3949={};_0x2b3949[_0x6b45('0x2f')]=_[_0x6b45('0x31')](db[_0x6b45('0x2a')]['rawAttributes']);_0x2b3949[_0x6b45('0x32')]=_[_0x6b45('0x31')](_0x4fd9b2[_0x6b45('0x32')]);_0x2b3949[_0x6b45('0x33')]=_[_0x6b45('0x34')](_0x2b3949['model'],_0x2b3949[_0x6b45('0x32')]);_0x1c5804[_0x6b45('0x36')]=_['intersection'](_0x2b3949[_0x6b45('0x2f')],qs[_0x6b45('0x35')](_0x4fd9b2['query'][_0x6b45('0x35')]));_0x1c5804[_0x6b45('0x36')]=_0x1c5804[_0x6b45('0x36')][_0x6b45('0x44')]?_0x1c5804['attributes']:_0x2b3949['model'];if(_0x4fd9b2[_0x6b45('0x32')][_0x6b45('0x45')]){_0x1c5804[_0x6b45('0x3f')]=[{'all':!![]}];}_0x1c5804=_[_0x6b45('0x3c')]({},_0x1c5804,_0x4fd9b2[_0x6b45('0x3e')]);return db[_0x6b45('0x2a')][_0x6b45('0x46')](_0x1c5804)[_0x6b45('0x26')](handleEntityNotFound(_0xa7b2e5,null))[_0x6b45('0x26')](respondWithResult(_0xa7b2e5,null))[_0x6b45('0x47')](handleError(_0xa7b2e5,null));};exports[_0x6b45('0x48')]=function(_0x19700b,_0x559d88){return db[_0x6b45('0x2a')][_0x6b45('0x48')](_0x19700b['body'],{})['then'](function(_0x578fa4){var _0x1ec7a6=_0x19700b[_0x6b45('0x49')]['get']({'plain':!![]});if(!_0x1ec7a6)throw new Error(_0x6b45('0x4a'));if(_0x1ec7a6['role']===_0x6b45('0x49')){var _0x16d91b=_0x578fa4[_0x6b45('0x23')]({'plain':!![]});var _0x248687=_0x6b45('0x24');return db[_0x6b45('0x4b')][_0x6b45('0x46')]({'where':{'name':_0x248687,'userProfileId':_0x1ec7a6['userProfileId']},'raw':!![]})[_0x6b45('0x26')](function(_0x441a72){if(_0x441a72&&_0x441a72['autoAssociation']===0x0){return db[_0x6b45('0x25')][_0x6b45('0x48')]({'name':_0x16d91b['name'],'resourceId':_0x16d91b['id'],'type':_0x441a72[_0x6b45('0x29')],'sectionId':_0x441a72['id']},{})['then'](function(){return _0x578fa4;});}else{return _0x578fa4;}})['catch'](function(_0x327590){logger[_0x6b45('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x327590);throw _0x327590;});}return _0x578fa4;})['then'](respondWithResult(_0x559d88,0xc9))['catch'](handleError(_0x559d88,null));};exports[_0x6b45('0x4c')]=function(_0x40b377,_0x2dc837){var _0x31ec54={'where':{'id':_0x40b377[_0x6b45('0x43')]['id']}},_0x2b915a={};_0x2b915a[_0x6b45('0x2f')]=_[_0x6b45('0x31')](db[_0x6b45('0x2a')][_0x6b45('0x2b')]);_0x31ec54[_0x6b45('0x36')]=_[_0x6b45('0x34')](_0x2b915a[_0x6b45('0x2f')],qs['fields'](_0x40b377['query'][_0x6b45('0x35')]));_0x31ec54[_0x6b45('0x36')]=_0x31ec54[_0x6b45('0x36')][_0x6b45('0x44')]?_0x31ec54[_0x6b45('0x36')]:_0x2b915a[_0x6b45('0x2f')];if(_0x40b377['query'][_0x6b45('0x45')]){_0x31ec54[_0x6b45('0x3f')]=[{'all':!![]}];}_0x31ec54=_[_0x6b45('0x3c')]({},_0x31ec54,_0x40b377['options']);return db['Dashboard'][_0x6b45('0x46')](_0x31ec54)['then'](handleEntityNotFound(_0x2dc837,null))[_0x6b45('0x26')](function(_0x4f3d3e){if(_0x4f3d3e){var _0x5bb0ea=_0x4f3d3e['get']({'plain':!![]});_0x5bb0ea=qs[_0x6b45('0x4d')](_0x5bb0ea,['id',_0x6b45('0x4e'),_0x6b45('0x4f')]);_0x40b377[_0x6b45('0x50')]=_['omit'](_0x40b377['body'],['id',_0x6b45('0x4e'),'updatedAt']);return db[_0x6b45('0x2a')][_0x6b45('0x48')](_[_0x6b45('0x3c')](_0x5bb0ea,_0x40b377[_0x6b45('0x50')]),{'include':_0x40b377[_0x6b45('0x32')][_0x6b45('0x45')]?[{'all':!![]}]:undefined})[_0x6b45('0x26')](function(_0x50df21){var _0x47f718=_0x40b377[_0x6b45('0x49')][_0x6b45('0x23')]({'plain':!![]});if(!_0x47f718)throw new Error(_0x6b45('0x4a'));if(_0x47f718[_0x6b45('0x51')]===_0x6b45('0x49')){var _0x68d4cf=_0x50df21['get']({'plain':!![]});var _0x215ca4=_0x6b45('0x24');return db[_0x6b45('0x4b')][_0x6b45('0x46')]({'where':{'name':_0x215ca4,'userProfileId':_0x47f718[_0x6b45('0x52')]},'raw':!![]})[_0x6b45('0x26')](function(_0x23b8ca){if(_0x23b8ca&&_0x23b8ca[_0x6b45('0x53')]===0x0){return db[_0x6b45('0x25')][_0x6b45('0x48')]({'name':_0x68d4cf[_0x6b45('0x29')],'resourceId':_0x68d4cf['id'],'type':_0x23b8ca[_0x6b45('0x29')],'sectionId':_0x23b8ca['id']},{})[_0x6b45('0x26')](function(){return _0x50df21;});}else{return _0x50df21;}})[_0x6b45('0x47')](function(_0x22c4fb){logger[_0x6b45('0x28')](_0x6b45('0x54'),_0x22c4fb);throw _0x22c4fb;});}return _0x50df21;});}})['then'](respondWithResult(_0x2dc837,0xc9))[_0x6b45('0x47')](handleError(_0x2dc837,null));};exports[_0x6b45('0x55')]=function(_0x42bdcc,_0x32bea2){if(_0x42bdcc[_0x6b45('0x50')]['id']){delete _0x42bdcc[_0x6b45('0x50')]['id'];}return db[_0x6b45('0x2a')][_0x6b45('0x46')]({'where':{'id':_0x42bdcc[_0x6b45('0x43')]['id']}})[_0x6b45('0x26')](handleEntityNotFound(_0x32bea2,null))[_0x6b45('0x26')](saveUpdates(_0x42bdcc[_0x6b45('0x50')],null))[_0x6b45('0x26')](respondWithResult(_0x32bea2,null))['catch'](handleError(_0x32bea2,null));};exports[_0x6b45('0x22')]=function(_0x4a2746,_0x282156){return db['Dashboard'][_0x6b45('0x46')]({'where':{'id':_0x4a2746[_0x6b45('0x43')]['id']}})[_0x6b45('0x26')](handleEntityNotFound(_0x282156,null))[_0x6b45('0x26')](removeEntity(_0x282156,null))[_0x6b45('0x47')](handleError(_0x282156,null));};function widgetAttributes(_0x3d6c2d){try{switch(_0x3d6c2d['type']){case _0x6b45('0x56'):return[{'name':_0x6b45('0x57'),'value':_0x3d6c2d[_0x6b45('0x57')]||(_0x3d6c2d[_0x6b45('0x58')]&&_0x3d6c2d[_0x6b45('0x58')][0x0]?_0x3d6c2d[_0x6b45('0x58')][0x0]['value']:undefined)||_0x6b45('0x59')}];case _0x6b45('0x5a'):return[{'name':'attrPath','value':_0x3d6c2d['attrPath']||(_0x3d6c2d['attrs']&&_0x3d6c2d[_0x6b45('0x58')][0x0]?_0x3d6c2d[_0x6b45('0x58')][0x0][_0x6b45('0x5b')]:undefined)||''}];case _0x6b45('0x5c'):return[{'name':_0x6b45('0x5d'),'value':_0x3d6c2d[_0x6b45('0x5d')]||(_0x3d6c2d['attrs']&&_0x3d6c2d[_0x6b45('0x58')][0x0]?_0x3d6c2d[_0x6b45('0x58')][0x0]['value']:undefined)||_0x6b45('0x5e')},{'name':_0x6b45('0x5f'),'value':_0x3d6c2d[_0x6b45('0x5f')]||(_0x3d6c2d[_0x6b45('0x58')]&&_0x3d6c2d[_0x6b45('0x58')][0x1]?_0x3d6c2d[_0x6b45('0x58')][0x1][_0x6b45('0x5b')]:undefined)||_0x6b45('0x60')},{'name':'attrFontSize','value':_0x3d6c2d[_0x6b45('0x61')]||(_0x3d6c2d[_0x6b45('0x58')]&&_0x3d6c2d[_0x6b45('0x58')][0x2]?_0x3d6c2d[_0x6b45('0x58')][0x2][_0x6b45('0x5b')]:undefined)||0xc}];case _0x6b45('0x62'):return[{'name':'attrMetric','value':_0x3d6c2d[_0x6b45('0x63')]||(_0x3d6c2d['attrs']&&_0x3d6c2d[_0x6b45('0x58')][0x0]?_0x3d6c2d[_0x6b45('0x58')][0x0][_0x6b45('0x5b')]:undefined)||_0x6b45('0x64')},{'name':_0x6b45('0x65'),'value':_0x3d6c2d[_0x6b45('0x65')]||(_0x3d6c2d['attrs']&&_0x3d6c2d[_0x6b45('0x58')][0x1]?_0x3d6c2d[_0x6b45('0x58')][0x1][_0x6b45('0x5b')]:undefined)||[]},{'name':'attrFontSize','value':_0x3d6c2d[_0x6b45('0x61')]||(_0x3d6c2d[_0x6b45('0x58')]&&_0x3d6c2d['attrs'][0x2]?_0x3d6c2d[_0x6b45('0x58')][0x2][_0x6b45('0x5b')]:undefined)||0x14},{'name':_0x6b45('0x66'),'value':_0x3d6c2d[_0x6b45('0x66')]||(_0x3d6c2d[_0x6b45('0x58')]&&_0x3d6c2d[_0x6b45('0x58')][0x3]?_0x3d6c2d[_0x6b45('0x58')][0x3]['value']:undefined)||_0x6b45('0x67')},{'name':'attrEmailAccounts','value':_0x3d6c2d[_0x6b45('0x68')]||(_0x3d6c2d[_0x6b45('0x58')]&&_0x3d6c2d[_0x6b45('0x58')][0x4]?_0x3d6c2d['attrs'][0x4]['value']:undefined)||''},{'name':_0x6b45('0x69'),'value':_0x3d6c2d[_0x6b45('0x69')]||(_0x3d6c2d[_0x6b45('0x58')]&&_0x3d6c2d[_0x6b45('0x58')][0x5]?_0x3d6c2d['attrs'][0x5]['value']:undefined)||''},{'name':'attrSmsAccounts','value':_0x3d6c2d[_0x6b45('0x6a')]||(_0x3d6c2d['attrs']&&_0x3d6c2d[_0x6b45('0x58')][0x6]?_0x3d6c2d[_0x6b45('0x58')][0x6][_0x6b45('0x5b')]:undefined)||''},{'name':_0x6b45('0x6b'),'value':_0x3d6c2d[_0x6b45('0x6b')]||(_0x3d6c2d['attrs']&&_0x3d6c2d[_0x6b45('0x58')][0x7]?_0x3d6c2d['attrs'][0x7][_0x6b45('0x5b')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x3d6c2d[_0x6b45('0x6c')]||(_0x3d6c2d[_0x6b45('0x58')]&&_0x3d6c2d['attrs'][0x8]?_0x3d6c2d[_0x6b45('0x58')][0x8][_0x6b45('0x5b')]:undefined)||''},{'name':_0x6b45('0x6d'),'value':_0x3d6c2d['attrChatWebsites']||(_0x3d6c2d[_0x6b45('0x58')]&&_0x3d6c2d[_0x6b45('0x58')][0x9]?_0x3d6c2d[_0x6b45('0x58')][0x9][_0x6b45('0x5b')]:undefined)||''}];case _0x6b45('0x6e'):case'pie-chart':return[{'name':_0x6b45('0x6f'),'value':_0x3d6c2d['attrSerie1']||(_0x3d6c2d[_0x6b45('0x58')]&&_0x3d6c2d[_0x6b45('0x58')][0x0]?_0x3d6c2d[_0x6b45('0x58')][0x0]['value']:undefined)||'total'},{'name':'attrSerie2','value':_0x3d6c2d[_0x6b45('0x70')]||(_0x3d6c2d[_0x6b45('0x58')]&&_0x3d6c2d[_0x6b45('0x58')][0x1]?_0x3d6c2d['attrs'][0x1]['value']:undefined)||null},{'name':'attrSerie3','value':_0x3d6c2d['attrSerie3']||(_0x3d6c2d[_0x6b45('0x58')]&&_0x3d6c2d[_0x6b45('0x58')][0x2]?_0x3d6c2d[_0x6b45('0x58')][0x2][_0x6b45('0x5b')]:undefined)||null},{'name':_0x6b45('0x65'),'value':_0x3d6c2d[_0x6b45('0x65')]||(_0x3d6c2d[_0x6b45('0x58')]&&_0x3d6c2d[_0x6b45('0x58')][0x3]?_0x3d6c2d['attrs'][0x3][_0x6b45('0x5b')]:undefined)||[]},{'name':'attrChannel','value':_0x3d6c2d[_0x6b45('0x66')]||(_0x3d6c2d[_0x6b45('0x58')]&&_0x3d6c2d[_0x6b45('0x58')][0x4]?_0x3d6c2d[_0x6b45('0x58')][0x4][_0x6b45('0x5b')]:undefined)||_0x6b45('0x67')},{'name':'attrEmailAccounts','value':_0x3d6c2d[_0x6b45('0x68')]||(_0x3d6c2d[_0x6b45('0x58')]&&_0x3d6c2d['attrs'][0x5]?_0x3d6c2d[_0x6b45('0x58')][0x5][_0x6b45('0x5b')]:undefined)||''},{'name':_0x6b45('0x69'),'value':_0x3d6c2d[_0x6b45('0x69')]||(_0x3d6c2d[_0x6b45('0x58')]&&_0x3d6c2d[_0x6b45('0x58')][0x6]?_0x3d6c2d[_0x6b45('0x58')][0x6]['value']:undefined)||''},{'name':_0x6b45('0x6a'),'value':_0x3d6c2d['attrSmsAccounts']||(_0x3d6c2d[_0x6b45('0x58')]&&_0x3d6c2d[_0x6b45('0x58')][0x7]?_0x3d6c2d[_0x6b45('0x58')][0x7][_0x6b45('0x5b')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x3d6c2d[_0x6b45('0x6b')]||(_0x3d6c2d['attrs']&&_0x3d6c2d['attrs'][0x8]?_0x3d6c2d[_0x6b45('0x58')][0x8][_0x6b45('0x5b')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x3d6c2d['attrWhatsappAccounts']||(_0x3d6c2d[_0x6b45('0x58')]&&_0x3d6c2d[_0x6b45('0x58')][0x9]?_0x3d6c2d[_0x6b45('0x58')][0x9][_0x6b45('0x5b')]:undefined)||''},{'name':_0x6b45('0x6d'),'value':_0x3d6c2d[_0x6b45('0x6d')]||(_0x3d6c2d[_0x6b45('0x58')]&&_0x3d6c2d[_0x6b45('0x58')][0xa]?_0x3d6c2d[_0x6b45('0x58')][0xa]['value']:undefined)||''}];case _0x6b45('0x71'):return[{'name':'attrReport','type':_0x3d6c2d[_0x6b45('0x72')]||(_0x3d6c2d[_0x6b45('0x58')]&&_0x3d6c2d[_0x6b45('0x58')][0x0]?_0x3d6c2d['attrs'][0x0][_0x6b45('0x2d')]:undefined)||null,'value':_0x3d6c2d[_0x6b45('0x73')]||(_0x3d6c2d[_0x6b45('0x58')]&&_0x3d6c2d[_0x6b45('0x58')][0x0]?_0x3d6c2d[_0x6b45('0x58')][0x0][_0x6b45('0x5b')]:undefined)||null},{'name':_0x6b45('0x74'),'value':_0x3d6c2d[_0x6b45('0x74')]||(_0x3d6c2d[_0x6b45('0x58')]&&_0x3d6c2d[_0x6b45('0x58')][0x1]?_0x3d6c2d[_0x6b45('0x58')][0x1][_0x6b45('0x5b')]:undefined)||0x0}];default:return[];}}catch(_0x1ea29d){logger[_0x6b45('0x28')](_0x6b45('0x75'),JSON['stringify'](_0x1ea29d));return[];}}exports[_0x6b45('0x76')]=function(_0x2ea6a3,_0x39dca1,_0x215496){if(_0x2ea6a3[_0x6b45('0x50')]['id']){delete _0x2ea6a3[_0x6b45('0x50')]['id'];}return db[_0x6b45('0x2a')]['find']({'where':{'id':_0x2ea6a3[_0x6b45('0x43')]['id']}})['then'](handleEntityNotFound(_0x39dca1,null))[_0x6b45('0x26')](function(_0x913cab){if(_0x913cab){_0x2ea6a3[_0x6b45('0x50')]['DashboardId']=_0x913cab['id'];_0x2ea6a3[_0x6b45('0x50')][_0x6b45('0x58')]=widgetAttributes(_0x2ea6a3[_0x6b45('0x50')]);return db[_0x6b45('0x77')][_0x6b45('0x48')](_0x2ea6a3[_0x6b45('0x50')]);}})[_0x6b45('0x26')](respondWithResult(_0x39dca1,null))[_0x6b45('0x47')](handleError(_0x39dca1,null));};exports[_0x6b45('0x78')]=function(_0x322d8c,_0x3908d0,_0x1b45a6){var _0xf121d={};var _0x1b24b7={};var _0x1f9292;var _0x116ad0;return db[_0x6b45('0x2a')][_0x6b45('0x79')]({'where':{'id':_0x322d8c[_0x6b45('0x43')]['id']}})[_0x6b45('0x26')](handleEntityNotFound(_0x3908d0,null))[_0x6b45('0x26')](function(_0x3813ec){if(_0x3813ec){_0x1f9292=_0x3813ec;_0x1b24b7[_0x6b45('0x2f')]=_[_0x6b45('0x31')](db['DashboardItem'][_0x6b45('0x2b')]);_0x1b24b7[_0x6b45('0x32')]=_[_0x6b45('0x31')](_0x322d8c[_0x6b45('0x32')]);_0x1b24b7['filters']=_['intersection'](_0x1b24b7['model'],_0x1b24b7[_0x6b45('0x32')]);_0xf121d[_0x6b45('0x36')]=_[_0x6b45('0x34')](_0x1b24b7[_0x6b45('0x2f')],qs[_0x6b45('0x35')](_0x322d8c[_0x6b45('0x32')][_0x6b45('0x35')]));_0xf121d[_0x6b45('0x36')]=_0xf121d[_0x6b45('0x36')][_0x6b45('0x44')]?_0xf121d[_0x6b45('0x36')]:_0x1b24b7[_0x6b45('0x2f')];_0xf121d[_0x6b45('0x38')]=qs[_0x6b45('0x39')](_0x322d8c[_0x6b45('0x32')][_0x6b45('0x39')]);_0xf121d[_0x6b45('0x3a')]=qs['filters'](_[_0x6b45('0x3b')](_0x322d8c['query'],_0x1b24b7[_0x6b45('0x33')]));if(_0x322d8c[_0x6b45('0x32')][_0x6b45('0x7a')]){_0xf121d['where']=_[_0x6b45('0x3c')](_0xf121d[_0x6b45('0x3a')],{'$or':_[_0x6b45('0x30')](_0xf121d['attributes'],function(_0x12863e){var _0x59767a={};_0x59767a[_0x12863e]={'$like':'%'+_0x322d8c['query'][_0x6b45('0x7a')]+'%'};return _0x59767a;})});}_0xf121d=_[_0x6b45('0x3c')]({},_0xf121d,_0x322d8c['options']);return _0x1f9292[_0x6b45('0x78')](_0xf121d);}})[_0x6b45('0x26')](function(_0x538def){if(_0x538def){_0x116ad0=_0x538def[_0x6b45('0x44')];if(!_0x322d8c[_0x6b45('0x32')]['hasOwnProperty']('nolimit')){_0xf121d[_0x6b45('0x1d')]=qs[_0x6b45('0x1d')](_0x322d8c[_0x6b45('0x32')][_0x6b45('0x1d')]);_0xf121d[_0x6b45('0x1b')]=qs[_0x6b45('0x1b')](_0x322d8c[_0x6b45('0x32')][_0x6b45('0x1b')]);}return _0x1f9292[_0x6b45('0x78')](_0xf121d);}})['then'](function(_0x40c63c){if(_0x40c63c){return _0x40c63c?{'count':_0x116ad0,'rows':_0x40c63c}:null;}})['then'](respondWithResult(_0x3908d0,null))[_0x6b45('0x47')](handleError(_0x3908d0,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 90ff390..4d62b00 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 _0x3343=['hasOwnProperty','hook','exports','Dashboard','setMaxListeners','save','update','remove','emit'];(function(_0x552c27,_0x478dc2){var _0x2a0922=function(_0x22617c){while(--_0x22617c){_0x552c27['push'](_0x552c27['shift']());}};_0x2a0922(++_0x478dc2);}(_0x3343,0x1aa));var _0x3334=function(_0x1551af,_0x5223c3){_0x1551af=_0x1551af-0x0;var _0xd8eb82=_0x3343[_0x1551af];return _0xd8eb82;};'use strict';var EventEmitter=require('events');var Dashboard=require('../../mysqldb')['db'][_0x3334('0x0')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x3334('0x1')](0x0);var events={'afterCreate':_0x3334('0x2'),'afterUpdate':_0x3334('0x3'),'afterDestroy':_0x3334('0x4')};function emitEvent(_0x5f5083){return function(_0x30b1fb,_0x16dcc0,_0x52de11){DashboardEvents[_0x3334('0x5')](_0x5f5083+':'+_0x30b1fb['id'],_0x30b1fb);DashboardEvents[_0x3334('0x5')](_0x5f5083,_0x30b1fb);_0x52de11(null);};}for(var e in events){if(events[_0x3334('0x6')](e)){var event=events[e];Dashboard[_0x3334('0x7')](e,emitEvent(event));}}module[_0x3334('0x8')]=DashboardEvents; \ No newline at end of file +var _0xb899=['remove','emit','hasOwnProperty','exports','events','../../mysqldb','Dashboard','save','update'];(function(_0x406c64,_0x219ec0){var _0x5f59ec=function(_0x37ac46){while(--_0x37ac46){_0x406c64['push'](_0x406c64['shift']());}};_0x5f59ec(++_0x219ec0);}(_0xb899,0x8b));var _0x9b89=function(_0x5efba1,_0x3d9361){_0x5efba1=_0x5efba1-0x0;var _0x336be6=_0xb899[_0x5efba1];return _0x336be6;};'use strict';var EventEmitter=require(_0x9b89('0x0'));var Dashboard=require(_0x9b89('0x1'))['db'][_0x9b89('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9b89('0x3'),'afterUpdate':_0x9b89('0x4'),'afterDestroy':_0x9b89('0x5')};function emitEvent(_0x281f5a){return function(_0x3afa4e,_0x477601,_0x28ac48){DashboardEvents[_0x9b89('0x6')](_0x281f5a+':'+_0x3afa4e['id'],_0x3afa4e);DashboardEvents['emit'](_0x281f5a,_0x3afa4e);_0x28ac48(null);};}for(var e in events){if(events[_0x9b89('0x7')](e)){var event=events[e];Dashboard['hook'](e,emitEvent(event));}}module[_0x9b89('0x8')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index c6dd141..7da9b96 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 _0xbad9=['request-promise','rimraf','./dashboard.attributes','define','Dashboard','dashboards','util','../../config/logger','api','moment','bluebird'];(function(_0x4be114,_0x15293d){var _0x39ac67=function(_0x4489a0){while(--_0x4489a0){_0x4be114['push'](_0x4be114['shift']());}};_0x39ac67(++_0x15293d);}(_0xbad9,0x119));var _0x9bad=function(_0x25ac0f,_0x251aa6){_0x25ac0f=_0x25ac0f-0x0;var _0x28201d=_0xbad9[_0x25ac0f];return _0x28201d;};'use strict';var _=require('lodash');var util=require(_0x9bad('0x0'));var logger=require(_0x9bad('0x1'))(_0x9bad('0x2'));var moment=require(_0x9bad('0x3'));var BPromise=require(_0x9bad('0x4'));var rp=require(_0x9bad('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9bad('0x6'));var config=require('../../config/environment');var attributes=require(_0x9bad('0x7'));module['exports']=function(_0x21de87,_0x130aa2){return _0x21de87[_0x9bad('0x8')](_0x9bad('0x9'),attributes,{'tableName':_0x9bad('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd00a=['exports','define','Dashboard','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./dashboard.attributes'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xd00a,0x1e3));var _0xad00=function(_0x4c5d84,_0x244cde){_0x4c5d84=_0x4c5d84-0x0;var _0x135396=_0xd00a[_0x4c5d84];return _0x135396;};'use strict';var _=require(_0xad00('0x0'));var util=require(_0xad00('0x1'));var logger=require(_0xad00('0x2'))('api');var moment=require(_0xad00('0x3'));var BPromise=require('bluebird');var rp=require(_0xad00('0x4'));var fs=require('fs');var path=require(_0xad00('0x5'));var rimraf=require(_0xad00('0x6'));var config=require(_0xad00('0x7'));var attributes=require(_0xad00('0x8'));module[_0xad00('0x9')]=function(_0x543bae,_0x375073){return _0x543bae[_0xad00('0xa')](_0xad00('0xb'),attributes,{'tableName':'dashboards','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.rpc.js b/server/api/dashboard/dashboard.rpc.js index b6acee9..d4a59b5 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 _0x555c=['rpc','jayson/promise','http','defaults','redis','socket.io-emitter','./dashboard.socket','request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','Dashboard,\x20%s,\x20%s,\x20%s','error','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x555c,0x1f0));var _0xc555=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0x555c[_0x28947d];return _0x12d2ee;};'use strict';var _=require(_0xc555('0x0'));var util=require(_0xc555('0x1'));var moment=require('moment');var BPromise=require(_0xc555('0x2'));var rs=require(_0xc555('0x3'));var fs=require('fs');var Redis=require(_0xc555('0x4'));var db=require(_0xc555('0x5'))['db'];var utils=require(_0xc555('0x6'));var logger=require(_0xc555('0x7'))(_0xc555('0x8'));var config=require('../../config/environment');var jayson=require(_0xc555('0x9'));var client=jayson['client'][_0xc555('0xa')]({'port':0x232a});config['redis']=_[_0xc555('0xb')](config[_0xc555('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xc555('0xd'))(new Redis(config[_0xc555('0xc')]));require(_0xc555('0xe'))['register'](socket);function respondWithRpcPromise(_0x4f596a,_0x10ffba,_0x15ba93){return new BPromise(function(_0x5b2ca6,_0xcdad29){return client[_0xc555('0xf')](_0x4f596a,_0x15ba93)[_0xc555('0x10')](function(_0x37167c){logger[_0xc555('0x11')](_0xc555('0x12'),_0x10ffba,_0xc555('0x13'));logger['debug'](_0xc555('0x14'),_0x10ffba,_0xc555('0x13'),JSON['stringify'](_0x37167c));if(_0x37167c[_0xc555('0x15')]){if(_0x37167c[_0xc555('0x15')]['code']===0x1f4){logger[_0xc555('0x15')]('Dashboard,\x20%s,\x20%s',_0x10ffba,_0x37167c[_0xc555('0x15')][_0xc555('0x16')]);return _0xcdad29(_0x37167c[_0xc555('0x15')]['message']);}logger[_0xc555('0x15')](_0xc555('0x12'),_0x10ffba,_0x37167c[_0xc555('0x15')][_0xc555('0x16')]);return _0x5b2ca6(_0x37167c[_0xc555('0x15')]['message']);}else{logger[_0xc555('0x11')](_0xc555('0x12'),_0x10ffba,_0xc555('0x13'));_0x5b2ca6(_0x37167c['result']['message']);}})[_0xc555('0x17')](function(_0x3375c6){logger[_0xc555('0x15')](_0xc555('0x12'),_0x10ffba,_0x3375c6);_0xcdad29(_0x3375c6);});});} \ No newline at end of file +var _0xd29d=['error','code','message','info','catch','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','request','then','Dashboard,\x20%s,\x20%s','debug','Dashboard,\x20%s,\x20%s,\x20%s'];(function(_0x4254a2,_0x263c50){var _0x36f1d8=function(_0xc93da6){while(--_0xc93da6){_0x4254a2['push'](_0x4254a2['shift']());}};_0x36f1d8(++_0x263c50);}(_0xd29d,0xa1));var _0xdd29=function(_0x565da4,_0x54150b){_0x565da4=_0x565da4-0x0;var _0x558e63=_0xd29d[_0x565da4];return _0x558e63;};'use strict';var _=require(_0xdd29('0x0'));var util=require('util');var moment=require(_0xdd29('0x1'));var BPromise=require(_0xdd29('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdd29('0x3'))['db'];var utils=require(_0xdd29('0x4'));var logger=require(_0xdd29('0x5'))(_0xdd29('0x6'));var config=require(_0xdd29('0x7'));var jayson=require(_0xdd29('0x8'));var client=jayson[_0xdd29('0x9')]['http']({'port':0x232a});config[_0xdd29('0xa')]=_[_0xdd29('0xb')](config[_0xdd29('0xa')],{'host':_0xdd29('0xc'),'port':0x18eb});var socket=require(_0xdd29('0xd'))(new Redis(config[_0xdd29('0xa')]));require(_0xdd29('0xe'))[_0xdd29('0xf')](socket);function respondWithRpcPromise(_0x25b57c,_0x19905b,_0x216c5c){return new BPromise(function(_0x4c595d,_0x365329){return client[_0xdd29('0x10')](_0x25b57c,_0x216c5c)[_0xdd29('0x11')](function(_0x401a17){logger['info'](_0xdd29('0x12'),_0x19905b,'request\x20sent');logger[_0xdd29('0x13')](_0xdd29('0x14'),_0x19905b,'request\x20sent',JSON['stringify'](_0x401a17));if(_0x401a17[_0xdd29('0x15')]){if(_0x401a17['error'][_0xdd29('0x16')]===0x1f4){logger[_0xdd29('0x15')](_0xdd29('0x12'),_0x19905b,_0x401a17[_0xdd29('0x15')][_0xdd29('0x17')]);return _0x365329(_0x401a17[_0xdd29('0x15')][_0xdd29('0x17')]);}logger['error'](_0xdd29('0x12'),_0x19905b,_0x401a17[_0xdd29('0x15')]['message']);return _0x4c595d(_0x401a17[_0xdd29('0x15')][_0xdd29('0x17')]);}else{logger[_0xdd29('0x18')](_0xdd29('0x12'),_0x19905b,'request\x20sent');_0x4c595d(_0x401a17['result'][_0xdd29('0x17')]);}})[_0xdd29('0x19')](function(_0x5e3c4c){logger[_0xdd29('0x15')](_0xdd29('0x12'),_0x19905b,_0x5e3c4c);_0x365329(_0x5e3c4c);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index e5830ec..b3518e5 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 _0xda3c=['dashboard:','./dashboard.events','save','remove','update','emit','removeListener','length'];(function(_0x39a879,_0x5df6d3){var _0x32c158=function(_0x305b71){while(--_0x305b71){_0x39a879['push'](_0x39a879['shift']());}};_0x32c158(++_0x5df6d3);}(_0xda3c,0xe1));var _0xcda3=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xda3c[_0x57b54c];return _0x59cc19;};'use strict';var DashboardEvents=require(_0xcda3('0x0'));var events=[_0xcda3('0x1'),_0xcda3('0x2'),_0xcda3('0x3')];function createListener(_0x2c39a2,_0x2e8c81){return function(_0x36e9a8){_0x2e8c81[_0xcda3('0x4')](_0x2c39a2,_0x36e9a8);};}function removeListener(_0x15eea1,_0x745413){return function(){DashboardEvents[_0xcda3('0x5')](_0x15eea1,_0x745413);};}exports['register']=function(_0x21756b){for(var _0x188821=0x0,_0x5df442=events[_0xcda3('0x6')];_0x188821<_0x5df442;_0x188821++){var _0x3598b9=events[_0x188821];var _0x1f5a1f=createListener(_0xcda3('0x7')+_0x3598b9,_0x21756b);DashboardEvents['on'](_0x3598b9,_0x1f5a1f);}}; \ No newline at end of file +var _0xb634=['./dashboard.events','save','remove','update','removeListener','length','dashboard:'];(function(_0x206fd7,_0x57a336){var _0x1ae6ad=function(_0x110b71){while(--_0x110b71){_0x206fd7['push'](_0x206fd7['shift']());}};_0x1ae6ad(++_0x57a336);}(_0xb634,0x181));var _0x4b63=function(_0xdc1218,_0x4b3819){_0xdc1218=_0xdc1218-0x0;var _0x42acf8=_0xb634[_0xdc1218];return _0x42acf8;};'use strict';var DashboardEvents=require(_0x4b63('0x0'));var events=[_0x4b63('0x1'),_0x4b63('0x2'),_0x4b63('0x3')];function createListener(_0x3ca933,_0x21e1c7){return function(_0x54fc1c){_0x21e1c7['emit'](_0x3ca933,_0x54fc1c);};}function removeListener(_0x51f1cb,_0xe68d4a){return function(){DashboardEvents[_0x4b63('0x4')](_0x51f1cb,_0xe68d4a);};}exports['register']=function(_0xa38f5b){for(var _0x3213b4=0x0,_0x18f8a9=events[_0x4b63('0x5')];_0x3213b4<_0x18f8a9;_0x3213b4++){var _0x3c5649=events[_0x3213b4];var _0x213440=createListener(_0x4b63('0x6')+_0x3c5649,_0xa38f5b);DashboardEvents['on'](_0x3c5649,_0x213440);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 2fe2e6e..034b795 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 _0xa94d=['create','post','clone','addItem','put','/:id','update','destroy','util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./dashboard.controller','get','isAuthenticated','index','show','/:id/items'];(function(_0x62bbab,_0x166c3f){var _0x86bfc0=function(_0x183817){while(--_0x183817){_0x62bbab['push'](_0x62bbab['shift']());}};_0x86bfc0(++_0x166c3f);}(_0xa94d,0xa8));var _0xda94=function(_0x292b2c,_0x20d015){_0x292b2c=_0x292b2c-0x0;var _0x1abc31=_0xa94d[_0x292b2c];return _0x1abc31;};'use strict';var multer=require('multer');var util=require(_0xda94('0x0'));var path=require(_0xda94('0x1'));var timeout=require(_0xda94('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xda94('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xda94('0x4'));var config=require(_0xda94('0x5'));var controller=require(_0xda94('0x6'));router[_0xda94('0x7')]('/',auth[_0xda94('0x8')](),controller[_0xda94('0x9')]);router[_0xda94('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xda94('0xa')]);router['get'](_0xda94('0xb'),auth[_0xda94('0x8')](),controller['getItems']);router['post']('/',auth[_0xda94('0x8')](),controller[_0xda94('0xc')]);router[_0xda94('0xd')]('/:id/clone',auth[_0xda94('0x8')](),controller[_0xda94('0xe')]);router[_0xda94('0xd')]('/:id/items',auth[_0xda94('0x8')](),controller[_0xda94('0xf')]);router[_0xda94('0x10')](_0xda94('0x11'),auth[_0xda94('0x8')](),controller[_0xda94('0x12')]);router['delete'](_0xda94('0x11'),auth[_0xda94('0x8')](),controller[_0xda94('0x13')]);module['exports']=router; \ No newline at end of file +var _0x3a69=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','get','isAuthenticated','index','/:id','show','/:id/items','create','/:id/clone','post','addItem','put','update','delete','exports','multer'];(function(_0xec612b,_0x2ee4eb){var _0x59e2a7=function(_0x59abba){while(--_0x59abba){_0xec612b['push'](_0xec612b['shift']());}};_0x59e2a7(++_0x2ee4eb);}(_0x3a69,0xa0));var _0x93a6=function(_0x134b6e,_0x21b5ca){_0x134b6e=_0x134b6e-0x0;var _0x2229a9=_0x3a69[_0x134b6e];return _0x2229a9;};'use strict';var multer=require(_0x93a6('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x93a6('0x1'));var express=require(_0x93a6('0x2'));var router=express[_0x93a6('0x3')]();var fs_extra=require(_0x93a6('0x4'));var auth=require(_0x93a6('0x5'));var interaction=require(_0x93a6('0x6'));var config=require(_0x93a6('0x7'));var controller=require(_0x93a6('0x8'));router[_0x93a6('0x9')]('/',auth[_0x93a6('0xa')](),controller[_0x93a6('0xb')]);router[_0x93a6('0x9')](_0x93a6('0xc'),auth[_0x93a6('0xa')](),controller[_0x93a6('0xd')]);router[_0x93a6('0x9')](_0x93a6('0xe'),auth[_0x93a6('0xa')](),controller['getItems']);router['post']('/',auth[_0x93a6('0xa')](),controller[_0x93a6('0xf')]);router['post'](_0x93a6('0x10'),auth[_0x93a6('0xa')](),controller['clone']);router[_0x93a6('0x11')](_0x93a6('0xe'),auth['isAuthenticated'](),controller[_0x93a6('0x12')]);router[_0x93a6('0x13')](_0x93a6('0xc'),auth[_0x93a6('0xa')](),controller[_0x93a6('0x14')]);router[_0x93a6('0x15')](_0x93a6('0xc'),auth[_0x93a6('0xa')](),controller['destroy']);module[_0x93a6('0x16')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index afd48ba..5ed8df4 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 _0x5d17=['#ffffff','sequelize','squel','STRING','TEXT','parse','getDataValue','attrs','setDataValue','stringify','INTEGER'];(function(_0x2e41e2,_0x4e7250){var _0x2844d6=function(_0x28ce24){while(--_0x28ce24){_0x2e41e2['push'](_0x2e41e2['shift']());}};_0x2844d6(++_0x4e7250);}(_0x5d17,0x114));var _0x75d1=function(_0x18fb16,_0x45edbc){_0x18fb16=_0x18fb16-0x0;var _0x147b0d=_0x5d17[_0x18fb16];return _0x147b0d;};'use strict';var Sequelize=require(_0x75d1('0x0'));var squel=require(_0x75d1('0x1'));var _=require('lodash');module['exports']={'title':{'type':Sequelize[_0x75d1('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x75d1('0x2')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x75d1('0x3')]('long'),'get':function(){try{return JSON[_0x75d1('0x4')](this[_0x75d1('0x5')](_0x75d1('0x6')));}catch(_0x32bd45){return[];}},'set':function(_0x56ac0a){try{this[_0x75d1('0x7')](_0x75d1('0x6'),JSON[_0x75d1('0x8')](_0x56ac0a));}catch(_0x1ee61b){this[_0x75d1('0x7')](_0x75d1('0x6'),JSON[_0x75d1('0x8')]([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x75d1('0x9')]},'col':{'type':Sequelize['INTEGER']},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x75d1('0xa'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x75d1('0x2')],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x75d1('0x2')]},'titleFontSize':{'type':Sequelize[_0x75d1('0x9')],'defaultValue':0xc}}; \ No newline at end of file +var _0x71ab=['setDataValue','stringify','INTEGER','#2196f3','squel','exports','STRING','TEXT','long','parse','getDataValue','attrs'];(function(_0x5a9c0c,_0x4ec485){var _0x53c77d=function(_0x1cf384){while(--_0x1cf384){_0x5a9c0c['push'](_0x5a9c0c['shift']());}};_0x53c77d(++_0x4ec485);}(_0x71ab,0x64));var _0xb71a=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x71ab[_0x2b4411];return _0x8e41ef;};'use strict';var Sequelize=require('sequelize');var squel=require(_0xb71a('0x0'));var _=require('lodash');module[_0xb71a('0x1')]={'title':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb71a('0x2')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0xb71a('0x3')](_0xb71a('0x4')),'get':function(){try{return JSON[_0xb71a('0x5')](this[_0xb71a('0x6')](_0xb71a('0x7')));}catch(_0x2192e8){return[];}},'set':function(_0x38d931){try{this[_0xb71a('0x8')](_0xb71a('0x7'),JSON[_0xb71a('0x9')](_0x38d931));}catch(_0x2a4c86){this[_0xb71a('0x8')](_0xb71a('0x7'),JSON[_0xb71a('0x9')]([]));}}},'sizeX':{'type':Sequelize[_0xb71a('0xa')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xb71a('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xb71a('0xa')]},'col':{'type':Sequelize['INTEGER']},'background':{'type':Sequelize[_0xb71a('0x2')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0xb71a('0x2')],'allowNull':![],'defaultValue':_0xb71a('0xb'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xb71a('0x2')]},'titleFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index 39cee0c..6ed7d42 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 _0xc0f9=['moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','end','status','offset','undefined','count','limit','Content-Range','json','apply','save','update','then','destroy','error','stack','name','params','keys','rawAttributes','query','filters','model','attributes','intersection','fields','length','options','DashboardItem','catch','type','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrChannel','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x22b142,_0x3b0dbe){var _0x299cb5=function(_0x1c5943){while(--_0x1c5943){_0x22b142['push'](_0x22b142['shift']());}};_0x299cb5(++_0x3b0dbe);}(_0xc0f9,0xc5));var _0x9c0f=function(_0x5093e9,_0x5154d0){_0x5093e9=_0x5093e9-0x0;var _0x4c9a22=_0xc0f9[_0x5093e9];return _0x4c9a22;};'use strict';var emlformat=require(_0x9c0f('0x0'));var rimraf=require(_0x9c0f('0x1'));var zipdir=require(_0x9c0f('0x2'));var jsonpatch=require(_0x9c0f('0x3'));var rp=require(_0x9c0f('0x4'));var moment=require(_0x9c0f('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x9c0f('0x6'));var util=require(_0x9c0f('0x7'));var path=require(_0x9c0f('0x8'));var sox=require('sox');var csv=require(_0x9c0f('0x9'));var ejs=require(_0x9c0f('0xa'));var fs=require('fs');var fs_extra=require(_0x9c0f('0xb'));var _=require(_0x9c0f('0xc'));var squel=require('squel');var crypto=require(_0x9c0f('0xd'));var jsforce=require(_0x9c0f('0xe'));var deskjs=require(_0x9c0f('0xf'));var toCsv=require(_0x9c0f('0x9'));var querystring=require('querystring');var Papa=require(_0x9c0f('0x10'));var Redis=require(_0x9c0f('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x9c0f('0x12'));var as=require(_0x9c0f('0x13'));var hardwareService=require(_0x9c0f('0x14'));var logger=require(_0x9c0f('0x15'))(_0x9c0f('0x16'));var utils=require(_0x9c0f('0x17'));var config=require(_0x9c0f('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x9c0f('0x19'))['db'];config[_0x9c0f('0x1a')]=_[_0x9c0f('0x1b')](config[_0x9c0f('0x1a')],{'host':_0x9c0f('0x1c'),'port':0x18eb});var socket=require(_0x9c0f('0x1d'))(new Redis(config[_0x9c0f('0x1a')]));require(_0x9c0f('0x1e'))[_0x9c0f('0x1f')](socket);function respondWithStatusCode(_0x1201db,_0x38749d){_0x38749d=_0x38749d||0xcc;return function(_0x5cb198){if(_0x5cb198){return _0x1201db[_0x9c0f('0x20')](_0x38749d);}return _0x1201db['status'](_0x38749d)[_0x9c0f('0x21')]();};}function respondWithResult(_0x4d2611,_0x455a04){_0x455a04=_0x455a04||0xc8;return function(_0x307696){if(_0x307696){return _0x4d2611[_0x9c0f('0x22')](_0x455a04)['json'](_0x307696);}};}function respondWithFilteredResult(_0x58a631,_0x2274f9){return function(_0x339c47){if(_0x339c47){var _0x32d253=typeof _0x2274f9[_0x9c0f('0x23')]===_0x9c0f('0x24')&&typeof _0x2274f9['limit']===_0x9c0f('0x24');var _0x2aa887=_0x339c47[_0x9c0f('0x25')];var _0x1f3016=_0x32d253?0x0:_0x2274f9['offset'];var _0x33dff7=_0x32d253?_0x339c47[_0x9c0f('0x25')]:_0x2274f9[_0x9c0f('0x23')]+_0x2274f9[_0x9c0f('0x26')];var _0x2485dc;if(_0x33dff7>=_0x2aa887){_0x33dff7=_0x2aa887;_0x2485dc=0xc8;}else{_0x2485dc=0xce;}_0x58a631['status'](_0x2485dc);return _0x58a631['set'](_0x9c0f('0x27'),_0x1f3016+'-'+_0x33dff7+'/'+_0x2aa887)[_0x9c0f('0x28')](_0x339c47);}return null;};}function patchUpdates(_0x3b16dc){return function(_0x2f1bd6){try{jsonpatch[_0x9c0f('0x29')](_0x2f1bd6,_0x3b16dc,!![]);}catch(_0x4f5f61){return BPromise['reject'](_0x4f5f61);}return _0x2f1bd6[_0x9c0f('0x2a')]();};}function saveUpdates(_0x463ea6,_0x5c4df9){return function(_0x3c8efd){if(_0x3c8efd){return _0x3c8efd[_0x9c0f('0x2b')](_0x463ea6)[_0x9c0f('0x2c')](function(_0x1af538){return _0x1af538;});}return null;};}function removeEntity(_0x56e12e,_0x540842){return function(_0x2145e2){if(_0x2145e2){return _0x2145e2[_0x9c0f('0x2d')]()[_0x9c0f('0x2c')](function(){_0x56e12e[_0x9c0f('0x22')](0xcc)[_0x9c0f('0x21')]();});}};}function handleEntityNotFound(_0x46e1c6,_0x192799){return function(_0x257fca){if(!_0x257fca){_0x46e1c6[_0x9c0f('0x20')](0x194);}return _0x257fca;};}function handleError(_0x56a3b7,_0x3adc6b){_0x3adc6b=_0x3adc6b||0x1f4;return function(_0x497f24){logger[_0x9c0f('0x2e')](_0x497f24[_0x9c0f('0x2f')]);if(_0x497f24[_0x9c0f('0x30')]){delete _0x497f24[_0x9c0f('0x30')];}_0x56a3b7['status'](_0x3adc6b)['send'](_0x497f24);};}exports['show']=function(_0x5d6f25,_0x222d97){var _0x18b564={'raw':![],'where':{'id':_0x5d6f25[_0x9c0f('0x31')]['id']}},_0x37f059={};_0x37f059['model']=_[_0x9c0f('0x32')](db['DashboardItem'][_0x9c0f('0x33')]);_0x37f059[_0x9c0f('0x34')]=_['keys'](_0x5d6f25[_0x9c0f('0x34')]);_0x37f059[_0x9c0f('0x35')]=_['intersection'](_0x37f059[_0x9c0f('0x36')],_0x37f059[_0x9c0f('0x34')]);_0x18b564[_0x9c0f('0x37')]=_[_0x9c0f('0x38')](_0x37f059[_0x9c0f('0x36')],qs[_0x9c0f('0x39')](_0x5d6f25['query'][_0x9c0f('0x39')]));_0x18b564['attributes']=_0x18b564[_0x9c0f('0x37')][_0x9c0f('0x3a')]?_0x18b564[_0x9c0f('0x37')]:_0x37f059[_0x9c0f('0x36')];if(_0x5d6f25['query']['includeAll']){_0x18b564['include']=[{'all':!![]}];}_0x18b564=_['merge']({},_0x18b564,_0x5d6f25[_0x9c0f('0x3b')]);return db[_0x9c0f('0x3c')]['find'](_0x18b564)[_0x9c0f('0x2c')](handleEntityNotFound(_0x222d97,null))[_0x9c0f('0x2c')](respondWithResult(_0x222d97,null))[_0x9c0f('0x3d')](handleError(_0x222d97,null));};exports[_0x9c0f('0x2d')]=function(_0x75caac,_0x552b81){return db[_0x9c0f('0x3c')]['find']({'where':{'id':_0x75caac[_0x9c0f('0x31')]['id']}})[_0x9c0f('0x2c')](handleEntityNotFound(_0x552b81,null))[_0x9c0f('0x2c')](removeEntity(_0x552b81,null))[_0x9c0f('0x3d')](handleError(_0x552b81,null));};function widgetAttributes(_0x2d7aa0){try{switch(_0x2d7aa0[_0x9c0f('0x3e')]){case'iframe':return[{'name':_0x9c0f('0x3f'),'value':_0x2d7aa0['attrUrl']||(_0x2d7aa0[_0x9c0f('0x40')]&&_0x2d7aa0['attrs'][0x0]?_0x2d7aa0[_0x9c0f('0x40')][0x0][_0x9c0f('0x41')]:undefined)||_0x9c0f('0x42')}];case _0x9c0f('0x43'):return[{'name':'attrPath','value':_0x2d7aa0[_0x9c0f('0x44')]||(_0x2d7aa0[_0x9c0f('0x40')]&&_0x2d7aa0[_0x9c0f('0x40')][0x0]?_0x2d7aa0['attrs'][0x0]['value']:undefined)||''}];case _0x9c0f('0x45'):return[{'name':'attrHourFormat','value':_0x2d7aa0[_0x9c0f('0x46')]||(_0x2d7aa0[_0x9c0f('0x40')]&&_0x2d7aa0['attrs'][0x0]?_0x2d7aa0[_0x9c0f('0x40')][0x0][_0x9c0f('0x41')]:undefined)||_0x9c0f('0x47')},{'name':_0x9c0f('0x48'),'value':_0x2d7aa0[_0x9c0f('0x48')]||(_0x2d7aa0['attrs']&&_0x2d7aa0[_0x9c0f('0x40')][0x1]?_0x2d7aa0[_0x9c0f('0x40')][0x1][_0x9c0f('0x41')]:undefined)||_0x9c0f('0x49')},{'name':_0x9c0f('0x4a'),'value':_0x2d7aa0[_0x9c0f('0x4a')]||(_0x2d7aa0['attrs']&&_0x2d7aa0[_0x9c0f('0x40')][0x2]?_0x2d7aa0['attrs'][0x2][_0x9c0f('0x41')]:undefined)||0xc}];case _0x9c0f('0x4b'):return[{'name':_0x9c0f('0x4c'),'value':_0x2d7aa0['attrMetric']||(_0x2d7aa0['attrs']&&_0x2d7aa0[_0x9c0f('0x40')][0x0]?_0x2d7aa0[_0x9c0f('0x40')][0x0]['value']:undefined)||_0x9c0f('0x4d')},{'name':'attrVoiceQueues','value':_0x2d7aa0[_0x9c0f('0x4e')]||(_0x2d7aa0[_0x9c0f('0x40')]&&_0x2d7aa0[_0x9c0f('0x40')][0x1]?_0x2d7aa0[_0x9c0f('0x40')][0x1][_0x9c0f('0x41')]:undefined)||[]},{'name':'attrFontSize','value':_0x2d7aa0[_0x9c0f('0x4a')]||(_0x2d7aa0[_0x9c0f('0x40')]&&_0x2d7aa0[_0x9c0f('0x40')][0x2]?_0x2d7aa0[_0x9c0f('0x40')][0x2][_0x9c0f('0x41')]:undefined)||0x14},{'name':'attrChannel','value':_0x2d7aa0['attrChannel']||(_0x2d7aa0[_0x9c0f('0x40')]&&_0x2d7aa0[_0x9c0f('0x40')][0x3]?_0x2d7aa0[_0x9c0f('0x40')][0x3][_0x9c0f('0x41')]:undefined)||_0x9c0f('0x4f')},{'name':_0x9c0f('0x50'),'value':_0x2d7aa0[_0x9c0f('0x50')]||(_0x2d7aa0[_0x9c0f('0x40')]&&_0x2d7aa0[_0x9c0f('0x40')][0x4]?_0x2d7aa0[_0x9c0f('0x40')][0x4]['value']:undefined)||''},{'name':_0x9c0f('0x51'),'value':_0x2d7aa0[_0x9c0f('0x51')]||(_0x2d7aa0[_0x9c0f('0x40')]&&_0x2d7aa0[_0x9c0f('0x40')][0x5]?_0x2d7aa0[_0x9c0f('0x40')][0x5][_0x9c0f('0x41')]:undefined)||''},{'name':_0x9c0f('0x52'),'value':_0x2d7aa0['attrSmsAccounts']||(_0x2d7aa0[_0x9c0f('0x40')]&&_0x2d7aa0[_0x9c0f('0x40')][0x6]?_0x2d7aa0[_0x9c0f('0x40')][0x6][_0x9c0f('0x41')]:undefined)||''},{'name':_0x9c0f('0x53'),'value':_0x2d7aa0[_0x9c0f('0x53')]||(_0x2d7aa0[_0x9c0f('0x40')]&&_0x2d7aa0[_0x9c0f('0x40')][0x7]?_0x2d7aa0[_0x9c0f('0x40')][0x7][_0x9c0f('0x41')]:undefined)||''},{'name':_0x9c0f('0x54'),'value':_0x2d7aa0[_0x9c0f('0x54')]||(_0x2d7aa0[_0x9c0f('0x40')]&&_0x2d7aa0[_0x9c0f('0x40')][0x8]?_0x2d7aa0[_0x9c0f('0x40')][0x8][_0x9c0f('0x41')]:undefined)||''},{'name':'attrChatWebsites','value':_0x2d7aa0[_0x9c0f('0x55')]||(_0x2d7aa0[_0x9c0f('0x40')]&&_0x2d7aa0[_0x9c0f('0x40')][0x9]?_0x2d7aa0['attrs'][0x9][_0x9c0f('0x41')]:undefined)||''}];case _0x9c0f('0x56'):case _0x9c0f('0x57'):return[{'name':_0x9c0f('0x58'),'value':_0x2d7aa0[_0x9c0f('0x58')]||(_0x2d7aa0[_0x9c0f('0x40')]&&_0x2d7aa0[_0x9c0f('0x40')][0x0]?_0x2d7aa0[_0x9c0f('0x40')][0x0][_0x9c0f('0x41')]:undefined)||_0x9c0f('0x4d')},{'name':_0x9c0f('0x59'),'value':_0x2d7aa0[_0x9c0f('0x59')]||(_0x2d7aa0['attrs']&&_0x2d7aa0[_0x9c0f('0x40')][0x1]?_0x2d7aa0[_0x9c0f('0x40')][0x1]['value']:undefined)||null},{'name':'attrSerie3','value':_0x2d7aa0[_0x9c0f('0x5a')]||(_0x2d7aa0[_0x9c0f('0x40')]&&_0x2d7aa0['attrs'][0x2]?_0x2d7aa0[_0x9c0f('0x40')][0x2][_0x9c0f('0x41')]:undefined)||null},{'name':_0x9c0f('0x4e'),'value':_0x2d7aa0['attrVoiceQueues']||(_0x2d7aa0['attrs']&&_0x2d7aa0[_0x9c0f('0x40')][0x3]?_0x2d7aa0[_0x9c0f('0x40')][0x3][_0x9c0f('0x41')]:undefined)||[]},{'name':_0x9c0f('0x5b'),'value':_0x2d7aa0[_0x9c0f('0x5b')]||(_0x2d7aa0[_0x9c0f('0x40')]&&_0x2d7aa0[_0x9c0f('0x40')][0x4]?_0x2d7aa0['attrs'][0x4][_0x9c0f('0x41')]:undefined)||_0x9c0f('0x4f')},{'name':_0x9c0f('0x50'),'value':_0x2d7aa0[_0x9c0f('0x50')]||(_0x2d7aa0[_0x9c0f('0x40')]&&_0x2d7aa0[_0x9c0f('0x40')][0x5]?_0x2d7aa0[_0x9c0f('0x40')][0x5][_0x9c0f('0x41')]:undefined)||''},{'name':_0x9c0f('0x51'),'value':_0x2d7aa0[_0x9c0f('0x51')]||(_0x2d7aa0[_0x9c0f('0x40')]&&_0x2d7aa0[_0x9c0f('0x40')][0x6]?_0x2d7aa0[_0x9c0f('0x40')][0x6][_0x9c0f('0x41')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x2d7aa0[_0x9c0f('0x52')]||(_0x2d7aa0[_0x9c0f('0x40')]&&_0x2d7aa0['attrs'][0x7]?_0x2d7aa0[_0x9c0f('0x40')][0x7][_0x9c0f('0x41')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x2d7aa0[_0x9c0f('0x53')]||(_0x2d7aa0[_0x9c0f('0x40')]&&_0x2d7aa0[_0x9c0f('0x40')][0x8]?_0x2d7aa0['attrs'][0x8][_0x9c0f('0x41')]:undefined)||''},{'name':_0x9c0f('0x54'),'value':_0x2d7aa0[_0x9c0f('0x54')]||(_0x2d7aa0['attrs']&&_0x2d7aa0['attrs'][0x9]?_0x2d7aa0[_0x9c0f('0x40')][0x9][_0x9c0f('0x41')]:undefined)||''},{'name':_0x9c0f('0x55'),'value':_0x2d7aa0[_0x9c0f('0x55')]||(_0x2d7aa0[_0x9c0f('0x40')]&&_0x2d7aa0[_0x9c0f('0x40')][0xa]?_0x2d7aa0[_0x9c0f('0x40')][0xa][_0x9c0f('0x41')]:undefined)||''}];case _0x9c0f('0x5c'):return[{'name':_0x9c0f('0x5d'),'type':_0x2d7aa0[_0x9c0f('0x5e')]||(_0x2d7aa0[_0x9c0f('0x40')]&&_0x2d7aa0[_0x9c0f('0x40')][0x0]?_0x2d7aa0['attrs'][0x0][_0x9c0f('0x3e')]:undefined)||null,'value':_0x2d7aa0[_0x9c0f('0x5d')]||(_0x2d7aa0['attrs']&&_0x2d7aa0[_0x9c0f('0x40')][0x0]?_0x2d7aa0['attrs'][0x0][_0x9c0f('0x41')]:undefined)||null},{'name':_0x9c0f('0x5f'),'value':_0x2d7aa0[_0x9c0f('0x5f')]||(_0x2d7aa0['attrs']&&_0x2d7aa0[_0x9c0f('0x40')][0x1]?_0x2d7aa0[_0x9c0f('0x40')][0x1][_0x9c0f('0x41')]:undefined)||0x0}];default:return[];}}catch(_0x5df9a6){logger['error'](_0x9c0f('0x60'),JSON[_0x9c0f('0x61')](_0x5df9a6));return[];}}exports[_0x9c0f('0x62')]=function(_0x40890b,_0x53abc8){if(_0x40890b[_0x9c0f('0x63')]){_0x40890b[_0x9c0f('0x63')][_0x9c0f('0x40')]=widgetAttributes(_0x40890b[_0x9c0f('0x63')]);}return db[_0x9c0f('0x3c')][_0x9c0f('0x62')](_0x40890b['body'],{})[_0x9c0f('0x2c')](respondWithResult(_0x53abc8,0xc9))[_0x9c0f('0x3d')](handleError(_0x53abc8,null));};exports[_0x9c0f('0x2b')]=function(_0x14e1be,_0xc0b6b5){if(_0x14e1be[_0x9c0f('0x63')]['id']){delete _0x14e1be[_0x9c0f('0x63')]['id'];}_0x14e1be[_0x9c0f('0x63')][_0x9c0f('0x40')]=widgetAttributes(_0x14e1be[_0x9c0f('0x63')]);return db['DashboardItem'][_0x9c0f('0x64')]({'where':{'id':_0x14e1be[_0x9c0f('0x31')]['id']}})[_0x9c0f('0x2c')](handleEntityNotFound(_0xc0b6b5,null))[_0x9c0f('0x2c')](saveUpdates(_0x14e1be[_0x9c0f('0x63')],null))[_0x9c0f('0x2c')](respondWithResult(_0xc0b6b5,null))[_0x9c0f('0x3d')](handleError(_0xc0b6b5,null));}; \ No newline at end of file +var _0xdbcd=['../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','end','undefined','count','offset','status','Content-Range','json','reject','save','destroy','then','sendStatus','stack','name','show','params','model','keys','DashboardItem','rawAttributes','filters','intersection','query','attributes','fields','includeAll','merge','catch','type','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrChannel','attrChatWebsites','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','update','find','eml-format','rimraf','request-promise','moment','bluebird','util','path','fs-extra','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdbcd,0x1ba));var _0xddbc=function(_0x1e9816,_0x11bef5){_0x1e9816=_0x1e9816-0x0;var _0x41e572=_0xdbcd[_0x1e9816];return _0x41e572;};'use strict';var emlformat=require(_0xddbc('0x0'));var rimraf=require(_0xddbc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xddbc('0x2'));var moment=require(_0xddbc('0x3'));var BPromise=require(_0xddbc('0x4'));var Mustache=require('mustache');var util=require(_0xddbc('0x5'));var path=require(_0xddbc('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xddbc('0x7'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xddbc('0x8'));var toCsv=require(_0xddbc('0x9'));var querystring=require(_0xddbc('0xa'));var Papa=require(_0xddbc('0xb'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xddbc('0xc'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xddbc('0xd'));var logger=require('../../config/logger')(_0xddbc('0xe'));var utils=require(_0xddbc('0xf'));var config=require(_0xddbc('0x10'));var licenseUtil=require(_0xddbc('0x11'));var db=require(_0xddbc('0x12'))['db'];config[_0xddbc('0x13')]=_[_0xddbc('0x14')](config[_0xddbc('0x13')],{'host':_0xddbc('0x15'),'port':0x18eb});var socket=require(_0xddbc('0x16'))(new Redis(config[_0xddbc('0x13')]));require(_0xddbc('0x17'))['register'](socket);function respondWithStatusCode(_0x57c81f,_0x45d556){_0x45d556=_0x45d556||0xcc;return function(_0x4453bf){if(_0x4453bf){return _0x57c81f['sendStatus'](_0x45d556);}return _0x57c81f['status'](_0x45d556)[_0xddbc('0x18')]();};}function respondWithResult(_0x2d4a9b,_0x2d366d){_0x2d366d=_0x2d366d||0xc8;return function(_0x19f977){if(_0x19f977){return _0x2d4a9b['status'](_0x2d366d)['json'](_0x19f977);}};}function respondWithFilteredResult(_0x356afe,_0x193c84){return function(_0x5d0a34){if(_0x5d0a34){var _0x48efdb=typeof _0x193c84['offset']===_0xddbc('0x19')&&typeof _0x193c84['limit']===_0xddbc('0x19');var _0xedd271=_0x5d0a34[_0xddbc('0x1a')];var _0x118569=_0x48efdb?0x0:_0x193c84[_0xddbc('0x1b')];var _0x114fc7=_0x48efdb?_0x5d0a34['count']:_0x193c84[_0xddbc('0x1b')]+_0x193c84['limit'];var _0x52426a;if(_0x114fc7>=_0xedd271){_0x114fc7=_0xedd271;_0x52426a=0xc8;}else{_0x52426a=0xce;}_0x356afe[_0xddbc('0x1c')](_0x52426a);return _0x356afe['set'](_0xddbc('0x1d'),_0x118569+'-'+_0x114fc7+'/'+_0xedd271)[_0xddbc('0x1e')](_0x5d0a34);}return null;};}function patchUpdates(_0x1cac88){return function(_0xa5a3a0){try{jsonpatch['apply'](_0xa5a3a0,_0x1cac88,!![]);}catch(_0x1e677a){return BPromise[_0xddbc('0x1f')](_0x1e677a);}return _0xa5a3a0[_0xddbc('0x20')]();};}function saveUpdates(_0x1d44a7,_0x328316){return function(_0x57eb60){if(_0x57eb60){return _0x57eb60['update'](_0x1d44a7)['then'](function(_0x302120){return _0x302120;});}return null;};}function removeEntity(_0x2f58cd,_0x2db65f){return function(_0x37c6f5){if(_0x37c6f5){return _0x37c6f5[_0xddbc('0x21')]()[_0xddbc('0x22')](function(){_0x2f58cd[_0xddbc('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a7e0b,_0x136f64){return function(_0x12bf5b){if(!_0x12bf5b){_0x2a7e0b[_0xddbc('0x23')](0x194);}return _0x12bf5b;};}function handleError(_0x3b1f06,_0xb4f6f5){_0xb4f6f5=_0xb4f6f5||0x1f4;return function(_0x16a720){logger['error'](_0x16a720[_0xddbc('0x24')]);if(_0x16a720[_0xddbc('0x25')]){delete _0x16a720[_0xddbc('0x25')];}_0x3b1f06[_0xddbc('0x1c')](_0xb4f6f5)['send'](_0x16a720);};}exports[_0xddbc('0x26')]=function(_0x56042c,_0x49cc11){var _0x95a9c6={'raw':![],'where':{'id':_0x56042c[_0xddbc('0x27')]['id']}},_0x4d6329={};_0x4d6329[_0xddbc('0x28')]=_[_0xddbc('0x29')](db[_0xddbc('0x2a')][_0xddbc('0x2b')]);_0x4d6329['query']=_[_0xddbc('0x29')](_0x56042c['query']);_0x4d6329[_0xddbc('0x2c')]=_[_0xddbc('0x2d')](_0x4d6329[_0xddbc('0x28')],_0x4d6329[_0xddbc('0x2e')]);_0x95a9c6[_0xddbc('0x2f')]=_[_0xddbc('0x2d')](_0x4d6329[_0xddbc('0x28')],qs[_0xddbc('0x30')](_0x56042c['query'][_0xddbc('0x30')]));_0x95a9c6[_0xddbc('0x2f')]=_0x95a9c6[_0xddbc('0x2f')]['length']?_0x95a9c6[_0xddbc('0x2f')]:_0x4d6329['model'];if(_0x56042c[_0xddbc('0x2e')][_0xddbc('0x31')]){_0x95a9c6['include']=[{'all':!![]}];}_0x95a9c6=_[_0xddbc('0x32')]({},_0x95a9c6,_0x56042c['options']);return db[_0xddbc('0x2a')]['find'](_0x95a9c6)['then'](handleEntityNotFound(_0x49cc11,null))[_0xddbc('0x22')](respondWithResult(_0x49cc11,null))['catch'](handleError(_0x49cc11,null));};exports['destroy']=function(_0x457fe8,_0x8d2fbd){return db[_0xddbc('0x2a')]['find']({'where':{'id':_0x457fe8['params']['id']}})[_0xddbc('0x22')](handleEntityNotFound(_0x8d2fbd,null))['then'](removeEntity(_0x8d2fbd,null))[_0xddbc('0x33')](handleError(_0x8d2fbd,null));};function widgetAttributes(_0x217c99){try{switch(_0x217c99[_0xddbc('0x34')]){case _0xddbc('0x35'):return[{'name':_0xddbc('0x36'),'value':_0x217c99[_0xddbc('0x36')]||(_0x217c99[_0xddbc('0x37')]&&_0x217c99[_0xddbc('0x37')][0x0]?_0x217c99[_0xddbc('0x37')][0x0][_0xddbc('0x38')]:undefined)||_0xddbc('0x39')}];case _0xddbc('0x3a'):return[{'name':_0xddbc('0x3b'),'value':_0x217c99[_0xddbc('0x3b')]||(_0x217c99['attrs']&&_0x217c99[_0xddbc('0x37')][0x0]?_0x217c99[_0xddbc('0x37')][0x0][_0xddbc('0x38')]:undefined)||''}];case _0xddbc('0x3c'):return[{'name':_0xddbc('0x3d'),'value':_0x217c99['attrHourFormat']||(_0x217c99['attrs']&&_0x217c99[_0xddbc('0x37')][0x0]?_0x217c99[_0xddbc('0x37')][0x0][_0xddbc('0x38')]:undefined)||_0xddbc('0x3e')},{'name':'attrTimezone','value':_0x217c99[_0xddbc('0x3f')]||(_0x217c99[_0xddbc('0x37')]&&_0x217c99[_0xddbc('0x37')][0x1]?_0x217c99[_0xddbc('0x37')][0x1][_0xddbc('0x38')]:undefined)||_0xddbc('0x40')},{'name':_0xddbc('0x41'),'value':_0x217c99[_0xddbc('0x41')]||(_0x217c99['attrs']&&_0x217c99[_0xddbc('0x37')][0x2]?_0x217c99[_0xddbc('0x37')][0x2]['value']:undefined)||0xc}];case'counter':return[{'name':_0xddbc('0x42'),'value':_0x217c99[_0xddbc('0x42')]||(_0x217c99[_0xddbc('0x37')]&&_0x217c99[_0xddbc('0x37')][0x0]?_0x217c99[_0xddbc('0x37')][0x0]['value']:undefined)||_0xddbc('0x43')},{'name':'attrVoiceQueues','value':_0x217c99[_0xddbc('0x44')]||(_0x217c99[_0xddbc('0x37')]&&_0x217c99['attrs'][0x1]?_0x217c99[_0xddbc('0x37')][0x1][_0xddbc('0x38')]:undefined)||[]},{'name':_0xddbc('0x41'),'value':_0x217c99['attrFontSize']||(_0x217c99['attrs']&&_0x217c99['attrs'][0x2]?_0x217c99[_0xddbc('0x37')][0x2]['value']:undefined)||0x14},{'name':'attrChannel','value':_0x217c99['attrChannel']||(_0x217c99[_0xddbc('0x37')]&&_0x217c99[_0xddbc('0x37')][0x3]?_0x217c99[_0xddbc('0x37')][0x3][_0xddbc('0x38')]:undefined)||_0xddbc('0x45')},{'name':_0xddbc('0x46'),'value':_0x217c99[_0xddbc('0x46')]||(_0x217c99[_0xddbc('0x37')]&&_0x217c99[_0xddbc('0x37')][0x4]?_0x217c99['attrs'][0x4][_0xddbc('0x38')]:undefined)||''},{'name':_0xddbc('0x47'),'value':_0x217c99[_0xddbc('0x47')]||(_0x217c99[_0xddbc('0x37')]&&_0x217c99['attrs'][0x5]?_0x217c99[_0xddbc('0x37')][0x5][_0xddbc('0x38')]:undefined)||''},{'name':_0xddbc('0x48'),'value':_0x217c99['attrSmsAccounts']||(_0x217c99[_0xddbc('0x37')]&&_0x217c99[_0xddbc('0x37')][0x6]?_0x217c99[_0xddbc('0x37')][0x6][_0xddbc('0x38')]:undefined)||''},{'name':_0xddbc('0x49'),'value':_0x217c99['attrOpenchannelAccounts']||(_0x217c99[_0xddbc('0x37')]&&_0x217c99[_0xddbc('0x37')][0x7]?_0x217c99[_0xddbc('0x37')][0x7]['value']:undefined)||''},{'name':_0xddbc('0x4a'),'value':_0x217c99[_0xddbc('0x4a')]||(_0x217c99[_0xddbc('0x37')]&&_0x217c99[_0xddbc('0x37')][0x8]?_0x217c99[_0xddbc('0x37')][0x8][_0xddbc('0x38')]:undefined)||''},{'name':'attrChatWebsites','value':_0x217c99['attrChatWebsites']||(_0x217c99[_0xddbc('0x37')]&&_0x217c99['attrs'][0x9]?_0x217c99[_0xddbc('0x37')][0x9][_0xddbc('0x38')]:undefined)||''}];case _0xddbc('0x4b'):case _0xddbc('0x4c'):return[{'name':'attrSerie1','value':_0x217c99[_0xddbc('0x4d')]||(_0x217c99[_0xddbc('0x37')]&&_0x217c99[_0xddbc('0x37')][0x0]?_0x217c99[_0xddbc('0x37')][0x0]['value']:undefined)||_0xddbc('0x43')},{'name':_0xddbc('0x4e'),'value':_0x217c99[_0xddbc('0x4e')]||(_0x217c99[_0xddbc('0x37')]&&_0x217c99[_0xddbc('0x37')][0x1]?_0x217c99[_0xddbc('0x37')][0x1][_0xddbc('0x38')]:undefined)||null},{'name':'attrSerie3','value':_0x217c99[_0xddbc('0x4f')]||(_0x217c99[_0xddbc('0x37')]&&_0x217c99[_0xddbc('0x37')][0x2]?_0x217c99[_0xddbc('0x37')][0x2]['value']:undefined)||null},{'name':_0xddbc('0x44'),'value':_0x217c99[_0xddbc('0x44')]||(_0x217c99['attrs']&&_0x217c99[_0xddbc('0x37')][0x3]?_0x217c99[_0xddbc('0x37')][0x3][_0xddbc('0x38')]:undefined)||[]},{'name':_0xddbc('0x50'),'value':_0x217c99[_0xddbc('0x50')]||(_0x217c99[_0xddbc('0x37')]&&_0x217c99['attrs'][0x4]?_0x217c99[_0xddbc('0x37')][0x4][_0xddbc('0x38')]:undefined)||'voice'},{'name':_0xddbc('0x46'),'value':_0x217c99[_0xddbc('0x46')]||(_0x217c99[_0xddbc('0x37')]&&_0x217c99[_0xddbc('0x37')][0x5]?_0x217c99[_0xddbc('0x37')][0x5]['value']:undefined)||''},{'name':_0xddbc('0x47'),'value':_0x217c99[_0xddbc('0x47')]||(_0x217c99[_0xddbc('0x37')]&&_0x217c99[_0xddbc('0x37')][0x6]?_0x217c99[_0xddbc('0x37')][0x6]['value']:undefined)||''},{'name':'attrSmsAccounts','value':_0x217c99[_0xddbc('0x48')]||(_0x217c99[_0xddbc('0x37')]&&_0x217c99[_0xddbc('0x37')][0x7]?_0x217c99[_0xddbc('0x37')][0x7]['value']:undefined)||''},{'name':_0xddbc('0x49'),'value':_0x217c99['attrOpenchannelAccounts']||(_0x217c99[_0xddbc('0x37')]&&_0x217c99['attrs'][0x8]?_0x217c99['attrs'][0x8][_0xddbc('0x38')]:undefined)||''},{'name':_0xddbc('0x4a'),'value':_0x217c99[_0xddbc('0x4a')]||(_0x217c99[_0xddbc('0x37')]&&_0x217c99[_0xddbc('0x37')][0x9]?_0x217c99[_0xddbc('0x37')][0x9]['value']:undefined)||''},{'name':_0xddbc('0x51'),'value':_0x217c99[_0xddbc('0x51')]||(_0x217c99[_0xddbc('0x37')]&&_0x217c99[_0xddbc('0x37')][0xa]?_0x217c99['attrs'][0xa]['value']:undefined)||''}];case _0xddbc('0x52'):return[{'name':_0xddbc('0x53'),'type':_0x217c99[_0xddbc('0x54')]||(_0x217c99[_0xddbc('0x37')]&&_0x217c99['attrs'][0x0]?_0x217c99[_0xddbc('0x37')][0x0][_0xddbc('0x34')]:undefined)||null,'value':_0x217c99[_0xddbc('0x53')]||(_0x217c99['attrs']&&_0x217c99[_0xddbc('0x37')][0x0]?_0x217c99[_0xddbc('0x37')][0x0]['value']:undefined)||null},{'name':_0xddbc('0x55'),'value':_0x217c99[_0xddbc('0x55')]||(_0x217c99['attrs']&&_0x217c99['attrs'][0x1]?_0x217c99['attrs'][0x1][_0xddbc('0x38')]:undefined)||0x0}];default:return[];}}catch(_0x1959e0){logger['error'](_0xddbc('0x56'),JSON[_0xddbc('0x57')](_0x1959e0));return[];}}exports[_0xddbc('0x58')]=function(_0x5e9a01,_0x2a1060){if(_0x5e9a01['body']){_0x5e9a01[_0xddbc('0x59')]['attrs']=widgetAttributes(_0x5e9a01[_0xddbc('0x59')]);}return db[_0xddbc('0x2a')][_0xddbc('0x58')](_0x5e9a01[_0xddbc('0x59')],{})['then'](respondWithResult(_0x2a1060,0xc9))[_0xddbc('0x33')](handleError(_0x2a1060,null));};exports[_0xddbc('0x5a')]=function(_0x294fda,_0xda1c23){if(_0x294fda[_0xddbc('0x59')]['id']){delete _0x294fda[_0xddbc('0x59')]['id'];}_0x294fda['body'][_0xddbc('0x37')]=widgetAttributes(_0x294fda['body']);return db['DashboardItem'][_0xddbc('0x5b')]({'where':{'id':_0x294fda[_0xddbc('0x27')]['id']}})[_0xddbc('0x22')](handleEntityNotFound(_0xda1c23,null))[_0xddbc('0x22')](saveUpdates(_0x294fda[_0xddbc('0x59')],null))[_0xddbc('0x22')](respondWithResult(_0xda1c23,null))[_0xddbc('0x33')](handleError(_0xda1c23,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 54eb67b..998e909 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 _0x3512=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','DashboardItem','setMaxListeners'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x3512,0xf9));var _0x2351=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x3512[_0x59ee6f];return _0x4c0979;};'use strict';var EventEmitter=require(_0x2351('0x0'));var DashboardItem=require(_0x2351('0x1'))['db'][_0x2351('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x2351('0x3')](0x0);var events={'afterCreate':_0x2351('0x4'),'afterUpdate':_0x2351('0x5'),'afterDestroy':_0x2351('0x6')};function emitEvent(_0x1908d5){return function(_0x3fa655,_0x250295,_0x210b74){DashboardItemEvents['emit'](_0x1908d5+':'+_0x3fa655['id'],_0x3fa655);DashboardItemEvents[_0x2351('0x7')](_0x1908d5,_0x3fa655);_0x210b74(null);};}for(var e in events){if(events[_0x2351('0x8')](e)){var event=events[e];DashboardItem[_0x2351('0x9')](e,emitEvent(event));}}module[_0x2351('0xa')]=DashboardItemEvents; \ No newline at end of file +var _0xf5af=['save','emit','hasOwnProperty','hook','exports','events','setMaxListeners'];(function(_0x3cc6d3,_0x23e575){var _0x70229d=function(_0x3a1ec1){while(--_0x3a1ec1){_0x3cc6d3['push'](_0x3cc6d3['shift']());}};_0x70229d(++_0x23e575);}(_0xf5af,0xb4));var _0xff5a=function(_0x2e8242,_0xdd7c17){_0x2e8242=_0x2e8242-0x0;var _0x910da8=_0xf5af[_0x2e8242];return _0x910da8;};'use strict';var EventEmitter=require(_0xff5a('0x0'));var DashboardItem=require('../../mysqldb')['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xff5a('0x1')](0x0);var events={'afterCreate':_0xff5a('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x1ab44c){return function(_0x2998f3,_0x1b09af,_0x588a37){DashboardItemEvents[_0xff5a('0x3')](_0x1ab44c+':'+_0x2998f3['id'],_0x2998f3);DashboardItemEvents[_0xff5a('0x3')](_0x1ab44c,_0x2998f3);_0x588a37(null);};}for(var e in events){if(events[_0xff5a('0x4')](e)){var event=events[e];DashboardItem[_0xff5a('0x5')](e,emitEvent(event));}}module[_0xff5a('0x6')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index ece4559..da1bf07 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 _0x1320=['moment','bluebird','rimraf','../../config/environment','./dashboardItem.attributes','exports','DashboardItem','dashboard_items','lodash','util','../../config/logger','api'];(function(_0x3c3698,_0xa0bf08){var _0x4e6637=function(_0x1fc9a4){while(--_0x1fc9a4){_0x3c3698['push'](_0x3c3698['shift']());}};_0x4e6637(++_0xa0bf08);}(_0x1320,0x128));var _0x0132=function(_0x4d6d9a,_0xa022de){_0x4d6d9a=_0x4d6d9a-0x0;var _0x2029f8=_0x1320[_0x4d6d9a];return _0x2029f8;};'use strict';var _=require(_0x0132('0x0'));var util=require(_0x0132('0x1'));var logger=require(_0x0132('0x2'))(_0x0132('0x3'));var moment=require(_0x0132('0x4'));var BPromise=require(_0x0132('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0132('0x6'));var config=require(_0x0132('0x7'));var attributes=require(_0x0132('0x8'));module[_0x0132('0x9')]=function(_0x1a2a51,_0x34408b){return _0x1a2a51['define'](_0x0132('0xa'),attributes,{'tableName':_0x0132('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2c2b=['dashboard_items','util','../../config/logger','api','request-promise','rimraf','exports','define','DashboardItem'];(function(_0x510cd9,_0x551300){var _0x2b1f61=function(_0x345249){while(--_0x345249){_0x510cd9['push'](_0x510cd9['shift']());}};_0x2b1f61(++_0x551300);}(_0x2c2b,0x1b1));var _0xb2c2=function(_0x5ca927,_0x38c385){_0x5ca927=_0x5ca927-0x0;var _0x1eb900=_0x2c2b[_0x5ca927];return _0x1eb900;};'use strict';var _=require('lodash');var util=require(_0xb2c2('0x0'));var logger=require(_0xb2c2('0x1'))(_0xb2c2('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb2c2('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb2c2('0x4'));var config=require('../../config/environment');var attributes=require('./dashboardItem.attributes');module[_0xb2c2('0x5')]=function(_0x103254,_0x5d42f4){return _0x103254[_0xb2c2('0x6')](_0xb2c2('0x7'),attributes,{'tableName':_0xb2c2('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.rpc.js b/server/api/dashboardItem/dashboardItem.rpc.js index 86d8a52..3af3e14 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 _0x7d3c=['stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','redis','localhost','socket.io-emitter','./dashboardItem.socket','request','then','info','DashboardItem,\x20%s,\x20%s','DashboardItem,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x3099e4,_0x5520d4){var _0x398197=function(_0x2f80b5){while(--_0x2f80b5){_0x3099e4['push'](_0x3099e4['shift']());}};_0x398197(++_0x5520d4);}(_0x7d3c,0x1c7));var _0xc7d3=function(_0xe2cbd3,_0x678694){_0xe2cbd3=_0xe2cbd3-0x0;var _0x5155e3=_0x7d3c[_0xe2cbd3];return _0x5155e3;};'use strict';var _=require(_0xc7d3('0x0'));var util=require(_0xc7d3('0x1'));var moment=require(_0xc7d3('0x2'));var BPromise=require(_0xc7d3('0x3'));var rs=require(_0xc7d3('0x4'));var fs=require('fs');var Redis=require(_0xc7d3('0x5'));var db=require(_0xc7d3('0x6'))['db'];var utils=require(_0xc7d3('0x7'));var logger=require(_0xc7d3('0x8'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc7d3('0x9')]['http']({'port':0x232a});config[_0xc7d3('0xa')]=_['defaults'](config[_0xc7d3('0xa')],{'host':_0xc7d3('0xb'),'port':0x18eb});var socket=require(_0xc7d3('0xc'))(new Redis(config['redis']));require(_0xc7d3('0xd'))['register'](socket);function respondWithRpcPromise(_0x215952,_0x2daf7f,_0x3c1d80){return new BPromise(function(_0x312e9d,_0x341aa5){return client[_0xc7d3('0xe')](_0x215952,_0x3c1d80)[_0xc7d3('0xf')](function(_0x15acf4){logger[_0xc7d3('0x10')](_0xc7d3('0x11'),_0x2daf7f,'request\x20sent');logger['debug'](_0xc7d3('0x12'),_0x2daf7f,_0xc7d3('0x13'),JSON[_0xc7d3('0x14')](_0x15acf4));if(_0x15acf4['error']){if(_0x15acf4[_0xc7d3('0x15')][_0xc7d3('0x16')]===0x1f4){logger[_0xc7d3('0x15')](_0xc7d3('0x11'),_0x2daf7f,_0x15acf4[_0xc7d3('0x15')][_0xc7d3('0x17')]);return _0x341aa5(_0x15acf4['error'][_0xc7d3('0x17')]);}logger['error'](_0xc7d3('0x11'),_0x2daf7f,_0x15acf4[_0xc7d3('0x15')][_0xc7d3('0x17')]);return _0x312e9d(_0x15acf4[_0xc7d3('0x15')][_0xc7d3('0x17')]);}else{logger[_0xc7d3('0x10')]('DashboardItem,\x20%s,\x20%s',_0x2daf7f,'request\x20sent');_0x312e9d(_0x15acf4['result'][_0xc7d3('0x17')]);}})[_0xc7d3('0x18')](function(_0x2d7041){logger['error'](_0xc7d3('0x11'),_0x2daf7f,_0x2d7041);_0x341aa5(_0x2d7041);});});} \ No newline at end of file +var _0x3f77=['then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','request'];(function(_0x271caa,_0x485e70){var _0x18a8fa=function(_0x205826){while(--_0x205826){_0x271caa['push'](_0x271caa['shift']());}};_0x18a8fa(++_0x485e70);}(_0x3f77,0x107));var _0x73f7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3f77[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x73f7('0x0'));var BPromise=require(_0x73f7('0x1'));var rs=require(_0x73f7('0x2'));var fs=require('fs');var Redis=require(_0x73f7('0x3'));var db=require(_0x73f7('0x4'))['db'];var utils=require(_0x73f7('0x5'));var logger=require(_0x73f7('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x73f7('0x7'));var client=jayson[_0x73f7('0x8')][_0x73f7('0x9')]({'port':0x232a});config[_0x73f7('0xa')]=_[_0x73f7('0xb')](config['redis'],{'host':_0x73f7('0xc'),'port':0x18eb});var socket=require(_0x73f7('0xd'))(new Redis(config[_0x73f7('0xa')]));require(_0x73f7('0xe'))[_0x73f7('0xf')](socket);function respondWithRpcPromise(_0x103e8c,_0x27ede3,_0x21b104){return new BPromise(function(_0x5106d8,_0x1c4a73){return client[_0x73f7('0x10')](_0x103e8c,_0x21b104)[_0x73f7('0x11')](function(_0x2ef891){logger[_0x73f7('0x12')](_0x73f7('0x13'),_0x27ede3,_0x73f7('0x14'));logger[_0x73f7('0x15')](_0x73f7('0x16'),_0x27ede3,'request\x20sent',JSON[_0x73f7('0x17')](_0x2ef891));if(_0x2ef891['error']){if(_0x2ef891[_0x73f7('0x18')][_0x73f7('0x19')]===0x1f4){logger[_0x73f7('0x18')](_0x73f7('0x13'),_0x27ede3,_0x2ef891[_0x73f7('0x18')][_0x73f7('0x1a')]);return _0x1c4a73(_0x2ef891[_0x73f7('0x18')][_0x73f7('0x1a')]);}logger[_0x73f7('0x18')](_0x73f7('0x13'),_0x27ede3,_0x2ef891[_0x73f7('0x18')][_0x73f7('0x1a')]);return _0x5106d8(_0x2ef891[_0x73f7('0x18')]['message']);}else{logger[_0x73f7('0x12')](_0x73f7('0x13'),_0x27ede3,_0x73f7('0x14'));_0x5106d8(_0x2ef891[_0x73f7('0x1b')][_0x73f7('0x1a')]);}})['catch'](function(_0x512cec){logger['error'](_0x73f7('0x13'),_0x27ede3,_0x512cec);_0x1c4a73(_0x512cec);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 8812b19..0b2ad8c 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 _0x2e06=['remove','update','emit','register','length','./dashboardItem.events','save'];(function(_0x23d137,_0x862a9f){var _0xf3acc1=function(_0x211173){while(--_0x211173){_0x23d137['push'](_0x23d137['shift']());}};_0xf3acc1(++_0x862a9f);}(_0x2e06,0x91));var _0x62e0=function(_0x37451c,_0x515e3e){_0x37451c=_0x37451c-0x0;var _0x485c57=_0x2e06[_0x37451c];return _0x485c57;};'use strict';var DashboardItemEvents=require(_0x62e0('0x0'));var events=[_0x62e0('0x1'),_0x62e0('0x2'),_0x62e0('0x3')];function createListener(_0x4df2ae,_0x4a581e){return function(_0x77201f){_0x4a581e[_0x62e0('0x4')](_0x4df2ae,_0x77201f);};}function removeListener(_0x478ef6,_0x8390a8){return function(){DashboardItemEvents['removeListener'](_0x478ef6,_0x8390a8);};}exports[_0x62e0('0x5')]=function(_0x466e69){for(var _0x2b5de3=0x0,_0xe74e05=events[_0x62e0('0x6')];_0x2b5de3<_0xe74e05;_0x2b5de3++){var _0x5f360d=events[_0x2b5de3];var _0x330281=createListener('dashboardItem:'+_0x5f360d,_0x466e69);DashboardItemEvents['on'](_0x5f360d,_0x330281);}}; \ No newline at end of file +var _0x8b62=['update','removeListener','register','length','dashboardItem:','save'];(function(_0x223781,_0x28224f){var _0x4e677b=function(_0x36e3c2){while(--_0x36e3c2){_0x223781['push'](_0x223781['shift']());}};_0x4e677b(++_0x28224f);}(_0x8b62,0x113));var _0x28b6=function(_0x4b4d43,_0x1590f7){_0x4b4d43=_0x4b4d43-0x0;var _0x5706ba=_0x8b62[_0x4b4d43];return _0x5706ba;};'use strict';var DashboardItemEvents=require('./dashboardItem.events');var events=[_0x28b6('0x0'),'remove',_0x28b6('0x1')];function createListener(_0x2cb108,_0x4ad530){return function(_0x44bd10){_0x4ad530['emit'](_0x2cb108,_0x44bd10);};}function removeListener(_0x6622a3,_0x837f63){return function(){DashboardItemEvents[_0x28b6('0x2')](_0x6622a3,_0x837f63);};}exports[_0x28b6('0x3')]=function(_0x28f1da){for(var _0x57da39=0x0,_0x4462d4=events[_0x28b6('0x4')];_0x57da39<_0x4462d4;_0x57da39++){var _0x4b3ee2=events[_0x57da39];var _0xad0355=createListener(_0x28b6('0x5')+_0x4b3ee2,_0x28f1da);DashboardItemEvents['on'](_0x4b3ee2,_0xad0355);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 9a96a27..35d2db3 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 _0x7d74=['/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','isAuthenticated','show','post','create','put'];(function(_0x14ce3d,_0x58dde7){var _0x61eecd=function(_0x164fde){while(--_0x164fde){_0x14ce3d['push'](_0x14ce3d['shift']());}};_0x61eecd(++_0x58dde7);}(_0x7d74,0x1e9));var _0x47d7=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x7d74[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x47d7('0x0'));var util=require(_0x47d7('0x1'));var path=require(_0x47d7('0x2'));var timeout=require(_0x47d7('0x3'));var express=require(_0x47d7('0x4'));var router=express[_0x47d7('0x5')]();var fs_extra=require(_0x47d7('0x6'));var auth=require(_0x47d7('0x7'));var interaction=require(_0x47d7('0x8'));var config=require(_0x47d7('0x9'));var controller=require(_0x47d7('0xa'));router[_0x47d7('0xb')]('/:id',auth[_0x47d7('0xc')](),controller[_0x47d7('0xd')]);router[_0x47d7('0xe')]('/',auth[_0x47d7('0xc')](),controller[_0x47d7('0xf')]);router[_0x47d7('0x10')](_0x47d7('0x11'),auth[_0x47d7('0xc')](),controller[_0x47d7('0x12')]);router[_0x47d7('0x13')](_0x47d7('0x11'),auth[_0x47d7('0xc')](),controller[_0x47d7('0x14')]);module[_0x47d7('0x15')]=router; \ No newline at end of file +var _0x7ff9=['../../components/auth/service','../../config/environment','./dashboardItem.controller','/:id','isAuthenticated','show','post','put','update','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x1d87fc,_0x1e5321){var _0x492b56=function(_0x4c6b16){while(--_0x4c6b16){_0x1d87fc['push'](_0x1d87fc['shift']());}};_0x492b56(++_0x1e5321);}(_0x7ff9,0x99));var _0x97ff=function(_0xb46203,_0x2e07d8){_0xb46203=_0xb46203-0x0;var _0x3b554a=_0x7ff9[_0xb46203];return _0x3b554a;};'use strict';var multer=require(_0x97ff('0x0'));var util=require(_0x97ff('0x1'));var path=require(_0x97ff('0x2'));var timeout=require(_0x97ff('0x3'));var express=require(_0x97ff('0x4'));var router=express[_0x97ff('0x5')]();var fs_extra=require(_0x97ff('0x6'));var auth=require(_0x97ff('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x97ff('0x8'));var controller=require(_0x97ff('0x9'));router['get'](_0x97ff('0xa'),auth[_0x97ff('0xb')](),controller[_0x97ff('0xc')]);router[_0x97ff('0xd')]('/',auth[_0x97ff('0xb')](),controller['create']);router[_0x97ff('0xe')](_0x97ff('0xa'),auth[_0x97ff('0xb')](),controller[_0x97ff('0xf')]);router['delete'](_0x97ff('0xa'),auth[_0x97ff('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index ccb4bca..585fbd9 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 _0xb053=['sequelize','exports','STRING','ENUM','first','second'];(function(_0x326a44,_0x41c393){var _0x218e10=function(_0x4ef0a6){while(--_0x4ef0a6){_0x326a44['push'](_0x326a44['shift']());}};_0x218e10(++_0x41c393);}(_0xb053,0x96));var _0x3b05=function(_0x58ef8c,_0x305ab2){_0x58ef8c=_0x58ef8c-0x0;var _0x26fca6=_0xb053[_0x58ef8c];return _0x26fca6;};'use strict';var Sequelize=require(_0x3b05('0x0'));module[_0x3b05('0x1')]={'name':{'type':Sequelize[_0x3b05('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0x3b05('0x3')](_0x3b05('0x4'),_0x3b05('0x5'),'third'),'allowNull':![],'defaultValue':_0x3b05('0x4')},'description':{'type':Sequelize[_0x3b05('0x2')]}}; \ No newline at end of file +var _0x27cb=['ENUM','first','second','third','exports','STRING'];(function(_0x52f82c,_0x201c03){var _0x329918=function(_0x29f9db){while(--_0x29f9db){_0x52f82c['push'](_0x52f82c['shift']());}};_0x329918(++_0x201c03);}(_0x27cb,0xa0));var _0xb27c=function(_0x4499cd,_0x397714){_0x4499cd=_0x4499cd-0x0;var _0x5733de=_0x27cb[_0x4499cd];return _0x5733de;};'use strict';var Sequelize=require('sequelize');module[_0xb27c('0x0')]={'name':{'type':Sequelize[_0xb27c('0x1')],'allowNull':![]},'level':{'type':Sequelize[_0xb27c('0x2')](_0xb27c('0x3'),_0xb27c('0x4'),_0xb27c('0x5')),'allowNull':![],'defaultValue':_0xb27c('0x3')},'description':{'type':Sequelize[_0xb27c('0x1')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index ad96063..fbd1366 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 _0x0e4b=['update','destroy','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','then','get','UserProfileResource','error','name','send','index','Disposition','fieldName','type','key','model','map','query','keys','attributes','hasOwnProperty','nolimit','order','sort','pick','where','VIRTUAL','filter','merge','includeAll','findAll','rows','params','rawAttributes','filters','intersection','fields','length','include','find','catch','body','user','Dispositions','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0x2d16cc,_0x46c3ac){var _0x18babf=function(_0x4c665e){while(--_0x4c665e){_0x2d16cc['push'](_0x2d16cc['shift']());}};_0x18babf(++_0x46c3ac);}(_0x0e4b,0x15a));var _0xb0e4=function(_0x17c5d6,_0x5efae6){_0x17c5d6=_0x17c5d6-0x0;var _0x4aecca=_0x0e4b[_0x17c5d6];return _0x4aecca;};'use strict';var emlformat=require(_0xb0e4('0x0'));var rimraf=require(_0xb0e4('0x1'));var zipdir=require(_0xb0e4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb0e4('0x3'));var moment=require(_0xb0e4('0x4'));var BPromise=require(_0xb0e4('0x5'));var Mustache=require(_0xb0e4('0x6'));var util=require(_0xb0e4('0x7'));var path=require(_0xb0e4('0x8'));var sox=require(_0xb0e4('0x9'));var csv=require(_0xb0e4('0xa'));var ejs=require(_0xb0e4('0xb'));var fs=require('fs');var fs_extra=require(_0xb0e4('0xc'));var _=require(_0xb0e4('0xd'));var squel=require(_0xb0e4('0xe'));var crypto=require(_0xb0e4('0xf'));var jsforce=require(_0xb0e4('0x10'));var deskjs=require(_0xb0e4('0x11'));var toCsv=require(_0xb0e4('0xa'));var querystring=require(_0xb0e4('0x12'));var Papa=require(_0xb0e4('0x13'));var Redis=require('ioredis');var authService=require(_0xb0e4('0x14'));var qs=require(_0xb0e4('0x15'));var as=require(_0xb0e4('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb0e4('0x17'))(_0xb0e4('0x18'));var utils=require(_0xb0e4('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xb0e4('0x1a'));var db=require(_0xb0e4('0x1b'))['db'];function respondWithStatusCode(_0x27d18c,_0x8523ad){_0x8523ad=_0x8523ad||0xcc;return function(_0x1693a5){if(_0x1693a5){return _0x27d18c[_0xb0e4('0x1c')](_0x8523ad);}return _0x27d18c[_0xb0e4('0x1d')](_0x8523ad)[_0xb0e4('0x1e')]();};}function respondWithResult(_0x1355f2,_0x436c07){_0x436c07=_0x436c07||0xc8;return function(_0x1bc455){if(_0x1bc455){return _0x1355f2[_0xb0e4('0x1d')](_0x436c07)[_0xb0e4('0x1f')](_0x1bc455);}};}function respondWithFilteredResult(_0x571261,_0x5548cd){return function(_0x3eb829){if(_0x3eb829){var _0x4f3b4f=typeof _0x5548cd[_0xb0e4('0x20')]===_0xb0e4('0x21')&&typeof _0x5548cd[_0xb0e4('0x22')]===_0xb0e4('0x21');var _0x9e001d=_0x3eb829[_0xb0e4('0x23')];var _0x296a24=_0x4f3b4f?0x0:_0x5548cd[_0xb0e4('0x20')];var _0x2cbf7a=_0x4f3b4f?_0x3eb829[_0xb0e4('0x23')]:_0x5548cd[_0xb0e4('0x20')]+_0x5548cd[_0xb0e4('0x22')];var _0x466815;if(_0x2cbf7a>=_0x9e001d){_0x2cbf7a=_0x9e001d;_0x466815=0xc8;}else{_0x466815=0xce;}_0x571261[_0xb0e4('0x1d')](_0x466815);return _0x571261[_0xb0e4('0x24')]('Content-Range',_0x296a24+'-'+_0x2cbf7a+'/'+_0x9e001d)[_0xb0e4('0x1f')](_0x3eb829);}return null;};}function patchUpdates(_0x3f1c7c){return function(_0x53817b){try{jsonpatch[_0xb0e4('0x25')](_0x53817b,_0x3f1c7c,!![]);}catch(_0x13c714){return BPromise[_0xb0e4('0x26')](_0x13c714);}return _0x53817b['save']();};}function saveUpdates(_0x33ef01,_0x9d6dd9){return function(_0x39764d){if(_0x39764d){return _0x39764d['update'](_0x33ef01)[_0xb0e4('0x27')](function(_0x23ac33){return _0x23ac33;});}return null;};}function removeEntity(_0x42b5e8,_0x1bd73d){return function(_0x1ee632){if(_0x1ee632){return _0x1ee632['destroy']()[_0xb0e4('0x27')](function(){var _0x30d7fc=_0x1ee632[_0xb0e4('0x28')]({'plain':!![]});var _0x34ba60='Dispositions';return db[_0xb0e4('0x29')]['destroy']({'where':{'type':_0x34ba60,'resourceId':_0x30d7fc['id']}})[_0xb0e4('0x27')](function(){return _0x1ee632;});})['then'](function(){_0x42b5e8[_0xb0e4('0x1d')](0xcc)[_0xb0e4('0x1e')]();});}};}function handleEntityNotFound(_0xd3fda5,_0x532c07){return function(_0x5d4bba){if(!_0x5d4bba){_0xd3fda5[_0xb0e4('0x1c')](0x194);}return _0x5d4bba;};}function handleError(_0x5d65e7,_0x27b5c7){_0x27b5c7=_0x27b5c7||0x1f4;return function(_0x11ffac){logger[_0xb0e4('0x2a')](_0x11ffac['stack']);if(_0x11ffac['name']){delete _0x11ffac[_0xb0e4('0x2b')];}_0x5d65e7[_0xb0e4('0x1d')](_0x27b5c7)[_0xb0e4('0x2c')](_0x11ffac);};}exports[_0xb0e4('0x2d')]=function(_0x383928,_0x3bf014){var _0x59379d={},_0x45d279={},_0x210c59={'count':0x0,'rows':[]};var _0x401719=_['map'](db[_0xb0e4('0x2e')]['rawAttributes'],function(_0x57dd40){return{'name':_0x57dd40[_0xb0e4('0x2f')],'type':_0x57dd40[_0xb0e4('0x30')][_0xb0e4('0x31')]};});_0x45d279[_0xb0e4('0x32')]=_[_0xb0e4('0x33')](_0x401719,_0xb0e4('0x2b'));_0x45d279[_0xb0e4('0x34')]=_[_0xb0e4('0x35')](_0x383928[_0xb0e4('0x34')]);_0x45d279['filters']=_['intersection'](_0x45d279[_0xb0e4('0x32')],_0x45d279[_0xb0e4('0x34')]);_0x59379d[_0xb0e4('0x36')]=_['intersection'](_0x45d279[_0xb0e4('0x32')],qs['fields'](_0x383928[_0xb0e4('0x34')]['fields']));_0x59379d[_0xb0e4('0x36')]=_0x59379d['attributes']['length']?_0x59379d[_0xb0e4('0x36')]:_0x45d279[_0xb0e4('0x32')];if(!_0x383928[_0xb0e4('0x34')][_0xb0e4('0x37')](_0xb0e4('0x38'))){_0x59379d[_0xb0e4('0x22')]=qs[_0xb0e4('0x22')](_0x383928['query']['limit']);_0x59379d[_0xb0e4('0x20')]=qs['offset'](_0x383928[_0xb0e4('0x34')]['offset']);}_0x59379d[_0xb0e4('0x39')]=qs['sort'](_0x383928[_0xb0e4('0x34')][_0xb0e4('0x3a')]);_0x59379d['where']=qs['filters'](_[_0xb0e4('0x3b')](_0x383928[_0xb0e4('0x34')],_0x45d279['filters']),_0x401719);if(_0x383928[_0xb0e4('0x34')]['filter']){_0x59379d['where']=_['merge'](_0x59379d[_0xb0e4('0x3c')],{'$or':_[_0xb0e4('0x33')](_0x401719,function(_0x597f10){if(_0x597f10['type']!==_0xb0e4('0x3d')){var _0x1c9589={};_0x1c9589[_0x597f10['name']]={'$like':'%'+_0x383928[_0xb0e4('0x34')][_0xb0e4('0x3e')]+'%'};return _0x1c9589;}})});}_0x59379d=_[_0xb0e4('0x3f')]({},_0x59379d,_0x383928['options']);var _0x21a0bc={'where':_0x59379d['where']};return db[_0xb0e4('0x2e')][_0xb0e4('0x23')](_0x21a0bc)[_0xb0e4('0x27')](function(_0x15e655){_0x210c59[_0xb0e4('0x23')]=_0x15e655;if(_0x383928[_0xb0e4('0x34')][_0xb0e4('0x40')]){_0x59379d['include']=[{'all':!![]}];}return db[_0xb0e4('0x2e')][_0xb0e4('0x41')](_0x59379d);})[_0xb0e4('0x27')](function(_0x51dd0d){_0x210c59[_0xb0e4('0x42')]=_0x51dd0d;return _0x210c59;})[_0xb0e4('0x27')](respondWithFilteredResult(_0x3bf014,_0x59379d))['catch'](handleError(_0x3bf014,null));};exports['show']=function(_0x31a039,_0x154af8){var _0x5afe84={'raw':!![],'where':{'id':_0x31a039[_0xb0e4('0x43')]['id']}},_0x169902={};_0x169902[_0xb0e4('0x32')]=_[_0xb0e4('0x35')](db['Disposition'][_0xb0e4('0x44')]);_0x169902[_0xb0e4('0x34')]=_['keys'](_0x31a039['query']);_0x169902[_0xb0e4('0x45')]=_[_0xb0e4('0x46')](_0x169902[_0xb0e4('0x32')],_0x169902['query']);_0x5afe84[_0xb0e4('0x36')]=_[_0xb0e4('0x46')](_0x169902['model'],qs[_0xb0e4('0x47')](_0x31a039[_0xb0e4('0x34')]['fields']));_0x5afe84[_0xb0e4('0x36')]=_0x5afe84[_0xb0e4('0x36')][_0xb0e4('0x48')]?_0x5afe84[_0xb0e4('0x36')]:_0x169902[_0xb0e4('0x32')];if(_0x31a039[_0xb0e4('0x34')][_0xb0e4('0x40')]){_0x5afe84[_0xb0e4('0x49')]=[{'all':!![]}];}_0x5afe84=_['merge']({},_0x5afe84,_0x31a039['options']);return db[_0xb0e4('0x2e')][_0xb0e4('0x4a')](_0x5afe84)[_0xb0e4('0x27')](handleEntityNotFound(_0x154af8,null))[_0xb0e4('0x27')](respondWithResult(_0x154af8,null))[_0xb0e4('0x4b')](handleError(_0x154af8,null));};exports['create']=function(_0x5ac8c2,_0x468e31){return db[_0xb0e4('0x2e')]['create'](_0x5ac8c2[_0xb0e4('0x4c')],{})[_0xb0e4('0x27')](function(_0x151d49){var _0x2cda61=_0x5ac8c2[_0xb0e4('0x4d')][_0xb0e4('0x28')]({'plain':!![]});if(!_0x2cda61)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2cda61['role']===_0xb0e4('0x4d')){var _0x404f1e=_0x151d49['get']({'plain':!![]});var _0x46dd66=_0xb0e4('0x4e');return db[_0xb0e4('0x4f')][_0xb0e4('0x4a')]({'where':{'name':_0x46dd66,'userProfileId':_0x2cda61[_0xb0e4('0x50')]},'raw':!![]})[_0xb0e4('0x27')](function(_0xc9ceb9){if(_0xc9ceb9&&_0xc9ceb9[_0xb0e4('0x51')]===0x0){return db['UserProfileResource'][_0xb0e4('0x52')]({'name':_0x404f1e[_0xb0e4('0x2b')],'resourceId':_0x404f1e['id'],'type':_0xc9ceb9[_0xb0e4('0x2b')],'sectionId':_0xc9ceb9['id']},{})[_0xb0e4('0x27')](function(){return _0x151d49;});}else{return _0x151d49;}})[_0xb0e4('0x4b')](function(_0x34db9d){logger[_0xb0e4('0x2a')](_0xb0e4('0x53'),_0x34db9d);throw _0x34db9d;});}return _0x151d49;})[_0xb0e4('0x27')](respondWithResult(_0x468e31,0xc9))[_0xb0e4('0x4b')](handleError(_0x468e31,null));};exports[_0xb0e4('0x54')]=function(_0xa3bba6,_0xab9922){if(_0xa3bba6[_0xb0e4('0x4c')]['id']){delete _0xa3bba6['body']['id'];}return db[_0xb0e4('0x2e')][_0xb0e4('0x4a')]({'where':{'id':_0xa3bba6[_0xb0e4('0x43')]['id']}})[_0xb0e4('0x27')](handleEntityNotFound(_0xab9922,null))[_0xb0e4('0x27')](saveUpdates(_0xa3bba6[_0xb0e4('0x4c')],null))[_0xb0e4('0x27')](respondWithResult(_0xab9922,null))[_0xb0e4('0x4b')](handleError(_0xab9922,null));};exports[_0xb0e4('0x55')]=function(_0x4881b3,_0x12a414){return db['Disposition'][_0xb0e4('0x4a')]({'where':{'id':_0x4881b3[_0xb0e4('0x43')]['id']}})[_0xb0e4('0x27')](handleEntityNotFound(_0x12a414,null))[_0xb0e4('0x27')](removeEntity(_0x12a414,null))[_0xb0e4('0x4b')](handleError(_0x12a414,null));}; \ No newline at end of file +var _0x0ec6=['merge','options','find','create','user','get','role','UserProfileSection','update','body','params','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','Dispositions','UserProfileResource','destroy','then','end','error','stack','name','map','Disposition','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','includeAll','include','findAll','rows','catch','show'];(function(_0x36fbef,_0x4ffc84){var _0x45e270=function(_0x32dd95){while(--_0x32dd95){_0x36fbef['push'](_0x36fbef['shift']());}};_0x45e270(++_0x4ffc84);}(_0x0ec6,0x1f1));var _0x60ec=function(_0x5d32f0,_0x429e9c){_0x5d32f0=_0x5d32f0-0x0;var _0x7d6bdb=_0x0ec6[_0x5d32f0];return _0x7d6bdb;};'use strict';var emlformat=require(_0x60ec('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x60ec('0x1'));var rp=require(_0x60ec('0x2'));var moment=require(_0x60ec('0x3'));var BPromise=require(_0x60ec('0x4'));var Mustache=require(_0x60ec('0x5'));var util=require(_0x60ec('0x6'));var path=require(_0x60ec('0x7'));var sox=require('sox');var csv=require(_0x60ec('0x8'));var ejs=require(_0x60ec('0x9'));var fs=require('fs');var fs_extra=require(_0x60ec('0xa'));var _=require(_0x60ec('0xb'));var squel=require('squel');var crypto=require(_0x60ec('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x60ec('0xd'));var toCsv=require(_0x60ec('0x8'));var querystring=require(_0x60ec('0xe'));var Papa=require(_0x60ec('0xf'));var Redis=require(_0x60ec('0x10'));var authService=require(_0x60ec('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x60ec('0x12'));var logger=require(_0x60ec('0x13'))(_0x60ec('0x14'));var utils=require(_0x60ec('0x15'));var config=require(_0x60ec('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x28cabb,_0x41621a){_0x41621a=_0x41621a||0xcc;return function(_0x103a72){if(_0x103a72){return _0x28cabb[_0x60ec('0x17')](_0x41621a);}return _0x28cabb[_0x60ec('0x18')](_0x41621a)['end']();};}function respondWithResult(_0x21af57,_0x456fb5){_0x456fb5=_0x456fb5||0xc8;return function(_0x22fdb1){if(_0x22fdb1){return _0x21af57[_0x60ec('0x18')](_0x456fb5)[_0x60ec('0x19')](_0x22fdb1);}};}function respondWithFilteredResult(_0x23298f,_0x1f7c76){return function(_0x19dd55){if(_0x19dd55){var _0x448553=typeof _0x1f7c76['offset']===_0x60ec('0x1a')&&typeof _0x1f7c76[_0x60ec('0x1b')]===_0x60ec('0x1a');var _0x155bdc=_0x19dd55[_0x60ec('0x1c')];var _0x222c38=_0x448553?0x0:_0x1f7c76[_0x60ec('0x1d')];var _0x13052c=_0x448553?_0x19dd55[_0x60ec('0x1c')]:_0x1f7c76[_0x60ec('0x1d')]+_0x1f7c76[_0x60ec('0x1b')];var _0x1bdc45;if(_0x13052c>=_0x155bdc){_0x13052c=_0x155bdc;_0x1bdc45=0xc8;}else{_0x1bdc45=0xce;}_0x23298f['status'](_0x1bdc45);return _0x23298f[_0x60ec('0x1e')](_0x60ec('0x1f'),_0x222c38+'-'+_0x13052c+'/'+_0x155bdc)[_0x60ec('0x19')](_0x19dd55);}return null;};}function patchUpdates(_0x278ae3){return function(_0x5cace8){try{jsonpatch[_0x60ec('0x20')](_0x5cace8,_0x278ae3,!![]);}catch(_0x3e152c){return BPromise[_0x60ec('0x21')](_0x3e152c);}return _0x5cace8[_0x60ec('0x22')]();};}function saveUpdates(_0x3ab7ef,_0x354f08){return function(_0x492dfa){if(_0x492dfa){return _0x492dfa['update'](_0x3ab7ef)['then'](function(_0x1476c6){return _0x1476c6;});}return null;};}function removeEntity(_0x1080c0,_0x1f0ce7){return function(_0x1fd96e){if(_0x1fd96e){return _0x1fd96e['destroy']()['then'](function(){var _0x47ede9=_0x1fd96e['get']({'plain':!![]});var _0x317b9a=_0x60ec('0x23');return db[_0x60ec('0x24')][_0x60ec('0x25')]({'where':{'type':_0x317b9a,'resourceId':_0x47ede9['id']}})[_0x60ec('0x26')](function(){return _0x1fd96e;});})[_0x60ec('0x26')](function(){_0x1080c0[_0x60ec('0x18')](0xcc)[_0x60ec('0x27')]();});}};}function handleEntityNotFound(_0x1da3bb,_0x4999c7){return function(_0x9e904f){if(!_0x9e904f){_0x1da3bb[_0x60ec('0x17')](0x194);}return _0x9e904f;};}function handleError(_0x55449b,_0x31c3b9){_0x31c3b9=_0x31c3b9||0x1f4;return function(_0xf3817d){logger[_0x60ec('0x28')](_0xf3817d[_0x60ec('0x29')]);if(_0xf3817d[_0x60ec('0x2a')]){delete _0xf3817d[_0x60ec('0x2a')];}_0x55449b[_0x60ec('0x18')](_0x31c3b9)['send'](_0xf3817d);};}exports['index']=function(_0x2edc8c,_0x2df6ba){var _0x4d0b14={},_0x48d814={},_0x1cb821={'count':0x0,'rows':[]};var _0x54348a=_[_0x60ec('0x2b')](db[_0x60ec('0x2c')][_0x60ec('0x2d')],function(_0x1299c9){return{'name':_0x1299c9[_0x60ec('0x2e')],'type':_0x1299c9['type'][_0x60ec('0x2f')]};});_0x48d814[_0x60ec('0x30')]=_[_0x60ec('0x2b')](_0x54348a,_0x60ec('0x2a'));_0x48d814[_0x60ec('0x31')]=_[_0x60ec('0x32')](_0x2edc8c['query']);_0x48d814[_0x60ec('0x33')]=_[_0x60ec('0x34')](_0x48d814['model'],_0x48d814[_0x60ec('0x31')]);_0x4d0b14[_0x60ec('0x35')]=_[_0x60ec('0x34')](_0x48d814[_0x60ec('0x30')],qs['fields'](_0x2edc8c[_0x60ec('0x31')][_0x60ec('0x36')]));_0x4d0b14[_0x60ec('0x35')]=_0x4d0b14[_0x60ec('0x35')][_0x60ec('0x37')]?_0x4d0b14[_0x60ec('0x35')]:_0x48d814[_0x60ec('0x30')];if(!_0x2edc8c[_0x60ec('0x31')][_0x60ec('0x38')](_0x60ec('0x39'))){_0x4d0b14[_0x60ec('0x1b')]=qs[_0x60ec('0x1b')](_0x2edc8c[_0x60ec('0x31')][_0x60ec('0x1b')]);_0x4d0b14[_0x60ec('0x1d')]=qs[_0x60ec('0x1d')](_0x2edc8c[_0x60ec('0x31')]['offset']);}_0x4d0b14[_0x60ec('0x3a')]=qs[_0x60ec('0x3b')](_0x2edc8c['query'][_0x60ec('0x3b')]);_0x4d0b14['where']=qs[_0x60ec('0x33')](_[_0x60ec('0x3c')](_0x2edc8c[_0x60ec('0x31')],_0x48d814[_0x60ec('0x33')]),_0x54348a);if(_0x2edc8c[_0x60ec('0x31')][_0x60ec('0x3d')]){_0x4d0b14[_0x60ec('0x3e')]=_['merge'](_0x4d0b14['where'],{'$or':_['map'](_0x54348a,function(_0x3e7f85){if(_0x3e7f85['type']!==_0x60ec('0x3f')){var _0x306f52={};_0x306f52[_0x3e7f85['name']]={'$like':'%'+_0x2edc8c[_0x60ec('0x31')]['filter']+'%'};return _0x306f52;}})});}_0x4d0b14=_['merge']({},_0x4d0b14,_0x2edc8c['options']);var _0x298e2c={'where':_0x4d0b14[_0x60ec('0x3e')]};return db[_0x60ec('0x2c')][_0x60ec('0x1c')](_0x298e2c)['then'](function(_0x3bb831){_0x1cb821[_0x60ec('0x1c')]=_0x3bb831;if(_0x2edc8c[_0x60ec('0x31')][_0x60ec('0x40')]){_0x4d0b14[_0x60ec('0x41')]=[{'all':!![]}];}return db[_0x60ec('0x2c')][_0x60ec('0x42')](_0x4d0b14);})[_0x60ec('0x26')](function(_0xf76d37){_0x1cb821[_0x60ec('0x43')]=_0xf76d37;return _0x1cb821;})[_0x60ec('0x26')](respondWithFilteredResult(_0x2df6ba,_0x4d0b14))[_0x60ec('0x44')](handleError(_0x2df6ba,null));};exports[_0x60ec('0x45')]=function(_0x1409b2,_0x483503){var _0x3c45d2={'raw':!![],'where':{'id':_0x1409b2['params']['id']}},_0x2a4e0d={};_0x2a4e0d[_0x60ec('0x30')]=_['keys'](db[_0x60ec('0x2c')][_0x60ec('0x2d')]);_0x2a4e0d[_0x60ec('0x31')]=_[_0x60ec('0x32')](_0x1409b2[_0x60ec('0x31')]);_0x2a4e0d['filters']=_[_0x60ec('0x34')](_0x2a4e0d['model'],_0x2a4e0d[_0x60ec('0x31')]);_0x3c45d2[_0x60ec('0x35')]=_[_0x60ec('0x34')](_0x2a4e0d[_0x60ec('0x30')],qs[_0x60ec('0x36')](_0x1409b2['query'][_0x60ec('0x36')]));_0x3c45d2['attributes']=_0x3c45d2[_0x60ec('0x35')][_0x60ec('0x37')]?_0x3c45d2['attributes']:_0x2a4e0d['model'];if(_0x1409b2[_0x60ec('0x31')][_0x60ec('0x40')]){_0x3c45d2[_0x60ec('0x41')]=[{'all':!![]}];}_0x3c45d2=_[_0x60ec('0x46')]({},_0x3c45d2,_0x1409b2[_0x60ec('0x47')]);return db[_0x60ec('0x2c')][_0x60ec('0x48')](_0x3c45d2)[_0x60ec('0x26')](handleEntityNotFound(_0x483503,null))[_0x60ec('0x26')](respondWithResult(_0x483503,null))[_0x60ec('0x44')](handleError(_0x483503,null));};exports[_0x60ec('0x49')]=function(_0x3c10af,_0x43bfcf){return db[_0x60ec('0x2c')][_0x60ec('0x49')](_0x3c10af['body'],{})[_0x60ec('0x26')](function(_0x1d8188){var _0x202ced=_0x3c10af[_0x60ec('0x4a')][_0x60ec('0x4b')]({'plain':!![]});if(!_0x202ced)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x202ced[_0x60ec('0x4c')]==='user'){var _0x3ce66e=_0x1d8188[_0x60ec('0x4b')]({'plain':!![]});var _0x5c606a=_0x60ec('0x23');return db[_0x60ec('0x4d')]['find']({'where':{'name':_0x5c606a,'userProfileId':_0x202ced['userProfileId']},'raw':!![]})[_0x60ec('0x26')](function(_0x50b9ea){if(_0x50b9ea&&_0x50b9ea['autoAssociation']===0x0){return db[_0x60ec('0x24')]['create']({'name':_0x3ce66e[_0x60ec('0x2a')],'resourceId':_0x3ce66e['id'],'type':_0x50b9ea[_0x60ec('0x2a')],'sectionId':_0x50b9ea['id']},{})['then'](function(){return _0x1d8188;});}else{return _0x1d8188;}})[_0x60ec('0x44')](function(_0x12f414){logger[_0x60ec('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x12f414);throw _0x12f414;});}return _0x1d8188;})[_0x60ec('0x26')](respondWithResult(_0x43bfcf,0xc9))[_0x60ec('0x44')](handleError(_0x43bfcf,null));};exports[_0x60ec('0x4e')]=function(_0x13c46c,_0x2ea124){if(_0x13c46c[_0x60ec('0x4f')]['id']){delete _0x13c46c[_0x60ec('0x4f')]['id'];}return db[_0x60ec('0x2c')]['find']({'where':{'id':_0x13c46c[_0x60ec('0x50')]['id']}})[_0x60ec('0x26')](handleEntityNotFound(_0x2ea124,null))[_0x60ec('0x26')](saveUpdates(_0x13c46c[_0x60ec('0x4f')],null))['then'](respondWithResult(_0x2ea124,null))[_0x60ec('0x44')](handleError(_0x2ea124,null));};exports[_0x60ec('0x25')]=function(_0xba960b,_0x50fcdc){return db[_0x60ec('0x2c')][_0x60ec('0x48')]({'where':{'id':_0xba960b[_0x60ec('0x50')]['id']}})[_0x60ec('0x26')](handleEntityNotFound(_0x50fcdc,null))['then'](removeEntity(_0x50fcdc,null))[_0x60ec('0x44')](handleError(_0x50fcdc,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 4392229..c3c4de5 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 _0x0526=['rimraf','../../config/environment','exports','define','name_voice','name','name_chat','ChatWebsiteId','MailAccountId','name_sms','FaxAccountId','name_openchannel','WhatsappAccountId','lodash','../../config/logger','moment','bluebird','path'];(function(_0x377f50,_0x5589ba){var _0x14a9d2=function(_0x4ab38b){while(--_0x4ab38b){_0x377f50['push'](_0x377f50['shift']());}};_0x14a9d2(++_0x5589ba);}(_0x0526,0x11b));var _0x6052=function(_0x5e7330,_0x505b45){_0x5e7330=_0x5e7330-0x0;var _0x51fe73=_0x0526[_0x5e7330];return _0x51fe73;};'use strict';var _=require(_0x6052('0x0'));var util=require('util');var logger=require(_0x6052('0x1'))('api');var moment=require(_0x6052('0x2'));var BPromise=require(_0x6052('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6052('0x4'));var rimraf=require(_0x6052('0x5'));var config=require(_0x6052('0x6'));var attributes=require('./disposition.attributes');module[_0x6052('0x7')]=function(_0xa38cfa,_0x37eec3){return _0xa38cfa[_0x6052('0x8')]('Disposition',attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':_0x6052('0x9'),'fields':[_0x6052('0xa'),'ListId']},{'unique':!![],'name':_0x6052('0xb'),'fields':['name',_0x6052('0xc')]},{'unique':!![],'name':'name_mail','fields':[_0x6052('0xa'),_0x6052('0xd')]},{'unique':!![],'name':_0x6052('0xe'),'fields':[_0x6052('0xa'),'SmsAccountId']},{'unique':!![],'name':'name_fax','fields':['name',_0x6052('0xf')]},{'unique':!![],'name':_0x6052('0x10'),'fields':['name','OpenchannelAccountId']},{'unique':!![],'name':'name_whatsapp','fields':[_0x6052('0xa'),_0x6052('0x11')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xed31=['OpenchannelAccountId','WhatsappAccountId','lodash','util','moment','bluebird','request-promise','path','../../config/environment','./disposition.attributes','exports','define','Disposition','name_voice','name_chat','name','ChatWebsiteId','name_mail','MailAccountId','name_sms','SmsAccountId','name_fax','FaxAccountId','name_openchannel'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xed31,0x7a));var _0x1ed3=function(_0x5e6939,_0x3dcd8a){_0x5e6939=_0x5e6939-0x0;var _0x45d3f1=_0xed31[_0x5e6939];return _0x45d3f1;};'use strict';var _=require(_0x1ed3('0x0'));var util=require(_0x1ed3('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x1ed3('0x2'));var BPromise=require(_0x1ed3('0x3'));var rp=require(_0x1ed3('0x4'));var fs=require('fs');var path=require(_0x1ed3('0x5'));var rimraf=require('rimraf');var config=require(_0x1ed3('0x6'));var attributes=require(_0x1ed3('0x7'));module[_0x1ed3('0x8')]=function(_0x10ffdd,_0x38b694){return _0x10ffdd[_0x1ed3('0x9')](_0x1ed3('0xa'),attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':_0x1ed3('0xb'),'fields':['name','ListId']},{'unique':!![],'name':_0x1ed3('0xc'),'fields':[_0x1ed3('0xd'),_0x1ed3('0xe')]},{'unique':!![],'name':_0x1ed3('0xf'),'fields':['name',_0x1ed3('0x10')]},{'unique':!![],'name':_0x1ed3('0x11'),'fields':['name',_0x1ed3('0x12')]},{'unique':!![],'name':_0x1ed3('0x13'),'fields':[_0x1ed3('0xd'),_0x1ed3('0x14')]},{'unique':!![],'name':_0x1ed3('0x15'),'fields':[_0x1ed3('0xd'),_0x1ed3('0x16')]},{'unique':!![],'name':'name_whatsapp','fields':[_0x1ed3('0xd'),_0x1ed3('0x17')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index eefbe98..b725ef6 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(_0x560980,_0x7981cc){var _0xb3b9d6=function(_0x349580){while(--_0x349580){_0x560980['push'](_0x560980['shift']());}};_0xb3b9d6(++_0x7981cc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xa9e0[_0x5783f4];return _0x28e380;};'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(_0x3e79ab,_0x2684e6){var _0x3b813c=function(_0x59b4d2){while(--_0x59b4d2){_0x3e79ab['push'](_0x3e79ab['shift']());}};_0x3b813c(++_0x2684e6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xa9e0[_0x2763f2];return _0x3ef471;};'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 481e76a..23dae72 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 _0x32d0=['get','isAuthenticated','index','/:id','show','post','create','put','destroy','multer','util','path','connect-timeout','express','../../config/environment','./disposition.controller'];(function(_0x4e48de,_0xffdb21){var _0x567e8c=function(_0x296f6c){while(--_0x296f6c){_0x4e48de['push'](_0x4e48de['shift']());}};_0x567e8c(++_0xffdb21);}(_0x32d0,0x139));var _0x032d=function(_0x3c5a91,_0x478b6e){_0x3c5a91=_0x3c5a91-0x0;var _0x270daa=_0x32d0[_0x3c5a91];return _0x270daa;};'use strict';var multer=require(_0x032d('0x0'));var util=require(_0x032d('0x1'));var path=require(_0x032d('0x2'));var timeout=require(_0x032d('0x3'));var express=require(_0x032d('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x032d('0x5'));var controller=require(_0x032d('0x6'));router[_0x032d('0x7')]('/',auth[_0x032d('0x8')](),controller[_0x032d('0x9')]);router[_0x032d('0x7')](_0x032d('0xa'),auth[_0x032d('0x8')](),controller[_0x032d('0xb')]);router[_0x032d('0xc')]('/',auth['isAuthenticated'](),controller[_0x032d('0xd')]);router[_0x032d('0xe')](_0x032d('0xa'),auth[_0x032d('0x8')](),controller['update']);router['delete'](_0x032d('0xa'),auth['isAuthenticated'](),controller[_0x032d('0xf')]);module['exports']=router; \ No newline at end of file +var _0x96c1=['path','connect-timeout','fs-extra','../../components/auth/service','./disposition.controller','get','isAuthenticated','index','/:id','show','post','put','delete','destroy','multer','util'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x96c1,0x10e));var _0x196c=function(_0x5ce662,_0x30c6ea){_0x5ce662=_0x5ce662-0x0;var _0xdd005=_0x96c1[_0x5ce662];return _0xdd005;};'use strict';var multer=require(_0x196c('0x0'));var util=require(_0x196c('0x1'));var path=require(_0x196c('0x2'));var timeout=require(_0x196c('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x196c('0x4'));var auth=require(_0x196c('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x196c('0x6'));router[_0x196c('0x7')]('/',auth[_0x196c('0x8')](),controller[_0x196c('0x9')]);router[_0x196c('0x7')](_0x196c('0xa'),auth[_0x196c('0x8')](),controller[_0x196c('0xb')]);router[_0x196c('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x196c('0xd')](_0x196c('0xa'),auth[_0x196c('0x8')](),controller['update']);router[_0x196c('0xe')](_0x196c('0xa'),auth['isAuthenticated'](),controller[_0x196c('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index be124c6..a3c0d27 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 _0x4604=['STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','2400','4800','7200','12000','9600','14400','DADHI','SIP','TEXT','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','mandatoryDispositionPauseId','sequelize','exports'];(function(_0x4718f7,_0x3cb9be){var _0x3c3f70=function(_0x92e3f0){while(--_0x92e3f0){_0x4718f7['push'](_0x4718f7['shift']());}};_0x3c3f70(++_0x3cb9be);}(_0x4604,0x1e1));var _0x4460=function(_0x5ac8fc,_0x35b006){_0x5ac8fc=_0x5ac8fc-0x0;var _0x3d3db5=_0x4604[_0x5ac8fc];return _0x3d3db5;};'use strict';var Sequelize=require(_0x4460('0x0'));module[_0x4460('0x1')]={'name':{'type':Sequelize[_0x4460('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x4460('0x2')]},'ecm':{'type':Sequelize[_0x4460('0x3')](_0x4460('0x4'),'no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize['STRING'],'defaultValue':_0x4460('0x5')},'localstationid':{'type':Sequelize[_0x4460('0x2')],'unique':'localstationid'},'minrate':{'type':Sequelize[_0x4460('0x3')](_0x4460('0x6'),_0x4460('0x7'),_0x4460('0x8'),'9600',_0x4460('0x9'),'14400'),'defaultValue':_0x4460('0x7')},'maxrate':{'type':Sequelize[_0x4460('0x3')](_0x4460('0x6'),_0x4460('0x7'),_0x4460('0x8'),_0x4460('0xa'),_0x4460('0x9'),_0x4460('0xb')),'defaultValue':_0x4460('0xb')},'modem':{'type':Sequelize[_0x4460('0x2')],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize[_0x4460('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x4460('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x4460('0x3')]('SIP','IAX',_0x4460('0xc'),'KHOMP'),'defaultValue':_0x4460('0xd')},'key':{'type':Sequelize[_0x4460('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x4460('0xe')],'defaultValue':function(){return _0x4460('0xf');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x4460('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x4460('0x11')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x4460('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x4460('0x10')],'allowNull':!![],'defaultValue':null,'comment':_0x4460('0x12')},'mandatoryDisposition':{'type':Sequelize[_0x4460('0x11')],'defaultValue':![],'comment':_0x4460('0x13'),'set':function(_0x5049ff){if(!_0x5049ff)this['setDataValue'](_0x4460('0x14'),null);this['setDataValue']('mandatoryDisposition',_0x5049ff);}}}; \ No newline at end of file +var _0x7128=['STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','4800','9600','2400','7200','v17,v27,v29','INTEGER','SIP','IAX','DADHI','KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports'];(function(_0x1deb03,_0xd05ad8){var _0x189fe7=function(_0x321225){while(--_0x321225){_0x1deb03['push'](_0x1deb03['shift']());}};_0x189fe7(++_0xd05ad8);}(_0x7128,0xfb));var _0x8712=function(_0x622035,_0x1a4b91){_0x622035=_0x622035-0x0;var _0x326cf2=_0x7128[_0x622035];return _0x326cf2;};'use strict';var Sequelize=require(_0x8712('0x0'));module[_0x8712('0x1')]={'name':{'type':Sequelize[_0x8712('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x8712('0x2')]},'ecm':{'type':Sequelize[_0x8712('0x3')](_0x8712('0x4'),'no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize[_0x8712('0x2')],'defaultValue':_0x8712('0x5')},'localstationid':{'type':Sequelize[_0x8712('0x2')],'unique':'localstationid'},'minrate':{'type':Sequelize[_0x8712('0x3')]('2400',_0x8712('0x6'),'7200',_0x8712('0x7'),'12000','14400'),'defaultValue':'4800'},'maxrate':{'type':Sequelize['ENUM'](_0x8712('0x8'),_0x8712('0x6'),_0x8712('0x9'),_0x8712('0x7'),'12000','14400'),'defaultValue':'14400'},'modem':{'type':Sequelize[_0x8712('0x2')],'defaultValue':_0x8712('0xa')},'gateway':{'type':Sequelize[_0x8712('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x8712('0xb')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize['ENUM'](_0x8712('0xc'),_0x8712('0xd'),_0x8712('0xe'),_0x8712('0xf')),'defaultValue':'SIP'},'key':{'type':Sequelize[_0x8712('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x8712('0x10')],'defaultValue':function(){return _0x8712('0x11');}},'notificationSound':{'type':Sequelize[_0x8712('0x12')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x8712('0x12')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x8712('0x12')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x8712('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x8712('0xb')],'allowNull':!![],'defaultValue':null,'comment':_0x8712('0x13')},'mandatoryDisposition':{'type':Sequelize[_0x8712('0x12')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x2a5dfd){if(!_0x2a5dfd)this[_0x8712('0x14')](_0x8712('0x15'),null);this[_0x8712('0x14')](_0x8712('0x16'),_0x2a5dfd);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 33b052a..8e9d9ef 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 _0xb00e=['removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./faxAccount.socket','jayson/promise','http','client','request','then','info','debug','request\x20sent','stringify','error','code','FaxAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','save','destroy','FaxAccounts','UserProfileResource','name','send','index','mandatoryDispositionPause','FaxAccount','rawAttributes','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','includeAll','create','body','user','get','role','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','Pause','describe','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','addInteraction','getInteractions','FaxInteraction','CmContact','Contact','User','Owner','fullname','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','FaxApplication','findAndCountAll','priority','stack','json','getApplications','from-voip-provider','exten','localstationid','app','system','description','appdata','Answer','push','CDR(type)=inbound-fax','gateway','faxdetect','headerinfo','maxrate','modem','t38timeout','Set','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','VoiceExtension','bulkCreate','updateAccountApplications','omit','tech','createdAt','updatedAt','TrunkId','ListId','getMessages','format','YYYY-MM-DD\x20HH:mm:ss','FaxMessage','CmList','List','DESC','attachments','join','server/files/attachments','basename','isNil','from','\x22%s\x22\x20<%s>','fax','Contacts','List\x20not\x20found','out','filename','Messages','Contact\x20not\x20found','spread','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save'];(function(_0x3df739,_0xfd6450){var _0x2ea45b=function(_0x3818aa){while(--_0x3818aa){_0x3df739['push'](_0x3df739['shift']());}};_0x2ea45b(++_0xfd6450);}(_0xb00e,0xc9));var _0xeb00=function(_0x1ab180,_0x382b2c){_0x1ab180=_0x1ab180-0x0;var _0xfb2c2d=_0xb00e[_0x1ab180];return _0xfb2c2d;};'use strict';var emlformat=require(_0xeb00('0x0'));var rimraf=require(_0xeb00('0x1'));var zipdir=require(_0xeb00('0x2'));var jsonpatch=require(_0xeb00('0x3'));var rp=require(_0xeb00('0x4'));var moment=require(_0xeb00('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xeb00('0x6'));var util=require(_0xeb00('0x7'));var path=require(_0xeb00('0x8'));var sox=require(_0xeb00('0x9'));var csv=require(_0xeb00('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xeb00('0xb'));var crypto=require(_0xeb00('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xeb00('0xa'));var querystring=require('querystring');var Papa=require(_0xeb00('0xd'));var Redis=require(_0xeb00('0xe'));var authService=require(_0xeb00('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xeb00('0x10'));var hardwareService=require(_0xeb00('0x11'));var logger=require(_0xeb00('0x12'))(_0xeb00('0x13'));var utils=require(_0xeb00('0x14'));var config=require(_0xeb00('0x15'));var licenseUtil=require(_0xeb00('0x16'));var db=require(_0xeb00('0x17'))['db'];config[_0xeb00('0x18')]=_[_0xeb00('0x19')](config[_0xeb00('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0xeb00('0x1a'))(new Redis(config[_0xeb00('0x18')]));require(_0xeb00('0x1b'))['register'](socket);var jayson=require(_0xeb00('0x1c'));var client=jayson['client'][_0xeb00('0x1d')]({'port':0x232c});var client9002=jayson[_0xeb00('0x1e')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4266d4,_0x845b4,_0x17b47d,_0x54cf6c){return new BPromise(function(_0x250257,_0x51d4df){var _0x22e124=_0x54cf6c||client;return _0x22e124[_0xeb00('0x1f')](_0x4266d4,_0x17b47d)[_0xeb00('0x20')](function(_0x759bf2){logger[_0xeb00('0x21')]('FaxAccount,\x20%s,\x20%s',_0x845b4,'request\x20sent');logger[_0xeb00('0x22')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x845b4,_0xeb00('0x23'),JSON[_0xeb00('0x24')](_0x759bf2));if(_0x759bf2[_0xeb00('0x25')]){if(_0x759bf2[_0xeb00('0x25')][_0xeb00('0x26')]===0x1f4){logger[_0xeb00('0x25')](_0xeb00('0x27'),_0x845b4,_0x759bf2[_0xeb00('0x25')][_0xeb00('0x28')]);return _0x51d4df(_0x759bf2[_0xeb00('0x25')][_0xeb00('0x28')]);}logger[_0xeb00('0x25')](_0xeb00('0x27'),_0x845b4,_0x759bf2['error'][_0xeb00('0x28')]);return _0x250257(_0x759bf2['error']['message']);}else{logger[_0xeb00('0x21')]('FaxAccount,\x20%s,\x20%s',_0x845b4,_0xeb00('0x23'));_0x250257(_0x759bf2[_0xeb00('0x29')][_0xeb00('0x28')]);}})[_0xeb00('0x2a')](function(_0x3b62be){logger['error'](_0xeb00('0x27'),_0x845b4,_0x3b62be);_0x51d4df(_0x3b62be);});});}function respondWithStatusCode(_0x222612,_0x457f50){_0x457f50=_0x457f50||0xcc;return function(_0x587ca4){if(_0x587ca4){return _0x222612[_0xeb00('0x2b')](_0x457f50);}return _0x222612[_0xeb00('0x2c')](_0x457f50)[_0xeb00('0x2d')]();};}function respondWithResult(_0x4d06f7,_0x3f051e){_0x3f051e=_0x3f051e||0xc8;return function(_0x15629b){if(_0x15629b){return _0x4d06f7[_0xeb00('0x2c')](_0x3f051e)['json'](_0x15629b);}};}function respondWithFilteredResult(_0xe74e19,_0x414ded){return function(_0x5d514f){if(_0x5d514f){var _0xc95f15=typeof _0x414ded[_0xeb00('0x2e')]===_0xeb00('0x2f')&&typeof _0x414ded[_0xeb00('0x30')]===_0xeb00('0x2f');var _0xe76e08=_0x5d514f[_0xeb00('0x31')];var _0x5528a7=_0xc95f15?0x0:_0x414ded[_0xeb00('0x2e')];var _0x4dd261=_0xc95f15?_0x5d514f[_0xeb00('0x31')]:_0x414ded[_0xeb00('0x2e')]+_0x414ded[_0xeb00('0x30')];var _0x873c0;if(_0x4dd261>=_0xe76e08){_0x4dd261=_0xe76e08;_0x873c0=0xc8;}else{_0x873c0=0xce;}_0xe74e19['status'](_0x873c0);return _0xe74e19[_0xeb00('0x32')](_0xeb00('0x33'),_0x5528a7+'-'+_0x4dd261+'/'+_0xe76e08)['json'](_0x5d514f);}return null;};}function patchUpdates(_0x1b2990){return function(_0x14b810){try{jsonpatch['apply'](_0x14b810,_0x1b2990,!![]);}catch(_0x553435){return BPromise['reject'](_0x553435);}return _0x14b810[_0xeb00('0x34')]();};}function saveUpdates(_0x30150a,_0x9c8862){return function(_0x2c92dc){if(_0x2c92dc){return _0x2c92dc['update'](_0x30150a)['then'](function(_0x399baa){return _0x399baa;});}return null;};}function removeEntity(_0x45ba8b,_0x142420){return function(_0x118c69){if(_0x118c69){return _0x118c69[_0xeb00('0x35')]()[_0xeb00('0x20')](function(){var _0x5d599a=_0x118c69['get']({'plain':!![]});var _0x277e70=_0xeb00('0x36');return db[_0xeb00('0x37')][_0xeb00('0x35')]({'where':{'type':_0x277e70,'resourceId':_0x5d599a['id']}})[_0xeb00('0x20')](function(){return _0x118c69;});})[_0xeb00('0x20')](function(){_0x45ba8b[_0xeb00('0x2c')](0xcc)[_0xeb00('0x2d')]();});}};}function handleEntityNotFound(_0x321ac4,_0xb08c91){return function(_0x2d3fe7){if(!_0x2d3fe7){_0x321ac4[_0xeb00('0x2b')](0x194);}return _0x2d3fe7;};}function handleError(_0x20eb12,_0x46b90d){_0x46b90d=_0x46b90d||0x1f4;return function(_0x5e98e2){logger[_0xeb00('0x25')](_0x5e98e2['stack']);if(_0x5e98e2[_0xeb00('0x38')]){delete _0x5e98e2[_0xeb00('0x38')];}_0x20eb12[_0xeb00('0x2c')](_0x46b90d)[_0xeb00('0x39')](_0x5e98e2);};}exports[_0xeb00('0x3a')]=function(_0x41a0f2,_0xf4d0c4){var _0x5e1b4d={'include':[{'model':db['Pause'],'as':_0xeb00('0x3b')}]},_0x54abd8={},_0x1a4cb2={'count':0x0,'rows':[]};var _0x30e447=_['map'](db[_0xeb00('0x3c')][_0xeb00('0x3d')],function(_0x34100b){return{'name':_0x34100b[_0xeb00('0x3e')],'type':_0x34100b[_0xeb00('0x3f')][_0xeb00('0x40')]};});_0x54abd8[_0xeb00('0x41')]=_[_0xeb00('0x42')](_0x30e447,'name');_0x54abd8['query']=_[_0xeb00('0x43')](_0x41a0f2['query']);_0x54abd8[_0xeb00('0x44')]=_[_0xeb00('0x45')](_0x54abd8['model'],_0x54abd8[_0xeb00('0x46')]);_0x5e1b4d[_0xeb00('0x47')]=_['intersection'](_0x54abd8[_0xeb00('0x41')],qs[_0xeb00('0x48')](_0x41a0f2['query'][_0xeb00('0x48')]));_0x5e1b4d[_0xeb00('0x47')]=_0x5e1b4d[_0xeb00('0x47')][_0xeb00('0x49')]?_0x5e1b4d['attributes']:_0x54abd8[_0xeb00('0x41')];if(!_0x41a0f2[_0xeb00('0x46')][_0xeb00('0x4a')](_0xeb00('0x4b'))){_0x5e1b4d[_0xeb00('0x30')]=qs[_0xeb00('0x30')](_0x41a0f2[_0xeb00('0x46')][_0xeb00('0x30')]);_0x5e1b4d[_0xeb00('0x2e')]=qs[_0xeb00('0x2e')](_0x41a0f2['query'][_0xeb00('0x2e')]);}_0x5e1b4d[_0xeb00('0x4c')]=qs[_0xeb00('0x4d')](_0x41a0f2[_0xeb00('0x46')]['sort']);_0x5e1b4d[_0xeb00('0x4e')]=qs['filters'](_[_0xeb00('0x4f')](_0x41a0f2[_0xeb00('0x46')],_0x54abd8[_0xeb00('0x44')]),_0x30e447);if(_0x41a0f2[_0xeb00('0x46')][_0xeb00('0x50')]){_0x5e1b4d[_0xeb00('0x4e')]=_[_0xeb00('0x51')](_0x5e1b4d[_0xeb00('0x4e')],{'$or':_['map'](_0x30e447,function(_0x5a7db8){if(_0x5a7db8['type']!==_0xeb00('0x52')){var _0x22b940={};_0x22b940[_0x5a7db8[_0xeb00('0x38')]]={'$like':'%'+_0x41a0f2['query'][_0xeb00('0x50')]+'%'};return _0x22b940;}})});}_0x5e1b4d=_[_0xeb00('0x51')]({},_0x5e1b4d,_0x41a0f2[_0xeb00('0x53')]);var _0x3920a4={'where':_0x5e1b4d[_0xeb00('0x4e')]};return db['FaxAccount'][_0xeb00('0x31')](_0x3920a4)[_0xeb00('0x20')](function(_0x4c50d2){_0x1a4cb2['count']=_0x4c50d2;if(_0x41a0f2[_0xeb00('0x46')]['includeAll']){_0x5e1b4d[_0xeb00('0x54')]=[{'all':!![]}];}return db[_0xeb00('0x3c')][_0xeb00('0x55')](_0x5e1b4d);})[_0xeb00('0x20')](function(_0x1a0dda){_0x1a4cb2[_0xeb00('0x56')]=_0x1a0dda;return _0x1a4cb2;})[_0xeb00('0x20')](respondWithFilteredResult(_0xf4d0c4,_0x5e1b4d))[_0xeb00('0x2a')](handleError(_0xf4d0c4,null));};exports[_0xeb00('0x57')]=function(_0x1fdb86,_0x113fbb){var _0x452a13={'raw':![],'where':{'id':_0x1fdb86[_0xeb00('0x58')]['id']},'include':[{'model':db['Pause'],'as':_0xeb00('0x3b')}]},_0x1d95ea={};_0x1d95ea[_0xeb00('0x41')]=_[_0xeb00('0x43')](db[_0xeb00('0x3c')][_0xeb00('0x3d')]);_0x1d95ea[_0xeb00('0x46')]=_[_0xeb00('0x43')](_0x1fdb86[_0xeb00('0x46')]);_0x1d95ea['filters']=_[_0xeb00('0x45')](_0x1d95ea['model'],_0x1d95ea[_0xeb00('0x46')]);_0x452a13['attributes']=_[_0xeb00('0x45')](_0x1d95ea[_0xeb00('0x41')],qs[_0xeb00('0x48')](_0x1fdb86[_0xeb00('0x46')][_0xeb00('0x48')]));_0x452a13[_0xeb00('0x47')]=_0x452a13['attributes'][_0xeb00('0x49')]?_0x452a13[_0xeb00('0x47')]:_0x1d95ea[_0xeb00('0x41')];if(_0x1fdb86[_0xeb00('0x46')][_0xeb00('0x59')]){_0x452a13[_0xeb00('0x54')]=[{'all':!![]}];}_0x452a13=_[_0xeb00('0x51')]({},_0x452a13,_0x1fdb86[_0xeb00('0x53')]);return db[_0xeb00('0x3c')]['find'](_0x452a13)[_0xeb00('0x20')](handleEntityNotFound(_0x113fbb,null))['then'](respondWithResult(_0x113fbb,null))['catch'](handleError(_0x113fbb,null));};exports[_0xeb00('0x5a')]=function(_0x17abbb,_0x5e6a9a){return db['FaxAccount']['create'](_0x17abbb[_0xeb00('0x5b')],{})['then'](function(_0x229102){var _0x3e2a24=_0x17abbb[_0xeb00('0x5c')][_0xeb00('0x5d')]({'plain':!![]});if(!_0x3e2a24)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3e2a24[_0xeb00('0x5e')]===_0xeb00('0x5c')){var _0x4fe41c=_0x229102[_0xeb00('0x5d')]({'plain':!![]});var _0x161e54=_0xeb00('0x36');return db['UserProfileSection'][_0xeb00('0x5f')]({'where':{'name':_0x161e54,'userProfileId':_0x3e2a24[_0xeb00('0x60')]},'raw':!![]})[_0xeb00('0x20')](function(_0x3c8832){if(_0x3c8832&&_0x3c8832[_0xeb00('0x61')]===0x0){return db['UserProfileResource']['create']({'name':_0x4fe41c[_0xeb00('0x38')],'resourceId':_0x4fe41c['id'],'type':_0x3c8832['name'],'sectionId':_0x3c8832['id']},{})[_0xeb00('0x20')](function(){return _0x229102;});}else{return _0x229102;}})[_0xeb00('0x2a')](function(_0x535e65){logger[_0xeb00('0x25')](_0xeb00('0x62'),_0x535e65);throw _0x535e65;});}return _0x229102;})['then'](respondWithResult(_0x5e6a9a,0xc9))[_0xeb00('0x2a')](handleError(_0x5e6a9a,null));};exports[_0xeb00('0x63')]=function(_0x5e3ed6,_0x4c0ff3){if(_0x5e3ed6[_0xeb00('0x5b')]['id']){delete _0x5e3ed6[_0xeb00('0x5b')]['id'];}return db[_0xeb00('0x3c')][_0xeb00('0x5f')]({'where':{'id':_0x5e3ed6['params']['id']},'include':[{'model':db[_0xeb00('0x64')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x4c0ff3,null))[_0xeb00('0x20')](saveUpdates(_0x5e3ed6[_0xeb00('0x5b')],null))[_0xeb00('0x20')](respondWithResult(_0x4c0ff3,null))[_0xeb00('0x2a')](handleError(_0x4c0ff3,null));};exports[_0xeb00('0x35')]=function(_0x155d32,_0x258f9c){return db[_0xeb00('0x3c')][_0xeb00('0x5f')]({'where':{'id':_0x155d32[_0xeb00('0x58')]['id']}})[_0xeb00('0x20')](handleEntityNotFound(_0x258f9c,null))[_0xeb00('0x20')](removeEntity(_0x258f9c,null))[_0xeb00('0x2a')](handleError(_0x258f9c,null));};exports[_0xeb00('0x65')]=function(_0x2af283,_0x2c5452){return db['FaxAccount'][_0xeb00('0x65')]()[_0xeb00('0x20')](respondWithResult(_0x2c5452,null))[_0xeb00('0x2a')](handleError(_0x2c5452,null));};exports[_0xeb00('0x66')]=function(_0xb3d201,_0x2d5a35,_0x49f484){if(_0xb3d201['body']['id']){delete _0xb3d201['body']['id'];}return db[_0xeb00('0x3c')][_0xeb00('0x5f')]({'where':{'id':_0xb3d201[_0xeb00('0x58')]['id']}})[_0xeb00('0x20')](handleEntityNotFound(_0x2d5a35,null))[_0xeb00('0x20')](function(_0x1a4a18){if(_0x1a4a18){_0xb3d201['body'][_0xeb00('0x67')]=_0x1a4a18['id'];return db[_0xeb00('0x68')][_0xeb00('0x5a')](_0xb3d201[_0xeb00('0x5b')]);}})['then'](respondWithResult(_0x2d5a35,null))[_0xeb00('0x2a')](handleError(_0x2d5a35,null));};exports[_0xeb00('0x69')]=function(_0x572863,_0x405b03,_0x365614){var _0x324eb4={'raw':![],'where':{}};var _0x1e282a={};var _0xbb1041={'count':0x0,'rows':[]};return db[_0xeb00('0x3c')][_0xeb00('0x6a')]({'where':{'id':_0x572863[_0xeb00('0x58')]['id']}})['then'](handleEntityNotFound(_0x405b03,null))['then'](function(_0x9aba1f){if(_0x9aba1f){_0x1e282a[_0xeb00('0x41')]=_['keys'](db[_0xeb00('0x68')]['rawAttributes']);_0x1e282a[_0xeb00('0x46')]=_[_0xeb00('0x43')](_0x572863['query']);_0x1e282a[_0xeb00('0x44')]=_[_0xeb00('0x45')](_0x1e282a[_0xeb00('0x41')],_0x1e282a[_0xeb00('0x46')]);_0x324eb4[_0xeb00('0x47')]=_[_0xeb00('0x45')](_0x1e282a[_0xeb00('0x41')],qs[_0xeb00('0x48')](_0x572863['query'][_0xeb00('0x48')]));_0x324eb4['attributes']=_0x324eb4['attributes'][_0xeb00('0x49')]?_0x324eb4['attributes']:_0x1e282a['model'];if(!_0x572863[_0xeb00('0x46')]['hasOwnProperty']('nolimit')){_0x324eb4[_0xeb00('0x30')]=qs[_0xeb00('0x30')](_0x572863[_0xeb00('0x46')][_0xeb00('0x30')]);_0x324eb4[_0xeb00('0x2e')]=qs['offset'](_0x572863[_0xeb00('0x46')][_0xeb00('0x2e')]);}_0x324eb4[_0xeb00('0x4c')]=qs[_0xeb00('0x4d')](_0x572863[_0xeb00('0x46')][_0xeb00('0x4d')]);_0x324eb4[_0xeb00('0x4e')]=qs[_0xeb00('0x44')](_['pick'](_0x572863[_0xeb00('0x46')],_0x1e282a[_0xeb00('0x44')]));_0x324eb4[_0xeb00('0x4e')]['FaxAccountId']=_0x9aba1f['id'];if(_0x572863['query'][_0xeb00('0x50')]){_0x324eb4[_0xeb00('0x4e')]=_[_0xeb00('0x51')](_0x324eb4[_0xeb00('0x4e')],{'$or':_[_0xeb00('0x42')](_0x324eb4['attributes'],function(_0x59b2ff){var _0x3bbacb={};_0x3bbacb[_0x59b2ff]={'$like':'%'+_0x572863[_0xeb00('0x46')][_0xeb00('0x50')]+'%'};return _0x3bbacb;})});}_0x324eb4=_[_0xeb00('0x51')]({},_0x324eb4,_0x572863[_0xeb00('0x53')]);return db[_0xeb00('0x68')][_0xeb00('0x31')]({'where':_0x324eb4[_0xeb00('0x4e')]})[_0xeb00('0x20')](function(_0x1fa13c){_0xbb1041['count']=_0x1fa13c;if(_0x572863[_0xeb00('0x46')][_0xeb00('0x59')]){_0x324eb4[_0xeb00('0x54')]=[{'all':!![]}];}return db['Disposition'][_0xeb00('0x55')](_0x324eb4);})[_0xeb00('0x20')](function(_0x3b0bb7){_0xbb1041['rows']=_0x3b0bb7;return _0xbb1041;});}})['then'](respondWithFilteredResult(_0x405b03,_0x324eb4))['catch'](handleError(_0x405b03,null));};exports[_0xeb00('0x6b')]=function(_0x583d06,_0x356401,_0x573f0c){return db[_0xeb00('0x3c')]['find']({'where':{'id':_0x583d06['params']['id']}})['then'](handleEntityNotFound(_0x356401,null))[_0xeb00('0x20')](function(_0x592acd){if(_0x592acd){return _0x592acd[_0xeb00('0x6b')](_0x583d06[_0xeb00('0x46')][_0xeb00('0x6c')]);}})[_0xeb00('0x20')](respondWithStatusCode(_0x356401,null))[_0xeb00('0x2a')](handleError(_0x356401,null));};exports['addAnswer']=function(_0x37d430,_0x1dc81a,_0x53e9ec){if(_0x37d430[_0xeb00('0x5b')]['id']){delete _0x37d430[_0xeb00('0x5b')]['id'];}return db[_0xeb00('0x3c')][_0xeb00('0x5f')]({'where':{'id':_0x37d430[_0xeb00('0x58')]['id']}})[_0xeb00('0x20')](handleEntityNotFound(_0x1dc81a,null))[_0xeb00('0x20')](function(_0x2ea338){if(_0x2ea338){_0x37d430['body'][_0xeb00('0x67')]=_0x2ea338['id'];return db[_0xeb00('0x6d')]['create'](_0x37d430['body']);}})[_0xeb00('0x20')](respondWithResult(_0x1dc81a,null))[_0xeb00('0x2a')](handleError(_0x1dc81a,null));};exports[_0xeb00('0x6e')]=function(_0x414a02,_0x20e876,_0x3ed0f4){var _0x299119={'raw':![],'where':{}};var _0xf17045={};var _0x38f14d={'count':0x0,'rows':[]};return db['FaxAccount'][_0xeb00('0x6a')]({'where':{'id':_0x414a02['params']['id']}})[_0xeb00('0x20')](handleEntityNotFound(_0x20e876,null))[_0xeb00('0x20')](function(_0x4a1069){if(_0x4a1069){_0xf17045[_0xeb00('0x41')]=_['keys'](db[_0xeb00('0x6d')]['rawAttributes']);_0xf17045['query']=_[_0xeb00('0x43')](_0x414a02[_0xeb00('0x46')]);_0xf17045[_0xeb00('0x44')]=_[_0xeb00('0x45')](_0xf17045[_0xeb00('0x41')],_0xf17045['query']);_0x299119[_0xeb00('0x47')]=_['intersection'](_0xf17045['model'],qs[_0xeb00('0x48')](_0x414a02[_0xeb00('0x46')]['fields']));_0x299119['attributes']=_0x299119[_0xeb00('0x47')][_0xeb00('0x49')]?_0x299119[_0xeb00('0x47')]:_0xf17045[_0xeb00('0x41')];if(!_0x414a02[_0xeb00('0x46')][_0xeb00('0x4a')]('nolimit')){_0x299119[_0xeb00('0x30')]=qs['limit'](_0x414a02[_0xeb00('0x46')][_0xeb00('0x30')]);_0x299119['offset']=qs[_0xeb00('0x2e')](_0x414a02['query'][_0xeb00('0x2e')]);}_0x299119['order']=qs[_0xeb00('0x4d')](_0x414a02[_0xeb00('0x46')][_0xeb00('0x4d')]);_0x299119['where']=qs['filters'](_[_0xeb00('0x4f')](_0x414a02[_0xeb00('0x46')],_0xf17045[_0xeb00('0x44')]));_0x299119[_0xeb00('0x4e')][_0xeb00('0x67')]=_0x4a1069['id'];if(_0x414a02[_0xeb00('0x46')][_0xeb00('0x50')]){_0x299119[_0xeb00('0x4e')]=_[_0xeb00('0x51')](_0x299119['where'],{'$or':_['map'](_0x299119[_0xeb00('0x47')],function(_0x2526b7){var _0x39dcd6={};_0x39dcd6[_0x2526b7]={'$like':'%'+_0x414a02[_0xeb00('0x46')][_0xeb00('0x50')]+'%'};return _0x39dcd6;})});}_0x299119=_['merge']({},_0x299119,_0x414a02[_0xeb00('0x53')]);return db[_0xeb00('0x6d')][_0xeb00('0x31')]({'where':_0x299119[_0xeb00('0x4e')]})[_0xeb00('0x20')](function(_0x4f9819){_0x38f14d[_0xeb00('0x31')]=_0x4f9819;if(_0x414a02[_0xeb00('0x46')]['includeAll']){_0x299119[_0xeb00('0x54')]=[{'all':!![]}];}return db[_0xeb00('0x6d')][_0xeb00('0x55')](_0x299119);})['then'](function(_0x148a8c){_0x38f14d[_0xeb00('0x56')]=_0x148a8c;return _0x38f14d;});}})[_0xeb00('0x20')](respondWithFilteredResult(_0x20e876,_0x299119))[_0xeb00('0x2a')](handleError(_0x20e876,null));};exports[_0xeb00('0x6f')]=function(_0x982d82,_0x281b18,_0x51e1da){return db[_0xeb00('0x3c')][_0xeb00('0x5f')]({'where':{'id':_0x982d82['params']['id']}})[_0xeb00('0x20')](handleEntityNotFound(_0x281b18,null))['then'](function(_0x5970cd){if(_0x5970cd){return _0x5970cd[_0xeb00('0x6f')](_0x982d82['query']['ids']);}})[_0xeb00('0x20')](respondWithStatusCode(_0x281b18,null))['catch'](handleError(_0x281b18,null));};exports[_0xeb00('0x70')]=function(_0x5d1073,_0x38f1db,_0x52195b){return db['FaxInteraction'][_0xeb00('0x5f')]({'where':{'id':_0x5d1073[_0xeb00('0x58')]['id']}})[_0xeb00('0x20')](handleEntityNotFound(_0x38f1db,null))[_0xeb00('0x20')](function(_0x1d01f1){if(_0x1d01f1){return _0x1d01f1[_0xeb00('0x70')](_0x5d1073[_0xeb00('0x5b')]['ids'],_['omit'](_0x5d1073['body'],[_0xeb00('0x6c'),'id'])||{});}})['then'](respondWithResult(_0x38f1db,null))[_0xeb00('0x2a')](handleError(_0x38f1db,null));};exports[_0xeb00('0x71')]=function(_0x26ea0a,_0x7895b0,_0x1e0436){var _0x1f3766={'raw':![],'where':{}};var _0x2a40a9={};var _0x13bf85={'count':0x0,'rows':[]};return db[_0xeb00('0x3c')]['findOne']({'where':{'id':_0x26ea0a[_0xeb00('0x58')]['id']}})[_0xeb00('0x20')](handleEntityNotFound(_0x7895b0,null))[_0xeb00('0x20')](function(_0x269988){if(_0x269988){_0x2a40a9[_0xeb00('0x41')]=_[_0xeb00('0x43')](db[_0xeb00('0x72')][_0xeb00('0x3d')]);_0x2a40a9['query']=_[_0xeb00('0x43')](_0x26ea0a[_0xeb00('0x46')]);_0x2a40a9[_0xeb00('0x44')]=_[_0xeb00('0x45')](_0x2a40a9[_0xeb00('0x41')],_0x2a40a9[_0xeb00('0x46')]);_0x1f3766['attributes']=_[_0xeb00('0x45')](_0x2a40a9['model'],qs[_0xeb00('0x48')](_0x26ea0a[_0xeb00('0x46')][_0xeb00('0x48')]));_0x1f3766[_0xeb00('0x47')]=_0x1f3766[_0xeb00('0x47')][_0xeb00('0x49')]?_0x1f3766[_0xeb00('0x47')]:_0x2a40a9[_0xeb00('0x41')];if(!_0x26ea0a['query'][_0xeb00('0x4a')](_0xeb00('0x4b'))){_0x1f3766['limit']=qs[_0xeb00('0x30')](_0x26ea0a[_0xeb00('0x46')]['limit']);_0x1f3766['offset']=qs[_0xeb00('0x2e')](_0x26ea0a['query'][_0xeb00('0x2e')]);}_0x1f3766[_0xeb00('0x4c')]=qs[_0xeb00('0x4d')](_0x26ea0a[_0xeb00('0x46')][_0xeb00('0x4d')]);_0x1f3766[_0xeb00('0x4e')]=qs['filters'](_[_0xeb00('0x4f')](_0x26ea0a[_0xeb00('0x46')],_0x2a40a9[_0xeb00('0x44')]));_0x1f3766[_0xeb00('0x4e')][_0xeb00('0x67')]=_0x269988['id'];if(_0x26ea0a[_0xeb00('0x46')]['filter']){_0x1f3766[_0xeb00('0x4e')]=_[_0xeb00('0x51')](_0x1f3766[_0xeb00('0x4e')],{'$or':_['map'](_0x1f3766[_0xeb00('0x47')],function(_0x267135){var _0x9ed0a2={};_0x9ed0a2[_0x267135]={'$like':'%'+_0x26ea0a[_0xeb00('0x46')][_0xeb00('0x50')]+'%'};return _0x9ed0a2;})});}_0x1f3766=_[_0xeb00('0x51')]({},_0x1f3766,_0x26ea0a[_0xeb00('0x53')]);return db[_0xeb00('0x72')][_0xeb00('0x31')]({'where':_0x1f3766[_0xeb00('0x4e')]})[_0xeb00('0x20')](function(_0x19af6f){_0x13bf85[_0xeb00('0x31')]=_0x19af6f;if(_0x26ea0a[_0xeb00('0x46')][_0xeb00('0x59')]){_0x1f3766['include']=[{'model':db[_0xeb00('0x73')],'as':_0xeb00('0x74'),'required':![]},{'model':db[_0xeb00('0x75')],'as':_0xeb00('0x76'),'attributes':[_0xeb00('0x38'),_0xeb00('0x77'),_0xeb00('0x78')],'required':![]},{'model':db[_0xeb00('0x79')],'as':_0xeb00('0x7a'),'attributes':['id',_0xeb00('0x38'),_0xeb00('0x7b')],'where':_0x26ea0a[_0xeb00('0x46')][_0xeb00('0x7c')]?{'id':_0x26ea0a[_0xeb00('0x46')][_0xeb00('0x7c')]}:undefined,'required':_0x26ea0a[_0xeb00('0x46')][_0xeb00('0x7c')]?!![]:![]}];}return db[_0xeb00('0x72')][_0xeb00('0x55')](_0x1f3766);})[_0xeb00('0x20')](function(_0x39156a){_0x13bf85[_0xeb00('0x56')]=_0x39156a;return _0x13bf85;});}})['then'](respondWithFilteredResult(_0x7895b0,_0x1f3766))['catch'](handleError(_0x7895b0,null));};exports[_0xeb00('0x7d')]=function(_0x3852be,_0x4a1420){var _0x77f06e=_0x3852be['params']['id'];var _0x383bfc=_0x3852be[_0xeb00('0x5b')];var _0x29051e=0xc8;var _0x22099b=null;return db[_0xeb00('0x7e')][_0xeb00('0x7f')]({'isolationLevel':db[_0xeb00('0x7e')]['Transaction']['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x19dbb6){return db[_0xeb00('0x3c')][_0xeb00('0x6a')]({'where':{'id':_0x77f06e},'transaction':_0x19dbb6})[_0xeb00('0x20')](function(_0x339820){if(_0x339820){return db[_0xeb00('0x80')]['destroy']({'where':{'FaxAccountId':_0x77f06e},'transaction':_0x19dbb6})['then'](function(){var _0x36fe11=_[_0xeb00('0x42')](_0x383bfc,function(_0xdc4134){_0xdc4134[_0xeb00('0x67')]=_0x77f06e;return _0xdc4134;});return db[_0xeb00('0x80')]['bulkCreate'](_0x36fe11,{'transaction':_0x19dbb6});});}else{_0x29051e=0x194;_0x22099b=[];}});})['then'](function(){if(_0x29051e!==0x194){return db[_0xeb00('0x80')][_0xeb00('0x81')]({'where':{'FaxAccountId':_0x77f06e},'order':_0xeb00('0x82')})[_0xeb00('0x20')](function(_0x308fc2){_0x22099b=_0x308fc2;});}})[_0xeb00('0x2a')](function(_0x13de1a){_0x29051e=0x1f4;logger[_0xeb00('0x25')](_0x13de1a[_0xeb00('0x83')]);if(_0x13de1a[_0xeb00('0x38')]){delete _0x13de1a[_0xeb00('0x38')];}_0x22099b=_0x13de1a;})['finally'](function(){if(_0x22099b===null){_0x4a1420[_0xeb00('0x2b')](_0x29051e);}else{if(_0x29051e===0x1f4){_0x4a1420[_0xeb00('0x2c')](_0x29051e)['send'](_0x22099b);}else{_0x4a1420[_0xeb00('0x2c')](_0x29051e)[_0xeb00('0x84')](_0x22099b);}}});};exports[_0xeb00('0x85')]=function(_0x95962c,_0x3cd6d6,_0x3e37a6){var _0x3a24f8={};var _0x427173={};var _0x25590e;var _0x1434ee;return db[_0xeb00('0x3c')][_0xeb00('0x6a')]({'where':{'id':_0x95962c[_0xeb00('0x58')]['id']}})[_0xeb00('0x20')](handleEntityNotFound(_0x3cd6d6,null))['then'](function(_0x2827f9){if(_0x2827f9){_0x25590e=_0x2827f9;_0x427173[_0xeb00('0x41')]=_[_0xeb00('0x43')](db[_0xeb00('0x80')]['rawAttributes']);_0x427173['query']=_[_0xeb00('0x43')](_0x95962c['query']);_0x427173[_0xeb00('0x44')]=_['intersection'](_0x427173[_0xeb00('0x41')],_0x427173[_0xeb00('0x46')]);_0x3a24f8['attributes']=_[_0xeb00('0x45')](_0x427173[_0xeb00('0x41')],qs[_0xeb00('0x48')](_0x95962c['query'][_0xeb00('0x48')]));_0x3a24f8[_0xeb00('0x47')]=_0x3a24f8[_0xeb00('0x47')][_0xeb00('0x49')]?_0x3a24f8[_0xeb00('0x47')]:_0x427173['model'];_0x3a24f8[_0xeb00('0x4c')]=qs[_0xeb00('0x4d')](_0x95962c['query'][_0xeb00('0x4d')]);_0x3a24f8[_0xeb00('0x4e')]=qs['filters'](_['pick'](_0x95962c[_0xeb00('0x46')],_0x427173[_0xeb00('0x44')]));if(_0x95962c[_0xeb00('0x46')][_0xeb00('0x50')]){_0x3a24f8[_0xeb00('0x4e')]=_[_0xeb00('0x51')](_0x3a24f8[_0xeb00('0x4e')],{'$or':_['map'](_0x3a24f8[_0xeb00('0x47')],function(_0x22c6f0){var _0x1569eb={};_0x1569eb[_0x22c6f0]={'$like':'%'+_0x95962c[_0xeb00('0x46')][_0xeb00('0x50')]+'%'};return _0x1569eb;})});}_0x3a24f8=_[_0xeb00('0x51')]({},_0x3a24f8,_0x95962c[_0xeb00('0x53')]);return _0x25590e[_0xeb00('0x85')](_0x3a24f8);}})[_0xeb00('0x20')](function(_0x5c3d1e){if(_0x5c3d1e){_0x1434ee=_0x5c3d1e['length'];if(!_0x95962c[_0xeb00('0x46')][_0xeb00('0x4a')](_0xeb00('0x4b'))){_0x3a24f8['limit']=qs[_0xeb00('0x30')](_0x95962c[_0xeb00('0x46')][_0xeb00('0x30')]);_0x3a24f8[_0xeb00('0x2e')]=qs[_0xeb00('0x2e')](_0x95962c[_0xeb00('0x46')][_0xeb00('0x2e')]);}return _0x25590e[_0xeb00('0x85')](_0x3a24f8);}})[_0xeb00('0x20')](function(_0x5400f9){if(_0x5400f9){return _0x5400f9?{'count':_0x1434ee,'rows':_0x5400f9}:null;}})[_0xeb00('0x20')](respondWithResult(_0x3cd6d6,null))[_0xeb00('0x2a')](handleError(_0x3cd6d6,null));};function Extension(_0x18dad2,_0x3c69b8,_0x36be05,_0x57e426){this['context']=_0xeb00('0x86');this[_0xeb00('0x87')]=_0x18dad2[_0xeb00('0x88')];this[_0xeb00('0x89')]=_0x57e426;this[_0xeb00('0x3f')]=_0xeb00('0x8a');this[_0xeb00('0x8b')]='Fax\x20Extension';this['FaxAccountId']=_0x18dad2['id'];this[_0xeb00('0x82')]=_0x3c69b8;this[_0xeb00('0x8c')]=_0x36be05;}function createExtensionsReciveFax(_0x5e4bf2){var _0x35f926=0x1;var _0x3d8cec=[];_0x3d8cec['push'](new Extension(_0x5e4bf2,_0x35f926,'',_0xeb00('0x8d')));_0x35f926+=0x1;_0x3d8cec[_0xeb00('0x8e')](new Extension(_0x5e4bf2,_0x35f926,_0xeb00('0x8f'),'Set'));_0x35f926+=0x1;for(var _0x44b60e in _0x5e4bf2){if(_0x5e4bf2[_0xeb00('0x4a')](_0x44b60e)&&(_0x44b60e==='ecm'||_0x44b60e===_0xeb00('0x88')||_0x44b60e===_0xeb00('0x90')||_0x44b60e===_0xeb00('0x91')||_0x44b60e===_0xeb00('0x92')||_0x44b60e===_0xeb00('0x93')||_0x44b60e==='minrate'||_0x44b60e===_0xeb00('0x94')||_0x44b60e===_0xeb00('0x95'))){_0x3d8cec[_0xeb00('0x8e')](new Extension(_0x5e4bf2,_0x35f926,'FAXOPT('+_0x44b60e+')='+_0x5e4bf2[_0x44b60e],_0xeb00('0x96')));_0x35f926+=0x1;}}_0x3d8cec[_0xeb00('0x8e')](new Extension(_0x5e4bf2,_0x35f926,'6',_0xeb00('0x97')));_0x35f926+=0x1;_0x3d8cec[_0xeb00('0x8e')](new Extension(_0x5e4bf2,_0x35f926,_0xeb00('0x98'),_0xeb00('0x99')));_0x35f926=0x0;return _0x3d8cec;}exports[_0xeb00('0x9a')]=function(_0x1b3f80,_0x54e61c,_0x35c84f){var _0x52be40;return db['sequelize'][_0xeb00('0x7f')](function(_0x76dc78){return db[_0xeb00('0x3c')]['create'](_0x1b3f80[_0xeb00('0x5b')],{'transaction':_0x76dc78})['then'](function(_0x2dfb4c){_0x52be40=_0x2dfb4c[_0xeb00('0x5d')]({'plain':!![]});return db[_0xeb00('0x9b')][_0xeb00('0x9c')](createExtensionsReciveFax(_0x52be40),{'transaction':_0x76dc78});});})[_0xeb00('0x20')](function(){return _0x52be40;})[_0xeb00('0x20')](respondWithResult(_0x54e61c,null))[_0xeb00('0x2a')](handleError(_0x54e61c,null));};exports[_0xeb00('0x9d')]=function(_0x5a80a5,_0x296b8f,_0x2d3d97){var _0x315e54;return db[_0xeb00('0x7e')][_0xeb00('0x7f')](function(_0x7544c5){return db[_0xeb00('0x3c')][_0xeb00('0x63')](_0x5a80a5[_0xeb00('0x5b')],{'where':{'id':_0x5a80a5['body']['id']},'transaction':_0x7544c5})['then'](function(_0x10d6bc){return db[_0xeb00('0x9b')][_0xeb00('0x35')]({'where':{'FaxAccountId':_0x5a80a5[_0xeb00('0x5b')]['id']},'transaction':_0x7544c5})[_0xeb00('0x20')](function(_0x30a807){return db[_0xeb00('0x9b')][_0xeb00('0x9c')](createExtensionsReciveFax(_[_0xeb00('0x9e')](_0x5a80a5[_0xeb00('0x5b')],[_0xeb00('0x9f'),'key',_0xeb00('0xa0'),_0xeb00('0xa1'),_0xeb00('0xa2'),_0xeb00('0xa3')])),{'transaction':_0x7544c5});});});})[_0xeb00('0x20')](function(){return db[_0xeb00('0x3c')]['findById'](_0x5a80a5[_0xeb00('0x5b')]['id']);})['then'](respondWithResult(_0x296b8f,null))[_0xeb00('0x2a')](handleError(_0x296b8f,null));};exports[_0xeb00('0xa4')]=function(_0x4b9837,_0x42f827,_0x150495){var _0x229b71={'raw':!![],'where':{}};var _0x391e2c={};var _0x104b00={'count':0x0,'rows':[]};return db[_0xeb00('0x3c')][_0xeb00('0x6a')]({'where':{'id':_0x4b9837[_0xeb00('0x58')]['id']}})['then'](handleEntityNotFound(_0x42f827,null))[_0xeb00('0x20')](function(_0x38dde0){if(_0x38dde0){_0x391e2c['model']=_['keys'](db['FaxMessage'][_0xeb00('0x3d')]);_0x391e2c[_0xeb00('0x46')]=_[_0xeb00('0x43')](_0x4b9837['query']);_0x391e2c[_0xeb00('0x44')]=_['intersection'](_0x391e2c[_0xeb00('0x41')],_0x391e2c[_0xeb00('0x46')]);_0x229b71[_0xeb00('0x47')]=_['intersection'](_0x391e2c[_0xeb00('0x41')],qs[_0xeb00('0x48')](_0x4b9837[_0xeb00('0x46')]['fields']));_0x229b71[_0xeb00('0x47')]=_0x229b71[_0xeb00('0x47')][_0xeb00('0x49')]?_0x229b71['attributes']:_0x391e2c[_0xeb00('0x41')];if(!_0x4b9837[_0xeb00('0x46')][_0xeb00('0x4a')](_0xeb00('0x4b'))){_0x229b71[_0xeb00('0x30')]=qs[_0xeb00('0x30')](_0x4b9837[_0xeb00('0x46')][_0xeb00('0x30')]);_0x229b71[_0xeb00('0x2e')]=qs[_0xeb00('0x2e')](_0x4b9837[_0xeb00('0x46')][_0xeb00('0x2e')]);}_0x229b71[_0xeb00('0x4c')]=qs[_0xeb00('0x4d')](_0x4b9837[_0xeb00('0x46')][_0xeb00('0x4d')]);_0x229b71[_0xeb00('0x4e')]=qs[_0xeb00('0x44')](_['pick'](_0x4b9837[_0xeb00('0x46')],_0x391e2c['filters']));_0x229b71[_0xeb00('0x4e')][_0xeb00('0x67')]=_0x38dde0['id'];if(_0x4b9837['query'][_0xeb00('0x50')]){_0x229b71['where']=_[_0xeb00('0x51')](_0x229b71[_0xeb00('0x4e')],{'$or':_['map'](_0x229b71[_0xeb00('0x47')],function(_0x41b9c9){var _0x271175={};_0x271175[_0x41b9c9]={'$like':'%'+_0x4b9837[_0xeb00('0x46')][_0xeb00('0x50')]+'%'};return _0x271175;})});}if(_0x4b9837[_0xeb00('0x46')]['$gte']){var _0xb0452b=_0x4b9837[_0xeb00('0x46')]['$gte']['split'](',');var _0x12f843={};_0x12f843[_0xb0452b[0x0]]={'$gte':moment(_0xb0452b[0x1])[_0xeb00('0xa5')](_0xeb00('0xa6'))};_0x229b71[_0xeb00('0x4e')]=_[_0xeb00('0x51')](_0x229b71['where'],_0x12f843);}_0x229b71=_['merge']({},_0x229b71,_0x4b9837['options']);return db[_0xeb00('0xa7')]['count']({'where':_0x229b71[_0xeb00('0x4e')]})[_0xeb00('0x20')](function(_0x506f56){_0x104b00['count']=_0x506f56;if(_0x4b9837[_0xeb00('0x46')][_0xeb00('0x59')]){_0x229b71[_0xeb00('0x54')]=[{'all':!![]}];}return db[_0xeb00('0xa7')]['findAll'](_0x229b71);})[_0xeb00('0x20')](function(_0x56a70b){_0x104b00[_0xeb00('0x56')]=_0x56a70b;return _0x104b00;});}})[_0xeb00('0x20')](respondWithFilteredResult(_0x42f827,_0x229b71))['catch'](handleError(_0x42f827,null));};exports[_0xeb00('0x39')]=function(_0x27efab,_0x5edbb1,_0x5c76d7){var _0x188cf8,_0x5727ca={},_0x1d5374;if(_0x27efab[_0xeb00('0x5b')]['to']){_0x1d5374=_0x27efab['body']['to'][0x0];}return db[_0xeb00('0x3c')][_0xeb00('0x5f')]({'where':{'id':_0x27efab[_0xeb00('0x58')]['id']},'include':[{'model':db[_0xeb00('0xa8')],'as':_0xeb00('0xa9'),'include':[{'model':db[_0xeb00('0x73')],'as':'Contacts','where':{'fax':_0x1d5374},'limit':0x1,'order':[['updatedAt',_0xeb00('0xaa')]]}]}]})[_0xeb00('0x20')](handleEntityNotFound(_0x5edbb1,null))[_0xeb00('0x20')](function(_0x303042){_0x188cf8=_0x303042;if(_0x27efab['body'][_0xeb00('0xab')]&&_0x27efab[_0xeb00('0x5b')]['attachments']['length']){for(var _0x4beb98=0x0;_0x4beb98<_0x27efab['body']['attachments'][_0xeb00('0x49')];_0x4beb98+=0x1){_0x27efab[_0xeb00('0x5b')][_0xeb00('0xab')][_0x4beb98]={'filename':_0x27efab['body'][_0xeb00('0xab')][_0x4beb98][_0xeb00('0x38')],'id':_0x27efab[_0xeb00('0x5b')][_0xeb00('0xab')][_0x4beb98]['id'],'path':path[_0xeb00('0xac')](config['root'],_0xeb00('0xad'),_0x27efab[_0xeb00('0x5b')][_0xeb00('0xab')][_0x4beb98][_0xeb00('0xae')])};}}return respondWithRpcPromise('CheckAfterSend','CheckAfterSend',{'FaxAccountId':_[_0xeb00('0xaf')](_0x27efab[_0xeb00('0x58')]['id'])?undefined:_0x27efab[_0xeb00('0x58')]['id'],'path':_[_0xeb00('0xaf')](_0x27efab['body'][_0xeb00('0xab')][0x0][_0xeb00('0x8')])?undefined:_0x27efab['body'][_0xeb00('0xab')][0x0][_0xeb00('0x8')],'fax':_[_0xeb00('0xaf')](_0x27efab[_0xeb00('0x5b')]['to'][0x0])?undefined:_0x27efab[_0xeb00('0x5b')]['to'][0x0]},client9002);})[_0xeb00('0x20')](function(){if(_0x188cf8){if(_['isNil'](_0x27efab[_0xeb00('0x5b')][_0xeb00('0xb0')])){_0x27efab[_0xeb00('0x5b')]['from']=util[_0xeb00('0xa5')](_0xeb00('0xb1'),_0x188cf8['name'],_0x188cf8[_0xeb00('0xb2')]);}if(_0x188cf8[_0xeb00('0xa9')]){if(_0x188cf8[_0xeb00('0xa9')]['Contacts'][_0xeb00('0x49')]){return _0x188cf8[_0xeb00('0xa9')][_0xeb00('0xb3')][0x0];}else{return db[_0xeb00('0x73')][_0xeb00('0x5a')](_['defaults'](_0x27efab['body'],{'firstName':_0x27efab[_0xeb00('0x5b')]['to'][0x0],'phone':_0x27efab[_0xeb00('0x5b')]['to'][0x0],'fax':_0x27efab['body']['to'][0x0],'ListId':_0x188cf8['ListId']}));}}else{throw new Error(_0xeb00('0xb4'));}}else{throw new Error('Send\x20Fax\x20failed');}})[_0xeb00('0x20')](function(_0x30fcd0){if(_0x30fcd0){return db[_0xeb00('0x72')][_0xeb00('0x5f')]({'where':{'ContactId':_0x30fcd0['id'],'closed':![],'FaxAccountId':_0x188cf8['id']}})[_0xeb00('0x20')](function(_0x30a317){if(_0x30a317){return[_0x30a317,![]];}return db[_0xeb00('0x72')]['create']({'UserId':_0x27efab[_0xeb00('0x5c')]['id'],'ContactId':_0x30fcd0['id'],'FaxAccountId':_0x188cf8['id'],'fax':_0x27efab[_0xeb00('0x5b')]['to'][0x0],'firstMsgDirection':_0xeb00('0xb5'),'Messages':[_[_0xeb00('0x51')](_0x27efab[_0xeb00('0x5b')],{'read':![],'body':_0x27efab[_0xeb00('0x5b')]['attachments'][0x0][_0xeb00('0xb6')],'FaxAccountId':_0x188cf8['id'],'UserId':_0x27efab[_0xeb00('0x5c')]['id'],'ContactId':_0x30fcd0['id'],'AttachmentId':_0x27efab[_0xeb00('0x5b')][_0xeb00('0xab')][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':_0xeb00('0xb7')}]})[_0xeb00('0x20')](function(_0x41fc3f){return[_0x41fc3f,!![]];});});}else{throw new Error(_0xeb00('0xb8'));}})[_0xeb00('0xb9')](function(_0xb2da0b,_0x5972e2){if(_0x5972e2){return _0xb2da0b;}return db[_0xeb00('0xa7')][_0xeb00('0x5a')]({'direction':_0xeb00('0xb5'),'read':![],'body':_0x27efab['body'][_0xeb00('0xab')][0x0][_0xeb00('0xb6')],'FaxAccountId':_0x188cf8['id'],'FaxInteractionId':_0xb2da0b['id'],'UserId':_0x27efab[_0xeb00('0x5c')]['id'],'ContactId':_0xb2da0b[_0xeb00('0xba')],'AttachmentId':_0x27efab[_0xeb00('0x5b')][_0xeb00('0xab')][0x0]['id']})['then'](function(_0x54e81d){_0xb2da0b[_0xeb00('0xbb')]['Messages']=[];_0xb2da0b[_0xeb00('0xbb')][_0xeb00('0xb7')][_0xeb00('0x8e')](_0x54e81d[_0xeb00('0xbb')]);return _0xb2da0b;});})[_0xeb00('0x20')](function(_0x27ada4){respondWithRpcPromise(_0xeb00('0xbc'),'SendFax',{'FaxAccountId':_['isNil'](_0x27efab[_0xeb00('0x58')]['id'])?undefined:_0x27efab[_0xeb00('0x58')]['id'],'path':_[_0xeb00('0xaf')](_0x27efab['body'][_0xeb00('0xab')][0x0][_0xeb00('0x8')])?undefined:_0x27efab[_0xeb00('0x5b')]['attachments'][0x0][_0xeb00('0x8')],'fax':_['isNil'](_0x27efab['body']['to'][0x0])?undefined:_0x27efab[_0xeb00('0x5b')]['to'][0x0],'AttachmentId':_0x27efab[_0xeb00('0x5b')][_0xeb00('0xab')][0x0]['id']},client9002)[_0xeb00('0x20')](function(_0x126250){logger[_0xeb00('0x21')](_0xeb00('0xbd'),_0x126250);})[_0xeb00('0x2a')](function(_0x320bfd){logger['info'](_0xeb00('0xbd'),_0x320bfd);});return _0x27ada4;})[_0xeb00('0x20')](respondWithResult(_0x5edbb1,null))[_0xeb00('0x2a')](handleError(_0x5edbb1,null));};exports[_0xeb00('0xbe')]=function(_0x549126,_0x229a64,_0x2244e7){return db['FaxAccount'][_0xeb00('0x5f')]({'where':{'id':_0x549126[_0xeb00('0x58')]['id']}})['then'](handleEntityNotFound(_0x229a64,null))[_0xeb00('0x20')](function(_0x4a9c9c){if(_0x4a9c9c){return _0x4a9c9c[_0xeb00('0xbe')](_0x549126[_0xeb00('0x5b')]['ids'],_[_0xeb00('0x9e')](_0x549126[_0xeb00('0x5b')],[_0xeb00('0x6c'),'id'])||{})['spread'](function(_0x3a9af5){for(var _0x4df6a3=0x0;_0x4df6a3<_0x549126['body'][_0xeb00('0x6c')][_0xeb00('0x49')];_0x4df6a3+=0x1){socket[_0xeb00('0xbf')](_0xeb00('0xc0'),{'UserId':Number(_0x549126[_0xeb00('0x5b')][_0xeb00('0x6c')][_0x4df6a3]),'FaxAccountId':Number(_0x549126[_0xeb00('0x58')]['id'])});}return _0x3a9af5;});}})[_0xeb00('0x20')](respondWithResult(_0x229a64,null))['catch'](handleError(_0x229a64,null));};exports['removeAgents']=function(_0x126be6,_0xa4ffe2,_0x5740db){return db[_0xeb00('0x3c')][_0xeb00('0x5f')]({'where':{'id':_0x126be6[_0xeb00('0x58')]['id']}})[_0xeb00('0x20')](handleEntityNotFound(_0xa4ffe2,null))[_0xeb00('0x20')](function(_0x368d61){if(_0x368d61){return _0x368d61[_0xeb00('0xc1')](_0x126be6[_0xeb00('0x46')][_0xeb00('0x6c')])[_0xeb00('0x20')](function(){if(_[_0xeb00('0xc2')](_0x126be6[_0xeb00('0x46')]['ids'])){for(var _0x1a233d=0x0;_0x1a233d<_0x126be6['query'][_0xeb00('0x6c')][_0xeb00('0x49')];_0x1a233d+=0x1){socket['emit'](_0xeb00('0xc3'),{'UserId':Number(_0x126be6[_0xeb00('0x46')][_0xeb00('0x6c')][_0x1a233d]),'FaxAccountId':Number(_0x126be6[_0xeb00('0x58')]['id'])});}}else{socket[_0xeb00('0xbf')](_0xeb00('0xc3'),{'UserId':Number(_0x126be6[_0xeb00('0x46')][_0xeb00('0x6c')]),'FaxAccountId':Number(_0x126be6[_0xeb00('0x58')]['id'])});}});}})[_0xeb00('0x20')](respondWithStatusCode(_0xa4ffe2,null))[_0xeb00('0x2a')](handleError(_0xa4ffe2,null));};exports[_0xeb00('0xc4')]=function(_0x864e10,_0x592502,_0x4efeaf){var _0x302565={};var _0x17a143={};var _0x4e3619;var _0xe47f52;return db[_0xeb00('0x3c')][_0xeb00('0x6a')]({'where':{'id':_0x864e10[_0xeb00('0x58')]['id']}})[_0xeb00('0x20')](handleEntityNotFound(_0x592502,null))[_0xeb00('0x20')](function(_0x4f9162){if(_0x4f9162){_0x4e3619=_0x4f9162;_0x17a143[_0xeb00('0x41')]=_[_0xeb00('0x43')](db[_0xeb00('0x75')][_0xeb00('0x3d')]);_0x17a143[_0xeb00('0x46')]=_['keys'](_0x864e10['query']);_0x17a143['filters']=_[_0xeb00('0x45')](_0x17a143[_0xeb00('0x41')],_0x17a143[_0xeb00('0x46')]);_0x302565[_0xeb00('0x47')]=_[_0xeb00('0x45')](_0x17a143[_0xeb00('0x41')],qs[_0xeb00('0x48')](_0x864e10[_0xeb00('0x46')][_0xeb00('0x48')]));_0x302565[_0xeb00('0x47')]=_0x302565['attributes'][_0xeb00('0x49')]?_0x302565[_0xeb00('0x47')]:_0x17a143[_0xeb00('0x41')];_0x302565[_0xeb00('0x4c')]=qs['sort'](_0x864e10[_0xeb00('0x46')][_0xeb00('0x4d')]);_0x302565[_0xeb00('0x4e')]=qs[_0xeb00('0x44')](_['pick'](_0x864e10['query'],_0x17a143[_0xeb00('0x44')]));if(_0x864e10[_0xeb00('0x46')][_0xeb00('0x50')]){_0x302565[_0xeb00('0x4e')]=_[_0xeb00('0x51')](_0x302565[_0xeb00('0x4e')],{'$or':_[_0xeb00('0x42')](_0x302565[_0xeb00('0x47')],function(_0x108488){var _0x42829e={};_0x42829e[_0x108488]={'$like':'%'+_0x864e10[_0xeb00('0x46')][_0xeb00('0x50')]+'%'};return _0x42829e;})});}_0x302565=_[_0xeb00('0x51')]({},_0x302565,_0x864e10[_0xeb00('0x53')]);return _0x4e3619['getAgents'](_0x302565);}})[_0xeb00('0x20')](function(_0x4f90e1){if(_0x4f90e1){_0xe47f52=_0x4f90e1[_0xeb00('0x49')];if(!_0x864e10[_0xeb00('0x46')][_0xeb00('0x4a')](_0xeb00('0x4b'))){_0x302565['limit']=qs[_0xeb00('0x30')](_0x864e10['query'][_0xeb00('0x30')]);_0x302565['offset']=qs[_0xeb00('0x2e')](_0x864e10[_0xeb00('0x46')]['offset']);}return _0x4e3619['getAgents'](_0x302565);}})[_0xeb00('0x20')](function(_0x589799){if(_0x589799){return _0x589799?{'count':_0xe47f52,'rows':_0x589799}:null;}})[_0xeb00('0x20')](respondWithResult(_0x592502,null))[_0xeb00('0x2a')](handleError(_0x592502,null));}; \ No newline at end of file +var _0x012d=['redis','localhost','socket.io-emitter','register','jayson/promise','client','http','request','info','FaxAccount,\x20%s,\x20%s','debug','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','FaxAccounts','UserProfileResource','sendStatus','stack','name','send','index','Pause','mandatoryDispositionPause','map','FaxAccount','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','includeAll','rows','show','params','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','FaxAccountId','Disposition','getDispositions','findOne','filter','options','include','findAll','removeDispositions','addAnswer','CannedAnswer','removeAnswers','ids','addInteraction','FaxInteraction','omit','getInteractions','CmContact','Contact','User','Owner','fullname','internal','Tag','Tags','color','tag','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','findAndCountAll','priority','getApplications','context','from-voip-provider','exten','app','system','description','Fax\x20Extension','appdata','push','Answer','CDR(type)=inbound-fax','localstationid','gateway','faxdetect','headerinfo','maxrate','minrate','modem','t38timeout','Set','/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','VoiceExtension','bulkCreate','updateAccountApplications','createdAt','updatedAt','findById','getMessages','$gte','split','YYYY-MM-DD\x20HH:mm:ss','FaxMessage','CmList','List','Contacts','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','ListId','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Messages','Contact\x20not\x20found','spread','dataValues','SendFax','addAgents','emit','removeAgents','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults'];(function(_0x196d22,_0x2dedfa){var _0x33772e=function(_0x3055bd){while(--_0x3055bd){_0x196d22['push'](_0x196d22['shift']());}};_0x33772e(++_0x2dedfa);}(_0x012d,0x17c));var _0xd012=function(_0x2413da,_0x50643d){_0x2413da=_0x2413da-0x0;var _0x1eca6e=_0x012d[_0x2413da];return _0x1eca6e;};'use strict';var emlformat=require(_0xd012('0x0'));var rimraf=require(_0xd012('0x1'));var zipdir=require(_0xd012('0x2'));var jsonpatch=require(_0xd012('0x3'));var rp=require(_0xd012('0x4'));var moment=require(_0xd012('0x5'));var BPromise=require(_0xd012('0x6'));var Mustache=require(_0xd012('0x7'));var util=require(_0xd012('0x8'));var path=require(_0xd012('0x9'));var sox=require(_0xd012('0xa'));var csv=require(_0xd012('0xb'));var ejs=require(_0xd012('0xc'));var fs=require('fs');var fs_extra=require(_0xd012('0xd'));var _=require(_0xd012('0xe'));var squel=require('squel');var crypto=require(_0xd012('0xf'));var jsforce=require(_0xd012('0x10'));var deskjs=require(_0xd012('0x11'));var toCsv=require(_0xd012('0xb'));var querystring=require(_0xd012('0x12'));var Papa=require(_0xd012('0x13'));var Redis=require('ioredis');var authService=require(_0xd012('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd012('0x15'));var logger=require(_0xd012('0x16'))('api');var utils=require(_0xd012('0x17'));var config=require(_0xd012('0x18'));var licenseUtil=require(_0xd012('0x19'));var db=require(_0xd012('0x1a'))['db'];config['redis']=_[_0xd012('0x1b')](config[_0xd012('0x1c')],{'host':_0xd012('0x1d'),'port':0x18eb});var socket=require(_0xd012('0x1e'))(new Redis(config[_0xd012('0x1c')]));require('./faxAccount.socket')[_0xd012('0x1f')](socket);var jayson=require(_0xd012('0x20'));var client=jayson[_0xd012('0x21')][_0xd012('0x22')]({'port':0x232c});var client9002=jayson['client'][_0xd012('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x5a2060,_0x59e340,_0x414a9f,_0x39f439){return new BPromise(function(_0x3cf923,_0x125c54){var _0x25da26=_0x39f439||client;return _0x25da26[_0xd012('0x23')](_0x5a2060,_0x414a9f)['then'](function(_0x4f483a){logger[_0xd012('0x24')](_0xd012('0x25'),_0x59e340,'request\x20sent');logger[_0xd012('0x26')](_0xd012('0x27'),_0x59e340,_0xd012('0x28'),JSON[_0xd012('0x29')](_0x4f483a));if(_0x4f483a[_0xd012('0x2a')]){if(_0x4f483a[_0xd012('0x2a')]['code']===0x1f4){logger['error'](_0xd012('0x25'),_0x59e340,_0x4f483a['error'][_0xd012('0x2b')]);return _0x125c54(_0x4f483a[_0xd012('0x2a')]['message']);}logger[_0xd012('0x2a')](_0xd012('0x25'),_0x59e340,_0x4f483a[_0xd012('0x2a')][_0xd012('0x2b')]);return _0x3cf923(_0x4f483a[_0xd012('0x2a')][_0xd012('0x2b')]);}else{logger['info']('FaxAccount,\x20%s,\x20%s',_0x59e340,_0xd012('0x28'));_0x3cf923(_0x4f483a['result'][_0xd012('0x2b')]);}})[_0xd012('0x2c')](function(_0x4ae8bb){logger[_0xd012('0x2a')]('FaxAccount,\x20%s,\x20%s',_0x59e340,_0x4ae8bb);_0x125c54(_0x4ae8bb);});});}function respondWithStatusCode(_0x51c0c0,_0xdb2331){_0xdb2331=_0xdb2331||0xcc;return function(_0x4f9435){if(_0x4f9435){return _0x51c0c0['sendStatus'](_0xdb2331);}return _0x51c0c0[_0xd012('0x2d')](_0xdb2331)[_0xd012('0x2e')]();};}function respondWithResult(_0x37e4c3,_0xef53a2){_0xef53a2=_0xef53a2||0xc8;return function(_0x3553a9){if(_0x3553a9){return _0x37e4c3[_0xd012('0x2d')](_0xef53a2)[_0xd012('0x2f')](_0x3553a9);}};}function respondWithFilteredResult(_0xa9f763,_0x5189f8){return function(_0x51a45c){if(_0x51a45c){var _0xb0ff8f=typeof _0x5189f8[_0xd012('0x30')]===_0xd012('0x31')&&typeof _0x5189f8[_0xd012('0x32')]==='undefined';var _0x90c0d0=_0x51a45c[_0xd012('0x33')];var _0x300204=_0xb0ff8f?0x0:_0x5189f8[_0xd012('0x30')];var _0x13d8c6=_0xb0ff8f?_0x51a45c[_0xd012('0x33')]:_0x5189f8[_0xd012('0x30')]+_0x5189f8['limit'];var _0x49db7b;if(_0x13d8c6>=_0x90c0d0){_0x13d8c6=_0x90c0d0;_0x49db7b=0xc8;}else{_0x49db7b=0xce;}_0xa9f763[_0xd012('0x2d')](_0x49db7b);return _0xa9f763[_0xd012('0x34')](_0xd012('0x35'),_0x300204+'-'+_0x13d8c6+'/'+_0x90c0d0)[_0xd012('0x2f')](_0x51a45c);}return null;};}function patchUpdates(_0x1ef885){return function(_0x5bd89b){try{jsonpatch[_0xd012('0x36')](_0x5bd89b,_0x1ef885,!![]);}catch(_0x3957bd){return BPromise[_0xd012('0x37')](_0x3957bd);}return _0x5bd89b['save']();};}function saveUpdates(_0x184ada,_0x56c3fe){return function(_0x4ce875){if(_0x4ce875){return _0x4ce875[_0xd012('0x38')](_0x184ada)[_0xd012('0x39')](function(_0x280dca){return _0x280dca;});}return null;};}function removeEntity(_0x1e7e1c,_0x4a3b8c){return function(_0x3a259c){if(_0x3a259c){return _0x3a259c[_0xd012('0x3a')]()['then'](function(){var _0x8ed30c=_0x3a259c[_0xd012('0x3b')]({'plain':!![]});var _0x294446=_0xd012('0x3c');return db[_0xd012('0x3d')]['destroy']({'where':{'type':_0x294446,'resourceId':_0x8ed30c['id']}})[_0xd012('0x39')](function(){return _0x3a259c;});})['then'](function(){_0x1e7e1c[_0xd012('0x2d')](0xcc)[_0xd012('0x2e')]();});}};}function handleEntityNotFound(_0x25952c,_0x25b94c){return function(_0x58961b){if(!_0x58961b){_0x25952c[_0xd012('0x3e')](0x194);}return _0x58961b;};}function handleError(_0x3d88e9,_0x378d73){_0x378d73=_0x378d73||0x1f4;return function(_0x2877a9){logger[_0xd012('0x2a')](_0x2877a9[_0xd012('0x3f')]);if(_0x2877a9[_0xd012('0x40')]){delete _0x2877a9[_0xd012('0x40')];}_0x3d88e9[_0xd012('0x2d')](_0x378d73)[_0xd012('0x41')](_0x2877a9);};}exports[_0xd012('0x42')]=function(_0x2962d8,_0x335b0b){var _0x1bb6f9={'include':[{'model':db[_0xd012('0x43')],'as':_0xd012('0x44')}]},_0x4ce876={},_0x595241={'count':0x0,'rows':[]};var _0x4a4167=_[_0xd012('0x45')](db[_0xd012('0x46')][_0xd012('0x47')],function(_0x1a07b3){return{'name':_0x1a07b3[_0xd012('0x48')],'type':_0x1a07b3[_0xd012('0x49')][_0xd012('0x4a')]};});_0x4ce876['model']=_[_0xd012('0x45')](_0x4a4167,_0xd012('0x40'));_0x4ce876[_0xd012('0x4b')]=_[_0xd012('0x4c')](_0x2962d8[_0xd012('0x4b')]);_0x4ce876[_0xd012('0x4d')]=_[_0xd012('0x4e')](_0x4ce876[_0xd012('0x4f')],_0x4ce876['query']);_0x1bb6f9['attributes']=_['intersection'](_0x4ce876[_0xd012('0x4f')],qs[_0xd012('0x50')](_0x2962d8[_0xd012('0x4b')][_0xd012('0x50')]));_0x1bb6f9[_0xd012('0x51')]=_0x1bb6f9['attributes'][_0xd012('0x52')]?_0x1bb6f9[_0xd012('0x51')]:_0x4ce876[_0xd012('0x4f')];if(!_0x2962d8[_0xd012('0x4b')][_0xd012('0x53')](_0xd012('0x54'))){_0x1bb6f9[_0xd012('0x32')]=qs['limit'](_0x2962d8[_0xd012('0x4b')]['limit']);_0x1bb6f9['offset']=qs[_0xd012('0x30')](_0x2962d8[_0xd012('0x4b')][_0xd012('0x30')]);}_0x1bb6f9[_0xd012('0x55')]=qs[_0xd012('0x56')](_0x2962d8[_0xd012('0x4b')][_0xd012('0x56')]);_0x1bb6f9[_0xd012('0x57')]=qs[_0xd012('0x4d')](_[_0xd012('0x58')](_0x2962d8[_0xd012('0x4b')],_0x4ce876[_0xd012('0x4d')]),_0x4a4167);if(_0x2962d8[_0xd012('0x4b')]['filter']){_0x1bb6f9['where']=_[_0xd012('0x59')](_0x1bb6f9['where'],{'$or':_[_0xd012('0x45')](_0x4a4167,function(_0x56e1bc){if(_0x56e1bc[_0xd012('0x49')]!==_0xd012('0x5a')){var _0x297e38={};_0x297e38[_0x56e1bc[_0xd012('0x40')]]={'$like':'%'+_0x2962d8['query']['filter']+'%'};return _0x297e38;}})});}_0x1bb6f9=_[_0xd012('0x59')]({},_0x1bb6f9,_0x2962d8['options']);var _0x160774={'where':_0x1bb6f9[_0xd012('0x57')]};return db['FaxAccount']['count'](_0x160774)['then'](function(_0x21296a){_0x595241[_0xd012('0x33')]=_0x21296a;if(_0x2962d8[_0xd012('0x4b')][_0xd012('0x5b')]){_0x1bb6f9['include']=[{'all':!![]}];}return db[_0xd012('0x46')]['findAll'](_0x1bb6f9);})[_0xd012('0x39')](function(_0xf092e5){_0x595241[_0xd012('0x5c')]=_0xf092e5;return _0x595241;})[_0xd012('0x39')](respondWithFilteredResult(_0x335b0b,_0x1bb6f9))[_0xd012('0x2c')](handleError(_0x335b0b,null));};exports[_0xd012('0x5d')]=function(_0x77d6a,_0x3c321b){var _0x4f6471={'raw':![],'where':{'id':_0x77d6a[_0xd012('0x5e')]['id']},'include':[{'model':db['Pause'],'as':_0xd012('0x44')}]},_0x35f549={};_0x35f549['model']=_['keys'](db[_0xd012('0x46')]['rawAttributes']);_0x35f549[_0xd012('0x4b')]=_[_0xd012('0x4c')](_0x77d6a[_0xd012('0x4b')]);_0x35f549[_0xd012('0x4d')]=_['intersection'](_0x35f549['model'],_0x35f549[_0xd012('0x4b')]);_0x4f6471[_0xd012('0x51')]=_[_0xd012('0x4e')](_0x35f549['model'],qs[_0xd012('0x50')](_0x77d6a[_0xd012('0x4b')][_0xd012('0x50')]));_0x4f6471['attributes']=_0x4f6471['attributes'][_0xd012('0x52')]?_0x4f6471[_0xd012('0x51')]:_0x35f549['model'];if(_0x77d6a[_0xd012('0x4b')][_0xd012('0x5b')]){_0x4f6471['include']=[{'all':!![]}];}_0x4f6471=_[_0xd012('0x59')]({},_0x4f6471,_0x77d6a['options']);return db['FaxAccount'][_0xd012('0x5f')](_0x4f6471)[_0xd012('0x39')](handleEntityNotFound(_0x3c321b,null))['then'](respondWithResult(_0x3c321b,null))[_0xd012('0x2c')](handleError(_0x3c321b,null));};exports[_0xd012('0x60')]=function(_0x76c27c,_0x56a46f){return db[_0xd012('0x46')][_0xd012('0x60')](_0x76c27c[_0xd012('0x61')],{})[_0xd012('0x39')](function(_0x206982){var _0x390550=_0x76c27c[_0xd012('0x62')]['get']({'plain':!![]});if(!_0x390550)throw new Error(_0xd012('0x63'));if(_0x390550[_0xd012('0x64')]===_0xd012('0x62')){var _0x19053f=_0x206982['get']({'plain':!![]});var _0x41370b=_0xd012('0x3c');return db[_0xd012('0x65')][_0xd012('0x5f')]({'where':{'name':_0x41370b,'userProfileId':_0x390550[_0xd012('0x66')]},'raw':!![]})['then'](function(_0x481836){if(_0x481836&&_0x481836[_0xd012('0x67')]===0x0){return db[_0xd012('0x3d')][_0xd012('0x60')]({'name':_0x19053f[_0xd012('0x40')],'resourceId':_0x19053f['id'],'type':_0x481836[_0xd012('0x40')],'sectionId':_0x481836['id']},{})['then'](function(){return _0x206982;});}else{return _0x206982;}})[_0xd012('0x2c')](function(_0x40f2f6){logger[_0xd012('0x2a')](_0xd012('0x68'),_0x40f2f6);throw _0x40f2f6;});}return _0x206982;})[_0xd012('0x39')](respondWithResult(_0x56a46f,0xc9))[_0xd012('0x2c')](handleError(_0x56a46f,null));};exports['update']=function(_0x36653f,_0x4a0bbb){if(_0x36653f[_0xd012('0x61')]['id']){delete _0x36653f[_0xd012('0x61')]['id'];}return db['FaxAccount'][_0xd012('0x5f')]({'where':{'id':_0x36653f['params']['id']},'include':[{'model':db[_0xd012('0x43')],'as':_0xd012('0x44')}]})[_0xd012('0x39')](handleEntityNotFound(_0x4a0bbb,null))[_0xd012('0x39')](saveUpdates(_0x36653f['body'],null))[_0xd012('0x39')](respondWithResult(_0x4a0bbb,null))[_0xd012('0x2c')](handleError(_0x4a0bbb,null));};exports[_0xd012('0x3a')]=function(_0x2df783,_0x5bee7b){return db[_0xd012('0x46')][_0xd012('0x5f')]({'where':{'id':_0x2df783[_0xd012('0x5e')]['id']}})[_0xd012('0x39')](handleEntityNotFound(_0x5bee7b,null))[_0xd012('0x39')](removeEntity(_0x5bee7b,null))[_0xd012('0x2c')](handleError(_0x5bee7b,null));};exports[_0xd012('0x69')]=function(_0x3169df,_0x60a847){return db[_0xd012('0x46')][_0xd012('0x69')]()['then'](respondWithResult(_0x60a847,null))[_0xd012('0x2c')](handleError(_0x60a847,null));};exports['addDisposition']=function(_0x49dfd7,_0x53662e,_0xce2604){if(_0x49dfd7[_0xd012('0x61')]['id']){delete _0x49dfd7[_0xd012('0x61')]['id'];}return db[_0xd012('0x46')][_0xd012('0x5f')]({'where':{'id':_0x49dfd7['params']['id']}})[_0xd012('0x39')](handleEntityNotFound(_0x53662e,null))[_0xd012('0x39')](function(_0x592844){if(_0x592844){_0x49dfd7[_0xd012('0x61')][_0xd012('0x6a')]=_0x592844['id'];return db[_0xd012('0x6b')][_0xd012('0x60')](_0x49dfd7[_0xd012('0x61')]);}})[_0xd012('0x39')](respondWithResult(_0x53662e,null))[_0xd012('0x2c')](handleError(_0x53662e,null));};exports[_0xd012('0x6c')]=function(_0x149ead,_0x299b43,_0x5a0a83){var _0x25a38b={'raw':![],'where':{}};var _0x3c9975={};var _0x19716b={'count':0x0,'rows':[]};return db['FaxAccount'][_0xd012('0x6d')]({'where':{'id':_0x149ead[_0xd012('0x5e')]['id']}})[_0xd012('0x39')](handleEntityNotFound(_0x299b43,null))[_0xd012('0x39')](function(_0x30b075){if(_0x30b075){_0x3c9975[_0xd012('0x4f')]=_[_0xd012('0x4c')](db['Disposition']['rawAttributes']);_0x3c9975['query']=_[_0xd012('0x4c')](_0x149ead[_0xd012('0x4b')]);_0x3c9975[_0xd012('0x4d')]=_['intersection'](_0x3c9975[_0xd012('0x4f')],_0x3c9975[_0xd012('0x4b')]);_0x25a38b['attributes']=_[_0xd012('0x4e')](_0x3c9975[_0xd012('0x4f')],qs[_0xd012('0x50')](_0x149ead['query'][_0xd012('0x50')]));_0x25a38b[_0xd012('0x51')]=_0x25a38b['attributes'][_0xd012('0x52')]?_0x25a38b[_0xd012('0x51')]:_0x3c9975[_0xd012('0x4f')];if(!_0x149ead[_0xd012('0x4b')][_0xd012('0x53')](_0xd012('0x54'))){_0x25a38b['limit']=qs[_0xd012('0x32')](_0x149ead['query']['limit']);_0x25a38b['offset']=qs['offset'](_0x149ead[_0xd012('0x4b')][_0xd012('0x30')]);}_0x25a38b['order']=qs[_0xd012('0x56')](_0x149ead['query'][_0xd012('0x56')]);_0x25a38b['where']=qs[_0xd012('0x4d')](_[_0xd012('0x58')](_0x149ead[_0xd012('0x4b')],_0x3c9975[_0xd012('0x4d')]));_0x25a38b[_0xd012('0x57')][_0xd012('0x6a')]=_0x30b075['id'];if(_0x149ead[_0xd012('0x4b')][_0xd012('0x6e')]){_0x25a38b[_0xd012('0x57')]=_[_0xd012('0x59')](_0x25a38b[_0xd012('0x57')],{'$or':_[_0xd012('0x45')](_0x25a38b[_0xd012('0x51')],function(_0x262b1a){var _0x59e6e6={};_0x59e6e6[_0x262b1a]={'$like':'%'+_0x149ead[_0xd012('0x4b')][_0xd012('0x6e')]+'%'};return _0x59e6e6;})});}_0x25a38b=_[_0xd012('0x59')]({},_0x25a38b,_0x149ead[_0xd012('0x6f')]);return db['Disposition']['count']({'where':_0x25a38b['where']})[_0xd012('0x39')](function(_0x171615){_0x19716b[_0xd012('0x33')]=_0x171615;if(_0x149ead[_0xd012('0x4b')][_0xd012('0x5b')]){_0x25a38b[_0xd012('0x70')]=[{'all':!![]}];}return db[_0xd012('0x6b')][_0xd012('0x71')](_0x25a38b);})['then'](function(_0x1f21dc){_0x19716b[_0xd012('0x5c')]=_0x1f21dc;return _0x19716b;});}})[_0xd012('0x39')](respondWithFilteredResult(_0x299b43,_0x25a38b))[_0xd012('0x2c')](handleError(_0x299b43,null));};exports[_0xd012('0x72')]=function(_0x1e7c83,_0x5dfb41,_0x16b1a4){return db[_0xd012('0x46')][_0xd012('0x5f')]({'where':{'id':_0x1e7c83[_0xd012('0x5e')]['id']}})[_0xd012('0x39')](handleEntityNotFound(_0x5dfb41,null))['then'](function(_0x12f3d9){if(_0x12f3d9){return _0x12f3d9[_0xd012('0x72')](_0x1e7c83['query']['ids']);}})[_0xd012('0x39')](respondWithStatusCode(_0x5dfb41,null))[_0xd012('0x2c')](handleError(_0x5dfb41,null));};exports[_0xd012('0x73')]=function(_0x253258,_0x154a98,_0x29f7d5){if(_0x253258[_0xd012('0x61')]['id']){delete _0x253258[_0xd012('0x61')]['id'];}return db['FaxAccount'][_0xd012('0x5f')]({'where':{'id':_0x253258[_0xd012('0x5e')]['id']}})[_0xd012('0x39')](handleEntityNotFound(_0x154a98,null))[_0xd012('0x39')](function(_0x24967c){if(_0x24967c){_0x253258['body'][_0xd012('0x6a')]=_0x24967c['id'];return db[_0xd012('0x74')][_0xd012('0x60')](_0x253258[_0xd012('0x61')]);}})[_0xd012('0x39')](respondWithResult(_0x154a98,null))[_0xd012('0x2c')](handleError(_0x154a98,null));};exports['getAnswers']=function(_0xcd40e2,_0x3beb48,_0x2082c2){var _0x4d0e2d={'raw':![],'where':{}};var _0x40918c={};var _0x52fb20={'count':0x0,'rows':[]};return db[_0xd012('0x46')][_0xd012('0x6d')]({'where':{'id':_0xcd40e2['params']['id']}})[_0xd012('0x39')](handleEntityNotFound(_0x3beb48,null))[_0xd012('0x39')](function(_0x7625ca){if(_0x7625ca){_0x40918c[_0xd012('0x4f')]=_[_0xd012('0x4c')](db[_0xd012('0x74')][_0xd012('0x47')]);_0x40918c[_0xd012('0x4b')]=_[_0xd012('0x4c')](_0xcd40e2['query']);_0x40918c[_0xd012('0x4d')]=_[_0xd012('0x4e')](_0x40918c[_0xd012('0x4f')],_0x40918c[_0xd012('0x4b')]);_0x4d0e2d[_0xd012('0x51')]=_[_0xd012('0x4e')](_0x40918c[_0xd012('0x4f')],qs['fields'](_0xcd40e2[_0xd012('0x4b')][_0xd012('0x50')]));_0x4d0e2d[_0xd012('0x51')]=_0x4d0e2d[_0xd012('0x51')][_0xd012('0x52')]?_0x4d0e2d[_0xd012('0x51')]:_0x40918c[_0xd012('0x4f')];if(!_0xcd40e2['query'][_0xd012('0x53')](_0xd012('0x54'))){_0x4d0e2d[_0xd012('0x32')]=qs['limit'](_0xcd40e2[_0xd012('0x4b')][_0xd012('0x32')]);_0x4d0e2d[_0xd012('0x30')]=qs['offset'](_0xcd40e2['query'][_0xd012('0x30')]);}_0x4d0e2d[_0xd012('0x55')]=qs[_0xd012('0x56')](_0xcd40e2[_0xd012('0x4b')][_0xd012('0x56')]);_0x4d0e2d[_0xd012('0x57')]=qs[_0xd012('0x4d')](_['pick'](_0xcd40e2[_0xd012('0x4b')],_0x40918c['filters']));_0x4d0e2d['where'][_0xd012('0x6a')]=_0x7625ca['id'];if(_0xcd40e2[_0xd012('0x4b')][_0xd012('0x6e')]){_0x4d0e2d['where']=_['merge'](_0x4d0e2d['where'],{'$or':_[_0xd012('0x45')](_0x4d0e2d['attributes'],function(_0x45eadf){var _0x54eda8={};_0x54eda8[_0x45eadf]={'$like':'%'+_0xcd40e2['query']['filter']+'%'};return _0x54eda8;})});}_0x4d0e2d=_[_0xd012('0x59')]({},_0x4d0e2d,_0xcd40e2[_0xd012('0x6f')]);return db[_0xd012('0x74')][_0xd012('0x33')]({'where':_0x4d0e2d[_0xd012('0x57')]})[_0xd012('0x39')](function(_0x4b9e9b){_0x52fb20[_0xd012('0x33')]=_0x4b9e9b;if(_0xcd40e2['query'][_0xd012('0x5b')]){_0x4d0e2d[_0xd012('0x70')]=[{'all':!![]}];}return db[_0xd012('0x74')]['findAll'](_0x4d0e2d);})[_0xd012('0x39')](function(_0x46e173){_0x52fb20[_0xd012('0x5c')]=_0x46e173;return _0x52fb20;});}})['then'](respondWithFilteredResult(_0x3beb48,_0x4d0e2d))[_0xd012('0x2c')](handleError(_0x3beb48,null));};exports['removeAnswers']=function(_0x9f39d0,_0x84c82,_0x568e4e){return db[_0xd012('0x46')][_0xd012('0x5f')]({'where':{'id':_0x9f39d0[_0xd012('0x5e')]['id']}})[_0xd012('0x39')](handleEntityNotFound(_0x84c82,null))['then'](function(_0x4afc45){if(_0x4afc45){return _0x4afc45[_0xd012('0x75')](_0x9f39d0['query'][_0xd012('0x76')]);}})['then'](respondWithStatusCode(_0x84c82,null))[_0xd012('0x2c')](handleError(_0x84c82,null));};exports[_0xd012('0x77')]=function(_0x4f26be,_0x169f7b,_0x51c4f6){return db[_0xd012('0x78')][_0xd012('0x5f')]({'where':{'id':_0x4f26be[_0xd012('0x5e')]['id']}})[_0xd012('0x39')](handleEntityNotFound(_0x169f7b,null))[_0xd012('0x39')](function(_0x3c9eae){if(_0x3c9eae){return _0x3c9eae[_0xd012('0x77')](_0x4f26be[_0xd012('0x61')][_0xd012('0x76')],_[_0xd012('0x79')](_0x4f26be[_0xd012('0x61')],['ids','id'])||{});}})[_0xd012('0x39')](respondWithResult(_0x169f7b,null))['catch'](handleError(_0x169f7b,null));};exports[_0xd012('0x7a')]=function(_0x22c2bd,_0x27cbf3,_0x148883){var _0x26f38b={'raw':![],'where':{}};var _0x96d91b={};var _0x6c14f4={'count':0x0,'rows':[]};return db[_0xd012('0x46')][_0xd012('0x6d')]({'where':{'id':_0x22c2bd['params']['id']}})['then'](handleEntityNotFound(_0x27cbf3,null))[_0xd012('0x39')](function(_0xce05de){if(_0xce05de){_0x96d91b[_0xd012('0x4f')]=_['keys'](db[_0xd012('0x78')][_0xd012('0x47')]);_0x96d91b['query']=_[_0xd012('0x4c')](_0x22c2bd[_0xd012('0x4b')]);_0x96d91b['filters']=_['intersection'](_0x96d91b['model'],_0x96d91b[_0xd012('0x4b')]);_0x26f38b[_0xd012('0x51')]=_[_0xd012('0x4e')](_0x96d91b[_0xd012('0x4f')],qs[_0xd012('0x50')](_0x22c2bd[_0xd012('0x4b')][_0xd012('0x50')]));_0x26f38b[_0xd012('0x51')]=_0x26f38b[_0xd012('0x51')]['length']?_0x26f38b[_0xd012('0x51')]:_0x96d91b[_0xd012('0x4f')];if(!_0x22c2bd[_0xd012('0x4b')]['hasOwnProperty'](_0xd012('0x54'))){_0x26f38b[_0xd012('0x32')]=qs['limit'](_0x22c2bd[_0xd012('0x4b')][_0xd012('0x32')]);_0x26f38b[_0xd012('0x30')]=qs['offset'](_0x22c2bd[_0xd012('0x4b')]['offset']);}_0x26f38b[_0xd012('0x55')]=qs[_0xd012('0x56')](_0x22c2bd[_0xd012('0x4b')][_0xd012('0x56')]);_0x26f38b[_0xd012('0x57')]=qs[_0xd012('0x4d')](_[_0xd012('0x58')](_0x22c2bd[_0xd012('0x4b')],_0x96d91b[_0xd012('0x4d')]));_0x26f38b[_0xd012('0x57')]['FaxAccountId']=_0xce05de['id'];if(_0x22c2bd[_0xd012('0x4b')]['filter']){_0x26f38b[_0xd012('0x57')]=_[_0xd012('0x59')](_0x26f38b[_0xd012('0x57')],{'$or':_[_0xd012('0x45')](_0x26f38b['attributes'],function(_0x3da515){var _0x334499={};_0x334499[_0x3da515]={'$like':'%'+_0x22c2bd[_0xd012('0x4b')][_0xd012('0x6e')]+'%'};return _0x334499;})});}_0x26f38b=_[_0xd012('0x59')]({},_0x26f38b,_0x22c2bd[_0xd012('0x6f')]);return db[_0xd012('0x78')][_0xd012('0x33')]({'where':_0x26f38b['where']})['then'](function(_0x27b094){_0x6c14f4[_0xd012('0x33')]=_0x27b094;if(_0x22c2bd[_0xd012('0x4b')][_0xd012('0x5b')]){_0x26f38b['include']=[{'model':db[_0xd012('0x7b')],'as':_0xd012('0x7c'),'required':![]},{'model':db[_0xd012('0x7d')],'as':_0xd012('0x7e'),'attributes':['name',_0xd012('0x7f'),_0xd012('0x80')],'required':![]},{'model':db[_0xd012('0x81')],'as':_0xd012('0x82'),'attributes':['id','name',_0xd012('0x83')],'where':_0x22c2bd[_0xd012('0x4b')]['tag']?{'id':_0x22c2bd[_0xd012('0x4b')][_0xd012('0x84')]}:undefined,'required':_0x22c2bd[_0xd012('0x4b')][_0xd012('0x84')]?!![]:![]}];}return db['FaxInteraction'][_0xd012('0x71')](_0x26f38b);})[_0xd012('0x39')](function(_0x376a2d){_0x6c14f4[_0xd012('0x5c')]=_0x376a2d;return _0x6c14f4;});}})[_0xd012('0x39')](respondWithFilteredResult(_0x27cbf3,_0x26f38b))[_0xd012('0x2c')](handleError(_0x27cbf3,null));};exports['addApplications']=function(_0x5e9519,_0x302a77){var _0x2a7ff5=_0x5e9519[_0xd012('0x5e')]['id'];var _0x2ccfc2=_0x5e9519['body'];var _0x1a70ff=0xc8;var _0x54dc9c=null;return db[_0xd012('0x85')][_0xd012('0x86')]({'isolationLevel':db['sequelize'][_0xd012('0x87')][_0xd012('0x88')][_0xd012('0x89')]},function(_0x42d9a3){return db[_0xd012('0x46')]['findOne']({'where':{'id':_0x2a7ff5},'transaction':_0x42d9a3})[_0xd012('0x39')](function(_0x5b1f6e){if(_0x5b1f6e){return db[_0xd012('0x8a')]['destroy']({'where':{'FaxAccountId':_0x2a7ff5},'transaction':_0x42d9a3})[_0xd012('0x39')](function(){var _0x48c87a=_[_0xd012('0x45')](_0x2ccfc2,function(_0x920938){_0x920938[_0xd012('0x6a')]=_0x2a7ff5;return _0x920938;});return db[_0xd012('0x8a')]['bulkCreate'](_0x48c87a,{'transaction':_0x42d9a3});});}else{_0x1a70ff=0x194;_0x54dc9c=[];}});})[_0xd012('0x39')](function(){if(_0x1a70ff!==0x194){return db[_0xd012('0x8a')][_0xd012('0x8b')]({'where':{'FaxAccountId':_0x2a7ff5},'order':_0xd012('0x8c')})['then'](function(_0x778e0d){_0x54dc9c=_0x778e0d;});}})[_0xd012('0x2c')](function(_0x1a6a07){_0x1a70ff=0x1f4;logger[_0xd012('0x2a')](_0x1a6a07[_0xd012('0x3f')]);if(_0x1a6a07['name']){delete _0x1a6a07[_0xd012('0x40')];}_0x54dc9c=_0x1a6a07;})['finally'](function(){if(_0x54dc9c===null){_0x302a77['sendStatus'](_0x1a70ff);}else{if(_0x1a70ff===0x1f4){_0x302a77[_0xd012('0x2d')](_0x1a70ff)[_0xd012('0x41')](_0x54dc9c);}else{_0x302a77[_0xd012('0x2d')](_0x1a70ff)[_0xd012('0x2f')](_0x54dc9c);}}});};exports[_0xd012('0x8d')]=function(_0x4fd3c7,_0x138aa0,_0x4a76d6){var _0x5ea944={};var _0x111a03={};var _0x423af1;var _0x84e84b;return db[_0xd012('0x46')]['findOne']({'where':{'id':_0x4fd3c7[_0xd012('0x5e')]['id']}})[_0xd012('0x39')](handleEntityNotFound(_0x138aa0,null))[_0xd012('0x39')](function(_0x403ba9){if(_0x403ba9){_0x423af1=_0x403ba9;_0x111a03[_0xd012('0x4f')]=_[_0xd012('0x4c')](db[_0xd012('0x8a')]['rawAttributes']);_0x111a03[_0xd012('0x4b')]=_[_0xd012('0x4c')](_0x4fd3c7[_0xd012('0x4b')]);_0x111a03[_0xd012('0x4d')]=_[_0xd012('0x4e')](_0x111a03[_0xd012('0x4f')],_0x111a03['query']);_0x5ea944[_0xd012('0x51')]=_[_0xd012('0x4e')](_0x111a03[_0xd012('0x4f')],qs[_0xd012('0x50')](_0x4fd3c7[_0xd012('0x4b')][_0xd012('0x50')]));_0x5ea944[_0xd012('0x51')]=_0x5ea944['attributes'][_0xd012('0x52')]?_0x5ea944[_0xd012('0x51')]:_0x111a03[_0xd012('0x4f')];_0x5ea944[_0xd012('0x55')]=qs['sort'](_0x4fd3c7[_0xd012('0x4b')][_0xd012('0x56')]);_0x5ea944[_0xd012('0x57')]=qs[_0xd012('0x4d')](_[_0xd012('0x58')](_0x4fd3c7[_0xd012('0x4b')],_0x111a03[_0xd012('0x4d')]));if(_0x4fd3c7[_0xd012('0x4b')]['filter']){_0x5ea944[_0xd012('0x57')]=_[_0xd012('0x59')](_0x5ea944[_0xd012('0x57')],{'$or':_['map'](_0x5ea944['attributes'],function(_0x110632){var _0x24c286={};_0x24c286[_0x110632]={'$like':'%'+_0x4fd3c7[_0xd012('0x4b')][_0xd012('0x6e')]+'%'};return _0x24c286;})});}_0x5ea944=_[_0xd012('0x59')]({},_0x5ea944,_0x4fd3c7['options']);return _0x423af1[_0xd012('0x8d')](_0x5ea944);}})[_0xd012('0x39')](function(_0xf8270c){if(_0xf8270c){_0x84e84b=_0xf8270c[_0xd012('0x52')];if(!_0x4fd3c7[_0xd012('0x4b')]['hasOwnProperty'](_0xd012('0x54'))){_0x5ea944['limit']=qs[_0xd012('0x32')](_0x4fd3c7[_0xd012('0x4b')][_0xd012('0x32')]);_0x5ea944[_0xd012('0x30')]=qs[_0xd012('0x30')](_0x4fd3c7['query']['offset']);}return _0x423af1[_0xd012('0x8d')](_0x5ea944);}})[_0xd012('0x39')](function(_0x4f6407){if(_0x4f6407){return _0x4f6407?{'count':_0x84e84b,'rows':_0x4f6407}:null;}})[_0xd012('0x39')](respondWithResult(_0x138aa0,null))[_0xd012('0x2c')](handleError(_0x138aa0,null));};function Extension(_0x5a66f2,_0xa98fd6,_0x49ad91,_0x129f73){this[_0xd012('0x8e')]=_0xd012('0x8f');this[_0xd012('0x90')]=_0x5a66f2['localstationid'];this[_0xd012('0x91')]=_0x129f73;this[_0xd012('0x49')]=_0xd012('0x92');this[_0xd012('0x93')]=_0xd012('0x94');this[_0xd012('0x6a')]=_0x5a66f2['id'];this['priority']=_0xa98fd6;this[_0xd012('0x95')]=_0x49ad91;}function createExtensionsReciveFax(_0x598bb9){var _0x3b980b=0x1;var _0x46aef9=[];_0x46aef9[_0xd012('0x96')](new Extension(_0x598bb9,_0x3b980b,'',_0xd012('0x97')));_0x3b980b+=0x1;_0x46aef9[_0xd012('0x96')](new Extension(_0x598bb9,_0x3b980b,_0xd012('0x98'),'Set'));_0x3b980b+=0x1;for(var _0x2f9abd in _0x598bb9){if(_0x598bb9[_0xd012('0x53')](_0x2f9abd)&&(_0x2f9abd==='ecm'||_0x2f9abd===_0xd012('0x99')||_0x2f9abd===_0xd012('0x9a')||_0x2f9abd===_0xd012('0x9b')||_0x2f9abd===_0xd012('0x9c')||_0x2f9abd===_0xd012('0x9d')||_0x2f9abd===_0xd012('0x9e')||_0x2f9abd===_0xd012('0x9f')||_0x2f9abd===_0xd012('0xa0'))){_0x46aef9['push'](new Extension(_0x598bb9,_0x3b980b,'FAXOPT('+_0x2f9abd+')='+_0x598bb9[_0x2f9abd],_0xd012('0xa1')));_0x3b980b+=0x1;}}_0x46aef9[_0xd012('0x96')](new Extension(_0x598bb9,_0x3b980b,'6','Wait'));_0x3b980b+=0x1;_0x46aef9[_0xd012('0x96')](new Extension(_0x598bb9,_0x3b980b,_0xd012('0xa2'),_0xd012('0xa3')));_0x3b980b=0x0;return _0x46aef9;}exports[_0xd012('0xa4')]=function(_0x29fb74,_0x1da3ea,_0x41a0eb){var _0x571ba6;return db[_0xd012('0x85')][_0xd012('0x86')](function(_0xecfbd1){return db['FaxAccount'][_0xd012('0x60')](_0x29fb74[_0xd012('0x61')],{'transaction':_0xecfbd1})[_0xd012('0x39')](function(_0x2eb475){_0x571ba6=_0x2eb475['get']({'plain':!![]});return db[_0xd012('0xa5')][_0xd012('0xa6')](createExtensionsReciveFax(_0x571ba6),{'transaction':_0xecfbd1});});})[_0xd012('0x39')](function(){return _0x571ba6;})['then'](respondWithResult(_0x1da3ea,null))['catch'](handleError(_0x1da3ea,null));};exports[_0xd012('0xa7')]=function(_0x181148,_0x115765,_0x195ab1){var _0x2a0ec4;return db[_0xd012('0x85')][_0xd012('0x86')](function(_0x234f27){return db['FaxAccount'][_0xd012('0x38')](_0x181148[_0xd012('0x61')],{'where':{'id':_0x181148[_0xd012('0x61')]['id']},'transaction':_0x234f27})[_0xd012('0x39')](function(_0x45a410){return db[_0xd012('0xa5')][_0xd012('0x3a')]({'where':{'FaxAccountId':_0x181148[_0xd012('0x61')]['id']},'transaction':_0x234f27})[_0xd012('0x39')](function(_0x2fdc75){return db[_0xd012('0xa5')][_0xd012('0xa6')](createExtensionsReciveFax(_[_0xd012('0x79')](_0x181148[_0xd012('0x61')],['tech',_0xd012('0x4a'),_0xd012('0xa8'),_0xd012('0xa9'),'TrunkId','ListId'])),{'transaction':_0x234f27});});});})['then'](function(){return db['FaxAccount'][_0xd012('0xaa')](_0x181148[_0xd012('0x61')]['id']);})[_0xd012('0x39')](respondWithResult(_0x115765,null))[_0xd012('0x2c')](handleError(_0x115765,null));};exports[_0xd012('0xab')]=function(_0x260f21,_0x2f4f1d,_0x397738){var _0x41980c={'raw':!![],'where':{}};var _0x54ec3c={};var _0x6c6dd5={'count':0x0,'rows':[]};return db[_0xd012('0x46')][_0xd012('0x6d')]({'where':{'id':_0x260f21[_0xd012('0x5e')]['id']}})[_0xd012('0x39')](handleEntityNotFound(_0x2f4f1d,null))['then'](function(_0x272288){if(_0x272288){_0x54ec3c['model']=_[_0xd012('0x4c')](db['FaxMessage']['rawAttributes']);_0x54ec3c[_0xd012('0x4b')]=_[_0xd012('0x4c')](_0x260f21['query']);_0x54ec3c['filters']=_['intersection'](_0x54ec3c[_0xd012('0x4f')],_0x54ec3c[_0xd012('0x4b')]);_0x41980c['attributes']=_[_0xd012('0x4e')](_0x54ec3c['model'],qs[_0xd012('0x50')](_0x260f21[_0xd012('0x4b')][_0xd012('0x50')]));_0x41980c[_0xd012('0x51')]=_0x41980c['attributes'][_0xd012('0x52')]?_0x41980c[_0xd012('0x51')]:_0x54ec3c['model'];if(!_0x260f21['query']['hasOwnProperty'](_0xd012('0x54'))){_0x41980c[_0xd012('0x32')]=qs[_0xd012('0x32')](_0x260f21[_0xd012('0x4b')][_0xd012('0x32')]);_0x41980c['offset']=qs[_0xd012('0x30')](_0x260f21[_0xd012('0x4b')][_0xd012('0x30')]);}_0x41980c[_0xd012('0x55')]=qs[_0xd012('0x56')](_0x260f21[_0xd012('0x4b')]['sort']);_0x41980c[_0xd012('0x57')]=qs[_0xd012('0x4d')](_[_0xd012('0x58')](_0x260f21['query'],_0x54ec3c[_0xd012('0x4d')]));_0x41980c[_0xd012('0x57')][_0xd012('0x6a')]=_0x272288['id'];if(_0x260f21[_0xd012('0x4b')][_0xd012('0x6e')]){_0x41980c[_0xd012('0x57')]=_[_0xd012('0x59')](_0x41980c[_0xd012('0x57')],{'$or':_[_0xd012('0x45')](_0x41980c[_0xd012('0x51')],function(_0x3c5ec0){var _0x34afaa={};_0x34afaa[_0x3c5ec0]={'$like':'%'+_0x260f21[_0xd012('0x4b')][_0xd012('0x6e')]+'%'};return _0x34afaa;})});}if(_0x260f21[_0xd012('0x4b')][_0xd012('0xac')]){var _0x2e5c44=_0x260f21[_0xd012('0x4b')][_0xd012('0xac')][_0xd012('0xad')](',');var _0xbe86ce={};_0xbe86ce[_0x2e5c44[0x0]]={'$gte':moment(_0x2e5c44[0x1])['format'](_0xd012('0xae'))};_0x41980c['where']=_[_0xd012('0x59')](_0x41980c['where'],_0xbe86ce);}_0x41980c=_[_0xd012('0x59')]({},_0x41980c,_0x260f21[_0xd012('0x6f')]);return db[_0xd012('0xaf')][_0xd012('0x33')]({'where':_0x41980c['where']})[_0xd012('0x39')](function(_0x5e1bf0){_0x6c6dd5[_0xd012('0x33')]=_0x5e1bf0;if(_0x260f21['query'][_0xd012('0x5b')]){_0x41980c[_0xd012('0x70')]=[{'all':!![]}];}return db[_0xd012('0xaf')][_0xd012('0x71')](_0x41980c);})[_0xd012('0x39')](function(_0x3eb13f){_0x6c6dd5[_0xd012('0x5c')]=_0x3eb13f;return _0x6c6dd5;});}})[_0xd012('0x39')](respondWithFilteredResult(_0x2f4f1d,_0x41980c))[_0xd012('0x2c')](handleError(_0x2f4f1d,null));};exports[_0xd012('0x41')]=function(_0x48cd7a,_0x49df37,_0x1a8a99){var _0x27c1ac,_0x48d0fd={},_0x201a9b;if(_0x48cd7a['body']['to']){_0x201a9b=_0x48cd7a[_0xd012('0x61')]['to'][0x0];}return db[_0xd012('0x46')]['find']({'where':{'id':_0x48cd7a[_0xd012('0x5e')]['id']},'include':[{'model':db[_0xd012('0xb0')],'as':_0xd012('0xb1'),'include':[{'model':db[_0xd012('0x7b')],'as':_0xd012('0xb2'),'where':{'fax':_0x201a9b},'limit':0x1,'order':[[_0xd012('0xa9'),'DESC']]}]}]})[_0xd012('0x39')](handleEntityNotFound(_0x49df37,null))[_0xd012('0x39')](function(_0x2fa102){_0x27c1ac=_0x2fa102;if(_0x48cd7a[_0xd012('0x61')]['attachments']&&_0x48cd7a[_0xd012('0x61')]['attachments'][_0xd012('0x52')]){for(var _0x1b372b=0x0;_0x1b372b<_0x48cd7a['body'][_0xd012('0xb3')][_0xd012('0x52')];_0x1b372b+=0x1){_0x48cd7a['body'][_0xd012('0xb3')][_0x1b372b]={'filename':_0x48cd7a['body'][_0xd012('0xb3')][_0x1b372b]['name'],'id':_0x48cd7a[_0xd012('0x61')][_0xd012('0xb3')][_0x1b372b]['id'],'path':path[_0xd012('0xb4')](config[_0xd012('0xb5')],_0xd012('0xb6'),_0x48cd7a['body'][_0xd012('0xb3')][_0x1b372b][_0xd012('0xb7')])};}}return respondWithRpcPromise(_0xd012('0xb8'),_0xd012('0xb8'),{'FaxAccountId':_['isNil'](_0x48cd7a['params']['id'])?undefined:_0x48cd7a[_0xd012('0x5e')]['id'],'path':_['isNil'](_0x48cd7a[_0xd012('0x61')]['attachments'][0x0][_0xd012('0x9')])?undefined:_0x48cd7a[_0xd012('0x61')][_0xd012('0xb3')][0x0][_0xd012('0x9')],'fax':_['isNil'](_0x48cd7a['body']['to'][0x0])?undefined:_0x48cd7a['body']['to'][0x0]},client9002);})[_0xd012('0x39')](function(){if(_0x27c1ac){if(_[_0xd012('0xb9')](_0x48cd7a[_0xd012('0x61')][_0xd012('0xba')])){_0x48cd7a[_0xd012('0x61')]['from']=util['format'](_0xd012('0xbb'),_0x27c1ac[_0xd012('0x40')],_0x27c1ac[_0xd012('0xbc')]);}if(_0x27c1ac[_0xd012('0xb1')]){if(_0x27c1ac[_0xd012('0xb1')][_0xd012('0xb2')][_0xd012('0x52')]){return _0x27c1ac['List'][_0xd012('0xb2')][0x0];}else{return db['CmContact'][_0xd012('0x60')](_[_0xd012('0x1b')](_0x48cd7a[_0xd012('0x61')],{'firstName':_0x48cd7a[_0xd012('0x61')]['to'][0x0],'phone':_0x48cd7a[_0xd012('0x61')]['to'][0x0],'fax':_0x48cd7a[_0xd012('0x61')]['to'][0x0],'ListId':_0x27c1ac[_0xd012('0xbd')]}));}}else{throw new Error(_0xd012('0xbe'));}}else{throw new Error(_0xd012('0xbf'));}})[_0xd012('0x39')](function(_0x5457a9){if(_0x5457a9){return db[_0xd012('0x78')]['find']({'where':{'ContactId':_0x5457a9['id'],'closed':![],'FaxAccountId':_0x27c1ac['id']}})[_0xd012('0x39')](function(_0x210a6f){if(_0x210a6f){return[_0x210a6f,![]];}return db['FaxInteraction']['create']({'UserId':_0x48cd7a['user']['id'],'ContactId':_0x5457a9['id'],'FaxAccountId':_0x27c1ac['id'],'fax':_0x48cd7a[_0xd012('0x61')]['to'][0x0],'firstMsgDirection':_0xd012('0xc0'),'Messages':[_[_0xd012('0x59')](_0x48cd7a[_0xd012('0x61')],{'read':![],'body':_0x48cd7a['body'][_0xd012('0xb3')][0x0][_0xd012('0xc1')],'FaxAccountId':_0x27c1ac['id'],'UserId':_0x48cd7a[_0xd012('0x62')]['id'],'ContactId':_0x5457a9['id'],'AttachmentId':_0x48cd7a[_0xd012('0x61')][_0xd012('0xb3')][0x0]['id']})]},{'include':[{'model':db[_0xd012('0xaf')],'as':_0xd012('0xc2')}]})[_0xd012('0x39')](function(_0x50f116){return[_0x50f116,!![]];});});}else{throw new Error(_0xd012('0xc3'));}})[_0xd012('0xc4')](function(_0x25d841,_0x5de891){if(_0x5de891){return _0x25d841;}return db[_0xd012('0xaf')][_0xd012('0x60')]({'direction':_0xd012('0xc0'),'read':![],'body':_0x48cd7a[_0xd012('0x61')][_0xd012('0xb3')][0x0][_0xd012('0xc1')],'FaxAccountId':_0x27c1ac['id'],'FaxInteractionId':_0x25d841['id'],'UserId':_0x48cd7a['user']['id'],'ContactId':_0x25d841['ContactId'],'AttachmentId':_0x48cd7a[_0xd012('0x61')][_0xd012('0xb3')][0x0]['id']})[_0xd012('0x39')](function(_0x3861a6){_0x25d841[_0xd012('0xc5')][_0xd012('0xc2')]=[];_0x25d841[_0xd012('0xc5')][_0xd012('0xc2')][_0xd012('0x96')](_0x3861a6[_0xd012('0xc5')]);return _0x25d841;});})['then'](function(_0xa34356){respondWithRpcPromise('SendFax',_0xd012('0xc6'),{'FaxAccountId':_[_0xd012('0xb9')](_0x48cd7a[_0xd012('0x5e')]['id'])?undefined:_0x48cd7a[_0xd012('0x5e')]['id'],'path':_['isNil'](_0x48cd7a[_0xd012('0x61')][_0xd012('0xb3')][0x0][_0xd012('0x9')])?undefined:_0x48cd7a['body'][_0xd012('0xb3')][0x0][_0xd012('0x9')],'fax':_['isNil'](_0x48cd7a[_0xd012('0x61')]['to'][0x0])?undefined:_0x48cd7a[_0xd012('0x61')]['to'][0x0],'AttachmentId':_0x48cd7a[_0xd012('0x61')]['attachments'][0x0]['id']},client9002)[_0xd012('0x39')](function(_0x18957d){logger[_0xd012('0x24')]('SendFaxRpc,\x20%s',_0x18957d);})[_0xd012('0x2c')](function(_0x35a497){logger[_0xd012('0x24')]('SendFaxRpc,\x20%s',_0x35a497);});return _0xa34356;})[_0xd012('0x39')](respondWithResult(_0x49df37,null))['catch'](handleError(_0x49df37,null));};exports[_0xd012('0xc7')]=function(_0x3512ea,_0x4d26e3,_0x1fafa7){return db[_0xd012('0x46')][_0xd012('0x5f')]({'where':{'id':_0x3512ea[_0xd012('0x5e')]['id']}})['then'](handleEntityNotFound(_0x4d26e3,null))[_0xd012('0x39')](function(_0x406dc7){if(_0x406dc7){return _0x406dc7[_0xd012('0xc7')](_0x3512ea[_0xd012('0x61')]['ids'],_[_0xd012('0x79')](_0x3512ea[_0xd012('0x61')],[_0xd012('0x76'),'id'])||{})[_0xd012('0xc4')](function(_0x900088){for(var _0x86f362=0x0;_0x86f362<_0x3512ea['body']['ids'][_0xd012('0x52')];_0x86f362+=0x1){socket[_0xd012('0xc8')]('userFaxAccount:save',{'UserId':Number(_0x3512ea[_0xd012('0x61')][_0xd012('0x76')][_0x86f362]),'FaxAccountId':Number(_0x3512ea['params']['id'])});}return _0x900088;});}})[_0xd012('0x39')](respondWithResult(_0x4d26e3,null))[_0xd012('0x2c')](handleError(_0x4d26e3,null));};exports[_0xd012('0xc9')]=function(_0x27943a,_0x3c6c33,_0x4b690f){return db[_0xd012('0x46')][_0xd012('0x5f')]({'where':{'id':_0x27943a[_0xd012('0x5e')]['id']}})[_0xd012('0x39')](handleEntityNotFound(_0x3c6c33,null))[_0xd012('0x39')](function(_0x5794cd){if(_0x5794cd){return _0x5794cd[_0xd012('0xc9')](_0x27943a[_0xd012('0x4b')][_0xd012('0x76')])[_0xd012('0x39')](function(){if(_[_0xd012('0xca')](_0x27943a[_0xd012('0x4b')][_0xd012('0x76')])){for(var _0x473ad1=0x0;_0x473ad1<_0x27943a[_0xd012('0x4b')]['ids'][_0xd012('0x52')];_0x473ad1+=0x1){socket[_0xd012('0xc8')]('userFaxAccount:remove',{'UserId':Number(_0x27943a[_0xd012('0x4b')]['ids'][_0x473ad1]),'FaxAccountId':Number(_0x27943a['params']['id'])});}}else{socket[_0xd012('0xc8')]('userFaxAccount:remove',{'UserId':Number(_0x27943a[_0xd012('0x4b')]['ids']),'FaxAccountId':Number(_0x27943a[_0xd012('0x5e')]['id'])});}});}})[_0xd012('0x39')](respondWithStatusCode(_0x3c6c33,null))[_0xd012('0x2c')](handleError(_0x3c6c33,null));};exports['getAgents']=function(_0x1b6c3e,_0x5ad09b,_0x8bd018){var _0x2a65e9={};var _0x13b465={};var _0x27280c;var _0xca1168;return db[_0xd012('0x46')][_0xd012('0x6d')]({'where':{'id':_0x1b6c3e[_0xd012('0x5e')]['id']}})[_0xd012('0x39')](handleEntityNotFound(_0x5ad09b,null))[_0xd012('0x39')](function(_0x10302d){if(_0x10302d){_0x27280c=_0x10302d;_0x13b465[_0xd012('0x4f')]=_[_0xd012('0x4c')](db[_0xd012('0x7d')][_0xd012('0x47')]);_0x13b465['query']=_[_0xd012('0x4c')](_0x1b6c3e['query']);_0x13b465[_0xd012('0x4d')]=_[_0xd012('0x4e')](_0x13b465[_0xd012('0x4f')],_0x13b465[_0xd012('0x4b')]);_0x2a65e9[_0xd012('0x51')]=_[_0xd012('0x4e')](_0x13b465[_0xd012('0x4f')],qs[_0xd012('0x50')](_0x1b6c3e['query'][_0xd012('0x50')]));_0x2a65e9[_0xd012('0x51')]=_0x2a65e9['attributes']['length']?_0x2a65e9['attributes']:_0x13b465['model'];_0x2a65e9[_0xd012('0x55')]=qs[_0xd012('0x56')](_0x1b6c3e[_0xd012('0x4b')][_0xd012('0x56')]);_0x2a65e9[_0xd012('0x57')]=qs['filters'](_[_0xd012('0x58')](_0x1b6c3e[_0xd012('0x4b')],_0x13b465['filters']));if(_0x1b6c3e[_0xd012('0x4b')][_0xd012('0x6e')]){_0x2a65e9[_0xd012('0x57')]=_[_0xd012('0x59')](_0x2a65e9['where'],{'$or':_['map'](_0x2a65e9[_0xd012('0x51')],function(_0x1bfd8d){var _0x150f70={};_0x150f70[_0x1bfd8d]={'$like':'%'+_0x1b6c3e['query'][_0xd012('0x6e')]+'%'};return _0x150f70;})});}_0x2a65e9=_['merge']({},_0x2a65e9,_0x1b6c3e[_0xd012('0x6f')]);return _0x27280c['getAgents'](_0x2a65e9);}})[_0xd012('0x39')](function(_0x22167c){if(_0x22167c){_0xca1168=_0x22167c[_0xd012('0x52')];if(!_0x1b6c3e[_0xd012('0x4b')]['hasOwnProperty'](_0xd012('0x54'))){_0x2a65e9[_0xd012('0x32')]=qs[_0xd012('0x32')](_0x1b6c3e[_0xd012('0x4b')]['limit']);_0x2a65e9[_0xd012('0x30')]=qs[_0xd012('0x30')](_0x1b6c3e[_0xd012('0x4b')][_0xd012('0x30')]);}return _0x27280c[_0xd012('0xcb')](_0x2a65e9);}})[_0xd012('0x39')](function(_0x3c6386){if(_0x3c6386){return _0x3c6386?{'count':_0xca1168,'rows':_0x3c6386}:null;}})['then'](respondWithResult(_0x5ad09b,null))['catch'](handleError(_0x5ad09b,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index c7278a3..d80a194 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 _0x3609=['save','update','remove','hook','exports','events','../../mysqldb','FaxAccount','setMaxListeners'];(function(_0x53b0be,_0x54cd5f){var _0x22712c=function(_0x10966d){while(--_0x10966d){_0x53b0be['push'](_0x53b0be['shift']());}};_0x22712c(++_0x54cd5f);}(_0x3609,0x101));var _0x9360=function(_0xb28e63,_0x4b1981){_0xb28e63=_0xb28e63-0x0;var _0x596d0f=_0x3609[_0xb28e63];return _0x596d0f;};'use strict';var EventEmitter=require(_0x9360('0x0'));var FaxAccount=require(_0x9360('0x1'))['db'][_0x9360('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x9360('0x3')](0x0);var events={'afterCreate':_0x9360('0x4'),'afterUpdate':_0x9360('0x5'),'afterDestroy':_0x9360('0x6')};function emitEvent(_0x577c1d){return function(_0x28376e,_0x24c531,_0x22133a){FaxAccountEvents['emit'](_0x577c1d+':'+_0x28376e['id'],_0x28376e);FaxAccountEvents['emit'](_0x577c1d,_0x28376e);_0x22133a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount[_0x9360('0x7')](e,emitEvent(event));}}module[_0x9360('0x8')]=FaxAccountEvents; \ No newline at end of file +var _0x3d70=['setMaxListeners','update','emit','hasOwnProperty','hook','exports','../../mysqldb','FaxAccount'];(function(_0x4cee98,_0x4a1580){var _0x3e3a10=function(_0x31b2b7){while(--_0x31b2b7){_0x4cee98['push'](_0x4cee98['shift']());}};_0x3e3a10(++_0x4a1580);}(_0x3d70,0xf6));var _0x03d7=function(_0x56a871,_0x18b7fe){_0x56a871=_0x56a871-0x0;var _0x124954=_0x3d70[_0x56a871];return _0x124954;};'use strict';var EventEmitter=require('events');var FaxAccount=require(_0x03d7('0x0'))['db'][_0x03d7('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x03d7('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x03d7('0x3'),'afterDestroy':'remove'};function emitEvent(_0x2eb3c3){return function(_0x3c0942,_0x5b1209,_0xe56609){FaxAccountEvents['emit'](_0x2eb3c3+':'+_0x3c0942['id'],_0x3c0942);FaxAccountEvents[_0x03d7('0x4')](_0x2eb3c3,_0x3c0942);_0xe56609(null);};}for(var e in events){if(events[_0x03d7('0x5')](e)){var event=events[e];FaxAccount[_0x03d7('0x6')](e,emitEvent(event));}}module[_0x03d7('0x7')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index ff032fe..452ac4a 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 _0xa03b=['define','FaxAccount','fax_accounts','lodash','util','../../config/logger','api','path','./faxAccount.attributes','exports'];(function(_0x1ed952,_0xcbca17){var _0x1ef805=function(_0x16b49f){while(--_0x16b49f){_0x1ed952['push'](_0x1ed952['shift']());}};_0x1ef805(++_0xcbca17);}(_0xa03b,0xad));var _0xba03=function(_0x39bc44,_0x1d4373){_0x39bc44=_0x39bc44-0x0;var _0x2916d8=_0xa03b[_0x39bc44];return _0x2916d8;};'use strict';var _=require(_0xba03('0x0'));var util=require(_0xba03('0x1'));var logger=require(_0xba03('0x2'))(_0xba03('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xba03('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xba03('0x5'));module[_0xba03('0x6')]=function(_0x15585a,_0x527224){return _0x15585a[_0xba03('0x7')](_0xba03('0x8'),attributes,{'tableName':_0xba03('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x43ec=['moment','request-promise','path','rimraf','../../config/environment','define','FaxAccount','fax_accounts','lodash','util','../../config/logger','api'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x43ec,0x1e8));var _0xc43e=function(_0x502f1b,_0x393700){_0x502f1b=_0x502f1b-0x0;var _0x127687=_0x43ec[_0x502f1b];return _0x127687;};'use strict';var _=require(_0xc43e('0x0'));var util=require(_0xc43e('0x1'));var logger=require(_0xc43e('0x2'))(_0xc43e('0x3'));var moment=require(_0xc43e('0x4'));var BPromise=require('bluebird');var rp=require(_0xc43e('0x5'));var fs=require('fs');var path=require(_0xc43e('0x6'));var rimraf=require(_0xc43e('0x7'));var config=require(_0xc43e('0x8'));var attributes=require('./faxAccount.attributes');module['exports']=function(_0x59c2cc,_0x26b033){return _0x59c2cc[_0xc43e('0x9')](_0xc43e('0xa'),attributes,{'tableName':_0xc43e('0xb'),'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 1b84702..550fcb4 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 _0x8073=['raw','limit','include','map','attributes','model','GetFaxAccount','NotifyFaxAccount','body','fax','CmContact','describe','then','ValidationError','difference','keys','createdAt','updatedAt','CompanyId','ListId','isNil','from','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','CmList','List','FaxApplication','Applications','account','applications','orderBy','priority','length','Contacts','create','contact','FaxInteraction','find','Contact\x20not\x20found','push','close','unmanaged','*,*,*,*','created','interaction','FaxMessage','ContactId','AttachmentId','UserId','name','agent','waitForTheAssignedAgent','Start','startRouting','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','request','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','FaxAccount','findAll','options'];(function(_0x2c1818,_0x1e360c){var _0x907722=function(_0x11b0fc){while(--_0x11b0fc){_0x2c1818['push'](_0x2c1818['shift']());}};_0x907722(++_0x1e360c);}(_0x8073,0x94));var _0x3807=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x8073[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0x3807('0x0'));var util=require(_0x3807('0x1'));var moment=require(_0x3807('0x2'));var BPromise=require(_0x3807('0x3'));var rs=require(_0x3807('0x4'));var fs=require('fs');var Redis=require(_0x3807('0x5'));var db=require(_0x3807('0x6'))['db'];var utils=require(_0x3807('0x7'));var logger=require(_0x3807('0x8'))(_0x3807('0x9'));var config=require(_0x3807('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x3807('0xb')]['http']({'port':0x232c});config[_0x3807('0xc')]=_[_0x3807('0xd')](config['redis'],{'host':_0x3807('0xe'),'port':0x18eb});var socket=require(_0x3807('0xf'))(new Redis(config[_0x3807('0xc')]));require(_0x3807('0x10'))[_0x3807('0x11')](socket);function respondWithRpcPromise(_0xf2c679,_0x28e439,_0x524713){return new BPromise(function(_0x556df5,_0x5439e9){return client[_0x3807('0x12')](_0xf2c679,_0x524713)['then'](function(_0x52eadf){logger[_0x3807('0x13')](_0x3807('0x14'),_0x28e439,_0x3807('0x15'));logger[_0x3807('0x16')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x28e439,_0x3807('0x15'),JSON[_0x3807('0x17')](_0x52eadf));if(_0x52eadf[_0x3807('0x18')]){if(_0x52eadf[_0x3807('0x18')][_0x3807('0x19')]===0x1f4){logger[_0x3807('0x18')](_0x3807('0x14'),_0x28e439,_0x52eadf[_0x3807('0x18')][_0x3807('0x1a')]);return _0x5439e9(_0x52eadf[_0x3807('0x18')][_0x3807('0x1a')]);}logger['error'](_0x3807('0x14'),_0x28e439,_0x52eadf['error'][_0x3807('0x1a')]);return _0x556df5(_0x52eadf[_0x3807('0x18')]['message']);}else{logger[_0x3807('0x13')](_0x3807('0x14'),_0x28e439,'request\x20sent');_0x556df5(_0x52eadf[_0x3807('0x1b')][_0x3807('0x1a')]);}})[_0x3807('0x1c')](function(_0x19f094){logger[_0x3807('0x18')](_0x3807('0x14'),_0x28e439,_0x19f094);_0x5439e9(_0x19f094);});});}exports['GetFaxAccount']=function(_0x2b24c5){var _0x593737=this;return new Promise(function(_0x4eaa15,_0x300ea8){return db[_0x3807('0x1d')][_0x3807('0x1e')]({'raw':_0x2b24c5[_0x3807('0x1f')]?_0x2b24c5[_0x3807('0x1f')][_0x3807('0x20')]===undefined?!![]:![]:!![],'where':_0x2b24c5[_0x3807('0x1f')]?_0x2b24c5[_0x3807('0x1f')]['where']||null:null,'attributes':_0x2b24c5[_0x3807('0x1f')]?_0x2b24c5[_0x3807('0x1f')]['attributes']||null:null,'limit':_0x2b24c5[_0x3807('0x1f')]?_0x2b24c5['options'][_0x3807('0x21')]||null:null,'include':_0x2b24c5[_0x3807('0x1f')]?_0x2b24c5[_0x3807('0x1f')][_0x3807('0x22')]?_[_0x3807('0x23')](_0x2b24c5[_0x3807('0x1f')][_0x3807('0x22')],function(_0x437128){return{'model':db[_0x437128['model']],'as':_0x437128['as'],'attributes':_0x437128[_0x3807('0x24')],'include':_0x437128['include']?_['map'](_0x437128['include'],function(_0x30c4aa){return{'model':db[_0x30c4aa[_0x3807('0x25')]],'as':_0x30c4aa['as'],'attributes':_0x30c4aa[_0x3807('0x24')],'include':_0x30c4aa['include']?_['map'](_0x30c4aa[_0x3807('0x22')],function(_0x401ce1){return{'model':db[_0x401ce1[_0x3807('0x25')]],'as':_0x401ce1['as'],'attributes':_0x401ce1['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5e35ba){logger[_0x3807('0x13')](_0x3807('0x26'),_0x2b24c5);logger[_0x3807('0x16')]('GetFaxAccount',_0x2b24c5,JSON[_0x3807('0x17')](_0x5e35ba));_0x4eaa15(_0x5e35ba);})[_0x3807('0x1c')](function(_0x358405){logger[_0x3807('0x18')](_0x3807('0x26'),_0x358405[_0x3807('0x1a')],_0x2b24c5);_0x300ea8(_0x593737[_0x3807('0x18')](0x1f4,_0x358405[_0x3807('0x1a')]));});});};exports[_0x3807('0x27')]=function(_0x1af34e,_0x5dd814,_0x51ae83){var _0x5b04f4=this;return new Promise(function(_0x119a7c,_0x49d580){var _0x387a22={'body':_0x1af34e[_0x3807('0x28')],'channel':_0x3807('0x29')};var _0x407833=[];var _0x3116b5=[];var _0x1f97c7={};return db[_0x3807('0x2a')][_0x3807('0x2b')]()[_0x3807('0x2c')](function(_0x334800){if(!_0x334800){throw new db['Sequelize'][(_0x3807('0x2d'))]('no\x20available\x20attributes');}_0x407833=_[_0x3807('0x2e')](_[_0x3807('0x2f')](_0x334800),[_0x3807('0x30'),_0x3807('0x31')]);_0x3116b5=_[_0x3807('0x2e')](_[_0x3807('0x2f')](_0x334800),[_0x3807('0x30'),_0x3807('0x31'),_0x3807('0x32'),_0x3807('0x33')]);if(_0x1af34e['body']['id']){delete _0x1af34e['body']['id'];}if(_[_0x3807('0x34')](_0x1af34e['body'][_0x3807('0x35')])){throw new db[(_0x3807('0x36'))][(_0x3807('0x2d'))](_0x3807('0x37'));}if(_[_0x3807('0x34')](_0x1af34e[_0x3807('0x28')][_0x3807('0x28')])||_0x1af34e[_0x3807('0x28')][_0x3807('0x28')]===''){throw new db[(_0x3807('0x36'))][(_0x3807('0x2d'))](_0x3807('0x38'));}if(_[_0x3807('0x34')](_0x1af34e[_0x3807('0x28')]['mapKey'])){throw new db[(_0x3807('0x36'))][(_0x3807('0x2d'))](_0x3807('0x39')+_0x3116b5);}if(!_['includes'](_0x3116b5,_0x1af34e[_0x3807('0x28')]['mapKey'])){throw new db[(_0x3807('0x36'))][(_0x3807('0x2d'))](_0x3807('0x3a')+_0x3116b5);}_0x1f97c7[_0x1af34e[_0x3807('0x28')][_0x3807('0x3b')]]=_0x1af34e[_0x3807('0x28')][_0x3807('0x35')];})[_0x3807('0x2c')](function(){return db[_0x3807('0x1d')]['find']({'where':{'id':_0x1af34e['account']['id']},'include':[{'model':db[_0x3807('0x3c')],'as':_0x3807('0x3d'),'include':[{'model':db[_0x3807('0x2a')],'as':'Contacts','where':_0x1f97c7,'limit':0x1,'order':[[_0x3807('0x31'),'DESC']]}]},{'model':db[_0x3807('0x3e')],'as':_0x3807('0x3f')}]});})[_0x3807('0x2c')](function(_0x50ce18){if(_0x50ce18&&_0x50ce18[_0x3807('0x3d')]){var _0x15d07d=_0x50ce18['get']({'plain':!![]});_0x387a22[_0x3807('0x40')]=_0x15d07d;_0x387a22[_0x3807('0x41')]=_0x15d07d['Applications'];_0x387a22['list']=_0x15d07d[_0x3807('0x3d')];_0x387a22[_0x3807('0x41')]=_[_0x3807('0x42')](_0x387a22[_0x3807('0x41')],[_0x3807('0x43')],['asc']);if(_0x387a22[_0x3807('0x40')][_0x3807('0x3f')]){delete _0x387a22[_0x3807('0x40')][_0x3807('0x3f')];}if(_0x387a22[_0x3807('0x40')]['List']&&_0x387a22[_0x3807('0x40')]['List']['Contacts'][_0x3807('0x44')]){return _0x387a22[_0x3807('0x40')][_0x3807('0x3d')][_0x3807('0x45')][0x0];}var _0x465bf0=_['defaults'](_0x1af34e[_0x3807('0x28')],{'firstName':_0x1af34e[_0x3807('0x28')][_0x3807('0x35')],'ListId':_0x15d07d[_0x3807('0x33')]});_0x465bf0[_0x1af34e['body'][_0x3807('0x3b')]]=_0x1af34e[_0x3807('0x28')]['from'];return db[_0x3807('0x2a')][_0x3807('0x46')](_0x465bf0,{'fields':_0x407833,'raw':!![]});}})[_0x3807('0x2c')](function(_0x2ec9ec){_0x387a22[_0x3807('0x47')]=_0x2ec9ec;if(_0x2ec9ec){var _0x41a15e={'ContactId':_0x2ec9ec['id'],'FaxAccountId':_0x1af34e['account']['id'],'fax':_0x2ec9ec[_0x3807('0x29')]};return db[_0x3807('0x48')][_0x3807('0x49')]({'where':{'ContactId':_0x2ec9ec['id'],'closed':![],'FaxAccountId':_0x1af34e['account']['id']}})['then'](function(_0x5b7803){if(_0x5b7803){return[_0x5b7803,![]];}return db[_0x3807('0x48')][_0x3807('0x46')](_0x41a15e)[_0x3807('0x2c')](function(_0x3d84b1){return[_0x3d84b1,!![]];});});}else{throw new Error(_0x3807('0x4a'));}})['spread'](function(_0x5ddc59,_0x4d8fd4){var _0x49cc43=_0x5ddc59['get']({'plain':!![]});if(_0x4d8fd4){if(_0x387a22[_0x3807('0x40')]['autoclose']){_0x387a22[_0x3807('0x41')][_0x3807('0x4b')]({'id':0x0,'priority':_0x387a22[_0x3807('0x41')][_0x3807('0x44')]+0x1,'app':_0x3807('0x4c'),'appdata':_0x3807('0x4d'),'interval':_0x3807('0x4e')});}_0x49cc43[_0x3807('0x4f')]=!![];}else{_0x49cc43['created']=![];}_0x387a22[_0x3807('0x50')]=_0x49cc43;return db[_0x3807('0x51')]['create']({'body':_0x1af34e[_0x3807('0x28')][_0x3807('0x28')],'FaxAccountId':_0x1af34e[_0x3807('0x40')]['id'],'FaxInteractionId':_0x5ddc59['id'],'direction':'in','ContactId':_0x5ddc59[_0x3807('0x52')],'AttachmentId':_0x1af34e[_0x3807('0x28')][_0x3807('0x53')]});})['then'](function(_0x565337){_0x387a22[_0x3807('0x1a')]=_0x565337;if(_0x387a22['interaction'][_0x3807('0x54')]){return db['User'][_0x3807('0x49')]({'attributes':['id',_0x3807('0x55')],'where':{'id':_0x387a22[_0x3807('0x50')]['UserId']}})[_0x3807('0x2c')](function(_0x2cba80){if(_0x2cba80){_0x387a22[_0x3807('0x41')]['unshift']({'id':0x0,'priority':0x0,'app':_0x3807('0x56'),'appdata':_0x2cba80[_0x3807('0x55')]+','+(_0x387a22[_0x3807('0x40')][_0x3807('0x57')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x3807('0x58'),_0x3807('0x59'),_0x387a22);});}return respondWithRpcPromise(_0x3807('0x58'),_0x3807('0x59'),_0x387a22);})[_0x3807('0x2c')](function(_0x371af3){_0x119a7c(_0x371af3);})[_0x3807('0x1c')](function(_0x3b1ebe){_0x49d580(_0x5b04f4[_0x3807('0x18')](0x1f4,_0x3b1ebe['message']));});});}; \ No newline at end of file +var _0x58b8=['AttachmentId','UserId','User','name','unshift','agent','Start','startRouting','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','./faxAccount.socket','register','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetFaxAccount','FaxAccount','findAll','options','raw','where','attributes','limit','include','model','map','stringify','body','fax','Sequelize','ValidationError','difference','createdAt','updatedAt','CompanyId','ListId','from','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','CmList','List','CmContact','Contacts','DESC','FaxApplication','Applications','get','account','list','applications','orderBy','priority','asc','length','create','contact','FaxInteraction','Contact\x20not\x20found','spread','autoclose','push','unmanaged','*,*,*,*','created','interaction','FaxMessage','ContactId'];(function(_0x3c9162,_0x1c9e16){var _0x3aba04=function(_0x620e0){while(--_0x620e0){_0x3c9162['push'](_0x3c9162['shift']());}};_0x3aba04(++_0x1c9e16);}(_0x58b8,0x11f));var _0x858b=function(_0x5bfb78,_0x22e3ff){_0x5bfb78=_0x5bfb78-0x0;var _0x4efd00=_0x58b8[_0x5bfb78];return _0x4efd00;};'use strict';var _=require(_0x858b('0x0'));var util=require(_0x858b('0x1'));var moment=require(_0x858b('0x2'));var BPromise=require(_0x858b('0x3'));var rs=require(_0x858b('0x4'));var fs=require('fs');var Redis=require(_0x858b('0x5'));var db=require(_0x858b('0x6'))['db'];var utils=require(_0x858b('0x7'));var logger=require(_0x858b('0x8'))(_0x858b('0x9'));var config=require(_0x858b('0xa'));var jayson=require(_0x858b('0xb'));var client=jayson[_0x858b('0xc')][_0x858b('0xd')]({'port':0x232c});config[_0x858b('0xe')]=_[_0x858b('0xf')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x858b('0xe')]));require(_0x858b('0x10'))[_0x858b('0x11')](socket);function respondWithRpcPromise(_0x38876b,_0x3fd80a,_0x5ce695){return new BPromise(function(_0x6d8d66,_0xfcda55){return client[_0x858b('0x12')](_0x38876b,_0x5ce695)[_0x858b('0x13')](function(_0x8ffffa){logger[_0x858b('0x14')](_0x858b('0x15'),_0x3fd80a,_0x858b('0x16'));logger['debug']('FaxAccount,\x20%s,\x20%s,\x20%s',_0x3fd80a,_0x858b('0x16'),JSON['stringify'](_0x8ffffa));if(_0x8ffffa['error']){if(_0x8ffffa[_0x858b('0x17')][_0x858b('0x18')]===0x1f4){logger[_0x858b('0x17')]('FaxAccount,\x20%s,\x20%s',_0x3fd80a,_0x8ffffa[_0x858b('0x17')]['message']);return _0xfcda55(_0x8ffffa[_0x858b('0x17')][_0x858b('0x19')]);}logger[_0x858b('0x17')](_0x858b('0x15'),_0x3fd80a,_0x8ffffa['error'][_0x858b('0x19')]);return _0x6d8d66(_0x8ffffa[_0x858b('0x17')][_0x858b('0x19')]);}else{logger['info'](_0x858b('0x15'),_0x3fd80a,_0x858b('0x16'));_0x6d8d66(_0x8ffffa[_0x858b('0x1a')]['message']);}})[_0x858b('0x1b')](function(_0x9545f7){logger[_0x858b('0x17')](_0x858b('0x15'),_0x3fd80a,_0x9545f7);_0xfcda55(_0x9545f7);});});}exports[_0x858b('0x1c')]=function(_0x35fc18){var _0x39d6d8=this;return new Promise(function(_0x4770cc,_0xd6b6e){return db[_0x858b('0x1d')][_0x858b('0x1e')]({'raw':_0x35fc18[_0x858b('0x1f')]?_0x35fc18['options'][_0x858b('0x20')]===undefined?!![]:![]:!![],'where':_0x35fc18[_0x858b('0x1f')]?_0x35fc18[_0x858b('0x1f')][_0x858b('0x21')]||null:null,'attributes':_0x35fc18[_0x858b('0x1f')]?_0x35fc18['options'][_0x858b('0x22')]||null:null,'limit':_0x35fc18[_0x858b('0x1f')]?_0x35fc18[_0x858b('0x1f')][_0x858b('0x23')]||null:null,'include':_0x35fc18['options']?_0x35fc18[_0x858b('0x1f')][_0x858b('0x24')]?_['map'](_0x35fc18[_0x858b('0x1f')][_0x858b('0x24')],function(_0x31caf3){return{'model':db[_0x31caf3[_0x858b('0x25')]],'as':_0x31caf3['as'],'attributes':_0x31caf3['attributes'],'include':_0x31caf3['include']?_['map'](_0x31caf3[_0x858b('0x24')],function(_0x427e84){return{'model':db[_0x427e84[_0x858b('0x25')]],'as':_0x427e84['as'],'attributes':_0x427e84[_0x858b('0x22')],'include':_0x427e84[_0x858b('0x24')]?_[_0x858b('0x26')](_0x427e84[_0x858b('0x24')],function(_0x1e323c){return{'model':db[_0x1e323c[_0x858b('0x25')]],'as':_0x1e323c['as'],'attributes':_0x1e323c[_0x858b('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2cf540){logger[_0x858b('0x14')](_0x858b('0x1c'),_0x35fc18);logger['debug'](_0x858b('0x1c'),_0x35fc18,JSON[_0x858b('0x27')](_0x2cf540));_0x4770cc(_0x2cf540);})[_0x858b('0x1b')](function(_0x13d704){logger['error'](_0x858b('0x1c'),_0x13d704[_0x858b('0x19')],_0x35fc18);_0xd6b6e(_0x39d6d8['error'](0x1f4,_0x13d704[_0x858b('0x19')]));});});};exports['NotifyFaxAccount']=function(_0x395701,_0x287aba,_0x308fb6){var _0x4a9fbc=this;return new Promise(function(_0x275c4c,_0x8bb772){var _0x133468={'body':_0x395701[_0x858b('0x28')],'channel':_0x858b('0x29')};var _0xb6b575=[];var _0x597d64=[];var _0x8dee7f={};return db['CmContact']['describe']()[_0x858b('0x13')](function(_0x520af3){if(!_0x520af3){throw new db[(_0x858b('0x2a'))][(_0x858b('0x2b'))]('no\x20available\x20attributes');}_0xb6b575=_[_0x858b('0x2c')](_['keys'](_0x520af3),[_0x858b('0x2d'),'updatedAt']);_0x597d64=_[_0x858b('0x2c')](_['keys'](_0x520af3),[_0x858b('0x2d'),_0x858b('0x2e'),_0x858b('0x2f'),_0x858b('0x30')]);if(_0x395701[_0x858b('0x28')]['id']){delete _0x395701[_0x858b('0x28')]['id'];}if(_['isNil'](_0x395701[_0x858b('0x28')][_0x858b('0x31')])){throw new db[(_0x858b('0x2a'))][(_0x858b('0x2b'))](_0x858b('0x32'));}if(_[_0x858b('0x33')](_0x395701['body'][_0x858b('0x28')])||_0x395701[_0x858b('0x28')]['body']===''){throw new db[(_0x858b('0x2a'))][(_0x858b('0x2b'))](_0x858b('0x34'));}if(_[_0x858b('0x33')](_0x395701[_0x858b('0x28')][_0x858b('0x35')])){throw new db['Sequelize'][(_0x858b('0x2b'))](_0x858b('0x36')+_0x597d64);}if(!_['includes'](_0x597d64,_0x395701[_0x858b('0x28')][_0x858b('0x35')])){throw new db[(_0x858b('0x2a'))][(_0x858b('0x2b'))](_0x858b('0x37')+_0x597d64);}_0x8dee7f[_0x395701['body']['mapKey']]=_0x395701[_0x858b('0x28')][_0x858b('0x31')];})[_0x858b('0x13')](function(){return db[_0x858b('0x1d')][_0x858b('0x38')]({'where':{'id':_0x395701['account']['id']},'include':[{'model':db[_0x858b('0x39')],'as':_0x858b('0x3a'),'include':[{'model':db[_0x858b('0x3b')],'as':_0x858b('0x3c'),'where':_0x8dee7f,'limit':0x1,'order':[[_0x858b('0x2e'),_0x858b('0x3d')]]}]},{'model':db[_0x858b('0x3e')],'as':_0x858b('0x3f')}]});})[_0x858b('0x13')](function(_0x5e8543){if(_0x5e8543&&_0x5e8543['List']){var _0x3c88cc=_0x5e8543[_0x858b('0x40')]({'plain':!![]});_0x133468[_0x858b('0x41')]=_0x3c88cc;_0x133468['applications']=_0x3c88cc['Applications'];_0x133468[_0x858b('0x42')]=_0x3c88cc['List'];_0x133468[_0x858b('0x43')]=_[_0x858b('0x44')](_0x133468['applications'],[_0x858b('0x45')],[_0x858b('0x46')]);if(_0x133468['account']['Applications']){delete _0x133468[_0x858b('0x41')][_0x858b('0x3f')];}if(_0x133468[_0x858b('0x41')][_0x858b('0x3a')]&&_0x133468[_0x858b('0x41')][_0x858b('0x3a')][_0x858b('0x3c')][_0x858b('0x47')]){return _0x133468['account'][_0x858b('0x3a')][_0x858b('0x3c')][0x0];}var _0x307c37=_['defaults'](_0x395701[_0x858b('0x28')],{'firstName':_0x395701['body'][_0x858b('0x31')],'ListId':_0x3c88cc[_0x858b('0x30')]});_0x307c37[_0x395701[_0x858b('0x28')][_0x858b('0x35')]]=_0x395701[_0x858b('0x28')]['from'];return db[_0x858b('0x3b')][_0x858b('0x48')](_0x307c37,{'fields':_0xb6b575,'raw':!![]});}})[_0x858b('0x13')](function(_0x30f541){_0x133468[_0x858b('0x49')]=_0x30f541;if(_0x30f541){var _0x55e9a0={'ContactId':_0x30f541['id'],'FaxAccountId':_0x395701['account']['id'],'fax':_0x30f541[_0x858b('0x29')]};return db['FaxInteraction'][_0x858b('0x38')]({'where':{'ContactId':_0x30f541['id'],'closed':![],'FaxAccountId':_0x395701[_0x858b('0x41')]['id']}})[_0x858b('0x13')](function(_0x35511f){if(_0x35511f){return[_0x35511f,![]];}return db[_0x858b('0x4a')][_0x858b('0x48')](_0x55e9a0)['then'](function(_0x3a49f3){return[_0x3a49f3,!![]];});});}else{throw new Error(_0x858b('0x4b'));}})[_0x858b('0x4c')](function(_0x4d6213,_0x464d7f){var _0x31ee0b=_0x4d6213[_0x858b('0x40')]({'plain':!![]});if(_0x464d7f){if(_0x133468[_0x858b('0x41')][_0x858b('0x4d')]){_0x133468['applications'][_0x858b('0x4e')]({'id':0x0,'priority':_0x133468['applications'][_0x858b('0x47')]+0x1,'app':'close','appdata':_0x858b('0x4f'),'interval':_0x858b('0x50')});}_0x31ee0b[_0x858b('0x51')]=!![];}else{_0x31ee0b[_0x858b('0x51')]=![];}_0x133468[_0x858b('0x52')]=_0x31ee0b;return db[_0x858b('0x53')][_0x858b('0x48')]({'body':_0x395701[_0x858b('0x28')][_0x858b('0x28')],'FaxAccountId':_0x395701['account']['id'],'FaxInteractionId':_0x4d6213['id'],'direction':'in','ContactId':_0x4d6213[_0x858b('0x54')],'AttachmentId':_0x395701[_0x858b('0x28')][_0x858b('0x55')]});})['then'](function(_0x36df2b){_0x133468['message']=_0x36df2b;if(_0x133468[_0x858b('0x52')][_0x858b('0x56')]){return db[_0x858b('0x57')][_0x858b('0x38')]({'attributes':['id',_0x858b('0x58')],'where':{'id':_0x133468['interaction'][_0x858b('0x56')]}})['then'](function(_0x284a98){if(_0x284a98){_0x133468[_0x858b('0x43')][_0x858b('0x59')]({'id':0x0,'priority':0x0,'app':_0x858b('0x5a'),'appdata':_0x284a98['name']+','+(_0x133468[_0x858b('0x41')]['waitForTheAssignedAgent']||0xa),'interval':_0x858b('0x50')});}return respondWithRpcPromise(_0x858b('0x5b'),_0x858b('0x5c'),_0x133468);});}return respondWithRpcPromise(_0x858b('0x5b'),_0x858b('0x5c'),_0x133468);})[_0x858b('0x13')](function(_0x51704c){_0x275c4c(_0x51704c);})[_0x858b('0x1b')](function(_0x131360){_0x8bb772(_0x4a9fbc[_0x858b('0x17')](0x1f4,_0x131360[_0x858b('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index cf22927..4bbc322 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 _0xf94f=['register','length','faxAccount:','./faxAccount.events','remove','update','emit','removeListener'];(function(_0x55cf08,_0x187024){var _0x5b8ddd=function(_0x4df428){while(--_0x4df428){_0x55cf08['push'](_0x55cf08['shift']());}};_0x5b8ddd(++_0x187024);}(_0xf94f,0x1d3));var _0xff94=function(_0x14cfe4,_0x5f0cc7){_0x14cfe4=_0x14cfe4-0x0;var _0x26463c=_0xf94f[_0x14cfe4];return _0x26463c;};'use strict';var FaxAccountEvents=require(_0xff94('0x0'));var events=['save',_0xff94('0x1'),_0xff94('0x2')];function createListener(_0x41a3b2,_0x4c0c70){return function(_0xdd89b3){_0x4c0c70[_0xff94('0x3')](_0x41a3b2,_0xdd89b3);};}function removeListener(_0x47f5af,_0x59886c){return function(){FaxAccountEvents[_0xff94('0x4')](_0x47f5af,_0x59886c);};}exports[_0xff94('0x5')]=function(_0x4817fb){for(var _0x5afe60=0x0,_0x4eb3de=events[_0xff94('0x6')];_0x5afe60<_0x4eb3de;_0x5afe60++){var _0x15e38d=events[_0x5afe60];var _0x27a04e=createListener(_0xff94('0x7')+_0x15e38d,_0x4817fb);FaxAccountEvents['on'](_0x15e38d,_0x27a04e);}}; \ No newline at end of file +var _0xb50d=['remove','update','emit','removeListener','register','length','faxAccount:','./faxAccount.events','save'];(function(_0x3deb08,_0x4d3d85){var _0x5412a1=function(_0x118d8f){while(--_0x118d8f){_0x3deb08['push'](_0x3deb08['shift']());}};_0x5412a1(++_0x4d3d85);}(_0xb50d,0x1a5));var _0xdb50=function(_0x3ff11a,_0x312cfa){_0x3ff11a=_0x3ff11a-0x0;var _0x3bda2e=_0xb50d[_0x3ff11a];return _0x3bda2e;};'use strict';var FaxAccountEvents=require(_0xdb50('0x0'));var events=[_0xdb50('0x1'),_0xdb50('0x2'),_0xdb50('0x3')];function createListener(_0x263845,_0x522ac4){return function(_0x3be00d){_0x522ac4[_0xdb50('0x4')](_0x263845,_0x3be00d);};}function removeListener(_0x16d71c,_0x440a00){return function(){FaxAccountEvents[_0xdb50('0x5')](_0x16d71c,_0x440a00);};}exports[_0xdb50('0x6')]=function(_0x147570){for(var _0x3d2ba5=0x0,_0x4d4666=events[_0xdb50('0x7')];_0x3d2ba5<_0x4d4666;_0x3d2ba5++){var _0x3d74d6=events[_0x3d2ba5];var _0x11dc51=createListener(_0xdb50('0x8')+_0x3d74d6,_0x147570);FaxAccountEvents['on'](_0x3d74d6,_0x11dc51);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 09257eb..d4ef70e 100644 --- a/server/api/faxAccount/index.js +++ b/server/api/faxAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','index','/describe','show','/:id/dispositions','isAuthenticated','getDispositions','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','addInteraction','addApplications','addAccountApplications','/updateaccountapplications','/:id/send','send','addAgents','put','/:id','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path'];(function(_0x5c839c,_0x335a88){var _0x14a48a=function(_0x443775){while(--_0x443775){_0x5c839c['push'](_0x5c839c['shift']());}};_0x14a48a(++_0x335a88);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xa9e0[_0x2a6809];return _0x11c371;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getApplications']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post']('/',auth[_0x0a9e('0xd')](),controller['create']);router[_0x0a9e('0x16')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router['post'](_0x0a9e('0x18'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x16')](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1a')]);router[_0x0a9e('0x16')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x16')]('/addaccountapplications',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router['post'](_0x0a9e('0x1d'),auth['isAuthenticated'](),controller['updateAccountApplications']);router[_0x0a9e('0x16')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['post'](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0x22'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x24')]);router[_0x0a9e('0x25')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x26')]);router['delete'](_0x0a9e('0x18'),auth['isAuthenticated'](),controller[_0x0a9e('0x27')]);router[_0x0a9e('0x25')](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x28')]);module[_0x0a9e('0x29')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','index','/describe','show','/:id/dispositions','isAuthenticated','getDispositions','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','addInteraction','addApplications','addAccountApplications','/updateaccountapplications','/:id/send','send','addAgents','put','/:id','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path'];(function(_0x5505a6,_0x3ecff8){var _0x95632=function(_0x5a8b33){while(--_0x5a8b33){_0x5505a6['push'](_0x5505a6['shift']());}};_0x95632(++_0x3ecff8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa9e0[_0x37bd26];return _0xe83dc4;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getApplications']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post']('/',auth[_0x0a9e('0xd')](),controller['create']);router[_0x0a9e('0x16')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router['post'](_0x0a9e('0x18'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x16')](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1a')]);router[_0x0a9e('0x16')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x16')]('/addaccountapplications',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router['post'](_0x0a9e('0x1d'),auth['isAuthenticated'](),controller['updateAccountApplications']);router[_0x0a9e('0x16')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['post'](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0x22'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x24')]);router[_0x0a9e('0x25')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x26')]);router['delete'](_0x0a9e('0x18'),auth['isAuthenticated'](),controller[_0x0a9e('0x27')]);router[_0x0a9e('0x25')](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x28')]);module[_0x0a9e('0x29')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index f32af24..d3fdf07 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 _0xc2c9=['*,*,*,*','sequelize','exports','STRING','TEXT'];(function(_0x32f9ca,_0x2fa8bc){var _0x52e083=function(_0x4fd86a){while(--_0x4fd86a){_0x32f9ca['push'](_0x32f9ca['shift']());}};_0x52e083(++_0x2fa8bc);}(_0xc2c9,0x83));var _0x9c2c=function(_0x1f4ef7,_0x27c88f){_0x1f4ef7=_0x1f4ef7-0x0;var _0xe1cf72=_0xc2c9[_0x1f4ef7];return _0xe1cf72;};'use strict';var Sequelize=require(_0x9c2c('0x0'));module[_0x9c2c('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x9c2c('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x9c2c('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x9c2c('0x4')}}; \ No newline at end of file +var _0x2fd1=['STRING','sequelize','exports','INTEGER','TEXT'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2fd1,0x6a));var _0x12fd=function(_0x4ab32c,_0x44ab5e){_0x4ab32c=_0x4ab32c-0x0;var _0x2b9644=_0x2fd1[_0x4ab32c];return _0x2b9644;};'use strict';var Sequelize=require(_0x12fd('0x0'));module[_0x12fd('0x1')]={'priority':{'type':Sequelize[_0x12fd('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x12fd('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x12fd('0x4')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 9becca5..f982a9e 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 _0xe342=['where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','end','error','stack','name','send','index','map','FaxApplication','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort'];(function(_0x53ad14,_0x4328b8){var _0x4f0e6f=function(_0x514b81){while(--_0x514b81){_0x53ad14['push'](_0x53ad14['shift']());}};_0x4f0e6f(++_0x4328b8);}(_0xe342,0x149));var _0x2e34=function(_0x1b1e76,_0x31695b){_0x1b1e76=_0x1b1e76-0x0;var _0x3d743a=_0xe342[_0x1b1e76];return _0x3d743a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2e34('0x0'));var zipdir=require(_0x2e34('0x1'));var jsonpatch=require(_0x2e34('0x2'));var rp=require(_0x2e34('0x3'));var moment=require(_0x2e34('0x4'));var BPromise=require(_0x2e34('0x5'));var Mustache=require(_0x2e34('0x6'));var util=require(_0x2e34('0x7'));var path=require(_0x2e34('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x2e34('0x9'));var fs=require('fs');var fs_extra=require(_0x2e34('0xa'));var _=require(_0x2e34('0xb'));var squel=require('squel');var crypto=require(_0x2e34('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2e34('0xd'));var Redis=require(_0x2e34('0xe'));var authService=require(_0x2e34('0xf'));var qs=require(_0x2e34('0x10'));var as=require(_0x2e34('0x11'));var hardwareService=require(_0x2e34('0x12'));var logger=require('../../config/logger')(_0x2e34('0x13'));var utils=require(_0x2e34('0x14'));var config=require(_0x2e34('0x15'));var licenseUtil=require(_0x2e34('0x16'));var db=require(_0x2e34('0x17'))['db'];function respondWithStatusCode(_0x426338,_0x30bf64){_0x30bf64=_0x30bf64||0xcc;return function(_0x580db6){if(_0x580db6){return _0x426338[_0x2e34('0x18')](_0x30bf64);}return _0x426338[_0x2e34('0x19')](_0x30bf64)['end']();};}function respondWithResult(_0x47f0fb,_0x1741a4){_0x1741a4=_0x1741a4||0xc8;return function(_0x5ddb0b){if(_0x5ddb0b){return _0x47f0fb[_0x2e34('0x19')](_0x1741a4)[_0x2e34('0x1a')](_0x5ddb0b);}};}function respondWithFilteredResult(_0x1b9c82,_0x15ac8d){return function(_0x10d109){if(_0x10d109){var _0x22a048=typeof _0x15ac8d[_0x2e34('0x1b')]===_0x2e34('0x1c')&&typeof _0x15ac8d[_0x2e34('0x1d')]===_0x2e34('0x1c');var _0x122ac4=_0x10d109[_0x2e34('0x1e')];var _0x5d659e=_0x22a048?0x0:_0x15ac8d[_0x2e34('0x1b')];var _0x5125cc=_0x22a048?_0x10d109[_0x2e34('0x1e')]:_0x15ac8d[_0x2e34('0x1b')]+_0x15ac8d[_0x2e34('0x1d')];var _0x3ff0bd;if(_0x5125cc>=_0x122ac4){_0x5125cc=_0x122ac4;_0x3ff0bd=0xc8;}else{_0x3ff0bd=0xce;}_0x1b9c82[_0x2e34('0x19')](_0x3ff0bd);return _0x1b9c82[_0x2e34('0x1f')](_0x2e34('0x20'),_0x5d659e+'-'+_0x5125cc+'/'+_0x122ac4)['json'](_0x10d109);}return null;};}function patchUpdates(_0x5e0235){return function(_0x3ec497){try{jsonpatch['apply'](_0x3ec497,_0x5e0235,!![]);}catch(_0x54749e){return BPromise[_0x2e34('0x21')](_0x54749e);}return _0x3ec497[_0x2e34('0x22')]();};}function saveUpdates(_0x14794d,_0x36e35a){return function(_0x552734){if(_0x552734){return _0x552734[_0x2e34('0x23')](_0x14794d)[_0x2e34('0x24')](function(_0x1d65f4){return _0x1d65f4;});}return null;};}function removeEntity(_0x2828c5,_0x28e2f2){return function(_0x9f145e){if(_0x9f145e){return _0x9f145e['destroy']()[_0x2e34('0x24')](function(){_0x2828c5[_0x2e34('0x19')](0xcc)[_0x2e34('0x25')]();});}};}function handleEntityNotFound(_0xa4b1ca,_0x3ccbec){return function(_0x3f7a56){if(!_0x3f7a56){_0xa4b1ca['sendStatus'](0x194);}return _0x3f7a56;};}function handleError(_0x48091c,_0x48c9ca){_0x48c9ca=_0x48c9ca||0x1f4;return function(_0x16db14){logger[_0x2e34('0x26')](_0x16db14[_0x2e34('0x27')]);if(_0x16db14['name']){delete _0x16db14[_0x2e34('0x28')];}_0x48091c[_0x2e34('0x19')](_0x48c9ca)[_0x2e34('0x29')](_0x16db14);};}exports[_0x2e34('0x2a')]=function(_0x5072a0,_0x23e6cc){var _0x5cdfe0={},_0x363a9e={},_0x2c277f={'count':0x0,'rows':[]};var _0x6c2434=_[_0x2e34('0x2b')](db[_0x2e34('0x2c')][_0x2e34('0x2d')],function(_0x510cad){return{'name':_0x510cad[_0x2e34('0x2e')],'type':_0x510cad[_0x2e34('0x2f')][_0x2e34('0x30')]};});_0x363a9e[_0x2e34('0x31')]=_[_0x2e34('0x2b')](_0x6c2434,'name');_0x363a9e[_0x2e34('0x32')]=_[_0x2e34('0x33')](_0x5072a0['query']);_0x363a9e[_0x2e34('0x34')]=_[_0x2e34('0x35')](_0x363a9e[_0x2e34('0x31')],_0x363a9e[_0x2e34('0x32')]);_0x5cdfe0[_0x2e34('0x36')]=_[_0x2e34('0x35')](_0x363a9e[_0x2e34('0x31')],qs[_0x2e34('0x37')](_0x5072a0[_0x2e34('0x32')]['fields']));_0x5cdfe0[_0x2e34('0x36')]=_0x5cdfe0[_0x2e34('0x36')][_0x2e34('0x38')]?_0x5cdfe0['attributes']:_0x363a9e[_0x2e34('0x31')];if(!_0x5072a0[_0x2e34('0x32')][_0x2e34('0x39')](_0x2e34('0x3a'))){_0x5cdfe0['limit']=qs[_0x2e34('0x1d')](_0x5072a0['query'][_0x2e34('0x1d')]);_0x5cdfe0[_0x2e34('0x1b')]=qs['offset'](_0x5072a0[_0x2e34('0x32')]['offset']);}_0x5cdfe0[_0x2e34('0x3b')]=qs[_0x2e34('0x3c')](_0x5072a0[_0x2e34('0x32')][_0x2e34('0x3c')]);_0x5cdfe0[_0x2e34('0x3d')]=qs[_0x2e34('0x34')](_[_0x2e34('0x3e')](_0x5072a0[_0x2e34('0x32')],_0x363a9e[_0x2e34('0x34')]),_0x6c2434);if(_0x5072a0['query'][_0x2e34('0x3f')]){_0x5cdfe0[_0x2e34('0x3d')]=_[_0x2e34('0x40')](_0x5cdfe0[_0x2e34('0x3d')],{'$or':_[_0x2e34('0x2b')](_0x6c2434,function(_0x4e4819){if(_0x4e4819['type']!==_0x2e34('0x41')){var _0x41f310={};_0x41f310[_0x4e4819[_0x2e34('0x28')]]={'$like':'%'+_0x5072a0[_0x2e34('0x32')][_0x2e34('0x3f')]+'%'};return _0x41f310;}})});}_0x5cdfe0=_[_0x2e34('0x40')]({},_0x5cdfe0,_0x5072a0[_0x2e34('0x42')]);var _0xad0b30={'where':_0x5cdfe0['where']};return db[_0x2e34('0x2c')][_0x2e34('0x1e')](_0xad0b30)[_0x2e34('0x24')](function(_0x462a59){_0x2c277f[_0x2e34('0x1e')]=_0x462a59;if(_0x5072a0[_0x2e34('0x32')]['includeAll']){_0x5cdfe0[_0x2e34('0x43')]=[{'all':!![]}];}return db[_0x2e34('0x2c')][_0x2e34('0x44')](_0x5cdfe0);})[_0x2e34('0x24')](function(_0x37e6c4){_0x2c277f[_0x2e34('0x45')]=_0x37e6c4;return _0x2c277f;})['then'](respondWithFilteredResult(_0x23e6cc,_0x5cdfe0))[_0x2e34('0x46')](handleError(_0x23e6cc,null));};exports[_0x2e34('0x47')]=function(_0x5eb237,_0x1db793){var _0xcd3ab2={'raw':!![],'where':{'id':_0x5eb237[_0x2e34('0x48')]['id']}},_0x398393={};_0x398393[_0x2e34('0x31')]=_[_0x2e34('0x33')](db[_0x2e34('0x2c')][_0x2e34('0x2d')]);_0x398393[_0x2e34('0x32')]=_['keys'](_0x5eb237[_0x2e34('0x32')]);_0x398393[_0x2e34('0x34')]=_[_0x2e34('0x35')](_0x398393[_0x2e34('0x31')],_0x398393[_0x2e34('0x32')]);_0xcd3ab2['attributes']=_[_0x2e34('0x35')](_0x398393[_0x2e34('0x31')],qs[_0x2e34('0x37')](_0x5eb237[_0x2e34('0x32')][_0x2e34('0x37')]));_0xcd3ab2[_0x2e34('0x36')]=_0xcd3ab2[_0x2e34('0x36')]['length']?_0xcd3ab2[_0x2e34('0x36')]:_0x398393[_0x2e34('0x31')];if(_0x5eb237[_0x2e34('0x32')][_0x2e34('0x49')]){_0xcd3ab2['include']=[{'all':!![]}];}_0xcd3ab2=_[_0x2e34('0x40')]({},_0xcd3ab2,_0x5eb237['options']);return db['FaxApplication'][_0x2e34('0x4a')](_0xcd3ab2)[_0x2e34('0x24')](handleEntityNotFound(_0x1db793,null))['then'](respondWithResult(_0x1db793,null))[_0x2e34('0x46')](handleError(_0x1db793,null));};exports[_0x2e34('0x4b')]=function(_0x67ae65,_0x5d2d61){return db[_0x2e34('0x2c')]['create'](_0x67ae65['body'],{})[_0x2e34('0x24')](respondWithResult(_0x5d2d61,0xc9))[_0x2e34('0x46')](handleError(_0x5d2d61,null));};exports[_0x2e34('0x23')]=function(_0x37e1d3,_0x20654a){if(_0x37e1d3[_0x2e34('0x4c')]['id']){delete _0x37e1d3[_0x2e34('0x4c')]['id'];}return db[_0x2e34('0x2c')][_0x2e34('0x4a')]({'where':{'id':_0x37e1d3[_0x2e34('0x48')]['id']}})[_0x2e34('0x24')](handleEntityNotFound(_0x20654a,null))['then'](saveUpdates(_0x37e1d3[_0x2e34('0x4c')],null))['then'](respondWithResult(_0x20654a,null))[_0x2e34('0x46')](handleError(_0x20654a,null));};exports[_0x2e34('0x4d')]=function(_0x26033e,_0xaf4d49){return db[_0x2e34('0x2c')][_0x2e34('0x4a')]({'where':{'id':_0x26033e[_0x2e34('0x48')]['id']}})[_0x2e34('0x24')](handleEntityNotFound(_0xaf4d49,null))['then'](removeEntity(_0xaf4d49,null))['catch'](handleError(_0xaf4d49,null));}; \ No newline at end of file +var _0xaaff=['key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','order','sort','where','pick','VIRTUAL','filter','merge','options','count','includeAll','rows','catch','show','params','intersection','include','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','FaxApplication','rawAttributes','fieldName','type'];(function(_0x2c1563,_0x206767){var _0x3352a9=function(_0x46c687){while(--_0x46c687){_0x2c1563['push'](_0x2c1563['shift']());}};_0x3352a9(++_0x206767);}(_0xaaff,0x18e));var _0xfaaf=function(_0x4f2b8c,_0x4012c8){_0x4f2b8c=_0x4f2b8c-0x0;var _0x1226ae=_0xaaff[_0x4f2b8c];return _0x1226ae;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfaaf('0x0'));var zipdir=require(_0xfaaf('0x1'));var jsonpatch=require(_0xfaaf('0x2'));var rp=require(_0xfaaf('0x3'));var moment=require('moment');var BPromise=require(_0xfaaf('0x4'));var Mustache=require(_0xfaaf('0x5'));var util=require(_0xfaaf('0x6'));var path=require(_0xfaaf('0x7'));var sox=require(_0xfaaf('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfaaf('0x9'));var _=require(_0xfaaf('0xa'));var squel=require('squel');var crypto=require(_0xfaaf('0xb'));var jsforce=require(_0xfaaf('0xc'));var deskjs=require(_0xfaaf('0xd'));var toCsv=require('to-csv');var querystring=require(_0xfaaf('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xfaaf('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfaaf('0x10'));var logger=require(_0xfaaf('0x11'))(_0xfaaf('0x12'));var utils=require(_0xfaaf('0x13'));var config=require(_0xfaaf('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xfaaf('0x15'))['db'];function respondWithStatusCode(_0x2a9a1d,_0x200c61){_0x200c61=_0x200c61||0xcc;return function(_0x5d6768){if(_0x5d6768){return _0x2a9a1d[_0xfaaf('0x16')](_0x200c61);}return _0x2a9a1d['status'](_0x200c61)[_0xfaaf('0x17')]();};}function respondWithResult(_0x11d064,_0x29db5c){_0x29db5c=_0x29db5c||0xc8;return function(_0x1b7f2f){if(_0x1b7f2f){return _0x11d064[_0xfaaf('0x18')](_0x29db5c)[_0xfaaf('0x19')](_0x1b7f2f);}};}function respondWithFilteredResult(_0x4fa01d,_0x47d2f4){return function(_0x23b61c){if(_0x23b61c){var _0x5a9cd1=typeof _0x47d2f4[_0xfaaf('0x1a')]===_0xfaaf('0x1b')&&typeof _0x47d2f4[_0xfaaf('0x1c')]==='undefined';var _0x11e05e=_0x23b61c['count'];var _0x3942a4=_0x5a9cd1?0x0:_0x47d2f4[_0xfaaf('0x1a')];var _0x96cfb6=_0x5a9cd1?_0x23b61c['count']:_0x47d2f4['offset']+_0x47d2f4['limit'];var _0x260831;if(_0x96cfb6>=_0x11e05e){_0x96cfb6=_0x11e05e;_0x260831=0xc8;}else{_0x260831=0xce;}_0x4fa01d[_0xfaaf('0x18')](_0x260831);return _0x4fa01d[_0xfaaf('0x1d')](_0xfaaf('0x1e'),_0x3942a4+'-'+_0x96cfb6+'/'+_0x11e05e)[_0xfaaf('0x19')](_0x23b61c);}return null;};}function patchUpdates(_0x5b1de7){return function(_0x6f23d){try{jsonpatch[_0xfaaf('0x1f')](_0x6f23d,_0x5b1de7,!![]);}catch(_0x338cbc){return BPromise[_0xfaaf('0x20')](_0x338cbc);}return _0x6f23d[_0xfaaf('0x21')]();};}function saveUpdates(_0x4c976a,_0x3f5454){return function(_0x3d76b0){if(_0x3d76b0){return _0x3d76b0[_0xfaaf('0x22')](_0x4c976a)[_0xfaaf('0x23')](function(_0x3160b1){return _0x3160b1;});}return null;};}function removeEntity(_0x3b01a4,_0x1dadab){return function(_0x1111ee){if(_0x1111ee){return _0x1111ee[_0xfaaf('0x24')]()[_0xfaaf('0x23')](function(){_0x3b01a4[_0xfaaf('0x18')](0xcc)[_0xfaaf('0x17')]();});}};}function handleEntityNotFound(_0x1dc16c,_0x111429){return function(_0x29fb08){if(!_0x29fb08){_0x1dc16c['sendStatus'](0x194);}return _0x29fb08;};}function handleError(_0x94445e,_0x132864){_0x132864=_0x132864||0x1f4;return function(_0x1ae914){logger['error'](_0x1ae914[_0xfaaf('0x25')]);if(_0x1ae914[_0xfaaf('0x26')]){delete _0x1ae914[_0xfaaf('0x26')];}_0x94445e[_0xfaaf('0x18')](_0x132864)[_0xfaaf('0x27')](_0x1ae914);};}exports[_0xfaaf('0x28')]=function(_0x1853ee,_0x543c43){var _0x3a2b40={},_0x4d91de={},_0x2960c5={'count':0x0,'rows':[]};var _0x31ae45=_[_0xfaaf('0x29')](db[_0xfaaf('0x2a')][_0xfaaf('0x2b')],function(_0x24712c){return{'name':_0x24712c[_0xfaaf('0x2c')],'type':_0x24712c[_0xfaaf('0x2d')][_0xfaaf('0x2e')]};});_0x4d91de[_0xfaaf('0x2f')]=_[_0xfaaf('0x29')](_0x31ae45,_0xfaaf('0x26'));_0x4d91de[_0xfaaf('0x30')]=_[_0xfaaf('0x31')](_0x1853ee[_0xfaaf('0x30')]);_0x4d91de[_0xfaaf('0x32')]=_['intersection'](_0x4d91de['model'],_0x4d91de['query']);_0x3a2b40[_0xfaaf('0x33')]=_['intersection'](_0x4d91de[_0xfaaf('0x2f')],qs[_0xfaaf('0x34')](_0x1853ee[_0xfaaf('0x30')][_0xfaaf('0x34')]));_0x3a2b40['attributes']=_0x3a2b40[_0xfaaf('0x33')][_0xfaaf('0x35')]?_0x3a2b40[_0xfaaf('0x33')]:_0x4d91de[_0xfaaf('0x2f')];if(!_0x1853ee[_0xfaaf('0x30')][_0xfaaf('0x36')]('nolimit')){_0x3a2b40[_0xfaaf('0x1c')]=qs[_0xfaaf('0x1c')](_0x1853ee[_0xfaaf('0x30')][_0xfaaf('0x1c')]);_0x3a2b40['offset']=qs[_0xfaaf('0x1a')](_0x1853ee[_0xfaaf('0x30')]['offset']);}_0x3a2b40[_0xfaaf('0x37')]=qs[_0xfaaf('0x38')](_0x1853ee['query'][_0xfaaf('0x38')]);_0x3a2b40[_0xfaaf('0x39')]=qs[_0xfaaf('0x32')](_[_0xfaaf('0x3a')](_0x1853ee[_0xfaaf('0x30')],_0x4d91de['filters']),_0x31ae45);if(_0x1853ee[_0xfaaf('0x30')]['filter']){_0x3a2b40[_0xfaaf('0x39')]=_['merge'](_0x3a2b40['where'],{'$or':_[_0xfaaf('0x29')](_0x31ae45,function(_0x24508f){if(_0x24508f['type']!==_0xfaaf('0x3b')){var _0x35b478={};_0x35b478[_0x24508f['name']]={'$like':'%'+_0x1853ee[_0xfaaf('0x30')][_0xfaaf('0x3c')]+'%'};return _0x35b478;}})});}_0x3a2b40=_[_0xfaaf('0x3d')]({},_0x3a2b40,_0x1853ee[_0xfaaf('0x3e')]);var _0x466dd6={'where':_0x3a2b40[_0xfaaf('0x39')]};return db[_0xfaaf('0x2a')][_0xfaaf('0x3f')](_0x466dd6)[_0xfaaf('0x23')](function(_0x533d86){_0x2960c5[_0xfaaf('0x3f')]=_0x533d86;if(_0x1853ee[_0xfaaf('0x30')][_0xfaaf('0x40')]){_0x3a2b40['include']=[{'all':!![]}];}return db[_0xfaaf('0x2a')]['findAll'](_0x3a2b40);})[_0xfaaf('0x23')](function(_0x316f42){_0x2960c5[_0xfaaf('0x41')]=_0x316f42;return _0x2960c5;})['then'](respondWithFilteredResult(_0x543c43,_0x3a2b40))[_0xfaaf('0x42')](handleError(_0x543c43,null));};exports[_0xfaaf('0x43')]=function(_0x240f01,_0x21b742){var _0x2e165d={'raw':!![],'where':{'id':_0x240f01[_0xfaaf('0x44')]['id']}},_0x2e8dd8={};_0x2e8dd8[_0xfaaf('0x2f')]=_[_0xfaaf('0x31')](db[_0xfaaf('0x2a')][_0xfaaf('0x2b')]);_0x2e8dd8[_0xfaaf('0x30')]=_['keys'](_0x240f01[_0xfaaf('0x30')]);_0x2e8dd8[_0xfaaf('0x32')]=_[_0xfaaf('0x45')](_0x2e8dd8[_0xfaaf('0x2f')],_0x2e8dd8['query']);_0x2e165d['attributes']=_[_0xfaaf('0x45')](_0x2e8dd8[_0xfaaf('0x2f')],qs['fields'](_0x240f01[_0xfaaf('0x30')][_0xfaaf('0x34')]));_0x2e165d[_0xfaaf('0x33')]=_0x2e165d[_0xfaaf('0x33')][_0xfaaf('0x35')]?_0x2e165d['attributes']:_0x2e8dd8[_0xfaaf('0x2f')];if(_0x240f01[_0xfaaf('0x30')][_0xfaaf('0x40')]){_0x2e165d[_0xfaaf('0x46')]=[{'all':!![]}];}_0x2e165d=_[_0xfaaf('0x3d')]({},_0x2e165d,_0x240f01[_0xfaaf('0x3e')]);return db[_0xfaaf('0x2a')][_0xfaaf('0x47')](_0x2e165d)[_0xfaaf('0x23')](handleEntityNotFound(_0x21b742,null))['then'](respondWithResult(_0x21b742,null))[_0xfaaf('0x42')](handleError(_0x21b742,null));};exports['create']=function(_0x19df23,_0x4d80f7){return db[_0xfaaf('0x2a')][_0xfaaf('0x48')](_0x19df23[_0xfaaf('0x49')],{})[_0xfaaf('0x23')](respondWithResult(_0x4d80f7,0xc9))[_0xfaaf('0x42')](handleError(_0x4d80f7,null));};exports[_0xfaaf('0x22')]=function(_0x4d569a,_0x895368){if(_0x4d569a[_0xfaaf('0x49')]['id']){delete _0x4d569a[_0xfaaf('0x49')]['id'];}return db[_0xfaaf('0x2a')]['find']({'where':{'id':_0x4d569a['params']['id']}})[_0xfaaf('0x23')](handleEntityNotFound(_0x895368,null))[_0xfaaf('0x23')](saveUpdates(_0x4d569a[_0xfaaf('0x49')],null))['then'](respondWithResult(_0x895368,null))['catch'](handleError(_0x895368,null));};exports[_0xfaaf('0x24')]=function(_0x516ad4,_0xa50bfb){return db[_0xfaaf('0x2a')][_0xfaaf('0x47')]({'where':{'id':_0x516ad4[_0xfaaf('0x44')]['id']}})[_0xfaaf('0x23')](handleEntityNotFound(_0xa50bfb,null))[_0xfaaf('0x23')](removeEntity(_0xa50bfb,null))[_0xfaaf('0x42')](handleError(_0xa50bfb,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 6f9f05c..d68dfcf 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 _0xc262=['api','moment','path','rimraf','../../config/environment','exports','define','FaxApplication','fax_applications','utf8mb4_unicode_ci'];(function(_0x376db5,_0x2b8874){var _0x304c17=function(_0x2dd9ba){while(--_0x2dd9ba){_0x376db5['push'](_0x376db5['shift']());}};_0x304c17(++_0x2b8874);}(_0xc262,0x1cc));var _0x2c26=function(_0x51fb74,_0x5b169b){_0x51fb74=_0x51fb74-0x0;var _0x1d62dd=_0xc262[_0x51fb74];return _0x1d62dd;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x2c26('0x0'));var moment=require(_0x2c26('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2c26('0x2'));var rimraf=require(_0x2c26('0x3'));var config=require(_0x2c26('0x4'));var attributes=require('./faxApplication.attributes');module[_0x2c26('0x5')]=function(_0x39e691,_0x279954){return _0x39e691[_0x2c26('0x6')](_0x2c26('0x7'),attributes,{'tableName':_0x2c26('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x2c26('0x9')});}; \ No newline at end of file +var _0xdb3b=['define','FaxApplication','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment','path','../../config/environment','exports'];(function(_0x4e7da6,_0x5d8440){var _0x25d332=function(_0x3df512){while(--_0x3df512){_0x4e7da6['push'](_0x4e7da6['shift']());}};_0x25d332(++_0x5d8440);}(_0xdb3b,0x16c));var _0xbdb3=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xdb3b[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xbdb3('0x0'))(_0xbdb3('0x1'));var moment=require(_0xbdb3('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xbdb3('0x3'));var rimraf=require('rimraf');var config=require(_0xbdb3('0x4'));var attributes=require('./faxApplication.attributes');module[_0xbdb3('0x5')]=function(_0x5af45a,_0x265c96){return _0x5af45a[_0xbdb3('0x6')](_0xbdb3('0x7'),attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xbdb3('0x8'),'collate':_0xbdb3('0x9')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 12cfcd6..eff638f 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 _0x3647=['error','code','message','result','catch','FaxApplication','update','body','options','raw','attributes','limit','then','UpdateFaxApplication','debug','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','http','request','info','request\x20sent','stringify'];(function(_0x440a92,_0x25d5b7){var _0x13571d=function(_0x3a7f49){while(--_0x3a7f49){_0x440a92['push'](_0x440a92['shift']());}};_0x13571d(++_0x25d5b7);}(_0x3647,0x161));var _0x7364=function(_0x4c60a6,_0x232e71){_0x4c60a6=_0x4c60a6-0x0;var _0x3c61de=_0x3647[_0x4c60a6];return _0x3c61de;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7364('0x0'));var BPromise=require('bluebird');var rs=require(_0x7364('0x1'));var fs=require('fs');var Redis=require(_0x7364('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x7364('0x3'));var logger=require(_0x7364('0x4'))('rpc');var config=require(_0x7364('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7364('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x24ee88,_0x4e7e67,_0x27aa8b){return new BPromise(function(_0x875162,_0x19a782){return client[_0x7364('0x7')](_0x24ee88,_0x27aa8b)['then'](function(_0x5cdd55){logger[_0x7364('0x8')]('FaxApplication,\x20%s,\x20%s',_0x4e7e67,_0x7364('0x9'));logger['debug']('FaxApplication,\x20%s,\x20%s,\x20%s',_0x4e7e67,'request\x20sent',JSON[_0x7364('0xa')](_0x5cdd55));if(_0x5cdd55['error']){if(_0x5cdd55[_0x7364('0xb')][_0x7364('0xc')]===0x1f4){logger[_0x7364('0xb')]('FaxApplication,\x20%s,\x20%s',_0x4e7e67,_0x5cdd55['error']['message']);return _0x19a782(_0x5cdd55['error'][_0x7364('0xd')]);}logger['error']('FaxApplication,\x20%s,\x20%s',_0x4e7e67,_0x5cdd55[_0x7364('0xb')][_0x7364('0xd')]);return _0x875162(_0x5cdd55[_0x7364('0xb')][_0x7364('0xd')]);}else{logger[_0x7364('0x8')]('FaxApplication,\x20%s,\x20%s',_0x4e7e67,_0x7364('0x9'));_0x875162(_0x5cdd55[_0x7364('0xe')][_0x7364('0xd')]);}})[_0x7364('0xf')](function(_0x4c5f49){logger['error']('FaxApplication,\x20%s,\x20%s',_0x4e7e67,_0x4c5f49);_0x19a782(_0x4c5f49);});});}exports['UpdateFaxApplication']=function(_0x28189c){var _0x58a24a=this;return new Promise(function(_0x1fd236,_0xf0ae2d){return db[_0x7364('0x10')][_0x7364('0x11')](_0x28189c[_0x7364('0x12')],{'raw':_0x28189c[_0x7364('0x13')]?_0x28189c[_0x7364('0x13')][_0x7364('0x14')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x28189c[_0x7364('0x13')]?_0x28189c['options']['where']||null:null,'attributes':_0x28189c[_0x7364('0x13')]?_0x28189c[_0x7364('0x13')][_0x7364('0x15')]||null:null,'limit':_0x28189c[_0x7364('0x13')]?_0x28189c[_0x7364('0x13')][_0x7364('0x16')]||null:null})[_0x7364('0x17')](function(_0x9de9de){logger[_0x7364('0x8')](_0x7364('0x18'),_0x28189c);logger[_0x7364('0x19')](_0x7364('0x18'),_0x28189c,JSON[_0x7364('0xa')](_0x9de9de));_0x1fd236(_0x9de9de);})[_0x7364('0xf')](function(_0x550f56){logger[_0x7364('0xb')](_0x7364('0x18'),_0x550f56['message'],_0x28189c);_0xf0ae2d(_0x58a24a['error'](0x1f4,_0x550f56[_0x7364('0xd')]));});});}; \ No newline at end of file +var _0x06da=['randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','info','request\x20sent','debug','stringify','error','FaxApplication,\x20%s,\x20%s','message','result','catch','UpdateFaxApplication','FaxApplication','update','body','options','attributes','then','moment'];(function(_0xb56a21,_0x3093c7){var _0x121573=function(_0x4bb965){while(--_0x4bb965){_0xb56a21['push'](_0xb56a21['shift']());}};_0x121573(++_0x3093c7);}(_0x06da,0x8f));var _0xa06d=function(_0x174d7b,_0x3a4d99){_0x174d7b=_0x174d7b-0x0;var _0x1748cd=_0x06da[_0x174d7b];return _0x1748cd;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xa06d('0x0'));var BPromise=require('bluebird');var rs=require(_0xa06d('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa06d('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xa06d('0x3'))('rpc');var config=require(_0xa06d('0x4'));var jayson=require(_0xa06d('0x5'));var client=jayson[_0xa06d('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3abe3f,_0x33f7b8,_0x21f2d4){return new BPromise(function(_0x25d5cb,_0x1b2f60){return client[_0xa06d('0x7')](_0x3abe3f,_0x21f2d4)['then'](function(_0x23149b){logger[_0xa06d('0x8')]('FaxApplication,\x20%s,\x20%s',_0x33f7b8,_0xa06d('0x9'));logger[_0xa06d('0xa')]('FaxApplication,\x20%s,\x20%s,\x20%s',_0x33f7b8,_0xa06d('0x9'),JSON[_0xa06d('0xb')](_0x23149b));if(_0x23149b[_0xa06d('0xc')]){if(_0x23149b[_0xa06d('0xc')]['code']===0x1f4){logger[_0xa06d('0xc')](_0xa06d('0xd'),_0x33f7b8,_0x23149b[_0xa06d('0xc')][_0xa06d('0xe')]);return _0x1b2f60(_0x23149b[_0xa06d('0xc')]['message']);}logger[_0xa06d('0xc')]('FaxApplication,\x20%s,\x20%s',_0x33f7b8,_0x23149b[_0xa06d('0xc')][_0xa06d('0xe')]);return _0x25d5cb(_0x23149b[_0xa06d('0xc')][_0xa06d('0xe')]);}else{logger[_0xa06d('0x8')](_0xa06d('0xd'),_0x33f7b8,_0xa06d('0x9'));_0x25d5cb(_0x23149b[_0xa06d('0xf')][_0xa06d('0xe')]);}})[_0xa06d('0x10')](function(_0xee559e){logger['error'](_0xa06d('0xd'),_0x33f7b8,_0xee559e);_0x1b2f60(_0xee559e);});});}exports[_0xa06d('0x11')]=function(_0x1cdc8d){var _0x2424de=this;return new Promise(function(_0x5c9738,_0xc78abc){return db[_0xa06d('0x12')][_0xa06d('0x13')](_0x1cdc8d[_0xa06d('0x14')],{'raw':_0x1cdc8d[_0xa06d('0x15')]?_0x1cdc8d[_0xa06d('0x15')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1cdc8d[_0xa06d('0x15')]?_0x1cdc8d['options']['where']||null:null,'attributes':_0x1cdc8d[_0xa06d('0x15')]?_0x1cdc8d['options'][_0xa06d('0x16')]||null:null,'limit':_0x1cdc8d[_0xa06d('0x15')]?_0x1cdc8d[_0xa06d('0x15')]['limit']||null:null})[_0xa06d('0x17')](function(_0x22e57d){logger[_0xa06d('0x8')](_0xa06d('0x11'),_0x1cdc8d);logger['debug']('UpdateFaxApplication',_0x1cdc8d,JSON[_0xa06d('0xb')](_0x22e57d));_0x5c9738(_0x22e57d);})[_0xa06d('0x10')](function(_0x15c669){logger[_0xa06d('0xc')](_0xa06d('0x11'),_0x15c669['message'],_0x1cdc8d);_0xc78abc(_0x2424de[_0xa06d('0xc')](0x1f4,_0x15c669[_0xa06d('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 5957801..98c951c 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 _0xa571=['index','/:id','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../config/environment','get','isAuthenticated'];(function(_0x2ebfd0,_0x46da5a){var _0x12da74=function(_0x4b4fdb){while(--_0x4b4fdb){_0x2ebfd0['push'](_0x2ebfd0['shift']());}};_0x12da74(++_0x46da5a);}(_0xa571,0x107));var _0x1a57=function(_0x2d56ef,_0x399c70){_0x2d56ef=_0x2d56ef-0x0;var _0x29b4ca=_0xa571[_0x2d56ef];return _0x29b4ca;};'use strict';var multer=require(_0x1a57('0x0'));var util=require(_0x1a57('0x1'));var path=require(_0x1a57('0x2'));var timeout=require(_0x1a57('0x3'));var express=require('express');var router=express[_0x1a57('0x4')]();var fs_extra=require(_0x1a57('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1a57('0x6'));var controller=require('./faxApplication.controller');router[_0x1a57('0x7')]('/',auth[_0x1a57('0x8')](),controller[_0x1a57('0x9')]);router[_0x1a57('0x7')](_0x1a57('0xa'),auth[_0x1a57('0x8')](),controller['show']);router[_0x1a57('0xb')]('/',auth[_0x1a57('0x8')](),controller[_0x1a57('0xc')]);router['put'](_0x1a57('0xa'),auth[_0x1a57('0x8')](),controller[_0x1a57('0xd')]);router[_0x1a57('0xe')](_0x1a57('0xa'),auth[_0x1a57('0x8')](),controller[_0x1a57('0xf')]);module[_0x1a57('0x10')]=router; \ No newline at end of file +var _0x6324=['util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','show','post','create','put','update','delete','/:id','destroy','exports','multer'];(function(_0x1f1743,_0x4a1d6e){var _0x372903=function(_0x2cde28){while(--_0x2cde28){_0x1f1743['push'](_0x1f1743['shift']());}};_0x372903(++_0x4a1d6e);}(_0x6324,0x142));var _0x4632=function(_0x289a1f,_0x1b4dc6){_0x289a1f=_0x289a1f-0x0;var _0x5a44ec=_0x6324[_0x289a1f];return _0x5a44ec;};'use strict';var multer=require(_0x4632('0x0'));var util=require(_0x4632('0x1'));var path=require(_0x4632('0x2'));var timeout=require(_0x4632('0x3'));var express=require('express');var router=express[_0x4632('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x4632('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4632('0x6'));var controller=require('./faxApplication.controller');router[_0x4632('0x7')]('/',auth[_0x4632('0x8')](),controller[_0x4632('0x9')]);router[_0x4632('0x7')]('/:id',auth[_0x4632('0x8')](),controller[_0x4632('0xa')]);router[_0x4632('0xb')]('/',auth['isAuthenticated'](),controller[_0x4632('0xc')]);router[_0x4632('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x4632('0xe')]);router[_0x4632('0xf')](_0x4632('0x10'),auth[_0x4632('0x8')](),controller[_0x4632('0x11')]);module[_0x4632('0x12')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 3352d5b..e7051ae 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 _0x3104=['out','BOOLEAN','DATE','STRING','ENUM'];(function(_0x1dbaec,_0x3c991f){var _0x4badf4=function(_0x563229){while(--_0x563229){_0x1dbaec['push'](_0x1dbaec['shift']());}};_0x4badf4(++_0x3c991f);}(_0x3104,0x11e));var _0x4310=function(_0x5da615,_0x4ee8c4){_0x5da615=_0x5da615-0x0;var _0x14f07b=_0x3104[_0x5da615];return _0x14f07b;};'use strict';var Sequelize=require('sequelize');module['exports']={'closed':{'type':Sequelize[_0x4310('0x0')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x4310('0x1')]},'disposition':{'type':Sequelize[_0x4310('0x2')]},'secondDisposition':{'type':Sequelize[_0x4310('0x2')]},'thirdDisposition':{'type':Sequelize[_0x4310('0x2')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x4310('0x1')]},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize[_0x4310('0x3')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x4310('0x1')]},'lastMsgDirection':{'type':Sequelize[_0x4310('0x3')]('in',_0x4310('0x4')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0xd4b7=['ENUM','sequelize','exports','BOOLEAN','DATE','STRING','out'];(function(_0x45967a,_0x474c44){var _0xf97e90=function(_0x207c36){while(--_0x207c36){_0x45967a['push'](_0x45967a['shift']());}};_0xf97e90(++_0x474c44);}(_0xd4b7,0x10b));var _0x7d4b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd4b7[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x7d4b('0x0'));module[_0x7d4b('0x1')]={'closed':{'type':Sequelize[_0x7d4b('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x7d4b('0x3')]},'disposition':{'type':Sequelize[_0x7d4b('0x4')]},'secondDisposition':{'type':Sequelize[_0x7d4b('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x7d4b('0x4')]},'read1stAt':{'type':Sequelize[_0x7d4b('0x3')]},'fax':{'type':Sequelize[_0x7d4b('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x7d4b('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x7d4b('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x7d4b('0x6')]('in',_0x7d4b('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index 10e6867..05aa7e1 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 _0x07cc=['catch','waiting','talking','answered','total','UserId','closed','index','FaxInteraction','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','sort','where','select','field','color','tools_tags','u.fullname','ui.FaxInteractionId','from','user_has_fax_interactions','users','u.id\x20=\x20ui.UserId','fax_interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.FaxAccountId','fax_messages','me.FaxInteractionId\x20=\x20i.id','it.FaxInteractionId\x20=\x20i.id','search','parseSearch','sqlOperator','conditions','find','unreadMessages','`\x20=\x200','having','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','value','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','body','text','some','compact','isEmpty','FaxAccountId','i.FaxAccountId\x20IN\x20?','concat','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','replace','i.fax\x20LIKE\x20?','group','Sequelize','QueryTypes','i.id','order','contactName','resolve','i.FaxAccountId\x20IS\x20NOT\x20NULL','role','agent','user','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','Contact.lastName','c.phone','Contact.phone','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','all','show','params','options','create','destroy','describe','addMessage','FaxMessage','ids','omit','getMessages','findOne','nolimit','filter','$gte','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','include','rows','addTags','spread','findAll','emit','faxInteractionTags:save','download','unix','server','files','join','root','attachments','transcript-%d-%s.zip','Attachment','Messages','createdAt','mkdirSync','existsSync','createReadStream','createWriteStream','basename','log','err','unlinkSync','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','update','then','stack','name','send','Users','map','fullname','Tags','TagIds','split','forEach','push'];(function(_0x3c7501,_0x47e75c){var _0x2a7c96=function(_0x579b66){while(--_0x579b66){_0x3c7501['push'](_0x3c7501['shift']());}};_0x2a7c96(++_0x47e75c);}(_0x07cc,0x181));var _0xc07c=function(_0x22f65e,_0x54a29f){_0x22f65e=_0x22f65e-0x0;var _0x542eaf=_0x07cc[_0x22f65e];return _0x542eaf;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc07c('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc07c('0x1'));var rp=require(_0xc07c('0x2'));var moment=require(_0xc07c('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xc07c('0x4'));var util=require(_0xc07c('0x5'));var path=require(_0xc07c('0x6'));var sox=require(_0xc07c('0x7'));var csv=require(_0xc07c('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc07c('0x9'));var squel=require(_0xc07c('0xa'));var crypto=require(_0xc07c('0xb'));var jsforce=require(_0xc07c('0xc'));var deskjs=require(_0xc07c('0xd'));var toCsv=require('to-csv');var querystring=require(_0xc07c('0xe'));var Papa=require('papaparse');var Redis=require(_0xc07c('0xf'));var authService=require(_0xc07c('0x10'));var qs=require(_0xc07c('0x11'));var as=require(_0xc07c('0x12'));var hardwareService=require(_0xc07c('0x13'));var logger=require(_0xc07c('0x14'))(_0xc07c('0x15'));var utils=require(_0xc07c('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xc07c('0x17'));var db=require(_0xc07c('0x18'))['db'];config[_0xc07c('0x19')]=_[_0xc07c('0x1a')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xc07c('0x1b'))(new Redis(config[_0xc07c('0x19')]));require('./faxInteraction.socket')[_0xc07c('0x1c')](socket);function respondWithStatusCode(_0x580f11,_0x19f8ec){_0x19f8ec=_0x19f8ec||0xcc;return function(_0x1dbe36){if(_0x1dbe36){return _0x580f11[_0xc07c('0x1d')](_0x19f8ec);}return _0x580f11[_0xc07c('0x1e')](_0x19f8ec)[_0xc07c('0x1f')]();};}function respondWithResult(_0x568eab,_0xce203f){_0xce203f=_0xce203f||0xc8;return function(_0x1c020d){if(_0x1c020d){return _0x568eab[_0xc07c('0x1e')](_0xce203f)[_0xc07c('0x20')](_0x1c020d);}};}function respondWithFilteredResult(_0x5b6cc6,_0x3aab81){return function(_0x1bb056){if(_0x1bb056){var _0x3f81bd=typeof _0x3aab81[_0xc07c('0x21')]===_0xc07c('0x22')&&typeof _0x3aab81[_0xc07c('0x23')]===_0xc07c('0x22');var _0x4357c4=_0x1bb056['count'];var _0x16fbe9=_0x3f81bd?0x0:_0x3aab81[_0xc07c('0x21')];var _0x1fc080=_0x3f81bd?_0x1bb056[_0xc07c('0x24')]:_0x3aab81[_0xc07c('0x21')]+_0x3aab81[_0xc07c('0x23')];var _0x95d842;if(_0x1fc080>=_0x4357c4){_0x1fc080=_0x4357c4;_0x95d842=0xc8;}else{_0x95d842=0xce;}_0x5b6cc6['status'](_0x95d842);return _0x5b6cc6[_0xc07c('0x25')]('Content-Range',_0x16fbe9+'-'+_0x1fc080+'/'+_0x4357c4)[_0xc07c('0x20')](_0x1bb056);}return null;};}function patchUpdates(_0x5ce3f4){return function(_0x16ee9e){try{jsonpatch[_0xc07c('0x26')](_0x16ee9e,_0x5ce3f4,!![]);}catch(_0x37fe93){return BPromise[_0xc07c('0x27')](_0x37fe93);}return _0x16ee9e['save']();};}function saveUpdates(_0x3d0a5e,_0x32dc88){return function(_0x2885a6){if(_0x2885a6){return _0x2885a6[_0xc07c('0x28')](_0x3d0a5e)[_0xc07c('0x29')](function(_0x472ddd){return _0x472ddd;});}return null;};}function removeEntity(_0x2d519f,_0x24a054){return function(_0x249dd4){if(_0x249dd4){return _0x249dd4['destroy']()[_0xc07c('0x29')](function(){_0x2d519f['status'](0xcc)[_0xc07c('0x1f')]();});}};}function handleEntityNotFound(_0x40d868,_0x4aae49){return function(_0x4b3367){if(!_0x4b3367){_0x40d868[_0xc07c('0x1d')](0x194);}return _0x4b3367;};}function handleError(_0x45c8fe,_0x1ebb0b){_0x1ebb0b=_0x1ebb0b||0x1f4;return function(_0x38c0e8){logger['error'](_0x38c0e8[_0xc07c('0x2a')]);if(_0x38c0e8[_0xc07c('0x2b')]){delete _0x38c0e8[_0xc07c('0x2b')];}_0x45c8fe['status'](_0x1ebb0b)[_0xc07c('0x2c')](_0x38c0e8);};}function getInteractionUsers(_0x43449f,_0xa954e2){return new BPromise(function(_0x33ba5e,_0x2b6efb){try{if(_0xa954e2[_0x43449f['id']]){_0x43449f[_0xc07c('0x2d')]=_[_0xc07c('0x2e')](_0xa954e2[_0x43449f['id']],function(_0x220608){return{'id':_0x220608['id'],'fullname':_0x220608[_0xc07c('0x2f')]};});}}catch(_0x3f7ace){_0x2b6efb(_0x3f7ace);}_0x33ba5e(_0x43449f);});}function getInteractionTags(_0x38d4b8,_0x396a91){return new BPromise(function(_0x16e105,_0x5b6041){try{if(_0x38d4b8['TagIds']){_0x38d4b8[_0xc07c('0x30')]=[];_0x38d4b8[_0xc07c('0x31')][_0xc07c('0x32')](',')[_0xc07c('0x33')](function(_0x481e80){_0x38d4b8['Tags'][_0xc07c('0x34')](_0x396a91[_0x481e80]);});}delete _0x38d4b8[_0xc07c('0x31')];}catch(_0x35e56c){_0x5b6041(_0x35e56c);}_0x16e105(_0x38d4b8);});}function updateFaxInteraction(_0x473fb3,_0x5363b5,_0x35be8d){return new BPromise(function(_0x5bd5e7,_0x3d0fe9){return getInteractionUsers(_0x473fb3,_0x35be8d)[_0xc07c('0x29')](function(_0x49ee45){return getInteractionTags(_0x49ee45,_0x5363b5);})[_0xc07c('0x29')](function(_0x4b5635){return getStateInteraction(_0x4b5635);})[_0xc07c('0x29')](function(_0x455d37){_0x5bd5e7(_0x455d37);})[_0xc07c('0x35')](function(_0x48245c){_0x3d0fe9(_0x48245c);});});}function getStateInteraction(_0x42ef6a){return new BPromise(function(_0x475a05){_0x42ef6a[_0xc07c('0x36')]=0x0;_0x42ef6a[_0xc07c('0x37')]=0x0;_0x42ef6a[_0xc07c('0x38')]=0x0;_0x42ef6a['unmanaged']=0x0;_0x42ef6a[_0xc07c('0x39')]=0x0;if(!_0x42ef6a['closed']&&!_0x42ef6a[_0xc07c('0x3a')]){_0x42ef6a['waiting']+=0x1;}if(!_0x42ef6a['closed']&&_0x42ef6a[_0xc07c('0x3a')]){_0x42ef6a[_0xc07c('0x37')]+=0x1;if(_0x42ef6a['waiting']){_0x42ef6a['waiting']-=0x1;}}if(_0x42ef6a[_0xc07c('0x3b')]&&_0x42ef6a['UserId']){_0x42ef6a['answered']+=0x1;if(_0x42ef6a[_0xc07c('0x37')]){_0x42ef6a[_0xc07c('0x37')]-=0x1;}}if(_0x42ef6a[_0xc07c('0x3b')]&&!_0x42ef6a[_0xc07c('0x3a')]){_0x42ef6a['unmanaged']+=0x1;if(_0x42ef6a['waiting']){_0x42ef6a[_0xc07c('0x36')]-=0x1;}}_0x42ef6a['total']+=0x1;_0x475a05(_0x42ef6a);});}exports[_0xc07c('0x3c')]=function(_0x58f581,_0x447727){var _0x5708a3={},_0xe9e9af={},_0x2c905e={'count':0x0,'rows':[]};var _0xfc254f=_[_0xc07c('0x2e')](db[_0xc07c('0x3d')][_0xc07c('0x3e')],function(_0xb2bbe5){return{'name':_0xb2bbe5[_0xc07c('0x3f')],'type':_0xb2bbe5[_0xc07c('0x40')]['key']};});_0xe9e9af['model']=_[_0xc07c('0x2e')](_0xfc254f,_0xc07c('0x2b'));_0xe9e9af[_0xc07c('0x41')]=_[_0xc07c('0x42')](_0x58f581[_0xc07c('0x41')]);_0xe9e9af[_0xc07c('0x43')]=_[_0xc07c('0x44')](_0xe9e9af[_0xc07c('0x45')],_0xe9e9af[_0xc07c('0x41')]);_0x5708a3[_0xc07c('0x46')]=_[_0xc07c('0x44')](_0xe9e9af[_0xc07c('0x45')],qs[_0xc07c('0x47')](_0x58f581[_0xc07c('0x41')][_0xc07c('0x47')]));_0x5708a3['attributes']=_0x5708a3[_0xc07c('0x46')][_0xc07c('0x48')]?_0x5708a3[_0xc07c('0x46')]:_0xe9e9af[_0xc07c('0x45')];if(!_0x58f581[_0xc07c('0x41')][_0xc07c('0x49')]('nolimit')){_0x5708a3['limit']=qs[_0xc07c('0x23')](_0x58f581['query']['limit']);_0x5708a3[_0xc07c('0x21')]=qs[_0xc07c('0x21')](_0x58f581[_0xc07c('0x41')][_0xc07c('0x21')]);}_0x5708a3['order']=qs[_0xc07c('0x4a')](_0x58f581[_0xc07c('0x41')]['sort']);_0x5708a3[_0xc07c('0x4b')]=qs[_0xc07c('0x43')](_['pick'](_0x58f581[_0xc07c('0x41')],_0xe9e9af['filters']),_0xfc254f);var _0x134178=[];var _0x590ab1=squel[_0xc07c('0x4c')]()[_0xc07c('0x4d')]('id')[_0xc07c('0x4d')]('name')[_0xc07c('0x4d')](_0xc07c('0x4e'))['from'](_0xc07c('0x4f'));var _0xcadbce=squel[_0xc07c('0x4c')]()['field']('u.id')[_0xc07c('0x4d')](_0xc07c('0x50'))[_0xc07c('0x4d')](_0xc07c('0x51'))[_0xc07c('0x52')](_0xc07c('0x53'),'ui')['left_join'](_0xc07c('0x54'),'u',_0xc07c('0x55'));var _0x147ce3=squel[_0xc07c('0x4c')]()[_0xc07c('0x52')](_0xc07c('0x56'),'i')[_0xc07c('0x57')](_0xc07c('0x58'),'c',_0xc07c('0x59'))[_0xc07c('0x57')](_0xc07c('0x54'),'o',_0xc07c('0x5a'))['left_join']('fax_accounts','a',_0xc07c('0x5b'))['left_join'](_0xc07c('0x5c'),'me',_0xc07c('0x5d'))[_0xc07c('0x57')]('fax_interaction_has_tags','it',_0xc07c('0x5e'))[_0xc07c('0x57')](_0xc07c('0x4f'),'t','t.id\x20=\x20it.TagId');var _0x33aec9=squel['expr']();var _0x51f992=[];var _0x318286=squel['expr']();var _0x7b6cdc;if(_0x58f581[_0xc07c('0x41')][_0xc07c('0x5f')]){_0x7b6cdc=as[_0xc07c('0x60')](_0x58f581[_0xc07c('0x41')][_0xc07c('0x5f')]);var _0x1a5831=_0x7b6cdc[_0xc07c('0x61')];for(var _0x941737=0x0;_0x941737<_0x7b6cdc[_0xc07c('0x62')][_0xc07c('0x48')];_0x941737++){var _0x1e1968=_0x7b6cdc[_0xc07c('0x62')][_0x941737];var _0x490b46='i';var _0x3a6f26=_[_0xc07c('0x63')](_0xfc254f,[_0xc07c('0x2b'),_0x1e1968[_0xc07c('0x4d')]]);if(!_0x3a6f26){switch(_0x1e1968[_0xc07c('0x4d')]){case _0xc07c('0x64'):if(_0x1e1968['value']==0x1){_0x147ce3['having']('`'+_0x1e1968[_0xc07c('0x4d')]+_0xc07c('0x65'));}else{_0x147ce3[_0xc07c('0x66')]('`'+_0x1e1968[_0xc07c('0x4d')]+_0xc07c('0x67'));}break;case _0xc07c('0x68'):if(_0x1e1968[_0xc07c('0x69')]===_0xc07c('0x6a')){if(_0x1e1968['value'][_0xc07c('0x32')]('\x20')['length']>0x1){_0x33aec9[_0x1a5831](_0xc07c('0x6b'),qs[_0xc07c('0x6c')](_0x1e1968[_0xc07c('0x6d')]),null);}else{var _0x3e8f06='%'+_0x1e1968[_0xc07c('0x6d')]+'%';_0x33aec9[_0x1a5831](_0xc07c('0x6e'),_0x3e8f06,_0x3e8f06,_0x3e8f06);}}else{_0x3a6f26=_[_0xc07c('0x63')](_0xfc254f,['name',_0xc07c('0x6f')]);_0x1e1968[_0xc07c('0x4d')]=_0xc07c('0x6f');_0x51d67f=as[_0xc07c('0x70')](_0x490b46,_0x3a6f26['type'],_0x1e1968);_0x33aec9[_0x1a5831](_0x51d67f['text'],_0x51d67f['value'][_0xc07c('0x71')],_0x51d67f['value'][_0xc07c('0x1f')]);}break;case _0xc07c('0x72'):var _0x2252ba=_0x1e1968[_0xc07c('0x6d')][_0xc07c('0x32')](',')['map'](function(_0x59ffbc){return Number(_0x59ffbc);});_0x2252ba['forEach'](function(_0x3c17a1){_0x318286['or'](_0xc07c('0x73'),'%,'+_0x3c17a1+',%');});_0x51f992=_[_0xc07c('0x74')](_0x51f992,_0x2252ba);break;case'User':if(_0x1e1968[_0xc07c('0x69')]===_0xc07c('0x6a')){_0x33aec9[_0x1a5831]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x1e1968[_0xc07c('0x6d')]+'%',null);}else{_0x3a6f26=_[_0xc07c('0x63')](_0xfc254f,[_0xc07c('0x2b'),_0xc07c('0x3a')]);_0x1e1968['field']=_0xc07c('0x3a');_0x51d67f=as[_0xc07c('0x70')](_0x490b46,_0x3a6f26[_0xc07c('0x40')],_0x1e1968);_0x33aec9[_0x1a5831](_0x51d67f['text'],_0x51d67f[_0xc07c('0x6d')][_0xc07c('0x71')],_0x51d67f['value'][_0xc07c('0x1f')]);}break;case _0xc07c('0x75'):_0x51d67f=as[_0xc07c('0x70')]('me',null,_0x1e1968);_0x33aec9[_0x1a5831](_0x51d67f[_0xc07c('0x76')],_0x51d67f[_0xc07c('0x6d')][_0xc07c('0x71')],_0x51d67f[_0xc07c('0x6d')][_0xc07c('0x1f')]);break;}}else{var _0x51d67f=as[_0xc07c('0x70')](_0x490b46,_0x3a6f26[_0xc07c('0x40')],_0x1e1968);_0x33aec9[_0x1a5831](_0x51d67f[_0xc07c('0x76')],_0x51d67f['value'][_0xc07c('0x71')],_0x51d67f[_0xc07c('0x6d')][_0xc07c('0x1f')]);}}}else{var _0x1d4a95=_(_0x58f581[_0xc07c('0x41')])['keys']()[_0xc07c('0x2e')](function(_0x3edc60){return _[_0xc07c('0x77')](_0xfc254f,[_0xc07c('0x2b'),_0x3edc60])?_0x3edc60:undefined;})[_0xc07c('0x78')]()['value']();if(!_[_0xc07c('0x79')](_0x1d4a95)){_0x1d4a95[_0xc07c('0x33')](function(_0x1b55e8){if(_0x1b55e8===_0xc07c('0x7a')){_0x147ce3[_0xc07c('0x4b')](_0xc07c('0x7b'),[][_0xc07c('0x7c')](_0x58f581[_0xc07c('0x41')][_0x1b55e8]));}else if(_0x1b55e8==='createdAt'){var _0x45451a=JSON[_0xc07c('0x7d')](_0x58f581[_0xc07c('0x41')][_0x1b55e8])['$gte'];var _0xf42424=JSON[_0xc07c('0x7d')](_0x58f581[_0xc07c('0x41')][_0x1b55e8])[_0xc07c('0x7e')];_0x147ce3[_0xc07c('0x4b')](_0xc07c('0x7f'),_0x45451a,_0xf42424);}else{if(_0x58f581[_0xc07c('0x41')][_0x1b55e8]===_0xc07c('0x80')){_0x147ce3['where']('i.'+_0x1b55e8+_0xc07c('0x81'));}else{_0x147ce3[_0xc07c('0x4b')]('i.'+_0x1b55e8+_0xc07c('0x82'),_0x58f581[_0xc07c('0x41')][_0x1b55e8]);}}});}if(_0x58f581[_0xc07c('0x41')][_0xc07c('0x83')]){if(_0x58f581['query'][_0xc07c('0x83')]==0x1){_0x147ce3['having'](_0xc07c('0x84'));}else{_0x147ce3[_0xc07c('0x66')](_0xc07c('0x85'));}}if(_0x58f581[_0xc07c('0x41')][_0xc07c('0x86')]){_0x51f992=_['isArray'](_0x58f581['query'][_0xc07c('0x86')])?_0x58f581[_0xc07c('0x41')]['tag']:new Array(_0x58f581[_0xc07c('0x41')][_0xc07c('0x86')]);_0x51f992[_0xc07c('0x33')](function(_0x5bf8bc){_0x318286['or'](_0xc07c('0x73'),'%,'+_0x5bf8bc+',%');});}if(_0x58f581[_0xc07c('0x41')]['filter']){var _0x492d5e=_0x58f581['query']['filter'][_0xc07c('0x87')]('\x5c','\x5c\x5c')[_0xc07c('0x87')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x492d5e)){_0x33aec9['or']('i.id\x20LIKE\x20?',_0x492d5e+'%')['or'](_0xc07c('0x88'),_0x492d5e+'%');}_0x33aec9['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x492d5e+'%');}}_0x147ce3[_0xc07c('0x4b')](_0x33aec9);_0x147ce3[_0xc07c('0x89')]('i.id');var _0xca4221={'type':db[_0xc07c('0x8a')][_0xc07c('0x8b')]['SELECT'],'raw':!![]};var _0x33d86c=_0x147ce3['clone']();_0x33d86c['field'](_0xc07c('0x8c'));_0x33d86c[_0xc07c('0x4d')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xc07c('0x64'));if(_0x5708a3[_0xc07c('0x8d')]){_0x5708a3[_0xc07c('0x8d')][_0xc07c('0x33')](function(_0x46debc){var _0x3a97ec=_0x46debc[0x0]===_0xc07c('0x8e')?_0x46debc[0x0]:'i.'+_0x46debc[0x0];_0x147ce3[_0xc07c('0x8d')](_0x3a97ec,_0x46debc[0x1]==='DESC'?![]:!![]);});}if(!_['isEmpty'](_0x51f992)){_0x147ce3['having'](_0x318286);_0x33d86c['where']('t.id\x20IN\x20?',_0x51f992);}BPromise[_0xc07c('0x8f')]()[_0xc07c('0x29')](function(){if(!_0x7b6cdc){if(_0x58f581['query'][_0xc07c('0x7a')])return;_0x33d86c[_0xc07c('0x4b')](_0xc07c('0x90'));_0x147ce3['where']('i.FaxAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x58f581['user'][_0xc07c('0x91')]!==_0xc07c('0x92'))return;return _0x58f581[_0xc07c('0x93')][_0xc07c('0x94')]({'attributes':['id'],'raw':!![]})['then'](function(_0x11e067){if(_['isEmpty'](_0x11e067)){_0x33d86c['where']('i.FaxAccountId\x20IS\x20NULL');_0x147ce3[_0xc07c('0x4b')](_0xc07c('0x95'));}else{_0x33d86c[_0xc07c('0x4b')](_0xc07c('0x7b'),_[_0xc07c('0x2e')](_0x11e067,'id'));_0x147ce3[_0xc07c('0x4b')](_0xc07c('0x7b'),_['map'](_0x11e067,'id'));}});})[_0xc07c('0x29')](function(){if(_0x58f581[_0xc07c('0x93')][_0xc07c('0x91')]===_0xc07c('0x92')&&!_0x7b6cdc&&!_0x58f581['query'][_0xc07c('0x7a')])return[];return db[_0xc07c('0x96')][_0xc07c('0x41')](_0x33d86c[_0xc07c('0x97')](),_0xca4221);})[_0xc07c('0x29')](function(_0x41772a){_0x2c905e[_0xc07c('0x24')]=_0x41772a[_0xc07c('0x48')];if(_0x2c905e['count']===0x0)return[];return db[_0xc07c('0x96')][_0xc07c('0x41')](_0x590ab1[_0xc07c('0x97')](),_0xca4221)['then'](function(_0x5b8643){_0x134178=_[_0xc07c('0x98')](_0x5b8643,'id');_0xca4221=_[_0xc07c('0x99')](_0xca4221,{'model':db[_0xc07c('0x3d')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x58f581['query'][_0xc07c('0x47')]){_0x5708a3[_0xc07c('0x46')][_0xc07c('0x33')](function(_0x30b74f){_0x147ce3['field']('i.'+_0x30b74f);});}else{_0x147ce3[_0xc07c('0x4d')](_0xc07c('0x9a'),_0xc07c('0x64'));_0x147ce3['field'](_0xc07c('0x9b'),_0xc07c('0x9c'));_0x147ce3[_0xc07c('0x4d')]('a.mandatoryDisposition',_0xc07c('0x9d'));_0x147ce3[_0xc07c('0x4d')](_0xc07c('0x9e'),_0xc07c('0x8e'));_0x147ce3['field'](_0xc07c('0x9f'));_0x147ce3[_0xc07c('0x4d')](_0xc07c('0xa0'),_0xc07c('0xa1'));_0x147ce3[_0xc07c('0x4d')]('c.lastName',_0xc07c('0xa2'));_0x147ce3[_0xc07c('0x4d')]('c.email','Contact.email');_0x147ce3[_0xc07c('0x4d')](_0xc07c('0xa3'),_0xc07c('0xa4'));_0x147ce3[_0xc07c('0x4d')]('c.mobile','Contact.mobile');_0x147ce3['field'](_0xc07c('0xa5'),_0xc07c('0xa6'));_0x147ce3[_0xc07c('0x4d')](_0xc07c('0xa7'),_0xc07c('0xa8'));_0x147ce3[_0xc07c('0x4d')](_0xc07c('0xa9'),_0xc07c('0xaa'));_0x147ce3[_0xc07c('0x4d')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0xc07c('0x31'));}if(_0x5708a3[_0xc07c('0x23')])_0x147ce3[_0xc07c('0x23')](_0x5708a3[_0xc07c('0x23')]);if(_0x5708a3[_0xc07c('0x21')])_0x147ce3['offset'](_0x5708a3[_0xc07c('0x21')]);return db['sequelize'][_0xc07c('0x41')](_0x147ce3[_0xc07c('0x97')](),_0xca4221);})[_0xc07c('0x29')](function(_0xdaa37a){if(_0xdaa37a[_0xc07c('0x48')]>0x0)_0xcadbce[_0xc07c('0x4b')](_0xc07c('0xab'),_[_0xc07c('0x2e')](_0xdaa37a,'id'));return db[_0xc07c('0x96')][_0xc07c('0x41')](_0xcadbce[_0xc07c('0x97')](),_0xca4221)[_0xc07c('0x29')](function(_0x3ef1f3){var _0x49c223=_[_0xc07c('0xac')](_0x3ef1f3,_0xc07c('0xad'));var _0x381be9=[];_0xdaa37a[_0xc07c('0x33')](function(_0x488db6){_0x381be9[_0xc07c('0x34')](updateFaxInteraction(_0x488db6,_0x134178,_0x49c223));});return BPromise[_0xc07c('0xae')](_0x381be9);});});})[_0xc07c('0x29')](function(_0x27588e){_0x2c905e['rows']=_0x27588e;return _0x2c905e;})[_0xc07c('0x29')](respondWithFilteredResult(_0x447727,_0x5708a3))[_0xc07c('0x35')](handleError(_0x447727,null));};exports[_0xc07c('0xaf')]=function(_0x154d64,_0x45d737){var _0x2ac46b={'raw':![],'where':{'id':_0x154d64[_0xc07c('0xb0')]['id']}},_0xdc0a62={};_0xdc0a62[_0xc07c('0x45')]=_[_0xc07c('0x42')](db[_0xc07c('0x3d')][_0xc07c('0x3e')]);_0xdc0a62[_0xc07c('0x41')]=_[_0xc07c('0x42')](_0x154d64[_0xc07c('0x41')]);_0xdc0a62[_0xc07c('0x43')]=_[_0xc07c('0x44')](_0xdc0a62[_0xc07c('0x45')],_0xdc0a62[_0xc07c('0x41')]);_0x2ac46b[_0xc07c('0x46')]=_[_0xc07c('0x44')](_0xdc0a62['model'],qs['fields'](_0x154d64[_0xc07c('0x41')][_0xc07c('0x47')]));_0x2ac46b['attributes']=_0x2ac46b[_0xc07c('0x46')][_0xc07c('0x48')]?_0x2ac46b[_0xc07c('0x46')]:_0xdc0a62[_0xc07c('0x45')];if(_0x154d64[_0xc07c('0x41')]['includeAll']){_0x2ac46b['include']=[{'all':!![]}];}_0x2ac46b=_[_0xc07c('0x99')]({},_0x2ac46b,_0x154d64[_0xc07c('0xb1')]);return db[_0xc07c('0x3d')][_0xc07c('0x63')](_0x2ac46b)[_0xc07c('0x29')](handleEntityNotFound(_0x45d737,null))['then'](respondWithResult(_0x45d737,null))['catch'](handleError(_0x45d737,null));};exports[_0xc07c('0xb2')]=function(_0x1bb6e5,_0x1a3585){return db[_0xc07c('0x3d')][_0xc07c('0xb2')](_0x1bb6e5[_0xc07c('0x75')],{})[_0xc07c('0x29')](respondWithResult(_0x1a3585,0xc9))[_0xc07c('0x35')](handleError(_0x1a3585,null));};exports[_0xc07c('0x28')]=function(_0x7d870b,_0xba1165){if(_0x7d870b['body']['id']){delete _0x7d870b[_0xc07c('0x75')]['id'];}return db[_0xc07c('0x3d')]['find']({'where':{'id':_0x7d870b[_0xc07c('0xb0')]['id']}})[_0xc07c('0x29')](handleEntityNotFound(_0xba1165,null))[_0xc07c('0x29')](saveUpdates(_0x7d870b[_0xc07c('0x75')],null))['then'](respondWithResult(_0xba1165,null))[_0xc07c('0x35')](handleError(_0xba1165,null));};exports[_0xc07c('0xb3')]=function(_0x14d050,_0x51d161){return db['FaxInteraction']['find']({'where':{'id':_0x14d050['params']['id']}})[_0xc07c('0x29')](handleEntityNotFound(_0x51d161,null))[_0xc07c('0x29')](removeEntity(_0x51d161,null))[_0xc07c('0x35')](handleError(_0x51d161,null));};exports[_0xc07c('0xb4')]=function(_0x4c0b86,_0x30af3b){return db[_0xc07c('0x3d')]['describe']()[_0xc07c('0x29')](respondWithResult(_0x30af3b,null))['catch'](handleError(_0x30af3b,null));};exports[_0xc07c('0xb5')]=function(_0x3b908d,_0x53abbc,_0x45e7c4){return db[_0xc07c('0xb6')]['find']({'where':{'id':_0x3b908d['params']['id']}})['then'](handleEntityNotFound(_0x53abbc,null))[_0xc07c('0x29')](function(_0x4bbc21){if(_0x4bbc21){return _0x4bbc21['addMessage'](_0x3b908d[_0xc07c('0x75')][_0xc07c('0xb7')],_[_0xc07c('0xb8')](_0x3b908d[_0xc07c('0x75')],[_0xc07c('0xb7'),'id'])||{});}})[_0xc07c('0x29')](respondWithResult(_0x53abbc,null))[_0xc07c('0x35')](handleError(_0x53abbc,null));};exports[_0xc07c('0xb9')]=function(_0x347209,_0x26f5bc,_0x10bde0){var _0x35bcde={'raw':![],'where':{}};var _0x2b65a8={};var _0x58ac5e={'count':0x0,'rows':[]};return db['FaxInteraction'][_0xc07c('0xba')]({'where':{'id':_0x347209[_0xc07c('0xb0')]['id']}})[_0xc07c('0x29')](handleEntityNotFound(_0x26f5bc,null))[_0xc07c('0x29')](function(_0x5700b5){if(_0x5700b5){_0x2b65a8[_0xc07c('0x45')]=_['keys'](db[_0xc07c('0xb6')][_0xc07c('0x3e')]);_0x2b65a8['query']=_[_0xc07c('0x42')](_0x347209['query']);_0x2b65a8[_0xc07c('0x43')]=_[_0xc07c('0x44')](_0x2b65a8[_0xc07c('0x45')],_0x2b65a8[_0xc07c('0x41')]);_0x35bcde[_0xc07c('0x46')]=_[_0xc07c('0x44')](_0x2b65a8['model'],qs[_0xc07c('0x47')](_0x347209[_0xc07c('0x41')]['fields']));_0x35bcde[_0xc07c('0x46')]=_0x35bcde[_0xc07c('0x46')][_0xc07c('0x48')]?_0x35bcde[_0xc07c('0x46')]:_0x2b65a8['model'];if(!_0x347209[_0xc07c('0x41')]['hasOwnProperty'](_0xc07c('0xbb'))){_0x35bcde[_0xc07c('0x23')]=qs[_0xc07c('0x23')](_0x347209[_0xc07c('0x41')][_0xc07c('0x23')]);_0x35bcde['offset']=qs[_0xc07c('0x21')](_0x347209['query']['offset']);}_0x35bcde['order']=qs[_0xc07c('0x4a')](_0x347209[_0xc07c('0x41')]['sort']);_0x35bcde[_0xc07c('0x4b')]=qs[_0xc07c('0x43')](_['pick'](_0x347209[_0xc07c('0x41')],_0x2b65a8[_0xc07c('0x43')]));_0x35bcde[_0xc07c('0x4b')]['FaxInteractionId']=_0x5700b5['id'];if(_0x347209[_0xc07c('0x41')][_0xc07c('0xbc')]){_0x35bcde[_0xc07c('0x4b')]=_[_0xc07c('0x99')](_0x35bcde['where'],{'$or':_[_0xc07c('0x2e')](_0x35bcde[_0xc07c('0x46')],function(_0x22a123){var _0xb7861d={};_0xb7861d[_0x22a123]={'$like':'%'+_0x347209[_0xc07c('0x41')][_0xc07c('0xbc')]+'%'};return _0xb7861d;})});}if(_0x347209['query'][_0xc07c('0xbd')]){var _0x4f0f17=_0x347209[_0xc07c('0x41')][_0xc07c('0xbd')][_0xc07c('0x32')](',');var _0x4d6333={};_0x4d6333[_0x4f0f17[0x0]]={'$gte':moment(_0x4f0f17[0x1])[_0xc07c('0xbe')](_0xc07c('0xbf'))};_0x35bcde[_0xc07c('0x4b')]=_[_0xc07c('0x99')](_0x35bcde[_0xc07c('0x4b')],_0x4d6333);}_0x35bcde=_[_0xc07c('0x99')]({},_0x35bcde,_0x347209[_0xc07c('0xb1')]);return db[_0xc07c('0xb6')]['count']({'where':_0x35bcde[_0xc07c('0x4b')]})['then'](function(_0x19f5e9){_0x58ac5e['count']=_0x19f5e9;if(_0x347209[_0xc07c('0x41')][_0xc07c('0xc0')]){_0x35bcde[_0xc07c('0xc1')]=[{'all':!![]}];}return db[_0xc07c('0xb6')]['findAll'](_0x35bcde);})[_0xc07c('0x29')](function(_0x23edf4){_0x58ac5e[_0xc07c('0xc2')]=_0x23edf4;return _0x58ac5e;});}})[_0xc07c('0x29')](respondWithFilteredResult(_0x26f5bc,_0x35bcde))[_0xc07c('0x35')](handleError(_0x26f5bc,null));};exports[_0xc07c('0xc3')]=function(_0x2e3525,_0x433e6b,_0x561308){return db['FaxInteraction'][_0xc07c('0x63')]({'where':{'id':_0x2e3525[_0xc07c('0xb0')]['id']}})[_0xc07c('0x29')](handleEntityNotFound(_0x433e6b,null))[_0xc07c('0x29')](function(_0x4d3bc2){if(_0x4d3bc2){return _0x4d3bc2['setTags'](_0x2e3525[_0xc07c('0x75')][_0xc07c('0xb7')],_[_0xc07c('0xb8')](_0x2e3525[_0xc07c('0x75')],[_0xc07c('0xb7'),'id'])||{})[_0xc07c('0xc4')](function(){return db[_0xc07c('0x72')][_0xc07c('0xc5')]({'attributes':['id',_0xc07c('0x2b'),_0xc07c('0x4e')],'where':{'id':_0x2e3525[_0xc07c('0x75')][_0xc07c('0xb7')]}});})[_0xc07c('0x29')](function(_0x51cd48){socket[_0xc07c('0xc6')](_0xc07c('0xc7'),{'id':Number(_0x2e3525[_0xc07c('0xb0')]['id']),'tags':_0x51cd48||[]});return{'id':Number(_0x2e3525[_0xc07c('0xb0')]['id']),'tags':_0x51cd48||[]};});}})[_0xc07c('0x29')](respondWithResult(_0x433e6b,null))[_0xc07c('0x35')](handleError(_0x433e6b,null));};exports['removeTags']=function(_0x419f90,_0x198193,_0x39a5d6){return db[_0xc07c('0x3d')][_0xc07c('0x63')]({'where':{'id':_0x419f90[_0xc07c('0xb0')]['id']}})[_0xc07c('0x29')](handleEntityNotFound(_0x198193,null))[_0xc07c('0x29')](function(_0x4cb960){if(_0x4cb960){return _0x4cb960['removeTags'](_0x419f90[_0xc07c('0x41')]['ids']);}})[_0xc07c('0x29')](respondWithStatusCode(_0x198193,null))[_0xc07c('0x35')](handleError(_0x198193,null));};exports[_0xc07c('0xc8')]=function(_0x377475,_0x4a1090){var _0x47f9ae=moment()[_0xc07c('0xc9')]()[_0xc07c('0x97')]();var _0x3cde92=path['join'](config['root'],_0xc07c('0xca'),_0xc07c('0xcb'),'tmp');var _0x3b9c7f=path[_0xc07c('0xcc')](config[_0xc07c('0xcd')],_0xc07c('0xca'),'files',_0xc07c('0xce'));var _0xbf42ec=path['join'](_0x3cde92,_0x47f9ae);var _0x136b3c=util[_0xc07c('0xbe')](_0xc07c('0xcf'),_0x377475['params']['id'],_0x47f9ae);var _0x31d560=path[_0xc07c('0xcc')](_0x3cde92,_0x136b3c);var _0x4e50a6=[];_0x4e50a6['push']({'model':db['Attachment'],'as':_0xc07c('0xd0'),'raw':!![]});var _0x3f44fc=[{'model':db[_0xc07c('0xb6')],'as':_0xc07c('0xd1'),'attributes':['id',_0xc07c('0x75'),_0xc07c('0xd2')],'include':_0x4e50a6}];return db[_0xc07c('0x3d')]['find']({'where':{'id':_0x377475['params']['id']},'include':_0x3f44fc})[_0xc07c('0x29')](handleEntityNotFound(_0x4a1090,null))[_0xc07c('0x29')](function(_0x125ecd){if(_0x125ecd&&_0x125ecd[_0xc07c('0xd1')]){var _0x213bb2=_0x125ecd['get']({'plain':!![]});fs[_0xc07c('0xd3')](_0xbf42ec);for(var _0x1d7e68=0x0;_0x1d7e68<_0x213bb2[_0xc07c('0xd1')][_0xc07c('0x48')];_0x1d7e68++){var _0x1a4047=_0x213bb2[_0xc07c('0xd1')][_0x1d7e68][_0xc07c('0xd0')];if(_0x1a4047){var _0x3f93e5=path[_0xc07c('0xcc')](_0x3b9c7f,_0x1a4047['basename']);if(fs[_0xc07c('0xd4')](_0x3f93e5)){fs[_0xc07c('0xd5')](_0x3f93e5)['pipe'](fs[_0xc07c('0xd6')](path[_0xc07c('0xcc')](_0xbf42ec,_0x1a4047[_0xc07c('0xd7')])));}}}return BPromise['resolve']()[_0xc07c('0x29')](function(){return new BPromise(function(_0x5b5e82,_0x4b960e){zipdir(_0xbf42ec,{'saveTo':_0x31d560},function(_0x32d782,_0xd0627d){if(_0x32d782)return _0x4b960e(_0x32d782);return _0x5b5e82(_0xd0627d);});})[_0xc07c('0x29')](function(){return new BPromise(function(_0x45a7ce,_0x23ba00){rimraf(_0xbf42ec,function(_0x17ca77){if(_0x17ca77)_0x23ba00(_0x17ca77);return _0x45a7ce();});});})[_0xc07c('0x29')](function(){return _0x4a1090['download'](_0x31d560,_0x136b3c,function(_0x4de08e){if(_0x4de08e){console[_0xc07c('0xd8')](_0xc07c('0xd9'),_0x4de08e);}else{fs[_0xc07c('0xda')](_0x31d560);}});});});}else{return _0x4a1090[_0xc07c('0x1d')](0xc8);}})[_0xc07c('0x35')](handleError(_0x4a1090,null));}; \ No newline at end of file +var _0x5e7d=['tools_tags','t.id\x20=\x20it.TagId','expr','search','find','unreadMessages','value','having','`\x20>\x200','Contact','operator','$substring','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','text','body','some','FaxAccountId','where','i.FaxAccountId\x20IN\x20?','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','QueryTypes','SELECT','clone','contactName','isEmpty','resolve','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','c.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','all','rows','show','params','model','rawAttributes','fields','includeAll','include','create','describe','addMessage','ids','omit','findOne','FaxMessage','hasOwnProperty','format','YYYY-MM-DD\x20HH:mm:ss','options','findAll','addTags','setTags','faxInteractionTags:save','removeTags','download','unix','join','root','files','server','attachments','transcript-%d-%s.zip','push','Attachment','Messages','get','mkdirSync','basename','existsSync','pipe','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','destroy','stack','name','send','Users','map','TagIds','Tags','forEach','catch','talking','answered','unmanaged','total','closed','UserId','waiting','index','FaxInteraction','type','key','keys','query','filters','intersection','attributes','length','nolimit','order','sort','pick','select','field','color','from','ui.FaxInteractionId','left_join','u.id\x20=\x20ui.UserId','fax_interactions','cm_contacts','o.id\x20=\x20i.UserId','fax_accounts','a.id\x20=\x20i.FaxAccountId','fax_messages','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id'];(function(_0x3efc2b,_0x30e89e){var _0x143578=function(_0x506c2d){while(--_0x506c2d){_0x3efc2b['push'](_0x3efc2b['shift']());}};_0x143578(++_0x30e89e);}(_0x5e7d,0x15f));var _0xd5e7=function(_0x367336,_0x18c229){_0x367336=_0x367336-0x0;var _0x3423a7=_0x5e7d[_0x367336];return _0x3423a7;};'use strict';var emlformat=require(_0xd5e7('0x0'));var rimraf=require(_0xd5e7('0x1'));var zipdir=require(_0xd5e7('0x2'));var jsonpatch=require(_0xd5e7('0x3'));var rp=require(_0xd5e7('0x4'));var moment=require(_0xd5e7('0x5'));var BPromise=require(_0xd5e7('0x6'));var Mustache=require(_0xd5e7('0x7'));var util=require(_0xd5e7('0x8'));var path=require(_0xd5e7('0x9'));var sox=require(_0xd5e7('0xa'));var csv=require(_0xd5e7('0xb'));var ejs=require(_0xd5e7('0xc'));var fs=require('fs');var fs_extra=require(_0xd5e7('0xd'));var _=require(_0xd5e7('0xe'));var squel=require(_0xd5e7('0xf'));var crypto=require('crypto');var jsforce=require(_0xd5e7('0x10'));var deskjs=require(_0xd5e7('0x11'));var toCsv=require(_0xd5e7('0xb'));var querystring=require(_0xd5e7('0x12'));var Papa=require(_0xd5e7('0x13'));var Redis=require(_0xd5e7('0x14'));var authService=require(_0xd5e7('0x15'));var qs=require(_0xd5e7('0x16'));var as=require(_0xd5e7('0x17'));var hardwareService=require(_0xd5e7('0x18'));var logger=require(_0xd5e7('0x19'))(_0xd5e7('0x1a'));var utils=require(_0xd5e7('0x1b'));var config=require(_0xd5e7('0x1c'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xd5e7('0x1d')]=_['defaults'](config['redis'],{'host':_0xd5e7('0x1e'),'port':0x18eb});var socket=require(_0xd5e7('0x1f'))(new Redis(config['redis']));require(_0xd5e7('0x20'))[_0xd5e7('0x21')](socket);function respondWithStatusCode(_0x41d3fb,_0x4933a3){_0x4933a3=_0x4933a3||0xcc;return function(_0x250aaa){if(_0x250aaa){return _0x41d3fb[_0xd5e7('0x22')](_0x4933a3);}return _0x41d3fb[_0xd5e7('0x23')](_0x4933a3)[_0xd5e7('0x24')]();};}function respondWithResult(_0x4bebde,_0x5fce4c){_0x5fce4c=_0x5fce4c||0xc8;return function(_0x5175a5){if(_0x5175a5){return _0x4bebde['status'](_0x5fce4c)['json'](_0x5175a5);}};}function respondWithFilteredResult(_0xa205dd,_0x5290bc){return function(_0x481966){if(_0x481966){var _0x570735=typeof _0x5290bc[_0xd5e7('0x25')]===_0xd5e7('0x26')&&typeof _0x5290bc[_0xd5e7('0x27')]===_0xd5e7('0x26');var _0x571d72=_0x481966[_0xd5e7('0x28')];var _0x2f0158=_0x570735?0x0:_0x5290bc[_0xd5e7('0x25')];var _0x256950=_0x570735?_0x481966[_0xd5e7('0x28')]:_0x5290bc[_0xd5e7('0x25')]+_0x5290bc['limit'];var _0x1e25f6;if(_0x256950>=_0x571d72){_0x256950=_0x571d72;_0x1e25f6=0xc8;}else{_0x1e25f6=0xce;}_0xa205dd[_0xd5e7('0x23')](_0x1e25f6);return _0xa205dd[_0xd5e7('0x29')](_0xd5e7('0x2a'),_0x2f0158+'-'+_0x256950+'/'+_0x571d72)[_0xd5e7('0x2b')](_0x481966);}return null;};}function patchUpdates(_0x5e52aa){return function(_0x4daf8b){try{jsonpatch['apply'](_0x4daf8b,_0x5e52aa,!![]);}catch(_0x523935){return BPromise[_0xd5e7('0x2c')](_0x523935);}return _0x4daf8b[_0xd5e7('0x2d')]();};}function saveUpdates(_0x4a3c6e,_0x1cb89a){return function(_0x451afa){if(_0x451afa){return _0x451afa[_0xd5e7('0x2e')](_0x4a3c6e)[_0xd5e7('0x2f')](function(_0x450cb0){return _0x450cb0;});}return null;};}function removeEntity(_0xaab16d,_0x552021){return function(_0x32a9b0){if(_0x32a9b0){return _0x32a9b0[_0xd5e7('0x30')]()[_0xd5e7('0x2f')](function(){_0xaab16d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x11140e,_0x34058b){return function(_0x46db32){if(!_0x46db32){_0x11140e[_0xd5e7('0x22')](0x194);}return _0x46db32;};}function handleError(_0xe5df6d,_0xd3deea){_0xd3deea=_0xd3deea||0x1f4;return function(_0x51d1e6){logger['error'](_0x51d1e6[_0xd5e7('0x31')]);if(_0x51d1e6[_0xd5e7('0x32')]){delete _0x51d1e6[_0xd5e7('0x32')];}_0xe5df6d['status'](_0xd3deea)[_0xd5e7('0x33')](_0x51d1e6);};}function getInteractionUsers(_0x25faa9,_0x3d85e5){return new BPromise(function(_0x3730f6,_0x4747d4){try{if(_0x3d85e5[_0x25faa9['id']]){_0x25faa9[_0xd5e7('0x34')]=_[_0xd5e7('0x35')](_0x3d85e5[_0x25faa9['id']],function(_0x4a8b77){return{'id':_0x4a8b77['id'],'fullname':_0x4a8b77['fullname']};});}}catch(_0x2091df){_0x4747d4(_0x2091df);}_0x3730f6(_0x25faa9);});}function getInteractionTags(_0x108d1d,_0x4efbdb){return new BPromise(function(_0xa5ff39,_0x48c0f6){try{if(_0x108d1d[_0xd5e7('0x36')]){_0x108d1d[_0xd5e7('0x37')]=[];_0x108d1d[_0xd5e7('0x36')]['split'](',')[_0xd5e7('0x38')](function(_0x2ed06d){_0x108d1d[_0xd5e7('0x37')]['push'](_0x4efbdb[_0x2ed06d]);});}delete _0x108d1d[_0xd5e7('0x36')];}catch(_0x5c1959){_0x48c0f6(_0x5c1959);}_0xa5ff39(_0x108d1d);});}function updateFaxInteraction(_0x449019,_0x2b5e03,_0x1d9b93){return new BPromise(function(_0x2c8b72,_0x3d8426){return getInteractionUsers(_0x449019,_0x1d9b93)['then'](function(_0x400d66){return getInteractionTags(_0x400d66,_0x2b5e03);})[_0xd5e7('0x2f')](function(_0x1b0098){return getStateInteraction(_0x1b0098);})['then'](function(_0x33f94c){_0x2c8b72(_0x33f94c);})[_0xd5e7('0x39')](function(_0x4a1a83){_0x3d8426(_0x4a1a83);});});}function getStateInteraction(_0x91f2ac){return new BPromise(function(_0x144af4){_0x91f2ac['waiting']=0x0;_0x91f2ac[_0xd5e7('0x3a')]=0x0;_0x91f2ac[_0xd5e7('0x3b')]=0x0;_0x91f2ac[_0xd5e7('0x3c')]=0x0;_0x91f2ac[_0xd5e7('0x3d')]=0x0;if(!_0x91f2ac[_0xd5e7('0x3e')]&&!_0x91f2ac[_0xd5e7('0x3f')]){_0x91f2ac[_0xd5e7('0x40')]+=0x1;}if(!_0x91f2ac[_0xd5e7('0x3e')]&&_0x91f2ac[_0xd5e7('0x3f')]){_0x91f2ac[_0xd5e7('0x3a')]+=0x1;if(_0x91f2ac[_0xd5e7('0x40')]){_0x91f2ac[_0xd5e7('0x40')]-=0x1;}}if(_0x91f2ac['closed']&&_0x91f2ac['UserId']){_0x91f2ac[_0xd5e7('0x3b')]+=0x1;if(_0x91f2ac['talking']){_0x91f2ac[_0xd5e7('0x3a')]-=0x1;}}if(_0x91f2ac[_0xd5e7('0x3e')]&&!_0x91f2ac[_0xd5e7('0x3f')]){_0x91f2ac[_0xd5e7('0x3c')]+=0x1;if(_0x91f2ac[_0xd5e7('0x40')]){_0x91f2ac[_0xd5e7('0x40')]-=0x1;}}_0x91f2ac[_0xd5e7('0x3d')]+=0x1;_0x144af4(_0x91f2ac);});}exports[_0xd5e7('0x41')]=function(_0x420e67,_0x327062){var _0x2618ec={},_0x7b69b6={},_0x49afd2={'count':0x0,'rows':[]};var _0x27b7a3=_[_0xd5e7('0x35')](db[_0xd5e7('0x42')]['rawAttributes'],function(_0x210e66){return{'name':_0x210e66['fieldName'],'type':_0x210e66[_0xd5e7('0x43')][_0xd5e7('0x44')]};});_0x7b69b6['model']=_[_0xd5e7('0x35')](_0x27b7a3,_0xd5e7('0x32'));_0x7b69b6['query']=_[_0xd5e7('0x45')](_0x420e67[_0xd5e7('0x46')]);_0x7b69b6[_0xd5e7('0x47')]=_[_0xd5e7('0x48')](_0x7b69b6['model'],_0x7b69b6[_0xd5e7('0x46')]);_0x2618ec[_0xd5e7('0x49')]=_[_0xd5e7('0x48')](_0x7b69b6['model'],qs['fields'](_0x420e67[_0xd5e7('0x46')]['fields']));_0x2618ec[_0xd5e7('0x49')]=_0x2618ec[_0xd5e7('0x49')][_0xd5e7('0x4a')]?_0x2618ec[_0xd5e7('0x49')]:_0x7b69b6['model'];if(!_0x420e67[_0xd5e7('0x46')]['hasOwnProperty'](_0xd5e7('0x4b'))){_0x2618ec['limit']=qs[_0xd5e7('0x27')](_0x420e67['query'][_0xd5e7('0x27')]);_0x2618ec['offset']=qs['offset'](_0x420e67[_0xd5e7('0x46')]['offset']);}_0x2618ec[_0xd5e7('0x4c')]=qs[_0xd5e7('0x4d')](_0x420e67[_0xd5e7('0x46')][_0xd5e7('0x4d')]);_0x2618ec['where']=qs[_0xd5e7('0x47')](_[_0xd5e7('0x4e')](_0x420e67[_0xd5e7('0x46')],_0x7b69b6[_0xd5e7('0x47')]),_0x27b7a3);var _0xec5de0=[];var _0x4cf159=squel[_0xd5e7('0x4f')]()[_0xd5e7('0x50')]('id')[_0xd5e7('0x50')](_0xd5e7('0x32'))[_0xd5e7('0x50')](_0xd5e7('0x51'))[_0xd5e7('0x52')]('tools_tags');var _0x1f9c9a=squel[_0xd5e7('0x4f')]()['field']('u.id')['field']('u.fullname')[_0xd5e7('0x50')](_0xd5e7('0x53'))['from']('user_has_fax_interactions','ui')[_0xd5e7('0x54')]('users','u',_0xd5e7('0x55'));var _0x4fdca0=squel[_0xd5e7('0x4f')]()['from'](_0xd5e7('0x56'),'i')[_0xd5e7('0x54')](_0xd5e7('0x57'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xd5e7('0x54')]('users','o',_0xd5e7('0x58'))[_0xd5e7('0x54')](_0xd5e7('0x59'),'a',_0xd5e7('0x5a'))['left_join'](_0xd5e7('0x5b'),'me',_0xd5e7('0x5c'))[_0xd5e7('0x54')](_0xd5e7('0x5d'),'it',_0xd5e7('0x5e'))[_0xd5e7('0x54')](_0xd5e7('0x5f'),'t',_0xd5e7('0x60'));var _0x4e896d=squel[_0xd5e7('0x61')]();var _0x5e28fe=[];var _0x1609b7=squel[_0xd5e7('0x61')]();var _0x536a28;if(_0x420e67[_0xd5e7('0x46')][_0xd5e7('0x62')]){_0x536a28=as['parseSearch'](_0x420e67[_0xd5e7('0x46')][_0xd5e7('0x62')]);var _0x197ed5=_0x536a28['sqlOperator'];for(var _0x2df426=0x0;_0x2df426<_0x536a28['conditions'][_0xd5e7('0x4a')];_0x2df426++){var _0x1449db=_0x536a28['conditions'][_0x2df426];var _0x42d21c='i';var _0x47b5b5=_[_0xd5e7('0x63')](_0x27b7a3,[_0xd5e7('0x32'),_0x1449db[_0xd5e7('0x50')]]);if(!_0x47b5b5){switch(_0x1449db['field']){case _0xd5e7('0x64'):if(_0x1449db[_0xd5e7('0x65')]==0x1){_0x4fdca0[_0xd5e7('0x66')]('`'+_0x1449db['field']+'`\x20=\x200');}else{_0x4fdca0[_0xd5e7('0x66')]('`'+_0x1449db[_0xd5e7('0x50')]+_0xd5e7('0x67'));}break;case _0xd5e7('0x68'):if(_0x1449db[_0xd5e7('0x69')]===_0xd5e7('0x6a')){if(_0x1449db[_0xd5e7('0x65')][_0xd5e7('0x6b')]('\x20')[_0xd5e7('0x4a')]>0x1){_0x4e896d[_0x197ed5](_0xd5e7('0x6c'),qs[_0xd5e7('0x6d')](_0x1449db[_0xd5e7('0x65')]),null);}else{var _0x5b356a='%'+_0x1449db[_0xd5e7('0x65')]+'%';_0x4e896d[_0x197ed5](_0xd5e7('0x6e'),_0x5b356a,_0x5b356a,_0x5b356a);}}else{_0x47b5b5=_[_0xd5e7('0x63')](_0x27b7a3,[_0xd5e7('0x32'),_0xd5e7('0x6f')]);_0x1449db['field']=_0xd5e7('0x6f');_0x3000b7=as[_0xd5e7('0x70')](_0x42d21c,_0x47b5b5[_0xd5e7('0x43')],_0x1449db);_0x4e896d[_0x197ed5](_0x3000b7['text'],_0x3000b7[_0xd5e7('0x65')][_0xd5e7('0x71')],_0x3000b7[_0xd5e7('0x65')][_0xd5e7('0x24')]);}break;case _0xd5e7('0x72'):var _0x281dd4=_0x1449db[_0xd5e7('0x65')]['split'](',')[_0xd5e7('0x35')](function(_0x1476e4){return Number(_0x1476e4);});_0x281dd4[_0xd5e7('0x38')](function(_0x1bab12){_0x1609b7['or'](_0xd5e7('0x73'),'%,'+_0x1bab12+',%');});_0x5e28fe=_['union'](_0x5e28fe,_0x281dd4);break;case'User':if(_0x1449db[_0xd5e7('0x69')]===_0xd5e7('0x6a')){_0x4e896d[_0x197ed5](_0xd5e7('0x74'),'%'+_0x1449db['value']+'%',null);}else{_0x47b5b5=_[_0xd5e7('0x63')](_0x27b7a3,['name',_0xd5e7('0x3f')]);_0x1449db['field']=_0xd5e7('0x3f');_0x3000b7=as['buildExpression'](_0x42d21c,_0x47b5b5[_0xd5e7('0x43')],_0x1449db);_0x4e896d[_0x197ed5](_0x3000b7[_0xd5e7('0x75')],_0x3000b7[_0xd5e7('0x65')][_0xd5e7('0x71')],_0x3000b7[_0xd5e7('0x65')][_0xd5e7('0x24')]);}break;case _0xd5e7('0x76'):_0x3000b7=as[_0xd5e7('0x70')]('me',null,_0x1449db);_0x4e896d[_0x197ed5](_0x3000b7[_0xd5e7('0x75')],_0x3000b7[_0xd5e7('0x65')][_0xd5e7('0x71')],_0x3000b7['value'][_0xd5e7('0x24')]);break;}}else{var _0x3000b7=as[_0xd5e7('0x70')](_0x42d21c,_0x47b5b5[_0xd5e7('0x43')],_0x1449db);_0x4e896d[_0x197ed5](_0x3000b7[_0xd5e7('0x75')],_0x3000b7[_0xd5e7('0x65')][_0xd5e7('0x71')],_0x3000b7[_0xd5e7('0x65')][_0xd5e7('0x24')]);}}}else{var _0x4c05f9=_(_0x420e67[_0xd5e7('0x46')])[_0xd5e7('0x45')]()[_0xd5e7('0x35')](function(_0x4cede7){return _[_0xd5e7('0x77')](_0x27b7a3,[_0xd5e7('0x32'),_0x4cede7])?_0x4cede7:undefined;})['compact']()['value']();if(!_['isEmpty'](_0x4c05f9)){_0x4c05f9[_0xd5e7('0x38')](function(_0x3dd826){if(_0x3dd826===_0xd5e7('0x78')){_0x4fdca0[_0xd5e7('0x79')](_0xd5e7('0x7a'),[]['concat'](_0x420e67[_0xd5e7('0x46')][_0x3dd826]));}else if(_0x3dd826===_0xd5e7('0x7b')){var _0xe7ad4c=JSON[_0xd5e7('0x7c')](_0x420e67[_0xd5e7('0x46')][_0x3dd826])[_0xd5e7('0x7d')];var _0x7854d9=JSON[_0xd5e7('0x7c')](_0x420e67[_0xd5e7('0x46')][_0x3dd826])['$lte'];_0x4fdca0[_0xd5e7('0x79')](_0xd5e7('0x7e'),_0xe7ad4c,_0x7854d9);}else{if(_0x420e67[_0xd5e7('0x46')][_0x3dd826]==='null'){_0x4fdca0[_0xd5e7('0x79')]('i.'+_0x3dd826+_0xd5e7('0x7f'));}else{_0x4fdca0[_0xd5e7('0x79')]('i.'+_0x3dd826+_0xd5e7('0x80'),_0x420e67[_0xd5e7('0x46')][_0x3dd826]);}}});}if(_0x420e67[_0xd5e7('0x46')][_0xd5e7('0x81')]){if(_0x420e67['query']['read']==0x1){_0x4fdca0[_0xd5e7('0x66')](_0xd5e7('0x82'));}else{_0x4fdca0[_0xd5e7('0x66')](_0xd5e7('0x83'));}}if(_0x420e67['query'][_0xd5e7('0x84')]){_0x5e28fe=_[_0xd5e7('0x85')](_0x420e67['query'][_0xd5e7('0x84')])?_0x420e67[_0xd5e7('0x46')][_0xd5e7('0x84')]:new Array(_0x420e67[_0xd5e7('0x46')][_0xd5e7('0x84')]);_0x5e28fe['forEach'](function(_0x3bb5ce){_0x1609b7['or'](_0xd5e7('0x73'),'%,'+_0x3bb5ce+',%');});}if(_0x420e67[_0xd5e7('0x46')][_0xd5e7('0x86')]){var _0x393887=_0x420e67['query']['filter'][_0xd5e7('0x87')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0xd5e7('0x88')](_0x393887)){_0x4e896d['or'](_0xd5e7('0x89'),_0x393887+'%')['or']('i.fax\x20LIKE\x20?',_0x393887+'%');}_0x4e896d['or'](_0xd5e7('0x8a'),_0x393887+'%');}}_0x4fdca0[_0xd5e7('0x79')](_0x4e896d);_0x4fdca0[_0xd5e7('0x8b')](_0xd5e7('0x8c'));var _0x9343c6={'type':db['Sequelize'][_0xd5e7('0x8d')][_0xd5e7('0x8e')],'raw':!![]};var _0x29276c=_0x4fdca0[_0xd5e7('0x8f')]();_0x29276c[_0xd5e7('0x50')](_0xd5e7('0x8c'));_0x29276c[_0xd5e7('0x50')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xd5e7('0x64'));if(_0x2618ec[_0xd5e7('0x4c')]){_0x2618ec[_0xd5e7('0x4c')][_0xd5e7('0x38')](function(_0x4e363e){var _0x35e94a=_0x4e363e[0x0]===_0xd5e7('0x90')?_0x4e363e[0x0]:'i.'+_0x4e363e[0x0];_0x4fdca0[_0xd5e7('0x4c')](_0x35e94a,_0x4e363e[0x1]==='DESC'?![]:!![]);});}if(!_[_0xd5e7('0x91')](_0x5e28fe)){_0x4fdca0[_0xd5e7('0x66')](_0x1609b7);_0x29276c['where']('t.id\x20IN\x20?',_0x5e28fe);}BPromise[_0xd5e7('0x92')]()['then'](function(){if(!_0x536a28){if(_0x420e67[_0xd5e7('0x46')][_0xd5e7('0x78')])return;_0x29276c[_0xd5e7('0x79')]('i.FaxAccountId\x20IS\x20NOT\x20NULL');_0x4fdca0['where'](_0xd5e7('0x93'));return;}if(_0x420e67[_0xd5e7('0x94')][_0xd5e7('0x95')]!==_0xd5e7('0x96'))return;return _0x420e67[_0xd5e7('0x94')][_0xd5e7('0x97')]({'attributes':['id'],'raw':!![]})[_0xd5e7('0x2f')](function(_0x257db8){if(_['isEmpty'](_0x257db8)){_0x29276c['where']('i.FaxAccountId\x20IS\x20NULL');_0x4fdca0['where'](_0xd5e7('0x98'));}else{_0x29276c['where'](_0xd5e7('0x7a'),_[_0xd5e7('0x35')](_0x257db8,'id'));_0x4fdca0[_0xd5e7('0x79')]('i.FaxAccountId\x20IN\x20?',_['map'](_0x257db8,'id'));}});})['then'](function(){if(_0x420e67[_0xd5e7('0x94')][_0xd5e7('0x95')]===_0xd5e7('0x96')&&!_0x536a28&&!_0x420e67[_0xd5e7('0x46')][_0xd5e7('0x78')])return[];return db[_0xd5e7('0x99')]['query'](_0x29276c[_0xd5e7('0x9a')](),_0x9343c6);})['then'](function(_0x458b41){_0x49afd2[_0xd5e7('0x28')]=_0x458b41[_0xd5e7('0x4a')];if(_0x49afd2['count']===0x0)return[];return db[_0xd5e7('0x99')][_0xd5e7('0x46')](_0x4cf159[_0xd5e7('0x9a')](),_0x9343c6)['then'](function(_0x16fc67){_0xec5de0=_[_0xd5e7('0x9b')](_0x16fc67,'id');_0x9343c6=_[_0xd5e7('0x9c')](_0x9343c6,{'model':db[_0xd5e7('0x42')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x420e67[_0xd5e7('0x46')]['fields']){_0x2618ec[_0xd5e7('0x49')][_0xd5e7('0x38')](function(_0x54ac30){_0x4fdca0[_0xd5e7('0x50')]('i.'+_0x54ac30);});}else{_0x4fdca0[_0xd5e7('0x50')](_0xd5e7('0x9d'),_0xd5e7('0x64'));_0x4fdca0['field'](_0xd5e7('0x9e'),'Account.key');_0x4fdca0['field'](_0xd5e7('0x9f'),_0xd5e7('0xa0'));_0x4fdca0[_0xd5e7('0x50')](_0xd5e7('0xa1'),_0xd5e7('0x90'));_0x4fdca0['field'](_0xd5e7('0xa2'));_0x4fdca0[_0xd5e7('0x50')](_0xd5e7('0xa3'),'Contact.firstName');_0x4fdca0[_0xd5e7('0x50')](_0xd5e7('0xa4'),'Contact.lastName');_0x4fdca0[_0xd5e7('0x50')](_0xd5e7('0xa5'),_0xd5e7('0xa6'));_0x4fdca0[_0xd5e7('0x50')](_0xd5e7('0xa7'),_0xd5e7('0xa8'));_0x4fdca0[_0xd5e7('0x50')](_0xd5e7('0xa9'),_0xd5e7('0xaa'));_0x4fdca0['field'](_0xd5e7('0xab'),_0xd5e7('0xac'));_0x4fdca0[_0xd5e7('0x50')](_0xd5e7('0xad'),_0xd5e7('0xae'));_0x4fdca0[_0xd5e7('0x50')](_0xd5e7('0xaf'),_0xd5e7('0xb0'));_0x4fdca0[_0xd5e7('0x50')](_0xd5e7('0xb1'),'TagIds');}if(_0x2618ec[_0xd5e7('0x27')])_0x4fdca0[_0xd5e7('0x27')](_0x2618ec[_0xd5e7('0x27')]);if(_0x2618ec[_0xd5e7('0x25')])_0x4fdca0[_0xd5e7('0x25')](_0x2618ec[_0xd5e7('0x25')]);return db[_0xd5e7('0x99')]['query'](_0x4fdca0['toString'](),_0x9343c6);})[_0xd5e7('0x2f')](function(_0x506d48){if(_0x506d48['length']>0x0)_0x1f9c9a['where'](_0xd5e7('0xb2'),_[_0xd5e7('0x35')](_0x506d48,'id'));return db[_0xd5e7('0x99')][_0xd5e7('0x46')](_0x1f9c9a[_0xd5e7('0x9a')](),_0x9343c6)['then'](function(_0x5dd928){var _0x57526a=_[_0xd5e7('0xb3')](_0x5dd928,_0xd5e7('0xb4'));var _0x49d7b1=[];_0x506d48[_0xd5e7('0x38')](function(_0x51525e){_0x49d7b1['push'](updateFaxInteraction(_0x51525e,_0xec5de0,_0x57526a));});return BPromise[_0xd5e7('0xb5')](_0x49d7b1);});});})['then'](function(_0x1fd4c0){_0x49afd2[_0xd5e7('0xb6')]=_0x1fd4c0;return _0x49afd2;})[_0xd5e7('0x2f')](respondWithFilteredResult(_0x327062,_0x2618ec))[_0xd5e7('0x39')](handleError(_0x327062,null));};exports[_0xd5e7('0xb7')]=function(_0x5d8e30,_0x6983ec){var _0x3f0df5={'raw':![],'where':{'id':_0x5d8e30[_0xd5e7('0xb8')]['id']}},_0x5572c6={};_0x5572c6[_0xd5e7('0xb9')]=_['keys'](db['FaxInteraction'][_0xd5e7('0xba')]);_0x5572c6['query']=_[_0xd5e7('0x45')](_0x5d8e30[_0xd5e7('0x46')]);_0x5572c6[_0xd5e7('0x47')]=_[_0xd5e7('0x48')](_0x5572c6[_0xd5e7('0xb9')],_0x5572c6[_0xd5e7('0x46')]);_0x3f0df5[_0xd5e7('0x49')]=_[_0xd5e7('0x48')](_0x5572c6[_0xd5e7('0xb9')],qs[_0xd5e7('0xbb')](_0x5d8e30[_0xd5e7('0x46')][_0xd5e7('0xbb')]));_0x3f0df5[_0xd5e7('0x49')]=_0x3f0df5[_0xd5e7('0x49')][_0xd5e7('0x4a')]?_0x3f0df5[_0xd5e7('0x49')]:_0x5572c6[_0xd5e7('0xb9')];if(_0x5d8e30[_0xd5e7('0x46')][_0xd5e7('0xbc')]){_0x3f0df5[_0xd5e7('0xbd')]=[{'all':!![]}];}_0x3f0df5=_[_0xd5e7('0x9c')]({},_0x3f0df5,_0x5d8e30['options']);return db[_0xd5e7('0x42')]['find'](_0x3f0df5)[_0xd5e7('0x2f')](handleEntityNotFound(_0x6983ec,null))[_0xd5e7('0x2f')](respondWithResult(_0x6983ec,null))['catch'](handleError(_0x6983ec,null));};exports[_0xd5e7('0xbe')]=function(_0x20f4dc,_0x500c10){return db[_0xd5e7('0x42')][_0xd5e7('0xbe')](_0x20f4dc[_0xd5e7('0x76')],{})['then'](respondWithResult(_0x500c10,0xc9))[_0xd5e7('0x39')](handleError(_0x500c10,null));};exports[_0xd5e7('0x2e')]=function(_0x3159bc,_0x513839){if(_0x3159bc[_0xd5e7('0x76')]['id']){delete _0x3159bc[_0xd5e7('0x76')]['id'];}return db['FaxInteraction'][_0xd5e7('0x63')]({'where':{'id':_0x3159bc['params']['id']}})['then'](handleEntityNotFound(_0x513839,null))[_0xd5e7('0x2f')](saveUpdates(_0x3159bc[_0xd5e7('0x76')],null))['then'](respondWithResult(_0x513839,null))[_0xd5e7('0x39')](handleError(_0x513839,null));};exports[_0xd5e7('0x30')]=function(_0x2b4193,_0x5a1eef){return db[_0xd5e7('0x42')][_0xd5e7('0x63')]({'where':{'id':_0x2b4193[_0xd5e7('0xb8')]['id']}})[_0xd5e7('0x2f')](handleEntityNotFound(_0x5a1eef,null))[_0xd5e7('0x2f')](removeEntity(_0x5a1eef,null))[_0xd5e7('0x39')](handleError(_0x5a1eef,null));};exports[_0xd5e7('0xbf')]=function(_0x458d02,_0x43e6ab){return db[_0xd5e7('0x42')][_0xd5e7('0xbf')]()[_0xd5e7('0x2f')](respondWithResult(_0x43e6ab,null))[_0xd5e7('0x39')](handleError(_0x43e6ab,null));};exports[_0xd5e7('0xc0')]=function(_0x2f159d,_0x400669,_0x423280){return db['FaxMessage'][_0xd5e7('0x63')]({'where':{'id':_0x2f159d[_0xd5e7('0xb8')]['id']}})['then'](handleEntityNotFound(_0x400669,null))['then'](function(_0x39b914){if(_0x39b914){return _0x39b914[_0xd5e7('0xc0')](_0x2f159d[_0xd5e7('0x76')][_0xd5e7('0xc1')],_[_0xd5e7('0xc2')](_0x2f159d['body'],[_0xd5e7('0xc1'),'id'])||{});}})[_0xd5e7('0x2f')](respondWithResult(_0x400669,null))[_0xd5e7('0x39')](handleError(_0x400669,null));};exports['getMessages']=function(_0xf03072,_0x22ba08,_0x4f01d2){var _0x5cdc2b={'raw':![],'where':{}};var _0x4e64ea={};var _0x287501={'count':0x0,'rows':[]};return db['FaxInteraction'][_0xd5e7('0xc3')]({'where':{'id':_0xf03072['params']['id']}})[_0xd5e7('0x2f')](handleEntityNotFound(_0x22ba08,null))['then'](function(_0x3397a9){if(_0x3397a9){_0x4e64ea[_0xd5e7('0xb9')]=_[_0xd5e7('0x45')](db[_0xd5e7('0xc4')][_0xd5e7('0xba')]);_0x4e64ea[_0xd5e7('0x46')]=_['keys'](_0xf03072[_0xd5e7('0x46')]);_0x4e64ea[_0xd5e7('0x47')]=_[_0xd5e7('0x48')](_0x4e64ea['model'],_0x4e64ea['query']);_0x5cdc2b[_0xd5e7('0x49')]=_[_0xd5e7('0x48')](_0x4e64ea[_0xd5e7('0xb9')],qs[_0xd5e7('0xbb')](_0xf03072[_0xd5e7('0x46')]['fields']));_0x5cdc2b[_0xd5e7('0x49')]=_0x5cdc2b[_0xd5e7('0x49')]['length']?_0x5cdc2b[_0xd5e7('0x49')]:_0x4e64ea[_0xd5e7('0xb9')];if(!_0xf03072['query'][_0xd5e7('0xc5')]('nolimit')){_0x5cdc2b['limit']=qs[_0xd5e7('0x27')](_0xf03072[_0xd5e7('0x46')][_0xd5e7('0x27')]);_0x5cdc2b[_0xd5e7('0x25')]=qs['offset'](_0xf03072[_0xd5e7('0x46')][_0xd5e7('0x25')]);}_0x5cdc2b[_0xd5e7('0x4c')]=qs[_0xd5e7('0x4d')](_0xf03072[_0xd5e7('0x46')][_0xd5e7('0x4d')]);_0x5cdc2b[_0xd5e7('0x79')]=qs[_0xd5e7('0x47')](_[_0xd5e7('0x4e')](_0xf03072['query'],_0x4e64ea[_0xd5e7('0x47')]));_0x5cdc2b[_0xd5e7('0x79')][_0xd5e7('0xb4')]=_0x3397a9['id'];if(_0xf03072[_0xd5e7('0x46')][_0xd5e7('0x86')]){_0x5cdc2b['where']=_[_0xd5e7('0x9c')](_0x5cdc2b['where'],{'$or':_['map'](_0x5cdc2b[_0xd5e7('0x49')],function(_0x5f5c4a){var _0x36ce43={};_0x36ce43[_0x5f5c4a]={'$like':'%'+_0xf03072['query'][_0xd5e7('0x86')]+'%'};return _0x36ce43;})});}if(_0xf03072[_0xd5e7('0x46')][_0xd5e7('0x7d')]){var _0x13f1cb=_0xf03072['query'][_0xd5e7('0x7d')][_0xd5e7('0x6b')](',');var _0x342d6b={};_0x342d6b[_0x13f1cb[0x0]]={'$gte':moment(_0x13f1cb[0x1])[_0xd5e7('0xc6')](_0xd5e7('0xc7'))};_0x5cdc2b['where']=_[_0xd5e7('0x9c')](_0x5cdc2b[_0xd5e7('0x79')],_0x342d6b);}_0x5cdc2b=_['merge']({},_0x5cdc2b,_0xf03072[_0xd5e7('0xc8')]);return db[_0xd5e7('0xc4')]['count']({'where':_0x5cdc2b['where']})[_0xd5e7('0x2f')](function(_0x22a895){_0x287501[_0xd5e7('0x28')]=_0x22a895;if(_0xf03072[_0xd5e7('0x46')][_0xd5e7('0xbc')]){_0x5cdc2b[_0xd5e7('0xbd')]=[{'all':!![]}];}return db[_0xd5e7('0xc4')][_0xd5e7('0xc9')](_0x5cdc2b);})[_0xd5e7('0x2f')](function(_0x385091){_0x287501['rows']=_0x385091;return _0x287501;});}})['then'](respondWithFilteredResult(_0x22ba08,_0x5cdc2b))['catch'](handleError(_0x22ba08,null));};exports[_0xd5e7('0xca')]=function(_0x4eae83,_0x37fcf3,_0x153489){return db[_0xd5e7('0x42')][_0xd5e7('0x63')]({'where':{'id':_0x4eae83['params']['id']}})['then'](handleEntityNotFound(_0x37fcf3,null))[_0xd5e7('0x2f')](function(_0x3b1e11){if(_0x3b1e11){return _0x3b1e11[_0xd5e7('0xcb')](_0x4eae83[_0xd5e7('0x76')]['ids'],_[_0xd5e7('0xc2')](_0x4eae83[_0xd5e7('0x76')],[_0xd5e7('0xc1'),'id'])||{})['spread'](function(){return db[_0xd5e7('0x72')]['findAll']({'attributes':['id',_0xd5e7('0x32'),_0xd5e7('0x51')],'where':{'id':_0x4eae83['body']['ids']}});})['then'](function(_0x3d7bf5){socket['emit'](_0xd5e7('0xcc'),{'id':Number(_0x4eae83[_0xd5e7('0xb8')]['id']),'tags':_0x3d7bf5||[]});return{'id':Number(_0x4eae83[_0xd5e7('0xb8')]['id']),'tags':_0x3d7bf5||[]};});}})['then'](respondWithResult(_0x37fcf3,null))['catch'](handleError(_0x37fcf3,null));};exports[_0xd5e7('0xcd')]=function(_0x3f43f4,_0x18ac4d,_0x45ad49){return db['FaxInteraction'][_0xd5e7('0x63')]({'where':{'id':_0x3f43f4[_0xd5e7('0xb8')]['id']}})[_0xd5e7('0x2f')](handleEntityNotFound(_0x18ac4d,null))[_0xd5e7('0x2f')](function(_0x50528b){if(_0x50528b){return _0x50528b['removeTags'](_0x3f43f4[_0xd5e7('0x46')][_0xd5e7('0xc1')]);}})['then'](respondWithStatusCode(_0x18ac4d,null))[_0xd5e7('0x39')](handleError(_0x18ac4d,null));};exports[_0xd5e7('0xce')]=function(_0x187292,_0x2b8872){var _0x7a6b6e=moment()[_0xd5e7('0xcf')]()[_0xd5e7('0x9a')]();var _0x2c062e=path[_0xd5e7('0xd0')](config[_0xd5e7('0xd1')],'server',_0xd5e7('0xd2'),'tmp');var _0x3109c3=path[_0xd5e7('0xd0')](config[_0xd5e7('0xd1')],_0xd5e7('0xd3'),_0xd5e7('0xd2'),_0xd5e7('0xd4'));var _0x4ec91f=path[_0xd5e7('0xd0')](_0x2c062e,_0x7a6b6e);var _0x4c0ca4=util['format'](_0xd5e7('0xd5'),_0x187292['params']['id'],_0x7a6b6e);var _0x1a64a7=path[_0xd5e7('0xd0')](_0x2c062e,_0x4c0ca4);var _0x2ef542=[];_0x2ef542[_0xd5e7('0xd6')]({'model':db[_0xd5e7('0xd7')],'as':_0xd5e7('0xd7'),'raw':!![]});var _0x124589=[{'model':db[_0xd5e7('0xc4')],'as':_0xd5e7('0xd8'),'attributes':['id',_0xd5e7('0x76'),_0xd5e7('0x7b')],'include':_0x2ef542}];return db[_0xd5e7('0x42')]['find']({'where':{'id':_0x187292[_0xd5e7('0xb8')]['id']},'include':_0x124589})[_0xd5e7('0x2f')](handleEntityNotFound(_0x2b8872,null))[_0xd5e7('0x2f')](function(_0x10eebf){if(_0x10eebf&&_0x10eebf[_0xd5e7('0xd8')]){var _0x397ede=_0x10eebf[_0xd5e7('0xd9')]({'plain':!![]});fs[_0xd5e7('0xda')](_0x4ec91f);for(var _0x52ade4=0x0;_0x52ade4<_0x397ede['Messages'][_0xd5e7('0x4a')];_0x52ade4++){var _0x9d5f5d=_0x397ede['Messages'][_0x52ade4][_0xd5e7('0xd7')];if(_0x9d5f5d){var _0x567125=path['join'](_0x3109c3,_0x9d5f5d[_0xd5e7('0xdb')]);if(fs[_0xd5e7('0xdc')](_0x567125)){fs['createReadStream'](_0x567125)[_0xd5e7('0xdd')](fs['createWriteStream'](path[_0xd5e7('0xd0')](_0x4ec91f,_0x9d5f5d[_0xd5e7('0xdb')])));}}}return BPromise[_0xd5e7('0x92')]()[_0xd5e7('0x2f')](function(){return new BPromise(function(_0x528170,_0x132076){zipdir(_0x4ec91f,{'saveTo':_0x1a64a7},function(_0xfc422f,_0x656619){if(_0xfc422f)return _0x132076(_0xfc422f);return _0x528170(_0x656619);});})[_0xd5e7('0x2f')](function(){return new BPromise(function(_0x58a9db,_0x36be2c){rimraf(_0x4ec91f,function(_0x486bba){if(_0x486bba)_0x36be2c(_0x486bba);return _0x58a9db();});});})[_0xd5e7('0x2f')](function(){return _0x2b8872[_0xd5e7('0xce')](_0x1a64a7,_0x4c0ca4,function(_0x3c72fd){if(_0x3c72fd){console['log']('err',_0x3c72fd);}else{fs[_0xd5e7('0xde')](_0x1a64a7);}});});});}else{return _0x2b8872[_0xd5e7('0x22')](0xc8);}})['catch'](handleError(_0x2b8872,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index f207999..31e5708 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 _0xdbf5=['findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','remove','getUsers','then','setDataValue','Users','map'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0xdbf5,0x194));var _0x5dbf=function(_0x2c1038,_0x15327c){_0x2c1038=_0x2c1038-0x0;var _0x50c3ed=_0xdbf5[_0x2c1038];return _0x50c3ed;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0x5dbf('0x0'))['db'][_0x5dbf('0x1')];var FaxMessage=require(_0x5dbf('0x0'))['db'][_0x5dbf('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x5dbf('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x5dbf('0x4')};function emitEvent(_0x2c5b43){return function(_0x5b542e,_0x137365,_0xa8ee7d){_0x5b542e[_0x5dbf('0x5')]({'attributes':['id'],'raw':!![]})[_0x5dbf('0x6')](function(_0x5a18e2){_0x5b542e[_0x5dbf('0x7')](_0x5dbf('0x8'),_0x5a18e2[_0x5dbf('0x9')](function(_0x46aa01){return{'id':_0x46aa01['id']};}));return FaxMessage[_0x5dbf('0xa')]({'where':{'FaxInteractionId':_0x5b542e['id'],'direction':'in','read':![]},'raw':!![]});})[_0x5dbf('0x6')](function(_0x337038){_0x5b542e[_0x5dbf('0x7')](_0x5dbf('0xb'),_0x337038[_0x5dbf('0xc')]);FaxInteractionEvents['emit'](_0x2c5b43+':'+_0x5b542e['id'],_0x5b542e);FaxInteractionEvents[_0x5dbf('0xd')](_0x2c5b43,_0x5b542e);_0xa8ee7d(null);})[_0x5dbf('0xe')](_0xa8ee7d(null));};}for(var e in events){if(events[_0x5dbf('0xf')](e)){var event=events[e];FaxInteraction[_0x5dbf('0x10')](e,emitEvent(event));}}module[_0x5dbf('0x11')]=FaxInteractionEvents; \ No newline at end of file +var _0x3f75=['getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','events','../../mysqldb','FaxMessage','save','update'];(function(_0x4b8e47,_0x2f9c13){var _0x3355f2=function(_0x4c9ba8){while(--_0x4c9ba8){_0x4b8e47['push'](_0x4b8e47['shift']());}};_0x3355f2(++_0x2f9c13);}(_0x3f75,0xeb));var _0x53f7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3f75[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x53f7('0x0'));var FaxInteraction=require(_0x53f7('0x1'))['db']['FaxInteraction'];var FaxMessage=require(_0x53f7('0x1'))['db'][_0x53f7('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x53f7('0x3'),'afterUpdate':_0x53f7('0x4'),'afterDestroy':'remove'};function emitEvent(_0x376902){return function(_0x3e4645,_0x1c00ca,_0x2ce43b){_0x3e4645[_0x53f7('0x5')]({'attributes':['id'],'raw':!![]})[_0x53f7('0x6')](function(_0x2c24a4){_0x3e4645[_0x53f7('0x7')](_0x53f7('0x8'),_0x2c24a4[_0x53f7('0x9')](function(_0x12e1c3){return{'id':_0x12e1c3['id']};}));return FaxMessage[_0x53f7('0xa')]({'where':{'FaxInteractionId':_0x3e4645['id'],'direction':'in','read':![]},'raw':!![]});})[_0x53f7('0x6')](function(_0x22d64a){_0x3e4645[_0x53f7('0x7')](_0x53f7('0xb'),_0x22d64a[_0x53f7('0xc')]);FaxInteractionEvents[_0x53f7('0xd')](_0x376902+':'+_0x3e4645['id'],_0x3e4645);FaxInteractionEvents[_0x53f7('0xd')](_0x376902,_0x3e4645);_0x2ce43b(null);})[_0x53f7('0xe')](_0x2ce43b(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module['exports']=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 738b21d..41819d1 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 _0x84ef=['FaxInteraction','fax_interactions','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./faxInteraction.attributes','exports','define'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x84ef,0x1d5));var _0xf84e=function(_0x3bc4cd,_0x6b254c){_0x3bc4cd=_0x3bc4cd-0x0;var _0x4aa969=_0x84ef[_0x3bc4cd];return _0x4aa969;};'use strict';var _=require('lodash');var util=require(_0xf84e('0x0'));var logger=require(_0xf84e('0x1'))(_0xf84e('0x2'));var moment=require(_0xf84e('0x3'));var BPromise=require(_0xf84e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf84e('0x5'));var rimraf=require(_0xf84e('0x6'));var config=require(_0xf84e('0x7'));var attributes=require(_0xf84e('0x8'));module[_0xf84e('0x9')]=function(_0x55d760,_0x5d1425){return _0x55d760[_0xf84e('0xa')](_0xf84e('0xb'),attributes,{'tableName':_0xf84e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x57819f,_0x21bd01,_0x270b02){if(_0x57819f['changed'](_0xf84e('0xd'))){_0x57819f[_0xf84e('0xe')]=moment()['format'](_0xf84e('0xf'));}_0x270b02(null,_0x57819f);}}});}; \ No newline at end of file +var _0xa5c5=['fax_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxInteraction.attributes','exports','FaxInteraction'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa5c5,0xba));var _0x5a5c=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xa5c5[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x5a5c('0x0'));var util=require(_0x5a5c('0x1'));var logger=require(_0x5a5c('0x2'))('api');var moment=require(_0x5a5c('0x3'));var BPromise=require(_0x5a5c('0x4'));var rp=require(_0x5a5c('0x5'));var fs=require('fs');var path=require(_0x5a5c('0x6'));var rimraf=require(_0x5a5c('0x7'));var config=require(_0x5a5c('0x8'));var attributes=require(_0x5a5c('0x9'));module[_0x5a5c('0xa')]=function(_0x1ecb19,_0xb3aca1){return _0x1ecb19['define'](_0x5a5c('0xb'),attributes,{'tableName':_0x5a5c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xd50c42,_0x169491,_0x5b061b){if(_0xd50c42[_0x5a5c('0xd')](_0x5a5c('0xe'))){_0xd50c42[_0x5a5c('0xf')]=moment()[_0x5a5c('0x10')](_0x5a5c('0x11'));}_0x5b061b(null,_0xd50c42);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 7a773fe..608d799 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 _0x106e=['message','result','catch','UpdateFaxInteraction','FaxInteraction','update','body','options','where','attributes','limit','AddTagsToFaxInteraction','then','addTags','ids','AddTags','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','request','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x5a26f5,_0x196300){var _0x2e9ef7=function(_0x593736){while(--_0x593736){_0x5a26f5['push'](_0x5a26f5['shift']());}};_0x2e9ef7(++_0x196300);}(_0x106e,0x1bd));var _0xe106=function(_0x32aaf4,_0x4af273){_0x32aaf4=_0x32aaf4-0x0;var _0x244de5=_0x106e[_0x32aaf4];return _0x244de5;};'use strict';var _=require(_0xe106('0x0'));var util=require(_0xe106('0x1'));var moment=require('moment');var BPromise=require(_0xe106('0x2'));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('../../config/logger')(_0xe106('0x6'));var config=require(_0xe106('0x7'));var jayson=require(_0xe106('0x8'));var client=jayson[_0xe106('0x9')][_0xe106('0xa')]({'port':0x232a});config['redis']=_[_0xe106('0xb')](config[_0xe106('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xe106('0xd'))(new Redis(config[_0xe106('0xc')]));require('./faxInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x494082,_0x9b1e63,_0x518e93){return new BPromise(function(_0x2dd774,_0x5963cf){return client[_0xe106('0xe')](_0x494082,_0x518e93)['then'](function(_0x5252de){logger[_0xe106('0xf')](_0xe106('0x10'),_0x9b1e63,_0xe106('0x11'));logger[_0xe106('0x12')](_0xe106('0x13'),_0x9b1e63,_0xe106('0x11'),JSON[_0xe106('0x14')](_0x5252de));if(_0x5252de[_0xe106('0x15')]){if(_0x5252de[_0xe106('0x15')][_0xe106('0x16')]===0x1f4){logger[_0xe106('0x15')](_0xe106('0x10'),_0x9b1e63,_0x5252de[_0xe106('0x15')][_0xe106('0x17')]);return _0x5963cf(_0x5252de[_0xe106('0x15')][_0xe106('0x17')]);}logger[_0xe106('0x15')](_0xe106('0x10'),_0x9b1e63,_0x5252de['error'][_0xe106('0x17')]);return _0x2dd774(_0x5252de[_0xe106('0x15')][_0xe106('0x17')]);}else{logger[_0xe106('0xf')]('FaxInteraction,\x20%s,\x20%s',_0x9b1e63,'request\x20sent');_0x2dd774(_0x5252de[_0xe106('0x18')][_0xe106('0x17')]);}})[_0xe106('0x19')](function(_0x58c51e){logger['error'](_0xe106('0x10'),_0x9b1e63,_0x58c51e);_0x5963cf(_0x58c51e);});});}exports[_0xe106('0x1a')]=function(_0x5c280b){var _0x3ab72d=this;return new Promise(function(_0x2f8da6,_0x38e1ea){return db[_0xe106('0x1b')][_0xe106('0x1c')](_0x5c280b[_0xe106('0x1d')],{'raw':_0x5c280b['options']?_0x5c280b[_0xe106('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5c280b[_0xe106('0x1e')]?_0x5c280b[_0xe106('0x1e')][_0xe106('0x1f')]||null:null,'attributes':_0x5c280b[_0xe106('0x1e')]?_0x5c280b[_0xe106('0x1e')][_0xe106('0x20')]||null:null,'limit':_0x5c280b['options']?_0x5c280b[_0xe106('0x1e')][_0xe106('0x21')]||null:null})['then'](function(_0x528ec6){logger[_0xe106('0xf')](_0xe106('0x1a'),_0x5c280b);logger[_0xe106('0x12')](_0xe106('0x1a'),_0x5c280b,JSON[_0xe106('0x14')](_0x528ec6));_0x2f8da6(_0x528ec6);})[_0xe106('0x19')](function(_0x732b38){logger['error'](_0xe106('0x1a'),_0x732b38[_0xe106('0x17')],_0x5c280b);_0x38e1ea(_0x3ab72d[_0xe106('0x15')](0x1f4,_0x732b38[_0xe106('0x17')]));});});};exports[_0xe106('0x22')]=function(_0x4acd6f){return new Promise(function(_0x45824b,_0x543435){return db[_0xe106('0x1b')]['find']({'where':_0x4acd6f[_0xe106('0x1e')]?_0x4acd6f[_0xe106('0x1e')][_0xe106('0x1f')]||null:null})[_0xe106('0x23')](function(_0x3d9a9d){if(_0x3d9a9d){return _0x3d9a9d[_0xe106('0x24')](_0x4acd6f[_0xe106('0x1d')]['ids'],_['omit'](_0x4acd6f[_0xe106('0x1d')],[_0xe106('0x25'),'id'])||{});}})['spread'](function(_0x19075a){logger[_0xe106('0xf')](_0xe106('0x26'),_0x4acd6f);logger[_0xe106('0x12')]('AddTags',_0x4acd6f,JSON['stringify'](_0x19075a));_0x45824b(_0x19075a);})[_0xe106('0x19')](function(_0x2bd368){logger[_0xe106('0x15')](_0xe106('0x26'),_0x2bd368[_0xe106('0x17')],_0x4acd6f);_0x543435(_this[_0xe106('0x15')](0x1f4,_0x2bd368[_0xe106('0x17')]));});});}; \ No newline at end of file +var _0xe67b=['raw','where','attributes','limit','catch','AddTagsToFaxInteraction','FaxInteraction','find','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','then','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','info','UpdateFaxInteraction','update','body','options'];(function(_0x1762b4,_0x33d836){var _0x29beda=function(_0x31c2fa){while(--_0x31c2fa){_0x1762b4['push'](_0x1762b4['shift']());}};_0x29beda(++_0x33d836);}(_0xe67b,0x91));var _0xbe67=function(_0x4e9d3c,_0x1f4b98){_0x4e9d3c=_0x4e9d3c-0x0;var _0x2d0825=_0xe67b[_0x4e9d3c];return _0x2d0825;};'use strict';var _=require(_0xbe67('0x0'));var util=require(_0xbe67('0x1'));var moment=require(_0xbe67('0x2'));var BPromise=require(_0xbe67('0x3'));var rs=require(_0xbe67('0x4'));var fs=require('fs');var Redis=require(_0xbe67('0x5'));var db=require(_0xbe67('0x6'))['db'];var utils=require(_0xbe67('0x7'));var logger=require(_0xbe67('0x8'))('rpc');var config=require(_0xbe67('0x9'));var jayson=require(_0xbe67('0xa'));var client=jayson['client'][_0xbe67('0xb')]({'port':0x232a});config[_0xbe67('0xc')]=_[_0xbe67('0xd')](config[_0xbe67('0xc')],{'host':_0xbe67('0xe'),'port':0x18eb});var socket=require(_0xbe67('0xf'))(new Redis(config['redis']));require(_0xbe67('0x10'))[_0xbe67('0x11')](socket);function respondWithRpcPromise(_0x193505,_0x481396,_0x5336cb){return new BPromise(function(_0x435ea4,_0x5672f6){return client['request'](_0x193505,_0x5336cb)[_0xbe67('0x12')](function(_0x35e756){logger['info'](_0xbe67('0x13'),_0x481396,_0xbe67('0x14'));logger[_0xbe67('0x15')]('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x481396,_0xbe67('0x14'),JSON[_0xbe67('0x16')](_0x35e756));if(_0x35e756['error']){if(_0x35e756['error'][_0xbe67('0x17')]===0x1f4){logger['error'](_0xbe67('0x13'),_0x481396,_0x35e756[_0xbe67('0x18')][_0xbe67('0x19')]);return _0x5672f6(_0x35e756[_0xbe67('0x18')][_0xbe67('0x19')]);}logger[_0xbe67('0x18')](_0xbe67('0x13'),_0x481396,_0x35e756['error'][_0xbe67('0x19')]);return _0x435ea4(_0x35e756['error'][_0xbe67('0x19')]);}else{logger[_0xbe67('0x1a')](_0xbe67('0x13'),_0x481396,_0xbe67('0x14'));_0x435ea4(_0x35e756['result']['message']);}})['catch'](function(_0x47aeee){logger[_0xbe67('0x18')]('FaxInteraction,\x20%s,\x20%s',_0x481396,_0x47aeee);_0x5672f6(_0x47aeee);});});}exports[_0xbe67('0x1b')]=function(_0x213c6e){var _0x2b06f6=this;return new Promise(function(_0x2d8890,_0x24eff8){return db['FaxInteraction'][_0xbe67('0x1c')](_0x213c6e[_0xbe67('0x1d')],{'raw':_0x213c6e[_0xbe67('0x1e')]?_0x213c6e[_0xbe67('0x1e')][_0xbe67('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x213c6e[_0xbe67('0x1e')]?_0x213c6e['options'][_0xbe67('0x20')]||null:null,'attributes':_0x213c6e[_0xbe67('0x1e')]?_0x213c6e['options'][_0xbe67('0x21')]||null:null,'limit':_0x213c6e[_0xbe67('0x1e')]?_0x213c6e['options'][_0xbe67('0x22')]||null:null})[_0xbe67('0x12')](function(_0x48bd62){logger[_0xbe67('0x1a')](_0xbe67('0x1b'),_0x213c6e);logger[_0xbe67('0x15')](_0xbe67('0x1b'),_0x213c6e,JSON[_0xbe67('0x16')](_0x48bd62));_0x2d8890(_0x48bd62);})[_0xbe67('0x23')](function(_0x5b33e8){logger[_0xbe67('0x18')](_0xbe67('0x1b'),_0x5b33e8[_0xbe67('0x19')],_0x213c6e);_0x24eff8(_0x2b06f6[_0xbe67('0x18')](0x1f4,_0x5b33e8[_0xbe67('0x19')]));});});};exports[_0xbe67('0x24')]=function(_0x237312){return new Promise(function(_0xed129,_0x42bb74){return db[_0xbe67('0x25')][_0xbe67('0x26')]({'where':_0x237312['options']?_0x237312[_0xbe67('0x1e')][_0xbe67('0x20')]||null:null})[_0xbe67('0x12')](function(_0x11351e){if(_0x11351e){return _0x11351e[_0xbe67('0x27')](_0x237312[_0xbe67('0x1d')][_0xbe67('0x28')],_[_0xbe67('0x29')](_0x237312[_0xbe67('0x1d')],[_0xbe67('0x28'),'id'])||{});}})[_0xbe67('0x2a')](function(_0x50e6c7){logger[_0xbe67('0x1a')]('AddTags',_0x237312);logger[_0xbe67('0x15')](_0xbe67('0x2b'),_0x237312,JSON[_0xbe67('0x16')](_0x50e6c7));_0xed129(_0x50e6c7);})[_0xbe67('0x23')](function(_0x146832){logger[_0xbe67('0x18')](_0xbe67('0x2b'),_0x146832['message'],_0x237312);_0x42bb74(_this[_0xbe67('0x18')](0x1f4,_0x146832[_0xbe67('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index f7844fe..17fc829 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 _0x4f5f=['emit','removeListener','length','faxInteraction:','./faxInteraction.events','save','remove','update'];(function(_0x9ea4c6,_0x1df2d3){var _0x290c87=function(_0x550208){while(--_0x550208){_0x9ea4c6['push'](_0x9ea4c6['shift']());}};_0x290c87(++_0x1df2d3);}(_0x4f5f,0xfc));var _0xf4f5=function(_0x5311a1,_0x304912){_0x5311a1=_0x5311a1-0x0;var _0x2acb9f=_0x4f5f[_0x5311a1];return _0x2acb9f;};'use strict';var FaxInteractionEvents=require(_0xf4f5('0x0'));var events=[_0xf4f5('0x1'),_0xf4f5('0x2'),_0xf4f5('0x3')];function createListener(_0x4bacea,_0x2eb9e1){return function(_0x2dae3){_0x2eb9e1[_0xf4f5('0x4')](_0x4bacea,_0x2dae3);};}function removeListener(_0x7f6ab9,_0x18f862){return function(){FaxInteractionEvents[_0xf4f5('0x5')](_0x7f6ab9,_0x18f862);};}exports['register']=function(_0xf64e67){for(var _0x4bcc4e=0x0,_0x41129d=events[_0xf4f5('0x6')];_0x4bcc4e<_0x41129d;_0x4bcc4e++){var _0x2f098f=events[_0x4bcc4e];var _0xae3264=createListener(_0xf4f5('0x7')+_0x2f098f,_0xf64e67);FaxInteractionEvents['on'](_0x2f098f,_0xae3264);}}; \ No newline at end of file +var _0x1730=['emit','removeListener','register','faxInteraction:'];(function(_0x3a6a89,_0x11e8dd){var _0x1fe7a4=function(_0x1f4405){while(--_0x1f4405){_0x3a6a89['push'](_0x3a6a89['shift']());}};_0x1fe7a4(++_0x11e8dd);}(_0x1730,0xd4));var _0x0173=function(_0x597f3e,_0x37b7f0){_0x597f3e=_0x597f3e-0x0;var _0x137a46=_0x1730[_0x597f3e];return _0x137a46;};'use strict';var FaxInteractionEvents=require('./faxInteraction.events');var events=['save','remove','update'];function createListener(_0x21cfb7,_0x1e689a){return function(_0x29aaf6){_0x1e689a[_0x0173('0x0')](_0x21cfb7,_0x29aaf6);};}function removeListener(_0x570608,_0x17b776){return function(){FaxInteractionEvents[_0x0173('0x1')](_0x570608,_0x17b776);};}exports[_0x0173('0x2')]=function(_0x208a3f){for(var _0x44a2d5=0x0,_0x4937ae=events['length'];_0x44a2d5<_0x4937ae;_0x44a2d5++){var _0x291dbb=events[_0x44a2d5];var _0x395b8d=createListener(_0x0173('0x3')+_0x291dbb,_0x208a3f);FaxInteractionEvents['on'](_0x291dbb,_0x395b8d);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 2ef6a4b..9b47245 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 _0x53ec=['download','post','create','addMessage','fax','addTags','put','tracked','faxinteraction:update','delete','destroy','removeTags','exports','util','connect-timeout','express','fs-extra','../../config/environment','./faxInteraction.controller','get','index','/describe','isAuthenticated','/:id','show','/:id/messages','getMessages','/:id/download'];(function(_0x524636,_0x12067c){var _0x3811c3=function(_0x559488){while(--_0x559488){_0x524636['push'](_0x524636['shift']());}};_0x3811c3(++_0x12067c);}(_0x53ec,0x179));var _0xc53e=function(_0x8ec6b4,_0x31ef52){_0x8ec6b4=_0x8ec6b4-0x0;var _0x52c0d0=_0x53ec[_0x8ec6b4];return _0x52c0d0;};'use strict';var multer=require('multer');var util=require(_0xc53e('0x0'));var path=require('path');var timeout=require(_0xc53e('0x1'));var express=require(_0xc53e('0x2'));var router=express['Router']();var fs_extra=require(_0xc53e('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc53e('0x4'));var controller=require(_0xc53e('0x5'));router[_0xc53e('0x6')]('/',auth['isAuthenticated'](),controller[_0xc53e('0x7')]);router[_0xc53e('0x6')](_0xc53e('0x8'),auth[_0xc53e('0x9')](),controller['describe']);router[_0xc53e('0x6')](_0xc53e('0xa'),auth[_0xc53e('0x9')](),controller[_0xc53e('0xb')]);router[_0xc53e('0x6')](_0xc53e('0xc'),auth[_0xc53e('0x9')](),controller[_0xc53e('0xd')]);router[_0xc53e('0x6')](_0xc53e('0xe'),auth[_0xc53e('0x9')](),controller[_0xc53e('0xf')]);router[_0xc53e('0x10')]('/',auth[_0xc53e('0x9')](),controller[_0xc53e('0x11')]);router[_0xc53e('0x10')](_0xc53e('0xc'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x12')]);router[_0xc53e('0x10')]('/:id/tags',auth[_0xc53e('0x9')](),interaction['tracked'](_0xc53e('0x13'),'faxinteraction:addtags'),controller[_0xc53e('0x14')]);router[_0xc53e('0x15')](_0xc53e('0xa'),auth['isAuthenticated'](),interaction[_0xc53e('0x16')]('fax',_0xc53e('0x17')),controller['update']);router[_0xc53e('0x18')](_0xc53e('0xa'),auth[_0xc53e('0x9')](),interaction[_0xc53e('0x16')](_0xc53e('0x13'),'faxinteraction:destroy'),controller[_0xc53e('0x19')]);router['delete']('/:id/tags',auth[_0xc53e('0x9')](),controller[_0xc53e('0x1a')]);module[_0xc53e('0x1b')]=router; \ No newline at end of file +var _0x3544=['/:id','show','/:id/messages','getMessages','download','post','create','/:id/tags','tracked','faxinteraction:addtags','put','faxinteraction:update','update','delete','fax','faxinteraction:destroy','destroy','removeTags','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','/describe'];(function(_0x44353d,_0x267761){var _0x93dd90=function(_0x218cc1){while(--_0x218cc1){_0x44353d['push'](_0x44353d['shift']());}};_0x93dd90(++_0x267761);}(_0x3544,0x70));var _0x4354=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x3544[_0x2b4411];return _0x8e41ef;};'use strict';var multer=require(_0x4354('0x0'));var util=require(_0x4354('0x1'));var path=require(_0x4354('0x2'));var timeout=require('connect-timeout');var express=require(_0x4354('0x3'));var router=express[_0x4354('0x4')]();var fs_extra=require(_0x4354('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x4354('0x6'));var config=require(_0x4354('0x7'));var controller=require(_0x4354('0x8'));router[_0x4354('0x9')]('/',auth[_0x4354('0xa')](),controller['index']);router[_0x4354('0x9')](_0x4354('0xb'),auth[_0x4354('0xa')](),controller['describe']);router[_0x4354('0x9')](_0x4354('0xc'),auth['isAuthenticated'](),controller[_0x4354('0xd')]);router[_0x4354('0x9')](_0x4354('0xe'),auth[_0x4354('0xa')](),controller[_0x4354('0xf')]);router[_0x4354('0x9')]('/:id/download',auth[_0x4354('0xa')](),controller[_0x4354('0x10')]);router[_0x4354('0x11')]('/',auth[_0x4354('0xa')](),controller[_0x4354('0x12')]);router['post'](_0x4354('0xe'),auth[_0x4354('0xa')](),controller['addMessage']);router[_0x4354('0x11')](_0x4354('0x13'),auth['isAuthenticated'](),interaction[_0x4354('0x14')]('fax',_0x4354('0x15')),controller['addTags']);router[_0x4354('0x16')](_0x4354('0xc'),auth[_0x4354('0xa')](),interaction['tracked']('fax',_0x4354('0x17')),controller[_0x4354('0x18')]);router[_0x4354('0x19')](_0x4354('0xc'),auth[_0x4354('0xa')](),interaction[_0x4354('0x14')](_0x4354('0x1a'),_0x4354('0x1b')),controller[_0x4354('0x1c')]);router[_0x4354('0x19')](_0x4354('0x13'),auth[_0x4354('0xa')](),controller[_0x4354('0x1d')]);module[_0x4354('0x1e')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index bd49eb9..259ac8a 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 _0xcb99=['TEXT','ENUM','out','DATE','sequelize'];(function(_0x2f1467,_0xd189c6){var _0xf9c138=function(_0x5415e1){while(--_0x5415e1){_0x2f1467['push'](_0x2f1467['shift']());}};_0xf9c138(++_0xd189c6);}(_0xcb99,0x8b));var _0x9cb9=function(_0x219bca,_0xe5a6e5){_0x219bca=_0x219bca-0x0;var _0x5e3451=_0xcb99[_0x219bca];return _0x5e3451;};'use strict';var Sequelize=require(_0x9cb9('0x0'));module['exports']={'body':{'type':Sequelize[_0x9cb9('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x9cb9('0x2')]('in',_0x9cb9('0x3')),'defaultValue':_0x9cb9('0x3'),'allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize[_0x9cb9('0x4')]}}; \ No newline at end of file +var _0xe57e=['out','DATE','sequelize','TEXT','medium','BOOLEAN'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe57e,0xf2));var _0xee57=function(_0xd7b35,_0x7aec91){_0xd7b35=_0xd7b35-0x0;var _0x400a21=_0xe57e[_0xd7b35];return _0x400a21;};'use strict';var Sequelize=require(_0xee57('0x0'));module['exports']={'body':{'type':Sequelize[_0xee57('0x1')](_0xee57('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xee57('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0xee57('0x4'),'allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize[_0xee57('0x5')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index d8c6b16..9160ac4 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 _0x5bc1=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','http','request','info','FaxMessage,\x20%s,\x20%s','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','sendStatus','stack','name','index','FaxMessage','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','show','params','body','find','describe','../../config/logger','fax-interactions','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','FaxInteractionId','read1stAt','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','User','fullname','email','internal','interface','SIP/%s','channel','motionChannel','event','EventManager','fax','RejectMessage','rejectMessage','contact','rejectmessage','create','CmContact','findOne','isNil','Attachment','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','join','server','files','attachments','download','rimraf','request-promise','bluebird','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js'];(function(_0x1e945f,_0x3f24d2){var _0x189aa7=function(_0x15d561){while(--_0x15d561){_0x1e945f['push'](_0x1e945f['shift']());}};_0x189aa7(++_0x3f24d2);}(_0x5bc1,0x10c));var _0x15bc=function(_0x18ae8f,_0x25f684){_0x18ae8f=_0x18ae8f-0x0;var _0x43e219=_0x5bc1[_0x18ae8f];return _0x43e219;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x15bc('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x15bc('0x1'));var moment=require('moment');var BPromise=require(_0x15bc('0x2'));var Mustache=require('mustache');var util=require(_0x15bc('0x3'));var path=require(_0x15bc('0x4'));var sox=require(_0x15bc('0x5'));var csv=require(_0x15bc('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x15bc('0x7'));var _=require(_0x15bc('0x8'));var squel=require('squel');var crypto=require(_0x15bc('0x9'));var jsforce=require(_0x15bc('0xa'));var deskjs=require(_0x15bc('0xb'));var toCsv=require(_0x15bc('0x6'));var querystring=require(_0x15bc('0xc'));var Papa=require(_0x15bc('0xd'));var Redis=require(_0x15bc('0xe'));var authService=require(_0x15bc('0xf'));var qs=require(_0x15bc('0x10'));var as=require(_0x15bc('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x15bc('0x12'));var utils=require(_0x15bc('0x13'));var config=require(_0x15bc('0x14'));var licenseUtil=require(_0x15bc('0x15'));var db=require('../../mysqldb')['db'];config[_0x15bc('0x16')]=_[_0x15bc('0x17')](config[_0x15bc('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x15bc('0x18'))(new Redis(config[_0x15bc('0x16')]));require(_0x15bc('0x19'))[_0x15bc('0x1a')](socket);var jayson=require(_0x15bc('0x1b'));var client=jayson[_0x15bc('0x1c')][_0x15bc('0x1d')]({'port':0x232c});var client9002=jayson[_0x15bc('0x1c')][_0x15bc('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x2e14da,_0x27eb34,_0xb551ca,_0x69f259){return new BPromise(function(_0x11b74f,_0x9c13a9){var _0x4438b3=_0x69f259||client;return _0x4438b3[_0x15bc('0x1e')](_0x2e14da,_0xb551ca)['then'](function(_0x216f85){logger[_0x15bc('0x1f')](_0x15bc('0x20'),_0x27eb34,_0x15bc('0x21'));logger['debug'](_0x15bc('0x22'),_0x27eb34,'request\x20sent',JSON[_0x15bc('0x23')](_0x216f85));if(_0x216f85['error']){if(_0x216f85['error']['code']===0x1f4){logger[_0x15bc('0x24')]('FaxMessage,\x20%s,\x20%s',_0x27eb34,_0x216f85[_0x15bc('0x24')][_0x15bc('0x25')]);return _0x9c13a9(_0x216f85[_0x15bc('0x24')]['message']);}logger[_0x15bc('0x24')]('FaxMessage,\x20%s,\x20%s',_0x27eb34,_0x216f85[_0x15bc('0x24')][_0x15bc('0x25')]);return _0x11b74f(_0x216f85['error']['message']);}else{logger[_0x15bc('0x1f')]('FaxMessage,\x20%s,\x20%s',_0x27eb34,_0x15bc('0x21'));_0x11b74f(_0x216f85[_0x15bc('0x26')]['message']);}})[_0x15bc('0x27')](function(_0x27cf74){logger[_0x15bc('0x24')](_0x15bc('0x20'),_0x27eb34,_0x27cf74);_0x9c13a9(_0x27cf74);});});}function respondWithStatusCode(_0x55fa65,_0x3403e8){_0x3403e8=_0x3403e8||0xcc;return function(_0x4560dd){if(_0x4560dd){return _0x55fa65['sendStatus'](_0x3403e8);}return _0x55fa65[_0x15bc('0x28')](_0x3403e8)[_0x15bc('0x29')]();};}function respondWithResult(_0x3f9dbc,_0x3b42c0){_0x3b42c0=_0x3b42c0||0xc8;return function(_0x4e8d86){if(_0x4e8d86){return _0x3f9dbc[_0x15bc('0x28')](_0x3b42c0)[_0x15bc('0x2a')](_0x4e8d86);}};}function respondWithFilteredResult(_0xda4d90,_0x40247f){return function(_0x2a9161){if(_0x2a9161){var _0x343b93=typeof _0x40247f[_0x15bc('0x2b')]===_0x15bc('0x2c')&&typeof _0x40247f['limit']===_0x15bc('0x2c');var _0x5cedd6=_0x2a9161['count'];var _0x59dd58=_0x343b93?0x0:_0x40247f[_0x15bc('0x2b')];var _0x363ae5=_0x343b93?_0x2a9161[_0x15bc('0x2d')]:_0x40247f[_0x15bc('0x2b')]+_0x40247f[_0x15bc('0x2e')];var _0x28f47b;if(_0x363ae5>=_0x5cedd6){_0x363ae5=_0x5cedd6;_0x28f47b=0xc8;}else{_0x28f47b=0xce;}_0xda4d90[_0x15bc('0x28')](_0x28f47b);return _0xda4d90[_0x15bc('0x2f')](_0x15bc('0x30'),_0x59dd58+'-'+_0x363ae5+'/'+_0x5cedd6)['json'](_0x2a9161);}return null;};}function patchUpdates(_0x3a7005){return function(_0x3dc49a){try{jsonpatch['apply'](_0x3dc49a,_0x3a7005,!![]);}catch(_0x7973d3){return BPromise[_0x15bc('0x31')](_0x7973d3);}return _0x3dc49a[_0x15bc('0x32')]();};}function saveUpdates(_0x34134a,_0x4ece35){return function(_0x5ea819){if(_0x5ea819){return _0x5ea819[_0x15bc('0x33')](_0x34134a)[_0x15bc('0x34')](function(_0x2a1d53){return _0x2a1d53;});}return null;};}function removeEntity(_0x433bf2,_0x5f4c9b){return function(_0x260559){if(_0x260559){return _0x260559[_0x15bc('0x35')]()['then'](function(){_0x433bf2[_0x15bc('0x28')](0xcc)[_0x15bc('0x29')]();});}};}function handleEntityNotFound(_0x2acab7,_0x1c0ddf){return function(_0x5f494b){if(!_0x5f494b){_0x2acab7[_0x15bc('0x36')](0x194);}return _0x5f494b;};}function handleError(_0x2d36da,_0x1131f9){_0x1131f9=_0x1131f9||0x1f4;return function(_0x328a81){logger[_0x15bc('0x24')](_0x328a81[_0x15bc('0x37')]);if(_0x328a81[_0x15bc('0x38')]){delete _0x328a81[_0x15bc('0x38')];}_0x2d36da[_0x15bc('0x28')](_0x1131f9)['send'](_0x328a81);};}exports[_0x15bc('0x39')]=function(_0x567f75,_0x36541c){var _0x1d504a={},_0x4e7724={},_0x3bda69={'count':0x0,'rows':[]};var _0x41ba2f=_['map'](db[_0x15bc('0x3a')][_0x15bc('0x3b')],function(_0x1642be){return{'name':_0x1642be['fieldName'],'type':_0x1642be[_0x15bc('0x3c')][_0x15bc('0x3d')]};});_0x4e7724[_0x15bc('0x3e')]=_[_0x15bc('0x3f')](_0x41ba2f,'name');_0x4e7724[_0x15bc('0x40')]=_[_0x15bc('0x41')](_0x567f75[_0x15bc('0x40')]);_0x4e7724[_0x15bc('0x42')]=_[_0x15bc('0x43')](_0x4e7724[_0x15bc('0x3e')],_0x4e7724[_0x15bc('0x40')]);_0x1d504a[_0x15bc('0x44')]=_['intersection'](_0x4e7724[_0x15bc('0x3e')],qs[_0x15bc('0x45')](_0x567f75[_0x15bc('0x40')][_0x15bc('0x45')]));_0x1d504a[_0x15bc('0x44')]=_0x1d504a['attributes'][_0x15bc('0x46')]?_0x1d504a[_0x15bc('0x44')]:_0x4e7724[_0x15bc('0x3e')];if(!_0x567f75[_0x15bc('0x40')][_0x15bc('0x47')](_0x15bc('0x48'))){_0x1d504a[_0x15bc('0x2e')]=qs[_0x15bc('0x2e')](_0x567f75[_0x15bc('0x40')][_0x15bc('0x2e')]);_0x1d504a[_0x15bc('0x2b')]=qs[_0x15bc('0x2b')](_0x567f75['query']['offset']);}_0x1d504a['order']=qs['sort'](_0x567f75[_0x15bc('0x40')][_0x15bc('0x49')]);_0x1d504a[_0x15bc('0x4a')]=qs[_0x15bc('0x42')](_[_0x15bc('0x4b')](_0x567f75[_0x15bc('0x40')],_0x4e7724[_0x15bc('0x42')]),_0x41ba2f);if(_0x567f75[_0x15bc('0x40')][_0x15bc('0x4c')]){_0x1d504a[_0x15bc('0x4a')]=_[_0x15bc('0x4d')](_0x1d504a[_0x15bc('0x4a')],{'$or':_[_0x15bc('0x3f')](_0x41ba2f,function(_0x4d64b2){if(_0x4d64b2[_0x15bc('0x3c')]!==_0x15bc('0x4e')){var _0x2dfd71={};_0x2dfd71[_0x4d64b2['name']]={'$like':'%'+_0x567f75[_0x15bc('0x40')]['filter']+'%'};return _0x2dfd71;}})});}_0x1d504a=_[_0x15bc('0x4d')]({},_0x1d504a,_0x567f75[_0x15bc('0x4f')]);var _0x598478={'where':_0x1d504a[_0x15bc('0x4a')]};return db[_0x15bc('0x3a')][_0x15bc('0x2d')](_0x598478)[_0x15bc('0x34')](function(_0x2a89ad){_0x3bda69[_0x15bc('0x2d')]=_0x2a89ad;if(_0x567f75[_0x15bc('0x40')]['includeAll']){_0x1d504a[_0x15bc('0x50')]=[{'all':!![]}];}return db[_0x15bc('0x3a')][_0x15bc('0x51')](_0x1d504a);})[_0x15bc('0x34')](function(_0x140d1c){_0x3bda69['rows']=_0x140d1c;return _0x3bda69;})[_0x15bc('0x34')](respondWithFilteredResult(_0x36541c,_0x1d504a))['catch'](handleError(_0x36541c,null));};exports[_0x15bc('0x52')]=function(_0x2d6dac,_0x29839b){var _0x4908ae={'raw':!![],'where':{'id':_0x2d6dac[_0x15bc('0x53')]['id']}},_0x3c4b57={};_0x3c4b57[_0x15bc('0x3e')]=_[_0x15bc('0x41')](db[_0x15bc('0x3a')][_0x15bc('0x3b')]);_0x3c4b57['query']=_[_0x15bc('0x41')](_0x2d6dac[_0x15bc('0x40')]);_0x3c4b57['filters']=_[_0x15bc('0x43')](_0x3c4b57[_0x15bc('0x3e')],_0x3c4b57['query']);_0x4908ae[_0x15bc('0x44')]=_[_0x15bc('0x43')](_0x3c4b57[_0x15bc('0x3e')],qs[_0x15bc('0x45')](_0x2d6dac[_0x15bc('0x40')][_0x15bc('0x45')]));_0x4908ae[_0x15bc('0x44')]=_0x4908ae[_0x15bc('0x44')][_0x15bc('0x46')]?_0x4908ae[_0x15bc('0x44')]:_0x3c4b57[_0x15bc('0x3e')];if(_0x2d6dac[_0x15bc('0x40')]['includeAll']){_0x4908ae[_0x15bc('0x50')]=[{'all':!![]}];}_0x4908ae=_[_0x15bc('0x4d')]({},_0x4908ae,_0x2d6dac[_0x15bc('0x4f')]);return db[_0x15bc('0x3a')]['find'](_0x4908ae)[_0x15bc('0x34')](handleEntityNotFound(_0x29839b,null))['then'](respondWithResult(_0x29839b,null))[_0x15bc('0x27')](handleError(_0x29839b,null));};exports[_0x15bc('0x33')]=function(_0x37d2e4,_0x3fe147){if(_0x37d2e4['body']['id']){delete _0x37d2e4[_0x15bc('0x54')]['id'];}return db[_0x15bc('0x3a')][_0x15bc('0x55')]({'where':{'id':_0x37d2e4[_0x15bc('0x53')]['id']}})[_0x15bc('0x34')](handleEntityNotFound(_0x3fe147,null))[_0x15bc('0x34')](saveUpdates(_0x37d2e4[_0x15bc('0x54')],null))[_0x15bc('0x34')](respondWithResult(_0x3fe147,null))[_0x15bc('0x27')](handleError(_0x3fe147,null));};exports[_0x15bc('0x35')]=function(_0x43312d,_0xb3d5fa){return db['FaxMessage'][_0x15bc('0x55')]({'where':{'id':_0x43312d['params']['id']}})['then'](handleEntityNotFound(_0xb3d5fa,null))[_0x15bc('0x34')](removeEntity(_0xb3d5fa,null))[_0x15bc('0x27')](handleError(_0xb3d5fa,null));};exports[_0x15bc('0x56')]=function(_0x55f5a2,_0x25e8df){return db[_0x15bc('0x3a')][_0x15bc('0x56')]()['then'](respondWithResult(_0x25e8df,null))[_0x15bc('0x27')](handleError(_0x25e8df,null));};var interaction_log=require(_0x15bc('0x57'))(_0x15bc('0x58'));exports['accept']=function(_0x46a4aa,_0x2ed834,_0x56dea6){var _0x47f187={'agent':{},'channel':'fax'};if(_0x46a4aa[_0x15bc('0x54')]['id']){delete _0x46a4aa['body']['id'];}_0x46a4aa[_0x15bc('0x54')][_0x15bc('0x59')]=!![];_0x46a4aa[_0x15bc('0x54')]['readAt']=moment()[_0x15bc('0x5a')](_0x15bc('0x5b'));_0x46a4aa['body'][_0x15bc('0x5c')]=_0x46a4aa['body']['UserId']||_0x46a4aa[_0x15bc('0x5d')]['id'];_0x47f187[_0x15bc('0x5e')]['id']=_0x46a4aa[_0x15bc('0x54')][_0x15bc('0x5c')];return db['FaxMessage'][_0x15bc('0x55')]({'where':{'id':_0x46a4aa[_0x15bc('0x53')]['id'],'UserId':null}})[_0x15bc('0x34')](handleEntityNotFound(_0x2ed834,null))[_0x15bc('0x34')](saveUpdates(_0x46a4aa[_0x15bc('0x54')],null))['then'](function(_0x3b9d10){if(_0x3b9d10){_0x47f187[_0x15bc('0x25')]=_0x3b9d10[_0x15bc('0x5f')]({'plain':!![]});return db['FaxInteraction']['find']({'where':{'id':_0x3b9d10[_0x15bc('0x60')]}});}return null;})[_0x15bc('0x34')](handleEntityNotFound(_0x2ed834,null))[_0x15bc('0x34')](function(_0x2614c8){if(_0x2614c8){return _0x2614c8['update']({'UserId':_0x46a4aa[_0x15bc('0x54')][_0x15bc('0x5c')],'read1stAt':_['isNil'](_0x2614c8[_0x15bc('0x61')])?moment()[_0x15bc('0x5a')](_0x15bc('0x5b')):undefined});}return null;})['then'](function(_0x42521e){if(_0x42521e){_0x47f187[_0x15bc('0x62')]=_0x42521e[_0x15bc('0x5f')]({'plain':!![]});interaction_log[_0x15bc('0x1f')](_0x15bc('0x63'),_0x46a4aa['user']['id'],_0x46a4aa[_0x15bc('0x5d')][_0x15bc('0x38')],_0x46a4aa[_0x15bc('0x5d')][_0x15bc('0x64')],_0x47f187[_0x15bc('0x62')]['id'],_0x46a4aa['body']?JSON[_0x15bc('0x23')](_0x46a4aa['body']):_0x15bc('0x65'));return respondWithRpcPromise(_0x15bc('0x66'),_0x15bc('0x67'),_0x47f187);}return null;})[_0x15bc('0x34')](function(_0x157d66){var _0x4d665f=_0x15bc('0x68')+_0x157d66['message'][_0x15bc('0x69')];return db[_0x15bc('0x6a')][_0x15bc('0x40')](_0x4d665f,{'type':db[_0x15bc('0x6b')][_0x15bc('0x6c')][_0x15bc('0x6d')],'raw':!![]})['then'](function(_0x2aefc8){return _0x2aefc8;});})[_0x15bc('0x34')](function(_0x164e53){if(_0x164e53){_0x47f187[_0x15bc('0x25')]['contact']=_0x164e53[0x0];if(!_0x46a4aa[_0x15bc('0x54')][_0x15bc('0x5c')])return;return db[_0x15bc('0x6e')][_0x15bc('0x55')]({'where':{'id':_0x46a4aa[_0x15bc('0x54')][_0x15bc('0x5c')],'role':_0x15bc('0x5e')},'attributes':['id',_0x15bc('0x38'),_0x15bc('0x6f'),_0x15bc('0x70'),_0x15bc('0x71')],'raw':!![]});}return null;})[_0x15bc('0x34')](function(_0x33959c){if(!_0x33959c)return null;_0x47f187[_0x15bc('0x25')][_0x15bc('0x5e')]=_0x33959c;return _0x47f187;})[_0x15bc('0x34')](function(_0x58b40c){if(_0x58b40c){if(_0x46a4aa[_0x15bc('0x54')]['manual']){_0x47f187[_0x15bc('0x25')][_0x15bc('0x72')]=util['format'](_0x15bc('0x73'),_0x46a4aa['user'][_0x15bc('0x38')]);_0x47f187[_0x15bc('0x25')][_0x15bc('0x74')]=_0x47f187['channel'];_0x47f187['message'][_0x15bc('0x75')]=_0x47f187[_0x15bc('0x74')];_0x47f187['message'][_0x15bc('0x76')]='accept';return respondWithRpcPromise(_0x15bc('0x77'),_0x15bc('0x77'),{'event':'acceptmessage','message':_0x47f187[_0x15bc('0x25')]},client9002)[_0x15bc('0x34')](function(){return _0x47f187;});}return _0x47f187;}return null;})['then'](respondWithResult(_0x2ed834,null))['catch'](handleError(_0x2ed834,null));};var interaction_log=require(_0x15bc('0x57'))('fax-interactions');exports[_0x15bc('0x31')]=function(_0x49ca16,_0x1d294b,_0x4a66ae){var _0x27afcf={'agent':{},'channel':_0x15bc('0x78')};if(_0x49ca16['body']['id']){delete _0x49ca16[_0x15bc('0x54')]['id'];}_0x49ca16[_0x15bc('0x54')][_0x15bc('0x5c')]=_0x49ca16[_0x15bc('0x54')]['UserId']||_0x49ca16[_0x15bc('0x5d')]['id'];_0x27afcf[_0x15bc('0x5e')]['id']=_0x49ca16[_0x15bc('0x54')][_0x15bc('0x5c')];return db[_0x15bc('0x3a')][_0x15bc('0x55')]({'where':{'id':_0x49ca16[_0x15bc('0x53')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x1d294b,null))['then'](function(_0x2eecf7){if(_0x2eecf7){_0x27afcf[_0x15bc('0x25')]=_0x2eecf7['get']({'plain':!![]});return db['FaxInteraction'][_0x15bc('0x55')]({'where':{'id':_0x2eecf7['FaxInteractionId']}});}return null;})[_0x15bc('0x34')](handleEntityNotFound(_0x1d294b,null))[_0x15bc('0x34')](function(_0x3aeaad){if(_0x3aeaad){_0x27afcf['interaction']=_0x3aeaad['get']({'plain':!![]});interaction_log['info']('[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x49ca16['user']['id'],_0x49ca16[_0x15bc('0x5d')]['name'],_0x49ca16[_0x15bc('0x5d')]['role'],_0x27afcf[_0x15bc('0x62')]['id'],_0x49ca16[_0x15bc('0x54')]?JSON['stringify'](_0x49ca16[_0x15bc('0x54')]):_0x15bc('0x65'));return respondWithRpcPromise(_0x15bc('0x79'),_0x15bc('0x7a'),_0x27afcf);}return null;})[_0x15bc('0x34')](function(_0x4271b6){var _0x28d0a8=_0x15bc('0x68')+_0x4271b6[_0x15bc('0x25')][_0x15bc('0x69')];return db[_0x15bc('0x6a')]['query'](_0x28d0a8,{'type':db[_0x15bc('0x6b')][_0x15bc('0x6c')]['SELECT'],'raw':!![]})['then'](function(_0x2998f4){return _0x2998f4;});})[_0x15bc('0x34')](function(_0x3db777){if(_0x3db777){_0x27afcf[_0x15bc('0x25')][_0x15bc('0x7b')]=_0x3db777[0x0];if(!_0x49ca16[_0x15bc('0x54')]['UserId'])return;return db[_0x15bc('0x6e')][_0x15bc('0x55')]({'where':{'id':_0x49ca16[_0x15bc('0x54')]['UserId'],'role':'agent'},'attributes':['id',_0x15bc('0x38'),_0x15bc('0x6f'),'email',_0x15bc('0x71')],'raw':!![]});}return null;})['then'](function(_0x12a719){if(!_0x12a719)return null;_0x27afcf[_0x15bc('0x25')]['agent']=_0x12a719;return _0x27afcf;})[_0x15bc('0x34')](function(_0x2c6b88){if(_0x2c6b88){_0x2c6b88[_0x15bc('0x25')][_0x15bc('0x72')]=util[_0x15bc('0x5a')](_0x15bc('0x73'),_0x49ca16[_0x15bc('0x5d')][_0x15bc('0x38')]);_0x2c6b88['message']['channel']=_0x27afcf[_0x15bc('0x74')];_0x2c6b88[_0x15bc('0x25')][_0x15bc('0x75')]=_0x27afcf[_0x15bc('0x74')];_0x2c6b88['message'][_0x15bc('0x76')]=_0x15bc('0x31');respondWithRpcPromise(_0x15bc('0x77'),_0x15bc('0x77'),{'event':_0x15bc('0x7c'),'message':_0x2c6b88[_0x15bc('0x25')]},client9002);return _0x27afcf;}return null;})[_0x15bc('0x34')](respondWithResult(_0x1d294b,null))[_0x15bc('0x27')](handleError(_0x1d294b,null));};exports[_0x15bc('0x7d')]=function(_0x5eff69,_0x1412f3){var _0x516220;return db['FaxMessage'][_0x15bc('0x7d')](_0x5eff69[_0x15bc('0x54')],{})[_0x15bc('0x34')](function(_0x4f6aa8){_0x516220=_0x4f6aa8;return db[_0x15bc('0x7e')][_0x15bc('0x7f')]({'where':{'id':_0x516220['ContactId']}});})[_0x15bc('0x34')](function(_0x3b41f9){if(_[_0x15bc('0x80')](_0x3b41f9)){return;}else{_0x516220[_0x15bc('0x78')]=_0x3b41f9[_0x15bc('0x78')];return db[_0x15bc('0x81')][_0x15bc('0x7f')]({'where':{'id':_0x516220[_0x15bc('0x82')]}});}})['then'](function(_0x3c8460){return respondWithRpcPromise(_0x15bc('0x83'),_0x15bc('0x83'),{'FaxAccountId':_[_0x15bc('0x80')](_0x5eff69['body'])?undefined:_0x5eff69['body'][_0x15bc('0x84')],'path':_[_0x15bc('0x80')](_0x3c8460)?undefined:util[_0x15bc('0x5a')](_0x15bc('0x85'),_0x3c8460[_0x15bc('0x86')]),'fax':_['isNil'](_0x516220[_0x15bc('0x78')])?undefined:_0x516220[_0x15bc('0x78')],'AttachmentId':_0x516220['AttachmentId']},client9002);})[_0x15bc('0x34')](respondWithResult(_0x1412f3,0xc9))[_0x15bc('0x27')](handleError(_0x1412f3,null));};exports['download']=function(_0x1d967d,_0x54e5ed){var _0x13cff7=path[_0x15bc('0x87')](config['root'],_0x15bc('0x88'),_0x15bc('0x89'),_0x15bc('0x8a'));return db[_0x15bc('0x3a')]['find']({'where':{'id':_0x1d967d[_0x15bc('0x53')]['id']},'include':[{'model':db['Attachment'],'as':_0x15bc('0x81')}]})[_0x15bc('0x34')](handleEntityNotFound(_0x54e5ed,null))['then'](function(_0x2332c0){if(_0x2332c0){return _0x54e5ed[_0x15bc('0x8b')](path[_0x15bc('0x87')](_0x13cff7,_0x2332c0[_0x15bc('0x81')][_0x15bc('0x86')]));}})[_0x15bc('0x27')](handleError(_0x54e5ed,null));}; \ No newline at end of file +var _0xbbad=['contact','UserId','User','fullname','internal','interface','SIP/%s','channel','event','EventManager','acceptmessage','get','FaxInteractionId','interaction','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','sequelize','email','motionChannel','rejectmessage','create','CmContact','findOne','Attachment','AttachmentId','SendFax','FaxAccountId','basename','download','join','server','files','attachments','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./faxMessage.socket','register','jayson/promise','client','http','then','info','FaxMessage,\x20%s,\x20%s','debug','FaxMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','reject','save','stack','send','index','map','rawAttributes','fieldName','type','model','name','query','keys','filters','intersection','attributes','fields','length','nolimit','order','pick','filter','where','merge','VIRTUAL','FaxMessage','include','findAll','params','includeAll','options','update','body','find','describe','fax-interactions','accept','fax','read','readAt','format','user','agent','FaxInteraction','isNil','read1stAt','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT'];(function(_0xa1f227,_0x5ab71e){var _0x1e2ad1=function(_0x5c9f1e){while(--_0x5c9f1e){_0xa1f227['push'](_0xa1f227['shift']());}};_0x1e2ad1(++_0x5ab71e);}(_0xbbad,0x1d0));var _0xdbba=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbbad[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xdbba('0x0'));var rimraf=require(_0xdbba('0x1'));var zipdir=require(_0xdbba('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdbba('0x3'));var moment=require('moment');var BPromise=require(_0xdbba('0x4'));var Mustache=require(_0xdbba('0x5'));var util=require(_0xdbba('0x6'));var path=require(_0xdbba('0x7'));var sox=require(_0xdbba('0x8'));var csv=require(_0xdbba('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdbba('0xa'));var _=require(_0xdbba('0xb'));var squel=require(_0xdbba('0xc'));var crypto=require('crypto');var jsforce=require(_0xdbba('0xd'));var deskjs=require(_0xdbba('0xe'));var toCsv=require(_0xdbba('0x9'));var querystring=require(_0xdbba('0xf'));var Papa=require(_0xdbba('0x10'));var Redis=require('ioredis');var authService=require(_0xdbba('0x11'));var qs=require(_0xdbba('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdbba('0x13'));var logger=require(_0xdbba('0x14'))('api');var utils=require(_0xdbba('0x15'));var config=require(_0xdbba('0x16'));var licenseUtil=require(_0xdbba('0x17'));var db=require(_0xdbba('0x18'))['db'];config[_0xdbba('0x19')]=_[_0xdbba('0x1a')](config[_0xdbba('0x19')],{'host':_0xdbba('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xdbba('0x1c'))[_0xdbba('0x1d')](socket);var jayson=require(_0xdbba('0x1e'));var client=jayson[_0xdbba('0x1f')]['http']({'port':0x232c});var client9002=jayson['client'][_0xdbba('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x5e4c7f,_0x5d5720,_0x648bd1,_0x40c9de){return new BPromise(function(_0x117b17,_0x2a27da){var _0x531ff1=_0x40c9de||client;return _0x531ff1['request'](_0x5e4c7f,_0x648bd1)[_0xdbba('0x21')](function(_0x324652){logger[_0xdbba('0x22')](_0xdbba('0x23'),_0x5d5720,'request\x20sent');logger[_0xdbba('0x24')](_0xdbba('0x25'),_0x5d5720,_0xdbba('0x26'),JSON[_0xdbba('0x27')](_0x324652));if(_0x324652[_0xdbba('0x28')]){if(_0x324652[_0xdbba('0x28')][_0xdbba('0x29')]===0x1f4){logger['error'](_0xdbba('0x23'),_0x5d5720,_0x324652[_0xdbba('0x28')][_0xdbba('0x2a')]);return _0x2a27da(_0x324652[_0xdbba('0x28')]['message']);}logger[_0xdbba('0x28')]('FaxMessage,\x20%s,\x20%s',_0x5d5720,_0x324652[_0xdbba('0x28')]['message']);return _0x117b17(_0x324652[_0xdbba('0x28')][_0xdbba('0x2a')]);}else{logger['info'](_0xdbba('0x23'),_0x5d5720,'request\x20sent');_0x117b17(_0x324652[_0xdbba('0x2b')][_0xdbba('0x2a')]);}})[_0xdbba('0x2c')](function(_0x3c9bf6){logger[_0xdbba('0x28')](_0xdbba('0x23'),_0x5d5720,_0x3c9bf6);_0x2a27da(_0x3c9bf6);});});}function respondWithStatusCode(_0x1f4c4a,_0x174fbb){_0x174fbb=_0x174fbb||0xcc;return function(_0x46be28){if(_0x46be28){return _0x1f4c4a[_0xdbba('0x2d')](_0x174fbb);}return _0x1f4c4a[_0xdbba('0x2e')](_0x174fbb)[_0xdbba('0x2f')]();};}function respondWithResult(_0x495c7e,_0x1360e1){_0x1360e1=_0x1360e1||0xc8;return function(_0x40104f){if(_0x40104f){return _0x495c7e['status'](_0x1360e1)['json'](_0x40104f);}};}function respondWithFilteredResult(_0x292996,_0x17a4fe){return function(_0x35ddca){if(_0x35ddca){var _0x451929=typeof _0x17a4fe[_0xdbba('0x30')]==='undefined'&&typeof _0x17a4fe[_0xdbba('0x31')]===_0xdbba('0x32');var _0x4b329a=_0x35ddca[_0xdbba('0x33')];var _0x46b671=_0x451929?0x0:_0x17a4fe[_0xdbba('0x30')];var _0x44651a=_0x451929?_0x35ddca[_0xdbba('0x33')]:_0x17a4fe[_0xdbba('0x30')]+_0x17a4fe[_0xdbba('0x31')];var _0x12c36d;if(_0x44651a>=_0x4b329a){_0x44651a=_0x4b329a;_0x12c36d=0xc8;}else{_0x12c36d=0xce;}_0x292996[_0xdbba('0x2e')](_0x12c36d);return _0x292996[_0xdbba('0x34')](_0xdbba('0x35'),_0x46b671+'-'+_0x44651a+'/'+_0x4b329a)['json'](_0x35ddca);}return null;};}function patchUpdates(_0x3dd597){return function(_0x5a0f8e){try{jsonpatch['apply'](_0x5a0f8e,_0x3dd597,!![]);}catch(_0x3ec2ae){return BPromise[_0xdbba('0x36')](_0x3ec2ae);}return _0x5a0f8e[_0xdbba('0x37')]();};}function saveUpdates(_0x47df4a,_0x2aa817){return function(_0x595c20){if(_0x595c20){return _0x595c20['update'](_0x47df4a)[_0xdbba('0x21')](function(_0x33abd7){return _0x33abd7;});}return null;};}function removeEntity(_0x104a83,_0xb66932){return function(_0x6dfb32){if(_0x6dfb32){return _0x6dfb32['destroy']()[_0xdbba('0x21')](function(){_0x104a83[_0xdbba('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x115afe,_0x1daad9){return function(_0x3d2687){if(!_0x3d2687){_0x115afe[_0xdbba('0x2d')](0x194);}return _0x3d2687;};}function handleError(_0x36e7a5,_0x288f89){_0x288f89=_0x288f89||0x1f4;return function(_0x34ddd5){logger[_0xdbba('0x28')](_0x34ddd5[_0xdbba('0x38')]);if(_0x34ddd5['name']){delete _0x34ddd5['name'];}_0x36e7a5[_0xdbba('0x2e')](_0x288f89)[_0xdbba('0x39')](_0x34ddd5);};}exports[_0xdbba('0x3a')]=function(_0x5c9dfd,_0x48dbab){var _0x135b88={},_0x42cf4a={},_0x4058ee={'count':0x0,'rows':[]};var _0x5cfee9=_[_0xdbba('0x3b')](db['FaxMessage'][_0xdbba('0x3c')],function(_0x5440ca){return{'name':_0x5440ca[_0xdbba('0x3d')],'type':_0x5440ca[_0xdbba('0x3e')]['key']};});_0x42cf4a[_0xdbba('0x3f')]=_['map'](_0x5cfee9,_0xdbba('0x40'));_0x42cf4a[_0xdbba('0x41')]=_[_0xdbba('0x42')](_0x5c9dfd[_0xdbba('0x41')]);_0x42cf4a[_0xdbba('0x43')]=_[_0xdbba('0x44')](_0x42cf4a[_0xdbba('0x3f')],_0x42cf4a[_0xdbba('0x41')]);_0x135b88[_0xdbba('0x45')]=_['intersection'](_0x42cf4a[_0xdbba('0x3f')],qs[_0xdbba('0x46')](_0x5c9dfd[_0xdbba('0x41')][_0xdbba('0x46')]));_0x135b88[_0xdbba('0x45')]=_0x135b88[_0xdbba('0x45')][_0xdbba('0x47')]?_0x135b88[_0xdbba('0x45')]:_0x42cf4a[_0xdbba('0x3f')];if(!_0x5c9dfd[_0xdbba('0x41')]['hasOwnProperty'](_0xdbba('0x48'))){_0x135b88[_0xdbba('0x31')]=qs[_0xdbba('0x31')](_0x5c9dfd['query'][_0xdbba('0x31')]);_0x135b88[_0xdbba('0x30')]=qs[_0xdbba('0x30')](_0x5c9dfd['query'][_0xdbba('0x30')]);}_0x135b88[_0xdbba('0x49')]=qs['sort'](_0x5c9dfd['query']['sort']);_0x135b88['where']=qs[_0xdbba('0x43')](_[_0xdbba('0x4a')](_0x5c9dfd[_0xdbba('0x41')],_0x42cf4a[_0xdbba('0x43')]),_0x5cfee9);if(_0x5c9dfd[_0xdbba('0x41')][_0xdbba('0x4b')]){_0x135b88[_0xdbba('0x4c')]=_[_0xdbba('0x4d')](_0x135b88[_0xdbba('0x4c')],{'$or':_[_0xdbba('0x3b')](_0x5cfee9,function(_0x10b640){if(_0x10b640['type']!==_0xdbba('0x4e')){var _0x6a1486={};_0x6a1486[_0x10b640[_0xdbba('0x40')]]={'$like':'%'+_0x5c9dfd[_0xdbba('0x41')][_0xdbba('0x4b')]+'%'};return _0x6a1486;}})});}_0x135b88=_[_0xdbba('0x4d')]({},_0x135b88,_0x5c9dfd['options']);var _0x5e9bac={'where':_0x135b88['where']};return db[_0xdbba('0x4f')][_0xdbba('0x33')](_0x5e9bac)[_0xdbba('0x21')](function(_0x22bea6){_0x4058ee[_0xdbba('0x33')]=_0x22bea6;if(_0x5c9dfd[_0xdbba('0x41')]['includeAll']){_0x135b88[_0xdbba('0x50')]=[{'all':!![]}];}return db['FaxMessage'][_0xdbba('0x51')](_0x135b88);})[_0xdbba('0x21')](function(_0x81fefe){_0x4058ee['rows']=_0x81fefe;return _0x4058ee;})[_0xdbba('0x21')](respondWithFilteredResult(_0x48dbab,_0x135b88))['catch'](handleError(_0x48dbab,null));};exports['show']=function(_0x5ee1eb,_0x56dbcf){var _0x42ecf6={'raw':!![],'where':{'id':_0x5ee1eb[_0xdbba('0x52')]['id']}},_0x271d40={};_0x271d40[_0xdbba('0x3f')]=_[_0xdbba('0x42')](db[_0xdbba('0x4f')][_0xdbba('0x3c')]);_0x271d40[_0xdbba('0x41')]=_['keys'](_0x5ee1eb['query']);_0x271d40[_0xdbba('0x43')]=_['intersection'](_0x271d40[_0xdbba('0x3f')],_0x271d40[_0xdbba('0x41')]);_0x42ecf6['attributes']=_[_0xdbba('0x44')](_0x271d40[_0xdbba('0x3f')],qs[_0xdbba('0x46')](_0x5ee1eb['query'][_0xdbba('0x46')]));_0x42ecf6[_0xdbba('0x45')]=_0x42ecf6[_0xdbba('0x45')][_0xdbba('0x47')]?_0x42ecf6[_0xdbba('0x45')]:_0x271d40['model'];if(_0x5ee1eb[_0xdbba('0x41')][_0xdbba('0x53')]){_0x42ecf6[_0xdbba('0x50')]=[{'all':!![]}];}_0x42ecf6=_[_0xdbba('0x4d')]({},_0x42ecf6,_0x5ee1eb[_0xdbba('0x54')]);return db[_0xdbba('0x4f')]['find'](_0x42ecf6)[_0xdbba('0x21')](handleEntityNotFound(_0x56dbcf,null))[_0xdbba('0x21')](respondWithResult(_0x56dbcf,null))[_0xdbba('0x2c')](handleError(_0x56dbcf,null));};exports[_0xdbba('0x55')]=function(_0x4f7397,_0x521dcf){if(_0x4f7397[_0xdbba('0x56')]['id']){delete _0x4f7397[_0xdbba('0x56')]['id'];}return db['FaxMessage'][_0xdbba('0x57')]({'where':{'id':_0x4f7397['params']['id']}})[_0xdbba('0x21')](handleEntityNotFound(_0x521dcf,null))[_0xdbba('0x21')](saveUpdates(_0x4f7397[_0xdbba('0x56')],null))[_0xdbba('0x21')](respondWithResult(_0x521dcf,null))[_0xdbba('0x2c')](handleError(_0x521dcf,null));};exports['destroy']=function(_0x449d37,_0x210c54){return db[_0xdbba('0x4f')][_0xdbba('0x57')]({'where':{'id':_0x449d37['params']['id']}})[_0xdbba('0x21')](handleEntityNotFound(_0x210c54,null))[_0xdbba('0x21')](removeEntity(_0x210c54,null))[_0xdbba('0x2c')](handleError(_0x210c54,null));};exports[_0xdbba('0x58')]=function(_0x26e1ab,_0xb715c9){return db[_0xdbba('0x4f')][_0xdbba('0x58')]()['then'](respondWithResult(_0xb715c9,null))[_0xdbba('0x2c')](handleError(_0xb715c9,null));};var interaction_log=require(_0xdbba('0x14'))(_0xdbba('0x59'));exports[_0xdbba('0x5a')]=function(_0x5989b5,_0xf46931,_0x200b4e){var _0x2c7443={'agent':{},'channel':_0xdbba('0x5b')};if(_0x5989b5[_0xdbba('0x56')]['id']){delete _0x5989b5[_0xdbba('0x56')]['id'];}_0x5989b5[_0xdbba('0x56')][_0xdbba('0x5c')]=!![];_0x5989b5[_0xdbba('0x56')][_0xdbba('0x5d')]=moment()[_0xdbba('0x5e')]('YYYY-MM-DD\x20HH:mm:ss');_0x5989b5[_0xdbba('0x56')]['UserId']=_0x5989b5[_0xdbba('0x56')]['UserId']||_0x5989b5[_0xdbba('0x5f')]['id'];_0x2c7443[_0xdbba('0x60')]['id']=_0x5989b5[_0xdbba('0x56')]['UserId'];return db['FaxMessage'][_0xdbba('0x57')]({'where':{'id':_0x5989b5[_0xdbba('0x52')]['id'],'UserId':null}})[_0xdbba('0x21')](handleEntityNotFound(_0xf46931,null))[_0xdbba('0x21')](saveUpdates(_0x5989b5['body'],null))[_0xdbba('0x21')](function(_0x5241b6){if(_0x5241b6){_0x2c7443[_0xdbba('0x2a')]=_0x5241b6['get']({'plain':!![]});return db[_0xdbba('0x61')]['find']({'where':{'id':_0x5241b6['FaxInteractionId']}});}return null;})[_0xdbba('0x21')](handleEntityNotFound(_0xf46931,null))[_0xdbba('0x21')](function(_0x588b69){if(_0x588b69){return _0x588b69[_0xdbba('0x55')]({'UserId':_0x5989b5['body']['UserId'],'read1stAt':_[_0xdbba('0x62')](_0x588b69[_0xdbba('0x63')])?moment()[_0xdbba('0x5e')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xdbba('0x21')](function(_0x1717d8){if(_0x1717d8){_0x2c7443['interaction']=_0x1717d8['get']({'plain':!![]});interaction_log[_0xdbba('0x22')](_0xdbba('0x64'),_0x5989b5[_0xdbba('0x5f')]['id'],_0x5989b5[_0xdbba('0x5f')]['name'],_0x5989b5[_0xdbba('0x5f')][_0xdbba('0x65')],_0x2c7443['interaction']['id'],_0x5989b5['body']?JSON[_0xdbba('0x27')](_0x5989b5[_0xdbba('0x56')]):'null');return respondWithRpcPromise('AcceptMessage',_0xdbba('0x66'),_0x2c7443);}return null;})[_0xdbba('0x21')](function(_0x5ea7bc){var _0x2b23b9=_0xdbba('0x67')+_0x5ea7bc[_0xdbba('0x2a')][_0xdbba('0x68')];return db['sequelize'][_0xdbba('0x41')](_0x2b23b9,{'type':db[_0xdbba('0x69')][_0xdbba('0x6a')][_0xdbba('0x6b')],'raw':!![]})[_0xdbba('0x21')](function(_0x2bb398){return _0x2bb398;});})[_0xdbba('0x21')](function(_0x417a23){if(_0x417a23){_0x2c7443[_0xdbba('0x2a')][_0xdbba('0x6c')]=_0x417a23[0x0];if(!_0x5989b5[_0xdbba('0x56')][_0xdbba('0x6d')])return;return db[_0xdbba('0x6e')][_0xdbba('0x57')]({'where':{'id':_0x5989b5[_0xdbba('0x56')][_0xdbba('0x6d')],'role':_0xdbba('0x60')},'attributes':['id',_0xdbba('0x40'),_0xdbba('0x6f'),'email',_0xdbba('0x70')],'raw':!![]});}return null;})[_0xdbba('0x21')](function(_0x56b3cb){if(!_0x56b3cb)return null;_0x2c7443['message'][_0xdbba('0x60')]=_0x56b3cb;return _0x2c7443;})['then'](function(_0x50bb35){if(_0x50bb35){if(_0x5989b5[_0xdbba('0x56')]['manual']){_0x2c7443[_0xdbba('0x2a')][_0xdbba('0x71')]=util['format'](_0xdbba('0x72'),_0x5989b5[_0xdbba('0x5f')]['name']);_0x2c7443[_0xdbba('0x2a')]['channel']=_0x2c7443[_0xdbba('0x73')];_0x2c7443[_0xdbba('0x2a')]['motionChannel']=_0x2c7443[_0xdbba('0x73')];_0x2c7443[_0xdbba('0x2a')][_0xdbba('0x74')]=_0xdbba('0x5a');return respondWithRpcPromise('EventManager',_0xdbba('0x75'),{'event':_0xdbba('0x76'),'message':_0x2c7443[_0xdbba('0x2a')]},client9002)['then'](function(){return _0x2c7443;});}return _0x2c7443;}return null;})['then'](respondWithResult(_0xf46931,null))[_0xdbba('0x2c')](handleError(_0xf46931,null));};var interaction_log=require(_0xdbba('0x14'))(_0xdbba('0x59'));exports[_0xdbba('0x36')]=function(_0x445bbd,_0x536bf6,_0x1cbaa3){var _0x4ae4b3={'agent':{},'channel':_0xdbba('0x5b')};if(_0x445bbd[_0xdbba('0x56')]['id']){delete _0x445bbd[_0xdbba('0x56')]['id'];}_0x445bbd[_0xdbba('0x56')][_0xdbba('0x6d')]=_0x445bbd[_0xdbba('0x56')][_0xdbba('0x6d')]||_0x445bbd[_0xdbba('0x5f')]['id'];_0x4ae4b3[_0xdbba('0x60')]['id']=_0x445bbd['body'][_0xdbba('0x6d')];return db['FaxMessage'][_0xdbba('0x57')]({'where':{'id':_0x445bbd[_0xdbba('0x52')]['id'],'UserId':null}})[_0xdbba('0x21')](handleEntityNotFound(_0x536bf6,null))[_0xdbba('0x21')](function(_0x1cb774){if(_0x1cb774){_0x4ae4b3[_0xdbba('0x2a')]=_0x1cb774[_0xdbba('0x77')]({'plain':!![]});return db['FaxInteraction'][_0xdbba('0x57')]({'where':{'id':_0x1cb774[_0xdbba('0x78')]}});}return null;})[_0xdbba('0x21')](handleEntityNotFound(_0x536bf6,null))[_0xdbba('0x21')](function(_0xf6e2a3){if(_0xf6e2a3){_0x4ae4b3[_0xdbba('0x79')]=_0xf6e2a3[_0xdbba('0x77')]({'plain':!![]});interaction_log['info'](_0xdbba('0x7a'),_0x445bbd['user']['id'],_0x445bbd[_0xdbba('0x5f')]['name'],_0x445bbd[_0xdbba('0x5f')][_0xdbba('0x65')],_0x4ae4b3[_0xdbba('0x79')]['id'],_0x445bbd[_0xdbba('0x56')]?JSON[_0xdbba('0x27')](_0x445bbd[_0xdbba('0x56')]):_0xdbba('0x7b'));return respondWithRpcPromise(_0xdbba('0x7c'),_0xdbba('0x7d'),_0x4ae4b3);}return null;})[_0xdbba('0x21')](function(_0xdbe9c7){var _0x59c7ca='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0xdbe9c7['message'][_0xdbba('0x68')];return db[_0xdbba('0x7e')]['query'](_0x59c7ca,{'type':db[_0xdbba('0x69')]['QueryTypes'][_0xdbba('0x6b')],'raw':!![]})[_0xdbba('0x21')](function(_0x4d331e){return _0x4d331e;});})[_0xdbba('0x21')](function(_0x657be9){if(_0x657be9){_0x4ae4b3[_0xdbba('0x2a')][_0xdbba('0x6c')]=_0x657be9[0x0];if(!_0x445bbd[_0xdbba('0x56')]['UserId'])return;return db[_0xdbba('0x6e')]['find']({'where':{'id':_0x445bbd[_0xdbba('0x56')][_0xdbba('0x6d')],'role':'agent'},'attributes':['id','name',_0xdbba('0x6f'),_0xdbba('0x7f'),_0xdbba('0x70')],'raw':!![]});}return null;})[_0xdbba('0x21')](function(_0xfacb4){if(!_0xfacb4)return null;_0x4ae4b3[_0xdbba('0x2a')][_0xdbba('0x60')]=_0xfacb4;return _0x4ae4b3;})[_0xdbba('0x21')](function(_0x7cd17b){if(_0x7cd17b){_0x7cd17b[_0xdbba('0x2a')][_0xdbba('0x71')]=util[_0xdbba('0x5e')](_0xdbba('0x72'),_0x445bbd['user'][_0xdbba('0x40')]);_0x7cd17b[_0xdbba('0x2a')]['channel']=_0x4ae4b3['channel'];_0x7cd17b[_0xdbba('0x2a')][_0xdbba('0x80')]=_0x4ae4b3['channel'];_0x7cd17b[_0xdbba('0x2a')]['event']=_0xdbba('0x36');respondWithRpcPromise('EventManager',_0xdbba('0x75'),{'event':_0xdbba('0x81'),'message':_0x7cd17b[_0xdbba('0x2a')]},client9002);return _0x4ae4b3;}return null;})[_0xdbba('0x21')](respondWithResult(_0x536bf6,null))[_0xdbba('0x2c')](handleError(_0x536bf6,null));};exports[_0xdbba('0x82')]=function(_0x21b9b9,_0x50bdad){var _0x4087ee;return db[_0xdbba('0x4f')][_0xdbba('0x82')](_0x21b9b9['body'],{})['then'](function(_0x350680){_0x4087ee=_0x350680;return db[_0xdbba('0x83')][_0xdbba('0x84')]({'where':{'id':_0x4087ee[_0xdbba('0x68')]}});})[_0xdbba('0x21')](function(_0x22fd9f){if(_['isNil'](_0x22fd9f)){return;}else{_0x4087ee[_0xdbba('0x5b')]=_0x22fd9f[_0xdbba('0x5b')];return db[_0xdbba('0x85')]['findOne']({'where':{'id':_0x4087ee[_0xdbba('0x86')]}});}})[_0xdbba('0x21')](function(_0x2e56a8){return respondWithRpcPromise(_0xdbba('0x87'),_0xdbba('0x87'),{'FaxAccountId':_[_0xdbba('0x62')](_0x21b9b9[_0xdbba('0x56')])?undefined:_0x21b9b9[_0xdbba('0x56')][_0xdbba('0x88')],'path':_[_0xdbba('0x62')](_0x2e56a8)?undefined:util[_0xdbba('0x5e')]('/var/opt/motion2/server/files/attachments/%s',_0x2e56a8[_0xdbba('0x89')]),'fax':_[_0xdbba('0x62')](_0x4087ee['fax'])?undefined:_0x4087ee[_0xdbba('0x5b')],'AttachmentId':_0x4087ee[_0xdbba('0x86')]},client9002);})[_0xdbba('0x21')](respondWithResult(_0x50bdad,0xc9))[_0xdbba('0x2c')](handleError(_0x50bdad,null));};exports[_0xdbba('0x8a')]=function(_0x474c9b,_0x5a4a68){var _0x2769d1=path[_0xdbba('0x8b')](config['root'],_0xdbba('0x8c'),_0xdbba('0x8d'),_0xdbba('0x8e'));return db[_0xdbba('0x4f')]['find']({'where':{'id':_0x474c9b[_0xdbba('0x52')]['id']},'include':[{'model':db[_0xdbba('0x85')],'as':'Attachment'}]})[_0xdbba('0x21')](handleEntityNotFound(_0x5a4a68,null))['then'](function(_0x34981a){if(_0x34981a){return _0x5a4a68[_0xdbba('0x8a')](path[_0xdbba('0x8b')](_0x2769d1,_0x34981a[_0xdbba('0x85')][_0xdbba('0x89')]));}})[_0xdbba('0x2c')](handleError(_0x5a4a68,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 2a41408..f6ed07b 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 _0x41d0=['remove','emit','hasOwnProperty','exports','events','../../mysqldb','FaxMessage','setMaxListeners','update'];(function(_0x222688,_0x46c5eb){var _0x437433=function(_0x29958c){while(--_0x29958c){_0x222688['push'](_0x222688['shift']());}};_0x437433(++_0x46c5eb);}(_0x41d0,0x1c6));var _0x041d=function(_0x2709f9,_0x2c9b2e){_0x2709f9=_0x2709f9-0x0;var _0x51da75=_0x41d0[_0x2709f9];return _0x51da75;};'use strict';var EventEmitter=require(_0x041d('0x0'));var FaxMessage=require(_0x041d('0x1'))['db'][_0x041d('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x041d('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x041d('0x4'),'afterDestroy':_0x041d('0x5')};function emitEvent(_0x12e55d){return function(_0x397dad,_0x41e587,_0x3a22a4){FaxMessageEvents[_0x041d('0x6')](_0x12e55d+':'+_0x397dad['id'],_0x397dad);FaxMessageEvents[_0x041d('0x6')](_0x12e55d,_0x397dad);_0x3a22a4(null);};}for(var e in events){if(events[_0x041d('0x7')](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module[_0x041d('0x8')]=FaxMessageEvents; \ No newline at end of file +var _0x6faf=['FaxMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x48712a,_0x178341){var _0x3c36f1=function(_0x322d66){while(--_0x322d66){_0x48712a['push'](_0x48712a['shift']());}};_0x3c36f1(++_0x178341);}(_0x6faf,0xf9));var _0xf6fa=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x6faf[_0xa464c9];return _0x3d73c4;};'use strict';var EventEmitter=require('events');var FaxMessage=require(_0xf6fa('0x0'))['db'][_0xf6fa('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xf6fa('0x2')](0x0);var events={'afterCreate':_0xf6fa('0x3'),'afterUpdate':_0xf6fa('0x4'),'afterDestroy':_0xf6fa('0x5')};function emitEvent(_0x4f1f7a){return function(_0x243626,_0x4c2fda,_0xed8c6b){FaxMessageEvents['emit'](_0x4f1f7a+':'+_0x243626['id'],_0x243626);FaxMessageEvents[_0xf6fa('0x6')](_0x4f1f7a,_0x243626);_0xed8c6b(null);};}for(var e in events){if(events[_0xf6fa('0x7')](e)){var event=events[e];FaxMessage[_0xf6fa('0x8')](e,emitEvent(event));}}module[_0xf6fa('0x9')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index b4fee6a..0b04cb0 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 _0xd523=['get','direction','toLowerCase','secret','isNil','UserId','FaxInteraction','findOne','update','createdAt','error','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./faxMessage.attributes','define','FaxMessage','fax_messages','fti_fax_messages','body','FULLTEXT','models'];(function(_0x508338,_0xcf1f4d){var _0x1ccd1b=function(_0x3b4525){while(--_0x3b4525){_0x508338['push'](_0x508338['shift']());}};_0x1ccd1b(++_0xcf1f4d);}(_0xd523,0x112));var _0x3d52=function(_0x36722b,_0x429390){_0x36722b=_0x36722b-0x0;var _0x2a9748=_0xd523[_0x36722b];return _0x2a9748;};'use strict';var _=require('lodash');var util=require(_0x3d52('0x0'));var logger=require(_0x3d52('0x1'))(_0x3d52('0x2'));var moment=require(_0x3d52('0x3'));var BPromise=require(_0x3d52('0x4'));var rp=require(_0x3d52('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3d52('0x6'));var config=require(_0x3d52('0x7'));var attributes=require(_0x3d52('0x8'));module['exports']=function(_0x6aec2e,_0x286b76){return _0x6aec2e[_0x3d52('0x9')](_0x3d52('0xa'),attributes,{'tableName':_0x3d52('0xb'),'paranoid':![],'indexes':[{'name':_0x3d52('0xc'),'fields':[_0x3d52('0xd')],'type':_0x3d52('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x37372c,_0x51b9e8,_0x2661b7){var _0x19f905=_0x6aec2e[_0x3d52('0xf')];var _0x19fdd3=_0x37372c[_0x3d52('0x10')]({'plain':!![]});if(_0x19fdd3[_0x3d52('0x11')][_0x3d52('0x12')]()==='in'||_0x19fdd3[_0x3d52('0x11')]['toLowerCase']()==='out'&&!_0x19fdd3[_0x3d52('0x13')]&&!_[_0x3d52('0x14')](_0x19fdd3[_0x3d52('0x15')])){_0x19f905[_0x3d52('0x16')][_0x3d52('0x17')]({'where':{'id':_0x19fdd3['FaxInteractionId']}})['then'](function(_0xe984f){if(_0xe984f){_0xe984f[_0x3d52('0x18')]({'lastMsgAt':_0x19fdd3[_0x3d52('0x19')],'lastMsgDirection':_0x19fdd3[_0x3d52('0x11')][_0x3d52('0x12')]()});}})['catch'](function(_0x4c6044){console[_0x3d52('0x1a')](_0x4c6044);});}_0x2661b7();}},'charset':_0x3d52('0x1b'),'collate':_0x3d52('0x1c')});}; \ No newline at end of file +var _0xfbe4=['update','createdAt','direction','catch','error','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxMessage.attributes','define','FaxMessage','fti_fax_messages','toLowerCase','secret','UserId','FaxInteraction'];(function(_0x2ed091,_0x2d504b){var _0xa7e658=function(_0xc46dc5){while(--_0xc46dc5){_0x2ed091['push'](_0x2ed091['shift']());}};_0xa7e658(++_0x2d504b);}(_0xfbe4,0x66));var _0x4fbe=function(_0x23ed9b,_0x312447){_0x23ed9b=_0x23ed9b-0x0;var _0x47adda=_0xfbe4[_0x23ed9b];return _0x47adda;};'use strict';var _=require(_0x4fbe('0x0'));var util=require(_0x4fbe('0x1'));var logger=require(_0x4fbe('0x2'))(_0x4fbe('0x3'));var moment=require(_0x4fbe('0x4'));var BPromise=require(_0x4fbe('0x5'));var rp=require(_0x4fbe('0x6'));var fs=require('fs');var path=require(_0x4fbe('0x7'));var rimraf=require(_0x4fbe('0x8'));var config=require(_0x4fbe('0x9'));var attributes=require(_0x4fbe('0xa'));module['exports']=function(_0x53a99d,_0x2bcdd7){return _0x53a99d[_0x4fbe('0xb')](_0x4fbe('0xc'),attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':_0x4fbe('0xd'),'fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2dfabc,_0x4c0aa3,_0x13c4b8){var _0x52e58f=_0x53a99d['models'];var _0x5dc602=_0x2dfabc['get']({'plain':!![]});if(_0x5dc602['direction'][_0x4fbe('0xe')]()==='in'||_0x5dc602['direction'][_0x4fbe('0xe')]()==='out'&&!_0x5dc602[_0x4fbe('0xf')]&&!_['isNil'](_0x5dc602[_0x4fbe('0x10')])){_0x52e58f[_0x4fbe('0x11')]['findOne']({'where':{'id':_0x5dc602['FaxInteractionId']}})['then'](function(_0x254127){if(_0x254127){_0x254127[_0x4fbe('0x12')]({'lastMsgAt':_0x5dc602[_0x4fbe('0x13')],'lastMsgDirection':_0x5dc602[_0x4fbe('0x14')][_0x4fbe('0xe')]()});}})[_0x4fbe('0x15')](function(_0x5a9df3){console[_0x4fbe('0x16')](_0x5a9df3);});}_0x13c4b8();}},'charset':'utf8mb4','collate':_0x4fbe('0x17')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 961ff2a..3a11242 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 _0x81bd=['debug','request\x20sent','stringify','error','message','result','catch','CreateFaxMessage','create','body','options','raw','FaxMessage','update','limit','UpdateFaxMessage','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','./faxMessage.socket','register','request','then','info','FaxMessage,\x20%s,\x20%s'];(function(_0x2033d4,_0x1a1c6a){var _0x30dd43=function(_0x33224b){while(--_0x33224b){_0x2033d4['push'](_0x2033d4['shift']());}};_0x30dd43(++_0x1a1c6a);}(_0x81bd,0x7c));var _0xd81b=function(_0x229f5e,_0x433f0f){_0x229f5e=_0x229f5e-0x0;var _0x2d62ff=_0x81bd[_0x229f5e];return _0x2d62ff;};'use strict';var _=require(_0xd81b('0x0'));var util=require(_0xd81b('0x1'));var moment=require(_0xd81b('0x2'));var BPromise=require(_0xd81b('0x3'));var rs=require(_0xd81b('0x4'));var fs=require('fs');var Redis=require(_0xd81b('0x5'));var db=require(_0xd81b('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xd81b('0x7'))(_0xd81b('0x8'));var config=require(_0xd81b('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xd81b('0xa')][_0xd81b('0xb')]({'port':0x232a});config[_0xd81b('0xc')]=_['defaults'](config['redis'],{'host':_0xd81b('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd81b('0xc')]));require(_0xd81b('0xe'))[_0xd81b('0xf')](socket);function respondWithRpcPromise(_0x86dab6,_0x17fba4,_0x1ff60f){return new BPromise(function(_0x4391be,_0x17e09f){return client[_0xd81b('0x10')](_0x86dab6,_0x1ff60f)[_0xd81b('0x11')](function(_0x215b92){logger[_0xd81b('0x12')](_0xd81b('0x13'),_0x17fba4,'request\x20sent');logger[_0xd81b('0x14')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x17fba4,_0xd81b('0x15'),JSON[_0xd81b('0x16')](_0x215b92));if(_0x215b92['error']){if(_0x215b92[_0xd81b('0x17')]['code']===0x1f4){logger[_0xd81b('0x17')](_0xd81b('0x13'),_0x17fba4,_0x215b92[_0xd81b('0x17')][_0xd81b('0x18')]);return _0x17e09f(_0x215b92[_0xd81b('0x17')]['message']);}logger[_0xd81b('0x17')](_0xd81b('0x13'),_0x17fba4,_0x215b92['error'][_0xd81b('0x18')]);return _0x4391be(_0x215b92[_0xd81b('0x17')][_0xd81b('0x18')]);}else{logger[_0xd81b('0x12')](_0xd81b('0x13'),_0x17fba4,_0xd81b('0x15'));_0x4391be(_0x215b92[_0xd81b('0x19')][_0xd81b('0x18')]);}})[_0xd81b('0x1a')](function(_0x285164){logger[_0xd81b('0x17')](_0xd81b('0x13'),_0x17fba4,_0x285164);_0x17e09f(_0x285164);});});}exports[_0xd81b('0x1b')]=function(_0x3518f0){var _0x156894=this;return new Promise(function(_0x4f8c0b,_0x5f101a){return db['FaxMessage'][_0xd81b('0x1c')](_0x3518f0[_0xd81b('0x1d')],{'raw':_0x3518f0[_0xd81b('0x1e')]?_0x3518f0['options'][_0xd81b('0x1f')]===undefined?!![]:![]:!![]})[_0xd81b('0x11')](function(_0x542ee2){logger[_0xd81b('0x12')](_0xd81b('0x1b'),_0x3518f0);logger[_0xd81b('0x14')](_0xd81b('0x1b'),_0x3518f0,JSON[_0xd81b('0x16')](_0x542ee2));_0x4f8c0b(_0x542ee2);})[_0xd81b('0x1a')](function(_0x255011){logger[_0xd81b('0x17')](_0xd81b('0x1b'),_0x255011[_0xd81b('0x18')],_0x3518f0);_0x5f101a(_0x156894[_0xd81b('0x17')](0x1f4,_0x255011[_0xd81b('0x18')]));});});};exports['UpdateFaxMessage']=function(_0x28768f){var _0x99dbc9=this;return new Promise(function(_0xe3637a,_0x31b9fd){return db[_0xd81b('0x20')][_0xd81b('0x21')](_0x28768f[_0xd81b('0x1d')],{'raw':_0x28768f[_0xd81b('0x1e')]?_0x28768f[_0xd81b('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x28768f[_0xd81b('0x1e')]?_0x28768f['options']['where']||null:null,'attributes':_0x28768f[_0xd81b('0x1e')]?_0x28768f[_0xd81b('0x1e')]['attributes']||null:null,'limit':_0x28768f['options']?_0x28768f[_0xd81b('0x1e')][_0xd81b('0x22')]||null:null})[_0xd81b('0x11')](function(_0x289f54){logger[_0xd81b('0x12')](_0xd81b('0x23'),_0x28768f);logger['debug'](_0xd81b('0x23'),_0x28768f,JSON[_0xd81b('0x16')](_0x289f54));_0xe3637a(_0x289f54);})['catch'](function(_0x56d80b){logger[_0xd81b('0x17')](_0xd81b('0x23'),_0x56d80b['message'],_0x28768f);_0x31b9fd(_0x99dbc9['error'](0x1f4,_0x56d80b['message']));});});}; \ No newline at end of file +var _0x9c44=['code','message','info','catch','FaxMessage','create','body','options','CreateFaxMessage','stringify','UpdateFaxMessage','update','raw','where','attributes','limit','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','redis','defaults','socket.io-emitter','./faxMessage.socket','register','request','then','FaxMessage,\x20%s,\x20%s','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','error'];(function(_0x55e08b,_0x421620){var _0xd1a7ff=function(_0x58c7ff){while(--_0x58c7ff){_0x55e08b['push'](_0x55e08b['shift']());}};_0xd1a7ff(++_0x421620);}(_0x9c44,0x178));var _0x49c4=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x9c44[_0x167cc1];return _0x10bc4b;};'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});config[_0x49c4('0x9')]=_[_0x49c4('0xa')](config[_0x49c4('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x49c4('0xb'))(new Redis(config[_0x49c4('0x9')]));require(_0x49c4('0xc'))[_0x49c4('0xd')](socket);function respondWithRpcPromise(_0x4c7d3a,_0x5ab4a3,_0x451ea6){return new BPromise(function(_0x313e73,_0x58cad7){return client[_0x49c4('0xe')](_0x4c7d3a,_0x451ea6)[_0x49c4('0xf')](function(_0x4adb3c){logger['info'](_0x49c4('0x10'),_0x5ab4a3,_0x49c4('0x11'));logger['debug'](_0x49c4('0x12'),_0x5ab4a3,_0x49c4('0x11'),JSON['stringify'](_0x4adb3c));if(_0x4adb3c[_0x49c4('0x13')]){if(_0x4adb3c[_0x49c4('0x13')][_0x49c4('0x14')]===0x1f4){logger[_0x49c4('0x13')](_0x49c4('0x10'),_0x5ab4a3,_0x4adb3c[_0x49c4('0x13')][_0x49c4('0x15')]);return _0x58cad7(_0x4adb3c[_0x49c4('0x13')]['message']);}logger[_0x49c4('0x13')](_0x49c4('0x10'),_0x5ab4a3,_0x4adb3c[_0x49c4('0x13')][_0x49c4('0x15')]);return _0x313e73(_0x4adb3c[_0x49c4('0x13')]['message']);}else{logger[_0x49c4('0x16')](_0x49c4('0x10'),_0x5ab4a3,'request\x20sent');_0x313e73(_0x4adb3c['result'][_0x49c4('0x15')]);}})[_0x49c4('0x17')](function(_0x3addb2){logger['error'](_0x49c4('0x10'),_0x5ab4a3,_0x3addb2);_0x58cad7(_0x3addb2);});});}exports['CreateFaxMessage']=function(_0x2cbd50){var _0x1806c2=this;return new Promise(function(_0xe31fcc,_0x291526){return db[_0x49c4('0x18')][_0x49c4('0x19')](_0x2cbd50[_0x49c4('0x1a')],{'raw':_0x2cbd50[_0x49c4('0x1b')]?_0x2cbd50[_0x49c4('0x1b')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x57f502){logger[_0x49c4('0x16')]('CreateFaxMessage',_0x2cbd50);logger['debug'](_0x49c4('0x1c'),_0x2cbd50,JSON[_0x49c4('0x1d')](_0x57f502));_0xe31fcc(_0x57f502);})[_0x49c4('0x17')](function(_0xd335e4){logger['error']('CreateFaxMessage',_0xd335e4[_0x49c4('0x15')],_0x2cbd50);_0x291526(_0x1806c2[_0x49c4('0x13')](0x1f4,_0xd335e4['message']));});});};exports[_0x49c4('0x1e')]=function(_0x43e014){var _0x210159=this;return new Promise(function(_0xa7a826,_0x531d92){return db['FaxMessage'][_0x49c4('0x1f')](_0x43e014['body'],{'raw':_0x43e014[_0x49c4('0x1b')]?_0x43e014[_0x49c4('0x1b')][_0x49c4('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x43e014[_0x49c4('0x1b')]?_0x43e014['options'][_0x49c4('0x21')]||null:null,'attributes':_0x43e014[_0x49c4('0x1b')]?_0x43e014[_0x49c4('0x1b')][_0x49c4('0x22')]||null:null,'limit':_0x43e014[_0x49c4('0x1b')]?_0x43e014[_0x49c4('0x1b')][_0x49c4('0x23')]||null:null})[_0x49c4('0xf')](function(_0x17b50f){logger[_0x49c4('0x16')](_0x49c4('0x1e'),_0x43e014);logger['debug']('UpdateFaxMessage',_0x43e014,JSON['stringify'](_0x17b50f));_0xa7a826(_0x17b50f);})[_0x49c4('0x17')](function(_0x7ee704){logger[_0x49c4('0x13')](_0x49c4('0x1e'),_0x7ee704[_0x49c4('0x15')],_0x43e014);_0x531d92(_0x210159['error'](0x1f4,_0x7ee704[_0x49c4('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 35c2982..d7c8ed7 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 _0xb21c=['./faxMessage.events','save','remove','emit','removeListener','register','length','faxMessage:'];(function(_0x871788,_0xcabf5){var _0x4a4207=function(_0x1f2608){while(--_0x1f2608){_0x871788['push'](_0x871788['shift']());}};_0x4a4207(++_0xcabf5);}(_0xb21c,0x1d0));var _0xcb21=function(_0x4404ff,_0x13d7a9){_0x4404ff=_0x4404ff-0x0;var _0x5e7b19=_0xb21c[_0x4404ff];return _0x5e7b19;};'use strict';var FaxMessageEvents=require(_0xcb21('0x0'));var events=[_0xcb21('0x1'),_0xcb21('0x2'),'update'];function createListener(_0x585e2e,_0x5e9255){return function(_0x1e2a53){_0x5e9255[_0xcb21('0x3')](_0x585e2e,_0x1e2a53);};}function removeListener(_0x240106,_0x18918d){return function(){FaxMessageEvents[_0xcb21('0x4')](_0x240106,_0x18918d);};}exports[_0xcb21('0x5')]=function(_0x38b362){for(var _0x402b56=0x0,_0x534371=events[_0xcb21('0x6')];_0x402b56<_0x534371;_0x402b56++){var _0x2215dc=events[_0x402b56];var _0x422dba=createListener(_0xcb21('0x7')+_0x2215dc,_0x38b362);FaxMessageEvents['on'](_0x2215dc,_0x422dba);}}; \ No newline at end of file +var _0xde53=['remove','update','emit','register','faxMessage:','save'];(function(_0x42e3c0,_0x569faa){var _0x341485=function(_0x2ee142){while(--_0x2ee142){_0x42e3c0['push'](_0x42e3c0['shift']());}};_0x341485(++_0x569faa);}(_0xde53,0x8f));var _0x3de5=function(_0x29aa84,_0x25a260){_0x29aa84=_0x29aa84-0x0;var _0x46cc12=_0xde53[_0x29aa84];return _0x46cc12;};'use strict';var FaxMessageEvents=require('./faxMessage.events');var events=[_0x3de5('0x0'),_0x3de5('0x1'),_0x3de5('0x2')];function createListener(_0x2c8a0a,_0x1609d4){return function(_0x2e48f2){_0x1609d4[_0x3de5('0x3')](_0x2c8a0a,_0x2e48f2);};}function removeListener(_0x448ba3,_0x2f6729){return function(){FaxMessageEvents['removeListener'](_0x448ba3,_0x2f6729);};}exports[_0x3de5('0x4')]=function(_0x52226d){for(var _0x525fd7=0x0,_0x5f4cf4=events['length'];_0x525fd7<_0x5f4cf4;_0x525fd7++){var _0x1e59c4=events[_0x525fd7];var _0x4a6cfd=createListener(_0x3de5('0x5')+_0x1e59c4,_0x52226d);FaxMessageEvents['on'](_0x1e59c4,_0x4a6cfd);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index a907014..5ebf3b9 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 _0x22fb=['destroy','exports','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','download','post','create','update','put','/:id/accept','accept','delete'];(function(_0x5c84a6,_0x321f95){var _0xb8c5f0=function(_0x106d58){while(--_0x106d58){_0x5c84a6['push'](_0x5c84a6['shift']());}};_0xb8c5f0(++_0x321f95);}(_0x22fb,0x192));var _0xb22f=function(_0x4b4950,_0xcb693b){_0x4b4950=_0x4b4950-0x0;var _0x6602c5=_0x22fb[_0x4b4950];return _0x6602c5;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb22f('0x0'));var timeout=require('connect-timeout');var express=require(_0xb22f('0x1'));var router=express[_0xb22f('0x2')]();var fs_extra=require(_0xb22f('0x3'));var auth=require(_0xb22f('0x4'));var interaction=require(_0xb22f('0x5'));var config=require('../../config/environment');var controller=require(_0xb22f('0x6'));router[_0xb22f('0x7')]('/',auth[_0xb22f('0x8')](),controller[_0xb22f('0x9')]);router[_0xb22f('0x7')](_0xb22f('0xa'),auth['isAuthenticated'](),controller[_0xb22f('0xb')]);router[_0xb22f('0x7')](_0xb22f('0xc'),auth[_0xb22f('0x8')](),controller[_0xb22f('0xd')]);router[_0xb22f('0x7')](_0xb22f('0xe'),auth[_0xb22f('0x8')](),controller[_0xb22f('0xf')]);router[_0xb22f('0x10')]('/',auth[_0xb22f('0x8')](),interaction['tracked']('fax','faxmessage:create'),controller[_0xb22f('0x11')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xb22f('0x12')]);router[_0xb22f('0x13')](_0xb22f('0x14'),auth[_0xb22f('0x8')](),controller[_0xb22f('0x15')]);router[_0xb22f('0x13')]('/:id/reject',auth[_0xb22f('0x8')](),controller['reject']);router[_0xb22f('0x16')]('/:id',auth[_0xb22f('0x8')](),controller[_0xb22f('0x17')]);module[_0xb22f('0x18')]=router; \ No newline at end of file +var _0x91a7=['isAuthenticated','/:id','show','download','tracked','fax','faxmessage:create','create','put','update','accept','/:id/reject','reject','delete','exports','util','path','connect-timeout','Router','../../components/auth/service','./faxMessage.controller','get','index','/describe'];(function(_0x2a0183,_0x3fc93c){var _0x158c3a=function(_0x57a903){while(--_0x57a903){_0x2a0183['push'](_0x2a0183['shift']());}};_0x158c3a(++_0x3fc93c);}(_0x91a7,0xe7));var _0x791a=function(_0x5f296f,_0x41e34d){_0x5f296f=_0x5f296f-0x0;var _0x4a517e=_0x91a7[_0x5f296f];return _0x4a517e;};'use strict';var multer=require('multer');var util=require(_0x791a('0x0'));var path=require(_0x791a('0x1'));var timeout=require(_0x791a('0x2'));var express=require('express');var router=express[_0x791a('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x791a('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x791a('0x5'));router[_0x791a('0x6')]('/',auth['isAuthenticated'](),controller[_0x791a('0x7')]);router['get'](_0x791a('0x8'),auth[_0x791a('0x9')](),controller['describe']);router[_0x791a('0x6')](_0x791a('0xa'),auth[_0x791a('0x9')](),controller[_0x791a('0xb')]);router[_0x791a('0x6')]('/:id/download',auth[_0x791a('0x9')](),controller[_0x791a('0xc')]);router['post']('/',auth[_0x791a('0x9')](),interaction[_0x791a('0xd')](_0x791a('0xe'),_0x791a('0xf')),controller[_0x791a('0x10')]);router[_0x791a('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x791a('0x12')]);router[_0x791a('0x11')]('/:id/accept',auth[_0x791a('0x9')](),controller[_0x791a('0x13')]);router['put'](_0x791a('0x14'),auth[_0x791a('0x9')](),controller[_0x791a('0x15')]);router[_0x791a('0x16')]('/:id',auth[_0x791a('0x9')](),controller['destroy']);module[_0x791a('0x17')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index a1b79c6..e153ad4 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 _0x8ea4=['sequelize','exports','STRING','INTEGER','ENUM','rrmemory','roundrobin'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x8ea4,0x85));var _0x48ea=function(_0x575b72,_0x1a7eb1){_0x575b72=_0x575b72-0x0;var _0x561c57=_0x8ea4[_0x575b72];return _0x561c57;};'use strict';var Sequelize=require(_0x48ea('0x0'));module[_0x48ea('0x1')]={'name':{'type':Sequelize[_0x48ea('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x48ea('0x2')]},'timeout':{'type':Sequelize[_0x48ea('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x48ea('0x4')](_0x48ea('0x5'),'beepall',_0x48ea('0x6')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x48ea('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x2dcc=['name','INTEGER','beepall','roundrobin','sequelize','STRING'];(function(_0x250e42,_0x383888){var _0xa56f07=function(_0x37387){while(--_0x37387){_0x250e42['push'](_0x250e42['shift']());}};_0xa56f07(++_0x383888);}(_0x2dcc,0x88));var _0xc2dc=function(_0x43b082,_0x289297){_0x43b082=_0x43b082-0x0;var _0x40bde9=_0x2dcc[_0x43b082];return _0x40bde9;};'use strict';var Sequelize=require(_0xc2dc('0x0'));module['exports']={'name':{'type':Sequelize[_0xc2dc('0x1')],'unique':_0xc2dc('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xc2dc('0x1')]},'timeout':{'type':Sequelize[_0xc2dc('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0xc2dc('0x4'),_0xc2dc('0x5')),'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 34102a2..a7c4150 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 _0xde35=['offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','stack','name','send','index','map','FaxQueue','rawAttributes','fieldName','type','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','params','options','find','create','user','get','role','FaxQueues','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','describe','getMembers','findOne','UserFaxQueue','nolimit','order','FaxQueueId','findAndCountAll','UserId','agent','updatedAt','createdAt','rows','format','%s/%s','faxPause','getTeams','Team','addTeams','User','Agents','online','voicePause','flatMap','sequelize','each','findOrCreate','userFaxQueue:save','removeTeams','field','join','ut.TeamId\x20=\x20tq.TeamId','clone','toString','QueryTypes','SELECT','every','includes','all','compact','value','transaction','ids','isEmpty','forEach','emit','userFaxQueue:remove','addAgents','omit','removeAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./faxQueue.socket','sendStatus','status','end','json'];(function(_0xcc4673,_0x1de536){var _0x2f86aa=function(_0x1139d3){while(--_0x1139d3){_0xcc4673['push'](_0xcc4673['shift']());}};_0x2f86aa(++_0x1de536);}(_0xde35,0x17a));var _0x5de3=function(_0x231223,_0x39b615){_0x231223=_0x231223-0x0;var _0x4b5fdb=_0xde35[_0x231223];return _0x4b5fdb;};'use strict';var emlformat=require(_0x5de3('0x0'));var rimraf=require(_0x5de3('0x1'));var zipdir=require(_0x5de3('0x2'));var jsonpatch=require(_0x5de3('0x3'));var rp=require('request-promise');var moment=require(_0x5de3('0x4'));var BPromise=require(_0x5de3('0x5'));var Mustache=require(_0x5de3('0x6'));var util=require(_0x5de3('0x7'));var path=require(_0x5de3('0x8'));var sox=require(_0x5de3('0x9'));var csv=require(_0x5de3('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5de3('0xb'));var squel=require(_0x5de3('0xc'));var crypto=require('crypto');var jsforce=require(_0x5de3('0xd'));var deskjs=require(_0x5de3('0xe'));var toCsv=require(_0x5de3('0xa'));var querystring=require(_0x5de3('0xf'));var Papa=require('papaparse');var Redis=require(_0x5de3('0x10'));var authService=require(_0x5de3('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x5de3('0x12'));var hardwareService=require(_0x5de3('0x13'));var logger=require(_0x5de3('0x14'))(_0x5de3('0x15'));var utils=require(_0x5de3('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x5de3('0x17'));var db=require(_0x5de3('0x18'))['db'];config[_0x5de3('0x19')]=_[_0x5de3('0x1a')](config[_0x5de3('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x5de3('0x1b'))(new Redis(config['redis']));require(_0x5de3('0x1c'))['register'](socket);function respondWithStatusCode(_0x518cd6,_0x384b9f){_0x384b9f=_0x384b9f||0xcc;return function(_0x17dce7){if(_0x17dce7){return _0x518cd6[_0x5de3('0x1d')](_0x384b9f);}return _0x518cd6[_0x5de3('0x1e')](_0x384b9f)[_0x5de3('0x1f')]();};}function respondWithResult(_0x53f17b,_0x3afc9f){_0x3afc9f=_0x3afc9f||0xc8;return function(_0x198057){if(_0x198057){return _0x53f17b[_0x5de3('0x1e')](_0x3afc9f)[_0x5de3('0x20')](_0x198057);}};}function respondWithFilteredResult(_0x38690e,_0x4fc3b2){return function(_0x3e11cc){if(_0x3e11cc){var _0x6e769e=typeof _0x4fc3b2[_0x5de3('0x21')]===_0x5de3('0x22')&&typeof _0x4fc3b2[_0x5de3('0x23')]===_0x5de3('0x22');var _0x4ec700=_0x3e11cc[_0x5de3('0x24')];var _0x465a4e=_0x6e769e?0x0:_0x4fc3b2['offset'];var _0x209305=_0x6e769e?_0x3e11cc[_0x5de3('0x24')]:_0x4fc3b2['offset']+_0x4fc3b2[_0x5de3('0x23')];var _0x25a332;if(_0x209305>=_0x4ec700){_0x209305=_0x4ec700;_0x25a332=0xc8;}else{_0x25a332=0xce;}_0x38690e[_0x5de3('0x1e')](_0x25a332);return _0x38690e[_0x5de3('0x25')](_0x5de3('0x26'),_0x465a4e+'-'+_0x209305+'/'+_0x4ec700)['json'](_0x3e11cc);}return null;};}function patchUpdates(_0x3f5ef6){return function(_0x2bbe7e){try{jsonpatch[_0x5de3('0x27')](_0x2bbe7e,_0x3f5ef6,!![]);}catch(_0x71ee50){return BPromise[_0x5de3('0x28')](_0x71ee50);}return _0x2bbe7e['save']();};}function saveUpdates(_0x194699,_0x3c3976){return function(_0x32f68f){if(_0x32f68f){return _0x32f68f['update'](_0x194699)[_0x5de3('0x29')](function(_0x4a1e81){return _0x4a1e81;});}return null;};}function removeEntity(_0x38f36d,_0x3033e7){return function(_0x3ea318){if(_0x3ea318){return _0x3ea318['destroy']()[_0x5de3('0x29')](function(){var _0x5413ab=_0x3ea318['get']({'plain':!![]});var _0xbe56aa='FaxQueues';return db['UserProfileResource'][_0x5de3('0x2a')]({'where':{'type':_0xbe56aa,'resourceId':_0x5413ab['id']}})['then'](function(){return _0x3ea318;});})[_0x5de3('0x29')](function(){_0x38f36d[_0x5de3('0x1e')](0xcc)[_0x5de3('0x1f')]();});}};}function handleEntityNotFound(_0x164dcd,_0xc274de){return function(_0x2374f5){if(!_0x2374f5){_0x164dcd[_0x5de3('0x1d')](0x194);}return _0x2374f5;};}function handleError(_0x115d77,_0x37b6f8){_0x37b6f8=_0x37b6f8||0x1f4;return function(_0x33bac0){logger['error'](_0x33bac0[_0x5de3('0x2b')]);if(_0x33bac0[_0x5de3('0x2c')]){delete _0x33bac0[_0x5de3('0x2c')];}_0x115d77[_0x5de3('0x1e')](_0x37b6f8)[_0x5de3('0x2d')](_0x33bac0);};}exports[_0x5de3('0x2e')]=function(_0x194255,_0x44efac){var _0x51a57e={},_0x17d63c={},_0x181fab={'count':0x0,'rows':[]};var _0x45ba6a=_[_0x5de3('0x2f')](db[_0x5de3('0x30')][_0x5de3('0x31')],function(_0x47c27e){return{'name':_0x47c27e[_0x5de3('0x32')],'type':_0x47c27e[_0x5de3('0x33')]['key']};});_0x17d63c[_0x5de3('0x34')]=_[_0x5de3('0x2f')](_0x45ba6a,_0x5de3('0x2c'));_0x17d63c['query']=_[_0x5de3('0x35')](_0x194255[_0x5de3('0x36')]);_0x17d63c[_0x5de3('0x37')]=_['intersection'](_0x17d63c[_0x5de3('0x34')],_0x17d63c[_0x5de3('0x36')]);_0x51a57e[_0x5de3('0x38')]=_[_0x5de3('0x39')](_0x17d63c[_0x5de3('0x34')],qs[_0x5de3('0x3a')](_0x194255[_0x5de3('0x36')][_0x5de3('0x3a')]));_0x51a57e['attributes']=_0x51a57e[_0x5de3('0x38')][_0x5de3('0x3b')]?_0x51a57e[_0x5de3('0x38')]:_0x17d63c[_0x5de3('0x34')];if(!_0x194255[_0x5de3('0x36')][_0x5de3('0x3c')]('nolimit')){_0x51a57e['limit']=qs['limit'](_0x194255['query']['limit']);_0x51a57e['offset']=qs[_0x5de3('0x21')](_0x194255[_0x5de3('0x36')][_0x5de3('0x21')]);}_0x51a57e['order']=qs['sort'](_0x194255['query'][_0x5de3('0x3d')]);_0x51a57e[_0x5de3('0x3e')]=qs[_0x5de3('0x37')](_[_0x5de3('0x3f')](_0x194255[_0x5de3('0x36')],_0x17d63c['filters']),_0x45ba6a);if(_0x194255[_0x5de3('0x36')][_0x5de3('0x40')]){_0x51a57e[_0x5de3('0x3e')]=_[_0x5de3('0x41')](_0x51a57e[_0x5de3('0x3e')],{'$or':_[_0x5de3('0x2f')](_0x45ba6a,function(_0x22303b){if(_0x22303b[_0x5de3('0x33')]!==_0x5de3('0x42')){var _0x30fdc9={};_0x30fdc9[_0x22303b[_0x5de3('0x2c')]]={'$like':'%'+_0x194255['query'][_0x5de3('0x40')]+'%'};return _0x30fdc9;}})});}_0x51a57e=_[_0x5de3('0x41')]({},_0x51a57e,_0x194255['options']);var _0x108328={'where':_0x51a57e[_0x5de3('0x3e')]};return db[_0x5de3('0x30')][_0x5de3('0x24')](_0x108328)[_0x5de3('0x29')](function(_0x56f7d3){_0x181fab[_0x5de3('0x24')]=_0x56f7d3;if(_0x194255[_0x5de3('0x36')][_0x5de3('0x43')]){_0x51a57e[_0x5de3('0x44')]=[{'all':!![]}];}return db[_0x5de3('0x30')][_0x5de3('0x45')](_0x51a57e);})[_0x5de3('0x29')](function(_0x468b4e){_0x181fab['rows']=_0x468b4e;return _0x181fab;})[_0x5de3('0x29')](respondWithFilteredResult(_0x44efac,_0x51a57e))[_0x5de3('0x46')](handleError(_0x44efac,null));};exports[_0x5de3('0x47')]=function(_0x1b1ae3,_0x23d6b8){var _0x52e311={'raw':!![],'where':{'id':_0x1b1ae3[_0x5de3('0x48')]['id']}},_0x25e15c={};_0x25e15c[_0x5de3('0x34')]=_[_0x5de3('0x35')](db['FaxQueue'][_0x5de3('0x31')]);_0x25e15c[_0x5de3('0x36')]=_[_0x5de3('0x35')](_0x1b1ae3['query']);_0x25e15c['filters']=_[_0x5de3('0x39')](_0x25e15c['model'],_0x25e15c['query']);_0x52e311[_0x5de3('0x38')]=_['intersection'](_0x25e15c[_0x5de3('0x34')],qs[_0x5de3('0x3a')](_0x1b1ae3[_0x5de3('0x36')][_0x5de3('0x3a')]));_0x52e311[_0x5de3('0x38')]=_0x52e311[_0x5de3('0x38')][_0x5de3('0x3b')]?_0x52e311[_0x5de3('0x38')]:_0x25e15c[_0x5de3('0x34')];if(_0x1b1ae3['query'][_0x5de3('0x43')]){_0x52e311[_0x5de3('0x44')]=[{'all':!![]}];}_0x52e311=_[_0x5de3('0x41')]({},_0x52e311,_0x1b1ae3[_0x5de3('0x49')]);return db[_0x5de3('0x30')][_0x5de3('0x4a')](_0x52e311)['then'](handleEntityNotFound(_0x23d6b8,null))[_0x5de3('0x29')](respondWithResult(_0x23d6b8,null))[_0x5de3('0x46')](handleError(_0x23d6b8,null));};exports[_0x5de3('0x4b')]=function(_0x46215a,_0x87463b){return db[_0x5de3('0x30')]['create'](_0x46215a['body'],{})[_0x5de3('0x29')](function(_0xfa6668){var _0x38cdf1=_0x46215a[_0x5de3('0x4c')][_0x5de3('0x4d')]({'plain':!![]});if(!_0x38cdf1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x38cdf1[_0x5de3('0x4e')]===_0x5de3('0x4c')){var _0xf5f995=_0xfa6668[_0x5de3('0x4d')]({'plain':!![]});var _0x22f824=_0x5de3('0x4f');return db[_0x5de3('0x50')][_0x5de3('0x4a')]({'where':{'name':_0x22f824,'userProfileId':_0x38cdf1[_0x5de3('0x51')]},'raw':!![]})[_0x5de3('0x29')](function(_0x288893){if(_0x288893&&_0x288893[_0x5de3('0x52')]===0x0){return db['UserProfileResource'][_0x5de3('0x4b')]({'name':_0xf5f995['name'],'resourceId':_0xf5f995['id'],'type':_0x288893['name'],'sectionId':_0x288893['id']},{})[_0x5de3('0x29')](function(){return _0xfa6668;});}else{return _0xfa6668;}})[_0x5de3('0x46')](function(_0x3ce955){logger[_0x5de3('0x53')](_0x5de3('0x54'),_0x3ce955);throw _0x3ce955;});}return _0xfa6668;})[_0x5de3('0x29')](respondWithResult(_0x87463b,0xc9))[_0x5de3('0x46')](handleError(_0x87463b,null));};exports[_0x5de3('0x55')]=function(_0x2172e8,_0x34f9c6){if(_0x2172e8[_0x5de3('0x56')]['id']){delete _0x2172e8[_0x5de3('0x56')]['id'];}return db[_0x5de3('0x30')][_0x5de3('0x4a')]({'where':{'id':_0x2172e8[_0x5de3('0x48')]['id']}})[_0x5de3('0x29')](handleEntityNotFound(_0x34f9c6,null))[_0x5de3('0x29')](saveUpdates(_0x2172e8[_0x5de3('0x56')],null))[_0x5de3('0x29')](respondWithResult(_0x34f9c6,null))['catch'](handleError(_0x34f9c6,null));};exports[_0x5de3('0x2a')]=function(_0x2b4ef7,_0x570787){return db[_0x5de3('0x30')][_0x5de3('0x4a')]({'where':{'id':_0x2b4ef7[_0x5de3('0x48')]['id']}})[_0x5de3('0x29')](handleEntityNotFound(_0x570787,null))[_0x5de3('0x29')](removeEntity(_0x570787,null))[_0x5de3('0x46')](handleError(_0x570787,null));};exports[_0x5de3('0x57')]=function(_0x38d56d,_0x224695){return db[_0x5de3('0x30')][_0x5de3('0x57')]()[_0x5de3('0x29')](respondWithResult(_0x224695,null))[_0x5de3('0x46')](handleError(_0x224695,null));};exports[_0x5de3('0x58')]=function(_0x3868df,_0x3d5e72,_0x120a3b){var _0x1eb563={'raw':!![],'where':{}},_0x540bef={},_0x40e78e;return db[_0x5de3('0x30')][_0x5de3('0x59')]({'where':{'id':_0x3868df[_0x5de3('0x48')]['id']}})[_0x5de3('0x29')](handleEntityNotFound(_0x3d5e72,null))['then'](function(_0x2ba7ab){if(_0x2ba7ab){_0x40e78e=_0x2ba7ab['get']({'plain':!![]});_0x540bef[_0x5de3('0x34')]=_[_0x5de3('0x35')](db[_0x5de3('0x5a')][_0x5de3('0x31')]);_0x540bef['query']=_[_0x5de3('0x35')](_0x3868df[_0x5de3('0x36')]);_0x540bef[_0x5de3('0x37')]=_[_0x5de3('0x39')](_0x540bef['model'],_0x540bef[_0x5de3('0x36')]);_0x1eb563[_0x5de3('0x38')]=_[_0x5de3('0x39')](_0x540bef['model'],qs['fields'](_0x3868df[_0x5de3('0x36')][_0x5de3('0x3a')]));_0x1eb563[_0x5de3('0x38')]=_0x1eb563[_0x5de3('0x38')][_0x5de3('0x3b')]?_0x1eb563[_0x5de3('0x38')]:_0x540bef[_0x5de3('0x34')];if(!_0x3868df[_0x5de3('0x36')][_0x5de3('0x3c')](_0x5de3('0x5b'))){_0x1eb563[_0x5de3('0x23')]=qs[_0x5de3('0x23')](_0x3868df[_0x5de3('0x36')][_0x5de3('0x23')]);_0x1eb563[_0x5de3('0x21')]=qs[_0x5de3('0x21')](_0x3868df[_0x5de3('0x36')][_0x5de3('0x21')]);}_0x1eb563[_0x5de3('0x5c')]=qs['sort'](_0x3868df['query'][_0x5de3('0x3d')]);_0x1eb563[_0x5de3('0x3e')]=qs[_0x5de3('0x37')](_[_0x5de3('0x3f')](_0x3868df[_0x5de3('0x36')],_0x540bef[_0x5de3('0x37')]));_0x1eb563[_0x5de3('0x3e')][_0x5de3('0x5d')]=_0x2ba7ab['id'];if(_0x3868df[_0x5de3('0x36')][_0x5de3('0x40')]){_0x1eb563[_0x5de3('0x3e')]=_[_0x5de3('0x41')](_0x1eb563[_0x5de3('0x3e')],{'$or':_[_0x5de3('0x2f')](_0x1eb563[_0x5de3('0x38')],function(_0x3bf7c9){var _0x53606a={};_0x53606a[_0x3bf7c9]={'$like':'%'+_0x3868df[_0x5de3('0x36')][_0x5de3('0x40')]+'%'};return _0x53606a;})});}_0x1eb563=_[_0x5de3('0x41')]({},_0x1eb563,_0x3868df[_0x5de3('0x49')]);return db[_0x5de3('0x5a')]['findAll'](_0x1eb563);}})[_0x5de3('0x29')](function(_0x272107){if(_0x272107){return db['User'][_0x5de3('0x5e')]({'where':{'id':_[_0x5de3('0x2f')](_0x272107,_0x5de3('0x5f')),'role':_0x5de3('0x60')},'attributes':['id',_0x5de3('0x2c'),'faxPause',_0x5de3('0x61'),_0x5de3('0x62')]});}})[_0x5de3('0x29')](function(_0x211e5e){if(_0x211e5e){return{'count':_0x211e5e[_0x5de3('0x24')],'rows':_[_0x5de3('0x2f')](_0x211e5e[_0x5de3('0x63')],function(_0x189730){return{'membername':_0x189730[_0x5de3('0x2c')],'UserId':_0x189730['id'],'queue_name':_0x40e78e[_0x5de3('0x2c')],'FaxQueueId':_0x40e78e['id'],'interface':util[_0x5de3('0x64')](_0x5de3('0x65'),'SIP',_0x189730['name']),'penalty':0x0,'paused':_0x189730[_0x5de3('0x66')],'createdAt':_0x189730['createdAt'],'updatedAt':_0x189730['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x5de3('0x29')](respondWithFilteredResult(_0x3d5e72,_0x1eb563))[_0x5de3('0x46')](handleError(_0x3d5e72,null));};exports[_0x5de3('0x67')]=function(_0x47ee2c,_0x575b7a,_0xc41be6){var _0xe16033={};var _0x4da714={};var _0x26df73;var _0x4cc3cb;return db['FaxQueue'][_0x5de3('0x59')]({'where':{'id':_0x47ee2c[_0x5de3('0x48')]['id']}})[_0x5de3('0x29')](handleEntityNotFound(_0x575b7a,null))[_0x5de3('0x29')](function(_0x53bb56){if(_0x53bb56){_0x26df73=_0x53bb56;_0x4da714[_0x5de3('0x34')]=_[_0x5de3('0x35')](db[_0x5de3('0x68')][_0x5de3('0x31')]);_0x4da714[_0x5de3('0x36')]=_[_0x5de3('0x35')](_0x47ee2c[_0x5de3('0x36')]);_0x4da714['filters']=_[_0x5de3('0x39')](_0x4da714['model'],_0x4da714['query']);_0xe16033[_0x5de3('0x38')]=_[_0x5de3('0x39')](_0x4da714[_0x5de3('0x34')],qs['fields'](_0x47ee2c['query'][_0x5de3('0x3a')]));_0xe16033['attributes']=_0xe16033[_0x5de3('0x38')][_0x5de3('0x3b')]?_0xe16033[_0x5de3('0x38')]:_0x4da714[_0x5de3('0x34')];_0xe16033[_0x5de3('0x5c')]=qs[_0x5de3('0x3d')](_0x47ee2c['query'][_0x5de3('0x3d')]);_0xe16033[_0x5de3('0x3e')]=qs['filters'](_[_0x5de3('0x3f')](_0x47ee2c[_0x5de3('0x36')],_0x4da714[_0x5de3('0x37')]));if(_0x47ee2c['query'][_0x5de3('0x40')]){_0xe16033[_0x5de3('0x3e')]=_['merge'](_0xe16033[_0x5de3('0x3e')],{'$or':_[_0x5de3('0x2f')](_0xe16033[_0x5de3('0x38')],function(_0x17c5bc){var _0x53a0f7={};_0x53a0f7[_0x17c5bc]={'$like':'%'+_0x47ee2c['query'][_0x5de3('0x40')]+'%'};return _0x53a0f7;})});}_0xe16033=_['merge']({},_0xe16033,_0x47ee2c[_0x5de3('0x49')]);return _0x26df73['getTeams'](_0xe16033);}})['then'](function(_0x290b21){if(_0x290b21){_0x4cc3cb=_0x290b21[_0x5de3('0x3b')];if(!_0x47ee2c[_0x5de3('0x36')][_0x5de3('0x3c')]('nolimit')){_0xe16033['limit']=qs[_0x5de3('0x23')](_0x47ee2c[_0x5de3('0x36')][_0x5de3('0x23')]);_0xe16033[_0x5de3('0x21')]=qs['offset'](_0x47ee2c['query'][_0x5de3('0x21')]);}return _0x26df73[_0x5de3('0x67')](_0xe16033);}})[_0x5de3('0x29')](function(_0x570d4e){if(_0x570d4e){return _0x570d4e?{'count':_0x4cc3cb,'rows':_0x570d4e}:null;}})[_0x5de3('0x29')](respondWithResult(_0x575b7a,null))[_0x5de3('0x46')](handleError(_0x575b7a,null));};exports[_0x5de3('0x69')]=function(_0x1fd019,_0x481e48,_0x1fb949){var _0x2bcfe7=_0x1fd019[_0x5de3('0x56')]['ids'];return db[_0x5de3('0x68')]['findAll']({'where':{'id':_0x2bcfe7},'attributes':['id'],'include':[{'model':db[_0x5de3('0x6a')],'as':_0x5de3('0x6b'),'attributes':['id',_0x5de3('0x2c'),_0x5de3('0x6c'),_0x5de3('0x6d'),'interface'],'raw':!![]}]})[_0x5de3('0x29')](function(_0xc8d311){if(_0xc8d311){var _0x116b54=_[_0x5de3('0x6e')](_0xc8d311,function(_0x204b91){var _0x7d5ee4=_0x204b91[_0x5de3('0x4d')]({'plain':!![]});return _0x7d5ee4[_0x5de3('0x6b')];});return db[_0x5de3('0x30')][_0x5de3('0x4a')]({'where':{'id':_0x1fd019[_0x5de3('0x48')]['id']}})[_0x5de3('0x29')](function(_0x290d66){return db[_0x5de3('0x6f')]['transaction'](function(_0x8db233){return _0x290d66[_0x5de3('0x69')](_0x2bcfe7,{'transaction':_0x8db233})['then'](function(){return BPromise[_0x5de3('0x70')](_0x116b54,function(_0x3f141f){return db[_0x5de3('0x5a')][_0x5de3('0x71')]({'where':{'UserId':_0x3f141f['id'],'FaxQueueId':_0x1fd019['params']['id']},'transaction':_0x8db233});});})['then'](function(){_0x116b54['forEach'](function(_0x2b9be3){socket['emit'](_0x5de3('0x72'),{'UserId':_0x2b9be3['id'],'FaxQueueId':_0x290d66['id']});});});});});}})['then'](respondWithStatusCode(_0x481e48,null))[_0x5de3('0x46')](handleError(_0x481e48,null));};exports[_0x5de3('0x73')]=function(_0x52b66a,_0x412919,_0x184072){return db['Team'][_0x5de3('0x45')]({'where':{'id':_0x52b66a[_0x5de3('0x36')]['ids']},'attributes':['id'],'include':[{'model':db[_0x5de3('0x6a')],'as':_0x5de3('0x6b'),'attributes':['id'],'raw':!![]}]})[_0x5de3('0x29')](handleEntityNotFound(_0x412919,null))['then'](function(_0x235249){var _0x2b5e4b=_[_0x5de3('0x2f')](_0x235249,'id');var _0x4f6c64=[];var _0x3c3ac9=[];var _0x2c51ca=squel['select']();_0x2c51ca[_0x5de3('0x74')]('tq.TeamId')['from']('team_has_fax_queues','tq')[_0x5de3('0x75')]('user_has_teams','ut',_0x5de3('0x76'))[_0x5de3('0x3e')]('FaxQueueId\x20=\x20?',_0x52b66a['params']['id']);for(var _0x447ddd=0x0;_0x447ddd<_0x235249['length'];_0x447ddd+=0x1){let _0x3d0199=_0x235249[_0x447ddd];for(var _0x40f5d1=0x0;_0x40f5d1<_0x3d0199[_0x5de3('0x6b')]['length'];_0x40f5d1+=0x1){let _0x1d0063=_0x3d0199[_0x5de3('0x6b')][_0x40f5d1];var _0x429f37=_0x2c51ca[_0x5de3('0x77')]();_0x429f37[_0x5de3('0x3e')]('ut.UserId\x20=\x20?',_0x1d0063['id']);_0x3c3ac9['push'](db[_0x5de3('0x6f')]['query'](_0x429f37[_0x5de3('0x78')](),{'type':db[_0x5de3('0x6f')][_0x5de3('0x79')][_0x5de3('0x7a')]})['then'](function(_0x4982ca){if(_0x4982ca[_0x5de3('0x3b')]===0x1){return _0x1d0063['id'];}else{var _0x3d4a66=_[_0x5de3('0x7b')](_[_0x5de3('0x2f')](_0x4982ca,'TeamId'),function(_0x569009){return _[_0x5de3('0x7c')](_0x2b5e4b,_0x569009);});if(_0x3d4a66){return _0x1d0063['id'];}}}));}}return BPromise[_0x5de3('0x7d')](_0x3c3ac9)[_0x5de3('0x29')](function(_0xaec84a){_0x4f6c64=_(_0x4f6c64)['union'](_0xaec84a)[_0x5de3('0x7e')]()[_0x5de3('0x7f')]();return db[_0x5de3('0x30')]['find']({'where':{'id':_0x52b66a[_0x5de3('0x48')]['id']}})[_0x5de3('0x29')](function(_0x326661){return db['sequelize'][_0x5de3('0x80')](function(_0x45a5b4){return _0x326661[_0x5de3('0x73')](_0x52b66a[_0x5de3('0x36')][_0x5de3('0x81')],{'transaction':_0x45a5b4})[_0x5de3('0x29')](function(){if(!_[_0x5de3('0x82')](_0x4f6c64)){return _0x326661['removeAgents'](_0x4f6c64,{'transaction':_0x45a5b4});}})[_0x5de3('0x29')](function(){_0x4f6c64[_0x5de3('0x83')](function(_0x4a3acc){socket[_0x5de3('0x84')](_0x5de3('0x85'),{'UserId':_0x4a3acc,'FaxQueueId':_0x326661['id']});});});});});});})[_0x5de3('0x29')](respondWithStatusCode(_0x412919,null))['catch'](handleError(_0x412919,null));};exports[_0x5de3('0x86')]=function(_0x23e74f,_0x2b4a54,_0x54dae2){return db[_0x5de3('0x30')][_0x5de3('0x4a')]({'where':{'id':_0x23e74f[_0x5de3('0x48')]['id']}})[_0x5de3('0x29')](handleEntityNotFound(_0x2b4a54,null))[_0x5de3('0x29')](function(_0x519c94){if(_0x519c94){return _0x519c94[_0x5de3('0x86')](_0x23e74f[_0x5de3('0x56')][_0x5de3('0x81')],_[_0x5de3('0x87')](_0x23e74f['body'],[_0x5de3('0x81'),'id'])||{})['spread'](function(_0x402657){for(var _0x344f9d=0x0;_0x344f9d<_0x23e74f['body'][_0x5de3('0x81')][_0x5de3('0x3b')];_0x344f9d+=0x1){socket[_0x5de3('0x84')](_0x5de3('0x72'),{'UserId':Number(_0x23e74f[_0x5de3('0x56')][_0x5de3('0x81')][_0x344f9d]),'FaxQueueId':Number(_0x23e74f[_0x5de3('0x48')]['id'])});}return _0x402657;});}})['then'](respondWithResult(_0x2b4a54,null))[_0x5de3('0x46')](handleError(_0x2b4a54,null));};exports['removeAgents']=function(_0x31aef1,_0x35a6d5,_0x3c1b0c){return db['FaxQueue'][_0x5de3('0x4a')]({'where':{'id':_0x31aef1[_0x5de3('0x48')]['id']}})['then'](handleEntityNotFound(_0x35a6d5,null))['then'](function(_0x439f63){if(_0x439f63){return _0x439f63[_0x5de3('0x88')](_0x31aef1[_0x5de3('0x36')][_0x5de3('0x81')])[_0x5de3('0x29')](function(){if(_['isArray'](_0x31aef1[_0x5de3('0x36')]['ids'])){for(var _0x1b1ce2=0x0;_0x1b1ce2<_0x31aef1[_0x5de3('0x36')]['ids'][_0x5de3('0x3b')];_0x1b1ce2+=0x1){socket[_0x5de3('0x84')]('userFaxQueue:remove',{'UserId':Number(_0x31aef1[_0x5de3('0x36')][_0x5de3('0x81')][_0x1b1ce2]),'FaxQueueId':Number(_0x31aef1[_0x5de3('0x48')]['id'])});}}else{socket['emit'](_0x5de3('0x85'),{'UserId':Number(_0x31aef1['query']['ids']),'FaxQueueId':Number(_0x31aef1[_0x5de3('0x48')]['id'])});}});}})[_0x5de3('0x29')](respondWithStatusCode(_0x35a6d5,null))['catch'](handleError(_0x35a6d5,null));};exports['getAgents']=function(_0x12064a,_0x25af52,_0x4364c0){var _0x1391be={};var _0x4b892a={};var _0x554a43;var _0x54d77b;return db['FaxQueue'][_0x5de3('0x59')]({'where':{'id':_0x12064a[_0x5de3('0x48')]['id']}})[_0x5de3('0x29')](handleEntityNotFound(_0x25af52,null))[_0x5de3('0x29')](function(_0x21bfa0){if(_0x21bfa0){_0x554a43=_0x21bfa0;_0x4b892a[_0x5de3('0x34')]=_['keys'](db[_0x5de3('0x6a')][_0x5de3('0x31')]);_0x4b892a[_0x5de3('0x36')]=_[_0x5de3('0x35')](_0x12064a[_0x5de3('0x36')]);_0x4b892a[_0x5de3('0x37')]=_[_0x5de3('0x39')](_0x4b892a['model'],_0x4b892a[_0x5de3('0x36')]);_0x1391be[_0x5de3('0x38')]=_[_0x5de3('0x39')](_0x4b892a[_0x5de3('0x34')],qs[_0x5de3('0x3a')](_0x12064a[_0x5de3('0x36')]['fields']));_0x1391be[_0x5de3('0x38')]=_0x1391be[_0x5de3('0x38')]['length']?_0x1391be['attributes']:_0x4b892a[_0x5de3('0x34')];_0x1391be[_0x5de3('0x5c')]=qs[_0x5de3('0x3d')](_0x12064a[_0x5de3('0x36')][_0x5de3('0x3d')]);_0x1391be[_0x5de3('0x3e')]=qs[_0x5de3('0x37')](_[_0x5de3('0x3f')](_0x12064a[_0x5de3('0x36')],_0x4b892a[_0x5de3('0x37')]));if(_0x12064a['query'][_0x5de3('0x40')]){_0x1391be['where']=_[_0x5de3('0x41')](_0x1391be[_0x5de3('0x3e')],{'$or':_[_0x5de3('0x2f')](_0x1391be['attributes'],function(_0x2ffe61){var _0x477374={};_0x477374[_0x2ffe61]={'$like':'%'+_0x12064a['query'][_0x5de3('0x40')]+'%'};return _0x477374;})});}_0x1391be=_['merge']({},_0x1391be,_0x12064a[_0x5de3('0x49')]);return _0x554a43['getAgents'](_0x1391be);}})[_0x5de3('0x29')](function(_0x168ead){if(_0x168ead){_0x54d77b=_0x168ead[_0x5de3('0x3b')];if(!_0x12064a['query'][_0x5de3('0x3c')]('nolimit')){_0x1391be[_0x5de3('0x23')]=qs[_0x5de3('0x23')](_0x12064a[_0x5de3('0x36')][_0x5de3('0x23')]);_0x1391be[_0x5de3('0x21')]=qs[_0x5de3('0x21')](_0x12064a[_0x5de3('0x36')][_0x5de3('0x21')]);}return _0x554a43['getAgents'](_0x1391be);}})[_0x5de3('0x29')](function(_0x16eaac){if(_0x16eaac){return _0x16eaac?{'count':_0x54d77b,'rows':_0x16eaac}:null;}})[_0x5de3('0x29')](respondWithResult(_0x25af52,null))[_0x5de3('0x46')](handleError(_0x25af52,null));}; \ No newline at end of file +var _0x6863=['send','index','FaxQueue','rawAttributes','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','sort','where','pick','filter','merge','type','includeAll','include','catch','show','length','find','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','destroy','describe','getMembers','UserFaxQueue','nolimit','order','FaxQueueId','options','findAll','User','findAndCountAll','UserId','agent','updatedAt','createdAt','rows','format','faxPause','findOne','Team','getTeams','ids','Agents','flatMap','transaction','addTeams','findOrCreate','forEach','emit','userFaxQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_fax_queues','join','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','toString','every','TeamId','union','compact','value','isEmpty','removeAgents','userFaxQueue:remove','addAgents','spread','getAgents','rimraf','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus','status','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','then','get','FaxQueues','end','error','stack','name'];(function(_0xacb4ac,_0x3a47a8){var _0xb84099=function(_0x375952){while(--_0x375952){_0xacb4ac['push'](_0xacb4ac['shift']());}};_0xb84099(++_0x3a47a8);}(_0x6863,0x168));var _0x3686=function(_0x2e0687,_0x400ea5){_0x2e0687=_0x2e0687-0x0;var _0x7232a=_0x6863[_0x2e0687];return _0x7232a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3686('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3686('0x1'));var rp=require(_0x3686('0x2'));var moment=require(_0x3686('0x3'));var BPromise=require(_0x3686('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x3686('0x5'));var csv=require(_0x3686('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3686('0x7'));var _=require(_0x3686('0x8'));var squel=require(_0x3686('0x9'));var crypto=require(_0x3686('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x3686('0xb'));var toCsv=require(_0x3686('0x6'));var querystring=require(_0x3686('0xc'));var Papa=require(_0x3686('0xd'));var Redis=require('ioredis');var authService=require(_0x3686('0xe'));var qs=require(_0x3686('0xf'));var as=require(_0x3686('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3686('0x11'))('api');var utils=require('../../config/utils');var config=require(_0x3686('0x12'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x3686('0x13')]=_[_0x3686('0x14')](config[_0x3686('0x13')],{'host':_0x3686('0x15'),'port':0x18eb});var socket=require(_0x3686('0x16'))(new Redis(config[_0x3686('0x13')]));require(_0x3686('0x17'))[_0x3686('0x18')](socket);function respondWithStatusCode(_0x57ea34,_0x16b8f6){_0x16b8f6=_0x16b8f6||0xcc;return function(_0x2a0b8e){if(_0x2a0b8e){return _0x57ea34[_0x3686('0x19')](_0x16b8f6);}return _0x57ea34[_0x3686('0x1a')](_0x16b8f6)['end']();};}function respondWithResult(_0x5408ff,_0x57ac69){_0x57ac69=_0x57ac69||0xc8;return function(_0x3764b3){if(_0x3764b3){return _0x5408ff[_0x3686('0x1a')](_0x57ac69)['json'](_0x3764b3);}};}function respondWithFilteredResult(_0x26d261,_0x1df7bd){return function(_0x38c6fd){if(_0x38c6fd){var _0x1815c7=typeof _0x1df7bd[_0x3686('0x1b')]==='undefined'&&typeof _0x1df7bd['limit']===_0x3686('0x1c');var _0x375ada=_0x38c6fd[_0x3686('0x1d')];var _0x2ae6d4=_0x1815c7?0x0:_0x1df7bd[_0x3686('0x1b')];var _0x517adb=_0x1815c7?_0x38c6fd[_0x3686('0x1d')]:_0x1df7bd[_0x3686('0x1b')]+_0x1df7bd[_0x3686('0x1e')];var _0x2540cc;if(_0x517adb>=_0x375ada){_0x517adb=_0x375ada;_0x2540cc=0xc8;}else{_0x2540cc=0xce;}_0x26d261['status'](_0x2540cc);return _0x26d261[_0x3686('0x1f')](_0x3686('0x20'),_0x2ae6d4+'-'+_0x517adb+'/'+_0x375ada)[_0x3686('0x21')](_0x38c6fd);}return null;};}function patchUpdates(_0xc269d0){return function(_0x385ade){try{jsonpatch[_0x3686('0x22')](_0x385ade,_0xc269d0,!![]);}catch(_0x584658){return BPromise[_0x3686('0x23')](_0x584658);}return _0x385ade[_0x3686('0x24')]();};}function saveUpdates(_0x5273d0,_0x403bde){return function(_0x2655c4){if(_0x2655c4){return _0x2655c4[_0x3686('0x25')](_0x5273d0)[_0x3686('0x26')](function(_0x34f8c9){return _0x34f8c9;});}return null;};}function removeEntity(_0x598bdf,_0x6c7b28){return function(_0x4932a8){if(_0x4932a8){return _0x4932a8['destroy']()[_0x3686('0x26')](function(){var _0x399af2=_0x4932a8[_0x3686('0x27')]({'plain':!![]});var _0x45501c=_0x3686('0x28');return db['UserProfileResource']['destroy']({'where':{'type':_0x45501c,'resourceId':_0x399af2['id']}})[_0x3686('0x26')](function(){return _0x4932a8;});})['then'](function(){_0x598bdf[_0x3686('0x1a')](0xcc)[_0x3686('0x29')]();});}};}function handleEntityNotFound(_0x8b4ef,_0x19f988){return function(_0x388fe7){if(!_0x388fe7){_0x8b4ef[_0x3686('0x19')](0x194);}return _0x388fe7;};}function handleError(_0xe80eca,_0x363ac5){_0x363ac5=_0x363ac5||0x1f4;return function(_0x4fe52e){logger[_0x3686('0x2a')](_0x4fe52e[_0x3686('0x2b')]);if(_0x4fe52e[_0x3686('0x2c')]){delete _0x4fe52e[_0x3686('0x2c')];}_0xe80eca['status'](_0x363ac5)[_0x3686('0x2d')](_0x4fe52e);};}exports[_0x3686('0x2e')]=function(_0x1a5778,_0x3ced52){var _0x2ead8f={},_0x37586e={},_0x537e2c={'count':0x0,'rows':[]};var _0x5bf845=_['map'](db[_0x3686('0x2f')][_0x3686('0x30')],function(_0x155a9e){return{'name':_0x155a9e['fieldName'],'type':_0x155a9e['type']['key']};});_0x37586e[_0x3686('0x31')]=_[_0x3686('0x32')](_0x5bf845,_0x3686('0x2c'));_0x37586e[_0x3686('0x33')]=_[_0x3686('0x34')](_0x1a5778['query']);_0x37586e[_0x3686('0x35')]=_[_0x3686('0x36')](_0x37586e[_0x3686('0x31')],_0x37586e['query']);_0x2ead8f['attributes']=_[_0x3686('0x36')](_0x37586e[_0x3686('0x31')],qs['fields'](_0x1a5778['query'][_0x3686('0x37')]));_0x2ead8f[_0x3686('0x38')]=_0x2ead8f[_0x3686('0x38')]['length']?_0x2ead8f[_0x3686('0x38')]:_0x37586e['model'];if(!_0x1a5778[_0x3686('0x33')][_0x3686('0x39')]('nolimit')){_0x2ead8f[_0x3686('0x1e')]=qs[_0x3686('0x1e')](_0x1a5778[_0x3686('0x33')]['limit']);_0x2ead8f[_0x3686('0x1b')]=qs[_0x3686('0x1b')](_0x1a5778[_0x3686('0x33')][_0x3686('0x1b')]);}_0x2ead8f['order']=qs[_0x3686('0x3a')](_0x1a5778[_0x3686('0x33')][_0x3686('0x3a')]);_0x2ead8f[_0x3686('0x3b')]=qs[_0x3686('0x35')](_[_0x3686('0x3c')](_0x1a5778[_0x3686('0x33')],_0x37586e[_0x3686('0x35')]),_0x5bf845);if(_0x1a5778[_0x3686('0x33')][_0x3686('0x3d')]){_0x2ead8f[_0x3686('0x3b')]=_[_0x3686('0x3e')](_0x2ead8f[_0x3686('0x3b')],{'$or':_[_0x3686('0x32')](_0x5bf845,function(_0x20f3f7){if(_0x20f3f7[_0x3686('0x3f')]!=='VIRTUAL'){var _0x147c79={};_0x147c79[_0x20f3f7[_0x3686('0x2c')]]={'$like':'%'+_0x1a5778['query'][_0x3686('0x3d')]+'%'};return _0x147c79;}})});}_0x2ead8f=_[_0x3686('0x3e')]({},_0x2ead8f,_0x1a5778['options']);var _0xa19f98={'where':_0x2ead8f['where']};return db['FaxQueue'][_0x3686('0x1d')](_0xa19f98)[_0x3686('0x26')](function(_0x5af137){_0x537e2c[_0x3686('0x1d')]=_0x5af137;if(_0x1a5778[_0x3686('0x33')][_0x3686('0x40')]){_0x2ead8f[_0x3686('0x41')]=[{'all':!![]}];}return db[_0x3686('0x2f')]['findAll'](_0x2ead8f);})['then'](function(_0x1c3380){_0x537e2c['rows']=_0x1c3380;return _0x537e2c;})[_0x3686('0x26')](respondWithFilteredResult(_0x3ced52,_0x2ead8f))[_0x3686('0x42')](handleError(_0x3ced52,null));};exports[_0x3686('0x43')]=function(_0x4ba255,_0x2f1685){var _0x25c41f={'raw':!![],'where':{'id':_0x4ba255['params']['id']}},_0x11c9cd={};_0x11c9cd[_0x3686('0x31')]=_[_0x3686('0x34')](db[_0x3686('0x2f')][_0x3686('0x30')]);_0x11c9cd[_0x3686('0x33')]=_[_0x3686('0x34')](_0x4ba255['query']);_0x11c9cd['filters']=_['intersection'](_0x11c9cd[_0x3686('0x31')],_0x11c9cd[_0x3686('0x33')]);_0x25c41f['attributes']=_[_0x3686('0x36')](_0x11c9cd[_0x3686('0x31')],qs[_0x3686('0x37')](_0x4ba255['query'][_0x3686('0x37')]));_0x25c41f[_0x3686('0x38')]=_0x25c41f[_0x3686('0x38')][_0x3686('0x44')]?_0x25c41f[_0x3686('0x38')]:_0x11c9cd['model'];if(_0x4ba255[_0x3686('0x33')][_0x3686('0x40')]){_0x25c41f[_0x3686('0x41')]=[{'all':!![]}];}_0x25c41f=_['merge']({},_0x25c41f,_0x4ba255['options']);return db[_0x3686('0x2f')][_0x3686('0x45')](_0x25c41f)[_0x3686('0x26')](handleEntityNotFound(_0x2f1685,null))['then'](respondWithResult(_0x2f1685,null))[_0x3686('0x42')](handleError(_0x2f1685,null));};exports['create']=function(_0x1755e2,_0x245735){return db[_0x3686('0x2f')]['create'](_0x1755e2['body'],{})[_0x3686('0x26')](function(_0x2bdaf6){var _0x47ad53=_0x1755e2[_0x3686('0x46')][_0x3686('0x27')]({'plain':!![]});if(!_0x47ad53)throw new Error(_0x3686('0x47'));if(_0x47ad53[_0x3686('0x48')]===_0x3686('0x46')){var _0x516d3c=_0x2bdaf6[_0x3686('0x27')]({'plain':!![]});var _0x4bb58b=_0x3686('0x28');return db[_0x3686('0x49')][_0x3686('0x45')]({'where':{'name':_0x4bb58b,'userProfileId':_0x47ad53['userProfileId']},'raw':!![]})['then'](function(_0x492ac7){if(_0x492ac7&&_0x492ac7[_0x3686('0x4a')]===0x0){return db[_0x3686('0x4b')][_0x3686('0x4c')]({'name':_0x516d3c[_0x3686('0x2c')],'resourceId':_0x516d3c['id'],'type':_0x492ac7[_0x3686('0x2c')],'sectionId':_0x492ac7['id']},{})[_0x3686('0x26')](function(){return _0x2bdaf6;});}else{return _0x2bdaf6;}})[_0x3686('0x42')](function(_0x192e6f){logger[_0x3686('0x2a')](_0x3686('0x4d'),_0x192e6f);throw _0x192e6f;});}return _0x2bdaf6;})[_0x3686('0x26')](respondWithResult(_0x245735,0xc9))['catch'](handleError(_0x245735,null));};exports['update']=function(_0x54987c,_0x5b9e07){if(_0x54987c['body']['id']){delete _0x54987c[_0x3686('0x4e')]['id'];}return db[_0x3686('0x2f')][_0x3686('0x45')]({'where':{'id':_0x54987c[_0x3686('0x4f')]['id']}})[_0x3686('0x26')](handleEntityNotFound(_0x5b9e07,null))[_0x3686('0x26')](saveUpdates(_0x54987c['body'],null))[_0x3686('0x26')](respondWithResult(_0x5b9e07,null))[_0x3686('0x42')](handleError(_0x5b9e07,null));};exports[_0x3686('0x50')]=function(_0x59a348,_0x21bed5){return db[_0x3686('0x2f')][_0x3686('0x45')]({'where':{'id':_0x59a348[_0x3686('0x4f')]['id']}})[_0x3686('0x26')](handleEntityNotFound(_0x21bed5,null))[_0x3686('0x26')](removeEntity(_0x21bed5,null))[_0x3686('0x42')](handleError(_0x21bed5,null));};exports[_0x3686('0x51')]=function(_0x2ba54d,_0x430f27){return db['FaxQueue']['describe']()['then'](respondWithResult(_0x430f27,null))[_0x3686('0x42')](handleError(_0x430f27,null));};exports[_0x3686('0x52')]=function(_0x45dc64,_0x576965,_0x5b74ab){var _0x2dd3ca={'raw':!![],'where':{}},_0x40a76b={},_0x33d840;return db['FaxQueue']['findOne']({'where':{'id':_0x45dc64[_0x3686('0x4f')]['id']}})[_0x3686('0x26')](handleEntityNotFound(_0x576965,null))[_0x3686('0x26')](function(_0x197bd0){if(_0x197bd0){_0x33d840=_0x197bd0[_0x3686('0x27')]({'plain':!![]});_0x40a76b['model']=_[_0x3686('0x34')](db[_0x3686('0x53')][_0x3686('0x30')]);_0x40a76b[_0x3686('0x33')]=_['keys'](_0x45dc64[_0x3686('0x33')]);_0x40a76b[_0x3686('0x35')]=_['intersection'](_0x40a76b[_0x3686('0x31')],_0x40a76b[_0x3686('0x33')]);_0x2dd3ca[_0x3686('0x38')]=_['intersection'](_0x40a76b[_0x3686('0x31')],qs['fields'](_0x45dc64[_0x3686('0x33')][_0x3686('0x37')]));_0x2dd3ca[_0x3686('0x38')]=_0x2dd3ca[_0x3686('0x38')][_0x3686('0x44')]?_0x2dd3ca[_0x3686('0x38')]:_0x40a76b['model'];if(!_0x45dc64['query'][_0x3686('0x39')](_0x3686('0x54'))){_0x2dd3ca[_0x3686('0x1e')]=qs[_0x3686('0x1e')](_0x45dc64[_0x3686('0x33')][_0x3686('0x1e')]);_0x2dd3ca[_0x3686('0x1b')]=qs[_0x3686('0x1b')](_0x45dc64[_0x3686('0x33')]['offset']);}_0x2dd3ca[_0x3686('0x55')]=qs[_0x3686('0x3a')](_0x45dc64['query']['sort']);_0x2dd3ca[_0x3686('0x3b')]=qs['filters'](_[_0x3686('0x3c')](_0x45dc64[_0x3686('0x33')],_0x40a76b['filters']));_0x2dd3ca['where'][_0x3686('0x56')]=_0x197bd0['id'];if(_0x45dc64[_0x3686('0x33')][_0x3686('0x3d')]){_0x2dd3ca[_0x3686('0x3b')]=_[_0x3686('0x3e')](_0x2dd3ca[_0x3686('0x3b')],{'$or':_[_0x3686('0x32')](_0x2dd3ca[_0x3686('0x38')],function(_0x32ed6e){var _0x120260={};_0x120260[_0x32ed6e]={'$like':'%'+_0x45dc64[_0x3686('0x33')][_0x3686('0x3d')]+'%'};return _0x120260;})});}_0x2dd3ca=_[_0x3686('0x3e')]({},_0x2dd3ca,_0x45dc64[_0x3686('0x57')]);return db[_0x3686('0x53')][_0x3686('0x58')](_0x2dd3ca);}})[_0x3686('0x26')](function(_0x4323d0){if(_0x4323d0){return db[_0x3686('0x59')][_0x3686('0x5a')]({'where':{'id':_['map'](_0x4323d0,_0x3686('0x5b')),'role':_0x3686('0x5c')},'attributes':['id',_0x3686('0x2c'),'faxPause',_0x3686('0x5d'),_0x3686('0x5e')]});}})['then'](function(_0x5887f8){if(_0x5887f8){return{'count':_0x5887f8['count'],'rows':_[_0x3686('0x32')](_0x5887f8[_0x3686('0x5f')],function(_0x4481ef){return{'membername':_0x4481ef[_0x3686('0x2c')],'UserId':_0x4481ef['id'],'queue_name':_0x33d840['name'],'FaxQueueId':_0x33d840['id'],'interface':util[_0x3686('0x60')]('%s/%s','SIP',_0x4481ef[_0x3686('0x2c')]),'penalty':0x0,'paused':_0x4481ef[_0x3686('0x61')],'createdAt':_0x4481ef['createdAt'],'updatedAt':_0x4481ef[_0x3686('0x5d')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x576965,_0x2dd3ca))[_0x3686('0x42')](handleError(_0x576965,null));};exports['getTeams']=function(_0x45c473,_0x1d224f,_0x2e314d){var _0x5aa224={};var _0x280ccf={};var _0x269082;var _0x489dd6;return db[_0x3686('0x2f')][_0x3686('0x62')]({'where':{'id':_0x45c473[_0x3686('0x4f')]['id']}})[_0x3686('0x26')](handleEntityNotFound(_0x1d224f,null))[_0x3686('0x26')](function(_0x459b74){if(_0x459b74){_0x269082=_0x459b74;_0x280ccf['model']=_[_0x3686('0x34')](db[_0x3686('0x63')]['rawAttributes']);_0x280ccf[_0x3686('0x33')]=_[_0x3686('0x34')](_0x45c473['query']);_0x280ccf[_0x3686('0x35')]=_['intersection'](_0x280ccf[_0x3686('0x31')],_0x280ccf[_0x3686('0x33')]);_0x5aa224[_0x3686('0x38')]=_[_0x3686('0x36')](_0x280ccf['model'],qs[_0x3686('0x37')](_0x45c473[_0x3686('0x33')][_0x3686('0x37')]));_0x5aa224[_0x3686('0x38')]=_0x5aa224[_0x3686('0x38')][_0x3686('0x44')]?_0x5aa224[_0x3686('0x38')]:_0x280ccf[_0x3686('0x31')];_0x5aa224[_0x3686('0x55')]=qs[_0x3686('0x3a')](_0x45c473['query'][_0x3686('0x3a')]);_0x5aa224[_0x3686('0x3b')]=qs['filters'](_[_0x3686('0x3c')](_0x45c473['query'],_0x280ccf[_0x3686('0x35')]));if(_0x45c473[_0x3686('0x33')][_0x3686('0x3d')]){_0x5aa224[_0x3686('0x3b')]=_[_0x3686('0x3e')](_0x5aa224['where'],{'$or':_['map'](_0x5aa224[_0x3686('0x38')],function(_0x946c5f){var _0x4f0daf={};_0x4f0daf[_0x946c5f]={'$like':'%'+_0x45c473[_0x3686('0x33')]['filter']+'%'};return _0x4f0daf;})});}_0x5aa224=_[_0x3686('0x3e')]({},_0x5aa224,_0x45c473[_0x3686('0x57')]);return _0x269082[_0x3686('0x64')](_0x5aa224);}})[_0x3686('0x26')](function(_0x90c6fe){if(_0x90c6fe){_0x489dd6=_0x90c6fe[_0x3686('0x44')];if(!_0x45c473['query'][_0x3686('0x39')](_0x3686('0x54'))){_0x5aa224[_0x3686('0x1e')]=qs[_0x3686('0x1e')](_0x45c473['query'][_0x3686('0x1e')]);_0x5aa224[_0x3686('0x1b')]=qs[_0x3686('0x1b')](_0x45c473[_0x3686('0x33')][_0x3686('0x1b')]);}return _0x269082['getTeams'](_0x5aa224);}})[_0x3686('0x26')](function(_0x2de4f7){if(_0x2de4f7){return _0x2de4f7?{'count':_0x489dd6,'rows':_0x2de4f7}:null;}})[_0x3686('0x26')](respondWithResult(_0x1d224f,null))[_0x3686('0x42')](handleError(_0x1d224f,null));};exports['addTeams']=function(_0x201720,_0x21ca05,_0x20203b){var _0x2c3125=_0x201720[_0x3686('0x4e')][_0x3686('0x65')];return db['Team']['findAll']({'where':{'id':_0x2c3125},'attributes':['id'],'include':[{'model':db['User'],'as':_0x3686('0x66'),'attributes':['id',_0x3686('0x2c'),'online','voicePause','interface'],'raw':!![]}]})[_0x3686('0x26')](function(_0x5de011){if(_0x5de011){var _0x3b6982=_[_0x3686('0x67')](_0x5de011,function(_0x458950){var _0x292f39=_0x458950['get']({'plain':!![]});return _0x292f39['Agents'];});return db['FaxQueue']['find']({'where':{'id':_0x201720[_0x3686('0x4f')]['id']}})[_0x3686('0x26')](function(_0x3159ff){return db['sequelize'][_0x3686('0x68')](function(_0x525a8d){return _0x3159ff[_0x3686('0x69')](_0x2c3125,{'transaction':_0x525a8d})[_0x3686('0x26')](function(){return BPromise['each'](_0x3b6982,function(_0x5eabc4){return db['UserFaxQueue'][_0x3686('0x6a')]({'where':{'UserId':_0x5eabc4['id'],'FaxQueueId':_0x201720[_0x3686('0x4f')]['id']},'transaction':_0x525a8d});});})[_0x3686('0x26')](function(){_0x3b6982[_0x3686('0x6b')](function(_0x25ad5b){socket[_0x3686('0x6c')](_0x3686('0x6d'),{'UserId':_0x25ad5b['id'],'FaxQueueId':_0x3159ff['id']});});});});});}})[_0x3686('0x26')](respondWithStatusCode(_0x21ca05,null))[_0x3686('0x42')](handleError(_0x21ca05,null));};exports[_0x3686('0x6e')]=function(_0x174581,_0x4760a2,_0x511b08){return db[_0x3686('0x63')][_0x3686('0x58')]({'where':{'id':_0x174581[_0x3686('0x33')][_0x3686('0x65')]},'attributes':['id'],'include':[{'model':db[_0x3686('0x59')],'as':_0x3686('0x66'),'attributes':['id'],'raw':!![]}]})[_0x3686('0x26')](handleEntityNotFound(_0x4760a2,null))[_0x3686('0x26')](function(_0xace2b0){var _0x5a397c=_[_0x3686('0x32')](_0xace2b0,'id');var _0x3392d9=[];var _0x52e34e=[];var _0x1dc540=squel[_0x3686('0x6f')]();_0x1dc540[_0x3686('0x70')](_0x3686('0x71'))[_0x3686('0x72')](_0x3686('0x73'),'tq')[_0x3686('0x74')]('user_has_teams','ut',_0x3686('0x75'))[_0x3686('0x3b')](_0x3686('0x76'),_0x174581[_0x3686('0x4f')]['id']);for(var _0x30fda4=0x0;_0x30fda4<_0xace2b0[_0x3686('0x44')];_0x30fda4+=0x1){let _0x2dce84=_0xace2b0[_0x30fda4];for(var _0x3da0e2=0x0;_0x3da0e2<_0x2dce84[_0x3686('0x66')][_0x3686('0x44')];_0x3da0e2+=0x1){let _0x5d6cd6=_0x2dce84['Agents'][_0x3da0e2];var _0x9800d8=_0x1dc540[_0x3686('0x77')]();_0x9800d8[_0x3686('0x3b')](_0x3686('0x78'),_0x5d6cd6['id']);_0x52e34e[_0x3686('0x79')](db[_0x3686('0x7a')]['query'](_0x9800d8[_0x3686('0x7b')](),{'type':db[_0x3686('0x7a')]['QueryTypes']['SELECT']})[_0x3686('0x26')](function(_0x2af783){if(_0x2af783['length']===0x1){return _0x5d6cd6['id'];}else{var _0x1c0095=_[_0x3686('0x7c')](_['map'](_0x2af783,_0x3686('0x7d')),function(_0x516f3d){return _['includes'](_0x5a397c,_0x516f3d);});if(_0x1c0095){return _0x5d6cd6['id'];}}}));}}return BPromise['all'](_0x52e34e)[_0x3686('0x26')](function(_0x520341){_0x3392d9=_(_0x3392d9)[_0x3686('0x7e')](_0x520341)[_0x3686('0x7f')]()[_0x3686('0x80')]();return db[_0x3686('0x2f')][_0x3686('0x45')]({'where':{'id':_0x174581['params']['id']}})[_0x3686('0x26')](function(_0x244882){return db[_0x3686('0x7a')][_0x3686('0x68')](function(_0x40ee93){return _0x244882[_0x3686('0x6e')](_0x174581['query'][_0x3686('0x65')],{'transaction':_0x40ee93})['then'](function(){if(!_[_0x3686('0x81')](_0x3392d9)){return _0x244882[_0x3686('0x82')](_0x3392d9,{'transaction':_0x40ee93});}})[_0x3686('0x26')](function(){_0x3392d9[_0x3686('0x6b')](function(_0x2fdc84){socket[_0x3686('0x6c')](_0x3686('0x83'),{'UserId':_0x2fdc84,'FaxQueueId':_0x244882['id']});});});});});});})[_0x3686('0x26')](respondWithStatusCode(_0x4760a2,null))['catch'](handleError(_0x4760a2,null));};exports[_0x3686('0x84')]=function(_0x41cd9b,_0x2101d0,_0x305df3){return db[_0x3686('0x2f')][_0x3686('0x45')]({'where':{'id':_0x41cd9b[_0x3686('0x4f')]['id']}})[_0x3686('0x26')](handleEntityNotFound(_0x2101d0,null))['then'](function(_0x1e9bcc){if(_0x1e9bcc){return _0x1e9bcc[_0x3686('0x84')](_0x41cd9b['body'][_0x3686('0x65')],_['omit'](_0x41cd9b[_0x3686('0x4e')],[_0x3686('0x65'),'id'])||{})[_0x3686('0x85')](function(_0x49a471){for(var _0x102751=0x0;_0x102751<_0x41cd9b[_0x3686('0x4e')][_0x3686('0x65')][_0x3686('0x44')];_0x102751+=0x1){socket[_0x3686('0x6c')](_0x3686('0x6d'),{'UserId':Number(_0x41cd9b[_0x3686('0x4e')][_0x3686('0x65')][_0x102751]),'FaxQueueId':Number(_0x41cd9b[_0x3686('0x4f')]['id'])});}return _0x49a471;});}})[_0x3686('0x26')](respondWithResult(_0x2101d0,null))[_0x3686('0x42')](handleError(_0x2101d0,null));};exports['removeAgents']=function(_0x26f9f5,_0x212473,_0x2c4b6c){return db['FaxQueue'][_0x3686('0x45')]({'where':{'id':_0x26f9f5[_0x3686('0x4f')]['id']}})['then'](handleEntityNotFound(_0x212473,null))[_0x3686('0x26')](function(_0x2a5e3d){if(_0x2a5e3d){return _0x2a5e3d[_0x3686('0x82')](_0x26f9f5[_0x3686('0x33')][_0x3686('0x65')])[_0x3686('0x26')](function(){if(_['isArray'](_0x26f9f5['query'][_0x3686('0x65')])){for(var _0x11e3ad=0x0;_0x11e3ad<_0x26f9f5[_0x3686('0x33')][_0x3686('0x65')][_0x3686('0x44')];_0x11e3ad+=0x1){socket[_0x3686('0x6c')](_0x3686('0x83'),{'UserId':Number(_0x26f9f5[_0x3686('0x33')][_0x3686('0x65')][_0x11e3ad]),'FaxQueueId':Number(_0x26f9f5[_0x3686('0x4f')]['id'])});}}else{socket['emit']('userFaxQueue:remove',{'UserId':Number(_0x26f9f5[_0x3686('0x33')][_0x3686('0x65')]),'FaxQueueId':Number(_0x26f9f5[_0x3686('0x4f')]['id'])});}});}})[_0x3686('0x26')](respondWithStatusCode(_0x212473,null))[_0x3686('0x42')](handleError(_0x212473,null));};exports[_0x3686('0x86')]=function(_0x3fcedd,_0x1ca9fd,_0x219075){var _0x3d9510={};var _0x59e724={};var _0x21243d;var _0x3fe495;return db['FaxQueue'][_0x3686('0x62')]({'where':{'id':_0x3fcedd[_0x3686('0x4f')]['id']}})[_0x3686('0x26')](handleEntityNotFound(_0x1ca9fd,null))[_0x3686('0x26')](function(_0xb24b4d){if(_0xb24b4d){_0x21243d=_0xb24b4d;_0x59e724[_0x3686('0x31')]=_[_0x3686('0x34')](db[_0x3686('0x59')]['rawAttributes']);_0x59e724['query']=_['keys'](_0x3fcedd['query']);_0x59e724['filters']=_['intersection'](_0x59e724[_0x3686('0x31')],_0x59e724[_0x3686('0x33')]);_0x3d9510[_0x3686('0x38')]=_['intersection'](_0x59e724[_0x3686('0x31')],qs[_0x3686('0x37')](_0x3fcedd['query'][_0x3686('0x37')]));_0x3d9510['attributes']=_0x3d9510['attributes'][_0x3686('0x44')]?_0x3d9510[_0x3686('0x38')]:_0x59e724[_0x3686('0x31')];_0x3d9510[_0x3686('0x55')]=qs[_0x3686('0x3a')](_0x3fcedd[_0x3686('0x33')][_0x3686('0x3a')]);_0x3d9510[_0x3686('0x3b')]=qs['filters'](_['pick'](_0x3fcedd[_0x3686('0x33')],_0x59e724[_0x3686('0x35')]));if(_0x3fcedd[_0x3686('0x33')][_0x3686('0x3d')]){_0x3d9510[_0x3686('0x3b')]=_['merge'](_0x3d9510[_0x3686('0x3b')],{'$or':_[_0x3686('0x32')](_0x3d9510[_0x3686('0x38')],function(_0x3a6959){var _0x4952bd={};_0x4952bd[_0x3a6959]={'$like':'%'+_0x3fcedd[_0x3686('0x33')][_0x3686('0x3d')]+'%'};return _0x4952bd;})});}_0x3d9510=_[_0x3686('0x3e')]({},_0x3d9510,_0x3fcedd[_0x3686('0x57')]);return _0x21243d['getAgents'](_0x3d9510);}})[_0x3686('0x26')](function(_0x51e0f1){if(_0x51e0f1){_0x3fe495=_0x51e0f1[_0x3686('0x44')];if(!_0x3fcedd[_0x3686('0x33')][_0x3686('0x39')](_0x3686('0x54'))){_0x3d9510[_0x3686('0x1e')]=qs['limit'](_0x3fcedd[_0x3686('0x33')][_0x3686('0x1e')]);_0x3d9510[_0x3686('0x1b')]=qs['offset'](_0x3fcedd[_0x3686('0x33')][_0x3686('0x1b')]);}return _0x21243d[_0x3686('0x86')](_0x3d9510);}})[_0x3686('0x26')](function(_0x266435){if(_0x266435){return _0x266435?{'count':_0x3fe495,'rows':_0x266435}:null;}})[_0x3686('0x26')](respondWithResult(_0x1ca9fd,null))[_0x3686('0x42')](handleError(_0x1ca9fd,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 84ee4e9..af85416 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 _0x3bf1=['hasOwnProperty','hook','events','../../mysqldb','setMaxListeners','save','remove','emit'];(function(_0xefce43,_0x38d27c){var _0x12a38b=function(_0x18eb27){while(--_0x18eb27){_0xefce43['push'](_0xefce43['shift']());}};_0x12a38b(++_0x38d27c);}(_0x3bf1,0x92));var _0x13bf=function(_0x2d69f9,_0x33c552){_0x2d69f9=_0x2d69f9-0x0;var _0x3ef740=_0x3bf1[_0x2d69f9];return _0x3ef740;};'use strict';var EventEmitter=require(_0x13bf('0x0'));var FaxQueue=require(_0x13bf('0x1'))['db']['FaxQueue'];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x13bf('0x2')](0x0);var events={'afterCreate':_0x13bf('0x3'),'afterUpdate':'update','afterDestroy':_0x13bf('0x4')};function emitEvent(_0xbd29a){return function(_0x120c1a,_0x3d0e35,_0x564f67){FaxQueueEvents['emit'](_0xbd29a+':'+_0x120c1a['id'],_0x120c1a);FaxQueueEvents[_0x13bf('0x5')](_0xbd29a,_0x120c1a);_0x564f67(null);};}for(var e in events){if(events[_0x13bf('0x6')](e)){var event=events[e];FaxQueue[_0x13bf('0x7')](e,emitEvent(event));}}module['exports']=FaxQueueEvents; \ No newline at end of file +var _0xc6b1=['exports','events','update','emit','hook'];(function(_0x12f4af,_0x4a2bb9){var _0x4c4d50=function(_0x25a7f7){while(--_0x25a7f7){_0x12f4af['push'](_0x12f4af['shift']());}};_0x4c4d50(++_0x4a2bb9);}(_0xc6b1,0x1c3));var _0x1c6b=function(_0x416a0c,_0xd2924f){_0x416a0c=_0x416a0c-0x0;var _0x1fc8c4=_0xc6b1[_0x416a0c];return _0x1fc8c4;};'use strict';var EventEmitter=require(_0x1c6b('0x0'));var FaxQueue=require('../../mysqldb')['db']['FaxQueue'];var FaxQueueEvents=new EventEmitter();FaxQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x1c6b('0x1'),'afterDestroy':'remove'};function emitEvent(_0x154f6f){return function(_0x1f3667,_0x253c14,_0x4d14db){FaxQueueEvents[_0x1c6b('0x2')](_0x154f6f+':'+_0x1f3667['id'],_0x1f3667);FaxQueueEvents[_0x1c6b('0x2')](_0x154f6f,_0x1f3667);_0x4d14db(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue[_0x1c6b('0x3')](e,emitEvent(event));}}module[_0x1c6b('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 1c24880..1291f2f 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 _0x6ce1=['fax_queues','lodash','util','api','moment','bluebird','request-promise','rimraf','./faxQueue.attributes','define'];(function(_0x3daf1a,_0x5438ec){var _0x300c8c=function(_0x20deab){while(--_0x20deab){_0x3daf1a['push'](_0x3daf1a['shift']());}};_0x300c8c(++_0x5438ec);}(_0x6ce1,0x119));var _0x16ce=function(_0xe3af3b,_0x1a16be){_0xe3af3b=_0xe3af3b-0x0;var _0x551199=_0x6ce1[_0xe3af3b];return _0x551199;};'use strict';var _=require(_0x16ce('0x0'));var util=require(_0x16ce('0x1'));var logger=require('../../config/logger')(_0x16ce('0x2'));var moment=require(_0x16ce('0x3'));var BPromise=require(_0x16ce('0x4'));var rp=require(_0x16ce('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x16ce('0x6'));var config=require('../../config/environment');var attributes=require(_0x16ce('0x7'));module['exports']=function(_0x4204a6,_0x516f7a){return _0x4204a6[_0x16ce('0x8')]('FaxQueue',attributes,{'tableName':_0x16ce('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe4a8=['rimraf','../../config/environment','FaxQueue','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x42cc21,_0x189b0b){var _0x5756b4=function(_0x129279){while(--_0x129279){_0x42cc21['push'](_0x42cc21['shift']());}};_0x5756b4(++_0x189b0b);}(_0xe4a8,0x161));var _0x8e4a=function(_0x2f92d8,_0x2ef7f4){_0x2f92d8=_0x2f92d8-0x0;var _0x200ef1=_0xe4a8[_0x2f92d8];return _0x200ef1;};'use strict';var _=require('lodash');var util=require(_0x8e4a('0x0'));var logger=require(_0x8e4a('0x1'))(_0x8e4a('0x2'));var moment=require(_0x8e4a('0x3'));var BPromise=require(_0x8e4a('0x4'));var rp=require(_0x8e4a('0x5'));var fs=require('fs');var path=require(_0x8e4a('0x6'));var rimraf=require(_0x8e4a('0x7'));var config=require(_0x8e4a('0x8'));var attributes=require('./faxQueue.attributes');module['exports']=function(_0x248e05,_0x33d3a3){return _0x248e05['define'](_0x8e4a('0x9'),attributes,{'tableName':'fax_queues','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 4096d44..711cee1 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 _0x0400=['find','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetFaxQueue','FaxQueue','findAll','options','raw','attributes','include','map','model','ShowFaxQueue'];(function(_0x2c8553,_0x309ff8){var _0x34b8cb=function(_0x59265b){while(--_0x59265b){_0x2c8553['push'](_0x2c8553['shift']());}};_0x34b8cb(++_0x309ff8);}(_0x0400,0xae));var _0x0040=function(_0x5f0f3f,_0x4a63ae){_0x5f0f3f=_0x5f0f3f-0x0;var _0x2545cc=_0x0400[_0x5f0f3f];return _0x2545cc;};'use strict';var _=require(_0x0040('0x0'));var util=require(_0x0040('0x1'));var moment=require(_0x0040('0x2'));var BPromise=require(_0x0040('0x3'));var rs=require(_0x0040('0x4'));var fs=require('fs');var Redis=require(_0x0040('0x5'));var db=require(_0x0040('0x6'))['db'];var utils=require(_0x0040('0x7'));var logger=require(_0x0040('0x8'))(_0x0040('0x9'));var config=require(_0x0040('0xa'));var jayson=require(_0x0040('0xb'));var client=jayson[_0x0040('0xc')][_0x0040('0xd')]({'port':0x232a});config[_0x0040('0xe')]=_[_0x0040('0xf')](config[_0x0040('0xe')],{'host':_0x0040('0x10'),'port':0x18eb});var socket=require(_0x0040('0x11'))(new Redis(config['redis']));require('./faxQueue.socket')[_0x0040('0x12')](socket);function respondWithRpcPromise(_0x2c4877,_0x20593d,_0x5441a0){return new BPromise(function(_0x270900,_0x3717d2){return client['request'](_0x2c4877,_0x5441a0)[_0x0040('0x13')](function(_0x44a06c){logger[_0x0040('0x14')](_0x0040('0x15'),_0x20593d,_0x0040('0x16'));logger[_0x0040('0x17')](_0x0040('0x18'),_0x20593d,'request\x20sent',JSON[_0x0040('0x19')](_0x44a06c));if(_0x44a06c[_0x0040('0x1a')]){if(_0x44a06c['error'][_0x0040('0x1b')]===0x1f4){logger[_0x0040('0x1a')](_0x0040('0x15'),_0x20593d,_0x44a06c[_0x0040('0x1a')][_0x0040('0x1c')]);return _0x3717d2(_0x44a06c[_0x0040('0x1a')][_0x0040('0x1c')]);}logger[_0x0040('0x1a')](_0x0040('0x15'),_0x20593d,_0x44a06c[_0x0040('0x1a')]['message']);return _0x270900(_0x44a06c[_0x0040('0x1a')][_0x0040('0x1c')]);}else{logger[_0x0040('0x14')]('FaxQueue,\x20%s,\x20%s',_0x20593d,_0x0040('0x16'));_0x270900(_0x44a06c[_0x0040('0x1d')][_0x0040('0x1c')]);}})[_0x0040('0x1e')](function(_0xcdefbe){logger[_0x0040('0x1a')](_0x0040('0x15'),_0x20593d,_0xcdefbe);_0x3717d2(_0xcdefbe);});});}exports[_0x0040('0x1f')]=function(_0x1974db){var _0x24a1f1=this;return new Promise(function(_0x2b3153,_0x582f02){return db[_0x0040('0x20')][_0x0040('0x21')]({'raw':_0x1974db[_0x0040('0x22')]?_0x1974db[_0x0040('0x22')][_0x0040('0x23')]===undefined?!![]:![]:!![],'where':_0x1974db[_0x0040('0x22')]?_0x1974db[_0x0040('0x22')]['where']||null:null,'attributes':_0x1974db['options']?_0x1974db[_0x0040('0x22')][_0x0040('0x24')]||null:null,'limit':_0x1974db[_0x0040('0x22')]?_0x1974db[_0x0040('0x22')]['limit']||null:null,'include':_0x1974db[_0x0040('0x22')]?_0x1974db[_0x0040('0x22')][_0x0040('0x25')]?_['map'](_0x1974db[_0x0040('0x22')][_0x0040('0x25')],function(_0x4a34e5){return{'model':db[_0x4a34e5['model']],'as':_0x4a34e5['as'],'attributes':_0x4a34e5[_0x0040('0x24')],'include':_0x4a34e5['include']?_[_0x0040('0x26')](_0x4a34e5['include'],function(_0x392ceb){return{'model':db[_0x392ceb[_0x0040('0x27')]],'as':_0x392ceb['as'],'attributes':_0x392ceb['attributes'],'include':_0x392ceb[_0x0040('0x25')]?_[_0x0040('0x26')](_0x392ceb[_0x0040('0x25')],function(_0x537647){return{'model':db[_0x537647[_0x0040('0x27')]],'as':_0x537647['as'],'attributes':_0x537647[_0x0040('0x24')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3246fe){logger['info'](_0x0040('0x1f'),_0x1974db);logger[_0x0040('0x17')](_0x0040('0x1f'),_0x1974db,JSON[_0x0040('0x19')](_0x3246fe));_0x2b3153(_0x3246fe);})['catch'](function(_0x858139){logger[_0x0040('0x1a')](_0x0040('0x1f'),_0x858139['message'],_0x1974db);_0x582f02(_0x24a1f1[_0x0040('0x1a')](0x1f4,_0x858139[_0x0040('0x1c')]));});});};exports[_0x0040('0x28')]=function(_0x3e431d){var _0x1609df=this;return new Promise(function(_0x9cf090,_0x287be7){return db[_0x0040('0x20')][_0x0040('0x29')]({'raw':_0x3e431d[_0x0040('0x22')]?_0x3e431d[_0x0040('0x22')][_0x0040('0x23')]===undefined?!![]:![]:!![],'where':_0x3e431d[_0x0040('0x22')]?_0x3e431d[_0x0040('0x22')][_0x0040('0x2a')]||null:null,'attributes':_0x3e431d[_0x0040('0x22')]?_0x3e431d['options'][_0x0040('0x24')]||null:null,'include':_0x3e431d[_0x0040('0x22')]?_0x3e431d[_0x0040('0x22')][_0x0040('0x25')]?_[_0x0040('0x26')](_0x3e431d['options'][_0x0040('0x25')],function(_0x18e80a){return{'model':db[_0x18e80a[_0x0040('0x27')]],'as':_0x18e80a['as'],'attributes':_0x18e80a['attributes'],'include':_0x18e80a['include']?_['map'](_0x18e80a[_0x0040('0x25')],function(_0x296928){return{'model':db[_0x296928['model']],'as':_0x296928['as'],'attributes':_0x296928[_0x0040('0x24')],'include':_0x296928[_0x0040('0x25')]?_[_0x0040('0x26')](_0x296928[_0x0040('0x25')],function(_0x4bcadb){return{'model':db[_0x4bcadb[_0x0040('0x27')]],'as':_0x4bcadb['as'],'attributes':_0x4bcadb[_0x0040('0x24')]};}):[]};}):[]};}):[]:[]})[_0x0040('0x13')](function(_0x3d341b){logger[_0x0040('0x14')](_0x0040('0x28'),_0x3e431d);logger['debug'](_0x0040('0x28'),_0x3e431d,JSON[_0x0040('0x19')](_0x3d341b));_0x9cf090(_0x3d341b);})[_0x0040('0x1e')](function(_0x2545c6){logger[_0x0040('0x1a')](_0x0040('0x28'),_0x2545c6[_0x0040('0x1c')],_0x3e431d);_0x287be7(_0x1609df['error'](0x1f4,_0x2545c6[_0x0040('0x1c')]));});});}; \ No newline at end of file +var _0xf13a=['result','catch','GetFaxQueue','FaxQueue','options','where','attributes','limit','include','map','model','ShowFaxQueue','find','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./faxQueue.socket','then','info','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','error','code','FaxQueue,\x20%s,\x20%s','message'];(function(_0x4df17e,_0x5edbda){var _0x5685a2=function(_0x275c1a){while(--_0x275c1a){_0x4df17e['push'](_0x4df17e['shift']());}};_0x5685a2(++_0x5edbda);}(_0xf13a,0x1af));var _0xaf13=function(_0x1ac120,_0x3e7e45){_0x1ac120=_0x1ac120-0x0;var _0x19b703=_0xf13a[_0x1ac120];return _0x19b703;};'use strict';var _=require(_0xaf13('0x0'));var util=require(_0xaf13('0x1'));var moment=require(_0xaf13('0x2'));var BPromise=require('bluebird');var rs=require(_0xaf13('0x3'));var fs=require('fs');var Redis=require(_0xaf13('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xaf13('0x5'));var logger=require(_0xaf13('0x6'))(_0xaf13('0x7'));var config=require(_0xaf13('0x8'));var jayson=require(_0xaf13('0x9'));var client=jayson[_0xaf13('0xa')][_0xaf13('0xb')]({'port':0x232a});config[_0xaf13('0xc')]=_['defaults'](config['redis'],{'host':_0xaf13('0xd'),'port':0x18eb});var socket=require(_0xaf13('0xe'))(new Redis(config[_0xaf13('0xc')]));require(_0xaf13('0xf'))['register'](socket);function respondWithRpcPromise(_0x8d2926,_0x3cc7d2,_0x374412){return new BPromise(function(_0x449c16,_0x340613){return client['request'](_0x8d2926,_0x374412)[_0xaf13('0x10')](function(_0x2ba443){logger[_0xaf13('0x11')]('FaxQueue,\x20%s,\x20%s',_0x3cc7d2,_0xaf13('0x12'));logger[_0xaf13('0x13')](_0xaf13('0x14'),_0x3cc7d2,_0xaf13('0x12'),JSON['stringify'](_0x2ba443));if(_0x2ba443[_0xaf13('0x15')]){if(_0x2ba443[_0xaf13('0x15')][_0xaf13('0x16')]===0x1f4){logger['error'](_0xaf13('0x17'),_0x3cc7d2,_0x2ba443[_0xaf13('0x15')][_0xaf13('0x18')]);return _0x340613(_0x2ba443[_0xaf13('0x15')][_0xaf13('0x18')]);}logger[_0xaf13('0x15')]('FaxQueue,\x20%s,\x20%s',_0x3cc7d2,_0x2ba443[_0xaf13('0x15')][_0xaf13('0x18')]);return _0x449c16(_0x2ba443[_0xaf13('0x15')][_0xaf13('0x18')]);}else{logger[_0xaf13('0x11')](_0xaf13('0x17'),_0x3cc7d2,'request\x20sent');_0x449c16(_0x2ba443[_0xaf13('0x19')]['message']);}})[_0xaf13('0x1a')](function(_0x25e530){logger[_0xaf13('0x15')]('FaxQueue,\x20%s,\x20%s',_0x3cc7d2,_0x25e530);_0x340613(_0x25e530);});});}exports[_0xaf13('0x1b')]=function(_0x4932c3){var _0x33d38f=this;return new Promise(function(_0x409005,_0x551cf1){return db[_0xaf13('0x1c')]['findAll']({'raw':_0x4932c3[_0xaf13('0x1d')]?_0x4932c3[_0xaf13('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x4932c3[_0xaf13('0x1d')]?_0x4932c3[_0xaf13('0x1d')][_0xaf13('0x1e')]||null:null,'attributes':_0x4932c3[_0xaf13('0x1d')]?_0x4932c3['options'][_0xaf13('0x1f')]||null:null,'limit':_0x4932c3[_0xaf13('0x1d')]?_0x4932c3[_0xaf13('0x1d')][_0xaf13('0x20')]||null:null,'include':_0x4932c3['options']?_0x4932c3[_0xaf13('0x1d')][_0xaf13('0x21')]?_[_0xaf13('0x22')](_0x4932c3[_0xaf13('0x1d')][_0xaf13('0x21')],function(_0x47130e){return{'model':db[_0x47130e[_0xaf13('0x23')]],'as':_0x47130e['as'],'attributes':_0x47130e[_0xaf13('0x1f')],'include':_0x47130e[_0xaf13('0x21')]?_['map'](_0x47130e[_0xaf13('0x21')],function(_0x4419ea){return{'model':db[_0x4419ea['model']],'as':_0x4419ea['as'],'attributes':_0x4419ea['attributes'],'include':_0x4419ea[_0xaf13('0x21')]?_[_0xaf13('0x22')](_0x4419ea['include'],function(_0x253a8c){return{'model':db[_0x253a8c[_0xaf13('0x23')]],'as':_0x253a8c['as'],'attributes':_0x253a8c[_0xaf13('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xaf13('0x10')](function(_0x511294){logger[_0xaf13('0x11')](_0xaf13('0x1b'),_0x4932c3);logger['debug'](_0xaf13('0x1b'),_0x4932c3,JSON['stringify'](_0x511294));_0x409005(_0x511294);})['catch'](function(_0x513d38){logger[_0xaf13('0x15')]('GetFaxQueue',_0x513d38[_0xaf13('0x18')],_0x4932c3);_0x551cf1(_0x33d38f['error'](0x1f4,_0x513d38[_0xaf13('0x18')]));});});};exports[_0xaf13('0x24')]=function(_0x2725c8){var _0x4a2fb5=this;return new Promise(function(_0xf1f22a,_0x1787fa){return db[_0xaf13('0x1c')][_0xaf13('0x25')]({'raw':_0x2725c8[_0xaf13('0x1d')]?_0x2725c8[_0xaf13('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x2725c8[_0xaf13('0x1d')]?_0x2725c8['options']['where']||null:null,'attributes':_0x2725c8[_0xaf13('0x1d')]?_0x2725c8[_0xaf13('0x1d')][_0xaf13('0x1f')]||null:null,'include':_0x2725c8[_0xaf13('0x1d')]?_0x2725c8[_0xaf13('0x1d')][_0xaf13('0x21')]?_[_0xaf13('0x22')](_0x2725c8[_0xaf13('0x1d')][_0xaf13('0x21')],function(_0xb4a9ea){return{'model':db[_0xb4a9ea[_0xaf13('0x23')]],'as':_0xb4a9ea['as'],'attributes':_0xb4a9ea[_0xaf13('0x1f')],'include':_0xb4a9ea[_0xaf13('0x21')]?_['map'](_0xb4a9ea[_0xaf13('0x21')],function(_0xfc28ff){return{'model':db[_0xfc28ff[_0xaf13('0x23')]],'as':_0xfc28ff['as'],'attributes':_0xfc28ff[_0xaf13('0x1f')],'include':_0xfc28ff[_0xaf13('0x21')]?_[_0xaf13('0x22')](_0xfc28ff[_0xaf13('0x21')],function(_0x5bd94a){return{'model':db[_0x5bd94a[_0xaf13('0x23')]],'as':_0x5bd94a['as'],'attributes':_0x5bd94a[_0xaf13('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xaf13('0x10')](function(_0x5d8de0){logger[_0xaf13('0x11')]('ShowFaxQueue',_0x2725c8);logger['debug'](_0xaf13('0x24'),_0x2725c8,JSON['stringify'](_0x5d8de0));_0xf1f22a(_0x5d8de0);})[_0xaf13('0x1a')](function(_0x2a681b){logger[_0xaf13('0x15')]('ShowFaxQueue',_0x2a681b[_0xaf13('0x18')],_0x2725c8);_0x1787fa(_0x4a2fb5[_0xaf13('0x15')](0x1f4,_0x2a681b[_0xaf13('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 7dcbabb..a6b755b 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 _0x19b4=['length','faxQueue:','./faxQueue.events','save','remove','update','emit'];(function(_0x5c455a,_0x4febed){var _0x57d3dc=function(_0x227798){while(--_0x227798){_0x5c455a['push'](_0x5c455a['shift']());}};_0x57d3dc(++_0x4febed);}(_0x19b4,0x113));var _0x419b=function(_0x2efa3d,_0x3f1b4d){_0x2efa3d=_0x2efa3d-0x0;var _0x58c525=_0x19b4[_0x2efa3d];return _0x58c525;};'use strict';var FaxQueueEvents=require(_0x419b('0x0'));var events=[_0x419b('0x1'),_0x419b('0x2'),_0x419b('0x3')];function createListener(_0x1ca2df,_0x2ea070){return function(_0x1dec10){_0x2ea070[_0x419b('0x4')](_0x1ca2df,_0x1dec10);};}function removeListener(_0xe4168,_0x5df4d3){return function(){FaxQueueEvents['removeListener'](_0xe4168,_0x5df4d3);};}exports['register']=function(_0x50bad2){for(var _0x42b277=0x0,_0x4ba3dd=events[_0x419b('0x5')];_0x42b277<_0x4ba3dd;_0x42b277++){var _0x4b73e3=events[_0x42b277];var _0xeee8b2=createListener(_0x419b('0x6')+_0x4b73e3,_0x50bad2);FaxQueueEvents['on'](_0x4b73e3,_0xeee8b2);}}; \ No newline at end of file +var _0xaddb=['save','remove','removeListener','length','faxQueue:','./faxQueue.events'];(function(_0x4f6efd,_0x587db0){var _0x5ddd3d=function(_0x3c2363){while(--_0x3c2363){_0x4f6efd['push'](_0x4f6efd['shift']());}};_0x5ddd3d(++_0x587db0);}(_0xaddb,0x83));var _0xbadd=function(_0x4c9427,_0x372857){_0x4c9427=_0x4c9427-0x0;var _0x5bfa52=_0xaddb[_0x4c9427];return _0x5bfa52;};'use strict';var FaxQueueEvents=require(_0xbadd('0x0'));var events=[_0xbadd('0x1'),_0xbadd('0x2'),'update'];function createListener(_0x28a291,_0x16a1b2){return function(_0x170d2f){_0x16a1b2['emit'](_0x28a291,_0x170d2f);};}function removeListener(_0xfb1bd3,_0x2ee5ec){return function(){FaxQueueEvents[_0xbadd('0x3')](_0xfb1bd3,_0x2ee5ec);};}exports['register']=function(_0x26a370){for(var _0x171db2=0x0,_0x7545a5=events[_0xbadd('0x4')];_0x171db2<_0x7545a5;_0x171db2++){var _0x14e3fc=events[_0x171db2];var _0x1f2721=createListener(_0xbadd('0x5')+_0x14e3fc,_0x26a370);FaxQueueEvents['on'](_0x14e3fc,_0x1f2721);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 20a3f29..fef0837 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 _0x583c=['util','path','connect-timeout','Router','fs-extra','../../config/environment','./faxQueue.controller','isAuthenticated','index','get','/describe','describe','show','/:id/members','/:id/teams','getTeams','getAgents','post','create','addTeams','/:id/users','addAgents','put','update','/:id','delete','removeTeams','removeAgents','exports','multer'];(function(_0x15a634,_0x4feb86){var _0xf4f7a0=function(_0x31d9fe){while(--_0x31d9fe){_0x15a634['push'](_0x15a634['shift']());}};_0xf4f7a0(++_0x4feb86);}(_0x583c,0x12b));var _0xc583=function(_0x550e29,_0x4047f){_0x550e29=_0x550e29-0x0;var _0x3515b6=_0x583c[_0x550e29];return _0x3515b6;};'use strict';var multer=require(_0xc583('0x0'));var util=require(_0xc583('0x1'));var path=require(_0xc583('0x2'));var timeout=require(_0xc583('0x3'));var express=require('express');var router=express[_0xc583('0x4')]();var fs_extra=require(_0xc583('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc583('0x6'));var controller=require(_0xc583('0x7'));router['get']('/',auth[_0xc583('0x8')](),controller[_0xc583('0x9')]);router[_0xc583('0xa')](_0xc583('0xb'),auth['isAuthenticated'](),controller[_0xc583('0xc')]);router[_0xc583('0xa')]('/:id',auth[_0xc583('0x8')](),controller[_0xc583('0xd')]);router[_0xc583('0xa')](_0xc583('0xe'),auth[_0xc583('0x8')](),controller['getMembers']);router[_0xc583('0xa')](_0xc583('0xf'),auth['isAuthenticated'](),controller[_0xc583('0x10')]);router[_0xc583('0xa')]('/:id/users',auth[_0xc583('0x8')](),controller[_0xc583('0x11')]);router[_0xc583('0x12')]('/',auth[_0xc583('0x8')](),controller[_0xc583('0x13')]);router[_0xc583('0x12')](_0xc583('0xf'),auth[_0xc583('0x8')](),controller[_0xc583('0x14')]);router['post'](_0xc583('0x15'),auth['isAuthenticated'](),controller[_0xc583('0x16')]);router[_0xc583('0x17')]('/:id',auth[_0xc583('0x8')](),controller[_0xc583('0x18')]);router['delete'](_0xc583('0x19'),auth[_0xc583('0x8')](),controller['destroy']);router[_0xc583('0x1a')](_0xc583('0xf'),auth[_0xc583('0x8')](),controller[_0xc583('0x1b')]);router['delete'](_0xc583('0x15'),auth['isAuthenticated'](),controller[_0xc583('0x1c')]);module[_0xc583('0x1d')]=router; \ No newline at end of file +var _0x6b1b=['../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/describe','describe','/:id/teams','getAgents','post','create','addTeams','/:id/users','addAgents','delete','/:id','destroy','removeAgents','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0x6b1b,0x1e7));var _0xb6b1=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0x6b1b[_0x4baae2];return _0x1a2285;};'use strict';var multer=require('multer');var util=require(_0xb6b1('0x0'));var path=require(_0xb6b1('0x1'));var timeout=require(_0xb6b1('0x2'));var express=require('express');var router=express[_0xb6b1('0x3')]();var fs_extra=require(_0xb6b1('0x4'));var auth=require(_0xb6b1('0x5'));var interaction=require(_0xb6b1('0x6'));var config=require(_0xb6b1('0x7'));var controller=require(_0xb6b1('0x8'));router[_0xb6b1('0x9')]('/',auth[_0xb6b1('0xa')](),controller[_0xb6b1('0xb')]);router[_0xb6b1('0x9')](_0xb6b1('0xc'),auth['isAuthenticated'](),controller[_0xb6b1('0xd')]);router['get']('/:id',auth[_0xb6b1('0xa')](),controller['show']);router[_0xb6b1('0x9')]('/:id/members',auth['isAuthenticated'](),controller['getMembers']);router['get'](_0xb6b1('0xe'),auth[_0xb6b1('0xa')](),controller['getTeams']);router[_0xb6b1('0x9')]('/:id/users',auth['isAuthenticated'](),controller[_0xb6b1('0xf')]);router[_0xb6b1('0x10')]('/',auth[_0xb6b1('0xa')](),controller[_0xb6b1('0x11')]);router[_0xb6b1('0x10')](_0xb6b1('0xe'),auth[_0xb6b1('0xa')](),controller[_0xb6b1('0x12')]);router[_0xb6b1('0x10')](_0xb6b1('0x13'),auth[_0xb6b1('0xa')](),controller[_0xb6b1('0x14')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0xb6b1('0x15')](_0xb6b1('0x16'),auth[_0xb6b1('0xa')](),controller[_0xb6b1('0x17')]);router[_0xb6b1('0x15')](_0xb6b1('0xe'),auth['isAuthenticated'](),controller['removeTeams']);router[_0xb6b1('0x15')](_0xb6b1('0x13'),auth[_0xb6b1('0xa')](),controller[_0xb6b1('0x18')]);module[_0xb6b1('0x19')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 456882e..c265bd3 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 _0xde32=['DATE','moment','sequelize','STRING'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xde32,0xd5));var _0x2de3=function(_0x1fdaf4,_0x465974){_0x1fdaf4=_0x1fdaf4-0x0;var _0x527f4b=_0xde32[_0x1fdaf4];return _0x527f4b;};'use strict';var moment=require(_0x2de3('0x0'));var Sequelize=require(_0x2de3('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x2de3('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x2de3('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x2de3('0x3')]},'acceptAt':{'type':Sequelize[_0x2de3('0x3')]},'exitAt':{'type':Sequelize[_0x2de3('0x3')]},'reason':{'type':Sequelize[_0x2de3('0x2')]}}; \ No newline at end of file +var _0x2299=['moment','sequelize','STRING','DATE'];(function(_0x25d8f1,_0x30a9f3){var _0x31839d=function(_0x44fc86){while(--_0x44fc86){_0x25d8f1['push'](_0x25d8f1['shift']());}};_0x31839d(++_0x30a9f3);}(_0x2299,0xb8));var _0x9229=function(_0x13d911,_0x472938){_0x13d911=_0x13d911-0x0;var _0x1bb4ea=_0x2299[_0x13d911];return _0x1bb4ea;};'use strict';var moment=require(_0x9229('0x0'));var Sequelize=require(_0x9229('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x9229('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x9229('0x2')]},'joinAt':{'type':Sequelize[_0x9229('0x3')]},'leaveAt':{'type':Sequelize[_0x9229('0x3')]},'acceptAt':{'type':Sequelize[_0x9229('0x3')]},'exitAt':{'type':Sequelize[_0x9229('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index b9dd690..4658c4c 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 _0x35a9=['send','index','map','FaxQueueReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','include','find','create','body','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','save','update','then','destroy','error','stack','name'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x35a9,0x73));var _0x935a=function(_0x187077,_0x1b69e1){_0x187077=_0x187077-0x0;var _0x2a85aa=_0x35a9[_0x187077];return _0x2a85aa;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x935a('0x0'));var zipdir=require(_0x935a('0x1'));var jsonpatch=require(_0x935a('0x2'));var rp=require(_0x935a('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x935a('0x4'));var util=require('util');var path=require(_0x935a('0x5'));var sox=require(_0x935a('0x6'));var csv=require(_0x935a('0x7'));var ejs=require(_0x935a('0x8'));var fs=require('fs');var fs_extra=require(_0x935a('0x9'));var _=require(_0x935a('0xa'));var squel=require(_0x935a('0xb'));var crypto=require(_0x935a('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x935a('0xd'));var toCsv=require(_0x935a('0x7'));var querystring=require(_0x935a('0xe'));var Papa=require(_0x935a('0xf'));var Redis=require(_0x935a('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x935a('0x11'));var as=require(_0x935a('0x12'));var hardwareService=require(_0x935a('0x13'));var logger=require('../../config/logger')(_0x935a('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x935a('0x15'));var db=require(_0x935a('0x16'))['db'];function respondWithStatusCode(_0x1e5152,_0x441f98){_0x441f98=_0x441f98||0xcc;return function(_0x3ed7e0){if(_0x3ed7e0){return _0x1e5152[_0x935a('0x17')](_0x441f98);}return _0x1e5152[_0x935a('0x18')](_0x441f98)[_0x935a('0x19')]();};}function respondWithResult(_0x5e1131,_0x109a98){_0x109a98=_0x109a98||0xc8;return function(_0x304c38){if(_0x304c38){return _0x5e1131[_0x935a('0x18')](_0x109a98)[_0x935a('0x1a')](_0x304c38);}};}function respondWithFilteredResult(_0xeebc0c,_0x22ab95){return function(_0xf881d6){if(_0xf881d6){var _0x463db1=typeof _0x22ab95[_0x935a('0x1b')]===_0x935a('0x1c')&&typeof _0x22ab95['limit']===_0x935a('0x1c');var _0x2aab94=_0xf881d6[_0x935a('0x1d')];var _0x446232=_0x463db1?0x0:_0x22ab95[_0x935a('0x1b')];var _0x3bac3e=_0x463db1?_0xf881d6[_0x935a('0x1d')]:_0x22ab95['offset']+_0x22ab95[_0x935a('0x1e')];var _0x90ef4;if(_0x3bac3e>=_0x2aab94){_0x3bac3e=_0x2aab94;_0x90ef4=0xc8;}else{_0x90ef4=0xce;}_0xeebc0c[_0x935a('0x18')](_0x90ef4);return _0xeebc0c[_0x935a('0x1f')]('Content-Range',_0x446232+'-'+_0x3bac3e+'/'+_0x2aab94)[_0x935a('0x1a')](_0xf881d6);}return null;};}function patchUpdates(_0x2c6873){return function(_0x53267b){try{jsonpatch[_0x935a('0x20')](_0x53267b,_0x2c6873,!![]);}catch(_0x257eb9){return BPromise[_0x935a('0x21')](_0x257eb9);}return _0x53267b[_0x935a('0x22')]();};}function saveUpdates(_0xe04139,_0x490627){return function(_0x267c48){if(_0x267c48){return _0x267c48[_0x935a('0x23')](_0xe04139)[_0x935a('0x24')](function(_0x4dd7aa){return _0x4dd7aa;});}return null;};}function removeEntity(_0x13e62a,_0x413787){return function(_0x326246){if(_0x326246){return _0x326246[_0x935a('0x25')]()['then'](function(){_0x13e62a['status'](0xcc)[_0x935a('0x19')]();});}};}function handleEntityNotFound(_0x46b6b8,_0x5a29df){return function(_0xa2c3f5){if(!_0xa2c3f5){_0x46b6b8[_0x935a('0x17')](0x194);}return _0xa2c3f5;};}function handleError(_0x34fb6f,_0x33f8c3){_0x33f8c3=_0x33f8c3||0x1f4;return function(_0x45ffc1){logger[_0x935a('0x26')](_0x45ffc1[_0x935a('0x27')]);if(_0x45ffc1[_0x935a('0x28')]){delete _0x45ffc1[_0x935a('0x28')];}_0x34fb6f[_0x935a('0x18')](_0x33f8c3)[_0x935a('0x29')](_0x45ffc1);};}exports[_0x935a('0x2a')]=function(_0x595b1c,_0x39c72c){var _0x43d93b={},_0x18a9dc={},_0x4f53af={'count':0x0,'rows':[]};var _0x261a8a=_[_0x935a('0x2b')](db[_0x935a('0x2c')][_0x935a('0x2d')],function(_0x48c9b5){return{'name':_0x48c9b5[_0x935a('0x2e')],'type':_0x48c9b5[_0x935a('0x2f')][_0x935a('0x30')]};});_0x18a9dc[_0x935a('0x31')]=_['map'](_0x261a8a,'name');_0x18a9dc[_0x935a('0x32')]=_[_0x935a('0x33')](_0x595b1c['query']);_0x18a9dc['filters']=_[_0x935a('0x34')](_0x18a9dc[_0x935a('0x31')],_0x18a9dc['query']);_0x43d93b[_0x935a('0x35')]=_['intersection'](_0x18a9dc[_0x935a('0x31')],qs['fields'](_0x595b1c[_0x935a('0x32')][_0x935a('0x36')]));_0x43d93b['attributes']=_0x43d93b['attributes'][_0x935a('0x37')]?_0x43d93b[_0x935a('0x35')]:_0x18a9dc[_0x935a('0x31')];if(!_0x595b1c[_0x935a('0x32')][_0x935a('0x38')](_0x935a('0x39'))){_0x43d93b[_0x935a('0x1e')]=qs[_0x935a('0x1e')](_0x595b1c[_0x935a('0x32')][_0x935a('0x1e')]);_0x43d93b['offset']=qs['offset'](_0x595b1c['query'][_0x935a('0x1b')]);}_0x43d93b[_0x935a('0x3a')]=qs[_0x935a('0x3b')](_0x595b1c[_0x935a('0x32')][_0x935a('0x3b')]);_0x43d93b[_0x935a('0x3c')]=qs['filters'](_[_0x935a('0x3d')](_0x595b1c['query'],_0x18a9dc[_0x935a('0x3e')]),_0x261a8a);if(_0x595b1c[_0x935a('0x32')][_0x935a('0x3f')]){_0x43d93b[_0x935a('0x3c')]=_['merge'](_0x43d93b[_0x935a('0x3c')],{'$or':_[_0x935a('0x2b')](_0x261a8a,function(_0x319642){if(_0x319642[_0x935a('0x2f')]!==_0x935a('0x40')){var _0x4dc91c={};_0x4dc91c[_0x319642['name']]={'$like':'%'+_0x595b1c[_0x935a('0x32')][_0x935a('0x3f')]+'%'};return _0x4dc91c;}})});}_0x43d93b=_[_0x935a('0x41')]({},_0x43d93b,_0x595b1c[_0x935a('0x42')]);var _0x1a2ae6={'where':_0x43d93b[_0x935a('0x3c')]};return db[_0x935a('0x2c')][_0x935a('0x1d')](_0x1a2ae6)[_0x935a('0x24')](function(_0x20584f){_0x4f53af[_0x935a('0x1d')]=_0x20584f;if(_0x595b1c['query'][_0x935a('0x43')]){_0x43d93b['include']=[{'all':!![]}];}return db['FaxQueueReport'][_0x935a('0x44')](_0x43d93b);})['then'](function(_0x3f5653){_0x4f53af[_0x935a('0x45')]=_0x3f5653;return _0x4f53af;})[_0x935a('0x24')](respondWithFilteredResult(_0x39c72c,_0x43d93b))[_0x935a('0x46')](handleError(_0x39c72c,null));};exports[_0x935a('0x47')]=function(_0x43ea46,_0x329719){var _0x57f870={'raw':!![],'where':{'id':_0x43ea46['params']['id']}},_0x2d734d={};_0x2d734d[_0x935a('0x31')]=_[_0x935a('0x33')](db[_0x935a('0x2c')][_0x935a('0x2d')]);_0x2d734d[_0x935a('0x32')]=_[_0x935a('0x33')](_0x43ea46['query']);_0x2d734d[_0x935a('0x3e')]=_['intersection'](_0x2d734d[_0x935a('0x31')],_0x2d734d['query']);_0x57f870[_0x935a('0x35')]=_[_0x935a('0x34')](_0x2d734d['model'],qs[_0x935a('0x36')](_0x43ea46[_0x935a('0x32')][_0x935a('0x36')]));_0x57f870[_0x935a('0x35')]=_0x57f870[_0x935a('0x35')][_0x935a('0x37')]?_0x57f870['attributes']:_0x2d734d['model'];if(_0x43ea46[_0x935a('0x32')]['includeAll']){_0x57f870[_0x935a('0x48')]=[{'all':!![]}];}_0x57f870=_[_0x935a('0x41')]({},_0x57f870,_0x43ea46[_0x935a('0x42')]);return db[_0x935a('0x2c')][_0x935a('0x49')](_0x57f870)[_0x935a('0x24')](handleEntityNotFound(_0x329719,null))[_0x935a('0x24')](respondWithResult(_0x329719,null))[_0x935a('0x46')](handleError(_0x329719,null));};exports['create']=function(_0x27aa52,_0x21e2c3){return db[_0x935a('0x2c')][_0x935a('0x4a')](_0x27aa52[_0x935a('0x4b')],{})[_0x935a('0x24')](respondWithResult(_0x21e2c3,0xc9))[_0x935a('0x46')](handleError(_0x21e2c3,null));};exports[_0x935a('0x23')]=function(_0x479124,_0x23e85f){if(_0x479124['body']['id']){delete _0x479124['body']['id'];}return db['FaxQueueReport'][_0x935a('0x49')]({'where':{'id':_0x479124[_0x935a('0x4c')]['id']}})[_0x935a('0x24')](handleEntityNotFound(_0x23e85f,null))[_0x935a('0x24')](saveUpdates(_0x479124['body'],null))[_0x935a('0x24')](respondWithResult(_0x23e85f,null))['catch'](handleError(_0x23e85f,null));};exports['destroy']=function(_0x41c5dc,_0x17d5ef){return db[_0x935a('0x2c')][_0x935a('0x49')]({'where':{'id':_0x41c5dc[_0x935a('0x4c')]['id']}})[_0x935a('0x24')](handleEntityNotFound(_0x17d5ef,null))[_0x935a('0x24')](removeEntity(_0x17d5ef,null))['catch'](handleError(_0x17d5ef,null));};exports[_0x935a('0x4d')]=function(_0x209cd8,_0x5bde42){return db[_0x935a('0x2c')]['describe']()['then'](respondWithResult(_0x5bde42,null))['catch'](handleError(_0x5bde42,null));}; \ No newline at end of file +var _0x4fdc=['crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','apply','reject','save','update','then','destroy','error','name','send','index','map','FaxQueueReport','rawAttributes','fieldName','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','filter','merge','type','VIRTUAL','options','include','rows','catch','params','find','create','body','describe','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel'];(function(_0x4c73f2,_0x168ac5){var _0x257b36=function(_0xaeb311){while(--_0xaeb311){_0x4c73f2['push'](_0x4c73f2['shift']());}};_0x257b36(++_0x168ac5);}(_0x4fdc,0x84));var _0xc4fd=function(_0x1ad17b,_0xd6e43e){_0x1ad17b=_0x1ad17b-0x0;var _0x4aae59=_0x4fdc[_0x1ad17b];return _0x4aae59;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc4fd('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc4fd('0x1'));var rp=require(_0xc4fd('0x2'));var moment=require(_0xc4fd('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xc4fd('0x4'));var util=require(_0xc4fd('0x5'));var path=require(_0xc4fd('0x6'));var sox=require(_0xc4fd('0x7'));var csv=require(_0xc4fd('0x8'));var ejs=require(_0xc4fd('0x9'));var fs=require('fs');var fs_extra=require(_0xc4fd('0xa'));var _=require('lodash');var squel=require(_0xc4fd('0xb'));var crypto=require(_0xc4fd('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xc4fd('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc4fd('0xe'));var Redis=require(_0xc4fd('0xf'));var authService=require(_0xc4fd('0x10'));var qs=require(_0xc4fd('0x11'));var as=require(_0xc4fd('0x12'));var hardwareService=require(_0xc4fd('0x13'));var logger=require(_0xc4fd('0x14'))(_0xc4fd('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc4fd('0x16'));var db=require(_0xc4fd('0x17'))['db'];function respondWithStatusCode(_0x25fc9a,_0x4cecec){_0x4cecec=_0x4cecec||0xcc;return function(_0x31d6c0){if(_0x31d6c0){return _0x25fc9a[_0xc4fd('0x18')](_0x4cecec);}return _0x25fc9a[_0xc4fd('0x19')](_0x4cecec)[_0xc4fd('0x1a')]();};}function respondWithResult(_0x4577a8,_0x29d08c){_0x29d08c=_0x29d08c||0xc8;return function(_0x1d67f0){if(_0x1d67f0){return _0x4577a8[_0xc4fd('0x19')](_0x29d08c)[_0xc4fd('0x1b')](_0x1d67f0);}};}function respondWithFilteredResult(_0x553121,_0x75a44f){return function(_0x4c96e5){if(_0x4c96e5){var _0x5a248c=typeof _0x75a44f[_0xc4fd('0x1c')]===_0xc4fd('0x1d')&&typeof _0x75a44f['limit']==='undefined';var _0x6c739e=_0x4c96e5[_0xc4fd('0x1e')];var _0x2bc246=_0x5a248c?0x0:_0x75a44f[_0xc4fd('0x1c')];var _0xaf6c46=_0x5a248c?_0x4c96e5[_0xc4fd('0x1e')]:_0x75a44f[_0xc4fd('0x1c')]+_0x75a44f['limit'];var _0x1e440f;if(_0xaf6c46>=_0x6c739e){_0xaf6c46=_0x6c739e;_0x1e440f=0xc8;}else{_0x1e440f=0xce;}_0x553121[_0xc4fd('0x19')](_0x1e440f);return _0x553121[_0xc4fd('0x1f')]('Content-Range',_0x2bc246+'-'+_0xaf6c46+'/'+_0x6c739e)['json'](_0x4c96e5);}return null;};}function patchUpdates(_0x1a21ef){return function(_0x254278){try{jsonpatch[_0xc4fd('0x20')](_0x254278,_0x1a21ef,!![]);}catch(_0x3f6fe3){return BPromise[_0xc4fd('0x21')](_0x3f6fe3);}return _0x254278[_0xc4fd('0x22')]();};}function saveUpdates(_0x5bcb6c,_0x5271f8){return function(_0x30900b){if(_0x30900b){return _0x30900b[_0xc4fd('0x23')](_0x5bcb6c)[_0xc4fd('0x24')](function(_0x2eba79){return _0x2eba79;});}return null;};}function removeEntity(_0x1b206b,_0x433eb4){return function(_0x3006ad){if(_0x3006ad){return _0x3006ad[_0xc4fd('0x25')]()[_0xc4fd('0x24')](function(){_0x1b206b['status'](0xcc)[_0xc4fd('0x1a')]();});}};}function handleEntityNotFound(_0x18b1a8,_0x2ce202){return function(_0x2c8831){if(!_0x2c8831){_0x18b1a8[_0xc4fd('0x18')](0x194);}return _0x2c8831;};}function handleError(_0xb6052a,_0x331f1){_0x331f1=_0x331f1||0x1f4;return function(_0x15022d){logger[_0xc4fd('0x26')](_0x15022d['stack']);if(_0x15022d['name']){delete _0x15022d[_0xc4fd('0x27')];}_0xb6052a[_0xc4fd('0x19')](_0x331f1)[_0xc4fd('0x28')](_0x15022d);};}exports[_0xc4fd('0x29')]=function(_0x38ac21,_0x23435e){var _0x546a39={},_0x15d61b={},_0x1b65bd={'count':0x0,'rows':[]};var _0x6b5f5e=_[_0xc4fd('0x2a')](db[_0xc4fd('0x2b')][_0xc4fd('0x2c')],function(_0x193a4a){return{'name':_0x193a4a[_0xc4fd('0x2d')],'type':_0x193a4a['type']['key']};});_0x15d61b[_0xc4fd('0x2e')]=_[_0xc4fd('0x2a')](_0x6b5f5e,_0xc4fd('0x27'));_0x15d61b[_0xc4fd('0x2f')]=_['keys'](_0x38ac21[_0xc4fd('0x2f')]);_0x15d61b['filters']=_[_0xc4fd('0x30')](_0x15d61b[_0xc4fd('0x2e')],_0x15d61b['query']);_0x546a39[_0xc4fd('0x31')]=_[_0xc4fd('0x30')](_0x15d61b[_0xc4fd('0x2e')],qs[_0xc4fd('0x32')](_0x38ac21[_0xc4fd('0x2f')][_0xc4fd('0x32')]));_0x546a39['attributes']=_0x546a39[_0xc4fd('0x31')][_0xc4fd('0x33')]?_0x546a39[_0xc4fd('0x31')]:_0x15d61b[_0xc4fd('0x2e')];if(!_0x38ac21[_0xc4fd('0x2f')][_0xc4fd('0x34')](_0xc4fd('0x35'))){_0x546a39['limit']=qs[_0xc4fd('0x36')](_0x38ac21['query']['limit']);_0x546a39[_0xc4fd('0x1c')]=qs['offset'](_0x38ac21[_0xc4fd('0x2f')][_0xc4fd('0x1c')]);}_0x546a39[_0xc4fd('0x37')]=qs['sort'](_0x38ac21[_0xc4fd('0x2f')][_0xc4fd('0x38')]);_0x546a39[_0xc4fd('0x39')]=qs[_0xc4fd('0x3a')](_['pick'](_0x38ac21[_0xc4fd('0x2f')],_0x15d61b[_0xc4fd('0x3a')]),_0x6b5f5e);if(_0x38ac21[_0xc4fd('0x2f')][_0xc4fd('0x3b')]){_0x546a39['where']=_[_0xc4fd('0x3c')](_0x546a39[_0xc4fd('0x39')],{'$or':_['map'](_0x6b5f5e,function(_0xe202af){if(_0xe202af[_0xc4fd('0x3d')]!==_0xc4fd('0x3e')){var _0x337dc7={};_0x337dc7[_0xe202af['name']]={'$like':'%'+_0x38ac21[_0xc4fd('0x2f')][_0xc4fd('0x3b')]+'%'};return _0x337dc7;}})});}_0x546a39=_['merge']({},_0x546a39,_0x38ac21[_0xc4fd('0x3f')]);var _0x9f2741={'where':_0x546a39[_0xc4fd('0x39')]};return db['FaxQueueReport'][_0xc4fd('0x1e')](_0x9f2741)[_0xc4fd('0x24')](function(_0x18981a){_0x1b65bd[_0xc4fd('0x1e')]=_0x18981a;if(_0x38ac21['query']['includeAll']){_0x546a39[_0xc4fd('0x40')]=[{'all':!![]}];}return db[_0xc4fd('0x2b')]['findAll'](_0x546a39);})[_0xc4fd('0x24')](function(_0xf06c76){_0x1b65bd[_0xc4fd('0x41')]=_0xf06c76;return _0x1b65bd;})[_0xc4fd('0x24')](respondWithFilteredResult(_0x23435e,_0x546a39))[_0xc4fd('0x42')](handleError(_0x23435e,null));};exports['show']=function(_0x3d1584,_0x517fe4){var _0x5c3fe9={'raw':!![],'where':{'id':_0x3d1584[_0xc4fd('0x43')]['id']}},_0xee8027={};_0xee8027['model']=_['keys'](db[_0xc4fd('0x2b')][_0xc4fd('0x2c')]);_0xee8027[_0xc4fd('0x2f')]=_['keys'](_0x3d1584['query']);_0xee8027[_0xc4fd('0x3a')]=_[_0xc4fd('0x30')](_0xee8027[_0xc4fd('0x2e')],_0xee8027[_0xc4fd('0x2f')]);_0x5c3fe9[_0xc4fd('0x31')]=_[_0xc4fd('0x30')](_0xee8027[_0xc4fd('0x2e')],qs[_0xc4fd('0x32')](_0x3d1584[_0xc4fd('0x2f')][_0xc4fd('0x32')]));_0x5c3fe9[_0xc4fd('0x31')]=_0x5c3fe9['attributes'][_0xc4fd('0x33')]?_0x5c3fe9[_0xc4fd('0x31')]:_0xee8027[_0xc4fd('0x2e')];if(_0x3d1584[_0xc4fd('0x2f')]['includeAll']){_0x5c3fe9[_0xc4fd('0x40')]=[{'all':!![]}];}_0x5c3fe9=_[_0xc4fd('0x3c')]({},_0x5c3fe9,_0x3d1584[_0xc4fd('0x3f')]);return db[_0xc4fd('0x2b')][_0xc4fd('0x44')](_0x5c3fe9)[_0xc4fd('0x24')](handleEntityNotFound(_0x517fe4,null))[_0xc4fd('0x24')](respondWithResult(_0x517fe4,null))[_0xc4fd('0x42')](handleError(_0x517fe4,null));};exports[_0xc4fd('0x45')]=function(_0x27b2a6,_0x26a4d2){return db['FaxQueueReport'][_0xc4fd('0x45')](_0x27b2a6[_0xc4fd('0x46')],{})['then'](respondWithResult(_0x26a4d2,0xc9))['catch'](handleError(_0x26a4d2,null));};exports[_0xc4fd('0x23')]=function(_0xebdd81,_0x1a3e0d){if(_0xebdd81[_0xc4fd('0x46')]['id']){delete _0xebdd81[_0xc4fd('0x46')]['id'];}return db['FaxQueueReport'][_0xc4fd('0x44')]({'where':{'id':_0xebdd81[_0xc4fd('0x43')]['id']}})[_0xc4fd('0x24')](handleEntityNotFound(_0x1a3e0d,null))[_0xc4fd('0x24')](saveUpdates(_0xebdd81[_0xc4fd('0x46')],null))[_0xc4fd('0x24')](respondWithResult(_0x1a3e0d,null))[_0xc4fd('0x42')](handleError(_0x1a3e0d,null));};exports['destroy']=function(_0x29d29c,_0x2dad03){return db['FaxQueueReport']['find']({'where':{'id':_0x29d29c[_0xc4fd('0x43')]['id']}})[_0xc4fd('0x24')](handleEntityNotFound(_0x2dad03,null))[_0xc4fd('0x24')](removeEntity(_0x2dad03,null))[_0xc4fd('0x42')](handleError(_0x2dad03,null));};exports[_0xc4fd('0x47')]=function(_0x3999d2,_0x4c5c90){return db[_0xc4fd('0x2b')][_0xc4fd('0x47')]()[_0xc4fd('0x24')](respondWithResult(_0x4c5c90,null))[_0xc4fd('0x42')](handleError(_0x4c5c90,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 5bab051..6413ea1 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 _0x5fc3=['util','api','moment','bluebird','request-promise','path','../../config/environment','./faxQueueReport.attributes','exports','define','report_fax_queue','uniqueid','lodash'];(function(_0x599e60,_0x5b6519){var _0x468e19=function(_0xcdfd97){while(--_0xcdfd97){_0x599e60['push'](_0x599e60['shift']());}};_0x468e19(++_0x5b6519);}(_0x5fc3,0xa8));var _0x35fc=function(_0x39cd3c,_0xa21102){_0x39cd3c=_0x39cd3c-0x0;var _0x47a0ae=_0x5fc3[_0x39cd3c];return _0x47a0ae;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var logger=require('../../config/logger')(_0x35fc('0x2'));var moment=require(_0x35fc('0x3'));var BPromise=require(_0x35fc('0x4'));var rp=require(_0x35fc('0x5'));var fs=require('fs');var path=require(_0x35fc('0x6'));var rimraf=require('rimraf');var config=require(_0x35fc('0x7'));var attributes=require(_0x35fc('0x8'));module[_0x35fc('0x9')]=function(_0x5b85ad,_0x5754be){return _0x5b85ad[_0x35fc('0xa')]('FaxQueueReport',attributes,{'tableName':_0x35fc('0xb'),'paranoid':![],'indexes':[{'name':_0x35fc('0xc'),'fields':[_0x35fc('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7fbe=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','uniqueid','../../config/logger','api'];(function(_0x40cd94,_0x98e3a0){var _0x4a4e40=function(_0x281e97){while(--_0x281e97){_0x40cd94['push'](_0x40cd94['shift']());}};_0x4a4e40(++_0x98e3a0);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x52c3c3,_0x5af662){_0x52c3c3=_0x52c3c3-0x0;var _0x34389a=_0x7fbe[_0x52c3c3];return _0x34389a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe7fb('0x0'))(_0xe7fb('0x1'));var moment=require(_0xe7fb('0x2'));var BPromise=require(_0xe7fb('0x3'));var rp=require(_0xe7fb('0x4'));var fs=require('fs');var path=require(_0xe7fb('0x5'));var rimraf=require(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var attributes=require(_0xe7fb('0x8'));module[_0xe7fb('0x9')]=function(_0x290172,_0x12d1b0){return _0x290172[_0xe7fb('0xa')](_0xe7fb('0xb'),attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0xe7fb('0xc'),'fields':[_0xe7fb('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 4f4c482..d78b31e 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 _0x42c1=['FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateFaxQueueReport','FaxQueueReport','create','body','options','raw','UpdateFaxQueueReport','attributes','limit','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1dffb9,_0x516fb0){var _0x38dc12=function(_0x1a2756){while(--_0x1a2756){_0x1dffb9['push'](_0x1dffb9['shift']());}};_0x38dc12(++_0x516fb0);}(_0x42c1,0x69));var _0x142c=function(_0x1e30fb,_0x79ff8e){_0x1e30fb=_0x1e30fb-0x0;var _0x3ffec9=_0x42c1[_0x1e30fb];return _0x3ffec9;};'use strict';var _=require(_0x142c('0x0'));var util=require(_0x142c('0x1'));var moment=require('moment');var BPromise=require(_0x142c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x142c('0x3'));var db=require(_0x142c('0x4'))['db'];var utils=require(_0x142c('0x5'));var logger=require('../../config/logger')(_0x142c('0x6'));var config=require(_0x142c('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x142c('0x8')][_0x142c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xf1c147,_0x491a47,_0x94839){return new BPromise(function(_0x1668a9,_0xae3e60){return client['request'](_0xf1c147,_0x94839)[_0x142c('0xa')](function(_0x158d14){logger[_0x142c('0xb')](_0x142c('0xc'),_0x491a47,_0x142c('0xd'));logger[_0x142c('0xe')](_0x142c('0xf'),_0x491a47,_0x142c('0xd'),JSON[_0x142c('0x10')](_0x158d14));if(_0x158d14['error']){if(_0x158d14[_0x142c('0x11')]['code']===0x1f4){logger[_0x142c('0x11')]('FaxQueueReport,\x20%s,\x20%s',_0x491a47,_0x158d14[_0x142c('0x11')]['message']);return _0xae3e60(_0x158d14[_0x142c('0x11')][_0x142c('0x12')]);}logger[_0x142c('0x11')]('FaxQueueReport,\x20%s,\x20%s',_0x491a47,_0x158d14[_0x142c('0x11')][_0x142c('0x12')]);return _0x1668a9(_0x158d14['error'][_0x142c('0x12')]);}else{logger[_0x142c('0xb')]('FaxQueueReport,\x20%s,\x20%s',_0x491a47,_0x142c('0xd'));_0x1668a9(_0x158d14[_0x142c('0x13')]['message']);}})[_0x142c('0x14')](function(_0x14c32a){logger[_0x142c('0x11')](_0x142c('0xc'),_0x491a47,_0x14c32a);_0xae3e60(_0x14c32a);});});}exports[_0x142c('0x15')]=function(_0x55113d){var _0x3bc11f=this;return new Promise(function(_0x19cf5a,_0x59c9f3){return db[_0x142c('0x16')][_0x142c('0x17')](_0x55113d[_0x142c('0x18')],{'raw':_0x55113d['options']?_0x55113d[_0x142c('0x19')][_0x142c('0x1a')]===undefined?!![]:![]:!![]})[_0x142c('0xa')](function(_0x2cb514){logger[_0x142c('0xb')](_0x142c('0x15'),_0x55113d);logger[_0x142c('0xe')](_0x142c('0x15'),_0x55113d,JSON['stringify'](_0x2cb514));_0x19cf5a(_0x2cb514);})[_0x142c('0x14')](function(_0x3d4ca3){logger['error']('CreateFaxQueueReport',_0x3d4ca3[_0x142c('0x12')],_0x55113d);_0x59c9f3(_0x3bc11f[_0x142c('0x11')](0x1f4,_0x3d4ca3[_0x142c('0x12')]));});});};exports[_0x142c('0x1b')]=function(_0x1f5f41){var _0x39f5af=this;return new Promise(function(_0x417684,_0x5e2e9a){return db[_0x142c('0x16')]['update'](_0x1f5f41[_0x142c('0x18')],{'raw':_0x1f5f41['options']?_0x1f5f41['options'][_0x142c('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1f5f41['options']?_0x1f5f41[_0x142c('0x19')]['where']||null:null,'attributes':_0x1f5f41[_0x142c('0x19')]?_0x1f5f41[_0x142c('0x19')][_0x142c('0x1c')]||null:null,'limit':_0x1f5f41[_0x142c('0x19')]?_0x1f5f41[_0x142c('0x19')][_0x142c('0x1d')]||null:null})[_0x142c('0xa')](function(_0x21af20){logger[_0x142c('0xb')](_0x142c('0x1b'),_0x1f5f41);logger[_0x142c('0xe')](_0x142c('0x1b'),_0x1f5f41,JSON[_0x142c('0x10')](_0x21af20));_0x417684(_0x21af20);})[_0x142c('0x14')](function(_0x3812e2){logger[_0x142c('0x11')]('UpdateFaxQueueReport',_0x3812e2[_0x142c('0x12')],_0x1f5f41);_0x5e2e9a(_0x39f5af['error'](0x1f4,_0x3812e2[_0x142c('0x12')]));});});}; \ No newline at end of file +var _0x1174=['request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateFaxQueueReport','body','options','UpdateFaxQueueReport','FaxQueueReport','update','raw','where','attributes','limit','lodash','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FaxQueueReport,\x20%s,\x20%s'];(function(_0x48bf20,_0x22e1a2){var _0x2e2ae6=function(_0x1cd8f9){while(--_0x1cd8f9){_0x48bf20['push'](_0x48bf20['shift']());}};_0x2e2ae6(++_0x22e1a2);}(_0x1174,0x1b3));var _0x4117=function(_0x33dc47,_0x1efdb9){_0x33dc47=_0x33dc47-0x0;var _0x371b62=_0x1174[_0x33dc47];return _0x371b62;};'use strict';var _=require(_0x4117('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4117('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0x4117('0x2'));var logger=require(_0x4117('0x3'))(_0x4117('0x4'));var config=require(_0x4117('0x5'));var jayson=require(_0x4117('0x6'));var client=jayson[_0x4117('0x7')][_0x4117('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x418315,_0x1d2913,_0x37654b){return new BPromise(function(_0x13d373,_0x3db36e){return client[_0x4117('0x9')](_0x418315,_0x37654b)[_0x4117('0xa')](function(_0x43e2b){logger[_0x4117('0xb')](_0x4117('0xc'),_0x1d2913,_0x4117('0xd'));logger[_0x4117('0xe')](_0x4117('0xf'),_0x1d2913,_0x4117('0xd'),JSON[_0x4117('0x10')](_0x43e2b));if(_0x43e2b[_0x4117('0x11')]){if(_0x43e2b[_0x4117('0x11')][_0x4117('0x12')]===0x1f4){logger['error']('FaxQueueReport,\x20%s,\x20%s',_0x1d2913,_0x43e2b[_0x4117('0x11')][_0x4117('0x13')]);return _0x3db36e(_0x43e2b[_0x4117('0x11')][_0x4117('0x13')]);}logger['error'](_0x4117('0xc'),_0x1d2913,_0x43e2b[_0x4117('0x11')][_0x4117('0x13')]);return _0x13d373(_0x43e2b[_0x4117('0x11')][_0x4117('0x13')]);}else{logger['info'](_0x4117('0xc'),_0x1d2913,_0x4117('0xd'));_0x13d373(_0x43e2b[_0x4117('0x14')][_0x4117('0x13')]);}})[_0x4117('0x15')](function(_0x1099e5){logger[_0x4117('0x11')](_0x4117('0xc'),_0x1d2913,_0x1099e5);_0x3db36e(_0x1099e5);});});}exports[_0x4117('0x16')]=function(_0x5a1d29){var _0x5b2f70=this;return new Promise(function(_0x47c017,_0x54554e){return db['FaxQueueReport']['create'](_0x5a1d29[_0x4117('0x17')],{'raw':_0x5a1d29[_0x4117('0x18')]?_0x5a1d29[_0x4117('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x4117('0xa')](function(_0x391920){logger['info'](_0x4117('0x16'),_0x5a1d29);logger[_0x4117('0xe')](_0x4117('0x16'),_0x5a1d29,JSON['stringify'](_0x391920));_0x47c017(_0x391920);})['catch'](function(_0x13e504){logger[_0x4117('0x11')]('CreateFaxQueueReport',_0x13e504[_0x4117('0x13')],_0x5a1d29);_0x54554e(_0x5b2f70[_0x4117('0x11')](0x1f4,_0x13e504['message']));});});};exports[_0x4117('0x19')]=function(_0x4964ee){var _0x54b0d7=this;return new Promise(function(_0x58c97c,_0x444d77){return db[_0x4117('0x1a')][_0x4117('0x1b')](_0x4964ee[_0x4117('0x17')],{'raw':_0x4964ee[_0x4117('0x18')]?_0x4964ee['options'][_0x4117('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4964ee[_0x4117('0x18')]?_0x4964ee[_0x4117('0x18')][_0x4117('0x1d')]||null:null,'attributes':_0x4964ee[_0x4117('0x18')]?_0x4964ee[_0x4117('0x18')][_0x4117('0x1e')]||null:null,'limit':_0x4964ee[_0x4117('0x18')]?_0x4964ee[_0x4117('0x18')][_0x4117('0x1f')]||null:null})[_0x4117('0xa')](function(_0x34b580){logger[_0x4117('0xb')](_0x4117('0x19'),_0x4964ee);logger[_0x4117('0xe')](_0x4117('0x19'),_0x4964ee,JSON[_0x4117('0x10')](_0x34b580));_0x58c97c(_0x34b580);})['catch'](function(_0x2e211d){logger[_0x4117('0x11')](_0x4117('0x19'),_0x2e211d['message'],_0x4964ee);_0x444d77(_0x54b0d7[_0x4117('0x11')](0x1f4,_0x2e211d[_0x4117('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index a60d1a8..c609948 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 _0xc89a=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','/describe','isAuthenticated','describe','/:id','show','post','create','update','delete','destroy'];(function(_0x1896b8,_0x350017){var _0x3d34df=function(_0x43d9d7){while(--_0x43d9d7){_0x1896b8['push'](_0x1896b8['shift']());}};_0x3d34df(++_0x350017);}(_0xc89a,0x1a3));var _0xac89=function(_0x464f3b,_0x5c5db2){_0x464f3b=_0x464f3b-0x0;var _0x5e861d=_0xc89a[_0x464f3b];return _0x5e861d;};'use strict';var multer=require(_0xac89('0x0'));var util=require(_0xac89('0x1'));var path=require(_0xac89('0x2'));var timeout=require(_0xac89('0x3'));var express=require(_0xac89('0x4'));var router=express[_0xac89('0x5')]();var fs_extra=require(_0xac89('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xac89('0x7'));var config=require(_0xac89('0x8'));var controller=require(_0xac89('0x9'));router[_0xac89('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0xac89('0xa')](_0xac89('0xb'),auth[_0xac89('0xc')](),controller[_0xac89('0xd')]);router[_0xac89('0xa')](_0xac89('0xe'),auth[_0xac89('0xc')](),controller[_0xac89('0xf')]);router[_0xac89('0x10')]('/',auth[_0xac89('0xc')](),controller[_0xac89('0x11')]);router['put'](_0xac89('0xe'),auth['isAuthenticated'](),controller[_0xac89('0x12')]);router[_0xac89('0x13')](_0xac89('0xe'),auth[_0xac89('0xc')](),controller[_0xac89('0x14')]);module[_0xac89('0x15')]=router; \ No newline at end of file +var _0xdf5e=['multer','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxQueueReport.controller','get','isAuthenticated','index','describe','/:id','show','put','delete','destroy'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdf5e,0xe0));var _0xedf5=function(_0x12e073,_0x4d43db){_0x12e073=_0x12e073-0x0;var _0x267748=_0xdf5e[_0x12e073];return _0x267748;};'use strict';var multer=require(_0xedf5('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xedf5('0x1'));var router=express[_0xedf5('0x2')]();var fs_extra=require(_0xedf5('0x3'));var auth=require(_0xedf5('0x4'));var interaction=require(_0xedf5('0x5'));var config=require('../../config/environment');var controller=require(_0xedf5('0x6'));router[_0xedf5('0x7')]('/',auth[_0xedf5('0x8')](),controller[_0xedf5('0x9')]);router[_0xedf5('0x7')]('/describe',auth[_0xedf5('0x8')](),controller[_0xedf5('0xa')]);router[_0xedf5('0x7')](_0xedf5('0xb'),auth[_0xedf5('0x8')](),controller[_0xedf5('0xc')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xedf5('0xd')](_0xedf5('0xb'),auth[_0xedf5('0x8')](),controller['update']);router[_0xedf5('0xe')](_0xedf5('0xb'),auth[_0xedf5('0x8')](),controller[_0xedf5('0xf')]);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 dba2b2f..2bfaf54 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 _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x4684af,_0x34880f){var _0x3bb413=function(_0x600b5a){while(--_0x600b5a){_0x4684af['push'](_0x4684af['shift']());}};_0x3bb413(++_0x34880f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xa9e0[_0x21aec3];return _0x288bbc;};'use strict';var moment=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'agent',_0x0a9e('0x4')),'allowNull':![],'defaultValue':_0x0a9e('0x4')},'transferredAt':{'type':Sequelize[_0x0a9e('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x0a9e('0x6')]}}; \ No newline at end of file +var _0x9bde=['NOW','sequelize','STRING','account','agent','queue','DATE'];(function(_0x152449,_0x49f41d){var _0x5b58b2=function(_0x226c30){while(--_0x226c30){_0x152449['push'](_0x152449['shift']());}};_0x5b58b2(++_0x49f41d);}(_0x9bde,0xe1));var _0xe9bd=function(_0x346a71,_0x1310c4){_0x346a71=_0x346a71-0x0;var _0x5a4f72=_0x9bde[_0x346a71];return _0x5a4f72;};'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/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 232e0e2..5eec0c3 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 _0x09e1=['status','end','json','offset','undefined','limit','count','set','apply','update','then','error','stack','name','index','map','FaxTransferReport','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','include','findAll','catch','show','params','keys','fields','includeAll','find','create','body','destroy','describe','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x31e9e2,_0x1445c7){var _0x4728c1=function(_0x456d6c){while(--_0x456d6c){_0x31e9e2['push'](_0x31e9e2['shift']());}};_0x4728c1(++_0x1445c7);}(_0x09e1,0x7b));var _0x109e=function(_0xd0fc05,_0x367594){_0xd0fc05=_0xd0fc05-0x0;var _0x5818ad=_0x09e1[_0xd0fc05];return _0x5818ad;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x109e('0x0'));var jsonpatch=require(_0x109e('0x1'));var rp=require('request-promise');var moment=require(_0x109e('0x2'));var BPromise=require(_0x109e('0x3'));var Mustache=require(_0x109e('0x4'));var util=require(_0x109e('0x5'));var path=require(_0x109e('0x6'));var sox=require(_0x109e('0x7'));var csv=require(_0x109e('0x8'));var ejs=require(_0x109e('0x9'));var fs=require('fs');var fs_extra=require(_0x109e('0xa'));var _=require(_0x109e('0xb'));var squel=require(_0x109e('0xc'));var crypto=require(_0x109e('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x109e('0xe'));var toCsv=require('to-csv');var querystring=require(_0x109e('0xf'));var Papa=require(_0x109e('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x109e('0x11'));var as=require(_0x109e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x109e('0x13'))(_0x109e('0x14'));var utils=require('../../config/utils');var config=require(_0x109e('0x15'));var licenseUtil=require(_0x109e('0x16'));var db=require(_0x109e('0x17'))['db'];function respondWithStatusCode(_0x2192eb,_0x522ce9){_0x522ce9=_0x522ce9||0xcc;return function(_0x1c7b83){if(_0x1c7b83){return _0x2192eb[_0x109e('0x18')](_0x522ce9);}return _0x2192eb[_0x109e('0x19')](_0x522ce9)[_0x109e('0x1a')]();};}function respondWithResult(_0xf93a7e,_0x202825){_0x202825=_0x202825||0xc8;return function(_0x24ca02){if(_0x24ca02){return _0xf93a7e[_0x109e('0x19')](_0x202825)[_0x109e('0x1b')](_0x24ca02);}};}function respondWithFilteredResult(_0x5dc47a,_0x1546ef){return function(_0x48b6e1){if(_0x48b6e1){var _0x4afe8e=typeof _0x1546ef[_0x109e('0x1c')]===_0x109e('0x1d')&&typeof _0x1546ef[_0x109e('0x1e')]===_0x109e('0x1d');var _0x29bf6b=_0x48b6e1[_0x109e('0x1f')];var _0xffc19=_0x4afe8e?0x0:_0x1546ef[_0x109e('0x1c')];var _0x1d97b6=_0x4afe8e?_0x48b6e1[_0x109e('0x1f')]:_0x1546ef['offset']+_0x1546ef[_0x109e('0x1e')];var _0x52be15;if(_0x1d97b6>=_0x29bf6b){_0x1d97b6=_0x29bf6b;_0x52be15=0xc8;}else{_0x52be15=0xce;}_0x5dc47a[_0x109e('0x19')](_0x52be15);return _0x5dc47a[_0x109e('0x20')]('Content-Range',_0xffc19+'-'+_0x1d97b6+'/'+_0x29bf6b)[_0x109e('0x1b')](_0x48b6e1);}return null;};}function patchUpdates(_0x2a6700){return function(_0x312389){try{jsonpatch[_0x109e('0x21')](_0x312389,_0x2a6700,!![]);}catch(_0x10691a){return BPromise['reject'](_0x10691a);}return _0x312389['save']();};}function saveUpdates(_0x38fbc6,_0x3ad154){return function(_0x41ebbb){if(_0x41ebbb){return _0x41ebbb[_0x109e('0x22')](_0x38fbc6)[_0x109e('0x23')](function(_0x2f4c5d){return _0x2f4c5d;});}return null;};}function removeEntity(_0x3bfe70,_0x35036b){return function(_0x3ab336){if(_0x3ab336){return _0x3ab336['destroy']()[_0x109e('0x23')](function(){_0x3bfe70[_0x109e('0x19')](0xcc)[_0x109e('0x1a')]();});}};}function handleEntityNotFound(_0x5be022,_0x4cccb8){return function(_0x750e90){if(!_0x750e90){_0x5be022[_0x109e('0x18')](0x194);}return _0x750e90;};}function handleError(_0x33be40,_0x2f2dfe){_0x2f2dfe=_0x2f2dfe||0x1f4;return function(_0x19047c){logger[_0x109e('0x24')](_0x19047c[_0x109e('0x25')]);if(_0x19047c[_0x109e('0x26')]){delete _0x19047c['name'];}_0x33be40[_0x109e('0x19')](_0x2f2dfe)['send'](_0x19047c);};}exports[_0x109e('0x27')]=function(_0x56ebf5,_0x42d17b){var _0x527225={},_0x5e00a3={},_0x5bb4b5={'count':0x0,'rows':[]};var _0x1f9b62=_[_0x109e('0x28')](db[_0x109e('0x29')][_0x109e('0x2a')],function(_0x2c0433){return{'name':_0x2c0433[_0x109e('0x2b')],'type':_0x2c0433[_0x109e('0x2c')]['key']};});_0x5e00a3[_0x109e('0x2d')]=_[_0x109e('0x28')](_0x1f9b62,'name');_0x5e00a3[_0x109e('0x2e')]=_['keys'](_0x56ebf5[_0x109e('0x2e')]);_0x5e00a3[_0x109e('0x2f')]=_[_0x109e('0x30')](_0x5e00a3[_0x109e('0x2d')],_0x5e00a3[_0x109e('0x2e')]);_0x527225[_0x109e('0x31')]=_[_0x109e('0x30')](_0x5e00a3[_0x109e('0x2d')],qs['fields'](_0x56ebf5[_0x109e('0x2e')]['fields']));_0x527225[_0x109e('0x31')]=_0x527225[_0x109e('0x31')][_0x109e('0x32')]?_0x527225['attributes']:_0x5e00a3[_0x109e('0x2d')];if(!_0x56ebf5[_0x109e('0x2e')][_0x109e('0x33')](_0x109e('0x34'))){_0x527225[_0x109e('0x1e')]=qs[_0x109e('0x1e')](_0x56ebf5[_0x109e('0x2e')][_0x109e('0x1e')]);_0x527225[_0x109e('0x1c')]=qs[_0x109e('0x1c')](_0x56ebf5[_0x109e('0x2e')][_0x109e('0x1c')]);}_0x527225[_0x109e('0x35')]=qs[_0x109e('0x36')](_0x56ebf5[_0x109e('0x2e')][_0x109e('0x36')]);_0x527225['where']=qs[_0x109e('0x2f')](_[_0x109e('0x37')](_0x56ebf5[_0x109e('0x2e')],_0x5e00a3['filters']),_0x1f9b62);if(_0x56ebf5[_0x109e('0x2e')][_0x109e('0x38')]){_0x527225[_0x109e('0x39')]=_['merge'](_0x527225['where'],{'$or':_[_0x109e('0x28')](_0x1f9b62,function(_0x20c95f){if(_0x20c95f['type']!==_0x109e('0x3a')){var _0x2ef322={};_0x2ef322[_0x20c95f[_0x109e('0x26')]]={'$like':'%'+_0x56ebf5[_0x109e('0x2e')][_0x109e('0x38')]+'%'};return _0x2ef322;}})});}_0x527225=_[_0x109e('0x3b')]({},_0x527225,_0x56ebf5[_0x109e('0x3c')]);var _0x4c13a6={'where':_0x527225['where']};return db[_0x109e('0x29')]['count'](_0x4c13a6)[_0x109e('0x23')](function(_0xc153f){_0x5bb4b5[_0x109e('0x1f')]=_0xc153f;if(_0x56ebf5['query']['includeAll']){_0x527225[_0x109e('0x3d')]=[{'all':!![]}];}return db[_0x109e('0x29')][_0x109e('0x3e')](_0x527225);})[_0x109e('0x23')](function(_0x369a3f){_0x5bb4b5['rows']=_0x369a3f;return _0x5bb4b5;})['then'](respondWithFilteredResult(_0x42d17b,_0x527225))[_0x109e('0x3f')](handleError(_0x42d17b,null));};exports[_0x109e('0x40')]=function(_0x11e330,_0x5313c8){var _0x294b0d={'raw':!![],'where':{'id':_0x11e330[_0x109e('0x41')]['id']}},_0x3b3fef={};_0x3b3fef[_0x109e('0x2d')]=_[_0x109e('0x42')](db['FaxTransferReport'][_0x109e('0x2a')]);_0x3b3fef['query']=_[_0x109e('0x42')](_0x11e330[_0x109e('0x2e')]);_0x3b3fef[_0x109e('0x2f')]=_['intersection'](_0x3b3fef[_0x109e('0x2d')],_0x3b3fef[_0x109e('0x2e')]);_0x294b0d[_0x109e('0x31')]=_[_0x109e('0x30')](_0x3b3fef['model'],qs[_0x109e('0x43')](_0x11e330['query']['fields']));_0x294b0d[_0x109e('0x31')]=_0x294b0d[_0x109e('0x31')][_0x109e('0x32')]?_0x294b0d[_0x109e('0x31')]:_0x3b3fef['model'];if(_0x11e330['query'][_0x109e('0x44')]){_0x294b0d[_0x109e('0x3d')]=[{'all':!![]}];}_0x294b0d=_[_0x109e('0x3b')]({},_0x294b0d,_0x11e330[_0x109e('0x3c')]);return db[_0x109e('0x29')][_0x109e('0x45')](_0x294b0d)[_0x109e('0x23')](handleEntityNotFound(_0x5313c8,null))['then'](respondWithResult(_0x5313c8,null))[_0x109e('0x3f')](handleError(_0x5313c8,null));};exports[_0x109e('0x46')]=function(_0x2d77ea,_0x2c56da){return db[_0x109e('0x29')][_0x109e('0x46')](_0x2d77ea[_0x109e('0x47')],{})[_0x109e('0x23')](respondWithResult(_0x2c56da,0xc9))[_0x109e('0x3f')](handleError(_0x2c56da,null));};exports['update']=function(_0x53a1c8,_0x1404dc){if(_0x53a1c8[_0x109e('0x47')]['id']){delete _0x53a1c8[_0x109e('0x47')]['id'];}return db[_0x109e('0x29')][_0x109e('0x45')]({'where':{'id':_0x53a1c8[_0x109e('0x41')]['id']}})[_0x109e('0x23')](handleEntityNotFound(_0x1404dc,null))[_0x109e('0x23')](saveUpdates(_0x53a1c8[_0x109e('0x47')],null))['then'](respondWithResult(_0x1404dc,null))[_0x109e('0x3f')](handleError(_0x1404dc,null));};exports[_0x109e('0x48')]=function(_0x55374b,_0xc9d558){return db[_0x109e('0x29')][_0x109e('0x45')]({'where':{'id':_0x55374b['params']['id']}})[_0x109e('0x23')](handleEntityNotFound(_0xc9d558,null))['then'](removeEntity(_0xc9d558,null))[_0x109e('0x3f')](handleError(_0xc9d558,null));};exports[_0x109e('0x49')]=function(_0x4cf0b8,_0x120f69){return db[_0x109e('0x29')][_0x109e('0x49')]()[_0x109e('0x23')](respondWithResult(_0x120f69,null))[_0x109e('0x3f')](handleError(_0x120f69,null));}; \ No newline at end of file +var _0xdb8b=['squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','limit','undefined','count','set','reject','destroy','end','error','stack','send','index','FaxTransferReport','type','key','map','name','keys','query','filters','intersection','attributes','model','fields','length','nolimit','offset','sort','where','filter','merge','VIRTUAL','options','then','includeAll','include','findAll','rows','catch','show','params','find','create','body','update','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','fs-extra','lodash'];(function(_0x3d0177,_0x5c98b1){var _0x47e974=function(_0x37b219){while(--_0x37b219){_0x3d0177['push'](_0x3d0177['shift']());}};_0x47e974(++_0x5c98b1);}(_0xdb8b,0x158));var _0xbdb8=function(_0x1b9a8b,_0x18eda6){_0x1b9a8b=_0x1b9a8b-0x0;var _0x2c7c7b=_0xdb8b[_0x1b9a8b];return _0x2c7c7b;};'use strict';var emlformat=require(_0xbdb8('0x0'));var rimraf=require(_0xbdb8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbdb8('0x2'));var rp=require(_0xbdb8('0x3'));var moment=require(_0xbdb8('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xbdb8('0x5'));var util=require('util');var path=require(_0xbdb8('0x6'));var sox=require(_0xbdb8('0x7'));var csv=require(_0xbdb8('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbdb8('0x9'));var _=require(_0xbdb8('0xa'));var squel=require(_0xbdb8('0xb'));var crypto=require(_0xbdb8('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xbdb8('0xd'));var toCsv=require(_0xbdb8('0x8'));var querystring=require('querystring');var Papa=require(_0xbdb8('0xe'));var Redis=require(_0xbdb8('0xf'));var authService=require(_0xbdb8('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbdb8('0x11'));var logger=require(_0xbdb8('0x12'))(_0xbdb8('0x13'));var utils=require(_0xbdb8('0x14'));var config=require(_0xbdb8('0x15'));var licenseUtil=require(_0xbdb8('0x16'));var db=require(_0xbdb8('0x17'))['db'];function respondWithStatusCode(_0x827adf,_0x4ff21d){_0x4ff21d=_0x4ff21d||0xcc;return function(_0xcfd5f8){if(_0xcfd5f8){return _0x827adf[_0xbdb8('0x18')](_0x4ff21d);}return _0x827adf['status'](_0x4ff21d)['end']();};}function respondWithResult(_0x1bd85b,_0x213f38){_0x213f38=_0x213f38||0xc8;return function(_0x501d4e){if(_0x501d4e){return _0x1bd85b[_0xbdb8('0x19')](_0x213f38)['json'](_0x501d4e);}};}function respondWithFilteredResult(_0x584efc,_0x38d1ad){return function(_0x5d149d){if(_0x5d149d){var _0x4deec0=typeof _0x38d1ad['offset']==='undefined'&&typeof _0x38d1ad[_0xbdb8('0x1a')]===_0xbdb8('0x1b');var _0x32fd56=_0x5d149d[_0xbdb8('0x1c')];var _0x41ce30=_0x4deec0?0x0:_0x38d1ad['offset'];var _0x2f816d=_0x4deec0?_0x5d149d[_0xbdb8('0x1c')]:_0x38d1ad['offset']+_0x38d1ad[_0xbdb8('0x1a')];var _0x26a7d5;if(_0x2f816d>=_0x32fd56){_0x2f816d=_0x32fd56;_0x26a7d5=0xc8;}else{_0x26a7d5=0xce;}_0x584efc['status'](_0x26a7d5);return _0x584efc[_0xbdb8('0x1d')]('Content-Range',_0x41ce30+'-'+_0x2f816d+'/'+_0x32fd56)['json'](_0x5d149d);}return null;};}function patchUpdates(_0x4e6284){return function(_0x1a5748){try{jsonpatch['apply'](_0x1a5748,_0x4e6284,!![]);}catch(_0x348115){return BPromise[_0xbdb8('0x1e')](_0x348115);}return _0x1a5748['save']();};}function saveUpdates(_0x56ef82,_0x562994){return function(_0x4d4f76){if(_0x4d4f76){return _0x4d4f76['update'](_0x56ef82)['then'](function(_0x313b92){return _0x313b92;});}return null;};}function removeEntity(_0x56a28f,_0x84772e){return function(_0x39f3a3){if(_0x39f3a3){return _0x39f3a3[_0xbdb8('0x1f')]()['then'](function(){_0x56a28f[_0xbdb8('0x19')](0xcc)[_0xbdb8('0x20')]();});}};}function handleEntityNotFound(_0x5ac580,_0x1ddbba){return function(_0x229b98){if(!_0x229b98){_0x5ac580[_0xbdb8('0x18')](0x194);}return _0x229b98;};}function handleError(_0x3bf920,_0x5859e6){_0x5859e6=_0x5859e6||0x1f4;return function(_0x2f5707){logger[_0xbdb8('0x21')](_0x2f5707[_0xbdb8('0x22')]);if(_0x2f5707['name']){delete _0x2f5707['name'];}_0x3bf920[_0xbdb8('0x19')](_0x5859e6)[_0xbdb8('0x23')](_0x2f5707);};}exports[_0xbdb8('0x24')]=function(_0x48fb37,_0x373b42){var _0xdc8adb={},_0x276fee={},_0x62d988={'count':0x0,'rows':[]};var _0x4610ba=_['map'](db[_0xbdb8('0x25')]['rawAttributes'],function(_0xfd44b){return{'name':_0xfd44b['fieldName'],'type':_0xfd44b[_0xbdb8('0x26')][_0xbdb8('0x27')]};});_0x276fee['model']=_[_0xbdb8('0x28')](_0x4610ba,_0xbdb8('0x29'));_0x276fee['query']=_[_0xbdb8('0x2a')](_0x48fb37[_0xbdb8('0x2b')]);_0x276fee[_0xbdb8('0x2c')]=_[_0xbdb8('0x2d')](_0x276fee['model'],_0x276fee[_0xbdb8('0x2b')]);_0xdc8adb[_0xbdb8('0x2e')]=_['intersection'](_0x276fee[_0xbdb8('0x2f')],qs[_0xbdb8('0x30')](_0x48fb37[_0xbdb8('0x2b')][_0xbdb8('0x30')]));_0xdc8adb[_0xbdb8('0x2e')]=_0xdc8adb[_0xbdb8('0x2e')][_0xbdb8('0x31')]?_0xdc8adb[_0xbdb8('0x2e')]:_0x276fee['model'];if(!_0x48fb37[_0xbdb8('0x2b')]['hasOwnProperty'](_0xbdb8('0x32'))){_0xdc8adb[_0xbdb8('0x1a')]=qs[_0xbdb8('0x1a')](_0x48fb37['query'][_0xbdb8('0x1a')]);_0xdc8adb['offset']=qs['offset'](_0x48fb37[_0xbdb8('0x2b')][_0xbdb8('0x33')]);}_0xdc8adb['order']=qs[_0xbdb8('0x34')](_0x48fb37[_0xbdb8('0x2b')][_0xbdb8('0x34')]);_0xdc8adb[_0xbdb8('0x35')]=qs[_0xbdb8('0x2c')](_['pick'](_0x48fb37['query'],_0x276fee['filters']),_0x4610ba);if(_0x48fb37['query'][_0xbdb8('0x36')]){_0xdc8adb[_0xbdb8('0x35')]=_[_0xbdb8('0x37')](_0xdc8adb[_0xbdb8('0x35')],{'$or':_[_0xbdb8('0x28')](_0x4610ba,function(_0xbf924c){if(_0xbf924c['type']!==_0xbdb8('0x38')){var _0x52ae2a={};_0x52ae2a[_0xbf924c[_0xbdb8('0x29')]]={'$like':'%'+_0x48fb37['query']['filter']+'%'};return _0x52ae2a;}})});}_0xdc8adb=_['merge']({},_0xdc8adb,_0x48fb37[_0xbdb8('0x39')]);var _0x1037ec={'where':_0xdc8adb[_0xbdb8('0x35')]};return db['FaxTransferReport'][_0xbdb8('0x1c')](_0x1037ec)[_0xbdb8('0x3a')](function(_0x480e99){_0x62d988['count']=_0x480e99;if(_0x48fb37[_0xbdb8('0x2b')][_0xbdb8('0x3b')]){_0xdc8adb[_0xbdb8('0x3c')]=[{'all':!![]}];}return db[_0xbdb8('0x25')][_0xbdb8('0x3d')](_0xdc8adb);})[_0xbdb8('0x3a')](function(_0x6a2be9){_0x62d988[_0xbdb8('0x3e')]=_0x6a2be9;return _0x62d988;})['then'](respondWithFilteredResult(_0x373b42,_0xdc8adb))[_0xbdb8('0x3f')](handleError(_0x373b42,null));};exports[_0xbdb8('0x40')]=function(_0x2f742f,_0x242ae3){var _0x510b53={'raw':!![],'where':{'id':_0x2f742f[_0xbdb8('0x41')]['id']}},_0x450831={};_0x450831['model']=_['keys'](db['FaxTransferReport']['rawAttributes']);_0x450831[_0xbdb8('0x2b')]=_[_0xbdb8('0x2a')](_0x2f742f[_0xbdb8('0x2b')]);_0x450831[_0xbdb8('0x2c')]=_[_0xbdb8('0x2d')](_0x450831[_0xbdb8('0x2f')],_0x450831[_0xbdb8('0x2b')]);_0x510b53['attributes']=_[_0xbdb8('0x2d')](_0x450831[_0xbdb8('0x2f')],qs[_0xbdb8('0x30')](_0x2f742f['query'][_0xbdb8('0x30')]));_0x510b53[_0xbdb8('0x2e')]=_0x510b53[_0xbdb8('0x2e')][_0xbdb8('0x31')]?_0x510b53['attributes']:_0x450831['model'];if(_0x2f742f['query'][_0xbdb8('0x3b')]){_0x510b53[_0xbdb8('0x3c')]=[{'all':!![]}];}_0x510b53=_[_0xbdb8('0x37')]({},_0x510b53,_0x2f742f[_0xbdb8('0x39')]);return db['FaxTransferReport'][_0xbdb8('0x42')](_0x510b53)[_0xbdb8('0x3a')](handleEntityNotFound(_0x242ae3,null))[_0xbdb8('0x3a')](respondWithResult(_0x242ae3,null))[_0xbdb8('0x3f')](handleError(_0x242ae3,null));};exports[_0xbdb8('0x43')]=function(_0x3cfc7d,_0x3d2562){return db[_0xbdb8('0x25')]['create'](_0x3cfc7d[_0xbdb8('0x44')],{})[_0xbdb8('0x3a')](respondWithResult(_0x3d2562,0xc9))[_0xbdb8('0x3f')](handleError(_0x3d2562,null));};exports[_0xbdb8('0x45')]=function(_0x5c2c0a,_0x281795){if(_0x5c2c0a[_0xbdb8('0x44')]['id']){delete _0x5c2c0a[_0xbdb8('0x44')]['id'];}return db[_0xbdb8('0x25')][_0xbdb8('0x42')]({'where':{'id':_0x5c2c0a[_0xbdb8('0x41')]['id']}})[_0xbdb8('0x3a')](handleEntityNotFound(_0x281795,null))[_0xbdb8('0x3a')](saveUpdates(_0x5c2c0a[_0xbdb8('0x44')],null))['then'](respondWithResult(_0x281795,null))[_0xbdb8('0x3f')](handleError(_0x281795,null));};exports[_0xbdb8('0x1f')]=function(_0x31dcbb,_0x2d485b){return db['FaxTransferReport'][_0xbdb8('0x42')]({'where':{'id':_0x31dcbb['params']['id']}})[_0xbdb8('0x3a')](handleEntityNotFound(_0x2d485b,null))['then'](removeEntity(_0x2d485b,null))[_0xbdb8('0x3f')](handleError(_0x2d485b,null));};exports[_0xbdb8('0x46')]=function(_0x5768cc,_0x1de2ec){return db[_0xbdb8('0x25')][_0xbdb8('0x46')]()[_0xbdb8('0x3a')](respondWithResult(_0x1de2ec,null))[_0xbdb8('0x3f')](handleError(_0x1de2ec,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index f7bd820..dc92813 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 _0xbae8=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./faxTransferReport.attributes','exports','define','FaxTransferReport','report_fax_transfer','lodash'];(function(_0xf8821a,_0x140c15){var _0x35da95=function(_0x225a49){while(--_0x225a49){_0xf8821a['push'](_0xf8821a['shift']());}};_0x35da95(++_0x140c15);}(_0xbae8,0x195));var _0x8bae=function(_0x12a2a6,_0x374ff1){_0x12a2a6=_0x12a2a6-0x0;var _0x1754ae=_0xbae8[_0x12a2a6];return _0x1754ae;};'use strict';var _=require(_0x8bae('0x0'));var util=require(_0x8bae('0x1'));var logger=require(_0x8bae('0x2'))(_0x8bae('0x3'));var moment=require('moment');var BPromise=require(_0x8bae('0x4'));var rp=require(_0x8bae('0x5'));var fs=require('fs');var path=require(_0x8bae('0x6'));var rimraf=require(_0x8bae('0x7'));var config=require(_0x8bae('0x8'));var attributes=require(_0x8bae('0x9'));module[_0x8bae('0xa')]=function(_0x55c816,_0x4d13fa){return _0x55c816[_0x8bae('0xb')](_0x8bae('0xc'),attributes,{'tableName':_0x8bae('0xd'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xc281=['util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./faxTransferReport.attributes','exports','define','report_fax_transfer','uniqueid'];(function(_0x53a829,_0x508637){var _0x46d9d9=function(_0x46f72d){while(--_0x46f72d){_0x53a829['push'](_0x53a829['shift']());}};_0x46d9d9(++_0x508637);}(_0xc281,0x1c7));var _0x1c28=function(_0x180293,_0x28e631){_0x180293=_0x180293-0x0;var _0x12dd33=_0xc281[_0x180293];return _0x12dd33;};'use strict';var _=require('lodash');var util=require(_0x1c28('0x0'));var logger=require(_0x1c28('0x1'))(_0x1c28('0x2'));var moment=require(_0x1c28('0x3'));var BPromise=require(_0x1c28('0x4'));var rp=require(_0x1c28('0x5'));var fs=require('fs');var path=require(_0x1c28('0x6'));var rimraf=require('rimraf');var config=require(_0x1c28('0x7'));var attributes=require(_0x1c28('0x8'));module[_0x1c28('0x9')]=function(_0x4bc56d,_0x71e150){return _0x4bc56d[_0x1c28('0xa')]('FaxTransferReport',attributes,{'tableName':_0x1c28('0xb'),'paranoid':![],'indexes':[{'name':_0x1c28('0xc'),'fields':[_0x1c28('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 969b46e..50deb85 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 _0xb80e=['debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FaxTransferReport,\x20%s,\x20%s','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','then','info','request\x20sent'];(function(_0x4e6ae6,_0x49dba6){var _0x23c108=function(_0x1bc103){while(--_0x1bc103){_0x4e6ae6['push'](_0x4e6ae6['shift']());}};_0x23c108(++_0x49dba6);}(_0xb80e,0x9b));var _0xeb80=function(_0x3732ed,_0x279d0a){_0x3732ed=_0x3732ed-0x0;var _0x55844c=_0xb80e[_0x3732ed];return _0x55844c;};'use strict';var _=require('lodash');var util=require(_0xeb80('0x0'));var moment=require(_0xeb80('0x1'));var BPromise=require(_0xeb80('0x2'));var rs=require(_0xeb80('0x3'));var fs=require('fs');var Redis=require(_0xeb80('0x4'));var db=require(_0xeb80('0x5'))['db'];var utils=require(_0xeb80('0x6'));var logger=require('../../config/logger')(_0xeb80('0x7'));var config=require('../../config/environment');var jayson=require(_0xeb80('0x8'));var client=jayson['client'][_0xeb80('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2f4f84,_0x30b682,_0xdb286e){return new BPromise(function(_0x3a6878,_0xa1ac05){return client['request'](_0x2f4f84,_0xdb286e)[_0xeb80('0xa')](function(_0x822fef){logger[_0xeb80('0xb')]('FaxTransferReport,\x20%s,\x20%s',_0x30b682,_0xeb80('0xc'));logger[_0xeb80('0xd')](_0xeb80('0xe'),_0x30b682,'request\x20sent',JSON[_0xeb80('0xf')](_0x822fef));if(_0x822fef[_0xeb80('0x10')]){if(_0x822fef[_0xeb80('0x10')][_0xeb80('0x11')]===0x1f4){logger[_0xeb80('0x10')]('FaxTransferReport,\x20%s,\x20%s',_0x30b682,_0x822fef[_0xeb80('0x10')][_0xeb80('0x12')]);return _0xa1ac05(_0x822fef[_0xeb80('0x10')][_0xeb80('0x12')]);}logger[_0xeb80('0x10')](_0xeb80('0x13'),_0x30b682,_0x822fef[_0xeb80('0x10')][_0xeb80('0x12')]);return _0x3a6878(_0x822fef[_0xeb80('0x10')][_0xeb80('0x12')]);}else{logger['info'](_0xeb80('0x13'),_0x30b682,_0xeb80('0xc'));_0x3a6878(_0x822fef['result'][_0xeb80('0x12')]);}})[_0xeb80('0x14')](function(_0x221e67){logger[_0xeb80('0x10')](_0xeb80('0x13'),_0x30b682,_0x221e67);_0xa1ac05(_0x221e67);});});} \ No newline at end of file +var _0xd6db=['../../config/environment','client','request','info','FaxTransferReport,\x20%s,\x20%s','FaxTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xd6db,0x186));var _0xbd6d=function(_0x2ea0fb,_0xd9bdcf){_0x2ea0fb=_0x2ea0fb-0x0;var _0x3ee61f=_0xd6db[_0x2ea0fb];return _0x3ee61f;};'use strict';var _=require(_0xbd6d('0x0'));var util=require(_0xbd6d('0x1'));var moment=require(_0xbd6d('0x2'));var BPromise=require(_0xbd6d('0x3'));var rs=require(_0xbd6d('0x4'));var fs=require('fs');var Redis=require(_0xbd6d('0x5'));var db=require(_0xbd6d('0x6'))['db'];var utils=require(_0xbd6d('0x7'));var logger=require(_0xbd6d('0x8'))(_0xbd6d('0x9'));var config=require(_0xbd6d('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xbd6d('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x26fd1f,_0x48e2e6,_0x5f3b64){return new BPromise(function(_0x5d663c,_0x16a856){return client[_0xbd6d('0xc')](_0x26fd1f,_0x5f3b64)['then'](function(_0x32a983){logger[_0xbd6d('0xd')](_0xbd6d('0xe'),_0x48e2e6,'request\x20sent');logger['debug'](_0xbd6d('0xf'),_0x48e2e6,_0xbd6d('0x10'),JSON['stringify'](_0x32a983));if(_0x32a983[_0xbd6d('0x11')]){if(_0x32a983[_0xbd6d('0x11')]['code']===0x1f4){logger[_0xbd6d('0x11')]('FaxTransferReport,\x20%s,\x20%s',_0x48e2e6,_0x32a983['error'][_0xbd6d('0x12')]);return _0x16a856(_0x32a983[_0xbd6d('0x11')][_0xbd6d('0x12')]);}logger[_0xbd6d('0x11')](_0xbd6d('0xe'),_0x48e2e6,_0x32a983[_0xbd6d('0x11')][_0xbd6d('0x12')]);return _0x5d663c(_0x32a983[_0xbd6d('0x11')][_0xbd6d('0x12')]);}else{logger[_0xbd6d('0xd')](_0xbd6d('0xe'),_0x48e2e6,_0xbd6d('0x10'));_0x5d663c(_0x32a983[_0xbd6d('0x13')][_0xbd6d('0x12')]);}})['catch'](function(_0x25509c){logger['error'](_0xbd6d('0xe'),_0x48e2e6,_0x25509c);_0x16a856(_0x25509c);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index abf8029..1492ec0 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 _0xafb7=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout'];(function(_0x2e529c,_0x376e88){var _0x195cba=function(_0x1dfe82){while(--_0x1dfe82){_0x2e529c['push'](_0x2e529c['shift']());}};_0x195cba(++_0x376e88);}(_0xafb7,0x13e));var _0x7afb=function(_0x20267c,_0x325024){_0x20267c=_0x20267c-0x0;var _0x3143ba=_0xafb7[_0x20267c];return _0x3143ba;};'use strict';var multer=require(_0x7afb('0x0'));var util=require(_0x7afb('0x1'));var path=require(_0x7afb('0x2'));var timeout=require(_0x7afb('0x3'));var express=require(_0x7afb('0x4'));var router=express[_0x7afb('0x5')]();var fs_extra=require(_0x7afb('0x6'));var auth=require(_0x7afb('0x7'));var interaction=require(_0x7afb('0x8'));var config=require(_0x7afb('0x9'));var controller=require('./faxTransferReport.controller');router[_0x7afb('0xa')]('/',auth[_0x7afb('0xb')](),controller[_0x7afb('0xc')]);router[_0x7afb('0xa')](_0x7afb('0xd'),auth[_0x7afb('0xb')](),controller[_0x7afb('0xe')]);router['get'](_0x7afb('0xf'),auth[_0x7afb('0xb')](),controller[_0x7afb('0x10')]);router[_0x7afb('0x11')]('/',auth[_0x7afb('0xb')](),controller[_0x7afb('0x12')]);router[_0x7afb('0x13')](_0x7afb('0xf'),auth[_0x7afb('0xb')](),controller[_0x7afb('0x14')]);router['delete'](_0x7afb('0xf'),auth[_0x7afb('0xb')](),controller[_0x7afb('0x15')]);module[_0x7afb('0x16')]=router; \ No newline at end of file +var _0x1675=['express','Router','fs-extra','../../components/auth/service','../../config/environment','./faxTransferReport.controller','get','isAuthenticated','index','/describe','post','delete','/:id','destroy','connect-timeout'];(function(_0x29b609,_0x19d388){var _0x54c952=function(_0xb3c38d){while(--_0xb3c38d){_0x29b609['push'](_0x29b609['shift']());}};_0x54c952(++_0x19d388);}(_0x1675,0xd1));var _0x5167=function(_0x507ecd,_0x217f93){_0x507ecd=_0x507ecd-0x0;var _0x163ed5=_0x1675[_0x507ecd];return _0x163ed5;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x5167('0x0'));var express=require(_0x5167('0x1'));var router=express[_0x5167('0x2')]();var fs_extra=require(_0x5167('0x3'));var auth=require(_0x5167('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x5167('0x5'));var controller=require(_0x5167('0x6'));router[_0x5167('0x7')]('/',auth[_0x5167('0x8')](),controller[_0x5167('0x9')]);router['get'](_0x5167('0xa'),auth[_0x5167('0x8')](),controller['describe']);router[_0x5167('0x7')]('/:id',auth[_0x5167('0x8')](),controller['show']);router[_0x5167('0xb')]('/',auth[_0x5167('0x8')](),controller['create']);router['put']('/:id',auth[_0x5167('0x8')](),controller['update']);router[_0x5167('0xc')](_0x5167('0xd'),auth[_0x5167('0x8')](),controller[_0x5167('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index e41eedb..a0136c4 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 _0x043e=['/:id/fields','getFields','create','addConfiguration','delete','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','isAuthenticated','index','get','/:id','show','/:id/configurations','getConfigurations'];(function(_0x41f36b,_0x3fa688){var _0xfd5df2=function(_0x3197e3){while(--_0x3197e3){_0x41f36b['push'](_0x41f36b['shift']());}};_0xfd5df2(++_0x3fa688);}(_0x043e,0x194));var _0xe043=function(_0x43b539,_0x346844){_0x43b539=_0x43b539-0x0;var _0x47d925=_0x043e[_0x43b539];return _0x47d925;};'use strict';var multer=require('multer');var util=require(_0xe043('0x0'));var path=require('path');var timeout=require(_0xe043('0x1'));var express=require(_0xe043('0x2'));var router=express[_0xe043('0x3')]();var fs_extra=require(_0xe043('0x4'));var auth=require(_0xe043('0x5'));var interaction=require(_0xe043('0x6'));var config=require(_0xe043('0x7'));var controller=require(_0xe043('0x8'));router['get']('/',auth[_0xe043('0x9')](),controller[_0xe043('0xa')]);router[_0xe043('0xb')](_0xe043('0xc'),auth[_0xe043('0x9')](),controller[_0xe043('0xd')]);router[_0xe043('0xb')](_0xe043('0xe'),auth['isAuthenticated'](),controller[_0xe043('0xf')]);router[_0xe043('0xb')](_0xe043('0x10'),auth[_0xe043('0x9')](),controller[_0xe043('0x11')]);router['post']('/',auth[_0xe043('0x9')](),controller[_0xe043('0x12')]);router['post'](_0xe043('0xe'),auth[_0xe043('0x9')](),controller[_0xe043('0x13')]);router['put'](_0xe043('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xe043('0x14')]('/:id',auth[_0xe043('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x8db1=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','isAuthenticated','index','get','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0x8db1,0x185));var _0x18db=function(_0x383552,_0x5db2de){_0x383552=_0x383552-0x0;var _0x338ff7=_0x8db1[_0x383552];return _0x338ff7;};'use strict';var multer=require(_0x18db('0x0'));var util=require(_0x18db('0x1'));var path=require(_0x18db('0x2'));var timeout=require(_0x18db('0x3'));var express=require(_0x18db('0x4'));var router=express[_0x18db('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x18db('0x6'));var interaction=require(_0x18db('0x7'));var config=require(_0x18db('0x8'));var controller=require(_0x18db('0x9'));router['get']('/',auth[_0x18db('0xa')](),controller[_0x18db('0xb')]);router[_0x18db('0xc')](_0x18db('0xd'),auth[_0x18db('0xa')](),controller['show']);router[_0x18db('0xc')](_0x18db('0xe'),auth[_0x18db('0xa')](),controller[_0x18db('0xf')]);router['get'](_0x18db('0x10'),auth[_0x18db('0xa')](),controller[_0x18db('0x11')]);router[_0x18db('0x12')]('/',auth[_0x18db('0xa')](),controller[_0x18db('0x13')]);router[_0x18db('0x12')](_0x18db('0xe'),auth[_0x18db('0xa')](),controller[_0x18db('0x14')]);router[_0x18db('0x15')](_0x18db('0xd'),auth[_0x18db('0xa')](),controller[_0x18db('0x16')]);router[_0x18db('0x17')]('/:id',auth[_0x18db('0xa')](),controller[_0x18db('0x18')]);module[_0x18db('0x19')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 08910d2..b7b2a5b 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 _0x518d=['sequelize','exports','STRING','ENUM','basic','integrationTab','newTab'];(function(_0x34311c,_0x52a317){var _0x4b8b35=function(_0x16888a){while(--_0x16888a){_0x34311c['push'](_0x34311c['shift']());}};_0x4b8b35(++_0x52a317);}(_0x518d,0x1d5));var _0xd518=function(_0x2e1a5a,_0x5e52f1){_0x2e1a5a=_0x2e1a5a-0x0;var _0xb7df2d=_0x518d[_0x2e1a5a];return _0xb7df2d;};'use strict';var Sequelize=require(_0xd518('0x0'));module[_0xd518('0x1')]={'name':{'type':Sequelize[_0xd518('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xd518('0x2')]},'authType':{'type':Sequelize[_0xd518('0x3')](_0xd518('0x4')),'defaultValue':_0xd518('0x4')},'password':{'type':Sequelize[_0xd518('0x2')]},'consumerKey':{'type':Sequelize['STRING']},'consumerSecret':{'type':Sequelize[_0xd518('0x2')]},'token':{'type':Sequelize[_0xd518('0x2')]},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xd518('0x3')](_0xd518('0x5'),_0xd518('0x6')),'defaultValue':_0xd518('0x5')}}; \ No newline at end of file +var _0xca39=['basic','ENUM','integrationTab','sequelize','STRING'];(function(_0x1ee294,_0xbba3f5){var _0x41d205=function(_0x529f07){while(--_0x529f07){_0x1ee294['push'](_0x1ee294['shift']());}};_0x41d205(++_0xbba3f5);}(_0xca39,0xda));var _0x9ca3=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xca39[_0x3bf83f];return _0x22c4a9;};'use strict';var Sequelize=require(_0x9ca3('0x0'));module['exports']={'name':{'type':Sequelize[_0x9ca3('0x1')]},'description':{'type':Sequelize[_0x9ca3('0x1')]},'username':{'type':Sequelize[_0x9ca3('0x1')]},'remoteUri':{'type':Sequelize['STRING']},'authType':{'type':Sequelize['ENUM'](_0x9ca3('0x2')),'defaultValue':_0x9ca3('0x2')},'password':{'type':Sequelize[_0x9ca3('0x1')]},'consumerKey':{'type':Sequelize[_0x9ca3('0x1')]},'consumerSecret':{'type':Sequelize[_0x9ca3('0x1')]},'token':{'type':Sequelize[_0x9ca3('0x1')]},'tokenSecret':{'type':Sequelize[_0x9ca3('0x1')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x9ca3('0x3')](_0x9ca3('0x4'),'newTab'),'defaultValue':_0x9ca3('0x4')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index cf57efb..f8e4edd 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 _0x71a1=['password','consumerKey','consumerSecret','token','tokenSecret','substring','lastIndexOf','GET','format','application/json','basic','headers','Authorization','Basic\x20%s','%s:%s','toString','base64','entries','active','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','count','limit','set','Content-Range','json','apply','save','update','then','destroy','sendStatus','error','stack','name','send','index','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','DeskAccount','findAll','rows','show','includeAll','catch','create','body','params','DeskConfiguration','filter','getConfigurations','addConfiguration','findOne','Subjects','getSubjects','channel','DeskField','Descriptions','getFields','priority','remoteUri','authType'];(function(_0x13f320,_0x4899e6){var _0x16a918=function(_0x3cddab){while(--_0x3cddab){_0x13f320['push'](_0x13f320['shift']());}};_0x16a918(++_0x4899e6);}(_0x71a1,0x8a));var _0x171a=function(_0x3d9d2f,_0x5e1987){_0x3d9d2f=_0x3d9d2f-0x0;var _0x1ac44d=_0x71a1[_0x3d9d2f];return _0x1ac44d;};'use strict';var emlformat=require(_0x171a('0x0'));var rimraf=require(_0x171a('0x1'));var zipdir=require(_0x171a('0x2'));var jsonpatch=require(_0x171a('0x3'));var rp=require(_0x171a('0x4'));var moment=require(_0x171a('0x5'));var BPromise=require(_0x171a('0x6'));var Mustache=require(_0x171a('0x7'));var util=require(_0x171a('0x8'));var path=require('path');var sox=require(_0x171a('0x9'));var csv=require('to-csv');var ejs=require(_0x171a('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x171a('0xb'));var squel=require(_0x171a('0xc'));var crypto=require('crypto');var jsforce=require(_0x171a('0xd'));var deskjs=require(_0x171a('0xe'));var toCsv=require('to-csv');var querystring=require(_0x171a('0xf'));var Papa=require(_0x171a('0x10'));var Redis=require(_0x171a('0x11'));var authService=require(_0x171a('0x12'));var qs=require(_0x171a('0x13'));var as=require(_0x171a('0x14'));var hardwareService=require(_0x171a('0x15'));var logger=require(_0x171a('0x16'))('api');var utils=require(_0x171a('0x17'));var config=require(_0x171a('0x18'));var licenseUtil=require(_0x171a('0x19'));var db=require(_0x171a('0x1a'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x5b1b52,_0x48a39b){_0x48a39b=_0x48a39b||0xcc;return function(_0x2cbbad){if(_0x2cbbad){return _0x5b1b52['sendStatus'](_0x48a39b);}return _0x5b1b52[_0x171a('0x1b')](_0x48a39b)[_0x171a('0x1c')]();};}function respondWithResult(_0x41f584,_0x21d3a2){_0x21d3a2=_0x21d3a2||0xc8;return function(_0x477730){if(_0x477730){return _0x41f584[_0x171a('0x1b')](_0x21d3a2)['json'](_0x477730);}};}function respondWithFilteredResult(_0x10c8bc,_0x9a8bb5){return function(_0x59f341){if(_0x59f341){var _0x1294cb=typeof _0x9a8bb5[_0x171a('0x1d')]==='undefined'&&typeof _0x9a8bb5['limit']==='undefined';var _0x47484f=_0x59f341[_0x171a('0x1e')];var _0x189b5b=_0x1294cb?0x0:_0x9a8bb5[_0x171a('0x1d')];var _0x20ca08=_0x1294cb?_0x59f341['count']:_0x9a8bb5['offset']+_0x9a8bb5[_0x171a('0x1f')];var _0x2fe719;if(_0x20ca08>=_0x47484f){_0x20ca08=_0x47484f;_0x2fe719=0xc8;}else{_0x2fe719=0xce;}_0x10c8bc[_0x171a('0x1b')](_0x2fe719);return _0x10c8bc[_0x171a('0x20')](_0x171a('0x21'),_0x189b5b+'-'+_0x20ca08+'/'+_0x47484f)[_0x171a('0x22')](_0x59f341);}return null;};}function patchUpdates(_0x31a992){return function(_0x404ec6){try{jsonpatch[_0x171a('0x23')](_0x404ec6,_0x31a992,!![]);}catch(_0x1ddd74){return BPromise['reject'](_0x1ddd74);}return _0x404ec6[_0x171a('0x24')]();};}function saveUpdates(_0x3d4da8,_0x2d7768){return function(_0x234927){if(_0x234927){return _0x234927[_0x171a('0x25')](_0x3d4da8)[_0x171a('0x26')](function(_0x1741d6){return _0x1741d6;});}return null;};}function removeEntity(_0xd364da,_0xf36ec1){return function(_0x51caf8){if(_0x51caf8){return _0x51caf8[_0x171a('0x27')]()[_0x171a('0x26')](function(){_0xd364da['status'](0xcc)[_0x171a('0x1c')]();});}};}function handleEntityNotFound(_0x293179,_0x3aa8c8){return function(_0x10eeb6){if(!_0x10eeb6){_0x293179[_0x171a('0x28')](0x194);}return _0x10eeb6;};}function handleError(_0x5c796b,_0x4502ff){_0x4502ff=_0x4502ff||0x1f4;return function(_0x285601){logger[_0x171a('0x29')](_0x285601[_0x171a('0x2a')]);if(_0x285601[_0x171a('0x2b')]){delete _0x285601[_0x171a('0x2b')];}_0x5c796b[_0x171a('0x1b')](_0x4502ff)[_0x171a('0x2c')](_0x285601);};}exports[_0x171a('0x2d')]=function(_0x484e70,_0xd5fdb0){var _0x16b3e2={},_0x35ce03={},_0x267901={'count':0x0,'rows':[]};var _0xece286=_['map'](db['DeskAccount'][_0x171a('0x2e')],function(_0x24256a){return{'name':_0x24256a[_0x171a('0x2f')],'type':_0x24256a[_0x171a('0x30')]['key']};});_0x35ce03[_0x171a('0x31')]=_[_0x171a('0x32')](_0xece286,_0x171a('0x2b'));_0x35ce03[_0x171a('0x33')]=_[_0x171a('0x34')](_0x484e70['query']);_0x35ce03[_0x171a('0x35')]=_[_0x171a('0x36')](_0x35ce03[_0x171a('0x31')],_0x35ce03[_0x171a('0x33')]);_0x16b3e2[_0x171a('0x37')]=_[_0x171a('0x36')](_0x35ce03[_0x171a('0x31')],qs['fields'](_0x484e70['query'][_0x171a('0x38')]));_0x16b3e2[_0x171a('0x37')]=_0x16b3e2[_0x171a('0x37')][_0x171a('0x39')]?_0x16b3e2[_0x171a('0x37')]:_0x35ce03[_0x171a('0x31')];if(!_0x484e70[_0x171a('0x33')][_0x171a('0x3a')](_0x171a('0x3b'))){_0x16b3e2['limit']=qs[_0x171a('0x1f')](_0x484e70['query'][_0x171a('0x1f')]);_0x16b3e2['offset']=qs[_0x171a('0x1d')](_0x484e70[_0x171a('0x33')][_0x171a('0x1d')]);}_0x16b3e2[_0x171a('0x3c')]=qs[_0x171a('0x3d')](_0x484e70['query'][_0x171a('0x3d')]);_0x16b3e2[_0x171a('0x3e')]=qs['filters'](_[_0x171a('0x3f')](_0x484e70[_0x171a('0x33')],_0x35ce03['filters']),_0xece286);if(_0x484e70[_0x171a('0x33')]['filter']){_0x16b3e2[_0x171a('0x3e')]=_[_0x171a('0x40')](_0x16b3e2[_0x171a('0x3e')],{'$or':_[_0x171a('0x32')](_0xece286,function(_0x572248){if(_0x572248[_0x171a('0x30')]!==_0x171a('0x41')){var _0x3d6867={};_0x3d6867[_0x572248['name']]={'$like':'%'+_0x484e70[_0x171a('0x33')]['filter']+'%'};return _0x3d6867;}})});}_0x16b3e2=_['merge']({},_0x16b3e2,_0x484e70[_0x171a('0x42')]);var _0x5c6937={'where':_0x16b3e2[_0x171a('0x3e')]};return db[_0x171a('0x43')][_0x171a('0x1e')](_0x5c6937)[_0x171a('0x26')](function(_0x3b017b){_0x267901['count']=_0x3b017b;if(_0x484e70[_0x171a('0x33')]['includeAll']){_0x16b3e2['include']=[{'all':!![]}];}return db[_0x171a('0x43')][_0x171a('0x44')](_0x16b3e2);})['then'](function(_0x5d4159){_0x267901[_0x171a('0x45')]=_0x5d4159;return _0x267901;})[_0x171a('0x26')](respondWithFilteredResult(_0xd5fdb0,_0x16b3e2))['catch'](handleError(_0xd5fdb0,null));};exports[_0x171a('0x46')]=function(_0x410cf7,_0x192bbe){var _0x104eca={'raw':![],'where':{'id':_0x410cf7['params']['id']}},_0x1d8031={};_0x1d8031['model']=_[_0x171a('0x34')](db[_0x171a('0x43')][_0x171a('0x2e')]);_0x1d8031['query']=_['keys'](_0x410cf7['query']);_0x1d8031[_0x171a('0x35')]=_[_0x171a('0x36')](_0x1d8031[_0x171a('0x31')],_0x1d8031['query']);_0x104eca[_0x171a('0x37')]=_[_0x171a('0x36')](_0x1d8031[_0x171a('0x31')],qs[_0x171a('0x38')](_0x410cf7['query'][_0x171a('0x38')]));_0x104eca[_0x171a('0x37')]=_0x104eca[_0x171a('0x37')][_0x171a('0x39')]?_0x104eca[_0x171a('0x37')]:_0x1d8031[_0x171a('0x31')];if(_0x410cf7['query'][_0x171a('0x47')]){_0x104eca['include']=[{'all':!![]}];}_0x104eca=_['merge']({},_0x104eca,_0x410cf7['options']);return db[_0x171a('0x43')]['find'](_0x104eca)['then'](handleEntityNotFound(_0x192bbe,null))['then'](respondWithResult(_0x192bbe,null))[_0x171a('0x48')](handleError(_0x192bbe,null));};exports['create']=function(_0x16c551,_0x53f3c0){return db[_0x171a('0x43')][_0x171a('0x49')](_0x16c551[_0x171a('0x4a')],{})['then'](respondWithResult(_0x53f3c0,0xc9))[_0x171a('0x48')](handleError(_0x53f3c0,null));};exports[_0x171a('0x25')]=function(_0x200194,_0x1eb5b0){if(_0x200194[_0x171a('0x4a')]['id']){delete _0x200194[_0x171a('0x4a')]['id'];}return db[_0x171a('0x43')]['find']({'where':{'id':_0x200194[_0x171a('0x4b')]['id']}})[_0x171a('0x26')](handleEntityNotFound(_0x1eb5b0,null))[_0x171a('0x26')](saveUpdates(_0x200194[_0x171a('0x4a')],null))[_0x171a('0x26')](respondWithResult(_0x1eb5b0,null))[_0x171a('0x48')](handleError(_0x1eb5b0,null));};exports[_0x171a('0x27')]=function(_0xba1fcc,_0x2829a0){return db[_0x171a('0x43')]['find']({'where':{'id':_0xba1fcc[_0x171a('0x4b')]['id']}})[_0x171a('0x26')](handleEntityNotFound(_0x2829a0,null))[_0x171a('0x26')](removeEntity(_0x2829a0,null))[_0x171a('0x48')](handleError(_0x2829a0,null));};exports['getConfigurations']=function(_0x174a0c,_0x4e3284,_0x391abc){var _0x820362={};var _0x59a8ea={};var _0x535698;var _0x326105;return db[_0x171a('0x43')]['findOne']({'where':{'id':_0x174a0c[_0x171a('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4e3284,null))[_0x171a('0x26')](function(_0x17c3fd){if(_0x17c3fd){_0x535698=_0x17c3fd;_0x59a8ea[_0x171a('0x31')]=_['keys'](db[_0x171a('0x4c')][_0x171a('0x2e')]);_0x59a8ea[_0x171a('0x33')]=_[_0x171a('0x34')](_0x174a0c['query']);_0x59a8ea[_0x171a('0x35')]=_[_0x171a('0x36')](_0x59a8ea[_0x171a('0x31')],_0x59a8ea['query']);_0x820362[_0x171a('0x37')]=_[_0x171a('0x36')](_0x59a8ea[_0x171a('0x31')],qs[_0x171a('0x38')](_0x174a0c[_0x171a('0x33')][_0x171a('0x38')]));_0x820362[_0x171a('0x37')]=_0x820362['attributes'][_0x171a('0x39')]?_0x820362['attributes']:_0x59a8ea[_0x171a('0x31')];_0x820362['order']=qs['sort'](_0x174a0c['query'][_0x171a('0x3d')]);_0x820362['where']=qs[_0x171a('0x35')](_[_0x171a('0x3f')](_0x174a0c['query'],_0x59a8ea[_0x171a('0x35')]));if(_0x174a0c[_0x171a('0x33')][_0x171a('0x4d')]){_0x820362[_0x171a('0x3e')]=_[_0x171a('0x40')](_0x820362[_0x171a('0x3e')],{'$or':_[_0x171a('0x32')](_0x820362[_0x171a('0x37')],function(_0xe5b6ad){var _0x554421={};_0x554421[_0xe5b6ad]={'$like':'%'+_0x174a0c[_0x171a('0x33')][_0x171a('0x4d')]+'%'};return _0x554421;})});}_0x820362=_[_0x171a('0x40')]({},_0x820362,_0x174a0c[_0x171a('0x42')]);return _0x535698['getConfigurations'](_0x820362);}})[_0x171a('0x26')](function(_0x4be2da){if(_0x4be2da){_0x326105=_0x4be2da[_0x171a('0x39')];if(!_0x174a0c[_0x171a('0x33')][_0x171a('0x3a')](_0x171a('0x3b'))){_0x820362[_0x171a('0x1f')]=qs[_0x171a('0x1f')](_0x174a0c['query'][_0x171a('0x1f')]);_0x820362['offset']=qs[_0x171a('0x1d')](_0x174a0c['query']['offset']);}return _0x535698[_0x171a('0x4e')](_0x820362);}})[_0x171a('0x26')](function(_0x354f97){if(_0x354f97){return _0x354f97?{'count':_0x326105,'rows':_0x354f97}:null;}})[_0x171a('0x26')](respondWithResult(_0x4e3284,null))[_0x171a('0x48')](handleError(_0x4e3284,null));};exports[_0x171a('0x4f')]=function(_0x16b742,_0x75b8a8,_0xa6c25b){if(_0x16b742['body']['id']){delete _0x16b742['body']['id'];}return db[_0x171a('0x43')][_0x171a('0x50')]({'where':{'id':_0x16b742[_0x171a('0x4b')]['id']}})['then'](handleEntityNotFound(_0x75b8a8,null))[_0x171a('0x26')](function(_0x53d59c){if(_0x53d59c){_0x16b742[_0x171a('0x4a')]['AccountId']=_0x53d59c['id'];_0x16b742[_0x171a('0x4a')][_0x171a('0x51')]=integrations[_0x171a('0x52')](_0x16b742[_0x171a('0x4a')][_0x171a('0x53')],_0x16b742['body'][_0x171a('0x30')]);_0x16b742[_0x171a('0x4a')]['Descriptions']=integrations['getDescriptions'](_0x16b742['body'][_0x171a('0x53')],_0x16b742['body'][_0x171a('0x30')]);return db[_0x171a('0x4c')][_0x171a('0x49')](_0x16b742[_0x171a('0x4a')],{'include':[{'model':db[_0x171a('0x54')],'as':'Subjects'},{'model':db['DeskField'],'as':_0x171a('0x55')}]});}return null;})['then'](respondWithResult(_0x75b8a8,null))['catch'](handleError(_0x75b8a8,null));};exports[_0x171a('0x56')]=function(_0x802bc,_0x150d51,_0x4e0b42){var _0x55db62=[{'name':_0x171a('0x57'),'label':_0x171a('0x57'),'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 _0x33cf50='';return db['DeskAccount'][_0x171a('0x50')]({'where':{'id':_0x802bc[_0x171a('0x4b')]['id']},'attributes':['id',_0x171a('0x58'),_0x171a('0x59'),'username',_0x171a('0x5a'),_0x171a('0x5b'),_0x171a('0x5c'),_0x171a('0x5d'),_0x171a('0x5e')]})['then'](handleEntityNotFound(_0x150d51,null))[_0x171a('0x26')](function(_0x3142b9){if(_0x3142b9){_0x33cf50=_0x3142b9['remoteUri'];var _0x493e36=_0x33cf50['slice'](-0x1);if(_0x493e36==='/'){_0x33cf50=_0x33cf50[_0x171a('0x5f')](0x0,_0x33cf50[_0x171a('0x60')](_0x493e36));}var _0x1985ed={'method':_0x171a('0x61'),'uri':util[_0x171a('0x62')]('%s/custom_fields',_0x33cf50),'headers':{'Content-Type':_0x171a('0x63'),'Accept':'application/json'},'json':!![]};if(_0x3142b9[_0x171a('0x59')]===_0x171a('0x64')){_0x1985ed[_0x171a('0x65')][_0x171a('0x66')]=util['format'](_0x171a('0x67'),new Buffer(util[_0x171a('0x62')](_0x171a('0x68'),_0x3142b9['username'],_0x3142b9[_0x171a('0x5a')]))[_0x171a('0x69')](_0x171a('0x6a')));}return rp(_0x1985ed)[_0x171a('0x26')](function(_0xeb61c5){return _0x55db62['concat'](_[_0x171a('0x32')](_0xeb61c5['_embedded'][_0x171a('0x6b')],function(_0x4724cb){return{'id':_0x4724cb[_0x171a('0x2b')],'name':_0x4724cb[_0x171a('0x2b')],'type':_0x4724cb['type'],'active':_0x4724cb[_0x171a('0x6c')],'label':_0x4724cb['label'],'custom':!![]};}));});}})[_0x171a('0x26')](function(_0x5bfa3c){return{'count':_0x5bfa3c[_0x171a('0x39')],'rows':_0x5bfa3c};})[_0x171a('0x26')](respondWithResult(_0x150d51,null))[_0x171a('0x48')](function(_0x58881b){var _0x24068f=_0x802bc[_0x171a('0x33')]['test']?0x1f4:_0x58881b['statusCode']||0x1f4;logger['error'](_0x171a('0x6d'),_0x171a('0x56'),_0x24068f,JSON[_0x171a('0x6e')](_0x58881b));delete _0x58881b[_0x171a('0x2b')];if(_0x24068f===0x191){_0x24068f=0x190;}_0x150d51[_0x171a('0x1b')](_0x24068f)['send'](_0x802bc['query'][_0x171a('0x6f')]?{'message':_0x171a('0x70'),'statusCode':_0x58881b[_0x171a('0x71')]}:_0x58881b);});}; \ No newline at end of file +var _0x049d=['sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','save','update','destroy','then','error','name','send','map','DeskAccount','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','getConfigurations','findOne','DeskConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','DeskField','getFields','priority','remoteUri','username','password','consumerKey','consumerSecret','token','tokenSecret','slice','substring','lastIndexOf','GET','%s/custom_fields','application/json','basic','headers','Authorization','format','Basic\x20%s','%s:%s','base64','concat','_embedded','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','eml-format','zip-dir','request-promise','path','sox','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x5c0613,_0x307c0c){var _0x3af273=function(_0x1c03f7){while(--_0x1c03f7){_0x5c0613['push'](_0x5c0613['shift']());}};_0x3af273(++_0x307c0c);}(_0x049d,0x138));var _0xd049=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x049d[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0xd049('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd049('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd049('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xd049('0x3'));var sox=require(_0xd049('0x4'));var csv=require(_0xd049('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd049('0x6'));var _=require(_0xd049('0x7'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd049('0x8'));var deskjs=require(_0xd049('0x9'));var toCsv=require(_0xd049('0x5'));var querystring=require(_0xd049('0xa'));var Papa=require(_0xd049('0xb'));var Redis=require('ioredis');var authService=require(_0xd049('0xc'));var qs=require(_0xd049('0xd'));var as=require(_0xd049('0xe'));var hardwareService=require(_0xd049('0xf'));var logger=require(_0xd049('0x10'))(_0xd049('0x11'));var utils=require(_0xd049('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xd049('0x13'));var db=require(_0xd049('0x14'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x316315,_0x14d86c){_0x14d86c=_0x14d86c||0xcc;return function(_0xf18c71){if(_0xf18c71){return _0x316315[_0xd049('0x15')](_0x14d86c);}return _0x316315[_0xd049('0x16')](_0x14d86c)[_0xd049('0x17')]();};}function respondWithResult(_0x225e17,_0x1c4c95){_0x1c4c95=_0x1c4c95||0xc8;return function(_0x31cbfd){if(_0x31cbfd){return _0x225e17['status'](_0x1c4c95)[_0xd049('0x18')](_0x31cbfd);}};}function respondWithFilteredResult(_0x42cd30,_0x3cf8a6){return function(_0x38043e){if(_0x38043e){var _0x3a1e3b=typeof _0x3cf8a6['offset']==='undefined'&&typeof _0x3cf8a6['limit']===_0xd049('0x19');var _0x4070a5=_0x38043e['count'];var _0x1f8883=_0x3a1e3b?0x0:_0x3cf8a6['offset'];var _0x5b9291=_0x3a1e3b?_0x38043e[_0xd049('0x1a')]:_0x3cf8a6[_0xd049('0x1b')]+_0x3cf8a6[_0xd049('0x1c')];var _0x6c616;if(_0x5b9291>=_0x4070a5){_0x5b9291=_0x4070a5;_0x6c616=0xc8;}else{_0x6c616=0xce;}_0x42cd30[_0xd049('0x16')](_0x6c616);return _0x42cd30[_0xd049('0x1d')](_0xd049('0x1e'),_0x1f8883+'-'+_0x5b9291+'/'+_0x4070a5)[_0xd049('0x18')](_0x38043e);}return null;};}function patchUpdates(_0x21d23e){return function(_0x437215){try{jsonpatch['apply'](_0x437215,_0x21d23e,!![]);}catch(_0x8e2f97){return BPromise['reject'](_0x8e2f97);}return _0x437215[_0xd049('0x1f')]();};}function saveUpdates(_0x509445,_0xaaf3c){return function(_0x3b6790){if(_0x3b6790){return _0x3b6790[_0xd049('0x20')](_0x509445)['then'](function(_0x16261a){return _0x16261a;});}return null;};}function removeEntity(_0xbc4a35,_0x13c5fb){return function(_0x36c674){if(_0x36c674){return _0x36c674[_0xd049('0x21')]()[_0xd049('0x22')](function(){_0xbc4a35[_0xd049('0x16')](0xcc)[_0xd049('0x17')]();});}};}function handleEntityNotFound(_0x21145b,_0x4d1dc4){return function(_0x56a14a){if(!_0x56a14a){_0x21145b['sendStatus'](0x194);}return _0x56a14a;};}function handleError(_0x101207,_0x45ccc2){_0x45ccc2=_0x45ccc2||0x1f4;return function(_0x354fe8){logger[_0xd049('0x23')](_0x354fe8['stack']);if(_0x354fe8[_0xd049('0x24')]){delete _0x354fe8[_0xd049('0x24')];}_0x101207[_0xd049('0x16')](_0x45ccc2)[_0xd049('0x25')](_0x354fe8);};}exports['index']=function(_0xbc1b79,_0x45dc3a){var _0xe1859={},_0x5e3d53={},_0xa4b00a={'count':0x0,'rows':[]};var _0x5741dd=_[_0xd049('0x26')](db[_0xd049('0x27')][_0xd049('0x28')],function(_0x24891d){return{'name':_0x24891d[_0xd049('0x29')],'type':_0x24891d[_0xd049('0x2a')][_0xd049('0x2b')]};});_0x5e3d53['model']=_['map'](_0x5741dd,_0xd049('0x24'));_0x5e3d53[_0xd049('0x2c')]=_['keys'](_0xbc1b79[_0xd049('0x2c')]);_0x5e3d53[_0xd049('0x2d')]=_[_0xd049('0x2e')](_0x5e3d53['model'],_0x5e3d53[_0xd049('0x2c')]);_0xe1859['attributes']=_[_0xd049('0x2e')](_0x5e3d53[_0xd049('0x2f')],qs[_0xd049('0x30')](_0xbc1b79['query']['fields']));_0xe1859[_0xd049('0x31')]=_0xe1859[_0xd049('0x31')][_0xd049('0x32')]?_0xe1859['attributes']:_0x5e3d53[_0xd049('0x2f')];if(!_0xbc1b79['query'][_0xd049('0x33')](_0xd049('0x34'))){_0xe1859[_0xd049('0x1c')]=qs[_0xd049('0x1c')](_0xbc1b79[_0xd049('0x2c')][_0xd049('0x1c')]);_0xe1859['offset']=qs[_0xd049('0x1b')](_0xbc1b79[_0xd049('0x2c')]['offset']);}_0xe1859[_0xd049('0x35')]=qs[_0xd049('0x36')](_0xbc1b79[_0xd049('0x2c')][_0xd049('0x36')]);_0xe1859[_0xd049('0x37')]=qs[_0xd049('0x2d')](_[_0xd049('0x38')](_0xbc1b79[_0xd049('0x2c')],_0x5e3d53[_0xd049('0x2d')]),_0x5741dd);if(_0xbc1b79[_0xd049('0x2c')][_0xd049('0x39')]){_0xe1859['where']=_['merge'](_0xe1859[_0xd049('0x37')],{'$or':_[_0xd049('0x26')](_0x5741dd,function(_0x53ad5a){if(_0x53ad5a['type']!==_0xd049('0x3a')){var _0x30fca5={};_0x30fca5[_0x53ad5a[_0xd049('0x24')]]={'$like':'%'+_0xbc1b79[_0xd049('0x2c')][_0xd049('0x39')]+'%'};return _0x30fca5;}})});}_0xe1859=_[_0xd049('0x3b')]({},_0xe1859,_0xbc1b79[_0xd049('0x3c')]);var _0x5b437b={'where':_0xe1859[_0xd049('0x37')]};return db['DeskAccount'][_0xd049('0x1a')](_0x5b437b)['then'](function(_0x134277){_0xa4b00a[_0xd049('0x1a')]=_0x134277;if(_0xbc1b79[_0xd049('0x2c')][_0xd049('0x3d')]){_0xe1859[_0xd049('0x3e')]=[{'all':!![]}];}return db[_0xd049('0x27')][_0xd049('0x3f')](_0xe1859);})[_0xd049('0x22')](function(_0x5b1518){_0xa4b00a[_0xd049('0x40')]=_0x5b1518;return _0xa4b00a;})[_0xd049('0x22')](respondWithFilteredResult(_0x45dc3a,_0xe1859))[_0xd049('0x41')](handleError(_0x45dc3a,null));};exports[_0xd049('0x42')]=function(_0x1c91f7,_0x3c86c1){var _0x5aa564={'raw':![],'where':{'id':_0x1c91f7[_0xd049('0x43')]['id']}},_0x490c9c={};_0x490c9c[_0xd049('0x2f')]=_[_0xd049('0x44')](db[_0xd049('0x27')][_0xd049('0x28')]);_0x490c9c[_0xd049('0x2c')]=_[_0xd049('0x44')](_0x1c91f7[_0xd049('0x2c')]);_0x490c9c['filters']=_[_0xd049('0x2e')](_0x490c9c[_0xd049('0x2f')],_0x490c9c[_0xd049('0x2c')]);_0x5aa564['attributes']=_[_0xd049('0x2e')](_0x490c9c[_0xd049('0x2f')],qs['fields'](_0x1c91f7['query'][_0xd049('0x30')]));_0x5aa564[_0xd049('0x31')]=_0x5aa564[_0xd049('0x31')]['length']?_0x5aa564[_0xd049('0x31')]:_0x490c9c['model'];if(_0x1c91f7['query'][_0xd049('0x3d')]){_0x5aa564[_0xd049('0x3e')]=[{'all':!![]}];}_0x5aa564=_['merge']({},_0x5aa564,_0x1c91f7[_0xd049('0x3c')]);return db['DeskAccount'][_0xd049('0x45')](_0x5aa564)[_0xd049('0x22')](handleEntityNotFound(_0x3c86c1,null))['then'](respondWithResult(_0x3c86c1,null))[_0xd049('0x41')](handleError(_0x3c86c1,null));};exports['create']=function(_0x3b3317,_0xc209ee){return db[_0xd049('0x27')][_0xd049('0x46')](_0x3b3317['body'],{})['then'](respondWithResult(_0xc209ee,0xc9))[_0xd049('0x41')](handleError(_0xc209ee,null));};exports[_0xd049('0x20')]=function(_0x303dba,_0x18fdad){if(_0x303dba['body']['id']){delete _0x303dba[_0xd049('0x47')]['id'];}return db['DeskAccount'][_0xd049('0x45')]({'where':{'id':_0x303dba[_0xd049('0x43')]['id']}})['then'](handleEntityNotFound(_0x18fdad,null))[_0xd049('0x22')](saveUpdates(_0x303dba[_0xd049('0x47')],null))[_0xd049('0x22')](respondWithResult(_0x18fdad,null))[_0xd049('0x41')](handleError(_0x18fdad,null));};exports['destroy']=function(_0x2d6282,_0x22014e){return db[_0xd049('0x27')][_0xd049('0x45')]({'where':{'id':_0x2d6282[_0xd049('0x43')]['id']}})['then'](handleEntityNotFound(_0x22014e,null))['then'](removeEntity(_0x22014e,null))[_0xd049('0x41')](handleError(_0x22014e,null));};exports[_0xd049('0x48')]=function(_0x96c4c0,_0x107b09,_0x219071){var _0x4cff1d={};var _0x5620db={};var _0x2a616f;var _0x5cd138;return db[_0xd049('0x27')][_0xd049('0x49')]({'where':{'id':_0x96c4c0[_0xd049('0x43')]['id']}})[_0xd049('0x22')](handleEntityNotFound(_0x107b09,null))['then'](function(_0x35dc40){if(_0x35dc40){_0x2a616f=_0x35dc40;_0x5620db[_0xd049('0x2f')]=_[_0xd049('0x44')](db[_0xd049('0x4a')]['rawAttributes']);_0x5620db[_0xd049('0x2c')]=_[_0xd049('0x44')](_0x96c4c0[_0xd049('0x2c')]);_0x5620db[_0xd049('0x2d')]=_[_0xd049('0x2e')](_0x5620db[_0xd049('0x2f')],_0x5620db[_0xd049('0x2c')]);_0x4cff1d[_0xd049('0x31')]=_[_0xd049('0x2e')](_0x5620db[_0xd049('0x2f')],qs[_0xd049('0x30')](_0x96c4c0[_0xd049('0x2c')]['fields']));_0x4cff1d[_0xd049('0x31')]=_0x4cff1d[_0xd049('0x31')][_0xd049('0x32')]?_0x4cff1d['attributes']:_0x5620db[_0xd049('0x2f')];_0x4cff1d[_0xd049('0x35')]=qs[_0xd049('0x36')](_0x96c4c0[_0xd049('0x2c')][_0xd049('0x36')]);_0x4cff1d[_0xd049('0x37')]=qs[_0xd049('0x2d')](_['pick'](_0x96c4c0[_0xd049('0x2c')],_0x5620db['filters']));if(_0x96c4c0[_0xd049('0x2c')][_0xd049('0x39')]){_0x4cff1d[_0xd049('0x37')]=_['merge'](_0x4cff1d['where'],{'$or':_[_0xd049('0x26')](_0x4cff1d[_0xd049('0x31')],function(_0x5c0ee4){var _0x143230={};_0x143230[_0x5c0ee4]={'$like':'%'+_0x96c4c0[_0xd049('0x2c')][_0xd049('0x39')]+'%'};return _0x143230;})});}_0x4cff1d=_['merge']({},_0x4cff1d,_0x96c4c0[_0xd049('0x3c')]);return _0x2a616f[_0xd049('0x48')](_0x4cff1d);}})[_0xd049('0x22')](function(_0x388b45){if(_0x388b45){_0x5cd138=_0x388b45[_0xd049('0x32')];if(!_0x96c4c0[_0xd049('0x2c')][_0xd049('0x33')](_0xd049('0x34'))){_0x4cff1d[_0xd049('0x1c')]=qs[_0xd049('0x1c')](_0x96c4c0[_0xd049('0x2c')][_0xd049('0x1c')]);_0x4cff1d[_0xd049('0x1b')]=qs[_0xd049('0x1b')](_0x96c4c0[_0xd049('0x2c')][_0xd049('0x1b')]);}return _0x2a616f[_0xd049('0x48')](_0x4cff1d);}})[_0xd049('0x22')](function(_0x258af5){if(_0x258af5){return _0x258af5?{'count':_0x5cd138,'rows':_0x258af5}:null;}})['then'](respondWithResult(_0x107b09,null))[_0xd049('0x41')](handleError(_0x107b09,null));};exports[_0xd049('0x4b')]=function(_0x5a4488,_0x25b655,_0x3c997d){if(_0x5a4488[_0xd049('0x47')]['id']){delete _0x5a4488['body']['id'];}return db[_0xd049('0x27')][_0xd049('0x49')]({'where':{'id':_0x5a4488[_0xd049('0x43')]['id']}})[_0xd049('0x22')](handleEntityNotFound(_0x25b655,null))[_0xd049('0x22')](function(_0x35797b){if(_0x35797b){_0x5a4488[_0xd049('0x47')][_0xd049('0x4c')]=_0x35797b['id'];_0x5a4488[_0xd049('0x47')][_0xd049('0x4d')]=integrations[_0xd049('0x4e')](_0x5a4488[_0xd049('0x47')][_0xd049('0x4f')],_0x5a4488['body'][_0xd049('0x2a')]);_0x5a4488[_0xd049('0x47')][_0xd049('0x50')]=integrations[_0xd049('0x51')](_0x5a4488[_0xd049('0x47')][_0xd049('0x4f')],_0x5a4488[_0xd049('0x47')][_0xd049('0x2a')]);return db['DeskConfiguration'][_0xd049('0x46')](_0x5a4488['body'],{'include':[{'model':db['DeskField'],'as':_0xd049('0x4d')},{'model':db[_0xd049('0x52')],'as':_0xd049('0x50')}]});}return null;})[_0xd049('0x22')](respondWithResult(_0x25b655,null))[_0xd049('0x41')](handleError(_0x25b655,null));};exports[_0xd049('0x53')]=function(_0xb5f9b6,_0x284199,_0x51fa5e){var _0xc05707=[{'name':_0xd049('0x54'),'label':_0xd049('0x54'),'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 _0x23c605='';return db[_0xd049('0x27')][_0xd049('0x49')]({'where':{'id':_0xb5f9b6['params']['id']},'attributes':['id',_0xd049('0x55'),'authType',_0xd049('0x56'),_0xd049('0x57'),_0xd049('0x58'),_0xd049('0x59'),_0xd049('0x5a'),_0xd049('0x5b')]})[_0xd049('0x22')](handleEntityNotFound(_0x284199,null))[_0xd049('0x22')](function(_0x5020b8){if(_0x5020b8){_0x23c605=_0x5020b8[_0xd049('0x55')];var _0x54fecd=_0x23c605[_0xd049('0x5c')](-0x1);if(_0x54fecd==='/'){_0x23c605=_0x23c605[_0xd049('0x5d')](0x0,_0x23c605[_0xd049('0x5e')](_0x54fecd));}var _0x3f1285={'method':_0xd049('0x5f'),'uri':util['format'](_0xd049('0x60'),_0x23c605),'headers':{'Content-Type':_0xd049('0x61'),'Accept':_0xd049('0x61')},'json':!![]};if(_0x5020b8['authType']===_0xd049('0x62')){_0x3f1285[_0xd049('0x63')][_0xd049('0x64')]=util[_0xd049('0x65')](_0xd049('0x66'),new Buffer(util[_0xd049('0x65')](_0xd049('0x67'),_0x5020b8[_0xd049('0x56')],_0x5020b8[_0xd049('0x57')]))['toString'](_0xd049('0x68')));}return rp(_0x3f1285)[_0xd049('0x22')](function(_0x4f7b79){return _0xc05707[_0xd049('0x69')](_[_0xd049('0x26')](_0x4f7b79[_0xd049('0x6a')]['entries'],function(_0x529561){return{'id':_0x529561[_0xd049('0x24')],'name':_0x529561[_0xd049('0x24')],'type':_0x529561['type'],'active':_0x529561['active'],'label':_0x529561['label'],'custom':!![]};}));});}})[_0xd049('0x22')](function(_0x8036e7){return{'count':_0x8036e7[_0xd049('0x32')],'rows':_0x8036e7};})[_0xd049('0x22')](respondWithResult(_0x284199,null))['catch'](function(_0x5eb974){var _0x585060=_0xb5f9b6[_0xd049('0x2c')][_0xd049('0x6b')]?0x1f4:_0x5eb974[_0xd049('0x6c')]||0x1f4;logger[_0xd049('0x23')](_0xd049('0x6d'),_0xd049('0x53'),_0x585060,JSON[_0xd049('0x6e')](_0x5eb974));delete _0x5eb974['name'];if(_0x585060===0x191){_0x585060=0x190;}_0x284199[_0xd049('0x16')](_0x585060)[_0xd049('0x25')](_0xb5f9b6[_0xd049('0x2c')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x5eb974[_0xd049('0x6c')]}:_0x5eb974);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index a4a26d6..d5dcde2 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 _0xb283=['int_desk_accounts','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','define'];(function(_0x141206,_0x48263b){var _0xf8a1d6=function(_0x4b180c){while(--_0x4b180c){_0x141206['push'](_0x141206['shift']());}};_0xf8a1d6(++_0x48263b);}(_0xb283,0x6d));var _0x3b28=function(_0x4dbeaa,_0x3fb85d){_0x4dbeaa=_0x4dbeaa-0x0;var _0x889e79=_0xb283[_0x4dbeaa];return _0x889e79;};'use strict';var _=require(_0x3b28('0x0'));var util=require(_0x3b28('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x3b28('0x2'));var BPromise=require(_0x3b28('0x3'));var rp=require(_0x3b28('0x4'));var fs=require('fs');var path=require(_0x3b28('0x5'));var rimraf=require(_0x3b28('0x6'));var config=require(_0x3b28('0x7'));var attributes=require('./intDeskAccount.attributes');var integrations=require(_0x3b28('0x8'));module[_0x3b28('0x9')]=function(_0x1d6f07,_0xbdf26e){return _0x1d6f07[_0x3b28('0xa')]('DeskAccount',attributes,{'tableName':_0x3b28('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4c1c=['lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','exports','define','DeskAccount','int_desk_accounts'];(function(_0x46d9e6,_0x3ae468){var _0x9221bd=function(_0x4e3e0f){while(--_0x4e3e0f){_0x46d9e6['push'](_0x46d9e6['shift']());}};_0x9221bd(++_0x3ae468);}(_0x4c1c,0x188));var _0xc4c1=function(_0x862884,_0x179ce7){_0x862884=_0x862884-0x0;var _0x506c8e=_0x4c1c[_0x862884];return _0x506c8e;};'use strict';var _=require(_0xc4c1('0x0'));var util=require('util');var logger=require(_0xc4c1('0x1'))(_0xc4c1('0x2'));var moment=require(_0xc4c1('0x3'));var BPromise=require(_0xc4c1('0x4'));var rp=require(_0xc4c1('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc4c1('0x6'));var config=require(_0xc4c1('0x7'));var attributes=require(_0xc4c1('0x8'));var integrations=require(_0xc4c1('0x9'));module[_0xc4c1('0xa')]=function(_0xceb7ec,_0x48b82e){return _0xceb7ec[_0xc4c1('0xb')](_0xc4c1('0xc'),attributes,{'tableName':_0xc4c1('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.rpc.js b/server/api/intDeskAccount/intDeskAccount.rpc.js index 11c97d2..540105e 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 _0x2280=['error','code','message','info','result','catch','GetDeskAccount','DeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','debug','ShowDeskAccount','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request','then','DeskAccount,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x2eac4f,_0x5173f9){var _0x58f73b=function(_0x529f28){while(--_0x529f28){_0x2eac4f['push'](_0x2eac4f['shift']());}};_0x58f73b(++_0x5173f9);}(_0x2280,0x167));var _0x0228=function(_0x21cbd8,_0x358cfe){_0x21cbd8=_0x21cbd8-0x0;var _0x3b7e9b=_0x2280[_0x21cbd8];return _0x3b7e9b;};'use strict';var _=require(_0x0228('0x0'));var util=require(_0x0228('0x1'));var moment=require(_0x0228('0x2'));var BPromise=require('bluebird');var rs=require(_0x0228('0x3'));var fs=require('fs');var Redis=require(_0x0228('0x4'));var db=require(_0x0228('0x5'))['db'];var utils=require(_0x0228('0x6'));var logger=require(_0x0228('0x7'))(_0x0228('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x0228('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2613f7,_0x1025f7,_0x1d9c52){return new BPromise(function(_0x6571a1,_0x1b0dc4){return client[_0x0228('0xa')](_0x2613f7,_0x1d9c52)[_0x0228('0xb')](function(_0x1da754){logger['info'](_0x0228('0xc'),_0x1025f7,_0x0228('0xd'));logger['debug']('DeskAccount,\x20%s,\x20%s,\x20%s',_0x1025f7,_0x0228('0xd'),JSON[_0x0228('0xe')](_0x1da754));if(_0x1da754['error']){if(_0x1da754[_0x0228('0xf')][_0x0228('0x10')]===0x1f4){logger['error'](_0x0228('0xc'),_0x1025f7,_0x1da754[_0x0228('0xf')][_0x0228('0x11')]);return _0x1b0dc4(_0x1da754['error']['message']);}logger[_0x0228('0xf')](_0x0228('0xc'),_0x1025f7,_0x1da754['error'][_0x0228('0x11')]);return _0x6571a1(_0x1da754['error'][_0x0228('0x11')]);}else{logger[_0x0228('0x12')](_0x0228('0xc'),_0x1025f7,_0x0228('0xd'));_0x6571a1(_0x1da754[_0x0228('0x13')][_0x0228('0x11')]);}})[_0x0228('0x14')](function(_0x2a3134){logger[_0x0228('0xf')]('DeskAccount,\x20%s,\x20%s',_0x1025f7,_0x2a3134);_0x1b0dc4(_0x2a3134);});});}exports[_0x0228('0x15')]=function(_0x22c5b9){var _0x543073=this;return new Promise(function(_0x108158,_0x3ef2a0){return db[_0x0228('0x16')][_0x0228('0x17')]({'raw':_0x22c5b9[_0x0228('0x18')]?_0x22c5b9[_0x0228('0x18')][_0x0228('0x19')]===undefined?!![]:![]:!![],'where':_0x22c5b9[_0x0228('0x18')]?_0x22c5b9[_0x0228('0x18')][_0x0228('0x1a')]||null:null,'attributes':_0x22c5b9['options']?_0x22c5b9[_0x0228('0x18')][_0x0228('0x1b')]||null:null,'limit':_0x22c5b9[_0x0228('0x18')]?_0x22c5b9[_0x0228('0x18')][_0x0228('0x1c')]||null:null,'include':_0x22c5b9['options']?_0x22c5b9['options'][_0x0228('0x1d')]?_[_0x0228('0x1e')](_0x22c5b9[_0x0228('0x18')]['include'],function(_0x3eb191){return{'model':db[_0x3eb191['model']],'as':_0x3eb191['as'],'attributes':_0x3eb191[_0x0228('0x1b')],'include':_0x3eb191[_0x0228('0x1d')]?_['map'](_0x3eb191[_0x0228('0x1d')],function(_0x4550ce){return{'model':db[_0x4550ce[_0x0228('0x1f')]],'as':_0x4550ce['as'],'attributes':_0x4550ce[_0x0228('0x1b')],'include':_0x4550ce[_0x0228('0x1d')]?_[_0x0228('0x1e')](_0x4550ce[_0x0228('0x1d')],function(_0x1f7aef){return{'model':db[_0x1f7aef['model']],'as':_0x1f7aef['as'],'attributes':_0x1f7aef[_0x0228('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0228('0xb')](function(_0x4e6878){logger[_0x0228('0x12')](_0x0228('0x15'),_0x22c5b9);logger[_0x0228('0x20')]('GetDeskAccount',_0x22c5b9,JSON[_0x0228('0xe')](_0x4e6878));_0x108158(_0x4e6878);})['catch'](function(_0x54534f){logger[_0x0228('0xf')](_0x0228('0x15'),_0x54534f[_0x0228('0x11')],_0x22c5b9);_0x3ef2a0(_0x543073[_0x0228('0xf')](0x1f4,_0x54534f[_0x0228('0x11')]));});});};exports[_0x0228('0x21')]=function(_0x5a7c4b){var _0x284f21=this;return new Promise(function(_0x51c211,_0x450612){return db[_0x0228('0x16')]['find']({'raw':_0x5a7c4b[_0x0228('0x18')]?_0x5a7c4b[_0x0228('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x5a7c4b[_0x0228('0x18')]?_0x5a7c4b[_0x0228('0x18')][_0x0228('0x1a')]||null:null,'attributes':_0x5a7c4b['options']?_0x5a7c4b[_0x0228('0x18')][_0x0228('0x1b')]||null:null,'include':_0x5a7c4b['options']?_0x5a7c4b[_0x0228('0x18')]['include']?_['map'](_0x5a7c4b[_0x0228('0x18')][_0x0228('0x1d')],function(_0x9c40fd){return{'model':db[_0x9c40fd['model']],'as':_0x9c40fd['as'],'attributes':_0x9c40fd[_0x0228('0x1b')],'include':_0x9c40fd[_0x0228('0x1d')]?_[_0x0228('0x1e')](_0x9c40fd[_0x0228('0x1d')],function(_0x18fb57){return{'model':db[_0x18fb57['model']],'as':_0x18fb57['as'],'attributes':_0x18fb57[_0x0228('0x1b')],'include':_0x18fb57[_0x0228('0x1d')]?_[_0x0228('0x1e')](_0x18fb57['include'],function(_0x18773a){return{'model':db[_0x18773a[_0x0228('0x1f')]],'as':_0x18773a['as'],'attributes':_0x18773a[_0x0228('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0228('0xb')](function(_0x46d36b){logger[_0x0228('0x12')](_0x0228('0x21'),_0x5a7c4b);logger[_0x0228('0x20')]('ShowDeskAccount',_0x5a7c4b,JSON[_0x0228('0xe')](_0x46d36b));_0x51c211(_0x46d36b);})['catch'](function(_0x4811be){logger['error'](_0x0228('0x21'),_0x4811be[_0x0228('0x11')],_0x5a7c4b);_0x450612(_0x284f21[_0x0228('0xf')](0x1f4,_0x4811be[_0x0228('0x11')]));});});}; \ No newline at end of file +var _0x9fbe=['request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','DeskAccount','options','raw','where','attributes','limit','include','model','map','GetDeskAccount','catch','ShowDeskAccount','then','lodash','util','moment','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','info','DeskAccount,\x20%s,\x20%s'];(function(_0x54794e,_0x2b0d2b){var _0x45e341=function(_0x177698){while(--_0x177698){_0x54794e['push'](_0x54794e['shift']());}};_0x45e341(++_0x2b0d2b);}(_0x9fbe,0x98));var _0xe9fb=function(_0x4cbdc4,_0x8be7a8){_0x4cbdc4=_0x4cbdc4-0x0;var _0x413c70=_0x9fbe[_0x4cbdc4];return _0x413c70;};'use strict';var _=require(_0xe9fb('0x0'));var util=require(_0xe9fb('0x1'));var moment=require(_0xe9fb('0x2'));var BPromise=require('bluebird');var rs=require(_0xe9fb('0x3'));var fs=require('fs');var Redis=require(_0xe9fb('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xe9fb('0x5'));var config=require(_0xe9fb('0x6'));var jayson=require(_0xe9fb('0x7'));var client=jayson[_0xe9fb('0x8')][_0xe9fb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x445419,_0x31458c,_0x106605){return new BPromise(function(_0x4c06bd,_0xb458c3){return client[_0xe9fb('0xa')](_0x445419,_0x106605)['then'](function(_0x3596c7){logger[_0xe9fb('0xb')](_0xe9fb('0xc'),_0x31458c,_0xe9fb('0xd'));logger[_0xe9fb('0xe')](_0xe9fb('0xf'),_0x31458c,'request\x20sent',JSON[_0xe9fb('0x10')](_0x3596c7));if(_0x3596c7['error']){if(_0x3596c7[_0xe9fb('0x11')][_0xe9fb('0x12')]===0x1f4){logger['error'](_0xe9fb('0xc'),_0x31458c,_0x3596c7['error']['message']);return _0xb458c3(_0x3596c7[_0xe9fb('0x11')]['message']);}logger['error'](_0xe9fb('0xc'),_0x31458c,_0x3596c7[_0xe9fb('0x11')][_0xe9fb('0x13')]);return _0x4c06bd(_0x3596c7[_0xe9fb('0x11')][_0xe9fb('0x13')]);}else{logger[_0xe9fb('0xb')](_0xe9fb('0xc'),_0x31458c,_0xe9fb('0xd'));_0x4c06bd(_0x3596c7['result'][_0xe9fb('0x13')]);}})['catch'](function(_0x5f46da){logger[_0xe9fb('0x11')](_0xe9fb('0xc'),_0x31458c,_0x5f46da);_0xb458c3(_0x5f46da);});});}exports['GetDeskAccount']=function(_0x16d68e){var _0x3782c3=this;return new Promise(function(_0x58a6ce,_0x4f901e){return db[_0xe9fb('0x14')]['findAll']({'raw':_0x16d68e[_0xe9fb('0x15')]?_0x16d68e[_0xe9fb('0x15')][_0xe9fb('0x16')]===undefined?!![]:![]:!![],'where':_0x16d68e['options']?_0x16d68e[_0xe9fb('0x15')][_0xe9fb('0x17')]||null:null,'attributes':_0x16d68e[_0xe9fb('0x15')]?_0x16d68e[_0xe9fb('0x15')][_0xe9fb('0x18')]||null:null,'limit':_0x16d68e[_0xe9fb('0x15')]?_0x16d68e[_0xe9fb('0x15')][_0xe9fb('0x19')]||null:null,'include':_0x16d68e[_0xe9fb('0x15')]?_0x16d68e[_0xe9fb('0x15')][_0xe9fb('0x1a')]?_['map'](_0x16d68e['options']['include'],function(_0xa958e2){return{'model':db[_0xa958e2['model']],'as':_0xa958e2['as'],'attributes':_0xa958e2[_0xe9fb('0x18')],'include':_0xa958e2[_0xe9fb('0x1a')]?_['map'](_0xa958e2[_0xe9fb('0x1a')],function(_0x44a588){return{'model':db[_0x44a588[_0xe9fb('0x1b')]],'as':_0x44a588['as'],'attributes':_0x44a588[_0xe9fb('0x18')],'include':_0x44a588[_0xe9fb('0x1a')]?_[_0xe9fb('0x1c')](_0x44a588[_0xe9fb('0x1a')],function(_0x20fc9f){return{'model':db[_0x20fc9f['model']],'as':_0x20fc9f['as'],'attributes':_0x20fc9f['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x837dc3){logger[_0xe9fb('0xb')]('GetDeskAccount',_0x16d68e);logger[_0xe9fb('0xe')](_0xe9fb('0x1d'),_0x16d68e,JSON['stringify'](_0x837dc3));_0x58a6ce(_0x837dc3);})[_0xe9fb('0x1e')](function(_0x3a4d16){logger[_0xe9fb('0x11')]('GetDeskAccount',_0x3a4d16['message'],_0x16d68e);_0x4f901e(_0x3782c3[_0xe9fb('0x11')](0x1f4,_0x3a4d16['message']));});});};exports[_0xe9fb('0x1f')]=function(_0x52962d){var _0x48306c=this;return new Promise(function(_0x196c36,_0x2ba4de){return db[_0xe9fb('0x14')]['find']({'raw':_0x52962d[_0xe9fb('0x15')]?_0x52962d[_0xe9fb('0x15')][_0xe9fb('0x16')]===undefined?!![]:![]:!![],'where':_0x52962d[_0xe9fb('0x15')]?_0x52962d[_0xe9fb('0x15')][_0xe9fb('0x17')]||null:null,'attributes':_0x52962d[_0xe9fb('0x15')]?_0x52962d['options'][_0xe9fb('0x18')]||null:null,'include':_0x52962d[_0xe9fb('0x15')]?_0x52962d['options'][_0xe9fb('0x1a')]?_[_0xe9fb('0x1c')](_0x52962d['options'][_0xe9fb('0x1a')],function(_0x3e1258){return{'model':db[_0x3e1258[_0xe9fb('0x1b')]],'as':_0x3e1258['as'],'attributes':_0x3e1258[_0xe9fb('0x18')],'include':_0x3e1258[_0xe9fb('0x1a')]?_['map'](_0x3e1258[_0xe9fb('0x1a')],function(_0x5a87c2){return{'model':db[_0x5a87c2[_0xe9fb('0x1b')]],'as':_0x5a87c2['as'],'attributes':_0x5a87c2[_0xe9fb('0x18')],'include':_0x5a87c2[_0xe9fb('0x1a')]?_[_0xe9fb('0x1c')](_0x5a87c2[_0xe9fb('0x1a')],function(_0x5ead4c){return{'model':db[_0x5ead4c[_0xe9fb('0x1b')]],'as':_0x5ead4c['as'],'attributes':_0x5ead4c[_0xe9fb('0x18')]};}):[]};}):[]};}):[]:[]})[_0xe9fb('0x20')](function(_0x56e692){logger[_0xe9fb('0xb')](_0xe9fb('0x1f'),_0x52962d);logger[_0xe9fb('0xe')](_0xe9fb('0x1f'),_0x52962d,JSON[_0xe9fb('0x10')](_0x56e692));_0x196c36(_0x56e692);})[_0xe9fb('0x1e')](function(_0x352e71){logger[_0xe9fb('0x11')](_0xe9fb('0x1f'),_0x352e71[_0xe9fb('0x13')],_0x52962d);_0x2ba4de(_0x48306c['error'](0x1f4,_0x352e71[_0xe9fb('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index be70837..d10cb9b 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 _0x9957=['/:id/subjects','getSubjects','getDescriptions','/:id/tags','getTags','post','create','setTags','put','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields'];(function(_0x331136,_0x15c2e9){var _0x1d0359=function(_0x555a86){while(--_0x555a86){_0x331136['push'](_0x331136['shift']());}};_0x1d0359(++_0x15c2e9);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/fields',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/descriptions',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/tags',auth['isAuthenticated'](),controller[_0x7995('0x16')]);router[_0x7995('0x17')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x18')]);router[_0x7995('0x19')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller['destroy']);module[_0x7995('0x1a')]=router; \ No newline at end of file +var _0x008c=['../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','getFields','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','setTags','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x39cec7,_0x5ccadf){var _0x2816fb=function(_0x8ea9f4){while(--_0x8ea9f4){_0x39cec7['push'](_0x39cec7['shift']());}};_0x2816fb(++_0x5ccadf);}(_0x008c,0x188));var _0xc008=function(_0x1cc3a5,_0x59850b){_0x1cc3a5=_0x1cc3a5-0x0;var _0x4bf8b7=_0x008c[_0x1cc3a5];return _0x4bf8b7;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/:id',auth[_0xc008('0xb')](),controller['show']);router[_0xc008('0xa')]('/:id/fields',auth['isAuthenticated'](),controller[_0xc008('0xd')]);router[_0xc008('0xa')]('/:id/subjects',auth['isAuthenticated'](),controller['getSubjects']);router[_0xc008('0xa')](_0xc008('0xe'),auth['isAuthenticated'](),controller[_0xc008('0xf')]);router[_0xc008('0xa')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x11')]);router[_0xc008('0x12')]('/',auth[_0xc008('0xb')](),controller['create']);router['post'](_0xc008('0x10'),auth['isAuthenticated'](),controller[_0xc008('0x13')]);router[_0xc008('0x14')](_0xc008('0x15'),auth[_0xc008('0xb')](),controller[_0xc008('0x16')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xc008('0x17')]);module[_0xc008('0x18')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index fd647b4..e3351b7 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 _0xb481=['exports','STRING','sequelize'];(function(_0x323ad7,_0x12b203){var _0x946599=function(_0x42da92){while(--_0x42da92){_0x323ad7['push'](_0x323ad7['shift']());}};_0x946599(++_0x12b203);}(_0xb481,0x1d0));var _0x1b48=function(_0x23428f,_0x288620){_0x23428f=_0x23428f-0x0;var _0x4a1f23=_0xb481[_0x23428f];return _0x4a1f23;};'use strict';var Sequelize=require(_0x1b48('0x0'));module[_0x1b48('0x1')]={'name':{'type':Sequelize[_0x1b48('0x2')]},'description':{'type':Sequelize[_0x1b48('0x2')]}}; \ No newline at end of file +var _0x32b7=['exports','STRING','sequelize'];(function(_0x33c3f0,_0x35a6a6){var _0x2ce021=function(_0x4f6778){while(--_0x4f6778){_0x33c3f0['push'](_0x33c3f0['shift']());}};_0x2ce021(++_0x35a6a6);}(_0x32b7,0x19d));var _0x732b=function(_0x4d56b5,_0x1a15f2){_0x4d56b5=_0x4d56b5-0x0;var _0x355514=_0x32b7[_0x4d56b5];return _0x355514;};'use strict';var Sequelize=require(_0x732b('0x0'));module[_0x732b('0x1')]={'name':{'type':Sequelize[_0x732b('0x2')]},'description':{'type':Sequelize[_0x732b('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 6025d65..5ac336b 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 _0x3ac3=['end','json','offset','limit','undefined','count','apply','reject','save','update','then','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','DeskConfiguration','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','findOne','DeskField','order','getFields','getSubjects','getDescriptions','getTags','Tag','setTags','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3ac3,0x1d9));var _0x33ac=function(_0x4d7f3f,_0x4d2803){_0x4d7f3f=_0x4d7f3f-0x0;var _0x5d67cc=_0x3ac3[_0x4d7f3f];return _0x5d67cc;};'use strict';var emlformat=require(_0x33ac('0x0'));var rimraf=require(_0x33ac('0x1'));var zipdir=require(_0x33ac('0x2'));var jsonpatch=require(_0x33ac('0x3'));var rp=require('request-promise');var moment=require(_0x33ac('0x4'));var BPromise=require(_0x33ac('0x5'));var Mustache=require(_0x33ac('0x6'));var util=require('util');var path=require(_0x33ac('0x7'));var sox=require(_0x33ac('0x8'));var csv=require(_0x33ac('0x9'));var ejs=require(_0x33ac('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x33ac('0xb'));var crypto=require(_0x33ac('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x33ac('0xd'));var toCsv=require(_0x33ac('0x9'));var querystring=require(_0x33ac('0xe'));var Papa=require(_0x33ac('0xf'));var Redis=require('ioredis');var authService=require(_0x33ac('0x10'));var qs=require(_0x33ac('0x11'));var as=require(_0x33ac('0x12'));var hardwareService=require(_0x33ac('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x33ac('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x33ac('0x15'));var db=require(_0x33ac('0x16'))['db'];function respondWithStatusCode(_0x1f5733,_0x5dd1b1){_0x5dd1b1=_0x5dd1b1||0xcc;return function(_0x20ba07){if(_0x20ba07){return _0x1f5733[_0x33ac('0x17')](_0x5dd1b1);}return _0x1f5733[_0x33ac('0x18')](_0x5dd1b1)[_0x33ac('0x19')]();};}function respondWithResult(_0x59f8f6,_0x4305ba){_0x4305ba=_0x4305ba||0xc8;return function(_0x113342){if(_0x113342){return _0x59f8f6[_0x33ac('0x18')](_0x4305ba)[_0x33ac('0x1a')](_0x113342);}};}function respondWithFilteredResult(_0x82545e,_0x4ac99a){return function(_0x19cb6e){if(_0x19cb6e){var _0x104b1f=typeof _0x4ac99a[_0x33ac('0x1b')]==='undefined'&&typeof _0x4ac99a[_0x33ac('0x1c')]===_0x33ac('0x1d');var _0x18277a=_0x19cb6e['count'];var _0x459a2a=_0x104b1f?0x0:_0x4ac99a[_0x33ac('0x1b')];var _0x13c197=_0x104b1f?_0x19cb6e[_0x33ac('0x1e')]:_0x4ac99a[_0x33ac('0x1b')]+_0x4ac99a['limit'];var _0x1d34ea;if(_0x13c197>=_0x18277a){_0x13c197=_0x18277a;_0x1d34ea=0xc8;}else{_0x1d34ea=0xce;}_0x82545e['status'](_0x1d34ea);return _0x82545e['set']('Content-Range',_0x459a2a+'-'+_0x13c197+'/'+_0x18277a)[_0x33ac('0x1a')](_0x19cb6e);}return null;};}function patchUpdates(_0x564801){return function(_0xa10f39){try{jsonpatch[_0x33ac('0x1f')](_0xa10f39,_0x564801,!![]);}catch(_0x80c60c){return BPromise[_0x33ac('0x20')](_0x80c60c);}return _0xa10f39[_0x33ac('0x21')]();};}function saveUpdates(_0x508532,_0x22699b){return function(_0x4da0c6){if(_0x4da0c6){return _0x4da0c6[_0x33ac('0x22')](_0x508532)[_0x33ac('0x23')](function(_0x419b8a){return _0x419b8a;});}return null;};}function removeEntity(_0xd31d56,_0x1c0a47){return function(_0xedef4b){if(_0xedef4b){return _0xedef4b['destroy']()[_0x33ac('0x23')](function(){_0xd31d56[_0x33ac('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1914bd,_0x43b41e){return function(_0x4231f3){if(!_0x4231f3){_0x1914bd[_0x33ac('0x17')](0x194);}return _0x4231f3;};}function handleError(_0x4df7d0,_0x16ffc5){_0x16ffc5=_0x16ffc5||0x1f4;return function(_0x57d5df){logger[_0x33ac('0x24')](_0x57d5df['stack']);if(_0x57d5df[_0x33ac('0x25')]){delete _0x57d5df[_0x33ac('0x25')];}_0x4df7d0[_0x33ac('0x18')](_0x16ffc5)[_0x33ac('0x26')](_0x57d5df);};}exports[_0x33ac('0x27')]=function(_0x42ecef,_0x4b2649){var _0x4b97e1={},_0x4cfc6a={},_0x1fcf18={'count':0x0,'rows':[]};var _0x419e50=_[_0x33ac('0x28')](db['DeskConfiguration'][_0x33ac('0x29')],function(_0x38d859){return{'name':_0x38d859[_0x33ac('0x2a')],'type':_0x38d859[_0x33ac('0x2b')][_0x33ac('0x2c')]};});_0x4cfc6a[_0x33ac('0x2d')]=_['map'](_0x419e50,_0x33ac('0x25'));_0x4cfc6a[_0x33ac('0x2e')]=_[_0x33ac('0x2f')](_0x42ecef[_0x33ac('0x2e')]);_0x4cfc6a[_0x33ac('0x30')]=_[_0x33ac('0x31')](_0x4cfc6a['model'],_0x4cfc6a[_0x33ac('0x2e')]);_0x4b97e1['attributes']=_[_0x33ac('0x31')](_0x4cfc6a[_0x33ac('0x2d')],qs[_0x33ac('0x32')](_0x42ecef[_0x33ac('0x2e')][_0x33ac('0x32')]));_0x4b97e1[_0x33ac('0x33')]=_0x4b97e1[_0x33ac('0x33')][_0x33ac('0x34')]?_0x4b97e1[_0x33ac('0x33')]:_0x4cfc6a['model'];if(!_0x42ecef[_0x33ac('0x2e')][_0x33ac('0x35')](_0x33ac('0x36'))){_0x4b97e1[_0x33ac('0x1c')]=qs[_0x33ac('0x1c')](_0x42ecef[_0x33ac('0x2e')][_0x33ac('0x1c')]);_0x4b97e1[_0x33ac('0x1b')]=qs[_0x33ac('0x1b')](_0x42ecef['query']['offset']);}_0x4b97e1['order']=qs[_0x33ac('0x37')](_0x42ecef['query'][_0x33ac('0x37')]);_0x4b97e1[_0x33ac('0x38')]=qs[_0x33ac('0x30')](_[_0x33ac('0x39')](_0x42ecef[_0x33ac('0x2e')],_0x4cfc6a[_0x33ac('0x30')]),_0x419e50);if(_0x42ecef['query'][_0x33ac('0x3a')]){_0x4b97e1[_0x33ac('0x38')]=_[_0x33ac('0x3b')](_0x4b97e1[_0x33ac('0x38')],{'$or':_[_0x33ac('0x28')](_0x419e50,function(_0x2d7a19){if(_0x2d7a19[_0x33ac('0x2b')]!==_0x33ac('0x3c')){var _0x4f71ec={};_0x4f71ec[_0x2d7a19[_0x33ac('0x25')]]={'$like':'%'+_0x42ecef[_0x33ac('0x2e')][_0x33ac('0x3a')]+'%'};return _0x4f71ec;}})});}_0x4b97e1=_['merge']({},_0x4b97e1,_0x42ecef[_0x33ac('0x3d')]);var _0x3582d1={'where':_0x4b97e1[_0x33ac('0x38')]};return db[_0x33ac('0x3e')][_0x33ac('0x1e')](_0x3582d1)[_0x33ac('0x23')](function(_0x4d20b5){_0x1fcf18[_0x33ac('0x1e')]=_0x4d20b5;if(_0x42ecef[_0x33ac('0x2e')][_0x33ac('0x3f')]){_0x4b97e1[_0x33ac('0x40')]=[{'all':!![]}];}return db['DeskConfiguration'][_0x33ac('0x41')](_0x4b97e1);})[_0x33ac('0x23')](function(_0x75cac9){_0x1fcf18[_0x33ac('0x42')]=_0x75cac9;return _0x1fcf18;})[_0x33ac('0x23')](respondWithFilteredResult(_0x4b2649,_0x4b97e1))[_0x33ac('0x43')](handleError(_0x4b2649,null));};exports[_0x33ac('0x44')]=function(_0xb01b73,_0x4b6f74){var _0x14936c={'raw':![],'where':{'id':_0xb01b73[_0x33ac('0x45')]['id']}},_0x4a40e6={};_0x4a40e6[_0x33ac('0x2d')]=_[_0x33ac('0x2f')](db[_0x33ac('0x3e')][_0x33ac('0x29')]);_0x4a40e6[_0x33ac('0x2e')]=_['keys'](_0xb01b73[_0x33ac('0x2e')]);_0x4a40e6[_0x33ac('0x30')]=_['intersection'](_0x4a40e6[_0x33ac('0x2d')],_0x4a40e6['query']);_0x14936c[_0x33ac('0x33')]=_[_0x33ac('0x31')](_0x4a40e6[_0x33ac('0x2d')],qs['fields'](_0xb01b73[_0x33ac('0x2e')][_0x33ac('0x32')]));_0x14936c[_0x33ac('0x33')]=_0x14936c[_0x33ac('0x33')]['length']?_0x14936c[_0x33ac('0x33')]:_0x4a40e6[_0x33ac('0x2d')];if(_0xb01b73[_0x33ac('0x2e')][_0x33ac('0x3f')]){_0x14936c['include']=[{'all':!![]}];}_0x14936c=_[_0x33ac('0x3b')]({},_0x14936c,_0xb01b73['options']);return db[_0x33ac('0x3e')][_0x33ac('0x46')](_0x14936c)[_0x33ac('0x23')](handleEntityNotFound(_0x4b6f74,null))[_0x33ac('0x23')](respondWithResult(_0x4b6f74,null))[_0x33ac('0x43')](handleError(_0x4b6f74,null));};exports[_0x33ac('0x47')]=function(_0x54c15c,_0x2d1fc9){return db['DeskConfiguration']['create'](_0x54c15c['body'],{})[_0x33ac('0x23')](respondWithResult(_0x2d1fc9,0xc9))[_0x33ac('0x43')](handleError(_0x2d1fc9,null));};exports[_0x33ac('0x22')]=function(_0x2e023d,_0x5cb713){if(_0x2e023d['body']['id']){delete _0x2e023d['body']['id'];}return db[_0x33ac('0x3e')]['find']({'where':{'id':_0x2e023d[_0x33ac('0x45')]['id']}})[_0x33ac('0x23')](handleEntityNotFound(_0x5cb713,null))[_0x33ac('0x23')](saveUpdates(_0x2e023d[_0x33ac('0x48')],null))[_0x33ac('0x23')](respondWithResult(_0x5cb713,null))[_0x33ac('0x43')](handleError(_0x5cb713,null));};exports[_0x33ac('0x49')]=function(_0x47d664,_0x16b7af){return db[_0x33ac('0x3e')]['find']({'where':{'id':_0x47d664['params']['id']}})['then'](handleEntityNotFound(_0x16b7af,null))[_0x33ac('0x23')](removeEntity(_0x16b7af,null))[_0x33ac('0x43')](handleError(_0x16b7af,null));};exports['getFields']=function(_0x54490f,_0x3b05f7,_0x1acfe6){var _0x375043={};var _0x229d8b={};var _0xfe3449;var _0x141ad2;return db[_0x33ac('0x3e')][_0x33ac('0x4a')]({'where':{'id':_0x54490f[_0x33ac('0x45')]['id']}})['then'](handleEntityNotFound(_0x3b05f7,null))[_0x33ac('0x23')](function(_0x399524){if(_0x399524){_0xfe3449=_0x399524;_0x229d8b[_0x33ac('0x2d')]=_[_0x33ac('0x2f')](db[_0x33ac('0x4b')]['rawAttributes']);_0x229d8b[_0x33ac('0x2e')]=_['keys'](_0x54490f['query']);_0x229d8b[_0x33ac('0x30')]=_['intersection'](_0x229d8b[_0x33ac('0x2d')],_0x229d8b[_0x33ac('0x2e')]);_0x375043[_0x33ac('0x33')]=_[_0x33ac('0x31')](_0x229d8b[_0x33ac('0x2d')],qs['fields'](_0x54490f[_0x33ac('0x2e')][_0x33ac('0x32')]));_0x375043[_0x33ac('0x33')]=_0x375043[_0x33ac('0x33')][_0x33ac('0x34')]?_0x375043[_0x33ac('0x33')]:_0x229d8b[_0x33ac('0x2d')];_0x375043[_0x33ac('0x4c')]=qs[_0x33ac('0x37')](_0x54490f[_0x33ac('0x2e')]['sort']);_0x375043[_0x33ac('0x38')]=qs[_0x33ac('0x30')](_[_0x33ac('0x39')](_0x54490f['query'],_0x229d8b[_0x33ac('0x30')]));if(_0x54490f[_0x33ac('0x2e')]['filter']){_0x375043['where']=_[_0x33ac('0x3b')](_0x375043[_0x33ac('0x38')],{'$or':_['map'](_0x375043['attributes'],function(_0x3f81dd){var _0x1a42f6={};_0x1a42f6[_0x3f81dd]={'$like':'%'+_0x54490f[_0x33ac('0x2e')]['filter']+'%'};return _0x1a42f6;})});}_0x375043=_['merge']({},_0x375043,_0x54490f['options']);return _0xfe3449[_0x33ac('0x4d')](_0x375043);}})[_0x33ac('0x23')](function(_0x4de2fd){if(_0x4de2fd){_0x141ad2=_0x4de2fd['length'];if(!_0x54490f[_0x33ac('0x2e')][_0x33ac('0x35')](_0x33ac('0x36'))){_0x375043[_0x33ac('0x1c')]=qs[_0x33ac('0x1c')](_0x54490f[_0x33ac('0x2e')][_0x33ac('0x1c')]);_0x375043[_0x33ac('0x1b')]=qs[_0x33ac('0x1b')](_0x54490f[_0x33ac('0x2e')][_0x33ac('0x1b')]);}return _0xfe3449[_0x33ac('0x4d')](_0x375043);}})[_0x33ac('0x23')](function(_0x20dbbf){if(_0x20dbbf){return _0x20dbbf?{'count':_0x141ad2,'rows':_0x20dbbf}:null;}})['then'](respondWithResult(_0x3b05f7,null))[_0x33ac('0x43')](handleError(_0x3b05f7,null));};exports['getSubjects']=function(_0x462457,_0x57fff9,_0x249129){var _0x537fc8={};var _0x5cfa99={};var _0x18795c;var _0x5ccbe3;return db[_0x33ac('0x3e')][_0x33ac('0x4a')]({'where':{'id':_0x462457[_0x33ac('0x45')]['id']}})['then'](handleEntityNotFound(_0x57fff9,null))['then'](function(_0x5f2c2d){if(_0x5f2c2d){_0x18795c=_0x5f2c2d;_0x5cfa99[_0x33ac('0x2d')]=_[_0x33ac('0x2f')](db['DeskField']['rawAttributes']);_0x5cfa99['query']=_['keys'](_0x462457['query']);_0x5cfa99[_0x33ac('0x30')]=_['intersection'](_0x5cfa99['model'],_0x5cfa99[_0x33ac('0x2e')]);_0x537fc8['attributes']=_[_0x33ac('0x31')](_0x5cfa99[_0x33ac('0x2d')],qs[_0x33ac('0x32')](_0x462457[_0x33ac('0x2e')]['fields']));_0x537fc8['attributes']=_0x537fc8['attributes'][_0x33ac('0x34')]?_0x537fc8['attributes']:_0x5cfa99['model'];_0x537fc8[_0x33ac('0x4c')]=qs[_0x33ac('0x37')](_0x462457['query'][_0x33ac('0x37')]);_0x537fc8[_0x33ac('0x38')]=qs[_0x33ac('0x30')](_['pick'](_0x462457['query'],_0x5cfa99[_0x33ac('0x30')]));if(_0x462457[_0x33ac('0x2e')][_0x33ac('0x3a')]){_0x537fc8['where']=_[_0x33ac('0x3b')](_0x537fc8[_0x33ac('0x38')],{'$or':_[_0x33ac('0x28')](_0x537fc8['attributes'],function(_0x1afab6){var _0x4359de={};_0x4359de[_0x1afab6]={'$like':'%'+_0x462457['query'][_0x33ac('0x3a')]+'%'};return _0x4359de;})});}_0x537fc8=_[_0x33ac('0x3b')]({},_0x537fc8,_0x462457['options']);return _0x18795c[_0x33ac('0x4e')](_0x537fc8);}})[_0x33ac('0x23')](function(_0x2fc7fc){if(_0x2fc7fc){_0x5ccbe3=_0x2fc7fc[_0x33ac('0x34')];if(!_0x462457[_0x33ac('0x2e')][_0x33ac('0x35')](_0x33ac('0x36'))){_0x537fc8[_0x33ac('0x1c')]=qs[_0x33ac('0x1c')](_0x462457['query'][_0x33ac('0x1c')]);_0x537fc8[_0x33ac('0x1b')]=qs[_0x33ac('0x1b')](_0x462457[_0x33ac('0x2e')][_0x33ac('0x1b')]);}return _0x18795c['getSubjects'](_0x537fc8);}})[_0x33ac('0x23')](function(_0x1c0bd6){if(_0x1c0bd6){return _0x1c0bd6?{'count':_0x5ccbe3,'rows':_0x1c0bd6}:null;}})[_0x33ac('0x23')](respondWithResult(_0x57fff9,null))[_0x33ac('0x43')](handleError(_0x57fff9,null));};exports[_0x33ac('0x4f')]=function(_0xd51f75,_0x4ba36d,_0x1fc85c){var _0x5c2cab={};var _0x4fe50f={};var _0x1851d6;var _0xc3820a;return db['DeskConfiguration'][_0x33ac('0x4a')]({'where':{'id':_0xd51f75[_0x33ac('0x45')]['id']}})[_0x33ac('0x23')](handleEntityNotFound(_0x4ba36d,null))['then'](function(_0x395519){if(_0x395519){_0x1851d6=_0x395519;_0x4fe50f['model']=_['keys'](db[_0x33ac('0x4b')]['rawAttributes']);_0x4fe50f['query']=_[_0x33ac('0x2f')](_0xd51f75[_0x33ac('0x2e')]);_0x4fe50f[_0x33ac('0x30')]=_[_0x33ac('0x31')](_0x4fe50f[_0x33ac('0x2d')],_0x4fe50f['query']);_0x5c2cab[_0x33ac('0x33')]=_[_0x33ac('0x31')](_0x4fe50f[_0x33ac('0x2d')],qs[_0x33ac('0x32')](_0xd51f75[_0x33ac('0x2e')][_0x33ac('0x32')]));_0x5c2cab[_0x33ac('0x33')]=_0x5c2cab[_0x33ac('0x33')][_0x33ac('0x34')]?_0x5c2cab[_0x33ac('0x33')]:_0x4fe50f[_0x33ac('0x2d')];_0x5c2cab['order']=qs['sort'](_0xd51f75[_0x33ac('0x2e')][_0x33ac('0x37')]);_0x5c2cab['where']=qs['filters'](_['pick'](_0xd51f75[_0x33ac('0x2e')],_0x4fe50f[_0x33ac('0x30')]));if(_0xd51f75[_0x33ac('0x2e')][_0x33ac('0x3a')]){_0x5c2cab[_0x33ac('0x38')]=_[_0x33ac('0x3b')](_0x5c2cab[_0x33ac('0x38')],{'$or':_[_0x33ac('0x28')](_0x5c2cab[_0x33ac('0x33')],function(_0x361876){var _0x590b99={};_0x590b99[_0x361876]={'$like':'%'+_0xd51f75['query'][_0x33ac('0x3a')]+'%'};return _0x590b99;})});}_0x5c2cab=_[_0x33ac('0x3b')]({},_0x5c2cab,_0xd51f75['options']);return _0x1851d6[_0x33ac('0x4f')](_0x5c2cab);}})[_0x33ac('0x23')](function(_0x40e59f){if(_0x40e59f){_0xc3820a=_0x40e59f['length'];if(!_0xd51f75[_0x33ac('0x2e')][_0x33ac('0x35')]('nolimit')){_0x5c2cab['limit']=qs[_0x33ac('0x1c')](_0xd51f75['query'][_0x33ac('0x1c')]);_0x5c2cab[_0x33ac('0x1b')]=qs[_0x33ac('0x1b')](_0xd51f75[_0x33ac('0x2e')][_0x33ac('0x1b')]);}return _0x1851d6[_0x33ac('0x4f')](_0x5c2cab);}})[_0x33ac('0x23')](function(_0x33f1ab){if(_0x33f1ab){return _0x33f1ab?{'count':_0xc3820a,'rows':_0x33f1ab}:null;}})[_0x33ac('0x23')](respondWithResult(_0x4ba36d,null))[_0x33ac('0x43')](handleError(_0x4ba36d,null));};exports[_0x33ac('0x50')]=function(_0x4af84b,_0x2baf5d,_0xc1b400){var _0x398f5e={};var _0x759003={};var _0x55d07b;var _0x419c32;return db[_0x33ac('0x3e')]['findOne']({'where':{'id':_0x4af84b[_0x33ac('0x45')]['id']}})[_0x33ac('0x23')](handleEntityNotFound(_0x2baf5d,null))['then'](function(_0x102665){if(_0x102665){_0x55d07b=_0x102665;_0x759003[_0x33ac('0x2d')]=_['keys'](db[_0x33ac('0x51')][_0x33ac('0x29')]);_0x759003['query']=_['keys'](_0x4af84b[_0x33ac('0x2e')]);_0x759003['filters']=_[_0x33ac('0x31')](_0x759003[_0x33ac('0x2d')],_0x759003[_0x33ac('0x2e')]);_0x398f5e[_0x33ac('0x33')]=_[_0x33ac('0x31')](_0x759003[_0x33ac('0x2d')],qs['fields'](_0x4af84b[_0x33ac('0x2e')][_0x33ac('0x32')]));_0x398f5e['attributes']=_0x398f5e[_0x33ac('0x33')][_0x33ac('0x34')]?_0x398f5e[_0x33ac('0x33')]:_0x759003[_0x33ac('0x2d')];_0x398f5e[_0x33ac('0x4c')]=qs[_0x33ac('0x37')](_0x4af84b[_0x33ac('0x2e')][_0x33ac('0x37')]);_0x398f5e[_0x33ac('0x38')]=qs[_0x33ac('0x30')](_[_0x33ac('0x39')](_0x4af84b[_0x33ac('0x2e')],_0x759003[_0x33ac('0x30')]));if(_0x4af84b[_0x33ac('0x2e')]['filter']){_0x398f5e['where']=_[_0x33ac('0x3b')](_0x398f5e['where'],{'$or':_[_0x33ac('0x28')](_0x398f5e[_0x33ac('0x33')],function(_0x1c7e82){var _0x1f5d0b={};_0x1f5d0b[_0x1c7e82]={'$like':'%'+_0x4af84b[_0x33ac('0x2e')][_0x33ac('0x3a')]+'%'};return _0x1f5d0b;})});}_0x398f5e=_[_0x33ac('0x3b')]({},_0x398f5e,_0x4af84b[_0x33ac('0x3d')]);return _0x55d07b[_0x33ac('0x50')](_0x398f5e);}})[_0x33ac('0x23')](function(_0x338531){if(_0x338531){_0x419c32=_0x338531['length'];if(!_0x4af84b[_0x33ac('0x2e')][_0x33ac('0x35')](_0x33ac('0x36'))){_0x398f5e[_0x33ac('0x1c')]=qs[_0x33ac('0x1c')](_0x4af84b['query'][_0x33ac('0x1c')]);_0x398f5e[_0x33ac('0x1b')]=qs['offset'](_0x4af84b[_0x33ac('0x2e')][_0x33ac('0x1b')]);}return _0x55d07b['getTags'](_0x398f5e);}})[_0x33ac('0x23')](function(_0x71aad){if(_0x71aad){return _0x71aad?{'count':_0x419c32,'rows':_0x71aad}:null;}})[_0x33ac('0x23')](respondWithResult(_0x2baf5d,null))[_0x33ac('0x43')](handleError(_0x2baf5d,null));};exports['setTags']=function(_0x476a57,_0x2760b2,_0x2388ad){if(_0x476a57['body']['id']){delete _0x476a57[_0x33ac('0x48')]['id'];}return db[_0x33ac('0x3e')]['findOne']({'where':{'id':_0x476a57[_0x33ac('0x45')]['id']}})[_0x33ac('0x23')](handleEntityNotFound(_0x2760b2,null))['then'](function(_0x2ef565){if(_0x2ef565){return _0x2ef565[_0x33ac('0x52')](_0x476a57[_0x33ac('0x48')]['ids']||[]);}return null;})[_0x33ac('0x23')](respondWithResult(_0x2760b2,null))[_0x33ac('0x43')](handleError(_0x2760b2,null));}; \ No newline at end of file +var _0x8475=['model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','include','find','create','body','params','destroy','getFields','findOne','DeskField','length','hasOwnProperty','getSubjects','getDescriptions','getTags','Tag','setTags','ids','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','DeskConfiguration','rawAttributes','fieldName','type','key'];(function(_0x23f558,_0x34d026){var _0x55e9ec=function(_0x7f94e){while(--_0x7f94e){_0x23f558['push'](_0x23f558['shift']());}};_0x55e9ec(++_0x34d026);}(_0x8475,0x1dd));var _0x5847=function(_0x184756,_0xa3e4bb){_0x184756=_0x184756-0x0;var _0x2c9784=_0x8475[_0x184756];return _0x2c9784;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x5847('0x0'));var jsonpatch=require(_0x5847('0x1'));var rp=require(_0x5847('0x2'));var moment=require(_0x5847('0x3'));var BPromise=require(_0x5847('0x4'));var Mustache=require(_0x5847('0x5'));var util=require(_0x5847('0x6'));var path=require('path');var sox=require(_0x5847('0x7'));var csv=require('to-csv');var ejs=require(_0x5847('0x8'));var fs=require('fs');var fs_extra=require(_0x5847('0x9'));var _=require(_0x5847('0xa'));var squel=require(_0x5847('0xb'));var crypto=require(_0x5847('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x5847('0xd'));var toCsv=require(_0x5847('0xe'));var querystring=require('querystring');var Papa=require(_0x5847('0xf'));var Redis=require(_0x5847('0x10'));var authService=require(_0x5847('0x11'));var qs=require(_0x5847('0x12'));var as=require(_0x5847('0x13'));var hardwareService=require(_0x5847('0x14'));var logger=require('../../config/logger')(_0x5847('0x15'));var utils=require(_0x5847('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x5847('0x17'));var db=require(_0x5847('0x18'))['db'];function respondWithStatusCode(_0x56f283,_0x14e2d3){_0x14e2d3=_0x14e2d3||0xcc;return function(_0x52633d){if(_0x52633d){return _0x56f283[_0x5847('0x19')](_0x14e2d3);}return _0x56f283[_0x5847('0x1a')](_0x14e2d3)[_0x5847('0x1b')]();};}function respondWithResult(_0x26f66b,_0x37cb45){_0x37cb45=_0x37cb45||0xc8;return function(_0x34e821){if(_0x34e821){return _0x26f66b['status'](_0x37cb45)[_0x5847('0x1c')](_0x34e821);}};}function respondWithFilteredResult(_0x4b4b19,_0x434af2){return function(_0x393e1e){if(_0x393e1e){var _0x38d139=typeof _0x434af2[_0x5847('0x1d')]==='undefined'&&typeof _0x434af2[_0x5847('0x1e')]===_0x5847('0x1f');var _0x3c25f7=_0x393e1e[_0x5847('0x20')];var _0x32ea7c=_0x38d139?0x0:_0x434af2[_0x5847('0x1d')];var _0x4a71a1=_0x38d139?_0x393e1e['count']:_0x434af2['offset']+_0x434af2[_0x5847('0x1e')];var _0x25810c;if(_0x4a71a1>=_0x3c25f7){_0x4a71a1=_0x3c25f7;_0x25810c=0xc8;}else{_0x25810c=0xce;}_0x4b4b19[_0x5847('0x1a')](_0x25810c);return _0x4b4b19[_0x5847('0x21')](_0x5847('0x22'),_0x32ea7c+'-'+_0x4a71a1+'/'+_0x3c25f7)['json'](_0x393e1e);}return null;};}function patchUpdates(_0x1a5ac0){return function(_0xc77eb3){try{jsonpatch[_0x5847('0x23')](_0xc77eb3,_0x1a5ac0,!![]);}catch(_0x554423){return BPromise[_0x5847('0x24')](_0x554423);}return _0xc77eb3[_0x5847('0x25')]();};}function saveUpdates(_0x456fbd,_0x1dbb5b){return function(_0x5a5f05){if(_0x5a5f05){return _0x5a5f05[_0x5847('0x26')](_0x456fbd)['then'](function(_0x10f64e){return _0x10f64e;});}return null;};}function removeEntity(_0x1df10d,_0x303188){return function(_0xe3c0bb){if(_0xe3c0bb){return _0xe3c0bb['destroy']()[_0x5847('0x27')](function(){_0x1df10d['status'](0xcc)[_0x5847('0x1b')]();});}};}function handleEntityNotFound(_0x9ea49e,_0x1b927f){return function(_0x2c0d5c){if(!_0x2c0d5c){_0x9ea49e[_0x5847('0x19')](0x194);}return _0x2c0d5c;};}function handleError(_0x2514b4,_0x13ff47){_0x13ff47=_0x13ff47||0x1f4;return function(_0x4b054d){logger[_0x5847('0x28')](_0x4b054d[_0x5847('0x29')]);if(_0x4b054d['name']){delete _0x4b054d[_0x5847('0x2a')];}_0x2514b4['status'](_0x13ff47)[_0x5847('0x2b')](_0x4b054d);};}exports[_0x5847('0x2c')]=function(_0x51a635,_0x52847f){var _0x46b110={},_0x29ad3d={},_0x29c2a4={'count':0x0,'rows':[]};var _0x598c10=_[_0x5847('0x2d')](db[_0x5847('0x2e')][_0x5847('0x2f')],function(_0x291cc6){return{'name':_0x291cc6[_0x5847('0x30')],'type':_0x291cc6[_0x5847('0x31')][_0x5847('0x32')]};});_0x29ad3d[_0x5847('0x33')]=_[_0x5847('0x2d')](_0x598c10,_0x5847('0x2a'));_0x29ad3d[_0x5847('0x34')]=_[_0x5847('0x35')](_0x51a635[_0x5847('0x34')]);_0x29ad3d[_0x5847('0x36')]=_[_0x5847('0x37')](_0x29ad3d[_0x5847('0x33')],_0x29ad3d[_0x5847('0x34')]);_0x46b110[_0x5847('0x38')]=_[_0x5847('0x37')](_0x29ad3d[_0x5847('0x33')],qs['fields'](_0x51a635[_0x5847('0x34')][_0x5847('0x39')]));_0x46b110[_0x5847('0x38')]=_0x46b110[_0x5847('0x38')]['length']?_0x46b110['attributes']:_0x29ad3d['model'];if(!_0x51a635[_0x5847('0x34')]['hasOwnProperty'](_0x5847('0x3a'))){_0x46b110[_0x5847('0x1e')]=qs['limit'](_0x51a635['query'][_0x5847('0x1e')]);_0x46b110[_0x5847('0x1d')]=qs[_0x5847('0x1d')](_0x51a635[_0x5847('0x34')][_0x5847('0x1d')]);}_0x46b110[_0x5847('0x3b')]=qs[_0x5847('0x3c')](_0x51a635[_0x5847('0x34')][_0x5847('0x3c')]);_0x46b110[_0x5847('0x3d')]=qs[_0x5847('0x36')](_[_0x5847('0x3e')](_0x51a635[_0x5847('0x34')],_0x29ad3d[_0x5847('0x36')]),_0x598c10);if(_0x51a635[_0x5847('0x34')][_0x5847('0x3f')]){_0x46b110[_0x5847('0x3d')]=_['merge'](_0x46b110[_0x5847('0x3d')],{'$or':_[_0x5847('0x2d')](_0x598c10,function(_0x6fc231){if(_0x6fc231['type']!==_0x5847('0x40')){var _0x54693c={};_0x54693c[_0x6fc231[_0x5847('0x2a')]]={'$like':'%'+_0x51a635[_0x5847('0x34')]['filter']+'%'};return _0x54693c;}})});}_0x46b110=_[_0x5847('0x41')]({},_0x46b110,_0x51a635[_0x5847('0x42')]);var _0x53c898={'where':_0x46b110[_0x5847('0x3d')]};return db[_0x5847('0x2e')][_0x5847('0x20')](_0x53c898)[_0x5847('0x27')](function(_0x3195e3){_0x29c2a4[_0x5847('0x20')]=_0x3195e3;if(_0x51a635[_0x5847('0x34')][_0x5847('0x43')]){_0x46b110['include']=[{'all':!![]}];}return db[_0x5847('0x2e')][_0x5847('0x44')](_0x46b110);})[_0x5847('0x27')](function(_0x36b18b){_0x29c2a4[_0x5847('0x45')]=_0x36b18b;return _0x29c2a4;})['then'](respondWithFilteredResult(_0x52847f,_0x46b110))[_0x5847('0x46')](handleError(_0x52847f,null));};exports['show']=function(_0x1de458,_0x6ae62e){var _0x1ccdcf={'raw':![],'where':{'id':_0x1de458['params']['id']}},_0x9a896c={};_0x9a896c[_0x5847('0x33')]=_['keys'](db['DeskConfiguration']['rawAttributes']);_0x9a896c['query']=_[_0x5847('0x35')](_0x1de458[_0x5847('0x34')]);_0x9a896c[_0x5847('0x36')]=_[_0x5847('0x37')](_0x9a896c[_0x5847('0x33')],_0x9a896c[_0x5847('0x34')]);_0x1ccdcf[_0x5847('0x38')]=_[_0x5847('0x37')](_0x9a896c[_0x5847('0x33')],qs[_0x5847('0x39')](_0x1de458['query']['fields']));_0x1ccdcf[_0x5847('0x38')]=_0x1ccdcf[_0x5847('0x38')]['length']?_0x1ccdcf[_0x5847('0x38')]:_0x9a896c[_0x5847('0x33')];if(_0x1de458[_0x5847('0x34')][_0x5847('0x43')]){_0x1ccdcf[_0x5847('0x47')]=[{'all':!![]}];}_0x1ccdcf=_[_0x5847('0x41')]({},_0x1ccdcf,_0x1de458[_0x5847('0x42')]);return db[_0x5847('0x2e')][_0x5847('0x48')](_0x1ccdcf)['then'](handleEntityNotFound(_0x6ae62e,null))[_0x5847('0x27')](respondWithResult(_0x6ae62e,null))['catch'](handleError(_0x6ae62e,null));};exports[_0x5847('0x49')]=function(_0x4267b5,_0x5bff5c){return db['DeskConfiguration'][_0x5847('0x49')](_0x4267b5[_0x5847('0x4a')],{})[_0x5847('0x27')](respondWithResult(_0x5bff5c,0xc9))[_0x5847('0x46')](handleError(_0x5bff5c,null));};exports[_0x5847('0x26')]=function(_0x14d32a,_0x37b302){if(_0x14d32a[_0x5847('0x4a')]['id']){delete _0x14d32a[_0x5847('0x4a')]['id'];}return db[_0x5847('0x2e')]['find']({'where':{'id':_0x14d32a[_0x5847('0x4b')]['id']}})['then'](handleEntityNotFound(_0x37b302,null))[_0x5847('0x27')](saveUpdates(_0x14d32a[_0x5847('0x4a')],null))[_0x5847('0x27')](respondWithResult(_0x37b302,null))[_0x5847('0x46')](handleError(_0x37b302,null));};exports[_0x5847('0x4c')]=function(_0x1be624,_0x520071){return db[_0x5847('0x2e')]['find']({'where':{'id':_0x1be624['params']['id']}})['then'](handleEntityNotFound(_0x520071,null))[_0x5847('0x27')](removeEntity(_0x520071,null))[_0x5847('0x46')](handleError(_0x520071,null));};exports[_0x5847('0x4d')]=function(_0x25e254,_0x14652e,_0x389ece){var _0x30dfd6={};var _0x4dc0e4={};var _0x2e1949;var _0x120b91;return db[_0x5847('0x2e')][_0x5847('0x4e')]({'where':{'id':_0x25e254[_0x5847('0x4b')]['id']}})[_0x5847('0x27')](handleEntityNotFound(_0x14652e,null))[_0x5847('0x27')](function(_0x19ae09){if(_0x19ae09){_0x2e1949=_0x19ae09;_0x4dc0e4['model']=_['keys'](db[_0x5847('0x4f')][_0x5847('0x2f')]);_0x4dc0e4[_0x5847('0x34')]=_[_0x5847('0x35')](_0x25e254[_0x5847('0x34')]);_0x4dc0e4[_0x5847('0x36')]=_[_0x5847('0x37')](_0x4dc0e4['model'],_0x4dc0e4[_0x5847('0x34')]);_0x30dfd6['attributes']=_[_0x5847('0x37')](_0x4dc0e4[_0x5847('0x33')],qs[_0x5847('0x39')](_0x25e254[_0x5847('0x34')][_0x5847('0x39')]));_0x30dfd6[_0x5847('0x38')]=_0x30dfd6[_0x5847('0x38')][_0x5847('0x50')]?_0x30dfd6[_0x5847('0x38')]:_0x4dc0e4[_0x5847('0x33')];_0x30dfd6[_0x5847('0x3b')]=qs[_0x5847('0x3c')](_0x25e254[_0x5847('0x34')][_0x5847('0x3c')]);_0x30dfd6['where']=qs[_0x5847('0x36')](_['pick'](_0x25e254[_0x5847('0x34')],_0x4dc0e4['filters']));if(_0x25e254[_0x5847('0x34')][_0x5847('0x3f')]){_0x30dfd6[_0x5847('0x3d')]=_[_0x5847('0x41')](_0x30dfd6['where'],{'$or':_[_0x5847('0x2d')](_0x30dfd6['attributes'],function(_0x12d695){var _0x1b28e2={};_0x1b28e2[_0x12d695]={'$like':'%'+_0x25e254[_0x5847('0x34')][_0x5847('0x3f')]+'%'};return _0x1b28e2;})});}_0x30dfd6=_[_0x5847('0x41')]({},_0x30dfd6,_0x25e254[_0x5847('0x42')]);return _0x2e1949[_0x5847('0x4d')](_0x30dfd6);}})[_0x5847('0x27')](function(_0x54ec04){if(_0x54ec04){_0x120b91=_0x54ec04[_0x5847('0x50')];if(!_0x25e254[_0x5847('0x34')][_0x5847('0x51')](_0x5847('0x3a'))){_0x30dfd6[_0x5847('0x1e')]=qs[_0x5847('0x1e')](_0x25e254[_0x5847('0x34')][_0x5847('0x1e')]);_0x30dfd6['offset']=qs['offset'](_0x25e254['query'][_0x5847('0x1d')]);}return _0x2e1949[_0x5847('0x4d')](_0x30dfd6);}})[_0x5847('0x27')](function(_0x2f4bf0){if(_0x2f4bf0){return _0x2f4bf0?{'count':_0x120b91,'rows':_0x2f4bf0}:null;}})['then'](respondWithResult(_0x14652e,null))[_0x5847('0x46')](handleError(_0x14652e,null));};exports['getSubjects']=function(_0x84a2dc,_0x1eee4e,_0x318f16){var _0x2ef9d1={};var _0x294989={};var _0x31b98e;var _0xc58c32;return db[_0x5847('0x2e')][_0x5847('0x4e')]({'where':{'id':_0x84a2dc[_0x5847('0x4b')]['id']}})[_0x5847('0x27')](handleEntityNotFound(_0x1eee4e,null))[_0x5847('0x27')](function(_0x273fb8){if(_0x273fb8){_0x31b98e=_0x273fb8;_0x294989[_0x5847('0x33')]=_[_0x5847('0x35')](db['DeskField'][_0x5847('0x2f')]);_0x294989[_0x5847('0x34')]=_[_0x5847('0x35')](_0x84a2dc[_0x5847('0x34')]);_0x294989[_0x5847('0x36')]=_[_0x5847('0x37')](_0x294989[_0x5847('0x33')],_0x294989[_0x5847('0x34')]);_0x2ef9d1[_0x5847('0x38')]=_['intersection'](_0x294989[_0x5847('0x33')],qs[_0x5847('0x39')](_0x84a2dc['query'][_0x5847('0x39')]));_0x2ef9d1[_0x5847('0x38')]=_0x2ef9d1[_0x5847('0x38')][_0x5847('0x50')]?_0x2ef9d1['attributes']:_0x294989[_0x5847('0x33')];_0x2ef9d1['order']=qs[_0x5847('0x3c')](_0x84a2dc[_0x5847('0x34')][_0x5847('0x3c')]);_0x2ef9d1[_0x5847('0x3d')]=qs[_0x5847('0x36')](_[_0x5847('0x3e')](_0x84a2dc['query'],_0x294989[_0x5847('0x36')]));if(_0x84a2dc['query'][_0x5847('0x3f')]){_0x2ef9d1[_0x5847('0x3d')]=_[_0x5847('0x41')](_0x2ef9d1['where'],{'$or':_[_0x5847('0x2d')](_0x2ef9d1['attributes'],function(_0x385d45){var _0x86a6b2={};_0x86a6b2[_0x385d45]={'$like':'%'+_0x84a2dc[_0x5847('0x34')][_0x5847('0x3f')]+'%'};return _0x86a6b2;})});}_0x2ef9d1=_[_0x5847('0x41')]({},_0x2ef9d1,_0x84a2dc['options']);return _0x31b98e['getSubjects'](_0x2ef9d1);}})[_0x5847('0x27')](function(_0x417bd0){if(_0x417bd0){_0xc58c32=_0x417bd0[_0x5847('0x50')];if(!_0x84a2dc[_0x5847('0x34')][_0x5847('0x51')]('nolimit')){_0x2ef9d1['limit']=qs[_0x5847('0x1e')](_0x84a2dc[_0x5847('0x34')][_0x5847('0x1e')]);_0x2ef9d1[_0x5847('0x1d')]=qs[_0x5847('0x1d')](_0x84a2dc['query']['offset']);}return _0x31b98e[_0x5847('0x52')](_0x2ef9d1);}})[_0x5847('0x27')](function(_0x4b2451){if(_0x4b2451){return _0x4b2451?{'count':_0xc58c32,'rows':_0x4b2451}:null;}})['then'](respondWithResult(_0x1eee4e,null))[_0x5847('0x46')](handleError(_0x1eee4e,null));};exports[_0x5847('0x53')]=function(_0x182b30,_0x503ba6,_0x213270){var _0x1a7b19={};var _0xbda48b={};var _0x42be35;var _0x594e94;return db['DeskConfiguration'][_0x5847('0x4e')]({'where':{'id':_0x182b30[_0x5847('0x4b')]['id']}})[_0x5847('0x27')](handleEntityNotFound(_0x503ba6,null))[_0x5847('0x27')](function(_0x2cd833){if(_0x2cd833){_0x42be35=_0x2cd833;_0xbda48b[_0x5847('0x33')]=_['keys'](db[_0x5847('0x4f')]['rawAttributes']);_0xbda48b[_0x5847('0x34')]=_['keys'](_0x182b30[_0x5847('0x34')]);_0xbda48b['filters']=_['intersection'](_0xbda48b[_0x5847('0x33')],_0xbda48b[_0x5847('0x34')]);_0x1a7b19[_0x5847('0x38')]=_[_0x5847('0x37')](_0xbda48b[_0x5847('0x33')],qs[_0x5847('0x39')](_0x182b30[_0x5847('0x34')][_0x5847('0x39')]));_0x1a7b19[_0x5847('0x38')]=_0x1a7b19[_0x5847('0x38')]['length']?_0x1a7b19['attributes']:_0xbda48b['model'];_0x1a7b19[_0x5847('0x3b')]=qs[_0x5847('0x3c')](_0x182b30[_0x5847('0x34')][_0x5847('0x3c')]);_0x1a7b19[_0x5847('0x3d')]=qs[_0x5847('0x36')](_['pick'](_0x182b30['query'],_0xbda48b[_0x5847('0x36')]));if(_0x182b30[_0x5847('0x34')][_0x5847('0x3f')]){_0x1a7b19[_0x5847('0x3d')]=_[_0x5847('0x41')](_0x1a7b19['where'],{'$or':_[_0x5847('0x2d')](_0x1a7b19['attributes'],function(_0x5eae0c){var _0x296e1c={};_0x296e1c[_0x5eae0c]={'$like':'%'+_0x182b30[_0x5847('0x34')]['filter']+'%'};return _0x296e1c;})});}_0x1a7b19=_[_0x5847('0x41')]({},_0x1a7b19,_0x182b30[_0x5847('0x42')]);return _0x42be35[_0x5847('0x53')](_0x1a7b19);}})[_0x5847('0x27')](function(_0xa98bf4){if(_0xa98bf4){_0x594e94=_0xa98bf4['length'];if(!_0x182b30[_0x5847('0x34')]['hasOwnProperty'](_0x5847('0x3a'))){_0x1a7b19[_0x5847('0x1e')]=qs[_0x5847('0x1e')](_0x182b30['query']['limit']);_0x1a7b19['offset']=qs['offset'](_0x182b30[_0x5847('0x34')]['offset']);}return _0x42be35[_0x5847('0x53')](_0x1a7b19);}})['then'](function(_0x244c3b){if(_0x244c3b){return _0x244c3b?{'count':_0x594e94,'rows':_0x244c3b}:null;}})[_0x5847('0x27')](respondWithResult(_0x503ba6,null))['catch'](handleError(_0x503ba6,null));};exports[_0x5847('0x54')]=function(_0x51721e,_0x5ea75a,_0x3eed8f){var _0x16f4c3={};var _0x21b3a5={};var _0x3144b1;var _0x18eea7;return db[_0x5847('0x2e')][_0x5847('0x4e')]({'where':{'id':_0x51721e[_0x5847('0x4b')]['id']}})[_0x5847('0x27')](handleEntityNotFound(_0x5ea75a,null))['then'](function(_0x3e0217){if(_0x3e0217){_0x3144b1=_0x3e0217;_0x21b3a5[_0x5847('0x33')]=_[_0x5847('0x35')](db[_0x5847('0x55')]['rawAttributes']);_0x21b3a5['query']=_[_0x5847('0x35')](_0x51721e[_0x5847('0x34')]);_0x21b3a5[_0x5847('0x36')]=_[_0x5847('0x37')](_0x21b3a5['model'],_0x21b3a5[_0x5847('0x34')]);_0x16f4c3[_0x5847('0x38')]=_[_0x5847('0x37')](_0x21b3a5[_0x5847('0x33')],qs[_0x5847('0x39')](_0x51721e[_0x5847('0x34')][_0x5847('0x39')]));_0x16f4c3[_0x5847('0x38')]=_0x16f4c3[_0x5847('0x38')][_0x5847('0x50')]?_0x16f4c3[_0x5847('0x38')]:_0x21b3a5[_0x5847('0x33')];_0x16f4c3[_0x5847('0x3b')]=qs[_0x5847('0x3c')](_0x51721e[_0x5847('0x34')][_0x5847('0x3c')]);_0x16f4c3[_0x5847('0x3d')]=qs[_0x5847('0x36')](_[_0x5847('0x3e')](_0x51721e[_0x5847('0x34')],_0x21b3a5[_0x5847('0x36')]));if(_0x51721e['query'][_0x5847('0x3f')]){_0x16f4c3[_0x5847('0x3d')]=_[_0x5847('0x41')](_0x16f4c3['where'],{'$or':_['map'](_0x16f4c3[_0x5847('0x38')],function(_0x2a3092){var _0x135f7e={};_0x135f7e[_0x2a3092]={'$like':'%'+_0x51721e[_0x5847('0x34')]['filter']+'%'};return _0x135f7e;})});}_0x16f4c3=_[_0x5847('0x41')]({},_0x16f4c3,_0x51721e[_0x5847('0x42')]);return _0x3144b1[_0x5847('0x54')](_0x16f4c3);}})['then'](function(_0x6e271e){if(_0x6e271e){_0x18eea7=_0x6e271e[_0x5847('0x50')];if(!_0x51721e['query'][_0x5847('0x51')](_0x5847('0x3a'))){_0x16f4c3[_0x5847('0x1e')]=qs[_0x5847('0x1e')](_0x51721e[_0x5847('0x34')][_0x5847('0x1e')]);_0x16f4c3[_0x5847('0x1d')]=qs[_0x5847('0x1d')](_0x51721e[_0x5847('0x34')][_0x5847('0x1d')]);}return _0x3144b1[_0x5847('0x54')](_0x16f4c3);}})[_0x5847('0x27')](function(_0x4624a9){if(_0x4624a9){return _0x4624a9?{'count':_0x18eea7,'rows':_0x4624a9}:null;}})[_0x5847('0x27')](respondWithResult(_0x5ea75a,null))[_0x5847('0x46')](handleError(_0x5ea75a,null));};exports[_0x5847('0x56')]=function(_0x34c6f5,_0x3fafdc,_0x335e44){if(_0x34c6f5[_0x5847('0x4a')]['id']){delete _0x34c6f5['body']['id'];}return db['DeskConfiguration'][_0x5847('0x4e')]({'where':{'id':_0x34c6f5['params']['id']}})[_0x5847('0x27')](handleEntityNotFound(_0x3fafdc,null))[_0x5847('0x27')](function(_0x49c98d){if(_0x49c98d){return _0x49c98d[_0x5847('0x56')](_0x34c6f5['body'][_0x5847('0x57')]||[]);}return null;})['then'](respondWithResult(_0x3fafdc,null))[_0x5847('0x46')](handleError(_0x3fafdc,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 1faeb7f..75ee78c 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 _0xde71=['path','rimraf','../../config/environment','./intDeskConfiguration.attributes','define','DeskConfiguration','int_desk_configurations','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x3d8a92,_0x2bd8aa){var _0x19fb63=function(_0x265f54){while(--_0x265f54){_0x3d8a92['push'](_0x3d8a92['shift']());}};_0x19fb63(++_0x2bd8aa);}(_0xde71,0x1c1));var _0x1de7=function(_0x343e44,_0x519af9){_0x343e44=_0x343e44-0x0;var _0xa5130e=_0xde71[_0x343e44];return _0xa5130e;};'use strict';var _=require(_0x1de7('0x0'));var util=require(_0x1de7('0x1'));var logger=require(_0x1de7('0x2'))(_0x1de7('0x3'));var moment=require('moment');var BPromise=require(_0x1de7('0x4'));var rp=require(_0x1de7('0x5'));var fs=require('fs');var path=require(_0x1de7('0x6'));var rimraf=require(_0x1de7('0x7'));var config=require(_0x1de7('0x8'));var attributes=require(_0x1de7('0x9'));module['exports']=function(_0x34d17a,_0xd38b7f){return _0x34d17a[_0x1de7('0xa')](_0x1de7('0xb'),attributes,{'tableName':_0x1de7('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe889=['lodash','util','bluebird','request-promise','rimraf','../../config/environment','DeskConfiguration','int_desk_configurations'];(function(_0x37731b,_0x5095e9){var _0x5a5cce=function(_0x1bdff4){while(--_0x1bdff4){_0x37731b['push'](_0x37731b['shift']());}};_0x5a5cce(++_0x5095e9);}(_0xe889,0x88));var _0x9e88=function(_0x111d21,_0x523f39){_0x111d21=_0x111d21-0x0;var _0xe89373=_0xe889[_0x111d21];return _0xe89373;};'use strict';var _=require(_0x9e88('0x0'));var util=require(_0x9e88('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x9e88('0x2'));var rp=require(_0x9e88('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9e88('0x4'));var config=require(_0x9e88('0x5'));var attributes=require('./intDeskConfiguration.attributes');module['exports']=function(_0x527a2a,_0x28bdcf){return _0x527a2a['define'](_0x9e88('0x6'),attributes,{'tableName':_0x9e88('0x7'),'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 c7e38bf..96ef908 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 _0x4f31=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','info','DeskConfiguration,\x20%s,\x20%s','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','lodash','util','bluebird','ioredis'];(function(_0x2212d1,_0x483fc8){var _0x15eec5=function(_0x15e6ac){while(--_0x15e6ac){_0x2212d1['push'](_0x2212d1['shift']());}};_0x15eec5(++_0x483fc8);}(_0x4f31,0x13f));var _0x14f3=function(_0x448691,_0x191d08){_0x448691=_0x448691-0x0;var _0x510dde=_0x4f31[_0x448691];return _0x510dde;};'use strict';var _=require(_0x14f3('0x0'));var util=require(_0x14f3('0x1'));var moment=require('moment');var BPromise=require(_0x14f3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x14f3('0x3'));var db=require(_0x14f3('0x4'))['db'];var utils=require(_0x14f3('0x5'));var logger=require(_0x14f3('0x6'))('rpc');var config=require(_0x14f3('0x7'));var jayson=require(_0x14f3('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x111fd0,_0xcff316,_0xfe48f7){return new BPromise(function(_0x314584,_0x541973){return client['request'](_0x111fd0,_0xfe48f7)['then'](function(_0x22de60){logger[_0x14f3('0x9')](_0x14f3('0xa'),_0xcff316,'request\x20sent');logger[_0x14f3('0xb')](_0x14f3('0xc'),_0xcff316,_0x14f3('0xd'),JSON[_0x14f3('0xe')](_0x22de60));if(_0x22de60['error']){if(_0x22de60['error'][_0x14f3('0xf')]===0x1f4){logger[_0x14f3('0x10')]('DeskConfiguration,\x20%s,\x20%s',_0xcff316,_0x22de60[_0x14f3('0x10')]['message']);return _0x541973(_0x22de60[_0x14f3('0x10')][_0x14f3('0x11')]);}logger[_0x14f3('0x10')](_0x14f3('0xa'),_0xcff316,_0x22de60[_0x14f3('0x10')][_0x14f3('0x11')]);return _0x314584(_0x22de60['error'][_0x14f3('0x11')]);}else{logger[_0x14f3('0x9')]('DeskConfiguration,\x20%s,\x20%s',_0xcff316,'request\x20sent');_0x314584(_0x22de60[_0x14f3('0x12')]['message']);}})['catch'](function(_0xb241bd){logger['error'](_0x14f3('0xa'),_0xcff316,_0xb241bd);_0x541973(_0xb241bd);});});} \ No newline at end of file +var _0xeb85=['message','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','DeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','DeskConfiguration,\x20%s,\x20%s','info'];(function(_0x432db1,_0x2cfb08){var _0x1c31fc=function(_0x20108e){while(--_0x20108e){_0x432db1['push'](_0x432db1['shift']());}};_0x1c31fc(++_0x2cfb08);}(_0xeb85,0x167));var _0x5eb8=function(_0x8a5bfa,_0x510b76){_0x8a5bfa=_0x8a5bfa-0x0;var _0x24cece=_0xeb85[_0x8a5bfa];return _0x24cece;};'use strict';var _=require('lodash');var util=require(_0x5eb8('0x0'));var moment=require(_0x5eb8('0x1'));var BPromise=require(_0x5eb8('0x2'));var rs=require(_0x5eb8('0x3'));var fs=require('fs');var Redis=require(_0x5eb8('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5eb8('0x5'));var logger=require(_0x5eb8('0x6'))('rpc');var config=require(_0x5eb8('0x7'));var jayson=require(_0x5eb8('0x8'));var client=jayson['client'][_0x5eb8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1b402e,_0x2e9793,_0x4e8b5e){return new BPromise(function(_0x3f7fb5,_0x44b372){return client[_0x5eb8('0xa')](_0x1b402e,_0x4e8b5e)[_0x5eb8('0xb')](function(_0x6a139a){logger['info']('DeskConfiguration,\x20%s,\x20%s',_0x2e9793,'request\x20sent');logger['debug'](_0x5eb8('0xc'),_0x2e9793,_0x5eb8('0xd'),JSON[_0x5eb8('0xe')](_0x6a139a));if(_0x6a139a[_0x5eb8('0xf')]){if(_0x6a139a['error'][_0x5eb8('0x10')]===0x1f4){logger[_0x5eb8('0xf')](_0x5eb8('0x11'),_0x2e9793,_0x6a139a[_0x5eb8('0xf')]['message']);return _0x44b372(_0x6a139a[_0x5eb8('0xf')]['message']);}logger[_0x5eb8('0xf')](_0x5eb8('0x11'),_0x2e9793,_0x6a139a[_0x5eb8('0xf')]['message']);return _0x3f7fb5(_0x6a139a['error']['message']);}else{logger[_0x5eb8('0x12')](_0x5eb8('0x11'),_0x2e9793,_0x5eb8('0xd'));_0x3f7fb5(_0x6a139a['result'][_0x5eb8('0x13')]);}})[_0x5eb8('0x14')](function(_0x94b3ae){logger[_0x5eb8('0xf')]('DeskConfiguration,\x20%s,\x20%s',_0x2e9793,_0x94b3ae);_0x44b372(_0x94b3ae);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 757d2ec..937ebb5 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 _0x17c1=['get','isAuthenticated','index','/:id','post','put','update','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3565c7,_0x21db85){var _0x4eb77c=function(_0x13b47b){while(--_0x13b47b){_0x3565c7['push'](_0x3565c7['shift']());}};_0x4eb77c(++_0x21db85);}(_0x17c1,0x184));var _0x117c=function(_0x4aa5d2,_0x2b9544){_0x4aa5d2=_0x4aa5d2-0x0;var _0x363711=_0x17c1[_0x4aa5d2];return _0x363711;};'use strict';var multer=require(_0x117c('0x0'));var util=require(_0x117c('0x1'));var path=require('path');var timeout=require(_0x117c('0x2'));var express=require('express');var router=express[_0x117c('0x3')]();var fs_extra=require(_0x117c('0x4'));var auth=require(_0x117c('0x5'));var interaction=require(_0x117c('0x6'));var config=require(_0x117c('0x7'));var controller=require('./intDeskField.controller');router[_0x117c('0x8')]('/',auth[_0x117c('0x9')](),controller[_0x117c('0xa')]);router[_0x117c('0x8')](_0x117c('0xb'),auth[_0x117c('0x9')](),controller['show']);router[_0x117c('0xc')]('/',auth[_0x117c('0x9')](),controller['create']);router[_0x117c('0xd')]('/:id',auth[_0x117c('0x9')](),controller[_0x117c('0xe')]);router[_0x117c('0xf')](_0x117c('0xb'),auth[_0x117c('0x9')](),controller[_0x117c('0x10')]);module[_0x117c('0x11')]=router; \ No newline at end of file +var _0xe884=['isAuthenticated','index','/:id','post','create','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','get'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0xe884,0x1d3));var _0x4e88=function(_0x2b1725,_0x5d7dc6){_0x2b1725=_0x2b1725-0x0;var _0xaa90cf=_0xe884[_0x2b1725];return _0xaa90cf;};'use strict';var multer=require(_0x4e88('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x4e88('0x1'));var express=require(_0x4e88('0x2'));var router=express[_0x4e88('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x4e88('0x4'));var interaction=require(_0x4e88('0x5'));var config=require(_0x4e88('0x6'));var controller=require(_0x4e88('0x7'));router[_0x4e88('0x8')]('/',auth[_0x4e88('0x9')](),controller[_0x4e88('0xa')]);router['get'](_0x4e88('0xb'),auth[_0x4e88('0x9')](),controller['show']);router[_0x4e88('0xc')]('/',auth[_0x4e88('0x9')](),controller[_0x4e88('0xd')]);router['put'](_0x4e88('0xb'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x4e88('0xb'),auth[_0x4e88('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index fb0cefe..0002d01 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 _0x56cd=['picklist','STRING','BOOLEAN','exports','ENUM','string','variable','customVariable','keyValue'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x56cd,0x12c));var _0xd56c=function(_0x53cf8e,_0x3d290f){_0x53cf8e=_0x53cf8e-0x0;var _0x459197=_0x56cd[_0x53cf8e];return _0x459197;};'use strict';var Sequelize=require('sequelize');module[_0xd56c('0x0')]={'type':{'type':Sequelize[_0xd56c('0x1')](_0xd56c('0x2'),_0xd56c('0x3'),_0xd56c('0x4'),_0xd56c('0x5'),_0xd56c('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0xd56c('0x7')]},'key':{'type':Sequelize[_0xd56c('0x7')]},'keyType':{'type':Sequelize[_0xd56c('0x1')]('string',_0xd56c('0x3'),_0xd56c('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xd56c('0x7')]},'nameField':{'type':Sequelize[_0xd56c('0x7')]},'customField':{'type':Sequelize[_0xd56c('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xba4a=['ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports'];(function(_0x5d7686,_0x5d11b1){var _0x408ab4=function(_0x424411){while(--_0x424411){_0x5d7686['push'](_0x5d7686['shift']());}};_0x408ab4(++_0x5d11b1);}(_0xba4a,0x1ac));var _0xaba4=function(_0x3bc803,_0x3a5146){_0x3bc803=_0x3bc803-0x0;var _0x2eb606=_0xba4a[_0x3bc803];return _0x2eb606;};'use strict';var Sequelize=require(_0xaba4('0x0'));module[_0xaba4('0x1')]={'type':{'type':Sequelize[_0xaba4('0x2')](_0xaba4('0x3'),_0xaba4('0x4'),_0xaba4('0x5'),_0xaba4('0x6'),_0xaba4('0x7')),'defaultValue':'string'},'content':{'type':Sequelize[_0xaba4('0x8')]},'key':{'type':Sequelize[_0xaba4('0x8')]},'keyType':{'type':Sequelize[_0xaba4('0x2')](_0xaba4('0x3'),_0xaba4('0x4'),_0xaba4('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xaba4('0x8')]},'nameField':{'type':Sequelize[_0xaba4('0x8')]},'customField':{'type':Sequelize[_0xaba4('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xaba4('0x8')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 23f1974..2fef573 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 _0x49fe=['set','json','apply','reject','save','update','then','destroy','stack','name','send','map','DeskField','rawAttributes','fieldName','type','model','query','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','keys','find','catch','create','body','eml-format','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count'];(function(_0x2080a3,_0x48acfa){var _0x8d7d17=function(_0x2dbc06){while(--_0x2dbc06){_0x2080a3['push'](_0x2080a3['shift']());}};_0x8d7d17(++_0x48acfa);}(_0x49fe,0x75));var _0xe49f=function(_0x2c3b19,_0x120e6e){_0x2c3b19=_0x2c3b19-0x0;var _0xacf5d3=_0x49fe[_0x2c3b19];return _0xacf5d3;};'use strict';var emlformat=require(_0xe49f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe49f('0x1'));var moment=require(_0xe49f('0x2'));var BPromise=require(_0xe49f('0x3'));var Mustache=require(_0xe49f('0x4'));var util=require(_0xe49f('0x5'));var path=require(_0xe49f('0x6'));var sox=require(_0xe49f('0x7'));var csv=require(_0xe49f('0x8'));var ejs=require(_0xe49f('0x9'));var fs=require('fs');var fs_extra=require(_0xe49f('0xa'));var _=require(_0xe49f('0xb'));var squel=require(_0xe49f('0xc'));var crypto=require(_0xe49f('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xe49f('0xe'));var toCsv=require(_0xe49f('0x8'));var querystring=require('querystring');var Papa=require(_0xe49f('0xf'));var Redis=require('ioredis');var authService=require(_0xe49f('0x10'));var qs=require(_0xe49f('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe49f('0x12'));var logger=require(_0xe49f('0x13'))(_0xe49f('0x14'));var utils=require(_0xe49f('0x15'));var config=require(_0xe49f('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xe49f('0x17'))['db'];function respondWithStatusCode(_0x3958bd,_0x504081){_0x504081=_0x504081||0xcc;return function(_0x10517d){if(_0x10517d){return _0x3958bd[_0xe49f('0x18')](_0x504081);}return _0x3958bd[_0xe49f('0x19')](_0x504081)[_0xe49f('0x1a')]();};}function respondWithResult(_0x44c7fe,_0x5708d9){_0x5708d9=_0x5708d9||0xc8;return function(_0x3645e8){if(_0x3645e8){return _0x44c7fe[_0xe49f('0x19')](_0x5708d9)['json'](_0x3645e8);}};}function respondWithFilteredResult(_0x4f3550,_0xfe24b7){return function(_0x3e5fb3){if(_0x3e5fb3){var _0x1e8eb8=typeof _0xfe24b7[_0xe49f('0x1b')]===_0xe49f('0x1c')&&typeof _0xfe24b7[_0xe49f('0x1d')]==='undefined';var _0x7831f1=_0x3e5fb3['count'];var _0x6ab378=_0x1e8eb8?0x0:_0xfe24b7['offset'];var _0x58f852=_0x1e8eb8?_0x3e5fb3[_0xe49f('0x1e')]:_0xfe24b7[_0xe49f('0x1b')]+_0xfe24b7['limit'];var _0x7a5643;if(_0x58f852>=_0x7831f1){_0x58f852=_0x7831f1;_0x7a5643=0xc8;}else{_0x7a5643=0xce;}_0x4f3550['status'](_0x7a5643);return _0x4f3550[_0xe49f('0x1f')]('Content-Range',_0x6ab378+'-'+_0x58f852+'/'+_0x7831f1)[_0xe49f('0x20')](_0x3e5fb3);}return null;};}function patchUpdates(_0x47b09a){return function(_0x4c4dcf){try{jsonpatch[_0xe49f('0x21')](_0x4c4dcf,_0x47b09a,!![]);}catch(_0x5b50e0){return BPromise[_0xe49f('0x22')](_0x5b50e0);}return _0x4c4dcf[_0xe49f('0x23')]();};}function saveUpdates(_0x40129c,_0x1647d1){return function(_0x424927){if(_0x424927){return _0x424927[_0xe49f('0x24')](_0x40129c)[_0xe49f('0x25')](function(_0x3d4146){return _0x3d4146;});}return null;};}function removeEntity(_0x233646,_0x2a2926){return function(_0x2bc2b2){if(_0x2bc2b2){return _0x2bc2b2[_0xe49f('0x26')]()[_0xe49f('0x25')](function(){_0x233646['status'](0xcc)[_0xe49f('0x1a')]();});}};}function handleEntityNotFound(_0x298cba,_0xbe357){return function(_0x14d820){if(!_0x14d820){_0x298cba['sendStatus'](0x194);}return _0x14d820;};}function handleError(_0x4ca90a,_0x1ff78c){_0x1ff78c=_0x1ff78c||0x1f4;return function(_0x44b702){logger['error'](_0x44b702[_0xe49f('0x27')]);if(_0x44b702['name']){delete _0x44b702[_0xe49f('0x28')];}_0x4ca90a[_0xe49f('0x19')](_0x1ff78c)[_0xe49f('0x29')](_0x44b702);};}exports['index']=function(_0x557b4e,_0x1357f6){var _0x32406b={},_0x298248={},_0x268f6e={'count':0x0,'rows':[]};var _0x4be6fc=_[_0xe49f('0x2a')](db[_0xe49f('0x2b')][_0xe49f('0x2c')],function(_0x1b3280){return{'name':_0x1b3280[_0xe49f('0x2d')],'type':_0x1b3280[_0xe49f('0x2e')]['key']};});_0x298248[_0xe49f('0x2f')]=_[_0xe49f('0x2a')](_0x4be6fc,_0xe49f('0x28'));_0x298248[_0xe49f('0x30')]=_['keys'](_0x557b4e['query']);_0x298248[_0xe49f('0x31')]=_[_0xe49f('0x32')](_0x298248[_0xe49f('0x2f')],_0x298248['query']);_0x32406b['attributes']=_[_0xe49f('0x32')](_0x298248[_0xe49f('0x2f')],qs[_0xe49f('0x33')](_0x557b4e['query'][_0xe49f('0x33')]));_0x32406b['attributes']=_0x32406b['attributes'][_0xe49f('0x34')]?_0x32406b[_0xe49f('0x35')]:_0x298248[_0xe49f('0x2f')];if(!_0x557b4e['query'][_0xe49f('0x36')](_0xe49f('0x37'))){_0x32406b['limit']=qs['limit'](_0x557b4e[_0xe49f('0x30')][_0xe49f('0x1d')]);_0x32406b[_0xe49f('0x1b')]=qs[_0xe49f('0x1b')](_0x557b4e['query'][_0xe49f('0x1b')]);}_0x32406b[_0xe49f('0x38')]=qs[_0xe49f('0x39')](_0x557b4e[_0xe49f('0x30')][_0xe49f('0x39')]);_0x32406b[_0xe49f('0x3a')]=qs[_0xe49f('0x31')](_[_0xe49f('0x3b')](_0x557b4e[_0xe49f('0x30')],_0x298248[_0xe49f('0x31')]),_0x4be6fc);if(_0x557b4e[_0xe49f('0x30')][_0xe49f('0x3c')]){_0x32406b[_0xe49f('0x3a')]=_[_0xe49f('0x3d')](_0x32406b[_0xe49f('0x3a')],{'$or':_[_0xe49f('0x2a')](_0x4be6fc,function(_0x1edf31){if(_0x1edf31[_0xe49f('0x2e')]!==_0xe49f('0x3e')){var _0x3d1380={};_0x3d1380[_0x1edf31[_0xe49f('0x28')]]={'$like':'%'+_0x557b4e[_0xe49f('0x30')][_0xe49f('0x3c')]+'%'};return _0x3d1380;}})});}_0x32406b=_['merge']({},_0x32406b,_0x557b4e[_0xe49f('0x3f')]);var _0x2efd45={'where':_0x32406b[_0xe49f('0x3a')]};return db['DeskField'][_0xe49f('0x1e')](_0x2efd45)['then'](function(_0x5cdf86){_0x268f6e[_0xe49f('0x1e')]=_0x5cdf86;if(_0x557b4e[_0xe49f('0x30')]['includeAll']){_0x32406b[_0xe49f('0x40')]=[{'all':!![]}];}return db[_0xe49f('0x2b')][_0xe49f('0x41')](_0x32406b);})[_0xe49f('0x25')](function(_0x36422e){_0x268f6e[_0xe49f('0x42')]=_0x36422e;return _0x268f6e;})[_0xe49f('0x25')](respondWithFilteredResult(_0x1357f6,_0x32406b))['catch'](handleError(_0x1357f6,null));};exports[_0xe49f('0x43')]=function(_0xbe91d2,_0x370162){var _0x2fb5f4={'raw':!![],'where':{'id':_0xbe91d2[_0xe49f('0x44')]['id']}},_0xd4341f={};_0xd4341f['model']=_[_0xe49f('0x45')](db[_0xe49f('0x2b')][_0xe49f('0x2c')]);_0xd4341f[_0xe49f('0x30')]=_[_0xe49f('0x45')](_0xbe91d2[_0xe49f('0x30')]);_0xd4341f[_0xe49f('0x31')]=_[_0xe49f('0x32')](_0xd4341f['model'],_0xd4341f['query']);_0x2fb5f4[_0xe49f('0x35')]=_['intersection'](_0xd4341f[_0xe49f('0x2f')],qs[_0xe49f('0x33')](_0xbe91d2[_0xe49f('0x30')][_0xe49f('0x33')]));_0x2fb5f4['attributes']=_0x2fb5f4[_0xe49f('0x35')][_0xe49f('0x34')]?_0x2fb5f4[_0xe49f('0x35')]:_0xd4341f['model'];if(_0xbe91d2[_0xe49f('0x30')]['includeAll']){_0x2fb5f4[_0xe49f('0x40')]=[{'all':!![]}];}_0x2fb5f4=_['merge']({},_0x2fb5f4,_0xbe91d2[_0xe49f('0x3f')]);return db['DeskField'][_0xe49f('0x46')](_0x2fb5f4)[_0xe49f('0x25')](handleEntityNotFound(_0x370162,null))[_0xe49f('0x25')](respondWithResult(_0x370162,null))[_0xe49f('0x47')](handleError(_0x370162,null));};exports[_0xe49f('0x48')]=function(_0x21796d,_0x2f87aa){return db[_0xe49f('0x2b')][_0xe49f('0x48')](_0x21796d['body'],{})['then'](respondWithResult(_0x2f87aa,0xc9))[_0xe49f('0x47')](handleError(_0x2f87aa,null));};exports[_0xe49f('0x24')]=function(_0x3fa5ec,_0x2cd14d){if(_0x3fa5ec[_0xe49f('0x49')]['id']){delete _0x3fa5ec[_0xe49f('0x49')]['id'];}return db[_0xe49f('0x2b')][_0xe49f('0x46')]({'where':{'id':_0x3fa5ec[_0xe49f('0x44')]['id']}})[_0xe49f('0x25')](handleEntityNotFound(_0x2cd14d,null))[_0xe49f('0x25')](saveUpdates(_0x3fa5ec['body'],null))[_0xe49f('0x25')](respondWithResult(_0x2cd14d,null))['catch'](handleError(_0x2cd14d,null));};exports[_0xe49f('0x26')]=function(_0x1daf27,_0x416807){return db[_0xe49f('0x2b')][_0xe49f('0x46')]({'where':{'id':_0x1daf27[_0xe49f('0x44')]['id']}})[_0xe49f('0x25')](handleEntityNotFound(_0x416807,null))[_0xe49f('0x25')](removeEntity(_0x416807,null))[_0xe49f('0x47')](handleError(_0x416807,null));}; \ No newline at end of file +var _0xfed6=['send','index','rawAttributes','fieldName','type','key','query','model','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','options','DeskField','includeAll','include','findAll','rows','show','keys','intersection','length','catch','create','body','find','params','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name'];(function(_0x467178,_0x5bc789){var _0xf85931=function(_0x24765d){while(--_0x24765d){_0x467178['push'](_0x467178['shift']());}};_0xf85931(++_0x5bc789);}(_0xfed6,0x14a));var _0x6fed=function(_0x3362e5,_0x5091d1){_0x3362e5=_0x3362e5-0x0;var _0x228031=_0xfed6[_0x3362e5];return _0x228031;};'use strict';var emlformat=require(_0x6fed('0x0'));var rimraf=require(_0x6fed('0x1'));var zipdir=require(_0x6fed('0x2'));var jsonpatch=require(_0x6fed('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x6fed('0x4'));var Mustache=require('mustache');var util=require(_0x6fed('0x5'));var path=require(_0x6fed('0x6'));var sox=require(_0x6fed('0x7'));var csv=require(_0x6fed('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6fed('0x9'));var _=require(_0x6fed('0xa'));var squel=require(_0x6fed('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x6fed('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x6fed('0xd'));var Redis=require(_0x6fed('0xe'));var authService=require(_0x6fed('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x6fed('0x10'));var hardwareService=require(_0x6fed('0x11'));var logger=require(_0x6fed('0x12'))(_0x6fed('0x13'));var utils=require('../../config/utils');var config=require(_0x6fed('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x6fed('0x15'))['db'];function respondWithStatusCode(_0x1a7863,_0x707f8d){_0x707f8d=_0x707f8d||0xcc;return function(_0x414e4f){if(_0x414e4f){return _0x1a7863[_0x6fed('0x16')](_0x707f8d);}return _0x1a7863[_0x6fed('0x17')](_0x707f8d)[_0x6fed('0x18')]();};}function respondWithResult(_0x3579e5,_0x5558ef){_0x5558ef=_0x5558ef||0xc8;return function(_0x304d01){if(_0x304d01){return _0x3579e5[_0x6fed('0x17')](_0x5558ef)[_0x6fed('0x19')](_0x304d01);}};}function respondWithFilteredResult(_0x4cc86c,_0x1332c6){return function(_0x294280){if(_0x294280){var _0x67415d=typeof _0x1332c6[_0x6fed('0x1a')]===_0x6fed('0x1b')&&typeof _0x1332c6[_0x6fed('0x1c')]===_0x6fed('0x1b');var _0x4eb346=_0x294280['count'];var _0x2f419a=_0x67415d?0x0:_0x1332c6['offset'];var _0x56988a=_0x67415d?_0x294280[_0x6fed('0x1d')]:_0x1332c6['offset']+_0x1332c6[_0x6fed('0x1c')];var _0x261663;if(_0x56988a>=_0x4eb346){_0x56988a=_0x4eb346;_0x261663=0xc8;}else{_0x261663=0xce;}_0x4cc86c[_0x6fed('0x17')](_0x261663);return _0x4cc86c[_0x6fed('0x1e')](_0x6fed('0x1f'),_0x2f419a+'-'+_0x56988a+'/'+_0x4eb346)[_0x6fed('0x19')](_0x294280);}return null;};}function patchUpdates(_0x357adf){return function(_0x2c838b){try{jsonpatch[_0x6fed('0x20')](_0x2c838b,_0x357adf,!![]);}catch(_0x2f4dc3){return BPromise['reject'](_0x2f4dc3);}return _0x2c838b[_0x6fed('0x21')]();};}function saveUpdates(_0x4e4373,_0x4e394b){return function(_0x1a2bec){if(_0x1a2bec){return _0x1a2bec[_0x6fed('0x22')](_0x4e4373)[_0x6fed('0x23')](function(_0x473d86){return _0x473d86;});}return null;};}function removeEntity(_0x21954c,_0x3c59a1){return function(_0xefb994){if(_0xefb994){return _0xefb994[_0x6fed('0x24')]()[_0x6fed('0x23')](function(){_0x21954c[_0x6fed('0x17')](0xcc)[_0x6fed('0x18')]();});}};}function handleEntityNotFound(_0x497747,_0x4b0e15){return function(_0x39b3ab){if(!_0x39b3ab){_0x497747[_0x6fed('0x16')](0x194);}return _0x39b3ab;};}function handleError(_0x5d02f5,_0x491d65){_0x491d65=_0x491d65||0x1f4;return function(_0x52cad1){logger[_0x6fed('0x25')](_0x52cad1[_0x6fed('0x26')]);if(_0x52cad1[_0x6fed('0x27')]){delete _0x52cad1['name'];}_0x5d02f5[_0x6fed('0x17')](_0x491d65)[_0x6fed('0x28')](_0x52cad1);};}exports[_0x6fed('0x29')]=function(_0x440d8a,_0x2e7a65){var _0x18bea5={},_0x35d2c2={},_0x1870ff={'count':0x0,'rows':[]};var _0x15bf3f=_['map'](db['DeskField'][_0x6fed('0x2a')],function(_0x48009a){return{'name':_0x48009a[_0x6fed('0x2b')],'type':_0x48009a[_0x6fed('0x2c')][_0x6fed('0x2d')]};});_0x35d2c2['model']=_['map'](_0x15bf3f,_0x6fed('0x27'));_0x35d2c2[_0x6fed('0x2e')]=_['keys'](_0x440d8a[_0x6fed('0x2e')]);_0x35d2c2['filters']=_['intersection'](_0x35d2c2[_0x6fed('0x2f')],_0x35d2c2['query']);_0x18bea5[_0x6fed('0x30')]=_['intersection'](_0x35d2c2['model'],qs[_0x6fed('0x31')](_0x440d8a['query']['fields']));_0x18bea5[_0x6fed('0x30')]=_0x18bea5[_0x6fed('0x30')]['length']?_0x18bea5[_0x6fed('0x30')]:_0x35d2c2[_0x6fed('0x2f')];if(!_0x440d8a['query'][_0x6fed('0x32')](_0x6fed('0x33'))){_0x18bea5['limit']=qs[_0x6fed('0x1c')](_0x440d8a[_0x6fed('0x2e')][_0x6fed('0x1c')]);_0x18bea5[_0x6fed('0x1a')]=qs['offset'](_0x440d8a[_0x6fed('0x2e')]['offset']);}_0x18bea5[_0x6fed('0x34')]=qs[_0x6fed('0x35')](_0x440d8a['query'][_0x6fed('0x35')]);_0x18bea5['where']=qs[_0x6fed('0x36')](_[_0x6fed('0x37')](_0x440d8a[_0x6fed('0x2e')],_0x35d2c2[_0x6fed('0x36')]),_0x15bf3f);if(_0x440d8a['query'][_0x6fed('0x38')]){_0x18bea5[_0x6fed('0x39')]=_[_0x6fed('0x3a')](_0x18bea5[_0x6fed('0x39')],{'$or':_['map'](_0x15bf3f,function(_0x102068){if(_0x102068[_0x6fed('0x2c')]!=='VIRTUAL'){var _0xf61812={};_0xf61812[_0x102068[_0x6fed('0x27')]]={'$like':'%'+_0x440d8a[_0x6fed('0x2e')][_0x6fed('0x38')]+'%'};return _0xf61812;}})});}_0x18bea5=_[_0x6fed('0x3a')]({},_0x18bea5,_0x440d8a[_0x6fed('0x3b')]);var _0x111be3={'where':_0x18bea5[_0x6fed('0x39')]};return db[_0x6fed('0x3c')]['count'](_0x111be3)[_0x6fed('0x23')](function(_0x36dfb9){_0x1870ff['count']=_0x36dfb9;if(_0x440d8a['query'][_0x6fed('0x3d')]){_0x18bea5[_0x6fed('0x3e')]=[{'all':!![]}];}return db['DeskField'][_0x6fed('0x3f')](_0x18bea5);})[_0x6fed('0x23')](function(_0x5ca319){_0x1870ff[_0x6fed('0x40')]=_0x5ca319;return _0x1870ff;})[_0x6fed('0x23')](respondWithFilteredResult(_0x2e7a65,_0x18bea5))['catch'](handleError(_0x2e7a65,null));};exports[_0x6fed('0x41')]=function(_0x398daa,_0x792d5){var _0x3424bf={'raw':!![],'where':{'id':_0x398daa['params']['id']}},_0x5bd845={};_0x5bd845[_0x6fed('0x2f')]=_[_0x6fed('0x42')](db[_0x6fed('0x3c')][_0x6fed('0x2a')]);_0x5bd845[_0x6fed('0x2e')]=_['keys'](_0x398daa['query']);_0x5bd845['filters']=_[_0x6fed('0x43')](_0x5bd845[_0x6fed('0x2f')],_0x5bd845[_0x6fed('0x2e')]);_0x3424bf[_0x6fed('0x30')]=_[_0x6fed('0x43')](_0x5bd845[_0x6fed('0x2f')],qs[_0x6fed('0x31')](_0x398daa[_0x6fed('0x2e')][_0x6fed('0x31')]));_0x3424bf['attributes']=_0x3424bf['attributes'][_0x6fed('0x44')]?_0x3424bf[_0x6fed('0x30')]:_0x5bd845[_0x6fed('0x2f')];if(_0x398daa[_0x6fed('0x2e')][_0x6fed('0x3d')]){_0x3424bf['include']=[{'all':!![]}];}_0x3424bf=_[_0x6fed('0x3a')]({},_0x3424bf,_0x398daa[_0x6fed('0x3b')]);return db[_0x6fed('0x3c')]['find'](_0x3424bf)['then'](handleEntityNotFound(_0x792d5,null))[_0x6fed('0x23')](respondWithResult(_0x792d5,null))[_0x6fed('0x45')](handleError(_0x792d5,null));};exports[_0x6fed('0x46')]=function(_0x2f253c,_0x5a2ea5){return db[_0x6fed('0x3c')][_0x6fed('0x46')](_0x2f253c[_0x6fed('0x47')],{})[_0x6fed('0x23')](respondWithResult(_0x5a2ea5,0xc9))[_0x6fed('0x45')](handleError(_0x5a2ea5,null));};exports[_0x6fed('0x22')]=function(_0x1891aa,_0x59b9c2){if(_0x1891aa[_0x6fed('0x47')]['id']){delete _0x1891aa['body']['id'];}return db[_0x6fed('0x3c')][_0x6fed('0x48')]({'where':{'id':_0x1891aa[_0x6fed('0x49')]['id']}})[_0x6fed('0x23')](handleEntityNotFound(_0x59b9c2,null))[_0x6fed('0x23')](saveUpdates(_0x1891aa[_0x6fed('0x47')],null))['then'](respondWithResult(_0x59b9c2,null))[_0x6fed('0x45')](handleError(_0x59b9c2,null));};exports[_0x6fed('0x24')]=function(_0xc07afa,_0x465272){return db[_0x6fed('0x3c')][_0x6fed('0x48')]({'where':{'id':_0xc07afa[_0x6fed('0x49')]['id']}})['then'](handleEntityNotFound(_0x465272,null))[_0x6fed('0x23')](removeEntity(_0x465272,null))[_0x6fed('0x45')](handleError(_0x465272,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 892079c..6166b59 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 _0x4812=['./intDeskField.attributes','DeskField','int_desk_fields','desk_unique_index','FieldId','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x21399e,_0xbc6101){var _0x3b7be4=function(_0x2b5747){while(--_0x2b5747){_0x21399e['push'](_0x21399e['shift']());}};_0x3b7be4(++_0xbc6101);}(_0x4812,0x89));var _0x2481=function(_0x38957c,_0x51e872){_0x38957c=_0x38957c-0x0;var _0x1cf301=_0x4812[_0x38957c];return _0x1cf301;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2481('0x0'))(_0x2481('0x1'));var moment=require(_0x2481('0x2'));var BPromise=require(_0x2481('0x3'));var rp=require(_0x2481('0x4'));var fs=require('fs');var path=require(_0x2481('0x5'));var rimraf=require('rimraf');var config=require(_0x2481('0x6'));var attributes=require(_0x2481('0x7'));module['exports']=function(_0x45633b,_0xd7c4e1){return _0x45633b['define'](_0x2481('0x8'),attributes,{'tableName':_0x2481('0x9'),'paranoid':![],'indexes':[{'name':_0x2481('0xa'),'fields':['idField',_0x2481('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5df1=['rimraf','../../config/environment','./intDeskField.attributes','exports','define','DeskField','int_desk_fields','desk_unique_index','FieldId','util','moment','request-promise'];(function(_0x36b037,_0x2b234e){var _0x409194=function(_0xddc9dc){while(--_0xddc9dc){_0x36b037['push'](_0x36b037['shift']());}};_0x409194(++_0x2b234e);}(_0x5df1,0x1a1));var _0x15df=function(_0x327833,_0x1a5833){_0x327833=_0x327833-0x0;var _0x29ade9=_0x5df1[_0x327833];return _0x29ade9;};'use strict';var _=require('lodash');var util=require(_0x15df('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x15df('0x1'));var BPromise=require('bluebird');var rp=require(_0x15df('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x15df('0x3'));var config=require(_0x15df('0x4'));var attributes=require(_0x15df('0x5'));module[_0x15df('0x6')]=function(_0x5c76f5,_0x17e05b){return _0x5c76f5[_0x15df('0x7')](_0x15df('0x8'),attributes,{'tableName':_0x15df('0x9'),'paranoid':![],'indexes':[{'name':_0x15df('0xa'),'fields':['idField',_0x15df('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.rpc.js b/server/api/intDeskField/intDeskField.rpc.js index 330ef1e..e31992e 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 _0xd006=['client','request','then','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x3c2bdb,_0x2ed746){var _0x341911=function(_0x22812a){while(--_0x22812a){_0x3c2bdb['push'](_0x3c2bdb['shift']());}};_0x341911(++_0x2ed746);}(_0xd006,0x1b0));var _0x6d00=function(_0x21de89,_0x367053){_0x21de89=_0x21de89-0x0;var _0x290b7e=_0xd006[_0x21de89];return _0x290b7e;};'use strict';var _=require('lodash');var util=require(_0x6d00('0x0'));var moment=require(_0x6d00('0x1'));var BPromise=require(_0x6d00('0x2'));var rs=require(_0x6d00('0x3'));var fs=require('fs');var Redis=require(_0x6d00('0x4'));var db=require(_0x6d00('0x5'))['db'];var utils=require(_0x6d00('0x6'));var logger=require('../../config/logger')(_0x6d00('0x7'));var config=require(_0x6d00('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x6d00('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5e5b64,_0x8f2f04,_0x14ec6e){return new BPromise(function(_0x5ecc55,_0x168213){return client[_0x6d00('0xa')](_0x5e5b64,_0x14ec6e)[_0x6d00('0xb')](function(_0x2a4846){logger['info'](_0x6d00('0xc'),_0x8f2f04,_0x6d00('0xd'));logger[_0x6d00('0xe')](_0x6d00('0xf'),_0x8f2f04,'request\x20sent',JSON['stringify'](_0x2a4846));if(_0x2a4846[_0x6d00('0x10')]){if(_0x2a4846[_0x6d00('0x10')][_0x6d00('0x11')]===0x1f4){logger[_0x6d00('0x10')](_0x6d00('0xc'),_0x8f2f04,_0x2a4846[_0x6d00('0x10')]['message']);return _0x168213(_0x2a4846[_0x6d00('0x10')][_0x6d00('0x12')]);}logger['error'](_0x6d00('0xc'),_0x8f2f04,_0x2a4846['error'][_0x6d00('0x12')]);return _0x5ecc55(_0x2a4846[_0x6d00('0x10')][_0x6d00('0x12')]);}else{logger['info'](_0x6d00('0xc'),_0x8f2f04,'request\x20sent');_0x5ecc55(_0x2a4846[_0x6d00('0x13')][_0x6d00('0x12')]);}})[_0x6d00('0x14')](function(_0x1f066b){logger[_0x6d00('0x10')](_0x6d00('0xc'),_0x8f2f04,_0x1f066b);_0x168213(_0x1f066b);});});} \ No newline at end of file +var _0x0616=['code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','info','DeskField,\x20%s,\x20%s','debug','request\x20sent','stringify','error'];(function(_0x2a0af4,_0x44e712){var _0x2be515=function(_0x39015a){while(--_0x39015a){_0x2a0af4['push'](_0x2a0af4['shift']());}};_0x2be515(++_0x44e712);}(_0x0616,0x1d0));var _0x6061=function(_0x73d817,_0x54eed1){_0x73d817=_0x73d817-0x0;var _0x178cf8=_0x0616[_0x73d817];return _0x178cf8;};'use strict';var _=require('lodash');var util=require(_0x6061('0x0'));var moment=require(_0x6061('0x1'));var BPromise=require(_0x6061('0x2'));var rs=require(_0x6061('0x3'));var fs=require('fs');var Redis=require(_0x6061('0x4'));var db=require(_0x6061('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6061('0x6'))(_0x6061('0x7'));var config=require(_0x6061('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x6061('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3d9516,_0x27f051,_0x501a39){return new BPromise(function(_0x53aaa4,_0x434d95){return client['request'](_0x3d9516,_0x501a39)['then'](function(_0xe2345b){logger[_0x6061('0xa')](_0x6061('0xb'),_0x27f051,'request\x20sent');logger[_0x6061('0xc')]('DeskField,\x20%s,\x20%s,\x20%s',_0x27f051,_0x6061('0xd'),JSON[_0x6061('0xe')](_0xe2345b));if(_0xe2345b[_0x6061('0xf')]){if(_0xe2345b['error'][_0x6061('0x10')]===0x1f4){logger['error'](_0x6061('0xb'),_0x27f051,_0xe2345b[_0x6061('0xf')][_0x6061('0x11')]);return _0x434d95(_0xe2345b['error'][_0x6061('0x11')]);}logger[_0x6061('0xf')](_0x6061('0xb'),_0x27f051,_0xe2345b[_0x6061('0xf')][_0x6061('0x11')]);return _0x53aaa4(_0xe2345b[_0x6061('0xf')][_0x6061('0x11')]);}else{logger[_0x6061('0xa')](_0x6061('0xb'),_0x27f051,_0x6061('0xd'));_0x53aaa4(_0xe2345b[_0x6061('0x12')]['message']);}})[_0x6061('0x13')](function(_0x4799a9){logger[_0x6061('0xf')](_0x6061('0xb'),_0x27f051,_0x4799a9);_0x434d95(_0x4799a9);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index c87e060..4c4fce8 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 _0x7141=['../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x5e9763,_0x5e9280){var _0x350a99=function(_0x31689f){while(--_0x31689f){_0x5e9763['push'](_0x5e9763['shift']());}};_0x350a99(++_0x5e9280);}(_0x7141,0x18d));var _0x1714=function(_0x1a6246,_0x3f75d8){_0x1a6246=_0x1a6246-0x0;var _0x4a9064=_0x7141[_0x1a6246];return _0x4a9064;};'use strict';var multer=require(_0x1714('0x0'));var util=require(_0x1714('0x1'));var path=require(_0x1714('0x2'));var timeout=require(_0x1714('0x3'));var express=require(_0x1714('0x4'));var router=express[_0x1714('0x5')]();var fs_extra=require(_0x1714('0x6'));var auth=require(_0x1714('0x7'));var interaction=require(_0x1714('0x8'));var config=require(_0x1714('0x9'));var controller=require(_0x1714('0xa'));router[_0x1714('0xb')]('/',auth[_0x1714('0xc')](),controller['index']);router[_0x1714('0xb')](_0x1714('0xd'),auth[_0x1714('0xc')](),controller[_0x1714('0xe')]);router[_0x1714('0xb')](_0x1714('0xf'),auth['isAuthenticated'](),controller[_0x1714('0x10')]);router[_0x1714('0xb')](_0x1714('0x11'),auth['isAuthenticated'](),controller[_0x1714('0x12')]);router[_0x1714('0x13')]('/',auth[_0x1714('0xc')](),controller[_0x1714('0x14')]);router[_0x1714('0x13')](_0x1714('0xf'),auth[_0x1714('0xc')](),controller[_0x1714('0x15')]);router[_0x1714('0x16')](_0x1714('0xd'),auth[_0x1714('0xc')](),controller[_0x1714('0x17')]);router[_0x1714('0x18')](_0x1714('0xd'),auth[_0x1714('0xc')](),controller[_0x1714('0x19')]);module[_0x1714('0x1a')]=router; \ No newline at end of file +var _0xa47a=['post','put','delete','/:id','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDynamics365Account.controller','get','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','create'];(function(_0x3f6426,_0x12cbf9){var _0x25d790=function(_0x3c6756){while(--_0x3c6756){_0x3f6426['push'](_0x3f6426['shift']());}};_0x25d790(++_0x12cbf9);}(_0xa47a,0x1d2));var _0xaa47=function(_0x47de36,_0x3fad7a){_0x47de36=_0x47de36-0x0;var _0x1ceb27=_0xa47a[_0x47de36];return _0x1ceb27;};'use strict';var multer=require(_0xaa47('0x0'));var util=require(_0xaa47('0x1'));var path=require(_0xaa47('0x2'));var timeout=require(_0xaa47('0x3'));var express=require('express');var router=express[_0xaa47('0x4')]();var fs_extra=require(_0xaa47('0x5'));var auth=require(_0xaa47('0x6'));var interaction=require(_0xaa47('0x7'));var config=require('../../config/environment');var controller=require(_0xaa47('0x8'));router[_0xaa47('0x9')]('/',auth[_0xaa47('0xa')](),controller['index']);router[_0xaa47('0x9')]('/:id',auth[_0xaa47('0xa')](),controller[_0xaa47('0xb')]);router['get'](_0xaa47('0xc'),auth['isAuthenticated'](),controller[_0xaa47('0xd')]);router[_0xaa47('0x9')](_0xaa47('0xe'),auth['isAuthenticated'](),controller[_0xaa47('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0xaa47('0x10')]);router[_0xaa47('0x11')](_0xaa47('0xc'),auth[_0xaa47('0xa')](),controller['addConfiguration']);router[_0xaa47('0x12')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xaa47('0x13')](_0xaa47('0x14'),auth[_0xaa47('0xa')](),controller[_0xaa47('0x15')]);module[_0xaa47('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 2b70f03..f289965 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 _0xac4f=['STRING','BOOLEAN','sequelize'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xac4f,0x122));var _0xfac4=function(_0x579681,_0x181f3f){_0x579681=_0x579681-0x0;var _0x3054e0=_0xac4f[_0x579681];return _0x3054e0;};'use strict';var Sequelize=require(_0xfac4('0x0'));module['exports']={'name':{'type':Sequelize[_0xfac4('0x1')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xfac4('0x1')]},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xfac4('0x1')]},'clientSecret':{'type':Sequelize[_0xfac4('0x1')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xfac4('0x1')]},'modernAuthentication':{'type':Sequelize[_0xfac4('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0x4250=['STRING','BOOLEAN','sequelize','exports'];(function(_0x2f7f29,_0x5c6040){var _0x37d68a=function(_0x59accb){while(--_0x59accb){_0x2f7f29['push'](_0x2f7f29['shift']());}};_0x37d68a(++_0x5c6040);}(_0x4250,0x146));var _0x0425=function(_0x5e36d1,_0x471178){_0x5e36d1=_0x5e36d1-0x0;var _0x950b9e=_0x4250[_0x5e36d1];return _0x950b9e;};'use strict';var Sequelize=require(_0x0425('0x0'));module[_0x0425('0x1')]={'name':{'type':Sequelize[_0x0425('0x2')]},'username':{'type':Sequelize[_0x0425('0x2')]},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x0425('0x2')]},'tenantId':{'type':Sequelize[_0x0425('0x2')]},'clientId':{'type':Sequelize[_0x0425('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x0425('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x0425('0x2')]},'modernAuthentication':{'type':Sequelize[_0x0425('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 e1b9e54..52df9ed 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 _0xc8bd=['timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','concat','username','password','remoteUri','tenantId','clientId','modernAuthentication','CloudProvider','data5','data7','https://login.microsoftonline.com/','/oauth2/token','clientSecret','access_token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','4.0','Attributes','includes','forEach','@odata.type','PicklistAttributeMetadata','MetadataId','all','isNil','BooleanAttributeMetadata','push','IntegerAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','DecimalAttributeMetadata','test','statusCode','stack','Wrong\x20credentials',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Label','UserLocalizedLabel','Value','LogicalName','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','Bearer\x20','TrueOption','true','FalseOption','false',')/Microsoft.Dynamics.CRM.','request-promise','util','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','status','offset','undefined','limit','count','json','update','destroy','then','sendStatus','error','name','send','map','Dynamics365Account','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','params','keys','options','find','body','getConfigurations','findOne','Dynamics365Configuration','sort','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','create','substring','lastIndexOf','format','%s/api/data/v9.0/','getFields','incident','Incident','PhoneCall','title','description','customerid','ownerid','caseorigincode','phonenumber','regardingobjectid','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractdetailidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdon','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyname','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','overriddencreatedon','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','socialprofileidname','statuscode','ticketnumber'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc8bd,0xf6));var _0xdc8b=function(_0xfc53fc,_0x4204d6){_0xfc53fc=_0xfc53fc-0x0;var _0x423828=_0xc8bd[_0xfc53fc];return _0x423828;};'use strict';var rp=require(_0xdc8b('0x0'));var util=require(_0xdc8b('0x1'));var _=require(_0xdc8b('0x2'));var qs=require(_0xdc8b('0x3'));var logger=require(_0xdc8b('0x4'))(_0xdc8b('0x5'));var db=require(_0xdc8b('0x6'))['db'];var integrations=require(_0xdc8b('0x7'));function respondWithResult(_0xc345ab,_0x1148ca){_0x1148ca=_0x1148ca||0xc8;return function(_0x3c1904){if(_0x3c1904){return _0xc345ab[_0xdc8b('0x8')](_0x1148ca)['json'](_0x3c1904);}};}function respondWithFilteredResult(_0x4ccf43,_0x38458d){return function(_0x3b38cf){if(_0x3b38cf){var _0x26cb70=typeof _0x38458d[_0xdc8b('0x9')]===_0xdc8b('0xa')&&typeof _0x38458d[_0xdc8b('0xb')]===_0xdc8b('0xa');var _0x24cd22=_0x3b38cf[_0xdc8b('0xc')];var _0x5e072a=_0x26cb70?0x0:_0x38458d[_0xdc8b('0x9')];var _0x540ff0=_0x26cb70?_0x3b38cf[_0xdc8b('0xc')]:_0x38458d[_0xdc8b('0x9')]+_0x38458d['limit'];var _0x1093d5;if(_0x540ff0>=_0x24cd22){_0x540ff0=_0x24cd22;_0x1093d5=0xc8;}else{_0x1093d5=0xce;}_0x4ccf43[_0xdc8b('0x8')](_0x1093d5);return _0x4ccf43['set']('Content-Range',_0x5e072a+'-'+_0x540ff0+'/'+_0x24cd22)[_0xdc8b('0xd')](_0x3b38cf);}return null;};}function saveUpdates(_0x33ccaf){return function(_0x1ec695){if(_0x1ec695){return _0x1ec695[_0xdc8b('0xe')](_0x33ccaf)['then'](function(_0x109dc1){return _0x109dc1;});}return null;};}function removeEntity(_0x1182bc){return function(_0x57b1ce){if(_0x57b1ce){return _0x57b1ce[_0xdc8b('0xf')]()[_0xdc8b('0x10')](function(){_0x1182bc['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2680ef){return function(_0xfbfd66){if(!_0xfbfd66){_0x2680ef[_0xdc8b('0x11')](0x194);}return _0xfbfd66;};}function handleError(_0x41c689,_0x3f59b4){_0x3f59b4=_0x3f59b4||0x1f4;return function(_0x59b1d2){logger[_0xdc8b('0x12')](_0x59b1d2['stack']);if(_0x59b1d2['name']){delete _0x59b1d2[_0xdc8b('0x13')];}_0x41c689[_0xdc8b('0x8')](_0x3f59b4)[_0xdc8b('0x14')](_0x59b1d2);};}exports['index']=function(_0x4b5511,_0x47c9c3){var _0x1b0524={},_0x48c819={},_0x501ccf={'count':0x0,'rows':[]};var _0x386e5b=_[_0xdc8b('0x15')](db[_0xdc8b('0x16')][_0xdc8b('0x17')],function(_0x152f59){return{'name':_0x152f59[_0xdc8b('0x18')],'type':_0x152f59[_0xdc8b('0x19')][_0xdc8b('0x1a')]};});_0x48c819[_0xdc8b('0x1b')]=_[_0xdc8b('0x15')](_0x386e5b,'name');_0x48c819['query']=_['keys'](_0x4b5511[_0xdc8b('0x1c')]);_0x48c819[_0xdc8b('0x1d')]=_[_0xdc8b('0x1e')](_0x48c819['model'],_0x48c819[_0xdc8b('0x1c')]);_0x1b0524['attributes']=_[_0xdc8b('0x1e')](_0x48c819['model'],qs[_0xdc8b('0x1f')](_0x4b5511['query'][_0xdc8b('0x1f')]));_0x1b0524[_0xdc8b('0x20')]=_0x1b0524['attributes'][_0xdc8b('0x21')]?_0x1b0524[_0xdc8b('0x20')]:_0x48c819[_0xdc8b('0x1b')];if(!_0x4b5511[_0xdc8b('0x1c')][_0xdc8b('0x22')](_0xdc8b('0x23'))){_0x1b0524['limit']=qs[_0xdc8b('0xb')](_0x4b5511[_0xdc8b('0x1c')][_0xdc8b('0xb')]);_0x1b0524[_0xdc8b('0x9')]=qs['offset'](_0x4b5511[_0xdc8b('0x1c')][_0xdc8b('0x9')]);}_0x1b0524[_0xdc8b('0x24')]=qs['sort'](_0x4b5511[_0xdc8b('0x1c')]['sort']);_0x1b0524[_0xdc8b('0x25')]=qs[_0xdc8b('0x1d')](_[_0xdc8b('0x26')](_0x4b5511[_0xdc8b('0x1c')],_0x48c819['filters']),_0x386e5b);if(_0x4b5511[_0xdc8b('0x1c')][_0xdc8b('0x27')]){_0x1b0524['where']=_[_0xdc8b('0x28')](_0x1b0524['where'],{'$or':_['map'](_0x386e5b,function(_0x44e86b){if(_0x44e86b[_0xdc8b('0x19')]!==_0xdc8b('0x29')){var _0x291e7e={};_0x291e7e[_0x44e86b[_0xdc8b('0x13')]]={'$like':'%'+_0x4b5511[_0xdc8b('0x1c')][_0xdc8b('0x27')]+'%'};return _0x291e7e;}})});}_0x1b0524=_[_0xdc8b('0x28')]({},_0x1b0524,_0x4b5511['options']);var _0xc058e5={'where':_0x1b0524['where']};return db['Dynamics365Account']['count'](_0xc058e5)[_0xdc8b('0x10')](function(_0xe2fb7b){_0x501ccf[_0xdc8b('0xc')]=_0xe2fb7b;if(_0x4b5511['query'][_0xdc8b('0x2a')]){_0x1b0524[_0xdc8b('0x2b')]=[{'all':!![]}];}return db[_0xdc8b('0x16')][_0xdc8b('0x2c')](_0x1b0524);})[_0xdc8b('0x10')](function(_0x4f0e5f){_0x501ccf[_0xdc8b('0x2d')]=_0x4f0e5f;return _0x501ccf;})[_0xdc8b('0x10')](respondWithFilteredResult(_0x47c9c3,_0x1b0524))[_0xdc8b('0x2e')](handleError(_0x47c9c3,null));};exports['show']=function(_0x5f4377,_0x4e0b80){var _0x3c9ff9={'raw':![],'where':{'id':_0x5f4377[_0xdc8b('0x2f')]['id']}},_0xfb54c2={};_0xfb54c2[_0xdc8b('0x1b')]=_[_0xdc8b('0x30')](db[_0xdc8b('0x16')]['rawAttributes']);_0xfb54c2[_0xdc8b('0x1c')]=_[_0xdc8b('0x30')](_0x5f4377[_0xdc8b('0x1c')]);_0xfb54c2['filters']=_[_0xdc8b('0x1e')](_0xfb54c2['model'],_0xfb54c2['query']);_0x3c9ff9[_0xdc8b('0x20')]=_[_0xdc8b('0x1e')](_0xfb54c2['model'],qs['fields'](_0x5f4377[_0xdc8b('0x1c')][_0xdc8b('0x1f')]));_0x3c9ff9[_0xdc8b('0x20')]=_0x3c9ff9[_0xdc8b('0x20')][_0xdc8b('0x21')]?_0x3c9ff9[_0xdc8b('0x20')]:_0xfb54c2['model'];if(_0x5f4377[_0xdc8b('0x1c')][_0xdc8b('0x2a')]){_0x3c9ff9[_0xdc8b('0x2b')]=[{'all':!![]}];}_0x3c9ff9=_[_0xdc8b('0x28')]({},_0x3c9ff9,_0x5f4377[_0xdc8b('0x31')]);return db[_0xdc8b('0x16')][_0xdc8b('0x32')](_0x3c9ff9)[_0xdc8b('0x10')](handleEntityNotFound(_0x4e0b80,null))[_0xdc8b('0x10')](respondWithResult(_0x4e0b80,null))[_0xdc8b('0x2e')](handleError(_0x4e0b80,null));};exports['create']=function(_0xadc15,_0x29fb9f){return db[_0xdc8b('0x16')]['create'](_0xadc15[_0xdc8b('0x33')],{})[_0xdc8b('0x10')](respondWithResult(_0x29fb9f,0xc9))[_0xdc8b('0x2e')](handleError(_0x29fb9f,null));};exports['update']=function(_0x45aacd,_0x5dce0b){if(_0x45aacd[_0xdc8b('0x33')]['id']){delete _0x45aacd[_0xdc8b('0x33')]['id'];}return db[_0xdc8b('0x16')][_0xdc8b('0x32')]({'where':{'id':_0x45aacd['params']['id']}})['then'](handleEntityNotFound(_0x5dce0b,null))[_0xdc8b('0x10')](saveUpdates(_0x45aacd['body'],null))[_0xdc8b('0x10')](respondWithResult(_0x5dce0b,null))[_0xdc8b('0x2e')](handleError(_0x5dce0b,null));};exports[_0xdc8b('0xf')]=function(_0x494bcd,_0x4b41e7){return db[_0xdc8b('0x16')][_0xdc8b('0x32')]({'where':{'id':_0x494bcd[_0xdc8b('0x2f')]['id']}})[_0xdc8b('0x10')](handleEntityNotFound(_0x4b41e7,null))[_0xdc8b('0x10')](removeEntity(_0x4b41e7,null))[_0xdc8b('0x2e')](handleError(_0x4b41e7,null));};exports[_0xdc8b('0x34')]=function(_0x43ac55,_0x5744c0){var _0x529562={};var _0x3bc5a2={};var _0x28105b;var _0x38bdc9;return db['Dynamics365Account'][_0xdc8b('0x35')]({'where':{'id':_0x43ac55[_0xdc8b('0x2f')]['id']}})[_0xdc8b('0x10')](handleEntityNotFound(_0x5744c0,null))[_0xdc8b('0x10')](function(_0x4b04fd){if(_0x4b04fd){_0x28105b=_0x4b04fd;_0x3bc5a2['model']=_[_0xdc8b('0x30')](db[_0xdc8b('0x36')][_0xdc8b('0x17')]);_0x3bc5a2[_0xdc8b('0x1c')]=_['keys'](_0x43ac55[_0xdc8b('0x1c')]);_0x3bc5a2[_0xdc8b('0x1d')]=_['intersection'](_0x3bc5a2['model'],_0x3bc5a2['query']);_0x529562['attributes']=_['intersection'](_0x3bc5a2[_0xdc8b('0x1b')],qs[_0xdc8b('0x1f')](_0x43ac55[_0xdc8b('0x1c')][_0xdc8b('0x1f')]));_0x529562[_0xdc8b('0x20')]=_0x529562[_0xdc8b('0x20')][_0xdc8b('0x21')]?_0x529562[_0xdc8b('0x20')]:_0x3bc5a2['model'];_0x529562[_0xdc8b('0x24')]=qs[_0xdc8b('0x37')](_0x43ac55[_0xdc8b('0x1c')][_0xdc8b('0x37')]);_0x529562[_0xdc8b('0x25')]=qs[_0xdc8b('0x1d')](_[_0xdc8b('0x26')](_0x43ac55[_0xdc8b('0x1c')],_0x3bc5a2[_0xdc8b('0x1d')]));if(_0x43ac55[_0xdc8b('0x1c')]['filter']){_0x529562['where']=_[_0xdc8b('0x28')](_0x529562['where'],{'$or':_[_0xdc8b('0x15')](_0x529562[_0xdc8b('0x20')],function(_0x52f621){var _0x41ea99={};_0x41ea99[_0x52f621]={'$like':'%'+_0x43ac55[_0xdc8b('0x1c')][_0xdc8b('0x27')]+'%'};return _0x41ea99;})});}_0x529562=_['merge']({},_0x529562,_0x43ac55[_0xdc8b('0x31')]);return _0x28105b[_0xdc8b('0x34')](_0x529562);}})[_0xdc8b('0x10')](function(_0x446bb3){if(_0x446bb3){_0x38bdc9=_0x446bb3[_0xdc8b('0x21')];if(!_0x43ac55[_0xdc8b('0x1c')][_0xdc8b('0x22')]('nolimit')){_0x529562[_0xdc8b('0xb')]=qs[_0xdc8b('0xb')](_0x43ac55[_0xdc8b('0x1c')][_0xdc8b('0xb')]);_0x529562[_0xdc8b('0x9')]=qs[_0xdc8b('0x9')](_0x43ac55['query'][_0xdc8b('0x9')]);}return _0x28105b[_0xdc8b('0x34')](_0x529562);}})['then'](function(_0x5c5e93){if(_0x5c5e93){return _0x5c5e93?{'count':_0x38bdc9,'rows':_0x5c5e93}:null;}})['then'](respondWithResult(_0x5744c0,null))['catch'](handleError(_0x5744c0,null));};exports[_0xdc8b('0x38')]=function(_0x4c8f4f,_0x1488c0){if(_0x4c8f4f[_0xdc8b('0x33')]['id']){delete _0x4c8f4f[_0xdc8b('0x33')]['id'];}return db[_0xdc8b('0x16')]['findOne']({'where':{'id':_0x4c8f4f[_0xdc8b('0x2f')]['id']}})[_0xdc8b('0x10')](handleEntityNotFound(_0x1488c0,null))[_0xdc8b('0x10')](function(_0xeec6b7){if(_0xeec6b7){_0x4c8f4f[_0xdc8b('0x33')][_0xdc8b('0x39')]=_0xeec6b7['id'];_0x4c8f4f['body'][_0xdc8b('0x3a')]=integrations[_0xdc8b('0x3b')](_0x4c8f4f[_0xdc8b('0x33')]['channel'],_0x4c8f4f['body'][_0xdc8b('0x19')]);_0x4c8f4f['body'][_0xdc8b('0x3c')]=integrations[_0xdc8b('0x3d')](_0x4c8f4f[_0xdc8b('0x33')][_0xdc8b('0x3e')],_0x4c8f4f[_0xdc8b('0x33')][_0xdc8b('0x19')]);return db[_0xdc8b('0x36')][_0xdc8b('0x3f')](_0x4c8f4f['body'],{'include':[{'model':db['Dynamics365Field'],'as':_0xdc8b('0x3a')},{'model':db['Dynamics365Field'],'as':_0xdc8b('0x3c')}]});}return null;})['then'](respondWithResult(_0x1488c0,null))['catch'](handleError(_0x1488c0,null));};function sanitizeRemoteUri(_0x514993){var _0x594bfa=_0x514993['slice'](-0x1);if(_0x594bfa==='/')return _0x514993[_0xdc8b('0x40')](0x0,_0x514993[_0xdc8b('0x41')](_0x594bfa));return _0x514993;}function getWebApiUrl(_0x5de29e){return util[_0xdc8b('0x42')](_0xdc8b('0x43'),_0x5de29e);}exports[_0xdc8b('0x44')]=function(_0x113ea8,_0xcab95d){var _0x598252=_0x113ea8[_0xdc8b('0x1c')]['ticketType'];var _0x4cd45c=_0x598252===_0xdc8b('0x45')?_0xdc8b('0x46'):_0xdc8b('0x47');var _0x47e06b='';var _0x5aaa52='';var _0x4bb26a='';var _0x34a9c4='';var _0x4dbc6f='';var _0x3f53ba='';var _0x1134b7='';var _0xd449df='';var _0x5ed629=[_0xdc8b('0x48'),_0xdc8b('0x49'),_0xdc8b('0x4a'),_0xdc8b('0x4b'),_0xdc8b('0x4c'),'subject',_0xdc8b('0x4d'),_0xdc8b('0x4e'),'directioncode',_0xdc8b('0x4f')];var _0x4887cf=[_0xdc8b('0x50'),_0xdc8b('0x51'),_0xdc8b('0x52'),_0xdc8b('0x53'),_0xdc8b('0x54'),_0xdc8b('0x55'),_0xdc8b('0x56'),'contractidname',_0xdc8b('0x57'),_0xdc8b('0x58'),_0xdc8b('0x59'),'createdbyyominame',_0xdc8b('0x5a'),'createdonbehalfbyname',_0xdc8b('0x5b'),_0xdc8b('0x5c'),_0xdc8b('0x5d'),_0xdc8b('0x5e'),_0xdc8b('0x5f'),_0xdc8b('0x60'),_0xdc8b('0x61'),_0xdc8b('0x62'),_0xdc8b('0x63'),_0xdc8b('0x64'),_0xdc8b('0x65'),_0xdc8b('0x66'),_0xdc8b('0x67'),_0xdc8b('0x68'),_0xdc8b('0x69'),_0xdc8b('0x6a'),_0xdc8b('0x6b'),_0xdc8b('0x6c'),'modifiedbyexternalpartyyominame',_0xdc8b('0x6d'),'modifiedbyyominame',_0xdc8b('0x6e'),_0xdc8b('0x6f'),_0xdc8b('0x70'),_0xdc8b('0x71'),_0xdc8b('0x72'),_0xdc8b('0x73'),'onholdtime',_0xdc8b('0x74'),'owneridname','owneridtype','owneridyominame','parentcaseidname',_0xdc8b('0x75'),_0xdc8b('0x76'),_0xdc8b('0x77'),_0xdc8b('0x78'),_0xdc8b('0x79'),_0xdc8b('0x7a'),_0xdc8b('0x7b'),'responseby',_0xdc8b('0x7c'),_0xdc8b('0x7d'),_0xdc8b('0x7e'),'slainvokedidname','slaname',_0xdc8b('0x7f'),'statecode',_0xdc8b('0x80'),'subjectidname',_0xdc8b('0x81'),_0xdc8b('0x82'),_0xdc8b('0x83'),_0xdc8b('0x84'),_0xdc8b('0x85'),'versionnumber'];var _0x542b83=_0x5ed629[_0xdc8b('0x86')](_0x4887cf);return db[_0xdc8b('0x16')]['findOne']({'where':{'id':_0x113ea8[_0xdc8b('0x2f')]['id']},'attributes':['id',_0xdc8b('0x87'),_0xdc8b('0x88'),_0xdc8b('0x89'),_0xdc8b('0x8a'),_0xdc8b('0x8b'),'clientSecret',_0xdc8b('0x8c')],'include':[{'model':db['CloudProvider'],'as':_0xdc8b('0x8d'),'attributes':['id',_0xdc8b('0x8e'),_0xdc8b('0x8f')]}]})[_0xdc8b('0x10')](handleEntityNotFound(_0xcab95d,null))['then'](function(_0x4e25eb){if(_0x4e25eb){if(_0x4e25eb['modernAuthentication']){_0x4e25eb['access_token']=_0x4e25eb[_0xdc8b('0x8d')][_0xdc8b('0x8e')];_0xd449df=sanitizeRemoteUri(_0x4e25eb[_0xdc8b('0x8d')][_0xdc8b('0x8f')]);_0x1134b7=getWebApiUrl(_0xd449df);return _0x4e25eb;}_0xd449df=sanitizeRemoteUri(_0x4e25eb[_0xdc8b('0x89')]);_0x1134b7=getWebApiUrl(_0xd449df);var _0x4b4f50={'method':'POST','uri':_0xdc8b('0x90')+_0x4e25eb[_0xdc8b('0x8a')]+_0xdc8b('0x91'),'form':{'client_id':_0x4e25eb[_0xdc8b('0x8b')],'resource':_0xd449df,'username':_0x4e25eb[_0xdc8b('0x87')],'password':_0x4e25eb[_0xdc8b('0x88')],'grant_type':'password','client_secret':_0x4e25eb[_0xdc8b('0x92')]},'json':!![]};return rp(_0x4b4f50);}})['then'](function(_0x4208e6){_0x3f53ba=_0x4208e6[_0xdc8b('0x93')];var _0x1daa5f={'method':_0xdc8b('0x94'),'uri':encodeURI(_0x1134b7+_0xdc8b('0x95')+_0x4cd45c+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x3f53ba,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x1daa5f);})[_0xdc8b('0x10')](function(_0x3aa0c4){var _0x24c01b=_0x3aa0c4['value'][0x0];var _0x30e579=_0x24c01b['MetadataId'];var _0x856809={'method':'GET','uri':_0x1134b7+_0xdc8b('0x96')+_0x30e579+_0xdc8b('0x97'),'headers':{'Authorization':'Bearer\x20'+_0x3f53ba,'If-None-Match':null,'OData-Version':_0xdc8b('0x98')},'json':!![]};return rp(_0x856809);})[_0xdc8b('0x10')](function(_0x1c9b44){_0x47e06b=_0x1c9b44;_0x5aaa52=_0x47e06b[_0xdc8b('0x99')];_0x5aaa52=_['remove'](_0x5aaa52,function(_0x33ffa5){return!_0x542b83[_0xdc8b('0x9a')](_0x33ffa5['LogicalName']);});var _0x44cb5b=[];var _0xd280a1=[];_0x5aaa52[_0xdc8b('0x9b')](function(_0x110eed){if(_0x110eed[_0xdc8b('0x9c')]){var _0x3c305b=_0x110eed[_0xdc8b('0x9c')][_0xdc8b('0x40')](_0x110eed[_0xdc8b('0x9c')]['lastIndexOf']('.')+0x1);if(_0x3c305b===_0xdc8b('0x9d')){_0x44cb5b['push'](getSelectList(_0x1134b7,_0x598252,_0xd280a1,_0x47e06b[_0xdc8b('0x9e')],_0x110eed[_0xdc8b('0x9e')],_0x3f53ba));}}});return Promise[_0xdc8b('0x9f')](_0x44cb5b);})[_0xdc8b('0x10')](function(_0x20483d){_0x4bb26a=_0x20483d[0x0];var _0x10cbcc=[];var _0x27915c=[];_0x5aaa52[_0xdc8b('0x9b')](function(_0x21a2cc){if(!_[_0xdc8b('0xa0')](_0x21a2cc['@odata.type'])){var _0x1002fd=_0x21a2cc[_0xdc8b('0x9c')]['substring'](_0x21a2cc['@odata.type']['lastIndexOf']('.')+0x1);if(_0x1002fd===_0xdc8b('0xa1')){_0x10cbcc[_0xdc8b('0xa2')](getBooleanList(_0x1134b7,_0x598252,_0x27915c,_0x47e06b[_0xdc8b('0x9e')],_0x21a2cc['MetadataId'],_0x3f53ba));}}});return Promise[_0xdc8b('0x9f')](_0x10cbcc);})[_0xdc8b('0x10')](function(_0x10119b){_0x34a9c4=_0x10119b[0x0];var _0xf23b4f=[];var _0x5b1f18=[];_0x5aaa52['forEach'](function(_0x4b1957){if(_0x4b1957[_0xdc8b('0x9c')]){var _0x823429=_0x4b1957[_0xdc8b('0x9c')][_0xdc8b('0x40')](_0x4b1957[_0xdc8b('0x9c')][_0xdc8b('0x41')]('.')+0x1);if(_0x823429==='StringAttributeMetadata'||_0x823429==='DoubleAttributeMetadata'||_0x823429==='BigIntAttributeMetadata'||_0x823429===_0xdc8b('0xa3')||_0x823429==='MemoAttributeMetadata'||_0x823429===_0xdc8b('0xa4')||_0x823429===_0xdc8b('0xa5')||_0x823429===_0xdc8b('0xa6')||_0x823429==='StateAttributeMetadata'||_0x823429===_0xdc8b('0xa7')){_0xf23b4f['push'](getInputList(_0x1134b7,_0x598252,_0x823429,_0x5b1f18,_0x47e06b[_0xdc8b('0x9e')],_0x4b1957[_0xdc8b('0x9e')],_0x3f53ba));}}});return Promise['all'](_0xf23b4f);})['then'](function(_0x36cd97){_0x4dbc6f=_0x36cd97[0x0];var _0x56a40e=_0x4bb26a['concat'](_0x34a9c4)['concat'](_0x4dbc6f);var _0x228c49={'count':_0x56a40e['length'],'rows':_0x56a40e};return _0x228c49;})[_0xdc8b('0x10')](respondWithResult(_0xcab95d,null))[_0xdc8b('0x2e')](function(_0x56a454){var _0xa49d55=_0x113ea8[_0xdc8b('0x1c')][_0xdc8b('0xa8')]?0x1f4:_0x56a454[_0xdc8b('0xa9')]||0x1f4;logger[_0xdc8b('0x12')](_0x56a454[_0xdc8b('0xaa')]);delete _0x56a454[_0xdc8b('0x13')];if(_0xa49d55===0x191){_0xa49d55=0x190;}_0xcab95d[_0xdc8b('0x8')](_0xa49d55)[_0xdc8b('0x14')](_0x113ea8['query'][_0xdc8b('0xa8')]?{'message':_0xdc8b('0xab'),'statusCode':_0x56a454[_0xdc8b('0xa9')]}:_0x56a454);});};function getSelectList(_0x196432,_0x29bf98,_0x29e4a2,_0x5792a0,_0x3c80f2,_0x5f0456){var _0x4dec02={'method':_0xdc8b('0x94'),'uri':_0x196432+_0xdc8b('0x96')+_0x5792a0+_0xdc8b('0xac')+_0x3c80f2+_0xdc8b('0xad')+_0xdc8b('0xae'),'headers':{'Authorization':'Bearer\x20'+_0x5f0456,'If-None-Match':null,'OData-Version':_0xdc8b('0x98')},'json':!![]};return rp(_0x4dec02)[_0xdc8b('0x10')](function(_0x24a9de){var _0x1d714d=[];var _0x7d722c=_0x24a9de[_0xdc8b('0xaf')]['Options'];_0x7d722c[_0xdc8b('0x9b')](function(_0x91824b){_0x1d714d[_0xdc8b('0xa2')]({'name':_0x91824b[_0xdc8b('0xb0')][_0xdc8b('0xb1')][_0xdc8b('0xb0')],'value':String(_0x91824b[_0xdc8b('0xb2')])});});var _0x1d86bc={'id':_0x29bf98+'_'+_0x24a9de[_0xdc8b('0xb3')],'name':_0x24a9de[_0xdc8b('0xb4')][_0xdc8b('0xb1')]['Label'],'custom':![],'options':_0x1d714d};_0x29e4a2['push'](_0x1d86bc);return _0x29e4a2;});}function getBooleanList(_0xfdb179,_0x24538a,_0x53e6ab,_0x4e2916,_0x8353f6,_0x24c08c){var _0x5f24da={'method':_0xdc8b('0x94'),'uri':_0xfdb179+_0xdc8b('0x96')+_0x4e2916+')/Attributes('+_0x8353f6+_0xdc8b('0xb5'),'headers':{'Authorization':_0xdc8b('0xb6')+_0x24c08c,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x5f24da)[_0xdc8b('0x10')](function(_0x27fc90){var _0x3ec13f=[];_0x3ec13f['push']({'name':_0x27fc90[_0xdc8b('0xaf')][_0xdc8b('0xb7')][_0xdc8b('0xb0')][_0xdc8b('0xb1')][_0xdc8b('0xb0')],'value':_0xdc8b('0xb8')},{'name':_0x27fc90[_0xdc8b('0xaf')][_0xdc8b('0xb9')]['Label']['UserLocalizedLabel'][_0xdc8b('0xb0')],'value':_0xdc8b('0xba')});var _0x44fa5f={'id':_0x24538a+'_'+_0x27fc90['LogicalName'],'name':_0x27fc90[_0xdc8b('0xb4')][_0xdc8b('0xb1')][_0xdc8b('0xb0')],'custom':![],'options':_0x3ec13f};_0x53e6ab[_0xdc8b('0xa2')](_0x44fa5f);return _0x53e6ab;});}function getInputList(_0x2b5bb6,_0x3f318d,_0x25a35b,_0x8dcfdf,_0x2b703a,_0x5ba557,_0x1a8045){var _0x452b30={'method':_0xdc8b('0x94'),'uri':_0x2b5bb6+_0xdc8b('0x96')+_0x2b703a+')/Attributes('+_0x5ba557+_0xdc8b('0xbb')+_0x25a35b+'?$select=DisplayName,LogicalName','headers':{'Authorization':_0xdc8b('0xb6')+_0x1a8045,'If-None-Match':null,'OData-Version':_0xdc8b('0x98')},'json':!![]};return rp(_0x452b30)[_0xdc8b('0x10')](function(_0x1ddfdd){var _0x37046b={'id':_0x3f318d+'_'+_0x1ddfdd[_0xdc8b('0xb3')],'name':_0x1ddfdd[_0xdc8b('0xb4')][_0xdc8b('0xb1')]?_0x1ddfdd['DisplayName'][_0xdc8b('0xb1')]['Label']:_0x1ddfdd[_0xdc8b('0xb3')],'custom':![],'options':[]};_0x8dcfdf[_0xdc8b('0xa2')](_0x37046b);return _0x8dcfdf;});} \ No newline at end of file +var _0x8b0c=['https://login.microsoftonline.com/','/oauth2/token','clientId','access_token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','includes','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','push','all','isNil','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','concat','test','error','statusCode',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','Options','Label','Value','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','OptionSet','TrueOption','UserLocalizedLabel','true','FalseOption','false',')/Microsoft.Dynamics.CRM.','request-promise','util','lodash','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','json','offset','undefined','limit','count','status','update','destroy','then','end','sendStatus','stack','name','send','index','Dynamics365Account','rawAttributes','fieldName','type','map','query','keys','filters','intersection','attributes','model','fields','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','catch','show','params','length','includeAll','find','create','body','getConfigurations','findOne','Dynamics365Configuration','pick','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','slice','substring','lastIndexOf','format','getFields','ticketType','description','customerid','ownerid','caseorigincode','subject','phonenumber','regardingobjectid','directioncode','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','createdbyexternalpartyyominame','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridyominame','emailaddress','entityimage_url','escalatedon','firstresponsebykpiidname','followupby','importsequencenumber','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','numberofchildincidents','onholdtime','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','socialprofileidname','ticketnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','username','password','remoteUri','tenantId','clientSecret','modernAuthentication','CloudProvider','data5','data7','POST'];(function(_0x45030e,_0x32b6b8){var _0x4df3be=function(_0x1fe781){while(--_0x1fe781){_0x45030e['push'](_0x45030e['shift']());}};_0x4df3be(++_0x32b6b8);}(_0x8b0c,0xec));var _0xc8b0=function(_0x12dca4,_0x38e541){_0x12dca4=_0x12dca4-0x0;var _0x5db702=_0x8b0c[_0x12dca4];return _0x5db702;};'use strict';var rp=require(_0xc8b0('0x0'));var util=require(_0xc8b0('0x1'));var _=require(_0xc8b0('0x2'));var qs=require('../../components/parsers/qs');var logger=require(_0xc8b0('0x3'))(_0xc8b0('0x4'));var db=require(_0xc8b0('0x5'))['db'];var integrations=require(_0xc8b0('0x6'));function respondWithResult(_0x17e519,_0x26c540){_0x26c540=_0x26c540||0xc8;return function(_0x2f0cea){if(_0x2f0cea){return _0x17e519['status'](_0x26c540)[_0xc8b0('0x7')](_0x2f0cea);}};}function respondWithFilteredResult(_0x358de8,_0x480e5e){return function(_0x2b4494){if(_0x2b4494){var _0x44a4b3=typeof _0x480e5e[_0xc8b0('0x8')]===_0xc8b0('0x9')&&typeof _0x480e5e[_0xc8b0('0xa')]==='undefined';var _0x10d012=_0x2b4494[_0xc8b0('0xb')];var _0x196a24=_0x44a4b3?0x0:_0x480e5e['offset'];var _0x550e4b=_0x44a4b3?_0x2b4494[_0xc8b0('0xb')]:_0x480e5e['offset']+_0x480e5e['limit'];var _0x42feb4;if(_0x550e4b>=_0x10d012){_0x550e4b=_0x10d012;_0x42feb4=0xc8;}else{_0x42feb4=0xce;}_0x358de8[_0xc8b0('0xc')](_0x42feb4);return _0x358de8['set']('Content-Range',_0x196a24+'-'+_0x550e4b+'/'+_0x10d012)[_0xc8b0('0x7')](_0x2b4494);}return null;};}function saveUpdates(_0x44a16e){return function(_0x2917cf){if(_0x2917cf){return _0x2917cf[_0xc8b0('0xd')](_0x44a16e)['then'](function(_0x466b17){return _0x466b17;});}return null;};}function removeEntity(_0x54a180){return function(_0x5916bb){if(_0x5916bb){return _0x5916bb[_0xc8b0('0xe')]()[_0xc8b0('0xf')](function(){_0x54a180['status'](0xcc)[_0xc8b0('0x10')]();});}};}function handleEntityNotFound(_0x24633b){return function(_0x213538){if(!_0x213538){_0x24633b[_0xc8b0('0x11')](0x194);}return _0x213538;};}function handleError(_0x2ec0df,_0x2d773d){_0x2d773d=_0x2d773d||0x1f4;return function(_0x1639c5){logger['error'](_0x1639c5[_0xc8b0('0x12')]);if(_0x1639c5['name']){delete _0x1639c5[_0xc8b0('0x13')];}_0x2ec0df['status'](_0x2d773d)[_0xc8b0('0x14')](_0x1639c5);};}exports[_0xc8b0('0x15')]=function(_0x1abb7a,_0x7f0cfc){var _0x22e5c0={},_0xa4eb3={},_0x462fa1={'count':0x0,'rows':[]};var _0x2cb380=_['map'](db[_0xc8b0('0x16')][_0xc8b0('0x17')],function(_0x312073){return{'name':_0x312073[_0xc8b0('0x18')],'type':_0x312073[_0xc8b0('0x19')]['key']};});_0xa4eb3['model']=_[_0xc8b0('0x1a')](_0x2cb380,_0xc8b0('0x13'));_0xa4eb3[_0xc8b0('0x1b')]=_[_0xc8b0('0x1c')](_0x1abb7a[_0xc8b0('0x1b')]);_0xa4eb3[_0xc8b0('0x1d')]=_[_0xc8b0('0x1e')](_0xa4eb3['model'],_0xa4eb3[_0xc8b0('0x1b')]);_0x22e5c0[_0xc8b0('0x1f')]=_['intersection'](_0xa4eb3[_0xc8b0('0x20')],qs['fields'](_0x1abb7a[_0xc8b0('0x1b')][_0xc8b0('0x21')]));_0x22e5c0[_0xc8b0('0x1f')]=_0x22e5c0['attributes']['length']?_0x22e5c0[_0xc8b0('0x1f')]:_0xa4eb3['model'];if(!_0x1abb7a['query'][_0xc8b0('0x22')]('nolimit')){_0x22e5c0[_0xc8b0('0xa')]=qs[_0xc8b0('0xa')](_0x1abb7a[_0xc8b0('0x1b')]['limit']);_0x22e5c0[_0xc8b0('0x8')]=qs[_0xc8b0('0x8')](_0x1abb7a['query'][_0xc8b0('0x8')]);}_0x22e5c0[_0xc8b0('0x23')]=qs[_0xc8b0('0x24')](_0x1abb7a[_0xc8b0('0x1b')][_0xc8b0('0x24')]);_0x22e5c0[_0xc8b0('0x25')]=qs[_0xc8b0('0x1d')](_['pick'](_0x1abb7a[_0xc8b0('0x1b')],_0xa4eb3['filters']),_0x2cb380);if(_0x1abb7a['query'][_0xc8b0('0x26')]){_0x22e5c0['where']=_[_0xc8b0('0x27')](_0x22e5c0[_0xc8b0('0x25')],{'$or':_[_0xc8b0('0x1a')](_0x2cb380,function(_0x4c8242){if(_0x4c8242[_0xc8b0('0x19')]!==_0xc8b0('0x28')){var _0x24b87a={};_0x24b87a[_0x4c8242[_0xc8b0('0x13')]]={'$like':'%'+_0x1abb7a['query'][_0xc8b0('0x26')]+'%'};return _0x24b87a;}})});}_0x22e5c0=_[_0xc8b0('0x27')]({},_0x22e5c0,_0x1abb7a[_0xc8b0('0x29')]);var _0x3b28f4={'where':_0x22e5c0['where']};return db['Dynamics365Account'][_0xc8b0('0xb')](_0x3b28f4)['then'](function(_0xb9c59b){_0x462fa1[_0xc8b0('0xb')]=_0xb9c59b;if(_0x1abb7a[_0xc8b0('0x1b')]['includeAll']){_0x22e5c0[_0xc8b0('0x2a')]=[{'all':!![]}];}return db[_0xc8b0('0x16')][_0xc8b0('0x2b')](_0x22e5c0);})[_0xc8b0('0xf')](function(_0x393d8b){_0x462fa1['rows']=_0x393d8b;return _0x462fa1;})[_0xc8b0('0xf')](respondWithFilteredResult(_0x7f0cfc,_0x22e5c0))[_0xc8b0('0x2c')](handleError(_0x7f0cfc,null));};exports[_0xc8b0('0x2d')]=function(_0x558161,_0x274020){var _0x839381={'raw':![],'where':{'id':_0x558161[_0xc8b0('0x2e')]['id']}},_0x2fa5a8={};_0x2fa5a8['model']=_[_0xc8b0('0x1c')](db[_0xc8b0('0x16')][_0xc8b0('0x17')]);_0x2fa5a8['query']=_[_0xc8b0('0x1c')](_0x558161['query']);_0x2fa5a8[_0xc8b0('0x1d')]=_[_0xc8b0('0x1e')](_0x2fa5a8[_0xc8b0('0x20')],_0x2fa5a8[_0xc8b0('0x1b')]);_0x839381[_0xc8b0('0x1f')]=_['intersection'](_0x2fa5a8[_0xc8b0('0x20')],qs[_0xc8b0('0x21')](_0x558161['query']['fields']));_0x839381['attributes']=_0x839381[_0xc8b0('0x1f')][_0xc8b0('0x2f')]?_0x839381[_0xc8b0('0x1f')]:_0x2fa5a8['model'];if(_0x558161['query'][_0xc8b0('0x30')]){_0x839381[_0xc8b0('0x2a')]=[{'all':!![]}];}_0x839381=_['merge']({},_0x839381,_0x558161['options']);return db['Dynamics365Account'][_0xc8b0('0x31')](_0x839381)[_0xc8b0('0xf')](handleEntityNotFound(_0x274020,null))[_0xc8b0('0xf')](respondWithResult(_0x274020,null))[_0xc8b0('0x2c')](handleError(_0x274020,null));};exports[_0xc8b0('0x32')]=function(_0x3d6d9f,_0x4f3540){return db[_0xc8b0('0x16')][_0xc8b0('0x32')](_0x3d6d9f[_0xc8b0('0x33')],{})[_0xc8b0('0xf')](respondWithResult(_0x4f3540,0xc9))['catch'](handleError(_0x4f3540,null));};exports[_0xc8b0('0xd')]=function(_0x23c593,_0x509456){if(_0x23c593['body']['id']){delete _0x23c593[_0xc8b0('0x33')]['id'];}return db[_0xc8b0('0x16')][_0xc8b0('0x31')]({'where':{'id':_0x23c593['params']['id']}})[_0xc8b0('0xf')](handleEntityNotFound(_0x509456,null))[_0xc8b0('0xf')](saveUpdates(_0x23c593['body'],null))[_0xc8b0('0xf')](respondWithResult(_0x509456,null))[_0xc8b0('0x2c')](handleError(_0x509456,null));};exports['destroy']=function(_0x31f61c,_0x9a0834){return db['Dynamics365Account'][_0xc8b0('0x31')]({'where':{'id':_0x31f61c[_0xc8b0('0x2e')]['id']}})[_0xc8b0('0xf')](handleEntityNotFound(_0x9a0834,null))['then'](removeEntity(_0x9a0834,null))[_0xc8b0('0x2c')](handleError(_0x9a0834,null));};exports[_0xc8b0('0x34')]=function(_0x4631a3,_0x96ceed){var _0x324136={};var _0x3de558={};var _0x387937;var _0x1641af;return db[_0xc8b0('0x16')][_0xc8b0('0x35')]({'where':{'id':_0x4631a3[_0xc8b0('0x2e')]['id']}})[_0xc8b0('0xf')](handleEntityNotFound(_0x96ceed,null))[_0xc8b0('0xf')](function(_0x46c960){if(_0x46c960){_0x387937=_0x46c960;_0x3de558[_0xc8b0('0x20')]=_[_0xc8b0('0x1c')](db[_0xc8b0('0x36')][_0xc8b0('0x17')]);_0x3de558['query']=_[_0xc8b0('0x1c')](_0x4631a3[_0xc8b0('0x1b')]);_0x3de558['filters']=_['intersection'](_0x3de558['model'],_0x3de558[_0xc8b0('0x1b')]);_0x324136[_0xc8b0('0x1f')]=_['intersection'](_0x3de558[_0xc8b0('0x20')],qs['fields'](_0x4631a3[_0xc8b0('0x1b')][_0xc8b0('0x21')]));_0x324136[_0xc8b0('0x1f')]=_0x324136[_0xc8b0('0x1f')][_0xc8b0('0x2f')]?_0x324136[_0xc8b0('0x1f')]:_0x3de558[_0xc8b0('0x20')];_0x324136[_0xc8b0('0x23')]=qs[_0xc8b0('0x24')](_0x4631a3['query'][_0xc8b0('0x24')]);_0x324136['where']=qs[_0xc8b0('0x1d')](_[_0xc8b0('0x37')](_0x4631a3[_0xc8b0('0x1b')],_0x3de558[_0xc8b0('0x1d')]));if(_0x4631a3[_0xc8b0('0x1b')][_0xc8b0('0x26')]){_0x324136[_0xc8b0('0x25')]=_[_0xc8b0('0x27')](_0x324136[_0xc8b0('0x25')],{'$or':_['map'](_0x324136[_0xc8b0('0x1f')],function(_0x5f50b7){var _0x9b3d01={};_0x9b3d01[_0x5f50b7]={'$like':'%'+_0x4631a3[_0xc8b0('0x1b')][_0xc8b0('0x26')]+'%'};return _0x9b3d01;})});}_0x324136=_[_0xc8b0('0x27')]({},_0x324136,_0x4631a3[_0xc8b0('0x29')]);return _0x387937[_0xc8b0('0x34')](_0x324136);}})[_0xc8b0('0xf')](function(_0x113c51){if(_0x113c51){_0x1641af=_0x113c51['length'];if(!_0x4631a3['query'][_0xc8b0('0x22')]('nolimit')){_0x324136[_0xc8b0('0xa')]=qs[_0xc8b0('0xa')](_0x4631a3['query'][_0xc8b0('0xa')]);_0x324136[_0xc8b0('0x8')]=qs[_0xc8b0('0x8')](_0x4631a3[_0xc8b0('0x1b')][_0xc8b0('0x8')]);}return _0x387937[_0xc8b0('0x34')](_0x324136);}})[_0xc8b0('0xf')](function(_0x5c5e2d){if(_0x5c5e2d){return _0x5c5e2d?{'count':_0x1641af,'rows':_0x5c5e2d}:null;}})[_0xc8b0('0xf')](respondWithResult(_0x96ceed,null))[_0xc8b0('0x2c')](handleError(_0x96ceed,null));};exports['addConfiguration']=function(_0x378b21,_0x5b06fd){if(_0x378b21[_0xc8b0('0x33')]['id']){delete _0x378b21[_0xc8b0('0x33')]['id'];}return db[_0xc8b0('0x16')][_0xc8b0('0x35')]({'where':{'id':_0x378b21[_0xc8b0('0x2e')]['id']}})[_0xc8b0('0xf')](handleEntityNotFound(_0x5b06fd,null))[_0xc8b0('0xf')](function(_0x3dac69){if(_0x3dac69){_0x378b21[_0xc8b0('0x33')][_0xc8b0('0x38')]=_0x3dac69['id'];_0x378b21[_0xc8b0('0x33')][_0xc8b0('0x39')]=integrations[_0xc8b0('0x3a')](_0x378b21['body'][_0xc8b0('0x3b')],_0x378b21[_0xc8b0('0x33')][_0xc8b0('0x19')]);_0x378b21[_0xc8b0('0x33')][_0xc8b0('0x3c')]=integrations[_0xc8b0('0x3d')](_0x378b21[_0xc8b0('0x33')][_0xc8b0('0x3b')],_0x378b21[_0xc8b0('0x33')][_0xc8b0('0x19')]);return db['Dynamics365Configuration'][_0xc8b0('0x32')](_0x378b21[_0xc8b0('0x33')],{'include':[{'model':db['Dynamics365Field'],'as':'Subjects'},{'model':db['Dynamics365Field'],'as':_0xc8b0('0x3c')}]});}return null;})[_0xc8b0('0xf')](respondWithResult(_0x5b06fd,null))['catch'](handleError(_0x5b06fd,null));};function sanitizeRemoteUri(_0x2bc896){var _0x2e6d00=_0x2bc896[_0xc8b0('0x3e')](-0x1);if(_0x2e6d00==='/')return _0x2bc896[_0xc8b0('0x3f')](0x0,_0x2bc896[_0xc8b0('0x40')](_0x2e6d00));return _0x2bc896;}function getWebApiUrl(_0x362cf7){return util[_0xc8b0('0x41')]('%s/api/data/v9.0/',_0x362cf7);}exports[_0xc8b0('0x42')]=function(_0x4b62e0,_0x56f383){var _0x537d40=_0x4b62e0['query'][_0xc8b0('0x43')];var _0x3bd527=_0x537d40==='incident'?'Incident':'PhoneCall';var _0x4981a9='';var _0xfba92d='';var _0x14347a='';var _0x3d5ba1='';var _0x3340cd='';var _0x40f740='';var _0x70c2ac='';var _0x512f49='';var _0x21438f=['title',_0xc8b0('0x44'),_0xc8b0('0x45'),_0xc8b0('0x46'),_0xc8b0('0x47'),_0xc8b0('0x48'),_0xc8b0('0x49'),_0xc8b0('0x4a'),_0xc8b0('0x4b'),'phonecall_activity_parties'];var _0x9d9fd7=[_0xc8b0('0x4c'),_0xc8b0('0x4d'),_0xc8b0('0x4e'),_0xc8b0('0x4f'),_0xc8b0('0x50'),_0xc8b0('0x51'),'contractdetailidname','contractidname','createdbyexternalpartyname',_0xc8b0('0x52'),'createdbyname',_0xc8b0('0x53'),_0xc8b0('0x54'),_0xc8b0('0x55'),_0xc8b0('0x56'),_0xc8b0('0x57'),'customeridtype',_0xc8b0('0x58'),_0xc8b0('0x59'),'entitlementidname','entityimage_timestamp',_0xc8b0('0x5a'),_0xc8b0('0x5b'),'exchangerate',_0xc8b0('0x5c'),_0xc8b0('0x5d'),_0xc8b0('0x5e'),'influencescore','kbarticleidname','lastonholdtime',_0xc8b0('0x5f'),_0xc8b0('0x60'),_0xc8b0('0x61'),_0xc8b0('0x62'),_0xc8b0('0x63'),_0xc8b0('0x64'),_0xc8b0('0x65'),_0xc8b0('0x66'),_0xc8b0('0x67'),'msdyn_iotalertname',_0xc8b0('0x68'),_0xc8b0('0x69'),'overriddencreatedon',_0xc8b0('0x6a'),_0xc8b0('0x6b'),_0xc8b0('0x6c'),_0xc8b0('0x6d'),_0xc8b0('0x6e'),_0xc8b0('0x6f'),_0xc8b0('0x70'),_0xc8b0('0x71'),'productserialnumber',_0xc8b0('0x72'),_0xc8b0('0x73'),_0xc8b0('0x74'),_0xc8b0('0x75'),_0xc8b0('0x76'),_0xc8b0('0x77'),_0xc8b0('0x78'),_0xc8b0('0x79'),_0xc8b0('0x7a'),'statecode','statuscode','subjectidname',_0xc8b0('0x7b'),'timezoneruleversionnumber',_0xc8b0('0x7c'),_0xc8b0('0x7d'),_0xc8b0('0x7e'),_0xc8b0('0x7f')];var _0x3ac16a=_0x21438f['concat'](_0x9d9fd7);return db[_0xc8b0('0x16')][_0xc8b0('0x35')]({'where':{'id':_0x4b62e0[_0xc8b0('0x2e')]['id']},'attributes':['id',_0xc8b0('0x80'),_0xc8b0('0x81'),_0xc8b0('0x82'),_0xc8b0('0x83'),'clientId',_0xc8b0('0x84'),_0xc8b0('0x85')],'include':[{'model':db['CloudProvider'],'as':_0xc8b0('0x86'),'attributes':['id',_0xc8b0('0x87'),_0xc8b0('0x88')]}]})[_0xc8b0('0xf')](handleEntityNotFound(_0x56f383,null))['then'](function(_0x1be349){if(_0x1be349){if(_0x1be349['modernAuthentication']){_0x1be349['access_token']=_0x1be349[_0xc8b0('0x86')][_0xc8b0('0x87')];_0x512f49=sanitizeRemoteUri(_0x1be349[_0xc8b0('0x86')]['data7']);_0x70c2ac=getWebApiUrl(_0x512f49);return _0x1be349;}_0x512f49=sanitizeRemoteUri(_0x1be349['remoteUri']);_0x70c2ac=getWebApiUrl(_0x512f49);var _0xdfecfe={'method':_0xc8b0('0x89'),'uri':_0xc8b0('0x8a')+_0x1be349[_0xc8b0('0x83')]+_0xc8b0('0x8b'),'form':{'client_id':_0x1be349[_0xc8b0('0x8c')],'resource':_0x512f49,'username':_0x1be349[_0xc8b0('0x80')],'password':_0x1be349[_0xc8b0('0x81')],'grant_type':_0xc8b0('0x81'),'client_secret':_0x1be349[_0xc8b0('0x84')]},'json':!![]};return rp(_0xdfecfe);}})[_0xc8b0('0xf')](function(_0xf10452){_0x40f740=_0xf10452[_0xc8b0('0x8d')];var _0x5488ec={'method':_0xc8b0('0x8e'),'uri':encodeURI(_0x70c2ac+_0xc8b0('0x8f')+_0x3bd527+'\x27'),'headers':{'Authorization':_0xc8b0('0x90')+_0x40f740,'If-None-Match':null,'OData-Version':_0xc8b0('0x91')},'json':!![]};return rp(_0x5488ec);})[_0xc8b0('0xf')](function(_0x570fbb){var _0x4e0ea1=_0x570fbb[_0xc8b0('0x92')][0x0];var _0x196b08=_0x4e0ea1[_0xc8b0('0x93')];var _0x1127f3={'method':_0xc8b0('0x8e'),'uri':_0x70c2ac+_0xc8b0('0x94')+_0x196b08+_0xc8b0('0x95'),'headers':{'Authorization':_0xc8b0('0x90')+_0x40f740,'If-None-Match':null,'OData-Version':_0xc8b0('0x91')},'json':!![]};return rp(_0x1127f3);})[_0xc8b0('0xf')](function(_0x1d6308){_0x4981a9=_0x1d6308;_0xfba92d=_0x4981a9[_0xc8b0('0x96')];_0xfba92d=_['remove'](_0xfba92d,function(_0x226733){return!_0x3ac16a[_0xc8b0('0x97')](_0x226733[_0xc8b0('0x98')]);});var _0x49e2a4=[];var _0xb0966e=[];_0xfba92d[_0xc8b0('0x99')](function(_0x308932){if(_0x308932[_0xc8b0('0x9a')]){var _0x5039e4=_0x308932[_0xc8b0('0x9a')][_0xc8b0('0x3f')](_0x308932[_0xc8b0('0x9a')][_0xc8b0('0x40')]('.')+0x1);if(_0x5039e4===_0xc8b0('0x9b')){_0x49e2a4[_0xc8b0('0x9c')](getSelectList(_0x70c2ac,_0x537d40,_0xb0966e,_0x4981a9[_0xc8b0('0x93')],_0x308932['MetadataId'],_0x40f740));}}});return Promise[_0xc8b0('0x9d')](_0x49e2a4);})[_0xc8b0('0xf')](function(_0x5a7b19){_0x14347a=_0x5a7b19[0x0];var _0x106235=[];var _0x4cab2f=[];_0xfba92d['forEach'](function(_0x503585){if(!_[_0xc8b0('0x9e')](_0x503585[_0xc8b0('0x9a')])){var _0x379d48=_0x503585['@odata.type'][_0xc8b0('0x3f')](_0x503585[_0xc8b0('0x9a')]['lastIndexOf']('.')+0x1);if(_0x379d48===_0xc8b0('0x9f')){_0x106235[_0xc8b0('0x9c')](getBooleanList(_0x70c2ac,_0x537d40,_0x4cab2f,_0x4981a9[_0xc8b0('0x93')],_0x503585[_0xc8b0('0x93')],_0x40f740));}}});return Promise['all'](_0x106235);})[_0xc8b0('0xf')](function(_0xe6dd6e){_0x3d5ba1=_0xe6dd6e[0x0];var _0x260d0e=[];var _0x4691e4=[];_0xfba92d['forEach'](function(_0x1dee97){if(_0x1dee97[_0xc8b0('0x9a')]){var _0x344e3d=_0x1dee97['@odata.type'][_0xc8b0('0x3f')](_0x1dee97[_0xc8b0('0x9a')][_0xc8b0('0x40')]('.')+0x1);if(_0x344e3d===_0xc8b0('0xa0')||_0x344e3d===_0xc8b0('0xa1')||_0x344e3d===_0xc8b0('0xa2')||_0x344e3d===_0xc8b0('0xa3')||_0x344e3d===_0xc8b0('0xa4')||_0x344e3d===_0xc8b0('0xa5')||_0x344e3d===_0xc8b0('0xa6')||_0x344e3d===_0xc8b0('0xa7')||_0x344e3d===_0xc8b0('0xa8')||_0x344e3d==='DecimalAttributeMetadata'){_0x260d0e[_0xc8b0('0x9c')](getInputList(_0x70c2ac,_0x537d40,_0x344e3d,_0x4691e4,_0x4981a9['MetadataId'],_0x1dee97[_0xc8b0('0x93')],_0x40f740));}}});return Promise[_0xc8b0('0x9d')](_0x260d0e);})['then'](function(_0x31dd90){_0x3340cd=_0x31dd90[0x0];var _0x18d0b5=_0x14347a[_0xc8b0('0xa9')](_0x3d5ba1)['concat'](_0x3340cd);var _0x3a7f07={'count':_0x18d0b5['length'],'rows':_0x18d0b5};return _0x3a7f07;})[_0xc8b0('0xf')](respondWithResult(_0x56f383,null))[_0xc8b0('0x2c')](function(_0x13333e){var _0x4afe04=_0x4b62e0['query'][_0xc8b0('0xaa')]?0x1f4:_0x13333e['statusCode']||0x1f4;logger[_0xc8b0('0xab')](_0x13333e[_0xc8b0('0x12')]);delete _0x13333e[_0xc8b0('0x13')];if(_0x4afe04===0x191){_0x4afe04=0x190;}_0x56f383[_0xc8b0('0xc')](_0x4afe04)['send'](_0x4b62e0[_0xc8b0('0x1b')][_0xc8b0('0xaa')]?{'message':'Wrong\x20credentials','statusCode':_0x13333e[_0xc8b0('0xac')]}:_0x13333e);});};function getSelectList(_0x2a98d6,_0x1b7c3e,_0x4cd130,_0x171248,_0x358d99,_0x3cdf36){var _0x4fed0d={'method':_0xc8b0('0x8e'),'uri':_0x2a98d6+_0xc8b0('0x94')+_0x171248+_0xc8b0('0xad')+_0x358d99+_0xc8b0('0xae')+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':'Bearer\x20'+_0x3cdf36,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x4fed0d)[_0xc8b0('0xf')](function(_0x29782f){var _0x4fd7b6=[];var _0x56919d=_0x29782f['OptionSet'][_0xc8b0('0xaf')];_0x56919d['forEach'](function(_0x2f9af4){_0x4fd7b6['push']({'name':_0x2f9af4[_0xc8b0('0xb0')]['UserLocalizedLabel']['Label'],'value':String(_0x2f9af4[_0xc8b0('0xb1')])});});var _0x2c0f5e={'id':_0x1b7c3e+'_'+_0x29782f['LogicalName'],'name':_0x29782f[_0xc8b0('0xb2')]['UserLocalizedLabel']['Label'],'custom':![],'options':_0x4fd7b6};_0x4cd130[_0xc8b0('0x9c')](_0x2c0f5e);return _0x4cd130;});}function getBooleanList(_0x497d2e,_0x42b96c,_0x4fceb6,_0x30e2b5,_0x5e4de4,_0x45438f){var _0x1091dc={'method':_0xc8b0('0x8e'),'uri':_0x497d2e+_0xc8b0('0x94')+_0x30e2b5+_0xc8b0('0xad')+_0x5e4de4+_0xc8b0('0xb3'),'headers':{'Authorization':_0xc8b0('0x90')+_0x45438f,'If-None-Match':null,'OData-Version':_0xc8b0('0x91')},'json':!![]};return rp(_0x1091dc)[_0xc8b0('0xf')](function(_0x2ec0e7){var _0x44d7d4=[];_0x44d7d4[_0xc8b0('0x9c')]({'name':_0x2ec0e7[_0xc8b0('0xb4')][_0xc8b0('0xb5')][_0xc8b0('0xb0')][_0xc8b0('0xb6')][_0xc8b0('0xb0')],'value':_0xc8b0('0xb7')},{'name':_0x2ec0e7[_0xc8b0('0xb4')][_0xc8b0('0xb8')][_0xc8b0('0xb0')][_0xc8b0('0xb6')][_0xc8b0('0xb0')],'value':_0xc8b0('0xb9')});var _0x36cbcc={'id':_0x42b96c+'_'+_0x2ec0e7[_0xc8b0('0x98')],'name':_0x2ec0e7['DisplayName'][_0xc8b0('0xb6')][_0xc8b0('0xb0')],'custom':![],'options':_0x44d7d4};_0x4fceb6[_0xc8b0('0x9c')](_0x36cbcc);return _0x4fceb6;});}function getInputList(_0x3adcba,_0x1b7032,_0x3b1808,_0x146a1d,_0x29fca4,_0x4bc74f,_0x4537de){var _0x312dcf={'method':_0xc8b0('0x8e'),'uri':_0x3adcba+_0xc8b0('0x94')+_0x29fca4+_0xc8b0('0xad')+_0x4bc74f+_0xc8b0('0xba')+_0x3b1808+'?$select=DisplayName,LogicalName','headers':{'Authorization':'Bearer\x20'+_0x4537de,'If-None-Match':null,'OData-Version':_0xc8b0('0x91')},'json':!![]};return rp(_0x312dcf)[_0xc8b0('0xf')](function(_0x5b5ba8){var _0x3bb838={'id':_0x1b7032+'_'+_0x5b5ba8[_0xc8b0('0x98')],'name':_0x5b5ba8['DisplayName'][_0xc8b0('0xb6')]?_0x5b5ba8[_0xc8b0('0xb2')][_0xc8b0('0xb6')]['Label']:_0x5b5ba8[_0xc8b0('0x98')],'custom':![],'options':[]};_0x146a1d['push'](_0x3bb838);return _0x146a1d;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 44f0ce5..acdf06d 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 _0xd8b0=['exports','Dynamics365Account','int_dynamics365_accounts','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x4e0e68,_0x38b5d8){var _0x5c44e7=function(_0x1e6559){while(--_0x1e6559){_0x4e0e68['push'](_0x4e0e68['shift']());}};_0x5c44e7(++_0x38b5d8);}(_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('./intDynamics365Account.attributes');var integrations=require('../../components/integrations/configuration');module[_0x0d8b('0x7')]=function(_0x227c63,_0x39f43a){return _0x227c63['define'](_0x0d8b('0x8'),attributes,{'tableName':_0x0d8b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x757a=['Dynamics365Account','int_dynamics365_accounts','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration'];(function(_0x4ff828,_0x4b4d35){var _0x3f9dfb=function(_0x226c21){while(--_0x226c21){_0x4ff828['push'](_0x4ff828['shift']());}};_0x3f9dfb(++_0x4b4d35);}(_0x757a,0xde));var _0xa757=function(_0x5749e2,_0x33649b){_0x5749e2=_0x5749e2-0x0;var _0x57bd00=_0x757a[_0x5749e2];return _0x57bd00;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var logger=require(_0xa757('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa757('0x2'));var fs=require('fs');var path=require(_0xa757('0x3'));var rimraf=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var attributes=require(_0xa757('0x6'));var integrations=require(_0xa757('0x7'));module['exports']=function(_0xae0e7c,_0x4343b6){return _0xae0e7c['define'](_0xa757('0x8'),attributes,{'tableName':_0xa757('0x9'),'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 f35a779..76ab0a7 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 _0xe69f=['moment','bluebird','randomstring','ioredis','../../config/utils','rpc','http','request','then','info','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','Dynamics365Account,\x20%s,\x20%s','message','result','catch','GetDynamics365Account','findAll','options','raw','where','attributes','limit','include','map','ShowDynamics365Account','Dynamics365Account','find','model','lodash','util'];(function(_0x53fbdd,_0x3de7ed){var _0x5d1ee5=function(_0x382fa2){while(--_0x382fa2){_0x53fbdd['push'](_0x53fbdd['shift']());}};_0x5d1ee5(++_0x3de7ed);}(_0xe69f,0x67));var _0xfe69=function(_0x366951,_0x17490b){_0x366951=_0x366951-0x0;var _0x57c837=_0xe69f[_0x366951];return _0x57c837;};'use strict';var _=require(_0xfe69('0x0'));var util=require(_0xfe69('0x1'));var moment=require(_0xfe69('0x2'));var BPromise=require(_0xfe69('0x3'));var rs=require(_0xfe69('0x4'));var fs=require('fs');var Redis=require(_0xfe69('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xfe69('0x6'));var logger=require('../../config/logger')(_0xfe69('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xfe69('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xb3b6a4,_0x1f9eda,_0x515f42){return new BPromise(function(_0x2dc12c,_0x3ff876){return client[_0xfe69('0x9')](_0xb3b6a4,_0x515f42)[_0xfe69('0xa')](function(_0x37fde9){logger[_0xfe69('0xb')]('Dynamics365Account,\x20%s,\x20%s',_0x1f9eda,_0xfe69('0xc'));logger[_0xfe69('0xd')](_0xfe69('0xe'),_0x1f9eda,_0xfe69('0xc'),JSON[_0xfe69('0xf')](_0x37fde9));if(_0x37fde9[_0xfe69('0x10')]){if(_0x37fde9[_0xfe69('0x10')][_0xfe69('0x11')]===0x1f4){logger['error'](_0xfe69('0x12'),_0x1f9eda,_0x37fde9[_0xfe69('0x10')][_0xfe69('0x13')]);return _0x3ff876(_0x37fde9[_0xfe69('0x10')][_0xfe69('0x13')]);}logger[_0xfe69('0x10')]('Dynamics365Account,\x20%s,\x20%s',_0x1f9eda,_0x37fde9[_0xfe69('0x10')][_0xfe69('0x13')]);return _0x2dc12c(_0x37fde9['error'][_0xfe69('0x13')]);}else{logger['info'](_0xfe69('0x12'),_0x1f9eda,_0xfe69('0xc'));_0x2dc12c(_0x37fde9[_0xfe69('0x14')][_0xfe69('0x13')]);}})[_0xfe69('0x15')](function(_0x18f2c0){logger[_0xfe69('0x10')](_0xfe69('0x12'),_0x1f9eda,_0x18f2c0);_0x3ff876(_0x18f2c0);});});}exports[_0xfe69('0x16')]=function(_0x5882c4){var _0x320495=this;return new Promise(function(_0x4cee92,_0x107aef){return db['Dynamics365Account'][_0xfe69('0x17')]({'raw':_0x5882c4[_0xfe69('0x18')]?_0x5882c4[_0xfe69('0x18')][_0xfe69('0x19')]===undefined?!![]:![]:!![],'where':_0x5882c4[_0xfe69('0x18')]?_0x5882c4['options'][_0xfe69('0x1a')]||null:null,'attributes':_0x5882c4[_0xfe69('0x18')]?_0x5882c4[_0xfe69('0x18')][_0xfe69('0x1b')]||null:null,'limit':_0x5882c4['options']?_0x5882c4[_0xfe69('0x18')][_0xfe69('0x1c')]||null:null,'include':_0x5882c4[_0xfe69('0x18')]?_0x5882c4[_0xfe69('0x18')][_0xfe69('0x1d')]?_['map'](_0x5882c4[_0xfe69('0x18')][_0xfe69('0x1d')],function(_0x51d4d9){return{'model':db[_0x51d4d9['model']],'as':_0x51d4d9['as'],'attributes':_0x51d4d9[_0xfe69('0x1b')],'include':_0x51d4d9['include']?_['map'](_0x51d4d9['include'],function(_0x339109){return{'model':db[_0x339109['model']],'as':_0x339109['as'],'attributes':_0x339109[_0xfe69('0x1b')],'include':_0x339109[_0xfe69('0x1d')]?_[_0xfe69('0x1e')](_0x339109['include'],function(_0x2b85e8){return{'model':db[_0x2b85e8['model']],'as':_0x2b85e8['as'],'attributes':_0x2b85e8[_0xfe69('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xfe69('0xa')](function(_0x5c733f){logger[_0xfe69('0xb')]('GetDynamics365Account',_0x5882c4);logger['debug'](_0xfe69('0x16'),_0x5882c4,JSON[_0xfe69('0xf')](_0x5c733f));_0x4cee92(_0x5c733f);})['catch'](function(_0x9df76c){logger[_0xfe69('0x10')](_0xfe69('0x16'),_0x9df76c['message'],_0x5882c4);_0x107aef(_0x320495['error'](0x1f4,_0x9df76c[_0xfe69('0x13')]));});});};exports[_0xfe69('0x1f')]=function(_0x500d38){var _0x15ccdf=this;return new Promise(function(_0xe3491b,_0x373881){return db[_0xfe69('0x20')][_0xfe69('0x21')]({'raw':_0x500d38[_0xfe69('0x18')]?_0x500d38[_0xfe69('0x18')][_0xfe69('0x19')]===undefined?!![]:![]:!![],'where':_0x500d38[_0xfe69('0x18')]?_0x500d38[_0xfe69('0x18')][_0xfe69('0x1a')]||null:null,'attributes':_0x500d38[_0xfe69('0x18')]?_0x500d38[_0xfe69('0x18')][_0xfe69('0x1b')]||null:null,'include':_0x500d38[_0xfe69('0x18')]?_0x500d38['options'][_0xfe69('0x1d')]?_[_0xfe69('0x1e')](_0x500d38[_0xfe69('0x18')][_0xfe69('0x1d')],function(_0x5c0539){return{'model':db[_0x5c0539[_0xfe69('0x22')]],'as':_0x5c0539['as'],'attributes':_0x5c0539[_0xfe69('0x1b')],'include':_0x5c0539[_0xfe69('0x1d')]?_['map'](_0x5c0539[_0xfe69('0x1d')],function(_0x225ed3){return{'model':db[_0x225ed3[_0xfe69('0x22')]],'as':_0x225ed3['as'],'attributes':_0x225ed3[_0xfe69('0x1b')],'include':_0x225ed3[_0xfe69('0x1d')]?_[_0xfe69('0x1e')](_0x225ed3[_0xfe69('0x1d')],function(_0x466307){return{'model':db[_0x466307[_0xfe69('0x22')]],'as':_0x466307['as'],'attributes':_0x466307[_0xfe69('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5e883d){logger[_0xfe69('0xb')]('ShowDynamics365Account',_0x500d38);logger[_0xfe69('0xd')]('ShowDynamics365Account',_0x500d38,JSON[_0xfe69('0xf')](_0x5e883d));_0xe3491b(_0x5e883d);})[_0xfe69('0x15')](function(_0x3ddd69){logger[_0xfe69('0x10')](_0xfe69('0x1f'),_0x3ddd69['message'],_0x500d38);_0x373881(_0x15ccdf[_0xfe69('0x10')](0x1f4,_0x3ddd69['message']));});});}; \ No newline at end of file +var _0x5f57=['../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetDynamics365Account','Dynamics365Account','findAll','options','raw','include','map','model','attributes','ShowDynamics365Account','find','where','lodash','moment','randomstring','../../mysqldb','../../config/utils'];(function(_0xd0c408,_0x5a19a9){var _0x542ce2=function(_0x405a77){while(--_0x405a77){_0xd0c408['push'](_0xd0c408['shift']());}};_0x542ce2(++_0x5a19a9);}(_0x5f57,0xe9));var _0x75f5=function(_0x4eb44b,_0x49f016){_0x4eb44b=_0x4eb44b-0x0;var _0x1f137f=_0x5f57[_0x4eb44b];return _0x1f137f;};'use strict';var _=require(_0x75f5('0x0'));var util=require('util');var moment=require(_0x75f5('0x1'));var BPromise=require('bluebird');var rs=require(_0x75f5('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x75f5('0x3'))['db'];var utils=require(_0x75f5('0x4'));var logger=require(_0x75f5('0x5'))(_0x75f5('0x6'));var config=require(_0x75f5('0x7'));var jayson=require(_0x75f5('0x8'));var client=jayson['client'][_0x75f5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3a1062,_0x34ccc7,_0x30f8b4){return new BPromise(function(_0x420770,_0x3ce721){return client[_0x75f5('0xa')](_0x3a1062,_0x30f8b4)[_0x75f5('0xb')](function(_0x244923){logger[_0x75f5('0xc')](_0x75f5('0xd'),_0x34ccc7,_0x75f5('0xe'));logger[_0x75f5('0xf')](_0x75f5('0x10'),_0x34ccc7,_0x75f5('0xe'),JSON[_0x75f5('0x11')](_0x244923));if(_0x244923[_0x75f5('0x12')]){if(_0x244923[_0x75f5('0x12')][_0x75f5('0x13')]===0x1f4){logger[_0x75f5('0x12')](_0x75f5('0xd'),_0x34ccc7,_0x244923[_0x75f5('0x12')][_0x75f5('0x14')]);return _0x3ce721(_0x244923[_0x75f5('0x12')][_0x75f5('0x14')]);}logger[_0x75f5('0x12')](_0x75f5('0xd'),_0x34ccc7,_0x244923[_0x75f5('0x12')]['message']);return _0x420770(_0x244923[_0x75f5('0x12')]['message']);}else{logger[_0x75f5('0xc')](_0x75f5('0xd'),_0x34ccc7,_0x75f5('0xe'));_0x420770(_0x244923['result'][_0x75f5('0x14')]);}})[_0x75f5('0x15')](function(_0x2cab66){logger[_0x75f5('0x12')](_0x75f5('0xd'),_0x34ccc7,_0x2cab66);_0x3ce721(_0x2cab66);});});}exports[_0x75f5('0x16')]=function(_0x4e6e1a){var _0x19eeb5=this;return new Promise(function(_0x3b177a,_0x10e9eb){return db[_0x75f5('0x17')][_0x75f5('0x18')]({'raw':_0x4e6e1a[_0x75f5('0x19')]?_0x4e6e1a[_0x75f5('0x19')][_0x75f5('0x1a')]===undefined?!![]:![]:!![],'where':_0x4e6e1a[_0x75f5('0x19')]?_0x4e6e1a[_0x75f5('0x19')]['where']||null:null,'attributes':_0x4e6e1a[_0x75f5('0x19')]?_0x4e6e1a[_0x75f5('0x19')]['attributes']||null:null,'limit':_0x4e6e1a['options']?_0x4e6e1a[_0x75f5('0x19')]['limit']||null:null,'include':_0x4e6e1a['options']?_0x4e6e1a[_0x75f5('0x19')][_0x75f5('0x1b')]?_[_0x75f5('0x1c')](_0x4e6e1a['options'][_0x75f5('0x1b')],function(_0x33f027){return{'model':db[_0x33f027[_0x75f5('0x1d')]],'as':_0x33f027['as'],'attributes':_0x33f027[_0x75f5('0x1e')],'include':_0x33f027[_0x75f5('0x1b')]?_[_0x75f5('0x1c')](_0x33f027[_0x75f5('0x1b')],function(_0x31271d){return{'model':db[_0x31271d['model']],'as':_0x31271d['as'],'attributes':_0x31271d['attributes'],'include':_0x31271d[_0x75f5('0x1b')]?_[_0x75f5('0x1c')](_0x31271d[_0x75f5('0x1b')],function(_0x19a9d9){return{'model':db[_0x19a9d9[_0x75f5('0x1d')]],'as':_0x19a9d9['as'],'attributes':_0x19a9d9[_0x75f5('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x75f5('0xb')](function(_0x1e1b5e){logger[_0x75f5('0xc')](_0x75f5('0x16'),_0x4e6e1a);logger[_0x75f5('0xf')](_0x75f5('0x16'),_0x4e6e1a,JSON[_0x75f5('0x11')](_0x1e1b5e));_0x3b177a(_0x1e1b5e);})[_0x75f5('0x15')](function(_0x5d76c9){logger[_0x75f5('0x12')](_0x75f5('0x16'),_0x5d76c9['message'],_0x4e6e1a);_0x10e9eb(_0x19eeb5[_0x75f5('0x12')](0x1f4,_0x5d76c9[_0x75f5('0x14')]));});});};exports[_0x75f5('0x1f')]=function(_0x4aba33){var _0x22ec1c=this;return new Promise(function(_0x2f63d9,_0x2b76ee){return db[_0x75f5('0x17')][_0x75f5('0x20')]({'raw':_0x4aba33[_0x75f5('0x19')]?_0x4aba33[_0x75f5('0x19')][_0x75f5('0x1a')]===undefined?!![]:![]:!![],'where':_0x4aba33['options']?_0x4aba33[_0x75f5('0x19')][_0x75f5('0x21')]||null:null,'attributes':_0x4aba33['options']?_0x4aba33[_0x75f5('0x19')][_0x75f5('0x1e')]||null:null,'include':_0x4aba33[_0x75f5('0x19')]?_0x4aba33[_0x75f5('0x19')][_0x75f5('0x1b')]?_['map'](_0x4aba33[_0x75f5('0x19')][_0x75f5('0x1b')],function(_0x9dcb4e){return{'model':db[_0x9dcb4e[_0x75f5('0x1d')]],'as':_0x9dcb4e['as'],'attributes':_0x9dcb4e['attributes'],'include':_0x9dcb4e[_0x75f5('0x1b')]?_['map'](_0x9dcb4e[_0x75f5('0x1b')],function(_0x9bc6fa){return{'model':db[_0x9bc6fa[_0x75f5('0x1d')]],'as':_0x9bc6fa['as'],'attributes':_0x9bc6fa[_0x75f5('0x1e')],'include':_0x9bc6fa[_0x75f5('0x1b')]?_[_0x75f5('0x1c')](_0x9bc6fa['include'],function(_0x1ca98a){return{'model':db[_0x1ca98a['model']],'as':_0x1ca98a['as'],'attributes':_0x1ca98a['attributes']};}):[]};}):[]};}):[]:[]})[_0x75f5('0xb')](function(_0x42c2b3){logger[_0x75f5('0xc')](_0x75f5('0x1f'),_0x4aba33);logger[_0x75f5('0xf')](_0x75f5('0x1f'),_0x4aba33,JSON[_0x75f5('0x11')](_0x42c2b3));_0x2f63d9(_0x42c2b3);})[_0x75f5('0x15')](function(_0x1dafb9){logger[_0x75f5('0x12')](_0x75f5('0x1f'),_0x1dafb9['message'],_0x4aba33);_0x2b76ee(_0x22ec1c['error'](0x1f4,_0x1dafb9[_0x75f5('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 1f8b9bd..95bb037 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 _0x8bc8=['show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','put','update','delete','/:id','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','index'];(function(_0x58ec63,_0x14c361){var _0x1cc1a2=function(_0x55c7e3){while(--_0x55c7e3){_0x58ec63['push'](_0x58ec63['shift']());}};_0x1cc1a2(++_0x14c361);}(_0x8bc8,0x1c0));var _0x88bc=function(_0x13409a,_0x8f949e){_0x13409a=_0x13409a-0x0;var _0x12815b=_0x8bc8[_0x13409a];return _0x12815b;};'use strict';var multer=require('multer');var util=require(_0x88bc('0x0'));var path=require(_0x88bc('0x1'));var timeout=require(_0x88bc('0x2'));var express=require(_0x88bc('0x3'));var router=express[_0x88bc('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x88bc('0x5'));var interaction=require(_0x88bc('0x6'));var config=require(_0x88bc('0x7'));var controller=require(_0x88bc('0x8'));router[_0x88bc('0x9')]('/',auth[_0x88bc('0xa')](),controller[_0x88bc('0xb')]);router['get']('/:id',auth[_0x88bc('0xa')](),controller[_0x88bc('0xc')]);router[_0x88bc('0x9')]('/:id/fields',auth[_0x88bc('0xa')](),controller[_0x88bc('0xd')]);router[_0x88bc('0x9')](_0x88bc('0xe'),auth[_0x88bc('0xa')](),controller[_0x88bc('0xf')]);router[_0x88bc('0x9')](_0x88bc('0x10'),auth['isAuthenticated'](),controller[_0x88bc('0x11')]);router['post']('/',auth[_0x88bc('0xa')](),controller['create']);router[_0x88bc('0x12')]('/:id',auth[_0x88bc('0xa')](),controller[_0x88bc('0x13')]);router[_0x88bc('0x14')](_0x88bc('0x15'),auth[_0x88bc('0xa')](),controller['destroy']);module[_0x88bc('0x16')]=router; \ No newline at end of file +var _0xa9f0=['/:id','isAuthenticated','show','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index'];(function(_0x7d79b3,_0x33ebf2){var _0x56ace2=function(_0x3a4ee1){while(--_0x3a4ee1){_0x7d79b3['push'](_0x7d79b3['shift']());}};_0x56ace2(++_0x33ebf2);}(_0xa9f0,0x153));var _0x0a9f=function(_0x52a77c,_0x466ae9){_0x52a77c=_0x52a77c-0x0;var _0x212119=_0xa9f0[_0x52a77c];return _0x212119;};'use strict';var multer=require(_0x0a9f('0x0'));var util=require('util');var path=require(_0x0a9f('0x1'));var timeout=require(_0x0a9f('0x2'));var express=require(_0x0a9f('0x3'));var router=express[_0x0a9f('0x4')]();var fs_extra=require(_0x0a9f('0x5'));var auth=require(_0x0a9f('0x6'));var interaction=require(_0x0a9f('0x7'));var config=require(_0x0a9f('0x8'));var controller=require('./intDynamics365Configuration.controller');router[_0x0a9f('0x9')]('/',auth['isAuthenticated'](),controller[_0x0a9f('0xa')]);router['get'](_0x0a9f('0xb'),auth[_0x0a9f('0xc')](),controller[_0x0a9f('0xd')]);router[_0x0a9f('0x9')]('/:id/fields',auth[_0x0a9f('0xc')](),controller[_0x0a9f('0xe')]);router[_0x0a9f('0x9')](_0x0a9f('0xf'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x0a9f('0x9')](_0x0a9f('0x10'),auth[_0x0a9f('0xc')](),controller[_0x0a9f('0x11')]);router[_0x0a9f('0x12')]('/',auth[_0x0a9f('0xc')](),controller[_0x0a9f('0x13')]);router[_0x0a9f('0x14')](_0x0a9f('0xb'),auth[_0x0a9f('0xc')](),controller[_0x0a9f('0x15')]);router[_0x0a9f('0x16')](_0x0a9f('0xb'),auth['isAuthenticated'](),controller[_0x0a9f('0x17')]);module[_0x0a9f('0x18')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 1d75a16..e558327 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 _0x8f2e=['exports','incident','phonecall','ENUM','contact','sequelize'];(function(_0x3a2650,_0x2cdddc){var _0x4482e6=function(_0x322125){while(--_0x322125){_0x3a2650['push'](_0x3a2650['shift']());}};_0x4482e6(++_0x2cdddc);}(_0x8f2e,0x1b5));var _0xe8f2=function(_0x59c7cc,_0xb4ca00){_0x59c7cc=_0x59c7cc-0x0;var _0x1dffb7=_0x8f2e[_0x59c7cc];return _0x1dffb7;};'use strict';var Sequelize=require(_0xe8f2('0x0'));module[_0xe8f2('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize['ENUM'](_0xe8f2('0x2'),_0xe8f2('0x3')),'defaultValue':_0xe8f2('0x2')},'moduleCreate':{'type':Sequelize[_0xe8f2('0x4')](_0xe8f2('0x5'),'nothing'),'defaultValue':_0xe8f2('0x5'),'allowNull':![]}}; \ No newline at end of file +var _0x404a=['incident','phonecall','nothing','sequelize','exports','STRING','ENUM'];(function(_0x3fc752,_0x545260){var _0xecdf3e=function(_0x5b55fe){while(--_0x5b55fe){_0x3fc752['push'](_0x3fc752['shift']());}};_0xecdf3e(++_0x545260);}(_0x404a,0xab));var _0xa404=function(_0x59cd8c,_0x5d69a9){_0x59cd8c=_0x59cd8c-0x0;var _0x4422eb=_0x404a[_0x59cd8c];return _0x4422eb;};'use strict';var Sequelize=require(_0xa404('0x0'));module[_0xa404('0x1')]={'name':{'type':Sequelize[_0xa404('0x2')]},'description':{'type':Sequelize[_0xa404('0x2')]},'ticketType':{'type':Sequelize[_0xa404('0x3')](_0xa404('0x4'),_0xa404('0x5')),'defaultValue':_0xa404('0x4')},'moduleCreate':{'type':Sequelize['ENUM']('contact',_0xa404('0x6')),'defaultValue':'contact','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 46bfad1..8f12487 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 _0x28dd=['findOne','merge','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','name','send','map','Dynamics365Configuration','rawAttributes','type','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','keys','include','find','create','body','getFields'];(function(_0x26e08d,_0xea5d00){var _0x3dab09=function(_0x434890){while(--_0x434890){_0x26e08d['push'](_0x26e08d['shift']());}};_0x3dab09(++_0xea5d00);}(_0x28dd,0x144));var _0xd28d=function(_0x326e79,_0x33dc91){_0x326e79=_0x326e79-0x0;var _0x37eb89=_0x28dd[_0x326e79];return _0x37eb89;};'use strict';var emlformat=require(_0xd28d('0x0'));var rimraf=require(_0xd28d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd28d('0x2'));var rp=require('request-promise');var moment=require(_0xd28d('0x3'));var BPromise=require(_0xd28d('0x4'));var Mustache=require(_0xd28d('0x5'));var util=require(_0xd28d('0x6'));var path=require(_0xd28d('0x7'));var sox=require('sox');var csv=require(_0xd28d('0x8'));var ejs=require(_0xd28d('0x9'));var fs=require('fs');var fs_extra=require(_0xd28d('0xa'));var _=require('lodash');var squel=require(_0xd28d('0xb'));var crypto=require(_0xd28d('0xc'));var jsforce=require(_0xd28d('0xd'));var deskjs=require(_0xd28d('0xe'));var toCsv=require(_0xd28d('0x8'));var querystring=require(_0xd28d('0xf'));var Papa=require(_0xd28d('0x10'));var Redis=require(_0xd28d('0x11'));var authService=require(_0xd28d('0x12'));var qs=require(_0xd28d('0x13'));var as=require(_0xd28d('0x14'));var hardwareService=require(_0xd28d('0x15'));var logger=require(_0xd28d('0x16'))('api');var utils=require(_0xd28d('0x17'));var config=require(_0xd28d('0x18'));var licenseUtil=require(_0xd28d('0x19'));var db=require(_0xd28d('0x1a'))['db'];function respondWithStatusCode(_0x280ce7,_0x264092){_0x264092=_0x264092||0xcc;return function(_0x5536ee){if(_0x5536ee){return _0x280ce7[_0xd28d('0x1b')](_0x264092);}return _0x280ce7['status'](_0x264092)[_0xd28d('0x1c')]();};}function respondWithResult(_0xb0cd9,_0xa3a727){_0xa3a727=_0xa3a727||0xc8;return function(_0x22ddde){if(_0x22ddde){return _0xb0cd9[_0xd28d('0x1d')](_0xa3a727)[_0xd28d('0x1e')](_0x22ddde);}};}function respondWithFilteredResult(_0x1697a7,_0x866ac8){return function(_0x698da4){if(_0x698da4){var _0x4b6cf8=typeof _0x866ac8[_0xd28d('0x1f')]===_0xd28d('0x20')&&typeof _0x866ac8[_0xd28d('0x21')]===_0xd28d('0x20');var _0x40392e=_0x698da4[_0xd28d('0x22')];var _0xc6c514=_0x4b6cf8?0x0:_0x866ac8[_0xd28d('0x1f')];var _0x268334=_0x4b6cf8?_0x698da4[_0xd28d('0x22')]:_0x866ac8[_0xd28d('0x1f')]+_0x866ac8[_0xd28d('0x21')];var _0x3b0e32;if(_0x268334>=_0x40392e){_0x268334=_0x40392e;_0x3b0e32=0xc8;}else{_0x3b0e32=0xce;}_0x1697a7[_0xd28d('0x1d')](_0x3b0e32);return _0x1697a7[_0xd28d('0x23')](_0xd28d('0x24'),_0xc6c514+'-'+_0x268334+'/'+_0x40392e)[_0xd28d('0x1e')](_0x698da4);}return null;};}function patchUpdates(_0x4cc90a){return function(_0x391a7d){try{jsonpatch[_0xd28d('0x25')](_0x391a7d,_0x4cc90a,!![]);}catch(_0x18935d){return BPromise[_0xd28d('0x26')](_0x18935d);}return _0x391a7d[_0xd28d('0x27')]();};}function saveUpdates(_0xac5027,_0x37e186){return function(_0xa27039){if(_0xa27039){return _0xa27039[_0xd28d('0x28')](_0xac5027)['then'](function(_0xc61c41){return _0xc61c41;});}return null;};}function removeEntity(_0x5d1397,_0x3bd634){return function(_0x242117){if(_0x242117){return _0x242117['destroy']()[_0xd28d('0x29')](function(){_0x5d1397['status'](0xcc)[_0xd28d('0x1c')]();});}};}function handleEntityNotFound(_0x3bf2e2,_0x390930){return function(_0x26ed73){if(!_0x26ed73){_0x3bf2e2[_0xd28d('0x1b')](0x194);}return _0x26ed73;};}function handleError(_0x39c953,_0x310a10){_0x310a10=_0x310a10||0x1f4;return function(_0x5e7e2d){logger['error'](_0x5e7e2d['stack']);if(_0x5e7e2d[_0xd28d('0x2a')]){delete _0x5e7e2d[_0xd28d('0x2a')];}_0x39c953['status'](_0x310a10)[_0xd28d('0x2b')](_0x5e7e2d);};}exports['index']=function(_0x2a9676,_0x250fd3){var _0x1145ed={},_0x221e7b={},_0x2ba32b={'count':0x0,'rows':[]};var _0x12aa01=_[_0xd28d('0x2c')](db[_0xd28d('0x2d')][_0xd28d('0x2e')],function(_0x4a125f){return{'name':_0x4a125f['fieldName'],'type':_0x4a125f[_0xd28d('0x2f')]['key']};});_0x221e7b['model']=_[_0xd28d('0x2c')](_0x12aa01,_0xd28d('0x2a'));_0x221e7b['query']=_['keys'](_0x2a9676[_0xd28d('0x30')]);_0x221e7b[_0xd28d('0x31')]=_['intersection'](_0x221e7b[_0xd28d('0x32')],_0x221e7b[_0xd28d('0x30')]);_0x1145ed[_0xd28d('0x33')]=_[_0xd28d('0x34')](_0x221e7b[_0xd28d('0x32')],qs[_0xd28d('0x35')](_0x2a9676[_0xd28d('0x30')]['fields']));_0x1145ed[_0xd28d('0x33')]=_0x1145ed[_0xd28d('0x33')][_0xd28d('0x36')]?_0x1145ed[_0xd28d('0x33')]:_0x221e7b[_0xd28d('0x32')];if(!_0x2a9676['query'][_0xd28d('0x37')](_0xd28d('0x38'))){_0x1145ed['limit']=qs[_0xd28d('0x21')](_0x2a9676[_0xd28d('0x30')][_0xd28d('0x21')]);_0x1145ed[_0xd28d('0x1f')]=qs[_0xd28d('0x1f')](_0x2a9676[_0xd28d('0x30')]['offset']);}_0x1145ed[_0xd28d('0x39')]=qs[_0xd28d('0x3a')](_0x2a9676[_0xd28d('0x30')][_0xd28d('0x3a')]);_0x1145ed[_0xd28d('0x3b')]=qs[_0xd28d('0x31')](_[_0xd28d('0x3c')](_0x2a9676[_0xd28d('0x30')],_0x221e7b[_0xd28d('0x31')]),_0x12aa01);if(_0x2a9676[_0xd28d('0x30')][_0xd28d('0x3d')]){_0x1145ed[_0xd28d('0x3b')]=_['merge'](_0x1145ed[_0xd28d('0x3b')],{'$or':_[_0xd28d('0x2c')](_0x12aa01,function(_0x46ccab){if(_0x46ccab[_0xd28d('0x2f')]!==_0xd28d('0x3e')){var _0x5bca71={};_0x5bca71[_0x46ccab[_0xd28d('0x2a')]]={'$like':'%'+_0x2a9676[_0xd28d('0x30')]['filter']+'%'};return _0x5bca71;}})});}_0x1145ed=_['merge']({},_0x1145ed,_0x2a9676[_0xd28d('0x3f')]);var _0x39841f={'where':_0x1145ed[_0xd28d('0x3b')]};return db[_0xd28d('0x2d')][_0xd28d('0x22')](_0x39841f)[_0xd28d('0x29')](function(_0x98071){_0x2ba32b['count']=_0x98071;if(_0x2a9676[_0xd28d('0x30')][_0xd28d('0x40')]){_0x1145ed['include']=[{'all':!![]}];}return db[_0xd28d('0x2d')][_0xd28d('0x41')](_0x1145ed);})['then'](function(_0x1be80d){_0x2ba32b[_0xd28d('0x42')]=_0x1be80d;return _0x2ba32b;})[_0xd28d('0x29')](respondWithFilteredResult(_0x250fd3,_0x1145ed))[_0xd28d('0x43')](handleError(_0x250fd3,null));};exports[_0xd28d('0x44')]=function(_0x4a6ac8,_0x4256f6){var _0x23be0b={'raw':![],'where':{'id':_0x4a6ac8[_0xd28d('0x45')]['id']}},_0x99653e={};_0x99653e[_0xd28d('0x32')]=_[_0xd28d('0x46')](db[_0xd28d('0x2d')][_0xd28d('0x2e')]);_0x99653e[_0xd28d('0x30')]=_['keys'](_0x4a6ac8['query']);_0x99653e[_0xd28d('0x31')]=_[_0xd28d('0x34')](_0x99653e[_0xd28d('0x32')],_0x99653e[_0xd28d('0x30')]);_0x23be0b[_0xd28d('0x33')]=_[_0xd28d('0x34')](_0x99653e[_0xd28d('0x32')],qs[_0xd28d('0x35')](_0x4a6ac8[_0xd28d('0x30')][_0xd28d('0x35')]));_0x23be0b[_0xd28d('0x33')]=_0x23be0b[_0xd28d('0x33')]['length']?_0x23be0b[_0xd28d('0x33')]:_0x99653e['model'];if(_0x4a6ac8['query'][_0xd28d('0x40')]){_0x23be0b[_0xd28d('0x47')]=[{'all':!![]}];}_0x23be0b=_['merge']({},_0x23be0b,_0x4a6ac8[_0xd28d('0x3f')]);return db[_0xd28d('0x2d')][_0xd28d('0x48')](_0x23be0b)[_0xd28d('0x29')](handleEntityNotFound(_0x4256f6,null))['then'](respondWithResult(_0x4256f6,null))[_0xd28d('0x43')](handleError(_0x4256f6,null));};exports[_0xd28d('0x49')]=function(_0x500ee4,_0x7f59f6){return db[_0xd28d('0x2d')]['create'](_0x500ee4['body'],{})[_0xd28d('0x29')](respondWithResult(_0x7f59f6,0xc9))[_0xd28d('0x43')](handleError(_0x7f59f6,null));};exports[_0xd28d('0x28')]=function(_0x20a98d,_0x3eb1af){if(_0x20a98d['body']['id']){delete _0x20a98d['body']['id'];}return db[_0xd28d('0x2d')][_0xd28d('0x48')]({'where':{'id':_0x20a98d['params']['id']}})['then'](handleEntityNotFound(_0x3eb1af,null))[_0xd28d('0x29')](saveUpdates(_0x20a98d[_0xd28d('0x4a')],null))[_0xd28d('0x29')](respondWithResult(_0x3eb1af,null))[_0xd28d('0x43')](handleError(_0x3eb1af,null));};exports['destroy']=function(_0x4090ce,_0x1f3a67){return db[_0xd28d('0x2d')][_0xd28d('0x48')]({'where':{'id':_0x4090ce['params']['id']}})[_0xd28d('0x29')](handleEntityNotFound(_0x1f3a67,null))['then'](removeEntity(_0x1f3a67,null))['catch'](handleError(_0x1f3a67,null));};exports[_0xd28d('0x4b')]=function(_0x4d4b0e,_0x45f41a,_0x2f4e27){var _0x28d6fd={};var _0x4b8a62={};var _0xee30dd;var _0x35fff9;return db[_0xd28d('0x2d')][_0xd28d('0x4c')]({'where':{'id':_0x4d4b0e[_0xd28d('0x45')]['id']}})['then'](handleEntityNotFound(_0x45f41a,null))[_0xd28d('0x29')](function(_0x4a7411){if(_0x4a7411){_0xee30dd=_0x4a7411;_0x4b8a62['model']=_[_0xd28d('0x46')](db['Dynamics365Field'][_0xd28d('0x2e')]);_0x4b8a62[_0xd28d('0x30')]=_[_0xd28d('0x46')](_0x4d4b0e[_0xd28d('0x30')]);_0x4b8a62[_0xd28d('0x31')]=_[_0xd28d('0x34')](_0x4b8a62['model'],_0x4b8a62[_0xd28d('0x30')]);_0x28d6fd[_0xd28d('0x33')]=_[_0xd28d('0x34')](_0x4b8a62[_0xd28d('0x32')],qs[_0xd28d('0x35')](_0x4d4b0e[_0xd28d('0x30')][_0xd28d('0x35')]));_0x28d6fd[_0xd28d('0x33')]=_0x28d6fd[_0xd28d('0x33')]['length']?_0x28d6fd[_0xd28d('0x33')]:_0x4b8a62[_0xd28d('0x32')];_0x28d6fd[_0xd28d('0x39')]=qs['sort'](_0x4d4b0e[_0xd28d('0x30')][_0xd28d('0x3a')]);_0x28d6fd[_0xd28d('0x3b')]=qs[_0xd28d('0x31')](_[_0xd28d('0x3c')](_0x4d4b0e[_0xd28d('0x30')],_0x4b8a62[_0xd28d('0x31')]));if(_0x4d4b0e[_0xd28d('0x30')][_0xd28d('0x3d')]){_0x28d6fd['where']=_[_0xd28d('0x4d')](_0x28d6fd['where'],{'$or':_[_0xd28d('0x2c')](_0x28d6fd[_0xd28d('0x33')],function(_0x50acd0){var _0x482950={};_0x482950[_0x50acd0]={'$like':'%'+_0x4d4b0e[_0xd28d('0x30')]['filter']+'%'};return _0x482950;})});}_0x28d6fd=_[_0xd28d('0x4d')]({},_0x28d6fd,_0x4d4b0e[_0xd28d('0x3f')]);return _0xee30dd[_0xd28d('0x4b')](_0x28d6fd);}})['then'](function(_0x5255f2){if(_0x5255f2){_0x35fff9=_0x5255f2[_0xd28d('0x36')];if(!_0x4d4b0e[_0xd28d('0x30')][_0xd28d('0x37')](_0xd28d('0x38'))){_0x28d6fd['limit']=qs['limit'](_0x4d4b0e['query'][_0xd28d('0x21')]);_0x28d6fd[_0xd28d('0x1f')]=qs[_0xd28d('0x1f')](_0x4d4b0e['query'][_0xd28d('0x1f')]);}return _0xee30dd[_0xd28d('0x4b')](_0x28d6fd);}})[_0xd28d('0x29')](function(_0x16d1cb){if(_0x16d1cb){return _0x16d1cb?{'count':_0x35fff9,'rows':_0x16d1cb}:null;}})['then'](respondWithResult(_0x45f41a,null))['catch'](handleError(_0x45f41a,null));};exports[_0xd28d('0x4e')]=function(_0x53e50b,_0x4b7327,_0x3b5530){var _0x347e99={};var _0x1ca36c={};var _0x373941;var _0x42d352;return db[_0xd28d('0x2d')][_0xd28d('0x4c')]({'where':{'id':_0x53e50b[_0xd28d('0x45')]['id']}})['then'](handleEntityNotFound(_0x4b7327,null))[_0xd28d('0x29')](function(_0x2735ee){if(_0x2735ee){_0x373941=_0x2735ee;_0x1ca36c[_0xd28d('0x32')]=_[_0xd28d('0x46')](db['Dynamics365Field'][_0xd28d('0x2e')]);_0x1ca36c[_0xd28d('0x30')]=_[_0xd28d('0x46')](_0x53e50b[_0xd28d('0x30')]);_0x1ca36c[_0xd28d('0x31')]=_[_0xd28d('0x34')](_0x1ca36c[_0xd28d('0x32')],_0x1ca36c['query']);_0x347e99[_0xd28d('0x33')]=_['intersection'](_0x1ca36c[_0xd28d('0x32')],qs['fields'](_0x53e50b[_0xd28d('0x30')][_0xd28d('0x35')]));_0x347e99[_0xd28d('0x33')]=_0x347e99[_0xd28d('0x33')][_0xd28d('0x36')]?_0x347e99[_0xd28d('0x33')]:_0x1ca36c[_0xd28d('0x32')];_0x347e99[_0xd28d('0x39')]=qs[_0xd28d('0x3a')](_0x53e50b[_0xd28d('0x30')]['sort']);_0x347e99[_0xd28d('0x3b')]=qs[_0xd28d('0x31')](_['pick'](_0x53e50b[_0xd28d('0x30')],_0x1ca36c[_0xd28d('0x31')]));if(_0x53e50b[_0xd28d('0x30')][_0xd28d('0x3d')]){_0x347e99['where']=_[_0xd28d('0x4d')](_0x347e99[_0xd28d('0x3b')],{'$or':_[_0xd28d('0x2c')](_0x347e99[_0xd28d('0x33')],function(_0x43e00f){var _0x3b6c70={};_0x3b6c70[_0x43e00f]={'$like':'%'+_0x53e50b[_0xd28d('0x30')]['filter']+'%'};return _0x3b6c70;})});}_0x347e99=_['merge']({},_0x347e99,_0x53e50b[_0xd28d('0x3f')]);return _0x373941['getSubjects'](_0x347e99);}})['then'](function(_0x1ee6a4){if(_0x1ee6a4){_0x42d352=_0x1ee6a4['length'];if(!_0x53e50b[_0xd28d('0x30')][_0xd28d('0x37')](_0xd28d('0x38'))){_0x347e99[_0xd28d('0x21')]=qs[_0xd28d('0x21')](_0x53e50b['query'][_0xd28d('0x21')]);_0x347e99['offset']=qs[_0xd28d('0x1f')](_0x53e50b[_0xd28d('0x30')][_0xd28d('0x1f')]);}return _0x373941[_0xd28d('0x4e')](_0x347e99);}})[_0xd28d('0x29')](function(_0x486732){if(_0x486732){return _0x486732?{'count':_0x42d352,'rows':_0x486732}:null;}})[_0xd28d('0x29')](respondWithResult(_0x4b7327,null))[_0xd28d('0x43')](handleError(_0x4b7327,null));};exports[_0xd28d('0x4f')]=function(_0x29b88d,_0x3bfc1d,_0x19bcec){var _0x2edeb7={};var _0x33d02={};var _0x1d2b03;var _0x2f9094;return db[_0xd28d('0x2d')][_0xd28d('0x4c')]({'where':{'id':_0x29b88d[_0xd28d('0x45')]['id']}})[_0xd28d('0x29')](handleEntityNotFound(_0x3bfc1d,null))[_0xd28d('0x29')](function(_0x5b79f9){if(_0x5b79f9){_0x1d2b03=_0x5b79f9;_0x33d02[_0xd28d('0x32')]=_[_0xd28d('0x46')](db['Dynamics365Field'][_0xd28d('0x2e')]);_0x33d02['query']=_['keys'](_0x29b88d[_0xd28d('0x30')]);_0x33d02[_0xd28d('0x31')]=_[_0xd28d('0x34')](_0x33d02[_0xd28d('0x32')],_0x33d02[_0xd28d('0x30')]);_0x2edeb7[_0xd28d('0x33')]=_[_0xd28d('0x34')](_0x33d02[_0xd28d('0x32')],qs[_0xd28d('0x35')](_0x29b88d[_0xd28d('0x30')][_0xd28d('0x35')]));_0x2edeb7[_0xd28d('0x33')]=_0x2edeb7[_0xd28d('0x33')][_0xd28d('0x36')]?_0x2edeb7['attributes']:_0x33d02[_0xd28d('0x32')];_0x2edeb7[_0xd28d('0x39')]=qs[_0xd28d('0x3a')](_0x29b88d['query'][_0xd28d('0x3a')]);_0x2edeb7[_0xd28d('0x3b')]=qs[_0xd28d('0x31')](_[_0xd28d('0x3c')](_0x29b88d[_0xd28d('0x30')],_0x33d02[_0xd28d('0x31')]));if(_0x29b88d['query'][_0xd28d('0x3d')]){_0x2edeb7['where']=_[_0xd28d('0x4d')](_0x2edeb7[_0xd28d('0x3b')],{'$or':_[_0xd28d('0x2c')](_0x2edeb7[_0xd28d('0x33')],function(_0x179103){var _0x328b72={};_0x328b72[_0x179103]={'$like':'%'+_0x29b88d['query'][_0xd28d('0x3d')]+'%'};return _0x328b72;})});}_0x2edeb7=_[_0xd28d('0x4d')]({},_0x2edeb7,_0x29b88d[_0xd28d('0x3f')]);return _0x1d2b03[_0xd28d('0x4f')](_0x2edeb7);}})[_0xd28d('0x29')](function(_0x1cc2b4){if(_0x1cc2b4){_0x2f9094=_0x1cc2b4[_0xd28d('0x36')];if(!_0x29b88d[_0xd28d('0x30')][_0xd28d('0x37')](_0xd28d('0x38'))){_0x2edeb7[_0xd28d('0x21')]=qs[_0xd28d('0x21')](_0x29b88d[_0xd28d('0x30')][_0xd28d('0x21')]);_0x2edeb7['offset']=qs[_0xd28d('0x1f')](_0x29b88d[_0xd28d('0x30')][_0xd28d('0x1f')]);}return _0x1d2b03[_0xd28d('0x4f')](_0x2edeb7);}})[_0xd28d('0x29')](function(_0x4b1712){if(_0x4b1712){return _0x4b1712?{'count':_0x2f9094,'rows':_0x4b1712}:null;}})['then'](respondWithResult(_0x3bfc1d,null))[_0xd28d('0x43')](handleError(_0x3bfc1d,null));}; \ No newline at end of file +var _0xe702=['Dynamics365Configuration','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','includeAll','include','rows','params','options','catch','create','body','find','destroy','Dynamics365Field','getFields','nolimit','getSubjects','getDescriptions','findOne','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','end','json','offset','undefined','count','limit','Content-Range','reject','save','update','then','error','stack','name','send','index','map'];(function(_0x1925df,_0xbd3e63){var _0x2f4e05=function(_0x4ffc0b){while(--_0x4ffc0b){_0x1925df['push'](_0x1925df['shift']());}};_0x2f4e05(++_0xbd3e63);}(_0xe702,0x168));var _0x2e70=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xe702[_0x6131cd];return _0x47e916;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2e70('0x0'));var zipdir=require(_0x2e70('0x1'));var jsonpatch=require(_0x2e70('0x2'));var rp=require(_0x2e70('0x3'));var moment=require(_0x2e70('0x4'));var BPromise=require(_0x2e70('0x5'));var Mustache=require(_0x2e70('0x6'));var util=require(_0x2e70('0x7'));var path=require(_0x2e70('0x8'));var sox=require(_0x2e70('0x9'));var csv=require(_0x2e70('0xa'));var ejs=require(_0x2e70('0xb'));var fs=require('fs');var fs_extra=require(_0x2e70('0xc'));var _=require(_0x2e70('0xd'));var squel=require(_0x2e70('0xe'));var crypto=require(_0x2e70('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x2e70('0x10'));var toCsv=require(_0x2e70('0xa'));var querystring=require(_0x2e70('0x11'));var Papa=require(_0x2e70('0x12'));var Redis=require('ioredis');var authService=require(_0x2e70('0x13'));var qs=require(_0x2e70('0x14'));var as=require(_0x2e70('0x15'));var hardwareService=require(_0x2e70('0x16'));var logger=require(_0x2e70('0x17'))(_0x2e70('0x18'));var utils=require('../../config/utils');var config=require(_0x2e70('0x19'));var licenseUtil=require(_0x2e70('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5bd271,_0x51734e){_0x51734e=_0x51734e||0xcc;return function(_0x3ac11f){if(_0x3ac11f){return _0x5bd271['sendStatus'](_0x51734e);}return _0x5bd271[_0x2e70('0x1b')](_0x51734e)[_0x2e70('0x1c')]();};}function respondWithResult(_0x265b0a,_0x449ca6){_0x449ca6=_0x449ca6||0xc8;return function(_0x3a2d63){if(_0x3a2d63){return _0x265b0a['status'](_0x449ca6)[_0x2e70('0x1d')](_0x3a2d63);}};}function respondWithFilteredResult(_0x5df1dd,_0x9c9c99){return function(_0x1ae21b){if(_0x1ae21b){var _0x480897=typeof _0x9c9c99[_0x2e70('0x1e')]===_0x2e70('0x1f')&&typeof _0x9c9c99['limit']===_0x2e70('0x1f');var _0x5e7c3f=_0x1ae21b[_0x2e70('0x20')];var _0x3fe4c7=_0x480897?0x0:_0x9c9c99[_0x2e70('0x1e')];var _0x4d37f8=_0x480897?_0x1ae21b['count']:_0x9c9c99[_0x2e70('0x1e')]+_0x9c9c99[_0x2e70('0x21')];var _0xb4f2c3;if(_0x4d37f8>=_0x5e7c3f){_0x4d37f8=_0x5e7c3f;_0xb4f2c3=0xc8;}else{_0xb4f2c3=0xce;}_0x5df1dd[_0x2e70('0x1b')](_0xb4f2c3);return _0x5df1dd['set'](_0x2e70('0x22'),_0x3fe4c7+'-'+_0x4d37f8+'/'+_0x5e7c3f)['json'](_0x1ae21b);}return null;};}function patchUpdates(_0x5c677c){return function(_0x505189){try{jsonpatch['apply'](_0x505189,_0x5c677c,!![]);}catch(_0x2a9ead){return BPromise[_0x2e70('0x23')](_0x2a9ead);}return _0x505189[_0x2e70('0x24')]();};}function saveUpdates(_0x433b26,_0x3758a9){return function(_0x54f341){if(_0x54f341){return _0x54f341[_0x2e70('0x25')](_0x433b26)[_0x2e70('0x26')](function(_0x4632f5){return _0x4632f5;});}return null;};}function removeEntity(_0x57a148,_0x1eb722){return function(_0x3dbb1d){if(_0x3dbb1d){return _0x3dbb1d['destroy']()[_0x2e70('0x26')](function(){_0x57a148[_0x2e70('0x1b')](0xcc)[_0x2e70('0x1c')]();});}};}function handleEntityNotFound(_0x1fcaf3,_0x59121c){return function(_0xcf8699){if(!_0xcf8699){_0x1fcaf3['sendStatus'](0x194);}return _0xcf8699;};}function handleError(_0x4b6219,_0xb16063){_0xb16063=_0xb16063||0x1f4;return function(_0x34f8db){logger[_0x2e70('0x27')](_0x34f8db[_0x2e70('0x28')]);if(_0x34f8db['name']){delete _0x34f8db[_0x2e70('0x29')];}_0x4b6219[_0x2e70('0x1b')](_0xb16063)[_0x2e70('0x2a')](_0x34f8db);};}exports[_0x2e70('0x2b')]=function(_0x3ac1fb,_0x42dd7b){var _0x518f69={},_0x27f61f={},_0x483db0={'count':0x0,'rows':[]};var _0x2957e8=_[_0x2e70('0x2c')](db[_0x2e70('0x2d')][_0x2e70('0x2e')],function(_0x17253b){return{'name':_0x17253b[_0x2e70('0x2f')],'type':_0x17253b[_0x2e70('0x30')][_0x2e70('0x31')]};});_0x27f61f[_0x2e70('0x32')]=_[_0x2e70('0x2c')](_0x2957e8,_0x2e70('0x29'));_0x27f61f[_0x2e70('0x33')]=_[_0x2e70('0x34')](_0x3ac1fb[_0x2e70('0x33')]);_0x27f61f['filters']=_['intersection'](_0x27f61f[_0x2e70('0x32')],_0x27f61f[_0x2e70('0x33')]);_0x518f69['attributes']=_[_0x2e70('0x35')](_0x27f61f[_0x2e70('0x32')],qs[_0x2e70('0x36')](_0x3ac1fb[_0x2e70('0x33')][_0x2e70('0x36')]));_0x518f69['attributes']=_0x518f69[_0x2e70('0x37')][_0x2e70('0x38')]?_0x518f69['attributes']:_0x27f61f[_0x2e70('0x32')];if(!_0x3ac1fb['query'][_0x2e70('0x39')]('nolimit')){_0x518f69['limit']=qs[_0x2e70('0x21')](_0x3ac1fb['query']['limit']);_0x518f69[_0x2e70('0x1e')]=qs[_0x2e70('0x1e')](_0x3ac1fb[_0x2e70('0x33')][_0x2e70('0x1e')]);}_0x518f69[_0x2e70('0x3a')]=qs[_0x2e70('0x3b')](_0x3ac1fb[_0x2e70('0x33')]['sort']);_0x518f69[_0x2e70('0x3c')]=qs[_0x2e70('0x3d')](_[_0x2e70('0x3e')](_0x3ac1fb['query'],_0x27f61f[_0x2e70('0x3d')]),_0x2957e8);if(_0x3ac1fb[_0x2e70('0x33')][_0x2e70('0x3f')]){_0x518f69[_0x2e70('0x3c')]=_[_0x2e70('0x40')](_0x518f69[_0x2e70('0x3c')],{'$or':_[_0x2e70('0x2c')](_0x2957e8,function(_0x4cdf6c){if(_0x4cdf6c[_0x2e70('0x30')]!=='VIRTUAL'){var _0x3b3e89={};_0x3b3e89[_0x4cdf6c[_0x2e70('0x29')]]={'$like':'%'+_0x3ac1fb['query']['filter']+'%'};return _0x3b3e89;}})});}_0x518f69=_[_0x2e70('0x40')]({},_0x518f69,_0x3ac1fb['options']);var _0x438a2b={'where':_0x518f69['where']};return db[_0x2e70('0x2d')][_0x2e70('0x20')](_0x438a2b)[_0x2e70('0x26')](function(_0x74faae){_0x483db0[_0x2e70('0x20')]=_0x74faae;if(_0x3ac1fb[_0x2e70('0x33')][_0x2e70('0x41')]){_0x518f69[_0x2e70('0x42')]=[{'all':!![]}];}return db[_0x2e70('0x2d')]['findAll'](_0x518f69);})[_0x2e70('0x26')](function(_0x18c1ee){_0x483db0[_0x2e70('0x43')]=_0x18c1ee;return _0x483db0;})[_0x2e70('0x26')](respondWithFilteredResult(_0x42dd7b,_0x518f69))['catch'](handleError(_0x42dd7b,null));};exports['show']=function(_0x5e8512,_0x2cdbbf){var _0x2e6fbc={'raw':![],'where':{'id':_0x5e8512[_0x2e70('0x44')]['id']}},_0x27b0ba={};_0x27b0ba[_0x2e70('0x32')]=_['keys'](db[_0x2e70('0x2d')][_0x2e70('0x2e')]);_0x27b0ba[_0x2e70('0x33')]=_[_0x2e70('0x34')](_0x5e8512['query']);_0x27b0ba[_0x2e70('0x3d')]=_[_0x2e70('0x35')](_0x27b0ba['model'],_0x27b0ba[_0x2e70('0x33')]);_0x2e6fbc[_0x2e70('0x37')]=_['intersection'](_0x27b0ba[_0x2e70('0x32')],qs[_0x2e70('0x36')](_0x5e8512[_0x2e70('0x33')][_0x2e70('0x36')]));_0x2e6fbc[_0x2e70('0x37')]=_0x2e6fbc[_0x2e70('0x37')][_0x2e70('0x38')]?_0x2e6fbc[_0x2e70('0x37')]:_0x27b0ba['model'];if(_0x5e8512[_0x2e70('0x33')][_0x2e70('0x41')]){_0x2e6fbc[_0x2e70('0x42')]=[{'all':!![]}];}_0x2e6fbc=_[_0x2e70('0x40')]({},_0x2e6fbc,_0x5e8512[_0x2e70('0x45')]);return db[_0x2e70('0x2d')]['find'](_0x2e6fbc)[_0x2e70('0x26')](handleEntityNotFound(_0x2cdbbf,null))[_0x2e70('0x26')](respondWithResult(_0x2cdbbf,null))[_0x2e70('0x46')](handleError(_0x2cdbbf,null));};exports[_0x2e70('0x47')]=function(_0x394bde,_0x56cb1e){return db[_0x2e70('0x2d')][_0x2e70('0x47')](_0x394bde[_0x2e70('0x48')],{})[_0x2e70('0x26')](respondWithResult(_0x56cb1e,0xc9))[_0x2e70('0x46')](handleError(_0x56cb1e,null));};exports[_0x2e70('0x25')]=function(_0xa320dc,_0x4d466a){if(_0xa320dc['body']['id']){delete _0xa320dc[_0x2e70('0x48')]['id'];}return db['Dynamics365Configuration'][_0x2e70('0x49')]({'where':{'id':_0xa320dc['params']['id']}})['then'](handleEntityNotFound(_0x4d466a,null))[_0x2e70('0x26')](saveUpdates(_0xa320dc[_0x2e70('0x48')],null))['then'](respondWithResult(_0x4d466a,null))['catch'](handleError(_0x4d466a,null));};exports[_0x2e70('0x4a')]=function(_0x599d1f,_0xed3f51){return db['Dynamics365Configuration'][_0x2e70('0x49')]({'where':{'id':_0x599d1f['params']['id']}})['then'](handleEntityNotFound(_0xed3f51,null))[_0x2e70('0x26')](removeEntity(_0xed3f51,null))[_0x2e70('0x46')](handleError(_0xed3f51,null));};exports['getFields']=function(_0x5bf37a,_0x170ad7,_0x42b587){var _0x3fdb69={};var _0x3414c3={};var _0x334015;var _0x42ada0;return db['Dynamics365Configuration']['findOne']({'where':{'id':_0x5bf37a[_0x2e70('0x44')]['id']}})['then'](handleEntityNotFound(_0x170ad7,null))[_0x2e70('0x26')](function(_0x135885){if(_0x135885){_0x334015=_0x135885;_0x3414c3[_0x2e70('0x32')]=_[_0x2e70('0x34')](db[_0x2e70('0x4b')][_0x2e70('0x2e')]);_0x3414c3['query']=_[_0x2e70('0x34')](_0x5bf37a['query']);_0x3414c3['filters']=_[_0x2e70('0x35')](_0x3414c3[_0x2e70('0x32')],_0x3414c3[_0x2e70('0x33')]);_0x3fdb69[_0x2e70('0x37')]=_[_0x2e70('0x35')](_0x3414c3[_0x2e70('0x32')],qs['fields'](_0x5bf37a[_0x2e70('0x33')]['fields']));_0x3fdb69[_0x2e70('0x37')]=_0x3fdb69[_0x2e70('0x37')][_0x2e70('0x38')]?_0x3fdb69[_0x2e70('0x37')]:_0x3414c3[_0x2e70('0x32')];_0x3fdb69[_0x2e70('0x3a')]=qs['sort'](_0x5bf37a['query'][_0x2e70('0x3b')]);_0x3fdb69['where']=qs[_0x2e70('0x3d')](_[_0x2e70('0x3e')](_0x5bf37a[_0x2e70('0x33')],_0x3414c3['filters']));if(_0x5bf37a[_0x2e70('0x33')]['filter']){_0x3fdb69[_0x2e70('0x3c')]=_['merge'](_0x3fdb69['where'],{'$or':_[_0x2e70('0x2c')](_0x3fdb69[_0x2e70('0x37')],function(_0x313e43){var _0x278309={};_0x278309[_0x313e43]={'$like':'%'+_0x5bf37a[_0x2e70('0x33')][_0x2e70('0x3f')]+'%'};return _0x278309;})});}_0x3fdb69=_[_0x2e70('0x40')]({},_0x3fdb69,_0x5bf37a[_0x2e70('0x45')]);return _0x334015[_0x2e70('0x4c')](_0x3fdb69);}})['then'](function(_0x3b06fc){if(_0x3b06fc){_0x42ada0=_0x3b06fc[_0x2e70('0x38')];if(!_0x5bf37a[_0x2e70('0x33')]['hasOwnProperty'](_0x2e70('0x4d'))){_0x3fdb69[_0x2e70('0x21')]=qs['limit'](_0x5bf37a[_0x2e70('0x33')]['limit']);_0x3fdb69['offset']=qs['offset'](_0x5bf37a[_0x2e70('0x33')]['offset']);}return _0x334015['getFields'](_0x3fdb69);}})[_0x2e70('0x26')](function(_0x2541e3){if(_0x2541e3){return _0x2541e3?{'count':_0x42ada0,'rows':_0x2541e3}:null;}})[_0x2e70('0x26')](respondWithResult(_0x170ad7,null))[_0x2e70('0x46')](handleError(_0x170ad7,null));};exports[_0x2e70('0x4e')]=function(_0xe67b04,_0x2bc971,_0x24f52b){var _0x5a1b6b={};var _0x123398={};var _0x1e768a;var _0x50f411;return db[_0x2e70('0x2d')]['findOne']({'where':{'id':_0xe67b04[_0x2e70('0x44')]['id']}})['then'](handleEntityNotFound(_0x2bc971,null))[_0x2e70('0x26')](function(_0x3635d5){if(_0x3635d5){_0x1e768a=_0x3635d5;_0x123398[_0x2e70('0x32')]=_[_0x2e70('0x34')](db[_0x2e70('0x4b')][_0x2e70('0x2e')]);_0x123398[_0x2e70('0x33')]=_[_0x2e70('0x34')](_0xe67b04[_0x2e70('0x33')]);_0x123398[_0x2e70('0x3d')]=_['intersection'](_0x123398[_0x2e70('0x32')],_0x123398[_0x2e70('0x33')]);_0x5a1b6b['attributes']=_[_0x2e70('0x35')](_0x123398[_0x2e70('0x32')],qs[_0x2e70('0x36')](_0xe67b04[_0x2e70('0x33')][_0x2e70('0x36')]));_0x5a1b6b[_0x2e70('0x37')]=_0x5a1b6b[_0x2e70('0x37')][_0x2e70('0x38')]?_0x5a1b6b[_0x2e70('0x37')]:_0x123398[_0x2e70('0x32')];_0x5a1b6b[_0x2e70('0x3a')]=qs[_0x2e70('0x3b')](_0xe67b04[_0x2e70('0x33')][_0x2e70('0x3b')]);_0x5a1b6b[_0x2e70('0x3c')]=qs['filters'](_[_0x2e70('0x3e')](_0xe67b04[_0x2e70('0x33')],_0x123398['filters']));if(_0xe67b04[_0x2e70('0x33')][_0x2e70('0x3f')]){_0x5a1b6b[_0x2e70('0x3c')]=_[_0x2e70('0x40')](_0x5a1b6b[_0x2e70('0x3c')],{'$or':_['map'](_0x5a1b6b[_0x2e70('0x37')],function(_0xcc504e){var _0x2ce24c={};_0x2ce24c[_0xcc504e]={'$like':'%'+_0xe67b04[_0x2e70('0x33')][_0x2e70('0x3f')]+'%'};return _0x2ce24c;})});}_0x5a1b6b=_[_0x2e70('0x40')]({},_0x5a1b6b,_0xe67b04[_0x2e70('0x45')]);return _0x1e768a[_0x2e70('0x4e')](_0x5a1b6b);}})[_0x2e70('0x26')](function(_0x34ecf2){if(_0x34ecf2){_0x50f411=_0x34ecf2[_0x2e70('0x38')];if(!_0xe67b04[_0x2e70('0x33')][_0x2e70('0x39')](_0x2e70('0x4d'))){_0x5a1b6b[_0x2e70('0x21')]=qs['limit'](_0xe67b04[_0x2e70('0x33')][_0x2e70('0x21')]);_0x5a1b6b[_0x2e70('0x1e')]=qs[_0x2e70('0x1e')](_0xe67b04[_0x2e70('0x33')][_0x2e70('0x1e')]);}return _0x1e768a['getSubjects'](_0x5a1b6b);}})[_0x2e70('0x26')](function(_0x37f203){if(_0x37f203){return _0x37f203?{'count':_0x50f411,'rows':_0x37f203}:null;}})[_0x2e70('0x26')](respondWithResult(_0x2bc971,null))['catch'](handleError(_0x2bc971,null));};exports[_0x2e70('0x4f')]=function(_0xd42139,_0x1334b1,_0x36cb67){var _0x34d34f={};var _0x24d46f={};var _0x5bc277;var _0x3bcaa5;return db[_0x2e70('0x2d')][_0x2e70('0x50')]({'where':{'id':_0xd42139[_0x2e70('0x44')]['id']}})[_0x2e70('0x26')](handleEntityNotFound(_0x1334b1,null))[_0x2e70('0x26')](function(_0x4ab378){if(_0x4ab378){_0x5bc277=_0x4ab378;_0x24d46f['model']=_[_0x2e70('0x34')](db[_0x2e70('0x4b')]['rawAttributes']);_0x24d46f[_0x2e70('0x33')]=_[_0x2e70('0x34')](_0xd42139[_0x2e70('0x33')]);_0x24d46f[_0x2e70('0x3d')]=_[_0x2e70('0x35')](_0x24d46f['model'],_0x24d46f['query']);_0x34d34f[_0x2e70('0x37')]=_[_0x2e70('0x35')](_0x24d46f[_0x2e70('0x32')],qs[_0x2e70('0x36')](_0xd42139[_0x2e70('0x33')][_0x2e70('0x36')]));_0x34d34f[_0x2e70('0x37')]=_0x34d34f[_0x2e70('0x37')][_0x2e70('0x38')]?_0x34d34f[_0x2e70('0x37')]:_0x24d46f['model'];_0x34d34f[_0x2e70('0x3a')]=qs[_0x2e70('0x3b')](_0xd42139[_0x2e70('0x33')][_0x2e70('0x3b')]);_0x34d34f[_0x2e70('0x3c')]=qs[_0x2e70('0x3d')](_[_0x2e70('0x3e')](_0xd42139[_0x2e70('0x33')],_0x24d46f[_0x2e70('0x3d')]));if(_0xd42139[_0x2e70('0x33')][_0x2e70('0x3f')]){_0x34d34f[_0x2e70('0x3c')]=_[_0x2e70('0x40')](_0x34d34f[_0x2e70('0x3c')],{'$or':_[_0x2e70('0x2c')](_0x34d34f['attributes'],function(_0x4ec59b){var _0xa660d1={};_0xa660d1[_0x4ec59b]={'$like':'%'+_0xd42139[_0x2e70('0x33')][_0x2e70('0x3f')]+'%'};return _0xa660d1;})});}_0x34d34f=_[_0x2e70('0x40')]({},_0x34d34f,_0xd42139[_0x2e70('0x45')]);return _0x5bc277[_0x2e70('0x4f')](_0x34d34f);}})[_0x2e70('0x26')](function(_0x3121c8){if(_0x3121c8){_0x3bcaa5=_0x3121c8[_0x2e70('0x38')];if(!_0xd42139[_0x2e70('0x33')][_0x2e70('0x39')](_0x2e70('0x4d'))){_0x34d34f[_0x2e70('0x21')]=qs[_0x2e70('0x21')](_0xd42139[_0x2e70('0x33')][_0x2e70('0x21')]);_0x34d34f[_0x2e70('0x1e')]=qs[_0x2e70('0x1e')](_0xd42139[_0x2e70('0x33')][_0x2e70('0x1e')]);}return _0x5bc277[_0x2e70('0x4f')](_0x34d34f);}})['then'](function(_0x1d93b6){if(_0x1d93b6){return _0x1d93b6?{'count':_0x3bcaa5,'rows':_0x1d93b6}:null;}})[_0x2e70('0x26')](respondWithResult(_0x1334b1,null))[_0x2e70('0x46')](handleError(_0x1334b1,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 32fd62e..bb35beb 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 _0xb821=['rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','define','Dynamics365Configuration','int_dynamics365_configurations','util','../../config/logger','bluebird'];(function(_0x3ae13d,_0x2cf7f9){var _0xf11147=function(_0x367b63){while(--_0x367b63){_0x3ae13d['push'](_0x3ae13d['shift']());}};_0xf11147(++_0x2cf7f9);}(_0xb821,0xa7));var _0x1b82=function(_0x43142c,_0xf069aa){_0x43142c=_0x43142c-0x0;var _0x192979=_0xb821[_0x43142c];return _0x192979;};'use strict';var _=require('lodash');var util=require(_0x1b82('0x0'));var logger=require(_0x1b82('0x1'))('api');var moment=require('moment');var BPromise=require(_0x1b82('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1b82('0x3'));var config=require(_0x1b82('0x4'));var attributes=require(_0x1b82('0x5'));module[_0x1b82('0x6')]=function(_0x597ca7,_0x3e27c4){return _0x597ca7[_0x1b82('0x7')](_0x1b82('0x8'),attributes,{'tableName':_0x1b82('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf109=['Dynamics365Configuration','int_dynamics365_configurations','lodash','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','define'];(function(_0x80aaee,_0x53dd19){var _0x380b69=function(_0x1a709e){while(--_0x1a709e){_0x80aaee['push'](_0x80aaee['shift']());}};_0x380b69(++_0x53dd19);}(_0xf109,0xce));var _0x9f10=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0xf109[_0x11005e];return _0x29338f;};'use strict';var _=require(_0x9f10('0x0'));var util=require(_0x9f10('0x1'));var logger=require(_0x9f10('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9f10('0x3'));var fs=require('fs');var path=require(_0x9f10('0x4'));var rimraf=require(_0x9f10('0x5'));var config=require(_0x9f10('0x6'));var attributes=require(_0x9f10('0x7'));module[_0x9f10('0x8')]=function(_0x408fe8,_0xd3137b){return _0x408fe8[_0x9f10('0x9')](_0x9f10('0xa'),attributes,{'tableName':_0x9f10('0xb'),'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 2228b2f..d4583f7 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 _0xc436=['stringify','error','code','message','request\x20sent','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','Dynamics365Configuration,\x20%s,\x20%s','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xc436,0x193));var _0x6c43=function(_0x192474,_0x2f1866){_0x192474=_0x192474-0x0;var _0xbfd1ed=_0xc436[_0x192474];return _0xbfd1ed;};'use strict';var _=require('lodash');var util=require(_0x6c43('0x0'));var moment=require('moment');var BPromise=require(_0x6c43('0x1'));var rs=require(_0x6c43('0x2'));var fs=require('fs');var Redis=require(_0x6c43('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x6c43('0x4'));var logger=require(_0x6c43('0x5'))(_0x6c43('0x6'));var config=require(_0x6c43('0x7'));var jayson=require(_0x6c43('0x8'));var client=jayson['client'][_0x6c43('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x19cc84,_0x5c3856,_0x44caf8){return new BPromise(function(_0x4f585f,_0x41f46a){return client['request'](_0x19cc84,_0x44caf8)[_0x6c43('0xa')](function(_0x36d437){logger[_0x6c43('0xb')](_0x6c43('0xc'),_0x5c3856,'request\x20sent');logger[_0x6c43('0xd')](_0x6c43('0xe'),_0x5c3856,'request\x20sent',JSON[_0x6c43('0xf')](_0x36d437));if(_0x36d437['error']){if(_0x36d437[_0x6c43('0x10')][_0x6c43('0x11')]===0x1f4){logger[_0x6c43('0x10')](_0x6c43('0xc'),_0x5c3856,_0x36d437[_0x6c43('0x10')][_0x6c43('0x12')]);return _0x41f46a(_0x36d437[_0x6c43('0x10')][_0x6c43('0x12')]);}logger[_0x6c43('0x10')]('Dynamics365Configuration,\x20%s,\x20%s',_0x5c3856,_0x36d437['error']['message']);return _0x4f585f(_0x36d437[_0x6c43('0x10')][_0x6c43('0x12')]);}else{logger[_0x6c43('0xb')](_0x6c43('0xc'),_0x5c3856,_0x6c43('0x13'));_0x4f585f(_0x36d437[_0x6c43('0x14')]['message']);}})[_0x6c43('0x15')](function(_0x3ddccb){logger[_0x6c43('0x10')](_0x6c43('0xc'),_0x5c3856,_0x3ddccb);_0x41f46a(_0x3ddccb);});});} \ No newline at end of file +var _0x8166=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','lodash','util'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x8166,0x1a2));var _0x6816=function(_0x28c939,_0x110e29){_0x28c939=_0x28c939-0x0;var _0x527fe9=_0x8166[_0x28c939];return _0x527fe9;};'use strict';var _=require(_0x6816('0x0'));var util=require(_0x6816('0x1'));var moment=require(_0x6816('0x2'));var BPromise=require(_0x6816('0x3'));var rs=require(_0x6816('0x4'));var fs=require('fs');var Redis=require(_0x6816('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x6816('0x6'));var logger=require(_0x6816('0x7'))('rpc');var config=require(_0x6816('0x8'));var jayson=require(_0x6816('0x9'));var client=jayson[_0x6816('0xa')][_0x6816('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5648f0,_0x34049b,_0x49d573){return new BPromise(function(_0x5e16c1,_0x292891){return client['request'](_0x5648f0,_0x49d573)['then'](function(_0x413525){logger[_0x6816('0xc')](_0x6816('0xd'),_0x34049b,_0x6816('0xe'));logger[_0x6816('0xf')]('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x34049b,_0x6816('0xe'),JSON[_0x6816('0x10')](_0x413525));if(_0x413525['error']){if(_0x413525[_0x6816('0x11')]['code']===0x1f4){logger[_0x6816('0x11')]('Dynamics365Configuration,\x20%s,\x20%s',_0x34049b,_0x413525['error'][_0x6816('0x12')]);return _0x292891(_0x413525[_0x6816('0x11')][_0x6816('0x12')]);}logger[_0x6816('0x11')](_0x6816('0xd'),_0x34049b,_0x413525['error'][_0x6816('0x12')]);return _0x5e16c1(_0x413525['error'][_0x6816('0x12')]);}else{logger[_0x6816('0xc')](_0x6816('0xd'),_0x34049b,_0x6816('0xe'));_0x5e16c1(_0x413525[_0x6816('0x13')][_0x6816('0x12')]);}})['catch'](function(_0x2a933d){logger[_0x6816('0x11')]('Dynamics365Configuration,\x20%s,\x20%s',_0x34049b,_0x2a933d);_0x292891(_0x2a933d);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 6f4289e..6f5680a 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 _0x6817=['show','post','create','put','update','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDynamics365Field.controller','index','get','/:id','isAuthenticated'];(function(_0x241f85,_0x1b01fd){var _0xcd0a2e=function(_0x48b559){while(--_0x48b559){_0x241f85['push'](_0x241f85['shift']());}};_0xcd0a2e(++_0x1b01fd);}(_0x6817,0xf7));var _0x7681=function(_0x330dcf,_0x5b0f24){_0x330dcf=_0x330dcf-0x0;var _0x322756=_0x6817[_0x330dcf];return _0x322756;};'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(_0x7681('0x7'));var config=require('../../config/environment');var controller=require(_0x7681('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x7681('0x9')]);router[_0x7681('0xa')](_0x7681('0xb'),auth[_0x7681('0xc')](),controller[_0x7681('0xd')]);router[_0x7681('0xe')]('/',auth['isAuthenticated'](),controller[_0x7681('0xf')]);router[_0x7681('0x10')](_0x7681('0xb'),auth[_0x7681('0xc')](),controller[_0x7681('0x11')]);router[_0x7681('0x12')]('/:id',auth[_0x7681('0xc')](),controller[_0x7681('0x13')]);module['exports']=router; \ No newline at end of file +var _0xfc52=['../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','/:id','create','put','delete','destroy','exports','path','connect-timeout','Router','fs-extra'];(function(_0x343583,_0x276f29){var _0x547962=function(_0x2b2f24){while(--_0x2b2f24){_0x343583['push'](_0x343583['shift']());}};_0x547962(++_0x276f29);}(_0xfc52,0x1d8));var _0x2fc5=function(_0x2ced4f,_0x3e2bec){_0x2ced4f=_0x2ced4f-0x0;var _0x4cf01a=_0xfc52[_0x2ced4f];return _0x4cf01a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2fc5('0x0'));var timeout=require(_0x2fc5('0x1'));var express=require('express');var router=express[_0x2fc5('0x2')]();var fs_extra=require(_0x2fc5('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2fc5('0x4'));var controller=require(_0x2fc5('0x5'));router[_0x2fc5('0x6')]('/',auth[_0x2fc5('0x7')](),controller['index']);router[_0x2fc5('0x6')](_0x2fc5('0x8'),auth[_0x2fc5('0x7')](),controller['show']);router['post']('/',auth[_0x2fc5('0x7')](),controller[_0x2fc5('0x9')]);router[_0x2fc5('0xa')](_0x2fc5('0x8'),auth[_0x2fc5('0x7')](),controller['update']);router[_0x2fc5('0xb')](_0x2fc5('0x8'),auth['isAuthenticated'](),controller[_0x2fc5('0xc')]);module[_0x2fc5('0xd')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 0cc51ba..f61c46f 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 _0x88a5=['sequelize','exports','ENUM','string','customVariable','picklist','STRING','BOOLEAN'];(function(_0x2feb20,_0x411328){var _0x504215=function(_0x2d3c2a){while(--_0x2d3c2a){_0x2feb20['push'](_0x2feb20['shift']());}};_0x504215(++_0x411328);}(_0x88a5,0x178));var _0x588a=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x88a5[_0x31e29a];return _0x32d892;};'use strict';var Sequelize=require(_0x588a('0x0'));module[_0x588a('0x1')]={'type':{'type':Sequelize[_0x588a('0x2')](_0x588a('0x3'),'variable',_0x588a('0x4'),'keyValue',_0x588a('0x5')),'defaultValue':_0x588a('0x3')},'content':{'type':Sequelize[_0x588a('0x6')]},'key':{'type':Sequelize[_0x588a('0x6')]},'keyType':{'type':Sequelize[_0x588a('0x2')](_0x588a('0x3'),'variable',_0x588a('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x588a('0x6')]},'nameField':{'type':Sequelize[_0x588a('0x6')]},'customField':{'type':Sequelize[_0x588a('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x588a('0x6')]}}; \ No newline at end of file +var _0x1c8d=['customVariable','picklist','STRING','ENUM','string','variable'];(function(_0x400ad4,_0x25ab92){var _0x48f28c=function(_0x482d00){while(--_0x482d00){_0x400ad4['push'](_0x400ad4['shift']());}};_0x48f28c(++_0x25ab92);}(_0x1c8d,0x183));var _0xd1c8=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x1c8d[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0xd1c8('0x0')](_0xd1c8('0x1'),_0xd1c8('0x2'),_0xd1c8('0x3'),'keyValue',_0xd1c8('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0xd1c8('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xd1c8('0x0')]('string',_0xd1c8('0x2'),_0xd1c8('0x3'))},'keyContent':{'type':Sequelize[_0xd1c8('0x5')]},'idField':{'type':Sequelize[_0xd1c8('0x5')]},'nameField':{'type':Sequelize[_0xd1c8('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd1c8('0x5')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 7e6ca3b..c4f5fc2 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 _0x8f4a=['map','Dynamics365Field','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','rawAttributes','create','body','update','find','zip-dir','request-promise','moment','bluebird','util','path','sox','fs-extra','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','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','sendStatus','error','stack','name','send'];(function(_0x4da55f,_0x39cd83){var _0xae8aa1=function(_0xfa2988){while(--_0xfa2988){_0x4da55f['push'](_0x4da55f['shift']());}};_0xae8aa1(++_0x39cd83);}(_0x8f4a,0x199));var _0xa8f4=function(_0x1945be,_0x58c2ac){_0x1945be=_0x1945be-0x0;var _0x583552=_0x8f4a[_0x1945be];return _0x583552;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xa8f4('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa8f4('0x1'));var moment=require(_0xa8f4('0x2'));var BPromise=require(_0xa8f4('0x3'));var Mustache=require('mustache');var util=require(_0xa8f4('0x4'));var path=require(_0xa8f4('0x5'));var sox=require(_0xa8f4('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa8f4('0x7'));var _=require(_0xa8f4('0x8'));var squel=require(_0xa8f4('0x9'));var crypto=require(_0xa8f4('0xa'));var jsforce=require(_0xa8f4('0xb'));var deskjs=require(_0xa8f4('0xc'));var toCsv=require(_0xa8f4('0xd'));var querystring=require('querystring');var Papa=require(_0xa8f4('0xe'));var Redis=require(_0xa8f4('0xf'));var authService=require(_0xa8f4('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xa8f4('0x11'));var hardwareService=require(_0xa8f4('0x12'));var logger=require(_0xa8f4('0x13'))(_0xa8f4('0x14'));var utils=require(_0xa8f4('0x15'));var config=require(_0xa8f4('0x16'));var licenseUtil=require(_0xa8f4('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x29b0e0,_0x48c322){_0x48c322=_0x48c322||0xcc;return function(_0x41db11){if(_0x41db11){return _0x29b0e0['sendStatus'](_0x48c322);}return _0x29b0e0[_0xa8f4('0x18')](_0x48c322)['end']();};}function respondWithResult(_0x44575b,_0x484454){_0x484454=_0x484454||0xc8;return function(_0x200fde){if(_0x200fde){return _0x44575b[_0xa8f4('0x18')](_0x484454)[_0xa8f4('0x19')](_0x200fde);}};}function respondWithFilteredResult(_0x5449d2,_0x374974){return function(_0x3f5eff){if(_0x3f5eff){var _0x112566=typeof _0x374974[_0xa8f4('0x1a')]===_0xa8f4('0x1b')&&typeof _0x374974[_0xa8f4('0x1c')]===_0xa8f4('0x1b');var _0x20f279=_0x3f5eff[_0xa8f4('0x1d')];var _0x3317f8=_0x112566?0x0:_0x374974[_0xa8f4('0x1a')];var _0x2509bc=_0x112566?_0x3f5eff[_0xa8f4('0x1d')]:_0x374974['offset']+_0x374974[_0xa8f4('0x1c')];var _0x5b9062;if(_0x2509bc>=_0x20f279){_0x2509bc=_0x20f279;_0x5b9062=0xc8;}else{_0x5b9062=0xce;}_0x5449d2[_0xa8f4('0x18')](_0x5b9062);return _0x5449d2['set'](_0xa8f4('0x1e'),_0x3317f8+'-'+_0x2509bc+'/'+_0x20f279)[_0xa8f4('0x19')](_0x3f5eff);}return null;};}function patchUpdates(_0x527712){return function(_0x16bde1){try{jsonpatch[_0xa8f4('0x1f')](_0x16bde1,_0x527712,!![]);}catch(_0x51dd9a){return BPromise[_0xa8f4('0x20')](_0x51dd9a);}return _0x16bde1[_0xa8f4('0x21')]();};}function saveUpdates(_0x4c4559,_0x600dcf){return function(_0x367383){if(_0x367383){return _0x367383['update'](_0x4c4559)[_0xa8f4('0x22')](function(_0x37e872){return _0x37e872;});}return null;};}function removeEntity(_0x2840ce,_0xa8ab46){return function(_0x2be24e){if(_0x2be24e){return _0x2be24e[_0xa8f4('0x23')]()[_0xa8f4('0x22')](function(){_0x2840ce['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x28de7f,_0x9f4ef){return function(_0x163e5d){if(!_0x163e5d){_0x28de7f[_0xa8f4('0x24')](0x194);}return _0x163e5d;};}function handleError(_0x5cd269,_0xba3604){_0xba3604=_0xba3604||0x1f4;return function(_0x58a489){logger[_0xa8f4('0x25')](_0x58a489[_0xa8f4('0x26')]);if(_0x58a489['name']){delete _0x58a489[_0xa8f4('0x27')];}_0x5cd269[_0xa8f4('0x18')](_0xba3604)[_0xa8f4('0x28')](_0x58a489);};}exports['index']=function(_0x9c61bf,_0x283ae6){var _0x417326={},_0x539701={},_0x3b320b={'count':0x0,'rows':[]};var _0x53673b=_[_0xa8f4('0x29')](db[_0xa8f4('0x2a')]['rawAttributes'],function(_0x2d2409){return{'name':_0x2d2409[_0xa8f4('0x2b')],'type':_0x2d2409[_0xa8f4('0x2c')][_0xa8f4('0x2d')]};});_0x539701[_0xa8f4('0x2e')]=_['map'](_0x53673b,'name');_0x539701[_0xa8f4('0x2f')]=_[_0xa8f4('0x30')](_0x9c61bf[_0xa8f4('0x2f')]);_0x539701[_0xa8f4('0x31')]=_[_0xa8f4('0x32')](_0x539701[_0xa8f4('0x2e')],_0x539701[_0xa8f4('0x2f')]);_0x417326[_0xa8f4('0x33')]=_[_0xa8f4('0x32')](_0x539701[_0xa8f4('0x2e')],qs[_0xa8f4('0x34')](_0x9c61bf['query'][_0xa8f4('0x34')]));_0x417326[_0xa8f4('0x33')]=_0x417326[_0xa8f4('0x33')][_0xa8f4('0x35')]?_0x417326['attributes']:_0x539701[_0xa8f4('0x2e')];if(!_0x9c61bf[_0xa8f4('0x2f')][_0xa8f4('0x36')](_0xa8f4('0x37'))){_0x417326['limit']=qs[_0xa8f4('0x1c')](_0x9c61bf[_0xa8f4('0x2f')]['limit']);_0x417326[_0xa8f4('0x1a')]=qs['offset'](_0x9c61bf[_0xa8f4('0x2f')]['offset']);}_0x417326[_0xa8f4('0x38')]=qs[_0xa8f4('0x39')](_0x9c61bf['query'][_0xa8f4('0x39')]);_0x417326[_0xa8f4('0x3a')]=qs['filters'](_[_0xa8f4('0x3b')](_0x9c61bf['query'],_0x539701[_0xa8f4('0x31')]),_0x53673b);if(_0x9c61bf[_0xa8f4('0x2f')][_0xa8f4('0x3c')]){_0x417326['where']=_[_0xa8f4('0x3d')](_0x417326[_0xa8f4('0x3a')],{'$or':_[_0xa8f4('0x29')](_0x53673b,function(_0x377727){if(_0x377727[_0xa8f4('0x2c')]!==_0xa8f4('0x3e')){var _0x569687={};_0x569687[_0x377727[_0xa8f4('0x27')]]={'$like':'%'+_0x9c61bf['query'][_0xa8f4('0x3c')]+'%'};return _0x569687;}})});}_0x417326=_[_0xa8f4('0x3d')]({},_0x417326,_0x9c61bf[_0xa8f4('0x3f')]);var _0x5084ef={'where':_0x417326[_0xa8f4('0x3a')]};return db['Dynamics365Field'][_0xa8f4('0x1d')](_0x5084ef)[_0xa8f4('0x22')](function(_0xfdaf38){_0x3b320b[_0xa8f4('0x1d')]=_0xfdaf38;if(_0x9c61bf[_0xa8f4('0x2f')][_0xa8f4('0x40')]){_0x417326[_0xa8f4('0x41')]=[{'all':!![]}];}return db[_0xa8f4('0x2a')][_0xa8f4('0x42')](_0x417326);})[_0xa8f4('0x22')](function(_0x33a028){_0x3b320b[_0xa8f4('0x43')]=_0x33a028;return _0x3b320b;})[_0xa8f4('0x22')](respondWithFilteredResult(_0x283ae6,_0x417326))[_0xa8f4('0x44')](handleError(_0x283ae6,null));};exports['show']=function(_0x308650,_0x336de5){var _0x165fe7={'raw':!![],'where':{'id':_0x308650[_0xa8f4('0x45')]['id']}},_0x1ecba={};_0x1ecba[_0xa8f4('0x2e')]=_[_0xa8f4('0x30')](db['Dynamics365Field'][_0xa8f4('0x46')]);_0x1ecba['query']=_[_0xa8f4('0x30')](_0x308650['query']);_0x1ecba['filters']=_[_0xa8f4('0x32')](_0x1ecba[_0xa8f4('0x2e')],_0x1ecba[_0xa8f4('0x2f')]);_0x165fe7[_0xa8f4('0x33')]=_[_0xa8f4('0x32')](_0x1ecba[_0xa8f4('0x2e')],qs[_0xa8f4('0x34')](_0x308650[_0xa8f4('0x2f')]['fields']));_0x165fe7[_0xa8f4('0x33')]=_0x165fe7['attributes'][_0xa8f4('0x35')]?_0x165fe7[_0xa8f4('0x33')]:_0x1ecba['model'];if(_0x308650[_0xa8f4('0x2f')][_0xa8f4('0x40')]){_0x165fe7[_0xa8f4('0x41')]=[{'all':!![]}];}_0x165fe7=_[_0xa8f4('0x3d')]({},_0x165fe7,_0x308650['options']);return db[_0xa8f4('0x2a')]['find'](_0x165fe7)['then'](handleEntityNotFound(_0x336de5,null))[_0xa8f4('0x22')](respondWithResult(_0x336de5,null))[_0xa8f4('0x44')](handleError(_0x336de5,null));};exports[_0xa8f4('0x47')]=function(_0x40569f,_0x4929f2){return db['Dynamics365Field']['create'](_0x40569f[_0xa8f4('0x48')],{})[_0xa8f4('0x22')](respondWithResult(_0x4929f2,0xc9))[_0xa8f4('0x44')](handleError(_0x4929f2,null));};exports[_0xa8f4('0x49')]=function(_0x4fe923,_0x23d7be){if(_0x4fe923['body']['id']){delete _0x4fe923[_0xa8f4('0x48')]['id'];}return db[_0xa8f4('0x2a')][_0xa8f4('0x4a')]({'where':{'id':_0x4fe923[_0xa8f4('0x45')]['id']}})[_0xa8f4('0x22')](handleEntityNotFound(_0x23d7be,null))[_0xa8f4('0x22')](saveUpdates(_0x4fe923[_0xa8f4('0x48')],null))[_0xa8f4('0x22')](respondWithResult(_0x23d7be,null))['catch'](handleError(_0x23d7be,null));};exports[_0xa8f4('0x23')]=function(_0x54c271,_0x331210){return db[_0xa8f4('0x2a')][_0xa8f4('0x4a')]({'where':{'id':_0x54c271[_0xa8f4('0x45')]['id']}})[_0xa8f4('0x22')](handleEntityNotFound(_0x331210,null))[_0xa8f4('0x22')](removeEntity(_0x331210,null))[_0xa8f4('0x44')](handleError(_0x331210,null));}; \ No newline at end of file +var _0x5e92=['key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','sort','where','filter','merge','options','include','findAll','catch','show','params','includeAll','find','create','body','update','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','count','limit','Content-Range','apply','save','then','destroy','error','stack','name','send','index','map','Dynamics365Field','rawAttributes','fieldName','type'];(function(_0x606ade,_0x424b44){var _0x1774b7=function(_0x203650){while(--_0x203650){_0x606ade['push'](_0x606ade['shift']());}};_0x1774b7(++_0x424b44);}(_0x5e92,0xab));var _0x25e9=function(_0x399ae7,_0x3fe762){_0x399ae7=_0x399ae7-0x0;var _0xa57ba7=_0x5e92[_0x399ae7];return _0xa57ba7;};'use strict';var emlformat=require(_0x25e9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x25e9('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x25e9('0x2'));var moment=require(_0x25e9('0x3'));var BPromise=require(_0x25e9('0x4'));var Mustache=require(_0x25e9('0x5'));var util=require(_0x25e9('0x6'));var path=require(_0x25e9('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x25e9('0x8'));var fs=require('fs');var fs_extra=require(_0x25e9('0x9'));var _=require('lodash');var squel=require(_0x25e9('0xa'));var crypto=require('crypto');var jsforce=require(_0x25e9('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x25e9('0xc'));var querystring=require(_0x25e9('0xd'));var Papa=require(_0x25e9('0xe'));var Redis=require(_0x25e9('0xf'));var authService=require(_0x25e9('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x25e9('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x25e9('0x12'))(_0x25e9('0x13'));var utils=require(_0x25e9('0x14'));var config=require(_0x25e9('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x25e9('0x16'))['db'];function respondWithStatusCode(_0x4552d9,_0x307e16){_0x307e16=_0x307e16||0xcc;return function(_0x58f073){if(_0x58f073){return _0x4552d9[_0x25e9('0x17')](_0x307e16);}return _0x4552d9[_0x25e9('0x18')](_0x307e16)[_0x25e9('0x19')]();};}function respondWithResult(_0x123934,_0x3ea452){_0x3ea452=_0x3ea452||0xc8;return function(_0x4078c4){if(_0x4078c4){return _0x123934['status'](_0x3ea452)[_0x25e9('0x1a')](_0x4078c4);}};}function respondWithFilteredResult(_0x4ceeab,_0x36e633){return function(_0x1e455f){if(_0x1e455f){var _0x2e98d7=typeof _0x36e633['offset']===_0x25e9('0x1b')&&typeof _0x36e633['limit']===_0x25e9('0x1b');var _0x5183bf=_0x1e455f[_0x25e9('0x1c')];var _0x18eb9d=_0x2e98d7?0x0:_0x36e633['offset'];var _0x43b477=_0x2e98d7?_0x1e455f['count']:_0x36e633['offset']+_0x36e633[_0x25e9('0x1d')];var _0x399967;if(_0x43b477>=_0x5183bf){_0x43b477=_0x5183bf;_0x399967=0xc8;}else{_0x399967=0xce;}_0x4ceeab['status'](_0x399967);return _0x4ceeab['set'](_0x25e9('0x1e'),_0x18eb9d+'-'+_0x43b477+'/'+_0x5183bf)['json'](_0x1e455f);}return null;};}function patchUpdates(_0x13b69c){return function(_0x4458cc){try{jsonpatch[_0x25e9('0x1f')](_0x4458cc,_0x13b69c,!![]);}catch(_0x142b1d){return BPromise['reject'](_0x142b1d);}return _0x4458cc[_0x25e9('0x20')]();};}function saveUpdates(_0x273a4c,_0x9688c1){return function(_0x2f6ddb){if(_0x2f6ddb){return _0x2f6ddb['update'](_0x273a4c)[_0x25e9('0x21')](function(_0x2a5138){return _0x2a5138;});}return null;};}function removeEntity(_0x5283c4,_0x3a0dae){return function(_0x387fbe){if(_0x387fbe){return _0x387fbe[_0x25e9('0x22')]()[_0x25e9('0x21')](function(){_0x5283c4[_0x25e9('0x18')](0xcc)[_0x25e9('0x19')]();});}};}function handleEntityNotFound(_0x1953de,_0x4a30dc){return function(_0x124245){if(!_0x124245){_0x1953de[_0x25e9('0x17')](0x194);}return _0x124245;};}function handleError(_0x527e71,_0x5d6bdb){_0x5d6bdb=_0x5d6bdb||0x1f4;return function(_0x2019ec){logger[_0x25e9('0x23')](_0x2019ec[_0x25e9('0x24')]);if(_0x2019ec['name']){delete _0x2019ec[_0x25e9('0x25')];}_0x527e71[_0x25e9('0x18')](_0x5d6bdb)[_0x25e9('0x26')](_0x2019ec);};}exports[_0x25e9('0x27')]=function(_0x432a8f,_0x31321d){var _0x46a76c={},_0x2c649e={},_0xfbc42c={'count':0x0,'rows':[]};var _0x473f06=_[_0x25e9('0x28')](db[_0x25e9('0x29')][_0x25e9('0x2a')],function(_0x1988f1){return{'name':_0x1988f1[_0x25e9('0x2b')],'type':_0x1988f1[_0x25e9('0x2c')][_0x25e9('0x2d')]};});_0x2c649e[_0x25e9('0x2e')]=_['map'](_0x473f06,'name');_0x2c649e[_0x25e9('0x2f')]=_[_0x25e9('0x30')](_0x432a8f[_0x25e9('0x2f')]);_0x2c649e[_0x25e9('0x31')]=_[_0x25e9('0x32')](_0x2c649e[_0x25e9('0x2e')],_0x2c649e[_0x25e9('0x2f')]);_0x46a76c[_0x25e9('0x33')]=_[_0x25e9('0x32')](_0x2c649e[_0x25e9('0x2e')],qs[_0x25e9('0x34')](_0x432a8f[_0x25e9('0x2f')][_0x25e9('0x34')]));_0x46a76c[_0x25e9('0x33')]=_0x46a76c[_0x25e9('0x33')][_0x25e9('0x35')]?_0x46a76c[_0x25e9('0x33')]:_0x2c649e[_0x25e9('0x2e')];if(!_0x432a8f[_0x25e9('0x2f')][_0x25e9('0x36')](_0x25e9('0x37'))){_0x46a76c[_0x25e9('0x1d')]=qs[_0x25e9('0x1d')](_0x432a8f[_0x25e9('0x2f')][_0x25e9('0x1d')]);_0x46a76c['offset']=qs[_0x25e9('0x38')](_0x432a8f[_0x25e9('0x2f')][_0x25e9('0x38')]);}_0x46a76c['order']=qs[_0x25e9('0x39')](_0x432a8f['query'][_0x25e9('0x39')]);_0x46a76c[_0x25e9('0x3a')]=qs[_0x25e9('0x31')](_['pick'](_0x432a8f['query'],_0x2c649e[_0x25e9('0x31')]),_0x473f06);if(_0x432a8f[_0x25e9('0x2f')][_0x25e9('0x3b')]){_0x46a76c[_0x25e9('0x3a')]=_['merge'](_0x46a76c[_0x25e9('0x3a')],{'$or':_[_0x25e9('0x28')](_0x473f06,function(_0x36482e){if(_0x36482e[_0x25e9('0x2c')]!=='VIRTUAL'){var _0x785d5b={};_0x785d5b[_0x36482e[_0x25e9('0x25')]]={'$like':'%'+_0x432a8f[_0x25e9('0x2f')][_0x25e9('0x3b')]+'%'};return _0x785d5b;}})});}_0x46a76c=_[_0x25e9('0x3c')]({},_0x46a76c,_0x432a8f[_0x25e9('0x3d')]);var _0x5aed6f={'where':_0x46a76c[_0x25e9('0x3a')]};return db['Dynamics365Field']['count'](_0x5aed6f)[_0x25e9('0x21')](function(_0x384bb0){_0xfbc42c[_0x25e9('0x1c')]=_0x384bb0;if(_0x432a8f['query']['includeAll']){_0x46a76c[_0x25e9('0x3e')]=[{'all':!![]}];}return db[_0x25e9('0x29')][_0x25e9('0x3f')](_0x46a76c);})['then'](function(_0x1c217e){_0xfbc42c['rows']=_0x1c217e;return _0xfbc42c;})[_0x25e9('0x21')](respondWithFilteredResult(_0x31321d,_0x46a76c))[_0x25e9('0x40')](handleError(_0x31321d,null));};exports[_0x25e9('0x41')]=function(_0x413939,_0x8c236){var _0x156ced={'raw':!![],'where':{'id':_0x413939[_0x25e9('0x42')]['id']}},_0x186448={};_0x186448['model']=_[_0x25e9('0x30')](db['Dynamics365Field'][_0x25e9('0x2a')]);_0x186448['query']=_[_0x25e9('0x30')](_0x413939[_0x25e9('0x2f')]);_0x186448['filters']=_[_0x25e9('0x32')](_0x186448[_0x25e9('0x2e')],_0x186448[_0x25e9('0x2f')]);_0x156ced['attributes']=_[_0x25e9('0x32')](_0x186448[_0x25e9('0x2e')],qs[_0x25e9('0x34')](_0x413939[_0x25e9('0x2f')][_0x25e9('0x34')]));_0x156ced['attributes']=_0x156ced['attributes'][_0x25e9('0x35')]?_0x156ced[_0x25e9('0x33')]:_0x186448[_0x25e9('0x2e')];if(_0x413939['query'][_0x25e9('0x43')]){_0x156ced[_0x25e9('0x3e')]=[{'all':!![]}];}_0x156ced=_[_0x25e9('0x3c')]({},_0x156ced,_0x413939[_0x25e9('0x3d')]);return db[_0x25e9('0x29')][_0x25e9('0x44')](_0x156ced)[_0x25e9('0x21')](handleEntityNotFound(_0x8c236,null))[_0x25e9('0x21')](respondWithResult(_0x8c236,null))[_0x25e9('0x40')](handleError(_0x8c236,null));};exports[_0x25e9('0x45')]=function(_0x54ee9b,_0x3ca4e9){return db[_0x25e9('0x29')][_0x25e9('0x45')](_0x54ee9b[_0x25e9('0x46')],{})['then'](respondWithResult(_0x3ca4e9,0xc9))['catch'](handleError(_0x3ca4e9,null));};exports[_0x25e9('0x47')]=function(_0x187777,_0x2999ce){if(_0x187777[_0x25e9('0x46')]['id']){delete _0x187777[_0x25e9('0x46')]['id'];}return db[_0x25e9('0x29')][_0x25e9('0x44')]({'where':{'id':_0x187777[_0x25e9('0x42')]['id']}})[_0x25e9('0x21')](handleEntityNotFound(_0x2999ce,null))[_0x25e9('0x21')](saveUpdates(_0x187777[_0x25e9('0x46')],null))[_0x25e9('0x21')](respondWithResult(_0x2999ce,null))[_0x25e9('0x40')](handleError(_0x2999ce,null));};exports[_0x25e9('0x22')]=function(_0x3e7acb,_0x41dc97){return db[_0x25e9('0x29')][_0x25e9('0x44')]({'where':{'id':_0x3e7acb[_0x25e9('0x42')]['id']}})[_0x25e9('0x21')](handleEntityNotFound(_0x41dc97,null))[_0x25e9('0x21')](removeEntity(_0x41dc97,null))['catch'](handleError(_0x41dc97,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index b0480d0..5f9dd4d 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 _0x09f1=['Dynamics365Field','int_dynamics365_fields','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x115850,_0x4bb634){var _0xbad084=function(_0xa14074){while(--_0xa14074){_0x115850['push'](_0x115850['shift']());}};_0xbad084(++_0x4bb634);}(_0x09f1,0x184));var _0x109f=function(_0x2e2562,_0x5607e5){_0x2e2562=_0x2e2562-0x0;var _0x3abd5b=_0x09f1[_0x2e2562];return _0x3abd5b;};'use strict';var _=require(_0x109f('0x0'));var util=require(_0x109f('0x1'));var logger=require(_0x109f('0x2'))(_0x109f('0x3'));var moment=require(_0x109f('0x4'));var BPromise=require(_0x109f('0x5'));var rp=require(_0x109f('0x6'));var fs=require('fs');var path=require(_0x109f('0x7'));var rimraf=require(_0x109f('0x8'));var config=require(_0x109f('0x9'));var attributes=require('./intDynamics365Field.attributes');module[_0x109f('0xa')]=function(_0x3c0f47,_0x598e5d){return _0x3c0f47[_0x109f('0xb')](_0x109f('0xc'),attributes,{'tableName':_0x109f('0xd'),'paranoid':![],'indexes':[{'name':'dynamics365_unique_index','fields':[_0x109f('0xe'),_0x109f('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdca3=['idField','FieldId','util','../../config/logger','moment','bluebird','rimraf','../../config/environment','./intDynamics365Field.attributes','exports','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index'];(function(_0x52a293,_0x20560f){var _0x50b815=function(_0x1f83b5){while(--_0x1f83b5){_0x52a293['push'](_0x52a293['shift']());}};_0x50b815(++_0x20560f);}(_0xdca3,0x17b));var _0x3dca=function(_0x42ee97,_0x27ecad){_0x42ee97=_0x42ee97-0x0;var _0x4c62af=_0xdca3[_0x42ee97];return _0x4c62af;};'use strict';var _=require('lodash');var util=require(_0x3dca('0x0'));var logger=require(_0x3dca('0x1'))('api');var moment=require(_0x3dca('0x2'));var BPromise=require(_0x3dca('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x3dca('0x4'));var config=require(_0x3dca('0x5'));var attributes=require(_0x3dca('0x6'));module[_0x3dca('0x7')]=function(_0x9cc90,_0x3cd0b4){return _0x9cc90['define'](_0x3dca('0x8'),attributes,{'tableName':_0x3dca('0x9'),'paranoid':![],'indexes':[{'name':_0x3dca('0xa'),'fields':[_0x3dca('0xb'),_0x3dca('0xc')],'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 49f6d2d..0e55ee8 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 _0xb288=['message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xb288,0xdf));var _0x8b28=function(_0xd17fe2,_0x41967c){_0xd17fe2=_0xd17fe2-0x0;var _0x56babf=_0xb288[_0xd17fe2];return _0x56babf;};'use strict';var _=require('lodash');var util=require(_0x8b28('0x0'));var moment=require(_0x8b28('0x1'));var BPromise=require('bluebird');var rs=require(_0x8b28('0x2'));var fs=require('fs');var Redis=require(_0x8b28('0x3'));var db=require(_0x8b28('0x4'))['db'];var utils=require(_0x8b28('0x5'));var logger=require(_0x8b28('0x6'))(_0x8b28('0x7'));var config=require(_0x8b28('0x8'));var jayson=require(_0x8b28('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2679ef,_0x435149,_0x45b308){return new BPromise(function(_0x5da1e6,_0x4c568c){return client[_0x8b28('0xa')](_0x2679ef,_0x45b308)[_0x8b28('0xb')](function(_0x5e2be6){logger[_0x8b28('0xc')](_0x8b28('0xd'),_0x435149,_0x8b28('0xe'));logger[_0x8b28('0xf')](_0x8b28('0x10'),_0x435149,_0x8b28('0xe'),JSON['stringify'](_0x5e2be6));if(_0x5e2be6[_0x8b28('0x11')]){if(_0x5e2be6[_0x8b28('0x11')][_0x8b28('0x12')]===0x1f4){logger[_0x8b28('0x11')](_0x8b28('0xd'),_0x435149,_0x5e2be6['error'][_0x8b28('0x13')]);return _0x4c568c(_0x5e2be6[_0x8b28('0x11')][_0x8b28('0x13')]);}logger[_0x8b28('0x11')](_0x8b28('0xd'),_0x435149,_0x5e2be6[_0x8b28('0x11')][_0x8b28('0x13')]);return _0x5da1e6(_0x5e2be6[_0x8b28('0x11')]['message']);}else{logger['info'](_0x8b28('0xd'),_0x435149,_0x8b28('0xe'));_0x5da1e6(_0x5e2be6[_0x8b28('0x14')][_0x8b28('0x13')]);}})[_0x8b28('0x15')](function(_0x5bc637){logger[_0x8b28('0x11')]('Dynamics365Field,\x20%s,\x20%s',_0x435149,_0x5bc637);_0x4c568c(_0x5bc637);});});} \ No newline at end of file +var _0xdd51=['jayson/promise','client','http','request','then','request\x20sent','debug','stringify','error','code','Dynamics365Field,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x11ebd2,_0x57582b){var _0x57ba34=function(_0xeb5185){while(--_0xeb5185){_0x11ebd2['push'](_0x11ebd2['shift']());}};_0x57ba34(++_0x57582b);}(_0xdd51,0x1da));var _0x1dd5=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xdd51[_0x411add];return _0x238242;};'use strict';var _=require('lodash');var util=require(_0x1dd5('0x0'));var moment=require(_0x1dd5('0x1'));var BPromise=require(_0x1dd5('0x2'));var rs=require(_0x1dd5('0x3'));var fs=require('fs');var Redis=require(_0x1dd5('0x4'));var db=require(_0x1dd5('0x5'))['db'];var utils=require(_0x1dd5('0x6'));var logger=require('../../config/logger')(_0x1dd5('0x7'));var config=require(_0x1dd5('0x8'));var jayson=require(_0x1dd5('0x9'));var client=jayson[_0x1dd5('0xa')][_0x1dd5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x371cf0,_0xbd1510,_0x2c5d48){return new BPromise(function(_0x4996ef,_0x140300){return client[_0x1dd5('0xc')](_0x371cf0,_0x2c5d48)[_0x1dd5('0xd')](function(_0x18cf29){logger['info']('Dynamics365Field,\x20%s,\x20%s',_0xbd1510,_0x1dd5('0xe'));logger[_0x1dd5('0xf')]('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0xbd1510,_0x1dd5('0xe'),JSON[_0x1dd5('0x10')](_0x18cf29));if(_0x18cf29[_0x1dd5('0x11')]){if(_0x18cf29[_0x1dd5('0x11')][_0x1dd5('0x12')]===0x1f4){logger[_0x1dd5('0x11')](_0x1dd5('0x13'),_0xbd1510,_0x18cf29['error']['message']);return _0x140300(_0x18cf29[_0x1dd5('0x11')][_0x1dd5('0x14')]);}logger[_0x1dd5('0x11')]('Dynamics365Field,\x20%s,\x20%s',_0xbd1510,_0x18cf29[_0x1dd5('0x11')]['message']);return _0x4996ef(_0x18cf29[_0x1dd5('0x11')][_0x1dd5('0x14')]);}else{logger['info'](_0x1dd5('0x13'),_0xbd1510,_0x1dd5('0xe'));_0x4996ef(_0x18cf29[_0x1dd5('0x15')]['message']);}})[_0x1dd5('0x16')](function(_0x48ec81){logger[_0x1dd5('0x11')](_0x1dd5('0x13'),_0xbd1510,_0x48ec81);_0x140300(_0x48ec81);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 6c6f882..2e0211b 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 _0x913a=['util','path','connect-timeout','Router','fs-extra','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','show','/:id/fields','getFields','create','/:id/configurations','addConfiguration','update','delete','/:id','exports','multer'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x913a,0xc7));var _0xa913=function(_0x8c0e2e,_0x2bed49){_0x8c0e2e=_0x8c0e2e-0x0;var _0x428e94=_0x913a[_0x8c0e2e];return _0x428e94;};'use strict';var multer=require(_0xa913('0x0'));var util=require(_0xa913('0x1'));var path=require(_0xa913('0x2'));var timeout=require(_0xa913('0x3'));var express=require('express');var router=express[_0xa913('0x4')]();var fs_extra=require(_0xa913('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa913('0x6'));var controller=require(_0xa913('0x7'));router[_0xa913('0x8')]('/',auth[_0xa913('0x9')](),controller['index']);router[_0xa913('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xa913('0xa')]);router[_0xa913('0x8')]('/:id/configurations',auth[_0xa913('0x9')](),controller['getConfigurations']);router['get'](_0xa913('0xb'),auth['isAuthenticated'](),controller[_0xa913('0xc')]);router['post']('/',auth[_0xa913('0x9')](),controller[_0xa913('0xd')]);router['post'](_0xa913('0xe'),auth['isAuthenticated'](),controller[_0xa913('0xf')]);router['put']('/:id',auth[_0xa913('0x9')](),controller[_0xa913('0x10')]);router[_0xa913('0x11')](_0xa913('0x12'),auth[_0xa913('0x9')](),controller['destroy']);module[_0xa913('0x13')]=router; \ No newline at end of file +var _0x22b7=['get','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','isAuthenticated','index','/:id'];(function(_0x3e6d5d,_0x264c7a){var _0x238923=function(_0x201b19){while(--_0x201b19){_0x3e6d5d['push'](_0x3e6d5d['shift']());}};_0x238923(++_0x264c7a);}(_0x22b7,0xd0));var _0x722b=function(_0x2db055,_0x5bde11){_0x2db055=_0x2db055-0x0;var _0xb2f3a4=_0x22b7[_0x2db055];return _0xb2f3a4;};'use strict';var multer=require(_0x722b('0x0'));var util=require(_0x722b('0x1'));var path=require('path');var timeout=require(_0x722b('0x2'));var express=require(_0x722b('0x3'));var router=express[_0x722b('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x722b('0x5'));var interaction=require(_0x722b('0x6'));var config=require(_0x722b('0x7'));var controller=require(_0x722b('0x8'));router['get']('/',auth[_0x722b('0x9')](),controller[_0x722b('0xa')]);router['get'](_0x722b('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x722b('0xc')](_0x722b('0xd'),auth[_0x722b('0x9')](),controller[_0x722b('0xe')]);router[_0x722b('0xc')](_0x722b('0xf'),auth[_0x722b('0x9')](),controller[_0x722b('0x10')]);router[_0x722b('0x11')]('/',auth[_0x722b('0x9')](),controller[_0x722b('0x12')]);router[_0x722b('0x11')](_0x722b('0xd'),auth['isAuthenticated'](),controller[_0x722b('0x13')]);router['put'](_0x722b('0xb'),auth[_0x722b('0x9')](),controller['update']);router['delete'](_0x722b('0xb'),auth[_0x722b('0x9')](),controller[_0x722b('0x14')]);module[_0x722b('0x15')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 714417a..8d19a6e 100644 --- a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js +++ b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['STRING','username','remoteUri','sequelize'];(function(_0x32de4c,_0x33a4f6){var _0x866b67=function(_0x52b46e){while(--_0x52b46e){_0x32de4c['push'](_0x32de4c['shift']());}};_0x866b67(++_0x33a4f6);}(_0x0b0e,0x187));var _0xe0b0=function(_0x40b2ed,_0x2b1765){_0x40b2ed=_0x40b2ed-0x0;var _0x18397d=_0x0b0e[_0x40b2ed];return _0x18397d;};'use strict';var Sequelize=require(_0xe0b0('0x0'));module['exports']={'name':{'type':Sequelize[_0xe0b0('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xe0b0('0x1')],'unique':_0xe0b0('0x2')},'apiKey':{'type':Sequelize[_0xe0b0('0x1')]},'remoteUri':{'type':Sequelize[_0xe0b0('0x1')],'unique':_0xe0b0('0x3')},'serverUrl':{'type':Sequelize[_0xe0b0('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xda2d=['exports','STRING','username'];(function(_0x5a16d4,_0x59f79a){var _0xf55351=function(_0x47c99d){while(--_0x47c99d){_0x5a16d4['push'](_0x5a16d4['shift']());}};_0xf55351(++_0x59f79a);}(_0xda2d,0x102));var _0xdda2=function(_0x2feb4f,_0x413102){_0x2feb4f=_0x2feb4f-0x0;var _0x2f1ec8=_0xda2d[_0x2feb4f];return _0x2f1ec8;};'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 ec4b242..9d5e3c1 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 _0xe5fb=['json','offset','undefined','set','Content-Range','reject','save','update','destroy','then','error','stack','name','send','index','map','FreshdeskAccount','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','count','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','getConfigurations','findOne','FreshdeskConfiguration','merge','options','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshdeskField','getFields','remoteUri','apiKey','slice','lastIndexOf','%s/%s','api/v2/ticket_fields','format','Basic\x20%s','toString','requester','subject','description','priority','group','remove','includes','default','custom_text','custom_dropdown','label','choices','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end'];(function(_0x3639ca,_0x13f27b){var _0x11e409=function(_0xa27dea){while(--_0xa27dea){_0x3639ca['push'](_0x3639ca['shift']());}};_0x11e409(++_0x13f27b);}(_0xe5fb,0xce));var _0xbe5f=function(_0x163742,_0x467e36){_0x163742=_0x163742-0x0;var _0x1152ac=_0xe5fb[_0x163742];return _0x1152ac;};'use strict';var emlformat=require(_0xbe5f('0x0'));var rimraf=require(_0xbe5f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbe5f('0x2'));var rp=require(_0xbe5f('0x3'));var moment=require(_0xbe5f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xbe5f('0x5'));var util=require(_0xbe5f('0x6'));var path=require(_0xbe5f('0x7'));var sox=require(_0xbe5f('0x8'));var csv=require(_0xbe5f('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbe5f('0xa'));var _=require(_0xbe5f('0xb'));var squel=require(_0xbe5f('0xc'));var crypto=require(_0xbe5f('0xd'));var jsforce=require(_0xbe5f('0xe'));var deskjs=require(_0xbe5f('0xf'));var toCsv=require('to-csv');var querystring=require(_0xbe5f('0x10'));var Papa=require(_0xbe5f('0x11'));var Redis=require(_0xbe5f('0x12'));var authService=require(_0xbe5f('0x13'));var qs=require(_0xbe5f('0x14'));var as=require(_0xbe5f('0x15'));var hardwareService=require(_0xbe5f('0x16'));var logger=require(_0xbe5f('0x17'))(_0xbe5f('0x18'));var utils=require(_0xbe5f('0x19'));var config=require(_0xbe5f('0x1a'));var licenseUtil=require(_0xbe5f('0x1b'));var db=require('../../mysqldb')['db'];var integrations=require(_0xbe5f('0x1c'));function respondWithStatusCode(_0x227ef6,_0x454a41){_0x454a41=_0x454a41||0xcc;return function(_0x5880c3){if(_0x5880c3){return _0x227ef6[_0xbe5f('0x1d')](_0x454a41);}return _0x227ef6[_0xbe5f('0x1e')](_0x454a41)[_0xbe5f('0x1f')]();};}function respondWithResult(_0x19d245,_0x3b753f){_0x3b753f=_0x3b753f||0xc8;return function(_0x5e2862){if(_0x5e2862){return _0x19d245[_0xbe5f('0x1e')](_0x3b753f)[_0xbe5f('0x20')](_0x5e2862);}};}function respondWithFilteredResult(_0x159fa3,_0x77698b){return function(_0x1b8825){if(_0x1b8825){var _0x345f65=typeof _0x77698b[_0xbe5f('0x21')]===_0xbe5f('0x22')&&typeof _0x77698b['limit']==='undefined';var _0x550702=_0x1b8825['count'];var _0x9b274e=_0x345f65?0x0:_0x77698b[_0xbe5f('0x21')];var _0x30f6d2=_0x345f65?_0x1b8825['count']:_0x77698b['offset']+_0x77698b['limit'];var _0x5d8d6c;if(_0x30f6d2>=_0x550702){_0x30f6d2=_0x550702;_0x5d8d6c=0xc8;}else{_0x5d8d6c=0xce;}_0x159fa3[_0xbe5f('0x1e')](_0x5d8d6c);return _0x159fa3[_0xbe5f('0x23')](_0xbe5f('0x24'),_0x9b274e+'-'+_0x30f6d2+'/'+_0x550702)[_0xbe5f('0x20')](_0x1b8825);}return null;};}function patchUpdates(_0x2c6c52){return function(_0x436cd2){try{jsonpatch['apply'](_0x436cd2,_0x2c6c52,!![]);}catch(_0x100b62){return BPromise[_0xbe5f('0x25')](_0x100b62);}return _0x436cd2[_0xbe5f('0x26')]();};}function saveUpdates(_0x306974,_0x1bfed4){return function(_0x3dccd1){if(_0x3dccd1){return _0x3dccd1[_0xbe5f('0x27')](_0x306974)['then'](function(_0x21cfdd){return _0x21cfdd;});}return null;};}function removeEntity(_0x1ab547,_0x4832a7){return function(_0x37b5a9){if(_0x37b5a9){return _0x37b5a9[_0xbe5f('0x28')]()[_0xbe5f('0x29')](function(){_0x1ab547[_0xbe5f('0x1e')](0xcc)[_0xbe5f('0x1f')]();});}};}function handleEntityNotFound(_0x30e1d5,_0x2d4e89){return function(_0x5326a5){if(!_0x5326a5){_0x30e1d5['sendStatus'](0x194);}return _0x5326a5;};}function handleError(_0x5e85f7,_0x55e7c5){_0x55e7c5=_0x55e7c5||0x1f4;return function(_0x11946e){logger[_0xbe5f('0x2a')](_0x11946e[_0xbe5f('0x2b')]);if(_0x11946e[_0xbe5f('0x2c')]){delete _0x11946e[_0xbe5f('0x2c')];}_0x5e85f7[_0xbe5f('0x1e')](_0x55e7c5)[_0xbe5f('0x2d')](_0x11946e);};}exports[_0xbe5f('0x2e')]=function(_0x1f3451,_0x52ff44){var _0xfe0ddc={},_0x443bdb={},_0x12cd38={'count':0x0,'rows':[]};var _0x3a4fd1=_[_0xbe5f('0x2f')](db[_0xbe5f('0x30')][_0xbe5f('0x31')],function(_0x366ae1){return{'name':_0x366ae1[_0xbe5f('0x32')],'type':_0x366ae1[_0xbe5f('0x33')][_0xbe5f('0x34')]};});_0x443bdb[_0xbe5f('0x35')]=_[_0xbe5f('0x2f')](_0x3a4fd1,_0xbe5f('0x2c'));_0x443bdb[_0xbe5f('0x36')]=_['keys'](_0x1f3451['query']);_0x443bdb[_0xbe5f('0x37')]=_[_0xbe5f('0x38')](_0x443bdb[_0xbe5f('0x35')],_0x443bdb[_0xbe5f('0x36')]);_0xfe0ddc[_0xbe5f('0x39')]=_[_0xbe5f('0x38')](_0x443bdb[_0xbe5f('0x35')],qs[_0xbe5f('0x3a')](_0x1f3451[_0xbe5f('0x36')][_0xbe5f('0x3a')]));_0xfe0ddc[_0xbe5f('0x39')]=_0xfe0ddc['attributes'][_0xbe5f('0x3b')]?_0xfe0ddc['attributes']:_0x443bdb[_0xbe5f('0x35')];if(!_0x1f3451[_0xbe5f('0x36')][_0xbe5f('0x3c')](_0xbe5f('0x3d'))){_0xfe0ddc[_0xbe5f('0x3e')]=qs[_0xbe5f('0x3e')](_0x1f3451[_0xbe5f('0x36')][_0xbe5f('0x3e')]);_0xfe0ddc[_0xbe5f('0x21')]=qs[_0xbe5f('0x21')](_0x1f3451['query'][_0xbe5f('0x21')]);}_0xfe0ddc[_0xbe5f('0x3f')]=qs[_0xbe5f('0x40')](_0x1f3451[_0xbe5f('0x36')][_0xbe5f('0x40')]);_0xfe0ddc[_0xbe5f('0x41')]=qs['filters'](_[_0xbe5f('0x42')](_0x1f3451[_0xbe5f('0x36')],_0x443bdb['filters']),_0x3a4fd1);if(_0x1f3451[_0xbe5f('0x36')][_0xbe5f('0x43')]){_0xfe0ddc['where']=_['merge'](_0xfe0ddc['where'],{'$or':_[_0xbe5f('0x2f')](_0x3a4fd1,function(_0x9ff166){if(_0x9ff166['type']!=='VIRTUAL'){var _0x5f4760={};_0x5f4760[_0x9ff166[_0xbe5f('0x2c')]]={'$like':'%'+_0x1f3451['query'][_0xbe5f('0x43')]+'%'};return _0x5f4760;}})});}_0xfe0ddc=_['merge']({},_0xfe0ddc,_0x1f3451['options']);var _0x40e9a4={'where':_0xfe0ddc[_0xbe5f('0x41')]};return db[_0xbe5f('0x30')][_0xbe5f('0x44')](_0x40e9a4)['then'](function(_0x552997){_0x12cd38['count']=_0x552997;if(_0x1f3451[_0xbe5f('0x36')][_0xbe5f('0x45')]){_0xfe0ddc[_0xbe5f('0x46')]=[{'all':!![]}];}return db[_0xbe5f('0x30')][_0xbe5f('0x47')](_0xfe0ddc);})['then'](function(_0x54102b){_0x12cd38[_0xbe5f('0x48')]=_0x54102b;return _0x12cd38;})[_0xbe5f('0x29')](respondWithFilteredResult(_0x52ff44,_0xfe0ddc))[_0xbe5f('0x49')](handleError(_0x52ff44,null));};exports[_0xbe5f('0x4a')]=function(_0x2e1959,_0x33c554){var _0x2f665d={'raw':![],'where':{'id':_0x2e1959[_0xbe5f('0x4b')]['id']}},_0x1b5e26={};_0x1b5e26[_0xbe5f('0x35')]=_['keys'](db[_0xbe5f('0x30')][_0xbe5f('0x31')]);_0x1b5e26[_0xbe5f('0x36')]=_[_0xbe5f('0x4c')](_0x2e1959[_0xbe5f('0x36')]);_0x1b5e26[_0xbe5f('0x37')]=_[_0xbe5f('0x38')](_0x1b5e26[_0xbe5f('0x35')],_0x1b5e26['query']);_0x2f665d[_0xbe5f('0x39')]=_['intersection'](_0x1b5e26[_0xbe5f('0x35')],qs[_0xbe5f('0x3a')](_0x2e1959[_0xbe5f('0x36')][_0xbe5f('0x3a')]));_0x2f665d[_0xbe5f('0x39')]=_0x2f665d['attributes'][_0xbe5f('0x3b')]?_0x2f665d[_0xbe5f('0x39')]:_0x1b5e26['model'];if(_0x2e1959[_0xbe5f('0x36')][_0xbe5f('0x45')]){_0x2f665d[_0xbe5f('0x46')]=[{'all':!![]}];}_0x2f665d=_['merge']({},_0x2f665d,_0x2e1959['options']);return db[_0xbe5f('0x30')][_0xbe5f('0x4d')](_0x2f665d)[_0xbe5f('0x29')](handleEntityNotFound(_0x33c554,null))[_0xbe5f('0x29')](respondWithResult(_0x33c554,null))[_0xbe5f('0x49')](handleError(_0x33c554,null));};exports[_0xbe5f('0x4e')]=function(_0x47bae0,_0x53a0ab){return db[_0xbe5f('0x30')][_0xbe5f('0x4e')](_0x47bae0['body'],{})[_0xbe5f('0x29')](respondWithResult(_0x53a0ab,0xc9))[_0xbe5f('0x49')](handleError(_0x53a0ab,null));};exports[_0xbe5f('0x27')]=function(_0x674bdd,_0x56c2e7){if(_0x674bdd[_0xbe5f('0x4f')]['id']){delete _0x674bdd[_0xbe5f('0x4f')]['id'];}return db[_0xbe5f('0x30')][_0xbe5f('0x4d')]({'where':{'id':_0x674bdd[_0xbe5f('0x4b')]['id']}})[_0xbe5f('0x29')](handleEntityNotFound(_0x56c2e7,null))['then'](saveUpdates(_0x674bdd['body'],null))[_0xbe5f('0x29')](respondWithResult(_0x56c2e7,null))[_0xbe5f('0x49')](handleError(_0x56c2e7,null));};exports[_0xbe5f('0x28')]=function(_0x343f5a,_0x2768f8){return db[_0xbe5f('0x30')][_0xbe5f('0x4d')]({'where':{'id':_0x343f5a[_0xbe5f('0x4b')]['id']}})[_0xbe5f('0x29')](handleEntityNotFound(_0x2768f8,null))[_0xbe5f('0x29')](removeEntity(_0x2768f8,null))['catch'](handleError(_0x2768f8,null));};exports[_0xbe5f('0x50')]=function(_0x2fa072,_0xc88e05,_0x1537f0){var _0x1790fb={};var _0xc603a9={};var _0x48dcec;var _0x3aefce;return db[_0xbe5f('0x30')][_0xbe5f('0x51')]({'where':{'id':_0x2fa072[_0xbe5f('0x4b')]['id']}})[_0xbe5f('0x29')](handleEntityNotFound(_0xc88e05,null))[_0xbe5f('0x29')](function(_0x140096){if(_0x140096){_0x48dcec=_0x140096;_0xc603a9[_0xbe5f('0x35')]=_[_0xbe5f('0x4c')](db[_0xbe5f('0x52')][_0xbe5f('0x31')]);_0xc603a9[_0xbe5f('0x36')]=_[_0xbe5f('0x4c')](_0x2fa072[_0xbe5f('0x36')]);_0xc603a9[_0xbe5f('0x37')]=_[_0xbe5f('0x38')](_0xc603a9[_0xbe5f('0x35')],_0xc603a9[_0xbe5f('0x36')]);_0x1790fb[_0xbe5f('0x39')]=_[_0xbe5f('0x38')](_0xc603a9[_0xbe5f('0x35')],qs[_0xbe5f('0x3a')](_0x2fa072['query'][_0xbe5f('0x3a')]));_0x1790fb[_0xbe5f('0x39')]=_0x1790fb[_0xbe5f('0x39')][_0xbe5f('0x3b')]?_0x1790fb['attributes']:_0xc603a9[_0xbe5f('0x35')];_0x1790fb[_0xbe5f('0x3f')]=qs[_0xbe5f('0x40')](_0x2fa072[_0xbe5f('0x36')][_0xbe5f('0x40')]);_0x1790fb[_0xbe5f('0x41')]=qs[_0xbe5f('0x37')](_[_0xbe5f('0x42')](_0x2fa072[_0xbe5f('0x36')],_0xc603a9['filters']));if(_0x2fa072[_0xbe5f('0x36')][_0xbe5f('0x43')]){_0x1790fb[_0xbe5f('0x41')]=_[_0xbe5f('0x53')](_0x1790fb[_0xbe5f('0x41')],{'$or':_[_0xbe5f('0x2f')](_0x1790fb['attributes'],function(_0x339fa6){var _0x2e3b99={};_0x2e3b99[_0x339fa6]={'$like':'%'+_0x2fa072[_0xbe5f('0x36')][_0xbe5f('0x43')]+'%'};return _0x2e3b99;})});}_0x1790fb=_[_0xbe5f('0x53')]({},_0x1790fb,_0x2fa072[_0xbe5f('0x54')]);return _0x48dcec['getConfigurations'](_0x1790fb);}})['then'](function(_0x279129){if(_0x279129){_0x3aefce=_0x279129[_0xbe5f('0x3b')];if(!_0x2fa072['query']['hasOwnProperty']('nolimit')){_0x1790fb['limit']=qs['limit'](_0x2fa072[_0xbe5f('0x36')][_0xbe5f('0x3e')]);_0x1790fb['offset']=qs[_0xbe5f('0x21')](_0x2fa072[_0xbe5f('0x36')][_0xbe5f('0x21')]);}return _0x48dcec[_0xbe5f('0x50')](_0x1790fb);}})[_0xbe5f('0x29')](function(_0x249a9a){if(_0x249a9a){return _0x249a9a?{'count':_0x3aefce,'rows':_0x249a9a}:null;}})[_0xbe5f('0x29')](respondWithResult(_0xc88e05,null))[_0xbe5f('0x49')](handleError(_0xc88e05,null));};exports['addConfiguration']=function(_0xbfd242,_0xe2a752,_0x4594c1){if(_0xbfd242[_0xbe5f('0x4f')]['id']){delete _0xbfd242[_0xbe5f('0x4f')]['id'];}return db[_0xbe5f('0x30')][_0xbe5f('0x51')]({'where':{'id':_0xbfd242['params']['id']}})[_0xbe5f('0x29')](handleEntityNotFound(_0xe2a752,null))[_0xbe5f('0x29')](function(_0x31a237){if(_0x31a237){_0xbfd242[_0xbe5f('0x4f')][_0xbe5f('0x55')]=_0x31a237['id'];_0xbfd242['body'][_0xbe5f('0x56')]=integrations[_0xbe5f('0x57')](_0xbfd242[_0xbe5f('0x4f')][_0xbe5f('0x58')],_0xbfd242[_0xbe5f('0x4f')][_0xbe5f('0x33')]);_0xbfd242['body'][_0xbe5f('0x59')]=integrations[_0xbe5f('0x5a')](_0xbfd242[_0xbe5f('0x4f')][_0xbe5f('0x58')],_0xbfd242[_0xbe5f('0x4f')][_0xbe5f('0x33')]);return db[_0xbe5f('0x52')][_0xbe5f('0x4e')](_0xbfd242[_0xbe5f('0x4f')],{'include':[{'model':db['FreshdeskField'],'as':_0xbe5f('0x56')},{'model':db[_0xbe5f('0x5b')],'as':_0xbe5f('0x59')}]});}return null;})[_0xbe5f('0x29')](respondWithResult(_0xe2a752,null))[_0xbe5f('0x49')](handleError(_0xe2a752,null));};exports[_0xbe5f('0x5c')]=function(_0x54956c,_0x2d184e,_0x3a122a){var _0x586aa8='';return db[_0xbe5f('0x30')][_0xbe5f('0x51')]({'where':{'id':_0x54956c[_0xbe5f('0x4b')]['id']},'attributes':['id',_0xbe5f('0x5d'),_0xbe5f('0x5e')]})[_0xbe5f('0x29')](handleEntityNotFound(_0x2d184e,null))[_0xbe5f('0x29')](function(_0x37bc2e){if(_0x37bc2e){_0x586aa8=_0x37bc2e[_0xbe5f('0x5d')];var _0x3852fe=_0x586aa8[_0xbe5f('0x5f')](-0x1);if(_0x3852fe==='/'){_0x586aa8=_0x586aa8['substring'](0x0,_0x586aa8[_0xbe5f('0x60')](_0x3852fe));}return rp({'method':'GET','uri':util['format'](_0xbe5f('0x61'),_0x586aa8,_0xbe5f('0x62')),'headers':{'Authorization':util[_0xbe5f('0x63')](_0xbe5f('0x64'),new Buffer(util['format']('%s:X',_0x37bc2e[_0xbe5f('0x5e')]))[_0xbe5f('0x65')]('base64'))},'json':!![]});}})['then'](function(_0x21b256){if(_0x21b256){var _0x1a94b1=[_0xbe5f('0x66'),_0xbe5f('0x67'),'agent',_0xbe5f('0x68'),_0xbe5f('0x1e'),_0xbe5f('0x69'),'group','source','ticket_type',_0xbe5f('0x6a'),'company'];_[_0xbe5f('0x6b')](_0x21b256,function(_0xa2816){return _0x1a94b1[_0xbe5f('0x6c')](_0xa2816[_0xbe5f('0x2c')])||!_0xa2816[_0xbe5f('0x6d')]&&_0xa2816['type']!==_0xbe5f('0x6e')&&_0xa2816[_0xbe5f('0x33')]!==_0xbe5f('0x6f');});return{'count':_0x21b256[_0xbe5f('0x3b')],'rows':_[_0xbe5f('0x2f')](_0x21b256,function(_0x21f1d8){return{'id':_0x21f1d8['name'],'name':_0x21f1d8[_0xbe5f('0x70')],'custom':!_0x21f1d8[_0xbe5f('0x6d')],'options':_0x21f1d8[_0xbe5f('0x71')]?_[_0xbe5f('0x2f')](_0x21f1d8[_0xbe5f('0x71')],function(_0x4d294e){return{'name':_['capitalize'](_0x4d294e),'value':_0x4d294e};}):[]};})};}})[_0xbe5f('0x29')](respondWithResult(_0x2d184e,null))[_0xbe5f('0x49')](function(_0x59fd19){var _0x24d21d=_0x54956c[_0xbe5f('0x36')][_0xbe5f('0x72')]?0x1f4:_0x59fd19[_0xbe5f('0x73')]||0x1f4;logger[_0xbe5f('0x2a')](_0xbe5f('0x74'),'getFields',_0x24d21d,JSON[_0xbe5f('0x75')](_0x59fd19));delete _0x59fd19[_0xbe5f('0x2c')];if(_0x24d21d===0x191){_0x24d21d=0x190;}_0x2d184e[_0xbe5f('0x1e')](_0x24d21d)[_0xbe5f('0x2d')](_0x54956c['query']['test']?{'message':_0xbe5f('0x76'),'statusCode':_0x59fd19[_0xbe5f('0x73')]}:_0x59fd19);});}; \ No newline at end of file +var _0x0901=['limit','count','set','apply','reject','save','then','error','name','send','index','map','FreshdeskAccount','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','update','body','destroy','getConfigurations','length','order','addConfiguration','findOne','AccountId','Subjects','channel','getDescriptions','FreshdeskConfiguration','FreshdeskField','Descriptions','getFields','apiKey','remoteUri','slice','substring','lastIndexOf','%s/%s','api/v2/ticket_fields','format','%s:X','base64','requester','agent','description','group','source','ticket_type','company','default','custom_text','custom_dropdown','label','choices','capitalize','statusCode','getFields,\x20%s,\x20%s,\x20%s','test','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','undefined'];(function(_0x5b27da,_0x4a6532){var _0x3254f4=function(_0x4194c6){while(--_0x4194c6){_0x5b27da['push'](_0x5b27da['shift']());}};_0x3254f4(++_0x4a6532);}(_0x0901,0x134));var _0x1090=function(_0x5d2042,_0x6bd091){_0x5d2042=_0x5d2042-0x0;var _0x41be99=_0x0901[_0x5d2042];return _0x41be99;};'use strict';var emlformat=require(_0x1090('0x0'));var rimraf=require(_0x1090('0x1'));var zipdir=require(_0x1090('0x2'));var jsonpatch=require(_0x1090('0x3'));var rp=require(_0x1090('0x4'));var moment=require(_0x1090('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1090('0x6'));var path=require(_0x1090('0x7'));var sox=require(_0x1090('0x8'));var csv=require(_0x1090('0x9'));var ejs=require(_0x1090('0xa'));var fs=require('fs');var fs_extra=require(_0x1090('0xb'));var _=require('lodash');var squel=require(_0x1090('0xc'));var crypto=require(_0x1090('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x1090('0xe'));var toCsv=require(_0x1090('0x9'));var querystring=require(_0x1090('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x1090('0x10'));var as=require(_0x1090('0x11'));var hardwareService=require(_0x1090('0x12'));var logger=require('../../config/logger')(_0x1090('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x1090('0x14'));var db=require(_0x1090('0x15'))['db'];var integrations=require(_0x1090('0x16'));function respondWithStatusCode(_0x2c0afa,_0x4250c6){_0x4250c6=_0x4250c6||0xcc;return function(_0x793497){if(_0x793497){return _0x2c0afa[_0x1090('0x17')](_0x4250c6);}return _0x2c0afa[_0x1090('0x18')](_0x4250c6)[_0x1090('0x19')]();};}function respondWithResult(_0x897055,_0x477a41){_0x477a41=_0x477a41||0xc8;return function(_0x43317a){if(_0x43317a){return _0x897055[_0x1090('0x18')](_0x477a41)['json'](_0x43317a);}};}function respondWithFilteredResult(_0x465cbd,_0x28a09a){return function(_0x14e6dc){if(_0x14e6dc){var _0x56d312=typeof _0x28a09a[_0x1090('0x1a')]===_0x1090('0x1b')&&typeof _0x28a09a[_0x1090('0x1c')]===_0x1090('0x1b');var _0x365975=_0x14e6dc['count'];var _0x3db4bb=_0x56d312?0x0:_0x28a09a[_0x1090('0x1a')];var _0xf77749=_0x56d312?_0x14e6dc[_0x1090('0x1d')]:_0x28a09a[_0x1090('0x1a')]+_0x28a09a[_0x1090('0x1c')];var _0x3ed180;if(_0xf77749>=_0x365975){_0xf77749=_0x365975;_0x3ed180=0xc8;}else{_0x3ed180=0xce;}_0x465cbd[_0x1090('0x18')](_0x3ed180);return _0x465cbd[_0x1090('0x1e')]('Content-Range',_0x3db4bb+'-'+_0xf77749+'/'+_0x365975)['json'](_0x14e6dc);}return null;};}function patchUpdates(_0x8df216){return function(_0x51514c){try{jsonpatch[_0x1090('0x1f')](_0x51514c,_0x8df216,!![]);}catch(_0x28502a){return BPromise[_0x1090('0x20')](_0x28502a);}return _0x51514c[_0x1090('0x21')]();};}function saveUpdates(_0x211b39,_0x29633c){return function(_0x2f04da){if(_0x2f04da){return _0x2f04da['update'](_0x211b39)['then'](function(_0x4c7434){return _0x4c7434;});}return null;};}function removeEntity(_0x48b5c0,_0x4d187a){return function(_0x53d6c1){if(_0x53d6c1){return _0x53d6c1['destroy']()[_0x1090('0x22')](function(){_0x48b5c0[_0x1090('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3face7,_0x50267d){return function(_0x12ee12){if(!_0x12ee12){_0x3face7[_0x1090('0x17')](0x194);}return _0x12ee12;};}function handleError(_0x3a2123,_0x5e2859){_0x5e2859=_0x5e2859||0x1f4;return function(_0x5d0e70){logger[_0x1090('0x23')](_0x5d0e70['stack']);if(_0x5d0e70[_0x1090('0x24')]){delete _0x5d0e70['name'];}_0x3a2123[_0x1090('0x18')](_0x5e2859)[_0x1090('0x25')](_0x5d0e70);};}exports[_0x1090('0x26')]=function(_0x3b7f54,_0x257645){var _0x5bd6ab={},_0x23f8a2={},_0x19fcdb={'count':0x0,'rows':[]};var _0x1d6d1e=_[_0x1090('0x27')](db[_0x1090('0x28')][_0x1090('0x29')],function(_0x312e27){return{'name':_0x312e27[_0x1090('0x2a')],'type':_0x312e27[_0x1090('0x2b')][_0x1090('0x2c')]};});_0x23f8a2['model']=_['map'](_0x1d6d1e,_0x1090('0x24'));_0x23f8a2[_0x1090('0x2d')]=_[_0x1090('0x2e')](_0x3b7f54['query']);_0x23f8a2[_0x1090('0x2f')]=_[_0x1090('0x30')](_0x23f8a2[_0x1090('0x31')],_0x23f8a2[_0x1090('0x2d')]);_0x5bd6ab[_0x1090('0x32')]=_['intersection'](_0x23f8a2[_0x1090('0x31')],qs[_0x1090('0x33')](_0x3b7f54[_0x1090('0x2d')][_0x1090('0x33')]));_0x5bd6ab[_0x1090('0x32')]=_0x5bd6ab[_0x1090('0x32')]['length']?_0x5bd6ab[_0x1090('0x32')]:_0x23f8a2['model'];if(!_0x3b7f54[_0x1090('0x2d')][_0x1090('0x34')](_0x1090('0x35'))){_0x5bd6ab[_0x1090('0x1c')]=qs['limit'](_0x3b7f54[_0x1090('0x2d')][_0x1090('0x1c')]);_0x5bd6ab[_0x1090('0x1a')]=qs['offset'](_0x3b7f54['query'][_0x1090('0x1a')]);}_0x5bd6ab['order']=qs[_0x1090('0x36')](_0x3b7f54['query'][_0x1090('0x36')]);_0x5bd6ab['where']=qs[_0x1090('0x2f')](_[_0x1090('0x37')](_0x3b7f54['query'],_0x23f8a2[_0x1090('0x2f')]),_0x1d6d1e);if(_0x3b7f54[_0x1090('0x2d')][_0x1090('0x38')]){_0x5bd6ab[_0x1090('0x39')]=_[_0x1090('0x3a')](_0x5bd6ab[_0x1090('0x39')],{'$or':_[_0x1090('0x27')](_0x1d6d1e,function(_0x3e96c1){if(_0x3e96c1[_0x1090('0x2b')]!==_0x1090('0x3b')){var _0x19d96b={};_0x19d96b[_0x3e96c1['name']]={'$like':'%'+_0x3b7f54[_0x1090('0x2d')][_0x1090('0x38')]+'%'};return _0x19d96b;}})});}_0x5bd6ab=_[_0x1090('0x3a')]({},_0x5bd6ab,_0x3b7f54[_0x1090('0x3c')]);var _0x21b0c8={'where':_0x5bd6ab[_0x1090('0x39')]};return db['FreshdeskAccount']['count'](_0x21b0c8)[_0x1090('0x22')](function(_0xb4323e){_0x19fcdb[_0x1090('0x1d')]=_0xb4323e;if(_0x3b7f54[_0x1090('0x2d')][_0x1090('0x3d')]){_0x5bd6ab[_0x1090('0x3e')]=[{'all':!![]}];}return db['FreshdeskAccount'][_0x1090('0x3f')](_0x5bd6ab);})[_0x1090('0x22')](function(_0x25de72){_0x19fcdb[_0x1090('0x40')]=_0x25de72;return _0x19fcdb;})[_0x1090('0x22')](respondWithFilteredResult(_0x257645,_0x5bd6ab))[_0x1090('0x41')](handleError(_0x257645,null));};exports[_0x1090('0x42')]=function(_0x1a7ef4,_0xe5273a){var _0x56876c={'raw':![],'where':{'id':_0x1a7ef4[_0x1090('0x43')]['id']}},_0x221720={};_0x221720['model']=_[_0x1090('0x2e')](db[_0x1090('0x28')][_0x1090('0x29')]);_0x221720[_0x1090('0x2d')]=_[_0x1090('0x2e')](_0x1a7ef4['query']);_0x221720[_0x1090('0x2f')]=_[_0x1090('0x30')](_0x221720[_0x1090('0x31')],_0x221720[_0x1090('0x2d')]);_0x56876c[_0x1090('0x32')]=_['intersection'](_0x221720[_0x1090('0x31')],qs[_0x1090('0x33')](_0x1a7ef4[_0x1090('0x2d')]['fields']));_0x56876c['attributes']=_0x56876c[_0x1090('0x32')]['length']?_0x56876c[_0x1090('0x32')]:_0x221720[_0x1090('0x31')];if(_0x1a7ef4[_0x1090('0x2d')]['includeAll']){_0x56876c['include']=[{'all':!![]}];}_0x56876c=_[_0x1090('0x3a')]({},_0x56876c,_0x1a7ef4[_0x1090('0x3c')]);return db['FreshdeskAccount'][_0x1090('0x44')](_0x56876c)[_0x1090('0x22')](handleEntityNotFound(_0xe5273a,null))['then'](respondWithResult(_0xe5273a,null))[_0x1090('0x41')](handleError(_0xe5273a,null));};exports[_0x1090('0x45')]=function(_0x38622e,_0x11d861){return db[_0x1090('0x28')]['create'](_0x38622e['body'],{})[_0x1090('0x22')](respondWithResult(_0x11d861,0xc9))['catch'](handleError(_0x11d861,null));};exports[_0x1090('0x46')]=function(_0x1e45a9,_0x8171eb){if(_0x1e45a9['body']['id']){delete _0x1e45a9[_0x1090('0x47')]['id'];}return db[_0x1090('0x28')][_0x1090('0x44')]({'where':{'id':_0x1e45a9[_0x1090('0x43')]['id']}})[_0x1090('0x22')](handleEntityNotFound(_0x8171eb,null))[_0x1090('0x22')](saveUpdates(_0x1e45a9[_0x1090('0x47')],null))[_0x1090('0x22')](respondWithResult(_0x8171eb,null))[_0x1090('0x41')](handleError(_0x8171eb,null));};exports[_0x1090('0x48')]=function(_0x36c2dd,_0x419b22){return db[_0x1090('0x28')][_0x1090('0x44')]({'where':{'id':_0x36c2dd['params']['id']}})[_0x1090('0x22')](handleEntityNotFound(_0x419b22,null))[_0x1090('0x22')](removeEntity(_0x419b22,null))['catch'](handleError(_0x419b22,null));};exports[_0x1090('0x49')]=function(_0x4d0b43,_0x1ab946,_0x1a94bd){var _0x4bb3e9={};var _0x30a7c7={};var _0xf82aa5;var _0x540e20;return db[_0x1090('0x28')]['findOne']({'where':{'id':_0x4d0b43['params']['id']}})[_0x1090('0x22')](handleEntityNotFound(_0x1ab946,null))[_0x1090('0x22')](function(_0x3187b9){if(_0x3187b9){_0xf82aa5=_0x3187b9;_0x30a7c7[_0x1090('0x31')]=_[_0x1090('0x2e')](db['FreshdeskConfiguration']['rawAttributes']);_0x30a7c7[_0x1090('0x2d')]=_[_0x1090('0x2e')](_0x4d0b43[_0x1090('0x2d')]);_0x30a7c7[_0x1090('0x2f')]=_['intersection'](_0x30a7c7['model'],_0x30a7c7[_0x1090('0x2d')]);_0x4bb3e9['attributes']=_['intersection'](_0x30a7c7[_0x1090('0x31')],qs[_0x1090('0x33')](_0x4d0b43[_0x1090('0x2d')][_0x1090('0x33')]));_0x4bb3e9[_0x1090('0x32')]=_0x4bb3e9[_0x1090('0x32')][_0x1090('0x4a')]?_0x4bb3e9[_0x1090('0x32')]:_0x30a7c7[_0x1090('0x31')];_0x4bb3e9[_0x1090('0x4b')]=qs[_0x1090('0x36')](_0x4d0b43[_0x1090('0x2d')]['sort']);_0x4bb3e9[_0x1090('0x39')]=qs[_0x1090('0x2f')](_[_0x1090('0x37')](_0x4d0b43[_0x1090('0x2d')],_0x30a7c7[_0x1090('0x2f')]));if(_0x4d0b43[_0x1090('0x2d')][_0x1090('0x38')]){_0x4bb3e9['where']=_[_0x1090('0x3a')](_0x4bb3e9[_0x1090('0x39')],{'$or':_[_0x1090('0x27')](_0x4bb3e9['attributes'],function(_0x16fa9f){var _0x30b912={};_0x30b912[_0x16fa9f]={'$like':'%'+_0x4d0b43[_0x1090('0x2d')][_0x1090('0x38')]+'%'};return _0x30b912;})});}_0x4bb3e9=_['merge']({},_0x4bb3e9,_0x4d0b43[_0x1090('0x3c')]);return _0xf82aa5[_0x1090('0x49')](_0x4bb3e9);}})['then'](function(_0xfd7c03){if(_0xfd7c03){_0x540e20=_0xfd7c03[_0x1090('0x4a')];if(!_0x4d0b43[_0x1090('0x2d')][_0x1090('0x34')](_0x1090('0x35'))){_0x4bb3e9[_0x1090('0x1c')]=qs[_0x1090('0x1c')](_0x4d0b43[_0x1090('0x2d')][_0x1090('0x1c')]);_0x4bb3e9[_0x1090('0x1a')]=qs[_0x1090('0x1a')](_0x4d0b43['query'][_0x1090('0x1a')]);}return _0xf82aa5[_0x1090('0x49')](_0x4bb3e9);}})[_0x1090('0x22')](function(_0x496cc0){if(_0x496cc0){return _0x496cc0?{'count':_0x540e20,'rows':_0x496cc0}:null;}})['then'](respondWithResult(_0x1ab946,null))[_0x1090('0x41')](handleError(_0x1ab946,null));};exports[_0x1090('0x4c')]=function(_0x31e628,_0x188d09,_0x3b9d9f){if(_0x31e628['body']['id']){delete _0x31e628[_0x1090('0x47')]['id'];}return db[_0x1090('0x28')][_0x1090('0x4d')]({'where':{'id':_0x31e628[_0x1090('0x43')]['id']}})[_0x1090('0x22')](handleEntityNotFound(_0x188d09,null))['then'](function(_0xc50fb7){if(_0xc50fb7){_0x31e628['body'][_0x1090('0x4e')]=_0xc50fb7['id'];_0x31e628[_0x1090('0x47')][_0x1090('0x4f')]=integrations['getSubjects'](_0x31e628['body'][_0x1090('0x50')],_0x31e628[_0x1090('0x47')]['type']);_0x31e628[_0x1090('0x47')]['Descriptions']=integrations[_0x1090('0x51')](_0x31e628[_0x1090('0x47')][_0x1090('0x50')],_0x31e628['body'][_0x1090('0x2b')]);return db[_0x1090('0x52')][_0x1090('0x45')](_0x31e628['body'],{'include':[{'model':db[_0x1090('0x53')],'as':_0x1090('0x4f')},{'model':db['FreshdeskField'],'as':_0x1090('0x54')}]});}return null;})[_0x1090('0x22')](respondWithResult(_0x188d09,null))['catch'](handleError(_0x188d09,null));};exports[_0x1090('0x55')]=function(_0x8f2332,_0x3b8060,_0x3ca0d4){var _0x54e6cb='';return db['FreshdeskAccount'][_0x1090('0x4d')]({'where':{'id':_0x8f2332[_0x1090('0x43')]['id']},'attributes':['id','remoteUri',_0x1090('0x56')]})[_0x1090('0x22')](handleEntityNotFound(_0x3b8060,null))['then'](function(_0x2abbd1){if(_0x2abbd1){_0x54e6cb=_0x2abbd1[_0x1090('0x57')];var _0x583e9c=_0x54e6cb[_0x1090('0x58')](-0x1);if(_0x583e9c==='/'){_0x54e6cb=_0x54e6cb[_0x1090('0x59')](0x0,_0x54e6cb[_0x1090('0x5a')](_0x583e9c));}return rp({'method':'GET','uri':util['format'](_0x1090('0x5b'),_0x54e6cb,_0x1090('0x5c')),'headers':{'Authorization':util[_0x1090('0x5d')]('Basic\x20%s',new Buffer(util[_0x1090('0x5d')](_0x1090('0x5e'),_0x2abbd1[_0x1090('0x56')]))['toString'](_0x1090('0x5f')))},'json':!![]});}})['then'](function(_0x565501){if(_0x565501){var _0x399adc=[_0x1090('0x60'),'subject',_0x1090('0x61'),_0x1090('0x62'),'status','priority',_0x1090('0x63'),_0x1090('0x64'),_0x1090('0x65'),_0x1090('0x63'),_0x1090('0x66')];_['remove'](_0x565501,function(_0x2073a4){return _0x399adc['includes'](_0x2073a4[_0x1090('0x24')])||!_0x2073a4[_0x1090('0x67')]&&_0x2073a4['type']!==_0x1090('0x68')&&_0x2073a4[_0x1090('0x2b')]!==_0x1090('0x69');});return{'count':_0x565501[_0x1090('0x4a')],'rows':_['map'](_0x565501,function(_0x20d013){return{'id':_0x20d013[_0x1090('0x24')],'name':_0x20d013[_0x1090('0x6a')],'custom':!_0x20d013[_0x1090('0x67')],'options':_0x20d013[_0x1090('0x6b')]?_[_0x1090('0x27')](_0x20d013[_0x1090('0x6b')],function(_0x119ebb){return{'name':_[_0x1090('0x6c')](_0x119ebb),'value':_0x119ebb};}):[]};})};}})[_0x1090('0x22')](respondWithResult(_0x3b8060,null))[_0x1090('0x41')](function(_0x24e4ea){var _0x39f0e0=_0x8f2332['query']['test']?0x1f4:_0x24e4ea[_0x1090('0x6d')]||0x1f4;logger['error'](_0x1090('0x6e'),_0x1090('0x55'),_0x39f0e0,JSON['stringify'](_0x24e4ea));delete _0x24e4ea[_0x1090('0x24')];if(_0x39f0e0===0x191){_0x39f0e0=0x190;}_0x3b8060[_0x1090('0x18')](_0x39f0e0)['send'](_0x8f2332[_0x1090('0x2d')][_0x1090('0x6f')]?{'message':'Wrong\x20credentials','statusCode':_0x24e4ea[_0x1090('0x6d')]}:_0x24e4ea);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 5328a25..137179b 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 _0x3b5b=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','define','FreshdeskAccount','int_freshdesk_accounts'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3b5b,0x6e));var _0xb3b5=function(_0x21c2c8,_0x44257e){_0x21c2c8=_0x21c2c8-0x0;var _0x4dd745=_0x3b5b[_0x21c2c8];return _0x4dd745;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb3b5('0x0'))('api');var moment=require(_0xb3b5('0x1'));var BPromise=require(_0xb3b5('0x2'));var rp=require(_0xb3b5('0x3'));var fs=require('fs');var path=require(_0xb3b5('0x4'));var rimraf=require(_0xb3b5('0x5'));var config=require(_0xb3b5('0x6'));var attributes=require(_0xb3b5('0x7'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0xbf81c4,_0x49a4f0){return _0xbf81c4[_0xb3b5('0x8')](_0xb3b5('0x9'),attributes,{'tableName':_0xb3b5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x668a=['moment','path','rimraf','../../components/integrations/configuration','exports','int_freshdesk_accounts','lodash','util','../../config/logger','api'];(function(_0x2b16b3,_0x1611a1){var _0x415632=function(_0x64039a){while(--_0x64039a){_0x2b16b3['push'](_0x2b16b3['shift']());}};_0x415632(++_0x1611a1);}(_0x668a,0x1be));var _0xa668=function(_0x2e0bf5,_0x24278f){_0x2e0bf5=_0x2e0bf5-0x0;var _0x5f24da=_0x668a[_0x2e0bf5];return _0x5f24da;};'use strict';var _=require(_0xa668('0x0'));var util=require(_0xa668('0x1'));var logger=require(_0xa668('0x2'))(_0xa668('0x3'));var moment=require(_0xa668('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa668('0x5'));var rimraf=require(_0xa668('0x6'));var config=require('../../config/environment');var attributes=require('./intFreshdeskAccount.attributes');var integrations=require(_0xa668('0x7'));module[_0xa668('0x8')]=function(_0x59643b,_0x493364){return _0x59643b['define']('FreshdeskAccount',attributes,{'tableName':_0xa668('0x9'),'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 6dc92c7..720eb9b 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 _0xc900=['debug','request\x20sent','stringify','error','code','message','result','GetFreshdeskAccount','findAll','options','raw','attributes','include','map','model','catch','ShowFreshdeskAccount','FreshdeskAccount','where','lodash','util','bluebird','ioredis','../../config/utils','rpc','http','request','then','info','FreshdeskAccount,\x20%s,\x20%s'];(function(_0x1b352e,_0x3b5e60){var _0x31d1e8=function(_0x3cca4f){while(--_0x3cca4f){_0x1b352e['push'](_0x1b352e['shift']());}};_0x31d1e8(++_0x3b5e60);}(_0xc900,0xc7));var _0x0c90=function(_0xcd35ba,_0x1dd745){_0xcd35ba=_0xcd35ba-0x0;var _0x446b89=_0xc900[_0xcd35ba];return _0x446b89;};'use strict';var _=require(_0x0c90('0x0'));var util=require(_0x0c90('0x1'));var moment=require('moment');var BPromise=require(_0x0c90('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0c90('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0c90('0x4'));var logger=require('../../config/logger')(_0x0c90('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x0c90('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x34b482,_0x3bf50c,_0x9d243e){return new BPromise(function(_0x5a43df,_0x12e6e0){return client[_0x0c90('0x7')](_0x34b482,_0x9d243e)[_0x0c90('0x8')](function(_0x406d55){logger[_0x0c90('0x9')](_0x0c90('0xa'),_0x3bf50c,'request\x20sent');logger[_0x0c90('0xb')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x3bf50c,_0x0c90('0xc'),JSON[_0x0c90('0xd')](_0x406d55));if(_0x406d55[_0x0c90('0xe')]){if(_0x406d55[_0x0c90('0xe')][_0x0c90('0xf')]===0x1f4){logger[_0x0c90('0xe')]('FreshdeskAccount,\x20%s,\x20%s',_0x3bf50c,_0x406d55[_0x0c90('0xe')][_0x0c90('0x10')]);return _0x12e6e0(_0x406d55[_0x0c90('0xe')]['message']);}logger[_0x0c90('0xe')](_0x0c90('0xa'),_0x3bf50c,_0x406d55[_0x0c90('0xe')]['message']);return _0x5a43df(_0x406d55[_0x0c90('0xe')][_0x0c90('0x10')]);}else{logger[_0x0c90('0x9')](_0x0c90('0xa'),_0x3bf50c,_0x0c90('0xc'));_0x5a43df(_0x406d55[_0x0c90('0x11')][_0x0c90('0x10')]);}})['catch'](function(_0x3bf2a1){logger[_0x0c90('0xe')]('FreshdeskAccount,\x20%s,\x20%s',_0x3bf50c,_0x3bf2a1);_0x12e6e0(_0x3bf2a1);});});}exports[_0x0c90('0x12')]=function(_0x4e3a61){var _0x4b9383=this;return new Promise(function(_0x4a077c,_0x4596db){return db['FreshdeskAccount'][_0x0c90('0x13')]({'raw':_0x4e3a61[_0x0c90('0x14')]?_0x4e3a61[_0x0c90('0x14')][_0x0c90('0x15')]===undefined?!![]:![]:!![],'where':_0x4e3a61[_0x0c90('0x14')]?_0x4e3a61[_0x0c90('0x14')]['where']||null:null,'attributes':_0x4e3a61[_0x0c90('0x14')]?_0x4e3a61['options'][_0x0c90('0x16')]||null:null,'limit':_0x4e3a61[_0x0c90('0x14')]?_0x4e3a61[_0x0c90('0x14')]['limit']||null:null,'include':_0x4e3a61[_0x0c90('0x14')]?_0x4e3a61[_0x0c90('0x14')][_0x0c90('0x17')]?_[_0x0c90('0x18')](_0x4e3a61[_0x0c90('0x14')]['include'],function(_0x21fba6){return{'model':db[_0x21fba6['model']],'as':_0x21fba6['as'],'attributes':_0x21fba6[_0x0c90('0x16')],'include':_0x21fba6['include']?_[_0x0c90('0x18')](_0x21fba6[_0x0c90('0x17')],function(_0xae29b9){return{'model':db[_0xae29b9[_0x0c90('0x19')]],'as':_0xae29b9['as'],'attributes':_0xae29b9[_0x0c90('0x16')],'include':_0xae29b9['include']?_[_0x0c90('0x18')](_0xae29b9[_0x0c90('0x17')],function(_0x121d3a){return{'model':db[_0x121d3a[_0x0c90('0x19')]],'as':_0x121d3a['as'],'attributes':_0x121d3a[_0x0c90('0x16')]};}):[]};}):[]};}):[]:[]})[_0x0c90('0x8')](function(_0xfbed99){logger[_0x0c90('0x9')](_0x0c90('0x12'),_0x4e3a61);logger[_0x0c90('0xb')](_0x0c90('0x12'),_0x4e3a61,JSON[_0x0c90('0xd')](_0xfbed99));_0x4a077c(_0xfbed99);})[_0x0c90('0x1a')](function(_0x49ae1a){logger[_0x0c90('0xe')](_0x0c90('0x12'),_0x49ae1a[_0x0c90('0x10')],_0x4e3a61);_0x4596db(_0x4b9383[_0x0c90('0xe')](0x1f4,_0x49ae1a[_0x0c90('0x10')]));});});};exports[_0x0c90('0x1b')]=function(_0x3f88b1){var _0x16980a=this;return new Promise(function(_0x40304e,_0x27f3b3){return db[_0x0c90('0x1c')]['find']({'raw':_0x3f88b1['options']?_0x3f88b1[_0x0c90('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x3f88b1[_0x0c90('0x14')]?_0x3f88b1[_0x0c90('0x14')][_0x0c90('0x1d')]||null:null,'attributes':_0x3f88b1['options']?_0x3f88b1[_0x0c90('0x14')][_0x0c90('0x16')]||null:null,'include':_0x3f88b1[_0x0c90('0x14')]?_0x3f88b1[_0x0c90('0x14')][_0x0c90('0x17')]?_[_0x0c90('0x18')](_0x3f88b1[_0x0c90('0x14')][_0x0c90('0x17')],function(_0x53873b){return{'model':db[_0x53873b[_0x0c90('0x19')]],'as':_0x53873b['as'],'attributes':_0x53873b[_0x0c90('0x16')],'include':_0x53873b[_0x0c90('0x17')]?_[_0x0c90('0x18')](_0x53873b[_0x0c90('0x17')],function(_0x30c48f){return{'model':db[_0x30c48f[_0x0c90('0x19')]],'as':_0x30c48f['as'],'attributes':_0x30c48f[_0x0c90('0x16')],'include':_0x30c48f[_0x0c90('0x17')]?_[_0x0c90('0x18')](_0x30c48f['include'],function(_0x390e55){return{'model':db[_0x390e55[_0x0c90('0x19')]],'as':_0x390e55['as'],'attributes':_0x390e55[_0x0c90('0x16')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xe2a8f8){logger[_0x0c90('0x9')](_0x0c90('0x1b'),_0x3f88b1);logger[_0x0c90('0xb')]('ShowFreshdeskAccount',_0x3f88b1,JSON[_0x0c90('0xd')](_0xe2a8f8));_0x40304e(_0xe2a8f8);})[_0x0c90('0x1a')](function(_0x5213af){logger[_0x0c90('0xe')](_0x0c90('0x1b'),_0x5213af[_0x0c90('0x10')],_0x3f88b1);_0x27f3b3(_0x16980a[_0x0c90('0xe')](0x1f4,_0x5213af[_0x0c90('0x10')]));});});}; \ No newline at end of file +var _0x0be7=['client','request','then','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','attributes','limit','include','map','model','ShowFreshdeskAccount','find','raw','where','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0x0be7,0xc4));var _0x70be=function(_0xcbfe09,_0x1777bf){_0xcbfe09=_0xcbfe09-0x0;var _0x3d59e3=_0x0be7[_0xcbfe09];return _0x3d59e3;};'use strict';var _=require('lodash');var util=require(_0x70be('0x0'));var moment=require('moment');var BPromise=require(_0x70be('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x70be('0x2'));var db=require(_0x70be('0x3'))['db'];var utils=require(_0x70be('0x4'));var logger=require(_0x70be('0x5'))(_0x70be('0x6'));var config=require(_0x70be('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x70be('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xe8b00,_0x5a8b51,_0x352f03){return new BPromise(function(_0x23373d,_0x11aa1a){return client[_0x70be('0x9')](_0xe8b00,_0x352f03)[_0x70be('0xa')](function(_0x5940c2){logger['info'](_0x70be('0xb'),_0x5a8b51,_0x70be('0xc'));logger[_0x70be('0xd')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x5a8b51,_0x70be('0xc'),JSON[_0x70be('0xe')](_0x5940c2));if(_0x5940c2[_0x70be('0xf')]){if(_0x5940c2['error'][_0x70be('0x10')]===0x1f4){logger[_0x70be('0xf')](_0x70be('0xb'),_0x5a8b51,_0x5940c2[_0x70be('0xf')][_0x70be('0x11')]);return _0x11aa1a(_0x5940c2[_0x70be('0xf')][_0x70be('0x11')]);}logger[_0x70be('0xf')](_0x70be('0xb'),_0x5a8b51,_0x5940c2[_0x70be('0xf')][_0x70be('0x11')]);return _0x23373d(_0x5940c2[_0x70be('0xf')][_0x70be('0x11')]);}else{logger[_0x70be('0x12')](_0x70be('0xb'),_0x5a8b51,'request\x20sent');_0x23373d(_0x5940c2[_0x70be('0x13')][_0x70be('0x11')]);}})[_0x70be('0x14')](function(_0x56e261){logger['error'](_0x70be('0xb'),_0x5a8b51,_0x56e261);_0x11aa1a(_0x56e261);});});}exports[_0x70be('0x15')]=function(_0x4bf04d){var _0x281650=this;return new Promise(function(_0xfdafd3,_0x2cc69f){return db[_0x70be('0x16')][_0x70be('0x17')]({'raw':_0x4bf04d[_0x70be('0x18')]?_0x4bf04d['options']['raw']===undefined?!![]:![]:!![],'where':_0x4bf04d[_0x70be('0x18')]?_0x4bf04d[_0x70be('0x18')]['where']||null:null,'attributes':_0x4bf04d[_0x70be('0x18')]?_0x4bf04d['options'][_0x70be('0x19')]||null:null,'limit':_0x4bf04d[_0x70be('0x18')]?_0x4bf04d[_0x70be('0x18')][_0x70be('0x1a')]||null:null,'include':_0x4bf04d[_0x70be('0x18')]?_0x4bf04d[_0x70be('0x18')][_0x70be('0x1b')]?_[_0x70be('0x1c')](_0x4bf04d[_0x70be('0x18')][_0x70be('0x1b')],function(_0x489036){return{'model':db[_0x489036[_0x70be('0x1d')]],'as':_0x489036['as'],'attributes':_0x489036[_0x70be('0x19')],'include':_0x489036['include']?_[_0x70be('0x1c')](_0x489036[_0x70be('0x1b')],function(_0x381ffe){return{'model':db[_0x381ffe['model']],'as':_0x381ffe['as'],'attributes':_0x381ffe[_0x70be('0x19')],'include':_0x381ffe['include']?_[_0x70be('0x1c')](_0x381ffe[_0x70be('0x1b')],function(_0x35fe7f){return{'model':db[_0x35fe7f[_0x70be('0x1d')]],'as':_0x35fe7f['as'],'attributes':_0x35fe7f[_0x70be('0x19')]};}):[]};}):[]};}):[]:[]})[_0x70be('0xa')](function(_0x3ee42a){logger['info'](_0x70be('0x15'),_0x4bf04d);logger[_0x70be('0xd')](_0x70be('0x15'),_0x4bf04d,JSON[_0x70be('0xe')](_0x3ee42a));_0xfdafd3(_0x3ee42a);})[_0x70be('0x14')](function(_0xbd9eba){logger['error'](_0x70be('0x15'),_0xbd9eba[_0x70be('0x11')],_0x4bf04d);_0x2cc69f(_0x281650[_0x70be('0xf')](0x1f4,_0xbd9eba['message']));});});};exports[_0x70be('0x1e')]=function(_0xada81d){var _0xf8ce91=this;return new Promise(function(_0x246c40,_0x3177b8){return db[_0x70be('0x16')][_0x70be('0x1f')]({'raw':_0xada81d[_0x70be('0x18')]?_0xada81d[_0x70be('0x18')][_0x70be('0x20')]===undefined?!![]:![]:!![],'where':_0xada81d[_0x70be('0x18')]?_0xada81d[_0x70be('0x18')][_0x70be('0x21')]||null:null,'attributes':_0xada81d[_0x70be('0x18')]?_0xada81d['options'][_0x70be('0x19')]||null:null,'include':_0xada81d[_0x70be('0x18')]?_0xada81d[_0x70be('0x18')]['include']?_[_0x70be('0x1c')](_0xada81d[_0x70be('0x18')][_0x70be('0x1b')],function(_0x1c4edb){return{'model':db[_0x1c4edb[_0x70be('0x1d')]],'as':_0x1c4edb['as'],'attributes':_0x1c4edb[_0x70be('0x19')],'include':_0x1c4edb[_0x70be('0x1b')]?_['map'](_0x1c4edb[_0x70be('0x1b')],function(_0x460fdf){return{'model':db[_0x460fdf[_0x70be('0x1d')]],'as':_0x460fdf['as'],'attributes':_0x460fdf[_0x70be('0x19')],'include':_0x460fdf['include']?_[_0x70be('0x1c')](_0x460fdf[_0x70be('0x1b')],function(_0x94e3e1){return{'model':db[_0x94e3e1[_0x70be('0x1d')]],'as':_0x94e3e1['as'],'attributes':_0x94e3e1['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x14092f){logger[_0x70be('0x12')](_0x70be('0x1e'),_0xada81d);logger[_0x70be('0xd')]('ShowFreshdeskAccount',_0xada81d,JSON['stringify'](_0x14092f));_0x246c40(_0x14092f);})[_0x70be('0x14')](function(_0x39ebba){logger[_0x70be('0xf')](_0x70be('0x1e'),_0x39ebba['message'],_0xada81d);_0x3177b8(_0xf8ce91[_0x70be('0xf')](0x1f4,_0x39ebba['message']));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 434ad89..dc05241 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 _0xf4cb=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','/:id/tags','getTags','post','create','setTags','put','delete','destroy','multer','util','path','express','Router','fs-extra'];(function(_0x3f1676,_0x5e7f1b){var _0x35fd86=function(_0x2d1609){while(--_0x2d1609){_0x3f1676['push'](_0x3f1676['shift']());}};_0x35fd86(++_0x5e7f1b);}(_0xf4cb,0xb7));var _0xbf4c=function(_0x495d3a,_0x367559){_0x495d3a=_0x495d3a-0x0;var _0x31235d=_0xf4cb[_0x495d3a];return _0x31235d;};'use strict';var multer=require(_0xbf4c('0x0'));var util=require(_0xbf4c('0x1'));var path=require(_0xbf4c('0x2'));var timeout=require('connect-timeout');var express=require(_0xbf4c('0x3'));var router=express[_0xbf4c('0x4')]();var fs_extra=require(_0xbf4c('0x5'));var auth=require(_0xbf4c('0x6'));var interaction=require(_0xbf4c('0x7'));var config=require(_0xbf4c('0x8'));var controller=require(_0xbf4c('0x9'));router[_0xbf4c('0xa')]('/',auth[_0xbf4c('0xb')](),controller[_0xbf4c('0xc')]);router[_0xbf4c('0xa')](_0xbf4c('0xd'),auth[_0xbf4c('0xb')](),controller[_0xbf4c('0xe')]);router[_0xbf4c('0xa')]('/:id/fields',auth['isAuthenticated'](),controller[_0xbf4c('0xf')]);router['get'](_0xbf4c('0x10'),auth[_0xbf4c('0xb')](),controller[_0xbf4c('0x11')]);router[_0xbf4c('0xa')](_0xbf4c('0x12'),auth[_0xbf4c('0xb')](),controller['getDescriptions']);router[_0xbf4c('0xa')](_0xbf4c('0x13'),auth[_0xbf4c('0xb')](),controller[_0xbf4c('0x14')]);router[_0xbf4c('0x15')]('/',auth[_0xbf4c('0xb')](),controller[_0xbf4c('0x16')]);router[_0xbf4c('0x15')](_0xbf4c('0x13'),auth['isAuthenticated'](),controller[_0xbf4c('0x17')]);router[_0xbf4c('0x18')](_0xbf4c('0xd'),auth[_0xbf4c('0xb')](),controller['update']);router[_0xbf4c('0x19')]('/:id',auth[_0xbf4c('0xb')](),controller[_0xbf4c('0x1a')]);module['exports']=router; \ No newline at end of file +var _0x0854=['connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','getTags','create','post','/:id/tags','setTags','put','update','delete','exports','multer','util','path'];(function(_0x36b9a,_0x434e2e){var _0x345e2d=function(_0x32e7bf){while(--_0x32e7bf){_0x36b9a['push'](_0x36b9a['shift']());}};_0x345e2d(++_0x434e2e);}(_0x0854,0x15c));var _0x4085=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0854[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x4085('0x0'));var util=require(_0x4085('0x1'));var path=require(_0x4085('0x2'));var timeout=require(_0x4085('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x4085('0x4'));var auth=require(_0x4085('0x5'));var interaction=require(_0x4085('0x6'));var config=require(_0x4085('0x7'));var controller=require(_0x4085('0x8'));router[_0x4085('0x9')]('/',auth[_0x4085('0xa')](),controller['index']);router[_0x4085('0x9')](_0x4085('0xb'),auth['isAuthenticated'](),controller[_0x4085('0xc')]);router[_0x4085('0x9')](_0x4085('0xd'),auth[_0x4085('0xa')](),controller[_0x4085('0xe')]);router[_0x4085('0x9')](_0x4085('0xf'),auth['isAuthenticated'](),controller[_0x4085('0x10')]);router[_0x4085('0x9')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0x4085('0x11')]);router[_0x4085('0x9')]('/:id/tags',auth['isAuthenticated'](),controller[_0x4085('0x12')]);router['post']('/',auth[_0x4085('0xa')](),controller[_0x4085('0x13')]);router[_0x4085('0x14')](_0x4085('0x15'),auth['isAuthenticated'](),controller[_0x4085('0x16')]);router[_0x4085('0x17')](_0x4085('0xb'),auth[_0x4085('0xa')](),controller[_0x4085('0x18')]);router[_0x4085('0x19')](_0x4085('0xb'),auth[_0x4085('0xa')](),controller['destroy']);module[_0x4085('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 1be40d9..04c8046 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 _0x1f5c=['sequelize','STRING'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0x1f5c,0x82));var _0xc1f5=function(_0x59dc12,_0x1ec155){_0x59dc12=_0x59dc12-0x0;var _0x20befc=_0x1f5c[_0x59dc12];return _0x20befc;};'use strict';var Sequelize=require(_0xc1f5('0x0'));module['exports']={'name':{'type':Sequelize[_0xc1f5('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb498=['STRING','sequelize','exports'];(function(_0x23e7c1,_0x35110c){var _0x1add43=function(_0x238918){while(--_0x238918){_0x23e7c1['push'](_0x23e7c1['shift']());}};_0x1add43(++_0x35110c);}(_0xb498,0x142));var _0x8b49=function(_0x478545,_0x156b00){_0x478545=_0x478545-0x0;var _0x4de529=_0xb498[_0x478545];return _0x4de529;};'use strict';var Sequelize=require(_0x8b49('0x0'));module[_0x8b49('0x1')]={'name':{'type':Sequelize[_0x8b49('0x2')]},'description':{'type':Sequelize[_0x8b49('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 61ecc4f..3c04227 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 _0xfd87=['order','sort','where','filters','VIRTUAL','filter','merge','options','includeAll','catch','show','params','find','create','body','findOne','FreshdeskField','getFields','getSubjects','pick','getDescriptions','Tag','getTags','setTags','ids','eml-format','rimraf','fast-json-patch','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','end','json','undefined','limit','count','offset','status','set','Content-Range','apply','reject','update','then','stack','name','index','map','FreshdeskConfiguration','rawAttributes','fieldName','type','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit'];(function(_0x4c7fb5,_0x2548ef){var _0x2e10ac=function(_0xf7e27c){while(--_0xf7e27c){_0x4c7fb5['push'](_0x4c7fb5['shift']());}};_0x2e10ac(++_0x2548ef);}(_0xfd87,0x100));var _0x7fd8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfd87[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x7fd8('0x0'));var rimraf=require(_0x7fd8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7fd8('0x2'));var rp=require('request-promise');var moment=require(_0x7fd8('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x7fd8('0x4'));var util=require(_0x7fd8('0x5'));var path=require(_0x7fd8('0x6'));var sox=require(_0x7fd8('0x7'));var csv=require(_0x7fd8('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7fd8('0x9'));var _=require(_0x7fd8('0xa'));var squel=require('squel');var crypto=require(_0x7fd8('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x7fd8('0xc'));var toCsv=require(_0x7fd8('0x8'));var querystring=require(_0x7fd8('0xd'));var Papa=require(_0x7fd8('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7fd8('0xf'));var as=require(_0x7fd8('0x10'));var hardwareService=require(_0x7fd8('0x11'));var logger=require('../../config/logger')(_0x7fd8('0x12'));var utils=require(_0x7fd8('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7fd8('0x14'))['db'];function respondWithStatusCode(_0x2d7111,_0x4f5a67){_0x4f5a67=_0x4f5a67||0xcc;return function(_0x2d48b2){if(_0x2d48b2){return _0x2d7111[_0x7fd8('0x15')](_0x4f5a67);}return _0x2d7111['status'](_0x4f5a67)[_0x7fd8('0x16')]();};}function respondWithResult(_0x15da1e,_0x510312){_0x510312=_0x510312||0xc8;return function(_0x526c1e){if(_0x526c1e){return _0x15da1e['status'](_0x510312)[_0x7fd8('0x17')](_0x526c1e);}};}function respondWithFilteredResult(_0x9e41,_0x2eeae3){return function(_0x4b3e33){if(_0x4b3e33){var _0x42a2f7=typeof _0x2eeae3['offset']===_0x7fd8('0x18')&&typeof _0x2eeae3[_0x7fd8('0x19')]===_0x7fd8('0x18');var _0x5283bd=_0x4b3e33[_0x7fd8('0x1a')];var _0x507ec2=_0x42a2f7?0x0:_0x2eeae3['offset'];var _0x138311=_0x42a2f7?_0x4b3e33[_0x7fd8('0x1a')]:_0x2eeae3[_0x7fd8('0x1b')]+_0x2eeae3[_0x7fd8('0x19')];var _0x5c8561;if(_0x138311>=_0x5283bd){_0x138311=_0x5283bd;_0x5c8561=0xc8;}else{_0x5c8561=0xce;}_0x9e41[_0x7fd8('0x1c')](_0x5c8561);return _0x9e41[_0x7fd8('0x1d')](_0x7fd8('0x1e'),_0x507ec2+'-'+_0x138311+'/'+_0x5283bd)[_0x7fd8('0x17')](_0x4b3e33);}return null;};}function patchUpdates(_0x2c2ebc){return function(_0x1112d6){try{jsonpatch[_0x7fd8('0x1f')](_0x1112d6,_0x2c2ebc,!![]);}catch(_0x50fd3a){return BPromise[_0x7fd8('0x20')](_0x50fd3a);}return _0x1112d6['save']();};}function saveUpdates(_0x59c11c,_0x43f5a5){return function(_0x2b72b3){if(_0x2b72b3){return _0x2b72b3[_0x7fd8('0x21')](_0x59c11c)['then'](function(_0x427b9a){return _0x427b9a;});}return null;};}function removeEntity(_0x2dc9f0,_0x153374){return function(_0x1c2bcf){if(_0x1c2bcf){return _0x1c2bcf['destroy']()[_0x7fd8('0x22')](function(){_0x2dc9f0['status'](0xcc)[_0x7fd8('0x16')]();});}};}function handleEntityNotFound(_0x7c0414,_0x28f587){return function(_0x5a3892){if(!_0x5a3892){_0x7c0414['sendStatus'](0x194);}return _0x5a3892;};}function handleError(_0xba74da,_0x5892a5){_0x5892a5=_0x5892a5||0x1f4;return function(_0x28d2de){logger['error'](_0x28d2de[_0x7fd8('0x23')]);if(_0x28d2de[_0x7fd8('0x24')]){delete _0x28d2de[_0x7fd8('0x24')];}_0xba74da['status'](_0x5892a5)['send'](_0x28d2de);};}exports[_0x7fd8('0x25')]=function(_0x16d57a,_0x153d26){var _0x28843d={},_0x136769={},_0x4211a1={'count':0x0,'rows':[]};var _0x3c4461=_[_0x7fd8('0x26')](db[_0x7fd8('0x27')][_0x7fd8('0x28')],function(_0x132d55){return{'name':_0x132d55[_0x7fd8('0x29')],'type':_0x132d55[_0x7fd8('0x2a')]['key']};});_0x136769[_0x7fd8('0x2b')]=_[_0x7fd8('0x26')](_0x3c4461,_0x7fd8('0x24'));_0x136769[_0x7fd8('0x2c')]=_[_0x7fd8('0x2d')](_0x16d57a[_0x7fd8('0x2c')]);_0x136769['filters']=_['intersection'](_0x136769[_0x7fd8('0x2b')],_0x136769[_0x7fd8('0x2c')]);_0x28843d[_0x7fd8('0x2e')]=_[_0x7fd8('0x2f')](_0x136769[_0x7fd8('0x2b')],qs[_0x7fd8('0x30')](_0x16d57a[_0x7fd8('0x2c')][_0x7fd8('0x30')]));_0x28843d[_0x7fd8('0x2e')]=_0x28843d[_0x7fd8('0x2e')][_0x7fd8('0x31')]?_0x28843d[_0x7fd8('0x2e')]:_0x136769[_0x7fd8('0x2b')];if(!_0x16d57a['query'][_0x7fd8('0x32')](_0x7fd8('0x33'))){_0x28843d['limit']=qs[_0x7fd8('0x19')](_0x16d57a[_0x7fd8('0x2c')]['limit']);_0x28843d[_0x7fd8('0x1b')]=qs[_0x7fd8('0x1b')](_0x16d57a[_0x7fd8('0x2c')][_0x7fd8('0x1b')]);}_0x28843d[_0x7fd8('0x34')]=qs['sort'](_0x16d57a[_0x7fd8('0x2c')][_0x7fd8('0x35')]);_0x28843d[_0x7fd8('0x36')]=qs[_0x7fd8('0x37')](_['pick'](_0x16d57a[_0x7fd8('0x2c')],_0x136769['filters']),_0x3c4461);if(_0x16d57a['query']['filter']){_0x28843d[_0x7fd8('0x36')]=_['merge'](_0x28843d[_0x7fd8('0x36')],{'$or':_[_0x7fd8('0x26')](_0x3c4461,function(_0x1ede67){if(_0x1ede67['type']!==_0x7fd8('0x38')){var _0x7dcd2c={};_0x7dcd2c[_0x1ede67['name']]={'$like':'%'+_0x16d57a[_0x7fd8('0x2c')][_0x7fd8('0x39')]+'%'};return _0x7dcd2c;}})});}_0x28843d=_[_0x7fd8('0x3a')]({},_0x28843d,_0x16d57a[_0x7fd8('0x3b')]);var _0x23d6b1={'where':_0x28843d[_0x7fd8('0x36')]};return db['FreshdeskConfiguration'][_0x7fd8('0x1a')](_0x23d6b1)['then'](function(_0x31e102){_0x4211a1[_0x7fd8('0x1a')]=_0x31e102;if(_0x16d57a[_0x7fd8('0x2c')][_0x7fd8('0x3c')]){_0x28843d['include']=[{'all':!![]}];}return db['FreshdeskConfiguration']['findAll'](_0x28843d);})[_0x7fd8('0x22')](function(_0x30b356){_0x4211a1['rows']=_0x30b356;return _0x4211a1;})[_0x7fd8('0x22')](respondWithFilteredResult(_0x153d26,_0x28843d))[_0x7fd8('0x3d')](handleError(_0x153d26,null));};exports[_0x7fd8('0x3e')]=function(_0x4cbf03,_0x440aea){var _0x17708d={'raw':![],'where':{'id':_0x4cbf03[_0x7fd8('0x3f')]['id']}},_0x5c9da5={};_0x5c9da5[_0x7fd8('0x2b')]=_[_0x7fd8('0x2d')](db['FreshdeskConfiguration'][_0x7fd8('0x28')]);_0x5c9da5[_0x7fd8('0x2c')]=_[_0x7fd8('0x2d')](_0x4cbf03[_0x7fd8('0x2c')]);_0x5c9da5[_0x7fd8('0x37')]=_[_0x7fd8('0x2f')](_0x5c9da5[_0x7fd8('0x2b')],_0x5c9da5[_0x7fd8('0x2c')]);_0x17708d[_0x7fd8('0x2e')]=_[_0x7fd8('0x2f')](_0x5c9da5[_0x7fd8('0x2b')],qs['fields'](_0x4cbf03[_0x7fd8('0x2c')][_0x7fd8('0x30')]));_0x17708d[_0x7fd8('0x2e')]=_0x17708d[_0x7fd8('0x2e')][_0x7fd8('0x31')]?_0x17708d[_0x7fd8('0x2e')]:_0x5c9da5[_0x7fd8('0x2b')];if(_0x4cbf03[_0x7fd8('0x2c')]['includeAll']){_0x17708d['include']=[{'all':!![]}];}_0x17708d=_[_0x7fd8('0x3a')]({},_0x17708d,_0x4cbf03[_0x7fd8('0x3b')]);return db['FreshdeskConfiguration'][_0x7fd8('0x40')](_0x17708d)[_0x7fd8('0x22')](handleEntityNotFound(_0x440aea,null))[_0x7fd8('0x22')](respondWithResult(_0x440aea,null))[_0x7fd8('0x3d')](handleError(_0x440aea,null));};exports[_0x7fd8('0x41')]=function(_0x202423,_0x436850){return db['FreshdeskConfiguration'][_0x7fd8('0x41')](_0x202423[_0x7fd8('0x42')],{})[_0x7fd8('0x22')](respondWithResult(_0x436850,0xc9))[_0x7fd8('0x3d')](handleError(_0x436850,null));};exports[_0x7fd8('0x21')]=function(_0x44beb6,_0x39d522){if(_0x44beb6['body']['id']){delete _0x44beb6[_0x7fd8('0x42')]['id'];}return db[_0x7fd8('0x27')][_0x7fd8('0x40')]({'where':{'id':_0x44beb6[_0x7fd8('0x3f')]['id']}})[_0x7fd8('0x22')](handleEntityNotFound(_0x39d522,null))[_0x7fd8('0x22')](saveUpdates(_0x44beb6[_0x7fd8('0x42')],null))[_0x7fd8('0x22')](respondWithResult(_0x39d522,null))[_0x7fd8('0x3d')](handleError(_0x39d522,null));};exports['destroy']=function(_0x2d790f,_0x2f410a){return db[_0x7fd8('0x27')][_0x7fd8('0x40')]({'where':{'id':_0x2d790f[_0x7fd8('0x3f')]['id']}})[_0x7fd8('0x22')](handleEntityNotFound(_0x2f410a,null))[_0x7fd8('0x22')](removeEntity(_0x2f410a,null))[_0x7fd8('0x3d')](handleError(_0x2f410a,null));};exports['getFields']=function(_0x587307,_0xd7bfb3,_0x5a7d0e){var _0x5bcbc0={};var _0x42e815={};var _0x4c5812;var _0x2c6689;return db['FreshdeskConfiguration'][_0x7fd8('0x43')]({'where':{'id':_0x587307[_0x7fd8('0x3f')]['id']}})[_0x7fd8('0x22')](handleEntityNotFound(_0xd7bfb3,null))['then'](function(_0x4b1401){if(_0x4b1401){_0x4c5812=_0x4b1401;_0x42e815[_0x7fd8('0x2b')]=_[_0x7fd8('0x2d')](db[_0x7fd8('0x44')][_0x7fd8('0x28')]);_0x42e815[_0x7fd8('0x2c')]=_[_0x7fd8('0x2d')](_0x587307[_0x7fd8('0x2c')]);_0x42e815[_0x7fd8('0x37')]=_[_0x7fd8('0x2f')](_0x42e815[_0x7fd8('0x2b')],_0x42e815[_0x7fd8('0x2c')]);_0x5bcbc0[_0x7fd8('0x2e')]=_[_0x7fd8('0x2f')](_0x42e815[_0x7fd8('0x2b')],qs['fields'](_0x587307[_0x7fd8('0x2c')][_0x7fd8('0x30')]));_0x5bcbc0['attributes']=_0x5bcbc0[_0x7fd8('0x2e')][_0x7fd8('0x31')]?_0x5bcbc0[_0x7fd8('0x2e')]:_0x42e815[_0x7fd8('0x2b')];_0x5bcbc0['order']=qs['sort'](_0x587307[_0x7fd8('0x2c')][_0x7fd8('0x35')]);_0x5bcbc0[_0x7fd8('0x36')]=qs[_0x7fd8('0x37')](_['pick'](_0x587307[_0x7fd8('0x2c')],_0x42e815[_0x7fd8('0x37')]));if(_0x587307['query'][_0x7fd8('0x39')]){_0x5bcbc0[_0x7fd8('0x36')]=_[_0x7fd8('0x3a')](_0x5bcbc0[_0x7fd8('0x36')],{'$or':_[_0x7fd8('0x26')](_0x5bcbc0[_0x7fd8('0x2e')],function(_0x177026){var _0x3bee3b={};_0x3bee3b[_0x177026]={'$like':'%'+_0x587307['query'][_0x7fd8('0x39')]+'%'};return _0x3bee3b;})});}_0x5bcbc0=_['merge']({},_0x5bcbc0,_0x587307[_0x7fd8('0x3b')]);return _0x4c5812[_0x7fd8('0x45')](_0x5bcbc0);}})[_0x7fd8('0x22')](function(_0x321fc1){if(_0x321fc1){_0x2c6689=_0x321fc1[_0x7fd8('0x31')];if(!_0x587307['query'][_0x7fd8('0x32')](_0x7fd8('0x33'))){_0x5bcbc0[_0x7fd8('0x19')]=qs['limit'](_0x587307['query'][_0x7fd8('0x19')]);_0x5bcbc0[_0x7fd8('0x1b')]=qs[_0x7fd8('0x1b')](_0x587307['query'][_0x7fd8('0x1b')]);}return _0x4c5812['getFields'](_0x5bcbc0);}})[_0x7fd8('0x22')](function(_0x471330){if(_0x471330){return _0x471330?{'count':_0x2c6689,'rows':_0x471330}:null;}})['then'](respondWithResult(_0xd7bfb3,null))[_0x7fd8('0x3d')](handleError(_0xd7bfb3,null));};exports[_0x7fd8('0x46')]=function(_0xe6a0da,_0x1ac1e9,_0x184482){var _0xa0394f={};var _0x48c1db={};var _0x1f149e;var _0x479e7d;return db[_0x7fd8('0x27')]['findOne']({'where':{'id':_0xe6a0da[_0x7fd8('0x3f')]['id']}})[_0x7fd8('0x22')](handleEntityNotFound(_0x1ac1e9,null))['then'](function(_0x125b2f){if(_0x125b2f){_0x1f149e=_0x125b2f;_0x48c1db[_0x7fd8('0x2b')]=_['keys'](db[_0x7fd8('0x44')][_0x7fd8('0x28')]);_0x48c1db[_0x7fd8('0x2c')]=_[_0x7fd8('0x2d')](_0xe6a0da['query']);_0x48c1db[_0x7fd8('0x37')]=_['intersection'](_0x48c1db['model'],_0x48c1db[_0x7fd8('0x2c')]);_0xa0394f['attributes']=_['intersection'](_0x48c1db[_0x7fd8('0x2b')],qs[_0x7fd8('0x30')](_0xe6a0da[_0x7fd8('0x2c')][_0x7fd8('0x30')]));_0xa0394f[_0x7fd8('0x2e')]=_0xa0394f[_0x7fd8('0x2e')][_0x7fd8('0x31')]?_0xa0394f[_0x7fd8('0x2e')]:_0x48c1db[_0x7fd8('0x2b')];_0xa0394f['order']=qs[_0x7fd8('0x35')](_0xe6a0da[_0x7fd8('0x2c')]['sort']);_0xa0394f['where']=qs[_0x7fd8('0x37')](_[_0x7fd8('0x47')](_0xe6a0da['query'],_0x48c1db[_0x7fd8('0x37')]));if(_0xe6a0da[_0x7fd8('0x2c')][_0x7fd8('0x39')]){_0xa0394f[_0x7fd8('0x36')]=_['merge'](_0xa0394f[_0x7fd8('0x36')],{'$or':_['map'](_0xa0394f[_0x7fd8('0x2e')],function(_0x20fd73){var _0x2bb7c0={};_0x2bb7c0[_0x20fd73]={'$like':'%'+_0xe6a0da[_0x7fd8('0x2c')][_0x7fd8('0x39')]+'%'};return _0x2bb7c0;})});}_0xa0394f=_[_0x7fd8('0x3a')]({},_0xa0394f,_0xe6a0da[_0x7fd8('0x3b')]);return _0x1f149e[_0x7fd8('0x46')](_0xa0394f);}})[_0x7fd8('0x22')](function(_0xa211e8){if(_0xa211e8){_0x479e7d=_0xa211e8[_0x7fd8('0x31')];if(!_0xe6a0da['query']['hasOwnProperty'](_0x7fd8('0x33'))){_0xa0394f[_0x7fd8('0x19')]=qs['limit'](_0xe6a0da[_0x7fd8('0x2c')][_0x7fd8('0x19')]);_0xa0394f[_0x7fd8('0x1b')]=qs[_0x7fd8('0x1b')](_0xe6a0da[_0x7fd8('0x2c')][_0x7fd8('0x1b')]);}return _0x1f149e[_0x7fd8('0x46')](_0xa0394f);}})['then'](function(_0x4bb633){if(_0x4bb633){return _0x4bb633?{'count':_0x479e7d,'rows':_0x4bb633}:null;}})[_0x7fd8('0x22')](respondWithResult(_0x1ac1e9,null))[_0x7fd8('0x3d')](handleError(_0x1ac1e9,null));};exports['getDescriptions']=function(_0x1b4b45,_0xb72d5b,_0x18049a){var _0x2244b3={};var _0x2de605={};var _0x56632b;var _0x5ed26f;return db[_0x7fd8('0x27')]['findOne']({'where':{'id':_0x1b4b45[_0x7fd8('0x3f')]['id']}})[_0x7fd8('0x22')](handleEntityNotFound(_0xb72d5b,null))[_0x7fd8('0x22')](function(_0x228dc6){if(_0x228dc6){_0x56632b=_0x228dc6;_0x2de605['model']=_['keys'](db[_0x7fd8('0x44')][_0x7fd8('0x28')]);_0x2de605['query']=_[_0x7fd8('0x2d')](_0x1b4b45['query']);_0x2de605[_0x7fd8('0x37')]=_[_0x7fd8('0x2f')](_0x2de605[_0x7fd8('0x2b')],_0x2de605[_0x7fd8('0x2c')]);_0x2244b3[_0x7fd8('0x2e')]=_[_0x7fd8('0x2f')](_0x2de605[_0x7fd8('0x2b')],qs[_0x7fd8('0x30')](_0x1b4b45[_0x7fd8('0x2c')][_0x7fd8('0x30')]));_0x2244b3[_0x7fd8('0x2e')]=_0x2244b3['attributes'][_0x7fd8('0x31')]?_0x2244b3[_0x7fd8('0x2e')]:_0x2de605[_0x7fd8('0x2b')];_0x2244b3[_0x7fd8('0x34')]=qs[_0x7fd8('0x35')](_0x1b4b45[_0x7fd8('0x2c')][_0x7fd8('0x35')]);_0x2244b3[_0x7fd8('0x36')]=qs[_0x7fd8('0x37')](_[_0x7fd8('0x47')](_0x1b4b45[_0x7fd8('0x2c')],_0x2de605['filters']));if(_0x1b4b45[_0x7fd8('0x2c')][_0x7fd8('0x39')]){_0x2244b3[_0x7fd8('0x36')]=_['merge'](_0x2244b3[_0x7fd8('0x36')],{'$or':_[_0x7fd8('0x26')](_0x2244b3[_0x7fd8('0x2e')],function(_0x1617fa){var _0x56912a={};_0x56912a[_0x1617fa]={'$like':'%'+_0x1b4b45[_0x7fd8('0x2c')]['filter']+'%'};return _0x56912a;})});}_0x2244b3=_['merge']({},_0x2244b3,_0x1b4b45[_0x7fd8('0x3b')]);return _0x56632b[_0x7fd8('0x48')](_0x2244b3);}})['then'](function(_0x14c649){if(_0x14c649){_0x5ed26f=_0x14c649[_0x7fd8('0x31')];if(!_0x1b4b45[_0x7fd8('0x2c')][_0x7fd8('0x32')](_0x7fd8('0x33'))){_0x2244b3[_0x7fd8('0x19')]=qs[_0x7fd8('0x19')](_0x1b4b45['query']['limit']);_0x2244b3[_0x7fd8('0x1b')]=qs[_0x7fd8('0x1b')](_0x1b4b45['query'][_0x7fd8('0x1b')]);}return _0x56632b['getDescriptions'](_0x2244b3);}})[_0x7fd8('0x22')](function(_0x399818){if(_0x399818){return _0x399818?{'count':_0x5ed26f,'rows':_0x399818}:null;}})[_0x7fd8('0x22')](respondWithResult(_0xb72d5b,null))[_0x7fd8('0x3d')](handleError(_0xb72d5b,null));};exports['getTags']=function(_0x5124cb,_0xd69175,_0x4ad687){var _0x124a03={};var _0x1a1d34={};var _0x43415b;var _0x25ccb3;return db[_0x7fd8('0x27')]['findOne']({'where':{'id':_0x5124cb[_0x7fd8('0x3f')]['id']}})['then'](handleEntityNotFound(_0xd69175,null))[_0x7fd8('0x22')](function(_0x433fcd){if(_0x433fcd){_0x43415b=_0x433fcd;_0x1a1d34[_0x7fd8('0x2b')]=_['keys'](db[_0x7fd8('0x49')][_0x7fd8('0x28')]);_0x1a1d34[_0x7fd8('0x2c')]=_[_0x7fd8('0x2d')](_0x5124cb['query']);_0x1a1d34[_0x7fd8('0x37')]=_[_0x7fd8('0x2f')](_0x1a1d34['model'],_0x1a1d34[_0x7fd8('0x2c')]);_0x124a03[_0x7fd8('0x2e')]=_['intersection'](_0x1a1d34[_0x7fd8('0x2b')],qs['fields'](_0x5124cb[_0x7fd8('0x2c')][_0x7fd8('0x30')]));_0x124a03[_0x7fd8('0x2e')]=_0x124a03['attributes'][_0x7fd8('0x31')]?_0x124a03[_0x7fd8('0x2e')]:_0x1a1d34[_0x7fd8('0x2b')];_0x124a03[_0x7fd8('0x34')]=qs[_0x7fd8('0x35')](_0x5124cb['query'][_0x7fd8('0x35')]);_0x124a03[_0x7fd8('0x36')]=qs[_0x7fd8('0x37')](_[_0x7fd8('0x47')](_0x5124cb[_0x7fd8('0x2c')],_0x1a1d34[_0x7fd8('0x37')]));if(_0x5124cb['query'][_0x7fd8('0x39')]){_0x124a03[_0x7fd8('0x36')]=_[_0x7fd8('0x3a')](_0x124a03[_0x7fd8('0x36')],{'$or':_[_0x7fd8('0x26')](_0x124a03['attributes'],function(_0x3e786d){var _0x40c783={};_0x40c783[_0x3e786d]={'$like':'%'+_0x5124cb[_0x7fd8('0x2c')][_0x7fd8('0x39')]+'%'};return _0x40c783;})});}_0x124a03=_[_0x7fd8('0x3a')]({},_0x124a03,_0x5124cb[_0x7fd8('0x3b')]);return _0x43415b['getTags'](_0x124a03);}})[_0x7fd8('0x22')](function(_0x1d0769){if(_0x1d0769){_0x25ccb3=_0x1d0769[_0x7fd8('0x31')];if(!_0x5124cb[_0x7fd8('0x2c')]['hasOwnProperty']('nolimit')){_0x124a03[_0x7fd8('0x19')]=qs[_0x7fd8('0x19')](_0x5124cb[_0x7fd8('0x2c')][_0x7fd8('0x19')]);_0x124a03[_0x7fd8('0x1b')]=qs['offset'](_0x5124cb[_0x7fd8('0x2c')][_0x7fd8('0x1b')]);}return _0x43415b[_0x7fd8('0x4a')](_0x124a03);}})[_0x7fd8('0x22')](function(_0x5f5085){if(_0x5f5085){return _0x5f5085?{'count':_0x25ccb3,'rows':_0x5f5085}:null;}})[_0x7fd8('0x22')](respondWithResult(_0xd69175,null))[_0x7fd8('0x3d')](handleError(_0xd69175,null));};exports[_0x7fd8('0x4b')]=function(_0x297b03,_0x5a9b88,_0x2f9cbc){if(_0x297b03[_0x7fd8('0x42')]['id']){delete _0x297b03[_0x7fd8('0x42')]['id'];}return db[_0x7fd8('0x27')]['findOne']({'where':{'id':_0x297b03[_0x7fd8('0x3f')]['id']}})[_0x7fd8('0x22')](handleEntityNotFound(_0x5a9b88,null))['then'](function(_0xa2e104){if(_0xa2e104){return _0xa2e104['setTags'](_0x297b03[_0x7fd8('0x42')][_0x7fd8('0x4c')]||[]);}return null;})['then'](respondWithResult(_0x5a9b88,null))['catch'](handleError(_0x5a9b88,null));}; \ No newline at end of file +var _0x111b=['status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','FreshdeskConfiguration','rawAttributes','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','getFields','findOne','getSubjects','FreshdeskField','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','ejs','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x111b,0xec));var _0xb111=function(_0x38ed1e,_0x17c77a){_0x38ed1e=_0x38ed1e-0x0;var _0x1e660e=_0x111b[_0x38ed1e];return _0x1e660e;};'use strict';var emlformat=require(_0xb111('0x0'));var rimraf=require(_0xb111('0x1'));var zipdir=require(_0xb111('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb111('0x3'));var moment=require('moment');var BPromise=require(_0xb111('0x4'));var Mustache=require(_0xb111('0x5'));var util=require(_0xb111('0x6'));var path=require(_0xb111('0x7'));var sox=require(_0xb111('0x8'));var csv=require('to-csv');var ejs=require(_0xb111('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xb111('0xa'));var toCsv=require(_0xb111('0xb'));var querystring=require(_0xb111('0xc'));var Papa=require(_0xb111('0xd'));var Redis=require(_0xb111('0xe'));var authService=require(_0xb111('0xf'));var qs=require(_0xb111('0x10'));var as=require(_0xb111('0x11'));var hardwareService=require(_0xb111('0x12'));var logger=require(_0xb111('0x13'))('api');var utils=require(_0xb111('0x14'));var config=require(_0xb111('0x15'));var licenseUtil=require(_0xb111('0x16'));var db=require(_0xb111('0x17'))['db'];function respondWithStatusCode(_0x2f43d0,_0x41a050){_0x41a050=_0x41a050||0xcc;return function(_0x278a36){if(_0x278a36){return _0x2f43d0[_0xb111('0x18')](_0x41a050);}return _0x2f43d0[_0xb111('0x19')](_0x41a050)[_0xb111('0x1a')]();};}function respondWithResult(_0x4f9eb4,_0x2dd8d2){_0x2dd8d2=_0x2dd8d2||0xc8;return function(_0x1f8b66){if(_0x1f8b66){return _0x4f9eb4[_0xb111('0x19')](_0x2dd8d2)[_0xb111('0x1b')](_0x1f8b66);}};}function respondWithFilteredResult(_0x311b40,_0x5b32af){return function(_0x5e4bd4){if(_0x5e4bd4){var _0x42b3cd=typeof _0x5b32af[_0xb111('0x1c')]==='undefined'&&typeof _0x5b32af[_0xb111('0x1d')]===_0xb111('0x1e');var _0x4d8504=_0x5e4bd4[_0xb111('0x1f')];var _0x41a907=_0x42b3cd?0x0:_0x5b32af['offset'];var _0x34f6cb=_0x42b3cd?_0x5e4bd4[_0xb111('0x1f')]:_0x5b32af[_0xb111('0x1c')]+_0x5b32af[_0xb111('0x1d')];var _0x43c653;if(_0x34f6cb>=_0x4d8504){_0x34f6cb=_0x4d8504;_0x43c653=0xc8;}else{_0x43c653=0xce;}_0x311b40['status'](_0x43c653);return _0x311b40[_0xb111('0x20')](_0xb111('0x21'),_0x41a907+'-'+_0x34f6cb+'/'+_0x4d8504)['json'](_0x5e4bd4);}return null;};}function patchUpdates(_0x548e20){return function(_0x3d0d20){try{jsonpatch[_0xb111('0x22')](_0x3d0d20,_0x548e20,!![]);}catch(_0x406c53){return BPromise[_0xb111('0x23')](_0x406c53);}return _0x3d0d20[_0xb111('0x24')]();};}function saveUpdates(_0xbe5b24,_0x374657){return function(_0x19a392){if(_0x19a392){return _0x19a392[_0xb111('0x25')](_0xbe5b24)[_0xb111('0x26')](function(_0x35ba0c){return _0x35ba0c;});}return null;};}function removeEntity(_0x49678e,_0xac4bc6){return function(_0x3dd6ce){if(_0x3dd6ce){return _0x3dd6ce[_0xb111('0x27')]()['then'](function(){_0x49678e[_0xb111('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1b0d19,_0x5e0036){return function(_0x577e82){if(!_0x577e82){_0x1b0d19[_0xb111('0x18')](0x194);}return _0x577e82;};}function handleError(_0xb3ed07,_0x162464){_0x162464=_0x162464||0x1f4;return function(_0x14991e){logger[_0xb111('0x28')](_0x14991e[_0xb111('0x29')]);if(_0x14991e[_0xb111('0x2a')]){delete _0x14991e[_0xb111('0x2a')];}_0xb3ed07[_0xb111('0x19')](_0x162464)[_0xb111('0x2b')](_0x14991e);};}exports[_0xb111('0x2c')]=function(_0x2aafa8,_0x44c3e3){var _0x345ada={},_0x5621d3={},_0x3eda52={'count':0x0,'rows':[]};var _0xbd790f=_['map'](db[_0xb111('0x2d')][_0xb111('0x2e')],function(_0x39efcc){return{'name':_0x39efcc[_0xb111('0x2f')],'type':_0x39efcc[_0xb111('0x30')][_0xb111('0x31')]};});_0x5621d3[_0xb111('0x32')]=_[_0xb111('0x33')](_0xbd790f,'name');_0x5621d3['query']=_[_0xb111('0x34')](_0x2aafa8['query']);_0x5621d3[_0xb111('0x35')]=_[_0xb111('0x36')](_0x5621d3[_0xb111('0x32')],_0x5621d3[_0xb111('0x37')]);_0x345ada[_0xb111('0x38')]=_[_0xb111('0x36')](_0x5621d3[_0xb111('0x32')],qs['fields'](_0x2aafa8[_0xb111('0x37')][_0xb111('0x39')]));_0x345ada[_0xb111('0x38')]=_0x345ada['attributes'][_0xb111('0x3a')]?_0x345ada[_0xb111('0x38')]:_0x5621d3[_0xb111('0x32')];if(!_0x2aafa8['query'][_0xb111('0x3b')](_0xb111('0x3c'))){_0x345ada['limit']=qs['limit'](_0x2aafa8['query'][_0xb111('0x1d')]);_0x345ada['offset']=qs[_0xb111('0x1c')](_0x2aafa8[_0xb111('0x37')][_0xb111('0x1c')]);}_0x345ada[_0xb111('0x3d')]=qs[_0xb111('0x3e')](_0x2aafa8[_0xb111('0x37')][_0xb111('0x3e')]);_0x345ada[_0xb111('0x3f')]=qs['filters'](_[_0xb111('0x40')](_0x2aafa8[_0xb111('0x37')],_0x5621d3['filters']),_0xbd790f);if(_0x2aafa8[_0xb111('0x37')][_0xb111('0x41')]){_0x345ada[_0xb111('0x3f')]=_[_0xb111('0x42')](_0x345ada[_0xb111('0x3f')],{'$or':_[_0xb111('0x33')](_0xbd790f,function(_0x2deb00){if(_0x2deb00[_0xb111('0x30')]!=='VIRTUAL'){var _0x2b871b={};_0x2b871b[_0x2deb00[_0xb111('0x2a')]]={'$like':'%'+_0x2aafa8[_0xb111('0x37')]['filter']+'%'};return _0x2b871b;}})});}_0x345ada=_[_0xb111('0x42')]({},_0x345ada,_0x2aafa8[_0xb111('0x43')]);var _0x7eac72={'where':_0x345ada[_0xb111('0x3f')]};return db[_0xb111('0x2d')][_0xb111('0x1f')](_0x7eac72)[_0xb111('0x26')](function(_0x185086){_0x3eda52[_0xb111('0x1f')]=_0x185086;if(_0x2aafa8['query'][_0xb111('0x44')]){_0x345ada[_0xb111('0x45')]=[{'all':!![]}];}return db[_0xb111('0x2d')][_0xb111('0x46')](_0x345ada);})[_0xb111('0x26')](function(_0x39f667){_0x3eda52[_0xb111('0x47')]=_0x39f667;return _0x3eda52;})[_0xb111('0x26')](respondWithFilteredResult(_0x44c3e3,_0x345ada))[_0xb111('0x48')](handleError(_0x44c3e3,null));};exports[_0xb111('0x49')]=function(_0x5ee88f,_0x3ad900){var _0x98f54e={'raw':![],'where':{'id':_0x5ee88f['params']['id']}},_0x3e5b8f={};_0x3e5b8f['model']=_[_0xb111('0x34')](db[_0xb111('0x2d')]['rawAttributes']);_0x3e5b8f[_0xb111('0x37')]=_[_0xb111('0x34')](_0x5ee88f[_0xb111('0x37')]);_0x3e5b8f[_0xb111('0x35')]=_[_0xb111('0x36')](_0x3e5b8f['model'],_0x3e5b8f['query']);_0x98f54e[_0xb111('0x38')]=_[_0xb111('0x36')](_0x3e5b8f[_0xb111('0x32')],qs['fields'](_0x5ee88f[_0xb111('0x37')][_0xb111('0x39')]));_0x98f54e[_0xb111('0x38')]=_0x98f54e[_0xb111('0x38')][_0xb111('0x3a')]?_0x98f54e['attributes']:_0x3e5b8f[_0xb111('0x32')];if(_0x5ee88f[_0xb111('0x37')][_0xb111('0x44')]){_0x98f54e[_0xb111('0x45')]=[{'all':!![]}];}_0x98f54e=_[_0xb111('0x42')]({},_0x98f54e,_0x5ee88f[_0xb111('0x43')]);return db[_0xb111('0x2d')][_0xb111('0x4a')](_0x98f54e)['then'](handleEntityNotFound(_0x3ad900,null))['then'](respondWithResult(_0x3ad900,null))[_0xb111('0x48')](handleError(_0x3ad900,null));};exports[_0xb111('0x4b')]=function(_0x19bc6f,_0x4d388a){return db[_0xb111('0x2d')][_0xb111('0x4b')](_0x19bc6f[_0xb111('0x4c')],{})[_0xb111('0x26')](respondWithResult(_0x4d388a,0xc9))[_0xb111('0x48')](handleError(_0x4d388a,null));};exports[_0xb111('0x25')]=function(_0x1f336a,_0x263f77){if(_0x1f336a[_0xb111('0x4c')]['id']){delete _0x1f336a[_0xb111('0x4c')]['id'];}return db[_0xb111('0x2d')][_0xb111('0x4a')]({'where':{'id':_0x1f336a['params']['id']}})[_0xb111('0x26')](handleEntityNotFound(_0x263f77,null))[_0xb111('0x26')](saveUpdates(_0x1f336a[_0xb111('0x4c')],null))[_0xb111('0x26')](respondWithResult(_0x263f77,null))['catch'](handleError(_0x263f77,null));};exports[_0xb111('0x27')]=function(_0x5c20d3,_0x4651a7){return db['FreshdeskConfiguration'][_0xb111('0x4a')]({'where':{'id':_0x5c20d3[_0xb111('0x4d')]['id']}})[_0xb111('0x26')](handleEntityNotFound(_0x4651a7,null))['then'](removeEntity(_0x4651a7,null))['catch'](handleError(_0x4651a7,null));};exports[_0xb111('0x4e')]=function(_0x1940b7,_0x13edf5,_0x599019){var _0xd8dc3e={};var _0x164eac={};var _0x263e1b;var _0x531f3d;return db[_0xb111('0x2d')][_0xb111('0x4f')]({'where':{'id':_0x1940b7[_0xb111('0x4d')]['id']}})['then'](handleEntityNotFound(_0x13edf5,null))[_0xb111('0x26')](function(_0x45b1e5){if(_0x45b1e5){_0x263e1b=_0x45b1e5;_0x164eac[_0xb111('0x32')]=_[_0xb111('0x34')](db['FreshdeskField'][_0xb111('0x2e')]);_0x164eac[_0xb111('0x37')]=_['keys'](_0x1940b7[_0xb111('0x37')]);_0x164eac[_0xb111('0x35')]=_['intersection'](_0x164eac[_0xb111('0x32')],_0x164eac[_0xb111('0x37')]);_0xd8dc3e[_0xb111('0x38')]=_['intersection'](_0x164eac[_0xb111('0x32')],qs['fields'](_0x1940b7[_0xb111('0x37')]['fields']));_0xd8dc3e['attributes']=_0xd8dc3e['attributes']['length']?_0xd8dc3e[_0xb111('0x38')]:_0x164eac[_0xb111('0x32')];_0xd8dc3e['order']=qs[_0xb111('0x3e')](_0x1940b7[_0xb111('0x37')][_0xb111('0x3e')]);_0xd8dc3e[_0xb111('0x3f')]=qs[_0xb111('0x35')](_[_0xb111('0x40')](_0x1940b7[_0xb111('0x37')],_0x164eac['filters']));if(_0x1940b7[_0xb111('0x37')][_0xb111('0x41')]){_0xd8dc3e[_0xb111('0x3f')]=_[_0xb111('0x42')](_0xd8dc3e[_0xb111('0x3f')],{'$or':_[_0xb111('0x33')](_0xd8dc3e[_0xb111('0x38')],function(_0x3b07ea){var _0x557560={};_0x557560[_0x3b07ea]={'$like':'%'+_0x1940b7['query'][_0xb111('0x41')]+'%'};return _0x557560;})});}_0xd8dc3e=_['merge']({},_0xd8dc3e,_0x1940b7[_0xb111('0x43')]);return _0x263e1b[_0xb111('0x4e')](_0xd8dc3e);}})[_0xb111('0x26')](function(_0x3bba2e){if(_0x3bba2e){_0x531f3d=_0x3bba2e[_0xb111('0x3a')];if(!_0x1940b7[_0xb111('0x37')]['hasOwnProperty'](_0xb111('0x3c'))){_0xd8dc3e[_0xb111('0x1d')]=qs[_0xb111('0x1d')](_0x1940b7['query'][_0xb111('0x1d')]);_0xd8dc3e[_0xb111('0x1c')]=qs[_0xb111('0x1c')](_0x1940b7[_0xb111('0x37')][_0xb111('0x1c')]);}return _0x263e1b[_0xb111('0x4e')](_0xd8dc3e);}})['then'](function(_0x4f7164){if(_0x4f7164){return _0x4f7164?{'count':_0x531f3d,'rows':_0x4f7164}:null;}})[_0xb111('0x26')](respondWithResult(_0x13edf5,null))[_0xb111('0x48')](handleError(_0x13edf5,null));};exports[_0xb111('0x50')]=function(_0x2dae57,_0x42afde,_0x10ddc2){var _0x281546={};var _0x92036f={};var _0x1e5620;var _0x176ae2;return db['FreshdeskConfiguration'][_0xb111('0x4f')]({'where':{'id':_0x2dae57[_0xb111('0x4d')]['id']}})[_0xb111('0x26')](handleEntityNotFound(_0x42afde,null))[_0xb111('0x26')](function(_0x21d182){if(_0x21d182){_0x1e5620=_0x21d182;_0x92036f[_0xb111('0x32')]=_[_0xb111('0x34')](db[_0xb111('0x51')][_0xb111('0x2e')]);_0x92036f[_0xb111('0x37')]=_[_0xb111('0x34')](_0x2dae57[_0xb111('0x37')]);_0x92036f[_0xb111('0x35')]=_[_0xb111('0x36')](_0x92036f['model'],_0x92036f[_0xb111('0x37')]);_0x281546[_0xb111('0x38')]=_[_0xb111('0x36')](_0x92036f[_0xb111('0x32')],qs[_0xb111('0x39')](_0x2dae57[_0xb111('0x37')][_0xb111('0x39')]));_0x281546['attributes']=_0x281546[_0xb111('0x38')][_0xb111('0x3a')]?_0x281546[_0xb111('0x38')]:_0x92036f[_0xb111('0x32')];_0x281546[_0xb111('0x3d')]=qs[_0xb111('0x3e')](_0x2dae57['query'][_0xb111('0x3e')]);_0x281546[_0xb111('0x3f')]=qs[_0xb111('0x35')](_[_0xb111('0x40')](_0x2dae57['query'],_0x92036f['filters']));if(_0x2dae57[_0xb111('0x37')]['filter']){_0x281546[_0xb111('0x3f')]=_[_0xb111('0x42')](_0x281546[_0xb111('0x3f')],{'$or':_[_0xb111('0x33')](_0x281546[_0xb111('0x38')],function(_0x41ef4a){var _0x278819={};_0x278819[_0x41ef4a]={'$like':'%'+_0x2dae57[_0xb111('0x37')][_0xb111('0x41')]+'%'};return _0x278819;})});}_0x281546=_[_0xb111('0x42')]({},_0x281546,_0x2dae57[_0xb111('0x43')]);return _0x1e5620['getSubjects'](_0x281546);}})[_0xb111('0x26')](function(_0x3acc4b){if(_0x3acc4b){_0x176ae2=_0x3acc4b[_0xb111('0x3a')];if(!_0x2dae57[_0xb111('0x37')][_0xb111('0x3b')]('nolimit')){_0x281546[_0xb111('0x1d')]=qs[_0xb111('0x1d')](_0x2dae57[_0xb111('0x37')][_0xb111('0x1d')]);_0x281546['offset']=qs[_0xb111('0x1c')](_0x2dae57[_0xb111('0x37')]['offset']);}return _0x1e5620[_0xb111('0x50')](_0x281546);}})[_0xb111('0x26')](function(_0xe4094c){if(_0xe4094c){return _0xe4094c?{'count':_0x176ae2,'rows':_0xe4094c}:null;}})[_0xb111('0x26')](respondWithResult(_0x42afde,null))[_0xb111('0x48')](handleError(_0x42afde,null));};exports['getDescriptions']=function(_0x678722,_0xadb3e5,_0x181859){var _0x57b0e6={};var _0x2d039e={};var _0x2b4eee;var _0x301454;return db['FreshdeskConfiguration'][_0xb111('0x4f')]({'where':{'id':_0x678722[_0xb111('0x4d')]['id']}})[_0xb111('0x26')](handleEntityNotFound(_0xadb3e5,null))['then'](function(_0x5609de){if(_0x5609de){_0x2b4eee=_0x5609de;_0x2d039e['model']=_[_0xb111('0x34')](db['FreshdeskField'][_0xb111('0x2e')]);_0x2d039e['query']=_[_0xb111('0x34')](_0x678722[_0xb111('0x37')]);_0x2d039e['filters']=_[_0xb111('0x36')](_0x2d039e[_0xb111('0x32')],_0x2d039e['query']);_0x57b0e6[_0xb111('0x38')]=_['intersection'](_0x2d039e[_0xb111('0x32')],qs[_0xb111('0x39')](_0x678722[_0xb111('0x37')]['fields']));_0x57b0e6[_0xb111('0x38')]=_0x57b0e6['attributes'][_0xb111('0x3a')]?_0x57b0e6[_0xb111('0x38')]:_0x2d039e[_0xb111('0x32')];_0x57b0e6['order']=qs['sort'](_0x678722['query'][_0xb111('0x3e')]);_0x57b0e6[_0xb111('0x3f')]=qs['filters'](_['pick'](_0x678722[_0xb111('0x37')],_0x2d039e[_0xb111('0x35')]));if(_0x678722[_0xb111('0x37')][_0xb111('0x41')]){_0x57b0e6['where']=_[_0xb111('0x42')](_0x57b0e6['where'],{'$or':_[_0xb111('0x33')](_0x57b0e6['attributes'],function(_0x595d71){var _0x3a3f13={};_0x3a3f13[_0x595d71]={'$like':'%'+_0x678722['query']['filter']+'%'};return _0x3a3f13;})});}_0x57b0e6=_[_0xb111('0x42')]({},_0x57b0e6,_0x678722[_0xb111('0x43')]);return _0x2b4eee['getDescriptions'](_0x57b0e6);}})[_0xb111('0x26')](function(_0x54bad6){if(_0x54bad6){_0x301454=_0x54bad6['length'];if(!_0x678722[_0xb111('0x37')][_0xb111('0x3b')](_0xb111('0x3c'))){_0x57b0e6[_0xb111('0x1d')]=qs[_0xb111('0x1d')](_0x678722['query'][_0xb111('0x1d')]);_0x57b0e6[_0xb111('0x1c')]=qs[_0xb111('0x1c')](_0x678722[_0xb111('0x37')]['offset']);}return _0x2b4eee[_0xb111('0x52')](_0x57b0e6);}})[_0xb111('0x26')](function(_0x4ec620){if(_0x4ec620){return _0x4ec620?{'count':_0x301454,'rows':_0x4ec620}:null;}})[_0xb111('0x26')](respondWithResult(_0xadb3e5,null))[_0xb111('0x48')](handleError(_0xadb3e5,null));};exports[_0xb111('0x53')]=function(_0x14119a,_0x1c928b,_0xf466ab){var _0x4e3df9={};var _0x293111={};var _0x32518a;var _0x255238;return db[_0xb111('0x2d')][_0xb111('0x4f')]({'where':{'id':_0x14119a[_0xb111('0x4d')]['id']}})['then'](handleEntityNotFound(_0x1c928b,null))[_0xb111('0x26')](function(_0x1756f0){if(_0x1756f0){_0x32518a=_0x1756f0;_0x293111[_0xb111('0x32')]=_['keys'](db[_0xb111('0x54')][_0xb111('0x2e')]);_0x293111['query']=_[_0xb111('0x34')](_0x14119a[_0xb111('0x37')]);_0x293111[_0xb111('0x35')]=_[_0xb111('0x36')](_0x293111[_0xb111('0x32')],_0x293111['query']);_0x4e3df9[_0xb111('0x38')]=_['intersection'](_0x293111[_0xb111('0x32')],qs[_0xb111('0x39')](_0x14119a[_0xb111('0x37')]['fields']));_0x4e3df9[_0xb111('0x38')]=_0x4e3df9[_0xb111('0x38')][_0xb111('0x3a')]?_0x4e3df9['attributes']:_0x293111[_0xb111('0x32')];_0x4e3df9[_0xb111('0x3d')]=qs['sort'](_0x14119a[_0xb111('0x37')][_0xb111('0x3e')]);_0x4e3df9[_0xb111('0x3f')]=qs[_0xb111('0x35')](_[_0xb111('0x40')](_0x14119a[_0xb111('0x37')],_0x293111[_0xb111('0x35')]));if(_0x14119a[_0xb111('0x37')][_0xb111('0x41')]){_0x4e3df9['where']=_[_0xb111('0x42')](_0x4e3df9[_0xb111('0x3f')],{'$or':_[_0xb111('0x33')](_0x4e3df9[_0xb111('0x38')],function(_0x17af1b){var _0xac1fb9={};_0xac1fb9[_0x17af1b]={'$like':'%'+_0x14119a['query']['filter']+'%'};return _0xac1fb9;})});}_0x4e3df9=_['merge']({},_0x4e3df9,_0x14119a[_0xb111('0x43')]);return _0x32518a[_0xb111('0x53')](_0x4e3df9);}})[_0xb111('0x26')](function(_0x3eea54){if(_0x3eea54){_0x255238=_0x3eea54[_0xb111('0x3a')];if(!_0x14119a[_0xb111('0x37')][_0xb111('0x3b')](_0xb111('0x3c'))){_0x4e3df9[_0xb111('0x1d')]=qs['limit'](_0x14119a[_0xb111('0x37')][_0xb111('0x1d')]);_0x4e3df9[_0xb111('0x1c')]=qs[_0xb111('0x1c')](_0x14119a[_0xb111('0x37')][_0xb111('0x1c')]);}return _0x32518a[_0xb111('0x53')](_0x4e3df9);}})[_0xb111('0x26')](function(_0x46f494){if(_0x46f494){return _0x46f494?{'count':_0x255238,'rows':_0x46f494}:null;}})[_0xb111('0x26')](respondWithResult(_0x1c928b,null))[_0xb111('0x48')](handleError(_0x1c928b,null));};exports[_0xb111('0x55')]=function(_0x11c06c,_0x52950d,_0x3137e1){if(_0x11c06c[_0xb111('0x4c')]['id']){delete _0x11c06c['body']['id'];}return db[_0xb111('0x2d')]['findOne']({'where':{'id':_0x11c06c['params']['id']}})[_0xb111('0x26')](handleEntityNotFound(_0x52950d,null))[_0xb111('0x26')](function(_0x537ee2){if(_0x537ee2){return _0x537ee2['setTags'](_0x11c06c[_0xb111('0x4c')][_0xb111('0x56')]||[]);}return null;})['then'](respondWithResult(_0x52950d,null))[_0xb111('0x48')](handleError(_0x52950d,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 8a378b7..5c1c420 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 _0x7da1=['rimraf','../../config/environment','define','FreshdeskConfiguration','int_freshdesk_configurations','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x4eb24f,_0x9d1734){var _0x2f5de3=function(_0x464b24){while(--_0x464b24){_0x4eb24f['push'](_0x4eb24f['shift']());}};_0x2f5de3(++_0x9d1734);}(_0x7da1,0x19f));var _0x17da=function(_0x4defab,_0x14578a){_0x4defab=_0x4defab-0x0;var _0xb0114=_0x7da1[_0x4defab];return _0xb0114;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x17da('0x0'))('api');var moment=require(_0x17da('0x1'));var BPromise=require(_0x17da('0x2'));var rp=require(_0x17da('0x3'));var fs=require('fs');var path=require(_0x17da('0x4'));var rimraf=require(_0x17da('0x5'));var config=require(_0x17da('0x6'));var attributes=require('./intFreshdeskConfiguration.attributes');module['exports']=function(_0x4b8b38,_0xbd7290){return _0x4b8b38[_0x17da('0x7')](_0x17da('0x8'),attributes,{'tableName':_0x17da('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfbe8=['rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','define','FreshdeskConfiguration','int_freshdesk_configurations','util','api','moment','bluebird','request-promise','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfbe8,0x162));var _0x8fbe=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xfbe8[_0xfae23b];return _0x200640;};'use strict';var _=require('lodash');var util=require(_0x8fbe('0x0'));var logger=require('../../config/logger')(_0x8fbe('0x1'));var moment=require(_0x8fbe('0x2'));var BPromise=require(_0x8fbe('0x3'));var rp=require(_0x8fbe('0x4'));var fs=require('fs');var path=require(_0x8fbe('0x5'));var rimraf=require(_0x8fbe('0x6'));var config=require(_0x8fbe('0x7'));var attributes=require(_0x8fbe('0x8'));module['exports']=function(_0x53bb14,_0x1d8020){return _0x53bb14[_0x8fbe('0x9')](_0x8fbe('0xa'),attributes,{'tableName':_0x8fbe('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 462e08e..02d6839 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 _0x4b2b=['http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0xf64702,_0x200185){var _0x571ba6=function(_0x579fb3){while(--_0x579fb3){_0xf64702['push'](_0xf64702['shift']());}};_0x571ba6(++_0x200185);}(_0x4b2b,0x160));var _0xb4b2=function(_0xcebb08,_0x564b45){_0xcebb08=_0xcebb08-0x0;var _0x593352=_0x4b2b[_0xcebb08];return _0x593352;};'use strict';var _=require(_0xb4b2('0x0'));var util=require(_0xb4b2('0x1'));var moment=require(_0xb4b2('0x2'));var BPromise=require(_0xb4b2('0x3'));var rs=require(_0xb4b2('0x4'));var fs=require('fs');var Redis=require(_0xb4b2('0x5'));var db=require(_0xb4b2('0x6'))['db'];var utils=require(_0xb4b2('0x7'));var logger=require(_0xb4b2('0x8'))(_0xb4b2('0x9'));var config=require('../../config/environment');var jayson=require(_0xb4b2('0xa'));var client=jayson[_0xb4b2('0xb')][_0xb4b2('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2d7156,_0x219709,_0xc603f4){return new BPromise(function(_0x2502da,_0x3d6675){return client[_0xb4b2('0xd')](_0x2d7156,_0xc603f4)[_0xb4b2('0xe')](function(_0x55d5f2){logger[_0xb4b2('0xf')](_0xb4b2('0x10'),_0x219709,'request\x20sent');logger[_0xb4b2('0x11')](_0xb4b2('0x12'),_0x219709,_0xb4b2('0x13'),JSON[_0xb4b2('0x14')](_0x55d5f2));if(_0x55d5f2[_0xb4b2('0x15')]){if(_0x55d5f2['error'][_0xb4b2('0x16')]===0x1f4){logger[_0xb4b2('0x15')](_0xb4b2('0x10'),_0x219709,_0x55d5f2['error'][_0xb4b2('0x17')]);return _0x3d6675(_0x55d5f2[_0xb4b2('0x15')][_0xb4b2('0x17')]);}logger['error']('FreshdeskConfiguration,\x20%s,\x20%s',_0x219709,_0x55d5f2['error']['message']);return _0x2502da(_0x55d5f2[_0xb4b2('0x15')][_0xb4b2('0x17')]);}else{logger[_0xb4b2('0xf')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x219709,_0xb4b2('0x13'));_0x2502da(_0x55d5f2[_0xb4b2('0x18')]['message']);}})[_0xb4b2('0x19')](function(_0x4eb1ff){logger[_0xb4b2('0x15')](_0xb4b2('0x10'),_0x219709,_0x4eb1ff);_0x3d6675(_0x4eb1ff);});});} \ No newline at end of file +var _0xc757=['FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','request','then','info'];(function(_0x241ef5,_0x17f16a){var _0x2e72e7=function(_0x3cf233){while(--_0x3cf233){_0x241ef5['push'](_0x241ef5['shift']());}};_0x2e72e7(++_0x17f16a);}(_0xc757,0x1d4));var _0x7c75=function(_0x2844de,_0x560469){_0x2844de=_0x2844de-0x0;var _0x37be61=_0xc757[_0x2844de];return _0x37be61;};'use strict';var _=require(_0x7c75('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x7c75('0x1'));var rs=require(_0x7c75('0x2'));var fs=require('fs');var Redis=require(_0x7c75('0x3'));var db=require(_0x7c75('0x4'))['db'];var utils=require(_0x7c75('0x5'));var logger=require(_0x7c75('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7c75('0x7')][_0x7c75('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x59e62c,_0x432ba1,_0x1cea0b){return new BPromise(function(_0x314786,_0x1fdb21){return client[_0x7c75('0x9')](_0x59e62c,_0x1cea0b)[_0x7c75('0xa')](function(_0x2bdcf4){logger[_0x7c75('0xb')](_0x7c75('0xc'),_0x432ba1,_0x7c75('0xd'));logger[_0x7c75('0xe')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x432ba1,_0x7c75('0xd'),JSON['stringify'](_0x2bdcf4));if(_0x2bdcf4[_0x7c75('0xf')]){if(_0x2bdcf4['error'][_0x7c75('0x10')]===0x1f4){logger[_0x7c75('0xf')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x432ba1,_0x2bdcf4[_0x7c75('0xf')][_0x7c75('0x11')]);return _0x1fdb21(_0x2bdcf4['error'][_0x7c75('0x11')]);}logger[_0x7c75('0xf')](_0x7c75('0xc'),_0x432ba1,_0x2bdcf4[_0x7c75('0xf')][_0x7c75('0x11')]);return _0x314786(_0x2bdcf4[_0x7c75('0xf')][_0x7c75('0x11')]);}else{logger[_0x7c75('0xb')](_0x7c75('0xc'),_0x432ba1,_0x7c75('0xd'));_0x314786(_0x2bdcf4[_0x7c75('0x12')][_0x7c75('0x11')]);}})[_0x7c75('0x13')](function(_0x4b53fc){logger[_0x7c75('0xf')](_0x7c75('0xc'),_0x432ba1,_0x4b53fc);_0x1fdb21(_0x4b53fc);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index c69b855..c8e4fbc 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 _0xf91c=['update','delete','exports','util','path','express','fs-extra','../../components/interaction/service','get','isAuthenticated','index','/:id','show','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf91c,0xf1));var _0xcf91=function(_0x5fae11,_0x812d2a){_0x5fae11=_0x5fae11-0x0;var _0x22695b=_0xf91c[_0x5fae11];return _0x22695b;};'use strict';var multer=require('multer');var util=require(_0xcf91('0x0'));var path=require(_0xcf91('0x1'));var timeout=require('connect-timeout');var express=require(_0xcf91('0x2'));var router=express['Router']();var fs_extra=require(_0xcf91('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xcf91('0x4'));var config=require('../../config/environment');var controller=require('./intFreshdeskField.controller');router[_0xcf91('0x5')]('/',auth[_0xcf91('0x6')](),controller[_0xcf91('0x7')]);router[_0xcf91('0x5')](_0xcf91('0x8'),auth['isAuthenticated'](),controller[_0xcf91('0x9')]);router['post']('/',auth[_0xcf91('0x6')](),controller[_0xcf91('0xa')]);router['put'](_0xcf91('0x8'),auth[_0xcf91('0x6')](),controller[_0xcf91('0xb')]);router[_0xcf91('0xc')](_0xcf91('0x8'),auth[_0xcf91('0x6')](),controller['destroy']);module[_0xcf91('0xd')]=router; \ No newline at end of file +var _0x5176=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','post','put','/:id','update','delete','destroy','exports','util','path','connect-timeout'];(function(_0x3d7056,_0xbb4258){var _0x464a0f=function(_0x4a7fdf){while(--_0x4a7fdf){_0x3d7056['push'](_0x3d7056['shift']());}};_0x464a0f(++_0xbb4258);}(_0x5176,0x179));var _0x6517=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x5176[_0x122ef9];return _0x42fba0;};'use strict';var multer=require('multer');var util=require(_0x6517('0x0'));var path=require(_0x6517('0x1'));var timeout=require(_0x6517('0x2'));var express=require(_0x6517('0x3'));var router=express[_0x6517('0x4')]();var fs_extra=require(_0x6517('0x5'));var auth=require(_0x6517('0x6'));var interaction=require(_0x6517('0x7'));var config=require(_0x6517('0x8'));var controller=require('./intFreshdeskField.controller');router[_0x6517('0x9')]('/',auth[_0x6517('0xa')](),controller[_0x6517('0xb')]);router[_0x6517('0x9')]('/:id',auth[_0x6517('0xa')](),controller[_0x6517('0xc')]);router[_0x6517('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x6517('0xe')](_0x6517('0xf'),auth['isAuthenticated'](),controller[_0x6517('0x10')]);router[_0x6517('0x11')](_0x6517('0xf'),auth[_0x6517('0xa')](),controller[_0x6517('0x12')]);module[_0x6517('0x13')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 68a4d53..33bf0c1 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 _0x30bd=['picklist','STRING','BOOLEAN','exports','ENUM','string','variable','keyValue'];(function(_0x31295c,_0x2f2b82){var _0x2c150e=function(_0x957f1){while(--_0x957f1){_0x31295c['push'](_0x31295c['shift']());}};_0x2c150e(++_0x2f2b82);}(_0x30bd,0xf3));var _0xd30b=function(_0x4973ac,_0x114f1c){_0x4973ac=_0x4973ac-0x0;var _0x46b976=_0x30bd[_0x4973ac];return _0x46b976;};'use strict';var Sequelize=require('sequelize');module[_0xd30b('0x0')]={'type':{'type':Sequelize[_0xd30b('0x1')](_0xd30b('0x2'),_0xd30b('0x3'),'customVariable',_0xd30b('0x4'),_0xd30b('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0xd30b('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xd30b('0x1')](_0xd30b('0x2'),_0xd30b('0x3'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xd30b('0x6')]},'nameField':{'type':Sequelize[_0xd30b('0x6')]},'customField':{'type':Sequelize[_0xd30b('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd30b('0x6')]}}; \ No newline at end of file +var _0xaf3d=['sequelize','exports','string','variable','keyValue','STRING','ENUM','BOOLEAN'];(function(_0x692ffb,_0xf40122){var _0x473fad=function(_0x4be1d5){while(--_0x4be1d5){_0x692ffb['push'](_0x692ffb['shift']());}};_0x473fad(++_0xf40122);}(_0xaf3d,0x1e8));var _0xdaf3=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xaf3d[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xdaf3('0x0'));module[_0xdaf3('0x1')]={'type':{'type':Sequelize['ENUM'](_0xdaf3('0x2'),_0xdaf3('0x3'),'customVariable',_0xdaf3('0x4'),'picklist'),'defaultValue':_0xdaf3('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xdaf3('0x5')]},'keyType':{'type':Sequelize[_0xdaf3('0x6')]('string',_0xdaf3('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0xdaf3('0x5')]},'idField':{'type':Sequelize[_0xdaf3('0x5')]},'nameField':{'type':Sequelize[_0xdaf3('0x5')]},'customField':{'type':Sequelize[_0xdaf3('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xdaf3('0x5')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 08cf0b1..607fabc 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 _0xfe57=['moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','apply','reject','save','update','then','name','send','map','FreshdeskField','fieldName','key','model','query','filters','intersection','fields','attributes','length','sort','where','filter','merge','type','VIRTUAL','options','include','findAll','rows','params','keys','includeAll','find','catch','create','body','destroy','eml-format','rimraf','request-promise'];(function(_0x319192,_0x5cb4d7){var _0x500af8=function(_0x257698){while(--_0x257698){_0x319192['push'](_0x319192['shift']());}};_0x500af8(++_0x5cb4d7);}(_0xfe57,0x195));var _0x7fe5=function(_0x3e2fcf,_0x579110){_0x3e2fcf=_0x3e2fcf-0x0;var _0x497db7=_0xfe57[_0x3e2fcf];return _0x497db7;};'use strict';var emlformat=require(_0x7fe5('0x0'));var rimraf=require(_0x7fe5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7fe5('0x2'));var moment=require(_0x7fe5('0x3'));var BPromise=require(_0x7fe5('0x4'));var Mustache=require(_0x7fe5('0x5'));var util=require(_0x7fe5('0x6'));var path=require(_0x7fe5('0x7'));var sox=require(_0x7fe5('0x8'));var csv=require(_0x7fe5('0x9'));var ejs=require(_0x7fe5('0xa'));var fs=require('fs');var fs_extra=require(_0x7fe5('0xb'));var _=require(_0x7fe5('0xc'));var squel=require(_0x7fe5('0xd'));var crypto=require(_0x7fe5('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x7fe5('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7fe5('0x10'));var Papa=require(_0x7fe5('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7fe5('0x12'));var as=require(_0x7fe5('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7fe5('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x7fe5('0x15'));var licenseUtil=require(_0x7fe5('0x16'));var db=require(_0x7fe5('0x17'))['db'];function respondWithStatusCode(_0x225fc3,_0x53f76c){_0x53f76c=_0x53f76c||0xcc;return function(_0x329c95){if(_0x329c95){return _0x225fc3[_0x7fe5('0x18')](_0x53f76c);}return _0x225fc3['status'](_0x53f76c)[_0x7fe5('0x19')]();};}function respondWithResult(_0x54cfb2,_0x1f84b5){_0x1f84b5=_0x1f84b5||0xc8;return function(_0x2d297b){if(_0x2d297b){return _0x54cfb2['status'](_0x1f84b5)[_0x7fe5('0x1a')](_0x2d297b);}};}function respondWithFilteredResult(_0x56e76f,_0x39f175){return function(_0x221ab2){if(_0x221ab2){var _0xbdf0a4=typeof _0x39f175[_0x7fe5('0x1b')]===_0x7fe5('0x1c')&&typeof _0x39f175[_0x7fe5('0x1d')]==='undefined';var _0x166e23=_0x221ab2[_0x7fe5('0x1e')];var _0x340d5e=_0xbdf0a4?0x0:_0x39f175[_0x7fe5('0x1b')];var _0x2533db=_0xbdf0a4?_0x221ab2[_0x7fe5('0x1e')]:_0x39f175[_0x7fe5('0x1b')]+_0x39f175[_0x7fe5('0x1d')];var _0x478523;if(_0x2533db>=_0x166e23){_0x2533db=_0x166e23;_0x478523=0xc8;}else{_0x478523=0xce;}_0x56e76f[_0x7fe5('0x1f')](_0x478523);return _0x56e76f['set']('Content-Range',_0x340d5e+'-'+_0x2533db+'/'+_0x166e23)[_0x7fe5('0x1a')](_0x221ab2);}return null;};}function patchUpdates(_0x459c2d){return function(_0x2f6592){try{jsonpatch[_0x7fe5('0x20')](_0x2f6592,_0x459c2d,!![]);}catch(_0x39c560){return BPromise[_0x7fe5('0x21')](_0x39c560);}return _0x2f6592[_0x7fe5('0x22')]();};}function saveUpdates(_0xdd9df7,_0x1b271c){return function(_0x28a7fd){if(_0x28a7fd){return _0x28a7fd[_0x7fe5('0x23')](_0xdd9df7)[_0x7fe5('0x24')](function(_0x54ee98){return _0x54ee98;});}return null;};}function removeEntity(_0x3e7340,_0x2f39e0){return function(_0x43e547){if(_0x43e547){return _0x43e547['destroy']()[_0x7fe5('0x24')](function(){_0x3e7340['status'](0xcc)[_0x7fe5('0x19')]();});}};}function handleEntityNotFound(_0x53f522,_0x5c3b37){return function(_0x190355){if(!_0x190355){_0x53f522[_0x7fe5('0x18')](0x194);}return _0x190355;};}function handleError(_0x2a96f4,_0x399c55){_0x399c55=_0x399c55||0x1f4;return function(_0x4393c3){logger['error'](_0x4393c3['stack']);if(_0x4393c3[_0x7fe5('0x25')]){delete _0x4393c3[_0x7fe5('0x25')];}_0x2a96f4[_0x7fe5('0x1f')](_0x399c55)[_0x7fe5('0x26')](_0x4393c3);};}exports['index']=function(_0x46f816,_0x4a77e9){var _0x150ab9={},_0x1420de={},_0x204bc8={'count':0x0,'rows':[]};var _0x28a689=_[_0x7fe5('0x27')](db[_0x7fe5('0x28')]['rawAttributes'],function(_0xe521c6){return{'name':_0xe521c6[_0x7fe5('0x29')],'type':_0xe521c6['type'][_0x7fe5('0x2a')]};});_0x1420de[_0x7fe5('0x2b')]=_[_0x7fe5('0x27')](_0x28a689,_0x7fe5('0x25'));_0x1420de[_0x7fe5('0x2c')]=_['keys'](_0x46f816['query']);_0x1420de[_0x7fe5('0x2d')]=_[_0x7fe5('0x2e')](_0x1420de[_0x7fe5('0x2b')],_0x1420de[_0x7fe5('0x2c')]);_0x150ab9['attributes']=_[_0x7fe5('0x2e')](_0x1420de[_0x7fe5('0x2b')],qs[_0x7fe5('0x2f')](_0x46f816[_0x7fe5('0x2c')][_0x7fe5('0x2f')]));_0x150ab9[_0x7fe5('0x30')]=_0x150ab9['attributes'][_0x7fe5('0x31')]?_0x150ab9[_0x7fe5('0x30')]:_0x1420de[_0x7fe5('0x2b')];if(!_0x46f816[_0x7fe5('0x2c')]['hasOwnProperty']('nolimit')){_0x150ab9[_0x7fe5('0x1d')]=qs['limit'](_0x46f816[_0x7fe5('0x2c')]['limit']);_0x150ab9[_0x7fe5('0x1b')]=qs['offset'](_0x46f816['query']['offset']);}_0x150ab9['order']=qs[_0x7fe5('0x32')](_0x46f816[_0x7fe5('0x2c')]['sort']);_0x150ab9[_0x7fe5('0x33')]=qs[_0x7fe5('0x2d')](_['pick'](_0x46f816[_0x7fe5('0x2c')],_0x1420de['filters']),_0x28a689);if(_0x46f816['query'][_0x7fe5('0x34')]){_0x150ab9[_0x7fe5('0x33')]=_[_0x7fe5('0x35')](_0x150ab9[_0x7fe5('0x33')],{'$or':_[_0x7fe5('0x27')](_0x28a689,function(_0x4c4b05){if(_0x4c4b05[_0x7fe5('0x36')]!==_0x7fe5('0x37')){var _0x5839b2={};_0x5839b2[_0x4c4b05[_0x7fe5('0x25')]]={'$like':'%'+_0x46f816[_0x7fe5('0x2c')][_0x7fe5('0x34')]+'%'};return _0x5839b2;}})});}_0x150ab9=_[_0x7fe5('0x35')]({},_0x150ab9,_0x46f816[_0x7fe5('0x38')]);var _0x1c81c8={'where':_0x150ab9[_0x7fe5('0x33')]};return db['FreshdeskField']['count'](_0x1c81c8)[_0x7fe5('0x24')](function(_0x5f5db0){_0x204bc8[_0x7fe5('0x1e')]=_0x5f5db0;if(_0x46f816[_0x7fe5('0x2c')]['includeAll']){_0x150ab9[_0x7fe5('0x39')]=[{'all':!![]}];}return db[_0x7fe5('0x28')][_0x7fe5('0x3a')](_0x150ab9);})[_0x7fe5('0x24')](function(_0x2fd004){_0x204bc8[_0x7fe5('0x3b')]=_0x2fd004;return _0x204bc8;})[_0x7fe5('0x24')](respondWithFilteredResult(_0x4a77e9,_0x150ab9))['catch'](handleError(_0x4a77e9,null));};exports['show']=function(_0x411002,_0x4f81ca){var _0xad0b05={'raw':!![],'where':{'id':_0x411002[_0x7fe5('0x3c')]['id']}},_0x1a3e0d={};_0x1a3e0d[_0x7fe5('0x2b')]=_['keys'](db[_0x7fe5('0x28')]['rawAttributes']);_0x1a3e0d['query']=_[_0x7fe5('0x3d')](_0x411002[_0x7fe5('0x2c')]);_0x1a3e0d['filters']=_[_0x7fe5('0x2e')](_0x1a3e0d[_0x7fe5('0x2b')],_0x1a3e0d[_0x7fe5('0x2c')]);_0xad0b05[_0x7fe5('0x30')]=_[_0x7fe5('0x2e')](_0x1a3e0d['model'],qs[_0x7fe5('0x2f')](_0x411002[_0x7fe5('0x2c')]['fields']));_0xad0b05[_0x7fe5('0x30')]=_0xad0b05[_0x7fe5('0x30')][_0x7fe5('0x31')]?_0xad0b05[_0x7fe5('0x30')]:_0x1a3e0d['model'];if(_0x411002[_0x7fe5('0x2c')][_0x7fe5('0x3e')]){_0xad0b05[_0x7fe5('0x39')]=[{'all':!![]}];}_0xad0b05=_['merge']({},_0xad0b05,_0x411002[_0x7fe5('0x38')]);return db[_0x7fe5('0x28')][_0x7fe5('0x3f')](_0xad0b05)['then'](handleEntityNotFound(_0x4f81ca,null))[_0x7fe5('0x24')](respondWithResult(_0x4f81ca,null))[_0x7fe5('0x40')](handleError(_0x4f81ca,null));};exports[_0x7fe5('0x41')]=function(_0x4b8642,_0x19c4a6){return db[_0x7fe5('0x28')][_0x7fe5('0x41')](_0x4b8642[_0x7fe5('0x42')],{})[_0x7fe5('0x24')](respondWithResult(_0x19c4a6,0xc9))[_0x7fe5('0x40')](handleError(_0x19c4a6,null));};exports[_0x7fe5('0x23')]=function(_0x447b57,_0x446f01){if(_0x447b57[_0x7fe5('0x42')]['id']){delete _0x447b57[_0x7fe5('0x42')]['id'];}return db['FreshdeskField']['find']({'where':{'id':_0x447b57['params']['id']}})['then'](handleEntityNotFound(_0x446f01,null))[_0x7fe5('0x24')](saveUpdates(_0x447b57['body'],null))[_0x7fe5('0x24')](respondWithResult(_0x446f01,null))[_0x7fe5('0x40')](handleError(_0x446f01,null));};exports[_0x7fe5('0x43')]=function(_0x1d9ca8,_0x362f33){return db['FreshdeskField'][_0x7fe5('0x3f')]({'where':{'id':_0x1d9ca8[_0x7fe5('0x3c')]['id']}})[_0x7fe5('0x24')](handleEntityNotFound(_0x362f33,null))[_0x7fe5('0x24')](removeEntity(_0x362f33,null))[_0x7fe5('0x40')](handleError(_0x362f33,null));}; \ No newline at end of file +var _0x574d=['reject','save','update','then','destroy','error','name','send','map','FreshdeskField','rawAttributes','fieldName','type','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','filter','findAll','catch','show','params','includeAll','include','options','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','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','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply'];(function(_0x55f455,_0x1e46c7){var _0x2a50a9=function(_0x2a79a5){while(--_0x2a79a5){_0x55f455['push'](_0x55f455['shift']());}};_0x2a50a9(++_0x1e46c7);}(_0x574d,0xc0));var _0xd574=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0x574d[_0x1e4360];return _0x31e6b4;};'use strict';var emlformat=require(_0xd574('0x0'));var rimraf=require(_0xd574('0x1'));var zipdir=require(_0xd574('0x2'));var jsonpatch=require(_0xd574('0x3'));var rp=require(_0xd574('0x4'));var moment=require(_0xd574('0x5'));var BPromise=require(_0xd574('0x6'));var Mustache=require('mustache');var util=require(_0xd574('0x7'));var path=require(_0xd574('0x8'));var sox=require(_0xd574('0x9'));var csv=require(_0xd574('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd574('0xb'));var _=require(_0xd574('0xc'));var squel=require(_0xd574('0xd'));var crypto=require(_0xd574('0xe'));var jsforce=require(_0xd574('0xf'));var deskjs=require(_0xd574('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd574('0x11'));var Redis=require(_0xd574('0x12'));var authService=require(_0xd574('0x13'));var qs=require(_0xd574('0x14'));var as=require(_0xd574('0x15'));var hardwareService=require(_0xd574('0x16'));var logger=require(_0xd574('0x17'))('api');var utils=require(_0xd574('0x18'));var config=require(_0xd574('0x19'));var licenseUtil=require(_0xd574('0x1a'));var db=require(_0xd574('0x1b'))['db'];function respondWithStatusCode(_0x1ddedb,_0x6c93de){_0x6c93de=_0x6c93de||0xcc;return function(_0x8dd760){if(_0x8dd760){return _0x1ddedb[_0xd574('0x1c')](_0x6c93de);}return _0x1ddedb[_0xd574('0x1d')](_0x6c93de)[_0xd574('0x1e')]();};}function respondWithResult(_0x43e251,_0x2cc660){_0x2cc660=_0x2cc660||0xc8;return function(_0x564b36){if(_0x564b36){return _0x43e251[_0xd574('0x1d')](_0x2cc660)[_0xd574('0x1f')](_0x564b36);}};}function respondWithFilteredResult(_0x2d66be,_0x1537f4){return function(_0x46fb4c){if(_0x46fb4c){var _0x341463=typeof _0x1537f4[_0xd574('0x20')]===_0xd574('0x21')&&typeof _0x1537f4['limit']==='undefined';var _0x1486c7=_0x46fb4c[_0xd574('0x22')];var _0x2ac01d=_0x341463?0x0:_0x1537f4['offset'];var _0x58a74b=_0x341463?_0x46fb4c[_0xd574('0x22')]:_0x1537f4[_0xd574('0x20')]+_0x1537f4[_0xd574('0x23')];var _0x46e331;if(_0x58a74b>=_0x1486c7){_0x58a74b=_0x1486c7;_0x46e331=0xc8;}else{_0x46e331=0xce;}_0x2d66be[_0xd574('0x1d')](_0x46e331);return _0x2d66be[_0xd574('0x24')](_0xd574('0x25'),_0x2ac01d+'-'+_0x58a74b+'/'+_0x1486c7)[_0xd574('0x1f')](_0x46fb4c);}return null;};}function patchUpdates(_0xefe45f){return function(_0x9f980d){try{jsonpatch[_0xd574('0x26')](_0x9f980d,_0xefe45f,!![]);}catch(_0x587f62){return BPromise[_0xd574('0x27')](_0x587f62);}return _0x9f980d[_0xd574('0x28')]();};}function saveUpdates(_0x481564,_0x39c39d){return function(_0x5e5b9f){if(_0x5e5b9f){return _0x5e5b9f[_0xd574('0x29')](_0x481564)[_0xd574('0x2a')](function(_0x199756){return _0x199756;});}return null;};}function removeEntity(_0x3f85cf,_0x1aec00){return function(_0x72d2b8){if(_0x72d2b8){return _0x72d2b8[_0xd574('0x2b')]()[_0xd574('0x2a')](function(){_0x3f85cf[_0xd574('0x1d')](0xcc)[_0xd574('0x1e')]();});}};}function handleEntityNotFound(_0x1fbd81,_0x44ddae){return function(_0x3e0501){if(!_0x3e0501){_0x1fbd81[_0xd574('0x1c')](0x194);}return _0x3e0501;};}function handleError(_0x5f1456,_0x441f13){_0x441f13=_0x441f13||0x1f4;return function(_0x53142f){logger[_0xd574('0x2c')](_0x53142f['stack']);if(_0x53142f['name']){delete _0x53142f[_0xd574('0x2d')];}_0x5f1456[_0xd574('0x1d')](_0x441f13)[_0xd574('0x2e')](_0x53142f);};}exports['index']=function(_0x2a8e86,_0x30e49e){var _0x8eefda={},_0x9761f5={},_0x508eaa={'count':0x0,'rows':[]};var _0x5298d7=_[_0xd574('0x2f')](db[_0xd574('0x30')][_0xd574('0x31')],function(_0x23a495){return{'name':_0x23a495[_0xd574('0x32')],'type':_0x23a495[_0xd574('0x33')]['key']};});_0x9761f5['model']=_[_0xd574('0x2f')](_0x5298d7,_0xd574('0x2d'));_0x9761f5[_0xd574('0x34')]=_[_0xd574('0x35')](_0x2a8e86[_0xd574('0x34')]);_0x9761f5[_0xd574('0x36')]=_[_0xd574('0x37')](_0x9761f5[_0xd574('0x38')],_0x9761f5['query']);_0x8eefda['attributes']=_[_0xd574('0x37')](_0x9761f5[_0xd574('0x38')],qs[_0xd574('0x39')](_0x2a8e86[_0xd574('0x34')][_0xd574('0x39')]));_0x8eefda['attributes']=_0x8eefda[_0xd574('0x3a')][_0xd574('0x3b')]?_0x8eefda[_0xd574('0x3a')]:_0x9761f5[_0xd574('0x38')];if(!_0x2a8e86[_0xd574('0x34')][_0xd574('0x3c')](_0xd574('0x3d'))){_0x8eefda['limit']=qs[_0xd574('0x23')](_0x2a8e86['query'][_0xd574('0x23')]);_0x8eefda[_0xd574('0x20')]=qs[_0xd574('0x20')](_0x2a8e86[_0xd574('0x34')][_0xd574('0x20')]);}_0x8eefda[_0xd574('0x3e')]=qs[_0xd574('0x3f')](_0x2a8e86[_0xd574('0x34')][_0xd574('0x3f')]);_0x8eefda[_0xd574('0x40')]=qs[_0xd574('0x36')](_['pick'](_0x2a8e86[_0xd574('0x34')],_0x9761f5[_0xd574('0x36')]),_0x5298d7);if(_0x2a8e86[_0xd574('0x34')]['filter']){_0x8eefda[_0xd574('0x40')]=_[_0xd574('0x41')](_0x8eefda[_0xd574('0x40')],{'$or':_[_0xd574('0x2f')](_0x5298d7,function(_0x15d429){if(_0x15d429[_0xd574('0x33')]!=='VIRTUAL'){var _0x1dbeb9={};_0x1dbeb9[_0x15d429[_0xd574('0x2d')]]={'$like':'%'+_0x2a8e86[_0xd574('0x34')][_0xd574('0x42')]+'%'};return _0x1dbeb9;}})});}_0x8eefda=_[_0xd574('0x41')]({},_0x8eefda,_0x2a8e86['options']);var _0x3f79c4={'where':_0x8eefda[_0xd574('0x40')]};return db[_0xd574('0x30')]['count'](_0x3f79c4)['then'](function(_0x4a0e67){_0x508eaa[_0xd574('0x22')]=_0x4a0e67;if(_0x2a8e86['query']['includeAll']){_0x8eefda['include']=[{'all':!![]}];}return db[_0xd574('0x30')][_0xd574('0x43')](_0x8eefda);})[_0xd574('0x2a')](function(_0x20b570){_0x508eaa['rows']=_0x20b570;return _0x508eaa;})[_0xd574('0x2a')](respondWithFilteredResult(_0x30e49e,_0x8eefda))[_0xd574('0x44')](handleError(_0x30e49e,null));};exports[_0xd574('0x45')]=function(_0x411ecb,_0x4a580c){var _0x1bf7c5={'raw':!![],'where':{'id':_0x411ecb[_0xd574('0x46')]['id']}},_0x4caf06={};_0x4caf06[_0xd574('0x38')]=_[_0xd574('0x35')](db[_0xd574('0x30')][_0xd574('0x31')]);_0x4caf06[_0xd574('0x34')]=_[_0xd574('0x35')](_0x411ecb[_0xd574('0x34')]);_0x4caf06[_0xd574('0x36')]=_[_0xd574('0x37')](_0x4caf06[_0xd574('0x38')],_0x4caf06[_0xd574('0x34')]);_0x1bf7c5[_0xd574('0x3a')]=_['intersection'](_0x4caf06[_0xd574('0x38')],qs['fields'](_0x411ecb['query'][_0xd574('0x39')]));_0x1bf7c5[_0xd574('0x3a')]=_0x1bf7c5['attributes'][_0xd574('0x3b')]?_0x1bf7c5[_0xd574('0x3a')]:_0x4caf06[_0xd574('0x38')];if(_0x411ecb['query'][_0xd574('0x47')]){_0x1bf7c5[_0xd574('0x48')]=[{'all':!![]}];}_0x1bf7c5=_[_0xd574('0x41')]({},_0x1bf7c5,_0x411ecb[_0xd574('0x49')]);return db[_0xd574('0x30')][_0xd574('0x4a')](_0x1bf7c5)['then'](handleEntityNotFound(_0x4a580c,null))[_0xd574('0x2a')](respondWithResult(_0x4a580c,null))[_0xd574('0x44')](handleError(_0x4a580c,null));};exports[_0xd574('0x4b')]=function(_0x8c305c,_0x14d08b){return db[_0xd574('0x30')][_0xd574('0x4b')](_0x8c305c[_0xd574('0x4c')],{})[_0xd574('0x2a')](respondWithResult(_0x14d08b,0xc9))[_0xd574('0x44')](handleError(_0x14d08b,null));};exports[_0xd574('0x29')]=function(_0x3aa4e6,_0x1cad77){if(_0x3aa4e6[_0xd574('0x4c')]['id']){delete _0x3aa4e6[_0xd574('0x4c')]['id'];}return db[_0xd574('0x30')]['find']({'where':{'id':_0x3aa4e6[_0xd574('0x46')]['id']}})[_0xd574('0x2a')](handleEntityNotFound(_0x1cad77,null))['then'](saveUpdates(_0x3aa4e6[_0xd574('0x4c')],null))[_0xd574('0x2a')](respondWithResult(_0x1cad77,null))[_0xd574('0x44')](handleError(_0x1cad77,null));};exports[_0xd574('0x2b')]=function(_0x2fcf85,_0x1426fb){return db[_0xd574('0x30')][_0xd574('0x4a')]({'where':{'id':_0x2fcf85[_0xd574('0x46')]['id']}})[_0xd574('0x2a')](handleEntityNotFound(_0x1426fb,null))['then'](removeEntity(_0x1426fb,null))[_0xd574('0x44')](handleError(_0x1426fb,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 921ad70..60ba6dd 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 _0xfe5d=['../../config/environment','./intFreshdeskField.attributes','exports','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0xfe5d,0x1ba));var _0xdfe5=function(_0xb520a5,_0x2cef0a){_0xb520a5=_0xb520a5-0x0;var _0xa0f8ef=_0xfe5d[_0xb520a5];return _0xa0f8ef;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xdfe5('0x0'))('api');var moment=require(_0xdfe5('0x1'));var BPromise=require(_0xdfe5('0x2'));var rp=require(_0xdfe5('0x3'));var fs=require('fs');var path=require(_0xdfe5('0x4'));var rimraf=require(_0xdfe5('0x5'));var config=require(_0xdfe5('0x6'));var attributes=require(_0xdfe5('0x7'));module[_0xdfe5('0x8')]=function(_0x283c91,_0x58e02d){return _0x283c91[_0xdfe5('0x9')](_0xdfe5('0xa'),attributes,{'tableName':_0xdfe5('0xb'),'paranoid':![],'indexes':[{'name':_0xdfe5('0xc'),'fields':[_0xdfe5('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x95ce=['exports','define','FreshdeskField','int_freshdesk_fields','FieldId','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskField.attributes'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0x95ce,0x1e6));var _0xe95c=function(_0x5131e4,_0x145fa4){_0x5131e4=_0x5131e4-0x0;var _0x254c6c=_0x95ce[_0x5131e4];return _0x254c6c;};'use strict';var _=require('lodash');var util=require(_0xe95c('0x0'));var logger=require(_0xe95c('0x1'))('api');var moment=require('moment');var BPromise=require(_0xe95c('0x2'));var rp=require(_0xe95c('0x3'));var fs=require('fs');var path=require(_0xe95c('0x4'));var rimraf=require(_0xe95c('0x5'));var config=require(_0xe95c('0x6'));var attributes=require(_0xe95c('0x7'));module[_0xe95c('0x8')]=function(_0x423077,_0x5277d2){return _0x423077[_0xe95c('0x9')](_0xe95c('0xa'),attributes,{'tableName':_0xe95c('0xb'),'paranoid':![],'indexes':[{'name':'freshdesk_unique_index','fields':['idField',_0xe95c('0xc')],'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 6e9809b..189ec3e 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 _0x41ca=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x34ae48,_0x662ff5){var _0x19b539=function(_0x24a8fe){while(--_0x24a8fe){_0x34ae48['push'](_0x34ae48['shift']());}};_0x19b539(++_0x662ff5);}(_0x41ca,0x90));var _0xa41c=function(_0x2e421e,_0x59b2d8){_0x2e421e=_0x2e421e-0x0;var _0x269a02=_0x41ca[_0x2e421e];return _0x269a02;};'use strict';var _=require(_0xa41c('0x0'));var util=require(_0xa41c('0x1'));var moment=require(_0xa41c('0x2'));var BPromise=require(_0xa41c('0x3'));var rs=require(_0xa41c('0x4'));var fs=require('fs');var Redis=require(_0xa41c('0x5'));var db=require(_0xa41c('0x6'))['db'];var utils=require(_0xa41c('0x7'));var logger=require('../../config/logger')(_0xa41c('0x8'));var config=require(_0xa41c('0x9'));var jayson=require(_0xa41c('0xa'));var client=jayson[_0xa41c('0xb')][_0xa41c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x26918a,_0x2ac6f2,_0x2f4bc4){return new BPromise(function(_0x1dedd8,_0xd82c6f){return client[_0xa41c('0xd')](_0x26918a,_0x2f4bc4)[_0xa41c('0xe')](function(_0x1b02ed){logger['info'](_0xa41c('0xf'),_0x2ac6f2,_0xa41c('0x10'));logger[_0xa41c('0x11')](_0xa41c('0x12'),_0x2ac6f2,_0xa41c('0x10'),JSON[_0xa41c('0x13')](_0x1b02ed));if(_0x1b02ed[_0xa41c('0x14')]){if(_0x1b02ed['error'][_0xa41c('0x15')]===0x1f4){logger[_0xa41c('0x14')](_0xa41c('0xf'),_0x2ac6f2,_0x1b02ed[_0xa41c('0x14')][_0xa41c('0x16')]);return _0xd82c6f(_0x1b02ed[_0xa41c('0x14')][_0xa41c('0x16')]);}logger[_0xa41c('0x14')](_0xa41c('0xf'),_0x2ac6f2,_0x1b02ed[_0xa41c('0x14')][_0xa41c('0x16')]);return _0x1dedd8(_0x1b02ed[_0xa41c('0x14')][_0xa41c('0x16')]);}else{logger[_0xa41c('0x17')](_0xa41c('0xf'),_0x2ac6f2,'request\x20sent');_0x1dedd8(_0x1b02ed['result'][_0xa41c('0x16')]);}})[_0xa41c('0x18')](function(_0x2158de){logger[_0xa41c('0x14')](_0xa41c('0xf'),_0x2ac6f2,_0x2158de);_0xd82c6f(_0x2158de);});});} \ No newline at end of file +var _0xc0c1=['request','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0xf88f4d,_0x3bd588){var _0x3dcfba=function(_0x139746){while(--_0x139746){_0xf88f4d['push'](_0xf88f4d['shift']());}};_0x3dcfba(++_0x3bd588);}(_0xc0c1,0x81));var _0x1c0c=function(_0x9641cb,_0x3bc3df){_0x9641cb=_0x9641cb-0x0;var _0x1a3294=_0xc0c1[_0x9641cb];return _0x1a3294;};'use strict';var _=require(_0x1c0c('0x0'));var util=require(_0x1c0c('0x1'));var moment=require('moment');var BPromise=require(_0x1c0c('0x2'));var rs=require(_0x1c0c('0x3'));var fs=require('fs');var Redis=require(_0x1c0c('0x4'));var db=require(_0x1c0c('0x5'))['db'];var utils=require(_0x1c0c('0x6'));var logger=require('../../config/logger')(_0x1c0c('0x7'));var config=require(_0x1c0c('0x8'));var jayson=require(_0x1c0c('0x9'));var client=jayson[_0x1c0c('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x12c78b,_0x3f9631,_0x1f4bd4){return new BPromise(function(_0x38fdd1,_0x5a8957){return client[_0x1c0c('0xb')](_0x12c78b,_0x1f4bd4)['then'](function(_0x13c0a9){logger[_0x1c0c('0xc')](_0x1c0c('0xd'),_0x3f9631,_0x1c0c('0xe'));logger['debug'](_0x1c0c('0xf'),_0x3f9631,_0x1c0c('0xe'),JSON[_0x1c0c('0x10')](_0x13c0a9));if(_0x13c0a9[_0x1c0c('0x11')]){if(_0x13c0a9[_0x1c0c('0x11')][_0x1c0c('0x12')]===0x1f4){logger[_0x1c0c('0x11')](_0x1c0c('0xd'),_0x3f9631,_0x13c0a9[_0x1c0c('0x11')]['message']);return _0x5a8957(_0x13c0a9[_0x1c0c('0x11')]['message']);}logger['error'](_0x1c0c('0xd'),_0x3f9631,_0x13c0a9[_0x1c0c('0x11')]['message']);return _0x38fdd1(_0x13c0a9['error'][_0x1c0c('0x13')]);}else{logger['info']('FreshdeskField,\x20%s,\x20%s',_0x3f9631,_0x1c0c('0xe'));_0x38fdd1(_0x13c0a9['result']['message']);}})['catch'](function(_0x51364d){logger[_0x1c0c('0x11')](_0x1c0c('0xd'),_0x3f9631,_0x51364d);_0x5a8957(_0x51364d);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 3d7aee4..4f6125a 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 _0x4fc2=['connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./intFreshsalesAccount.controller','isAuthenticated','index','/:id','show','get','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','update','delete','exports','multer','util','path'];(function(_0x44e7f6,_0x3b8abb){var _0xa375dd=function(_0x1cd84f){while(--_0x1cd84f){_0x44e7f6['push'](_0x44e7f6['shift']());}};_0xa375dd(++_0x3b8abb);}(_0x4fc2,0x111));var _0x24fc=function(_0x407d0f,_0x5cafa2){_0x407d0f=_0x407d0f-0x0;var _0xdeeb73=_0x4fc2[_0x407d0f];return _0xdeeb73;};'use strict';var multer=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var path=require(_0x24fc('0x2'));var timeout=require(_0x24fc('0x3'));var express=require('express');var router=express[_0x24fc('0x4')]();var fs_extra=require(_0x24fc('0x5'));var auth=require(_0x24fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x24fc('0x7'));var controller=require(_0x24fc('0x8'));router['get']('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0xa')]);router['get'](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0xc')]);router[_0x24fc('0xd')](_0x24fc('0xe'),auth[_0x24fc('0x9')](),controller['getConfigurations']);router[_0x24fc('0xd')](_0x24fc('0xf'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x10')]);router[_0x24fc('0x11')]('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0x12')]);router[_0x24fc('0x11')]('/:id/configurations',auth[_0x24fc('0x9')](),controller[_0x24fc('0x13')]);router['put'](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x14')]);router[_0x24fc('0x15')](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller['destroy']);module[_0x24fc('0x16')]=router; \ No newline at end of file +var _0x9348=['../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','show','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','/:id','update','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x300860,_0x509371){var _0x2094ad=function(_0x2090a2){while(--_0x2090a2){_0x300860['push'](_0x300860['shift']());}};_0x2094ad(++_0x509371);}(_0x9348,0x10d));var _0x8934=function(_0x45f4af,_0x1f902d){_0x45f4af=_0x45f4af-0x0;var _0x29f808=_0x9348[_0x45f4af];return _0x29f808;};'use strict';var multer=require(_0x8934('0x0'));var util=require(_0x8934('0x1'));var path=require(_0x8934('0x2'));var timeout=require(_0x8934('0x3'));var express=require(_0x8934('0x4'));var router=express['Router']();var fs_extra=require(_0x8934('0x5'));var auth=require(_0x8934('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8934('0x7'));var controller=require(_0x8934('0x8'));router[_0x8934('0x9')]('/',auth[_0x8934('0xa')](),controller[_0x8934('0xb')]);router[_0x8934('0x9')]('/:id',auth[_0x8934('0xa')](),controller[_0x8934('0xc')]);router[_0x8934('0x9')]('/:id/configurations',auth['isAuthenticated'](),controller['getConfigurations']);router['get'](_0x8934('0xd'),auth['isAuthenticated'](),controller[_0x8934('0xe')]);router[_0x8934('0xf')]('/',auth[_0x8934('0xa')](),controller[_0x8934('0x10')]);router[_0x8934('0xf')](_0x8934('0x11'),auth[_0x8934('0xa')](),controller[_0x8934('0x12')]);router['put'](_0x8934('0x13'),auth[_0x8934('0xa')](),controller[_0x8934('0x14')]);router[_0x8934('0x15')](_0x8934('0x13'),auth[_0x8934('0xa')](),controller['destroy']);module[_0x8934('0x16')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index a801d5f..3f305a3 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 _0x77d4=['exports','STRING','username'];(function(_0x32c9b9,_0x21a0cf){var _0x239eab=function(_0x25fceb){while(--_0x25fceb){_0x32c9b9['push'](_0x32c9b9['shift']());}};_0x239eab(++_0x21a0cf);}(_0x77d4,0x108));var _0x477d=function(_0x3c33c4,_0x3490ea){_0x3c33c4=_0x3c33c4-0x0;var _0x2c4b73=_0x77d4[_0x3c33c4];return _0x2c4b73;};'use strict';var Sequelize=require('sequelize');module[_0x477d('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x477d('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0x477d('0x2')},'apiKey':{'type':Sequelize[_0x477d('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x477d('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x4137=['STRING','username','remoteUri','sequelize','exports'];(function(_0x23bc41,_0x4d2165){var _0x228730=function(_0x1c911c){while(--_0x1c911c){_0x23bc41['push'](_0x23bc41['shift']());}};_0x228730(++_0x4d2165);}(_0x4137,0xf8));var _0x7413=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x4137[_0x57b54c];return _0x59cc19;};'use strict';var Sequelize=require(_0x7413('0x0'));module[_0x7413('0x1')]={'name':{'type':Sequelize[_0x7413('0x2')]},'description':{'type':Sequelize[_0x7413('0x2')]},'username':{'type':Sequelize[_0x7413('0x2')],'unique':_0x7413('0x3')},'apiKey':{'type':Sequelize[_0x7413('0x2')]},'remoteUri':{'type':Sequelize[_0x7413('0x2')],'unique':_0x7413('0x4')},'serverUrl':{'type':Sequelize[_0x7413('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index 007f8fa..0587f6d 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 _0xcc9f=['users','email','Requested\x20Resource\x20not\x20Found','test','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','end','offset','undefined','count','limit','status','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','index','map','FreshsalesAccount','fieldName','key','query','keys','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','type','options','includeAll','include','rows','catch','show','params','rawAttributes','find','create','body','findOne','getConfigurations','hasOwnProperty','AccountId','Subjects','getSubjects','channel','Descriptions','FreshsalesConfiguration','FreshsalesField','getFields','username','remoteUri','slice','substring','GET','Token\x20token=','apiKey'];(function(_0xb2454d,_0x291753){var _0x5464fb=function(_0x386805){while(--_0x386805){_0xb2454d['push'](_0xb2454d['shift']());}};_0x5464fb(++_0x291753);}(_0xcc9f,0x1a4));var _0xfcc9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcc9f[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xfcc9('0x0'));var rimraf=require(_0xfcc9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfcc9('0x2'));var rp=require(_0xfcc9('0x3'));var moment=require(_0xfcc9('0x4'));var BPromise=require(_0xfcc9('0x5'));var Mustache=require(_0xfcc9('0x6'));var util=require(_0xfcc9('0x7'));var path=require(_0xfcc9('0x8'));var sox=require(_0xfcc9('0x9'));var csv=require('to-csv');var ejs=require(_0xfcc9('0xa'));var fs=require('fs');var fs_extra=require(_0xfcc9('0xb'));var _=require('lodash');var squel=require(_0xfcc9('0xc'));var crypto=require(_0xfcc9('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xfcc9('0xe'));var toCsv=require(_0xfcc9('0xf'));var querystring=require(_0xfcc9('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xfcc9('0x11'));var qs=require(_0xfcc9('0x12'));var as=require(_0xfcc9('0x13'));var hardwareService=require(_0xfcc9('0x14'));var logger=require(_0xfcc9('0x15'))('api');var utils=require(_0xfcc9('0x16'));var config=require(_0xfcc9('0x17'));var licenseUtil=require(_0xfcc9('0x18'));var db=require('../../mysqldb')['db'];var integrations=require(_0xfcc9('0x19'));function respondWithStatusCode(_0x5d42b6,_0x151545){_0x151545=_0x151545||0xcc;return function(_0x4052b0){if(_0x4052b0){return _0x5d42b6[_0xfcc9('0x1a')](_0x151545);}return _0x5d42b6['status'](_0x151545)[_0xfcc9('0x1b')]();};}function respondWithResult(_0x238ffe,_0x5ed76a){_0x5ed76a=_0x5ed76a||0xc8;return function(_0x286683){if(_0x286683){return _0x238ffe['status'](_0x5ed76a)['json'](_0x286683);}};}function respondWithFilteredResult(_0x556e77,_0x5f0d30){return function(_0x1a8de2){if(_0x1a8de2){var _0x426b12=typeof _0x5f0d30[_0xfcc9('0x1c')]===_0xfcc9('0x1d')&&typeof _0x5f0d30['limit']==='undefined';var _0x247ce2=_0x1a8de2[_0xfcc9('0x1e')];var _0x3eedf6=_0x426b12?0x0:_0x5f0d30[_0xfcc9('0x1c')];var _0x2f0055=_0x426b12?_0x1a8de2[_0xfcc9('0x1e')]:_0x5f0d30[_0xfcc9('0x1c')]+_0x5f0d30[_0xfcc9('0x1f')];var _0x2eddbc;if(_0x2f0055>=_0x247ce2){_0x2f0055=_0x247ce2;_0x2eddbc=0xc8;}else{_0x2eddbc=0xce;}_0x556e77[_0xfcc9('0x20')](_0x2eddbc);return _0x556e77[_0xfcc9('0x21')](_0xfcc9('0x22'),_0x3eedf6+'-'+_0x2f0055+'/'+_0x247ce2)[_0xfcc9('0x23')](_0x1a8de2);}return null;};}function patchUpdates(_0x471f8c){return function(_0x493fb8){try{jsonpatch[_0xfcc9('0x24')](_0x493fb8,_0x471f8c,!![]);}catch(_0x1804e5){return BPromise[_0xfcc9('0x25')](_0x1804e5);}return _0x493fb8[_0xfcc9('0x26')]();};}function saveUpdates(_0x7f5bfd,_0x11bf90){return function(_0x526e19){if(_0x526e19){return _0x526e19[_0xfcc9('0x27')](_0x7f5bfd)[_0xfcc9('0x28')](function(_0x2568f9){return _0x2568f9;});}return null;};}function removeEntity(_0x1ca315,_0x178426){return function(_0x26e1dc){if(_0x26e1dc){return _0x26e1dc[_0xfcc9('0x29')]()['then'](function(){_0x1ca315[_0xfcc9('0x20')](0xcc)[_0xfcc9('0x1b')]();});}};}function handleEntityNotFound(_0x3b6113,_0x1a89ab){return function(_0x32ce1d){if(!_0x32ce1d){_0x3b6113[_0xfcc9('0x1a')](0x194);}return _0x32ce1d;};}function handleError(_0x4fcbb7,_0x2aba31){_0x2aba31=_0x2aba31||0x1f4;return function(_0x2d7c93){logger[_0xfcc9('0x2a')](_0x2d7c93[_0xfcc9('0x2b')]);if(_0x2d7c93[_0xfcc9('0x2c')]){delete _0x2d7c93[_0xfcc9('0x2c')];}_0x4fcbb7[_0xfcc9('0x20')](_0x2aba31)['send'](_0x2d7c93);};}exports[_0xfcc9('0x2d')]=function(_0x140faf,_0x2152bf){var _0x2686aa={},_0x30ce91={},_0x108321={'count':0x0,'rows':[]};var _0xc9ca99=_[_0xfcc9('0x2e')](db[_0xfcc9('0x2f')]['rawAttributes'],function(_0x5d675e){return{'name':_0x5d675e[_0xfcc9('0x30')],'type':_0x5d675e['type'][_0xfcc9('0x31')]};});_0x30ce91['model']=_[_0xfcc9('0x2e')](_0xc9ca99,_0xfcc9('0x2c'));_0x30ce91[_0xfcc9('0x32')]=_[_0xfcc9('0x33')](_0x140faf['query']);_0x30ce91[_0xfcc9('0x34')]=_[_0xfcc9('0x35')](_0x30ce91[_0xfcc9('0x36')],_0x30ce91[_0xfcc9('0x32')]);_0x2686aa['attributes']=_[_0xfcc9('0x35')](_0x30ce91[_0xfcc9('0x36')],qs[_0xfcc9('0x37')](_0x140faf[_0xfcc9('0x32')]['fields']));_0x2686aa[_0xfcc9('0x38')]=_0x2686aa[_0xfcc9('0x38')][_0xfcc9('0x39')]?_0x2686aa['attributes']:_0x30ce91[_0xfcc9('0x36')];if(!_0x140faf[_0xfcc9('0x32')]['hasOwnProperty'](_0xfcc9('0x3a'))){_0x2686aa[_0xfcc9('0x1f')]=qs[_0xfcc9('0x1f')](_0x140faf['query'][_0xfcc9('0x1f')]);_0x2686aa[_0xfcc9('0x1c')]=qs[_0xfcc9('0x1c')](_0x140faf[_0xfcc9('0x32')][_0xfcc9('0x1c')]);}_0x2686aa[_0xfcc9('0x3b')]=qs[_0xfcc9('0x3c')](_0x140faf[_0xfcc9('0x32')][_0xfcc9('0x3c')]);_0x2686aa[_0xfcc9('0x3d')]=qs[_0xfcc9('0x34')](_[_0xfcc9('0x3e')](_0x140faf[_0xfcc9('0x32')],_0x30ce91[_0xfcc9('0x34')]),_0xc9ca99);if(_0x140faf[_0xfcc9('0x32')][_0xfcc9('0x3f')]){_0x2686aa[_0xfcc9('0x3d')]=_[_0xfcc9('0x40')](_0x2686aa[_0xfcc9('0x3d')],{'$or':_[_0xfcc9('0x2e')](_0xc9ca99,function(_0x2f4b57){if(_0x2f4b57[_0xfcc9('0x41')]!=='VIRTUAL'){var _0x236d6a={};_0x236d6a[_0x2f4b57[_0xfcc9('0x2c')]]={'$like':'%'+_0x140faf[_0xfcc9('0x32')][_0xfcc9('0x3f')]+'%'};return _0x236d6a;}})});}_0x2686aa=_[_0xfcc9('0x40')]({},_0x2686aa,_0x140faf[_0xfcc9('0x42')]);var _0x3cc925={'where':_0x2686aa[_0xfcc9('0x3d')]};return db[_0xfcc9('0x2f')][_0xfcc9('0x1e')](_0x3cc925)['then'](function(_0xe62139){_0x108321[_0xfcc9('0x1e')]=_0xe62139;if(_0x140faf[_0xfcc9('0x32')][_0xfcc9('0x43')]){_0x2686aa[_0xfcc9('0x44')]=[{'all':!![]}];}return db['FreshsalesAccount']['findAll'](_0x2686aa);})[_0xfcc9('0x28')](function(_0x36f1fb){_0x108321[_0xfcc9('0x45')]=_0x36f1fb;return _0x108321;})[_0xfcc9('0x28')](respondWithFilteredResult(_0x2152bf,_0x2686aa))[_0xfcc9('0x46')](handleError(_0x2152bf,null));};exports[_0xfcc9('0x47')]=function(_0x57b5ac,_0x4a37bc){var _0x692792={'raw':![],'where':{'id':_0x57b5ac[_0xfcc9('0x48')]['id']}},_0x38e878={};_0x38e878[_0xfcc9('0x36')]=_['keys'](db[_0xfcc9('0x2f')][_0xfcc9('0x49')]);_0x38e878['query']=_[_0xfcc9('0x33')](_0x57b5ac[_0xfcc9('0x32')]);_0x38e878[_0xfcc9('0x34')]=_[_0xfcc9('0x35')](_0x38e878[_0xfcc9('0x36')],_0x38e878['query']);_0x692792[_0xfcc9('0x38')]=_[_0xfcc9('0x35')](_0x38e878['model'],qs['fields'](_0x57b5ac['query']['fields']));_0x692792[_0xfcc9('0x38')]=_0x692792[_0xfcc9('0x38')][_0xfcc9('0x39')]?_0x692792[_0xfcc9('0x38')]:_0x38e878[_0xfcc9('0x36')];if(_0x57b5ac[_0xfcc9('0x32')][_0xfcc9('0x43')]){_0x692792[_0xfcc9('0x44')]=[{'all':!![]}];}_0x692792=_[_0xfcc9('0x40')]({},_0x692792,_0x57b5ac[_0xfcc9('0x42')]);return db[_0xfcc9('0x2f')][_0xfcc9('0x4a')](_0x692792)[_0xfcc9('0x28')](handleEntityNotFound(_0x4a37bc,null))[_0xfcc9('0x28')](respondWithResult(_0x4a37bc,null))[_0xfcc9('0x46')](handleError(_0x4a37bc,null));};exports['create']=function(_0x1f6899,_0x1f9f9f){return db['FreshsalesAccount'][_0xfcc9('0x4b')](_0x1f6899['body'],{})[_0xfcc9('0x28')](respondWithResult(_0x1f9f9f,0xc9))[_0xfcc9('0x46')](handleError(_0x1f9f9f,null));};exports[_0xfcc9('0x27')]=function(_0x3a4227,_0x4fae25){if(_0x3a4227['body']['id']){delete _0x3a4227[_0xfcc9('0x4c')]['id'];}return db[_0xfcc9('0x2f')][_0xfcc9('0x4a')]({'where':{'id':_0x3a4227[_0xfcc9('0x48')]['id']}})[_0xfcc9('0x28')](handleEntityNotFound(_0x4fae25,null))[_0xfcc9('0x28')](saveUpdates(_0x3a4227['body'],null))[_0xfcc9('0x28')](respondWithResult(_0x4fae25,null))[_0xfcc9('0x46')](handleError(_0x4fae25,null));};exports[_0xfcc9('0x29')]=function(_0x4cfcbf,_0x23628b){return db[_0xfcc9('0x2f')]['find']({'where':{'id':_0x4cfcbf['params']['id']}})[_0xfcc9('0x28')](handleEntityNotFound(_0x23628b,null))['then'](removeEntity(_0x23628b,null))[_0xfcc9('0x46')](handleError(_0x23628b,null));};exports['getConfigurations']=function(_0x297ca4,_0x52e95d,_0x28002a){var _0x40b583={};var _0x8e4a51={};var _0x1ae087;var _0x5e26b4;return db[_0xfcc9('0x2f')][_0xfcc9('0x4d')]({'where':{'id':_0x297ca4[_0xfcc9('0x48')]['id']}})[_0xfcc9('0x28')](handleEntityNotFound(_0x52e95d,null))[_0xfcc9('0x28')](function(_0x4059d8){if(_0x4059d8){_0x1ae087=_0x4059d8;_0x8e4a51[_0xfcc9('0x36')]=_[_0xfcc9('0x33')](db['FreshsalesConfiguration']['rawAttributes']);_0x8e4a51[_0xfcc9('0x32')]=_[_0xfcc9('0x33')](_0x297ca4[_0xfcc9('0x32')]);_0x8e4a51[_0xfcc9('0x34')]=_[_0xfcc9('0x35')](_0x8e4a51[_0xfcc9('0x36')],_0x8e4a51[_0xfcc9('0x32')]);_0x40b583[_0xfcc9('0x38')]=_[_0xfcc9('0x35')](_0x8e4a51[_0xfcc9('0x36')],qs['fields'](_0x297ca4[_0xfcc9('0x32')][_0xfcc9('0x37')]));_0x40b583['attributes']=_0x40b583[_0xfcc9('0x38')][_0xfcc9('0x39')]?_0x40b583[_0xfcc9('0x38')]:_0x8e4a51[_0xfcc9('0x36')];_0x40b583[_0xfcc9('0x3b')]=qs[_0xfcc9('0x3c')](_0x297ca4[_0xfcc9('0x32')][_0xfcc9('0x3c')]);_0x40b583[_0xfcc9('0x3d')]=qs['filters'](_['pick'](_0x297ca4[_0xfcc9('0x32')],_0x8e4a51[_0xfcc9('0x34')]));if(_0x297ca4['query']['filter']){_0x40b583[_0xfcc9('0x3d')]=_[_0xfcc9('0x40')](_0x40b583[_0xfcc9('0x3d')],{'$or':_['map'](_0x40b583[_0xfcc9('0x38')],function(_0x49a43c){var _0x2ae88c={};_0x2ae88c[_0x49a43c]={'$like':'%'+_0x297ca4[_0xfcc9('0x32')][_0xfcc9('0x3f')]+'%'};return _0x2ae88c;})});}_0x40b583=_[_0xfcc9('0x40')]({},_0x40b583,_0x297ca4[_0xfcc9('0x42')]);return _0x1ae087[_0xfcc9('0x4e')](_0x40b583);}})[_0xfcc9('0x28')](function(_0x487271){if(_0x487271){_0x5e26b4=_0x487271[_0xfcc9('0x39')];if(!_0x297ca4['query'][_0xfcc9('0x4f')](_0xfcc9('0x3a'))){_0x40b583[_0xfcc9('0x1f')]=qs[_0xfcc9('0x1f')](_0x297ca4[_0xfcc9('0x32')][_0xfcc9('0x1f')]);_0x40b583[_0xfcc9('0x1c')]=qs[_0xfcc9('0x1c')](_0x297ca4['query'][_0xfcc9('0x1c')]);}return _0x1ae087[_0xfcc9('0x4e')](_0x40b583);}})[_0xfcc9('0x28')](function(_0x2c662a){if(_0x2c662a){return _0x2c662a?{'count':_0x5e26b4,'rows':_0x2c662a}:null;}})['then'](respondWithResult(_0x52e95d,null))[_0xfcc9('0x46')](handleError(_0x52e95d,null));};exports['addConfiguration']=function(_0x4ba3ae,_0x25452b,_0x497774){if(_0x4ba3ae[_0xfcc9('0x4c')]['id']){delete _0x4ba3ae[_0xfcc9('0x4c')]['id'];}return db[_0xfcc9('0x2f')][_0xfcc9('0x4d')]({'where':{'id':_0x4ba3ae['params']['id']}})[_0xfcc9('0x28')](handleEntityNotFound(_0x25452b,null))['then'](function(_0x441f5){if(_0x441f5){_0x4ba3ae[_0xfcc9('0x4c')][_0xfcc9('0x50')]=_0x441f5['id'];_0x4ba3ae['body'][_0xfcc9('0x51')]=integrations[_0xfcc9('0x52')](_0x4ba3ae[_0xfcc9('0x4c')][_0xfcc9('0x53')],_0x4ba3ae[_0xfcc9('0x4c')][_0xfcc9('0x41')]);_0x4ba3ae[_0xfcc9('0x4c')][_0xfcc9('0x54')]=integrations['getDescriptions'](_0x4ba3ae['body'][_0xfcc9('0x53')],_0x4ba3ae[_0xfcc9('0x4c')]['type']);return db[_0xfcc9('0x55')][_0xfcc9('0x4b')](_0x4ba3ae[_0xfcc9('0x4c')],{'include':[{'model':db['FreshsalesField'],'as':_0xfcc9('0x51')},{'model':db[_0xfcc9('0x56')],'as':'Descriptions'}]});}return null;})[_0xfcc9('0x28')](respondWithResult(_0x25452b,null))[_0xfcc9('0x46')](handleError(_0x25452b,null));};exports[_0xfcc9('0x57')]=function(_0x3a5af3,_0x40bf45,_0xa2209a){var _0x2f0cd4='';var _0x1227ea='';return db[_0xfcc9('0x2f')][_0xfcc9('0x4d')]({'where':{'id':_0x3a5af3['params']['id']},'attributes':['id',_0xfcc9('0x58'),_0xfcc9('0x59'),'apiKey']})[_0xfcc9('0x28')](handleEntityNotFound(_0x40bf45,null))[_0xfcc9('0x28')](function(_0x1fcc92){if(_0x1fcc92){_0x1227ea=_0x1fcc92[_0xfcc9('0x58')];_0x2f0cd4=_0x1fcc92[_0xfcc9('0x59')];var _0x108e47=_0x1fcc92[_0xfcc9('0x59')][_0xfcc9('0x5a')](-0x1);if(_0x108e47==='/'){_0x2f0cd4=_0x2f0cd4[_0xfcc9('0x5b')](0x0,_0x2f0cd4['lastIndexOf'](_0x108e47));}return rp({'method':_0xfcc9('0x5c'),'uri':util['format']('%s%s',_0x2f0cd4,'/api/selector/owners'),'headers':{'Authorization':_0xfcc9('0x5d')+_0x1fcc92[_0xfcc9('0x5e')]},'json':!![]});}})[_0xfcc9('0x28')](function(_0x3e1de2){if(_0x3e1de2){var _0x477685=_0x3e1de2[_0xfcc9('0x5f')];var _0x140fde=![];var _0xda697b=null;for(_0xda697b=0x0;_0xda697b<_0x477685[_0xfcc9('0x39')];_0xda697b++){if(_0x477685[_0xda697b][_0xfcc9('0x60')]===_0x1227ea){_0x140fde=!![];}}if(_0x140fde){return!![];}else{throw new Error({'statusCode':0x194,'message':_0xfcc9('0x61')});}}})['then'](respondWithResult(_0x40bf45,null))['catch'](function(_0x10f002){var _0x23115e=_0x3a5af3['query'][_0xfcc9('0x62')]?0x1f4:_0x10f002['statusCode']||0x1f4;logger['error'](_0xfcc9('0x63'),'getFields',_0x23115e,JSON[_0xfcc9('0x64')](_0x10f002));delete _0x10f002[_0xfcc9('0x2c')];if(_0x23115e===0x191){_0x23115e=0x190;}_0x40bf45[_0xfcc9('0x20')](_0x23115e)[_0xfcc9('0x65')](_0x3a5af3[_0xfcc9('0x32')][_0xfcc9('0x62')]?{'message':_0xfcc9('0x66'),'statusCode':_0x10f002['statusCode']}:_0x10f002);});}; \ No newline at end of file +var _0x70dd=['../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','end','stack','name','send','map','rawAttributes','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','FreshsalesAccount','includeAll','include','catch','params','options','create','body','find','destroy','getConfigurations','findOne','FreshsalesConfiguration','addConfiguration','getSubjects','Descriptions','channel','FreshsalesField','Subjects','getFields','username','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format','%s%s','/api/selector/owners','Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','zip-dir','fast-json-patch','moment','bluebird','mustache','util','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis'];(function(_0x3596f9,_0x23ac87){var _0x13e16b=function(_0x1b9791){while(--_0x1b9791){_0x3596f9['push'](_0x3596f9['shift']());}};_0x13e16b(++_0x23ac87);}(_0x70dd,0x121));var _0xd70d=function(_0x2faa51,_0x17be07){_0x2faa51=_0x2faa51-0x0;var _0x41406a=_0x70dd[_0x2faa51];return _0x41406a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xd70d('0x0'));var jsonpatch=require(_0xd70d('0x1'));var rp=require('request-promise');var moment=require(_0xd70d('0x2'));var BPromise=require(_0xd70d('0x3'));var Mustache=require(_0xd70d('0x4'));var util=require(_0xd70d('0x5'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd70d('0x6'));var fs=require('fs');var fs_extra=require(_0xd70d('0x7'));var _=require(_0xd70d('0x8'));var squel=require(_0xd70d('0x9'));var crypto=require(_0xd70d('0xa'));var jsforce=require(_0xd70d('0xb'));var deskjs=require(_0xd70d('0xc'));var toCsv=require(_0xd70d('0xd'));var querystring=require(_0xd70d('0xe'));var Papa=require(_0xd70d('0xf'));var Redis=require(_0xd70d('0x10'));var authService=require(_0xd70d('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xd70d('0x12'));var hardwareService=require(_0xd70d('0x13'));var logger=require('../../config/logger')(_0xd70d('0x14'));var utils=require(_0xd70d('0x15'));var config=require(_0xd70d('0x16'));var licenseUtil=require(_0xd70d('0x17'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x509511,_0x5a0d46){_0x5a0d46=_0x5a0d46||0xcc;return function(_0x4a3530){if(_0x4a3530){return _0x509511[_0xd70d('0x18')](_0x5a0d46);}return _0x509511[_0xd70d('0x19')](_0x5a0d46)['end']();};}function respondWithResult(_0x56abf6,_0x4522db){_0x4522db=_0x4522db||0xc8;return function(_0x624805){if(_0x624805){return _0x56abf6[_0xd70d('0x19')](_0x4522db)[_0xd70d('0x1a')](_0x624805);}};}function respondWithFilteredResult(_0x42b93c,_0x3508a1){return function(_0x3dbf08){if(_0x3dbf08){var _0x40fe43=typeof _0x3508a1['offset']===_0xd70d('0x1b')&&typeof _0x3508a1[_0xd70d('0x1c')]===_0xd70d('0x1b');var _0x2b3894=_0x3dbf08[_0xd70d('0x1d')];var _0x484c7f=_0x40fe43?0x0:_0x3508a1[_0xd70d('0x1e')];var _0x4348f6=_0x40fe43?_0x3dbf08[_0xd70d('0x1d')]:_0x3508a1[_0xd70d('0x1e')]+_0x3508a1['limit'];var _0x364f0a;if(_0x4348f6>=_0x2b3894){_0x4348f6=_0x2b3894;_0x364f0a=0xc8;}else{_0x364f0a=0xce;}_0x42b93c['status'](_0x364f0a);return _0x42b93c[_0xd70d('0x1f')](_0xd70d('0x20'),_0x484c7f+'-'+_0x4348f6+'/'+_0x2b3894)[_0xd70d('0x1a')](_0x3dbf08);}return null;};}function patchUpdates(_0x3a3e3a){return function(_0x1e7e12){try{jsonpatch['apply'](_0x1e7e12,_0x3a3e3a,!![]);}catch(_0x2c1f09){return BPromise[_0xd70d('0x21')](_0x2c1f09);}return _0x1e7e12[_0xd70d('0x22')]();};}function saveUpdates(_0x2ed962,_0x4ceebb){return function(_0x17eeaa){if(_0x17eeaa){return _0x17eeaa[_0xd70d('0x23')](_0x2ed962)[_0xd70d('0x24')](function(_0x1189f6){return _0x1189f6;});}return null;};}function removeEntity(_0x524172,_0x2670ac){return function(_0x5ba3c2){if(_0x5ba3c2){return _0x5ba3c2['destroy']()[_0xd70d('0x24')](function(){_0x524172[_0xd70d('0x19')](0xcc)[_0xd70d('0x25')]();});}};}function handleEntityNotFound(_0x598520,_0x32ea5a){return function(_0x509a4d){if(!_0x509a4d){_0x598520[_0xd70d('0x18')](0x194);}return _0x509a4d;};}function handleError(_0x526b88,_0x166b34){_0x166b34=_0x166b34||0x1f4;return function(_0x1d4a1b){logger['error'](_0x1d4a1b[_0xd70d('0x26')]);if(_0x1d4a1b[_0xd70d('0x27')]){delete _0x1d4a1b[_0xd70d('0x27')];}_0x526b88[_0xd70d('0x19')](_0x166b34)[_0xd70d('0x28')](_0x1d4a1b);};}exports['index']=function(_0x3ed73e,_0x50a370){var _0x3925af={},_0x23de17={},_0x45b378={'count':0x0,'rows':[]};var _0x2b4eba=_[_0xd70d('0x29')](db['FreshsalesAccount'][_0xd70d('0x2a')],function(_0x27afb9){return{'name':_0x27afb9['fieldName'],'type':_0x27afb9[_0xd70d('0x2b')][_0xd70d('0x2c')]};});_0x23de17[_0xd70d('0x2d')]=_[_0xd70d('0x29')](_0x2b4eba,'name');_0x23de17['query']=_[_0xd70d('0x2e')](_0x3ed73e['query']);_0x23de17[_0xd70d('0x2f')]=_[_0xd70d('0x30')](_0x23de17['model'],_0x23de17[_0xd70d('0x31')]);_0x3925af[_0xd70d('0x32')]=_[_0xd70d('0x30')](_0x23de17['model'],qs[_0xd70d('0x33')](_0x3ed73e[_0xd70d('0x31')]['fields']));_0x3925af[_0xd70d('0x32')]=_0x3925af['attributes'][_0xd70d('0x34')]?_0x3925af['attributes']:_0x23de17['model'];if(!_0x3ed73e[_0xd70d('0x31')][_0xd70d('0x35')](_0xd70d('0x36'))){_0x3925af['limit']=qs['limit'](_0x3ed73e[_0xd70d('0x31')]['limit']);_0x3925af[_0xd70d('0x1e')]=qs[_0xd70d('0x1e')](_0x3ed73e[_0xd70d('0x31')][_0xd70d('0x1e')]);}_0x3925af[_0xd70d('0x37')]=qs[_0xd70d('0x38')](_0x3ed73e[_0xd70d('0x31')][_0xd70d('0x38')]);_0x3925af[_0xd70d('0x39')]=qs[_0xd70d('0x2f')](_[_0xd70d('0x3a')](_0x3ed73e[_0xd70d('0x31')],_0x23de17[_0xd70d('0x2f')]),_0x2b4eba);if(_0x3ed73e[_0xd70d('0x31')][_0xd70d('0x3b')]){_0x3925af['where']=_[_0xd70d('0x3c')](_0x3925af[_0xd70d('0x39')],{'$or':_['map'](_0x2b4eba,function(_0x52bd10){if(_0x52bd10[_0xd70d('0x2b')]!==_0xd70d('0x3d')){var _0x2e1e73={};_0x2e1e73[_0x52bd10[_0xd70d('0x27')]]={'$like':'%'+_0x3ed73e[_0xd70d('0x31')]['filter']+'%'};return _0x2e1e73;}})});}_0x3925af=_[_0xd70d('0x3c')]({},_0x3925af,_0x3ed73e['options']);var _0x5aec4e={'where':_0x3925af[_0xd70d('0x39')]};return db[_0xd70d('0x3e')][_0xd70d('0x1d')](_0x5aec4e)['then'](function(_0x36ffb1){_0x45b378[_0xd70d('0x1d')]=_0x36ffb1;if(_0x3ed73e['query'][_0xd70d('0x3f')]){_0x3925af[_0xd70d('0x40')]=[{'all':!![]}];}return db['FreshsalesAccount']['findAll'](_0x3925af);})[_0xd70d('0x24')](function(_0x2ba281){_0x45b378['rows']=_0x2ba281;return _0x45b378;})[_0xd70d('0x24')](respondWithFilteredResult(_0x50a370,_0x3925af))[_0xd70d('0x41')](handleError(_0x50a370,null));};exports['show']=function(_0x9d7a57,_0x507a75){var _0x230de0={'raw':![],'where':{'id':_0x9d7a57[_0xd70d('0x42')]['id']}},_0x96696f={};_0x96696f[_0xd70d('0x2d')]=_[_0xd70d('0x2e')](db[_0xd70d('0x3e')][_0xd70d('0x2a')]);_0x96696f[_0xd70d('0x31')]=_[_0xd70d('0x2e')](_0x9d7a57[_0xd70d('0x31')]);_0x96696f[_0xd70d('0x2f')]=_[_0xd70d('0x30')](_0x96696f[_0xd70d('0x2d')],_0x96696f['query']);_0x230de0[_0xd70d('0x32')]=_[_0xd70d('0x30')](_0x96696f[_0xd70d('0x2d')],qs[_0xd70d('0x33')](_0x9d7a57['query'][_0xd70d('0x33')]));_0x230de0[_0xd70d('0x32')]=_0x230de0[_0xd70d('0x32')][_0xd70d('0x34')]?_0x230de0[_0xd70d('0x32')]:_0x96696f['model'];if(_0x9d7a57['query'][_0xd70d('0x3f')]){_0x230de0['include']=[{'all':!![]}];}_0x230de0=_[_0xd70d('0x3c')]({},_0x230de0,_0x9d7a57[_0xd70d('0x43')]);return db[_0xd70d('0x3e')]['find'](_0x230de0)[_0xd70d('0x24')](handleEntityNotFound(_0x507a75,null))['then'](respondWithResult(_0x507a75,null))[_0xd70d('0x41')](handleError(_0x507a75,null));};exports[_0xd70d('0x44')]=function(_0x3db014,_0x214258){return db[_0xd70d('0x3e')][_0xd70d('0x44')](_0x3db014[_0xd70d('0x45')],{})['then'](respondWithResult(_0x214258,0xc9))[_0xd70d('0x41')](handleError(_0x214258,null));};exports['update']=function(_0x1e7e46,_0x4a490d){if(_0x1e7e46[_0xd70d('0x45')]['id']){delete _0x1e7e46[_0xd70d('0x45')]['id'];}return db['FreshsalesAccount'][_0xd70d('0x46')]({'where':{'id':_0x1e7e46['params']['id']}})[_0xd70d('0x24')](handleEntityNotFound(_0x4a490d,null))[_0xd70d('0x24')](saveUpdates(_0x1e7e46[_0xd70d('0x45')],null))[_0xd70d('0x24')](respondWithResult(_0x4a490d,null))[_0xd70d('0x41')](handleError(_0x4a490d,null));};exports[_0xd70d('0x47')]=function(_0x4e4ac9,_0x183529){return db[_0xd70d('0x3e')][_0xd70d('0x46')]({'where':{'id':_0x4e4ac9[_0xd70d('0x42')]['id']}})[_0xd70d('0x24')](handleEntityNotFound(_0x183529,null))[_0xd70d('0x24')](removeEntity(_0x183529,null))[_0xd70d('0x41')](handleError(_0x183529,null));};exports[_0xd70d('0x48')]=function(_0x501958,_0x13eac9,_0x19a08b){var _0x45d116={};var _0x478687={};var _0x3db83a;var _0x4b981a;return db[_0xd70d('0x3e')][_0xd70d('0x49')]({'where':{'id':_0x501958[_0xd70d('0x42')]['id']}})['then'](handleEntityNotFound(_0x13eac9,null))[_0xd70d('0x24')](function(_0x14160a){if(_0x14160a){_0x3db83a=_0x14160a;_0x478687[_0xd70d('0x2d')]=_[_0xd70d('0x2e')](db[_0xd70d('0x4a')][_0xd70d('0x2a')]);_0x478687[_0xd70d('0x31')]=_[_0xd70d('0x2e')](_0x501958[_0xd70d('0x31')]);_0x478687['filters']=_[_0xd70d('0x30')](_0x478687[_0xd70d('0x2d')],_0x478687[_0xd70d('0x31')]);_0x45d116['attributes']=_[_0xd70d('0x30')](_0x478687[_0xd70d('0x2d')],qs[_0xd70d('0x33')](_0x501958[_0xd70d('0x31')][_0xd70d('0x33')]));_0x45d116[_0xd70d('0x32')]=_0x45d116[_0xd70d('0x32')][_0xd70d('0x34')]?_0x45d116[_0xd70d('0x32')]:_0x478687['model'];_0x45d116['order']=qs[_0xd70d('0x38')](_0x501958['query']['sort']);_0x45d116[_0xd70d('0x39')]=qs['filters'](_[_0xd70d('0x3a')](_0x501958[_0xd70d('0x31')],_0x478687['filters']));if(_0x501958[_0xd70d('0x31')][_0xd70d('0x3b')]){_0x45d116['where']=_[_0xd70d('0x3c')](_0x45d116[_0xd70d('0x39')],{'$or':_[_0xd70d('0x29')](_0x45d116[_0xd70d('0x32')],function(_0x3dd1a9){var _0x239ead={};_0x239ead[_0x3dd1a9]={'$like':'%'+_0x501958['query']['filter']+'%'};return _0x239ead;})});}_0x45d116=_[_0xd70d('0x3c')]({},_0x45d116,_0x501958[_0xd70d('0x43')]);return _0x3db83a['getConfigurations'](_0x45d116);}})['then'](function(_0x1aa71f){if(_0x1aa71f){_0x4b981a=_0x1aa71f[_0xd70d('0x34')];if(!_0x501958[_0xd70d('0x31')][_0xd70d('0x35')](_0xd70d('0x36'))){_0x45d116['limit']=qs[_0xd70d('0x1c')](_0x501958[_0xd70d('0x31')][_0xd70d('0x1c')]);_0x45d116[_0xd70d('0x1e')]=qs[_0xd70d('0x1e')](_0x501958['query'][_0xd70d('0x1e')]);}return _0x3db83a['getConfigurations'](_0x45d116);}})['then'](function(_0xdb73b2){if(_0xdb73b2){return _0xdb73b2?{'count':_0x4b981a,'rows':_0xdb73b2}:null;}})['then'](respondWithResult(_0x13eac9,null))[_0xd70d('0x41')](handleError(_0x13eac9,null));};exports[_0xd70d('0x4b')]=function(_0x34fe89,_0x44a76a,_0x3a9ba6){if(_0x34fe89[_0xd70d('0x45')]['id']){delete _0x34fe89[_0xd70d('0x45')]['id'];}return db[_0xd70d('0x3e')][_0xd70d('0x49')]({'where':{'id':_0x34fe89[_0xd70d('0x42')]['id']}})['then'](handleEntityNotFound(_0x44a76a,null))[_0xd70d('0x24')](function(_0x3036ac){if(_0x3036ac){_0x34fe89[_0xd70d('0x45')]['AccountId']=_0x3036ac['id'];_0x34fe89['body']['Subjects']=integrations[_0xd70d('0x4c')](_0x34fe89['body']['channel'],_0x34fe89[_0xd70d('0x45')]['type']);_0x34fe89[_0xd70d('0x45')][_0xd70d('0x4d')]=integrations['getDescriptions'](_0x34fe89['body'][_0xd70d('0x4e')],_0x34fe89[_0xd70d('0x45')][_0xd70d('0x2b')]);return db[_0xd70d('0x4a')][_0xd70d('0x44')](_0x34fe89[_0xd70d('0x45')],{'include':[{'model':db[_0xd70d('0x4f')],'as':_0xd70d('0x50')},{'model':db['FreshsalesField'],'as':_0xd70d('0x4d')}]});}return null;})[_0xd70d('0x24')](respondWithResult(_0x44a76a,null))[_0xd70d('0x41')](handleError(_0x44a76a,null));};exports[_0xd70d('0x51')]=function(_0x291b16,_0x4c5ee3,_0x2cc78b){var _0x382695='';var _0x3befe7='';return db[_0xd70d('0x3e')][_0xd70d('0x49')]({'where':{'id':_0x291b16[_0xd70d('0x42')]['id']},'attributes':['id',_0xd70d('0x52'),_0xd70d('0x53'),_0xd70d('0x54')]})[_0xd70d('0x24')](handleEntityNotFound(_0x4c5ee3,null))[_0xd70d('0x24')](function(_0x88f9f9){if(_0x88f9f9){_0x3befe7=_0x88f9f9['username'];_0x382695=_0x88f9f9[_0xd70d('0x53')];var _0x396ba2=_0x88f9f9[_0xd70d('0x53')][_0xd70d('0x55')](-0x1);if(_0x396ba2==='/'){_0x382695=_0x382695[_0xd70d('0x56')](0x0,_0x382695[_0xd70d('0x57')](_0x396ba2));}return rp({'method':_0xd70d('0x58'),'uri':util[_0xd70d('0x59')](_0xd70d('0x5a'),_0x382695,_0xd70d('0x5b')),'headers':{'Authorization':_0xd70d('0x5c')+_0x88f9f9['apiKey']},'json':!![]});}})[_0xd70d('0x24')](function(_0x3113fd){if(_0x3113fd){var _0x1f3a6b=_0x3113fd[_0xd70d('0x5d')];var _0x568c01=![];var _0x1c4264=null;for(_0x1c4264=0x0;_0x1c4264<_0x1f3a6b[_0xd70d('0x34')];_0x1c4264++){if(_0x1f3a6b[_0x1c4264][_0xd70d('0x5e')]===_0x3befe7){_0x568c01=!![];}}if(_0x568c01){return!![];}else{throw new Error({'statusCode':0x194,'message':_0xd70d('0x5f')});}}})['then'](respondWithResult(_0x4c5ee3,null))[_0xd70d('0x41')](function(_0x2a9734){var _0x474401=_0x291b16['query']['test']?0x1f4:_0x2a9734[_0xd70d('0x60')]||0x1f4;logger[_0xd70d('0x61')](_0xd70d('0x62'),_0xd70d('0x51'),_0x474401,JSON[_0xd70d('0x63')](_0x2a9734));delete _0x2a9734['name'];if(_0x474401===0x191){_0x474401=0x190;}_0x4c5ee3[_0xd70d('0x19')](_0x474401)[_0xd70d('0x28')](_0x291b16[_0xd70d('0x31')][_0xd70d('0x64')]?{'message':_0xd70d('0x65'),'statusCode':_0x2a9734[_0xd70d('0x60')]}:_0x2a9734);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 9f97973..eb8c2a3 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 _0x25e7=['request-promise','path','rimraf','../../config/environment','exports','define','FreshsalesAccount','int_freshsales_accounts','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x103ac3,_0x26c2d5){var _0x269048=function(_0x299575){while(--_0x299575){_0x103ac3['push'](_0x103ac3['shift']());}};_0x269048(++_0x26c2d5);}(_0x25e7,0x1d6));var _0x725e=function(_0x4313b7,_0x48641c){_0x4313b7=_0x4313b7-0x0;var _0x57dbbe=_0x25e7[_0x4313b7];return _0x57dbbe;};'use strict';var _=require(_0x725e('0x0'));var util=require(_0x725e('0x1'));var logger=require(_0x725e('0x2'))(_0x725e('0x3'));var moment=require(_0x725e('0x4'));var BPromise=require(_0x725e('0x5'));var rp=require(_0x725e('0x6'));var fs=require('fs');var path=require(_0x725e('0x7'));var rimraf=require(_0x725e('0x8'));var config=require(_0x725e('0x9'));var attributes=require('./intFreshsalesAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x725e('0xa')]=function(_0x480945,_0x481316){return _0x480945[_0x725e('0xb')](_0x725e('0xc'),attributes,{'tableName':_0x725e('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd101=['moment','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','define','FreshsalesAccount','int_freshsales_accounts','lodash','../../config/logger','api'];(function(_0x3b8aca,_0x1f2ce4){var _0x188bae=function(_0xa91287){while(--_0xa91287){_0x3b8aca['push'](_0x3b8aca['shift']());}};_0x188bae(++_0x1f2ce4);}(_0xd101,0xc1));var _0x1d10=function(_0x1b8171,_0x4cb679){_0x1b8171=_0x1b8171-0x0;var _0xa8c506=_0xd101[_0x1b8171];return _0xa8c506;};'use strict';var _=require(_0x1d10('0x0'));var util=require('util');var logger=require(_0x1d10('0x1'))(_0x1d10('0x2'));var moment=require(_0x1d10('0x3'));var BPromise=require(_0x1d10('0x4'));var rp=require(_0x1d10('0x5'));var fs=require('fs');var path=require(_0x1d10('0x6'));var rimraf=require(_0x1d10('0x7'));var config=require(_0x1d10('0x8'));var attributes=require('./intFreshsalesAccount.attributes');var integrations=require(_0x1d10('0x9'));module[_0x1d10('0xa')]=function(_0x2a4e2d,_0x27d569){return _0x2a4e2d[_0x1d10('0xb')](_0x1d10('0xc'),attributes,{'tableName':_0x1d10('0xd'),'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 04ec65d..026b5b7 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 _0xba34=['request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','where','attributes','limit','include','map','model','ShowFreshsalesAccount','find','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshsalesAccount,\x20%s,\x20%s'];(function(_0x38bf4b,_0x5a907a){var _0x549624=function(_0x10c2c9){while(--_0x10c2c9){_0x38bf4b['push'](_0x38bf4b['shift']());}};_0x549624(++_0x5a907a);}(_0xba34,0x119));var _0x4ba3=function(_0x32b8fe,_0x59c640){_0x32b8fe=_0x32b8fe-0x0;var _0x5cbb49=_0xba34[_0x32b8fe];return _0x5cbb49;};'use strict';var _=require(_0x4ba3('0x0'));var util=require(_0x4ba3('0x1'));var moment=require(_0x4ba3('0x2'));var BPromise=require(_0x4ba3('0x3'));var rs=require(_0x4ba3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4ba3('0x5'))(_0x4ba3('0x6'));var config=require(_0x4ba3('0x7'));var jayson=require(_0x4ba3('0x8'));var client=jayson[_0x4ba3('0x9')][_0x4ba3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe5f99a,_0x585f2d,_0x6254fb){return new BPromise(function(_0x368eee,_0x2df7f3){return client[_0x4ba3('0xb')](_0xe5f99a,_0x6254fb)[_0x4ba3('0xc')](function(_0xcf1ec3){logger[_0x4ba3('0xd')](_0x4ba3('0xe'),_0x585f2d,_0x4ba3('0xf'));logger[_0x4ba3('0x10')](_0x4ba3('0x11'),_0x585f2d,'request\x20sent',JSON[_0x4ba3('0x12')](_0xcf1ec3));if(_0xcf1ec3[_0x4ba3('0x13')]){if(_0xcf1ec3['error'][_0x4ba3('0x14')]===0x1f4){logger['error'](_0x4ba3('0xe'),_0x585f2d,_0xcf1ec3['error'][_0x4ba3('0x15')]);return _0x2df7f3(_0xcf1ec3[_0x4ba3('0x13')][_0x4ba3('0x15')]);}logger[_0x4ba3('0x13')](_0x4ba3('0xe'),_0x585f2d,_0xcf1ec3[_0x4ba3('0x13')][_0x4ba3('0x15')]);return _0x368eee(_0xcf1ec3[_0x4ba3('0x13')][_0x4ba3('0x15')]);}else{logger[_0x4ba3('0xd')](_0x4ba3('0xe'),_0x585f2d,_0x4ba3('0xf'));_0x368eee(_0xcf1ec3[_0x4ba3('0x16')][_0x4ba3('0x15')]);}})[_0x4ba3('0x17')](function(_0x1b7776){logger['error'](_0x4ba3('0xe'),_0x585f2d,_0x1b7776);_0x2df7f3(_0x1b7776);});});}exports[_0x4ba3('0x18')]=function(_0x5ff7ce){var _0x451c92=this;return new Promise(function(_0x556290,_0x2519bb){return db[_0x4ba3('0x19')][_0x4ba3('0x1a')]({'raw':_0x5ff7ce[_0x4ba3('0x1b')]?_0x5ff7ce[_0x4ba3('0x1b')][_0x4ba3('0x1c')]===undefined?!![]:![]:!![],'where':_0x5ff7ce['options']?_0x5ff7ce['options'][_0x4ba3('0x1d')]||null:null,'attributes':_0x5ff7ce['options']?_0x5ff7ce[_0x4ba3('0x1b')][_0x4ba3('0x1e')]||null:null,'limit':_0x5ff7ce[_0x4ba3('0x1b')]?_0x5ff7ce[_0x4ba3('0x1b')][_0x4ba3('0x1f')]||null:null,'include':_0x5ff7ce[_0x4ba3('0x1b')]?_0x5ff7ce['options'][_0x4ba3('0x20')]?_[_0x4ba3('0x21')](_0x5ff7ce['options'][_0x4ba3('0x20')],function(_0x4ffe39){return{'model':db[_0x4ffe39[_0x4ba3('0x22')]],'as':_0x4ffe39['as'],'attributes':_0x4ffe39[_0x4ba3('0x1e')],'include':_0x4ffe39[_0x4ba3('0x20')]?_[_0x4ba3('0x21')](_0x4ffe39[_0x4ba3('0x20')],function(_0xe29a49){return{'model':db[_0xe29a49[_0x4ba3('0x22')]],'as':_0xe29a49['as'],'attributes':_0xe29a49[_0x4ba3('0x1e')],'include':_0xe29a49[_0x4ba3('0x20')]?_[_0x4ba3('0x21')](_0xe29a49['include'],function(_0x252f37){return{'model':db[_0x252f37[_0x4ba3('0x22')]],'as':_0x252f37['as'],'attributes':_0x252f37[_0x4ba3('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x10537e){logger[_0x4ba3('0xd')](_0x4ba3('0x18'),_0x5ff7ce);logger['debug'](_0x4ba3('0x18'),_0x5ff7ce,JSON[_0x4ba3('0x12')](_0x10537e));_0x556290(_0x10537e);})[_0x4ba3('0x17')](function(_0x22394d){logger['error']('GetFreshsalesAccount',_0x22394d[_0x4ba3('0x15')],_0x5ff7ce);_0x2519bb(_0x451c92[_0x4ba3('0x13')](0x1f4,_0x22394d[_0x4ba3('0x15')]));});});};exports[_0x4ba3('0x23')]=function(_0x2cb5d5){var _0x11f88f=this;return new Promise(function(_0x48b3b7,_0x27444b){return db[_0x4ba3('0x19')][_0x4ba3('0x24')]({'raw':_0x2cb5d5[_0x4ba3('0x1b')]?_0x2cb5d5[_0x4ba3('0x1b')][_0x4ba3('0x1c')]===undefined?!![]:![]:!![],'where':_0x2cb5d5[_0x4ba3('0x1b')]?_0x2cb5d5[_0x4ba3('0x1b')][_0x4ba3('0x1d')]||null:null,'attributes':_0x2cb5d5[_0x4ba3('0x1b')]?_0x2cb5d5['options']['attributes']||null:null,'include':_0x2cb5d5['options']?_0x2cb5d5[_0x4ba3('0x1b')][_0x4ba3('0x20')]?_[_0x4ba3('0x21')](_0x2cb5d5[_0x4ba3('0x1b')][_0x4ba3('0x20')],function(_0x137f9b){return{'model':db[_0x137f9b[_0x4ba3('0x22')]],'as':_0x137f9b['as'],'attributes':_0x137f9b[_0x4ba3('0x1e')],'include':_0x137f9b[_0x4ba3('0x20')]?_[_0x4ba3('0x21')](_0x137f9b[_0x4ba3('0x20')],function(_0x3439cb){return{'model':db[_0x3439cb['model']],'as':_0x3439cb['as'],'attributes':_0x3439cb[_0x4ba3('0x1e')],'include':_0x3439cb[_0x4ba3('0x20')]?_[_0x4ba3('0x21')](_0x3439cb['include'],function(_0x188f8c){return{'model':db[_0x188f8c['model']],'as':_0x188f8c['as'],'attributes':_0x188f8c[_0x4ba3('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x4ba3('0xc')](function(_0x426e11){logger[_0x4ba3('0xd')](_0x4ba3('0x23'),_0x2cb5d5);logger[_0x4ba3('0x10')]('ShowFreshsalesAccount',_0x2cb5d5,JSON[_0x4ba3('0x12')](_0x426e11));_0x48b3b7(_0x426e11);})[_0x4ba3('0x17')](function(_0x2e77d4){logger['error'](_0x4ba3('0x23'),_0x2e77d4[_0x4ba3('0x15')],_0x2cb5d5);_0x27444b(_0x11f88f['error'](0x1f4,_0x2e77d4[_0x4ba3('0x15')]));});});}; \ No newline at end of file +var _0x25e7=['find','ShowFreshsalesAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','error','message','result','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','where','attributes','limit','map','include','model','stringify'];(function(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0x25e7,0x1d6));var _0x725e=function(_0x15c5b8,_0x3b670f){_0x15c5b8=_0x15c5b8-0x0;var _0xd45fe6=_0x25e7[_0x15c5b8];return _0xd45fe6;};'use strict';var _=require(_0x725e('0x0'));var util=require(_0x725e('0x1'));var moment=require(_0x725e('0x2'));var BPromise=require(_0x725e('0x3'));var rs=require(_0x725e('0x4'));var fs=require('fs');var Redis=require(_0x725e('0x5'));var db=require(_0x725e('0x6'))['db'];var utils=require(_0x725e('0x7'));var logger=require(_0x725e('0x8'))(_0x725e('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x725e('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x481316,_0x111a50,_0x192c27){return new BPromise(function(_0x216b33,_0x67de0c){return client[_0x725e('0xb')](_0x481316,_0x192c27)[_0x725e('0xc')](function(_0x39858a){logger[_0x725e('0xd')](_0x725e('0xe'),_0x111a50,_0x725e('0xf'));logger[_0x725e('0x10')](_0x725e('0x11'),_0x111a50,'request\x20sent',JSON['stringify'](_0x39858a));if(_0x39858a[_0x725e('0x12')]){if(_0x39858a[_0x725e('0x12')]['code']===0x1f4){logger['error'](_0x725e('0xe'),_0x111a50,_0x39858a[_0x725e('0x12')]['message']);return _0x67de0c(_0x39858a[_0x725e('0x12')][_0x725e('0x13')]);}logger[_0x725e('0x12')]('FreshsalesAccount,\x20%s,\x20%s',_0x111a50,_0x39858a[_0x725e('0x12')][_0x725e('0x13')]);return _0x216b33(_0x39858a[_0x725e('0x12')][_0x725e('0x13')]);}else{logger[_0x725e('0xd')](_0x725e('0xe'),_0x111a50,'request\x20sent');_0x216b33(_0x39858a[_0x725e('0x14')][_0x725e('0x13')]);}})[_0x725e('0x15')](function(_0x54ac0f){logger[_0x725e('0x12')](_0x725e('0xe'),_0x111a50,_0x54ac0f);_0x67de0c(_0x54ac0f);});});}exports[_0x725e('0x16')]=function(_0x397e33){var _0x268438=this;return new Promise(function(_0x2811e7,_0x528e7d){return db[_0x725e('0x17')][_0x725e('0x18')]({'raw':_0x397e33[_0x725e('0x19')]?_0x397e33[_0x725e('0x19')][_0x725e('0x1a')]===undefined?!![]:![]:!![],'where':_0x397e33[_0x725e('0x19')]?_0x397e33['options'][_0x725e('0x1b')]||null:null,'attributes':_0x397e33[_0x725e('0x19')]?_0x397e33[_0x725e('0x19')][_0x725e('0x1c')]||null:null,'limit':_0x397e33[_0x725e('0x19')]?_0x397e33[_0x725e('0x19')][_0x725e('0x1d')]||null:null,'include':_0x397e33[_0x725e('0x19')]?_0x397e33[_0x725e('0x19')]['include']?_[_0x725e('0x1e')](_0x397e33[_0x725e('0x19')][_0x725e('0x1f')],function(_0x3facae){return{'model':db[_0x3facae['model']],'as':_0x3facae['as'],'attributes':_0x3facae[_0x725e('0x1c')],'include':_0x3facae['include']?_['map'](_0x3facae['include'],function(_0x2aad7b){return{'model':db[_0x2aad7b[_0x725e('0x20')]],'as':_0x2aad7b['as'],'attributes':_0x2aad7b[_0x725e('0x1c')],'include':_0x2aad7b['include']?_[_0x725e('0x1e')](_0x2aad7b[_0x725e('0x1f')],function(_0x5a5bef){return{'model':db[_0x5a5bef[_0x725e('0x20')]],'as':_0x5a5bef['as'],'attributes':_0x5a5bef[_0x725e('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x378ace){logger['info']('GetFreshsalesAccount',_0x397e33);logger[_0x725e('0x10')]('GetFreshsalesAccount',_0x397e33,JSON[_0x725e('0x21')](_0x378ace));_0x2811e7(_0x378ace);})['catch'](function(_0x4de2e0){logger[_0x725e('0x12')](_0x725e('0x16'),_0x4de2e0[_0x725e('0x13')],_0x397e33);_0x528e7d(_0x268438['error'](0x1f4,_0x4de2e0[_0x725e('0x13')]));});});};exports['ShowFreshsalesAccount']=function(_0x85d29c){var _0x1ce9c8=this;return new Promise(function(_0x39932f,_0x28951f){return db[_0x725e('0x17')][_0x725e('0x22')]({'raw':_0x85d29c[_0x725e('0x19')]?_0x85d29c[_0x725e('0x19')][_0x725e('0x1a')]===undefined?!![]:![]:!![],'where':_0x85d29c[_0x725e('0x19')]?_0x85d29c[_0x725e('0x19')]['where']||null:null,'attributes':_0x85d29c[_0x725e('0x19')]?_0x85d29c[_0x725e('0x19')]['attributes']||null:null,'include':_0x85d29c[_0x725e('0x19')]?_0x85d29c['options'][_0x725e('0x1f')]?_['map'](_0x85d29c[_0x725e('0x19')][_0x725e('0x1f')],function(_0x1f2898){return{'model':db[_0x1f2898[_0x725e('0x20')]],'as':_0x1f2898['as'],'attributes':_0x1f2898[_0x725e('0x1c')],'include':_0x1f2898[_0x725e('0x1f')]?_['map'](_0x1f2898['include'],function(_0x35e5e7){return{'model':db[_0x35e5e7[_0x725e('0x20')]],'as':_0x35e5e7['as'],'attributes':_0x35e5e7[_0x725e('0x1c')],'include':_0x35e5e7['include']?_[_0x725e('0x1e')](_0x35e5e7['include'],function(_0x3ce327){return{'model':db[_0x3ce327[_0x725e('0x20')]],'as':_0x3ce327['as'],'attributes':_0x3ce327[_0x725e('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x725e('0xc')](function(_0x4f15f3){logger['info'](_0x725e('0x23'),_0x85d29c);logger[_0x725e('0x10')](_0x725e('0x23'),_0x85d29c,JSON['stringify'](_0x4f15f3));_0x39932f(_0x4f15f3);})[_0x725e('0x15')](function(_0xec3b9d){logger[_0x725e('0x12')]('ShowFreshsalesAccount',_0xec3b9d[_0x725e('0x13')],_0x85d29c);_0x28951f(_0x1ce9c8['error'](0x1f4,_0xec3b9d[_0x725e('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index e576b98..ce5d361 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 _0x6f53=['path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get','index','/:id','isAuthenticated','getSubjects','/:id/descriptions','/:id/fields','getFields','create','update','destroy','multer'];(function(_0x471757,_0x3de4a8){var _0x580ef9=function(_0x2e16ad){while(--_0x2e16ad){_0x471757['push'](_0x471757['shift']());}};_0x580ef9(++_0x3de4a8);}(_0x6f53,0xaa));var _0x36f5=function(_0x1c6f08,_0x58d5c9){_0x1c6f08=_0x1c6f08-0x0;var _0x22e108=_0x6f53[_0x1c6f08];return _0x22e108;};'use strict';var multer=require(_0x36f5('0x0'));var util=require('util');var path=require(_0x36f5('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x36f5('0x2')]();var fs_extra=require(_0x36f5('0x3'));var auth=require(_0x36f5('0x4'));var interaction=require(_0x36f5('0x5'));var config=require(_0x36f5('0x6'));var controller=require(_0x36f5('0x7'));router[_0x36f5('0x8')]('/',auth['isAuthenticated'](),controller[_0x36f5('0x9')]);router[_0x36f5('0x8')](_0x36f5('0xa'),auth[_0x36f5('0xb')](),controller['show']);router[_0x36f5('0x8')]('/:id/subjects',auth[_0x36f5('0xb')](),controller[_0x36f5('0xc')]);router[_0x36f5('0x8')](_0x36f5('0xd'),auth[_0x36f5('0xb')](),controller['getDescriptions']);router['get'](_0x36f5('0xe'),auth[_0x36f5('0xb')](),controller[_0x36f5('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0x36f5('0x10')]);router['put'](_0x36f5('0xa'),auth[_0x36f5('0xb')](),controller[_0x36f5('0x11')]);router['delete'](_0x36f5('0xa'),auth[_0x36f5('0xb')](),controller[_0x36f5('0x12')]);module['exports']=router; \ No newline at end of file +var _0x92b4=['isAuthenticated','/:id/descriptions','getDescriptions','getFields','post','put','update','delete','destroy','exports','util','connect-timeout','express','fs-extra','../../components/interaction/service','get','index','/:id'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0x92b4,0x64));var _0x492b=function(_0x122b70,_0x1982c5){_0x122b70=_0x122b70-0x0;var _0x57865c=_0x92b4[_0x122b70];return _0x57865c;};'use strict';var multer=require('multer');var util=require(_0x492b('0x0'));var path=require('path');var timeout=require(_0x492b('0x1'));var express=require(_0x492b('0x2'));var router=express['Router']();var fs_extra=require(_0x492b('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x492b('0x4'));var config=require('../../config/environment');var controller=require('./intFreshsalesConfiguration.controller');router[_0x492b('0x5')]('/',auth['isAuthenticated'](),controller[_0x492b('0x6')]);router[_0x492b('0x5')](_0x492b('0x7'),auth[_0x492b('0x8')](),controller['show']);router[_0x492b('0x5')]('/:id/subjects',auth[_0x492b('0x8')](),controller['getSubjects']);router[_0x492b('0x5')](_0x492b('0x9'),auth[_0x492b('0x8')](),controller[_0x492b('0xa')]);router['get']('/:id/fields',auth[_0x492b('0x8')](),controller[_0x492b('0xb')]);router[_0x492b('0xc')]('/',auth[_0x492b('0x8')](),controller['create']);router[_0x492b('0xd')](_0x492b('0x7'),auth[_0x492b('0x8')](),controller[_0x492b('0xe')]);router[_0x492b('0xf')]('/:id',auth[_0x492b('0x8')](),controller[_0x492b('0x10')]);module[_0x492b('0x11')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 77545c0..3e4c47e 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 _0xff69=['STRING','sequelize'];(function(_0x4ba63f,_0x3ed400){var _0x3227b3=function(_0x506000){while(--_0x506000){_0x4ba63f['push'](_0x4ba63f['shift']());}};_0x3227b3(++_0x3ed400);}(_0xff69,0x199));var _0x9ff6=function(_0x34232c,_0x18e61d){_0x34232c=_0x34232c-0x0;var _0x4d4f4e=_0xff69[_0x34232c];return _0x4d4f4e;};'use strict';var Sequelize=require(_0x9ff6('0x0'));module['exports']={'name':{'type':Sequelize[_0x9ff6('0x1')]},'description':{'type':Sequelize[_0x9ff6('0x1')]}}; \ No newline at end of file +var _0xab5d=['exports','STRING'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0xab5d,0x6e));var _0xdab5=function(_0x3e4f1a,_0xf71492){_0x3e4f1a=_0x3e4f1a-0x0;var _0x32049a=_0xab5d[_0x3e4f1a];return _0x32049a;};'use strict';var Sequelize=require('sequelize');module[_0xdab5('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xdab5('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 1e53f0c..e2eb645 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 _0x7342=['../../components/parsers/qs','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','Content-Range','apply','save','update','then','stack','name','FreshsalesConfiguration','fieldName','type','map','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','show','params','model','rawAttributes','include','options','find','create','body','destroy','getSubjects','findOne','getDescriptions','FreshsalesField','getFields','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis'];(function(_0x4fa107,_0x45715b){var _0x183cc3=function(_0x39bbc5){while(--_0x39bbc5){_0x4fa107['push'](_0x4fa107['shift']());}};_0x183cc3(++_0x45715b);}(_0x7342,0xd4));var _0x2734=function(_0x588a7a,_0x2422ff){_0x588a7a=_0x588a7a-0x0;var _0x2cc8df=_0x7342[_0x588a7a];return _0x2cc8df;};'use strict';var emlformat=require(_0x2734('0x0'));var rimraf=require(_0x2734('0x1'));var zipdir=require(_0x2734('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x2734('0x3'));var BPromise=require(_0x2734('0x4'));var Mustache=require(_0x2734('0x5'));var util=require(_0x2734('0x6'));var path=require(_0x2734('0x7'));var sox=require(_0x2734('0x8'));var csv=require(_0x2734('0x9'));var ejs=require(_0x2734('0xa'));var fs=require('fs');var fs_extra=require(_0x2734('0xb'));var _=require(_0x2734('0xc'));var squel=require(_0x2734('0xd'));var crypto=require(_0x2734('0xe'));var jsforce=require(_0x2734('0xf'));var deskjs=require(_0x2734('0x10'));var toCsv=require(_0x2734('0x9'));var querystring=require(_0x2734('0x11'));var Papa=require('papaparse');var Redis=require(_0x2734('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x2734('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2734('0x14'));var utils=require('../../config/utils');var config=require(_0x2734('0x15'));var licenseUtil=require(_0x2734('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x64e7c4,_0x346682){_0x346682=_0x346682||0xcc;return function(_0x196a1c){if(_0x196a1c){return _0x64e7c4[_0x2734('0x17')](_0x346682);}return _0x64e7c4[_0x2734('0x18')](_0x346682)[_0x2734('0x19')]();};}function respondWithResult(_0x229f38,_0x200a1b){_0x200a1b=_0x200a1b||0xc8;return function(_0x3c3d07){if(_0x3c3d07){return _0x229f38[_0x2734('0x18')](_0x200a1b)[_0x2734('0x1a')](_0x3c3d07);}};}function respondWithFilteredResult(_0x4df926,_0x547f05){return function(_0x17760c){if(_0x17760c){var _0x52e660=typeof _0x547f05[_0x2734('0x1b')]===_0x2734('0x1c')&&typeof _0x547f05['limit']==='undefined';var _0x3850b3=_0x17760c[_0x2734('0x1d')];var _0x5cdad9=_0x52e660?0x0:_0x547f05[_0x2734('0x1b')];var _0x2056df=_0x52e660?_0x17760c[_0x2734('0x1d')]:_0x547f05['offset']+_0x547f05['limit'];var _0x2abe22;if(_0x2056df>=_0x3850b3){_0x2056df=_0x3850b3;_0x2abe22=0xc8;}else{_0x2abe22=0xce;}_0x4df926['status'](_0x2abe22);return _0x4df926['set'](_0x2734('0x1e'),_0x5cdad9+'-'+_0x2056df+'/'+_0x3850b3)[_0x2734('0x1a')](_0x17760c);}return null;};}function patchUpdates(_0x3368bb){return function(_0x50b6c2){try{jsonpatch[_0x2734('0x1f')](_0x50b6c2,_0x3368bb,!![]);}catch(_0x1eab6f){return BPromise['reject'](_0x1eab6f);}return _0x50b6c2[_0x2734('0x20')]();};}function saveUpdates(_0x3fcaaf,_0x190143){return function(_0x41dea4){if(_0x41dea4){return _0x41dea4[_0x2734('0x21')](_0x3fcaaf)['then'](function(_0x5b6a5e){return _0x5b6a5e;});}return null;};}function removeEntity(_0x570255,_0x2e5828){return function(_0x3f8c1d){if(_0x3f8c1d){return _0x3f8c1d['destroy']()[_0x2734('0x22')](function(){_0x570255[_0x2734('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1d872b,_0x5a1cf2){return function(_0x5c61c4){if(!_0x5c61c4){_0x1d872b[_0x2734('0x17')](0x194);}return _0x5c61c4;};}function handleError(_0x2d6a79,_0x1b13b1){_0x1b13b1=_0x1b13b1||0x1f4;return function(_0x2104c4){logger['error'](_0x2104c4[_0x2734('0x23')]);if(_0x2104c4['name']){delete _0x2104c4[_0x2734('0x24')];}_0x2d6a79[_0x2734('0x18')](_0x1b13b1)['send'](_0x2104c4);};}exports['index']=function(_0x4d9e92,_0xd2a1a){var _0x1854f1={},_0x464941={},_0x55393e={'count':0x0,'rows':[]};var _0x2a29b7=_['map'](db[_0x2734('0x25')]['rawAttributes'],function(_0x261246){return{'name':_0x261246[_0x2734('0x26')],'type':_0x261246[_0x2734('0x27')]['key']};});_0x464941['model']=_[_0x2734('0x28')](_0x2a29b7,_0x2734('0x24'));_0x464941['query']=_[_0x2734('0x29')](_0x4d9e92['query']);_0x464941[_0x2734('0x2a')]=_[_0x2734('0x2b')](_0x464941['model'],_0x464941[_0x2734('0x2c')]);_0x1854f1['attributes']=_[_0x2734('0x2b')](_0x464941['model'],qs['fields'](_0x4d9e92['query'][_0x2734('0x2d')]));_0x1854f1[_0x2734('0x2e')]=_0x1854f1[_0x2734('0x2e')][_0x2734('0x2f')]?_0x1854f1[_0x2734('0x2e')]:_0x464941['model'];if(!_0x4d9e92[_0x2734('0x2c')][_0x2734('0x30')](_0x2734('0x31'))){_0x1854f1[_0x2734('0x32')]=qs['limit'](_0x4d9e92['query']['limit']);_0x1854f1['offset']=qs[_0x2734('0x1b')](_0x4d9e92[_0x2734('0x2c')][_0x2734('0x1b')]);}_0x1854f1[_0x2734('0x33')]=qs[_0x2734('0x34')](_0x4d9e92[_0x2734('0x2c')][_0x2734('0x34')]);_0x1854f1[_0x2734('0x35')]=qs['filters'](_[_0x2734('0x36')](_0x4d9e92[_0x2734('0x2c')],_0x464941[_0x2734('0x2a')]),_0x2a29b7);if(_0x4d9e92['query'][_0x2734('0x37')]){_0x1854f1['where']=_[_0x2734('0x38')](_0x1854f1[_0x2734('0x35')],{'$or':_[_0x2734('0x28')](_0x2a29b7,function(_0xa19d46){if(_0xa19d46[_0x2734('0x27')]!==_0x2734('0x39')){var _0x48c0f8={};_0x48c0f8[_0xa19d46['name']]={'$like':'%'+_0x4d9e92[_0x2734('0x2c')][_0x2734('0x37')]+'%'};return _0x48c0f8;}})});}_0x1854f1=_[_0x2734('0x38')]({},_0x1854f1,_0x4d9e92['options']);var _0x13022b={'where':_0x1854f1['where']};return db[_0x2734('0x25')]['count'](_0x13022b)['then'](function(_0x14a4ba){_0x55393e['count']=_0x14a4ba;if(_0x4d9e92['query'][_0x2734('0x3a')]){_0x1854f1['include']=[{'all':!![]}];}return db[_0x2734('0x25')][_0x2734('0x3b')](_0x1854f1);})['then'](function(_0x1fea11){_0x55393e[_0x2734('0x3c')]=_0x1fea11;return _0x55393e;})[_0x2734('0x22')](respondWithFilteredResult(_0xd2a1a,_0x1854f1))[_0x2734('0x3d')](handleError(_0xd2a1a,null));};exports[_0x2734('0x3e')]=function(_0x2535a4,_0x586088){var _0x3560c9={'raw':![],'where':{'id':_0x2535a4[_0x2734('0x3f')]['id']}},_0x3527c0={};_0x3527c0[_0x2734('0x40')]=_[_0x2734('0x29')](db['FreshsalesConfiguration'][_0x2734('0x41')]);_0x3527c0[_0x2734('0x2c')]=_[_0x2734('0x29')](_0x2535a4['query']);_0x3527c0['filters']=_[_0x2734('0x2b')](_0x3527c0[_0x2734('0x40')],_0x3527c0['query']);_0x3560c9[_0x2734('0x2e')]=_[_0x2734('0x2b')](_0x3527c0['model'],qs[_0x2734('0x2d')](_0x2535a4[_0x2734('0x2c')]['fields']));_0x3560c9[_0x2734('0x2e')]=_0x3560c9[_0x2734('0x2e')]['length']?_0x3560c9[_0x2734('0x2e')]:_0x3527c0[_0x2734('0x40')];if(_0x2535a4[_0x2734('0x2c')][_0x2734('0x3a')]){_0x3560c9[_0x2734('0x42')]=[{'all':!![]}];}_0x3560c9=_[_0x2734('0x38')]({},_0x3560c9,_0x2535a4[_0x2734('0x43')]);return db[_0x2734('0x25')][_0x2734('0x44')](_0x3560c9)[_0x2734('0x22')](handleEntityNotFound(_0x586088,null))[_0x2734('0x22')](respondWithResult(_0x586088,null))['catch'](handleError(_0x586088,null));};exports[_0x2734('0x45')]=function(_0x414683,_0x248c32){return db[_0x2734('0x25')][_0x2734('0x45')](_0x414683[_0x2734('0x46')],{})['then'](respondWithResult(_0x248c32,0xc9))['catch'](handleError(_0x248c32,null));};exports['update']=function(_0x3bec85,_0x3aa1c0){if(_0x3bec85[_0x2734('0x46')]['id']){delete _0x3bec85['body']['id'];}return db['FreshsalesConfiguration'][_0x2734('0x44')]({'where':{'id':_0x3bec85[_0x2734('0x3f')]['id']}})[_0x2734('0x22')](handleEntityNotFound(_0x3aa1c0,null))['then'](saveUpdates(_0x3bec85[_0x2734('0x46')],null))[_0x2734('0x22')](respondWithResult(_0x3aa1c0,null))[_0x2734('0x3d')](handleError(_0x3aa1c0,null));};exports[_0x2734('0x47')]=function(_0x2b6f36,_0x33e75c){return db['FreshsalesConfiguration'][_0x2734('0x44')]({'where':{'id':_0x2b6f36[_0x2734('0x3f')]['id']}})[_0x2734('0x22')](handleEntityNotFound(_0x33e75c,null))[_0x2734('0x22')](removeEntity(_0x33e75c,null))[_0x2734('0x3d')](handleError(_0x33e75c,null));};exports[_0x2734('0x48')]=function(_0x3e1d75,_0x527256,_0xcfd6c4){var _0x3150dd={};var _0x50f87c={};var _0x2bee25;var _0x3497ed;return db[_0x2734('0x25')][_0x2734('0x49')]({'where':{'id':_0x3e1d75[_0x2734('0x3f')]['id']}})[_0x2734('0x22')](handleEntityNotFound(_0x527256,null))[_0x2734('0x22')](function(_0x3cb4cb){if(_0x3cb4cb){_0x2bee25=_0x3cb4cb;_0x50f87c[_0x2734('0x40')]=_['keys'](db['FreshsalesField']['rawAttributes']);_0x50f87c[_0x2734('0x2c')]=_[_0x2734('0x29')](_0x3e1d75[_0x2734('0x2c')]);_0x50f87c[_0x2734('0x2a')]=_[_0x2734('0x2b')](_0x50f87c[_0x2734('0x40')],_0x50f87c['query']);_0x3150dd[_0x2734('0x2e')]=_[_0x2734('0x2b')](_0x50f87c[_0x2734('0x40')],qs[_0x2734('0x2d')](_0x3e1d75['query']['fields']));_0x3150dd['attributes']=_0x3150dd[_0x2734('0x2e')][_0x2734('0x2f')]?_0x3150dd['attributes']:_0x50f87c['model'];_0x3150dd[_0x2734('0x33')]=qs[_0x2734('0x34')](_0x3e1d75[_0x2734('0x2c')]['sort']);_0x3150dd['where']=qs['filters'](_['pick'](_0x3e1d75[_0x2734('0x2c')],_0x50f87c[_0x2734('0x2a')]));if(_0x3e1d75[_0x2734('0x2c')][_0x2734('0x37')]){_0x3150dd[_0x2734('0x35')]=_[_0x2734('0x38')](_0x3150dd['where'],{'$or':_['map'](_0x3150dd[_0x2734('0x2e')],function(_0x2acf07){var _0x3f75f4={};_0x3f75f4[_0x2acf07]={'$like':'%'+_0x3e1d75[_0x2734('0x2c')][_0x2734('0x37')]+'%'};return _0x3f75f4;})});}_0x3150dd=_[_0x2734('0x38')]({},_0x3150dd,_0x3e1d75[_0x2734('0x43')]);return _0x2bee25[_0x2734('0x48')](_0x3150dd);}})[_0x2734('0x22')](function(_0x3ed436){if(_0x3ed436){_0x3497ed=_0x3ed436[_0x2734('0x2f')];if(!_0x3e1d75['query'][_0x2734('0x30')](_0x2734('0x31'))){_0x3150dd[_0x2734('0x32')]=qs[_0x2734('0x32')](_0x3e1d75[_0x2734('0x2c')]['limit']);_0x3150dd[_0x2734('0x1b')]=qs[_0x2734('0x1b')](_0x3e1d75[_0x2734('0x2c')][_0x2734('0x1b')]);}return _0x2bee25[_0x2734('0x48')](_0x3150dd);}})[_0x2734('0x22')](function(_0x210f82){if(_0x210f82){return _0x210f82?{'count':_0x3497ed,'rows':_0x210f82}:null;}})[_0x2734('0x22')](respondWithResult(_0x527256,null))['catch'](handleError(_0x527256,null));};exports[_0x2734('0x4a')]=function(_0x356696,_0x538c84,_0x28e661){var _0x378458={};var _0x205765={};var _0x438fa1;var _0x1394ed;return db[_0x2734('0x25')][_0x2734('0x49')]({'where':{'id':_0x356696[_0x2734('0x3f')]['id']}})[_0x2734('0x22')](handleEntityNotFound(_0x538c84,null))[_0x2734('0x22')](function(_0x5d3f68){if(_0x5d3f68){_0x438fa1=_0x5d3f68;_0x205765[_0x2734('0x40')]=_['keys'](db[_0x2734('0x4b')]['rawAttributes']);_0x205765['query']=_[_0x2734('0x29')](_0x356696[_0x2734('0x2c')]);_0x205765[_0x2734('0x2a')]=_['intersection'](_0x205765['model'],_0x205765['query']);_0x378458['attributes']=_[_0x2734('0x2b')](_0x205765[_0x2734('0x40')],qs[_0x2734('0x2d')](_0x356696[_0x2734('0x2c')]['fields']));_0x378458[_0x2734('0x2e')]=_0x378458[_0x2734('0x2e')]['length']?_0x378458[_0x2734('0x2e')]:_0x205765[_0x2734('0x40')];_0x378458[_0x2734('0x33')]=qs[_0x2734('0x34')](_0x356696['query']['sort']);_0x378458[_0x2734('0x35')]=qs[_0x2734('0x2a')](_[_0x2734('0x36')](_0x356696[_0x2734('0x2c')],_0x205765[_0x2734('0x2a')]));if(_0x356696['query'][_0x2734('0x37')]){_0x378458[_0x2734('0x35')]=_['merge'](_0x378458[_0x2734('0x35')],{'$or':_[_0x2734('0x28')](_0x378458[_0x2734('0x2e')],function(_0x53e2b6){var _0x74b552={};_0x74b552[_0x53e2b6]={'$like':'%'+_0x356696[_0x2734('0x2c')][_0x2734('0x37')]+'%'};return _0x74b552;})});}_0x378458=_['merge']({},_0x378458,_0x356696[_0x2734('0x43')]);return _0x438fa1[_0x2734('0x4a')](_0x378458);}})[_0x2734('0x22')](function(_0x17134c){if(_0x17134c){_0x1394ed=_0x17134c[_0x2734('0x2f')];if(!_0x356696[_0x2734('0x2c')][_0x2734('0x30')](_0x2734('0x31'))){_0x378458[_0x2734('0x32')]=qs[_0x2734('0x32')](_0x356696['query'][_0x2734('0x32')]);_0x378458[_0x2734('0x1b')]=qs[_0x2734('0x1b')](_0x356696[_0x2734('0x2c')]['offset']);}return _0x438fa1[_0x2734('0x4a')](_0x378458);}})['then'](function(_0xe61609){if(_0xe61609){return _0xe61609?{'count':_0x1394ed,'rows':_0xe61609}:null;}})['then'](respondWithResult(_0x538c84,null))['catch'](handleError(_0x538c84,null));};exports[_0x2734('0x4c')]=function(_0x1c222d,_0xa417a9,_0x46bf18){var _0x43b770={};var _0x429d3b={};var _0x582dec;var _0x55fc61;return db[_0x2734('0x25')][_0x2734('0x49')]({'where':{'id':_0x1c222d[_0x2734('0x3f')]['id']}})[_0x2734('0x22')](handleEntityNotFound(_0xa417a9,null))[_0x2734('0x22')](function(_0x13b1b8){if(_0x13b1b8){_0x582dec=_0x13b1b8;_0x429d3b[_0x2734('0x40')]=_[_0x2734('0x29')](db[_0x2734('0x4b')]['rawAttributes']);_0x429d3b[_0x2734('0x2c')]=_[_0x2734('0x29')](_0x1c222d[_0x2734('0x2c')]);_0x429d3b[_0x2734('0x2a')]=_[_0x2734('0x2b')](_0x429d3b[_0x2734('0x40')],_0x429d3b['query']);_0x43b770[_0x2734('0x2e')]=_[_0x2734('0x2b')](_0x429d3b[_0x2734('0x40')],qs[_0x2734('0x2d')](_0x1c222d[_0x2734('0x2c')][_0x2734('0x2d')]));_0x43b770[_0x2734('0x2e')]=_0x43b770[_0x2734('0x2e')]['length']?_0x43b770[_0x2734('0x2e')]:_0x429d3b[_0x2734('0x40')];_0x43b770[_0x2734('0x33')]=qs[_0x2734('0x34')](_0x1c222d[_0x2734('0x2c')][_0x2734('0x34')]);_0x43b770[_0x2734('0x35')]=qs[_0x2734('0x2a')](_['pick'](_0x1c222d['query'],_0x429d3b[_0x2734('0x2a')]));if(_0x1c222d[_0x2734('0x2c')]['filter']){_0x43b770[_0x2734('0x35')]=_['merge'](_0x43b770['where'],{'$or':_[_0x2734('0x28')](_0x43b770[_0x2734('0x2e')],function(_0x13441f){var _0x5896ea={};_0x5896ea[_0x13441f]={'$like':'%'+_0x1c222d[_0x2734('0x2c')][_0x2734('0x37')]+'%'};return _0x5896ea;})});}_0x43b770=_['merge']({},_0x43b770,_0x1c222d[_0x2734('0x43')]);return _0x582dec[_0x2734('0x4c')](_0x43b770);}})[_0x2734('0x22')](function(_0x3d8145){if(_0x3d8145){_0x55fc61=_0x3d8145[_0x2734('0x2f')];if(!_0x1c222d[_0x2734('0x2c')][_0x2734('0x30')](_0x2734('0x31'))){_0x43b770[_0x2734('0x32')]=qs[_0x2734('0x32')](_0x1c222d[_0x2734('0x2c')][_0x2734('0x32')]);_0x43b770[_0x2734('0x1b')]=qs[_0x2734('0x1b')](_0x1c222d['query'][_0x2734('0x1b')]);}return _0x582dec[_0x2734('0x4c')](_0x43b770);}})[_0x2734('0x22')](function(_0x1fdb9b){if(_0x1fdb9b){return _0x1fdb9b?{'count':_0x55fc61,'rows':_0x1fdb9b}:null;}})['then'](respondWithResult(_0xa417a9,null))[_0x2734('0x3d')](handleError(_0xa417a9,null));}; \ No newline at end of file +var _0xcaca=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','FreshsalesConfiguration','rawAttributes','fieldName','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','getSubjects','findOne','FreshsalesField','getDescriptions','pick','getFields','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x5074e9,_0x48a968){var _0x19d105=function(_0x2ce1a4){while(--_0x2ce1a4){_0x5074e9['push'](_0x5074e9['shift']());}};_0x19d105(++_0x48a968);}(_0xcaca,0x18e));var _0xacac=function(_0x21dd85,_0x384ae1){_0x21dd85=_0x21dd85-0x0;var _0x7928b0=_0xcaca[_0x21dd85];return _0x7928b0;};'use strict';var emlformat=require(_0xacac('0x0'));var rimraf=require(_0xacac('0x1'));var zipdir=require(_0xacac('0x2'));var jsonpatch=require(_0xacac('0x3'));var rp=require(_0xacac('0x4'));var moment=require('moment');var BPromise=require(_0xacac('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xacac('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xacac('0x7'));var fs=require('fs');var fs_extra=require(_0xacac('0x8'));var _=require(_0xacac('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xacac('0xa'));var deskjs=require(_0xacac('0xb'));var toCsv=require(_0xacac('0xc'));var querystring=require(_0xacac('0xd'));var Papa=require(_0xacac('0xe'));var Redis=require(_0xacac('0xf'));var authService=require(_0xacac('0x10'));var qs=require(_0xacac('0x11'));var as=require(_0xacac('0x12'));var hardwareService=require(_0xacac('0x13'));var logger=require(_0xacac('0x14'))('api');var utils=require(_0xacac('0x15'));var config=require(_0xacac('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xacac('0x17'))['db'];function respondWithStatusCode(_0x2ed586,_0x5a2423){_0x5a2423=_0x5a2423||0xcc;return function(_0x1b2b89){if(_0x1b2b89){return _0x2ed586[_0xacac('0x18')](_0x5a2423);}return _0x2ed586[_0xacac('0x19')](_0x5a2423)[_0xacac('0x1a')]();};}function respondWithResult(_0x9e5b53,_0x506536){_0x506536=_0x506536||0xc8;return function(_0x15ae93){if(_0x15ae93){return _0x9e5b53[_0xacac('0x19')](_0x506536)[_0xacac('0x1b')](_0x15ae93);}};}function respondWithFilteredResult(_0x1df027,_0xa644a0){return function(_0x162050){if(_0x162050){var _0x31218c=typeof _0xa644a0['offset']===_0xacac('0x1c')&&typeof _0xa644a0[_0xacac('0x1d')]===_0xacac('0x1c');var _0x38490f=_0x162050[_0xacac('0x1e')];var _0x5db3f1=_0x31218c?0x0:_0xa644a0[_0xacac('0x1f')];var _0x71b278=_0x31218c?_0x162050[_0xacac('0x1e')]:_0xa644a0[_0xacac('0x1f')]+_0xa644a0[_0xacac('0x1d')];var _0x44a7d7;if(_0x71b278>=_0x38490f){_0x71b278=_0x38490f;_0x44a7d7=0xc8;}else{_0x44a7d7=0xce;}_0x1df027['status'](_0x44a7d7);return _0x1df027[_0xacac('0x20')](_0xacac('0x21'),_0x5db3f1+'-'+_0x71b278+'/'+_0x38490f)[_0xacac('0x1b')](_0x162050);}return null;};}function patchUpdates(_0x49e509){return function(_0xee75ad){try{jsonpatch[_0xacac('0x22')](_0xee75ad,_0x49e509,!![]);}catch(_0x2e21ec){return BPromise[_0xacac('0x23')](_0x2e21ec);}return _0xee75ad[_0xacac('0x24')]();};}function saveUpdates(_0x10f585,_0x205901){return function(_0x3b7574){if(_0x3b7574){return _0x3b7574[_0xacac('0x25')](_0x10f585)[_0xacac('0x26')](function(_0x367b96){return _0x367b96;});}return null;};}function removeEntity(_0x58c6e0,_0x442e25){return function(_0x3bd398){if(_0x3bd398){return _0x3bd398[_0xacac('0x27')]()[_0xacac('0x26')](function(){_0x58c6e0[_0xacac('0x19')](0xcc)[_0xacac('0x1a')]();});}};}function handleEntityNotFound(_0x39b9d1,_0x84b79c){return function(_0x436f62){if(!_0x436f62){_0x39b9d1[_0xacac('0x18')](0x194);}return _0x436f62;};}function handleError(_0x17ab9a,_0x3e0bbc){_0x3e0bbc=_0x3e0bbc||0x1f4;return function(_0x46ccf5){logger[_0xacac('0x28')](_0x46ccf5[_0xacac('0x29')]);if(_0x46ccf5[_0xacac('0x2a')]){delete _0x46ccf5['name'];}_0x17ab9a['status'](_0x3e0bbc)[_0xacac('0x2b')](_0x46ccf5);};}exports['index']=function(_0x49fae4,_0x540bf3){var _0x23d19f={},_0x204335={},_0x2b5bf8={'count':0x0,'rows':[]};var _0x275f45=_[_0xacac('0x2c')](db[_0xacac('0x2d')][_0xacac('0x2e')],function(_0x1a965e){return{'name':_0x1a965e[_0xacac('0x2f')],'type':_0x1a965e['type'][_0xacac('0x30')]};});_0x204335['model']=_['map'](_0x275f45,'name');_0x204335[_0xacac('0x31')]=_['keys'](_0x49fae4[_0xacac('0x31')]);_0x204335[_0xacac('0x32')]=_[_0xacac('0x33')](_0x204335[_0xacac('0x34')],_0x204335[_0xacac('0x31')]);_0x23d19f['attributes']=_[_0xacac('0x33')](_0x204335[_0xacac('0x34')],qs[_0xacac('0x35')](_0x49fae4['query']['fields']));_0x23d19f[_0xacac('0x36')]=_0x23d19f['attributes'][_0xacac('0x37')]?_0x23d19f[_0xacac('0x36')]:_0x204335['model'];if(!_0x49fae4[_0xacac('0x31')][_0xacac('0x38')](_0xacac('0x39'))){_0x23d19f['limit']=qs['limit'](_0x49fae4[_0xacac('0x31')][_0xacac('0x1d')]);_0x23d19f[_0xacac('0x1f')]=qs[_0xacac('0x1f')](_0x49fae4['query'][_0xacac('0x1f')]);}_0x23d19f[_0xacac('0x3a')]=qs[_0xacac('0x3b')](_0x49fae4[_0xacac('0x31')][_0xacac('0x3b')]);_0x23d19f[_0xacac('0x3c')]=qs[_0xacac('0x32')](_['pick'](_0x49fae4['query'],_0x204335[_0xacac('0x32')]),_0x275f45);if(_0x49fae4[_0xacac('0x31')][_0xacac('0x3d')]){_0x23d19f[_0xacac('0x3c')]=_[_0xacac('0x3e')](_0x23d19f[_0xacac('0x3c')],{'$or':_['map'](_0x275f45,function(_0x2cf6b3){if(_0x2cf6b3[_0xacac('0x3f')]!==_0xacac('0x40')){var _0x488438={};_0x488438[_0x2cf6b3[_0xacac('0x2a')]]={'$like':'%'+_0x49fae4[_0xacac('0x31')]['filter']+'%'};return _0x488438;}})});}_0x23d19f=_[_0xacac('0x3e')]({},_0x23d19f,_0x49fae4[_0xacac('0x41')]);var _0x2456a7={'where':_0x23d19f['where']};return db[_0xacac('0x2d')]['count'](_0x2456a7)[_0xacac('0x26')](function(_0x1775a3){_0x2b5bf8[_0xacac('0x1e')]=_0x1775a3;if(_0x49fae4[_0xacac('0x31')][_0xacac('0x42')]){_0x23d19f[_0xacac('0x43')]=[{'all':!![]}];}return db[_0xacac('0x2d')][_0xacac('0x44')](_0x23d19f);})['then'](function(_0x42ba2e){_0x2b5bf8[_0xacac('0x45')]=_0x42ba2e;return _0x2b5bf8;})[_0xacac('0x26')](respondWithFilteredResult(_0x540bf3,_0x23d19f))[_0xacac('0x46')](handleError(_0x540bf3,null));};exports[_0xacac('0x47')]=function(_0x5650d4,_0x576385){var _0xd293bf={'raw':![],'where':{'id':_0x5650d4[_0xacac('0x48')]['id']}},_0x36829a={};_0x36829a[_0xacac('0x34')]=_[_0xacac('0x49')](db[_0xacac('0x2d')][_0xacac('0x2e')]);_0x36829a[_0xacac('0x31')]=_[_0xacac('0x49')](_0x5650d4[_0xacac('0x31')]);_0x36829a[_0xacac('0x32')]=_['intersection'](_0x36829a[_0xacac('0x34')],_0x36829a[_0xacac('0x31')]);_0xd293bf[_0xacac('0x36')]=_[_0xacac('0x33')](_0x36829a[_0xacac('0x34')],qs['fields'](_0x5650d4[_0xacac('0x31')][_0xacac('0x35')]));_0xd293bf[_0xacac('0x36')]=_0xd293bf[_0xacac('0x36')][_0xacac('0x37')]?_0xd293bf[_0xacac('0x36')]:_0x36829a[_0xacac('0x34')];if(_0x5650d4['query']['includeAll']){_0xd293bf[_0xacac('0x43')]=[{'all':!![]}];}_0xd293bf=_[_0xacac('0x3e')]({},_0xd293bf,_0x5650d4[_0xacac('0x41')]);return db[_0xacac('0x2d')][_0xacac('0x4a')](_0xd293bf)['then'](handleEntityNotFound(_0x576385,null))[_0xacac('0x26')](respondWithResult(_0x576385,null))[_0xacac('0x46')](handleError(_0x576385,null));};exports[_0xacac('0x4b')]=function(_0x5b6964,_0xf034f8){return db[_0xacac('0x2d')][_0xacac('0x4b')](_0x5b6964['body'],{})[_0xacac('0x26')](respondWithResult(_0xf034f8,0xc9))['catch'](handleError(_0xf034f8,null));};exports['update']=function(_0x2dcf5a,_0x4b1d63){if(_0x2dcf5a[_0xacac('0x4c')]['id']){delete _0x2dcf5a[_0xacac('0x4c')]['id'];}return db[_0xacac('0x2d')][_0xacac('0x4a')]({'where':{'id':_0x2dcf5a[_0xacac('0x48')]['id']}})[_0xacac('0x26')](handleEntityNotFound(_0x4b1d63,null))[_0xacac('0x26')](saveUpdates(_0x2dcf5a[_0xacac('0x4c')],null))['then'](respondWithResult(_0x4b1d63,null))[_0xacac('0x46')](handleError(_0x4b1d63,null));};exports[_0xacac('0x27')]=function(_0x66835d,_0x344349){return db['FreshsalesConfiguration'][_0xacac('0x4a')]({'where':{'id':_0x66835d[_0xacac('0x48')]['id']}})[_0xacac('0x26')](handleEntityNotFound(_0x344349,null))[_0xacac('0x26')](removeEntity(_0x344349,null))[_0xacac('0x46')](handleError(_0x344349,null));};exports[_0xacac('0x4d')]=function(_0x4ac316,_0x15dbd6,_0x4bafe2){var _0x25886d={};var _0x51986d={};var _0x367999;var _0x5627f8;return db[_0xacac('0x2d')][_0xacac('0x4e')]({'where':{'id':_0x4ac316[_0xacac('0x48')]['id']}})['then'](handleEntityNotFound(_0x15dbd6,null))['then'](function(_0xe3d70e){if(_0xe3d70e){_0x367999=_0xe3d70e;_0x51986d['model']=_[_0xacac('0x49')](db[_0xacac('0x4f')][_0xacac('0x2e')]);_0x51986d[_0xacac('0x31')]=_['keys'](_0x4ac316[_0xacac('0x31')]);_0x51986d[_0xacac('0x32')]=_['intersection'](_0x51986d[_0xacac('0x34')],_0x51986d[_0xacac('0x31')]);_0x25886d[_0xacac('0x36')]=_[_0xacac('0x33')](_0x51986d['model'],qs['fields'](_0x4ac316[_0xacac('0x31')][_0xacac('0x35')]));_0x25886d[_0xacac('0x36')]=_0x25886d[_0xacac('0x36')][_0xacac('0x37')]?_0x25886d['attributes']:_0x51986d[_0xacac('0x34')];_0x25886d[_0xacac('0x3a')]=qs[_0xacac('0x3b')](_0x4ac316['query'][_0xacac('0x3b')]);_0x25886d[_0xacac('0x3c')]=qs[_0xacac('0x32')](_['pick'](_0x4ac316[_0xacac('0x31')],_0x51986d[_0xacac('0x32')]));if(_0x4ac316['query'][_0xacac('0x3d')]){_0x25886d[_0xacac('0x3c')]=_['merge'](_0x25886d[_0xacac('0x3c')],{'$or':_[_0xacac('0x2c')](_0x25886d[_0xacac('0x36')],function(_0x5579ac){var _0x33e5e7={};_0x33e5e7[_0x5579ac]={'$like':'%'+_0x4ac316['query']['filter']+'%'};return _0x33e5e7;})});}_0x25886d=_[_0xacac('0x3e')]({},_0x25886d,_0x4ac316[_0xacac('0x41')]);return _0x367999[_0xacac('0x4d')](_0x25886d);}})['then'](function(_0xf72b22){if(_0xf72b22){_0x5627f8=_0xf72b22[_0xacac('0x37')];if(!_0x4ac316['query'][_0xacac('0x38')](_0xacac('0x39'))){_0x25886d[_0xacac('0x1d')]=qs[_0xacac('0x1d')](_0x4ac316[_0xacac('0x31')]['limit']);_0x25886d[_0xacac('0x1f')]=qs[_0xacac('0x1f')](_0x4ac316['query'][_0xacac('0x1f')]);}return _0x367999[_0xacac('0x4d')](_0x25886d);}})[_0xacac('0x26')](function(_0x3d4705){if(_0x3d4705){return _0x3d4705?{'count':_0x5627f8,'rows':_0x3d4705}:null;}})[_0xacac('0x26')](respondWithResult(_0x15dbd6,null))[_0xacac('0x46')](handleError(_0x15dbd6,null));};exports[_0xacac('0x50')]=function(_0x46c60b,_0x7bf1ed,_0x48e78f){var _0x546201={};var _0x502c32={};var _0x2a9683;var _0x1ea86f;return db[_0xacac('0x2d')][_0xacac('0x4e')]({'where':{'id':_0x46c60b[_0xacac('0x48')]['id']}})['then'](handleEntityNotFound(_0x7bf1ed,null))['then'](function(_0x3d5414){if(_0x3d5414){_0x2a9683=_0x3d5414;_0x502c32[_0xacac('0x34')]=_['keys'](db[_0xacac('0x4f')][_0xacac('0x2e')]);_0x502c32[_0xacac('0x31')]=_['keys'](_0x46c60b[_0xacac('0x31')]);_0x502c32[_0xacac('0x32')]=_[_0xacac('0x33')](_0x502c32[_0xacac('0x34')],_0x502c32[_0xacac('0x31')]);_0x546201['attributes']=_['intersection'](_0x502c32[_0xacac('0x34')],qs['fields'](_0x46c60b[_0xacac('0x31')]['fields']));_0x546201['attributes']=_0x546201[_0xacac('0x36')][_0xacac('0x37')]?_0x546201[_0xacac('0x36')]:_0x502c32[_0xacac('0x34')];_0x546201[_0xacac('0x3a')]=qs[_0xacac('0x3b')](_0x46c60b['query'][_0xacac('0x3b')]);_0x546201['where']=qs[_0xacac('0x32')](_[_0xacac('0x51')](_0x46c60b[_0xacac('0x31')],_0x502c32[_0xacac('0x32')]));if(_0x46c60b[_0xacac('0x31')]['filter']){_0x546201[_0xacac('0x3c')]=_[_0xacac('0x3e')](_0x546201['where'],{'$or':_[_0xacac('0x2c')](_0x546201[_0xacac('0x36')],function(_0x2e75b9){var _0x511a2f={};_0x511a2f[_0x2e75b9]={'$like':'%'+_0x46c60b[_0xacac('0x31')][_0xacac('0x3d')]+'%'};return _0x511a2f;})});}_0x546201=_[_0xacac('0x3e')]({},_0x546201,_0x46c60b[_0xacac('0x41')]);return _0x2a9683[_0xacac('0x50')](_0x546201);}})[_0xacac('0x26')](function(_0x15db2a){if(_0x15db2a){_0x1ea86f=_0x15db2a[_0xacac('0x37')];if(!_0x46c60b[_0xacac('0x31')][_0xacac('0x38')](_0xacac('0x39'))){_0x546201[_0xacac('0x1d')]=qs['limit'](_0x46c60b[_0xacac('0x31')]['limit']);_0x546201['offset']=qs[_0xacac('0x1f')](_0x46c60b['query']['offset']);}return _0x2a9683[_0xacac('0x50')](_0x546201);}})[_0xacac('0x26')](function(_0x24fde8){if(_0x24fde8){return _0x24fde8?{'count':_0x1ea86f,'rows':_0x24fde8}:null;}})['then'](respondWithResult(_0x7bf1ed,null))['catch'](handleError(_0x7bf1ed,null));};exports[_0xacac('0x52')]=function(_0x7eda51,_0x4bfdab,_0x19f71b){var _0x5086b1={};var _0x274876={};var _0x364e32;var _0x432920;return db[_0xacac('0x2d')][_0xacac('0x4e')]({'where':{'id':_0x7eda51[_0xacac('0x48')]['id']}})[_0xacac('0x26')](handleEntityNotFound(_0x4bfdab,null))[_0xacac('0x26')](function(_0x1b0000){if(_0x1b0000){_0x364e32=_0x1b0000;_0x274876[_0xacac('0x34')]=_[_0xacac('0x49')](db[_0xacac('0x4f')]['rawAttributes']);_0x274876[_0xacac('0x31')]=_[_0xacac('0x49')](_0x7eda51[_0xacac('0x31')]);_0x274876[_0xacac('0x32')]=_[_0xacac('0x33')](_0x274876['model'],_0x274876['query']);_0x5086b1[_0xacac('0x36')]=_[_0xacac('0x33')](_0x274876[_0xacac('0x34')],qs[_0xacac('0x35')](_0x7eda51[_0xacac('0x31')]['fields']));_0x5086b1[_0xacac('0x36')]=_0x5086b1['attributes'][_0xacac('0x37')]?_0x5086b1[_0xacac('0x36')]:_0x274876[_0xacac('0x34')];_0x5086b1[_0xacac('0x3a')]=qs[_0xacac('0x3b')](_0x7eda51[_0xacac('0x31')][_0xacac('0x3b')]);_0x5086b1[_0xacac('0x3c')]=qs[_0xacac('0x32')](_[_0xacac('0x51')](_0x7eda51[_0xacac('0x31')],_0x274876['filters']));if(_0x7eda51[_0xacac('0x31')][_0xacac('0x3d')]){_0x5086b1[_0xacac('0x3c')]=_['merge'](_0x5086b1[_0xacac('0x3c')],{'$or':_[_0xacac('0x2c')](_0x5086b1[_0xacac('0x36')],function(_0x3fa64c){var _0xdd3073={};_0xdd3073[_0x3fa64c]={'$like':'%'+_0x7eda51[_0xacac('0x31')][_0xacac('0x3d')]+'%'};return _0xdd3073;})});}_0x5086b1=_['merge']({},_0x5086b1,_0x7eda51[_0xacac('0x41')]);return _0x364e32[_0xacac('0x52')](_0x5086b1);}})[_0xacac('0x26')](function(_0x5f0fed){if(_0x5f0fed){_0x432920=_0x5f0fed[_0xacac('0x37')];if(!_0x7eda51[_0xacac('0x31')][_0xacac('0x38')](_0xacac('0x39'))){_0x5086b1[_0xacac('0x1d')]=qs[_0xacac('0x1d')](_0x7eda51[_0xacac('0x31')][_0xacac('0x1d')]);_0x5086b1[_0xacac('0x1f')]=qs['offset'](_0x7eda51[_0xacac('0x31')][_0xacac('0x1f')]);}return _0x364e32[_0xacac('0x52')](_0x5086b1);}})[_0xacac('0x26')](function(_0x54b568){if(_0x54b568){return _0x54b568?{'count':_0x432920,'rows':_0x54b568}:null;}})['then'](respondWithResult(_0x4bfdab,null))['catch'](handleError(_0x4bfdab,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index d204693..4e311ee 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 _0x4269=['./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration','int_freshsales_configurations','lodash','util','../../config/logger','moment','path','rimraf','../../config/environment'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x4269,0xe9));var _0x9426=function(_0x5519e0,_0xec8f68){_0x5519e0=_0x5519e0-0x0;var _0x14dfb2=_0x4269[_0x5519e0];return _0x14dfb2;};'use strict';var _=require(_0x9426('0x0'));var util=require(_0x9426('0x1'));var logger=require(_0x9426('0x2'))('api');var moment=require(_0x9426('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9426('0x4'));var rimraf=require(_0x9426('0x5'));var config=require(_0x9426('0x6'));var attributes=require(_0x9426('0x7'));module[_0x9426('0x8')]=function(_0x37b2e2,_0x42477d){return _0x37b2e2[_0x9426('0x9')](_0x9426('0xa'),attributes,{'tableName':_0x9426('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x70b1=['define','int_freshsales_configurations','lodash','util','../../config/logger','api','moment','request-promise','../../config/environment','./intFreshsalesConfiguration.attributes','exports'];(function(_0x2d0484,_0x36cb59){var _0x4013d1=function(_0x33f804){while(--_0x33f804){_0x2d0484['push'](_0x2d0484['shift']());}};_0x4013d1(++_0x36cb59);}(_0x70b1,0x14c));var _0x170b=function(_0x3077c7,_0x486647){_0x3077c7=_0x3077c7-0x0;var _0xceb15a=_0x70b1[_0x3077c7];return _0xceb15a;};'use strict';var _=require(_0x170b('0x0'));var util=require(_0x170b('0x1'));var logger=require(_0x170b('0x2'))(_0x170b('0x3'));var moment=require(_0x170b('0x4'));var BPromise=require('bluebird');var rp=require(_0x170b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x170b('0x6'));var attributes=require(_0x170b('0x7'));module[_0x170b('0x8')]=function(_0x9ed757,_0x9a0d15){return _0x9ed757[_0x170b('0x9')]('FreshsalesConfiguration',attributes,{'tableName':_0x170b('0xa'),'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 2c6f2f3..23827be 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 _0x34fa=['stringify','error','code','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x207a02,_0x278c56){var _0xd995c3=function(_0x24e415){while(--_0x24e415){_0x207a02['push'](_0x207a02['shift']());}};_0xd995c3(++_0x278c56);}(_0x34fa,0x1aa));var _0xa34f=function(_0x537a06,_0x88b891){_0x537a06=_0x537a06-0x0;var _0xcf8a4b=_0x34fa[_0x537a06];return _0xcf8a4b;};'use strict';var _=require(_0xa34f('0x0'));var util=require(_0xa34f('0x1'));var moment=require(_0xa34f('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa34f('0x3'));var db=require(_0xa34f('0x4'))['db'];var utils=require(_0xa34f('0x5'));var logger=require(_0xa34f('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xa34f('0x7'));var client=jayson['client'][_0xa34f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5e655d,_0x50b12e,_0x5a63a7){return new BPromise(function(_0x3925dd,_0x1c091f){return client['request'](_0x5e655d,_0x5a63a7)[_0xa34f('0x9')](function(_0x454b91){logger[_0xa34f('0xa')](_0xa34f('0xb'),_0x50b12e,_0xa34f('0xc'));logger[_0xa34f('0xd')]('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x50b12e,_0xa34f('0xc'),JSON[_0xa34f('0xe')](_0x454b91));if(_0x454b91[_0xa34f('0xf')]){if(_0x454b91[_0xa34f('0xf')][_0xa34f('0x10')]===0x1f4){logger[_0xa34f('0xf')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x50b12e,_0x454b91[_0xa34f('0xf')][_0xa34f('0x11')]);return _0x1c091f(_0x454b91['error'][_0xa34f('0x11')]);}logger[_0xa34f('0xf')](_0xa34f('0xb'),_0x50b12e,_0x454b91[_0xa34f('0xf')][_0xa34f('0x11')]);return _0x3925dd(_0x454b91['error'][_0xa34f('0x11')]);}else{logger[_0xa34f('0xa')](_0xa34f('0xb'),_0x50b12e,'request\x20sent');_0x3925dd(_0x454b91[_0xa34f('0x12')][_0xa34f('0x11')]);}})[_0xa34f('0x13')](function(_0x498ed3){logger[_0xa34f('0xf')](_0xa34f('0xb'),_0x50b12e,_0x498ed3);_0x1c091f(_0x498ed3);});});} \ No newline at end of file +var _0x7400=['http','request','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7400,0x1d8));var _0x0740=function(_0x42bfc9,_0x92ccf5){_0x42bfc9=_0x42bfc9-0x0;var _0x645e2b=_0x7400[_0x42bfc9];return _0x645e2b;};'use strict';var _=require(_0x0740('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x0740('0x1'));var rs=require(_0x0740('0x2'));var fs=require('fs');var Redis=require(_0x0740('0x3'));var db=require(_0x0740('0x4'))['db'];var utils=require(_0x0740('0x5'));var logger=require(_0x0740('0x6'))(_0x0740('0x7'));var config=require(_0x0740('0x8'));var jayson=require(_0x0740('0x9'));var client=jayson[_0x0740('0xa')][_0x0740('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x38de9e,_0x39c2d3,_0x464967){return new BPromise(function(_0x4be1fa,_0x4a525b){return client[_0x0740('0xc')](_0x38de9e,_0x464967)['then'](function(_0x29626c){logger[_0x0740('0xd')](_0x0740('0xe'),_0x39c2d3,_0x0740('0xf'));logger['debug'](_0x0740('0x10'),_0x39c2d3,_0x0740('0xf'),JSON[_0x0740('0x11')](_0x29626c));if(_0x29626c[_0x0740('0x12')]){if(_0x29626c[_0x0740('0x12')][_0x0740('0x13')]===0x1f4){logger['error'](_0x0740('0xe'),_0x39c2d3,_0x29626c[_0x0740('0x12')]['message']);return _0x4a525b(_0x29626c[_0x0740('0x12')]['message']);}logger[_0x0740('0x12')](_0x0740('0xe'),_0x39c2d3,_0x29626c[_0x0740('0x12')][_0x0740('0x14')]);return _0x4be1fa(_0x29626c['error']['message']);}else{logger[_0x0740('0xd')](_0x0740('0xe'),_0x39c2d3,_0x0740('0xf'));_0x4be1fa(_0x29626c['result'][_0x0740('0x14')]);}})['catch'](function(_0x4f9fed){logger[_0x0740('0x12')](_0x0740('0xe'),_0x39c2d3,_0x4f9fed);_0x4a525b(_0x4f9fed);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index d96121c..ec6f2d3 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 _0xf53f=['get','isAuthenticated','show','post','put','update','/:id','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller'];(function(_0xe53e44,_0x172df){var _0x1bae8e=function(_0x5b385b){while(--_0x5b385b){_0xe53e44['push'](_0xe53e44['shift']());}};_0x1bae8e(++_0x172df);}(_0xf53f,0x8d));var _0xff53=function(_0x137e11,_0x27a58d){_0x137e11=_0x137e11-0x0;var _0xb2774f=_0xf53f[_0x137e11];return _0xb2774f;};'use strict';var multer=require(_0xff53('0x0'));var util=require(_0xff53('0x1'));var path=require(_0xff53('0x2'));var timeout=require(_0xff53('0x3'));var express=require(_0xff53('0x4'));var router=express[_0xff53('0x5')]();var fs_extra=require(_0xff53('0x6'));var auth=require(_0xff53('0x7'));var interaction=require(_0xff53('0x8'));var config=require(_0xff53('0x9'));var controller=require(_0xff53('0xa'));router[_0xff53('0xb')]('/',auth['isAuthenticated'](),controller['index']);router[_0xff53('0xb')]('/:id',auth[_0xff53('0xc')](),controller[_0xff53('0xd')]);router[_0xff53('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0xff53('0xf')]('/:id',auth[_0xff53('0xc')](),controller[_0xff53('0x10')]);router['delete'](_0xff53('0x11'),auth[_0xff53('0xc')](),controller['destroy']);module[_0xff53('0x12')]=router; \ No newline at end of file +var _0xecd5=['delete','destroy','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshsalesField.controller','isAuthenticated','index','/:id','show','post','create','put','update'];(function(_0x9b50c4,_0x274a56){var _0x3276e5=function(_0x1b23ff){while(--_0x1b23ff){_0x9b50c4['push'](_0x9b50c4['shift']());}};_0x3276e5(++_0x274a56);}(_0xecd5,0x110));var _0x5ecd=function(_0x1ca072,_0x1ef001){_0x1ca072=_0x1ca072-0x0;var _0x9f5e46=_0xecd5[_0x1ca072];return _0x9f5e46;};'use strict';var multer=require('multer');var util=require(_0x5ecd('0x0'));var path=require(_0x5ecd('0x1'));var timeout=require(_0x5ecd('0x2'));var express=require('express');var router=express[_0x5ecd('0x3')]();var fs_extra=require(_0x5ecd('0x4'));var auth=require(_0x5ecd('0x5'));var interaction=require(_0x5ecd('0x6'));var config=require('../../config/environment');var controller=require(_0x5ecd('0x7'));router['get']('/',auth[_0x5ecd('0x8')](),controller[_0x5ecd('0x9')]);router['get'](_0x5ecd('0xa'),auth[_0x5ecd('0x8')](),controller[_0x5ecd('0xb')]);router[_0x5ecd('0xc')]('/',auth[_0x5ecd('0x8')](),controller[_0x5ecd('0xd')]);router[_0x5ecd('0xe')](_0x5ecd('0xa'),auth[_0x5ecd('0x8')](),controller[_0x5ecd('0xf')]);router[_0x5ecd('0x10')](_0x5ecd('0xa'),auth['isAuthenticated'](),controller[_0x5ecd('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 0587afc..13bc5ec 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 _0xb398=['STRING','variable','BOOLEAN','exports','ENUM','string','customVariable','picklist'];(function(_0x7afa09,_0x39bf57){var _0x261bc6=function(_0x4c91e6){while(--_0x4c91e6){_0x7afa09['push'](_0x7afa09['shift']());}};_0x261bc6(++_0x39bf57);}(_0xb398,0x1d3));var _0x8b39=function(_0x5cee2e,_0x4d0d08){_0x5cee2e=_0x5cee2e-0x0;var _0x19d977=_0xb398[_0x5cee2e];return _0x19d977;};'use strict';var Sequelize=require('sequelize');module[_0x8b39('0x0')]={'type':{'type':Sequelize[_0x8b39('0x1')](_0x8b39('0x2'),'variable',_0x8b39('0x3'),'keyValue',_0x8b39('0x4')),'defaultValue':_0x8b39('0x2')},'content':{'type':Sequelize[_0x8b39('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x8b39('0x2'),_0x8b39('0x6'),_0x8b39('0x3'))},'keyContent':{'type':Sequelize[_0x8b39('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x8b39('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8b39('0x5')]}}; \ No newline at end of file +var _0xe5b7=['STRING','variable','sequelize','ENUM','string','customVariable','keyValue'];(function(_0x55b633,_0x321e5a){var _0x24c8a2=function(_0xab5c90){while(--_0xab5c90){_0x55b633['push'](_0x55b633['shift']());}};_0x24c8a2(++_0x321e5a);}(_0xe5b7,0xaa));var _0x7e5b=function(_0x21a56b,_0x2e3192){_0x21a56b=_0x21a56b-0x0;var _0x47dce7=_0xe5b7[_0x21a56b];return _0x47dce7;};'use strict';var Sequelize=require(_0x7e5b('0x0'));module['exports']={'type':{'type':Sequelize[_0x7e5b('0x1')](_0x7e5b('0x2'),'variable',_0x7e5b('0x3'),_0x7e5b('0x4'),'picklist'),'defaultValue':_0x7e5b('0x2')},'content':{'type':Sequelize[_0x7e5b('0x5')]},'key':{'type':Sequelize[_0x7e5b('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0x7e5b('0x2'),_0x7e5b('0x6'),_0x7e5b('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x7e5b('0x5')]},'nameField':{'type':Sequelize[_0x7e5b('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7e5b('0x5')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 82546f0..de4f61b 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 _0xeae8=['eml-format','zip-dir','request-promise','mustache','sox','fs-extra','lodash','crypto','jsforce','to-csv','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','status','end','offset','undefined','count','limit','Content-Range','apply','save','update','then','destroy','sendStatus','error','name','send','index','map','FreshsalesField','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','rows','catch','show','includeAll','include','create','body','params','find'];(function(_0x36a3c5,_0x3bd7e6){var _0x369a67=function(_0x54d6ff){while(--_0x54d6ff){_0x36a3c5['push'](_0x36a3c5['shift']());}};_0x369a67(++_0x3bd7e6);}(_0xeae8,0x108));var _0x8eae=function(_0x17f234,_0x2ab699){_0x17f234=_0x17f234-0x0;var _0xf64326=_0xeae8[_0x17f234];return _0xf64326;};'use strict';var emlformat=require(_0x8eae('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8eae('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8eae('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8eae('0x3'));var util=require('util');var path=require('path');var sox=require(_0x8eae('0x4'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8eae('0x5'));var _=require(_0x8eae('0x6'));var squel=require('squel');var crypto=require(_0x8eae('0x7'));var jsforce=require(_0x8eae('0x8'));var deskjs=require('desk.js');var toCsv=require(_0x8eae('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8eae('0xa'));var authService=require('../../components/auth/service');var qs=require(_0x8eae('0xb'));var as=require(_0x8eae('0xc'));var hardwareService=require(_0x8eae('0xd'));var logger=require(_0x8eae('0xe'))(_0x8eae('0xf'));var utils=require(_0x8eae('0x10'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4d961d,_0x1bf216){_0x1bf216=_0x1bf216||0xcc;return function(_0x2891ff){if(_0x2891ff){return _0x4d961d['sendStatus'](_0x1bf216);}return _0x4d961d[_0x8eae('0x11')](_0x1bf216)[_0x8eae('0x12')]();};}function respondWithResult(_0x1b220d,_0x266c5c){_0x266c5c=_0x266c5c||0xc8;return function(_0x154673){if(_0x154673){return _0x1b220d[_0x8eae('0x11')](_0x266c5c)['json'](_0x154673);}};}function respondWithFilteredResult(_0x4de031,_0x3f785c){return function(_0x4aa65c){if(_0x4aa65c){var _0x224538=typeof _0x3f785c[_0x8eae('0x13')]===_0x8eae('0x14')&&typeof _0x3f785c['limit']===_0x8eae('0x14');var _0x4547f7=_0x4aa65c[_0x8eae('0x15')];var _0xaaa325=_0x224538?0x0:_0x3f785c['offset'];var _0x423be5=_0x224538?_0x4aa65c[_0x8eae('0x15')]:_0x3f785c['offset']+_0x3f785c[_0x8eae('0x16')];var _0x28730a;if(_0x423be5>=_0x4547f7){_0x423be5=_0x4547f7;_0x28730a=0xc8;}else{_0x28730a=0xce;}_0x4de031[_0x8eae('0x11')](_0x28730a);return _0x4de031['set'](_0x8eae('0x17'),_0xaaa325+'-'+_0x423be5+'/'+_0x4547f7)['json'](_0x4aa65c);}return null;};}function patchUpdates(_0x300685){return function(_0x5c24df){try{jsonpatch[_0x8eae('0x18')](_0x5c24df,_0x300685,!![]);}catch(_0xa1e8e9){return BPromise['reject'](_0xa1e8e9);}return _0x5c24df[_0x8eae('0x19')]();};}function saveUpdates(_0x4db730,_0x821424){return function(_0x16c510){if(_0x16c510){return _0x16c510[_0x8eae('0x1a')](_0x4db730)[_0x8eae('0x1b')](function(_0x56c924){return _0x56c924;});}return null;};}function removeEntity(_0x29fd1a,_0x3c60a5){return function(_0x211730){if(_0x211730){return _0x211730[_0x8eae('0x1c')]()[_0x8eae('0x1b')](function(){_0x29fd1a['status'](0xcc)[_0x8eae('0x12')]();});}};}function handleEntityNotFound(_0x3cc683,_0x4c75de){return function(_0x52cdc9){if(!_0x52cdc9){_0x3cc683[_0x8eae('0x1d')](0x194);}return _0x52cdc9;};}function handleError(_0x1d51f8,_0x3e07ce){_0x3e07ce=_0x3e07ce||0x1f4;return function(_0x11daeb){logger[_0x8eae('0x1e')](_0x11daeb['stack']);if(_0x11daeb['name']){delete _0x11daeb[_0x8eae('0x1f')];}_0x1d51f8[_0x8eae('0x11')](_0x3e07ce)[_0x8eae('0x20')](_0x11daeb);};}exports[_0x8eae('0x21')]=function(_0x3b2b72,_0x9789c9){var _0x5c1577={},_0x1c2055={},_0x57e6ce={'count':0x0,'rows':[]};var _0x32ad30=_[_0x8eae('0x22')](db[_0x8eae('0x23')][_0x8eae('0x24')],function(_0x29f947){return{'name':_0x29f947[_0x8eae('0x25')],'type':_0x29f947[_0x8eae('0x26')]['key']};});_0x1c2055['model']=_['map'](_0x32ad30,'name');_0x1c2055[_0x8eae('0x27')]=_[_0x8eae('0x28')](_0x3b2b72[_0x8eae('0x27')]);_0x1c2055[_0x8eae('0x29')]=_[_0x8eae('0x2a')](_0x1c2055[_0x8eae('0x2b')],_0x1c2055[_0x8eae('0x27')]);_0x5c1577[_0x8eae('0x2c')]=_[_0x8eae('0x2a')](_0x1c2055[_0x8eae('0x2b')],qs[_0x8eae('0x2d')](_0x3b2b72[_0x8eae('0x27')][_0x8eae('0x2d')]));_0x5c1577[_0x8eae('0x2c')]=_0x5c1577[_0x8eae('0x2c')][_0x8eae('0x2e')]?_0x5c1577['attributes']:_0x1c2055[_0x8eae('0x2b')];if(!_0x3b2b72[_0x8eae('0x27')][_0x8eae('0x2f')](_0x8eae('0x30'))){_0x5c1577['limit']=qs['limit'](_0x3b2b72[_0x8eae('0x27')][_0x8eae('0x16')]);_0x5c1577[_0x8eae('0x13')]=qs[_0x8eae('0x13')](_0x3b2b72[_0x8eae('0x27')][_0x8eae('0x13')]);}_0x5c1577[_0x8eae('0x31')]=qs[_0x8eae('0x32')](_0x3b2b72['query'][_0x8eae('0x32')]);_0x5c1577[_0x8eae('0x33')]=qs[_0x8eae('0x29')](_[_0x8eae('0x34')](_0x3b2b72['query'],_0x1c2055['filters']),_0x32ad30);if(_0x3b2b72[_0x8eae('0x27')][_0x8eae('0x35')]){_0x5c1577[_0x8eae('0x33')]=_[_0x8eae('0x36')](_0x5c1577['where'],{'$or':_[_0x8eae('0x22')](_0x32ad30,function(_0x53b40b){if(_0x53b40b[_0x8eae('0x26')]!==_0x8eae('0x37')){var _0x5b8bec={};_0x5b8bec[_0x53b40b['name']]={'$like':'%'+_0x3b2b72[_0x8eae('0x27')]['filter']+'%'};return _0x5b8bec;}})});}_0x5c1577=_['merge']({},_0x5c1577,_0x3b2b72[_0x8eae('0x38')]);var _0x56015e={'where':_0x5c1577[_0x8eae('0x33')]};return db['FreshsalesField'][_0x8eae('0x15')](_0x56015e)[_0x8eae('0x1b')](function(_0x281607){_0x57e6ce[_0x8eae('0x15')]=_0x281607;if(_0x3b2b72[_0x8eae('0x27')]['includeAll']){_0x5c1577['include']=[{'all':!![]}];}return db[_0x8eae('0x23')]['findAll'](_0x5c1577);})[_0x8eae('0x1b')](function(_0x22e7ed){_0x57e6ce[_0x8eae('0x39')]=_0x22e7ed;return _0x57e6ce;})[_0x8eae('0x1b')](respondWithFilteredResult(_0x9789c9,_0x5c1577))[_0x8eae('0x3a')](handleError(_0x9789c9,null));};exports[_0x8eae('0x3b')]=function(_0x2cb1a9,_0x288136){var _0x8438e0={'raw':!![],'where':{'id':_0x2cb1a9['params']['id']}},_0x5b9473={};_0x5b9473[_0x8eae('0x2b')]=_[_0x8eae('0x28')](db[_0x8eae('0x23')][_0x8eae('0x24')]);_0x5b9473[_0x8eae('0x27')]=_[_0x8eae('0x28')](_0x2cb1a9[_0x8eae('0x27')]);_0x5b9473[_0x8eae('0x29')]=_[_0x8eae('0x2a')](_0x5b9473['model'],_0x5b9473[_0x8eae('0x27')]);_0x8438e0[_0x8eae('0x2c')]=_[_0x8eae('0x2a')](_0x5b9473[_0x8eae('0x2b')],qs[_0x8eae('0x2d')](_0x2cb1a9[_0x8eae('0x27')][_0x8eae('0x2d')]));_0x8438e0[_0x8eae('0x2c')]=_0x8438e0['attributes'][_0x8eae('0x2e')]?_0x8438e0['attributes']:_0x5b9473[_0x8eae('0x2b')];if(_0x2cb1a9[_0x8eae('0x27')][_0x8eae('0x3c')]){_0x8438e0[_0x8eae('0x3d')]=[{'all':!![]}];}_0x8438e0=_[_0x8eae('0x36')]({},_0x8438e0,_0x2cb1a9[_0x8eae('0x38')]);return db[_0x8eae('0x23')]['find'](_0x8438e0)[_0x8eae('0x1b')](handleEntityNotFound(_0x288136,null))[_0x8eae('0x1b')](respondWithResult(_0x288136,null))[_0x8eae('0x3a')](handleError(_0x288136,null));};exports['create']=function(_0x495fc0,_0x4988d9){return db[_0x8eae('0x23')][_0x8eae('0x3e')](_0x495fc0[_0x8eae('0x3f')],{})['then'](respondWithResult(_0x4988d9,0xc9))[_0x8eae('0x3a')](handleError(_0x4988d9,null));};exports[_0x8eae('0x1a')]=function(_0x2023de,_0xbc6a02){if(_0x2023de['body']['id']){delete _0x2023de[_0x8eae('0x3f')]['id'];}return db[_0x8eae('0x23')]['find']({'where':{'id':_0x2023de[_0x8eae('0x40')]['id']}})[_0x8eae('0x1b')](handleEntityNotFound(_0xbc6a02,null))['then'](saveUpdates(_0x2023de[_0x8eae('0x3f')],null))[_0x8eae('0x1b')](respondWithResult(_0xbc6a02,null))['catch'](handleError(_0xbc6a02,null));};exports['destroy']=function(_0x5cdd3e,_0x3ff93c){return db['FreshsalesField'][_0x8eae('0x41')]({'where':{'id':_0x5cdd3e[_0x8eae('0x40')]['id']}})[_0x8eae('0x1b')](handleEntityNotFound(_0x3ff93c,null))[_0x8eae('0x1b')](removeEntity(_0x3ff93c,null))[_0x8eae('0x3a')](handleError(_0x3ff93c,null));}; \ No newline at end of file +var _0xf247=['query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','options','includeAll','include','FreshsalesField','findAll','rows','show','params','rawAttributes','keys','find','catch','create','body','zip-dir','request-promise','moment','bluebird','mustache','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','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','send','index','fieldName','type','model','map','name'];(function(_0x58dc50,_0x2af0b7){var _0x1fda34=function(_0x5cf61b){while(--_0x5cf61b){_0x58dc50['push'](_0x58dc50['shift']());}};_0x1fda34(++_0x2af0b7);}(_0xf247,0x198));var _0x7f24=function(_0x328bd3,_0x9cf5a5){_0x328bd3=_0x328bd3-0x0;var _0x458149=_0xf247[_0x328bd3];return _0x458149;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7f24('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7f24('0x1'));var moment=require(_0x7f24('0x2'));var BPromise=require(_0x7f24('0x3'));var Mustache=require(_0x7f24('0x4'));var util=require('util');var path=require(_0x7f24('0x5'));var sox=require(_0x7f24('0x6'));var csv=require(_0x7f24('0x7'));var ejs=require(_0x7f24('0x8'));var fs=require('fs');var fs_extra=require(_0x7f24('0x9'));var _=require(_0x7f24('0xa'));var squel=require('squel');var crypto=require(_0x7f24('0xb'));var jsforce=require(_0x7f24('0xc'));var deskjs=require(_0x7f24('0xd'));var toCsv=require(_0x7f24('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x7f24('0xe'));var authService=require(_0x7f24('0xf'));var qs=require(_0x7f24('0x10'));var as=require(_0x7f24('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7f24('0x12'))(_0x7f24('0x13'));var utils=require(_0x7f24('0x14'));var config=require(_0x7f24('0x15'));var licenseUtil=require(_0x7f24('0x16'));var db=require(_0x7f24('0x17'))['db'];function respondWithStatusCode(_0x58d91f,_0x33c7f9){_0x33c7f9=_0x33c7f9||0xcc;return function(_0x492e45){if(_0x492e45){return _0x58d91f[_0x7f24('0x18')](_0x33c7f9);}return _0x58d91f[_0x7f24('0x19')](_0x33c7f9)['end']();};}function respondWithResult(_0x137127,_0x4511a0){_0x4511a0=_0x4511a0||0xc8;return function(_0x4f1009){if(_0x4f1009){return _0x137127['status'](_0x4511a0)[_0x7f24('0x1a')](_0x4f1009);}};}function respondWithFilteredResult(_0x28cf22,_0xf91b17){return function(_0x23be6c){if(_0x23be6c){var _0x471d30=typeof _0xf91b17[_0x7f24('0x1b')]==='undefined'&&typeof _0xf91b17['limit']===_0x7f24('0x1c');var _0x3f41a7=_0x23be6c[_0x7f24('0x1d')];var _0x2e426a=_0x471d30?0x0:_0xf91b17[_0x7f24('0x1b')];var _0x235d71=_0x471d30?_0x23be6c[_0x7f24('0x1d')]:_0xf91b17['offset']+_0xf91b17[_0x7f24('0x1e')];var _0x41a3ae;if(_0x235d71>=_0x3f41a7){_0x235d71=_0x3f41a7;_0x41a3ae=0xc8;}else{_0x41a3ae=0xce;}_0x28cf22['status'](_0x41a3ae);return _0x28cf22[_0x7f24('0x1f')](_0x7f24('0x20'),_0x2e426a+'-'+_0x235d71+'/'+_0x3f41a7)[_0x7f24('0x1a')](_0x23be6c);}return null;};}function patchUpdates(_0x3aa275){return function(_0x3fbeef){try{jsonpatch[_0x7f24('0x21')](_0x3fbeef,_0x3aa275,!![]);}catch(_0xc3d85a){return BPromise[_0x7f24('0x22')](_0xc3d85a);}return _0x3fbeef[_0x7f24('0x23')]();};}function saveUpdates(_0x28e4be,_0x1ba1a4){return function(_0x146372){if(_0x146372){return _0x146372[_0x7f24('0x24')](_0x28e4be)[_0x7f24('0x25')](function(_0x45b435){return _0x45b435;});}return null;};}function removeEntity(_0x20c089,_0x1da0a0){return function(_0x2c275e){if(_0x2c275e){return _0x2c275e[_0x7f24('0x26')]()['then'](function(){_0x20c089[_0x7f24('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1dac00,_0x40ca96){return function(_0x50230a){if(!_0x50230a){_0x1dac00[_0x7f24('0x18')](0x194);}return _0x50230a;};}function handleError(_0xa28ef0,_0x1441f9){_0x1441f9=_0x1441f9||0x1f4;return function(_0x11a670){logger[_0x7f24('0x27')](_0x11a670[_0x7f24('0x28')]);if(_0x11a670['name']){delete _0x11a670['name'];}_0xa28ef0[_0x7f24('0x19')](_0x1441f9)[_0x7f24('0x29')](_0x11a670);};}exports[_0x7f24('0x2a')]=function(_0x29f26c,_0x9518e4){var _0x236195={},_0x58fed1={},_0x1f9590={'count':0x0,'rows':[]};var _0x5cfb3e=_['map'](db['FreshsalesField']['rawAttributes'],function(_0x4210ce){return{'name':_0x4210ce[_0x7f24('0x2b')],'type':_0x4210ce[_0x7f24('0x2c')]['key']};});_0x58fed1[_0x7f24('0x2d')]=_[_0x7f24('0x2e')](_0x5cfb3e,_0x7f24('0x2f'));_0x58fed1[_0x7f24('0x30')]=_['keys'](_0x29f26c['query']);_0x58fed1[_0x7f24('0x31')]=_['intersection'](_0x58fed1[_0x7f24('0x2d')],_0x58fed1[_0x7f24('0x30')]);_0x236195[_0x7f24('0x32')]=_[_0x7f24('0x33')](_0x58fed1[_0x7f24('0x2d')],qs[_0x7f24('0x34')](_0x29f26c[_0x7f24('0x30')][_0x7f24('0x34')]));_0x236195[_0x7f24('0x32')]=_0x236195[_0x7f24('0x32')][_0x7f24('0x35')]?_0x236195['attributes']:_0x58fed1['model'];if(!_0x29f26c[_0x7f24('0x30')][_0x7f24('0x36')](_0x7f24('0x37'))){_0x236195[_0x7f24('0x1e')]=qs[_0x7f24('0x1e')](_0x29f26c['query'][_0x7f24('0x1e')]);_0x236195[_0x7f24('0x1b')]=qs['offset'](_0x29f26c['query']['offset']);}_0x236195[_0x7f24('0x38')]=qs['sort'](_0x29f26c[_0x7f24('0x30')]['sort']);_0x236195[_0x7f24('0x39')]=qs[_0x7f24('0x31')](_[_0x7f24('0x3a')](_0x29f26c[_0x7f24('0x30')],_0x58fed1[_0x7f24('0x31')]),_0x5cfb3e);if(_0x29f26c[_0x7f24('0x30')][_0x7f24('0x3b')]){_0x236195[_0x7f24('0x39')]=_[_0x7f24('0x3c')](_0x236195[_0x7f24('0x39')],{'$or':_['map'](_0x5cfb3e,function(_0x51b0f2){if(_0x51b0f2[_0x7f24('0x2c')]!==_0x7f24('0x3d')){var _0x42e1e8={};_0x42e1e8[_0x51b0f2[_0x7f24('0x2f')]]={'$like':'%'+_0x29f26c['query'][_0x7f24('0x3b')]+'%'};return _0x42e1e8;}})});}_0x236195=_[_0x7f24('0x3c')]({},_0x236195,_0x29f26c[_0x7f24('0x3e')]);var _0x48e4cc={'where':_0x236195['where']};return db['FreshsalesField'][_0x7f24('0x1d')](_0x48e4cc)[_0x7f24('0x25')](function(_0x4636a5){_0x1f9590[_0x7f24('0x1d')]=_0x4636a5;if(_0x29f26c[_0x7f24('0x30')][_0x7f24('0x3f')]){_0x236195[_0x7f24('0x40')]=[{'all':!![]}];}return db[_0x7f24('0x41')][_0x7f24('0x42')](_0x236195);})[_0x7f24('0x25')](function(_0xf5d8ca){_0x1f9590[_0x7f24('0x43')]=_0xf5d8ca;return _0x1f9590;})['then'](respondWithFilteredResult(_0x9518e4,_0x236195))['catch'](handleError(_0x9518e4,null));};exports[_0x7f24('0x44')]=function(_0x1e4333,_0x58105d){var _0x5245f2={'raw':!![],'where':{'id':_0x1e4333[_0x7f24('0x45')]['id']}},_0x173509={};_0x173509[_0x7f24('0x2d')]=_['keys'](db[_0x7f24('0x41')][_0x7f24('0x46')]);_0x173509[_0x7f24('0x30')]=_[_0x7f24('0x47')](_0x1e4333[_0x7f24('0x30')]);_0x173509[_0x7f24('0x31')]=_['intersection'](_0x173509[_0x7f24('0x2d')],_0x173509[_0x7f24('0x30')]);_0x5245f2[_0x7f24('0x32')]=_['intersection'](_0x173509[_0x7f24('0x2d')],qs['fields'](_0x1e4333[_0x7f24('0x30')][_0x7f24('0x34')]));_0x5245f2['attributes']=_0x5245f2['attributes'][_0x7f24('0x35')]?_0x5245f2[_0x7f24('0x32')]:_0x173509[_0x7f24('0x2d')];if(_0x1e4333[_0x7f24('0x30')][_0x7f24('0x3f')]){_0x5245f2[_0x7f24('0x40')]=[{'all':!![]}];}_0x5245f2=_[_0x7f24('0x3c')]({},_0x5245f2,_0x1e4333[_0x7f24('0x3e')]);return db[_0x7f24('0x41')][_0x7f24('0x48')](_0x5245f2)[_0x7f24('0x25')](handleEntityNotFound(_0x58105d,null))['then'](respondWithResult(_0x58105d,null))[_0x7f24('0x49')](handleError(_0x58105d,null));};exports[_0x7f24('0x4a')]=function(_0x4b16aa,_0x15bce9){return db[_0x7f24('0x41')][_0x7f24('0x4a')](_0x4b16aa[_0x7f24('0x4b')],{})[_0x7f24('0x25')](respondWithResult(_0x15bce9,0xc9))[_0x7f24('0x49')](handleError(_0x15bce9,null));};exports[_0x7f24('0x24')]=function(_0x4abcf8,_0x1a9dce){if(_0x4abcf8[_0x7f24('0x4b')]['id']){delete _0x4abcf8[_0x7f24('0x4b')]['id'];}return db[_0x7f24('0x41')][_0x7f24('0x48')]({'where':{'id':_0x4abcf8[_0x7f24('0x45')]['id']}})['then'](handleEntityNotFound(_0x1a9dce,null))[_0x7f24('0x25')](saveUpdates(_0x4abcf8[_0x7f24('0x4b')],null))[_0x7f24('0x25')](respondWithResult(_0x1a9dce,null))[_0x7f24('0x49')](handleError(_0x1a9dce,null));};exports[_0x7f24('0x26')]=function(_0x4c85b7,_0x456020){return db[_0x7f24('0x41')]['find']({'where':{'id':_0x4c85b7[_0x7f24('0x45')]['id']}})[_0x7f24('0x25')](handleEntityNotFound(_0x456020,null))[_0x7f24('0x25')](removeEntity(_0x456020,null))[_0x7f24('0x49')](handleError(_0x456020,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index fd7b0c1..aa1f2dd 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 _0x8374=['FreshsalesField','freshsales_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesField.attributes','exports'];(function(_0x2da352,_0x5a2291){var _0x1ab378=function(_0x33dacd){while(--_0x33dacd){_0x2da352['push'](_0x2da352['shift']());}};_0x1ab378(++_0x5a2291);}(_0x8374,0x174));var _0x4837=function(_0x1b024e,_0x1cff73){_0x1b024e=_0x1b024e-0x0;var _0x376252=_0x8374[_0x1b024e];return _0x376252;};'use strict';var _=require(_0x4837('0x0'));var util=require(_0x4837('0x1'));var logger=require(_0x4837('0x2'))(_0x4837('0x3'));var moment=require(_0x4837('0x4'));var BPromise=require(_0x4837('0x5'));var rp=require(_0x4837('0x6'));var fs=require('fs');var path=require(_0x4837('0x7'));var rimraf=require(_0x4837('0x8'));var config=require(_0x4837('0x9'));var attributes=require(_0x4837('0xa'));module[_0x4837('0xb')]=function(_0x2bd5a7,_0x425c07){return _0x2bd5a7['define'](_0x4837('0xc'),attributes,{'tableName':'int_freshsales_fields','paranoid':![],'indexes':[{'name':_0x4837('0xd'),'fields':[_0x4837('0xe'),_0x4837('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa8b1=['request-promise','../../config/environment','./intFreshsalesField.attributes','define','int_freshsales_fields','freshsales_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x2bda7e,_0x2b6d2f){var _0x10a523=function(_0x39feed){while(--_0x39feed){_0x2bda7e['push'](_0x2bda7e['shift']());}};_0x10a523(++_0x2b6d2f);}(_0xa8b1,0x182));var _0x1a8b=function(_0x319ac5,_0xe140cf){_0x319ac5=_0x319ac5-0x0;var _0x4b8b1b=_0xa8b1[_0x319ac5];return _0x4b8b1b;};'use strict';var _=require(_0x1a8b('0x0'));var util=require(_0x1a8b('0x1'));var logger=require(_0x1a8b('0x2'))(_0x1a8b('0x3'));var moment=require(_0x1a8b('0x4'));var BPromise=require(_0x1a8b('0x5'));var rp=require(_0x1a8b('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1a8b('0x7'));var attributes=require(_0x1a8b('0x8'));module['exports']=function(_0x2d90b8,_0x23d6ec){return _0x2d90b8[_0x1a8b('0x9')]('FreshsalesField',attributes,{'tableName':_0x1a8b('0xa'),'paranoid':![],'indexes':[{'name':_0x1a8b('0xb'),'fields':[_0x1a8b('0xc'),_0x1a8b('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 38fab52..b59662e 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 _0x3f8a=['catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x3f2d7a,_0x539136){_0x3f2d7a=_0x3f2d7a-0x0;var _0x5ad277=_0x3f8a[_0x3f2d7a];return _0x5ad277;};'use strict';var _=require(_0xa3f8('0x0'));var util=require(_0xa3f8('0x1'));var moment=require(_0xa3f8('0x2'));var BPromise=require(_0xa3f8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa3f8('0x4'));var db=require(_0xa3f8('0x5'))['db'];var utils=require(_0xa3f8('0x6'));var logger=require(_0xa3f8('0x7'))(_0xa3f8('0x8'));var config=require(_0xa3f8('0x9'));var jayson=require(_0xa3f8('0xa'));var client=jayson[_0xa3f8('0xb')][_0xa3f8('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xf895d9,_0xcfea5,_0x268332){return new BPromise(function(_0x2faf2e,_0x2448de){return client[_0xa3f8('0xd')](_0xf895d9,_0x268332)[_0xa3f8('0xe')](function(_0xcdb0d4){logger['info'](_0xa3f8('0xf'),_0xcfea5,_0xa3f8('0x10'));logger[_0xa3f8('0x11')](_0xa3f8('0x12'),_0xcfea5,'request\x20sent',JSON[_0xa3f8('0x13')](_0xcdb0d4));if(_0xcdb0d4[_0xa3f8('0x14')]){if(_0xcdb0d4[_0xa3f8('0x14')][_0xa3f8('0x15')]===0x1f4){logger[_0xa3f8('0x14')](_0xa3f8('0xf'),_0xcfea5,_0xcdb0d4[_0xa3f8('0x14')][_0xa3f8('0x16')]);return _0x2448de(_0xcdb0d4[_0xa3f8('0x14')][_0xa3f8('0x16')]);}logger[_0xa3f8('0x14')](_0xa3f8('0xf'),_0xcfea5,_0xcdb0d4['error'][_0xa3f8('0x16')]);return _0x2faf2e(_0xcdb0d4[_0xa3f8('0x14')][_0xa3f8('0x16')]);}else{logger[_0xa3f8('0x17')]('FreshsalesField,\x20%s,\x20%s',_0xcfea5,_0xa3f8('0x10'));_0x2faf2e(_0xcdb0d4[_0xa3f8('0x18')][_0xa3f8('0x16')]);}})[_0xa3f8('0x19')](function(_0x45ef64){logger[_0xa3f8('0x14')](_0xa3f8('0xf'),_0xcfea5,_0x45ef64);_0x2448de(_0x45ef64);});});} \ 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(_0x2ee42a,_0x14f94c){var _0x524489=function(_0x416f8d){while(--_0x416f8d){_0x2ee42a['push'](_0x2ee42a['shift']());}};_0x524489(++_0x14f94c);}(_0xafc4,0x69));var _0x4afc=function(_0x476cba,_0x34f187){_0x476cba=_0x476cba-0x0;var _0x176a68=_0xafc4[_0x476cba];return _0x176a68;};'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 5d3f959..df20d05 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(_0x3234cf,_0x134836){var _0x300532=function(_0x5ca0c9){while(--_0x5ca0c9){_0x3234cf['push'](_0x3234cf['shift']());}};_0x300532(++_0x134836);}(_0xa9e0,0x123));var _0x0a9e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa9e0[_0x30ae5e];return _0x1f2e93;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x403e51,_0x2ddaa8){var _0x460c60=function(_0x189d8e){while(--_0x189d8e){_0x403e51['push'](_0x403e51['shift']());}};_0x460c60(++_0x2ddaa8);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index c1721be..9af77ca 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 _0x8383=['newTab','integrationTab','sequelize','STRING','username','ENUM'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x8383,0x98));var _0x3838=function(_0xdb18de,_0x2d88aa){_0xdb18de=_0xdb18de-0x0;var _0x53679a=_0x8383[_0xdb18de];return _0x53679a;};'use strict';var Sequelize=require(_0x3838('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x3838('0x1')]},'username':{'type':Sequelize[_0x3838('0x1')],'unique':_0x3838('0x2')},'remoteUri':{'type':Sequelize[_0x3838('0x1')]},'password':{'type':Sequelize[_0x3838('0x1')]},'clientId':{'type':Sequelize[_0x3838('0x1')]},'clientSecret':{'type':Sequelize[_0x3838('0x1')]},'securityToken':{'type':Sequelize[_0x3838('0x1')]},'serverUrl':{'type':Sequelize[_0x3838('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x3838('0x3')]('integrationTab',_0x3838('0x4')),'defaultValue':_0x3838('0x5')}}; \ No newline at end of file +var _0xaf30=['username','ENUM','integrationTab','newTab','exports','STRING'];(function(_0x4ecc0a,_0x1dc3b9){var _0x5e2deb=function(_0x17ecb4){while(--_0x17ecb4){_0x4ecc0a['push'](_0x4ecc0a['shift']());}};_0x5e2deb(++_0x1dc3b9);}(_0xaf30,0xd0));var _0x0af3=function(_0x2abc3d,_0x48edca){_0x2abc3d=_0x2abc3d-0x0;var _0x252745=_0xaf30[_0x2abc3d];return _0x252745;};'use strict';var Sequelize=require('sequelize');module[_0x0af3('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x0af3('0x1')]},'username':{'type':Sequelize[_0x0af3('0x1')],'unique':_0x0af3('0x2')},'remoteUri':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x0af3('0x1')]},'clientId':{'type':Sequelize[_0x0af3('0x1')]},'clientSecret':{'type':Sequelize[_0x0af3('0x1')]},'securityToken':{'type':Sequelize[_0x0af3('0x1')]},'serverUrl':{'type':Sequelize[_0x0af3('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x0af3('0x3')](_0x0af3('0x4'),_0x0af3('0x5')),'defaultValue':_0x0af3('0x4')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 241c2a1..09c074c 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 _0x04b4=['limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','SalesforceAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','merge','VIRTUAL','where','includeAll','show','length','options','find','catch','create','body','params','getConfigurations','findOne','SalesforceConfiguration','filter','channel','Descriptions','getDescriptions','SalesforceField','Subjects','getFields','Task','remoteUri','clientId','password','securityToken','slice','substring','Connection','clientSecret','concat','isNil','ticketType','describe','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Subject','Description','string','int','picklist','boolean','email','textarea','phone','includes','label','custom','picklistValues','True','true','False','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','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','../../components/integrations/configuration','sendStatus','status','json','offset','undefined'];(function(_0x58b94c,_0x284e1b){var _0x5def79=function(_0x13b006){while(--_0x13b006){_0x58b94c['push'](_0x58b94c['shift']());}};_0x5def79(++_0x284e1b);}(_0x04b4,0xdd));var _0x404b=function(_0x346697,_0x26caf8){_0x346697=_0x346697-0x0;var _0x95c697=_0x04b4[_0x346697];return _0x95c697;};'use strict';var emlformat=require(_0x404b('0x0'));var rimraf=require(_0x404b('0x1'));var zipdir=require(_0x404b('0x2'));var jsonpatch=require(_0x404b('0x3'));var rp=require(_0x404b('0x4'));var moment=require('moment');var BPromise=require(_0x404b('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x404b('0x6'));var sox=require(_0x404b('0x7'));var csv=require(_0x404b('0x8'));var ejs=require(_0x404b('0x9'));var fs=require('fs');var fs_extra=require(_0x404b('0xa'));var _=require(_0x404b('0xb'));var squel=require(_0x404b('0xc'));var crypto=require(_0x404b('0xd'));var jsforce=require(_0x404b('0xe'));var deskjs=require(_0x404b('0xf'));var toCsv=require(_0x404b('0x8'));var querystring=require('querystring');var Papa=require(_0x404b('0x10'));var Redis=require(_0x404b('0x11'));var authService=require(_0x404b('0x12'));var qs=require(_0x404b('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x404b('0x14'));var logger=require(_0x404b('0x15'))(_0x404b('0x16'));var utils=require(_0x404b('0x17'));var config=require(_0x404b('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0x404b('0x19'));function respondWithStatusCode(_0x8f4f5,_0x2853be){_0x2853be=_0x2853be||0xcc;return function(_0x942c4a){if(_0x942c4a){return _0x8f4f5[_0x404b('0x1a')](_0x2853be);}return _0x8f4f5[_0x404b('0x1b')](_0x2853be)['end']();};}function respondWithResult(_0x4a1689,_0x10ad7d){_0x10ad7d=_0x10ad7d||0xc8;return function(_0x3f859b){if(_0x3f859b){return _0x4a1689[_0x404b('0x1b')](_0x10ad7d)[_0x404b('0x1c')](_0x3f859b);}};}function respondWithFilteredResult(_0x189f74,_0x37dc8b){return function(_0x26b848){if(_0x26b848){var _0x18cc9d=typeof _0x37dc8b[_0x404b('0x1d')]===_0x404b('0x1e')&&typeof _0x37dc8b[_0x404b('0x1f')]===_0x404b('0x1e');var _0x175aab=_0x26b848[_0x404b('0x20')];var _0x1e9f69=_0x18cc9d?0x0:_0x37dc8b[_0x404b('0x1d')];var _0x1e5253=_0x18cc9d?_0x26b848[_0x404b('0x20')]:_0x37dc8b[_0x404b('0x1d')]+_0x37dc8b['limit'];var _0x51a154;if(_0x1e5253>=_0x175aab){_0x1e5253=_0x175aab;_0x51a154=0xc8;}else{_0x51a154=0xce;}_0x189f74[_0x404b('0x1b')](_0x51a154);return _0x189f74[_0x404b('0x21')](_0x404b('0x22'),_0x1e9f69+'-'+_0x1e5253+'/'+_0x175aab)['json'](_0x26b848);}return null;};}function patchUpdates(_0x5d2b31){return function(_0x13a1b7){try{jsonpatch[_0x404b('0x23')](_0x13a1b7,_0x5d2b31,!![]);}catch(_0xda07cd){return BPromise[_0x404b('0x24')](_0xda07cd);}return _0x13a1b7[_0x404b('0x25')]();};}function saveUpdates(_0x3d3b54,_0x39e4ab){return function(_0x37d9b1){if(_0x37d9b1){return _0x37d9b1[_0x404b('0x26')](_0x3d3b54)[_0x404b('0x27')](function(_0x35c173){return _0x35c173;});}return null;};}function removeEntity(_0x246399,_0x190616){return function(_0xdf3f47){if(_0xdf3f47){return _0xdf3f47[_0x404b('0x28')]()[_0x404b('0x27')](function(){_0x246399[_0x404b('0x1b')](0xcc)[_0x404b('0x29')]();});}};}function handleEntityNotFound(_0x12cd08,_0xa63746){return function(_0x288cb7){if(!_0x288cb7){_0x12cd08['sendStatus'](0x194);}return _0x288cb7;};}function handleError(_0x5e9603,_0x1d54e1){_0x1d54e1=_0x1d54e1||0x1f4;return function(_0x14e343){logger[_0x404b('0x2a')](_0x14e343[_0x404b('0x2b')]);if(_0x14e343[_0x404b('0x2c')]){delete _0x14e343[_0x404b('0x2c')];}_0x5e9603[_0x404b('0x1b')](_0x1d54e1)[_0x404b('0x2d')](_0x14e343);};}exports[_0x404b('0x2e')]=function(_0x3a306d,_0x4aea91){var _0x2e4920={},_0x3b9ffb={},_0x45ff96={'count':0x0,'rows':[]};var _0x42dda9=_[_0x404b('0x2f')](db[_0x404b('0x30')][_0x404b('0x31')],function(_0x5b07a3){return{'name':_0x5b07a3[_0x404b('0x32')],'type':_0x5b07a3[_0x404b('0x33')][_0x404b('0x34')]};});_0x3b9ffb[_0x404b('0x35')]=_['map'](_0x42dda9,'name');_0x3b9ffb[_0x404b('0x36')]=_[_0x404b('0x37')](_0x3a306d[_0x404b('0x36')]);_0x3b9ffb[_0x404b('0x38')]=_[_0x404b('0x39')](_0x3b9ffb[_0x404b('0x35')],_0x3b9ffb[_0x404b('0x36')]);_0x2e4920[_0x404b('0x3a')]=_[_0x404b('0x39')](_0x3b9ffb[_0x404b('0x35')],qs[_0x404b('0x3b')](_0x3a306d[_0x404b('0x36')][_0x404b('0x3b')]));_0x2e4920[_0x404b('0x3a')]=_0x2e4920[_0x404b('0x3a')]['length']?_0x2e4920['attributes']:_0x3b9ffb[_0x404b('0x35')];if(!_0x3a306d['query'][_0x404b('0x3c')](_0x404b('0x3d'))){_0x2e4920[_0x404b('0x1f')]=qs[_0x404b('0x1f')](_0x3a306d[_0x404b('0x36')][_0x404b('0x1f')]);_0x2e4920[_0x404b('0x1d')]=qs[_0x404b('0x1d')](_0x3a306d[_0x404b('0x36')]['offset']);}_0x2e4920[_0x404b('0x3e')]=qs[_0x404b('0x3f')](_0x3a306d[_0x404b('0x36')][_0x404b('0x3f')]);_0x2e4920['where']=qs[_0x404b('0x38')](_[_0x404b('0x40')](_0x3a306d['query'],_0x3b9ffb[_0x404b('0x38')]),_0x42dda9);if(_0x3a306d['query']['filter']){_0x2e4920['where']=_[_0x404b('0x41')](_0x2e4920['where'],{'$or':_[_0x404b('0x2f')](_0x42dda9,function(_0x549e8c){if(_0x549e8c[_0x404b('0x33')]!==_0x404b('0x42')){var _0x309808={};_0x309808[_0x549e8c[_0x404b('0x2c')]]={'$like':'%'+_0x3a306d[_0x404b('0x36')]['filter']+'%'};return _0x309808;}})});}_0x2e4920=_[_0x404b('0x41')]({},_0x2e4920,_0x3a306d['options']);var _0x4eafe7={'where':_0x2e4920[_0x404b('0x43')]};return db[_0x404b('0x30')][_0x404b('0x20')](_0x4eafe7)[_0x404b('0x27')](function(_0x50d9a5){_0x45ff96[_0x404b('0x20')]=_0x50d9a5;if(_0x3a306d[_0x404b('0x36')][_0x404b('0x44')]){_0x2e4920['include']=[{'all':!![]}];}return db[_0x404b('0x30')]['findAll'](_0x2e4920);})[_0x404b('0x27')](function(_0x201459){_0x45ff96['rows']=_0x201459;return _0x45ff96;})[_0x404b('0x27')](respondWithFilteredResult(_0x4aea91,_0x2e4920))['catch'](handleError(_0x4aea91,null));};exports[_0x404b('0x45')]=function(_0x45ba79,_0xa209b7){var _0x4ab3e4={'raw':![],'where':{'id':_0x45ba79['params']['id']}},_0x4d56a0={};_0x4d56a0[_0x404b('0x35')]=_['keys'](db[_0x404b('0x30')][_0x404b('0x31')]);_0x4d56a0[_0x404b('0x36')]=_['keys'](_0x45ba79['query']);_0x4d56a0[_0x404b('0x38')]=_[_0x404b('0x39')](_0x4d56a0[_0x404b('0x35')],_0x4d56a0[_0x404b('0x36')]);_0x4ab3e4['attributes']=_['intersection'](_0x4d56a0[_0x404b('0x35')],qs[_0x404b('0x3b')](_0x45ba79['query'][_0x404b('0x3b')]));_0x4ab3e4['attributes']=_0x4ab3e4[_0x404b('0x3a')][_0x404b('0x46')]?_0x4ab3e4[_0x404b('0x3a')]:_0x4d56a0['model'];if(_0x45ba79[_0x404b('0x36')][_0x404b('0x44')]){_0x4ab3e4['include']=[{'all':!![]}];}_0x4ab3e4=_['merge']({},_0x4ab3e4,_0x45ba79[_0x404b('0x47')]);return db[_0x404b('0x30')][_0x404b('0x48')](_0x4ab3e4)[_0x404b('0x27')](handleEntityNotFound(_0xa209b7,null))[_0x404b('0x27')](respondWithResult(_0xa209b7,null))[_0x404b('0x49')](handleError(_0xa209b7,null));};exports[_0x404b('0x4a')]=function(_0x126c87,_0x23d27d){return db[_0x404b('0x30')][_0x404b('0x4a')](_0x126c87['body'],{})[_0x404b('0x27')](respondWithResult(_0x23d27d,0xc9))[_0x404b('0x49')](handleError(_0x23d27d,null));};exports[_0x404b('0x26')]=function(_0x2ff6a9,_0x15cda8){if(_0x2ff6a9[_0x404b('0x4b')]['id']){delete _0x2ff6a9['body']['id'];}return db[_0x404b('0x30')][_0x404b('0x48')]({'where':{'id':_0x2ff6a9[_0x404b('0x4c')]['id']}})[_0x404b('0x27')](handleEntityNotFound(_0x15cda8,null))[_0x404b('0x27')](saveUpdates(_0x2ff6a9['body'],null))[_0x404b('0x27')](respondWithResult(_0x15cda8,null))[_0x404b('0x49')](handleError(_0x15cda8,null));};exports[_0x404b('0x28')]=function(_0x338189,_0x39aacf){return db[_0x404b('0x30')][_0x404b('0x48')]({'where':{'id':_0x338189[_0x404b('0x4c')]['id']}})[_0x404b('0x27')](handleEntityNotFound(_0x39aacf,null))['then'](removeEntity(_0x39aacf,null))[_0x404b('0x49')](handleError(_0x39aacf,null));};exports[_0x404b('0x4d')]=function(_0x4f9b34,_0x496977,_0x20d7bc){var _0x3b0e1d={};var _0x400488={};var _0x5664d5;var _0x2fe1b0;return db['SalesforceAccount'][_0x404b('0x4e')]({'where':{'id':_0x4f9b34[_0x404b('0x4c')]['id']}})[_0x404b('0x27')](handleEntityNotFound(_0x496977,null))[_0x404b('0x27')](function(_0x1725dd){if(_0x1725dd){_0x5664d5=_0x1725dd;_0x400488['model']=_['keys'](db[_0x404b('0x4f')][_0x404b('0x31')]);_0x400488['query']=_[_0x404b('0x37')](_0x4f9b34[_0x404b('0x36')]);_0x400488[_0x404b('0x38')]=_[_0x404b('0x39')](_0x400488[_0x404b('0x35')],_0x400488[_0x404b('0x36')]);_0x3b0e1d[_0x404b('0x3a')]=_[_0x404b('0x39')](_0x400488[_0x404b('0x35')],qs['fields'](_0x4f9b34[_0x404b('0x36')][_0x404b('0x3b')]));_0x3b0e1d['attributes']=_0x3b0e1d[_0x404b('0x3a')][_0x404b('0x46')]?_0x3b0e1d['attributes']:_0x400488[_0x404b('0x35')];_0x3b0e1d['order']=qs[_0x404b('0x3f')](_0x4f9b34[_0x404b('0x36')]['sort']);_0x3b0e1d['where']=qs[_0x404b('0x38')](_[_0x404b('0x40')](_0x4f9b34[_0x404b('0x36')],_0x400488[_0x404b('0x38')]));if(_0x4f9b34[_0x404b('0x36')][_0x404b('0x50')]){_0x3b0e1d[_0x404b('0x43')]=_[_0x404b('0x41')](_0x3b0e1d[_0x404b('0x43')],{'$or':_[_0x404b('0x2f')](_0x3b0e1d[_0x404b('0x3a')],function(_0x51eb6b){var _0x2d39d0={};_0x2d39d0[_0x51eb6b]={'$like':'%'+_0x4f9b34[_0x404b('0x36')]['filter']+'%'};return _0x2d39d0;})});}_0x3b0e1d=_['merge']({},_0x3b0e1d,_0x4f9b34['options']);return _0x5664d5[_0x404b('0x4d')](_0x3b0e1d);}})['then'](function(_0xb85f46){if(_0xb85f46){_0x2fe1b0=_0xb85f46[_0x404b('0x46')];if(!_0x4f9b34[_0x404b('0x36')][_0x404b('0x3c')]('nolimit')){_0x3b0e1d[_0x404b('0x1f')]=qs['limit'](_0x4f9b34['query'][_0x404b('0x1f')]);_0x3b0e1d[_0x404b('0x1d')]=qs[_0x404b('0x1d')](_0x4f9b34[_0x404b('0x36')]['offset']);}return _0x5664d5[_0x404b('0x4d')](_0x3b0e1d);}})['then'](function(_0x25e450){if(_0x25e450){return _0x25e450?{'count':_0x2fe1b0,'rows':_0x25e450}:null;}})['then'](respondWithResult(_0x496977,null))['catch'](handleError(_0x496977,null));};exports['addConfiguration']=function(_0x81df19,_0x4bf404,_0x358423){if(_0x81df19[_0x404b('0x4b')]['id']){delete _0x81df19[_0x404b('0x4b')]['id'];}return db['SalesforceAccount'][_0x404b('0x4e')]({'where':{'id':_0x81df19[_0x404b('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4bf404,null))[_0x404b('0x27')](function(_0xeaafd7){if(_0xeaafd7){_0x81df19[_0x404b('0x4b')]['AccountId']=_0xeaafd7['id'];_0x81df19[_0x404b('0x4b')]['Subjects']=integrations['getSubjects'](_0x81df19[_0x404b('0x4b')][_0x404b('0x51')],_0x81df19['body'][_0x404b('0x33')]);_0x81df19[_0x404b('0x4b')][_0x404b('0x52')]=integrations[_0x404b('0x53')](_0x81df19[_0x404b('0x4b')]['channel'],_0x81df19['body'][_0x404b('0x33')]);return db['SalesforceConfiguration'][_0x404b('0x4a')](_0x81df19[_0x404b('0x4b')],{'include':[{'model':db[_0x404b('0x54')],'as':_0x404b('0x55')},{'model':db['SalesforceField'],'as':_0x404b('0x52')}]});}return null;})[_0x404b('0x27')](respondWithResult(_0x4bf404,null))['catch'](handleError(_0x4bf404,null));};exports[_0x404b('0x56')]=function(_0x1e188e,_0x26ced7,_0x274b91){var _0x1f12e9;var _0x349b5f='';var _0x29f9c7=_0x404b('0x57');return db[_0x404b('0x30')]['findOne']({'where':{'id':_0x1e188e[_0x404b('0x4c')]['id']},'attributes':['id',_0x404b('0x58'),_0x404b('0x59'),'clientSecret','username',_0x404b('0x5a'),_0x404b('0x5b')]})[_0x404b('0x27')](handleEntityNotFound(_0x26ced7,null))[_0x404b('0x27')](function(_0x136e4c){if(_0x136e4c){_0x349b5f=_0x136e4c[_0x404b('0x58')];var _0x37d4fd=_0x349b5f[_0x404b('0x5c')](-0x1);if(_0x37d4fd==='/'){_0x349b5f=_0x349b5f[_0x404b('0x5d')](0x0,_0x349b5f['lastIndexOf'](_0x37d4fd));}_0x1f12e9=new jsforce[(_0x404b('0x5e'))]({'oauth2':{'loginUrl':_0x349b5f,'clientId':_0x136e4c[_0x404b('0x59')],'clientSecret':_0x136e4c[_0x404b('0x5f')]}});return _0x1f12e9['login'](_0x136e4c['username'],_0x136e4c[_0x404b('0x5a')][_0x404b('0x60')](_0x136e4c[_0x404b('0x5b')]));}})[_0x404b('0x27')](function(_0x52e86e){if(_0x52e86e){if(!_[_0x404b('0x61')](_0x1e188e[_0x404b('0x36')]['ticketType'])){_0x29f9c7=_0x1e188e[_0x404b('0x36')][_0x404b('0x62')];}return _0x1f12e9['sobject'](_0x29f9c7)[_0x404b('0x63')]();}})[_0x404b('0x27')](function(_0x529970){var _0x3f2fc4=[_0x404b('0x64'),_0x404b('0x65'),_0x404b('0x66'),_0x404b('0x67'),_0x404b('0x68'),_0x404b('0x69')];var _0x5324d3=[_0x404b('0x6a'),_0x404b('0x6b'),_0x404b('0x6c'),_0x404b('0x6d'),_0x404b('0x6e'),_0x404b('0x6f'),_0x404b('0x70')];if(_0x529970){_['remove'](_0x529970[_0x404b('0x3b')],function(_0x3d0ad){return _0x3f2fc4[_0x404b('0x71')](_0x3d0ad['name'])||!_0x5324d3[_0x404b('0x71')](_0x3d0ad[_0x404b('0x33')]);});return{'count':_0x529970['fields'][_0x404b('0x46')],'rows':_[_0x404b('0x2f')](_0x529970[_0x404b('0x3b')],function(_0x5527f5){return{'id':_0x5527f5[_0x404b('0x2c')],'name':_0x5527f5[_0x404b('0x72')],'custom':_0x5527f5[_0x404b('0x73')],'options':_0x5527f5['picklistValues']['length']>0x0?_[_0x404b('0x2f')](_0x5527f5[_0x404b('0x74')],function(_0x2be626){return{'name':_0x2be626['label'],'value':_0x2be626['value']};}):_0x5527f5[_0x404b('0x33')]==_0x404b('0x6d')?[{'name':_0x404b('0x75'),'value':_0x404b('0x76')},{'name':_0x404b('0x77'),'value':_0x404b('0x78')}]:[]};})};}})[_0x404b('0x27')](respondWithResult(_0x26ced7,null))['catch'](function(_0x7d2372){var _0x517674=_0x1e188e[_0x404b('0x36')][_0x404b('0x79')]?0x1f4:_0x7d2372[_0x404b('0x7a')]||0x1f4;logger[_0x404b('0x2a')](_0x404b('0x7b'),_0x404b('0x56'),_0x517674,JSON[_0x404b('0x7c')](_0x7d2372));delete _0x7d2372[_0x404b('0x2c')];if(_0x517674===0x191){_0x517674=0x190;}_0x26ced7['status'](_0x517674)[_0x404b('0x2d')](_0x1e188e[_0x404b('0x36')][_0x404b('0x79')]?{'message':_0x404b('0x7d'),'statusCode':_0x7d2372['statusCode']}:_0x7d2372);});}; \ No newline at end of file +var _0x9ecc=['create','body','getConfigurations','findOne','SalesforceConfiguration','map','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','SalesforceField','getFields','Task','remoteUri','clientId','clientSecret','username','securityToken','slice','substring','lastIndexOf','login','ticketType','sobject','describe','OwnerId','IsRecurrence','Subject','Description','string','int','boolean','email','textarea','phone','includes','label','custom','picklistValues','True','true','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','json','limit','undefined','offset','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','rawAttributes','type','key','model','query','filters','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','SalesforceAccount','includeAll','include','findAll','rows','catch','show','params','keys','intersection','find'];(function(_0xc0a3d3,_0x2c8d00){var _0x3386e8=function(_0x3f9df4){while(--_0x3f9df4){_0xc0a3d3['push'](_0xc0a3d3['shift']());}};_0x3386e8(++_0x2c8d00);}(_0x9ecc,0x19e));var _0xc9ec=function(_0x46075c,_0x1befde){_0x46075c=_0x46075c-0x0;var _0x46147d=_0x9ecc[_0x46075c];return _0x46147d;};'use strict';var emlformat=require(_0xc9ec('0x0'));var rimraf=require(_0xc9ec('0x1'));var zipdir=require(_0xc9ec('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc9ec('0x3'));var moment=require('moment');var BPromise=require(_0xc9ec('0x4'));var Mustache=require('mustache');var util=require(_0xc9ec('0x5'));var path=require(_0xc9ec('0x6'));var sox=require(_0xc9ec('0x7'));var csv=require(_0xc9ec('0x8'));var ejs=require(_0xc9ec('0x9'));var fs=require('fs');var fs_extra=require(_0xc9ec('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xc9ec('0xb'));var deskjs=require(_0xc9ec('0xc'));var toCsv=require(_0xc9ec('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xc9ec('0xd'));var authService=require(_0xc9ec('0xe'));var qs=require(_0xc9ec('0xf'));var as=require(_0xc9ec('0x10'));var hardwareService=require(_0xc9ec('0x11'));var logger=require(_0xc9ec('0x12'))(_0xc9ec('0x13'));var utils=require(_0xc9ec('0x14'));var config=require(_0xc9ec('0x15'));var licenseUtil=require(_0xc9ec('0x16'));var db=require('../../mysqldb')['db'];var integrations=require(_0xc9ec('0x17'));function respondWithStatusCode(_0x39cdaf,_0x21afe3){_0x21afe3=_0x21afe3||0xcc;return function(_0x4f4834){if(_0x4f4834){return _0x39cdaf[_0xc9ec('0x18')](_0x21afe3);}return _0x39cdaf[_0xc9ec('0x19')](_0x21afe3)[_0xc9ec('0x1a')]();};}function respondWithResult(_0x30480d,_0x1cba65){_0x1cba65=_0x1cba65||0xc8;return function(_0x45c6d5){if(_0x45c6d5){return _0x30480d[_0xc9ec('0x19')](_0x1cba65)[_0xc9ec('0x1b')](_0x45c6d5);}};}function respondWithFilteredResult(_0x27da89,_0x344ea8){return function(_0x563c7d){if(_0x563c7d){var _0x21a1eb=typeof _0x344ea8['offset']==='undefined'&&typeof _0x344ea8[_0xc9ec('0x1c')]===_0xc9ec('0x1d');var _0x58783f=_0x563c7d['count'];var _0x4ea3b8=_0x21a1eb?0x0:_0x344ea8[_0xc9ec('0x1e')];var _0x52de85=_0x21a1eb?_0x563c7d['count']:_0x344ea8[_0xc9ec('0x1e')]+_0x344ea8[_0xc9ec('0x1c')];var _0x522c1d;if(_0x52de85>=_0x58783f){_0x52de85=_0x58783f;_0x522c1d=0xc8;}else{_0x522c1d=0xce;}_0x27da89[_0xc9ec('0x19')](_0x522c1d);return _0x27da89[_0xc9ec('0x1f')](_0xc9ec('0x20'),_0x4ea3b8+'-'+_0x52de85+'/'+_0x58783f)[_0xc9ec('0x1b')](_0x563c7d);}return null;};}function patchUpdates(_0x4c90f1){return function(_0x15b525){try{jsonpatch[_0xc9ec('0x21')](_0x15b525,_0x4c90f1,!![]);}catch(_0x56a055){return BPromise[_0xc9ec('0x22')](_0x56a055);}return _0x15b525[_0xc9ec('0x23')]();};}function saveUpdates(_0x8eb8d3,_0x54b277){return function(_0x3ba11c){if(_0x3ba11c){return _0x3ba11c[_0xc9ec('0x24')](_0x8eb8d3)['then'](function(_0x29bc71){return _0x29bc71;});}return null;};}function removeEntity(_0x1fcaa7,_0x507052){return function(_0x527320){if(_0x527320){return _0x527320[_0xc9ec('0x25')]()[_0xc9ec('0x26')](function(){_0x1fcaa7[_0xc9ec('0x19')](0xcc)[_0xc9ec('0x1a')]();});}};}function handleEntityNotFound(_0x3daf7b,_0x29ea40){return function(_0xf6bb6f){if(!_0xf6bb6f){_0x3daf7b[_0xc9ec('0x18')](0x194);}return _0xf6bb6f;};}function handleError(_0x4de57d,_0x5bc1a3){_0x5bc1a3=_0x5bc1a3||0x1f4;return function(_0x1ba8c4){logger[_0xc9ec('0x27')](_0x1ba8c4[_0xc9ec('0x28')]);if(_0x1ba8c4[_0xc9ec('0x29')]){delete _0x1ba8c4[_0xc9ec('0x29')];}_0x4de57d[_0xc9ec('0x19')](_0x5bc1a3)[_0xc9ec('0x2a')](_0x1ba8c4);};}exports[_0xc9ec('0x2b')]=function(_0x407aee,_0x3c247a){var _0x21246d={},_0x40924c={},_0x1a376d={'count':0x0,'rows':[]};var _0x502da9=_['map'](db['SalesforceAccount'][_0xc9ec('0x2c')],function(_0x1f51c9){return{'name':_0x1f51c9['fieldName'],'type':_0x1f51c9[_0xc9ec('0x2d')][_0xc9ec('0x2e')]};});_0x40924c[_0xc9ec('0x2f')]=_['map'](_0x502da9,_0xc9ec('0x29'));_0x40924c[_0xc9ec('0x30')]=_['keys'](_0x407aee[_0xc9ec('0x30')]);_0x40924c[_0xc9ec('0x31')]=_['intersection'](_0x40924c[_0xc9ec('0x2f')],_0x40924c[_0xc9ec('0x30')]);_0x21246d['attributes']=_['intersection'](_0x40924c['model'],qs['fields'](_0x407aee[_0xc9ec('0x30')][_0xc9ec('0x32')]));_0x21246d[_0xc9ec('0x33')]=_0x21246d['attributes'][_0xc9ec('0x34')]?_0x21246d['attributes']:_0x40924c[_0xc9ec('0x2f')];if(!_0x407aee[_0xc9ec('0x30')][_0xc9ec('0x35')](_0xc9ec('0x36'))){_0x21246d['limit']=qs[_0xc9ec('0x1c')](_0x407aee[_0xc9ec('0x30')][_0xc9ec('0x1c')]);_0x21246d['offset']=qs[_0xc9ec('0x1e')](_0x407aee['query'][_0xc9ec('0x1e')]);}_0x21246d[_0xc9ec('0x37')]=qs[_0xc9ec('0x38')](_0x407aee[_0xc9ec('0x30')][_0xc9ec('0x38')]);_0x21246d[_0xc9ec('0x39')]=qs['filters'](_[_0xc9ec('0x3a')](_0x407aee[_0xc9ec('0x30')],_0x40924c[_0xc9ec('0x31')]),_0x502da9);if(_0x407aee['query'][_0xc9ec('0x3b')]){_0x21246d[_0xc9ec('0x39')]=_[_0xc9ec('0x3c')](_0x21246d[_0xc9ec('0x39')],{'$or':_['map'](_0x502da9,function(_0x76e72b){if(_0x76e72b[_0xc9ec('0x2d')]!==_0xc9ec('0x3d')){var _0xd4859a={};_0xd4859a[_0x76e72b[_0xc9ec('0x29')]]={'$like':'%'+_0x407aee[_0xc9ec('0x30')][_0xc9ec('0x3b')]+'%'};return _0xd4859a;}})});}_0x21246d=_['merge']({},_0x21246d,_0x407aee[_0xc9ec('0x3e')]);var _0x4c3205={'where':_0x21246d[_0xc9ec('0x39')]};return db[_0xc9ec('0x3f')]['count'](_0x4c3205)[_0xc9ec('0x26')](function(_0x56be0f){_0x1a376d['count']=_0x56be0f;if(_0x407aee[_0xc9ec('0x30')][_0xc9ec('0x40')]){_0x21246d[_0xc9ec('0x41')]=[{'all':!![]}];}return db[_0xc9ec('0x3f')][_0xc9ec('0x42')](_0x21246d);})[_0xc9ec('0x26')](function(_0x3f5264){_0x1a376d[_0xc9ec('0x43')]=_0x3f5264;return _0x1a376d;})['then'](respondWithFilteredResult(_0x3c247a,_0x21246d))[_0xc9ec('0x44')](handleError(_0x3c247a,null));};exports[_0xc9ec('0x45')]=function(_0x485716,_0x1942d2){var _0x5e6d64={'raw':![],'where':{'id':_0x485716[_0xc9ec('0x46')]['id']}},_0x3350b5={};_0x3350b5[_0xc9ec('0x2f')]=_[_0xc9ec('0x47')](db[_0xc9ec('0x3f')][_0xc9ec('0x2c')]);_0x3350b5[_0xc9ec('0x30')]=_['keys'](_0x485716[_0xc9ec('0x30')]);_0x3350b5[_0xc9ec('0x31')]=_[_0xc9ec('0x48')](_0x3350b5[_0xc9ec('0x2f')],_0x3350b5[_0xc9ec('0x30')]);_0x5e6d64[_0xc9ec('0x33')]=_[_0xc9ec('0x48')](_0x3350b5['model'],qs[_0xc9ec('0x32')](_0x485716[_0xc9ec('0x30')]['fields']));_0x5e6d64[_0xc9ec('0x33')]=_0x5e6d64['attributes']['length']?_0x5e6d64[_0xc9ec('0x33')]:_0x3350b5['model'];if(_0x485716[_0xc9ec('0x30')][_0xc9ec('0x40')]){_0x5e6d64[_0xc9ec('0x41')]=[{'all':!![]}];}_0x5e6d64=_[_0xc9ec('0x3c')]({},_0x5e6d64,_0x485716[_0xc9ec('0x3e')]);return db['SalesforceAccount'][_0xc9ec('0x49')](_0x5e6d64)[_0xc9ec('0x26')](handleEntityNotFound(_0x1942d2,null))['then'](respondWithResult(_0x1942d2,null))[_0xc9ec('0x44')](handleError(_0x1942d2,null));};exports[_0xc9ec('0x4a')]=function(_0x55ec63,_0x363a8f){return db[_0xc9ec('0x3f')][_0xc9ec('0x4a')](_0x55ec63[_0xc9ec('0x4b')],{})[_0xc9ec('0x26')](respondWithResult(_0x363a8f,0xc9))[_0xc9ec('0x44')](handleError(_0x363a8f,null));};exports['update']=function(_0x2aa8cb,_0x22090b){if(_0x2aa8cb['body']['id']){delete _0x2aa8cb[_0xc9ec('0x4b')]['id'];}return db[_0xc9ec('0x3f')]['find']({'where':{'id':_0x2aa8cb[_0xc9ec('0x46')]['id']}})[_0xc9ec('0x26')](handleEntityNotFound(_0x22090b,null))[_0xc9ec('0x26')](saveUpdates(_0x2aa8cb[_0xc9ec('0x4b')],null))[_0xc9ec('0x26')](respondWithResult(_0x22090b,null))['catch'](handleError(_0x22090b,null));};exports[_0xc9ec('0x25')]=function(_0x3e4dac,_0x43229b){return db[_0xc9ec('0x3f')][_0xc9ec('0x49')]({'where':{'id':_0x3e4dac[_0xc9ec('0x46')]['id']}})[_0xc9ec('0x26')](handleEntityNotFound(_0x43229b,null))['then'](removeEntity(_0x43229b,null))[_0xc9ec('0x44')](handleError(_0x43229b,null));};exports[_0xc9ec('0x4c')]=function(_0x237cfc,_0x255731,_0x2e3d8d){var _0x429bb4={};var _0x522d72={};var _0x1414c1;var _0x57ffcb;return db[_0xc9ec('0x3f')][_0xc9ec('0x4d')]({'where':{'id':_0x237cfc['params']['id']}})[_0xc9ec('0x26')](handleEntityNotFound(_0x255731,null))['then'](function(_0x3e784f){if(_0x3e784f){_0x1414c1=_0x3e784f;_0x522d72['model']=_[_0xc9ec('0x47')](db[_0xc9ec('0x4e')][_0xc9ec('0x2c')]);_0x522d72[_0xc9ec('0x30')]=_[_0xc9ec('0x47')](_0x237cfc[_0xc9ec('0x30')]);_0x522d72[_0xc9ec('0x31')]=_[_0xc9ec('0x48')](_0x522d72['model'],_0x522d72[_0xc9ec('0x30')]);_0x429bb4[_0xc9ec('0x33')]=_['intersection'](_0x522d72[_0xc9ec('0x2f')],qs[_0xc9ec('0x32')](_0x237cfc[_0xc9ec('0x30')][_0xc9ec('0x32')]));_0x429bb4[_0xc9ec('0x33')]=_0x429bb4[_0xc9ec('0x33')][_0xc9ec('0x34')]?_0x429bb4['attributes']:_0x522d72[_0xc9ec('0x2f')];_0x429bb4[_0xc9ec('0x37')]=qs[_0xc9ec('0x38')](_0x237cfc[_0xc9ec('0x30')][_0xc9ec('0x38')]);_0x429bb4['where']=qs[_0xc9ec('0x31')](_['pick'](_0x237cfc['query'],_0x522d72[_0xc9ec('0x31')]));if(_0x237cfc[_0xc9ec('0x30')][_0xc9ec('0x3b')]){_0x429bb4[_0xc9ec('0x39')]=_[_0xc9ec('0x3c')](_0x429bb4[_0xc9ec('0x39')],{'$or':_[_0xc9ec('0x4f')](_0x429bb4[_0xc9ec('0x33')],function(_0x56d5fe){var _0x57c212={};_0x57c212[_0x56d5fe]={'$like':'%'+_0x237cfc[_0xc9ec('0x30')][_0xc9ec('0x3b')]+'%'};return _0x57c212;})});}_0x429bb4=_[_0xc9ec('0x3c')]({},_0x429bb4,_0x237cfc[_0xc9ec('0x3e')]);return _0x1414c1[_0xc9ec('0x4c')](_0x429bb4);}})[_0xc9ec('0x26')](function(_0x4b3ad2){if(_0x4b3ad2){_0x57ffcb=_0x4b3ad2[_0xc9ec('0x34')];if(!_0x237cfc['query']['hasOwnProperty']('nolimit')){_0x429bb4[_0xc9ec('0x1c')]=qs[_0xc9ec('0x1c')](_0x237cfc['query'][_0xc9ec('0x1c')]);_0x429bb4['offset']=qs['offset'](_0x237cfc['query'][_0xc9ec('0x1e')]);}return _0x1414c1[_0xc9ec('0x4c')](_0x429bb4);}})[_0xc9ec('0x26')](function(_0xb9f1d2){if(_0xb9f1d2){return _0xb9f1d2?{'count':_0x57ffcb,'rows':_0xb9f1d2}:null;}})[_0xc9ec('0x26')](respondWithResult(_0x255731,null))[_0xc9ec('0x44')](handleError(_0x255731,null));};exports[_0xc9ec('0x50')]=function(_0x1afc34,_0x4c3c93,_0xbbfd60){if(_0x1afc34[_0xc9ec('0x4b')]['id']){delete _0x1afc34[_0xc9ec('0x4b')]['id'];}return db[_0xc9ec('0x3f')]['findOne']({'where':{'id':_0x1afc34[_0xc9ec('0x46')]['id']}})['then'](handleEntityNotFound(_0x4c3c93,null))[_0xc9ec('0x26')](function(_0x5519cb){if(_0x5519cb){_0x1afc34[_0xc9ec('0x4b')][_0xc9ec('0x51')]=_0x5519cb['id'];_0x1afc34[_0xc9ec('0x4b')][_0xc9ec('0x52')]=integrations[_0xc9ec('0x53')](_0x1afc34[_0xc9ec('0x4b')][_0xc9ec('0x54')],_0x1afc34[_0xc9ec('0x4b')][_0xc9ec('0x2d')]);_0x1afc34['body'][_0xc9ec('0x55')]=integrations['getDescriptions'](_0x1afc34[_0xc9ec('0x4b')][_0xc9ec('0x54')],_0x1afc34[_0xc9ec('0x4b')]['type']);return db[_0xc9ec('0x4e')]['create'](_0x1afc34[_0xc9ec('0x4b')],{'include':[{'model':db[_0xc9ec('0x56')],'as':_0xc9ec('0x52')},{'model':db['SalesforceField'],'as':_0xc9ec('0x55')}]});}return null;})['then'](respondWithResult(_0x4c3c93,null))[_0xc9ec('0x44')](handleError(_0x4c3c93,null));};exports[_0xc9ec('0x57')]=function(_0x1bb295,_0x47439e,_0x32705c){var _0x164cd8;var _0x5de914='';var _0x426c4c=_0xc9ec('0x58');return db[_0xc9ec('0x3f')][_0xc9ec('0x4d')]({'where':{'id':_0x1bb295[_0xc9ec('0x46')]['id']},'attributes':['id',_0xc9ec('0x59'),_0xc9ec('0x5a'),_0xc9ec('0x5b'),_0xc9ec('0x5c'),'password',_0xc9ec('0x5d')]})[_0xc9ec('0x26')](handleEntityNotFound(_0x47439e,null))['then'](function(_0x692c04){if(_0x692c04){_0x5de914=_0x692c04[_0xc9ec('0x59')];var _0x58665c=_0x5de914[_0xc9ec('0x5e')](-0x1);if(_0x58665c==='/'){_0x5de914=_0x5de914[_0xc9ec('0x5f')](0x0,_0x5de914[_0xc9ec('0x60')](_0x58665c));}_0x164cd8=new jsforce['Connection']({'oauth2':{'loginUrl':_0x5de914,'clientId':_0x692c04[_0xc9ec('0x5a')],'clientSecret':_0x692c04[_0xc9ec('0x5b')]}});return _0x164cd8[_0xc9ec('0x61')](_0x692c04[_0xc9ec('0x5c')],_0x692c04['password']['concat'](_0x692c04[_0xc9ec('0x5d')]));}})[_0xc9ec('0x26')](function(_0x5ad056){if(_0x5ad056){if(!_['isNil'](_0x1bb295[_0xc9ec('0x30')][_0xc9ec('0x62')])){_0x426c4c=_0x1bb295[_0xc9ec('0x30')][_0xc9ec('0x62')];}return _0x164cd8[_0xc9ec('0x63')](_0x426c4c)[_0xc9ec('0x64')]();}})['then'](function(_0x4972ae){var _0x4319a1=[_0xc9ec('0x65'),'ActivityDate','IsReminderSet',_0xc9ec('0x66'),_0xc9ec('0x67'),_0xc9ec('0x68')];var _0x3a135d=[_0xc9ec('0x69'),_0xc9ec('0x6a'),'picklist',_0xc9ec('0x6b'),_0xc9ec('0x6c'),_0xc9ec('0x6d'),_0xc9ec('0x6e')];if(_0x4972ae){_['remove'](_0x4972ae['fields'],function(_0x3c3fb3){return _0x4319a1['includes'](_0x3c3fb3[_0xc9ec('0x29')])||!_0x3a135d[_0xc9ec('0x6f')](_0x3c3fb3[_0xc9ec('0x2d')]);});return{'count':_0x4972ae[_0xc9ec('0x32')]['length'],'rows':_[_0xc9ec('0x4f')](_0x4972ae[_0xc9ec('0x32')],function(_0x12a103){return{'id':_0x12a103[_0xc9ec('0x29')],'name':_0x12a103[_0xc9ec('0x70')],'custom':_0x12a103[_0xc9ec('0x71')],'options':_0x12a103[_0xc9ec('0x72')][_0xc9ec('0x34')]>0x0?_['map'](_0x12a103['picklistValues'],function(_0x5a558a){return{'name':_0x5a558a[_0xc9ec('0x70')],'value':_0x5a558a['value']};}):_0x12a103[_0xc9ec('0x2d')]=='boolean'?[{'name':_0xc9ec('0x73'),'value':_0xc9ec('0x74')},{'name':'False','value':_0xc9ec('0x75')}]:[]};})};}})[_0xc9ec('0x26')](respondWithResult(_0x47439e,null))[_0xc9ec('0x44')](function(_0x22c6ac){var _0x3f7b6c=_0x1bb295[_0xc9ec('0x30')][_0xc9ec('0x76')]?0x1f4:_0x22c6ac[_0xc9ec('0x77')]||0x1f4;logger[_0xc9ec('0x27')](_0xc9ec('0x78'),'getFields',_0x3f7b6c,JSON['stringify'](_0x22c6ac));delete _0x22c6ac[_0xc9ec('0x29')];if(_0x3f7b6c===0x191){_0x3f7b6c=0x190;}_0x47439e[_0xc9ec('0x19')](_0x3f7b6c)[_0xc9ec('0x2a')](_0x1bb295[_0xc9ec('0x30')][_0xc9ec('0x76')]?{'message':_0xc9ec('0x79'),'statusCode':_0x22c6ac[_0xc9ec('0x77')]}:_0x22c6ac);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index ea3bc33..3502f60 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 _0x7ff1=['../../config/environment','exports','define','SalesforceAccount','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x3d8e8b,_0x15e452){var _0x3112fb=function(_0x2eb194){while(--_0x2eb194){_0x3d8e8b['push'](_0x3d8e8b['shift']());}};_0x3112fb(++_0x15e452);}(_0x7ff1,0x93));var _0x17ff=function(_0x285824,_0x3da647){_0x285824=_0x285824-0x0;var _0x311d7e=_0x7ff1[_0x285824];return _0x311d7e;};'use strict';var _=require('lodash');var util=require(_0x17ff('0x0'));var logger=require(_0x17ff('0x1'))(_0x17ff('0x2'));var moment=require(_0x17ff('0x3'));var BPromise=require(_0x17ff('0x4'));var rp=require(_0x17ff('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x17ff('0x6'));var config=require(_0x17ff('0x7'));var attributes=require('./intSalesforceAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x17ff('0x8')]=function(_0x176948,_0x1a4e40){return _0x176948[_0x17ff('0x9')](_0x17ff('0xa'),attributes,{'tableName':'int_salesforce_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcbfa=['SalesforceAccount','int_salesforce_accounts','lodash','util','../../config/logger','moment','bluebird','path','rimraf','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','define'];(function(_0x538c70,_0x35531f){var _0x42ae01=function(_0x5c7368){while(--_0x5c7368){_0x538c70['push'](_0x538c70['shift']());}};_0x42ae01(++_0x35531f);}(_0xcbfa,0x1f0));var _0xacbf=function(_0x35a140,_0x3aeac6){_0x35a140=_0x35a140-0x0;var _0x30ab82=_0xcbfa[_0x35a140];return _0x30ab82;};'use strict';var _=require(_0xacbf('0x0'));var util=require(_0xacbf('0x1'));var logger=require(_0xacbf('0x2'))('api');var moment=require(_0xacbf('0x3'));var BPromise=require(_0xacbf('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xacbf('0x5'));var rimraf=require(_0xacbf('0x6'));var config=require('../../config/environment');var attributes=require(_0xacbf('0x7'));var integrations=require(_0xacbf('0x8'));module[_0xacbf('0x9')]=function(_0x1a4733,_0x64a24b){return _0x1a4733[_0xacbf('0xa')](_0xacbf('0xb'),attributes,{'tableName':_0xacbf('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js b/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js index 518e1e8..02db1ef 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 _0x9613=['message','result','catch','GetSalesforceAccount','SalesforceAccount','findAll','options','raw','limit','include','map','attributes','model','where','ShowSalesforceAccount','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','then','info','request\x20sent','debug','stringify','error','code','SalesforceAccount,\x20%s,\x20%s'];(function(_0x23ca57,_0x23b25c){var _0x2904b5=function(_0x3c1581){while(--_0x3c1581){_0x23ca57['push'](_0x23ca57['shift']());}};_0x2904b5(++_0x23b25c);}(_0x9613,0x1c9));var _0x3961=function(_0x1712f4,_0x5c7e68){_0x1712f4=_0x1712f4-0x0;var _0x2cac70=_0x9613[_0x1712f4];return _0x2cac70;};'use strict';var _=require(_0x3961('0x0'));var util=require(_0x3961('0x1'));var moment=require(_0x3961('0x2'));var BPromise=require(_0x3961('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3961('0x4'));var db=require(_0x3961('0x5'))['db'];var utils=require(_0x3961('0x6'));var logger=require(_0x3961('0x7'))('rpc');var config=require(_0x3961('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x3961('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2961c5,_0x263945,_0x519227){return new BPromise(function(_0x3a0772,_0x492ee8){return client[_0x3961('0xa')](_0x2961c5,_0x519227)[_0x3961('0xb')](function(_0x14eba6){logger[_0x3961('0xc')]('SalesforceAccount,\x20%s,\x20%s',_0x263945,_0x3961('0xd'));logger[_0x3961('0xe')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x263945,_0x3961('0xd'),JSON[_0x3961('0xf')](_0x14eba6));if(_0x14eba6[_0x3961('0x10')]){if(_0x14eba6[_0x3961('0x10')][_0x3961('0x11')]===0x1f4){logger[_0x3961('0x10')](_0x3961('0x12'),_0x263945,_0x14eba6[_0x3961('0x10')]['message']);return _0x492ee8(_0x14eba6[_0x3961('0x10')]['message']);}logger['error'](_0x3961('0x12'),_0x263945,_0x14eba6['error'][_0x3961('0x13')]);return _0x3a0772(_0x14eba6[_0x3961('0x10')][_0x3961('0x13')]);}else{logger[_0x3961('0xc')](_0x3961('0x12'),_0x263945,_0x3961('0xd'));_0x3a0772(_0x14eba6[_0x3961('0x14')][_0x3961('0x13')]);}})[_0x3961('0x15')](function(_0x2c83e6){logger[_0x3961('0x10')](_0x3961('0x12'),_0x263945,_0x2c83e6);_0x492ee8(_0x2c83e6);});});}exports[_0x3961('0x16')]=function(_0x4fce93){var _0x9f301d=this;return new Promise(function(_0x2001eb,_0x59f928){return db[_0x3961('0x17')][_0x3961('0x18')]({'raw':_0x4fce93[_0x3961('0x19')]?_0x4fce93[_0x3961('0x19')][_0x3961('0x1a')]===undefined?!![]:![]:!![],'where':_0x4fce93[_0x3961('0x19')]?_0x4fce93[_0x3961('0x19')]['where']||null:null,'attributes':_0x4fce93['options']?_0x4fce93['options']['attributes']||null:null,'limit':_0x4fce93[_0x3961('0x19')]?_0x4fce93[_0x3961('0x19')][_0x3961('0x1b')]||null:null,'include':_0x4fce93[_0x3961('0x19')]?_0x4fce93[_0x3961('0x19')][_0x3961('0x1c')]?_[_0x3961('0x1d')](_0x4fce93[_0x3961('0x19')][_0x3961('0x1c')],function(_0x255608){return{'model':db[_0x255608['model']],'as':_0x255608['as'],'attributes':_0x255608[_0x3961('0x1e')],'include':_0x255608[_0x3961('0x1c')]?_[_0x3961('0x1d')](_0x255608[_0x3961('0x1c')],function(_0x5c06f3){return{'model':db[_0x5c06f3[_0x3961('0x1f')]],'as':_0x5c06f3['as'],'attributes':_0x5c06f3[_0x3961('0x1e')],'include':_0x5c06f3[_0x3961('0x1c')]?_[_0x3961('0x1d')](_0x5c06f3[_0x3961('0x1c')],function(_0x3aaf90){return{'model':db[_0x3aaf90['model']],'as':_0x3aaf90['as'],'attributes':_0x3aaf90[_0x3961('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x3961('0xb')](function(_0x4a806b){logger[_0x3961('0xc')]('GetSalesforceAccount',_0x4fce93);logger[_0x3961('0xe')]('GetSalesforceAccount',_0x4fce93,JSON['stringify'](_0x4a806b));_0x2001eb(_0x4a806b);})[_0x3961('0x15')](function(_0x43767d){logger[_0x3961('0x10')]('GetSalesforceAccount',_0x43767d['message'],_0x4fce93);_0x59f928(_0x9f301d[_0x3961('0x10')](0x1f4,_0x43767d[_0x3961('0x13')]));});});};exports['ShowSalesforceAccount']=function(_0x191b7d){var _0x5b7baf=this;return new Promise(function(_0x3104ff,_0x378d7f){return db[_0x3961('0x17')]['find']({'raw':_0x191b7d[_0x3961('0x19')]?_0x191b7d['options']['raw']===undefined?!![]:![]:!![],'where':_0x191b7d['options']?_0x191b7d[_0x3961('0x19')][_0x3961('0x20')]||null:null,'attributes':_0x191b7d[_0x3961('0x19')]?_0x191b7d[_0x3961('0x19')][_0x3961('0x1e')]||null:null,'include':_0x191b7d[_0x3961('0x19')]?_0x191b7d[_0x3961('0x19')][_0x3961('0x1c')]?_['map'](_0x191b7d[_0x3961('0x19')][_0x3961('0x1c')],function(_0x4a0146){return{'model':db[_0x4a0146[_0x3961('0x1f')]],'as':_0x4a0146['as'],'attributes':_0x4a0146[_0x3961('0x1e')],'include':_0x4a0146[_0x3961('0x1c')]?_[_0x3961('0x1d')](_0x4a0146[_0x3961('0x1c')],function(_0x439329){return{'model':db[_0x439329[_0x3961('0x1f')]],'as':_0x439329['as'],'attributes':_0x439329[_0x3961('0x1e')],'include':_0x439329['include']?_[_0x3961('0x1d')](_0x439329[_0x3961('0x1c')],function(_0xd0cb43){return{'model':db[_0xd0cb43[_0x3961('0x1f')]],'as':_0xd0cb43['as'],'attributes':_0xd0cb43[_0x3961('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x3961('0xb')](function(_0x5b1b5a){logger['info'](_0x3961('0x21'),_0x191b7d);logger[_0x3961('0xe')](_0x3961('0x21'),_0x191b7d,JSON['stringify'](_0x5b1b5a));_0x3104ff(_0x5b1b5a);})[_0x3961('0x15')](function(_0x364edc){logger['error'](_0x3961('0x21'),_0x364edc['message'],_0x191b7d);_0x378d7f(_0x5b7baf[_0x3961('0x10')](0x1f4,_0x364edc[_0x3961('0x13')]));});});}; \ No newline at end of file +var _0x0004=['model','map','attributes','then','ShowSalesforceAccount','SalesforceAccount','find','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetSalesforceAccount','findAll','options','raw','where','limit','include'];(function(_0x28181c,_0x9e8e0f){var _0x1432fe=function(_0x31d7c7){while(--_0x31d7c7){_0x28181c['push'](_0x28181c['shift']());}};_0x1432fe(++_0x9e8e0f);}(_0x0004,0x19e));var _0x4000=function(_0x32bf8b,_0x2ac32b){_0x32bf8b=_0x32bf8b-0x0;var _0x1e5ef5=_0x0004[_0x32bf8b];return _0x1e5ef5;};'use strict';var _=require(_0x4000('0x0'));var util=require('util');var moment=require(_0x4000('0x1'));var BPromise=require(_0x4000('0x2'));var rs=require(_0x4000('0x3'));var fs=require('fs');var Redis=require(_0x4000('0x4'));var db=require(_0x4000('0x5'))['db'];var utils=require(_0x4000('0x6'));var logger=require(_0x4000('0x7'))(_0x4000('0x8'));var config=require(_0x4000('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x4000('0xa')][_0x4000('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3f86e8,_0x4b1d79,_0x18c4bb){return new BPromise(function(_0x258832,_0x5ccbeb){return client['request'](_0x3f86e8,_0x18c4bb)['then'](function(_0x42ab47){logger['info'](_0x4000('0xc'),_0x4b1d79,_0x4000('0xd'));logger[_0x4000('0xe')](_0x4000('0xf'),_0x4b1d79,_0x4000('0xd'),JSON[_0x4000('0x10')](_0x42ab47));if(_0x42ab47[_0x4000('0x11')]){if(_0x42ab47[_0x4000('0x11')][_0x4000('0x12')]===0x1f4){logger[_0x4000('0x11')](_0x4000('0xc'),_0x4b1d79,_0x42ab47[_0x4000('0x11')][_0x4000('0x13')]);return _0x5ccbeb(_0x42ab47[_0x4000('0x11')]['message']);}logger['error']('SalesforceAccount,\x20%s,\x20%s',_0x4b1d79,_0x42ab47[_0x4000('0x11')][_0x4000('0x13')]);return _0x258832(_0x42ab47[_0x4000('0x11')][_0x4000('0x13')]);}else{logger[_0x4000('0x14')]('SalesforceAccount,\x20%s,\x20%s',_0x4b1d79,_0x4000('0xd'));_0x258832(_0x42ab47[_0x4000('0x15')]['message']);}})[_0x4000('0x16')](function(_0x35d93a){logger[_0x4000('0x11')](_0x4000('0xc'),_0x4b1d79,_0x35d93a);_0x5ccbeb(_0x35d93a);});});}exports[_0x4000('0x17')]=function(_0x362be7){var _0x280df2=this;return new Promise(function(_0x1d7594,_0x277193){return db['SalesforceAccount'][_0x4000('0x18')]({'raw':_0x362be7[_0x4000('0x19')]?_0x362be7['options'][_0x4000('0x1a')]===undefined?!![]:![]:!![],'where':_0x362be7[_0x4000('0x19')]?_0x362be7[_0x4000('0x19')][_0x4000('0x1b')]||null:null,'attributes':_0x362be7[_0x4000('0x19')]?_0x362be7['options']['attributes']||null:null,'limit':_0x362be7[_0x4000('0x19')]?_0x362be7['options'][_0x4000('0x1c')]||null:null,'include':_0x362be7[_0x4000('0x19')]?_0x362be7['options'][_0x4000('0x1d')]?_['map'](_0x362be7[_0x4000('0x19')][_0x4000('0x1d')],function(_0x3f5d57){return{'model':db[_0x3f5d57[_0x4000('0x1e')]],'as':_0x3f5d57['as'],'attributes':_0x3f5d57['attributes'],'include':_0x3f5d57[_0x4000('0x1d')]?_[_0x4000('0x1f')](_0x3f5d57[_0x4000('0x1d')],function(_0x24e34f){return{'model':db[_0x24e34f[_0x4000('0x1e')]],'as':_0x24e34f['as'],'attributes':_0x24e34f[_0x4000('0x20')],'include':_0x24e34f[_0x4000('0x1d')]?_['map'](_0x24e34f[_0x4000('0x1d')],function(_0x343eee){return{'model':db[_0x343eee[_0x4000('0x1e')]],'as':_0x343eee['as'],'attributes':_0x343eee['attributes']};}):[]};}):[]};}):[]:[]})[_0x4000('0x21')](function(_0x54be16){logger['info'](_0x4000('0x17'),_0x362be7);logger[_0x4000('0xe')](_0x4000('0x17'),_0x362be7,JSON['stringify'](_0x54be16));_0x1d7594(_0x54be16);})['catch'](function(_0x5be96c){logger['error'](_0x4000('0x17'),_0x5be96c['message'],_0x362be7);_0x277193(_0x280df2[_0x4000('0x11')](0x1f4,_0x5be96c['message']));});});};exports[_0x4000('0x22')]=function(_0x28e700){var _0x2de320=this;return new Promise(function(_0x20ba90,_0x290416){return db[_0x4000('0x23')][_0x4000('0x24')]({'raw':_0x28e700[_0x4000('0x19')]?_0x28e700[_0x4000('0x19')][_0x4000('0x1a')]===undefined?!![]:![]:!![],'where':_0x28e700[_0x4000('0x19')]?_0x28e700[_0x4000('0x19')]['where']||null:null,'attributes':_0x28e700[_0x4000('0x19')]?_0x28e700[_0x4000('0x19')][_0x4000('0x20')]||null:null,'include':_0x28e700['options']?_0x28e700[_0x4000('0x19')]['include']?_['map'](_0x28e700[_0x4000('0x19')][_0x4000('0x1d')],function(_0x50a27c){return{'model':db[_0x50a27c[_0x4000('0x1e')]],'as':_0x50a27c['as'],'attributes':_0x50a27c[_0x4000('0x20')],'include':_0x50a27c[_0x4000('0x1d')]?_[_0x4000('0x1f')](_0x50a27c[_0x4000('0x1d')],function(_0x328361){return{'model':db[_0x328361['model']],'as':_0x328361['as'],'attributes':_0x328361[_0x4000('0x20')],'include':_0x328361['include']?_[_0x4000('0x1f')](_0x328361['include'],function(_0x34b358){return{'model':db[_0x34b358[_0x4000('0x1e')]],'as':_0x34b358['as'],'attributes':_0x34b358[_0x4000('0x20')]};}):[]};}):[]};}):[]:[]})[_0x4000('0x21')](function(_0x3d8c76){logger[_0x4000('0x14')](_0x4000('0x22'),_0x28e700);logger['debug'](_0x4000('0x22'),_0x28e700,JSON[_0x4000('0x10')](_0x3d8c76));_0x20ba90(_0x3d8c76);})['catch'](function(_0x32a3a2){logger['error']('ShowSalesforceAccount',_0x32a3a2[_0x4000('0x13')],_0x28e700);_0x290416(_0x2de320[_0x4000('0x11')](0x1f4,_0x32a3a2[_0x4000('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 6e9a801..7701272 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 _0x2ef3=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intSalesforceConfiguration.controller','get','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','update','exports','multer','util','path'];(function(_0x7f5e50,_0x17c7c9){var _0xfa71ba=function(_0x1a512c){while(--_0x1a512c){_0x7f5e50['push'](_0x7f5e50['shift']());}};_0xfa71ba(++_0x17c7c9);}(_0x2ef3,0xba));var _0x32ef=function(_0x2c0620,_0x3ab922){_0x2c0620=_0x2c0620-0x0;var _0x11dc62=_0x2ef3[_0x2c0620];return _0x11dc62;};'use strict';var multer=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var path=require(_0x32ef('0x2'));var timeout=require(_0x32ef('0x3'));var express=require(_0x32ef('0x4'));var router=express[_0x32ef('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x32ef('0x6'));var interaction=require(_0x32ef('0x7'));var config=require('../../config/environment');var controller=require(_0x32ef('0x8'));router[_0x32ef('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x32ef('0x9')](_0x32ef('0xa'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xc')]);router[_0x32ef('0x9')](_0x32ef('0xd'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xe')]);router[_0x32ef('0x9')](_0x32ef('0xf'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x32ef('0x9')](_0x32ef('0x10'),auth[_0x32ef('0xb')](),controller[_0x32ef('0x11')]);router['post']('/',auth[_0x32ef('0xb')](),controller['create']);router[_0x32ef('0x12')]('/:id',auth[_0x32ef('0xb')](),controller[_0x32ef('0x13')]);router['delete']('/:id',auth[_0x32ef('0xb')](),controller['destroy']);module[_0x32ef('0x14')]=router; \ No newline at end of file +var _0x5f2f=['Router','fs-extra','../../components/auth/service','./intSalesforceConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','create','put','update','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x2ed7a2,_0x56a52f){var _0x33f974=function(_0x681308){while(--_0x681308){_0x2ed7a2['push'](_0x2ed7a2['shift']());}};_0x33f974(++_0x56a52f);}(_0x5f2f,0x73));var _0xf5f2=function(_0x5b7f48,_0x4d8a1d){_0x5b7f48=_0x5b7f48-0x0;var _0x2424b0=_0x5f2f[_0x5b7f48];return _0x2424b0;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var fs_extra=require(_0xf5f2('0x6'));var auth=require(_0xf5f2('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf5f2('0x8'));router[_0xf5f2('0x9')]('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0xb')]);router[_0xf5f2('0x9')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0xd')]);router[_0xf5f2('0x9')](_0xf5f2('0xe'),auth['isAuthenticated'](),controller[_0xf5f2('0xf')]);router[_0xf5f2('0x9')](_0xf5f2('0x10'),auth['isAuthenticated'](),controller[_0xf5f2('0x11')]);router['get']('/:id/descriptions',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x12')]);router['post']('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x13')]);router[_0xf5f2('0x14')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x15')]);router['delete'](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x16')]);module[_0xf5f2('0x17')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index f803921..f235aa0 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 _0x41cc=['lead','account_contact_lead','sequelize','STRING','ENUM','Task','Case','contact_lead','contact'];(function(_0x351509,_0x54725c){var _0x4e9861=function(_0x54f92c){while(--_0x54f92c){_0x351509['push'](_0x351509['shift']());}};_0x4e9861(++_0x54725c);}(_0x41cc,0x1df));var _0xc41c=function(_0xbca15c,_0x5ac4cc){_0xbca15c=_0xbca15c-0x0;var _0x2f2a88=_0x41cc[_0xbca15c];return _0x2f2a88;};'use strict';var Sequelize=require(_0xc41c('0x0'));module['exports']={'name':{'type':Sequelize[_0xc41c('0x1')]},'description':{'type':Sequelize[_0xc41c('0x1')]},'ticketType':{'type':Sequelize[_0xc41c('0x2')](_0xc41c('0x3'),_0xc41c('0x4')),'defaultValue':_0xc41c('0x3')},'moduleSearch':{'type':Sequelize[_0xc41c('0x2')](_0xc41c('0x5'),_0xc41c('0x6'),_0xc41c('0x7'),_0xc41c('0x8'),'account'),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize[_0xc41c('0x2')]('nothing',_0xc41c('0x6'),_0xc41c('0x7'),'account'),'defaultValue':'lead'},'leadId':{'type':Sequelize['STRING']},'additionalSearchAccount':{'type':Sequelize['STRING']},'additionalSearchContact':{'type':Sequelize['STRING']},'additionalSearchLead':{'type':Sequelize[_0xc41c('0x1')]}}; \ No newline at end of file +var _0x6e2d=['lead','account','nothing','sequelize','exports','STRING','ENUM','Task','Case','contact_lead','contact'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x6e2d,0x158));var _0xd6e2=function(_0x3f68c8,_0x44724f){_0x3f68c8=_0x3f68c8-0x0;var _0x2ab867=_0x6e2d[_0x3f68c8];return _0x2ab867;};'use strict';var Sequelize=require(_0xd6e2('0x0'));module[_0xd6e2('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xd6e2('0x2')]},'ticketType':{'type':Sequelize[_0xd6e2('0x3')](_0xd6e2('0x4'),_0xd6e2('0x5')),'defaultValue':_0xd6e2('0x4')},'moduleSearch':{'type':Sequelize['ENUM'](_0xd6e2('0x6'),_0xd6e2('0x7'),_0xd6e2('0x8'),'account_contact_lead',_0xd6e2('0x9')),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize[_0xd6e2('0x3')](_0xd6e2('0xa'),_0xd6e2('0x7'),_0xd6e2('0x8'),_0xd6e2('0x9')),'defaultValue':_0xd6e2('0x8')},'leadId':{'type':Sequelize['STRING']},'additionalSearchAccount':{'type':Sequelize[_0xd6e2('0x2')]},'additionalSearchContact':{'type':Sequelize[_0xd6e2('0x2')]},'additionalSearchLead':{'type':Sequelize[_0xd6e2('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 63416d0..840e459 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 _0x1cbb=['options','include','rows','show','params','keys','includeAll','find','create','body','catch','findOne','rawAttributes','order','getFields','getSubjects','SalesforceField','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','offset','undefined','limit','count','status','Content-Range','json','reject','save','then','destroy','error','stack','name','send','index','SalesforceConfiguration','fieldName','key','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','map','type','merge'];(function(_0x1fd654,_0x553655){var _0x2bf8e1=function(_0x5c9506){while(--_0x5c9506){_0x1fd654['push'](_0x1fd654['shift']());}};_0x2bf8e1(++_0x553655);}(_0x1cbb,0x105));var _0xb1cb=function(_0x4d3303,_0xae916e){_0x4d3303=_0x4d3303-0x0;var _0x1c3768=_0x1cbb[_0x4d3303];return _0x1c3768;};'use strict';var emlformat=require(_0xb1cb('0x0'));var rimraf=require(_0xb1cb('0x1'));var zipdir=require(_0xb1cb('0x2'));var jsonpatch=require(_0xb1cb('0x3'));var rp=require('request-promise');var moment=require(_0xb1cb('0x4'));var BPromise=require(_0xb1cb('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xb1cb('0x6'));var sox=require(_0xb1cb('0x7'));var csv=require(_0xb1cb('0x8'));var ejs=require(_0xb1cb('0x9'));var fs=require('fs');var fs_extra=require(_0xb1cb('0xa'));var _=require(_0xb1cb('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xb1cb('0xc'));var deskjs=require(_0xb1cb('0xd'));var toCsv=require('to-csv');var querystring=require(_0xb1cb('0xe'));var Papa=require(_0xb1cb('0xf'));var Redis=require('ioredis');var authService=require(_0xb1cb('0x10'));var qs=require(_0xb1cb('0x11'));var as=require(_0xb1cb('0x12'));var hardwareService=require(_0xb1cb('0x13'));var logger=require(_0xb1cb('0x14'))(_0xb1cb('0x15'));var utils=require(_0xb1cb('0x16'));var config=require(_0xb1cb('0x17'));var licenseUtil=require(_0xb1cb('0x18'));var db=require(_0xb1cb('0x19'))['db'];function respondWithStatusCode(_0x2a42cc,_0x4789c9){_0x4789c9=_0x4789c9||0xcc;return function(_0x56819c){if(_0x56819c){return _0x2a42cc[_0xb1cb('0x1a')](_0x4789c9);}return _0x2a42cc['status'](_0x4789c9)[_0xb1cb('0x1b')]();};}function respondWithResult(_0x3a470f,_0x4e6888){_0x4e6888=_0x4e6888||0xc8;return function(_0x1acbe6){if(_0x1acbe6){return _0x3a470f['status'](_0x4e6888)['json'](_0x1acbe6);}};}function respondWithFilteredResult(_0xda39ae,_0x12bcba){return function(_0x1177c1){if(_0x1177c1){var _0x28f351=typeof _0x12bcba[_0xb1cb('0x1c')]===_0xb1cb('0x1d')&&typeof _0x12bcba[_0xb1cb('0x1e')]===_0xb1cb('0x1d');var _0x183aba=_0x1177c1['count'];var _0xa84e8c=_0x28f351?0x0:_0x12bcba[_0xb1cb('0x1c')];var _0xc286f2=_0x28f351?_0x1177c1[_0xb1cb('0x1f')]:_0x12bcba['offset']+_0x12bcba[_0xb1cb('0x1e')];var _0x5800fe;if(_0xc286f2>=_0x183aba){_0xc286f2=_0x183aba;_0x5800fe=0xc8;}else{_0x5800fe=0xce;}_0xda39ae[_0xb1cb('0x20')](_0x5800fe);return _0xda39ae['set'](_0xb1cb('0x21'),_0xa84e8c+'-'+_0xc286f2+'/'+_0x183aba)[_0xb1cb('0x22')](_0x1177c1);}return null;};}function patchUpdates(_0x15202a){return function(_0x1867f7){try{jsonpatch['apply'](_0x1867f7,_0x15202a,!![]);}catch(_0x5a0acf){return BPromise[_0xb1cb('0x23')](_0x5a0acf);}return _0x1867f7[_0xb1cb('0x24')]();};}function saveUpdates(_0x3a821b,_0x165a04){return function(_0x522403){if(_0x522403){return _0x522403['update'](_0x3a821b)[_0xb1cb('0x25')](function(_0x59784d){return _0x59784d;});}return null;};}function removeEntity(_0x1962b6,_0x47d6f2){return function(_0x37a2cd){if(_0x37a2cd){return _0x37a2cd[_0xb1cb('0x26')]()[_0xb1cb('0x25')](function(){_0x1962b6['status'](0xcc)[_0xb1cb('0x1b')]();});}};}function handleEntityNotFound(_0x410031,_0x38d554){return function(_0x465ac5){if(!_0x465ac5){_0x410031[_0xb1cb('0x1a')](0x194);}return _0x465ac5;};}function handleError(_0x542ca2,_0x271c7c){_0x271c7c=_0x271c7c||0x1f4;return function(_0x3ecd97){logger[_0xb1cb('0x27')](_0x3ecd97[_0xb1cb('0x28')]);if(_0x3ecd97[_0xb1cb('0x29')]){delete _0x3ecd97[_0xb1cb('0x29')];}_0x542ca2[_0xb1cb('0x20')](_0x271c7c)[_0xb1cb('0x2a')](_0x3ecd97);};}exports[_0xb1cb('0x2b')]=function(_0x28560a,_0x5b086e){var _0x50a446={},_0x3073ca={},_0x2cbcb0={'count':0x0,'rows':[]};var _0x32b9e3=_['map'](db[_0xb1cb('0x2c')]['rawAttributes'],function(_0x265aed){return{'name':_0x265aed[_0xb1cb('0x2d')],'type':_0x265aed['type'][_0xb1cb('0x2e')]};});_0x3073ca['model']=_['map'](_0x32b9e3,_0xb1cb('0x29'));_0x3073ca[_0xb1cb('0x2f')]=_['keys'](_0x28560a[_0xb1cb('0x2f')]);_0x3073ca['filters']=_['intersection'](_0x3073ca['model'],_0x3073ca[_0xb1cb('0x2f')]);_0x50a446['attributes']=_[_0xb1cb('0x30')](_0x3073ca[_0xb1cb('0x31')],qs[_0xb1cb('0x32')](_0x28560a[_0xb1cb('0x2f')][_0xb1cb('0x32')]));_0x50a446[_0xb1cb('0x33')]=_0x50a446[_0xb1cb('0x33')][_0xb1cb('0x34')]?_0x50a446[_0xb1cb('0x33')]:_0x3073ca[_0xb1cb('0x31')];if(!_0x28560a[_0xb1cb('0x2f')][_0xb1cb('0x35')](_0xb1cb('0x36'))){_0x50a446[_0xb1cb('0x1e')]=qs[_0xb1cb('0x1e')](_0x28560a[_0xb1cb('0x2f')]['limit']);_0x50a446[_0xb1cb('0x1c')]=qs[_0xb1cb('0x1c')](_0x28560a[_0xb1cb('0x2f')][_0xb1cb('0x1c')]);}_0x50a446['order']=qs[_0xb1cb('0x37')](_0x28560a[_0xb1cb('0x2f')][_0xb1cb('0x37')]);_0x50a446[_0xb1cb('0x38')]=qs[_0xb1cb('0x39')](_[_0xb1cb('0x3a')](_0x28560a[_0xb1cb('0x2f')],_0x3073ca[_0xb1cb('0x39')]),_0x32b9e3);if(_0x28560a['query'][_0xb1cb('0x3b')]){_0x50a446['where']=_['merge'](_0x50a446[_0xb1cb('0x38')],{'$or':_[_0xb1cb('0x3c')](_0x32b9e3,function(_0x507c12){if(_0x507c12[_0xb1cb('0x3d')]!=='VIRTUAL'){var _0x303687={};_0x303687[_0x507c12[_0xb1cb('0x29')]]={'$like':'%'+_0x28560a[_0xb1cb('0x2f')][_0xb1cb('0x3b')]+'%'};return _0x303687;}})});}_0x50a446=_[_0xb1cb('0x3e')]({},_0x50a446,_0x28560a[_0xb1cb('0x3f')]);var _0x462734={'where':_0x50a446[_0xb1cb('0x38')]};return db[_0xb1cb('0x2c')][_0xb1cb('0x1f')](_0x462734)[_0xb1cb('0x25')](function(_0x1162da){_0x2cbcb0[_0xb1cb('0x1f')]=_0x1162da;if(_0x28560a[_0xb1cb('0x2f')]['includeAll']){_0x50a446[_0xb1cb('0x40')]=[{'all':!![]}];}return db[_0xb1cb('0x2c')]['findAll'](_0x50a446);})[_0xb1cb('0x25')](function(_0x5cfa36){_0x2cbcb0[_0xb1cb('0x41')]=_0x5cfa36;return _0x2cbcb0;})[_0xb1cb('0x25')](respondWithFilteredResult(_0x5b086e,_0x50a446))['catch'](handleError(_0x5b086e,null));};exports[_0xb1cb('0x42')]=function(_0x102fe0,_0x1e5d27){var _0x34157d={'raw':![],'where':{'id':_0x102fe0[_0xb1cb('0x43')]['id']}},_0x4a91b2={};_0x4a91b2[_0xb1cb('0x31')]=_[_0xb1cb('0x44')](db[_0xb1cb('0x2c')]['rawAttributes']);_0x4a91b2[_0xb1cb('0x2f')]=_['keys'](_0x102fe0[_0xb1cb('0x2f')]);_0x4a91b2[_0xb1cb('0x39')]=_['intersection'](_0x4a91b2[_0xb1cb('0x31')],_0x4a91b2['query']);_0x34157d[_0xb1cb('0x33')]=_['intersection'](_0x4a91b2[_0xb1cb('0x31')],qs['fields'](_0x102fe0[_0xb1cb('0x2f')]['fields']));_0x34157d[_0xb1cb('0x33')]=_0x34157d[_0xb1cb('0x33')]['length']?_0x34157d[_0xb1cb('0x33')]:_0x4a91b2[_0xb1cb('0x31')];if(_0x102fe0['query'][_0xb1cb('0x45')]){_0x34157d[_0xb1cb('0x40')]=[{'all':!![]}];}_0x34157d=_['merge']({},_0x34157d,_0x102fe0[_0xb1cb('0x3f')]);return db[_0xb1cb('0x2c')][_0xb1cb('0x46')](_0x34157d)[_0xb1cb('0x25')](handleEntityNotFound(_0x1e5d27,null))['then'](respondWithResult(_0x1e5d27,null))['catch'](handleError(_0x1e5d27,null));};exports[_0xb1cb('0x47')]=function(_0x1a1c9c,_0x8bfc4){return db[_0xb1cb('0x2c')][_0xb1cb('0x47')](_0x1a1c9c[_0xb1cb('0x48')],{})['then'](respondWithResult(_0x8bfc4,0xc9))['catch'](handleError(_0x8bfc4,null));};exports['update']=function(_0x10c536,_0x144d10){if(_0x10c536[_0xb1cb('0x48')]['id']){delete _0x10c536[_0xb1cb('0x48')]['id'];}return db['SalesforceConfiguration']['find']({'where':{'id':_0x10c536[_0xb1cb('0x43')]['id']}})[_0xb1cb('0x25')](handleEntityNotFound(_0x144d10,null))[_0xb1cb('0x25')](saveUpdates(_0x10c536[_0xb1cb('0x48')],null))[_0xb1cb('0x25')](respondWithResult(_0x144d10,null))[_0xb1cb('0x49')](handleError(_0x144d10,null));};exports[_0xb1cb('0x26')]=function(_0x478454,_0x31ea7b){return db['SalesforceConfiguration'][_0xb1cb('0x46')]({'where':{'id':_0x478454[_0xb1cb('0x43')]['id']}})[_0xb1cb('0x25')](handleEntityNotFound(_0x31ea7b,null))[_0xb1cb('0x25')](removeEntity(_0x31ea7b,null))[_0xb1cb('0x49')](handleError(_0x31ea7b,null));};exports['getFields']=function(_0x71bfa9,_0x3226f2,_0x5ec80d){var _0x46d7f9={};var _0x247058={};var _0x1817fd;var _0x353224;return db['SalesforceConfiguration'][_0xb1cb('0x4a')]({'where':{'id':_0x71bfa9[_0xb1cb('0x43')]['id']}})['then'](handleEntityNotFound(_0x3226f2,null))[_0xb1cb('0x25')](function(_0x5aa2a8){if(_0x5aa2a8){_0x1817fd=_0x5aa2a8;_0x247058[_0xb1cb('0x31')]=_['keys'](db['SalesforceField'][_0xb1cb('0x4b')]);_0x247058[_0xb1cb('0x2f')]=_[_0xb1cb('0x44')](_0x71bfa9[_0xb1cb('0x2f')]);_0x247058[_0xb1cb('0x39')]=_['intersection'](_0x247058[_0xb1cb('0x31')],_0x247058[_0xb1cb('0x2f')]);_0x46d7f9[_0xb1cb('0x33')]=_['intersection'](_0x247058[_0xb1cb('0x31')],qs[_0xb1cb('0x32')](_0x71bfa9['query'][_0xb1cb('0x32')]));_0x46d7f9[_0xb1cb('0x33')]=_0x46d7f9[_0xb1cb('0x33')]['length']?_0x46d7f9[_0xb1cb('0x33')]:_0x247058['model'];_0x46d7f9[_0xb1cb('0x4c')]=qs[_0xb1cb('0x37')](_0x71bfa9[_0xb1cb('0x2f')][_0xb1cb('0x37')]);_0x46d7f9['where']=qs[_0xb1cb('0x39')](_[_0xb1cb('0x3a')](_0x71bfa9[_0xb1cb('0x2f')],_0x247058[_0xb1cb('0x39')]));if(_0x71bfa9[_0xb1cb('0x2f')][_0xb1cb('0x3b')]){_0x46d7f9[_0xb1cb('0x38')]=_[_0xb1cb('0x3e')](_0x46d7f9['where'],{'$or':_[_0xb1cb('0x3c')](_0x46d7f9['attributes'],function(_0x2d99a1){var _0x36e69c={};_0x36e69c[_0x2d99a1]={'$like':'%'+_0x71bfa9[_0xb1cb('0x2f')][_0xb1cb('0x3b')]+'%'};return _0x36e69c;})});}_0x46d7f9=_[_0xb1cb('0x3e')]({},_0x46d7f9,_0x71bfa9[_0xb1cb('0x3f')]);return _0x1817fd[_0xb1cb('0x4d')](_0x46d7f9);}})[_0xb1cb('0x25')](function(_0x124d9a){if(_0x124d9a){_0x353224=_0x124d9a[_0xb1cb('0x34')];if(!_0x71bfa9['query'][_0xb1cb('0x35')](_0xb1cb('0x36'))){_0x46d7f9[_0xb1cb('0x1e')]=qs[_0xb1cb('0x1e')](_0x71bfa9[_0xb1cb('0x2f')][_0xb1cb('0x1e')]);_0x46d7f9[_0xb1cb('0x1c')]=qs[_0xb1cb('0x1c')](_0x71bfa9[_0xb1cb('0x2f')][_0xb1cb('0x1c')]);}return _0x1817fd[_0xb1cb('0x4d')](_0x46d7f9);}})['then'](function(_0x2004f4){if(_0x2004f4){return _0x2004f4?{'count':_0x353224,'rows':_0x2004f4}:null;}})['then'](respondWithResult(_0x3226f2,null))[_0xb1cb('0x49')](handleError(_0x3226f2,null));};exports[_0xb1cb('0x4e')]=function(_0x2c9bea,_0x36ef61,_0xb7e066){var _0x5826e5={};var _0x3568e5={};var _0x39b191;var _0x2b5fc2;return db[_0xb1cb('0x2c')]['findOne']({'where':{'id':_0x2c9bea[_0xb1cb('0x43')]['id']}})['then'](handleEntityNotFound(_0x36ef61,null))[_0xb1cb('0x25')](function(_0x1df971){if(_0x1df971){_0x39b191=_0x1df971;_0x3568e5[_0xb1cb('0x31')]=_[_0xb1cb('0x44')](db[_0xb1cb('0x4f')]['rawAttributes']);_0x3568e5['query']=_[_0xb1cb('0x44')](_0x2c9bea[_0xb1cb('0x2f')]);_0x3568e5[_0xb1cb('0x39')]=_['intersection'](_0x3568e5[_0xb1cb('0x31')],_0x3568e5[_0xb1cb('0x2f')]);_0x5826e5['attributes']=_[_0xb1cb('0x30')](_0x3568e5['model'],qs[_0xb1cb('0x32')](_0x2c9bea['query'][_0xb1cb('0x32')]));_0x5826e5[_0xb1cb('0x33')]=_0x5826e5[_0xb1cb('0x33')][_0xb1cb('0x34')]?_0x5826e5[_0xb1cb('0x33')]:_0x3568e5[_0xb1cb('0x31')];_0x5826e5[_0xb1cb('0x4c')]=qs['sort'](_0x2c9bea[_0xb1cb('0x2f')][_0xb1cb('0x37')]);_0x5826e5[_0xb1cb('0x38')]=qs[_0xb1cb('0x39')](_[_0xb1cb('0x3a')](_0x2c9bea[_0xb1cb('0x2f')],_0x3568e5[_0xb1cb('0x39')]));if(_0x2c9bea[_0xb1cb('0x2f')][_0xb1cb('0x3b')]){_0x5826e5[_0xb1cb('0x38')]=_['merge'](_0x5826e5[_0xb1cb('0x38')],{'$or':_['map'](_0x5826e5[_0xb1cb('0x33')],function(_0x54dd87){var _0x1ec0e1={};_0x1ec0e1[_0x54dd87]={'$like':'%'+_0x2c9bea[_0xb1cb('0x2f')][_0xb1cb('0x3b')]+'%'};return _0x1ec0e1;})});}_0x5826e5=_['merge']({},_0x5826e5,_0x2c9bea['options']);return _0x39b191[_0xb1cb('0x4e')](_0x5826e5);}})[_0xb1cb('0x25')](function(_0xfc1a2){if(_0xfc1a2){_0x2b5fc2=_0xfc1a2[_0xb1cb('0x34')];if(!_0x2c9bea['query']['hasOwnProperty'](_0xb1cb('0x36'))){_0x5826e5[_0xb1cb('0x1e')]=qs[_0xb1cb('0x1e')](_0x2c9bea[_0xb1cb('0x2f')][_0xb1cb('0x1e')]);_0x5826e5[_0xb1cb('0x1c')]=qs[_0xb1cb('0x1c')](_0x2c9bea['query'][_0xb1cb('0x1c')]);}return _0x39b191[_0xb1cb('0x4e')](_0x5826e5);}})[_0xb1cb('0x25')](function(_0x6a382){if(_0x6a382){return _0x6a382?{'count':_0x2b5fc2,'rows':_0x6a382}:null;}})[_0xb1cb('0x25')](respondWithResult(_0x36ef61,null))['catch'](handleError(_0x36ef61,null));};exports[_0xb1cb('0x50')]=function(_0x107613,_0x40d061,_0x39681d){var _0x20a99e={};var _0x36099b={};var _0x3ed677;var _0xdd6c90;return db[_0xb1cb('0x2c')][_0xb1cb('0x4a')]({'where':{'id':_0x107613[_0xb1cb('0x43')]['id']}})[_0xb1cb('0x25')](handleEntityNotFound(_0x40d061,null))[_0xb1cb('0x25')](function(_0x2315c6){if(_0x2315c6){_0x3ed677=_0x2315c6;_0x36099b[_0xb1cb('0x31')]=_[_0xb1cb('0x44')](db[_0xb1cb('0x4f')]['rawAttributes']);_0x36099b['query']=_[_0xb1cb('0x44')](_0x107613[_0xb1cb('0x2f')]);_0x36099b['filters']=_[_0xb1cb('0x30')](_0x36099b['model'],_0x36099b[_0xb1cb('0x2f')]);_0x20a99e[_0xb1cb('0x33')]=_[_0xb1cb('0x30')](_0x36099b[_0xb1cb('0x31')],qs[_0xb1cb('0x32')](_0x107613['query']['fields']));_0x20a99e[_0xb1cb('0x33')]=_0x20a99e[_0xb1cb('0x33')][_0xb1cb('0x34')]?_0x20a99e['attributes']:_0x36099b['model'];_0x20a99e[_0xb1cb('0x4c')]=qs['sort'](_0x107613[_0xb1cb('0x2f')]['sort']);_0x20a99e[_0xb1cb('0x38')]=qs[_0xb1cb('0x39')](_[_0xb1cb('0x3a')](_0x107613[_0xb1cb('0x2f')],_0x36099b[_0xb1cb('0x39')]));if(_0x107613[_0xb1cb('0x2f')]['filter']){_0x20a99e[_0xb1cb('0x38')]=_[_0xb1cb('0x3e')](_0x20a99e[_0xb1cb('0x38')],{'$or':_[_0xb1cb('0x3c')](_0x20a99e['attributes'],function(_0x71ba71){var _0x197812={};_0x197812[_0x71ba71]={'$like':'%'+_0x107613[_0xb1cb('0x2f')][_0xb1cb('0x3b')]+'%'};return _0x197812;})});}_0x20a99e=_[_0xb1cb('0x3e')]({},_0x20a99e,_0x107613['options']);return _0x3ed677[_0xb1cb('0x50')](_0x20a99e);}})['then'](function(_0x565685){if(_0x565685){_0xdd6c90=_0x565685['length'];if(!_0x107613[_0xb1cb('0x2f')]['hasOwnProperty'](_0xb1cb('0x36'))){_0x20a99e[_0xb1cb('0x1e')]=qs['limit'](_0x107613[_0xb1cb('0x2f')][_0xb1cb('0x1e')]);_0x20a99e[_0xb1cb('0x1c')]=qs['offset'](_0x107613[_0xb1cb('0x2f')][_0xb1cb('0x1c')]);}return _0x3ed677[_0xb1cb('0x50')](_0x20a99e);}})['then'](function(_0x47fdb1){if(_0x47fdb1){return _0x47fdb1?{'count':_0xdd6c90,'rows':_0x47fdb1}:null;}})['then'](respondWithResult(_0x40d061,null))['catch'](handleError(_0x40d061,null));}; \ No newline at end of file +var _0x135c=['../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','count','limit','set','apply','reject','save','update','then','destroy','error','stack','name','index','map','SalesforceConfiguration','type','key','model','query','keys','filters','attributes','intersection','fields','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','rawAttributes','length','find','create','body','params','getFields','findOne','getSubjects','SalesforceField','hasOwnProperty','getDescriptions','pick','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x53b133,_0x176261){var _0x5647e0=function(_0x4c62b0){while(--_0x4c62b0){_0x53b133['push'](_0x53b133['shift']());}};_0x5647e0(++_0x176261);}(_0x135c,0xda));var _0xc135=function(_0x2d361d,_0x2e1713){_0x2d361d=_0x2d361d-0x0;var _0x5ac9b3=_0x135c[_0x2d361d];return _0x5ac9b3;};'use strict';var emlformat=require(_0xc135('0x0'));var rimraf=require(_0xc135('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc135('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xc135('0x3'));var Mustache=require(_0xc135('0x4'));var util=require(_0xc135('0x5'));var path=require('path');var sox=require(_0xc135('0x6'));var csv=require(_0xc135('0x7'));var ejs=require(_0xc135('0x8'));var fs=require('fs');var fs_extra=require(_0xc135('0x9'));var _=require(_0xc135('0xa'));var squel=require(_0xc135('0xb'));var crypto=require(_0xc135('0xc'));var jsforce=require(_0xc135('0xd'));var deskjs=require(_0xc135('0xe'));var toCsv=require(_0xc135('0x7'));var querystring=require('querystring');var Papa=require(_0xc135('0xf'));var Redis=require(_0xc135('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xc135('0x11'));var as=require(_0xc135('0x12'));var hardwareService=require(_0xc135('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xc135('0x14'));var licenseUtil=require(_0xc135('0x15'));var db=require(_0xc135('0x16'))['db'];function respondWithStatusCode(_0x5515ee,_0xc62959){_0xc62959=_0xc62959||0xcc;return function(_0x4e9404){if(_0x4e9404){return _0x5515ee[_0xc135('0x17')](_0xc62959);}return _0x5515ee[_0xc135('0x18')](_0xc62959)[_0xc135('0x19')]();};}function respondWithResult(_0x41f8f8,_0x233753){_0x233753=_0x233753||0xc8;return function(_0xb5bfde){if(_0xb5bfde){return _0x41f8f8[_0xc135('0x18')](_0x233753)[_0xc135('0x1a')](_0xb5bfde);}};}function respondWithFilteredResult(_0xb74f9a,_0x386d02){return function(_0x1e4b6b){if(_0x1e4b6b){var _0x44507c=typeof _0x386d02[_0xc135('0x1b')]==='undefined'&&typeof _0x386d02['limit']==='undefined';var _0x1bf4fd=_0x1e4b6b[_0xc135('0x1c')];var _0x22d29f=_0x44507c?0x0:_0x386d02[_0xc135('0x1b')];var _0x5e7c7e=_0x44507c?_0x1e4b6b['count']:_0x386d02[_0xc135('0x1b')]+_0x386d02[_0xc135('0x1d')];var _0x39830c;if(_0x5e7c7e>=_0x1bf4fd){_0x5e7c7e=_0x1bf4fd;_0x39830c=0xc8;}else{_0x39830c=0xce;}_0xb74f9a['status'](_0x39830c);return _0xb74f9a[_0xc135('0x1e')]('Content-Range',_0x22d29f+'-'+_0x5e7c7e+'/'+_0x1bf4fd)[_0xc135('0x1a')](_0x1e4b6b);}return null;};}function patchUpdates(_0x6f30fd){return function(_0x53f7fb){try{jsonpatch[_0xc135('0x1f')](_0x53f7fb,_0x6f30fd,!![]);}catch(_0x68682){return BPromise[_0xc135('0x20')](_0x68682);}return _0x53f7fb[_0xc135('0x21')]();};}function saveUpdates(_0x23fd4b,_0x52f2be){return function(_0x4396c9){if(_0x4396c9){return _0x4396c9[_0xc135('0x22')](_0x23fd4b)[_0xc135('0x23')](function(_0x51d959){return _0x51d959;});}return null;};}function removeEntity(_0x22173e,_0x1b8d52){return function(_0x3bb639){if(_0x3bb639){return _0x3bb639[_0xc135('0x24')]()[_0xc135('0x23')](function(){_0x22173e[_0xc135('0x18')](0xcc)[_0xc135('0x19')]();});}};}function handleEntityNotFound(_0x41727c,_0x56d7af){return function(_0x1f1ed0){if(!_0x1f1ed0){_0x41727c[_0xc135('0x17')](0x194);}return _0x1f1ed0;};}function handleError(_0x421b9b,_0x2cef85){_0x2cef85=_0x2cef85||0x1f4;return function(_0x20ac74){logger[_0xc135('0x25')](_0x20ac74[_0xc135('0x26')]);if(_0x20ac74[_0xc135('0x27')]){delete _0x20ac74[_0xc135('0x27')];}_0x421b9b['status'](_0x2cef85)['send'](_0x20ac74);};}exports[_0xc135('0x28')]=function(_0x51a320,_0x1a2a1b){var _0x1cf24f={},_0x122daa={},_0x350168={'count':0x0,'rows':[]};var _0x30d1f0=_[_0xc135('0x29')](db[_0xc135('0x2a')]['rawAttributes'],function(_0x578a38){return{'name':_0x578a38['fieldName'],'type':_0x578a38[_0xc135('0x2b')][_0xc135('0x2c')]};});_0x122daa[_0xc135('0x2d')]=_[_0xc135('0x29')](_0x30d1f0,_0xc135('0x27'));_0x122daa[_0xc135('0x2e')]=_[_0xc135('0x2f')](_0x51a320[_0xc135('0x2e')]);_0x122daa[_0xc135('0x30')]=_['intersection'](_0x122daa[_0xc135('0x2d')],_0x122daa[_0xc135('0x2e')]);_0x1cf24f[_0xc135('0x31')]=_[_0xc135('0x32')](_0x122daa[_0xc135('0x2d')],qs[_0xc135('0x33')](_0x51a320[_0xc135('0x2e')][_0xc135('0x33')]));_0x1cf24f[_0xc135('0x31')]=_0x1cf24f[_0xc135('0x31')]['length']?_0x1cf24f['attributes']:_0x122daa[_0xc135('0x2d')];if(!_0x51a320[_0xc135('0x2e')]['hasOwnProperty'](_0xc135('0x34'))){_0x1cf24f[_0xc135('0x1d')]=qs[_0xc135('0x1d')](_0x51a320[_0xc135('0x2e')][_0xc135('0x1d')]);_0x1cf24f[_0xc135('0x1b')]=qs[_0xc135('0x1b')](_0x51a320['query'][_0xc135('0x1b')]);}_0x1cf24f[_0xc135('0x35')]=qs[_0xc135('0x36')](_0x51a320['query'][_0xc135('0x36')]);_0x1cf24f[_0xc135('0x37')]=qs[_0xc135('0x30')](_['pick'](_0x51a320['query'],_0x122daa[_0xc135('0x30')]),_0x30d1f0);if(_0x51a320[_0xc135('0x2e')][_0xc135('0x38')]){_0x1cf24f[_0xc135('0x37')]=_[_0xc135('0x39')](_0x1cf24f[_0xc135('0x37')],{'$or':_[_0xc135('0x29')](_0x30d1f0,function(_0x4db815){if(_0x4db815['type']!==_0xc135('0x3a')){var _0x550281={};_0x550281[_0x4db815[_0xc135('0x27')]]={'$like':'%'+_0x51a320[_0xc135('0x2e')][_0xc135('0x38')]+'%'};return _0x550281;}})});}_0x1cf24f=_[_0xc135('0x39')]({},_0x1cf24f,_0x51a320[_0xc135('0x3b')]);var _0x37444c={'where':_0x1cf24f[_0xc135('0x37')]};return db[_0xc135('0x2a')][_0xc135('0x1c')](_0x37444c)['then'](function(_0x5cfb4d){_0x350168[_0xc135('0x1c')]=_0x5cfb4d;if(_0x51a320[_0xc135('0x2e')][_0xc135('0x3c')]){_0x1cf24f[_0xc135('0x3d')]=[{'all':!![]}];}return db[_0xc135('0x2a')][_0xc135('0x3e')](_0x1cf24f);})[_0xc135('0x23')](function(_0x5b1c0f){_0x350168[_0xc135('0x3f')]=_0x5b1c0f;return _0x350168;})[_0xc135('0x23')](respondWithFilteredResult(_0x1a2a1b,_0x1cf24f))[_0xc135('0x40')](handleError(_0x1a2a1b,null));};exports[_0xc135('0x41')]=function(_0x1cb46e,_0x3bbd91){var _0x19666a={'raw':![],'where':{'id':_0x1cb46e['params']['id']}},_0x422607={};_0x422607[_0xc135('0x2d')]=_[_0xc135('0x2f')](db[_0xc135('0x2a')][_0xc135('0x42')]);_0x422607[_0xc135('0x2e')]=_[_0xc135('0x2f')](_0x1cb46e[_0xc135('0x2e')]);_0x422607['filters']=_[_0xc135('0x32')](_0x422607[_0xc135('0x2d')],_0x422607[_0xc135('0x2e')]);_0x19666a[_0xc135('0x31')]=_[_0xc135('0x32')](_0x422607[_0xc135('0x2d')],qs[_0xc135('0x33')](_0x1cb46e[_0xc135('0x2e')][_0xc135('0x33')]));_0x19666a[_0xc135('0x31')]=_0x19666a[_0xc135('0x31')][_0xc135('0x43')]?_0x19666a['attributes']:_0x422607['model'];if(_0x1cb46e['query'][_0xc135('0x3c')]){_0x19666a[_0xc135('0x3d')]=[{'all':!![]}];}_0x19666a=_[_0xc135('0x39')]({},_0x19666a,_0x1cb46e[_0xc135('0x3b')]);return db[_0xc135('0x2a')][_0xc135('0x44')](_0x19666a)[_0xc135('0x23')](handleEntityNotFound(_0x3bbd91,null))[_0xc135('0x23')](respondWithResult(_0x3bbd91,null))[_0xc135('0x40')](handleError(_0x3bbd91,null));};exports[_0xc135('0x45')]=function(_0x270f4b,_0x46118d){return db[_0xc135('0x2a')]['create'](_0x270f4b[_0xc135('0x46')],{})[_0xc135('0x23')](respondWithResult(_0x46118d,0xc9))[_0xc135('0x40')](handleError(_0x46118d,null));};exports[_0xc135('0x22')]=function(_0xc31d1a,_0x45dc55){if(_0xc31d1a[_0xc135('0x46')]['id']){delete _0xc31d1a['body']['id'];}return db[_0xc135('0x2a')][_0xc135('0x44')]({'where':{'id':_0xc31d1a[_0xc135('0x47')]['id']}})['then'](handleEntityNotFound(_0x45dc55,null))['then'](saveUpdates(_0xc31d1a[_0xc135('0x46')],null))[_0xc135('0x23')](respondWithResult(_0x45dc55,null))['catch'](handleError(_0x45dc55,null));};exports['destroy']=function(_0x1fa6be,_0x4618e6){return db['SalesforceConfiguration'][_0xc135('0x44')]({'where':{'id':_0x1fa6be[_0xc135('0x47')]['id']}})[_0xc135('0x23')](handleEntityNotFound(_0x4618e6,null))[_0xc135('0x23')](removeEntity(_0x4618e6,null))[_0xc135('0x40')](handleError(_0x4618e6,null));};exports[_0xc135('0x48')]=function(_0x237970,_0x3ba543,_0x35e076){var _0x82f719={};var _0x32e5ed={};var _0x4238fd;var _0x2350f2;return db[_0xc135('0x2a')][_0xc135('0x49')]({'where':{'id':_0x237970['params']['id']}})[_0xc135('0x23')](handleEntityNotFound(_0x3ba543,null))['then'](function(_0x2c2b85){if(_0x2c2b85){_0x4238fd=_0x2c2b85;_0x32e5ed[_0xc135('0x2d')]=_[_0xc135('0x2f')](db['SalesforceField']['rawAttributes']);_0x32e5ed[_0xc135('0x2e')]=_[_0xc135('0x2f')](_0x237970[_0xc135('0x2e')]);_0x32e5ed['filters']=_[_0xc135('0x32')](_0x32e5ed[_0xc135('0x2d')],_0x32e5ed['query']);_0x82f719[_0xc135('0x31')]=_['intersection'](_0x32e5ed[_0xc135('0x2d')],qs[_0xc135('0x33')](_0x237970[_0xc135('0x2e')]['fields']));_0x82f719[_0xc135('0x31')]=_0x82f719[_0xc135('0x31')]['length']?_0x82f719[_0xc135('0x31')]:_0x32e5ed['model'];_0x82f719['order']=qs[_0xc135('0x36')](_0x237970[_0xc135('0x2e')][_0xc135('0x36')]);_0x82f719['where']=qs[_0xc135('0x30')](_['pick'](_0x237970[_0xc135('0x2e')],_0x32e5ed['filters']));if(_0x237970[_0xc135('0x2e')]['filter']){_0x82f719[_0xc135('0x37')]=_['merge'](_0x82f719[_0xc135('0x37')],{'$or':_[_0xc135('0x29')](_0x82f719[_0xc135('0x31')],function(_0x3f4601){var _0x8a7139={};_0x8a7139[_0x3f4601]={'$like':'%'+_0x237970['query'][_0xc135('0x38')]+'%'};return _0x8a7139;})});}_0x82f719=_[_0xc135('0x39')]({},_0x82f719,_0x237970[_0xc135('0x3b')]);return _0x4238fd[_0xc135('0x48')](_0x82f719);}})['then'](function(_0x160c74){if(_0x160c74){_0x2350f2=_0x160c74[_0xc135('0x43')];if(!_0x237970[_0xc135('0x2e')]['hasOwnProperty'](_0xc135('0x34'))){_0x82f719['limit']=qs['limit'](_0x237970['query'][_0xc135('0x1d')]);_0x82f719[_0xc135('0x1b')]=qs[_0xc135('0x1b')](_0x237970['query'][_0xc135('0x1b')]);}return _0x4238fd['getFields'](_0x82f719);}})['then'](function(_0x3638e0){if(_0x3638e0){return _0x3638e0?{'count':_0x2350f2,'rows':_0x3638e0}:null;}})[_0xc135('0x23')](respondWithResult(_0x3ba543,null))[_0xc135('0x40')](handleError(_0x3ba543,null));};exports[_0xc135('0x4a')]=function(_0x7c2571,_0x98906d,_0x512eca){var _0x44cd5a={};var _0x2572bf={};var _0x26f97f;var _0x149d2e;return db[_0xc135('0x2a')][_0xc135('0x49')]({'where':{'id':_0x7c2571[_0xc135('0x47')]['id']}})[_0xc135('0x23')](handleEntityNotFound(_0x98906d,null))[_0xc135('0x23')](function(_0x1d24d4){if(_0x1d24d4){_0x26f97f=_0x1d24d4;_0x2572bf[_0xc135('0x2d')]=_['keys'](db[_0xc135('0x4b')][_0xc135('0x42')]);_0x2572bf[_0xc135('0x2e')]=_[_0xc135('0x2f')](_0x7c2571[_0xc135('0x2e')]);_0x2572bf[_0xc135('0x30')]=_[_0xc135('0x32')](_0x2572bf[_0xc135('0x2d')],_0x2572bf['query']);_0x44cd5a[_0xc135('0x31')]=_[_0xc135('0x32')](_0x2572bf[_0xc135('0x2d')],qs[_0xc135('0x33')](_0x7c2571[_0xc135('0x2e')][_0xc135('0x33')]));_0x44cd5a[_0xc135('0x31')]=_0x44cd5a[_0xc135('0x31')][_0xc135('0x43')]?_0x44cd5a[_0xc135('0x31')]:_0x2572bf[_0xc135('0x2d')];_0x44cd5a[_0xc135('0x35')]=qs[_0xc135('0x36')](_0x7c2571[_0xc135('0x2e')][_0xc135('0x36')]);_0x44cd5a[_0xc135('0x37')]=qs[_0xc135('0x30')](_['pick'](_0x7c2571[_0xc135('0x2e')],_0x2572bf['filters']));if(_0x7c2571[_0xc135('0x2e')][_0xc135('0x38')]){_0x44cd5a['where']=_[_0xc135('0x39')](_0x44cd5a['where'],{'$or':_[_0xc135('0x29')](_0x44cd5a[_0xc135('0x31')],function(_0x10702c){var _0x30997c={};_0x30997c[_0x10702c]={'$like':'%'+_0x7c2571[_0xc135('0x2e')][_0xc135('0x38')]+'%'};return _0x30997c;})});}_0x44cd5a=_[_0xc135('0x39')]({},_0x44cd5a,_0x7c2571[_0xc135('0x3b')]);return _0x26f97f['getSubjects'](_0x44cd5a);}})['then'](function(_0x440d62){if(_0x440d62){_0x149d2e=_0x440d62[_0xc135('0x43')];if(!_0x7c2571[_0xc135('0x2e')][_0xc135('0x4c')](_0xc135('0x34'))){_0x44cd5a[_0xc135('0x1d')]=qs['limit'](_0x7c2571[_0xc135('0x2e')][_0xc135('0x1d')]);_0x44cd5a[_0xc135('0x1b')]=qs['offset'](_0x7c2571[_0xc135('0x2e')][_0xc135('0x1b')]);}return _0x26f97f[_0xc135('0x4a')](_0x44cd5a);}})['then'](function(_0x393406){if(_0x393406){return _0x393406?{'count':_0x149d2e,'rows':_0x393406}:null;}})[_0xc135('0x23')](respondWithResult(_0x98906d,null))['catch'](handleError(_0x98906d,null));};exports[_0xc135('0x4d')]=function(_0x15116b,_0x37f9df,_0x20ae5c){var _0x5cdb51={};var _0x4b5110={};var _0x1783a9;var _0x53db47;return db[_0xc135('0x2a')][_0xc135('0x49')]({'where':{'id':_0x15116b[_0xc135('0x47')]['id']}})[_0xc135('0x23')](handleEntityNotFound(_0x37f9df,null))[_0xc135('0x23')](function(_0x5b0afc){if(_0x5b0afc){_0x1783a9=_0x5b0afc;_0x4b5110[_0xc135('0x2d')]=_['keys'](db[_0xc135('0x4b')][_0xc135('0x42')]);_0x4b5110[_0xc135('0x2e')]=_['keys'](_0x15116b['query']);_0x4b5110[_0xc135('0x30')]=_[_0xc135('0x32')](_0x4b5110[_0xc135('0x2d')],_0x4b5110[_0xc135('0x2e')]);_0x5cdb51['attributes']=_[_0xc135('0x32')](_0x4b5110[_0xc135('0x2d')],qs[_0xc135('0x33')](_0x15116b[_0xc135('0x2e')][_0xc135('0x33')]));_0x5cdb51['attributes']=_0x5cdb51[_0xc135('0x31')][_0xc135('0x43')]?_0x5cdb51['attributes']:_0x4b5110['model'];_0x5cdb51[_0xc135('0x35')]=qs[_0xc135('0x36')](_0x15116b[_0xc135('0x2e')][_0xc135('0x36')]);_0x5cdb51[_0xc135('0x37')]=qs[_0xc135('0x30')](_[_0xc135('0x4e')](_0x15116b[_0xc135('0x2e')],_0x4b5110['filters']));if(_0x15116b[_0xc135('0x2e')][_0xc135('0x38')]){_0x5cdb51[_0xc135('0x37')]=_[_0xc135('0x39')](_0x5cdb51[_0xc135('0x37')],{'$or':_['map'](_0x5cdb51[_0xc135('0x31')],function(_0x4fd2eb){var _0x3d27ac={};_0x3d27ac[_0x4fd2eb]={'$like':'%'+_0x15116b['query']['filter']+'%'};return _0x3d27ac;})});}_0x5cdb51=_[_0xc135('0x39')]({},_0x5cdb51,_0x15116b['options']);return _0x1783a9[_0xc135('0x4d')](_0x5cdb51);}})[_0xc135('0x23')](function(_0x173c37){if(_0x173c37){_0x53db47=_0x173c37[_0xc135('0x43')];if(!_0x15116b['query']['hasOwnProperty'](_0xc135('0x34'))){_0x5cdb51[_0xc135('0x1d')]=qs[_0xc135('0x1d')](_0x15116b[_0xc135('0x2e')][_0xc135('0x1d')]);_0x5cdb51[_0xc135('0x1b')]=qs[_0xc135('0x1b')](_0x15116b[_0xc135('0x2e')][_0xc135('0x1b')]);}return _0x1783a9[_0xc135('0x4d')](_0x5cdb51);}})[_0xc135('0x23')](function(_0x57a580){if(_0x57a580){return _0x57a580?{'count':_0x53db47,'rows':_0x57a580}:null;}})[_0xc135('0x23')](respondWithResult(_0x37f9df,null))[_0xc135('0x40')](handleError(_0x37f9df,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 7deef56..892c94b 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 _0x68f6=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intSalesforceConfiguration.attributes','exports','define','lodash','util'];(function(_0x551360,_0x3f4dd8){var _0x4cea83=function(_0x50d26e){while(--_0x50d26e){_0x551360['push'](_0x551360['shift']());}};_0x4cea83(++_0x3f4dd8);}(_0x68f6,0x18a));var _0x668f=function(_0x366ac7,_0x3c3744){_0x366ac7=_0x366ac7-0x0;var _0x4fd0d0=_0x68f6[_0x366ac7];return _0x4fd0d0;};'use strict';var _=require(_0x668f('0x0'));var util=require(_0x668f('0x1'));var logger=require(_0x668f('0x2'))(_0x668f('0x3'));var moment=require(_0x668f('0x4'));var BPromise=require(_0x668f('0x5'));var rp=require(_0x668f('0x6'));var fs=require('fs');var path=require(_0x668f('0x7'));var rimraf=require('rimraf');var config=require(_0x668f('0x8'));var attributes=require(_0x668f('0x9'));module[_0x668f('0xa')]=function(_0x4db70f,_0x356ab8){return _0x4db70f[_0x668f('0xb')]('SalesforceConfiguration',attributes,{'tableName':'int_salesforce_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0594=['define','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0594,0xeb));var _0x4059=function(_0x2325c0,_0x5929c5){_0x2325c0=_0x2325c0-0x0;var _0x1c7b40=_0x0594[_0x2325c0];return _0x1c7b40;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4059('0x0'))(_0x4059('0x1'));var moment=require(_0x4059('0x2'));var BPromise=require(_0x4059('0x3'));var rp=require(_0x4059('0x4'));var fs=require('fs');var path=require(_0x4059('0x5'));var rimraf=require(_0x4059('0x6'));var config=require('../../config/environment');var attributes=require('./intSalesforceConfiguration.attributes');module[_0x4059('0x7')]=function(_0x2b00bd,_0x2f5318){return _0x2b00bd[_0x4059('0x8')]('SalesforceConfiguration',attributes,{'tableName':'int_salesforce_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js index 7233a69..3724a9e 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 _0xcb3d=['randomstring','../../config/utils','rpc','../../config/environment','client','http','request','then','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','catch','util','moment','bluebird'];(function(_0x55a4a5,_0x2cd7ab){var _0x57d590=function(_0x14b270){while(--_0x14b270){_0x55a4a5['push'](_0x55a4a5['shift']());}};_0x57d590(++_0x2cd7ab);}(_0xcb3d,0x1c5));var _0xdcb3=function(_0xc655ad,_0xf05e9b){_0xc655ad=_0xc655ad-0x0;var _0x293bd5=_0xcb3d[_0xc655ad];return _0x293bd5;};'use strict';var _=require('lodash');var util=require(_0xdcb3('0x0'));var moment=require(_0xdcb3('0x1'));var BPromise=require(_0xdcb3('0x2'));var rs=require(_0xdcb3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xdcb3('0x4'));var logger=require('../../config/logger')(_0xdcb3('0x5'));var config=require(_0xdcb3('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xdcb3('0x7')][_0xdcb3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x30a80f,_0x32f1b4,_0x2dfa7a){return new BPromise(function(_0x4c555e,_0x471e00){return client[_0xdcb3('0x9')](_0x30a80f,_0x2dfa7a)[_0xdcb3('0xa')](function(_0x5729bd){logger['info'](_0xdcb3('0xb'),_0x32f1b4,_0xdcb3('0xc'));logger[_0xdcb3('0xd')]('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x32f1b4,'request\x20sent',JSON[_0xdcb3('0xe')](_0x5729bd));if(_0x5729bd[_0xdcb3('0xf')]){if(_0x5729bd[_0xdcb3('0xf')]['code']===0x1f4){logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x32f1b4,_0x5729bd[_0xdcb3('0xf')][_0xdcb3('0x10')]);return _0x471e00(_0x5729bd[_0xdcb3('0xf')]['message']);}logger[_0xdcb3('0xf')](_0xdcb3('0xb'),_0x32f1b4,_0x5729bd[_0xdcb3('0xf')][_0xdcb3('0x10')]);return _0x4c555e(_0x5729bd[_0xdcb3('0xf')][_0xdcb3('0x10')]);}else{logger[_0xdcb3('0x11')](_0xdcb3('0xb'),_0x32f1b4,_0xdcb3('0xc'));_0x4c555e(_0x5729bd['result'][_0xdcb3('0x10')]);}})[_0xdcb3('0x12')](function(_0x206add){logger['error'](_0xdcb3('0xb'),_0x32f1b4,_0x206add);_0x471e00(_0x206add);});});} \ No newline at end of file +var _0xd551=['jayson/promise','client','http','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x580a10,_0x48e5d4){var _0x476b81=function(_0x126766){while(--_0x126766){_0x580a10['push'](_0x580a10['shift']());}};_0x476b81(++_0x48e5d4);}(_0xd551,0x65));var _0x1d55=function(_0x34ad09,_0xba8f16){_0x34ad09=_0x34ad09-0x0;var _0x4c8431=_0xd551[_0x34ad09];return _0x4c8431;};'use strict';var _=require('lodash');var util=require(_0x1d55('0x0'));var moment=require(_0x1d55('0x1'));var BPromise=require(_0x1d55('0x2'));var rs=require(_0x1d55('0x3'));var fs=require('fs');var Redis=require(_0x1d55('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1d55('0x5'));var logger=require(_0x1d55('0x6'))(_0x1d55('0x7'));var config=require(_0x1d55('0x8'));var jayson=require(_0x1d55('0x9'));var client=jayson[_0x1d55('0xa')][_0x1d55('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5c84ad,_0x26f547,_0x562762){return new BPromise(function(_0x524051,_0x20aac1){return client['request'](_0x5c84ad,_0x562762)['then'](function(_0x31ecab){logger[_0x1d55('0xc')](_0x1d55('0xd'),_0x26f547,_0x1d55('0xe'));logger[_0x1d55('0xf')](_0x1d55('0x10'),_0x26f547,_0x1d55('0xe'),JSON[_0x1d55('0x11')](_0x31ecab));if(_0x31ecab[_0x1d55('0x12')]){if(_0x31ecab['error'][_0x1d55('0x13')]===0x1f4){logger[_0x1d55('0x12')](_0x1d55('0xd'),_0x26f547,_0x31ecab[_0x1d55('0x12')]['message']);return _0x20aac1(_0x31ecab[_0x1d55('0x12')][_0x1d55('0x14')]);}logger[_0x1d55('0x12')](_0x1d55('0xd'),_0x26f547,_0x31ecab[_0x1d55('0x12')][_0x1d55('0x14')]);return _0x524051(_0x31ecab[_0x1d55('0x12')][_0x1d55('0x14')]);}else{logger[_0x1d55('0xc')](_0x1d55('0xd'),_0x26f547,_0x1d55('0xe'));_0x524051(_0x31ecab[_0x1d55('0x15')][_0x1d55('0x14')]);}})['catch'](function(_0x4352fb){logger[_0x1d55('0x12')]('SalesforceConfiguration,\x20%s,\x20%s',_0x26f547,_0x4352fb);_0x20aac1(_0x4352fb);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 74bca41..7829346 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 _0x54ab=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy','exports'];(function(_0x2e6c19,_0x131233){var _0x52885d=function(_0x38f224){while(--_0x38f224){_0x2e6c19['push'](_0x2e6c19['shift']());}};_0x52885d(++_0x131233);}(_0x54ab,0xab));var _0xb54a=function(_0x1d094c,_0x168326){_0x1d094c=_0x1d094c-0x0;var _0x1e6250=_0x54ab[_0x1d094c];return _0x1e6250;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb54a('0x0'));var timeout=require(_0xb54a('0x1'));var express=require('express');var router=express[_0xb54a('0x2')]();var fs_extra=require(_0xb54a('0x3'));var auth=require(_0xb54a('0x4'));var interaction=require(_0xb54a('0x5'));var config=require(_0xb54a('0x6'));var controller=require(_0xb54a('0x7'));router[_0xb54a('0x8')]('/',auth[_0xb54a('0x9')](),controller[_0xb54a('0xa')]);router[_0xb54a('0x8')](_0xb54a('0xb'),auth[_0xb54a('0x9')](),controller[_0xb54a('0xc')]);router[_0xb54a('0xd')]('/',auth[_0xb54a('0x9')](),controller[_0xb54a('0xe')]);router['put'](_0xb54a('0xb'),auth[_0xb54a('0x9')](),controller[_0xb54a('0xf')]);router[_0xb54a('0x10')](_0xb54a('0xb'),auth[_0xb54a('0x9')](),controller[_0xb54a('0x11')]);module[_0xb54a('0x12')]=router; \ No newline at end of file +var _0xb4dd=['../../components/interaction/service','../../config/environment','./intSalesforceField.controller','isAuthenticated','index','get','show','post','put','/:id','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra'];(function(_0x5b87ce,_0x20b7f6){var _0x597aa7=function(_0x295004){while(--_0x295004){_0x5b87ce['push'](_0x5b87ce['shift']());}};_0x597aa7(++_0x20b7f6);}(_0xb4dd,0x13d));var _0xdb4d=function(_0x1360de,_0x1ca32f){_0x1360de=_0x1360de-0x0;var _0x2517ec=_0xb4dd[_0x1360de];return _0x2517ec;};'use strict';var multer=require(_0xdb4d('0x0'));var util=require(_0xdb4d('0x1'));var path=require('path');var timeout=require(_0xdb4d('0x2'));var express=require(_0xdb4d('0x3'));var router=express[_0xdb4d('0x4')]();var fs_extra=require(_0xdb4d('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xdb4d('0x6'));var config=require(_0xdb4d('0x7'));var controller=require(_0xdb4d('0x8'));router['get']('/',auth[_0xdb4d('0x9')](),controller[_0xdb4d('0xa')]);router[_0xdb4d('0xb')]('/:id',auth[_0xdb4d('0x9')](),controller[_0xdb4d('0xc')]);router[_0xdb4d('0xd')]('/',auth[_0xdb4d('0x9')](),controller['create']);router[_0xdb4d('0xe')](_0xdb4d('0xf'),auth[_0xdb4d('0x9')](),controller['update']);router[_0xdb4d('0x10')](_0xdb4d('0xf'),auth['isAuthenticated'](),controller[_0xdb4d('0x11')]);module[_0xdb4d('0x12')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 40f3f40..1039742 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 _0x6a40=['STRING','customVariable','exports','ENUM','variable','keyValue','picklist','string'];(function(_0x18cd36,_0x1d102f){var _0x1158b8=function(_0x3f280f){while(--_0x3f280f){_0x18cd36['push'](_0x18cd36['shift']());}};_0x1158b8(++_0x1d102f);}(_0x6a40,0xf2));var _0x06a4=function(_0x23dea0,_0x9c4c3d){_0x23dea0=_0x23dea0-0x0;var _0x457f66=_0x6a40[_0x23dea0];return _0x457f66;};'use strict';var Sequelize=require('sequelize');module[_0x06a4('0x0')]={'type':{'type':Sequelize[_0x06a4('0x1')]('string',_0x06a4('0x2'),'customVariable',_0x06a4('0x3'),_0x06a4('0x4')),'defaultValue':_0x06a4('0x5')},'content':{'type':Sequelize[_0x06a4('0x6')]},'key':{'type':Sequelize[_0x06a4('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x06a4('0x5'),_0x06a4('0x2'),_0x06a4('0x7'))},'keyContent':{'type':Sequelize[_0x06a4('0x6')]},'idField':{'type':Sequelize[_0x06a4('0x6')]},'variableName':{'type':Sequelize[_0x06a4('0x6')]}}; \ No newline at end of file +var _0x72b5=['keyValue','picklist','string','STRING','customVariable','sequelize','ENUM','variable'];(function(_0x295fe9,_0x345828){var _0x3b80df=function(_0x85b4dc){while(--_0x85b4dc){_0x295fe9['push'](_0x295fe9['shift']());}};_0x3b80df(++_0x345828);}(_0x72b5,0x9d));var _0x572b=function(_0x1323fa,_0x193b8a){_0x1323fa=_0x1323fa-0x0;var _0x39b0e7=_0x72b5[_0x1323fa];return _0x39b0e7;};'use strict';var Sequelize=require(_0x572b('0x0'));module['exports']={'type':{'type':Sequelize[_0x572b('0x1')]('string',_0x572b('0x2'),'customVariable',_0x572b('0x3'),_0x572b('0x4')),'defaultValue':_0x572b('0x5')},'content':{'type':Sequelize[_0x572b('0x6')]},'key':{'type':Sequelize[_0x572b('0x6')]},'keyType':{'type':Sequelize[_0x572b('0x1')](_0x572b('0x5'),_0x572b('0x2'),_0x572b('0x7'))},'keyContent':{'type':Sequelize[_0x572b('0x6')]},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize[_0x572b('0x6')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index b17ade5..0e51a76 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 _0xd04d=['create','body','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','status','offset','limit','count','set','Content-Range','json','reject','update','then','destroy','error','name','send','SalesforceField','rawAttributes','type','key','model','map','filters','intersection','query','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','length','find'];(function(_0x1e3147,_0x58b414){var _0x3c6709=function(_0x2731af){while(--_0x2731af){_0x1e3147['push'](_0x1e3147['shift']());}};_0x3c6709(++_0x58b414);}(_0xd04d,0xda));var _0xdd04=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xd04d[_0xfae23b];return _0x200640;};'use strict';var emlformat=require(_0xdd04('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdd04('0x1'));var jsonpatch=require(_0xdd04('0x2'));var rp=require('request-promise');var moment=require(_0xdd04('0x3'));var BPromise=require(_0xdd04('0x4'));var Mustache=require(_0xdd04('0x5'));var util=require(_0xdd04('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xdd04('0x7'));var fs=require('fs');var fs_extra=require(_0xdd04('0x8'));var _=require('lodash');var squel=require(_0xdd04('0x9'));var crypto=require(_0xdd04('0xa'));var jsforce=require(_0xdd04('0xb'));var deskjs=require(_0xdd04('0xc'));var toCsv=require(_0xdd04('0xd'));var querystring=require(_0xdd04('0xe'));var Papa=require(_0xdd04('0xf'));var Redis=require(_0xdd04('0x10'));var authService=require(_0xdd04('0x11'));var qs=require(_0xdd04('0x12'));var as=require(_0xdd04('0x13'));var hardwareService=require(_0xdd04('0x14'));var logger=require(_0xdd04('0x15'))(_0xdd04('0x16'));var utils=require(_0xdd04('0x17'));var config=require(_0xdd04('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2204ce,_0x347cd4){_0x347cd4=_0x347cd4||0xcc;return function(_0x13ee35){if(_0x13ee35){return _0x2204ce[_0xdd04('0x19')](_0x347cd4);}return _0x2204ce['status'](_0x347cd4)[_0xdd04('0x1a')]();};}function respondWithResult(_0x59dbd5,_0x4ed5af){_0x4ed5af=_0x4ed5af||0xc8;return function(_0x5d8e49){if(_0x5d8e49){return _0x59dbd5[_0xdd04('0x1b')](_0x4ed5af)['json'](_0x5d8e49);}};}function respondWithFilteredResult(_0x1ce486,_0x57fde4){return function(_0x2202b8){if(_0x2202b8){var _0x1a3399=typeof _0x57fde4[_0xdd04('0x1c')]==='undefined'&&typeof _0x57fde4[_0xdd04('0x1d')]==='undefined';var _0x5d1a15=_0x2202b8[_0xdd04('0x1e')];var _0x150b75=_0x1a3399?0x0:_0x57fde4['offset'];var _0x3b2c9f=_0x1a3399?_0x2202b8['count']:_0x57fde4[_0xdd04('0x1c')]+_0x57fde4[_0xdd04('0x1d')];var _0x1f4645;if(_0x3b2c9f>=_0x5d1a15){_0x3b2c9f=_0x5d1a15;_0x1f4645=0xc8;}else{_0x1f4645=0xce;}_0x1ce486[_0xdd04('0x1b')](_0x1f4645);return _0x1ce486[_0xdd04('0x1f')](_0xdd04('0x20'),_0x150b75+'-'+_0x3b2c9f+'/'+_0x5d1a15)[_0xdd04('0x21')](_0x2202b8);}return null;};}function patchUpdates(_0x4f139c){return function(_0x7223ce){try{jsonpatch['apply'](_0x7223ce,_0x4f139c,!![]);}catch(_0x7e89a4){return BPromise[_0xdd04('0x22')](_0x7e89a4);}return _0x7223ce['save']();};}function saveUpdates(_0x40e344,_0x5d4741){return function(_0x2a3736){if(_0x2a3736){return _0x2a3736[_0xdd04('0x23')](_0x40e344)[_0xdd04('0x24')](function(_0x3d6dd8){return _0x3d6dd8;});}return null;};}function removeEntity(_0x5472b8,_0x57695e){return function(_0x128a2c){if(_0x128a2c){return _0x128a2c[_0xdd04('0x25')]()[_0xdd04('0x24')](function(){_0x5472b8[_0xdd04('0x1b')](0xcc)[_0xdd04('0x1a')]();});}};}function handleEntityNotFound(_0x3d14c7,_0x416511){return function(_0x5b4b97){if(!_0x5b4b97){_0x3d14c7[_0xdd04('0x19')](0x194);}return _0x5b4b97;};}function handleError(_0x36e5b6,_0x1132c9){_0x1132c9=_0x1132c9||0x1f4;return function(_0x194808){logger[_0xdd04('0x26')](_0x194808['stack']);if(_0x194808[_0xdd04('0x27')]){delete _0x194808[_0xdd04('0x27')];}_0x36e5b6[_0xdd04('0x1b')](_0x1132c9)[_0xdd04('0x28')](_0x194808);};}exports['index']=function(_0x37e665,_0x30fdd9){var _0x2fe3e2={},_0x106455={},_0x23d177={'count':0x0,'rows':[]};var _0x108d7d=_['map'](db[_0xdd04('0x29')][_0xdd04('0x2a')],function(_0x178683){return{'name':_0x178683['fieldName'],'type':_0x178683[_0xdd04('0x2b')][_0xdd04('0x2c')]};});_0x106455[_0xdd04('0x2d')]=_[_0xdd04('0x2e')](_0x108d7d,'name');_0x106455['query']=_['keys'](_0x37e665['query']);_0x106455[_0xdd04('0x2f')]=_[_0xdd04('0x30')](_0x106455['model'],_0x106455[_0xdd04('0x31')]);_0x2fe3e2['attributes']=_[_0xdd04('0x30')](_0x106455[_0xdd04('0x2d')],qs[_0xdd04('0x32')](_0x37e665[_0xdd04('0x31')][_0xdd04('0x32')]));_0x2fe3e2[_0xdd04('0x33')]=_0x2fe3e2[_0xdd04('0x33')]['length']?_0x2fe3e2[_0xdd04('0x33')]:_0x106455['model'];if(!_0x37e665[_0xdd04('0x31')][_0xdd04('0x34')](_0xdd04('0x35'))){_0x2fe3e2[_0xdd04('0x1d')]=qs[_0xdd04('0x1d')](_0x37e665[_0xdd04('0x31')][_0xdd04('0x1d')]);_0x2fe3e2[_0xdd04('0x1c')]=qs[_0xdd04('0x1c')](_0x37e665[_0xdd04('0x31')][_0xdd04('0x1c')]);}_0x2fe3e2[_0xdd04('0x36')]=qs[_0xdd04('0x37')](_0x37e665[_0xdd04('0x31')][_0xdd04('0x37')]);_0x2fe3e2[_0xdd04('0x38')]=qs['filters'](_['pick'](_0x37e665[_0xdd04('0x31')],_0x106455[_0xdd04('0x2f')]),_0x108d7d);if(_0x37e665['query'][_0xdd04('0x39')]){_0x2fe3e2[_0xdd04('0x38')]=_[_0xdd04('0x3a')](_0x2fe3e2[_0xdd04('0x38')],{'$or':_[_0xdd04('0x2e')](_0x108d7d,function(_0x1efca9){if(_0x1efca9[_0xdd04('0x2b')]!=='VIRTUAL'){var _0xda961f={};_0xda961f[_0x1efca9[_0xdd04('0x27')]]={'$like':'%'+_0x37e665['query'][_0xdd04('0x39')]+'%'};return _0xda961f;}})});}_0x2fe3e2=_[_0xdd04('0x3a')]({},_0x2fe3e2,_0x37e665[_0xdd04('0x3b')]);var _0x6e4686={'where':_0x2fe3e2[_0xdd04('0x38')]};return db[_0xdd04('0x29')][_0xdd04('0x1e')](_0x6e4686)['then'](function(_0x17e587){_0x23d177[_0xdd04('0x1e')]=_0x17e587;if(_0x37e665[_0xdd04('0x31')][_0xdd04('0x3c')]){_0x2fe3e2[_0xdd04('0x3d')]=[{'all':!![]}];}return db[_0xdd04('0x29')][_0xdd04('0x3e')](_0x2fe3e2);})['then'](function(_0x3e01a9){_0x23d177[_0xdd04('0x3f')]=_0x3e01a9;return _0x23d177;})[_0xdd04('0x24')](respondWithFilteredResult(_0x30fdd9,_0x2fe3e2))[_0xdd04('0x40')](handleError(_0x30fdd9,null));};exports[_0xdd04('0x41')]=function(_0x3f0b5a,_0x23580b){var _0x27b1b2={'raw':!![],'where':{'id':_0x3f0b5a[_0xdd04('0x42')]['id']}},_0x4d4b7c={};_0x4d4b7c[_0xdd04('0x2d')]=_[_0xdd04('0x43')](db['SalesforceField']['rawAttributes']);_0x4d4b7c[_0xdd04('0x31')]=_['keys'](_0x3f0b5a[_0xdd04('0x31')]);_0x4d4b7c[_0xdd04('0x2f')]=_[_0xdd04('0x30')](_0x4d4b7c[_0xdd04('0x2d')],_0x4d4b7c[_0xdd04('0x31')]);_0x27b1b2[_0xdd04('0x33')]=_[_0xdd04('0x30')](_0x4d4b7c[_0xdd04('0x2d')],qs[_0xdd04('0x32')](_0x3f0b5a[_0xdd04('0x31')][_0xdd04('0x32')]));_0x27b1b2['attributes']=_0x27b1b2[_0xdd04('0x33')][_0xdd04('0x44')]?_0x27b1b2[_0xdd04('0x33')]:_0x4d4b7c[_0xdd04('0x2d')];if(_0x3f0b5a['query'][_0xdd04('0x3c')]){_0x27b1b2[_0xdd04('0x3d')]=[{'all':!![]}];}_0x27b1b2=_[_0xdd04('0x3a')]({},_0x27b1b2,_0x3f0b5a[_0xdd04('0x3b')]);return db[_0xdd04('0x29')][_0xdd04('0x45')](_0x27b1b2)[_0xdd04('0x24')](handleEntityNotFound(_0x23580b,null))[_0xdd04('0x24')](respondWithResult(_0x23580b,null))[_0xdd04('0x40')](handleError(_0x23580b,null));};exports[_0xdd04('0x46')]=function(_0x13550e,_0x56fd35){return db[_0xdd04('0x29')]['create'](_0x13550e[_0xdd04('0x47')],{})[_0xdd04('0x24')](respondWithResult(_0x56fd35,0xc9))[_0xdd04('0x40')](handleError(_0x56fd35,null));};exports[_0xdd04('0x23')]=function(_0x48cf0a,_0x4f741d){if(_0x48cf0a['body']['id']){delete _0x48cf0a[_0xdd04('0x47')]['id'];}return db[_0xdd04('0x29')][_0xdd04('0x45')]({'where':{'id':_0x48cf0a['params']['id']}})[_0xdd04('0x24')](handleEntityNotFound(_0x4f741d,null))[_0xdd04('0x24')](saveUpdates(_0x48cf0a['body'],null))['then'](respondWithResult(_0x4f741d,null))['catch'](handleError(_0x4f741d,null));};exports[_0xdd04('0x25')]=function(_0x29093e,_0x35bed4){return db[_0xdd04('0x29')][_0xdd04('0x45')]({'where':{'id':_0x29093e[_0xdd04('0x42')]['id']}})[_0xdd04('0x24')](handleEntityNotFound(_0x35bed4,null))['then'](removeEntity(_0x35bed4,null))[_0xdd04('0x40')](handleError(_0x35bed4,null));}; \ No newline at end of file +var _0xd3db=['status','end','json','offset','undefined','limit','count','set','apply','then','destroy','sendStatus','stack','name','index','SalesforceField','rawAttributes','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','catch','show','params','include','find','create','body','update','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x770ffe,_0x441c78){var _0x27f062=function(_0x52da97){while(--_0x52da97){_0x770ffe['push'](_0x770ffe['shift']());}};_0x27f062(++_0x441c78);}(_0xd3db,0x1d4));var _0xbd3d=function(_0x126dca,_0x341c12){_0x126dca=_0x126dca-0x0;var _0x33db12=_0xd3db[_0x126dca];return _0x33db12;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbd3d('0x0'));var zipdir=require(_0xbd3d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xbd3d('0x2'));var BPromise=require(_0xbd3d('0x3'));var Mustache=require(_0xbd3d('0x4'));var util=require(_0xbd3d('0x5'));var path=require(_0xbd3d('0x6'));var sox=require(_0xbd3d('0x7'));var csv=require(_0xbd3d('0x8'));var ejs=require(_0xbd3d('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbd3d('0xa'));var squel=require(_0xbd3d('0xb'));var crypto=require(_0xbd3d('0xc'));var jsforce=require(_0xbd3d('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xbd3d('0x8'));var querystring=require('querystring');var Papa=require(_0xbd3d('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xbd3d('0xf'));var as=require(_0xbd3d('0x10'));var hardwareService=require(_0xbd3d('0x11'));var logger=require(_0xbd3d('0x12'))('api');var utils=require(_0xbd3d('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xbd3d('0x14'));var db=require(_0xbd3d('0x15'))['db'];function respondWithStatusCode(_0xf51fa9,_0x5ae367){_0x5ae367=_0x5ae367||0xcc;return function(_0x220c61){if(_0x220c61){return _0xf51fa9['sendStatus'](_0x5ae367);}return _0xf51fa9[_0xbd3d('0x16')](_0x5ae367)[_0xbd3d('0x17')]();};}function respondWithResult(_0x798a4e,_0x5f31b9){_0x5f31b9=_0x5f31b9||0xc8;return function(_0x1b381b){if(_0x1b381b){return _0x798a4e[_0xbd3d('0x16')](_0x5f31b9)[_0xbd3d('0x18')](_0x1b381b);}};}function respondWithFilteredResult(_0x34d627,_0x16e06c){return function(_0x117b79){if(_0x117b79){var _0x54bfac=typeof _0x16e06c[_0xbd3d('0x19')]===_0xbd3d('0x1a')&&typeof _0x16e06c[_0xbd3d('0x1b')]===_0xbd3d('0x1a');var _0x56df26=_0x117b79['count'];var _0x6b882a=_0x54bfac?0x0:_0x16e06c[_0xbd3d('0x19')];var _0x176fe5=_0x54bfac?_0x117b79[_0xbd3d('0x1c')]:_0x16e06c[_0xbd3d('0x19')]+_0x16e06c['limit'];var _0xafe96;if(_0x176fe5>=_0x56df26){_0x176fe5=_0x56df26;_0xafe96=0xc8;}else{_0xafe96=0xce;}_0x34d627['status'](_0xafe96);return _0x34d627[_0xbd3d('0x1d')]('Content-Range',_0x6b882a+'-'+_0x176fe5+'/'+_0x56df26)['json'](_0x117b79);}return null;};}function patchUpdates(_0x1ae51d){return function(_0x59bade){try{jsonpatch[_0xbd3d('0x1e')](_0x59bade,_0x1ae51d,!![]);}catch(_0x488f25){return BPromise['reject'](_0x488f25);}return _0x59bade['save']();};}function saveUpdates(_0x3f3df3,_0x1a735b){return function(_0x3e0db4){if(_0x3e0db4){return _0x3e0db4['update'](_0x3f3df3)[_0xbd3d('0x1f')](function(_0x4b3de3){return _0x4b3de3;});}return null;};}function removeEntity(_0x2ca9e8,_0x15f0c2){return function(_0x37be52){if(_0x37be52){return _0x37be52[_0xbd3d('0x20')]()[_0xbd3d('0x1f')](function(){_0x2ca9e8[_0xbd3d('0x16')](0xcc)[_0xbd3d('0x17')]();});}};}function handleEntityNotFound(_0x116901,_0x5752f8){return function(_0x189125){if(!_0x189125){_0x116901[_0xbd3d('0x21')](0x194);}return _0x189125;};}function handleError(_0x319c97,_0x164634){_0x164634=_0x164634||0x1f4;return function(_0xb5377e){logger['error'](_0xb5377e[_0xbd3d('0x22')]);if(_0xb5377e[_0xbd3d('0x23')]){delete _0xb5377e[_0xbd3d('0x23')];}_0x319c97[_0xbd3d('0x16')](_0x164634)['send'](_0xb5377e);};}exports[_0xbd3d('0x24')]=function(_0x4bc783,_0x30e853){var _0x151ed2={},_0x130f5d={},_0x453701={'count':0x0,'rows':[]};var _0x3ef9e8=_['map'](db[_0xbd3d('0x25')][_0xbd3d('0x26')],function(_0x5ca759){return{'name':_0x5ca759['fieldName'],'type':_0x5ca759[_0xbd3d('0x27')][_0xbd3d('0x28')]};});_0x130f5d[_0xbd3d('0x29')]=_[_0xbd3d('0x2a')](_0x3ef9e8,_0xbd3d('0x23'));_0x130f5d[_0xbd3d('0x2b')]=_[_0xbd3d('0x2c')](_0x4bc783[_0xbd3d('0x2b')]);_0x130f5d[_0xbd3d('0x2d')]=_['intersection'](_0x130f5d[_0xbd3d('0x29')],_0x130f5d['query']);_0x151ed2[_0xbd3d('0x2e')]=_[_0xbd3d('0x2f')](_0x130f5d[_0xbd3d('0x29')],qs[_0xbd3d('0x30')](_0x4bc783[_0xbd3d('0x2b')][_0xbd3d('0x30')]));_0x151ed2[_0xbd3d('0x2e')]=_0x151ed2['attributes'][_0xbd3d('0x31')]?_0x151ed2['attributes']:_0x130f5d[_0xbd3d('0x29')];if(!_0x4bc783[_0xbd3d('0x2b')][_0xbd3d('0x32')](_0xbd3d('0x33'))){_0x151ed2[_0xbd3d('0x1b')]=qs[_0xbd3d('0x1b')](_0x4bc783[_0xbd3d('0x2b')]['limit']);_0x151ed2['offset']=qs[_0xbd3d('0x19')](_0x4bc783[_0xbd3d('0x2b')][_0xbd3d('0x19')]);}_0x151ed2[_0xbd3d('0x34')]=qs[_0xbd3d('0x35')](_0x4bc783['query'][_0xbd3d('0x35')]);_0x151ed2[_0xbd3d('0x36')]=qs[_0xbd3d('0x2d')](_[_0xbd3d('0x37')](_0x4bc783[_0xbd3d('0x2b')],_0x130f5d[_0xbd3d('0x2d')]),_0x3ef9e8);if(_0x4bc783[_0xbd3d('0x2b')][_0xbd3d('0x38')]){_0x151ed2[_0xbd3d('0x36')]=_[_0xbd3d('0x39')](_0x151ed2[_0xbd3d('0x36')],{'$or':_[_0xbd3d('0x2a')](_0x3ef9e8,function(_0x16ee4d){if(_0x16ee4d[_0xbd3d('0x27')]!==_0xbd3d('0x3a')){var _0x614050={};_0x614050[_0x16ee4d['name']]={'$like':'%'+_0x4bc783[_0xbd3d('0x2b')]['filter']+'%'};return _0x614050;}})});}_0x151ed2=_['merge']({},_0x151ed2,_0x4bc783[_0xbd3d('0x3b')]);var _0xd0add6={'where':_0x151ed2['where']};return db[_0xbd3d('0x25')]['count'](_0xd0add6)[_0xbd3d('0x1f')](function(_0x38a625){_0x453701[_0xbd3d('0x1c')]=_0x38a625;if(_0x4bc783['query'][_0xbd3d('0x3c')]){_0x151ed2['include']=[{'all':!![]}];}return db['SalesforceField'][_0xbd3d('0x3d')](_0x151ed2);})['then'](function(_0x3d9989){_0x453701['rows']=_0x3d9989;return _0x453701;})[_0xbd3d('0x1f')](respondWithFilteredResult(_0x30e853,_0x151ed2))[_0xbd3d('0x3e')](handleError(_0x30e853,null));};exports[_0xbd3d('0x3f')]=function(_0x4d4c3b,_0x17482d){var _0x24d4b8={'raw':!![],'where':{'id':_0x4d4c3b[_0xbd3d('0x40')]['id']}},_0x322a74={};_0x322a74[_0xbd3d('0x29')]=_[_0xbd3d('0x2c')](db[_0xbd3d('0x25')][_0xbd3d('0x26')]);_0x322a74[_0xbd3d('0x2b')]=_[_0xbd3d('0x2c')](_0x4d4c3b[_0xbd3d('0x2b')]);_0x322a74[_0xbd3d('0x2d')]=_[_0xbd3d('0x2f')](_0x322a74['model'],_0x322a74[_0xbd3d('0x2b')]);_0x24d4b8[_0xbd3d('0x2e')]=_[_0xbd3d('0x2f')](_0x322a74[_0xbd3d('0x29')],qs[_0xbd3d('0x30')](_0x4d4c3b[_0xbd3d('0x2b')]['fields']));_0x24d4b8[_0xbd3d('0x2e')]=_0x24d4b8[_0xbd3d('0x2e')]['length']?_0x24d4b8[_0xbd3d('0x2e')]:_0x322a74['model'];if(_0x4d4c3b[_0xbd3d('0x2b')]['includeAll']){_0x24d4b8[_0xbd3d('0x41')]=[{'all':!![]}];}_0x24d4b8=_['merge']({},_0x24d4b8,_0x4d4c3b[_0xbd3d('0x3b')]);return db['SalesforceField'][_0xbd3d('0x42')](_0x24d4b8)[_0xbd3d('0x1f')](handleEntityNotFound(_0x17482d,null))['then'](respondWithResult(_0x17482d,null))[_0xbd3d('0x3e')](handleError(_0x17482d,null));};exports[_0xbd3d('0x43')]=function(_0x29b075,_0x1176a1){return db[_0xbd3d('0x25')][_0xbd3d('0x43')](_0x29b075[_0xbd3d('0x44')],{})[_0xbd3d('0x1f')](respondWithResult(_0x1176a1,0xc9))['catch'](handleError(_0x1176a1,null));};exports[_0xbd3d('0x45')]=function(_0x3e0a41,_0x566816){if(_0x3e0a41['body']['id']){delete _0x3e0a41[_0xbd3d('0x44')]['id'];}return db[_0xbd3d('0x25')]['find']({'where':{'id':_0x3e0a41['params']['id']}})[_0xbd3d('0x1f')](handleEntityNotFound(_0x566816,null))[_0xbd3d('0x1f')](saveUpdates(_0x3e0a41[_0xbd3d('0x44')],null))['then'](respondWithResult(_0x566816,null))['catch'](handleError(_0x566816,null));};exports[_0xbd3d('0x20')]=function(_0x1f875b,_0x44dfa4){return db[_0xbd3d('0x25')]['find']({'where':{'id':_0x1f875b[_0xbd3d('0x40')]['id']}})[_0xbd3d('0x1f')](handleEntityNotFound(_0x44dfa4,null))[_0xbd3d('0x1f')](removeEntity(_0x44dfa4,null))['catch'](handleError(_0x44dfa4,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 086a8ec..db00788 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 _0xaca0=['rimraf','../../config/environment','exports','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','FieldId','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x5774be,_0x2259d3){var _0x4914b4=function(_0x1eebc3){while(--_0x1eebc3){_0x5774be['push'](_0x5774be['shift']());}};_0x4914b4(++_0x2259d3);}(_0xaca0,0x1c8));var _0x0aca=function(_0x5ca0bc,_0x27d70e){_0x5ca0bc=_0x5ca0bc-0x0;var _0x456d4f=_0xaca0[_0x5ca0bc];return _0x456d4f;};'use strict';var _=require(_0x0aca('0x0'));var util=require(_0x0aca('0x1'));var logger=require(_0x0aca('0x2'))(_0x0aca('0x3'));var moment=require(_0x0aca('0x4'));var BPromise=require('bluebird');var rp=require(_0x0aca('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0aca('0x6'));var config=require(_0x0aca('0x7'));var attributes=require('./intSalesforceField.attributes');module[_0x0aca('0x8')]=function(_0x538402,_0x3e189a){return _0x538402[_0x0aca('0x9')](_0x0aca('0xa'),attributes,{'tableName':_0x0aca('0xb'),'paranoid':![],'indexes':[{'name':_0x0aca('0xc'),'fields':['idField',_0x0aca('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8233=['../../config/environment','./intSalesforceField.attributes','define','SalesforceField','idField','FieldId','../../config/logger','bluebird','request-promise','rimraf'];(function(_0x78f0bf,_0x4bec23){var _0x3ccc69=function(_0x2623c4){while(--_0x2623c4){_0x78f0bf['push'](_0x78f0bf['shift']());}};_0x3ccc69(++_0x4bec23);}(_0x8233,0x132));var _0x3823=function(_0x40e7aa,_0xb952d9){_0x40e7aa=_0x40e7aa-0x0;var _0x2dc873=_0x8233[_0x40e7aa];return _0x2dc873;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3823('0x0'))('api');var moment=require('moment');var BPromise=require(_0x3823('0x1'));var rp=require(_0x3823('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3823('0x3'));var config=require(_0x3823('0x4'));var attributes=require(_0x3823('0x5'));module['exports']=function(_0x117533,_0x5ef69c){return _0x117533[_0x3823('0x6')](_0x3823('0x7'),attributes,{'tableName':'int_salesforce_fields','paranoid':![],'indexes':[{'name':'salesforce_unique_index','fields':[_0x3823('0x8'),_0x3823('0x9')],'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 0a918be..b472285 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 _0x6050=['rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','SalesforceField,\x20%s,\x20%s','message','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x3439c7,_0x1af949){var _0x552961=function(_0x50c031){while(--_0x50c031){_0x3439c7['push'](_0x3439c7['shift']());}};_0x552961(++_0x1af949);}(_0x6050,0xbf));var _0x0605=function(_0xc87400,_0x27bb35){_0xc87400=_0xc87400-0x0;var _0x4ac9a4=_0x6050[_0xc87400];return _0x4ac9a4;};'use strict';var _=require(_0x0605('0x0'));var util=require(_0x0605('0x1'));var moment=require('moment');var BPromise=require(_0x0605('0x2'));var rs=require(_0x0605('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0605('0x4'))['db'];var utils=require(_0x0605('0x5'));var logger=require(_0x0605('0x6'))(_0x0605('0x7'));var config=require(_0x0605('0x8'));var jayson=require(_0x0605('0x9'));var client=jayson[_0x0605('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ccf6e,_0x1ad980,_0x257a59){return new BPromise(function(_0xd706f8,_0x417182){return client[_0x0605('0xb')](_0x4ccf6e,_0x257a59)[_0x0605('0xc')](function(_0x2ce900){logger[_0x0605('0xd')]('SalesforceField,\x20%s,\x20%s',_0x1ad980,_0x0605('0xe'));logger[_0x0605('0xf')](_0x0605('0x10'),_0x1ad980,_0x0605('0xe'),JSON[_0x0605('0x11')](_0x2ce900));if(_0x2ce900[_0x0605('0x12')]){if(_0x2ce900[_0x0605('0x12')][_0x0605('0x13')]===0x1f4){logger[_0x0605('0x12')](_0x0605('0x14'),_0x1ad980,_0x2ce900[_0x0605('0x12')]['message']);return _0x417182(_0x2ce900['error']['message']);}logger['error']('SalesforceField,\x20%s,\x20%s',_0x1ad980,_0x2ce900[_0x0605('0x12')][_0x0605('0x15')]);return _0xd706f8(_0x2ce900['error']['message']);}else{logger[_0x0605('0xd')](_0x0605('0x14'),_0x1ad980,'request\x20sent');_0xd706f8(_0x2ce900['result'][_0x0605('0x15')]);}})['catch'](function(_0x3e379c){logger[_0x0605('0x12')]('SalesforceField,\x20%s,\x20%s',_0x1ad980,_0x3e379c);_0x417182(_0x3e379c);});});} \ No newline at end of file +var _0x6c25=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x5d68ec,_0x4984cb){var _0x1d4a40=function(_0x2f2db6){while(--_0x2f2db6){_0x5d68ec['push'](_0x5d68ec['shift']());}};_0x1d4a40(++_0x4984cb);}(_0x6c25,0xd2));var _0x56c2=function(_0x3d0c89,_0x39a2fa){_0x3d0c89=_0x3d0c89-0x0;var _0xd17883=_0x6c25[_0x3d0c89];return _0xd17883;};'use strict';var _=require(_0x56c2('0x0'));var util=require(_0x56c2('0x1'));var moment=require('moment');var BPromise=require(_0x56c2('0x2'));var rs=require(_0x56c2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x56c2('0x4'))['db'];var utils=require(_0x56c2('0x5'));var logger=require(_0x56c2('0x6'))(_0x56c2('0x7'));var config=require(_0x56c2('0x8'));var jayson=require(_0x56c2('0x9'));var client=jayson[_0x56c2('0xa')][_0x56c2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4505ac,_0x8bbff,_0x3d94b2){return new BPromise(function(_0x6fdf6f,_0x5b5367){return client[_0x56c2('0xc')](_0x4505ac,_0x3d94b2)[_0x56c2('0xd')](function(_0x4a49df){logger[_0x56c2('0xe')](_0x56c2('0xf'),_0x8bbff,_0x56c2('0x10'));logger[_0x56c2('0x11')](_0x56c2('0x12'),_0x8bbff,_0x56c2('0x10'),JSON[_0x56c2('0x13')](_0x4a49df));if(_0x4a49df[_0x56c2('0x14')]){if(_0x4a49df[_0x56c2('0x14')][_0x56c2('0x15')]===0x1f4){logger[_0x56c2('0x14')](_0x56c2('0xf'),_0x8bbff,_0x4a49df[_0x56c2('0x14')]['message']);return _0x5b5367(_0x4a49df[_0x56c2('0x14')]['message']);}logger[_0x56c2('0x14')]('SalesforceField,\x20%s,\x20%s',_0x8bbff,_0x4a49df[_0x56c2('0x14')][_0x56c2('0x16')]);return _0x6fdf6f(_0x4a49df[_0x56c2('0x14')][_0x56c2('0x16')]);}else{logger[_0x56c2('0xe')](_0x56c2('0xf'),_0x8bbff,_0x56c2('0x10'));_0x6fdf6f(_0x4a49df[_0x56c2('0x17')][_0x56c2('0x16')]);}})['catch'](function(_0x3728a7){logger[_0x56c2('0x14')](_0x56c2('0xf'),_0x8bbff,_0x3728a7);_0x5b5367(_0x3728a7);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 48ea744..60ebf6d 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 _0x8728=['update','delete','/:id','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','index','show','getConfigurations','/:id/fields','getFields','post','/:id/configurations','addConfiguration','put'];(function(_0x32272e,_0xe0ca7b){var _0x4005dd=function(_0x2bd382){while(--_0x2bd382){_0x32272e['push'](_0x32272e['shift']());}};_0x4005dd(++_0xe0ca7b);}(_0x8728,0x14a));var _0x8872=function(_0x2a7272,_0x4d794c){_0x2a7272=_0x2a7272-0x0;var _0x13d9c6=_0x8728[_0x2a7272];return _0x13d9c6;};'use strict';var multer=require(_0x8872('0x0'));var util=require(_0x8872('0x1'));var path=require('path');var timeout=require(_0x8872('0x2'));var express=require('express');var router=express[_0x8872('0x3')]();var fs_extra=require(_0x8872('0x4'));var auth=require(_0x8872('0x5'));var interaction=require(_0x8872('0x6'));var config=require(_0x8872('0x7'));var controller=require(_0x8872('0x8'));router[_0x8872('0x9')]('/',auth[_0x8872('0xa')](),controller[_0x8872('0xb')]);router[_0x8872('0x9')]('/:id',auth[_0x8872('0xa')](),controller[_0x8872('0xc')]);router[_0x8872('0x9')]('/:id/configurations',auth[_0x8872('0xa')](),controller[_0x8872('0xd')]);router[_0x8872('0x9')](_0x8872('0xe'),auth[_0x8872('0xa')](),controller[_0x8872('0xf')]);router[_0x8872('0x10')]('/',auth[_0x8872('0xa')](),controller['create']);router[_0x8872('0x10')](_0x8872('0x11'),auth[_0x8872('0xa')](),controller[_0x8872('0x12')]);router[_0x8872('0x13')]('/:id',auth[_0x8872('0xa')](),controller[_0x8872('0x14')]);router[_0x8872('0x15')](_0x8872('0x16'),auth[_0x8872('0xa')](),controller[_0x8872('0x17')]);module[_0x8872('0x18')]=router; \ No newline at end of file +var _0xbdd7=['express','fs-extra','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','index','/:id','isAuthenticated','show','/:id/configurations','post','create','addConfiguration','put','update','destroy','multer','util','path'];(function(_0x1fb02e,_0x2db37a){var _0x9f7b68=function(_0x1548ae){while(--_0x1548ae){_0x1fb02e['push'](_0x1fb02e['shift']());}};_0x9f7b68(++_0x2db37a);}(_0xbdd7,0xed));var _0x7bdd=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xbdd7[_0x3947c9];return _0x2e7871;};'use strict';var multer=require(_0x7bdd('0x0'));var util=require(_0x7bdd('0x1'));var path=require(_0x7bdd('0x2'));var timeout=require('connect-timeout');var express=require(_0x7bdd('0x3'));var router=express['Router']();var fs_extra=require(_0x7bdd('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x7bdd('0x5'));var config=require(_0x7bdd('0x6'));var controller=require(_0x7bdd('0x7'));router[_0x7bdd('0x8')]('/',auth['isAuthenticated'](),controller[_0x7bdd('0x9')]);router[_0x7bdd('0x8')](_0x7bdd('0xa'),auth[_0x7bdd('0xb')](),controller[_0x7bdd('0xc')]);router[_0x7bdd('0x8')](_0x7bdd('0xd'),auth[_0x7bdd('0xb')](),controller['getConfigurations']);router['get']('/:id/fields',auth[_0x7bdd('0xb')](),controller['getFields']);router[_0x7bdd('0xe')]('/',auth[_0x7bdd('0xb')](),controller[_0x7bdd('0xf')]);router[_0x7bdd('0xe')](_0x7bdd('0xd'),auth[_0x7bdd('0xb')](),controller[_0x7bdd('0x10')]);router[_0x7bdd('0x11')](_0x7bdd('0xa'),auth[_0x7bdd('0xb')](),controller[_0x7bdd('0x12')]);router['delete'](_0x7bdd('0xa'),auth[_0x7bdd('0xb')](),controller[_0x7bdd('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 5a55a6e..0185148 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 _0x3867=['sequelize','STRING','remoteUri'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3867,0x198));var _0x7386=function(_0x2ca840,_0x9f3c7){_0x2ca840=_0x2ca840-0x0;var _0x181773=_0x3867[_0x2ca840];return _0x181773;};'use strict';var Sequelize=require(_0x7386('0x0'));module['exports']={'name':{'type':Sequelize[_0x7386('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x7386('0x1')],'unique':'username'},'password':{'type':Sequelize[_0x7386('0x1')]},'email':{'type':Sequelize[_0x7386('0x1')]},'remoteUri':{'type':Sequelize[_0x7386('0x1')],'unique':_0x7386('0x2')},'serverUrl':{'type':Sequelize[_0x7386('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x18cb=['username','remoteUri','sequelize','STRING'];(function(_0xe0648e,_0x5845f9){var _0x232e53=function(_0x1da32f){while(--_0x1da32f){_0xe0648e['push'](_0xe0648e['shift']());}};_0x232e53(++_0x5845f9);}(_0x18cb,0x176));var _0xb18c=function(_0x16d270,_0x324fdf){_0x16d270=_0x16d270-0x0;var _0x5867f7=_0x18cb[_0x16d270];return _0x5867f7;};'use strict';var Sequelize=require(_0xb18c('0x0'));module['exports']={'name':{'type':Sequelize[_0xb18c('0x1')]},'description':{'type':Sequelize[_0xb18c('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0xb18c('0x2')},'password':{'type':Sequelize[_0xb18c('0x1')]},'email':{'type':Sequelize[_0xb18c('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xb18c('0x3')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index dd5bcbe..a8d4e5c 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 _0x13f2=['incident_state','severity','category','parent','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','sys_updated_by','opened_by','user_input','sys_created_on','sys_domain','state','sys_created_by','calendar_stc','closed_at','cmdb_ci','delivery_plan','impact','active','work_notes_list','business_service','priority','sys_domain_path','rfc','time_worked','expected_start','opened_at','business_duration','group_list','work_end','reopened_time','resolved_at','caller_id','subcategory','work_notes','short_description','correlation_display','delivery_task','work_start','assignment_group','business_stc','additional_assignee_list','description','sys_class_name','parent_incident','contact_type','urgency','problem_id','company','activity_due','assigned_to','comments','sla_due','approval','due_date','sys_mod_count','reopen_count','sys_tags','escalation','upon_approval','correlation_id','location','password','email','remoteUri','slice','substring','%s/api/now/doc/table/schema/','username','incident?sysparm_display_value=all','result','incident\x20table\x20objects','assign','forEach','internalType','label','push','all','log','TCL:\x20_object','remove','includes','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','concat','ServiceNow\x20error:\x20','test','statusCode','boolean','True','true','false','GET','sys_choice?sysparm_query=name=incident^element=','inactive','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','set','apply','reject','save','update','then','destroy','error','stack','name','send','map','ServicenowAccount','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','keys','length','find','create','body','params','getConfigurations','findOne','pick','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ServicenowConfiguration','ServicenowField','made_sla','hold_reason','knowledge','close_code','notify'];(function(_0x2ab3e4,_0x113a6d){var _0x10d163=function(_0x3cd648){while(--_0x3cd648){_0x2ab3e4['push'](_0x2ab3e4['shift']());}};_0x10d163(++_0x113a6d);}(_0x13f2,0x1dd));var _0x213f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x13f2[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x213f('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x213f('0x1'));var rp=require('request-promise');var moment=require(_0x213f('0x2'));var BPromise=require(_0x213f('0x3'));var Mustache=require(_0x213f('0x4'));var util=require(_0x213f('0x5'));var path=require(_0x213f('0x6'));var sox=require(_0x213f('0x7'));var csv=require(_0x213f('0x8'));var ejs=require(_0x213f('0x9'));var fs=require('fs');var fs_extra=require(_0x213f('0xa'));var _=require(_0x213f('0xb'));var squel=require('squel');var crypto=require(_0x213f('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x213f('0x8'));var querystring=require('querystring');var Papa=require(_0x213f('0xd'));var Redis=require(_0x213f('0xe'));var authService=require(_0x213f('0xf'));var qs=require(_0x213f('0x10'));var as=require(_0x213f('0x11'));var hardwareService=require(_0x213f('0x12'));var logger=require(_0x213f('0x13'))(_0x213f('0x14'));var utils=require('../../config/utils');var config=require(_0x213f('0x15'));var licenseUtil=require(_0x213f('0x16'));var db=require(_0x213f('0x17'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x3f74c6,_0x435c45){_0x435c45=_0x435c45||0xcc;return function(_0x710156){if(_0x710156){return _0x3f74c6[_0x213f('0x18')](_0x435c45);}return _0x3f74c6[_0x213f('0x19')](_0x435c45)[_0x213f('0x1a')]();};}function respondWithResult(_0x210075,_0x5418a3){_0x5418a3=_0x5418a3||0xc8;return function(_0x2cda86){if(_0x2cda86){return _0x210075[_0x213f('0x19')](_0x5418a3)[_0x213f('0x1b')](_0x2cda86);}};}function respondWithFilteredResult(_0x122487,_0x50dc6a){return function(_0xd96169){if(_0xd96169){var _0x36e25a=typeof _0x50dc6a['offset']===_0x213f('0x1c')&&typeof _0x50dc6a['limit']===_0x213f('0x1c');var _0x59acfb=_0xd96169[_0x213f('0x1d')];var _0x122e8f=_0x36e25a?0x0:_0x50dc6a[_0x213f('0x1e')];var _0x39f4b6=_0x36e25a?_0xd96169[_0x213f('0x1d')]:_0x50dc6a[_0x213f('0x1e')]+_0x50dc6a['limit'];var _0x784969;if(_0x39f4b6>=_0x59acfb){_0x39f4b6=_0x59acfb;_0x784969=0xc8;}else{_0x784969=0xce;}_0x122487[_0x213f('0x19')](_0x784969);return _0x122487[_0x213f('0x1f')]('Content-Range',_0x122e8f+'-'+_0x39f4b6+'/'+_0x59acfb)['json'](_0xd96169);}return null;};}function patchUpdates(_0x511689){return function(_0x28cc6e){try{jsonpatch[_0x213f('0x20')](_0x28cc6e,_0x511689,!![]);}catch(_0x19e55c){return BPromise[_0x213f('0x21')](_0x19e55c);}return _0x28cc6e[_0x213f('0x22')]();};}function saveUpdates(_0x22f9af,_0x137d3e){return function(_0x142537){if(_0x142537){return _0x142537[_0x213f('0x23')](_0x22f9af)[_0x213f('0x24')](function(_0x26fccb){return _0x26fccb;});}return null;};}function removeEntity(_0x5d0ed1,_0x363ea0){return function(_0x5cd3d6){if(_0x5cd3d6){return _0x5cd3d6[_0x213f('0x25')]()[_0x213f('0x24')](function(){_0x5d0ed1[_0x213f('0x19')](0xcc)[_0x213f('0x1a')]();});}};}function handleEntityNotFound(_0x3142db,_0x2a5f5f){return function(_0x481e13){if(!_0x481e13){_0x3142db['sendStatus'](0x194);}return _0x481e13;};}function handleError(_0x53d02a,_0x29d563){_0x29d563=_0x29d563||0x1f4;return function(_0x286a9e){logger[_0x213f('0x26')](_0x286a9e[_0x213f('0x27')]);if(_0x286a9e['name']){delete _0x286a9e[_0x213f('0x28')];}_0x53d02a[_0x213f('0x19')](_0x29d563)[_0x213f('0x29')](_0x286a9e);};}exports['index']=function(_0x524e54,_0x4aec2){var _0x54993a={},_0x4d1ae3={},_0x61f107={'count':0x0,'rows':[]};var _0x3a0ae5=_[_0x213f('0x2a')](db[_0x213f('0x2b')][_0x213f('0x2c')],function(_0x5a5957){return{'name':_0x5a5957[_0x213f('0x2d')],'type':_0x5a5957[_0x213f('0x2e')][_0x213f('0x2f')]};});_0x4d1ae3[_0x213f('0x30')]=_[_0x213f('0x2a')](_0x3a0ae5,'name');_0x4d1ae3[_0x213f('0x31')]=_['keys'](_0x524e54['query']);_0x4d1ae3[_0x213f('0x32')]=_['intersection'](_0x4d1ae3['model'],_0x4d1ae3[_0x213f('0x31')]);_0x54993a[_0x213f('0x33')]=_[_0x213f('0x34')](_0x4d1ae3[_0x213f('0x30')],qs[_0x213f('0x35')](_0x524e54[_0x213f('0x31')][_0x213f('0x35')]));_0x54993a[_0x213f('0x33')]=_0x54993a[_0x213f('0x33')]['length']?_0x54993a[_0x213f('0x33')]:_0x4d1ae3[_0x213f('0x30')];if(!_0x524e54[_0x213f('0x31')][_0x213f('0x36')](_0x213f('0x37'))){_0x54993a[_0x213f('0x38')]=qs[_0x213f('0x38')](_0x524e54[_0x213f('0x31')]['limit']);_0x54993a[_0x213f('0x1e')]=qs[_0x213f('0x1e')](_0x524e54[_0x213f('0x31')][_0x213f('0x1e')]);}_0x54993a[_0x213f('0x39')]=qs[_0x213f('0x3a')](_0x524e54[_0x213f('0x31')]['sort']);_0x54993a[_0x213f('0x3b')]=qs['filters'](_['pick'](_0x524e54['query'],_0x4d1ae3[_0x213f('0x32')]),_0x3a0ae5);if(_0x524e54['query'][_0x213f('0x3c')]){_0x54993a[_0x213f('0x3b')]=_[_0x213f('0x3d')](_0x54993a[_0x213f('0x3b')],{'$or':_[_0x213f('0x2a')](_0x3a0ae5,function(_0x2e3b50){if(_0x2e3b50[_0x213f('0x2e')]!==_0x213f('0x3e')){var _0x18ba0f={};_0x18ba0f[_0x2e3b50['name']]={'$like':'%'+_0x524e54[_0x213f('0x31')]['filter']+'%'};return _0x18ba0f;}})});}_0x54993a=_[_0x213f('0x3d')]({},_0x54993a,_0x524e54[_0x213f('0x3f')]);var _0x2671f3={'where':_0x54993a[_0x213f('0x3b')]};return db[_0x213f('0x2b')]['count'](_0x2671f3)[_0x213f('0x24')](function(_0x1d2450){_0x61f107['count']=_0x1d2450;if(_0x524e54[_0x213f('0x31')][_0x213f('0x40')]){_0x54993a[_0x213f('0x41')]=[{'all':!![]}];}return db[_0x213f('0x2b')][_0x213f('0x42')](_0x54993a);})[_0x213f('0x24')](function(_0x3febee){_0x61f107[_0x213f('0x43')]=_0x3febee;return _0x61f107;})['then'](respondWithFilteredResult(_0x4aec2,_0x54993a))[_0x213f('0x44')](handleError(_0x4aec2,null));};exports[_0x213f('0x45')]=function(_0x3a24a6,_0x174d9a){var _0x5e501d={'raw':![],'where':{'id':_0x3a24a6['params']['id']}},_0x1f2795={};_0x1f2795[_0x213f('0x30')]=_[_0x213f('0x46')](db[_0x213f('0x2b')]['rawAttributes']);_0x1f2795['query']=_['keys'](_0x3a24a6['query']);_0x1f2795[_0x213f('0x32')]=_['intersection'](_0x1f2795['model'],_0x1f2795[_0x213f('0x31')]);_0x5e501d[_0x213f('0x33')]=_[_0x213f('0x34')](_0x1f2795[_0x213f('0x30')],qs[_0x213f('0x35')](_0x3a24a6['query'][_0x213f('0x35')]));_0x5e501d['attributes']=_0x5e501d[_0x213f('0x33')][_0x213f('0x47')]?_0x5e501d[_0x213f('0x33')]:_0x1f2795[_0x213f('0x30')];if(_0x3a24a6[_0x213f('0x31')][_0x213f('0x40')]){_0x5e501d['include']=[{'all':!![]}];}_0x5e501d=_[_0x213f('0x3d')]({},_0x5e501d,_0x3a24a6[_0x213f('0x3f')]);return db[_0x213f('0x2b')][_0x213f('0x48')](_0x5e501d)[_0x213f('0x24')](handleEntityNotFound(_0x174d9a,null))[_0x213f('0x24')](respondWithResult(_0x174d9a,null))[_0x213f('0x44')](handleError(_0x174d9a,null));};exports[_0x213f('0x49')]=function(_0x10dee6,_0x49faf2){return db['ServicenowAccount'][_0x213f('0x49')](_0x10dee6['body'],{})[_0x213f('0x24')](respondWithResult(_0x49faf2,0xc9))[_0x213f('0x44')](handleError(_0x49faf2,null));};exports['update']=function(_0x234e6c,_0x4817f5){if(_0x234e6c[_0x213f('0x4a')]['id']){delete _0x234e6c[_0x213f('0x4a')]['id'];}return db[_0x213f('0x2b')][_0x213f('0x48')]({'where':{'id':_0x234e6c[_0x213f('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4817f5,null))[_0x213f('0x24')](saveUpdates(_0x234e6c[_0x213f('0x4a')],null))[_0x213f('0x24')](respondWithResult(_0x4817f5,null))[_0x213f('0x44')](handleError(_0x4817f5,null));};exports[_0x213f('0x25')]=function(_0x5dbf35,_0x5ae87d){return db[_0x213f('0x2b')][_0x213f('0x48')]({'where':{'id':_0x5dbf35['params']['id']}})[_0x213f('0x24')](handleEntityNotFound(_0x5ae87d,null))[_0x213f('0x24')](removeEntity(_0x5ae87d,null))[_0x213f('0x44')](handleError(_0x5ae87d,null));};exports[_0x213f('0x4c')]=function(_0x54315b,_0x2230e1,_0x2417eb){var _0x2761d7={};var _0x2017ac={};var _0x46eeb3;var _0x2defd7;return db[_0x213f('0x2b')][_0x213f('0x4d')]({'where':{'id':_0x54315b[_0x213f('0x4b')]['id']}})[_0x213f('0x24')](handleEntityNotFound(_0x2230e1,null))[_0x213f('0x24')](function(_0xd8f22b){if(_0xd8f22b){_0x46eeb3=_0xd8f22b;_0x2017ac[_0x213f('0x30')]=_[_0x213f('0x46')](db['ServicenowConfiguration'][_0x213f('0x2c')]);_0x2017ac[_0x213f('0x31')]=_['keys'](_0x54315b[_0x213f('0x31')]);_0x2017ac['filters']=_[_0x213f('0x34')](_0x2017ac[_0x213f('0x30')],_0x2017ac['query']);_0x2761d7[_0x213f('0x33')]=_['intersection'](_0x2017ac[_0x213f('0x30')],qs['fields'](_0x54315b['query'][_0x213f('0x35')]));_0x2761d7[_0x213f('0x33')]=_0x2761d7[_0x213f('0x33')][_0x213f('0x47')]?_0x2761d7[_0x213f('0x33')]:_0x2017ac[_0x213f('0x30')];_0x2761d7[_0x213f('0x39')]=qs['sort'](_0x54315b[_0x213f('0x31')][_0x213f('0x3a')]);_0x2761d7[_0x213f('0x3b')]=qs[_0x213f('0x32')](_[_0x213f('0x4e')](_0x54315b['query'],_0x2017ac['filters']));if(_0x54315b[_0x213f('0x31')][_0x213f('0x3c')]){_0x2761d7['where']=_[_0x213f('0x3d')](_0x2761d7['where'],{'$or':_[_0x213f('0x2a')](_0x2761d7[_0x213f('0x33')],function(_0x5c8e0f){var _0x1ad26d={};_0x1ad26d[_0x5c8e0f]={'$like':'%'+_0x54315b['query'][_0x213f('0x3c')]+'%'};return _0x1ad26d;})});}_0x2761d7=_[_0x213f('0x3d')]({},_0x2761d7,_0x54315b[_0x213f('0x3f')]);return _0x46eeb3[_0x213f('0x4c')](_0x2761d7);}})[_0x213f('0x24')](function(_0x5a4775){if(_0x5a4775){_0x2defd7=_0x5a4775['length'];if(!_0x54315b[_0x213f('0x31')][_0x213f('0x36')]('nolimit')){_0x2761d7['limit']=qs[_0x213f('0x38')](_0x54315b[_0x213f('0x31')]['limit']);_0x2761d7[_0x213f('0x1e')]=qs[_0x213f('0x1e')](_0x54315b[_0x213f('0x31')][_0x213f('0x1e')]);}return _0x46eeb3[_0x213f('0x4c')](_0x2761d7);}})[_0x213f('0x24')](function(_0x5b63cb){if(_0x5b63cb){return _0x5b63cb?{'count':_0x2defd7,'rows':_0x5b63cb}:null;}})[_0x213f('0x24')](respondWithResult(_0x2230e1,null))[_0x213f('0x44')](handleError(_0x2230e1,null));};exports[_0x213f('0x4f')]=function(_0x56d4b3,_0x44f650,_0x5638c7){if(_0x56d4b3[_0x213f('0x4a')]['id']){delete _0x56d4b3[_0x213f('0x4a')]['id'];}return db[_0x213f('0x2b')][_0x213f('0x4d')]({'where':{'id':_0x56d4b3[_0x213f('0x4b')]['id']}})[_0x213f('0x24')](handleEntityNotFound(_0x44f650,null))['then'](function(_0x492f1a){if(_0x492f1a){_0x56d4b3['body'][_0x213f('0x50')]=_0x492f1a['id'];_0x56d4b3[_0x213f('0x4a')][_0x213f('0x51')]=integrations[_0x213f('0x52')](_0x56d4b3[_0x213f('0x4a')][_0x213f('0x53')],_0x56d4b3[_0x213f('0x4a')][_0x213f('0x2e')]);_0x56d4b3[_0x213f('0x4a')][_0x213f('0x54')]=integrations[_0x213f('0x55')](_0x56d4b3[_0x213f('0x4a')][_0x213f('0x53')],_0x56d4b3[_0x213f('0x4a')][_0x213f('0x2e')]);return db[_0x213f('0x56')][_0x213f('0x49')](_0x56d4b3['body'],{'include':[{'model':db[_0x213f('0x57')],'as':_0x213f('0x51')},{'model':db[_0x213f('0x57')],'as':_0x213f('0x54')}]});}return null;})[_0x213f('0x24')](respondWithResult(_0x44f650,null))[_0x213f('0x44')](handleError(_0x44f650,null));};exports['getFields']=function(_0x7f766f,_0x4a7a1f,_0x2a4d7e){var _0x225b13=[_0x213f('0x58'),_0x213f('0x59'),_0x213f('0x5a'),'subcategory',_0x213f('0x5b'),_0x213f('0x5c'),_0x213f('0x5d'),_0x213f('0x5e'),_0x213f('0x5f')];var _0x5450d6=[_0x213f('0x60'),_0x213f('0x58'),_0x213f('0x61'),_0x213f('0x62'),_0x213f('0x63'),_0x213f('0x64'),_0x213f('0x65'),'hold_reason','approval_history','number','resolved_by',_0x213f('0x66'),_0x213f('0x67'),_0x213f('0x68'),_0x213f('0x69'),_0x213f('0x6a'),_0x213f('0x6b'),_0x213f('0x6c'),'knowledge','order',_0x213f('0x6d'),_0x213f('0x6e'),_0x213f('0x6f'),_0x213f('0x70'),_0x213f('0x71'),_0x213f('0x72'),_0x213f('0x73'),_0x213f('0x74'),_0x213f('0x75'),_0x213f('0x76'),_0x213f('0x77'),_0x213f('0x78'),_0x213f('0x79'),_0x213f('0x7a'),_0x213f('0x7b'),_0x213f('0x7c'),_0x213f('0x7d'),_0x213f('0x7e'),_0x213f('0x7f'),_0x213f('0x80'),'approval_set',_0x213f('0x81'),_0x213f('0x82'),_0x213f('0x83'),'close_code',_0x213f('0x84'),_0x213f('0x85'),_0x213f('0x86'),_0x213f('0x87'),_0x213f('0x88'),_0x213f('0x89'),_0x213f('0x8a'),'calendar_duration','notify',_0x213f('0x8b'),'close_notes','closed_by','follow_up',_0x213f('0x8c'),'sys_id',_0x213f('0x8d'),'reopened_by','incident_state',_0x213f('0x8e'),_0x213f('0x8f'),_0x213f('0x90'),'reassignment_count',_0x213f('0x91'),_0x213f('0x92'),_0x213f('0x5e'),_0x213f('0x93'),_0x213f('0x94'),_0x213f('0x95'),'comments_and_work_notes',_0x213f('0x96'),_0x213f('0x97'),_0x213f('0x98'),_0x213f('0x99'),_0x213f('0x9a'),_0x213f('0x9b'),_0x213f('0x9c'),_0x213f('0x9d'),_0x213f('0x5f')];var _0x32b7f9='';var _0x5c805a='';var _0x1e722a=[];var _0x4778d7='';var _0x44be15='';var _0x1b2246=[];var _0x22e1be='';var _0x96686c='';var _0x2034ef={};var _0x5642d0='';return db['ServicenowAccount']['findOne']({'where':{'id':_0x7f766f[_0x213f('0x4b')]['id']},'attributes':['id','username',_0x213f('0x9e'),_0x213f('0x9f'),_0x213f('0xa0'),'serverUrl']})[_0x213f('0x24')](handleEntityNotFound(_0x4a7a1f,null))['then'](function(_0x4b9f7a){if(_0x4b9f7a){_0x5642d0=_0x4b9f7a[_0x213f('0xa0')];var _0x54c973=_0x5642d0[_0x213f('0xa1')](-0x1);if(_0x54c973==='/'){_0x5642d0=_0x5642d0[_0x213f('0xa2')](0x0,_0x5642d0['lastIndexOf'](_0x54c973));}_0x96686c=util['format'](_0x213f('0xa3'),_0x5642d0);_0x22e1be=util['format']('%s/api/now/table/',_0x5642d0);_0x2034ef={'user':_0x4b9f7a[_0x213f('0xa4')],'pass':_0x4b9f7a['password']};var _0x5518a6={'method':'GET','uri':_0x96686c+_0x213f('0xa5'),'auth':_0x2034ef,'json':!![]};return rp(_0x5518a6);}})[_0x213f('0x24')](function(_0x12f08b){if(_0x12f08b[_0x213f('0xa6')][_0x213f('0x47')]>0x0){_0x32b7f9=_0x12f08b['result'];}console['log'](_0x213f('0xa7'),_0x32b7f9);_0x1b2246=[];_0x5c805a=Object[_0x213f('0xa8')]([],_0x32b7f9);_['remove'](_0x5c805a,function(_0x50bce6){return!_0x225b13['includes'](_0x50bce6[_0x213f('0x28')]);});_0x5c805a[_0x213f('0xa9')](function(_0x5ccbd7){var _0x5e880f=createFieldObject(_0x22e1be,_0x2034ef,_0x5ccbd7[_0x213f('0xaa')],_0x5ccbd7[_0x213f('0x28')],_0x5ccbd7[_0x213f('0xab')],![]);_0x1b2246[_0x213f('0xac')](_0x5e880f);});return Promise[_0x213f('0xad')](_0x1b2246);})['then'](function(_0x54dd35){_0x1e722a=_0x54dd35;_0x4778d7=Object['assign']([],_0x32b7f9);console[_0x213f('0xae')](_0x213f('0xaf'),_0x32b7f9);_[_0x213f('0xb0')](_0x4778d7,function(_0x23ef3a){return _0x5450d6[_0x213f('0xb1')](_0x23ef3a[_0x213f('0x28')]);});console['log'](_0x213f('0xb2'),_0x4778d7);_0x1b2246=[];_0x4778d7['forEach'](function(_0x2a2434){var _0x36e619=createFieldObject(_0x22e1be,_0x2034ef,_0x2a2434[_0x213f('0xaa')],_0x2a2434[_0x213f('0x28')],_0x2a2434[_0x213f('0xab')],!![]);_0x1b2246['push'](_0x36e619);});return Promise[_0x213f('0xad')](_0x1b2246);})['then'](function(_0xad4edf){_0x44be15=_0xad4edf;var _0x538df3=_0x1e722a[_0x213f('0xb3')](_0x44be15);return{'count':_0x538df3[_0x213f('0x47')],'rows':_0x538df3};})[_0x213f('0x24')](respondWithResult(_0x4a7a1f,null))[_0x213f('0x44')](function(_0x197377){console[_0x213f('0xae')](_0x213f('0xb4')+_0x197377);var _0x1536c3=_0x7f766f['query'][_0x213f('0xb5')]?0x1f4:_0x197377[_0x213f('0xb6')]||0x1f4;logger['error'](_0x197377[_0x213f('0x27')]);delete _0x197377[_0x213f('0x28')];if(_0x1536c3===0x191){_0x1536c3=0x190;}_0x4a7a1f[_0x213f('0x19')](_0x1536c3)['send'](_0x7f766f[_0x213f('0x31')][_0x213f('0xb5')]?{'message':'Wrong\x20credentials','statusCode':_0x197377[_0x213f('0xb6')]}:_0x197377);});};function createFieldObject(_0x372f1b,_0x4d80ed,_0x4e2227,_0x128088,_0x2a254a,_0x47bf5f){return new Promise(function(_0x54c7d1,_0x322962){var _0x2c0d16={'id':_0x128088,'name':_0x2a254a,'custom':_0x47bf5f};if(_0x4e2227===_0x213f('0xb7')){_0x2c0d16['options']=[{'name':_0x213f('0xb8'),'value':_0x213f('0xb9')},{'name':'False','value':_0x213f('0xba')}];_0x54c7d1(_0x2c0d16);}else{var _0x1bc0bc={'method':_0x213f('0xbb'),'uri':_0x372f1b+_0x213f('0xbc')+_0x128088,'auth':_0x4d80ed,'json':!![]};return rp(_0x1bc0bc)[_0x213f('0x24')](function(_0x207775){var _0x4d5080=[];if(_0x207775[_0x213f('0xa6')][_0x213f('0x47')]>0x0){_0x207775['result'][_0x213f('0xa9')](function(_0x169343){if(_0x169343[_0x213f('0xbd')]===_0x213f('0xba')){var _0x3e419c={'name':_0x169343[_0x213f('0xab')],'value':_0x169343['value']};_0x4d5080[_0x213f('0xac')](_0x3e419c);}});}_0x2c0d16[_0x213f('0x3f')]=_0x4d5080;if(_0x2c0d16[_0x213f('0x3f')][_0x213f('0x47')]>0x0){_0x54c7d1(_0x2c0d16);}else{if(_0x47bf5f==![]){_0x54c7d1();}else{_0x54c7d1(_0x2c0d16);}}});}});} \ No newline at end of file +var _0x6394=['name','send','map','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','ServicenowAccount','findAll','catch','show','params','keys','rawAttributes','find','create','body','update','getConfigurations','findOne','ServicenowConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ServicenowField','made_sla','hold_reason','knowledge','subcategory','notify','incident_state','severity','category','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','approval_history','resolved_by','sys_updated_by','user_input','sys_created_on','sys_domain','sys_created_by','calendar_stc','closed_at','cmdb_ci','delivery_plan','impact','active','work_notes_list','business_service','priority','rfc','time_worked','expected_start','business_duration','group_list','reopened_time','resolved_at','caller_id','approval_set','work_notes','short_description','close_code','correlation_display','delivery_task','work_start','assignment_group','business_stc','additional_assignee_list','description','sys_class_name','close_notes','closed_by','follow_up','parent_incident','sys_id','contact_type','urgency','problem_id','reassignment_count','assigned_to','sla_due','approval','comments_and_work_notes','sys_mod_count','sys_tags','upon_approval','correlation_id','username','password','email','serverUrl','slice','substring','lastIndexOf','format','%s/api/now/table/','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','remove','includes','forEach','label','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','internalType','push','all','concat','test','Wrong\x20credentials','statusCode','boolean','True','False','false','GET','sys_choice?sysparm_query=name=incident^element=','inactive','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','offset','undefined','count','set','Content-Range','json','reject','destroy','then','error'];(function(_0x552545,_0x4be12d){var _0x348df0=function(_0x2ed185){while(--_0x2ed185){_0x552545['push'](_0x552545['shift']());}};_0x348df0(++_0x4be12d);}(_0x6394,0x92));var _0x4639=function(_0x43078f,_0x52b0e7){_0x43078f=_0x43078f-0x0;var _0x2d7413=_0x6394[_0x43078f];return _0x2d7413;};'use strict';var emlformat=require(_0x4639('0x0'));var rimraf=require(_0x4639('0x1'));var zipdir=require(_0x4639('0x2'));var jsonpatch=require(_0x4639('0x3'));var rp=require(_0x4639('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x4639('0x5'));var util=require(_0x4639('0x6'));var path=require(_0x4639('0x7'));var sox=require(_0x4639('0x8'));var csv=require(_0x4639('0x9'));var ejs=require(_0x4639('0xa'));var fs=require('fs');var fs_extra=require(_0x4639('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x4639('0xc'));var jsforce=require(_0x4639('0xd'));var deskjs=require(_0x4639('0xe'));var toCsv=require(_0x4639('0x9'));var querystring=require(_0x4639('0xf'));var Papa=require(_0x4639('0x10'));var Redis=require(_0x4639('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x4639('0x12'));var as=require(_0x4639('0x13'));var hardwareService=require(_0x4639('0x14'));var logger=require(_0x4639('0x15'))(_0x4639('0x16'));var utils=require(_0x4639('0x17'));var config=require(_0x4639('0x18'));var licenseUtil=require(_0x4639('0x19'));var db=require(_0x4639('0x1a'))['db'];var integrations=require(_0x4639('0x1b'));function respondWithStatusCode(_0x3207d0,_0x16bb70){_0x16bb70=_0x16bb70||0xcc;return function(_0x53dc8d){if(_0x53dc8d){return _0x3207d0[_0x4639('0x1c')](_0x16bb70);}return _0x3207d0['status'](_0x16bb70)[_0x4639('0x1d')]();};}function respondWithResult(_0x1341d3,_0x493d68){_0x493d68=_0x493d68||0xc8;return function(_0x28e716){if(_0x28e716){return _0x1341d3[_0x4639('0x1e')](_0x493d68)['json'](_0x28e716);}};}function respondWithFilteredResult(_0x1abeae,_0x521a06){return function(_0x1a2f0c){if(_0x1a2f0c){var _0x502aa4=typeof _0x521a06[_0x4639('0x1f')]===_0x4639('0x20')&&typeof _0x521a06['limit']==='undefined';var _0x4a2bcc=_0x1a2f0c['count'];var _0x5d70ab=_0x502aa4?0x0:_0x521a06[_0x4639('0x1f')];var _0x579b2e=_0x502aa4?_0x1a2f0c[_0x4639('0x21')]:_0x521a06[_0x4639('0x1f')]+_0x521a06['limit'];var _0x3e552c;if(_0x579b2e>=_0x4a2bcc){_0x579b2e=_0x4a2bcc;_0x3e552c=0xc8;}else{_0x3e552c=0xce;}_0x1abeae['status'](_0x3e552c);return _0x1abeae[_0x4639('0x22')](_0x4639('0x23'),_0x5d70ab+'-'+_0x579b2e+'/'+_0x4a2bcc)[_0x4639('0x24')](_0x1a2f0c);}return null;};}function patchUpdates(_0x3c911e){return function(_0x817769){try{jsonpatch['apply'](_0x817769,_0x3c911e,!![]);}catch(_0x1d672f){return BPromise[_0x4639('0x25')](_0x1d672f);}return _0x817769['save']();};}function saveUpdates(_0x295003,_0xd314b6){return function(_0x2f8ec7){if(_0x2f8ec7){return _0x2f8ec7['update'](_0x295003)['then'](function(_0x310d25){return _0x310d25;});}return null;};}function removeEntity(_0x169be8,_0x5a8b81){return function(_0x33b558){if(_0x33b558){return _0x33b558[_0x4639('0x26')]()[_0x4639('0x27')](function(){_0x169be8[_0x4639('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0xeeed41,_0x45b480){return function(_0x23b77e){if(!_0x23b77e){_0xeeed41[_0x4639('0x1c')](0x194);}return _0x23b77e;};}function handleError(_0x35fbc7,_0x48104f){_0x48104f=_0x48104f||0x1f4;return function(_0x4b556d){logger[_0x4639('0x28')](_0x4b556d['stack']);if(_0x4b556d[_0x4639('0x29')]){delete _0x4b556d[_0x4639('0x29')];}_0x35fbc7[_0x4639('0x1e')](_0x48104f)[_0x4639('0x2a')](_0x4b556d);};}exports['index']=function(_0x363790,_0x1879c2){var _0x8516f5={},_0x31dd57={},_0x515b0d={'count':0x0,'rows':[]};var _0x5418eb=_[_0x4639('0x2b')](db['ServicenowAccount']['rawAttributes'],function(_0x1b4f28){return{'name':_0x1b4f28[_0x4639('0x2c')],'type':_0x1b4f28[_0x4639('0x2d')][_0x4639('0x2e')]};});_0x31dd57[_0x4639('0x2f')]=_['map'](_0x5418eb,_0x4639('0x29'));_0x31dd57[_0x4639('0x30')]=_['keys'](_0x363790[_0x4639('0x30')]);_0x31dd57[_0x4639('0x31')]=_[_0x4639('0x32')](_0x31dd57['model'],_0x31dd57[_0x4639('0x30')]);_0x8516f5['attributes']=_[_0x4639('0x32')](_0x31dd57[_0x4639('0x2f')],qs['fields'](_0x363790[_0x4639('0x30')][_0x4639('0x33')]));_0x8516f5[_0x4639('0x34')]=_0x8516f5[_0x4639('0x34')][_0x4639('0x35')]?_0x8516f5[_0x4639('0x34')]:_0x31dd57[_0x4639('0x2f')];if(!_0x363790[_0x4639('0x30')][_0x4639('0x36')](_0x4639('0x37'))){_0x8516f5[_0x4639('0x38')]=qs[_0x4639('0x38')](_0x363790[_0x4639('0x30')][_0x4639('0x38')]);_0x8516f5[_0x4639('0x1f')]=qs[_0x4639('0x1f')](_0x363790['query'][_0x4639('0x1f')]);}_0x8516f5[_0x4639('0x39')]=qs['sort'](_0x363790['query'][_0x4639('0x3a')]);_0x8516f5[_0x4639('0x3b')]=qs['filters'](_[_0x4639('0x3c')](_0x363790[_0x4639('0x30')],_0x31dd57[_0x4639('0x31')]),_0x5418eb);if(_0x363790['query'][_0x4639('0x3d')]){_0x8516f5['where']=_[_0x4639('0x3e')](_0x8516f5[_0x4639('0x3b')],{'$or':_['map'](_0x5418eb,function(_0x3df52e){if(_0x3df52e[_0x4639('0x2d')]!==_0x4639('0x3f')){var _0x2d9d60={};_0x2d9d60[_0x3df52e[_0x4639('0x29')]]={'$like':'%'+_0x363790[_0x4639('0x30')][_0x4639('0x3d')]+'%'};return _0x2d9d60;}})});}_0x8516f5=_[_0x4639('0x3e')]({},_0x8516f5,_0x363790[_0x4639('0x40')]);var _0x407a91={'where':_0x8516f5['where']};return db['ServicenowAccount'][_0x4639('0x21')](_0x407a91)['then'](function(_0x476723){_0x515b0d[_0x4639('0x21')]=_0x476723;if(_0x363790['query'][_0x4639('0x41')]){_0x8516f5[_0x4639('0x42')]=[{'all':!![]}];}return db[_0x4639('0x43')][_0x4639('0x44')](_0x8516f5);})[_0x4639('0x27')](function(_0x47e22a){_0x515b0d['rows']=_0x47e22a;return _0x515b0d;})[_0x4639('0x27')](respondWithFilteredResult(_0x1879c2,_0x8516f5))[_0x4639('0x45')](handleError(_0x1879c2,null));};exports[_0x4639('0x46')]=function(_0x390e7c,_0x5f2da7){var _0x2b39dc={'raw':![],'where':{'id':_0x390e7c[_0x4639('0x47')]['id']}},_0x2fce09={};_0x2fce09['model']=_[_0x4639('0x48')](db[_0x4639('0x43')][_0x4639('0x49')]);_0x2fce09[_0x4639('0x30')]=_[_0x4639('0x48')](_0x390e7c[_0x4639('0x30')]);_0x2fce09[_0x4639('0x31')]=_[_0x4639('0x32')](_0x2fce09[_0x4639('0x2f')],_0x2fce09['query']);_0x2b39dc[_0x4639('0x34')]=_[_0x4639('0x32')](_0x2fce09[_0x4639('0x2f')],qs[_0x4639('0x33')](_0x390e7c[_0x4639('0x30')]['fields']));_0x2b39dc[_0x4639('0x34')]=_0x2b39dc['attributes'][_0x4639('0x35')]?_0x2b39dc[_0x4639('0x34')]:_0x2fce09[_0x4639('0x2f')];if(_0x390e7c[_0x4639('0x30')]['includeAll']){_0x2b39dc[_0x4639('0x42')]=[{'all':!![]}];}_0x2b39dc=_[_0x4639('0x3e')]({},_0x2b39dc,_0x390e7c['options']);return db[_0x4639('0x43')][_0x4639('0x4a')](_0x2b39dc)[_0x4639('0x27')](handleEntityNotFound(_0x5f2da7,null))['then'](respondWithResult(_0x5f2da7,null))[_0x4639('0x45')](handleError(_0x5f2da7,null));};exports[_0x4639('0x4b')]=function(_0x120b3a,_0x506eaa){return db['ServicenowAccount'][_0x4639('0x4b')](_0x120b3a[_0x4639('0x4c')],{})[_0x4639('0x27')](respondWithResult(_0x506eaa,0xc9))[_0x4639('0x45')](handleError(_0x506eaa,null));};exports[_0x4639('0x4d')]=function(_0x2dba6a,_0x1b0b1a){if(_0x2dba6a[_0x4639('0x4c')]['id']){delete _0x2dba6a[_0x4639('0x4c')]['id'];}return db[_0x4639('0x43')]['find']({'where':{'id':_0x2dba6a[_0x4639('0x47')]['id']}})['then'](handleEntityNotFound(_0x1b0b1a,null))[_0x4639('0x27')](saveUpdates(_0x2dba6a[_0x4639('0x4c')],null))[_0x4639('0x27')](respondWithResult(_0x1b0b1a,null))[_0x4639('0x45')](handleError(_0x1b0b1a,null));};exports[_0x4639('0x26')]=function(_0x183c3b,_0x35cec7){return db[_0x4639('0x43')][_0x4639('0x4a')]({'where':{'id':_0x183c3b[_0x4639('0x47')]['id']}})[_0x4639('0x27')](handleEntityNotFound(_0x35cec7,null))['then'](removeEntity(_0x35cec7,null))[_0x4639('0x45')](handleError(_0x35cec7,null));};exports[_0x4639('0x4e')]=function(_0x51cd37,_0x168f31,_0x19ae24){var _0x2762be={};var _0x3bea99={};var _0x4592c0;var _0x5eaf5f;return db[_0x4639('0x43')][_0x4639('0x4f')]({'where':{'id':_0x51cd37[_0x4639('0x47')]['id']}})[_0x4639('0x27')](handleEntityNotFound(_0x168f31,null))[_0x4639('0x27')](function(_0x3c754f){if(_0x3c754f){_0x4592c0=_0x3c754f;_0x3bea99['model']=_[_0x4639('0x48')](db[_0x4639('0x50')][_0x4639('0x49')]);_0x3bea99[_0x4639('0x30')]=_['keys'](_0x51cd37[_0x4639('0x30')]);_0x3bea99[_0x4639('0x31')]=_[_0x4639('0x32')](_0x3bea99[_0x4639('0x2f')],_0x3bea99[_0x4639('0x30')]);_0x2762be[_0x4639('0x34')]=_[_0x4639('0x32')](_0x3bea99['model'],qs[_0x4639('0x33')](_0x51cd37[_0x4639('0x30')][_0x4639('0x33')]));_0x2762be[_0x4639('0x34')]=_0x2762be['attributes'][_0x4639('0x35')]?_0x2762be['attributes']:_0x3bea99[_0x4639('0x2f')];_0x2762be['order']=qs[_0x4639('0x3a')](_0x51cd37[_0x4639('0x30')][_0x4639('0x3a')]);_0x2762be['where']=qs[_0x4639('0x31')](_[_0x4639('0x3c')](_0x51cd37[_0x4639('0x30')],_0x3bea99[_0x4639('0x31')]));if(_0x51cd37[_0x4639('0x30')][_0x4639('0x3d')]){_0x2762be['where']=_[_0x4639('0x3e')](_0x2762be[_0x4639('0x3b')],{'$or':_[_0x4639('0x2b')](_0x2762be[_0x4639('0x34')],function(_0x2a5e56){var _0x1df443={};_0x1df443[_0x2a5e56]={'$like':'%'+_0x51cd37[_0x4639('0x30')][_0x4639('0x3d')]+'%'};return _0x1df443;})});}_0x2762be=_[_0x4639('0x3e')]({},_0x2762be,_0x51cd37['options']);return _0x4592c0[_0x4639('0x4e')](_0x2762be);}})['then'](function(_0x4b9ea9){if(_0x4b9ea9){_0x5eaf5f=_0x4b9ea9[_0x4639('0x35')];if(!_0x51cd37[_0x4639('0x30')][_0x4639('0x36')](_0x4639('0x37'))){_0x2762be[_0x4639('0x38')]=qs[_0x4639('0x38')](_0x51cd37[_0x4639('0x30')][_0x4639('0x38')]);_0x2762be[_0x4639('0x1f')]=qs[_0x4639('0x1f')](_0x51cd37[_0x4639('0x30')][_0x4639('0x1f')]);}return _0x4592c0[_0x4639('0x4e')](_0x2762be);}})[_0x4639('0x27')](function(_0xad03b3){if(_0xad03b3){return _0xad03b3?{'count':_0x5eaf5f,'rows':_0xad03b3}:null;}})[_0x4639('0x27')](respondWithResult(_0x168f31,null))[_0x4639('0x45')](handleError(_0x168f31,null));};exports['addConfiguration']=function(_0x3995be,_0x5e1a19,_0x35401d){if(_0x3995be[_0x4639('0x4c')]['id']){delete _0x3995be['body']['id'];}return db[_0x4639('0x43')][_0x4639('0x4f')]({'where':{'id':_0x3995be[_0x4639('0x47')]['id']}})[_0x4639('0x27')](handleEntityNotFound(_0x5e1a19,null))[_0x4639('0x27')](function(_0x22fcd0){if(_0x22fcd0){_0x3995be['body'][_0x4639('0x51')]=_0x22fcd0['id'];_0x3995be[_0x4639('0x4c')][_0x4639('0x52')]=integrations[_0x4639('0x53')](_0x3995be[_0x4639('0x4c')][_0x4639('0x54')],_0x3995be[_0x4639('0x4c')][_0x4639('0x2d')]);_0x3995be[_0x4639('0x4c')][_0x4639('0x55')]=integrations[_0x4639('0x56')](_0x3995be[_0x4639('0x4c')][_0x4639('0x54')],_0x3995be[_0x4639('0x4c')][_0x4639('0x2d')]);return db[_0x4639('0x50')]['create'](_0x3995be[_0x4639('0x4c')],{'include':[{'model':db[_0x4639('0x57')],'as':_0x4639('0x52')},{'model':db[_0x4639('0x57')],'as':'Descriptions'}]});}return null;})[_0x4639('0x27')](respondWithResult(_0x5e1a19,null))['catch'](handleError(_0x5e1a19,null));};exports['getFields']=function(_0x855072,_0xafab9e,_0x23d1d8){var _0x275d1f=[_0x4639('0x58'),_0x4639('0x59'),_0x4639('0x5a'),_0x4639('0x5b'),'close_code',_0x4639('0x5c'),_0x4639('0x5d'),_0x4639('0x5e'),_0x4639('0x5f')];var _0x16cc7c=['parent',_0x4639('0x58'),_0x4639('0x60'),_0x4639('0x61'),_0x4639('0x62'),_0x4639('0x63'),_0x4639('0x64'),_0x4639('0x59'),_0x4639('0x65'),'number',_0x4639('0x66'),_0x4639('0x67'),'opened_by',_0x4639('0x68'),_0x4639('0x69'),_0x4639('0x6a'),'state',_0x4639('0x6b'),'knowledge',_0x4639('0x39'),_0x4639('0x6c'),_0x4639('0x6d'),_0x4639('0x6e'),_0x4639('0x6f'),_0x4639('0x70'),_0x4639('0x71'),_0x4639('0x72'),_0x4639('0x73'),_0x4639('0x74'),'sys_domain_path',_0x4639('0x75'),_0x4639('0x76'),_0x4639('0x77'),'opened_at',_0x4639('0x78'),_0x4639('0x79'),'work_end',_0x4639('0x7a'),_0x4639('0x7b'),_0x4639('0x7c'),_0x4639('0x7d'),_0x4639('0x5b'),_0x4639('0x7e'),_0x4639('0x7f'),_0x4639('0x80'),_0x4639('0x81'),_0x4639('0x82'),_0x4639('0x83'),_0x4639('0x84'),_0x4639('0x85'),_0x4639('0x86'),_0x4639('0x87'),'calendar_duration','notify',_0x4639('0x88'),_0x4639('0x89'),_0x4639('0x8a'),_0x4639('0x8b'),_0x4639('0x8c'),_0x4639('0x8d'),_0x4639('0x8e'),'reopened_by',_0x4639('0x5d'),_0x4639('0x8f'),_0x4639('0x90'),'company',_0x4639('0x91'),'activity_due',_0x4639('0x92'),_0x4639('0x5e'),'comments',_0x4639('0x93'),_0x4639('0x94'),_0x4639('0x95'),'due_date',_0x4639('0x96'),'reopen_count',_0x4639('0x97'),'escalation',_0x4639('0x98'),_0x4639('0x99'),'location',_0x4639('0x5f')];var _0x5952f5='';var _0x59d503='';var _0x1d806e=[];var _0x4aae70='';var _0x36a72b='';var _0xb5e277=[];var _0x934aea='';var _0x1f5a68='';var _0x273fa2={};var _0x16ba2f='';return db['ServicenowAccount']['findOne']({'where':{'id':_0x855072[_0x4639('0x47')]['id']},'attributes':['id',_0x4639('0x9a'),_0x4639('0x9b'),_0x4639('0x9c'),'remoteUri',_0x4639('0x9d')]})[_0x4639('0x27')](handleEntityNotFound(_0xafab9e,null))[_0x4639('0x27')](function(_0x270c2e){if(_0x270c2e){_0x16ba2f=_0x270c2e['remoteUri'];var _0x571645=_0x16ba2f[_0x4639('0x9e')](-0x1);if(_0x571645==='/'){_0x16ba2f=_0x16ba2f[_0x4639('0x9f')](0x0,_0x16ba2f[_0x4639('0xa0')](_0x571645));}_0x1f5a68=util[_0x4639('0xa1')]('%s/api/now/doc/table/schema/',_0x16ba2f);_0x934aea=util['format'](_0x4639('0xa2'),_0x16ba2f);_0x273fa2={'user':_0x270c2e[_0x4639('0x9a')],'pass':_0x270c2e[_0x4639('0x9b')]};var _0x1d59d2={'method':'GET','uri':_0x1f5a68+_0x4639('0xa3'),'auth':_0x273fa2,'json':!![]};return rp(_0x1d59d2);}})[_0x4639('0x27')](function(_0x50ae6b){if(_0x50ae6b['result'][_0x4639('0x35')]>0x0){_0x5952f5=_0x50ae6b[_0x4639('0xa4')];}console[_0x4639('0xa5')](_0x4639('0xa6'),_0x5952f5);_0xb5e277=[];_0x59d503=Object[_0x4639('0xa7')]([],_0x5952f5);_[_0x4639('0xa8')](_0x59d503,function(_0x5ce54e){return!_0x275d1f[_0x4639('0xa9')](_0x5ce54e[_0x4639('0x29')]);});_0x59d503[_0x4639('0xaa')](function(_0x83f289){var _0x432c79=createFieldObject(_0x934aea,_0x273fa2,_0x83f289['internalType'],_0x83f289['name'],_0x83f289[_0x4639('0xab')],![]);_0xb5e277['push'](_0x432c79);});return Promise['all'](_0xb5e277);})['then'](function(_0x4a2a96){_0x1d806e=_0x4a2a96;_0x4aae70=Object[_0x4639('0xa7')]([],_0x5952f5);console[_0x4639('0xa5')]('TCL:\x20_object',_0x5952f5);_[_0x4639('0xa8')](_0x4aae70,function(_0x35df80){return _0x16cc7c[_0x4639('0xa9')](_0x35df80[_0x4639('0x29')]);});console[_0x4639('0xa5')](_0x4639('0xac'),_0x4aae70);_0xb5e277=[];_0x4aae70[_0x4639('0xaa')](function(_0xe983b7){var _0x43c3ce=createFieldObject(_0x934aea,_0x273fa2,_0xe983b7[_0x4639('0xad')],_0xe983b7[_0x4639('0x29')],_0xe983b7[_0x4639('0xab')],!![]);_0xb5e277[_0x4639('0xae')](_0x43c3ce);});return Promise[_0x4639('0xaf')](_0xb5e277);})[_0x4639('0x27')](function(_0x5f5aac){_0x36a72b=_0x5f5aac;var _0x10b947=_0x1d806e[_0x4639('0xb0')](_0x36a72b);return{'count':_0x10b947['length'],'rows':_0x10b947};})[_0x4639('0x27')](respondWithResult(_0xafab9e,null))[_0x4639('0x45')](function(_0x5cd86b){console['log']('ServiceNow\x20error:\x20'+_0x5cd86b);var _0x45814f=_0x855072['query'][_0x4639('0xb1')]?0x1f4:_0x5cd86b['statusCode']||0x1f4;logger['error'](_0x5cd86b['stack']);delete _0x5cd86b['name'];if(_0x45814f===0x191){_0x45814f=0x190;}_0xafab9e['status'](_0x45814f)['send'](_0x855072['query'][_0x4639('0xb1')]?{'message':_0x4639('0xb2'),'statusCode':_0x5cd86b[_0x4639('0xb3')]}:_0x5cd86b);});};function createFieldObject(_0xa5e959,_0x3bdd99,_0x3b5679,_0xa73b05,_0x2854b0,_0x211909){return new Promise(function(_0x49ecf0,_0x4a6a0f){var _0x3335fd={'id':_0xa73b05,'name':_0x2854b0,'custom':_0x211909};if(_0x3b5679===_0x4639('0xb4')){_0x3335fd[_0x4639('0x40')]=[{'name':_0x4639('0xb5'),'value':'true'},{'name':_0x4639('0xb6'),'value':_0x4639('0xb7')}];_0x49ecf0(_0x3335fd);}else{var _0x5cbeca={'method':_0x4639('0xb8'),'uri':_0xa5e959+_0x4639('0xb9')+_0xa73b05,'auth':_0x3bdd99,'json':!![]};return rp(_0x5cbeca)['then'](function(_0x8f1c46){var _0x31e3b9=[];if(_0x8f1c46['result'][_0x4639('0x35')]>0x0){_0x8f1c46[_0x4639('0xa4')]['forEach'](function(_0x57cb3b){if(_0x57cb3b[_0x4639('0xba')]===_0x4639('0xb7')){var _0x32c488={'name':_0x57cb3b[_0x4639('0xab')],'value':_0x57cb3b['value']};_0x31e3b9[_0x4639('0xae')](_0x32c488);}});}_0x3335fd[_0x4639('0x40')]=_0x31e3b9;if(_0x3335fd[_0x4639('0x40')][_0x4639('0x35')]>0x0){_0x49ecf0(_0x3335fd);}else{if(_0x211909==![]){_0x49ecf0();}else{_0x49ecf0(_0x3335fd);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index b7ecb30..3d2d738 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 _0x8958=['exports','define','ServicenowAccount','util','request-promise','rimraf','../../config/environment','./intServicenowAccount.attributes'];(function(_0x3f9617,_0x1ce1aa){var _0x1d4bf3=function(_0x4c2da7){while(--_0x4c2da7){_0x3f9617['push'](_0x3f9617['shift']());}};_0x1d4bf3(++_0x1ce1aa);}(_0x8958,0x93));var _0x8895=function(_0x3de2e7,_0x39aa2b){_0x3de2e7=_0x3de2e7-0x0;var _0x116f34=_0x8958[_0x3de2e7];return _0x116f34;};'use strict';var _=require('lodash');var util=require(_0x8895('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8895('0x1'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8895('0x2'));var config=require(_0x8895('0x3'));var attributes=require(_0x8895('0x4'));var integrations=require('../../components/integrations/configuration');module[_0x8895('0x5')]=function(_0x2f03ad,_0x124e1e){return _0x2f03ad[_0x8895('0x6')](_0x8895('0x7'),attributes,{'tableName':'int_servicenow_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x31f0=['./intServicenowAccount.attributes','ServicenowAccount','int_servicenow_accounts','lodash','../../config/logger','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x186015,_0x1e657a){var _0x574358=function(_0x3bbad6){while(--_0x3bbad6){_0x186015['push'](_0x186015['shift']());}};_0x574358(++_0x1e657a);}(_0x31f0,0xb7));var _0x031f=function(_0x322e29,_0x5e86a2){_0x322e29=_0x322e29-0x0;var _0x17438f=_0x31f0[_0x322e29];return _0x17438f;};'use strict';var _=require(_0x031f('0x0'));var util=require('util');var logger=require(_0x031f('0x1'))('api');var moment=require(_0x031f('0x2'));var BPromise=require(_0x031f('0x3'));var rp=require(_0x031f('0x4'));var fs=require('fs');var path=require(_0x031f('0x5'));var rimraf=require('rimraf');var config=require(_0x031f('0x6'));var attributes=require(_0x031f('0x7'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x56328c,_0x3dc98e){return _0x56328c['define'](_0x031f('0x8'),attributes,{'tableName':_0x031f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.rpc.js b/server/api/intServicenowAccount/intServicenowAccount.rpc.js index 1f14a78..c5981f4 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 _0xad56=['message','result','catch','GetServicenowAccount','ServicenowAccount','options','attributes','limit','include','map','model','debug','ShowServicenowAccount','find','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xad56,0x177));var _0x6ad5=function(_0x39f7c8,_0x4bf22e){_0x39f7c8=_0x39f7c8-0x0;var _0x1ce574=_0xad56[_0x39f7c8];return _0x1ce574;};'use strict';var _=require(_0x6ad5('0x0'));var util=require(_0x6ad5('0x1'));var moment=require(_0x6ad5('0x2'));var BPromise=require(_0x6ad5('0x3'));var rs=require(_0x6ad5('0x4'));var fs=require('fs');var Redis=require(_0x6ad5('0x5'));var db=require(_0x6ad5('0x6'))['db'];var utils=require(_0x6ad5('0x7'));var logger=require(_0x6ad5('0x8'))(_0x6ad5('0x9'));var config=require(_0x6ad5('0xa'));var jayson=require(_0x6ad5('0xb'));var client=jayson[_0x6ad5('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2dd59d,_0x5c2df3,_0x51f8ee){return new BPromise(function(_0xa31667,_0x1ad672){return client[_0x6ad5('0xd')](_0x2dd59d,_0x51f8ee)[_0x6ad5('0xe')](function(_0x46ec46){logger[_0x6ad5('0xf')](_0x6ad5('0x10'),_0x5c2df3,_0x6ad5('0x11'));logger['debug']('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x5c2df3,_0x6ad5('0x11'),JSON[_0x6ad5('0x12')](_0x46ec46));if(_0x46ec46[_0x6ad5('0x13')]){if(_0x46ec46[_0x6ad5('0x13')][_0x6ad5('0x14')]===0x1f4){logger[_0x6ad5('0x13')](_0x6ad5('0x10'),_0x5c2df3,_0x46ec46[_0x6ad5('0x13')][_0x6ad5('0x15')]);return _0x1ad672(_0x46ec46['error']['message']);}logger[_0x6ad5('0x13')]('ServicenowAccount,\x20%s,\x20%s',_0x5c2df3,_0x46ec46[_0x6ad5('0x13')]['message']);return _0xa31667(_0x46ec46[_0x6ad5('0x13')][_0x6ad5('0x15')]);}else{logger[_0x6ad5('0xf')](_0x6ad5('0x10'),_0x5c2df3,_0x6ad5('0x11'));_0xa31667(_0x46ec46[_0x6ad5('0x16')][_0x6ad5('0x15')]);}})[_0x6ad5('0x17')](function(_0x53d716){logger['error']('ServicenowAccount,\x20%s,\x20%s',_0x5c2df3,_0x53d716);_0x1ad672(_0x53d716);});});}exports[_0x6ad5('0x18')]=function(_0x279b68){var _0x2dacbc=this;return new Promise(function(_0x15da41,_0x4479f9){return db[_0x6ad5('0x19')]['findAll']({'raw':_0x279b68[_0x6ad5('0x1a')]?_0x279b68[_0x6ad5('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x279b68[_0x6ad5('0x1a')]?_0x279b68[_0x6ad5('0x1a')]['where']||null:null,'attributes':_0x279b68[_0x6ad5('0x1a')]?_0x279b68['options'][_0x6ad5('0x1b')]||null:null,'limit':_0x279b68[_0x6ad5('0x1a')]?_0x279b68['options'][_0x6ad5('0x1c')]||null:null,'include':_0x279b68['options']?_0x279b68[_0x6ad5('0x1a')][_0x6ad5('0x1d')]?_[_0x6ad5('0x1e')](_0x279b68['options']['include'],function(_0x180f21){return{'model':db[_0x180f21[_0x6ad5('0x1f')]],'as':_0x180f21['as'],'attributes':_0x180f21[_0x6ad5('0x1b')],'include':_0x180f21[_0x6ad5('0x1d')]?_[_0x6ad5('0x1e')](_0x180f21['include'],function(_0x4c7a04){return{'model':db[_0x4c7a04[_0x6ad5('0x1f')]],'as':_0x4c7a04['as'],'attributes':_0x4c7a04['attributes'],'include':_0x4c7a04[_0x6ad5('0x1d')]?_['map'](_0x4c7a04[_0x6ad5('0x1d')],function(_0x51040a){return{'model':db[_0x51040a[_0x6ad5('0x1f')]],'as':_0x51040a['as'],'attributes':_0x51040a['attributes']};}):[]};}):[]};}):[]:[]})[_0x6ad5('0xe')](function(_0x30ea08){logger[_0x6ad5('0xf')](_0x6ad5('0x18'),_0x279b68);logger[_0x6ad5('0x20')](_0x6ad5('0x18'),_0x279b68,JSON[_0x6ad5('0x12')](_0x30ea08));_0x15da41(_0x30ea08);})[_0x6ad5('0x17')](function(_0x454f48){logger[_0x6ad5('0x13')]('GetServicenowAccount',_0x454f48[_0x6ad5('0x15')],_0x279b68);_0x4479f9(_0x2dacbc['error'](0x1f4,_0x454f48[_0x6ad5('0x15')]));});});};exports[_0x6ad5('0x21')]=function(_0x4a93bc){var _0x321de8=this;return new Promise(function(_0x1255be,_0x123448){return db['ServicenowAccount'][_0x6ad5('0x22')]({'raw':_0x4a93bc[_0x6ad5('0x1a')]?_0x4a93bc['options']['raw']===undefined?!![]:![]:!![],'where':_0x4a93bc[_0x6ad5('0x1a')]?_0x4a93bc[_0x6ad5('0x1a')][_0x6ad5('0x23')]||null:null,'attributes':_0x4a93bc[_0x6ad5('0x1a')]?_0x4a93bc[_0x6ad5('0x1a')][_0x6ad5('0x1b')]||null:null,'include':_0x4a93bc[_0x6ad5('0x1a')]?_0x4a93bc[_0x6ad5('0x1a')]['include']?_[_0x6ad5('0x1e')](_0x4a93bc[_0x6ad5('0x1a')][_0x6ad5('0x1d')],function(_0x492466){return{'model':db[_0x492466[_0x6ad5('0x1f')]],'as':_0x492466['as'],'attributes':_0x492466['attributes'],'include':_0x492466[_0x6ad5('0x1d')]?_[_0x6ad5('0x1e')](_0x492466[_0x6ad5('0x1d')],function(_0x3292ae){return{'model':db[_0x3292ae['model']],'as':_0x3292ae['as'],'attributes':_0x3292ae[_0x6ad5('0x1b')],'include':_0x3292ae['include']?_[_0x6ad5('0x1e')](_0x3292ae[_0x6ad5('0x1d')],function(_0x294d8a){return{'model':db[_0x294d8a[_0x6ad5('0x1f')]],'as':_0x294d8a['as'],'attributes':_0x294d8a['attributes']};}):[]};}):[]};}):[]:[]})[_0x6ad5('0xe')](function(_0x4174c0){logger[_0x6ad5('0xf')]('ShowServicenowAccount',_0x4a93bc);logger[_0x6ad5('0x20')](_0x6ad5('0x21'),_0x4a93bc,JSON[_0x6ad5('0x12')](_0x4174c0));_0x1255be(_0x4174c0);})[_0x6ad5('0x17')](function(_0x23672d){logger[_0x6ad5('0x13')](_0x6ad5('0x21'),_0x23672d[_0x6ad5('0x15')],_0x4a93bc);_0x123448(_0x321de8['error'](0x1f4,_0x23672d['message']));});});}; \ No newline at end of file +var _0x2abd=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','ServicenowAccount','options','raw','where','attributes','include','map','model','GetServicenowAccount','ShowServicenowAccount','then','lodash'];(function(_0x353e56,_0x58c4f7){var _0x391ba6=function(_0x59af57){while(--_0x59af57){_0x353e56['push'](_0x353e56['shift']());}};_0x391ba6(++_0x58c4f7);}(_0x2abd,0xcb));var _0xd2ab=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x2abd[_0x138adb];return _0x1b27f2;};'use strict';var _=require(_0xd2ab('0x0'));var util=require(_0xd2ab('0x1'));var moment=require(_0xd2ab('0x2'));var BPromise=require(_0xd2ab('0x3'));var rs=require(_0xd2ab('0x4'));var fs=require('fs');var Redis=require(_0xd2ab('0x5'));var db=require(_0xd2ab('0x6'))['db'];var utils=require(_0xd2ab('0x7'));var logger=require('../../config/logger')(_0xd2ab('0x8'));var config=require('../../config/environment');var jayson=require(_0xd2ab('0x9'));var client=jayson[_0xd2ab('0xa')][_0xd2ab('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4475a5,_0x25a8e4,_0x1e2916){return new BPromise(function(_0x4fdce6,_0x357397){return client[_0xd2ab('0xc')](_0x4475a5,_0x1e2916)['then'](function(_0x74eb6c){logger[_0xd2ab('0xd')](_0xd2ab('0xe'),_0x25a8e4,_0xd2ab('0xf'));logger[_0xd2ab('0x10')](_0xd2ab('0x11'),_0x25a8e4,_0xd2ab('0xf'),JSON[_0xd2ab('0x12')](_0x74eb6c));if(_0x74eb6c['error']){if(_0x74eb6c['error'][_0xd2ab('0x13')]===0x1f4){logger[_0xd2ab('0x14')](_0xd2ab('0xe'),_0x25a8e4,_0x74eb6c['error'][_0xd2ab('0x15')]);return _0x357397(_0x74eb6c['error'][_0xd2ab('0x15')]);}logger[_0xd2ab('0x14')](_0xd2ab('0xe'),_0x25a8e4,_0x74eb6c[_0xd2ab('0x14')][_0xd2ab('0x15')]);return _0x4fdce6(_0x74eb6c[_0xd2ab('0x14')][_0xd2ab('0x15')]);}else{logger[_0xd2ab('0xd')]('ServicenowAccount,\x20%s,\x20%s',_0x25a8e4,_0xd2ab('0xf'));_0x4fdce6(_0x74eb6c['result'][_0xd2ab('0x15')]);}})[_0xd2ab('0x16')](function(_0x566b67){logger[_0xd2ab('0x14')](_0xd2ab('0xe'),_0x25a8e4,_0x566b67);_0x357397(_0x566b67);});});}exports['GetServicenowAccount']=function(_0x26575c){var _0x5253a6=this;return new Promise(function(_0x20704e,_0x3e00fc){return db[_0xd2ab('0x17')]['findAll']({'raw':_0x26575c[_0xd2ab('0x18')]?_0x26575c[_0xd2ab('0x18')][_0xd2ab('0x19')]===undefined?!![]:![]:!![],'where':_0x26575c[_0xd2ab('0x18')]?_0x26575c[_0xd2ab('0x18')][_0xd2ab('0x1a')]||null:null,'attributes':_0x26575c[_0xd2ab('0x18')]?_0x26575c[_0xd2ab('0x18')][_0xd2ab('0x1b')]||null:null,'limit':_0x26575c[_0xd2ab('0x18')]?_0x26575c['options']['limit']||null:null,'include':_0x26575c[_0xd2ab('0x18')]?_0x26575c[_0xd2ab('0x18')][_0xd2ab('0x1c')]?_[_0xd2ab('0x1d')](_0x26575c[_0xd2ab('0x18')][_0xd2ab('0x1c')],function(_0x2b9502){return{'model':db[_0x2b9502[_0xd2ab('0x1e')]],'as':_0x2b9502['as'],'attributes':_0x2b9502['attributes'],'include':_0x2b9502[_0xd2ab('0x1c')]?_[_0xd2ab('0x1d')](_0x2b9502['include'],function(_0xeb56f){return{'model':db[_0xeb56f['model']],'as':_0xeb56f['as'],'attributes':_0xeb56f[_0xd2ab('0x1b')],'include':_0xeb56f[_0xd2ab('0x1c')]?_['map'](_0xeb56f[_0xd2ab('0x1c')],function(_0x1074d2){return{'model':db[_0x1074d2[_0xd2ab('0x1e')]],'as':_0x1074d2['as'],'attributes':_0x1074d2[_0xd2ab('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x37b1a8){logger[_0xd2ab('0xd')](_0xd2ab('0x1f'),_0x26575c);logger['debug']('GetServicenowAccount',_0x26575c,JSON[_0xd2ab('0x12')](_0x37b1a8));_0x20704e(_0x37b1a8);})[_0xd2ab('0x16')](function(_0x2fc1f1){logger['error'](_0xd2ab('0x1f'),_0x2fc1f1['message'],_0x26575c);_0x3e00fc(_0x5253a6['error'](0x1f4,_0x2fc1f1[_0xd2ab('0x15')]));});});};exports[_0xd2ab('0x20')]=function(_0x5b2b44){var _0x2b0df5=this;return new Promise(function(_0x9c0e5d,_0x5ee85e){return db[_0xd2ab('0x17')]['find']({'raw':_0x5b2b44[_0xd2ab('0x18')]?_0x5b2b44['options'][_0xd2ab('0x19')]===undefined?!![]:![]:!![],'where':_0x5b2b44[_0xd2ab('0x18')]?_0x5b2b44[_0xd2ab('0x18')][_0xd2ab('0x1a')]||null:null,'attributes':_0x5b2b44[_0xd2ab('0x18')]?_0x5b2b44[_0xd2ab('0x18')][_0xd2ab('0x1b')]||null:null,'include':_0x5b2b44[_0xd2ab('0x18')]?_0x5b2b44[_0xd2ab('0x18')][_0xd2ab('0x1c')]?_[_0xd2ab('0x1d')](_0x5b2b44[_0xd2ab('0x18')][_0xd2ab('0x1c')],function(_0x69f67b){return{'model':db[_0x69f67b[_0xd2ab('0x1e')]],'as':_0x69f67b['as'],'attributes':_0x69f67b['attributes'],'include':_0x69f67b[_0xd2ab('0x1c')]?_[_0xd2ab('0x1d')](_0x69f67b[_0xd2ab('0x1c')],function(_0xd6fa73){return{'model':db[_0xd6fa73[_0xd2ab('0x1e')]],'as':_0xd6fa73['as'],'attributes':_0xd6fa73[_0xd2ab('0x1b')],'include':_0xd6fa73['include']?_[_0xd2ab('0x1d')](_0xd6fa73['include'],function(_0x2cd5d8){return{'model':db[_0x2cd5d8[_0xd2ab('0x1e')]],'as':_0x2cd5d8['as'],'attributes':_0x2cd5d8[_0xd2ab('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xd2ab('0x21')](function(_0x29c1a0){logger[_0xd2ab('0xd')]('ShowServicenowAccount',_0x5b2b44);logger['debug']('ShowServicenowAccount',_0x5b2b44,JSON[_0xd2ab('0x12')](_0x29c1a0));_0x9c0e5d(_0x29c1a0);})[_0xd2ab('0x16')](function(_0x386b52){logger[_0xd2ab('0x14')](_0xd2ab('0x20'),_0x386b52[_0xd2ab('0x15')],_0x5b2b44);_0x5ee85e(_0x2b0df5['error'](0x1f4,_0x386b52[_0xd2ab('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 180004b..f6d2311 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 _0xa9e4=['getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','put','destroy','util','connect-timeout','Router','../../components/auth/service','../../config/environment','./intServicenowConfiguration.controller','isAuthenticated','index','get','/:id','/:id/fields'];(function(_0x4101ad,_0x1b7eaf){var _0x3b6244=function(_0x5e7c49){while(--_0x5e7c49){_0x4101ad['push'](_0x4101ad['shift']());}};_0x3b6244(++_0x1b7eaf);}(_0xa9e4,0x138));var _0x4a9e=function(_0x15cdf2,_0x3416a8){_0x15cdf2=_0x15cdf2-0x0;var _0x1488a9=_0xa9e4[_0x15cdf2];return _0x1488a9;};'use strict';var multer=require('multer');var util=require(_0x4a9e('0x0'));var path=require('path');var timeout=require(_0x4a9e('0x1'));var express=require('express');var router=express[_0x4a9e('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x4a9e('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x4a9e('0x4'));var controller=require(_0x4a9e('0x5'));router['get']('/',auth[_0x4a9e('0x6')](),controller[_0x4a9e('0x7')]);router[_0x4a9e('0x8')](_0x4a9e('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x4a9e('0x8')](_0x4a9e('0xa'),auth[_0x4a9e('0x6')](),controller[_0x4a9e('0xb')]);router['get'](_0x4a9e('0xc'),auth['isAuthenticated'](),controller[_0x4a9e('0xd')]);router[_0x4a9e('0x8')](_0x4a9e('0xe'),auth['isAuthenticated'](),controller[_0x4a9e('0xf')]);router[_0x4a9e('0x10')]('/',auth[_0x4a9e('0x6')](),controller['create']);router[_0x4a9e('0x11')](_0x4a9e('0x9'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x4a9e('0x9'),auth[_0x4a9e('0x6')](),controller[_0x4a9e('0x12')]);module['exports']=router; \ No newline at end of file +var _0xd35b=['get','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../config/environment','./intServicenowConfiguration.controller','isAuthenticated'];(function(_0x221300,_0x2ab897){var _0x5546d1=function(_0x617895){while(--_0x617895){_0x221300['push'](_0x221300['shift']());}};_0x5546d1(++_0x2ab897);}(_0xd35b,0x16e));var _0xbd35=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xd35b[_0x311c35];return _0x5cc50c;};'use strict';var multer=require(_0xbd35('0x0'));var util=require(_0xbd35('0x1'));var path=require(_0xbd35('0x2'));var timeout=require(_0xbd35('0x3'));var express=require(_0xbd35('0x4'));var router=express['Router']();var fs_extra=require(_0xbd35('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xbd35('0x6'));var controller=require(_0xbd35('0x7'));router['get']('/',auth[_0xbd35('0x8')](),controller['index']);router[_0xbd35('0x9')](_0xbd35('0xa'),auth[_0xbd35('0x8')](),controller[_0xbd35('0xb')]);router['get'](_0xbd35('0xc'),auth[_0xbd35('0x8')](),controller[_0xbd35('0xd')]);router[_0xbd35('0x9')](_0xbd35('0xe'),auth[_0xbd35('0x8')](),controller[_0xbd35('0xf')]);router[_0xbd35('0x9')](_0xbd35('0x10'),auth[_0xbd35('0x8')](),controller[_0xbd35('0x11')]);router[_0xbd35('0x12')]('/',auth[_0xbd35('0x8')](),controller[_0xbd35('0x13')]);router[_0xbd35('0x14')]('/:id',auth[_0xbd35('0x8')](),controller[_0xbd35('0x15')]);router[_0xbd35('0x16')](_0xbd35('0xa'),auth[_0xbd35('0x8')](),controller[_0xbd35('0x17')]);module[_0xbd35('0x18')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 2c67492..610bb2c 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 _0x334d=['sequelize','STRING'];(function(_0x31bebb,_0x317739){var _0x26928b=function(_0x471539){while(--_0x471539){_0x31bebb['push'](_0x31bebb['shift']());}};_0x26928b(++_0x317739);}(_0x334d,0x1d2));var _0xd334=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x334d[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xd334('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xd334('0x1')]}}; \ No newline at end of file +var _0x53c1=['sequelize','STRING'];(function(_0x27a1e0,_0x3ff2cb){var _0x1ca624=function(_0x435802){while(--_0x435802){_0x27a1e0['push'](_0x27a1e0['shift']());}};_0x1ca624(++_0x3ff2cb);}(_0x53c1,0x94));var _0x153c=function(_0x31957d,_0x56aed4){_0x31957d=_0x31957d-0x0;var _0x3717a9=_0x53c1[_0x31957d];return _0x3717a9;};'use strict';var Sequelize=require(_0x153c('0x0'));module['exports']={'name':{'type':Sequelize[_0x153c('0x1')]},'description':{'type':Sequelize[_0x153c('0x1')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index aa1c72f..e53d7f3 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 _0xb7f3=['undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','sendStatus','error','name','send','map','ServicenowConfiguration','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','length','find','body','params','getFields','findOne','ServicenowField','nolimit','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset'];(function(_0xeef94c,_0x1db3f7){var _0x447522=function(_0x16d3d5){while(--_0x16d3d5){_0xeef94c['push'](_0xeef94c['shift']());}};_0x447522(++_0x1db3f7);}(_0xb7f3,0x81));var _0x3b7f=function(_0x2aade7,_0x5386ee){_0x2aade7=_0x2aade7-0x0;var _0x2a6bfe=_0xb7f3[_0x2aade7];return _0x2a6bfe;};'use strict';var emlformat=require(_0x3b7f('0x0'));var rimraf=require(_0x3b7f('0x1'));var zipdir=require(_0x3b7f('0x2'));var jsonpatch=require(_0x3b7f('0x3'));var rp=require(_0x3b7f('0x4'));var moment=require(_0x3b7f('0x5'));var BPromise=require(_0x3b7f('0x6'));var Mustache=require('mustache');var util=require(_0x3b7f('0x7'));var path=require(_0x3b7f('0x8'));var sox=require(_0x3b7f('0x9'));var csv=require(_0x3b7f('0xa'));var ejs=require(_0x3b7f('0xb'));var fs=require('fs');var fs_extra=require(_0x3b7f('0xc'));var _=require(_0x3b7f('0xd'));var squel=require(_0x3b7f('0xe'));var crypto=require(_0x3b7f('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x3b7f('0x10'));var toCsv=require(_0x3b7f('0xa'));var querystring=require(_0x3b7f('0x11'));var Papa=require(_0x3b7f('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3b7f('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3b7f('0x14'))('api');var utils=require(_0x3b7f('0x15'));var config=require(_0x3b7f('0x16'));var licenseUtil=require(_0x3b7f('0x17'));var db=require(_0x3b7f('0x18'))['db'];function respondWithStatusCode(_0x3e2730,_0x265694){_0x265694=_0x265694||0xcc;return function(_0x3c4bb3){if(_0x3c4bb3){return _0x3e2730['sendStatus'](_0x265694);}return _0x3e2730[_0x3b7f('0x19')](_0x265694)[_0x3b7f('0x1a')]();};}function respondWithResult(_0x393b16,_0x484cc6){_0x484cc6=_0x484cc6||0xc8;return function(_0x6970c9){if(_0x6970c9){return _0x393b16['status'](_0x484cc6)[_0x3b7f('0x1b')](_0x6970c9);}};}function respondWithFilteredResult(_0xfb369c,_0x4edad4){return function(_0x5f1bf5){if(_0x5f1bf5){var _0x40b0b7=typeof _0x4edad4[_0x3b7f('0x1c')]===_0x3b7f('0x1d')&&typeof _0x4edad4[_0x3b7f('0x1e')]===_0x3b7f('0x1d');var _0x1a61c2=_0x5f1bf5[_0x3b7f('0x1f')];var _0x457215=_0x40b0b7?0x0:_0x4edad4['offset'];var _0x19ae31=_0x40b0b7?_0x5f1bf5[_0x3b7f('0x1f')]:_0x4edad4[_0x3b7f('0x1c')]+_0x4edad4[_0x3b7f('0x1e')];var _0x23bc3e;if(_0x19ae31>=_0x1a61c2){_0x19ae31=_0x1a61c2;_0x23bc3e=0xc8;}else{_0x23bc3e=0xce;}_0xfb369c[_0x3b7f('0x19')](_0x23bc3e);return _0xfb369c[_0x3b7f('0x20')](_0x3b7f('0x21'),_0x457215+'-'+_0x19ae31+'/'+_0x1a61c2)[_0x3b7f('0x1b')](_0x5f1bf5);}return null;};}function patchUpdates(_0x2980b6){return function(_0x25ed57){try{jsonpatch[_0x3b7f('0x22')](_0x25ed57,_0x2980b6,!![]);}catch(_0x127d07){return BPromise['reject'](_0x127d07);}return _0x25ed57[_0x3b7f('0x23')]();};}function saveUpdates(_0x426623,_0x5e14fd){return function(_0x2fe259){if(_0x2fe259){return _0x2fe259[_0x3b7f('0x24')](_0x426623)[_0x3b7f('0x25')](function(_0x5555e0){return _0x5555e0;});}return null;};}function removeEntity(_0x1c8edb,_0x3d5ccb){return function(_0x1c3404){if(_0x1c3404){return _0x1c3404[_0x3b7f('0x26')]()[_0x3b7f('0x25')](function(){_0x1c8edb[_0x3b7f('0x19')](0xcc)[_0x3b7f('0x1a')]();});}};}function handleEntityNotFound(_0x51aebb,_0x508a53){return function(_0x17b21a){if(!_0x17b21a){_0x51aebb[_0x3b7f('0x27')](0x194);}return _0x17b21a;};}function handleError(_0x39da1e,_0x5c686f){_0x5c686f=_0x5c686f||0x1f4;return function(_0x355fac){logger[_0x3b7f('0x28')](_0x355fac['stack']);if(_0x355fac[_0x3b7f('0x29')]){delete _0x355fac[_0x3b7f('0x29')];}_0x39da1e['status'](_0x5c686f)[_0x3b7f('0x2a')](_0x355fac);};}exports['index']=function(_0x133aa2,_0x10cf9c){var _0x47bf1e={},_0x219d64={},_0x4bd239={'count':0x0,'rows':[]};var _0x537d34=_[_0x3b7f('0x2b')](db[_0x3b7f('0x2c')][_0x3b7f('0x2d')],function(_0x164af5){return{'name':_0x164af5[_0x3b7f('0x2e')],'type':_0x164af5['type']['key']};});_0x219d64[_0x3b7f('0x2f')]=_[_0x3b7f('0x2b')](_0x537d34,_0x3b7f('0x29'));_0x219d64[_0x3b7f('0x30')]=_[_0x3b7f('0x31')](_0x133aa2[_0x3b7f('0x30')]);_0x219d64[_0x3b7f('0x32')]=_[_0x3b7f('0x33')](_0x219d64[_0x3b7f('0x2f')],_0x219d64[_0x3b7f('0x30')]);_0x47bf1e[_0x3b7f('0x34')]=_['intersection'](_0x219d64['model'],qs['fields'](_0x133aa2['query'][_0x3b7f('0x35')]));_0x47bf1e['attributes']=_0x47bf1e['attributes']['length']?_0x47bf1e[_0x3b7f('0x34')]:_0x219d64[_0x3b7f('0x2f')];if(!_0x133aa2['query'][_0x3b7f('0x36')]('nolimit')){_0x47bf1e[_0x3b7f('0x1e')]=qs[_0x3b7f('0x1e')](_0x133aa2[_0x3b7f('0x30')][_0x3b7f('0x1e')]);_0x47bf1e[_0x3b7f('0x1c')]=qs[_0x3b7f('0x1c')](_0x133aa2[_0x3b7f('0x30')][_0x3b7f('0x1c')]);}_0x47bf1e[_0x3b7f('0x37')]=qs[_0x3b7f('0x38')](_0x133aa2[_0x3b7f('0x30')][_0x3b7f('0x38')]);_0x47bf1e[_0x3b7f('0x39')]=qs['filters'](_[_0x3b7f('0x3a')](_0x133aa2[_0x3b7f('0x30')],_0x219d64[_0x3b7f('0x32')]),_0x537d34);if(_0x133aa2[_0x3b7f('0x30')][_0x3b7f('0x3b')]){_0x47bf1e[_0x3b7f('0x39')]=_['merge'](_0x47bf1e[_0x3b7f('0x39')],{'$or':_[_0x3b7f('0x2b')](_0x537d34,function(_0x2b4ef1){if(_0x2b4ef1[_0x3b7f('0x3c')]!==_0x3b7f('0x3d')){var _0x416815={};_0x416815[_0x2b4ef1['name']]={'$like':'%'+_0x133aa2[_0x3b7f('0x30')][_0x3b7f('0x3b')]+'%'};return _0x416815;}})});}_0x47bf1e=_[_0x3b7f('0x3e')]({},_0x47bf1e,_0x133aa2[_0x3b7f('0x3f')]);var _0x5bc4f1={'where':_0x47bf1e['where']};return db[_0x3b7f('0x2c')]['count'](_0x5bc4f1)[_0x3b7f('0x25')](function(_0x361c4b){_0x4bd239[_0x3b7f('0x1f')]=_0x361c4b;if(_0x133aa2[_0x3b7f('0x30')][_0x3b7f('0x40')]){_0x47bf1e['include']=[{'all':!![]}];}return db[_0x3b7f('0x2c')][_0x3b7f('0x41')](_0x47bf1e);})[_0x3b7f('0x25')](function(_0x571d21){_0x4bd239[_0x3b7f('0x42')]=_0x571d21;return _0x4bd239;})['then'](respondWithFilteredResult(_0x10cf9c,_0x47bf1e))[_0x3b7f('0x43')](handleError(_0x10cf9c,null));};exports[_0x3b7f('0x44')]=function(_0x8777ec,_0x504a4c){var _0x1b17ce={'raw':![],'where':{'id':_0x8777ec['params']['id']}},_0x4882ae={};_0x4882ae['model']=_[_0x3b7f('0x31')](db['ServicenowConfiguration'][_0x3b7f('0x2d')]);_0x4882ae[_0x3b7f('0x30')]=_[_0x3b7f('0x31')](_0x8777ec[_0x3b7f('0x30')]);_0x4882ae['filters']=_[_0x3b7f('0x33')](_0x4882ae[_0x3b7f('0x2f')],_0x4882ae['query']);_0x1b17ce['attributes']=_[_0x3b7f('0x33')](_0x4882ae[_0x3b7f('0x2f')],qs[_0x3b7f('0x35')](_0x8777ec[_0x3b7f('0x30')][_0x3b7f('0x35')]));_0x1b17ce[_0x3b7f('0x34')]=_0x1b17ce[_0x3b7f('0x34')][_0x3b7f('0x45')]?_0x1b17ce['attributes']:_0x4882ae[_0x3b7f('0x2f')];if(_0x8777ec[_0x3b7f('0x30')]['includeAll']){_0x1b17ce['include']=[{'all':!![]}];}_0x1b17ce=_[_0x3b7f('0x3e')]({},_0x1b17ce,_0x8777ec[_0x3b7f('0x3f')]);return db['ServicenowConfiguration'][_0x3b7f('0x46')](_0x1b17ce)[_0x3b7f('0x25')](handleEntityNotFound(_0x504a4c,null))[_0x3b7f('0x25')](respondWithResult(_0x504a4c,null))[_0x3b7f('0x43')](handleError(_0x504a4c,null));};exports['create']=function(_0x131087,_0x30db96){return db[_0x3b7f('0x2c')]['create'](_0x131087[_0x3b7f('0x47')],{})[_0x3b7f('0x25')](respondWithResult(_0x30db96,0xc9))[_0x3b7f('0x43')](handleError(_0x30db96,null));};exports[_0x3b7f('0x24')]=function(_0x92cd9c,_0x531651){if(_0x92cd9c[_0x3b7f('0x47')]['id']){delete _0x92cd9c[_0x3b7f('0x47')]['id'];}return db['ServicenowConfiguration'][_0x3b7f('0x46')]({'where':{'id':_0x92cd9c[_0x3b7f('0x48')]['id']}})['then'](handleEntityNotFound(_0x531651,null))[_0x3b7f('0x25')](saveUpdates(_0x92cd9c['body'],null))['then'](respondWithResult(_0x531651,null))['catch'](handleError(_0x531651,null));};exports[_0x3b7f('0x26')]=function(_0x1cfca1,_0x36b739){return db[_0x3b7f('0x2c')][_0x3b7f('0x46')]({'where':{'id':_0x1cfca1[_0x3b7f('0x48')]['id']}})[_0x3b7f('0x25')](handleEntityNotFound(_0x36b739,null))[_0x3b7f('0x25')](removeEntity(_0x36b739,null))[_0x3b7f('0x43')](handleError(_0x36b739,null));};exports[_0x3b7f('0x49')]=function(_0x26524b,_0xefc558,_0x123313){var _0x11cedd={};var _0x1d689a={};var _0x3710b9;var _0x2d69f5;return db[_0x3b7f('0x2c')][_0x3b7f('0x4a')]({'where':{'id':_0x26524b[_0x3b7f('0x48')]['id']}})[_0x3b7f('0x25')](handleEntityNotFound(_0xefc558,null))[_0x3b7f('0x25')](function(_0x397e16){if(_0x397e16){_0x3710b9=_0x397e16;_0x1d689a[_0x3b7f('0x2f')]=_[_0x3b7f('0x31')](db[_0x3b7f('0x4b')]['rawAttributes']);_0x1d689a[_0x3b7f('0x30')]=_['keys'](_0x26524b[_0x3b7f('0x30')]);_0x1d689a['filters']=_['intersection'](_0x1d689a[_0x3b7f('0x2f')],_0x1d689a[_0x3b7f('0x30')]);_0x11cedd[_0x3b7f('0x34')]=_[_0x3b7f('0x33')](_0x1d689a[_0x3b7f('0x2f')],qs[_0x3b7f('0x35')](_0x26524b['query']['fields']));_0x11cedd[_0x3b7f('0x34')]=_0x11cedd[_0x3b7f('0x34')]['length']?_0x11cedd[_0x3b7f('0x34')]:_0x1d689a[_0x3b7f('0x2f')];_0x11cedd[_0x3b7f('0x37')]=qs[_0x3b7f('0x38')](_0x26524b[_0x3b7f('0x30')][_0x3b7f('0x38')]);_0x11cedd[_0x3b7f('0x39')]=qs[_0x3b7f('0x32')](_['pick'](_0x26524b[_0x3b7f('0x30')],_0x1d689a['filters']));if(_0x26524b[_0x3b7f('0x30')]['filter']){_0x11cedd['where']=_[_0x3b7f('0x3e')](_0x11cedd['where'],{'$or':_[_0x3b7f('0x2b')](_0x11cedd[_0x3b7f('0x34')],function(_0x16cff7){var _0x44544f={};_0x44544f[_0x16cff7]={'$like':'%'+_0x26524b[_0x3b7f('0x30')][_0x3b7f('0x3b')]+'%'};return _0x44544f;})});}_0x11cedd=_[_0x3b7f('0x3e')]({},_0x11cedd,_0x26524b['options']);return _0x3710b9[_0x3b7f('0x49')](_0x11cedd);}})[_0x3b7f('0x25')](function(_0x4e1e7a){if(_0x4e1e7a){_0x2d69f5=_0x4e1e7a[_0x3b7f('0x45')];if(!_0x26524b[_0x3b7f('0x30')][_0x3b7f('0x36')](_0x3b7f('0x4c'))){_0x11cedd['limit']=qs['limit'](_0x26524b['query']['limit']);_0x11cedd['offset']=qs[_0x3b7f('0x1c')](_0x26524b[_0x3b7f('0x30')][_0x3b7f('0x1c')]);}return _0x3710b9[_0x3b7f('0x49')](_0x11cedd);}})[_0x3b7f('0x25')](function(_0xf4730){if(_0xf4730){return _0xf4730?{'count':_0x2d69f5,'rows':_0xf4730}:null;}})[_0x3b7f('0x25')](respondWithResult(_0xefc558,null))[_0x3b7f('0x43')](handleError(_0xefc558,null));};exports[_0x3b7f('0x4d')]=function(_0x3832c1,_0x97d090,_0x4915f1){var _0x495214={};var _0x4f53f9={};var _0x282798;var _0x58b9eb;return db[_0x3b7f('0x2c')][_0x3b7f('0x4a')]({'where':{'id':_0x3832c1[_0x3b7f('0x48')]['id']}})['then'](handleEntityNotFound(_0x97d090,null))['then'](function(_0x175bcb){if(_0x175bcb){_0x282798=_0x175bcb;_0x4f53f9[_0x3b7f('0x2f')]=_['keys'](db[_0x3b7f('0x4b')][_0x3b7f('0x2d')]);_0x4f53f9[_0x3b7f('0x30')]=_[_0x3b7f('0x31')](_0x3832c1[_0x3b7f('0x30')]);_0x4f53f9[_0x3b7f('0x32')]=_['intersection'](_0x4f53f9[_0x3b7f('0x2f')],_0x4f53f9[_0x3b7f('0x30')]);_0x495214[_0x3b7f('0x34')]=_[_0x3b7f('0x33')](_0x4f53f9['model'],qs[_0x3b7f('0x35')](_0x3832c1[_0x3b7f('0x30')]['fields']));_0x495214['attributes']=_0x495214[_0x3b7f('0x34')]['length']?_0x495214[_0x3b7f('0x34')]:_0x4f53f9[_0x3b7f('0x2f')];_0x495214[_0x3b7f('0x37')]=qs[_0x3b7f('0x38')](_0x3832c1[_0x3b7f('0x30')][_0x3b7f('0x38')]);_0x495214[_0x3b7f('0x39')]=qs[_0x3b7f('0x32')](_[_0x3b7f('0x3a')](_0x3832c1[_0x3b7f('0x30')],_0x4f53f9['filters']));if(_0x3832c1['query'][_0x3b7f('0x3b')]){_0x495214[_0x3b7f('0x39')]=_['merge'](_0x495214[_0x3b7f('0x39')],{'$or':_['map'](_0x495214[_0x3b7f('0x34')],function(_0x1db32f){var _0x114f67={};_0x114f67[_0x1db32f]={'$like':'%'+_0x3832c1[_0x3b7f('0x30')]['filter']+'%'};return _0x114f67;})});}_0x495214=_['merge']({},_0x495214,_0x3832c1[_0x3b7f('0x3f')]);return _0x282798['getSubjects'](_0x495214);}})[_0x3b7f('0x25')](function(_0x3132a5){if(_0x3132a5){_0x58b9eb=_0x3132a5['length'];if(!_0x3832c1[_0x3b7f('0x30')][_0x3b7f('0x36')](_0x3b7f('0x4c'))){_0x495214[_0x3b7f('0x1e')]=qs[_0x3b7f('0x1e')](_0x3832c1[_0x3b7f('0x30')]['limit']);_0x495214['offset']=qs[_0x3b7f('0x1c')](_0x3832c1[_0x3b7f('0x30')][_0x3b7f('0x1c')]);}return _0x282798[_0x3b7f('0x4d')](_0x495214);}})[_0x3b7f('0x25')](function(_0x2a7324){if(_0x2a7324){return _0x2a7324?{'count':_0x58b9eb,'rows':_0x2a7324}:null;}})[_0x3b7f('0x25')](respondWithResult(_0x97d090,null))['catch'](handleError(_0x97d090,null));};exports[_0x3b7f('0x4e')]=function(_0x5bf7f3,_0x34dd0c,_0x1e65cd){var _0x4ea05a={};var _0x18747a={};var _0x473f93;var _0x732b0f;return db[_0x3b7f('0x2c')][_0x3b7f('0x4a')]({'where':{'id':_0x5bf7f3[_0x3b7f('0x48')]['id']}})[_0x3b7f('0x25')](handleEntityNotFound(_0x34dd0c,null))['then'](function(_0x4f84f4){if(_0x4f84f4){_0x473f93=_0x4f84f4;_0x18747a[_0x3b7f('0x2f')]=_[_0x3b7f('0x31')](db[_0x3b7f('0x4b')][_0x3b7f('0x2d')]);_0x18747a[_0x3b7f('0x30')]=_[_0x3b7f('0x31')](_0x5bf7f3[_0x3b7f('0x30')]);_0x18747a[_0x3b7f('0x32')]=_['intersection'](_0x18747a[_0x3b7f('0x2f')],_0x18747a[_0x3b7f('0x30')]);_0x4ea05a[_0x3b7f('0x34')]=_[_0x3b7f('0x33')](_0x18747a['model'],qs[_0x3b7f('0x35')](_0x5bf7f3['query'][_0x3b7f('0x35')]));_0x4ea05a[_0x3b7f('0x34')]=_0x4ea05a[_0x3b7f('0x34')]['length']?_0x4ea05a[_0x3b7f('0x34')]:_0x18747a[_0x3b7f('0x2f')];_0x4ea05a['order']=qs[_0x3b7f('0x38')](_0x5bf7f3[_0x3b7f('0x30')][_0x3b7f('0x38')]);_0x4ea05a[_0x3b7f('0x39')]=qs['filters'](_[_0x3b7f('0x3a')](_0x5bf7f3[_0x3b7f('0x30')],_0x18747a[_0x3b7f('0x32')]));if(_0x5bf7f3[_0x3b7f('0x30')][_0x3b7f('0x3b')]){_0x4ea05a[_0x3b7f('0x39')]=_[_0x3b7f('0x3e')](_0x4ea05a['where'],{'$or':_['map'](_0x4ea05a[_0x3b7f('0x34')],function(_0x419c05){var _0x5f34a2={};_0x5f34a2[_0x419c05]={'$like':'%'+_0x5bf7f3[_0x3b7f('0x30')][_0x3b7f('0x3b')]+'%'};return _0x5f34a2;})});}_0x4ea05a=_[_0x3b7f('0x3e')]({},_0x4ea05a,_0x5bf7f3['options']);return _0x473f93[_0x3b7f('0x4e')](_0x4ea05a);}})['then'](function(_0xcaf36d){if(_0xcaf36d){_0x732b0f=_0xcaf36d[_0x3b7f('0x45')];if(!_0x5bf7f3['query'][_0x3b7f('0x36')](_0x3b7f('0x4c'))){_0x4ea05a[_0x3b7f('0x1e')]=qs['limit'](_0x5bf7f3[_0x3b7f('0x30')][_0x3b7f('0x1e')]);_0x4ea05a[_0x3b7f('0x1c')]=qs[_0x3b7f('0x1c')](_0x5bf7f3[_0x3b7f('0x30')][_0x3b7f('0x1c')]);}return _0x473f93[_0x3b7f('0x4e')](_0x4ea05a);}})[_0x3b7f('0x25')](function(_0x149120){if(_0x149120){return _0x149120?{'count':_0x732b0f,'rows':_0x149120}:null;}})[_0x3b7f('0x25')](respondWithResult(_0x34dd0c,null))[_0x3b7f('0x43')](handleError(_0x34dd0c,null));}; \ No newline at end of file +var _0x2746=['ServicenowConfiguration','findAll','rows','show','params','rawAttributes','keys','options','create','body','catch','find','getFields','findOne','ServicenowField','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','moment','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','offset','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','type','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','include'];(function(_0x325e3d,_0x2c82b9){var _0x3285a5=function(_0x1528fc){while(--_0x1528fc){_0x325e3d['push'](_0x325e3d['shift']());}};_0x3285a5(++_0x2c82b9);}(_0x2746,0xb5));var _0x6274=function(_0x11e8ef,_0x4d8150){_0x11e8ef=_0x11e8ef-0x0;var _0x227d07=_0x2746[_0x11e8ef];return _0x227d07;};'use strict';var emlformat=require(_0x6274('0x0'));var rimraf=require(_0x6274('0x1'));var zipdir=require(_0x6274('0x2'));var jsonpatch=require(_0x6274('0x3'));var rp=require('request-promise');var moment=require(_0x6274('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x6274('0x5'));var sox=require(_0x6274('0x6'));var csv=require(_0x6274('0x7'));var ejs=require(_0x6274('0x8'));var fs=require('fs');var fs_extra=require(_0x6274('0x9'));var _=require(_0x6274('0xa'));var squel=require('squel');var crypto=require(_0x6274('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x6274('0xc'));var toCsv=require('to-csv');var querystring=require(_0x6274('0xd'));var Papa=require(_0x6274('0xe'));var Redis=require(_0x6274('0xf'));var authService=require(_0x6274('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x6274('0x11'));var hardwareService=require(_0x6274('0x12'));var logger=require(_0x6274('0x13'))(_0x6274('0x14'));var utils=require(_0x6274('0x15'));var config=require(_0x6274('0x16'));var licenseUtil=require(_0x6274('0x17'));var db=require(_0x6274('0x18'))['db'];function respondWithStatusCode(_0x4c35b2,_0x2d1d1e){_0x2d1d1e=_0x2d1d1e||0xcc;return function(_0x1421a2){if(_0x1421a2){return _0x4c35b2['sendStatus'](_0x2d1d1e);}return _0x4c35b2[_0x6274('0x19')](_0x2d1d1e)[_0x6274('0x1a')]();};}function respondWithResult(_0x1f2a0a,_0x14d93a){_0x14d93a=_0x14d93a||0xc8;return function(_0x50c7d7){if(_0x50c7d7){return _0x1f2a0a[_0x6274('0x19')](_0x14d93a)[_0x6274('0x1b')](_0x50c7d7);}};}function respondWithFilteredResult(_0x1a2ab1,_0x4e4e55){return function(_0x1fb7c4){if(_0x1fb7c4){var _0x1c0eb6=typeof _0x4e4e55['offset']===_0x6274('0x1c')&&typeof _0x4e4e55[_0x6274('0x1d')]==='undefined';var _0x24d392=_0x1fb7c4['count'];var _0x2e0147=_0x1c0eb6?0x0:_0x4e4e55[_0x6274('0x1e')];var _0x181b46=_0x1c0eb6?_0x1fb7c4['count']:_0x4e4e55[_0x6274('0x1e')]+_0x4e4e55[_0x6274('0x1d')];var _0x3144db;if(_0x181b46>=_0x24d392){_0x181b46=_0x24d392;_0x3144db=0xc8;}else{_0x3144db=0xce;}_0x1a2ab1[_0x6274('0x19')](_0x3144db);return _0x1a2ab1['set'](_0x6274('0x1f'),_0x2e0147+'-'+_0x181b46+'/'+_0x24d392)[_0x6274('0x1b')](_0x1fb7c4);}return null;};}function patchUpdates(_0x573c59){return function(_0x4ed021){try{jsonpatch[_0x6274('0x20')](_0x4ed021,_0x573c59,!![]);}catch(_0x1f478b){return BPromise[_0x6274('0x21')](_0x1f478b);}return _0x4ed021[_0x6274('0x22')]();};}function saveUpdates(_0x29d796,_0xce9b66){return function(_0x17a15a){if(_0x17a15a){return _0x17a15a[_0x6274('0x23')](_0x29d796)[_0x6274('0x24')](function(_0x358a96){return _0x358a96;});}return null;};}function removeEntity(_0x3f0729,_0x352253){return function(_0x2881cd){if(_0x2881cd){return _0x2881cd[_0x6274('0x25')]()[_0x6274('0x24')](function(){_0x3f0729[_0x6274('0x19')](0xcc)[_0x6274('0x1a')]();});}};}function handleEntityNotFound(_0x284eb4,_0x22942e){return function(_0x2ebbff){if(!_0x2ebbff){_0x284eb4[_0x6274('0x26')](0x194);}return _0x2ebbff;};}function handleError(_0x3c922e,_0x3f578b){_0x3f578b=_0x3f578b||0x1f4;return function(_0x2a0bfd){logger[_0x6274('0x27')](_0x2a0bfd[_0x6274('0x28')]);if(_0x2a0bfd['name']){delete _0x2a0bfd[_0x6274('0x29')];}_0x3c922e[_0x6274('0x19')](_0x3f578b)[_0x6274('0x2a')](_0x2a0bfd);};}exports[_0x6274('0x2b')]=function(_0x26ac33,_0x50fdec){var _0x404a1c={},_0x3b78c9={},_0x56d73d={'count':0x0,'rows':[]};var _0x22cd3b=_['map'](db['ServicenowConfiguration']['rawAttributes'],function(_0x3fea8e){return{'name':_0x3fea8e['fieldName'],'type':_0x3fea8e[_0x6274('0x2c')]['key']};});_0x3b78c9[_0x6274('0x2d')]=_[_0x6274('0x2e')](_0x22cd3b,_0x6274('0x29'));_0x3b78c9[_0x6274('0x2f')]=_['keys'](_0x26ac33[_0x6274('0x2f')]);_0x3b78c9[_0x6274('0x30')]=_[_0x6274('0x31')](_0x3b78c9[_0x6274('0x2d')],_0x3b78c9['query']);_0x404a1c[_0x6274('0x32')]=_[_0x6274('0x31')](_0x3b78c9[_0x6274('0x2d')],qs[_0x6274('0x33')](_0x26ac33[_0x6274('0x2f')][_0x6274('0x33')]));_0x404a1c[_0x6274('0x32')]=_0x404a1c[_0x6274('0x32')][_0x6274('0x34')]?_0x404a1c[_0x6274('0x32')]:_0x3b78c9['model'];if(!_0x26ac33['query'][_0x6274('0x35')](_0x6274('0x36'))){_0x404a1c['limit']=qs[_0x6274('0x1d')](_0x26ac33[_0x6274('0x2f')][_0x6274('0x1d')]);_0x404a1c['offset']=qs['offset'](_0x26ac33['query'][_0x6274('0x1e')]);}_0x404a1c[_0x6274('0x37')]=qs[_0x6274('0x38')](_0x26ac33[_0x6274('0x2f')][_0x6274('0x38')]);_0x404a1c[_0x6274('0x39')]=qs[_0x6274('0x30')](_[_0x6274('0x3a')](_0x26ac33[_0x6274('0x2f')],_0x3b78c9[_0x6274('0x30')]),_0x22cd3b);if(_0x26ac33[_0x6274('0x2f')][_0x6274('0x3b')]){_0x404a1c[_0x6274('0x39')]=_[_0x6274('0x3c')](_0x404a1c['where'],{'$or':_['map'](_0x22cd3b,function(_0x44775f){if(_0x44775f[_0x6274('0x2c')]!==_0x6274('0x3d')){var _0x578856={};_0x578856[_0x44775f[_0x6274('0x29')]]={'$like':'%'+_0x26ac33[_0x6274('0x2f')][_0x6274('0x3b')]+'%'};return _0x578856;}})});}_0x404a1c=_['merge']({},_0x404a1c,_0x26ac33['options']);var _0xf57cc2={'where':_0x404a1c[_0x6274('0x39')]};return db['ServicenowConfiguration'][_0x6274('0x3e')](_0xf57cc2)[_0x6274('0x24')](function(_0x3d6f63){_0x56d73d['count']=_0x3d6f63;if(_0x26ac33[_0x6274('0x2f')][_0x6274('0x3f')]){_0x404a1c[_0x6274('0x40')]=[{'all':!![]}];}return db[_0x6274('0x41')][_0x6274('0x42')](_0x404a1c);})[_0x6274('0x24')](function(_0x57eeb2){_0x56d73d[_0x6274('0x43')]=_0x57eeb2;return _0x56d73d;})[_0x6274('0x24')](respondWithFilteredResult(_0x50fdec,_0x404a1c))['catch'](handleError(_0x50fdec,null));};exports[_0x6274('0x44')]=function(_0x3a06fa,_0x20f459){var _0x539592={'raw':![],'where':{'id':_0x3a06fa[_0x6274('0x45')]['id']}},_0x36713b={};_0x36713b[_0x6274('0x2d')]=_['keys'](db['ServicenowConfiguration'][_0x6274('0x46')]);_0x36713b[_0x6274('0x2f')]=_[_0x6274('0x47')](_0x3a06fa[_0x6274('0x2f')]);_0x36713b[_0x6274('0x30')]=_[_0x6274('0x31')](_0x36713b[_0x6274('0x2d')],_0x36713b[_0x6274('0x2f')]);_0x539592[_0x6274('0x32')]=_['intersection'](_0x36713b[_0x6274('0x2d')],qs['fields'](_0x3a06fa[_0x6274('0x2f')]['fields']));_0x539592[_0x6274('0x32')]=_0x539592[_0x6274('0x32')][_0x6274('0x34')]?_0x539592[_0x6274('0x32')]:_0x36713b[_0x6274('0x2d')];if(_0x3a06fa[_0x6274('0x2f')][_0x6274('0x3f')]){_0x539592['include']=[{'all':!![]}];}_0x539592=_['merge']({},_0x539592,_0x3a06fa[_0x6274('0x48')]);return db[_0x6274('0x41')]['find'](_0x539592)[_0x6274('0x24')](handleEntityNotFound(_0x20f459,null))[_0x6274('0x24')](respondWithResult(_0x20f459,null))['catch'](handleError(_0x20f459,null));};exports[_0x6274('0x49')]=function(_0x4c08a9,_0x946530){return db[_0x6274('0x41')][_0x6274('0x49')](_0x4c08a9[_0x6274('0x4a')],{})['then'](respondWithResult(_0x946530,0xc9))[_0x6274('0x4b')](handleError(_0x946530,null));};exports[_0x6274('0x23')]=function(_0x60befe,_0x4aadf){if(_0x60befe[_0x6274('0x4a')]['id']){delete _0x60befe[_0x6274('0x4a')]['id'];}return db['ServicenowConfiguration'][_0x6274('0x4c')]({'where':{'id':_0x60befe[_0x6274('0x45')]['id']}})[_0x6274('0x24')](handleEntityNotFound(_0x4aadf,null))[_0x6274('0x24')](saveUpdates(_0x60befe[_0x6274('0x4a')],null))[_0x6274('0x24')](respondWithResult(_0x4aadf,null))[_0x6274('0x4b')](handleError(_0x4aadf,null));};exports[_0x6274('0x25')]=function(_0x3fc897,_0x44a293){return db[_0x6274('0x41')][_0x6274('0x4c')]({'where':{'id':_0x3fc897['params']['id']}})[_0x6274('0x24')](handleEntityNotFound(_0x44a293,null))[_0x6274('0x24')](removeEntity(_0x44a293,null))[_0x6274('0x4b')](handleError(_0x44a293,null));};exports[_0x6274('0x4d')]=function(_0x4cc4e6,_0x159c54,_0xab701){var _0x1865c5={};var _0xb4a600={};var _0x4a4894;var _0x1b548a;return db[_0x6274('0x41')][_0x6274('0x4e')]({'where':{'id':_0x4cc4e6[_0x6274('0x45')]['id']}})[_0x6274('0x24')](handleEntityNotFound(_0x159c54,null))[_0x6274('0x24')](function(_0x544195){if(_0x544195){_0x4a4894=_0x544195;_0xb4a600[_0x6274('0x2d')]=_[_0x6274('0x47')](db[_0x6274('0x4f')]['rawAttributes']);_0xb4a600['query']=_['keys'](_0x4cc4e6[_0x6274('0x2f')]);_0xb4a600[_0x6274('0x30')]=_['intersection'](_0xb4a600[_0x6274('0x2d')],_0xb4a600[_0x6274('0x2f')]);_0x1865c5[_0x6274('0x32')]=_[_0x6274('0x31')](_0xb4a600[_0x6274('0x2d')],qs[_0x6274('0x33')](_0x4cc4e6['query'][_0x6274('0x33')]));_0x1865c5[_0x6274('0x32')]=_0x1865c5['attributes'][_0x6274('0x34')]?_0x1865c5[_0x6274('0x32')]:_0xb4a600['model'];_0x1865c5['order']=qs[_0x6274('0x38')](_0x4cc4e6[_0x6274('0x2f')]['sort']);_0x1865c5[_0x6274('0x39')]=qs[_0x6274('0x30')](_[_0x6274('0x3a')](_0x4cc4e6[_0x6274('0x2f')],_0xb4a600[_0x6274('0x30')]));if(_0x4cc4e6[_0x6274('0x2f')]['filter']){_0x1865c5[_0x6274('0x39')]=_['merge'](_0x1865c5[_0x6274('0x39')],{'$or':_[_0x6274('0x2e')](_0x1865c5[_0x6274('0x32')],function(_0x56e9cf){var _0xf9b8a={};_0xf9b8a[_0x56e9cf]={'$like':'%'+_0x4cc4e6[_0x6274('0x2f')]['filter']+'%'};return _0xf9b8a;})});}_0x1865c5=_[_0x6274('0x3c')]({},_0x1865c5,_0x4cc4e6[_0x6274('0x48')]);return _0x4a4894[_0x6274('0x4d')](_0x1865c5);}})[_0x6274('0x24')](function(_0x26265d){if(_0x26265d){_0x1b548a=_0x26265d[_0x6274('0x34')];if(!_0x4cc4e6['query'][_0x6274('0x35')](_0x6274('0x36'))){_0x1865c5['limit']=qs[_0x6274('0x1d')](_0x4cc4e6[_0x6274('0x2f')]['limit']);_0x1865c5[_0x6274('0x1e')]=qs[_0x6274('0x1e')](_0x4cc4e6[_0x6274('0x2f')][_0x6274('0x1e')]);}return _0x4a4894[_0x6274('0x4d')](_0x1865c5);}})['then'](function(_0x43d4ea){if(_0x43d4ea){return _0x43d4ea?{'count':_0x1b548a,'rows':_0x43d4ea}:null;}})[_0x6274('0x24')](respondWithResult(_0x159c54,null))[_0x6274('0x4b')](handleError(_0x159c54,null));};exports['getSubjects']=function(_0x21caf6,_0x157a8a,_0x16aee4){var _0x1cadf7={};var _0x4a2f35={};var _0x53b7e5;var _0x34873f;return db[_0x6274('0x41')][_0x6274('0x4e')]({'where':{'id':_0x21caf6[_0x6274('0x45')]['id']}})[_0x6274('0x24')](handleEntityNotFound(_0x157a8a,null))[_0x6274('0x24')](function(_0x4a8afd){if(_0x4a8afd){_0x53b7e5=_0x4a8afd;_0x4a2f35[_0x6274('0x2d')]=_[_0x6274('0x47')](db['ServicenowField']['rawAttributes']);_0x4a2f35['query']=_[_0x6274('0x47')](_0x21caf6[_0x6274('0x2f')]);_0x4a2f35[_0x6274('0x30')]=_[_0x6274('0x31')](_0x4a2f35[_0x6274('0x2d')],_0x4a2f35[_0x6274('0x2f')]);_0x1cadf7[_0x6274('0x32')]=_[_0x6274('0x31')](_0x4a2f35['model'],qs[_0x6274('0x33')](_0x21caf6[_0x6274('0x2f')][_0x6274('0x33')]));_0x1cadf7[_0x6274('0x32')]=_0x1cadf7['attributes']['length']?_0x1cadf7[_0x6274('0x32')]:_0x4a2f35[_0x6274('0x2d')];_0x1cadf7['order']=qs['sort'](_0x21caf6[_0x6274('0x2f')]['sort']);_0x1cadf7[_0x6274('0x39')]=qs[_0x6274('0x30')](_[_0x6274('0x3a')](_0x21caf6[_0x6274('0x2f')],_0x4a2f35[_0x6274('0x30')]));if(_0x21caf6[_0x6274('0x2f')][_0x6274('0x3b')]){_0x1cadf7[_0x6274('0x39')]=_[_0x6274('0x3c')](_0x1cadf7['where'],{'$or':_[_0x6274('0x2e')](_0x1cadf7[_0x6274('0x32')],function(_0x408821){var _0x24add3={};_0x24add3[_0x408821]={'$like':'%'+_0x21caf6[_0x6274('0x2f')][_0x6274('0x3b')]+'%'};return _0x24add3;})});}_0x1cadf7=_[_0x6274('0x3c')]({},_0x1cadf7,_0x21caf6[_0x6274('0x48')]);return _0x53b7e5[_0x6274('0x50')](_0x1cadf7);}})[_0x6274('0x24')](function(_0x4991f3){if(_0x4991f3){_0x34873f=_0x4991f3['length'];if(!_0x21caf6[_0x6274('0x2f')][_0x6274('0x35')](_0x6274('0x36'))){_0x1cadf7['limit']=qs[_0x6274('0x1d')](_0x21caf6[_0x6274('0x2f')][_0x6274('0x1d')]);_0x1cadf7[_0x6274('0x1e')]=qs[_0x6274('0x1e')](_0x21caf6[_0x6274('0x2f')][_0x6274('0x1e')]);}return _0x53b7e5[_0x6274('0x50')](_0x1cadf7);}})[_0x6274('0x24')](function(_0x585f42){if(_0x585f42){return _0x585f42?{'count':_0x34873f,'rows':_0x585f42}:null;}})[_0x6274('0x24')](respondWithResult(_0x157a8a,null))[_0x6274('0x4b')](handleError(_0x157a8a,null));};exports[_0x6274('0x51')]=function(_0x52cab7,_0x28c55e,_0x384ff4){var _0x208144={};var _0x19ca4a={};var _0x4dcc4f;var _0x114fee;return db[_0x6274('0x41')][_0x6274('0x4e')]({'where':{'id':_0x52cab7[_0x6274('0x45')]['id']}})[_0x6274('0x24')](handleEntityNotFound(_0x28c55e,null))['then'](function(_0x71377a){if(_0x71377a){_0x4dcc4f=_0x71377a;_0x19ca4a['model']=_[_0x6274('0x47')](db['ServicenowField'][_0x6274('0x46')]);_0x19ca4a[_0x6274('0x2f')]=_[_0x6274('0x47')](_0x52cab7[_0x6274('0x2f')]);_0x19ca4a[_0x6274('0x30')]=_[_0x6274('0x31')](_0x19ca4a[_0x6274('0x2d')],_0x19ca4a[_0x6274('0x2f')]);_0x208144['attributes']=_[_0x6274('0x31')](_0x19ca4a[_0x6274('0x2d')],qs[_0x6274('0x33')](_0x52cab7[_0x6274('0x2f')][_0x6274('0x33')]));_0x208144[_0x6274('0x32')]=_0x208144[_0x6274('0x32')][_0x6274('0x34')]?_0x208144[_0x6274('0x32')]:_0x19ca4a[_0x6274('0x2d')];_0x208144[_0x6274('0x37')]=qs['sort'](_0x52cab7['query']['sort']);_0x208144['where']=qs['filters'](_[_0x6274('0x3a')](_0x52cab7[_0x6274('0x2f')],_0x19ca4a[_0x6274('0x30')]));if(_0x52cab7[_0x6274('0x2f')][_0x6274('0x3b')]){_0x208144[_0x6274('0x39')]=_[_0x6274('0x3c')](_0x208144[_0x6274('0x39')],{'$or':_[_0x6274('0x2e')](_0x208144[_0x6274('0x32')],function(_0x3ec87b){var _0x1f6944={};_0x1f6944[_0x3ec87b]={'$like':'%'+_0x52cab7[_0x6274('0x2f')][_0x6274('0x3b')]+'%'};return _0x1f6944;})});}_0x208144=_[_0x6274('0x3c')]({},_0x208144,_0x52cab7[_0x6274('0x48')]);return _0x4dcc4f['getDescriptions'](_0x208144);}})[_0x6274('0x24')](function(_0x2eaf4c){if(_0x2eaf4c){_0x114fee=_0x2eaf4c[_0x6274('0x34')];if(!_0x52cab7['query']['hasOwnProperty'](_0x6274('0x36'))){_0x208144['limit']=qs['limit'](_0x52cab7['query'][_0x6274('0x1d')]);_0x208144[_0x6274('0x1e')]=qs[_0x6274('0x1e')](_0x52cab7[_0x6274('0x2f')]['offset']);}return _0x4dcc4f['getDescriptions'](_0x208144);}})[_0x6274('0x24')](function(_0x4b081e){if(_0x4b081e){return _0x4b081e?{'count':_0x114fee,'rows':_0x4b081e}:null;}})[_0x6274('0x24')](respondWithResult(_0x28c55e,null))[_0x6274('0x4b')](handleError(_0x28c55e,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 938b19d..7a3398c 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 _0xd506=['rimraf','define','int_servicenow_configurations','lodash'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xd506,0x197));var _0x6d50=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xd506[_0x4ea69d];return _0x5318e0;};'use strict';var _=require(_0x6d50('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6d50('0x1'));var config=require('../../config/environment');var attributes=require('./intServicenowConfiguration.attributes');module['exports']=function(_0x167f4e,_0x23c343){return _0x167f4e[_0x6d50('0x2')]('ServicenowConfiguration',attributes,{'tableName':_0x6d50('0x3'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9672=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./intServicenowConfiguration.attributes','define','ServicenowConfiguration','int_servicenow_configurations','lodash','util'];(function(_0x223d59,_0x200318){var _0x25ef82=function(_0x298401){while(--_0x298401){_0x223d59['push'](_0x223d59['shift']());}};_0x25ef82(++_0x200318);}(_0x9672,0xee));var _0x2967=function(_0x3e2193,_0x377c4c){_0x3e2193=_0x3e2193-0x0;var _0x385da8=_0x9672[_0x3e2193];return _0x385da8;};'use strict';var _=require(_0x2967('0x0'));var util=require(_0x2967('0x1'));var logger=require('../../config/logger')(_0x2967('0x2'));var moment=require(_0x2967('0x3'));var BPromise=require(_0x2967('0x4'));var rp=require(_0x2967('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2967('0x6'));var config=require(_0x2967('0x7'));var attributes=require(_0x2967('0x8'));module['exports']=function(_0x4baad7,_0x24424d){return _0x4baad7[_0x2967('0x9')](_0x2967('0xa'),attributes,{'tableName':_0x2967('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js index d673a47..29aa0ed 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 _0x6afc=['stringify','error','message','info','result','catch','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','ServicenowConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x2fc012,_0x503e5b){var _0x2891f9=function(_0x295f5e){while(--_0x295f5e){_0x2fc012['push'](_0x2fc012['shift']());}};_0x2891f9(++_0x503e5b);}(_0x6afc,0x16b));var _0xc6af=function(_0x3167e6,_0x45b0ec){_0x3167e6=_0x3167e6-0x0;var _0x5cedc7=_0x6afc[_0x3167e6];return _0x5cedc7;};'use strict';var _=require(_0xc6af('0x0'));var util=require('util');var moment=require(_0xc6af('0x1'));var BPromise=require('bluebird');var rs=require(_0xc6af('0x2'));var fs=require('fs');var Redis=require(_0xc6af('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc6af('0x4'));var logger=require(_0xc6af('0x5'))(_0xc6af('0x6'));var config=require(_0xc6af('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xc6af('0x8')][_0xc6af('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3c0485,_0x6d4994,_0x3bfb71){return new BPromise(function(_0x117df9,_0x57811b){return client[_0xc6af('0xa')](_0x3c0485,_0x3bfb71)[_0xc6af('0xb')](function(_0x5363c2){logger['info'](_0xc6af('0xc'),_0x6d4994,_0xc6af('0xd'));logger['debug'](_0xc6af('0xe'),_0x6d4994,_0xc6af('0xd'),JSON[_0xc6af('0xf')](_0x5363c2));if(_0x5363c2['error']){if(_0x5363c2[_0xc6af('0x10')]['code']===0x1f4){logger[_0xc6af('0x10')](_0xc6af('0xc'),_0x6d4994,_0x5363c2[_0xc6af('0x10')][_0xc6af('0x11')]);return _0x57811b(_0x5363c2[_0xc6af('0x10')][_0xc6af('0x11')]);}logger[_0xc6af('0x10')](_0xc6af('0xc'),_0x6d4994,_0x5363c2['error'][_0xc6af('0x11')]);return _0x117df9(_0x5363c2[_0xc6af('0x10')][_0xc6af('0x11')]);}else{logger[_0xc6af('0x12')](_0xc6af('0xc'),_0x6d4994,_0xc6af('0xd'));_0x117df9(_0x5363c2[_0xc6af('0x13')][_0xc6af('0x11')]);}})[_0xc6af('0x14')](function(_0x125e3f){logger[_0xc6af('0x10')](_0xc6af('0xc'),_0x6d4994,_0x125e3f);_0x57811b(_0x125e3f);});});} \ No newline at end of file +var _0x378f=['bluebird','ioredis','../../mysqldb','../../config/logger','rpc','http','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','ServicenowConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','moment'];(function(_0x2faddb,_0xc18b78){var _0x273c05=function(_0x1a3785){while(--_0x1a3785){_0x2faddb['push'](_0x2faddb['shift']());}};_0x273c05(++_0xc18b78);}(_0x378f,0xc9));var _0xf378=function(_0x1a473f,_0x1f4e67){_0x1a473f=_0x1a473f-0x0;var _0x3fb212=_0x378f[_0x1a473f];return _0x3fb212;};'use strict';var _=require(_0xf378('0x0'));var util=require(_0xf378('0x1'));var moment=require(_0xf378('0x2'));var BPromise=require(_0xf378('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf378('0x4'));var db=require(_0xf378('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf378('0x6'))(_0xf378('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xf378('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x416467,_0x129d03,_0x5cbd63){return new BPromise(function(_0x9b1f5f,_0x8d8761){return client['request'](_0x416467,_0x5cbd63)['then'](function(_0x20ebc3){logger['info']('ServicenowConfiguration,\x20%s,\x20%s',_0x129d03,'request\x20sent');logger['debug'](_0xf378('0x9'),_0x129d03,_0xf378('0xa'),JSON[_0xf378('0xb')](_0x20ebc3));if(_0x20ebc3[_0xf378('0xc')]){if(_0x20ebc3[_0xf378('0xc')]['code']===0x1f4){logger[_0xf378('0xc')](_0xf378('0xd'),_0x129d03,_0x20ebc3[_0xf378('0xc')][_0xf378('0xe')]);return _0x8d8761(_0x20ebc3[_0xf378('0xc')][_0xf378('0xe')]);}logger[_0xf378('0xc')]('ServicenowConfiguration,\x20%s,\x20%s',_0x129d03,_0x20ebc3['error']['message']);return _0x9b1f5f(_0x20ebc3[_0xf378('0xc')][_0xf378('0xe')]);}else{logger['info'](_0xf378('0xd'),_0x129d03,_0xf378('0xa'));_0x9b1f5f(_0x20ebc3[_0xf378('0xf')][_0xf378('0xe')]);}})[_0xf378('0x10')](function(_0x3d97c6){logger[_0xf378('0xc')](_0xf378('0xd'),_0x129d03,_0x3d97c6);_0x8d8761(_0x3d97c6);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index aa2244c..970c5fb 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 _0x716f=['./intServicenowField.controller','get','index','isAuthenticated','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x5c8be0,_0x2ced5e){var _0x41fbc6=function(_0x9bd4c7){while(--_0x9bd4c7){_0x5c8be0['push'](_0x5c8be0['shift']());}};_0x41fbc6(++_0x2ced5e);}(_0x716f,0x19b));var _0xf716=function(_0x23b655,_0x4feb2b){_0x23b655=_0x23b655-0x0;var _0x364b32=_0x716f[_0x23b655];return _0x364b32;};'use strict';var multer=require(_0xf716('0x0'));var util=require(_0xf716('0x1'));var path=require(_0xf716('0x2'));var timeout=require(_0xf716('0x3'));var express=require(_0xf716('0x4'));var router=express[_0xf716('0x5')]();var fs_extra=require(_0xf716('0x6'));var auth=require(_0xf716('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xf716('0x8'));var controller=require(_0xf716('0x9'));router[_0xf716('0xa')]('/',auth['isAuthenticated'](),controller[_0xf716('0xb')]);router[_0xf716('0xa')]('/:id',auth[_0xf716('0xc')](),controller['show']);router[_0xf716('0xd')]('/',auth[_0xf716('0xc')](),controller[_0xf716('0xe')]);router[_0xf716('0xf')](_0xf716('0x10'),auth[_0xf716('0xc')](),controller[_0xf716('0x11')]);router[_0xf716('0x12')]('/:id',auth[_0xf716('0xc')](),controller[_0xf716('0x13')]);module[_0xf716('0x14')]=router; \ No newline at end of file +var _0x34de=['../../config/environment','./intServicenowField.controller','get','isAuthenticated','index','/:id','post','create','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x33314d,_0x499628){var _0x4ffe8e=function(_0xb1ec35){while(--_0xb1ec35){_0x33314d['push'](_0x33314d['shift']());}};_0x4ffe8e(++_0x499628);}(_0x34de,0x14e));var _0xe34d=function(_0x172ae4,_0x35f100){_0x172ae4=_0x172ae4-0x0;var _0x5e07eb=_0x34de[_0x172ae4];return _0x5e07eb;};'use strict';var multer=require(_0xe34d('0x0'));var util=require(_0xe34d('0x1'));var path=require(_0xe34d('0x2'));var timeout=require(_0xe34d('0x3'));var express=require(_0xe34d('0x4'));var router=express[_0xe34d('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xe34d('0x6'));var interaction=require(_0xe34d('0x7'));var config=require(_0xe34d('0x8'));var controller=require(_0xe34d('0x9'));router[_0xe34d('0xa')]('/',auth[_0xe34d('0xb')](),controller[_0xe34d('0xc')]);router['get'](_0xe34d('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xe34d('0xe')]('/',auth['isAuthenticated'](),controller[_0xe34d('0xf')]);router['put']('/:id',auth[_0xe34d('0xb')](),controller['update']);router['delete'](_0xe34d('0xd'),auth['isAuthenticated'](),controller[_0xe34d('0x10')]);module[_0xe34d('0x11')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index e91664e..6269686 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 _0xa6c6=['STRING','customVariable','sequelize','exports','ENUM','string','variable','picklist'];(function(_0x527a6c,_0x15b18d){var _0x4c780d=function(_0xebc03){while(--_0xebc03){_0x527a6c['push'](_0x527a6c['shift']());}};_0x4c780d(++_0x15b18d);}(_0xa6c6,0xba));var _0x6a6c=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xa6c6[_0x4b369d];return _0x571a98;};'use strict';var Sequelize=require(_0x6a6c('0x0'));module[_0x6a6c('0x1')]={'type':{'type':Sequelize[_0x6a6c('0x2')](_0x6a6c('0x3'),_0x6a6c('0x4'),'customVariable','keyValue',_0x6a6c('0x5')),'defaultValue':_0x6a6c('0x3')},'content':{'type':Sequelize[_0x6a6c('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x6a6c('0x2')](_0x6a6c('0x3'),'variable',_0x6a6c('0x7'))},'keyContent':{'type':Sequelize[_0x6a6c('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x6a6c('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x40ed=['exports','ENUM','string','variable','keyValue','picklist','STRING','customVariable','sequelize'];(function(_0x147eb2,_0x517881){var _0x361644=function(_0x32ea89){while(--_0x32ea89){_0x147eb2['push'](_0x147eb2['shift']());}};_0x361644(++_0x517881);}(_0x40ed,0x8f));var _0xd40e=function(_0x45ed52,_0x1c1b06){_0x45ed52=_0x45ed52-0x0;var _0x42bebe=_0x40ed[_0x45ed52];return _0x42bebe;};'use strict';var Sequelize=require(_0xd40e('0x0'));module[_0xd40e('0x1')]={'type':{'type':Sequelize[_0xd40e('0x2')](_0xd40e('0x3'),_0xd40e('0x4'),'customVariable',_0xd40e('0x5'),_0xd40e('0x6')),'defaultValue':_0xd40e('0x3')},'content':{'type':Sequelize[_0xd40e('0x7')]},'key':{'type':Sequelize[_0xd40e('0x7')]},'keyType':{'type':Sequelize['ENUM']('string','variable',_0xd40e('0x8'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xd40e('0x7')]},'nameField':{'type':Sequelize[_0xd40e('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 26e5f35..326f013 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 _0x0362=['squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','error','stack','name','send','index','ServicenowField','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','show','params','rawAttributes','options','find','catch','create','body','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','fs-extra','lodash'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x0362,0x8c));var _0x2036=function(_0xf78043,_0x5154d1){_0xf78043=_0xf78043-0x0;var _0xff3a16=_0x0362[_0xf78043];return _0xff3a16;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x2036('0x0'));var jsonpatch=require(_0x2036('0x1'));var rp=require(_0x2036('0x2'));var moment=require('moment');var BPromise=require(_0x2036('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x2036('0x4'));var sox=require(_0x2036('0x5'));var csv=require(_0x2036('0x6'));var ejs=require(_0x2036('0x7'));var fs=require('fs');var fs_extra=require(_0x2036('0x8'));var _=require(_0x2036('0x9'));var squel=require(_0x2036('0xa'));var crypto=require(_0x2036('0xb'));var jsforce=require(_0x2036('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x2036('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x2036('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x2036('0xf'));var hardwareService=require(_0x2036('0x10'));var logger=require(_0x2036('0x11'))(_0x2036('0x12'));var utils=require(_0x2036('0x13'));var config=require(_0x2036('0x14'));var licenseUtil=require(_0x2036('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3dd403,_0x182100){_0x182100=_0x182100||0xcc;return function(_0x33a8de){if(_0x33a8de){return _0x3dd403['sendStatus'](_0x182100);}return _0x3dd403[_0x2036('0x16')](_0x182100)[_0x2036('0x17')]();};}function respondWithResult(_0x2bebbc,_0x12db36){_0x12db36=_0x12db36||0xc8;return function(_0x45d374){if(_0x45d374){return _0x2bebbc[_0x2036('0x16')](_0x12db36)[_0x2036('0x18')](_0x45d374);}};}function respondWithFilteredResult(_0x4f4305,_0x5152db){return function(_0x5a5b4b){if(_0x5a5b4b){var _0x38deae=typeof _0x5152db['offset']===_0x2036('0x19')&&typeof _0x5152db['limit']===_0x2036('0x19');var _0xc7efc9=_0x5a5b4b[_0x2036('0x1a')];var _0xea56c3=_0x38deae?0x0:_0x5152db[_0x2036('0x1b')];var _0xb67e45=_0x38deae?_0x5a5b4b[_0x2036('0x1a')]:_0x5152db[_0x2036('0x1b')]+_0x5152db[_0x2036('0x1c')];var _0x976d71;if(_0xb67e45>=_0xc7efc9){_0xb67e45=_0xc7efc9;_0x976d71=0xc8;}else{_0x976d71=0xce;}_0x4f4305[_0x2036('0x16')](_0x976d71);return _0x4f4305[_0x2036('0x1d')](_0x2036('0x1e'),_0xea56c3+'-'+_0xb67e45+'/'+_0xc7efc9)[_0x2036('0x18')](_0x5a5b4b);}return null;};}function patchUpdates(_0x2bdd9a){return function(_0x166bd4){try{jsonpatch[_0x2036('0x1f')](_0x166bd4,_0x2bdd9a,!![]);}catch(_0x213552){return BPromise[_0x2036('0x20')](_0x213552);}return _0x166bd4[_0x2036('0x21')]();};}function saveUpdates(_0x3302a5,_0x3849a6){return function(_0x4633aa){if(_0x4633aa){return _0x4633aa[_0x2036('0x22')](_0x3302a5)['then'](function(_0x512d01){return _0x512d01;});}return null;};}function removeEntity(_0x20fc26,_0x6f8114){return function(_0x1fe036){if(_0x1fe036){return _0x1fe036[_0x2036('0x23')]()[_0x2036('0x24')](function(){_0x20fc26[_0x2036('0x16')](0xcc)[_0x2036('0x17')]();});}};}function handleEntityNotFound(_0x22c7aa,_0x513ac9){return function(_0x16f8f8){if(!_0x16f8f8){_0x22c7aa[_0x2036('0x25')](0x194);}return _0x16f8f8;};}function handleError(_0x2afdd6,_0x2d518e){_0x2d518e=_0x2d518e||0x1f4;return function(_0x4ba4dc){logger[_0x2036('0x26')](_0x4ba4dc[_0x2036('0x27')]);if(_0x4ba4dc['name']){delete _0x4ba4dc[_0x2036('0x28')];}_0x2afdd6[_0x2036('0x16')](_0x2d518e)[_0x2036('0x29')](_0x4ba4dc);};}exports[_0x2036('0x2a')]=function(_0x11f164,_0x4a699c){var _0x429abf={},_0x56955d={},_0xc48af7={'count':0x0,'rows':[]};var _0x5187af=_['map'](db[_0x2036('0x2b')]['rawAttributes'],function(_0x391343){return{'name':_0x391343[_0x2036('0x2c')],'type':_0x391343[_0x2036('0x2d')][_0x2036('0x2e')]};});_0x56955d[_0x2036('0x2f')]=_[_0x2036('0x30')](_0x5187af,_0x2036('0x28'));_0x56955d[_0x2036('0x31')]=_[_0x2036('0x32')](_0x11f164[_0x2036('0x31')]);_0x56955d[_0x2036('0x33')]=_[_0x2036('0x34')](_0x56955d['model'],_0x56955d['query']);_0x429abf['attributes']=_['intersection'](_0x56955d['model'],qs[_0x2036('0x35')](_0x11f164[_0x2036('0x31')]['fields']));_0x429abf[_0x2036('0x36')]=_0x429abf[_0x2036('0x36')][_0x2036('0x37')]?_0x429abf[_0x2036('0x36')]:_0x56955d[_0x2036('0x2f')];if(!_0x11f164[_0x2036('0x31')][_0x2036('0x38')](_0x2036('0x39'))){_0x429abf[_0x2036('0x1c')]=qs[_0x2036('0x1c')](_0x11f164['query'][_0x2036('0x1c')]);_0x429abf[_0x2036('0x1b')]=qs[_0x2036('0x1b')](_0x11f164[_0x2036('0x31')][_0x2036('0x1b')]);}_0x429abf[_0x2036('0x3a')]=qs['sort'](_0x11f164['query'][_0x2036('0x3b')]);_0x429abf[_0x2036('0x3c')]=qs[_0x2036('0x33')](_[_0x2036('0x3d')](_0x11f164[_0x2036('0x31')],_0x56955d[_0x2036('0x33')]),_0x5187af);if(_0x11f164[_0x2036('0x31')][_0x2036('0x3e')]){_0x429abf[_0x2036('0x3c')]=_[_0x2036('0x3f')](_0x429abf[_0x2036('0x3c')],{'$or':_[_0x2036('0x30')](_0x5187af,function(_0x52a8d1){if(_0x52a8d1[_0x2036('0x2d')]!==_0x2036('0x40')){var _0x3e403b={};_0x3e403b[_0x52a8d1[_0x2036('0x28')]]={'$like':'%'+_0x11f164['query'][_0x2036('0x3e')]+'%'};return _0x3e403b;}})});}_0x429abf=_[_0x2036('0x3f')]({},_0x429abf,_0x11f164['options']);var _0x2b540c={'where':_0x429abf[_0x2036('0x3c')]};return db[_0x2036('0x2b')][_0x2036('0x1a')](_0x2b540c)[_0x2036('0x24')](function(_0x4bcbe4){_0xc48af7[_0x2036('0x1a')]=_0x4bcbe4;if(_0x11f164[_0x2036('0x31')][_0x2036('0x41')]){_0x429abf[_0x2036('0x42')]=[{'all':!![]}];}return db[_0x2036('0x2b')]['findAll'](_0x429abf);})[_0x2036('0x24')](function(_0x4735ac){_0xc48af7['rows']=_0x4735ac;return _0xc48af7;})[_0x2036('0x24')](respondWithFilteredResult(_0x4a699c,_0x429abf))['catch'](handleError(_0x4a699c,null));};exports[_0x2036('0x43')]=function(_0x5936b6,_0x52c528){var _0x9213be={'raw':!![],'where':{'id':_0x5936b6[_0x2036('0x44')]['id']}},_0x5a6192={};_0x5a6192[_0x2036('0x2f')]=_[_0x2036('0x32')](db[_0x2036('0x2b')][_0x2036('0x45')]);_0x5a6192[_0x2036('0x31')]=_['keys'](_0x5936b6[_0x2036('0x31')]);_0x5a6192['filters']=_[_0x2036('0x34')](_0x5a6192['model'],_0x5a6192[_0x2036('0x31')]);_0x9213be[_0x2036('0x36')]=_[_0x2036('0x34')](_0x5a6192[_0x2036('0x2f')],qs[_0x2036('0x35')](_0x5936b6[_0x2036('0x31')]['fields']));_0x9213be[_0x2036('0x36')]=_0x9213be[_0x2036('0x36')][_0x2036('0x37')]?_0x9213be[_0x2036('0x36')]:_0x5a6192['model'];if(_0x5936b6['query'][_0x2036('0x41')]){_0x9213be[_0x2036('0x42')]=[{'all':!![]}];}_0x9213be=_['merge']({},_0x9213be,_0x5936b6[_0x2036('0x46')]);return db[_0x2036('0x2b')][_0x2036('0x47')](_0x9213be)['then'](handleEntityNotFound(_0x52c528,null))['then'](respondWithResult(_0x52c528,null))[_0x2036('0x48')](handleError(_0x52c528,null));};exports[_0x2036('0x49')]=function(_0x4e004f,_0x1510aa){return db[_0x2036('0x2b')][_0x2036('0x49')](_0x4e004f[_0x2036('0x4a')],{})['then'](respondWithResult(_0x1510aa,0xc9))[_0x2036('0x48')](handleError(_0x1510aa,null));};exports[_0x2036('0x22')]=function(_0x3dc272,_0x13002f){if(_0x3dc272['body']['id']){delete _0x3dc272[_0x2036('0x4a')]['id'];}return db[_0x2036('0x2b')][_0x2036('0x47')]({'where':{'id':_0x3dc272[_0x2036('0x44')]['id']}})[_0x2036('0x24')](handleEntityNotFound(_0x13002f,null))[_0x2036('0x24')](saveUpdates(_0x3dc272[_0x2036('0x4a')],null))[_0x2036('0x24')](respondWithResult(_0x13002f,null))['catch'](handleError(_0x13002f,null));};exports[_0x2036('0x23')]=function(_0x2a7715,_0x5bf60f){return db[_0x2036('0x2b')][_0x2036('0x47')]({'where':{'id':_0x2a7715['params']['id']}})[_0x2036('0x24')](handleEntityNotFound(_0x5bf60f,null))[_0x2036('0x24')](removeEntity(_0x5bf60f,null))[_0x2036('0x48')](handleError(_0x5bf60f,null));}; \ No newline at end of file +var _0xe7c7=['limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','error','name','send','index','map','ServicenowField','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','catch','params','includeAll','create','body','find','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset'];(function(_0x24de89,_0x5d6491){var _0x42b287=function(_0x3f9478){while(--_0x3f9478){_0x24de89['push'](_0x24de89['shift']());}};_0x42b287(++_0x5d6491);}(_0xe7c7,0x10b));var _0x7e7c=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xe7c7[_0x413feb];return _0x40ee88;};'use strict';var emlformat=require(_0x7e7c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7e7c('0x1'));var jsonpatch=require(_0x7e7c('0x2'));var rp=require(_0x7e7c('0x3'));var moment=require(_0x7e7c('0x4'));var BPromise=require(_0x7e7c('0x5'));var Mustache=require(_0x7e7c('0x6'));var util=require(_0x7e7c('0x7'));var path=require(_0x7e7c('0x8'));var sox=require(_0x7e7c('0x9'));var csv=require('to-csv');var ejs=require(_0x7e7c('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x7e7c('0xb'));var crypto=require(_0x7e7c('0xc'));var jsforce=require(_0x7e7c('0xd'));var deskjs=require(_0x7e7c('0xe'));var toCsv=require(_0x7e7c('0xf'));var querystring=require('querystring');var Papa=require(_0x7e7c('0x10'));var Redis=require(_0x7e7c('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x7e7c('0x12'));var hardwareService=require(_0x7e7c('0x13'));var logger=require(_0x7e7c('0x14'))(_0x7e7c('0x15'));var utils=require(_0x7e7c('0x16'));var config=require(_0x7e7c('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1ea808,_0x36b978){_0x36b978=_0x36b978||0xcc;return function(_0x536850){if(_0x536850){return _0x1ea808[_0x7e7c('0x18')](_0x36b978);}return _0x1ea808[_0x7e7c('0x19')](_0x36b978)[_0x7e7c('0x1a')]();};}function respondWithResult(_0x321282,_0x75dc38){_0x75dc38=_0x75dc38||0xc8;return function(_0x1056a8){if(_0x1056a8){return _0x321282[_0x7e7c('0x19')](_0x75dc38)[_0x7e7c('0x1b')](_0x1056a8);}};}function respondWithFilteredResult(_0x55cecf,_0x17732d){return function(_0x21b6b7){if(_0x21b6b7){var _0x211e3d=typeof _0x17732d[_0x7e7c('0x1c')]==='undefined'&&typeof _0x17732d[_0x7e7c('0x1d')]===_0x7e7c('0x1e');var _0xe0562=_0x21b6b7['count'];var _0x4fe236=_0x211e3d?0x0:_0x17732d[_0x7e7c('0x1c')];var _0x23d564=_0x211e3d?_0x21b6b7[_0x7e7c('0x1f')]:_0x17732d['offset']+_0x17732d[_0x7e7c('0x1d')];var _0x75d520;if(_0x23d564>=_0xe0562){_0x23d564=_0xe0562;_0x75d520=0xc8;}else{_0x75d520=0xce;}_0x55cecf['status'](_0x75d520);return _0x55cecf[_0x7e7c('0x20')](_0x7e7c('0x21'),_0x4fe236+'-'+_0x23d564+'/'+_0xe0562)[_0x7e7c('0x1b')](_0x21b6b7);}return null;};}function patchUpdates(_0x2b5cee){return function(_0x217f79){try{jsonpatch[_0x7e7c('0x22')](_0x217f79,_0x2b5cee,!![]);}catch(_0x443cd8){return BPromise[_0x7e7c('0x23')](_0x443cd8);}return _0x217f79['save']();};}function saveUpdates(_0x3df1b6,_0x17239b){return function(_0x589e43){if(_0x589e43){return _0x589e43[_0x7e7c('0x24')](_0x3df1b6)[_0x7e7c('0x25')](function(_0x20188b){return _0x20188b;});}return null;};}function removeEntity(_0x1a1510,_0x332904){return function(_0x2a5a3e){if(_0x2a5a3e){return _0x2a5a3e[_0x7e7c('0x26')]()['then'](function(){_0x1a1510['status'](0xcc)[_0x7e7c('0x1a')]();});}};}function handleEntityNotFound(_0x36db2a,_0x40c3ee){return function(_0x5d36c9){if(!_0x5d36c9){_0x36db2a[_0x7e7c('0x18')](0x194);}return _0x5d36c9;};}function handleError(_0x61850c,_0x3e94c5){_0x3e94c5=_0x3e94c5||0x1f4;return function(_0x52c64a){logger[_0x7e7c('0x27')](_0x52c64a['stack']);if(_0x52c64a[_0x7e7c('0x28')]){delete _0x52c64a[_0x7e7c('0x28')];}_0x61850c['status'](_0x3e94c5)[_0x7e7c('0x29')](_0x52c64a);};}exports[_0x7e7c('0x2a')]=function(_0x5663ae,_0x100840){var _0x310c66={},_0x407706={},_0x4db2ec={'count':0x0,'rows':[]};var _0x9334d1=_[_0x7e7c('0x2b')](db[_0x7e7c('0x2c')][_0x7e7c('0x2d')],function(_0x5c0b5d){return{'name':_0x5c0b5d[_0x7e7c('0x2e')],'type':_0x5c0b5d[_0x7e7c('0x2f')]['key']};});_0x407706[_0x7e7c('0x30')]=_[_0x7e7c('0x2b')](_0x9334d1,_0x7e7c('0x28'));_0x407706[_0x7e7c('0x31')]=_[_0x7e7c('0x32')](_0x5663ae['query']);_0x407706[_0x7e7c('0x33')]=_['intersection'](_0x407706['model'],_0x407706[_0x7e7c('0x31')]);_0x310c66[_0x7e7c('0x34')]=_[_0x7e7c('0x35')](_0x407706['model'],qs[_0x7e7c('0x36')](_0x5663ae[_0x7e7c('0x31')][_0x7e7c('0x36')]));_0x310c66[_0x7e7c('0x34')]=_0x310c66[_0x7e7c('0x34')][_0x7e7c('0x37')]?_0x310c66[_0x7e7c('0x34')]:_0x407706[_0x7e7c('0x30')];if(!_0x5663ae[_0x7e7c('0x31')][_0x7e7c('0x38')](_0x7e7c('0x39'))){_0x310c66['limit']=qs[_0x7e7c('0x1d')](_0x5663ae[_0x7e7c('0x31')]['limit']);_0x310c66['offset']=qs[_0x7e7c('0x1c')](_0x5663ae['query'][_0x7e7c('0x1c')]);}_0x310c66[_0x7e7c('0x3a')]=qs[_0x7e7c('0x3b')](_0x5663ae[_0x7e7c('0x31')]['sort']);_0x310c66[_0x7e7c('0x3c')]=qs[_0x7e7c('0x33')](_[_0x7e7c('0x3d')](_0x5663ae[_0x7e7c('0x31')],_0x407706[_0x7e7c('0x33')]),_0x9334d1);if(_0x5663ae[_0x7e7c('0x31')][_0x7e7c('0x3e')]){_0x310c66[_0x7e7c('0x3c')]=_[_0x7e7c('0x3f')](_0x310c66[_0x7e7c('0x3c')],{'$or':_[_0x7e7c('0x2b')](_0x9334d1,function(_0x22bdad){if(_0x22bdad[_0x7e7c('0x2f')]!==_0x7e7c('0x40')){var _0x2eb892={};_0x2eb892[_0x22bdad[_0x7e7c('0x28')]]={'$like':'%'+_0x5663ae['query']['filter']+'%'};return _0x2eb892;}})});}_0x310c66=_[_0x7e7c('0x3f')]({},_0x310c66,_0x5663ae[_0x7e7c('0x41')]);var _0x27a498={'where':_0x310c66[_0x7e7c('0x3c')]};return db[_0x7e7c('0x2c')][_0x7e7c('0x1f')](_0x27a498)[_0x7e7c('0x25')](function(_0x5e736c){_0x4db2ec[_0x7e7c('0x1f')]=_0x5e736c;if(_0x5663ae[_0x7e7c('0x31')]['includeAll']){_0x310c66[_0x7e7c('0x42')]=[{'all':!![]}];}return db[_0x7e7c('0x2c')][_0x7e7c('0x43')](_0x310c66);})[_0x7e7c('0x25')](function(_0x427b98){_0x4db2ec['rows']=_0x427b98;return _0x4db2ec;})[_0x7e7c('0x25')](respondWithFilteredResult(_0x100840,_0x310c66))[_0x7e7c('0x44')](handleError(_0x100840,null));};exports['show']=function(_0x508511,_0x3c7284){var _0x39ba39={'raw':!![],'where':{'id':_0x508511[_0x7e7c('0x45')]['id']}},_0x48c70c={};_0x48c70c[_0x7e7c('0x30')]=_[_0x7e7c('0x32')](db['ServicenowField'][_0x7e7c('0x2d')]);_0x48c70c[_0x7e7c('0x31')]=_[_0x7e7c('0x32')](_0x508511[_0x7e7c('0x31')]);_0x48c70c[_0x7e7c('0x33')]=_[_0x7e7c('0x35')](_0x48c70c[_0x7e7c('0x30')],_0x48c70c['query']);_0x39ba39[_0x7e7c('0x34')]=_['intersection'](_0x48c70c['model'],qs[_0x7e7c('0x36')](_0x508511['query'][_0x7e7c('0x36')]));_0x39ba39[_0x7e7c('0x34')]=_0x39ba39[_0x7e7c('0x34')][_0x7e7c('0x37')]?_0x39ba39[_0x7e7c('0x34')]:_0x48c70c[_0x7e7c('0x30')];if(_0x508511[_0x7e7c('0x31')][_0x7e7c('0x46')]){_0x39ba39['include']=[{'all':!![]}];}_0x39ba39=_[_0x7e7c('0x3f')]({},_0x39ba39,_0x508511[_0x7e7c('0x41')]);return db[_0x7e7c('0x2c')]['find'](_0x39ba39)[_0x7e7c('0x25')](handleEntityNotFound(_0x3c7284,null))[_0x7e7c('0x25')](respondWithResult(_0x3c7284,null))[_0x7e7c('0x44')](handleError(_0x3c7284,null));};exports[_0x7e7c('0x47')]=function(_0x2d361b,_0x38c49b){return db[_0x7e7c('0x2c')][_0x7e7c('0x47')](_0x2d361b[_0x7e7c('0x48')],{})['then'](respondWithResult(_0x38c49b,0xc9))[_0x7e7c('0x44')](handleError(_0x38c49b,null));};exports[_0x7e7c('0x24')]=function(_0x3c7f10,_0x2a8048){if(_0x3c7f10[_0x7e7c('0x48')]['id']){delete _0x3c7f10['body']['id'];}return db[_0x7e7c('0x2c')][_0x7e7c('0x49')]({'where':{'id':_0x3c7f10[_0x7e7c('0x45')]['id']}})[_0x7e7c('0x25')](handleEntityNotFound(_0x2a8048,null))[_0x7e7c('0x25')](saveUpdates(_0x3c7f10['body'],null))[_0x7e7c('0x25')](respondWithResult(_0x2a8048,null))[_0x7e7c('0x44')](handleError(_0x2a8048,null));};exports[_0x7e7c('0x26')]=function(_0x1639d0,_0xe14c29){return db[_0x7e7c('0x2c')][_0x7e7c('0x49')]({'where':{'id':_0x1639d0[_0x7e7c('0x45')]['id']}})[_0x7e7c('0x25')](handleEntityNotFound(_0xe14c29,null))[_0x7e7c('0x25')](removeEntity(_0xe14c29,null))[_0x7e7c('0x44')](handleError(_0xe14c29,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index d422413..7c8444a 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 _0xf2c1=['lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intServicenowField.attributes','exports','define','int_servicenow_fields','idField','FieldId'];(function(_0x54e4fd,_0x4059d4){var _0x50cbb2=function(_0x47549d){while(--_0x47549d){_0x54e4fd['push'](_0x54e4fd['shift']());}};_0x50cbb2(++_0x4059d4);}(_0xf2c1,0x15e));var _0x1f2c=function(_0x2d9a60,_0x1b5bc1){_0x2d9a60=_0x2d9a60-0x0;var _0x8f442=_0xf2c1[_0x2d9a60];return _0x8f442;};'use strict';var _=require(_0x1f2c('0x0'));var util=require(_0x1f2c('0x1'));var logger=require('../../config/logger')(_0x1f2c('0x2'));var moment=require(_0x1f2c('0x3'));var BPromise=require(_0x1f2c('0x4'));var rp=require(_0x1f2c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1f2c('0x6'));var config=require(_0x1f2c('0x7'));var attributes=require(_0x1f2c('0x8'));module[_0x1f2c('0x9')]=function(_0x4b7dfa,_0x5ce209){return _0x4b7dfa[_0x1f2c('0xa')]('ServicenowField',attributes,{'tableName':_0x1f2c('0xb'),'paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':[_0x1f2c('0xc'),_0x1f2c('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x061c=['./intServicenowField.attributes','ServicenowField','servicenow_unique_index','idField','util','api','moment','request-promise','path','rimraf'];(function(_0x1d6e3d,_0x51b0c5){var _0x27d1e4=function(_0x37d6c4){while(--_0x37d6c4){_0x1d6e3d['push'](_0x1d6e3d['shift']());}};_0x27d1e4(++_0x51b0c5);}(_0x061c,0x1d0));var _0xc061=function(_0x5f3fb2,_0x384327){_0x5f3fb2=_0x5f3fb2-0x0;var _0x160f2b=_0x061c[_0x5f3fb2];return _0x160f2b;};'use strict';var _=require('lodash');var util=require(_0xc061('0x0'));var logger=require('../../config/logger')(_0xc061('0x1'));var moment=require(_0xc061('0x2'));var BPromise=require('bluebird');var rp=require(_0xc061('0x3'));var fs=require('fs');var path=require(_0xc061('0x4'));var rimraf=require(_0xc061('0x5'));var config=require('../../config/environment');var attributes=require(_0xc061('0x6'));module['exports']=function(_0x40da6c,_0x49cef7){return _0x40da6c['define'](_0xc061('0x7'),attributes,{'tableName':'int_servicenow_fields','paranoid':![],'indexes':[{'name':_0xc061('0x8'),'fields':[_0xc061('0x9'),'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 e60f108..eb33f07 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 _0xac4a=['ServicenowField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','then','info','debug','ServicenowField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xac4a,0x13f));var _0xaac4=function(_0x927617,_0x25e6f8){_0x927617=_0x927617-0x0;var _0x85a341=_0xac4a[_0x927617];return _0x85a341;};'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')]('ServicenowField,\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')]('ServicenowField,\x20%s,\x20%s',_0x5870e8,_0x1766c2);_0x567295(_0x1766c2);});});} \ No newline at end of file +var _0xbdb7=['request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','info','ServicenowField,\x20%s,\x20%s'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x3d5aef,_0x64e2d5){_0x3d5aef=_0x3d5aef-0x0;var _0x33e385=_0xbdb7[_0x3d5aef];return _0x33e385;};'use strict';var _=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var moment=require(_0x7bdb('0x2'));var BPromise=require(_0x7bdb('0x3'));var rs=require(_0x7bdb('0x4'));var fs=require('fs');var Redis=require(_0x7bdb('0x5'));var db=require(_0x7bdb('0x6'))['db'];var utils=require(_0x7bdb('0x7'));var logger=require(_0x7bdb('0x8'))('rpc');var config=require(_0x7bdb('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7bdb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1e23a3,_0x493bde,_0x513cba){return new BPromise(function(_0x468041,_0x11a877){return client['request'](_0x1e23a3,_0x513cba)['then'](function(_0xdc2ffc){logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));logger[_0x7bdb('0xe')](_0x7bdb('0xf'),_0x493bde,_0x7bdb('0xd'),JSON[_0x7bdb('0x10')](_0xdc2ffc));if(_0xdc2ffc['error']){if(_0xdc2ffc['error']['code']===0x1f4){logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error'][_0x7bdb('0x12')]);return _0x11a877(_0xdc2ffc['error']['message']);}logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error']['message']);return _0x468041(_0xdc2ffc['error'][_0x7bdb('0x12')]);}else{logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));_0x468041(_0xdc2ffc[_0x7bdb('0x13')][_0x7bdb('0x12')]);}})[_0x7bdb('0x14')](function(_0x1b2d9b){logger['error'](_0x7bdb('0xc'),_0x493bde,_0x1b2d9b);_0x11a877(_0x1b2d9b);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 482a323..189bffc 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(_0xd474e4,_0x1a4804){var _0x314957=function(_0xe1e04){while(--_0xe1e04){_0xd474e4['push'](_0xd474e4['shift']());}};_0x314957(++_0x1a4804);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xa9e0[_0x34bf97];return _0x292719;};'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(_0x58ce3d,_0x535c28){var _0x3406ac=function(_0x335200){while(--_0x335200){_0x58ce3d['push'](_0x58ce3d['shift']());}};_0x3406ac(++_0x535c28);}(_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 f0a6199..7daf251 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(_0x1e9718,_0x1f5555){var _0x491d4f=function(_0x4a01de){while(--_0x4a01de){_0x1e9718['push'](_0x1e9718['shift']());}};_0x491d4f(++_0x1f5555);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xa9e0[_0xbb091];return _0x467a04;};'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(_0x57aa9b,_0xf681e0){var _0x5ee142=function(_0x529fb0){while(--_0x529fb0){_0x57aa9b['push'](_0x57aa9b['shift']());}};_0x5ee142(++_0xf681e0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xa9e0[_0x1c546c];return _0x2cc384;};'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 1169c76..10d84d2 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 _0xa9ed=['values','test','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','name','send','index','map','SugarcrmAccount','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','length','options','create','body','find','findOne','SugarcrmConfiguration','order','getConfigurations','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','SugarcrmField','Descriptions','getFields','assigned_user_id','created_by','date_start','duration_hours','duration_minutes','parent_id','parent_type','parent_name','direction','password','remoteUri','slice','substring','lastIndexOf','POST','format','%s%s','stringify','username','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','/service/v4_1/rest.php','get_module_fields','JSON','Calls','module_fields','remove','includes','endsWith'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xa9ed,0x187));var _0xda9e=function(_0x1d87fc,_0x1e5321){_0x1d87fc=_0x1d87fc-0x0;var _0x492b56=_0xa9ed[_0x1d87fc];return _0x492b56;};'use strict';var emlformat=require(_0xda9e('0x0'));var rimraf=require(_0xda9e('0x1'));var zipdir=require(_0xda9e('0x2'));var jsonpatch=require(_0xda9e('0x3'));var rp=require(_0xda9e('0x4'));var moment=require('moment');var BPromise=require(_0xda9e('0x5'));var Mustache=require(_0xda9e('0x6'));var util=require(_0xda9e('0x7'));var path=require(_0xda9e('0x8'));var sox=require(_0xda9e('0x9'));var csv=require(_0xda9e('0xa'));var ejs=require(_0xda9e('0xb'));var fs=require('fs');var fs_extra=require(_0xda9e('0xc'));var _=require(_0xda9e('0xd'));var squel=require(_0xda9e('0xe'));var crypto=require(_0xda9e('0xf'));var jsforce=require(_0xda9e('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xda9e('0xa'));var querystring=require(_0xda9e('0x11'));var Papa=require(_0xda9e('0x12'));var Redis=require(_0xda9e('0x13'));var authService=require(_0xda9e('0x14'));var qs=require(_0xda9e('0x15'));var as=require(_0xda9e('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xda9e('0x17'))(_0xda9e('0x18'));var utils=require(_0xda9e('0x19'));var config=require(_0xda9e('0x1a'));var licenseUtil=require(_0xda9e('0x1b'));var db=require(_0xda9e('0x1c'))['db'];var integrations=require(_0xda9e('0x1d'));function respondWithStatusCode(_0x2a23e6,_0x55ede6){_0x55ede6=_0x55ede6||0xcc;return function(_0x4a43bd){if(_0x4a43bd){return _0x2a23e6[_0xda9e('0x1e')](_0x55ede6);}return _0x2a23e6[_0xda9e('0x1f')](_0x55ede6)[_0xda9e('0x20')]();};}function respondWithResult(_0x27b637,_0x2b8e08){_0x2b8e08=_0x2b8e08||0xc8;return function(_0x29c239){if(_0x29c239){return _0x27b637['status'](_0x2b8e08)[_0xda9e('0x21')](_0x29c239);}};}function respondWithFilteredResult(_0x368003,_0x2d8cef){return function(_0x482da8){if(_0x482da8){var _0x104694=typeof _0x2d8cef[_0xda9e('0x22')]===_0xda9e('0x23')&&typeof _0x2d8cef['limit']===_0xda9e('0x23');var _0x1d316e=_0x482da8[_0xda9e('0x24')];var _0x2871b8=_0x104694?0x0:_0x2d8cef[_0xda9e('0x22')];var _0x5d9678=_0x104694?_0x482da8[_0xda9e('0x24')]:_0x2d8cef[_0xda9e('0x22')]+_0x2d8cef[_0xda9e('0x25')];var _0xf4a7a3;if(_0x5d9678>=_0x1d316e){_0x5d9678=_0x1d316e;_0xf4a7a3=0xc8;}else{_0xf4a7a3=0xce;}_0x368003[_0xda9e('0x1f')](_0xf4a7a3);return _0x368003[_0xda9e('0x26')](_0xda9e('0x27'),_0x2871b8+'-'+_0x5d9678+'/'+_0x1d316e)['json'](_0x482da8);}return null;};}function patchUpdates(_0x589aaa){return function(_0x24d3a4){try{jsonpatch['apply'](_0x24d3a4,_0x589aaa,!![]);}catch(_0x1f522a){return BPromise[_0xda9e('0x28')](_0x1f522a);}return _0x24d3a4[_0xda9e('0x29')]();};}function saveUpdates(_0x1262d1,_0x283ec9){return function(_0x556fb8){if(_0x556fb8){return _0x556fb8[_0xda9e('0x2a')](_0x1262d1)[_0xda9e('0x2b')](function(_0x997bdc){return _0x997bdc;});}return null;};}function removeEntity(_0x54306a,_0x15b53c){return function(_0x402cd1){if(_0x402cd1){return _0x402cd1[_0xda9e('0x2c')]()[_0xda9e('0x2b')](function(){_0x54306a['status'](0xcc)[_0xda9e('0x20')]();});}};}function handleEntityNotFound(_0x40cc15,_0x364ef4){return function(_0x3de0c3){if(!_0x3de0c3){_0x40cc15[_0xda9e('0x1e')](0x194);}return _0x3de0c3;};}function handleError(_0x253d8c,_0x11f03a){_0x11f03a=_0x11f03a||0x1f4;return function(_0xc249ef){logger[_0xda9e('0x2d')](_0xc249ef['stack']);if(_0xc249ef[_0xda9e('0x2e')]){delete _0xc249ef[_0xda9e('0x2e')];}_0x253d8c[_0xda9e('0x1f')](_0x11f03a)[_0xda9e('0x2f')](_0xc249ef);};}exports[_0xda9e('0x30')]=function(_0x279ff8,_0x19a72f){var _0x1daa0b={},_0x5091f5={},_0x4e39b1={'count':0x0,'rows':[]};var _0x38d37f=_[_0xda9e('0x31')](db[_0xda9e('0x32')][_0xda9e('0x33')],function(_0x21ab77){return{'name':_0x21ab77[_0xda9e('0x34')],'type':_0x21ab77[_0xda9e('0x35')]['key']};});_0x5091f5[_0xda9e('0x36')]=_['map'](_0x38d37f,_0xda9e('0x2e'));_0x5091f5[_0xda9e('0x37')]=_[_0xda9e('0x38')](_0x279ff8[_0xda9e('0x37')]);_0x5091f5[_0xda9e('0x39')]=_[_0xda9e('0x3a')](_0x5091f5[_0xda9e('0x36')],_0x5091f5[_0xda9e('0x37')]);_0x1daa0b['attributes']=_['intersection'](_0x5091f5[_0xda9e('0x36')],qs['fields'](_0x279ff8['query'][_0xda9e('0x3b')]));_0x1daa0b[_0xda9e('0x3c')]=_0x1daa0b[_0xda9e('0x3c')]['length']?_0x1daa0b[_0xda9e('0x3c')]:_0x5091f5[_0xda9e('0x36')];if(!_0x279ff8[_0xda9e('0x37')]['hasOwnProperty'](_0xda9e('0x3d'))){_0x1daa0b[_0xda9e('0x25')]=qs[_0xda9e('0x25')](_0x279ff8[_0xda9e('0x37')][_0xda9e('0x25')]);_0x1daa0b[_0xda9e('0x22')]=qs[_0xda9e('0x22')](_0x279ff8[_0xda9e('0x37')][_0xda9e('0x22')]);}_0x1daa0b['order']=qs['sort'](_0x279ff8[_0xda9e('0x37')][_0xda9e('0x3e')]);_0x1daa0b[_0xda9e('0x3f')]=qs[_0xda9e('0x39')](_[_0xda9e('0x40')](_0x279ff8[_0xda9e('0x37')],_0x5091f5['filters']),_0x38d37f);if(_0x279ff8[_0xda9e('0x37')][_0xda9e('0x41')]){_0x1daa0b['where']=_[_0xda9e('0x42')](_0x1daa0b['where'],{'$or':_[_0xda9e('0x31')](_0x38d37f,function(_0x5ab480){if(_0x5ab480[_0xda9e('0x35')]!==_0xda9e('0x43')){var _0x345f4b={};_0x345f4b[_0x5ab480[_0xda9e('0x2e')]]={'$like':'%'+_0x279ff8[_0xda9e('0x37')][_0xda9e('0x41')]+'%'};return _0x345f4b;}})});}_0x1daa0b=_[_0xda9e('0x42')]({},_0x1daa0b,_0x279ff8['options']);var _0x518c71={'where':_0x1daa0b[_0xda9e('0x3f')]};return db['SugarcrmAccount']['count'](_0x518c71)[_0xda9e('0x2b')](function(_0xd42481){_0x4e39b1[_0xda9e('0x24')]=_0xd42481;if(_0x279ff8['query'][_0xda9e('0x44')]){_0x1daa0b[_0xda9e('0x45')]=[{'all':!![]}];}return db['SugarcrmAccount'][_0xda9e('0x46')](_0x1daa0b);})[_0xda9e('0x2b')](function(_0x565d28){_0x4e39b1[_0xda9e('0x47')]=_0x565d28;return _0x4e39b1;})['then'](respondWithFilteredResult(_0x19a72f,_0x1daa0b))[_0xda9e('0x48')](handleError(_0x19a72f,null));};exports[_0xda9e('0x49')]=function(_0x44b4bc,_0x2e6831){var _0x3c54eb={'raw':![],'where':{'id':_0x44b4bc[_0xda9e('0x4a')]['id']}},_0x4cd5f0={};_0x4cd5f0['model']=_[_0xda9e('0x38')](db[_0xda9e('0x32')]['rawAttributes']);_0x4cd5f0[_0xda9e('0x37')]=_[_0xda9e('0x38')](_0x44b4bc['query']);_0x4cd5f0['filters']=_['intersection'](_0x4cd5f0[_0xda9e('0x36')],_0x4cd5f0[_0xda9e('0x37')]);_0x3c54eb[_0xda9e('0x3c')]=_[_0xda9e('0x3a')](_0x4cd5f0[_0xda9e('0x36')],qs['fields'](_0x44b4bc[_0xda9e('0x37')]['fields']));_0x3c54eb['attributes']=_0x3c54eb[_0xda9e('0x3c')][_0xda9e('0x4b')]?_0x3c54eb[_0xda9e('0x3c')]:_0x4cd5f0[_0xda9e('0x36')];if(_0x44b4bc[_0xda9e('0x37')][_0xda9e('0x44')]){_0x3c54eb[_0xda9e('0x45')]=[{'all':!![]}];}_0x3c54eb=_[_0xda9e('0x42')]({},_0x3c54eb,_0x44b4bc[_0xda9e('0x4c')]);return db['SugarcrmAccount']['find'](_0x3c54eb)[_0xda9e('0x2b')](handleEntityNotFound(_0x2e6831,null))[_0xda9e('0x2b')](respondWithResult(_0x2e6831,null))[_0xda9e('0x48')](handleError(_0x2e6831,null));};exports[_0xda9e('0x4d')]=function(_0x1712ae,_0x3396e8){return db[_0xda9e('0x32')]['create'](_0x1712ae[_0xda9e('0x4e')],{})['then'](respondWithResult(_0x3396e8,0xc9))[_0xda9e('0x48')](handleError(_0x3396e8,null));};exports[_0xda9e('0x2a')]=function(_0xa1636b,_0x9ad231){if(_0xa1636b[_0xda9e('0x4e')]['id']){delete _0xa1636b[_0xda9e('0x4e')]['id'];}return db[_0xda9e('0x32')][_0xda9e('0x4f')]({'where':{'id':_0xa1636b[_0xda9e('0x4a')]['id']}})[_0xda9e('0x2b')](handleEntityNotFound(_0x9ad231,null))['then'](saveUpdates(_0xa1636b[_0xda9e('0x4e')],null))[_0xda9e('0x2b')](respondWithResult(_0x9ad231,null))[_0xda9e('0x48')](handleError(_0x9ad231,null));};exports[_0xda9e('0x2c')]=function(_0x36c655,_0x9c5a66){return db[_0xda9e('0x32')]['find']({'where':{'id':_0x36c655[_0xda9e('0x4a')]['id']}})[_0xda9e('0x2b')](handleEntityNotFound(_0x9c5a66,null))[_0xda9e('0x2b')](removeEntity(_0x9c5a66,null))[_0xda9e('0x48')](handleError(_0x9c5a66,null));};exports['getConfigurations']=function(_0x8d14d9,_0x58f46b,_0x351504){var _0x3c4d22={};var _0x3527af={};var _0x277925;var _0x1f27c5;return db[_0xda9e('0x32')][_0xda9e('0x50')]({'where':{'id':_0x8d14d9['params']['id']}})[_0xda9e('0x2b')](handleEntityNotFound(_0x58f46b,null))[_0xda9e('0x2b')](function(_0x86a73a){if(_0x86a73a){_0x277925=_0x86a73a;_0x3527af['model']=_[_0xda9e('0x38')](db[_0xda9e('0x51')][_0xda9e('0x33')]);_0x3527af[_0xda9e('0x37')]=_['keys'](_0x8d14d9[_0xda9e('0x37')]);_0x3527af[_0xda9e('0x39')]=_[_0xda9e('0x3a')](_0x3527af['model'],_0x3527af[_0xda9e('0x37')]);_0x3c4d22[_0xda9e('0x3c')]=_['intersection'](_0x3527af['model'],qs['fields'](_0x8d14d9['query'][_0xda9e('0x3b')]));_0x3c4d22[_0xda9e('0x3c')]=_0x3c4d22[_0xda9e('0x3c')][_0xda9e('0x4b')]?_0x3c4d22[_0xda9e('0x3c')]:_0x3527af[_0xda9e('0x36')];_0x3c4d22[_0xda9e('0x52')]=qs[_0xda9e('0x3e')](_0x8d14d9['query']['sort']);_0x3c4d22[_0xda9e('0x3f')]=qs[_0xda9e('0x39')](_['pick'](_0x8d14d9['query'],_0x3527af['filters']));if(_0x8d14d9[_0xda9e('0x37')]['filter']){_0x3c4d22[_0xda9e('0x3f')]=_[_0xda9e('0x42')](_0x3c4d22[_0xda9e('0x3f')],{'$or':_[_0xda9e('0x31')](_0x3c4d22['attributes'],function(_0x18f47c){var _0x328f5a={};_0x328f5a[_0x18f47c]={'$like':'%'+_0x8d14d9['query'][_0xda9e('0x41')]+'%'};return _0x328f5a;})});}_0x3c4d22=_['merge']({},_0x3c4d22,_0x8d14d9[_0xda9e('0x4c')]);return _0x277925[_0xda9e('0x53')](_0x3c4d22);}})[_0xda9e('0x2b')](function(_0x7f9511){if(_0x7f9511){_0x1f27c5=_0x7f9511[_0xda9e('0x4b')];if(!_0x8d14d9['query'][_0xda9e('0x54')](_0xda9e('0x3d'))){_0x3c4d22[_0xda9e('0x25')]=qs[_0xda9e('0x25')](_0x8d14d9[_0xda9e('0x37')][_0xda9e('0x25')]);_0x3c4d22['offset']=qs['offset'](_0x8d14d9['query'][_0xda9e('0x22')]);}return _0x277925[_0xda9e('0x53')](_0x3c4d22);}})[_0xda9e('0x2b')](function(_0x26835e){if(_0x26835e){return _0x26835e?{'count':_0x1f27c5,'rows':_0x26835e}:null;}})[_0xda9e('0x2b')](respondWithResult(_0x58f46b,null))[_0xda9e('0x48')](handleError(_0x58f46b,null));};exports[_0xda9e('0x55')]=function(_0x17371f,_0x5651d5,_0x1e5d13){if(_0x17371f[_0xda9e('0x4e')]['id']){delete _0x17371f[_0xda9e('0x4e')]['id'];}return db[_0xda9e('0x32')][_0xda9e('0x50')]({'where':{'id':_0x17371f['params']['id']}})[_0xda9e('0x2b')](handleEntityNotFound(_0x5651d5,null))['then'](function(_0x1e790e){if(_0x1e790e){_0x17371f[_0xda9e('0x4e')][_0xda9e('0x56')]=_0x1e790e['id'];_0x17371f[_0xda9e('0x4e')][_0xda9e('0x57')]=integrations[_0xda9e('0x58')](_0x17371f['body'][_0xda9e('0x59')],_0x17371f[_0xda9e('0x4e')][_0xda9e('0x35')]);_0x17371f[_0xda9e('0x4e')]['Descriptions']=integrations[_0xda9e('0x5a')](_0x17371f[_0xda9e('0x4e')][_0xda9e('0x59')],_0x17371f[_0xda9e('0x4e')][_0xda9e('0x35')]);return db[_0xda9e('0x51')]['create'](_0x17371f['body'],{'include':[{'model':db[_0xda9e('0x5b')],'as':'Subjects'},{'model':db[_0xda9e('0x5b')],'as':_0xda9e('0x5c')}]});}return null;})[_0xda9e('0x2b')](respondWithResult(_0x5651d5,null))[_0xda9e('0x48')](handleError(_0x5651d5,null));};exports[_0xda9e('0x5d')]=function(_0xacf645,_0x45b2bb,_0x2e0e8a){var _0x324c14='';var _0xa57a7e=['id',_0xda9e('0x2e'),_0xda9e('0x5e'),_0xda9e('0x5f'),'description',_0xda9e('0x60'),_0xda9e('0x61'),_0xda9e('0x62'),_0xda9e('0x63'),_0xda9e('0x64'),_0xda9e('0x65'),_0xda9e('0x66')];return db[_0xda9e('0x32')]['findOne']({'where':{'id':_0xacf645[_0xda9e('0x4a')]['id']},'attributes':['id','username',_0xda9e('0x67'),_0xda9e('0x68')]})[_0xda9e('0x2b')](handleEntityNotFound(_0x45b2bb,null))[_0xda9e('0x2b')](function(_0x5cbb80){if(_0x5cbb80){_0x324c14=_0x5cbb80[_0xda9e('0x68')];var _0x3dfdd5=_0x324c14[_0xda9e('0x69')](-0x1);if(_0x3dfdd5==='/'){_0x324c14=_0x324c14[_0xda9e('0x6a')](0x0,_0x324c14[_0xda9e('0x6b')](_0x3dfdd5));}return rp({'method':_0xda9e('0x6c'),'uri':util[_0xda9e('0x6d')](_0xda9e('0x6e'),_0x324c14,'/service/v4_1/rest.php'),'json':!![],'form':{'method':'login','input_type':'JSON','response_type':'JSON','rest_data':JSON[_0xda9e('0x6f')]({'user_auth':{'user_name':_0x5cbb80[_0xda9e('0x70')],'password':_0x5cbb80[_0xda9e('0x67')],'encryption':_0xda9e('0x71')},'application':_0xda9e('0x72')})}});}})['then'](function(_0x9d13b7){if(_0x9d13b7&&_0x9d13b7[_0xda9e('0x2e')]!==_0xda9e('0x73')&&_0x9d13b7[_0xda9e('0x2e')]!==_0xda9e('0x74')){return rp({'method':_0xda9e('0x6c'),'uri':util['format']('%s%s',_0x324c14,_0xda9e('0x75')),'json':!![],'form':{'method':_0xda9e('0x76'),'input_type':'JSON','response_type':_0xda9e('0x77'),'rest_data':JSON['stringify']({'session':_0x9d13b7['id'],'module_name':_0xda9e('0x78')})}})[_0xda9e('0x2b')](function(_0x1ecad3){if(_0x1ecad3){var _0x4f1737=_['values'](_0x1ecad3[_0xda9e('0x79')]);_[_0xda9e('0x7a')](_0x4f1737,function(_0x1f2b35){return _0xa57a7e[_0xda9e('0x7b')](_0x1f2b35[_0xda9e('0x2e')]);});return{'count':_0x4f1737['length'],'rows':_[_0xda9e('0x31')](_0x4f1737,function(_0x5955ef){return{'id':_0x5955ef[_0xda9e('0x2e')],'name':_0x5955ef['label'],'custom':_[_0xda9e('0x7c')](_0x5955ef[_0xda9e('0x2e')],'_c')?!![]:![],'options':_0x5955ef[_0xda9e('0x4c')]?_[_0xda9e('0x31')](_[_0xda9e('0x7d')](_0x5955ef[_0xda9e('0x4c')]),function(_0x235bfe){return{'name':_0x235bfe['value'],'value':_0x235bfe[_0xda9e('0x2e')]};}):[]};})};}})[_0xda9e('0x2b')](respondWithResult(_0x45b2bb,null))[_0xda9e('0x48')](function(_0x22124b){var _0x579a30=_0xacf645[_0xda9e('0x37')][_0xda9e('0x7e')]?0x1f4:_0x22124b['statusCode']||0x1f4;logger[_0xda9e('0x2d')](_0xda9e('0x7f'),_0xda9e('0x5d'),_0x579a30,JSON[_0xda9e('0x6f')](_0x22124b));delete _0x22124b[_0xda9e('0x2e')];if(_0x579a30===0x191){_0x579a30=0x190;}_0x45b2bb[_0xda9e('0x1f')](_0x579a30)['send'](_0xacf645[_0xda9e('0x37')][_0xda9e('0x7e')]?{'message':_0xda9e('0x80'),'statusCode':_0x22124b['statusCode']}:_0x22124b);});}else{var _0x40b22f=0x1f4;_0x45b2bb[_0xda9e('0x1f')](_0x40b22f)[_0xda9e('0x2f')]({'message':_0xda9e('0x80'),'statusCode':0x190});}});}; \ No newline at end of file +var _0x226f=['destroy','error','stack','name','send','index','map','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','SugarcrmAccount','includeAll','include','findAll','rows','catch','show','params','find','create','body','SugarcrmConfiguration','getConfigurations','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','type','getFields','assigned_user_id','created_by','description','duration_minutes','parent_id','parent_type','direction','findOne','username','password','slice','lastIndexOf','POST','format','%s%s','/service/v4_1/rest.php','login','JSON','stringify','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','Calls','values','includes','label','endsWith','value','statusCode','test','Wrong\x20credentials','zip-dir','fast-json-patch','moment','path','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','limit','count','set','apply','save','update','then'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x226f,0x12d));var _0xf226=function(_0x5523d5,_0x356cc6){_0x5523d5=_0x5523d5-0x0;var _0x49b4a2=_0x226f[_0x5523d5];return _0x49b4a2;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xf226('0x0'));var jsonpatch=require(_0xf226('0x1'));var rp=require('request-promise');var moment=require(_0xf226('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xf226('0x3'));var sox=require('sox');var csv=require(_0xf226('0x4'));var ejs=require(_0xf226('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xf226('0x6'));var crypto=require(_0xf226('0x7'));var jsforce=require(_0xf226('0x8'));var deskjs=require(_0xf226('0x9'));var toCsv=require(_0xf226('0x4'));var querystring=require('querystring');var Papa=require(_0xf226('0xa'));var Redis=require(_0xf226('0xb'));var authService=require('../../components/auth/service');var qs=require(_0xf226('0xc'));var as=require(_0xf226('0xd'));var hardwareService=require(_0xf226('0xe'));var logger=require('../../config/logger')('api');var utils=require(_0xf226('0xf'));var config=require(_0xf226('0x10'));var licenseUtil=require(_0xf226('0x11'));var db=require(_0xf226('0x12'))['db'];var integrations=require(_0xf226('0x13'));function respondWithStatusCode(_0x4c2154,_0x2191e0){_0x2191e0=_0x2191e0||0xcc;return function(_0x802071){if(_0x802071){return _0x4c2154[_0xf226('0x14')](_0x2191e0);}return _0x4c2154[_0xf226('0x15')](_0x2191e0)[_0xf226('0x16')]();};}function respondWithResult(_0x4e30e7,_0x3a3ecc){_0x3a3ecc=_0x3a3ecc||0xc8;return function(_0x14481a){if(_0x14481a){return _0x4e30e7['status'](_0x3a3ecc)[_0xf226('0x17')](_0x14481a);}};}function respondWithFilteredResult(_0x167e8f,_0x1ec43d){return function(_0x3430ee){if(_0x3430ee){var _0x52cbcc=typeof _0x1ec43d[_0xf226('0x18')]==='undefined'&&typeof _0x1ec43d[_0xf226('0x19')]==='undefined';var _0x47e061=_0x3430ee['count'];var _0x23e282=_0x52cbcc?0x0:_0x1ec43d[_0xf226('0x18')];var _0x4e2e70=_0x52cbcc?_0x3430ee[_0xf226('0x1a')]:_0x1ec43d[_0xf226('0x18')]+_0x1ec43d[_0xf226('0x19')];var _0x4f4d54;if(_0x4e2e70>=_0x47e061){_0x4e2e70=_0x47e061;_0x4f4d54=0xc8;}else{_0x4f4d54=0xce;}_0x167e8f[_0xf226('0x15')](_0x4f4d54);return _0x167e8f[_0xf226('0x1b')]('Content-Range',_0x23e282+'-'+_0x4e2e70+'/'+_0x47e061)[_0xf226('0x17')](_0x3430ee);}return null;};}function patchUpdates(_0x4554bd){return function(_0x4caad9){try{jsonpatch[_0xf226('0x1c')](_0x4caad9,_0x4554bd,!![]);}catch(_0x42a9cd){return BPromise['reject'](_0x42a9cd);}return _0x4caad9[_0xf226('0x1d')]();};}function saveUpdates(_0x58917b,_0x54995f){return function(_0x5b752f){if(_0x5b752f){return _0x5b752f[_0xf226('0x1e')](_0x58917b)[_0xf226('0x1f')](function(_0xb6df2c){return _0xb6df2c;});}return null;};}function removeEntity(_0x55ae7f,_0x285b23){return function(_0x2d427f){if(_0x2d427f){return _0x2d427f[_0xf226('0x20')]()[_0xf226('0x1f')](function(){_0x55ae7f['status'](0xcc)[_0xf226('0x16')]();});}};}function handleEntityNotFound(_0x394407,_0x18db0a){return function(_0x462f64){if(!_0x462f64){_0x394407[_0xf226('0x14')](0x194);}return _0x462f64;};}function handleError(_0x308c6a,_0x4bab6e){_0x4bab6e=_0x4bab6e||0x1f4;return function(_0x1fb055){logger[_0xf226('0x21')](_0x1fb055[_0xf226('0x22')]);if(_0x1fb055[_0xf226('0x23')]){delete _0x1fb055[_0xf226('0x23')];}_0x308c6a[_0xf226('0x15')](_0x4bab6e)[_0xf226('0x24')](_0x1fb055);};}exports[_0xf226('0x25')]=function(_0x305ef5,_0x5a6932){var _0x4e4884={},_0x3bff2f={},_0x6f48d0={'count':0x0,'rows':[]};var _0x1bdde3=_[_0xf226('0x26')](db['SugarcrmAccount'][_0xf226('0x27')],function(_0x55cc8f){return{'name':_0x55cc8f['fieldName'],'type':_0x55cc8f['type']['key']};});_0x3bff2f[_0xf226('0x28')]=_[_0xf226('0x26')](_0x1bdde3,'name');_0x3bff2f['query']=_[_0xf226('0x29')](_0x305ef5[_0xf226('0x2a')]);_0x3bff2f[_0xf226('0x2b')]=_[_0xf226('0x2c')](_0x3bff2f['model'],_0x3bff2f[_0xf226('0x2a')]);_0x4e4884[_0xf226('0x2d')]=_[_0xf226('0x2c')](_0x3bff2f['model'],qs[_0xf226('0x2e')](_0x305ef5[_0xf226('0x2a')]['fields']));_0x4e4884[_0xf226('0x2d')]=_0x4e4884[_0xf226('0x2d')][_0xf226('0x2f')]?_0x4e4884[_0xf226('0x2d')]:_0x3bff2f[_0xf226('0x28')];if(!_0x305ef5[_0xf226('0x2a')][_0xf226('0x30')](_0xf226('0x31'))){_0x4e4884['limit']=qs[_0xf226('0x19')](_0x305ef5[_0xf226('0x2a')]['limit']);_0x4e4884['offset']=qs['offset'](_0x305ef5[_0xf226('0x2a')][_0xf226('0x18')]);}_0x4e4884[_0xf226('0x32')]=qs[_0xf226('0x33')](_0x305ef5[_0xf226('0x2a')][_0xf226('0x33')]);_0x4e4884['where']=qs[_0xf226('0x2b')](_[_0xf226('0x34')](_0x305ef5[_0xf226('0x2a')],_0x3bff2f[_0xf226('0x2b')]),_0x1bdde3);if(_0x305ef5[_0xf226('0x2a')]['filter']){_0x4e4884[_0xf226('0x35')]=_[_0xf226('0x36')](_0x4e4884['where'],{'$or':_['map'](_0x1bdde3,function(_0x4d011d){if(_0x4d011d['type']!==_0xf226('0x37')){var _0x47f6ea={};_0x47f6ea[_0x4d011d[_0xf226('0x23')]]={'$like':'%'+_0x305ef5[_0xf226('0x2a')][_0xf226('0x38')]+'%'};return _0x47f6ea;}})});}_0x4e4884=_[_0xf226('0x36')]({},_0x4e4884,_0x305ef5[_0xf226('0x39')]);var _0x4939c9={'where':_0x4e4884['where']};return db[_0xf226('0x3a')][_0xf226('0x1a')](_0x4939c9)[_0xf226('0x1f')](function(_0x5771cc){_0x6f48d0[_0xf226('0x1a')]=_0x5771cc;if(_0x305ef5[_0xf226('0x2a')][_0xf226('0x3b')]){_0x4e4884[_0xf226('0x3c')]=[{'all':!![]}];}return db[_0xf226('0x3a')][_0xf226('0x3d')](_0x4e4884);})['then'](function(_0x4071a7){_0x6f48d0[_0xf226('0x3e')]=_0x4071a7;return _0x6f48d0;})['then'](respondWithFilteredResult(_0x5a6932,_0x4e4884))[_0xf226('0x3f')](handleError(_0x5a6932,null));};exports[_0xf226('0x40')]=function(_0x552945,_0x31502c){var _0x2548dc={'raw':![],'where':{'id':_0x552945[_0xf226('0x41')]['id']}},_0x2ca994={};_0x2ca994[_0xf226('0x28')]=_[_0xf226('0x29')](db[_0xf226('0x3a')][_0xf226('0x27')]);_0x2ca994[_0xf226('0x2a')]=_[_0xf226('0x29')](_0x552945['query']);_0x2ca994[_0xf226('0x2b')]=_[_0xf226('0x2c')](_0x2ca994[_0xf226('0x28')],_0x2ca994[_0xf226('0x2a')]);_0x2548dc[_0xf226('0x2d')]=_['intersection'](_0x2ca994[_0xf226('0x28')],qs[_0xf226('0x2e')](_0x552945[_0xf226('0x2a')][_0xf226('0x2e')]));_0x2548dc['attributes']=_0x2548dc['attributes'][_0xf226('0x2f')]?_0x2548dc['attributes']:_0x2ca994[_0xf226('0x28')];if(_0x552945['query'][_0xf226('0x3b')]){_0x2548dc['include']=[{'all':!![]}];}_0x2548dc=_[_0xf226('0x36')]({},_0x2548dc,_0x552945['options']);return db[_0xf226('0x3a')][_0xf226('0x42')](_0x2548dc)[_0xf226('0x1f')](handleEntityNotFound(_0x31502c,null))[_0xf226('0x1f')](respondWithResult(_0x31502c,null))[_0xf226('0x3f')](handleError(_0x31502c,null));};exports[_0xf226('0x43')]=function(_0x13bd16,_0x1c79ce){return db[_0xf226('0x3a')]['create'](_0x13bd16[_0xf226('0x44')],{})[_0xf226('0x1f')](respondWithResult(_0x1c79ce,0xc9))[_0xf226('0x3f')](handleError(_0x1c79ce,null));};exports[_0xf226('0x1e')]=function(_0x480ca2,_0x16995e){if(_0x480ca2[_0xf226('0x44')]['id']){delete _0x480ca2[_0xf226('0x44')]['id'];}return db['SugarcrmAccount'][_0xf226('0x42')]({'where':{'id':_0x480ca2['params']['id']}})['then'](handleEntityNotFound(_0x16995e,null))['then'](saveUpdates(_0x480ca2['body'],null))[_0xf226('0x1f')](respondWithResult(_0x16995e,null))[_0xf226('0x3f')](handleError(_0x16995e,null));};exports[_0xf226('0x20')]=function(_0x19fd8a,_0x396af2){return db[_0xf226('0x3a')][_0xf226('0x42')]({'where':{'id':_0x19fd8a[_0xf226('0x41')]['id']}})[_0xf226('0x1f')](handleEntityNotFound(_0x396af2,null))[_0xf226('0x1f')](removeEntity(_0x396af2,null))[_0xf226('0x3f')](handleError(_0x396af2,null));};exports['getConfigurations']=function(_0x346dea,_0x251a48,_0x5598ac){var _0x22da18={};var _0x24990f={};var _0x5dc128;var _0x2536b8;return db[_0xf226('0x3a')]['findOne']({'where':{'id':_0x346dea[_0xf226('0x41')]['id']}})['then'](handleEntityNotFound(_0x251a48,null))['then'](function(_0x55592d){if(_0x55592d){_0x5dc128=_0x55592d;_0x24990f[_0xf226('0x28')]=_['keys'](db[_0xf226('0x45')][_0xf226('0x27')]);_0x24990f[_0xf226('0x2a')]=_['keys'](_0x346dea['query']);_0x24990f[_0xf226('0x2b')]=_[_0xf226('0x2c')](_0x24990f[_0xf226('0x28')],_0x24990f['query']);_0x22da18['attributes']=_['intersection'](_0x24990f['model'],qs[_0xf226('0x2e')](_0x346dea[_0xf226('0x2a')][_0xf226('0x2e')]));_0x22da18[_0xf226('0x2d')]=_0x22da18[_0xf226('0x2d')][_0xf226('0x2f')]?_0x22da18[_0xf226('0x2d')]:_0x24990f[_0xf226('0x28')];_0x22da18['order']=qs['sort'](_0x346dea[_0xf226('0x2a')][_0xf226('0x33')]);_0x22da18[_0xf226('0x35')]=qs[_0xf226('0x2b')](_[_0xf226('0x34')](_0x346dea[_0xf226('0x2a')],_0x24990f[_0xf226('0x2b')]));if(_0x346dea[_0xf226('0x2a')][_0xf226('0x38')]){_0x22da18[_0xf226('0x35')]=_['merge'](_0x22da18[_0xf226('0x35')],{'$or':_[_0xf226('0x26')](_0x22da18[_0xf226('0x2d')],function(_0x33e225){var _0x3e5a03={};_0x3e5a03[_0x33e225]={'$like':'%'+_0x346dea[_0xf226('0x2a')][_0xf226('0x38')]+'%'};return _0x3e5a03;})});}_0x22da18=_['merge']({},_0x22da18,_0x346dea[_0xf226('0x39')]);return _0x5dc128[_0xf226('0x46')](_0x22da18);}})[_0xf226('0x1f')](function(_0x52320d){if(_0x52320d){_0x2536b8=_0x52320d[_0xf226('0x2f')];if(!_0x346dea[_0xf226('0x2a')][_0xf226('0x30')](_0xf226('0x31'))){_0x22da18[_0xf226('0x19')]=qs[_0xf226('0x19')](_0x346dea['query'][_0xf226('0x19')]);_0x22da18[_0xf226('0x18')]=qs['offset'](_0x346dea[_0xf226('0x2a')][_0xf226('0x18')]);}return _0x5dc128[_0xf226('0x46')](_0x22da18);}})[_0xf226('0x1f')](function(_0x575990){if(_0x575990){return _0x575990?{'count':_0x2536b8,'rows':_0x575990}:null;}})[_0xf226('0x1f')](respondWithResult(_0x251a48,null))[_0xf226('0x3f')](handleError(_0x251a48,null));};exports[_0xf226('0x47')]=function(_0x549a44,_0x4f2e53,_0x2db55b){if(_0x549a44[_0xf226('0x44')]['id']){delete _0x549a44[_0xf226('0x44')]['id'];}return db['SugarcrmAccount']['findOne']({'where':{'id':_0x549a44[_0xf226('0x41')]['id']}})[_0xf226('0x1f')](handleEntityNotFound(_0x4f2e53,null))[_0xf226('0x1f')](function(_0x27bd9a){if(_0x27bd9a){_0x549a44[_0xf226('0x44')][_0xf226('0x48')]=_0x27bd9a['id'];_0x549a44[_0xf226('0x44')][_0xf226('0x49')]=integrations['getSubjects'](_0x549a44[_0xf226('0x44')][_0xf226('0x4a')],_0x549a44[_0xf226('0x44')]['type']);_0x549a44[_0xf226('0x44')][_0xf226('0x4b')]=integrations[_0xf226('0x4c')](_0x549a44[_0xf226('0x44')][_0xf226('0x4a')],_0x549a44[_0xf226('0x44')][_0xf226('0x4d')]);return db[_0xf226('0x45')][_0xf226('0x43')](_0x549a44[_0xf226('0x44')],{'include':[{'model':db['SugarcrmField'],'as':_0xf226('0x49')},{'model':db['SugarcrmField'],'as':_0xf226('0x4b')}]});}return null;})[_0xf226('0x1f')](respondWithResult(_0x4f2e53,null))['catch'](handleError(_0x4f2e53,null));};exports[_0xf226('0x4e')]=function(_0x156a99,_0x4b5961,_0x25e994){var _0x2d489f='';var _0x4380ba=['id',_0xf226('0x23'),_0xf226('0x4f'),_0xf226('0x50'),_0xf226('0x51'),'date_start','duration_hours',_0xf226('0x52'),_0xf226('0x53'),_0xf226('0x54'),'parent_name',_0xf226('0x55')];return db['SugarcrmAccount'][_0xf226('0x56')]({'where':{'id':_0x156a99[_0xf226('0x41')]['id']},'attributes':['id',_0xf226('0x57'),_0xf226('0x58'),'remoteUri']})[_0xf226('0x1f')](handleEntityNotFound(_0x4b5961,null))[_0xf226('0x1f')](function(_0x550447){if(_0x550447){_0x2d489f=_0x550447['remoteUri'];var _0x1f68dd=_0x2d489f[_0xf226('0x59')](-0x1);if(_0x1f68dd==='/'){_0x2d489f=_0x2d489f['substring'](0x0,_0x2d489f[_0xf226('0x5a')](_0x1f68dd));}return rp({'method':_0xf226('0x5b'),'uri':util[_0xf226('0x5c')](_0xf226('0x5d'),_0x2d489f,_0xf226('0x5e')),'json':!![],'form':{'method':_0xf226('0x5f'),'input_type':_0xf226('0x60'),'response_type':_0xf226('0x60'),'rest_data':JSON[_0xf226('0x61')]({'user_auth':{'user_name':_0x550447['username'],'password':_0x550447[_0xf226('0x58')],'encryption':_0xf226('0x62')},'application':_0xf226('0x63')})}});}})[_0xf226('0x1f')](function(_0x42a1fb){if(_0x42a1fb&&_0x42a1fb[_0xf226('0x23')]!==_0xf226('0x64')&&_0x42a1fb[_0xf226('0x23')]!==_0xf226('0x65')){return rp({'method':_0xf226('0x5b'),'uri':util[_0xf226('0x5c')]('%s%s',_0x2d489f,'/service/v4_1/rest.php'),'json':!![],'form':{'method':'get_module_fields','input_type':_0xf226('0x60'),'response_type':_0xf226('0x60'),'rest_data':JSON[_0xf226('0x61')]({'session':_0x42a1fb['id'],'module_name':_0xf226('0x66')})}})[_0xf226('0x1f')](function(_0x4e80ee){if(_0x4e80ee){var _0x13042d=_[_0xf226('0x67')](_0x4e80ee['module_fields']);_['remove'](_0x13042d,function(_0x32f909){return _0x4380ba[_0xf226('0x68')](_0x32f909[_0xf226('0x23')]);});return{'count':_0x13042d[_0xf226('0x2f')],'rows':_[_0xf226('0x26')](_0x13042d,function(_0x2ecac7){return{'id':_0x2ecac7[_0xf226('0x23')],'name':_0x2ecac7[_0xf226('0x69')],'custom':_[_0xf226('0x6a')](_0x2ecac7[_0xf226('0x23')],'_c')?!![]:![],'options':_0x2ecac7['options']?_[_0xf226('0x26')](_[_0xf226('0x67')](_0x2ecac7[_0xf226('0x39')]),function(_0x50b402){return{'name':_0x50b402[_0xf226('0x6b')],'value':_0x50b402[_0xf226('0x23')]};}):[]};})};}})[_0xf226('0x1f')](respondWithResult(_0x4b5961,null))['catch'](function(_0x4182b1){var _0x31f827=_0x156a99[_0xf226('0x2a')]['test']?0x1f4:_0x4182b1[_0xf226('0x6c')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x31f827,JSON['stringify'](_0x4182b1));delete _0x4182b1[_0xf226('0x23')];if(_0x31f827===0x191){_0x31f827=0x190;}_0x4b5961[_0xf226('0x15')](_0x31f827)[_0xf226('0x24')](_0x156a99[_0xf226('0x2a')][_0xf226('0x6d')]?{'message':_0xf226('0x6e'),'statusCode':_0x4182b1[_0xf226('0x6c')]}:_0x4182b1);});}else{var _0x5ef9d6=0x1f4;_0x4b5961[_0xf226('0x15')](_0x5ef9d6)[_0xf226('0x24')]({'message':_0xf226('0x6e'),'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 9e08cdb..6711678 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 _0xd66d=['exports','define','SugarcrmAccount','int_sugarcrm_accounts','lodash','../../config/logger','bluebird','path','rimraf','./intSugarcrmAccount.attributes','../../components/integrations/configuration'];(function(_0x1c4e6b,_0x5f4e07){var _0x1b2aac=function(_0x317304){while(--_0x317304){_0x1c4e6b['push'](_0x1c4e6b['shift']());}};_0x1b2aac(++_0x5f4e07);}(_0xd66d,0x12d));var _0xdd66=function(_0x5a95fa,_0x4a2fc9){_0x5a95fa=_0x5a95fa-0x0;var _0x1a61b8=_0xd66d[_0x5a95fa];return _0x1a61b8;};'use strict';var _=require(_0xdd66('0x0'));var util=require('util');var logger=require(_0xdd66('0x1'))('api');var moment=require('moment');var BPromise=require(_0xdd66('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdd66('0x3'));var rimraf=require(_0xdd66('0x4'));var config=require('../../config/environment');var attributes=require(_0xdd66('0x5'));var integrations=require(_0xdd66('0x6'));module[_0xdd66('0x7')]=function(_0x1f9143,_0x11e1b4){return _0x1f9143[_0xdd66('0x8')](_0xdd66('0x9'),attributes,{'tableName':_0xdd66('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2906=['rimraf','exports','SugarcrmAccount','int_sugarcrm_accounts','lodash','util','api','bluebird','request-promise','path'];(function(_0x2a4209,_0x2de4fe){var _0x1edd1c=function(_0x51dfac){while(--_0x51dfac){_0x2a4209['push'](_0x2a4209['shift']());}};_0x1edd1c(++_0x2de4fe);}(_0x2906,0xe0));var _0x6290=function(_0x15af2f,_0x3c0a01){_0x15af2f=_0x15af2f-0x0;var _0x359239=_0x2906[_0x15af2f];return _0x359239;};'use strict';var _=require(_0x6290('0x0'));var util=require(_0x6290('0x1'));var logger=require('../../config/logger')(_0x6290('0x2'));var moment=require('moment');var BPromise=require(_0x6290('0x3'));var rp=require(_0x6290('0x4'));var fs=require('fs');var path=require(_0x6290('0x5'));var rimraf=require(_0x6290('0x6'));var config=require('../../config/environment');var attributes=require('./intSugarcrmAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x6290('0x7')]=function(_0x55ce99,_0x3467a9){return _0x55ce99['define'](_0x6290('0x8'),attributes,{'tableName':_0x6290('0x9'),'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 dc1a7ad..8899607 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 _0x012a=['jayson/promise','client','http','request','then','info','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SugarcrmAccount,\x20%s,\x20%s','message','result','catch','findAll','options','raw','attributes','limit','include','map','model','GetSugarcrmAccount','SugarcrmAccount','ShowSugarcrmAccount','lodash','util','randomstring','ioredis','../../mysqldb','rpc','../../config/environment'];(function(_0x87506e,_0x5680ec){var _0x5496a4=function(_0x1e29ab){while(--_0x1e29ab){_0x87506e['push'](_0x87506e['shift']());}};_0x5496a4(++_0x5680ec);}(_0x012a,0x16f));var _0xa012=function(_0xbd56b0,_0x38fe4d){_0xbd56b0=_0xbd56b0-0x0;var _0xb928c=_0x012a[_0xbd56b0];return _0xb928c;};'use strict';var _=require(_0xa012('0x0'));var util=require(_0xa012('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa012('0x2'));var fs=require('fs');var Redis=require(_0xa012('0x3'));var db=require(_0xa012('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa012('0x5'));var config=require(_0xa012('0x6'));var jayson=require(_0xa012('0x7'));var client=jayson[_0xa012('0x8')][_0xa012('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x575145,_0x4e6213,_0x3dd643){return new BPromise(function(_0xdd5e6c,_0xfe0d63){return client[_0xa012('0xa')](_0x575145,_0x3dd643)[_0xa012('0xb')](function(_0x2a3c33){logger[_0xa012('0xc')]('SugarcrmAccount,\x20%s,\x20%s',_0x4e6213,_0xa012('0xd'));logger[_0xa012('0xe')](_0xa012('0xf'),_0x4e6213,_0xa012('0xd'),JSON[_0xa012('0x10')](_0x2a3c33));if(_0x2a3c33[_0xa012('0x11')]){if(_0x2a3c33[_0xa012('0x11')][_0xa012('0x12')]===0x1f4){logger[_0xa012('0x11')](_0xa012('0x13'),_0x4e6213,_0x2a3c33[_0xa012('0x11')]['message']);return _0xfe0d63(_0x2a3c33[_0xa012('0x11')]['message']);}logger['error'](_0xa012('0x13'),_0x4e6213,_0x2a3c33[_0xa012('0x11')][_0xa012('0x14')]);return _0xdd5e6c(_0x2a3c33[_0xa012('0x11')][_0xa012('0x14')]);}else{logger['info'](_0xa012('0x13'),_0x4e6213,_0xa012('0xd'));_0xdd5e6c(_0x2a3c33[_0xa012('0x15')][_0xa012('0x14')]);}})[_0xa012('0x16')](function(_0x4622da){logger[_0xa012('0x11')](_0xa012('0x13'),_0x4e6213,_0x4622da);_0xfe0d63(_0x4622da);});});}exports['GetSugarcrmAccount']=function(_0x31ca8b){var _0x6cf847=this;return new Promise(function(_0xfd485,_0x593b81){return db['SugarcrmAccount'][_0xa012('0x17')]({'raw':_0x31ca8b[_0xa012('0x18')]?_0x31ca8b['options'][_0xa012('0x19')]===undefined?!![]:![]:!![],'where':_0x31ca8b[_0xa012('0x18')]?_0x31ca8b[_0xa012('0x18')]['where']||null:null,'attributes':_0x31ca8b['options']?_0x31ca8b[_0xa012('0x18')][_0xa012('0x1a')]||null:null,'limit':_0x31ca8b[_0xa012('0x18')]?_0x31ca8b[_0xa012('0x18')][_0xa012('0x1b')]||null:null,'include':_0x31ca8b[_0xa012('0x18')]?_0x31ca8b[_0xa012('0x18')][_0xa012('0x1c')]?_[_0xa012('0x1d')](_0x31ca8b[_0xa012('0x18')][_0xa012('0x1c')],function(_0x568463){return{'model':db[_0x568463[_0xa012('0x1e')]],'as':_0x568463['as'],'attributes':_0x568463[_0xa012('0x1a')],'include':_0x568463[_0xa012('0x1c')]?_['map'](_0x568463['include'],function(_0x1b8611){return{'model':db[_0x1b8611['model']],'as':_0x1b8611['as'],'attributes':_0x1b8611[_0xa012('0x1a')],'include':_0x1b8611[_0xa012('0x1c')]?_[_0xa012('0x1d')](_0x1b8611[_0xa012('0x1c')],function(_0x4f4676){return{'model':db[_0x4f4676[_0xa012('0x1e')]],'as':_0x4f4676['as'],'attributes':_0x4f4676[_0xa012('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xa012('0xb')](function(_0xbb7c8a){logger[_0xa012('0xc')]('GetSugarcrmAccount',_0x31ca8b);logger['debug'](_0xa012('0x1f'),_0x31ca8b,JSON['stringify'](_0xbb7c8a));_0xfd485(_0xbb7c8a);})[_0xa012('0x16')](function(_0x4717aa){logger['error'](_0xa012('0x1f'),_0x4717aa[_0xa012('0x14')],_0x31ca8b);_0x593b81(_0x6cf847[_0xa012('0x11')](0x1f4,_0x4717aa[_0xa012('0x14')]));});});};exports['ShowSugarcrmAccount']=function(_0x4b68fa){var _0x1b5be1=this;return new Promise(function(_0x2eb2d5,_0x32df3c){return db[_0xa012('0x20')]['find']({'raw':_0x4b68fa[_0xa012('0x18')]?_0x4b68fa[_0xa012('0x18')][_0xa012('0x19')]===undefined?!![]:![]:!![],'where':_0x4b68fa[_0xa012('0x18')]?_0x4b68fa[_0xa012('0x18')]['where']||null:null,'attributes':_0x4b68fa[_0xa012('0x18')]?_0x4b68fa['options'][_0xa012('0x1a')]||null:null,'include':_0x4b68fa['options']?_0x4b68fa[_0xa012('0x18')][_0xa012('0x1c')]?_[_0xa012('0x1d')](_0x4b68fa[_0xa012('0x18')][_0xa012('0x1c')],function(_0xbc26b){return{'model':db[_0xbc26b[_0xa012('0x1e')]],'as':_0xbc26b['as'],'attributes':_0xbc26b[_0xa012('0x1a')],'include':_0xbc26b['include']?_[_0xa012('0x1d')](_0xbc26b['include'],function(_0x3b93df){return{'model':db[_0x3b93df['model']],'as':_0x3b93df['as'],'attributes':_0x3b93df[_0xa012('0x1a')],'include':_0x3b93df[_0xa012('0x1c')]?_[_0xa012('0x1d')](_0x3b93df[_0xa012('0x1c')],function(_0x181177){return{'model':db[_0x181177[_0xa012('0x1e')]],'as':_0x181177['as'],'attributes':_0x181177[_0xa012('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xa012('0xb')](function(_0x23d492){logger[_0xa012('0xc')](_0xa012('0x21'),_0x4b68fa);logger[_0xa012('0xe')](_0xa012('0x21'),_0x4b68fa,JSON['stringify'](_0x23d492));_0x2eb2d5(_0x23d492);})[_0xa012('0x16')](function(_0x344bfe){logger[_0xa012('0x11')](_0xa012('0x21'),_0x344bfe[_0xa012('0x14')],_0x4b68fa);_0x32df3c(_0x1b5be1['error'](0x1f4,_0x344bfe['message']));});});}; \ No newline at end of file +var _0xa038=['ShowSugarcrmAccount','where','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','client','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','SugarcrmAccount','findAll','options','raw','attributes','limit','include','map','model','GetSugarcrmAccount','debug'];(function(_0x1a545b,_0x5a9a8e){var _0x3ccd0b=function(_0x1ee327){while(--_0x1ee327){_0x1a545b['push'](_0x1a545b['shift']());}};_0x3ccd0b(++_0x5a9a8e);}(_0xa038,0x1f1));var _0x8a03=function(_0x172747,_0x1732bd){_0x172747=_0x172747-0x0;var _0x509692=_0xa038[_0x172747];return _0x509692;};'use strict';var _=require(_0x8a03('0x0'));var util=require(_0x8a03('0x1'));var moment=require(_0x8a03('0x2'));var BPromise=require(_0x8a03('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8a03('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8a03('0x5'));var logger=require(_0x8a03('0x6'))(_0x8a03('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8a03('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x22776f,_0x337b77,_0x34365e){return new BPromise(function(_0x1b8b8e,_0x5a3ab6){return client['request'](_0x22776f,_0x34365e)[_0x8a03('0x9')](function(_0x16b02c){logger[_0x8a03('0xa')](_0x8a03('0xb'),_0x337b77,_0x8a03('0xc'));logger['debug'](_0x8a03('0xd'),_0x337b77,_0x8a03('0xc'),JSON[_0x8a03('0xe')](_0x16b02c));if(_0x16b02c[_0x8a03('0xf')]){if(_0x16b02c[_0x8a03('0xf')][_0x8a03('0x10')]===0x1f4){logger[_0x8a03('0xf')](_0x8a03('0xb'),_0x337b77,_0x16b02c[_0x8a03('0xf')][_0x8a03('0x11')]);return _0x5a3ab6(_0x16b02c[_0x8a03('0xf')]['message']);}logger[_0x8a03('0xf')](_0x8a03('0xb'),_0x337b77,_0x16b02c['error'][_0x8a03('0x11')]);return _0x1b8b8e(_0x16b02c[_0x8a03('0xf')]['message']);}else{logger[_0x8a03('0xa')](_0x8a03('0xb'),_0x337b77,_0x8a03('0xc'));_0x1b8b8e(_0x16b02c[_0x8a03('0x12')][_0x8a03('0x11')]);}})[_0x8a03('0x13')](function(_0x13d9f4){logger[_0x8a03('0xf')](_0x8a03('0xb'),_0x337b77,_0x13d9f4);_0x5a3ab6(_0x13d9f4);});});}exports['GetSugarcrmAccount']=function(_0x2c8118){var _0x388325=this;return new Promise(function(_0x57049b,_0x4a906e){return db[_0x8a03('0x14')][_0x8a03('0x15')]({'raw':_0x2c8118[_0x8a03('0x16')]?_0x2c8118[_0x8a03('0x16')][_0x8a03('0x17')]===undefined?!![]:![]:!![],'where':_0x2c8118[_0x8a03('0x16')]?_0x2c8118[_0x8a03('0x16')]['where']||null:null,'attributes':_0x2c8118[_0x8a03('0x16')]?_0x2c8118[_0x8a03('0x16')][_0x8a03('0x18')]||null:null,'limit':_0x2c8118[_0x8a03('0x16')]?_0x2c8118['options'][_0x8a03('0x19')]||null:null,'include':_0x2c8118[_0x8a03('0x16')]?_0x2c8118[_0x8a03('0x16')][_0x8a03('0x1a')]?_['map'](_0x2c8118[_0x8a03('0x16')]['include'],function(_0x1140b8){return{'model':db[_0x1140b8['model']],'as':_0x1140b8['as'],'attributes':_0x1140b8[_0x8a03('0x18')],'include':_0x1140b8[_0x8a03('0x1a')]?_[_0x8a03('0x1b')](_0x1140b8['include'],function(_0x204b80){return{'model':db[_0x204b80[_0x8a03('0x1c')]],'as':_0x204b80['as'],'attributes':_0x204b80['attributes'],'include':_0x204b80['include']?_[_0x8a03('0x1b')](_0x204b80[_0x8a03('0x1a')],function(_0x1bfc99){return{'model':db[_0x1bfc99[_0x8a03('0x1c')]],'as':_0x1bfc99['as'],'attributes':_0x1bfc99[_0x8a03('0x18')]};}):[]};}):[]};}):[]:[]})[_0x8a03('0x9')](function(_0x1d182d){logger[_0x8a03('0xa')](_0x8a03('0x1d'),_0x2c8118);logger[_0x8a03('0x1e')]('GetSugarcrmAccount',_0x2c8118,JSON[_0x8a03('0xe')](_0x1d182d));_0x57049b(_0x1d182d);})[_0x8a03('0x13')](function(_0x4ef0e6){logger[_0x8a03('0xf')](_0x8a03('0x1d'),_0x4ef0e6[_0x8a03('0x11')],_0x2c8118);_0x4a906e(_0x388325[_0x8a03('0xf')](0x1f4,_0x4ef0e6[_0x8a03('0x11')]));});});};exports[_0x8a03('0x1f')]=function(_0x484ae9){var _0x3d41c8=this;return new Promise(function(_0x1cd942,_0x418c85){return db[_0x8a03('0x14')]['find']({'raw':_0x484ae9[_0x8a03('0x16')]?_0x484ae9[_0x8a03('0x16')][_0x8a03('0x17')]===undefined?!![]:![]:!![],'where':_0x484ae9['options']?_0x484ae9['options'][_0x8a03('0x20')]||null:null,'attributes':_0x484ae9[_0x8a03('0x16')]?_0x484ae9[_0x8a03('0x16')][_0x8a03('0x18')]||null:null,'include':_0x484ae9[_0x8a03('0x16')]?_0x484ae9[_0x8a03('0x16')][_0x8a03('0x1a')]?_[_0x8a03('0x1b')](_0x484ae9[_0x8a03('0x16')]['include'],function(_0x5c083c){return{'model':db[_0x5c083c[_0x8a03('0x1c')]],'as':_0x5c083c['as'],'attributes':_0x5c083c['attributes'],'include':_0x5c083c[_0x8a03('0x1a')]?_[_0x8a03('0x1b')](_0x5c083c[_0x8a03('0x1a')],function(_0x2b7856){return{'model':db[_0x2b7856[_0x8a03('0x1c')]],'as':_0x2b7856['as'],'attributes':_0x2b7856[_0x8a03('0x18')],'include':_0x2b7856[_0x8a03('0x1a')]?_['map'](_0x2b7856['include'],function(_0x5def17){return{'model':db[_0x5def17[_0x8a03('0x1c')]],'as':_0x5def17['as'],'attributes':_0x5def17[_0x8a03('0x18')]};}):[]};}):[]};}):[]:[]})[_0x8a03('0x9')](function(_0x28d5cc){logger[_0x8a03('0xa')]('ShowSugarcrmAccount',_0x484ae9);logger['debug'](_0x8a03('0x1f'),_0x484ae9,JSON[_0x8a03('0xe')](_0x28d5cc));_0x1cd942(_0x28d5cc);})[_0x8a03('0x13')](function(_0x2ecf37){logger[_0x8a03('0xf')](_0x8a03('0x1f'),_0x2ecf37['message'],_0x484ae9);_0x418c85(_0x3d41c8[_0x8a03('0xf')](0x1f4,_0x2ecf37[_0x8a03('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index c995389..001bfda 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 _0x3551=['getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects'];(function(_0x211d7b,_0x1960b7){var _0x3b39b6=function(_0x4ee31f){while(--_0x4ee31f){_0x211d7b['push'](_0x211d7b['shift']());}};_0x3b39b6(++_0x1960b7);}(_0x3551,0x1ca));var _0x1355=function(_0x5de818,_0x7c4485){_0x5de818=_0x5de818-0x0;var _0x345670=_0x3551[_0x5de818];return _0x345670;};'use strict';var multer=require(_0x1355('0x0'));var util=require(_0x1355('0x1'));var path=require(_0x1355('0x2'));var timeout=require(_0x1355('0x3'));var express=require(_0x1355('0x4'));var router=express[_0x1355('0x5')]();var fs_extra=require(_0x1355('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x1355('0x7'));var config=require(_0x1355('0x8'));var controller=require(_0x1355('0x9'));router[_0x1355('0xa')]('/',auth[_0x1355('0xb')](),controller[_0x1355('0xc')]);router[_0x1355('0xa')](_0x1355('0xd'),auth['isAuthenticated'](),controller[_0x1355('0xe')]);router[_0x1355('0xa')](_0x1355('0xf'),auth[_0x1355('0xb')](),controller[_0x1355('0x10')]);router[_0x1355('0xa')](_0x1355('0x11'),auth[_0x1355('0xb')](),controller[_0x1355('0x12')]);router[_0x1355('0xa')](_0x1355('0x13'),auth['isAuthenticated'](),controller[_0x1355('0x14')]);router[_0x1355('0x15')]('/',auth[_0x1355('0xb')](),controller[_0x1355('0x16')]);router[_0x1355('0x17')](_0x1355('0xd'),auth[_0x1355('0xb')](),controller[_0x1355('0x18')]);router[_0x1355('0x19')](_0x1355('0xd'),auth[_0x1355('0xb')](),controller[_0x1355('0x1a')]);module[_0x1355('0x1b')]=router; \ No newline at end of file +var _0x0c96=['destroy','multer','util','express','Router','./intSugarcrmConfiguration.controller','get','isAuthenticated','/:id','show','getFields','getSubjects','/:id/descriptions','getDescriptions','create','put','delete'];(function(_0x5d04d1,_0x31d44f){var _0x4b8e13=function(_0x22caff){while(--_0x22caff){_0x5d04d1['push'](_0x5d04d1['shift']());}};_0x4b8e13(++_0x31d44f);}(_0x0c96,0x9a));var _0x60c9=function(_0x1d4bdc,_0x4175f7){_0x1d4bdc=_0x1d4bdc-0x0;var _0x5892c4=_0x0c96[_0x1d4bdc];return _0x5892c4;};'use strict';var multer=require(_0x60c9('0x0'));var util=require(_0x60c9('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x60c9('0x2'));var router=express[_0x60c9('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x60c9('0x4'));router[_0x60c9('0x5')]('/',auth[_0x60c9('0x6')](),controller['index']);router[_0x60c9('0x5')](_0x60c9('0x7'),auth['isAuthenticated'](),controller[_0x60c9('0x8')]);router[_0x60c9('0x5')]('/:id/fields',auth[_0x60c9('0x6')](),controller[_0x60c9('0x9')]);router['get']('/:id/subjects',auth[_0x60c9('0x6')](),controller[_0x60c9('0xa')]);router['get'](_0x60c9('0xb'),auth[_0x60c9('0x6')](),controller[_0x60c9('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x60c9('0xd')]);router[_0x60c9('0xe')](_0x60c9('0x7'),auth[_0x60c9('0x6')](),controller['update']);router[_0x60c9('0xf')](_0x60c9('0x7'),auth[_0x60c9('0x6')](),controller[_0x60c9('0x10')]);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 5a4b776..b76a87d 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 _0xb791=['STRING','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb791,0xb3));var _0x1b79=function(_0x172948,_0x4262cc){_0x172948=_0x172948-0x0;var _0x4aeaa9=_0xb791[_0x172948];return _0x4aeaa9;};'use strict';var Sequelize=require(_0x1b79('0x0'));module['exports']={'name':{'type':Sequelize[_0x1b79('0x1')]},'description':{'type':Sequelize[_0x1b79('0x1')]}}; \ No newline at end of file +var _0x51cb=['STRING'];(function(_0x2b1a80,_0x52780d){var _0x4061c9=function(_0x24379c){while(--_0x24379c){_0x2b1a80['push'](_0x2b1a80['shift']());}};_0x4061c9(++_0x52780d);}(_0x51cb,0x1f0));var _0xb51c=function(_0xa059b5,_0x15063b){_0xa059b5=_0xa059b5-0x0;var _0xec4998=_0x51cb[_0xa059b5];return _0xec4998;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb51c('0x0')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 9001f05..e1c2eee 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 _0x9667=['model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','getFields','findOne','SugarcrmField','nolimit','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','bluebird','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/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','send','index','map','SugarcrmConfiguration','rawAttributes','fieldName','type','key'];(function(_0x321946,_0x53c4fd){var _0x3ab590=function(_0x17bdb9){while(--_0x17bdb9){_0x321946['push'](_0x321946['shift']());}};_0x3ab590(++_0x53c4fd);}(_0x9667,0xcb));var _0x7966=function(_0x5ef4ac,_0x2c955a){_0x5ef4ac=_0x5ef4ac-0x0;var _0x219f07=_0x9667[_0x5ef4ac];return _0x219f07;};'use strict';var emlformat=require(_0x7966('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7966('0x1'));var jsonpatch=require(_0x7966('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x7966('0x3'));var Mustache=require(_0x7966('0x4'));var util=require(_0x7966('0x5'));var path=require(_0x7966('0x6'));var sox=require(_0x7966('0x7'));var csv=require(_0x7966('0x8'));var ejs=require(_0x7966('0x9'));var fs=require('fs');var fs_extra=require(_0x7966('0xa'));var _=require(_0x7966('0xb'));var squel=require(_0x7966('0xc'));var crypto=require(_0x7966('0xd'));var jsforce=require(_0x7966('0xe'));var deskjs=require(_0x7966('0xf'));var toCsv=require(_0x7966('0x8'));var querystring=require(_0x7966('0x10'));var Papa=require(_0x7966('0x11'));var Redis=require('ioredis');var authService=require(_0x7966('0x12'));var qs=require(_0x7966('0x13'));var as=require(_0x7966('0x14'));var hardwareService=require(_0x7966('0x15'));var logger=require(_0x7966('0x16'))(_0x7966('0x17'));var utils=require('../../config/utils');var config=require(_0x7966('0x18'));var licenseUtil=require(_0x7966('0x19'));var db=require(_0x7966('0x1a'))['db'];function respondWithStatusCode(_0x3cb57d,_0x336b80){_0x336b80=_0x336b80||0xcc;return function(_0x133e50){if(_0x133e50){return _0x3cb57d[_0x7966('0x1b')](_0x336b80);}return _0x3cb57d[_0x7966('0x1c')](_0x336b80)['end']();};}function respondWithResult(_0x205153,_0x1a0c56){_0x1a0c56=_0x1a0c56||0xc8;return function(_0x496455){if(_0x496455){return _0x205153[_0x7966('0x1c')](_0x1a0c56)[_0x7966('0x1d')](_0x496455);}};}function respondWithFilteredResult(_0x13fd5b,_0x4aecde){return function(_0x2bae60){if(_0x2bae60){var _0x3e6dd9=typeof _0x4aecde[_0x7966('0x1e')]===_0x7966('0x1f')&&typeof _0x4aecde[_0x7966('0x20')]===_0x7966('0x1f');var _0x4482d8=_0x2bae60[_0x7966('0x21')];var _0x50ec74=_0x3e6dd9?0x0:_0x4aecde[_0x7966('0x1e')];var _0x1cdf4d=_0x3e6dd9?_0x2bae60['count']:_0x4aecde[_0x7966('0x1e')]+_0x4aecde[_0x7966('0x20')];var _0x420ff5;if(_0x1cdf4d>=_0x4482d8){_0x1cdf4d=_0x4482d8;_0x420ff5=0xc8;}else{_0x420ff5=0xce;}_0x13fd5b[_0x7966('0x1c')](_0x420ff5);return _0x13fd5b['set'](_0x7966('0x22'),_0x50ec74+'-'+_0x1cdf4d+'/'+_0x4482d8)['json'](_0x2bae60);}return null;};}function patchUpdates(_0x517be0){return function(_0x5f1802){try{jsonpatch[_0x7966('0x23')](_0x5f1802,_0x517be0,!![]);}catch(_0xc12f28){return BPromise[_0x7966('0x24')](_0xc12f28);}return _0x5f1802['save']();};}function saveUpdates(_0x3ac496,_0xc6062d){return function(_0x5bc69e){if(_0x5bc69e){return _0x5bc69e[_0x7966('0x25')](_0x3ac496)[_0x7966('0x26')](function(_0x11e2b9){return _0x11e2b9;});}return null;};}function removeEntity(_0x61c3c4,_0x3ab3c2){return function(_0x32d05d){if(_0x32d05d){return _0x32d05d[_0x7966('0x27')]()[_0x7966('0x26')](function(){_0x61c3c4[_0x7966('0x1c')](0xcc)[_0x7966('0x28')]();});}};}function handleEntityNotFound(_0x467604,_0x5860e8){return function(_0x743d38){if(!_0x743d38){_0x467604[_0x7966('0x1b')](0x194);}return _0x743d38;};}function handleError(_0x2af629,_0x1c3268){_0x1c3268=_0x1c3268||0x1f4;return function(_0x5477f8){logger[_0x7966('0x29')](_0x5477f8[_0x7966('0x2a')]);if(_0x5477f8['name']){delete _0x5477f8[_0x7966('0x2b')];}_0x2af629['status'](_0x1c3268)[_0x7966('0x2c')](_0x5477f8);};}exports[_0x7966('0x2d')]=function(_0x1480c5,_0x6d14f7){var _0x46d3dd={},_0x289646={},_0xdbef47={'count':0x0,'rows':[]};var _0x3cc683=_[_0x7966('0x2e')](db[_0x7966('0x2f')][_0x7966('0x30')],function(_0x5cabc6){return{'name':_0x5cabc6[_0x7966('0x31')],'type':_0x5cabc6[_0x7966('0x32')][_0x7966('0x33')]};});_0x289646[_0x7966('0x34')]=_[_0x7966('0x2e')](_0x3cc683,_0x7966('0x2b'));_0x289646[_0x7966('0x35')]=_[_0x7966('0x36')](_0x1480c5[_0x7966('0x35')]);_0x289646[_0x7966('0x37')]=_['intersection'](_0x289646[_0x7966('0x34')],_0x289646[_0x7966('0x35')]);_0x46d3dd[_0x7966('0x38')]=_[_0x7966('0x39')](_0x289646[_0x7966('0x34')],qs['fields'](_0x1480c5['query'][_0x7966('0x3a')]));_0x46d3dd[_0x7966('0x38')]=_0x46d3dd[_0x7966('0x38')][_0x7966('0x3b')]?_0x46d3dd['attributes']:_0x289646['model'];if(!_0x1480c5['query'][_0x7966('0x3c')]('nolimit')){_0x46d3dd[_0x7966('0x20')]=qs[_0x7966('0x20')](_0x1480c5[_0x7966('0x35')][_0x7966('0x20')]);_0x46d3dd['offset']=qs[_0x7966('0x1e')](_0x1480c5[_0x7966('0x35')][_0x7966('0x1e')]);}_0x46d3dd[_0x7966('0x3d')]=qs[_0x7966('0x3e')](_0x1480c5[_0x7966('0x35')][_0x7966('0x3e')]);_0x46d3dd['where']=qs['filters'](_[_0x7966('0x3f')](_0x1480c5[_0x7966('0x35')],_0x289646[_0x7966('0x37')]),_0x3cc683);if(_0x1480c5[_0x7966('0x35')][_0x7966('0x40')]){_0x46d3dd['where']=_[_0x7966('0x41')](_0x46d3dd[_0x7966('0x42')],{'$or':_[_0x7966('0x2e')](_0x3cc683,function(_0x44505d){if(_0x44505d['type']!==_0x7966('0x43')){var _0xd918a2={};_0xd918a2[_0x44505d[_0x7966('0x2b')]]={'$like':'%'+_0x1480c5[_0x7966('0x35')][_0x7966('0x40')]+'%'};return _0xd918a2;}})});}_0x46d3dd=_[_0x7966('0x41')]({},_0x46d3dd,_0x1480c5[_0x7966('0x44')]);var _0x328bae={'where':_0x46d3dd['where']};return db[_0x7966('0x2f')][_0x7966('0x21')](_0x328bae)['then'](function(_0x50393a){_0xdbef47[_0x7966('0x21')]=_0x50393a;if(_0x1480c5['query'][_0x7966('0x45')]){_0x46d3dd[_0x7966('0x46')]=[{'all':!![]}];}return db[_0x7966('0x2f')][_0x7966('0x47')](_0x46d3dd);})[_0x7966('0x26')](function(_0x20df67){_0xdbef47[_0x7966('0x48')]=_0x20df67;return _0xdbef47;})[_0x7966('0x26')](respondWithFilteredResult(_0x6d14f7,_0x46d3dd))[_0x7966('0x49')](handleError(_0x6d14f7,null));};exports[_0x7966('0x4a')]=function(_0x5c54f1,_0x522d8c){var _0x360315={'raw':![],'where':{'id':_0x5c54f1[_0x7966('0x4b')]['id']}},_0x433753={};_0x433753['model']=_[_0x7966('0x36')](db[_0x7966('0x2f')][_0x7966('0x30')]);_0x433753['query']=_[_0x7966('0x36')](_0x5c54f1[_0x7966('0x35')]);_0x433753[_0x7966('0x37')]=_[_0x7966('0x39')](_0x433753[_0x7966('0x34')],_0x433753[_0x7966('0x35')]);_0x360315[_0x7966('0x38')]=_[_0x7966('0x39')](_0x433753['model'],qs[_0x7966('0x3a')](_0x5c54f1[_0x7966('0x35')][_0x7966('0x3a')]));_0x360315[_0x7966('0x38')]=_0x360315[_0x7966('0x38')]['length']?_0x360315[_0x7966('0x38')]:_0x433753[_0x7966('0x34')];if(_0x5c54f1[_0x7966('0x35')][_0x7966('0x45')]){_0x360315[_0x7966('0x46')]=[{'all':!![]}];}_0x360315=_[_0x7966('0x41')]({},_0x360315,_0x5c54f1['options']);return db[_0x7966('0x2f')][_0x7966('0x4c')](_0x360315)[_0x7966('0x26')](handleEntityNotFound(_0x522d8c,null))[_0x7966('0x26')](respondWithResult(_0x522d8c,null))[_0x7966('0x49')](handleError(_0x522d8c,null));};exports[_0x7966('0x4d')]=function(_0x3861b4,_0x15bdf7){return db[_0x7966('0x2f')]['create'](_0x3861b4[_0x7966('0x4e')],{})[_0x7966('0x26')](respondWithResult(_0x15bdf7,0xc9))[_0x7966('0x49')](handleError(_0x15bdf7,null));};exports[_0x7966('0x25')]=function(_0x25baa0,_0x8e2c5d){if(_0x25baa0[_0x7966('0x4e')]['id']){delete _0x25baa0['body']['id'];}return db[_0x7966('0x2f')][_0x7966('0x4c')]({'where':{'id':_0x25baa0[_0x7966('0x4b')]['id']}})[_0x7966('0x26')](handleEntityNotFound(_0x8e2c5d,null))['then'](saveUpdates(_0x25baa0[_0x7966('0x4e')],null))[_0x7966('0x26')](respondWithResult(_0x8e2c5d,null))[_0x7966('0x49')](handleError(_0x8e2c5d,null));};exports[_0x7966('0x27')]=function(_0x5a9274,_0x59c36a){return db[_0x7966('0x2f')]['find']({'where':{'id':_0x5a9274[_0x7966('0x4b')]['id']}})[_0x7966('0x26')](handleEntityNotFound(_0x59c36a,null))['then'](removeEntity(_0x59c36a,null))[_0x7966('0x49')](handleError(_0x59c36a,null));};exports[_0x7966('0x4f')]=function(_0x52ead2,_0x3b7ed9,_0x3eca13){var _0x226ffd={};var _0x41f21f={};var _0x5a9063;var _0x5ee6ed;return db['SugarcrmConfiguration'][_0x7966('0x50')]({'where':{'id':_0x52ead2[_0x7966('0x4b')]['id']}})[_0x7966('0x26')](handleEntityNotFound(_0x3b7ed9,null))[_0x7966('0x26')](function(_0xeecc68){if(_0xeecc68){_0x5a9063=_0xeecc68;_0x41f21f['model']=_[_0x7966('0x36')](db[_0x7966('0x51')][_0x7966('0x30')]);_0x41f21f['query']=_[_0x7966('0x36')](_0x52ead2['query']);_0x41f21f['filters']=_['intersection'](_0x41f21f['model'],_0x41f21f[_0x7966('0x35')]);_0x226ffd[_0x7966('0x38')]=_[_0x7966('0x39')](_0x41f21f[_0x7966('0x34')],qs['fields'](_0x52ead2[_0x7966('0x35')][_0x7966('0x3a')]));_0x226ffd[_0x7966('0x38')]=_0x226ffd[_0x7966('0x38')][_0x7966('0x3b')]?_0x226ffd[_0x7966('0x38')]:_0x41f21f[_0x7966('0x34')];_0x226ffd[_0x7966('0x3d')]=qs[_0x7966('0x3e')](_0x52ead2[_0x7966('0x35')][_0x7966('0x3e')]);_0x226ffd[_0x7966('0x42')]=qs[_0x7966('0x37')](_[_0x7966('0x3f')](_0x52ead2[_0x7966('0x35')],_0x41f21f['filters']));if(_0x52ead2['query']['filter']){_0x226ffd['where']=_[_0x7966('0x41')](_0x226ffd[_0x7966('0x42')],{'$or':_[_0x7966('0x2e')](_0x226ffd[_0x7966('0x38')],function(_0x26d1e5){var _0x25bd7c={};_0x25bd7c[_0x26d1e5]={'$like':'%'+_0x52ead2[_0x7966('0x35')]['filter']+'%'};return _0x25bd7c;})});}_0x226ffd=_[_0x7966('0x41')]({},_0x226ffd,_0x52ead2['options']);return _0x5a9063['getFields'](_0x226ffd);}})['then'](function(_0x4cbbbf){if(_0x4cbbbf){_0x5ee6ed=_0x4cbbbf[_0x7966('0x3b')];if(!_0x52ead2[_0x7966('0x35')][_0x7966('0x3c')](_0x7966('0x52'))){_0x226ffd[_0x7966('0x20')]=qs[_0x7966('0x20')](_0x52ead2['query'][_0x7966('0x20')]);_0x226ffd[_0x7966('0x1e')]=qs[_0x7966('0x1e')](_0x52ead2[_0x7966('0x35')]['offset']);}return _0x5a9063[_0x7966('0x4f')](_0x226ffd);}})[_0x7966('0x26')](function(_0x332d0f){if(_0x332d0f){return _0x332d0f?{'count':_0x5ee6ed,'rows':_0x332d0f}:null;}})['then'](respondWithResult(_0x3b7ed9,null))[_0x7966('0x49')](handleError(_0x3b7ed9,null));};exports[_0x7966('0x53')]=function(_0xfbda3d,_0x56c0c4,_0x12516e){var _0x27602c={};var _0x22d7be={};var _0x18777c;var _0x1ff81d;return db[_0x7966('0x2f')][_0x7966('0x50')]({'where':{'id':_0xfbda3d[_0x7966('0x4b')]['id']}})[_0x7966('0x26')](handleEntityNotFound(_0x56c0c4,null))[_0x7966('0x26')](function(_0x4c7bd2){if(_0x4c7bd2){_0x18777c=_0x4c7bd2;_0x22d7be['model']=_[_0x7966('0x36')](db['SugarcrmField'][_0x7966('0x30')]);_0x22d7be[_0x7966('0x35')]=_[_0x7966('0x36')](_0xfbda3d['query']);_0x22d7be[_0x7966('0x37')]=_[_0x7966('0x39')](_0x22d7be[_0x7966('0x34')],_0x22d7be[_0x7966('0x35')]);_0x27602c[_0x7966('0x38')]=_[_0x7966('0x39')](_0x22d7be[_0x7966('0x34')],qs[_0x7966('0x3a')](_0xfbda3d[_0x7966('0x35')][_0x7966('0x3a')]));_0x27602c[_0x7966('0x38')]=_0x27602c[_0x7966('0x38')][_0x7966('0x3b')]?_0x27602c[_0x7966('0x38')]:_0x22d7be[_0x7966('0x34')];_0x27602c[_0x7966('0x3d')]=qs[_0x7966('0x3e')](_0xfbda3d['query'][_0x7966('0x3e')]);_0x27602c[_0x7966('0x42')]=qs['filters'](_[_0x7966('0x3f')](_0xfbda3d[_0x7966('0x35')],_0x22d7be[_0x7966('0x37')]));if(_0xfbda3d[_0x7966('0x35')]['filter']){_0x27602c['where']=_[_0x7966('0x41')](_0x27602c[_0x7966('0x42')],{'$or':_[_0x7966('0x2e')](_0x27602c[_0x7966('0x38')],function(_0x296f5d){var _0x1c50ae={};_0x1c50ae[_0x296f5d]={'$like':'%'+_0xfbda3d[_0x7966('0x35')][_0x7966('0x40')]+'%'};return _0x1c50ae;})});}_0x27602c=_[_0x7966('0x41')]({},_0x27602c,_0xfbda3d[_0x7966('0x44')]);return _0x18777c[_0x7966('0x53')](_0x27602c);}})[_0x7966('0x26')](function(_0x464b16){if(_0x464b16){_0x1ff81d=_0x464b16[_0x7966('0x3b')];if(!_0xfbda3d[_0x7966('0x35')][_0x7966('0x3c')](_0x7966('0x52'))){_0x27602c['limit']=qs[_0x7966('0x20')](_0xfbda3d['query'][_0x7966('0x20')]);_0x27602c[_0x7966('0x1e')]=qs['offset'](_0xfbda3d[_0x7966('0x35')][_0x7966('0x1e')]);}return _0x18777c[_0x7966('0x53')](_0x27602c);}})[_0x7966('0x26')](function(_0x2aae23){if(_0x2aae23){return _0x2aae23?{'count':_0x1ff81d,'rows':_0x2aae23}:null;}})['then'](respondWithResult(_0x56c0c4,null))[_0x7966('0x49')](handleError(_0x56c0c4,null));};exports['getDescriptions']=function(_0x3c7f6d,_0x92bf17,_0x7b2c7){var _0x280636={};var _0x37ee72={};var _0x10dc45;var _0x5839f6;return db[_0x7966('0x2f')][_0x7966('0x50')]({'where':{'id':_0x3c7f6d[_0x7966('0x4b')]['id']}})[_0x7966('0x26')](handleEntityNotFound(_0x92bf17,null))[_0x7966('0x26')](function(_0x3b535c){if(_0x3b535c){_0x10dc45=_0x3b535c;_0x37ee72['model']=_[_0x7966('0x36')](db['SugarcrmField'][_0x7966('0x30')]);_0x37ee72[_0x7966('0x35')]=_['keys'](_0x3c7f6d[_0x7966('0x35')]);_0x37ee72[_0x7966('0x37')]=_['intersection'](_0x37ee72[_0x7966('0x34')],_0x37ee72['query']);_0x280636[_0x7966('0x38')]=_[_0x7966('0x39')](_0x37ee72['model'],qs['fields'](_0x3c7f6d[_0x7966('0x35')][_0x7966('0x3a')]));_0x280636['attributes']=_0x280636[_0x7966('0x38')]['length']?_0x280636['attributes']:_0x37ee72[_0x7966('0x34')];_0x280636[_0x7966('0x3d')]=qs[_0x7966('0x3e')](_0x3c7f6d['query'][_0x7966('0x3e')]);_0x280636['where']=qs['filters'](_[_0x7966('0x3f')](_0x3c7f6d[_0x7966('0x35')],_0x37ee72['filters']));if(_0x3c7f6d['query'][_0x7966('0x40')]){_0x280636['where']=_[_0x7966('0x41')](_0x280636[_0x7966('0x42')],{'$or':_[_0x7966('0x2e')](_0x280636[_0x7966('0x38')],function(_0x15b3c2){var _0x2c5279={};_0x2c5279[_0x15b3c2]={'$like':'%'+_0x3c7f6d[_0x7966('0x35')][_0x7966('0x40')]+'%'};return _0x2c5279;})});}_0x280636=_[_0x7966('0x41')]({},_0x280636,_0x3c7f6d[_0x7966('0x44')]);return _0x10dc45[_0x7966('0x54')](_0x280636);}})['then'](function(_0x3f39cf){if(_0x3f39cf){_0x5839f6=_0x3f39cf[_0x7966('0x3b')];if(!_0x3c7f6d[_0x7966('0x35')]['hasOwnProperty'](_0x7966('0x52'))){_0x280636[_0x7966('0x20')]=qs['limit'](_0x3c7f6d[_0x7966('0x35')][_0x7966('0x20')]);_0x280636[_0x7966('0x1e')]=qs[_0x7966('0x1e')](_0x3c7f6d[_0x7966('0x35')][_0x7966('0x1e')]);}return _0x10dc45[_0x7966('0x54')](_0x280636);}})[_0x7966('0x26')](function(_0x451ee7){if(_0x451ee7){return _0x451ee7?{'count':_0x5839f6,'rows':_0x451ee7}:null;}})[_0x7966('0x26')](respondWithResult(_0x92bf17,null))[_0x7966('0x49')](handleError(_0x92bf17,null));}; \ No newline at end of file +var _0x82a8=['intersection','length','find','create','body','getFields','findOne','SugarcrmField','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then','destroy','end','stack','index','SugarcrmConfiguration','rawAttributes','fieldName','type','model','map','name','query','keys','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params'];(function(_0x4fa489,_0x4cba6b){var _0x41d2ce=function(_0x364060){while(--_0x364060){_0x4fa489['push'](_0x4fa489['shift']());}};_0x41d2ce(++_0x4cba6b);}(_0x82a8,0x195));var _0x882a=function(_0xce3b06,_0x2bc3b0){_0xce3b06=_0xce3b06-0x0;var _0x2761d3=_0x82a8[_0xce3b06];return _0x2761d3;};'use strict';var emlformat=require(_0x882a('0x0'));var rimraf=require(_0x882a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x882a('0x2'));var rp=require(_0x882a('0x3'));var moment=require(_0x882a('0x4'));var BPromise=require(_0x882a('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x882a('0x6'));var csv=require('to-csv');var ejs=require(_0x882a('0x7'));var fs=require('fs');var fs_extra=require(_0x882a('0x8'));var _=require(_0x882a('0x9'));var squel=require(_0x882a('0xa'));var crypto=require('crypto');var jsforce=require(_0x882a('0xb'));var deskjs=require(_0x882a('0xc'));var toCsv=require(_0x882a('0xd'));var querystring=require(_0x882a('0xe'));var Papa=require(_0x882a('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x882a('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x882a('0x11'))(_0x882a('0x12'));var utils=require(_0x882a('0x13'));var config=require(_0x882a('0x14'));var licenseUtil=require(_0x882a('0x15'));var db=require(_0x882a('0x16'))['db'];function respondWithStatusCode(_0x338275,_0x40556b){_0x40556b=_0x40556b||0xcc;return function(_0x322c97){if(_0x322c97){return _0x338275[_0x882a('0x17')](_0x40556b);}return _0x338275[_0x882a('0x18')](_0x40556b)['end']();};}function respondWithResult(_0x3202c1,_0x3811b0){_0x3811b0=_0x3811b0||0xc8;return function(_0x4730ac){if(_0x4730ac){return _0x3202c1[_0x882a('0x18')](_0x3811b0)['json'](_0x4730ac);}};}function respondWithFilteredResult(_0xc9aaba,_0x2c41ef){return function(_0x181787){if(_0x181787){var _0x2af67d=typeof _0x2c41ef[_0x882a('0x19')]===_0x882a('0x1a')&&typeof _0x2c41ef[_0x882a('0x1b')]===_0x882a('0x1a');var _0xc4c8ae=_0x181787[_0x882a('0x1c')];var _0x36cdce=_0x2af67d?0x0:_0x2c41ef[_0x882a('0x19')];var _0x2971e4=_0x2af67d?_0x181787[_0x882a('0x1c')]:_0x2c41ef['offset']+_0x2c41ef[_0x882a('0x1b')];var _0x61e424;if(_0x2971e4>=_0xc4c8ae){_0x2971e4=_0xc4c8ae;_0x61e424=0xc8;}else{_0x61e424=0xce;}_0xc9aaba[_0x882a('0x18')](_0x61e424);return _0xc9aaba[_0x882a('0x1d')](_0x882a('0x1e'),_0x36cdce+'-'+_0x2971e4+'/'+_0xc4c8ae)[_0x882a('0x1f')](_0x181787);}return null;};}function patchUpdates(_0x3d9912){return function(_0x486908){try{jsonpatch[_0x882a('0x20')](_0x486908,_0x3d9912,!![]);}catch(_0x4dfd1d){return BPromise['reject'](_0x4dfd1d);}return _0x486908[_0x882a('0x21')]();};}function saveUpdates(_0x1ec880,_0x2dd7dd){return function(_0x5c468d){if(_0x5c468d){return _0x5c468d[_0x882a('0x22')](_0x1ec880)[_0x882a('0x23')](function(_0x4aadfc){return _0x4aadfc;});}return null;};}function removeEntity(_0x20495f,_0x50cf9d){return function(_0x4391c0){if(_0x4391c0){return _0x4391c0[_0x882a('0x24')]()[_0x882a('0x23')](function(){_0x20495f['status'](0xcc)[_0x882a('0x25')]();});}};}function handleEntityNotFound(_0x45a7d7,_0x4c364f){return function(_0x5514b0){if(!_0x5514b0){_0x45a7d7[_0x882a('0x17')](0x194);}return _0x5514b0;};}function handleError(_0x3046f7,_0x54e52d){_0x54e52d=_0x54e52d||0x1f4;return function(_0x4a54d6){logger['error'](_0x4a54d6[_0x882a('0x26')]);if(_0x4a54d6['name']){delete _0x4a54d6['name'];}_0x3046f7['status'](_0x54e52d)['send'](_0x4a54d6);};}exports[_0x882a('0x27')]=function(_0x5181a0,_0x2a8e42){var _0x4e33de={},_0x2d42f9={},_0x3d46c0={'count':0x0,'rows':[]};var _0x59df96=_['map'](db[_0x882a('0x28')][_0x882a('0x29')],function(_0x233941){return{'name':_0x233941[_0x882a('0x2a')],'type':_0x233941[_0x882a('0x2b')]['key']};});_0x2d42f9[_0x882a('0x2c')]=_[_0x882a('0x2d')](_0x59df96,_0x882a('0x2e'));_0x2d42f9[_0x882a('0x2f')]=_[_0x882a('0x30')](_0x5181a0['query']);_0x2d42f9[_0x882a('0x31')]=_['intersection'](_0x2d42f9['model'],_0x2d42f9[_0x882a('0x2f')]);_0x4e33de[_0x882a('0x32')]=_['intersection'](_0x2d42f9['model'],qs[_0x882a('0x33')](_0x5181a0[_0x882a('0x2f')][_0x882a('0x33')]));_0x4e33de[_0x882a('0x32')]=_0x4e33de['attributes']['length']?_0x4e33de[_0x882a('0x32')]:_0x2d42f9[_0x882a('0x2c')];if(!_0x5181a0[_0x882a('0x2f')][_0x882a('0x34')](_0x882a('0x35'))){_0x4e33de['limit']=qs[_0x882a('0x1b')](_0x5181a0[_0x882a('0x2f')][_0x882a('0x1b')]);_0x4e33de[_0x882a('0x19')]=qs['offset'](_0x5181a0['query']['offset']);}_0x4e33de[_0x882a('0x36')]=qs[_0x882a('0x37')](_0x5181a0[_0x882a('0x2f')][_0x882a('0x37')]);_0x4e33de[_0x882a('0x38')]=qs[_0x882a('0x31')](_[_0x882a('0x39')](_0x5181a0[_0x882a('0x2f')],_0x2d42f9['filters']),_0x59df96);if(_0x5181a0[_0x882a('0x2f')]['filter']){_0x4e33de[_0x882a('0x38')]=_[_0x882a('0x3a')](_0x4e33de[_0x882a('0x38')],{'$or':_[_0x882a('0x2d')](_0x59df96,function(_0x4260d5){if(_0x4260d5[_0x882a('0x2b')]!==_0x882a('0x3b')){var _0x3cf4c5={};_0x3cf4c5[_0x4260d5[_0x882a('0x2e')]]={'$like':'%'+_0x5181a0[_0x882a('0x2f')][_0x882a('0x3c')]+'%'};return _0x3cf4c5;}})});}_0x4e33de=_[_0x882a('0x3a')]({},_0x4e33de,_0x5181a0[_0x882a('0x3d')]);var _0x222813={'where':_0x4e33de[_0x882a('0x38')]};return db[_0x882a('0x28')]['count'](_0x222813)['then'](function(_0x15c1d8){_0x3d46c0['count']=_0x15c1d8;if(_0x5181a0[_0x882a('0x2f')][_0x882a('0x3e')]){_0x4e33de[_0x882a('0x3f')]=[{'all':!![]}];}return db[_0x882a('0x28')][_0x882a('0x40')](_0x4e33de);})['then'](function(_0x1e5550){_0x3d46c0[_0x882a('0x41')]=_0x1e5550;return _0x3d46c0;})['then'](respondWithFilteredResult(_0x2a8e42,_0x4e33de))[_0x882a('0x42')](handleError(_0x2a8e42,null));};exports[_0x882a('0x43')]=function(_0x3c03e0,_0x5bc6ec){var _0x3c44fb={'raw':![],'where':{'id':_0x3c03e0[_0x882a('0x44')]['id']}},_0x2bebe4={};_0x2bebe4[_0x882a('0x2c')]=_['keys'](db[_0x882a('0x28')]['rawAttributes']);_0x2bebe4[_0x882a('0x2f')]=_[_0x882a('0x30')](_0x3c03e0[_0x882a('0x2f')]);_0x2bebe4['filters']=_[_0x882a('0x45')](_0x2bebe4[_0x882a('0x2c')],_0x2bebe4[_0x882a('0x2f')]);_0x3c44fb['attributes']=_[_0x882a('0x45')](_0x2bebe4['model'],qs[_0x882a('0x33')](_0x3c03e0['query'][_0x882a('0x33')]));_0x3c44fb[_0x882a('0x32')]=_0x3c44fb[_0x882a('0x32')][_0x882a('0x46')]?_0x3c44fb[_0x882a('0x32')]:_0x2bebe4['model'];if(_0x3c03e0[_0x882a('0x2f')][_0x882a('0x3e')]){_0x3c44fb[_0x882a('0x3f')]=[{'all':!![]}];}_0x3c44fb=_['merge']({},_0x3c44fb,_0x3c03e0[_0x882a('0x3d')]);return db[_0x882a('0x28')][_0x882a('0x47')](_0x3c44fb)[_0x882a('0x23')](handleEntityNotFound(_0x5bc6ec,null))[_0x882a('0x23')](respondWithResult(_0x5bc6ec,null))['catch'](handleError(_0x5bc6ec,null));};exports[_0x882a('0x48')]=function(_0x5a256d,_0x496391){return db[_0x882a('0x28')]['create'](_0x5a256d[_0x882a('0x49')],{})[_0x882a('0x23')](respondWithResult(_0x496391,0xc9))['catch'](handleError(_0x496391,null));};exports['update']=function(_0x1eb8fe,_0x3d70ea){if(_0x1eb8fe[_0x882a('0x49')]['id']){delete _0x1eb8fe[_0x882a('0x49')]['id'];}return db[_0x882a('0x28')][_0x882a('0x47')]({'where':{'id':_0x1eb8fe[_0x882a('0x44')]['id']}})[_0x882a('0x23')](handleEntityNotFound(_0x3d70ea,null))['then'](saveUpdates(_0x1eb8fe[_0x882a('0x49')],null))[_0x882a('0x23')](respondWithResult(_0x3d70ea,null))[_0x882a('0x42')](handleError(_0x3d70ea,null));};exports[_0x882a('0x24')]=function(_0xf1283d,_0x392cc9){return db[_0x882a('0x28')][_0x882a('0x47')]({'where':{'id':_0xf1283d['params']['id']}})['then'](handleEntityNotFound(_0x392cc9,null))[_0x882a('0x23')](removeEntity(_0x392cc9,null))['catch'](handleError(_0x392cc9,null));};exports[_0x882a('0x4a')]=function(_0x48d297,_0x49fe56,_0x199a24){var _0x288c76={};var _0x42ee2b={};var _0x51d38d;var _0xad56ae;return db[_0x882a('0x28')][_0x882a('0x4b')]({'where':{'id':_0x48d297[_0x882a('0x44')]['id']}})[_0x882a('0x23')](handleEntityNotFound(_0x49fe56,null))['then'](function(_0x22e7d6){if(_0x22e7d6){_0x51d38d=_0x22e7d6;_0x42ee2b['model']=_[_0x882a('0x30')](db['SugarcrmField'][_0x882a('0x29')]);_0x42ee2b['query']=_['keys'](_0x48d297['query']);_0x42ee2b[_0x882a('0x31')]=_[_0x882a('0x45')](_0x42ee2b[_0x882a('0x2c')],_0x42ee2b[_0x882a('0x2f')]);_0x288c76[_0x882a('0x32')]=_[_0x882a('0x45')](_0x42ee2b[_0x882a('0x2c')],qs[_0x882a('0x33')](_0x48d297[_0x882a('0x2f')]['fields']));_0x288c76['attributes']=_0x288c76[_0x882a('0x32')][_0x882a('0x46')]?_0x288c76[_0x882a('0x32')]:_0x42ee2b[_0x882a('0x2c')];_0x288c76[_0x882a('0x36')]=qs[_0x882a('0x37')](_0x48d297[_0x882a('0x2f')]['sort']);_0x288c76[_0x882a('0x38')]=qs['filters'](_[_0x882a('0x39')](_0x48d297['query'],_0x42ee2b[_0x882a('0x31')]));if(_0x48d297[_0x882a('0x2f')]['filter']){_0x288c76[_0x882a('0x38')]=_[_0x882a('0x3a')](_0x288c76['where'],{'$or':_[_0x882a('0x2d')](_0x288c76[_0x882a('0x32')],function(_0x3555bb){var _0x57a27e={};_0x57a27e[_0x3555bb]={'$like':'%'+_0x48d297['query']['filter']+'%'};return _0x57a27e;})});}_0x288c76=_[_0x882a('0x3a')]({},_0x288c76,_0x48d297[_0x882a('0x3d')]);return _0x51d38d[_0x882a('0x4a')](_0x288c76);}})[_0x882a('0x23')](function(_0x537466){if(_0x537466){_0xad56ae=_0x537466[_0x882a('0x46')];if(!_0x48d297[_0x882a('0x2f')]['hasOwnProperty'](_0x882a('0x35'))){_0x288c76[_0x882a('0x1b')]=qs['limit'](_0x48d297['query']['limit']);_0x288c76[_0x882a('0x19')]=qs[_0x882a('0x19')](_0x48d297[_0x882a('0x2f')][_0x882a('0x19')]);}return _0x51d38d[_0x882a('0x4a')](_0x288c76);}})[_0x882a('0x23')](function(_0x5e2290){if(_0x5e2290){return _0x5e2290?{'count':_0xad56ae,'rows':_0x5e2290}:null;}})[_0x882a('0x23')](respondWithResult(_0x49fe56,null))[_0x882a('0x42')](handleError(_0x49fe56,null));};exports['getSubjects']=function(_0x2d9df8,_0x95e0fa,_0x2e5286){var _0x1e16b9={};var _0x3b5f9f={};var _0x34f5c;var _0x4c41d3;return db[_0x882a('0x28')][_0x882a('0x4b')]({'where':{'id':_0x2d9df8[_0x882a('0x44')]['id']}})[_0x882a('0x23')](handleEntityNotFound(_0x95e0fa,null))[_0x882a('0x23')](function(_0x352685){if(_0x352685){_0x34f5c=_0x352685;_0x3b5f9f[_0x882a('0x2c')]=_['keys'](db[_0x882a('0x4c')][_0x882a('0x29')]);_0x3b5f9f[_0x882a('0x2f')]=_[_0x882a('0x30')](_0x2d9df8[_0x882a('0x2f')]);_0x3b5f9f[_0x882a('0x31')]=_[_0x882a('0x45')](_0x3b5f9f[_0x882a('0x2c')],_0x3b5f9f[_0x882a('0x2f')]);_0x1e16b9[_0x882a('0x32')]=_[_0x882a('0x45')](_0x3b5f9f[_0x882a('0x2c')],qs[_0x882a('0x33')](_0x2d9df8[_0x882a('0x2f')][_0x882a('0x33')]));_0x1e16b9[_0x882a('0x32')]=_0x1e16b9[_0x882a('0x32')][_0x882a('0x46')]?_0x1e16b9[_0x882a('0x32')]:_0x3b5f9f['model'];_0x1e16b9[_0x882a('0x36')]=qs[_0x882a('0x37')](_0x2d9df8[_0x882a('0x2f')][_0x882a('0x37')]);_0x1e16b9[_0x882a('0x38')]=qs[_0x882a('0x31')](_[_0x882a('0x39')](_0x2d9df8[_0x882a('0x2f')],_0x3b5f9f['filters']));if(_0x2d9df8[_0x882a('0x2f')]['filter']){_0x1e16b9[_0x882a('0x38')]=_['merge'](_0x1e16b9[_0x882a('0x38')],{'$or':_['map'](_0x1e16b9['attributes'],function(_0x113d47){var _0x1d01b3={};_0x1d01b3[_0x113d47]={'$like':'%'+_0x2d9df8[_0x882a('0x2f')][_0x882a('0x3c')]+'%'};return _0x1d01b3;})});}_0x1e16b9=_[_0x882a('0x3a')]({},_0x1e16b9,_0x2d9df8[_0x882a('0x3d')]);return _0x34f5c[_0x882a('0x4d')](_0x1e16b9);}})[_0x882a('0x23')](function(_0x56ee1f){if(_0x56ee1f){_0x4c41d3=_0x56ee1f[_0x882a('0x46')];if(!_0x2d9df8[_0x882a('0x2f')][_0x882a('0x34')](_0x882a('0x35'))){_0x1e16b9[_0x882a('0x1b')]=qs[_0x882a('0x1b')](_0x2d9df8['query']['limit']);_0x1e16b9[_0x882a('0x19')]=qs[_0x882a('0x19')](_0x2d9df8[_0x882a('0x2f')][_0x882a('0x19')]);}return _0x34f5c[_0x882a('0x4d')](_0x1e16b9);}})[_0x882a('0x23')](function(_0x357ff8){if(_0x357ff8){return _0x357ff8?{'count':_0x4c41d3,'rows':_0x357ff8}:null;}})[_0x882a('0x23')](respondWithResult(_0x95e0fa,null))[_0x882a('0x42')](handleError(_0x95e0fa,null));};exports[_0x882a('0x4e')]=function(_0xe7e985,_0x2a9a25,_0x555ca8){var _0x1a46c2={};var _0x4ca5b1={};var _0x83888b;var _0x612218;return db[_0x882a('0x28')]['findOne']({'where':{'id':_0xe7e985[_0x882a('0x44')]['id']}})[_0x882a('0x23')](handleEntityNotFound(_0x2a9a25,null))[_0x882a('0x23')](function(_0x4610a7){if(_0x4610a7){_0x83888b=_0x4610a7;_0x4ca5b1['model']=_[_0x882a('0x30')](db[_0x882a('0x4c')][_0x882a('0x29')]);_0x4ca5b1[_0x882a('0x2f')]=_[_0x882a('0x30')](_0xe7e985[_0x882a('0x2f')]);_0x4ca5b1[_0x882a('0x31')]=_[_0x882a('0x45')](_0x4ca5b1[_0x882a('0x2c')],_0x4ca5b1[_0x882a('0x2f')]);_0x1a46c2[_0x882a('0x32')]=_[_0x882a('0x45')](_0x4ca5b1['model'],qs['fields'](_0xe7e985['query'][_0x882a('0x33')]));_0x1a46c2[_0x882a('0x32')]=_0x1a46c2[_0x882a('0x32')][_0x882a('0x46')]?_0x1a46c2[_0x882a('0x32')]:_0x4ca5b1[_0x882a('0x2c')];_0x1a46c2[_0x882a('0x36')]=qs[_0x882a('0x37')](_0xe7e985[_0x882a('0x2f')][_0x882a('0x37')]);_0x1a46c2[_0x882a('0x38')]=qs['filters'](_[_0x882a('0x39')](_0xe7e985[_0x882a('0x2f')],_0x4ca5b1[_0x882a('0x31')]));if(_0xe7e985[_0x882a('0x2f')][_0x882a('0x3c')]){_0x1a46c2[_0x882a('0x38')]=_[_0x882a('0x3a')](_0x1a46c2['where'],{'$or':_[_0x882a('0x2d')](_0x1a46c2[_0x882a('0x32')],function(_0x509cd8){var _0x2bf0d5={};_0x2bf0d5[_0x509cd8]={'$like':'%'+_0xe7e985[_0x882a('0x2f')]['filter']+'%'};return _0x2bf0d5;})});}_0x1a46c2=_[_0x882a('0x3a')]({},_0x1a46c2,_0xe7e985[_0x882a('0x3d')]);return _0x83888b[_0x882a('0x4e')](_0x1a46c2);}})[_0x882a('0x23')](function(_0x590998){if(_0x590998){_0x612218=_0x590998[_0x882a('0x46')];if(!_0xe7e985['query']['hasOwnProperty'](_0x882a('0x35'))){_0x1a46c2[_0x882a('0x1b')]=qs[_0x882a('0x1b')](_0xe7e985[_0x882a('0x2f')]['limit']);_0x1a46c2[_0x882a('0x19')]=qs[_0x882a('0x19')](_0xe7e985[_0x882a('0x2f')][_0x882a('0x19')]);}return _0x83888b[_0x882a('0x4e')](_0x1a46c2);}})[_0x882a('0x23')](function(_0x53a558){if(_0x53a558){return _0x53a558?{'count':_0x612218,'rows':_0x53a558}:null;}})[_0x882a('0x23')](respondWithResult(_0x2a9a25,null))[_0x882a('0x42')](handleError(_0x2a9a25,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 646bae2..c1a6941 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 _0x5094=['define','int_sugarcrm_configurations','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes'];(function(_0x384447,_0x41669a){var _0x3810db=function(_0x3f1288){while(--_0x3f1288){_0x384447['push'](_0x384447['shift']());}};_0x3810db(++_0x41669a);}(_0x5094,0x152));var _0x4509=function(_0xb1b08c,_0x1961a6){_0xb1b08c=_0xb1b08c-0x0;var _0x608518=_0x5094[_0xb1b08c];return _0x608518;};'use strict';var _=require('lodash');var util=require(_0x4509('0x0'));var logger=require(_0x4509('0x1'))(_0x4509('0x2'));var moment=require(_0x4509('0x3'));var BPromise=require(_0x4509('0x4'));var rp=require(_0x4509('0x5'));var fs=require('fs');var path=require(_0x4509('0x6'));var rimraf=require(_0x4509('0x7'));var config=require(_0x4509('0x8'));var attributes=require(_0x4509('0x9'));module['exports']=function(_0x517e31,_0x3ef798){return _0x517e31[_0x4509('0xa')]('SugarcrmConfiguration',attributes,{'tableName':_0x4509('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5110=['moment','bluebird','request-promise','path','exports','define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util','api'];(function(_0x26e3c7,_0x3b3677){var _0xdd1004=function(_0x405d3c){while(--_0x405d3c){_0x26e3c7['push'](_0x26e3c7['shift']());}};_0xdd1004(++_0x3b3677);}(_0x5110,0x152));var _0x0511=function(_0x4e1045,_0xc8c1fb){_0x4e1045=_0x4e1045-0x0;var _0x2fa4e5=_0x5110[_0x4e1045];return _0x2fa4e5;};'use strict';var _=require(_0x0511('0x0'));var util=require(_0x0511('0x1'));var logger=require('../../config/logger')(_0x0511('0x2'));var moment=require(_0x0511('0x3'));var BPromise=require(_0x0511('0x4'));var rp=require(_0x0511('0x5'));var fs=require('fs');var path=require(_0x0511('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intSugarcrmConfiguration.attributes');module[_0x0511('0x7')]=function(_0x2e5bee,_0x54b246){return _0x2e5bee[_0x0511('0x8')](_0x0511('0x9'),attributes,{'tableName':_0x0511('0xa'),'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 6b653a8..a0213cf 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 _0x230f=['ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','moment','bluebird'];(function(_0x4d3ee3,_0x425fb3){var _0x12606e=function(_0x541b8c){while(--_0x541b8c){_0x4d3ee3['push'](_0x4d3ee3['shift']());}};_0x12606e(++_0x425fb3);}(_0x230f,0x147));var _0xf230=function(_0x2db12b,_0x30ab1d){_0x2db12b=_0x2db12b-0x0;var _0x20990b=_0x230f[_0x2db12b];return _0x20990b;};'use strict';var _=require(_0xf230('0x0'));var util=require('util');var moment=require(_0xf230('0x1'));var BPromise=require(_0xf230('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf230('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xf230('0x4'));var logger=require(_0xf230('0x5'))(_0xf230('0x6'));var config=require('../../config/environment');var jayson=require(_0xf230('0x7'));var client=jayson[_0xf230('0x8')][_0xf230('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5e54b2,_0x439d29,_0xb0648f){return new BPromise(function(_0x1481cf,_0x56e9cf){return client[_0xf230('0xa')](_0x5e54b2,_0xb0648f)[_0xf230('0xb')](function(_0x34bf81){logger['info'](_0xf230('0xc'),_0x439d29,_0xf230('0xd'));logger[_0xf230('0xe')](_0xf230('0xf'),_0x439d29,_0xf230('0xd'),JSON['stringify'](_0x34bf81));if(_0x34bf81['error']){if(_0x34bf81[_0xf230('0x10')][_0xf230('0x11')]===0x1f4){logger[_0xf230('0x10')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x439d29,_0x34bf81[_0xf230('0x10')][_0xf230('0x12')]);return _0x56e9cf(_0x34bf81[_0xf230('0x10')][_0xf230('0x12')]);}logger[_0xf230('0x10')](_0xf230('0xc'),_0x439d29,_0x34bf81['error'][_0xf230('0x12')]);return _0x1481cf(_0x34bf81[_0xf230('0x10')]['message']);}else{logger[_0xf230('0x13')](_0xf230('0xc'),_0x439d29,_0xf230('0xd'));_0x1481cf(_0x34bf81[_0xf230('0x14')][_0xf230('0x12')]);}})[_0xf230('0x15')](function(_0x92b364){logger[_0xf230('0x10')](_0xf230('0xc'),_0x439d29,_0x92b364);_0x56e9cf(_0x92b364);});});} \ No newline at end of file +var _0xb19e=['util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','request\x20sent','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SugarcrmConfiguration,\x20%s,\x20%s','info','result','catch','lodash'];(function(_0x13489f,_0x299c9f){var _0x3286b3=function(_0x3c66fc){while(--_0x3c66fc){_0x13489f['push'](_0x13489f['shift']());}};_0x3286b3(++_0x299c9f);}(_0xb19e,0x113));var _0xeb19=function(_0x510c60,_0x50247e){_0x510c60=_0x510c60-0x0;var _0x49c4aa=_0xb19e[_0x510c60];return _0x49c4aa;};'use strict';var _=require(_0xeb19('0x0'));var util=require(_0xeb19('0x1'));var moment=require(_0xeb19('0x2'));var BPromise=require('bluebird');var rs=require(_0xeb19('0x3'));var fs=require('fs');var Redis=require(_0xeb19('0x4'));var db=require(_0xeb19('0x5'))['db'];var utils=require(_0xeb19('0x6'));var logger=require(_0xeb19('0x7'))(_0xeb19('0x8'));var config=require('../../config/environment');var jayson=require(_0xeb19('0x9'));var client=jayson['client'][_0xeb19('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x48da5e,_0x369a8b,_0x1ca7d3){return new BPromise(function(_0x10d514,_0x13e695){return client[_0xeb19('0xb')](_0x48da5e,_0x1ca7d3)[_0xeb19('0xc')](function(_0x6261c4){logger['info']('SugarcrmConfiguration,\x20%s,\x20%s',_0x369a8b,_0xeb19('0xd'));logger['debug'](_0xeb19('0xe'),_0x369a8b,_0xeb19('0xd'),JSON[_0xeb19('0xf')](_0x6261c4));if(_0x6261c4[_0xeb19('0x10')]){if(_0x6261c4[_0xeb19('0x10')][_0xeb19('0x11')]===0x1f4){logger[_0xeb19('0x10')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x369a8b,_0x6261c4[_0xeb19('0x10')][_0xeb19('0x12')]);return _0x13e695(_0x6261c4['error']['message']);}logger['error'](_0xeb19('0x13'),_0x369a8b,_0x6261c4[_0xeb19('0x10')][_0xeb19('0x12')]);return _0x10d514(_0x6261c4[_0xeb19('0x10')][_0xeb19('0x12')]);}else{logger[_0xeb19('0x14')](_0xeb19('0x13'),_0x369a8b,_0xeb19('0xd'));_0x10d514(_0x6261c4[_0xeb19('0x15')][_0xeb19('0x12')]);}})[_0xeb19('0x16')](function(_0x4f6c3a){logger[_0xeb19('0x10')](_0xeb19('0x13'),_0x369a8b,_0x4f6c3a);_0x13e695(_0x4f6c3a);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index c52aeec..e4cf21a 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 _0x8bfd=['create','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./intSugarcrmField.controller','get','index','/:id','isAuthenticated','show','post'];(function(_0x37445c,_0x413b45){var _0x37b861=function(_0x237657){while(--_0x237657){_0x37445c['push'](_0x37445c['shift']());}};_0x37b861(++_0x413b45);}(_0x8bfd,0xbe));var _0xd8bf=function(_0x351b46,_0x26b265){_0x351b46=_0x351b46-0x0;var _0x1515df=_0x8bfd[_0x351b46];return _0x1515df;};'use strict';var multer=require(_0xd8bf('0x0'));var util=require('util');var path=require(_0xd8bf('0x1'));var timeout=require(_0xd8bf('0x2'));var express=require(_0xd8bf('0x3'));var router=express[_0xd8bf('0x4')]();var fs_extra=require(_0xd8bf('0x5'));var auth=require(_0xd8bf('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xd8bf('0x7'));router[_0xd8bf('0x8')]('/',auth['isAuthenticated'](),controller[_0xd8bf('0x9')]);router[_0xd8bf('0x8')](_0xd8bf('0xa'),auth[_0xd8bf('0xb')](),controller[_0xd8bf('0xc')]);router[_0xd8bf('0xd')]('/',auth[_0xd8bf('0xb')](),controller[_0xd8bf('0xe')]);router['put'](_0xd8bf('0xa'),auth[_0xd8bf('0xb')](),controller['update']);router['delete'](_0xd8bf('0xa'),auth['isAuthenticated'](),controller[_0xd8bf('0xf')]);module[_0xd8bf('0x10')]=router; \ No newline at end of file +var _0xe799=['delete','destroy','exports','path','express','../../components/auth/service','../../components/interaction/service','./intSugarcrmField.controller','get','index','/:id','post','isAuthenticated','create','update'];(function(_0x1c4f4a,_0x1b254c){var _0x1e6a1b=function(_0x169c0b){while(--_0x169c0b){_0x1c4f4a['push'](_0x1c4f4a['shift']());}};_0x1e6a1b(++_0x1b254c);}(_0xe799,0x1d4));var _0x9e79=function(_0x386e1e,_0x245ed2){_0x386e1e=_0x386e1e-0x0;var _0x22e2a0=_0xe799[_0x386e1e];return _0x22e2a0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9e79('0x0'));var timeout=require('connect-timeout');var express=require(_0x9e79('0x1'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x9e79('0x2'));var interaction=require(_0x9e79('0x3'));var config=require('../../config/environment');var controller=require(_0x9e79('0x4'));router[_0x9e79('0x5')]('/',auth['isAuthenticated'](),controller[_0x9e79('0x6')]);router[_0x9e79('0x5')](_0x9e79('0x7'),auth['isAuthenticated'](),controller['show']);router[_0x9e79('0x8')]('/',auth[_0x9e79('0x9')](),controller[_0x9e79('0xa')]);router['put'](_0x9e79('0x7'),auth[_0x9e79('0x9')](),controller[_0x9e79('0xb')]);router[_0x9e79('0xc')](_0x9e79('0x7'),auth['isAuthenticated'](),controller[_0x9e79('0xd')]);module[_0x9e79('0xe')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index d8d5e7a..aa5c45a 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 _0xef2d=['variable','keyValue','STRING','customVariable','sequelize','exports','ENUM','string'];(function(_0x4fcb4a,_0x33cd8e){var _0x4ff769=function(_0x384338){while(--_0x384338){_0x4fcb4a['push'](_0x4fcb4a['shift']());}};_0x4ff769(++_0x33cd8e);}(_0xef2d,0xb4));var _0xdef2=function(_0xacec5,_0xc6e455){_0xacec5=_0xacec5-0x0;var _0x28fbb6=_0xef2d[_0xacec5];return _0x28fbb6;};'use strict';var Sequelize=require(_0xdef2('0x0'));module[_0xdef2('0x1')]={'type':{'type':Sequelize[_0xdef2('0x2')](_0xdef2('0x3'),_0xdef2('0x4'),'customVariable',_0xdef2('0x5'),'picklist'),'defaultValue':_0xdef2('0x3')},'content':{'type':Sequelize[_0xdef2('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xdef2('0x2')](_0xdef2('0x3'),_0xdef2('0x4'),_0xdef2('0x7'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xdef2('0x6')]},'nameField':{'type':Sequelize[_0xdef2('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xdef2('0x6')]}}; \ No newline at end of file +var _0x4f55=['STRING','BOOLEAN','variable','customVariable','keyValue','picklist','string'];(function(_0x25a42a,_0x3d489b){var _0x1129b1=function(_0x4ae61b){while(--_0x4ae61b){_0x25a42a['push'](_0x25a42a['shift']());}};_0x1129b1(++_0x3d489b);}(_0x4f55,0xdb));var _0x54f5=function(_0x5105f2,_0x5f331e){_0x5105f2=_0x5105f2-0x0;var _0x151a91=_0x4f55[_0x5105f2];return _0x151a91;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize['ENUM']('string',_0x54f5('0x0'),_0x54f5('0x1'),_0x54f5('0x2'),_0x54f5('0x3')),'defaultValue':_0x54f5('0x4')},'content':{'type':Sequelize[_0x54f5('0x5')]},'key':{'type':Sequelize[_0x54f5('0x5')]},'keyType':{'type':Sequelize['ENUM']('string',_0x54f5('0x0'),_0x54f5('0x1'))},'keyContent':{'type':Sequelize[_0x54f5('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x54f5('0x5')]},'customField':{'type':Sequelize[_0x54f5('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x54f5('0x5')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index c008283..0e001c7 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 _0x5256=['then','destroy','error','stack','name','send','index','map','SugarcrmField','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','where','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save'];(function(_0x31c026,_0x53f703){var _0x1a15b=function(_0xe1c32){while(--_0xe1c32){_0x31c026['push'](_0x31c026['shift']());}};_0x1a15b(++_0x53f703);}(_0x5256,0x1d5));var _0x6525=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0x5256[_0x6cf19c];return _0xce14f3;};'use strict';var emlformat=require(_0x6525('0x0'));var rimraf=require(_0x6525('0x1'));var zipdir=require(_0x6525('0x2'));var jsonpatch=require(_0x6525('0x3'));var rp=require(_0x6525('0x4'));var moment=require('moment');var BPromise=require(_0x6525('0x5'));var Mustache=require(_0x6525('0x6'));var util=require(_0x6525('0x7'));var path=require(_0x6525('0x8'));var sox=require(_0x6525('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6525('0xa'));var squel=require(_0x6525('0xb'));var crypto=require(_0x6525('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x6525('0xd'));var toCsv=require(_0x6525('0xe'));var querystring=require(_0x6525('0xf'));var Papa=require(_0x6525('0x10'));var Redis=require(_0x6525('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x6525('0x12'));var as=require(_0x6525('0x13'));var hardwareService=require(_0x6525('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x6525('0x15'));var config=require(_0x6525('0x16'));var licenseUtil=require(_0x6525('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x35b15c,_0x2255af){_0x2255af=_0x2255af||0xcc;return function(_0x552d06){if(_0x552d06){return _0x35b15c['sendStatus'](_0x2255af);}return _0x35b15c[_0x6525('0x18')](_0x2255af)[_0x6525('0x19')]();};}function respondWithResult(_0xee166,_0x21797f){_0x21797f=_0x21797f||0xc8;return function(_0x531d24){if(_0x531d24){return _0xee166[_0x6525('0x18')](_0x21797f)[_0x6525('0x1a')](_0x531d24);}};}function respondWithFilteredResult(_0x37d887,_0x25fd83){return function(_0x487452){if(_0x487452){var _0x2e54fb=typeof _0x25fd83[_0x6525('0x1b')]===_0x6525('0x1c')&&typeof _0x25fd83['limit']===_0x6525('0x1c');var _0x278804=_0x487452[_0x6525('0x1d')];var _0x6a6475=_0x2e54fb?0x0:_0x25fd83[_0x6525('0x1b')];var _0x5b7528=_0x2e54fb?_0x487452[_0x6525('0x1d')]:_0x25fd83['offset']+_0x25fd83[_0x6525('0x1e')];var _0x1636b1;if(_0x5b7528>=_0x278804){_0x5b7528=_0x278804;_0x1636b1=0xc8;}else{_0x1636b1=0xce;}_0x37d887[_0x6525('0x18')](_0x1636b1);return _0x37d887[_0x6525('0x1f')](_0x6525('0x20'),_0x6a6475+'-'+_0x5b7528+'/'+_0x278804)[_0x6525('0x1a')](_0x487452);}return null;};}function patchUpdates(_0x3cabec){return function(_0x381a3e){try{jsonpatch[_0x6525('0x21')](_0x381a3e,_0x3cabec,!![]);}catch(_0x200cbc){return BPromise['reject'](_0x200cbc);}return _0x381a3e[_0x6525('0x22')]();};}function saveUpdates(_0x3d89f2,_0x2901a6){return function(_0x428deb){if(_0x428deb){return _0x428deb['update'](_0x3d89f2)[_0x6525('0x23')](function(_0x230a77){return _0x230a77;});}return null;};}function removeEntity(_0x17688b,_0xec202a){return function(_0x2cd7a5){if(_0x2cd7a5){return _0x2cd7a5[_0x6525('0x24')]()[_0x6525('0x23')](function(){_0x17688b[_0x6525('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b32a6,_0x3a31b3){return function(_0x14cd8c){if(!_0x14cd8c){_0x2b32a6['sendStatus'](0x194);}return _0x14cd8c;};}function handleError(_0x1ff1e9,_0x32159a){_0x32159a=_0x32159a||0x1f4;return function(_0x30427a){logger[_0x6525('0x25')](_0x30427a[_0x6525('0x26')]);if(_0x30427a[_0x6525('0x27')]){delete _0x30427a['name'];}_0x1ff1e9[_0x6525('0x18')](_0x32159a)[_0x6525('0x28')](_0x30427a);};}exports[_0x6525('0x29')]=function(_0x46773c,_0x5518ae){var _0x5a23f5={},_0x24cdc7={},_0x14fb9b={'count':0x0,'rows':[]};var _0x3466cb=_[_0x6525('0x2a')](db[_0x6525('0x2b')][_0x6525('0x2c')],function(_0x2c10a1){return{'name':_0x2c10a1['fieldName'],'type':_0x2c10a1[_0x6525('0x2d')][_0x6525('0x2e')]};});_0x24cdc7[_0x6525('0x2f')]=_['map'](_0x3466cb,_0x6525('0x27'));_0x24cdc7[_0x6525('0x30')]=_[_0x6525('0x31')](_0x46773c[_0x6525('0x30')]);_0x24cdc7[_0x6525('0x32')]=_[_0x6525('0x33')](_0x24cdc7[_0x6525('0x2f')],_0x24cdc7[_0x6525('0x30')]);_0x5a23f5[_0x6525('0x34')]=_['intersection'](_0x24cdc7[_0x6525('0x2f')],qs[_0x6525('0x35')](_0x46773c[_0x6525('0x30')][_0x6525('0x35')]));_0x5a23f5['attributes']=_0x5a23f5[_0x6525('0x34')][_0x6525('0x36')]?_0x5a23f5[_0x6525('0x34')]:_0x24cdc7['model'];if(!_0x46773c[_0x6525('0x30')][_0x6525('0x37')]('nolimit')){_0x5a23f5[_0x6525('0x1e')]=qs[_0x6525('0x1e')](_0x46773c[_0x6525('0x30')][_0x6525('0x1e')]);_0x5a23f5[_0x6525('0x1b')]=qs['offset'](_0x46773c[_0x6525('0x30')][_0x6525('0x1b')]);}_0x5a23f5[_0x6525('0x38')]=qs['sort'](_0x46773c[_0x6525('0x30')]['sort']);_0x5a23f5[_0x6525('0x39')]=qs['filters'](_['pick'](_0x46773c[_0x6525('0x30')],_0x24cdc7[_0x6525('0x32')]),_0x3466cb);if(_0x46773c[_0x6525('0x30')][_0x6525('0x3a')]){_0x5a23f5['where']=_[_0x6525('0x3b')](_0x5a23f5['where'],{'$or':_[_0x6525('0x2a')](_0x3466cb,function(_0x437603){if(_0x437603[_0x6525('0x2d')]!==_0x6525('0x3c')){var _0xed32bc={};_0xed32bc[_0x437603[_0x6525('0x27')]]={'$like':'%'+_0x46773c['query'][_0x6525('0x3a')]+'%'};return _0xed32bc;}})});}_0x5a23f5=_[_0x6525('0x3b')]({},_0x5a23f5,_0x46773c[_0x6525('0x3d')]);var _0x5f4968={'where':_0x5a23f5[_0x6525('0x39')]};return db[_0x6525('0x2b')]['count'](_0x5f4968)[_0x6525('0x23')](function(_0x4f1b47){_0x14fb9b[_0x6525('0x1d')]=_0x4f1b47;if(_0x46773c[_0x6525('0x30')][_0x6525('0x3e')]){_0x5a23f5[_0x6525('0x3f')]=[{'all':!![]}];}return db['SugarcrmField']['findAll'](_0x5a23f5);})[_0x6525('0x23')](function(_0x25a461){_0x14fb9b[_0x6525('0x40')]=_0x25a461;return _0x14fb9b;})[_0x6525('0x23')](respondWithFilteredResult(_0x5518ae,_0x5a23f5))[_0x6525('0x41')](handleError(_0x5518ae,null));};exports[_0x6525('0x42')]=function(_0x1a40fd,_0x13ae0e){var _0x55d802={'raw':!![],'where':{'id':_0x1a40fd[_0x6525('0x43')]['id']}},_0x533f97={};_0x533f97[_0x6525('0x2f')]=_[_0x6525('0x31')](db[_0x6525('0x2b')][_0x6525('0x2c')]);_0x533f97[_0x6525('0x30')]=_[_0x6525('0x31')](_0x1a40fd[_0x6525('0x30')]);_0x533f97[_0x6525('0x32')]=_['intersection'](_0x533f97[_0x6525('0x2f')],_0x533f97[_0x6525('0x30')]);_0x55d802[_0x6525('0x34')]=_[_0x6525('0x33')](_0x533f97[_0x6525('0x2f')],qs['fields'](_0x1a40fd[_0x6525('0x30')][_0x6525('0x35')]));_0x55d802[_0x6525('0x34')]=_0x55d802[_0x6525('0x34')][_0x6525('0x36')]?_0x55d802['attributes']:_0x533f97[_0x6525('0x2f')];if(_0x1a40fd['query']['includeAll']){_0x55d802[_0x6525('0x3f')]=[{'all':!![]}];}_0x55d802=_[_0x6525('0x3b')]({},_0x55d802,_0x1a40fd[_0x6525('0x3d')]);return db[_0x6525('0x2b')][_0x6525('0x44')](_0x55d802)[_0x6525('0x23')](handleEntityNotFound(_0x13ae0e,null))[_0x6525('0x23')](respondWithResult(_0x13ae0e,null))['catch'](handleError(_0x13ae0e,null));};exports[_0x6525('0x45')]=function(_0x3ea381,_0x3b71bb){return db[_0x6525('0x2b')]['create'](_0x3ea381[_0x6525('0x46')],{})[_0x6525('0x23')](respondWithResult(_0x3b71bb,0xc9))[_0x6525('0x41')](handleError(_0x3b71bb,null));};exports[_0x6525('0x47')]=function(_0x19b99e,_0xda9d94){if(_0x19b99e['body']['id']){delete _0x19b99e[_0x6525('0x46')]['id'];}return db[_0x6525('0x2b')][_0x6525('0x44')]({'where':{'id':_0x19b99e[_0x6525('0x43')]['id']}})['then'](handleEntityNotFound(_0xda9d94,null))['then'](saveUpdates(_0x19b99e[_0x6525('0x46')],null))[_0x6525('0x23')](respondWithResult(_0xda9d94,null))['catch'](handleError(_0xda9d94,null));};exports[_0x6525('0x24')]=function(_0x385ed3,_0x203366){return db['SugarcrmField']['find']({'where':{'id':_0x385ed3[_0x6525('0x43')]['id']}})[_0x6525('0x23')](handleEntityNotFound(_0x203366,null))[_0x6525('0x23')](removeEntity(_0x203366,null))[_0x6525('0x41')](handleError(_0x203366,null));}; \ No newline at end of file +var _0xd740=['where','type','VIRTUAL','options','includeAll','include','rows','catch','show','keys','SugarcrmField','fields','find','create','body','params','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','json','offset','limit','undefined','count','status','set','Content-Range','apply','reject','save','update','then','stack','send','index','map','model','name','intersection','attributes','query','length','sort','filters','filter','merge'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xd740,0x94));var _0x0d74=function(_0x111311,_0x1e2f69){_0x111311=_0x111311-0x0;var _0x4cef39=_0xd740[_0x111311];return _0x4cef39;};'use strict';var emlformat=require(_0x0d74('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0d74('0x1'));var jsonpatch=require(_0x0d74('0x2'));var rp=require(_0x0d74('0x3'));var moment=require('moment');var BPromise=require(_0x0d74('0x4'));var Mustache=require(_0x0d74('0x5'));var util=require('util');var path=require(_0x0d74('0x6'));var sox=require('sox');var csv=require(_0x0d74('0x7'));var ejs=require(_0x0d74('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0d74('0x9'));var squel=require(_0x0d74('0xa'));var crypto=require(_0x0d74('0xb'));var jsforce=require(_0x0d74('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x0d74('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x0d74('0xd'));var authService=require(_0x0d74('0xe'));var qs=require(_0x0d74('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0d74('0x10'));var logger=require('../../config/logger')(_0x0d74('0x11'));var utils=require(_0x0d74('0x12'));var config=require(_0x0d74('0x13'));var licenseUtil=require(_0x0d74('0x14'));var db=require(_0x0d74('0x15'))['db'];function respondWithStatusCode(_0x3a2306,_0x286d9f){_0x286d9f=_0x286d9f||0xcc;return function(_0x56698e){if(_0x56698e){return _0x3a2306['sendStatus'](_0x286d9f);}return _0x3a2306['status'](_0x286d9f)[_0x0d74('0x16')]();};}function respondWithResult(_0x16dcb1,_0x10d745){_0x10d745=_0x10d745||0xc8;return function(_0x29f10e){if(_0x29f10e){return _0x16dcb1['status'](_0x10d745)[_0x0d74('0x17')](_0x29f10e);}};}function respondWithFilteredResult(_0x1e7f29,_0x5d586f){return function(_0x235088){if(_0x235088){var _0x269253=typeof _0x5d586f[_0x0d74('0x18')]==='undefined'&&typeof _0x5d586f[_0x0d74('0x19')]===_0x0d74('0x1a');var _0x2bcf96=_0x235088[_0x0d74('0x1b')];var _0x5c66e8=_0x269253?0x0:_0x5d586f[_0x0d74('0x18')];var _0x2756b0=_0x269253?_0x235088[_0x0d74('0x1b')]:_0x5d586f['offset']+_0x5d586f[_0x0d74('0x19')];var _0x584f85;if(_0x2756b0>=_0x2bcf96){_0x2756b0=_0x2bcf96;_0x584f85=0xc8;}else{_0x584f85=0xce;}_0x1e7f29[_0x0d74('0x1c')](_0x584f85);return _0x1e7f29[_0x0d74('0x1d')](_0x0d74('0x1e'),_0x5c66e8+'-'+_0x2756b0+'/'+_0x2bcf96)['json'](_0x235088);}return null;};}function patchUpdates(_0x61d7a9){return function(_0x370876){try{jsonpatch[_0x0d74('0x1f')](_0x370876,_0x61d7a9,!![]);}catch(_0x14849f){return BPromise[_0x0d74('0x20')](_0x14849f);}return _0x370876[_0x0d74('0x21')]();};}function saveUpdates(_0x327936,_0x5eeeab){return function(_0x22b503){if(_0x22b503){return _0x22b503[_0x0d74('0x22')](_0x327936)[_0x0d74('0x23')](function(_0x430220){return _0x430220;});}return null;};}function removeEntity(_0x59fec7,_0xaf8b4e){return function(_0x342474){if(_0x342474){return _0x342474['destroy']()[_0x0d74('0x23')](function(){_0x59fec7['status'](0xcc)[_0x0d74('0x16')]();});}};}function handleEntityNotFound(_0x37426d,_0x3a3817){return function(_0x2ff76a){if(!_0x2ff76a){_0x37426d['sendStatus'](0x194);}return _0x2ff76a;};}function handleError(_0x262df1,_0x3fc56a){_0x3fc56a=_0x3fc56a||0x1f4;return function(_0x71599c){logger['error'](_0x71599c[_0x0d74('0x24')]);if(_0x71599c['name']){delete _0x71599c['name'];}_0x262df1[_0x0d74('0x1c')](_0x3fc56a)[_0x0d74('0x25')](_0x71599c);};}exports[_0x0d74('0x26')]=function(_0x4640ec,_0x296fe9){var _0x2f4764={},_0x21e992={},_0x553ee8={'count':0x0,'rows':[]};var _0x50a93e=_[_0x0d74('0x27')](db['SugarcrmField']['rawAttributes'],function(_0xe2b146){return{'name':_0xe2b146['fieldName'],'type':_0xe2b146['type']['key']};});_0x21e992[_0x0d74('0x28')]=_['map'](_0x50a93e,_0x0d74('0x29'));_0x21e992['query']=_['keys'](_0x4640ec['query']);_0x21e992['filters']=_[_0x0d74('0x2a')](_0x21e992[_0x0d74('0x28')],_0x21e992['query']);_0x2f4764[_0x0d74('0x2b')]=_[_0x0d74('0x2a')](_0x21e992[_0x0d74('0x28')],qs['fields'](_0x4640ec[_0x0d74('0x2c')]['fields']));_0x2f4764[_0x0d74('0x2b')]=_0x2f4764[_0x0d74('0x2b')][_0x0d74('0x2d')]?_0x2f4764[_0x0d74('0x2b')]:_0x21e992['model'];if(!_0x4640ec[_0x0d74('0x2c')]['hasOwnProperty']('nolimit')){_0x2f4764[_0x0d74('0x19')]=qs['limit'](_0x4640ec[_0x0d74('0x2c')][_0x0d74('0x19')]);_0x2f4764[_0x0d74('0x18')]=qs[_0x0d74('0x18')](_0x4640ec[_0x0d74('0x2c')][_0x0d74('0x18')]);}_0x2f4764['order']=qs[_0x0d74('0x2e')](_0x4640ec[_0x0d74('0x2c')][_0x0d74('0x2e')]);_0x2f4764['where']=qs['filters'](_['pick'](_0x4640ec[_0x0d74('0x2c')],_0x21e992[_0x0d74('0x2f')]),_0x50a93e);if(_0x4640ec[_0x0d74('0x2c')][_0x0d74('0x30')]){_0x2f4764['where']=_[_0x0d74('0x31')](_0x2f4764[_0x0d74('0x32')],{'$or':_[_0x0d74('0x27')](_0x50a93e,function(_0x5a82eb){if(_0x5a82eb[_0x0d74('0x33')]!==_0x0d74('0x34')){var _0x1cb0c9={};_0x1cb0c9[_0x5a82eb[_0x0d74('0x29')]]={'$like':'%'+_0x4640ec['query'][_0x0d74('0x30')]+'%'};return _0x1cb0c9;}})});}_0x2f4764=_['merge']({},_0x2f4764,_0x4640ec[_0x0d74('0x35')]);var _0x1cb8af={'where':_0x2f4764[_0x0d74('0x32')]};return db['SugarcrmField']['count'](_0x1cb8af)['then'](function(_0x2df003){_0x553ee8[_0x0d74('0x1b')]=_0x2df003;if(_0x4640ec[_0x0d74('0x2c')][_0x0d74('0x36')]){_0x2f4764[_0x0d74('0x37')]=[{'all':!![]}];}return db['SugarcrmField']['findAll'](_0x2f4764);})[_0x0d74('0x23')](function(_0x1164dd){_0x553ee8[_0x0d74('0x38')]=_0x1164dd;return _0x553ee8;})['then'](respondWithFilteredResult(_0x296fe9,_0x2f4764))[_0x0d74('0x39')](handleError(_0x296fe9,null));};exports[_0x0d74('0x3a')]=function(_0x389357,_0x19a598){var _0x383acd={'raw':!![],'where':{'id':_0x389357['params']['id']}},_0x594d59={};_0x594d59[_0x0d74('0x28')]=_[_0x0d74('0x3b')](db[_0x0d74('0x3c')]['rawAttributes']);_0x594d59[_0x0d74('0x2c')]=_['keys'](_0x389357[_0x0d74('0x2c')]);_0x594d59[_0x0d74('0x2f')]=_[_0x0d74('0x2a')](_0x594d59[_0x0d74('0x28')],_0x594d59[_0x0d74('0x2c')]);_0x383acd[_0x0d74('0x2b')]=_[_0x0d74('0x2a')](_0x594d59['model'],qs[_0x0d74('0x3d')](_0x389357[_0x0d74('0x2c')]['fields']));_0x383acd[_0x0d74('0x2b')]=_0x383acd['attributes'][_0x0d74('0x2d')]?_0x383acd[_0x0d74('0x2b')]:_0x594d59['model'];if(_0x389357[_0x0d74('0x2c')][_0x0d74('0x36')]){_0x383acd[_0x0d74('0x37')]=[{'all':!![]}];}_0x383acd=_[_0x0d74('0x31')]({},_0x383acd,_0x389357['options']);return db[_0x0d74('0x3c')][_0x0d74('0x3e')](_0x383acd)[_0x0d74('0x23')](handleEntityNotFound(_0x19a598,null))[_0x0d74('0x23')](respondWithResult(_0x19a598,null))[_0x0d74('0x39')](handleError(_0x19a598,null));};exports[_0x0d74('0x3f')]=function(_0x383ed6,_0x508d68){return db[_0x0d74('0x3c')][_0x0d74('0x3f')](_0x383ed6['body'],{})[_0x0d74('0x23')](respondWithResult(_0x508d68,0xc9))['catch'](handleError(_0x508d68,null));};exports['update']=function(_0x18d66e,_0x39260d){if(_0x18d66e[_0x0d74('0x40')]['id']){delete _0x18d66e[_0x0d74('0x40')]['id'];}return db[_0x0d74('0x3c')]['find']({'where':{'id':_0x18d66e[_0x0d74('0x41')]['id']}})[_0x0d74('0x23')](handleEntityNotFound(_0x39260d,null))['then'](saveUpdates(_0x18d66e[_0x0d74('0x40')],null))[_0x0d74('0x23')](respondWithResult(_0x39260d,null))[_0x0d74('0x39')](handleError(_0x39260d,null));};exports['destroy']=function(_0x3b70b9,_0x164881){return db[_0x0d74('0x3c')][_0x0d74('0x3e')]({'where':{'id':_0x3b70b9['params']['id']}})['then'](handleEntityNotFound(_0x164881,null))[_0x0d74('0x23')](removeEntity(_0x164881,null))[_0x0d74('0x39')](handleError(_0x164881,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 67de3ad..40b7ed4 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 _0xdeb5=['sugarcrm_unique_index','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intSugarcrmField.attributes','define','SugarcrmField','int_sugarcrm_fields'];(function(_0x7a0dc4,_0x3ad603){var _0x205820=function(_0x540c07){while(--_0x540c07){_0x7a0dc4['push'](_0x7a0dc4['shift']());}};_0x205820(++_0x3ad603);}(_0xdeb5,0x188));var _0x5deb=function(_0x590275,_0x5b9a6a){_0x590275=_0x590275-0x0;var _0x102a13=_0xdeb5[_0x590275];return _0x102a13;};'use strict';var _=require(_0x5deb('0x0'));var util=require(_0x5deb('0x1'));var logger=require(_0x5deb('0x2'))(_0x5deb('0x3'));var moment=require(_0x5deb('0x4'));var BPromise=require(_0x5deb('0x5'));var rp=require(_0x5deb('0x6'));var fs=require('fs');var path=require(_0x5deb('0x7'));var rimraf=require('rimraf');var config=require(_0x5deb('0x8'));var attributes=require(_0x5deb('0x9'));module['exports']=function(_0x28baf7,_0x1cdb07){return _0x28baf7[_0x5deb('0xa')](_0x5deb('0xb'),attributes,{'tableName':_0x5deb('0xc'),'paranoid':![],'indexes':[{'name':_0x5deb('0xd'),'fields':['idField',_0x5deb('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb0b5=['./intSugarcrmField.attributes','exports','SugarcrmField','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x120ab8,_0x577eb9){var _0x597e51=function(_0x165bf4){while(--_0x165bf4){_0x120ab8['push'](_0x120ab8['shift']());}};_0x597e51(++_0x577eb9);}(_0xb0b5,0x12b));var _0x5b0b=function(_0x27657c,_0x36813e){_0x27657c=_0x27657c-0x0;var _0x12324a=_0xb0b5[_0x27657c];return _0x12324a;};'use strict';var _=require(_0x5b0b('0x0'));var util=require(_0x5b0b('0x1'));var logger=require(_0x5b0b('0x2'))(_0x5b0b('0x3'));var moment=require(_0x5b0b('0x4'));var BPromise=require(_0x5b0b('0x5'));var rp=require(_0x5b0b('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5b0b('0x7'));var config=require(_0x5b0b('0x8'));var attributes=require(_0x5b0b('0x9'));module[_0x5b0b('0xa')]=function(_0x1b6af7,_0x25481a){return _0x1b6af7['define'](_0x5b0b('0xb'),attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':[_0x5b0b('0xc'),_0x5b0b('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.rpc.js b/server/api/intSugarcrmField/intSugarcrmField.rpc.js index c50540d..0fc7ebd 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 _0xbc24=['message','info','result','catch','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x237f86,_0x104a7f){var _0x23a496=function(_0x23054f){while(--_0x23054f){_0x237f86['push'](_0x237f86['shift']());}};_0x23a496(++_0x104a7f);}(_0xbc24,0xac));var _0x4bc2=function(_0xfb11e4,_0x5f54d5){_0xfb11e4=_0xfb11e4-0x0;var _0x575b9e=_0xbc24[_0xfb11e4];return _0x575b9e;};'use strict';var _=require('lodash');var util=require(_0x4bc2('0x0'));var moment=require(_0x4bc2('0x1'));var BPromise=require(_0x4bc2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4bc2('0x3'))['db'];var utils=require(_0x4bc2('0x4'));var logger=require(_0x4bc2('0x5'))(_0x4bc2('0x6'));var config=require('../../config/environment');var jayson=require(_0x4bc2('0x7'));var client=jayson['client'][_0x4bc2('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1ee1d5,_0x5c7aae,_0x5c9db9){return new BPromise(function(_0x4d8642,_0x3d9c27){return client[_0x4bc2('0x9')](_0x1ee1d5,_0x5c9db9)[_0x4bc2('0xa')](function(_0x33ffe4){logger['info'](_0x4bc2('0xb'),_0x5c7aae,_0x4bc2('0xc'));logger[_0x4bc2('0xd')](_0x4bc2('0xe'),_0x5c7aae,_0x4bc2('0xc'),JSON[_0x4bc2('0xf')](_0x33ffe4));if(_0x33ffe4[_0x4bc2('0x10')]){if(_0x33ffe4[_0x4bc2('0x10')]['code']===0x1f4){logger[_0x4bc2('0x10')](_0x4bc2('0xb'),_0x5c7aae,_0x33ffe4['error']['message']);return _0x3d9c27(_0x33ffe4['error'][_0x4bc2('0x11')]);}logger['error']('SugarcrmField,\x20%s,\x20%s',_0x5c7aae,_0x33ffe4[_0x4bc2('0x10')][_0x4bc2('0x11')]);return _0x4d8642(_0x33ffe4['error'][_0x4bc2('0x11')]);}else{logger[_0x4bc2('0x12')](_0x4bc2('0xb'),_0x5c7aae,_0x4bc2('0xc'));_0x4d8642(_0x33ffe4[_0x4bc2('0x13')][_0x4bc2('0x11')]);}})[_0x4bc2('0x14')](function(_0xf43829){logger[_0x4bc2('0x10')](_0x4bc2('0xb'),_0x5c7aae,_0xf43829);_0x3d9c27(_0xf43829);});});} \ No newline at end of file +var _0xb9d2=['SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','client','http','request','SugarcrmField,\x20%s,\x20%s','request\x20sent'];(function(_0x357318,_0xc7771a){var _0x338002=function(_0x37d4ab){while(--_0x37d4ab){_0x357318['push'](_0x357318['shift']());}};_0x338002(++_0xc7771a);}(_0xb9d2,0xd0));var _0x2b9d=function(_0x19908f,_0xc32e70){_0x19908f=_0x19908f-0x0;var _0x36cfbe=_0xb9d2[_0x19908f];return _0x36cfbe;};'use strict';var _=require(_0x2b9d('0x0'));var util=require(_0x2b9d('0x1'));var moment=require(_0x2b9d('0x2'));var BPromise=require(_0x2b9d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2b9d('0x4'))['db'];var utils=require(_0x2b9d('0x5'));var logger=require(_0x2b9d('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2b9d('0x7')][_0x2b9d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1e155f,_0x57f71e,_0x496b66){return new BPromise(function(_0x5f00a2,_0x7f7ad6){return client[_0x2b9d('0x9')](_0x1e155f,_0x496b66)['then'](function(_0x1ab8a1){logger['info'](_0x2b9d('0xa'),_0x57f71e,_0x2b9d('0xb'));logger['debug'](_0x2b9d('0xc'),_0x57f71e,_0x2b9d('0xb'),JSON[_0x2b9d('0xd')](_0x1ab8a1));if(_0x1ab8a1[_0x2b9d('0xe')]){if(_0x1ab8a1[_0x2b9d('0xe')][_0x2b9d('0xf')]===0x1f4){logger[_0x2b9d('0xe')](_0x2b9d('0xa'),_0x57f71e,_0x1ab8a1[_0x2b9d('0xe')][_0x2b9d('0x10')]);return _0x7f7ad6(_0x1ab8a1[_0x2b9d('0xe')][_0x2b9d('0x10')]);}logger['error']('SugarcrmField,\x20%s,\x20%s',_0x57f71e,_0x1ab8a1[_0x2b9d('0xe')][_0x2b9d('0x10')]);return _0x5f00a2(_0x1ab8a1[_0x2b9d('0xe')][_0x2b9d('0x10')]);}else{logger[_0x2b9d('0x11')](_0x2b9d('0xa'),_0x57f71e,_0x2b9d('0xb'));_0x5f00a2(_0x1ab8a1[_0x2b9d('0x12')][_0x2b9d('0x10')]);}})[_0x2b9d('0x13')](function(_0x1b7976){logger[_0x2b9d('0xe')](_0x2b9d('0xa'),_0x57f71e,_0x1b7976);_0x7f7ad6(_0x1b7976);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 07cc7a0..a2faa13 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 _0xa459=['/:id','show','/:id/configurations','getConfigurations','getFields','post','addConfiguration','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','get'];(function(_0x27740a,_0x537f2c){var _0x1f7dad=function(_0x28d7f3){while(--_0x28d7f3){_0x27740a['push'](_0x27740a['shift']());}};_0x1f7dad(++_0x537f2c);}(_0xa459,0x1d8));var _0x9a45=function(_0x586fc0,_0x1ca661){_0x586fc0=_0x586fc0-0x0;var _0x2e6a73=_0xa459[_0x586fc0];return _0x2e6a73;};'use strict';var multer=require(_0x9a45('0x0'));var util=require(_0x9a45('0x1'));var path=require(_0x9a45('0x2'));var timeout=require(_0x9a45('0x3'));var express=require(_0x9a45('0x4'));var router=express[_0x9a45('0x5')]();var fs_extra=require(_0x9a45('0x6'));var auth=require(_0x9a45('0x7'));var interaction=require(_0x9a45('0x8'));var config=require('../../config/environment');var controller=require('./intVtigerAccount.controller');router['get']('/',auth[_0x9a45('0x9')](),controller['index']);router[_0x9a45('0xa')](_0x9a45('0xb'),auth[_0x9a45('0x9')](),controller[_0x9a45('0xc')]);router[_0x9a45('0xa')](_0x9a45('0xd'),auth['isAuthenticated'](),controller[_0x9a45('0xe')]);router['get']('/:id/fields',auth['isAuthenticated'](),controller[_0x9a45('0xf')]);router[_0x9a45('0x10')]('/',auth[_0x9a45('0x9')](),controller['create']);router[_0x9a45('0x10')](_0x9a45('0xd'),auth[_0x9a45('0x9')](),controller[_0x9a45('0x11')]);router[_0x9a45('0x12')](_0x9a45('0xb'),auth[_0x9a45('0x9')](),controller[_0x9a45('0x13')]);router[_0x9a45('0x14')]('/:id',auth[_0x9a45('0x9')](),controller[_0x9a45('0x15')]);module[_0x9a45('0x16')]=router; \ No newline at end of file +var _0x5694=['destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','getFields','create','post','addConfiguration','put','update','delete'];(function(_0x37c2a8,_0x20c9d9){var _0x5514f0=function(_0x2a0336){while(--_0x2a0336){_0x37c2a8['push'](_0x37c2a8['shift']());}};_0x5514f0(++_0x20c9d9);}(_0x5694,0x1ca));var _0x4569=function(_0x1906ef,_0x15aadc){_0x1906ef=_0x1906ef-0x0;var _0x141fd6=_0x5694[_0x1906ef];return _0x141fd6;};'use strict';var multer=require(_0x4569('0x0'));var util=require(_0x4569('0x1'));var path=require(_0x4569('0x2'));var timeout=require(_0x4569('0x3'));var express=require('express');var router=express[_0x4569('0x4')]();var fs_extra=require(_0x4569('0x5'));var auth=require(_0x4569('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x4569('0x7'));var controller=require('./intVtigerAccount.controller');router[_0x4569('0x8')]('/',auth[_0x4569('0x9')](),controller[_0x4569('0xa')]);router[_0x4569('0x8')](_0x4569('0xb'),auth[_0x4569('0x9')](),controller[_0x4569('0xc')]);router[_0x4569('0x8')](_0x4569('0xd'),auth[_0x4569('0x9')](),controller['getConfigurations']);router[_0x4569('0x8')](_0x4569('0xe'),auth[_0x4569('0x9')](),controller[_0x4569('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0x4569('0x10')]);router[_0x4569('0x11')](_0x4569('0xd'),auth['isAuthenticated'](),controller[_0x4569('0x12')]);router[_0x4569('0x13')]('/:id',auth[_0x4569('0x9')](),controller[_0x4569('0x14')]);router[_0x4569('0x15')](_0x4569('0xb'),auth['isAuthenticated'](),controller[_0x4569('0x16')]);module[_0x4569('0x17')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index bfc9a9e..5616ed9 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 _0x196f=['STRING','sequelize'];(function(_0x751b64,_0x2a72f7){var _0x38e165=function(_0x14f9f1){while(--_0x14f9f1){_0x751b64['push'](_0x751b64['shift']());}};_0x38e165(++_0x2a72f7);}(_0x196f,0xef));var _0xf196=function(_0xd2ff7a,_0x5ed65c){_0xd2ff7a=_0xd2ff7a-0x0;var _0x2be5d7=_0x196f[_0xd2ff7a];return _0x2be5d7;};'use strict';var Sequelize=require(_0xf196('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xf196('0x1')]},'username':{'type':Sequelize[_0xf196('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize[_0xf196('0x1')],'allowNull':![],'defaultValue':'HelpDesk'},'remoteUri':{'type':Sequelize[_0xf196('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xf196('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize[_0xf196('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xc288=['sequelize','STRING','HelpDesk'];(function(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0xc288,0xfc));var _0x8c28=function(_0x81e374,_0x5e71f4){_0x81e374=_0x81e374-0x0;var _0x292b27=_0xc288[_0x81e374];return _0x292b27;};'use strict';var Sequelize=require(_0x8c28('0x0'));module['exports']={'name':{'type':Sequelize[_0x8c28('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x8c28('0x1')]},'username':{'type':Sequelize[_0x8c28('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x8c28('0x2')},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x8c28('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x8c28('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index 6b6f4a1..d7674cc 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 _0x4985=['../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','stack','name','send','index','map','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','length','order','sort','where','filter','merge','VIRTUAL','VtigerAccount','findAll','rows','catch','show','params','fields','includeAll','include','options','find','create','body','getConfigurations','findOne','pick','hasOwnProperty','nolimit','AccountId','Subjects','getSubjects','channel','type','Descriptions','getDescriptions','VtigerConfiguration','VtigerField','md5','username','description','moduleName','remoteUri','serverUrl','accessKey','substring','lastIndexOf','format','%s/webservice.php','GET','getchallenge','success','POST','result','token','describe','sessionName','autogenerated','reference','owner','includes','editable','label','startsWith','picklistValues','value','vTiger\x20error:\x20','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','eml-format','rimraf','fast-json-patch','moment','util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x5ec453,_0x30b0ba){var _0x25548f=function(_0x387b62){while(--_0x387b62){_0x5ec453['push'](_0x5ec453['shift']());}};_0x25548f(++_0x30b0ba);}(_0x4985,0xd8));var _0x5498=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0x4985[_0x5c3c0b];return _0x52ecd2;};'use strict';var emlformat=require(_0x5498('0x0'));var rimraf=require(_0x5498('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5498('0x2'));var rp=require('request-promise');var moment=require(_0x5498('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x5498('0x4'));var path=require(_0x5498('0x5'));var sox=require(_0x5498('0x6'));var csv=require('to-csv');var ejs=require(_0x5498('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5498('0x8'));var squel=require(_0x5498('0x9'));var crypto=require(_0x5498('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x5498('0xb'));var toCsv=require(_0x5498('0xc'));var querystring=require(_0x5498('0xd'));var Papa=require(_0x5498('0xe'));var Redis=require(_0x5498('0xf'));var authService=require(_0x5498('0x10'));var qs=require(_0x5498('0x11'));var as=require(_0x5498('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5498('0x13'))(_0x5498('0x14'));var utils=require('../../config/utils');var config=require(_0x5498('0x15'));var licenseUtil=require(_0x5498('0x16'));var db=require(_0x5498('0x17'))['db'];var integrations=require(_0x5498('0x18'));function respondWithStatusCode(_0x81f13f,_0x43b4b5){_0x43b4b5=_0x43b4b5||0xcc;return function(_0x83b76a){if(_0x83b76a){return _0x81f13f[_0x5498('0x19')](_0x43b4b5);}return _0x81f13f[_0x5498('0x1a')](_0x43b4b5)[_0x5498('0x1b')]();};}function respondWithResult(_0x2fe669,_0x45a30d){_0x45a30d=_0x45a30d||0xc8;return function(_0x4ec50a){if(_0x4ec50a){return _0x2fe669['status'](_0x45a30d)[_0x5498('0x1c')](_0x4ec50a);}};}function respondWithFilteredResult(_0x1b0509,_0x10875f){return function(_0x26557f){if(_0x26557f){var _0x3b1ca4=typeof _0x10875f[_0x5498('0x1d')]===_0x5498('0x1e')&&typeof _0x10875f[_0x5498('0x1f')]===_0x5498('0x1e');var _0x4c1df6=_0x26557f[_0x5498('0x20')];var _0x541a1c=_0x3b1ca4?0x0:_0x10875f['offset'];var _0x17b877=_0x3b1ca4?_0x26557f[_0x5498('0x20')]:_0x10875f['offset']+_0x10875f[_0x5498('0x1f')];var _0x564ad0;if(_0x17b877>=_0x4c1df6){_0x17b877=_0x4c1df6;_0x564ad0=0xc8;}else{_0x564ad0=0xce;}_0x1b0509[_0x5498('0x1a')](_0x564ad0);return _0x1b0509['set'](_0x5498('0x21'),_0x541a1c+'-'+_0x17b877+'/'+_0x4c1df6)[_0x5498('0x1c')](_0x26557f);}return null;};}function patchUpdates(_0x5dc840){return function(_0x5875b5){try{jsonpatch[_0x5498('0x22')](_0x5875b5,_0x5dc840,!![]);}catch(_0xf5d0dd){return BPromise['reject'](_0xf5d0dd);}return _0x5875b5[_0x5498('0x23')]();};}function saveUpdates(_0x537b6d,_0x53ba68){return function(_0x4dc0b4){if(_0x4dc0b4){return _0x4dc0b4[_0x5498('0x24')](_0x537b6d)[_0x5498('0x25')](function(_0x2e0377){return _0x2e0377;});}return null;};}function removeEntity(_0x469f96,_0x8f5b1){return function(_0x5958b0){if(_0x5958b0){return _0x5958b0['destroy']()['then'](function(){_0x469f96[_0x5498('0x1a')](0xcc)[_0x5498('0x1b')]();});}};}function handleEntityNotFound(_0x575528,_0x1a53ef){return function(_0x5c105d){if(!_0x5c105d){_0x575528['sendStatus'](0x194);}return _0x5c105d;};}function handleError(_0x2e2b02,_0x53b5c8){_0x53b5c8=_0x53b5c8||0x1f4;return function(_0x1ad33e){logger['error'](_0x1ad33e[_0x5498('0x26')]);if(_0x1ad33e['name']){delete _0x1ad33e[_0x5498('0x27')];}_0x2e2b02[_0x5498('0x1a')](_0x53b5c8)[_0x5498('0x28')](_0x1ad33e);};}exports[_0x5498('0x29')]=function(_0x2580c4,_0x541efc){var _0x533e0b={},_0x18e27f={},_0x1047ca={'count':0x0,'rows':[]};var _0x38c973=_[_0x5498('0x2a')](db['VtigerAccount'][_0x5498('0x2b')],function(_0x1179ec){return{'name':_0x1179ec[_0x5498('0x2c')],'type':_0x1179ec['type']['key']};});_0x18e27f[_0x5498('0x2d')]=_[_0x5498('0x2a')](_0x38c973,_0x5498('0x27'));_0x18e27f[_0x5498('0x2e')]=_[_0x5498('0x2f')](_0x2580c4[_0x5498('0x2e')]);_0x18e27f[_0x5498('0x30')]=_[_0x5498('0x31')](_0x18e27f['model'],_0x18e27f[_0x5498('0x2e')]);_0x533e0b[_0x5498('0x32')]=_[_0x5498('0x31')](_0x18e27f[_0x5498('0x2d')],qs['fields'](_0x2580c4[_0x5498('0x2e')]['fields']));_0x533e0b['attributes']=_0x533e0b[_0x5498('0x32')][_0x5498('0x33')]?_0x533e0b[_0x5498('0x32')]:_0x18e27f['model'];if(!_0x2580c4['query']['hasOwnProperty']('nolimit')){_0x533e0b[_0x5498('0x1f')]=qs['limit'](_0x2580c4[_0x5498('0x2e')][_0x5498('0x1f')]);_0x533e0b['offset']=qs[_0x5498('0x1d')](_0x2580c4[_0x5498('0x2e')][_0x5498('0x1d')]);}_0x533e0b[_0x5498('0x34')]=qs[_0x5498('0x35')](_0x2580c4['query']['sort']);_0x533e0b[_0x5498('0x36')]=qs[_0x5498('0x30')](_['pick'](_0x2580c4['query'],_0x18e27f[_0x5498('0x30')]),_0x38c973);if(_0x2580c4['query'][_0x5498('0x37')]){_0x533e0b['where']=_[_0x5498('0x38')](_0x533e0b['where'],{'$or':_['map'](_0x38c973,function(_0x36d940){if(_0x36d940['type']!==_0x5498('0x39')){var _0x4a464f={};_0x4a464f[_0x36d940[_0x5498('0x27')]]={'$like':'%'+_0x2580c4[_0x5498('0x2e')][_0x5498('0x37')]+'%'};return _0x4a464f;}})});}_0x533e0b=_['merge']({},_0x533e0b,_0x2580c4['options']);var _0x34dd8c={'where':_0x533e0b[_0x5498('0x36')]};return db[_0x5498('0x3a')][_0x5498('0x20')](_0x34dd8c)[_0x5498('0x25')](function(_0x2c6f83){_0x1047ca[_0x5498('0x20')]=_0x2c6f83;if(_0x2580c4[_0x5498('0x2e')]['includeAll']){_0x533e0b['include']=[{'all':!![]}];}return db[_0x5498('0x3a')][_0x5498('0x3b')](_0x533e0b);})[_0x5498('0x25')](function(_0x341e9b){_0x1047ca[_0x5498('0x3c')]=_0x341e9b;return _0x1047ca;})['then'](respondWithFilteredResult(_0x541efc,_0x533e0b))[_0x5498('0x3d')](handleError(_0x541efc,null));};exports[_0x5498('0x3e')]=function(_0x20c368,_0x6e627c){var _0xaaaabe={'raw':![],'where':{'id':_0x20c368[_0x5498('0x3f')]['id']}},_0x2b0ce5={};_0x2b0ce5[_0x5498('0x2d')]=_[_0x5498('0x2f')](db[_0x5498('0x3a')]['rawAttributes']);_0x2b0ce5[_0x5498('0x2e')]=_['keys'](_0x20c368[_0x5498('0x2e')]);_0x2b0ce5[_0x5498('0x30')]=_[_0x5498('0x31')](_0x2b0ce5[_0x5498('0x2d')],_0x2b0ce5[_0x5498('0x2e')]);_0xaaaabe[_0x5498('0x32')]=_[_0x5498('0x31')](_0x2b0ce5['model'],qs[_0x5498('0x40')](_0x20c368['query'][_0x5498('0x40')]));_0xaaaabe[_0x5498('0x32')]=_0xaaaabe[_0x5498('0x32')][_0x5498('0x33')]?_0xaaaabe[_0x5498('0x32')]:_0x2b0ce5['model'];if(_0x20c368[_0x5498('0x2e')][_0x5498('0x41')]){_0xaaaabe[_0x5498('0x42')]=[{'all':!![]}];}_0xaaaabe=_[_0x5498('0x38')]({},_0xaaaabe,_0x20c368[_0x5498('0x43')]);return db[_0x5498('0x3a')][_0x5498('0x44')](_0xaaaabe)[_0x5498('0x25')](handleEntityNotFound(_0x6e627c,null))[_0x5498('0x25')](respondWithResult(_0x6e627c,null))['catch'](handleError(_0x6e627c,null));};exports[_0x5498('0x45')]=function(_0x334d3b,_0x116422){return db[_0x5498('0x3a')]['create'](_0x334d3b[_0x5498('0x46')],{})[_0x5498('0x25')](respondWithResult(_0x116422,0xc9))['catch'](handleError(_0x116422,null));};exports['update']=function(_0x309952,_0x503784){if(_0x309952[_0x5498('0x46')]['id']){delete _0x309952[_0x5498('0x46')]['id'];}return db[_0x5498('0x3a')][_0x5498('0x44')]({'where':{'id':_0x309952[_0x5498('0x3f')]['id']}})[_0x5498('0x25')](handleEntityNotFound(_0x503784,null))[_0x5498('0x25')](saveUpdates(_0x309952[_0x5498('0x46')],null))['then'](respondWithResult(_0x503784,null))[_0x5498('0x3d')](handleError(_0x503784,null));};exports['destroy']=function(_0x19a622,_0x1a5e6e){return db[_0x5498('0x3a')][_0x5498('0x44')]({'where':{'id':_0x19a622[_0x5498('0x3f')]['id']}})[_0x5498('0x25')](handleEntityNotFound(_0x1a5e6e,null))[_0x5498('0x25')](removeEntity(_0x1a5e6e,null))['catch'](handleError(_0x1a5e6e,null));};exports[_0x5498('0x47')]=function(_0x300b05,_0x276291,_0x3b6510){var _0x13a1a0={};var _0x3540c0={};var _0x54d5b7;var _0x292301;return db[_0x5498('0x3a')][_0x5498('0x48')]({'where':{'id':_0x300b05['params']['id']}})[_0x5498('0x25')](handleEntityNotFound(_0x276291,null))[_0x5498('0x25')](function(_0x78fcf3){if(_0x78fcf3){_0x54d5b7=_0x78fcf3;_0x3540c0[_0x5498('0x2d')]=_[_0x5498('0x2f')](db['VtigerConfiguration'][_0x5498('0x2b')]);_0x3540c0[_0x5498('0x2e')]=_['keys'](_0x300b05[_0x5498('0x2e')]);_0x3540c0[_0x5498('0x30')]=_[_0x5498('0x31')](_0x3540c0[_0x5498('0x2d')],_0x3540c0[_0x5498('0x2e')]);_0x13a1a0[_0x5498('0x32')]=_[_0x5498('0x31')](_0x3540c0[_0x5498('0x2d')],qs[_0x5498('0x40')](_0x300b05['query'][_0x5498('0x40')]));_0x13a1a0[_0x5498('0x32')]=_0x13a1a0[_0x5498('0x32')][_0x5498('0x33')]?_0x13a1a0[_0x5498('0x32')]:_0x3540c0['model'];_0x13a1a0[_0x5498('0x34')]=qs[_0x5498('0x35')](_0x300b05['query'][_0x5498('0x35')]);_0x13a1a0['where']=qs['filters'](_[_0x5498('0x49')](_0x300b05[_0x5498('0x2e')],_0x3540c0['filters']));if(_0x300b05[_0x5498('0x2e')][_0x5498('0x37')]){_0x13a1a0[_0x5498('0x36')]=_[_0x5498('0x38')](_0x13a1a0[_0x5498('0x36')],{'$or':_[_0x5498('0x2a')](_0x13a1a0['attributes'],function(_0x55f2d8){var _0x496150={};_0x496150[_0x55f2d8]={'$like':'%'+_0x300b05['query'][_0x5498('0x37')]+'%'};return _0x496150;})});}_0x13a1a0=_[_0x5498('0x38')]({},_0x13a1a0,_0x300b05[_0x5498('0x43')]);return _0x54d5b7[_0x5498('0x47')](_0x13a1a0);}})[_0x5498('0x25')](function(_0x3d510e){if(_0x3d510e){_0x292301=_0x3d510e['length'];if(!_0x300b05['query'][_0x5498('0x4a')](_0x5498('0x4b'))){_0x13a1a0[_0x5498('0x1f')]=qs['limit'](_0x300b05['query'][_0x5498('0x1f')]);_0x13a1a0[_0x5498('0x1d')]=qs[_0x5498('0x1d')](_0x300b05[_0x5498('0x2e')][_0x5498('0x1d')]);}return _0x54d5b7[_0x5498('0x47')](_0x13a1a0);}})[_0x5498('0x25')](function(_0x1f65ba){if(_0x1f65ba){return _0x1f65ba?{'count':_0x292301,'rows':_0x1f65ba}:null;}})['then'](respondWithResult(_0x276291,null))[_0x5498('0x3d')](handleError(_0x276291,null));};exports['addConfiguration']=function(_0x29bbf0,_0x2f9343,_0x572de8){if(_0x29bbf0['body']['id']){delete _0x29bbf0[_0x5498('0x46')]['id'];}return db[_0x5498('0x3a')]['findOne']({'where':{'id':_0x29bbf0['params']['id']}})[_0x5498('0x25')](handleEntityNotFound(_0x2f9343,null))[_0x5498('0x25')](function(_0x26f77e){if(_0x26f77e){_0x29bbf0[_0x5498('0x46')][_0x5498('0x4c')]=_0x26f77e['id'];_0x29bbf0[_0x5498('0x46')][_0x5498('0x4d')]=integrations[_0x5498('0x4e')](_0x29bbf0[_0x5498('0x46')][_0x5498('0x4f')],_0x29bbf0[_0x5498('0x46')][_0x5498('0x50')]);_0x29bbf0[_0x5498('0x46')][_0x5498('0x51')]=integrations[_0x5498('0x52')](_0x29bbf0['body'][_0x5498('0x4f')],_0x29bbf0[_0x5498('0x46')][_0x5498('0x50')]);return db[_0x5498('0x53')][_0x5498('0x45')](_0x29bbf0['body'],{'include':[{'model':db['VtigerField'],'as':_0x5498('0x4d')},{'model':db[_0x5498('0x54')],'as':_0x5498('0x51')}]});}return null;})[_0x5498('0x25')](respondWithResult(_0x2f9343,null))[_0x5498('0x3d')](handleError(_0x2f9343,null));};var md5=require(_0x5498('0x55'));exports['getFields']=function(_0x56738c,_0x24da8c,_0x503a6d){var _0x4e5b81=null;var _0x3c9972=null;var _0x2e7ccf=null;var _0x348d06=null;var _0x4a4bfd='';return db['VtigerAccount']['findOne']({'where':{'id':_0x56738c[_0x5498('0x3f')]['id']},'attributes':['id',_0x5498('0x27'),_0x5498('0x56'),_0x5498('0x57'),_0x5498('0x58'),_0x5498('0x59'),_0x5498('0x5a'),_0x5498('0x5b')]})[_0x5498('0x25')](handleEntityNotFound(_0x24da8c,null))[_0x5498('0x25')](function(_0x3e12d2){if(_0x3e12d2){_0x4e5b81=_0x3e12d2[_0x5498('0x56')];_0x3c9972=_0x3e12d2[_0x5498('0x5b')];_0x2e7ccf=_0x3e12d2[_0x5498('0x58')];_0x4a4bfd=_0x3e12d2['remoteUri'];var _0x298194=_0x4a4bfd['slice'](-0x1);if(_0x298194==='/'){_0x4a4bfd=_0x4a4bfd[_0x5498('0x5c')](0x0,_0x4a4bfd[_0x5498('0x5d')](_0x298194));}_0x348d06=util[_0x5498('0x5e')](_0x5498('0x5f'),_0x4a4bfd);var _0x3c8b9b={'method':_0x5498('0x60'),'uri':_0x348d06,'qs':{'operation':_0x5498('0x61'),'username':_0x3e12d2[_0x5498('0x56')]},'json':!![]};return rp(_0x3c8b9b);}})[_0x5498('0x25')](function(_0x373dd5){if(_0x373dd5[_0x5498('0x62')]){var _0x490094={'method':_0x5498('0x63'),'uri':_0x348d06,'form':{'operation':'login','username':_0x4e5b81,'accessKey':md5(_0x373dd5[_0x5498('0x64')][_0x5498('0x65')]+_0x3c9972)},'json':!![]};return rp(_0x490094);}})[_0x5498('0x25')](function(_0x998556){if(_0x998556[_0x5498('0x62')]){var _0x54a4c5={'method':_0x5498('0x60'),'uri':_0x348d06,'qs':{'operation':_0x5498('0x66'),'username':_0x4e5b81,'sessionName':_0x998556[_0x5498('0x64')][_0x5498('0x67')],'elementType':_0x2e7ccf},'json':!![]};return rp(_0x54a4c5);}})[_0x5498('0x25')](function(_0x3eca02){if(_0x3eca02[_0x5498('0x62')]){var _0x30c777=[_0x5498('0x68'),_0x5498('0x69'),_0x5498('0x6a')];_['remove'](_0x3eca02[_0x5498('0x64')][_0x5498('0x40')],function(_0x2e9d19){return _0x30c777[_0x5498('0x6b')](_0x2e9d19['type'][_0x5498('0x27')]);});_['remove'](_0x3eca02[_0x5498('0x64')][_0x5498('0x40')],function(_0x3a8271){return _0x3a8271[_0x5498('0x6c')]==='false';});return{'count':_0x3eca02[_0x5498('0x64')][_0x5498('0x40')][_0x5498('0x33')],'rows':_[_0x5498('0x2a')](_0x3eca02[_0x5498('0x64')][_0x5498('0x40')],function(_0x4a6b0d){return{'id':_0x4a6b0d[_0x5498('0x27')],'name':_0x4a6b0d[_0x5498('0x6d')],'custom':_[_0x5498('0x6e')](_0x4a6b0d[_0x5498('0x27')],'cf_')?!![]:![],'options':_0x4a6b0d[_0x5498('0x50')][_0x5498('0x27')]==='picklist'&&_0x4a6b0d[_0x5498('0x50')]['picklistValues'][_0x5498('0x33')]>0x0?_[_0x5498('0x2a')](_0x4a6b0d['type'][_0x5498('0x6f')],function(_0x1fece6){return{'name':_0x1fece6[_0x5498('0x6d')],'value':_0x1fece6[_0x5498('0x70')]};}):[]};})};}})[_0x5498('0x25')](respondWithResult(_0x24da8c,null))[_0x5498('0x3d')](function(_0x408aaf){console['log'](_0x5498('0x71')+_0x408aaf);var _0x1f182c=_0x56738c[_0x5498('0x2e')][_0x5498('0x72')]?0x1f4:_0x408aaf[_0x5498('0x73')]||0x1f4;logger[_0x5498('0x74')](_0x5498('0x75'),_0x5498('0x76'),_0x1f182c,JSON[_0x5498('0x77')](_0x408aaf));delete _0x408aaf['name'];if(_0x1f182c===0x191){_0x1f182c=0x190;}_0x24da8c[_0x5498('0x1a')](_0x1f182c)[_0x5498('0x28')](_0x56738c[_0x5498('0x2e')][_0x5498('0x72')]?{'message':'Wrong\x20credentials','statusCode':_0x408aaf[_0x5498('0x73')]}:_0x408aaf);});}; \ No newline at end of file +var _0xaca4=['login','result','token','describe','sessionName','reference','owner','remove','includes','label','startsWith','cf_','picklistValues','value','vTiger\x20error:\x20','test','statusCode','error','stringify','Wrong\x20credentials','rimraf','zip-dir','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','json','limit','undefined','count','offset','set','Content-Range','apply','update','destroy','then','stack','name','send','index','map','fieldName','key','model','query','filters','intersection','attributes','length','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','VtigerAccount','findAll','show','keys','rawAttributes','fields','includeAll','include','find','create','body','catch','params','getConfigurations','findOne','VtigerConfiguration','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','VtigerField','getFields','username','moduleName','remoteUri','serverUrl','accessKey','slice','format','%s/webservice.php','GET','success','POST'];(function(_0x4aa4e6,_0x278c45){var _0x322588=function(_0x19279d){while(--_0x19279d){_0x4aa4e6['push'](_0x4aa4e6['shift']());}};_0x322588(++_0x278c45);}(_0xaca4,0x179));var _0x4aca=function(_0x910a5b,_0x53c6f9){_0x910a5b=_0x910a5b-0x0;var _0x3a44b7=_0xaca4[_0x910a5b];return _0x3a44b7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4aca('0x0'));var zipdir=require(_0x4aca('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4aca('0x2'));var moment=require(_0x4aca('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x4aca('0x4'));var util=require(_0x4aca('0x5'));var path=require('path');var sox=require(_0x4aca('0x6'));var csv=require(_0x4aca('0x7'));var ejs=require(_0x4aca('0x8'));var fs=require('fs');var fs_extra=require(_0x4aca('0x9'));var _=require(_0x4aca('0xa'));var squel=require(_0x4aca('0xb'));var crypto=require(_0x4aca('0xc'));var jsforce=require(_0x4aca('0xd'));var deskjs=require(_0x4aca('0xe'));var toCsv=require(_0x4aca('0x7'));var querystring=require(_0x4aca('0xf'));var Papa=require(_0x4aca('0x10'));var Redis=require(_0x4aca('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x4aca('0x12'));var as=require(_0x4aca('0x13'));var hardwareService=require(_0x4aca('0x14'));var logger=require(_0x4aca('0x15'))(_0x4aca('0x16'));var utils=require(_0x4aca('0x17'));var config=require(_0x4aca('0x18'));var licenseUtil=require(_0x4aca('0x19'));var db=require(_0x4aca('0x1a'))['db'];var integrations=require(_0x4aca('0x1b'));function respondWithStatusCode(_0x2da08e,_0x4dd42c){_0x4dd42c=_0x4dd42c||0xcc;return function(_0x5257bd){if(_0x5257bd){return _0x2da08e['sendStatus'](_0x4dd42c);}return _0x2da08e[_0x4aca('0x1c')](_0x4dd42c)['end']();};}function respondWithResult(_0x50c6e5,_0x5b294d){_0x5b294d=_0x5b294d||0xc8;return function(_0x208084){if(_0x208084){return _0x50c6e5[_0x4aca('0x1c')](_0x5b294d)[_0x4aca('0x1d')](_0x208084);}};}function respondWithFilteredResult(_0x4417bf,_0x1028fb){return function(_0x45ffbc){if(_0x45ffbc){var _0x1006cc=typeof _0x1028fb['offset']==='undefined'&&typeof _0x1028fb[_0x4aca('0x1e')]===_0x4aca('0x1f');var _0xf7dbca=_0x45ffbc[_0x4aca('0x20')];var _0x39fa23=_0x1006cc?0x0:_0x1028fb[_0x4aca('0x21')];var _0x13f138=_0x1006cc?_0x45ffbc[_0x4aca('0x20')]:_0x1028fb[_0x4aca('0x21')]+_0x1028fb[_0x4aca('0x1e')];var _0x4d5dfb;if(_0x13f138>=_0xf7dbca){_0x13f138=_0xf7dbca;_0x4d5dfb=0xc8;}else{_0x4d5dfb=0xce;}_0x4417bf[_0x4aca('0x1c')](_0x4d5dfb);return _0x4417bf[_0x4aca('0x22')](_0x4aca('0x23'),_0x39fa23+'-'+_0x13f138+'/'+_0xf7dbca)[_0x4aca('0x1d')](_0x45ffbc);}return null;};}function patchUpdates(_0xa600e1){return function(_0x3081a5){try{jsonpatch[_0x4aca('0x24')](_0x3081a5,_0xa600e1,!![]);}catch(_0x2d6264){return BPromise['reject'](_0x2d6264);}return _0x3081a5['save']();};}function saveUpdates(_0x38d82b,_0x2c0fdb){return function(_0x4a4d9d){if(_0x4a4d9d){return _0x4a4d9d[_0x4aca('0x25')](_0x38d82b)['then'](function(_0x11ce9b){return _0x11ce9b;});}return null;};}function removeEntity(_0xc50608,_0x3d4d15){return function(_0x4d9474){if(_0x4d9474){return _0x4d9474[_0x4aca('0x26')]()[_0x4aca('0x27')](function(){_0xc50608['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5d6378,_0x1f9a4a){return function(_0x447c19){if(!_0x447c19){_0x5d6378['sendStatus'](0x194);}return _0x447c19;};}function handleError(_0x7cbb33,_0x5821c7){_0x5821c7=_0x5821c7||0x1f4;return function(_0x1b97bc){logger['error'](_0x1b97bc[_0x4aca('0x28')]);if(_0x1b97bc[_0x4aca('0x29')]){delete _0x1b97bc[_0x4aca('0x29')];}_0x7cbb33['status'](_0x5821c7)[_0x4aca('0x2a')](_0x1b97bc);};}exports[_0x4aca('0x2b')]=function(_0x379f39,_0x14d333){var _0x131dc4={},_0x2a6823={},_0x1aa8a2={'count':0x0,'rows':[]};var _0x2f67c6=_[_0x4aca('0x2c')](db['VtigerAccount']['rawAttributes'],function(_0x2dc9ae){return{'name':_0x2dc9ae[_0x4aca('0x2d')],'type':_0x2dc9ae['type'][_0x4aca('0x2e')]};});_0x2a6823[_0x4aca('0x2f')]=_[_0x4aca('0x2c')](_0x2f67c6,_0x4aca('0x29'));_0x2a6823['query']=_['keys'](_0x379f39[_0x4aca('0x30')]);_0x2a6823[_0x4aca('0x31')]=_[_0x4aca('0x32')](_0x2a6823[_0x4aca('0x2f')],_0x2a6823[_0x4aca('0x30')]);_0x131dc4[_0x4aca('0x33')]=_['intersection'](_0x2a6823[_0x4aca('0x2f')],qs['fields'](_0x379f39[_0x4aca('0x30')]['fields']));_0x131dc4[_0x4aca('0x33')]=_0x131dc4['attributes'][_0x4aca('0x34')]?_0x131dc4['attributes']:_0x2a6823['model'];if(!_0x379f39[_0x4aca('0x30')]['hasOwnProperty'](_0x4aca('0x35'))){_0x131dc4['limit']=qs[_0x4aca('0x1e')](_0x379f39[_0x4aca('0x30')]['limit']);_0x131dc4['offset']=qs[_0x4aca('0x21')](_0x379f39[_0x4aca('0x30')][_0x4aca('0x21')]);}_0x131dc4[_0x4aca('0x36')]=qs[_0x4aca('0x37')](_0x379f39[_0x4aca('0x30')][_0x4aca('0x37')]);_0x131dc4[_0x4aca('0x38')]=qs[_0x4aca('0x31')](_[_0x4aca('0x39')](_0x379f39[_0x4aca('0x30')],_0x2a6823[_0x4aca('0x31')]),_0x2f67c6);if(_0x379f39[_0x4aca('0x30')]['filter']){_0x131dc4['where']=_[_0x4aca('0x3a')](_0x131dc4[_0x4aca('0x38')],{'$or':_[_0x4aca('0x2c')](_0x2f67c6,function(_0x43f2bf){if(_0x43f2bf[_0x4aca('0x3b')]!==_0x4aca('0x3c')){var _0x2468f5={};_0x2468f5[_0x43f2bf[_0x4aca('0x29')]]={'$like':'%'+_0x379f39[_0x4aca('0x30')][_0x4aca('0x3d')]+'%'};return _0x2468f5;}})});}_0x131dc4=_[_0x4aca('0x3a')]({},_0x131dc4,_0x379f39[_0x4aca('0x3e')]);var _0x1eb5c9={'where':_0x131dc4['where']};return db[_0x4aca('0x3f')]['count'](_0x1eb5c9)['then'](function(_0xa49c68){_0x1aa8a2['count']=_0xa49c68;if(_0x379f39[_0x4aca('0x30')]['includeAll']){_0x131dc4['include']=[{'all':!![]}];}return db['VtigerAccount'][_0x4aca('0x40')](_0x131dc4);})[_0x4aca('0x27')](function(_0x7965b6){_0x1aa8a2['rows']=_0x7965b6;return _0x1aa8a2;})['then'](respondWithFilteredResult(_0x14d333,_0x131dc4))['catch'](handleError(_0x14d333,null));};exports[_0x4aca('0x41')]=function(_0x24676b,_0x27e162){var _0x582a46={'raw':![],'where':{'id':_0x24676b['params']['id']}},_0x55b404={};_0x55b404[_0x4aca('0x2f')]=_[_0x4aca('0x42')](db['VtigerAccount'][_0x4aca('0x43')]);_0x55b404[_0x4aca('0x30')]=_[_0x4aca('0x42')](_0x24676b[_0x4aca('0x30')]);_0x55b404[_0x4aca('0x31')]=_[_0x4aca('0x32')](_0x55b404[_0x4aca('0x2f')],_0x55b404[_0x4aca('0x30')]);_0x582a46[_0x4aca('0x33')]=_['intersection'](_0x55b404[_0x4aca('0x2f')],qs['fields'](_0x24676b['query'][_0x4aca('0x44')]));_0x582a46[_0x4aca('0x33')]=_0x582a46[_0x4aca('0x33')][_0x4aca('0x34')]?_0x582a46[_0x4aca('0x33')]:_0x55b404[_0x4aca('0x2f')];if(_0x24676b[_0x4aca('0x30')][_0x4aca('0x45')]){_0x582a46[_0x4aca('0x46')]=[{'all':!![]}];}_0x582a46=_[_0x4aca('0x3a')]({},_0x582a46,_0x24676b[_0x4aca('0x3e')]);return db[_0x4aca('0x3f')][_0x4aca('0x47')](_0x582a46)[_0x4aca('0x27')](handleEntityNotFound(_0x27e162,null))[_0x4aca('0x27')](respondWithResult(_0x27e162,null))['catch'](handleError(_0x27e162,null));};exports[_0x4aca('0x48')]=function(_0x4e3025,_0x397dc6){return db['VtigerAccount']['create'](_0x4e3025[_0x4aca('0x49')],{})[_0x4aca('0x27')](respondWithResult(_0x397dc6,0xc9))[_0x4aca('0x4a')](handleError(_0x397dc6,null));};exports[_0x4aca('0x25')]=function(_0x15575b,_0x3bb134){if(_0x15575b[_0x4aca('0x49')]['id']){delete _0x15575b[_0x4aca('0x49')]['id'];}return db['VtigerAccount'][_0x4aca('0x47')]({'where':{'id':_0x15575b[_0x4aca('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3bb134,null))['then'](saveUpdates(_0x15575b[_0x4aca('0x49')],null))[_0x4aca('0x27')](respondWithResult(_0x3bb134,null))['catch'](handleError(_0x3bb134,null));};exports[_0x4aca('0x26')]=function(_0x350b74,_0x1cdc49){return db['VtigerAccount'][_0x4aca('0x47')]({'where':{'id':_0x350b74[_0x4aca('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1cdc49,null))['then'](removeEntity(_0x1cdc49,null))[_0x4aca('0x4a')](handleError(_0x1cdc49,null));};exports[_0x4aca('0x4c')]=function(_0x1b086d,_0x272869,_0x39be2a){var _0x11cd9f={};var _0x2bede2={};var _0x12f5c3;var _0x50a28c;return db[_0x4aca('0x3f')][_0x4aca('0x4d')]({'where':{'id':_0x1b086d[_0x4aca('0x4b')]['id']}})['then'](handleEntityNotFound(_0x272869,null))[_0x4aca('0x27')](function(_0x147d38){if(_0x147d38){_0x12f5c3=_0x147d38;_0x2bede2[_0x4aca('0x2f')]=_[_0x4aca('0x42')](db[_0x4aca('0x4e')][_0x4aca('0x43')]);_0x2bede2['query']=_[_0x4aca('0x42')](_0x1b086d[_0x4aca('0x30')]);_0x2bede2[_0x4aca('0x31')]=_[_0x4aca('0x32')](_0x2bede2[_0x4aca('0x2f')],_0x2bede2[_0x4aca('0x30')]);_0x11cd9f[_0x4aca('0x33')]=_[_0x4aca('0x32')](_0x2bede2[_0x4aca('0x2f')],qs[_0x4aca('0x44')](_0x1b086d[_0x4aca('0x30')][_0x4aca('0x44')]));_0x11cd9f[_0x4aca('0x33')]=_0x11cd9f[_0x4aca('0x33')][_0x4aca('0x34')]?_0x11cd9f['attributes']:_0x2bede2[_0x4aca('0x2f')];_0x11cd9f[_0x4aca('0x36')]=qs[_0x4aca('0x37')](_0x1b086d[_0x4aca('0x30')][_0x4aca('0x37')]);_0x11cd9f[_0x4aca('0x38')]=qs[_0x4aca('0x31')](_[_0x4aca('0x39')](_0x1b086d['query'],_0x2bede2[_0x4aca('0x31')]));if(_0x1b086d[_0x4aca('0x30')][_0x4aca('0x3d')]){_0x11cd9f[_0x4aca('0x38')]=_[_0x4aca('0x3a')](_0x11cd9f['where'],{'$or':_[_0x4aca('0x2c')](_0x11cd9f[_0x4aca('0x33')],function(_0xbc766e){var _0x31c15b={};_0x31c15b[_0xbc766e]={'$like':'%'+_0x1b086d[_0x4aca('0x30')][_0x4aca('0x3d')]+'%'};return _0x31c15b;})});}_0x11cd9f=_[_0x4aca('0x3a')]({},_0x11cd9f,_0x1b086d[_0x4aca('0x3e')]);return _0x12f5c3[_0x4aca('0x4c')](_0x11cd9f);}})[_0x4aca('0x27')](function(_0x4f86fd){if(_0x4f86fd){_0x50a28c=_0x4f86fd['length'];if(!_0x1b086d[_0x4aca('0x30')][_0x4aca('0x4f')](_0x4aca('0x35'))){_0x11cd9f[_0x4aca('0x1e')]=qs[_0x4aca('0x1e')](_0x1b086d[_0x4aca('0x30')][_0x4aca('0x1e')]);_0x11cd9f[_0x4aca('0x21')]=qs[_0x4aca('0x21')](_0x1b086d[_0x4aca('0x30')]['offset']);}return _0x12f5c3[_0x4aca('0x4c')](_0x11cd9f);}})[_0x4aca('0x27')](function(_0x4cf6c4){if(_0x4cf6c4){return _0x4cf6c4?{'count':_0x50a28c,'rows':_0x4cf6c4}:null;}})[_0x4aca('0x27')](respondWithResult(_0x272869,null))['catch'](handleError(_0x272869,null));};exports[_0x4aca('0x50')]=function(_0x16100c,_0x29a69a,_0x5b9890){if(_0x16100c[_0x4aca('0x49')]['id']){delete _0x16100c[_0x4aca('0x49')]['id'];}return db[_0x4aca('0x3f')][_0x4aca('0x4d')]({'where':{'id':_0x16100c[_0x4aca('0x4b')]['id']}})[_0x4aca('0x27')](handleEntityNotFound(_0x29a69a,null))['then'](function(_0x3b1f7b){if(_0x3b1f7b){_0x16100c[_0x4aca('0x49')][_0x4aca('0x51')]=_0x3b1f7b['id'];_0x16100c[_0x4aca('0x49')][_0x4aca('0x52')]=integrations[_0x4aca('0x53')](_0x16100c['body'][_0x4aca('0x54')],_0x16100c[_0x4aca('0x49')][_0x4aca('0x3b')]);_0x16100c[_0x4aca('0x49')]['Descriptions']=integrations[_0x4aca('0x55')](_0x16100c['body'][_0x4aca('0x54')],_0x16100c['body'][_0x4aca('0x3b')]);return db[_0x4aca('0x4e')][_0x4aca('0x48')](_0x16100c[_0x4aca('0x49')],{'include':[{'model':db[_0x4aca('0x56')],'as':'Subjects'},{'model':db[_0x4aca('0x56')],'as':'Descriptions'}]});}return null;})[_0x4aca('0x27')](respondWithResult(_0x29a69a,null))[_0x4aca('0x4a')](handleError(_0x29a69a,null));};var md5=require('md5');exports[_0x4aca('0x57')]=function(_0x17609f,_0x154688,_0x4bfa8a){var _0x1311a2=null;var _0x67b73b=null;var _0x51ac31=null;var _0x56d6d5=null;var _0x4feb85='';return db[_0x4aca('0x3f')]['findOne']({'where':{'id':_0x17609f[_0x4aca('0x4b')]['id']},'attributes':['id','name',_0x4aca('0x58'),'description',_0x4aca('0x59'),_0x4aca('0x5a'),_0x4aca('0x5b'),_0x4aca('0x5c')]})[_0x4aca('0x27')](handleEntityNotFound(_0x154688,null))['then'](function(_0x3b6548){if(_0x3b6548){_0x1311a2=_0x3b6548['username'];_0x67b73b=_0x3b6548[_0x4aca('0x5c')];_0x51ac31=_0x3b6548[_0x4aca('0x59')];_0x4feb85=_0x3b6548[_0x4aca('0x5a')];var _0x4eddef=_0x4feb85[_0x4aca('0x5d')](-0x1);if(_0x4eddef==='/'){_0x4feb85=_0x4feb85['substring'](0x0,_0x4feb85['lastIndexOf'](_0x4eddef));}_0x56d6d5=util[_0x4aca('0x5e')](_0x4aca('0x5f'),_0x4feb85);var _0x3d4532={'method':_0x4aca('0x60'),'uri':_0x56d6d5,'qs':{'operation':'getchallenge','username':_0x3b6548[_0x4aca('0x58')]},'json':!![]};return rp(_0x3d4532);}})[_0x4aca('0x27')](function(_0x50a478){if(_0x50a478[_0x4aca('0x61')]){var _0x1490d2={'method':_0x4aca('0x62'),'uri':_0x56d6d5,'form':{'operation':_0x4aca('0x63'),'username':_0x1311a2,'accessKey':md5(_0x50a478[_0x4aca('0x64')][_0x4aca('0x65')]+_0x67b73b)},'json':!![]};return rp(_0x1490d2);}})['then'](function(_0x3f3b7e){if(_0x3f3b7e[_0x4aca('0x61')]){var _0x14bec3={'method':_0x4aca('0x60'),'uri':_0x56d6d5,'qs':{'operation':_0x4aca('0x66'),'username':_0x1311a2,'sessionName':_0x3f3b7e[_0x4aca('0x64')][_0x4aca('0x67')],'elementType':_0x51ac31},'json':!![]};return rp(_0x14bec3);}})['then'](function(_0xade782){if(_0xade782[_0x4aca('0x61')]){var _0x40a3f2=['autogenerated',_0x4aca('0x68'),_0x4aca('0x69')];_[_0x4aca('0x6a')](_0xade782['result'][_0x4aca('0x44')],function(_0x4941e6){return _0x40a3f2[_0x4aca('0x6b')](_0x4941e6[_0x4aca('0x3b')][_0x4aca('0x29')]);});_['remove'](_0xade782[_0x4aca('0x64')][_0x4aca('0x44')],function(_0xad526d){return _0xad526d['editable']==='false';});return{'count':_0xade782['result'][_0x4aca('0x44')][_0x4aca('0x34')],'rows':_['map'](_0xade782[_0x4aca('0x64')][_0x4aca('0x44')],function(_0x2cb548){return{'id':_0x2cb548[_0x4aca('0x29')],'name':_0x2cb548[_0x4aca('0x6c')],'custom':_[_0x4aca('0x6d')](_0x2cb548[_0x4aca('0x29')],_0x4aca('0x6e'))?!![]:![],'options':_0x2cb548['type']['name']==='picklist'&&_0x2cb548[_0x4aca('0x3b')][_0x4aca('0x6f')][_0x4aca('0x34')]>0x0?_[_0x4aca('0x2c')](_0x2cb548[_0x4aca('0x3b')][_0x4aca('0x6f')],function(_0x2418bb){return{'name':_0x2418bb['label'],'value':_0x2418bb[_0x4aca('0x70')]};}):[]};})};}})['then'](respondWithResult(_0x154688,null))[_0x4aca('0x4a')](function(_0x378bf3){console['log'](_0x4aca('0x71')+_0x378bf3);var _0x2034d6=_0x17609f['query'][_0x4aca('0x72')]?0x1f4:_0x378bf3[_0x4aca('0x73')]||0x1f4;logger[_0x4aca('0x74')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x2034d6,JSON[_0x4aca('0x75')](_0x378bf3));delete _0x378bf3[_0x4aca('0x29')];if(_0x2034d6===0x191){_0x2034d6=0x190;}_0x154688[_0x4aca('0x1c')](_0x2034d6)['send'](_0x17609f[_0x4aca('0x30')][_0x4aca('0x72')]?{'message':_0x4aca('0x76'),'statusCode':_0x378bf3['statusCode']}:_0x378bf3);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 4975e76..39c45c6 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 _0x0324=['../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','define','VtigerAccount','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x4c2d1d,_0x12978c){var _0xa8bfb9=function(_0x5e0873){while(--_0x5e0873){_0x4c2d1d['push'](_0x4c2d1d['shift']());}};_0xa8bfb9(++_0x12978c);}(_0x0324,0x1e6));var _0x4032=function(_0x143d16,_0x2bf862){_0x143d16=_0x143d16-0x0;var _0x1a143f=_0x0324[_0x143d16];return _0x1a143f;};'use strict';var _=require(_0x4032('0x0'));var util=require(_0x4032('0x1'));var logger=require(_0x4032('0x2'))('api');var moment=require(_0x4032('0x3'));var BPromise=require(_0x4032('0x4'));var rp=require(_0x4032('0x5'));var fs=require('fs');var path=require(_0x4032('0x6'));var rimraf=require(_0x4032('0x7'));var config=require(_0x4032('0x8'));var attributes=require(_0x4032('0x9'));var integrations=require(_0x4032('0xa'));module['exports']=function(_0x2f207f,_0x74d43c){return _0x2f207f[_0x4032('0xb')](_0x4032('0xc'),attributes,{'tableName':'int_vtiger_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x29e4=['VtigerAccount','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','../../components/integrations/configuration','exports','define'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x29e4,0x145));var _0x429e=function(_0x1775f9,_0x39665f){_0x1775f9=_0x1775f9-0x0;var _0x546b95=_0x29e4[_0x1775f9];return _0x546b95;};'use strict';var _=require(_0x429e('0x0'));var util=require(_0x429e('0x1'));var logger=require(_0x429e('0x2'))(_0x429e('0x3'));var moment=require(_0x429e('0x4'));var BPromise=require(_0x429e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x429e('0x6'));var config=require(_0x429e('0x7'));var attributes=require('./intVtigerAccount.attributes');var integrations=require(_0x429e('0x8'));module[_0x429e('0x9')]=function(_0x4d0dd4,_0x4f15f7){return _0x4d0dd4[_0x429e('0xa')](_0x429e('0xb'),attributes,{'tableName':'int_vtiger_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.rpc.js b/server/api/intVtigerAccount/intVtigerAccount.rpc.js index 9a6711c..8e78b8d 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 _0x8f59=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','VtigerAccount,\x20%s,\x20%s,\x20%s','error','message','result','GetVtigerAccount','VtigerAccount','findAll','options','raw','where','attributes','limit','map','include','model','then','debug','catch','ShowVtigerAccount','stringify','lodash','util','moment'];(function(_0xb66df,_0x4fb5ce){var _0x42a702=function(_0x252d1d){while(--_0x252d1d){_0xb66df['push'](_0xb66df['shift']());}};_0x42a702(++_0x4fb5ce);}(_0x8f59,0x11d));var _0x98f5=function(_0x20f050,_0x4bc6ee){_0x20f050=_0x20f050-0x0;var _0x120f93=_0x8f59[_0x20f050];return _0x120f93;};'use strict';var _=require(_0x98f5('0x0'));var util=require(_0x98f5('0x1'));var moment=require(_0x98f5('0x2'));var BPromise=require(_0x98f5('0x3'));var rs=require(_0x98f5('0x4'));var fs=require('fs');var Redis=require(_0x98f5('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x98f5('0x6'));var logger=require(_0x98f5('0x7'))(_0x98f5('0x8'));var config=require(_0x98f5('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x98f5('0xa')][_0x98f5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2e2acf,_0x5869ee,_0x5e91b3){return new BPromise(function(_0x109417,_0x1cd8a8){return client[_0x98f5('0xc')](_0x2e2acf,_0x5e91b3)['then'](function(_0x456329){logger[_0x98f5('0xd')](_0x98f5('0xe'),_0x5869ee,_0x98f5('0xf'));logger['debug'](_0x98f5('0x10'),_0x5869ee,'request\x20sent',JSON['stringify'](_0x456329));if(_0x456329[_0x98f5('0x11')]){if(_0x456329[_0x98f5('0x11')]['code']===0x1f4){logger[_0x98f5('0x11')](_0x98f5('0xe'),_0x5869ee,_0x456329[_0x98f5('0x11')][_0x98f5('0x12')]);return _0x1cd8a8(_0x456329[_0x98f5('0x11')][_0x98f5('0x12')]);}logger['error'](_0x98f5('0xe'),_0x5869ee,_0x456329[_0x98f5('0x11')]['message']);return _0x109417(_0x456329[_0x98f5('0x11')][_0x98f5('0x12')]);}else{logger[_0x98f5('0xd')]('VtigerAccount,\x20%s,\x20%s',_0x5869ee,_0x98f5('0xf'));_0x109417(_0x456329[_0x98f5('0x13')][_0x98f5('0x12')]);}})['catch'](function(_0x440cfa){logger[_0x98f5('0x11')]('VtigerAccount,\x20%s,\x20%s',_0x5869ee,_0x440cfa);_0x1cd8a8(_0x440cfa);});});}exports[_0x98f5('0x14')]=function(_0x51a567){var _0x10c57c=this;return new Promise(function(_0x9e42dd,_0x2291d5){return db[_0x98f5('0x15')][_0x98f5('0x16')]({'raw':_0x51a567[_0x98f5('0x17')]?_0x51a567['options'][_0x98f5('0x18')]===undefined?!![]:![]:!![],'where':_0x51a567['options']?_0x51a567[_0x98f5('0x17')][_0x98f5('0x19')]||null:null,'attributes':_0x51a567['options']?_0x51a567[_0x98f5('0x17')][_0x98f5('0x1a')]||null:null,'limit':_0x51a567[_0x98f5('0x17')]?_0x51a567[_0x98f5('0x17')][_0x98f5('0x1b')]||null:null,'include':_0x51a567[_0x98f5('0x17')]?_0x51a567[_0x98f5('0x17')]['include']?_[_0x98f5('0x1c')](_0x51a567['options'][_0x98f5('0x1d')],function(_0x495889){return{'model':db[_0x495889[_0x98f5('0x1e')]],'as':_0x495889['as'],'attributes':_0x495889[_0x98f5('0x1a')],'include':_0x495889[_0x98f5('0x1d')]?_[_0x98f5('0x1c')](_0x495889[_0x98f5('0x1d')],function(_0x18052d){return{'model':db[_0x18052d[_0x98f5('0x1e')]],'as':_0x18052d['as'],'attributes':_0x18052d['attributes'],'include':_0x18052d[_0x98f5('0x1d')]?_[_0x98f5('0x1c')](_0x18052d['include'],function(_0x1a1c55){return{'model':db[_0x1a1c55[_0x98f5('0x1e')]],'as':_0x1a1c55['as'],'attributes':_0x1a1c55[_0x98f5('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x98f5('0x1f')](function(_0x230d1b){logger[_0x98f5('0xd')](_0x98f5('0x14'),_0x51a567);logger[_0x98f5('0x20')]('GetVtigerAccount',_0x51a567,JSON['stringify'](_0x230d1b));_0x9e42dd(_0x230d1b);})[_0x98f5('0x21')](function(_0x71661e){logger[_0x98f5('0x11')](_0x98f5('0x14'),_0x71661e[_0x98f5('0x12')],_0x51a567);_0x2291d5(_0x10c57c[_0x98f5('0x11')](0x1f4,_0x71661e['message']));});});};exports[_0x98f5('0x22')]=function(_0x6d7418){var _0x7a922b=this;return new Promise(function(_0xd20823,_0x1e7138){return db[_0x98f5('0x15')]['find']({'raw':_0x6d7418[_0x98f5('0x17')]?_0x6d7418[_0x98f5('0x17')][_0x98f5('0x18')]===undefined?!![]:![]:!![],'where':_0x6d7418[_0x98f5('0x17')]?_0x6d7418['options'][_0x98f5('0x19')]||null:null,'attributes':_0x6d7418[_0x98f5('0x17')]?_0x6d7418[_0x98f5('0x17')][_0x98f5('0x1a')]||null:null,'include':_0x6d7418[_0x98f5('0x17')]?_0x6d7418[_0x98f5('0x17')][_0x98f5('0x1d')]?_[_0x98f5('0x1c')](_0x6d7418[_0x98f5('0x17')][_0x98f5('0x1d')],function(_0x12d874){return{'model':db[_0x12d874[_0x98f5('0x1e')]],'as':_0x12d874['as'],'attributes':_0x12d874[_0x98f5('0x1a')],'include':_0x12d874[_0x98f5('0x1d')]?_[_0x98f5('0x1c')](_0x12d874[_0x98f5('0x1d')],function(_0x2227f1){return{'model':db[_0x2227f1[_0x98f5('0x1e')]],'as':_0x2227f1['as'],'attributes':_0x2227f1[_0x98f5('0x1a')],'include':_0x2227f1[_0x98f5('0x1d')]?_['map'](_0x2227f1[_0x98f5('0x1d')],function(_0x4aba7a){return{'model':db[_0x4aba7a['model']],'as':_0x4aba7a['as'],'attributes':_0x4aba7a[_0x98f5('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x98f5('0x1f')](function(_0x65c03b){logger[_0x98f5('0xd')]('ShowVtigerAccount',_0x6d7418);logger[_0x98f5('0x20')](_0x98f5('0x22'),_0x6d7418,JSON[_0x98f5('0x23')](_0x65c03b));_0xd20823(_0x65c03b);})['catch'](function(_0x17bfe2){logger[_0x98f5('0x11')]('ShowVtigerAccount',_0x17bfe2[_0x98f5('0x12')],_0x6d7418);_0x1e7138(_0x7a922b[_0x98f5('0x11')](0x1f4,_0x17bfe2[_0x98f5('0x12')]));});});}; \ No newline at end of file +var _0x7334=['code','message','request\x20sent','result','GetVtigerAccount','findAll','options','raw','where','attributes','limit','include','map','model','VtigerAccount','find','ShowVtigerAccount','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VtigerAccount,\x20%s,\x20%s','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x7334,0x184));var _0x4733=function(_0x323df2,_0x415c2b){_0x323df2=_0x323df2-0x0;var _0x4f1bde=_0x7334[_0x323df2];return _0x4f1bde;};'use strict';var _=require(_0x4733('0x0'));var util=require(_0x4733('0x1'));var moment=require(_0x4733('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4733('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4733('0x4'));var logger=require(_0x4733('0x5'))(_0x4733('0x6'));var config=require(_0x4733('0x7'));var jayson=require(_0x4733('0x8'));var client=jayson[_0x4733('0x9')][_0x4733('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x283754,_0x12cafa,_0x43d95c){return new BPromise(function(_0x8257cf,_0x3562b7){return client[_0x4733('0xb')](_0x283754,_0x43d95c)[_0x4733('0xc')](function(_0x2d5fde){logger[_0x4733('0xd')](_0x4733('0xe'),_0x12cafa,'request\x20sent');logger[_0x4733('0xf')](_0x4733('0x10'),_0x12cafa,'request\x20sent',JSON[_0x4733('0x11')](_0x2d5fde));if(_0x2d5fde['error']){if(_0x2d5fde[_0x4733('0x12')][_0x4733('0x13')]===0x1f4){logger[_0x4733('0x12')](_0x4733('0xe'),_0x12cafa,_0x2d5fde[_0x4733('0x12')][_0x4733('0x14')]);return _0x3562b7(_0x2d5fde[_0x4733('0x12')]['message']);}logger[_0x4733('0x12')]('VtigerAccount,\x20%s,\x20%s',_0x12cafa,_0x2d5fde[_0x4733('0x12')][_0x4733('0x14')]);return _0x8257cf(_0x2d5fde[_0x4733('0x12')][_0x4733('0x14')]);}else{logger[_0x4733('0xd')](_0x4733('0xe'),_0x12cafa,_0x4733('0x15'));_0x8257cf(_0x2d5fde[_0x4733('0x16')][_0x4733('0x14')]);}})['catch'](function(_0x2c0031){logger[_0x4733('0x12')]('VtigerAccount,\x20%s,\x20%s',_0x12cafa,_0x2c0031);_0x3562b7(_0x2c0031);});});}exports[_0x4733('0x17')]=function(_0x1d2fb6){var _0x2aa223=this;return new Promise(function(_0x384e0c,_0x579f67){return db['VtigerAccount'][_0x4733('0x18')]({'raw':_0x1d2fb6[_0x4733('0x19')]?_0x1d2fb6['options'][_0x4733('0x1a')]===undefined?!![]:![]:!![],'where':_0x1d2fb6[_0x4733('0x19')]?_0x1d2fb6[_0x4733('0x19')][_0x4733('0x1b')]||null:null,'attributes':_0x1d2fb6['options']?_0x1d2fb6[_0x4733('0x19')][_0x4733('0x1c')]||null:null,'limit':_0x1d2fb6['options']?_0x1d2fb6[_0x4733('0x19')][_0x4733('0x1d')]||null:null,'include':_0x1d2fb6['options']?_0x1d2fb6[_0x4733('0x19')][_0x4733('0x1e')]?_[_0x4733('0x1f')](_0x1d2fb6[_0x4733('0x19')][_0x4733('0x1e')],function(_0x24db74){return{'model':db[_0x24db74[_0x4733('0x20')]],'as':_0x24db74['as'],'attributes':_0x24db74[_0x4733('0x1c')],'include':_0x24db74['include']?_[_0x4733('0x1f')](_0x24db74[_0x4733('0x1e')],function(_0x7884e5){return{'model':db[_0x7884e5[_0x4733('0x20')]],'as':_0x7884e5['as'],'attributes':_0x7884e5[_0x4733('0x1c')],'include':_0x7884e5[_0x4733('0x1e')]?_[_0x4733('0x1f')](_0x7884e5[_0x4733('0x1e')],function(_0x13bc12){return{'model':db[_0x13bc12[_0x4733('0x20')]],'as':_0x13bc12['as'],'attributes':_0x13bc12['attributes']};}):[]};}):[]};}):[]:[]})[_0x4733('0xc')](function(_0x4c91bc){logger['info'](_0x4733('0x17'),_0x1d2fb6);logger['debug'](_0x4733('0x17'),_0x1d2fb6,JSON['stringify'](_0x4c91bc));_0x384e0c(_0x4c91bc);})['catch'](function(_0x517c73){logger[_0x4733('0x12')](_0x4733('0x17'),_0x517c73[_0x4733('0x14')],_0x1d2fb6);_0x579f67(_0x2aa223[_0x4733('0x12')](0x1f4,_0x517c73['message']));});});};exports['ShowVtigerAccount']=function(_0x50f67e){var _0x2b2757=this;return new Promise(function(_0x56872b,_0x5a4814){return db[_0x4733('0x21')][_0x4733('0x22')]({'raw':_0x50f67e[_0x4733('0x19')]?_0x50f67e['options']['raw']===undefined?!![]:![]:!![],'where':_0x50f67e[_0x4733('0x19')]?_0x50f67e[_0x4733('0x19')][_0x4733('0x1b')]||null:null,'attributes':_0x50f67e[_0x4733('0x19')]?_0x50f67e[_0x4733('0x19')]['attributes']||null:null,'include':_0x50f67e[_0x4733('0x19')]?_0x50f67e[_0x4733('0x19')][_0x4733('0x1e')]?_[_0x4733('0x1f')](_0x50f67e[_0x4733('0x19')]['include'],function(_0x570bc6){return{'model':db[_0x570bc6[_0x4733('0x20')]],'as':_0x570bc6['as'],'attributes':_0x570bc6[_0x4733('0x1c')],'include':_0x570bc6[_0x4733('0x1e')]?_[_0x4733('0x1f')](_0x570bc6[_0x4733('0x1e')],function(_0x5e31c8){return{'model':db[_0x5e31c8[_0x4733('0x20')]],'as':_0x5e31c8['as'],'attributes':_0x5e31c8[_0x4733('0x1c')],'include':_0x5e31c8[_0x4733('0x1e')]?_['map'](_0x5e31c8[_0x4733('0x1e')],function(_0x10a5e9){return{'model':db[_0x10a5e9[_0x4733('0x20')]],'as':_0x10a5e9['as'],'attributes':_0x10a5e9[_0x4733('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x4733('0xc')](function(_0x311c1d){logger[_0x4733('0xd')](_0x4733('0x23'),_0x50f67e);logger['debug'](_0x4733('0x23'),_0x50f67e,JSON['stringify'](_0x311c1d));_0x56872b(_0x311c1d);})[_0x4733('0x24')](function(_0x29db03){logger[_0x4733('0x12')](_0x4733('0x23'),_0x29db03[_0x4733('0x14')],_0x50f67e);_0x5a4814(_0x2b2757[_0x4733('0x12')](0x1f4,_0x29db03[_0x4733('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 4c98daf..9109afa 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 _0x127f=['/:id/subjects','getSubjects','getDescriptions','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated','index','/:id','show'];(function(_0x750ef7,_0x2ecb59){var _0x291474=function(_0xb8b588){while(--_0xb8b588){_0x750ef7['push'](_0x750ef7['shift']());}};_0x291474(++_0x2ecb59);}(_0x127f,0x159));var _0xf127=function(_0x620bff,_0x448de2){_0x620bff=_0x620bff-0x0;var _0x38b188=_0x127f[_0x620bff];return _0x38b188;};'use strict';var multer=require(_0xf127('0x0'));var util=require(_0xf127('0x1'));var path=require(_0xf127('0x2'));var timeout=require(_0xf127('0x3'));var express=require('express');var router=express[_0xf127('0x4')]();var fs_extra=require(_0xf127('0x5'));var auth=require(_0xf127('0x6'));var interaction=require(_0xf127('0x7'));var config=require(_0xf127('0x8'));var controller=require(_0xf127('0x9'));router[_0xf127('0xa')]('/',auth[_0xf127('0xb')](),controller[_0xf127('0xc')]);router['get'](_0xf127('0xd'),auth[_0xf127('0xb')](),controller[_0xf127('0xe')]);router[_0xf127('0xa')]('/:id/fields',auth[_0xf127('0xb')](),controller['getFields']);router[_0xf127('0xa')](_0xf127('0xf'),auth[_0xf127('0xb')](),controller[_0xf127('0x10')]);router[_0xf127('0xa')]('/:id/descriptions',auth[_0xf127('0xb')](),controller[_0xf127('0x11')]);router[_0xf127('0x12')]('/',auth['isAuthenticated'](),controller[_0xf127('0x13')]);router[_0xf127('0x14')](_0xf127('0xd'),auth[_0xf127('0xb')](),controller['update']);router[_0xf127('0x15')](_0xf127('0xd'),auth[_0xf127('0xb')](),controller[_0xf127('0x16')]);module[_0xf127('0x17')]=router; \ No newline at end of file +var _0x0897=['create','put','delete','exports','multer','util','path','express','Router','fs-extra','../../config/environment','./intVtigerConfiguration.controller','isAuthenticated','get','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post'];(function(_0x88e558,_0x4e8960){var _0x5c2b09=function(_0x47653c){while(--_0x47653c){_0x88e558['push'](_0x88e558['shift']());}};_0x5c2b09(++_0x4e8960);}(_0x0897,0x122));var _0x7089=function(_0x3b78b2,_0x252142){_0x3b78b2=_0x3b78b2-0x0;var _0x56ec38=_0x0897[_0x3b78b2];return _0x56ec38;};'use strict';var multer=require(_0x7089('0x0'));var util=require(_0x7089('0x1'));var path=require(_0x7089('0x2'));var timeout=require('connect-timeout');var express=require(_0x7089('0x3'));var router=express[_0x7089('0x4')]();var fs_extra=require(_0x7089('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7089('0x6'));var controller=require(_0x7089('0x7'));router['get']('/',auth[_0x7089('0x8')](),controller['index']);router[_0x7089('0x9')](_0x7089('0xa'),auth['isAuthenticated'](),controller[_0x7089('0xb')]);router[_0x7089('0x9')](_0x7089('0xc'),auth[_0x7089('0x8')](),controller[_0x7089('0xd')]);router[_0x7089('0x9')](_0x7089('0xe'),auth[_0x7089('0x8')](),controller[_0x7089('0xf')]);router['get'](_0x7089('0x10'),auth[_0x7089('0x8')](),controller['getDescriptions']);router[_0x7089('0x11')]('/',auth[_0x7089('0x8')](),controller[_0x7089('0x12')]);router[_0x7089('0x13')](_0x7089('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x7089('0x14')]('/:id',auth[_0x7089('0x8')](),controller['destroy']);module[_0x7089('0x15')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index ff98882..c45372e 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 _0x6aae=['STRING','sequelize','exports'];(function(_0x220afa,_0xf5f6cc){var _0x1b79d1=function(_0x178a39){while(--_0x178a39){_0x220afa['push'](_0x220afa['shift']());}};_0x1b79d1(++_0xf5f6cc);}(_0x6aae,0x1c9));var _0xe6aa=function(_0x39b015,_0x1e2986){_0x39b015=_0x39b015-0x0;var _0x559fa4=_0x6aae[_0x39b015];return _0x559fa4;};'use strict';var Sequelize=require(_0xe6aa('0x0'));module[_0xe6aa('0x1')]={'name':{'type':Sequelize[_0xe6aa('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2191=['exports','STRING'];(function(_0x2c8342,_0x323485){var _0x1716c1=function(_0x9b14d9){while(--_0x9b14d9){_0x2c8342['push'](_0x2c8342['shift']());}};_0x1716c1(++_0x323485);}(_0x2191,0x1ec));var _0x1219=function(_0x98eff7,_0x4fa7f9){_0x98eff7=_0x98eff7-0x0;var _0x593a9=_0x2191[_0x98eff7];return _0x593a9;};'use strict';var Sequelize=require('sequelize');module[_0x1219('0x0')]={'name':{'type':Sequelize[_0x1219('0x1')]},'description':{'type':Sequelize[_0x1219('0x1')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 94e36cf..e9e5be4 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 _0xaba8=['destroy','error','stack','name','index','map','VtigerConfiguration','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','includeAll','include','findAll','catch','show','params','body','update','findOne','VtigerField','getFields','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','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','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','then'];(function(_0xa2d2c1,_0xdb5d56){var _0x164b0c=function(_0x40563b){while(--_0x40563b){_0xa2d2c1['push'](_0xa2d2c1['shift']());}};_0x164b0c(++_0xdb5d56);}(_0xaba8,0x1af));var _0x8aba=function(_0x42dd1d,_0x439075){_0x42dd1d=_0x42dd1d-0x0;var _0x4ce444=_0xaba8[_0x42dd1d];return _0x4ce444;};'use strict';var emlformat=require(_0x8aba('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8aba('0x1'));var jsonpatch=require(_0x8aba('0x2'));var rp=require(_0x8aba('0x3'));var moment=require('moment');var BPromise=require(_0x8aba('0x4'));var Mustache=require(_0x8aba('0x5'));var util=require(_0x8aba('0x6'));var path=require('path');var sox=require(_0x8aba('0x7'));var csv=require(_0x8aba('0x8'));var ejs=require(_0x8aba('0x9'));var fs=require('fs');var fs_extra=require(_0x8aba('0xa'));var _=require(_0x8aba('0xb'));var squel=require(_0x8aba('0xc'));var crypto=require(_0x8aba('0xd'));var jsforce=require(_0x8aba('0xe'));var deskjs=require(_0x8aba('0xf'));var toCsv=require(_0x8aba('0x8'));var querystring=require(_0x8aba('0x10'));var Papa=require(_0x8aba('0x11'));var Redis=require(_0x8aba('0x12'));var authService=require(_0x8aba('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x8aba('0x14'));var hardwareService=require(_0x8aba('0x15'));var logger=require('../../config/logger')(_0x8aba('0x16'));var utils=require(_0x8aba('0x17'));var config=require(_0x8aba('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x8aba('0x19'))['db'];function respondWithStatusCode(_0x5e5ead,_0x498556){_0x498556=_0x498556||0xcc;return function(_0x37688f){if(_0x37688f){return _0x5e5ead[_0x8aba('0x1a')](_0x498556);}return _0x5e5ead[_0x8aba('0x1b')](_0x498556)[_0x8aba('0x1c')]();};}function respondWithResult(_0x30c97f,_0x1da62a){_0x1da62a=_0x1da62a||0xc8;return function(_0x2e1414){if(_0x2e1414){return _0x30c97f[_0x8aba('0x1b')](_0x1da62a)[_0x8aba('0x1d')](_0x2e1414);}};}function respondWithFilteredResult(_0x5ea2db,_0x45498b){return function(_0x35ff3a){if(_0x35ff3a){var _0x59e1f9=typeof _0x45498b[_0x8aba('0x1e')]==='undefined'&&typeof _0x45498b[_0x8aba('0x1f')]===_0x8aba('0x20');var _0x4fb17b=_0x35ff3a[_0x8aba('0x21')];var _0x434bde=_0x59e1f9?0x0:_0x45498b[_0x8aba('0x1e')];var _0x14d75c=_0x59e1f9?_0x35ff3a[_0x8aba('0x21')]:_0x45498b[_0x8aba('0x1e')]+_0x45498b[_0x8aba('0x1f')];var _0x2a3190;if(_0x14d75c>=_0x4fb17b){_0x14d75c=_0x4fb17b;_0x2a3190=0xc8;}else{_0x2a3190=0xce;}_0x5ea2db['status'](_0x2a3190);return _0x5ea2db[_0x8aba('0x22')](_0x8aba('0x23'),_0x434bde+'-'+_0x14d75c+'/'+_0x4fb17b)[_0x8aba('0x1d')](_0x35ff3a);}return null;};}function patchUpdates(_0x42eda9){return function(_0xeae40d){try{jsonpatch['apply'](_0xeae40d,_0x42eda9,!![]);}catch(_0x81e64){return BPromise['reject'](_0x81e64);}return _0xeae40d['save']();};}function saveUpdates(_0x49f2b8,_0x4b62f9){return function(_0x27a181){if(_0x27a181){return _0x27a181['update'](_0x49f2b8)[_0x8aba('0x24')](function(_0x1f365e){return _0x1f365e;});}return null;};}function removeEntity(_0x389c7c,_0x255457){return function(_0x46ea78){if(_0x46ea78){return _0x46ea78[_0x8aba('0x25')]()[_0x8aba('0x24')](function(){_0x389c7c[_0x8aba('0x1b')](0xcc)[_0x8aba('0x1c')]();});}};}function handleEntityNotFound(_0x3a3161,_0x55c3ca){return function(_0x1a1c53){if(!_0x1a1c53){_0x3a3161['sendStatus'](0x194);}return _0x1a1c53;};}function handleError(_0x2b70eb,_0x220cfd){_0x220cfd=_0x220cfd||0x1f4;return function(_0x33439d){logger[_0x8aba('0x26')](_0x33439d[_0x8aba('0x27')]);if(_0x33439d[_0x8aba('0x28')]){delete _0x33439d['name'];}_0x2b70eb[_0x8aba('0x1b')](_0x220cfd)['send'](_0x33439d);};}exports[_0x8aba('0x29')]=function(_0x28be4c,_0x5c3f08){var _0x1d8755={},_0x476a90={},_0x2dc19b={'count':0x0,'rows':[]};var _0x3bc0ea=_[_0x8aba('0x2a')](db[_0x8aba('0x2b')][_0x8aba('0x2c')],function(_0x39c587){return{'name':_0x39c587[_0x8aba('0x2d')],'type':_0x39c587['type'][_0x8aba('0x2e')]};});_0x476a90[_0x8aba('0x2f')]=_[_0x8aba('0x2a')](_0x3bc0ea,_0x8aba('0x28'));_0x476a90[_0x8aba('0x30')]=_[_0x8aba('0x31')](_0x28be4c[_0x8aba('0x30')]);_0x476a90[_0x8aba('0x32')]=_[_0x8aba('0x33')](_0x476a90[_0x8aba('0x2f')],_0x476a90[_0x8aba('0x30')]);_0x1d8755[_0x8aba('0x34')]=_[_0x8aba('0x33')](_0x476a90[_0x8aba('0x2f')],qs[_0x8aba('0x35')](_0x28be4c['query'][_0x8aba('0x35')]));_0x1d8755['attributes']=_0x1d8755[_0x8aba('0x34')][_0x8aba('0x36')]?_0x1d8755[_0x8aba('0x34')]:_0x476a90['model'];if(!_0x28be4c[_0x8aba('0x30')][_0x8aba('0x37')](_0x8aba('0x38'))){_0x1d8755[_0x8aba('0x1f')]=qs['limit'](_0x28be4c[_0x8aba('0x30')]['limit']);_0x1d8755[_0x8aba('0x1e')]=qs[_0x8aba('0x1e')](_0x28be4c[_0x8aba('0x30')][_0x8aba('0x1e')]);}_0x1d8755[_0x8aba('0x39')]=qs[_0x8aba('0x3a')](_0x28be4c[_0x8aba('0x30')][_0x8aba('0x3a')]);_0x1d8755[_0x8aba('0x3b')]=qs['filters'](_[_0x8aba('0x3c')](_0x28be4c[_0x8aba('0x30')],_0x476a90[_0x8aba('0x32')]),_0x3bc0ea);if(_0x28be4c[_0x8aba('0x30')][_0x8aba('0x3d')]){_0x1d8755[_0x8aba('0x3b')]=_[_0x8aba('0x3e')](_0x1d8755['where'],{'$or':_['map'](_0x3bc0ea,function(_0xd96212){if(_0xd96212[_0x8aba('0x3f')]!=='VIRTUAL'){var _0x2fe67b={};_0x2fe67b[_0xd96212[_0x8aba('0x28')]]={'$like':'%'+_0x28be4c[_0x8aba('0x30')][_0x8aba('0x3d')]+'%'};return _0x2fe67b;}})});}_0x1d8755=_[_0x8aba('0x3e')]({},_0x1d8755,_0x28be4c[_0x8aba('0x40')]);var _0x2cddf4={'where':_0x1d8755[_0x8aba('0x3b')]};return db[_0x8aba('0x2b')]['count'](_0x2cddf4)[_0x8aba('0x24')](function(_0x279d4c){_0x2dc19b['count']=_0x279d4c;if(_0x28be4c[_0x8aba('0x30')][_0x8aba('0x41')]){_0x1d8755[_0x8aba('0x42')]=[{'all':!![]}];}return db[_0x8aba('0x2b')][_0x8aba('0x43')](_0x1d8755);})[_0x8aba('0x24')](function(_0x592861){_0x2dc19b['rows']=_0x592861;return _0x2dc19b;})[_0x8aba('0x24')](respondWithFilteredResult(_0x5c3f08,_0x1d8755))[_0x8aba('0x44')](handleError(_0x5c3f08,null));};exports[_0x8aba('0x45')]=function(_0x479364,_0x3e69ff){var _0x58be35={'raw':![],'where':{'id':_0x479364[_0x8aba('0x46')]['id']}},_0xabc2ce={};_0xabc2ce[_0x8aba('0x2f')]=_[_0x8aba('0x31')](db[_0x8aba('0x2b')][_0x8aba('0x2c')]);_0xabc2ce[_0x8aba('0x30')]=_[_0x8aba('0x31')](_0x479364[_0x8aba('0x30')]);_0xabc2ce['filters']=_[_0x8aba('0x33')](_0xabc2ce[_0x8aba('0x2f')],_0xabc2ce[_0x8aba('0x30')]);_0x58be35['attributes']=_['intersection'](_0xabc2ce[_0x8aba('0x2f')],qs[_0x8aba('0x35')](_0x479364[_0x8aba('0x30')][_0x8aba('0x35')]));_0x58be35[_0x8aba('0x34')]=_0x58be35[_0x8aba('0x34')]['length']?_0x58be35[_0x8aba('0x34')]:_0xabc2ce['model'];if(_0x479364[_0x8aba('0x30')][_0x8aba('0x41')]){_0x58be35[_0x8aba('0x42')]=[{'all':!![]}];}_0x58be35=_['merge']({},_0x58be35,_0x479364[_0x8aba('0x40')]);return db['VtigerConfiguration']['find'](_0x58be35)[_0x8aba('0x24')](handleEntityNotFound(_0x3e69ff,null))[_0x8aba('0x24')](respondWithResult(_0x3e69ff,null))[_0x8aba('0x44')](handleError(_0x3e69ff,null));};exports['create']=function(_0x29ebbf,_0x565d22){return db[_0x8aba('0x2b')]['create'](_0x29ebbf[_0x8aba('0x47')],{})['then'](respondWithResult(_0x565d22,0xc9))[_0x8aba('0x44')](handleError(_0x565d22,null));};exports[_0x8aba('0x48')]=function(_0x30b037,_0x1b2e77){if(_0x30b037[_0x8aba('0x47')]['id']){delete _0x30b037[_0x8aba('0x47')]['id'];}return db['VtigerConfiguration']['find']({'where':{'id':_0x30b037['params']['id']}})[_0x8aba('0x24')](handleEntityNotFound(_0x1b2e77,null))[_0x8aba('0x24')](saveUpdates(_0x30b037[_0x8aba('0x47')],null))[_0x8aba('0x24')](respondWithResult(_0x1b2e77,null))[_0x8aba('0x44')](handleError(_0x1b2e77,null));};exports[_0x8aba('0x25')]=function(_0xb59f57,_0x3c0c28){return db[_0x8aba('0x2b')]['find']({'where':{'id':_0xb59f57[_0x8aba('0x46')]['id']}})['then'](handleEntityNotFound(_0x3c0c28,null))[_0x8aba('0x24')](removeEntity(_0x3c0c28,null))[_0x8aba('0x44')](handleError(_0x3c0c28,null));};exports['getFields']=function(_0x8581a5,_0x42bfec,_0x4f4f4c){var _0x1fd938={};var _0x415339={};var _0x4b8643;var _0x1b0af6;return db['VtigerConfiguration'][_0x8aba('0x49')]({'where':{'id':_0x8581a5[_0x8aba('0x46')]['id']}})[_0x8aba('0x24')](handleEntityNotFound(_0x42bfec,null))['then'](function(_0x22b78c){if(_0x22b78c){_0x4b8643=_0x22b78c;_0x415339[_0x8aba('0x2f')]=_[_0x8aba('0x31')](db[_0x8aba('0x4a')][_0x8aba('0x2c')]);_0x415339[_0x8aba('0x30')]=_[_0x8aba('0x31')](_0x8581a5[_0x8aba('0x30')]);_0x415339[_0x8aba('0x32')]=_['intersection'](_0x415339[_0x8aba('0x2f')],_0x415339[_0x8aba('0x30')]);_0x1fd938[_0x8aba('0x34')]=_['intersection'](_0x415339['model'],qs['fields'](_0x8581a5[_0x8aba('0x30')]['fields']));_0x1fd938[_0x8aba('0x34')]=_0x1fd938[_0x8aba('0x34')][_0x8aba('0x36')]?_0x1fd938[_0x8aba('0x34')]:_0x415339['model'];_0x1fd938[_0x8aba('0x39')]=qs['sort'](_0x8581a5['query'][_0x8aba('0x3a')]);_0x1fd938['where']=qs[_0x8aba('0x32')](_[_0x8aba('0x3c')](_0x8581a5[_0x8aba('0x30')],_0x415339['filters']));if(_0x8581a5['query'][_0x8aba('0x3d')]){_0x1fd938[_0x8aba('0x3b')]=_[_0x8aba('0x3e')](_0x1fd938['where'],{'$or':_[_0x8aba('0x2a')](_0x1fd938[_0x8aba('0x34')],function(_0x21d043){var _0x5abf8f={};_0x5abf8f[_0x21d043]={'$like':'%'+_0x8581a5[_0x8aba('0x30')]['filter']+'%'};return _0x5abf8f;})});}_0x1fd938=_[_0x8aba('0x3e')]({},_0x1fd938,_0x8581a5[_0x8aba('0x40')]);return _0x4b8643[_0x8aba('0x4b')](_0x1fd938);}})['then'](function(_0x241e2f){if(_0x241e2f){_0x1b0af6=_0x241e2f[_0x8aba('0x36')];if(!_0x8581a5[_0x8aba('0x30')]['hasOwnProperty']('nolimit')){_0x1fd938[_0x8aba('0x1f')]=qs[_0x8aba('0x1f')](_0x8581a5[_0x8aba('0x30')][_0x8aba('0x1f')]);_0x1fd938['offset']=qs[_0x8aba('0x1e')](_0x8581a5[_0x8aba('0x30')][_0x8aba('0x1e')]);}return _0x4b8643[_0x8aba('0x4b')](_0x1fd938);}})['then'](function(_0xe78c57){if(_0xe78c57){return _0xe78c57?{'count':_0x1b0af6,'rows':_0xe78c57}:null;}})[_0x8aba('0x24')](respondWithResult(_0x42bfec,null))[_0x8aba('0x44')](handleError(_0x42bfec,null));};exports[_0x8aba('0x4c')]=function(_0x333268,_0x2d791e,_0x16b381){var _0x3ed0fd={};var _0x3d892c={};var _0x4e3880;var _0x27416d;return db[_0x8aba('0x2b')]['findOne']({'where':{'id':_0x333268[_0x8aba('0x46')]['id']}})[_0x8aba('0x24')](handleEntityNotFound(_0x2d791e,null))[_0x8aba('0x24')](function(_0xf44b2b){if(_0xf44b2b){_0x4e3880=_0xf44b2b;_0x3d892c[_0x8aba('0x2f')]=_['keys'](db[_0x8aba('0x4a')][_0x8aba('0x2c')]);_0x3d892c['query']=_[_0x8aba('0x31')](_0x333268['query']);_0x3d892c[_0x8aba('0x32')]=_[_0x8aba('0x33')](_0x3d892c['model'],_0x3d892c['query']);_0x3ed0fd['attributes']=_[_0x8aba('0x33')](_0x3d892c[_0x8aba('0x2f')],qs[_0x8aba('0x35')](_0x333268['query'][_0x8aba('0x35')]));_0x3ed0fd[_0x8aba('0x34')]=_0x3ed0fd[_0x8aba('0x34')][_0x8aba('0x36')]?_0x3ed0fd['attributes']:_0x3d892c[_0x8aba('0x2f')];_0x3ed0fd[_0x8aba('0x39')]=qs['sort'](_0x333268[_0x8aba('0x30')][_0x8aba('0x3a')]);_0x3ed0fd[_0x8aba('0x3b')]=qs['filters'](_['pick'](_0x333268[_0x8aba('0x30')],_0x3d892c[_0x8aba('0x32')]));if(_0x333268[_0x8aba('0x30')][_0x8aba('0x3d')]){_0x3ed0fd['where']=_[_0x8aba('0x3e')](_0x3ed0fd[_0x8aba('0x3b')],{'$or':_['map'](_0x3ed0fd[_0x8aba('0x34')],function(_0x3aaa4e){var _0x14ee7d={};_0x14ee7d[_0x3aaa4e]={'$like':'%'+_0x333268['query'][_0x8aba('0x3d')]+'%'};return _0x14ee7d;})});}_0x3ed0fd=_['merge']({},_0x3ed0fd,_0x333268['options']);return _0x4e3880['getSubjects'](_0x3ed0fd);}})['then'](function(_0x2e73be){if(_0x2e73be){_0x27416d=_0x2e73be[_0x8aba('0x36')];if(!_0x333268[_0x8aba('0x30')][_0x8aba('0x37')](_0x8aba('0x38'))){_0x3ed0fd[_0x8aba('0x1f')]=qs['limit'](_0x333268[_0x8aba('0x30')][_0x8aba('0x1f')]);_0x3ed0fd[_0x8aba('0x1e')]=qs[_0x8aba('0x1e')](_0x333268[_0x8aba('0x30')][_0x8aba('0x1e')]);}return _0x4e3880['getSubjects'](_0x3ed0fd);}})[_0x8aba('0x24')](function(_0x895376){if(_0x895376){return _0x895376?{'count':_0x27416d,'rows':_0x895376}:null;}})[_0x8aba('0x24')](respondWithResult(_0x2d791e,null))[_0x8aba('0x44')](handleError(_0x2d791e,null));};exports['getDescriptions']=function(_0x53dd5b,_0x413d70,_0x432ef3){var _0xfbcb69={};var _0x14812c={};var _0x114b77;var _0x1bb1f2;return db[_0x8aba('0x2b')][_0x8aba('0x49')]({'where':{'id':_0x53dd5b['params']['id']}})[_0x8aba('0x24')](handleEntityNotFound(_0x413d70,null))[_0x8aba('0x24')](function(_0x46aeab){if(_0x46aeab){_0x114b77=_0x46aeab;_0x14812c[_0x8aba('0x2f')]=_[_0x8aba('0x31')](db[_0x8aba('0x4a')][_0x8aba('0x2c')]);_0x14812c[_0x8aba('0x30')]=_[_0x8aba('0x31')](_0x53dd5b[_0x8aba('0x30')]);_0x14812c[_0x8aba('0x32')]=_[_0x8aba('0x33')](_0x14812c['model'],_0x14812c[_0x8aba('0x30')]);_0xfbcb69[_0x8aba('0x34')]=_[_0x8aba('0x33')](_0x14812c[_0x8aba('0x2f')],qs['fields'](_0x53dd5b[_0x8aba('0x30')][_0x8aba('0x35')]));_0xfbcb69['attributes']=_0xfbcb69[_0x8aba('0x34')][_0x8aba('0x36')]?_0xfbcb69['attributes']:_0x14812c[_0x8aba('0x2f')];_0xfbcb69[_0x8aba('0x39')]=qs['sort'](_0x53dd5b[_0x8aba('0x30')][_0x8aba('0x3a')]);_0xfbcb69['where']=qs[_0x8aba('0x32')](_[_0x8aba('0x3c')](_0x53dd5b[_0x8aba('0x30')],_0x14812c['filters']));if(_0x53dd5b['query'][_0x8aba('0x3d')]){_0xfbcb69[_0x8aba('0x3b')]=_[_0x8aba('0x3e')](_0xfbcb69[_0x8aba('0x3b')],{'$or':_[_0x8aba('0x2a')](_0xfbcb69[_0x8aba('0x34')],function(_0x572739){var _0x5679f6={};_0x5679f6[_0x572739]={'$like':'%'+_0x53dd5b['query'][_0x8aba('0x3d')]+'%'};return _0x5679f6;})});}_0xfbcb69=_[_0x8aba('0x3e')]({},_0xfbcb69,_0x53dd5b[_0x8aba('0x40')]);return _0x114b77[_0x8aba('0x4d')](_0xfbcb69);}})[_0x8aba('0x24')](function(_0x3ae2cb){if(_0x3ae2cb){_0x1bb1f2=_0x3ae2cb[_0x8aba('0x36')];if(!_0x53dd5b[_0x8aba('0x30')][_0x8aba('0x37')](_0x8aba('0x38'))){_0xfbcb69[_0x8aba('0x1f')]=qs[_0x8aba('0x1f')](_0x53dd5b['query'][_0x8aba('0x1f')]);_0xfbcb69[_0x8aba('0x1e')]=qs[_0x8aba('0x1e')](_0x53dd5b[_0x8aba('0x30')]['offset']);}return _0x114b77['getDescriptions'](_0xfbcb69);}})[_0x8aba('0x24')](function(_0x32e819){if(_0x32e819){return _0x32e819?{'count':_0x1bb1f2,'rows':_0x32e819}:null;}})[_0x8aba('0x24')](respondWithResult(_0x413d70,null))[_0x8aba('0x44')](handleError(_0x413d70,null));}; \ No newline at end of file +var _0xa62c=['query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','VtigerConfiguration','catch','show','params','find','create','body','getFields','VtigerField','order','findOne','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','save','update','then','destroy','end','error','name','send','index','map','rawAttributes','fieldName','type','key','model'];(function(_0x8facad,_0x216fb6){var _0x140786=function(_0xb5c668){while(--_0xb5c668){_0x8facad['push'](_0x8facad['shift']());}};_0x140786(++_0x216fb6);}(_0xa62c,0x70));var _0xca62=function(_0x277721,_0x46971e){_0x277721=_0x277721-0x0;var _0x286051=_0xa62c[_0x277721];return _0x286051;};'use strict';var emlformat=require(_0xca62('0x0'));var rimraf=require(_0xca62('0x1'));var zipdir=require(_0xca62('0x2'));var jsonpatch=require(_0xca62('0x3'));var rp=require(_0xca62('0x4'));var moment=require(_0xca62('0x5'));var BPromise=require(_0xca62('0x6'));var Mustache=require('mustache');var util=require(_0xca62('0x7'));var path=require(_0xca62('0x8'));var sox=require(_0xca62('0x9'));var csv=require(_0xca62('0xa'));var ejs=require(_0xca62('0xb'));var fs=require('fs');var fs_extra=require(_0xca62('0xc'));var _=require(_0xca62('0xd'));var squel=require(_0xca62('0xe'));var crypto=require('crypto');var jsforce=require(_0xca62('0xf'));var deskjs=require(_0xca62('0x10'));var toCsv=require(_0xca62('0xa'));var querystring=require('querystring');var Papa=require(_0xca62('0x11'));var Redis=require(_0xca62('0x12'));var authService=require(_0xca62('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xca62('0x14'));var hardwareService=require(_0xca62('0x15'));var logger=require(_0xca62('0x16'))(_0xca62('0x17'));var utils=require(_0xca62('0x18'));var config=require(_0xca62('0x19'));var licenseUtil=require(_0xca62('0x1a'));var db=require(_0xca62('0x1b'))['db'];function respondWithStatusCode(_0x2ba621,_0x59cfd8){_0x59cfd8=_0x59cfd8||0xcc;return function(_0x23a20b){if(_0x23a20b){return _0x2ba621[_0xca62('0x1c')](_0x59cfd8);}return _0x2ba621[_0xca62('0x1d')](_0x59cfd8)['end']();};}function respondWithResult(_0x4a0835,_0x5446a3){_0x5446a3=_0x5446a3||0xc8;return function(_0x307a30){if(_0x307a30){return _0x4a0835['status'](_0x5446a3)[_0xca62('0x1e')](_0x307a30);}};}function respondWithFilteredResult(_0x1634b2,_0x539a04){return function(_0x4f93fc){if(_0x4f93fc){var _0x21eae8=typeof _0x539a04[_0xca62('0x1f')]===_0xca62('0x20')&&typeof _0x539a04['limit']===_0xca62('0x20');var _0x98db4c=_0x4f93fc[_0xca62('0x21')];var _0x58d6f6=_0x21eae8?0x0:_0x539a04[_0xca62('0x1f')];var _0x34a370=_0x21eae8?_0x4f93fc[_0xca62('0x21')]:_0x539a04[_0xca62('0x1f')]+_0x539a04[_0xca62('0x22')];var _0x1b62bb;if(_0x34a370>=_0x98db4c){_0x34a370=_0x98db4c;_0x1b62bb=0xc8;}else{_0x1b62bb=0xce;}_0x1634b2[_0xca62('0x1d')](_0x1b62bb);return _0x1634b2[_0xca62('0x23')](_0xca62('0x24'),_0x58d6f6+'-'+_0x34a370+'/'+_0x98db4c)[_0xca62('0x1e')](_0x4f93fc);}return null;};}function patchUpdates(_0x133132){return function(_0x1dff07){try{jsonpatch['apply'](_0x1dff07,_0x133132,!![]);}catch(_0x4c05c2){return BPromise['reject'](_0x4c05c2);}return _0x1dff07[_0xca62('0x25')]();};}function saveUpdates(_0x138177,_0x3f2a52){return function(_0x3d4730){if(_0x3d4730){return _0x3d4730[_0xca62('0x26')](_0x138177)[_0xca62('0x27')](function(_0x364c8d){return _0x364c8d;});}return null;};}function removeEntity(_0x3eb516,_0x4b1c5a){return function(_0x486763){if(_0x486763){return _0x486763[_0xca62('0x28')]()['then'](function(){_0x3eb516[_0xca62('0x1d')](0xcc)[_0xca62('0x29')]();});}};}function handleEntityNotFound(_0x32933c,_0x3e90eb){return function(_0x20e970){if(!_0x20e970){_0x32933c[_0xca62('0x1c')](0x194);}return _0x20e970;};}function handleError(_0x4e05d4,_0x483aae){_0x483aae=_0x483aae||0x1f4;return function(_0xd03a0b){logger[_0xca62('0x2a')](_0xd03a0b['stack']);if(_0xd03a0b['name']){delete _0xd03a0b[_0xca62('0x2b')];}_0x4e05d4['status'](_0x483aae)[_0xca62('0x2c')](_0xd03a0b);};}exports[_0xca62('0x2d')]=function(_0x1ed588,_0x107187){var _0x37dd79={},_0x4e4c0c={},_0x4958d7={'count':0x0,'rows':[]};var _0x403208=_[_0xca62('0x2e')](db['VtigerConfiguration'][_0xca62('0x2f')],function(_0x2b8aee){return{'name':_0x2b8aee[_0xca62('0x30')],'type':_0x2b8aee[_0xca62('0x31')][_0xca62('0x32')]};});_0x4e4c0c[_0xca62('0x33')]=_[_0xca62('0x2e')](_0x403208,_0xca62('0x2b'));_0x4e4c0c[_0xca62('0x34')]=_[_0xca62('0x35')](_0x1ed588[_0xca62('0x34')]);_0x4e4c0c[_0xca62('0x36')]=_[_0xca62('0x37')](_0x4e4c0c[_0xca62('0x33')],_0x4e4c0c[_0xca62('0x34')]);_0x37dd79[_0xca62('0x38')]=_[_0xca62('0x37')](_0x4e4c0c[_0xca62('0x33')],qs[_0xca62('0x39')](_0x1ed588[_0xca62('0x34')]['fields']));_0x37dd79['attributes']=_0x37dd79[_0xca62('0x38')][_0xca62('0x3a')]?_0x37dd79['attributes']:_0x4e4c0c['model'];if(!_0x1ed588[_0xca62('0x34')][_0xca62('0x3b')](_0xca62('0x3c'))){_0x37dd79[_0xca62('0x22')]=qs['limit'](_0x1ed588[_0xca62('0x34')][_0xca62('0x22')]);_0x37dd79['offset']=qs['offset'](_0x1ed588['query'][_0xca62('0x1f')]);}_0x37dd79['order']=qs[_0xca62('0x3d')](_0x1ed588[_0xca62('0x34')][_0xca62('0x3d')]);_0x37dd79[_0xca62('0x3e')]=qs[_0xca62('0x36')](_[_0xca62('0x3f')](_0x1ed588[_0xca62('0x34')],_0x4e4c0c['filters']),_0x403208);if(_0x1ed588[_0xca62('0x34')][_0xca62('0x40')]){_0x37dd79[_0xca62('0x3e')]=_[_0xca62('0x41')](_0x37dd79[_0xca62('0x3e')],{'$or':_[_0xca62('0x2e')](_0x403208,function(_0x45cc1a){if(_0x45cc1a[_0xca62('0x31')]!=='VIRTUAL'){var _0xa66fa4={};_0xa66fa4[_0x45cc1a[_0xca62('0x2b')]]={'$like':'%'+_0x1ed588['query']['filter']+'%'};return _0xa66fa4;}})});}_0x37dd79=_[_0xca62('0x41')]({},_0x37dd79,_0x1ed588[_0xca62('0x42')]);var _0x14645c={'where':_0x37dd79[_0xca62('0x3e')]};return db['VtigerConfiguration'][_0xca62('0x21')](_0x14645c)[_0xca62('0x27')](function(_0x117035){_0x4958d7['count']=_0x117035;if(_0x1ed588[_0xca62('0x34')][_0xca62('0x43')]){_0x37dd79[_0xca62('0x44')]=[{'all':!![]}];}return db[_0xca62('0x45')]['findAll'](_0x37dd79);})[_0xca62('0x27')](function(_0x3fe8e4){_0x4958d7['rows']=_0x3fe8e4;return _0x4958d7;})['then'](respondWithFilteredResult(_0x107187,_0x37dd79))[_0xca62('0x46')](handleError(_0x107187,null));};exports[_0xca62('0x47')]=function(_0x19e605,_0xd80dd3){var _0x2c1132={'raw':![],'where':{'id':_0x19e605[_0xca62('0x48')]['id']}},_0x51f7f8={};_0x51f7f8['model']=_[_0xca62('0x35')](db[_0xca62('0x45')][_0xca62('0x2f')]);_0x51f7f8[_0xca62('0x34')]=_[_0xca62('0x35')](_0x19e605[_0xca62('0x34')]);_0x51f7f8['filters']=_['intersection'](_0x51f7f8['model'],_0x51f7f8[_0xca62('0x34')]);_0x2c1132[_0xca62('0x38')]=_['intersection'](_0x51f7f8[_0xca62('0x33')],qs['fields'](_0x19e605[_0xca62('0x34')][_0xca62('0x39')]));_0x2c1132[_0xca62('0x38')]=_0x2c1132['attributes']['length']?_0x2c1132[_0xca62('0x38')]:_0x51f7f8[_0xca62('0x33')];if(_0x19e605[_0xca62('0x34')]['includeAll']){_0x2c1132[_0xca62('0x44')]=[{'all':!![]}];}_0x2c1132=_['merge']({},_0x2c1132,_0x19e605[_0xca62('0x42')]);return db[_0xca62('0x45')][_0xca62('0x49')](_0x2c1132)[_0xca62('0x27')](handleEntityNotFound(_0xd80dd3,null))[_0xca62('0x27')](respondWithResult(_0xd80dd3,null))[_0xca62('0x46')](handleError(_0xd80dd3,null));};exports[_0xca62('0x4a')]=function(_0x31e256,_0x1c14aa){return db[_0xca62('0x45')][_0xca62('0x4a')](_0x31e256[_0xca62('0x4b')],{})[_0xca62('0x27')](respondWithResult(_0x1c14aa,0xc9))[_0xca62('0x46')](handleError(_0x1c14aa,null));};exports[_0xca62('0x26')]=function(_0x510330,_0x39d3bf){if(_0x510330[_0xca62('0x4b')]['id']){delete _0x510330[_0xca62('0x4b')]['id'];}return db[_0xca62('0x45')]['find']({'where':{'id':_0x510330['params']['id']}})['then'](handleEntityNotFound(_0x39d3bf,null))[_0xca62('0x27')](saveUpdates(_0x510330[_0xca62('0x4b')],null))[_0xca62('0x27')](respondWithResult(_0x39d3bf,null))[_0xca62('0x46')](handleError(_0x39d3bf,null));};exports['destroy']=function(_0xe610f2,_0x363203){return db[_0xca62('0x45')][_0xca62('0x49')]({'where':{'id':_0xe610f2[_0xca62('0x48')]['id']}})[_0xca62('0x27')](handleEntityNotFound(_0x363203,null))[_0xca62('0x27')](removeEntity(_0x363203,null))[_0xca62('0x46')](handleError(_0x363203,null));};exports[_0xca62('0x4c')]=function(_0x3f4d4b,_0x3dd4df,_0x5414c6){var _0x41a3ec={};var _0x134b10={};var _0x5cc81a;var _0x511f58;return db[_0xca62('0x45')]['findOne']({'where':{'id':_0x3f4d4b[_0xca62('0x48')]['id']}})[_0xca62('0x27')](handleEntityNotFound(_0x3dd4df,null))[_0xca62('0x27')](function(_0x52702e){if(_0x52702e){_0x5cc81a=_0x52702e;_0x134b10[_0xca62('0x33')]=_[_0xca62('0x35')](db[_0xca62('0x4d')][_0xca62('0x2f')]);_0x134b10['query']=_[_0xca62('0x35')](_0x3f4d4b[_0xca62('0x34')]);_0x134b10[_0xca62('0x36')]=_[_0xca62('0x37')](_0x134b10[_0xca62('0x33')],_0x134b10[_0xca62('0x34')]);_0x41a3ec[_0xca62('0x38')]=_[_0xca62('0x37')](_0x134b10['model'],qs[_0xca62('0x39')](_0x3f4d4b[_0xca62('0x34')]['fields']));_0x41a3ec['attributes']=_0x41a3ec['attributes']['length']?_0x41a3ec['attributes']:_0x134b10[_0xca62('0x33')];_0x41a3ec[_0xca62('0x4e')]=qs[_0xca62('0x3d')](_0x3f4d4b[_0xca62('0x34')][_0xca62('0x3d')]);_0x41a3ec[_0xca62('0x3e')]=qs['filters'](_['pick'](_0x3f4d4b[_0xca62('0x34')],_0x134b10[_0xca62('0x36')]));if(_0x3f4d4b['query'][_0xca62('0x40')]){_0x41a3ec[_0xca62('0x3e')]=_[_0xca62('0x41')](_0x41a3ec[_0xca62('0x3e')],{'$or':_[_0xca62('0x2e')](_0x41a3ec['attributes'],function(_0x28869a){var _0x1d8e13={};_0x1d8e13[_0x28869a]={'$like':'%'+_0x3f4d4b[_0xca62('0x34')][_0xca62('0x40')]+'%'};return _0x1d8e13;})});}_0x41a3ec=_['merge']({},_0x41a3ec,_0x3f4d4b[_0xca62('0x42')]);return _0x5cc81a[_0xca62('0x4c')](_0x41a3ec);}})[_0xca62('0x27')](function(_0x4ac5e0){if(_0x4ac5e0){_0x511f58=_0x4ac5e0[_0xca62('0x3a')];if(!_0x3f4d4b['query'][_0xca62('0x3b')](_0xca62('0x3c'))){_0x41a3ec[_0xca62('0x22')]=qs[_0xca62('0x22')](_0x3f4d4b[_0xca62('0x34')]['limit']);_0x41a3ec[_0xca62('0x1f')]=qs[_0xca62('0x1f')](_0x3f4d4b[_0xca62('0x34')][_0xca62('0x1f')]);}return _0x5cc81a[_0xca62('0x4c')](_0x41a3ec);}})[_0xca62('0x27')](function(_0x4f8936){if(_0x4f8936){return _0x4f8936?{'count':_0x511f58,'rows':_0x4f8936}:null;}})[_0xca62('0x27')](respondWithResult(_0x3dd4df,null))['catch'](handleError(_0x3dd4df,null));};exports['getSubjects']=function(_0xa012c9,_0x434a72,_0x5343a6){var _0x23073c={};var _0x2448f3={};var _0x3bcb83;var _0x5e51c1;return db['VtigerConfiguration'][_0xca62('0x4f')]({'where':{'id':_0xa012c9[_0xca62('0x48')]['id']}})['then'](handleEntityNotFound(_0x434a72,null))['then'](function(_0x3e1cd4){if(_0x3e1cd4){_0x3bcb83=_0x3e1cd4;_0x2448f3[_0xca62('0x33')]=_[_0xca62('0x35')](db['VtigerField'][_0xca62('0x2f')]);_0x2448f3[_0xca62('0x34')]=_[_0xca62('0x35')](_0xa012c9[_0xca62('0x34')]);_0x2448f3[_0xca62('0x36')]=_[_0xca62('0x37')](_0x2448f3[_0xca62('0x33')],_0x2448f3[_0xca62('0x34')]);_0x23073c[_0xca62('0x38')]=_[_0xca62('0x37')](_0x2448f3['model'],qs[_0xca62('0x39')](_0xa012c9[_0xca62('0x34')]['fields']));_0x23073c[_0xca62('0x38')]=_0x23073c[_0xca62('0x38')][_0xca62('0x3a')]?_0x23073c[_0xca62('0x38')]:_0x2448f3['model'];_0x23073c[_0xca62('0x4e')]=qs[_0xca62('0x3d')](_0xa012c9[_0xca62('0x34')][_0xca62('0x3d')]);_0x23073c['where']=qs[_0xca62('0x36')](_[_0xca62('0x3f')](_0xa012c9[_0xca62('0x34')],_0x2448f3[_0xca62('0x36')]));if(_0xa012c9[_0xca62('0x34')][_0xca62('0x40')]){_0x23073c[_0xca62('0x3e')]=_[_0xca62('0x41')](_0x23073c[_0xca62('0x3e')],{'$or':_[_0xca62('0x2e')](_0x23073c[_0xca62('0x38')],function(_0x134691){var _0x8026f6={};_0x8026f6[_0x134691]={'$like':'%'+_0xa012c9[_0xca62('0x34')]['filter']+'%'};return _0x8026f6;})});}_0x23073c=_[_0xca62('0x41')]({},_0x23073c,_0xa012c9[_0xca62('0x42')]);return _0x3bcb83[_0xca62('0x50')](_0x23073c);}})['then'](function(_0x1a70d6){if(_0x1a70d6){_0x5e51c1=_0x1a70d6[_0xca62('0x3a')];if(!_0xa012c9[_0xca62('0x34')]['hasOwnProperty'](_0xca62('0x3c'))){_0x23073c[_0xca62('0x22')]=qs[_0xca62('0x22')](_0xa012c9['query'][_0xca62('0x22')]);_0x23073c[_0xca62('0x1f')]=qs[_0xca62('0x1f')](_0xa012c9[_0xca62('0x34')]['offset']);}return _0x3bcb83[_0xca62('0x50')](_0x23073c);}})[_0xca62('0x27')](function(_0x2c2db1){if(_0x2c2db1){return _0x2c2db1?{'count':_0x5e51c1,'rows':_0x2c2db1}:null;}})[_0xca62('0x27')](respondWithResult(_0x434a72,null))[_0xca62('0x46')](handleError(_0x434a72,null));};exports[_0xca62('0x51')]=function(_0x5f135b,_0x35ebd0,_0x10a9b2){var _0x5cf845={};var _0x92be6f={};var _0x3d0e8b;var _0x319650;return db['VtigerConfiguration'][_0xca62('0x4f')]({'where':{'id':_0x5f135b[_0xca62('0x48')]['id']}})[_0xca62('0x27')](handleEntityNotFound(_0x35ebd0,null))[_0xca62('0x27')](function(_0x5c18e1){if(_0x5c18e1){_0x3d0e8b=_0x5c18e1;_0x92be6f[_0xca62('0x33')]=_[_0xca62('0x35')](db[_0xca62('0x4d')][_0xca62('0x2f')]);_0x92be6f['query']=_[_0xca62('0x35')](_0x5f135b[_0xca62('0x34')]);_0x92be6f[_0xca62('0x36')]=_['intersection'](_0x92be6f[_0xca62('0x33')],_0x92be6f['query']);_0x5cf845[_0xca62('0x38')]=_[_0xca62('0x37')](_0x92be6f[_0xca62('0x33')],qs['fields'](_0x5f135b[_0xca62('0x34')][_0xca62('0x39')]));_0x5cf845[_0xca62('0x38')]=_0x5cf845[_0xca62('0x38')][_0xca62('0x3a')]?_0x5cf845[_0xca62('0x38')]:_0x92be6f[_0xca62('0x33')];_0x5cf845['order']=qs['sort'](_0x5f135b[_0xca62('0x34')]['sort']);_0x5cf845['where']=qs['filters'](_['pick'](_0x5f135b[_0xca62('0x34')],_0x92be6f['filters']));if(_0x5f135b[_0xca62('0x34')][_0xca62('0x40')]){_0x5cf845[_0xca62('0x3e')]=_[_0xca62('0x41')](_0x5cf845['where'],{'$or':_[_0xca62('0x2e')](_0x5cf845['attributes'],function(_0x52fb8b){var _0x3c79f7={};_0x3c79f7[_0x52fb8b]={'$like':'%'+_0x5f135b[_0xca62('0x34')]['filter']+'%'};return _0x3c79f7;})});}_0x5cf845=_[_0xca62('0x41')]({},_0x5cf845,_0x5f135b['options']);return _0x3d0e8b[_0xca62('0x51')](_0x5cf845);}})[_0xca62('0x27')](function(_0x194d3f){if(_0x194d3f){_0x319650=_0x194d3f['length'];if(!_0x5f135b[_0xca62('0x34')][_0xca62('0x3b')](_0xca62('0x3c'))){_0x5cf845[_0xca62('0x22')]=qs[_0xca62('0x22')](_0x5f135b[_0xca62('0x34')][_0xca62('0x22')]);_0x5cf845[_0xca62('0x1f')]=qs[_0xca62('0x1f')](_0x5f135b[_0xca62('0x34')][_0xca62('0x1f')]);}return _0x3d0e8b['getDescriptions'](_0x5cf845);}})['then'](function(_0x1109ed){if(_0x1109ed){return _0x1109ed?{'count':_0x319650,'rows':_0x1109ed}:null;}})[_0xca62('0x27')](respondWithResult(_0x35ebd0,null))[_0xca62('0x46')](handleError(_0x35ebd0,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 7fbb7ea..a9e5220 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 _0xa075=['define','VtigerConfiguration','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intVtigerConfiguration.attributes'];(function(_0x452c06,_0x2d6a45){var _0x3c4e54=function(_0x4ad95c){while(--_0x4ad95c){_0x452c06['push'](_0x452c06['shift']());}};_0x3c4e54(++_0x2d6a45);}(_0xa075,0xad));var _0x5a07=function(_0x5bc144,_0x285275){_0x5bc144=_0x5bc144-0x0;var _0x184193=_0xa075[_0x5bc144];return _0x184193;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x5a07('0x0'));var moment=require(_0x5a07('0x1'));var BPromise=require(_0x5a07('0x2'));var rp=require(_0x5a07('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5a07('0x4'));var config=require(_0x5a07('0x5'));var attributes=require(_0x5a07('0x6'));module['exports']=function(_0x1f6688,_0x4b1a84){return _0x1f6688[_0x5a07('0x7')](_0x5a07('0x8'),attributes,{'tableName':'int_vtiger_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdbc5=['lodash','api','moment','bluebird','rimraf','../../config/environment','./intVtigerConfiguration.attributes','exports','VtigerConfiguration','int_vtiger_configurations'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xdbc5,0x1b8));var _0x5dbc=function(_0x3c9d1c,_0x5e0e35){_0x3c9d1c=_0x3c9d1c-0x0;var _0x5a0ba1=_0xdbc5[_0x3c9d1c];return _0x5a0ba1;};'use strict';var _=require(_0x5dbc('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5dbc('0x1'));var moment=require(_0x5dbc('0x2'));var BPromise=require(_0x5dbc('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5dbc('0x4'));var config=require(_0x5dbc('0x5'));var attributes=require(_0x5dbc('0x6'));module[_0x5dbc('0x7')]=function(_0x195f35,_0x35ac6a){return _0x195f35['define'](_0x5dbc('0x8'),attributes,{'tableName':_0x5dbc('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js index a67993c..e68b9d7 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 _0x99ed=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','VtigerConfiguration,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','moment'];(function(_0x525d78,_0x14175d){var _0x4c203d=function(_0x45d4f4){while(--_0x45d4f4){_0x525d78['push'](_0x525d78['shift']());}};_0x4c203d(++_0x14175d);}(_0x99ed,0x175));var _0xd99e=function(_0x187e17,_0x5e67da){_0x187e17=_0x187e17-0x0;var _0x15db9d=_0x99ed[_0x187e17];return _0x15db9d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd99e('0x0'));var BPromise=require(_0xd99e('0x1'));var rs=require(_0xd99e('0x2'));var fs=require('fs');var Redis=require(_0xd99e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xd99e('0x4'));var logger=require(_0xd99e('0x5'))(_0xd99e('0x6'));var config=require('../../config/environment');var jayson=require(_0xd99e('0x7'));var client=jayson[_0xd99e('0x8')][_0xd99e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x26995f,_0x54d110,_0x494eb7){return new BPromise(function(_0x3853f1,_0x56b02d){return client[_0xd99e('0xa')](_0x26995f,_0x494eb7)[_0xd99e('0xb')](function(_0x58f75a){logger[_0xd99e('0xc')](_0xd99e('0xd'),_0x54d110,'request\x20sent');logger[_0xd99e('0xe')]('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x54d110,_0xd99e('0xf'),JSON[_0xd99e('0x10')](_0x58f75a));if(_0x58f75a[_0xd99e('0x11')]){if(_0x58f75a[_0xd99e('0x11')][_0xd99e('0x12')]===0x1f4){logger[_0xd99e('0x11')]('VtigerConfiguration,\x20%s,\x20%s',_0x54d110,_0x58f75a[_0xd99e('0x11')][_0xd99e('0x13')]);return _0x56b02d(_0x58f75a['error'][_0xd99e('0x13')]);}logger[_0xd99e('0x11')](_0xd99e('0xd'),_0x54d110,_0x58f75a[_0xd99e('0x11')][_0xd99e('0x13')]);return _0x3853f1(_0x58f75a[_0xd99e('0x11')][_0xd99e('0x13')]);}else{logger[_0xd99e('0xc')]('VtigerConfiguration,\x20%s,\x20%s',_0x54d110,_0xd99e('0xf'));_0x3853f1(_0x58f75a[_0xd99e('0x14')][_0xd99e('0x13')]);}})[_0xd99e('0x15')](function(_0x45fa08){logger[_0xd99e('0x11')](_0xd99e('0xd'),_0x54d110,_0x45fa08);_0x56b02d(_0x45fa08);});});} \ No newline at end of file +var _0xcf47=['ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','randomstring'];(function(_0x48f128,_0x1c17a9){var _0x4cba68=function(_0x3f9d0b){while(--_0x3f9d0b){_0x48f128['push'](_0x48f128['shift']());}};_0x4cba68(++_0x1c17a9);}(_0xcf47,0x1df));var _0x7cf4=function(_0xe9cf54,_0x1a1855){_0xe9cf54=_0xe9cf54-0x0;var _0x142fc5=_0xcf47[_0xe9cf54];return _0x142fc5;};'use strict';var _=require(_0x7cf4('0x0'));var util=require(_0x7cf4('0x1'));var moment=require(_0x7cf4('0x2'));var BPromise=require('bluebird');var rs=require(_0x7cf4('0x3'));var fs=require('fs');var Redis=require(_0x7cf4('0x4'));var db=require(_0x7cf4('0x5'))['db'];var utils=require(_0x7cf4('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x7cf4('0x7'));var jayson=require(_0x7cf4('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3b3ae9,_0x9892ba,_0x174d4c){return new BPromise(function(_0x544799,_0x208267){return client[_0x7cf4('0x9')](_0x3b3ae9,_0x174d4c)[_0x7cf4('0xa')](function(_0x17f6db){logger[_0x7cf4('0xb')](_0x7cf4('0xc'),_0x9892ba,_0x7cf4('0xd'));logger[_0x7cf4('0xe')](_0x7cf4('0xf'),_0x9892ba,_0x7cf4('0xd'),JSON[_0x7cf4('0x10')](_0x17f6db));if(_0x17f6db['error']){if(_0x17f6db[_0x7cf4('0x11')]['code']===0x1f4){logger[_0x7cf4('0x11')](_0x7cf4('0xc'),_0x9892ba,_0x17f6db[_0x7cf4('0x11')][_0x7cf4('0x12')]);return _0x208267(_0x17f6db['error'][_0x7cf4('0x12')]);}logger[_0x7cf4('0x11')](_0x7cf4('0xc'),_0x9892ba,_0x17f6db['error'][_0x7cf4('0x12')]);return _0x544799(_0x17f6db['error'][_0x7cf4('0x12')]);}else{logger['info'](_0x7cf4('0xc'),_0x9892ba,'request\x20sent');_0x544799(_0x17f6db[_0x7cf4('0x13')][_0x7cf4('0x12')]);}})[_0x7cf4('0x14')](function(_0x5e23c5){logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x9892ba,_0x5e23c5);_0x208267(_0x5e23c5);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index c3dd5f8..08c145f 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 _0x75b5=['update','delete','destroy','exports','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get','isAuthenticated','index','show','post','create','put','/:id'];(function(_0x48eab4,_0x277c00){var _0xae2e9e=function(_0x590f1c){while(--_0x590f1c){_0x48eab4['push'](_0x48eab4['shift']());}};_0xae2e9e(++_0x277c00);}(_0x75b5,0xe8));var _0x575b=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0x75b5[_0x187ee1];return _0x388160;};'use strict';var multer=require('multer');var util=require(_0x575b('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x575b('0x1'));var router=express[_0x575b('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x575b('0x3'));var interaction=require(_0x575b('0x4'));var config=require(_0x575b('0x5'));var controller=require(_0x575b('0x6'));router[_0x575b('0x7')]('/',auth[_0x575b('0x8')](),controller[_0x575b('0x9')]);router[_0x575b('0x7')]('/:id',auth[_0x575b('0x8')](),controller[_0x575b('0xa')]);router[_0x575b('0xb')]('/',auth['isAuthenticated'](),controller[_0x575b('0xc')]);router[_0x575b('0xd')](_0x575b('0xe'),auth[_0x575b('0x8')](),controller[_0x575b('0xf')]);router[_0x575b('0x10')](_0x575b('0xe'),auth[_0x575b('0x8')](),controller[_0x575b('0x11')]);module[_0x575b('0x12')]=router; \ No newline at end of file +var _0xe515=['./intVtigerField.controller','isAuthenticated','index','get','show','post','create','put','/:id','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x194525,_0x4ec962){var _0x2c7b77=function(_0x3a3a70){while(--_0x3a3a70){_0x194525['push'](_0x194525['shift']());}};_0x2c7b77(++_0x4ec962);}(_0xe515,0xab));var _0x5e51=function(_0x3d8e70,_0x1a49c0){_0x3d8e70=_0x3d8e70-0x0;var _0x4fb9ea=_0xe515[_0x3d8e70];return _0x4fb9ea;};'use strict';var multer=require(_0x5e51('0x0'));var util=require(_0x5e51('0x1'));var path=require('path');var timeout=require(_0x5e51('0x2'));var express=require(_0x5e51('0x3'));var router=express[_0x5e51('0x4')]();var fs_extra=require(_0x5e51('0x5'));var auth=require(_0x5e51('0x6'));var interaction=require(_0x5e51('0x7'));var config=require(_0x5e51('0x8'));var controller=require(_0x5e51('0x9'));router['get']('/',auth[_0x5e51('0xa')](),controller[_0x5e51('0xb')]);router[_0x5e51('0xc')]('/:id',auth[_0x5e51('0xa')](),controller[_0x5e51('0xd')]);router[_0x5e51('0xe')]('/',auth['isAuthenticated'](),controller[_0x5e51('0xf')]);router[_0x5e51('0x10')](_0x5e51('0x11'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x5e51('0x11'),auth[_0x5e51('0xa')](),controller[_0x5e51('0x12')]);module[_0x5e51('0x13')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index d00e5db..4dd721f 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 _0xeb2f=['variable','customVariable','keyValue','STRING','BOOLEAN','sequelize','exports','ENUM','string'];(function(_0x432fca,_0xb0b1b5){var _0x3adba4=function(_0x5e3ae4){while(--_0x5e3ae4){_0x432fca['push'](_0x432fca['shift']());}};_0x3adba4(++_0xb0b1b5);}(_0xeb2f,0x125));var _0xfeb2=function(_0x172660,_0x260d9b){_0x172660=_0x172660-0x0;var _0x83204f=_0xeb2f[_0x172660];return _0x83204f;};'use strict';var Sequelize=require(_0xfeb2('0x0'));module[_0xfeb2('0x1')]={'type':{'type':Sequelize[_0xfeb2('0x2')](_0xfeb2('0x3'),_0xfeb2('0x4'),_0xfeb2('0x5'),_0xfeb2('0x6'),'picklist'),'defaultValue':_0xfeb2('0x3')},'content':{'type':Sequelize[_0xfeb2('0x7')]},'key':{'type':Sequelize[_0xfeb2('0x7')]},'keyType':{'type':Sequelize[_0xfeb2('0x2')](_0xfeb2('0x3'),_0xfeb2('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0xfeb2('0x7')]},'idField':{'type':Sequelize[_0xfeb2('0x7')]},'nameField':{'type':Sequelize[_0xfeb2('0x7')]},'customField':{'type':Sequelize[_0xfeb2('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xfeb2('0x7')]}}; \ No newline at end of file +var _0x486a=['ENUM','variable','customVariable','picklist','string','STRING','BOOLEAN','sequelize','exports'];(function(_0x4f28e1,_0x14f715){var _0x5bb911=function(_0x3e5546){while(--_0x3e5546){_0x4f28e1['push'](_0x4f28e1['shift']());}};_0x5bb911(++_0x14f715);}(_0x486a,0x16f));var _0xa486=function(_0x55c3d9,_0x3bf75c){_0x55c3d9=_0x55c3d9-0x0;var _0x19fd97=_0x486a[_0x55c3d9];return _0x19fd97;};'use strict';var Sequelize=require(_0xa486('0x0'));module[_0xa486('0x1')]={'type':{'type':Sequelize[_0xa486('0x2')]('string',_0xa486('0x3'),_0xa486('0x4'),'keyValue',_0xa486('0x5')),'defaultValue':_0xa486('0x6')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xa486('0x2')]('string',_0xa486('0x3'),_0xa486('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xa486('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xa486('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 9c8104c..0f80656 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 _0x3a74=['count','apply','reject','save','then','destroy','end','error','stack','VtigerField','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','map','VIRTUAL','name','options','includeAll','include','findAll','show','params','keys','fields','find','catch','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','offset','undefined','limit'];(function(_0x3b9703,_0x4ec964){var _0x1bb1cb=function(_0x24622){while(--_0x24622){_0x3b9703['push'](_0x3b9703['shift']());}};_0x1bb1cb(++_0x4ec964);}(_0x3a74,0x198));var _0x43a7=function(_0x264194,_0x48ee77){_0x264194=_0x264194-0x0;var _0x584be0=_0x3a74[_0x264194];return _0x584be0;};'use strict';var emlformat=require(_0x43a7('0x0'));var rimraf=require(_0x43a7('0x1'));var zipdir=require(_0x43a7('0x2'));var jsonpatch=require(_0x43a7('0x3'));var rp=require('request-promise');var moment=require(_0x43a7('0x4'));var BPromise=require(_0x43a7('0x5'));var Mustache=require('mustache');var util=require(_0x43a7('0x6'));var path=require(_0x43a7('0x7'));var sox=require(_0x43a7('0x8'));var csv=require('to-csv');var ejs=require(_0x43a7('0x9'));var fs=require('fs');var fs_extra=require(_0x43a7('0xa'));var _=require(_0x43a7('0xb'));var squel=require(_0x43a7('0xc'));var crypto=require('crypto');var jsforce=require(_0x43a7('0xd'));var deskjs=require(_0x43a7('0xe'));var toCsv=require(_0x43a7('0xf'));var querystring=require(_0x43a7('0x10'));var Papa=require(_0x43a7('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x43a7('0x12'));var as=require(_0x43a7('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x43a7('0x14'))(_0x43a7('0x15'));var utils=require(_0x43a7('0x16'));var config=require(_0x43a7('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x404686,_0x44fa22){_0x44fa22=_0x44fa22||0xcc;return function(_0x4d80db){if(_0x4d80db){return _0x404686[_0x43a7('0x18')](_0x44fa22);}return _0x404686[_0x43a7('0x19')](_0x44fa22)['end']();};}function respondWithResult(_0x32fbe8,_0x4ef432){_0x4ef432=_0x4ef432||0xc8;return function(_0x4a5e38){if(_0x4a5e38){return _0x32fbe8['status'](_0x4ef432)[_0x43a7('0x1a')](_0x4a5e38);}};}function respondWithFilteredResult(_0x194924,_0x2da1b2){return function(_0x3c7871){if(_0x3c7871){var _0x46d039=typeof _0x2da1b2[_0x43a7('0x1b')]===_0x43a7('0x1c')&&typeof _0x2da1b2[_0x43a7('0x1d')]===_0x43a7('0x1c');var _0x28e02e=_0x3c7871[_0x43a7('0x1e')];var _0x56441a=_0x46d039?0x0:_0x2da1b2[_0x43a7('0x1b')];var _0x260e5d=_0x46d039?_0x3c7871[_0x43a7('0x1e')]:_0x2da1b2[_0x43a7('0x1b')]+_0x2da1b2[_0x43a7('0x1d')];var _0x13896b;if(_0x260e5d>=_0x28e02e){_0x260e5d=_0x28e02e;_0x13896b=0xc8;}else{_0x13896b=0xce;}_0x194924[_0x43a7('0x19')](_0x13896b);return _0x194924['set']('Content-Range',_0x56441a+'-'+_0x260e5d+'/'+_0x28e02e)[_0x43a7('0x1a')](_0x3c7871);}return null;};}function patchUpdates(_0x4c326d){return function(_0x3c1eff){try{jsonpatch[_0x43a7('0x1f')](_0x3c1eff,_0x4c326d,!![]);}catch(_0x50b577){return BPromise[_0x43a7('0x20')](_0x50b577);}return _0x3c1eff[_0x43a7('0x21')]();};}function saveUpdates(_0x40a263,_0x59f517){return function(_0x481667){if(_0x481667){return _0x481667['update'](_0x40a263)[_0x43a7('0x22')](function(_0x3d8c6e){return _0x3d8c6e;});}return null;};}function removeEntity(_0xdc6ab4,_0x4cc402){return function(_0x773acf){if(_0x773acf){return _0x773acf[_0x43a7('0x23')]()[_0x43a7('0x22')](function(){_0xdc6ab4[_0x43a7('0x19')](0xcc)[_0x43a7('0x24')]();});}};}function handleEntityNotFound(_0x486975,_0x185326){return function(_0x3bc73d){if(!_0x3bc73d){_0x486975['sendStatus'](0x194);}return _0x3bc73d;};}function handleError(_0x3b561d,_0x3c98bc){_0x3c98bc=_0x3c98bc||0x1f4;return function(_0x176cfc){logger[_0x43a7('0x25')](_0x176cfc[_0x43a7('0x26')]);if(_0x176cfc['name']){delete _0x176cfc['name'];}_0x3b561d[_0x43a7('0x19')](_0x3c98bc)['send'](_0x176cfc);};}exports['index']=function(_0x1deddd,_0xbb56f2){var _0x41047e={},_0x68310={},_0x1379af={'count':0x0,'rows':[]};var _0x51d69e=_['map'](db[_0x43a7('0x27')][_0x43a7('0x28')],function(_0x1de5ac){return{'name':_0x1de5ac[_0x43a7('0x29')],'type':_0x1de5ac[_0x43a7('0x2a')][_0x43a7('0x2b')]};});_0x68310[_0x43a7('0x2c')]=_['map'](_0x51d69e,'name');_0x68310[_0x43a7('0x2d')]=_['keys'](_0x1deddd['query']);_0x68310[_0x43a7('0x2e')]=_[_0x43a7('0x2f')](_0x68310['model'],_0x68310['query']);_0x41047e['attributes']=_[_0x43a7('0x2f')](_0x68310[_0x43a7('0x2c')],qs['fields'](_0x1deddd[_0x43a7('0x2d')]['fields']));_0x41047e[_0x43a7('0x30')]=_0x41047e[_0x43a7('0x30')][_0x43a7('0x31')]?_0x41047e['attributes']:_0x68310[_0x43a7('0x2c')];if(!_0x1deddd[_0x43a7('0x2d')][_0x43a7('0x32')](_0x43a7('0x33'))){_0x41047e[_0x43a7('0x1d')]=qs[_0x43a7('0x1d')](_0x1deddd[_0x43a7('0x2d')][_0x43a7('0x1d')]);_0x41047e[_0x43a7('0x1b')]=qs[_0x43a7('0x1b')](_0x1deddd['query'][_0x43a7('0x1b')]);}_0x41047e[_0x43a7('0x34')]=qs[_0x43a7('0x35')](_0x1deddd[_0x43a7('0x2d')][_0x43a7('0x35')]);_0x41047e[_0x43a7('0x36')]=qs['filters'](_['pick'](_0x1deddd[_0x43a7('0x2d')],_0x68310[_0x43a7('0x2e')]),_0x51d69e);if(_0x1deddd[_0x43a7('0x2d')][_0x43a7('0x37')]){_0x41047e[_0x43a7('0x36')]=_[_0x43a7('0x38')](_0x41047e[_0x43a7('0x36')],{'$or':_[_0x43a7('0x39')](_0x51d69e,function(_0x47e8d2){if(_0x47e8d2[_0x43a7('0x2a')]!==_0x43a7('0x3a')){var _0x29c997={};_0x29c997[_0x47e8d2[_0x43a7('0x3b')]]={'$like':'%'+_0x1deddd[_0x43a7('0x2d')]['filter']+'%'};return _0x29c997;}})});}_0x41047e=_['merge']({},_0x41047e,_0x1deddd[_0x43a7('0x3c')]);var _0xc4445d={'where':_0x41047e[_0x43a7('0x36')]};return db[_0x43a7('0x27')]['count'](_0xc4445d)['then'](function(_0x4cb7bd){_0x1379af[_0x43a7('0x1e')]=_0x4cb7bd;if(_0x1deddd[_0x43a7('0x2d')][_0x43a7('0x3d')]){_0x41047e[_0x43a7('0x3e')]=[{'all':!![]}];}return db[_0x43a7('0x27')][_0x43a7('0x3f')](_0x41047e);})['then'](function(_0x952b8f){_0x1379af['rows']=_0x952b8f;return _0x1379af;})[_0x43a7('0x22')](respondWithFilteredResult(_0xbb56f2,_0x41047e))['catch'](handleError(_0xbb56f2,null));};exports[_0x43a7('0x40')]=function(_0x4628c1,_0x3ac1f6){var _0x564550={'raw':!![],'where':{'id':_0x4628c1[_0x43a7('0x41')]['id']}},_0x2a321e={};_0x2a321e[_0x43a7('0x2c')]=_[_0x43a7('0x42')](db['VtigerField'][_0x43a7('0x28')]);_0x2a321e[_0x43a7('0x2d')]=_[_0x43a7('0x42')](_0x4628c1[_0x43a7('0x2d')]);_0x2a321e['filters']=_[_0x43a7('0x2f')](_0x2a321e[_0x43a7('0x2c')],_0x2a321e[_0x43a7('0x2d')]);_0x564550[_0x43a7('0x30')]=_[_0x43a7('0x2f')](_0x2a321e['model'],qs[_0x43a7('0x43')](_0x4628c1[_0x43a7('0x2d')][_0x43a7('0x43')]));_0x564550['attributes']=_0x564550['attributes'][_0x43a7('0x31')]?_0x564550[_0x43a7('0x30')]:_0x2a321e['model'];if(_0x4628c1[_0x43a7('0x2d')][_0x43a7('0x3d')]){_0x564550[_0x43a7('0x3e')]=[{'all':!![]}];}_0x564550=_[_0x43a7('0x38')]({},_0x564550,_0x4628c1['options']);return db['VtigerField'][_0x43a7('0x44')](_0x564550)[_0x43a7('0x22')](handleEntityNotFound(_0x3ac1f6,null))[_0x43a7('0x22')](respondWithResult(_0x3ac1f6,null))[_0x43a7('0x45')](handleError(_0x3ac1f6,null));};exports[_0x43a7('0x46')]=function(_0x51810f,_0x26791c){return db['VtigerField'][_0x43a7('0x46')](_0x51810f[_0x43a7('0x47')],{})[_0x43a7('0x22')](respondWithResult(_0x26791c,0xc9))[_0x43a7('0x45')](handleError(_0x26791c,null));};exports[_0x43a7('0x48')]=function(_0x551ece,_0x52a890){if(_0x551ece[_0x43a7('0x47')]['id']){delete _0x551ece[_0x43a7('0x47')]['id'];}return db['VtigerField'][_0x43a7('0x44')]({'where':{'id':_0x551ece[_0x43a7('0x41')]['id']}})['then'](handleEntityNotFound(_0x52a890,null))['then'](saveUpdates(_0x551ece[_0x43a7('0x47')],null))[_0x43a7('0x22')](respondWithResult(_0x52a890,null))[_0x43a7('0x45')](handleError(_0x52a890,null));};exports[_0x43a7('0x23')]=function(_0x2825ea,_0x2ff05c){return db['VtigerField'][_0x43a7('0x44')]({'where':{'id':_0x2825ea[_0x43a7('0x41')]['id']}})[_0x43a7('0x22')](handleEntityNotFound(_0x2ff05c,null))[_0x43a7('0x22')](removeEntity(_0x2ff05c,null))[_0x43a7('0x45')](handleError(_0x2ff05c,null));}; \ No newline at end of file +var _0xc997=['Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','map','type','key','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','VtigerField','findAll','rows','catch','show','keys','create','body','find','params','rimraf','zip-dir','fast-json-patch','moment','util','path','sox','ejs','fs-extra','lodash','squel','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','sendStatus','end','status','undefined','count','offset','set'];(function(_0x4512b8,_0x4eea21){var _0x5c84cb=function(_0x523481){while(--_0x523481){_0x4512b8['push'](_0x4512b8['shift']());}};_0x5c84cb(++_0x4eea21);}(_0xc997,0x114));var _0x7c99=function(_0x9df8e0,_0x6e9a51){_0x9df8e0=_0x9df8e0-0x0;var _0x2fe4ff=_0xc997[_0x9df8e0];return _0x2fe4ff;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7c99('0x0'));var zipdir=require(_0x7c99('0x1'));var jsonpatch=require(_0x7c99('0x2'));var rp=require('request-promise');var moment=require(_0x7c99('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7c99('0x4'));var path=require(_0x7c99('0x5'));var sox=require(_0x7c99('0x6'));var csv=require('to-csv');var ejs=require(_0x7c99('0x7'));var fs=require('fs');var fs_extra=require(_0x7c99('0x8'));var _=require(_0x7c99('0x9'));var squel=require(_0x7c99('0xa'));var crypto=require('crypto');var jsforce=require(_0x7c99('0xb'));var deskjs=require(_0x7c99('0xc'));var toCsv=require('to-csv');var querystring=require(_0x7c99('0xd'));var Papa=require(_0x7c99('0xe'));var Redis=require(_0x7c99('0xf'));var authService=require(_0x7c99('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x7c99('0x11'));var hardwareService=require(_0x7c99('0x12'));var logger=require(_0x7c99('0x13'))(_0x7c99('0x14'));var utils=require(_0x7c99('0x15'));var config=require(_0x7c99('0x16'));var licenseUtil=require(_0x7c99('0x17'));var db=require(_0x7c99('0x18'))['db'];function respondWithStatusCode(_0x3b2e5f,_0x2ea5db){_0x2ea5db=_0x2ea5db||0xcc;return function(_0x29aaf6){if(_0x29aaf6){return _0x3b2e5f[_0x7c99('0x19')](_0x2ea5db);}return _0x3b2e5f['status'](_0x2ea5db)[_0x7c99('0x1a')]();};}function respondWithResult(_0x495f87,_0x25e1c4){_0x25e1c4=_0x25e1c4||0xc8;return function(_0x44fca3){if(_0x44fca3){return _0x495f87[_0x7c99('0x1b')](_0x25e1c4)['json'](_0x44fca3);}};}function respondWithFilteredResult(_0x1adecd,_0xa86522){return function(_0x7ea8dd){if(_0x7ea8dd){var _0x282b41=typeof _0xa86522['offset']===_0x7c99('0x1c')&&typeof _0xa86522['limit']===_0x7c99('0x1c');var _0x56f073=_0x7ea8dd[_0x7c99('0x1d')];var _0x230ee6=_0x282b41?0x0:_0xa86522[_0x7c99('0x1e')];var _0x5868c0=_0x282b41?_0x7ea8dd[_0x7c99('0x1d')]:_0xa86522[_0x7c99('0x1e')]+_0xa86522['limit'];var _0x57d7dc;if(_0x5868c0>=_0x56f073){_0x5868c0=_0x56f073;_0x57d7dc=0xc8;}else{_0x57d7dc=0xce;}_0x1adecd[_0x7c99('0x1b')](_0x57d7dc);return _0x1adecd[_0x7c99('0x1f')](_0x7c99('0x20'),_0x230ee6+'-'+_0x5868c0+'/'+_0x56f073)[_0x7c99('0x21')](_0x7ea8dd);}return null;};}function patchUpdates(_0x1786b4){return function(_0x4ae440){try{jsonpatch[_0x7c99('0x22')](_0x4ae440,_0x1786b4,!![]);}catch(_0x4ae94b){return BPromise[_0x7c99('0x23')](_0x4ae94b);}return _0x4ae440[_0x7c99('0x24')]();};}function saveUpdates(_0x5162d3,_0x2d1df7){return function(_0x3415a3){if(_0x3415a3){return _0x3415a3[_0x7c99('0x25')](_0x5162d3)[_0x7c99('0x26')](function(_0x40a56){return _0x40a56;});}return null;};}function removeEntity(_0x359452,_0x2b25b8){return function(_0x2d2629){if(_0x2d2629){return _0x2d2629[_0x7c99('0x27')]()['then'](function(){_0x359452[_0x7c99('0x1b')](0xcc)[_0x7c99('0x1a')]();});}};}function handleEntityNotFound(_0x74e525,_0x35116b){return function(_0x4ca1cc){if(!_0x4ca1cc){_0x74e525[_0x7c99('0x19')](0x194);}return _0x4ca1cc;};}function handleError(_0xa9480,_0x58837d){_0x58837d=_0x58837d||0x1f4;return function(_0x8e7fa9){logger[_0x7c99('0x28')](_0x8e7fa9[_0x7c99('0x29')]);if(_0x8e7fa9['name']){delete _0x8e7fa9[_0x7c99('0x2a')];}_0xa9480['status'](_0x58837d)[_0x7c99('0x2b')](_0x8e7fa9);};}exports['index']=function(_0x2c4534,_0x33e8dd){var _0x4a2be2={},_0x15b47d={},_0x139330={'count':0x0,'rows':[]};var _0x40a818=_[_0x7c99('0x2c')](db['VtigerField']['rawAttributes'],function(_0x105ae2){return{'name':_0x105ae2['fieldName'],'type':_0x105ae2[_0x7c99('0x2d')][_0x7c99('0x2e')]};});_0x15b47d['model']=_['map'](_0x40a818,_0x7c99('0x2a'));_0x15b47d[_0x7c99('0x2f')]=_['keys'](_0x2c4534[_0x7c99('0x2f')]);_0x15b47d['filters']=_[_0x7c99('0x30')](_0x15b47d[_0x7c99('0x31')],_0x15b47d[_0x7c99('0x2f')]);_0x4a2be2[_0x7c99('0x32')]=_[_0x7c99('0x30')](_0x15b47d['model'],qs[_0x7c99('0x33')](_0x2c4534[_0x7c99('0x2f')][_0x7c99('0x33')]));_0x4a2be2[_0x7c99('0x32')]=_0x4a2be2['attributes'][_0x7c99('0x34')]?_0x4a2be2[_0x7c99('0x32')]:_0x15b47d[_0x7c99('0x31')];if(!_0x2c4534[_0x7c99('0x2f')][_0x7c99('0x35')](_0x7c99('0x36'))){_0x4a2be2[_0x7c99('0x37')]=qs['limit'](_0x2c4534['query'][_0x7c99('0x37')]);_0x4a2be2['offset']=qs[_0x7c99('0x1e')](_0x2c4534['query'][_0x7c99('0x1e')]);}_0x4a2be2[_0x7c99('0x38')]=qs[_0x7c99('0x39')](_0x2c4534[_0x7c99('0x2f')][_0x7c99('0x39')]);_0x4a2be2[_0x7c99('0x3a')]=qs[_0x7c99('0x3b')](_[_0x7c99('0x3c')](_0x2c4534[_0x7c99('0x2f')],_0x15b47d[_0x7c99('0x3b')]),_0x40a818);if(_0x2c4534[_0x7c99('0x2f')][_0x7c99('0x3d')]){_0x4a2be2[_0x7c99('0x3a')]=_[_0x7c99('0x3e')](_0x4a2be2[_0x7c99('0x3a')],{'$or':_[_0x7c99('0x2c')](_0x40a818,function(_0x56b1d9){if(_0x56b1d9[_0x7c99('0x2d')]!==_0x7c99('0x3f')){var _0x40e797={};_0x40e797[_0x56b1d9[_0x7c99('0x2a')]]={'$like':'%'+_0x2c4534['query']['filter']+'%'};return _0x40e797;}})});}_0x4a2be2=_[_0x7c99('0x3e')]({},_0x4a2be2,_0x2c4534[_0x7c99('0x40')]);var _0x2de59c={'where':_0x4a2be2[_0x7c99('0x3a')]};return db['VtigerField'][_0x7c99('0x1d')](_0x2de59c)[_0x7c99('0x26')](function(_0x18b119){_0x139330[_0x7c99('0x1d')]=_0x18b119;if(_0x2c4534[_0x7c99('0x2f')][_0x7c99('0x41')]){_0x4a2be2[_0x7c99('0x42')]=[{'all':!![]}];}return db[_0x7c99('0x43')][_0x7c99('0x44')](_0x4a2be2);})[_0x7c99('0x26')](function(_0x40d66e){_0x139330[_0x7c99('0x45')]=_0x40d66e;return _0x139330;})['then'](respondWithFilteredResult(_0x33e8dd,_0x4a2be2))[_0x7c99('0x46')](handleError(_0x33e8dd,null));};exports[_0x7c99('0x47')]=function(_0x43787,_0x16c630){var _0x4b07b0={'raw':!![],'where':{'id':_0x43787['params']['id']}},_0x59f95d={};_0x59f95d[_0x7c99('0x31')]=_[_0x7c99('0x48')](db['VtigerField']['rawAttributes']);_0x59f95d[_0x7c99('0x2f')]=_[_0x7c99('0x48')](_0x43787['query']);_0x59f95d[_0x7c99('0x3b')]=_[_0x7c99('0x30')](_0x59f95d[_0x7c99('0x31')],_0x59f95d['query']);_0x4b07b0['attributes']=_[_0x7c99('0x30')](_0x59f95d[_0x7c99('0x31')],qs['fields'](_0x43787['query']['fields']));_0x4b07b0[_0x7c99('0x32')]=_0x4b07b0[_0x7c99('0x32')][_0x7c99('0x34')]?_0x4b07b0[_0x7c99('0x32')]:_0x59f95d[_0x7c99('0x31')];if(_0x43787[_0x7c99('0x2f')][_0x7c99('0x41')]){_0x4b07b0[_0x7c99('0x42')]=[{'all':!![]}];}_0x4b07b0=_[_0x7c99('0x3e')]({},_0x4b07b0,_0x43787['options']);return db[_0x7c99('0x43')]['find'](_0x4b07b0)[_0x7c99('0x26')](handleEntityNotFound(_0x16c630,null))['then'](respondWithResult(_0x16c630,null))[_0x7c99('0x46')](handleError(_0x16c630,null));};exports[_0x7c99('0x49')]=function(_0x158235,_0x3028e5){return db[_0x7c99('0x43')][_0x7c99('0x49')](_0x158235['body'],{})['then'](respondWithResult(_0x3028e5,0xc9))[_0x7c99('0x46')](handleError(_0x3028e5,null));};exports[_0x7c99('0x25')]=function(_0x1d012f,_0x223ccd){if(_0x1d012f['body']['id']){delete _0x1d012f[_0x7c99('0x4a')]['id'];}return db[_0x7c99('0x43')][_0x7c99('0x4b')]({'where':{'id':_0x1d012f[_0x7c99('0x4c')]['id']}})[_0x7c99('0x26')](handleEntityNotFound(_0x223ccd,null))[_0x7c99('0x26')](saveUpdates(_0x1d012f[_0x7c99('0x4a')],null))[_0x7c99('0x26')](respondWithResult(_0x223ccd,null))[_0x7c99('0x46')](handleError(_0x223ccd,null));};exports[_0x7c99('0x27')]=function(_0x27be21,_0x2ec80e){return db[_0x7c99('0x43')]['find']({'where':{'id':_0x27be21[_0x7c99('0x4c')]['id']}})[_0x7c99('0x26')](handleEntityNotFound(_0x2ec80e,null))[_0x7c99('0x26')](removeEntity(_0x2ec80e,null))[_0x7c99('0x46')](handleError(_0x2ec80e,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 7042d73..d09cdae 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 _0x3d85=['../../config/environment','./intVtigerField.attributes','exports','define','VtigerField','vtiger_unique_index','FieldId','lodash','util','../../config/logger','api','moment','request-promise','rimraf'];(function(_0x22f8ab,_0x15d8ff){var _0x2a70e5=function(_0x5e6895){while(--_0x5e6895){_0x22f8ab['push'](_0x22f8ab['shift']());}};_0x2a70e5(++_0x15d8ff);}(_0x3d85,0xd9));var _0x53d8=function(_0x1b7970,_0x442feb){_0x1b7970=_0x1b7970-0x0;var _0x4926df=_0x3d85[_0x1b7970];return _0x4926df;};'use strict';var _=require(_0x53d8('0x0'));var util=require(_0x53d8('0x1'));var logger=require(_0x53d8('0x2'))(_0x53d8('0x3'));var moment=require(_0x53d8('0x4'));var BPromise=require('bluebird');var rp=require(_0x53d8('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x53d8('0x6'));var config=require(_0x53d8('0x7'));var attributes=require(_0x53d8('0x8'));module[_0x53d8('0x9')]=function(_0x94d5d,_0x3d0111){return _0x94d5d[_0x53d8('0xa')](_0x53d8('0xb'),attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':_0x53d8('0xc'),'fields':['idField',_0x53d8('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb1a8=['bluebird','request-promise','path','rimraf','VtigerField','int_vtiger_fields','idField','FieldId','lodash','../../config/logger','moment'];(function(_0x4e6ae6,_0x49dba6){var _0x23c108=function(_0x1bc103){while(--_0x1bc103){_0x4e6ae6['push'](_0x4e6ae6['shift']());}};_0x23c108(++_0x49dba6);}(_0xb1a8,0x105));var _0x8b1a=function(_0x7624c6,_0x9ff83a){_0x7624c6=_0x7624c6-0x0;var _0x37256d=_0xb1a8[_0x7624c6];return _0x37256d;};'use strict';var _=require(_0x8b1a('0x0'));var util=require('util');var logger=require(_0x8b1a('0x1'))('api');var moment=require(_0x8b1a('0x2'));var BPromise=require(_0x8b1a('0x3'));var rp=require(_0x8b1a('0x4'));var fs=require('fs');var path=require(_0x8b1a('0x5'));var rimraf=require(_0x8b1a('0x6'));var config=require('../../config/environment');var attributes=require('./intVtigerField.attributes');module['exports']=function(_0x131ef5,_0x3b48a6){return _0x131ef5['define'](_0x8b1a('0x7'),attributes,{'tableName':_0x8b1a('0x8'),'paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':[_0x8b1a('0x9'),_0x8b1a('0xa')],'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 9e1f615..e43407d 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 _0x1689=['rpc','../../config/environment','jayson/promise','client','request','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','moment','bluebird','randomstring','../../config/logger'];(function(_0x2e08ee,_0x1ca023){var _0x2c32b1=function(_0x35546f){while(--_0x35546f){_0x2e08ee['push'](_0x2e08ee['shift']());}};_0x2c32b1(++_0x1ca023);}(_0x1689,0x19a));var _0x9168=function(_0x2b5e59,_0x786083){_0x2b5e59=_0x2b5e59-0x0;var _0x319549=_0x1689[_0x2b5e59];return _0x319549;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9168('0x0'));var BPromise=require(_0x9168('0x1'));var rs=require(_0x9168('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x9168('0x3'))(_0x9168('0x4'));var config=require(_0x9168('0x5'));var jayson=require(_0x9168('0x6'));var client=jayson[_0x9168('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4880a7,_0x2c1ffc,_0x1bcd5){return new BPromise(function(_0x4c6b38,_0xa9a56a){return client[_0x9168('0x8')](_0x4880a7,_0x1bcd5)['then'](function(_0x50ec6f){logger['info'](_0x9168('0x9'),_0x2c1ffc,_0x9168('0xa'));logger[_0x9168('0xb')](_0x9168('0xc'),_0x2c1ffc,_0x9168('0xa'),JSON[_0x9168('0xd')](_0x50ec6f));if(_0x50ec6f[_0x9168('0xe')]){if(_0x50ec6f[_0x9168('0xe')][_0x9168('0xf')]===0x1f4){logger['error'](_0x9168('0x9'),_0x2c1ffc,_0x50ec6f[_0x9168('0xe')][_0x9168('0x10')]);return _0xa9a56a(_0x50ec6f[_0x9168('0xe')][_0x9168('0x10')]);}logger[_0x9168('0xe')](_0x9168('0x9'),_0x2c1ffc,_0x50ec6f[_0x9168('0xe')][_0x9168('0x10')]);return _0x4c6b38(_0x50ec6f[_0x9168('0xe')][_0x9168('0x10')]);}else{logger[_0x9168('0x11')](_0x9168('0x9'),_0x2c1ffc,_0x9168('0xa'));_0x4c6b38(_0x50ec6f['result'][_0x9168('0x10')]);}})['catch'](function(_0x479fa8){logger[_0x9168('0xe')]('VtigerField,\x20%s,\x20%s',_0x2c1ffc,_0x479fa8);_0xa9a56a(_0x479fa8);});});} \ No newline at end of file +var _0x663e=['message','info','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x663e,0x1d2));var _0xe663=function(_0xfd16b2,_0x1228e7){_0xfd16b2=_0xfd16b2-0x0;var _0x151d0a=_0x663e[_0xfd16b2];return _0x151d0a;};'use strict';var _=require('lodash');var util=require(_0xe663('0x0'));var moment=require('moment');var BPromise=require(_0xe663('0x1'));var rs=require(_0xe663('0x2'));var fs=require('fs');var Redis=require(_0xe663('0x3'));var db=require(_0xe663('0x4'))['db'];var utils=require(_0xe663('0x5'));var logger=require(_0xe663('0x6'))(_0xe663('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe663('0x8')][_0xe663('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x118d4f,_0xd845d1,_0x1817e4){return new BPromise(function(_0x5274a1,_0x11406e){return client['request'](_0x118d4f,_0x1817e4)['then'](function(_0x4c7e16){logger['info'](_0xe663('0xa'),_0xd845d1,_0xe663('0xb'));logger[_0xe663('0xc')](_0xe663('0xd'),_0xd845d1,_0xe663('0xb'),JSON[_0xe663('0xe')](_0x4c7e16));if(_0x4c7e16[_0xe663('0xf')]){if(_0x4c7e16[_0xe663('0xf')][_0xe663('0x10')]===0x1f4){logger['error'](_0xe663('0xa'),_0xd845d1,_0x4c7e16['error'][_0xe663('0x11')]);return _0x11406e(_0x4c7e16[_0xe663('0xf')][_0xe663('0x11')]);}logger[_0xe663('0xf')](_0xe663('0xa'),_0xd845d1,_0x4c7e16[_0xe663('0xf')][_0xe663('0x11')]);return _0x5274a1(_0x4c7e16[_0xe663('0xf')][_0xe663('0x11')]);}else{logger[_0xe663('0x12')](_0xe663('0xa'),_0xd845d1,_0xe663('0xb'));_0x5274a1(_0x4c7e16[_0xe663('0x13')]['message']);}})[_0xe663('0x14')](function(_0xea02c){logger[_0xe663('0xf')](_0xe663('0xa'),_0xd845d1,_0xea02c);_0x11406e(_0xea02c);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index e2b9491..80808ea 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 _0xdc39=['../../components/interaction/service','./intZendeskAccount.controller','isAuthenticated','index','get','getConfigurations','/:id/fields','getFields','post','create','put','/:id','delete','destroy','util','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x51937d,_0x45b3c7){var _0x4e1c07=function(_0x4b5990){while(--_0x4b5990){_0x51937d['push'](_0x51937d['shift']());}};_0x4e1c07(++_0x45b3c7);}(_0xdc39,0x12b));var _0x9dc3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdc39[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x9dc3('0x0'));var path=require('path');var timeout=require(_0x9dc3('0x1'));var express=require('express');var router=express[_0x9dc3('0x2')]();var fs_extra=require(_0x9dc3('0x3'));var auth=require(_0x9dc3('0x4'));var interaction=require(_0x9dc3('0x5'));var config=require('../../config/environment');var controller=require(_0x9dc3('0x6'));router['get']('/',auth[_0x9dc3('0x7')](),controller[_0x9dc3('0x8')]);router[_0x9dc3('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x9dc3('0x9')]('/:id/configurations',auth[_0x9dc3('0x7')](),controller[_0x9dc3('0xa')]);router[_0x9dc3('0x9')](_0x9dc3('0xb'),auth[_0x9dc3('0x7')](),controller[_0x9dc3('0xc')]);router[_0x9dc3('0xd')]('/',auth['isAuthenticated'](),controller[_0x9dc3('0xe')]);router['post']('/:id/configurations',auth[_0x9dc3('0x7')](),controller['addConfiguration']);router[_0x9dc3('0xf')](_0x9dc3('0x10'),auth[_0x9dc3('0x7')](),controller['update']);router[_0x9dc3('0x11')](_0x9dc3('0x10'),auth[_0x9dc3('0x7')](),controller[_0x9dc3('0x12')]);module['exports']=router; \ No newline at end of file +var _0x95a7=['isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get'];(function(_0x352e09,_0x37a7da){var _0x1b7094=function(_0x561074){while(--_0x561074){_0x352e09['push'](_0x352e09['shift']());}};_0x1b7094(++_0x37a7da);}(_0x95a7,0x12c));var _0x795a=function(_0x150c44,_0x5636d5){_0x150c44=_0x150c44-0x0;var _0xe7b06=_0x95a7[_0x150c44];return _0xe7b06;};'use strict';var multer=require(_0x795a('0x0'));var util=require(_0x795a('0x1'));var path=require(_0x795a('0x2'));var timeout=require(_0x795a('0x3'));var express=require(_0x795a('0x4'));var router=express[_0x795a('0x5')]();var fs_extra=require(_0x795a('0x6'));var auth=require(_0x795a('0x7'));var interaction=require(_0x795a('0x8'));var config=require(_0x795a('0x9'));var controller=require(_0x795a('0xa'));router[_0x795a('0xb')]('/',auth[_0x795a('0xc')](),controller[_0x795a('0xd')]);router['get'](_0x795a('0xe'),auth[_0x795a('0xc')](),controller[_0x795a('0xf')]);router[_0x795a('0xb')]('/:id/configurations',auth[_0x795a('0xc')](),controller[_0x795a('0x10')]);router['get'](_0x795a('0x11'),auth[_0x795a('0xc')](),controller[_0x795a('0x12')]);router[_0x795a('0x13')]('/',auth[_0x795a('0xc')](),controller[_0x795a('0x14')]);router['post']('/:id/configurations',auth[_0x795a('0xc')](),controller[_0x795a('0x15')]);router[_0x795a('0x16')](_0x795a('0xe'),auth[_0x795a('0xc')](),controller[_0x795a('0x17')]);router['delete'](_0x795a('0xe'),auth[_0x795a('0xc')](),controller[_0x795a('0x18')]);module[_0x795a('0x19')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index f4bdee4..8fabda3 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 _0x4819=['remoteUri','ENUM','token','integrationTab','newTab','exports','STRING','username'];(function(_0x162081,_0x2b07fa){var _0x3e8bc2=function(_0x3ce576){while(--_0x3ce576){_0x162081['push'](_0x162081['shift']());}};_0x3e8bc2(++_0x2b07fa);}(_0x4819,0xcd));var _0x9481=function(_0x3a9d77,_0xdc466){_0x3a9d77=_0x3a9d77-0x0;var _0x130f80=_0x4819[_0x3a9d77];return _0x130f80;};'use strict';var Sequelize=require('sequelize');module[_0x9481('0x0')]={'name':{'type':Sequelize[_0x9481('0x1')]},'description':{'type':Sequelize[_0x9481('0x1')]},'username':{'type':Sequelize[_0x9481('0x1')],'unique':_0x9481('0x2')},'password':{'type':Sequelize[_0x9481('0x1')]},'token':{'type':Sequelize[_0x9481('0x1')]},'remoteUri':{'type':Sequelize[_0x9481('0x1')],'unique':_0x9481('0x3')},'authType':{'type':Sequelize[_0x9481('0x4')]('password',_0x9481('0x5')),'defaultValue':'password'},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x9481('0x4')](_0x9481('0x6'),_0x9481('0x7')),'defaultValue':_0x9481('0x6')}}; \ No newline at end of file +var _0x7ed1=['password','token','integrationTab','newTab','sequelize','STRING','username','remoteUri','ENUM'];(function(_0x4f7c98,_0x3b5356){var _0x4486df=function(_0x4bbb0f){while(--_0x4bbb0f){_0x4f7c98['push'](_0x4f7c98['shift']());}};_0x4486df(++_0x3b5356);}(_0x7ed1,0xca));var _0x17ed=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0x7ed1[_0x3d42d8];return _0x27fc41;};'use strict';var Sequelize=require(_0x17ed('0x0'));module['exports']={'name':{'type':Sequelize[_0x17ed('0x1')]},'description':{'type':Sequelize[_0x17ed('0x1')]},'username':{'type':Sequelize[_0x17ed('0x1')],'unique':_0x17ed('0x2')},'password':{'type':Sequelize[_0x17ed('0x1')]},'token':{'type':Sequelize[_0x17ed('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x17ed('0x3')},'authType':{'type':Sequelize[_0x17ed('0x4')](_0x17ed('0x5'),_0x17ed('0x6')),'defaultValue':'password'},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x17ed('0x4')](_0x17ed('0x7'),_0x17ed('0x8')),'defaultValue':_0x17ed('0x7')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index ed6001f..3f2baff 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 _0x0abf=['eml-format','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','error','name','send','index','map','ZendeskAccount','rawAttributes','type','key','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','destroy','getConfigurations','addConfiguration','findOne','AccountId','Subjects','getSubjects','Descriptions','ZendeskConfiguration','ZendeskField','getFields','username','password','token','authType','remoteUri','substring','lastIndexOf','GET','format','%s/%s','ticket_fields','headers','toString','base64','Basic\x20%s','%s/token:%s','Unknown\x20authentication\x20type','subject','description','group','assignee','remove','includes','position','title','system_field_options','custom_field_options','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','test'];(function(_0x54c984,_0x5052e3){var _0x4c8d1c=function(_0x54828e){while(--_0x54828e){_0x54c984['push'](_0x54c984['shift']());}};_0x4c8d1c(++_0x5052e3);}(_0x0abf,0xe8));var _0xf0ab=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x0abf[_0x4cf98e];return _0x1623ac;};'use strict';var emlformat=require(_0xf0ab('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf0ab('0x1'));var jsonpatch=require(_0xf0ab('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf0ab('0x3'));var Mustache=require('mustache');var util=require(_0xf0ab('0x4'));var path=require(_0xf0ab('0x5'));var sox=require(_0xf0ab('0x6'));var csv=require(_0xf0ab('0x7'));var ejs=require(_0xf0ab('0x8'));var fs=require('fs');var fs_extra=require(_0xf0ab('0x9'));var _=require(_0xf0ab('0xa'));var squel=require('squel');var crypto=require(_0xf0ab('0xb'));var jsforce=require(_0xf0ab('0xc'));var deskjs=require(_0xf0ab('0xd'));var toCsv=require(_0xf0ab('0x7'));var querystring=require('querystring');var Papa=require(_0xf0ab('0xe'));var Redis=require(_0xf0ab('0xf'));var authService=require(_0xf0ab('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf0ab('0x11'));var logger=require('../../config/logger')(_0xf0ab('0x12'));var utils=require(_0xf0ab('0x13'));var config=require(_0xf0ab('0x14'));var licenseUtil=require(_0xf0ab('0x15'));var db=require(_0xf0ab('0x16'))['db'];var integrations=require(_0xf0ab('0x17'));function respondWithStatusCode(_0x34ccdc,_0x4fdd5f){_0x4fdd5f=_0x4fdd5f||0xcc;return function(_0x39b4e7){if(_0x39b4e7){return _0x34ccdc[_0xf0ab('0x18')](_0x4fdd5f);}return _0x34ccdc[_0xf0ab('0x19')](_0x4fdd5f)[_0xf0ab('0x1a')]();};}function respondWithResult(_0x1824ef,_0x36cabe){_0x36cabe=_0x36cabe||0xc8;return function(_0x3d7129){if(_0x3d7129){return _0x1824ef[_0xf0ab('0x19')](_0x36cabe)[_0xf0ab('0x1b')](_0x3d7129);}};}function respondWithFilteredResult(_0x3c5bfd,_0x20f453){return function(_0x221bac){if(_0x221bac){var _0x200cf5=typeof _0x20f453[_0xf0ab('0x1c')]===_0xf0ab('0x1d')&&typeof _0x20f453['limit']===_0xf0ab('0x1d');var _0x9e3b47=_0x221bac[_0xf0ab('0x1e')];var _0x1ffeb5=_0x200cf5?0x0:_0x20f453[_0xf0ab('0x1c')];var _0xb9a33=_0x200cf5?_0x221bac[_0xf0ab('0x1e')]:_0x20f453[_0xf0ab('0x1c')]+_0x20f453[_0xf0ab('0x1f')];var _0x1874a5;if(_0xb9a33>=_0x9e3b47){_0xb9a33=_0x9e3b47;_0x1874a5=0xc8;}else{_0x1874a5=0xce;}_0x3c5bfd[_0xf0ab('0x19')](_0x1874a5);return _0x3c5bfd[_0xf0ab('0x20')](_0xf0ab('0x21'),_0x1ffeb5+'-'+_0xb9a33+'/'+_0x9e3b47)[_0xf0ab('0x1b')](_0x221bac);}return null;};}function patchUpdates(_0x2cd961){return function(_0x45c1c9){try{jsonpatch['apply'](_0x45c1c9,_0x2cd961,!![]);}catch(_0x153492){return BPromise[_0xf0ab('0x22')](_0x153492);}return _0x45c1c9[_0xf0ab('0x23')]();};}function saveUpdates(_0x11ab3a,_0x3bf6a1){return function(_0x374531){if(_0x374531){return _0x374531[_0xf0ab('0x24')](_0x11ab3a)[_0xf0ab('0x25')](function(_0x36ad01){return _0x36ad01;});}return null;};}function removeEntity(_0x18bb37,_0x43119f){return function(_0x5645b2){if(_0x5645b2){return _0x5645b2['destroy']()['then'](function(){_0x18bb37[_0xf0ab('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3eca32,_0x16b979){return function(_0x51ac90){if(!_0x51ac90){_0x3eca32[_0xf0ab('0x18')](0x194);}return _0x51ac90;};}function handleError(_0x22671e,_0x10bf5f){_0x10bf5f=_0x10bf5f||0x1f4;return function(_0x38fb71){logger[_0xf0ab('0x26')](_0x38fb71['stack']);if(_0x38fb71[_0xf0ab('0x27')]){delete _0x38fb71['name'];}_0x22671e['status'](_0x10bf5f)[_0xf0ab('0x28')](_0x38fb71);};}exports[_0xf0ab('0x29')]=function(_0x1b223d,_0x445160){var _0x43476c={},_0x174052={},_0x367302={'count':0x0,'rows':[]};var _0x14da9c=_[_0xf0ab('0x2a')](db[_0xf0ab('0x2b')][_0xf0ab('0x2c')],function(_0x199753){return{'name':_0x199753['fieldName'],'type':_0x199753[_0xf0ab('0x2d')][_0xf0ab('0x2e')]};});_0x174052['model']=_['map'](_0x14da9c,_0xf0ab('0x27'));_0x174052[_0xf0ab('0x2f')]=_[_0xf0ab('0x30')](_0x1b223d['query']);_0x174052['filters']=_[_0xf0ab('0x31')](_0x174052['model'],_0x174052[_0xf0ab('0x2f')]);_0x43476c['attributes']=_[_0xf0ab('0x31')](_0x174052[_0xf0ab('0x32')],qs['fields'](_0x1b223d['query'][_0xf0ab('0x33')]));_0x43476c[_0xf0ab('0x34')]=_0x43476c[_0xf0ab('0x34')][_0xf0ab('0x35')]?_0x43476c[_0xf0ab('0x34')]:_0x174052[_0xf0ab('0x32')];if(!_0x1b223d[_0xf0ab('0x2f')][_0xf0ab('0x36')](_0xf0ab('0x37'))){_0x43476c[_0xf0ab('0x1f')]=qs[_0xf0ab('0x1f')](_0x1b223d[_0xf0ab('0x2f')][_0xf0ab('0x1f')]);_0x43476c[_0xf0ab('0x1c')]=qs['offset'](_0x1b223d[_0xf0ab('0x2f')][_0xf0ab('0x1c')]);}_0x43476c[_0xf0ab('0x38')]=qs['sort'](_0x1b223d[_0xf0ab('0x2f')][_0xf0ab('0x39')]);_0x43476c[_0xf0ab('0x3a')]=qs['filters'](_[_0xf0ab('0x3b')](_0x1b223d['query'],_0x174052[_0xf0ab('0x3c')]),_0x14da9c);if(_0x1b223d['query'][_0xf0ab('0x3d')]){_0x43476c[_0xf0ab('0x3a')]=_[_0xf0ab('0x3e')](_0x43476c[_0xf0ab('0x3a')],{'$or':_[_0xf0ab('0x2a')](_0x14da9c,function(_0x1dfb2e){if(_0x1dfb2e['type']!==_0xf0ab('0x3f')){var _0x683d08={};_0x683d08[_0x1dfb2e['name']]={'$like':'%'+_0x1b223d[_0xf0ab('0x2f')][_0xf0ab('0x3d')]+'%'};return _0x683d08;}})});}_0x43476c=_[_0xf0ab('0x3e')]({},_0x43476c,_0x1b223d[_0xf0ab('0x40')]);var _0x31fa72={'where':_0x43476c[_0xf0ab('0x3a')]};return db[_0xf0ab('0x2b')]['count'](_0x31fa72)[_0xf0ab('0x25')](function(_0x4f6e93){_0x367302[_0xf0ab('0x1e')]=_0x4f6e93;if(_0x1b223d['query'][_0xf0ab('0x41')]){_0x43476c[_0xf0ab('0x42')]=[{'all':!![]}];}return db[_0xf0ab('0x2b')][_0xf0ab('0x43')](_0x43476c);})[_0xf0ab('0x25')](function(_0x553d07){_0x367302[_0xf0ab('0x44')]=_0x553d07;return _0x367302;})[_0xf0ab('0x25')](respondWithFilteredResult(_0x445160,_0x43476c))[_0xf0ab('0x45')](handleError(_0x445160,null));};exports[_0xf0ab('0x46')]=function(_0x191caf,_0x17a73){var _0x45849c={'raw':![],'where':{'id':_0x191caf[_0xf0ab('0x47')]['id']}},_0x413f5c={};_0x413f5c[_0xf0ab('0x32')]=_[_0xf0ab('0x30')](db[_0xf0ab('0x2b')][_0xf0ab('0x2c')]);_0x413f5c['query']=_['keys'](_0x191caf[_0xf0ab('0x2f')]);_0x413f5c['filters']=_[_0xf0ab('0x31')](_0x413f5c[_0xf0ab('0x32')],_0x413f5c['query']);_0x45849c[_0xf0ab('0x34')]=_[_0xf0ab('0x31')](_0x413f5c['model'],qs[_0xf0ab('0x33')](_0x191caf[_0xf0ab('0x2f')][_0xf0ab('0x33')]));_0x45849c[_0xf0ab('0x34')]=_0x45849c[_0xf0ab('0x34')][_0xf0ab('0x35')]?_0x45849c[_0xf0ab('0x34')]:_0x413f5c[_0xf0ab('0x32')];if(_0x191caf[_0xf0ab('0x2f')][_0xf0ab('0x41')]){_0x45849c[_0xf0ab('0x42')]=[{'all':!![]}];}_0x45849c=_[_0xf0ab('0x3e')]({},_0x45849c,_0x191caf[_0xf0ab('0x40')]);return db[_0xf0ab('0x2b')]['find'](_0x45849c)['then'](handleEntityNotFound(_0x17a73,null))[_0xf0ab('0x25')](respondWithResult(_0x17a73,null))['catch'](handleError(_0x17a73,null));};exports['create']=function(_0x4e57d3,_0xc3b68d){return db[_0xf0ab('0x2b')][_0xf0ab('0x48')](_0x4e57d3[_0xf0ab('0x49')],{})[_0xf0ab('0x25')](respondWithResult(_0xc3b68d,0xc9))[_0xf0ab('0x45')](handleError(_0xc3b68d,null));};exports[_0xf0ab('0x24')]=function(_0x1a0f21,_0xc6862b){if(_0x1a0f21[_0xf0ab('0x49')]['id']){delete _0x1a0f21[_0xf0ab('0x49')]['id'];}return db[_0xf0ab('0x2b')]['find']({'where':{'id':_0x1a0f21[_0xf0ab('0x47')]['id']}})[_0xf0ab('0x25')](handleEntityNotFound(_0xc6862b,null))[_0xf0ab('0x25')](saveUpdates(_0x1a0f21[_0xf0ab('0x49')],null))[_0xf0ab('0x25')](respondWithResult(_0xc6862b,null))[_0xf0ab('0x45')](handleError(_0xc6862b,null));};exports[_0xf0ab('0x4a')]=function(_0x2e6c5e,_0x47f564){return db['ZendeskAccount']['find']({'where':{'id':_0x2e6c5e[_0xf0ab('0x47')]['id']}})[_0xf0ab('0x25')](handleEntityNotFound(_0x47f564,null))['then'](removeEntity(_0x47f564,null))[_0xf0ab('0x45')](handleError(_0x47f564,null));};exports[_0xf0ab('0x4b')]=function(_0x4edb01,_0x1a9981,_0x53d6a4){var _0x1352ac={};var _0xe4ef6d={};var _0x187389;var _0x33112b;return db[_0xf0ab('0x2b')]['findOne']({'where':{'id':_0x4edb01[_0xf0ab('0x47')]['id']}})['then'](handleEntityNotFound(_0x1a9981,null))[_0xf0ab('0x25')](function(_0x4c9d2b){if(_0x4c9d2b){_0x187389=_0x4c9d2b;_0xe4ef6d[_0xf0ab('0x32')]=_['keys'](db['ZendeskConfiguration'][_0xf0ab('0x2c')]);_0xe4ef6d['query']=_[_0xf0ab('0x30')](_0x4edb01['query']);_0xe4ef6d[_0xf0ab('0x3c')]=_['intersection'](_0xe4ef6d[_0xf0ab('0x32')],_0xe4ef6d[_0xf0ab('0x2f')]);_0x1352ac[_0xf0ab('0x34')]=_['intersection'](_0xe4ef6d['model'],qs['fields'](_0x4edb01[_0xf0ab('0x2f')][_0xf0ab('0x33')]));_0x1352ac['attributes']=_0x1352ac['attributes'][_0xf0ab('0x35')]?_0x1352ac[_0xf0ab('0x34')]:_0xe4ef6d[_0xf0ab('0x32')];_0x1352ac[_0xf0ab('0x38')]=qs[_0xf0ab('0x39')](_0x4edb01[_0xf0ab('0x2f')][_0xf0ab('0x39')]);_0x1352ac[_0xf0ab('0x3a')]=qs[_0xf0ab('0x3c')](_[_0xf0ab('0x3b')](_0x4edb01[_0xf0ab('0x2f')],_0xe4ef6d['filters']));if(_0x4edb01[_0xf0ab('0x2f')]['filter']){_0x1352ac[_0xf0ab('0x3a')]=_[_0xf0ab('0x3e')](_0x1352ac[_0xf0ab('0x3a')],{'$or':_[_0xf0ab('0x2a')](_0x1352ac[_0xf0ab('0x34')],function(_0x3c168f){var _0x152e80={};_0x152e80[_0x3c168f]={'$like':'%'+_0x4edb01[_0xf0ab('0x2f')][_0xf0ab('0x3d')]+'%'};return _0x152e80;})});}_0x1352ac=_[_0xf0ab('0x3e')]({},_0x1352ac,_0x4edb01['options']);return _0x187389[_0xf0ab('0x4b')](_0x1352ac);}})[_0xf0ab('0x25')](function(_0x4062b7){if(_0x4062b7){_0x33112b=_0x4062b7[_0xf0ab('0x35')];if(!_0x4edb01[_0xf0ab('0x2f')][_0xf0ab('0x36')](_0xf0ab('0x37'))){_0x1352ac[_0xf0ab('0x1f')]=qs[_0xf0ab('0x1f')](_0x4edb01['query']['limit']);_0x1352ac[_0xf0ab('0x1c')]=qs[_0xf0ab('0x1c')](_0x4edb01[_0xf0ab('0x2f')]['offset']);}return _0x187389[_0xf0ab('0x4b')](_0x1352ac);}})[_0xf0ab('0x25')](function(_0xd61dcf){if(_0xd61dcf){return _0xd61dcf?{'count':_0x33112b,'rows':_0xd61dcf}:null;}})['then'](respondWithResult(_0x1a9981,null))[_0xf0ab('0x45')](handleError(_0x1a9981,null));};exports[_0xf0ab('0x4c')]=function(_0x3fc57e,_0x3d333f,_0x23f4f8){if(_0x3fc57e['body']['id']){delete _0x3fc57e[_0xf0ab('0x49')]['id'];}return db[_0xf0ab('0x2b')][_0xf0ab('0x4d')]({'where':{'id':_0x3fc57e[_0xf0ab('0x47')]['id']}})[_0xf0ab('0x25')](handleEntityNotFound(_0x3d333f,null))[_0xf0ab('0x25')](function(_0xe3fc19){if(_0xe3fc19){_0x3fc57e[_0xf0ab('0x49')][_0xf0ab('0x4e')]=_0xe3fc19['id'];_0x3fc57e[_0xf0ab('0x49')][_0xf0ab('0x4f')]=integrations[_0xf0ab('0x50')](_0x3fc57e[_0xf0ab('0x49')]['channel'],_0x3fc57e['body'][_0xf0ab('0x2d')]);_0x3fc57e[_0xf0ab('0x49')][_0xf0ab('0x51')]=integrations['getDescriptions'](_0x3fc57e[_0xf0ab('0x49')]['channel'],_0x3fc57e[_0xf0ab('0x49')][_0xf0ab('0x2d')]);return db[_0xf0ab('0x52')]['create'](_0x3fc57e[_0xf0ab('0x49')],{'include':[{'model':db['ZendeskField'],'as':'Subjects'},{'model':db[_0xf0ab('0x53')],'as':_0xf0ab('0x51')}]});}return null;})[_0xf0ab('0x25')](respondWithResult(_0x3d333f,null))['catch'](handleError(_0x3d333f,null));};exports[_0xf0ab('0x54')]=function(_0x92ade0,_0x1035b3,_0x122c41){var _0x5b6923='';return db['ZendeskAccount']['findOne']({'where':{'id':_0x92ade0[_0xf0ab('0x47')]['id']},'attributes':['id',_0xf0ab('0x55'),_0xf0ab('0x56'),_0xf0ab('0x57'),_0xf0ab('0x58'),_0xf0ab('0x59')]})[_0xf0ab('0x25')](handleEntityNotFound(_0x1035b3,null))[_0xf0ab('0x25')](function(_0x3119d1){if(_0x3119d1){_0x5b6923=_0x3119d1[_0xf0ab('0x59')];var _0x228334=_0x5b6923['slice'](-0x1);if(_0x228334==='/'){_0x5b6923=_0x5b6923[_0xf0ab('0x5a')](0x0,_0x5b6923[_0xf0ab('0x5b')](_0x228334));}var _0x24e4f5={'method':_0xf0ab('0x5c'),'uri':util[_0xf0ab('0x5d')](_0xf0ab('0x5e'),_0x5b6923,_0xf0ab('0x5f')),'json':!![]};switch(_0x3119d1[_0xf0ab('0x58')]){case'password':_0x24e4f5[_0xf0ab('0x60')]={'Authorization':util[_0xf0ab('0x5d')]('Basic\x20%s',new Buffer(util['format']('%s:%s',_0x3119d1[_0xf0ab('0x55')],_0x3119d1[_0xf0ab('0x56')]))[_0xf0ab('0x61')](_0xf0ab('0x62')))};break;case _0xf0ab('0x57'):_0x24e4f5[_0xf0ab('0x60')]={'Authorization':util['format'](_0xf0ab('0x63'),new Buffer(util['format'](_0xf0ab('0x64'),_0x3119d1['username'],_0x3119d1[_0xf0ab('0x57')]))['toString'](_0xf0ab('0x62')))};break;default:throw new db['Sequelize']['ValidationError'](_0xf0ab('0x65'));}return rp(_0x24e4f5);}})[_0xf0ab('0x25')](function(_0x1f37a2){if(_0x1f37a2){var _0xd96ca8=[_0xf0ab('0x66'),_0xf0ab('0x67'),_0xf0ab('0x68'),_0xf0ab('0x69')];_[_0xf0ab('0x6a')](_0x1f37a2[_0xf0ab('0x5f')],function(_0x1650c0){return _0xd96ca8[_0xf0ab('0x6b')](_0x1650c0[_0xf0ab('0x2d')]);});return{'count':_0x1f37a2['ticket_fields'][_0xf0ab('0x35')],'rows':_[_0xf0ab('0x2a')](_0x1f37a2[_0xf0ab('0x5f')],function(_0x12acef){return{'id':_0x12acef['id'],'name':_0x12acef[_0xf0ab('0x6c')]>0x7?_0x12acef[_0xf0ab('0x6d')]:_0x12acef[_0xf0ab('0x2d')],'custom':_0x12acef[_0xf0ab('0x6c')]>0x7?!![]:![],'options':_0x12acef[_0xf0ab('0x6e')]?_0x12acef[_0xf0ab('0x6e')]:_0x12acef[_0xf0ab('0x6f')]?_0x12acef[_0xf0ab('0x6f')]:[]};})};}})['then'](respondWithResult(_0x1035b3,null))[_0xf0ab('0x45')](function(_0x1f18cd){var _0x3221ff=_0x92ade0[_0xf0ab('0x2f')]['test']?0x1f4:_0x1f18cd[_0xf0ab('0x70')]||0x1f4;logger[_0xf0ab('0x26')](_0xf0ab('0x71'),_0xf0ab('0x54'),_0x3221ff,JSON[_0xf0ab('0x72')](_0x1f18cd));delete _0x1f18cd['name'];if(_0x3221ff===0x191){_0x3221ff=0x190;}_0x1035b3[_0xf0ab('0x19')](_0x3221ff)[_0xf0ab('0x28')](_0x92ade0['query'][_0xf0ab('0x73')]?{'message':'Wrong\x20credentials','statusCode':_0x1f18cd[_0xf0ab('0x70')]}:_0x1f18cd);});}; \ No newline at end of file +var _0xefda=['getDescriptions','ZendeskField','getFields','username','password','token','authType','remoteUri','slice','substring','lastIndexOf','GET','format','%s/%s','headers','Basic\x20%s','%s:%s','toString','base64','Sequelize','ValidationError','Unknown\x20authentication\x20type','group','assignee','remove','ticket_fields','includes','position','system_field_options','custom_field_options','test','statusCode','stringify','send','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','name','index','rawAttributes','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','ZendeskAccount','includeAll','include','rows','catch','show','params','find','create','body','getConfigurations','findOne','ZendeskConfiguration','AccountId','Subjects','channel','type','Descriptions'];(function(_0x3ebb69,_0x3e612e){var _0x421e59=function(_0x5a8c66){while(--_0x5a8c66){_0x3ebb69['push'](_0x3ebb69['shift']());}};_0x421e59(++_0x3e612e);}(_0xefda,0x96));var _0xaefd=function(_0xf0ae5f,_0xd22ac7){_0xf0ae5f=_0xf0ae5f-0x0;var _0xf1ba5a=_0xefda[_0xf0ae5f];return _0xf1ba5a;};'use strict';var emlformat=require(_0xaefd('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xaefd('0x1'));var rp=require(_0xaefd('0x2'));var moment=require('moment');var BPromise=require(_0xaefd('0x3'));var Mustache=require(_0xaefd('0x4'));var util=require(_0xaefd('0x5'));var path=require(_0xaefd('0x6'));var sox=require(_0xaefd('0x7'));var csv=require(_0xaefd('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xaefd('0x9'));var _=require(_0xaefd('0xa'));var squel=require(_0xaefd('0xb'));var crypto=require(_0xaefd('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xaefd('0xd'));var toCsv=require(_0xaefd('0x8'));var querystring=require(_0xaefd('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xaefd('0xf'));var as=require(_0xaefd('0x10'));var hardwareService=require(_0xaefd('0x11'));var logger=require(_0xaefd('0x12'))(_0xaefd('0x13'));var utils=require(_0xaefd('0x14'));var config=require(_0xaefd('0x15'));var licenseUtil=require(_0xaefd('0x16'));var db=require(_0xaefd('0x17'))['db'];var integrations=require(_0xaefd('0x18'));function respondWithStatusCode(_0x2a310c,_0x4b2b5c){_0x4b2b5c=_0x4b2b5c||0xcc;return function(_0x3172d3){if(_0x3172d3){return _0x2a310c['sendStatus'](_0x4b2b5c);}return _0x2a310c[_0xaefd('0x19')](_0x4b2b5c)[_0xaefd('0x1a')]();};}function respondWithResult(_0x9dfdf6,_0x43b82a){_0x43b82a=_0x43b82a||0xc8;return function(_0x4ec92a){if(_0x4ec92a){return _0x9dfdf6[_0xaefd('0x19')](_0x43b82a)[_0xaefd('0x1b')](_0x4ec92a);}};}function respondWithFilteredResult(_0x41f345,_0x411701){return function(_0x10ee28){if(_0x10ee28){var _0x32f75e=typeof _0x411701[_0xaefd('0x1c')]===_0xaefd('0x1d')&&typeof _0x411701['limit']===_0xaefd('0x1d');var _0x109604=_0x10ee28[_0xaefd('0x1e')];var _0x1737a1=_0x32f75e?0x0:_0x411701[_0xaefd('0x1c')];var _0x244956=_0x32f75e?_0x10ee28['count']:_0x411701[_0xaefd('0x1c')]+_0x411701[_0xaefd('0x1f')];var _0x24f131;if(_0x244956>=_0x109604){_0x244956=_0x109604;_0x24f131=0xc8;}else{_0x24f131=0xce;}_0x41f345[_0xaefd('0x19')](_0x24f131);return _0x41f345[_0xaefd('0x20')](_0xaefd('0x21'),_0x1737a1+'-'+_0x244956+'/'+_0x109604)['json'](_0x10ee28);}return null;};}function patchUpdates(_0x463d48){return function(_0x18e71c){try{jsonpatch[_0xaefd('0x22')](_0x18e71c,_0x463d48,!![]);}catch(_0x3d9823){return BPromise[_0xaefd('0x23')](_0x3d9823);}return _0x18e71c['save']();};}function saveUpdates(_0x479486,_0x5b9967){return function(_0x21680a){if(_0x21680a){return _0x21680a[_0xaefd('0x24')](_0x479486)[_0xaefd('0x25')](function(_0x5a44ed){return _0x5a44ed;});}return null;};}function removeEntity(_0x23060f,_0x4cd9b2){return function(_0x3deec8){if(_0x3deec8){return _0x3deec8[_0xaefd('0x26')]()[_0xaefd('0x25')](function(){_0x23060f['status'](0xcc)[_0xaefd('0x1a')]();});}};}function handleEntityNotFound(_0x3ffc9c,_0x18e720){return function(_0x14cc9d){if(!_0x14cc9d){_0x3ffc9c[_0xaefd('0x27')](0x194);}return _0x14cc9d;};}function handleError(_0x5a170c,_0x2fe27e){_0x2fe27e=_0x2fe27e||0x1f4;return function(_0x58c008){logger[_0xaefd('0x28')](_0x58c008[_0xaefd('0x29')]);if(_0x58c008['name']){delete _0x58c008[_0xaefd('0x2a')];}_0x5a170c[_0xaefd('0x19')](_0x2fe27e)['send'](_0x58c008);};}exports[_0xaefd('0x2b')]=function(_0x114ec0,_0x36b6b7){var _0x4c0898={},_0x45f0e8={},_0x5c573b={'count':0x0,'rows':[]};var _0x109e19=_['map'](db['ZendeskAccount'][_0xaefd('0x2c')],function(_0x1b470c){return{'name':_0x1b470c['fieldName'],'type':_0x1b470c['type']['key']};});_0x45f0e8[_0xaefd('0x2d')]=_[_0xaefd('0x2e')](_0x109e19,'name');_0x45f0e8['query']=_[_0xaefd('0x2f')](_0x114ec0[_0xaefd('0x30')]);_0x45f0e8[_0xaefd('0x31')]=_[_0xaefd('0x32')](_0x45f0e8['model'],_0x45f0e8[_0xaefd('0x30')]);_0x4c0898[_0xaefd('0x33')]=_[_0xaefd('0x32')](_0x45f0e8[_0xaefd('0x2d')],qs[_0xaefd('0x34')](_0x114ec0[_0xaefd('0x30')][_0xaefd('0x34')]));_0x4c0898[_0xaefd('0x33')]=_0x4c0898[_0xaefd('0x33')][_0xaefd('0x35')]?_0x4c0898[_0xaefd('0x33')]:_0x45f0e8[_0xaefd('0x2d')];if(!_0x114ec0[_0xaefd('0x30')][_0xaefd('0x36')](_0xaefd('0x37'))){_0x4c0898[_0xaefd('0x1f')]=qs['limit'](_0x114ec0[_0xaefd('0x30')][_0xaefd('0x1f')]);_0x4c0898[_0xaefd('0x1c')]=qs['offset'](_0x114ec0[_0xaefd('0x30')]['offset']);}_0x4c0898[_0xaefd('0x38')]=qs[_0xaefd('0x39')](_0x114ec0[_0xaefd('0x30')][_0xaefd('0x39')]);_0x4c0898[_0xaefd('0x3a')]=qs[_0xaefd('0x31')](_[_0xaefd('0x3b')](_0x114ec0[_0xaefd('0x30')],_0x45f0e8[_0xaefd('0x31')]),_0x109e19);if(_0x114ec0[_0xaefd('0x30')][_0xaefd('0x3c')]){_0x4c0898[_0xaefd('0x3a')]=_[_0xaefd('0x3d')](_0x4c0898[_0xaefd('0x3a')],{'$or':_['map'](_0x109e19,function(_0x1cfd6d){if(_0x1cfd6d['type']!==_0xaefd('0x3e')){var _0x6562={};_0x6562[_0x1cfd6d[_0xaefd('0x2a')]]={'$like':'%'+_0x114ec0[_0xaefd('0x30')][_0xaefd('0x3c')]+'%'};return _0x6562;}})});}_0x4c0898=_[_0xaefd('0x3d')]({},_0x4c0898,_0x114ec0[_0xaefd('0x3f')]);var _0x145e9e={'where':_0x4c0898[_0xaefd('0x3a')]};return db[_0xaefd('0x40')]['count'](_0x145e9e)[_0xaefd('0x25')](function(_0x3296ac){_0x5c573b['count']=_0x3296ac;if(_0x114ec0[_0xaefd('0x30')][_0xaefd('0x41')]){_0x4c0898[_0xaefd('0x42')]=[{'all':!![]}];}return db['ZendeskAccount']['findAll'](_0x4c0898);})[_0xaefd('0x25')](function(_0x3d0abf){_0x5c573b[_0xaefd('0x43')]=_0x3d0abf;return _0x5c573b;})[_0xaefd('0x25')](respondWithFilteredResult(_0x36b6b7,_0x4c0898))[_0xaefd('0x44')](handleError(_0x36b6b7,null));};exports[_0xaefd('0x45')]=function(_0x2e17b5,_0x2e98aa){var _0x48a7af={'raw':![],'where':{'id':_0x2e17b5[_0xaefd('0x46')]['id']}},_0x26587e={};_0x26587e[_0xaefd('0x2d')]=_[_0xaefd('0x2f')](db[_0xaefd('0x40')][_0xaefd('0x2c')]);_0x26587e[_0xaefd('0x30')]=_[_0xaefd('0x2f')](_0x2e17b5['query']);_0x26587e['filters']=_[_0xaefd('0x32')](_0x26587e[_0xaefd('0x2d')],_0x26587e['query']);_0x48a7af['attributes']=_[_0xaefd('0x32')](_0x26587e[_0xaefd('0x2d')],qs[_0xaefd('0x34')](_0x2e17b5[_0xaefd('0x30')][_0xaefd('0x34')]));_0x48a7af[_0xaefd('0x33')]=_0x48a7af[_0xaefd('0x33')][_0xaefd('0x35')]?_0x48a7af[_0xaefd('0x33')]:_0x26587e['model'];if(_0x2e17b5[_0xaefd('0x30')][_0xaefd('0x41')]){_0x48a7af[_0xaefd('0x42')]=[{'all':!![]}];}_0x48a7af=_[_0xaefd('0x3d')]({},_0x48a7af,_0x2e17b5[_0xaefd('0x3f')]);return db[_0xaefd('0x40')][_0xaefd('0x47')](_0x48a7af)['then'](handleEntityNotFound(_0x2e98aa,null))[_0xaefd('0x25')](respondWithResult(_0x2e98aa,null))['catch'](handleError(_0x2e98aa,null));};exports[_0xaefd('0x48')]=function(_0x374845,_0x16c664){return db[_0xaefd('0x40')]['create'](_0x374845['body'],{})[_0xaefd('0x25')](respondWithResult(_0x16c664,0xc9))[_0xaefd('0x44')](handleError(_0x16c664,null));};exports[_0xaefd('0x24')]=function(_0x4eeb56,_0x2a836a){if(_0x4eeb56[_0xaefd('0x49')]['id']){delete _0x4eeb56['body']['id'];}return db[_0xaefd('0x40')][_0xaefd('0x47')]({'where':{'id':_0x4eeb56[_0xaefd('0x46')]['id']}})[_0xaefd('0x25')](handleEntityNotFound(_0x2a836a,null))[_0xaefd('0x25')](saveUpdates(_0x4eeb56[_0xaefd('0x49')],null))[_0xaefd('0x25')](respondWithResult(_0x2a836a,null))[_0xaefd('0x44')](handleError(_0x2a836a,null));};exports['destroy']=function(_0x567ceb,_0x1406b8){return db[_0xaefd('0x40')]['find']({'where':{'id':_0x567ceb[_0xaefd('0x46')]['id']}})['then'](handleEntityNotFound(_0x1406b8,null))[_0xaefd('0x25')](removeEntity(_0x1406b8,null))[_0xaefd('0x44')](handleError(_0x1406b8,null));};exports[_0xaefd('0x4a')]=function(_0x69185e,_0x27fd3f,_0xf727cd){var _0x4b709a={};var _0x56e180={};var _0x1fd0b0;var _0x338823;return db['ZendeskAccount'][_0xaefd('0x4b')]({'where':{'id':_0x69185e[_0xaefd('0x46')]['id']}})[_0xaefd('0x25')](handleEntityNotFound(_0x27fd3f,null))[_0xaefd('0x25')](function(_0x4a883b){if(_0x4a883b){_0x1fd0b0=_0x4a883b;_0x56e180['model']=_[_0xaefd('0x2f')](db[_0xaefd('0x4c')][_0xaefd('0x2c')]);_0x56e180[_0xaefd('0x30')]=_[_0xaefd('0x2f')](_0x69185e['query']);_0x56e180[_0xaefd('0x31')]=_[_0xaefd('0x32')](_0x56e180['model'],_0x56e180[_0xaefd('0x30')]);_0x4b709a[_0xaefd('0x33')]=_['intersection'](_0x56e180[_0xaefd('0x2d')],qs[_0xaefd('0x34')](_0x69185e[_0xaefd('0x30')]['fields']));_0x4b709a[_0xaefd('0x33')]=_0x4b709a[_0xaefd('0x33')]['length']?_0x4b709a[_0xaefd('0x33')]:_0x56e180[_0xaefd('0x2d')];_0x4b709a[_0xaefd('0x38')]=qs[_0xaefd('0x39')](_0x69185e['query']['sort']);_0x4b709a[_0xaefd('0x3a')]=qs[_0xaefd('0x31')](_[_0xaefd('0x3b')](_0x69185e[_0xaefd('0x30')],_0x56e180[_0xaefd('0x31')]));if(_0x69185e[_0xaefd('0x30')][_0xaefd('0x3c')]){_0x4b709a[_0xaefd('0x3a')]=_[_0xaefd('0x3d')](_0x4b709a[_0xaefd('0x3a')],{'$or':_['map'](_0x4b709a['attributes'],function(_0x324eb4){var _0x431c1a={};_0x431c1a[_0x324eb4]={'$like':'%'+_0x69185e[_0xaefd('0x30')][_0xaefd('0x3c')]+'%'};return _0x431c1a;})});}_0x4b709a=_['merge']({},_0x4b709a,_0x69185e[_0xaefd('0x3f')]);return _0x1fd0b0[_0xaefd('0x4a')](_0x4b709a);}})[_0xaefd('0x25')](function(_0x1ad04e){if(_0x1ad04e){_0x338823=_0x1ad04e[_0xaefd('0x35')];if(!_0x69185e[_0xaefd('0x30')][_0xaefd('0x36')](_0xaefd('0x37'))){_0x4b709a['limit']=qs[_0xaefd('0x1f')](_0x69185e[_0xaefd('0x30')][_0xaefd('0x1f')]);_0x4b709a[_0xaefd('0x1c')]=qs['offset'](_0x69185e[_0xaefd('0x30')]['offset']);}return _0x1fd0b0[_0xaefd('0x4a')](_0x4b709a);}})[_0xaefd('0x25')](function(_0x516913){if(_0x516913){return _0x516913?{'count':_0x338823,'rows':_0x516913}:null;}})['then'](respondWithResult(_0x27fd3f,null))[_0xaefd('0x44')](handleError(_0x27fd3f,null));};exports['addConfiguration']=function(_0x5e0068,_0x4e75bc,_0xe2397c){if(_0x5e0068[_0xaefd('0x49')]['id']){delete _0x5e0068[_0xaefd('0x49')]['id'];}return db[_0xaefd('0x40')][_0xaefd('0x4b')]({'where':{'id':_0x5e0068[_0xaefd('0x46')]['id']}})['then'](handleEntityNotFound(_0x4e75bc,null))['then'](function(_0x4f8e16){if(_0x4f8e16){_0x5e0068['body'][_0xaefd('0x4d')]=_0x4f8e16['id'];_0x5e0068['body'][_0xaefd('0x4e')]=integrations['getSubjects'](_0x5e0068[_0xaefd('0x49')][_0xaefd('0x4f')],_0x5e0068[_0xaefd('0x49')][_0xaefd('0x50')]);_0x5e0068[_0xaefd('0x49')][_0xaefd('0x51')]=integrations[_0xaefd('0x52')](_0x5e0068['body'][_0xaefd('0x4f')],_0x5e0068[_0xaefd('0x49')][_0xaefd('0x50')]);return db[_0xaefd('0x4c')]['create'](_0x5e0068[_0xaefd('0x49')],{'include':[{'model':db['ZendeskField'],'as':_0xaefd('0x4e')},{'model':db[_0xaefd('0x53')],'as':_0xaefd('0x51')}]});}return null;})[_0xaefd('0x25')](respondWithResult(_0x4e75bc,null))[_0xaefd('0x44')](handleError(_0x4e75bc,null));};exports[_0xaefd('0x54')]=function(_0x57776e,_0x1a6195,_0x3b39db){var _0x4a9fa5='';return db[_0xaefd('0x40')][_0xaefd('0x4b')]({'where':{'id':_0x57776e['params']['id']},'attributes':['id',_0xaefd('0x55'),_0xaefd('0x56'),_0xaefd('0x57'),_0xaefd('0x58'),_0xaefd('0x59')]})[_0xaefd('0x25')](handleEntityNotFound(_0x1a6195,null))[_0xaefd('0x25')](function(_0x6f99b0){if(_0x6f99b0){_0x4a9fa5=_0x6f99b0[_0xaefd('0x59')];var _0x1ec9be=_0x4a9fa5[_0xaefd('0x5a')](-0x1);if(_0x1ec9be==='/'){_0x4a9fa5=_0x4a9fa5[_0xaefd('0x5b')](0x0,_0x4a9fa5[_0xaefd('0x5c')](_0x1ec9be));}var _0x43338b={'method':_0xaefd('0x5d'),'uri':util[_0xaefd('0x5e')](_0xaefd('0x5f'),_0x4a9fa5,'ticket_fields'),'json':!![]};switch(_0x6f99b0[_0xaefd('0x58')]){case _0xaefd('0x56'):_0x43338b[_0xaefd('0x60')]={'Authorization':util['format'](_0xaefd('0x61'),new Buffer(util[_0xaefd('0x5e')](_0xaefd('0x62'),_0x6f99b0[_0xaefd('0x55')],_0x6f99b0['password']))[_0xaefd('0x63')]('base64'))};break;case _0xaefd('0x57'):_0x43338b['headers']={'Authorization':util[_0xaefd('0x5e')](_0xaefd('0x61'),new Buffer(util[_0xaefd('0x5e')]('%s/token:%s',_0x6f99b0['username'],_0x6f99b0[_0xaefd('0x57')]))[_0xaefd('0x63')](_0xaefd('0x64')))};break;default:throw new db[(_0xaefd('0x65'))][(_0xaefd('0x66'))](_0xaefd('0x67'));}return rp(_0x43338b);}})['then'](function(_0x499d7d){if(_0x499d7d){var _0x58c97c=['subject','description',_0xaefd('0x68'),_0xaefd('0x69')];_[_0xaefd('0x6a')](_0x499d7d[_0xaefd('0x6b')],function(_0x5ae635){return _0x58c97c[_0xaefd('0x6c')](_0x5ae635[_0xaefd('0x50')]);});return{'count':_0x499d7d['ticket_fields'][_0xaefd('0x35')],'rows':_['map'](_0x499d7d[_0xaefd('0x6b')],function(_0x51b6f1){return{'id':_0x51b6f1['id'],'name':_0x51b6f1[_0xaefd('0x6d')]>0x7?_0x51b6f1['title']:_0x51b6f1[_0xaefd('0x50')],'custom':_0x51b6f1['position']>0x7?!![]:![],'options':_0x51b6f1[_0xaefd('0x6e')]?_0x51b6f1[_0xaefd('0x6e')]:_0x51b6f1['custom_field_options']?_0x51b6f1[_0xaefd('0x6f')]:[]};})};}})[_0xaefd('0x25')](respondWithResult(_0x1a6195,null))[_0xaefd('0x44')](function(_0x564c89){var _0x42c55c=_0x57776e[_0xaefd('0x30')][_0xaefd('0x70')]?0x1f4:_0x564c89[_0xaefd('0x71')]||0x1f4;logger[_0xaefd('0x28')]('getFields,\x20%s,\x20%s,\x20%s',_0xaefd('0x54'),_0x42c55c,JSON[_0xaefd('0x72')](_0x564c89));delete _0x564c89['name'];if(_0x42c55c===0x191){_0x42c55c=0x190;}_0x1a6195[_0xaefd('0x19')](_0x42c55c)[_0xaefd('0x73')](_0x57776e[_0xaefd('0x30')][_0xaefd('0x70')]?{'message':'Wrong\x20credentials','statusCode':_0x564c89[_0xaefd('0x71')]}:_0x564c89);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 69c3c93..0553cef 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 _0x81c4=['util','api','request-promise','rimraf','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','define','int_zendesk_accounts','lodash'];(function(_0x20dd00,_0x1a9b17){var _0x1765dc=function(_0x92666d){while(--_0x92666d){_0x20dd00['push'](_0x20dd00['shift']());}};_0x1765dc(++_0x1a9b17);}(_0x81c4,0xe5));var _0x481c=function(_0x513aa5,_0x1fba79){_0x513aa5=_0x513aa5-0x0;var _0x1a1a7c=_0x81c4[_0x513aa5];return _0x1a1a7c;};'use strict';var _=require(_0x481c('0x0'));var util=require(_0x481c('0x1'));var logger=require('../../config/logger')(_0x481c('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x481c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x481c('0x4'));var config=require(_0x481c('0x5'));var attributes=require(_0x481c('0x6'));var integrations=require(_0x481c('0x7'));module['exports']=function(_0x6e4139,_0x1f27b2){return _0x6e4139[_0x481c('0x8')]('ZendeskAccount',attributes,{'tableName':_0x481c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0399=['path','rimraf','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','int_zendesk_accounts','lodash','../../config/logger','api','bluebird','request-promise'];(function(_0x67b97a,_0x503a86){var _0x1c50b2=function(_0x1f76d7){while(--_0x1f76d7){_0x67b97a['push'](_0x67b97a['shift']());}};_0x1c50b2(++_0x503a86);}(_0x0399,0x97));var _0x9039=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x0399[_0x1cc8fe];return _0x230054;};'use strict';var _=require(_0x9039('0x0'));var util=require('util');var logger=require(_0x9039('0x1'))(_0x9039('0x2'));var moment=require('moment');var BPromise=require(_0x9039('0x3'));var rp=require(_0x9039('0x4'));var fs=require('fs');var path=require(_0x9039('0x5'));var rimraf=require(_0x9039('0x6'));var config=require(_0x9039('0x7'));var attributes=require(_0x9039('0x8'));var integrations=require(_0x9039('0x9'));module[_0x9039('0xa')]=function(_0x21c2a3,_0x2ca415){return _0x21c2a3['define']('ZendeskAccount',attributes,{'tableName':_0x9039('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.rpc.js b/server/api/intZendeskAccount/intZendeskAccount.rpc.js index 2f6f858..b6951b3 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 _0xd3fd=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','GetZendeskAccount','ZendeskAccount','findAll','options','raw','attributes','include','map','model','catch','ShowZendeskAccount','where','lodash'];(function(_0x2444db,_0x5c124d){var _0x5866ec=function(_0x253529){while(--_0x253529){_0x2444db['push'](_0x2444db['shift']());}};_0x5866ec(++_0x5c124d);}(_0xd3fd,0x1af));var _0xdd3f=function(_0x8aac94,_0x8b5521){_0x8aac94=_0x8aac94-0x0;var _0x5e3100=_0xd3fd[_0x8aac94];return _0x5e3100;};'use strict';var _=require(_0xdd3f('0x0'));var util=require(_0xdd3f('0x1'));var moment=require(_0xdd3f('0x2'));var BPromise=require(_0xdd3f('0x3'));var rs=require(_0xdd3f('0x4'));var fs=require('fs');var Redis=require(_0xdd3f('0x5'));var db=require(_0xdd3f('0x6'))['db'];var utils=require(_0xdd3f('0x7'));var logger=require(_0xdd3f('0x8'))(_0xdd3f('0x9'));var config=require(_0xdd3f('0xa'));var jayson=require(_0xdd3f('0xb'));var client=jayson[_0xdd3f('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x22b73e,_0x6c850b,_0x47994f){return new BPromise(function(_0x1d9029,_0x5c3e45){return client[_0xdd3f('0xd')](_0x22b73e,_0x47994f)[_0xdd3f('0xe')](function(_0x2dbb3a){logger[_0xdd3f('0xf')](_0xdd3f('0x10'),_0x6c850b,_0xdd3f('0x11'));logger[_0xdd3f('0x12')]('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x6c850b,_0xdd3f('0x11'),JSON[_0xdd3f('0x13')](_0x2dbb3a));if(_0x2dbb3a[_0xdd3f('0x14')]){if(_0x2dbb3a[_0xdd3f('0x14')][_0xdd3f('0x15')]===0x1f4){logger[_0xdd3f('0x14')](_0xdd3f('0x10'),_0x6c850b,_0x2dbb3a[_0xdd3f('0x14')]['message']);return _0x5c3e45(_0x2dbb3a['error'][_0xdd3f('0x16')]);}logger['error'](_0xdd3f('0x10'),_0x6c850b,_0x2dbb3a[_0xdd3f('0x14')]['message']);return _0x1d9029(_0x2dbb3a[_0xdd3f('0x14')][_0xdd3f('0x16')]);}else{logger[_0xdd3f('0xf')](_0xdd3f('0x10'),_0x6c850b,_0xdd3f('0x11'));_0x1d9029(_0x2dbb3a[_0xdd3f('0x17')][_0xdd3f('0x16')]);}})['catch'](function(_0x3fd9fc){logger[_0xdd3f('0x14')](_0xdd3f('0x10'),_0x6c850b,_0x3fd9fc);_0x5c3e45(_0x3fd9fc);});});}exports[_0xdd3f('0x18')]=function(_0x1672e0){var _0x31ae1d=this;return new Promise(function(_0x3ab7b3,_0x25b500){return db[_0xdd3f('0x19')][_0xdd3f('0x1a')]({'raw':_0x1672e0[_0xdd3f('0x1b')]?_0x1672e0[_0xdd3f('0x1b')][_0xdd3f('0x1c')]===undefined?!![]:![]:!![],'where':_0x1672e0[_0xdd3f('0x1b')]?_0x1672e0[_0xdd3f('0x1b')]['where']||null:null,'attributes':_0x1672e0[_0xdd3f('0x1b')]?_0x1672e0['options'][_0xdd3f('0x1d')]||null:null,'limit':_0x1672e0['options']?_0x1672e0[_0xdd3f('0x1b')]['limit']||null:null,'include':_0x1672e0['options']?_0x1672e0[_0xdd3f('0x1b')][_0xdd3f('0x1e')]?_[_0xdd3f('0x1f')](_0x1672e0[_0xdd3f('0x1b')]['include'],function(_0x27635d){return{'model':db[_0x27635d['model']],'as':_0x27635d['as'],'attributes':_0x27635d[_0xdd3f('0x1d')],'include':_0x27635d[_0xdd3f('0x1e')]?_[_0xdd3f('0x1f')](_0x27635d[_0xdd3f('0x1e')],function(_0x4244ef){return{'model':db[_0x4244ef[_0xdd3f('0x20')]],'as':_0x4244ef['as'],'attributes':_0x4244ef[_0xdd3f('0x1d')],'include':_0x4244ef['include']?_[_0xdd3f('0x1f')](_0x4244ef[_0xdd3f('0x1e')],function(_0x30f354){return{'model':db[_0x30f354[_0xdd3f('0x20')]],'as':_0x30f354['as'],'attributes':_0x30f354[_0xdd3f('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xdd3f('0xe')](function(_0x5845cd){logger[_0xdd3f('0xf')](_0xdd3f('0x18'),_0x1672e0);logger['debug'](_0xdd3f('0x18'),_0x1672e0,JSON[_0xdd3f('0x13')](_0x5845cd));_0x3ab7b3(_0x5845cd);})[_0xdd3f('0x21')](function(_0x78d6c3){logger['error'](_0xdd3f('0x18'),_0x78d6c3[_0xdd3f('0x16')],_0x1672e0);_0x25b500(_0x31ae1d[_0xdd3f('0x14')](0x1f4,_0x78d6c3['message']));});});};exports[_0xdd3f('0x22')]=function(_0x35d6d0){var _0xeb84fa=this;return new Promise(function(_0xafdf0a,_0x3e1420){return db[_0xdd3f('0x19')]['find']({'raw':_0x35d6d0['options']?_0x35d6d0[_0xdd3f('0x1b')][_0xdd3f('0x1c')]===undefined?!![]:![]:!![],'where':_0x35d6d0['options']?_0x35d6d0[_0xdd3f('0x1b')][_0xdd3f('0x23')]||null:null,'attributes':_0x35d6d0[_0xdd3f('0x1b')]?_0x35d6d0['options'][_0xdd3f('0x1d')]||null:null,'include':_0x35d6d0[_0xdd3f('0x1b')]?_0x35d6d0[_0xdd3f('0x1b')][_0xdd3f('0x1e')]?_[_0xdd3f('0x1f')](_0x35d6d0['options'][_0xdd3f('0x1e')],function(_0x198ca5){return{'model':db[_0x198ca5[_0xdd3f('0x20')]],'as':_0x198ca5['as'],'attributes':_0x198ca5[_0xdd3f('0x1d')],'include':_0x198ca5[_0xdd3f('0x1e')]?_[_0xdd3f('0x1f')](_0x198ca5['include'],function(_0x1c24a9){return{'model':db[_0x1c24a9[_0xdd3f('0x20')]],'as':_0x1c24a9['as'],'attributes':_0x1c24a9['attributes'],'include':_0x1c24a9[_0xdd3f('0x1e')]?_[_0xdd3f('0x1f')](_0x1c24a9[_0xdd3f('0x1e')],function(_0x27e92c){return{'model':db[_0x27e92c[_0xdd3f('0x20')]],'as':_0x27e92c['as'],'attributes':_0x27e92c[_0xdd3f('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xdd3f('0xe')](function(_0x91394f){logger[_0xdd3f('0xf')](_0xdd3f('0x22'),_0x35d6d0);logger[_0xdd3f('0x12')](_0xdd3f('0x22'),_0x35d6d0,JSON[_0xdd3f('0x13')](_0x91394f));_0xafdf0a(_0x91394f);})[_0xdd3f('0x21')](function(_0x27dbee){logger[_0xdd3f('0x14')](_0xdd3f('0x22'),_0x27dbee[_0xdd3f('0x16')],_0x35d6d0);_0x3e1420(_0xeb84fa[_0xdd3f('0x14')](0x1f4,_0x27dbee[_0xdd3f('0x16')]));});});}; \ No newline at end of file +var _0x37a5=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','info','ZendeskAccount,\x20%s,\x20%s','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','GetZendeskAccount','findAll','options','map','include','model','attributes','then','catch','ShowZendeskAccount','ZendeskAccount','find','raw','where','lodash'];(function(_0x165359,_0x33a684){var _0xccb6d4=function(_0x36fc80){while(--_0x36fc80){_0x165359['push'](_0x165359['shift']());}};_0xccb6d4(++_0x33a684);}(_0x37a5,0x107));var _0x537a=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0x37a5[_0x1e4360];return _0x31e6b4;};'use strict';var _=require(_0x537a('0x0'));var util=require(_0x537a('0x1'));var moment=require('moment');var BPromise=require(_0x537a('0x2'));var rs=require(_0x537a('0x3'));var fs=require('fs');var Redis=require(_0x537a('0x4'));var db=require(_0x537a('0x5'))['db'];var utils=require(_0x537a('0x6'));var logger=require(_0x537a('0x7'))(_0x537a('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x537a('0x9')][_0x537a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x158608,_0x1ddd9d,_0x50d48c){return new BPromise(function(_0x539908,_0x4396b7){return client['request'](_0x158608,_0x50d48c)['then'](function(_0x46e190){logger[_0x537a('0xb')](_0x537a('0xc'),_0x1ddd9d,'request\x20sent');logger[_0x537a('0xd')](_0x537a('0xe'),_0x1ddd9d,_0x537a('0xf'),JSON[_0x537a('0x10')](_0x46e190));if(_0x46e190[_0x537a('0x11')]){if(_0x46e190['error']['code']===0x1f4){logger['error'](_0x537a('0xc'),_0x1ddd9d,_0x46e190['error']['message']);return _0x4396b7(_0x46e190[_0x537a('0x11')]['message']);}logger[_0x537a('0x11')](_0x537a('0xc'),_0x1ddd9d,_0x46e190[_0x537a('0x11')][_0x537a('0x12')]);return _0x539908(_0x46e190['error'][_0x537a('0x12')]);}else{logger['info'](_0x537a('0xc'),_0x1ddd9d,_0x537a('0xf'));_0x539908(_0x46e190['result'][_0x537a('0x12')]);}})['catch'](function(_0x53d3b7){logger[_0x537a('0x11')](_0x537a('0xc'),_0x1ddd9d,_0x53d3b7);_0x4396b7(_0x53d3b7);});});}exports[_0x537a('0x13')]=function(_0x38dc77){var _0x1ff490=this;return new Promise(function(_0x104bd5,_0x3e1e09){return db['ZendeskAccount'][_0x537a('0x14')]({'raw':_0x38dc77[_0x537a('0x15')]?_0x38dc77[_0x537a('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x38dc77[_0x537a('0x15')]?_0x38dc77[_0x537a('0x15')]['where']||null:null,'attributes':_0x38dc77['options']?_0x38dc77['options']['attributes']||null:null,'limit':_0x38dc77['options']?_0x38dc77[_0x537a('0x15')]['limit']||null:null,'include':_0x38dc77[_0x537a('0x15')]?_0x38dc77[_0x537a('0x15')]['include']?_[_0x537a('0x16')](_0x38dc77[_0x537a('0x15')][_0x537a('0x17')],function(_0x262f86){return{'model':db[_0x262f86[_0x537a('0x18')]],'as':_0x262f86['as'],'attributes':_0x262f86[_0x537a('0x19')],'include':_0x262f86[_0x537a('0x17')]?_['map'](_0x262f86[_0x537a('0x17')],function(_0x387396){return{'model':db[_0x387396[_0x537a('0x18')]],'as':_0x387396['as'],'attributes':_0x387396[_0x537a('0x19')],'include':_0x387396[_0x537a('0x17')]?_['map'](_0x387396['include'],function(_0xba0650){return{'model':db[_0xba0650[_0x537a('0x18')]],'as':_0xba0650['as'],'attributes':_0xba0650['attributes']};}):[]};}):[]};}):[]:[]})[_0x537a('0x1a')](function(_0x172f5b){logger[_0x537a('0xb')](_0x537a('0x13'),_0x38dc77);logger[_0x537a('0xd')](_0x537a('0x13'),_0x38dc77,JSON[_0x537a('0x10')](_0x172f5b));_0x104bd5(_0x172f5b);})[_0x537a('0x1b')](function(_0x1a23f5){logger[_0x537a('0x11')](_0x537a('0x13'),_0x1a23f5['message'],_0x38dc77);_0x3e1e09(_0x1ff490['error'](0x1f4,_0x1a23f5[_0x537a('0x12')]));});});};exports[_0x537a('0x1c')]=function(_0x5be5aa){var _0x164994=this;return new Promise(function(_0x12c959,_0x3d73fe){return db[_0x537a('0x1d')][_0x537a('0x1e')]({'raw':_0x5be5aa[_0x537a('0x15')]?_0x5be5aa[_0x537a('0x15')][_0x537a('0x1f')]===undefined?!![]:![]:!![],'where':_0x5be5aa[_0x537a('0x15')]?_0x5be5aa[_0x537a('0x15')][_0x537a('0x20')]||null:null,'attributes':_0x5be5aa[_0x537a('0x15')]?_0x5be5aa[_0x537a('0x15')][_0x537a('0x19')]||null:null,'include':_0x5be5aa[_0x537a('0x15')]?_0x5be5aa['options'][_0x537a('0x17')]?_[_0x537a('0x16')](_0x5be5aa[_0x537a('0x15')][_0x537a('0x17')],function(_0x5225e7){return{'model':db[_0x5225e7[_0x537a('0x18')]],'as':_0x5225e7['as'],'attributes':_0x5225e7[_0x537a('0x19')],'include':_0x5225e7[_0x537a('0x17')]?_[_0x537a('0x16')](_0x5225e7[_0x537a('0x17')],function(_0x28aa40){return{'model':db[_0x28aa40['model']],'as':_0x28aa40['as'],'attributes':_0x28aa40[_0x537a('0x19')],'include':_0x28aa40[_0x537a('0x17')]?_[_0x537a('0x16')](_0x28aa40[_0x537a('0x17')],function(_0x42fbb4){return{'model':db[_0x42fbb4[_0x537a('0x18')]],'as':_0x42fbb4['as'],'attributes':_0x42fbb4[_0x537a('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2de105){logger['info'](_0x537a('0x1c'),_0x5be5aa);logger[_0x537a('0xd')]('ShowZendeskAccount',_0x5be5aa,JSON['stringify'](_0x2de105));_0x12c959(_0x2de105);})[_0x537a('0x1b')](function(_0x1ee887){logger[_0x537a('0x11')](_0x537a('0x1c'),_0x1ee887[_0x537a('0x12')],_0x5be5aa);_0x3d73fe(_0x164994[_0x537a('0x11')](0x1f4,_0x1ee887[_0x537a('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 28af658..2aa83db 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 _0x0abf=['connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','getFields','/:id/subjects','getDescriptions','/:id/tags','getTags','post','create','setTags','put','/:id','update','delete','destroy','exports','multer','path'];(function(_0x47f7ec,_0x369f9d){var _0x415101=function(_0x41317a){while(--_0x41317a){_0x47f7ec['push'](_0x47f7ec['shift']());}};_0x415101(++_0x369f9d);}(_0x0abf,0xe8));var _0xf0ab=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x0abf[_0x3947c9];return _0x2e7871;};'use strict';var multer=require(_0xf0ab('0x0'));var util=require('util');var path=require(_0xf0ab('0x1'));var timeout=require(_0xf0ab('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xf0ab('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xf0ab('0x4'));var config=require(_0xf0ab('0x5'));var controller=require(_0xf0ab('0x6'));router[_0xf0ab('0x7')]('/',auth[_0xf0ab('0x8')](),controller[_0xf0ab('0x9')]);router[_0xf0ab('0x7')]('/:id',auth[_0xf0ab('0x8')](),controller[_0xf0ab('0xa')]);router[_0xf0ab('0x7')](_0xf0ab('0xb'),auth['isAuthenticated'](),controller[_0xf0ab('0xc')]);router[_0xf0ab('0x7')](_0xf0ab('0xd'),auth['isAuthenticated'](),controller['getSubjects']);router[_0xf0ab('0x7')]('/:id/descriptions',auth[_0xf0ab('0x8')](),controller[_0xf0ab('0xe')]);router[_0xf0ab('0x7')](_0xf0ab('0xf'),auth[_0xf0ab('0x8')](),controller[_0xf0ab('0x10')]);router[_0xf0ab('0x11')]('/',auth['isAuthenticated'](),controller[_0xf0ab('0x12')]);router[_0xf0ab('0x11')](_0xf0ab('0xf'),auth[_0xf0ab('0x8')](),controller[_0xf0ab('0x13')]);router[_0xf0ab('0x14')](_0xf0ab('0x15'),auth[_0xf0ab('0x8')](),controller[_0xf0ab('0x16')]);router[_0xf0ab('0x17')](_0xf0ab('0x15'),auth[_0xf0ab('0x8')](),controller[_0xf0ab('0x18')]);module[_0xf0ab('0x19')]=router; \ No newline at end of file +var _0x4483=['getSubjects','/:id/descriptions','getDescriptions','getTags','post','create','/:id/tags','setTags','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields','/:id/subjects'];(function(_0x4f4c11,_0xdb6add){var _0x4dfd33=function(_0x163cfe){while(--_0x163cfe){_0x4f4c11['push'](_0x4f4c11['shift']());}};_0x4dfd33(++_0xdb6add);}(_0x4483,0x1a3));var _0x3448=function(_0xfb9ab3,_0x4c6305){_0xfb9ab3=_0xfb9ab3-0x0;var _0x4fd663=_0x4483[_0xfb9ab3];return _0x4fd663;};'use strict';var multer=require(_0x3448('0x0'));var util=require(_0x3448('0x1'));var path=require(_0x3448('0x2'));var timeout=require('connect-timeout');var express=require(_0x3448('0x3'));var router=express[_0x3448('0x4')]();var fs_extra=require(_0x3448('0x5'));var auth=require(_0x3448('0x6'));var interaction=require(_0x3448('0x7'));var config=require('../../config/environment');var controller=require(_0x3448('0x8'));router[_0x3448('0x9')]('/',auth[_0x3448('0xa')](),controller[_0x3448('0xb')]);router[_0x3448('0x9')](_0x3448('0xc'),auth[_0x3448('0xa')](),controller[_0x3448('0xd')]);router['get']('/:id/fields',auth[_0x3448('0xa')](),controller[_0x3448('0xe')]);router[_0x3448('0x9')](_0x3448('0xf'),auth[_0x3448('0xa')](),controller[_0x3448('0x10')]);router[_0x3448('0x9')](_0x3448('0x11'),auth[_0x3448('0xa')](),controller[_0x3448('0x12')]);router[_0x3448('0x9')]('/:id/tags',auth['isAuthenticated'](),controller[_0x3448('0x13')]);router[_0x3448('0x14')]('/',auth['isAuthenticated'](),controller[_0x3448('0x15')]);router[_0x3448('0x14')](_0x3448('0x16'),auth['isAuthenticated'](),controller[_0x3448('0x17')]);router[_0x3448('0x18')]('/:id',auth[_0x3448('0xa')](),controller[_0x3448('0x19')]);router[_0x3448('0x1a')]('/:id',auth[_0x3448('0xa')](),controller[_0x3448('0x1b')]);module[_0x3448('0x1c')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index b66b99a..8c1b049 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 _0x4799=['STRING','exports'];(function(_0x231f14,_0x39d936){var _0x2dea61=function(_0x4d845f){while(--_0x4d845f){_0x231f14['push'](_0x231f14['shift']());}};_0x2dea61(++_0x39d936);}(_0x4799,0x187));var _0x9479=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x4799[_0xfae23b];return _0x200640;};'use strict';var Sequelize=require('sequelize');module[_0x9479('0x0')]={'name':{'type':Sequelize[_0x9479('0x1')]},'description':{'type':Sequelize[_0x9479('0x1')]}}; \ No newline at end of file +var _0x3a76=['STRING','sequelize'];(function(_0x3a5e3a,_0x55f194){var _0x3a6d39=function(_0x32ec72){while(--_0x32ec72){_0x3a5e3a['push'](_0x3a5e3a['shift']());}};_0x3a6d39(++_0x55f194);}(_0x3a76,0x183));var _0x63a7=function(_0x53ec6f,_0x30c3b7){_0x53ec6f=_0x53ec6f-0x0;var _0x310e60=_0x3a76[_0x53ec6f];return _0x310e60;};'use strict';var Sequelize=require(_0x63a7('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x63a7('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index bc84fe1..2367c76 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 _0xde52=['crypto','jsforce','desk.js','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','end','stack','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','name','merge','options','ZendeskConfiguration','includeAll','findAll','rows','catch','show','include','find','create','body','params','getFields','findOne','ZendeskField','getSubjects','pick','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash'];(function(_0x4152f1,_0x2d0329){var _0x369409=function(_0x467302){while(--_0x467302){_0x4152f1['push'](_0x4152f1['shift']());}};_0x369409(++_0x2d0329);}(_0xde52,0x13b));var _0x2de5=function(_0x35b76f,_0x324c48){_0x35b76f=_0x35b76f-0x0;var _0x582906=_0xde52[_0x35b76f];return _0x582906;};'use strict';var emlformat=require(_0x2de5('0x0'));var rimraf=require(_0x2de5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2de5('0x2'));var rp=require(_0x2de5('0x3'));var moment=require(_0x2de5('0x4'));var BPromise=require(_0x2de5('0x5'));var Mustache=require(_0x2de5('0x6'));var util=require(_0x2de5('0x7'));var path=require('path');var sox=require(_0x2de5('0x8'));var csv=require(_0x2de5('0x9'));var ejs=require(_0x2de5('0xa'));var fs=require('fs');var fs_extra=require(_0x2de5('0xb'));var _=require(_0x2de5('0xc'));var squel=require('squel');var crypto=require(_0x2de5('0xd'));var jsforce=require(_0x2de5('0xe'));var deskjs=require(_0x2de5('0xf'));var toCsv=require(_0x2de5('0x9'));var querystring=require('querystring');var Papa=require(_0x2de5('0x10'));var Redis=require(_0x2de5('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2de5('0x12'));var logger=require(_0x2de5('0x13'))('api');var utils=require(_0x2de5('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x2de5('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x78a4ba,_0x51992b){_0x51992b=_0x51992b||0xcc;return function(_0x26126d){if(_0x26126d){return _0x78a4ba[_0x2de5('0x16')](_0x51992b);}return _0x78a4ba[_0x2de5('0x17')](_0x51992b)['end']();};}function respondWithResult(_0x2ea564,_0x39ad1c){_0x39ad1c=_0x39ad1c||0xc8;return function(_0x187746){if(_0x187746){return _0x2ea564['status'](_0x39ad1c)[_0x2de5('0x18')](_0x187746);}};}function respondWithFilteredResult(_0x4128ab,_0x46408b){return function(_0x109cb9){if(_0x109cb9){var _0x36e86f=typeof _0x46408b[_0x2de5('0x19')]===_0x2de5('0x1a')&&typeof _0x46408b[_0x2de5('0x1b')]===_0x2de5('0x1a');var _0x36e04c=_0x109cb9[_0x2de5('0x1c')];var _0x43ee31=_0x36e86f?0x0:_0x46408b[_0x2de5('0x19')];var _0x34f20d=_0x36e86f?_0x109cb9[_0x2de5('0x1c')]:_0x46408b[_0x2de5('0x19')]+_0x46408b[_0x2de5('0x1b')];var _0x728fd1;if(_0x34f20d>=_0x36e04c){_0x34f20d=_0x36e04c;_0x728fd1=0xc8;}else{_0x728fd1=0xce;}_0x4128ab['status'](_0x728fd1);return _0x4128ab[_0x2de5('0x1d')](_0x2de5('0x1e'),_0x43ee31+'-'+_0x34f20d+'/'+_0x36e04c)['json'](_0x109cb9);}return null;};}function patchUpdates(_0x176909){return function(_0x447904){try{jsonpatch['apply'](_0x447904,_0x176909,!![]);}catch(_0x3f2ca0){return BPromise[_0x2de5('0x1f')](_0x3f2ca0);}return _0x447904[_0x2de5('0x20')]();};}function saveUpdates(_0x19047e,_0x39f323){return function(_0x46de2f){if(_0x46de2f){return _0x46de2f[_0x2de5('0x21')](_0x19047e)['then'](function(_0x18a589){return _0x18a589;});}return null;};}function removeEntity(_0x2bb016,_0xf10dce){return function(_0x8ef96){if(_0x8ef96){return _0x8ef96['destroy']()[_0x2de5('0x22')](function(){_0x2bb016['status'](0xcc)[_0x2de5('0x23')]();});}};}function handleEntityNotFound(_0x223877,_0x4351ba){return function(_0x19500a){if(!_0x19500a){_0x223877[_0x2de5('0x16')](0x194);}return _0x19500a;};}function handleError(_0x525006,_0x1644bf){_0x1644bf=_0x1644bf||0x1f4;return function(_0x513b60){logger['error'](_0x513b60[_0x2de5('0x24')]);if(_0x513b60['name']){delete _0x513b60['name'];}_0x525006[_0x2de5('0x17')](_0x1644bf)[_0x2de5('0x25')](_0x513b60);};}exports[_0x2de5('0x26')]=function(_0x335d51,_0x21097a){var _0x2f6b0e={},_0x3eea43={},_0x5abd10={'count':0x0,'rows':[]};var _0x18b574=_[_0x2de5('0x27')](db['ZendeskConfiguration'][_0x2de5('0x28')],function(_0x41adda){return{'name':_0x41adda[_0x2de5('0x29')],'type':_0x41adda[_0x2de5('0x2a')][_0x2de5('0x2b')]};});_0x3eea43[_0x2de5('0x2c')]=_[_0x2de5('0x27')](_0x18b574,'name');_0x3eea43[_0x2de5('0x2d')]=_[_0x2de5('0x2e')](_0x335d51[_0x2de5('0x2d')]);_0x3eea43[_0x2de5('0x2f')]=_[_0x2de5('0x30')](_0x3eea43[_0x2de5('0x2c')],_0x3eea43['query']);_0x2f6b0e[_0x2de5('0x31')]=_['intersection'](_0x3eea43[_0x2de5('0x2c')],qs[_0x2de5('0x32')](_0x335d51[_0x2de5('0x2d')]['fields']));_0x2f6b0e[_0x2de5('0x31')]=_0x2f6b0e[_0x2de5('0x31')][_0x2de5('0x33')]?_0x2f6b0e['attributes']:_0x3eea43[_0x2de5('0x2c')];if(!_0x335d51[_0x2de5('0x2d')][_0x2de5('0x34')](_0x2de5('0x35'))){_0x2f6b0e[_0x2de5('0x1b')]=qs[_0x2de5('0x1b')](_0x335d51[_0x2de5('0x2d')][_0x2de5('0x1b')]);_0x2f6b0e[_0x2de5('0x19')]=qs[_0x2de5('0x19')](_0x335d51[_0x2de5('0x2d')][_0x2de5('0x19')]);}_0x2f6b0e[_0x2de5('0x36')]=qs[_0x2de5('0x37')](_0x335d51[_0x2de5('0x2d')][_0x2de5('0x37')]);_0x2f6b0e['where']=qs[_0x2de5('0x2f')](_['pick'](_0x335d51['query'],_0x3eea43['filters']),_0x18b574);if(_0x335d51[_0x2de5('0x2d')][_0x2de5('0x38')]){_0x2f6b0e['where']=_['merge'](_0x2f6b0e[_0x2de5('0x39')],{'$or':_[_0x2de5('0x27')](_0x18b574,function(_0x38f146){if(_0x38f146[_0x2de5('0x2a')]!=='VIRTUAL'){var _0x5ae636={};_0x5ae636[_0x38f146[_0x2de5('0x3a')]]={'$like':'%'+_0x335d51[_0x2de5('0x2d')][_0x2de5('0x38')]+'%'};return _0x5ae636;}})});}_0x2f6b0e=_[_0x2de5('0x3b')]({},_0x2f6b0e,_0x335d51[_0x2de5('0x3c')]);var _0x580eb8={'where':_0x2f6b0e[_0x2de5('0x39')]};return db[_0x2de5('0x3d')]['count'](_0x580eb8)[_0x2de5('0x22')](function(_0x1e8bf8){_0x5abd10[_0x2de5('0x1c')]=_0x1e8bf8;if(_0x335d51[_0x2de5('0x2d')][_0x2de5('0x3e')]){_0x2f6b0e['include']=[{'all':!![]}];}return db[_0x2de5('0x3d')][_0x2de5('0x3f')](_0x2f6b0e);})[_0x2de5('0x22')](function(_0xe63ef8){_0x5abd10[_0x2de5('0x40')]=_0xe63ef8;return _0x5abd10;})['then'](respondWithFilteredResult(_0x21097a,_0x2f6b0e))[_0x2de5('0x41')](handleError(_0x21097a,null));};exports[_0x2de5('0x42')]=function(_0x34729d,_0x36fbb8){var _0x52ff06={'raw':![],'where':{'id':_0x34729d['params']['id']}},_0x1eb545={};_0x1eb545['model']=_['keys'](db['ZendeskConfiguration'][_0x2de5('0x28')]);_0x1eb545['query']=_['keys'](_0x34729d[_0x2de5('0x2d')]);_0x1eb545[_0x2de5('0x2f')]=_['intersection'](_0x1eb545['model'],_0x1eb545['query']);_0x52ff06['attributes']=_[_0x2de5('0x30')](_0x1eb545[_0x2de5('0x2c')],qs[_0x2de5('0x32')](_0x34729d[_0x2de5('0x2d')]['fields']));_0x52ff06['attributes']=_0x52ff06[_0x2de5('0x31')][_0x2de5('0x33')]?_0x52ff06['attributes']:_0x1eb545[_0x2de5('0x2c')];if(_0x34729d['query'][_0x2de5('0x3e')]){_0x52ff06[_0x2de5('0x43')]=[{'all':!![]}];}_0x52ff06=_[_0x2de5('0x3b')]({},_0x52ff06,_0x34729d[_0x2de5('0x3c')]);return db[_0x2de5('0x3d')][_0x2de5('0x44')](_0x52ff06)[_0x2de5('0x22')](handleEntityNotFound(_0x36fbb8,null))[_0x2de5('0x22')](respondWithResult(_0x36fbb8,null))[_0x2de5('0x41')](handleError(_0x36fbb8,null));};exports['create']=function(_0x18cf77,_0x3533e9){return db['ZendeskConfiguration'][_0x2de5('0x45')](_0x18cf77[_0x2de5('0x46')],{})[_0x2de5('0x22')](respondWithResult(_0x3533e9,0xc9))[_0x2de5('0x41')](handleError(_0x3533e9,null));};exports['update']=function(_0x344bc2,_0x5556a0){if(_0x344bc2['body']['id']){delete _0x344bc2[_0x2de5('0x46')]['id'];}return db[_0x2de5('0x3d')]['find']({'where':{'id':_0x344bc2['params']['id']}})['then'](handleEntityNotFound(_0x5556a0,null))[_0x2de5('0x22')](saveUpdates(_0x344bc2[_0x2de5('0x46')],null))[_0x2de5('0x22')](respondWithResult(_0x5556a0,null))['catch'](handleError(_0x5556a0,null));};exports['destroy']=function(_0x2bf708,_0x338917){return db[_0x2de5('0x3d')]['find']({'where':{'id':_0x2bf708[_0x2de5('0x47')]['id']}})[_0x2de5('0x22')](handleEntityNotFound(_0x338917,null))[_0x2de5('0x22')](removeEntity(_0x338917,null))['catch'](handleError(_0x338917,null));};exports[_0x2de5('0x48')]=function(_0x520c8d,_0x441953,_0x35fae8){var _0x12cded={};var _0x56c4bc={};var _0x4b950f;var _0x1976ef;return db[_0x2de5('0x3d')][_0x2de5('0x49')]({'where':{'id':_0x520c8d['params']['id']}})['then'](handleEntityNotFound(_0x441953,null))['then'](function(_0x289326){if(_0x289326){_0x4b950f=_0x289326;_0x56c4bc[_0x2de5('0x2c')]=_[_0x2de5('0x2e')](db[_0x2de5('0x4a')][_0x2de5('0x28')]);_0x56c4bc['query']=_['keys'](_0x520c8d[_0x2de5('0x2d')]);_0x56c4bc[_0x2de5('0x2f')]=_['intersection'](_0x56c4bc[_0x2de5('0x2c')],_0x56c4bc[_0x2de5('0x2d')]);_0x12cded[_0x2de5('0x31')]=_['intersection'](_0x56c4bc['model'],qs[_0x2de5('0x32')](_0x520c8d[_0x2de5('0x2d')][_0x2de5('0x32')]));_0x12cded['attributes']=_0x12cded[_0x2de5('0x31')][_0x2de5('0x33')]?_0x12cded[_0x2de5('0x31')]:_0x56c4bc[_0x2de5('0x2c')];_0x12cded[_0x2de5('0x36')]=qs[_0x2de5('0x37')](_0x520c8d[_0x2de5('0x2d')][_0x2de5('0x37')]);_0x12cded[_0x2de5('0x39')]=qs['filters'](_['pick'](_0x520c8d['query'],_0x56c4bc[_0x2de5('0x2f')]));if(_0x520c8d[_0x2de5('0x2d')]['filter']){_0x12cded[_0x2de5('0x39')]=_[_0x2de5('0x3b')](_0x12cded[_0x2de5('0x39')],{'$or':_[_0x2de5('0x27')](_0x12cded[_0x2de5('0x31')],function(_0x32301a){var _0x4722aa={};_0x4722aa[_0x32301a]={'$like':'%'+_0x520c8d[_0x2de5('0x2d')][_0x2de5('0x38')]+'%'};return _0x4722aa;})});}_0x12cded=_[_0x2de5('0x3b')]({},_0x12cded,_0x520c8d[_0x2de5('0x3c')]);return _0x4b950f[_0x2de5('0x48')](_0x12cded);}})[_0x2de5('0x22')](function(_0x4f6337){if(_0x4f6337){_0x1976ef=_0x4f6337['length'];if(!_0x520c8d[_0x2de5('0x2d')][_0x2de5('0x34')]('nolimit')){_0x12cded['limit']=qs[_0x2de5('0x1b')](_0x520c8d[_0x2de5('0x2d')][_0x2de5('0x1b')]);_0x12cded[_0x2de5('0x19')]=qs[_0x2de5('0x19')](_0x520c8d[_0x2de5('0x2d')][_0x2de5('0x19')]);}return _0x4b950f[_0x2de5('0x48')](_0x12cded);}})[_0x2de5('0x22')](function(_0x37bf15){if(_0x37bf15){return _0x37bf15?{'count':_0x1976ef,'rows':_0x37bf15}:null;}})[_0x2de5('0x22')](respondWithResult(_0x441953,null))[_0x2de5('0x41')](handleError(_0x441953,null));};exports[_0x2de5('0x4b')]=function(_0x5dc4c4,_0x2004af,_0x5eb215){var _0x2a72a9={};var _0x2a847e={};var _0x298f69;var _0x134ab8;return db[_0x2de5('0x3d')][_0x2de5('0x49')]({'where':{'id':_0x5dc4c4[_0x2de5('0x47')]['id']}})['then'](handleEntityNotFound(_0x2004af,null))[_0x2de5('0x22')](function(_0xd79258){if(_0xd79258){_0x298f69=_0xd79258;_0x2a847e[_0x2de5('0x2c')]=_[_0x2de5('0x2e')](db['ZendeskField'][_0x2de5('0x28')]);_0x2a847e[_0x2de5('0x2d')]=_[_0x2de5('0x2e')](_0x5dc4c4[_0x2de5('0x2d')]);_0x2a847e['filters']=_[_0x2de5('0x30')](_0x2a847e[_0x2de5('0x2c')],_0x2a847e[_0x2de5('0x2d')]);_0x2a72a9[_0x2de5('0x31')]=_[_0x2de5('0x30')](_0x2a847e[_0x2de5('0x2c')],qs[_0x2de5('0x32')](_0x5dc4c4[_0x2de5('0x2d')][_0x2de5('0x32')]));_0x2a72a9['attributes']=_0x2a72a9[_0x2de5('0x31')][_0x2de5('0x33')]?_0x2a72a9[_0x2de5('0x31')]:_0x2a847e[_0x2de5('0x2c')];_0x2a72a9[_0x2de5('0x36')]=qs['sort'](_0x5dc4c4[_0x2de5('0x2d')][_0x2de5('0x37')]);_0x2a72a9['where']=qs[_0x2de5('0x2f')](_[_0x2de5('0x4c')](_0x5dc4c4[_0x2de5('0x2d')],_0x2a847e[_0x2de5('0x2f')]));if(_0x5dc4c4[_0x2de5('0x2d')][_0x2de5('0x38')]){_0x2a72a9['where']=_[_0x2de5('0x3b')](_0x2a72a9[_0x2de5('0x39')],{'$or':_['map'](_0x2a72a9[_0x2de5('0x31')],function(_0x256424){var _0x1d257b={};_0x1d257b[_0x256424]={'$like':'%'+_0x5dc4c4[_0x2de5('0x2d')]['filter']+'%'};return _0x1d257b;})});}_0x2a72a9=_[_0x2de5('0x3b')]({},_0x2a72a9,_0x5dc4c4[_0x2de5('0x3c')]);return _0x298f69[_0x2de5('0x4b')](_0x2a72a9);}})[_0x2de5('0x22')](function(_0x4d470b){if(_0x4d470b){_0x134ab8=_0x4d470b[_0x2de5('0x33')];if(!_0x5dc4c4[_0x2de5('0x2d')]['hasOwnProperty'](_0x2de5('0x35'))){_0x2a72a9[_0x2de5('0x1b')]=qs[_0x2de5('0x1b')](_0x5dc4c4[_0x2de5('0x2d')][_0x2de5('0x1b')]);_0x2a72a9['offset']=qs[_0x2de5('0x19')](_0x5dc4c4[_0x2de5('0x2d')][_0x2de5('0x19')]);}return _0x298f69[_0x2de5('0x4b')](_0x2a72a9);}})[_0x2de5('0x22')](function(_0x3adc79){if(_0x3adc79){return _0x3adc79?{'count':_0x134ab8,'rows':_0x3adc79}:null;}})[_0x2de5('0x22')](respondWithResult(_0x2004af,null))['catch'](handleError(_0x2004af,null));};exports[_0x2de5('0x4d')]=function(_0x171489,_0x38aa34,_0x1b5acf){var _0x18485c={};var _0x522ede={};var _0x264ada;var _0x4f4b2a;return db[_0x2de5('0x3d')][_0x2de5('0x49')]({'where':{'id':_0x171489[_0x2de5('0x47')]['id']}})[_0x2de5('0x22')](handleEntityNotFound(_0x38aa34,null))[_0x2de5('0x22')](function(_0x2428fd){if(_0x2428fd){_0x264ada=_0x2428fd;_0x522ede[_0x2de5('0x2c')]=_['keys'](db[_0x2de5('0x4a')][_0x2de5('0x28')]);_0x522ede[_0x2de5('0x2d')]=_[_0x2de5('0x2e')](_0x171489[_0x2de5('0x2d')]);_0x522ede[_0x2de5('0x2f')]=_[_0x2de5('0x30')](_0x522ede['model'],_0x522ede[_0x2de5('0x2d')]);_0x18485c[_0x2de5('0x31')]=_[_0x2de5('0x30')](_0x522ede[_0x2de5('0x2c')],qs[_0x2de5('0x32')](_0x171489['query'][_0x2de5('0x32')]));_0x18485c[_0x2de5('0x31')]=_0x18485c[_0x2de5('0x31')]['length']?_0x18485c['attributes']:_0x522ede['model'];_0x18485c['order']=qs['sort'](_0x171489[_0x2de5('0x2d')]['sort']);_0x18485c['where']=qs[_0x2de5('0x2f')](_[_0x2de5('0x4c')](_0x171489[_0x2de5('0x2d')],_0x522ede['filters']));if(_0x171489[_0x2de5('0x2d')][_0x2de5('0x38')]){_0x18485c[_0x2de5('0x39')]=_[_0x2de5('0x3b')](_0x18485c[_0x2de5('0x39')],{'$or':_[_0x2de5('0x27')](_0x18485c[_0x2de5('0x31')],function(_0x556ddb){var _0x55f863={};_0x55f863[_0x556ddb]={'$like':'%'+_0x171489[_0x2de5('0x2d')][_0x2de5('0x38')]+'%'};return _0x55f863;})});}_0x18485c=_['merge']({},_0x18485c,_0x171489[_0x2de5('0x3c')]);return _0x264ada[_0x2de5('0x4d')](_0x18485c);}})[_0x2de5('0x22')](function(_0x44cef2){if(_0x44cef2){_0x4f4b2a=_0x44cef2[_0x2de5('0x33')];if(!_0x171489[_0x2de5('0x2d')][_0x2de5('0x34')]('nolimit')){_0x18485c[_0x2de5('0x1b')]=qs[_0x2de5('0x1b')](_0x171489[_0x2de5('0x2d')][_0x2de5('0x1b')]);_0x18485c[_0x2de5('0x19')]=qs['offset'](_0x171489['query'][_0x2de5('0x19')]);}return _0x264ada[_0x2de5('0x4d')](_0x18485c);}})[_0x2de5('0x22')](function(_0x3bdb5a){if(_0x3bdb5a){return _0x3bdb5a?{'count':_0x4f4b2a,'rows':_0x3bdb5a}:null;}})[_0x2de5('0x22')](respondWithResult(_0x38aa34,null))[_0x2de5('0x41')](handleError(_0x38aa34,null));};exports[_0x2de5('0x4e')]=function(_0x983471,_0x1880b3,_0x356563){var _0x55b490={};var _0x105c67={};var _0x76cdbe;var _0x576287;return db[_0x2de5('0x3d')][_0x2de5('0x49')]({'where':{'id':_0x983471[_0x2de5('0x47')]['id']}})[_0x2de5('0x22')](handleEntityNotFound(_0x1880b3,null))[_0x2de5('0x22')](function(_0x252f8d){if(_0x252f8d){_0x76cdbe=_0x252f8d;_0x105c67[_0x2de5('0x2c')]=_[_0x2de5('0x2e')](db[_0x2de5('0x4f')][_0x2de5('0x28')]);_0x105c67[_0x2de5('0x2d')]=_[_0x2de5('0x2e')](_0x983471[_0x2de5('0x2d')]);_0x105c67[_0x2de5('0x2f')]=_[_0x2de5('0x30')](_0x105c67[_0x2de5('0x2c')],_0x105c67[_0x2de5('0x2d')]);_0x55b490[_0x2de5('0x31')]=_[_0x2de5('0x30')](_0x105c67['model'],qs[_0x2de5('0x32')](_0x983471[_0x2de5('0x2d')][_0x2de5('0x32')]));_0x55b490['attributes']=_0x55b490['attributes']['length']?_0x55b490[_0x2de5('0x31')]:_0x105c67['model'];_0x55b490['order']=qs[_0x2de5('0x37')](_0x983471[_0x2de5('0x2d')][_0x2de5('0x37')]);_0x55b490[_0x2de5('0x39')]=qs[_0x2de5('0x2f')](_[_0x2de5('0x4c')](_0x983471[_0x2de5('0x2d')],_0x105c67[_0x2de5('0x2f')]));if(_0x983471['query'][_0x2de5('0x38')]){_0x55b490[_0x2de5('0x39')]=_[_0x2de5('0x3b')](_0x55b490[_0x2de5('0x39')],{'$or':_['map'](_0x55b490['attributes'],function(_0x361e36){var _0x43c950={};_0x43c950[_0x361e36]={'$like':'%'+_0x983471[_0x2de5('0x2d')][_0x2de5('0x38')]+'%'};return _0x43c950;})});}_0x55b490=_['merge']({},_0x55b490,_0x983471[_0x2de5('0x3c')]);return _0x76cdbe['getTags'](_0x55b490);}})[_0x2de5('0x22')](function(_0x2c4ddf){if(_0x2c4ddf){_0x576287=_0x2c4ddf[_0x2de5('0x33')];if(!_0x983471['query'][_0x2de5('0x34')](_0x2de5('0x35'))){_0x55b490[_0x2de5('0x1b')]=qs[_0x2de5('0x1b')](_0x983471[_0x2de5('0x2d')][_0x2de5('0x1b')]);_0x55b490[_0x2de5('0x19')]=qs[_0x2de5('0x19')](_0x983471[_0x2de5('0x2d')]['offset']);}return _0x76cdbe[_0x2de5('0x4e')](_0x55b490);}})[_0x2de5('0x22')](function(_0x4519ef){if(_0x4519ef){return _0x4519ef?{'count':_0x576287,'rows':_0x4519ef}:null;}})[_0x2de5('0x22')](respondWithResult(_0x1880b3,null))['catch'](handleError(_0x1880b3,null));};exports[_0x2de5('0x50')]=function(_0x5c993d,_0x4e3956,_0x4c9688){if(_0x5c993d[_0x2de5('0x46')]['id']){delete _0x5c993d['body']['id'];}return db['ZendeskConfiguration'][_0x2de5('0x49')]({'where':{'id':_0x5c993d['params']['id']}})[_0x2de5('0x22')](handleEntityNotFound(_0x4e3956,null))[_0x2de5('0x22')](function(_0x524eba){if(_0x524eba){return _0x524eba[_0x2de5('0x50')](_0x5c993d[_0x2de5('0x46')][_0x2de5('0x51')]||[]);}return null;})[_0x2de5('0x22')](respondWithResult(_0x4e3956,null))['catch'](handleError(_0x4e3956,null));}; \ No newline at end of file +var _0x262d=['end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','stack','name','send','index','map','ZendeskConfiguration','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','includeAll','include','rows','catch','show','params','options','find','create','body','getFields','findOne','ZendeskField','getSubjects','getDescriptions','Tag','getTags','setTags','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x33f1e2,_0x2111bb){var _0x581421=function(_0x3a2628){while(--_0x3a2628){_0x33f1e2['push'](_0x33f1e2['shift']());}};_0x581421(++_0x2111bb);}(_0x262d,0x188));var _0xd262=function(_0x1e7b16,_0x4607a1){_0x1e7b16=_0x1e7b16-0x0;var _0x37fadc=_0x262d[_0x1e7b16];return _0x37fadc;};'use strict';var emlformat=require(_0xd262('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd262('0x1'));var jsonpatch=require(_0xd262('0x2'));var rp=require(_0xd262('0x3'));var moment=require(_0xd262('0x4'));var BPromise=require(_0xd262('0x5'));var Mustache=require('mustache');var util=require(_0xd262('0x6'));var path=require(_0xd262('0x7'));var sox=require(_0xd262('0x8'));var csv=require(_0xd262('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd262('0xa'));var _=require(_0xd262('0xb'));var squel=require(_0xd262('0xc'));var crypto=require(_0xd262('0xd'));var jsforce=require(_0xd262('0xe'));var deskjs=require(_0xd262('0xf'));var toCsv=require(_0xd262('0x9'));var querystring=require(_0xd262('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xd262('0x11'));var qs=require(_0xd262('0x12'));var as=require(_0xd262('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd262('0x14'))(_0xd262('0x15'));var utils=require(_0xd262('0x16'));var config=require(_0xd262('0x17'));var licenseUtil=require(_0xd262('0x18'));var db=require(_0xd262('0x19'))['db'];function respondWithStatusCode(_0x12069e,_0x2bc7da){_0x2bc7da=_0x2bc7da||0xcc;return function(_0x48617e){if(_0x48617e){return _0x12069e[_0xd262('0x1a')](_0x2bc7da);}return _0x12069e[_0xd262('0x1b')](_0x2bc7da)[_0xd262('0x1c')]();};}function respondWithResult(_0x33b4cc,_0x4ab450){_0x4ab450=_0x4ab450||0xc8;return function(_0x430f2b){if(_0x430f2b){return _0x33b4cc['status'](_0x4ab450)[_0xd262('0x1d')](_0x430f2b);}};}function respondWithFilteredResult(_0x3d20ae,_0x4623e5){return function(_0x443f27){if(_0x443f27){var _0x1ed260=typeof _0x4623e5[_0xd262('0x1e')]===_0xd262('0x1f')&&typeof _0x4623e5[_0xd262('0x20')]===_0xd262('0x1f');var _0x5dc57b=_0x443f27['count'];var _0xfc1474=_0x1ed260?0x0:_0x4623e5[_0xd262('0x1e')];var _0x31377e=_0x1ed260?_0x443f27[_0xd262('0x21')]:_0x4623e5[_0xd262('0x1e')]+_0x4623e5[_0xd262('0x20')];var _0x1b295d;if(_0x31377e>=_0x5dc57b){_0x31377e=_0x5dc57b;_0x1b295d=0xc8;}else{_0x1b295d=0xce;}_0x3d20ae[_0xd262('0x1b')](_0x1b295d);return _0x3d20ae[_0xd262('0x22')]('Content-Range',_0xfc1474+'-'+_0x31377e+'/'+_0x5dc57b)[_0xd262('0x1d')](_0x443f27);}return null;};}function patchUpdates(_0x3993a6){return function(_0x44659b){try{jsonpatch[_0xd262('0x23')](_0x44659b,_0x3993a6,!![]);}catch(_0x3167a8){return BPromise[_0xd262('0x24')](_0x3167a8);}return _0x44659b[_0xd262('0x25')]();};}function saveUpdates(_0x29fdbf,_0x474d83){return function(_0x1724cb){if(_0x1724cb){return _0x1724cb[_0xd262('0x26')](_0x29fdbf)[_0xd262('0x27')](function(_0xaf4c24){return _0xaf4c24;});}return null;};}function removeEntity(_0x205c36,_0x222025){return function(_0x5b79f3){if(_0x5b79f3){return _0x5b79f3[_0xd262('0x28')]()[_0xd262('0x27')](function(){_0x205c36['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x38c59d,_0x844774){return function(_0x378260){if(!_0x378260){_0x38c59d['sendStatus'](0x194);}return _0x378260;};}function handleError(_0x355558,_0x5962a1){_0x5962a1=_0x5962a1||0x1f4;return function(_0x3f6c71){logger['error'](_0x3f6c71[_0xd262('0x29')]);if(_0x3f6c71[_0xd262('0x2a')]){delete _0x3f6c71[_0xd262('0x2a')];}_0x355558[_0xd262('0x1b')](_0x5962a1)[_0xd262('0x2b')](_0x3f6c71);};}exports[_0xd262('0x2c')]=function(_0x1dcd97,_0x3270b3){var _0x559d0d={},_0x1a0599={},_0x32ed66={'count':0x0,'rows':[]};var _0x30ecad=_[_0xd262('0x2d')](db[_0xd262('0x2e')][_0xd262('0x2f')],function(_0x128ff6){return{'name':_0x128ff6['fieldName'],'type':_0x128ff6[_0xd262('0x30')][_0xd262('0x31')]};});_0x1a0599[_0xd262('0x32')]=_[_0xd262('0x2d')](_0x30ecad,_0xd262('0x2a'));_0x1a0599[_0xd262('0x33')]=_[_0xd262('0x34')](_0x1dcd97[_0xd262('0x33')]);_0x1a0599['filters']=_[_0xd262('0x35')](_0x1a0599[_0xd262('0x32')],_0x1a0599[_0xd262('0x33')]);_0x559d0d[_0xd262('0x36')]=_[_0xd262('0x35')](_0x1a0599[_0xd262('0x32')],qs['fields'](_0x1dcd97[_0xd262('0x33')][_0xd262('0x37')]));_0x559d0d[_0xd262('0x36')]=_0x559d0d[_0xd262('0x36')][_0xd262('0x38')]?_0x559d0d[_0xd262('0x36')]:_0x1a0599['model'];if(!_0x1dcd97[_0xd262('0x33')][_0xd262('0x39')](_0xd262('0x3a'))){_0x559d0d['limit']=qs['limit'](_0x1dcd97[_0xd262('0x33')][_0xd262('0x20')]);_0x559d0d[_0xd262('0x1e')]=qs[_0xd262('0x1e')](_0x1dcd97[_0xd262('0x33')][_0xd262('0x1e')]);}_0x559d0d[_0xd262('0x3b')]=qs['sort'](_0x1dcd97[_0xd262('0x33')][_0xd262('0x3c')]);_0x559d0d[_0xd262('0x3d')]=qs[_0xd262('0x3e')](_[_0xd262('0x3f')](_0x1dcd97[_0xd262('0x33')],_0x1a0599['filters']),_0x30ecad);if(_0x1dcd97[_0xd262('0x33')][_0xd262('0x40')]){_0x559d0d[_0xd262('0x3d')]=_[_0xd262('0x41')](_0x559d0d[_0xd262('0x3d')],{'$or':_[_0xd262('0x2d')](_0x30ecad,function(_0x5c2cc8){if(_0x5c2cc8[_0xd262('0x30')]!=='VIRTUAL'){var _0x5a7cee={};_0x5a7cee[_0x5c2cc8[_0xd262('0x2a')]]={'$like':'%'+_0x1dcd97[_0xd262('0x33')][_0xd262('0x40')]+'%'};return _0x5a7cee;}})});}_0x559d0d=_[_0xd262('0x41')]({},_0x559d0d,_0x1dcd97['options']);var _0x4636f4={'where':_0x559d0d[_0xd262('0x3d')]};return db[_0xd262('0x2e')][_0xd262('0x21')](_0x4636f4)[_0xd262('0x27')](function(_0x3e5229){_0x32ed66[_0xd262('0x21')]=_0x3e5229;if(_0x1dcd97['query'][_0xd262('0x42')]){_0x559d0d[_0xd262('0x43')]=[{'all':!![]}];}return db[_0xd262('0x2e')]['findAll'](_0x559d0d);})[_0xd262('0x27')](function(_0x328f10){_0x32ed66[_0xd262('0x44')]=_0x328f10;return _0x32ed66;})[_0xd262('0x27')](respondWithFilteredResult(_0x3270b3,_0x559d0d))[_0xd262('0x45')](handleError(_0x3270b3,null));};exports[_0xd262('0x46')]=function(_0x4aa936,_0x3bf983){var _0x3c0072={'raw':![],'where':{'id':_0x4aa936[_0xd262('0x47')]['id']}},_0x3a184a={};_0x3a184a[_0xd262('0x32')]=_[_0xd262('0x34')](db[_0xd262('0x2e')][_0xd262('0x2f')]);_0x3a184a[_0xd262('0x33')]=_[_0xd262('0x34')](_0x4aa936[_0xd262('0x33')]);_0x3a184a[_0xd262('0x3e')]=_[_0xd262('0x35')](_0x3a184a['model'],_0x3a184a[_0xd262('0x33')]);_0x3c0072[_0xd262('0x36')]=_[_0xd262('0x35')](_0x3a184a[_0xd262('0x32')],qs[_0xd262('0x37')](_0x4aa936['query']['fields']));_0x3c0072[_0xd262('0x36')]=_0x3c0072[_0xd262('0x36')]['length']?_0x3c0072[_0xd262('0x36')]:_0x3a184a[_0xd262('0x32')];if(_0x4aa936['query']['includeAll']){_0x3c0072[_0xd262('0x43')]=[{'all':!![]}];}_0x3c0072=_[_0xd262('0x41')]({},_0x3c0072,_0x4aa936[_0xd262('0x48')]);return db[_0xd262('0x2e')][_0xd262('0x49')](_0x3c0072)[_0xd262('0x27')](handleEntityNotFound(_0x3bf983,null))[_0xd262('0x27')](respondWithResult(_0x3bf983,null))['catch'](handleError(_0x3bf983,null));};exports[_0xd262('0x4a')]=function(_0xec09fc,_0x15f061){return db[_0xd262('0x2e')][_0xd262('0x4a')](_0xec09fc['body'],{})['then'](respondWithResult(_0x15f061,0xc9))[_0xd262('0x45')](handleError(_0x15f061,null));};exports['update']=function(_0x46437b,_0x2d100c){if(_0x46437b['body']['id']){delete _0x46437b[_0xd262('0x4b')]['id'];}return db[_0xd262('0x2e')]['find']({'where':{'id':_0x46437b[_0xd262('0x47')]['id']}})['then'](handleEntityNotFound(_0x2d100c,null))['then'](saveUpdates(_0x46437b[_0xd262('0x4b')],null))[_0xd262('0x27')](respondWithResult(_0x2d100c,null))['catch'](handleError(_0x2d100c,null));};exports[_0xd262('0x28')]=function(_0xcc18f4,_0x174e55){return db[_0xd262('0x2e')][_0xd262('0x49')]({'where':{'id':_0xcc18f4[_0xd262('0x47')]['id']}})[_0xd262('0x27')](handleEntityNotFound(_0x174e55,null))[_0xd262('0x27')](removeEntity(_0x174e55,null))['catch'](handleError(_0x174e55,null));};exports[_0xd262('0x4c')]=function(_0x52ac93,_0x413347,_0x1201c3){var _0x364e15={};var _0xfec767={};var _0x5397ac;var _0x1655d1;return db[_0xd262('0x2e')][_0xd262('0x4d')]({'where':{'id':_0x52ac93['params']['id']}})[_0xd262('0x27')](handleEntityNotFound(_0x413347,null))[_0xd262('0x27')](function(_0x5def9f){if(_0x5def9f){_0x5397ac=_0x5def9f;_0xfec767[_0xd262('0x32')]=_[_0xd262('0x34')](db[_0xd262('0x4e')]['rawAttributes']);_0xfec767[_0xd262('0x33')]=_[_0xd262('0x34')](_0x52ac93['query']);_0xfec767[_0xd262('0x3e')]=_[_0xd262('0x35')](_0xfec767[_0xd262('0x32')],_0xfec767[_0xd262('0x33')]);_0x364e15[_0xd262('0x36')]=_['intersection'](_0xfec767[_0xd262('0x32')],qs['fields'](_0x52ac93[_0xd262('0x33')][_0xd262('0x37')]));_0x364e15['attributes']=_0x364e15[_0xd262('0x36')][_0xd262('0x38')]?_0x364e15[_0xd262('0x36')]:_0xfec767[_0xd262('0x32')];_0x364e15[_0xd262('0x3b')]=qs[_0xd262('0x3c')](_0x52ac93[_0xd262('0x33')][_0xd262('0x3c')]);_0x364e15['where']=qs[_0xd262('0x3e')](_['pick'](_0x52ac93[_0xd262('0x33')],_0xfec767[_0xd262('0x3e')]));if(_0x52ac93[_0xd262('0x33')][_0xd262('0x40')]){_0x364e15['where']=_[_0xd262('0x41')](_0x364e15[_0xd262('0x3d')],{'$or':_[_0xd262('0x2d')](_0x364e15[_0xd262('0x36')],function(_0x579e68){var _0x49e930={};_0x49e930[_0x579e68]={'$like':'%'+_0x52ac93[_0xd262('0x33')][_0xd262('0x40')]+'%'};return _0x49e930;})});}_0x364e15=_['merge']({},_0x364e15,_0x52ac93[_0xd262('0x48')]);return _0x5397ac[_0xd262('0x4c')](_0x364e15);}})[_0xd262('0x27')](function(_0x254c32){if(_0x254c32){_0x1655d1=_0x254c32['length'];if(!_0x52ac93[_0xd262('0x33')][_0xd262('0x39')]('nolimit')){_0x364e15[_0xd262('0x20')]=qs['limit'](_0x52ac93[_0xd262('0x33')]['limit']);_0x364e15[_0xd262('0x1e')]=qs[_0xd262('0x1e')](_0x52ac93[_0xd262('0x33')][_0xd262('0x1e')]);}return _0x5397ac[_0xd262('0x4c')](_0x364e15);}})['then'](function(_0x38278a){if(_0x38278a){return _0x38278a?{'count':_0x1655d1,'rows':_0x38278a}:null;}})[_0xd262('0x27')](respondWithResult(_0x413347,null))[_0xd262('0x45')](handleError(_0x413347,null));};exports[_0xd262('0x4f')]=function(_0x4a17f5,_0x1ae0a0,_0x4cdd4e){var _0x387b6e={};var _0x3ff0b9={};var _0x41ce30;var _0x59bf36;return db[_0xd262('0x2e')][_0xd262('0x4d')]({'where':{'id':_0x4a17f5[_0xd262('0x47')]['id']}})[_0xd262('0x27')](handleEntityNotFound(_0x1ae0a0,null))[_0xd262('0x27')](function(_0x7eb8b5){if(_0x7eb8b5){_0x41ce30=_0x7eb8b5;_0x3ff0b9['model']=_['keys'](db[_0xd262('0x4e')][_0xd262('0x2f')]);_0x3ff0b9[_0xd262('0x33')]=_['keys'](_0x4a17f5[_0xd262('0x33')]);_0x3ff0b9[_0xd262('0x3e')]=_[_0xd262('0x35')](_0x3ff0b9[_0xd262('0x32')],_0x3ff0b9['query']);_0x387b6e[_0xd262('0x36')]=_['intersection'](_0x3ff0b9[_0xd262('0x32')],qs[_0xd262('0x37')](_0x4a17f5[_0xd262('0x33')][_0xd262('0x37')]));_0x387b6e[_0xd262('0x36')]=_0x387b6e[_0xd262('0x36')][_0xd262('0x38')]?_0x387b6e['attributes']:_0x3ff0b9[_0xd262('0x32')];_0x387b6e[_0xd262('0x3b')]=qs[_0xd262('0x3c')](_0x4a17f5[_0xd262('0x33')][_0xd262('0x3c')]);_0x387b6e[_0xd262('0x3d')]=qs[_0xd262('0x3e')](_['pick'](_0x4a17f5[_0xd262('0x33')],_0x3ff0b9[_0xd262('0x3e')]));if(_0x4a17f5[_0xd262('0x33')][_0xd262('0x40')]){_0x387b6e[_0xd262('0x3d')]=_['merge'](_0x387b6e['where'],{'$or':_[_0xd262('0x2d')](_0x387b6e['attributes'],function(_0x3ca731){var _0x135f0c={};_0x135f0c[_0x3ca731]={'$like':'%'+_0x4a17f5[_0xd262('0x33')][_0xd262('0x40')]+'%'};return _0x135f0c;})});}_0x387b6e=_[_0xd262('0x41')]({},_0x387b6e,_0x4a17f5[_0xd262('0x48')]);return _0x41ce30['getSubjects'](_0x387b6e);}})[_0xd262('0x27')](function(_0x3b9e1c){if(_0x3b9e1c){_0x59bf36=_0x3b9e1c[_0xd262('0x38')];if(!_0x4a17f5['query'][_0xd262('0x39')](_0xd262('0x3a'))){_0x387b6e[_0xd262('0x20')]=qs[_0xd262('0x20')](_0x4a17f5[_0xd262('0x33')][_0xd262('0x20')]);_0x387b6e[_0xd262('0x1e')]=qs[_0xd262('0x1e')](_0x4a17f5[_0xd262('0x33')][_0xd262('0x1e')]);}return _0x41ce30['getSubjects'](_0x387b6e);}})['then'](function(_0x35ea20){if(_0x35ea20){return _0x35ea20?{'count':_0x59bf36,'rows':_0x35ea20}:null;}})[_0xd262('0x27')](respondWithResult(_0x1ae0a0,null))[_0xd262('0x45')](handleError(_0x1ae0a0,null));};exports[_0xd262('0x50')]=function(_0x721b3e,_0x102a02,_0x109e6a){var _0x5754c4={};var _0x3147cc={};var _0x4eedd9;var _0x58721c;return db[_0xd262('0x2e')]['findOne']({'where':{'id':_0x721b3e['params']['id']}})['then'](handleEntityNotFound(_0x102a02,null))[_0xd262('0x27')](function(_0x1afd1e){if(_0x1afd1e){_0x4eedd9=_0x1afd1e;_0x3147cc[_0xd262('0x32')]=_[_0xd262('0x34')](db[_0xd262('0x4e')][_0xd262('0x2f')]);_0x3147cc[_0xd262('0x33')]=_[_0xd262('0x34')](_0x721b3e['query']);_0x3147cc[_0xd262('0x3e')]=_[_0xd262('0x35')](_0x3147cc['model'],_0x3147cc[_0xd262('0x33')]);_0x5754c4[_0xd262('0x36')]=_[_0xd262('0x35')](_0x3147cc[_0xd262('0x32')],qs[_0xd262('0x37')](_0x721b3e[_0xd262('0x33')][_0xd262('0x37')]));_0x5754c4['attributes']=_0x5754c4[_0xd262('0x36')][_0xd262('0x38')]?_0x5754c4['attributes']:_0x3147cc[_0xd262('0x32')];_0x5754c4[_0xd262('0x3b')]=qs[_0xd262('0x3c')](_0x721b3e[_0xd262('0x33')][_0xd262('0x3c')]);_0x5754c4[_0xd262('0x3d')]=qs[_0xd262('0x3e')](_[_0xd262('0x3f')](_0x721b3e['query'],_0x3147cc[_0xd262('0x3e')]));if(_0x721b3e['query'][_0xd262('0x40')]){_0x5754c4[_0xd262('0x3d')]=_['merge'](_0x5754c4[_0xd262('0x3d')],{'$or':_[_0xd262('0x2d')](_0x5754c4['attributes'],function(_0x386250){var _0x4fe376={};_0x4fe376[_0x386250]={'$like':'%'+_0x721b3e['query']['filter']+'%'};return _0x4fe376;})});}_0x5754c4=_[_0xd262('0x41')]({},_0x5754c4,_0x721b3e[_0xd262('0x48')]);return _0x4eedd9[_0xd262('0x50')](_0x5754c4);}})[_0xd262('0x27')](function(_0x12fdcb){if(_0x12fdcb){_0x58721c=_0x12fdcb[_0xd262('0x38')];if(!_0x721b3e[_0xd262('0x33')][_0xd262('0x39')]('nolimit')){_0x5754c4[_0xd262('0x20')]=qs['limit'](_0x721b3e['query'][_0xd262('0x20')]);_0x5754c4[_0xd262('0x1e')]=qs['offset'](_0x721b3e[_0xd262('0x33')][_0xd262('0x1e')]);}return _0x4eedd9['getDescriptions'](_0x5754c4);}})[_0xd262('0x27')](function(_0x1a21e0){if(_0x1a21e0){return _0x1a21e0?{'count':_0x58721c,'rows':_0x1a21e0}:null;}})[_0xd262('0x27')](respondWithResult(_0x102a02,null))[_0xd262('0x45')](handleError(_0x102a02,null));};exports['getTags']=function(_0x25f1d9,_0x34fe3a,_0x12b93a){var _0x593bf6={};var _0x9b0e95={};var _0x97ec2c;var _0x58cc28;return db[_0xd262('0x2e')]['findOne']({'where':{'id':_0x25f1d9['params']['id']}})[_0xd262('0x27')](handleEntityNotFound(_0x34fe3a,null))['then'](function(_0x54b76f){if(_0x54b76f){_0x97ec2c=_0x54b76f;_0x9b0e95['model']=_[_0xd262('0x34')](db[_0xd262('0x51')][_0xd262('0x2f')]);_0x9b0e95['query']=_[_0xd262('0x34')](_0x25f1d9[_0xd262('0x33')]);_0x9b0e95['filters']=_['intersection'](_0x9b0e95[_0xd262('0x32')],_0x9b0e95['query']);_0x593bf6[_0xd262('0x36')]=_[_0xd262('0x35')](_0x9b0e95['model'],qs[_0xd262('0x37')](_0x25f1d9[_0xd262('0x33')][_0xd262('0x37')]));_0x593bf6[_0xd262('0x36')]=_0x593bf6[_0xd262('0x36')][_0xd262('0x38')]?_0x593bf6[_0xd262('0x36')]:_0x9b0e95[_0xd262('0x32')];_0x593bf6[_0xd262('0x3b')]=qs['sort'](_0x25f1d9['query'][_0xd262('0x3c')]);_0x593bf6[_0xd262('0x3d')]=qs[_0xd262('0x3e')](_[_0xd262('0x3f')](_0x25f1d9['query'],_0x9b0e95[_0xd262('0x3e')]));if(_0x25f1d9[_0xd262('0x33')][_0xd262('0x40')]){_0x593bf6[_0xd262('0x3d')]=_[_0xd262('0x41')](_0x593bf6[_0xd262('0x3d')],{'$or':_[_0xd262('0x2d')](_0x593bf6['attributes'],function(_0x448cc){var _0x18785e={};_0x18785e[_0x448cc]={'$like':'%'+_0x25f1d9['query'][_0xd262('0x40')]+'%'};return _0x18785e;})});}_0x593bf6=_['merge']({},_0x593bf6,_0x25f1d9[_0xd262('0x48')]);return _0x97ec2c[_0xd262('0x52')](_0x593bf6);}})['then'](function(_0x137730){if(_0x137730){_0x58cc28=_0x137730[_0xd262('0x38')];if(!_0x25f1d9[_0xd262('0x33')][_0xd262('0x39')]('nolimit')){_0x593bf6['limit']=qs['limit'](_0x25f1d9['query'][_0xd262('0x20')]);_0x593bf6[_0xd262('0x1e')]=qs[_0xd262('0x1e')](_0x25f1d9['query'][_0xd262('0x1e')]);}return _0x97ec2c[_0xd262('0x52')](_0x593bf6);}})[_0xd262('0x27')](function(_0x1b0990){if(_0x1b0990){return _0x1b0990?{'count':_0x58cc28,'rows':_0x1b0990}:null;}})[_0xd262('0x27')](respondWithResult(_0x34fe3a,null))[_0xd262('0x45')](handleError(_0x34fe3a,null));};exports[_0xd262('0x53')]=function(_0x5d988d,_0x186f21,_0x5c44fd){if(_0x5d988d['body']['id']){delete _0x5d988d[_0xd262('0x4b')]['id'];}return db[_0xd262('0x2e')][_0xd262('0x4d')]({'where':{'id':_0x5d988d[_0xd262('0x47')]['id']}})[_0xd262('0x27')](handleEntityNotFound(_0x186f21,null))[_0xd262('0x27')](function(_0xb3020e){if(_0xb3020e){return _0xb3020e[_0xd262('0x53')](_0x5d988d[_0xd262('0x4b')]['ids']||[]);}return null;})[_0xd262('0x27')](respondWithResult(_0x186f21,null))[_0xd262('0x45')](handleError(_0x186f21,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index e2c4a1c..7f246ab 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 _0x8e3f=['request-promise','rimraf','../../config/environment','exports','define','int_zendesk_configurations','lodash','util','../../config/logger','moment','bluebird'];(function(_0x482a39,_0x5891ce){var _0x123ac6=function(_0x1741c2){while(--_0x1741c2){_0x482a39['push'](_0x482a39['shift']());}};_0x123ac6(++_0x5891ce);}(_0x8e3f,0xc1));var _0xf8e3=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x8e3f[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0xf8e3('0x0'));var util=require(_0xf8e3('0x1'));var logger=require(_0xf8e3('0x2'))('api');var moment=require(_0xf8e3('0x3'));var BPromise=require(_0xf8e3('0x4'));var rp=require(_0xf8e3('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf8e3('0x6'));var config=require(_0xf8e3('0x7'));var attributes=require('./intZendeskConfiguration.attributes');module[_0xf8e3('0x8')]=function(_0xb21f8d,_0x2621c5){return _0xb21f8d[_0xf8e3('0x9')]('ZendeskConfiguration',attributes,{'tableName':_0xf8e3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb03e=['int_zendesk_configurations','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration'];(function(_0x4ddfe1,_0x35939d){var _0x4aaf51=function(_0x1e99a0){while(--_0x1e99a0){_0x4ddfe1['push'](_0x4ddfe1['shift']());}};_0x4aaf51(++_0x35939d);}(_0xb03e,0x1eb));var _0xeb03=function(_0x30121b,_0x17e097){_0x30121b=_0x30121b-0x0;var _0x4f3e23=_0xb03e[_0x30121b];return _0x4f3e23;};'use strict';var _=require('lodash');var util=require(_0xeb03('0x0'));var logger=require(_0xeb03('0x1'))(_0xeb03('0x2'));var moment=require(_0xeb03('0x3'));var BPromise=require(_0xeb03('0x4'));var rp=require(_0xeb03('0x5'));var fs=require('fs');var path=require(_0xeb03('0x6'));var rimraf=require(_0xeb03('0x7'));var config=require(_0xeb03('0x8'));var attributes=require(_0xeb03('0x9'));module[_0xeb03('0xa')]=function(_0xee2291,_0x4e1cea){return _0xee2291[_0xeb03('0xb')](_0xeb03('0xc'),attributes,{'tableName':_0xeb03('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js index 75a7a6f..fad80fe 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 _0xc523=['http','then','info','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','ZendeskConfiguration,\x20%s,\x20%s','result','catch','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xc523,0x1da));var _0x3c52=function(_0x42020e,_0x4b92fb){_0x42020e=_0x42020e-0x0;var _0x561551=_0xc523[_0x42020e];return _0x561551;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3c52('0x0'));var BPromise=require(_0x3c52('0x1'));var rs=require(_0x3c52('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3c52('0x3'))['db'];var utils=require(_0x3c52('0x4'));var logger=require(_0x3c52('0x5'))(_0x3c52('0x6'));var config=require(_0x3c52('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x3c52('0x8')][_0x3c52('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4274f6,_0x3157c1,_0x3ce4c3){return new BPromise(function(_0x371952,_0x547a58){return client['request'](_0x4274f6,_0x3ce4c3)[_0x3c52('0xa')](function(_0x577d16){logger[_0x3c52('0xb')]('ZendeskConfiguration,\x20%s,\x20%s',_0x3157c1,_0x3c52('0xc'));logger[_0x3c52('0xd')](_0x3c52('0xe'),_0x3157c1,'request\x20sent',JSON[_0x3c52('0xf')](_0x577d16));if(_0x577d16[_0x3c52('0x10')]){if(_0x577d16[_0x3c52('0x10')]['code']===0x1f4){logger[_0x3c52('0x10')]('ZendeskConfiguration,\x20%s,\x20%s',_0x3157c1,_0x577d16[_0x3c52('0x10')][_0x3c52('0x11')]);return _0x547a58(_0x577d16[_0x3c52('0x10')][_0x3c52('0x11')]);}logger[_0x3c52('0x10')]('ZendeskConfiguration,\x20%s,\x20%s',_0x3157c1,_0x577d16[_0x3c52('0x10')][_0x3c52('0x11')]);return _0x371952(_0x577d16[_0x3c52('0x10')][_0x3c52('0x11')]);}else{logger['info'](_0x3c52('0x12'),_0x3157c1,_0x3c52('0xc'));_0x371952(_0x577d16[_0x3c52('0x13')][_0x3c52('0x11')]);}})[_0x3c52('0x14')](function(_0x57aa38){logger[_0x3c52('0x10')](_0x3c52('0x12'),_0x3157c1,_0x57aa38);_0x547a58(_0x57aa38);});});} \ No newline at end of file +var _0xc081=['jayson/promise','client','http','then','info','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ZendeskConfiguration,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x2b3dea,_0x198287){var _0x299979=function(_0x123eb2){while(--_0x123eb2){_0x2b3dea['push'](_0x2b3dea['shift']());}};_0x299979(++_0x198287);}(_0xc081,0x9f));var _0x1c08=function(_0x19a49f,_0x444d74){_0x19a49f=_0x19a49f-0x0;var _0x5351ae=_0xc081[_0x19a49f];return _0x5351ae;};'use strict';var _=require('lodash');var util=require(_0x1c08('0x0'));var moment=require(_0x1c08('0x1'));var BPromise=require(_0x1c08('0x2'));var rs=require(_0x1c08('0x3'));var fs=require('fs');var Redis=require(_0x1c08('0x4'));var db=require(_0x1c08('0x5'))['db'];var utils=require(_0x1c08('0x6'));var logger=require(_0x1c08('0x7'))(_0x1c08('0x8'));var config=require('../../config/environment');var jayson=require(_0x1c08('0x9'));var client=jayson[_0x1c08('0xa')][_0x1c08('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xc4b6b3,_0x43c459,_0x15d005){return new BPromise(function(_0x262234,_0x45cd67){return client['request'](_0xc4b6b3,_0x15d005)[_0x1c08('0xc')](function(_0x525e13){logger[_0x1c08('0xd')]('ZendeskConfiguration,\x20%s,\x20%s',_0x43c459,'request\x20sent');logger[_0x1c08('0xe')](_0x1c08('0xf'),_0x43c459,_0x1c08('0x10'),JSON[_0x1c08('0x11')](_0x525e13));if(_0x525e13[_0x1c08('0x12')]){if(_0x525e13[_0x1c08('0x12')][_0x1c08('0x13')]===0x1f4){logger[_0x1c08('0x12')](_0x1c08('0x14'),_0x43c459,_0x525e13['error'][_0x1c08('0x15')]);return _0x45cd67(_0x525e13['error'][_0x1c08('0x15')]);}logger[_0x1c08('0x12')](_0x1c08('0x14'),_0x43c459,_0x525e13[_0x1c08('0x12')][_0x1c08('0x15')]);return _0x262234(_0x525e13[_0x1c08('0x12')][_0x1c08('0x15')]);}else{logger[_0x1c08('0xd')]('ZendeskConfiguration,\x20%s,\x20%s',_0x43c459,_0x1c08('0x10'));_0x262234(_0x525e13[_0x1c08('0x16')][_0x1c08('0x15')]);}})[_0x1c08('0x17')](function(_0x46162d){logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0x43c459,_0x46162d);_0x45cd67(_0x46162d);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 16239c7..1765074 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 _0x4112=['delete','destroy','multer','path','express','Router','fs-extra','../../components/auth/service','./intZendeskField.controller','isAuthenticated','index','get','show','/:id','update'];(function(_0x4fbb3e,_0x55785f){var _0x1eb197=function(_0xfda25){while(--_0xfda25){_0x4fbb3e['push'](_0x4fbb3e['shift']());}};_0x1eb197(++_0x55785f);}(_0x4112,0xb6));var _0x2411=function(_0x4768c6,_0xff55d6){_0x4768c6=_0x4768c6-0x0;var _0x41b439=_0x4112[_0x4768c6];return _0x41b439;};'use strict';var multer=require(_0x2411('0x0'));var util=require('util');var path=require(_0x2411('0x1'));var timeout=require('connect-timeout');var express=require(_0x2411('0x2'));var router=express[_0x2411('0x3')]();var fs_extra=require(_0x2411('0x4'));var auth=require(_0x2411('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x2411('0x6'));router['get']('/',auth[_0x2411('0x7')](),controller[_0x2411('0x8')]);router[_0x2411('0x9')]('/:id',auth[_0x2411('0x7')](),controller[_0x2411('0xa')]);router['post']('/',auth[_0x2411('0x7')](),controller['create']);router['put'](_0x2411('0xb'),auth[_0x2411('0x7')](),controller[_0x2411('0xc')]);router[_0x2411('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x2411('0xe')]);module['exports']=router; \ No newline at end of file +var _0xdcac=['update','delete','destroy','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intZendeskField.controller','isAuthenticated','index','get','/:id','show','create'];(function(_0x7bb309,_0x528140){var _0x3613a4=function(_0x26cd31){while(--_0x26cd31){_0x7bb309['push'](_0x7bb309['shift']());}};_0x3613a4(++_0x528140);}(_0xdcac,0x19b));var _0xcdca=function(_0x4a2e7c,_0x458396){_0x4a2e7c=_0x4a2e7c-0x0;var _0x245ab0=_0xdcac[_0x4a2e7c];return _0x245ab0;};'use strict';var multer=require('multer');var util=require(_0xcdca('0x0'));var path=require(_0xcdca('0x1'));var timeout=require(_0xcdca('0x2'));var express=require('express');var router=express[_0xcdca('0x3')]();var fs_extra=require(_0xcdca('0x4'));var auth=require(_0xcdca('0x5'));var interaction=require(_0xcdca('0x6'));var config=require('../../config/environment');var controller=require(_0xcdca('0x7'));router['get']('/',auth[_0xcdca('0x8')](),controller[_0xcdca('0x9')]);router[_0xcdca('0xa')](_0xcdca('0xb'),auth[_0xcdca('0x8')](),controller[_0xcdca('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0xcdca('0xd')]);router['put'](_0xcdca('0xb'),auth[_0xcdca('0x8')](),controller[_0xcdca('0xe')]);router[_0xcdca('0xf')](_0xcdca('0xb'),auth[_0xcdca('0x8')](),controller[_0xcdca('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 2779baf..5fa15d5 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 _0xba1a=['string','STRING','BOOLEAN','sequelize','exports','ENUM','variable','customVariable','keyValue'];(function(_0xd45d05,_0x52393b){var _0x15940b=function(_0x39afc9){while(--_0x39afc9){_0xd45d05['push'](_0xd45d05['shift']());}};_0x15940b(++_0x52393b);}(_0xba1a,0x9c));var _0xaba1=function(_0x4faaee,_0x467507){_0x4faaee=_0x4faaee-0x0;var _0x2525b6=_0xba1a[_0x4faaee];return _0x2525b6;};'use strict';var Sequelize=require(_0xaba1('0x0'));module[_0xaba1('0x1')]={'type':{'type':Sequelize[_0xaba1('0x2')]('string',_0xaba1('0x3'),_0xaba1('0x4'),_0xaba1('0x5'),'picklist'),'defaultValue':_0xaba1('0x6')},'content':{'type':Sequelize[_0xaba1('0x7')]},'key':{'type':Sequelize[_0xaba1('0x7')]},'keyType':{'type':Sequelize[_0xaba1('0x2')](_0xaba1('0x6'),_0xaba1('0x3'),_0xaba1('0x4'))},'keyContent':{'type':Sequelize[_0xaba1('0x7')]},'idField':{'type':Sequelize[_0xaba1('0x7')]},'nameField':{'type':Sequelize[_0xaba1('0x7')]},'customField':{'type':Sequelize[_0xaba1('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xaba1('0x7')]}}; \ No newline at end of file +var _0xe7fa=['BOOLEAN','ENUM','string','variable','customVariable','keyValue','picklist','STRING'];(function(_0x599aaf,_0x3d3622){var _0xd995f3=function(_0x19825e){while(--_0x19825e){_0x599aaf['push'](_0x599aaf['shift']());}};_0xd995f3(++_0x3d3622);}(_0xe7fa,0xf1));var _0xae7f=function(_0x5b0f84,_0x77fe11){_0x5b0f84=_0x5b0f84-0x0;var _0x96b11d=_0xe7fa[_0x5b0f84];return _0x96b11d;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0xae7f('0x0')](_0xae7f('0x1'),_0xae7f('0x2'),_0xae7f('0x3'),_0xae7f('0x4'),_0xae7f('0x5')),'defaultValue':_0xae7f('0x1')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xae7f('0x0')](_0xae7f('0x1'),_0xae7f('0x2'),_0xae7f('0x3'))},'keyContent':{'type':Sequelize[_0xae7f('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xae7f('0x6')]},'customField':{'type':Sequelize[_0xae7f('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xae7f('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 713f1db..a04c325 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 _0x34e1=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','ZendeskField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service'];(function(_0x2fc012,_0x503e5b){var _0x2891f9=function(_0x295f5e){while(--_0x295f5e){_0x2fc012['push'](_0x2fc012['shift']());}};_0x2891f9(++_0x503e5b);}(_0x34e1,0xdc));var _0x134e=function(_0x108ed5,_0x4948b6){_0x108ed5=_0x108ed5-0x0;var _0x457da4=_0x34e1[_0x108ed5];return _0x457da4;};'use strict';var emlformat=require(_0x134e('0x0'));var rimraf=require(_0x134e('0x1'));var zipdir=require(_0x134e('0x2'));var jsonpatch=require(_0x134e('0x3'));var rp=require(_0x134e('0x4'));var moment=require(_0x134e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x134e('0x6'));var util=require(_0x134e('0x7'));var path=require(_0x134e('0x8'));var sox=require(_0x134e('0x9'));var csv=require('to-csv');var ejs=require(_0x134e('0xa'));var fs=require('fs');var fs_extra=require(_0x134e('0xb'));var _=require(_0x134e('0xc'));var squel=require(_0x134e('0xd'));var crypto=require(_0x134e('0xe'));var jsforce=require(_0x134e('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x134e('0x10'));var querystring=require(_0x134e('0x11'));var Papa=require(_0x134e('0x12'));var Redis=require('ioredis');var authService=require(_0x134e('0x13'));var qs=require(_0x134e('0x14'));var as=require(_0x134e('0x15'));var hardwareService=require(_0x134e('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x134e('0x17'));var config=require(_0x134e('0x18'));var licenseUtil=require(_0x134e('0x19'));var db=require(_0x134e('0x1a'))['db'];function respondWithStatusCode(_0x47c76f,_0x511809){_0x511809=_0x511809||0xcc;return function(_0x56f328){if(_0x56f328){return _0x47c76f[_0x134e('0x1b')](_0x511809);}return _0x47c76f[_0x134e('0x1c')](_0x511809)[_0x134e('0x1d')]();};}function respondWithResult(_0x4273f6,_0x42878e){_0x42878e=_0x42878e||0xc8;return function(_0x4328a4){if(_0x4328a4){return _0x4273f6[_0x134e('0x1c')](_0x42878e)[_0x134e('0x1e')](_0x4328a4);}};}function respondWithFilteredResult(_0x2e3593,_0x3f8b94){return function(_0x4b6ead){if(_0x4b6ead){var _0x1ef39b=typeof _0x3f8b94[_0x134e('0x1f')]==='undefined'&&typeof _0x3f8b94[_0x134e('0x20')]===_0x134e('0x21');var _0x58829e=_0x4b6ead[_0x134e('0x22')];var _0x266b0c=_0x1ef39b?0x0:_0x3f8b94['offset'];var _0x3ef9ee=_0x1ef39b?_0x4b6ead[_0x134e('0x22')]:_0x3f8b94['offset']+_0x3f8b94[_0x134e('0x20')];var _0x47c497;if(_0x3ef9ee>=_0x58829e){_0x3ef9ee=_0x58829e;_0x47c497=0xc8;}else{_0x47c497=0xce;}_0x2e3593[_0x134e('0x1c')](_0x47c497);return _0x2e3593[_0x134e('0x23')](_0x134e('0x24'),_0x266b0c+'-'+_0x3ef9ee+'/'+_0x58829e)[_0x134e('0x1e')](_0x4b6ead);}return null;};}function patchUpdates(_0x1637b3){return function(_0x2bb46c){try{jsonpatch[_0x134e('0x25')](_0x2bb46c,_0x1637b3,!![]);}catch(_0x228361){return BPromise[_0x134e('0x26')](_0x228361);}return _0x2bb46c[_0x134e('0x27')]();};}function saveUpdates(_0x5cc475,_0x656592){return function(_0x11dbc0){if(_0x11dbc0){return _0x11dbc0[_0x134e('0x28')](_0x5cc475)['then'](function(_0x61577e){return _0x61577e;});}return null;};}function removeEntity(_0x261b82,_0x3348ce){return function(_0x47d932){if(_0x47d932){return _0x47d932[_0x134e('0x29')]()[_0x134e('0x2a')](function(){_0x261b82[_0x134e('0x1c')](0xcc)[_0x134e('0x1d')]();});}};}function handleEntityNotFound(_0x18f933,_0x2b3402){return function(_0x54742e){if(!_0x54742e){_0x18f933[_0x134e('0x1b')](0x194);}return _0x54742e;};}function handleError(_0x421c01,_0x94e500){_0x94e500=_0x94e500||0x1f4;return function(_0x1b4a7a){logger[_0x134e('0x2b')](_0x1b4a7a[_0x134e('0x2c')]);if(_0x1b4a7a[_0x134e('0x2d')]){delete _0x1b4a7a[_0x134e('0x2d')];}_0x421c01[_0x134e('0x1c')](_0x94e500)[_0x134e('0x2e')](_0x1b4a7a);};}exports[_0x134e('0x2f')]=function(_0x201ad0,_0x33f390){var _0x2e8f59={},_0x2adfe1={},_0x328ef5={'count':0x0,'rows':[]};var _0x38135b=_[_0x134e('0x30')](db[_0x134e('0x31')][_0x134e('0x32')],function(_0x31ae71){return{'name':_0x31ae71[_0x134e('0x33')],'type':_0x31ae71[_0x134e('0x34')][_0x134e('0x35')]};});_0x2adfe1[_0x134e('0x36')]=_[_0x134e('0x30')](_0x38135b,_0x134e('0x2d'));_0x2adfe1[_0x134e('0x37')]=_[_0x134e('0x38')](_0x201ad0[_0x134e('0x37')]);_0x2adfe1[_0x134e('0x39')]=_[_0x134e('0x3a')](_0x2adfe1[_0x134e('0x36')],_0x2adfe1[_0x134e('0x37')]);_0x2e8f59['attributes']=_[_0x134e('0x3a')](_0x2adfe1[_0x134e('0x36')],qs[_0x134e('0x3b')](_0x201ad0[_0x134e('0x37')][_0x134e('0x3b')]));_0x2e8f59[_0x134e('0x3c')]=_0x2e8f59['attributes'][_0x134e('0x3d')]?_0x2e8f59[_0x134e('0x3c')]:_0x2adfe1[_0x134e('0x36')];if(!_0x201ad0[_0x134e('0x37')][_0x134e('0x3e')](_0x134e('0x3f'))){_0x2e8f59[_0x134e('0x20')]=qs[_0x134e('0x20')](_0x201ad0['query'][_0x134e('0x20')]);_0x2e8f59[_0x134e('0x1f')]=qs[_0x134e('0x1f')](_0x201ad0[_0x134e('0x37')][_0x134e('0x1f')]);}_0x2e8f59[_0x134e('0x40')]=qs[_0x134e('0x41')](_0x201ad0[_0x134e('0x37')][_0x134e('0x41')]);_0x2e8f59['where']=qs[_0x134e('0x39')](_['pick'](_0x201ad0[_0x134e('0x37')],_0x2adfe1[_0x134e('0x39')]),_0x38135b);if(_0x201ad0[_0x134e('0x37')][_0x134e('0x42')]){_0x2e8f59[_0x134e('0x43')]=_[_0x134e('0x44')](_0x2e8f59[_0x134e('0x43')],{'$or':_[_0x134e('0x30')](_0x38135b,function(_0x73d717){if(_0x73d717[_0x134e('0x34')]!==_0x134e('0x45')){var _0x3765f1={};_0x3765f1[_0x73d717['name']]={'$like':'%'+_0x201ad0[_0x134e('0x37')][_0x134e('0x42')]+'%'};return _0x3765f1;}})});}_0x2e8f59=_['merge']({},_0x2e8f59,_0x201ad0['options']);var _0x37bd25={'where':_0x2e8f59['where']};return db[_0x134e('0x31')][_0x134e('0x22')](_0x37bd25)[_0x134e('0x2a')](function(_0x37edcc){_0x328ef5[_0x134e('0x22')]=_0x37edcc;if(_0x201ad0[_0x134e('0x37')][_0x134e('0x46')]){_0x2e8f59[_0x134e('0x47')]=[{'all':!![]}];}return db['ZendeskField'][_0x134e('0x48')](_0x2e8f59);})[_0x134e('0x2a')](function(_0x2265ea){_0x328ef5[_0x134e('0x49')]=_0x2265ea;return _0x328ef5;})['then'](respondWithFilteredResult(_0x33f390,_0x2e8f59))['catch'](handleError(_0x33f390,null));};exports[_0x134e('0x4a')]=function(_0x48da68,_0x4c4d08){var _0x238420={'raw':!![],'where':{'id':_0x48da68[_0x134e('0x4b')]['id']}},_0x5d9022={};_0x5d9022[_0x134e('0x36')]=_[_0x134e('0x38')](db['ZendeskField'][_0x134e('0x32')]);_0x5d9022[_0x134e('0x37')]=_['keys'](_0x48da68[_0x134e('0x37')]);_0x5d9022[_0x134e('0x39')]=_['intersection'](_0x5d9022['model'],_0x5d9022[_0x134e('0x37')]);_0x238420['attributes']=_['intersection'](_0x5d9022[_0x134e('0x36')],qs[_0x134e('0x3b')](_0x48da68[_0x134e('0x37')][_0x134e('0x3b')]));_0x238420[_0x134e('0x3c')]=_0x238420[_0x134e('0x3c')][_0x134e('0x3d')]?_0x238420['attributes']:_0x5d9022[_0x134e('0x36')];if(_0x48da68[_0x134e('0x37')][_0x134e('0x46')]){_0x238420[_0x134e('0x47')]=[{'all':!![]}];}_0x238420=_[_0x134e('0x44')]({},_0x238420,_0x48da68['options']);return db[_0x134e('0x31')][_0x134e('0x4c')](_0x238420)[_0x134e('0x2a')](handleEntityNotFound(_0x4c4d08,null))[_0x134e('0x2a')](respondWithResult(_0x4c4d08,null))[_0x134e('0x4d')](handleError(_0x4c4d08,null));};exports[_0x134e('0x4e')]=function(_0x2f7a24,_0x5b4de1){return db[_0x134e('0x31')][_0x134e('0x4e')](_0x2f7a24['body'],{})[_0x134e('0x2a')](respondWithResult(_0x5b4de1,0xc9))['catch'](handleError(_0x5b4de1,null));};exports[_0x134e('0x28')]=function(_0x32f7ba,_0x415115){if(_0x32f7ba[_0x134e('0x4f')]['id']){delete _0x32f7ba[_0x134e('0x4f')]['id'];}return db[_0x134e('0x31')]['find']({'where':{'id':_0x32f7ba[_0x134e('0x4b')]['id']}})[_0x134e('0x2a')](handleEntityNotFound(_0x415115,null))[_0x134e('0x2a')](saveUpdates(_0x32f7ba[_0x134e('0x4f')],null))[_0x134e('0x2a')](respondWithResult(_0x415115,null))[_0x134e('0x4d')](handleError(_0x415115,null));};exports[_0x134e('0x29')]=function(_0x1c16e5,_0x29352c){return db[_0x134e('0x31')][_0x134e('0x4c')]({'where':{'id':_0x1c16e5['params']['id']}})[_0x134e('0x2a')](handleEntityNotFound(_0x29352c,null))[_0x134e('0x2a')](removeEntity(_0x29352c,null))[_0x134e('0x4d')](handleError(_0x29352c,null));}; \ No newline at end of file +var _0xda51=['crypto','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','undefined','limit','count','offset','json','apply','save','then','end','error','stack','name','send','index','ZendeskField','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','order','sort','where','pick','filter','merge','VIRTUAL','include','rows','catch','show','includeAll','options','find','create','body','params','rimraf','bluebird','mustache','util','path','sox','to-csv','ejs','lodash'];(function(_0x6357ad,_0x5b380f){var _0x9b1add=function(_0x119f86){while(--_0x119f86){_0x6357ad['push'](_0x6357ad['shift']());}};_0x9b1add(++_0x5b380f);}(_0xda51,0x7f));var _0x1da5=function(_0x11b19b,_0x213234){_0x11b19b=_0x11b19b-0x0;var _0x1daac1=_0xda51[_0x11b19b];return _0x1daac1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1da5('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x1da5('0x1'));var Mustache=require(_0x1da5('0x2'));var util=require(_0x1da5('0x3'));var path=require(_0x1da5('0x4'));var sox=require(_0x1da5('0x5'));var csv=require(_0x1da5('0x6'));var ejs=require(_0x1da5('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1da5('0x8'));var squel=require('squel');var crypto=require(_0x1da5('0x9'));var jsforce=require(_0x1da5('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x1da5('0x6'));var querystring=require(_0x1da5('0xb'));var Papa=require(_0x1da5('0xc'));var Redis=require(_0x1da5('0xd'));var authService=require(_0x1da5('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x1da5('0xf'));var hardwareService=require(_0x1da5('0x10'));var logger=require(_0x1da5('0x11'))(_0x1da5('0x12'));var utils=require(_0x1da5('0x13'));var config=require(_0x1da5('0x14'));var licenseUtil=require(_0x1da5('0x15'));var db=require(_0x1da5('0x16'))['db'];function respondWithStatusCode(_0x2310b4,_0x4fa2a6){_0x4fa2a6=_0x4fa2a6||0xcc;return function(_0x141317){if(_0x141317){return _0x2310b4['sendStatus'](_0x4fa2a6);}return _0x2310b4[_0x1da5('0x17')](_0x4fa2a6)['end']();};}function respondWithResult(_0x4bcdaa,_0x158019){_0x158019=_0x158019||0xc8;return function(_0xaa1495){if(_0xaa1495){return _0x4bcdaa[_0x1da5('0x17')](_0x158019)['json'](_0xaa1495);}};}function respondWithFilteredResult(_0xd5f69f,_0x29d734){return function(_0x2087ed){if(_0x2087ed){var _0x260f60=typeof _0x29d734['offset']===_0x1da5('0x18')&&typeof _0x29d734[_0x1da5('0x19')]===_0x1da5('0x18');var _0x21921d=_0x2087ed[_0x1da5('0x1a')];var _0x4a675c=_0x260f60?0x0:_0x29d734['offset'];var _0x83a6ff=_0x260f60?_0x2087ed[_0x1da5('0x1a')]:_0x29d734[_0x1da5('0x1b')]+_0x29d734[_0x1da5('0x19')];var _0x438ef9;if(_0x83a6ff>=_0x21921d){_0x83a6ff=_0x21921d;_0x438ef9=0xc8;}else{_0x438ef9=0xce;}_0xd5f69f[_0x1da5('0x17')](_0x438ef9);return _0xd5f69f['set']('Content-Range',_0x4a675c+'-'+_0x83a6ff+'/'+_0x21921d)[_0x1da5('0x1c')](_0x2087ed);}return null;};}function patchUpdates(_0x3a6357){return function(_0x2ada51){try{jsonpatch[_0x1da5('0x1d')](_0x2ada51,_0x3a6357,!![]);}catch(_0x2c3edb){return BPromise['reject'](_0x2c3edb);}return _0x2ada51[_0x1da5('0x1e')]();};}function saveUpdates(_0x4b6fb1,_0x373fe1){return function(_0x4209b0){if(_0x4209b0){return _0x4209b0['update'](_0x4b6fb1)['then'](function(_0x1ed2b5){return _0x1ed2b5;});}return null;};}function removeEntity(_0x5468fc,_0x49b854){return function(_0x4a7580){if(_0x4a7580){return _0x4a7580['destroy']()[_0x1da5('0x1f')](function(){_0x5468fc[_0x1da5('0x17')](0xcc)[_0x1da5('0x20')]();});}};}function handleEntityNotFound(_0x3eb546,_0x85ad64){return function(_0xa6934f){if(!_0xa6934f){_0x3eb546['sendStatus'](0x194);}return _0xa6934f;};}function handleError(_0x2986ee,_0x34beb2){_0x34beb2=_0x34beb2||0x1f4;return function(_0xebdb98){logger[_0x1da5('0x21')](_0xebdb98[_0x1da5('0x22')]);if(_0xebdb98[_0x1da5('0x23')]){delete _0xebdb98[_0x1da5('0x23')];}_0x2986ee[_0x1da5('0x17')](_0x34beb2)[_0x1da5('0x24')](_0xebdb98);};}exports[_0x1da5('0x25')]=function(_0x2034a0,_0x36db1f){var _0x25ac42={},_0x15621e={},_0x25c8f0={'count':0x0,'rows':[]};var _0x44a90b=_['map'](db[_0x1da5('0x26')][_0x1da5('0x27')],function(_0x1bb39e){return{'name':_0x1bb39e[_0x1da5('0x28')],'type':_0x1bb39e[_0x1da5('0x29')][_0x1da5('0x2a')]};});_0x15621e[_0x1da5('0x2b')]=_[_0x1da5('0x2c')](_0x44a90b,_0x1da5('0x23'));_0x15621e[_0x1da5('0x2d')]=_[_0x1da5('0x2e')](_0x2034a0[_0x1da5('0x2d')]);_0x15621e[_0x1da5('0x2f')]=_[_0x1da5('0x30')](_0x15621e[_0x1da5('0x2b')],_0x15621e['query']);_0x25ac42['attributes']=_[_0x1da5('0x30')](_0x15621e[_0x1da5('0x2b')],qs['fields'](_0x2034a0['query'][_0x1da5('0x31')]));_0x25ac42[_0x1da5('0x32')]=_0x25ac42[_0x1da5('0x32')]['length']?_0x25ac42[_0x1da5('0x32')]:_0x15621e[_0x1da5('0x2b')];if(!_0x2034a0['query']['hasOwnProperty']('nolimit')){_0x25ac42[_0x1da5('0x19')]=qs[_0x1da5('0x19')](_0x2034a0[_0x1da5('0x2d')][_0x1da5('0x19')]);_0x25ac42[_0x1da5('0x1b')]=qs[_0x1da5('0x1b')](_0x2034a0[_0x1da5('0x2d')]['offset']);}_0x25ac42[_0x1da5('0x33')]=qs[_0x1da5('0x34')](_0x2034a0[_0x1da5('0x2d')]['sort']);_0x25ac42[_0x1da5('0x35')]=qs[_0x1da5('0x2f')](_[_0x1da5('0x36')](_0x2034a0[_0x1da5('0x2d')],_0x15621e['filters']),_0x44a90b);if(_0x2034a0[_0x1da5('0x2d')][_0x1da5('0x37')]){_0x25ac42[_0x1da5('0x35')]=_[_0x1da5('0x38')](_0x25ac42[_0x1da5('0x35')],{'$or':_[_0x1da5('0x2c')](_0x44a90b,function(_0x2443bb){if(_0x2443bb[_0x1da5('0x29')]!==_0x1da5('0x39')){var _0xb1e066={};_0xb1e066[_0x2443bb['name']]={'$like':'%'+_0x2034a0['query'][_0x1da5('0x37')]+'%'};return _0xb1e066;}})});}_0x25ac42=_[_0x1da5('0x38')]({},_0x25ac42,_0x2034a0['options']);var _0xe0d8c6={'where':_0x25ac42['where']};return db[_0x1da5('0x26')]['count'](_0xe0d8c6)[_0x1da5('0x1f')](function(_0x21282b){_0x25c8f0[_0x1da5('0x1a')]=_0x21282b;if(_0x2034a0['query']['includeAll']){_0x25ac42[_0x1da5('0x3a')]=[{'all':!![]}];}return db[_0x1da5('0x26')]['findAll'](_0x25ac42);})[_0x1da5('0x1f')](function(_0x2795f7){_0x25c8f0[_0x1da5('0x3b')]=_0x2795f7;return _0x25c8f0;})['then'](respondWithFilteredResult(_0x36db1f,_0x25ac42))[_0x1da5('0x3c')](handleError(_0x36db1f,null));};exports[_0x1da5('0x3d')]=function(_0x525106,_0x597af2){var _0x2c2f39={'raw':!![],'where':{'id':_0x525106['params']['id']}},_0x496242={};_0x496242[_0x1da5('0x2b')]=_[_0x1da5('0x2e')](db[_0x1da5('0x26')][_0x1da5('0x27')]);_0x496242[_0x1da5('0x2d')]=_[_0x1da5('0x2e')](_0x525106['query']);_0x496242[_0x1da5('0x2f')]=_[_0x1da5('0x30')](_0x496242[_0x1da5('0x2b')],_0x496242[_0x1da5('0x2d')]);_0x2c2f39['attributes']=_[_0x1da5('0x30')](_0x496242[_0x1da5('0x2b')],qs['fields'](_0x525106['query']['fields']));_0x2c2f39[_0x1da5('0x32')]=_0x2c2f39[_0x1da5('0x32')]['length']?_0x2c2f39['attributes']:_0x496242['model'];if(_0x525106[_0x1da5('0x2d')][_0x1da5('0x3e')]){_0x2c2f39[_0x1da5('0x3a')]=[{'all':!![]}];}_0x2c2f39=_[_0x1da5('0x38')]({},_0x2c2f39,_0x525106[_0x1da5('0x3f')]);return db['ZendeskField'][_0x1da5('0x40')](_0x2c2f39)[_0x1da5('0x1f')](handleEntityNotFound(_0x597af2,null))['then'](respondWithResult(_0x597af2,null))[_0x1da5('0x3c')](handleError(_0x597af2,null));};exports[_0x1da5('0x41')]=function(_0x3ffd58,_0x27c778){return db[_0x1da5('0x26')][_0x1da5('0x41')](_0x3ffd58['body'],{})['then'](respondWithResult(_0x27c778,0xc9))[_0x1da5('0x3c')](handleError(_0x27c778,null));};exports['update']=function(_0x28c4bc,_0x5cb158){if(_0x28c4bc['body']['id']){delete _0x28c4bc[_0x1da5('0x42')]['id'];}return db[_0x1da5('0x26')][_0x1da5('0x40')]({'where':{'id':_0x28c4bc[_0x1da5('0x43')]['id']}})[_0x1da5('0x1f')](handleEntityNotFound(_0x5cb158,null))[_0x1da5('0x1f')](saveUpdates(_0x28c4bc[_0x1da5('0x42')],null))['then'](respondWithResult(_0x5cb158,null))[_0x1da5('0x3c')](handleError(_0x5cb158,null));};exports['destroy']=function(_0x1bcd24,_0x1dcbda){return db[_0x1da5('0x26')][_0x1da5('0x40')]({'where':{'id':_0x1bcd24[_0x1da5('0x43')]['id']}})[_0x1da5('0x1f')](handleEntityNotFound(_0x1dcbda,null))[_0x1da5('0x1f')](removeEntity(_0x1dcbda,null))[_0x1da5('0x3c')](handleError(_0x1dcbda,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 204ce24..20491a1 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 _0x0382=['lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./intZendeskField.attributes','exports','define','ZendeskField','int_zendesk_fields','FieldId'];(function(_0x13e6e1,_0x22c6f9){var _0xab9bd6=function(_0x52475e){while(--_0x52475e){_0x13e6e1['push'](_0x13e6e1['shift']());}};_0xab9bd6(++_0x22c6f9);}(_0x0382,0x8c));var _0x2038=function(_0x903228,_0x42c429){_0x903228=_0x903228-0x0;var _0xcec81d=_0x0382[_0x903228];return _0xcec81d;};'use strict';var _=require(_0x2038('0x0'));var util=require(_0x2038('0x1'));var logger=require(_0x2038('0x2'))(_0x2038('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2038('0x4'));var fs=require('fs');var path=require(_0x2038('0x5'));var rimraf=require(_0x2038('0x6'));var config=require(_0x2038('0x7'));var attributes=require(_0x2038('0x8'));module[_0x2038('0x9')]=function(_0x50943a,_0x16be13){return _0x50943a[_0x2038('0xa')](_0x2038('0xb'),attributes,{'tableName':_0x2038('0xc'),'paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':['idField',_0x2038('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2132=['../../config/logger','api','path','rimraf','../../config/environment','./intZendeskField.attributes','exports','define','ZendeskField','idField','lodash','util'];(function(_0x3aa0ac,_0x5f5da6){var _0x568a11=function(_0x26f47e){while(--_0x26f47e){_0x3aa0ac['push'](_0x3aa0ac['shift']());}};_0x568a11(++_0x5f5da6);}(_0x2132,0xee));var _0x2213=function(_0x5dbc66,_0x11b6fa){_0x5dbc66=_0x5dbc66-0x0;var _0x15aa60=_0x2132[_0x5dbc66];return _0x15aa60;};'use strict';var _=require(_0x2213('0x0'));var util=require(_0x2213('0x1'));var logger=require(_0x2213('0x2'))(_0x2213('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2213('0x4'));var rimraf=require(_0x2213('0x5'));var config=require(_0x2213('0x6'));var attributes=require(_0x2213('0x7'));module[_0x2213('0x8')]=function(_0x42ac98,_0xe9eac7){return _0x42ac98[_0x2213('0x9')](_0x2213('0xa'),attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':[_0x2213('0xb'),'FieldId'],'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 301967a..eb3bd1b 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 _0xbc07=['../../config/utils','../../config/logger','rpc','../../config/environment','http','info','request\x20sent','ZendeskField,\x20%s,\x20%s,\x20%s','error','code','ZendeskField,\x20%s,\x20%s','message','catch','util','moment','bluebird','../../mysqldb'];(function(_0x2fcab3,_0x56e2a0){var _0x5da536=function(_0xb7325c){while(--_0xb7325c){_0x2fcab3['push'](_0x2fcab3['shift']());}};_0x5da536(++_0x56e2a0);}(_0xbc07,0x183));var _0x7bc0=function(_0x539811,_0x703df8){_0x539811=_0x539811-0x0;var _0x3f653b=_0xbc07[_0x539811];return _0x3f653b;};'use strict';var _=require('lodash');var util=require(_0x7bc0('0x0'));var moment=require(_0x7bc0('0x1'));var BPromise=require(_0x7bc0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7bc0('0x3'))['db'];var utils=require(_0x7bc0('0x4'));var logger=require(_0x7bc0('0x5'))(_0x7bc0('0x6'));var config=require(_0x7bc0('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7bc0('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x462568,_0x3d16fa,_0x2a2a05){return new BPromise(function(_0x27d8c3,_0x5e2634){return client['request'](_0x462568,_0x2a2a05)['then'](function(_0x56d562){logger[_0x7bc0('0x9')]('ZendeskField,\x20%s,\x20%s',_0x3d16fa,_0x7bc0('0xa'));logger['debug'](_0x7bc0('0xb'),_0x3d16fa,_0x7bc0('0xa'),JSON['stringify'](_0x56d562));if(_0x56d562[_0x7bc0('0xc')]){if(_0x56d562[_0x7bc0('0xc')][_0x7bc0('0xd')]===0x1f4){logger[_0x7bc0('0xc')](_0x7bc0('0xe'),_0x3d16fa,_0x56d562[_0x7bc0('0xc')][_0x7bc0('0xf')]);return _0x5e2634(_0x56d562['error'][_0x7bc0('0xf')]);}logger['error'](_0x7bc0('0xe'),_0x3d16fa,_0x56d562[_0x7bc0('0xc')][_0x7bc0('0xf')]);return _0x27d8c3(_0x56d562[_0x7bc0('0xc')][_0x7bc0('0xf')]);}else{logger[_0x7bc0('0x9')](_0x7bc0('0xe'),_0x3d16fa,_0x7bc0('0xa'));_0x27d8c3(_0x56d562['result'][_0x7bc0('0xf')]);}})[_0x7bc0('0x10')](function(_0x3b27e1){logger[_0x7bc0('0xc')]('ZendeskField,\x20%s,\x20%s',_0x3d16fa,_0x3b27e1);_0x5e2634(_0x3b27e1);});});} \ No newline at end of file +var _0xcb51=['result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x30d953,_0x1cc062){var _0x16b2f6=function(_0x246f85){while(--_0x246f85){_0x30d953['push'](_0x30d953['shift']());}};_0x16b2f6(++_0x1cc062);}(_0xcb51,0x172));var _0x1cb5=function(_0x47a349,_0x4699d9){_0x47a349=_0x47a349-0x0;var _0x18ab75=_0xcb51[_0x47a349];return _0x18ab75;};'use strict';var _=require(_0x1cb5('0x0'));var util=require(_0x1cb5('0x1'));var moment=require(_0x1cb5('0x2'));var BPromise=require(_0x1cb5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1cb5('0x4'));var db=require(_0x1cb5('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x1cb5('0x6'))(_0x1cb5('0x7'));var config=require(_0x1cb5('0x8'));var jayson=require(_0x1cb5('0x9'));var client=jayson[_0x1cb5('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5133a9,_0x3183de,_0x318a84){return new BPromise(function(_0x32cd92,_0x1b5af5){return client[_0x1cb5('0xb')](_0x5133a9,_0x318a84)[_0x1cb5('0xc')](function(_0x1efe5c){logger[_0x1cb5('0xd')](_0x1cb5('0xe'),_0x3183de,_0x1cb5('0xf'));logger[_0x1cb5('0x10')](_0x1cb5('0x11'),_0x3183de,'request\x20sent',JSON['stringify'](_0x1efe5c));if(_0x1efe5c[_0x1cb5('0x12')]){if(_0x1efe5c['error'][_0x1cb5('0x13')]===0x1f4){logger[_0x1cb5('0x12')](_0x1cb5('0xe'),_0x3183de,_0x1efe5c[_0x1cb5('0x12')][_0x1cb5('0x14')]);return _0x1b5af5(_0x1efe5c[_0x1cb5('0x12')][_0x1cb5('0x14')]);}logger[_0x1cb5('0x12')](_0x1cb5('0xe'),_0x3183de,_0x1efe5c[_0x1cb5('0x12')]['message']);return _0x32cd92(_0x1efe5c['error']['message']);}else{logger[_0x1cb5('0xd')]('ZendeskField,\x20%s,\x20%s',_0x3183de,'request\x20sent');_0x32cd92(_0x1efe5c[_0x1cb5('0x15')][_0x1cb5('0x14')]);}})[_0x1cb5('0x16')](function(_0x2c7477){logger['error'](_0x1cb5('0xe'),_0x3183de,_0x2c7477);_0x1b5af5(_0x2c7477);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 00bdd49..148a8de 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 _0xcef3=['/:id','/:id/configurations','getFields','post','addConfiguration','put','update','delete','destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','isAuthenticated','index','get'];(function(_0x331ed5,_0x465ece){var _0x187185=function(_0x560827){while(--_0x560827){_0x331ed5['push'](_0x331ed5['shift']());}};_0x187185(++_0x465ece);}(_0xcef3,0x88));var _0x3cef=function(_0x5459c1,_0x36f6f0){_0x5459c1=_0x5459c1-0x0;var _0x3f99b5=_0xcef3[_0x5459c1];return _0x3f99b5;};'use strict';var multer=require(_0x3cef('0x0'));var util=require(_0x3cef('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x3cef('0x2')]();var fs_extra=require(_0x3cef('0x3'));var auth=require(_0x3cef('0x4'));var interaction=require(_0x3cef('0x5'));var config=require(_0x3cef('0x6'));var controller=require(_0x3cef('0x7'));router['get']('/',auth[_0x3cef('0x8')](),controller[_0x3cef('0x9')]);router[_0x3cef('0xa')](_0x3cef('0xb'),auth['isAuthenticated'](),controller['show']);router['get'](_0x3cef('0xc'),auth[_0x3cef('0x8')](),controller['getConfigurations']);router[_0x3cef('0xa')]('/:id/fields',auth[_0x3cef('0x8')](),controller[_0x3cef('0xd')]);router[_0x3cef('0xe')]('/',auth[_0x3cef('0x8')](),controller['create']);router[_0x3cef('0xe')]('/:id/configurations',auth[_0x3cef('0x8')](),controller[_0x3cef('0xf')]);router[_0x3cef('0x10')](_0x3cef('0xb'),auth[_0x3cef('0x8')](),controller[_0x3cef('0x11')]);router[_0x3cef('0x12')](_0x3cef('0xb'),auth[_0x3cef('0x8')](),controller[_0x3cef('0x13')]);module[_0x3cef('0x14')]=router; \ No newline at end of file +var _0x2a4d=['delete','destroy','multer','connect-timeout','express','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','index','isAuthenticated','show','/:id/configurations','/:id/fields','post','create','addConfiguration','put','/:id','update'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0x2a4d,0xde));var _0xd2a4=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0x2a4d[_0x2070da];return _0x4f9fe1;};'use strict';var multer=require(_0xd2a4('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xd2a4('0x1'));var express=require(_0xd2a4('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xd2a4('0x3'));var config=require(_0xd2a4('0x4'));var controller=require(_0xd2a4('0x5'));router[_0xd2a4('0x6')]('/',auth['isAuthenticated'](),controller[_0xd2a4('0x7')]);router[_0xd2a4('0x6')]('/:id',auth[_0xd2a4('0x8')](),controller[_0xd2a4('0x9')]);router[_0xd2a4('0x6')](_0xd2a4('0xa'),auth[_0xd2a4('0x8')](),controller['getConfigurations']);router[_0xd2a4('0x6')](_0xd2a4('0xb'),auth[_0xd2a4('0x8')](),controller['getFields']);router[_0xd2a4('0xc')]('/',auth[_0xd2a4('0x8')](),controller[_0xd2a4('0xd')]);router[_0xd2a4('0xc')](_0xd2a4('0xa'),auth['isAuthenticated'](),controller[_0xd2a4('0xe')]);router[_0xd2a4('0xf')](_0xd2a4('0x10'),auth[_0xd2a4('0x8')](),controller[_0xd2a4('0x11')]);router[_0xd2a4('0x12')](_0xd2a4('0x10'),auth[_0xd2a4('0x8')](),controller[_0xd2a4('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 5ebefcd..b72c908 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 _0xa9e0=['sequelize','exports','STRING'];(function(_0x18261f,_0x3eddfa){var _0x1c5910=function(_0x57224e){while(--_0x57224e){_0x18261f['push'](_0x18261f['shift']());}};_0x1c5910(++_0x3eddfa);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa9e0[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize[_0x0a9e('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x0a9e('0x2')]},'serverUrl':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0x0a9e('0x2')]},'refreshToken':{'type':Sequelize[_0x0a9e('0x2')]}}; \ No newline at end of file +var _0x5ff3=['STRING','exports'];(function(_0x1e164a,_0x6f6bf1){var _0x464640=function(_0x39e147){while(--_0x39e147){_0x1e164a['push'](_0x1e164a['shift']());}};_0x464640(++_0x6f6bf1);}(_0x5ff3,0x17d));var _0x35ff=function(_0x505c3c,_0x46e639){_0x505c3c=_0x505c3c-0x0;var _0x335f53=_0x5ff3[_0x505c3c];return _0x335f53;};'use strict';var Sequelize=require('sequelize');module[_0x35ff('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x35ff('0x1')]},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize[_0x35ff('0x1')]},'clientId':{'type':Sequelize[_0x35ff('0x1')]},'clientSecret':{'type':Sequelize[_0x35ff('0x1')]},'serverUrl':{'type':Sequelize[_0x35ff('0x1')],'allowNull':![]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize[_0x35ff('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 7f1f760..aeca22c 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 _0x870c=['filters','intersection','attributes','model','fields','length','nolimit','sort','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','body','destroy','getConfigurations','findOne','ZohoConfiguration','order','pick','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZohoField','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','zone','clientId','serverUrl','zoho.eu','com','slice','substring','lastIndexOf','format','https://www.zohoapis.%s/crm/v2/settings/fields','Zoho-oauthtoken\x20','response','message','Owner','Subject','Description','Call_Duration','Call_Result','Call_Start_Time','Call_Type','remove','includes','api_name','system_mandatory','push','data_type','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','then','error','stack','name','send','map','ZohoAccount','rawAttributes','type','key','query','keys'];(function(_0x3a2f1c,_0x1fb97c){var _0x533dc5=function(_0x578882){while(--_0x578882){_0x3a2f1c['push'](_0x3a2f1c['shift']());}};_0x533dc5(++_0x1fb97c);}(_0x870c,0xd5));var _0xc870=function(_0x544b75,_0x5295cd){_0x544b75=_0x544b75-0x0;var _0x25ee75=_0x870c[_0x544b75];return _0x25ee75;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc870('0x0'));var zipdir=require(_0xc870('0x1'));var jsonpatch=require(_0xc870('0x2'));var rp=require(_0xc870('0x3'));var moment=require(_0xc870('0x4'));var BPromise=require(_0xc870('0x5'));var Mustache=require(_0xc870('0x6'));var util=require(_0xc870('0x7'));var path=require(_0xc870('0x8'));var sox=require(_0xc870('0x9'));var csv=require(_0xc870('0xa'));var ejs=require(_0xc870('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc870('0xc'));var squel=require(_0xc870('0xd'));var crypto=require(_0xc870('0xe'));var jsforce=require(_0xc870('0xf'));var deskjs=require(_0xc870('0x10'));var toCsv=require(_0xc870('0xa'));var querystring=require(_0xc870('0x11'));var Papa=require('papaparse');var Redis=require(_0xc870('0x12'));var authService=require(_0xc870('0x13'));var qs=require(_0xc870('0x14'));var as=require(_0xc870('0x15'));var hardwareService=require(_0xc870('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0xc870('0x17'));var config=require(_0xc870('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xc870('0x19'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x2dcc4b,_0x4bfc19){_0x4bfc19=_0x4bfc19||0xcc;return function(_0x304317){if(_0x304317){return _0x2dcc4b[_0xc870('0x1a')](_0x4bfc19);}return _0x2dcc4b[_0xc870('0x1b')](_0x4bfc19)[_0xc870('0x1c')]();};}function respondWithResult(_0x7c3430,_0x4d0f92){_0x4d0f92=_0x4d0f92||0xc8;return function(_0x20bc02){if(_0x20bc02){return _0x7c3430[_0xc870('0x1b')](_0x4d0f92)[_0xc870('0x1d')](_0x20bc02);}};}function respondWithFilteredResult(_0x34fbdc,_0x1d2408){return function(_0x55a2ec){if(_0x55a2ec){var _0x2d818c=typeof _0x1d2408[_0xc870('0x1e')]===_0xc870('0x1f')&&typeof _0x1d2408[_0xc870('0x20')]===_0xc870('0x1f');var _0x89679e=_0x55a2ec[_0xc870('0x21')];var _0xd998d3=_0x2d818c?0x0:_0x1d2408[_0xc870('0x1e')];var _0x392cf6=_0x2d818c?_0x55a2ec['count']:_0x1d2408[_0xc870('0x1e')]+_0x1d2408[_0xc870('0x20')];var _0xa02655;if(_0x392cf6>=_0x89679e){_0x392cf6=_0x89679e;_0xa02655=0xc8;}else{_0xa02655=0xce;}_0x34fbdc['status'](_0xa02655);return _0x34fbdc[_0xc870('0x22')]('Content-Range',_0xd998d3+'-'+_0x392cf6+'/'+_0x89679e)['json'](_0x55a2ec);}return null;};}function patchUpdates(_0x22e1d5){return function(_0x58d494){try{jsonpatch[_0xc870('0x23')](_0x58d494,_0x22e1d5,!![]);}catch(_0x2be13e){return BPromise[_0xc870('0x24')](_0x2be13e);}return _0x58d494['save']();};}function saveUpdates(_0x44c998,_0x1d072a){return function(_0x49b300){if(_0x49b300){return _0x49b300['update'](_0x44c998)[_0xc870('0x25')](function(_0x4c6132){return _0x4c6132;});}return null;};}function removeEntity(_0x4557ca,_0x59c138){return function(_0x1fb36d){if(_0x1fb36d){return _0x1fb36d['destroy']()[_0xc870('0x25')](function(){_0x4557ca[_0xc870('0x1b')](0xcc)[_0xc870('0x1c')]();});}};}function handleEntityNotFound(_0x4b17fc,_0x31a9fc){return function(_0x45f9a3){if(!_0x45f9a3){_0x4b17fc['sendStatus'](0x194);}return _0x45f9a3;};}function handleError(_0x5a2263,_0x4149de){_0x4149de=_0x4149de||0x1f4;return function(_0xd7b269){logger[_0xc870('0x26')](_0xd7b269[_0xc870('0x27')]);if(_0xd7b269[_0xc870('0x28')]){delete _0xd7b269[_0xc870('0x28')];}_0x5a2263[_0xc870('0x1b')](_0x4149de)[_0xc870('0x29')](_0xd7b269);};}exports['index']=function(_0x3edd42,_0x2973f0){var _0x176f44={},_0x449eb3={},_0x3a5f42={'count':0x0,'rows':[]};var _0x2e9c43=_[_0xc870('0x2a')](db[_0xc870('0x2b')][_0xc870('0x2c')],function(_0x5973e9){return{'name':_0x5973e9['fieldName'],'type':_0x5973e9[_0xc870('0x2d')][_0xc870('0x2e')]};});_0x449eb3['model']=_['map'](_0x2e9c43,_0xc870('0x28'));_0x449eb3[_0xc870('0x2f')]=_[_0xc870('0x30')](_0x3edd42[_0xc870('0x2f')]);_0x449eb3[_0xc870('0x31')]=_[_0xc870('0x32')](_0x449eb3['model'],_0x449eb3['query']);_0x176f44[_0xc870('0x33')]=_[_0xc870('0x32')](_0x449eb3[_0xc870('0x34')],qs[_0xc870('0x35')](_0x3edd42['query']['fields']));_0x176f44[_0xc870('0x33')]=_0x176f44[_0xc870('0x33')][_0xc870('0x36')]?_0x176f44[_0xc870('0x33')]:_0x449eb3['model'];if(!_0x3edd42[_0xc870('0x2f')]['hasOwnProperty'](_0xc870('0x37'))){_0x176f44['limit']=qs['limit'](_0x3edd42[_0xc870('0x2f')][_0xc870('0x20')]);_0x176f44[_0xc870('0x1e')]=qs[_0xc870('0x1e')](_0x3edd42[_0xc870('0x2f')][_0xc870('0x1e')]);}_0x176f44['order']=qs[_0xc870('0x38')](_0x3edd42['query']['sort']);_0x176f44['where']=qs[_0xc870('0x31')](_['pick'](_0x3edd42['query'],_0x449eb3['filters']),_0x2e9c43);if(_0x3edd42[_0xc870('0x2f')][_0xc870('0x39')]){_0x176f44['where']=_[_0xc870('0x3a')](_0x176f44[_0xc870('0x3b')],{'$or':_[_0xc870('0x2a')](_0x2e9c43,function(_0x1e9c57){if(_0x1e9c57[_0xc870('0x2d')]!==_0xc870('0x3c')){var _0x1e13c7={};_0x1e13c7[_0x1e9c57[_0xc870('0x28')]]={'$like':'%'+_0x3edd42[_0xc870('0x2f')]['filter']+'%'};return _0x1e13c7;}})});}_0x176f44=_[_0xc870('0x3a')]({},_0x176f44,_0x3edd42[_0xc870('0x3d')]);var _0x406c08={'where':_0x176f44['where']};return db[_0xc870('0x2b')][_0xc870('0x21')](_0x406c08)['then'](function(_0x5f04b7){_0x3a5f42[_0xc870('0x21')]=_0x5f04b7;if(_0x3edd42['query'][_0xc870('0x3e')]){_0x176f44[_0xc870('0x3f')]=[{'all':!![]}];}return db['ZohoAccount'][_0xc870('0x40')](_0x176f44);})[_0xc870('0x25')](function(_0x2d0b77){_0x3a5f42['rows']=_0x2d0b77;return _0x3a5f42;})[_0xc870('0x25')](respondWithFilteredResult(_0x2973f0,_0x176f44))[_0xc870('0x41')](handleError(_0x2973f0,null));};exports[_0xc870('0x42')]=function(_0x30bfe6,_0x599aea){var _0x4fd963={'raw':![],'where':{'id':_0x30bfe6[_0xc870('0x43')]['id']}},_0x407b89={};_0x407b89[_0xc870('0x34')]=_['keys'](db['ZohoAccount'][_0xc870('0x2c')]);_0x407b89[_0xc870('0x2f')]=_[_0xc870('0x30')](_0x30bfe6[_0xc870('0x2f')]);_0x407b89[_0xc870('0x31')]=_['intersection'](_0x407b89[_0xc870('0x34')],_0x407b89[_0xc870('0x2f')]);_0x4fd963[_0xc870('0x33')]=_[_0xc870('0x32')](_0x407b89[_0xc870('0x34')],qs[_0xc870('0x35')](_0x30bfe6['query'][_0xc870('0x35')]));_0x4fd963[_0xc870('0x33')]=_0x4fd963['attributes'][_0xc870('0x36')]?_0x4fd963[_0xc870('0x33')]:_0x407b89[_0xc870('0x34')];if(_0x30bfe6[_0xc870('0x2f')][_0xc870('0x3e')]){_0x4fd963[_0xc870('0x3f')]=[{'all':!![]}];}_0x4fd963=_[_0xc870('0x3a')]({},_0x4fd963,_0x30bfe6['options']);return db[_0xc870('0x2b')][_0xc870('0x44')](_0x4fd963)[_0xc870('0x25')](handleEntityNotFound(_0x599aea,null))['then'](respondWithResult(_0x599aea,null))['catch'](handleError(_0x599aea,null));};exports[_0xc870('0x45')]=function(_0x3528d8,_0x4bbbbd){return db[_0xc870('0x2b')][_0xc870('0x45')](_0x3528d8[_0xc870('0x46')],{})[_0xc870('0x25')](respondWithResult(_0x4bbbbd,0xc9))['catch'](handleError(_0x4bbbbd,null));};exports['update']=function(_0x12170f,_0x5011a0){if(_0x12170f[_0xc870('0x46')]['id']){delete _0x12170f[_0xc870('0x46')]['id'];}return db[_0xc870('0x2b')][_0xc870('0x44')]({'where':{'id':_0x12170f[_0xc870('0x43')]['id']}})['then'](handleEntityNotFound(_0x5011a0,null))[_0xc870('0x25')](saveUpdates(_0x12170f[_0xc870('0x46')],null))['then'](respondWithResult(_0x5011a0,null))['catch'](handleError(_0x5011a0,null));};exports[_0xc870('0x47')]=function(_0x108a43,_0x70d57){return db[_0xc870('0x2b')][_0xc870('0x44')]({'where':{'id':_0x108a43[_0xc870('0x43')]['id']}})[_0xc870('0x25')](handleEntityNotFound(_0x70d57,null))[_0xc870('0x25')](removeEntity(_0x70d57,null))[_0xc870('0x41')](handleError(_0x70d57,null));};exports[_0xc870('0x48')]=function(_0x2e15a4,_0x4bf737,_0xaf8c4){var _0xe657cf={};var _0x58a871={};var _0x4bf7a9;var _0x3c20ec;return db[_0xc870('0x2b')][_0xc870('0x49')]({'where':{'id':_0x2e15a4[_0xc870('0x43')]['id']}})[_0xc870('0x25')](handleEntityNotFound(_0x4bf737,null))[_0xc870('0x25')](function(_0x8a08ba){if(_0x8a08ba){_0x4bf7a9=_0x8a08ba;_0x58a871[_0xc870('0x34')]=_[_0xc870('0x30')](db[_0xc870('0x4a')][_0xc870('0x2c')]);_0x58a871[_0xc870('0x2f')]=_[_0xc870('0x30')](_0x2e15a4[_0xc870('0x2f')]);_0x58a871[_0xc870('0x31')]=_[_0xc870('0x32')](_0x58a871['model'],_0x58a871[_0xc870('0x2f')]);_0xe657cf['attributes']=_[_0xc870('0x32')](_0x58a871[_0xc870('0x34')],qs[_0xc870('0x35')](_0x2e15a4[_0xc870('0x2f')][_0xc870('0x35')]));_0xe657cf[_0xc870('0x33')]=_0xe657cf[_0xc870('0x33')][_0xc870('0x36')]?_0xe657cf[_0xc870('0x33')]:_0x58a871[_0xc870('0x34')];_0xe657cf[_0xc870('0x4b')]=qs[_0xc870('0x38')](_0x2e15a4[_0xc870('0x2f')][_0xc870('0x38')]);_0xe657cf[_0xc870('0x3b')]=qs[_0xc870('0x31')](_[_0xc870('0x4c')](_0x2e15a4[_0xc870('0x2f')],_0x58a871[_0xc870('0x31')]));if(_0x2e15a4[_0xc870('0x2f')][_0xc870('0x39')]){_0xe657cf[_0xc870('0x3b')]=_[_0xc870('0x3a')](_0xe657cf[_0xc870('0x3b')],{'$or':_[_0xc870('0x2a')](_0xe657cf[_0xc870('0x33')],function(_0x573a12){var _0x45efcf={};_0x45efcf[_0x573a12]={'$like':'%'+_0x2e15a4['query'][_0xc870('0x39')]+'%'};return _0x45efcf;})});}_0xe657cf=_['merge']({},_0xe657cf,_0x2e15a4['options']);return _0x4bf7a9['getConfigurations'](_0xe657cf);}})[_0xc870('0x25')](function(_0x59ab9b){if(_0x59ab9b){_0x3c20ec=_0x59ab9b[_0xc870('0x36')];if(!_0x2e15a4[_0xc870('0x2f')][_0xc870('0x4d')](_0xc870('0x37'))){_0xe657cf[_0xc870('0x20')]=qs['limit'](_0x2e15a4[_0xc870('0x2f')][_0xc870('0x20')]);_0xe657cf[_0xc870('0x1e')]=qs[_0xc870('0x1e')](_0x2e15a4['query'][_0xc870('0x1e')]);}return _0x4bf7a9[_0xc870('0x48')](_0xe657cf);}})[_0xc870('0x25')](function(_0x337e18){if(_0x337e18){return _0x337e18?{'count':_0x3c20ec,'rows':_0x337e18}:null;}})[_0xc870('0x25')](respondWithResult(_0x4bf737,null))[_0xc870('0x41')](handleError(_0x4bf737,null));};exports[_0xc870('0x4e')]=function(_0x537aa2,_0x591b8e,_0x3f0398){if(_0x537aa2[_0xc870('0x46')]['id']){delete _0x537aa2[_0xc870('0x46')]['id'];}return db[_0xc870('0x2b')][_0xc870('0x49')]({'where':{'id':_0x537aa2['params']['id']}})[_0xc870('0x25')](handleEntityNotFound(_0x591b8e,null))['then'](function(_0x548911){if(_0x548911){_0x537aa2[_0xc870('0x46')][_0xc870('0x4f')]=_0x548911['id'];_0x537aa2[_0xc870('0x46')][_0xc870('0x50')]=integrations[_0xc870('0x51')](_0x537aa2['body'][_0xc870('0x52')],_0x537aa2['body'][_0xc870('0x2d')]);_0x537aa2[_0xc870('0x46')][_0xc870('0x53')]=integrations[_0xc870('0x54')](_0x537aa2[_0xc870('0x46')][_0xc870('0x52')],_0x537aa2[_0xc870('0x46')][_0xc870('0x2d')]);return db[_0xc870('0x4a')][_0xc870('0x45')](_0x537aa2[_0xc870('0x46')],{'include':[{'model':db['ZohoField'],'as':'Subjects'},{'model':db[_0xc870('0x55')],'as':'Descriptions'}]});}return null;})[_0xc870('0x25')](respondWithResult(_0x591b8e,null))[_0xc870('0x41')](handleError(_0x591b8e,null));};function getAccessToken(_0x3e9828){return new Promise(function(_0x335d9b,_0x1458da){var _0x269a9e;switch(_0x3e9828['zone']){case'US':_0x269a9e=_0xc870('0x56');break;case'AU':_0x269a9e=_0xc870('0x57');break;case'EU':_0x269a9e=_0xc870('0x58');break;case'IN':_0x269a9e=_0xc870('0x59');break;case'CN':_0x269a9e=_0xc870('0x5a');break;default:_0x269a9e=_0xc870('0x58');break;}var _0x2ec446={'method':_0xc870('0x5b'),'uri':_0x269a9e+_0xc870('0x5c'),'qs':{'refresh_token':_0x3e9828[_0xc870('0x5d')],'client_id':_0x3e9828['clientId'],'client_secret':_0x3e9828['clientSecret'],'grant_type':_0xc870('0x5e')},'json':!![]};return rp(_0x2ec446)[_0xc870('0x25')](function(_0x3f4b09){if(_0x3f4b09[_0xc870('0x5f')]){_0x335d9b(_0x3f4b09['access_token']);}else{_0x1458da(_0xc870('0x60'));}})['catch'](function(_0x2fcf81){_0x1458da(_0x2fcf81);});});}exports[_0xc870('0x61')]=function(_0x4b4cc7,_0x40a5f3,_0x52e5bc){var _0x53551d,_0x3a2c00,_0x5b0613,_0x33ae93,_0x5ac669;return db[_0xc870('0x2b')]['findOne']({'where':{'id':_0x4b4cc7[_0xc870('0x43')]['id']},'attributes':['id',_0xc870('0x62'),_0xc870('0x63'),_0xc870('0x64'),'clientSecret',_0xc870('0x65'),'code',_0xc870('0x5d')]})[_0xc870('0x25')](handleEntityNotFound(_0x40a5f3,null))[_0xc870('0x25')](function(_0xb50563){_0x5ac669=_0xb50563;_0x53551d=_0x5ac669[_0xc870('0x62')];_0x3a2c00=_0x53551d===_0xc870('0x66')?'eu':_0xc870('0x67');_0x5b0613=_0x5ac669['serverUrl'];var _0x35eb8a=_0x5b0613[_0xc870('0x68')](-0x1);if(_0x35eb8a==='/'||_0x35eb8a==='\x5c'||_0x35eb8a===':'){_0x5b0613=_0x5b0613[_0xc870('0x69')](0x0,_0x5b0613[_0xc870('0x6a')](_0x35eb8a));}if(!_0x5ac669[_0xc870('0x5d')]){throw new Error('Refresh\x20Token\x20not\x20available\x20for\x20the\x20account');}return getAccessToken(_0x5ac669);})['then'](function(_0x45ba62){if(_0x45ba62){return rp({'method':'GET','uri':util[_0xc870('0x6b')](_0xc870('0x6c'),_0x3a2c00),'qs':{'module':'Calls'},'headers':{'Authorization':_0xc870('0x6d')+_0x45ba62},'json':!![]});}})[_0xc870('0x25')](function(_0x165e3f){if(_0x165e3f){if(_0x165e3f['response']&&_0x165e3f[_0xc870('0x6e')][_0xc870('0x26')]){throw new Error(_0x165e3f[_0xc870('0x6e')][_0xc870('0x26')][_0xc870('0x6f')]);}var _0x4bad42=[];var _0x45cb20=[];var _0x3f5a37=[_0xc870('0x70'),_0xc870('0x71'),_0xc870('0x72'),'WhoId',_0xc870('0x73'),_0xc870('0x74'),_0xc870('0x75'),_0xc870('0x76')];_0x45cb20=_[_0xc870('0x77')](_0x165e3f[_0xc870('0x35')],function(_0x4bdc8c){return _0x3f5a37[_0xc870('0x78')](_0x4bdc8c[_0xc870('0x79')]);});for(var _0x91d56e=0x0;_0x91d56e<_0x45cb20[_0xc870('0x36')];_0x91d56e++){if(_0x45cb20[_0x91d56e][_0xc870('0x7a')]===![]){_0x4bad42[_0xc870('0x7b')]({'id':_0x45cb20[_0x91d56e]['id'],'name':_0x45cb20[_0x91d56e]['display_label'],'custom':_0x45cb20[_0x91d56e]['custom_field'],'options':_0x45cb20[_0x91d56e][_0xc870('0x7c')]==='picklist'&&_0x45cb20[_0x91d56e][_0xc870('0x7d')][_0xc870('0x36')]>-0x1?_[_0xc870('0x2a')](_0x45cb20[_0x91d56e]['pick_list_values'],function(_0x23ef29){return{'name':_0x23ef29,'value':_0x23ef29};}):[]});}}return{'count':_0x4bad42[_0xc870('0x36')],'rows':_0x4bad42};}else{return{'count':0x0,'rows':[]};}})[_0xc870('0x25')](respondWithResult(_0x40a5f3,null))[_0xc870('0x41')](function(_0xac7198){var _0x1d7816=_0x4b4cc7[_0xc870('0x2f')][_0xc870('0x7e')]?0x1f4:_0xac7198[_0xc870('0x7f')]||0x1f4;logger['error'](_0xc870('0x80'),_0xc870('0x61'),_0x1d7816,JSON[_0xc870('0x81')](_0xac7198));delete _0xac7198[_0xc870('0x28')];if(_0x1d7816===0x191){_0x1d7816=0x190;}_0x40a5f3[_0xc870('0x1b')](_0x1d7816)['send'](_0x4b4cc7[_0xc870('0x2f')][_0xc870('0x7e')]?{'message':_0xc870('0x82'),'statusCode':_0xac7198['statusCode']}:_0xac7198);});}; \ No newline at end of file +var _0xe7f1=['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','../../components/integrations/configuration','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','save','update','then','error','stack','name','index','ZohoAccount','fieldName','type','model','keys','query','intersection','attributes','fields','length','nolimit','order','sort','filters','pick','filter','where','merge','map','VIRTUAL','options','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','destroy','getConfigurations','findOne','ZohoConfiguration','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZohoField','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','zone','serverUrl','code','zoho.eu','slice','substring','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','Owner','Subject','Description','WhoId','Call_Start_Time','Call_Type','remove','includes','system_mandatory','push','picklist','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','to-csv','fs-extra'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe7f1,0x102));var _0x1e7f=function(_0x193cf9,_0x2e61d5){_0x193cf9=_0x193cf9-0x0;var _0x50d461=_0xe7f1[_0x193cf9];return _0x50d461;};'use strict';var emlformat=require(_0x1e7f('0x0'));var rimraf=require(_0x1e7f('0x1'));var zipdir=require(_0x1e7f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1e7f('0x3'));var moment=require(_0x1e7f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x1e7f('0x5'));var util=require(_0x1e7f('0x6'));var path=require(_0x1e7f('0x7'));var sox=require('sox');var csv=require(_0x1e7f('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1e7f('0x9'));var _=require(_0x1e7f('0xa'));var squel=require(_0x1e7f('0xb'));var crypto=require(_0x1e7f('0xc'));var jsforce=require(_0x1e7f('0xd'));var deskjs=require(_0x1e7f('0xe'));var toCsv=require(_0x1e7f('0x8'));var querystring=require(_0x1e7f('0xf'));var Papa=require(_0x1e7f('0x10'));var Redis=require(_0x1e7f('0x11'));var authService=require(_0x1e7f('0x12'));var qs=require(_0x1e7f('0x13'));var as=require(_0x1e7f('0x14'));var hardwareService=require(_0x1e7f('0x15'));var logger=require(_0x1e7f('0x16'))(_0x1e7f('0x17'));var utils=require(_0x1e7f('0x18'));var config=require(_0x1e7f('0x19'));var licenseUtil=require(_0x1e7f('0x1a'));var db=require(_0x1e7f('0x1b'))['db'];var integrations=require(_0x1e7f('0x1c'));function respondWithStatusCode(_0x1c4082,_0x130f05){_0x130f05=_0x130f05||0xcc;return function(_0x11b4a4){if(_0x11b4a4){return _0x1c4082[_0x1e7f('0x1d')](_0x130f05);}return _0x1c4082[_0x1e7f('0x1e')](_0x130f05)[_0x1e7f('0x1f')]();};}function respondWithResult(_0xd53575,_0x3cebfa){_0x3cebfa=_0x3cebfa||0xc8;return function(_0x268666){if(_0x268666){return _0xd53575[_0x1e7f('0x1e')](_0x3cebfa)[_0x1e7f('0x20')](_0x268666);}};}function respondWithFilteredResult(_0x5eeee2,_0x1c1402){return function(_0x583ee5){if(_0x583ee5){var _0x62aac8=typeof _0x1c1402['offset']===_0x1e7f('0x21')&&typeof _0x1c1402[_0x1e7f('0x22')]===_0x1e7f('0x21');var _0x26dec2=_0x583ee5[_0x1e7f('0x23')];var _0x4141ad=_0x62aac8?0x0:_0x1c1402[_0x1e7f('0x24')];var _0x446d12=_0x62aac8?_0x583ee5[_0x1e7f('0x23')]:_0x1c1402['offset']+_0x1c1402['limit'];var _0x318acf;if(_0x446d12>=_0x26dec2){_0x446d12=_0x26dec2;_0x318acf=0xc8;}else{_0x318acf=0xce;}_0x5eeee2[_0x1e7f('0x1e')](_0x318acf);return _0x5eeee2[_0x1e7f('0x25')]('Content-Range',_0x4141ad+'-'+_0x446d12+'/'+_0x26dec2)['json'](_0x583ee5);}return null;};}function patchUpdates(_0x2ee602){return function(_0x120e38){try{jsonpatch[_0x1e7f('0x26')](_0x120e38,_0x2ee602,!![]);}catch(_0x4fc0c9){return BPromise[_0x1e7f('0x27')](_0x4fc0c9);}return _0x120e38[_0x1e7f('0x28')]();};}function saveUpdates(_0x2512e9,_0x412153){return function(_0x7ebdd9){if(_0x7ebdd9){return _0x7ebdd9[_0x1e7f('0x29')](_0x2512e9)[_0x1e7f('0x2a')](function(_0x548bf6){return _0x548bf6;});}return null;};}function removeEntity(_0x736bd0,_0x49c5e9){return function(_0x258ad3){if(_0x258ad3){return _0x258ad3['destroy']()[_0x1e7f('0x2a')](function(){_0x736bd0[_0x1e7f('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x349610,_0x45545c){return function(_0xc47550){if(!_0xc47550){_0x349610['sendStatus'](0x194);}return _0xc47550;};}function handleError(_0x30f6b0,_0xafd55f){_0xafd55f=_0xafd55f||0x1f4;return function(_0x1cc535){logger[_0x1e7f('0x2b')](_0x1cc535[_0x1e7f('0x2c')]);if(_0x1cc535[_0x1e7f('0x2d')]){delete _0x1cc535['name'];}_0x30f6b0['status'](_0xafd55f)['send'](_0x1cc535);};}exports[_0x1e7f('0x2e')]=function(_0x2b1edb,_0x387a5d){var _0x45dcd6={},_0x27efa8={},_0x2abd07={'count':0x0,'rows':[]};var _0x436515=_['map'](db[_0x1e7f('0x2f')]['rawAttributes'],function(_0x2ce935){return{'name':_0x2ce935[_0x1e7f('0x30')],'type':_0x2ce935[_0x1e7f('0x31')]['key']};});_0x27efa8[_0x1e7f('0x32')]=_['map'](_0x436515,_0x1e7f('0x2d'));_0x27efa8['query']=_[_0x1e7f('0x33')](_0x2b1edb[_0x1e7f('0x34')]);_0x27efa8['filters']=_[_0x1e7f('0x35')](_0x27efa8['model'],_0x27efa8['query']);_0x45dcd6[_0x1e7f('0x36')]=_['intersection'](_0x27efa8[_0x1e7f('0x32')],qs[_0x1e7f('0x37')](_0x2b1edb[_0x1e7f('0x34')]['fields']));_0x45dcd6['attributes']=_0x45dcd6[_0x1e7f('0x36')][_0x1e7f('0x38')]?_0x45dcd6[_0x1e7f('0x36')]:_0x27efa8['model'];if(!_0x2b1edb[_0x1e7f('0x34')]['hasOwnProperty'](_0x1e7f('0x39'))){_0x45dcd6['limit']=qs[_0x1e7f('0x22')](_0x2b1edb['query'][_0x1e7f('0x22')]);_0x45dcd6[_0x1e7f('0x24')]=qs[_0x1e7f('0x24')](_0x2b1edb[_0x1e7f('0x34')]['offset']);}_0x45dcd6[_0x1e7f('0x3a')]=qs[_0x1e7f('0x3b')](_0x2b1edb[_0x1e7f('0x34')][_0x1e7f('0x3b')]);_0x45dcd6['where']=qs[_0x1e7f('0x3c')](_[_0x1e7f('0x3d')](_0x2b1edb['query'],_0x27efa8[_0x1e7f('0x3c')]),_0x436515);if(_0x2b1edb[_0x1e7f('0x34')][_0x1e7f('0x3e')]){_0x45dcd6[_0x1e7f('0x3f')]=_[_0x1e7f('0x40')](_0x45dcd6[_0x1e7f('0x3f')],{'$or':_[_0x1e7f('0x41')](_0x436515,function(_0x40f77f){if(_0x40f77f['type']!==_0x1e7f('0x42')){var _0x1901fa={};_0x1901fa[_0x40f77f[_0x1e7f('0x2d')]]={'$like':'%'+_0x2b1edb['query'][_0x1e7f('0x3e')]+'%'};return _0x1901fa;}})});}_0x45dcd6=_[_0x1e7f('0x40')]({},_0x45dcd6,_0x2b1edb[_0x1e7f('0x43')]);var _0x5a4755={'where':_0x45dcd6[_0x1e7f('0x3f')]};return db['ZohoAccount']['count'](_0x5a4755)['then'](function(_0x529d95){_0x2abd07[_0x1e7f('0x23')]=_0x529d95;if(_0x2b1edb[_0x1e7f('0x34')]['includeAll']){_0x45dcd6[_0x1e7f('0x44')]=[{'all':!![]}];}return db[_0x1e7f('0x2f')][_0x1e7f('0x45')](_0x45dcd6);})['then'](function(_0x2c690c){_0x2abd07[_0x1e7f('0x46')]=_0x2c690c;return _0x2abd07;})['then'](respondWithFilteredResult(_0x387a5d,_0x45dcd6))[_0x1e7f('0x47')](handleError(_0x387a5d,null));};exports[_0x1e7f('0x48')]=function(_0x1d38d6,_0x7ef002){var _0x6c78cc={'raw':![],'where':{'id':_0x1d38d6[_0x1e7f('0x49')]['id']}},_0x103792={};_0x103792[_0x1e7f('0x32')]=_['keys'](db[_0x1e7f('0x2f')][_0x1e7f('0x4a')]);_0x103792['query']=_[_0x1e7f('0x33')](_0x1d38d6['query']);_0x103792[_0x1e7f('0x3c')]=_[_0x1e7f('0x35')](_0x103792[_0x1e7f('0x32')],_0x103792[_0x1e7f('0x34')]);_0x6c78cc['attributes']=_['intersection'](_0x103792[_0x1e7f('0x32')],qs[_0x1e7f('0x37')](_0x1d38d6[_0x1e7f('0x34')]['fields']));_0x6c78cc['attributes']=_0x6c78cc[_0x1e7f('0x36')]['length']?_0x6c78cc[_0x1e7f('0x36')]:_0x103792[_0x1e7f('0x32')];if(_0x1d38d6[_0x1e7f('0x34')]['includeAll']){_0x6c78cc[_0x1e7f('0x44')]=[{'all':!![]}];}_0x6c78cc=_[_0x1e7f('0x40')]({},_0x6c78cc,_0x1d38d6['options']);return db[_0x1e7f('0x2f')][_0x1e7f('0x4b')](_0x6c78cc)['then'](handleEntityNotFound(_0x7ef002,null))['then'](respondWithResult(_0x7ef002,null))[_0x1e7f('0x47')](handleError(_0x7ef002,null));};exports[_0x1e7f('0x4c')]=function(_0xa0a0a4,_0x5bbb94){return db[_0x1e7f('0x2f')][_0x1e7f('0x4c')](_0xa0a0a4[_0x1e7f('0x4d')],{})[_0x1e7f('0x2a')](respondWithResult(_0x5bbb94,0xc9))[_0x1e7f('0x47')](handleError(_0x5bbb94,null));};exports[_0x1e7f('0x29')]=function(_0x1f0bce,_0x53d0ef){if(_0x1f0bce[_0x1e7f('0x4d')]['id']){delete _0x1f0bce['body']['id'];}return db[_0x1e7f('0x2f')][_0x1e7f('0x4b')]({'where':{'id':_0x1f0bce[_0x1e7f('0x49')]['id']}})[_0x1e7f('0x2a')](handleEntityNotFound(_0x53d0ef,null))[_0x1e7f('0x2a')](saveUpdates(_0x1f0bce[_0x1e7f('0x4d')],null))[_0x1e7f('0x2a')](respondWithResult(_0x53d0ef,null))[_0x1e7f('0x47')](handleError(_0x53d0ef,null));};exports[_0x1e7f('0x4e')]=function(_0x954b7,_0x396b3c){return db[_0x1e7f('0x2f')][_0x1e7f('0x4b')]({'where':{'id':_0x954b7[_0x1e7f('0x49')]['id']}})['then'](handleEntityNotFound(_0x396b3c,null))['then'](removeEntity(_0x396b3c,null))[_0x1e7f('0x47')](handleError(_0x396b3c,null));};exports[_0x1e7f('0x4f')]=function(_0x27913b,_0x43a934,_0x53f81a){var _0x4aa8b0={};var _0x32e273={};var _0x40e4a4;var _0x4a8191;return db[_0x1e7f('0x2f')][_0x1e7f('0x50')]({'where':{'id':_0x27913b[_0x1e7f('0x49')]['id']}})[_0x1e7f('0x2a')](handleEntityNotFound(_0x43a934,null))['then'](function(_0x1a1473){if(_0x1a1473){_0x40e4a4=_0x1a1473;_0x32e273[_0x1e7f('0x32')]=_[_0x1e7f('0x33')](db[_0x1e7f('0x51')][_0x1e7f('0x4a')]);_0x32e273[_0x1e7f('0x34')]=_[_0x1e7f('0x33')](_0x27913b[_0x1e7f('0x34')]);_0x32e273[_0x1e7f('0x3c')]=_[_0x1e7f('0x35')](_0x32e273['model'],_0x32e273['query']);_0x4aa8b0[_0x1e7f('0x36')]=_[_0x1e7f('0x35')](_0x32e273[_0x1e7f('0x32')],qs['fields'](_0x27913b[_0x1e7f('0x34')][_0x1e7f('0x37')]));_0x4aa8b0[_0x1e7f('0x36')]=_0x4aa8b0[_0x1e7f('0x36')][_0x1e7f('0x38')]?_0x4aa8b0[_0x1e7f('0x36')]:_0x32e273[_0x1e7f('0x32')];_0x4aa8b0[_0x1e7f('0x3a')]=qs['sort'](_0x27913b['query'][_0x1e7f('0x3b')]);_0x4aa8b0[_0x1e7f('0x3f')]=qs[_0x1e7f('0x3c')](_['pick'](_0x27913b[_0x1e7f('0x34')],_0x32e273[_0x1e7f('0x3c')]));if(_0x27913b[_0x1e7f('0x34')][_0x1e7f('0x3e')]){_0x4aa8b0[_0x1e7f('0x3f')]=_[_0x1e7f('0x40')](_0x4aa8b0[_0x1e7f('0x3f')],{'$or':_['map'](_0x4aa8b0[_0x1e7f('0x36')],function(_0x31fbf6){var _0x3b78a0={};_0x3b78a0[_0x31fbf6]={'$like':'%'+_0x27913b[_0x1e7f('0x34')][_0x1e7f('0x3e')]+'%'};return _0x3b78a0;})});}_0x4aa8b0=_[_0x1e7f('0x40')]({},_0x4aa8b0,_0x27913b['options']);return _0x40e4a4[_0x1e7f('0x4f')](_0x4aa8b0);}})['then'](function(_0x4b7ade){if(_0x4b7ade){_0x4a8191=_0x4b7ade[_0x1e7f('0x38')];if(!_0x27913b[_0x1e7f('0x34')][_0x1e7f('0x52')]('nolimit')){_0x4aa8b0[_0x1e7f('0x22')]=qs[_0x1e7f('0x22')](_0x27913b[_0x1e7f('0x34')]['limit']);_0x4aa8b0[_0x1e7f('0x24')]=qs[_0x1e7f('0x24')](_0x27913b[_0x1e7f('0x34')][_0x1e7f('0x24')]);}return _0x40e4a4[_0x1e7f('0x4f')](_0x4aa8b0);}})[_0x1e7f('0x2a')](function(_0x33212f){if(_0x33212f){return _0x33212f?{'count':_0x4a8191,'rows':_0x33212f}:null;}})[_0x1e7f('0x2a')](respondWithResult(_0x43a934,null))[_0x1e7f('0x47')](handleError(_0x43a934,null));};exports[_0x1e7f('0x53')]=function(_0x921e78,_0x1ef8aa,_0x5a124e){if(_0x921e78[_0x1e7f('0x4d')]['id']){delete _0x921e78[_0x1e7f('0x4d')]['id'];}return db[_0x1e7f('0x2f')]['findOne']({'where':{'id':_0x921e78[_0x1e7f('0x49')]['id']}})[_0x1e7f('0x2a')](handleEntityNotFound(_0x1ef8aa,null))['then'](function(_0x264cf1){if(_0x264cf1){_0x921e78[_0x1e7f('0x4d')][_0x1e7f('0x54')]=_0x264cf1['id'];_0x921e78[_0x1e7f('0x4d')][_0x1e7f('0x55')]=integrations[_0x1e7f('0x56')](_0x921e78['body'][_0x1e7f('0x57')],_0x921e78[_0x1e7f('0x4d')][_0x1e7f('0x31')]);_0x921e78['body'][_0x1e7f('0x58')]=integrations[_0x1e7f('0x59')](_0x921e78['body'][_0x1e7f('0x57')],_0x921e78[_0x1e7f('0x4d')][_0x1e7f('0x31')]);return db[_0x1e7f('0x51')][_0x1e7f('0x4c')](_0x921e78[_0x1e7f('0x4d')],{'include':[{'model':db[_0x1e7f('0x5a')],'as':_0x1e7f('0x55')},{'model':db[_0x1e7f('0x5a')],'as':_0x1e7f('0x58')}]});}return null;})[_0x1e7f('0x2a')](respondWithResult(_0x1ef8aa,null))[_0x1e7f('0x47')](handleError(_0x1ef8aa,null));};function getAccessToken(_0x38f5f2){return new Promise(function(_0x227b3e,_0x3b128f){var _0x531b39;switch(_0x38f5f2['zone']){case'US':_0x531b39=_0x1e7f('0x5b');break;case'AU':_0x531b39=_0x1e7f('0x5c');break;case'EU':_0x531b39=_0x1e7f('0x5d');break;case'IN':_0x531b39=_0x1e7f('0x5e');break;case'CN':_0x531b39=_0x1e7f('0x5f');break;default:_0x531b39=_0x1e7f('0x5d');break;}var _0x2919a9={'method':_0x1e7f('0x60'),'uri':_0x531b39+_0x1e7f('0x61'),'qs':{'refresh_token':_0x38f5f2[_0x1e7f('0x62')],'client_id':_0x38f5f2[_0x1e7f('0x63')],'client_secret':_0x38f5f2[_0x1e7f('0x64')],'grant_type':_0x1e7f('0x65')},'json':!![]};return rp(_0x2919a9)['then'](function(_0x4f4cbc){if(_0x4f4cbc[_0x1e7f('0x66')]){_0x227b3e(_0x4f4cbc['access_token']);}else{_0x3b128f(_0x1e7f('0x67'));}})[_0x1e7f('0x47')](function(_0x1d621f){_0x3b128f(_0x1d621f);});});}exports[_0x1e7f('0x68')]=function(_0x87786a,_0x37c9f9,_0x33e6d0){var _0x4b05f9,_0x3a86e6,_0x47abe2,_0x4bfd55,_0x568399;return db[_0x1e7f('0x2f')][_0x1e7f('0x50')]({'where':{'id':_0x87786a[_0x1e7f('0x49')]['id']},'attributes':['id',_0x1e7f('0x69'),_0x1e7f('0x6a'),_0x1e7f('0x63'),_0x1e7f('0x64'),_0x1e7f('0x6b'),_0x1e7f('0x6c'),_0x1e7f('0x62')]})[_0x1e7f('0x2a')](handleEntityNotFound(_0x37c9f9,null))[_0x1e7f('0x2a')](function(_0x5f49eb){_0x568399=_0x5f49eb;_0x4b05f9=_0x568399[_0x1e7f('0x69')];_0x3a86e6=_0x4b05f9===_0x1e7f('0x6d')?'eu':'com';_0x47abe2=_0x568399[_0x1e7f('0x6b')];var _0x32c645=_0x47abe2[_0x1e7f('0x6e')](-0x1);if(_0x32c645==='/'||_0x32c645==='\x5c'||_0x32c645===':'){_0x47abe2=_0x47abe2[_0x1e7f('0x6f')](0x0,_0x47abe2['lastIndexOf'](_0x32c645));}if(!_0x568399[_0x1e7f('0x62')]){throw new Error(_0x1e7f('0x70'));}return getAccessToken(_0x568399);})['then'](function(_0xe7d86d){if(_0xe7d86d){return rp({'method':'GET','uri':util['format'](_0x1e7f('0x71'),_0x3a86e6),'qs':{'module':_0x1e7f('0x72')},'headers':{'Authorization':_0x1e7f('0x73')+_0xe7d86d},'json':!![]});}})['then'](function(_0x56ccbc){if(_0x56ccbc){if(_0x56ccbc[_0x1e7f('0x74')]&&_0x56ccbc['response'][_0x1e7f('0x2b')]){throw new Error(_0x56ccbc[_0x1e7f('0x74')][_0x1e7f('0x2b')]['message']);}var _0x217eb6=[];var _0x4b5fdd=[];var _0x3cda3=[_0x1e7f('0x75'),_0x1e7f('0x76'),_0x1e7f('0x77'),_0x1e7f('0x78'),'Call_Duration','Call_Result',_0x1e7f('0x79'),_0x1e7f('0x7a')];_0x4b5fdd=_[_0x1e7f('0x7b')](_0x56ccbc[_0x1e7f('0x37')],function(_0x4e49e8){return _0x3cda3[_0x1e7f('0x7c')](_0x4e49e8['api_name']);});for(var _0xdef7be=0x0;_0xdef7be<_0x4b5fdd[_0x1e7f('0x38')];_0xdef7be++){if(_0x4b5fdd[_0xdef7be][_0x1e7f('0x7d')]===![]){_0x217eb6[_0x1e7f('0x7e')]({'id':_0x4b5fdd[_0xdef7be]['id'],'name':_0x4b5fdd[_0xdef7be]['display_label'],'custom':_0x4b5fdd[_0xdef7be]['custom_field'],'options':_0x4b5fdd[_0xdef7be]['data_type']===_0x1e7f('0x7f')&&_0x4b5fdd[_0xdef7be]['pick_list_values'][_0x1e7f('0x38')]>-0x1?_['map'](_0x4b5fdd[_0xdef7be]['pick_list_values'],function(_0x1fc036){return{'name':_0x1fc036,'value':_0x1fc036};}):[]});}}return{'count':_0x217eb6[_0x1e7f('0x38')],'rows':_0x217eb6};}else{return{'count':0x0,'rows':[]};}})[_0x1e7f('0x2a')](respondWithResult(_0x37c9f9,null))[_0x1e7f('0x47')](function(_0x3f2547){var _0xc16862=_0x87786a[_0x1e7f('0x34')][_0x1e7f('0x80')]?0x1f4:_0x3f2547[_0x1e7f('0x81')]||0x1f4;logger[_0x1e7f('0x2b')](_0x1e7f('0x82'),_0x1e7f('0x68'),_0xc16862,JSON[_0x1e7f('0x83')](_0x3f2547));delete _0x3f2547[_0x1e7f('0x2d')];if(_0xc16862===0x191){_0xc16862=0x190;}_0x37c9f9[_0x1e7f('0x1e')](_0xc16862)[_0x1e7f('0x84')](_0x87786a[_0x1e7f('0x34')][_0x1e7f('0x80')]?{'message':_0x1e7f('0x85'),'statusCode':_0x3f2547[_0x1e7f('0x81')]}:_0x3f2547);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 5400666..1bfb439 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 _0x1099=['/oauth/v2/token','authorization_code','parse','refresh_token','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','https://accounts.zoho.com','application/x-www-form-urlencoded','then','refreshToken','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','ZohoAccount','int_zoho_accounts','changed','zone','serverUrl','clientId','clientSecret','code','host','slice','substring','lastIndexOf','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST'];(function(_0x414eab,_0x42b14d){var _0x1ddfbd=function(_0x18b6c6){while(--_0x18b6c6){_0x414eab['push'](_0x414eab['shift']());}};_0x1ddfbd(++_0x42b14d);}(_0x1099,0x168));var _0x9109=function(_0x5bb3a2,_0xf19c88){_0x5bb3a2=_0x5bb3a2-0x0;var _0x2c01de=_0x1099[_0x5bb3a2];return _0x2c01de;};'use strict';var _=require(_0x9109('0x0'));var util=require(_0x9109('0x1'));var logger=require('../../config/logger')(_0x9109('0x2'));var moment=require(_0x9109('0x3'));var BPromise=require(_0x9109('0x4'));var rp=require(_0x9109('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9109('0x6'));var config=require(_0x9109('0x7'));var attributes=require(_0x9109('0x8'));var integrations=require(_0x9109('0x9'));module['exports']=function(_0x12e282,_0x5ba0bf){return _0x12e282['define'](_0x9109('0xa'),attributes,{'tableName':_0x9109('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x338e31,_0x2878df,_0x1a2d30){if(_0x338e31[_0x9109('0xc')](_0x9109('0xd'))||_0x338e31['changed'](_0x9109('0xe'))||_0x338e31[_0x9109('0xc')](_0x9109('0xf'))||_0x338e31[_0x9109('0xc')](_0x9109('0x10'))||_0x338e31['changed'](_0x9109('0x11'))||_0x338e31[_0x9109('0xc')](_0x9109('0x12'))){var _0x53ed55,_0x15c4c9;_0x53ed55=_0x338e31[_0x9109('0xe')];var _0x2ceaff=_0x53ed55[_0x9109('0x13')](-0x1);if(_0x2ceaff==='/'||_0x2ceaff==='\x5c'||_0x2ceaff===':'){_0x53ed55=_0x53ed55[_0x9109('0x14')](0x0,_0x53ed55[_0x9109('0x15')](_0x2ceaff));}switch(_0x338e31[_0x9109('0xd')]){case'US':_0x15c4c9='https://accounts.zoho.com';break;case'AU':_0x15c4c9=_0x9109('0x16');break;case'IN':_0x15c4c9=_0x9109('0x17');break;case'CN':_0x15c4c9=_0x9109('0x18');break;default:_0x15c4c9=_0x9109('0x19');break;}var _0x524bf5={'method':_0x9109('0x1a'),'uri':_0x15c4c9+_0x9109('0x1b'),'form':{'grant_type':_0x9109('0x1c'),'client_id':_0x338e31['clientId'],'client_secret':_0x338e31[_0x9109('0x10')],'redirect_uri':_0x338e31[_0x9109('0xe')],'code':_0x338e31[_0x9109('0x11')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x524bf5)['then'](function(_0x5dd25b){var _0x1ebccf=JSON[_0x9109('0x1d')](_0x5dd25b);if(_0x1ebccf[_0x9109('0x1e')]){_0x338e31['refreshToken']=_0x1ebccf[_0x9109('0x1e')];logger[_0x9109('0x1f')](util[_0x9109('0x20')](_0x9109('0x21'),_0x338e31[_0x9109('0x22')],_0x338e31['id']));}else{logger[_0x9109('0x23')](util['format'](_0x9109('0x24'),_0x338e31[_0x9109('0x22')],_0x338e31['id']),util[_0x9109('0x25')](_0x1ebccf,{'showHidden':![],'depth':null}));}return _0x1a2d30(null,_0x2878df);})[_0x9109('0x26')](function(_0x390727){logger[_0x9109('0x23')](util['format'](_0x9109('0x24'),_0x338e31[_0x9109('0x22')],_0x338e31['id']),util[_0x9109('0x25')](parsedResult,{'showHidden':![],'depth':null}));return _0x1a2d30(_0x390727);});}else{return _0x1a2d30(null,_0x2878df);}},'beforeUpdate':function(_0xc810be,_0x30573c,_0x30a49b){if(_0xc810be[_0x9109('0xc')](_0x9109('0xd'))||_0xc810be[_0x9109('0xc')](_0x9109('0xe'))||_0xc810be[_0x9109('0xc')](_0x9109('0xf'))||_0xc810be[_0x9109('0xc')](_0x9109('0x10'))||_0xc810be['changed']('code')||_0xc810be[_0x9109('0xc')]('host')){var _0x143c83,_0x489fb9;_0x143c83=_0xc810be[_0x9109('0xe')];var _0x110ca3=_0x143c83['slice'](-0x1);if(_0x110ca3==='/'||_0x110ca3==='\x5c'||_0x110ca3===':'){_0x143c83=_0x143c83[_0x9109('0x14')](0x0,_0x143c83['lastIndexOf'](_0x110ca3));}switch(_0xc810be[_0x9109('0xd')]){case'US':_0x489fb9=_0x9109('0x27');break;case'AU':_0x489fb9=_0x9109('0x16');break;case'IN':_0x489fb9=_0x9109('0x17');break;case'CN':_0x489fb9=_0x9109('0x18');break;default:_0x489fb9='https://accounts.zoho.eu';break;}var _0x34a1a4={'method':_0x9109('0x1a'),'uri':_0x489fb9+_0x9109('0x1b'),'form':{'grant_type':_0x9109('0x1c'),'client_id':_0xc810be['clientId'],'client_secret':_0xc810be[_0x9109('0x10')],'redirect_uri':_0xc810be['serverUrl'],'code':_0xc810be['code']},'headers':{'Content-Type':_0x9109('0x28')}};return rp(_0x34a1a4)[_0x9109('0x29')](function(_0xa1c5c2){var _0x12c43c=JSON[_0x9109('0x1d')](_0xa1c5c2);if(_0x12c43c[_0x9109('0x1e')]){_0xc810be[_0x9109('0x2a')]=_0x12c43c[_0x9109('0x1e')];logger[_0x9109('0x1f')](util[_0x9109('0x20')](_0x9109('0x21'),_0xc810be[_0x9109('0x22')],_0xc810be['id']));}else{logger['error'](util[_0x9109('0x20')](_0x9109('0x24'),_0xc810be[_0x9109('0x22')],_0xc810be['id']),util[_0x9109('0x25')](_0x12c43c,{'showHidden':![],'depth':null}));}return _0x30a49b(null,_0x30573c);})[_0x9109('0x26')](function(_0x58d5b0){logger[_0x9109('0x23')](util[_0x9109('0x20')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0xc810be[_0x9109('0x22')],_0xc810be['id']),util[_0x9109('0x25')](parsedResult,{'showHidden':![],'depth':null}));return _0x30a49b(_0x58d5b0);});}else{return _0x30a49b(null,_0x30573c);}}}});}; \ No newline at end of file +var _0x96f0=['parse','refresh_token','refreshToken','info','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','zone','POST','/oauth/v2/token','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./intZohoAccount.attributes','exports','define','ZohoAccount','int_zoho_accounts','changed','serverUrl','clientId','clientSecret','code','host','slice','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','authorization_code','application/x-www-form-urlencoded','then'];(function(_0x422344,_0x276567){var _0x20efc8=function(_0x275ce9){while(--_0x275ce9){_0x422344['push'](_0x422344['shift']());}};_0x20efc8(++_0x276567);}(_0x96f0,0x116));var _0x096f=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0x96f0[_0x5c351c];return _0x26f3b3;};'use strict';var _=require(_0x096f('0x0'));var util=require(_0x096f('0x1'));var logger=require(_0x096f('0x2'))(_0x096f('0x3'));var moment=require('moment');var BPromise=require(_0x096f('0x4'));var rp=require(_0x096f('0x5'));var fs=require('fs');var path=require(_0x096f('0x6'));var rimraf=require(_0x096f('0x7'));var config=require('../../config/environment');var attributes=require(_0x096f('0x8'));var integrations=require('../../components/integrations/configuration');module[_0x096f('0x9')]=function(_0x59561a,_0x3759bb){return _0x59561a[_0x096f('0xa')](_0x096f('0xb'),attributes,{'tableName':_0x096f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x47a69b,_0x541c66,_0x106e4c){if(_0x47a69b[_0x096f('0xd')]('zone')||_0x47a69b['changed'](_0x096f('0xe'))||_0x47a69b[_0x096f('0xd')](_0x096f('0xf'))||_0x47a69b[_0x096f('0xd')](_0x096f('0x10'))||_0x47a69b[_0x096f('0xd')](_0x096f('0x11'))||_0x47a69b['changed'](_0x096f('0x12'))){var _0x4f442e,_0x57026c;_0x4f442e=_0x47a69b[_0x096f('0xe')];var _0x5866bc=_0x4f442e[_0x096f('0x13')](-0x1);if(_0x5866bc==='/'||_0x5866bc==='\x5c'||_0x5866bc===':'){_0x4f442e=_0x4f442e[_0x096f('0x14')](0x0,_0x4f442e[_0x096f('0x15')](_0x5866bc));}switch(_0x47a69b['zone']){case'US':_0x57026c=_0x096f('0x16');break;case'AU':_0x57026c=_0x096f('0x17');break;case'IN':_0x57026c=_0x096f('0x18');break;case'CN':_0x57026c=_0x096f('0x19');break;default:_0x57026c=_0x096f('0x1a');break;}var _0x5cc0d3={'method':'POST','uri':_0x57026c+'/oauth/v2/token','form':{'grant_type':_0x096f('0x1b'),'client_id':_0x47a69b[_0x096f('0xf')],'client_secret':_0x47a69b['clientSecret'],'redirect_uri':_0x47a69b[_0x096f('0xe')],'code':_0x47a69b['code']},'headers':{'Content-Type':_0x096f('0x1c')}};return rp(_0x5cc0d3)[_0x096f('0x1d')](function(_0xe10073){var _0x236cd0=JSON[_0x096f('0x1e')](_0xe10073);if(_0x236cd0[_0x096f('0x1f')]){_0x47a69b[_0x096f('0x20')]=_0x236cd0[_0x096f('0x1f')];logger[_0x096f('0x21')](util['format']('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x47a69b[_0x096f('0x22')],_0x47a69b['id']));}else{logger[_0x096f('0x23')](util['format'](_0x096f('0x24'),_0x47a69b[_0x096f('0x22')],_0x47a69b['id']),util[_0x096f('0x25')](_0x236cd0,{'showHidden':![],'depth':null}));}return _0x106e4c(null,_0x541c66);})[_0x096f('0x26')](function(_0x4c4b91){logger['error'](util['format'](_0x096f('0x24'),_0x47a69b[_0x096f('0x22')],_0x47a69b['id']),util[_0x096f('0x25')](parsedResult,{'showHidden':![],'depth':null}));return _0x106e4c(_0x4c4b91);});}else{return _0x106e4c(null,_0x541c66);}},'beforeUpdate':function(_0x352b48,_0x5da564,_0x5567c8){if(_0x352b48['changed'](_0x096f('0x27'))||_0x352b48['changed'](_0x096f('0xe'))||_0x352b48[_0x096f('0xd')](_0x096f('0xf'))||_0x352b48['changed'](_0x096f('0x10'))||_0x352b48['changed']('code')||_0x352b48[_0x096f('0xd')](_0x096f('0x12'))){var _0x23e9ca,_0x44a776;_0x23e9ca=_0x352b48[_0x096f('0xe')];var _0x25d55f=_0x23e9ca['slice'](-0x1);if(_0x25d55f==='/'||_0x25d55f==='\x5c'||_0x25d55f===':'){_0x23e9ca=_0x23e9ca[_0x096f('0x14')](0x0,_0x23e9ca[_0x096f('0x15')](_0x25d55f));}switch(_0x352b48['zone']){case'US':_0x44a776=_0x096f('0x16');break;case'AU':_0x44a776=_0x096f('0x17');break;case'IN':_0x44a776=_0x096f('0x18');break;case'CN':_0x44a776=_0x096f('0x19');break;default:_0x44a776='https://accounts.zoho.eu';break;}var _0x3f6cb8={'method':_0x096f('0x28'),'uri':_0x44a776+_0x096f('0x29'),'form':{'grant_type':_0x096f('0x1b'),'client_id':_0x352b48[_0x096f('0xf')],'client_secret':_0x352b48['clientSecret'],'redirect_uri':_0x352b48[_0x096f('0xe')],'code':_0x352b48[_0x096f('0x11')]},'headers':{'Content-Type':_0x096f('0x1c')}};return rp(_0x3f6cb8)[_0x096f('0x1d')](function(_0x44448c){var _0x6306db=JSON[_0x096f('0x1e')](_0x44448c);if(_0x6306db[_0x096f('0x1f')]){_0x352b48[_0x096f('0x20')]=_0x6306db[_0x096f('0x1f')];logger[_0x096f('0x21')](util[_0x096f('0x2a')](_0x096f('0x2b'),_0x352b48[_0x096f('0x22')],_0x352b48['id']));}else{logger[_0x096f('0x23')](util[_0x096f('0x2a')](_0x096f('0x24'),_0x352b48[_0x096f('0x22')],_0x352b48['id']),util[_0x096f('0x25')](_0x6306db,{'showHidden':![],'depth':null}));}return _0x5567c8(null,_0x5da564);})[_0x096f('0x26')](function(_0x2e107c){logger[_0x096f('0x23')](util[_0x096f('0x2a')](_0x096f('0x24'),_0x352b48[_0x096f('0x22')],_0x352b48['id']),util[_0x096f('0x25')](parsedResult,{'showHidden':![],'depth':null}));return _0x5567c8(_0x2e107c);});}else{return _0x5567c8(null,_0x5da564);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 1ea05db..0385126 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 _0xa057=['../../config/logger','../../config/environment','http','request','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetZohoAccount','ZohoAccount','options','where','attributes','limit','include','map','model','then','find','raw','ShowZohoAccount','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x41eafa,_0x1c154d){var _0x4d5e44=function(_0x5311cb){while(--_0x5311cb){_0x41eafa['push'](_0x41eafa['shift']());}};_0x4d5e44(++_0x1c154d);}(_0xa057,0x123));var _0x7a05=function(_0x1084a5,_0x579890){_0x1084a5=_0x1084a5-0x0;var _0xf18360=_0xa057[_0x1084a5];return _0xf18360;};'use strict';var _=require(_0x7a05('0x0'));var util=require(_0x7a05('0x1'));var moment=require('moment');var BPromise=require(_0x7a05('0x2'));var rs=require(_0x7a05('0x3'));var fs=require('fs');var Redis=require(_0x7a05('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7a05('0x5'));var logger=require(_0x7a05('0x6'))('rpc');var config=require(_0x7a05('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7a05('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x19e056,_0x2572af,_0x560067){return new BPromise(function(_0x32d32f,_0x2135d2){return client[_0x7a05('0x9')](_0x19e056,_0x560067)['then'](function(_0x31841c){logger[_0x7a05('0xa')](_0x7a05('0xb'),_0x2572af,_0x7a05('0xc'));logger[_0x7a05('0xd')](_0x7a05('0xe'),_0x2572af,'request\x20sent',JSON[_0x7a05('0xf')](_0x31841c));if(_0x31841c[_0x7a05('0x10')]){if(_0x31841c['error']['code']===0x1f4){logger[_0x7a05('0x10')](_0x7a05('0xb'),_0x2572af,_0x31841c['error']['message']);return _0x2135d2(_0x31841c['error'][_0x7a05('0x11')]);}logger[_0x7a05('0x10')](_0x7a05('0xb'),_0x2572af,_0x31841c[_0x7a05('0x10')][_0x7a05('0x11')]);return _0x32d32f(_0x31841c[_0x7a05('0x10')][_0x7a05('0x11')]);}else{logger[_0x7a05('0xa')]('ZohoAccount,\x20%s,\x20%s',_0x2572af,'request\x20sent');_0x32d32f(_0x31841c[_0x7a05('0x12')][_0x7a05('0x11')]);}})['catch'](function(_0x5ad0e6){logger[_0x7a05('0x10')]('ZohoAccount,\x20%s,\x20%s',_0x2572af,_0x5ad0e6);_0x2135d2(_0x5ad0e6);});});}exports[_0x7a05('0x13')]=function(_0x449d86){var _0x9e6a53=this;return new Promise(function(_0x5a9477,_0x519666){return db[_0x7a05('0x14')]['findAll']({'raw':_0x449d86[_0x7a05('0x15')]?_0x449d86[_0x7a05('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x449d86['options']?_0x449d86['options'][_0x7a05('0x16')]||null:null,'attributes':_0x449d86[_0x7a05('0x15')]?_0x449d86[_0x7a05('0x15')][_0x7a05('0x17')]||null:null,'limit':_0x449d86['options']?_0x449d86[_0x7a05('0x15')][_0x7a05('0x18')]||null:null,'include':_0x449d86[_0x7a05('0x15')]?_0x449d86['options'][_0x7a05('0x19')]?_[_0x7a05('0x1a')](_0x449d86[_0x7a05('0x15')][_0x7a05('0x19')],function(_0x1b62de){return{'model':db[_0x1b62de[_0x7a05('0x1b')]],'as':_0x1b62de['as'],'attributes':_0x1b62de[_0x7a05('0x17')],'include':_0x1b62de[_0x7a05('0x19')]?_[_0x7a05('0x1a')](_0x1b62de[_0x7a05('0x19')],function(_0x2c2390){return{'model':db[_0x2c2390['model']],'as':_0x2c2390['as'],'attributes':_0x2c2390['attributes'],'include':_0x2c2390['include']?_[_0x7a05('0x1a')](_0x2c2390[_0x7a05('0x19')],function(_0x124697){return{'model':db[_0x124697[_0x7a05('0x1b')]],'as':_0x124697['as'],'attributes':_0x124697[_0x7a05('0x17')]};}):[]};}):[]};}):[]:[]})[_0x7a05('0x1c')](function(_0x2fafe7){logger[_0x7a05('0xa')](_0x7a05('0x13'),_0x449d86);logger['debug']('GetZohoAccount',_0x449d86,JSON[_0x7a05('0xf')](_0x2fafe7));_0x5a9477(_0x2fafe7);})['catch'](function(_0x4f26bc){logger[_0x7a05('0x10')](_0x7a05('0x13'),_0x4f26bc[_0x7a05('0x11')],_0x449d86);_0x519666(_0x9e6a53[_0x7a05('0x10')](0x1f4,_0x4f26bc[_0x7a05('0x11')]));});});};exports['ShowZohoAccount']=function(_0x1106ad){var _0x272034=this;return new Promise(function(_0x37dbf1,_0x479c10){return db[_0x7a05('0x14')][_0x7a05('0x1d')]({'raw':_0x1106ad[_0x7a05('0x15')]?_0x1106ad['options'][_0x7a05('0x1e')]===undefined?!![]:![]:!![],'where':_0x1106ad[_0x7a05('0x15')]?_0x1106ad[_0x7a05('0x15')][_0x7a05('0x16')]||null:null,'attributes':_0x1106ad['options']?_0x1106ad[_0x7a05('0x15')]['attributes']||null:null,'include':_0x1106ad[_0x7a05('0x15')]?_0x1106ad[_0x7a05('0x15')]['include']?_[_0x7a05('0x1a')](_0x1106ad[_0x7a05('0x15')][_0x7a05('0x19')],function(_0x4e52bd){return{'model':db[_0x4e52bd[_0x7a05('0x1b')]],'as':_0x4e52bd['as'],'attributes':_0x4e52bd[_0x7a05('0x17')],'include':_0x4e52bd['include']?_[_0x7a05('0x1a')](_0x4e52bd[_0x7a05('0x19')],function(_0x4f0fb6){return{'model':db[_0x4f0fb6['model']],'as':_0x4f0fb6['as'],'attributes':_0x4f0fb6[_0x7a05('0x17')],'include':_0x4f0fb6[_0x7a05('0x19')]?_['map'](_0x4f0fb6[_0x7a05('0x19')],function(_0x39a83c){return{'model':db[_0x39a83c[_0x7a05('0x1b')]],'as':_0x39a83c['as'],'attributes':_0x39a83c[_0x7a05('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x44ca67){logger[_0x7a05('0xa')](_0x7a05('0x1f'),_0x1106ad);logger[_0x7a05('0xd')]('ShowZohoAccount',_0x1106ad,JSON['stringify'](_0x44ca67));_0x37dbf1(_0x44ca67);})[_0x7a05('0x20')](function(_0x52edc1){logger[_0x7a05('0x10')]('ShowZohoAccount',_0x52edc1['message'],_0x1106ad);_0x479c10(_0x272034[_0x7a05('0x10')](0x1f4,_0x52edc1[_0x7a05('0x11')]));});});}; \ No newline at end of file +var _0x4a03=['message','ZohoAccount,\x20%s,\x20%s','result','catch','GetZohoAccount','ZohoAccount','findAll','options','raw','where','attributes','include','map','model','find','ShowZohoAccount','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x4a03,0x16e));var _0x34a0=function(_0x4996d2,_0x410e09){_0x4996d2=_0x4996d2-0x0;var _0x2ac0dc=_0x4a03[_0x4996d2];return _0x2ac0dc;};'use strict';var _=require('lodash');var util=require(_0x34a0('0x0'));var moment=require(_0x34a0('0x1'));var BPromise=require(_0x34a0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x34a0('0x3'));var db=require(_0x34a0('0x4'))['db'];var utils=require(_0x34a0('0x5'));var logger=require('../../config/logger')(_0x34a0('0x6'));var config=require(_0x34a0('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x34a0('0x8')][_0x34a0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x491fe8,_0x44d6be,_0x2cf483){return new BPromise(function(_0x592827,_0xb182cc){return client[_0x34a0('0xa')](_0x491fe8,_0x2cf483)[_0x34a0('0xb')](function(_0x176571){logger[_0x34a0('0xc')]('ZohoAccount,\x20%s,\x20%s',_0x44d6be,_0x34a0('0xd'));logger[_0x34a0('0xe')](_0x34a0('0xf'),_0x44d6be,_0x34a0('0xd'),JSON[_0x34a0('0x10')](_0x176571));if(_0x176571[_0x34a0('0x11')]){if(_0x176571[_0x34a0('0x11')][_0x34a0('0x12')]===0x1f4){logger['error']('ZohoAccount,\x20%s,\x20%s',_0x44d6be,_0x176571[_0x34a0('0x11')][_0x34a0('0x13')]);return _0xb182cc(_0x176571['error'][_0x34a0('0x13')]);}logger[_0x34a0('0x11')](_0x34a0('0x14'),_0x44d6be,_0x176571[_0x34a0('0x11')][_0x34a0('0x13')]);return _0x592827(_0x176571[_0x34a0('0x11')][_0x34a0('0x13')]);}else{logger[_0x34a0('0xc')](_0x34a0('0x14'),_0x44d6be,_0x34a0('0xd'));_0x592827(_0x176571[_0x34a0('0x15')][_0x34a0('0x13')]);}})[_0x34a0('0x16')](function(_0x4134f0){logger[_0x34a0('0x11')](_0x34a0('0x14'),_0x44d6be,_0x4134f0);_0xb182cc(_0x4134f0);});});}exports[_0x34a0('0x17')]=function(_0x224cca){var _0xe380c8=this;return new Promise(function(_0x2c5325,_0x4fab3a){return db[_0x34a0('0x18')][_0x34a0('0x19')]({'raw':_0x224cca[_0x34a0('0x1a')]?_0x224cca[_0x34a0('0x1a')][_0x34a0('0x1b')]===undefined?!![]:![]:!![],'where':_0x224cca[_0x34a0('0x1a')]?_0x224cca['options'][_0x34a0('0x1c')]||null:null,'attributes':_0x224cca[_0x34a0('0x1a')]?_0x224cca[_0x34a0('0x1a')][_0x34a0('0x1d')]||null:null,'limit':_0x224cca[_0x34a0('0x1a')]?_0x224cca[_0x34a0('0x1a')]['limit']||null:null,'include':_0x224cca[_0x34a0('0x1a')]?_0x224cca[_0x34a0('0x1a')][_0x34a0('0x1e')]?_[_0x34a0('0x1f')](_0x224cca[_0x34a0('0x1a')][_0x34a0('0x1e')],function(_0x5354c7){return{'model':db[_0x5354c7[_0x34a0('0x20')]],'as':_0x5354c7['as'],'attributes':_0x5354c7[_0x34a0('0x1d')],'include':_0x5354c7['include']?_[_0x34a0('0x1f')](_0x5354c7[_0x34a0('0x1e')],function(_0x4fdbc3){return{'model':db[_0x4fdbc3[_0x34a0('0x20')]],'as':_0x4fdbc3['as'],'attributes':_0x4fdbc3[_0x34a0('0x1d')],'include':_0x4fdbc3[_0x34a0('0x1e')]?_[_0x34a0('0x1f')](_0x4fdbc3[_0x34a0('0x1e')],function(_0x5c49be){return{'model':db[_0x5c49be[_0x34a0('0x20')]],'as':_0x5c49be['as'],'attributes':_0x5c49be[_0x34a0('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x34a0('0xb')](function(_0x159b33){logger[_0x34a0('0xc')](_0x34a0('0x17'),_0x224cca);logger['debug']('GetZohoAccount',_0x224cca,JSON[_0x34a0('0x10')](_0x159b33));_0x2c5325(_0x159b33);})['catch'](function(_0x333ecf){logger[_0x34a0('0x11')](_0x34a0('0x17'),_0x333ecf[_0x34a0('0x13')],_0x224cca);_0x4fab3a(_0xe380c8[_0x34a0('0x11')](0x1f4,_0x333ecf[_0x34a0('0x13')]));});});};exports['ShowZohoAccount']=function(_0x31bd8e){var _0x13ddbe=this;return new Promise(function(_0x6190d0,_0x134451){return db[_0x34a0('0x18')][_0x34a0('0x21')]({'raw':_0x31bd8e[_0x34a0('0x1a')]?_0x31bd8e[_0x34a0('0x1a')][_0x34a0('0x1b')]===undefined?!![]:![]:!![],'where':_0x31bd8e[_0x34a0('0x1a')]?_0x31bd8e[_0x34a0('0x1a')][_0x34a0('0x1c')]||null:null,'attributes':_0x31bd8e[_0x34a0('0x1a')]?_0x31bd8e[_0x34a0('0x1a')]['attributes']||null:null,'include':_0x31bd8e[_0x34a0('0x1a')]?_0x31bd8e[_0x34a0('0x1a')][_0x34a0('0x1e')]?_['map'](_0x31bd8e[_0x34a0('0x1a')]['include'],function(_0x26d9b8){return{'model':db[_0x26d9b8[_0x34a0('0x20')]],'as':_0x26d9b8['as'],'attributes':_0x26d9b8[_0x34a0('0x1d')],'include':_0x26d9b8[_0x34a0('0x1e')]?_[_0x34a0('0x1f')](_0x26d9b8[_0x34a0('0x1e')],function(_0x4cb7fd){return{'model':db[_0x4cb7fd[_0x34a0('0x20')]],'as':_0x4cb7fd['as'],'attributes':_0x4cb7fd['attributes'],'include':_0x4cb7fd[_0x34a0('0x1e')]?_[_0x34a0('0x1f')](_0x4cb7fd[_0x34a0('0x1e')],function(_0x5ecab4){return{'model':db[_0x5ecab4[_0x34a0('0x20')]],'as':_0x5ecab4['as'],'attributes':_0x5ecab4[_0x34a0('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x34a0('0xb')](function(_0x1f629c){logger['info']('ShowZohoAccount',_0x31bd8e);logger[_0x34a0('0xe')](_0x34a0('0x22'),_0x31bd8e,JSON['stringify'](_0x1f629c));_0x6190d0(_0x1f629c);})[_0x34a0('0x16')](function(_0x135192){logger['error']('ShowZohoAccount',_0x135192['message'],_0x31bd8e);_0x134451(_0x13ddbe['error'](0x1f4,_0x135192[_0x34a0('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 1d8bf55..8e087f0 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 _0x37b4=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','create','delete','destroy','multer','util'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x37b4,0x166));var _0x437b=function(_0x20e79a,_0x322d4e){_0x20e79a=_0x20e79a-0x0;var _0x70801f=_0x37b4[_0x20e79a];return _0x70801f;};'use strict';var multer=require(_0x437b('0x0'));var util=require(_0x437b('0x1'));var path=require(_0x437b('0x2'));var timeout=require(_0x437b('0x3'));var express=require(_0x437b('0x4'));var router=express[_0x437b('0x5')]();var fs_extra=require(_0x437b('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x437b('0x7'));var config=require(_0x437b('0x8'));var controller=require('./intZohoConfiguration.controller');router[_0x437b('0x9')]('/',auth[_0x437b('0xa')](),controller['index']);router['get'](_0x437b('0xb'),auth[_0x437b('0xa')](),controller['show']);router['get'](_0x437b('0xc'),auth[_0x437b('0xa')](),controller[_0x437b('0xd')]);router[_0x437b('0x9')](_0x437b('0xe'),auth[_0x437b('0xa')](),controller[_0x437b('0xf')]);router[_0x437b('0x9')]('/:id/descriptions',auth[_0x437b('0xa')](),controller[_0x437b('0x10')]);router['post']('/',auth[_0x437b('0xa')](),controller[_0x437b('0x11')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x437b('0x12')](_0x437b('0xb'),auth[_0x437b('0xa')](),controller[_0x437b('0x13')]);module['exports']=router; \ No newline at end of file +var _0xeb86=['show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','./intZohoConfiguration.controller','get','isAuthenticated','index','/:id'];(function(_0x1b24c1,_0x504921){var _0x3ddd94=function(_0xeba046){while(--_0xeba046){_0x1b24c1['push'](_0x1b24c1['shift']());}};_0x3ddd94(++_0x504921);}(_0xeb86,0xa3));var _0x6eb8=function(_0x563284,_0x5da653){_0x563284=_0x563284-0x0;var _0x2fe1eb=_0xeb86[_0x563284];return _0x2fe1eb;};'use strict';var multer=require(_0x6eb8('0x0'));var util=require(_0x6eb8('0x1'));var path=require(_0x6eb8('0x2'));var timeout=require(_0x6eb8('0x3'));var express=require(_0x6eb8('0x4'));var router=express['Router']();var fs_extra=require(_0x6eb8('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x6eb8('0x6'));var config=require('../../config/environment');var controller=require(_0x6eb8('0x7'));router[_0x6eb8('0x8')]('/',auth[_0x6eb8('0x9')](),controller[_0x6eb8('0xa')]);router[_0x6eb8('0x8')](_0x6eb8('0xb'),auth['isAuthenticated'](),controller[_0x6eb8('0xc')]);router['get'](_0x6eb8('0xd'),auth[_0x6eb8('0x9')](),controller[_0x6eb8('0xe')]);router[_0x6eb8('0x8')](_0x6eb8('0xf'),auth['isAuthenticated'](),controller['getSubjects']);router['get'](_0x6eb8('0x10'),auth[_0x6eb8('0x9')](),controller[_0x6eb8('0x11')]);router[_0x6eb8('0x12')]('/',auth[_0x6eb8('0x9')](),controller[_0x6eb8('0x13')]);router[_0x6eb8('0x14')](_0x6eb8('0xb'),auth['isAuthenticated'](),controller[_0x6eb8('0x15')]);router[_0x6eb8('0x16')](_0x6eb8('0xb'),auth[_0x6eb8('0x9')](),controller[_0x6eb8('0x17')]);module[_0x6eb8('0x18')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 787f6b4..c42cc2b 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 _0x27b8=['sequelize','exports','STRING','ENUM','nothing','lead','contact_lead','contact'];(function(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0x27b8,0x80));var _0x827b=function(_0x45cb0d,_0x3eb821){_0x45cb0d=_0x45cb0d-0x0;var _0x40394b=_0x27b8[_0x45cb0d];return _0x40394b;};'use strict';var Sequelize=require(_0x827b('0x0'));module[_0x827b('0x1')]={'name':{'type':Sequelize[_0x827b('0x2')]},'moduleCreate':{'type':Sequelize[_0x827b('0x3')]('lead','contact',_0x827b('0x4')),'defaultValue':_0x827b('0x5')},'moduleSearch':{'type':Sequelize[_0x827b('0x3')](_0x827b('0x6'),_0x827b('0x7'),_0x827b('0x5')),'defaultValue':_0x827b('0x6')},'description':{'type':Sequelize[_0x827b('0x2')]}}; \ No newline at end of file +var _0x77c6=['contact','nothing','lead','contact_lead','STRING','sequelize','ENUM'];(function(_0x46c72b,_0xd150e5){var _0x19b0ef=function(_0x27288e){while(--_0x27288e){_0x46c72b['push'](_0x46c72b['shift']());}};_0x19b0ef(++_0xd150e5);}(_0x77c6,0x1b7));var _0x677c=function(_0x55483d,_0x51831b){_0x55483d=_0x55483d-0x0;var _0x3ba5f2=_0x77c6[_0x55483d];return _0x3ba5f2;};'use strict';var Sequelize=require(_0x677c('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize[_0x677c('0x1')]('lead',_0x677c('0x2'),_0x677c('0x3')),'defaultValue':_0x677c('0x4')},'moduleSearch':{'type':Sequelize[_0x677c('0x1')](_0x677c('0x5'),'contact',_0x677c('0x4')),'defaultValue':'contact_lead'},'description':{'type':Sequelize[_0x677c('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 659f924..411ba1f 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 _0xd609=['fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','map','merge','where','ZohoConfiguration','includeAll','include','rows','catch','show','params','find','create','body','findOne','ZohoField','options','getFields','getSubjects','getDescriptions','eml-format','zip-dir'];(function(_0x2cfb58,_0x3d9412){var _0xd99951=function(_0x329afa){while(--_0x329afa){_0x2cfb58['push'](_0x2cfb58['shift']());}};_0xd99951(++_0x3d9412);}(_0xd609,0x136));var _0x9d60=function(_0x511bf2,_0x438e43){_0x511bf2=_0x511bf2-0x0;var _0x3212b5=_0xd609[_0x511bf2];return _0x3212b5;};'use strict';var emlformat=require(_0x9d60('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9d60('0x1'));var jsonpatch=require(_0x9d60('0x2'));var rp=require('request-promise');var moment=require(_0x9d60('0x3'));var BPromise=require(_0x9d60('0x4'));var Mustache=require(_0x9d60('0x5'));var util=require(_0x9d60('0x6'));var path=require('path');var sox=require(_0x9d60('0x7'));var csv=require(_0x9d60('0x8'));var ejs=require(_0x9d60('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9d60('0xa'));var squel=require(_0x9d60('0xb'));var crypto=require(_0x9d60('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9d60('0xd'));var Redis=require(_0x9d60('0xe'));var authService=require(_0x9d60('0xf'));var qs=require(_0x9d60('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9d60('0x11'));var logger=require('../../config/logger')(_0x9d60('0x12'));var utils=require(_0x9d60('0x13'));var config=require(_0x9d60('0x14'));var licenseUtil=require(_0x9d60('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1e3b88,_0x461ca4){_0x461ca4=_0x461ca4||0xcc;return function(_0xbe131a){if(_0xbe131a){return _0x1e3b88[_0x9d60('0x16')](_0x461ca4);}return _0x1e3b88[_0x9d60('0x17')](_0x461ca4)[_0x9d60('0x18')]();};}function respondWithResult(_0x209b47,_0x15fe65){_0x15fe65=_0x15fe65||0xc8;return function(_0x712adc){if(_0x712adc){return _0x209b47['status'](_0x15fe65)[_0x9d60('0x19')](_0x712adc);}};}function respondWithFilteredResult(_0x10f4aa,_0x3e6024){return function(_0x47ef6e){if(_0x47ef6e){var _0x3d6bc4=typeof _0x3e6024['offset']===_0x9d60('0x1a')&&typeof _0x3e6024[_0x9d60('0x1b')]===_0x9d60('0x1a');var _0x52a13f=_0x47ef6e['count'];var _0x5d30ba=_0x3d6bc4?0x0:_0x3e6024[_0x9d60('0x1c')];var _0x142f29=_0x3d6bc4?_0x47ef6e[_0x9d60('0x1d')]:_0x3e6024[_0x9d60('0x1c')]+_0x3e6024[_0x9d60('0x1b')];var _0x12aae2;if(_0x142f29>=_0x52a13f){_0x142f29=_0x52a13f;_0x12aae2=0xc8;}else{_0x12aae2=0xce;}_0x10f4aa[_0x9d60('0x17')](_0x12aae2);return _0x10f4aa[_0x9d60('0x1e')](_0x9d60('0x1f'),_0x5d30ba+'-'+_0x142f29+'/'+_0x52a13f)[_0x9d60('0x19')](_0x47ef6e);}return null;};}function patchUpdates(_0x28e5e0){return function(_0x26802b){try{jsonpatch[_0x9d60('0x20')](_0x26802b,_0x28e5e0,!![]);}catch(_0x163b8){return BPromise['reject'](_0x163b8);}return _0x26802b[_0x9d60('0x21')]();};}function saveUpdates(_0xad0d04,_0x234b98){return function(_0x4b1238){if(_0x4b1238){return _0x4b1238[_0x9d60('0x22')](_0xad0d04)[_0x9d60('0x23')](function(_0x34ddbf){return _0x34ddbf;});}return null;};}function removeEntity(_0x3a96a1,_0x5d9349){return function(_0x2638dc){if(_0x2638dc){return _0x2638dc[_0x9d60('0x24')]()[_0x9d60('0x23')](function(){_0x3a96a1[_0x9d60('0x17')](0xcc)[_0x9d60('0x18')]();});}};}function handleEntityNotFound(_0x432f43,_0x12964f){return function(_0x2bf4e6){if(!_0x2bf4e6){_0x432f43[_0x9d60('0x16')](0x194);}return _0x2bf4e6;};}function handleError(_0x46c0ce,_0x3d41c0){_0x3d41c0=_0x3d41c0||0x1f4;return function(_0x4768c4){logger[_0x9d60('0x25')](_0x4768c4[_0x9d60('0x26')]);if(_0x4768c4[_0x9d60('0x27')]){delete _0x4768c4['name'];}_0x46c0ce[_0x9d60('0x17')](_0x3d41c0)[_0x9d60('0x28')](_0x4768c4);};}exports[_0x9d60('0x29')]=function(_0x144a6f,_0x152e6a){var _0x2d4045={},_0x4b86a4={},_0x38022b={'count':0x0,'rows':[]};var _0x1d01ff=_['map'](db['ZohoConfiguration'][_0x9d60('0x2a')],function(_0x468571){return{'name':_0x468571[_0x9d60('0x2b')],'type':_0x468571[_0x9d60('0x2c')][_0x9d60('0x2d')]};});_0x4b86a4[_0x9d60('0x2e')]=_['map'](_0x1d01ff,_0x9d60('0x27'));_0x4b86a4[_0x9d60('0x2f')]=_[_0x9d60('0x30')](_0x144a6f[_0x9d60('0x2f')]);_0x4b86a4[_0x9d60('0x31')]=_[_0x9d60('0x32')](_0x4b86a4['model'],_0x4b86a4[_0x9d60('0x2f')]);_0x2d4045[_0x9d60('0x33')]=_[_0x9d60('0x32')](_0x4b86a4['model'],qs[_0x9d60('0x34')](_0x144a6f[_0x9d60('0x2f')][_0x9d60('0x34')]));_0x2d4045[_0x9d60('0x33')]=_0x2d4045[_0x9d60('0x33')][_0x9d60('0x35')]?_0x2d4045[_0x9d60('0x33')]:_0x4b86a4[_0x9d60('0x2e')];if(!_0x144a6f[_0x9d60('0x2f')]['hasOwnProperty'](_0x9d60('0x36'))){_0x2d4045[_0x9d60('0x1b')]=qs[_0x9d60('0x1b')](_0x144a6f[_0x9d60('0x2f')][_0x9d60('0x1b')]);_0x2d4045[_0x9d60('0x1c')]=qs['offset'](_0x144a6f['query'][_0x9d60('0x1c')]);}_0x2d4045[_0x9d60('0x37')]=qs[_0x9d60('0x38')](_0x144a6f[_0x9d60('0x2f')]['sort']);_0x2d4045['where']=qs[_0x9d60('0x31')](_[_0x9d60('0x39')](_0x144a6f[_0x9d60('0x2f')],_0x4b86a4['filters']),_0x1d01ff);if(_0x144a6f[_0x9d60('0x2f')][_0x9d60('0x3a')]){_0x2d4045['where']=_['merge'](_0x2d4045['where'],{'$or':_[_0x9d60('0x3b')](_0x1d01ff,function(_0x314c05){if(_0x314c05[_0x9d60('0x2c')]!=='VIRTUAL'){var _0x1d3e2d={};_0x1d3e2d[_0x314c05['name']]={'$like':'%'+_0x144a6f[_0x9d60('0x2f')]['filter']+'%'};return _0x1d3e2d;}})});}_0x2d4045=_[_0x9d60('0x3c')]({},_0x2d4045,_0x144a6f['options']);var _0x5953a6={'where':_0x2d4045[_0x9d60('0x3d')]};return db[_0x9d60('0x3e')]['count'](_0x5953a6)[_0x9d60('0x23')](function(_0x1eef32){_0x38022b[_0x9d60('0x1d')]=_0x1eef32;if(_0x144a6f[_0x9d60('0x2f')][_0x9d60('0x3f')]){_0x2d4045[_0x9d60('0x40')]=[{'all':!![]}];}return db[_0x9d60('0x3e')]['findAll'](_0x2d4045);})[_0x9d60('0x23')](function(_0x3724fa){_0x38022b[_0x9d60('0x41')]=_0x3724fa;return _0x38022b;})[_0x9d60('0x23')](respondWithFilteredResult(_0x152e6a,_0x2d4045))[_0x9d60('0x42')](handleError(_0x152e6a,null));};exports[_0x9d60('0x43')]=function(_0x1d397b,_0x25d5f3){var _0x366f9f={'raw':![],'where':{'id':_0x1d397b[_0x9d60('0x44')]['id']}},_0x3f3f8f={};_0x3f3f8f['model']=_[_0x9d60('0x30')](db[_0x9d60('0x3e')][_0x9d60('0x2a')]);_0x3f3f8f[_0x9d60('0x2f')]=_[_0x9d60('0x30')](_0x1d397b[_0x9d60('0x2f')]);_0x3f3f8f[_0x9d60('0x31')]=_[_0x9d60('0x32')](_0x3f3f8f[_0x9d60('0x2e')],_0x3f3f8f['query']);_0x366f9f[_0x9d60('0x33')]=_[_0x9d60('0x32')](_0x3f3f8f['model'],qs['fields'](_0x1d397b[_0x9d60('0x2f')][_0x9d60('0x34')]));_0x366f9f['attributes']=_0x366f9f[_0x9d60('0x33')][_0x9d60('0x35')]?_0x366f9f[_0x9d60('0x33')]:_0x3f3f8f[_0x9d60('0x2e')];if(_0x1d397b[_0x9d60('0x2f')][_0x9d60('0x3f')]){_0x366f9f[_0x9d60('0x40')]=[{'all':!![]}];}_0x366f9f=_[_0x9d60('0x3c')]({},_0x366f9f,_0x1d397b['options']);return db['ZohoConfiguration'][_0x9d60('0x45')](_0x366f9f)[_0x9d60('0x23')](handleEntityNotFound(_0x25d5f3,null))[_0x9d60('0x23')](respondWithResult(_0x25d5f3,null))[_0x9d60('0x42')](handleError(_0x25d5f3,null));};exports['create']=function(_0x9df8e0,_0x1ac1f1){return db[_0x9d60('0x3e')][_0x9d60('0x46')](_0x9df8e0[_0x9d60('0x47')],{})['then'](respondWithResult(_0x1ac1f1,0xc9))[_0x9d60('0x42')](handleError(_0x1ac1f1,null));};exports[_0x9d60('0x22')]=function(_0x30f451,_0x366f52){if(_0x30f451[_0x9d60('0x47')]['id']){delete _0x30f451[_0x9d60('0x47')]['id'];}return db[_0x9d60('0x3e')]['find']({'where':{'id':_0x30f451[_0x9d60('0x44')]['id']}})['then'](handleEntityNotFound(_0x366f52,null))['then'](saveUpdates(_0x30f451[_0x9d60('0x47')],null))[_0x9d60('0x23')](respondWithResult(_0x366f52,null))['catch'](handleError(_0x366f52,null));};exports[_0x9d60('0x24')]=function(_0x11b124,_0xace9af){return db['ZohoConfiguration'][_0x9d60('0x45')]({'where':{'id':_0x11b124[_0x9d60('0x44')]['id']}})[_0x9d60('0x23')](handleEntityNotFound(_0xace9af,null))[_0x9d60('0x23')](removeEntity(_0xace9af,null))[_0x9d60('0x42')](handleError(_0xace9af,null));};exports['getFields']=function(_0x235299,_0x1a9a4c,_0x1afaef){var _0x11fc69={};var _0xf5edba={};var _0x3efcac;var _0x5f35b5;return db[_0x9d60('0x3e')][_0x9d60('0x48')]({'where':{'id':_0x235299[_0x9d60('0x44')]['id']}})['then'](handleEntityNotFound(_0x1a9a4c,null))[_0x9d60('0x23')](function(_0x4d565f){if(_0x4d565f){_0x3efcac=_0x4d565f;_0xf5edba[_0x9d60('0x2e')]=_[_0x9d60('0x30')](db[_0x9d60('0x49')][_0x9d60('0x2a')]);_0xf5edba[_0x9d60('0x2f')]=_['keys'](_0x235299[_0x9d60('0x2f')]);_0xf5edba[_0x9d60('0x31')]=_[_0x9d60('0x32')](_0xf5edba[_0x9d60('0x2e')],_0xf5edba['query']);_0x11fc69[_0x9d60('0x33')]=_[_0x9d60('0x32')](_0xf5edba[_0x9d60('0x2e')],qs[_0x9d60('0x34')](_0x235299[_0x9d60('0x2f')]['fields']));_0x11fc69[_0x9d60('0x33')]=_0x11fc69[_0x9d60('0x33')][_0x9d60('0x35')]?_0x11fc69[_0x9d60('0x33')]:_0xf5edba['model'];_0x11fc69[_0x9d60('0x37')]=qs['sort'](_0x235299['query'][_0x9d60('0x38')]);_0x11fc69[_0x9d60('0x3d')]=qs[_0x9d60('0x31')](_[_0x9d60('0x39')](_0x235299[_0x9d60('0x2f')],_0xf5edba[_0x9d60('0x31')]));if(_0x235299[_0x9d60('0x2f')]['filter']){_0x11fc69[_0x9d60('0x3d')]=_[_0x9d60('0x3c')](_0x11fc69['where'],{'$or':_[_0x9d60('0x3b')](_0x11fc69[_0x9d60('0x33')],function(_0x3dd32f){var _0xd8e256={};_0xd8e256[_0x3dd32f]={'$like':'%'+_0x235299[_0x9d60('0x2f')][_0x9d60('0x3a')]+'%'};return _0xd8e256;})});}_0x11fc69=_[_0x9d60('0x3c')]({},_0x11fc69,_0x235299[_0x9d60('0x4a')]);return _0x3efcac[_0x9d60('0x4b')](_0x11fc69);}})[_0x9d60('0x23')](function(_0x44c182){if(_0x44c182){_0x5f35b5=_0x44c182['length'];if(!_0x235299[_0x9d60('0x2f')]['hasOwnProperty'](_0x9d60('0x36'))){_0x11fc69['limit']=qs['limit'](_0x235299['query'][_0x9d60('0x1b')]);_0x11fc69['offset']=qs[_0x9d60('0x1c')](_0x235299[_0x9d60('0x2f')][_0x9d60('0x1c')]);}return _0x3efcac['getFields'](_0x11fc69);}})[_0x9d60('0x23')](function(_0xc77e9d){if(_0xc77e9d){return _0xc77e9d?{'count':_0x5f35b5,'rows':_0xc77e9d}:null;}})[_0x9d60('0x23')](respondWithResult(_0x1a9a4c,null))[_0x9d60('0x42')](handleError(_0x1a9a4c,null));};exports[_0x9d60('0x4c')]=function(_0x562cfe,_0x4080ce,_0x59fc91){var _0x45f046={};var _0x2d769c={};var _0x5e4231;var _0x1b6c06;return db[_0x9d60('0x3e')][_0x9d60('0x48')]({'where':{'id':_0x562cfe[_0x9d60('0x44')]['id']}})[_0x9d60('0x23')](handleEntityNotFound(_0x4080ce,null))[_0x9d60('0x23')](function(_0x316eb0){if(_0x316eb0){_0x5e4231=_0x316eb0;_0x2d769c[_0x9d60('0x2e')]=_[_0x9d60('0x30')](db[_0x9d60('0x49')][_0x9d60('0x2a')]);_0x2d769c[_0x9d60('0x2f')]=_['keys'](_0x562cfe['query']);_0x2d769c[_0x9d60('0x31')]=_[_0x9d60('0x32')](_0x2d769c[_0x9d60('0x2e')],_0x2d769c['query']);_0x45f046[_0x9d60('0x33')]=_[_0x9d60('0x32')](_0x2d769c[_0x9d60('0x2e')],qs[_0x9d60('0x34')](_0x562cfe[_0x9d60('0x2f')][_0x9d60('0x34')]));_0x45f046[_0x9d60('0x33')]=_0x45f046[_0x9d60('0x33')][_0x9d60('0x35')]?_0x45f046[_0x9d60('0x33')]:_0x2d769c['model'];_0x45f046[_0x9d60('0x37')]=qs[_0x9d60('0x38')](_0x562cfe['query'][_0x9d60('0x38')]);_0x45f046[_0x9d60('0x3d')]=qs[_0x9d60('0x31')](_[_0x9d60('0x39')](_0x562cfe[_0x9d60('0x2f')],_0x2d769c[_0x9d60('0x31')]));if(_0x562cfe[_0x9d60('0x2f')][_0x9d60('0x3a')]){_0x45f046[_0x9d60('0x3d')]=_[_0x9d60('0x3c')](_0x45f046[_0x9d60('0x3d')],{'$or':_[_0x9d60('0x3b')](_0x45f046[_0x9d60('0x33')],function(_0x4487a6){var _0x53ab66={};_0x53ab66[_0x4487a6]={'$like':'%'+_0x562cfe[_0x9d60('0x2f')][_0x9d60('0x3a')]+'%'};return _0x53ab66;})});}_0x45f046=_['merge']({},_0x45f046,_0x562cfe[_0x9d60('0x4a')]);return _0x5e4231[_0x9d60('0x4c')](_0x45f046);}})[_0x9d60('0x23')](function(_0x8075e6){if(_0x8075e6){_0x1b6c06=_0x8075e6[_0x9d60('0x35')];if(!_0x562cfe[_0x9d60('0x2f')]['hasOwnProperty'](_0x9d60('0x36'))){_0x45f046[_0x9d60('0x1b')]=qs[_0x9d60('0x1b')](_0x562cfe['query'][_0x9d60('0x1b')]);_0x45f046[_0x9d60('0x1c')]=qs['offset'](_0x562cfe[_0x9d60('0x2f')][_0x9d60('0x1c')]);}return _0x5e4231[_0x9d60('0x4c')](_0x45f046);}})['then'](function(_0x1be1bd){if(_0x1be1bd){return _0x1be1bd?{'count':_0x1b6c06,'rows':_0x1be1bd}:null;}})[_0x9d60('0x23')](respondWithResult(_0x4080ce,null))[_0x9d60('0x42')](handleError(_0x4080ce,null));};exports[_0x9d60('0x4d')]=function(_0xc966fc,_0x2c8749,_0x358d02){var _0x430733={};var _0x3ff008={};var _0x2d0af8;var _0x197c21;return db[_0x9d60('0x3e')][_0x9d60('0x48')]({'where':{'id':_0xc966fc[_0x9d60('0x44')]['id']}})['then'](handleEntityNotFound(_0x2c8749,null))['then'](function(_0x2e5ba9){if(_0x2e5ba9){_0x2d0af8=_0x2e5ba9;_0x3ff008['model']=_[_0x9d60('0x30')](db['ZohoField'][_0x9d60('0x2a')]);_0x3ff008['query']=_[_0x9d60('0x30')](_0xc966fc['query']);_0x3ff008['filters']=_[_0x9d60('0x32')](_0x3ff008[_0x9d60('0x2e')],_0x3ff008[_0x9d60('0x2f')]);_0x430733[_0x9d60('0x33')]=_[_0x9d60('0x32')](_0x3ff008[_0x9d60('0x2e')],qs[_0x9d60('0x34')](_0xc966fc['query'][_0x9d60('0x34')]));_0x430733[_0x9d60('0x33')]=_0x430733['attributes'][_0x9d60('0x35')]?_0x430733['attributes']:_0x3ff008[_0x9d60('0x2e')];_0x430733[_0x9d60('0x37')]=qs[_0x9d60('0x38')](_0xc966fc[_0x9d60('0x2f')][_0x9d60('0x38')]);_0x430733[_0x9d60('0x3d')]=qs[_0x9d60('0x31')](_['pick'](_0xc966fc[_0x9d60('0x2f')],_0x3ff008['filters']));if(_0xc966fc[_0x9d60('0x2f')][_0x9d60('0x3a')]){_0x430733['where']=_['merge'](_0x430733[_0x9d60('0x3d')],{'$or':_[_0x9d60('0x3b')](_0x430733[_0x9d60('0x33')],function(_0x2cf4b3){var _0x2b06fb={};_0x2b06fb[_0x2cf4b3]={'$like':'%'+_0xc966fc[_0x9d60('0x2f')]['filter']+'%'};return _0x2b06fb;})});}_0x430733=_[_0x9d60('0x3c')]({},_0x430733,_0xc966fc[_0x9d60('0x4a')]);return _0x2d0af8[_0x9d60('0x4d')](_0x430733);}})[_0x9d60('0x23')](function(_0x54612d){if(_0x54612d){_0x197c21=_0x54612d[_0x9d60('0x35')];if(!_0xc966fc['query']['hasOwnProperty'](_0x9d60('0x36'))){_0x430733[_0x9d60('0x1b')]=qs[_0x9d60('0x1b')](_0xc966fc[_0x9d60('0x2f')][_0x9d60('0x1b')]);_0x430733[_0x9d60('0x1c')]=qs[_0x9d60('0x1c')](_0xc966fc['query'][_0x9d60('0x1c')]);}return _0x2d0af8['getDescriptions'](_0x430733);}})['then'](function(_0x1d685c){if(_0x1d685c){return _0x1d685c?{'count':_0x197c21,'rows':_0x1d685c}:null;}})[_0x9d60('0x23')](respondWithResult(_0x2c8749,null))[_0x9d60('0x42')](handleError(_0x2c8749,null));}; \ No newline at end of file +var _0x1a19=['filter','merge','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','find','create','body','destroy','findOne','ZohoField','pick','getFields','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','save','update','then','error','stack','index','map','ZohoConfiguration','fieldName','type','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x1e8707,_0x24ffcb){var _0x42085a=function(_0x35dca1){while(--_0x35dca1){_0x1e8707['push'](_0x1e8707['shift']());}};_0x42085a(++_0x24ffcb);}(_0x1a19,0x15d));var _0x91a1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1a19[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x91a1('0x0'));var rimraf=require(_0x91a1('0x1'));var zipdir=require(_0x91a1('0x2'));var jsonpatch=require(_0x91a1('0x3'));var rp=require(_0x91a1('0x4'));var moment=require(_0x91a1('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x91a1('0x6'));var util=require(_0x91a1('0x7'));var path=require(_0x91a1('0x8'));var sox=require(_0x91a1('0x9'));var csv=require('to-csv');var ejs=require(_0x91a1('0xa'));var fs=require('fs');var fs_extra=require(_0x91a1('0xb'));var _=require('lodash');var squel=require(_0x91a1('0xc'));var crypto=require(_0x91a1('0xd'));var jsforce=require(_0x91a1('0xe'));var deskjs=require(_0x91a1('0xf'));var toCsv=require(_0x91a1('0x10'));var querystring=require(_0x91a1('0x11'));var Papa=require(_0x91a1('0x12'));var Redis=require(_0x91a1('0x13'));var authService=require(_0x91a1('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x91a1('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x91a1('0x16'))(_0x91a1('0x17'));var utils=require(_0x91a1('0x18'));var config=require(_0x91a1('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x91a1('0x1a'))['db'];function respondWithStatusCode(_0x529f68,_0x51035e){_0x51035e=_0x51035e||0xcc;return function(_0x57a2f6){if(_0x57a2f6){return _0x529f68[_0x91a1('0x1b')](_0x51035e);}return _0x529f68[_0x91a1('0x1c')](_0x51035e)[_0x91a1('0x1d')]();};}function respondWithResult(_0x332054,_0x22d039){_0x22d039=_0x22d039||0xc8;return function(_0x38fd6e){if(_0x38fd6e){return _0x332054[_0x91a1('0x1c')](_0x22d039)[_0x91a1('0x1e')](_0x38fd6e);}};}function respondWithFilteredResult(_0x3c5fb3,_0x4ff9f0){return function(_0x274d00){if(_0x274d00){var _0x45c26d=typeof _0x4ff9f0['offset']==='undefined'&&typeof _0x4ff9f0[_0x91a1('0x1f')]===_0x91a1('0x20');var _0xf8c8df=_0x274d00[_0x91a1('0x21')];var _0x3d5f5b=_0x45c26d?0x0:_0x4ff9f0[_0x91a1('0x22')];var _0x2428ba=_0x45c26d?_0x274d00[_0x91a1('0x21')]:_0x4ff9f0['offset']+_0x4ff9f0[_0x91a1('0x1f')];var _0x280486;if(_0x2428ba>=_0xf8c8df){_0x2428ba=_0xf8c8df;_0x280486=0xc8;}else{_0x280486=0xce;}_0x3c5fb3['status'](_0x280486);return _0x3c5fb3[_0x91a1('0x23')](_0x91a1('0x24'),_0x3d5f5b+'-'+_0x2428ba+'/'+_0xf8c8df)['json'](_0x274d00);}return null;};}function patchUpdates(_0x1c365a){return function(_0x1ee313){try{jsonpatch[_0x91a1('0x25')](_0x1ee313,_0x1c365a,!![]);}catch(_0x262f1e){return BPromise['reject'](_0x262f1e);}return _0x1ee313[_0x91a1('0x26')]();};}function saveUpdates(_0x34d101,_0x505787){return function(_0xb1e6ed){if(_0xb1e6ed){return _0xb1e6ed[_0x91a1('0x27')](_0x34d101)[_0x91a1('0x28')](function(_0xd93d87){return _0xd93d87;});}return null;};}function removeEntity(_0x543684,_0x4e85df){return function(_0x4ebcab){if(_0x4ebcab){return _0x4ebcab['destroy']()[_0x91a1('0x28')](function(){_0x543684[_0x91a1('0x1c')](0xcc)[_0x91a1('0x1d')]();});}};}function handleEntityNotFound(_0x1fd602,_0x440e4e){return function(_0x3a76b4){if(!_0x3a76b4){_0x1fd602[_0x91a1('0x1b')](0x194);}return _0x3a76b4;};}function handleError(_0x160476,_0x1a0a4f){_0x1a0a4f=_0x1a0a4f||0x1f4;return function(_0x589d2e){logger[_0x91a1('0x29')](_0x589d2e[_0x91a1('0x2a')]);if(_0x589d2e['name']){delete _0x589d2e['name'];}_0x160476['status'](_0x1a0a4f)['send'](_0x589d2e);};}exports[_0x91a1('0x2b')]=function(_0x3ea04e,_0x4ed94b){var _0x47e5ae={},_0x20c09d={},_0x386788={'count':0x0,'rows':[]};var _0x6ecf74=_[_0x91a1('0x2c')](db[_0x91a1('0x2d')]['rawAttributes'],function(_0x3f87a8){return{'name':_0x3f87a8[_0x91a1('0x2e')],'type':_0x3f87a8[_0x91a1('0x2f')]['key']};});_0x20c09d['model']=_[_0x91a1('0x2c')](_0x6ecf74,'name');_0x20c09d[_0x91a1('0x30')]=_[_0x91a1('0x31')](_0x3ea04e[_0x91a1('0x30')]);_0x20c09d[_0x91a1('0x32')]=_[_0x91a1('0x33')](_0x20c09d['model'],_0x20c09d[_0x91a1('0x30')]);_0x47e5ae['attributes']=_[_0x91a1('0x33')](_0x20c09d[_0x91a1('0x34')],qs['fields'](_0x3ea04e[_0x91a1('0x30')][_0x91a1('0x35')]));_0x47e5ae[_0x91a1('0x36')]=_0x47e5ae[_0x91a1('0x36')][_0x91a1('0x37')]?_0x47e5ae[_0x91a1('0x36')]:_0x20c09d['model'];if(!_0x3ea04e[_0x91a1('0x30')][_0x91a1('0x38')](_0x91a1('0x39'))){_0x47e5ae[_0x91a1('0x1f')]=qs['limit'](_0x3ea04e[_0x91a1('0x30')][_0x91a1('0x1f')]);_0x47e5ae['offset']=qs[_0x91a1('0x22')](_0x3ea04e[_0x91a1('0x30')][_0x91a1('0x22')]);}_0x47e5ae[_0x91a1('0x3a')]=qs[_0x91a1('0x3b')](_0x3ea04e[_0x91a1('0x30')][_0x91a1('0x3b')]);_0x47e5ae[_0x91a1('0x3c')]=qs[_0x91a1('0x32')](_['pick'](_0x3ea04e[_0x91a1('0x30')],_0x20c09d[_0x91a1('0x32')]),_0x6ecf74);if(_0x3ea04e[_0x91a1('0x30')][_0x91a1('0x3d')]){_0x47e5ae[_0x91a1('0x3c')]=_[_0x91a1('0x3e')](_0x47e5ae[_0x91a1('0x3c')],{'$or':_['map'](_0x6ecf74,function(_0x5db40f){if(_0x5db40f[_0x91a1('0x2f')]!=='VIRTUAL'){var _0x49d62f={};_0x49d62f[_0x5db40f['name']]={'$like':'%'+_0x3ea04e[_0x91a1('0x30')][_0x91a1('0x3d')]+'%'};return _0x49d62f;}})});}_0x47e5ae=_[_0x91a1('0x3e')]({},_0x47e5ae,_0x3ea04e['options']);var _0x2b1865={'where':_0x47e5ae['where']};return db[_0x91a1('0x2d')][_0x91a1('0x21')](_0x2b1865)['then'](function(_0x416a62){_0x386788[_0x91a1('0x21')]=_0x416a62;if(_0x3ea04e[_0x91a1('0x30')][_0x91a1('0x3f')]){_0x47e5ae[_0x91a1('0x40')]=[{'all':!![]}];}return db[_0x91a1('0x2d')][_0x91a1('0x41')](_0x47e5ae);})[_0x91a1('0x28')](function(_0xe2cf9b){_0x386788[_0x91a1('0x42')]=_0xe2cf9b;return _0x386788;})[_0x91a1('0x28')](respondWithFilteredResult(_0x4ed94b,_0x47e5ae))[_0x91a1('0x43')](handleError(_0x4ed94b,null));};exports[_0x91a1('0x44')]=function(_0x353b69,_0x5f2b21){var _0x2e8e14={'raw':![],'where':{'id':_0x353b69[_0x91a1('0x45')]['id']}},_0xc35e60={};_0xc35e60['model']=_[_0x91a1('0x31')](db[_0x91a1('0x2d')][_0x91a1('0x46')]);_0xc35e60['query']=_[_0x91a1('0x31')](_0x353b69[_0x91a1('0x30')]);_0xc35e60[_0x91a1('0x32')]=_['intersection'](_0xc35e60[_0x91a1('0x34')],_0xc35e60['query']);_0x2e8e14[_0x91a1('0x36')]=_[_0x91a1('0x33')](_0xc35e60[_0x91a1('0x34')],qs[_0x91a1('0x35')](_0x353b69['query']['fields']));_0x2e8e14['attributes']=_0x2e8e14['attributes']['length']?_0x2e8e14['attributes']:_0xc35e60[_0x91a1('0x34')];if(_0x353b69['query']['includeAll']){_0x2e8e14[_0x91a1('0x40')]=[{'all':!![]}];}_0x2e8e14=_[_0x91a1('0x3e')]({},_0x2e8e14,_0x353b69[_0x91a1('0x47')]);return db[_0x91a1('0x2d')][_0x91a1('0x48')](_0x2e8e14)[_0x91a1('0x28')](handleEntityNotFound(_0x5f2b21,null))['then'](respondWithResult(_0x5f2b21,null))['catch'](handleError(_0x5f2b21,null));};exports[_0x91a1('0x49')]=function(_0x344b92,_0x5b5025){return db[_0x91a1('0x2d')][_0x91a1('0x49')](_0x344b92[_0x91a1('0x4a')],{})[_0x91a1('0x28')](respondWithResult(_0x5b5025,0xc9))['catch'](handleError(_0x5b5025,null));};exports[_0x91a1('0x27')]=function(_0x33e68d,_0x14100c){if(_0x33e68d[_0x91a1('0x4a')]['id']){delete _0x33e68d[_0x91a1('0x4a')]['id'];}return db[_0x91a1('0x2d')][_0x91a1('0x48')]({'where':{'id':_0x33e68d[_0x91a1('0x45')]['id']}})[_0x91a1('0x28')](handleEntityNotFound(_0x14100c,null))['then'](saveUpdates(_0x33e68d['body'],null))[_0x91a1('0x28')](respondWithResult(_0x14100c,null))['catch'](handleError(_0x14100c,null));};exports[_0x91a1('0x4b')]=function(_0x493a94,_0xfa2e3b){return db[_0x91a1('0x2d')]['find']({'where':{'id':_0x493a94[_0x91a1('0x45')]['id']}})['then'](handleEntityNotFound(_0xfa2e3b,null))[_0x91a1('0x28')](removeEntity(_0xfa2e3b,null))['catch'](handleError(_0xfa2e3b,null));};exports['getFields']=function(_0x2c2081,_0x46fcdc,_0x349d92){var _0x538992={};var _0x9173b={};var _0x54b12f;var _0xe0da15;return db[_0x91a1('0x2d')][_0x91a1('0x4c')]({'where':{'id':_0x2c2081[_0x91a1('0x45')]['id']}})[_0x91a1('0x28')](handleEntityNotFound(_0x46fcdc,null))['then'](function(_0x3e2c5b){if(_0x3e2c5b){_0x54b12f=_0x3e2c5b;_0x9173b[_0x91a1('0x34')]=_[_0x91a1('0x31')](db[_0x91a1('0x4d')][_0x91a1('0x46')]);_0x9173b[_0x91a1('0x30')]=_['keys'](_0x2c2081[_0x91a1('0x30')]);_0x9173b[_0x91a1('0x32')]=_[_0x91a1('0x33')](_0x9173b['model'],_0x9173b['query']);_0x538992[_0x91a1('0x36')]=_[_0x91a1('0x33')](_0x9173b['model'],qs[_0x91a1('0x35')](_0x2c2081[_0x91a1('0x30')][_0x91a1('0x35')]));_0x538992[_0x91a1('0x36')]=_0x538992[_0x91a1('0x36')][_0x91a1('0x37')]?_0x538992[_0x91a1('0x36')]:_0x9173b[_0x91a1('0x34')];_0x538992['order']=qs['sort'](_0x2c2081['query'][_0x91a1('0x3b')]);_0x538992[_0x91a1('0x3c')]=qs['filters'](_[_0x91a1('0x4e')](_0x2c2081[_0x91a1('0x30')],_0x9173b['filters']));if(_0x2c2081[_0x91a1('0x30')]['filter']){_0x538992[_0x91a1('0x3c')]=_[_0x91a1('0x3e')](_0x538992[_0x91a1('0x3c')],{'$or':_[_0x91a1('0x2c')](_0x538992['attributes'],function(_0x1cc15a){var _0x2b3c1d={};_0x2b3c1d[_0x1cc15a]={'$like':'%'+_0x2c2081[_0x91a1('0x30')]['filter']+'%'};return _0x2b3c1d;})});}_0x538992=_['merge']({},_0x538992,_0x2c2081[_0x91a1('0x47')]);return _0x54b12f[_0x91a1('0x4f')](_0x538992);}})[_0x91a1('0x28')](function(_0x44b75e){if(_0x44b75e){_0xe0da15=_0x44b75e['length'];if(!_0x2c2081[_0x91a1('0x30')][_0x91a1('0x38')](_0x91a1('0x39'))){_0x538992[_0x91a1('0x1f')]=qs[_0x91a1('0x1f')](_0x2c2081['query'][_0x91a1('0x1f')]);_0x538992['offset']=qs['offset'](_0x2c2081['query']['offset']);}return _0x54b12f[_0x91a1('0x4f')](_0x538992);}})[_0x91a1('0x28')](function(_0x1b03e4){if(_0x1b03e4){return _0x1b03e4?{'count':_0xe0da15,'rows':_0x1b03e4}:null;}})[_0x91a1('0x28')](respondWithResult(_0x46fcdc,null))[_0x91a1('0x43')](handleError(_0x46fcdc,null));};exports[_0x91a1('0x50')]=function(_0xb6cddf,_0x596cf4,_0x3dbca1){var _0x128ba1={};var _0x510866={};var _0x51a071;var _0x164a71;return db[_0x91a1('0x2d')][_0x91a1('0x4c')]({'where':{'id':_0xb6cddf[_0x91a1('0x45')]['id']}})[_0x91a1('0x28')](handleEntityNotFound(_0x596cf4,null))[_0x91a1('0x28')](function(_0x390351){if(_0x390351){_0x51a071=_0x390351;_0x510866[_0x91a1('0x34')]=_[_0x91a1('0x31')](db['ZohoField'][_0x91a1('0x46')]);_0x510866['query']=_['keys'](_0xb6cddf[_0x91a1('0x30')]);_0x510866[_0x91a1('0x32')]=_[_0x91a1('0x33')](_0x510866[_0x91a1('0x34')],_0x510866['query']);_0x128ba1[_0x91a1('0x36')]=_[_0x91a1('0x33')](_0x510866['model'],qs[_0x91a1('0x35')](_0xb6cddf[_0x91a1('0x30')][_0x91a1('0x35')]));_0x128ba1[_0x91a1('0x36')]=_0x128ba1[_0x91a1('0x36')]['length']?_0x128ba1[_0x91a1('0x36')]:_0x510866[_0x91a1('0x34')];_0x128ba1['order']=qs['sort'](_0xb6cddf[_0x91a1('0x30')]['sort']);_0x128ba1[_0x91a1('0x3c')]=qs[_0x91a1('0x32')](_[_0x91a1('0x4e')](_0xb6cddf[_0x91a1('0x30')],_0x510866[_0x91a1('0x32')]));if(_0xb6cddf[_0x91a1('0x30')][_0x91a1('0x3d')]){_0x128ba1['where']=_['merge'](_0x128ba1[_0x91a1('0x3c')],{'$or':_['map'](_0x128ba1['attributes'],function(_0x3815de){var _0x29b3b2={};_0x29b3b2[_0x3815de]={'$like':'%'+_0xb6cddf[_0x91a1('0x30')][_0x91a1('0x3d')]+'%'};return _0x29b3b2;})});}_0x128ba1=_[_0x91a1('0x3e')]({},_0x128ba1,_0xb6cddf[_0x91a1('0x47')]);return _0x51a071[_0x91a1('0x50')](_0x128ba1);}})['then'](function(_0x1a290f){if(_0x1a290f){_0x164a71=_0x1a290f[_0x91a1('0x37')];if(!_0xb6cddf[_0x91a1('0x30')][_0x91a1('0x38')]('nolimit')){_0x128ba1['limit']=qs[_0x91a1('0x1f')](_0xb6cddf['query'][_0x91a1('0x1f')]);_0x128ba1['offset']=qs['offset'](_0xb6cddf[_0x91a1('0x30')][_0x91a1('0x22')]);}return _0x51a071[_0x91a1('0x50')](_0x128ba1);}})[_0x91a1('0x28')](function(_0x253097){if(_0x253097){return _0x253097?{'count':_0x164a71,'rows':_0x253097}:null;}})[_0x91a1('0x28')](respondWithResult(_0x596cf4,null))[_0x91a1('0x43')](handleError(_0x596cf4,null));};exports['getDescriptions']=function(_0x3845ea,_0x574a5a,_0x4aa3fc){var _0x25d6a3={};var _0x53877d={};var _0x2d5b50;var _0x3d57b5;return db[_0x91a1('0x2d')]['findOne']({'where':{'id':_0x3845ea[_0x91a1('0x45')]['id']}})[_0x91a1('0x28')](handleEntityNotFound(_0x574a5a,null))[_0x91a1('0x28')](function(_0x1c2e6a){if(_0x1c2e6a){_0x2d5b50=_0x1c2e6a;_0x53877d['model']=_[_0x91a1('0x31')](db['ZohoField']['rawAttributes']);_0x53877d[_0x91a1('0x30')]=_[_0x91a1('0x31')](_0x3845ea['query']);_0x53877d['filters']=_[_0x91a1('0x33')](_0x53877d[_0x91a1('0x34')],_0x53877d[_0x91a1('0x30')]);_0x25d6a3[_0x91a1('0x36')]=_[_0x91a1('0x33')](_0x53877d[_0x91a1('0x34')],qs[_0x91a1('0x35')](_0x3845ea[_0x91a1('0x30')]['fields']));_0x25d6a3[_0x91a1('0x36')]=_0x25d6a3[_0x91a1('0x36')][_0x91a1('0x37')]?_0x25d6a3['attributes']:_0x53877d[_0x91a1('0x34')];_0x25d6a3['order']=qs['sort'](_0x3845ea[_0x91a1('0x30')]['sort']);_0x25d6a3['where']=qs[_0x91a1('0x32')](_['pick'](_0x3845ea[_0x91a1('0x30')],_0x53877d[_0x91a1('0x32')]));if(_0x3845ea[_0x91a1('0x30')][_0x91a1('0x3d')]){_0x25d6a3['where']=_['merge'](_0x25d6a3['where'],{'$or':_[_0x91a1('0x2c')](_0x25d6a3[_0x91a1('0x36')],function(_0x3f11d0){var _0x1e6fc9={};_0x1e6fc9[_0x3f11d0]={'$like':'%'+_0x3845ea['query']['filter']+'%'};return _0x1e6fc9;})});}_0x25d6a3=_[_0x91a1('0x3e')]({},_0x25d6a3,_0x3845ea[_0x91a1('0x47')]);return _0x2d5b50['getDescriptions'](_0x25d6a3);}})[_0x91a1('0x28')](function(_0x23680a){if(_0x23680a){_0x3d57b5=_0x23680a[_0x91a1('0x37')];if(!_0x3845ea[_0x91a1('0x30')][_0x91a1('0x38')](_0x91a1('0x39'))){_0x25d6a3[_0x91a1('0x1f')]=qs[_0x91a1('0x1f')](_0x3845ea[_0x91a1('0x30')][_0x91a1('0x1f')]);_0x25d6a3[_0x91a1('0x22')]=qs[_0x91a1('0x22')](_0x3845ea[_0x91a1('0x30')][_0x91a1('0x22')]);}return _0x2d5b50[_0x91a1('0x51')](_0x25d6a3);}})['then'](function(_0x5aee37){if(_0x5aee37){return _0x5aee37?{'count':_0x3d57b5,'rows':_0x5aee37}:null;}})['then'](respondWithResult(_0x574a5a,null))['catch'](handleError(_0x574a5a,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 6b2081d..1f8a311 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 _0x743e=['lodash','util','../../config/logger','moment','request-promise','path','../../config/environment','./intZohoConfiguration.attributes','exports','define','ZohoConfiguration','int_zoho_configurations'];(function(_0x5ef161,_0x27d16c){var _0x1c6e9e=function(_0x8fc2a6){while(--_0x8fc2a6){_0x5ef161['push'](_0x5ef161['shift']());}};_0x1c6e9e(++_0x27d16c);}(_0x743e,0xe4));var _0xe743=function(_0x2563f7,_0x4daa86){_0x2563f7=_0x2563f7-0x0;var _0x4d65fd=_0x743e[_0x2563f7];return _0x4d65fd;};'use strict';var _=require(_0xe743('0x0'));var util=require(_0xe743('0x1'));var logger=require(_0xe743('0x2'))('api');var moment=require(_0xe743('0x3'));var BPromise=require('bluebird');var rp=require(_0xe743('0x4'));var fs=require('fs');var path=require(_0xe743('0x5'));var rimraf=require('rimraf');var config=require(_0xe743('0x6'));var attributes=require(_0xe743('0x7'));module[_0xe743('0x8')]=function(_0x3a6261,_0x532524){return _0x3a6261[_0xe743('0x9')](_0xe743('0xa'),attributes,{'tableName':_0xe743('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5fd9=['./intZohoConfiguration.attributes','exports','define','int_zoho_configurations','lodash','util','../../config/logger','moment','request-promise','rimraf'];(function(_0x3f7595,_0x2c5b60){var _0x225030=function(_0x3e8545){while(--_0x3e8545){_0x3f7595['push'](_0x3f7595['shift']());}};_0x225030(++_0x2c5b60);}(_0x5fd9,0x13a));var _0x95fd=function(_0x37914d,_0x4209c0){_0x37914d=_0x37914d-0x0;var _0x2b4118=_0x5fd9[_0x37914d];return _0x2b4118;};'use strict';var _=require(_0x95fd('0x0'));var util=require(_0x95fd('0x1'));var logger=require(_0x95fd('0x2'))('api');var moment=require(_0x95fd('0x3'));var BPromise=require('bluebird');var rp=require(_0x95fd('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x95fd('0x5'));var config=require('../../config/environment');var attributes=require(_0x95fd('0x6'));module[_0x95fd('0x7')]=function(_0x189d7c,_0x5d3ff7){return _0x189d7c[_0x95fd('0x8')]('ZohoConfiguration',attributes,{'tableName':_0x95fd('0x9'),'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 609c690..e68672c 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 _0x7108=['ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0x2d04b3,_0x3723f6){var _0x5e6bf6=function(_0xa4e13b){while(--_0xa4e13b){_0x2d04b3['push'](_0x2d04b3['shift']());}};_0x5e6bf6(++_0x3723f6);}(_0x7108,0x127));var _0x8710=function(_0x5de924,_0x18fcc0){_0x5de924=_0x5de924-0x0;var _0x4b98d0=_0x7108[_0x5de924];return _0x4b98d0;};'use strict';var _=require(_0x8710('0x0'));var util=require(_0x8710('0x1'));var moment=require(_0x8710('0x2'));var BPromise=require(_0x8710('0x3'));var rs=require(_0x8710('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8710('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8710('0x6'))(_0x8710('0x7'));var config=require(_0x8710('0x8'));var jayson=require(_0x8710('0x9'));var client=jayson[_0x8710('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x23fcd9,_0x37309b,_0x26d0cf){return new BPromise(function(_0x19eb5d,_0x17f653){return client[_0x8710('0xb')](_0x23fcd9,_0x26d0cf)[_0x8710('0xc')](function(_0x41554a){logger['info'](_0x8710('0xd'),_0x37309b,_0x8710('0xe'));logger[_0x8710('0xf')](_0x8710('0x10'),_0x37309b,_0x8710('0xe'),JSON['stringify'](_0x41554a));if(_0x41554a[_0x8710('0x11')]){if(_0x41554a[_0x8710('0x11')][_0x8710('0x12')]===0x1f4){logger[_0x8710('0x11')]('ZohoConfiguration,\x20%s,\x20%s',_0x37309b,_0x41554a[_0x8710('0x11')][_0x8710('0x13')]);return _0x17f653(_0x41554a['error']['message']);}logger[_0x8710('0x11')](_0x8710('0xd'),_0x37309b,_0x41554a[_0x8710('0x11')]['message']);return _0x19eb5d(_0x41554a[_0x8710('0x11')][_0x8710('0x13')]);}else{logger[_0x8710('0x14')]('ZohoConfiguration,\x20%s,\x20%s',_0x37309b,_0x8710('0xe'));_0x19eb5d(_0x41554a['result'][_0x8710('0x13')]);}})[_0x8710('0x15')](function(_0x1463e1){logger[_0x8710('0x11')]('ZohoConfiguration,\x20%s,\x20%s',_0x37309b,_0x1463e1);_0x17f653(_0x1463e1);});});} \ No newline at end of file +var _0x0e10=['rpc','../../config/environment','jayson/promise','http','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','ZohoConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x4e6eef,_0x212f65){var _0x36eff5=function(_0x165d32){while(--_0x165d32){_0x4e6eef['push'](_0x4e6eef['shift']());}};_0x36eff5(++_0x212f65);}(_0x0e10,0x126));var _0x00e1=function(_0x3fed61,_0x440894){_0x3fed61=_0x3fed61-0x0;var _0x5bf937=_0x0e10[_0x3fed61];return _0x5bf937;};'use strict';var _=require(_0x00e1('0x0'));var util=require(_0x00e1('0x1'));var moment=require('moment');var BPromise=require(_0x00e1('0x2'));var rs=require(_0x00e1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x00e1('0x4'))['db'];var utils=require(_0x00e1('0x5'));var logger=require('../../config/logger')(_0x00e1('0x6'));var config=require(_0x00e1('0x7'));var jayson=require(_0x00e1('0x8'));var client=jayson['client'][_0x00e1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x184475,_0x501e2f,_0x40ca59){return new BPromise(function(_0x5da53e,_0x154564){return client['request'](_0x184475,_0x40ca59)[_0x00e1('0xa')](function(_0x4e9ff6){logger[_0x00e1('0xb')](_0x00e1('0xc'),_0x501e2f,_0x00e1('0xd'));logger['debug'](_0x00e1('0xe'),_0x501e2f,_0x00e1('0xd'),JSON['stringify'](_0x4e9ff6));if(_0x4e9ff6['error']){if(_0x4e9ff6[_0x00e1('0xf')][_0x00e1('0x10')]===0x1f4){logger[_0x00e1('0xf')](_0x00e1('0xc'),_0x501e2f,_0x4e9ff6[_0x00e1('0xf')][_0x00e1('0x11')]);return _0x154564(_0x4e9ff6[_0x00e1('0xf')][_0x00e1('0x11')]);}logger[_0x00e1('0xf')](_0x00e1('0xc'),_0x501e2f,_0x4e9ff6[_0x00e1('0xf')]['message']);return _0x5da53e(_0x4e9ff6[_0x00e1('0xf')][_0x00e1('0x11')]);}else{logger[_0x00e1('0xb')](_0x00e1('0xc'),_0x501e2f,'request\x20sent');_0x5da53e(_0x4e9ff6[_0x00e1('0x12')][_0x00e1('0x11')]);}})[_0x00e1('0x13')](function(_0x19720e){logger[_0x00e1('0xf')]('ZohoConfiguration,\x20%s,\x20%s',_0x501e2f,_0x19720e);_0x154564(_0x19720e);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 1e4666f..3894d8b 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 _0xdfb2=['delete','destroy','exports','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller','isAuthenticated','index','get','/:id','show','post','put','update'];(function(_0x3b1b28,_0x70b837){var _0x401f9d=function(_0x20a747){while(--_0x20a747){_0x3b1b28['push'](_0x3b1b28['shift']());}};_0x401f9d(++_0x70b837);}(_0xdfb2,0x81));var _0x2dfb=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xdfb2[_0x2763f2];return _0x3ef471;};'use strict';var multer=require('multer');var util=require(_0x2dfb('0x0'));var path=require('path');var timeout=require(_0x2dfb('0x1'));var express=require(_0x2dfb('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x2dfb('0x3'));var interaction=require(_0x2dfb('0x4'));var config=require(_0x2dfb('0x5'));var controller=require(_0x2dfb('0x6'));router['get']('/',auth[_0x2dfb('0x7')](),controller[_0x2dfb('0x8')]);router[_0x2dfb('0x9')](_0x2dfb('0xa'),auth[_0x2dfb('0x7')](),controller[_0x2dfb('0xb')]);router[_0x2dfb('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2dfb('0xd')](_0x2dfb('0xa'),auth[_0x2dfb('0x7')](),controller[_0x2dfb('0xe')]);router[_0x2dfb('0xf')](_0x2dfb('0xa'),auth[_0x2dfb('0x7')](),controller[_0x2dfb('0x10')]);module[_0x2dfb('0x11')]=router; \ No newline at end of file +var _0xcae1=['isAuthenticated','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/:id','post','create','update','delete'];(function(_0x113508,_0x445931){var _0x291e82=function(_0x4b9f85){while(--_0x4b9f85){_0x113508['push'](_0x113508['shift']());}};_0x291e82(++_0x445931);}(_0xcae1,0xdf));var _0x1cae=function(_0x374dd6,_0xadc0eb){_0x374dd6=_0x374dd6-0x0;var _0x1aadd0=_0xcae1[_0x374dd6];return _0x1aadd0;};'use strict';var multer=require(_0x1cae('0x0'));var util=require(_0x1cae('0x1'));var path=require(_0x1cae('0x2'));var timeout=require(_0x1cae('0x3'));var express=require(_0x1cae('0x4'));var router=express[_0x1cae('0x5')]();var fs_extra=require(_0x1cae('0x6'));var auth=require(_0x1cae('0x7'));var interaction=require(_0x1cae('0x8'));var config=require(_0x1cae('0x9'));var controller=require('./intZohoField.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x1cae('0xa')]);router[_0x1cae('0xb')](_0x1cae('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x1cae('0xd')]('/',auth['isAuthenticated'](),controller[_0x1cae('0xe')]);router['put'](_0x1cae('0xc'),auth['isAuthenticated'](),controller[_0x1cae('0xf')]);router[_0x1cae('0x10')](_0x1cae('0xc'),auth[_0x1cae('0x11')](),controller[_0x1cae('0x12')]);module[_0x1cae('0x13')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index a4249e0..a79d3d8 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 _0x0b7c=['keyValue','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable'];(function(_0x1a37e3,_0x5db8f6){var _0x4db78a=function(_0x15e6c1){while(--_0x15e6c1){_0x1a37e3['push'](_0x1a37e3['shift']());}};_0x4db78a(++_0x5db8f6);}(_0x0b7c,0x66));var _0xc0b7=function(_0x3e1829,_0xc8ccda){_0x3e1829=_0x3e1829-0x0;var _0x129345=_0x0b7c[_0x3e1829];return _0x129345;};'use strict';var Sequelize=require(_0xc0b7('0x0'));module[_0xc0b7('0x1')]={'type':{'type':Sequelize[_0xc0b7('0x2')](_0xc0b7('0x3'),_0xc0b7('0x4'),_0xc0b7('0x5'),_0xc0b7('0x6'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0xc0b7('0x7')]},'key':{'type':Sequelize[_0xc0b7('0x7')]},'keyType':{'type':Sequelize[_0xc0b7('0x2')](_0xc0b7('0x3'),'variable',_0xc0b7('0x5'))},'keyContent':{'type':Sequelize[_0xc0b7('0x7')]},'idField':{'type':Sequelize[_0xc0b7('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xc0b7('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc0b7('0x7')]}}; \ No newline at end of file +var _0x3c2f=['BOOLEAN','sequelize','exports','ENUM','customVariable','keyValue','picklist','string','STRING','variable'];(function(_0x5e8e61,_0x3dfd31){var _0x4db3db=function(_0x38b1e2){while(--_0x38b1e2){_0x5e8e61['push'](_0x5e8e61['shift']());}};_0x4db3db(++_0x3dfd31);}(_0x3c2f,0xe7));var _0xf3c2=function(_0x4f484c,_0x9bccb4){_0x4f484c=_0x4f484c-0x0;var _0x276e95=_0x3c2f[_0x4f484c];return _0x276e95;};'use strict';var Sequelize=require(_0xf3c2('0x0'));module[_0xf3c2('0x1')]={'type':{'type':Sequelize[_0xf3c2('0x2')]('string','variable',_0xf3c2('0x3'),_0xf3c2('0x4'),_0xf3c2('0x5')),'defaultValue':_0xf3c2('0x6')},'content':{'type':Sequelize[_0xf3c2('0x7')]},'key':{'type':Sequelize[_0xf3c2('0x7')]},'keyType':{'type':Sequelize[_0xf3c2('0x2')](_0xf3c2('0x6'),_0xf3c2('0x8'),_0xf3c2('0x3'))},'keyContent':{'type':Sequelize[_0xf3c2('0x7')]},'idField':{'type':Sequelize[_0xf3c2('0x7')]},'nameField':{'type':Sequelize[_0xf3c2('0x7')]},'customField':{'type':Sequelize[_0xf3c2('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf3c2('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index e6668b8..0ea781c 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 _0xcd78=['then','destroy','stack','send','index','ZohoField','rawAttributes','fieldName','type','model','map','name','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filters','filter','where','merge','VIRTUAL','options','count','includeAll','findAll','catch','show','params','include','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','sox','ejs','fs-extra','lodash','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','status','set','apply','save'];(function(_0x382a17,_0x29c95d){var _0x329c99=function(_0x4a78ec){while(--_0x4a78ec){_0x382a17['push'](_0x382a17['shift']());}};_0x329c99(++_0x29c95d);}(_0xcd78,0xa9));var _0x8cd7=function(_0x5dc654,_0x337bd6){_0x5dc654=_0x5dc654-0x0;var _0x189859=_0xcd78[_0x5dc654];return _0x189859;};'use strict';var emlformat=require(_0x8cd7('0x0'));var rimraf=require(_0x8cd7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8cd7('0x2'));var rp=require(_0x8cd7('0x3'));var moment=require(_0x8cd7('0x4'));var BPromise=require(_0x8cd7('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x8cd7('0x6'));var csv=require('to-csv');var ejs=require(_0x8cd7('0x7'));var fs=require('fs');var fs_extra=require(_0x8cd7('0x8'));var _=require(_0x8cd7('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x8cd7('0xa'));var toCsv=require(_0x8cd7('0xb'));var querystring=require(_0x8cd7('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8cd7('0xd'));var qs=require(_0x8cd7('0xe'));var as=require(_0x8cd7('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x8cd7('0x10'));var licenseUtil=require(_0x8cd7('0x11'));var db=require(_0x8cd7('0x12'))['db'];function respondWithStatusCode(_0x1e1816,_0x2d6488){_0x2d6488=_0x2d6488||0xcc;return function(_0x3772ab){if(_0x3772ab){return _0x1e1816[_0x8cd7('0x13')](_0x2d6488);}return _0x1e1816['status'](_0x2d6488)[_0x8cd7('0x14')]();};}function respondWithResult(_0x204f1c,_0x53b4e9){_0x53b4e9=_0x53b4e9||0xc8;return function(_0x273b36){if(_0x273b36){return _0x204f1c['status'](_0x53b4e9)[_0x8cd7('0x15')](_0x273b36);}};}function respondWithFilteredResult(_0x46222c,_0x11eef9){return function(_0x5e800c){if(_0x5e800c){var _0x47eacb=typeof _0x11eef9[_0x8cd7('0x16')]===_0x8cd7('0x17')&&typeof _0x11eef9[_0x8cd7('0x18')]==='undefined';var _0x5207a5=_0x5e800c['count'];var _0x39b142=_0x47eacb?0x0:_0x11eef9[_0x8cd7('0x16')];var _0x4e21a5=_0x47eacb?_0x5e800c['count']:_0x11eef9[_0x8cd7('0x16')]+_0x11eef9[_0x8cd7('0x18')];var _0x51084f;if(_0x4e21a5>=_0x5207a5){_0x4e21a5=_0x5207a5;_0x51084f=0xc8;}else{_0x51084f=0xce;}_0x46222c[_0x8cd7('0x19')](_0x51084f);return _0x46222c[_0x8cd7('0x1a')]('Content-Range',_0x39b142+'-'+_0x4e21a5+'/'+_0x5207a5)[_0x8cd7('0x15')](_0x5e800c);}return null;};}function patchUpdates(_0x5429f5){return function(_0x51b011){try{jsonpatch[_0x8cd7('0x1b')](_0x51b011,_0x5429f5,!![]);}catch(_0x1964e7){return BPromise['reject'](_0x1964e7);}return _0x51b011[_0x8cd7('0x1c')]();};}function saveUpdates(_0x23c0a0,_0x36ae69){return function(_0x593374){if(_0x593374){return _0x593374['update'](_0x23c0a0)[_0x8cd7('0x1d')](function(_0x3d18e3){return _0x3d18e3;});}return null;};}function removeEntity(_0x3e35b9,_0xc5cd33){return function(_0x523455){if(_0x523455){return _0x523455[_0x8cd7('0x1e')]()['then'](function(){_0x3e35b9[_0x8cd7('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0xba3de,_0x359b4d){return function(_0x3dafe4){if(!_0x3dafe4){_0xba3de[_0x8cd7('0x13')](0x194);}return _0x3dafe4;};}function handleError(_0x2eec77,_0x2a0e00){_0x2a0e00=_0x2a0e00||0x1f4;return function(_0x5cbedb){logger['error'](_0x5cbedb[_0x8cd7('0x1f')]);if(_0x5cbedb['name']){delete _0x5cbedb['name'];}_0x2eec77[_0x8cd7('0x19')](_0x2a0e00)[_0x8cd7('0x20')](_0x5cbedb);};}exports[_0x8cd7('0x21')]=function(_0x342c1c,_0x427811){var _0x27fed1={},_0x31ad86={},_0x4331db={'count':0x0,'rows':[]};var _0x387472=_['map'](db[_0x8cd7('0x22')][_0x8cd7('0x23')],function(_0x2dc257){return{'name':_0x2dc257[_0x8cd7('0x24')],'type':_0x2dc257[_0x8cd7('0x25')]['key']};});_0x31ad86[_0x8cd7('0x26')]=_[_0x8cd7('0x27')](_0x387472,_0x8cd7('0x28'));_0x31ad86[_0x8cd7('0x29')]=_[_0x8cd7('0x2a')](_0x342c1c[_0x8cd7('0x29')]);_0x31ad86['filters']=_[_0x8cd7('0x2b')](_0x31ad86[_0x8cd7('0x26')],_0x31ad86[_0x8cd7('0x29')]);_0x27fed1[_0x8cd7('0x2c')]=_[_0x8cd7('0x2b')](_0x31ad86[_0x8cd7('0x26')],qs[_0x8cd7('0x2d')](_0x342c1c[_0x8cd7('0x29')][_0x8cd7('0x2d')]));_0x27fed1[_0x8cd7('0x2c')]=_0x27fed1[_0x8cd7('0x2c')][_0x8cd7('0x2e')]?_0x27fed1[_0x8cd7('0x2c')]:_0x31ad86[_0x8cd7('0x26')];if(!_0x342c1c[_0x8cd7('0x29')][_0x8cd7('0x2f')](_0x8cd7('0x30'))){_0x27fed1[_0x8cd7('0x18')]=qs[_0x8cd7('0x18')](_0x342c1c[_0x8cd7('0x29')][_0x8cd7('0x18')]);_0x27fed1[_0x8cd7('0x16')]=qs['offset'](_0x342c1c['query'][_0x8cd7('0x16')]);}_0x27fed1['order']=qs['sort'](_0x342c1c[_0x8cd7('0x29')][_0x8cd7('0x31')]);_0x27fed1['where']=qs['filters'](_[_0x8cd7('0x32')](_0x342c1c[_0x8cd7('0x29')],_0x31ad86[_0x8cd7('0x33')]),_0x387472);if(_0x342c1c[_0x8cd7('0x29')][_0x8cd7('0x34')]){_0x27fed1[_0x8cd7('0x35')]=_[_0x8cd7('0x36')](_0x27fed1['where'],{'$or':_[_0x8cd7('0x27')](_0x387472,function(_0x2aca01){if(_0x2aca01[_0x8cd7('0x25')]!==_0x8cd7('0x37')){var _0x1b1028={};_0x1b1028[_0x2aca01[_0x8cd7('0x28')]]={'$like':'%'+_0x342c1c[_0x8cd7('0x29')][_0x8cd7('0x34')]+'%'};return _0x1b1028;}})});}_0x27fed1=_[_0x8cd7('0x36')]({},_0x27fed1,_0x342c1c[_0x8cd7('0x38')]);var _0x2db7dc={'where':_0x27fed1[_0x8cd7('0x35')]};return db[_0x8cd7('0x22')][_0x8cd7('0x39')](_0x2db7dc)[_0x8cd7('0x1d')](function(_0x1d5f58){_0x4331db[_0x8cd7('0x39')]=_0x1d5f58;if(_0x342c1c[_0x8cd7('0x29')][_0x8cd7('0x3a')]){_0x27fed1['include']=[{'all':!![]}];}return db[_0x8cd7('0x22')][_0x8cd7('0x3b')](_0x27fed1);})[_0x8cd7('0x1d')](function(_0x17ca18){_0x4331db['rows']=_0x17ca18;return _0x4331db;})['then'](respondWithFilteredResult(_0x427811,_0x27fed1))[_0x8cd7('0x3c')](handleError(_0x427811,null));};exports[_0x8cd7('0x3d')]=function(_0x319b6f,_0x5318ad){var _0x33fca6={'raw':!![],'where':{'id':_0x319b6f[_0x8cd7('0x3e')]['id']}},_0x60e4e2={};_0x60e4e2[_0x8cd7('0x26')]=_['keys'](db[_0x8cd7('0x22')]['rawAttributes']);_0x60e4e2[_0x8cd7('0x29')]=_[_0x8cd7('0x2a')](_0x319b6f[_0x8cd7('0x29')]);_0x60e4e2[_0x8cd7('0x33')]=_[_0x8cd7('0x2b')](_0x60e4e2[_0x8cd7('0x26')],_0x60e4e2['query']);_0x33fca6[_0x8cd7('0x2c')]=_[_0x8cd7('0x2b')](_0x60e4e2[_0x8cd7('0x26')],qs[_0x8cd7('0x2d')](_0x319b6f['query'][_0x8cd7('0x2d')]));_0x33fca6[_0x8cd7('0x2c')]=_0x33fca6[_0x8cd7('0x2c')]['length']?_0x33fca6[_0x8cd7('0x2c')]:_0x60e4e2[_0x8cd7('0x26')];if(_0x319b6f[_0x8cd7('0x29')]['includeAll']){_0x33fca6[_0x8cd7('0x3f')]=[{'all':!![]}];}_0x33fca6=_['merge']({},_0x33fca6,_0x319b6f[_0x8cd7('0x38')]);return db[_0x8cd7('0x22')]['find'](_0x33fca6)['then'](handleEntityNotFound(_0x5318ad,null))[_0x8cd7('0x1d')](respondWithResult(_0x5318ad,null))['catch'](handleError(_0x5318ad,null));};exports[_0x8cd7('0x40')]=function(_0x402008,_0x399ad8){return db[_0x8cd7('0x22')]['create'](_0x402008[_0x8cd7('0x41')],{})[_0x8cd7('0x1d')](respondWithResult(_0x399ad8,0xc9))['catch'](handleError(_0x399ad8,null));};exports['update']=function(_0x286c73,_0x7fa08c){if(_0x286c73['body']['id']){delete _0x286c73[_0x8cd7('0x41')]['id'];}return db[_0x8cd7('0x22')]['find']({'where':{'id':_0x286c73[_0x8cd7('0x3e')]['id']}})[_0x8cd7('0x1d')](handleEntityNotFound(_0x7fa08c,null))[_0x8cd7('0x1d')](saveUpdates(_0x286c73[_0x8cd7('0x41')],null))[_0x8cd7('0x1d')](respondWithResult(_0x7fa08c,null))['catch'](handleError(_0x7fa08c,null));};exports[_0x8cd7('0x1e')]=function(_0x3df7aa,_0x4538e0){return db[_0x8cd7('0x22')]['find']({'where':{'id':_0x3df7aa[_0x8cd7('0x3e')]['id']}})[_0x8cd7('0x1d')](handleEntityNotFound(_0x4538e0,null))[_0x8cd7('0x1d')](removeEntity(_0x4538e0,null))['catch'](handleError(_0x4538e0,null));}; \ No newline at end of file +var _0x1eec=['end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','stack','name','send','index','map','ZohoField','rawAttributes','fieldName','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','filters','pick','filter','where','type','options','include','findAll','rows','show','params','includeAll','merge','find','create','body','catch','destroy','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1eec,0xc9));var _0xc1ee=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x1eec[_0x5d6456];return _0x4d66c1;};'use strict';var emlformat=require(_0xc1ee('0x0'));var rimraf=require(_0xc1ee('0x1'));var zipdir=require(_0xc1ee('0x2'));var jsonpatch=require(_0xc1ee('0x3'));var rp=require('request-promise');var moment=require(_0xc1ee('0x4'));var BPromise=require(_0xc1ee('0x5'));var Mustache=require(_0xc1ee('0x6'));var util=require(_0xc1ee('0x7'));var path=require(_0xc1ee('0x8'));var sox=require('sox');var csv=require(_0xc1ee('0x9'));var ejs=require(_0xc1ee('0xa'));var fs=require('fs');var fs_extra=require(_0xc1ee('0xb'));var _=require(_0xc1ee('0xc'));var squel=require(_0xc1ee('0xd'));var crypto=require(_0xc1ee('0xe'));var jsforce=require(_0xc1ee('0xf'));var deskjs=require(_0xc1ee('0x10'));var toCsv=require(_0xc1ee('0x9'));var querystring=require(_0xc1ee('0x11'));var Papa=require(_0xc1ee('0x12'));var Redis=require(_0xc1ee('0x13'));var authService=require(_0xc1ee('0x14'));var qs=require(_0xc1ee('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc1ee('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc1ee('0x17'));var db=require(_0xc1ee('0x18'))['db'];function respondWithStatusCode(_0x8f7cd0,_0x3531a3){_0x3531a3=_0x3531a3||0xcc;return function(_0x254af1){if(_0x254af1){return _0x8f7cd0[_0xc1ee('0x19')](_0x3531a3);}return _0x8f7cd0[_0xc1ee('0x1a')](_0x3531a3)[_0xc1ee('0x1b')]();};}function respondWithResult(_0x112cc5,_0xe930fd){_0xe930fd=_0xe930fd||0xc8;return function(_0x134887){if(_0x134887){return _0x112cc5[_0xc1ee('0x1a')](_0xe930fd)[_0xc1ee('0x1c')](_0x134887);}};}function respondWithFilteredResult(_0x30083a,_0x15d4e2){return function(_0x18713b){if(_0x18713b){var _0x256f1b=typeof _0x15d4e2[_0xc1ee('0x1d')]==='undefined'&&typeof _0x15d4e2['limit']===_0xc1ee('0x1e');var _0x16e40f=_0x18713b[_0xc1ee('0x1f')];var _0x43b1c3=_0x256f1b?0x0:_0x15d4e2['offset'];var _0x12bf0f=_0x256f1b?_0x18713b[_0xc1ee('0x1f')]:_0x15d4e2[_0xc1ee('0x1d')]+_0x15d4e2[_0xc1ee('0x20')];var _0x363b61;if(_0x12bf0f>=_0x16e40f){_0x12bf0f=_0x16e40f;_0x363b61=0xc8;}else{_0x363b61=0xce;}_0x30083a['status'](_0x363b61);return _0x30083a[_0xc1ee('0x21')](_0xc1ee('0x22'),_0x43b1c3+'-'+_0x12bf0f+'/'+_0x16e40f)[_0xc1ee('0x1c')](_0x18713b);}return null;};}function patchUpdates(_0x370bac){return function(_0x315a83){try{jsonpatch[_0xc1ee('0x23')](_0x315a83,_0x370bac,!![]);}catch(_0xccf175){return BPromise[_0xc1ee('0x24')](_0xccf175);}return _0x315a83[_0xc1ee('0x25')]();};}function saveUpdates(_0x36e1df,_0x48919a){return function(_0x5be168){if(_0x5be168){return _0x5be168[_0xc1ee('0x26')](_0x36e1df)['then'](function(_0x26cbce){return _0x26cbce;});}return null;};}function removeEntity(_0x1df97d,_0x31442f){return function(_0x5c40f9){if(_0x5c40f9){return _0x5c40f9['destroy']()[_0xc1ee('0x27')](function(){_0x1df97d[_0xc1ee('0x1a')](0xcc)[_0xc1ee('0x1b')]();});}};}function handleEntityNotFound(_0x708558,_0x259de3){return function(_0xbee181){if(!_0xbee181){_0x708558[_0xc1ee('0x19')](0x194);}return _0xbee181;};}function handleError(_0xefe3e,_0x580e52){_0x580e52=_0x580e52||0x1f4;return function(_0x339f3d){logger['error'](_0x339f3d[_0xc1ee('0x28')]);if(_0x339f3d['name']){delete _0x339f3d[_0xc1ee('0x29')];}_0xefe3e[_0xc1ee('0x1a')](_0x580e52)[_0xc1ee('0x2a')](_0x339f3d);};}exports[_0xc1ee('0x2b')]=function(_0x3de5a5,_0x23bc7e){var _0x3b239f={},_0x5248b4={},_0x55cecd={'count':0x0,'rows':[]};var _0x3274dd=_[_0xc1ee('0x2c')](db[_0xc1ee('0x2d')][_0xc1ee('0x2e')],function(_0x48efe8){return{'name':_0x48efe8[_0xc1ee('0x2f')],'type':_0x48efe8['type']['key']};});_0x5248b4[_0xc1ee('0x30')]=_['map'](_0x3274dd,_0xc1ee('0x29'));_0x5248b4[_0xc1ee('0x31')]=_[_0xc1ee('0x32')](_0x3de5a5[_0xc1ee('0x31')]);_0x5248b4['filters']=_[_0xc1ee('0x33')](_0x5248b4['model'],_0x5248b4[_0xc1ee('0x31')]);_0x3b239f[_0xc1ee('0x34')]=_[_0xc1ee('0x33')](_0x5248b4[_0xc1ee('0x30')],qs[_0xc1ee('0x35')](_0x3de5a5[_0xc1ee('0x31')][_0xc1ee('0x35')]));_0x3b239f[_0xc1ee('0x34')]=_0x3b239f[_0xc1ee('0x34')][_0xc1ee('0x36')]?_0x3b239f[_0xc1ee('0x34')]:_0x5248b4[_0xc1ee('0x30')];if(!_0x3de5a5[_0xc1ee('0x31')]['hasOwnProperty'](_0xc1ee('0x37'))){_0x3b239f[_0xc1ee('0x20')]=qs[_0xc1ee('0x20')](_0x3de5a5[_0xc1ee('0x31')][_0xc1ee('0x20')]);_0x3b239f['offset']=qs[_0xc1ee('0x1d')](_0x3de5a5[_0xc1ee('0x31')][_0xc1ee('0x1d')]);}_0x3b239f[_0xc1ee('0x38')]=qs[_0xc1ee('0x39')](_0x3de5a5[_0xc1ee('0x31')]['sort']);_0x3b239f['where']=qs[_0xc1ee('0x3a')](_[_0xc1ee('0x3b')](_0x3de5a5[_0xc1ee('0x31')],_0x5248b4['filters']),_0x3274dd);if(_0x3de5a5[_0xc1ee('0x31')][_0xc1ee('0x3c')]){_0x3b239f['where']=_['merge'](_0x3b239f[_0xc1ee('0x3d')],{'$or':_[_0xc1ee('0x2c')](_0x3274dd,function(_0x2954fc){if(_0x2954fc[_0xc1ee('0x3e')]!=='VIRTUAL'){var _0x3f4405={};_0x3f4405[_0x2954fc[_0xc1ee('0x29')]]={'$like':'%'+_0x3de5a5[_0xc1ee('0x31')][_0xc1ee('0x3c')]+'%'};return _0x3f4405;}})});}_0x3b239f=_['merge']({},_0x3b239f,_0x3de5a5[_0xc1ee('0x3f')]);var _0x343279={'where':_0x3b239f[_0xc1ee('0x3d')]};return db[_0xc1ee('0x2d')][_0xc1ee('0x1f')](_0x343279)['then'](function(_0x263fee){_0x55cecd['count']=_0x263fee;if(_0x3de5a5[_0xc1ee('0x31')]['includeAll']){_0x3b239f[_0xc1ee('0x40')]=[{'all':!![]}];}return db[_0xc1ee('0x2d')][_0xc1ee('0x41')](_0x3b239f);})[_0xc1ee('0x27')](function(_0x385afa){_0x55cecd[_0xc1ee('0x42')]=_0x385afa;return _0x55cecd;})[_0xc1ee('0x27')](respondWithFilteredResult(_0x23bc7e,_0x3b239f))['catch'](handleError(_0x23bc7e,null));};exports[_0xc1ee('0x43')]=function(_0x287067,_0x292201){var _0x2229ae={'raw':!![],'where':{'id':_0x287067[_0xc1ee('0x44')]['id']}},_0x5ca242={};_0x5ca242[_0xc1ee('0x30')]=_[_0xc1ee('0x32')](db[_0xc1ee('0x2d')]['rawAttributes']);_0x5ca242['query']=_[_0xc1ee('0x32')](_0x287067[_0xc1ee('0x31')]);_0x5ca242[_0xc1ee('0x3a')]=_[_0xc1ee('0x33')](_0x5ca242[_0xc1ee('0x30')],_0x5ca242[_0xc1ee('0x31')]);_0x2229ae['attributes']=_['intersection'](_0x5ca242['model'],qs[_0xc1ee('0x35')](_0x287067[_0xc1ee('0x31')][_0xc1ee('0x35')]));_0x2229ae[_0xc1ee('0x34')]=_0x2229ae['attributes'][_0xc1ee('0x36')]?_0x2229ae['attributes']:_0x5ca242['model'];if(_0x287067[_0xc1ee('0x31')][_0xc1ee('0x45')]){_0x2229ae[_0xc1ee('0x40')]=[{'all':!![]}];}_0x2229ae=_[_0xc1ee('0x46')]({},_0x2229ae,_0x287067[_0xc1ee('0x3f')]);return db['ZohoField'][_0xc1ee('0x47')](_0x2229ae)[_0xc1ee('0x27')](handleEntityNotFound(_0x292201,null))['then'](respondWithResult(_0x292201,null))['catch'](handleError(_0x292201,null));};exports[_0xc1ee('0x48')]=function(_0x22ccd7,_0x147fbb){return db[_0xc1ee('0x2d')]['create'](_0x22ccd7[_0xc1ee('0x49')],{})[_0xc1ee('0x27')](respondWithResult(_0x147fbb,0xc9))['catch'](handleError(_0x147fbb,null));};exports[_0xc1ee('0x26')]=function(_0x439d44,_0x42fdc2){if(_0x439d44[_0xc1ee('0x49')]['id']){delete _0x439d44[_0xc1ee('0x49')]['id'];}return db[_0xc1ee('0x2d')][_0xc1ee('0x47')]({'where':{'id':_0x439d44[_0xc1ee('0x44')]['id']}})[_0xc1ee('0x27')](handleEntityNotFound(_0x42fdc2,null))['then'](saveUpdates(_0x439d44[_0xc1ee('0x49')],null))[_0xc1ee('0x27')](respondWithResult(_0x42fdc2,null))[_0xc1ee('0x4a')](handleError(_0x42fdc2,null));};exports[_0xc1ee('0x4b')]=function(_0x523017,_0xb67638){return db[_0xc1ee('0x2d')][_0xc1ee('0x47')]({'where':{'id':_0x523017[_0xc1ee('0x44')]['id']}})[_0xc1ee('0x27')](handleEntityNotFound(_0xb67638,null))[_0xc1ee('0x27')](removeEntity(_0xb67638,null))[_0xc1ee('0x4a')](handleError(_0xb67638,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index d0facb6..00c9399 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 _0xa46e=['path','../../config/environment','exports','define','int_zoho_fields','zoho_unique_index','idField','FieldId','lodash','util','api','moment','bluebird'];(function(_0x28d7c5,_0x4666bc){var _0x23c9d1=function(_0x4618e2){while(--_0x4618e2){_0x28d7c5['push'](_0x28d7c5['shift']());}};_0x23c9d1(++_0x4666bc);}(_0xa46e,0x8a));var _0xea46=function(_0x13606d,_0x30f265){_0x13606d=_0x13606d-0x0;var _0x1b85b0=_0xa46e[_0x13606d];return _0x1b85b0;};'use strict';var _=require(_0xea46('0x0'));var util=require(_0xea46('0x1'));var logger=require('../../config/logger')(_0xea46('0x2'));var moment=require(_0xea46('0x3'));var BPromise=require(_0xea46('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xea46('0x5'));var rimraf=require('rimraf');var config=require(_0xea46('0x6'));var attributes=require('./intZohoField.attributes');module[_0xea46('0x7')]=function(_0x528404,_0x10bee5){return _0x528404[_0xea46('0x8')]('ZohoField',attributes,{'tableName':_0xea46('0x9'),'paranoid':![],'indexes':[{'name':_0xea46('0xa'),'fields':[_0xea46('0xb'),_0xea46('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x81c6=['../../config/environment','./intZohoField.attributes','exports','define','ZohoField','idField','FieldId','util','bluebird','request-promise','path'];(function(_0x5c284c,_0x2efdc1){var _0x398188=function(_0x19f0a0){while(--_0x19f0a0){_0x5c284c['push'](_0x5c284c['shift']());}};_0x398188(++_0x2efdc1);}(_0x81c6,0x1d5));var _0x681c=function(_0xe506a9,_0x3105d4){_0xe506a9=_0xe506a9-0x0;var _0x12ca6f=_0x81c6[_0xe506a9];return _0x12ca6f;};'use strict';var _=require('lodash');var util=require(_0x681c('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x681c('0x1'));var rp=require(_0x681c('0x2'));var fs=require('fs');var path=require(_0x681c('0x3'));var rimraf=require('rimraf');var config=require(_0x681c('0x4'));var attributes=require(_0x681c('0x5'));module[_0x681c('0x6')]=function(_0x1d31c8,_0x4ea522){return _0x1d31c8[_0x681c('0x7')](_0x681c('0x8'),attributes,{'tableName':'int_zoho_fields','paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':[_0x681c('0x9'),_0x681c('0xa')],'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 8e85f4c..d11bd95 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 _0x6fee=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','ZohoField,\x20%s,\x20%s','debug','ZohoField,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','lodash'];(function(_0xd4826e,_0x12cd4f){var _0x22457d=function(_0x27397e){while(--_0x27397e){_0xd4826e['push'](_0xd4826e['shift']());}};_0x22457d(++_0x12cd4f);}(_0x6fee,0x77));var _0xe6fe=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6fee[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe6fe('0x0'));var util=require('util');var moment=require(_0xe6fe('0x1'));var BPromise=require(_0xe6fe('0x2'));var rs=require(_0xe6fe('0x3'));var fs=require('fs');var Redis=require(_0xe6fe('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe6fe('0x5'));var logger=require(_0xe6fe('0x6'))(_0xe6fe('0x7'));var config=require(_0xe6fe('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xe6fe('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3857f2,_0x4ed886,_0x28e9ed){return new BPromise(function(_0x1852e7,_0x4fc4c8){return client[_0xe6fe('0xa')](_0x3857f2,_0x28e9ed)[_0xe6fe('0xb')](function(_0x282cf6){logger['info'](_0xe6fe('0xc'),_0x4ed886,'request\x20sent');logger[_0xe6fe('0xd')](_0xe6fe('0xe'),_0x4ed886,_0xe6fe('0xf'),JSON['stringify'](_0x282cf6));if(_0x282cf6[_0xe6fe('0x10')]){if(_0x282cf6[_0xe6fe('0x10')][_0xe6fe('0x11')]===0x1f4){logger[_0xe6fe('0x10')](_0xe6fe('0xc'),_0x4ed886,_0x282cf6[_0xe6fe('0x10')]['message']);return _0x4fc4c8(_0x282cf6[_0xe6fe('0x10')][_0xe6fe('0x12')]);}logger[_0xe6fe('0x10')](_0xe6fe('0xc'),_0x4ed886,_0x282cf6[_0xe6fe('0x10')][_0xe6fe('0x12')]);return _0x1852e7(_0x282cf6[_0xe6fe('0x10')][_0xe6fe('0x12')]);}else{logger['info']('ZohoField,\x20%s,\x20%s',_0x4ed886,_0xe6fe('0xf'));_0x1852e7(_0x282cf6['result']['message']);}})[_0xe6fe('0x13')](function(_0x2dc207){logger[_0xe6fe('0x10')]('ZohoField,\x20%s,\x20%s',_0x4ed886,_0x2dc207);_0x4fc4c8(_0x2dc207);});});} \ No newline at end of file +var _0xf9f8=['moment','bluebird','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','util'];(function(_0x34021d,_0x753aa6){var _0x16597b=function(_0x2d040a){while(--_0x2d040a){_0x34021d['push'](_0x34021d['shift']());}};_0x16597b(++_0x753aa6);}(_0xf9f8,0x197));var _0x8f9f=function(_0x2e20bc,_0xd603db){_0x2e20bc=_0x2e20bc-0x0;var _0x1aabd0=_0xf9f8[_0x2e20bc];return _0x1aabd0;};'use strict';var _=require('lodash');var util=require(_0x8f9f('0x0'));var moment=require(_0x8f9f('0x1'));var BPromise=require(_0x8f9f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8f9f('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x8f9f('0x4'));var logger=require(_0x8f9f('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x8f9f('0x6'));var client=jayson[_0x8f9f('0x7')][_0x8f9f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2d3af5,_0x4a8df2,_0x7f69e4){return new BPromise(function(_0x44a661,_0x3b7c03){return client['request'](_0x2d3af5,_0x7f69e4)['then'](function(_0x5ca4c2){logger[_0x8f9f('0x9')](_0x8f9f('0xa'),_0x4a8df2,_0x8f9f('0xb'));logger[_0x8f9f('0xc')]('ZohoField,\x20%s,\x20%s,\x20%s',_0x4a8df2,_0x8f9f('0xb'),JSON[_0x8f9f('0xd')](_0x5ca4c2));if(_0x5ca4c2[_0x8f9f('0xe')]){if(_0x5ca4c2[_0x8f9f('0xe')][_0x8f9f('0xf')]===0x1f4){logger[_0x8f9f('0xe')]('ZohoField,\x20%s,\x20%s',_0x4a8df2,_0x5ca4c2[_0x8f9f('0xe')][_0x8f9f('0x10')]);return _0x3b7c03(_0x5ca4c2[_0x8f9f('0xe')][_0x8f9f('0x10')]);}logger['error'](_0x8f9f('0xa'),_0x4a8df2,_0x5ca4c2['error']['message']);return _0x44a661(_0x5ca4c2[_0x8f9f('0xe')][_0x8f9f('0x10')]);}else{logger[_0x8f9f('0x9')](_0x8f9f('0xa'),_0x4a8df2,_0x8f9f('0xb'));_0x44a661(_0x5ca4c2['result']['message']);}})['catch'](function(_0x4a7751){logger[_0x8f9f('0xe')]('ZohoField,\x20%s,\x20%s',_0x4a8df2,_0x4a7751);_0x3b7c03(_0x4a7751);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 50a7af2..535795d 100644 --- a/server/api/integration/index.js +++ b/server/api/integration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x20d1cf,_0x3bf30a){var _0x3fbc81=function(_0x234335){while(--_0x234335){_0x20d1cf['push'](_0x20d1cf['shift']());}};_0x3fbc81(++_0x3bf30a);}(_0xe706,0xa3));var _0x6e70=function(_0x3b9859,_0x52b534){_0x3b9859=_0x3b9859-0x0;var _0x3bc080=_0xe706[_0x3b9859];return _0x3bc080;};'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(_0x3eb5f3,_0x2032f4){var _0xf43b85=function(_0x4e633a){while(--_0x4e633a){_0x3eb5f3['push'](_0x3eb5f3['shift']());}};_0xf43b85(++_0x2032f4);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1147ab,_0x10e72b){_0x1147ab=_0x1147ab-0x0;var _0x55cb5a=_0xcb91[_0x1147ab];return _0x55cb5a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 3fe423c..5016f9d 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 _0xafd0=['STRING','unique_name_and_version','app.js','INTEGER','BOOLEAN','state','sequelize','exports'];(function(_0x21c068,_0x369d6a){var _0x5cf199=function(_0x2c0159){while(--_0x2c0159){_0x21c068['push'](_0x21c068['shift']());}};_0x5cf199(++_0x369d6a);}(_0xafd0,0x18e));var _0x0afd=function(_0x1b2ff7,_0x12a034){_0x1b2ff7=_0x1b2ff7-0x0;var _0x31656a=_0xafd0[_0x1b2ff7];return _0x31656a;};'use strict';var Sequelize=require(_0x0afd('0x0'));module[_0x0afd('0x1')]={'name':{'type':Sequelize[_0x0afd('0x2')],'allowNull':![],'unique':_0x0afd('0x3')},'version':{'type':Sequelize[_0x0afd('0x2')],'allowNull':![],'unique':_0x0afd('0x3')},'main':{'type':Sequelize[_0x0afd('0x2')],'defaultValue':_0x0afd('0x4')},'filename':{'type':Sequelize[_0x0afd('0x2')]},'path':{'type':Sequelize[_0x0afd('0x2')]},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize[_0x0afd('0x5')]},'active':{'type':Sequelize[_0x0afd('0x6')],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize[_0x0afd('0x2')]},'state':{'type':Sequelize[_0x0afd('0x2')],'unique':_0x0afd('0x7')},'description':{'type':Sequelize[_0x0afd('0x2')]},'title':{'type':Sequelize[_0x0afd('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'link':{'type':Sequelize[_0x0afd('0x2')],'defaultValue':'#'}}; \ No newline at end of file +var _0xf2b9=['INTEGER','BOOLEAN','state','sequelize','exports','STRING','unique_name_and_version','app.js'];(function(_0x482340,_0x225de9){var _0x5f2926=function(_0x4a3254){while(--_0x4a3254){_0x482340['push'](_0x482340['shift']());}};_0x5f2926(++_0x225de9);}(_0xf2b9,0x183));var _0x9f2b=function(_0x59dc3f,_0x219ceb){_0x59dc3f=_0x59dc3f-0x0;var _0x17a7aa=_0xf2b9[_0x59dc3f];return _0x17a7aa;};'use strict';var Sequelize=require(_0x9f2b('0x0'));module[_0x9f2b('0x1')]={'name':{'type':Sequelize[_0x9f2b('0x2')],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize[_0x9f2b('0x2')],'allowNull':![],'unique':_0x9f2b('0x3')},'main':{'type':Sequelize[_0x9f2b('0x2')],'defaultValue':_0x9f2b('0x4')},'filename':{'type':Sequelize[_0x9f2b('0x2')]},'path':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x9f2b('0x2')]},'size':{'type':Sequelize[_0x9f2b('0x5')]},'active':{'type':Sequelize[_0x9f2b('0x6')],'defaultValue':![]},'author':{'type':Sequelize[_0x9f2b('0x2')]},'logo':{'type':Sequelize[_0x9f2b('0x2')]},'state':{'type':Sequelize[_0x9f2b('0x2')],'unique':_0x9f2b('0x7')},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x9f2b('0x2')]},'link':{'type':Sequelize['STRING'],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index 883d990..d22e954 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 _0xfcf0=['intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','filter','includeAll','include','catch','params','merge','options','create','body','find','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','update','then','destroy','error','stack','name','send','index','Integration','rawAttributes','fieldName','type','key','model','map','keys','query','filters'];(function(_0x448f9d,_0xd4b6b4){var _0x566882=function(_0x92d359){while(--_0x92d359){_0x448f9d['push'](_0x448f9d['shift']());}};_0x566882(++_0xd4b6b4);}(_0xfcf0,0x138));var _0x0fcf=function(_0x352d28,_0x444033){_0x352d28=_0x352d28-0x0;var _0x387d7e=_0xfcf0[_0x352d28];return _0x387d7e;};'use strict';var emlformat=require(_0x0fcf('0x0'));var rimraf=require(_0x0fcf('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0fcf('0x2'));var rp=require(_0x0fcf('0x3'));var moment=require(_0x0fcf('0x4'));var BPromise=require(_0x0fcf('0x5'));var Mustache=require('mustache');var util=require(_0x0fcf('0x6'));var path=require(_0x0fcf('0x7'));var sox=require(_0x0fcf('0x8'));var csv=require(_0x0fcf('0x9'));var ejs=require(_0x0fcf('0xa'));var fs=require('fs');var fs_extra=require(_0x0fcf('0xb'));var _=require(_0x0fcf('0xc'));var squel=require(_0x0fcf('0xd'));var crypto=require('crypto');var jsforce=require(_0x0fcf('0xe'));var deskjs=require(_0x0fcf('0xf'));var toCsv=require(_0x0fcf('0x9'));var querystring=require('querystring');var Papa=require(_0x0fcf('0x10'));var Redis=require(_0x0fcf('0x11'));var authService=require(_0x0fcf('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x0fcf('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0fcf('0x14'))(_0x0fcf('0x15'));var utils=require(_0x0fcf('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0fcf('0x17'))['db'];function respondWithStatusCode(_0x3c999e,_0x4b4904){_0x4b4904=_0x4b4904||0xcc;return function(_0x20153d){if(_0x20153d){return _0x3c999e[_0x0fcf('0x18')](_0x4b4904);}return _0x3c999e[_0x0fcf('0x19')](_0x4b4904)[_0x0fcf('0x1a')]();};}function respondWithResult(_0x25fadc,_0x48bba6){_0x48bba6=_0x48bba6||0xc8;return function(_0xa32692){if(_0xa32692){return _0x25fadc[_0x0fcf('0x19')](_0x48bba6)[_0x0fcf('0x1b')](_0xa32692);}};}function respondWithFilteredResult(_0x5e867f,_0x3c09c4){return function(_0x610106){if(_0x610106){var _0x445207=typeof _0x3c09c4[_0x0fcf('0x1c')]==='undefined'&&typeof _0x3c09c4[_0x0fcf('0x1d')]===_0x0fcf('0x1e');var _0x1a8477=_0x610106[_0x0fcf('0x1f')];var _0x19cfbd=_0x445207?0x0:_0x3c09c4['offset'];var _0x18ea32=_0x445207?_0x610106[_0x0fcf('0x1f')]:_0x3c09c4['offset']+_0x3c09c4[_0x0fcf('0x1d')];var _0x1b9a90;if(_0x18ea32>=_0x1a8477){_0x18ea32=_0x1a8477;_0x1b9a90=0xc8;}else{_0x1b9a90=0xce;}_0x5e867f['status'](_0x1b9a90);return _0x5e867f[_0x0fcf('0x20')]('Content-Range',_0x19cfbd+'-'+_0x18ea32+'/'+_0x1a8477)[_0x0fcf('0x1b')](_0x610106);}return null;};}function patchUpdates(_0x13454e){return function(_0x5c8279){try{jsonpatch[_0x0fcf('0x21')](_0x5c8279,_0x13454e,!![]);}catch(_0x3f28d0){return BPromise[_0x0fcf('0x22')](_0x3f28d0);}return _0x5c8279['save']();};}function saveUpdates(_0x2f03ce,_0x1dafc8){return function(_0x196d30){if(_0x196d30){return _0x196d30[_0x0fcf('0x23')](_0x2f03ce)[_0x0fcf('0x24')](function(_0x30e1b0){return _0x30e1b0;});}return null;};}function removeEntity(_0x5841a9,_0x2eef74){return function(_0x253641){if(_0x253641){return _0x253641[_0x0fcf('0x25')]()[_0x0fcf('0x24')](function(){_0x5841a9[_0x0fcf('0x19')](0xcc)[_0x0fcf('0x1a')]();});}};}function handleEntityNotFound(_0x2ce990,_0x18f269){return function(_0x117510){if(!_0x117510){_0x2ce990['sendStatus'](0x194);}return _0x117510;};}function handleError(_0x18965e,_0xc107a){_0xc107a=_0xc107a||0x1f4;return function(_0x41b7a2){logger[_0x0fcf('0x26')](_0x41b7a2[_0x0fcf('0x27')]);if(_0x41b7a2[_0x0fcf('0x28')]){delete _0x41b7a2[_0x0fcf('0x28')];}_0x18965e['status'](_0xc107a)[_0x0fcf('0x29')](_0x41b7a2);};}exports[_0x0fcf('0x2a')]=function(_0x200517,_0x35180d){var _0x49fd0e={},_0x5d9bcd={},_0x4af80d={'count':0x0,'rows':[]};var _0x428194=_['map'](db[_0x0fcf('0x2b')][_0x0fcf('0x2c')],function(_0x56a416){return{'name':_0x56a416[_0x0fcf('0x2d')],'type':_0x56a416[_0x0fcf('0x2e')][_0x0fcf('0x2f')]};});_0x5d9bcd[_0x0fcf('0x30')]=_[_0x0fcf('0x31')](_0x428194,_0x0fcf('0x28'));_0x5d9bcd['query']=_[_0x0fcf('0x32')](_0x200517[_0x0fcf('0x33')]);_0x5d9bcd[_0x0fcf('0x34')]=_[_0x0fcf('0x35')](_0x5d9bcd[_0x0fcf('0x30')],_0x5d9bcd[_0x0fcf('0x33')]);_0x49fd0e['attributes']=_[_0x0fcf('0x35')](_0x5d9bcd[_0x0fcf('0x30')],qs[_0x0fcf('0x36')](_0x200517[_0x0fcf('0x33')][_0x0fcf('0x36')]));_0x49fd0e[_0x0fcf('0x37')]=_0x49fd0e[_0x0fcf('0x37')][_0x0fcf('0x38')]?_0x49fd0e[_0x0fcf('0x37')]:_0x5d9bcd[_0x0fcf('0x30')];if(!_0x200517[_0x0fcf('0x33')][_0x0fcf('0x39')](_0x0fcf('0x3a'))){_0x49fd0e[_0x0fcf('0x1d')]=qs['limit'](_0x200517['query'][_0x0fcf('0x1d')]);_0x49fd0e['offset']=qs['offset'](_0x200517[_0x0fcf('0x33')][_0x0fcf('0x1c')]);}_0x49fd0e[_0x0fcf('0x3b')]=qs['sort'](_0x200517['query'][_0x0fcf('0x3c')]);_0x49fd0e[_0x0fcf('0x3d')]=qs[_0x0fcf('0x34')](_['pick'](_0x200517[_0x0fcf('0x33')],_0x5d9bcd[_0x0fcf('0x34')]),_0x428194);if(_0x200517[_0x0fcf('0x33')]['filter']){_0x49fd0e['where']=_['merge'](_0x49fd0e[_0x0fcf('0x3d')],{'$or':_[_0x0fcf('0x31')](_0x428194,function(_0xdfdd1){if(_0xdfdd1[_0x0fcf('0x2e')]!==_0x0fcf('0x3e')){var _0x4be8eb={};_0x4be8eb[_0xdfdd1[_0x0fcf('0x28')]]={'$like':'%'+_0x200517[_0x0fcf('0x33')][_0x0fcf('0x3f')]+'%'};return _0x4be8eb;}})});}_0x49fd0e=_['merge']({},_0x49fd0e,_0x200517['options']);var _0x13e4b2={'where':_0x49fd0e[_0x0fcf('0x3d')]};return db[_0x0fcf('0x2b')][_0x0fcf('0x1f')](_0x13e4b2)[_0x0fcf('0x24')](function(_0x4c6669){_0x4af80d[_0x0fcf('0x1f')]=_0x4c6669;if(_0x200517[_0x0fcf('0x33')][_0x0fcf('0x40')]){_0x49fd0e[_0x0fcf('0x41')]=[{'all':!![]}];}return db['Integration']['findAll'](_0x49fd0e);})[_0x0fcf('0x24')](function(_0x2444a6){_0x4af80d['rows']=_0x2444a6;return _0x4af80d;})[_0x0fcf('0x24')](respondWithFilteredResult(_0x35180d,_0x49fd0e))[_0x0fcf('0x42')](handleError(_0x35180d,null));};exports['show']=function(_0x237fa6,_0xfc2f2b){var _0x44eb03={'raw':![],'where':{'id':_0x237fa6[_0x0fcf('0x43')]['id']}},_0x1f322b={};_0x1f322b['model']=_[_0x0fcf('0x32')](db[_0x0fcf('0x2b')]['rawAttributes']);_0x1f322b['query']=_[_0x0fcf('0x32')](_0x237fa6['query']);_0x1f322b['filters']=_[_0x0fcf('0x35')](_0x1f322b[_0x0fcf('0x30')],_0x1f322b[_0x0fcf('0x33')]);_0x44eb03[_0x0fcf('0x37')]=_[_0x0fcf('0x35')](_0x1f322b[_0x0fcf('0x30')],qs[_0x0fcf('0x36')](_0x237fa6[_0x0fcf('0x33')][_0x0fcf('0x36')]));_0x44eb03[_0x0fcf('0x37')]=_0x44eb03['attributes'][_0x0fcf('0x38')]?_0x44eb03[_0x0fcf('0x37')]:_0x1f322b[_0x0fcf('0x30')];if(_0x237fa6['query']['includeAll']){_0x44eb03[_0x0fcf('0x41')]=[{'all':!![]}];}_0x44eb03=_[_0x0fcf('0x44')]({},_0x44eb03,_0x237fa6[_0x0fcf('0x45')]);return db[_0x0fcf('0x2b')]['find'](_0x44eb03)['then'](handleEntityNotFound(_0xfc2f2b,null))[_0x0fcf('0x24')](respondWithResult(_0xfc2f2b,null))[_0x0fcf('0x42')](handleError(_0xfc2f2b,null));};exports[_0x0fcf('0x46')]=function(_0x1fb83d,_0x345188){return db[_0x0fcf('0x2b')][_0x0fcf('0x46')](_0x1fb83d[_0x0fcf('0x47')],{})['then'](respondWithResult(_0x345188,0xc9))['catch'](handleError(_0x345188,null));};exports[_0x0fcf('0x23')]=function(_0x243699,_0x28d2f4){if(_0x243699[_0x0fcf('0x47')]['id']){delete _0x243699[_0x0fcf('0x47')]['id'];}return db[_0x0fcf('0x2b')]['find']({'where':{'id':_0x243699[_0x0fcf('0x43')]['id']}})[_0x0fcf('0x24')](handleEntityNotFound(_0x28d2f4,null))['then'](saveUpdates(_0x243699[_0x0fcf('0x47')],null))[_0x0fcf('0x24')](respondWithResult(_0x28d2f4,null))[_0x0fcf('0x42')](handleError(_0x28d2f4,null));};exports[_0x0fcf('0x25')]=function(_0x5435c0,_0xc514bf){return db[_0x0fcf('0x2b')][_0x0fcf('0x48')]({'where':{'id':_0x5435c0[_0x0fcf('0x43')]['id']}})[_0x0fcf('0x24')](handleEntityNotFound(_0xc514bf,null))[_0x0fcf('0x24')](removeEntity(_0xc514bf,null))[_0x0fcf('0x42')](handleError(_0xc514bf,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(_0x3196eb,_0x8502a8){var _0x420117=function(_0xeb0156){while(--_0xeb0156){_0x3196eb['push'](_0x3196eb['shift']());}};_0x420117(++_0x8502a8);}(_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 85a2710..1593586 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 _0x3ab3=['rimraf','../../config/environment','./integration.attributes','exports','Integration','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x541271,_0x3fa6c8){var _0x4da473=function(_0x5f4e06){while(--_0x5f4e06){_0x541271['push'](_0x541271['shift']());}};_0x4da473(++_0x3fa6c8);}(_0x3ab3,0x95));var _0x33ab=function(_0x41d02a,_0x355e19){_0x41d02a=_0x41d02a-0x0;var _0x4c3983=_0x3ab3[_0x41d02a];return _0x4c3983;};'use strict';var _=require(_0x33ab('0x0'));var util=require(_0x33ab('0x1'));var logger=require(_0x33ab('0x2'))(_0x33ab('0x3'));var moment=require(_0x33ab('0x4'));var BPromise=require('bluebird');var rp=require(_0x33ab('0x5'));var fs=require('fs');var path=require(_0x33ab('0x6'));var rimraf=require(_0x33ab('0x7'));var config=require(_0x33ab('0x8'));var attributes=require(_0x33ab('0x9'));module[_0x33ab('0xa')]=function(_0x3ded10,_0x145fce){return _0x3ded10['define'](_0x33ab('0xb'),attributes,{'tableName':'integrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfc56=['api','moment','bluebird','request-promise','path','./integration.attributes','define','Integration','integrations','lodash','util','../../config/logger'];(function(_0x3d6922,_0x42d0d8){var _0x2f1917=function(_0x7be18a){while(--_0x7be18a){_0x3d6922['push'](_0x3d6922['shift']());}};_0x2f1917(++_0x42d0d8);}(_0xfc56,0x1b9));var _0x6fc5=function(_0x399926,_0x420cfb){_0x399926=_0x399926-0x0;var _0xec23eb=_0xfc56[_0x399926];return _0xec23eb;};'use strict';var _=require(_0x6fc5('0x0'));var util=require(_0x6fc5('0x1'));var logger=require(_0x6fc5('0x2'))(_0x6fc5('0x3'));var moment=require(_0x6fc5('0x4'));var BPromise=require(_0x6fc5('0x5'));var rp=require(_0x6fc5('0x6'));var fs=require('fs');var path=require(_0x6fc5('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6fc5('0x8'));module['exports']=function(_0x12c87d,_0x365ace){return _0x12c87d[_0x6fc5('0x9')](_0x6fc5('0xa'),attributes,{'tableName':_0x6fc5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integration/integration.rpc.js b/server/api/integration/integration.rpc.js index 9346a17..a279006 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 _0xe2fe=['then','info','Integration,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request'];(function(_0x46f25d,_0x1c9a22){var _0x567a8e=function(_0x1fcf40){while(--_0x1fcf40){_0x46f25d['push'](_0x46f25d['shift']());}};_0x567a8e(++_0x1c9a22);}(_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']('Integration,\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 +var _0x6d38=['request','then','Integration,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x3974e6,_0x53f90d){var _0x27d460=function(_0x224f19){while(--_0x224f19){_0x3974e6['push'](_0x3974e6['shift']());}};_0x27d460(++_0x53f90d);}(_0x6d38,0x1ef));var _0x86d3=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x6d38[_0x3947c9];return _0x2e7871;};'use strict';var _=require('lodash');var util=require(_0x86d3('0x0'));var moment=require(_0x86d3('0x1'));var BPromise=require(_0x86d3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x86d3('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x86d3('0x4'))(_0x86d3('0x5'));var config=require(_0x86d3('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x86d3('0x7')][_0x86d3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x33d4aa,_0x2eaa15,_0x47e654){return new BPromise(function(_0x552b07,_0x2aea31){return client[_0x86d3('0x9')](_0x33d4aa,_0x47e654)[_0x86d3('0xa')](function(_0x499640){logger['info'](_0x86d3('0xb'),_0x2eaa15,_0x86d3('0xc'));logger['debug']('Integration,\x20%s,\x20%s,\x20%s',_0x2eaa15,_0x86d3('0xc'),JSON[_0x86d3('0xd')](_0x499640));if(_0x499640['error']){if(_0x499640[_0x86d3('0xe')]['code']===0x1f4){logger[_0x86d3('0xe')](_0x86d3('0xb'),_0x2eaa15,_0x499640[_0x86d3('0xe')][_0x86d3('0xf')]);return _0x2aea31(_0x499640[_0x86d3('0xe')][_0x86d3('0xf')]);}logger[_0x86d3('0xe')](_0x86d3('0xb'),_0x2eaa15,_0x499640['error'][_0x86d3('0xf')]);return _0x552b07(_0x499640[_0x86d3('0xe')][_0x86d3('0xf')]);}else{logger[_0x86d3('0x10')](_0x86d3('0xb'),_0x2eaa15,_0x86d3('0xc'));_0x552b07(_0x499640[_0x86d3('0x11')][_0x86d3('0xf')]);}})['catch'](function(_0x2d5ba9){logger[_0x86d3('0xe')](_0x86d3('0xb'),_0x2eaa15,_0x2d5ba9);_0x2aea31(_0x2d5ba9);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index c7fce39..522fde4 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 _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(_0x4111c5,_0x1b2481){var _0x341819=function(_0xbc4e78){while(--_0xbc4e78){_0x4111c5['push'](_0x4111c5['shift']());}};_0x341819(++_0x1b2481);}(_0x4975,0x86));var _0x5497=function(_0x4c7dd3,_0x4bfc28){_0x4c7dd3=_0x4c7dd3-0x0;var _0x584f73=_0x4975[_0x4c7dd3];return _0x584f73;};'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 +var _0xdb28=['destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','create','put','update'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0xdb28,0x106));var _0x8db2=function(_0x2bc270,_0x7baa1){_0x2bc270=_0x2bc270-0x0;var _0x3259f6=_0xdb28[_0x2bc270];return _0x3259f6;};'use strict';var multer=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var path=require(_0x8db2('0x2'));var timeout=require(_0x8db2('0x3'));var express=require('express');var router=express[_0x8db2('0x4')]();var fs_extra=require(_0x8db2('0x5'));var auth=require(_0x8db2('0x6'));var interaction=require(_0x8db2('0x7'));var config=require(_0x8db2('0x8'));var controller=require('./integrationReport.controller');router[_0x8db2('0x9')]('/',auth[_0x8db2('0xa')](),controller['index']);router['get'](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xc')]);router[_0x8db2('0x9')](_0x8db2('0xd'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xe')]);router['post']('/',auth[_0x8db2('0xa')](),controller[_0x8db2('0xf')]);router[_0x8db2('0x10')]('/:id',auth[_0x8db2('0xa')](),controller[_0x8db2('0x11')]);router['delete'](_0x8db2('0xd'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x12')]);module[_0x8db2('0x13')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 8696ae5..7e907ed 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 _0x352e=['BOOLEAN','TEXT','SENDING','FAILED','exports','STRING','INTEGER','DATE'];(function(_0x326e1d,_0x360232){var _0x1ad676=function(_0x1bb4d3){while(--_0x1bb4d3){_0x326e1d['push'](_0x326e1d['shift']());}};_0x1ad676(++_0x360232);}(_0x352e,0x1b4));var _0xe352=function(_0xe4af88,_0x22d66f){_0xe4af88=_0xe4af88-0x0;var _0x237fee=_0x352e[_0xe4af88];return _0x237fee;};'use strict';var Sequelize=require('sequelize');module[_0xe352('0x0')]={'integration':{'type':Sequelize[_0xe352('0x1')]},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize[_0xe352('0x1')]},'ticketId':{'type':Sequelize[_0xe352('0x1')]},'integrationId':{'type':Sequelize[_0xe352('0x2')]},'contacts':{'type':Sequelize[_0xe352('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xe352('0x1')]},'calleridname':{'type':Sequelize[_0xe352('0x1')]},'queue':{'type':Sequelize[_0xe352('0x1')]},'interface':{'type':Sequelize[_0xe352('0x1')]},'membername':{'type':Sequelize[_0xe352('0x1')]},'agentcalledAt':{'type':Sequelize[_0xe352('0x3')]},'agentconnectAt':{'type':Sequelize[_0xe352('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0xe352('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xe352('0x3')]},'talktime':{'type':Sequelize[_0xe352('0x2')]},'agentacw':{'type':Sequelize[_0xe352('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xe352('0x2')]},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize[_0xe352('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xe352('0x3')]},'agentdump':{'type':Sequelize[_0xe352('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xe352('0x3')]},'lastevent':{'type':Sequelize[_0xe352('0x1')]},'channel':{'type':Sequelize[_0xe352('0x1')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xe352('0x1')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xe352('0x1')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xe352('0x1')]},'context':{'type':Sequelize[_0xe352('0x1')]},'exten':{'type':Sequelize[_0xe352('0x1')]},'priority':{'type':Sequelize[_0xe352('0x1')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xe352('0x2')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xe352('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xe352('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xe352('0x1')]},'destlanguage':{'type':Sequelize[_0xe352('0x1')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0xe352('0x1')]},'destexten':{'type':Sequelize[_0xe352('0x1')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize[_0xe352('0x1')]},'inReplyTo':{'type':Sequelize[_0xe352('0x1')]},'subject':{'type':Sequelize[_0xe352('0x1')]},'from':{'type':Sequelize[_0xe352('0x1')]},'to':{'type':Sequelize[_0xe352('0x1')]},'cc':{'type':Sequelize['STRING']},'attachment':{'type':Sequelize[_0xe352('0x5')]},'html':{'type':Sequelize[_0xe352('0x5')]},'text':{'type':Sequelize['TEXT']},'status':{'type':Sequelize['ENUM']('SENT',_0xe352('0x6'),'RECEIVED',_0xe352('0x7'))},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize[_0xe352('0x1')]},'appdata':{'type':Sequelize['STRING']},'projectId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xed6d=['SENDING','RECEIVED','FAILED','sequelize','STRING','INTEGER','BOOLEAN','DATE','TEXT','ENUM','SENT'];(function(_0x54ddb5,_0x3c6d18){var _0x39faee=function(_0x3ef1df){while(--_0x3ef1df){_0x54ddb5['push'](_0x54ddb5['shift']());}};_0x39faee(++_0x3c6d18);}(_0xed6d,0x1bb));var _0xded6=function(_0x1f36bb,_0x8af718){_0x1f36bb=_0x1f36bb-0x0;var _0xaf97fa=_0xed6d[_0x1f36bb];return _0xaf97fa;};'use strict';var Sequelize=require(_0xded6('0x0'));module['exports']={'integration':{'type':Sequelize[_0xded6('0x1')]},'eventChannel':{'type':Sequelize[_0xded6('0x1')]},'exitStatus':{'type':Sequelize['STRING']},'ticketId':{'type':Sequelize[_0xded6('0x1')]},'integrationId':{'type':Sequelize[_0xded6('0x2')]},'contacts':{'type':Sequelize[_0xded6('0x1')]},'uniqueid':{'type':Sequelize[_0xded6('0x1')]},'calleridnum':{'type':Sequelize[_0xded6('0x1')]},'calleridname':{'type':Sequelize[_0xded6('0x1')]},'queue':{'type':Sequelize[_0xded6('0x1')]},'interface':{'type':Sequelize[_0xded6('0x1')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0xded6('0x3')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xded6('0x4')]},'talktime':{'type':Sequelize[_0xded6('0x2')]},'agentacw':{'type':Sequelize[_0xded6('0x3')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xded6('0x2')]},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize[_0xded6('0x3')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xded6('0x4')]},'agentdump':{'type':Sequelize[_0xded6('0x3')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0xded6('0x1')]},'channel':{'type':Sequelize[_0xded6('0x1')]},'channelstate':{'type':Sequelize[_0xded6('0x2')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xded6('0x1')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xded6('0x1')]},'context':{'type':Sequelize[_0xded6('0x1')]},'exten':{'type':Sequelize[_0xded6('0x1')]},'priority':{'type':Sequelize[_0xded6('0x1')]},'destchannel':{'type':Sequelize[_0xded6('0x1')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xded6('0x1')]},'destcalleridnum':{'type':Sequelize[_0xded6('0x1')]},'destcalleridname':{'type':Sequelize[_0xded6('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xded6('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xded6('0x1')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0xded6('0x1')]},'destcontext':{'type':Sequelize[_0xded6('0x1')]},'destexten':{'type':Sequelize[_0xded6('0x1')]},'destpriority':{'type':Sequelize[_0xded6('0x1')]},'destuniqueid':{'type':Sequelize[_0xded6('0x1')]},'messageId':{'type':Sequelize[_0xded6('0x1')]},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize[_0xded6('0x1')]},'to':{'type':Sequelize[_0xded6('0x1')]},'cc':{'type':Sequelize[_0xded6('0x1')]},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize[_0xded6('0x5')]},'text':{'type':Sequelize[_0xded6('0x5')]},'status':{'type':Sequelize[_0xded6('0x6')](_0xded6('0x7'),_0xded6('0x8'),_0xded6('0x9'),_0xded6('0xa'))},'url':{'type':Sequelize[_0xded6('0x1')]},'app':{'type':Sequelize[_0xded6('0x1')]},'appdata':{'type':Sequelize['STRING']},'projectId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 5499e20..760f560 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 _0x7be6=['undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','IntegrationReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','length','create','body','find','params','describe','eml-format','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset'];(function(_0x229728,_0x4fd19f){var _0x384549=function(_0x175f2a){while(--_0x175f2a){_0x229728['push'](_0x229728['shift']());}};_0x384549(++_0x4fd19f);}(_0x7be6,0x171));var _0x67be=function(_0x4d2976,_0x26bd1d){_0x4d2976=_0x4d2976-0x0;var _0x35ef5e=_0x7be6[_0x4d2976];return _0x35ef5e;};'use strict';var emlformat=require(_0x67be('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x67be('0x1'));var rp=require(_0x67be('0x2'));var moment=require(_0x67be('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x67be('0x4'));var util=require(_0x67be('0x5'));var path=require(_0x67be('0x6'));var sox=require(_0x67be('0x7'));var csv=require(_0x67be('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x67be('0x9'));var _=require(_0x67be('0xa'));var squel=require(_0x67be('0xb'));var crypto=require(_0x67be('0xc'));var jsforce=require(_0x67be('0xd'));var deskjs=require(_0x67be('0xe'));var toCsv=require('to-csv');var querystring=require(_0x67be('0xf'));var Papa=require(_0x67be('0x10'));var Redis=require(_0x67be('0x11'));var authService=require(_0x67be('0x12'));var qs=require(_0x67be('0x13'));var as=require(_0x67be('0x14'));var hardwareService=require(_0x67be('0x15'));var logger=require(_0x67be('0x16'))(_0x67be('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x67be('0x18'));var db=require(_0x67be('0x19'))['db'];function respondWithStatusCode(_0x43af6d,_0x40f32d){_0x40f32d=_0x40f32d||0xcc;return function(_0x4c9fae){if(_0x4c9fae){return _0x43af6d[_0x67be('0x1a')](_0x40f32d);}return _0x43af6d[_0x67be('0x1b')](_0x40f32d)[_0x67be('0x1c')]();};}function respondWithResult(_0x5bd014,_0x2f656a){_0x2f656a=_0x2f656a||0xc8;return function(_0x31549b){if(_0x31549b){return _0x5bd014[_0x67be('0x1b')](_0x2f656a)[_0x67be('0x1d')](_0x31549b);}};}function respondWithFilteredResult(_0x4c31cb,_0x142eb9){return function(_0x5db127){if(_0x5db127){var _0x468458=typeof _0x142eb9[_0x67be('0x1e')]===_0x67be('0x1f')&&typeof _0x142eb9[_0x67be('0x20')]==='undefined';var _0x60775c=_0x5db127[_0x67be('0x21')];var _0x46efd2=_0x468458?0x0:_0x142eb9['offset'];var _0xa2fe82=_0x468458?_0x5db127[_0x67be('0x21')]:_0x142eb9[_0x67be('0x1e')]+_0x142eb9['limit'];var _0x16a231;if(_0xa2fe82>=_0x60775c){_0xa2fe82=_0x60775c;_0x16a231=0xc8;}else{_0x16a231=0xce;}_0x4c31cb['status'](_0x16a231);return _0x4c31cb[_0x67be('0x22')](_0x67be('0x23'),_0x46efd2+'-'+_0xa2fe82+'/'+_0x60775c)['json'](_0x5db127);}return null;};}function patchUpdates(_0x282425){return function(_0x214fb0){try{jsonpatch[_0x67be('0x24')](_0x214fb0,_0x282425,!![]);}catch(_0x24ad38){return BPromise['reject'](_0x24ad38);}return _0x214fb0[_0x67be('0x25')]();};}function saveUpdates(_0x218abd,_0x51a72f){return function(_0x158468){if(_0x158468){return _0x158468[_0x67be('0x26')](_0x218abd)[_0x67be('0x27')](function(_0x5d5c58){return _0x5d5c58;});}return null;};}function removeEntity(_0x1f3ef3,_0x36513a){return function(_0x6f4da7){if(_0x6f4da7){return _0x6f4da7[_0x67be('0x28')]()[_0x67be('0x27')](function(){_0x1f3ef3[_0x67be('0x1b')](0xcc)[_0x67be('0x1c')]();});}};}function handleEntityNotFound(_0x48ad5a,_0x4259b1){return function(_0xbc24a2){if(!_0xbc24a2){_0x48ad5a[_0x67be('0x1a')](0x194);}return _0xbc24a2;};}function handleError(_0x582a41,_0x107557){_0x107557=_0x107557||0x1f4;return function(_0x3acbfa){logger[_0x67be('0x29')](_0x3acbfa[_0x67be('0x2a')]);if(_0x3acbfa[_0x67be('0x2b')]){delete _0x3acbfa[_0x67be('0x2b')];}_0x582a41[_0x67be('0x1b')](_0x107557)[_0x67be('0x2c')](_0x3acbfa);};}exports[_0x67be('0x2d')]=function(_0x148a13,_0xa32b13){var _0x582eda={},_0xecfd66={},_0x27adc6={'count':0x0,'rows':[]};var _0x6fff6e=_[_0x67be('0x2e')](db[_0x67be('0x2f')][_0x67be('0x30')],function(_0x55fc38){return{'name':_0x55fc38[_0x67be('0x31')],'type':_0x55fc38[_0x67be('0x32')][_0x67be('0x33')]};});_0xecfd66[_0x67be('0x34')]=_[_0x67be('0x2e')](_0x6fff6e,_0x67be('0x2b'));_0xecfd66[_0x67be('0x35')]=_[_0x67be('0x36')](_0x148a13[_0x67be('0x35')]);_0xecfd66['filters']=_[_0x67be('0x37')](_0xecfd66[_0x67be('0x34')],_0xecfd66['query']);_0x582eda[_0x67be('0x38')]=_[_0x67be('0x37')](_0xecfd66[_0x67be('0x34')],qs[_0x67be('0x39')](_0x148a13[_0x67be('0x35')][_0x67be('0x39')]));_0x582eda['attributes']=_0x582eda[_0x67be('0x38')]['length']?_0x582eda[_0x67be('0x38')]:_0xecfd66['model'];if(!_0x148a13[_0x67be('0x35')][_0x67be('0x3a')](_0x67be('0x3b'))){_0x582eda['limit']=qs['limit'](_0x148a13[_0x67be('0x35')][_0x67be('0x20')]);_0x582eda[_0x67be('0x1e')]=qs[_0x67be('0x1e')](_0x148a13[_0x67be('0x35')][_0x67be('0x1e')]);}_0x582eda[_0x67be('0x3c')]=qs[_0x67be('0x3d')](_0x148a13[_0x67be('0x35')]['sort']);_0x582eda[_0x67be('0x3e')]=qs['filters'](_[_0x67be('0x3f')](_0x148a13[_0x67be('0x35')],_0xecfd66[_0x67be('0x40')]),_0x6fff6e);if(_0x148a13['query'][_0x67be('0x41')]){_0x582eda[_0x67be('0x3e')]=_[_0x67be('0x42')](_0x582eda[_0x67be('0x3e')],{'$or':_['map'](_0x6fff6e,function(_0xfd00b9){if(_0xfd00b9[_0x67be('0x32')]!==_0x67be('0x43')){var _0x3b98f8={};_0x3b98f8[_0xfd00b9['name']]={'$like':'%'+_0x148a13[_0x67be('0x35')][_0x67be('0x41')]+'%'};return _0x3b98f8;}})});}_0x582eda=_[_0x67be('0x42')]({},_0x582eda,_0x148a13[_0x67be('0x44')]);var _0x180794={'where':_0x582eda[_0x67be('0x3e')]};return db['IntegrationReport'][_0x67be('0x21')](_0x180794)[_0x67be('0x27')](function(_0x1bbac0){_0x27adc6[_0x67be('0x21')]=_0x1bbac0;if(_0x148a13[_0x67be('0x35')][_0x67be('0x45')]){_0x582eda[_0x67be('0x46')]=[{'all':!![]}];}return db[_0x67be('0x2f')]['findAll'](_0x582eda);})[_0x67be('0x27')](function(_0x485033){_0x27adc6[_0x67be('0x47')]=_0x485033;return _0x27adc6;})['then'](respondWithFilteredResult(_0xa32b13,_0x582eda))[_0x67be('0x48')](handleError(_0xa32b13,null));};exports[_0x67be('0x49')]=function(_0x482578,_0x14c245){var _0x427a00={'raw':![],'where':{'id':_0x482578['params']['id']}},_0x17cc83={};_0x17cc83[_0x67be('0x34')]=_[_0x67be('0x36')](db[_0x67be('0x2f')]['rawAttributes']);_0x17cc83[_0x67be('0x35')]=_[_0x67be('0x36')](_0x482578[_0x67be('0x35')]);_0x17cc83[_0x67be('0x40')]=_[_0x67be('0x37')](_0x17cc83['model'],_0x17cc83[_0x67be('0x35')]);_0x427a00[_0x67be('0x38')]=_[_0x67be('0x37')](_0x17cc83[_0x67be('0x34')],qs[_0x67be('0x39')](_0x482578['query'][_0x67be('0x39')]));_0x427a00[_0x67be('0x38')]=_0x427a00[_0x67be('0x38')][_0x67be('0x4a')]?_0x427a00[_0x67be('0x38')]:_0x17cc83[_0x67be('0x34')];if(_0x482578[_0x67be('0x35')]['includeAll']){_0x427a00[_0x67be('0x46')]=[{'all':!![]}];}_0x427a00=_[_0x67be('0x42')]({},_0x427a00,_0x482578['options']);return db[_0x67be('0x2f')]['find'](_0x427a00)[_0x67be('0x27')](handleEntityNotFound(_0x14c245,null))[_0x67be('0x27')](respondWithResult(_0x14c245,null))[_0x67be('0x48')](handleError(_0x14c245,null));};exports['create']=function(_0x87abf7,_0x2bce54){return db[_0x67be('0x2f')][_0x67be('0x4b')](_0x87abf7[_0x67be('0x4c')],{})['then'](respondWithResult(_0x2bce54,0xc9))[_0x67be('0x48')](handleError(_0x2bce54,null));};exports[_0x67be('0x26')]=function(_0x174fa1,_0x2bb047){if(_0x174fa1['body']['id']){delete _0x174fa1[_0x67be('0x4c')]['id'];}return db[_0x67be('0x2f')]['find']({'where':{'id':_0x174fa1['params']['id']}})[_0x67be('0x27')](handleEntityNotFound(_0x2bb047,null))[_0x67be('0x27')](saveUpdates(_0x174fa1[_0x67be('0x4c')],null))[_0x67be('0x27')](respondWithResult(_0x2bb047,null))[_0x67be('0x48')](handleError(_0x2bb047,null));};exports[_0x67be('0x28')]=function(_0x1e3f43,_0x419cd8){return db[_0x67be('0x2f')][_0x67be('0x4d')]({'where':{'id':_0x1e3f43[_0x67be('0x4e')]['id']}})[_0x67be('0x27')](handleEntityNotFound(_0x419cd8,null))['then'](removeEntity(_0x419cd8,null))[_0x67be('0x48')](handleError(_0x419cd8,null));};exports[_0x67be('0x4f')]=function(_0x4834d8,_0x1dc113){return db[_0x67be('0x2f')]['describe']()[_0x67be('0x27')](respondWithResult(_0x1dc113,null))[_0x67be('0x48')](handleError(_0x1dc113,null));}; \ No newline at end of file +var _0xbc67=['squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','undefined','count','offset','Content-Range','apply','save','update','then','error','stack','name','send','index','map','IntegrationReport','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','limit','order','sort','where','pick','merge','type','VIRTUAL','options','include','rows','catch','show','includeAll','find','body','params','destroy','describe','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash'];(function(_0x3e2590,_0x52827d){var _0x1f3167=function(_0x342d1a){while(--_0x342d1a){_0x3e2590['push'](_0x3e2590['shift']());}};_0x1f3167(++_0x52827d);}(_0xbc67,0xcd));var _0x7bc6=function(_0x1bae76,_0x5de524){_0x1bae76=_0x1bae76-0x0;var _0x252334=_0xbc67[_0x1bae76];return _0x252334;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7bc6('0x0'));var jsonpatch=require(_0x7bc6('0x1'));var rp=require(_0x7bc6('0x2'));var moment=require(_0x7bc6('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x7bc6('0x4'));var util=require(_0x7bc6('0x5'));var path=require(_0x7bc6('0x6'));var sox=require(_0x7bc6('0x7'));var csv=require(_0x7bc6('0x8'));var ejs=require(_0x7bc6('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7bc6('0xa'));var squel=require(_0x7bc6('0xb'));var crypto=require(_0x7bc6('0xc'));var jsforce=require(_0x7bc6('0xd'));var deskjs=require(_0x7bc6('0xe'));var toCsv=require('to-csv');var querystring=require(_0x7bc6('0xf'));var Papa=require(_0x7bc6('0x10'));var Redis=require(_0x7bc6('0x11'));var authService=require(_0x7bc6('0x12'));var qs=require(_0x7bc6('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7bc6('0x14'));var logger=require(_0x7bc6('0x15'))(_0x7bc6('0x16'));var utils=require(_0x7bc6('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x7bc6('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a8e9a,_0x58c2b5){_0x58c2b5=_0x58c2b5||0xcc;return function(_0xe6f06e){if(_0xe6f06e){return _0x2a8e9a[_0x7bc6('0x19')](_0x58c2b5);}return _0x2a8e9a['status'](_0x58c2b5)['end']();};}function respondWithResult(_0x25d0ed,_0x532c3a){_0x532c3a=_0x532c3a||0xc8;return function(_0x643b67){if(_0x643b67){return _0x25d0ed[_0x7bc6('0x1a')](_0x532c3a)[_0x7bc6('0x1b')](_0x643b67);}};}function respondWithFilteredResult(_0x4127ad,_0x54a805){return function(_0x32250c){if(_0x32250c){var _0x5a4233=typeof _0x54a805['offset']==='undefined'&&typeof _0x54a805['limit']===_0x7bc6('0x1c');var _0x245af5=_0x32250c[_0x7bc6('0x1d')];var _0x3429dc=_0x5a4233?0x0:_0x54a805[_0x7bc6('0x1e')];var _0x9125cc=_0x5a4233?_0x32250c[_0x7bc6('0x1d')]:_0x54a805['offset']+_0x54a805['limit'];var _0x349af8;if(_0x9125cc>=_0x245af5){_0x9125cc=_0x245af5;_0x349af8=0xc8;}else{_0x349af8=0xce;}_0x4127ad[_0x7bc6('0x1a')](_0x349af8);return _0x4127ad['set'](_0x7bc6('0x1f'),_0x3429dc+'-'+_0x9125cc+'/'+_0x245af5)[_0x7bc6('0x1b')](_0x32250c);}return null;};}function patchUpdates(_0x120ff6){return function(_0x40bf76){try{jsonpatch[_0x7bc6('0x20')](_0x40bf76,_0x120ff6,!![]);}catch(_0x1bc862){return BPromise['reject'](_0x1bc862);}return _0x40bf76[_0x7bc6('0x21')]();};}function saveUpdates(_0x5bbe95,_0x383fbf){return function(_0x2264a7){if(_0x2264a7){return _0x2264a7[_0x7bc6('0x22')](_0x5bbe95)[_0x7bc6('0x23')](function(_0x5b16fb){return _0x5b16fb;});}return null;};}function removeEntity(_0x339444,_0x510afc){return function(_0x441b2b){if(_0x441b2b){return _0x441b2b['destroy']()[_0x7bc6('0x23')](function(){_0x339444[_0x7bc6('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x18b639,_0x4a40ad){return function(_0x27716e){if(!_0x27716e){_0x18b639['sendStatus'](0x194);}return _0x27716e;};}function handleError(_0x34c12a,_0x46629b){_0x46629b=_0x46629b||0x1f4;return function(_0xcc87e3){logger[_0x7bc6('0x24')](_0xcc87e3[_0x7bc6('0x25')]);if(_0xcc87e3[_0x7bc6('0x26')]){delete _0xcc87e3[_0x7bc6('0x26')];}_0x34c12a[_0x7bc6('0x1a')](_0x46629b)[_0x7bc6('0x27')](_0xcc87e3);};}exports[_0x7bc6('0x28')]=function(_0x3aa7df,_0x459184){var _0x5d43a4={},_0x27cc85={},_0x1c6795={'count':0x0,'rows':[]};var _0x1334d3=_[_0x7bc6('0x29')](db[_0x7bc6('0x2a')]['rawAttributes'],function(_0x4df927){return{'name':_0x4df927[_0x7bc6('0x2b')],'type':_0x4df927['type'][_0x7bc6('0x2c')]};});_0x27cc85[_0x7bc6('0x2d')]=_[_0x7bc6('0x29')](_0x1334d3,'name');_0x27cc85[_0x7bc6('0x2e')]=_[_0x7bc6('0x2f')](_0x3aa7df[_0x7bc6('0x2e')]);_0x27cc85[_0x7bc6('0x30')]=_[_0x7bc6('0x31')](_0x27cc85[_0x7bc6('0x2d')],_0x27cc85[_0x7bc6('0x2e')]);_0x5d43a4['attributes']=_[_0x7bc6('0x31')](_0x27cc85[_0x7bc6('0x2d')],qs['fields'](_0x3aa7df[_0x7bc6('0x2e')][_0x7bc6('0x32')]));_0x5d43a4[_0x7bc6('0x33')]=_0x5d43a4[_0x7bc6('0x33')][_0x7bc6('0x34')]?_0x5d43a4['attributes']:_0x27cc85['model'];if(!_0x3aa7df[_0x7bc6('0x2e')]['hasOwnProperty']('nolimit')){_0x5d43a4['limit']=qs['limit'](_0x3aa7df[_0x7bc6('0x2e')][_0x7bc6('0x35')]);_0x5d43a4['offset']=qs[_0x7bc6('0x1e')](_0x3aa7df['query'][_0x7bc6('0x1e')]);}_0x5d43a4[_0x7bc6('0x36')]=qs[_0x7bc6('0x37')](_0x3aa7df[_0x7bc6('0x2e')][_0x7bc6('0x37')]);_0x5d43a4[_0x7bc6('0x38')]=qs[_0x7bc6('0x30')](_[_0x7bc6('0x39')](_0x3aa7df[_0x7bc6('0x2e')],_0x27cc85[_0x7bc6('0x30')]),_0x1334d3);if(_0x3aa7df[_0x7bc6('0x2e')]['filter']){_0x5d43a4[_0x7bc6('0x38')]=_[_0x7bc6('0x3a')](_0x5d43a4['where'],{'$or':_[_0x7bc6('0x29')](_0x1334d3,function(_0x5cb4fe){if(_0x5cb4fe[_0x7bc6('0x3b')]!==_0x7bc6('0x3c')){var _0x257ce2={};_0x257ce2[_0x5cb4fe[_0x7bc6('0x26')]]={'$like':'%'+_0x3aa7df[_0x7bc6('0x2e')]['filter']+'%'};return _0x257ce2;}})});}_0x5d43a4=_[_0x7bc6('0x3a')]({},_0x5d43a4,_0x3aa7df[_0x7bc6('0x3d')]);var _0x195328={'where':_0x5d43a4[_0x7bc6('0x38')]};return db[_0x7bc6('0x2a')]['count'](_0x195328)[_0x7bc6('0x23')](function(_0x18a6ee){_0x1c6795[_0x7bc6('0x1d')]=_0x18a6ee;if(_0x3aa7df[_0x7bc6('0x2e')]['includeAll']){_0x5d43a4[_0x7bc6('0x3e')]=[{'all':!![]}];}return db[_0x7bc6('0x2a')]['findAll'](_0x5d43a4);})['then'](function(_0xf63c00){_0x1c6795[_0x7bc6('0x3f')]=_0xf63c00;return _0x1c6795;})['then'](respondWithFilteredResult(_0x459184,_0x5d43a4))[_0x7bc6('0x40')](handleError(_0x459184,null));};exports[_0x7bc6('0x41')]=function(_0x5e5d4f,_0x75a334){var _0x58df1b={'raw':![],'where':{'id':_0x5e5d4f['params']['id']}},_0x12d901={};_0x12d901[_0x7bc6('0x2d')]=_[_0x7bc6('0x2f')](db['IntegrationReport']['rawAttributes']);_0x12d901[_0x7bc6('0x2e')]=_[_0x7bc6('0x2f')](_0x5e5d4f['query']);_0x12d901['filters']=_[_0x7bc6('0x31')](_0x12d901[_0x7bc6('0x2d')],_0x12d901[_0x7bc6('0x2e')]);_0x58df1b[_0x7bc6('0x33')]=_[_0x7bc6('0x31')](_0x12d901['model'],qs[_0x7bc6('0x32')](_0x5e5d4f[_0x7bc6('0x2e')][_0x7bc6('0x32')]));_0x58df1b[_0x7bc6('0x33')]=_0x58df1b[_0x7bc6('0x33')][_0x7bc6('0x34')]?_0x58df1b['attributes']:_0x12d901[_0x7bc6('0x2d')];if(_0x5e5d4f['query'][_0x7bc6('0x42')]){_0x58df1b[_0x7bc6('0x3e')]=[{'all':!![]}];}_0x58df1b=_[_0x7bc6('0x3a')]({},_0x58df1b,_0x5e5d4f[_0x7bc6('0x3d')]);return db['IntegrationReport'][_0x7bc6('0x43')](_0x58df1b)[_0x7bc6('0x23')](handleEntityNotFound(_0x75a334,null))[_0x7bc6('0x23')](respondWithResult(_0x75a334,null))[_0x7bc6('0x40')](handleError(_0x75a334,null));};exports['create']=function(_0x563b3b,_0x27bdfc){return db['IntegrationReport']['create'](_0x563b3b[_0x7bc6('0x44')],{})[_0x7bc6('0x23')](respondWithResult(_0x27bdfc,0xc9))[_0x7bc6('0x40')](handleError(_0x27bdfc,null));};exports[_0x7bc6('0x22')]=function(_0x2c8b0d,_0x11149e){if(_0x2c8b0d[_0x7bc6('0x44')]['id']){delete _0x2c8b0d[_0x7bc6('0x44')]['id'];}return db[_0x7bc6('0x2a')][_0x7bc6('0x43')]({'where':{'id':_0x2c8b0d[_0x7bc6('0x45')]['id']}})[_0x7bc6('0x23')](handleEntityNotFound(_0x11149e,null))['then'](saveUpdates(_0x2c8b0d[_0x7bc6('0x44')],null))[_0x7bc6('0x23')](respondWithResult(_0x11149e,null))[_0x7bc6('0x40')](handleError(_0x11149e,null));};exports[_0x7bc6('0x46')]=function(_0x455890,_0x544e98){return db[_0x7bc6('0x2a')]['find']({'where':{'id':_0x455890[_0x7bc6('0x45')]['id']}})[_0x7bc6('0x23')](handleEntityNotFound(_0x544e98,null))[_0x7bc6('0x23')](removeEntity(_0x544e98,null))[_0x7bc6('0x40')](handleError(_0x544e98,null));};exports[_0x7bc6('0x47')]=function(_0x2d9463,_0x4e99e5){return db[_0x7bc6('0x2a')][_0x7bc6('0x47')]()[_0x7bc6('0x23')](respondWithResult(_0x4e99e5,null))[_0x7bc6('0x40')](handleError(_0x4e99e5,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 3e4ad65..1b307df 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 _0x1337=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./integrationReport.attributes','exports','define','IntegrationReport','report_integration','lodash','util'];(function(_0x492cd9,_0x411d1c){var _0xfe102f=function(_0x2da0b9){while(--_0x2da0b9){_0x492cd9['push'](_0x492cd9['shift']());}};_0xfe102f(++_0x411d1c);}(_0x1337,0x1c0));var _0x7133=function(_0xd13d87,_0x3ca500){_0xd13d87=_0xd13d87-0x0;var _0x3a2004=_0x1337[_0xd13d87];return _0x3a2004;};'use strict';var _=require(_0x7133('0x0'));var util=require(_0x7133('0x1'));var logger=require(_0x7133('0x2'))(_0x7133('0x3'));var moment=require(_0x7133('0x4'));var BPromise=require(_0x7133('0x5'));var rp=require(_0x7133('0x6'));var fs=require('fs');var path=require(_0x7133('0x7'));var rimraf=require(_0x7133('0x8'));var config=require(_0x7133('0x9'));var attributes=require(_0x7133('0xa'));module[_0x7133('0xb')]=function(_0x285ac2,_0x1f14bd){return _0x285ac2[_0x7133('0xc')](_0x7133('0xd'),attributes,{'tableName':_0x7133('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3f43=['lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./integrationReport.attributes','exports','define','IntegrationReport','report_integration'];(function(_0x4f6112,_0x536938){var _0x2af37c=function(_0x4d35b4){while(--_0x4d35b4){_0x4f6112['push'](_0x4f6112['shift']());}};_0x2af37c(++_0x536938);}(_0x3f43,0x16c));var _0x33f4=function(_0x5121b5,_0x15e4e7){_0x5121b5=_0x5121b5-0x0;var _0xfbbfc1=_0x3f43[_0x5121b5];return _0xfbbfc1;};'use strict';var _=require(_0x33f4('0x0'));var util=require('util');var logger=require(_0x33f4('0x1'))(_0x33f4('0x2'));var moment=require(_0x33f4('0x3'));var BPromise=require(_0x33f4('0x4'));var rp=require(_0x33f4('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x33f4('0x6'));var config=require(_0x33f4('0x7'));var attributes=require(_0x33f4('0x8'));module[_0x33f4('0x9')]=function(_0x1a9f40,_0x2638ff){return _0x1a9f40[_0x33f4('0xa')](_0x33f4('0xb'),attributes,{'tableName':_0x33f4('0xc'),'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 35ec98d..bae533b 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 _0x187d=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch'];(function(_0x48064e,_0x151c47){var _0x549156=function(_0xd4d61c){while(--_0xd4d61c){_0x48064e['push'](_0x48064e['shift']());}};_0x549156(++_0x151c47);}(_0x187d,0x93));var _0xd187=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0x187d[_0x5c3c0b];return _0x52ecd2;};'use strict';var _=require(_0xd187('0x0'));var util=require('util');var moment=require(_0xd187('0x1'));var BPromise=require(_0xd187('0x2'));var rs=require(_0xd187('0x3'));var fs=require('fs');var Redis=require(_0xd187('0x4'));var db=require(_0xd187('0x5'))['db'];var utils=require(_0xd187('0x6'));var logger=require('../../config/logger')(_0xd187('0x7'));var config=require(_0xd187('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd187('0x9')][_0xd187('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x444a60,_0x1d3fe4,_0x28ce2f){return new BPromise(function(_0x2d6992,_0x358c45){return client[_0xd187('0xb')](_0x444a60,_0x28ce2f)['then'](function(_0x342539){logger[_0xd187('0xc')](_0xd187('0xd'),_0x1d3fe4,_0xd187('0xe'));logger[_0xd187('0xf')](_0xd187('0x10'),_0x1d3fe4,'request\x20sent',JSON[_0xd187('0x11')](_0x342539));if(_0x342539[_0xd187('0x12')]){if(_0x342539[_0xd187('0x12')]['code']===0x1f4){logger[_0xd187('0x12')](_0xd187('0xd'),_0x1d3fe4,_0x342539[_0xd187('0x12')]['message']);return _0x358c45(_0x342539[_0xd187('0x12')][_0xd187('0x13')]);}logger[_0xd187('0x12')](_0xd187('0xd'),_0x1d3fe4,_0x342539['error'][_0xd187('0x13')]);return _0x2d6992(_0x342539[_0xd187('0x12')][_0xd187('0x13')]);}else{logger[_0xd187('0xc')]('IntegrationReport,\x20%s,\x20%s',_0x1d3fe4,_0xd187('0xe'));_0x2d6992(_0x342539['result']['message']);}})[_0xd187('0x14')](function(_0x5a4986){logger['error'](_0xd187('0xd'),_0x1d3fe4,_0x5a4986);_0x358c45(_0x5a4986);});});} \ No newline at end of file +var _0x1967=['then','info','IntegrationReport,\x20%s,\x20%s','IntegrationReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0x4bc65f,_0x39ec43){var _0x44f85f=function(_0x175343){while(--_0x175343){_0x4bc65f['push'](_0x4bc65f['shift']());}};_0x44f85f(++_0x39ec43);}(_0x1967,0x173));var _0x7196=function(_0x438d96,_0x236924){_0x438d96=_0x438d96-0x0;var _0x34eb23=_0x1967[_0x438d96];return _0x34eb23;};'use strict';var _=require('lodash');var util=require(_0x7196('0x0'));var moment=require(_0x7196('0x1'));var BPromise=require(_0x7196('0x2'));var rs=require(_0x7196('0x3'));var fs=require('fs');var Redis=require(_0x7196('0x4'));var db=require(_0x7196('0x5'))['db'];var utils=require(_0x7196('0x6'));var logger=require(_0x7196('0x7'))(_0x7196('0x8'));var config=require(_0x7196('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7196('0xa')][_0x7196('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x194746,_0x40e0af,_0x266a6e){return new BPromise(function(_0xad78a,_0x510c72){return client[_0x7196('0xc')](_0x194746,_0x266a6e)[_0x7196('0xd')](function(_0x3f846e){logger[_0x7196('0xe')](_0x7196('0xf'),_0x40e0af,'request\x20sent');logger['debug'](_0x7196('0x10'),_0x40e0af,_0x7196('0x11'),JSON[_0x7196('0x12')](_0x3f846e));if(_0x3f846e[_0x7196('0x13')]){if(_0x3f846e[_0x7196('0x13')][_0x7196('0x14')]===0x1f4){logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x3f846e[_0x7196('0x13')][_0x7196('0x15')]);return _0x510c72(_0x3f846e[_0x7196('0x13')]['message']);}logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x3f846e[_0x7196('0x13')][_0x7196('0x15')]);return _0xad78a(_0x3f846e['error'][_0x7196('0x15')]);}else{logger['info'](_0x7196('0xf'),_0x40e0af,_0x7196('0x11'));_0xad78a(_0x3f846e[_0x7196('0x16')][_0x7196('0x15')]);}})[_0x7196('0x17')](function(_0x2e3e0e){logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x2e3e0e);_0x510c72(_0x2e3e0e);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 9ace23e..b062eee 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 _0x0d4d=['path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./interval.controller','isAuthenticated','index','get','getIntervals','post','create','/:id/sub_intervals','addInterval','addIntervals','put','/:id','update','destroy','multer','util'];(function(_0x2820c4,_0x31a325){var _0x5459cd=function(_0x577c3e){while(--_0x577c3e){_0x2820c4['push'](_0x2820c4['shift']());}};_0x5459cd(++_0x31a325);}(_0x0d4d,0x132));var _0xd0d4=function(_0x32587b,_0xf0c910){_0x32587b=_0x32587b-0x0;var _0x4315c7=_0x0d4d[_0x32587b];return _0x4315c7;};'use strict';var multer=require(_0xd0d4('0x0'));var util=require(_0xd0d4('0x1'));var path=require(_0xd0d4('0x2'));var timeout=require(_0xd0d4('0x3'));var express=require(_0xd0d4('0x4'));var router=express[_0xd0d4('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xd0d4('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd0d4('0x7'));var controller=require(_0xd0d4('0x8'));router['get']('/',auth[_0xd0d4('0x9')](),controller[_0xd0d4('0xa')]);router[_0xd0d4('0xb')]('/:id',auth[_0xd0d4('0x9')](),controller['show']);router[_0xd0d4('0xb')]('/:id/sub_intervals',auth[_0xd0d4('0x9')](),controller[_0xd0d4('0xc')]);router[_0xd0d4('0xd')]('/',auth['isAuthenticated'](),controller[_0xd0d4('0xe')]);router[_0xd0d4('0xd')](_0xd0d4('0xf'),auth[_0xd0d4('0x9')](),controller[_0xd0d4('0x10')]);router[_0xd0d4('0xd')]('/:id/sub_intervals/create_many',auth[_0xd0d4('0x9')](),controller[_0xd0d4('0x11')]);router[_0xd0d4('0x12')](_0xd0d4('0x13'),auth[_0xd0d4('0x9')](),controller[_0xd0d4('0x14')]);router['delete'](_0xd0d4('0x13'),auth[_0xd0d4('0x9')](),controller[_0xd0d4('0x15')]);module['exports']=router; \ No newline at end of file +var _0x2087=['delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','/:id','isAuthenticated','show','/:id/sub_intervals','getIntervals','create','post','addInterval','/:id/sub_intervals/create_many','addIntervals','put'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x2087,0xf3));var _0x7208=function(_0x5b6a9d,_0x2e6019){_0x5b6a9d=_0x5b6a9d-0x0;var _0x1dc718=_0x2087[_0x5b6a9d];return _0x1dc718;};'use strict';var multer=require(_0x7208('0x0'));var util=require(_0x7208('0x1'));var path=require(_0x7208('0x2'));var timeout=require(_0x7208('0x3'));var express=require('express');var router=express[_0x7208('0x4')]();var fs_extra=require(_0x7208('0x5'));var auth=require(_0x7208('0x6'));var interaction=require(_0x7208('0x7'));var config=require('../../config/environment');var controller=require('./interval.controller');router[_0x7208('0x8')]('/',auth['isAuthenticated'](),controller[_0x7208('0x9')]);router['get'](_0x7208('0xa'),auth[_0x7208('0xb')](),controller[_0x7208('0xc')]);router[_0x7208('0x8')](_0x7208('0xd'),auth[_0x7208('0xb')](),controller[_0x7208('0xe')]);router['post']('/',auth[_0x7208('0xb')](),controller[_0x7208('0xf')]);router[_0x7208('0x10')](_0x7208('0xd'),auth[_0x7208('0xb')](),controller[_0x7208('0x11')]);router['post'](_0x7208('0x12'),auth[_0x7208('0xb')](),controller[_0x7208('0x13')]);router[_0x7208('0x14')](_0x7208('0xa'),auth[_0x7208('0xb')](),controller['update']);router[_0x7208('0x15')](_0x7208('0xa'),auth[_0x7208('0xb')](),controller[_0x7208('0x16')]);module[_0x7208('0x17')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index f3fe9a4..53cd0d9 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 _0xd30a=['sequelize','STRING'];(function(_0x4771f7,_0x3cce17){var _0x386d6a=function(_0x2887ea){while(--_0x2887ea){_0x4771f7['push'](_0x4771f7['shift']());}};_0x386d6a(++_0x3cce17);}(_0xd30a,0x150));var _0xad30=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xd30a[_0x139a3c];return _0x2b375b;};'use strict';var Sequelize=require(_0xad30('0x0'));module['exports']={'name':{'type':Sequelize[_0xad30('0x1')]},'description':{'type':Sequelize[_0xad30('0x1')]},'interval':{'type':Sequelize[_0xad30('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0x92b1=['sequelize','STRING'];(function(_0xda90c,_0x1b67e0){var _0xedbd19=function(_0x44bae3){while(--_0x44bae3){_0xda90c['push'](_0xda90c['shift']());}};_0xedbd19(++_0x1b67e0);}(_0x92b1,0x100));var _0x192b=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x92b1[_0x3b380d];return _0x54502b;};'use strict';var Sequelize=require(_0x192b('0x0'));module['exports']={'name':{'type':Sequelize[_0x192b('0x1')]},'description':{'type':Sequelize[_0x192b('0x1')]},'interval':{'type':Sequelize[_0x192b('0x1')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index 677acde..f411cb8 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 _0x6015=['options','include','findAll','rows','params','includeAll','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addInterval','getIntervals','findOne','sort','hasOwnProperty','transaction','IntervalId','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','get','Intervals','UserProfileResource','destroy','end','error','stack','name','send','map','Interval','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','where','pick','filter','merge','VIRTUAL'];(function(_0x173e4a,_0x3e9626){var _0x5a834d=function(_0x6f505c){while(--_0x6f505c){_0x173e4a['push'](_0x173e4a['shift']());}};_0x5a834d(++_0x3e9626);}(_0x6015,0x74));var _0x5601=function(_0x51143a,_0x8cdddd){_0x51143a=_0x51143a-0x0;var _0x5a5b7e=_0x6015[_0x51143a];return _0x5a5b7e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x5601('0x0'));var jsonpatch=require(_0x5601('0x1'));var rp=require(_0x5601('0x2'));var moment=require(_0x5601('0x3'));var BPromise=require(_0x5601('0x4'));var Mustache=require(_0x5601('0x5'));var util=require(_0x5601('0x6'));var path=require(_0x5601('0x7'));var sox=require('sox');var csv=require(_0x5601('0x8'));var ejs=require(_0x5601('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5601('0xa'));var squel=require(_0x5601('0xb'));var crypto=require(_0x5601('0xc'));var jsforce=require(_0x5601('0xd'));var deskjs=require(_0x5601('0xe'));var toCsv=require(_0x5601('0x8'));var querystring=require(_0x5601('0xf'));var Papa=require(_0x5601('0x10'));var Redis=require(_0x5601('0x11'));var authService=require(_0x5601('0x12'));var qs=require(_0x5601('0x13'));var as=require(_0x5601('0x14'));var hardwareService=require(_0x5601('0x15'));var logger=require(_0x5601('0x16'))('api');var utils=require(_0x5601('0x17'));var config=require(_0x5601('0x18'));var licenseUtil=require(_0x5601('0x19'));var db=require(_0x5601('0x1a'))['db'];var extensions=require(_0x5601('0x1b'));function respondWithStatusCode(_0x102858,_0x171b1c){_0x171b1c=_0x171b1c||0xcc;return function(_0x57e20f){if(_0x57e20f){return _0x102858['sendStatus'](_0x171b1c);}return _0x102858[_0x5601('0x1c')](_0x171b1c)['end']();};}function respondWithResult(_0x5751fc,_0x56260e){_0x56260e=_0x56260e||0xc8;return function(_0x1db7d1){if(_0x1db7d1){return _0x5751fc[_0x5601('0x1c')](_0x56260e)[_0x5601('0x1d')](_0x1db7d1);}};}function respondWithFilteredResult(_0x1cf936,_0xb543b7){return function(_0x1dfe0d){if(_0x1dfe0d){var _0x1ae771=typeof _0xb543b7[_0x5601('0x1e')]===_0x5601('0x1f')&&typeof _0xb543b7['limit']==='undefined';var _0x1834a5=_0x1dfe0d[_0x5601('0x20')];var _0x540016=_0x1ae771?0x0:_0xb543b7[_0x5601('0x1e')];var _0x1433a8=_0x1ae771?_0x1dfe0d[_0x5601('0x20')]:_0xb543b7[_0x5601('0x1e')]+_0xb543b7[_0x5601('0x21')];var _0x1e0068;if(_0x1433a8>=_0x1834a5){_0x1433a8=_0x1834a5;_0x1e0068=0xc8;}else{_0x1e0068=0xce;}_0x1cf936['status'](_0x1e0068);return _0x1cf936[_0x5601('0x22')](_0x5601('0x23'),_0x540016+'-'+_0x1433a8+'/'+_0x1834a5)[_0x5601('0x1d')](_0x1dfe0d);}return null;};}function patchUpdates(_0x1b0d78){return function(_0x529c06){try{jsonpatch[_0x5601('0x24')](_0x529c06,_0x1b0d78,!![]);}catch(_0x34613f){return BPromise[_0x5601('0x25')](_0x34613f);}return _0x529c06[_0x5601('0x26')]();};}function saveUpdates(_0x5983ce,_0x4e4636){return function(_0x2aa170){if(_0x2aa170){return _0x2aa170['update'](_0x5983ce)[_0x5601('0x27')](function(_0x3f526e){return _0x3f526e;});}return null;};}function removeEntity(_0x490111,_0x2c2487){return function(_0x3b2fc3){if(_0x3b2fc3){return _0x3b2fc3['destroy']()['then'](function(){var _0x5e47cc=_0x3b2fc3[_0x5601('0x28')]({'plain':!![]});var _0x4a3372=_0x5601('0x29');return db[_0x5601('0x2a')][_0x5601('0x2b')]({'where':{'type':_0x4a3372,'resourceId':_0x5e47cc['id']}})['then'](function(){return _0x3b2fc3;});})['then'](function(){_0x490111[_0x5601('0x1c')](0xcc)[_0x5601('0x2c')]();});}};}function handleEntityNotFound(_0x59f152,_0x209887){return function(_0x36ba76){if(!_0x36ba76){_0x59f152['sendStatus'](0x194);}return _0x36ba76;};}function handleError(_0x430ba8,_0x6a18b2){_0x6a18b2=_0x6a18b2||0x1f4;return function(_0xf4bb65){logger[_0x5601('0x2d')](_0xf4bb65[_0x5601('0x2e')]);if(_0xf4bb65[_0x5601('0x2f')]){delete _0xf4bb65[_0x5601('0x2f')];}_0x430ba8['status'](_0x6a18b2)[_0x5601('0x30')](_0xf4bb65);};}exports['index']=function(_0x337055,_0x234b34){var _0x45f857={},_0x3e064b={},_0x307b6e={'count':0x0,'rows':[]};var _0x3bf639=_[_0x5601('0x31')](db[_0x5601('0x32')][_0x5601('0x33')],function(_0x441055){return{'name':_0x441055[_0x5601('0x34')],'type':_0x441055[_0x5601('0x35')][_0x5601('0x36')]};});_0x3e064b[_0x5601('0x37')]=_[_0x5601('0x31')](_0x3bf639,'name');_0x3e064b[_0x5601('0x38')]=_[_0x5601('0x39')](_0x337055[_0x5601('0x38')]);_0x3e064b[_0x5601('0x3a')]=_[_0x5601('0x3b')](_0x3e064b['model'],_0x3e064b[_0x5601('0x38')]);_0x45f857['attributes']=_[_0x5601('0x3b')](_0x3e064b['model'],qs[_0x5601('0x3c')](_0x337055[_0x5601('0x38')][_0x5601('0x3c')]));_0x45f857[_0x5601('0x3d')]=_0x45f857[_0x5601('0x3d')][_0x5601('0x3e')]?_0x45f857[_0x5601('0x3d')]:_0x3e064b[_0x5601('0x37')];if(!_0x337055[_0x5601('0x38')]['hasOwnProperty'](_0x5601('0x3f'))){_0x45f857[_0x5601('0x21')]=qs['limit'](_0x337055[_0x5601('0x38')][_0x5601('0x21')]);_0x45f857[_0x5601('0x1e')]=qs[_0x5601('0x1e')](_0x337055[_0x5601('0x38')][_0x5601('0x1e')]);}_0x45f857[_0x5601('0x40')]=qs['sort'](_0x337055[_0x5601('0x38')]['sort']);_0x45f857[_0x5601('0x41')]=qs[_0x5601('0x3a')](_[_0x5601('0x42')](_0x337055[_0x5601('0x38')],_0x3e064b['filters']),_0x3bf639);if(_0x337055[_0x5601('0x38')][_0x5601('0x43')]){_0x45f857[_0x5601('0x41')]=_[_0x5601('0x44')](_0x45f857[_0x5601('0x41')],{'$or':_['map'](_0x3bf639,function(_0x11741b){if(_0x11741b[_0x5601('0x35')]!==_0x5601('0x45')){var _0x1b2038={};_0x1b2038[_0x11741b[_0x5601('0x2f')]]={'$like':'%'+_0x337055['query']['filter']+'%'};return _0x1b2038;}})});}_0x45f857=_['merge']({},_0x45f857,_0x337055[_0x5601('0x46')]);var _0x12f8aa={'where':_0x45f857[_0x5601('0x41')]};return db['Interval'][_0x5601('0x20')](_0x12f8aa)['then'](function(_0x1dfe6b){_0x307b6e[_0x5601('0x20')]=_0x1dfe6b;if(_0x337055['query']['includeAll']){_0x45f857[_0x5601('0x47')]=[{'all':!![]}];}return db['Interval'][_0x5601('0x48')](_0x45f857);})[_0x5601('0x27')](function(_0x44d295){_0x307b6e[_0x5601('0x49')]=_0x44d295;return _0x307b6e;})['then'](respondWithFilteredResult(_0x234b34,_0x45f857))['catch'](handleError(_0x234b34,null));};exports['show']=function(_0x468e82,_0x261211){var _0x7a652a={'raw':!![],'where':{'id':_0x468e82[_0x5601('0x4a')]['id']}},_0x2d218d={};_0x2d218d[_0x5601('0x37')]=_[_0x5601('0x39')](db[_0x5601('0x32')][_0x5601('0x33')]);_0x2d218d[_0x5601('0x38')]=_[_0x5601('0x39')](_0x468e82[_0x5601('0x38')]);_0x2d218d['filters']=_[_0x5601('0x3b')](_0x2d218d[_0x5601('0x37')],_0x2d218d[_0x5601('0x38')]);_0x7a652a[_0x5601('0x3d')]=_[_0x5601('0x3b')](_0x2d218d['model'],qs['fields'](_0x468e82[_0x5601('0x38')][_0x5601('0x3c')]));_0x7a652a['attributes']=_0x7a652a[_0x5601('0x3d')][_0x5601('0x3e')]?_0x7a652a['attributes']:_0x2d218d[_0x5601('0x37')];if(_0x468e82[_0x5601('0x38')][_0x5601('0x4b')]){_0x7a652a[_0x5601('0x47')]=[{'all':!![]}];}_0x7a652a=_[_0x5601('0x44')]({},_0x7a652a,_0x468e82['options']);return db[_0x5601('0x32')][_0x5601('0x4c')](_0x7a652a)[_0x5601('0x27')](handleEntityNotFound(_0x261211,null))[_0x5601('0x27')](respondWithResult(_0x261211,null))[_0x5601('0x4d')](handleError(_0x261211,null));};exports[_0x5601('0x4e')]=function(_0x15c9f2,_0x2479c2){return db[_0x5601('0x32')][_0x5601('0x4e')](_0x15c9f2[_0x5601('0x4f')],{})[_0x5601('0x27')](function(_0x3cbad8){var _0x32981c=_0x15c9f2[_0x5601('0x50')]['get']({'plain':!![]});if(!_0x32981c)throw new Error(_0x5601('0x51'));if(_0x32981c['role']===_0x5601('0x50')){var _0x3ba6b1=_0x3cbad8[_0x5601('0x28')]({'plain':!![]});var _0x55c88c='Intervals';return db[_0x5601('0x52')][_0x5601('0x4c')]({'where':{'name':_0x55c88c,'userProfileId':_0x32981c[_0x5601('0x53')]},'raw':!![]})[_0x5601('0x27')](function(_0x5d511c){if(_0x5d511c&&_0x5d511c[_0x5601('0x54')]===0x0){return db[_0x5601('0x2a')]['create']({'name':_0x3ba6b1['name'],'resourceId':_0x3ba6b1['id'],'type':_0x5d511c[_0x5601('0x2f')],'sectionId':_0x5d511c['id']},{})['then'](function(){return _0x3cbad8;});}else{return _0x3cbad8;}})[_0x5601('0x4d')](function(_0x19f737){logger[_0x5601('0x2d')](_0x5601('0x55'),_0x19f737);throw _0x19f737;});}return _0x3cbad8;})['then'](respondWithResult(_0x2479c2,0xc9))['catch'](handleError(_0x2479c2,null));};exports['update']=function(_0x19d418,_0x3bad94){if(_0x19d418[_0x5601('0x4f')]['id']){delete _0x19d418[_0x5601('0x4f')]['id'];}return db['Interval'][_0x5601('0x4c')]({'where':{'id':_0x19d418[_0x5601('0x4a')]['id']}})[_0x5601('0x27')](handleEntityNotFound(_0x3bad94,null))[_0x5601('0x27')](saveUpdates(_0x19d418[_0x5601('0x4f')],null))['then'](respondWithResult(_0x3bad94,null))['catch'](handleError(_0x3bad94,null));};exports['destroy']=function(_0x581b8c,_0x387dd7){return db[_0x5601('0x32')][_0x5601('0x4c')]({'where':{'id':_0x581b8c[_0x5601('0x4a')]['id']}})[_0x5601('0x27')](handleEntityNotFound(_0x387dd7,null))[_0x5601('0x27')](removeEntity(_0x387dd7,null))[_0x5601('0x4d')](handleError(_0x387dd7,null));};exports[_0x5601('0x56')]=function(_0x681e87,_0x34cdc3,_0x5d3ce2){if(_0x681e87[_0x5601('0x4f')]['id']){delete _0x681e87[_0x5601('0x4f')]['id'];}return db[_0x5601('0x32')]['find']({'where':{'id':_0x681e87[_0x5601('0x4a')]['id']}})[_0x5601('0x27')](handleEntityNotFound(_0x34cdc3,null))['then'](function(_0x4b5b31){if(_0x4b5b31){_0x681e87[_0x5601('0x4f')]['IntervalId']=_0x4b5b31['id'];return db[_0x5601('0x32')][_0x5601('0x4e')](_0x681e87[_0x5601('0x4f')]);}})[_0x5601('0x27')](respondWithResult(_0x34cdc3,null))[_0x5601('0x4d')](handleError(_0x34cdc3,null));};exports[_0x5601('0x57')]=function(_0x599a3b,_0x30f92a,_0xdb4a64){var _0x3064e8={};var _0x38221e={};var _0x1d5ad5;var _0x10f0dd;return db[_0x5601('0x32')][_0x5601('0x58')]({'where':{'id':_0x599a3b[_0x5601('0x4a')]['id']}})[_0x5601('0x27')](handleEntityNotFound(_0x30f92a,null))[_0x5601('0x27')](function(_0x1612a2){if(_0x1612a2){_0x1d5ad5=_0x1612a2;_0x38221e[_0x5601('0x37')]=_[_0x5601('0x39')](db[_0x5601('0x32')][_0x5601('0x33')]);_0x38221e[_0x5601('0x38')]=_[_0x5601('0x39')](_0x599a3b[_0x5601('0x38')]);_0x38221e[_0x5601('0x3a')]=_[_0x5601('0x3b')](_0x38221e[_0x5601('0x37')],_0x38221e['query']);_0x3064e8[_0x5601('0x3d')]=_['intersection'](_0x38221e[_0x5601('0x37')],qs[_0x5601('0x3c')](_0x599a3b[_0x5601('0x38')]['fields']));_0x3064e8[_0x5601('0x3d')]=_0x3064e8[_0x5601('0x3d')][_0x5601('0x3e')]?_0x3064e8[_0x5601('0x3d')]:_0x38221e['model'];_0x3064e8[_0x5601('0x40')]=qs['sort'](_0x599a3b['query'][_0x5601('0x59')]);_0x3064e8[_0x5601('0x41')]=qs[_0x5601('0x3a')](_['pick'](_0x599a3b['query'],_0x38221e['filters']));if(_0x599a3b[_0x5601('0x38')]['filter']){_0x3064e8['where']=_[_0x5601('0x44')](_0x3064e8[_0x5601('0x41')],{'$or':_[_0x5601('0x31')](_0x3064e8[_0x5601('0x3d')],function(_0x36ec54){var _0x1ad1a4={};_0x1ad1a4[_0x36ec54]={'$like':'%'+_0x599a3b[_0x5601('0x38')][_0x5601('0x43')]+'%'};return _0x1ad1a4;})});}_0x3064e8=_[_0x5601('0x44')]({},_0x3064e8,_0x599a3b[_0x5601('0x46')]);return _0x1d5ad5['getIntervals'](_0x3064e8);}})[_0x5601('0x27')](function(_0x389b99){if(_0x389b99){_0x10f0dd=_0x389b99[_0x5601('0x3e')];if(!_0x599a3b[_0x5601('0x38')][_0x5601('0x5a')](_0x5601('0x3f'))){_0x3064e8[_0x5601('0x21')]=qs[_0x5601('0x21')](_0x599a3b['query'][_0x5601('0x21')]);_0x3064e8[_0x5601('0x1e')]=qs[_0x5601('0x1e')](_0x599a3b[_0x5601('0x38')]['offset']);}return _0x1d5ad5['getIntervals'](_0x3064e8);}})[_0x5601('0x27')](function(_0x243068){if(_0x243068){return _0x243068?{'count':_0x10f0dd,'rows':_0x243068}:null;}})['then'](respondWithResult(_0x30f92a,null))[_0x5601('0x4d')](handleError(_0x30f92a,null));};exports['addIntervals']=function(_0x4d20f7,_0x3f2915,_0x3cbfaf){return db[_0x5601('0x32')][_0x5601('0x58')]({'where':{'id':_0x4d20f7[_0x5601('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3f2915,null))[_0x5601('0x27')](function(_0xbe0045){if(_0xbe0045){return db['sequelize'][_0x5601('0x5b')](function(_0x48759b){return db[_0x5601('0x32')][_0x5601('0x2b')]({'where':{'IntervalId':_0x4d20f7[_0x5601('0x4a')]['id']},'transaction':_0x48759b})[_0x5601('0x27')](function(_0x330959){var _0x3bb810=_['map'](_0x4d20f7['body'],function(_0x56116c){delete _0x56116c['id'];_0x56116c[_0x5601('0x5c')]=_0x4d20f7[_0x5601('0x4a')]['id'];return _0x56116c;});return db[_0x5601('0x32')]['bulkCreate'](_0x3bb810,{'transaction':_0x48759b});});})[_0x5601('0x27')](function(){return db['Interval']['findAll']({'where':{'IntervalId':_0x4d20f7[_0x5601('0x4a')]['id']}});});}})[_0x5601('0x27')](respondWithResult(_0x3f2915,null))[_0x5601('0x4d')](handleError(_0x3f2915,null));}; \ No newline at end of file +var _0xbaa6=['destroy','Intervals','UserProfileResource','error','stack','name','send','index','Interval','rawAttributes','fieldName','type','key','model','map','query','attributes','intersection','fields','length','nolimit','sort','where','filters','pick','filter','findAll','catch','show','params','keys','includeAll','include','merge','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addInterval','getIntervals','findOne','order','hasOwnProperty','addIntervals','transaction','IntervalId','bulkCreate','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then'];(function(_0x7e8765,_0x4c0c37){var _0x579621=function(_0x280a0c){while(--_0x280a0c){_0x7e8765['push'](_0x7e8765['shift']());}};_0x579621(++_0x4c0c37);}(_0xbaa6,0x1ae));var _0x6baa=function(_0x563af1,_0x37924c){_0x563af1=_0x563af1-0x0;var _0x58fccb=_0xbaa6[_0x563af1];return _0x58fccb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6baa('0x0'));var zipdir=require(_0x6baa('0x1'));var jsonpatch=require(_0x6baa('0x2'));var rp=require(_0x6baa('0x3'));var moment=require(_0x6baa('0x4'));var BPromise=require(_0x6baa('0x5'));var Mustache=require(_0x6baa('0x6'));var util=require(_0x6baa('0x7'));var path=require(_0x6baa('0x8'));var sox=require(_0x6baa('0x9'));var csv=require(_0x6baa('0xa'));var ejs=require(_0x6baa('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6baa('0xc'));var squel=require(_0x6baa('0xd'));var crypto=require(_0x6baa('0xe'));var jsforce=require(_0x6baa('0xf'));var deskjs=require(_0x6baa('0x10'));var toCsv=require(_0x6baa('0xa'));var querystring=require('querystring');var Papa=require(_0x6baa('0x11'));var Redis=require(_0x6baa('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x6baa('0x13'));var as=require(_0x6baa('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6baa('0x15'))(_0x6baa('0x16'));var utils=require(_0x6baa('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x6baa('0x18'));var db=require(_0x6baa('0x19'))['db'];var extensions=require('../../components/extensions/rewrite');function respondWithStatusCode(_0x26454e,_0x44bae1){_0x44bae1=_0x44bae1||0xcc;return function(_0x3e9587){if(_0x3e9587){return _0x26454e[_0x6baa('0x1a')](_0x44bae1);}return _0x26454e[_0x6baa('0x1b')](_0x44bae1)[_0x6baa('0x1c')]();};}function respondWithResult(_0x160d6d,_0x3296bb){_0x3296bb=_0x3296bb||0xc8;return function(_0x5ac8dc){if(_0x5ac8dc){return _0x160d6d['status'](_0x3296bb)['json'](_0x5ac8dc);}};}function respondWithFilteredResult(_0xa4eeb5,_0x130709){return function(_0x4c24be){if(_0x4c24be){var _0x369eed=typeof _0x130709[_0x6baa('0x1d')]===_0x6baa('0x1e')&&typeof _0x130709[_0x6baa('0x1f')]===_0x6baa('0x1e');var _0x7d4d50=_0x4c24be[_0x6baa('0x20')];var _0x212a82=_0x369eed?0x0:_0x130709[_0x6baa('0x1d')];var _0x284dd3=_0x369eed?_0x4c24be[_0x6baa('0x20')]:_0x130709['offset']+_0x130709[_0x6baa('0x1f')];var _0x212532;if(_0x284dd3>=_0x7d4d50){_0x284dd3=_0x7d4d50;_0x212532=0xc8;}else{_0x212532=0xce;}_0xa4eeb5[_0x6baa('0x1b')](_0x212532);return _0xa4eeb5[_0x6baa('0x21')](_0x6baa('0x22'),_0x212a82+'-'+_0x284dd3+'/'+_0x7d4d50)[_0x6baa('0x23')](_0x4c24be);}return null;};}function patchUpdates(_0x48f2d0){return function(_0x382152){try{jsonpatch['apply'](_0x382152,_0x48f2d0,!![]);}catch(_0x4c4695){return BPromise[_0x6baa('0x24')](_0x4c4695);}return _0x382152[_0x6baa('0x25')]();};}function saveUpdates(_0x4c5c8a,_0x1cd5d9){return function(_0x55baf7){if(_0x55baf7){return _0x55baf7[_0x6baa('0x26')](_0x4c5c8a)[_0x6baa('0x27')](function(_0x468140){return _0x468140;});}return null;};}function removeEntity(_0x2c9362,_0x3524e8){return function(_0x5a1088){if(_0x5a1088){return _0x5a1088[_0x6baa('0x28')]()[_0x6baa('0x27')](function(){var _0x164ff6=_0x5a1088['get']({'plain':!![]});var _0x2829df=_0x6baa('0x29');return db[_0x6baa('0x2a')][_0x6baa('0x28')]({'where':{'type':_0x2829df,'resourceId':_0x164ff6['id']}})[_0x6baa('0x27')](function(){return _0x5a1088;});})[_0x6baa('0x27')](function(){_0x2c9362[_0x6baa('0x1b')](0xcc)[_0x6baa('0x1c')]();});}};}function handleEntityNotFound(_0x492453,_0x54101e){return function(_0x49dda0){if(!_0x49dda0){_0x492453['sendStatus'](0x194);}return _0x49dda0;};}function handleError(_0x56dafb,_0x7b3f49){_0x7b3f49=_0x7b3f49||0x1f4;return function(_0x188941){logger[_0x6baa('0x2b')](_0x188941[_0x6baa('0x2c')]);if(_0x188941[_0x6baa('0x2d')]){delete _0x188941['name'];}_0x56dafb['status'](_0x7b3f49)[_0x6baa('0x2e')](_0x188941);};}exports[_0x6baa('0x2f')]=function(_0xc36e73,_0x55a246){var _0x2dd55c={},_0x174bc0={},_0x3521af={'count':0x0,'rows':[]};var _0x307a0d=_['map'](db[_0x6baa('0x30')][_0x6baa('0x31')],function(_0x545ff0){return{'name':_0x545ff0[_0x6baa('0x32')],'type':_0x545ff0[_0x6baa('0x33')][_0x6baa('0x34')]};});_0x174bc0[_0x6baa('0x35')]=_[_0x6baa('0x36')](_0x307a0d,'name');_0x174bc0[_0x6baa('0x37')]=_['keys'](_0xc36e73[_0x6baa('0x37')]);_0x174bc0['filters']=_['intersection'](_0x174bc0[_0x6baa('0x35')],_0x174bc0[_0x6baa('0x37')]);_0x2dd55c[_0x6baa('0x38')]=_[_0x6baa('0x39')](_0x174bc0[_0x6baa('0x35')],qs['fields'](_0xc36e73[_0x6baa('0x37')][_0x6baa('0x3a')]));_0x2dd55c[_0x6baa('0x38')]=_0x2dd55c[_0x6baa('0x38')][_0x6baa('0x3b')]?_0x2dd55c[_0x6baa('0x38')]:_0x174bc0[_0x6baa('0x35')];if(!_0xc36e73[_0x6baa('0x37')]['hasOwnProperty'](_0x6baa('0x3c'))){_0x2dd55c[_0x6baa('0x1f')]=qs[_0x6baa('0x1f')](_0xc36e73['query']['limit']);_0x2dd55c[_0x6baa('0x1d')]=qs[_0x6baa('0x1d')](_0xc36e73[_0x6baa('0x37')][_0x6baa('0x1d')]);}_0x2dd55c['order']=qs[_0x6baa('0x3d')](_0xc36e73['query']['sort']);_0x2dd55c[_0x6baa('0x3e')]=qs[_0x6baa('0x3f')](_[_0x6baa('0x40')](_0xc36e73[_0x6baa('0x37')],_0x174bc0['filters']),_0x307a0d);if(_0xc36e73[_0x6baa('0x37')][_0x6baa('0x41')]){_0x2dd55c[_0x6baa('0x3e')]=_['merge'](_0x2dd55c[_0x6baa('0x3e')],{'$or':_['map'](_0x307a0d,function(_0x23c23f){if(_0x23c23f[_0x6baa('0x33')]!=='VIRTUAL'){var _0x34d711={};_0x34d711[_0x23c23f[_0x6baa('0x2d')]]={'$like':'%'+_0xc36e73[_0x6baa('0x37')][_0x6baa('0x41')]+'%'};return _0x34d711;}})});}_0x2dd55c=_['merge']({},_0x2dd55c,_0xc36e73['options']);var _0x3738ca={'where':_0x2dd55c[_0x6baa('0x3e')]};return db[_0x6baa('0x30')][_0x6baa('0x20')](_0x3738ca)[_0x6baa('0x27')](function(_0x2b9b7c){_0x3521af[_0x6baa('0x20')]=_0x2b9b7c;if(_0xc36e73['query']['includeAll']){_0x2dd55c['include']=[{'all':!![]}];}return db[_0x6baa('0x30')][_0x6baa('0x42')](_0x2dd55c);})[_0x6baa('0x27')](function(_0x4499e2){_0x3521af['rows']=_0x4499e2;return _0x3521af;})[_0x6baa('0x27')](respondWithFilteredResult(_0x55a246,_0x2dd55c))[_0x6baa('0x43')](handleError(_0x55a246,null));};exports[_0x6baa('0x44')]=function(_0x4d291b,_0x1a89df){var _0x1ca3cc={'raw':!![],'where':{'id':_0x4d291b[_0x6baa('0x45')]['id']}},_0x1ddf11={};_0x1ddf11[_0x6baa('0x35')]=_[_0x6baa('0x46')](db[_0x6baa('0x30')][_0x6baa('0x31')]);_0x1ddf11[_0x6baa('0x37')]=_[_0x6baa('0x46')](_0x4d291b[_0x6baa('0x37')]);_0x1ddf11[_0x6baa('0x3f')]=_[_0x6baa('0x39')](_0x1ddf11[_0x6baa('0x35')],_0x1ddf11[_0x6baa('0x37')]);_0x1ca3cc[_0x6baa('0x38')]=_[_0x6baa('0x39')](_0x1ddf11[_0x6baa('0x35')],qs[_0x6baa('0x3a')](_0x4d291b[_0x6baa('0x37')][_0x6baa('0x3a')]));_0x1ca3cc['attributes']=_0x1ca3cc[_0x6baa('0x38')][_0x6baa('0x3b')]?_0x1ca3cc[_0x6baa('0x38')]:_0x1ddf11[_0x6baa('0x35')];if(_0x4d291b['query'][_0x6baa('0x47')]){_0x1ca3cc[_0x6baa('0x48')]=[{'all':!![]}];}_0x1ca3cc=_[_0x6baa('0x49')]({},_0x1ca3cc,_0x4d291b[_0x6baa('0x4a')]);return db['Interval'][_0x6baa('0x4b')](_0x1ca3cc)['then'](handleEntityNotFound(_0x1a89df,null))[_0x6baa('0x27')](respondWithResult(_0x1a89df,null))[_0x6baa('0x43')](handleError(_0x1a89df,null));};exports[_0x6baa('0x4c')]=function(_0x25f7c4,_0x226c50){return db[_0x6baa('0x30')]['create'](_0x25f7c4[_0x6baa('0x4d')],{})[_0x6baa('0x27')](function(_0x1cdd8f){var _0x40cabc=_0x25f7c4[_0x6baa('0x4e')]['get']({'plain':!![]});if(!_0x40cabc)throw new Error(_0x6baa('0x4f'));if(_0x40cabc[_0x6baa('0x50')]===_0x6baa('0x4e')){var _0x58079b=_0x1cdd8f[_0x6baa('0x51')]({'plain':!![]});var _0x49b38c=_0x6baa('0x29');return db['UserProfileSection'][_0x6baa('0x4b')]({'where':{'name':_0x49b38c,'userProfileId':_0x40cabc[_0x6baa('0x52')]},'raw':!![]})[_0x6baa('0x27')](function(_0x2779bd){if(_0x2779bd&&_0x2779bd[_0x6baa('0x53')]===0x0){return db[_0x6baa('0x2a')][_0x6baa('0x4c')]({'name':_0x58079b[_0x6baa('0x2d')],'resourceId':_0x58079b['id'],'type':_0x2779bd['name'],'sectionId':_0x2779bd['id']},{})['then'](function(){return _0x1cdd8f;});}else{return _0x1cdd8f;}})[_0x6baa('0x43')](function(_0x4edc27){logger[_0x6baa('0x2b')](_0x6baa('0x54'),_0x4edc27);throw _0x4edc27;});}return _0x1cdd8f;})['then'](respondWithResult(_0x226c50,0xc9))['catch'](handleError(_0x226c50,null));};exports[_0x6baa('0x26')]=function(_0x12aa93,_0x4e2666){if(_0x12aa93[_0x6baa('0x4d')]['id']){delete _0x12aa93['body']['id'];}return db[_0x6baa('0x30')][_0x6baa('0x4b')]({'where':{'id':_0x12aa93[_0x6baa('0x45')]['id']}})['then'](handleEntityNotFound(_0x4e2666,null))[_0x6baa('0x27')](saveUpdates(_0x12aa93[_0x6baa('0x4d')],null))[_0x6baa('0x27')](respondWithResult(_0x4e2666,null))[_0x6baa('0x43')](handleError(_0x4e2666,null));};exports[_0x6baa('0x28')]=function(_0x524d82,_0xc2240a){return db[_0x6baa('0x30')]['find']({'where':{'id':_0x524d82[_0x6baa('0x45')]['id']}})[_0x6baa('0x27')](handleEntityNotFound(_0xc2240a,null))[_0x6baa('0x27')](removeEntity(_0xc2240a,null))['catch'](handleError(_0xc2240a,null));};exports[_0x6baa('0x55')]=function(_0x3522f4,_0x3f055d,_0xee6c26){if(_0x3522f4[_0x6baa('0x4d')]['id']){delete _0x3522f4[_0x6baa('0x4d')]['id'];}return db['Interval'][_0x6baa('0x4b')]({'where':{'id':_0x3522f4['params']['id']}})[_0x6baa('0x27')](handleEntityNotFound(_0x3f055d,null))[_0x6baa('0x27')](function(_0x2cd02e){if(_0x2cd02e){_0x3522f4[_0x6baa('0x4d')]['IntervalId']=_0x2cd02e['id'];return db[_0x6baa('0x30')][_0x6baa('0x4c')](_0x3522f4[_0x6baa('0x4d')]);}})[_0x6baa('0x27')](respondWithResult(_0x3f055d,null))[_0x6baa('0x43')](handleError(_0x3f055d,null));};exports[_0x6baa('0x56')]=function(_0x403593,_0x26aee6,_0x228641){var _0x1cf2a3={};var _0x1deede={};var _0x4d3377;var _0xb9cfd8;return db[_0x6baa('0x30')][_0x6baa('0x57')]({'where':{'id':_0x403593[_0x6baa('0x45')]['id']}})[_0x6baa('0x27')](handleEntityNotFound(_0x26aee6,null))[_0x6baa('0x27')](function(_0x5763b7){if(_0x5763b7){_0x4d3377=_0x5763b7;_0x1deede[_0x6baa('0x35')]=_[_0x6baa('0x46')](db['Interval'][_0x6baa('0x31')]);_0x1deede[_0x6baa('0x37')]=_['keys'](_0x403593[_0x6baa('0x37')]);_0x1deede[_0x6baa('0x3f')]=_[_0x6baa('0x39')](_0x1deede[_0x6baa('0x35')],_0x1deede['query']);_0x1cf2a3['attributes']=_[_0x6baa('0x39')](_0x1deede[_0x6baa('0x35')],qs[_0x6baa('0x3a')](_0x403593[_0x6baa('0x37')][_0x6baa('0x3a')]));_0x1cf2a3[_0x6baa('0x38')]=_0x1cf2a3[_0x6baa('0x38')]['length']?_0x1cf2a3[_0x6baa('0x38')]:_0x1deede[_0x6baa('0x35')];_0x1cf2a3[_0x6baa('0x58')]=qs[_0x6baa('0x3d')](_0x403593[_0x6baa('0x37')]['sort']);_0x1cf2a3['where']=qs[_0x6baa('0x3f')](_[_0x6baa('0x40')](_0x403593[_0x6baa('0x37')],_0x1deede[_0x6baa('0x3f')]));if(_0x403593[_0x6baa('0x37')]['filter']){_0x1cf2a3['where']=_[_0x6baa('0x49')](_0x1cf2a3['where'],{'$or':_[_0x6baa('0x36')](_0x1cf2a3[_0x6baa('0x38')],function(_0x1ef847){var _0x5badde={};_0x5badde[_0x1ef847]={'$like':'%'+_0x403593[_0x6baa('0x37')][_0x6baa('0x41')]+'%'};return _0x5badde;})});}_0x1cf2a3=_['merge']({},_0x1cf2a3,_0x403593[_0x6baa('0x4a')]);return _0x4d3377[_0x6baa('0x56')](_0x1cf2a3);}})[_0x6baa('0x27')](function(_0x3eeb2e){if(_0x3eeb2e){_0xb9cfd8=_0x3eeb2e[_0x6baa('0x3b')];if(!_0x403593[_0x6baa('0x37')][_0x6baa('0x59')]('nolimit')){_0x1cf2a3[_0x6baa('0x1f')]=qs['limit'](_0x403593['query'][_0x6baa('0x1f')]);_0x1cf2a3[_0x6baa('0x1d')]=qs['offset'](_0x403593[_0x6baa('0x37')][_0x6baa('0x1d')]);}return _0x4d3377[_0x6baa('0x56')](_0x1cf2a3);}})['then'](function(_0x47dec6){if(_0x47dec6){return _0x47dec6?{'count':_0xb9cfd8,'rows':_0x47dec6}:null;}})[_0x6baa('0x27')](respondWithResult(_0x26aee6,null))['catch'](handleError(_0x26aee6,null));};exports[_0x6baa('0x5a')]=function(_0x2ba796,_0x482516,_0x13238a){return db['Interval'][_0x6baa('0x57')]({'where':{'id':_0x2ba796['params']['id']}})[_0x6baa('0x27')](handleEntityNotFound(_0x482516,null))[_0x6baa('0x27')](function(_0x33ad4d){if(_0x33ad4d){return db['sequelize'][_0x6baa('0x5b')](function(_0x5917c0){return db[_0x6baa('0x30')]['destroy']({'where':{'IntervalId':_0x2ba796[_0x6baa('0x45')]['id']},'transaction':_0x5917c0})[_0x6baa('0x27')](function(_0x1e6789){var _0x1afc3a=_['map'](_0x2ba796[_0x6baa('0x4d')],function(_0x191fdd){delete _0x191fdd['id'];_0x191fdd[_0x6baa('0x5c')]=_0x2ba796[_0x6baa('0x45')]['id'];return _0x191fdd;});return db[_0x6baa('0x30')][_0x6baa('0x5d')](_0x1afc3a,{'transaction':_0x5917c0});});})[_0x6baa('0x27')](function(){return db['Interval'][_0x6baa('0x42')]({'where':{'IntervalId':_0x2ba796[_0x6baa('0x45')]['id']}});});}})[_0x6baa('0x27')](respondWithResult(_0x482516,null))[_0x6baa('0x43')](handleError(_0x482516,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 7f157a5..c21b44e 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 _0xa765=['./interval.attributes','../../components/extensions/rewrite','exports','define','Interval','tools_intervals','rewrite','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa765,0xe7));var _0x5a76=function(_0x16a9dc,_0x3c5d02){_0x16a9dc=_0x16a9dc-0x0;var _0xd820c4=_0xa765[_0x16a9dc];return _0xd820c4;};'use strict';var _=require(_0x5a76('0x0'));var util=require(_0x5a76('0x1'));var logger=require(_0x5a76('0x2'))('api');var moment=require(_0x5a76('0x3'));var BPromise=require(_0x5a76('0x4'));var rp=require(_0x5a76('0x5'));var fs=require('fs');var path=require(_0x5a76('0x6'));var rimraf=require(_0x5a76('0x7'));var config=require(_0x5a76('0x8'));var attributes=require(_0x5a76('0x9'));var extensions=require(_0x5a76('0xa'));module[_0x5a76('0xb')]=function(_0x1de31a,_0x36ad9c){return _0x1de31a[_0x5a76('0xc')](_0x5a76('0xd'),attributes,{'tableName':_0x5a76('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x17bf3d,_0x2237df){extensions[_0x5a76('0xf')](_0x1de31a,_0x17bf3d);},'afterBulkCreate':function(_0x489bc6,_0xb5a70,_0x49c23a){_0x49c23a();extensions[_0x5a76('0xf')](_0x1de31a,_0x489bc6[0x0]);},'afterUpdate':function(_0x5a4f30,_0x474728){extensions[_0x5a76('0xf')](_0x1de31a,_0x5a4f30);},'afterDestroy':function(_0x4a0b5d,_0x47b7f4){extensions['rewrite'](_0x1de31a,_0x4a0b5d);}}});}; \ No newline at end of file +var _0x8d30=['path','./interval.attributes','../../components/extensions/rewrite','exports','define','Interval','tools_intervals','rewrite','lodash','util','moment','bluebird','request-promise'];(function(_0x161450,_0x5ca76c){var _0x5a3fda=function(_0x18a4bd){while(--_0x18a4bd){_0x161450['push'](_0x161450['shift']());}};_0x5a3fda(++_0x5ca76c);}(_0x8d30,0x7d));var _0x08d3=function(_0x3238bd,_0x4ea3ef){_0x3238bd=_0x3238bd-0x0;var _0xdc7a7e=_0x8d30[_0x3238bd];return _0xdc7a7e;};'use strict';var _=require(_0x08d3('0x0'));var util=require(_0x08d3('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x08d3('0x2'));var BPromise=require(_0x08d3('0x3'));var rp=require(_0x08d3('0x4'));var fs=require('fs');var path=require(_0x08d3('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x08d3('0x6'));var extensions=require(_0x08d3('0x7'));module[_0x08d3('0x8')]=function(_0x3e9ca2,_0xfe2ce){return _0x3e9ca2[_0x08d3('0x9')](_0x08d3('0xa'),attributes,{'tableName':_0x08d3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x449cf7,_0x573bcf){extensions[_0x08d3('0xc')](_0x3e9ca2,_0x449cf7);},'afterBulkCreate':function(_0x2be440,_0x19e3cd,_0x5d8840){_0x5d8840();extensions[_0x08d3('0xc')](_0x3e9ca2,_0x2be440[0x0]);},'afterUpdate':function(_0xa87b50,_0x2956be){extensions[_0x08d3('0xc')](_0x3e9ca2,_0xa87b50);},'afterDestroy':function(_0x13453c,_0x1ee30d){extensions[_0x08d3('0xc')](_0x3e9ca2,_0x13453c);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 8152f9f..b5261c3 100644 --- a/server/api/interval/interval.rpc.js +++ b/server/api/interval/interval.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['code','error','message','result','catch','Interval','findAll','options','raw','where','attributes','include','map','model','GetInterval','stringify','ShowInterval','find','then','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Interval,\x20%s,\x20%s','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s'];(function(_0x1e6db3,_0x5643ac){var _0x1de886=function(_0x351318){while(--_0x351318){_0x1e6db3['push'](_0x1e6db3['shift']());}};_0x1de886(++_0x5643ac);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xa9e0[_0x4baae2];return _0x1a2285;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['GetInterval']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});};exports[_0x0a9e('0x1f')]=function(_0x2ec755){var _0x5c877d=this;return new Promise(function(_0x15b200,_0x40e7a3){return db[_0x0a9e('0x14')][_0x0a9e('0x20')]({'raw':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')]['where']||null:null,'attributes':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755['options'][_0x0a9e('0x19')]||null:null,'include':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x2ec755['options'][_0x0a9e('0x1a')],function(_0x46f0a5){return{'model':db[_0x46f0a5[_0x0a9e('0x1c')]],'as':_0x46f0a5['as'],'attributes':_0x46f0a5[_0x0a9e('0x19')],'include':_0x46f0a5[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x46f0a5[_0x0a9e('0x1a')],function(_0x39e565){return{'model':db[_0x39e565['model']],'as':_0x39e565['as'],'attributes':_0x39e565[_0x0a9e('0x19')],'include':_0x39e565['include']?_[_0x0a9e('0x1b')](_0x39e565[_0x0a9e('0x1a')],function(_0x2b7e7f){return{'model':db[_0x2b7e7f[_0x0a9e('0x1c')]],'as':_0x2b7e7f['as'],'attributes':_0x2b7e7f['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x21')](function(_0xd1836d){logger[_0x0a9e('0xa')](_0x0a9e('0x1f'),_0x2ec755);logger['debug']('ShowInterval',_0x2ec755,JSON[_0x0a9e('0x1e')](_0xd1836d));_0x15b200(_0xd1836d);})['catch'](function(_0x24936a){logger[_0x0a9e('0x10')](_0x0a9e('0x1f'),_0x24936a[_0x0a9e('0x11')],_0x2ec755);_0x40e7a3(_0x5c877d['error'](0x1f4,_0x24936a[_0x0a9e('0x11')]));});});}; \ No newline at end of file +var _0xa9e0=['code','error','message','result','catch','Interval','findAll','options','raw','where','attributes','include','map','model','GetInterval','stringify','ShowInterval','find','then','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Interval,\x20%s,\x20%s','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_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 moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['GetInterval']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});};exports[_0x0a9e('0x1f')]=function(_0x2ec755){var _0x5c877d=this;return new Promise(function(_0x15b200,_0x40e7a3){return db[_0x0a9e('0x14')][_0x0a9e('0x20')]({'raw':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')]['where']||null:null,'attributes':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755['options'][_0x0a9e('0x19')]||null:null,'include':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x2ec755['options'][_0x0a9e('0x1a')],function(_0x46f0a5){return{'model':db[_0x46f0a5[_0x0a9e('0x1c')]],'as':_0x46f0a5['as'],'attributes':_0x46f0a5[_0x0a9e('0x19')],'include':_0x46f0a5[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x46f0a5[_0x0a9e('0x1a')],function(_0x39e565){return{'model':db[_0x39e565['model']],'as':_0x39e565['as'],'attributes':_0x39e565[_0x0a9e('0x19')],'include':_0x39e565['include']?_[_0x0a9e('0x1b')](_0x39e565[_0x0a9e('0x1a')],function(_0x2b7e7f){return{'model':db[_0x2b7e7f[_0x0a9e('0x1c')]],'as':_0x2b7e7f['as'],'attributes':_0x2b7e7f['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x21')](function(_0xd1836d){logger[_0x0a9e('0xa')](_0x0a9e('0x1f'),_0x2ec755);logger['debug']('ShowInterval',_0x2ec755,JSON[_0x0a9e('0x1e')](_0xd1836d));_0x15b200(_0xd1836d);})['catch'](function(_0x24936a){logger[_0x0a9e('0x10')](_0x0a9e('0x1f'),_0x24936a[_0x0a9e('0x11')],_0x2ec755);_0x40e7a3(_0x5c877d['error'](0x1f4,_0x24936a[_0x0a9e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 66d0cc6..6ca1688 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 _0x5f2f=['isAuthenticated','send','exports','express','Router','../../components/auth/service','./jira.controller','post'];(function(_0x257a01,_0x143777){var _0xc2cd98=function(_0x3d1842){while(--_0x3d1842){_0x257a01['push'](_0x257a01['shift']());}};_0xc2cd98(++_0x143777);}(_0x5f2f,0x73));var _0xf5f2=function(_0x3efd09,_0x4b3e6a){_0x3efd09=_0x3efd09-0x0;var _0x2a8b3d=_0x5f2f[_0x3efd09];return _0x2a8b3d;};'use strict';var express=require(_0xf5f2('0x0'));var router=express[_0xf5f2('0x1')]();var auth=require(_0xf5f2('0x2'));var controller=require(_0xf5f2('0x3'));router[_0xf5f2('0x4')]('/',auth[_0xf5f2('0x5')](),controller[_0xf5f2('0x6')]);module[_0xf5f2('0x7')]=router; \ No newline at end of file +var _0xdb28=['isAuthenticated','send','exports','express','Router','../../components/auth/service','./jira.controller'];(function(_0x21d873,_0x3c7ffe){var _0x48eff9=function(_0x53fe25){while(--_0x53fe25){_0x21d873['push'](_0x21d873['shift']());}};_0x48eff9(++_0x3c7ffe);}(_0xdb28,0x106));var _0x8db2=function(_0x52d3e4,_0x6acd8){_0x52d3e4=_0x52d3e4-0x0;var _0xa41a32=_0xdb28[_0x52d3e4];return _0xa41a32;};'use strict';var express=require(_0x8db2('0x0'));var router=express[_0x8db2('0x1')]();var auth=require(_0x8db2('0x2'));var controller=require(_0x8db2('0x3'));router['post']('/',auth[_0x8db2('0x4')](),controller[_0x8db2('0x5')]);module[_0x8db2('0x6')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index a36ca35..7093ecf 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 _0xc454=['remoteAddress','socket','body','bluebird','https','../../config/logger','support','3eAmWpBVP0','key','MOTGUI','Report','\x20from\x20','description','stringify','issuetype','Bug','fields','customfield_11500','customfield_11501','oldToken','customfield_11502','name','reason','customfield_10102','/rest/api/2/issue','POST','Basic\x20','toString','base64','request','setEncoding','utf8','data','end','status','statusCode','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','send','headers','x-forwarded-for','connection'];(function(_0x1b62b8,_0x3e78d9){var _0x47a5a0=function(_0x479a5b){while(--_0x479a5b){_0x1b62b8['push'](_0x1b62b8['shift']());}};_0x47a5a0(++_0x3e78d9);}(_0xc454,0xbb));var _0x4c45=function(_0x2b6348,_0x1e9358){_0x2b6348=_0x2b6348-0x0;var _0x4324d7=_0xc454[_0x2b6348];return _0x4324d7;};'use strict';var BPromise=require(_0x4c45('0x0'));var https=require(_0x4c45('0x1'));var logger=require(_0x4c45('0x2'))('api');var USERNAME=_0x4c45('0x3');var PASSWORD=_0x4c45('0x4');function openIssue(_0x211612,_0x40650d){var _0x1a09ac={'fields':{'project':{'key':_0x211612[_0x4c45('0x5')]||_0x4c45('0x6')},'summary':(_0x211612['summary']||_0x4c45('0x7'))+_0x4c45('0x8')+_0x211612['ip'],'description':_0x211612[_0x4c45('0x9')]||JSON[_0x4c45('0xa')](_0x211612),'issuetype':{'name':_0x211612[_0x4c45('0xb')]||_0x4c45('0xc')}}};_0x1a09ac[_0x4c45('0xd')][_0x4c45('0xe')]=_0x211612['email'];_0x1a09ac[_0x4c45('0xd')][_0x4c45('0xf')]=_0x211612[_0x4c45('0x10')];_0x1a09ac[_0x4c45('0xd')][_0x4c45('0x11')]=_0x211612['newToken'];_0x1a09ac['fields']['customfield_11503']=_0x211612[_0x4c45('0x12')];_0x1a09ac[_0x4c45('0xd')]['customfield_11504']=_0x211612[_0x4c45('0x13')];_0x1a09ac[_0x4c45('0xd')][_0x4c45('0x14')]=_0x211612['ip'];var _0x3cad03={'host':'track.xcallymotion.com','port':0x1bb,'path':_0x4c45('0x15'),'method':_0x4c45('0x16'),'timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':_0x4c45('0x17')+new Buffer(USERNAME+':'+PASSWORD)[_0x4c45('0x18')](_0x4c45('0x19'))}};var _0x696ebc=JSON[_0x4c45('0xa')](_0x1a09ac);var _0x383d40=https[_0x4c45('0x1a')](_0x3cad03,function(_0x298b89){_0x298b89[_0x4c45('0x1b')](_0x4c45('0x1c'));var _0x5ab5ff='';_0x298b89['on'](_0x4c45('0x1d'),function(_0x4e9180){_0x5ab5ff+=_0x4e9180;});_0x298b89['on'](_0x4c45('0x1e'),function(){if(_0x40650d){return _0x40650d[_0x4c45('0x1f')](_0x298b89[_0x4c45('0x20')])[_0x4c45('0x21')](JSON[_0x4c45('0x22')](_0x5ab5ff));}});});_0x383d40['on'](_0x4c45('0x23'),function(_0x24912c){if(_0x40650d){return _0x40650d[_0x4c45('0x1f')](0x1f4)['json']({'errors':[{'message':_0x4c45('0x24'),'type':_0x4c45('0x25')}]});}});_0x383d40[_0x4c45('0x26')](_0x696ebc);_0x383d40[_0x4c45('0x1e')]();}exports['openIssue']=openIssue;exports[_0x4c45('0x27')]=function(_0x25f368,_0x4fb4a9){_0x25f368['body']['ip']=_0x25f368[_0x4c45('0x28')][_0x4c45('0x29')]||_0x25f368[_0x4c45('0x2a')]['remoteAddress']||_0x25f368['socket'][_0x4c45('0x2b')]||_0x25f368[_0x4c45('0x2a')][_0x4c45('0x2c')][_0x4c45('0x2b')];return openIssue(_0x25f368[_0x4c45('0x2d')],_0x4fb4a9);}; \ No newline at end of file +var _0xb862=['oldToken','customfield_11502','newToken','name','customfield_11504','reason','customfield_10102','/rest/api/2/issue','POST','toString','base64','request','setEncoding','utf8','data','status','statusCode','json','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','end','send','body','x-forwarded-for','remoteAddress','socket','connection','https','../../config/logger','support','3eAmWpBVP0','MOTGUI','summary','Report','\x20from\x20','description','stringify','issuetype','Bug','fields','email'];(function(_0x7f05e9,_0x4fcac3){var _0x82831b=function(_0x3fb306){while(--_0x3fb306){_0x7f05e9['push'](_0x7f05e9['shift']());}};_0x82831b(++_0x4fcac3);}(_0xb862,0x1cb));var _0x2b86=function(_0x444e1c,_0x1aadb2){_0x444e1c=_0x444e1c-0x0;var _0x5a8b5d=_0xb862[_0x444e1c];return _0x5a8b5d;};'use strict';var BPromise=require('bluebird');var https=require(_0x2b86('0x0'));var logger=require(_0x2b86('0x1'))('api');var USERNAME=_0x2b86('0x2');var PASSWORD=_0x2b86('0x3');function openIssue(_0x88122d,_0x23c3a5){var _0x170050={'fields':{'project':{'key':_0x88122d['key']||_0x2b86('0x4')},'summary':(_0x88122d[_0x2b86('0x5')]||_0x2b86('0x6'))+_0x2b86('0x7')+_0x88122d['ip'],'description':_0x88122d[_0x2b86('0x8')]||JSON[_0x2b86('0x9')](_0x88122d),'issuetype':{'name':_0x88122d[_0x2b86('0xa')]||_0x2b86('0xb')}}};_0x170050[_0x2b86('0xc')]['customfield_11500']=_0x88122d[_0x2b86('0xd')];_0x170050[_0x2b86('0xc')]['customfield_11501']=_0x88122d[_0x2b86('0xe')];_0x170050[_0x2b86('0xc')][_0x2b86('0xf')]=_0x88122d[_0x2b86('0x10')];_0x170050[_0x2b86('0xc')]['customfield_11503']=_0x88122d[_0x2b86('0x11')];_0x170050[_0x2b86('0xc')][_0x2b86('0x12')]=_0x88122d[_0x2b86('0x13')];_0x170050[_0x2b86('0xc')][_0x2b86('0x14')]=_0x88122d['ip'];var _0x52d086={'host':'track.xcallymotion.com','port':0x1bb,'path':_0x2b86('0x15'),'method':_0x2b86('0x16'),'timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)[_0x2b86('0x17')](_0x2b86('0x18'))}};var _0x22066e=JSON[_0x2b86('0x9')](_0x170050);var _0x21fa07=https[_0x2b86('0x19')](_0x52d086,function(_0xf06047){_0xf06047[_0x2b86('0x1a')](_0x2b86('0x1b'));var _0x409edc='';_0xf06047['on'](_0x2b86('0x1c'),function(_0x2a88aa){_0x409edc+=_0x2a88aa;});_0xf06047['on']('end',function(){if(_0x23c3a5){return _0x23c3a5[_0x2b86('0x1d')](_0xf06047[_0x2b86('0x1e')])[_0x2b86('0x1f')](JSON['parse'](_0x409edc));}});});_0x21fa07['on'](_0x2b86('0x20'),function(_0x28acd6){if(_0x23c3a5){return _0x23c3a5[_0x2b86('0x1d')](0x1f4)['json']({'errors':[{'message':_0x2b86('0x21'),'type':_0x2b86('0x22')}]});}});_0x21fa07[_0x2b86('0x23')](_0x22066e);_0x21fa07[_0x2b86('0x24')]();}exports['openIssue']=openIssue;exports[_0x2b86('0x25')]=function(_0x33ef1f,_0x4028d6){_0x33ef1f[_0x2b86('0x26')]['ip']=_0x33ef1f['headers'][_0x2b86('0x27')]||_0x33ef1f['connection'][_0x2b86('0x28')]||_0x33ef1f[_0x2b86('0x29')][_0x2b86('0x28')]||_0x33ef1f[_0x2b86('0x2a')]['socket'][_0x2b86('0x28')];return openIssue(_0x33ef1f[_0x2b86('0x26')],_0x4028d6);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 6e1e06b..daf20a8 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 _0x702d=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','describe','/:id','isAuthenticated','show','post','create','put','update','destroy','exports','multer','util','path'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x702d,0x147));var _0xd702=function(_0x231749,_0x20f566){_0x231749=_0x231749-0x0;var _0x3311f9=_0x702d[_0x231749];return _0x3311f9;};'use strict';var multer=require(_0xd702('0x0'));var util=require(_0xd702('0x1'));var path=require(_0xd702('0x2'));var timeout=require(_0xd702('0x3'));var express=require(_0xd702('0x4'));var router=express['Router']();var fs_extra=require(_0xd702('0x5'));var auth=require(_0xd702('0x6'));var interaction=require(_0xd702('0x7'));var config=require(_0xd702('0x8'));var controller=require('./jscriptyAnswerReport.controller');router[_0xd702('0x9')]('/',auth['isAuthenticated'](),controller[_0xd702('0xa')]);router[_0xd702('0x9')](_0xd702('0xb'),auth['isAuthenticated'](),controller[_0xd702('0xc')]);router['get'](_0xd702('0xd'),auth[_0xd702('0xe')](),controller[_0xd702('0xf')]);router[_0xd702('0x10')]('/',auth[_0xd702('0xe')](),controller[_0xd702('0x11')]);router[_0xd702('0x12')](_0xd702('0xd'),auth[_0xd702('0xe')](),controller[_0xd702('0x13')]);router['delete']('/:id',auth[_0xd702('0xe')](),controller[_0xd702('0x14')]);module[_0xd702('0x15')]=router; \ No newline at end of file +var _0x668b=['get','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','isAuthenticated','index'];(function(_0x398fca,_0x4a8a34){var _0x4987d0=function(_0x332dba){while(--_0x332dba){_0x398fca['push'](_0x398fca['shift']());}};_0x4987d0(++_0x4a8a34);}(_0x668b,0x140));var _0xb668=function(_0x5cab28,_0x307622){_0x5cab28=_0x5cab28-0x0;var _0xa3554d=_0x668b[_0x5cab28];return _0xa3554d;};'use strict';var multer=require(_0xb668('0x0'));var util=require(_0xb668('0x1'));var path=require('path');var timeout=require(_0xb668('0x2'));var express=require(_0xb668('0x3'));var router=express['Router']();var fs_extra=require(_0xb668('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xb668('0x5'));var config=require(_0xb668('0x6'));var controller=require(_0xb668('0x7'));router['get']('/',auth[_0xb668('0x8')](),controller[_0xb668('0x9')]);router[_0xb668('0xa')](_0xb668('0xb'),auth[_0xb668('0x8')](),controller[_0xb668('0xc')]);router['get'](_0xb668('0xd'),auth[_0xb668('0x8')](),controller[_0xb668('0xe')]);router[_0xb668('0xf')]('/',auth[_0xb668('0x8')](),controller[_0xb668('0x10')]);router[_0xb668('0x11')](_0xb668('0xd'),auth['isAuthenticated'](),controller[_0xb668('0x12')]);router[_0xb668('0x13')](_0xb668('0xd'),auth[_0xb668('0x8')](),controller[_0xb668('0x14')]);module[_0xb668('0x15')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 1619c56..8d7d878 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(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0x7a54,0x106));var _0x47a5=function(_0x57e862,_0x4851a8){_0x57e862=_0x57e862-0x0;var _0x1a9b80=_0x7a54[_0x57e862];return _0x1a9b80;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'question':{'type':Sequelize[_0x47a5('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x47a5('0x3'))},'membername':{'type':Sequelize[_0x47a5('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x47a5('0x4')]},'uniqueid':{'type':Sequelize[_0x47a5('0x4')]},'calleridname':{'type':Sequelize[_0x47a5('0x4')]},'calleridnum':{'type':Sequelize[_0x47a5('0x4')]},'questionId':{'type':Sequelize[_0x47a5('0x4')]}}; \ No newline at end of file +var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0x7a54,0x106));var _0x47a5=function(_0x38ede1,_0xca81ac){_0x38ede1=_0x38ede1-0x0;var _0x4098bf=_0x7a54[_0x38ede1];return _0x4098bf;};'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 a2660b5..fff588b 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 _0x3f1c=['params','rawAttributes','includeAll','find','catch','create','body','describe','eml-format','fast-json-patch','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','save','update','then','stack','name','send','index','map','JscriptyAnswerReport','fieldName','type','key','model','keys','intersection','attributes','fields','length','query','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include'];(function(_0x185a6f,_0x192581){var _0x54ec70=function(_0x13b64e){while(--_0x13b64e){_0x185a6f['push'](_0x185a6f['shift']());}};_0x54ec70(++_0x192581);}(_0x3f1c,0xd4));var _0xc3f1=function(_0x75c0aa,_0x52f100){_0x75c0aa=_0x75c0aa-0x0;var _0x397a4e=_0x3f1c[_0x75c0aa];return _0x397a4e;};'use strict';var emlformat=require(_0xc3f1('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc3f1('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xc3f1('0x2'));var Mustache=require(_0xc3f1('0x3'));var util=require(_0xc3f1('0x4'));var path=require(_0xc3f1('0x5'));var sox=require(_0xc3f1('0x6'));var csv=require('to-csv');var ejs=require(_0xc3f1('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc3f1('0x8'));var squel=require(_0xc3f1('0x9'));var crypto=require(_0xc3f1('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xc3f1('0xb'));var querystring=require('querystring');var Papa=require(_0xc3f1('0xc'));var Redis=require(_0xc3f1('0xd'));var authService=require(_0xc3f1('0xe'));var qs=require(_0xc3f1('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc3f1('0x10'));var logger=require('../../config/logger')(_0xc3f1('0x11'));var utils=require('../../config/utils');var config=require(_0xc3f1('0x12'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x23bb14,_0x103df5){_0x103df5=_0x103df5||0xcc;return function(_0x25cb9e){if(_0x25cb9e){return _0x23bb14[_0xc3f1('0x13')](_0x103df5);}return _0x23bb14[_0xc3f1('0x14')](_0x103df5)[_0xc3f1('0x15')]();};}function respondWithResult(_0x5bbfb3,_0x5dbe5c){_0x5dbe5c=_0x5dbe5c||0xc8;return function(_0x1d9ea7){if(_0x1d9ea7){return _0x5bbfb3[_0xc3f1('0x14')](_0x5dbe5c)[_0xc3f1('0x16')](_0x1d9ea7);}};}function respondWithFilteredResult(_0x23eb8c,_0x4e8f05){return function(_0x4667af){if(_0x4667af){var _0xee643=typeof _0x4e8f05[_0xc3f1('0x17')]===_0xc3f1('0x18')&&typeof _0x4e8f05['limit']===_0xc3f1('0x18');var _0x59e1e3=_0x4667af[_0xc3f1('0x19')];var _0x420d75=_0xee643?0x0:_0x4e8f05[_0xc3f1('0x17')];var _0x3dc419=_0xee643?_0x4667af['count']:_0x4e8f05[_0xc3f1('0x17')]+_0x4e8f05[_0xc3f1('0x1a')];var _0x3f97b2;if(_0x3dc419>=_0x59e1e3){_0x3dc419=_0x59e1e3;_0x3f97b2=0xc8;}else{_0x3f97b2=0xce;}_0x23eb8c[_0xc3f1('0x14')](_0x3f97b2);return _0x23eb8c[_0xc3f1('0x1b')]('Content-Range',_0x420d75+'-'+_0x3dc419+'/'+_0x59e1e3)[_0xc3f1('0x16')](_0x4667af);}return null;};}function patchUpdates(_0x4f53c1){return function(_0x546627){try{jsonpatch[_0xc3f1('0x1c')](_0x546627,_0x4f53c1,!![]);}catch(_0x1d3ebb){return BPromise[_0xc3f1('0x1d')](_0x1d3ebb);}return _0x546627[_0xc3f1('0x1e')]();};}function saveUpdates(_0x53d054,_0x44d774){return function(_0x2df1a4){if(_0x2df1a4){return _0x2df1a4[_0xc3f1('0x1f')](_0x53d054)[_0xc3f1('0x20')](function(_0x151c8a){return _0x151c8a;});}return null;};}function removeEntity(_0x31a03c,_0x2f4d81){return function(_0x294f50){if(_0x294f50){return _0x294f50['destroy']()['then'](function(){_0x31a03c[_0xc3f1('0x14')](0xcc)[_0xc3f1('0x15')]();});}};}function handleEntityNotFound(_0x3b1eb9,_0x49d98d){return function(_0x5e1b6a){if(!_0x5e1b6a){_0x3b1eb9[_0xc3f1('0x13')](0x194);}return _0x5e1b6a;};}function handleError(_0x41b473,_0x1cf63f){_0x1cf63f=_0x1cf63f||0x1f4;return function(_0x4dd154){logger['error'](_0x4dd154[_0xc3f1('0x21')]);if(_0x4dd154[_0xc3f1('0x22')]){delete _0x4dd154['name'];}_0x41b473['status'](_0x1cf63f)[_0xc3f1('0x23')](_0x4dd154);};}exports[_0xc3f1('0x24')]=function(_0x5cb85d,_0x2d6cc4){var _0x22dac7={},_0x2f925e={},_0x3454a3={'count':0x0,'rows':[]};var _0x4103ef=_[_0xc3f1('0x25')](db[_0xc3f1('0x26')]['rawAttributes'],function(_0x22957c){return{'name':_0x22957c[_0xc3f1('0x27')],'type':_0x22957c[_0xc3f1('0x28')][_0xc3f1('0x29')]};});_0x2f925e[_0xc3f1('0x2a')]=_['map'](_0x4103ef,_0xc3f1('0x22'));_0x2f925e['query']=_[_0xc3f1('0x2b')](_0x5cb85d['query']);_0x2f925e['filters']=_[_0xc3f1('0x2c')](_0x2f925e[_0xc3f1('0x2a')],_0x2f925e['query']);_0x22dac7[_0xc3f1('0x2d')]=_[_0xc3f1('0x2c')](_0x2f925e['model'],qs[_0xc3f1('0x2e')](_0x5cb85d['query'][_0xc3f1('0x2e')]));_0x22dac7[_0xc3f1('0x2d')]=_0x22dac7[_0xc3f1('0x2d')][_0xc3f1('0x2f')]?_0x22dac7[_0xc3f1('0x2d')]:_0x2f925e['model'];if(!_0x5cb85d[_0xc3f1('0x30')][_0xc3f1('0x31')]('nolimit')){_0x22dac7[_0xc3f1('0x1a')]=qs[_0xc3f1('0x1a')](_0x5cb85d[_0xc3f1('0x30')]['limit']);_0x22dac7[_0xc3f1('0x17')]=qs[_0xc3f1('0x17')](_0x5cb85d['query'][_0xc3f1('0x17')]);}_0x22dac7[_0xc3f1('0x32')]=qs['sort'](_0x5cb85d[_0xc3f1('0x30')][_0xc3f1('0x33')]);_0x22dac7[_0xc3f1('0x34')]=qs[_0xc3f1('0x35')](_[_0xc3f1('0x36')](_0x5cb85d[_0xc3f1('0x30')],_0x2f925e[_0xc3f1('0x35')]),_0x4103ef);if(_0x5cb85d[_0xc3f1('0x30')][_0xc3f1('0x37')]){_0x22dac7[_0xc3f1('0x34')]=_[_0xc3f1('0x38')](_0x22dac7['where'],{'$or':_[_0xc3f1('0x25')](_0x4103ef,function(_0x5db660){if(_0x5db660['type']!==_0xc3f1('0x39')){var _0x4420ce={};_0x4420ce[_0x5db660[_0xc3f1('0x22')]]={'$like':'%'+_0x5cb85d['query'][_0xc3f1('0x37')]+'%'};return _0x4420ce;}})});}_0x22dac7=_[_0xc3f1('0x38')]({},_0x22dac7,_0x5cb85d[_0xc3f1('0x3a')]);var _0x29eefa={'where':_0x22dac7[_0xc3f1('0x34')]};return db[_0xc3f1('0x26')]['count'](_0x29eefa)[_0xc3f1('0x20')](function(_0x3afde8){_0x3454a3[_0xc3f1('0x19')]=_0x3afde8;if(_0x5cb85d['query']['includeAll']){_0x22dac7[_0xc3f1('0x3b')]=[{'all':!![]}];}return db[_0xc3f1('0x26')]['findAll'](_0x22dac7);})[_0xc3f1('0x20')](function(_0x30e012){_0x3454a3['rows']=_0x30e012;return _0x3454a3;})['then'](respondWithFilteredResult(_0x2d6cc4,_0x22dac7))['catch'](handleError(_0x2d6cc4,null));};exports['show']=function(_0x4a829c,_0x1904c0){var _0x1e8e55={'raw':!![],'where':{'id':_0x4a829c[_0xc3f1('0x3c')]['id']}},_0xfcf4a6={};_0xfcf4a6['model']=_['keys'](db[_0xc3f1('0x26')][_0xc3f1('0x3d')]);_0xfcf4a6[_0xc3f1('0x30')]=_[_0xc3f1('0x2b')](_0x4a829c[_0xc3f1('0x30')]);_0xfcf4a6[_0xc3f1('0x35')]=_[_0xc3f1('0x2c')](_0xfcf4a6[_0xc3f1('0x2a')],_0xfcf4a6[_0xc3f1('0x30')]);_0x1e8e55['attributes']=_[_0xc3f1('0x2c')](_0xfcf4a6[_0xc3f1('0x2a')],qs['fields'](_0x4a829c[_0xc3f1('0x30')][_0xc3f1('0x2e')]));_0x1e8e55[_0xc3f1('0x2d')]=_0x1e8e55[_0xc3f1('0x2d')]['length']?_0x1e8e55['attributes']:_0xfcf4a6['model'];if(_0x4a829c['query'][_0xc3f1('0x3e')]){_0x1e8e55[_0xc3f1('0x3b')]=[{'all':!![]}];}_0x1e8e55=_['merge']({},_0x1e8e55,_0x4a829c[_0xc3f1('0x3a')]);return db[_0xc3f1('0x26')][_0xc3f1('0x3f')](_0x1e8e55)[_0xc3f1('0x20')](handleEntityNotFound(_0x1904c0,null))[_0xc3f1('0x20')](respondWithResult(_0x1904c0,null))[_0xc3f1('0x40')](handleError(_0x1904c0,null));};exports[_0xc3f1('0x41')]=function(_0x581eca,_0x3fdb5c){return db[_0xc3f1('0x26')]['create'](_0x581eca[_0xc3f1('0x42')],{})[_0xc3f1('0x20')](respondWithResult(_0x3fdb5c,0xc9))[_0xc3f1('0x40')](handleError(_0x3fdb5c,null));};exports['update']=function(_0x1a7d8c,_0x2f370b){if(_0x1a7d8c['body']['id']){delete _0x1a7d8c[_0xc3f1('0x42')]['id'];}return db[_0xc3f1('0x26')][_0xc3f1('0x3f')]({'where':{'id':_0x1a7d8c[_0xc3f1('0x3c')]['id']}})[_0xc3f1('0x20')](handleEntityNotFound(_0x2f370b,null))[_0xc3f1('0x20')](saveUpdates(_0x1a7d8c[_0xc3f1('0x42')],null))[_0xc3f1('0x20')](respondWithResult(_0x2f370b,null))[_0xc3f1('0x40')](handleError(_0x2f370b,null));};exports['destroy']=function(_0x2966f2,_0x59245c){return db[_0xc3f1('0x26')][_0xc3f1('0x3f')]({'where':{'id':_0x2966f2[_0xc3f1('0x3c')]['id']}})[_0xc3f1('0x20')](handleEntityNotFound(_0x59245c,null))[_0xc3f1('0x20')](removeEntity(_0x59245c,null))[_0xc3f1('0x40')](handleError(_0x59245c,null));};exports[_0xc3f1('0x43')]=function(_0x58803a,_0x32aae1){return db[_0xc3f1('0x26')]['describe']()[_0xc3f1('0x20')](respondWithResult(_0x32aae1,null))[_0xc3f1('0x40')](handleError(_0x32aae1,null));}; \ No newline at end of file +var _0xa4dc=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','merge','VIRTUAL','where','JscriptyAnswerReport','includeAll','catch','show','params','keys','length','include','options','find','create','body','describe','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware'];(function(_0x2ee881,_0x11fc32){var _0xabda6d=function(_0x2f5bb8){while(--_0x2f5bb8){_0x2ee881['push'](_0x2ee881['shift']());}};_0xabda6d(++_0x11fc32);}(_0xa4dc,0x16a));var _0xca4d=function(_0x7e2eb0,_0x17cd58){_0x7e2eb0=_0x7e2eb0-0x0;var _0xd92de4=_0xa4dc[_0x7e2eb0];return _0xd92de4;};'use strict';var emlformat=require(_0xca4d('0x0'));var rimraf=require(_0xca4d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xca4d('0x2'));var moment=require(_0xca4d('0x3'));var BPromise=require(_0xca4d('0x4'));var Mustache=require(_0xca4d('0x5'));var util=require(_0xca4d('0x6'));var path=require('path');var sox=require(_0xca4d('0x7'));var csv=require(_0xca4d('0x8'));var ejs=require(_0xca4d('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xca4d('0xa'));var squel=require('squel');var crypto=require(_0xca4d('0xb'));var jsforce=require(_0xca4d('0xc'));var deskjs=require(_0xca4d('0xd'));var toCsv=require(_0xca4d('0x8'));var querystring=require('querystring');var Papa=require(_0xca4d('0xe'));var Redis=require(_0xca4d('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xca4d('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xca4d('0x11'));var logger=require(_0xca4d('0x12'))(_0xca4d('0x13'));var utils=require(_0xca4d('0x14'));var config=require(_0xca4d('0x15'));var licenseUtil=require(_0xca4d('0x16'));var db=require(_0xca4d('0x17'))['db'];function respondWithStatusCode(_0x2009d4,_0x5e5163){_0x5e5163=_0x5e5163||0xcc;return function(_0x3fc3ab){if(_0x3fc3ab){return _0x2009d4['sendStatus'](_0x5e5163);}return _0x2009d4[_0xca4d('0x18')](_0x5e5163)[_0xca4d('0x19')]();};}function respondWithResult(_0x2e86ae,_0x4ab15d){_0x4ab15d=_0x4ab15d||0xc8;return function(_0x47285f){if(_0x47285f){return _0x2e86ae['status'](_0x4ab15d)[_0xca4d('0x1a')](_0x47285f);}};}function respondWithFilteredResult(_0x3dddc8,_0x33a7d6){return function(_0x334ab4){if(_0x334ab4){var _0x40e945=typeof _0x33a7d6[_0xca4d('0x1b')]===_0xca4d('0x1c')&&typeof _0x33a7d6['limit']===_0xca4d('0x1c');var _0x20ed84=_0x334ab4[_0xca4d('0x1d')];var _0x388ff7=_0x40e945?0x0:_0x33a7d6[_0xca4d('0x1b')];var _0x395319=_0x40e945?_0x334ab4[_0xca4d('0x1d')]:_0x33a7d6[_0xca4d('0x1b')]+_0x33a7d6[_0xca4d('0x1e')];var _0x5738b6;if(_0x395319>=_0x20ed84){_0x395319=_0x20ed84;_0x5738b6=0xc8;}else{_0x5738b6=0xce;}_0x3dddc8['status'](_0x5738b6);return _0x3dddc8[_0xca4d('0x1f')]('Content-Range',_0x388ff7+'-'+_0x395319+'/'+_0x20ed84)[_0xca4d('0x1a')](_0x334ab4);}return null;};}function patchUpdates(_0x555f0e){return function(_0x375efa){try{jsonpatch[_0xca4d('0x20')](_0x375efa,_0x555f0e,!![]);}catch(_0x35295c){return BPromise[_0xca4d('0x21')](_0x35295c);}return _0x375efa[_0xca4d('0x22')]();};}function saveUpdates(_0x4f692b,_0x58e346){return function(_0xe29bfc){if(_0xe29bfc){return _0xe29bfc[_0xca4d('0x23')](_0x4f692b)[_0xca4d('0x24')](function(_0x390634){return _0x390634;});}return null;};}function removeEntity(_0x5ef722,_0x2515fc){return function(_0x4d7f1a){if(_0x4d7f1a){return _0x4d7f1a[_0xca4d('0x25')]()['then'](function(){_0x5ef722[_0xca4d('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1763f3,_0x3ffe67){return function(_0x3e0210){if(!_0x3e0210){_0x1763f3[_0xca4d('0x26')](0x194);}return _0x3e0210;};}function handleError(_0x57a079,_0x327006){_0x327006=_0x327006||0x1f4;return function(_0xfea1c5){logger[_0xca4d('0x27')](_0xfea1c5[_0xca4d('0x28')]);if(_0xfea1c5[_0xca4d('0x29')]){delete _0xfea1c5[_0xca4d('0x29')];}_0x57a079[_0xca4d('0x18')](_0x327006)[_0xca4d('0x2a')](_0xfea1c5);};}exports[_0xca4d('0x2b')]=function(_0x37d563,_0xfacacb){var _0x319dea={},_0x522be8={},_0x53efdb={'count':0x0,'rows':[]};var _0xcc6dd5=_[_0xca4d('0x2c')](db['JscriptyAnswerReport'][_0xca4d('0x2d')],function(_0x532066){return{'name':_0x532066[_0xca4d('0x2e')],'type':_0x532066[_0xca4d('0x2f')]['key']};});_0x522be8[_0xca4d('0x30')]=_[_0xca4d('0x2c')](_0xcc6dd5,_0xca4d('0x29'));_0x522be8[_0xca4d('0x31')]=_['keys'](_0x37d563[_0xca4d('0x31')]);_0x522be8[_0xca4d('0x32')]=_[_0xca4d('0x33')](_0x522be8[_0xca4d('0x30')],_0x522be8['query']);_0x319dea[_0xca4d('0x34')]=_[_0xca4d('0x33')](_0x522be8[_0xca4d('0x30')],qs[_0xca4d('0x35')](_0x37d563['query'][_0xca4d('0x35')]));_0x319dea[_0xca4d('0x34')]=_0x319dea[_0xca4d('0x34')]['length']?_0x319dea[_0xca4d('0x34')]:_0x522be8[_0xca4d('0x30')];if(!_0x37d563[_0xca4d('0x31')][_0xca4d('0x36')](_0xca4d('0x37'))){_0x319dea['limit']=qs[_0xca4d('0x1e')](_0x37d563[_0xca4d('0x31')][_0xca4d('0x1e')]);_0x319dea[_0xca4d('0x1b')]=qs[_0xca4d('0x1b')](_0x37d563['query'][_0xca4d('0x1b')]);}_0x319dea[_0xca4d('0x38')]=qs[_0xca4d('0x39')](_0x37d563[_0xca4d('0x31')]['sort']);_0x319dea['where']=qs[_0xca4d('0x32')](_[_0xca4d('0x3a')](_0x37d563['query'],_0x522be8[_0xca4d('0x32')]),_0xcc6dd5);if(_0x37d563['query'][_0xca4d('0x3b')]){_0x319dea['where']=_[_0xca4d('0x3c')](_0x319dea['where'],{'$or':_[_0xca4d('0x2c')](_0xcc6dd5,function(_0x2e7dd7){if(_0x2e7dd7[_0xca4d('0x2f')]!==_0xca4d('0x3d')){var _0x361835={};_0x361835[_0x2e7dd7['name']]={'$like':'%'+_0x37d563[_0xca4d('0x31')][_0xca4d('0x3b')]+'%'};return _0x361835;}})});}_0x319dea=_[_0xca4d('0x3c')]({},_0x319dea,_0x37d563['options']);var _0x1f0b3e={'where':_0x319dea[_0xca4d('0x3e')]};return db[_0xca4d('0x3f')]['count'](_0x1f0b3e)[_0xca4d('0x24')](function(_0x206391){_0x53efdb[_0xca4d('0x1d')]=_0x206391;if(_0x37d563['query'][_0xca4d('0x40')]){_0x319dea['include']=[{'all':!![]}];}return db[_0xca4d('0x3f')]['findAll'](_0x319dea);})['then'](function(_0x173bca){_0x53efdb['rows']=_0x173bca;return _0x53efdb;})['then'](respondWithFilteredResult(_0xfacacb,_0x319dea))[_0xca4d('0x41')](handleError(_0xfacacb,null));};exports[_0xca4d('0x42')]=function(_0x39dd75,_0x27f9da){var _0x44430c={'raw':!![],'where':{'id':_0x39dd75[_0xca4d('0x43')]['id']}},_0x164509={};_0x164509[_0xca4d('0x30')]=_[_0xca4d('0x44')](db['JscriptyAnswerReport']['rawAttributes']);_0x164509[_0xca4d('0x31')]=_[_0xca4d('0x44')](_0x39dd75[_0xca4d('0x31')]);_0x164509['filters']=_[_0xca4d('0x33')](_0x164509[_0xca4d('0x30')],_0x164509['query']);_0x44430c[_0xca4d('0x34')]=_[_0xca4d('0x33')](_0x164509[_0xca4d('0x30')],qs['fields'](_0x39dd75['query'][_0xca4d('0x35')]));_0x44430c[_0xca4d('0x34')]=_0x44430c[_0xca4d('0x34')][_0xca4d('0x45')]?_0x44430c[_0xca4d('0x34')]:_0x164509['model'];if(_0x39dd75[_0xca4d('0x31')][_0xca4d('0x40')]){_0x44430c[_0xca4d('0x46')]=[{'all':!![]}];}_0x44430c=_[_0xca4d('0x3c')]({},_0x44430c,_0x39dd75[_0xca4d('0x47')]);return db[_0xca4d('0x3f')][_0xca4d('0x48')](_0x44430c)[_0xca4d('0x24')](handleEntityNotFound(_0x27f9da,null))['then'](respondWithResult(_0x27f9da,null))[_0xca4d('0x41')](handleError(_0x27f9da,null));};exports['create']=function(_0x505fb7,_0x5f335c){return db[_0xca4d('0x3f')][_0xca4d('0x49')](_0x505fb7[_0xca4d('0x4a')],{})[_0xca4d('0x24')](respondWithResult(_0x5f335c,0xc9))[_0xca4d('0x41')](handleError(_0x5f335c,null));};exports[_0xca4d('0x23')]=function(_0x3bba4d,_0x3f7dd6){if(_0x3bba4d[_0xca4d('0x4a')]['id']){delete _0x3bba4d[_0xca4d('0x4a')]['id'];}return db[_0xca4d('0x3f')][_0xca4d('0x48')]({'where':{'id':_0x3bba4d[_0xca4d('0x43')]['id']}})[_0xca4d('0x24')](handleEntityNotFound(_0x3f7dd6,null))[_0xca4d('0x24')](saveUpdates(_0x3bba4d[_0xca4d('0x4a')],null))[_0xca4d('0x24')](respondWithResult(_0x3f7dd6,null))[_0xca4d('0x41')](handleError(_0x3f7dd6,null));};exports[_0xca4d('0x25')]=function(_0x3b91d3,_0x5a3a45){return db[_0xca4d('0x3f')][_0xca4d('0x48')]({'where':{'id':_0x3b91d3['params']['id']}})['then'](handleEntityNotFound(_0x5a3a45,null))[_0xca4d('0x24')](removeEntity(_0x5a3a45,null))[_0xca4d('0x41')](handleError(_0x5a3a45,null));};exports[_0xca4d('0x4b')]=function(_0x250fda,_0x4679c0){return db[_0xca4d('0x3f')][_0xca4d('0x4b')]()['then'](respondWithResult(_0x4679c0,null))[_0xca4d('0x41')](handleError(_0x4679c0,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index a3b6027..9696a26 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 _0x7cc5=['api','path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports','define','JscriptyAnswerReport','report_jscripty_answers','lodash','util'];(function(_0x38a86c,_0xbffba4){var _0x7a5e15=function(_0x4f2ee2){while(--_0x4f2ee2){_0x38a86c['push'](_0x38a86c['shift']());}};_0x7a5e15(++_0xbffba4);}(_0x7cc5,0x82));var _0x57cc=function(_0x26fdfc,_0x5ede52){_0x26fdfc=_0x26fdfc-0x0;var _0x5c9e63=_0x7cc5[_0x26fdfc];return _0x5c9e63;};'use strict';var _=require(_0x57cc('0x0'));var util=require(_0x57cc('0x1'));var logger=require('../../config/logger')(_0x57cc('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x57cc('0x3'));var rimraf=require(_0x57cc('0x4'));var config=require(_0x57cc('0x5'));var attributes=require(_0x57cc('0x6'));module[_0x57cc('0x7')]=function(_0x1ee331,_0x555c20){return _0x1ee331[_0x57cc('0x8')](_0x57cc('0x9'),attributes,{'tableName':_0x57cc('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0d61=['../../config/logger','api','moment','request-promise','path','rimraf','./jscriptyAnswerReport.attributes','define','JscriptyAnswerReport'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0d61,0x1dd));var _0x10d6=function(_0x55157b,_0x19406b){_0x55157b=_0x55157b-0x0;var _0x2a2f2c=_0x0d61[_0x55157b];return _0x2a2f2c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x10d6('0x0'))(_0x10d6('0x1'));var moment=require(_0x10d6('0x2'));var BPromise=require('bluebird');var rp=require(_0x10d6('0x3'));var fs=require('fs');var path=require(_0x10d6('0x4'));var rimraf=require(_0x10d6('0x5'));var config=require('../../config/environment');var attributes=require(_0x10d6('0x6'));module['exports']=function(_0x12a7b9,_0x41b99d){return _0x12a7b9[_0x10d6('0x7')](_0x10d6('0x8'),attributes,{'tableName':'report_jscripty_answers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js index 2b3ab07..9d5182c 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 _0x6c19=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6c19,0x1b4));var _0x96c1=function(_0x296754,_0x5befe9){_0x296754=_0x296754-0x0;var _0x1d9f1d=_0x6c19[_0x296754];return _0x1d9f1d;};'use strict';var _=require(_0x96c1('0x0'));var util=require(_0x96c1('0x1'));var moment=require('moment');var BPromise=require(_0x96c1('0x2'));var rs=require(_0x96c1('0x3'));var fs=require('fs');var Redis=require(_0x96c1('0x4'));var db=require(_0x96c1('0x5'))['db'];var utils=require(_0x96c1('0x6'));var logger=require(_0x96c1('0x7'))(_0x96c1('0x8'));var config=require(_0x96c1('0x9'));var jayson=require(_0x96c1('0xa'));var client=jayson[_0x96c1('0xb')][_0x96c1('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xbf92c0,_0x5cb4df,_0x2fc7cb){return new BPromise(function(_0x5b174f,_0x86d490){return client[_0x96c1('0xd')](_0xbf92c0,_0x2fc7cb)[_0x96c1('0xe')](function(_0x2da3f7){logger[_0x96c1('0xf')](_0x96c1('0x10'),_0x5cb4df,_0x96c1('0x11'));logger[_0x96c1('0x12')](_0x96c1('0x13'),_0x5cb4df,_0x96c1('0x11'),JSON[_0x96c1('0x14')](_0x2da3f7));if(_0x2da3f7[_0x96c1('0x15')]){if(_0x2da3f7[_0x96c1('0x15')][_0x96c1('0x16')]===0x1f4){logger[_0x96c1('0x15')](_0x96c1('0x10'),_0x5cb4df,_0x2da3f7['error'][_0x96c1('0x17')]);return _0x86d490(_0x2da3f7['error']['message']);}logger[_0x96c1('0x15')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x5cb4df,_0x2da3f7[_0x96c1('0x15')]['message']);return _0x5b174f(_0x2da3f7[_0x96c1('0x15')][_0x96c1('0x17')]);}else{logger[_0x96c1('0xf')](_0x96c1('0x10'),_0x5cb4df,'request\x20sent');_0x5b174f(_0x2da3f7[_0x96c1('0x18')][_0x96c1('0x17')]);}})[_0x96c1('0x19')](function(_0x5b2ceb){logger[_0x96c1('0x15')](_0x96c1('0x10'),_0x5cb4df,_0x5b2ceb);_0x86d490(_0x5b2ceb);});});} \ No newline at end of file +var _0x7bc5=['code','message','info','catch','lodash','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0xe36e9d,_0x31e7a3){var _0xe596f3=function(_0x5dc713){while(--_0x5dc713){_0xe36e9d['push'](_0xe36e9d['shift']());}};_0xe596f3(++_0x31e7a3);}(_0x7bc5,0x7c));var _0x57bc=function(_0x14e9f0,_0x287f90){_0x14e9f0=_0x14e9f0-0x0;var _0xa63f7e=_0x7bc5[_0x14e9f0];return _0xa63f7e;};'use strict';var _=require(_0x57bc('0x0'));var util=require('util');var moment=require(_0x57bc('0x1'));var BPromise=require(_0x57bc('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x57bc('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x57bc('0x4'))(_0x57bc('0x5'));var config=require(_0x57bc('0x6'));var jayson=require(_0x57bc('0x7'));var client=jayson['client'][_0x57bc('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x74e816,_0x174b9e,_0x2fe491){return new BPromise(function(_0x2b9602,_0x217af6){return client[_0x57bc('0x9')](_0x74e816,_0x2fe491)['then'](function(_0x3868d9){logger['info'](_0x57bc('0xa'),_0x174b9e,_0x57bc('0xb'));logger[_0x57bc('0xc')](_0x57bc('0xd'),_0x174b9e,_0x57bc('0xb'),JSON[_0x57bc('0xe')](_0x3868d9));if(_0x3868d9['error']){if(_0x3868d9[_0x57bc('0xf')][_0x57bc('0x10')]===0x1f4){logger[_0x57bc('0xf')](_0x57bc('0xa'),_0x174b9e,_0x3868d9[_0x57bc('0xf')][_0x57bc('0x11')]);return _0x217af6(_0x3868d9[_0x57bc('0xf')][_0x57bc('0x11')]);}logger[_0x57bc('0xf')](_0x57bc('0xa'),_0x174b9e,_0x3868d9['error'][_0x57bc('0x11')]);return _0x2b9602(_0x3868d9['error']['message']);}else{logger[_0x57bc('0x12')](_0x57bc('0xa'),_0x174b9e,_0x57bc('0xb'));_0x2b9602(_0x3868d9['result'][_0x57bc('0x11')]);}})[_0x57bc('0x13')](function(_0x57f2b6){logger[_0x57bc('0xf')](_0x57bc('0xa'),_0x174b9e,_0x57f2b6);_0x217af6(_0x57f2b6);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index ac76328..8fb3703 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 _0x1bae=['/:id','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','index','/:id/sessions','getSessions','/:id/answers','getAnswers','/:id/summary','30s','getSummary','post','create','/:id/clone','clone','put'];(function(_0x125425,_0x4b6bab){var _0xd04dc4=function(_0x37fc01){while(--_0x37fc01){_0x125425['push'](_0x125425['shift']());}};_0xd04dc4(++_0x4b6bab);}(_0x1bae,0x109));var _0xe1ba=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x1bae[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xe1ba('0x0'));var util=require(_0xe1ba('0x1'));var path=require(_0xe1ba('0x2'));var timeout=require(_0xe1ba('0x3'));var express=require(_0xe1ba('0x4'));var router=express[_0xe1ba('0x5')]();var fs_extra=require(_0xe1ba('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xe1ba('0x7'));var config=require(_0xe1ba('0x8'));var controller=require(_0xe1ba('0x9'));router[_0xe1ba('0xa')]('/',auth[_0xe1ba('0xb')](),controller[_0xe1ba('0xc')]);router[_0xe1ba('0xa')]('/:id',auth[_0xe1ba('0xb')](),controller['show']);router['get'](_0xe1ba('0xd'),auth[_0xe1ba('0xb')](),controller[_0xe1ba('0xe')]);router[_0xe1ba('0xa')](_0xe1ba('0xf'),auth['isAuthenticated'](),controller[_0xe1ba('0x10')]);router['get'](_0xe1ba('0x11'),auth[_0xe1ba('0xb')](),timeout(_0xe1ba('0x12')),controller[_0xe1ba('0x13')]);router[_0xe1ba('0x14')]('/',auth['isAuthenticated'](),controller[_0xe1ba('0x15')]);router[_0xe1ba('0x14')](_0xe1ba('0x16'),auth[_0xe1ba('0xb')](),controller[_0xe1ba('0x17')]);router[_0xe1ba('0x18')](_0xe1ba('0x19'),auth['isAuthenticated'](),controller[_0xe1ba('0x1a')]);router['delete'](_0xe1ba('0x19'),auth['isAuthenticated'](),controller[_0xe1ba('0x1b')]);module[_0xe1ba('0x1c')]=router; \ No newline at end of file +var _0x3e81=['create','/:id/clone','/:id','delete','exports','multer','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyProject.controller','get','/:id/sessions','getSessions','/:id/answers','getAnswers','/:id/summary','isAuthenticated','30s','post'];(function(_0x33b259,_0x2036be){var _0xf95548=function(_0x5b3424){while(--_0x5b3424){_0x33b259['push'](_0x33b259['shift']());}};_0xf95548(++_0x2036be);}(_0x3e81,0x1d3));var _0x13e8=function(_0x180fc8,_0x169157){_0x180fc8=_0x180fc8-0x0;var _0x411749=_0x3e81[_0x180fc8];return _0x411749;};'use strict';var multer=require(_0x13e8('0x0'));var util=require(_0x13e8('0x1'));var path=require('path');var timeout=require(_0x13e8('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x13e8('0x3'));var auth=require(_0x13e8('0x4'));var interaction=require(_0x13e8('0x5'));var config=require('../../config/environment');var controller=require(_0x13e8('0x6'));router[_0x13e8('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x13e8('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router['get'](_0x13e8('0x8'),auth['isAuthenticated'](),controller[_0x13e8('0x9')]);router['get'](_0x13e8('0xa'),auth['isAuthenticated'](),controller[_0x13e8('0xb')]);router[_0x13e8('0x7')](_0x13e8('0xc'),auth[_0x13e8('0xd')](),timeout(_0x13e8('0xe')),controller['getSummary']);router[_0x13e8('0xf')]('/',auth[_0x13e8('0xd')](),controller[_0x13e8('0x10')]);router[_0x13e8('0xf')](_0x13e8('0x11'),auth[_0x13e8('0xd')](),controller['clone']);router['put'](_0x13e8('0x12'),auth[_0x13e8('0xd')](),controller['update']);router[_0x13e8('0x13')](_0x13e8('0x12'),auth['isAuthenticated'](),controller['destroy']);module[_0x13e8('0x14')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 9a09835..20a0e75 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 _0x7501=['util','exports','STRING','name','TEXT','long','isObjectLike','setDataValue','formData','stringify','isString','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','lodash'];(function(_0x4772e0,_0x1072a2){var _0x8797f0=function(_0x24d04f){while(--_0x24d04f){_0x4772e0['push'](_0x4772e0['shift']());}};_0x8797f0(++_0x1072a2);}(_0x7501,0x6f));var _0x1750=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0x7501[_0x255d5b];return _0x3e141a;};'use strict';var Sequelize=require('sequelize');var _=require(_0x1750('0x0'));var util=require(_0x1750('0x1'));module[_0x1750('0x2')]={'name':{'type':Sequelize[_0x1750('0x3')],'unique':_0x1750('0x4')},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0x1750('0x5')](_0x1750('0x6')),'set':function(_0x26899b){if(_[_0x1750('0x7')](_0x26899b)){this[_0x1750('0x8')](_0x1750('0x9'),JSON[_0x1750('0xa')](_0x26899b));}else if(_[_0x1750('0xb')](_0x26899b)){this['setDataValue'](_0x1750('0x9'),_0x26899b);}else{this[_0x1750('0x8')](_0x1750('0x9'),util['format'](_0x1750('0xc'),this['getDataValue']('name')||'',this[_0x1750('0xd')](_0x1750('0xe'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x1750('0xf')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x1750('0xf')],'defaultValue':![]}}; \ No newline at end of file +var _0xca37=['formData','isString','setDataValue','getDataValue','BOOLEAN','sequelize','util','exports','name','STRING','TEXT','isObjectLike'];(function(_0x1a687f,_0x14bf1d){var _0x2d6acb=function(_0x1a6a8c){while(--_0x1a6a8c){_0x1a687f['push'](_0x1a687f['shift']());}};_0x2d6acb(++_0x14bf1d);}(_0xca37,0x1c1));var _0x7ca3=function(_0x3637ce,_0x39aa5a){_0x3637ce=_0x3637ce-0x0;var _0x357c17=_0xca37[_0x3637ce];return _0x357c17;};'use strict';var Sequelize=require(_0x7ca3('0x0'));var _=require('lodash');var util=require(_0x7ca3('0x1'));module[_0x7ca3('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0x7ca3('0x3')},'description':{'type':Sequelize[_0x7ca3('0x4')]},'formData':{'type':Sequelize[_0x7ca3('0x5')]('long'),'set':function(_0x5a9c38){if(_[_0x7ca3('0x6')](_0x5a9c38)){this['setDataValue'](_0x7ca3('0x7'),JSON['stringify'](_0x5a9c38));}else if(_[_0x7ca3('0x8')](_0x5a9c38)){this[_0x7ca3('0x9')](_0x7ca3('0x7'),_0x5a9c38);}else{this['setDataValue']('formData',util['format']('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this[_0x7ca3('0xa')](_0x7ca3('0x3'))||'',this[_0x7ca3('0xa')]('description')||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x7ca3('0xb')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x7ca3('0xb')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index aab78fe..057e6bc 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 _0x4628=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','then','get','Projects','UserProfileResource','error','stack','name','send','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','pick','where','VIRTUAL','filter','merge','options','JscriptyProject','include','rows','params','fields','includeAll','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','updatedAt','createdAt','UserProfileSection','findOne','nolimit','order','sort','ProjectId','JscriptySessionReport','findAll','getAnswers','JscriptyAnswerReport','number','toString','indexOf','replace','getSummary','startTime','parse','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','isEmpty','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','Content-disposition','setHeader','text/csv','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','desk.js','ioredis'];(function(_0x5561e8,_0x4a5fd3){var _0x56d3bc=function(_0x617385){while(--_0x617385){_0x5561e8['push'](_0x5561e8['shift']());}};_0x56d3bc(++_0x4a5fd3);}(_0x4628,0xd3));var _0x8462=function(_0x398832,_0x3f0efb){_0x398832=_0x398832-0x0;var _0x29e357=_0x4628[_0x398832];return _0x29e357;};'use strict';var emlformat=require(_0x8462('0x0'));var rimraf=require(_0x8462('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8462('0x2'));var rp=require(_0x8462('0x3'));var moment=require(_0x8462('0x4'));var BPromise=require(_0x8462('0x5'));var Mustache=require(_0x8462('0x6'));var util=require('util');var path=require(_0x8462('0x7'));var sox=require(_0x8462('0x8'));var csv=require(_0x8462('0x9'));var ejs=require(_0x8462('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8462('0xb'));var squel=require('squel');var crypto=require(_0x8462('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x8462('0xd'));var toCsv=require(_0x8462('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8462('0xe'));var authService=require(_0x8462('0xf'));var qs=require(_0x8462('0x10'));var as=require(_0x8462('0x11'));var hardwareService=require(_0x8462('0x12'));var logger=require(_0x8462('0x13'))('api');var utils=require(_0x8462('0x14'));var config=require(_0x8462('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x8462('0x16'))['db'];function respondWithStatusCode(_0x53877d,_0x54a0ff){_0x54a0ff=_0x54a0ff||0xcc;return function(_0x56cca2){if(_0x56cca2){return _0x53877d[_0x8462('0x17')](_0x54a0ff);}return _0x53877d[_0x8462('0x18')](_0x54a0ff)[_0x8462('0x19')]();};}function respondWithResult(_0x57be34,_0x2afbf5){_0x2afbf5=_0x2afbf5||0xc8;return function(_0x14cbd2){if(_0x14cbd2){return _0x57be34[_0x8462('0x18')](_0x2afbf5)[_0x8462('0x1a')](_0x14cbd2);}};}function respondWithFilteredResult(_0x4e6a68,_0x3be4b8){return function(_0x3a19a9){if(_0x3a19a9){var _0x4f3824=typeof _0x3be4b8[_0x8462('0x1b')]===_0x8462('0x1c')&&typeof _0x3be4b8[_0x8462('0x1d')]===_0x8462('0x1c');var _0x49ef1f=_0x3a19a9[_0x8462('0x1e')];var _0x1f5d3e=_0x4f3824?0x0:_0x3be4b8[_0x8462('0x1b')];var _0x105897=_0x4f3824?_0x3a19a9[_0x8462('0x1e')]:_0x3be4b8['offset']+_0x3be4b8['limit'];var _0xf1686c;if(_0x105897>=_0x49ef1f){_0x105897=_0x49ef1f;_0xf1686c=0xc8;}else{_0xf1686c=0xce;}_0x4e6a68[_0x8462('0x18')](_0xf1686c);return _0x4e6a68[_0x8462('0x1f')](_0x8462('0x20'),_0x1f5d3e+'-'+_0x105897+'/'+_0x49ef1f)['json'](_0x3a19a9);}return null;};}function patchUpdates(_0x490dcb){return function(_0xad863d){try{jsonpatch[_0x8462('0x21')](_0xad863d,_0x490dcb,!![]);}catch(_0x2714f1){return BPromise[_0x8462('0x22')](_0x2714f1);}return _0xad863d[_0x8462('0x23')]();};}function saveUpdates(_0x5d64ea,_0x22d1c0){return function(_0x5446b7){if(_0x5446b7){return _0x5446b7['update'](_0x5d64ea)['then'](function(_0x567805){return _0x567805;});}return null;};}function removeEntity(_0x3a09f1,_0x9f0860){return function(_0x3a26bf){if(_0x3a26bf){return _0x3a26bf[_0x8462('0x24')]()[_0x8462('0x25')](function(){var _0x3c3cfb=_0x3a26bf[_0x8462('0x26')]({'plain':!![]});var _0x5ca724=_0x8462('0x27');return db[_0x8462('0x28')][_0x8462('0x24')]({'where':{'type':_0x5ca724,'resourceId':_0x3c3cfb['id']}})[_0x8462('0x25')](function(){return _0x3a26bf;});})[_0x8462('0x25')](function(){_0x3a09f1[_0x8462('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e50a0,_0x593681){return function(_0x3c9d95){if(!_0x3c9d95){_0x5e50a0[_0x8462('0x17')](0x194);}return _0x3c9d95;};}function handleError(_0x5efacd,_0x1eac49){_0x1eac49=_0x1eac49||0x1f4;return function(_0x3e4e30){logger[_0x8462('0x29')](_0x3e4e30[_0x8462('0x2a')]);if(_0x3e4e30['name']){delete _0x3e4e30[_0x8462('0x2b')];}_0x5efacd['status'](_0x1eac49)[_0x8462('0x2c')](_0x3e4e30);};}exports['index']=function(_0x4541c8,_0x52d278){var _0x5994f0={},_0x11cab6={},_0x45efda={'count':0x0,'rows':[]};var _0x397535=_[_0x8462('0x2d')](db['JscriptyProject'][_0x8462('0x2e')],function(_0x321435){return{'name':_0x321435[_0x8462('0x2f')],'type':_0x321435['type'][_0x8462('0x30')]};});_0x11cab6[_0x8462('0x31')]=_['map'](_0x397535,_0x8462('0x2b'));_0x11cab6[_0x8462('0x32')]=_[_0x8462('0x33')](_0x4541c8[_0x8462('0x32')]);_0x11cab6[_0x8462('0x34')]=_[_0x8462('0x35')](_0x11cab6[_0x8462('0x31')],_0x11cab6[_0x8462('0x32')]);_0x5994f0['attributes']=_[_0x8462('0x35')](_0x11cab6[_0x8462('0x31')],qs['fields'](_0x4541c8[_0x8462('0x32')]['fields']));_0x5994f0[_0x8462('0x36')]=_0x5994f0['attributes'][_0x8462('0x37')]?_0x5994f0[_0x8462('0x36')]:_0x11cab6[_0x8462('0x31')];if(!_0x4541c8[_0x8462('0x32')][_0x8462('0x38')]('nolimit')){_0x5994f0[_0x8462('0x1d')]=qs[_0x8462('0x1d')](_0x4541c8[_0x8462('0x32')]['limit']);_0x5994f0[_0x8462('0x1b')]=qs[_0x8462('0x1b')](_0x4541c8['query'][_0x8462('0x1b')]);}_0x5994f0['order']=qs['sort'](_0x4541c8[_0x8462('0x32')]['sort']);_0x5994f0['where']=qs[_0x8462('0x34')](_[_0x8462('0x39')](_0x4541c8[_0x8462('0x32')],_0x11cab6['filters']),_0x397535);if(_0x4541c8[_0x8462('0x32')]['filter']){_0x5994f0[_0x8462('0x3a')]=_['merge'](_0x5994f0[_0x8462('0x3a')],{'$or':_[_0x8462('0x2d')](_0x397535,function(_0xf2a600){if(_0xf2a600['type']!==_0x8462('0x3b')){var _0x180d6b={};_0x180d6b[_0xf2a600[_0x8462('0x2b')]]={'$like':'%'+_0x4541c8[_0x8462('0x32')][_0x8462('0x3c')]+'%'};return _0x180d6b;}})});}_0x5994f0=_[_0x8462('0x3d')]({},_0x5994f0,_0x4541c8[_0x8462('0x3e')]);var _0x43c247={'where':_0x5994f0[_0x8462('0x3a')]};return db[_0x8462('0x3f')][_0x8462('0x1e')](_0x43c247)[_0x8462('0x25')](function(_0x459c6c){_0x45efda[_0x8462('0x1e')]=_0x459c6c;if(_0x4541c8['query']['includeAll']){_0x5994f0[_0x8462('0x40')]=[{'all':!![]}];}return db[_0x8462('0x3f')]['findAll'](_0x5994f0);})[_0x8462('0x25')](function(_0xfa0916){_0x45efda[_0x8462('0x41')]=_0xfa0916;return _0x45efda;})[_0x8462('0x25')](respondWithFilteredResult(_0x52d278,_0x5994f0))['catch'](handleError(_0x52d278,null));};exports['show']=function(_0x228239,_0x359961){var _0x734f2a={'raw':![],'where':{'id':_0x228239[_0x8462('0x42')]['id']}},_0x347d3b={};_0x347d3b[_0x8462('0x31')]=_[_0x8462('0x33')](db['JscriptyProject']['rawAttributes']);_0x347d3b[_0x8462('0x32')]=_['keys'](_0x228239['query']);_0x347d3b['filters']=_[_0x8462('0x35')](_0x347d3b[_0x8462('0x31')],_0x347d3b[_0x8462('0x32')]);_0x734f2a[_0x8462('0x36')]=_[_0x8462('0x35')](_0x347d3b[_0x8462('0x31')],qs[_0x8462('0x43')](_0x228239['query']['fields']));_0x734f2a[_0x8462('0x36')]=_0x734f2a['attributes']['length']?_0x734f2a[_0x8462('0x36')]:_0x347d3b['model'];if(_0x228239['query'][_0x8462('0x44')]){_0x734f2a[_0x8462('0x40')]=[{'all':!![]}];}_0x734f2a=_[_0x8462('0x3d')]({},_0x734f2a,_0x228239[_0x8462('0x3e')]);return db[_0x8462('0x3f')][_0x8462('0x45')](_0x734f2a)[_0x8462('0x25')](handleEntityNotFound(_0x359961,null))[_0x8462('0x25')](respondWithResult(_0x359961,null))[_0x8462('0x46')](handleError(_0x359961,null));};exports['create']=function(_0x362eb9,_0x23f4a2){return db['JscriptyProject'][_0x8462('0x47')](_0x362eb9[_0x8462('0x48')],{})[_0x8462('0x25')](function(_0x11cf22){var _0x4d3a2f=_0x362eb9['user'][_0x8462('0x26')]({'plain':!![]});if(!_0x4d3a2f)throw new Error(_0x8462('0x49'));if(_0x4d3a2f[_0x8462('0x4a')]===_0x8462('0x4b')){var _0x45abbc=_0x11cf22[_0x8462('0x26')]({'plain':!![]});var _0x1f8777=_0x8462('0x27');return db['UserProfileSection'][_0x8462('0x45')]({'where':{'name':_0x1f8777,'userProfileId':_0x4d3a2f[_0x8462('0x4c')]},'raw':!![]})['then'](function(_0x5bc102){if(_0x5bc102&&_0x5bc102[_0x8462('0x4d')]===0x0){return db[_0x8462('0x28')][_0x8462('0x47')]({'name':_0x45abbc[_0x8462('0x2b')],'resourceId':_0x45abbc['id'],'type':_0x5bc102[_0x8462('0x2b')],'sectionId':_0x5bc102['id']},{})[_0x8462('0x25')](function(){return _0x11cf22;});}else{return _0x11cf22;}})[_0x8462('0x46')](function(_0x21d43e){logger[_0x8462('0x29')](_0x8462('0x4e'),_0x21d43e);throw _0x21d43e;});}return _0x11cf22;})[_0x8462('0x25')](respondWithResult(_0x23f4a2,0xc9))['catch'](handleError(_0x23f4a2,null));};exports[_0x8462('0x4f')]=function(_0x550f77,_0x52f3cb){var _0x232537={'where':{'id':_0x550f77['params']['id']}},_0x43bdf5={};_0x43bdf5[_0x8462('0x31')]=_['keys'](db[_0x8462('0x3f')][_0x8462('0x2e')]);_0x232537[_0x8462('0x36')]=_[_0x8462('0x35')](_0x43bdf5[_0x8462('0x31')],qs['fields'](_0x550f77[_0x8462('0x32')][_0x8462('0x43')]));_0x232537[_0x8462('0x36')]=_0x232537['attributes']['length']?_0x232537['attributes']:_0x43bdf5[_0x8462('0x31')];if(_0x550f77[_0x8462('0x32')][_0x8462('0x44')]){_0x232537[_0x8462('0x40')]=[{'all':!![]}];}_0x232537=_['merge']({},_0x232537,_0x550f77[_0x8462('0x3e')]);return db[_0x8462('0x3f')][_0x8462('0x45')](_0x232537)[_0x8462('0x25')](handleEntityNotFound(_0x52f3cb,null))[_0x8462('0x25')](function(_0x51634b){if(_0x51634b){var _0x1a4a14=_0x51634b[_0x8462('0x26')]({'plain':!![]});_0x1a4a14=qs[_0x8462('0x50')](_0x1a4a14,['id','createdAt',_0x8462('0x51')]);_0x550f77[_0x8462('0x48')]=_[_0x8462('0x50')](_0x550f77[_0x8462('0x48')],['id',_0x8462('0x52'),'updatedAt']);return db['JscriptyProject']['create'](_[_0x8462('0x3d')](_0x1a4a14,_0x550f77['body']),{'include':_0x550f77['query'][_0x8462('0x44')]?[{'all':!![]}]:undefined})[_0x8462('0x25')](function(_0x40161f){var _0x3547de=_0x550f77['user'][_0x8462('0x26')]({'plain':!![]});if(!_0x3547de)throw new Error(_0x8462('0x49'));if(_0x3547de['role']==='user'){var _0x38a245=_0x40161f[_0x8462('0x26')]({'plain':!![]});var _0x9b90c3=_0x8462('0x27');return db[_0x8462('0x53')][_0x8462('0x45')]({'where':{'name':_0x9b90c3,'userProfileId':_0x3547de['userProfileId']},'raw':!![]})[_0x8462('0x25')](function(_0x333d4d){if(_0x333d4d&&_0x333d4d[_0x8462('0x4d')]===0x0){return db[_0x8462('0x28')][_0x8462('0x47')]({'name':_0x38a245[_0x8462('0x2b')],'resourceId':_0x38a245['id'],'type':_0x333d4d['name'],'sectionId':_0x333d4d['id']},{})[_0x8462('0x25')](function(){return _0x40161f;});}else{return _0x40161f;}})[_0x8462('0x46')](function(_0x497460){logger[_0x8462('0x29')](_0x8462('0x4e'),_0x497460);throw _0x497460;});}return _0x40161f;});}})['then'](respondWithResult(_0x52f3cb,0xc9))[_0x8462('0x46')](handleError(_0x52f3cb,null));};exports['update']=function(_0x1e0c7d,_0x4868d6){if(_0x1e0c7d['body']['id']){delete _0x1e0c7d[_0x8462('0x48')]['id'];}return db[_0x8462('0x3f')][_0x8462('0x45')]({'where':{'id':_0x1e0c7d['params']['id']}})[_0x8462('0x25')](handleEntityNotFound(_0x4868d6,null))[_0x8462('0x25')](saveUpdates(_0x1e0c7d[_0x8462('0x48')],null))[_0x8462('0x25')](respondWithResult(_0x4868d6,null))['catch'](handleError(_0x4868d6,null));};exports['destroy']=function(_0x5cbe81,_0x506ef0){return db[_0x8462('0x3f')]['find']({'where':{'id':_0x5cbe81[_0x8462('0x42')]['id']}})[_0x8462('0x25')](handleEntityNotFound(_0x506ef0,null))['then'](removeEntity(_0x506ef0,null))['catch'](handleError(_0x506ef0,null));};exports['getSessions']=function(_0x4ebbc0,_0x4f3ba6,_0x28b3c6){var _0x4a1d86={'raw':!![],'where':{}};var _0x2d1cdf={};var _0x5a7b81={'count':0x0,'rows':[]};return db['JscriptyProject'][_0x8462('0x54')]({'where':{'id':_0x4ebbc0['params']['id']}})[_0x8462('0x25')](handleEntityNotFound(_0x4f3ba6,null))[_0x8462('0x25')](function(_0x3df75b){if(_0x3df75b){_0x2d1cdf[_0x8462('0x31')]=_[_0x8462('0x33')](db['JscriptySessionReport'][_0x8462('0x2e')]);_0x2d1cdf[_0x8462('0x32')]=_[_0x8462('0x33')](_0x4ebbc0[_0x8462('0x32')]);_0x2d1cdf[_0x8462('0x34')]=_['intersection'](_0x2d1cdf['model'],_0x2d1cdf[_0x8462('0x32')]);_0x4a1d86['attributes']=_[_0x8462('0x35')](_0x2d1cdf['model'],qs[_0x8462('0x43')](_0x4ebbc0[_0x8462('0x32')][_0x8462('0x43')]));_0x4a1d86[_0x8462('0x36')]=_0x4a1d86[_0x8462('0x36')]['length']?_0x4a1d86['attributes']:_0x2d1cdf[_0x8462('0x31')];if(!_0x4ebbc0[_0x8462('0x32')][_0x8462('0x38')](_0x8462('0x55'))){_0x4a1d86[_0x8462('0x1d')]=qs['limit'](_0x4ebbc0[_0x8462('0x32')][_0x8462('0x1d')]);_0x4a1d86[_0x8462('0x1b')]=qs[_0x8462('0x1b')](_0x4ebbc0[_0x8462('0x32')][_0x8462('0x1b')]);}_0x4a1d86[_0x8462('0x56')]=qs[_0x8462('0x57')](_0x4ebbc0[_0x8462('0x32')]['sort']);_0x4a1d86[_0x8462('0x3a')]=qs[_0x8462('0x34')](_[_0x8462('0x39')](_0x4ebbc0['query'],_0x2d1cdf[_0x8462('0x34')]));_0x4a1d86[_0x8462('0x3a')][_0x8462('0x58')]=_0x3df75b['id'];if(_0x4ebbc0[_0x8462('0x32')]['filter']){_0x4a1d86[_0x8462('0x3a')]=_['merge'](_0x4a1d86[_0x8462('0x3a')],{'$or':_[_0x8462('0x2d')](_0x4a1d86['attributes'],function(_0x30ba22){var _0x38e00f={};_0x38e00f[_0x30ba22]={'$like':'%'+_0x4ebbc0[_0x8462('0x32')][_0x8462('0x3c')]+'%'};return _0x38e00f;})});}_0x4a1d86=_[_0x8462('0x3d')]({},_0x4a1d86,_0x4ebbc0['options']);return db[_0x8462('0x59')][_0x8462('0x1e')]({'where':_0x4a1d86[_0x8462('0x3a')]})[_0x8462('0x25')](function(_0x282223){_0x5a7b81[_0x8462('0x1e')]=_0x282223;if(_0x4ebbc0['query']['includeAll']){_0x4a1d86['include']=[{'all':!![]}];}return db[_0x8462('0x59')][_0x8462('0x5a')](_0x4a1d86);})['then'](function(_0x1fda22){_0x5a7b81['rows']=_0x1fda22;return _0x5a7b81;});}})[_0x8462('0x25')](respondWithFilteredResult(_0x4f3ba6,_0x4a1d86))[_0x8462('0x46')](handleError(_0x4f3ba6,null));};exports[_0x8462('0x5b')]=function(_0x8031c5,_0x1aa232,_0x1354e1){var _0x59c37e={'raw':!![],'where':{}};var _0x461001={};var _0x3fefdd={'count':0x0,'rows':[]};return db[_0x8462('0x3f')][_0x8462('0x54')]({'where':{'id':_0x8031c5[_0x8462('0x42')]['id']}})[_0x8462('0x25')](handleEntityNotFound(_0x1aa232,null))[_0x8462('0x25')](function(_0x63c73d){if(_0x63c73d){_0x461001['model']=_[_0x8462('0x33')](db[_0x8462('0x5c')][_0x8462('0x2e')]);_0x461001[_0x8462('0x32')]=_[_0x8462('0x33')](_0x8031c5[_0x8462('0x32')]);_0x461001['filters']=_['intersection'](_0x461001[_0x8462('0x31')],_0x461001[_0x8462('0x32')]);_0x59c37e[_0x8462('0x36')]=_['intersection'](_0x461001['model'],qs[_0x8462('0x43')](_0x8031c5[_0x8462('0x32')][_0x8462('0x43')]));_0x59c37e['attributes']=_0x59c37e['attributes'][_0x8462('0x37')]?_0x59c37e[_0x8462('0x36')]:_0x461001[_0x8462('0x31')];if(!_0x8031c5[_0x8462('0x32')][_0x8462('0x38')](_0x8462('0x55'))){_0x59c37e[_0x8462('0x1d')]=qs[_0x8462('0x1d')](_0x8031c5[_0x8462('0x32')]['limit']);_0x59c37e['offset']=qs[_0x8462('0x1b')](_0x8031c5[_0x8462('0x32')][_0x8462('0x1b')]);}_0x59c37e[_0x8462('0x56')]=qs[_0x8462('0x57')](_0x8031c5[_0x8462('0x32')][_0x8462('0x57')]);_0x59c37e[_0x8462('0x3a')]=qs[_0x8462('0x34')](_['pick'](_0x8031c5[_0x8462('0x32')],_0x461001['filters']));_0x59c37e[_0x8462('0x3a')][_0x8462('0x58')]=_0x63c73d['id'];if(_0x8031c5[_0x8462('0x32')][_0x8462('0x3c')]){_0x59c37e['where']=_[_0x8462('0x3d')](_0x59c37e[_0x8462('0x3a')],{'$or':_['map'](_0x59c37e[_0x8462('0x36')],function(_0x22307e){var _0x453e61={};_0x453e61[_0x22307e]={'$like':'%'+_0x8031c5[_0x8462('0x32')][_0x8462('0x3c')]+'%'};return _0x453e61;})});}_0x59c37e=_['merge']({},_0x59c37e,_0x8031c5['options']);return db['JscriptyAnswerReport'][_0x8462('0x1e')]({'where':_0x59c37e[_0x8462('0x3a')]})['then'](function(_0x2ca997){_0x3fefdd[_0x8462('0x1e')]=_0x2ca997;if(_0x8031c5[_0x8462('0x32')][_0x8462('0x44')]){_0x59c37e[_0x8462('0x40')]=[{'all':!![]}];}return db[_0x8462('0x5c')][_0x8462('0x5a')](_0x59c37e);})[_0x8462('0x25')](function(_0x2803e2){_0x3fefdd[_0x8462('0x41')]=_0x2803e2;return _0x3fefdd;});}})[_0x8462('0x25')](respondWithFilteredResult(_0x1aa232,_0x59c37e))[_0x8462('0x46')](handleError(_0x1aa232,null));};function char(_0x36b6fe){return _0x8462('0x5d')===typeof _0x36b6fe?String['fromCharCode'][_0x8462('0x21')](null,arguments):_0x36b6fe;}function needsEncapsulation(_0x5ab8dd){return!!_0x5ab8dd&&(_0x5ab8dd[_0x8462('0x5e')]()[_0x8462('0x5f')](char(0xd))>=0x0||_0x5ab8dd[_0x8462('0x5e')]()[_0x8462('0x5f')](char(0xa))>=0x0||_0x5ab8dd['toString']()['indexOf'](char(0x2c))>=0x0||_0x5ab8dd[_0x8462('0x5e')]()[_0x8462('0x5f')](char(0x22))>=0x0);}function encapsulate(_0x2c617d){var _0x1d8ca8=char(0x22),_0x43f789='\x5c'+char(0x22),_0x1cc019=_0x2c617d['toString']()[_0x8462('0x60')](new RegExp(_0x1d8ca8,'g'),_0x43f789);return _0x1d8ca8+_0x1cc019+_0x1d8ca8;}exports[_0x8462('0x61')]=function(_0x357273,_0x4165bc,_0x1f4273){var _0x4410de,_0x425207;var _0x2b5b3a={'where':{'ProjectId':_0x357273[_0x8462('0x42')]['id']}};if(_0x357273[_0x8462('0x32')][_0x8462('0x62')]){_0x2b5b3a[_0x8462('0x3a')]['starttime']=JSON[_0x8462('0x63')](_0x357273[_0x8462('0x32')]['startTime']);}return db[_0x8462('0x59')][_0x8462('0x5a')](_0x2b5b3a)[_0x8462('0x25')](handleEntityNotFound(_0x4165bc,null))[_0x8462('0x25')](function(_0x3d4edc){if(_0x3d4edc){_0x4410de=_0x3d4edc;return db['JscriptyQuestionReport']['findAll']({'where':{'SessionId':{'$in':_[_0x8462('0x2d')](_0x4410de,'id')},'ProjectId':_0x357273[_0x8462('0x42')]['id']},'order':'-createdAt'});}})[_0x8462('0x25')](handleEntityNotFound(_0x4165bc,null))['then'](function(_0x56bf29){if(_0x56bf29){_0x425207=_0x56bf29;var _0x57b650={};for(var _0x4c5257=0x0,_0xc4fd3a=_0x425207['length'];_0x4c5257<_0xc4fd3a;_0x4c5257++){if(!_0x57b650[_0x8462('0x38')](_0x425207[_0x4c5257][_0x8462('0x64')])){_0x57b650[_0x425207[_0x4c5257][_0x8462('0x64')]]=needsEncapsulation(_0x425207[_0x4c5257][_0x8462('0x65')])?encapsulate(_0x425207[_0x4c5257][_0x8462('0x65')]):_0x425207[_0x4c5257][_0x8462('0x65')];}}var _0xa2e61d=[],_0x29163a={};for(var _0x400b9c=0x0,_0x31c049=_0x4410de[_0x8462('0x37')];_0x400b9c<_0x31c049;_0x400b9c++){_0x29163a={'ProjectId':_0x357273['params']['id'],'SessionId':_0x4410de[_0x400b9c]['id'],'StartTime':moment(_0x4410de[_0x400b9c]['starttime'])[_0x8462('0x66')](_0x8462('0x67'))};for(var _0x1ec073=0x0,_0x4b652c=_0x425207[_0x8462('0x37')];_0x1ec073<_0x4b652c;_0x1ec073++){if(_0x425207[_0x1ec073][_0x8462('0x68')]==_0x4410de[_0x400b9c]['id']&&_0x57b650[_0x8462('0x38')](_0x425207[_0x1ec073][_0x8462('0x64')])){_0x29163a[_0x57b650[_0x425207[_0x1ec073][_0x8462('0x64')]]]=_0x425207[_0x1ec073][_0x8462('0x69')];}}for(var _0x3f1d42 in _0x57b650){if(!_0x29163a[_0x8462('0x38')](_0x57b650[_0x3f1d42])){_0x29163a[_0x57b650[_0x3f1d42]]=null;}}_0xa2e61d['push'](_0x29163a);}return _0xa2e61d;}})[_0x8462('0x25')](function(_0x2ee3c8){if(!_[_0x8462('0x6a')](_0x2ee3c8)){var _0x148813=toCsv(_0x2ee3c8);var _0x43fd01=Date[_0x8462('0x6b')]();fs[_0x8462('0x6c')](util[_0x8462('0x66')](_0x8462('0x6d'),_0x357273[_0x8462('0x42')]['id'],_0x43fd01),_0x148813);_0x4165bc['setHeader'](_0x8462('0x6e'),'attachment;\x20filename='+util[_0x8462('0x66')]('Jscripty_Project_%d_Summary_%s.csv',_0x357273[_0x8462('0x42')]['id'],_0x43fd01));_0x4165bc[_0x8462('0x6f')]('Content-type',_0x8462('0x70'));return _0x4165bc['download'](util[_0x8462('0x66')](_0x8462('0x6d'),_0x357273[_0x8462('0x42')]['id'],_0x43fd01));}else{return _0x4165bc[_0x8462('0x17')](0xcc);}})[_0x8462('0x46')](handleError(_0x4165bc,null));}; \ No newline at end of file +var _0x37e4=['getAnswers','JscriptyAnswerReport','hasOwnProperty','filter','number','fromCharCode','toString','indexOf','replace','startTime','starttime','parse','JscriptyQuestionReport','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','push','isEmpty','now','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','download','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','end','json','offset','undefined','limit','Content-Range','apply','save','update','then','destroy','UserProfileResource','error','stack','name','send','index','JscriptyProject','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','VIRTUAL','merge','count','includeAll','include','findAll','rows','catch','show','params','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Projects','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','getSessions','findOne','JscriptySessionReport','ProjectId','options'];(function(_0x4da300,_0x3c2f85){var _0x4b4f98=function(_0x3fd3bd){while(--_0x3fd3bd){_0x4da300['push'](_0x4da300['shift']());}};_0x4b4f98(++_0x3c2f85);}(_0x37e4,0x18e));var _0x437e=function(_0x1b9685,_0x41c1b4){_0x1b9685=_0x1b9685-0x0;var _0x226f0f=_0x37e4[_0x1b9685];return _0x226f0f;};'use strict';var emlformat=require(_0x437e('0x0'));var rimraf=require(_0x437e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x437e('0x2'));var rp=require(_0x437e('0x3'));var moment=require(_0x437e('0x4'));var BPromise=require(_0x437e('0x5'));var Mustache=require(_0x437e('0x6'));var util=require(_0x437e('0x7'));var path=require(_0x437e('0x8'));var sox=require(_0x437e('0x9'));var csv=require(_0x437e('0xa'));var ejs=require(_0x437e('0xb'));var fs=require('fs');var fs_extra=require(_0x437e('0xc'));var _=require(_0x437e('0xd'));var squel=require(_0x437e('0xe'));var crypto=require(_0x437e('0xf'));var jsforce=require(_0x437e('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x437e('0xa'));var querystring=require('querystring');var Papa=require(_0x437e('0x11'));var Redis=require(_0x437e('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x437e('0x13'));var as=require(_0x437e('0x14'));var hardwareService=require(_0x437e('0x15'));var logger=require(_0x437e('0x16'))(_0x437e('0x17'));var utils=require(_0x437e('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3182b9,_0x268d1a){_0x268d1a=_0x268d1a||0xcc;return function(_0x1bee2b){if(_0x1bee2b){return _0x3182b9[_0x437e('0x19')](_0x268d1a);}return _0x3182b9[_0x437e('0x1a')](_0x268d1a)[_0x437e('0x1b')]();};}function respondWithResult(_0x158cdb,_0x204e1a){_0x204e1a=_0x204e1a||0xc8;return function(_0x1629be){if(_0x1629be){return _0x158cdb[_0x437e('0x1a')](_0x204e1a)[_0x437e('0x1c')](_0x1629be);}};}function respondWithFilteredResult(_0x1bab5a,_0x128156){return function(_0x5b3f56){if(_0x5b3f56){var _0x355c78=typeof _0x128156[_0x437e('0x1d')]===_0x437e('0x1e')&&typeof _0x128156[_0x437e('0x1f')]===_0x437e('0x1e');var _0x4ba700=_0x5b3f56['count'];var _0x58ef0f=_0x355c78?0x0:_0x128156['offset'];var _0x4ea09b=_0x355c78?_0x5b3f56['count']:_0x128156[_0x437e('0x1d')]+_0x128156['limit'];var _0x567a1a;if(_0x4ea09b>=_0x4ba700){_0x4ea09b=_0x4ba700;_0x567a1a=0xc8;}else{_0x567a1a=0xce;}_0x1bab5a[_0x437e('0x1a')](_0x567a1a);return _0x1bab5a['set'](_0x437e('0x20'),_0x58ef0f+'-'+_0x4ea09b+'/'+_0x4ba700)[_0x437e('0x1c')](_0x5b3f56);}return null;};}function patchUpdates(_0x595925){return function(_0x12b7db){try{jsonpatch[_0x437e('0x21')](_0x12b7db,_0x595925,!![]);}catch(_0x185559){return BPromise['reject'](_0x185559);}return _0x12b7db[_0x437e('0x22')]();};}function saveUpdates(_0x5e2997,_0x5ac03e){return function(_0x438db7){if(_0x438db7){return _0x438db7[_0x437e('0x23')](_0x5e2997)[_0x437e('0x24')](function(_0x151e64){return _0x151e64;});}return null;};}function removeEntity(_0x25dfca,_0x48e9a8){return function(_0x362821){if(_0x362821){return _0x362821[_0x437e('0x25')]()['then'](function(){var _0x36dfeb=_0x362821['get']({'plain':!![]});var _0x31b8e8='Projects';return db[_0x437e('0x26')][_0x437e('0x25')]({'where':{'type':_0x31b8e8,'resourceId':_0x36dfeb['id']}})[_0x437e('0x24')](function(){return _0x362821;});})['then'](function(){_0x25dfca['status'](0xcc)[_0x437e('0x1b')]();});}};}function handleEntityNotFound(_0x3b7baf,_0x5c546f){return function(_0x5a224c){if(!_0x5a224c){_0x3b7baf[_0x437e('0x19')](0x194);}return _0x5a224c;};}function handleError(_0x15cb81,_0x541087){_0x541087=_0x541087||0x1f4;return function(_0x27a269){logger[_0x437e('0x27')](_0x27a269[_0x437e('0x28')]);if(_0x27a269[_0x437e('0x29')]){delete _0x27a269[_0x437e('0x29')];}_0x15cb81[_0x437e('0x1a')](_0x541087)[_0x437e('0x2a')](_0x27a269);};}exports[_0x437e('0x2b')]=function(_0x2c54c8,_0x2950de){var _0x148320={},_0x397a33={},_0x1fab11={'count':0x0,'rows':[]};var _0x420437=_['map'](db[_0x437e('0x2c')][_0x437e('0x2d')],function(_0x16bdf1){return{'name':_0x16bdf1[_0x437e('0x2e')],'type':_0x16bdf1[_0x437e('0x2f')][_0x437e('0x30')]};});_0x397a33[_0x437e('0x31')]=_[_0x437e('0x32')](_0x420437,_0x437e('0x29'));_0x397a33[_0x437e('0x33')]=_[_0x437e('0x34')](_0x2c54c8[_0x437e('0x33')]);_0x397a33[_0x437e('0x35')]=_[_0x437e('0x36')](_0x397a33['model'],_0x397a33['query']);_0x148320['attributes']=_[_0x437e('0x36')](_0x397a33[_0x437e('0x31')],qs[_0x437e('0x37')](_0x2c54c8[_0x437e('0x33')][_0x437e('0x37')]));_0x148320['attributes']=_0x148320[_0x437e('0x38')][_0x437e('0x39')]?_0x148320['attributes']:_0x397a33['model'];if(!_0x2c54c8[_0x437e('0x33')]['hasOwnProperty'](_0x437e('0x3a'))){_0x148320[_0x437e('0x1f')]=qs[_0x437e('0x1f')](_0x2c54c8['query'][_0x437e('0x1f')]);_0x148320[_0x437e('0x1d')]=qs[_0x437e('0x1d')](_0x2c54c8['query'][_0x437e('0x1d')]);}_0x148320[_0x437e('0x3b')]=qs[_0x437e('0x3c')](_0x2c54c8[_0x437e('0x33')]['sort']);_0x148320[_0x437e('0x3d')]=qs[_0x437e('0x35')](_[_0x437e('0x3e')](_0x2c54c8[_0x437e('0x33')],_0x397a33[_0x437e('0x35')]),_0x420437);if(_0x2c54c8[_0x437e('0x33')]['filter']){_0x148320[_0x437e('0x3d')]=_['merge'](_0x148320[_0x437e('0x3d')],{'$or':_[_0x437e('0x32')](_0x420437,function(_0x52273f){if(_0x52273f[_0x437e('0x2f')]!==_0x437e('0x3f')){var _0x50be9f={};_0x50be9f[_0x52273f[_0x437e('0x29')]]={'$like':'%'+_0x2c54c8[_0x437e('0x33')]['filter']+'%'};return _0x50be9f;}})});}_0x148320=_[_0x437e('0x40')]({},_0x148320,_0x2c54c8['options']);var _0x4ee63b={'where':_0x148320[_0x437e('0x3d')]};return db['JscriptyProject'][_0x437e('0x41')](_0x4ee63b)['then'](function(_0x59a419){_0x1fab11['count']=_0x59a419;if(_0x2c54c8[_0x437e('0x33')][_0x437e('0x42')]){_0x148320[_0x437e('0x43')]=[{'all':!![]}];}return db[_0x437e('0x2c')][_0x437e('0x44')](_0x148320);})['then'](function(_0xe13d91){_0x1fab11[_0x437e('0x45')]=_0xe13d91;return _0x1fab11;})[_0x437e('0x24')](respondWithFilteredResult(_0x2950de,_0x148320))[_0x437e('0x46')](handleError(_0x2950de,null));};exports[_0x437e('0x47')]=function(_0x598dba,_0x1fc68b){var _0x298067={'raw':![],'where':{'id':_0x598dba[_0x437e('0x48')]['id']}},_0x16ffe6={};_0x16ffe6[_0x437e('0x31')]=_[_0x437e('0x34')](db[_0x437e('0x2c')][_0x437e('0x2d')]);_0x16ffe6['query']=_['keys'](_0x598dba['query']);_0x16ffe6['filters']=_[_0x437e('0x36')](_0x16ffe6['model'],_0x16ffe6[_0x437e('0x33')]);_0x298067[_0x437e('0x38')]=_['intersection'](_0x16ffe6[_0x437e('0x31')],qs['fields'](_0x598dba['query'][_0x437e('0x37')]));_0x298067[_0x437e('0x38')]=_0x298067[_0x437e('0x38')][_0x437e('0x39')]?_0x298067['attributes']:_0x16ffe6[_0x437e('0x31')];if(_0x598dba['query'][_0x437e('0x42')]){_0x298067[_0x437e('0x43')]=[{'all':!![]}];}_0x298067=_[_0x437e('0x40')]({},_0x298067,_0x598dba['options']);return db[_0x437e('0x2c')]['find'](_0x298067)[_0x437e('0x24')](handleEntityNotFound(_0x1fc68b,null))[_0x437e('0x24')](respondWithResult(_0x1fc68b,null))[_0x437e('0x46')](handleError(_0x1fc68b,null));};exports[_0x437e('0x49')]=function(_0x5b4811,_0x2cfd96){return db['JscriptyProject'][_0x437e('0x49')](_0x5b4811[_0x437e('0x4a')],{})['then'](function(_0x49a9cf){var _0x1cf57b=_0x5b4811[_0x437e('0x4b')][_0x437e('0x4c')]({'plain':!![]});if(!_0x1cf57b)throw new Error(_0x437e('0x4d'));if(_0x1cf57b[_0x437e('0x4e')]===_0x437e('0x4b')){var _0x396ec0=_0x49a9cf[_0x437e('0x4c')]({'plain':!![]});var _0xa243ae=_0x437e('0x4f');return db[_0x437e('0x50')][_0x437e('0x51')]({'where':{'name':_0xa243ae,'userProfileId':_0x1cf57b[_0x437e('0x52')]},'raw':!![]})['then'](function(_0x668d88){if(_0x668d88&&_0x668d88[_0x437e('0x53')]===0x0){return db[_0x437e('0x26')][_0x437e('0x49')]({'name':_0x396ec0[_0x437e('0x29')],'resourceId':_0x396ec0['id'],'type':_0x668d88['name'],'sectionId':_0x668d88['id']},{})[_0x437e('0x24')](function(){return _0x49a9cf;});}else{return _0x49a9cf;}})[_0x437e('0x46')](function(_0x2bdd62){logger[_0x437e('0x27')](_0x437e('0x54'),_0x2bdd62);throw _0x2bdd62;});}return _0x49a9cf;})[_0x437e('0x24')](respondWithResult(_0x2cfd96,0xc9))[_0x437e('0x46')](handleError(_0x2cfd96,null));};exports[_0x437e('0x55')]=function(_0x6f0527,_0x537f76){var _0xf9fa04={'where':{'id':_0x6f0527[_0x437e('0x48')]['id']}},_0x31c0b5={};_0x31c0b5[_0x437e('0x31')]=_[_0x437e('0x34')](db['JscriptyProject']['rawAttributes']);_0xf9fa04[_0x437e('0x38')]=_[_0x437e('0x36')](_0x31c0b5[_0x437e('0x31')],qs[_0x437e('0x37')](_0x6f0527[_0x437e('0x33')][_0x437e('0x37')]));_0xf9fa04[_0x437e('0x38')]=_0xf9fa04[_0x437e('0x38')][_0x437e('0x39')]?_0xf9fa04[_0x437e('0x38')]:_0x31c0b5[_0x437e('0x31')];if(_0x6f0527[_0x437e('0x33')][_0x437e('0x42')]){_0xf9fa04[_0x437e('0x43')]=[{'all':!![]}];}_0xf9fa04=_[_0x437e('0x40')]({},_0xf9fa04,_0x6f0527['options']);return db['JscriptyProject'][_0x437e('0x51')](_0xf9fa04)['then'](handleEntityNotFound(_0x537f76,null))['then'](function(_0x473c0b){if(_0x473c0b){var _0x2c493e=_0x473c0b[_0x437e('0x4c')]({'plain':!![]});_0x2c493e=qs[_0x437e('0x56')](_0x2c493e,['id',_0x437e('0x57'),_0x437e('0x58')]);_0x6f0527['body']=_['omit'](_0x6f0527[_0x437e('0x4a')],['id',_0x437e('0x57'),_0x437e('0x58')]);return db[_0x437e('0x2c')][_0x437e('0x49')](_[_0x437e('0x40')](_0x2c493e,_0x6f0527[_0x437e('0x4a')]),{'include':_0x6f0527[_0x437e('0x33')][_0x437e('0x42')]?[{'all':!![]}]:undefined})[_0x437e('0x24')](function(_0x3817f8){var _0x21f8c1=_0x6f0527[_0x437e('0x4b')][_0x437e('0x4c')]({'plain':!![]});if(!_0x21f8c1)throw new Error(_0x437e('0x4d'));if(_0x21f8c1['role']===_0x437e('0x4b')){var _0x50c527=_0x3817f8[_0x437e('0x4c')]({'plain':!![]});var _0x41162b=_0x437e('0x4f');return db['UserProfileSection'][_0x437e('0x51')]({'where':{'name':_0x41162b,'userProfileId':_0x21f8c1[_0x437e('0x52')]},'raw':!![]})[_0x437e('0x24')](function(_0x4e8f2f){if(_0x4e8f2f&&_0x4e8f2f['autoAssociation']===0x0){return db['UserProfileResource'][_0x437e('0x49')]({'name':_0x50c527['name'],'resourceId':_0x50c527['id'],'type':_0x4e8f2f[_0x437e('0x29')],'sectionId':_0x4e8f2f['id']},{})[_0x437e('0x24')](function(){return _0x3817f8;});}else{return _0x3817f8;}})[_0x437e('0x46')](function(_0x1570aa){logger[_0x437e('0x27')](_0x437e('0x54'),_0x1570aa);throw _0x1570aa;});}return _0x3817f8;});}})['then'](respondWithResult(_0x537f76,0xc9))[_0x437e('0x46')](handleError(_0x537f76,null));};exports[_0x437e('0x23')]=function(_0x3a3d17,_0x38513f){if(_0x3a3d17[_0x437e('0x4a')]['id']){delete _0x3a3d17[_0x437e('0x4a')]['id'];}return db[_0x437e('0x2c')][_0x437e('0x51')]({'where':{'id':_0x3a3d17[_0x437e('0x48')]['id']}})[_0x437e('0x24')](handleEntityNotFound(_0x38513f,null))[_0x437e('0x24')](saveUpdates(_0x3a3d17[_0x437e('0x4a')],null))['then'](respondWithResult(_0x38513f,null))[_0x437e('0x46')](handleError(_0x38513f,null));};exports[_0x437e('0x25')]=function(_0x1a3451,_0x205983){return db[_0x437e('0x2c')][_0x437e('0x51')]({'where':{'id':_0x1a3451[_0x437e('0x48')]['id']}})[_0x437e('0x24')](handleEntityNotFound(_0x205983,null))[_0x437e('0x24')](removeEntity(_0x205983,null))[_0x437e('0x46')](handleError(_0x205983,null));};exports[_0x437e('0x59')]=function(_0x54791d,_0x25520c,_0x4608ad){var _0x1d3f9b={'raw':!![],'where':{}};var _0x4136ac={};var _0x412add={'count':0x0,'rows':[]};return db[_0x437e('0x2c')][_0x437e('0x5a')]({'where':{'id':_0x54791d[_0x437e('0x48')]['id']}})['then'](handleEntityNotFound(_0x25520c,null))['then'](function(_0x17ad69){if(_0x17ad69){_0x4136ac[_0x437e('0x31')]=_[_0x437e('0x34')](db[_0x437e('0x5b')][_0x437e('0x2d')]);_0x4136ac[_0x437e('0x33')]=_[_0x437e('0x34')](_0x54791d[_0x437e('0x33')]);_0x4136ac[_0x437e('0x35')]=_['intersection'](_0x4136ac['model'],_0x4136ac[_0x437e('0x33')]);_0x1d3f9b[_0x437e('0x38')]=_[_0x437e('0x36')](_0x4136ac[_0x437e('0x31')],qs[_0x437e('0x37')](_0x54791d['query'][_0x437e('0x37')]));_0x1d3f9b[_0x437e('0x38')]=_0x1d3f9b[_0x437e('0x38')][_0x437e('0x39')]?_0x1d3f9b['attributes']:_0x4136ac[_0x437e('0x31')];if(!_0x54791d[_0x437e('0x33')]['hasOwnProperty']('nolimit')){_0x1d3f9b['limit']=qs[_0x437e('0x1f')](_0x54791d[_0x437e('0x33')][_0x437e('0x1f')]);_0x1d3f9b[_0x437e('0x1d')]=qs[_0x437e('0x1d')](_0x54791d[_0x437e('0x33')][_0x437e('0x1d')]);}_0x1d3f9b[_0x437e('0x3b')]=qs[_0x437e('0x3c')](_0x54791d[_0x437e('0x33')][_0x437e('0x3c')]);_0x1d3f9b[_0x437e('0x3d')]=qs[_0x437e('0x35')](_[_0x437e('0x3e')](_0x54791d[_0x437e('0x33')],_0x4136ac['filters']));_0x1d3f9b[_0x437e('0x3d')][_0x437e('0x5c')]=_0x17ad69['id'];if(_0x54791d[_0x437e('0x33')]['filter']){_0x1d3f9b[_0x437e('0x3d')]=_['merge'](_0x1d3f9b[_0x437e('0x3d')],{'$or':_[_0x437e('0x32')](_0x1d3f9b[_0x437e('0x38')],function(_0x5d1f14){var _0x208684={};_0x208684[_0x5d1f14]={'$like':'%'+_0x54791d['query']['filter']+'%'};return _0x208684;})});}_0x1d3f9b=_[_0x437e('0x40')]({},_0x1d3f9b,_0x54791d[_0x437e('0x5d')]);return db[_0x437e('0x5b')][_0x437e('0x41')]({'where':_0x1d3f9b[_0x437e('0x3d')]})[_0x437e('0x24')](function(_0x51adea){_0x412add[_0x437e('0x41')]=_0x51adea;if(_0x54791d[_0x437e('0x33')][_0x437e('0x42')]){_0x1d3f9b[_0x437e('0x43')]=[{'all':!![]}];}return db['JscriptySessionReport']['findAll'](_0x1d3f9b);})[_0x437e('0x24')](function(_0x3ef5a4){_0x412add[_0x437e('0x45')]=_0x3ef5a4;return _0x412add;});}})[_0x437e('0x24')](respondWithFilteredResult(_0x25520c,_0x1d3f9b))[_0x437e('0x46')](handleError(_0x25520c,null));};exports[_0x437e('0x5e')]=function(_0x1afe8a,_0x45b950,_0x390143){var _0x2e6c8a={'raw':!![],'where':{}};var _0xd3b8b6={};var _0x170ac8={'count':0x0,'rows':[]};return db[_0x437e('0x2c')][_0x437e('0x5a')]({'where':{'id':_0x1afe8a[_0x437e('0x48')]['id']}})['then'](handleEntityNotFound(_0x45b950,null))[_0x437e('0x24')](function(_0x1416b9){if(_0x1416b9){_0xd3b8b6[_0x437e('0x31')]=_[_0x437e('0x34')](db[_0x437e('0x5f')][_0x437e('0x2d')]);_0xd3b8b6[_0x437e('0x33')]=_[_0x437e('0x34')](_0x1afe8a[_0x437e('0x33')]);_0xd3b8b6[_0x437e('0x35')]=_['intersection'](_0xd3b8b6[_0x437e('0x31')],_0xd3b8b6[_0x437e('0x33')]);_0x2e6c8a['attributes']=_[_0x437e('0x36')](_0xd3b8b6['model'],qs[_0x437e('0x37')](_0x1afe8a[_0x437e('0x33')]['fields']));_0x2e6c8a[_0x437e('0x38')]=_0x2e6c8a['attributes'][_0x437e('0x39')]?_0x2e6c8a[_0x437e('0x38')]:_0xd3b8b6[_0x437e('0x31')];if(!_0x1afe8a['query'][_0x437e('0x60')](_0x437e('0x3a'))){_0x2e6c8a[_0x437e('0x1f')]=qs[_0x437e('0x1f')](_0x1afe8a[_0x437e('0x33')]['limit']);_0x2e6c8a[_0x437e('0x1d')]=qs[_0x437e('0x1d')](_0x1afe8a['query']['offset']);}_0x2e6c8a[_0x437e('0x3b')]=qs[_0x437e('0x3c')](_0x1afe8a[_0x437e('0x33')][_0x437e('0x3c')]);_0x2e6c8a[_0x437e('0x3d')]=qs['filters'](_[_0x437e('0x3e')](_0x1afe8a['query'],_0xd3b8b6[_0x437e('0x35')]));_0x2e6c8a[_0x437e('0x3d')]['ProjectId']=_0x1416b9['id'];if(_0x1afe8a[_0x437e('0x33')][_0x437e('0x61')]){_0x2e6c8a['where']=_[_0x437e('0x40')](_0x2e6c8a[_0x437e('0x3d')],{'$or':_['map'](_0x2e6c8a['attributes'],function(_0x44f1b7){var _0x1052d0={};_0x1052d0[_0x44f1b7]={'$like':'%'+_0x1afe8a['query'][_0x437e('0x61')]+'%'};return _0x1052d0;})});}_0x2e6c8a=_['merge']({},_0x2e6c8a,_0x1afe8a[_0x437e('0x5d')]);return db['JscriptyAnswerReport'][_0x437e('0x41')]({'where':_0x2e6c8a[_0x437e('0x3d')]})['then'](function(_0xa94f57){_0x170ac8[_0x437e('0x41')]=_0xa94f57;if(_0x1afe8a['query'][_0x437e('0x42')]){_0x2e6c8a[_0x437e('0x43')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0x437e('0x44')](_0x2e6c8a);})[_0x437e('0x24')](function(_0x96654){_0x170ac8[_0x437e('0x45')]=_0x96654;return _0x170ac8;});}})[_0x437e('0x24')](respondWithFilteredResult(_0x45b950,_0x2e6c8a))[_0x437e('0x46')](handleError(_0x45b950,null));};function char(_0x2e3306){return _0x437e('0x62')===typeof _0x2e3306?String[_0x437e('0x63')]['apply'](null,arguments):_0x2e3306;}function needsEncapsulation(_0x1f3495){return!!_0x1f3495&&(_0x1f3495['toString']()['indexOf'](char(0xd))>=0x0||_0x1f3495[_0x437e('0x64')]()[_0x437e('0x65')](char(0xa))>=0x0||_0x1f3495[_0x437e('0x64')]()['indexOf'](char(0x2c))>=0x0||_0x1f3495[_0x437e('0x64')]()[_0x437e('0x65')](char(0x22))>=0x0);}function encapsulate(_0x56faaf){var _0x4c3283=char(0x22),_0x4192bf='\x5c'+char(0x22),_0x19c924=_0x56faaf['toString']()[_0x437e('0x66')](new RegExp(_0x4c3283,'g'),_0x4192bf);return _0x4c3283+_0x19c924+_0x4c3283;}exports['getSummary']=function(_0x162ecc,_0x5071f7,_0x457c39){var _0x5cbf03,_0x2dd50c;var _0x894cc4={'where':{'ProjectId':_0x162ecc[_0x437e('0x48')]['id']}};if(_0x162ecc[_0x437e('0x33')][_0x437e('0x67')]){_0x894cc4['where'][_0x437e('0x68')]=JSON[_0x437e('0x69')](_0x162ecc[_0x437e('0x33')][_0x437e('0x67')]);}return db[_0x437e('0x5b')]['findAll'](_0x894cc4)[_0x437e('0x24')](handleEntityNotFound(_0x5071f7,null))[_0x437e('0x24')](function(_0x556db0){if(_0x556db0){_0x5cbf03=_0x556db0;return db[_0x437e('0x6a')][_0x437e('0x44')]({'where':{'SessionId':{'$in':_[_0x437e('0x32')](_0x5cbf03,'id')},'ProjectId':_0x162ecc[_0x437e('0x48')]['id']},'order':_0x437e('0x6b')});}})['then'](handleEntityNotFound(_0x5071f7,null))[_0x437e('0x24')](function(_0x3339e0){if(_0x3339e0){_0x2dd50c=_0x3339e0;var _0x3d9a49={};for(var _0x50783b=0x0,_0x56e8e4=_0x2dd50c['length'];_0x50783b<_0x56e8e4;_0x50783b++){if(!_0x3d9a49['hasOwnProperty'](_0x2dd50c[_0x50783b][_0x437e('0x6c')])){_0x3d9a49[_0x2dd50c[_0x50783b][_0x437e('0x6c')]]=needsEncapsulation(_0x2dd50c[_0x50783b][_0x437e('0x6d')])?encapsulate(_0x2dd50c[_0x50783b]['question']):_0x2dd50c[_0x50783b][_0x437e('0x6d')];}}var _0x48f1a6=[],_0x1c341d={};for(var _0x15e24d=0x0,_0x415ac4=_0x5cbf03[_0x437e('0x39')];_0x15e24d<_0x415ac4;_0x15e24d++){_0x1c341d={'ProjectId':_0x162ecc[_0x437e('0x48')]['id'],'SessionId':_0x5cbf03[_0x15e24d]['id'],'StartTime':moment(_0x5cbf03[_0x15e24d][_0x437e('0x68')])[_0x437e('0x6e')](_0x437e('0x6f'))};for(var _0x567d67=0x0,_0x4a955f=_0x2dd50c[_0x437e('0x39')];_0x567d67<_0x4a955f;_0x567d67++){if(_0x2dd50c[_0x567d67][_0x437e('0x70')]==_0x5cbf03[_0x15e24d]['id']&&_0x3d9a49[_0x437e('0x60')](_0x2dd50c[_0x567d67]['questionId'])){_0x1c341d[_0x3d9a49[_0x2dd50c[_0x567d67][_0x437e('0x6c')]]]=_0x2dd50c[_0x567d67]['answer'];}}for(var _0xfabd0f in _0x3d9a49){if(!_0x1c341d['hasOwnProperty'](_0x3d9a49[_0xfabd0f])){_0x1c341d[_0x3d9a49[_0xfabd0f]]=null;}}_0x48f1a6[_0x437e('0x71')](_0x1c341d);}return _0x48f1a6;}})['then'](function(_0x30e653){if(!_[_0x437e('0x72')](_0x30e653)){var _0x53748c=toCsv(_0x30e653);var _0x1b6c52=Date[_0x437e('0x73')]();fs['writeFileSync'](util['format']('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x162ecc['params']['id'],_0x1b6c52),_0x53748c);_0x5071f7[_0x437e('0x74')](_0x437e('0x75'),_0x437e('0x76')+util[_0x437e('0x6e')](_0x437e('0x77'),_0x162ecc[_0x437e('0x48')]['id'],_0x1b6c52));_0x5071f7[_0x437e('0x74')](_0x437e('0x78'),_0x437e('0x79'));return _0x5071f7[_0x437e('0x7a')](util[_0x437e('0x6e')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x162ecc[_0x437e('0x48')]['id'],_0x1b6c52));}else{return _0x5071f7[_0x437e('0x19')](0xcc);}})[_0x437e('0x46')](handleError(_0x5071f7,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 323a431..cb3aa7e 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 _0xb458=['path','rimraf','./jscriptyProject.attributes','define','JscriptyProject','jscripty_projects','lodash','util','../../config/logger','bluebird','request-promise'];(function(_0x417af1,_0x1004cc){var _0xc5af59=function(_0x5c0230){while(--_0x5c0230){_0x417af1['push'](_0x417af1['shift']());}};_0xc5af59(++_0x1004cc);}(_0xb458,0x103));var _0x8b45=function(_0x4df667,_0x2d80ea){_0x4df667=_0x4df667-0x0;var _0x24ff9d=_0xb458[_0x4df667];return _0x24ff9d;};'use strict';var _=require(_0x8b45('0x0'));var util=require(_0x8b45('0x1'));var logger=require(_0x8b45('0x2'))('api');var moment=require('moment');var BPromise=require(_0x8b45('0x3'));var rp=require(_0x8b45('0x4'));var fs=require('fs');var path=require(_0x8b45('0x5'));var rimraf=require(_0x8b45('0x6'));var config=require('../../config/environment');var attributes=require(_0x8b45('0x7'));module['exports']=function(_0x5cc2d5,_0xe8d774){return _0x5cc2d5[_0x8b45('0x8')](_0x8b45('0x9'),attributes,{'tableName':_0x8b45('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2bae=['../../config/environment','exports','JscriptyProject','jscripty_projects','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x2e7d62,_0x1bf94a){var _0x34b0e5=function(_0x52012b){while(--_0x52012b){_0x2e7d62['push'](_0x2e7d62['shift']());}};_0x34b0e5(++_0x1bf94a);}(_0x2bae,0x164));var _0xe2ba=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2bae[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe2ba('0x0'));var util=require(_0xe2ba('0x1'));var logger=require(_0xe2ba('0x2'))(_0xe2ba('0x3'));var moment=require(_0xe2ba('0x4'));var BPromise=require(_0xe2ba('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe2ba('0x6'));var rimraf=require('rimraf');var config=require(_0xe2ba('0x7'));var attributes=require('./jscriptyProject.attributes');module[_0xe2ba('0x8')]=function(_0x129677,_0x21601e){return _0x129677['define'](_0xe2ba('0x9'),attributes,{'tableName':_0xe2ba('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 86af9f2..5af1e65 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 _0xd8b0=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','ioredis'];(function(_0x43941d,_0x45fd0d){var _0x27b82a=function(_0x21851e){while(--_0x21851e){_0x43941d['push'](_0x43941d['shift']());}};_0x27b82a(++_0x45fd0d);}(_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 moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var utils=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0d8b('0x7')][_0x0d8b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){return client[_0x0d8b('0x9')](_0x39f43a,_0x413284)[_0x0d8b('0xa')](function(_0x3b027f){logger[_0x0d8b('0xb')](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x4a4470,'request\x20sent',JSON[_0x0d8b('0x10')](_0x3b027f));if(_0x3b027f['error']){if(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x12')]===0x1f4){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x58e4e2(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x284169(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}else{logger['info'](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));_0x284169(_0x3b027f[_0x0d8b('0x14')][_0x0d8b('0x13')]);}})[_0x0d8b('0x15')](function(_0x5cd485){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x5cd485);_0x58e4e2(_0x5cd485);});});} \ No newline at end of file +var _0xe706=['http','request','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x45cb0c,_0x4dd70f){var _0x21c344=function(_0xdbfb44){while(--_0xdbfb44){_0x45cb0c['push'](_0x45cb0c['shift']());}};_0x21c344(++_0x4dd70f);}(_0xe706,0xa3));var _0x6e70=function(_0x175374,_0x3c2440){_0x175374=_0x175374-0x0;var _0x4e1f61=_0xe706[_0x175374];return _0x4e1f61;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e70('0x3'));var fs=require('fs');var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var utils=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));var config=require(_0x6e70('0x9'));var jayson=require(_0x6e70('0xa'));var client=jayson[_0x6e70('0xb')][_0x6e70('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){return client[_0x6e70('0xd')](_0x36357b,_0x45a2d4)[_0x6e70('0xe')](function(_0x25e61c){logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,_0x6e70('0x11'));logger[_0x6e70('0x12')](_0x6e70('0x13'),_0x293ce7,_0x6e70('0x11'),JSON['stringify'](_0x25e61c));if(_0x25e61c['error']){if(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x15')]===0x1f4){logger[_0x6e70('0x14')](_0x6e70('0x10'),_0x293ce7,_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);return _0x3c4843(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);}logger['error']('JscriptyProject,\x20%s,\x20%s',_0x293ce7,_0x25e61c['error'][_0x6e70('0x16')]);return _0x188ed3(_0x25e61c['error']['message']);}else{logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,'request\x20sent');_0x188ed3(_0x25e61c[_0x6e70('0x17')]['message']);}})[_0x6e70('0x18')](function(_0x161f23){logger['error']('JscriptyProject,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 4b2687a..fdfc215 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 _0x1aaf=['put','update','delete','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create'];(function(_0x19456c,_0x19912e){var _0xab98ef=function(_0x3dfa57){while(--_0x3dfa57){_0x19456c['push'](_0x19456c['shift']());}};_0xab98ef(++_0x19912e);}(_0x1aaf,0x16c));var _0xf1aa=function(_0x2f0e89,_0x2161ca){_0x2f0e89=_0x2f0e89-0x0;var _0x3df90e=_0x1aaf[_0x2f0e89];return _0x3df90e;};'use strict';var multer=require('multer');var util=require(_0xf1aa('0x0'));var path=require(_0xf1aa('0x1'));var timeout=require('connect-timeout');var express=require(_0xf1aa('0x2'));var router=express['Router']();var fs_extra=require(_0xf1aa('0x3'));var auth=require(_0xf1aa('0x4'));var interaction=require(_0xf1aa('0x5'));var config=require(_0xf1aa('0x6'));var controller=require(_0xf1aa('0x7'));router[_0xf1aa('0x8')]('/',auth[_0xf1aa('0x9')](),controller[_0xf1aa('0xa')]);router['get'](_0xf1aa('0xb'),auth[_0xf1aa('0x9')](),controller[_0xf1aa('0xc')]);router[_0xf1aa('0x8')](_0xf1aa('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xf1aa('0xe')]('/',auth['isAuthenticated'](),controller[_0xf1aa('0xf')]);router[_0xf1aa('0x10')](_0xf1aa('0xd'),auth[_0xf1aa('0x9')](),controller[_0xf1aa('0x11')]);router[_0xf1aa('0x12')](_0xf1aa('0xd'),auth[_0xf1aa('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xd780=['get','show','post','create','update','/:id','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../config/environment','./jscriptyQuestionReport.controller','isAuthenticated','index'];(function(_0x112ac3,_0x53d887){var _0x5d1df3=function(_0x55d7df){while(--_0x55d7df){_0x112ac3['push'](_0x112ac3['shift']());}};_0x5d1df3(++_0x53d887);}(_0xd780,0x139));var _0x0d78=function(_0x492757,_0x149f12){_0x492757=_0x492757-0x0;var _0x5c3e4d=_0xd780[_0x492757];return _0x5c3e4d;};'use strict';var multer=require(_0x0d78('0x0'));var util=require(_0x0d78('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0d78('0x2'));var router=express[_0x0d78('0x3')]();var fs_extra=require(_0x0d78('0x4'));var auth=require(_0x0d78('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0d78('0x6'));var controller=require(_0x0d78('0x7'));router['get']('/',auth[_0x0d78('0x8')](),controller[_0x0d78('0x9')]);router['get']('/describe',auth[_0x0d78('0x8')](),controller['describe']);router[_0x0d78('0xa')]('/:id',auth[_0x0d78('0x8')](),controller[_0x0d78('0xb')]);router[_0x0d78('0xc')]('/',auth[_0x0d78('0x8')](),controller[_0x0d78('0xd')]);router['put']('/:id',auth[_0x0d78('0x8')](),controller[_0x0d78('0xe')]);router['delete'](_0x0d78('0xf'),auth[_0x0d78('0x8')](),controller['destroy']);module[_0x0d78('0x10')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index fda503f..17fc7c3 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(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0x7a54,0x106));var _0x47a5=function(_0x1ee059,_0x490d88){_0x1ee059=_0x1ee059-0x0;var _0x1b6bda=_0x7a54[_0x1ee059];return _0x1b6bda;};'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(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0x7a54,0x106));var _0x47a5=function(_0x1335de,_0x1c9290){_0x1335de=_0x1335de-0x0;var _0x24f5cc=_0x7a54[_0x1335de];return _0x24f5cc;};'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 b746eb4..ccd5374 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 _0x7797=['set','json','apply','reject','update','then','destroy','error','stack','name','send','index','map','rawAttributes','type','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','JscriptyQuestionReport','includeAll','include','findAll','rows','catch','keys','length','find','create','body','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','count','offset'];(function(_0x5c5d0c,_0x5892ef){var _0x51b085=function(_0x2d5175){while(--_0x2d5175){_0x5c5d0c['push'](_0x5c5d0c['shift']());}};_0x51b085(++_0x5892ef);}(_0x7797,0x10b));var _0x7779=function(_0x329d13,_0x1aff27){_0x329d13=_0x329d13-0x0;var _0x33efd9=_0x7797[_0x329d13];return _0x33efd9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7779('0x0'));var zipdir=require(_0x7779('0x1'));var jsonpatch=require(_0x7779('0x2'));var rp=require(_0x7779('0x3'));var moment=require(_0x7779('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7779('0x5'));var util=require(_0x7779('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x7779('0x7'));var ejs=require(_0x7779('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7779('0x9'));var squel=require(_0x7779('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x7779('0xb'));var toCsv=require(_0x7779('0x7'));var querystring=require(_0x7779('0xc'));var Papa=require(_0x7779('0xd'));var Redis=require(_0x7779('0xe'));var authService=require(_0x7779('0xf'));var qs=require(_0x7779('0x10'));var as=require(_0x7779('0x11'));var hardwareService=require(_0x7779('0x12'));var logger=require('../../config/logger')(_0x7779('0x13'));var utils=require('../../config/utils');var config=require(_0x7779('0x14'));var licenseUtil=require(_0x7779('0x15'));var db=require(_0x7779('0x16'))['db'];function respondWithStatusCode(_0x148060,_0x1bf3e8){_0x1bf3e8=_0x1bf3e8||0xcc;return function(_0x195009){if(_0x195009){return _0x148060[_0x7779('0x17')](_0x1bf3e8);}return _0x148060[_0x7779('0x18')](_0x1bf3e8)[_0x7779('0x19')]();};}function respondWithResult(_0x3f011a,_0x5a3d0a){_0x5a3d0a=_0x5a3d0a||0xc8;return function(_0x46601a){if(_0x46601a){return _0x3f011a[_0x7779('0x18')](_0x5a3d0a)['json'](_0x46601a);}};}function respondWithFilteredResult(_0x664bd6,_0x33c564){return function(_0x113512){if(_0x113512){var _0xadf7d=typeof _0x33c564['offset']===_0x7779('0x1a')&&typeof _0x33c564['limit']===_0x7779('0x1a');var _0x1ad687=_0x113512[_0x7779('0x1b')];var _0x3a1462=_0xadf7d?0x0:_0x33c564[_0x7779('0x1c')];var _0x369207=_0xadf7d?_0x113512[_0x7779('0x1b')]:_0x33c564[_0x7779('0x1c')]+_0x33c564['limit'];var _0x3c279e;if(_0x369207>=_0x1ad687){_0x369207=_0x1ad687;_0x3c279e=0xc8;}else{_0x3c279e=0xce;}_0x664bd6[_0x7779('0x18')](_0x3c279e);return _0x664bd6[_0x7779('0x1d')]('Content-Range',_0x3a1462+'-'+_0x369207+'/'+_0x1ad687)[_0x7779('0x1e')](_0x113512);}return null;};}function patchUpdates(_0x2ddbb4){return function(_0x5687e5){try{jsonpatch[_0x7779('0x1f')](_0x5687e5,_0x2ddbb4,!![]);}catch(_0x4c5d8d){return BPromise[_0x7779('0x20')](_0x4c5d8d);}return _0x5687e5['save']();};}function saveUpdates(_0x4e2d61,_0x336901){return function(_0xb1c1bd){if(_0xb1c1bd){return _0xb1c1bd[_0x7779('0x21')](_0x4e2d61)[_0x7779('0x22')](function(_0xd35d20){return _0xd35d20;});}return null;};}function removeEntity(_0xeaf90a,_0x2a6014){return function(_0x164ec2){if(_0x164ec2){return _0x164ec2[_0x7779('0x23')]()['then'](function(){_0xeaf90a[_0x7779('0x18')](0xcc)[_0x7779('0x19')]();});}};}function handleEntityNotFound(_0xbc0f31,_0x28bb92){return function(_0x4b1f9f){if(!_0x4b1f9f){_0xbc0f31[_0x7779('0x17')](0x194);}return _0x4b1f9f;};}function handleError(_0x51a40d,_0x1c58c2){_0x1c58c2=_0x1c58c2||0x1f4;return function(_0x564f99){logger[_0x7779('0x24')](_0x564f99[_0x7779('0x25')]);if(_0x564f99[_0x7779('0x26')]){delete _0x564f99['name'];}_0x51a40d[_0x7779('0x18')](_0x1c58c2)[_0x7779('0x27')](_0x564f99);};}exports[_0x7779('0x28')]=function(_0x255202,_0x540186){var _0x25f7b4={},_0x54c68e={},_0x80e806={'count':0x0,'rows':[]};var _0x3e3b27=_[_0x7779('0x29')](db['JscriptyQuestionReport'][_0x7779('0x2a')],function(_0x130203){return{'name':_0x130203['fieldName'],'type':_0x130203[_0x7779('0x2b')]['key']};});_0x54c68e[_0x7779('0x2c')]=_[_0x7779('0x29')](_0x3e3b27,_0x7779('0x26'));_0x54c68e[_0x7779('0x2d')]=_['keys'](_0x255202[_0x7779('0x2d')]);_0x54c68e['filters']=_[_0x7779('0x2e')](_0x54c68e['model'],_0x54c68e[_0x7779('0x2d')]);_0x25f7b4[_0x7779('0x2f')]=_[_0x7779('0x2e')](_0x54c68e[_0x7779('0x2c')],qs[_0x7779('0x30')](_0x255202['query'][_0x7779('0x30')]));_0x25f7b4['attributes']=_0x25f7b4['attributes']['length']?_0x25f7b4[_0x7779('0x2f')]:_0x54c68e[_0x7779('0x2c')];if(!_0x255202[_0x7779('0x2d')][_0x7779('0x31')](_0x7779('0x32'))){_0x25f7b4[_0x7779('0x33')]=qs[_0x7779('0x33')](_0x255202[_0x7779('0x2d')][_0x7779('0x33')]);_0x25f7b4['offset']=qs[_0x7779('0x1c')](_0x255202['query'][_0x7779('0x1c')]);}_0x25f7b4[_0x7779('0x34')]=qs['sort'](_0x255202[_0x7779('0x2d')][_0x7779('0x35')]);_0x25f7b4['where']=qs[_0x7779('0x36')](_[_0x7779('0x37')](_0x255202[_0x7779('0x2d')],_0x54c68e['filters']),_0x3e3b27);if(_0x255202[_0x7779('0x2d')][_0x7779('0x38')]){_0x25f7b4[_0x7779('0x39')]=_[_0x7779('0x3a')](_0x25f7b4[_0x7779('0x39')],{'$or':_[_0x7779('0x29')](_0x3e3b27,function(_0x2f3479){if(_0x2f3479[_0x7779('0x2b')]!==_0x7779('0x3b')){var _0x9a1990={};_0x9a1990[_0x2f3479[_0x7779('0x26')]]={'$like':'%'+_0x255202[_0x7779('0x2d')][_0x7779('0x38')]+'%'};return _0x9a1990;}})});}_0x25f7b4=_['merge']({},_0x25f7b4,_0x255202[_0x7779('0x3c')]);var _0x31eac1={'where':_0x25f7b4[_0x7779('0x39')]};return db[_0x7779('0x3d')][_0x7779('0x1b')](_0x31eac1)[_0x7779('0x22')](function(_0x2fdb72){_0x80e806[_0x7779('0x1b')]=_0x2fdb72;if(_0x255202['query'][_0x7779('0x3e')]){_0x25f7b4[_0x7779('0x3f')]=[{'all':!![]}];}return db[_0x7779('0x3d')][_0x7779('0x40')](_0x25f7b4);})[_0x7779('0x22')](function(_0xb97a99){_0x80e806[_0x7779('0x41')]=_0xb97a99;return _0x80e806;})[_0x7779('0x22')](respondWithFilteredResult(_0x540186,_0x25f7b4))[_0x7779('0x42')](handleError(_0x540186,null));};exports['show']=function(_0x1530b4,_0x2a9239){var _0x66ac4f={'raw':!![],'where':{'id':_0x1530b4['params']['id']}},_0x4efe7f={};_0x4efe7f[_0x7779('0x2c')]=_[_0x7779('0x43')](db[_0x7779('0x3d')][_0x7779('0x2a')]);_0x4efe7f['query']=_[_0x7779('0x43')](_0x1530b4[_0x7779('0x2d')]);_0x4efe7f[_0x7779('0x36')]=_[_0x7779('0x2e')](_0x4efe7f[_0x7779('0x2c')],_0x4efe7f['query']);_0x66ac4f['attributes']=_[_0x7779('0x2e')](_0x4efe7f[_0x7779('0x2c')],qs['fields'](_0x1530b4['query'][_0x7779('0x30')]));_0x66ac4f[_0x7779('0x2f')]=_0x66ac4f[_0x7779('0x2f')][_0x7779('0x44')]?_0x66ac4f[_0x7779('0x2f')]:_0x4efe7f[_0x7779('0x2c')];if(_0x1530b4[_0x7779('0x2d')][_0x7779('0x3e')]){_0x66ac4f[_0x7779('0x3f')]=[{'all':!![]}];}_0x66ac4f=_[_0x7779('0x3a')]({},_0x66ac4f,_0x1530b4['options']);return db[_0x7779('0x3d')][_0x7779('0x45')](_0x66ac4f)['then'](handleEntityNotFound(_0x2a9239,null))[_0x7779('0x22')](respondWithResult(_0x2a9239,null))['catch'](handleError(_0x2a9239,null));};exports[_0x7779('0x46')]=function(_0x968a80,_0xbebe13){return db['JscriptyQuestionReport'][_0x7779('0x46')](_0x968a80['body'],{})[_0x7779('0x22')](respondWithResult(_0xbebe13,0xc9))[_0x7779('0x42')](handleError(_0xbebe13,null));};exports[_0x7779('0x21')]=function(_0x4bd448,_0x3e38ea){if(_0x4bd448[_0x7779('0x47')]['id']){delete _0x4bd448[_0x7779('0x47')]['id'];}return db['JscriptyQuestionReport'][_0x7779('0x45')]({'where':{'id':_0x4bd448['params']['id']}})[_0x7779('0x22')](handleEntityNotFound(_0x3e38ea,null))[_0x7779('0x22')](saveUpdates(_0x4bd448[_0x7779('0x47')],null))['then'](respondWithResult(_0x3e38ea,null))[_0x7779('0x42')](handleError(_0x3e38ea,null));};exports[_0x7779('0x23')]=function(_0x3101a8,_0xe2cbc9){return db['JscriptyQuestionReport'][_0x7779('0x45')]({'where':{'id':_0x3101a8[_0x7779('0x48')]['id']}})[_0x7779('0x22')](handleEntityNotFound(_0xe2cbc9,null))[_0x7779('0x22')](removeEntity(_0xe2cbc9,null))['catch'](handleError(_0xe2cbc9,null));};exports[_0x7779('0x49')]=function(_0x3b63ff,_0x57ed65){return db['JscriptyQuestionReport'][_0x7779('0x49')]()[_0x7779('0x22')](respondWithResult(_0x57ed65,null))['catch'](handleError(_0x57ed65,null));}; \ No newline at end of file +var _0x1ff8=['sendStatus','error','stack','name','send','index','map','JscriptyQuestionReport','rawAttributes','fieldName','type','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','keys','includeAll','body','find','describe','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy'];(function(_0x428441,_0x1050f4){var _0x545acc=function(_0x43ce7a){while(--_0x43ce7a){_0x428441['push'](_0x428441['shift']());}};_0x545acc(++_0x1050f4);}(_0x1ff8,0x192));var _0x81ff=function(_0x1bba1a,_0xdb4f8b){_0x1bba1a=_0x1bba1a-0x0;var _0x4ed799=_0x1ff8[_0x1bba1a];return _0x4ed799;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x81ff('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x81ff('0x1'));var moment=require(_0x81ff('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x81ff('0x3'));var util=require(_0x81ff('0x4'));var path=require(_0x81ff('0x5'));var sox=require(_0x81ff('0x6'));var csv=require(_0x81ff('0x7'));var ejs=require(_0x81ff('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x81ff('0x9'));var squel=require(_0x81ff('0xa'));var crypto=require(_0x81ff('0xb'));var jsforce=require(_0x81ff('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x81ff('0x7'));var querystring=require(_0x81ff('0xd'));var Papa=require(_0x81ff('0xe'));var Redis=require('ioredis');var authService=require(_0x81ff('0xf'));var qs=require(_0x81ff('0x10'));var as=require(_0x81ff('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x81ff('0x12'));var utils=require(_0x81ff('0x13'));var config=require(_0x81ff('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x81ff('0x15'))['db'];function respondWithStatusCode(_0x4d817e,_0x1163f9){_0x1163f9=_0x1163f9||0xcc;return function(_0x3a0c17){if(_0x3a0c17){return _0x4d817e['sendStatus'](_0x1163f9);}return _0x4d817e[_0x81ff('0x16')](_0x1163f9)[_0x81ff('0x17')]();};}function respondWithResult(_0x114750,_0x23eeb9){_0x23eeb9=_0x23eeb9||0xc8;return function(_0x1da9e8){if(_0x1da9e8){return _0x114750[_0x81ff('0x16')](_0x23eeb9)[_0x81ff('0x18')](_0x1da9e8);}};}function respondWithFilteredResult(_0x5337f8,_0x532f09){return function(_0x46b22a){if(_0x46b22a){var _0x4e192c=typeof _0x532f09[_0x81ff('0x19')]===_0x81ff('0x1a')&&typeof _0x532f09[_0x81ff('0x1b')]===_0x81ff('0x1a');var _0x143d20=_0x46b22a[_0x81ff('0x1c')];var _0x1b16dd=_0x4e192c?0x0:_0x532f09['offset'];var _0x58b9c8=_0x4e192c?_0x46b22a[_0x81ff('0x1c')]:_0x532f09[_0x81ff('0x19')]+_0x532f09[_0x81ff('0x1b')];var _0x4fa37e;if(_0x58b9c8>=_0x143d20){_0x58b9c8=_0x143d20;_0x4fa37e=0xc8;}else{_0x4fa37e=0xce;}_0x5337f8[_0x81ff('0x16')](_0x4fa37e);return _0x5337f8[_0x81ff('0x1d')](_0x81ff('0x1e'),_0x1b16dd+'-'+_0x58b9c8+'/'+_0x143d20)['json'](_0x46b22a);}return null;};}function patchUpdates(_0x211fc8){return function(_0x1484d5){try{jsonpatch[_0x81ff('0x1f')](_0x1484d5,_0x211fc8,!![]);}catch(_0x4a7355){return BPromise[_0x81ff('0x20')](_0x4a7355);}return _0x1484d5[_0x81ff('0x21')]();};}function saveUpdates(_0x2f1a0f,_0x2f7c5c){return function(_0x253b28){if(_0x253b28){return _0x253b28['update'](_0x2f1a0f)[_0x81ff('0x22')](function(_0x341341){return _0x341341;});}return null;};}function removeEntity(_0x27bbb0,_0x33a052){return function(_0x25af22){if(_0x25af22){return _0x25af22[_0x81ff('0x23')]()[_0x81ff('0x22')](function(){_0x27bbb0[_0x81ff('0x16')](0xcc)[_0x81ff('0x17')]();});}};}function handleEntityNotFound(_0x15ebe0,_0x47cbbe){return function(_0x50b2cd){if(!_0x50b2cd){_0x15ebe0[_0x81ff('0x24')](0x194);}return _0x50b2cd;};}function handleError(_0x27dade,_0x5f5787){_0x5f5787=_0x5f5787||0x1f4;return function(_0x1f6d19){logger[_0x81ff('0x25')](_0x1f6d19[_0x81ff('0x26')]);if(_0x1f6d19[_0x81ff('0x27')]){delete _0x1f6d19[_0x81ff('0x27')];}_0x27dade[_0x81ff('0x16')](_0x5f5787)[_0x81ff('0x28')](_0x1f6d19);};}exports[_0x81ff('0x29')]=function(_0x2d2eb2,_0x56d0c2){var _0x37dce5={},_0x10415c={},_0x12b803={'count':0x0,'rows':[]};var _0x1b8519=_[_0x81ff('0x2a')](db[_0x81ff('0x2b')][_0x81ff('0x2c')],function(_0x5d2415){return{'name':_0x5d2415[_0x81ff('0x2d')],'type':_0x5d2415[_0x81ff('0x2e')]['key']};});_0x10415c[_0x81ff('0x2f')]=_[_0x81ff('0x2a')](_0x1b8519,_0x81ff('0x27'));_0x10415c['query']=_['keys'](_0x2d2eb2[_0x81ff('0x30')]);_0x10415c[_0x81ff('0x31')]=_[_0x81ff('0x32')](_0x10415c['model'],_0x10415c[_0x81ff('0x30')]);_0x37dce5['attributes']=_[_0x81ff('0x32')](_0x10415c[_0x81ff('0x2f')],qs[_0x81ff('0x33')](_0x2d2eb2[_0x81ff('0x30')][_0x81ff('0x33')]));_0x37dce5[_0x81ff('0x34')]=_0x37dce5[_0x81ff('0x34')][_0x81ff('0x35')]?_0x37dce5[_0x81ff('0x34')]:_0x10415c[_0x81ff('0x2f')];if(!_0x2d2eb2['query'][_0x81ff('0x36')]('nolimit')){_0x37dce5[_0x81ff('0x1b')]=qs['limit'](_0x2d2eb2[_0x81ff('0x30')][_0x81ff('0x1b')]);_0x37dce5[_0x81ff('0x19')]=qs[_0x81ff('0x19')](_0x2d2eb2[_0x81ff('0x30')][_0x81ff('0x19')]);}_0x37dce5[_0x81ff('0x37')]=qs['sort'](_0x2d2eb2[_0x81ff('0x30')][_0x81ff('0x38')]);_0x37dce5[_0x81ff('0x39')]=qs[_0x81ff('0x31')](_['pick'](_0x2d2eb2[_0x81ff('0x30')],_0x10415c[_0x81ff('0x31')]),_0x1b8519);if(_0x2d2eb2['query'][_0x81ff('0x3a')]){_0x37dce5[_0x81ff('0x39')]=_[_0x81ff('0x3b')](_0x37dce5[_0x81ff('0x39')],{'$or':_[_0x81ff('0x2a')](_0x1b8519,function(_0x409f7d){if(_0x409f7d[_0x81ff('0x2e')]!==_0x81ff('0x3c')){var _0x16a83b={};_0x16a83b[_0x409f7d[_0x81ff('0x27')]]={'$like':'%'+_0x2d2eb2[_0x81ff('0x30')][_0x81ff('0x3a')]+'%'};return _0x16a83b;}})});}_0x37dce5=_[_0x81ff('0x3b')]({},_0x37dce5,_0x2d2eb2[_0x81ff('0x3d')]);var _0x38ffc1={'where':_0x37dce5[_0x81ff('0x39')]};return db[_0x81ff('0x2b')][_0x81ff('0x1c')](_0x38ffc1)['then'](function(_0x4e4c87){_0x12b803[_0x81ff('0x1c')]=_0x4e4c87;if(_0x2d2eb2[_0x81ff('0x30')]['includeAll']){_0x37dce5[_0x81ff('0x3e')]=[{'all':!![]}];}return db[_0x81ff('0x2b')][_0x81ff('0x3f')](_0x37dce5);})['then'](function(_0x3af02f){_0x12b803[_0x81ff('0x40')]=_0x3af02f;return _0x12b803;})['then'](respondWithFilteredResult(_0x56d0c2,_0x37dce5))[_0x81ff('0x41')](handleError(_0x56d0c2,null));};exports[_0x81ff('0x42')]=function(_0xc83358,_0x78d4f4){var _0x3a9e55={'raw':!![],'where':{'id':_0xc83358[_0x81ff('0x43')]['id']}},_0x336459={};_0x336459[_0x81ff('0x2f')]=_[_0x81ff('0x44')](db[_0x81ff('0x2b')][_0x81ff('0x2c')]);_0x336459['query']=_[_0x81ff('0x44')](_0xc83358['query']);_0x336459[_0x81ff('0x31')]=_[_0x81ff('0x32')](_0x336459['model'],_0x336459[_0x81ff('0x30')]);_0x3a9e55['attributes']=_['intersection'](_0x336459[_0x81ff('0x2f')],qs[_0x81ff('0x33')](_0xc83358[_0x81ff('0x30')]['fields']));_0x3a9e55[_0x81ff('0x34')]=_0x3a9e55[_0x81ff('0x34')]['length']?_0x3a9e55['attributes']:_0x336459[_0x81ff('0x2f')];if(_0xc83358[_0x81ff('0x30')][_0x81ff('0x45')]){_0x3a9e55['include']=[{'all':!![]}];}_0x3a9e55=_[_0x81ff('0x3b')]({},_0x3a9e55,_0xc83358[_0x81ff('0x3d')]);return db[_0x81ff('0x2b')]['find'](_0x3a9e55)[_0x81ff('0x22')](handleEntityNotFound(_0x78d4f4,null))[_0x81ff('0x22')](respondWithResult(_0x78d4f4,null))['catch'](handleError(_0x78d4f4,null));};exports['create']=function(_0x29d89c,_0x1a1d37){return db['JscriptyQuestionReport']['create'](_0x29d89c[_0x81ff('0x46')],{})[_0x81ff('0x22')](respondWithResult(_0x1a1d37,0xc9))[_0x81ff('0x41')](handleError(_0x1a1d37,null));};exports['update']=function(_0x2627b1,_0x5e3f2f){if(_0x2627b1[_0x81ff('0x46')]['id']){delete _0x2627b1[_0x81ff('0x46')]['id'];}return db[_0x81ff('0x2b')][_0x81ff('0x47')]({'where':{'id':_0x2627b1['params']['id']}})[_0x81ff('0x22')](handleEntityNotFound(_0x5e3f2f,null))[_0x81ff('0x22')](saveUpdates(_0x2627b1['body'],null))['then'](respondWithResult(_0x5e3f2f,null))['catch'](handleError(_0x5e3f2f,null));};exports[_0x81ff('0x23')]=function(_0x579d84,_0x49a2f0){return db[_0x81ff('0x2b')][_0x81ff('0x47')]({'where':{'id':_0x579d84[_0x81ff('0x43')]['id']}})[_0x81ff('0x22')](handleEntityNotFound(_0x49a2f0,null))[_0x81ff('0x22')](removeEntity(_0x49a2f0,null))['catch'](handleError(_0x49a2f0,null));};exports[_0x81ff('0x48')]=function(_0x13daf2,_0x24b8a8){return db[_0x81ff('0x2b')][_0x81ff('0x48')]()[_0x81ff('0x22')](respondWithResult(_0x24b8a8,null))[_0x81ff('0x41')](handleError(_0x24b8a8,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 48bcd7a..cab2bdf 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 _0x7ef2=['path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','exports','define','JscriptyQuestionReport','report_jscripty_questions','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0x495de6,_0x3797c1){var _0x5a352f=function(_0x153049){while(--_0x153049){_0x495de6['push'](_0x495de6['shift']());}};_0x5a352f(++_0x3797c1);}(_0x7ef2,0xa4));var _0x27ef=function(_0xe3daf0,_0x53621c){_0xe3daf0=_0xe3daf0-0x0;var _0x415597=_0x7ef2[_0xe3daf0];return _0x415597;};'use strict';var _=require(_0x27ef('0x0'));var util=require('util');var logger=require(_0x27ef('0x1'))('api');var moment=require(_0x27ef('0x2'));var BPromise=require(_0x27ef('0x3'));var rp=require(_0x27ef('0x4'));var fs=require('fs');var path=require(_0x27ef('0x5'));var rimraf=require(_0x27ef('0x6'));var config=require(_0x27ef('0x7'));var attributes=require(_0x27ef('0x8'));module[_0x27ef('0x9')]=function(_0x3239b4,_0x3d1cb7){return _0x3239b4[_0x27ef('0xa')](_0x27ef('0xb'),attributes,{'tableName':_0x27ef('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc46e=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','JscriptyQuestionReport','report_jscripty_questions','lodash'];(function(_0x4805a6,_0x759130){var _0x2916f9=function(_0x465a47){while(--_0x465a47){_0x4805a6['push'](_0x4805a6['shift']());}};_0x2916f9(++_0x759130);}(_0xc46e,0x1ed));var _0xec46=function(_0x4efd3d,_0x2b9694){_0x4efd3d=_0x4efd3d-0x0;var _0x1293f2=_0xc46e[_0x4efd3d];return _0x1293f2;};'use strict';var _=require(_0xec46('0x0'));var util=require(_0xec46('0x1'));var logger=require(_0xec46('0x2'))(_0xec46('0x3'));var moment=require(_0xec46('0x4'));var BPromise=require(_0xec46('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xec46('0x6'));var rimraf=require(_0xec46('0x7'));var config=require(_0xec46('0x8'));var attributes=require('./jscriptyQuestionReport.attributes');module[_0xec46('0x9')]=function(_0x42d4e8,_0x338593){return _0x42d4e8[_0xec46('0xa')](_0xec46('0xb'),attributes,{'tableName':_0xec46('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 0f231c9..9551752 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 _0x7f3a=['client','http','then','info','debug','request\x20sent','stringify','error','JscriptyQuestionReport,\x20%s,\x20%s','message','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x4b1936,_0x42bbd5){var _0x5ee8ce=function(_0x8c00c5){while(--_0x8c00c5){_0x4b1936['push'](_0x4b1936['shift']());}};_0x5ee8ce(++_0x42bbd5);}(_0x7f3a,0xee));var _0xa7f3=function(_0x4497b6,_0x38403a){_0x4497b6=_0x4497b6-0x0;var _0x2641a2=_0x7f3a[_0x4497b6];return _0x2641a2;};'use strict';var _=require(_0xa7f3('0x0'));var util=require('util');var moment=require(_0xa7f3('0x1'));var BPromise=require(_0xa7f3('0x2'));var rs=require(_0xa7f3('0x3'));var fs=require('fs');var Redis=require(_0xa7f3('0x4'));var db=require(_0xa7f3('0x5'))['db'];var utils=require(_0xa7f3('0x6'));var logger=require(_0xa7f3('0x7'))('rpc');var config=require(_0xa7f3('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xa7f3('0x9')][_0xa7f3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x26c99d,_0x2cad2c,_0x20386e){return new BPromise(function(_0x37eb15,_0x341e01){return client['request'](_0x26c99d,_0x20386e)[_0xa7f3('0xb')](function(_0x3f4589){logger[_0xa7f3('0xc')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x2cad2c,'request\x20sent');logger[_0xa7f3('0xd')]('JscriptyQuestionReport,\x20%s,\x20%s,\x20%s',_0x2cad2c,_0xa7f3('0xe'),JSON[_0xa7f3('0xf')](_0x3f4589));if(_0x3f4589['error']){if(_0x3f4589['error']['code']===0x1f4){logger[_0xa7f3('0x10')](_0xa7f3('0x11'),_0x2cad2c,_0x3f4589[_0xa7f3('0x10')][_0xa7f3('0x12')]);return _0x341e01(_0x3f4589[_0xa7f3('0x10')][_0xa7f3('0x12')]);}logger[_0xa7f3('0x10')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x2cad2c,_0x3f4589[_0xa7f3('0x10')][_0xa7f3('0x12')]);return _0x37eb15(_0x3f4589[_0xa7f3('0x10')][_0xa7f3('0x12')]);}else{logger[_0xa7f3('0xc')](_0xa7f3('0x11'),_0x2cad2c,_0xa7f3('0xe'));_0x37eb15(_0x3f4589['result']['message']);}})['catch'](function(_0x35470d){logger[_0xa7f3('0x10')](_0xa7f3('0x11'),_0x2cad2c,_0x35470d);_0x341e01(_0x35470d);});});} \ No newline at end of file +var _0xdea9=['../../config/logger','../../config/environment','client','http','request','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x4d5b07,_0x2d59df){var _0x3a10b0=function(_0x5693a2){while(--_0x5693a2){_0x4d5b07['push'](_0x4d5b07['shift']());}};_0x3a10b0(++_0x2d59df);}(_0xdea9,0x1b4));var _0x9dea=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xdea9[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x9dea('0x0'));var rs=require(_0x9dea('0x1'));var fs=require('fs');var Redis=require(_0x9dea('0x2'));var db=require(_0x9dea('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x9dea('0x4'))('rpc');var config=require(_0x9dea('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x9dea('0x6')][_0x9dea('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1460bd,_0x99a26c,_0x1d9f09){return new BPromise(function(_0x1416a7,_0x61cee1){return client[_0x9dea('0x8')](_0x1460bd,_0x1d9f09)['then'](function(_0x3bd6f7){logger[_0x9dea('0x9')](_0x9dea('0xa'),_0x99a26c,_0x9dea('0xb'));logger[_0x9dea('0xc')](_0x9dea('0xd'),_0x99a26c,_0x9dea('0xb'),JSON[_0x9dea('0xe')](_0x3bd6f7));if(_0x3bd6f7[_0x9dea('0xf')]){if(_0x3bd6f7['error'][_0x9dea('0x10')]===0x1f4){logger[_0x9dea('0xf')](_0x9dea('0xa'),_0x99a26c,_0x3bd6f7[_0x9dea('0xf')][_0x9dea('0x11')]);return _0x61cee1(_0x3bd6f7[_0x9dea('0xf')][_0x9dea('0x11')]);}logger['error'](_0x9dea('0xa'),_0x99a26c,_0x3bd6f7[_0x9dea('0xf')][_0x9dea('0x11')]);return _0x1416a7(_0x3bd6f7[_0x9dea('0xf')][_0x9dea('0x11')]);}else{logger[_0x9dea('0x9')](_0x9dea('0xa'),_0x99a26c,_0x9dea('0xb'));_0x1416a7(_0x3bd6f7[_0x9dea('0x12')][_0x9dea('0x11')]);}})[_0x9dea('0x13')](function(_0x3a663a){logger[_0x9dea('0xf')](_0x9dea('0xa'),_0x99a26c,_0x3a663a);_0x61cee1(_0x3a663a);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index ca55b87..05ecece 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 _0x934d=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/questions','getQuestions','post','create','put','delete'];(function(_0x4e025b,_0x1301d3){var _0x217a0a=function(_0x73d2e6){while(--_0x73d2e6){_0x4e025b['push'](_0x4e025b['shift']());}};_0x217a0a(++_0x1301d3);}(_0x934d,0x182));var _0xd934=function(_0x1abb09,_0x18ee91){_0x1abb09=_0x1abb09-0x0;var _0xea1c07=_0x934d[_0x1abb09];return _0xea1c07;};'use strict';var multer=require(_0xd934('0x0'));var util=require(_0xd934('0x1'));var path=require(_0xd934('0x2'));var timeout=require(_0xd934('0x3'));var express=require(_0xd934('0x4'));var router=express[_0xd934('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xd934('0x6'));var interaction=require(_0xd934('0x7'));var config=require(_0xd934('0x8'));var controller=require('./jscriptySessionReport.controller');router[_0xd934('0x9')]('/',auth['isAuthenticated'](),controller[_0xd934('0xa')]);router[_0xd934('0x9')](_0xd934('0xb'),auth[_0xd934('0xc')](),controller[_0xd934('0xd')]);router[_0xd934('0x9')](_0xd934('0xe'),auth[_0xd934('0xc')](),controller[_0xd934('0xf')]);router['get'](_0xd934('0x10'),auth['isAuthenticated'](),controller[_0xd934('0x11')]);router[_0xd934('0x12')]('/',auth[_0xd934('0xc')](),controller[_0xd934('0x13')]);router[_0xd934('0x14')](_0xd934('0xe'),auth[_0xd934('0xc')](),controller['update']);router[_0xd934('0x15')](_0xd934('0xe'),auth[_0xd934('0xc')](),controller[_0xd934('0x16')]);module[_0xd934('0x17')]=router; \ No newline at end of file +var _0xf51f=['isAuthenticated','describe','show','get','getQuestions','post','put','/:id','update','destroy','multer','util','path','../../components/auth/service','../../config/environment'];(function(_0x173452,_0x3aa870){var _0xee3fd0=function(_0x10eb01){while(--_0x10eb01){_0x173452['push'](_0x173452['shift']());}};_0xee3fd0(++_0x3aa870);}(_0xf51f,0xbe));var _0xff51=function(_0x199c03,_0x3254aa){_0x199c03=_0x199c03-0x0;var _0x11a7d4=_0xf51f[_0x199c03];return _0x11a7d4;};'use strict';var multer=require(_0xff51('0x0'));var util=require(_0xff51('0x1'));var path=require(_0xff51('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xff51('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xff51('0x4'));var controller=require('./jscriptySessionReport.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router['get']('/describe',auth[_0xff51('0x5')](),controller[_0xff51('0x6')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xff51('0x7')]);router[_0xff51('0x8')]('/:id/questions',auth[_0xff51('0x5')](),controller[_0xff51('0x9')]);router[_0xff51('0xa')]('/',auth[_0xff51('0x5')](),controller['create']);router[_0xff51('0xb')](_0xff51('0xc'),auth[_0xff51('0x5')](),controller[_0xff51('0xd')]);router['delete'](_0xff51('0xc'),auth[_0xff51('0x5')](),controller[_0xff51('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index c7d9fea..430446e 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 _0x2c65=['format','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','sequelize','exports','DATE','setDataValue','endtime'];(function(_0x344c07,_0x25d8fb){var _0x4afd1b=function(_0x9cc65){while(--_0x9cc65){_0x344c07['push'](_0x344c07['shift']());}};_0x4afd1b(++_0x25d8fb);}(_0x2c65,0xca));var _0x52c6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2c65[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require('moment');var Sequelize=require(_0x52c6('0x0'));module[_0x52c6('0x1')]={'starttime':{'type':Sequelize[_0x52c6('0x2')],'set':function(_0x637d90){this[_0x52c6('0x3')]('starttime',_0x637d90);this[_0x52c6('0x3')](_0x52c6('0x4'),moment()[_0x52c6('0x5')](_0x52c6('0x6')));}},'endtime':{'type':Sequelize[_0x52c6('0x2')]},'membername':{'type':Sequelize[_0x52c6('0x7')]},'projectname':{'type':Sequelize[_0x52c6('0x7')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x52c6('0x7')]},'calleridname':{'type':Sequelize[_0x52c6('0x7')]},'calleridnum':{'type':Sequelize[_0x52c6('0x7')]},'completed':{'type':Sequelize[_0x52c6('0x8')],'defaultValue':![]}}; \ No newline at end of file +var _0x00a0=['setDataValue','starttime','format','STRING','BOOLEAN','moment','exports','DATE'];(function(_0x362bd8,_0x24dad2){var _0x5b25df=function(_0x2b0d39){while(--_0x2b0d39){_0x362bd8['push'](_0x362bd8['shift']());}};_0x5b25df(++_0x24dad2);}(_0x00a0,0xd5));var _0x000a=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x00a0[_0x122ef9];return _0x42fba0;};'use strict';var moment=require(_0x000a('0x0'));var Sequelize=require('sequelize');module[_0x000a('0x1')]={'starttime':{'type':Sequelize[_0x000a('0x2')],'set':function(_0x37081){this[_0x000a('0x3')](_0x000a('0x4'),_0x37081);this[_0x000a('0x3')]('endtime',moment()[_0x000a('0x5')]('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize[_0x000a('0x2')]},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0x000a('0x6')]},'queue':{'type':Sequelize[_0x000a('0x6')]},'uniqueid':{'type':Sequelize[_0x000a('0x6')]},'calleridname':{'type':Sequelize[_0x000a('0x6')]},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize[_0x000a('0x7')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 6f648c2..56fea6f 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 _0xa4e4=['Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','JscriptySessionReport','rawAttributes','fieldName','type','keys','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','params','find','body','describe','getQuestions','findOne','SessionId','JscriptyQuestionReport','rows','eml-format','rimraf','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','count','set'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa4e4,0x1c2));var _0x4a4e=function(_0x57a5e5,_0x18b0d6){_0x57a5e5=_0x57a5e5-0x0;var _0x354012=_0xa4e4[_0x57a5e5];return _0x354012;};'use strict';var emlformat=require(_0x4a4e('0x0'));var rimraf=require(_0x4a4e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x4a4e('0x2'));var moment=require(_0x4a4e('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4a4e('0x4'));var path=require(_0x4a4e('0x5'));var sox=require(_0x4a4e('0x6'));var csv=require(_0x4a4e('0x7'));var ejs=require(_0x4a4e('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4a4e('0x9'));var squel=require(_0x4a4e('0xa'));var crypto=require(_0x4a4e('0xb'));var jsforce=require(_0x4a4e('0xc'));var deskjs=require(_0x4a4e('0xd'));var toCsv=require('to-csv');var querystring=require(_0x4a4e('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x4a4e('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x4a4e('0x10'));var hardwareService=require(_0x4a4e('0x11'));var logger=require(_0x4a4e('0x12'))(_0x4a4e('0x13'));var utils=require(_0x4a4e('0x14'));var config=require(_0x4a4e('0x15'));var licenseUtil=require(_0x4a4e('0x16'));var db=require(_0x4a4e('0x17'))['db'];function respondWithStatusCode(_0x513b7a,_0xe8f556){_0xe8f556=_0xe8f556||0xcc;return function(_0x21cadc){if(_0x21cadc){return _0x513b7a['sendStatus'](_0xe8f556);}return _0x513b7a[_0x4a4e('0x18')](_0xe8f556)[_0x4a4e('0x19')]();};}function respondWithResult(_0x17a544,_0x1029ab){_0x1029ab=_0x1029ab||0xc8;return function(_0x4319f7){if(_0x4319f7){return _0x17a544[_0x4a4e('0x18')](_0x1029ab)['json'](_0x4319f7);}};}function respondWithFilteredResult(_0xdfe84,_0x5da935){return function(_0x518d45){if(_0x518d45){var _0x354d5e=typeof _0x5da935[_0x4a4e('0x1a')]===_0x4a4e('0x1b')&&typeof _0x5da935['limit']===_0x4a4e('0x1b');var _0x7bfe29=_0x518d45['count'];var _0x51dc6f=_0x354d5e?0x0:_0x5da935[_0x4a4e('0x1a')];var _0x305e8c=_0x354d5e?_0x518d45[_0x4a4e('0x1c')]:_0x5da935[_0x4a4e('0x1a')]+_0x5da935['limit'];var _0xe783da;if(_0x305e8c>=_0x7bfe29){_0x305e8c=_0x7bfe29;_0xe783da=0xc8;}else{_0xe783da=0xce;}_0xdfe84['status'](_0xe783da);return _0xdfe84[_0x4a4e('0x1d')](_0x4a4e('0x1e'),_0x51dc6f+'-'+_0x305e8c+'/'+_0x7bfe29)[_0x4a4e('0x1f')](_0x518d45);}return null;};}function patchUpdates(_0x2fcf5a){return function(_0x21acf1){try{jsonpatch[_0x4a4e('0x20')](_0x21acf1,_0x2fcf5a,!![]);}catch(_0x37988c){return BPromise[_0x4a4e('0x21')](_0x37988c);}return _0x21acf1[_0x4a4e('0x22')]();};}function saveUpdates(_0x29aa04,_0x82e3ae){return function(_0x5a74b9){if(_0x5a74b9){return _0x5a74b9[_0x4a4e('0x23')](_0x29aa04)[_0x4a4e('0x24')](function(_0x40ad6c){return _0x40ad6c;});}return null;};}function removeEntity(_0x23441b,_0x54f27e){return function(_0x21001f){if(_0x21001f){return _0x21001f[_0x4a4e('0x25')]()[_0x4a4e('0x24')](function(){_0x23441b[_0x4a4e('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f9d57,_0x49c716){return function(_0x4a92b8){if(!_0x4a92b8){_0x1f9d57[_0x4a4e('0x26')](0x194);}return _0x4a92b8;};}function handleError(_0x3ddc15,_0x20941f){_0x20941f=_0x20941f||0x1f4;return function(_0x32a8b1){logger[_0x4a4e('0x27')](_0x32a8b1[_0x4a4e('0x28')]);if(_0x32a8b1['name']){delete _0x32a8b1[_0x4a4e('0x29')];}_0x3ddc15['status'](_0x20941f)[_0x4a4e('0x2a')](_0x32a8b1);};}exports[_0x4a4e('0x2b')]=function(_0x5b6b4f,_0x3c88d3){var _0x39aff7={},_0xfa416c={},_0x132cb8={'count':0x0,'rows':[]};var _0x39aa01=_[_0x4a4e('0x2c')](db[_0x4a4e('0x2d')][_0x4a4e('0x2e')],function(_0x198742){return{'name':_0x198742[_0x4a4e('0x2f')],'type':_0x198742[_0x4a4e('0x30')]['key']};});_0xfa416c['model']=_['map'](_0x39aa01,'name');_0xfa416c['query']=_[_0x4a4e('0x31')](_0x5b6b4f[_0x4a4e('0x32')]);_0xfa416c[_0x4a4e('0x33')]=_['intersection'](_0xfa416c[_0x4a4e('0x34')],_0xfa416c[_0x4a4e('0x32')]);_0x39aff7[_0x4a4e('0x35')]=_[_0x4a4e('0x36')](_0xfa416c[_0x4a4e('0x34')],qs['fields'](_0x5b6b4f[_0x4a4e('0x32')][_0x4a4e('0x37')]));_0x39aff7[_0x4a4e('0x35')]=_0x39aff7['attributes'][_0x4a4e('0x38')]?_0x39aff7[_0x4a4e('0x35')]:_0xfa416c[_0x4a4e('0x34')];if(!_0x5b6b4f[_0x4a4e('0x32')][_0x4a4e('0x39')](_0x4a4e('0x3a'))){_0x39aff7[_0x4a4e('0x3b')]=qs[_0x4a4e('0x3b')](_0x5b6b4f[_0x4a4e('0x32')][_0x4a4e('0x3b')]);_0x39aff7['offset']=qs['offset'](_0x5b6b4f[_0x4a4e('0x32')]['offset']);}_0x39aff7['order']=qs[_0x4a4e('0x3c')](_0x5b6b4f[_0x4a4e('0x32')]['sort']);_0x39aff7[_0x4a4e('0x3d')]=qs[_0x4a4e('0x33')](_[_0x4a4e('0x3e')](_0x5b6b4f[_0x4a4e('0x32')],_0xfa416c['filters']),_0x39aa01);if(_0x5b6b4f['query'][_0x4a4e('0x3f')]){_0x39aff7[_0x4a4e('0x3d')]=_['merge'](_0x39aff7[_0x4a4e('0x3d')],{'$or':_[_0x4a4e('0x2c')](_0x39aa01,function(_0x4de33f){if(_0x4de33f[_0x4a4e('0x30')]!==_0x4a4e('0x40')){var _0x2be8e={};_0x2be8e[_0x4de33f[_0x4a4e('0x29')]]={'$like':'%'+_0x5b6b4f[_0x4a4e('0x32')][_0x4a4e('0x3f')]+'%'};return _0x2be8e;}})});}_0x39aff7=_[_0x4a4e('0x41')]({},_0x39aff7,_0x5b6b4f[_0x4a4e('0x42')]);var _0x19025a={'where':_0x39aff7[_0x4a4e('0x3d')]};return db[_0x4a4e('0x2d')]['count'](_0x19025a)[_0x4a4e('0x24')](function(_0x12e4f5){_0x132cb8['count']=_0x12e4f5;if(_0x5b6b4f[_0x4a4e('0x32')][_0x4a4e('0x43')]){_0x39aff7[_0x4a4e('0x44')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0x4a4e('0x45')](_0x39aff7);})['then'](function(_0x465ddf){_0x132cb8['rows']=_0x465ddf;return _0x132cb8;})[_0x4a4e('0x24')](respondWithFilteredResult(_0x3c88d3,_0x39aff7))[_0x4a4e('0x46')](handleError(_0x3c88d3,null));};exports['show']=function(_0x255beb,_0x37cd3c){var _0x41e52b={'raw':!![],'where':{'id':_0x255beb[_0x4a4e('0x47')]['id']}},_0x29db53={};_0x29db53['model']=_[_0x4a4e('0x31')](db[_0x4a4e('0x2d')][_0x4a4e('0x2e')]);_0x29db53['query']=_[_0x4a4e('0x31')](_0x255beb[_0x4a4e('0x32')]);_0x29db53[_0x4a4e('0x33')]=_['intersection'](_0x29db53[_0x4a4e('0x34')],_0x29db53[_0x4a4e('0x32')]);_0x41e52b[_0x4a4e('0x35')]=_[_0x4a4e('0x36')](_0x29db53[_0x4a4e('0x34')],qs['fields'](_0x255beb['query'][_0x4a4e('0x37')]));_0x41e52b[_0x4a4e('0x35')]=_0x41e52b[_0x4a4e('0x35')][_0x4a4e('0x38')]?_0x41e52b['attributes']:_0x29db53[_0x4a4e('0x34')];if(_0x255beb[_0x4a4e('0x32')]['includeAll']){_0x41e52b[_0x4a4e('0x44')]=[{'all':!![]}];}_0x41e52b=_[_0x4a4e('0x41')]({},_0x41e52b,_0x255beb[_0x4a4e('0x42')]);return db[_0x4a4e('0x2d')][_0x4a4e('0x48')](_0x41e52b)[_0x4a4e('0x24')](handleEntityNotFound(_0x37cd3c,null))[_0x4a4e('0x24')](respondWithResult(_0x37cd3c,null))[_0x4a4e('0x46')](handleError(_0x37cd3c,null));};exports['create']=function(_0x1b9830,_0x48f01e){return db[_0x4a4e('0x2d')]['create'](_0x1b9830[_0x4a4e('0x49')],{})['then'](respondWithResult(_0x48f01e,0xc9))[_0x4a4e('0x46')](handleError(_0x48f01e,null));};exports[_0x4a4e('0x23')]=function(_0x582add,_0x35e1c2){if(_0x582add['body']['id']){delete _0x582add[_0x4a4e('0x49')]['id'];}return db[_0x4a4e('0x2d')][_0x4a4e('0x48')]({'where':{'id':_0x582add[_0x4a4e('0x47')]['id']}})[_0x4a4e('0x24')](handleEntityNotFound(_0x35e1c2,null))[_0x4a4e('0x24')](saveUpdates(_0x582add[_0x4a4e('0x49')],null))[_0x4a4e('0x24')](respondWithResult(_0x35e1c2,null))[_0x4a4e('0x46')](handleError(_0x35e1c2,null));};exports[_0x4a4e('0x25')]=function(_0x4898e5,_0x405440){return db[_0x4a4e('0x2d')][_0x4a4e('0x48')]({'where':{'id':_0x4898e5['params']['id']}})[_0x4a4e('0x24')](handleEntityNotFound(_0x405440,null))[_0x4a4e('0x24')](removeEntity(_0x405440,null))['catch'](handleError(_0x405440,null));};exports['describe']=function(_0x55f168,_0x32c56d){return db[_0x4a4e('0x2d')][_0x4a4e('0x4a')]()[_0x4a4e('0x24')](respondWithResult(_0x32c56d,null))['catch'](handleError(_0x32c56d,null));};exports[_0x4a4e('0x4b')]=function(_0x132619,_0x569460,_0x556003){var _0x15b19b={'raw':!![],'where':{}};var _0x125f28={};var _0xcdc627={'count':0x0,'rows':[]};return db[_0x4a4e('0x2d')][_0x4a4e('0x4c')]({'where':{'id':_0x132619[_0x4a4e('0x47')]['id']}})[_0x4a4e('0x24')](handleEntityNotFound(_0x569460,null))['then'](function(_0x5a0a84){if(_0x5a0a84){_0x125f28['model']=_[_0x4a4e('0x31')](db['JscriptyQuestionReport'][_0x4a4e('0x2e')]);_0x125f28[_0x4a4e('0x32')]=_[_0x4a4e('0x31')](_0x132619[_0x4a4e('0x32')]);_0x125f28[_0x4a4e('0x33')]=_[_0x4a4e('0x36')](_0x125f28[_0x4a4e('0x34')],_0x125f28[_0x4a4e('0x32')]);_0x15b19b[_0x4a4e('0x35')]=_[_0x4a4e('0x36')](_0x125f28[_0x4a4e('0x34')],qs[_0x4a4e('0x37')](_0x132619[_0x4a4e('0x32')][_0x4a4e('0x37')]));_0x15b19b['attributes']=_0x15b19b[_0x4a4e('0x35')]['length']?_0x15b19b['attributes']:_0x125f28[_0x4a4e('0x34')];if(!_0x132619[_0x4a4e('0x32')][_0x4a4e('0x39')]('nolimit')){_0x15b19b[_0x4a4e('0x3b')]=qs['limit'](_0x132619['query']['limit']);_0x15b19b[_0x4a4e('0x1a')]=qs[_0x4a4e('0x1a')](_0x132619['query'][_0x4a4e('0x1a')]);}_0x15b19b['order']=qs[_0x4a4e('0x3c')](_0x132619[_0x4a4e('0x32')]['sort']);_0x15b19b['where']=qs['filters'](_[_0x4a4e('0x3e')](_0x132619['query'],_0x125f28[_0x4a4e('0x33')]));_0x15b19b[_0x4a4e('0x3d')][_0x4a4e('0x4d')]=_0x5a0a84['id'];if(_0x132619['query'][_0x4a4e('0x3f')]){_0x15b19b['where']=_[_0x4a4e('0x41')](_0x15b19b[_0x4a4e('0x3d')],{'$or':_[_0x4a4e('0x2c')](_0x15b19b['attributes'],function(_0x166575){var _0x508ca8={};_0x508ca8[_0x166575]={'$like':'%'+_0x132619[_0x4a4e('0x32')][_0x4a4e('0x3f')]+'%'};return _0x508ca8;})});}_0x15b19b=_[_0x4a4e('0x41')]({},_0x15b19b,_0x132619[_0x4a4e('0x42')]);return db[_0x4a4e('0x4e')][_0x4a4e('0x1c')]({'where':_0x15b19b[_0x4a4e('0x3d')]})['then'](function(_0x5015d3){_0xcdc627['count']=_0x5015d3;if(_0x132619['query']['includeAll']){_0x15b19b[_0x4a4e('0x44')]=[{'all':!![]}];}return db[_0x4a4e('0x4e')][_0x4a4e('0x45')](_0x15b19b);})[_0x4a4e('0x24')](function(_0xbb97ee){_0xcdc627[_0x4a4e('0x4f')]=_0xbb97ee;return _0xcdc627;});}})[_0x4a4e('0x24')](respondWithFilteredResult(_0x569460,_0x15b19b))[_0x4a4e('0x46')](handleError(_0x569460,null));}; \ No newline at end of file +var _0x1613=['fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','catch','show','body','find','params','getQuestions','findOne','rawAttributes','SessionId','JscriptyQuestionReport','findAll','rows','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','map','JscriptySessionReport'];(function(_0x2634a7,_0x118508){var _0xa52e2c=function(_0x400f75){while(--_0x400f75){_0x2634a7['push'](_0x2634a7['shift']());}};_0xa52e2c(++_0x118508);}(_0x1613,0x113));var _0x3161=function(_0x45b188,_0x2bdbd1){_0x45b188=_0x45b188-0x0;var _0x59ae2a=_0x1613[_0x45b188];return _0x59ae2a;};'use strict';var emlformat=require(_0x3161('0x0'));var rimraf=require(_0x3161('0x1'));var zipdir=require(_0x3161('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3161('0x3'));var moment=require('moment');var BPromise=require(_0x3161('0x4'));var Mustache=require(_0x3161('0x5'));var util=require(_0x3161('0x6'));var path=require(_0x3161('0x7'));var sox=require('sox');var csv=require(_0x3161('0x8'));var ejs=require(_0x3161('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3161('0xa'));var squel=require(_0x3161('0xb'));var crypto=require(_0x3161('0xc'));var jsforce=require(_0x3161('0xd'));var deskjs=require(_0x3161('0xe'));var toCsv=require('to-csv');var querystring=require(_0x3161('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x3161('0x10'));var qs=require(_0x3161('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3161('0x12'));var logger=require(_0x3161('0x13'))(_0x3161('0x14'));var utils=require(_0x3161('0x15'));var config=require(_0x3161('0x16'));var licenseUtil=require(_0x3161('0x17'));var db=require(_0x3161('0x18'))['db'];function respondWithStatusCode(_0x4b95c4,_0x47b656){_0x47b656=_0x47b656||0xcc;return function(_0x3b8b34){if(_0x3b8b34){return _0x4b95c4[_0x3161('0x19')](_0x47b656);}return _0x4b95c4[_0x3161('0x1a')](_0x47b656)[_0x3161('0x1b')]();};}function respondWithResult(_0x35a2b4,_0x582b5e){_0x582b5e=_0x582b5e||0xc8;return function(_0x3c8d71){if(_0x3c8d71){return _0x35a2b4[_0x3161('0x1a')](_0x582b5e)[_0x3161('0x1c')](_0x3c8d71);}};}function respondWithFilteredResult(_0x4951c0,_0x37b454){return function(_0x1c4ab1){if(_0x1c4ab1){var _0x38f339=typeof _0x37b454[_0x3161('0x1d')]===_0x3161('0x1e')&&typeof _0x37b454[_0x3161('0x1f')]===_0x3161('0x1e');var _0xdb212c=_0x1c4ab1[_0x3161('0x20')];var _0x60b9a3=_0x38f339?0x0:_0x37b454[_0x3161('0x1d')];var _0x12fe01=_0x38f339?_0x1c4ab1['count']:_0x37b454[_0x3161('0x1d')]+_0x37b454[_0x3161('0x1f')];var _0x5b326e;if(_0x12fe01>=_0xdb212c){_0x12fe01=_0xdb212c;_0x5b326e=0xc8;}else{_0x5b326e=0xce;}_0x4951c0[_0x3161('0x1a')](_0x5b326e);return _0x4951c0[_0x3161('0x21')](_0x3161('0x22'),_0x60b9a3+'-'+_0x12fe01+'/'+_0xdb212c)[_0x3161('0x1c')](_0x1c4ab1);}return null;};}function patchUpdates(_0x2cabf0){return function(_0x10f40){try{jsonpatch[_0x3161('0x23')](_0x10f40,_0x2cabf0,!![]);}catch(_0x472db9){return BPromise[_0x3161('0x24')](_0x472db9);}return _0x10f40['save']();};}function saveUpdates(_0x2fb66e,_0xce365d){return function(_0x5f2694){if(_0x5f2694){return _0x5f2694[_0x3161('0x25')](_0x2fb66e)[_0x3161('0x26')](function(_0x329b70){return _0x329b70;});}return null;};}function removeEntity(_0xa21526,_0x830b71){return function(_0x338c59){if(_0x338c59){return _0x338c59[_0x3161('0x27')]()[_0x3161('0x26')](function(){_0xa21526[_0x3161('0x1a')](0xcc)[_0x3161('0x1b')]();});}};}function handleEntityNotFound(_0x2ce7be,_0x1f9d42){return function(_0x478b7b){if(!_0x478b7b){_0x2ce7be[_0x3161('0x19')](0x194);}return _0x478b7b;};}function handleError(_0x1e21df,_0x1812cf){_0x1812cf=_0x1812cf||0x1f4;return function(_0x491b05){logger['error'](_0x491b05[_0x3161('0x28')]);if(_0x491b05[_0x3161('0x29')]){delete _0x491b05[_0x3161('0x29')];}_0x1e21df[_0x3161('0x1a')](_0x1812cf)[_0x3161('0x2a')](_0x491b05);};}exports['index']=function(_0x4c69c2,_0x35f4f6){var _0xf77233={},_0x193955={},_0x194853={'count':0x0,'rows':[]};var _0x47137c=_[_0x3161('0x2b')](db[_0x3161('0x2c')]['rawAttributes'],function(_0x3d8b99){return{'name':_0x3d8b99[_0x3161('0x2d')],'type':_0x3d8b99[_0x3161('0x2e')][_0x3161('0x2f')]};});_0x193955[_0x3161('0x30')]=_[_0x3161('0x2b')](_0x47137c,'name');_0x193955[_0x3161('0x31')]=_[_0x3161('0x32')](_0x4c69c2[_0x3161('0x31')]);_0x193955[_0x3161('0x33')]=_[_0x3161('0x34')](_0x193955['model'],_0x193955['query']);_0xf77233[_0x3161('0x35')]=_[_0x3161('0x34')](_0x193955[_0x3161('0x30')],qs['fields'](_0x4c69c2[_0x3161('0x31')][_0x3161('0x36')]));_0xf77233['attributes']=_0xf77233[_0x3161('0x35')][_0x3161('0x37')]?_0xf77233[_0x3161('0x35')]:_0x193955[_0x3161('0x30')];if(!_0x4c69c2['query'][_0x3161('0x38')](_0x3161('0x39'))){_0xf77233[_0x3161('0x1f')]=qs[_0x3161('0x1f')](_0x4c69c2[_0x3161('0x31')][_0x3161('0x1f')]);_0xf77233[_0x3161('0x1d')]=qs[_0x3161('0x1d')](_0x4c69c2[_0x3161('0x31')][_0x3161('0x1d')]);}_0xf77233[_0x3161('0x3a')]=qs['sort'](_0x4c69c2[_0x3161('0x31')][_0x3161('0x3b')]);_0xf77233[_0x3161('0x3c')]=qs[_0x3161('0x33')](_[_0x3161('0x3d')](_0x4c69c2[_0x3161('0x31')],_0x193955[_0x3161('0x33')]),_0x47137c);if(_0x4c69c2[_0x3161('0x31')]['filter']){_0xf77233[_0x3161('0x3c')]=_[_0x3161('0x3e')](_0xf77233['where'],{'$or':_[_0x3161('0x2b')](_0x47137c,function(_0x341cd7){if(_0x341cd7[_0x3161('0x2e')]!==_0x3161('0x3f')){var _0x2085d8={};_0x2085d8[_0x341cd7[_0x3161('0x29')]]={'$like':'%'+_0x4c69c2[_0x3161('0x31')][_0x3161('0x40')]+'%'};return _0x2085d8;}})});}_0xf77233=_[_0x3161('0x3e')]({},_0xf77233,_0x4c69c2[_0x3161('0x41')]);var _0x5b17cb={'where':_0xf77233[_0x3161('0x3c')]};return db[_0x3161('0x2c')][_0x3161('0x20')](_0x5b17cb)[_0x3161('0x26')](function(_0x18c4b9){_0x194853['count']=_0x18c4b9;if(_0x4c69c2['query'][_0x3161('0x42')]){_0xf77233[_0x3161('0x43')]=[{'all':!![]}];}return db[_0x3161('0x2c')]['findAll'](_0xf77233);})['then'](function(_0x6c1555){_0x194853['rows']=_0x6c1555;return _0x194853;})[_0x3161('0x26')](respondWithFilteredResult(_0x35f4f6,_0xf77233))[_0x3161('0x44')](handleError(_0x35f4f6,null));};exports[_0x3161('0x45')]=function(_0x3d5af5,_0x30adac){var _0x3b7df4={'raw':!![],'where':{'id':_0x3d5af5['params']['id']}},_0x1b0ac1={};_0x1b0ac1[_0x3161('0x30')]=_[_0x3161('0x32')](db['JscriptySessionReport']['rawAttributes']);_0x1b0ac1['query']=_[_0x3161('0x32')](_0x3d5af5['query']);_0x1b0ac1[_0x3161('0x33')]=_[_0x3161('0x34')](_0x1b0ac1[_0x3161('0x30')],_0x1b0ac1['query']);_0x3b7df4[_0x3161('0x35')]=_[_0x3161('0x34')](_0x1b0ac1[_0x3161('0x30')],qs[_0x3161('0x36')](_0x3d5af5[_0x3161('0x31')][_0x3161('0x36')]));_0x3b7df4[_0x3161('0x35')]=_0x3b7df4['attributes']['length']?_0x3b7df4[_0x3161('0x35')]:_0x1b0ac1[_0x3161('0x30')];if(_0x3d5af5['query'][_0x3161('0x42')]){_0x3b7df4[_0x3161('0x43')]=[{'all':!![]}];}_0x3b7df4=_[_0x3161('0x3e')]({},_0x3b7df4,_0x3d5af5[_0x3161('0x41')]);return db[_0x3161('0x2c')]['find'](_0x3b7df4)[_0x3161('0x26')](handleEntityNotFound(_0x30adac,null))[_0x3161('0x26')](respondWithResult(_0x30adac,null))['catch'](handleError(_0x30adac,null));};exports['create']=function(_0x1b17bc,_0x7eabc){return db['JscriptySessionReport']['create'](_0x1b17bc[_0x3161('0x46')],{})['then'](respondWithResult(_0x7eabc,0xc9))['catch'](handleError(_0x7eabc,null));};exports[_0x3161('0x25')]=function(_0x3387d0,_0x53f58d){if(_0x3387d0[_0x3161('0x46')]['id']){delete _0x3387d0[_0x3161('0x46')]['id'];}return db[_0x3161('0x2c')][_0x3161('0x47')]({'where':{'id':_0x3387d0[_0x3161('0x48')]['id']}})[_0x3161('0x26')](handleEntityNotFound(_0x53f58d,null))[_0x3161('0x26')](saveUpdates(_0x3387d0[_0x3161('0x46')],null))[_0x3161('0x26')](respondWithResult(_0x53f58d,null))[_0x3161('0x44')](handleError(_0x53f58d,null));};exports['destroy']=function(_0x43dc26,_0x3c37d3){return db[_0x3161('0x2c')][_0x3161('0x47')]({'where':{'id':_0x43dc26[_0x3161('0x48')]['id']}})[_0x3161('0x26')](handleEntityNotFound(_0x3c37d3,null))[_0x3161('0x26')](removeEntity(_0x3c37d3,null))[_0x3161('0x44')](handleError(_0x3c37d3,null));};exports['describe']=function(_0x237ad7,_0x16f6fe){return db['JscriptySessionReport']['describe']()[_0x3161('0x26')](respondWithResult(_0x16f6fe,null))[_0x3161('0x44')](handleError(_0x16f6fe,null));};exports[_0x3161('0x49')]=function(_0x26f13d,_0x2d8d71,_0x4295){var _0x32afde={'raw':!![],'where':{}};var _0x4f98b1={};var _0x3780d4={'count':0x0,'rows':[]};return db[_0x3161('0x2c')][_0x3161('0x4a')]({'where':{'id':_0x26f13d[_0x3161('0x48')]['id']}})['then'](handleEntityNotFound(_0x2d8d71,null))[_0x3161('0x26')](function(_0x1cb1dc){if(_0x1cb1dc){_0x4f98b1['model']=_['keys'](db['JscriptyQuestionReport'][_0x3161('0x4b')]);_0x4f98b1[_0x3161('0x31')]=_[_0x3161('0x32')](_0x26f13d['query']);_0x4f98b1[_0x3161('0x33')]=_[_0x3161('0x34')](_0x4f98b1[_0x3161('0x30')],_0x4f98b1[_0x3161('0x31')]);_0x32afde[_0x3161('0x35')]=_['intersection'](_0x4f98b1['model'],qs[_0x3161('0x36')](_0x26f13d[_0x3161('0x31')][_0x3161('0x36')]));_0x32afde[_0x3161('0x35')]=_0x32afde[_0x3161('0x35')][_0x3161('0x37')]?_0x32afde['attributes']:_0x4f98b1['model'];if(!_0x26f13d['query']['hasOwnProperty'](_0x3161('0x39'))){_0x32afde['limit']=qs[_0x3161('0x1f')](_0x26f13d[_0x3161('0x31')][_0x3161('0x1f')]);_0x32afde[_0x3161('0x1d')]=qs[_0x3161('0x1d')](_0x26f13d[_0x3161('0x31')]['offset']);}_0x32afde[_0x3161('0x3a')]=qs['sort'](_0x26f13d[_0x3161('0x31')]['sort']);_0x32afde[_0x3161('0x3c')]=qs[_0x3161('0x33')](_[_0x3161('0x3d')](_0x26f13d['query'],_0x4f98b1[_0x3161('0x33')]));_0x32afde['where'][_0x3161('0x4c')]=_0x1cb1dc['id'];if(_0x26f13d[_0x3161('0x31')]['filter']){_0x32afde['where']=_[_0x3161('0x3e')](_0x32afde[_0x3161('0x3c')],{'$or':_['map'](_0x32afde[_0x3161('0x35')],function(_0x4adebd){var _0x4626ab={};_0x4626ab[_0x4adebd]={'$like':'%'+_0x26f13d[_0x3161('0x31')][_0x3161('0x40')]+'%'};return _0x4626ab;})});}_0x32afde=_[_0x3161('0x3e')]({},_0x32afde,_0x26f13d[_0x3161('0x41')]);return db[_0x3161('0x4d')][_0x3161('0x20')]({'where':_0x32afde[_0x3161('0x3c')]})[_0x3161('0x26')](function(_0xd28400){_0x3780d4[_0x3161('0x20')]=_0xd28400;if(_0x26f13d['query'][_0x3161('0x42')]){_0x32afde['include']=[{'all':!![]}];}return db[_0x3161('0x4d')][_0x3161('0x4e')](_0x32afde);})[_0x3161('0x26')](function(_0x3d8882){_0x3780d4[_0x3161('0x4f')]=_0x3d8882;return _0x3780d4;});}})[_0x3161('0x26')](respondWithFilteredResult(_0x2d8d71,_0x32afde))[_0x3161('0x44')](handleError(_0x2d8d71,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index ac2c976..f07757a 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 _0x3baf=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptySessionReport.attributes','exports','define'];(function(_0x543084,_0x4337f5){var _0x306a57=function(_0x2769ed){while(--_0x2769ed){_0x543084['push'](_0x543084['shift']());}};_0x306a57(++_0x4337f5);}(_0x3baf,0xf7));var _0xf3ba=function(_0x294747,_0x379ea7){_0x294747=_0x294747-0x0;var _0x1a4b30=_0x3baf[_0x294747];return _0x1a4b30;};'use strict';var _=require(_0xf3ba('0x0'));var util=require(_0xf3ba('0x1'));var logger=require(_0xf3ba('0x2'))(_0xf3ba('0x3'));var moment=require(_0xf3ba('0x4'));var BPromise=require(_0xf3ba('0x5'));var rp=require(_0xf3ba('0x6'));var fs=require('fs');var path=require(_0xf3ba('0x7'));var rimraf=require(_0xf3ba('0x8'));var config=require(_0xf3ba('0x9'));var attributes=require(_0xf3ba('0xa'));module[_0xf3ba('0xb')]=function(_0x475268,_0x2e6df2){return _0x475268[_0xf3ba('0xc')]('JscriptySessionReport',attributes,{'tableName':'report_jscripty_sessions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeff8=['rimraf','../../config/environment','./jscriptySessionReport.attributes','define','JscriptySessionReport','lodash','util','api','moment','bluebird','path'];(function(_0x32b207,_0x39f76c){var _0x94d027=function(_0x5b73d8){while(--_0x5b73d8){_0x32b207['push'](_0x32b207['shift']());}};_0x94d027(++_0x39f76c);}(_0xeff8,0x186));var _0x8eff=function(_0x5d7227,_0x12aebe){_0x5d7227=_0x5d7227-0x0;var _0x15ac55=_0xeff8[_0x5d7227];return _0x15ac55;};'use strict';var _=require(_0x8eff('0x0'));var util=require(_0x8eff('0x1'));var logger=require('../../config/logger')(_0x8eff('0x2'));var moment=require(_0x8eff('0x3'));var BPromise=require(_0x8eff('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8eff('0x5'));var rimraf=require(_0x8eff('0x6'));var config=require(_0x8eff('0x7'));var attributes=require(_0x8eff('0x8'));module['exports']=function(_0x469641,_0xb54063){return _0x469641[_0x8eff('0x9')](_0x8eff('0xa'),attributes,{'tableName':'report_jscripty_sessions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js index 41be456..bf1444f 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 _0xba34=['../../config/environment','jayson/promise','client','http','request','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc'];(function(_0x3b8787,_0x3f4bc5){var _0x48bd6f=function(_0x41d414){while(--_0x41d414){_0x3b8787['push'](_0x3b8787['shift']());}};_0x48bd6f(++_0x3f4bc5);}(_0xba34,0x119));var _0x4ba3=function(_0x1decce,_0x467bf5){_0x1decce=_0x1decce-0x0;var _0x14f2d5=_0xba34[_0x1decce];return _0x14f2d5;};'use strict';var _=require(_0x4ba3('0x0'));var util=require(_0x4ba3('0x1'));var moment=require(_0x4ba3('0x2'));var BPromise=require(_0x4ba3('0x3'));var rs=require(_0x4ba3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4ba3('0x5'))(_0x4ba3('0x6'));var config=require(_0x4ba3('0x7'));var jayson=require(_0x4ba3('0x8'));var client=jayson[_0x4ba3('0x9')][_0x4ba3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe5f99a,_0x585f2d,_0x6254fb){return new BPromise(function(_0x368eee,_0x2df7f3){return client[_0x4ba3('0xb')](_0xe5f99a,_0x6254fb)[_0x4ba3('0xc')](function(_0xcf1ec3){logger[_0x4ba3('0xd')](_0x4ba3('0xe'),_0x585f2d,_0x4ba3('0xf'));logger[_0x4ba3('0x10')](_0x4ba3('0x11'),_0x585f2d,'request\x20sent',JSON[_0x4ba3('0x12')](_0xcf1ec3));if(_0xcf1ec3[_0x4ba3('0x13')]){if(_0xcf1ec3['error'][_0x4ba3('0x14')]===0x1f4){logger['error'](_0x4ba3('0xe'),_0x585f2d,_0xcf1ec3['error'][_0x4ba3('0x15')]);return _0x2df7f3(_0xcf1ec3[_0x4ba3('0x13')][_0x4ba3('0x15')]);}logger[_0x4ba3('0x13')](_0x4ba3('0xe'),_0x585f2d,_0xcf1ec3[_0x4ba3('0x13')][_0x4ba3('0x15')]);return _0x368eee(_0xcf1ec3[_0x4ba3('0x13')][_0x4ba3('0x15')]);}else{logger[_0x4ba3('0xd')](_0x4ba3('0xe'),_0x585f2d,_0x4ba3('0xf'));_0x368eee(_0xcf1ec3[_0x4ba3('0x16')][_0x4ba3('0x15')]);}})[_0x4ba3('0x17')](function(_0x1b7776){logger['error'](_0x4ba3('0xe'),_0x585f2d,_0x1b7776);_0x2df7f3(_0x1b7776);});});} \ No newline at end of file +var _0x0120=['result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x700205,_0x2772c4){var _0x251fd4=function(_0x392325){while(--_0x392325){_0x700205['push'](_0x700205['shift']());}};_0x251fd4(++_0x2772c4);}(_0x0120,0x6f));var _0x0012=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x0120[_0x297fd3];return _0x2af381;};'use strict';var _=require(_0x0012('0x0'));var util=require(_0x0012('0x1'));var moment=require(_0x0012('0x2'));var BPromise=require(_0x0012('0x3'));var rs=require(_0x0012('0x4'));var fs=require('fs');var Redis=require(_0x0012('0x5'));var db=require(_0x0012('0x6'))['db'];var utils=require(_0x0012('0x7'));var logger=require(_0x0012('0x8'))(_0x0012('0x9'));var config=require(_0x0012('0xa'));var jayson=require(_0x0012('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x59980a,_0x95d441,_0x436af8){return new BPromise(function(_0x3d4c64,_0x30176d){return client[_0x0012('0xc')](_0x59980a,_0x436af8)['then'](function(_0x14991f){logger[_0x0012('0xd')](_0x0012('0xe'),_0x95d441,_0x0012('0xf'));logger['debug'](_0x0012('0x10'),_0x95d441,'request\x20sent',JSON[_0x0012('0x11')](_0x14991f));if(_0x14991f[_0x0012('0x12')]){if(_0x14991f[_0x0012('0x12')][_0x0012('0x13')]===0x1f4){logger[_0x0012('0x12')]('JscriptySessionReport,\x20%s,\x20%s',_0x95d441,_0x14991f[_0x0012('0x12')]['message']);return _0x30176d(_0x14991f['error']['message']);}logger['error'](_0x0012('0xe'),_0x95d441,_0x14991f['error'][_0x0012('0x14')]);return _0x3d4c64(_0x14991f[_0x0012('0x12')]['message']);}else{logger[_0x0012('0xd')](_0x0012('0xe'),_0x95d441,_0x0012('0xf'));_0x3d4c64(_0x14991f[_0x0012('0x15')]['message']);}})['catch'](function(_0x1e7fbe){logger[_0x0012('0x12')](_0x0012('0xe'),_0x95d441,_0x1e7fbe);_0x30176d(_0x1e7fbe);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 4ef6694..f7a3c0b 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 _0xd4b7=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','index','put','/:id','isAuthenticated','update','get','downloadLogFile','exports'];(function(_0xc5eb30,_0x356954){var _0x237a8a=function(_0x12c4d6){while(--_0x12c4d6){_0xc5eb30['push'](_0xc5eb30['shift']());}};_0x237a8a(++_0x356954);}(_0xd4b7,0x69));var _0x7d4b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd4b7[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x7d4b('0x0'));var util=require(_0x7d4b('0x1'));var path=require(_0x7d4b('0x2'));var timeout=require(_0x7d4b('0x3'));var express=require('express');var router=express[_0x7d4b('0x4')]();var fs_extra=require(_0x7d4b('0x5'));var auth=require(_0x7d4b('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./license.controller');router['get']('/',controller[_0x7d4b('0x7')]);router[_0x7d4b('0x8')](_0x7d4b('0x9'),auth[_0x7d4b('0xa')](),controller[_0x7d4b('0xb')]);router[_0x7d4b('0xc')]('/download_log_file',auth[_0x7d4b('0xa')](),controller[_0x7d4b('0xd')]);module[_0x7d4b('0xe')]=router; \ No newline at end of file +var _0x10a8=['exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./license.controller','get','index','put','/:id','isAuthenticated','update','downloadLogFile'];(function(_0x354b49,_0x1626fc){var _0x2e5754=function(_0x3acfc1){while(--_0x3acfc1){_0x354b49['push'](_0x354b49['shift']());}};_0x2e5754(++_0x1626fc);}(_0x10a8,0x1ee));var _0x810a=function(_0x1ff3e8,_0x427e2e){_0x1ff3e8=_0x1ff3e8-0x0;var _0x2ec3f0=_0x10a8[_0x1ff3e8];return _0x2ec3f0;};'use strict';var multer=require(_0x810a('0x0'));var util=require('util');var path=require(_0x810a('0x1'));var timeout=require(_0x810a('0x2'));var express=require(_0x810a('0x3'));var router=express[_0x810a('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x810a('0x5'));var interaction=require(_0x810a('0x6'));var config=require(_0x810a('0x7'));var controller=require(_0x810a('0x8'));router[_0x810a('0x9')]('/',controller[_0x810a('0xa')]);router[_0x810a('0xb')](_0x810a('0xc'),auth[_0x810a('0xd')](),controller[_0x810a('0xe')]);router[_0x810a('0x9')]('/download_log_file',auth[_0x810a('0xd')](),controller[_0x810a('0xf')]);module[_0x810a('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 d2438f6..a6da00d 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 _0xc4dc=['exports','STRING','INTEGER','sequelize'];(function(_0x225f43,_0x2ba06f){var _0x592761=function(_0xc2e1da){while(--_0xc2e1da){_0x225f43['push'](_0x225f43['shift']());}};_0x592761(++_0x2ba06f);}(_0xc4dc,0x123));var _0xcc4d=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xc4dc[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require(_0xcc4d('0x0'));module[_0xcc4d('0x1')]={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize[_0xcc4d('0x2')]},'data2':{'type':Sequelize[_0xcc4d('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0xcc4d('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x798a=['TEXT','STRING','INTEGER','sequelize','exports'];(function(_0x205867,_0x2ab803){var _0x1b0374=function(_0x3ee3ac){while(--_0x3ee3ac){_0x205867['push'](_0x205867['shift']());}};_0x1b0374(++_0x2ab803);}(_0x798a,0x8f));var _0xa798=function(_0x36884e,_0x48008f){_0x36884e=_0x36884e-0x0;var _0x1cc367=_0x798a[_0x36884e];return _0x1cc367;};'use strict';var Sequelize=require(_0xa798('0x0'));module[_0xa798('0x1')]={'license':{'type':Sequelize[_0xa798('0x2')]},'data1':{'type':Sequelize[_0xa798('0x3')]},'data2':{'type':Sequelize['STRING']},'chatLicenseExceeded':{'type':Sequelize[_0xa798('0x4')],'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 0a616d5..bdaae53 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 _0x95a7=['undefined','limit','count','set','Content-Range','apply','save','then','destroy','error','stack','name','index','model','keys','License','rawAttributes','query','filters','intersection','fields','attributes','length','merge','options','getLicense','catch','body','params','get','checkLicense','key','demo','downloadLogFile','license-info.log','join','/var','log','setHeader','Content-disposition','attachment;\x20filename=','Content-Type','text/plain','download','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset'];(function(_0xc87d08,_0x59c9be){var _0x30a714=function(_0x437c0d){while(--_0x437c0d){_0xc87d08['push'](_0xc87d08['shift']());}};_0x30a714(++_0x59c9be);}(_0x95a7,0x107));var _0x795a=function(_0x32ba07,_0x425202){_0x32ba07=_0x32ba07-0x0;var _0x243999=_0x95a7[_0x32ba07];return _0x243999;};'use strict';var emlformat=require(_0x795a('0x0'));var rimraf=require(_0x795a('0x1'));var zipdir=require(_0x795a('0x2'));var jsonpatch=require(_0x795a('0x3'));var rp=require('request-promise');var moment=require(_0x795a('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x795a('0x5'));var util=require(_0x795a('0x6'));var path=require(_0x795a('0x7'));var sox=require(_0x795a('0x8'));var csv=require(_0x795a('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x795a('0xa'));var _=require(_0x795a('0xb'));var squel=require('squel');var crypto=require(_0x795a('0xc'));var jsforce=require(_0x795a('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x795a('0xe'));var authService=require(_0x795a('0xf'));var qs=require(_0x795a('0x10'));var as=require(_0x795a('0x11'));var hardwareService=require(_0x795a('0x12'));var logger=require(_0x795a('0x13'))(_0x795a('0x14'));var utils=require(_0x795a('0x15'));var config=require(_0x795a('0x16'));var licenseUtil=require(_0x795a('0x17'));var db=require(_0x795a('0x18'))['db'];function respondWithStatusCode(_0x33fdaa,_0x1dc5f5){_0x1dc5f5=_0x1dc5f5||0xcc;return function(_0x5bea2f){if(_0x5bea2f){return _0x33fdaa[_0x795a('0x19')](_0x1dc5f5);}return _0x33fdaa[_0x795a('0x1a')](_0x1dc5f5)['end']();};}function respondWithResult(_0x1c52a2,_0xd8de05){_0xd8de05=_0xd8de05||0xc8;return function(_0x55b102){if(_0x55b102){return _0x1c52a2[_0x795a('0x1a')](_0xd8de05)[_0x795a('0x1b')](_0x55b102);}};}function respondWithFilteredResult(_0x5c38e1,_0x4bf3f5){return function(_0x171e4d){if(_0x171e4d){var _0x5e90a7=typeof _0x4bf3f5[_0x795a('0x1c')]===_0x795a('0x1d')&&typeof _0x4bf3f5[_0x795a('0x1e')]===_0x795a('0x1d');var _0x2d590f=_0x171e4d[_0x795a('0x1f')];var _0x2fa3c9=_0x5e90a7?0x0:_0x4bf3f5[_0x795a('0x1c')];var _0xeb270a=_0x5e90a7?_0x171e4d[_0x795a('0x1f')]:_0x4bf3f5[_0x795a('0x1c')]+_0x4bf3f5[_0x795a('0x1e')];var _0x2a6008;if(_0xeb270a>=_0x2d590f){_0xeb270a=_0x2d590f;_0x2a6008=0xc8;}else{_0x2a6008=0xce;}_0x5c38e1[_0x795a('0x1a')](_0x2a6008);return _0x5c38e1[_0x795a('0x20')](_0x795a('0x21'),_0x2fa3c9+'-'+_0xeb270a+'/'+_0x2d590f)[_0x795a('0x1b')](_0x171e4d);}return null;};}function patchUpdates(_0x3f7a98){return function(_0x170f7c){try{jsonpatch[_0x795a('0x22')](_0x170f7c,_0x3f7a98,!![]);}catch(_0x2cfdb1){return BPromise['reject'](_0x2cfdb1);}return _0x170f7c[_0x795a('0x23')]();};}function saveUpdates(_0x2d305e,_0x590a22){return function(_0x44bbdb){if(_0x44bbdb){return _0x44bbdb['update'](_0x2d305e)[_0x795a('0x24')](function(_0x14e21c){return _0x14e21c;});}return null;};}function removeEntity(_0x290dc2,_0x23329d){return function(_0x5a4e29){if(_0x5a4e29){return _0x5a4e29[_0x795a('0x25')]()[_0x795a('0x24')](function(){_0x290dc2[_0x795a('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x453a1f,_0x1bf100){return function(_0x36f226){if(!_0x36f226){_0x453a1f[_0x795a('0x19')](0x194);}return _0x36f226;};}function handleError(_0x5a1553,_0x196388){_0x196388=_0x196388||0x1f4;return function(_0x250071){logger[_0x795a('0x26')](_0x250071[_0x795a('0x27')]);if(_0x250071[_0x795a('0x28')]){delete _0x250071[_0x795a('0x28')];}_0x5a1553[_0x795a('0x1a')](_0x196388)['send'](_0x250071);};}var utilLicense=require(_0x795a('0x17'));exports[_0x795a('0x29')]=function(_0x1c1bda,_0x492316){var _0x22ea4b={'raw':!![],'where':{'id':0x1}},_0x3fb736={};_0x3fb736[_0x795a('0x2a')]=_[_0x795a('0x2b')](db[_0x795a('0x2c')][_0x795a('0x2d')]);_0x3fb736[_0x795a('0x2e')]=_[_0x795a('0x2b')](_0x1c1bda[_0x795a('0x2e')]);_0x3fb736[_0x795a('0x2f')]=_['intersection'](_0x3fb736[_0x795a('0x2a')],_0x3fb736[_0x795a('0x2e')]);_0x22ea4b['attributes']=_[_0x795a('0x30')](_0x3fb736[_0x795a('0x2a')],qs[_0x795a('0x31')](_0x1c1bda[_0x795a('0x2e')][_0x795a('0x31')]));_0x22ea4b['attributes']=_0x22ea4b[_0x795a('0x32')][_0x795a('0x33')]?_0x22ea4b[_0x795a('0x32')]:_0x3fb736[_0x795a('0x2a')];_0x22ea4b=_[_0x795a('0x34')]({},_0x22ea4b,_0x1c1bda[_0x795a('0x35')]);return utilLicense[_0x795a('0x36')](_0x22ea4b)[_0x795a('0x24')](respondWithResult(_0x492316,null))[_0x795a('0x37')](handleError(_0x492316,null));};exports['update']=function(_0x2996e1,_0x51e7b3){if(_0x2996e1['body']['id']){delete _0x2996e1[_0x795a('0x38')]['id'];}return db[_0x795a('0x2c')]['find']({'where':{'id':_0x2996e1[_0x795a('0x39')]['id']}})[_0x795a('0x24')](handleEntityNotFound(_0x51e7b3,null))[_0x795a('0x24')](function(_0x14a8a0){var _0x5f4906=_0x14a8a0[_0x795a('0x3a')]({'plain':!![]});return utilLicense[_0x795a('0x3b')](_0x5f4906,_0x2996e1[_0x795a('0x38')][_0x795a('0x3c')]);})[_0x795a('0x24')](function(_0x52dc90){if(!_0x52dc90[_0x795a('0x3d')]){return saveUpdates(_0x2996e1[_0x795a('0x38')],null);}return _0x52dc90;})[_0x795a('0x24')](respondWithResult(_0x51e7b3,null))[_0x795a('0x37')](handleError(_0x51e7b3,null));};exports[_0x795a('0x3e')]=function(_0x35ea2f,_0x3a4bfc){var _0x2bcd1e=_0x795a('0x3f');var _0x56f7f9=path[_0x795a('0x40')](_0x795a('0x41'),_0x795a('0x42'),'xcally',_0x2bcd1e);_0x3a4bfc[_0x795a('0x43')](_0x795a('0x44'),_0x795a('0x45')+_0x2bcd1e);_0x3a4bfc['set'](_0x795a('0x46'),_0x795a('0x47'));_0x3a4bfc[_0x795a('0x48')](_0x56f7f9);}; \ No newline at end of file +var _0xbdc0=['crypto','desk.js','to-csv','querystring','papaparse','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','json','apply','reject','save','then','destroy','end','error','name','send','index','model','keys','License','rawAttributes','query','filters','intersection','attributes','fields','options','catch','update','body','find','get','demo','downloadLogFile','join','/var','log','xcally','setHeader','Content-disposition','attachment;\x20filename=','Content-Type','text/plain','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','ejs','fs-extra','lodash','squel'];(function(_0x1582ba,_0x1a027f){var _0x714be6=function(_0x380434){while(--_0x380434){_0x1582ba['push'](_0x1582ba['shift']());}};_0x714be6(++_0x1a027f);}(_0xbdc0,0x1c2));var _0x0bdc=function(_0x321135,_0x456a6b){_0x321135=_0x321135-0x0;var _0x3e9c0c=_0xbdc0[_0x321135];return _0x3e9c0c;};'use strict';var emlformat=require(_0x0bdc('0x0'));var rimraf=require(_0x0bdc('0x1'));var zipdir=require(_0x0bdc('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0bdc('0x3'));var moment=require(_0x0bdc('0x4'));var BPromise=require(_0x0bdc('0x5'));var Mustache=require(_0x0bdc('0x6'));var util=require(_0x0bdc('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0bdc('0x8'));var fs=require('fs');var fs_extra=require(_0x0bdc('0x9'));var _=require(_0x0bdc('0xa'));var squel=require(_0x0bdc('0xb'));var crypto=require(_0x0bdc('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x0bdc('0xd'));var toCsv=require(_0x0bdc('0xe'));var querystring=require(_0x0bdc('0xf'));var Papa=require(_0x0bdc('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0bdc('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0bdc('0x12'))(_0x0bdc('0x13'));var utils=require(_0x0bdc('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0bdc('0x15'))['db'];function respondWithStatusCode(_0x24b5b0,_0x5674d8){_0x5674d8=_0x5674d8||0xcc;return function(_0x14d15c){if(_0x14d15c){return _0x24b5b0[_0x0bdc('0x16')](_0x5674d8);}return _0x24b5b0[_0x0bdc('0x17')](_0x5674d8)['end']();};}function respondWithResult(_0x954f60,_0x2773b0){_0x2773b0=_0x2773b0||0xc8;return function(_0x2f2224){if(_0x2f2224){return _0x954f60[_0x0bdc('0x17')](_0x2773b0)['json'](_0x2f2224);}};}function respondWithFilteredResult(_0x394cfb,_0x18a2cd){return function(_0x210b2f){if(_0x210b2f){var _0xa862eb=typeof _0x18a2cd[_0x0bdc('0x18')]===_0x0bdc('0x19')&&typeof _0x18a2cd[_0x0bdc('0x1a')]==='undefined';var _0x55a1db=_0x210b2f[_0x0bdc('0x1b')];var _0xffa9e4=_0xa862eb?0x0:_0x18a2cd[_0x0bdc('0x18')];var _0x4dd329=_0xa862eb?_0x210b2f[_0x0bdc('0x1b')]:_0x18a2cd[_0x0bdc('0x18')]+_0x18a2cd['limit'];var _0x3967cf;if(_0x4dd329>=_0x55a1db){_0x4dd329=_0x55a1db;_0x3967cf=0xc8;}else{_0x3967cf=0xce;}_0x394cfb['status'](_0x3967cf);return _0x394cfb[_0x0bdc('0x1c')]('Content-Range',_0xffa9e4+'-'+_0x4dd329+'/'+_0x55a1db)[_0x0bdc('0x1d')](_0x210b2f);}return null;};}function patchUpdates(_0x1bf9d5){return function(_0x4fd584){try{jsonpatch[_0x0bdc('0x1e')](_0x4fd584,_0x1bf9d5,!![]);}catch(_0xef836d){return BPromise[_0x0bdc('0x1f')](_0xef836d);}return _0x4fd584[_0x0bdc('0x20')]();};}function saveUpdates(_0x16e728,_0x1897a2){return function(_0xbf644a){if(_0xbf644a){return _0xbf644a['update'](_0x16e728)[_0x0bdc('0x21')](function(_0x22248e){return _0x22248e;});}return null;};}function removeEntity(_0x5876ac,_0x12fe30){return function(_0x147389){if(_0x147389){return _0x147389[_0x0bdc('0x22')]()[_0x0bdc('0x21')](function(){_0x5876ac[_0x0bdc('0x17')](0xcc)[_0x0bdc('0x23')]();});}};}function handleEntityNotFound(_0x16944a,_0xbb3e3f){return function(_0x256d39){if(!_0x256d39){_0x16944a[_0x0bdc('0x16')](0x194);}return _0x256d39;};}function handleError(_0x3a3f5e,_0xeb0b0d){_0xeb0b0d=_0xeb0b0d||0x1f4;return function(_0x1854b0){logger[_0x0bdc('0x24')](_0x1854b0['stack']);if(_0x1854b0['name']){delete _0x1854b0[_0x0bdc('0x25')];}_0x3a3f5e[_0x0bdc('0x17')](_0xeb0b0d)[_0x0bdc('0x26')](_0x1854b0);};}var utilLicense=require('../../config/license/util');exports[_0x0bdc('0x27')]=function(_0x3548eb,_0x426808){var _0x4ae2ec={'raw':!![],'where':{'id':0x1}},_0x207331={};_0x207331[_0x0bdc('0x28')]=_[_0x0bdc('0x29')](db[_0x0bdc('0x2a')][_0x0bdc('0x2b')]);_0x207331['query']=_[_0x0bdc('0x29')](_0x3548eb[_0x0bdc('0x2c')]);_0x207331[_0x0bdc('0x2d')]=_[_0x0bdc('0x2e')](_0x207331[_0x0bdc('0x28')],_0x207331[_0x0bdc('0x2c')]);_0x4ae2ec[_0x0bdc('0x2f')]=_[_0x0bdc('0x2e')](_0x207331[_0x0bdc('0x28')],qs[_0x0bdc('0x30')](_0x3548eb[_0x0bdc('0x2c')][_0x0bdc('0x30')]));_0x4ae2ec[_0x0bdc('0x2f')]=_0x4ae2ec[_0x0bdc('0x2f')]['length']?_0x4ae2ec[_0x0bdc('0x2f')]:_0x207331[_0x0bdc('0x28')];_0x4ae2ec=_['merge']({},_0x4ae2ec,_0x3548eb[_0x0bdc('0x31')]);return utilLicense['getLicense'](_0x4ae2ec)[_0x0bdc('0x21')](respondWithResult(_0x426808,null))[_0x0bdc('0x32')](handleError(_0x426808,null));};exports[_0x0bdc('0x33')]=function(_0x4c8a60,_0x3303d8){if(_0x4c8a60[_0x0bdc('0x34')]['id']){delete _0x4c8a60[_0x0bdc('0x34')]['id'];}return db[_0x0bdc('0x2a')][_0x0bdc('0x35')]({'where':{'id':_0x4c8a60['params']['id']}})[_0x0bdc('0x21')](handleEntityNotFound(_0x3303d8,null))[_0x0bdc('0x21')](function(_0x4edd27){var _0x56bf90=_0x4edd27[_0x0bdc('0x36')]({'plain':!![]});return utilLicense['checkLicense'](_0x56bf90,_0x4c8a60['body']['key']);})[_0x0bdc('0x21')](function(_0x3ab2ef){if(!_0x3ab2ef[_0x0bdc('0x37')]){return saveUpdates(_0x4c8a60[_0x0bdc('0x34')],null);}return _0x3ab2ef;})['then'](respondWithResult(_0x3303d8,null))['catch'](handleError(_0x3303d8,null));};exports[_0x0bdc('0x38')]=function(_0x3c15ec,_0x4980a8){var _0x5939f2='license-info.log';var _0x52cbd1=path[_0x0bdc('0x39')](_0x0bdc('0x3a'),_0x0bdc('0x3b'),_0x0bdc('0x3c'),_0x5939f2);_0x4980a8[_0x0bdc('0x3d')](_0x0bdc('0x3e'),_0x0bdc('0x3f')+_0x5939f2);_0x4980a8[_0x0bdc('0x1c')](_0x0bdc('0x40'),_0x0bdc('0x41'));_0x4980a8['download'](_0x52cbd1);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 7ea5d85..099366a 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 _0x1e04=['./license.attributes','define','License','license','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x45f5aa,_0x4d6ebc){var _0x18aa93=function(_0x1a282e){while(--_0x1a282e){_0x45f5aa['push'](_0x45f5aa['shift']());}};_0x18aa93(++_0x4d6ebc);}(_0x1e04,0xb4));var _0x41e0=function(_0xa4eaad,_0x5d99ee){_0xa4eaad=_0xa4eaad-0x0;var _0xf11a17=_0x1e04[_0xa4eaad];return _0xf11a17;};'use strict';var _=require('lodash');var util=require(_0x41e0('0x0'));var logger=require(_0x41e0('0x1'))(_0x41e0('0x2'));var moment=require(_0x41e0('0x3'));var BPromise=require(_0x41e0('0x4'));var rp=require(_0x41e0('0x5'));var fs=require('fs');var path=require(_0x41e0('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x41e0('0x7'));module['exports']=function(_0x38c77f,_0x574046){return _0x38c77f[_0x41e0('0x8')](_0x41e0('0x9'),attributes,{'tableName':_0x41e0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5828=['./license.attributes','License','license','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment'];(function(_0x418d65,_0x69d05c){var _0x3bb5e4=function(_0x43b92b){while(--_0x43b92b){_0x418d65['push'](_0x418d65['shift']());}};_0x3bb5e4(++_0x69d05c);}(_0x5828,0xea));var _0x8582=function(_0x57e35f,_0x2d3adc){_0x57e35f=_0x57e35f-0x0;var _0x17ea9f=_0x5828[_0x57e35f];return _0x17ea9f;};'use strict';var _=require(_0x8582('0x0'));var util=require(_0x8582('0x1'));var logger=require(_0x8582('0x2'))(_0x8582('0x3'));var moment=require(_0x8582('0x4'));var BPromise=require(_0x8582('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8582('0x6'));var rimraf=require('rimraf');var config=require(_0x8582('0x7'));var attributes=require(_0x8582('0x8'));module['exports']=function(_0x5c4e74,_0x5da159){return _0x5c4e74['define'](_0x8582('0x9'),attributes,{'tableName':_0x8582('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/license/license.rpc.js b/server/api/license/license.rpc.js index 23007f4..a034bf0 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 _0x94aa=['../../config/environment','jayson/promise','client','http','info','request\x20sent','License,\x20%s,\x20%s,\x20%s','stringify','error','code','License,\x20%s,\x20%s','message','result','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x5948dd,_0x1f6ac8){var _0xb1f8be=function(_0x31a8d2){while(--_0x31a8d2){_0x5948dd['push'](_0x5948dd['shift']());}};_0xb1f8be(++_0x1f6ac8);}(_0x94aa,0x172));var _0xa94a=function(_0x208ba1,_0x1384db){_0x208ba1=_0x208ba1-0x0;var _0x4bc5fc=_0x94aa[_0x208ba1];return _0x4bc5fc;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xa94a('0x0'));var BPromise=require(_0xa94a('0x1'));var rs=require(_0xa94a('0x2'));var fs=require('fs');var Redis=require(_0xa94a('0x3'));var db=require(_0xa94a('0x4'))['db'];var utils=require(_0xa94a('0x5'));var logger=require(_0xa94a('0x6'))(_0xa94a('0x7'));var config=require(_0xa94a('0x8'));var jayson=require(_0xa94a('0x9'));var client=jayson[_0xa94a('0xa')][_0xa94a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5320c7,_0x8234ba,_0x1f5017){return new BPromise(function(_0x2b88e8,_0x2f511d){return client['request'](_0x5320c7,_0x1f5017)['then'](function(_0x5b99e7){logger[_0xa94a('0xc')]('License,\x20%s,\x20%s',_0x8234ba,_0xa94a('0xd'));logger['debug'](_0xa94a('0xe'),_0x8234ba,'request\x20sent',JSON[_0xa94a('0xf')](_0x5b99e7));if(_0x5b99e7[_0xa94a('0x10')]){if(_0x5b99e7['error'][_0xa94a('0x11')]===0x1f4){logger[_0xa94a('0x10')](_0xa94a('0x12'),_0x8234ba,_0x5b99e7[_0xa94a('0x10')]['message']);return _0x2f511d(_0x5b99e7[_0xa94a('0x10')][_0xa94a('0x13')]);}logger[_0xa94a('0x10')](_0xa94a('0x12'),_0x8234ba,_0x5b99e7['error']['message']);return _0x2b88e8(_0x5b99e7[_0xa94a('0x10')]['message']);}else{logger[_0xa94a('0xc')](_0xa94a('0x12'),_0x8234ba,_0xa94a('0xd'));_0x2b88e8(_0x5b99e7[_0xa94a('0x14')][_0xa94a('0x13')]);}})['catch'](function(_0x38d221){logger[_0xa94a('0x10')](_0xa94a('0x12'),_0x8234ba,_0x38d221);_0x2f511d(_0x38d221);});});} \ No newline at end of file +var _0xab8b=['then','info','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','code','License,\x20%s,\x20%s','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x3430aa,_0x57cd92){var _0x2ac5c=function(_0x3068dd){while(--_0x3068dd){_0x3430aa['push'](_0x3430aa['shift']());}};_0x2ac5c(++_0x57cd92);}(_0xab8b,0xe7));var _0xbab8=function(_0x4a38f4,_0x788125){_0x4a38f4=_0x4a38f4-0x0;var _0x5753f0=_0xab8b[_0x4a38f4];return _0x5753f0;};'use strict';var _=require('lodash');var util=require(_0xbab8('0x0'));var moment=require(_0xbab8('0x1'));var BPromise=require(_0xbab8('0x2'));var rs=require(_0xbab8('0x3'));var fs=require('fs');var Redis=require(_0xbab8('0x4'));var db=require(_0xbab8('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xbab8('0x6'))(_0xbab8('0x7'));var config=require('../../config/environment');var jayson=require(_0xbab8('0x8'));var client=jayson[_0xbab8('0x9')][_0xbab8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5abfd9,_0x357993,_0x10b09a){return new BPromise(function(_0x336c17,_0x4902f9){return client['request'](_0x5abfd9,_0x10b09a)[_0xbab8('0xb')](function(_0x9430b2){logger[_0xbab8('0xc')]('License,\x20%s,\x20%s',_0x357993,_0xbab8('0xd'));logger[_0xbab8('0xe')](_0xbab8('0xf'),_0x357993,'request\x20sent',JSON[_0xbab8('0x10')](_0x9430b2));if(_0x9430b2['error']){if(_0x9430b2[_0xbab8('0x11')][_0xbab8('0x12')]===0x1f4){logger[_0xbab8('0x11')](_0xbab8('0x13'),_0x357993,_0x9430b2[_0xbab8('0x11')][_0xbab8('0x14')]);return _0x4902f9(_0x9430b2['error'][_0xbab8('0x14')]);}logger['error']('License,\x20%s,\x20%s',_0x357993,_0x9430b2['error'][_0xbab8('0x14')]);return _0x336c17(_0x9430b2[_0xbab8('0x11')][_0xbab8('0x14')]);}else{logger[_0xbab8('0xc')](_0xbab8('0x13'),_0x357993,_0xbab8('0xd'));_0x336c17(_0x9430b2['result']['message']);}})[_0xbab8('0x15')](function(_0x50f6c3){logger['error']('License,\x20%s,\x20%s',_0x357993,_0x50f6c3);_0x4902f9(_0x50f6c3);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 6e0a16d..73c588d 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 _0x6899=['removeAnswers','removeImap','removeSmtp','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./mailAccount.controller','get','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/interactions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/verify','verifySmtp','/:id/users','getAgents','post','addDisposition','addAnswer','addInteraction','addApplications','/:id/send','send','update','removeDispositions','delete'];(function(_0x89a5f2,_0x1c0cfb){var _0x526482=function(_0x607e9d){while(--_0x607e9d){_0x89a5f2['push'](_0x89a5f2['shift']());}};_0x526482(++_0x1c0cfb);}(_0x6899,0xeb));var _0x9689=function(_0x2dd93f,_0x34b248){_0x2dd93f=_0x2dd93f-0x0;var _0x1bf1b8=_0x6899[_0x2dd93f];return _0x1bf1b8;};'use strict';var multer=require(_0x9689('0x0'));var util=require(_0x9689('0x1'));var path=require(_0x9689('0x2'));var timeout=require(_0x9689('0x3'));var express=require(_0x9689('0x4'));var router=express[_0x9689('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x9689('0x6'));var interaction=require(_0x9689('0x7'));var config=require('../../config/environment');var controller=require(_0x9689('0x8'));router[_0x9689('0x9')]('/',auth[_0x9689('0xa')](),controller['index']);router[_0x9689('0x9')]('/describe',auth[_0x9689('0xa')](),controller[_0x9689('0xb')]);router[_0x9689('0x9')](_0x9689('0xc'),auth['isAuthenticated'](),controller[_0x9689('0xd')]);router[_0x9689('0x9')](_0x9689('0xe'),auth['isAuthenticated'](),controller[_0x9689('0xf')]);router['get'](_0x9689('0x10'),auth[_0x9689('0xa')](),controller[_0x9689('0x11')]);router[_0x9689('0x9')](_0x9689('0x12'),auth['isAuthenticated'](),controller[_0x9689('0x13')]);router[_0x9689('0x9')](_0x9689('0x14'),auth[_0x9689('0xa')](),controller[_0x9689('0x15')]);router[_0x9689('0x9')](_0x9689('0x16'),auth[_0x9689('0xa')](),controller['getInteractions']);router[_0x9689('0x9')](_0x9689('0x17'),auth[_0x9689('0xa')](),controller[_0x9689('0x18')]);router[_0x9689('0x9')](_0x9689('0x19'),auth[_0x9689('0xa')](),controller[_0x9689('0x1a')]);router['get'](_0x9689('0x1b'),auth[_0x9689('0xa')](),controller[_0x9689('0x1c')]);router[_0x9689('0x9')](_0x9689('0x1d'),auth['isAuthenticated'](),controller[_0x9689('0x1e')]);router[_0x9689('0x1f')](_0x9689('0xe'),auth[_0x9689('0xa')](),controller[_0x9689('0x20')]);router[_0x9689('0x1f')]('/:id/canned_answers',auth[_0x9689('0xa')](),controller[_0x9689('0x21')]);router[_0x9689('0x1f')]('/',auth['isAuthenticated'](),controller['create']);router[_0x9689('0x1f')](_0x9689('0x12'),auth['isAuthenticated'](),controller['addImap']);router[_0x9689('0x1f')]('/:id/out_servers',auth[_0x9689('0xa')](),controller['addSmtp']);router[_0x9689('0x1f')](_0x9689('0x16'),auth[_0x9689('0xa')](),controller[_0x9689('0x22')]);router['post'](_0x9689('0x17'),auth[_0x9689('0xa')](),controller[_0x9689('0x23')]);router[_0x9689('0x1f')](_0x9689('0x24'),auth[_0x9689('0xa')](),controller[_0x9689('0x25')]);router[_0x9689('0x1f')](_0x9689('0x1d'),auth[_0x9689('0xa')](),controller['addAgents']);router['put'](_0x9689('0xc'),auth['isAuthenticated'](),controller[_0x9689('0x26')]);router['delete'](_0x9689('0xe'),auth[_0x9689('0xa')](),controller[_0x9689('0x27')]);router[_0x9689('0x28')](_0x9689('0x10'),auth[_0x9689('0xa')](),controller[_0x9689('0x29')]);router['delete'](_0x9689('0x12'),auth[_0x9689('0xa')](),controller[_0x9689('0x2a')]);router['delete'](_0x9689('0x14'),auth['isAuthenticated'](),controller[_0x9689('0x2b')]);router[_0x9689('0x28')](_0x9689('0xc'),auth[_0x9689('0xa')](),controller['destroy']);router[_0x9689('0x28')](_0x9689('0x1d'),auth[_0x9689('0xa')](),controller[_0x9689('0x2c')]);module[_0x9689('0x2d')]=router; \ No newline at end of file +var _0xd2a8=['removeSmtp','/:id/users','removeAgents','exports','multer','util','path','connect-timeout','Router','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/interactions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/verify','verifySmtp','getAgents','post','addDisposition','addAnswer','create','addImap','addSmtp','addApplications','send','/:id','update','delete','removeDispositions','removeAnswers','removeImap'];(function(_0x56b479,_0x1a0112){var _0x128a46=function(_0x2561a5){while(--_0x2561a5){_0x56b479['push'](_0x56b479['shift']());}};_0x128a46(++_0x1a0112);}(_0xd2a8,0x1bc));var _0x8d2a=function(_0x2b4b5a,_0x3e1c81){_0x2b4b5a=_0x2b4b5a-0x0;var _0x18b32c=_0xd2a8[_0x2b4b5a];return _0x18b32c;};'use strict';var multer=require(_0x8d2a('0x0'));var util=require(_0x8d2a('0x1'));var path=require(_0x8d2a('0x2'));var timeout=require(_0x8d2a('0x3'));var express=require('express');var router=express[_0x8d2a('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8d2a('0x5'));var controller=require('./mailAccount.controller');router[_0x8d2a('0x6')]('/',auth[_0x8d2a('0x7')](),controller[_0x8d2a('0x8')]);router[_0x8d2a('0x6')](_0x8d2a('0x9'),auth['isAuthenticated'](),controller[_0x8d2a('0xa')]);router[_0x8d2a('0x6')]('/:id',auth[_0x8d2a('0x7')](),controller['show']);router[_0x8d2a('0x6')](_0x8d2a('0xb'),auth[_0x8d2a('0x7')](),controller[_0x8d2a('0xc')]);router[_0x8d2a('0x6')](_0x8d2a('0xd'),auth[_0x8d2a('0x7')](),controller['getAnswers']);router['get'](_0x8d2a('0xe'),auth[_0x8d2a('0x7')](),controller[_0x8d2a('0xf')]);router['get'](_0x8d2a('0x10'),auth['isAuthenticated'](),controller[_0x8d2a('0x11')]);router[_0x8d2a('0x6')](_0x8d2a('0x12'),auth[_0x8d2a('0x7')](),controller['getInteractions']);router[_0x8d2a('0x6')](_0x8d2a('0x13'),auth[_0x8d2a('0x7')](),controller[_0x8d2a('0x14')]);router[_0x8d2a('0x6')](_0x8d2a('0x15'),auth['isAuthenticated'](),controller[_0x8d2a('0x16')]);router[_0x8d2a('0x6')](_0x8d2a('0x17'),auth[_0x8d2a('0x7')](),controller[_0x8d2a('0x18')]);router['get']('/:id/users',auth[_0x8d2a('0x7')](),controller[_0x8d2a('0x19')]);router[_0x8d2a('0x1a')](_0x8d2a('0xb'),auth[_0x8d2a('0x7')](),controller[_0x8d2a('0x1b')]);router[_0x8d2a('0x1a')]('/:id/canned_answers',auth[_0x8d2a('0x7')](),controller[_0x8d2a('0x1c')]);router[_0x8d2a('0x1a')]('/',auth[_0x8d2a('0x7')](),controller[_0x8d2a('0x1d')]);router[_0x8d2a('0x1a')](_0x8d2a('0xe'),auth[_0x8d2a('0x7')](),controller[_0x8d2a('0x1e')]);router['post']('/:id/out_servers',auth['isAuthenticated'](),controller[_0x8d2a('0x1f')]);router[_0x8d2a('0x1a')](_0x8d2a('0x12'),auth[_0x8d2a('0x7')](),controller['addInteraction']);router[_0x8d2a('0x1a')]('/:id/applications',auth['isAuthenticated'](),controller[_0x8d2a('0x20')]);router[_0x8d2a('0x1a')]('/:id/send',auth[_0x8d2a('0x7')](),controller[_0x8d2a('0x21')]);router[_0x8d2a('0x1a')]('/:id/users',auth[_0x8d2a('0x7')](),controller['addAgents']);router['put'](_0x8d2a('0x22'),auth['isAuthenticated'](),controller[_0x8d2a('0x23')]);router[_0x8d2a('0x24')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x8d2a('0x25')]);router[_0x8d2a('0x24')](_0x8d2a('0xd'),auth[_0x8d2a('0x7')](),controller[_0x8d2a('0x26')]);router[_0x8d2a('0x24')](_0x8d2a('0xe'),auth['isAuthenticated'](),controller[_0x8d2a('0x27')]);router[_0x8d2a('0x24')](_0x8d2a('0x10'),auth[_0x8d2a('0x7')](),controller[_0x8d2a('0x28')]);router[_0x8d2a('0x24')]('/:id',auth[_0x8d2a('0x7')](),controller['destroy']);router[_0x8d2a('0x24')](_0x8d2a('0x29'),auth['isAuthenticated'](),controller[_0x8d2a('0x2a')]);module[_0x8d2a('0x2b')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 70aa460..beaae7b 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 _0x0d42=['outlook365','getDataValue','provider','custom','sequelize','exports','STRING','BOOLEAN','TEXT','INTEGER','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','ENUM','gmail','hotmail','yahoo'];(function(_0xa79977,_0x4f7f12){var _0x109f10=function(_0x56780f){while(--_0x56780f){_0xa79977['push'](_0xa79977['shift']());}};_0x109f10(++_0x4f7f12);}(_0x0d42,0x1a8));var _0x20d4=function(_0x598f1f,_0xa7d1c){_0x598f1f=_0x598f1f-0x0;var _0x26d77d=_0x0d42[_0x598f1f];return _0x26d77d;};'use strict';var Sequelize=require(_0x20d4('0x0'));module[_0x20d4('0x1')]={'description':{'type':Sequelize[_0x20d4('0x2')]},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize[_0x20d4('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x20d4('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x20d4('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0x20d4('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0x20d4('0x4')]},'markAsUnread':{'type':Sequelize[_0x20d4('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x20d4('0x2')],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize[_0x20d4('0x5')](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x20d4('0x4')],'defaultValue':function(){return _0x20d4('0x6');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x20d4('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x20d4('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x20d4('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x20d4('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x20d4('0x5')],'allowNull':!![],'defaultValue':null,'comment':_0x20d4('0x7')},'mandatoryDisposition':{'type':Sequelize[_0x20d4('0x3')],'defaultValue':![],'comment':_0x20d4('0x8'),'set':function(_0x21382d){if(!_0x21382d)this[_0x20d4('0x9')](_0x20d4('0xa'),null);this['setDataValue'](_0x20d4('0xb'),_0x21382d);}},'provider':{'type':Sequelize[_0x20d4('0xc')](_0x20d4('0xd'),_0x20d4('0xe'),_0x20d4('0xf'),_0x20d4('0x10')),'defaultValue':null,'get':function(){if(!this[_0x20d4('0x11')](_0x20d4('0x12')))return _0x20d4('0x13');return this['getDataValue'](_0x20d4('0x12'));},'set':function(_0x39bf52){if(_0x39bf52==='custom')_0x39bf52=null;return this[_0x20d4('0x9')](_0x20d4('0x12'),_0x39bf52);}}}; \ No newline at end of file +var _0x2a10=['yahoo','outlook365','provider','getDataValue','custom','sequelize','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','ENUM','gmail','hotmail'];(function(_0x2064e5,_0x4f6fa2){var _0x21a233=function(_0x1b2491){while(--_0x1b2491){_0x2064e5['push'](_0x2064e5['shift']());}};_0x21a233(++_0x4f6fa2);}(_0x2a10,0x101));var _0x02a1=function(_0x6ad2c7,_0xb22a9a){_0x6ad2c7=_0x6ad2c7-0x0;var _0x435d5f=_0x2a10[_0x6ad2c7];return _0x435d5f;};'use strict';var Sequelize=require(_0x02a1('0x0'));module[_0x02a1('0x1')]={'description':{'type':Sequelize[_0x02a1('0x2')]},'name':{'type':Sequelize[_0x02a1('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0x02a1('0x3')],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x02a1('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0x02a1('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0x02a1('0x4')]},'markAsUnread':{'type':Sequelize[_0x02a1('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x02a1('0x5')},'fontSize':{'type':Sequelize[_0x02a1('0x6')](0x2)[_0x02a1('0x7')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x02a1('0x4')],'defaultValue':function(){return _0x02a1('0x8');}},'notificationSound':{'type':Sequelize[_0x02a1('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x02a1('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x02a1('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x02a1('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x02a1('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x02a1('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x02a1('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x02a1('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0x02a1('0x9')},'mandatoryDisposition':{'type':Sequelize[_0x02a1('0x3')],'defaultValue':![],'comment':_0x02a1('0xa'),'set':function(_0x533e4e){if(!_0x533e4e)this[_0x02a1('0xb')]('mandatoryDispositionPauseId',null);this[_0x02a1('0xb')](_0x02a1('0xc'),_0x533e4e);}},'provider':{'type':Sequelize[_0x02a1('0xd')](_0x02a1('0xe'),_0x02a1('0xf'),_0x02a1('0x10'),_0x02a1('0x11')),'defaultValue':null,'get':function(){if(!this['getDataValue'](_0x02a1('0x12')))return'custom';return this[_0x02a1('0x13')](_0x02a1('0x12'));},'set':function(_0x3d9f86){if(_0x3d9f86===_0x02a1('0x14'))_0x3d9f86=null;return this[_0x02a1('0xb')]('provider',_0x3d9f86);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 24121cd..7b7c7be 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 _0x5ae2=['email','ListId','isNil','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','omit','CmContact','Contact','User','Owner','fullname','Tag','Tags','color','tag','addApplications','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','finally','getApplications','getMessages','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','List','Contacts','updatedAt','CloudProvider','Smtp\x20configuration\x20not\x20found','from','%s\x20<%s>','attachments','join','root','getSmtpOptions','SendMail','sendMail','List\x20not\x20found','defaults','messageId','subject','attach','out','Messages','verifySmtp','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','moment','util','juice','ioredis','../../config/logger','../../config/environment','../../mysqldb','redis','socket.io-emitter','./mailAccount.socket','http','request','then','info','request\x20sent','debug','error','message','MailAccount,\x20%s,\x20%s','result','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','update','get','MailAccounts','UserProfileResource','destroy','stack','name','send','index','MailServerOut','Smtp','Pause','map','MailAccount','fieldName','type','query','keys','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','options','includeAll','include','findAll','show','params','MailServerIn','Imap','mandatoryDispositionPause','rawAttributes','find','body','modernAuthentication','secure','describe','addDisposition','MailAccountId','Disposition','create','getDispositions','findOne','filter','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','imap-mail.outlook.com','smtp.gmail.com','hotmail','smtp-mail.outlook.com','outlook365','Unknown\x20email\x20service\x20provider','user','username','password','pass','CloudProviderId','port','host','service','authentication','key','provider','custom'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x5ae2,0x104));var _0x25ae=function(_0x2ac756,_0x33408b){_0x2ac756=_0x2ac756-0x0;var _0xa621fb=_0x5ae2[_0x2ac756];return _0xa621fb;};'use strict';var moment=require(_0x25ae('0x0'));var BPromise=require('bluebird');var util=require(_0x25ae('0x1'));var path=require('path');var _=require('lodash');var juice=require(_0x25ae('0x2'));var Redis=require(_0x25ae('0x3'));var qs=require('../../components/parsers/qs');var logger=require(_0x25ae('0x4'))('api');var config=require(_0x25ae('0x5'));var db=require(_0x25ae('0x6'))['db'];config[_0x25ae('0x7')]=_['defaults'](config[_0x25ae('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0x25ae('0x8'))(new Redis(config[_0x25ae('0x7')]));require(_0x25ae('0x9'))['register'](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x25ae('0xa')]({'port':0x232b});function respondWithRpcPromise(_0x90f771,_0x1db94e,_0x1904ed,_0x29a974){return new BPromise(function(_0x3e64f8,_0x4314ac){var _0x51bb06=_0x29a974||client;return _0x51bb06[_0x25ae('0xb')](_0x90f771,_0x1904ed)[_0x25ae('0xc')](function(_0xc778d6){logger[_0x25ae('0xd')]('MailAccount,\x20%s,\x20%s',_0x1db94e,_0x25ae('0xe'));logger[_0x25ae('0xf')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x1db94e,_0x25ae('0xe'),JSON['stringify'](_0xc778d6));if(_0xc778d6[_0x25ae('0x10')]){if(_0xc778d6[_0x25ae('0x10')]['code']===0x1f4){logger['error']('MailAccount,\x20%s,\x20%s',_0x1db94e,_0xc778d6[_0x25ae('0x10')][_0x25ae('0x11')]);return _0x4314ac(_0xc778d6[_0x25ae('0x10')][_0x25ae('0x11')]);}logger['error']('MailAccount,\x20%s,\x20%s',_0x1db94e,_0xc778d6[_0x25ae('0x10')]['message']);return _0x3e64f8(_0xc778d6[_0x25ae('0x10')][_0x25ae('0x11')]);}else{logger[_0x25ae('0xd')](_0x25ae('0x12'),_0x1db94e,_0x25ae('0xe'));_0x3e64f8(_0xc778d6[_0x25ae('0x13')]['message']);}})[_0x25ae('0x14')](function(_0x18b18a){logger[_0x25ae('0x10')](_0x25ae('0x12'),_0x1db94e,_0x18b18a);_0x4314ac(_0x18b18a);});});}function respondWithStatusCode(_0x4a2c27,_0x445b6e){_0x445b6e=_0x445b6e||0xcc;return function(_0x490aef){if(_0x490aef){return _0x4a2c27[_0x25ae('0x15')](_0x445b6e);}return _0x4a2c27[_0x25ae('0x16')](_0x445b6e)[_0x25ae('0x17')]();};}function respondWithResult(_0x17e936,_0x26973b){_0x26973b=_0x26973b||0xc8;return function(_0x267a5d){if(_0x267a5d){return _0x17e936['status'](_0x26973b)['json'](_0x267a5d);}};}function respondWithFilteredResult(_0x31453d,_0x30fad1){return function(_0x1a80f9){if(_0x1a80f9){var _0x9cc2e1=typeof _0x30fad1[_0x25ae('0x18')]===_0x25ae('0x19')&&typeof _0x30fad1[_0x25ae('0x1a')]===_0x25ae('0x19');var _0x5b6c42=_0x1a80f9[_0x25ae('0x1b')];var _0x597d01=_0x9cc2e1?0x0:_0x30fad1['offset'];var _0x47028b=_0x9cc2e1?_0x1a80f9[_0x25ae('0x1b')]:_0x30fad1['offset']+_0x30fad1['limit'];var _0x480d70;if(_0x47028b>=_0x5b6c42){_0x47028b=_0x5b6c42;_0x480d70=0xc8;}else{_0x480d70=0xce;}_0x31453d[_0x25ae('0x16')](_0x480d70);return _0x31453d[_0x25ae('0x1c')](_0x25ae('0x1d'),_0x597d01+'-'+_0x47028b+'/'+_0x5b6c42)[_0x25ae('0x1e')](_0x1a80f9);}return null;};}function saveUpdates(_0x5e5816){return function(_0x4ca07d){if(_0x4ca07d){return _0x4ca07d[_0x25ae('0x1f')](_0x5e5816)['then'](function(_0x30ab1f){return _0x30ab1f;});}return null;};}function removeEntity(_0x14b482){return function(_0x424c09){if(_0x424c09){return _0x424c09['destroy']()[_0x25ae('0xc')](function(){var _0x212274=_0x424c09[_0x25ae('0x20')]({'plain':!![]});var _0x2a8b6e=_0x25ae('0x21');return db[_0x25ae('0x22')][_0x25ae('0x23')]({'where':{'type':_0x2a8b6e,'resourceId':_0x212274['id']}})['then'](function(){return _0x424c09;});})[_0x25ae('0xc')](function(){_0x14b482[_0x25ae('0x16')](0xcc)[_0x25ae('0x17')]();});}};}function handleEntityNotFound(_0x4ea265){return function(_0x1cc44e){if(!_0x1cc44e){_0x4ea265[_0x25ae('0x15')](0x194);}return _0x1cc44e;};}function handleError(_0x596051,_0x4df295){_0x4df295=_0x4df295||0x1f4;return function(_0x52ffbb){logger[_0x25ae('0x10')](_0x52ffbb[_0x25ae('0x24')]);if(_0x52ffbb[_0x25ae('0x25')]){delete _0x52ffbb[_0x25ae('0x25')];}_0x596051['status'](_0x4df295)[_0x25ae('0x26')](_0x52ffbb);};}exports[_0x25ae('0x27')]=function(_0x3c8da3,_0x5f22bb){var _0x42ba41={'include':[{'model':db['MailServerIn'],'as':'Imap'},{'model':db[_0x25ae('0x28')],'as':_0x25ae('0x29')},{'model':db[_0x25ae('0x2a')],'as':'mandatoryDispositionPause'}]},_0x3523b5={},_0x4303ed={'count':0x0,'rows':[]};var _0x397f8e=_[_0x25ae('0x2b')](db[_0x25ae('0x2c')]['rawAttributes'],function(_0x4f4be7){return{'name':_0x4f4be7[_0x25ae('0x2d')],'type':_0x4f4be7[_0x25ae('0x2e')]['key']};});_0x3523b5['model']=_[_0x25ae('0x2b')](_0x397f8e,'name');_0x3523b5[_0x25ae('0x2f')]=_[_0x25ae('0x30')](_0x3c8da3[_0x25ae('0x2f')]);_0x3523b5['filters']=_[_0x25ae('0x31')](_0x3523b5['model'],_0x3523b5[_0x25ae('0x2f')]);_0x42ba41[_0x25ae('0x32')]=_[_0x25ae('0x31')](_0x3523b5[_0x25ae('0x33')],qs['fields'](_0x3c8da3[_0x25ae('0x2f')][_0x25ae('0x34')]));_0x42ba41[_0x25ae('0x32')]=_0x42ba41[_0x25ae('0x32')][_0x25ae('0x35')]?_0x42ba41[_0x25ae('0x32')]:_0x3523b5[_0x25ae('0x33')];if(!_0x3c8da3[_0x25ae('0x2f')][_0x25ae('0x36')](_0x25ae('0x37'))){_0x42ba41['limit']=qs['limit'](_0x3c8da3[_0x25ae('0x2f')][_0x25ae('0x1a')]);_0x42ba41[_0x25ae('0x18')]=qs[_0x25ae('0x18')](_0x3c8da3[_0x25ae('0x2f')]['offset']);}_0x42ba41[_0x25ae('0x38')]=qs[_0x25ae('0x39')](_0x3c8da3['query'][_0x25ae('0x39')]);_0x42ba41[_0x25ae('0x3a')]=qs[_0x25ae('0x3b')](_[_0x25ae('0x3c')](_0x3c8da3['query'],_0x3523b5[_0x25ae('0x3b')]),_0x397f8e);if(_0x3c8da3['query']['filter']){_0x42ba41[_0x25ae('0x3a')]=_[_0x25ae('0x3d')](_0x42ba41[_0x25ae('0x3a')],{'$or':_['map'](_0x397f8e,function(_0x1f61c6){if(_0x1f61c6['type']!==_0x25ae('0x3e')){var _0x4bbf17={};_0x4bbf17[_0x1f61c6[_0x25ae('0x25')]]={'$like':'%'+_0x3c8da3['query']['filter']+'%'};return _0x4bbf17;}})});}_0x42ba41=_[_0x25ae('0x3d')]({},_0x42ba41,_0x3c8da3[_0x25ae('0x3f')]);var _0x3962ee={'where':_0x42ba41['where']};return db[_0x25ae('0x2c')][_0x25ae('0x1b')](_0x3962ee)[_0x25ae('0xc')](function(_0x5e82a5){_0x4303ed['count']=_0x5e82a5;if(_0x3c8da3[_0x25ae('0x2f')][_0x25ae('0x40')]){_0x42ba41[_0x25ae('0x41')]=[{'all':!![]}];}_0x42ba41['logging']=!![];return db[_0x25ae('0x2c')][_0x25ae('0x42')](_0x42ba41);})['then'](function(_0x212e45){_0x4303ed['rows']=_0x212e45;return _0x4303ed;})['then'](respondWithFilteredResult(_0x5f22bb,_0x42ba41))['catch'](handleError(_0x5f22bb,null));};exports[_0x25ae('0x43')]=function(_0x24a956,_0x211b97){var _0x1e2f1e={'raw':![],'where':{'id':_0x24a956[_0x25ae('0x44')]['id']},'include':[{'model':db[_0x25ae('0x45')],'as':_0x25ae('0x46')},{'model':db[_0x25ae('0x28')],'as':_0x25ae('0x29')},{'model':db['Pause'],'as':_0x25ae('0x47')}]},_0x1c7a26={};_0x1c7a26['model']=_[_0x25ae('0x30')](db[_0x25ae('0x2c')][_0x25ae('0x48')]);_0x1c7a26['query']=_[_0x25ae('0x30')](_0x24a956[_0x25ae('0x2f')]);_0x1c7a26[_0x25ae('0x3b')]=_[_0x25ae('0x31')](_0x1c7a26['model'],_0x1c7a26[_0x25ae('0x2f')]);_0x1e2f1e['attributes']=_[_0x25ae('0x31')](_0x1c7a26[_0x25ae('0x33')],qs[_0x25ae('0x34')](_0x24a956[_0x25ae('0x2f')][_0x25ae('0x34')]));_0x1e2f1e[_0x25ae('0x32')]=_0x1e2f1e['attributes']['length']?_0x1e2f1e['attributes']:_0x1c7a26[_0x25ae('0x33')];if(_0x24a956[_0x25ae('0x2f')][_0x25ae('0x40')]){_0x1e2f1e['include']=[{'all':!![]}];}_0x1e2f1e=_[_0x25ae('0x3d')]({},_0x1e2f1e,_0x24a956[_0x25ae('0x3f')]);return db[_0x25ae('0x2c')][_0x25ae('0x49')](_0x1e2f1e)[_0x25ae('0xc')](handleEntityNotFound(_0x211b97,null))['then'](respondWithResult(_0x211b97,null))['catch'](handleError(_0x211b97,null));};exports[_0x25ae('0x1f')]=function(_0x56b5cc,_0x344e09){if(_0x56b5cc[_0x25ae('0x4a')]['id']){delete _0x56b5cc[_0x25ae('0x4a')]['id'];}if(_0x56b5cc[_0x25ae('0x4a')][_0x25ae('0x46')]){if(!_0x56b5cc[_0x25ae('0x4a')][_0x25ae('0x46')]['modernAuthentication']){_0x56b5cc[_0x25ae('0x4a')][_0x25ae('0x46')]['CloudProviderId']=null;}}if(_0x56b5cc[_0x25ae('0x4a')][_0x25ae('0x29')]){if(_0x56b5cc[_0x25ae('0x4a')][_0x25ae('0x29')][_0x25ae('0x4b')]){_0x56b5cc[_0x25ae('0x4a')][_0x25ae('0x29')][_0x25ae('0x4c')]=![];}else{_0x56b5cc[_0x25ae('0x4a')]['Smtp']['CloudProviderId']=null;}}return db[_0x25ae('0x2c')][_0x25ae('0x49')]({'where':{'id':_0x56b5cc[_0x25ae('0x44')]['id']},'include':[{'model':db[_0x25ae('0x45')],'as':_0x25ae('0x46')},{'model':db['MailServerOut'],'as':_0x25ae('0x29')},{'model':db[_0x25ae('0x2a')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x344e09,null))['then'](saveUpdates(_0x56b5cc[_0x25ae('0x4a')],null))[_0x25ae('0xc')](function(_0x4df7dc){if(_0x4df7dc&&_0x56b5cc[_0x25ae('0x4a')][_0x25ae('0x46')]){return db['MailServerIn']['update'](_0x56b5cc[_0x25ae('0x4a')][_0x25ae('0x46')],{'where':{'MailAccountId':_0x4df7dc['id']}})[_0x25ae('0xc')](function(){return _0x4df7dc;});}return _0x4df7dc;})[_0x25ae('0xc')](function(_0x1d8093){if(_0x1d8093&&_0x56b5cc[_0x25ae('0x4a')]['Smtp']){return db['MailServerOut'][_0x25ae('0x1f')](_0x56b5cc[_0x25ae('0x4a')][_0x25ae('0x29')],{'where':{'MailAccountId':_0x1d8093['id']}})[_0x25ae('0xc')](function(){return _0x1d8093;});}return _0x1d8093;})[_0x25ae('0xc')](respondWithResult(_0x344e09,null))[_0x25ae('0x14')](handleError(_0x344e09,null));};exports['describe']=function(_0x39fb9b,_0xbbbd42){return db[_0x25ae('0x2c')][_0x25ae('0x4d')]()['then'](respondWithResult(_0xbbbd42,null))['catch'](handleError(_0xbbbd42,null));};exports[_0x25ae('0x4e')]=function(_0xb64407,_0x1043ea){if(_0xb64407['body']['id']){delete _0xb64407[_0x25ae('0x4a')]['id'];}return db[_0x25ae('0x2c')][_0x25ae('0x49')]({'where':{'id':_0xb64407['params']['id']}})[_0x25ae('0xc')](handleEntityNotFound(_0x1043ea,null))[_0x25ae('0xc')](function(_0x5ee5ea){if(_0x5ee5ea){_0xb64407[_0x25ae('0x4a')][_0x25ae('0x4f')]=_0x5ee5ea['id'];return db[_0x25ae('0x50')][_0x25ae('0x51')](_0xb64407[_0x25ae('0x4a')]);}})[_0x25ae('0xc')](respondWithResult(_0x1043ea,null))[_0x25ae('0x14')](handleError(_0x1043ea,null));};exports[_0x25ae('0x52')]=function(_0x1c3a84,_0x12baa1){var _0x5b9263={'raw':![],'where':{}};var _0x313b4a={};var _0x2be5ce={'count':0x0,'rows':[]};return db[_0x25ae('0x2c')][_0x25ae('0x53')]({'where':{'id':_0x1c3a84['params']['id']}})[_0x25ae('0xc')](handleEntityNotFound(_0x12baa1,null))[_0x25ae('0xc')](function(_0x186eea){if(_0x186eea){_0x313b4a[_0x25ae('0x33')]=_['keys'](db['Disposition'][_0x25ae('0x48')]);_0x313b4a['query']=_[_0x25ae('0x30')](_0x1c3a84[_0x25ae('0x2f')]);_0x313b4a[_0x25ae('0x3b')]=_[_0x25ae('0x31')](_0x313b4a[_0x25ae('0x33')],_0x313b4a[_0x25ae('0x2f')]);_0x5b9263[_0x25ae('0x32')]=_[_0x25ae('0x31')](_0x313b4a[_0x25ae('0x33')],qs['fields'](_0x1c3a84['query'][_0x25ae('0x34')]));_0x5b9263[_0x25ae('0x32')]=_0x5b9263[_0x25ae('0x32')]['length']?_0x5b9263['attributes']:_0x313b4a['model'];if(!_0x1c3a84[_0x25ae('0x2f')][_0x25ae('0x36')](_0x25ae('0x37'))){_0x5b9263[_0x25ae('0x1a')]=qs[_0x25ae('0x1a')](_0x1c3a84['query'][_0x25ae('0x1a')]);_0x5b9263[_0x25ae('0x18')]=qs[_0x25ae('0x18')](_0x1c3a84[_0x25ae('0x2f')][_0x25ae('0x18')]);}_0x5b9263[_0x25ae('0x38')]=qs[_0x25ae('0x39')](_0x1c3a84[_0x25ae('0x2f')][_0x25ae('0x39')]);_0x5b9263['where']=qs[_0x25ae('0x3b')](_[_0x25ae('0x3c')](_0x1c3a84['query'],_0x313b4a[_0x25ae('0x3b')]));_0x5b9263[_0x25ae('0x3a')]['MailAccountId']=_0x186eea['id'];if(_0x1c3a84['query'][_0x25ae('0x54')]){_0x5b9263[_0x25ae('0x3a')]=_[_0x25ae('0x3d')](_0x5b9263[_0x25ae('0x3a')],{'$or':_[_0x25ae('0x2b')](_0x5b9263[_0x25ae('0x32')],function(_0x24f827){var _0x4bc98f={};_0x4bc98f[_0x24f827]={'$like':'%'+_0x1c3a84[_0x25ae('0x2f')][_0x25ae('0x54')]+'%'};return _0x4bc98f;})});}_0x5b9263=_[_0x25ae('0x3d')]({},_0x5b9263,_0x1c3a84['options']);return db[_0x25ae('0x50')][_0x25ae('0x1b')]({'where':_0x5b9263[_0x25ae('0x3a')]})[_0x25ae('0xc')](function(_0x496df8){_0x2be5ce[_0x25ae('0x1b')]=_0x496df8;if(_0x1c3a84['query'][_0x25ae('0x40')]){_0x5b9263[_0x25ae('0x41')]=[{'all':!![]}];}return db['Disposition'][_0x25ae('0x42')](_0x5b9263);})['then'](function(_0xf7b094){_0x2be5ce[_0x25ae('0x55')]=_0xf7b094;return _0x2be5ce;});}})[_0x25ae('0xc')](respondWithFilteredResult(_0x12baa1,_0x5b9263))['catch'](handleError(_0x12baa1,null));};exports[_0x25ae('0x56')]=function(_0x3d7535,_0x46df1a){return db[_0x25ae('0x2c')][_0x25ae('0x49')]({'where':{'id':_0x3d7535['params']['id']}})[_0x25ae('0xc')](handleEntityNotFound(_0x46df1a,null))[_0x25ae('0xc')](function(_0x415c19){if(_0x415c19){return _0x415c19[_0x25ae('0x56')](_0x3d7535[_0x25ae('0x2f')][_0x25ae('0x57')]);}})['then'](respondWithStatusCode(_0x46df1a,null))['catch'](handleError(_0x46df1a,null));};exports[_0x25ae('0x58')]=function(_0x23961f,_0x28bb25){if(_0x23961f[_0x25ae('0x4a')]['id']){delete _0x23961f['body']['id'];}return db[_0x25ae('0x2c')][_0x25ae('0x49')]({'where':{'id':_0x23961f['params']['id']}})[_0x25ae('0xc')](handleEntityNotFound(_0x28bb25,null))[_0x25ae('0xc')](function(_0x4ad4bf){if(_0x4ad4bf){_0x23961f['body'][_0x25ae('0x4f')]=_0x4ad4bf['id'];return db[_0x25ae('0x59')]['create'](_0x23961f[_0x25ae('0x4a')]);}})['then'](respondWithResult(_0x28bb25,null))[_0x25ae('0x14')](handleError(_0x28bb25,null));};exports[_0x25ae('0x5a')]=function(_0x39f383,_0x33f48a){var _0x307db5={'raw':![],'where':{}};var _0x27be8c={};var _0x4198b8={'count':0x0,'rows':[]};return db[_0x25ae('0x2c')][_0x25ae('0x53')]({'where':{'id':_0x39f383['params']['id']}})[_0x25ae('0xc')](handleEntityNotFound(_0x33f48a,null))[_0x25ae('0xc')](function(_0x48002f){if(_0x48002f){_0x27be8c['model']=_[_0x25ae('0x30')](db[_0x25ae('0x59')]['rawAttributes']);_0x27be8c[_0x25ae('0x2f')]=_['keys'](_0x39f383['query']);_0x27be8c['filters']=_[_0x25ae('0x31')](_0x27be8c[_0x25ae('0x33')],_0x27be8c[_0x25ae('0x2f')]);_0x307db5[_0x25ae('0x32')]=_[_0x25ae('0x31')](_0x27be8c['model'],qs['fields'](_0x39f383[_0x25ae('0x2f')][_0x25ae('0x34')]));_0x307db5[_0x25ae('0x32')]=_0x307db5[_0x25ae('0x32')][_0x25ae('0x35')]?_0x307db5[_0x25ae('0x32')]:_0x27be8c[_0x25ae('0x33')];if(!_0x39f383['query'][_0x25ae('0x36')]('nolimit')){_0x307db5[_0x25ae('0x1a')]=qs[_0x25ae('0x1a')](_0x39f383[_0x25ae('0x2f')]['limit']);_0x307db5[_0x25ae('0x18')]=qs[_0x25ae('0x18')](_0x39f383[_0x25ae('0x2f')][_0x25ae('0x18')]);}_0x307db5[_0x25ae('0x38')]=qs[_0x25ae('0x39')](_0x39f383[_0x25ae('0x2f')][_0x25ae('0x39')]);_0x307db5['where']=qs[_0x25ae('0x3b')](_['pick'](_0x39f383[_0x25ae('0x2f')],_0x27be8c[_0x25ae('0x3b')]));_0x307db5['where'][_0x25ae('0x4f')]=_0x48002f['id'];if(_0x39f383[_0x25ae('0x2f')]['filter']){_0x307db5[_0x25ae('0x3a')]=_['merge'](_0x307db5[_0x25ae('0x3a')],{'$or':_['map'](_0x307db5[_0x25ae('0x32')],function(_0x586efc){var _0x376e81={};_0x376e81[_0x586efc]={'$like':'%'+_0x39f383[_0x25ae('0x2f')][_0x25ae('0x54')]+'%'};return _0x376e81;})});}_0x307db5=_[_0x25ae('0x3d')]({},_0x307db5,_0x39f383[_0x25ae('0x3f')]);return db[_0x25ae('0x59')][_0x25ae('0x1b')]({'where':_0x307db5[_0x25ae('0x3a')]})['then'](function(_0x3400f1){_0x4198b8['count']=_0x3400f1;if(_0x39f383[_0x25ae('0x2f')]['includeAll']){_0x307db5[_0x25ae('0x41')]=[{'all':!![]}];}return db[_0x25ae('0x59')][_0x25ae('0x42')](_0x307db5);})['then'](function(_0x29cb80){_0x4198b8['rows']=_0x29cb80;return _0x4198b8;});}})[_0x25ae('0xc')](respondWithFilteredResult(_0x33f48a,_0x307db5))[_0x25ae('0x14')](handleError(_0x33f48a,null));};exports['removeAnswers']=function(_0x2ca1d0,_0x43359f){return db[_0x25ae('0x2c')][_0x25ae('0x49')]({'where':{'id':_0x2ca1d0[_0x25ae('0x44')]['id']}})[_0x25ae('0xc')](handleEntityNotFound(_0x43359f,null))['then'](function(_0x229709){if(_0x229709){return _0x229709[_0x25ae('0x5b')](_0x2ca1d0[_0x25ae('0x2f')]['ids']);}})[_0x25ae('0xc')](respondWithStatusCode(_0x43359f,null))[_0x25ae('0x14')](handleError(_0x43359f,null));};function getImapHost(_0x21775b){switch(_0x21775b){case _0x25ae('0x5c'):return _0x25ae('0x5d');case _0x25ae('0x5e'):return _0x25ae('0x5f');case'hotmail':return _0x25ae('0x60');case'outlook365':return'outlook.office365.com';}throw new Error('Unknown\x20email\x20service\x20provider',_0x21775b);}function getSmtpHost(_0x5a0ce8){switch(_0x5a0ce8){case _0x25ae('0x5c'):return _0x25ae('0x61');case _0x25ae('0x5e'):return'smtp.mail.yahoo.com';case _0x25ae('0x62'):return _0x25ae('0x63');case _0x25ae('0x64'):return'smtp.office365.com';}throw new Error(_0x25ae('0x65'),_0x5a0ce8);}function getSmtpPort(_0x114ba9,_0x934060){switch(_0x114ba9){case'gmail':return _0x934060===!![]?0x24b:0x1d1;case _0x25ae('0x5e'):return 0x1d1;case _0x25ae('0x62'):return 0x24b;case _0x25ae('0x64'):return 0x24b;}throw new Error(_0x25ae('0x65'),_0x114ba9);}function getAuthenticationOptions(_0xf082e7,_0x574bbb){var _0x44d59e={};var _0x5a464f={};if(_0xf082e7){_0x44d59e[_0x25ae('0x66')]=_0x5a464f[_0x25ae('0x66')]=_0x574bbb[_0x25ae('0x67')];_0x44d59e[_0x25ae('0x68')]=_0x5a464f[_0x25ae('0x69')]=_0x574bbb[_0x25ae('0x68')];if(_0x574bbb[_0x25ae('0x4b')]){_0x44d59e[_0x25ae('0x4b')]=_0x5a464f[_0x25ae('0x4b')]=!![];_0x44d59e[_0x25ae('0x6a')]=_0x5a464f[_0x25ae('0x6a')]=_0x574bbb[_0x25ae('0x6a')];_0x44d59e[_0x25ae('0x68')]=_0x5a464f['pass']=null;}else{_0x44d59e['CloudProviderId']=_0x5a464f[_0x25ae('0x6a')]=null;}_0x44d59e['host']=getImapHost(_0xf082e7);_0x44d59e[_0x25ae('0x6b')]=0x3e1;_0x5a464f[_0x25ae('0x6c')]=getSmtpHost(_0xf082e7);_0x5a464f['port']=getSmtpPort(_0xf082e7,_0x5a464f[_0x25ae('0x4c')]);_0x44d59e[_0x25ae('0x6d')]=_0x5a464f[_0x25ae('0x6d')]=null;}else{if(_0x574bbb[_0x25ae('0x6e')]){_0x44d59e['user']=_0x5a464f[_0x25ae('0x66')]=_0x574bbb['username'];_0x44d59e[_0x25ae('0x68')]=_0x5a464f[_0x25ae('0x69')]=_0x574bbb[_0x25ae('0x68')];}else{_0x44d59e['authentication']=_0x5a464f['authentication']=![];_0x44d59e[_0x25ae('0x66')]=_0x5a464f[_0x25ae('0x66')]=null;_0x44d59e[_0x25ae('0x68')]=_0x5a464f['pass']=null;}_0x44d59e[_0x25ae('0x6c')]=_0x574bbb['Imap']['host'];_0x44d59e[_0x25ae('0x6b')]=_0x574bbb['Imap'][_0x25ae('0x6b')];_0x5a464f[_0x25ae('0x6c')]=_0x574bbb[_0x25ae('0x29')][_0x25ae('0x6c')];_0x5a464f['port']=_0x574bbb[_0x25ae('0x29')]['port'];}return{'Imap':_0x44d59e,'Smtp':_0x5a464f};}exports[_0x25ae('0x51')]=function(_0x522027,_0x1f3f27){var _0x4a8d44={'name':_0x522027[_0x25ae('0x4a')][_0x25ae('0x25')],'key':_0x522027['body'][_0x25ae('0x6f')],'provider':_0x522027[_0x25ae('0x4a')][_0x25ae('0x70')]===_0x25ae('0x71')?null:_0x522027['body'][_0x25ae('0x70')],'email':_0x522027[_0x25ae('0x4a')][_0x25ae('0x72')],'ListId':_0x522027[_0x25ae('0x4a')][_0x25ae('0x73')],'active':!_[_0x25ae('0x74')](_0x522027['body']['active'])?_0x522027['body']['active']:!![],'description':_0x522027[_0x25ae('0x4a')][_0x25ae('0x75')]||null};var _0x45ab37=getAuthenticationOptions(_0x4a8d44[_0x25ae('0x70')],_0x522027['body']);_0x4a8d44[_0x25ae('0x46')]=_0x45ab37['Imap'];_0x4a8d44['Smtp']=_0x45ab37[_0x25ae('0x29')];return db['MailAccount'][_0x25ae('0x51')](_0x4a8d44,{'include':[{'model':db['MailServerOut'],'as':_0x25ae('0x29')},{'model':db[_0x25ae('0x45')],'as':'Imap'}]})[_0x25ae('0xc')](function(_0x25fdfb){var _0x3572c1=_0x522027[_0x25ae('0x66')][_0x25ae('0x20')]({'plain':!![]});if(!_0x3572c1)throw new Error(_0x25ae('0x76'));if(_0x3572c1['role']===_0x25ae('0x66')){var _0x3a2924=_0x25fdfb[_0x25ae('0x20')]({'plain':!![]});return db[_0x25ae('0x77')][_0x25ae('0x49')]({'where':{'name':_0x25ae('0x21'),'userProfileId':_0x3572c1[_0x25ae('0x78')]},'raw':!![]})[_0x25ae('0xc')](function(_0x2603cf){if(_0x2603cf&&_0x2603cf[_0x25ae('0x79')]===0x0){return db[_0x25ae('0x22')]['create']({'name':_0x3a2924[_0x25ae('0x25')],'resourceId':_0x3a2924['id'],'type':_0x2603cf[_0x25ae('0x25')],'sectionId':_0x2603cf['id']},{})[_0x25ae('0xc')](function(){return _0x25fdfb;});}else{return _0x25fdfb;}})[_0x25ae('0x14')](function(_0x311a31){logger[_0x25ae('0x10')](_0x25ae('0x7a'),_0x311a31);throw _0x311a31;});}return _0x25fdfb;})['then'](respondWithResult(_0x1f3f27,0xc9))['catch'](handleError(_0x1f3f27,null));};exports[_0x25ae('0x7b')]=function(_0x595e0d,_0x483bc9){return db[_0x25ae('0x2c')][_0x25ae('0x53')]({'where':{'id':_0x595e0d[_0x25ae('0x44')]['id']}})['then'](handleEntityNotFound(_0x483bc9,null))[_0x25ae('0xc')](function(_0x4f3b3b){if(_0x4f3b3b){return _0x4f3b3b[_0x25ae('0x7b')]();}return null;})[_0x25ae('0xc')](respondWithResult(_0x483bc9,null))['catch'](handleError(_0x483bc9,null));};exports[_0x25ae('0x7c')]=function(_0x3ebb66,_0x527529){if(_0x3ebb66[_0x25ae('0x4a')]['id']){delete _0x3ebb66[_0x25ae('0x4a')]['id'];}return db[_0x25ae('0x2c')]['find']({'where':{'id':_0x3ebb66[_0x25ae('0x44')]['id']}})['then'](handleEntityNotFound(_0x527529,null))[_0x25ae('0xc')](function(_0x21a992){if(_0x21a992){_0x3ebb66[_0x25ae('0x4a')][_0x25ae('0x4f')]=_0x21a992['id'];return db[_0x25ae('0x45')][_0x25ae('0x51')](_0x3ebb66[_0x25ae('0x4a')]);}})['then'](respondWithResult(_0x527529,null))['catch'](handleError(_0x527529,null));};exports[_0x25ae('0x7d')]=function(_0x34cc24,_0x3cd563){return db[_0x25ae('0x2c')]['findOne']({'where':{'id':_0x34cc24[_0x25ae('0x44')]['id']}})[_0x25ae('0xc')](handleEntityNotFound(_0x3cd563,null))[_0x25ae('0xc')](function(_0x591a61){if(_0x591a61){return _0x591a61[_0x25ae('0x7e')](null);}return null;})[_0x25ae('0xc')](respondWithStatusCode(_0x3cd563,null))[_0x25ae('0x14')](handleError(_0x3cd563,null));};exports[_0x25ae('0x7f')]=function(_0x4d023f,_0xbb3a82){return db[_0x25ae('0x2c')][_0x25ae('0x53')]({'where':{'id':_0x4d023f[_0x25ae('0x44')]['id']}})['then'](handleEntityNotFound(_0xbb3a82,null))[_0x25ae('0xc')](function(_0x2c8e37){if(_0x2c8e37){return _0x2c8e37[_0x25ae('0x7f')]();}return null;})[_0x25ae('0xc')](respondWithResult(_0xbb3a82,null))['catch'](handleError(_0xbb3a82,null));};exports['addSmtp']=function(_0x423ee4,_0x52414e){if(_0x423ee4[_0x25ae('0x4a')]['id']){delete _0x423ee4[_0x25ae('0x4a')]['id'];}return db[_0x25ae('0x2c')][_0x25ae('0x49')]({'where':{'id':_0x423ee4[_0x25ae('0x44')]['id']}})[_0x25ae('0xc')](handleEntityNotFound(_0x52414e,null))[_0x25ae('0xc')](function(_0x4d8d2a){if(_0x4d8d2a){_0x423ee4[_0x25ae('0x4a')][_0x25ae('0x4f')]=_0x4d8d2a['id'];return db[_0x25ae('0x28')]['create'](_0x423ee4['body']);}})[_0x25ae('0xc')](respondWithResult(_0x52414e,null))[_0x25ae('0x14')](handleError(_0x52414e,null));};exports[_0x25ae('0x80')]=function(_0x121be5,_0x4c521c){return db[_0x25ae('0x2c')][_0x25ae('0x53')]({'where':{'id':_0x121be5[_0x25ae('0x44')]['id']}})[_0x25ae('0xc')](handleEntityNotFound(_0x4c521c,null))[_0x25ae('0xc')](function(_0xea8de7){if(_0xea8de7){return _0xea8de7[_0x25ae('0x81')](null);}return null;})['then'](respondWithStatusCode(_0x4c521c,null))[_0x25ae('0x14')](handleError(_0x4c521c,null));};exports[_0x25ae('0x82')]=function(_0x234c6e,_0x44f1f7){return db[_0x25ae('0x83')][_0x25ae('0x49')]({'where':{'id':_0x234c6e[_0x25ae('0x44')]['id']}})[_0x25ae('0xc')](handleEntityNotFound(_0x44f1f7,null))['then'](function(_0x5f3325){if(_0x5f3325){return _0x5f3325[_0x25ae('0x82')](_0x234c6e[_0x25ae('0x4a')][_0x25ae('0x57')],_[_0x25ae('0x84')](_0x234c6e[_0x25ae('0x4a')],[_0x25ae('0x57'),'id'])||{});}})[_0x25ae('0xc')](respondWithResult(_0x44f1f7,null))[_0x25ae('0x14')](handleError(_0x44f1f7,null));};exports['getInteractions']=function(_0x152081,_0x127863){var _0xa7916f={'raw':![],'where':{}};var _0x2dc934={};var _0x22e3a3={'count':0x0,'rows':[]};return db[_0x25ae('0x2c')][_0x25ae('0x53')]({'where':{'id':_0x152081[_0x25ae('0x44')]['id']}})[_0x25ae('0xc')](handleEntityNotFound(_0x127863,null))['then'](function(_0x1b1b53){if(_0x1b1b53){_0x2dc934[_0x25ae('0x33')]=_[_0x25ae('0x30')](db[_0x25ae('0x83')]['rawAttributes']);_0x2dc934[_0x25ae('0x2f')]=_['keys'](_0x152081['query']);_0x2dc934['filters']=_[_0x25ae('0x31')](_0x2dc934[_0x25ae('0x33')],_0x2dc934['query']);_0xa7916f[_0x25ae('0x32')]=_[_0x25ae('0x31')](_0x2dc934[_0x25ae('0x33')],qs[_0x25ae('0x34')](_0x152081[_0x25ae('0x2f')][_0x25ae('0x34')]));_0xa7916f[_0x25ae('0x32')]=_0xa7916f['attributes'][_0x25ae('0x35')]?_0xa7916f[_0x25ae('0x32')]:_0x2dc934[_0x25ae('0x33')];if(!_0x152081[_0x25ae('0x2f')][_0x25ae('0x36')](_0x25ae('0x37'))){_0xa7916f[_0x25ae('0x1a')]=qs['limit'](_0x152081['query']['limit']);_0xa7916f[_0x25ae('0x18')]=qs[_0x25ae('0x18')](_0x152081[_0x25ae('0x2f')][_0x25ae('0x18')]);}_0xa7916f['order']=qs[_0x25ae('0x39')](_0x152081[_0x25ae('0x2f')][_0x25ae('0x39')]);_0xa7916f[_0x25ae('0x3a')]=qs['filters'](_[_0x25ae('0x3c')](_0x152081[_0x25ae('0x2f')],_0x2dc934[_0x25ae('0x3b')]));_0xa7916f[_0x25ae('0x3a')][_0x25ae('0x4f')]=_0x1b1b53['id'];if(_0x152081[_0x25ae('0x2f')][_0x25ae('0x54')]){_0xa7916f[_0x25ae('0x3a')]=_['merge'](_0xa7916f[_0x25ae('0x3a')],{'$or':_[_0x25ae('0x2b')](_0xa7916f[_0x25ae('0x32')],function(_0xddbdc){var _0x3708b7={};_0x3708b7[_0xddbdc]={'$like':'%'+_0x152081['query'][_0x25ae('0x54')]+'%'};return _0x3708b7;})});}_0xa7916f=_['merge']({},_0xa7916f,_0x152081['options']);return db['MailInteraction']['count']({'where':_0xa7916f['where']})[_0x25ae('0xc')](function(_0xc1bcb2){_0x22e3a3['count']=_0xc1bcb2;if(_0x152081[_0x25ae('0x2f')]['includeAll']){_0xa7916f[_0x25ae('0x41')]=[{'model':db[_0x25ae('0x85')],'as':_0x25ae('0x86'),'required':![]},{'model':db[_0x25ae('0x87')],'as':_0x25ae('0x88'),'attributes':[_0x25ae('0x25'),_0x25ae('0x89'),'internal'],'required':![]},{'model':db[_0x25ae('0x8a')],'as':_0x25ae('0x8b'),'attributes':['id',_0x25ae('0x25'),_0x25ae('0x8c')],'where':_0x152081['query']['tag']?{'id':_0x152081['query'][_0x25ae('0x8d')]}:undefined,'required':_0x152081[_0x25ae('0x2f')][_0x25ae('0x8d')]?!![]:![]}];}return db['MailInteraction']['findAll'](_0xa7916f);})[_0x25ae('0xc')](function(_0x27b6f1){_0x22e3a3['rows']=_0x27b6f1;return _0x22e3a3;});}})[_0x25ae('0xc')](respondWithFilteredResult(_0x127863,_0xa7916f))['catch'](handleError(_0x127863,null));};exports[_0x25ae('0x8e')]=function addApplications(_0x161034,_0x3501b4){var _0xc56288=_0x161034[_0x25ae('0x44')]['id'];var _0x41f50b=_0x161034[_0x25ae('0x4a')];var _0x44a6d6=0xc8;var _0x42deda=null;return db[_0x25ae('0x8f')][_0x25ae('0x90')]({'isolationLevel':db['sequelize']['Transaction'][_0x25ae('0x91')][_0x25ae('0x92')]},function(_0x3683ca){return db[_0x25ae('0x2c')]['findOne']({'where':{'id':_0xc56288},'transaction':_0x3683ca})[_0x25ae('0xc')](function(_0x12fb03){if(_0x12fb03){return db['MailApplication'][_0x25ae('0x23')]({'where':{'MailAccountId':_0xc56288},'transaction':_0x3683ca})[_0x25ae('0xc')](function(){var _0x2db64a=_[_0x25ae('0x2b')](_0x41f50b,function(_0x34c885){_0x34c885[_0x25ae('0x4f')]=_0xc56288;return _0x34c885;});return db['MailApplication'][_0x25ae('0x93')](_0x2db64a,{'transaction':_0x3683ca});});}else{_0x44a6d6=0x194;_0x42deda=[];}});})['then'](function(){if(_0x44a6d6!==0x194){return db['MailApplication']['findAndCountAll']({'where':{'MailAccountId':_0xc56288},'order':'priority'})[_0x25ae('0xc')](function(_0x3f7f53){_0x42deda=_0x3f7f53;});}})[_0x25ae('0x14')](function(_0x1f3849){_0x44a6d6=0x1f4;logger[_0x25ae('0x10')](_0x1f3849[_0x25ae('0x24')]);if(_0x1f3849['name']){delete _0x1f3849[_0x25ae('0x25')];}_0x42deda=_0x1f3849;})[_0x25ae('0x94')](function(){if(_0x42deda===null){_0x3501b4[_0x25ae('0x15')](_0x44a6d6);}else{if(_0x44a6d6===0x1f4){_0x3501b4[_0x25ae('0x16')](_0x44a6d6)[_0x25ae('0x26')](_0x42deda);}else{_0x3501b4[_0x25ae('0x16')](_0x44a6d6)[_0x25ae('0x1e')](_0x42deda);}}});};exports[_0x25ae('0x95')]=function(_0x5dfdd5,_0x59ef7f){var _0x2f1c50={};var _0x1d235f={};var _0x3903cb;var _0x2c82bd;return db[_0x25ae('0x2c')][_0x25ae('0x53')]({'where':{'id':_0x5dfdd5['params']['id']}})['then'](handleEntityNotFound(_0x59ef7f,null))[_0x25ae('0xc')](function(_0x49cfb5){if(_0x49cfb5){_0x3903cb=_0x49cfb5;_0x1d235f[_0x25ae('0x33')]=_[_0x25ae('0x30')](db['MailApplication'][_0x25ae('0x48')]);_0x1d235f[_0x25ae('0x2f')]=_[_0x25ae('0x30')](_0x5dfdd5[_0x25ae('0x2f')]);_0x1d235f['filters']=_[_0x25ae('0x31')](_0x1d235f['model'],_0x1d235f['query']);_0x2f1c50[_0x25ae('0x32')]=_[_0x25ae('0x31')](_0x1d235f['model'],qs[_0x25ae('0x34')](_0x5dfdd5[_0x25ae('0x2f')][_0x25ae('0x34')]));_0x2f1c50[_0x25ae('0x32')]=_0x2f1c50[_0x25ae('0x32')]['length']?_0x2f1c50[_0x25ae('0x32')]:_0x1d235f[_0x25ae('0x33')];_0x2f1c50[_0x25ae('0x38')]=qs[_0x25ae('0x39')](_0x5dfdd5[_0x25ae('0x2f')]['sort']);_0x2f1c50['where']=qs[_0x25ae('0x3b')](_[_0x25ae('0x3c')](_0x5dfdd5[_0x25ae('0x2f')],_0x1d235f[_0x25ae('0x3b')]));if(_0x5dfdd5[_0x25ae('0x2f')][_0x25ae('0x54')]){_0x2f1c50[_0x25ae('0x3a')]=_['merge'](_0x2f1c50['where'],{'$or':_[_0x25ae('0x2b')](_0x2f1c50[_0x25ae('0x32')],function(_0x1d4583){var _0x5f48d1={};_0x5f48d1[_0x1d4583]={'$like':'%'+_0x5dfdd5[_0x25ae('0x2f')]['filter']+'%'};return _0x5f48d1;})});}_0x2f1c50=_[_0x25ae('0x3d')]({},_0x2f1c50,_0x5dfdd5['options']);return _0x3903cb[_0x25ae('0x95')](_0x2f1c50);}})[_0x25ae('0xc')](function(_0x45265e){if(_0x45265e){_0x2c82bd=_0x45265e[_0x25ae('0x35')];if(!_0x5dfdd5['query']['hasOwnProperty'](_0x25ae('0x37'))){_0x2f1c50['limit']=qs[_0x25ae('0x1a')](_0x5dfdd5[_0x25ae('0x2f')][_0x25ae('0x1a')]);_0x2f1c50[_0x25ae('0x18')]=qs['offset'](_0x5dfdd5['query']['offset']);}return _0x3903cb[_0x25ae('0x95')](_0x2f1c50);}})[_0x25ae('0xc')](function(_0x16d5ed){if(_0x16d5ed){return _0x16d5ed?{'count':_0x2c82bd,'rows':_0x16d5ed}:null;}})[_0x25ae('0xc')](respondWithResult(_0x59ef7f,null))[_0x25ae('0x14')](handleError(_0x59ef7f,null));};exports[_0x25ae('0x96')]=function(_0x197ece,_0x197caf){var _0x3c073f={'raw':!![],'where':{}};var _0x4b772f={};var _0x48aa85={'count':0x0,'rows':[]};return db[_0x25ae('0x2c')][_0x25ae('0x53')]({'where':{'id':_0x197ece[_0x25ae('0x44')]['id']}})['then'](handleEntityNotFound(_0x197caf,null))[_0x25ae('0xc')](function(_0x27a18d){if(_0x27a18d){_0x4b772f['model']=_['keys'](db[_0x25ae('0x97')][_0x25ae('0x48')]);_0x4b772f[_0x25ae('0x2f')]=_[_0x25ae('0x30')](_0x197ece[_0x25ae('0x2f')]);_0x4b772f['filters']=_[_0x25ae('0x31')](_0x4b772f['model'],_0x4b772f[_0x25ae('0x2f')]);_0x3c073f['attributes']=_[_0x25ae('0x31')](_0x4b772f['model'],qs[_0x25ae('0x34')](_0x197ece[_0x25ae('0x2f')][_0x25ae('0x34')]));_0x3c073f[_0x25ae('0x32')]=_0x3c073f['attributes']['length']?_0x3c073f[_0x25ae('0x32')]:_0x4b772f['model'];if(!_0x197ece[_0x25ae('0x2f')][_0x25ae('0x36')](_0x25ae('0x37'))){_0x3c073f[_0x25ae('0x1a')]=qs['limit'](_0x197ece['query'][_0x25ae('0x1a')]);_0x3c073f['offset']=qs[_0x25ae('0x18')](_0x197ece[_0x25ae('0x2f')][_0x25ae('0x18')]);}_0x3c073f[_0x25ae('0x38')]=qs[_0x25ae('0x39')](_0x197ece[_0x25ae('0x2f')][_0x25ae('0x39')]);_0x3c073f[_0x25ae('0x3a')]=qs[_0x25ae('0x3b')](_[_0x25ae('0x3c')](_0x197ece[_0x25ae('0x2f')],_0x4b772f[_0x25ae('0x3b')]));_0x3c073f[_0x25ae('0x3a')][_0x25ae('0x4f')]=_0x27a18d['id'];if(_0x197ece[_0x25ae('0x2f')][_0x25ae('0x54')]){_0x3c073f['where']=_['merge'](_0x3c073f['where'],{'$or':_['map'](_0x3c073f[_0x25ae('0x32')],function(_0x20f910){var _0x47484e={};_0x47484e[_0x20f910]={'$like':'%'+_0x197ece[_0x25ae('0x2f')][_0x25ae('0x54')]+'%'};return _0x47484e;})});}if(_0x197ece[_0x25ae('0x2f')][_0x25ae('0x98')]){var _0x2c96b9=_0x197ece[_0x25ae('0x2f')][_0x25ae('0x98')][_0x25ae('0x99')](',');var _0xc38b46={};_0xc38b46[_0x2c96b9[0x0]]={'$gte':moment(_0x2c96b9[0x1])[_0x25ae('0x9a')](_0x25ae('0x9b'))};_0x3c073f[_0x25ae('0x3a')]=_[_0x25ae('0x3d')](_0x3c073f[_0x25ae('0x3a')],_0xc38b46);}_0x3c073f=_[_0x25ae('0x3d')]({},_0x3c073f,_0x197ece['options']);return db['MailMessage'][_0x25ae('0x1b')]({'where':_0x3c073f[_0x25ae('0x3a')]})[_0x25ae('0xc')](function(_0x53294b){_0x48aa85[_0x25ae('0x1b')]=_0x53294b;if(_0x197ece[_0x25ae('0x2f')][_0x25ae('0x40')]){_0x3c073f[_0x25ae('0x41')]=[{'all':!![]}];}return db[_0x25ae('0x97')]['findAll'](_0x3c073f);})['then'](function(_0x29f2d1){if(_0x197ece['query']['inlineCss']==='true'){for(var _0x386bab=0x0;_0x386bab<_0x29f2d1[_0x25ae('0x35')];_0x386bab++){_0x29f2d1[_0x386bab]['body']=juice(_0x29f2d1[_0x386bab]['body']);}}_0x48aa85[_0x25ae('0x55')]=_0x29f2d1;return _0x48aa85;});}})[_0x25ae('0xc')](respondWithFilteredResult(_0x197caf,_0x3c073f))['catch'](handleError(_0x197caf,null));};exports[_0x25ae('0x26')]=function(_0x220f62,_0x9c182){var _0x4f61c4,_0x3cdf6b={},_0x4a0352;if(_0x220f62['body']['to']){_0x4a0352=_0x220f62[_0x25ae('0x4a')]['to']['split'](',')[0x0];}return db[_0x25ae('0x2c')][_0x25ae('0x49')]({'where':{'id':_0x220f62[_0x25ae('0x44')]['id']},'include':[{'model':db['CmList'],'as':_0x25ae('0x9c'),'include':[{'model':db[_0x25ae('0x85')],'as':_0x25ae('0x9d'),'where':{'email':_0x4a0352},'limit':0x1,'order':[[_0x25ae('0x9e'),'DESC']]}]},{'model':db[_0x25ae('0x28')],'as':_0x25ae('0x29'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x25ae('0x9f'),'raw':!![]}]}]})[_0x25ae('0xc')](handleEntityNotFound(_0x9c182,null))[_0x25ae('0xc')](function(_0xebd14b){if(!_0xebd14b)return;_0x4f61c4=_0xebd14b;if(!_0xebd14b[_0x25ae('0x29')])throw new Error(_0x25ae('0xa0'));if(_['isNil'](_0x220f62[_0x25ae('0x4a')][_0x25ae('0xa1')])){_0x220f62[_0x25ae('0x4a')][_0x25ae('0xa1')]=util['format'](_0x25ae('0xa2'),_0xebd14b[_0x25ae('0x25')],_0xebd14b[_0x25ae('0x72')]||_0xebd14b['Smtp'][_0x25ae('0x66')]);}if(_0x220f62[_0x25ae('0x4a')]['attachments']&&_0x220f62['body'][_0x25ae('0xa3')][_0x25ae('0x35')]){for(var _0x3e3bf6=0x0;_0x3e3bf6<_0x220f62[_0x25ae('0x4a')][_0x25ae('0xa3')][_0x25ae('0x35')];_0x3e3bf6+=0x1){_0x220f62[_0x25ae('0x4a')]['attachments'][_0x3e3bf6]={'filename':_0x220f62[_0x25ae('0x4a')][_0x25ae('0xa3')][_0x3e3bf6][_0x25ae('0x25')],'path':path[_0x25ae('0xa4')](config[_0x25ae('0xa5')],'server/files/attachments',_0x220f62[_0x25ae('0x4a')][_0x25ae('0xa3')][_0x3e3bf6]['basename'])};}}var _0x58fc84=_0xebd14b[_0x25ae('0xa6')]();return respondWithRpcPromise(_0x25ae('0xa7'),_0x25ae('0xa8'),{'account':_0x58fc84,'message':_0x220f62[_0x25ae('0x4a')]});})['then'](function(_0x5ab13f){if(!_0x5ab13f)return;_0x3cdf6b=_0x5ab13f;if(!_0x4f61c4[_0x25ae('0x9c')])throw new Error(_0x25ae('0xa9'));if(_0x4f61c4[_0x25ae('0x9c')][_0x25ae('0x9d')]['length'])return _0x4f61c4[_0x25ae('0x9c')]['Contacts'][0x0];return db[_0x25ae('0x85')]['create'](_[_0x25ae('0xaa')](_0x220f62[_0x25ae('0x4a')],{'firstName':_0x220f62[_0x25ae('0x4a')]['to'],'email':_0x220f62[_0x25ae('0x4a')]['to'],'phone':_0x220f62['body']['to'],'ListId':_0x4f61c4[_0x25ae('0x73')]}));})['then'](function(_0x3d0068){if(!_0x3d0068)return;var _0x3655e8={'UserId':_0x220f62[_0x25ae('0x66')]['id'],'ContactId':_0x3d0068['id'],'MailAccountId':_0x4f61c4['id'],'inReplyTo':_0x3cdf6b[_0x25ae('0xab')],'to':_0x220f62[_0x25ae('0x4a')]['from'],'cc':_0x220f62[_0x25ae('0x4a')]['cc'],'subject':_0x220f62[_0x25ae('0x4a')][_0x25ae('0xac')],'attach':_0x220f62[_0x25ae('0x4a')][_0x25ae('0xad')],'firstMsgDirection':_0x25ae('0xae'),'lastMsgAt':moment()[_0x25ae('0x9a')](_0x25ae('0x9b')),'lastMsgDirection':'out','Messages':[_[_0x25ae('0x3d')](_0x220f62['body'],{'messageId':_0x3cdf6b[_0x25ae('0xab')],'sentAt':moment()[_0x25ae('0x9a')](_0x25ae('0x9b')),'read':!![],'MailAccountId':_0x4f61c4['id'],'UserId':_0x220f62[_0x25ae('0x66')]['id'],'ContactId':_0x3d0068['id']})]};if(_0x220f62[_0x25ae('0x4a')]['Interaction']){_0x3655e8=_[_0x25ae('0x3d')](_0x3655e8,_0x220f62['body']['Interaction']);}return db[_0x25ae('0x83')]['create'](_0x3655e8,{'include':[{'model':db[_0x25ae('0x97')],'as':_0x25ae('0xaf')}]});})['then'](respondWithResult(_0x9c182,null))['catch'](handleError(_0x9c182,null));};exports[_0x25ae('0xb0')]=function(_0xb64b5f,_0x451772){return db[_0x25ae('0x2c')][_0x25ae('0x49')]({'where':{'id':_0xb64b5f[_0x25ae('0x44')]['id']},'include':[{'model':db[_0x25ae('0x28')],'as':_0x25ae('0x29'),'raw':!![],'include':[{'model':db[_0x25ae('0x9f')],'as':'CloudProvider','raw':!![]}]}]})[_0x25ae('0xc')](handleEntityNotFound(_0x451772,null))[_0x25ae('0xc')](function(_0x5a0978){if(!_0x5a0978[_0x25ae('0x29')])return;var _0x5bf9c8=_0x5a0978[_0x25ae('0xa6')]();return respondWithRpcPromise('VerifySmtp',_0x25ae('0xb0'),{'account':_0x5bf9c8});})[_0x25ae('0xc')](respondWithResult(_0x451772,null))[_0x25ae('0x14')](handleError(_0x451772,null));};exports['destroy']=function(_0x2ba73e,_0x533720){return db[_0x25ae('0x2c')][_0x25ae('0x49')]({'where':{'id':_0x2ba73e[_0x25ae('0x44')]['id']}})[_0x25ae('0xc')](handleEntityNotFound(_0x533720,null))[_0x25ae('0xc')](function(_0x390f8f){if(_0x390f8f&&_0x390f8f[_0x25ae('0x6d')]){throw new db['Sequelize'][(_0x25ae('0xb1'))](_0x25ae('0xb2'));}return _0x390f8f;})['then'](removeEntity(_0x533720,null))['catch'](handleError(_0x533720,null));};exports[_0x25ae('0xb3')]=function(_0x1cae53,_0x375810){return db[_0x25ae('0x2c')][_0x25ae('0x49')]({'where':{'id':_0x1cae53[_0x25ae('0x44')]['id']}})[_0x25ae('0xc')](handleEntityNotFound(_0x375810,null))['then'](function(_0x174d62){if(_0x174d62){return _0x174d62['addAgents'](_0x1cae53[_0x25ae('0x4a')][_0x25ae('0x57')],_[_0x25ae('0x84')](_0x1cae53[_0x25ae('0x4a')],['ids','id'])||{})[_0x25ae('0xb4')](function(_0x46a39d){for(var _0x621ff1=0x0;_0x621ff1<_0x1cae53[_0x25ae('0x4a')]['ids']['length'];_0x621ff1+=0x1){socket[_0x25ae('0xb5')](_0x25ae('0xb6'),{'UserId':Number(_0x1cae53[_0x25ae('0x4a')][_0x25ae('0x57')][_0x621ff1]),'MailAccountId':Number(_0x1cae53[_0x25ae('0x44')]['id'])});}return _0x46a39d;});}})[_0x25ae('0xc')](respondWithResult(_0x375810,null))[_0x25ae('0x14')](handleError(_0x375810,null));};exports[_0x25ae('0xb7')]=function(_0x138ec3,_0x3fb792){return db[_0x25ae('0x2c')][_0x25ae('0x49')]({'where':{'id':_0x138ec3['params']['id']}})['then'](handleEntityNotFound(_0x3fb792,null))[_0x25ae('0xc')](function(_0x57d06f){if(_0x57d06f){return _0x57d06f[_0x25ae('0xb7')](_0x138ec3[_0x25ae('0x2f')][_0x25ae('0x57')])[_0x25ae('0xc')](function(){if(_[_0x25ae('0xb8')](_0x138ec3[_0x25ae('0x2f')][_0x25ae('0x57')])){for(var _0x5c0c1a=0x0;_0x5c0c1a<_0x138ec3[_0x25ae('0x2f')][_0x25ae('0x57')][_0x25ae('0x35')];_0x5c0c1a+=0x1){socket[_0x25ae('0xb5')]('userMailAccount:remove',{'UserId':Number(_0x138ec3[_0x25ae('0x2f')][_0x25ae('0x57')][_0x5c0c1a]),'MailAccountId':Number(_0x138ec3[_0x25ae('0x44')]['id'])});}}else{socket['emit'](_0x25ae('0xb9'),{'UserId':Number(_0x138ec3['query']['ids']),'MailAccountId':Number(_0x138ec3['params']['id'])});}});}})[_0x25ae('0xc')](respondWithStatusCode(_0x3fb792,null))[_0x25ae('0x14')](handleError(_0x3fb792,null));};exports['getAgents']=function(_0x49e07e,_0x30af54){var _0x57f693={};var _0x2ba7cf={};var _0x389a8e;var _0x4fad91;return db[_0x25ae('0x2c')]['findOne']({'where':{'id':_0x49e07e[_0x25ae('0x44')]['id']}})['then'](handleEntityNotFound(_0x30af54,null))[_0x25ae('0xc')](function(_0x191f4c){if(_0x191f4c){_0x389a8e=_0x191f4c;_0x2ba7cf[_0x25ae('0x33')]=_[_0x25ae('0x30')](db[_0x25ae('0x87')][_0x25ae('0x48')]);_0x2ba7cf[_0x25ae('0x2f')]=_[_0x25ae('0x30')](_0x49e07e[_0x25ae('0x2f')]);_0x2ba7cf[_0x25ae('0x3b')]=_['intersection'](_0x2ba7cf['model'],_0x2ba7cf[_0x25ae('0x2f')]);_0x57f693[_0x25ae('0x32')]=_[_0x25ae('0x31')](_0x2ba7cf[_0x25ae('0x33')],qs['fields'](_0x49e07e[_0x25ae('0x2f')][_0x25ae('0x34')]));_0x57f693['attributes']=_0x57f693[_0x25ae('0x32')][_0x25ae('0x35')]?_0x57f693[_0x25ae('0x32')]:_0x2ba7cf['model'];_0x57f693[_0x25ae('0x38')]=qs[_0x25ae('0x39')](_0x49e07e['query'][_0x25ae('0x39')]);_0x57f693[_0x25ae('0x3a')]=qs[_0x25ae('0x3b')](_[_0x25ae('0x3c')](_0x49e07e[_0x25ae('0x2f')],_0x2ba7cf[_0x25ae('0x3b')]));if(_0x49e07e[_0x25ae('0x2f')][_0x25ae('0x54')]){_0x57f693[_0x25ae('0x3a')]=_[_0x25ae('0x3d')](_0x57f693[_0x25ae('0x3a')],{'$or':_[_0x25ae('0x2b')](_0x57f693[_0x25ae('0x32')],function(_0x56b630){var _0x3af1a7={};_0x3af1a7[_0x56b630]={'$like':'%'+_0x49e07e[_0x25ae('0x2f')][_0x25ae('0x54')]+'%'};return _0x3af1a7;})});}_0x57f693=_['merge']({},_0x57f693,_0x49e07e[_0x25ae('0x3f')]);return _0x389a8e['getAgents'](_0x57f693);}})['then'](function(_0x21f003){if(_0x21f003){_0x4fad91=_0x21f003[_0x25ae('0x35')];if(!_0x49e07e[_0x25ae('0x2f')][_0x25ae('0x36')]('nolimit')){_0x57f693[_0x25ae('0x1a')]=qs['limit'](_0x49e07e[_0x25ae('0x2f')][_0x25ae('0x1a')]);_0x57f693['offset']=qs[_0x25ae('0x18')](_0x49e07e[_0x25ae('0x2f')][_0x25ae('0x18')]);}return _0x389a8e[_0x25ae('0xba')](_0x57f693);}})[_0x25ae('0xc')](function(_0x16cc1f){if(_0x16cc1f){return _0x16cc1f?{'count':_0x4fad91,'rows':_0x16cc1f}:null;}})[_0x25ae('0xc')](respondWithResult(_0x30af54,null))[_0x25ae('0x14')](handleError(_0x30af54,null));}; \ No newline at end of file +var _0xc003=['secure','CloudProviderId','params','update','describe','Disposition','create','hasOwnProperty','nolimit','order','MailAccountId','filter','removeDispositions','ids','addAnswer','CannedAnswer','findOne','pick','removeAnswers','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','outlook.office365.com','Unknown\x20email\x20service\x20provider','smtp.gmail.com','smtp.mail.yahoo.com','smtp-mail.outlook.com','user','username','password','pass','host','port','service','authentication','key','custom','provider','ListId','active','description','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','MailInteraction','addInteraction','omit','getInteractions','CmContact','Contact','User','Owner','fullname','internal','Tag','Tags','tag','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','bulkCreate','priority','finally','getApplications','getMessages','MailMessage','$gte','format','YYYY-MM-DD\x20HH:mm:ss','split','CmList','List','Contacts','CloudProvider','Smtp\x20configuration\x20not\x20found','isNil','from','%s\x20<%s>','email','attachments','join','root','getSmtpOptions','SendMail','sendMail','subject','out','messageId','Interaction','Messages','verifySmtp','VerifySmtp','Sequelize','addAgents','spread','emit','removeAgents','userMailAccount:remove','getAgents','moment','util','path','lodash','ioredis','../../components/parsers/qs','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','jayson/promise','client','http','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','end','status','json','offset','undefined','limit','count','set','destroy','MailAccounts','UserProfileResource','sendStatus','stack','name','send','MailServerIn','Imap','MailServerOut','Pause','mandatoryDispositionPause','map','rawAttributes','model','query','keys','filters','attributes','intersection','fields','length','sort','where','merge','options','MailAccount','includeAll','include','findAll','rows','show','Smtp','find','body','modernAuthentication'];(function(_0x34c8ca,_0x12806d){var _0x25d326=function(_0x5ce300){while(--_0x5ce300){_0x34c8ca['push'](_0x34c8ca['shift']());}};_0x25d326(++_0x12806d);}(_0xc003,0x1dc));var _0x3c00=function(_0x495098,_0x411781){_0x495098=_0x495098-0x0;var _0x27ab66=_0xc003[_0x495098];return _0x27ab66;};'use strict';var moment=require(_0x3c00('0x0'));var BPromise=require('bluebird');var util=require(_0x3c00('0x1'));var path=require(_0x3c00('0x2'));var _=require(_0x3c00('0x3'));var juice=require('juice');var Redis=require(_0x3c00('0x4'));var qs=require(_0x3c00('0x5'));var logger=require('../../config/logger')('api');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x3c00('0x6')]=_[_0x3c00('0x7')](config[_0x3c00('0x6')],{'host':_0x3c00('0x8'),'port':0x18eb});var socket=require(_0x3c00('0x9'))(new Redis(config[_0x3c00('0x6')]));require(_0x3c00('0xa'))['register'](socket);var jayson=require(_0x3c00('0xb'));var client=jayson[_0x3c00('0xc')][_0x3c00('0xd')]({'port':0x232b});function respondWithRpcPromise(_0x3b6836,_0x11b23e,_0x3ff18e,_0x7eca7){return new BPromise(function(_0x4c52ab,_0x555009){var _0x50b4c5=_0x7eca7||client;return _0x50b4c5[_0x3c00('0xe')](_0x3b6836,_0x3ff18e)[_0x3c00('0xf')](function(_0x46d410){logger[_0x3c00('0x10')](_0x3c00('0x11'),_0x11b23e,_0x3c00('0x12'));logger[_0x3c00('0x13')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x11b23e,_0x3c00('0x12'),JSON[_0x3c00('0x14')](_0x46d410));if(_0x46d410[_0x3c00('0x15')]){if(_0x46d410['error'][_0x3c00('0x16')]===0x1f4){logger[_0x3c00('0x15')](_0x3c00('0x11'),_0x11b23e,_0x46d410[_0x3c00('0x15')]['message']);return _0x555009(_0x46d410[_0x3c00('0x15')]['message']);}logger[_0x3c00('0x15')](_0x3c00('0x11'),_0x11b23e,_0x46d410[_0x3c00('0x15')][_0x3c00('0x17')]);return _0x4c52ab(_0x46d410['error']['message']);}else{logger['info'](_0x3c00('0x11'),_0x11b23e,_0x3c00('0x12'));_0x4c52ab(_0x46d410[_0x3c00('0x18')]['message']);}})[_0x3c00('0x19')](function(_0x3b3237){logger[_0x3c00('0x15')](_0x3c00('0x11'),_0x11b23e,_0x3b3237);_0x555009(_0x3b3237);});});}function respondWithStatusCode(_0x254cb4,_0x54909d){_0x54909d=_0x54909d||0xcc;return function(_0x4e6d00){if(_0x4e6d00){return _0x254cb4['sendStatus'](_0x54909d);}return _0x254cb4['status'](_0x54909d)[_0x3c00('0x1a')]();};}function respondWithResult(_0x46b4c0,_0x57be94){_0x57be94=_0x57be94||0xc8;return function(_0x2d5e3d){if(_0x2d5e3d){return _0x46b4c0[_0x3c00('0x1b')](_0x57be94)[_0x3c00('0x1c')](_0x2d5e3d);}};}function respondWithFilteredResult(_0x39c17c,_0x1f4413){return function(_0x2852b6){if(_0x2852b6){var _0x2ed44b=typeof _0x1f4413[_0x3c00('0x1d')]===_0x3c00('0x1e')&&typeof _0x1f4413[_0x3c00('0x1f')]===_0x3c00('0x1e');var _0x28b4dc=_0x2852b6[_0x3c00('0x20')];var _0x2f8162=_0x2ed44b?0x0:_0x1f4413[_0x3c00('0x1d')];var _0x4b142b=_0x2ed44b?_0x2852b6[_0x3c00('0x20')]:_0x1f4413['offset']+_0x1f4413[_0x3c00('0x1f')];var _0x2d52bc;if(_0x4b142b>=_0x28b4dc){_0x4b142b=_0x28b4dc;_0x2d52bc=0xc8;}else{_0x2d52bc=0xce;}_0x39c17c[_0x3c00('0x1b')](_0x2d52bc);return _0x39c17c[_0x3c00('0x21')]('Content-Range',_0x2f8162+'-'+_0x4b142b+'/'+_0x28b4dc)[_0x3c00('0x1c')](_0x2852b6);}return null;};}function saveUpdates(_0x3b6eb7){return function(_0x3fdfc5){if(_0x3fdfc5){return _0x3fdfc5['update'](_0x3b6eb7)[_0x3c00('0xf')](function(_0x4abf1d){return _0x4abf1d;});}return null;};}function removeEntity(_0x57bd3a){return function(_0x4d59d0){if(_0x4d59d0){return _0x4d59d0[_0x3c00('0x22')]()[_0x3c00('0xf')](function(){var _0x2bb773=_0x4d59d0['get']({'plain':!![]});var _0x20ecbe=_0x3c00('0x23');return db[_0x3c00('0x24')][_0x3c00('0x22')]({'where':{'type':_0x20ecbe,'resourceId':_0x2bb773['id']}})['then'](function(){return _0x4d59d0;});})['then'](function(){_0x57bd3a[_0x3c00('0x1b')](0xcc)[_0x3c00('0x1a')]();});}};}function handleEntityNotFound(_0x5b0a8e){return function(_0x18c6cf){if(!_0x18c6cf){_0x5b0a8e[_0x3c00('0x25')](0x194);}return _0x18c6cf;};}function handleError(_0xcb4512,_0x418e72){_0x418e72=_0x418e72||0x1f4;return function(_0x3d1125){logger['error'](_0x3d1125[_0x3c00('0x26')]);if(_0x3d1125[_0x3c00('0x27')]){delete _0x3d1125[_0x3c00('0x27')];}_0xcb4512['status'](_0x418e72)[_0x3c00('0x28')](_0x3d1125);};}exports['index']=function(_0x5b02b0,_0x54d33e){var _0x443853={'include':[{'model':db[_0x3c00('0x29')],'as':_0x3c00('0x2a')},{'model':db[_0x3c00('0x2b')],'as':'Smtp'},{'model':db[_0x3c00('0x2c')],'as':_0x3c00('0x2d')}]},_0x2650a0={},_0x1ed765={'count':0x0,'rows':[]};var _0x2680a1=_[_0x3c00('0x2e')](db['MailAccount'][_0x3c00('0x2f')],function(_0x25a3e5){return{'name':_0x25a3e5['fieldName'],'type':_0x25a3e5['type']['key']};});_0x2650a0[_0x3c00('0x30')]=_[_0x3c00('0x2e')](_0x2680a1,_0x3c00('0x27'));_0x2650a0[_0x3c00('0x31')]=_[_0x3c00('0x32')](_0x5b02b0[_0x3c00('0x31')]);_0x2650a0[_0x3c00('0x33')]=_['intersection'](_0x2650a0[_0x3c00('0x30')],_0x2650a0['query']);_0x443853[_0x3c00('0x34')]=_[_0x3c00('0x35')](_0x2650a0[_0x3c00('0x30')],qs[_0x3c00('0x36')](_0x5b02b0['query'][_0x3c00('0x36')]));_0x443853[_0x3c00('0x34')]=_0x443853[_0x3c00('0x34')][_0x3c00('0x37')]?_0x443853['attributes']:_0x2650a0[_0x3c00('0x30')];if(!_0x5b02b0[_0x3c00('0x31')]['hasOwnProperty']('nolimit')){_0x443853['limit']=qs[_0x3c00('0x1f')](_0x5b02b0[_0x3c00('0x31')][_0x3c00('0x1f')]);_0x443853[_0x3c00('0x1d')]=qs[_0x3c00('0x1d')](_0x5b02b0['query'][_0x3c00('0x1d')]);}_0x443853['order']=qs[_0x3c00('0x38')](_0x5b02b0[_0x3c00('0x31')][_0x3c00('0x38')]);_0x443853['where']=qs[_0x3c00('0x33')](_['pick'](_0x5b02b0[_0x3c00('0x31')],_0x2650a0['filters']),_0x2680a1);if(_0x5b02b0['query']['filter']){_0x443853[_0x3c00('0x39')]=_[_0x3c00('0x3a')](_0x443853['where'],{'$or':_[_0x3c00('0x2e')](_0x2680a1,function(_0x195525){if(_0x195525['type']!=='VIRTUAL'){var _0x1c59a4={};_0x1c59a4[_0x195525['name']]={'$like':'%'+_0x5b02b0['query']['filter']+'%'};return _0x1c59a4;}})});}_0x443853=_[_0x3c00('0x3a')]({},_0x443853,_0x5b02b0[_0x3c00('0x3b')]);var _0x12cc23={'where':_0x443853[_0x3c00('0x39')]};return db[_0x3c00('0x3c')][_0x3c00('0x20')](_0x12cc23)[_0x3c00('0xf')](function(_0x52af71){_0x1ed765[_0x3c00('0x20')]=_0x52af71;if(_0x5b02b0[_0x3c00('0x31')][_0x3c00('0x3d')]){_0x443853[_0x3c00('0x3e')]=[{'all':!![]}];}_0x443853['logging']=!![];return db[_0x3c00('0x3c')][_0x3c00('0x3f')](_0x443853);})[_0x3c00('0xf')](function(_0x58110f){_0x1ed765[_0x3c00('0x40')]=_0x58110f;return _0x1ed765;})[_0x3c00('0xf')](respondWithFilteredResult(_0x54d33e,_0x443853))[_0x3c00('0x19')](handleError(_0x54d33e,null));};exports[_0x3c00('0x41')]=function(_0x17dbb1,_0x3e512a){var _0x626212={'raw':![],'where':{'id':_0x17dbb1['params']['id']},'include':[{'model':db[_0x3c00('0x29')],'as':'Imap'},{'model':db['MailServerOut'],'as':_0x3c00('0x42')},{'model':db[_0x3c00('0x2c')],'as':_0x3c00('0x2d')}]},_0x256fd6={};_0x256fd6['model']=_['keys'](db[_0x3c00('0x3c')][_0x3c00('0x2f')]);_0x256fd6[_0x3c00('0x31')]=_['keys'](_0x17dbb1[_0x3c00('0x31')]);_0x256fd6['filters']=_[_0x3c00('0x35')](_0x256fd6['model'],_0x256fd6[_0x3c00('0x31')]);_0x626212[_0x3c00('0x34')]=_[_0x3c00('0x35')](_0x256fd6[_0x3c00('0x30')],qs[_0x3c00('0x36')](_0x17dbb1[_0x3c00('0x31')]['fields']));_0x626212['attributes']=_0x626212[_0x3c00('0x34')][_0x3c00('0x37')]?_0x626212[_0x3c00('0x34')]:_0x256fd6[_0x3c00('0x30')];if(_0x17dbb1[_0x3c00('0x31')][_0x3c00('0x3d')]){_0x626212[_0x3c00('0x3e')]=[{'all':!![]}];}_0x626212=_[_0x3c00('0x3a')]({},_0x626212,_0x17dbb1[_0x3c00('0x3b')]);return db[_0x3c00('0x3c')][_0x3c00('0x43')](_0x626212)[_0x3c00('0xf')](handleEntityNotFound(_0x3e512a,null))['then'](respondWithResult(_0x3e512a,null))[_0x3c00('0x19')](handleError(_0x3e512a,null));};exports['update']=function(_0x19702c,_0x3be529){if(_0x19702c[_0x3c00('0x44')]['id']){delete _0x19702c[_0x3c00('0x44')]['id'];}if(_0x19702c[_0x3c00('0x44')][_0x3c00('0x2a')]){if(!_0x19702c[_0x3c00('0x44')][_0x3c00('0x2a')][_0x3c00('0x45')]){_0x19702c[_0x3c00('0x44')][_0x3c00('0x2a')]['CloudProviderId']=null;}}if(_0x19702c[_0x3c00('0x44')][_0x3c00('0x42')]){if(_0x19702c[_0x3c00('0x44')][_0x3c00('0x42')][_0x3c00('0x45')]){_0x19702c[_0x3c00('0x44')][_0x3c00('0x42')][_0x3c00('0x46')]=![];}else{_0x19702c[_0x3c00('0x44')][_0x3c00('0x42')][_0x3c00('0x47')]=null;}}return db['MailAccount'][_0x3c00('0x43')]({'where':{'id':_0x19702c[_0x3c00('0x48')]['id']},'include':[{'model':db[_0x3c00('0x29')],'as':_0x3c00('0x2a')},{'model':db['MailServerOut'],'as':'Smtp'},{'model':db[_0x3c00('0x2c')],'as':'mandatoryDispositionPause'}]})[_0x3c00('0xf')](handleEntityNotFound(_0x3be529,null))[_0x3c00('0xf')](saveUpdates(_0x19702c[_0x3c00('0x44')],null))['then'](function(_0x23fd94){if(_0x23fd94&&_0x19702c[_0x3c00('0x44')][_0x3c00('0x2a')]){return db[_0x3c00('0x29')][_0x3c00('0x49')](_0x19702c[_0x3c00('0x44')][_0x3c00('0x2a')],{'where':{'MailAccountId':_0x23fd94['id']}})[_0x3c00('0xf')](function(){return _0x23fd94;});}return _0x23fd94;})[_0x3c00('0xf')](function(_0x140558){if(_0x140558&&_0x19702c[_0x3c00('0x44')]['Smtp']){return db['MailServerOut']['update'](_0x19702c[_0x3c00('0x44')][_0x3c00('0x42')],{'where':{'MailAccountId':_0x140558['id']}})[_0x3c00('0xf')](function(){return _0x140558;});}return _0x140558;})[_0x3c00('0xf')](respondWithResult(_0x3be529,null))[_0x3c00('0x19')](handleError(_0x3be529,null));};exports['describe']=function(_0x305a2e,_0x56c276){return db[_0x3c00('0x3c')][_0x3c00('0x4a')]()[_0x3c00('0xf')](respondWithResult(_0x56c276,null))[_0x3c00('0x19')](handleError(_0x56c276,null));};exports['addDisposition']=function(_0x4d8bf6,_0x571eb1){if(_0x4d8bf6[_0x3c00('0x44')]['id']){delete _0x4d8bf6['body']['id'];}return db['MailAccount']['find']({'where':{'id':_0x4d8bf6['params']['id']}})['then'](handleEntityNotFound(_0x571eb1,null))['then'](function(_0x504774){if(_0x504774){_0x4d8bf6[_0x3c00('0x44')]['MailAccountId']=_0x504774['id'];return db[_0x3c00('0x4b')][_0x3c00('0x4c')](_0x4d8bf6[_0x3c00('0x44')]);}})['then'](respondWithResult(_0x571eb1,null))[_0x3c00('0x19')](handleError(_0x571eb1,null));};exports['getDispositions']=function(_0x39aeb6,_0x1208c1){var _0x3f80a1={'raw':![],'where':{}};var _0x4b3000={};var _0x4d1469={'count':0x0,'rows':[]};return db[_0x3c00('0x3c')]['findOne']({'where':{'id':_0x39aeb6[_0x3c00('0x48')]['id']}})[_0x3c00('0xf')](handleEntityNotFound(_0x1208c1,null))[_0x3c00('0xf')](function(_0x5051ab){if(_0x5051ab){_0x4b3000[_0x3c00('0x30')]=_[_0x3c00('0x32')](db[_0x3c00('0x4b')]['rawAttributes']);_0x4b3000[_0x3c00('0x31')]=_[_0x3c00('0x32')](_0x39aeb6['query']);_0x4b3000[_0x3c00('0x33')]=_['intersection'](_0x4b3000[_0x3c00('0x30')],_0x4b3000['query']);_0x3f80a1[_0x3c00('0x34')]=_[_0x3c00('0x35')](_0x4b3000['model'],qs[_0x3c00('0x36')](_0x39aeb6['query'][_0x3c00('0x36')]));_0x3f80a1[_0x3c00('0x34')]=_0x3f80a1[_0x3c00('0x34')][_0x3c00('0x37')]?_0x3f80a1[_0x3c00('0x34')]:_0x4b3000[_0x3c00('0x30')];if(!_0x39aeb6[_0x3c00('0x31')][_0x3c00('0x4d')](_0x3c00('0x4e'))){_0x3f80a1[_0x3c00('0x1f')]=qs[_0x3c00('0x1f')](_0x39aeb6[_0x3c00('0x31')][_0x3c00('0x1f')]);_0x3f80a1['offset']=qs[_0x3c00('0x1d')](_0x39aeb6[_0x3c00('0x31')][_0x3c00('0x1d')]);}_0x3f80a1[_0x3c00('0x4f')]=qs[_0x3c00('0x38')](_0x39aeb6['query'][_0x3c00('0x38')]);_0x3f80a1[_0x3c00('0x39')]=qs[_0x3c00('0x33')](_['pick'](_0x39aeb6[_0x3c00('0x31')],_0x4b3000['filters']));_0x3f80a1['where'][_0x3c00('0x50')]=_0x5051ab['id'];if(_0x39aeb6[_0x3c00('0x31')][_0x3c00('0x51')]){_0x3f80a1[_0x3c00('0x39')]=_[_0x3c00('0x3a')](_0x3f80a1[_0x3c00('0x39')],{'$or':_['map'](_0x3f80a1[_0x3c00('0x34')],function(_0x3d3e01){var _0x97d847={};_0x97d847[_0x3d3e01]={'$like':'%'+_0x39aeb6[_0x3c00('0x31')][_0x3c00('0x51')]+'%'};return _0x97d847;})});}_0x3f80a1=_[_0x3c00('0x3a')]({},_0x3f80a1,_0x39aeb6[_0x3c00('0x3b')]);return db[_0x3c00('0x4b')][_0x3c00('0x20')]({'where':_0x3f80a1['where']})[_0x3c00('0xf')](function(_0x3b1a95){_0x4d1469[_0x3c00('0x20')]=_0x3b1a95;if(_0x39aeb6[_0x3c00('0x31')]['includeAll']){_0x3f80a1[_0x3c00('0x3e')]=[{'all':!![]}];}return db[_0x3c00('0x4b')][_0x3c00('0x3f')](_0x3f80a1);})['then'](function(_0x370714){_0x4d1469[_0x3c00('0x40')]=_0x370714;return _0x4d1469;});}})[_0x3c00('0xf')](respondWithFilteredResult(_0x1208c1,_0x3f80a1))[_0x3c00('0x19')](handleError(_0x1208c1,null));};exports[_0x3c00('0x52')]=function(_0x228d57,_0x3e0beb){return db['MailAccount'][_0x3c00('0x43')]({'where':{'id':_0x228d57['params']['id']}})[_0x3c00('0xf')](handleEntityNotFound(_0x3e0beb,null))[_0x3c00('0xf')](function(_0x469ef0){if(_0x469ef0){return _0x469ef0[_0x3c00('0x52')](_0x228d57[_0x3c00('0x31')][_0x3c00('0x53')]);}})[_0x3c00('0xf')](respondWithStatusCode(_0x3e0beb,null))[_0x3c00('0x19')](handleError(_0x3e0beb,null));};exports[_0x3c00('0x54')]=function(_0x489d60,_0x425a9d){if(_0x489d60[_0x3c00('0x44')]['id']){delete _0x489d60[_0x3c00('0x44')]['id'];}return db[_0x3c00('0x3c')][_0x3c00('0x43')]({'where':{'id':_0x489d60[_0x3c00('0x48')]['id']}})[_0x3c00('0xf')](handleEntityNotFound(_0x425a9d,null))[_0x3c00('0xf')](function(_0x4d8987){if(_0x4d8987){_0x489d60['body'][_0x3c00('0x50')]=_0x4d8987['id'];return db[_0x3c00('0x55')][_0x3c00('0x4c')](_0x489d60[_0x3c00('0x44')]);}})[_0x3c00('0xf')](respondWithResult(_0x425a9d,null))[_0x3c00('0x19')](handleError(_0x425a9d,null));};exports['getAnswers']=function(_0x2d7a2d,_0x28e066){var _0x58d1df={'raw':![],'where':{}};var _0x52dec6={};var _0xf5b088={'count':0x0,'rows':[]};return db[_0x3c00('0x3c')][_0x3c00('0x56')]({'where':{'id':_0x2d7a2d[_0x3c00('0x48')]['id']}})[_0x3c00('0xf')](handleEntityNotFound(_0x28e066,null))[_0x3c00('0xf')](function(_0x5d0ec1){if(_0x5d0ec1){_0x52dec6[_0x3c00('0x30')]=_[_0x3c00('0x32')](db[_0x3c00('0x55')][_0x3c00('0x2f')]);_0x52dec6[_0x3c00('0x31')]=_['keys'](_0x2d7a2d[_0x3c00('0x31')]);_0x52dec6[_0x3c00('0x33')]=_[_0x3c00('0x35')](_0x52dec6[_0x3c00('0x30')],_0x52dec6['query']);_0x58d1df[_0x3c00('0x34')]=_[_0x3c00('0x35')](_0x52dec6['model'],qs[_0x3c00('0x36')](_0x2d7a2d[_0x3c00('0x31')]['fields']));_0x58d1df[_0x3c00('0x34')]=_0x58d1df[_0x3c00('0x34')][_0x3c00('0x37')]?_0x58d1df[_0x3c00('0x34')]:_0x52dec6['model'];if(!_0x2d7a2d[_0x3c00('0x31')][_0x3c00('0x4d')]('nolimit')){_0x58d1df['limit']=qs[_0x3c00('0x1f')](_0x2d7a2d[_0x3c00('0x31')]['limit']);_0x58d1df[_0x3c00('0x1d')]=qs['offset'](_0x2d7a2d[_0x3c00('0x31')][_0x3c00('0x1d')]);}_0x58d1df['order']=qs[_0x3c00('0x38')](_0x2d7a2d['query'][_0x3c00('0x38')]);_0x58d1df[_0x3c00('0x39')]=qs[_0x3c00('0x33')](_[_0x3c00('0x57')](_0x2d7a2d[_0x3c00('0x31')],_0x52dec6[_0x3c00('0x33')]));_0x58d1df[_0x3c00('0x39')][_0x3c00('0x50')]=_0x5d0ec1['id'];if(_0x2d7a2d[_0x3c00('0x31')][_0x3c00('0x51')]){_0x58d1df['where']=_[_0x3c00('0x3a')](_0x58d1df[_0x3c00('0x39')],{'$or':_[_0x3c00('0x2e')](_0x58d1df[_0x3c00('0x34')],function(_0x223d78){var _0x16818e={};_0x16818e[_0x223d78]={'$like':'%'+_0x2d7a2d[_0x3c00('0x31')]['filter']+'%'};return _0x16818e;})});}_0x58d1df=_['merge']({},_0x58d1df,_0x2d7a2d['options']);return db[_0x3c00('0x55')][_0x3c00('0x20')]({'where':_0x58d1df[_0x3c00('0x39')]})[_0x3c00('0xf')](function(_0x52d67f){_0xf5b088[_0x3c00('0x20')]=_0x52d67f;if(_0x2d7a2d['query']['includeAll']){_0x58d1df[_0x3c00('0x3e')]=[{'all':!![]}];}return db[_0x3c00('0x55')][_0x3c00('0x3f')](_0x58d1df);})['then'](function(_0x5cda){_0xf5b088[_0x3c00('0x40')]=_0x5cda;return _0xf5b088;});}})[_0x3c00('0xf')](respondWithFilteredResult(_0x28e066,_0x58d1df))[_0x3c00('0x19')](handleError(_0x28e066,null));};exports[_0x3c00('0x58')]=function(_0x5c767d,_0x34f305){return db[_0x3c00('0x3c')]['find']({'where':{'id':_0x5c767d['params']['id']}})[_0x3c00('0xf')](handleEntityNotFound(_0x34f305,null))[_0x3c00('0xf')](function(_0x124d3a){if(_0x124d3a){return _0x124d3a[_0x3c00('0x58')](_0x5c767d[_0x3c00('0x31')][_0x3c00('0x53')]);}})['then'](respondWithStatusCode(_0x34f305,null))['catch'](handleError(_0x34f305,null));};function getImapHost(_0x4ec3ba){switch(_0x4ec3ba){case _0x3c00('0x59'):return _0x3c00('0x5a');case _0x3c00('0x5b'):return _0x3c00('0x5c');case _0x3c00('0x5d'):return'imap-mail.outlook.com';case'outlook365':return _0x3c00('0x5e');}throw new Error(_0x3c00('0x5f'),_0x4ec3ba);}function getSmtpHost(_0xe83de2){switch(_0xe83de2){case _0x3c00('0x59'):return _0x3c00('0x60');case'yahoo':return _0x3c00('0x61');case'hotmail':return _0x3c00('0x62');case'outlook365':return'smtp.office365.com';}throw new Error(_0x3c00('0x5f'),_0xe83de2);}function getSmtpPort(_0x3a5489,_0x1d7368){switch(_0x3a5489){case _0x3c00('0x59'):return _0x1d7368===!![]?0x24b:0x1d1;case _0x3c00('0x5b'):return 0x1d1;case _0x3c00('0x5d'):return 0x24b;case'outlook365':return 0x24b;}throw new Error(_0x3c00('0x5f'),_0x3a5489);}function getAuthenticationOptions(_0x59c1f2,_0x27ec94){var _0x22a755={};var _0x15ac3f={};if(_0x59c1f2){_0x22a755[_0x3c00('0x63')]=_0x15ac3f[_0x3c00('0x63')]=_0x27ec94[_0x3c00('0x64')];_0x22a755[_0x3c00('0x65')]=_0x15ac3f[_0x3c00('0x66')]=_0x27ec94[_0x3c00('0x65')];if(_0x27ec94[_0x3c00('0x45')]){_0x22a755[_0x3c00('0x45')]=_0x15ac3f['modernAuthentication']=!![];_0x22a755[_0x3c00('0x47')]=_0x15ac3f[_0x3c00('0x47')]=_0x27ec94[_0x3c00('0x47')];_0x22a755[_0x3c00('0x65')]=_0x15ac3f['pass']=null;}else{_0x22a755[_0x3c00('0x47')]=_0x15ac3f['CloudProviderId']=null;}_0x22a755[_0x3c00('0x67')]=getImapHost(_0x59c1f2);_0x22a755[_0x3c00('0x68')]=0x3e1;_0x15ac3f[_0x3c00('0x67')]=getSmtpHost(_0x59c1f2);_0x15ac3f[_0x3c00('0x68')]=getSmtpPort(_0x59c1f2,_0x15ac3f[_0x3c00('0x46')]);_0x22a755[_0x3c00('0x69')]=_0x15ac3f['service']=null;}else{if(_0x27ec94[_0x3c00('0x6a')]){_0x22a755[_0x3c00('0x63')]=_0x15ac3f[_0x3c00('0x63')]=_0x27ec94[_0x3c00('0x64')];_0x22a755[_0x3c00('0x65')]=_0x15ac3f[_0x3c00('0x66')]=_0x27ec94[_0x3c00('0x65')];}else{_0x22a755[_0x3c00('0x6a')]=_0x15ac3f[_0x3c00('0x6a')]=![];_0x22a755[_0x3c00('0x63')]=_0x15ac3f[_0x3c00('0x63')]=null;_0x22a755[_0x3c00('0x65')]=_0x15ac3f[_0x3c00('0x66')]=null;}_0x22a755[_0x3c00('0x67')]=_0x27ec94[_0x3c00('0x2a')][_0x3c00('0x67')];_0x22a755[_0x3c00('0x68')]=_0x27ec94[_0x3c00('0x2a')][_0x3c00('0x68')];_0x15ac3f[_0x3c00('0x67')]=_0x27ec94[_0x3c00('0x42')][_0x3c00('0x67')];_0x15ac3f[_0x3c00('0x68')]=_0x27ec94[_0x3c00('0x42')][_0x3c00('0x68')];}return{'Imap':_0x22a755,'Smtp':_0x15ac3f};}exports['create']=function(_0x406bd9,_0xa17d0e){var _0x2fe47e={'name':_0x406bd9[_0x3c00('0x44')][_0x3c00('0x27')],'key':_0x406bd9['body'][_0x3c00('0x6b')],'provider':_0x406bd9[_0x3c00('0x44')]['provider']===_0x3c00('0x6c')?null:_0x406bd9['body'][_0x3c00('0x6d')],'email':_0x406bd9[_0x3c00('0x44')]['email'],'ListId':_0x406bd9['body'][_0x3c00('0x6e')],'active':!_['isNil'](_0x406bd9[_0x3c00('0x44')]['active'])?_0x406bd9[_0x3c00('0x44')][_0x3c00('0x6f')]:!![],'description':_0x406bd9['body'][_0x3c00('0x70')]||null};var _0xc40fd8=getAuthenticationOptions(_0x2fe47e[_0x3c00('0x6d')],_0x406bd9[_0x3c00('0x44')]);_0x2fe47e[_0x3c00('0x2a')]=_0xc40fd8[_0x3c00('0x2a')];_0x2fe47e[_0x3c00('0x42')]=_0xc40fd8[_0x3c00('0x42')];return db[_0x3c00('0x3c')]['create'](_0x2fe47e,{'include':[{'model':db[_0x3c00('0x2b')],'as':_0x3c00('0x42')},{'model':db[_0x3c00('0x29')],'as':_0x3c00('0x2a')}]})[_0x3c00('0xf')](function(_0x4eefb7){var _0x38c793=_0x406bd9[_0x3c00('0x63')][_0x3c00('0x71')]({'plain':!![]});if(!_0x38c793)throw new Error(_0x3c00('0x72'));if(_0x38c793['role']==='user'){var _0x233e51=_0x4eefb7[_0x3c00('0x71')]({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':_0x3c00('0x23'),'userProfileId':_0x38c793['userProfileId']},'raw':!![]})[_0x3c00('0xf')](function(_0x1bae2f){if(_0x1bae2f&&_0x1bae2f[_0x3c00('0x73')]===0x0){return db['UserProfileResource'][_0x3c00('0x4c')]({'name':_0x233e51[_0x3c00('0x27')],'resourceId':_0x233e51['id'],'type':_0x1bae2f[_0x3c00('0x27')],'sectionId':_0x1bae2f['id']},{})[_0x3c00('0xf')](function(){return _0x4eefb7;});}else{return _0x4eefb7;}})[_0x3c00('0x19')](function(_0x46840e){logger[_0x3c00('0x15')](_0x3c00('0x74'),_0x46840e);throw _0x46840e;});}return _0x4eefb7;})['then'](respondWithResult(_0xa17d0e,0xc9))[_0x3c00('0x19')](handleError(_0xa17d0e,null));};exports[_0x3c00('0x75')]=function(_0x423936,_0x4af307){return db['MailAccount'][_0x3c00('0x56')]({'where':{'id':_0x423936['params']['id']}})[_0x3c00('0xf')](handleEntityNotFound(_0x4af307,null))[_0x3c00('0xf')](function(_0x294165){if(_0x294165){return _0x294165['getImap']();}return null;})[_0x3c00('0xf')](respondWithResult(_0x4af307,null))[_0x3c00('0x19')](handleError(_0x4af307,null));};exports[_0x3c00('0x76')]=function(_0x4c1d83,_0x12c96e){if(_0x4c1d83['body']['id']){delete _0x4c1d83[_0x3c00('0x44')]['id'];}return db[_0x3c00('0x3c')][_0x3c00('0x43')]({'where':{'id':_0x4c1d83[_0x3c00('0x48')]['id']}})[_0x3c00('0xf')](handleEntityNotFound(_0x12c96e,null))[_0x3c00('0xf')](function(_0x4e4a1d){if(_0x4e4a1d){_0x4c1d83[_0x3c00('0x44')][_0x3c00('0x50')]=_0x4e4a1d['id'];return db[_0x3c00('0x29')][_0x3c00('0x4c')](_0x4c1d83[_0x3c00('0x44')]);}})[_0x3c00('0xf')](respondWithResult(_0x12c96e,null))[_0x3c00('0x19')](handleError(_0x12c96e,null));};exports[_0x3c00('0x77')]=function(_0x4bf360,_0x18c367){return db[_0x3c00('0x3c')][_0x3c00('0x56')]({'where':{'id':_0x4bf360[_0x3c00('0x48')]['id']}})['then'](handleEntityNotFound(_0x18c367,null))['then'](function(_0xdcbf9e){if(_0xdcbf9e){return _0xdcbf9e[_0x3c00('0x78')](null);}return null;})['then'](respondWithStatusCode(_0x18c367,null))[_0x3c00('0x19')](handleError(_0x18c367,null));};exports[_0x3c00('0x79')]=function(_0x2a65a4,_0x3d6630){return db[_0x3c00('0x3c')][_0x3c00('0x56')]({'where':{'id':_0x2a65a4['params']['id']}})[_0x3c00('0xf')](handleEntityNotFound(_0x3d6630,null))['then'](function(_0x2ebd47){if(_0x2ebd47){return _0x2ebd47[_0x3c00('0x79')]();}return null;})[_0x3c00('0xf')](respondWithResult(_0x3d6630,null))['catch'](handleError(_0x3d6630,null));};exports[_0x3c00('0x7a')]=function(_0x11926a,_0x1f824b){if(_0x11926a[_0x3c00('0x44')]['id']){delete _0x11926a[_0x3c00('0x44')]['id'];}return db[_0x3c00('0x3c')][_0x3c00('0x43')]({'where':{'id':_0x11926a[_0x3c00('0x48')]['id']}})['then'](handleEntityNotFound(_0x1f824b,null))[_0x3c00('0xf')](function(_0x37d65e){if(_0x37d65e){_0x11926a[_0x3c00('0x44')][_0x3c00('0x50')]=_0x37d65e['id'];return db[_0x3c00('0x2b')][_0x3c00('0x4c')](_0x11926a['body']);}})[_0x3c00('0xf')](respondWithResult(_0x1f824b,null))[_0x3c00('0x19')](handleError(_0x1f824b,null));};exports[_0x3c00('0x7b')]=function(_0x555c14,_0x16626e){return db[_0x3c00('0x3c')]['findOne']({'where':{'id':_0x555c14['params']['id']}})[_0x3c00('0xf')](handleEntityNotFound(_0x16626e,null))['then'](function(_0x2070b1){if(_0x2070b1){return _0x2070b1[_0x3c00('0x7c')](null);}return null;})['then'](respondWithStatusCode(_0x16626e,null))[_0x3c00('0x19')](handleError(_0x16626e,null));};exports['addInteraction']=function(_0x266251,_0xbb078){return db[_0x3c00('0x7d')][_0x3c00('0x43')]({'where':{'id':_0x266251['params']['id']}})[_0x3c00('0xf')](handleEntityNotFound(_0xbb078,null))[_0x3c00('0xf')](function(_0x2236d1){if(_0x2236d1){return _0x2236d1[_0x3c00('0x7e')](_0x266251[_0x3c00('0x44')]['ids'],_[_0x3c00('0x7f')](_0x266251[_0x3c00('0x44')],['ids','id'])||{});}})[_0x3c00('0xf')](respondWithResult(_0xbb078,null))['catch'](handleError(_0xbb078,null));};exports[_0x3c00('0x80')]=function(_0x2df064,_0x4278bd){var _0x322f2e={'raw':![],'where':{}};var _0x25a82a={};var _0x540f26={'count':0x0,'rows':[]};return db[_0x3c00('0x3c')][_0x3c00('0x56')]({'where':{'id':_0x2df064[_0x3c00('0x48')]['id']}})[_0x3c00('0xf')](handleEntityNotFound(_0x4278bd,null))[_0x3c00('0xf')](function(_0x5926ad){if(_0x5926ad){_0x25a82a[_0x3c00('0x30')]=_[_0x3c00('0x32')](db[_0x3c00('0x7d')][_0x3c00('0x2f')]);_0x25a82a[_0x3c00('0x31')]=_[_0x3c00('0x32')](_0x2df064[_0x3c00('0x31')]);_0x25a82a[_0x3c00('0x33')]=_[_0x3c00('0x35')](_0x25a82a['model'],_0x25a82a[_0x3c00('0x31')]);_0x322f2e[_0x3c00('0x34')]=_[_0x3c00('0x35')](_0x25a82a[_0x3c00('0x30')],qs[_0x3c00('0x36')](_0x2df064[_0x3c00('0x31')][_0x3c00('0x36')]));_0x322f2e[_0x3c00('0x34')]=_0x322f2e[_0x3c00('0x34')][_0x3c00('0x37')]?_0x322f2e['attributes']:_0x25a82a['model'];if(!_0x2df064[_0x3c00('0x31')][_0x3c00('0x4d')](_0x3c00('0x4e'))){_0x322f2e[_0x3c00('0x1f')]=qs[_0x3c00('0x1f')](_0x2df064['query'][_0x3c00('0x1f')]);_0x322f2e[_0x3c00('0x1d')]=qs['offset'](_0x2df064[_0x3c00('0x31')][_0x3c00('0x1d')]);}_0x322f2e[_0x3c00('0x4f')]=qs['sort'](_0x2df064['query'][_0x3c00('0x38')]);_0x322f2e[_0x3c00('0x39')]=qs[_0x3c00('0x33')](_[_0x3c00('0x57')](_0x2df064['query'],_0x25a82a['filters']));_0x322f2e[_0x3c00('0x39')][_0x3c00('0x50')]=_0x5926ad['id'];if(_0x2df064[_0x3c00('0x31')][_0x3c00('0x51')]){_0x322f2e[_0x3c00('0x39')]=_[_0x3c00('0x3a')](_0x322f2e[_0x3c00('0x39')],{'$or':_[_0x3c00('0x2e')](_0x322f2e[_0x3c00('0x34')],function(_0x15eefb){var _0x1f8e8f={};_0x1f8e8f[_0x15eefb]={'$like':'%'+_0x2df064[_0x3c00('0x31')][_0x3c00('0x51')]+'%'};return _0x1f8e8f;})});}_0x322f2e=_['merge']({},_0x322f2e,_0x2df064['options']);return db[_0x3c00('0x7d')][_0x3c00('0x20')]({'where':_0x322f2e[_0x3c00('0x39')]})[_0x3c00('0xf')](function(_0x77beeb){_0x540f26[_0x3c00('0x20')]=_0x77beeb;if(_0x2df064[_0x3c00('0x31')][_0x3c00('0x3d')]){_0x322f2e[_0x3c00('0x3e')]=[{'model':db[_0x3c00('0x81')],'as':_0x3c00('0x82'),'required':![]},{'model':db[_0x3c00('0x83')],'as':_0x3c00('0x84'),'attributes':[_0x3c00('0x27'),_0x3c00('0x85'),_0x3c00('0x86')],'required':![]},{'model':db[_0x3c00('0x87')],'as':_0x3c00('0x88'),'attributes':['id','name','color'],'where':_0x2df064[_0x3c00('0x31')][_0x3c00('0x89')]?{'id':_0x2df064[_0x3c00('0x31')]['tag']}:undefined,'required':_0x2df064[_0x3c00('0x31')][_0x3c00('0x89')]?!![]:![]}];}return db['MailInteraction'][_0x3c00('0x3f')](_0x322f2e);})[_0x3c00('0xf')](function(_0x25aa21){_0x540f26[_0x3c00('0x40')]=_0x25aa21;return _0x540f26;});}})['then'](respondWithFilteredResult(_0x4278bd,_0x322f2e))[_0x3c00('0x19')](handleError(_0x4278bd,null));};exports['addApplications']=function addApplications(_0x1ccef1,_0x1ebf78){var _0x569fd0=_0x1ccef1[_0x3c00('0x48')]['id'];var _0x16b865=_0x1ccef1[_0x3c00('0x44')];var _0x575e9c=0xc8;var _0x3884ad=null;return db[_0x3c00('0x8a')][_0x3c00('0x8b')]({'isolationLevel':db[_0x3c00('0x8a')]['Transaction'][_0x3c00('0x8c')][_0x3c00('0x8d')]},function(_0xc2822a){return db['MailAccount'][_0x3c00('0x56')]({'where':{'id':_0x569fd0},'transaction':_0xc2822a})[_0x3c00('0xf')](function(_0x302420){if(_0x302420){return db[_0x3c00('0x8e')]['destroy']({'where':{'MailAccountId':_0x569fd0},'transaction':_0xc2822a})[_0x3c00('0xf')](function(){var _0x1e6bd7=_[_0x3c00('0x2e')](_0x16b865,function(_0xffd3fd){_0xffd3fd[_0x3c00('0x50')]=_0x569fd0;return _0xffd3fd;});return db[_0x3c00('0x8e')][_0x3c00('0x8f')](_0x1e6bd7,{'transaction':_0xc2822a});});}else{_0x575e9c=0x194;_0x3884ad=[];}});})[_0x3c00('0xf')](function(){if(_0x575e9c!==0x194){return db[_0x3c00('0x8e')]['findAndCountAll']({'where':{'MailAccountId':_0x569fd0},'order':_0x3c00('0x90')})[_0x3c00('0xf')](function(_0x250544){_0x3884ad=_0x250544;});}})[_0x3c00('0x19')](function(_0x502fd2){_0x575e9c=0x1f4;logger[_0x3c00('0x15')](_0x502fd2[_0x3c00('0x26')]);if(_0x502fd2[_0x3c00('0x27')]){delete _0x502fd2['name'];}_0x3884ad=_0x502fd2;})[_0x3c00('0x91')](function(){if(_0x3884ad===null){_0x1ebf78[_0x3c00('0x25')](_0x575e9c);}else{if(_0x575e9c===0x1f4){_0x1ebf78['status'](_0x575e9c)['send'](_0x3884ad);}else{_0x1ebf78[_0x3c00('0x1b')](_0x575e9c)[_0x3c00('0x1c')](_0x3884ad);}}});};exports['getApplications']=function(_0x51680d,_0x251fbb){var _0xb59a15={};var _0x1110be={};var _0x495a4a;var _0x400e94;return db[_0x3c00('0x3c')][_0x3c00('0x56')]({'where':{'id':_0x51680d[_0x3c00('0x48')]['id']}})[_0x3c00('0xf')](handleEntityNotFound(_0x251fbb,null))['then'](function(_0x334321){if(_0x334321){_0x495a4a=_0x334321;_0x1110be[_0x3c00('0x30')]=_['keys'](db['MailApplication'][_0x3c00('0x2f')]);_0x1110be[_0x3c00('0x31')]=_['keys'](_0x51680d[_0x3c00('0x31')]);_0x1110be[_0x3c00('0x33')]=_[_0x3c00('0x35')](_0x1110be[_0x3c00('0x30')],_0x1110be[_0x3c00('0x31')]);_0xb59a15[_0x3c00('0x34')]=_[_0x3c00('0x35')](_0x1110be[_0x3c00('0x30')],qs['fields'](_0x51680d[_0x3c00('0x31')][_0x3c00('0x36')]));_0xb59a15[_0x3c00('0x34')]=_0xb59a15[_0x3c00('0x34')]['length']?_0xb59a15[_0x3c00('0x34')]:_0x1110be[_0x3c00('0x30')];_0xb59a15['order']=qs[_0x3c00('0x38')](_0x51680d['query'][_0x3c00('0x38')]);_0xb59a15[_0x3c00('0x39')]=qs[_0x3c00('0x33')](_['pick'](_0x51680d['query'],_0x1110be[_0x3c00('0x33')]));if(_0x51680d['query'][_0x3c00('0x51')]){_0xb59a15[_0x3c00('0x39')]=_['merge'](_0xb59a15['where'],{'$or':_[_0x3c00('0x2e')](_0xb59a15[_0x3c00('0x34')],function(_0x642f12){var _0x42ee06={};_0x42ee06[_0x642f12]={'$like':'%'+_0x51680d[_0x3c00('0x31')][_0x3c00('0x51')]+'%'};return _0x42ee06;})});}_0xb59a15=_[_0x3c00('0x3a')]({},_0xb59a15,_0x51680d['options']);return _0x495a4a[_0x3c00('0x92')](_0xb59a15);}})['then'](function(_0x1b9bda){if(_0x1b9bda){_0x400e94=_0x1b9bda['length'];if(!_0x51680d['query'][_0x3c00('0x4d')](_0x3c00('0x4e'))){_0xb59a15['limit']=qs[_0x3c00('0x1f')](_0x51680d[_0x3c00('0x31')]['limit']);_0xb59a15[_0x3c00('0x1d')]=qs[_0x3c00('0x1d')](_0x51680d['query']['offset']);}return _0x495a4a[_0x3c00('0x92')](_0xb59a15);}})[_0x3c00('0xf')](function(_0x27ff2a){if(_0x27ff2a){return _0x27ff2a?{'count':_0x400e94,'rows':_0x27ff2a}:null;}})['then'](respondWithResult(_0x251fbb,null))[_0x3c00('0x19')](handleError(_0x251fbb,null));};exports[_0x3c00('0x93')]=function(_0xfe2c48,_0x34bbcf){var _0x1b3cf1={'raw':!![],'where':{}};var _0x2574c3={};var _0x3cda4c={'count':0x0,'rows':[]};return db[_0x3c00('0x3c')][_0x3c00('0x56')]({'where':{'id':_0xfe2c48['params']['id']}})[_0x3c00('0xf')](handleEntityNotFound(_0x34bbcf,null))[_0x3c00('0xf')](function(_0x103a2c){if(_0x103a2c){_0x2574c3[_0x3c00('0x30')]=_[_0x3c00('0x32')](db[_0x3c00('0x94')][_0x3c00('0x2f')]);_0x2574c3[_0x3c00('0x31')]=_[_0x3c00('0x32')](_0xfe2c48[_0x3c00('0x31')]);_0x2574c3[_0x3c00('0x33')]=_[_0x3c00('0x35')](_0x2574c3[_0x3c00('0x30')],_0x2574c3['query']);_0x1b3cf1[_0x3c00('0x34')]=_[_0x3c00('0x35')](_0x2574c3[_0x3c00('0x30')],qs[_0x3c00('0x36')](_0xfe2c48['query'][_0x3c00('0x36')]));_0x1b3cf1[_0x3c00('0x34')]=_0x1b3cf1['attributes']['length']?_0x1b3cf1[_0x3c00('0x34')]:_0x2574c3[_0x3c00('0x30')];if(!_0xfe2c48[_0x3c00('0x31')]['hasOwnProperty']('nolimit')){_0x1b3cf1[_0x3c00('0x1f')]=qs[_0x3c00('0x1f')](_0xfe2c48['query']['limit']);_0x1b3cf1[_0x3c00('0x1d')]=qs[_0x3c00('0x1d')](_0xfe2c48['query'][_0x3c00('0x1d')]);}_0x1b3cf1[_0x3c00('0x4f')]=qs['sort'](_0xfe2c48[_0x3c00('0x31')][_0x3c00('0x38')]);_0x1b3cf1[_0x3c00('0x39')]=qs[_0x3c00('0x33')](_[_0x3c00('0x57')](_0xfe2c48[_0x3c00('0x31')],_0x2574c3[_0x3c00('0x33')]));_0x1b3cf1[_0x3c00('0x39')][_0x3c00('0x50')]=_0x103a2c['id'];if(_0xfe2c48['query'][_0x3c00('0x51')]){_0x1b3cf1['where']=_[_0x3c00('0x3a')](_0x1b3cf1[_0x3c00('0x39')],{'$or':_[_0x3c00('0x2e')](_0x1b3cf1[_0x3c00('0x34')],function(_0x3c90e4){var _0x1febb0={};_0x1febb0[_0x3c90e4]={'$like':'%'+_0xfe2c48['query'][_0x3c00('0x51')]+'%'};return _0x1febb0;})});}if(_0xfe2c48[_0x3c00('0x31')][_0x3c00('0x95')]){var _0x5d23ba=_0xfe2c48['query'][_0x3c00('0x95')]['split'](',');var _0x2ff91d={};_0x2ff91d[_0x5d23ba[0x0]]={'$gte':moment(_0x5d23ba[0x1])[_0x3c00('0x96')](_0x3c00('0x97'))};_0x1b3cf1[_0x3c00('0x39')]=_[_0x3c00('0x3a')](_0x1b3cf1[_0x3c00('0x39')],_0x2ff91d);}_0x1b3cf1=_[_0x3c00('0x3a')]({},_0x1b3cf1,_0xfe2c48['options']);return db[_0x3c00('0x94')][_0x3c00('0x20')]({'where':_0x1b3cf1[_0x3c00('0x39')]})['then'](function(_0x5d8144){_0x3cda4c[_0x3c00('0x20')]=_0x5d8144;if(_0xfe2c48[_0x3c00('0x31')]['includeAll']){_0x1b3cf1[_0x3c00('0x3e')]=[{'all':!![]}];}return db['MailMessage']['findAll'](_0x1b3cf1);})[_0x3c00('0xf')](function(_0x16a297){if(_0xfe2c48[_0x3c00('0x31')]['inlineCss']==='true'){for(var _0x17935b=0x0;_0x17935b<_0x16a297[_0x3c00('0x37')];_0x17935b++){_0x16a297[_0x17935b]['body']=juice(_0x16a297[_0x17935b]['body']);}}_0x3cda4c[_0x3c00('0x40')]=_0x16a297;return _0x3cda4c;});}})['then'](respondWithFilteredResult(_0x34bbcf,_0x1b3cf1))[_0x3c00('0x19')](handleError(_0x34bbcf,null));};exports[_0x3c00('0x28')]=function(_0x571614,_0x324ded){var _0x53967c,_0x13b600={},_0xe391c;if(_0x571614['body']['to']){_0xe391c=_0x571614[_0x3c00('0x44')]['to'][_0x3c00('0x98')](',')[0x0];}return db[_0x3c00('0x3c')][_0x3c00('0x43')]({'where':{'id':_0x571614[_0x3c00('0x48')]['id']},'include':[{'model':db[_0x3c00('0x99')],'as':_0x3c00('0x9a'),'include':[{'model':db[_0x3c00('0x81')],'as':_0x3c00('0x9b'),'where':{'email':_0xe391c},'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0x3c00('0x2b')],'as':'Smtp','raw':!![],'include':[{'model':db[_0x3c00('0x9c')],'as':_0x3c00('0x9c'),'raw':!![]}]}]})[_0x3c00('0xf')](handleEntityNotFound(_0x324ded,null))[_0x3c00('0xf')](function(_0x2d1573){if(!_0x2d1573)return;_0x53967c=_0x2d1573;if(!_0x2d1573['Smtp'])throw new Error(_0x3c00('0x9d'));if(_[_0x3c00('0x9e')](_0x571614[_0x3c00('0x44')][_0x3c00('0x9f')])){_0x571614[_0x3c00('0x44')][_0x3c00('0x9f')]=util[_0x3c00('0x96')](_0x3c00('0xa0'),_0x2d1573[_0x3c00('0x27')],_0x2d1573[_0x3c00('0xa1')]||_0x2d1573[_0x3c00('0x42')][_0x3c00('0x63')]);}if(_0x571614['body'][_0x3c00('0xa2')]&&_0x571614[_0x3c00('0x44')][_0x3c00('0xa2')]['length']){for(var _0x4d21d3=0x0;_0x4d21d3<_0x571614[_0x3c00('0x44')][_0x3c00('0xa2')][_0x3c00('0x37')];_0x4d21d3+=0x1){_0x571614[_0x3c00('0x44')][_0x3c00('0xa2')][_0x4d21d3]={'filename':_0x571614[_0x3c00('0x44')][_0x3c00('0xa2')][_0x4d21d3][_0x3c00('0x27')],'path':path[_0x3c00('0xa3')](config[_0x3c00('0xa4')],'server/files/attachments',_0x571614[_0x3c00('0x44')][_0x3c00('0xa2')][_0x4d21d3]['basename'])};}}var _0x30e63b=_0x2d1573[_0x3c00('0xa5')]();return respondWithRpcPromise(_0x3c00('0xa6'),_0x3c00('0xa7'),{'account':_0x30e63b,'message':_0x571614[_0x3c00('0x44')]});})[_0x3c00('0xf')](function(_0x3a7eb8){if(!_0x3a7eb8)return;_0x13b600=_0x3a7eb8;if(!_0x53967c[_0x3c00('0x9a')])throw new Error('List\x20not\x20found');if(_0x53967c[_0x3c00('0x9a')]['Contacts'][_0x3c00('0x37')])return _0x53967c[_0x3c00('0x9a')][_0x3c00('0x9b')][0x0];return db[_0x3c00('0x81')]['create'](_['defaults'](_0x571614[_0x3c00('0x44')],{'firstName':_0x571614[_0x3c00('0x44')]['to'],'email':_0x571614['body']['to'],'phone':_0x571614[_0x3c00('0x44')]['to'],'ListId':_0x53967c[_0x3c00('0x6e')]}));})[_0x3c00('0xf')](function(_0x470f07){if(!_0x470f07)return;var _0x233b75={'UserId':_0x571614[_0x3c00('0x63')]['id'],'ContactId':_0x470f07['id'],'MailAccountId':_0x53967c['id'],'inReplyTo':_0x13b600['messageId'],'to':_0x571614[_0x3c00('0x44')][_0x3c00('0x9f')],'cc':_0x571614[_0x3c00('0x44')]['cc'],'subject':_0x571614[_0x3c00('0x44')][_0x3c00('0xa8')],'attach':_0x571614[_0x3c00('0x44')]['attach'],'firstMsgDirection':_0x3c00('0xa9'),'lastMsgAt':moment()['format'](_0x3c00('0x97')),'lastMsgDirection':_0x3c00('0xa9'),'Messages':[_['merge'](_0x571614[_0x3c00('0x44')],{'messageId':_0x13b600[_0x3c00('0xaa')],'sentAt':moment()['format'](_0x3c00('0x97')),'read':!![],'MailAccountId':_0x53967c['id'],'UserId':_0x571614[_0x3c00('0x63')]['id'],'ContactId':_0x470f07['id']})]};if(_0x571614[_0x3c00('0x44')]['Interaction']){_0x233b75=_[_0x3c00('0x3a')](_0x233b75,_0x571614[_0x3c00('0x44')][_0x3c00('0xab')]);}return db[_0x3c00('0x7d')][_0x3c00('0x4c')](_0x233b75,{'include':[{'model':db[_0x3c00('0x94')],'as':_0x3c00('0xac')}]});})['then'](respondWithResult(_0x324ded,null))[_0x3c00('0x19')](handleError(_0x324ded,null));};exports[_0x3c00('0xad')]=function(_0x1050a3,_0x32f131){return db[_0x3c00('0x3c')]['find']({'where':{'id':_0x1050a3[_0x3c00('0x48')]['id']},'include':[{'model':db['MailServerOut'],'as':_0x3c00('0x42'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x3c00('0x9c'),'raw':!![]}]}]})['then'](handleEntityNotFound(_0x32f131,null))['then'](function(_0x3cbc2c){if(!_0x3cbc2c[_0x3c00('0x42')])return;var _0x2af19a=_0x3cbc2c[_0x3c00('0xa5')]();return respondWithRpcPromise(_0x3c00('0xae'),_0x3c00('0xad'),{'account':_0x2af19a});})[_0x3c00('0xf')](respondWithResult(_0x32f131,null))[_0x3c00('0x19')](handleError(_0x32f131,null));};exports[_0x3c00('0x22')]=function(_0xdfdb50,_0x5d47ec){return db[_0x3c00('0x3c')][_0x3c00('0x43')]({'where':{'id':_0xdfdb50['params']['id']}})[_0x3c00('0xf')](handleEntityNotFound(_0x5d47ec,null))[_0x3c00('0xf')](function(_0x384e31){if(_0x384e31&&_0x384e31['service']){throw new db[(_0x3c00('0xaf'))]['ValidationError']('You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account');}return _0x384e31;})[_0x3c00('0xf')](removeEntity(_0x5d47ec,null))[_0x3c00('0x19')](handleError(_0x5d47ec,null));};exports[_0x3c00('0xb0')]=function(_0xf53533,_0x5a1712){return db[_0x3c00('0x3c')][_0x3c00('0x43')]({'where':{'id':_0xf53533[_0x3c00('0x48')]['id']}})['then'](handleEntityNotFound(_0x5a1712,null))['then'](function(_0x109834){if(_0x109834){return _0x109834[_0x3c00('0xb0')](_0xf53533[_0x3c00('0x44')][_0x3c00('0x53')],_['omit'](_0xf53533[_0x3c00('0x44')],[_0x3c00('0x53'),'id'])||{})[_0x3c00('0xb1')](function(_0xf0c421){for(var _0xad8a63=0x0;_0xad8a63<_0xf53533[_0x3c00('0x44')]['ids']['length'];_0xad8a63+=0x1){socket[_0x3c00('0xb2')]('userMailAccount:save',{'UserId':Number(_0xf53533[_0x3c00('0x44')][_0x3c00('0x53')][_0xad8a63]),'MailAccountId':Number(_0xf53533[_0x3c00('0x48')]['id'])});}return _0xf0c421;});}})[_0x3c00('0xf')](respondWithResult(_0x5a1712,null))[_0x3c00('0x19')](handleError(_0x5a1712,null));};exports[_0x3c00('0xb3')]=function(_0x88c007,_0x159a97){return db['MailAccount'][_0x3c00('0x43')]({'where':{'id':_0x88c007['params']['id']}})['then'](handleEntityNotFound(_0x159a97,null))[_0x3c00('0xf')](function(_0x5bfd4a){if(_0x5bfd4a){return _0x5bfd4a[_0x3c00('0xb3')](_0x88c007['query'][_0x3c00('0x53')])[_0x3c00('0xf')](function(){if(_['isArray'](_0x88c007['query'][_0x3c00('0x53')])){for(var _0xc602f5=0x0;_0xc602f5<_0x88c007[_0x3c00('0x31')][_0x3c00('0x53')]['length'];_0xc602f5+=0x1){socket[_0x3c00('0xb2')](_0x3c00('0xb4'),{'UserId':Number(_0x88c007[_0x3c00('0x31')][_0x3c00('0x53')][_0xc602f5]),'MailAccountId':Number(_0x88c007[_0x3c00('0x48')]['id'])});}}else{socket[_0x3c00('0xb2')]('userMailAccount:remove',{'UserId':Number(_0x88c007['query'][_0x3c00('0x53')]),'MailAccountId':Number(_0x88c007[_0x3c00('0x48')]['id'])});}});}})['then'](respondWithStatusCode(_0x159a97,null))[_0x3c00('0x19')](handleError(_0x159a97,null));};exports['getAgents']=function(_0x56bbdf,_0xf769a2){var _0x24fa00={};var _0x167233={};var _0x5ef7ab;var _0x591136;return db['MailAccount'][_0x3c00('0x56')]({'where':{'id':_0x56bbdf['params']['id']}})[_0x3c00('0xf')](handleEntityNotFound(_0xf769a2,null))[_0x3c00('0xf')](function(_0x2a16e4){if(_0x2a16e4){_0x5ef7ab=_0x2a16e4;_0x167233[_0x3c00('0x30')]=_[_0x3c00('0x32')](db[_0x3c00('0x83')][_0x3c00('0x2f')]);_0x167233[_0x3c00('0x31')]=_[_0x3c00('0x32')](_0x56bbdf[_0x3c00('0x31')]);_0x167233['filters']=_[_0x3c00('0x35')](_0x167233[_0x3c00('0x30')],_0x167233[_0x3c00('0x31')]);_0x24fa00[_0x3c00('0x34')]=_[_0x3c00('0x35')](_0x167233[_0x3c00('0x30')],qs[_0x3c00('0x36')](_0x56bbdf[_0x3c00('0x31')][_0x3c00('0x36')]));_0x24fa00['attributes']=_0x24fa00[_0x3c00('0x34')][_0x3c00('0x37')]?_0x24fa00[_0x3c00('0x34')]:_0x167233[_0x3c00('0x30')];_0x24fa00[_0x3c00('0x4f')]=qs[_0x3c00('0x38')](_0x56bbdf['query'][_0x3c00('0x38')]);_0x24fa00[_0x3c00('0x39')]=qs['filters'](_[_0x3c00('0x57')](_0x56bbdf[_0x3c00('0x31')],_0x167233[_0x3c00('0x33')]));if(_0x56bbdf['query']['filter']){_0x24fa00[_0x3c00('0x39')]=_[_0x3c00('0x3a')](_0x24fa00[_0x3c00('0x39')],{'$or':_[_0x3c00('0x2e')](_0x24fa00[_0x3c00('0x34')],function(_0x389a8f){var _0x5290cd={};_0x5290cd[_0x389a8f]={'$like':'%'+_0x56bbdf[_0x3c00('0x31')][_0x3c00('0x51')]+'%'};return _0x5290cd;})});}_0x24fa00=_[_0x3c00('0x3a')]({},_0x24fa00,_0x56bbdf[_0x3c00('0x3b')]);return _0x5ef7ab[_0x3c00('0xb5')](_0x24fa00);}})[_0x3c00('0xf')](function(_0x4c4308){if(_0x4c4308){_0x591136=_0x4c4308['length'];if(!_0x56bbdf['query'][_0x3c00('0x4d')](_0x3c00('0x4e'))){_0x24fa00[_0x3c00('0x1f')]=qs['limit'](_0x56bbdf[_0x3c00('0x31')][_0x3c00('0x1f')]);_0x24fa00[_0x3c00('0x1d')]=qs[_0x3c00('0x1d')](_0x56bbdf[_0x3c00('0x31')][_0x3c00('0x1d')]);}return _0x5ef7ab[_0x3c00('0xb5')](_0x24fa00);}})['then'](function(_0x10328a){if(_0x10328a){return _0x10328a?{'count':_0x591136,'rows':_0x10328a}:null;}})[_0x3c00('0xf')](respondWithResult(_0xf769a2,null))[_0x3c00('0x19')](handleError(_0xf769a2,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index aa8ed81..8dc2be6 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 _0x292c=['hook','exports','events','MailAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x33f0e4,_0x2d414a){var _0x543c2e=function(_0x2c6571){while(--_0x2c6571){_0x33f0e4['push'](_0x33f0e4['shift']());}};_0x543c2e(++_0x2d414a);}(_0x292c,0x66));var _0xc292=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0x292c[_0x15bc81];return _0x59440e;};'use strict';var EventEmitter=require(_0xc292('0x0'));var MailAccount=require('../../mysqldb')['db'][_0xc292('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xc292('0x2')](0x0);var events={'afterCreate':_0xc292('0x3'),'afterUpdate':_0xc292('0x4'),'afterDestroy':_0xc292('0x5')};function emitEvent(_0x50b478){return function(_0x1f14f9,_0x536154,_0x516f54){MailAccountEvents[_0xc292('0x6')](_0x50b478+':'+_0x1f14f9['id'],_0x1f14f9);MailAccountEvents[_0xc292('0x6')](_0x50b478,_0x1f14f9);_0x516f54(null);};}for(var e in events){if(events[_0xc292('0x7')](e)){var event=events[e];MailAccount[_0xc292('0x8')](e,emitEvent(event));}}module[_0xc292('0x9')]=MailAccountEvents; \ No newline at end of file +var _0x3912=['../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x36ed3c,_0x44a00a){var _0x52a2e0=function(_0x3f7af9){while(--_0x3f7af9){_0x36ed3c['push'](_0x36ed3c['shift']());}};_0x52a2e0(++_0x44a00a);}(_0x3912,0xa9));var _0x2391=function(_0x590c1f,_0x585eed){_0x590c1f=_0x590c1f-0x0;var _0xd82111=_0x3912[_0x590c1f];return _0xd82111;};'use strict';var EventEmitter=require(_0x2391('0x0'));var MailAccount=require(_0x2391('0x1'))['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x2391('0x2')](0x0);var events={'afterCreate':_0x2391('0x3'),'afterUpdate':_0x2391('0x4'),'afterDestroy':_0x2391('0x5')};function emitEvent(_0x3d9a69){return function(_0x447341,_0x22e7fd,_0x45aea9){MailAccountEvents[_0x2391('0x6')](_0x3d9a69+':'+_0x447341['id'],_0x447341);MailAccountEvents[_0x2391('0x6')](_0x3d9a69,_0x447341);_0x45aea9(null);};}for(var e in events){if(events[_0x2391('0x7')](e)){var event=events[e];MailAccount[_0x2391('0x8')](e,emitEvent(event));}}module[_0x2391('0x9')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 617e9fc..5ddf677 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 _0xc407=['auth','OAuth2','user','pass','exports','mail_accounts','provider','service','host','port','Smtp','authentication','modernAuthentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found'];(function(_0x3bfcdc,_0x31371c){var _0x5e5b02=function(_0x51a445){while(--_0x51a445){_0x3bfcdc['push'](_0x3bfcdc['shift']());}};_0x5e5b02(++_0x31371c);}(_0xc407,0x103));var _0x7c40=function(_0x14490c,_0x50e8ab){_0x14490c=_0x14490c-0x0;var _0x2f6825=_0xc407[_0x14490c];return _0x2f6825;};'use strict';var attributes=require('./mailAccount.attributes');module[_0x7c40('0x0')]=function(_0x515f81){return _0x515f81['define']('MailAccount',attributes,{'tableName':_0x7c40('0x1'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x2e1e9b=this;var _0x12377d={'id':_0x2e1e9b['id'],'tls':{'rejectUnauthorized':![]}};if(_0x2e1e9b[_0x7c40('0x2')]!=='custom'){_0x12377d[_0x7c40('0x3')]=_0x2e1e9b[_0x7c40('0x2')];}else{_0x12377d[_0x7c40('0x4')]=_0x2e1e9b['Smtp']['host'];_0x12377d[_0x7c40('0x5')]=_0x2e1e9b[_0x7c40('0x6')][_0x7c40('0x5')];_0x12377d['secure']=_0x2e1e9b[_0x7c40('0x6')]['secure'];}if(_0x2e1e9b[_0x7c40('0x6')][_0x7c40('0x7')]){if(_0x2e1e9b[_0x7c40('0x6')][_0x7c40('0x8')]){if(!_0x2e1e9b[_0x7c40('0x6')][_0x7c40('0x9')])throw new Error(_0x7c40('0xa'));_0x12377d[_0x7c40('0xb')]={'type':_0x7c40('0xc'),'user':_0x2e1e9b[_0x7c40('0x6')]['user'],'accessToken':_0x2e1e9b[_0x7c40('0x6')][_0x7c40('0x9')]['data5']};}else{_0x12377d[_0x7c40('0xb')]={'user':_0x2e1e9b[_0x7c40('0x6')][_0x7c40('0xd')],'pass':_0x2e1e9b[_0x7c40('0x6')][_0x7c40('0xe')]};}}return _0x12377d;}}});}; \ No newline at end of file +var _0xdfff=['auth','user','data5','pass','exports','define','MailAccount','mail_accounts','provider','custom','service','host','Smtp','port','secure','modernAuthentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found'];(function(_0x2156b1,_0x1d6c41){var _0x22361c=function(_0x5e1473){while(--_0x5e1473){_0x2156b1['push'](_0x2156b1['shift']());}};_0x22361c(++_0x1d6c41);}(_0xdfff,0x112));var _0xfdff=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xdfff[_0x14add3];return _0x4a174f;};'use strict';var attributes=require('./mailAccount.attributes');module[_0xfdff('0x0')]=function(_0x2c910a){return _0x2c910a[_0xfdff('0x1')](_0xfdff('0x2'),attributes,{'tableName':_0xfdff('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x24af16=this;var _0x24150f={'id':_0x24af16['id'],'tls':{'rejectUnauthorized':![]}};if(_0x24af16[_0xfdff('0x4')]!==_0xfdff('0x5')){_0x24150f[_0xfdff('0x6')]=_0x24af16[_0xfdff('0x4')];}else{_0x24150f[_0xfdff('0x7')]=_0x24af16[_0xfdff('0x8')][_0xfdff('0x7')];_0x24150f[_0xfdff('0x9')]=_0x24af16[_0xfdff('0x8')][_0xfdff('0x9')];_0x24150f[_0xfdff('0xa')]=_0x24af16[_0xfdff('0x8')][_0xfdff('0xa')];}if(_0x24af16['Smtp']['authentication']){if(_0x24af16['Smtp'][_0xfdff('0xb')]){if(!_0x24af16['Smtp'][_0xfdff('0xc')])throw new Error(_0xfdff('0xd'));_0x24150f[_0xfdff('0xe')]={'type':'OAuth2','user':_0x24af16['Smtp'][_0xfdff('0xf')],'accessToken':_0x24af16[_0xfdff('0x8')][_0xfdff('0xc')][_0xfdff('0x10')]};}else{_0x24150f[_0xfdff('0xe')]={'user':_0x24af16['Smtp']['user'],'pass':_0x24af16[_0xfdff('0x8')][_0xfdff('0x11')]};}}return _0x24150f;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index cef36ee..2ceda33 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 _0xba34=['MailApplication','MailServerOut','Smtp','CloudProvider','get','omit','Applications','getSmtpOptions','list','applications','orderBy','priority','asc','autoclose','push','length','close','*,*,*,*','Contacts','from','create','List\x20not\x20found','contact','messageId','generate','subject','attach','format','MailInteraction','MailMessage','Messages','inReplyTo','spread','update','YYYY-MM-DD\x20HH:mm:ss','interaction','attachments','originTo','originCc','bcc','ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','Attachment','Attachments','UserId','unshift','agent','name','waitForTheAssignedAgent','Start','startRouting','lodash','moment','bluebird','randomstring','ioredis','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./mailAccount.socket','register','request','then','info','MailAccount,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch','GetMailAccount','findAll','options','raw','where','attributes','limit','include','map','model','stringify','ShowMailAccount','MailAccount','find','setDataValue','smtpOptions','NotifyMailAccount','body','mail','difference','keys','CmContact','rawAttributes','createdAt','updatedAt','CompanyId','ListId','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','DESC'];(function(_0x596754,_0x2c95ce){var _0x563055=function(_0x5b10e7){while(--_0x5b10e7){_0x596754['push'](_0x596754['shift']());}};_0x563055(++_0x2c95ce);}(_0xba34,0x119));var _0x4ba3=function(_0x344e26,_0x54b816){_0x344e26=_0x344e26-0x0;var _0x7feb76=_0xba34[_0x344e26];return _0x7feb76;};'use strict';var _=require(_0x4ba3('0x0'));var moment=require(_0x4ba3('0x1'));var BPromise=require(_0x4ba3('0x2'));var rs=require(_0x4ba3('0x3'));var Redis=require(_0x4ba3('0x4'));var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')('rpc');var config=require(_0x4ba3('0x5'));var jayson=require(_0x4ba3('0x6'));var client=jayson[_0x4ba3('0x7')][_0x4ba3('0x8')]({'port':0x232c});config[_0x4ba3('0x9')]=_[_0x4ba3('0xa')](config[_0x4ba3('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x4ba3('0xb'))(new Redis(config[_0x4ba3('0x9')]));require(_0x4ba3('0xc'))[_0x4ba3('0xd')](socket);function respondWithRpcPromise(_0x380d60,_0xcf1ec3,_0x292f58){return new BPromise(function(_0x3f653c,_0x2ed106){return client[_0x4ba3('0xe')](_0x380d60,_0x292f58)[_0x4ba3('0xf')](function(_0x51edab){logger[_0x4ba3('0x10')](_0x4ba3('0x11'),_0xcf1ec3,'request\x20sent');logger[_0x4ba3('0x12')]('MailAccount,\x20%s,\x20%s,\x20%s',_0xcf1ec3,_0x4ba3('0x13'),JSON['stringify'](_0x51edab));if(_0x51edab[_0x4ba3('0x14')]){if(_0x51edab[_0x4ba3('0x14')][_0x4ba3('0x15')]===0x1f4){logger[_0x4ba3('0x14')](_0x4ba3('0x11'),_0xcf1ec3,_0x51edab[_0x4ba3('0x14')][_0x4ba3('0x16')]);return _0x2ed106(_0x51edab[_0x4ba3('0x14')][_0x4ba3('0x16')]);}logger[_0x4ba3('0x14')](_0x4ba3('0x11'),_0xcf1ec3,_0x51edab[_0x4ba3('0x14')][_0x4ba3('0x16')]);return _0x3f653c(_0x51edab[_0x4ba3('0x14')][_0x4ba3('0x16')]);}else{logger[_0x4ba3('0x10')]('MailAccount,\x20%s,\x20%s',_0xcf1ec3,_0x4ba3('0x13'));_0x3f653c(_0x51edab[_0x4ba3('0x17')][_0x4ba3('0x16')]);}})[_0x4ba3('0x18')](function(_0x556290){logger[_0x4ba3('0x14')](_0x4ba3('0x11'),_0xcf1ec3,_0x556290);_0x2ed106(_0x556290);});});}exports[_0x4ba3('0x19')]=function(_0x1e2ce5){var _0x184332=this;return new Promise(function(_0x125944,_0x4b2791){return db['MailAccount'][_0x4ba3('0x1a')]({'raw':_0x1e2ce5['options']?_0x1e2ce5[_0x4ba3('0x1b')][_0x4ba3('0x1c')]===undefined?!![]:![]:!![],'where':_0x1e2ce5[_0x4ba3('0x1b')]?_0x1e2ce5[_0x4ba3('0x1b')][_0x4ba3('0x1d')]||null:null,'attributes':_0x1e2ce5[_0x4ba3('0x1b')]?_0x1e2ce5['options'][_0x4ba3('0x1e')]||null:null,'limit':_0x1e2ce5[_0x4ba3('0x1b')]?_0x1e2ce5['options'][_0x4ba3('0x1f')]||null:null,'include':_0x1e2ce5['options']?_0x1e2ce5[_0x4ba3('0x1b')][_0x4ba3('0x20')]?_[_0x4ba3('0x21')](_0x1e2ce5[_0x4ba3('0x1b')][_0x4ba3('0x20')],function(_0xe29a49){return{'model':db[_0xe29a49[_0x4ba3('0x22')]],'as':_0xe29a49['as'],'attributes':_0xe29a49[_0x4ba3('0x1e')],'include':_0xe29a49[_0x4ba3('0x20')]?_[_0x4ba3('0x21')](_0xe29a49['include'],function(_0x252f37){return{'model':db[_0x252f37[_0x4ba3('0x22')]],'as':_0x252f37['as'],'attributes':_0x252f37[_0x4ba3('0x1e')],'include':_0x252f37['include']?_[_0x4ba3('0x21')](_0x252f37[_0x4ba3('0x20')],function(_0x44d78c){return{'model':db[_0x44d78c['model']],'as':_0x44d78c['as'],'attributes':_0x44d78c[_0x4ba3('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x4ba3('0xf')](function(_0x34ecb4){logger[_0x4ba3('0x10')]('GetMailAccount',_0x1e2ce5);logger['debug'](_0x4ba3('0x19'),_0x1e2ce5,JSON[_0x4ba3('0x23')](_0x34ecb4));_0x125944(_0x34ecb4);})[_0x4ba3('0x18')](function(_0x19f039){logger[_0x4ba3('0x14')](_0x4ba3('0x19'),_0x19f039['message'],_0x1e2ce5);_0x4b2791(_0x184332[_0x4ba3('0x14')](0x1f4,_0x19f039[_0x4ba3('0x16')]));});});};exports[_0x4ba3('0x24')]=function(_0xbf95b3){var _0x2a6757=this;return new Promise(function(_0x1a7a2c,_0x457236){return db[_0x4ba3('0x25')][_0x4ba3('0x26')]({'raw':_0xbf95b3[_0x4ba3('0x1b')]?_0xbf95b3['options']['raw']===undefined?!![]:![]:!![],'where':_0xbf95b3['options']?_0xbf95b3[_0x4ba3('0x1b')][_0x4ba3('0x1d')]||null:null,'attributes':_0xbf95b3[_0x4ba3('0x1b')]?_0xbf95b3[_0x4ba3('0x1b')][_0x4ba3('0x1e')]||null:null,'include':_0xbf95b3[_0x4ba3('0x1b')]?_0xbf95b3[_0x4ba3('0x1b')][_0x4ba3('0x20')]?_[_0x4ba3('0x21')](_0xbf95b3[_0x4ba3('0x1b')][_0x4ba3('0x20')],function(_0x3439cb){return{'model':db[_0x3439cb['model']],'as':_0x3439cb['as'],'attributes':_0x3439cb[_0x4ba3('0x1e')],'include':_0x3439cb[_0x4ba3('0x20')]?_[_0x4ba3('0x21')](_0x3439cb['include'],function(_0x188f8c){return{'model':db[_0x188f8c['model']],'as':_0x188f8c['as'],'attributes':_0x188f8c[_0x4ba3('0x1e')],'include':_0x188f8c[_0x4ba3('0x20')]?_[_0x4ba3('0x21')](_0x188f8c[_0x4ba3('0x20')],function(_0xf892e1){return{'model':db[_0xf892e1[_0x4ba3('0x22')]],'as':_0xf892e1['as'],'attributes':_0xf892e1['attributes']};}):[]};}):[]};}):[]:[]})[_0x4ba3('0xf')](function(_0x3cf56c){if(_0xbf95b3[_0x4ba3('0x1b')]['smtp']===!![])_0x3cf56c[_0x4ba3('0x27')](_0x4ba3('0x28'),_0x3cf56c['getSmtpOptions']());logger[_0x4ba3('0x10')]('ShowMailAccount',_0xbf95b3);logger['debug'](_0x4ba3('0x24'),_0xbf95b3,JSON[_0x4ba3('0x23')](_0x3cf56c));_0x1a7a2c(_0x3cf56c);})[_0x4ba3('0x18')](function(_0x2b14e1){logger[_0x4ba3('0x14')]('ShowMailAccount',_0x2b14e1[_0x4ba3('0x16')],_0xbf95b3);_0x457236(_0x2a6757[_0x4ba3('0x14')](0x1f4,_0x2b14e1[_0x4ba3('0x16')]));});});};exports[_0x4ba3('0x29')]=function(_0xab7983){var _0x2acc92=this;return new Promise(function(_0x349af4,_0x2577be){var _0x553475={'body':_0xab7983[_0x4ba3('0x2a')],'channel':_0x4ba3('0x2b')};var _0x3cb07f=_[_0x4ba3('0x2c')](_[_0x4ba3('0x2d')](db[_0x4ba3('0x2e')][_0x4ba3('0x2f')]),[_0x4ba3('0x30'),_0x4ba3('0x31'),_0x4ba3('0x32'),_0x4ba3('0x33')]);var _0x1c58d2=![];if(_0xab7983[_0x4ba3('0x2a')]['id']){delete _0xab7983[_0x4ba3('0x2a')]['id'];}if(_['isNil'](_0xab7983['body']['from'])){return _0x2577be(_0x2acc92['error'](0x1f4,'from\x20is\x20mandatory'));}if(_[_0x4ba3('0x34')](_0xab7983['body'][_0x4ba3('0x2a')])||_0xab7983['body'][_0x4ba3('0x2a')]===''){return _0x2577be(_0x2acc92[_0x4ba3('0x14')](0x1f4,_0x4ba3('0x35')));}if(_[_0x4ba3('0x34')](_0xab7983[_0x4ba3('0x2a')]['mapKey'])){return _0x2577be(_0x2acc92[_0x4ba3('0x14')](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3cb07f));}if(!_[_0x4ba3('0x36')](_0x3cb07f,_0xab7983['body'][_0x4ba3('0x37')])){return _0x2577be(_0x2acc92[_0x4ba3('0x14')](0x1f4,_0x4ba3('0x38')+_0x3cb07f));}var _0x261a5e={};_0x261a5e[_0xab7983[_0x4ba3('0x2a')][_0x4ba3('0x37')]]=_0xab7983[_0x4ba3('0x2a')]['from'];return db[_0x4ba3('0x25')][_0x4ba3('0x26')]({'where':{'id':_0xab7983[_0x4ba3('0x39')]['id']},'include':[{'model':db[_0x4ba3('0x3a')],'as':_0x4ba3('0x3b'),'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x261a5e,'limit':0x1,'order':[[_0x4ba3('0x31'),_0x4ba3('0x3c')]]}]},{'model':db[_0x4ba3('0x3d')],'as':'Applications'},{'model':db[_0x4ba3('0x3e')],'as':_0x4ba3('0x3f'),'include':[{'model':db[_0x4ba3('0x40')],'as':'CloudProvider'}]}]})['then'](function(_0x34dc04){if(_0x34dc04&&_0x34dc04['List']){var _0x439acf=_0x34dc04[_0x4ba3('0x41')]({'plain':!![]});_0x553475[_0x4ba3('0x39')]=_[_0x4ba3('0x42')](_0x439acf,[_0x4ba3('0x43'),_0x4ba3('0x3b')]);_0x553475['account'][_0x4ba3('0x28')]=_0x34dc04[_0x4ba3('0x44')]();_0x553475['applications']=_0x439acf[_0x4ba3('0x43')];_0x553475[_0x4ba3('0x45')]=_0x439acf[_0x4ba3('0x3b')];_0x553475[_0x4ba3('0x46')]=_[_0x4ba3('0x47')](_0x553475['applications'],[_0x4ba3('0x48')],[_0x4ba3('0x49')]);if(_0x553475['account']&&_0x553475[_0x4ba3('0x39')][_0x4ba3('0x4a')]){_0x553475[_0x4ba3('0x46')][_0x4ba3('0x4b')]({'id':0x0,'priority':_0x553475[_0x4ba3('0x46')][_0x4ba3('0x4c')]+0x1,'app':_0x4ba3('0x4d'),'appdata':_0x4ba3('0x4a'),'interval':_0x4ba3('0x4e')});}if(_0x553475[_0x4ba3('0x39')][_0x4ba3('0x43')]){delete _0x553475[_0x4ba3('0x39')][_0x4ba3('0x43')];}if(_0x553475[_0x4ba3('0x39')][_0x4ba3('0x3b')]){delete _0x553475['account']['List'];}if(_0x439acf['List'][_0x4ba3('0x4f')][_0x4ba3('0x4c')]){return _0x439acf[_0x4ba3('0x3b')][_0x4ba3('0x4f')][0x0];}var _0x40af1d=_['defaults'](_0xab7983[_0x4ba3('0x2a')],{'firstName':_0xab7983[_0x4ba3('0x2a')][_0x4ba3('0x50')],'ListId':_0x439acf[_0x4ba3('0x33')]});_0x40af1d[_0xab7983[_0x4ba3('0x2a')][_0x4ba3('0x37')]]=_0xab7983[_0x4ba3('0x2a')][_0x4ba3('0x50')];return db[_0x4ba3('0x2e')][_0x4ba3('0x51')](_0x40af1d);}else{throw new Error(_0x4ba3('0x52'));}})[_0x4ba3('0xf')](function(_0x317b9f){_0x553475[_0x4ba3('0x53')]=_0x317b9f;if(_0x317b9f){if(!_0xab7983['body'][_0x4ba3('0x16')][_0x4ba3('0x54')]){_0xab7983[_0x4ba3('0x2a')][_0x4ba3('0x16')][_0x4ba3('0x54')]=rs[_0x4ba3('0x55')]()+'\x20'+_0xab7983[_0x4ba3('0x2a')][_0x4ba3('0x16')]['from'];}var _0x8ea419={'ContactId':_0x317b9f['id'],'MailAccountId':_0xab7983[_0x4ba3('0x39')]['id'],'inReplyTo':_0xab7983[_0x4ba3('0x2a')]['message'][_0x4ba3('0x54')],'to':_0xab7983['body'][_0x4ba3('0x16')][_0x4ba3('0x50')],'cc':_0xab7983[_0x4ba3('0x2a')][_0x4ba3('0x16')]['cc'],'subject':_0xab7983[_0x4ba3('0x2a')]['message'][_0x4ba3('0x56')],'attach':_0xab7983[_0x4ba3('0x2a')][_0x4ba3('0x16')][_0x4ba3('0x57')],'lastMsgAt':moment()[_0x4ba3('0x58')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'};return db[_0x4ba3('0x59')][_0x4ba3('0x26')]({'where':{'closed':![],'MailAccountId':_0xab7983[_0x4ba3('0x39')]['id']},'include':[{'model':db[_0x4ba3('0x5a')],'as':_0x4ba3('0x5b'),'attributes':[_0x4ba3('0x54')],'where':{'messageId':_0xab7983[_0x4ba3('0x2a')][_0x4ba3('0x16')][_0x4ba3('0x5c')]}}]})[_0x4ba3('0xf')](function(_0x1afc5e){if(_0x1afc5e){return[_0x1afc5e,![]];}return db['MailInteraction'][_0x4ba3('0x51')](_0x8ea419)[_0x4ba3('0xf')](function(_0x55c03c){return[_0x55c03c,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x4ba3('0x5d')](function(_0x296bf6,_0x5c7c2f){if(_0x296bf6){_0x1c58d2=_0x5c7c2f;if(!_0x5c7c2f){return _0x296bf6[_0x4ba3('0x5e')]({'inReplyTo':_0xab7983[_0x4ba3('0x2a')][_0x4ba3('0x16')]['messageId'],'to':_0xab7983[_0x4ba3('0x2a')][_0x4ba3('0x16')][_0x4ba3('0x50')],'cc':_0xab7983[_0x4ba3('0x2a')][_0x4ba3('0x16')]['cc'],'subject':_0xab7983[_0x4ba3('0x2a')]['message'][_0x4ba3('0x56')],'attach':_0x296bf6[_0x4ba3('0x57')]?_0x296bf6[_0x4ba3('0x57')]:_0xab7983['body'][_0x4ba3('0x16')][_0x4ba3('0x57')],'substatus':null,'substatusAt':moment()[_0x4ba3('0x58')](_0x4ba3('0x5f')),'lastMsgAt':moment()[_0x4ba3('0x58')](_0x4ba3('0x5f')),'lastMsgDirection':'in'});}else{return _0x296bf6;}}})[_0x4ba3('0xf')](function(_0x424477){_0x553475['interaction']=_0x424477['get']({'plain':!![]});_0x553475[_0x4ba3('0x60')]['created']=_0x1c58d2;return db[_0x4ba3('0x5a')][_0x4ba3('0x51')]({'body':_0xab7983[_0x4ba3('0x2a')]['body'],'MailAccountId':_0xab7983[_0x4ba3('0x39')]['id'],'MailInteractionId':_0x424477['id'],'direction':'in','ContactId':_0x553475[_0x4ba3('0x53')]['id'],'messageId':_0xab7983[_0x4ba3('0x2a')]['message'][_0x4ba3('0x54')],'from':_0xab7983['body'][_0x4ba3('0x16')][_0x4ba3('0x50')],'to':_0xab7983['body'][_0x4ba3('0x16')]['to'],'cc':_0xab7983[_0x4ba3('0x2a')][_0x4ba3('0x16')]['cc'],'subject':_0xab7983[_0x4ba3('0x2a')][_0x4ba3('0x16')][_0x4ba3('0x56')],'attach':_0xab7983[_0x4ba3('0x2a')][_0x4ba3('0x16')][_0x4ba3('0x57')],'Attachments':_0xab7983['body'][_0x4ba3('0x16')][_0x4ba3('0x61')],'originTo':_0xab7983[_0x4ba3('0x2a')][_0x4ba3('0x16')][_0x4ba3('0x62')],'originCc':_0xab7983[_0x4ba3('0x2a')][_0x4ba3('0x16')][_0x4ba3('0x63')],'bcc':_0xab7983[_0x4ba3('0x2a')][_0x4ba3('0x16')][_0x4ba3('0x64')],'ChatWebsiteId':_0xab7983[_0x4ba3('0x2a')]['message'][_0x4ba3('0x65')]||null,'originChannel':_0xab7983[_0x4ba3('0x2a')]['message'][_0x4ba3('0x66')]||_0x4ba3('0x67'),'ChatOfflineMessageId':_0xab7983['body']['message'][_0x4ba3('0x68')]||null},{'include':[{'model':db[_0x4ba3('0x69')],'as':_0x4ba3('0x6a')}]});})[_0x4ba3('0xf')](function(_0x37b966){_0x553475[_0x4ba3('0x16')]=_0x37b966;if(_0x553475[_0x4ba3('0x60')][_0x4ba3('0x6b')]){return db['User'][_0x4ba3('0x26')]({'attributes':['id','name'],'where':{'id':_0x553475[_0x4ba3('0x60')][_0x4ba3('0x6b')]}})[_0x4ba3('0xf')](function(_0x3c3638){if(_0x3c3638){_0x553475[_0x4ba3('0x46')][_0x4ba3('0x6c')]({'id':0x0,'priority':0x0,'app':_0x4ba3('0x6d'),'appdata':_0x3c3638[_0x4ba3('0x6e')]+','+(_0x553475['account'][_0x4ba3('0x6f')]||0xa),'interval':_0x4ba3('0x4e')});}return respondWithRpcPromise(_0x4ba3('0x70'),'startRouting',_0x553475);});}return respondWithRpcPromise(_0x4ba3('0x70'),_0x4ba3('0x71'),_0x553475);})[_0x4ba3('0xf')](function(_0x39d428){_0x349af4(_0x39d428);})[_0x4ba3('0x18')](function(_0x2569bc){_0x2577be(_0x2acc92[_0x4ba3('0x14')](0x1f4,_0x2569bc['message']));});});}; \ No newline at end of file +var _0xdb28=['DESC','MailApplication','Applications','CloudProvider','get','omit','smtpOptions','list','applications','orderBy','priority','asc','autoclose','push','length','*,*,*,*','Contacts','create','messageId','generate','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','inReplyTo','spread','update','subject','interaction','created','contact','attachments','originTo','originCc','bcc','ChatWebsiteId','originChannel','Email','Attachment','UserId','name','unshift','agent','waitForTheAssignedAgent','Start','startRouting','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./mailAccount.socket','register','request','info','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','MailAccount,\x20%s,\x20%s','message','result','catch','GetMailAccount','MailAccount','findAll','options','raw','where','attributes','include','model','map','then','find','smtp','getSmtpOptions','ShowMailAccount','NotifyMailAccount','body','difference','rawAttributes','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','CmContact'];(function(_0x57d92a,_0x5c2c3e){var _0x2a64ec=function(_0x8ac2e2){while(--_0x8ac2e2){_0x57d92a['push'](_0x57d92a['shift']());}};_0x2a64ec(++_0x5c2c3e);}(_0xdb28,0x106));var _0x8db2=function(_0x50be22,_0x5618d9){_0x50be22=_0x50be22-0x0;var _0x42a6e4=_0xdb28[_0x50be22];return _0x42a6e4;};'use strict';var _=require(_0x8db2('0x0'));var moment=require(_0x8db2('0x1'));var BPromise=require(_0x8db2('0x2'));var rs=require(_0x8db2('0x3'));var Redis=require('ioredis');var db=require(_0x8db2('0x4'))['db'];var logger=require(_0x8db2('0x5'))(_0x8db2('0x6'));var config=require(_0x8db2('0x7'));var jayson=require(_0x8db2('0x8'));var client=jayson['client'][_0x8db2('0x9')]({'port':0x232c});config[_0x8db2('0xa')]=_['defaults'](config['redis'],{'host':_0x8db2('0xb'),'port':0x18eb});var socket=require(_0x8db2('0xc'))(new Redis(config[_0x8db2('0xa')]));require(_0x8db2('0xd'))[_0x8db2('0xe')](socket);function respondWithRpcPromise(_0x1ff362,_0x126c78,_0x4ba340){return new BPromise(function(_0x30dc90,_0x476216){return client[_0x8db2('0xf')](_0x1ff362,_0x4ba340)['then'](function(_0x1d9371){logger[_0x8db2('0x10')]('MailAccount,\x20%s,\x20%s',_0x126c78,_0x8db2('0x11'));logger[_0x8db2('0x12')](_0x8db2('0x13'),_0x126c78,_0x8db2('0x11'),JSON[_0x8db2('0x14')](_0x1d9371));if(_0x1d9371['error']){if(_0x1d9371['error'][_0x8db2('0x15')]===0x1f4){logger[_0x8db2('0x16')](_0x8db2('0x17'),_0x126c78,_0x1d9371[_0x8db2('0x16')][_0x8db2('0x18')]);return _0x476216(_0x1d9371[_0x8db2('0x16')][_0x8db2('0x18')]);}logger[_0x8db2('0x16')](_0x8db2('0x17'),_0x126c78,_0x1d9371[_0x8db2('0x16')]['message']);return _0x30dc90(_0x1d9371[_0x8db2('0x16')][_0x8db2('0x18')]);}else{logger['info'](_0x8db2('0x17'),_0x126c78,_0x8db2('0x11'));_0x30dc90(_0x1d9371[_0x8db2('0x19')][_0x8db2('0x18')]);}})[_0x8db2('0x1a')](function(_0x46ce14){logger['error']('MailAccount,\x20%s,\x20%s',_0x126c78,_0x46ce14);_0x476216(_0x46ce14);});});}exports[_0x8db2('0x1b')]=function(_0x104e33){var _0x1310d3=this;return new Promise(function(_0x1b64e4,_0x58562e){return db[_0x8db2('0x1c')][_0x8db2('0x1d')]({'raw':_0x104e33[_0x8db2('0x1e')]?_0x104e33[_0x8db2('0x1e')][_0x8db2('0x1f')]===undefined?!![]:![]:!![],'where':_0x104e33['options']?_0x104e33[_0x8db2('0x1e')][_0x8db2('0x20')]||null:null,'attributes':_0x104e33[_0x8db2('0x1e')]?_0x104e33[_0x8db2('0x1e')][_0x8db2('0x21')]||null:null,'limit':_0x104e33[_0x8db2('0x1e')]?_0x104e33[_0x8db2('0x1e')]['limit']||null:null,'include':_0x104e33[_0x8db2('0x1e')]?_0x104e33['options']['include']?_['map'](_0x104e33['options'][_0x8db2('0x22')],function(_0x29b5cd){return{'model':db[_0x29b5cd[_0x8db2('0x23')]],'as':_0x29b5cd['as'],'attributes':_0x29b5cd[_0x8db2('0x21')],'include':_0x29b5cd[_0x8db2('0x22')]?_[_0x8db2('0x24')](_0x29b5cd['include'],function(_0x3544ba){return{'model':db[_0x3544ba[_0x8db2('0x23')]],'as':_0x3544ba['as'],'attributes':_0x3544ba[_0x8db2('0x21')],'include':_0x3544ba[_0x8db2('0x22')]?_['map'](_0x3544ba[_0x8db2('0x22')],function(_0x11f398){return{'model':db[_0x11f398[_0x8db2('0x23')]],'as':_0x11f398['as'],'attributes':_0x11f398[_0x8db2('0x21')]};}):[]};}):[]};}):[]:[]})[_0x8db2('0x25')](function(_0x21bae5){logger[_0x8db2('0x10')](_0x8db2('0x1b'),_0x104e33);logger[_0x8db2('0x12')]('GetMailAccount',_0x104e33,JSON[_0x8db2('0x14')](_0x21bae5));_0x1b64e4(_0x21bae5);})['catch'](function(_0x59cb77){logger[_0x8db2('0x16')](_0x8db2('0x1b'),_0x59cb77[_0x8db2('0x18')],_0x104e33);_0x58562e(_0x1310d3['error'](0x1f4,_0x59cb77[_0x8db2('0x18')]));});});};exports['ShowMailAccount']=function(_0x3f7aac){var _0x2b653b=this;return new Promise(function(_0x14bd12,_0x4d9e26){return db['MailAccount'][_0x8db2('0x26')]({'raw':_0x3f7aac[_0x8db2('0x1e')]?_0x3f7aac['options']['raw']===undefined?!![]:![]:!![],'where':_0x3f7aac[_0x8db2('0x1e')]?_0x3f7aac[_0x8db2('0x1e')][_0x8db2('0x20')]||null:null,'attributes':_0x3f7aac[_0x8db2('0x1e')]?_0x3f7aac[_0x8db2('0x1e')][_0x8db2('0x21')]||null:null,'include':_0x3f7aac[_0x8db2('0x1e')]?_0x3f7aac[_0x8db2('0x1e')][_0x8db2('0x22')]?_[_0x8db2('0x24')](_0x3f7aac['options'][_0x8db2('0x22')],function(_0x304a72){return{'model':db[_0x304a72['model']],'as':_0x304a72['as'],'attributes':_0x304a72[_0x8db2('0x21')],'include':_0x304a72[_0x8db2('0x22')]?_['map'](_0x304a72['include'],function(_0x3c1983){return{'model':db[_0x3c1983['model']],'as':_0x3c1983['as'],'attributes':_0x3c1983[_0x8db2('0x21')],'include':_0x3c1983[_0x8db2('0x22')]?_[_0x8db2('0x24')](_0x3c1983[_0x8db2('0x22')],function(_0x5cc419){return{'model':db[_0x5cc419[_0x8db2('0x23')]],'as':_0x5cc419['as'],'attributes':_0x5cc419['attributes']};}):[]};}):[]};}):[]:[]})[_0x8db2('0x25')](function(_0xd550ae){if(_0x3f7aac[_0x8db2('0x1e')][_0x8db2('0x27')]===!![])_0xd550ae['setDataValue']('smtpOptions',_0xd550ae[_0x8db2('0x28')]());logger[_0x8db2('0x10')]('ShowMailAccount',_0x3f7aac);logger[_0x8db2('0x12')](_0x8db2('0x29'),_0x3f7aac,JSON[_0x8db2('0x14')](_0xd550ae));_0x14bd12(_0xd550ae);})['catch'](function(_0x152e15){logger[_0x8db2('0x16')](_0x8db2('0x29'),_0x152e15[_0x8db2('0x18')],_0x3f7aac);_0x4d9e26(_0x2b653b[_0x8db2('0x16')](0x1f4,_0x152e15[_0x8db2('0x18')]));});});};exports[_0x8db2('0x2a')]=function(_0x1575ea){var _0x3793a4=this;return new Promise(function(_0x63c561,_0x21cf7c){var _0x20bf0b={'body':_0x1575ea[_0x8db2('0x2b')],'channel':'mail'};var _0x3ee510=_[_0x8db2('0x2c')](_['keys'](db['CmContact'][_0x8db2('0x2d')]),['createdAt',_0x8db2('0x2e'),_0x8db2('0x2f'),_0x8db2('0x30')]);var _0x307783=![];if(_0x1575ea[_0x8db2('0x2b')]['id']){delete _0x1575ea[_0x8db2('0x2b')]['id'];}if(_[_0x8db2('0x31')](_0x1575ea['body'][_0x8db2('0x32')])){return _0x21cf7c(_0x3793a4[_0x8db2('0x16')](0x1f4,_0x8db2('0x33')));}if(_[_0x8db2('0x31')](_0x1575ea['body'][_0x8db2('0x2b')])||_0x1575ea[_0x8db2('0x2b')][_0x8db2('0x2b')]===''){return _0x21cf7c(_0x3793a4[_0x8db2('0x16')](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0x8db2('0x31')](_0x1575ea['body'][_0x8db2('0x34')])){return _0x21cf7c(_0x3793a4[_0x8db2('0x16')](0x1f4,_0x8db2('0x35')+_0x3ee510));}if(!_['includes'](_0x3ee510,_0x1575ea['body'][_0x8db2('0x34')])){return _0x21cf7c(_0x3793a4['error'](0x1f4,_0x8db2('0x36')+_0x3ee510));}var _0x467866={};_0x467866[_0x1575ea[_0x8db2('0x2b')][_0x8db2('0x34')]]=_0x1575ea[_0x8db2('0x2b')][_0x8db2('0x32')];return db[_0x8db2('0x1c')][_0x8db2('0x26')]({'where':{'id':_0x1575ea[_0x8db2('0x37')]['id']},'include':[{'model':db[_0x8db2('0x38')],'as':_0x8db2('0x39'),'include':[{'model':db[_0x8db2('0x3a')],'as':'Contacts','where':_0x467866,'limit':0x1,'order':[[_0x8db2('0x2e'),_0x8db2('0x3b')]]}]},{'model':db[_0x8db2('0x3c')],'as':_0x8db2('0x3d')},{'model':db['MailServerOut'],'as':'Smtp','include':[{'model':db[_0x8db2('0x3e')],'as':_0x8db2('0x3e')}]}]})[_0x8db2('0x25')](function(_0x4c66e5){if(_0x4c66e5&&_0x4c66e5['List']){var _0x494d6e=_0x4c66e5[_0x8db2('0x3f')]({'plain':!![]});_0x20bf0b[_0x8db2('0x37')]=_[_0x8db2('0x40')](_0x494d6e,[_0x8db2('0x3d'),_0x8db2('0x39')]);_0x20bf0b[_0x8db2('0x37')][_0x8db2('0x41')]=_0x4c66e5['getSmtpOptions']();_0x20bf0b['applications']=_0x494d6e[_0x8db2('0x3d')];_0x20bf0b[_0x8db2('0x42')]=_0x494d6e[_0x8db2('0x39')];_0x20bf0b[_0x8db2('0x43')]=_[_0x8db2('0x44')](_0x20bf0b[_0x8db2('0x43')],[_0x8db2('0x45')],[_0x8db2('0x46')]);if(_0x20bf0b[_0x8db2('0x37')]&&_0x20bf0b[_0x8db2('0x37')][_0x8db2('0x47')]){_0x20bf0b[_0x8db2('0x43')][_0x8db2('0x48')]({'id':0x0,'priority':_0x20bf0b[_0x8db2('0x43')][_0x8db2('0x49')]+0x1,'app':'close','appdata':_0x8db2('0x47'),'interval':_0x8db2('0x4a')});}if(_0x20bf0b['account'][_0x8db2('0x3d')]){delete _0x20bf0b[_0x8db2('0x37')][_0x8db2('0x3d')];}if(_0x20bf0b['account'][_0x8db2('0x39')]){delete _0x20bf0b[_0x8db2('0x37')][_0x8db2('0x39')];}if(_0x494d6e[_0x8db2('0x39')][_0x8db2('0x4b')]['length']){return _0x494d6e[_0x8db2('0x39')][_0x8db2('0x4b')][0x0];}var _0x469bc2=_['defaults'](_0x1575ea[_0x8db2('0x2b')],{'firstName':_0x1575ea[_0x8db2('0x2b')][_0x8db2('0x32')],'ListId':_0x494d6e[_0x8db2('0x30')]});_0x469bc2[_0x1575ea[_0x8db2('0x2b')][_0x8db2('0x34')]]=_0x1575ea[_0x8db2('0x2b')]['from'];return db[_0x8db2('0x3a')][_0x8db2('0x4c')](_0x469bc2);}else{throw new Error('List\x20not\x20found');}})[_0x8db2('0x25')](function(_0x1683b8){_0x20bf0b['contact']=_0x1683b8;if(_0x1683b8){if(!_0x1575ea[_0x8db2('0x2b')][_0x8db2('0x18')][_0x8db2('0x4d')]){_0x1575ea[_0x8db2('0x2b')][_0x8db2('0x18')][_0x8db2('0x4d')]=rs[_0x8db2('0x4e')]()+'\x20'+_0x1575ea[_0x8db2('0x2b')][_0x8db2('0x18')][_0x8db2('0x32')];}var _0x12fd12={'ContactId':_0x1683b8['id'],'MailAccountId':_0x1575ea[_0x8db2('0x37')]['id'],'inReplyTo':_0x1575ea[_0x8db2('0x2b')][_0x8db2('0x18')][_0x8db2('0x4d')],'to':_0x1575ea[_0x8db2('0x2b')]['message'][_0x8db2('0x32')],'cc':_0x1575ea[_0x8db2('0x2b')][_0x8db2('0x18')]['cc'],'subject':_0x1575ea[_0x8db2('0x2b')][_0x8db2('0x18')]['subject'],'attach':_0x1575ea[_0x8db2('0x2b')][_0x8db2('0x18')][_0x8db2('0x4f')],'lastMsgAt':moment()[_0x8db2('0x50')](_0x8db2('0x51')),'lastMsgDirection':'in'};return db[_0x8db2('0x52')][_0x8db2('0x26')]({'where':{'closed':![],'MailAccountId':_0x1575ea[_0x8db2('0x37')]['id']},'include':[{'model':db[_0x8db2('0x53')],'as':_0x8db2('0x54'),'attributes':[_0x8db2('0x4d')],'where':{'messageId':_0x1575ea[_0x8db2('0x2b')][_0x8db2('0x18')][_0x8db2('0x55')]}}]})[_0x8db2('0x25')](function(_0x270fc0){if(_0x270fc0){return[_0x270fc0,![]];}return db[_0x8db2('0x52')][_0x8db2('0x4c')](_0x12fd12)['then'](function(_0x3273dd){return[_0x3273dd,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x8db2('0x56')](function(_0x570c53,_0x3de11e){if(_0x570c53){_0x307783=_0x3de11e;if(!_0x3de11e){return _0x570c53[_0x8db2('0x57')]({'inReplyTo':_0x1575ea[_0x8db2('0x2b')][_0x8db2('0x18')][_0x8db2('0x4d')],'to':_0x1575ea['body']['message'][_0x8db2('0x32')],'cc':_0x1575ea[_0x8db2('0x2b')][_0x8db2('0x18')]['cc'],'subject':_0x1575ea[_0x8db2('0x2b')][_0x8db2('0x18')][_0x8db2('0x58')],'attach':_0x570c53[_0x8db2('0x4f')]?_0x570c53[_0x8db2('0x4f')]:_0x1575ea['body'][_0x8db2('0x18')][_0x8db2('0x4f')],'substatus':null,'substatusAt':moment()[_0x8db2('0x50')](_0x8db2('0x51')),'lastMsgAt':moment()[_0x8db2('0x50')](_0x8db2('0x51')),'lastMsgDirection':'in'});}else{return _0x570c53;}}})[_0x8db2('0x25')](function(_0x20caf0){_0x20bf0b['interaction']=_0x20caf0['get']({'plain':!![]});_0x20bf0b[_0x8db2('0x59')][_0x8db2('0x5a')]=_0x307783;return db[_0x8db2('0x53')][_0x8db2('0x4c')]({'body':_0x1575ea[_0x8db2('0x2b')]['body'],'MailAccountId':_0x1575ea['account']['id'],'MailInteractionId':_0x20caf0['id'],'direction':'in','ContactId':_0x20bf0b[_0x8db2('0x5b')]['id'],'messageId':_0x1575ea[_0x8db2('0x2b')]['message'][_0x8db2('0x4d')],'from':_0x1575ea[_0x8db2('0x2b')][_0x8db2('0x18')]['from'],'to':_0x1575ea[_0x8db2('0x2b')][_0x8db2('0x18')]['to'],'cc':_0x1575ea[_0x8db2('0x2b')]['message']['cc'],'subject':_0x1575ea[_0x8db2('0x2b')][_0x8db2('0x18')][_0x8db2('0x58')],'attach':_0x1575ea[_0x8db2('0x2b')][_0x8db2('0x18')]['attach'],'Attachments':_0x1575ea[_0x8db2('0x2b')][_0x8db2('0x18')][_0x8db2('0x5c')],'originTo':_0x1575ea['body']['message'][_0x8db2('0x5d')],'originCc':_0x1575ea[_0x8db2('0x2b')]['message'][_0x8db2('0x5e')],'bcc':_0x1575ea[_0x8db2('0x2b')][_0x8db2('0x18')][_0x8db2('0x5f')],'ChatWebsiteId':_0x1575ea[_0x8db2('0x2b')][_0x8db2('0x18')][_0x8db2('0x60')]||null,'originChannel':_0x1575ea[_0x8db2('0x2b')][_0x8db2('0x18')][_0x8db2('0x61')]||_0x8db2('0x62'),'ChatOfflineMessageId':_0x1575ea[_0x8db2('0x2b')][_0x8db2('0x18')]['ChatOfflineMessageId']||null},{'include':[{'model':db[_0x8db2('0x63')],'as':'Attachments'}]});})[_0x8db2('0x25')](function(_0x3015ab){_0x20bf0b['message']=_0x3015ab;if(_0x20bf0b[_0x8db2('0x59')][_0x8db2('0x64')]){return db['User'][_0x8db2('0x26')]({'attributes':['id',_0x8db2('0x65')],'where':{'id':_0x20bf0b[_0x8db2('0x59')][_0x8db2('0x64')]}})[_0x8db2('0x25')](function(_0x31a095){if(_0x31a095){_0x20bf0b[_0x8db2('0x43')][_0x8db2('0x66')]({'id':0x0,'priority':0x0,'app':_0x8db2('0x67'),'appdata':_0x31a095['name']+','+(_0x20bf0b['account'][_0x8db2('0x68')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x8db2('0x69'),_0x8db2('0x6a'),_0x20bf0b);});}return respondWithRpcPromise(_0x8db2('0x69'),'startRouting',_0x20bf0b);})[_0x8db2('0x25')](function(_0x9675c1){_0x63c561(_0x9675c1);})[_0x8db2('0x1a')](function(_0x591c5d){_0x21cf7c(_0x3793a4[_0x8db2('0x16')](0x1f4,_0x591c5d[_0x8db2('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 267f197..c056ebd 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 _0x9c00=['register','length','mailAccount:','./mailAccount.events','save','emit','removeListener'];(function(_0xe6d797,_0x46fdd9){var _0x59828c=function(_0x5acf4e){while(--_0x5acf4e){_0xe6d797['push'](_0xe6d797['shift']());}};_0x59828c(++_0x46fdd9);}(_0x9c00,0x1a0));var _0x09c0=function(_0x597c16,_0x2292fe){_0x597c16=_0x597c16-0x0;var _0x30cc2c=_0x9c00[_0x597c16];return _0x30cc2c;};'use strict';var MailAccountEvents=require(_0x09c0('0x0'));var events=[_0x09c0('0x1'),'remove','update'];function createListener(_0xe0d293,_0x8c9907){return function(_0x5d1967){_0x8c9907[_0x09c0('0x2')](_0xe0d293,_0x5d1967);};}function removeListener(_0x2c702c,_0x2ed715){return function(){MailAccountEvents[_0x09c0('0x3')](_0x2c702c,_0x2ed715);};}exports[_0x09c0('0x4')]=function(_0x5914eb){for(var _0x4d5fc3=0x0,_0x1f3d7e=events[_0x09c0('0x5')];_0x4d5fc3<_0x1f3d7e;_0x4d5fc3++){var _0x1b633b=events[_0x4d5fc3];var _0x3187aa=createListener(_0x09c0('0x6')+_0x1b633b,_0x5914eb);MailAccountEvents['on'](_0x1b633b,_0x3187aa);}}; \ No newline at end of file +var _0x8d44=['register','length','mailAccount:','./mailAccount.events','save','update','removeListener'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0x8d44,0x161));var _0x48d4=function(_0x1c8172,_0xb2959a){_0x1c8172=_0x1c8172-0x0;var _0x263664=_0x8d44[_0x1c8172];return _0x263664;};'use strict';var MailAccountEvents=require(_0x48d4('0x0'));var events=[_0x48d4('0x1'),'remove',_0x48d4('0x2')];function createListener(_0x1a6d24,_0x174135){return function(_0x3a7d36){_0x174135['emit'](_0x1a6d24,_0x3a7d36);};}function removeListener(_0x3fa84d,_0x5e5d76){return function(){MailAccountEvents[_0x48d4('0x3')](_0x3fa84d,_0x5e5d76);};}exports[_0x48d4('0x4')]=function(_0x4c7a24){for(var _0x32354d=0x0,_0x1b5f1b=events[_0x48d4('0x5')];_0x32354d<_0x1b5f1b;_0x32354d++){var _0x580d25=events[_0x32354d];var _0x17d57c=createListener(_0x48d4('0x6')+_0x580d25,_0x4c7a24);MailAccountEvents['on'](_0x580d25,_0x17d57c);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 2c34826..9c002da 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 _0x408d=['connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailApplication.controller','get','/:id','show','put','isAuthenticated','delete','destroy','multer','path'];(function(_0x5cfdd8,_0x27555c){var _0x4fd729=function(_0x27239c){while(--_0x27239c){_0x5cfdd8['push'](_0x5cfdd8['shift']());}};_0x4fd729(++_0x27555c);}(_0x408d,0x175));var _0xd408=function(_0x5e570c,_0x233990){_0x5e570c=_0x5e570c-0x0;var _0xc62527=_0x408d[_0x5e570c];return _0xc62527;};'use strict';var multer=require(_0xd408('0x0'));var util=require('util');var path=require(_0xd408('0x1'));var timeout=require(_0xd408('0x2'));var express=require('express');var router=express[_0xd408('0x3')]();var fs_extra=require(_0xd408('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xd408('0x5'));var config=require(_0xd408('0x6'));var controller=require(_0xd408('0x7'));router[_0xd408('0x8')](_0xd408('0x9'),auth['isAuthenticated'](),controller[_0xd408('0xa')]);router[_0xd408('0xb')](_0xd408('0x9'),auth[_0xd408('0xc')](),controller['update']);router[_0xd408('0xd')](_0xd408('0x9'),auth[_0xd408('0xc')](),controller[_0xd408('0xe')]);module['exports']=router; \ No newline at end of file +var _0x1bf3=['delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./mailApplication.controller','get','isAuthenticated','show','put','/:id'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x1bf3,0x182));var _0x31bf=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x1bf3[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x31bf('0x0'));var util=require(_0x31bf('0x1'));var path=require('path');var timeout=require(_0x31bf('0x2'));var express=require(_0x31bf('0x3'));var router=express[_0x31bf('0x4')]();var fs_extra=require(_0x31bf('0x5'));var auth=require(_0x31bf('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x31bf('0x7'));var controller=require(_0x31bf('0x8'));router[_0x31bf('0x9')]('/:id',auth[_0x31bf('0xa')](),controller[_0x31bf('0xb')]);router[_0x31bf('0xc')](_0x31bf('0xd'),auth[_0x31bf('0xa')](),controller['update']);router[_0x31bf('0xe')](_0x31bf('0xd'),auth[_0x31bf('0xa')](),controller['destroy']);module[_0x31bf('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 912b32d..8bd4e8e 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 _0xa366=['INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize','exports'];(function(_0x53c07d,_0x454e3e){var _0x2a6ec4=function(_0x439f72){while(--_0x439f72){_0x53c07d['push'](_0x53c07d['shift']());}};_0x2a6ec4(++_0x454e3e);}(_0xa366,0x1b0));var _0x6a36=function(_0x4948bd,_0x126fb4){_0x4948bd=_0x4948bd-0x0;var _0x3024ee=_0xa366[_0x4948bd];return _0x3024ee;};'use strict';var Sequelize=require(_0x6a36('0x0'));module[_0x6a36('0x1')]={'priority':{'type':Sequelize[_0x6a36('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x6a36('0x3')],'allowNull':![],'defaultValue':_0x6a36('0x4')},'appdata':{'type':Sequelize[_0x6a36('0x5')]()},'description':{'type':Sequelize[_0x6a36('0x3')]},'interval':{'type':Sequelize[_0x6a36('0x3')],'defaultValue':_0x6a36('0x6')}}; \ No newline at end of file +var _0x2b2f=['STRING','noop','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x18e471,_0x1abfd7){var _0x35df73=function(_0x3e57b3){while(--_0x3e57b3){_0x18e471['push'](_0x18e471['shift']());}};_0x35df73(++_0x1abfd7);}(_0x2b2f,0xe7));var _0xf2b2=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x2b2f[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require(_0xf2b2('0x0'));module[_0xf2b2('0x1')]={'priority':{'type':Sequelize[_0xf2b2('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xf2b2('0x3')],'allowNull':![],'defaultValue':_0xf2b2('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xf2b2('0x3')]},'interval':{'type':Sequelize[_0xf2b2('0x3')],'defaultValue':_0xf2b2('0x5')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index aeb4489..c7c5744 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 _0xb43b=['name','status','send','show','params','keys','MailApplication','rawAttributes','query','intersection','model','fields','attributes','length','includeAll','merge','options','find','then','catch','body','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','undefined','count','offset','limit','set','Content-Range','json','apply','reject','update','destroy','sendStatus'];(function(_0x309768,_0x1daf54){var _0x34136d=function(_0x5d29e2){while(--_0x5d29e2){_0x309768['push'](_0x309768['shift']());}};_0x34136d(++_0x1daf54);}(_0xb43b,0x1b2));var _0xbb43=function(_0x2e207a,_0x91aef2){_0x2e207a=_0x2e207a-0x0;var _0x18ad79=_0xb43b[_0x2e207a];return _0x18ad79;};'use strict';var emlformat=require(_0xbb43('0x0'));var rimraf=require(_0xbb43('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbb43('0x2'));var rp=require(_0xbb43('0x3'));var moment=require(_0xbb43('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xbb43('0x5'));var util=require(_0xbb43('0x6'));var path=require(_0xbb43('0x7'));var sox=require(_0xbb43('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbb43('0x9'));var _=require('lodash');var squel=require(_0xbb43('0xa'));var crypto=require(_0xbb43('0xb'));var jsforce=require(_0xbb43('0xc'));var deskjs=require(_0xbb43('0xd'));var toCsv=require(_0xbb43('0xe'));var querystring=require('querystring');var Papa=require(_0xbb43('0xf'));var Redis=require(_0xbb43('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xbb43('0x11'));var as=require(_0xbb43('0x12'));var hardwareService=require(_0xbb43('0x13'));var logger=require(_0xbb43('0x14'))(_0xbb43('0x15'));var utils=require(_0xbb43('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xbb43('0x17'));var db=require(_0xbb43('0x18'))['db'];function respondWithStatusCode(_0x50e2c0,_0x578392){_0x578392=_0x578392||0xcc;return function(_0x41e7e5){if(_0x41e7e5){return _0x50e2c0['sendStatus'](_0x578392);}return _0x50e2c0['status'](_0x578392)[_0xbb43('0x19')]();};}function respondWithResult(_0x5a509f,_0x68d45d){_0x68d45d=_0x68d45d||0xc8;return function(_0x43021d){if(_0x43021d){return _0x5a509f['status'](_0x68d45d)['json'](_0x43021d);}};}function respondWithFilteredResult(_0x4d5bcf,_0x338120){return function(_0x2abce0){if(_0x2abce0){var _0x57bd1d=typeof _0x338120['offset']===_0xbb43('0x1a')&&typeof _0x338120['limit']==='undefined';var _0x2b0797=_0x2abce0[_0xbb43('0x1b')];var _0x2e3b43=_0x57bd1d?0x0:_0x338120['offset'];var _0x1c16d7=_0x57bd1d?_0x2abce0['count']:_0x338120[_0xbb43('0x1c')]+_0x338120[_0xbb43('0x1d')];var _0x4dfc54;if(_0x1c16d7>=_0x2b0797){_0x1c16d7=_0x2b0797;_0x4dfc54=0xc8;}else{_0x4dfc54=0xce;}_0x4d5bcf['status'](_0x4dfc54);return _0x4d5bcf[_0xbb43('0x1e')](_0xbb43('0x1f'),_0x2e3b43+'-'+_0x1c16d7+'/'+_0x2b0797)[_0xbb43('0x20')](_0x2abce0);}return null;};}function patchUpdates(_0x2bf2d4){return function(_0x5bcce7){try{jsonpatch[_0xbb43('0x21')](_0x5bcce7,_0x2bf2d4,!![]);}catch(_0x5f4416){return BPromise[_0xbb43('0x22')](_0x5f4416);}return _0x5bcce7['save']();};}function saveUpdates(_0x2f5e31,_0x565256){return function(_0x3f323e){if(_0x3f323e){return _0x3f323e[_0xbb43('0x23')](_0x2f5e31)['then'](function(_0x1d0768){return _0x1d0768;});}return null;};}function removeEntity(_0x4dfb7f,_0xf24e60){return function(_0x298ce2){if(_0x298ce2){return _0x298ce2[_0xbb43('0x24')]()['then'](function(){_0x4dfb7f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x269ca5,_0x32d7f0){return function(_0x5d8310){if(!_0x5d8310){_0x269ca5[_0xbb43('0x25')](0x194);}return _0x5d8310;};}function handleError(_0x2da653,_0x226827){_0x226827=_0x226827||0x1f4;return function(_0x3874fb){logger['error'](_0x3874fb['stack']);if(_0x3874fb[_0xbb43('0x26')]){delete _0x3874fb[_0xbb43('0x26')];}_0x2da653[_0xbb43('0x27')](_0x226827)[_0xbb43('0x28')](_0x3874fb);};}exports[_0xbb43('0x29')]=function(_0x40b04b,_0x21d386){var _0x473828={'raw':!![],'where':{'id':_0x40b04b[_0xbb43('0x2a')]['id']}},_0x539730={};_0x539730['model']=_[_0xbb43('0x2b')](db[_0xbb43('0x2c')][_0xbb43('0x2d')]);_0x539730[_0xbb43('0x2e')]=_['keys'](_0x40b04b[_0xbb43('0x2e')]);_0x539730['filters']=_['intersection'](_0x539730['model'],_0x539730[_0xbb43('0x2e')]);_0x473828['attributes']=_[_0xbb43('0x2f')](_0x539730[_0xbb43('0x30')],qs[_0xbb43('0x31')](_0x40b04b['query'][_0xbb43('0x31')]));_0x473828[_0xbb43('0x32')]=_0x473828[_0xbb43('0x32')][_0xbb43('0x33')]?_0x473828[_0xbb43('0x32')]:_0x539730[_0xbb43('0x30')];if(_0x40b04b[_0xbb43('0x2e')][_0xbb43('0x34')]){_0x473828['include']=[{'all':!![]}];}_0x473828=_[_0xbb43('0x35')]({},_0x473828,_0x40b04b[_0xbb43('0x36')]);return db[_0xbb43('0x2c')][_0xbb43('0x37')](_0x473828)[_0xbb43('0x38')](handleEntityNotFound(_0x21d386,null))[_0xbb43('0x38')](respondWithResult(_0x21d386,null))[_0xbb43('0x39')](handleError(_0x21d386,null));};exports[_0xbb43('0x23')]=function(_0x349a83,_0x57105c){if(_0x349a83[_0xbb43('0x3a')]['id']){delete _0x349a83[_0xbb43('0x3a')]['id'];}return db[_0xbb43('0x2c')][_0xbb43('0x37')]({'where':{'id':_0x349a83[_0xbb43('0x2a')]['id']}})[_0xbb43('0x38')](handleEntityNotFound(_0x57105c,null))['then'](saveUpdates(_0x349a83[_0xbb43('0x3a')],null))[_0xbb43('0x38')](respondWithResult(_0x57105c,null))['catch'](handleError(_0x57105c,null));};exports[_0xbb43('0x24')]=function(_0x2c9a7c,_0x11d384){return db['MailApplication']['find']({'where':{'id':_0x2c9a7c['params']['id']}})[_0xbb43('0x38')](handleEntityNotFound(_0x11d384,null))[_0xbb43('0x38')](removeEntity(_0x11d384,null))['catch'](handleError(_0x11d384,null));}; \ No newline at end of file +var _0x70e0=['util','sox','ejs','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','count','limit','set','apply','save','update','then','error','stack','name','send','show','model','keys','MailApplication','query','filters','attributes','intersection','length','includeAll','include','find','catch','body','params','eml-format','rimraf','zip-dir','moment','bluebird','mustache'];(function(_0x98ac1f,_0x2effb0){var _0x1579d1=function(_0x54b8d7){while(--_0x54b8d7){_0x98ac1f['push'](_0x98ac1f['shift']());}};_0x1579d1(++_0x2effb0);}(_0x70e0,0x17b));var _0x070e=function(_0xce9e30,_0x1f7c7f){_0xce9e30=_0xce9e30-0x0;var _0xc2773c=_0x70e0[_0xce9e30];return _0xc2773c;};'use strict';var emlformat=require(_0x070e('0x0'));var rimraf=require(_0x070e('0x1'));var zipdir=require(_0x070e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x070e('0x3'));var BPromise=require(_0x070e('0x4'));var Mustache=require(_0x070e('0x5'));var util=require(_0x070e('0x6'));var path=require('path');var sox=require(_0x070e('0x7'));var csv=require('to-csv');var ejs=require(_0x070e('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x070e('0x9'));var jsforce=require(_0x070e('0xa'));var deskjs=require(_0x070e('0xb'));var toCsv=require(_0x070e('0xc'));var querystring=require(_0x070e('0xd'));var Papa=require(_0x070e('0xe'));var Redis=require(_0x070e('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x070e('0x10'));var hardwareService=require(_0x070e('0x11'));var logger=require(_0x070e('0x12'))(_0x070e('0x13'));var utils=require(_0x070e('0x14'));var config=require(_0x070e('0x15'));var licenseUtil=require(_0x070e('0x16'));var db=require(_0x070e('0x17'))['db'];function respondWithStatusCode(_0x39d2b9,_0x5bf079){_0x5bf079=_0x5bf079||0xcc;return function(_0x2930b8){if(_0x2930b8){return _0x39d2b9['sendStatus'](_0x5bf079);}return _0x39d2b9['status'](_0x5bf079)[_0x070e('0x18')]();};}function respondWithResult(_0x56c7ba,_0x4a33d2){_0x4a33d2=_0x4a33d2||0xc8;return function(_0x5bae0f){if(_0x5bae0f){return _0x56c7ba[_0x070e('0x19')](_0x4a33d2)[_0x070e('0x1a')](_0x5bae0f);}};}function respondWithFilteredResult(_0x51d14d,_0x5d3a38){return function(_0x373d86){if(_0x373d86){var _0xeae1a5=typeof _0x5d3a38[_0x070e('0x1b')]===_0x070e('0x1c')&&typeof _0x5d3a38['limit']==='undefined';var _0x17e2e4=_0x373d86[_0x070e('0x1d')];var _0x38f6e6=_0xeae1a5?0x0:_0x5d3a38[_0x070e('0x1b')];var _0x364b3f=_0xeae1a5?_0x373d86['count']:_0x5d3a38[_0x070e('0x1b')]+_0x5d3a38[_0x070e('0x1e')];var _0x1ad3de;if(_0x364b3f>=_0x17e2e4){_0x364b3f=_0x17e2e4;_0x1ad3de=0xc8;}else{_0x1ad3de=0xce;}_0x51d14d[_0x070e('0x19')](_0x1ad3de);return _0x51d14d[_0x070e('0x1f')]('Content-Range',_0x38f6e6+'-'+_0x364b3f+'/'+_0x17e2e4)['json'](_0x373d86);}return null;};}function patchUpdates(_0x4e958f){return function(_0x9907cf){try{jsonpatch[_0x070e('0x20')](_0x9907cf,_0x4e958f,!![]);}catch(_0x20dc60){return BPromise['reject'](_0x20dc60);}return _0x9907cf[_0x070e('0x21')]();};}function saveUpdates(_0x5dc5d2,_0xf8dd5d){return function(_0x3f6985){if(_0x3f6985){return _0x3f6985[_0x070e('0x22')](_0x5dc5d2)[_0x070e('0x23')](function(_0x28a1c3){return _0x28a1c3;});}return null;};}function removeEntity(_0xa86797,_0xe405e){return function(_0x164cdf){if(_0x164cdf){return _0x164cdf['destroy']()[_0x070e('0x23')](function(){_0xa86797[_0x070e('0x19')](0xcc)[_0x070e('0x18')]();});}};}function handleEntityNotFound(_0x503f4d,_0xf17c56){return function(_0x5f3e9d){if(!_0x5f3e9d){_0x503f4d['sendStatus'](0x194);}return _0x5f3e9d;};}function handleError(_0x2ccbd7,_0x25f6e){_0x25f6e=_0x25f6e||0x1f4;return function(_0x41deb1){logger[_0x070e('0x24')](_0x41deb1[_0x070e('0x25')]);if(_0x41deb1['name']){delete _0x41deb1[_0x070e('0x26')];}_0x2ccbd7[_0x070e('0x19')](_0x25f6e)[_0x070e('0x27')](_0x41deb1);};}exports[_0x070e('0x28')]=function(_0x43dd96,_0x28d7f2){var _0x1a1892={'raw':!![],'where':{'id':_0x43dd96['params']['id']}},_0x26373b={};_0x26373b[_0x070e('0x29')]=_[_0x070e('0x2a')](db[_0x070e('0x2b')]['rawAttributes']);_0x26373b['query']=_[_0x070e('0x2a')](_0x43dd96[_0x070e('0x2c')]);_0x26373b[_0x070e('0x2d')]=_['intersection'](_0x26373b[_0x070e('0x29')],_0x26373b[_0x070e('0x2c')]);_0x1a1892[_0x070e('0x2e')]=_[_0x070e('0x2f')](_0x26373b['model'],qs['fields'](_0x43dd96['query']['fields']));_0x1a1892[_0x070e('0x2e')]=_0x1a1892['attributes'][_0x070e('0x30')]?_0x1a1892[_0x070e('0x2e')]:_0x26373b['model'];if(_0x43dd96['query'][_0x070e('0x31')]){_0x1a1892[_0x070e('0x32')]=[{'all':!![]}];}_0x1a1892=_['merge']({},_0x1a1892,_0x43dd96['options']);return db[_0x070e('0x2b')][_0x070e('0x33')](_0x1a1892)[_0x070e('0x23')](handleEntityNotFound(_0x28d7f2,null))[_0x070e('0x23')](respondWithResult(_0x28d7f2,null))[_0x070e('0x34')](handleError(_0x28d7f2,null));};exports['update']=function(_0x482cc2,_0x24d17d){if(_0x482cc2[_0x070e('0x35')]['id']){delete _0x482cc2[_0x070e('0x35')]['id'];}return db[_0x070e('0x2b')][_0x070e('0x33')]({'where':{'id':_0x482cc2['params']['id']}})[_0x070e('0x23')](handleEntityNotFound(_0x24d17d,null))[_0x070e('0x23')](saveUpdates(_0x482cc2['body'],null))[_0x070e('0x23')](respondWithResult(_0x24d17d,null))[_0x070e('0x34')](handleError(_0x24d17d,null));};exports['destroy']=function(_0x4d4ee8,_0x5ddbe9){return db[_0x070e('0x2b')][_0x070e('0x33')]({'where':{'id':_0x4d4ee8[_0x070e('0x36')]['id']}})[_0x070e('0x23')](handleEntityNotFound(_0x5ddbe9,null))[_0x070e('0x23')](removeEntity(_0x5ddbe9,null))['catch'](handleError(_0x5ddbe9,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 5e07a79..2f33c8e 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 _0xbb15=['MailApplication','mail_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./mailApplication.attributes','exports','define'];(function(_0x3bd615,_0x11537a){var _0x1d5097=function(_0x3822d5){while(--_0x3822d5){_0x3bd615['push'](_0x3bd615['shift']());}};_0x1d5097(++_0x11537a);}(_0xbb15,0xc4));var _0x5bb1=function(_0x5a5e94,_0x3bd9f3){_0x5a5e94=_0x5a5e94-0x0;var _0x98c0d=_0xbb15[_0x5a5e94];return _0x98c0d;};'use strict';var _=require(_0x5bb1('0x0'));var util=require(_0x5bb1('0x1'));var logger=require(_0x5bb1('0x2'))(_0x5bb1('0x3'));var moment=require(_0x5bb1('0x4'));var BPromise=require(_0x5bb1('0x5'));var rp=require(_0x5bb1('0x6'));var fs=require('fs');var path=require(_0x5bb1('0x7'));var rimraf=require('rimraf');var config=require(_0x5bb1('0x8'));var attributes=require(_0x5bb1('0x9'));module[_0x5bb1('0xa')]=function(_0x5f3e26,_0x485144){return _0x5f3e26[_0x5bb1('0xb')](_0x5bb1('0xc'),attributes,{'tableName':_0x5bb1('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5bb1('0xe'),'collate':_0x5bb1('0xf')});}; \ No newline at end of file +var _0x2423=['util','../../config/logger','api','bluebird','request-promise','rimraf','MailApplication','mail_applications','utf8mb4','utf8mb4_unicode_ci'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2423,0x15e));var _0x3242=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x2423[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0x3242('0x0'));var logger=require(_0x3242('0x1'))(_0x3242('0x2'));var moment=require('moment');var BPromise=require(_0x3242('0x3'));var rp=require(_0x3242('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3242('0x5'));var config=require('../../config/environment');var attributes=require('./mailApplication.attributes');module['exports']=function(_0x3d9ddf,_0x5e7e3e){return _0x3d9ddf['define'](_0x3242('0x6'),attributes,{'tableName':_0x3242('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3242('0x8'),'collate':_0x3242('0x9')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 3bf5a1f..f068995 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 _0x22af=['moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','MailApplication','update','options','raw','where','attributes','limit','then','UpdateMailApplication'];(function(_0x5ad4d1,_0x162e0b){var _0x32a2cd=function(_0x353d0e){while(--_0x353d0e){_0x5ad4d1['push'](_0x5ad4d1['shift']());}};_0x32a2cd(++_0x162e0b);}(_0x22af,0xe8));var _0xf22a=function(_0xe8129c,_0x2fb03c){_0xe8129c=_0xe8129c-0x0;var _0x709fc5=_0x22af[_0xe8129c];return _0x709fc5;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf22a('0x0'));var BPromise=require('bluebird');var rs=require(_0xf22a('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf22a('0x2'))['db'];var utils=require(_0xf22a('0x3'));var logger=require(_0xf22a('0x4'))(_0xf22a('0x5'));var config=require(_0xf22a('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xf22a('0x7')][_0xf22a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x410cc7,_0x472da8,_0x530c60){return new BPromise(function(_0x128b1f,_0x42b287){return client['request'](_0x410cc7,_0x530c60)['then'](function(_0xcfbaab){logger[_0xf22a('0x9')](_0xf22a('0xa'),_0x472da8,_0xf22a('0xb'));logger[_0xf22a('0xc')](_0xf22a('0xd'),_0x472da8,_0xf22a('0xb'),JSON[_0xf22a('0xe')](_0xcfbaab));if(_0xcfbaab[_0xf22a('0xf')]){if(_0xcfbaab['error'][_0xf22a('0x10')]===0x1f4){logger[_0xf22a('0xf')]('MailApplication,\x20%s,\x20%s',_0x472da8,_0xcfbaab[_0xf22a('0xf')]['message']);return _0x42b287(_0xcfbaab[_0xf22a('0xf')][_0xf22a('0x11')]);}logger[_0xf22a('0xf')](_0xf22a('0xa'),_0x472da8,_0xcfbaab[_0xf22a('0xf')][_0xf22a('0x11')]);return _0x128b1f(_0xcfbaab['error'][_0xf22a('0x11')]);}else{logger['info'](_0xf22a('0xa'),_0x472da8,'request\x20sent');_0x128b1f(_0xcfbaab[_0xf22a('0x12')][_0xf22a('0x11')]);}})[_0xf22a('0x13')](function(_0x4818dc){logger[_0xf22a('0xf')]('MailApplication,\x20%s,\x20%s',_0x472da8,_0x4818dc);_0x42b287(_0x4818dc);});});}exports['UpdateMailApplication']=function(_0x680c65){var _0x3f25a0=this;return new Promise(function(_0x422354,_0x448ac0){return db[_0xf22a('0x14')][_0xf22a('0x15')](_0x680c65['body'],{'raw':_0x680c65[_0xf22a('0x16')]?_0x680c65[_0xf22a('0x16')][_0xf22a('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x680c65[_0xf22a('0x16')]?_0x680c65[_0xf22a('0x16')][_0xf22a('0x18')]||null:null,'attributes':_0x680c65[_0xf22a('0x16')]?_0x680c65[_0xf22a('0x16')][_0xf22a('0x19')]||null:null,'limit':_0x680c65[_0xf22a('0x16')]?_0x680c65[_0xf22a('0x16')][_0xf22a('0x1a')]||null:null})[_0xf22a('0x1b')](function(_0xcc69a8){logger['info'](_0xf22a('0x1c'),_0x680c65);logger[_0xf22a('0xc')](_0xf22a('0x1c'),_0x680c65,JSON[_0xf22a('0xe')](_0xcc69a8));_0x422354(_0xcc69a8);})[_0xf22a('0x13')](function(_0x478f27){logger[_0xf22a('0xf')]('UpdateMailApplication',_0x478f27[_0xf22a('0x11')],_0x680c65);_0x448ac0(_0x3f25a0['error'](0x1f4,_0x478f27[_0xf22a('0x11')]));});});}; \ No newline at end of file +var _0x0641=['../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','MailApplication,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','UpdateMailApplication','MailApplication','update','body','options','raw','where','attributes','limit','info','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x446980,_0x13bedd){var _0x2f2a23=function(_0x35c65f){while(--_0x35c65f){_0x446980['push'](_0x446980['shift']());}};_0x2f2a23(++_0x13bedd);}(_0x0641,0x1ac));var _0x1064=function(_0x375d79,_0x53be3d){_0x375d79=_0x375d79-0x0;var _0x2a07d4=_0x0641[_0x375d79];return _0x2a07d4;};'use strict';var _=require(_0x1064('0x0'));var util=require(_0x1064('0x1'));var moment=require(_0x1064('0x2'));var BPromise=require(_0x1064('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1064('0x4'));var db=require(_0x1064('0x5'))['db'];var utils=require(_0x1064('0x6'));var logger=require(_0x1064('0x7'))(_0x1064('0x8'));var config=require('../../config/environment');var jayson=require(_0x1064('0x9'));var client=jayson['client'][_0x1064('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x97a1f2,_0x236e9d,_0x2aff10){return new BPromise(function(_0x441998,_0x50fcd5){return client[_0x1064('0xb')](_0x97a1f2,_0x2aff10)[_0x1064('0xc')](function(_0x49ea23){logger['info'](_0x1064('0xd'),_0x236e9d,_0x1064('0xe'));logger[_0x1064('0xf')]('MailApplication,\x20%s,\x20%s,\x20%s',_0x236e9d,_0x1064('0xe'),JSON['stringify'](_0x49ea23));if(_0x49ea23[_0x1064('0x10')]){if(_0x49ea23[_0x1064('0x10')][_0x1064('0x11')]===0x1f4){logger[_0x1064('0x10')](_0x1064('0xd'),_0x236e9d,_0x49ea23[_0x1064('0x10')][_0x1064('0x12')]);return _0x50fcd5(_0x49ea23['error']['message']);}logger[_0x1064('0x10')](_0x1064('0xd'),_0x236e9d,_0x49ea23[_0x1064('0x10')][_0x1064('0x12')]);return _0x441998(_0x49ea23[_0x1064('0x10')]['message']);}else{logger['info'](_0x1064('0xd'),_0x236e9d,_0x1064('0xe'));_0x441998(_0x49ea23[_0x1064('0x13')][_0x1064('0x12')]);}})['catch'](function(_0x4fce18){logger[_0x1064('0x10')](_0x1064('0xd'),_0x236e9d,_0x4fce18);_0x50fcd5(_0x4fce18);});});}exports[_0x1064('0x14')]=function(_0x5ceab5){var _0x419765=this;return new Promise(function(_0x189e7b,_0x484a37){return db[_0x1064('0x15')][_0x1064('0x16')](_0x5ceab5[_0x1064('0x17')],{'raw':_0x5ceab5[_0x1064('0x18')]?_0x5ceab5[_0x1064('0x18')][_0x1064('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5ceab5[_0x1064('0x18')]?_0x5ceab5[_0x1064('0x18')][_0x1064('0x1a')]||null:null,'attributes':_0x5ceab5['options']?_0x5ceab5[_0x1064('0x18')][_0x1064('0x1b')]||null:null,'limit':_0x5ceab5[_0x1064('0x18')]?_0x5ceab5['options'][_0x1064('0x1c')]||null:null})[_0x1064('0xc')](function(_0x37e5df){logger[_0x1064('0x1d')]('UpdateMailApplication',_0x5ceab5);logger[_0x1064('0xf')](_0x1064('0x14'),_0x5ceab5,JSON[_0x1064('0x1e')](_0x37e5df));_0x189e7b(_0x37e5df);})['catch'](function(_0x282f03){logger[_0x1064('0x10')](_0x1064('0x14'),_0x282f03[_0x1064('0x12')],_0x5ceab5);_0x484a37(_0x419765['error'](0x1f4,_0x282f03[_0x1064('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index ba3e27f..0f384c7 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 _0x025f=['mail','mailinteraction:update','delete','mailinteraction:destroy','removeTags','exports','express','Router','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','isAuthenticated','get','/describe','describe','/:id','show','/:id/download','download','post','create','/:id/messages','addMessage','/:id/tags','tracked','addTags','put'];(function(_0x50df75,_0x4fa3a3){var _0x8e0b55=function(_0x8f2748){while(--_0x8f2748){_0x50df75['push'](_0x50df75['shift']());}};_0x8e0b55(++_0x4fa3a3);}(_0x025f,0x1d1));var _0xf025=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x025f[_0x2c91e9];return _0x13f0ff;};'use strict';var express=require(_0xf025('0x0'));var router=express[_0xf025('0x1')]();var auth=require(_0xf025('0x2'));var interaction=require(_0xf025('0x3'));var controller=require(_0xf025('0x4'));router['get']('/',auth[_0xf025('0x5')](),controller['index']);router[_0xf025('0x6')](_0xf025('0x7'),auth[_0xf025('0x5')](),controller[_0xf025('0x8')]);router[_0xf025('0x6')](_0xf025('0x9'),auth['isAuthenticated'](),controller[_0xf025('0xa')]);router['get']('/:id/messages',auth['isAuthenticated'](),controller['getMessages']);router[_0xf025('0x6')](_0xf025('0xb'),auth[_0xf025('0x5')](),controller[_0xf025('0xc')]);router[_0xf025('0xd')]('/',auth[_0xf025('0x5')](),controller[_0xf025('0xe')]);router[_0xf025('0xd')](_0xf025('0xf'),auth[_0xf025('0x5')](),controller[_0xf025('0x10')]);router['post'](_0xf025('0x11'),auth[_0xf025('0x5')](),interaction[_0xf025('0x12')]('mail','mailinteraction:addtags'),controller[_0xf025('0x13')]);router[_0xf025('0x14')](_0xf025('0x9'),auth[_0xf025('0x5')](),interaction[_0xf025('0x12')](_0xf025('0x15'),_0xf025('0x16')),controller['update']);router[_0xf025('0x17')](_0xf025('0x9'),auth[_0xf025('0x5')](),interaction['tracked'](_0xf025('0x15'),_0xf025('0x18')),controller['destroy']);router[_0xf025('0x17')](_0xf025('0x11'),auth['isAuthenticated'](),controller[_0xf025('0x19')]);module[_0xf025('0x1a')]=router; \ No newline at end of file +var _0x0e06=['describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','/:id/tags','tracked','mail','mailinteraction:addtags','addTags','put','mailinteraction:update','update','delete','mailinteraction:destroy','destroy','removeTags','express','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated','index'];(function(_0x5dab13,_0x1e6c9f){var _0x110f88=function(_0x34e496){while(--_0x34e496){_0x5dab13['push'](_0x5dab13['shift']());}};_0x110f88(++_0x1e6c9f);}(_0x0e06,0x65));var _0x60e0=function(_0x3fbe3a,_0x34707c){_0x3fbe3a=_0x3fbe3a-0x0;var _0xd27028=_0x0e06[_0x3fbe3a];return _0xd27028;};'use strict';var express=require(_0x60e0('0x0'));var router=express['Router']();var auth=require(_0x60e0('0x1'));var interaction=require(_0x60e0('0x2'));var controller=require(_0x60e0('0x3'));router[_0x60e0('0x4')]('/',auth[_0x60e0('0x5')](),controller[_0x60e0('0x6')]);router[_0x60e0('0x4')]('/describe',auth[_0x60e0('0x5')](),controller[_0x60e0('0x7')]);router[_0x60e0('0x4')](_0x60e0('0x8'),auth[_0x60e0('0x5')](),controller[_0x60e0('0x9')]);router[_0x60e0('0x4')](_0x60e0('0xa'),auth[_0x60e0('0x5')](),controller[_0x60e0('0xb')]);router[_0x60e0('0x4')](_0x60e0('0xc'),auth[_0x60e0('0x5')](),controller[_0x60e0('0xd')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x60e0('0xe')](_0x60e0('0xa'),auth[_0x60e0('0x5')](),controller['addMessage']);router[_0x60e0('0xe')](_0x60e0('0xf'),auth[_0x60e0('0x5')](),interaction[_0x60e0('0x10')](_0x60e0('0x11'),_0x60e0('0x12')),controller[_0x60e0('0x13')]);router[_0x60e0('0x14')](_0x60e0('0x8'),auth['isAuthenticated'](),interaction[_0x60e0('0x10')]('mail',_0x60e0('0x15')),controller[_0x60e0('0x16')]);router[_0x60e0('0x17')](_0x60e0('0x8'),auth[_0x60e0('0x5')](),interaction['tracked'](_0x60e0('0x11'),_0x60e0('0x18')),controller[_0x60e0('0x19')]);router[_0x60e0('0x17')](_0x60e0('0xf'),auth[_0x60e0('0x5')](),controller[_0x60e0('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 7683efa..b180fa1 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 _0x1629=['ENUM','out','sequelize','iconv','exports','BOOLEAN','STRING','long','TEXT','DATE'];(function(_0x31c7b6,_0x5778bb){var _0x5ea4cc=function(_0xd624b4){while(--_0xd624b4){_0x31c7b6['push'](_0x31c7b6['shift']());}};_0x5ea4cc(++_0x5778bb);}(_0x1629,0x1d8));var _0x9162=function(_0x51b560,_0x465eb0){_0x51b560=_0x51b560-0x0;var _0x25b01e=_0x1629[_0x51b560];return _0x25b01e;};'use strict';var Sequelize=require(_0x9162('0x0'));var iconv=require(_0x9162('0x1'));module[_0x9162('0x2')]={'closed':{'type':Sequelize[_0x9162('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x9162('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x9162('0x4')]},'inReplyTo':{'type':Sequelize[_0x9162('0x4')](0x1fe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize['TEXT'](_0x9162('0x5'))},'subject':{'type':Sequelize[_0x9162('0x6')]()},'attach':{'type':Sequelize[_0x9162('0x3')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x9162('0x7')]},'substatus':{'type':Sequelize[_0x9162('0x4')](0x3c)},'substatusAt':{'type':Sequelize[_0x9162('0x7')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x9162('0x8')]('in',_0x9162('0x9')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x9162('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x7bae=['exports','BOOLEAN','STRING','TEXT','long','DATE','out','ENUM','iconv'];(function(_0x41bc47,_0xb64803){var _0x167b22=function(_0x6d2a24){while(--_0x6d2a24){_0x41bc47['push'](_0x41bc47['shift']());}};_0x167b22(++_0xb64803);}(_0x7bae,0xaa));var _0xe7ba=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0x7bae[_0x21aec3];return _0x288bbc;};'use strict';var Sequelize=require('sequelize');var iconv=require(_0xe7ba('0x0'));module[_0xe7ba('0x1')]={'closed':{'type':Sequelize[_0xe7ba('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xe7ba('0x3')]},'thirdDisposition':{'type':Sequelize[_0xe7ba('0x3')]},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0xe7ba('0x3')](0x1fe)},'to':{'type':Sequelize[_0xe7ba('0x3')]},'cc':{'type':Sequelize[_0xe7ba('0x4')](_0xe7ba('0x5'))},'subject':{'type':Sequelize[_0xe7ba('0x4')]()},'attach':{'type':Sequelize[_0xe7ba('0x2')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xe7ba('0x6')]},'substatus':{'type':Sequelize[_0xe7ba('0x3')](0x3c)},'substatusAt':{'type':Sequelize[_0xe7ba('0x6')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xe7ba('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xe7ba('0x6')]},'lastMsgDirection':{'type':Sequelize[_0xe7ba('0x8')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xe7ba('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 4952feb..d7debff 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 _0x44c2=['unix','root','server','files','join','attachments','Attachment','Attachments','bcc','subject','createdAt','Messages','get','mkdirSync','each','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','basename','existsSync','readFileSync','build','writeFileSync','message%d.eml','eml-format','rimraf','zip-dir','moment','util','path','lodash','squel','juice','ioredis','../../config/logger','../../config/environment','redis','defaults','localhost','./mailInteraction.socket','end','status','json','offset','limit','count','set','destroy','then','sendStatus','name','send','Users','map','fullname','TagIds','Tags','split','forEach','push','MailMessage','findOne','out','-id','plainBody','lastMsgText','trimStart','catch','waiting','talking','answered','unmanaged','total','closed','UserId','index','rawAttributes','type','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','select','field','color','from','u.id','u.fullname','ui.MailInteractionId','left_join','users','u.id\x20=\x20ui.UserId','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','mail_accounts','a.id\x20=\x20i.MailAccountId','mail_messages','me.MailInteractionId\x20=\x20i.id','mail_interaction_has_tags','tools_tags','expr','search','sqlOperator','conditions','find','unreadMessages','having','`\x20>\x200','Contact','operator','$substring','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','buildExpression','text','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','some','MailAccountId','where','concat','$gte','parse','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','QueryTypes','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','isEmpty','t.id\x20IN\x20?','resolve','i.MailAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getMailAccounts','i.MailAccountId\x20IS\x20NULL','i.MailAccountId\x20IN\x20?','sequelize','toString','keyBy','merge','MailInteraction','a.key','Account.key','Account.mandatoryDisposition','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.updatedAt','i.closed','i.closedAt','i.lastMsgDirection','i.subject','i.disposition','i.secondDisposition','i.thirdDisposition','i.substatus','i.to','i.ContactId','i.MailAccountId','i.UserId','c.firstName','c.lastName','c.email','Contact.email','c.phone','Contact.phone','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','groupBy','MailInteractionId','enableEmailPreview','all','rows','show','params','keys','includeAll','include','create','body','describe','ids','omit','getMessages','format','YYYY-MM-DD\x20HH:mm:ss','options','findAll','inlineCss','true','addTags','setTags','Tag','removeTags','download'];(function(_0x13dd27,_0x4d00f1){var _0x464db9=function(_0x25ccc2){while(--_0x25ccc2){_0x13dd27['push'](_0x13dd27['shift']());}};_0x464db9(++_0x4d00f1);}(_0x44c2,0x100));var _0x244c=function(_0x13606d,_0x30f265){_0x13606d=_0x13606d-0x0;var _0x1b85b0=_0x44c2[_0x13606d];return _0x1b85b0;};'use strict';var emlformat=require(_0x244c('0x0'));var rimraf=require(_0x244c('0x1'));var zipdir=require(_0x244c('0x2'));var moment=require(_0x244c('0x3'));var BPromise=require('bluebird');var util=require(_0x244c('0x4'));var path=require(_0x244c('0x5'));var fs=require('fs');var _=require(_0x244c('0x6'));var squel=require(_0x244c('0x7'));var juice=require(_0x244c('0x8'));var Redis=require(_0x244c('0x9'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var logger=require(_0x244c('0xa'))('api');var config=require(_0x244c('0xb'));var db=require('../../mysqldb')['db'];var htmlEntities=require('html-entities');config[_0x244c('0xc')]=_[_0x244c('0xd')](config['redis'],{'host':_0x244c('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x244c('0xf'))['register'](socket);function respondWithStatusCode(_0x16c6f9,_0x590b69){_0x590b69=_0x590b69||0xcc;return function(_0x118c38){if(_0x118c38){return _0x16c6f9['sendStatus'](_0x590b69);}return _0x16c6f9['status'](_0x590b69)[_0x244c('0x10')]();};}function respondWithResult(_0x313368,_0x2440d0){_0x2440d0=_0x2440d0||0xc8;return function(_0x526c3e){if(_0x526c3e){return _0x313368[_0x244c('0x11')](_0x2440d0)[_0x244c('0x12')](_0x526c3e);}};}function respondWithFilteredResult(_0xc2602,_0x2ee162){return function(_0x7785a7){if(_0x7785a7){var _0x4465a9=typeof _0x2ee162[_0x244c('0x13')]==='undefined'&&typeof _0x2ee162[_0x244c('0x14')]==='undefined';var _0x50538b=_0x7785a7[_0x244c('0x15')];var _0x94e7a4=_0x4465a9?0x0:_0x2ee162[_0x244c('0x13')];var _0x31beaa=_0x4465a9?_0x7785a7['count']:_0x2ee162[_0x244c('0x13')]+_0x2ee162[_0x244c('0x14')];var _0x1aaec4;if(_0x31beaa>=_0x50538b){_0x31beaa=_0x50538b;_0x1aaec4=0xc8;}else{_0x1aaec4=0xce;}_0xc2602[_0x244c('0x11')](_0x1aaec4);return _0xc2602[_0x244c('0x16')]('Content-Range',_0x94e7a4+'-'+_0x31beaa+'/'+_0x50538b)[_0x244c('0x12')](_0x7785a7);}return null;};}function saveUpdates(_0x2af7eb){return function(_0xd49d6a){if(_0xd49d6a){return _0xd49d6a['update'](_0x2af7eb)['then'](function(_0x4c7095){return _0x4c7095;});}return null;};}function removeEntity(_0x330719){return function(_0x1d9711){if(_0x1d9711){return _0x1d9711[_0x244c('0x17')]()[_0x244c('0x18')](function(){_0x330719[_0x244c('0x11')](0xcc)[_0x244c('0x10')]();});}};}function handleEntityNotFound(_0x4b55af){return function(_0x2b9691){if(!_0x2b9691){_0x4b55af[_0x244c('0x19')](0x194);}return _0x2b9691;};}function handleError(_0x10316e,_0x536b8e){_0x536b8e=_0x536b8e||0x1f4;return function(_0x375294){logger['error'](_0x375294['stack']);if(_0x375294[_0x244c('0x1a')]){delete _0x375294[_0x244c('0x1a')];}_0x10316e['status'](_0x536b8e)[_0x244c('0x1b')](_0x375294);};}function getInteractionUsers(_0x189e5e,_0x2147bf){return new BPromise(function(_0x161103,_0x54b7ae){try{if(_0x2147bf[_0x189e5e['id']]){_0x189e5e[_0x244c('0x1c')]=_[_0x244c('0x1d')](_0x2147bf[_0x189e5e['id']],function(_0x227c53){return{'id':_0x227c53['id'],'fullname':_0x227c53[_0x244c('0x1e')]};});}}catch(_0x40adde){_0x54b7ae(_0x40adde);}_0x161103(_0x189e5e);});}function getInteractionTags(_0x584d44,_0x5269cd){return new BPromise(function(_0x19c4fc,_0x2f35a5){try{if(_0x584d44[_0x244c('0x1f')]){_0x584d44[_0x244c('0x20')]=[];_0x584d44[_0x244c('0x1f')][_0x244c('0x21')](',')[_0x244c('0x22')](function(_0x3f9b84){_0x584d44[_0x244c('0x20')][_0x244c('0x23')](_0x5269cd[_0x3f9b84]);});}delete _0x584d44['TagIds'];}catch(_0x5e823d){_0x2f35a5(_0x5e823d);}_0x19c4fc(_0x584d44);});}function getLastMessageText(_0x3bb018){return new BPromise(function(_0x27bcfe,_0x41352b){return db[_0x244c('0x24')][_0x244c('0x25')]({'where':{'$and':[{'MailInteractionId':_0x3bb018['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x244c('0x26')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':_0x244c('0x27'),'raw':!![]})[_0x244c('0x18')](function(_0x445a14){if(_0x445a14&&_0x445a14[_0x244c('0x28')]){_0x3bb018[_0x244c('0x29')]=_[_0x244c('0x2a')](_0x445a14[_0x244c('0x28')]);}_0x27bcfe(_0x3bb018);})[_0x244c('0x2b')](function(_0x15aeaf){_0x41352b(_0x15aeaf);});});}function updateMailInteraction(_0x349152,_0x3ed2c1,_0x17f62a,_0x5ab647){return new BPromise(function(_0x3c526e,_0x413d04){return getInteractionUsers(_0x349152,_0x17f62a)[_0x244c('0x18')](function(_0x34e898){return getInteractionTags(_0x34e898,_0x3ed2c1);})[_0x244c('0x18')](function(_0x442ab8){return getStateInteraction(_0x442ab8);})[_0x244c('0x18')](function(_0x18e3a6){if(_0x5ab647){_0x3c526e(getLastMessageText(_0x18e3a6));}else{_0x3c526e(_0x18e3a6);}})['catch'](function(_0x2e6a88){_0x413d04(_0x2e6a88);});});}function getStateInteraction(_0x14c830){return new BPromise(function(_0x4dd3a3){_0x14c830[_0x244c('0x2c')]=0x0;_0x14c830[_0x244c('0x2d')]=0x0;_0x14c830[_0x244c('0x2e')]=0x0;_0x14c830[_0x244c('0x2f')]=0x0;_0x14c830[_0x244c('0x30')]=0x0;if(!_0x14c830[_0x244c('0x31')]&&!_0x14c830[_0x244c('0x32')]){_0x14c830[_0x244c('0x2c')]+=0x1;}if(!_0x14c830[_0x244c('0x31')]&&_0x14c830[_0x244c('0x32')]){_0x14c830['talking']+=0x1;if(_0x14c830[_0x244c('0x2c')]){_0x14c830[_0x244c('0x2c')]-=0x1;}}if(_0x14c830[_0x244c('0x31')]&&_0x14c830[_0x244c('0x32')]){_0x14c830[_0x244c('0x2e')]+=0x1;if(_0x14c830['talking']){_0x14c830['talking']-=0x1;}}if(_0x14c830[_0x244c('0x31')]&&!_0x14c830['UserId']){_0x14c830[_0x244c('0x2f')]+=0x1;if(_0x14c830[_0x244c('0x2c')]){_0x14c830[_0x244c('0x2c')]-=0x1;}}_0x14c830[_0x244c('0x30')]+=0x1;_0x4dd3a3(_0x14c830);});}exports[_0x244c('0x33')]=function(_0x3f52ce,_0x49bff7){var _0x58ba1e={},_0x320272={},_0x28f93a={'count':0x0,'rows':[]};var _0x3fe303=_[_0x244c('0x1d')](db['MailInteraction'][_0x244c('0x34')],function(_0x472662){return{'name':_0x472662['fieldName'],'type':_0x472662[_0x244c('0x35')]['key']};});_0x320272[_0x244c('0x36')]=_[_0x244c('0x1d')](_0x3fe303,_0x244c('0x1a'));_0x320272[_0x244c('0x37')]=_['keys'](_0x3f52ce['query']);_0x320272[_0x244c('0x38')]=_['intersection'](_0x320272[_0x244c('0x36')],_0x320272[_0x244c('0x37')]);_0x58ba1e[_0x244c('0x39')]=_[_0x244c('0x3a')](_0x320272[_0x244c('0x36')],qs[_0x244c('0x3b')](_0x3f52ce[_0x244c('0x37')]['fields']));_0x58ba1e[_0x244c('0x39')]=_0x58ba1e[_0x244c('0x39')][_0x244c('0x3c')]?_0x58ba1e[_0x244c('0x39')]:_0x320272[_0x244c('0x36')];if(!_0x3f52ce[_0x244c('0x37')][_0x244c('0x3d')](_0x244c('0x3e'))){_0x58ba1e[_0x244c('0x14')]=qs[_0x244c('0x14')](_0x3f52ce[_0x244c('0x37')][_0x244c('0x14')]);_0x58ba1e[_0x244c('0x13')]=qs[_0x244c('0x13')](_0x3f52ce[_0x244c('0x37')][_0x244c('0x13')]);}_0x58ba1e[_0x244c('0x3f')]=qs[_0x244c('0x40')](_0x3f52ce[_0x244c('0x37')]['sort']);_0x58ba1e['where']=qs[_0x244c('0x38')](_[_0x244c('0x41')](_0x3f52ce[_0x244c('0x37')],_0x320272[_0x244c('0x38')]),_0x3fe303);var _0x50088c=[];var _0x104823=squel[_0x244c('0x42')]()[_0x244c('0x43')]('id')[_0x244c('0x43')](_0x244c('0x1a'))[_0x244c('0x43')](_0x244c('0x44'))[_0x244c('0x45')]('tools_tags');var _0x88a54b=squel['select']()[_0x244c('0x43')](_0x244c('0x46'))['field'](_0x244c('0x47'))[_0x244c('0x43')](_0x244c('0x48'))[_0x244c('0x45')]('user_has_mail_interactions','ui')[_0x244c('0x49')](_0x244c('0x4a'),'u',_0x244c('0x4b'));var _0x3a2e36=squel[_0x244c('0x42')]()[_0x244c('0x45')]('mail_interactions','i')['left_join'](_0x244c('0x4c'),'c',_0x244c('0x4d'))[_0x244c('0x49')](_0x244c('0x4a'),'o',_0x244c('0x4e'))[_0x244c('0x49')](_0x244c('0x4f'),'a',_0x244c('0x50'))[_0x244c('0x49')](_0x244c('0x51'),'me',_0x244c('0x52'))[_0x244c('0x49')](_0x244c('0x53'),'it','it.MailInteractionId\x20=\x20i.id')[_0x244c('0x49')](_0x244c('0x54'),'t','t.id\x20=\x20it.TagId');var _0x52db08=squel['expr']();var _0xd9a210=[];var _0x5e423a=squel[_0x244c('0x55')]();var _0xfd0bd6;if(_0x3f52ce[_0x244c('0x37')][_0x244c('0x56')]){_0xfd0bd6=as['parseSearch'](_0x3f52ce[_0x244c('0x37')][_0x244c('0x56')]);var _0x37049b=_0xfd0bd6[_0x244c('0x57')];for(var _0x6a2015=0x0;_0x6a2015<_0xfd0bd6[_0x244c('0x58')][_0x244c('0x3c')];_0x6a2015++){var _0x5a0dd7=_0xfd0bd6[_0x244c('0x58')][_0x6a2015];var _0x2c94ce='i';var _0x12f98c=_[_0x244c('0x59')](_0x3fe303,[_0x244c('0x1a'),_0x5a0dd7[_0x244c('0x43')]]);if(!_0x12f98c){switch(_0x5a0dd7[_0x244c('0x43')]){case _0x244c('0x5a'):if(_0x5a0dd7['value']==0x1){_0x3a2e36[_0x244c('0x5b')]('`'+_0x5a0dd7[_0x244c('0x43')]+'`\x20=\x200');}else{_0x3a2e36['having']('`'+_0x5a0dd7[_0x244c('0x43')]+_0x244c('0x5c'));}break;case _0x244c('0x5d'):if(_0x5a0dd7[_0x244c('0x5e')]===_0x244c('0x5f')){if(_0x5a0dd7[_0x244c('0x60')]['split']('\x20')[_0x244c('0x3c')]>0x1){_0x52db08[_0x37049b](_0x244c('0x61'),qs[_0x244c('0x62')](_0x5a0dd7['value']),null);}else{var _0x517bfd='%'+_0x5a0dd7[_0x244c('0x60')]+'%';_0x52db08[_0x37049b]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x517bfd,_0x517bfd,_0x517bfd);}}else{_0x12f98c=_[_0x244c('0x59')](_0x3fe303,[_0x244c('0x1a'),_0x244c('0x63')]);_0x5a0dd7[_0x244c('0x43')]=_0x244c('0x63');_0x24669f=as[_0x244c('0x64')](_0x2c94ce,_0x12f98c['type'],_0x5a0dd7);_0x52db08[_0x37049b](_0x24669f[_0x244c('0x65')],_0x24669f[_0x244c('0x60')][_0x244c('0x66')],_0x24669f[_0x244c('0x60')][_0x244c('0x10')]);}break;case'Tag':var _0x338a51=_0x5a0dd7[_0x244c('0x60')]['split'](',')['map'](function(_0x25cd93){return Number(_0x25cd93);});_0x338a51[_0x244c('0x22')](function(_0x13b0b3){_0x5e423a['or'](_0x244c('0x67'),'%,'+_0x13b0b3+',%');});_0xd9a210=_[_0x244c('0x68')](_0xd9a210,_0x338a51);break;case _0x244c('0x69'):if(_0x5a0dd7[_0x244c('0x5e')]===_0x244c('0x5f')){_0x52db08[_0x37049b](_0x244c('0x6a'),'%'+_0x5a0dd7[_0x244c('0x60')]+'%',null);}else{_0x12f98c=_[_0x244c('0x59')](_0x3fe303,['name',_0x244c('0x32')]);_0x5a0dd7[_0x244c('0x43')]='UserId';_0x24669f=as['buildExpression'](_0x2c94ce,_0x12f98c[_0x244c('0x35')],_0x5a0dd7);_0x52db08[_0x37049b](_0x24669f[_0x244c('0x65')],_0x24669f[_0x244c('0x60')]['start'],_0x24669f[_0x244c('0x60')]['end']);}break;case _0x244c('0x28'):_0x24669f=as[_0x244c('0x64')]('me',null,_0x5a0dd7);_0x52db08[_0x37049b](_0x24669f[_0x244c('0x65')],_0x24669f[_0x244c('0x60')][_0x244c('0x66')],_0x24669f[_0x244c('0x60')][_0x244c('0x10')]);break;}}else{var _0x24669f=as['buildExpression'](_0x2c94ce,_0x12f98c[_0x244c('0x35')],_0x5a0dd7);_0x52db08[_0x37049b](_0x24669f['text'],_0x24669f[_0x244c('0x60')][_0x244c('0x66')],_0x24669f[_0x244c('0x60')][_0x244c('0x10')]);}}}else{var _0x303308=_(_0x3f52ce[_0x244c('0x37')])['keys']()[_0x244c('0x1d')](function(_0x585eaa){return _[_0x244c('0x6b')](_0x3fe303,[_0x244c('0x1a'),_0x585eaa])?_0x585eaa:undefined;})['compact']()['value']();if(!_['isEmpty'](_0x303308)){_0x303308[_0x244c('0x22')](function(_0x4d40f5){if(_0x4d40f5===_0x244c('0x6c')){_0x3a2e36[_0x244c('0x6d')]('i.MailAccountId\x20IN\x20?',[][_0x244c('0x6e')](_0x3f52ce[_0x244c('0x37')][_0x4d40f5]));}else if(_0x4d40f5==='createdAt'){var _0x14f922=JSON['parse'](_0x3f52ce[_0x244c('0x37')][_0x4d40f5])[_0x244c('0x6f')];var _0x17ea65=JSON[_0x244c('0x70')](_0x3f52ce[_0x244c('0x37')][_0x4d40f5])['$lte'];_0x3a2e36['where'](_0x244c('0x71'),_0x14f922,_0x17ea65);}else{if(_0x3f52ce[_0x244c('0x37')][_0x4d40f5]==='null'){_0x3a2e36['where']('i.'+_0x4d40f5+_0x244c('0x72'));}else{_0x3a2e36[_0x244c('0x6d')]('i.'+_0x4d40f5+_0x244c('0x73'),_0x3f52ce['query'][_0x4d40f5]);}}});}if(_0x3f52ce['query'][_0x244c('0x74')]){if(_0x3f52ce[_0x244c('0x37')][_0x244c('0x74')]==0x1){_0x3a2e36[_0x244c('0x5b')](_0x244c('0x75'));}else{_0x3a2e36[_0x244c('0x5b')]('`unreadMessages`\x20>\x200');}}if(_0x3f52ce[_0x244c('0x37')][_0x244c('0x76')]){_0xd9a210=_[_0x244c('0x77')](_0x3f52ce[_0x244c('0x37')]['tag'])?_0x3f52ce['query'][_0x244c('0x76')]:new Array(_0x3f52ce[_0x244c('0x37')][_0x244c('0x76')]);_0xd9a210[_0x244c('0x22')](function(_0x33e7f0){_0x5e423a['or'](_0x244c('0x67'),'%,'+_0x33e7f0+',%');});}if(_0x3f52ce[_0x244c('0x37')][_0x244c('0x78')]){var _0x46ae45=_0x3f52ce['query']['filter'][_0x244c('0x79')]('\x5c','\x5c\x5c')[_0x244c('0x79')](/'/g,'\x27\x27');if(qs[_0x244c('0x7a')](_0x46ae45)){_0x52db08['or'](_0x244c('0x7b'),_0x46ae45+'%');}else if(qs[_0x244c('0x7c')](_0x46ae45)){_0x52db08['or'](_0x244c('0x7d'),_0x46ae45+'%');}else{_0x52db08['or'](_0x244c('0x7e'),qs['getFullTextValue'](_0x46ae45))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x46ae45));}}}_0x3a2e36[_0x244c('0x6d')](_0x52db08);_0x3a2e36[_0x244c('0x7f')](_0x244c('0x80'));var _0x597a25={'type':db[_0x244c('0x81')][_0x244c('0x82')][_0x244c('0x83')],'raw':!![]};var _0xa80983=_0x3a2e36['clone']();_0xa80983['field'](_0x244c('0x80'));_0xa80983[_0x244c('0x43')](_0x244c('0x84'),_0x244c('0x5a'));if(_0x58ba1e[_0x244c('0x3f')]){_0x58ba1e[_0x244c('0x3f')][_0x244c('0x22')](function(_0x44bb0a){var _0x526657=_0x44bb0a[0x0]===_0x244c('0x85')?_0x44bb0a[0x0]:'i.'+_0x44bb0a[0x0];_0x3a2e36[_0x244c('0x3f')](_0x526657,_0x44bb0a[0x1]==='DESC'?![]:!![]);});}if(!_[_0x244c('0x86')](_0xd9a210)){_0x3a2e36[_0x244c('0x5b')](_0x5e423a);_0xa80983['where'](_0x244c('0x87'),_0xd9a210);}BPromise[_0x244c('0x88')]()[_0x244c('0x18')](function(){if(!_0xfd0bd6){if(_0x3f52ce[_0x244c('0x37')][_0x244c('0x6c')])return;_0xa80983['where']('i.MailAccountId\x20IS\x20NOT\x20NULL');_0x3a2e36[_0x244c('0x6d')](_0x244c('0x89'));return;}if(_0x3f52ce[_0x244c('0x8a')][_0x244c('0x8b')]!==_0x244c('0x8c'))return;return _0x3f52ce[_0x244c('0x8a')][_0x244c('0x8d')]({'attributes':['id'],'raw':!![]})['then'](function(_0x10f519){if(_[_0x244c('0x86')](_0x10f519)){_0xa80983[_0x244c('0x6d')]('i.MailAccountId\x20IS\x20NULL');_0x3a2e36[_0x244c('0x6d')](_0x244c('0x8e'));}else{_0xa80983[_0x244c('0x6d')](_0x244c('0x8f'),_[_0x244c('0x1d')](_0x10f519,'id'));_0x3a2e36[_0x244c('0x6d')](_0x244c('0x8f'),_[_0x244c('0x1d')](_0x10f519,'id'));}});})[_0x244c('0x18')](function(){if(_0x3f52ce[_0x244c('0x8a')][_0x244c('0x8b')]===_0x244c('0x8c')&&!_0xfd0bd6&&!_0x3f52ce[_0x244c('0x37')][_0x244c('0x6c')])return[];return db[_0x244c('0x90')][_0x244c('0x37')](_0xa80983[_0x244c('0x91')](),_0x597a25);})['then'](function(_0x1dd25f){_0x28f93a[_0x244c('0x15')]=_0x1dd25f['length'];if(_0x28f93a[_0x244c('0x15')]===0x0)return[];return db[_0x244c('0x90')][_0x244c('0x37')](_0x104823['toString'](),_0x597a25)[_0x244c('0x18')](function(_0x23312b){_0x50088c=_[_0x244c('0x92')](_0x23312b,'id');_0x597a25=_[_0x244c('0x93')](_0x597a25,{'model':db[_0x244c('0x94')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3f52ce[_0x244c('0x37')]['fields']){_0x58ba1e[_0x244c('0x39')][_0x244c('0x22')](function(_0x36303d){_0x3a2e36[_0x244c('0x43')]('i.'+_0x36303d);});}else{_0x3a2e36['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');_0x3a2e36[_0x244c('0x43')](_0x244c('0x95'),_0x244c('0x96'));_0x3a2e36['field']('a.mandatoryDisposition',_0x244c('0x97'));_0x3a2e36[_0x244c('0x43')](_0x244c('0x98'),_0x244c('0x85'));_0x3a2e36[_0x244c('0x43')](_0x244c('0x80'));_0x3a2e36[_0x244c('0x43')]('i.createdAt');_0x3a2e36['field'](_0x244c('0x99'));_0x3a2e36[_0x244c('0x43')](_0x244c('0x9a'));_0x3a2e36['field'](_0x244c('0x9b'));_0x3a2e36[_0x244c('0x43')]('i.attach');_0x3a2e36[_0x244c('0x43')]('i.lastMsgAt');_0x3a2e36['field'](_0x244c('0x9c'));_0x3a2e36['field'](_0x244c('0x9d'));_0x3a2e36[_0x244c('0x43')](_0x244c('0x9e'));_0x3a2e36[_0x244c('0x43')](_0x244c('0x9f'));_0x3a2e36[_0x244c('0x43')](_0x244c('0xa0'));_0x3a2e36[_0x244c('0x43')](_0x244c('0xa1'));_0x3a2e36[_0x244c('0x43')](_0x244c('0xa2'));_0x3a2e36['field'](_0x244c('0xa3'));_0x3a2e36[_0x244c('0x43')](_0x244c('0xa4'));_0x3a2e36[_0x244c('0x43')](_0x244c('0xa5'));_0x3a2e36[_0x244c('0x43')](_0x244c('0xa6'),'Contact.firstName');_0x3a2e36['field'](_0x244c('0xa7'),'Contact.lastName');_0x3a2e36[_0x244c('0x43')](_0x244c('0xa8'),_0x244c('0xa9'));_0x3a2e36[_0x244c('0x43')](_0x244c('0xaa'),_0x244c('0xab'));_0x3a2e36[_0x244c('0x43')]('c.mobile','Contact.mobile');_0x3a2e36[_0x244c('0x43')](_0x244c('0xac'),_0x244c('0xad'));_0x3a2e36[_0x244c('0x43')](_0x244c('0xae'),_0x244c('0xaf'));_0x3a2e36[_0x244c('0x43')](_0x244c('0xb0'),'Owner.internal');_0x3a2e36[_0x244c('0x43')](_0x244c('0xb1'),'TagIds');}if(_0x58ba1e[_0x244c('0x14')])_0x3a2e36['limit'](_0x58ba1e[_0x244c('0x14')]);if(_0x58ba1e[_0x244c('0x13')])_0x3a2e36[_0x244c('0x13')](_0x58ba1e[_0x244c('0x13')]);return db['sequelize'][_0x244c('0x37')](_0x3a2e36[_0x244c('0x91')](),_0x597a25);})['then'](function(_0x16b752){if(_0x16b752['length']>0x0)_0x88a54b['where'](_0x244c('0xb2'),_[_0x244c('0x1d')](_0x16b752,'id'));return db[_0x244c('0x90')]['query'](_0x88a54b[_0x244c('0x91')](),_0x597a25)[_0x244c('0x18')](function(_0x50ff0c){var _0x22f704=_[_0x244c('0xb3')](_0x50ff0c,_0x244c('0xb4'));var _0x43df8d=[];return db['Setting']['findOne']({'attributes':[_0x244c('0xb5')],'raw':!![]})[_0x244c('0x18')](function(_0x3438b4){var _0x52a47b=_0x3438b4[_0x244c('0xb5')];_0x16b752[_0x244c('0x22')](function(_0x2c74ae){_0x43df8d[_0x244c('0x23')](updateMailInteraction(_0x2c74ae,_0x50088c,_0x22f704,_0x52a47b));});return BPromise[_0x244c('0xb6')](_0x43df8d);});});});})['then'](function(_0x1d24ae){_0x28f93a[_0x244c('0xb7')]=_0x1d24ae;return _0x28f93a;})[_0x244c('0x18')](respondWithFilteredResult(_0x49bff7,_0x58ba1e))['catch'](handleError(_0x49bff7,null));};exports[_0x244c('0xb8')]=function(_0x41f6c8,_0x122c76){var _0x44d6ef={'raw':![],'where':{'id':_0x41f6c8[_0x244c('0xb9')]['id']}},_0x2e6f6e={};_0x2e6f6e[_0x244c('0x36')]=_['keys'](db['MailInteraction']['rawAttributes']);_0x2e6f6e[_0x244c('0x37')]=_[_0x244c('0xba')](_0x41f6c8[_0x244c('0x37')]);_0x2e6f6e[_0x244c('0x38')]=_['intersection'](_0x2e6f6e[_0x244c('0x36')],_0x2e6f6e[_0x244c('0x37')]);_0x44d6ef[_0x244c('0x39')]=_['intersection'](_0x2e6f6e[_0x244c('0x36')],qs['fields'](_0x41f6c8[_0x244c('0x37')][_0x244c('0x3b')]));_0x44d6ef['attributes']=_0x44d6ef[_0x244c('0x39')]['length']?_0x44d6ef[_0x244c('0x39')]:_0x2e6f6e[_0x244c('0x36')];if(_0x41f6c8[_0x244c('0x37')][_0x244c('0xbb')]){_0x44d6ef[_0x244c('0xbc')]=[{'all':!![]}];}_0x44d6ef=_[_0x244c('0x93')]({},_0x44d6ef,_0x41f6c8['options']);return db[_0x244c('0x94')][_0x244c('0x59')](_0x44d6ef)['then'](handleEntityNotFound(_0x122c76,null))[_0x244c('0x18')](respondWithResult(_0x122c76,null))[_0x244c('0x2b')](handleError(_0x122c76,null));};exports[_0x244c('0xbd')]=function(_0x350e40,_0x40200f){return db[_0x244c('0x94')][_0x244c('0xbd')](_0x350e40['body'],{})[_0x244c('0x18')](respondWithResult(_0x40200f,0xc9))[_0x244c('0x2b')](handleError(_0x40200f,null));};exports['update']=function(_0x5143e3,_0x46b264){if(_0x5143e3[_0x244c('0xbe')]['id']){delete _0x5143e3[_0x244c('0xbe')]['id'];}return db['MailInteraction'][_0x244c('0x59')]({'where':{'id':_0x5143e3['params']['id']}})[_0x244c('0x18')](handleEntityNotFound(_0x46b264,null))[_0x244c('0x18')](saveUpdates(_0x5143e3['body'],null))[_0x244c('0x18')](respondWithResult(_0x46b264,null))['catch'](handleError(_0x46b264,null));};exports['destroy']=function(_0x1367fd,_0xadd8a7){return db[_0x244c('0x94')]['find']({'where':{'id':_0x1367fd['params']['id']}})[_0x244c('0x18')](handleEntityNotFound(_0xadd8a7,null))['then'](removeEntity(_0xadd8a7,null))[_0x244c('0x2b')](handleError(_0xadd8a7,null));};exports[_0x244c('0xbf')]=function(_0x47db61,_0x44e2af){return db[_0x244c('0x94')]['describe']()[_0x244c('0x18')](respondWithResult(_0x44e2af,null))['catch'](handleError(_0x44e2af,null));};exports['addMessage']=function(_0x299fb8,_0x55e94b){return db['MailMessage']['find']({'where':{'id':_0x299fb8['params']['id']}})['then'](handleEntityNotFound(_0x55e94b,null))[_0x244c('0x18')](function(_0x49dc73){if(_0x49dc73){return _0x49dc73['addMessage'](_0x299fb8[_0x244c('0xbe')][_0x244c('0xc0')],_[_0x244c('0xc1')](_0x299fb8[_0x244c('0xbe')],[_0x244c('0xc0'),'id'])||{});}})['then'](respondWithResult(_0x55e94b,null))['catch'](handleError(_0x55e94b,null));};exports[_0x244c('0xc2')]=function(_0x5860a1,_0x457c19){var _0x3c2a78={'raw':![],'where':{}};var _0x5428fa={};var _0x10a9fd={'count':0x0,'rows':[]};return db['MailInteraction'][_0x244c('0x25')]({'where':{'id':_0x5860a1[_0x244c('0xb9')]['id']}})[_0x244c('0x18')](handleEntityNotFound(_0x457c19,null))['then'](function(_0x160f0e){if(_0x160f0e){_0x5428fa['model']=_[_0x244c('0xba')](db[_0x244c('0x24')][_0x244c('0x34')]);_0x5428fa[_0x244c('0x37')]=_[_0x244c('0xba')](_0x5860a1[_0x244c('0x37')]);_0x5428fa[_0x244c('0x38')]=_[_0x244c('0x3a')](_0x5428fa[_0x244c('0x36')],_0x5428fa[_0x244c('0x37')]);_0x3c2a78['attributes']=_['intersection'](_0x5428fa[_0x244c('0x36')],qs[_0x244c('0x3b')](_0x5860a1[_0x244c('0x37')]['fields']));_0x3c2a78[_0x244c('0x39')]=_0x3c2a78['attributes'][_0x244c('0x3c')]?_0x3c2a78[_0x244c('0x39')]:_0x5428fa['model'];if(!_0x5860a1['query'][_0x244c('0x3d')](_0x244c('0x3e'))){_0x3c2a78[_0x244c('0x14')]=qs[_0x244c('0x14')](_0x5860a1['query'][_0x244c('0x14')]);_0x3c2a78[_0x244c('0x13')]=qs[_0x244c('0x13')](_0x5860a1[_0x244c('0x37')][_0x244c('0x13')]);}_0x3c2a78[_0x244c('0x3f')]=qs[_0x244c('0x40')](_0x5860a1[_0x244c('0x37')][_0x244c('0x40')]);_0x3c2a78['where']=qs[_0x244c('0x38')](_[_0x244c('0x41')](_0x5860a1['query'],_0x5428fa[_0x244c('0x38')]));_0x3c2a78[_0x244c('0x6d')][_0x244c('0xb4')]=_0x160f0e['id'];if(_0x5860a1[_0x244c('0x37')][_0x244c('0x78')]){_0x3c2a78[_0x244c('0x6d')]=_[_0x244c('0x93')](_0x3c2a78[_0x244c('0x6d')],{'$or':_['map'](_0x3c2a78[_0x244c('0x39')],function(_0x45c3de){var _0x1a141f={};_0x1a141f[_0x45c3de]={'$like':'%'+_0x5860a1[_0x244c('0x37')]['filter']+'%'};return _0x1a141f;})});}if(_0x5860a1[_0x244c('0x37')][_0x244c('0x6f')]){var _0x322bfb=_0x5860a1[_0x244c('0x37')][_0x244c('0x6f')][_0x244c('0x21')](',');var _0x403704={};_0x403704[_0x322bfb[0x0]]={'$gte':moment(_0x322bfb[0x1])[_0x244c('0xc3')](_0x244c('0xc4'))};_0x3c2a78[_0x244c('0x6d')]=_[_0x244c('0x93')](_0x3c2a78[_0x244c('0x6d')],_0x403704);}_0x3c2a78=_[_0x244c('0x93')]({},_0x3c2a78,_0x5860a1[_0x244c('0xc5')]);return db[_0x244c('0x24')][_0x244c('0x15')]({'where':_0x3c2a78[_0x244c('0x6d')]})[_0x244c('0x18')](function(_0x260f2a){_0x10a9fd['count']=_0x260f2a;if(_0x5860a1['query']['includeAll']){_0x3c2a78[_0x244c('0xbc')]=[{'all':!![]}];}return db[_0x244c('0x24')][_0x244c('0xc6')](_0x3c2a78);})[_0x244c('0x18')](function(_0x2373f5){if(_0x5860a1[_0x244c('0x37')][_0x244c('0xc7')]===_0x244c('0xc8')){for(var _0x112dad=0x0;_0x112dad<_0x2373f5[_0x244c('0x3c')];_0x112dad++){_0x2373f5[_0x112dad][_0x244c('0xbe')]=juice(_0x2373f5[_0x112dad]['body']);}}_0x10a9fd[_0x244c('0xb7')]=_0x2373f5;return _0x10a9fd;});}})[_0x244c('0x18')](respondWithFilteredResult(_0x457c19,_0x3c2a78))[_0x244c('0x2b')](handleError(_0x457c19,null));};exports[_0x244c('0xc9')]=function(_0x4650a6,_0x2d1a9b){return db[_0x244c('0x94')][_0x244c('0x59')]({'where':{'id':_0x4650a6[_0x244c('0xb9')]['id']}})[_0x244c('0x18')](handleEntityNotFound(_0x2d1a9b,null))['then'](function(_0x3158c3){if(_0x3158c3){return _0x3158c3[_0x244c('0xca')](_0x4650a6[_0x244c('0xbe')][_0x244c('0xc0')],_[_0x244c('0xc1')](_0x4650a6[_0x244c('0xbe')],[_0x244c('0xc0'),'id'])||{})['spread'](function(){return db[_0x244c('0xcb')]['findAll']({'attributes':['id','name','color'],'where':{'id':_0x4650a6[_0x244c('0xbe')]['ids']}});})[_0x244c('0x18')](function(_0x333e48){socket['emit']('mailInteractionTags:save',{'id':Number(_0x4650a6[_0x244c('0xb9')]['id']),'tags':_0x333e48||[]});return{'id':Number(_0x4650a6[_0x244c('0xb9')]['id']),'tags':_0x333e48||[]};});}})[_0x244c('0x18')](respondWithResult(_0x2d1a9b,null))[_0x244c('0x2b')](handleError(_0x2d1a9b,null));};exports[_0x244c('0xcc')]=function(_0x496311,_0xe12c5f){return db[_0x244c('0x94')][_0x244c('0x59')]({'where':{'id':_0x496311['params']['id']}})[_0x244c('0x18')](handleEntityNotFound(_0xe12c5f,null))[_0x244c('0x18')](function(_0x56814b){if(_0x56814b){return _0x56814b[_0x244c('0xcc')](_0x496311[_0x244c('0x37')][_0x244c('0xc0')]);}})[_0x244c('0x18')](respondWithStatusCode(_0xe12c5f,null))[_0x244c('0x2b')](handleError(_0xe12c5f,null));};exports[_0x244c('0xcd')]=function(_0x2d3a79,_0x37737e){var _0x393619=moment()[_0x244c('0xce')]()[_0x244c('0x91')]();var _0x522605=path['join'](config[_0x244c('0xcf')],_0x244c('0xd0'),_0x244c('0xd1'),'tmp');var _0x95094e=path[_0x244c('0xd2')](config[_0x244c('0xcf')],_0x244c('0xd0'),'files','attachments');var _0x40408b=path['join'](_0x522605,_0x393619);var _0x39e52f=util[_0x244c('0xc3')]('transcript-%d-%s.zip',_0x2d3a79['params']['id'],_0x393619);var _0x113ea3=path[_0x244c('0xd2')](_0x522605,_0x39e52f);var _0x37df0b=[];if(_0x2d3a79[_0x244c('0x37')][_0x244c('0xd3')]){_0x37df0b[_0x244c('0x23')]({'model':db[_0x244c('0xd4')],'as':_0x244c('0xd5'),'raw':!![]});}var _0x3a8605=[{'model':db['MailMessage'],'as':'Messages','attributes':['id',_0x244c('0xbe'),_0x244c('0x45'),'to','cc',_0x244c('0xd6'),_0x244c('0xd7'),_0x244c('0xd8')],'where':{'secret':![]},'order':qs[_0x244c('0x40')]('id'),'include':_0x37df0b}];return db[_0x244c('0x94')][_0x244c('0x59')]({'where':{'id':_0x2d3a79['params']['id']},'include':_0x3a8605})['then'](handleEntityNotFound(_0x37737e,null))['then'](function(_0x4fe419){if(_0x4fe419&&_0x4fe419[_0x244c('0xd9')]){var _0x15a616=_0x4fe419[_0x244c('0xda')]({'plain':!![]});fs[_0x244c('0xdb')](_0x40408b);return BPromise[_0x244c('0xdc')](_0x15a616[_0x244c('0xd9')],function(_0x21ec78,_0x3e1cc7){var _0x13804e={'from':_0x21ec78[_0x244c('0x45')],'to':_0x21ec78['to'],'subject':_0x21ec78['subject'],'html':htmlEntities[_0x244c('0xdd')](_0x21ec78['body']),'headers':{'Date':moment(_0x21ec78[_0x244c('0xd8')])['format'](_0x244c('0xde'))},'attachments':[]};if(_0x21ec78['cc']){_0x13804e[_0x244c('0xdf')]['Cc']=_0x21ec78['cc'];}if(_0x21ec78[_0x244c('0xd6')]){_0x13804e[_0x244c('0xdf')][_0x244c('0xe0')]=_0x21ec78['bcc'];}return new BPromise(function(_0x143193,_0x357ee8){if(_0x21ec78[_0x244c('0xd5')]){for(var _0x518d4f=0x0;_0x518d4f<_0x21ec78['Attachments'][_0x244c('0x3c')];_0x518d4f++){var _0xe7ad4b=_0x21ec78[_0x244c('0xd5')][_0x518d4f];var _0x4bc00d=path['join'](_0x95094e,_0xe7ad4b[_0x244c('0xe1')]);if(fs[_0x244c('0xe2')](_0x4bc00d)){_0x13804e[_0x244c('0xd3')]['push']({'name':_0xe7ad4b[_0x244c('0x1a')],'contentType':_0xe7ad4b[_0x244c('0x35')],'data':fs[_0x244c('0xe3')](_0x4bc00d)});}}}emlformat[_0x244c('0xe4')](_0x13804e,function(_0x145a72,_0x9018c1){if(_0x145a72)return _0x357ee8(_0x145a72);fs[_0x244c('0xe5')](path['join'](_0x40408b,util[_0x244c('0xc3')](_0x244c('0xe6'),_0x3e1cc7)),_0x9018c1);return _0x143193(_0x9018c1);});});})[_0x244c('0x18')](function(){return new BPromise(function(_0x697258,_0xc19b5){zipdir(_0x40408b,{'saveTo':_0x113ea3},function(_0x40d9f6,_0x219bc6){if(_0x40d9f6)return _0xc19b5(_0x40d9f6);return _0x697258(_0x219bc6);});})[_0x244c('0x18')](function(){return new BPromise(function(_0x20e666,_0x2f24cf){rimraf(_0x40408b,function(_0xaedc3a){if(_0xaedc3a)_0x2f24cf(_0xaedc3a);return _0x20e666();});});})[_0x244c('0x18')](function(){return _0x37737e[_0x244c('0xcd')](_0x113ea3,_0x39e52f,function(_0x480f66){if(!_0x480f66)fs['unlinkSync'](_0x113ea3);});});});}else{return _0x37737e['sendStatus'](0xc8);}})[_0x244c('0x2b')](handleError(_0x37737e,null));}; \ No newline at end of file +var _0x6c45=['intersection','fields','length','model','hasOwnProperty','order','sort','where','select','field','from','u.id','u.fullname','user_has_mail_interactions','left_join','users','u.id\x20=\x20ui.UserId','cm_contacts','mail_accounts','a.id\x20=\x20i.MailAccountId','mail_messages','it.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','sqlOperator','conditions','unreadMessages','having','`\x20>\x200','operator','$substring','value','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','find','ContactId','buildExpression','text','start','Tag','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','some','compact','isEmpty','MailAccountId','i.MailAccountId\x20IN\x20?','concat','createdAt','parse','$gte','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','isArray','tag','filter','isNumeric','i.id\x20LIKE\x20?','c.email\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','i.MailAccountId\x20IS\x20NOT\x20NULL','agent','getMailAccounts','i.MailAccountId\x20IS\x20NULL','user','role','toString','sequelize','merge','MailInteraction','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.lastMsgDirection','i.subject','i.disposition','i.secondDisposition','i.thirdDisposition','i.substatus','i.to','i.ContactId','i.MailAccountId','Contact.lastName','Contact.email','c.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','groupBy','MailInteractionId','Setting','enableEmailPreview','all','rows','show','params','filters','includeAll','include','options','create','body','destroy','describe','addMessage','MailMessage','ids','omit','getMessages','nolimit','pick','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','addTags','setTags','spread','color','emit','mailInteractionTags:save','removeTags','download','unix','join','server','files','tmp','root','attachments','transcript-%d-%s.zip','Attachment','Attachments','Messages','bcc','subject','get','mkdirSync','each','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','existsSync','readFileSync','build','writeFileSync','message%d.eml','unlinkSync','eml-format','rimraf','moment','bluebird','util','path','lodash','squel','juice','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','html-entities','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','update','then','error','stack','name','send','Users','fullname','TagIds','Tags','push','findOne','out','plainBody','trimStart','catch','waiting','talking','answered','unmanaged','total','closed','UserId','index','map','rawAttributes','type','key','query','keys','attributes'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x6c45,0xb1));var _0x56c4=function(_0x40aa8a,_0x3a1309){_0x40aa8a=_0x40aa8a-0x0;var _0x5ea886=_0x6c45[_0x40aa8a];return _0x5ea886;};'use strict';var emlformat=require(_0x56c4('0x0'));var rimraf=require(_0x56c4('0x1'));var zipdir=require('zip-dir');var moment=require(_0x56c4('0x2'));var BPromise=require(_0x56c4('0x3'));var util=require(_0x56c4('0x4'));var path=require(_0x56c4('0x5'));var fs=require('fs');var _=require(_0x56c4('0x6'));var squel=require(_0x56c4('0x7'));var juice=require(_0x56c4('0x8'));var Redis=require(_0x56c4('0x9'));var qs=require(_0x56c4('0xa'));var as=require(_0x56c4('0xb'));var logger=require(_0x56c4('0xc'))(_0x56c4('0xd'));var config=require(_0x56c4('0xe'));var db=require(_0x56c4('0xf'))['db'];var htmlEntities=require(_0x56c4('0x10'));config[_0x56c4('0x11')]=_[_0x56c4('0x12')](config[_0x56c4('0x11')],{'host':_0x56c4('0x13'),'port':0x18eb});var socket=require(_0x56c4('0x14'))(new Redis(config['redis']));require(_0x56c4('0x15'))[_0x56c4('0x16')](socket);function respondWithStatusCode(_0x311519,_0x108338){_0x108338=_0x108338||0xcc;return function(_0x4ed446){if(_0x4ed446){return _0x311519[_0x56c4('0x17')](_0x108338);}return _0x311519[_0x56c4('0x18')](_0x108338)[_0x56c4('0x19')]();};}function respondWithResult(_0x39de9c,_0x51fb33){_0x51fb33=_0x51fb33||0xc8;return function(_0x6d9810){if(_0x6d9810){return _0x39de9c['status'](_0x51fb33)['json'](_0x6d9810);}};}function respondWithFilteredResult(_0x2cb56e,_0xec63c0){return function(_0x4602b2){if(_0x4602b2){var _0x1f9bfb=typeof _0xec63c0[_0x56c4('0x1a')]==='undefined'&&typeof _0xec63c0[_0x56c4('0x1b')]===_0x56c4('0x1c');var _0x533968=_0x4602b2[_0x56c4('0x1d')];var _0xd0dd01=_0x1f9bfb?0x0:_0xec63c0[_0x56c4('0x1a')];var _0x2f0bb2=_0x1f9bfb?_0x4602b2['count']:_0xec63c0[_0x56c4('0x1a')]+_0xec63c0[_0x56c4('0x1b')];var _0x56324c;if(_0x2f0bb2>=_0x533968){_0x2f0bb2=_0x533968;_0x56324c=0xc8;}else{_0x56324c=0xce;}_0x2cb56e[_0x56c4('0x18')](_0x56324c);return _0x2cb56e[_0x56c4('0x1e')](_0x56c4('0x1f'),_0xd0dd01+'-'+_0x2f0bb2+'/'+_0x533968)[_0x56c4('0x20')](_0x4602b2);}return null;};}function saveUpdates(_0x4d6871){return function(_0x100a6e){if(_0x100a6e){return _0x100a6e[_0x56c4('0x21')](_0x4d6871)[_0x56c4('0x22')](function(_0x7a7612){return _0x7a7612;});}return null;};}function removeEntity(_0x35108){return function(_0x18a1b9){if(_0x18a1b9){return _0x18a1b9['destroy']()['then'](function(){_0x35108[_0x56c4('0x18')](0xcc)[_0x56c4('0x19')]();});}};}function handleEntityNotFound(_0x4cb83b){return function(_0x1cf6fc){if(!_0x1cf6fc){_0x4cb83b[_0x56c4('0x17')](0x194);}return _0x1cf6fc;};}function handleError(_0x10eae6,_0x23b11e){_0x23b11e=_0x23b11e||0x1f4;return function(_0x299dbc){logger[_0x56c4('0x23')](_0x299dbc[_0x56c4('0x24')]);if(_0x299dbc['name']){delete _0x299dbc[_0x56c4('0x25')];}_0x10eae6[_0x56c4('0x18')](_0x23b11e)[_0x56c4('0x26')](_0x299dbc);};}function getInteractionUsers(_0x5e7da1,_0xc8ed28){return new BPromise(function(_0x4d1d9c,_0x213cc6){try{if(_0xc8ed28[_0x5e7da1['id']]){_0x5e7da1[_0x56c4('0x27')]=_['map'](_0xc8ed28[_0x5e7da1['id']],function(_0x148268){return{'id':_0x148268['id'],'fullname':_0x148268[_0x56c4('0x28')]};});}}catch(_0x51dcf8){_0x213cc6(_0x51dcf8);}_0x4d1d9c(_0x5e7da1);});}function getInteractionTags(_0x4c4a8c,_0x57fa1c){return new BPromise(function(_0x23fadb,_0x2ac814){try{if(_0x4c4a8c[_0x56c4('0x29')]){_0x4c4a8c['Tags']=[];_0x4c4a8c[_0x56c4('0x29')]['split'](',')['forEach'](function(_0x5f9cc){_0x4c4a8c[_0x56c4('0x2a')][_0x56c4('0x2b')](_0x57fa1c[_0x5f9cc]);});}delete _0x4c4a8c[_0x56c4('0x29')];}catch(_0x3f9cc0){_0x2ac814(_0x3f9cc0);}_0x23fadb(_0x4c4a8c);});}function getLastMessageText(_0x431f48){return new BPromise(function(_0x49f0c2,_0x3c8db4){return db['MailMessage'][_0x56c4('0x2c')]({'where':{'$and':[{'MailInteractionId':_0x431f48['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x56c4('0x2d')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x56c4('0x2e')],'order':'-id','raw':!![]})[_0x56c4('0x22')](function(_0x367fec){if(_0x367fec&&_0x367fec[_0x56c4('0x2e')]){_0x431f48['lastMsgText']=_[_0x56c4('0x2f')](_0x367fec[_0x56c4('0x2e')]);}_0x49f0c2(_0x431f48);})['catch'](function(_0x3de2e7){_0x3c8db4(_0x3de2e7);});});}function updateMailInteraction(_0x5f1e92,_0x266aa6,_0x4157cd,_0x39a52e){return new BPromise(function(_0x513492,_0x2dfa7b){return getInteractionUsers(_0x5f1e92,_0x4157cd)['then'](function(_0x5533cc){return getInteractionTags(_0x5533cc,_0x266aa6);})[_0x56c4('0x22')](function(_0x110e97){return getStateInteraction(_0x110e97);})[_0x56c4('0x22')](function(_0x33a9e7){if(_0x39a52e){_0x513492(getLastMessageText(_0x33a9e7));}else{_0x513492(_0x33a9e7);}})[_0x56c4('0x30')](function(_0x4abe0f){_0x2dfa7b(_0x4abe0f);});});}function getStateInteraction(_0x25e822){return new BPromise(function(_0x3bea12){_0x25e822[_0x56c4('0x31')]=0x0;_0x25e822[_0x56c4('0x32')]=0x0;_0x25e822[_0x56c4('0x33')]=0x0;_0x25e822[_0x56c4('0x34')]=0x0;_0x25e822[_0x56c4('0x35')]=0x0;if(!_0x25e822['closed']&&!_0x25e822['UserId']){_0x25e822[_0x56c4('0x31')]+=0x1;}if(!_0x25e822[_0x56c4('0x36')]&&_0x25e822[_0x56c4('0x37')]){_0x25e822[_0x56c4('0x32')]+=0x1;if(_0x25e822[_0x56c4('0x31')]){_0x25e822['waiting']-=0x1;}}if(_0x25e822['closed']&&_0x25e822[_0x56c4('0x37')]){_0x25e822['answered']+=0x1;if(_0x25e822[_0x56c4('0x32')]){_0x25e822[_0x56c4('0x32')]-=0x1;}}if(_0x25e822[_0x56c4('0x36')]&&!_0x25e822[_0x56c4('0x37')]){_0x25e822['unmanaged']+=0x1;if(_0x25e822[_0x56c4('0x31')]){_0x25e822[_0x56c4('0x31')]-=0x1;}}_0x25e822[_0x56c4('0x35')]+=0x1;_0x3bea12(_0x25e822);});}exports[_0x56c4('0x38')]=function(_0x4ec104,_0xf2bdac){var _0x120713={},_0x5bdf0a={},_0x5c37a6={'count':0x0,'rows':[]};var _0x1db591=_[_0x56c4('0x39')](db['MailInteraction'][_0x56c4('0x3a')],function(_0x22e900){return{'name':_0x22e900['fieldName'],'type':_0x22e900[_0x56c4('0x3b')][_0x56c4('0x3c')]};});_0x5bdf0a['model']=_['map'](_0x1db591,_0x56c4('0x25'));_0x5bdf0a[_0x56c4('0x3d')]=_[_0x56c4('0x3e')](_0x4ec104[_0x56c4('0x3d')]);_0x5bdf0a['filters']=_['intersection'](_0x5bdf0a['model'],_0x5bdf0a[_0x56c4('0x3d')]);_0x120713[_0x56c4('0x3f')]=_[_0x56c4('0x40')](_0x5bdf0a['model'],qs[_0x56c4('0x41')](_0x4ec104[_0x56c4('0x3d')]['fields']));_0x120713[_0x56c4('0x3f')]=_0x120713[_0x56c4('0x3f')][_0x56c4('0x42')]?_0x120713[_0x56c4('0x3f')]:_0x5bdf0a[_0x56c4('0x43')];if(!_0x4ec104[_0x56c4('0x3d')][_0x56c4('0x44')]('nolimit')){_0x120713['limit']=qs[_0x56c4('0x1b')](_0x4ec104['query']['limit']);_0x120713[_0x56c4('0x1a')]=qs['offset'](_0x4ec104[_0x56c4('0x3d')][_0x56c4('0x1a')]);}_0x120713[_0x56c4('0x45')]=qs[_0x56c4('0x46')](_0x4ec104['query'][_0x56c4('0x46')]);_0x120713[_0x56c4('0x47')]=qs['filters'](_['pick'](_0x4ec104['query'],_0x5bdf0a['filters']),_0x1db591);var _0x2651aa=[];var _0x4b1304=squel[_0x56c4('0x48')]()['field']('id')[_0x56c4('0x49')]('name')[_0x56c4('0x49')]('color')[_0x56c4('0x4a')]('tools_tags');var _0x5950e5=squel[_0x56c4('0x48')]()[_0x56c4('0x49')](_0x56c4('0x4b'))[_0x56c4('0x49')](_0x56c4('0x4c'))[_0x56c4('0x49')]('ui.MailInteractionId')[_0x56c4('0x4a')](_0x56c4('0x4d'),'ui')[_0x56c4('0x4e')](_0x56c4('0x4f'),'u',_0x56c4('0x50'));var _0x1ca0fc=squel[_0x56c4('0x48')]()[_0x56c4('0x4a')]('mail_interactions','i')[_0x56c4('0x4e')](_0x56c4('0x51'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x56c4('0x4e')](_0x56c4('0x4f'),'o','o.id\x20=\x20i.UserId')[_0x56c4('0x4e')](_0x56c4('0x52'),'a',_0x56c4('0x53'))[_0x56c4('0x4e')](_0x56c4('0x54'),'me','me.MailInteractionId\x20=\x20i.id')[_0x56c4('0x4e')]('mail_interaction_has_tags','it',_0x56c4('0x55'))[_0x56c4('0x4e')]('tools_tags','t',_0x56c4('0x56'));var _0x2f7193=squel[_0x56c4('0x57')]();var _0x55b81f=[];var _0x3578f5=squel[_0x56c4('0x57')]();var _0x3cfc7f;if(_0x4ec104['query']['search']){_0x3cfc7f=as[_0x56c4('0x58')](_0x4ec104[_0x56c4('0x3d')]['search']);var _0x1bba97=_0x3cfc7f[_0x56c4('0x59')];for(var _0x192761=0x0;_0x192761<_0x3cfc7f[_0x56c4('0x5a')]['length'];_0x192761++){var _0x2c2c69=_0x3cfc7f[_0x56c4('0x5a')][_0x192761];var _0x29410e='i';var _0x15981c=_['find'](_0x1db591,[_0x56c4('0x25'),_0x2c2c69['field']]);if(!_0x15981c){switch(_0x2c2c69[_0x56c4('0x49')]){case _0x56c4('0x5b'):if(_0x2c2c69['value']==0x1){_0x1ca0fc[_0x56c4('0x5c')]('`'+_0x2c2c69[_0x56c4('0x49')]+'`\x20=\x200');}else{_0x1ca0fc['having']('`'+_0x2c2c69[_0x56c4('0x49')]+_0x56c4('0x5d'));}break;case'Contact':if(_0x2c2c69[_0x56c4('0x5e')]===_0x56c4('0x5f')){if(_0x2c2c69[_0x56c4('0x60')][_0x56c4('0x61')]('\x20')[_0x56c4('0x42')]>0x1){_0x2f7193[_0x1bba97](_0x56c4('0x62'),qs[_0x56c4('0x63')](_0x2c2c69[_0x56c4('0x60')]),null);}else{var _0x2d1f86='%'+_0x2c2c69[_0x56c4('0x60')]+'%';_0x2f7193[_0x1bba97]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x2d1f86,_0x2d1f86,_0x2d1f86);}}else{_0x15981c=_[_0x56c4('0x64')](_0x1db591,[_0x56c4('0x25'),_0x56c4('0x65')]);_0x2c2c69[_0x56c4('0x49')]=_0x56c4('0x65');_0xa807be=as[_0x56c4('0x66')](_0x29410e,_0x15981c[_0x56c4('0x3b')],_0x2c2c69);_0x2f7193[_0x1bba97](_0xa807be[_0x56c4('0x67')],_0xa807be[_0x56c4('0x60')][_0x56c4('0x68')],_0xa807be['value'][_0x56c4('0x19')]);}break;case _0x56c4('0x69'):var _0x39e86f=_0x2c2c69['value'][_0x56c4('0x61')](',')['map'](function(_0x41643d){return Number(_0x41643d);});_0x39e86f[_0x56c4('0x6a')](function(_0x403c44){_0x3578f5['or'](_0x56c4('0x6b'),'%,'+_0x403c44+',%');});_0x55b81f=_[_0x56c4('0x6c')](_0x55b81f,_0x39e86f);break;case _0x56c4('0x6d'):if(_0x2c2c69[_0x56c4('0x5e')]===_0x56c4('0x5f')){_0x2f7193[_0x1bba97](_0x56c4('0x6e'),'%'+_0x2c2c69['value']+'%',null);}else{_0x15981c=_[_0x56c4('0x64')](_0x1db591,['name','UserId']);_0x2c2c69[_0x56c4('0x49')]=_0x56c4('0x37');_0xa807be=as['buildExpression'](_0x29410e,_0x15981c[_0x56c4('0x3b')],_0x2c2c69);_0x2f7193[_0x1bba97](_0xa807be['text'],_0xa807be['value'][_0x56c4('0x68')],_0xa807be[_0x56c4('0x60')]['end']);}break;case _0x56c4('0x2e'):_0xa807be=as[_0x56c4('0x66')]('me',null,_0x2c2c69);_0x2f7193[_0x1bba97](_0xa807be[_0x56c4('0x67')],_0xa807be[_0x56c4('0x60')][_0x56c4('0x68')],_0xa807be[_0x56c4('0x60')][_0x56c4('0x19')]);break;}}else{var _0xa807be=as['buildExpression'](_0x29410e,_0x15981c[_0x56c4('0x3b')],_0x2c2c69);_0x2f7193[_0x1bba97](_0xa807be[_0x56c4('0x67')],_0xa807be['value'][_0x56c4('0x68')],_0xa807be['value']['end']);}}}else{var _0x3bf1ea=_(_0x4ec104[_0x56c4('0x3d')])[_0x56c4('0x3e')]()[_0x56c4('0x39')](function(_0x49fb8c){return _[_0x56c4('0x6f')](_0x1db591,[_0x56c4('0x25'),_0x49fb8c])?_0x49fb8c:undefined;})[_0x56c4('0x70')]()[_0x56c4('0x60')]();if(!_[_0x56c4('0x71')](_0x3bf1ea)){_0x3bf1ea[_0x56c4('0x6a')](function(_0x2a4f44){if(_0x2a4f44===_0x56c4('0x72')){_0x1ca0fc['where'](_0x56c4('0x73'),[][_0x56c4('0x74')](_0x4ec104[_0x56c4('0x3d')][_0x2a4f44]));}else if(_0x2a4f44===_0x56c4('0x75')){var _0x4db4ce=JSON[_0x56c4('0x76')](_0x4ec104['query'][_0x2a4f44])[_0x56c4('0x77')];var _0x4b0d9c=JSON['parse'](_0x4ec104[_0x56c4('0x3d')][_0x2a4f44])['$lte'];_0x1ca0fc['where']('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x4db4ce,_0x4b0d9c);}else{if(_0x4ec104['query'][_0x2a4f44]===_0x56c4('0x78')){_0x1ca0fc[_0x56c4('0x47')]('i.'+_0x2a4f44+_0x56c4('0x79'));}else{_0x1ca0fc['where']('i.'+_0x2a4f44+_0x56c4('0x7a'),_0x4ec104['query'][_0x2a4f44]);}}});}if(_0x4ec104[_0x56c4('0x3d')]['read']){if(_0x4ec104[_0x56c4('0x3d')][_0x56c4('0x7b')]==0x1){_0x1ca0fc[_0x56c4('0x5c')]('`unreadMessages`\x20=\x200');}else{_0x1ca0fc[_0x56c4('0x5c')](_0x56c4('0x7c'));}}if(_0x4ec104['query']['tag']){_0x55b81f=_[_0x56c4('0x7d')](_0x4ec104[_0x56c4('0x3d')]['tag'])?_0x4ec104[_0x56c4('0x3d')][_0x56c4('0x7e')]:new Array(_0x4ec104['query']['tag']);_0x55b81f['forEach'](function(_0x21c9ff){_0x3578f5['or'](_0x56c4('0x6b'),'%,'+_0x21c9ff+',%');});}if(_0x4ec104[_0x56c4('0x3d')]['filter']){var _0x355abc=_0x4ec104[_0x56c4('0x3d')][_0x56c4('0x7f')]['replace']('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x56c4('0x80')](_0x355abc)){_0x2f7193['or'](_0x56c4('0x81'),_0x355abc+'%');}else if(qs['isEmail'](_0x355abc)){_0x2f7193['or'](_0x56c4('0x82'),_0x355abc+'%');}else{_0x2f7193['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x355abc))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x56c4('0x63')](_0x355abc));}}}_0x1ca0fc[_0x56c4('0x47')](_0x2f7193);_0x1ca0fc[_0x56c4('0x83')](_0x56c4('0x84'));var _0xc82779={'type':db[_0x56c4('0x85')][_0x56c4('0x86')][_0x56c4('0x87')],'raw':!![]};var _0x57e8dc=_0x1ca0fc[_0x56c4('0x88')]();_0x57e8dc[_0x56c4('0x49')]('i.id');_0x57e8dc[_0x56c4('0x49')](_0x56c4('0x89'),_0x56c4('0x5b'));if(_0x120713[_0x56c4('0x45')]){_0x120713['order'][_0x56c4('0x6a')](function(_0x8b83be){var _0x5568ad=_0x8b83be[0x0]==='contactName'?_0x8b83be[0x0]:'i.'+_0x8b83be[0x0];_0x1ca0fc[_0x56c4('0x45')](_0x5568ad,_0x8b83be[0x1]===_0x56c4('0x8a')?![]:!![]);});}if(!_[_0x56c4('0x71')](_0x55b81f)){_0x1ca0fc['having'](_0x3578f5);_0x57e8dc[_0x56c4('0x47')]('t.id\x20IN\x20?',_0x55b81f);}BPromise['resolve']()['then'](function(){if(!_0x3cfc7f){if(_0x4ec104[_0x56c4('0x3d')]['MailAccountId'])return;_0x57e8dc[_0x56c4('0x47')](_0x56c4('0x8b'));_0x1ca0fc[_0x56c4('0x47')](_0x56c4('0x8b'));return;}if(_0x4ec104['user']['role']!==_0x56c4('0x8c'))return;return _0x4ec104['user'][_0x56c4('0x8d')]({'attributes':['id'],'raw':!![]})[_0x56c4('0x22')](function(_0x253e95){if(_['isEmpty'](_0x253e95)){_0x57e8dc[_0x56c4('0x47')](_0x56c4('0x8e'));_0x1ca0fc[_0x56c4('0x47')](_0x56c4('0x8e'));}else{_0x57e8dc[_0x56c4('0x47')](_0x56c4('0x73'),_['map'](_0x253e95,'id'));_0x1ca0fc['where'](_0x56c4('0x73'),_[_0x56c4('0x39')](_0x253e95,'id'));}});})[_0x56c4('0x22')](function(){if(_0x4ec104[_0x56c4('0x8f')][_0x56c4('0x90')]===_0x56c4('0x8c')&&!_0x3cfc7f&&!_0x4ec104[_0x56c4('0x3d')][_0x56c4('0x72')])return[];return db['sequelize']['query'](_0x57e8dc[_0x56c4('0x91')](),_0xc82779);})['then'](function(_0x22c108){_0x5c37a6[_0x56c4('0x1d')]=_0x22c108[_0x56c4('0x42')];if(_0x5c37a6[_0x56c4('0x1d')]===0x0)return[];return db[_0x56c4('0x92')]['query'](_0x4b1304[_0x56c4('0x91')](),_0xc82779)[_0x56c4('0x22')](function(_0x3a40f2){_0x2651aa=_['keyBy'](_0x3a40f2,'id');_0xc82779=_[_0x56c4('0x93')](_0xc82779,{'model':db[_0x56c4('0x94')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4ec104[_0x56c4('0x3d')][_0x56c4('0x41')]){_0x120713[_0x56c4('0x3f')][_0x56c4('0x6a')](function(_0x34c4e1){_0x1ca0fc[_0x56c4('0x49')]('i.'+_0x34c4e1);});}else{_0x1ca0fc['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');_0x1ca0fc['field'](_0x56c4('0x95'),_0x56c4('0x96'));_0x1ca0fc[_0x56c4('0x49')](_0x56c4('0x97'),_0x56c4('0x98'));_0x1ca0fc[_0x56c4('0x49')](_0x56c4('0x99'),_0x56c4('0x9a'));_0x1ca0fc[_0x56c4('0x49')](_0x56c4('0x84'));_0x1ca0fc[_0x56c4('0x49')](_0x56c4('0x9b'));_0x1ca0fc[_0x56c4('0x49')](_0x56c4('0x9c'));_0x1ca0fc['field'](_0x56c4('0x9d'));_0x1ca0fc['field'](_0x56c4('0x9e'));_0x1ca0fc[_0x56c4('0x49')](_0x56c4('0x9f'));_0x1ca0fc[_0x56c4('0x49')](_0x56c4('0xa0'));_0x1ca0fc['field'](_0x56c4('0xa1'));_0x1ca0fc[_0x56c4('0x49')](_0x56c4('0xa2'));_0x1ca0fc[_0x56c4('0x49')](_0x56c4('0xa3'));_0x1ca0fc[_0x56c4('0x49')](_0x56c4('0xa4'));_0x1ca0fc[_0x56c4('0x49')](_0x56c4('0xa5'));_0x1ca0fc['field'](_0x56c4('0xa6'));_0x1ca0fc[_0x56c4('0x49')](_0x56c4('0xa7'));_0x1ca0fc[_0x56c4('0x49')](_0x56c4('0xa8'));_0x1ca0fc['field'](_0x56c4('0xa9'));_0x1ca0fc[_0x56c4('0x49')]('i.UserId');_0x1ca0fc[_0x56c4('0x49')]('c.firstName','Contact.firstName');_0x1ca0fc['field']('c.lastName',_0x56c4('0xaa'));_0x1ca0fc[_0x56c4('0x49')]('c.email',_0x56c4('0xab'));_0x1ca0fc[_0x56c4('0x49')](_0x56c4('0xac'),'Contact.phone');_0x1ca0fc[_0x56c4('0x49')](_0x56c4('0xad'),_0x56c4('0xae'));_0x1ca0fc['field'](_0x56c4('0xaf'),_0x56c4('0xb0'));_0x1ca0fc[_0x56c4('0x49')]('o.fullname','Owner.fullname');_0x1ca0fc['field'](_0x56c4('0xb1'),_0x56c4('0xb2'));_0x1ca0fc[_0x56c4('0x49')](_0x56c4('0xb3'),_0x56c4('0x29'));}if(_0x120713[_0x56c4('0x1b')])_0x1ca0fc[_0x56c4('0x1b')](_0x120713[_0x56c4('0x1b')]);if(_0x120713[_0x56c4('0x1a')])_0x1ca0fc['offset'](_0x120713['offset']);return db['sequelize']['query'](_0x1ca0fc[_0x56c4('0x91')](),_0xc82779);})[_0x56c4('0x22')](function(_0x2d1874){if(_0x2d1874['length']>0x0)_0x5950e5[_0x56c4('0x47')](_0x56c4('0xb4'),_['map'](_0x2d1874,'id'));return db['sequelize'][_0x56c4('0x3d')](_0x5950e5['toString'](),_0xc82779)[_0x56c4('0x22')](function(_0x9eb5d9){var _0x3d310b=_[_0x56c4('0xb5')](_0x9eb5d9,_0x56c4('0xb6'));var _0x3f9a5a=[];return db[_0x56c4('0xb7')][_0x56c4('0x2c')]({'attributes':[_0x56c4('0xb8')],'raw':!![]})[_0x56c4('0x22')](function(_0x3cb165){var _0x1900d9=_0x3cb165[_0x56c4('0xb8')];_0x2d1874['forEach'](function(_0x1a328f){_0x3f9a5a[_0x56c4('0x2b')](updateMailInteraction(_0x1a328f,_0x2651aa,_0x3d310b,_0x1900d9));});return BPromise[_0x56c4('0xb9')](_0x3f9a5a);});});});})[_0x56c4('0x22')](function(_0x59ba4f){_0x5c37a6[_0x56c4('0xba')]=_0x59ba4f;return _0x5c37a6;})[_0x56c4('0x22')](respondWithFilteredResult(_0xf2bdac,_0x120713))[_0x56c4('0x30')](handleError(_0xf2bdac,null));};exports[_0x56c4('0xbb')]=function(_0x5ce085,_0x2e3f8e){var _0x2524c5={'raw':![],'where':{'id':_0x5ce085[_0x56c4('0xbc')]['id']}},_0x3759a1={};_0x3759a1['model']=_[_0x56c4('0x3e')](db[_0x56c4('0x94')]['rawAttributes']);_0x3759a1[_0x56c4('0x3d')]=_[_0x56c4('0x3e')](_0x5ce085[_0x56c4('0x3d')]);_0x3759a1[_0x56c4('0xbd')]=_[_0x56c4('0x40')](_0x3759a1[_0x56c4('0x43')],_0x3759a1[_0x56c4('0x3d')]);_0x2524c5[_0x56c4('0x3f')]=_[_0x56c4('0x40')](_0x3759a1[_0x56c4('0x43')],qs[_0x56c4('0x41')](_0x5ce085[_0x56c4('0x3d')][_0x56c4('0x41')]));_0x2524c5[_0x56c4('0x3f')]=_0x2524c5[_0x56c4('0x3f')][_0x56c4('0x42')]?_0x2524c5[_0x56c4('0x3f')]:_0x3759a1['model'];if(_0x5ce085['query'][_0x56c4('0xbe')]){_0x2524c5[_0x56c4('0xbf')]=[{'all':!![]}];}_0x2524c5=_[_0x56c4('0x93')]({},_0x2524c5,_0x5ce085[_0x56c4('0xc0')]);return db[_0x56c4('0x94')][_0x56c4('0x64')](_0x2524c5)[_0x56c4('0x22')](handleEntityNotFound(_0x2e3f8e,null))[_0x56c4('0x22')](respondWithResult(_0x2e3f8e,null))[_0x56c4('0x30')](handleError(_0x2e3f8e,null));};exports[_0x56c4('0xc1')]=function(_0x5cd941,_0x4b479a){return db['MailInteraction'][_0x56c4('0xc1')](_0x5cd941[_0x56c4('0xc2')],{})[_0x56c4('0x22')](respondWithResult(_0x4b479a,0xc9))['catch'](handleError(_0x4b479a,null));};exports[_0x56c4('0x21')]=function(_0x36b208,_0x4d70ad){if(_0x36b208[_0x56c4('0xc2')]['id']){delete _0x36b208[_0x56c4('0xc2')]['id'];}return db[_0x56c4('0x94')][_0x56c4('0x64')]({'where':{'id':_0x36b208[_0x56c4('0xbc')]['id']}})[_0x56c4('0x22')](handleEntityNotFound(_0x4d70ad,null))[_0x56c4('0x22')](saveUpdates(_0x36b208['body'],null))[_0x56c4('0x22')](respondWithResult(_0x4d70ad,null))[_0x56c4('0x30')](handleError(_0x4d70ad,null));};exports[_0x56c4('0xc3')]=function(_0x43aecc,_0x35619a){return db[_0x56c4('0x94')][_0x56c4('0x64')]({'where':{'id':_0x43aecc[_0x56c4('0xbc')]['id']}})[_0x56c4('0x22')](handleEntityNotFound(_0x35619a,null))[_0x56c4('0x22')](removeEntity(_0x35619a,null))['catch'](handleError(_0x35619a,null));};exports[_0x56c4('0xc4')]=function(_0x29a9ca,_0x34a49b){return db[_0x56c4('0x94')][_0x56c4('0xc4')]()[_0x56c4('0x22')](respondWithResult(_0x34a49b,null))['catch'](handleError(_0x34a49b,null));};exports[_0x56c4('0xc5')]=function(_0x5c1f8b,_0x1131ce){return db[_0x56c4('0xc6')][_0x56c4('0x64')]({'where':{'id':_0x5c1f8b[_0x56c4('0xbc')]['id']}})[_0x56c4('0x22')](handleEntityNotFound(_0x1131ce,null))[_0x56c4('0x22')](function(_0x5317f9){if(_0x5317f9){return _0x5317f9['addMessage'](_0x5c1f8b[_0x56c4('0xc2')][_0x56c4('0xc7')],_[_0x56c4('0xc8')](_0x5c1f8b[_0x56c4('0xc2')],[_0x56c4('0xc7'),'id'])||{});}})[_0x56c4('0x22')](respondWithResult(_0x1131ce,null))[_0x56c4('0x30')](handleError(_0x1131ce,null));};exports[_0x56c4('0xc9')]=function(_0x36bff4,_0x2ddfea){var _0x4bf393={'raw':![],'where':{}};var _0x53bdeb={};var _0x2a9dd5={'count':0x0,'rows':[]};return db[_0x56c4('0x94')][_0x56c4('0x2c')]({'where':{'id':_0x36bff4[_0x56c4('0xbc')]['id']}})[_0x56c4('0x22')](handleEntityNotFound(_0x2ddfea,null))['then'](function(_0x189e43){if(_0x189e43){_0x53bdeb[_0x56c4('0x43')]=_[_0x56c4('0x3e')](db[_0x56c4('0xc6')][_0x56c4('0x3a')]);_0x53bdeb[_0x56c4('0x3d')]=_[_0x56c4('0x3e')](_0x36bff4[_0x56c4('0x3d')]);_0x53bdeb['filters']=_[_0x56c4('0x40')](_0x53bdeb[_0x56c4('0x43')],_0x53bdeb['query']);_0x4bf393[_0x56c4('0x3f')]=_[_0x56c4('0x40')](_0x53bdeb[_0x56c4('0x43')],qs[_0x56c4('0x41')](_0x36bff4[_0x56c4('0x3d')][_0x56c4('0x41')]));_0x4bf393[_0x56c4('0x3f')]=_0x4bf393[_0x56c4('0x3f')][_0x56c4('0x42')]?_0x4bf393['attributes']:_0x53bdeb[_0x56c4('0x43')];if(!_0x36bff4[_0x56c4('0x3d')][_0x56c4('0x44')](_0x56c4('0xca'))){_0x4bf393[_0x56c4('0x1b')]=qs[_0x56c4('0x1b')](_0x36bff4[_0x56c4('0x3d')][_0x56c4('0x1b')]);_0x4bf393[_0x56c4('0x1a')]=qs[_0x56c4('0x1a')](_0x36bff4[_0x56c4('0x3d')][_0x56c4('0x1a')]);}_0x4bf393[_0x56c4('0x45')]=qs[_0x56c4('0x46')](_0x36bff4[_0x56c4('0x3d')]['sort']);_0x4bf393[_0x56c4('0x47')]=qs[_0x56c4('0xbd')](_[_0x56c4('0xcb')](_0x36bff4[_0x56c4('0x3d')],_0x53bdeb[_0x56c4('0xbd')]));_0x4bf393['where'][_0x56c4('0xb6')]=_0x189e43['id'];if(_0x36bff4[_0x56c4('0x3d')][_0x56c4('0x7f')]){_0x4bf393[_0x56c4('0x47')]=_['merge'](_0x4bf393[_0x56c4('0x47')],{'$or':_['map'](_0x4bf393[_0x56c4('0x3f')],function(_0x363f41){var _0x4bdfd4={};_0x4bdfd4[_0x363f41]={'$like':'%'+_0x36bff4[_0x56c4('0x3d')][_0x56c4('0x7f')]+'%'};return _0x4bdfd4;})});}if(_0x36bff4[_0x56c4('0x3d')][_0x56c4('0x77')]){var _0x9e7843=_0x36bff4['query'][_0x56c4('0x77')][_0x56c4('0x61')](',');var _0x1ba5e9={};_0x1ba5e9[_0x9e7843[0x0]]={'$gte':moment(_0x9e7843[0x1])[_0x56c4('0xcc')](_0x56c4('0xcd'))};_0x4bf393[_0x56c4('0x47')]=_[_0x56c4('0x93')](_0x4bf393[_0x56c4('0x47')],_0x1ba5e9);}_0x4bf393=_[_0x56c4('0x93')]({},_0x4bf393,_0x36bff4[_0x56c4('0xc0')]);return db[_0x56c4('0xc6')][_0x56c4('0x1d')]({'where':_0x4bf393[_0x56c4('0x47')]})['then'](function(_0x1da341){_0x2a9dd5[_0x56c4('0x1d')]=_0x1da341;if(_0x36bff4[_0x56c4('0x3d')]['includeAll']){_0x4bf393[_0x56c4('0xbf')]=[{'all':!![]}];}return db['MailMessage']['findAll'](_0x4bf393);})[_0x56c4('0x22')](function(_0x284b81){if(_0x36bff4[_0x56c4('0x3d')][_0x56c4('0xce')]===_0x56c4('0xcf')){for(var _0x1027ed=0x0;_0x1027ed<_0x284b81['length'];_0x1027ed++){_0x284b81[_0x1027ed][_0x56c4('0xc2')]=juice(_0x284b81[_0x1027ed][_0x56c4('0xc2')]);}}_0x2a9dd5[_0x56c4('0xba')]=_0x284b81;return _0x2a9dd5;});}})[_0x56c4('0x22')](respondWithFilteredResult(_0x2ddfea,_0x4bf393))[_0x56c4('0x30')](handleError(_0x2ddfea,null));};exports[_0x56c4('0xd0')]=function(_0x2caf9a,_0xc73296){return db['MailInteraction']['find']({'where':{'id':_0x2caf9a['params']['id']}})[_0x56c4('0x22')](handleEntityNotFound(_0xc73296,null))[_0x56c4('0x22')](function(_0x37d4f7){if(_0x37d4f7){return _0x37d4f7[_0x56c4('0xd1')](_0x2caf9a[_0x56c4('0xc2')][_0x56c4('0xc7')],_[_0x56c4('0xc8')](_0x2caf9a['body'],[_0x56c4('0xc7'),'id'])||{})[_0x56c4('0xd2')](function(){return db[_0x56c4('0x69')]['findAll']({'attributes':['id',_0x56c4('0x25'),_0x56c4('0xd3')],'where':{'id':_0x2caf9a['body'][_0x56c4('0xc7')]}});})[_0x56c4('0x22')](function(_0x204386){socket[_0x56c4('0xd4')](_0x56c4('0xd5'),{'id':Number(_0x2caf9a[_0x56c4('0xbc')]['id']),'tags':_0x204386||[]});return{'id':Number(_0x2caf9a[_0x56c4('0xbc')]['id']),'tags':_0x204386||[]};});}})['then'](respondWithResult(_0xc73296,null))[_0x56c4('0x30')](handleError(_0xc73296,null));};exports[_0x56c4('0xd6')]=function(_0x5209c9,_0x5950e4){return db[_0x56c4('0x94')][_0x56c4('0x64')]({'where':{'id':_0x5209c9['params']['id']}})[_0x56c4('0x22')](handleEntityNotFound(_0x5950e4,null))[_0x56c4('0x22')](function(_0x2445cc){if(_0x2445cc){return _0x2445cc[_0x56c4('0xd6')](_0x5209c9['query'][_0x56c4('0xc7')]);}})['then'](respondWithStatusCode(_0x5950e4,null))['catch'](handleError(_0x5950e4,null));};exports[_0x56c4('0xd7')]=function(_0x138156,_0xd86363){var _0x33f657=moment()[_0x56c4('0xd8')]()['toString']();var _0x525a0f=path[_0x56c4('0xd9')](config['root'],_0x56c4('0xda'),_0x56c4('0xdb'),_0x56c4('0xdc'));var _0x14ed7f=path['join'](config[_0x56c4('0xdd')],'server',_0x56c4('0xdb'),_0x56c4('0xde'));var _0x36530e=path[_0x56c4('0xd9')](_0x525a0f,_0x33f657);var _0x5c627b=util[_0x56c4('0xcc')](_0x56c4('0xdf'),_0x138156[_0x56c4('0xbc')]['id'],_0x33f657);var _0x30cd5c=path['join'](_0x525a0f,_0x5c627b);var _0x74b2a6=[];if(_0x138156[_0x56c4('0x3d')][_0x56c4('0xde')]){_0x74b2a6[_0x56c4('0x2b')]({'model':db[_0x56c4('0xe0')],'as':_0x56c4('0xe1'),'raw':!![]});}var _0x38f0af=[{'model':db[_0x56c4('0xc6')],'as':_0x56c4('0xe2'),'attributes':['id',_0x56c4('0xc2'),'from','to','cc',_0x56c4('0xe3'),_0x56c4('0xe4'),_0x56c4('0x75')],'where':{'secret':![]},'order':qs['sort']('id'),'include':_0x74b2a6}];return db[_0x56c4('0x94')][_0x56c4('0x64')]({'where':{'id':_0x138156[_0x56c4('0xbc')]['id']},'include':_0x38f0af})['then'](handleEntityNotFound(_0xd86363,null))['then'](function(_0x12691f){if(_0x12691f&&_0x12691f['Messages']){var _0x5b148b=_0x12691f[_0x56c4('0xe5')]({'plain':!![]});fs[_0x56c4('0xe6')](_0x36530e);return BPromise[_0x56c4('0xe7')](_0x5b148b[_0x56c4('0xe2')],function(_0x500d68,_0xa4e299){var _0x35e94={'from':_0x500d68[_0x56c4('0x4a')],'to':_0x500d68['to'],'subject':_0x500d68[_0x56c4('0xe4')],'html':htmlEntities[_0x56c4('0xe8')](_0x500d68[_0x56c4('0xc2')]),'headers':{'Date':moment(_0x500d68[_0x56c4('0x75')])['format'](_0x56c4('0xe9'))},'attachments':[]};if(_0x500d68['cc']){_0x35e94['headers']['Cc']=_0x500d68['cc'];}if(_0x500d68[_0x56c4('0xe3')]){_0x35e94[_0x56c4('0xea')]['Bcc']=_0x500d68[_0x56c4('0xe3')];}return new BPromise(function(_0x48af15,_0x421910){if(_0x500d68['Attachments']){for(var _0x366689=0x0;_0x366689<_0x500d68[_0x56c4('0xe1')]['length'];_0x366689++){var _0x484464=_0x500d68['Attachments'][_0x366689];var _0x4bf2c7=path[_0x56c4('0xd9')](_0x14ed7f,_0x484464['basename']);if(fs[_0x56c4('0xeb')](_0x4bf2c7)){_0x35e94[_0x56c4('0xde')][_0x56c4('0x2b')]({'name':_0x484464[_0x56c4('0x25')],'contentType':_0x484464[_0x56c4('0x3b')],'data':fs[_0x56c4('0xec')](_0x4bf2c7)});}}}emlformat[_0x56c4('0xed')](_0x35e94,function(_0x21f504,_0x51bd96){if(_0x21f504)return _0x421910(_0x21f504);fs[_0x56c4('0xee')](path[_0x56c4('0xd9')](_0x36530e,util[_0x56c4('0xcc')](_0x56c4('0xef'),_0xa4e299)),_0x51bd96);return _0x48af15(_0x51bd96);});});})[_0x56c4('0x22')](function(){return new BPromise(function(_0x19f50a,_0xe10a55){zipdir(_0x36530e,{'saveTo':_0x30cd5c},function(_0x1e1e5f,_0x1151a4){if(_0x1e1e5f)return _0xe10a55(_0x1e1e5f);return _0x19f50a(_0x1151a4);});})[_0x56c4('0x22')](function(){return new BPromise(function(_0x3980e0,_0x1199ff){rimraf(_0x36530e,function(_0x4c23e3){if(_0x4c23e3)_0x1199ff(_0x4c23e3);return _0x3980e0();});});})['then'](function(){return _0xd86363[_0x56c4('0xd7')](_0x30cd5c,_0x5c627b,function(_0x357917){if(!_0x357917)fs[_0x56c4('0xf0')](_0x30cd5c);});});});}else{return _0xd86363[_0x56c4('0x17')](0xc8);}})[_0x56c4('0x30')](handleError(_0xd86363,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index f21c2d0..78d3ccd 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 _0xc7e6=['../../mysqldb','setMaxListeners','save','update','getUsers','setDataValue','map','findAll','then','unreadMessages','length','emit','catch','hasOwnProperty','hook','events'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0xc7e6,0x1ef));var _0x6c7e=function(_0x5cba0e,_0x4fb1a6){_0x5cba0e=_0x5cba0e-0x0;var _0x5e1e19=_0xc7e6[_0x5cba0e];return _0x5e1e19;};'use strict';var EventEmitter=require(_0x6c7e('0x0'));var MailInteraction=require(_0x6c7e('0x1'))['db']['MailInteraction'];var MailMessage=require('../../mysqldb')['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x6c7e('0x2')](0x0);var events={'afterCreate':_0x6c7e('0x3'),'afterUpdate':_0x6c7e('0x4'),'afterDestroy':'remove'};function emitEvent(_0x3818b6){return function(_0x5a5d65,_0xe662d2,_0x52a69c){_0x5a5d65[_0x6c7e('0x5')]({'attributes':['id'],'raw':!![]})['then'](function(_0x58f608){_0x5a5d65[_0x6c7e('0x6')]('Users',_0x58f608[_0x6c7e('0x7')](function(_0x133961){return{'id':_0x133961['id']};}));return MailMessage[_0x6c7e('0x8')]({'where':{'MailInteractionId':_0x5a5d65['id'],'direction':'in','read':![]},'raw':!![]});})[_0x6c7e('0x9')](function(_0x4da581){_0x5a5d65[_0x6c7e('0x6')](_0x6c7e('0xa'),_0x4da581[_0x6c7e('0xb')]);MailInteractionEvents['emit'](_0x3818b6+':'+_0x5a5d65['id'],_0x5a5d65);MailInteractionEvents[_0x6c7e('0xc')](_0x3818b6,_0x5a5d65);_0x52a69c(null);})[_0x6c7e('0xd')](_0x52a69c(null));};}for(var e in events){if(events[_0x6c7e('0xe')](e)){var event=events[e];MailInteraction[_0x6c7e('0xf')](e,emitEvent(event));}}module['exports']=MailInteractionEvents; \ No newline at end of file +var _0x1d9c=['setDataValue','Users','map','findAll','unreadMessages','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','MailInteraction','MailMessage','setMaxListeners','save','remove','getUsers'];(function(_0x3f268a,_0x4d28d5){var _0x5b8b99=function(_0x4457c6){while(--_0x4457c6){_0x3f268a['push'](_0x3f268a['shift']());}};_0x5b8b99(++_0x4d28d5);}(_0x1d9c,0x64));var _0xc1d9=function(_0x888a02,_0x5df389){_0x888a02=_0x888a02-0x0;var _0xedd786=_0x1d9c[_0x888a02];return _0xedd786;};'use strict';var EventEmitter=require(_0xc1d9('0x0'));var MailInteraction=require(_0xc1d9('0x1'))['db'][_0xc1d9('0x2')];var MailMessage=require(_0xc1d9('0x1'))['db'][_0xc1d9('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xc1d9('0x4')](0x0);var events={'afterCreate':_0xc1d9('0x5'),'afterUpdate':'update','afterDestroy':_0xc1d9('0x6')};function emitEvent(_0x3e5975){return function(_0x5f0b89,_0x56601a,_0x210653){_0x5f0b89[_0xc1d9('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x53922){_0x5f0b89[_0xc1d9('0x8')](_0xc1d9('0x9'),_0x53922[_0xc1d9('0xa')](function(_0x28bc4d){return{'id':_0x28bc4d['id']};}));return MailMessage[_0xc1d9('0xb')]({'where':{'MailInteractionId':_0x5f0b89['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x53002f){_0x5f0b89[_0xc1d9('0x8')](_0xc1d9('0xc'),_0x53002f['length']);MailInteractionEvents[_0xc1d9('0xd')](_0x3e5975+':'+_0x5f0b89['id'],_0x5f0b89);MailInteractionEvents[_0xc1d9('0xd')](_0x3e5975,_0x5f0b89);_0x210653(null);})[_0xc1d9('0xe')](_0x210653(null));};}for(var e in events){if(events[_0xc1d9('0xf')](e)){var event=events[e];MailInteraction[_0xc1d9('0x10')](e,emitEvent(event));}}module[_0xc1d9('0x11')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 0edad24..1081797 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 _0x0703=['util','../../config/logger','api','moment','bluebird','path','./mailInteraction.attributes','exports','define','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closedAt','changed','substatus','closed','models','get','MailMessage','update','then','catch','utf8mb4'];(function(_0xee1ec9,_0x2f0599){var _0x102a53=function(_0x4e5f7f){while(--_0x4e5f7f){_0xee1ec9['push'](_0xee1ec9['shift']());}};_0x102a53(++_0x2f0599);}(_0x0703,0x129));var _0x3070=function(_0x270876,_0x50516b){_0x270876=_0x270876-0x0;var _0x1bc190=_0x0703[_0x270876];return _0x1bc190;};'use strict';var _=require('lodash');var util=require(_0x3070('0x0'));var logger=require(_0x3070('0x1'))(_0x3070('0x2'));var moment=require(_0x3070('0x3'));var BPromise=require(_0x3070('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3070('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3070('0x6'));module[_0x3070('0x7')]=function(_0x435b50,_0x122943){return _0x435b50[_0x3070('0x8')]('MailInteraction',attributes,{'tableName':_0x3070('0x9'),'paranoid':![],'indexes':[{'name':_0x3070('0xa'),'fields':[_0x3070('0xb'),'to'],'type':_0x3070('0xc')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x2072dc,_0x432cec,_0x156ac6){if(_0x2072dc['substatus']){_0x2072dc[_0x3070('0xd')]=moment()[_0x3070('0xe')](_0x3070('0xf'));}if(_0x2072dc['closed']){_0x2072dc[_0x3070('0x10')]=moment()[_0x3070('0xe')](_0x3070('0xf'));}_0x156ac6(null,_0x432cec);},'beforeUpdate':function(_0x4dce18,_0x5133c0,_0x316169){if(_0x4dce18[_0x3070('0x11')](_0x3070('0x12'))){_0x4dce18[_0x3070('0xd')]=_0x4dce18[_0x3070('0x12')]?moment()[_0x3070('0xe')](_0x3070('0xf')):null;}if(_0x4dce18['changed'](_0x3070('0x13'))){_0x4dce18[_0x3070('0x10')]=moment()[_0x3070('0xe')](_0x3070('0xf'));_0x4dce18['substatus']=null;_0x4dce18[_0x3070('0xd')]=null;}_0x316169(null,_0x4dce18);},'afterUpdate':function(_0x5c6576,_0x30d1ec,_0x246d51){var _0xafc6b6=_0x435b50[_0x3070('0x14')];var _0x7bccf6=_0x5c6576[_0x3070('0x15')]({'plain':!![]});if(_0x7bccf6[_0x3070('0x13')]){return _0xafc6b6[_0x3070('0x16')][_0x3070('0x17')]({'read':!![]},{'where':{'MailInteractionId':_0x7bccf6['id']}})[_0x3070('0x18')](function(){_0x246d51();})[_0x3070('0x19')](function(_0x443b78){_0x246d51(_0x443b78);});}else{_0x246d51();}}},'charset':_0x3070('0x1a'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xa593=['moment','bluebird','../../config/environment','./mailInteraction.attributes','exports','define','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','changed','models','get','then','catch','utf8mb4','lodash','util','../../config/logger','api'];(function(_0x57fbf3,_0x450361){var _0x99aa2b=function(_0xfceb3e){while(--_0xfceb3e){_0x57fbf3['push'](_0x57fbf3['shift']());}};_0x99aa2b(++_0x450361);}(_0xa593,0xc4));var _0x3a59=function(_0x4b2dad,_0x506b66){_0x4b2dad=_0x4b2dad-0x0;var _0x354cc9=_0xa593[_0x4b2dad];return _0x354cc9;};'use strict';var _=require(_0x3a59('0x0'));var util=require(_0x3a59('0x1'));var logger=require(_0x3a59('0x2'))(_0x3a59('0x3'));var moment=require(_0x3a59('0x4'));var BPromise=require(_0x3a59('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3a59('0x6'));var attributes=require(_0x3a59('0x7'));module[_0x3a59('0x8')]=function(_0x26a5b3,_0x315254){return _0x26a5b3[_0x3a59('0x9')]('MailInteraction',attributes,{'tableName':_0x3a59('0xa'),'paranoid':![],'indexes':[{'name':_0x3a59('0xb'),'fields':[_0x3a59('0xc'),'to'],'type':_0x3a59('0xd')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x8eb74a,_0x26cd44,_0x4279e1){if(_0x8eb74a[_0x3a59('0xe')]){_0x8eb74a[_0x3a59('0xf')]=moment()[_0x3a59('0x10')](_0x3a59('0x11'));}if(_0x8eb74a[_0x3a59('0x12')]){_0x8eb74a['closedAt']=moment()[_0x3a59('0x10')](_0x3a59('0x11'));}_0x4279e1(null,_0x26cd44);},'beforeUpdate':function(_0x9a6707,_0x4a4294,_0x1aef6a){if(_0x9a6707['changed'](_0x3a59('0xe'))){_0x9a6707[_0x3a59('0xf')]=_0x9a6707['substatus']?moment()[_0x3a59('0x10')]('YYYY-MM-DD\x20HH:mm:ss'):null;}if(_0x9a6707[_0x3a59('0x13')](_0x3a59('0x12'))){_0x9a6707['closedAt']=moment()[_0x3a59('0x10')](_0x3a59('0x11'));_0x9a6707[_0x3a59('0xe')]=null;_0x9a6707[_0x3a59('0xf')]=null;}_0x1aef6a(null,_0x9a6707);},'afterUpdate':function(_0x369c41,_0x40537c,_0x32bf31){var _0x9e830e=_0x26a5b3[_0x3a59('0x14')];var _0x5bc0bd=_0x369c41[_0x3a59('0x15')]({'plain':!![]});if(_0x5bc0bd[_0x3a59('0x12')]){return _0x9e830e['MailMessage']['update']({'read':!![]},{'where':{'MailInteractionId':_0x5bc0bd['id']}})[_0x3a59('0x16')](function(){_0x32bf31();})[_0x3a59('0x17')](function(_0x19a1d8){_0x32bf31(_0x19a1d8);});}else{_0x32bf31();}}},'charset':_0x3a59('0x18'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 286cb1a..2cad02d 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 _0x3ef1=['jayson/promise','client','http','redis','localhost','socket.io-emitter','register','request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','MailInteraction','body','options','raw','where','attributes','limit','UpdateMailInteraction','AddTagsToMailInteraction','find','addTags','ids','omit','spread','AddTags','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0xab2622,_0x582313){var _0x3ab544=function(_0x591570){while(--_0x591570){_0xab2622['push'](_0xab2622['shift']());}};_0x3ab544(++_0x582313);}(_0x3ef1,0x99));var _0x13ef=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0x3ef1[_0x334841];return _0x5beb4b;};'use strict';var _=require('lodash');var util=require(_0x13ef('0x0'));var moment=require(_0x13ef('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x13ef('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x13ef('0x3'));var logger=require(_0x13ef('0x4'))(_0x13ef('0x5'));var config=require(_0x13ef('0x6'));var jayson=require(_0x13ef('0x7'));var client=jayson[_0x13ef('0x8')][_0x13ef('0x9')]({'port':0x232a});config[_0x13ef('0xa')]=_['defaults'](config[_0x13ef('0xa')],{'host':_0x13ef('0xb'),'port':0x18eb});var socket=require(_0x13ef('0xc'))(new Redis(config['redis']));require('./mailInteraction.socket')[_0x13ef('0xd')](socket);function respondWithRpcPromise(_0x3d5235,_0x4a878a,_0x4a4c55){return new BPromise(function(_0x578110,_0x4a9549){return client[_0x13ef('0xe')](_0x3d5235,_0x4a4c55)[_0x13ef('0xf')](function(_0x47d984){logger[_0x13ef('0x10')](_0x13ef('0x11'),_0x4a878a,_0x13ef('0x12'));logger[_0x13ef('0x13')]('MailInteraction,\x20%s,\x20%s,\x20%s',_0x4a878a,_0x13ef('0x12'),JSON[_0x13ef('0x14')](_0x47d984));if(_0x47d984['error']){if(_0x47d984[_0x13ef('0x15')]['code']===0x1f4){logger[_0x13ef('0x15')](_0x13ef('0x11'),_0x4a878a,_0x47d984['error'][_0x13ef('0x16')]);return _0x4a9549(_0x47d984[_0x13ef('0x15')][_0x13ef('0x16')]);}logger[_0x13ef('0x15')](_0x13ef('0x11'),_0x4a878a,_0x47d984[_0x13ef('0x15')][_0x13ef('0x16')]);return _0x578110(_0x47d984['error'][_0x13ef('0x16')]);}else{logger[_0x13ef('0x10')](_0x13ef('0x11'),_0x4a878a,_0x13ef('0x12'));_0x578110(_0x47d984[_0x13ef('0x17')]['message']);}})[_0x13ef('0x18')](function(_0x25903f){logger['error'](_0x13ef('0x11'),_0x4a878a,_0x25903f);_0x4a9549(_0x25903f);});});}exports['UpdateMailInteraction']=function(_0x5d052f){var _0x5d8aab=this;return new Promise(function(_0x4dc8a4,_0x370c9d){return db[_0x13ef('0x19')]['update'](_0x5d052f[_0x13ef('0x1a')],{'raw':_0x5d052f[_0x13ef('0x1b')]?_0x5d052f[_0x13ef('0x1b')][_0x13ef('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5d052f[_0x13ef('0x1b')]?_0x5d052f[_0x13ef('0x1b')][_0x13ef('0x1d')]||null:null,'attributes':_0x5d052f[_0x13ef('0x1b')]?_0x5d052f[_0x13ef('0x1b')][_0x13ef('0x1e')]||null:null,'limit':_0x5d052f[_0x13ef('0x1b')]?_0x5d052f[_0x13ef('0x1b')][_0x13ef('0x1f')]||null:null})[_0x13ef('0xf')](function(_0x586875){logger[_0x13ef('0x10')](_0x13ef('0x20'),_0x5d052f);logger[_0x13ef('0x13')](_0x13ef('0x20'),_0x5d052f,JSON[_0x13ef('0x14')](_0x586875));_0x4dc8a4(_0x586875);})[_0x13ef('0x18')](function(_0x140d0e){logger['error']('UpdateMailInteraction',_0x140d0e[_0x13ef('0x16')],_0x5d052f);_0x370c9d(_0x5d8aab['error'](0x1f4,_0x140d0e[_0x13ef('0x16')]));});});};exports[_0x13ef('0x21')]=function(_0x5d4bcd){return new Promise(function(_0xdaf605,_0x39b5c1){return db[_0x13ef('0x19')][_0x13ef('0x22')]({'where':_0x5d4bcd[_0x13ef('0x1b')]?_0x5d4bcd[_0x13ef('0x1b')][_0x13ef('0x1d')]||null:null})[_0x13ef('0xf')](function(_0xdd95c2){if(_0xdd95c2){return _0xdd95c2[_0x13ef('0x23')](_0x5d4bcd[_0x13ef('0x1a')][_0x13ef('0x24')],_[_0x13ef('0x25')](_0x5d4bcd[_0x13ef('0x1a')],[_0x13ef('0x24'),'id'])||{});}})[_0x13ef('0x26')](function(_0x4c7799){logger[_0x13ef('0x10')](_0x13ef('0x27'),_0x5d4bcd);logger[_0x13ef('0x13')](_0x13ef('0x27'),_0x5d4bcd,JSON['stringify'](_0x4c7799));_0xdaf605(_0x4c7799);})[_0x13ef('0x18')](function(_0x1357a3){logger['error']('AddTags',_0x1357a3[_0x13ef('0x16')],_0x5d4bcd);_0x39b5c1(_this[_0x13ef('0x15')](0x1f4,_0x1357a3[_0x13ef('0x16')]));});});}; \ No newline at end of file +var _0xf156=['limit','debug','UpdateMailInteraction','MailInteraction','addTags','ids','AddTags','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','body','options','raw','where','attributes'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0xf156,0x137));var _0x6f15=function(_0x43c834,_0x3d4706){_0x43c834=_0x43c834-0x0;var _0x445205=_0xf156[_0x43c834];return _0x445205;};'use strict';var _=require('lodash');var util=require(_0x6f15('0x0'));var moment=require(_0x6f15('0x1'));var BPromise=require('bluebird');var rs=require(_0x6f15('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6f15('0x3'))['db'];var utils=require(_0x6f15('0x4'));var logger=require(_0x6f15('0x5'))(_0x6f15('0x6'));var config=require(_0x6f15('0x7'));var jayson=require(_0x6f15('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0x6f15('0x9')]=_[_0x6f15('0xa')](config['redis'],{'host':_0x6f15('0xb'),'port':0x18eb});var socket=require(_0x6f15('0xc'))(new Redis(config[_0x6f15('0x9')]));require(_0x6f15('0xd'))['register'](socket);function respondWithRpcPromise(_0x5aa7f5,_0x352bf2,_0x2b5297){return new BPromise(function(_0x243eea,_0x11f16f){return client[_0x6f15('0xe')](_0x5aa7f5,_0x2b5297)[_0x6f15('0xf')](function(_0x20f597){logger[_0x6f15('0x10')](_0x6f15('0x11'),_0x352bf2,_0x6f15('0x12'));logger['debug'](_0x6f15('0x13'),_0x352bf2,'request\x20sent',JSON[_0x6f15('0x14')](_0x20f597));if(_0x20f597[_0x6f15('0x15')]){if(_0x20f597[_0x6f15('0x15')][_0x6f15('0x16')]===0x1f4){logger[_0x6f15('0x15')](_0x6f15('0x11'),_0x352bf2,_0x20f597[_0x6f15('0x15')][_0x6f15('0x17')]);return _0x11f16f(_0x20f597[_0x6f15('0x15')][_0x6f15('0x17')]);}logger['error'](_0x6f15('0x11'),_0x352bf2,_0x20f597['error'][_0x6f15('0x17')]);return _0x243eea(_0x20f597['error'][_0x6f15('0x17')]);}else{logger['info'](_0x6f15('0x11'),_0x352bf2,'request\x20sent');_0x243eea(_0x20f597[_0x6f15('0x18')]['message']);}})[_0x6f15('0x19')](function(_0x344cd2){logger[_0x6f15('0x15')](_0x6f15('0x11'),_0x352bf2,_0x344cd2);_0x11f16f(_0x344cd2);});});}exports['UpdateMailInteraction']=function(_0x596634){var _0xcb33c7=this;return new Promise(function(_0x12d96a,_0x23a5c3){return db['MailInteraction']['update'](_0x596634[_0x6f15('0x1a')],{'raw':_0x596634[_0x6f15('0x1b')]?_0x596634['options'][_0x6f15('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x596634['options']?_0x596634[_0x6f15('0x1b')][_0x6f15('0x1d')]||null:null,'attributes':_0x596634['options']?_0x596634['options'][_0x6f15('0x1e')]||null:null,'limit':_0x596634['options']?_0x596634[_0x6f15('0x1b')][_0x6f15('0x1f')]||null:null})[_0x6f15('0xf')](function(_0x31f785){logger[_0x6f15('0x10')]('UpdateMailInteraction',_0x596634);logger[_0x6f15('0x20')](_0x6f15('0x21'),_0x596634,JSON[_0x6f15('0x14')](_0x31f785));_0x12d96a(_0x31f785);})[_0x6f15('0x19')](function(_0x5ab978){logger[_0x6f15('0x15')](_0x6f15('0x21'),_0x5ab978[_0x6f15('0x17')],_0x596634);_0x23a5c3(_0xcb33c7[_0x6f15('0x15')](0x1f4,_0x5ab978['message']));});});};exports['AddTagsToMailInteraction']=function(_0x362dc3){return new Promise(function(_0x117128,_0x3226cc){return db[_0x6f15('0x22')]['find']({'where':_0x362dc3[_0x6f15('0x1b')]?_0x362dc3['options']['where']||null:null})[_0x6f15('0xf')](function(_0x1cc321){if(_0x1cc321){return _0x1cc321[_0x6f15('0x23')](_0x362dc3[_0x6f15('0x1a')][_0x6f15('0x24')],_['omit'](_0x362dc3[_0x6f15('0x1a')],[_0x6f15('0x24'),'id'])||{});}})['spread'](function(_0x38ba99){logger['info'](_0x6f15('0x25'),_0x362dc3);logger[_0x6f15('0x20')](_0x6f15('0x25'),_0x362dc3,JSON['stringify'](_0x38ba99));_0x117128(_0x38ba99);})[_0x6f15('0x19')](function(_0xb7ba68){logger[_0x6f15('0x15')](_0x6f15('0x25'),_0xb7ba68[_0x6f15('0x17')],_0x362dc3);_0x3226cc(_this[_0x6f15('0x15')](0x1f4,_0xb7ba68[_0x6f15('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 134e9dd..b437b5e 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 _0x3571=['mailInteraction:','./mailInteraction.events','save','remove','update','emit','removeListener','register','length'];(function(_0x3a74b1,_0x49ad83){var _0x245fcd=function(_0x3255c2){while(--_0x3255c2){_0x3a74b1['push'](_0x3a74b1['shift']());}};_0x245fcd(++_0x49ad83);}(_0x3571,0xf4));var _0x1357=function(_0x30e004,_0x46f8c2){_0x30e004=_0x30e004-0x0;var _0x5ca247=_0x3571[_0x30e004];return _0x5ca247;};'use strict';var MailInteractionEvents=require(_0x1357('0x0'));var events=[_0x1357('0x1'),_0x1357('0x2'),_0x1357('0x3')];function createListener(_0x460b99,_0x58d49a){return function(_0x251d04){_0x58d49a[_0x1357('0x4')](_0x460b99,_0x251d04);};}function removeListener(_0x1d9b34,_0x339b24){return function(){MailInteractionEvents[_0x1357('0x5')](_0x1d9b34,_0x339b24);};}exports[_0x1357('0x6')]=function(_0x432ae4){for(var _0xeb9d4b=0x0,_0x158296=events[_0x1357('0x7')];_0xeb9d4b<_0x158296;_0xeb9d4b++){var _0x203754=events[_0xeb9d4b];var _0x47e0b7=createListener(_0x1357('0x8')+_0x203754,_0x432ae4);MailInteractionEvents['on'](_0x203754,_0x47e0b7);}}; \ No newline at end of file +var _0x343e=['update','emit','removeListener','register','mailInteraction:','./mailInteraction.events','remove'];(function(_0xee61f,_0x25bb94){var _0x27afc2=function(_0x5161cb){while(--_0x5161cb){_0xee61f['push'](_0xee61f['shift']());}};_0x27afc2(++_0x25bb94);}(_0x343e,0x178));var _0xe343=function(_0x172562,_0x51917a){_0x172562=_0x172562-0x0;var _0x38257b=_0x343e[_0x172562];return _0x38257b;};'use strict';var MailInteractionEvents=require(_0xe343('0x0'));var events=['save',_0xe343('0x1'),_0xe343('0x2')];function createListener(_0x30ba8b,_0x5c1f01){return function(_0x3c979a){_0x5c1f01[_0xe343('0x3')](_0x30ba8b,_0x3c979a);};}function removeListener(_0xaedaa7,_0x4657ab){return function(){MailInteractionEvents[_0xe343('0x4')](_0xaedaa7,_0x4657ab);};}exports[_0xe343('0x5')]=function(_0x5d6b6e){for(var _0x147d31=0x0,_0x378900=events['length'];_0x147d31<_0x378900;_0x147d31++){var _0x3395f5=events[_0x147d31];var _0x3d0dbb=createListener(_0xe343('0x6')+_0x3395f5,_0x5d6b6e);MailInteractionEvents['on'](_0x3395f5,_0x3d0dbb);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index af252b9..40237c6 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 _0xf194=['put','update','/:id/accept','accept','reject','destroy','exports','multer','util','path','connect-timeout','Router','../../config/environment','./mailMessage.controller','get','index','describe','/:id','isAuthenticated','/:id/download','download','post','create'];(function(_0x2b5fc8,_0x380cb7){var _0x253c77=function(_0x19f5f1){while(--_0x19f5f1){_0x2b5fc8['push'](_0x2b5fc8['shift']());}};_0x253c77(++_0x380cb7);}(_0xf194,0x91));var _0x4f19=function(_0x54bccc,_0x3fb8b8){_0x54bccc=_0x54bccc-0x0;var _0x1d4b9a=_0xf194[_0x54bccc];return _0x1d4b9a;};'use strict';var multer=require(_0x4f19('0x0'));var util=require(_0x4f19('0x1'));var path=require(_0x4f19('0x2'));var timeout=require(_0x4f19('0x3'));var express=require('express');var router=express[_0x4f19('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x4f19('0x5'));var controller=require(_0x4f19('0x6'));router[_0x4f19('0x7')]('/',auth['isAuthenticated'](),controller[_0x4f19('0x8')]);router[_0x4f19('0x7')]('/describe',auth['isAuthenticated'](),controller[_0x4f19('0x9')]);router[_0x4f19('0x7')](_0x4f19('0xa'),auth[_0x4f19('0xb')](),controller['show']);router[_0x4f19('0x7')](_0x4f19('0xc'),auth[_0x4f19('0xb')](),controller[_0x4f19('0xd')]);router[_0x4f19('0xe')]('/',auth[_0x4f19('0xb')](),interaction['tracked']('mail','mailmessage:create'),controller[_0x4f19('0xf')]);router[_0x4f19('0x10')]('/:id',auth[_0x4f19('0xb')](),controller[_0x4f19('0x11')]);router[_0x4f19('0x10')](_0x4f19('0x12'),auth['isAuthenticated'](),controller[_0x4f19('0x13')]);router[_0x4f19('0x10')]('/:id/reject',auth[_0x4f19('0xb')](),controller[_0x4f19('0x14')]);router['delete'](_0x4f19('0xa'),auth['isAuthenticated'](),controller[_0x4f19('0x15')]);module[_0x4f19('0x16')]=router; \ No newline at end of file +var _0x9649=['multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','index','isAuthenticated','describe','get','show','/:id/download','download','tracked','mailmessage:create','create','/:id','update','put','/:id/accept','accept','/:id/reject','delete','destroy','exports'];(function(_0x24b6ac,_0x2cfe6a){var _0xb30964=function(_0x4083ed){while(--_0x4083ed){_0x24b6ac['push'](_0x24b6ac['shift']());}};_0xb30964(++_0x2cfe6a);}(_0x9649,0x118));var _0x9964=function(_0xd85c4b,_0x4ce11b){_0xd85c4b=_0xd85c4b-0x0;var _0x5d4392=_0x9649[_0xd85c4b];return _0x5d4392;};'use strict';var multer=require(_0x9964('0x0'));var util=require(_0x9964('0x1'));var path=require('path');var timeout=require(_0x9964('0x2'));var express=require(_0x9964('0x3'));var router=express[_0x9964('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9964('0x5'));var interaction=require(_0x9964('0x6'));var config=require(_0x9964('0x7'));var controller=require(_0x9964('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x9964('0x9')]);router['get']('/describe',auth[_0x9964('0xa')](),controller[_0x9964('0xb')]);router[_0x9964('0xc')]('/:id',auth[_0x9964('0xa')](),controller[_0x9964('0xd')]);router[_0x9964('0xc')](_0x9964('0xe'),auth['isAuthenticated'](),controller[_0x9964('0xf')]);router['post']('/',auth[_0x9964('0xa')](),interaction[_0x9964('0x10')]('mail',_0x9964('0x11')),controller[_0x9964('0x12')]);router['put'](_0x9964('0x13'),auth['isAuthenticated'](),controller[_0x9964('0x14')]);router[_0x9964('0x15')](_0x9964('0x16'),auth[_0x9964('0xa')](),controller[_0x9964('0x17')]);router[_0x9964('0x15')](_0x9964('0x18'),auth['isAuthenticated'](),controller['reject']);router[_0x9964('0x19')](_0x9964('0x13'),auth['isAuthenticated'](),controller[_0x9964('0x1a')]);module[_0x9964('0x1b')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 9e925f7..aee84a4 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 _0xf611=['Email','sequelize','lodash','exports','TEXT','long','medium','ENUM','out','STRING','INTEGER','BOOLEAN'];(function(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0xf611,0x199));var _0x1f61=function(_0x1cb18a,_0x33167a){_0x1cb18a=_0x1cb18a-0x0;var _0x22442e=_0xf611[_0x1cb18a];return _0x22442e;};'use strict';var Sequelize=require(_0x1f61('0x0'));var _=require(_0x1f61('0x1'));module[_0x1f61('0x2')]={'body':{'type':Sequelize[_0x1f61('0x3')](_0x1f61('0x4')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x1f61('0x5'))},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x1f61('0x6')]('in',_0x1f61('0x7')),'defaultValue':_0x1f61('0x7'),'allowNull':![]},'messageId':{'type':Sequelize[_0x1f61('0x8')](0x1fe)},'from':{'type':Sequelize[_0x1f61('0x8')]},'to':{'type':Sequelize['TEXT'](_0x1f61('0x4'))},'cc':{'type':Sequelize[_0x1f61('0x3')](_0x1f61('0x4'))},'bcc':{'type':Sequelize['TEXT']('long')},'subject':{'type':Sequelize[_0x1f61('0x3')]},'sentAt':{'type':Sequelize['DATE']},'attach':{'type':Sequelize[_0x1f61('0x9')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x1f61('0xa')],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize['TEXT'](_0x1f61('0x4'))},'originCc':{'type':Sequelize[_0x1f61('0x3')]('long')},'originChannel':{'type':Sequelize[_0x1f61('0x6')]('Email','Chat'),'defaultValue':_0x1f61('0xb'),'allowNull':![]}}; \ No newline at end of file +var _0x70d5=['lodash','exports','TEXT','long','medium','BOOLEAN','ENUM','out','STRING','INTEGER','Email'];(function(_0x57486e,_0x32283b){var _0x5f110b=function(_0xa18fc3){while(--_0xa18fc3){_0x57486e['push'](_0x57486e['shift']());}};_0x5f110b(++_0x32283b);}(_0x70d5,0x18c));var _0x570d=function(_0x2a607c,_0x2c0ede){_0x2a607c=_0x2a607c-0x0;var _0x46f19a=_0x70d5[_0x2a607c];return _0x46f19a;};'use strict';var Sequelize=require('sequelize');var _=require(_0x570d('0x0'));module[_0x570d('0x1')]={'body':{'type':Sequelize[_0x570d('0x2')](_0x570d('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x570d('0x2')](_0x570d('0x4'))},'read':{'type':Sequelize[_0x570d('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0x570d('0x6')]('in',_0x570d('0x7')),'defaultValue':_0x570d('0x7'),'allowNull':![]},'messageId':{'type':Sequelize[_0x570d('0x8')](0x1fe)},'from':{'type':Sequelize[_0x570d('0x8')]},'to':{'type':Sequelize[_0x570d('0x2')](_0x570d('0x3'))},'cc':{'type':Sequelize['TEXT']('long')},'bcc':{'type':Sequelize['TEXT'](_0x570d('0x3'))},'subject':{'type':Sequelize[_0x570d('0x2')]},'sentAt':{'type':Sequelize['DATE']},'attach':{'type':Sequelize[_0x570d('0x9')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x570d('0x5')],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize['TEXT'](_0x570d('0x3'))},'originCc':{'type':Sequelize['TEXT'](_0x570d('0x3'))},'originChannel':{'type':Sequelize[_0x570d('0x6')](_0x570d('0xa'),'Chat'),'defaultValue':_0x570d('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 a5924a7..8eee7b5 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 _0xf60a=['toString','root','server','files','tmp','message-%s.eml','from','bcc','subject','createdAt','Attachments','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','existsSync','readFileSync','build','download','unlinkSync','eml-format','util','path','html-to-text','../../components/parsers/qs','api','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','./mailMessage.socket','register','jayson/promise','client','http','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','status','json','offset','undefined','limit','count','set','Content-Range','update','sendStatus','stack','name','send','index','MailMessage','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','fields','body','find','destroy','describe','out','MailAccount','findOne','MailAccountId','CmList','List','Contacts','updatedAt','DESC','MailServerOut','Smtp','CloudProvider','getSmtpOptions','attachments','join','basename','CmContact','create','ListId','List\x20not\x20found','SendMail','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','accept','mail','read','readAt','UserId','user','agent','get','isNil','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','contact','User','fullname','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','reject','MailInteraction','MailInteractionId','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT','fromString','rejectmessage','unix'];(function(_0x1b6186,_0x1ec7f2){var _0x186121=function(_0x1748a8){while(--_0x1748a8){_0x1b6186['push'](_0x1b6186['shift']());}};_0x186121(++_0x1ec7f2);}(_0xf60a,0xb7));var _0xaf60=function(_0x3251f7,_0x43d28c){_0x3251f7=_0x3251f7-0x0;var _0x13c104=_0xf60a[_0x3251f7];return _0x13c104;};'use strict';var emlformat=require(_0xaf60('0x0'));var moment=require('moment');var BPromise=require('bluebird');var util=require(_0xaf60('0x1'));var path=require(_0xaf60('0x2'));var fs=require('fs');var _=require('lodash');var Redis=require('ioredis');var htmlToText=require(_0xaf60('0x3'));var qs=require(_0xaf60('0x4'));var logger=require('../../config/logger')(_0xaf60('0x5'));var interaction_log=require(_0xaf60('0x6'))('mail-interactions');var config=require(_0xaf60('0x7'));var db=require(_0xaf60('0x8'))['db'];config[_0xaf60('0x9')]=_[_0xaf60('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xaf60('0x9')]));var htmlEntities=require('html-entities');require(_0xaf60('0xb'))[_0xaf60('0xc')](socket);var jayson=require(_0xaf60('0xd'));var client=jayson[_0xaf60('0xe')]['http']({'port':0x232c});var client9003=jayson[_0xaf60('0xe')][_0xaf60('0xf')]({'port':0x232b});var client9002=jayson[_0xaf60('0xe')][_0xaf60('0xf')]({'port':0x232a});function respondWithRpcPromise(_0x3c54d6,_0x5bce88,_0xbb23e8,_0x3d980a){return new BPromise(function(_0x3a38d1,_0x2f66b3){var _0x1b7e9a=_0x3d980a||client;return _0x1b7e9a[_0xaf60('0x10')](_0x3c54d6,_0xbb23e8)[_0xaf60('0x11')](function(_0x1cc296){logger[_0xaf60('0x12')](_0xaf60('0x13'),_0x5bce88,_0xaf60('0x14'));logger[_0xaf60('0x15')](_0xaf60('0x16'),_0x5bce88,_0xaf60('0x14'),JSON[_0xaf60('0x17')](_0x1cc296));if(_0x1cc296[_0xaf60('0x18')]){if(_0x1cc296[_0xaf60('0x18')]['code']===0x1f4){logger[_0xaf60('0x18')](_0xaf60('0x13'),_0x5bce88,_0x1cc296[_0xaf60('0x18')]['message']);return _0x2f66b3(_0x1cc296[_0xaf60('0x18')][_0xaf60('0x19')]);}logger[_0xaf60('0x18')](_0xaf60('0x13'),_0x5bce88,_0x1cc296[_0xaf60('0x18')][_0xaf60('0x19')]);return _0x3a38d1(_0x1cc296[_0xaf60('0x18')][_0xaf60('0x19')]);}else{logger['info'](_0xaf60('0x13'),_0x5bce88,_0xaf60('0x14'));_0x3a38d1(_0x1cc296[_0xaf60('0x1a')][_0xaf60('0x19')]);}})[_0xaf60('0x1b')](function(_0x30ea52){logger[_0xaf60('0x18')]('MailMessage,\x20%s,\x20%s',_0x5bce88,_0x30ea52);_0x2f66b3(_0x30ea52);});});}function respondWithResult(_0x536aa3,_0x393181){_0x393181=_0x393181||0xc8;return function(_0x38b718){if(_0x38b718){return _0x536aa3[_0xaf60('0x1c')](_0x393181)[_0xaf60('0x1d')](_0x38b718);}};}function respondWithFilteredResult(_0x1ae187,_0x29e74e){return function(_0x1c95e8){if(_0x1c95e8){var _0x18a497=typeof _0x29e74e[_0xaf60('0x1e')]===_0xaf60('0x1f')&&typeof _0x29e74e[_0xaf60('0x20')]===_0xaf60('0x1f');var _0x2c86a1=_0x1c95e8['count'];var _0x652c68=_0x18a497?0x0:_0x29e74e[_0xaf60('0x1e')];var _0x561ea6=_0x18a497?_0x1c95e8[_0xaf60('0x21')]:_0x29e74e[_0xaf60('0x1e')]+_0x29e74e[_0xaf60('0x20')];var _0x16f275;if(_0x561ea6>=_0x2c86a1){_0x561ea6=_0x2c86a1;_0x16f275=0xc8;}else{_0x16f275=0xce;}_0x1ae187[_0xaf60('0x1c')](_0x16f275);return _0x1ae187[_0xaf60('0x22')](_0xaf60('0x23'),_0x652c68+'-'+_0x561ea6+'/'+_0x2c86a1)[_0xaf60('0x1d')](_0x1c95e8);}return null;};}function saveUpdates(_0xb29c0){return function(_0x52b019){if(_0x52b019){return _0x52b019[_0xaf60('0x24')](_0xb29c0)[_0xaf60('0x11')](function(_0x1b24d9){return _0x1b24d9;});}return null;};}function removeEntity(_0x53dd4e){return function(_0x4de655){if(_0x4de655){return _0x4de655['destroy']()[_0xaf60('0x11')](function(){_0x53dd4e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x383ed4){return function(_0x4b922e){if(!_0x4b922e){_0x383ed4[_0xaf60('0x25')](0x194);}return _0x4b922e;};}function handleError(_0x13df89,_0x294171){_0x294171=_0x294171||0x1f4;return function(_0x5215c6){logger['error'](_0x5215c6[_0xaf60('0x26')]);if(_0x5215c6['name']){delete _0x5215c6[_0xaf60('0x27')];}_0x13df89[_0xaf60('0x1c')](_0x294171)[_0xaf60('0x28')](_0x5215c6);};}exports[_0xaf60('0x29')]=function(_0x15da79,_0x3bbbcf){var _0x5b27eb={},_0x3aeab4={},_0x550821={'count':0x0,'rows':[]};var _0x7e5183=_['map'](db[_0xaf60('0x2a')][_0xaf60('0x2b')],function(_0x15e45b){return{'name':_0x15e45b[_0xaf60('0x2c')],'type':_0x15e45b[_0xaf60('0x2d')][_0xaf60('0x2e')]};});_0x3aeab4[_0xaf60('0x2f')]=_[_0xaf60('0x30')](_0x7e5183,_0xaf60('0x27'));_0x3aeab4[_0xaf60('0x31')]=_[_0xaf60('0x32')](_0x15da79[_0xaf60('0x31')]);_0x3aeab4[_0xaf60('0x33')]=_[_0xaf60('0x34')](_0x3aeab4[_0xaf60('0x2f')],_0x3aeab4[_0xaf60('0x31')]);_0x5b27eb[_0xaf60('0x35')]=_[_0xaf60('0x34')](_0x3aeab4['model'],qs['fields'](_0x15da79[_0xaf60('0x31')]['fields']));_0x5b27eb['attributes']=_0x5b27eb['attributes'][_0xaf60('0x36')]?_0x5b27eb[_0xaf60('0x35')]:_0x3aeab4[_0xaf60('0x2f')];if(!_0x15da79['query'][_0xaf60('0x37')](_0xaf60('0x38'))){_0x5b27eb[_0xaf60('0x20')]=qs[_0xaf60('0x20')](_0x15da79[_0xaf60('0x31')][_0xaf60('0x20')]);_0x5b27eb[_0xaf60('0x1e')]=qs[_0xaf60('0x1e')](_0x15da79[_0xaf60('0x31')][_0xaf60('0x1e')]);}_0x5b27eb[_0xaf60('0x39')]=qs['sort'](_0x15da79[_0xaf60('0x31')][_0xaf60('0x3a')]);_0x5b27eb[_0xaf60('0x3b')]=qs['filters'](_[_0xaf60('0x3c')](_0x15da79['query'],_0x3aeab4[_0xaf60('0x33')]),_0x7e5183);if(_0x15da79[_0xaf60('0x31')][_0xaf60('0x3d')]){_0x5b27eb['where']=_['merge'](_0x5b27eb[_0xaf60('0x3b')],{'$or':_[_0xaf60('0x30')](_0x7e5183,function(_0x3e8c2d){if(_0x3e8c2d['type']!==_0xaf60('0x3e')){var _0x9b552f={};_0x9b552f[_0x3e8c2d[_0xaf60('0x27')]]={'$like':'%'+_0x15da79[_0xaf60('0x31')][_0xaf60('0x3d')]+'%'};return _0x9b552f;}})});}_0x5b27eb=_[_0xaf60('0x3f')]({},_0x5b27eb,_0x15da79[_0xaf60('0x40')]);var _0x10c4f2={'where':_0x5b27eb['where']};return db[_0xaf60('0x2a')]['count'](_0x10c4f2)[_0xaf60('0x11')](function(_0x16c2c7){_0x550821['count']=_0x16c2c7;if(_0x15da79[_0xaf60('0x31')][_0xaf60('0x41')]){_0x5b27eb[_0xaf60('0x42')]=[{'all':!![]}];}return db['MailMessage'][_0xaf60('0x43')](_0x5b27eb);})[_0xaf60('0x11')](function(_0x59f9fc){_0x550821[_0xaf60('0x44')]=_0x59f9fc;return _0x550821;})[_0xaf60('0x11')](respondWithFilteredResult(_0x3bbbcf,_0x5b27eb))['catch'](handleError(_0x3bbbcf,null));};exports[_0xaf60('0x45')]=function(_0x14effc,_0x32080f){var _0xa351c1={'raw':!![],'where':{'id':_0x14effc[_0xaf60('0x46')]['id']}},_0x12a360={};_0x12a360['model']=_['keys'](db[_0xaf60('0x2a')][_0xaf60('0x2b')]);_0x12a360[_0xaf60('0x31')]=_[_0xaf60('0x32')](_0x14effc[_0xaf60('0x31')]);_0x12a360['filters']=_[_0xaf60('0x34')](_0x12a360[_0xaf60('0x2f')],_0x12a360[_0xaf60('0x31')]);_0xa351c1['attributes']=_[_0xaf60('0x34')](_0x12a360[_0xaf60('0x2f')],qs['fields'](_0x14effc[_0xaf60('0x31')][_0xaf60('0x47')]));_0xa351c1[_0xaf60('0x35')]=_0xa351c1['attributes'][_0xaf60('0x36')]?_0xa351c1[_0xaf60('0x35')]:_0x12a360[_0xaf60('0x2f')];if(_0x14effc['query'][_0xaf60('0x41')]){_0xa351c1[_0xaf60('0x42')]=[{'all':!![]}];}_0xa351c1=_[_0xaf60('0x3f')]({},_0xa351c1,_0x14effc['options']);return db[_0xaf60('0x2a')]['find'](_0xa351c1)['then'](handleEntityNotFound(_0x32080f,null))['then'](respondWithResult(_0x32080f,null))['catch'](handleError(_0x32080f,null));};exports[_0xaf60('0x24')]=function(_0x20e575,_0x3ba3ad){if(_0x20e575[_0xaf60('0x48')]['id']){delete _0x20e575[_0xaf60('0x48')]['id'];}return db[_0xaf60('0x2a')][_0xaf60('0x49')]({'where':{'id':_0x20e575['params']['id']}})[_0xaf60('0x11')](handleEntityNotFound(_0x3ba3ad,null))[_0xaf60('0x11')](saveUpdates(_0x20e575['body'],null))[_0xaf60('0x11')](respondWithResult(_0x3ba3ad,null))[_0xaf60('0x1b')](handleError(_0x3ba3ad,null));};exports[_0xaf60('0x4a')]=function(_0x30e5fe,_0x2ffa76){return db['MailMessage'][_0xaf60('0x49')]({'where':{'id':_0x30e5fe[_0xaf60('0x46')]['id']}})[_0xaf60('0x11')](handleEntityNotFound(_0x2ffa76,null))[_0xaf60('0x11')](removeEntity(_0x2ffa76,null))['catch'](handleError(_0x2ffa76,null));};exports[_0xaf60('0x4b')]=function(_0x428bb6,_0xfe28f8){return db[_0xaf60('0x2a')][_0xaf60('0x4b')]()[_0xaf60('0x11')](respondWithResult(_0xfe28f8,null))[_0xaf60('0x1b')](handleError(_0xfe28f8,null));};exports['create']=function(_0x784c25,_0x553363){return db[_0xaf60('0x2a')]['create'](_0x784c25[_0xaf60('0x48')])[_0xaf60('0x11')](function(_0x536a66){if(_0x536a66){if(_0x536a66['direction']===_0xaf60('0x4c')&&!_0x536a66['secret']){var _0x5c21d7,_0x3b3b8d,_0x33910a;if(_0x784c25[_0xaf60('0x48')]['to']){_0x3b3b8d=_0x784c25[_0xaf60('0x48')]['to']['split'](',')[0x0];}return db[_0xaf60('0x4d')][_0xaf60('0x4e')]({'where':{'id':_0x536a66[_0xaf60('0x4f')]},'include':[{'model':db[_0xaf60('0x50')],'as':_0xaf60('0x51'),'include':[{'model':db['CmContact'],'as':_0xaf60('0x52'),'where':{'email':_0x3b3b8d},'limit':0x1,'order':[[_0xaf60('0x53'),_0xaf60('0x54')]]}]},{'model':db[_0xaf60('0x55')],'as':_0xaf60('0x56'),'raw':!![],'include':[{'model':db[_0xaf60('0x57')],'as':'CloudProvider','raw':!![]}]}]})[_0xaf60('0x11')](function(_0x16559e){_0x5c21d7=_0x16559e;if(!_0x5c21d7||!_0x5c21d7[_0xaf60('0x56')])return;var _0x32674f=_0x5c21d7[_0xaf60('0x58')]();if(_0x784c25[_0xaf60('0x48')]['attachments']&&_0x784c25[_0xaf60('0x48')][_0xaf60('0x59')][_0xaf60('0x36')]){for(var _0x17bf41=0x0;_0x17bf41<_0x784c25[_0xaf60('0x48')][_0xaf60('0x59')][_0xaf60('0x36')];_0x17bf41+=0x1){_0x784c25[_0xaf60('0x48')][_0xaf60('0x59')][_0x17bf41]={'filename':_0x784c25[_0xaf60('0x48')][_0xaf60('0x59')][_0x17bf41]['name'],'path':path[_0xaf60('0x5a')](config['root'],'server/files/attachments',_0x784c25[_0xaf60('0x48')]['attachments'][_0x17bf41][_0xaf60('0x5b')])};}}_0x33910a={'account':_0x32674f,'message':_0x784c25[_0xaf60('0x48')]};return;})[_0xaf60('0x11')](function(){if(_0x5c21d7[_0xaf60('0x51')]){if(_0x5c21d7[_0xaf60('0x51')]['Contacts'][_0xaf60('0x36')]){return _0x5c21d7[_0xaf60('0x51')][_0xaf60('0x52')][0x0];}else{return db[_0xaf60('0x5c')][_0xaf60('0x5d')](_[_0xaf60('0xa')](_0x784c25[_0xaf60('0x48')],{'firstName':_0x784c25['body']['to'],'email':_0x784c25[_0xaf60('0x48')]['to'],'phone':_0x784c25[_0xaf60('0x48')]['to'],'ListId':_0x5c21d7[_0xaf60('0x5e')]}));}}else{throw new Error(_0xaf60('0x5f'));}})[_0xaf60('0x11')](function(){if(_0x33910a){return respondWithRpcPromise(_0xaf60('0x60'),_0xaf60('0x61'),_0x33910a,client9003)['then'](function(_0xc9afd2){return _0x536a66[_0xaf60('0x24')]({'read':!![],'messageId':_0xc9afd2[_0xaf60('0x62')],'sentAt':moment()[_0xaf60('0x63')](_0xaf60('0x64'))});})[_0xaf60('0x1b')](function(_0x2b019d){logger['error']('%s',JSON[_0xaf60('0x17')](_0x2b019d));return _0x536a66;});}return _0x536a66;});}return _0x536a66;}})['then'](respondWithResult(_0x553363,0xc9))[_0xaf60('0x1b')](handleError(_0x553363,null));};exports[_0xaf60('0x65')]=function(_0x231f64,_0xcec160){var _0x193b6d={'agent':{},'channel':_0xaf60('0x66')};if(_0x231f64['body']['id']){delete _0x231f64[_0xaf60('0x48')]['id'];}_0x231f64[_0xaf60('0x48')][_0xaf60('0x67')]=!![];_0x231f64[_0xaf60('0x48')][_0xaf60('0x68')]=moment()[_0xaf60('0x63')]('YYYY-MM-DD\x20HH:mm:ss');_0x231f64[_0xaf60('0x48')][_0xaf60('0x69')]=_0x231f64[_0xaf60('0x48')][_0xaf60('0x69')]||_0x231f64[_0xaf60('0x6a')]['id'];_0x193b6d[_0xaf60('0x6b')]['id']=_0x231f64[_0xaf60('0x48')][_0xaf60('0x69')];return db[_0xaf60('0x2a')][_0xaf60('0x49')]({'where':{'id':_0x231f64[_0xaf60('0x46')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0xcec160,null))[_0xaf60('0x11')](saveUpdates(_0x231f64['body'],null))['then'](function(_0x4c4b61){if(_0x4c4b61){_0x193b6d['message']=_0x4c4b61[_0xaf60('0x6c')]({'plain':!![]});return db['MailInteraction'][_0xaf60('0x49')]({'where':{'id':_0x4c4b61['MailInteractionId']}});}return null;})[_0xaf60('0x11')](handleEntityNotFound(_0xcec160,null))[_0xaf60('0x11')](function(_0x126bb5){if(_0x126bb5){return _0x126bb5[_0xaf60('0x24')]({'UserId':_0x231f64[_0xaf60('0x48')]['UserId'],'read1stAt':_[_0xaf60('0x6d')](_0x126bb5[_0xaf60('0x6e')])?moment()[_0xaf60('0x63')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xaf60('0x11')](function(_0x53b9d6){if(_0x53b9d6){_0x193b6d[_0xaf60('0x6f')]=_0x53b9d6['get']({'plain':!![]});interaction_log['info'](_0xaf60('0x70'),_0x231f64['user']['id'],_0x231f64[_0xaf60('0x6a')][_0xaf60('0x27')],_0x231f64[_0xaf60('0x6a')][_0xaf60('0x71')],_0x193b6d['interaction']['id'],_0x231f64['body']?JSON[_0xaf60('0x17')](_0x231f64[_0xaf60('0x48')]):_0xaf60('0x72'));return respondWithRpcPromise('AcceptMessage',_0xaf60('0x73'),_0x193b6d);}return null;})[_0xaf60('0x11')](function(_0x583793){var _0x5bb586=_0xaf60('0x74')+_0x583793['message'][_0xaf60('0x75')];return db[_0xaf60('0x76')][_0xaf60('0x31')](_0x5bb586,{'type':db[_0xaf60('0x77')][_0xaf60('0x78')]['SELECT'],'raw':!![]})[_0xaf60('0x11')](function(_0x233531){return _0x233531;});})[_0xaf60('0x11')](function(_0x51a94a){if(_0x51a94a){_0x193b6d[_0xaf60('0x19')][_0xaf60('0x79')]=_0x51a94a[0x0];if(!_0x231f64['body']['UserId'])return;return db[_0xaf60('0x7a')][_0xaf60('0x49')]({'where':{'id':_0x231f64[_0xaf60('0x48')][_0xaf60('0x69')],'role':_0xaf60('0x6b')},'attributes':['id','name',_0xaf60('0x7b'),'email',_0xaf60('0x7c')],'raw':!![]});}return null;})[_0xaf60('0x11')](function(_0x308122){if(!_0x308122)return null;_0x193b6d[_0xaf60('0x19')]['agent']=_0x308122;return _0x193b6d;})[_0xaf60('0x11')](function(_0x140de5){if(_0x140de5){if(_0x231f64[_0xaf60('0x48')][_0xaf60('0x7d')]){_0x193b6d[_0xaf60('0x19')][_0xaf60('0x7e')]=util['format'](_0xaf60('0x7f'),_0x231f64[_0xaf60('0x6a')][_0xaf60('0x27')]);_0x193b6d['message']['channel']=_0x193b6d[_0xaf60('0x80')];_0x193b6d[_0xaf60('0x19')][_0xaf60('0x81')]=_0x193b6d[_0xaf60('0x80')];_0x193b6d['message'][_0xaf60('0x82')]=_0xaf60('0x65');_0x193b6d['message'][_0xaf60('0x48')]=htmlToText['fromString'](_0x193b6d[_0xaf60('0x19')][_0xaf60('0x48')]);return respondWithRpcPromise(_0xaf60('0x83'),'EventManager',{'event':_0xaf60('0x84'),'message':_0x193b6d[_0xaf60('0x19')]},client9002)[_0xaf60('0x11')](function(){return _0x193b6d;});}return _0x193b6d;}return null;})[_0xaf60('0x11')](respondWithResult(_0xcec160,null))[_0xaf60('0x1b')](handleError(_0xcec160,null));};exports[_0xaf60('0x85')]=function(_0x15b61e,_0x492724){var _0x136502={'agent':{},'channel':_0xaf60('0x66')};if(_0x15b61e[_0xaf60('0x48')]['id']){delete _0x15b61e[_0xaf60('0x48')]['id'];}_0x15b61e['body'][_0xaf60('0x69')]=_0x15b61e[_0xaf60('0x48')]['UserId']||_0x15b61e[_0xaf60('0x6a')]['id'];_0x136502['agent']['id']=_0x15b61e[_0xaf60('0x48')][_0xaf60('0x69')];return db[_0xaf60('0x2a')][_0xaf60('0x49')]({'where':{'id':_0x15b61e[_0xaf60('0x46')]['id'],'UserId':null}})[_0xaf60('0x11')](handleEntityNotFound(_0x492724,null))[_0xaf60('0x11')](function(_0x286d70){if(_0x286d70){_0x136502[_0xaf60('0x19')]=_0x286d70[_0xaf60('0x6c')]({'plain':!![]});return db[_0xaf60('0x86')][_0xaf60('0x49')]({'where':{'id':_0x286d70[_0xaf60('0x87')]}});}return null;})[_0xaf60('0x11')](handleEntityNotFound(_0x492724,null))['then'](function(_0x3b31ab){if(_0x3b31ab){_0x136502[_0xaf60('0x6f')]=_0x3b31ab[_0xaf60('0x6c')]({'plain':!![]});interaction_log[_0xaf60('0x12')](_0xaf60('0x88'),_0x15b61e['user']['id'],_0x15b61e[_0xaf60('0x6a')][_0xaf60('0x27')],_0x15b61e[_0xaf60('0x6a')][_0xaf60('0x71')],_0x136502[_0xaf60('0x6f')]['id'],_0x15b61e['body']?JSON['stringify'](_0x15b61e[_0xaf60('0x48')]):_0xaf60('0x72'));return respondWithRpcPromise(_0xaf60('0x89'),_0xaf60('0x8a'),_0x136502);}return null;})['then'](function(_0x1cede2){var _0x8431e7=_0xaf60('0x74')+_0x1cede2[_0xaf60('0x19')]['ContactId'];return db['sequelize'][_0xaf60('0x31')](_0x8431e7,{'type':db[_0xaf60('0x77')][_0xaf60('0x78')][_0xaf60('0x8b')],'raw':!![]})[_0xaf60('0x11')](function(_0xb98d69){return _0xb98d69;});})[_0xaf60('0x11')](function(_0x5ef005){if(_0x5ef005){_0x136502['message'][_0xaf60('0x79')]=_0x5ef005[0x0];if(!_0x15b61e['body']['UserId'])return;return db[_0xaf60('0x7a')][_0xaf60('0x49')]({'where':{'id':_0x15b61e[_0xaf60('0x48')][_0xaf60('0x69')],'role':_0xaf60('0x6b')},'attributes':['id','name',_0xaf60('0x7b'),'email',_0xaf60('0x7c')],'raw':!![]});}return null;})[_0xaf60('0x11')](function(_0x1d72e3){if(!_0x1d72e3)return null;_0x136502[_0xaf60('0x19')][_0xaf60('0x6b')]=_0x1d72e3;return _0x136502;})[_0xaf60('0x11')](function(_0x17dc32){if(_0x17dc32){_0x17dc32[_0xaf60('0x19')]['interface']=util['format'](_0xaf60('0x7f'),_0x15b61e['user'][_0xaf60('0x27')]);_0x17dc32[_0xaf60('0x19')][_0xaf60('0x80')]=_0x136502['channel'];_0x17dc32[_0xaf60('0x19')][_0xaf60('0x81')]=_0x136502[_0xaf60('0x80')];_0x17dc32['message'][_0xaf60('0x82')]=_0xaf60('0x85');_0x17dc32[_0xaf60('0x19')][_0xaf60('0x48')]=htmlToText[_0xaf60('0x8c')](_0x136502[_0xaf60('0x19')][_0xaf60('0x48')]);respondWithRpcPromise(_0xaf60('0x83'),'EventManager',{'event':_0xaf60('0x8d'),'message':_0x17dc32[_0xaf60('0x19')]},client9002);return _0x136502;}return null;})[_0xaf60('0x11')](respondWithResult(_0x492724,null))[_0xaf60('0x1b')](handleError(_0x492724,null));};exports['download']=function(_0x4858c4,_0x1fd4d6){var _0x476819=moment()[_0xaf60('0x8e')]()[_0xaf60('0x8f')]();var _0x57c2ca=path['join'](config[_0xaf60('0x90')],_0xaf60('0x91'),_0xaf60('0x92'),_0xaf60('0x93'));var _0x31bef6=path[_0xaf60('0x5a')](config[_0xaf60('0x90')],'server',_0xaf60('0x92'),_0xaf60('0x59'));var _0x506d8a=util['format'](_0xaf60('0x94'),_0x476819);return db[_0xaf60('0x2a')][_0xaf60('0x49')]({'where':{'id':_0x4858c4['params']['id']},'attributes':['id',_0xaf60('0x48'),_0xaf60('0x95'),'to','cc',_0xaf60('0x96'),_0xaf60('0x97'),_0xaf60('0x98')],'include':_0x4858c4[_0xaf60('0x31')]['attachments']?[{'model':db['Attachment'],'as':_0xaf60('0x99')}]:undefined})['then'](handleEntityNotFound(_0x1fd4d6,null))[_0xaf60('0x11')](function(_0x24e4ac){if(_0x24e4ac){var _0x19cab1=_0x24e4ac;var _0x26df50={'from':_0x19cab1[_0xaf60('0x95')],'to':_0x19cab1['to'],'subject':_0x19cab1[_0xaf60('0x97')],'html':htmlEntities[_0xaf60('0x9a')](_0x19cab1[_0xaf60('0x48')]),'headers':{'Date':moment(_0x19cab1[_0xaf60('0x98')])['format'](_0xaf60('0x9b'))},'attachments':[]};if(_0x24e4ac['cc']){_0x26df50['headers']['Cc']=_0x24e4ac['cc'];}if(_0x24e4ac[_0xaf60('0x96')]){_0x26df50[_0xaf60('0x9c')][_0xaf60('0x9d')]=_0x24e4ac[_0xaf60('0x96')];}return new BPromise(function(_0x408994,_0x2f4a7){if(_0x24e4ac[_0xaf60('0x99')]){for(var _0x76279=0x0;_0x76279<_0x24e4ac['Attachments'][_0xaf60('0x36')];_0x76279++){var _0x7398cf=_0x24e4ac[_0xaf60('0x99')][_0x76279];var _0x17e77c=path[_0xaf60('0x5a')](_0x31bef6,_0x7398cf[_0xaf60('0x5b')]);if(fs[_0xaf60('0x9e')](_0x17e77c)){_0x26df50[_0xaf60('0x59')]['push']({'name':_0x7398cf[_0xaf60('0x27')],'contentType':_0x7398cf['type'],'data':fs[_0xaf60('0x9f')](_0x17e77c)});}}}emlformat[_0xaf60('0xa0')](_0x26df50,function(_0x66e70,_0x1f92a9){if(_0x66e70)return _0x2f4a7(_0x66e70);fs['writeFileSync'](path['join'](_0x57c2ca,_0x506d8a),_0x1f92a9);return _0x408994(_0x1f92a9);});});}})[_0xaf60('0x11')](function(_0x168ebf){if(_0x168ebf){return _0x1fd4d6[_0xaf60('0xa1')](path['join'](_0x57c2ca,_0x506d8a),_0x506d8a,function(_0x5ea54a){if(!_0x5ea54a)fs[_0xaf60('0xa2')](path['join'](_0x57c2ca,_0x506d8a));});}})[_0xaf60('0x1b')](handleError(_0x1fd4d6,null));}; \ No newline at end of file +var _0xfdaa=['ContactId','sequelize','Sequelize','SELECT','contact','User','fullname','email','internal','manual','interface','channel','motionChannel','event','fromString','EventManager','acceptmessage','reject','MailInteraction','MailInteractionId','null','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','QueryTypes','rejectmessage','download','unix','toString','root','server','files','tmp','from','createdAt','Attachments','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','Bcc','existsSync','push','readFileSync','build','writeFileSync','unlinkSync','eml-format','moment','bluebird','util','path','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','mail-interactions','../../config/environment','../../mysqldb','redis','defaults','localhost','html-entities','./mailMessage.socket','register','jayson/promise','http','client','request','then','info','debug','request\x20sent','error','message','MailMessage,\x20%s,\x20%s','result','status','json','offset','limit','count','set','Content-Range','update','destroy','end','sendStatus','stack','name','send','index','map','MailMessage','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','options','findAll','rows','catch','show','params','includeAll','include','merge','body','find','describe','create','direction','out','secret','MailAccount','findOne','MailAccountId','List','Contacts','DESC','MailServerOut','Smtp','CloudProvider','attachments','join','server/files/attachments','basename','ListId','List\x20not\x20found','SendMail','sendMail','format','YYYY-MM-DD\x20HH:mm:ss','stringify','accept','mail','read','readAt','UserId','user','agent','isNil','read1stAt','interaction','get','role','AcceptMessage'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xfdaa,0x171));var _0xafda=function(_0x1f9503,_0x8e450b){_0x1f9503=_0x1f9503-0x0;var _0xaab94f=_0xfdaa[_0x1f9503];return _0xaab94f;};'use strict';var emlformat=require(_0xafda('0x0'));var moment=require(_0xafda('0x1'));var BPromise=require(_0xafda('0x2'));var util=require(_0xafda('0x3'));var path=require(_0xafda('0x4'));var fs=require('fs');var _=require(_0xafda('0x5'));var Redis=require(_0xafda('0x6'));var htmlToText=require('html-to-text');var qs=require(_0xafda('0x7'));var logger=require(_0xafda('0x8'))(_0xafda('0x9'));var interaction_log=require(_0xafda('0x8'))(_0xafda('0xa'));var config=require(_0xafda('0xb'));var db=require(_0xafda('0xc'))['db'];config[_0xafda('0xd')]=_[_0xafda('0xe')](config[_0xafda('0xd')],{'host':_0xafda('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xafda('0xd')]));var htmlEntities=require(_0xafda('0x10'));require(_0xafda('0x11'))[_0xafda('0x12')](socket);var jayson=require(_0xafda('0x13'));var client=jayson['client'][_0xafda('0x14')]({'port':0x232c});var client9003=jayson['client'][_0xafda('0x14')]({'port':0x232b});var client9002=jayson[_0xafda('0x15')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2a0bc4,_0x388f48,_0x1d2b91,_0x1d9254){return new BPromise(function(_0x1a5c18,_0x3d1ed4){var _0x5c0a5b=_0x1d9254||client;return _0x5c0a5b[_0xafda('0x16')](_0x2a0bc4,_0x1d2b91)[_0xafda('0x17')](function(_0xa1a9e5){logger[_0xafda('0x18')]('MailMessage,\x20%s,\x20%s',_0x388f48,'request\x20sent');logger[_0xafda('0x19')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x388f48,_0xafda('0x1a'),JSON['stringify'](_0xa1a9e5));if(_0xa1a9e5['error']){if(_0xa1a9e5[_0xafda('0x1b')]['code']===0x1f4){logger[_0xafda('0x1b')]('MailMessage,\x20%s,\x20%s',_0x388f48,_0xa1a9e5[_0xafda('0x1b')]['message']);return _0x3d1ed4(_0xa1a9e5[_0xafda('0x1b')][_0xafda('0x1c')]);}logger['error']('MailMessage,\x20%s,\x20%s',_0x388f48,_0xa1a9e5['error'][_0xafda('0x1c')]);return _0x1a5c18(_0xa1a9e5[_0xafda('0x1b')][_0xafda('0x1c')]);}else{logger[_0xafda('0x18')](_0xafda('0x1d'),_0x388f48,_0xafda('0x1a'));_0x1a5c18(_0xa1a9e5[_0xafda('0x1e')]['message']);}})['catch'](function(_0x1ae605){logger[_0xafda('0x1b')](_0xafda('0x1d'),_0x388f48,_0x1ae605);_0x3d1ed4(_0x1ae605);});});}function respondWithResult(_0x2f4a8c,_0x19eb42){_0x19eb42=_0x19eb42||0xc8;return function(_0x404ee5){if(_0x404ee5){return _0x2f4a8c[_0xafda('0x1f')](_0x19eb42)[_0xafda('0x20')](_0x404ee5);}};}function respondWithFilteredResult(_0x3207cf,_0xebdefe){return function(_0x256262){if(_0x256262){var _0xfaea9=typeof _0xebdefe[_0xafda('0x21')]==='undefined'&&typeof _0xebdefe[_0xafda('0x22')]==='undefined';var _0x4b7e6f=_0x256262[_0xafda('0x23')];var _0x1c21b7=_0xfaea9?0x0:_0xebdefe[_0xafda('0x21')];var _0x31957e=_0xfaea9?_0x256262['count']:_0xebdefe[_0xafda('0x21')]+_0xebdefe[_0xafda('0x22')];var _0x37a1de;if(_0x31957e>=_0x4b7e6f){_0x31957e=_0x4b7e6f;_0x37a1de=0xc8;}else{_0x37a1de=0xce;}_0x3207cf['status'](_0x37a1de);return _0x3207cf[_0xafda('0x24')](_0xafda('0x25'),_0x1c21b7+'-'+_0x31957e+'/'+_0x4b7e6f)[_0xafda('0x20')](_0x256262);}return null;};}function saveUpdates(_0x45d99e){return function(_0x4357be){if(_0x4357be){return _0x4357be[_0xafda('0x26')](_0x45d99e)['then'](function(_0x5a29b5){return _0x5a29b5;});}return null;};}function removeEntity(_0xa8a794){return function(_0x20a598){if(_0x20a598){return _0x20a598[_0xafda('0x27')]()[_0xafda('0x17')](function(){_0xa8a794['status'](0xcc)[_0xafda('0x28')]();});}};}function handleEntityNotFound(_0x4047e5){return function(_0x4abfd8){if(!_0x4abfd8){_0x4047e5[_0xafda('0x29')](0x194);}return _0x4abfd8;};}function handleError(_0x2abb82,_0x29bb08){_0x29bb08=_0x29bb08||0x1f4;return function(_0x3793a0){logger[_0xafda('0x1b')](_0x3793a0[_0xafda('0x2a')]);if(_0x3793a0[_0xafda('0x2b')]){delete _0x3793a0[_0xafda('0x2b')];}_0x2abb82[_0xafda('0x1f')](_0x29bb08)[_0xafda('0x2c')](_0x3793a0);};}exports[_0xafda('0x2d')]=function(_0x163695,_0x5758e2){var _0x53fc71={},_0xd7adc6={},_0x1194cc={'count':0x0,'rows':[]};var _0x5ba715=_[_0xafda('0x2e')](db[_0xafda('0x2f')][_0xafda('0x30')],function(_0x4f4d76){return{'name':_0x4f4d76[_0xafda('0x31')],'type':_0x4f4d76[_0xafda('0x32')][_0xafda('0x33')]};});_0xd7adc6['model']=_['map'](_0x5ba715,_0xafda('0x2b'));_0xd7adc6[_0xafda('0x34')]=_[_0xafda('0x35')](_0x163695[_0xafda('0x34')]);_0xd7adc6[_0xafda('0x36')]=_[_0xafda('0x37')](_0xd7adc6[_0xafda('0x38')],_0xd7adc6[_0xafda('0x34')]);_0x53fc71[_0xafda('0x39')]=_[_0xafda('0x37')](_0xd7adc6[_0xafda('0x38')],qs[_0xafda('0x3a')](_0x163695['query'][_0xafda('0x3a')]));_0x53fc71[_0xafda('0x39')]=_0x53fc71[_0xafda('0x39')][_0xafda('0x3b')]?_0x53fc71[_0xafda('0x39')]:_0xd7adc6[_0xafda('0x38')];if(!_0x163695[_0xafda('0x34')][_0xafda('0x3c')](_0xafda('0x3d'))){_0x53fc71[_0xafda('0x22')]=qs['limit'](_0x163695['query']['limit']);_0x53fc71[_0xafda('0x21')]=qs[_0xafda('0x21')](_0x163695['query'][_0xafda('0x21')]);}_0x53fc71[_0xafda('0x3e')]=qs[_0xafda('0x3f')](_0x163695[_0xafda('0x34')]['sort']);_0x53fc71[_0xafda('0x40')]=qs[_0xafda('0x36')](_[_0xafda('0x41')](_0x163695['query'],_0xd7adc6['filters']),_0x5ba715);if(_0x163695['query']['filter']){_0x53fc71[_0xafda('0x40')]=_['merge'](_0x53fc71['where'],{'$or':_[_0xafda('0x2e')](_0x5ba715,function(_0x30dd7d){if(_0x30dd7d['type']!==_0xafda('0x42')){var _0x21b695={};_0x21b695[_0x30dd7d['name']]={'$like':'%'+_0x163695[_0xafda('0x34')][_0xafda('0x43')]+'%'};return _0x21b695;}})});}_0x53fc71=_['merge']({},_0x53fc71,_0x163695[_0xafda('0x44')]);var _0x3d0ae9={'where':_0x53fc71[_0xafda('0x40')]};return db[_0xafda('0x2f')][_0xafda('0x23')](_0x3d0ae9)[_0xafda('0x17')](function(_0x1c016f){_0x1194cc['count']=_0x1c016f;if(_0x163695[_0xafda('0x34')]['includeAll']){_0x53fc71['include']=[{'all':!![]}];}return db[_0xafda('0x2f')][_0xafda('0x45')](_0x53fc71);})[_0xafda('0x17')](function(_0x45482b){_0x1194cc[_0xafda('0x46')]=_0x45482b;return _0x1194cc;})[_0xafda('0x17')](respondWithFilteredResult(_0x5758e2,_0x53fc71))[_0xafda('0x47')](handleError(_0x5758e2,null));};exports[_0xafda('0x48')]=function(_0x375f86,_0x111702){var _0xe14f21={'raw':!![],'where':{'id':_0x375f86[_0xafda('0x49')]['id']}},_0x2093a1={};_0x2093a1[_0xafda('0x38')]=_[_0xafda('0x35')](db[_0xafda('0x2f')][_0xafda('0x30')]);_0x2093a1[_0xafda('0x34')]=_[_0xafda('0x35')](_0x375f86[_0xafda('0x34')]);_0x2093a1[_0xafda('0x36')]=_[_0xafda('0x37')](_0x2093a1[_0xafda('0x38')],_0x2093a1['query']);_0xe14f21[_0xafda('0x39')]=_[_0xafda('0x37')](_0x2093a1[_0xafda('0x38')],qs['fields'](_0x375f86[_0xafda('0x34')][_0xafda('0x3a')]));_0xe14f21[_0xafda('0x39')]=_0xe14f21[_0xafda('0x39')][_0xafda('0x3b')]?_0xe14f21[_0xafda('0x39')]:_0x2093a1[_0xafda('0x38')];if(_0x375f86[_0xafda('0x34')][_0xafda('0x4a')]){_0xe14f21[_0xafda('0x4b')]=[{'all':!![]}];}_0xe14f21=_[_0xafda('0x4c')]({},_0xe14f21,_0x375f86[_0xafda('0x44')]);return db[_0xafda('0x2f')]['find'](_0xe14f21)[_0xafda('0x17')](handleEntityNotFound(_0x111702,null))[_0xafda('0x17')](respondWithResult(_0x111702,null))['catch'](handleError(_0x111702,null));};exports[_0xafda('0x26')]=function(_0x1bee4f,_0x1dde72){if(_0x1bee4f['body']['id']){delete _0x1bee4f[_0xafda('0x4d')]['id'];}return db[_0xafda('0x2f')][_0xafda('0x4e')]({'where':{'id':_0x1bee4f[_0xafda('0x49')]['id']}})[_0xafda('0x17')](handleEntityNotFound(_0x1dde72,null))[_0xafda('0x17')](saveUpdates(_0x1bee4f[_0xafda('0x4d')],null))[_0xafda('0x17')](respondWithResult(_0x1dde72,null))[_0xafda('0x47')](handleError(_0x1dde72,null));};exports[_0xafda('0x27')]=function(_0x17f6fb,_0x2ee8b1){return db['MailMessage'][_0xafda('0x4e')]({'where':{'id':_0x17f6fb['params']['id']}})[_0xafda('0x17')](handleEntityNotFound(_0x2ee8b1,null))[_0xafda('0x17')](removeEntity(_0x2ee8b1,null))['catch'](handleError(_0x2ee8b1,null));};exports['describe']=function(_0x44ec24,_0x38c192){return db[_0xafda('0x2f')][_0xafda('0x4f')]()['then'](respondWithResult(_0x38c192,null))[_0xafda('0x47')](handleError(_0x38c192,null));};exports[_0xafda('0x50')]=function(_0x70d858,_0x4c8155){return db[_0xafda('0x2f')]['create'](_0x70d858[_0xafda('0x4d')])[_0xafda('0x17')](function(_0x5dd4f2){if(_0x5dd4f2){if(_0x5dd4f2[_0xafda('0x51')]===_0xafda('0x52')&&!_0x5dd4f2[_0xafda('0x53')]){var _0x2af7f7,_0x45f012,_0x3dda85;if(_0x70d858[_0xafda('0x4d')]['to']){_0x45f012=_0x70d858['body']['to']['split'](',')[0x0];}return db[_0xafda('0x54')][_0xafda('0x55')]({'where':{'id':_0x5dd4f2[_0xafda('0x56')]},'include':[{'model':db['CmList'],'as':_0xafda('0x57'),'include':[{'model':db['CmContact'],'as':_0xafda('0x58'),'where':{'email':_0x45f012},'limit':0x1,'order':[['updatedAt',_0xafda('0x59')]]}]},{'model':db[_0xafda('0x5a')],'as':_0xafda('0x5b'),'raw':!![],'include':[{'model':db[_0xafda('0x5c')],'as':_0xafda('0x5c'),'raw':!![]}]}]})[_0xafda('0x17')](function(_0x339262){_0x2af7f7=_0x339262;if(!_0x2af7f7||!_0x2af7f7['Smtp'])return;var _0x3899f4=_0x2af7f7['getSmtpOptions']();if(_0x70d858[_0xafda('0x4d')][_0xafda('0x5d')]&&_0x70d858[_0xafda('0x4d')][_0xafda('0x5d')][_0xafda('0x3b')]){for(var _0x248d8a=0x0;_0x248d8a<_0x70d858[_0xafda('0x4d')][_0xafda('0x5d')]['length'];_0x248d8a+=0x1){_0x70d858[_0xafda('0x4d')][_0xafda('0x5d')][_0x248d8a]={'filename':_0x70d858['body'][_0xafda('0x5d')][_0x248d8a][_0xafda('0x2b')],'path':path[_0xafda('0x5e')](config['root'],_0xafda('0x5f'),_0x70d858['body'][_0xafda('0x5d')][_0x248d8a][_0xafda('0x60')])};}}_0x3dda85={'account':_0x3899f4,'message':_0x70d858[_0xafda('0x4d')]};return;})['then'](function(){if(_0x2af7f7['List']){if(_0x2af7f7[_0xafda('0x57')][_0xafda('0x58')][_0xafda('0x3b')]){return _0x2af7f7[_0xafda('0x57')][_0xafda('0x58')][0x0];}else{return db['CmContact'][_0xafda('0x50')](_['defaults'](_0x70d858[_0xafda('0x4d')],{'firstName':_0x70d858[_0xafda('0x4d')]['to'],'email':_0x70d858[_0xafda('0x4d')]['to'],'phone':_0x70d858[_0xafda('0x4d')]['to'],'ListId':_0x2af7f7[_0xafda('0x61')]}));}}else{throw new Error(_0xafda('0x62'));}})['then'](function(){if(_0x3dda85){return respondWithRpcPromise(_0xafda('0x63'),_0xafda('0x64'),_0x3dda85,client9003)[_0xafda('0x17')](function(_0x27e16a){return _0x5dd4f2['update']({'read':!![],'messageId':_0x27e16a['messageId'],'sentAt':moment()[_0xafda('0x65')](_0xafda('0x66'))});})[_0xafda('0x47')](function(_0x22eaca){logger[_0xafda('0x1b')]('%s',JSON[_0xafda('0x67')](_0x22eaca));return _0x5dd4f2;});}return _0x5dd4f2;});}return _0x5dd4f2;}})[_0xafda('0x17')](respondWithResult(_0x4c8155,0xc9))[_0xafda('0x47')](handleError(_0x4c8155,null));};exports[_0xafda('0x68')]=function(_0xfdf11,_0x41f8be){var _0x20b285={'agent':{},'channel':_0xafda('0x69')};if(_0xfdf11['body']['id']){delete _0xfdf11['body']['id'];}_0xfdf11[_0xafda('0x4d')][_0xafda('0x6a')]=!![];_0xfdf11['body'][_0xafda('0x6b')]=moment()[_0xafda('0x65')](_0xafda('0x66'));_0xfdf11[_0xafda('0x4d')][_0xafda('0x6c')]=_0xfdf11[_0xafda('0x4d')][_0xafda('0x6c')]||_0xfdf11[_0xafda('0x6d')]['id'];_0x20b285[_0xafda('0x6e')]['id']=_0xfdf11[_0xafda('0x4d')][_0xafda('0x6c')];return db[_0xafda('0x2f')]['find']({'where':{'id':_0xfdf11[_0xafda('0x49')]['id'],'UserId':null}})[_0xafda('0x17')](handleEntityNotFound(_0x41f8be,null))[_0xafda('0x17')](saveUpdates(_0xfdf11[_0xafda('0x4d')],null))[_0xafda('0x17')](function(_0x39ac5f){if(_0x39ac5f){_0x20b285[_0xafda('0x1c')]=_0x39ac5f['get']({'plain':!![]});return db['MailInteraction'][_0xafda('0x4e')]({'where':{'id':_0x39ac5f['MailInteractionId']}});}return null;})[_0xafda('0x17')](handleEntityNotFound(_0x41f8be,null))['then'](function(_0x4da346){if(_0x4da346){return _0x4da346[_0xafda('0x26')]({'UserId':_0xfdf11[_0xafda('0x4d')][_0xafda('0x6c')],'read1stAt':_[_0xafda('0x6f')](_0x4da346[_0xafda('0x70')])?moment()[_0xafda('0x65')](_0xafda('0x66')):undefined});}return null;})[_0xafda('0x17')](function(_0x3b50b4){if(_0x3b50b4){_0x20b285[_0xafda('0x71')]=_0x3b50b4[_0xafda('0x72')]({'plain':!![]});interaction_log['info']('[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0xfdf11[_0xafda('0x6d')]['id'],_0xfdf11[_0xafda('0x6d')]['name'],_0xfdf11[_0xafda('0x6d')][_0xafda('0x73')],_0x20b285[_0xafda('0x71')]['id'],_0xfdf11[_0xafda('0x4d')]?JSON[_0xafda('0x67')](_0xfdf11[_0xafda('0x4d')]):'null');return respondWithRpcPromise(_0xafda('0x74'),'acceptMessage',_0x20b285);}return null;})[_0xafda('0x17')](function(_0x4273a8){var _0x253e94='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4273a8[_0xafda('0x1c')][_0xafda('0x75')];return db[_0xafda('0x76')][_0xafda('0x34')](_0x253e94,{'type':db[_0xafda('0x77')]['QueryTypes'][_0xafda('0x78')],'raw':!![]})[_0xafda('0x17')](function(_0x2f7eb7){return _0x2f7eb7;});})['then'](function(_0x160a19){if(_0x160a19){_0x20b285[_0xafda('0x1c')][_0xafda('0x79')]=_0x160a19[0x0];if(!_0xfdf11[_0xafda('0x4d')][_0xafda('0x6c')])return;return db[_0xafda('0x7a')][_0xafda('0x4e')]({'where':{'id':_0xfdf11['body'][_0xafda('0x6c')],'role':_0xafda('0x6e')},'attributes':['id','name',_0xafda('0x7b'),_0xafda('0x7c'),_0xafda('0x7d')],'raw':!![]});}return null;})['then'](function(_0xf04507){if(!_0xf04507)return null;_0x20b285['message'][_0xafda('0x6e')]=_0xf04507;return _0x20b285;})[_0xafda('0x17')](function(_0x4db7f7){if(_0x4db7f7){if(_0xfdf11[_0xafda('0x4d')][_0xafda('0x7e')]){_0x20b285[_0xafda('0x1c')][_0xafda('0x7f')]=util[_0xafda('0x65')]('SIP/%s',_0xfdf11[_0xafda('0x6d')]['name']);_0x20b285[_0xafda('0x1c')][_0xafda('0x80')]=_0x20b285['channel'];_0x20b285['message'][_0xafda('0x81')]=_0x20b285[_0xafda('0x80')];_0x20b285[_0xafda('0x1c')][_0xafda('0x82')]='accept';_0x20b285[_0xafda('0x1c')][_0xafda('0x4d')]=htmlToText[_0xafda('0x83')](_0x20b285[_0xafda('0x1c')][_0xafda('0x4d')]);return respondWithRpcPromise('EventManager',_0xafda('0x84'),{'event':_0xafda('0x85'),'message':_0x20b285['message']},client9002)[_0xafda('0x17')](function(){return _0x20b285;});}return _0x20b285;}return null;})['then'](respondWithResult(_0x41f8be,null))[_0xafda('0x47')](handleError(_0x41f8be,null));};exports[_0xafda('0x86')]=function(_0x5975e3,_0x491743){var _0xef8bb9={'agent':{},'channel':'mail'};if(_0x5975e3[_0xafda('0x4d')]['id']){delete _0x5975e3[_0xafda('0x4d')]['id'];}_0x5975e3[_0xafda('0x4d')]['UserId']=_0x5975e3[_0xafda('0x4d')]['UserId']||_0x5975e3['user']['id'];_0xef8bb9[_0xafda('0x6e')]['id']=_0x5975e3[_0xafda('0x4d')][_0xafda('0x6c')];return db['MailMessage']['find']({'where':{'id':_0x5975e3[_0xafda('0x49')]['id'],'UserId':null}})[_0xafda('0x17')](handleEntityNotFound(_0x491743,null))[_0xafda('0x17')](function(_0x78a63f){if(_0x78a63f){_0xef8bb9[_0xafda('0x1c')]=_0x78a63f[_0xafda('0x72')]({'plain':!![]});return db[_0xafda('0x87')]['find']({'where':{'id':_0x78a63f[_0xafda('0x88')]}});}return null;})[_0xafda('0x17')](handleEntityNotFound(_0x491743,null))[_0xafda('0x17')](function(_0x2f8c4b){if(_0x2f8c4b){_0xef8bb9[_0xafda('0x71')]=_0x2f8c4b['get']({'plain':!![]});interaction_log[_0xafda('0x18')]('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x5975e3[_0xafda('0x6d')]['id'],_0x5975e3[_0xafda('0x6d')][_0xafda('0x2b')],_0x5975e3[_0xafda('0x6d')][_0xafda('0x73')],_0xef8bb9[_0xafda('0x71')]['id'],_0x5975e3[_0xafda('0x4d')]?JSON[_0xafda('0x67')](_0x5975e3[_0xafda('0x4d')]):_0xafda('0x89'));return respondWithRpcPromise('RejectMessage',_0xafda('0x8a'),_0xef8bb9);}return null;})[_0xafda('0x17')](function(_0x1c80b0){var _0x409a95=_0xafda('0x8b')+_0x1c80b0[_0xafda('0x1c')][_0xafda('0x75')];return db[_0xafda('0x76')][_0xafda('0x34')](_0x409a95,{'type':db[_0xafda('0x77')][_0xafda('0x8c')][_0xafda('0x78')],'raw':!![]})[_0xafda('0x17')](function(_0xa60d88){return _0xa60d88;});})[_0xafda('0x17')](function(_0x969c3d){if(_0x969c3d){_0xef8bb9[_0xafda('0x1c')][_0xafda('0x79')]=_0x969c3d[0x0];if(!_0x5975e3[_0xafda('0x4d')][_0xafda('0x6c')])return;return db[_0xafda('0x7a')][_0xafda('0x4e')]({'where':{'id':_0x5975e3[_0xafda('0x4d')][_0xafda('0x6c')],'role':_0xafda('0x6e')},'attributes':['id','name',_0xafda('0x7b'),'email',_0xafda('0x7d')],'raw':!![]});}return null;})[_0xafda('0x17')](function(_0x42d1ad){if(!_0x42d1ad)return null;_0xef8bb9[_0xafda('0x1c')]['agent']=_0x42d1ad;return _0xef8bb9;})[_0xafda('0x17')](function(_0x3988f0){if(_0x3988f0){_0x3988f0['message']['interface']=util[_0xafda('0x65')]('SIP/%s',_0x5975e3[_0xafda('0x6d')]['name']);_0x3988f0['message']['channel']=_0xef8bb9[_0xafda('0x80')];_0x3988f0[_0xafda('0x1c')]['motionChannel']=_0xef8bb9[_0xafda('0x80')];_0x3988f0[_0xafda('0x1c')][_0xafda('0x82')]=_0xafda('0x86');_0x3988f0[_0xafda('0x1c')][_0xafda('0x4d')]=htmlToText[_0xafda('0x83')](_0xef8bb9['message'][_0xafda('0x4d')]);respondWithRpcPromise('EventManager','EventManager',{'event':_0xafda('0x8d'),'message':_0x3988f0[_0xafda('0x1c')]},client9002);return _0xef8bb9;}return null;})[_0xafda('0x17')](respondWithResult(_0x491743,null))[_0xafda('0x47')](handleError(_0x491743,null));};exports[_0xafda('0x8e')]=function(_0x4cbe14,_0x2a3a97){var _0x2336bd=moment()[_0xafda('0x8f')]()[_0xafda('0x90')]();var _0x42e68e=path[_0xafda('0x5e')](config[_0xafda('0x91')],_0xafda('0x92'),_0xafda('0x93'),_0xafda('0x94'));var _0x5d7d0e=path[_0xafda('0x5e')](config[_0xafda('0x91')],'server',_0xafda('0x93'),_0xafda('0x5d'));var _0x4701d0=util[_0xafda('0x65')]('message-%s.eml',_0x2336bd);return db[_0xafda('0x2f')]['find']({'where':{'id':_0x4cbe14[_0xafda('0x49')]['id']},'attributes':['id',_0xafda('0x4d'),_0xafda('0x95'),'to','cc','bcc','subject',_0xafda('0x96')],'include':_0x4cbe14[_0xafda('0x34')]['attachments']?[{'model':db['Attachment'],'as':_0xafda('0x97')}]:undefined})['then'](handleEntityNotFound(_0x2a3a97,null))[_0xafda('0x17')](function(_0x3fd293){if(_0x3fd293){var _0x54a1b2=_0x3fd293;var _0x478e60={'from':_0x54a1b2[_0xafda('0x95')],'to':_0x54a1b2['to'],'subject':_0x54a1b2['subject'],'html':htmlEntities['decode'](_0x54a1b2[_0xafda('0x4d')]),'headers':{'Date':moment(_0x54a1b2[_0xafda('0x96')])['format'](_0xafda('0x98'))},'attachments':[]};if(_0x3fd293['cc']){_0x478e60[_0xafda('0x99')]['Cc']=_0x3fd293['cc'];}if(_0x3fd293[_0xafda('0x9a')]){_0x478e60[_0xafda('0x99')][_0xafda('0x9b')]=_0x3fd293[_0xafda('0x9a')];}return new BPromise(function(_0x4f016e,_0xec0694){if(_0x3fd293[_0xafda('0x97')]){for(var _0x205429=0x0;_0x205429<_0x3fd293[_0xafda('0x97')]['length'];_0x205429++){var _0x55f573=_0x3fd293[_0xafda('0x97')][_0x205429];var _0xd66a2f=path[_0xafda('0x5e')](_0x5d7d0e,_0x55f573[_0xafda('0x60')]);if(fs[_0xafda('0x9c')](_0xd66a2f)){_0x478e60[_0xafda('0x5d')][_0xafda('0x9d')]({'name':_0x55f573[_0xafda('0x2b')],'contentType':_0x55f573['type'],'data':fs[_0xafda('0x9e')](_0xd66a2f)});}}}emlformat[_0xafda('0x9f')](_0x478e60,function(_0x47f16e,_0x5c391a){if(_0x47f16e)return _0xec0694(_0x47f16e);fs[_0xafda('0xa0')](path[_0xafda('0x5e')](_0x42e68e,_0x4701d0),_0x5c391a);return _0x4f016e(_0x5c391a);});});}})[_0xafda('0x17')](function(_0x236a0d){if(_0x236a0d){return _0x2a3a97[_0xafda('0x8e')](path['join'](_0x42e68e,_0x4701d0),_0x4701d0,function(_0x5686a1){if(!_0x5686a1)fs[_0xafda('0xa1')](path[_0xafda('0x5e')](_0x42e68e,_0x4701d0));});}})[_0xafda('0x47')](handleError(_0x2a3a97,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 6ba134a..f9eae2b 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 _0x3068=['save','update','remove','emit','hasOwnProperty','hook','exports','events','MailMessage','setMaxListeners'];(function(_0x1d9ee1,_0x293312){var _0x29ab8b=function(_0x4ec561){while(--_0x4ec561){_0x1d9ee1['push'](_0x1d9ee1['shift']());}};_0x29ab8b(++_0x293312);}(_0x3068,0x93));var _0x8306=function(_0x4b1051,_0xb9d64d){_0x4b1051=_0x4b1051-0x0;var _0x4521e6=_0x3068[_0x4b1051];return _0x4521e6;};'use strict';var EventEmitter=require(_0x8306('0x0'));var MailMessage=require('../../mysqldb')['db'][_0x8306('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x8306('0x2')](0x0);var events={'afterCreate':_0x8306('0x3'),'afterUpdate':_0x8306('0x4'),'afterDestroy':_0x8306('0x5')};function emitEvent(_0x3c9de5){return function(_0x2e8d2a,_0x4788f5,_0x4f368c){MailMessageEvents[_0x8306('0x6')](_0x3c9de5+':'+_0x2e8d2a['id'],_0x2e8d2a);MailMessageEvents[_0x8306('0x6')](_0x3c9de5,_0x2e8d2a);_0x4f368c(null);};}for(var e in events){if(events[_0x8306('0x7')](e)){var event=events[e];MailMessage[_0x8306('0x8')](e,emitEvent(event));}}module[_0x8306('0x9')]=MailMessageEvents; \ No newline at end of file +var _0xaef0=['update','remove','hasOwnProperty','../../mysqldb','MailMessage','setMaxListeners','save'];(function(_0x46c677,_0x350c0a){var _0x20bd84=function(_0x4cb52e){while(--_0x4cb52e){_0x46c677['push'](_0x46c677['shift']());}};_0x20bd84(++_0x350c0a);}(_0xaef0,0x15a));var _0x0aef=function(_0x592d48,_0x23f1ba){_0x592d48=_0x592d48-0x0;var _0x5d789e=_0xaef0[_0x592d48];return _0x5d789e;};'use strict';var EventEmitter=require('events');var MailMessage=require(_0x0aef('0x0'))['db'][_0x0aef('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x0aef('0x2')](0x0);var events={'afterCreate':_0x0aef('0x3'),'afterUpdate':_0x0aef('0x4'),'afterDestroy':_0x0aef('0x5')};function emitEvent(_0x1b169c){return function(_0x39e00f,_0x246535,_0x52fd54){MailMessageEvents['emit'](_0x1b169c+':'+_0x39e00f['id'],_0x39e00f);MailMessageEvents['emit'](_0x1b169c,_0x39e00f);_0x52fd54(null);};}for(var e in events){if(events[_0x0aef('0x6')](e)){var event=events[e];MailMessage['hook'](e,emitEvent(event));}}module['exports']=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index bb2ba39..e33c3df 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 _0xf263=['UserId','MailInteraction','findOne','MailInteractionId','then','update','createdAt','error','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./mailMessage.attributes','exports','define','MailMessage','mail_messages','messageId','plainBody','subject','body','fromString','models','get','direction','toLowerCase','out','secret','isNil'];(function(_0x95abe2,_0x2d4fea){var _0x2fc8c4=function(_0x5234b8){while(--_0x5234b8){_0x95abe2['push'](_0x95abe2['shift']());}};_0x2fc8c4(++_0x2d4fea);}(_0xf263,0x92));var _0x3f26=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xf263[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3f26('0x0'))(_0x3f26('0x1'));var moment=require(_0x3f26('0x2'));var BPromise=require(_0x3f26('0x3'));var rp=require(_0x3f26('0x4'));var htmlToText=require('html-to-text');var fs=require('fs');var path=require(_0x3f26('0x5'));var rimraf=require(_0x3f26('0x6'));var config=require('../../config/environment');var attributes=require(_0x3f26('0x7'));module[_0x3f26('0x8')]=function(_0x417ff2,_0x4f02f1){return _0x417ff2[_0x3f26('0x9')](_0x3f26('0xa'),attributes,{'tableName':_0x3f26('0xb'),'paranoid':![],'indexes':[{'name':_0x3f26('0xc'),'fields':['messageId']},{'name':'fti_mail_messages','fields':[_0x3f26('0xd'),_0x3f26('0xe')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x59aac6,_0x531640,_0x387f01){if(_0x59aac6[_0x3f26('0xf')]){_0x59aac6['plainBody']=htmlToText[_0x3f26('0x10')](_0x59aac6[_0x3f26('0xf')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x387f01(null,_0x531640);},'afterCreate':function(_0x503ba2,_0x2dd436,_0x40476e){var _0x52a72f=_0x417ff2[_0x3f26('0x11')];var _0x3438ee=_0x503ba2[_0x3f26('0x12')]({'plain':!![]});if(_0x3438ee[_0x3f26('0x13')][_0x3f26('0x14')]()==='in'||_0x3438ee['direction'][_0x3f26('0x14')]()===_0x3f26('0x15')&&!_0x3438ee[_0x3f26('0x16')]&&!_[_0x3f26('0x17')](_0x3438ee[_0x3f26('0x18')])){_0x52a72f[_0x3f26('0x19')][_0x3f26('0x1a')]({'where':{'id':_0x3438ee[_0x3f26('0x1b')]}})[_0x3f26('0x1c')](function(_0x1a83fb){if(_0x1a83fb){_0x1a83fb[_0x3f26('0x1d')]({'lastMsgAt':_0x3438ee[_0x3f26('0x1e')],'lastMsgDirection':_0x3438ee[_0x3f26('0x13')][_0x3f26('0x14')]()});}})['catch'](function(_0x51a282){console[_0x3f26('0x1f')](_0x51a282);});}_0x40476e();}},'charset':_0x3f26('0x20'),'collate':_0x3f26('0x21')});}; \ No newline at end of file +var _0xefe5=['out','secret','UserId','MailInteraction','findOne','MailInteractionId','createdAt','toLowerCase','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','html-to-text','path','../../config/environment','./mailMessage.attributes','exports','MailMessage','mail_messages','messageId','fti_mail_messages','plainBody','subject','body','models','get','direction'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xefe5,0x156));var _0x5efe=function(_0x6306d2,_0x4ae91b){_0x6306d2=_0x6306d2-0x0;var _0x4d13aa=_0xefe5[_0x6306d2];return _0x4d13aa;};'use strict';var _=require(_0x5efe('0x0'));var util=require(_0x5efe('0x1'));var logger=require(_0x5efe('0x2'))(_0x5efe('0x3'));var moment=require('moment');var BPromise=require(_0x5efe('0x4'));var rp=require(_0x5efe('0x5'));var htmlToText=require(_0x5efe('0x6'));var fs=require('fs');var path=require(_0x5efe('0x7'));var rimraf=require('rimraf');var config=require(_0x5efe('0x8'));var attributes=require(_0x5efe('0x9'));module[_0x5efe('0xa')]=function(_0x52ca2c,_0x310e69){return _0x52ca2c['define'](_0x5efe('0xb'),attributes,{'tableName':_0x5efe('0xc'),'paranoid':![],'indexes':[{'name':_0x5efe('0xd'),'fields':['messageId']},{'name':_0x5efe('0xe'),'fields':[_0x5efe('0xf'),_0x5efe('0x10')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x241ff6,_0x35ce70,_0x518246){if(_0x241ff6['body']){_0x241ff6[_0x5efe('0xf')]=htmlToText['fromString'](_0x241ff6[_0x5efe('0x11')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x518246(null,_0x35ce70);},'afterCreate':function(_0x5f3f6b,_0xcd64c8,_0x4b8124){var _0x48fea3=_0x52ca2c[_0x5efe('0x12')];var _0x42490d=_0x5f3f6b[_0x5efe('0x13')]({'plain':!![]});if(_0x42490d[_0x5efe('0x14')]['toLowerCase']()==='in'||_0x42490d['direction']['toLowerCase']()===_0x5efe('0x15')&&!_0x42490d[_0x5efe('0x16')]&&!_['isNil'](_0x42490d[_0x5efe('0x17')])){_0x48fea3[_0x5efe('0x18')][_0x5efe('0x19')]({'where':{'id':_0x42490d[_0x5efe('0x1a')]}})['then'](function(_0x1fd44d){if(_0x1fd44d){_0x1fd44d['update']({'lastMsgAt':_0x42490d[_0x5efe('0x1b')],'lastMsgDirection':_0x42490d['direction'][_0x5efe('0x1c')]()});}})[_0x5efe('0x1d')](function(_0x43826d){console[_0x5efe('0x1e')](_0x43826d);});}_0x4b8124();}},'charset':_0x5efe('0x1f'),'collate':_0x5efe('0x20')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 00c8f59..64189f0 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 _0x955f=['../../mysqldb','rpc','jayson/promise','client','http','defaults','redis','socket.io-emitter','./mailMessage.socket','register','then','info','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','MailMessage,\x20%s,\x20%s','message','result','catch','CreateMailMessage','MailMessage','create','options','raw','lodash','util','moment','bluebird','randomstring'];(function(_0x258313,_0x2f0677){var _0x170572=function(_0xf7ea7){while(--_0xf7ea7){_0x258313['push'](_0x258313['shift']());}};_0x170572(++_0x2f0677);}(_0x955f,0x1eb));var _0xf955=function(_0xe32c98,_0x32717d){_0xe32c98=_0xe32c98-0x0;var _0x456581=_0x955f[_0xe32c98];return _0x456581;};'use strict';var _=require(_0xf955('0x0'));var util=require(_0xf955('0x1'));var moment=require(_0xf955('0x2'));var BPromise=require(_0xf955('0x3'));var rs=require(_0xf955('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf955('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf955('0x6'));var config=require('../../config/environment');var jayson=require(_0xf955('0x7'));var client=jayson[_0xf955('0x8')][_0xf955('0x9')]({'port':0x232a});config['redis']=_[_0xf955('0xa')](config[_0xf955('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xf955('0xc'))(new Redis(config[_0xf955('0xb')]));require(_0xf955('0xd'))[_0xf955('0xe')](socket);function respondWithRpcPromise(_0x134c1b,_0x421e4a,_0x186719){return new BPromise(function(_0x4d213a,_0xf7e3e){return client['request'](_0x134c1b,_0x186719)[_0xf955('0xf')](function(_0x5d6211){logger[_0xf955('0x10')]('MailMessage,\x20%s,\x20%s',_0x421e4a,_0xf955('0x11'));logger['debug'](_0xf955('0x12'),_0x421e4a,'request\x20sent',JSON[_0xf955('0x13')](_0x5d6211));if(_0x5d6211[_0xf955('0x14')]){if(_0x5d6211[_0xf955('0x14')][_0xf955('0x15')]===0x1f4){logger[_0xf955('0x14')](_0xf955('0x16'),_0x421e4a,_0x5d6211[_0xf955('0x14')][_0xf955('0x17')]);return _0xf7e3e(_0x5d6211[_0xf955('0x14')][_0xf955('0x17')]);}logger['error'](_0xf955('0x16'),_0x421e4a,_0x5d6211['error'][_0xf955('0x17')]);return _0x4d213a(_0x5d6211[_0xf955('0x14')][_0xf955('0x17')]);}else{logger[_0xf955('0x10')]('MailMessage,\x20%s,\x20%s',_0x421e4a,'request\x20sent');_0x4d213a(_0x5d6211[_0xf955('0x18')][_0xf955('0x17')]);}})[_0xf955('0x19')](function(_0x4d7b5b){logger[_0xf955('0x14')](_0xf955('0x16'),_0x421e4a,_0x4d7b5b);_0xf7e3e(_0x4d7b5b);});});}exports[_0xf955('0x1a')]=function(_0x3f960e){var _0x3ae4fb=this;return new Promise(function(_0x5f4d9a,_0x17d86a){return db[_0xf955('0x1b')][_0xf955('0x1c')](_0x3f960e['body'],{'raw':_0x3f960e[_0xf955('0x1d')]?_0x3f960e['options'][_0xf955('0x1e')]===undefined?!![]:![]:!![]})[_0xf955('0xf')](function(_0x37143d){logger[_0xf955('0x10')](_0xf955('0x1a'),_0x3f960e);logger['debug'](_0xf955('0x1a'),_0x3f960e,JSON[_0xf955('0x13')](_0x37143d));_0x5f4d9a(_0x37143d);})[_0xf955('0x19')](function(_0x13a1a7){logger[_0xf955('0x14')](_0xf955('0x1a'),_0x13a1a7[_0xf955('0x17')],_0x3f960e);_0x17d86a(_0x3ae4fb['error'](0x1f4,_0x13a1a7[_0xf955('0x17')]));});});}; \ No newline at end of file +var _0x6cb4=['result','catch','CreateMailMessage','MailMessage','create','body','options','raw','info','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','register','request','then','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','error','code','MailMessage,\x20%s,\x20%s','message'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6cb4,0xff));var _0x46cb=function(_0x56f147,_0x1fd168){_0x56f147=_0x56f147-0x0;var _0x22beb5=_0x6cb4[_0x56f147];return _0x22beb5;};'use strict';var _=require(_0x46cb('0x0'));var util=require(_0x46cb('0x1'));var moment=require(_0x46cb('0x2'));var BPromise=require(_0x46cb('0x3'));var rs=require(_0x46cb('0x4'));var fs=require('fs');var Redis=require(_0x46cb('0x5'));var db=require(_0x46cb('0x6'))['db'];var utils=require(_0x46cb('0x7'));var logger=require(_0x46cb('0x8'))('rpc');var config=require(_0x46cb('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x46cb('0xa')]['http']({'port':0x232a});config[_0x46cb('0xb')]=_[_0x46cb('0xc')](config[_0x46cb('0xb')],{'host':_0x46cb('0xd'),'port':0x18eb});var socket=require(_0x46cb('0xe'))(new Redis(config[_0x46cb('0xb')]));require('./mailMessage.socket')[_0x46cb('0xf')](socket);function respondWithRpcPromise(_0x34f9e9,_0x48101c,_0x206f10){return new BPromise(function(_0x106a87,_0x4a60b2){return client[_0x46cb('0x10')](_0x34f9e9,_0x206f10)[_0x46cb('0x11')](function(_0x570cfd){logger['info']('MailMessage,\x20%s,\x20%s',_0x48101c,_0x46cb('0x12'));logger[_0x46cb('0x13')](_0x46cb('0x14'),_0x48101c,_0x46cb('0x12'),JSON['stringify'](_0x570cfd));if(_0x570cfd[_0x46cb('0x15')]){if(_0x570cfd[_0x46cb('0x15')][_0x46cb('0x16')]===0x1f4){logger[_0x46cb('0x15')](_0x46cb('0x17'),_0x48101c,_0x570cfd[_0x46cb('0x15')][_0x46cb('0x18')]);return _0x4a60b2(_0x570cfd[_0x46cb('0x15')][_0x46cb('0x18')]);}logger[_0x46cb('0x15')](_0x46cb('0x17'),_0x48101c,_0x570cfd['error'][_0x46cb('0x18')]);return _0x106a87(_0x570cfd['error'][_0x46cb('0x18')]);}else{logger['info']('MailMessage,\x20%s,\x20%s',_0x48101c,'request\x20sent');_0x106a87(_0x570cfd[_0x46cb('0x19')][_0x46cb('0x18')]);}})[_0x46cb('0x1a')](function(_0xcc8e2){logger[_0x46cb('0x15')](_0x46cb('0x17'),_0x48101c,_0xcc8e2);_0x4a60b2(_0xcc8e2);});});}exports[_0x46cb('0x1b')]=function(_0x32e9fe){var _0x90cd50=this;return new Promise(function(_0xfc9064,_0x149483){return db[_0x46cb('0x1c')][_0x46cb('0x1d')](_0x32e9fe[_0x46cb('0x1e')],{'raw':_0x32e9fe[_0x46cb('0x1f')]?_0x32e9fe[_0x46cb('0x1f')][_0x46cb('0x20')]===undefined?!![]:![]:!![]})[_0x46cb('0x11')](function(_0x41ecd2){logger[_0x46cb('0x21')](_0x46cb('0x1b'),_0x32e9fe);logger[_0x46cb('0x13')](_0x46cb('0x1b'),_0x32e9fe,JSON[_0x46cb('0x22')](_0x41ecd2));_0xfc9064(_0x41ecd2);})[_0x46cb('0x1a')](function(_0x5a1338){logger['error'](_0x46cb('0x1b'),_0x5a1338[_0x46cb('0x18')],_0x32e9fe);_0x149483(_0x90cd50[_0x46cb('0x15')](0x1f4,_0x5a1338[_0x46cb('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 8a1cdd2..d76d2aa 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 _0x408a=['mailMessage:','save','remove','emit','removeListener','register'];(function(_0x299af8,_0x433f59){var _0x262341=function(_0x419180){while(--_0x419180){_0x299af8['push'](_0x299af8['shift']());}};_0x262341(++_0x433f59);}(_0x408a,0x67));var _0xa408=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x408a[_0x2b4411];return _0x8e41ef;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=[_0xa408('0x0'),_0xa408('0x1'),'update'];function createListener(_0x81353e,_0x482419){return function(_0x381fc8){_0x482419[_0xa408('0x2')](_0x81353e,_0x381fc8);};}function removeListener(_0x3ed995,_0x4ab052){return function(){MailMessageEvents[_0xa408('0x3')](_0x3ed995,_0x4ab052);};}exports[_0xa408('0x4')]=function(_0x2be7d6){for(var _0x3b5303=0x0,_0x107480=events['length'];_0x3b5303<_0x107480;_0x3b5303++){var _0x592b07=events[_0x3b5303];var _0xdb3829=createListener(_0xa408('0x5')+_0x592b07,_0x2be7d6);MailMessageEvents['on'](_0x592b07,_0xdb3829);}}; \ No newline at end of file +var _0xd3d2=['length','./mailMessage.events','save','update','emit','removeListener','register'];(function(_0x156838,_0x39a171){var _0x5651b2=function(_0x30d8db){while(--_0x30d8db){_0x156838['push'](_0x156838['shift']());}};_0x5651b2(++_0x39a171);}(_0xd3d2,0x120));var _0x2d3d=function(_0x17f0c1,_0x593217){_0x17f0c1=_0x17f0c1-0x0;var _0x3615d5=_0xd3d2[_0x17f0c1];return _0x3615d5;};'use strict';var MailMessageEvents=require(_0x2d3d('0x0'));var events=[_0x2d3d('0x1'),'remove',_0x2d3d('0x2')];function createListener(_0x52d85e,_0x213430){return function(_0x4329a6){_0x213430[_0x2d3d('0x3')](_0x52d85e,_0x4329a6);};}function removeListener(_0x58cf52,_0x20a7a7){return function(){MailMessageEvents[_0x2d3d('0x4')](_0x58cf52,_0x20a7a7);};}exports[_0x2d3d('0x5')]=function(_0xe4a43){for(var _0x4081af=0x0,_0x49410b=events[_0x2d3d('0x6')];_0x4081af<_0x49410b;_0x4081af++){var _0x5c1115=events[_0x4081af];var _0x19be37=createListener('mailMessage:'+_0x5c1115,_0xe4a43);MailMessageEvents['on'](_0x5c1115,_0x19be37);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 710a043..c8e13da 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 _0x16fd=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','isAuthenticated','index','get','describe','/:id','show','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','put','update','destroy','delete','removeTeams','removeAgents','exports','util'];(function(_0xb31440,_0x3575cf){var _0x316def=function(_0x30a2aa){while(--_0x30a2aa){_0xb31440['push'](_0xb31440['shift']());}};_0x316def(++_0x3575cf);}(_0x16fd,0x9a));var _0xd16f=function(_0x38782c,_0x5c9fef){_0x38782c=_0x38782c-0x0;var _0x3708bf=_0x16fd[_0x38782c];return _0x3708bf;};'use strict';var multer=require('multer');var util=require(_0xd16f('0x0'));var path=require(_0xd16f('0x1'));var timeout=require(_0xd16f('0x2'));var express=require(_0xd16f('0x3'));var router=express[_0xd16f('0x4')]();var fs_extra=require(_0xd16f('0x5'));var auth=require(_0xd16f('0x6'));var interaction=require(_0xd16f('0x7'));var config=require(_0xd16f('0x8'));var controller=require(_0xd16f('0x9'));router['get']('/',auth[_0xd16f('0xa')](),controller[_0xd16f('0xb')]);router[_0xd16f('0xc')]('/describe',auth['isAuthenticated'](),controller[_0xd16f('0xd')]);router[_0xd16f('0xc')](_0xd16f('0xe'),auth['isAuthenticated'](),controller[_0xd16f('0xf')]);router[_0xd16f('0xc')]('/:id/members',auth['isAuthenticated'](),controller[_0xd16f('0x10')]);router[_0xd16f('0xc')](_0xd16f('0x11'),auth[_0xd16f('0xa')](),controller[_0xd16f('0x12')]);router['get'](_0xd16f('0x13'),auth[_0xd16f('0xa')](),controller[_0xd16f('0x14')]);router['post']('/',auth[_0xd16f('0xa')](),controller['create']);router[_0xd16f('0x15')](_0xd16f('0x11'),auth['isAuthenticated'](),controller[_0xd16f('0x16')]);router[_0xd16f('0x15')](_0xd16f('0x13'),auth['isAuthenticated'](),controller[_0xd16f('0x17')]);router[_0xd16f('0x18')]('/:id',auth['isAuthenticated'](),controller[_0xd16f('0x19')]);router['delete'](_0xd16f('0xe'),auth[_0xd16f('0xa')](),controller[_0xd16f('0x1a')]);router[_0xd16f('0x1b')](_0xd16f('0x11'),auth[_0xd16f('0xa')](),controller[_0xd16f('0x1c')]);router['delete'](_0xd16f('0x13'),auth[_0xd16f('0xa')](),controller[_0xd16f('0x1d')]);module[_0xd16f('0x1e')]=router; \ No newline at end of file +var _0x856e=['getTeams','/:id/users','getAgents','post','addTeams','addAgents','put','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./mailQueue.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams'];(function(_0x21aec3,_0x5c97e9){var _0x288bbc=function(_0x2283fe){while(--_0x2283fe){_0x21aec3['push'](_0x21aec3['shift']());}};_0x288bbc(++_0x5c97e9);}(_0x856e,0x142));var _0xe856=function(_0x5d6e35,_0x4d1ac0){_0x5d6e35=_0x5d6e35-0x0;var _0x5d7ada=_0x856e[_0x5d6e35];return _0x5d7ada;};'use strict';var multer=require(_0xe856('0x0'));var util=require(_0xe856('0x1'));var path=require(_0xe856('0x2'));var timeout=require(_0xe856('0x3'));var express=require(_0xe856('0x4'));var router=express['Router']();var fs_extra=require(_0xe856('0x5'));var auth=require(_0xe856('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xe856('0x7'));var controller=require(_0xe856('0x8'));router['get']('/',auth[_0xe856('0x9')](),controller[_0xe856('0xa')]);router[_0xe856('0xb')](_0xe856('0xc'),auth[_0xe856('0x9')](),controller[_0xe856('0xd')]);router[_0xe856('0xb')](_0xe856('0xe'),auth['isAuthenticated'](),controller[_0xe856('0xf')]);router['get'](_0xe856('0x10'),auth['isAuthenticated'](),controller[_0xe856('0x11')]);router[_0xe856('0xb')](_0xe856('0x12'),auth[_0xe856('0x9')](),controller[_0xe856('0x13')]);router[_0xe856('0xb')](_0xe856('0x14'),auth[_0xe856('0x9')](),controller[_0xe856('0x15')]);router[_0xe856('0x16')]('/',auth[_0xe856('0x9')](),controller['create']);router[_0xe856('0x16')](_0xe856('0x12'),auth[_0xe856('0x9')](),controller[_0xe856('0x17')]);router[_0xe856('0x16')](_0xe856('0x14'),auth[_0xe856('0x9')](),controller[_0xe856('0x18')]);router[_0xe856('0x19')](_0xe856('0xe'),auth[_0xe856('0x9')](),controller['update']);router[_0xe856('0x1a')](_0xe856('0xe'),auth['isAuthenticated'](),controller[_0xe856('0x1b')]);router[_0xe856('0x1a')](_0xe856('0x12'),auth[_0xe856('0x9')](),controller[_0xe856('0x1c')]);router[_0xe856('0x1a')](_0xe856('0x14'),auth[_0xe856('0x9')](),controller[_0xe856('0x1d')]);module[_0xe856('0x1e')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 9c8a940..30b89de 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 _0x3860=['exports','STRING','name','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize'];(function(_0x3f68dc,_0x3ae2f8){var _0x8c9e6f=function(_0x32b1cd){while(--_0x32b1cd){_0x3f68dc['push'](_0x3f68dc['shift']());}};_0x8c9e6f(++_0x3ae2f8);}(_0x3860,0x14c));var _0x0386=function(_0x2cc164,_0x5355dc){_0x2cc164=_0x2cc164-0x0;var _0x4663f0=_0x3860[_0x2cc164];return _0x4663f0;};'use strict';var Sequelize=require(_0x0386('0x0'));module[_0x0386('0x1')]={'name':{'type':Sequelize[_0x0386('0x2')],'unique':_0x0386('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x0386('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x0386('0x5')](_0x0386('0x6'),_0x0386('0x7'),_0x0386('0x8'))}}; \ No newline at end of file +var _0x0199=['sequelize','exports','name','INTEGER','ENUM','rrmemory','beepall','roundrobin'];(function(_0x32c9b9,_0x21a0cf){var _0x239eab=function(_0x25fceb){while(--_0x25fceb){_0x32c9b9['push'](_0x32c9b9['shift']());}};_0x239eab(++_0x21a0cf);}(_0x0199,0xa8));var _0x9019=function(_0xe1f130,_0x83fcef){_0xe1f130=_0xe1f130-0x0;var _0xbb1d66=_0x0199[_0xe1f130];return _0xbb1d66;};'use strict';var Sequelize=require(_0x9019('0x0'));module[_0x9019('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x9019('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x9019('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x9019('0x4')](_0x9019('0x5'),_0x9019('0x6'),_0x9019('0x7'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 960fb04..102bef7 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 _0xd3d1=['get','MailQueues','stack','name','index','map','MailQueue','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','catch','keys','rawAttributes','includeAll','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','body','params','describe','getMembers','findOne','nolimit','order','UserMailQueue','User','UserId','mailPause','updatedAt','createdAt','format','%s/%s','SIP','Team','getTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','addTeams','findOrCreate','emit','userMailQueue:save','removeTeams','join','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','ut.UserId\x20=\x20?','toString','QueryTypes','every','TeamId','all','union','value','isEmpty','removeAgents','forEach','addAgents','omit','spread','userMailQueue:remove','getAgents','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','./mailQueue.socket','register','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','save','then','destroy'];(function(_0x13b02f,_0x462a53){var _0x12e9a6=function(_0x187d57){while(--_0x187d57){_0x13b02f['push'](_0x13b02f['shift']());}};_0x12e9a6(++_0x462a53);}(_0xd3d1,0x172));var _0x1d3d=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0xd3d1[_0x4a53d];return _0x27410e;};'use strict';var emlformat=require(_0x1d3d('0x0'));var rimraf=require(_0x1d3d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x1d3d('0x2'));var moment=require(_0x1d3d('0x3'));var BPromise=require(_0x1d3d('0x4'));var Mustache=require(_0x1d3d('0x5'));var util=require(_0x1d3d('0x6'));var path=require(_0x1d3d('0x7'));var sox=require(_0x1d3d('0x8'));var csv=require(_0x1d3d('0x9'));var ejs=require(_0x1d3d('0xa'));var fs=require('fs');var fs_extra=require(_0x1d3d('0xb'));var _=require(_0x1d3d('0xc'));var squel=require(_0x1d3d('0xd'));var crypto=require(_0x1d3d('0xe'));var jsforce=require(_0x1d3d('0xf'));var deskjs=require(_0x1d3d('0x10'));var toCsv=require(_0x1d3d('0x9'));var querystring=require(_0x1d3d('0x11'));var Papa=require('papaparse');var Redis=require(_0x1d3d('0x12'));var authService=require(_0x1d3d('0x13'));var qs=require(_0x1d3d('0x14'));var as=require(_0x1d3d('0x15'));var hardwareService=require(_0x1d3d('0x16'));var logger=require(_0x1d3d('0x17'))(_0x1d3d('0x18'));var utils=require(_0x1d3d('0x19'));var config=require(_0x1d3d('0x1a'));var licenseUtil=require(_0x1d3d('0x1b'));var db=require(_0x1d3d('0x1c'))['db'];config['redis']=_[_0x1d3d('0x1d')](config[_0x1d3d('0x1e')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1d3d('0x1e')]));require(_0x1d3d('0x1f'))[_0x1d3d('0x20')](socket);function respondWithStatusCode(_0x59b907,_0x4098a9){_0x4098a9=_0x4098a9||0xcc;return function(_0x4dcc22){if(_0x4dcc22){return _0x59b907[_0x1d3d('0x21')](_0x4098a9);}return _0x59b907[_0x1d3d('0x22')](_0x4098a9)[_0x1d3d('0x23')]();};}function respondWithResult(_0x24bb8c,_0x21c2e4){_0x21c2e4=_0x21c2e4||0xc8;return function(_0x1bdbdc){if(_0x1bdbdc){return _0x24bb8c[_0x1d3d('0x22')](_0x21c2e4)['json'](_0x1bdbdc);}};}function respondWithFilteredResult(_0x5d3ac9,_0x316ab4){return function(_0xe0a583){if(_0xe0a583){var _0x50bab4=typeof _0x316ab4[_0x1d3d('0x24')]==='undefined'&&typeof _0x316ab4[_0x1d3d('0x25')]===_0x1d3d('0x26');var _0x2cd430=_0xe0a583[_0x1d3d('0x27')];var _0x5a6772=_0x50bab4?0x0:_0x316ab4[_0x1d3d('0x24')];var _0x56db7a=_0x50bab4?_0xe0a583['count']:_0x316ab4[_0x1d3d('0x24')]+_0x316ab4[_0x1d3d('0x25')];var _0x43b14b;if(_0x56db7a>=_0x2cd430){_0x56db7a=_0x2cd430;_0x43b14b=0xc8;}else{_0x43b14b=0xce;}_0x5d3ac9[_0x1d3d('0x22')](_0x43b14b);return _0x5d3ac9[_0x1d3d('0x28')](_0x1d3d('0x29'),_0x5a6772+'-'+_0x56db7a+'/'+_0x2cd430)[_0x1d3d('0x2a')](_0xe0a583);}return null;};}function patchUpdates(_0xa55c43){return function(_0x270b90){try{jsonpatch[_0x1d3d('0x2b')](_0x270b90,_0xa55c43,!![]);}catch(_0x1610a6){return BPromise['reject'](_0x1610a6);}return _0x270b90[_0x1d3d('0x2c')]();};}function saveUpdates(_0x72868d,_0x4a48c5){return function(_0x3639f1){if(_0x3639f1){return _0x3639f1['update'](_0x72868d)[_0x1d3d('0x2d')](function(_0x20ae6d){return _0x20ae6d;});}return null;};}function removeEntity(_0x2bd023,_0x4235fd){return function(_0x44e03e){if(_0x44e03e){return _0x44e03e[_0x1d3d('0x2e')]()[_0x1d3d('0x2d')](function(){var _0x298fd3=_0x44e03e[_0x1d3d('0x2f')]({'plain':!![]});var _0x2df7b7=_0x1d3d('0x30');return db['UserProfileResource'][_0x1d3d('0x2e')]({'where':{'type':_0x2df7b7,'resourceId':_0x298fd3['id']}})['then'](function(){return _0x44e03e;});})[_0x1d3d('0x2d')](function(){_0x2bd023[_0x1d3d('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x185913,_0x16b7b3){return function(_0x3cb011){if(!_0x3cb011){_0x185913[_0x1d3d('0x21')](0x194);}return _0x3cb011;};}function handleError(_0x4abbfc,_0x2d46c2){_0x2d46c2=_0x2d46c2||0x1f4;return function(_0x235ef3){logger['error'](_0x235ef3[_0x1d3d('0x31')]);if(_0x235ef3['name']){delete _0x235ef3[_0x1d3d('0x32')];}_0x4abbfc[_0x1d3d('0x22')](_0x2d46c2)['send'](_0x235ef3);};}exports[_0x1d3d('0x33')]=function(_0x192f60,_0x102b70){var _0x250b03={},_0x3a4c01={},_0x462628={'count':0x0,'rows':[]};var _0x4fc03a=_[_0x1d3d('0x34')](db[_0x1d3d('0x35')]['rawAttributes'],function(_0x2146c3){return{'name':_0x2146c3[_0x1d3d('0x36')],'type':_0x2146c3[_0x1d3d('0x37')][_0x1d3d('0x38')]};});_0x3a4c01['model']=_['map'](_0x4fc03a,_0x1d3d('0x32'));_0x3a4c01[_0x1d3d('0x39')]=_['keys'](_0x192f60[_0x1d3d('0x39')]);_0x3a4c01[_0x1d3d('0x3a')]=_[_0x1d3d('0x3b')](_0x3a4c01[_0x1d3d('0x3c')],_0x3a4c01['query']);_0x250b03['attributes']=_[_0x1d3d('0x3b')](_0x3a4c01['model'],qs[_0x1d3d('0x3d')](_0x192f60[_0x1d3d('0x39')][_0x1d3d('0x3d')]));_0x250b03[_0x1d3d('0x3e')]=_0x250b03[_0x1d3d('0x3e')][_0x1d3d('0x3f')]?_0x250b03[_0x1d3d('0x3e')]:_0x3a4c01[_0x1d3d('0x3c')];if(!_0x192f60['query'][_0x1d3d('0x40')]('nolimit')){_0x250b03[_0x1d3d('0x25')]=qs[_0x1d3d('0x25')](_0x192f60['query'][_0x1d3d('0x25')]);_0x250b03[_0x1d3d('0x24')]=qs[_0x1d3d('0x24')](_0x192f60[_0x1d3d('0x39')]['offset']);}_0x250b03['order']=qs[_0x1d3d('0x41')](_0x192f60['query'][_0x1d3d('0x41')]);_0x250b03[_0x1d3d('0x42')]=qs['filters'](_[_0x1d3d('0x43')](_0x192f60[_0x1d3d('0x39')],_0x3a4c01['filters']),_0x4fc03a);if(_0x192f60[_0x1d3d('0x39')][_0x1d3d('0x44')]){_0x250b03[_0x1d3d('0x42')]=_[_0x1d3d('0x45')](_0x250b03[_0x1d3d('0x42')],{'$or':_[_0x1d3d('0x34')](_0x4fc03a,function(_0x502507){if(_0x502507[_0x1d3d('0x37')]!==_0x1d3d('0x46')){var _0x1c9e17={};_0x1c9e17[_0x502507[_0x1d3d('0x32')]]={'$like':'%'+_0x192f60[_0x1d3d('0x39')]['filter']+'%'};return _0x1c9e17;}})});}_0x250b03=_[_0x1d3d('0x45')]({},_0x250b03,_0x192f60[_0x1d3d('0x47')]);var _0x1c0cc6={'where':_0x250b03[_0x1d3d('0x42')]};return db['MailQueue'][_0x1d3d('0x27')](_0x1c0cc6)[_0x1d3d('0x2d')](function(_0x1597fa){_0x462628[_0x1d3d('0x27')]=_0x1597fa;if(_0x192f60[_0x1d3d('0x39')]['includeAll']){_0x250b03['include']=[{'all':!![]}];}return db[_0x1d3d('0x35')][_0x1d3d('0x48')](_0x250b03);})[_0x1d3d('0x2d')](function(_0x66efd){_0x462628[_0x1d3d('0x49')]=_0x66efd;return _0x462628;})['then'](respondWithFilteredResult(_0x102b70,_0x250b03))[_0x1d3d('0x4a')](handleError(_0x102b70,null));};exports['show']=function(_0x26c6fd,_0x13bb96){var _0x84ebb4={'raw':!![],'where':{'id':_0x26c6fd['params']['id']}},_0x1f267b={};_0x1f267b[_0x1d3d('0x3c')]=_[_0x1d3d('0x4b')](db[_0x1d3d('0x35')][_0x1d3d('0x4c')]);_0x1f267b[_0x1d3d('0x39')]=_[_0x1d3d('0x4b')](_0x26c6fd[_0x1d3d('0x39')]);_0x1f267b['filters']=_[_0x1d3d('0x3b')](_0x1f267b['model'],_0x1f267b[_0x1d3d('0x39')]);_0x84ebb4[_0x1d3d('0x3e')]=_['intersection'](_0x1f267b[_0x1d3d('0x3c')],qs['fields'](_0x26c6fd[_0x1d3d('0x39')]['fields']));_0x84ebb4[_0x1d3d('0x3e')]=_0x84ebb4[_0x1d3d('0x3e')][_0x1d3d('0x3f')]?_0x84ebb4[_0x1d3d('0x3e')]:_0x1f267b[_0x1d3d('0x3c')];if(_0x26c6fd[_0x1d3d('0x39')][_0x1d3d('0x4d')]){_0x84ebb4[_0x1d3d('0x4e')]=[{'all':!![]}];}_0x84ebb4=_['merge']({},_0x84ebb4,_0x26c6fd['options']);return db['MailQueue'][_0x1d3d('0x4f')](_0x84ebb4)[_0x1d3d('0x2d')](handleEntityNotFound(_0x13bb96,null))[_0x1d3d('0x2d')](respondWithResult(_0x13bb96,null))[_0x1d3d('0x4a')](handleError(_0x13bb96,null));};exports[_0x1d3d('0x50')]=function(_0x3e5636,_0x47beed){return db['MailQueue']['create'](_0x3e5636['body'],{})[_0x1d3d('0x2d')](function(_0x21620d){var _0x89a16a=_0x3e5636[_0x1d3d('0x51')][_0x1d3d('0x2f')]({'plain':!![]});if(!_0x89a16a)throw new Error(_0x1d3d('0x52'));if(_0x89a16a[_0x1d3d('0x53')]===_0x1d3d('0x51')){var _0x3792ab=_0x21620d[_0x1d3d('0x2f')]({'plain':!![]});var _0xefc84c=_0x1d3d('0x30');return db[_0x1d3d('0x54')][_0x1d3d('0x4f')]({'where':{'name':_0xefc84c,'userProfileId':_0x89a16a[_0x1d3d('0x55')]},'raw':!![]})['then'](function(_0x465e97){if(_0x465e97&&_0x465e97[_0x1d3d('0x56')]===0x0){return db[_0x1d3d('0x57')][_0x1d3d('0x50')]({'name':_0x3792ab['name'],'resourceId':_0x3792ab['id'],'type':_0x465e97[_0x1d3d('0x32')],'sectionId':_0x465e97['id']},{})['then'](function(){return _0x21620d;});}else{return _0x21620d;}})['catch'](function(_0x27b3d9){logger[_0x1d3d('0x58')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x27b3d9);throw _0x27b3d9;});}return _0x21620d;})[_0x1d3d('0x2d')](respondWithResult(_0x47beed,0xc9))[_0x1d3d('0x4a')](handleError(_0x47beed,null));};exports['update']=function(_0x367290,_0x7af4dd){if(_0x367290[_0x1d3d('0x59')]['id']){delete _0x367290[_0x1d3d('0x59')]['id'];}return db[_0x1d3d('0x35')][_0x1d3d('0x4f')]({'where':{'id':_0x367290[_0x1d3d('0x5a')]['id']}})[_0x1d3d('0x2d')](handleEntityNotFound(_0x7af4dd,null))[_0x1d3d('0x2d')](saveUpdates(_0x367290['body'],null))[_0x1d3d('0x2d')](respondWithResult(_0x7af4dd,null))['catch'](handleError(_0x7af4dd,null));};exports['destroy']=function(_0x57c8ee,_0x5ed012){return db[_0x1d3d('0x35')][_0x1d3d('0x4f')]({'where':{'id':_0x57c8ee[_0x1d3d('0x5a')]['id']}})[_0x1d3d('0x2d')](handleEntityNotFound(_0x5ed012,null))['then'](removeEntity(_0x5ed012,null))[_0x1d3d('0x4a')](handleError(_0x5ed012,null));};exports['describe']=function(_0x44273d,_0xd3f336){return db['MailQueue'][_0x1d3d('0x5b')]()[_0x1d3d('0x2d')](respondWithResult(_0xd3f336,null))['catch'](handleError(_0xd3f336,null));};exports[_0x1d3d('0x5c')]=function(_0x4318ed,_0x295145,_0x1abb53){var _0x3bac7f={'raw':!![],'where':{}},_0x16e757={},_0x4e47d5;return db[_0x1d3d('0x35')][_0x1d3d('0x5d')]({'where':{'id':_0x4318ed[_0x1d3d('0x5a')]['id']}})[_0x1d3d('0x2d')](handleEntityNotFound(_0x295145,null))[_0x1d3d('0x2d')](function(_0x4b04a1){if(_0x4b04a1){_0x4e47d5=_0x4b04a1[_0x1d3d('0x2f')]({'plain':!![]});_0x16e757['model']=_[_0x1d3d('0x4b')](db['UserMailQueue'][_0x1d3d('0x4c')]);_0x16e757[_0x1d3d('0x39')]=_[_0x1d3d('0x4b')](_0x4318ed[_0x1d3d('0x39')]);_0x16e757[_0x1d3d('0x3a')]=_[_0x1d3d('0x3b')](_0x16e757[_0x1d3d('0x3c')],_0x16e757['query']);_0x3bac7f[_0x1d3d('0x3e')]=_[_0x1d3d('0x3b')](_0x16e757[_0x1d3d('0x3c')],qs[_0x1d3d('0x3d')](_0x4318ed[_0x1d3d('0x39')][_0x1d3d('0x3d')]));_0x3bac7f['attributes']=_0x3bac7f[_0x1d3d('0x3e')][_0x1d3d('0x3f')]?_0x3bac7f[_0x1d3d('0x3e')]:_0x16e757[_0x1d3d('0x3c')];if(!_0x4318ed[_0x1d3d('0x39')]['hasOwnProperty'](_0x1d3d('0x5e'))){_0x3bac7f[_0x1d3d('0x25')]=qs[_0x1d3d('0x25')](_0x4318ed['query'][_0x1d3d('0x25')]);_0x3bac7f['offset']=qs[_0x1d3d('0x24')](_0x4318ed['query'][_0x1d3d('0x24')]);}_0x3bac7f[_0x1d3d('0x5f')]=qs[_0x1d3d('0x41')](_0x4318ed['query'][_0x1d3d('0x41')]);_0x3bac7f[_0x1d3d('0x42')]=qs[_0x1d3d('0x3a')](_['pick'](_0x4318ed[_0x1d3d('0x39')],_0x16e757[_0x1d3d('0x3a')]));_0x3bac7f[_0x1d3d('0x42')]['MailQueueId']=_0x4b04a1['id'];if(_0x4318ed[_0x1d3d('0x39')][_0x1d3d('0x44')]){_0x3bac7f[_0x1d3d('0x42')]=_[_0x1d3d('0x45')](_0x3bac7f[_0x1d3d('0x42')],{'$or':_['map'](_0x3bac7f[_0x1d3d('0x3e')],function(_0xdf0d1f){var _0x25f4e0={};_0x25f4e0[_0xdf0d1f]={'$like':'%'+_0x4318ed['query'][_0x1d3d('0x44')]+'%'};return _0x25f4e0;})});}_0x3bac7f=_[_0x1d3d('0x45')]({},_0x3bac7f,_0x4318ed[_0x1d3d('0x47')]);return db[_0x1d3d('0x60')][_0x1d3d('0x48')](_0x3bac7f);}})['then'](function(_0x21f8ac){if(_0x21f8ac){return db[_0x1d3d('0x61')]['findAndCountAll']({'where':{'id':_[_0x1d3d('0x34')](_0x21f8ac,_0x1d3d('0x62')),'role':'agent'},'attributes':['id',_0x1d3d('0x32'),_0x1d3d('0x63'),_0x1d3d('0x64'),_0x1d3d('0x65')]});}})['then'](function(_0x3fc022){if(_0x3fc022){return{'count':_0x3fc022[_0x1d3d('0x27')],'rows':_[_0x1d3d('0x34')](_0x3fc022[_0x1d3d('0x49')],function(_0x5af94a){return{'membername':_0x5af94a['name'],'UserId':_0x5af94a['id'],'queue_name':_0x4e47d5[_0x1d3d('0x32')],'MailQueueId':_0x4e47d5['id'],'interface':util[_0x1d3d('0x66')](_0x1d3d('0x67'),_0x1d3d('0x68'),_0x5af94a[_0x1d3d('0x32')]),'penalty':0x0,'paused':_0x5af94a[_0x1d3d('0x63')],'createdAt':_0x5af94a[_0x1d3d('0x65')],'updatedAt':_0x5af94a['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x1d3d('0x2d')](respondWithFilteredResult(_0x295145,_0x3bac7f))[_0x1d3d('0x4a')](handleError(_0x295145,null));};exports['getTeams']=function(_0x164b5d,_0x310d27,_0x3ab561){var _0x5d951f={};var _0x4079ca={};var _0x328032;var _0x29033a;return db[_0x1d3d('0x35')]['findOne']({'where':{'id':_0x164b5d[_0x1d3d('0x5a')]['id']}})[_0x1d3d('0x2d')](handleEntityNotFound(_0x310d27,null))[_0x1d3d('0x2d')](function(_0x63489){if(_0x63489){_0x328032=_0x63489;_0x4079ca['model']=_[_0x1d3d('0x4b')](db[_0x1d3d('0x69')][_0x1d3d('0x4c')]);_0x4079ca['query']=_[_0x1d3d('0x4b')](_0x164b5d[_0x1d3d('0x39')]);_0x4079ca['filters']=_[_0x1d3d('0x3b')](_0x4079ca['model'],_0x4079ca[_0x1d3d('0x39')]);_0x5d951f[_0x1d3d('0x3e')]=_['intersection'](_0x4079ca['model'],qs[_0x1d3d('0x3d')](_0x164b5d[_0x1d3d('0x39')]['fields']));_0x5d951f[_0x1d3d('0x3e')]=_0x5d951f[_0x1d3d('0x3e')][_0x1d3d('0x3f')]?_0x5d951f[_0x1d3d('0x3e')]:_0x4079ca['model'];_0x5d951f[_0x1d3d('0x5f')]=qs[_0x1d3d('0x41')](_0x164b5d[_0x1d3d('0x39')]['sort']);_0x5d951f[_0x1d3d('0x42')]=qs[_0x1d3d('0x3a')](_[_0x1d3d('0x43')](_0x164b5d['query'],_0x4079ca[_0x1d3d('0x3a')]));if(_0x164b5d[_0x1d3d('0x39')][_0x1d3d('0x44')]){_0x5d951f[_0x1d3d('0x42')]=_[_0x1d3d('0x45')](_0x5d951f[_0x1d3d('0x42')],{'$or':_['map'](_0x5d951f[_0x1d3d('0x3e')],function(_0x2b5ff2){var _0x5cedcf={};_0x5cedcf[_0x2b5ff2]={'$like':'%'+_0x164b5d[_0x1d3d('0x39')][_0x1d3d('0x44')]+'%'};return _0x5cedcf;})});}_0x5d951f=_[_0x1d3d('0x45')]({},_0x5d951f,_0x164b5d['options']);return _0x328032[_0x1d3d('0x6a')](_0x5d951f);}})['then'](function(_0x49ab17){if(_0x49ab17){_0x29033a=_0x49ab17['length'];if(!_0x164b5d[_0x1d3d('0x39')]['hasOwnProperty'](_0x1d3d('0x5e'))){_0x5d951f[_0x1d3d('0x25')]=qs[_0x1d3d('0x25')](_0x164b5d[_0x1d3d('0x39')]['limit']);_0x5d951f['offset']=qs[_0x1d3d('0x24')](_0x164b5d[_0x1d3d('0x39')]['offset']);}return _0x328032[_0x1d3d('0x6a')](_0x5d951f);}})[_0x1d3d('0x2d')](function(_0x5be307){if(_0x5be307){return _0x5be307?{'count':_0x29033a,'rows':_0x5be307}:null;}})[_0x1d3d('0x2d')](respondWithResult(_0x310d27,null))[_0x1d3d('0x4a')](handleError(_0x310d27,null));};exports['addTeams']=function(_0x329748,_0x59054d,_0x3ac7e6){var _0x347fd8=_0x329748[_0x1d3d('0x59')][_0x1d3d('0x6b')];return db[_0x1d3d('0x69')]['findAll']({'where':{'id':_0x347fd8},'attributes':['id'],'include':[{'model':db[_0x1d3d('0x61')],'as':_0x1d3d('0x6c'),'attributes':['id',_0x1d3d('0x32'),_0x1d3d('0x6d'),_0x1d3d('0x6e'),_0x1d3d('0x6f')],'raw':!![]}]})[_0x1d3d('0x2d')](function(_0x9a3674){if(_0x9a3674){var _0x25fc35=_[_0x1d3d('0x70')](_0x9a3674,function(_0x24b3d8){var _0x123523=_0x24b3d8['get']({'plain':!![]});return _0x123523[_0x1d3d('0x6c')];});return db['MailQueue'][_0x1d3d('0x4f')]({'where':{'id':_0x329748[_0x1d3d('0x5a')]['id']}})[_0x1d3d('0x2d')](function(_0x1d5518){return db[_0x1d3d('0x71')][_0x1d3d('0x72')](function(_0x3e9c1e){return _0x1d5518[_0x1d3d('0x73')](_0x347fd8,{'transaction':_0x3e9c1e})[_0x1d3d('0x2d')](function(){return BPromise['each'](_0x25fc35,function(_0x55ec07){return db['UserMailQueue'][_0x1d3d('0x74')]({'where':{'UserId':_0x55ec07['id'],'MailQueueId':_0x329748['params']['id']},'transaction':_0x3e9c1e});});})[_0x1d3d('0x2d')](function(){_0x25fc35['forEach'](function(_0x270217){socket[_0x1d3d('0x75')](_0x1d3d('0x76'),{'UserId':_0x270217['id'],'MailQueueId':_0x1d5518['id']});});});});});}})[_0x1d3d('0x2d')](respondWithStatusCode(_0x59054d,null))['catch'](handleError(_0x59054d,null));};exports[_0x1d3d('0x77')]=function(_0x15d0b3,_0x20238b,_0x24f238){return db['Team'][_0x1d3d('0x48')]({'where':{'id':_0x15d0b3[_0x1d3d('0x39')]['ids']},'attributes':['id'],'include':[{'model':db[_0x1d3d('0x61')],'as':_0x1d3d('0x6c'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x20238b,null))['then'](function(_0x5e8bea){var _0x578704=_[_0x1d3d('0x34')](_0x5e8bea,'id');var _0x5cd9ad=[];var _0x26f19e=[];var _0x53bddd=squel['select']();_0x53bddd['field']('tq.TeamId')['from']('team_has_mail_queues','tq')[_0x1d3d('0x78')]('user_has_teams','ut',_0x1d3d('0x79'))[_0x1d3d('0x42')](_0x1d3d('0x7a'),_0x15d0b3[_0x1d3d('0x5a')]['id']);for(var _0x459c4d=0x0;_0x459c4d<_0x5e8bea['length'];_0x459c4d+=0x1){let _0x2dbef6=_0x5e8bea[_0x459c4d];for(var _0x11df10=0x0;_0x11df10<_0x2dbef6[_0x1d3d('0x6c')][_0x1d3d('0x3f')];_0x11df10+=0x1){let _0x1bb879=_0x2dbef6[_0x1d3d('0x6c')][_0x11df10];var _0x4cd9b1=_0x53bddd['clone']();_0x4cd9b1['where'](_0x1d3d('0x7b'),_0x1bb879['id']);_0x26f19e['push'](db['sequelize'][_0x1d3d('0x39')](_0x4cd9b1[_0x1d3d('0x7c')](),{'type':db[_0x1d3d('0x71')][_0x1d3d('0x7d')]['SELECT']})[_0x1d3d('0x2d')](function(_0x35e341){if(_0x35e341['length']===0x1){return _0x1bb879['id'];}else{var _0x5d9eb6=_[_0x1d3d('0x7e')](_['map'](_0x35e341,_0x1d3d('0x7f')),function(_0x34663a){return _['includes'](_0x578704,_0x34663a);});if(_0x5d9eb6){return _0x1bb879['id'];}}}));}}return BPromise[_0x1d3d('0x80')](_0x26f19e)[_0x1d3d('0x2d')](function(_0x46a315){_0x5cd9ad=_(_0x5cd9ad)[_0x1d3d('0x81')](_0x46a315)['compact']()[_0x1d3d('0x82')]();return db['MailQueue'][_0x1d3d('0x4f')]({'where':{'id':_0x15d0b3['params']['id']}})[_0x1d3d('0x2d')](function(_0xf35959){return db[_0x1d3d('0x71')]['transaction'](function(_0x514bdb){return _0xf35959[_0x1d3d('0x77')](_0x15d0b3[_0x1d3d('0x39')][_0x1d3d('0x6b')],{'transaction':_0x514bdb})[_0x1d3d('0x2d')](function(){if(!_[_0x1d3d('0x83')](_0x5cd9ad)){return _0xf35959[_0x1d3d('0x84')](_0x5cd9ad,{'transaction':_0x514bdb});}})['then'](function(){_0x5cd9ad[_0x1d3d('0x85')](function(_0x384c0a){socket[_0x1d3d('0x75')]('userMailQueue:remove',{'UserId':_0x384c0a,'MailQueueId':_0xf35959['id']});});});});});});})[_0x1d3d('0x2d')](respondWithStatusCode(_0x20238b,null))[_0x1d3d('0x4a')](handleError(_0x20238b,null));};exports[_0x1d3d('0x86')]=function(_0x8c6cea,_0x553f42,_0x4672d2){return db[_0x1d3d('0x35')][_0x1d3d('0x4f')]({'where':{'id':_0x8c6cea['params']['id']}})['then'](handleEntityNotFound(_0x553f42,null))[_0x1d3d('0x2d')](function(_0xfe16f8){if(_0xfe16f8){return _0xfe16f8[_0x1d3d('0x86')](_0x8c6cea[_0x1d3d('0x59')]['ids'],_[_0x1d3d('0x87')](_0x8c6cea[_0x1d3d('0x59')],[_0x1d3d('0x6b'),'id'])||{})[_0x1d3d('0x88')](function(_0x5c4e0a){for(var _0x3700a4=0x0;_0x3700a4<_0x8c6cea['body'][_0x1d3d('0x6b')][_0x1d3d('0x3f')];_0x3700a4+=0x1){socket[_0x1d3d('0x75')]('userMailQueue:save',{'UserId':Number(_0x8c6cea[_0x1d3d('0x59')][_0x1d3d('0x6b')][_0x3700a4]),'MailQueueId':Number(_0x8c6cea[_0x1d3d('0x5a')]['id'])});}return _0x5c4e0a;});}})['then'](respondWithResult(_0x553f42,null))[_0x1d3d('0x4a')](handleError(_0x553f42,null));};exports[_0x1d3d('0x84')]=function(_0x53404d,_0x1b6235,_0x2b4511){return db[_0x1d3d('0x35')][_0x1d3d('0x4f')]({'where':{'id':_0x53404d[_0x1d3d('0x5a')]['id']}})[_0x1d3d('0x2d')](handleEntityNotFound(_0x1b6235,null))['then'](function(_0x104d22){if(_0x104d22){return _0x104d22['removeAgents'](_0x53404d['query'][_0x1d3d('0x6b')])['then'](function(){if(_['isArray'](_0x53404d['query'][_0x1d3d('0x6b')])){for(var _0x16e24f=0x0;_0x16e24f<_0x53404d['query'][_0x1d3d('0x6b')][_0x1d3d('0x3f')];_0x16e24f+=0x1){socket[_0x1d3d('0x75')]('userMailQueue:remove',{'UserId':Number(_0x53404d[_0x1d3d('0x39')][_0x1d3d('0x6b')][_0x16e24f]),'MailQueueId':Number(_0x53404d[_0x1d3d('0x5a')]['id'])});}}else{socket[_0x1d3d('0x75')](_0x1d3d('0x89'),{'UserId':Number(_0x53404d[_0x1d3d('0x39')][_0x1d3d('0x6b')]),'MailQueueId':Number(_0x53404d['params']['id'])});}});}})[_0x1d3d('0x2d')](respondWithStatusCode(_0x1b6235,null))[_0x1d3d('0x4a')](handleError(_0x1b6235,null));};exports[_0x1d3d('0x8a')]=function(_0x43367e,_0x1fbe3e,_0x14138f){var _0x34573b={};var _0x18edd5={};var _0x42af23;var _0x4bb51b;return db[_0x1d3d('0x35')][_0x1d3d('0x5d')]({'where':{'id':_0x43367e[_0x1d3d('0x5a')]['id']}})[_0x1d3d('0x2d')](handleEntityNotFound(_0x1fbe3e,null))[_0x1d3d('0x2d')](function(_0x488ce5){if(_0x488ce5){_0x42af23=_0x488ce5;_0x18edd5['model']=_[_0x1d3d('0x4b')](db[_0x1d3d('0x61')][_0x1d3d('0x4c')]);_0x18edd5[_0x1d3d('0x39')]=_['keys'](_0x43367e[_0x1d3d('0x39')]);_0x18edd5[_0x1d3d('0x3a')]=_[_0x1d3d('0x3b')](_0x18edd5[_0x1d3d('0x3c')],_0x18edd5['query']);_0x34573b['attributes']=_[_0x1d3d('0x3b')](_0x18edd5[_0x1d3d('0x3c')],qs[_0x1d3d('0x3d')](_0x43367e[_0x1d3d('0x39')][_0x1d3d('0x3d')]));_0x34573b[_0x1d3d('0x3e')]=_0x34573b[_0x1d3d('0x3e')][_0x1d3d('0x3f')]?_0x34573b[_0x1d3d('0x3e')]:_0x18edd5[_0x1d3d('0x3c')];_0x34573b[_0x1d3d('0x5f')]=qs[_0x1d3d('0x41')](_0x43367e[_0x1d3d('0x39')]['sort']);_0x34573b[_0x1d3d('0x42')]=qs['filters'](_[_0x1d3d('0x43')](_0x43367e[_0x1d3d('0x39')],_0x18edd5[_0x1d3d('0x3a')]));if(_0x43367e[_0x1d3d('0x39')][_0x1d3d('0x44')]){_0x34573b['where']=_[_0x1d3d('0x45')](_0x34573b[_0x1d3d('0x42')],{'$or':_[_0x1d3d('0x34')](_0x34573b[_0x1d3d('0x3e')],function(_0x5ba897){var _0x23bb10={};_0x23bb10[_0x5ba897]={'$like':'%'+_0x43367e[_0x1d3d('0x39')][_0x1d3d('0x44')]+'%'};return _0x23bb10;})});}_0x34573b=_[_0x1d3d('0x45')]({},_0x34573b,_0x43367e[_0x1d3d('0x47')]);return _0x42af23[_0x1d3d('0x8a')](_0x34573b);}})[_0x1d3d('0x2d')](function(_0x31a234){if(_0x31a234){_0x4bb51b=_0x31a234[_0x1d3d('0x3f')];if(!_0x43367e[_0x1d3d('0x39')][_0x1d3d('0x40')](_0x1d3d('0x5e'))){_0x34573b['limit']=qs['limit'](_0x43367e[_0x1d3d('0x39')]['limit']);_0x34573b[_0x1d3d('0x24')]=qs[_0x1d3d('0x24')](_0x43367e[_0x1d3d('0x39')]['offset']);}return _0x42af23['getAgents'](_0x34573b);}})[_0x1d3d('0x2d')](function(_0x55c8da){if(_0x55c8da){return _0x55c8da?{'count':_0x4bb51b,'rows':_0x55c8da}:null;}})[_0x1d3d('0x2d')](respondWithResult(_0x1fbe3e,null))[_0x1d3d('0x4a')](handleError(_0x1fbe3e,null));}; \ No newline at end of file +var _0x9e6f=['socket.io-emitter','register','status','offset','undefined','count','limit','set','Content-Range','json','reject','save','update','then','get','MailQueues','end','sendStatus','error','stack','name','send','index','map','MailQueue','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','destroy','describe','UserMailQueue','hasOwnProperty','nolimit','order','MailQueueId','options','findAndCountAll','UserId','mailPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','findOne','addTeams','ids','voicePause','interface','flatMap','Agents','sequelize','transaction','each','findOrCreate','emit','Team','User','select','field','tq.TeamId','from','team_has_mail_queues','join','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','compact','value','removeTeams','isEmpty','removeAgents','forEach','userMailQueue:remove','addAgents','omit','userMailQueue:save','getAgents','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','redis','defaults'];(function(_0x827637,_0x24805f){var _0xa773b8=function(_0x5d0575){while(--_0x5d0575){_0x827637['push'](_0x827637['shift']());}};_0xa773b8(++_0x24805f);}(_0x9e6f,0x76));var _0xf9e6=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x9e6f[_0x422905];return _0x33dc6c;};'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'];config[_0xf9e6('0x19')]=_[_0xf9e6('0x1a')](config[_0xf9e6('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xf9e6('0x1b'))(new Redis(config[_0xf9e6('0x19')]));require('./mailQueue.socket')[_0xf9e6('0x1c')](socket);function respondWithStatusCode(_0xc375cf,_0x551068){_0x551068=_0x551068||0xcc;return function(_0x2f63a4){if(_0x2f63a4){return _0xc375cf['sendStatus'](_0x551068);}return _0xc375cf[_0xf9e6('0x1d')](_0x551068)['end']();};}function respondWithResult(_0x28721c,_0x331084){_0x331084=_0x331084||0xc8;return function(_0xcbcd41){if(_0xcbcd41){return _0x28721c[_0xf9e6('0x1d')](_0x331084)['json'](_0xcbcd41);}};}function respondWithFilteredResult(_0x3a683f,_0x1e1882){return function(_0x466631){if(_0x466631){var _0x199707=typeof _0x1e1882[_0xf9e6('0x1e')]===_0xf9e6('0x1f')&&typeof _0x1e1882['limit']===_0xf9e6('0x1f');var _0x53c89e=_0x466631[_0xf9e6('0x20')];var _0x218660=_0x199707?0x0:_0x1e1882['offset'];var _0x4d39c2=_0x199707?_0x466631[_0xf9e6('0x20')]:_0x1e1882[_0xf9e6('0x1e')]+_0x1e1882[_0xf9e6('0x21')];var _0x25b935;if(_0x4d39c2>=_0x53c89e){_0x4d39c2=_0x53c89e;_0x25b935=0xc8;}else{_0x25b935=0xce;}_0x3a683f[_0xf9e6('0x1d')](_0x25b935);return _0x3a683f[_0xf9e6('0x22')](_0xf9e6('0x23'),_0x218660+'-'+_0x4d39c2+'/'+_0x53c89e)[_0xf9e6('0x24')](_0x466631);}return null;};}function patchUpdates(_0xb37f5f){return function(_0x288157){try{jsonpatch['apply'](_0x288157,_0xb37f5f,!![]);}catch(_0x51ec80){return BPromise[_0xf9e6('0x25')](_0x51ec80);}return _0x288157[_0xf9e6('0x26')]();};}function saveUpdates(_0x1db708,_0xd3eb68){return function(_0x20010b){if(_0x20010b){return _0x20010b[_0xf9e6('0x27')](_0x1db708)['then'](function(_0x2d3186){return _0x2d3186;});}return null;};}function removeEntity(_0x2f02f8,_0x144575){return function(_0x4cc708){if(_0x4cc708){return _0x4cc708['destroy']()[_0xf9e6('0x28')](function(){var _0x3e43d5=_0x4cc708[_0xf9e6('0x29')]({'plain':!![]});var _0x2ea01a=_0xf9e6('0x2a');return db['UserProfileResource']['destroy']({'where':{'type':_0x2ea01a,'resourceId':_0x3e43d5['id']}})[_0xf9e6('0x28')](function(){return _0x4cc708;});})['then'](function(){_0x2f02f8['status'](0xcc)[_0xf9e6('0x2b')]();});}};}function handleEntityNotFound(_0xbf62bf,_0x2fd16e){return function(_0x1d247d){if(!_0x1d247d){_0xbf62bf[_0xf9e6('0x2c')](0x194);}return _0x1d247d;};}function handleError(_0x2da1be,_0x113cc7){_0x113cc7=_0x113cc7||0x1f4;return function(_0xf96f32){logger[_0xf9e6('0x2d')](_0xf96f32[_0xf9e6('0x2e')]);if(_0xf96f32['name']){delete _0xf96f32[_0xf9e6('0x2f')];}_0x2da1be[_0xf9e6('0x1d')](_0x113cc7)[_0xf9e6('0x30')](_0xf96f32);};}exports[_0xf9e6('0x31')]=function(_0x1bdf56,_0x5d05ff){var _0x310842={},_0x25c69c={},_0x54a5f3={'count':0x0,'rows':[]};var _0xabba9d=_[_0xf9e6('0x32')](db[_0xf9e6('0x33')][_0xf9e6('0x34')],function(_0x6aa0d4){return{'name':_0x6aa0d4[_0xf9e6('0x35')],'type':_0x6aa0d4[_0xf9e6('0x36')][_0xf9e6('0x37')]};});_0x25c69c[_0xf9e6('0x38')]=_['map'](_0xabba9d,_0xf9e6('0x2f'));_0x25c69c[_0xf9e6('0x39')]=_[_0xf9e6('0x3a')](_0x1bdf56[_0xf9e6('0x39')]);_0x25c69c['filters']=_[_0xf9e6('0x3b')](_0x25c69c[_0xf9e6('0x38')],_0x25c69c[_0xf9e6('0x39')]);_0x310842['attributes']=_[_0xf9e6('0x3b')](_0x25c69c['model'],qs[_0xf9e6('0x3c')](_0x1bdf56[_0xf9e6('0x39')]['fields']));_0x310842['attributes']=_0x310842[_0xf9e6('0x3d')][_0xf9e6('0x3e')]?_0x310842[_0xf9e6('0x3d')]:_0x25c69c[_0xf9e6('0x38')];if(!_0x1bdf56['query']['hasOwnProperty']('nolimit')){_0x310842[_0xf9e6('0x21')]=qs[_0xf9e6('0x21')](_0x1bdf56[_0xf9e6('0x39')][_0xf9e6('0x21')]);_0x310842[_0xf9e6('0x1e')]=qs[_0xf9e6('0x1e')](_0x1bdf56['query'][_0xf9e6('0x1e')]);}_0x310842['order']=qs[_0xf9e6('0x3f')](_0x1bdf56[_0xf9e6('0x39')][_0xf9e6('0x3f')]);_0x310842[_0xf9e6('0x40')]=qs[_0xf9e6('0x41')](_[_0xf9e6('0x42')](_0x1bdf56[_0xf9e6('0x39')],_0x25c69c['filters']),_0xabba9d);if(_0x1bdf56[_0xf9e6('0x39')][_0xf9e6('0x43')]){_0x310842[_0xf9e6('0x40')]=_[_0xf9e6('0x44')](_0x310842[_0xf9e6('0x40')],{'$or':_[_0xf9e6('0x32')](_0xabba9d,function(_0x121eec){if(_0x121eec[_0xf9e6('0x36')]!==_0xf9e6('0x45')){var _0x43b7c2={};_0x43b7c2[_0x121eec['name']]={'$like':'%'+_0x1bdf56[_0xf9e6('0x39')][_0xf9e6('0x43')]+'%'};return _0x43b7c2;}})});}_0x310842=_[_0xf9e6('0x44')]({},_0x310842,_0x1bdf56['options']);var _0xc9b06e={'where':_0x310842[_0xf9e6('0x40')]};return db[_0xf9e6('0x33')]['count'](_0xc9b06e)['then'](function(_0x3ee6ca){_0x54a5f3[_0xf9e6('0x20')]=_0x3ee6ca;if(_0x1bdf56['query'][_0xf9e6('0x46')]){_0x310842[_0xf9e6('0x47')]=[{'all':!![]}];}return db[_0xf9e6('0x33')][_0xf9e6('0x48')](_0x310842);})['then'](function(_0x4207ff){_0x54a5f3[_0xf9e6('0x49')]=_0x4207ff;return _0x54a5f3;})['then'](respondWithFilteredResult(_0x5d05ff,_0x310842))[_0xf9e6('0x4a')](handleError(_0x5d05ff,null));};exports[_0xf9e6('0x4b')]=function(_0x2e2d38,_0x58935b){var _0x3c3d9d={'raw':!![],'where':{'id':_0x2e2d38[_0xf9e6('0x4c')]['id']}},_0x46a53e={};_0x46a53e['model']=_['keys'](db[_0xf9e6('0x33')][_0xf9e6('0x34')]);_0x46a53e[_0xf9e6('0x39')]=_[_0xf9e6('0x3a')](_0x2e2d38[_0xf9e6('0x39')]);_0x46a53e[_0xf9e6('0x41')]=_[_0xf9e6('0x3b')](_0x46a53e[_0xf9e6('0x38')],_0x46a53e[_0xf9e6('0x39')]);_0x3c3d9d['attributes']=_[_0xf9e6('0x3b')](_0x46a53e['model'],qs[_0xf9e6('0x3c')](_0x2e2d38['query']['fields']));_0x3c3d9d[_0xf9e6('0x3d')]=_0x3c3d9d[_0xf9e6('0x3d')]['length']?_0x3c3d9d['attributes']:_0x46a53e['model'];if(_0x2e2d38[_0xf9e6('0x39')][_0xf9e6('0x46')]){_0x3c3d9d['include']=[{'all':!![]}];}_0x3c3d9d=_[_0xf9e6('0x44')]({},_0x3c3d9d,_0x2e2d38['options']);return db[_0xf9e6('0x33')][_0xf9e6('0x4d')](_0x3c3d9d)[_0xf9e6('0x28')](handleEntityNotFound(_0x58935b,null))[_0xf9e6('0x28')](respondWithResult(_0x58935b,null))[_0xf9e6('0x4a')](handleError(_0x58935b,null));};exports[_0xf9e6('0x4e')]=function(_0x3bd6aa,_0x141335){return db[_0xf9e6('0x33')][_0xf9e6('0x4e')](_0x3bd6aa['body'],{})[_0xf9e6('0x28')](function(_0xa62ed5){var _0x18d891=_0x3bd6aa['user'][_0xf9e6('0x29')]({'plain':!![]});if(!_0x18d891)throw new Error(_0xf9e6('0x4f'));if(_0x18d891[_0xf9e6('0x50')]==='user'){var _0x5a69d6=_0xa62ed5[_0xf9e6('0x29')]({'plain':!![]});var _0x9fdcad=_0xf9e6('0x2a');return db[_0xf9e6('0x51')][_0xf9e6('0x4d')]({'where':{'name':_0x9fdcad,'userProfileId':_0x18d891[_0xf9e6('0x52')]},'raw':!![]})[_0xf9e6('0x28')](function(_0x40b9fd){if(_0x40b9fd&&_0x40b9fd[_0xf9e6('0x53')]===0x0){return db[_0xf9e6('0x54')][_0xf9e6('0x4e')]({'name':_0x5a69d6[_0xf9e6('0x2f')],'resourceId':_0x5a69d6['id'],'type':_0x40b9fd[_0xf9e6('0x2f')],'sectionId':_0x40b9fd['id']},{})[_0xf9e6('0x28')](function(){return _0xa62ed5;});}else{return _0xa62ed5;}})[_0xf9e6('0x4a')](function(_0x5d671e){logger[_0xf9e6('0x2d')](_0xf9e6('0x55'),_0x5d671e);throw _0x5d671e;});}return _0xa62ed5;})[_0xf9e6('0x28')](respondWithResult(_0x141335,0xc9))[_0xf9e6('0x4a')](handleError(_0x141335,null));};exports[_0xf9e6('0x27')]=function(_0x524e5e,_0x57d553){if(_0x524e5e[_0xf9e6('0x56')]['id']){delete _0x524e5e[_0xf9e6('0x56')]['id'];}return db[_0xf9e6('0x33')][_0xf9e6('0x4d')]({'where':{'id':_0x524e5e[_0xf9e6('0x4c')]['id']}})[_0xf9e6('0x28')](handleEntityNotFound(_0x57d553,null))[_0xf9e6('0x28')](saveUpdates(_0x524e5e[_0xf9e6('0x56')],null))[_0xf9e6('0x28')](respondWithResult(_0x57d553,null))[_0xf9e6('0x4a')](handleError(_0x57d553,null));};exports[_0xf9e6('0x57')]=function(_0x2b85cd,_0x452356){return db['MailQueue'][_0xf9e6('0x4d')]({'where':{'id':_0x2b85cd[_0xf9e6('0x4c')]['id']}})[_0xf9e6('0x28')](handleEntityNotFound(_0x452356,null))[_0xf9e6('0x28')](removeEntity(_0x452356,null))[_0xf9e6('0x4a')](handleError(_0x452356,null));};exports['describe']=function(_0x2b2ea2,_0x22d3f0){return db[_0xf9e6('0x33')][_0xf9e6('0x58')]()[_0xf9e6('0x28')](respondWithResult(_0x22d3f0,null))[_0xf9e6('0x4a')](handleError(_0x22d3f0,null));};exports['getMembers']=function(_0x388c28,_0x5f0c7e,_0x5a17e7){var _0x30a6dd={'raw':!![],'where':{}},_0xcfa71e={},_0x43d88b;return db[_0xf9e6('0x33')]['findOne']({'where':{'id':_0x388c28['params']['id']}})[_0xf9e6('0x28')](handleEntityNotFound(_0x5f0c7e,null))[_0xf9e6('0x28')](function(_0x553be7){if(_0x553be7){_0x43d88b=_0x553be7[_0xf9e6('0x29')]({'plain':!![]});_0xcfa71e['model']=_[_0xf9e6('0x3a')](db[_0xf9e6('0x59')][_0xf9e6('0x34')]);_0xcfa71e['query']=_[_0xf9e6('0x3a')](_0x388c28[_0xf9e6('0x39')]);_0xcfa71e[_0xf9e6('0x41')]=_[_0xf9e6('0x3b')](_0xcfa71e[_0xf9e6('0x38')],_0xcfa71e['query']);_0x30a6dd[_0xf9e6('0x3d')]=_['intersection'](_0xcfa71e[_0xf9e6('0x38')],qs['fields'](_0x388c28[_0xf9e6('0x39')][_0xf9e6('0x3c')]));_0x30a6dd[_0xf9e6('0x3d')]=_0x30a6dd[_0xf9e6('0x3d')][_0xf9e6('0x3e')]?_0x30a6dd[_0xf9e6('0x3d')]:_0xcfa71e[_0xf9e6('0x38')];if(!_0x388c28[_0xf9e6('0x39')][_0xf9e6('0x5a')](_0xf9e6('0x5b'))){_0x30a6dd[_0xf9e6('0x21')]=qs[_0xf9e6('0x21')](_0x388c28[_0xf9e6('0x39')][_0xf9e6('0x21')]);_0x30a6dd[_0xf9e6('0x1e')]=qs[_0xf9e6('0x1e')](_0x388c28[_0xf9e6('0x39')]['offset']);}_0x30a6dd[_0xf9e6('0x5c')]=qs['sort'](_0x388c28[_0xf9e6('0x39')][_0xf9e6('0x3f')]);_0x30a6dd[_0xf9e6('0x40')]=qs[_0xf9e6('0x41')](_['pick'](_0x388c28[_0xf9e6('0x39')],_0xcfa71e[_0xf9e6('0x41')]));_0x30a6dd['where'][_0xf9e6('0x5d')]=_0x553be7['id'];if(_0x388c28[_0xf9e6('0x39')][_0xf9e6('0x43')]){_0x30a6dd[_0xf9e6('0x40')]=_[_0xf9e6('0x44')](_0x30a6dd[_0xf9e6('0x40')],{'$or':_[_0xf9e6('0x32')](_0x30a6dd['attributes'],function(_0x140125){var _0x28e032={};_0x28e032[_0x140125]={'$like':'%'+_0x388c28['query'][_0xf9e6('0x43')]+'%'};return _0x28e032;})});}_0x30a6dd=_[_0xf9e6('0x44')]({},_0x30a6dd,_0x388c28[_0xf9e6('0x5e')]);return db[_0xf9e6('0x59')][_0xf9e6('0x48')](_0x30a6dd);}})[_0xf9e6('0x28')](function(_0x25dc9c){if(_0x25dc9c){return db['User'][_0xf9e6('0x5f')]({'where':{'id':_[_0xf9e6('0x32')](_0x25dc9c,_0xf9e6('0x60')),'role':'agent'},'attributes':['id',_0xf9e6('0x2f'),_0xf9e6('0x61'),_0xf9e6('0x62'),_0xf9e6('0x63')]});}})[_0xf9e6('0x28')](function(_0x4a232d){if(_0x4a232d){return{'count':_0x4a232d[_0xf9e6('0x20')],'rows':_['map'](_0x4a232d['rows'],function(_0x151615){return{'membername':_0x151615[_0xf9e6('0x2f')],'UserId':_0x151615['id'],'queue_name':_0x43d88b[_0xf9e6('0x2f')],'MailQueueId':_0x43d88b['id'],'interface':util[_0xf9e6('0x64')](_0xf9e6('0x65'),_0xf9e6('0x66'),_0x151615[_0xf9e6('0x2f')]),'penalty':0x0,'paused':_0x151615[_0xf9e6('0x61')],'createdAt':_0x151615['createdAt'],'updatedAt':_0x151615[_0xf9e6('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xf9e6('0x28')](respondWithFilteredResult(_0x5f0c7e,_0x30a6dd))[_0xf9e6('0x4a')](handleError(_0x5f0c7e,null));};exports[_0xf9e6('0x67')]=function(_0x3b4a54,_0x5c6ff7,_0x509f52){var _0x1e0d0f={};var _0x140c36={};var _0x1586c7;var _0x3894a4;return db[_0xf9e6('0x33')][_0xf9e6('0x68')]({'where':{'id':_0x3b4a54['params']['id']}})[_0xf9e6('0x28')](handleEntityNotFound(_0x5c6ff7,null))['then'](function(_0x2d3a93){if(_0x2d3a93){_0x1586c7=_0x2d3a93;_0x140c36[_0xf9e6('0x38')]=_[_0xf9e6('0x3a')](db['Team'][_0xf9e6('0x34')]);_0x140c36[_0xf9e6('0x39')]=_[_0xf9e6('0x3a')](_0x3b4a54[_0xf9e6('0x39')]);_0x140c36[_0xf9e6('0x41')]=_['intersection'](_0x140c36[_0xf9e6('0x38')],_0x140c36[_0xf9e6('0x39')]);_0x1e0d0f[_0xf9e6('0x3d')]=_[_0xf9e6('0x3b')](_0x140c36[_0xf9e6('0x38')],qs[_0xf9e6('0x3c')](_0x3b4a54[_0xf9e6('0x39')]['fields']));_0x1e0d0f[_0xf9e6('0x3d')]=_0x1e0d0f[_0xf9e6('0x3d')][_0xf9e6('0x3e')]?_0x1e0d0f[_0xf9e6('0x3d')]:_0x140c36['model'];_0x1e0d0f[_0xf9e6('0x5c')]=qs[_0xf9e6('0x3f')](_0x3b4a54[_0xf9e6('0x39')][_0xf9e6('0x3f')]);_0x1e0d0f[_0xf9e6('0x40')]=qs[_0xf9e6('0x41')](_[_0xf9e6('0x42')](_0x3b4a54[_0xf9e6('0x39')],_0x140c36[_0xf9e6('0x41')]));if(_0x3b4a54['query']['filter']){_0x1e0d0f[_0xf9e6('0x40')]=_[_0xf9e6('0x44')](_0x1e0d0f[_0xf9e6('0x40')],{'$or':_[_0xf9e6('0x32')](_0x1e0d0f[_0xf9e6('0x3d')],function(_0x2a5055){var _0x425ecb={};_0x425ecb[_0x2a5055]={'$like':'%'+_0x3b4a54['query']['filter']+'%'};return _0x425ecb;})});}_0x1e0d0f=_[_0xf9e6('0x44')]({},_0x1e0d0f,_0x3b4a54[_0xf9e6('0x5e')]);return _0x1586c7[_0xf9e6('0x67')](_0x1e0d0f);}})[_0xf9e6('0x28')](function(_0x59127c){if(_0x59127c){_0x3894a4=_0x59127c['length'];if(!_0x3b4a54[_0xf9e6('0x39')][_0xf9e6('0x5a')]('nolimit')){_0x1e0d0f[_0xf9e6('0x21')]=qs['limit'](_0x3b4a54[_0xf9e6('0x39')][_0xf9e6('0x21')]);_0x1e0d0f['offset']=qs[_0xf9e6('0x1e')](_0x3b4a54[_0xf9e6('0x39')][_0xf9e6('0x1e')]);}return _0x1586c7[_0xf9e6('0x67')](_0x1e0d0f);}})[_0xf9e6('0x28')](function(_0x2ce10e){if(_0x2ce10e){return _0x2ce10e?{'count':_0x3894a4,'rows':_0x2ce10e}:null;}})[_0xf9e6('0x28')](respondWithResult(_0x5c6ff7,null))['catch'](handleError(_0x5c6ff7,null));};exports[_0xf9e6('0x69')]=function(_0x112cea,_0x7c44eb,_0x27e2dd){var _0x3e08f5=_0x112cea[_0xf9e6('0x56')][_0xf9e6('0x6a')];return db['Team'][_0xf9e6('0x48')]({'where':{'id':_0x3e08f5},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id','name','online',_0xf9e6('0x6b'),_0xf9e6('0x6c')],'raw':!![]}]})[_0xf9e6('0x28')](function(_0x27812c){if(_0x27812c){var _0x41a8e0=_[_0xf9e6('0x6d')](_0x27812c,function(_0xb77731){var _0x28c652=_0xb77731[_0xf9e6('0x29')]({'plain':!![]});return _0x28c652[_0xf9e6('0x6e')];});return db['MailQueue'][_0xf9e6('0x4d')]({'where':{'id':_0x112cea[_0xf9e6('0x4c')]['id']}})['then'](function(_0x81d5e7){return db[_0xf9e6('0x6f')][_0xf9e6('0x70')](function(_0x4f3f6c){return _0x81d5e7['addTeams'](_0x3e08f5,{'transaction':_0x4f3f6c})[_0xf9e6('0x28')](function(){return BPromise[_0xf9e6('0x71')](_0x41a8e0,function(_0x2f0b49){return db[_0xf9e6('0x59')][_0xf9e6('0x72')]({'where':{'UserId':_0x2f0b49['id'],'MailQueueId':_0x112cea[_0xf9e6('0x4c')]['id']},'transaction':_0x4f3f6c});});})[_0xf9e6('0x28')](function(){_0x41a8e0['forEach'](function(_0x1f0757){socket[_0xf9e6('0x73')]('userMailQueue:save',{'UserId':_0x1f0757['id'],'MailQueueId':_0x81d5e7['id']});});});});});}})[_0xf9e6('0x28')](respondWithStatusCode(_0x7c44eb,null))[_0xf9e6('0x4a')](handleError(_0x7c44eb,null));};exports['removeTeams']=function(_0x465fa7,_0x1b1471,_0x40252e){return db[_0xf9e6('0x74')]['findAll']({'where':{'id':_0x465fa7['query'][_0xf9e6('0x6a')]},'attributes':['id'],'include':[{'model':db[_0xf9e6('0x75')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xf9e6('0x28')](handleEntityNotFound(_0x1b1471,null))['then'](function(_0x47cd6b){var _0x32b06a=_[_0xf9e6('0x32')](_0x47cd6b,'id');var _0x1e27bf=[];var _0x273e8e=[];var _0x217dc4=squel[_0xf9e6('0x76')]();_0x217dc4[_0xf9e6('0x77')](_0xf9e6('0x78'))[_0xf9e6('0x79')](_0xf9e6('0x7a'),'tq')[_0xf9e6('0x7b')]('user_has_teams','ut',_0xf9e6('0x7c'))['where'](_0xf9e6('0x7d'),_0x465fa7[_0xf9e6('0x4c')]['id']);for(var _0x3de43b=0x0;_0x3de43b<_0x47cd6b['length'];_0x3de43b+=0x1){let _0x403162=_0x47cd6b[_0x3de43b];for(var _0x134bcb=0x0;_0x134bcb<_0x403162[_0xf9e6('0x6e')][_0xf9e6('0x3e')];_0x134bcb+=0x1){let _0x341b69=_0x403162['Agents'][_0x134bcb];var _0x533af1=_0x217dc4['clone']();_0x533af1[_0xf9e6('0x40')]('ut.UserId\x20=\x20?',_0x341b69['id']);_0x273e8e[_0xf9e6('0x7e')](db[_0xf9e6('0x6f')]['query'](_0x533af1[_0xf9e6('0x7f')](),{'type':db[_0xf9e6('0x6f')][_0xf9e6('0x80')][_0xf9e6('0x81')]})[_0xf9e6('0x28')](function(_0x1c3595){if(_0x1c3595[_0xf9e6('0x3e')]===0x1){return _0x341b69['id'];}else{var _0x3554e1=_[_0xf9e6('0x82')](_[_0xf9e6('0x32')](_0x1c3595,_0xf9e6('0x83')),function(_0x3a6a12){return _[_0xf9e6('0x84')](_0x32b06a,_0x3a6a12);});if(_0x3554e1){return _0x341b69['id'];}}}));}}return BPromise[_0xf9e6('0x85')](_0x273e8e)['then'](function(_0x48ef25){_0x1e27bf=_(_0x1e27bf)['union'](_0x48ef25)[_0xf9e6('0x86')]()[_0xf9e6('0x87')]();return db[_0xf9e6('0x33')]['find']({'where':{'id':_0x465fa7[_0xf9e6('0x4c')]['id']}})[_0xf9e6('0x28')](function(_0x87bab8){return db[_0xf9e6('0x6f')][_0xf9e6('0x70')](function(_0x4bd5d5){return _0x87bab8[_0xf9e6('0x88')](_0x465fa7['query'][_0xf9e6('0x6a')],{'transaction':_0x4bd5d5})[_0xf9e6('0x28')](function(){if(!_[_0xf9e6('0x89')](_0x1e27bf)){return _0x87bab8[_0xf9e6('0x8a')](_0x1e27bf,{'transaction':_0x4bd5d5});}})['then'](function(){_0x1e27bf[_0xf9e6('0x8b')](function(_0x5b8bd9){socket[_0xf9e6('0x73')](_0xf9e6('0x8c'),{'UserId':_0x5b8bd9,'MailQueueId':_0x87bab8['id']});});});});});});})['then'](respondWithStatusCode(_0x1b1471,null))[_0xf9e6('0x4a')](handleError(_0x1b1471,null));};exports[_0xf9e6('0x8d')]=function(_0x14d653,_0x190c79,_0x21cc40){return db[_0xf9e6('0x33')][_0xf9e6('0x4d')]({'where':{'id':_0x14d653[_0xf9e6('0x4c')]['id']}})['then'](handleEntityNotFound(_0x190c79,null))[_0xf9e6('0x28')](function(_0x4e7048){if(_0x4e7048){return _0x4e7048[_0xf9e6('0x8d')](_0x14d653[_0xf9e6('0x56')]['ids'],_[_0xf9e6('0x8e')](_0x14d653[_0xf9e6('0x56')],[_0xf9e6('0x6a'),'id'])||{})['spread'](function(_0x26ee80){for(var _0x57a53d=0x0;_0x57a53d<_0x14d653[_0xf9e6('0x56')][_0xf9e6('0x6a')]['length'];_0x57a53d+=0x1){socket[_0xf9e6('0x73')](_0xf9e6('0x8f'),{'UserId':Number(_0x14d653['body'][_0xf9e6('0x6a')][_0x57a53d]),'MailQueueId':Number(_0x14d653[_0xf9e6('0x4c')]['id'])});}return _0x26ee80;});}})[_0xf9e6('0x28')](respondWithResult(_0x190c79,null))[_0xf9e6('0x4a')](handleError(_0x190c79,null));};exports[_0xf9e6('0x8a')]=function(_0x314e16,_0x1043d7,_0x5b0dd4){return db[_0xf9e6('0x33')][_0xf9e6('0x4d')]({'where':{'id':_0x314e16[_0xf9e6('0x4c')]['id']}})[_0xf9e6('0x28')](handleEntityNotFound(_0x1043d7,null))['then'](function(_0x221a80){if(_0x221a80){return _0x221a80[_0xf9e6('0x8a')](_0x314e16['query'][_0xf9e6('0x6a')])['then'](function(){if(_['isArray'](_0x314e16[_0xf9e6('0x39')][_0xf9e6('0x6a')])){for(var _0xab8db9=0x0;_0xab8db9<_0x314e16[_0xf9e6('0x39')]['ids'][_0xf9e6('0x3e')];_0xab8db9+=0x1){socket[_0xf9e6('0x73')](_0xf9e6('0x8c'),{'UserId':Number(_0x314e16[_0xf9e6('0x39')][_0xf9e6('0x6a')][_0xab8db9]),'MailQueueId':Number(_0x314e16[_0xf9e6('0x4c')]['id'])});}}else{socket['emit'](_0xf9e6('0x8c'),{'UserId':Number(_0x314e16['query'][_0xf9e6('0x6a')]),'MailQueueId':Number(_0x314e16[_0xf9e6('0x4c')]['id'])});}});}})['then'](respondWithStatusCode(_0x1043d7,null))[_0xf9e6('0x4a')](handleError(_0x1043d7,null));};exports[_0xf9e6('0x90')]=function(_0x1000a2,_0x426d8f,_0x4caeed){var _0x5bae33={};var _0xe34f74={};var _0x175ae5;var _0x48d928;return db[_0xf9e6('0x33')][_0xf9e6('0x68')]({'where':{'id':_0x1000a2[_0xf9e6('0x4c')]['id']}})[_0xf9e6('0x28')](handleEntityNotFound(_0x426d8f,null))[_0xf9e6('0x28')](function(_0x3e4bfe){if(_0x3e4bfe){_0x175ae5=_0x3e4bfe;_0xe34f74[_0xf9e6('0x38')]=_[_0xf9e6('0x3a')](db[_0xf9e6('0x75')]['rawAttributes']);_0xe34f74[_0xf9e6('0x39')]=_[_0xf9e6('0x3a')](_0x1000a2[_0xf9e6('0x39')]);_0xe34f74[_0xf9e6('0x41')]=_[_0xf9e6('0x3b')](_0xe34f74[_0xf9e6('0x38')],_0xe34f74[_0xf9e6('0x39')]);_0x5bae33[_0xf9e6('0x3d')]=_[_0xf9e6('0x3b')](_0xe34f74['model'],qs[_0xf9e6('0x3c')](_0x1000a2[_0xf9e6('0x39')][_0xf9e6('0x3c')]));_0x5bae33[_0xf9e6('0x3d')]=_0x5bae33[_0xf9e6('0x3d')][_0xf9e6('0x3e')]?_0x5bae33['attributes']:_0xe34f74[_0xf9e6('0x38')];_0x5bae33[_0xf9e6('0x5c')]=qs['sort'](_0x1000a2[_0xf9e6('0x39')][_0xf9e6('0x3f')]);_0x5bae33[_0xf9e6('0x40')]=qs[_0xf9e6('0x41')](_[_0xf9e6('0x42')](_0x1000a2[_0xf9e6('0x39')],_0xe34f74[_0xf9e6('0x41')]));if(_0x1000a2[_0xf9e6('0x39')]['filter']){_0x5bae33[_0xf9e6('0x40')]=_[_0xf9e6('0x44')](_0x5bae33[_0xf9e6('0x40')],{'$or':_[_0xf9e6('0x32')](_0x5bae33[_0xf9e6('0x3d')],function(_0x4ae098){var _0x2e1963={};_0x2e1963[_0x4ae098]={'$like':'%'+_0x1000a2[_0xf9e6('0x39')][_0xf9e6('0x43')]+'%'};return _0x2e1963;})});}_0x5bae33=_[_0xf9e6('0x44')]({},_0x5bae33,_0x1000a2[_0xf9e6('0x5e')]);return _0x175ae5[_0xf9e6('0x90')](_0x5bae33);}})['then'](function(_0x2313aa){if(_0x2313aa){_0x48d928=_0x2313aa[_0xf9e6('0x3e')];if(!_0x1000a2[_0xf9e6('0x39')][_0xf9e6('0x5a')]('nolimit')){_0x5bae33['limit']=qs['limit'](_0x1000a2[_0xf9e6('0x39')][_0xf9e6('0x21')]);_0x5bae33[_0xf9e6('0x1e')]=qs[_0xf9e6('0x1e')](_0x1000a2[_0xf9e6('0x39')]['offset']);}return _0x175ae5['getAgents'](_0x5bae33);}})[_0xf9e6('0x28')](function(_0x22c0eb){if(_0x22c0eb){return _0x22c0eb?{'count':_0x48d928,'rows':_0x22c0eb}:null;}})['then'](respondWithResult(_0x426d8f,null))[_0xf9e6('0x4a')](handleError(_0x426d8f,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index c423c68..a2babcd 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 _0x1a4f=['MailQueue','setMaxListeners','save','update','remove','emit','exports','events','../../mysqldb'];(function(_0x2f4a79,_0xc0a0f2){var _0x25463f=function(_0x5b84b3){while(--_0x5b84b3){_0x2f4a79['push'](_0x2f4a79['shift']());}};_0x25463f(++_0xc0a0f2);}(_0x1a4f,0x19c));var _0xf1a4=function(_0x5787ca,_0x4f6e1c){_0x5787ca=_0x5787ca-0x0;var _0x4222c8=_0x1a4f[_0x5787ca];return _0x4222c8;};'use strict';var EventEmitter=require(_0xf1a4('0x0'));var MailQueue=require(_0xf1a4('0x1'))['db'][_0xf1a4('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xf1a4('0x3')](0x0);var events={'afterCreate':_0xf1a4('0x4'),'afterUpdate':_0xf1a4('0x5'),'afterDestroy':_0xf1a4('0x6')};function emitEvent(_0x132139){return function(_0x297c7f,_0x326878,_0x537cc6){MailQueueEvents[_0xf1a4('0x7')](_0x132139+':'+_0x297c7f['id'],_0x297c7f);MailQueueEvents[_0xf1a4('0x7')](_0x132139,_0x297c7f);_0x537cc6(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module[_0xf1a4('0x8')]=MailQueueEvents; \ No newline at end of file +var _0xd4e8=['../../mysqldb','MailQueue','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x3f88bc,_0xe38cf5){var _0x4df1c4=function(_0x111de1){while(--_0x111de1){_0x3f88bc['push'](_0x3f88bc['shift']());}};_0x4df1c4(++_0xe38cf5);}(_0xd4e8,0x1d5));var _0x8d4e=function(_0x8ed2fe,_0x19ca78){_0x8ed2fe=_0x8ed2fe-0x0;var _0x23a751=_0xd4e8[_0x8ed2fe];return _0x23a751;};'use strict';var EventEmitter=require(_0x8d4e('0x0'));var MailQueue=require(_0x8d4e('0x1'))['db'][_0x8d4e('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8d4e('0x3'),'afterUpdate':_0x8d4e('0x4'),'afterDestroy':_0x8d4e('0x5')};function emitEvent(_0x49f85c){return function(_0x32f19a,_0x75a8f4,_0xe33210){MailQueueEvents[_0x8d4e('0x6')](_0x49f85c+':'+_0x32f19a['id'],_0x32f19a);MailQueueEvents[_0x8d4e('0x6')](_0x49f85c,_0x32f19a);_0xe33210(null);};}for(var e in events){if(events[_0x8d4e('0x7')](e)){var event=events[e];MailQueue[_0x8d4e('0x8')](e,emitEvent(event));}}module[_0x8d4e('0x9')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index b3ac313..0ba25c8 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 _0x9d85=['MailQueue','mail_queues','lodash','util','../../config/logger','moment','bluebird','request-promise','./mailQueue.attributes','define'];(function(_0x2a608d,_0x298459){var _0x1bee3e=function(_0x989a39){while(--_0x989a39){_0x2a608d['push'](_0x2a608d['shift']());}};_0x1bee3e(++_0x298459);}(_0x9d85,0x106));var _0x59d8=function(_0x505707,_0x1022bc){_0x505707=_0x505707-0x0;var _0x43cf38=_0x9d85[_0x505707];return _0x43cf38;};'use strict';var _=require(_0x59d8('0x0'));var util=require(_0x59d8('0x1'));var logger=require(_0x59d8('0x2'))('api');var moment=require(_0x59d8('0x3'));var BPromise=require(_0x59d8('0x4'));var rp=require(_0x59d8('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x59d8('0x6'));module['exports']=function(_0x1db4e6,_0x485633){return _0x1db4e6[_0x59d8('0x7')](_0x59d8('0x8'),attributes,{'tableName':_0x59d8('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9d2d=['../../config/environment','./mailQueue.attributes','define','mail_queues','lodash','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x5e3f0f,_0x16c6c7){var _0xbd8d66=function(_0x3f4da4){while(--_0x3f4da4){_0x5e3f0f['push'](_0x5e3f0f['shift']());}};_0xbd8d66(++_0x16c6c7);}(_0x9d2d,0xd5));var _0xd9d2=function(_0x4f8779,_0x5ed2f2){_0x4f8779=_0x4f8779-0x0;var _0x285c5c=_0x9d2d[_0x4f8779];return _0x285c5c;};'use strict';var _=require(_0xd9d2('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xd9d2('0x1'));var moment=require(_0xd9d2('0x2'));var BPromise=require(_0xd9d2('0x3'));var rp=require(_0xd9d2('0x4'));var fs=require('fs');var path=require(_0xd9d2('0x5'));var rimraf=require(_0xd9d2('0x6'));var config=require(_0xd9d2('0x7'));var attributes=require(_0xd9d2('0x8'));module['exports']=function(_0x6c5c13,_0x586c2e){return _0x6c5c13[_0xd9d2('0x9')]('MailQueue',attributes,{'tableName':_0xd9d2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.rpc.js b/server/api/mailQueue/mailQueue.rpc.js index a8a34cc..872a50e 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 _0xd57b=['ShowMailQueue','stringify','lodash','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','request','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','error','message','result','GetMailQueue','findAll','options','raw','where','attributes','include','map','model','catch','MailQueue','find'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0xd57b,0x1be));var _0xbd57=function(_0x127783,_0x258715){_0x127783=_0x127783-0x0;var _0x14f298=_0xd57b[_0x127783];return _0x14f298;};'use strict';var _=require(_0xbd57('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbd57('0x1'));var db=require(_0xbd57('0x2'))['db'];var utils=require(_0xbd57('0x3'));var logger=require('../../config/logger')(_0xbd57('0x4'));var config=require('../../config/environment');var jayson=require(_0xbd57('0x5'));var client=jayson['client'][_0xbd57('0x6')]({'port':0x232a});config[_0xbd57('0x7')]=_[_0xbd57('0x8')](config[_0xbd57('0x7')],{'host':_0xbd57('0x9'),'port':0x18eb});var socket=require(_0xbd57('0xa'))(new Redis(config[_0xbd57('0x7')]));require(_0xbd57('0xb'))[_0xbd57('0xc')](socket);function respondWithRpcPromise(_0x4b0802,_0x558e25,_0x853f7f){return new BPromise(function(_0x21eff0,_0x58c7c3){return client[_0xbd57('0xd')](_0x4b0802,_0x853f7f)[_0xbd57('0xe')](function(_0x3163df){logger[_0xbd57('0xf')](_0xbd57('0x10'),_0x558e25,_0xbd57('0x11'));logger[_0xbd57('0x12')](_0xbd57('0x13'),_0x558e25,_0xbd57('0x11'),JSON['stringify'](_0x3163df));if(_0x3163df[_0xbd57('0x14')]){if(_0x3163df[_0xbd57('0x14')]['code']===0x1f4){logger[_0xbd57('0x14')](_0xbd57('0x10'),_0x558e25,_0x3163df[_0xbd57('0x14')][_0xbd57('0x15')]);return _0x58c7c3(_0x3163df[_0xbd57('0x14')][_0xbd57('0x15')]);}logger[_0xbd57('0x14')]('MailQueue,\x20%s,\x20%s',_0x558e25,_0x3163df['error'][_0xbd57('0x15')]);return _0x21eff0(_0x3163df[_0xbd57('0x14')][_0xbd57('0x15')]);}else{logger[_0xbd57('0xf')]('MailQueue,\x20%s,\x20%s',_0x558e25,_0xbd57('0x11'));_0x21eff0(_0x3163df[_0xbd57('0x16')][_0xbd57('0x15')]);}})['catch'](function(_0x103ab8){logger[_0xbd57('0x14')](_0xbd57('0x10'),_0x558e25,_0x103ab8);_0x58c7c3(_0x103ab8);});});}exports[_0xbd57('0x17')]=function(_0x54a441){var _0xf3d96e=this;return new Promise(function(_0x12c7e2,_0x2048d6){return db['MailQueue'][_0xbd57('0x18')]({'raw':_0x54a441[_0xbd57('0x19')]?_0x54a441['options'][_0xbd57('0x1a')]===undefined?!![]:![]:!![],'where':_0x54a441['options']?_0x54a441['options'][_0xbd57('0x1b')]||null:null,'attributes':_0x54a441[_0xbd57('0x19')]?_0x54a441[_0xbd57('0x19')][_0xbd57('0x1c')]||null:null,'limit':_0x54a441['options']?_0x54a441[_0xbd57('0x19')]['limit']||null:null,'include':_0x54a441[_0xbd57('0x19')]?_0x54a441['options'][_0xbd57('0x1d')]?_[_0xbd57('0x1e')](_0x54a441[_0xbd57('0x19')][_0xbd57('0x1d')],function(_0x28be5e){return{'model':db[_0x28be5e[_0xbd57('0x1f')]],'as':_0x28be5e['as'],'attributes':_0x28be5e['attributes'],'include':_0x28be5e[_0xbd57('0x1d')]?_[_0xbd57('0x1e')](_0x28be5e['include'],function(_0x238aea){return{'model':db[_0x238aea[_0xbd57('0x1f')]],'as':_0x238aea['as'],'attributes':_0x238aea[_0xbd57('0x1c')],'include':_0x238aea[_0xbd57('0x1d')]?_[_0xbd57('0x1e')](_0x238aea[_0xbd57('0x1d')],function(_0x14f784){return{'model':db[_0x14f784[_0xbd57('0x1f')]],'as':_0x14f784['as'],'attributes':_0x14f784[_0xbd57('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x21c567){logger['info']('GetMailQueue',_0x54a441);logger['debug'](_0xbd57('0x17'),_0x54a441,JSON['stringify'](_0x21c567));_0x12c7e2(_0x21c567);})[_0xbd57('0x20')](function(_0x10253d){logger[_0xbd57('0x14')]('GetMailQueue',_0x10253d['message'],_0x54a441);_0x2048d6(_0xf3d96e[_0xbd57('0x14')](0x1f4,_0x10253d[_0xbd57('0x15')]));});});};exports['ShowMailQueue']=function(_0x60ebcb){var _0x11a718=this;return new Promise(function(_0xc22a07,_0x3e442e){return db[_0xbd57('0x21')][_0xbd57('0x22')]({'raw':_0x60ebcb[_0xbd57('0x19')]?_0x60ebcb[_0xbd57('0x19')][_0xbd57('0x1a')]===undefined?!![]:![]:!![],'where':_0x60ebcb[_0xbd57('0x19')]?_0x60ebcb[_0xbd57('0x19')]['where']||null:null,'attributes':_0x60ebcb[_0xbd57('0x19')]?_0x60ebcb[_0xbd57('0x19')][_0xbd57('0x1c')]||null:null,'include':_0x60ebcb[_0xbd57('0x19')]?_0x60ebcb[_0xbd57('0x19')][_0xbd57('0x1d')]?_[_0xbd57('0x1e')](_0x60ebcb[_0xbd57('0x19')]['include'],function(_0x1335b2){return{'model':db[_0x1335b2[_0xbd57('0x1f')]],'as':_0x1335b2['as'],'attributes':_0x1335b2[_0xbd57('0x1c')],'include':_0x1335b2[_0xbd57('0x1d')]?_[_0xbd57('0x1e')](_0x1335b2[_0xbd57('0x1d')],function(_0x13c332){return{'model':db[_0x13c332[_0xbd57('0x1f')]],'as':_0x13c332['as'],'attributes':_0x13c332[_0xbd57('0x1c')],'include':_0x13c332['include']?_[_0xbd57('0x1e')](_0x13c332[_0xbd57('0x1d')],function(_0x2f3e9c){return{'model':db[_0x2f3e9c[_0xbd57('0x1f')]],'as':_0x2f3e9c['as'],'attributes':_0x2f3e9c['attributes']};}):[]};}):[]};}):[]:[]})[_0xbd57('0xe')](function(_0x50db27){logger['info']('ShowMailQueue',_0x60ebcb);logger[_0xbd57('0x12')](_0xbd57('0x23'),_0x60ebcb,JSON[_0xbd57('0x24')](_0x50db27));_0xc22a07(_0x50db27);})['catch'](function(_0x256df1){logger[_0xbd57('0x14')]('ShowMailQueue',_0x256df1[_0xbd57('0x15')],_0x60ebcb);_0x3e442e(_0x11a718[_0xbd57('0x14')](0x1f4,_0x256df1[_0xbd57('0x15')]));});});}; \ No newline at end of file +var _0xf2f5=['include','map','model','GetMailQueue','debug','ShowMailQueue','raw','where','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./mailQueue.socket','request','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','MailQueue','findAll','options','attributes','limit'];(function(_0x4bb722,_0x1db86e){var _0x407977=function(_0xe856ab){while(--_0xe856ab){_0x4bb722['push'](_0x4bb722['shift']());}};_0x407977(++_0x1db86e);}(_0xf2f5,0x179));var _0x5f2f=function(_0x1406fd,_0x5b1a56){_0x1406fd=_0x1406fd-0x0;var _0x1a985e=_0xf2f5[_0x1406fd];return _0x1a985e;};'use strict';var _=require(_0x5f2f('0x0'));var util=require('util');var moment=require(_0x5f2f('0x1'));var BPromise=require('bluebird');var rs=require(_0x5f2f('0x2'));var fs=require('fs');var Redis=require(_0x5f2f('0x3'));var db=require(_0x5f2f('0x4'))['db'];var utils=require(_0x5f2f('0x5'));var logger=require(_0x5f2f('0x6'))(_0x5f2f('0x7'));var config=require(_0x5f2f('0x8'));var jayson=require(_0x5f2f('0x9'));var client=jayson[_0x5f2f('0xa')][_0x5f2f('0xb')]({'port':0x232a});config[_0x5f2f('0xc')]=_[_0x5f2f('0xd')](config[_0x5f2f('0xc')],{'host':_0x5f2f('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5f2f('0xc')]));require(_0x5f2f('0xf'))['register'](socket);function respondWithRpcPromise(_0x4568ef,_0x1d7a67,_0x450487){return new BPromise(function(_0x32cc75,_0x1261af){return client[_0x5f2f('0x10')](_0x4568ef,_0x450487)[_0x5f2f('0x11')](function(_0x87acf1){logger[_0x5f2f('0x12')](_0x5f2f('0x13'),_0x1d7a67,_0x5f2f('0x14'));logger['debug'](_0x5f2f('0x15'),_0x1d7a67,_0x5f2f('0x14'),JSON[_0x5f2f('0x16')](_0x87acf1));if(_0x87acf1[_0x5f2f('0x17')]){if(_0x87acf1['error'][_0x5f2f('0x18')]===0x1f4){logger[_0x5f2f('0x17')]('MailQueue,\x20%s,\x20%s',_0x1d7a67,_0x87acf1[_0x5f2f('0x17')][_0x5f2f('0x19')]);return _0x1261af(_0x87acf1[_0x5f2f('0x17')][_0x5f2f('0x19')]);}logger[_0x5f2f('0x17')](_0x5f2f('0x13'),_0x1d7a67,_0x87acf1['error'][_0x5f2f('0x19')]);return _0x32cc75(_0x87acf1['error'][_0x5f2f('0x19')]);}else{logger['info'](_0x5f2f('0x13'),_0x1d7a67,_0x5f2f('0x14'));_0x32cc75(_0x87acf1[_0x5f2f('0x1a')]['message']);}})[_0x5f2f('0x1b')](function(_0x17b15f){logger[_0x5f2f('0x17')]('MailQueue,\x20%s,\x20%s',_0x1d7a67,_0x17b15f);_0x1261af(_0x17b15f);});});}exports['GetMailQueue']=function(_0x1583ac){var _0x45279b=this;return new Promise(function(_0x5f5db1,_0x187e87){return db[_0x5f2f('0x1c')][_0x5f2f('0x1d')]({'raw':_0x1583ac[_0x5f2f('0x1e')]?_0x1583ac[_0x5f2f('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x1583ac[_0x5f2f('0x1e')]?_0x1583ac[_0x5f2f('0x1e')]['where']||null:null,'attributes':_0x1583ac[_0x5f2f('0x1e')]?_0x1583ac[_0x5f2f('0x1e')][_0x5f2f('0x1f')]||null:null,'limit':_0x1583ac['options']?_0x1583ac[_0x5f2f('0x1e')][_0x5f2f('0x20')]||null:null,'include':_0x1583ac[_0x5f2f('0x1e')]?_0x1583ac['options'][_0x5f2f('0x21')]?_[_0x5f2f('0x22')](_0x1583ac[_0x5f2f('0x1e')][_0x5f2f('0x21')],function(_0x492c1b){return{'model':db[_0x492c1b['model']],'as':_0x492c1b['as'],'attributes':_0x492c1b[_0x5f2f('0x1f')],'include':_0x492c1b['include']?_[_0x5f2f('0x22')](_0x492c1b['include'],function(_0x568479){return{'model':db[_0x568479[_0x5f2f('0x23')]],'as':_0x568479['as'],'attributes':_0x568479[_0x5f2f('0x1f')],'include':_0x568479[_0x5f2f('0x21')]?_[_0x5f2f('0x22')](_0x568479[_0x5f2f('0x21')],function(_0x376f75){return{'model':db[_0x376f75['model']],'as':_0x376f75['as'],'attributes':_0x376f75[_0x5f2f('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x5f2f('0x11')](function(_0x3250c9){logger[_0x5f2f('0x12')](_0x5f2f('0x24'),_0x1583ac);logger[_0x5f2f('0x25')](_0x5f2f('0x24'),_0x1583ac,JSON[_0x5f2f('0x16')](_0x3250c9));_0x5f5db1(_0x3250c9);})[_0x5f2f('0x1b')](function(_0x51fa98){logger['error']('GetMailQueue',_0x51fa98[_0x5f2f('0x19')],_0x1583ac);_0x187e87(_0x45279b[_0x5f2f('0x17')](0x1f4,_0x51fa98['message']));});});};exports[_0x5f2f('0x26')]=function(_0x4249be){var _0x737dc=this;return new Promise(function(_0x6a424d,_0x336835){return db[_0x5f2f('0x1c')]['find']({'raw':_0x4249be[_0x5f2f('0x1e')]?_0x4249be[_0x5f2f('0x1e')][_0x5f2f('0x27')]===undefined?!![]:![]:!![],'where':_0x4249be[_0x5f2f('0x1e')]?_0x4249be['options'][_0x5f2f('0x28')]||null:null,'attributes':_0x4249be[_0x5f2f('0x1e')]?_0x4249be['options'][_0x5f2f('0x1f')]||null:null,'include':_0x4249be[_0x5f2f('0x1e')]?_0x4249be[_0x5f2f('0x1e')][_0x5f2f('0x21')]?_[_0x5f2f('0x22')](_0x4249be[_0x5f2f('0x1e')][_0x5f2f('0x21')],function(_0x353c48){return{'model':db[_0x353c48[_0x5f2f('0x23')]],'as':_0x353c48['as'],'attributes':_0x353c48['attributes'],'include':_0x353c48['include']?_['map'](_0x353c48[_0x5f2f('0x21')],function(_0x45bbd6){return{'model':db[_0x45bbd6[_0x5f2f('0x23')]],'as':_0x45bbd6['as'],'attributes':_0x45bbd6['attributes'],'include':_0x45bbd6[_0x5f2f('0x21')]?_[_0x5f2f('0x22')](_0x45bbd6['include'],function(_0x3fedec){return{'model':db[_0x3fedec[_0x5f2f('0x23')]],'as':_0x3fedec['as'],'attributes':_0x3fedec[_0x5f2f('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1551de){logger['info'](_0x5f2f('0x26'),_0x4249be);logger['debug']('ShowMailQueue',_0x4249be,JSON[_0x5f2f('0x16')](_0x1551de));_0x6a424d(_0x1551de);})[_0x5f2f('0x1b')](function(_0x1c436e){logger['error'](_0x5f2f('0x26'),_0x1c436e[_0x5f2f('0x19')],_0x4249be);_0x336835(_0x737dc[_0x5f2f('0x17')](0x1f4,_0x1c436e[_0x5f2f('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index ba07ace..3d2afea 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 _0xb464=['emit','removeListener','register','length','mailQueue:','./mailQueue.events','save','update'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0xb464,0xad));var _0x4b46=function(_0x530e0e,_0x54d536){_0x530e0e=_0x530e0e-0x0;var _0x2742fb=_0xb464[_0x530e0e];return _0x2742fb;};'use strict';var MailQueueEvents=require(_0x4b46('0x0'));var events=[_0x4b46('0x1'),'remove',_0x4b46('0x2')];function createListener(_0x254da1,_0x5d8605){return function(_0x139975){_0x5d8605[_0x4b46('0x3')](_0x254da1,_0x139975);};}function removeListener(_0x40c389,_0x51afc2){return function(){MailQueueEvents[_0x4b46('0x4')](_0x40c389,_0x51afc2);};}exports[_0x4b46('0x5')]=function(_0x519534){for(var _0x2c074a=0x0,_0x3b9b96=events[_0x4b46('0x6')];_0x2c074a<_0x3b9b96;_0x2c074a++){var _0x127133=events[_0x2c074a];var _0x3dbefc=createListener(_0x4b46('0x7')+_0x127133,_0x519534);MailQueueEvents['on'](_0x127133,_0x3dbefc);}}; \ No newline at end of file +var _0xcbf0=['mailQueue:','./mailQueue.events','save','remove','update','emit','removeListener','register'];(function(_0x5004d5,_0x50ab11){var _0x33469a=function(_0x270937){while(--_0x270937){_0x5004d5['push'](_0x5004d5['shift']());}};_0x33469a(++_0x50ab11);}(_0xcbf0,0xc1));var _0x0cbf=function(_0x2c5cc5,_0x1c9789){_0x2c5cc5=_0x2c5cc5-0x0;var _0x56aa0c=_0xcbf0[_0x2c5cc5];return _0x56aa0c;};'use strict';var MailQueueEvents=require(_0x0cbf('0x0'));var events=[_0x0cbf('0x1'),_0x0cbf('0x2'),_0x0cbf('0x3')];function createListener(_0x507948,_0x55d052){return function(_0x415e3d){_0x55d052[_0x0cbf('0x4')](_0x507948,_0x415e3d);};}function removeListener(_0x116ab1,_0x36cbc9){return function(){MailQueueEvents[_0x0cbf('0x5')](_0x116ab1,_0x36cbc9);};}exports[_0x0cbf('0x6')]=function(_0x45f816){for(var _0x4c97cd=0x0,_0x4996b0=events['length'];_0x4c97cd<_0x4996b0;_0x4c97cd++){var _0x17afd6=events[_0x4c97cd];var _0x4a91d8=createListener(_0x0cbf('0x7')+_0x17afd6,_0x45f816);MailQueueEvents['on'](_0x17afd6,_0x4a91d8);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 078123f..a4d01fa 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 _0x6c8b=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailQueueReport.controller','get','isAuthenticated','describe','/:id','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express'];(function(_0x2d45ad,_0x38863b){var _0x54af10=function(_0x87fb27){while(--_0x87fb27){_0x2d45ad['push'](_0x2d45ad['shift']());}};_0x54af10(++_0x38863b);}(_0x6c8b,0x10d));var _0xb6c8=function(_0x481a51,_0x1b1f7a){_0x481a51=_0x481a51-0x0;var _0x5eaac1=_0x6c8b[_0x481a51];return _0x5eaac1;};'use strict';var multer=require('multer');var util=require(_0xb6c8('0x0'));var path=require(_0xb6c8('0x1'));var timeout=require(_0xb6c8('0x2'));var express=require(_0xb6c8('0x3'));var router=express[_0xb6c8('0x4')]();var fs_extra=require(_0xb6c8('0x5'));var auth=require(_0xb6c8('0x6'));var interaction=require(_0xb6c8('0x7'));var config=require('../../config/environment');var controller=require(_0xb6c8('0x8'));router[_0xb6c8('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xb6c8('0x9')]('/describe',auth[_0xb6c8('0xa')](),controller[_0xb6c8('0xb')]);router[_0xb6c8('0x9')](_0xb6c8('0xc'),auth[_0xb6c8('0xa')](),controller[_0xb6c8('0xd')]);router[_0xb6c8('0xe')]('/',auth[_0xb6c8('0xa')](),controller[_0xb6c8('0xf')]);router[_0xb6c8('0x10')](_0xb6c8('0xc'),auth[_0xb6c8('0xa')](),controller[_0xb6c8('0x11')]);router[_0xb6c8('0x12')](_0xb6c8('0xc'),auth[_0xb6c8('0xa')](),controller[_0xb6c8('0x13')]);module[_0xb6c8('0x14')]=router; \ No newline at end of file +var _0xf5c4=['get','/describe','show','create','put','/:id','update','destroy','exports','multer','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','isAuthenticated'];(function(_0x16a637,_0x5eb627){var _0x25126d=function(_0x54e016){while(--_0x54e016){_0x16a637['push'](_0x16a637['shift']());}};_0x25126d(++_0x5eb627);}(_0xf5c4,0xab));var _0x4f5c=function(_0x332551,_0x21bdc3){_0x332551=_0x332551-0x0;var _0x5f26b5=_0xf5c4[_0x332551];return _0x5f26b5;};'use strict';var multer=require(_0x4f5c('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x4f5c('0x1'));var express=require(_0x4f5c('0x2'));var router=express['Router']();var fs_extra=require(_0x4f5c('0x3'));var auth=require(_0x4f5c('0x4'));var interaction=require(_0x4f5c('0x5'));var config=require(_0x4f5c('0x6'));var controller=require(_0x4f5c('0x7'));router['get']('/',auth[_0x4f5c('0x8')](),controller['index']);router[_0x4f5c('0x9')](_0x4f5c('0xa'),auth[_0x4f5c('0x8')](),controller['describe']);router[_0x4f5c('0x9')]('/:id',auth[_0x4f5c('0x8')](),controller[_0x4f5c('0xb')]);router['post']('/',auth[_0x4f5c('0x8')](),controller[_0x4f5c('0xc')]);router[_0x4f5c('0xd')](_0x4f5c('0xe'),auth[_0x4f5c('0x8')](),controller[_0x4f5c('0xf')]);router['delete']('/:id',auth[_0x4f5c('0x8')](),controller[_0x4f5c('0x10')]);module[_0x4f5c('0x11')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index ad7d1c6..4590667 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 _0x9490=['STRING','DATE'];(function(_0x17b11a,_0x228eb7){var _0x56775e=function(_0x4a633e){while(--_0x4a633e){_0x17b11a['push'](_0x17b11a['shift']());}};_0x56775e(++_0x228eb7);}(_0x9490,0x15c));var _0x0949=function(_0x44d3b4,_0xf4795d){_0x44d3b4=_0x44d3b4-0x0;var _0x200dd4=_0x9490[_0x44d3b4];return _0x200dd4;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x0949('0x0')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x0949('0x1')]},'leaveAt':{'type':Sequelize[_0x0949('0x1')]},'acceptAt':{'type':Sequelize[_0x0949('0x1')]},'exitAt':{'type':Sequelize[_0x0949('0x1')]},'reason':{'type':Sequelize[_0x0949('0x0')]}}; \ No newline at end of file +var _0x0c74=['DATE','sequelize','exports','STRING'];(function(_0x23e7c1,_0x35110c){var _0x1add43=function(_0x238918){while(--_0x238918){_0x23e7c1['push'](_0x23e7c1['shift']());}};_0x1add43(++_0x35110c);}(_0x0c74,0x1cd));var _0x40c7=function(_0x4057a1,_0x315235){_0x4057a1=_0x4057a1-0x0;var _0x12f4a3=_0x0c74[_0x4057a1];return _0x12f4a3;};'use strict';var moment=require('moment');var Sequelize=require(_0x40c7('0x0'));module[_0x40c7('0x1')]={'uniqueid':{'type':Sequelize[_0x40c7('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x40c7('0x2')]},'joinAt':{'type':Sequelize[_0x40c7('0x3')]},'leaveAt':{'type':Sequelize[_0x40c7('0x3')]},'acceptAt':{'type':Sequelize[_0x40c7('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x40c7('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index c94e63a..5ad2ea6 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 _0x8ace=['keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','options','include','rows','params','rawAttributes','catch','create','body','find','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','update','then','stack','name','send','map','MailQueueReport','type','query'];(function(_0x323b2b,_0x541754){var _0x25b0c9=function(_0x3a10eb){while(--_0x3a10eb){_0x323b2b['push'](_0x323b2b['shift']());}};_0x25b0c9(++_0x541754);}(_0x8ace,0x1bc));var _0xe8ac=function(_0x18cb0a,_0x172892){_0x18cb0a=_0x18cb0a-0x0;var _0x4c7286=_0x8ace[_0x18cb0a];return _0x4c7286;};'use strict';var emlformat=require(_0xe8ac('0x0'));var rimraf=require(_0xe8ac('0x1'));var zipdir=require(_0xe8ac('0x2'));var jsonpatch=require(_0xe8ac('0x3'));var rp=require(_0xe8ac('0x4'));var moment=require(_0xe8ac('0x5'));var BPromise=require(_0xe8ac('0x6'));var Mustache=require(_0xe8ac('0x7'));var util=require(_0xe8ac('0x8'));var path=require(_0xe8ac('0x9'));var sox=require(_0xe8ac('0xa'));var csv=require(_0xe8ac('0xb'));var ejs=require(_0xe8ac('0xc'));var fs=require('fs');var fs_extra=require(_0xe8ac('0xd'));var _=require('lodash');var squel=require(_0xe8ac('0xe'));var crypto=require(_0xe8ac('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xe8ac('0xb'));var querystring=require('querystring');var Papa=require(_0xe8ac('0x10'));var Redis=require(_0xe8ac('0x11'));var authService=require(_0xe8ac('0x12'));var qs=require(_0xe8ac('0x13'));var as=require(_0xe8ac('0x14'));var hardwareService=require(_0xe8ac('0x15'));var logger=require('../../config/logger')(_0xe8ac('0x16'));var utils=require(_0xe8ac('0x17'));var config=require(_0xe8ac('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xe8ac('0x19'))['db'];function respondWithStatusCode(_0x4735cb,_0x4cc3b1){_0x4cc3b1=_0x4cc3b1||0xcc;return function(_0x183b7d){if(_0x183b7d){return _0x4735cb[_0xe8ac('0x1a')](_0x4cc3b1);}return _0x4735cb[_0xe8ac('0x1b')](_0x4cc3b1)[_0xe8ac('0x1c')]();};}function respondWithResult(_0x268f61,_0x317078){_0x317078=_0x317078||0xc8;return function(_0x1be138){if(_0x1be138){return _0x268f61[_0xe8ac('0x1b')](_0x317078)[_0xe8ac('0x1d')](_0x1be138);}};}function respondWithFilteredResult(_0x369d36,_0x5e4495){return function(_0x224bda){if(_0x224bda){var _0x18ddb3=typeof _0x5e4495['offset']===_0xe8ac('0x1e')&&typeof _0x5e4495[_0xe8ac('0x1f')]===_0xe8ac('0x1e');var _0xe1c52e=_0x224bda[_0xe8ac('0x20')];var _0x36759c=_0x18ddb3?0x0:_0x5e4495['offset'];var _0x59df3d=_0x18ddb3?_0x224bda['count']:_0x5e4495[_0xe8ac('0x21')]+_0x5e4495[_0xe8ac('0x1f')];var _0x4e5d00;if(_0x59df3d>=_0xe1c52e){_0x59df3d=_0xe1c52e;_0x4e5d00=0xc8;}else{_0x4e5d00=0xce;}_0x369d36[_0xe8ac('0x1b')](_0x4e5d00);return _0x369d36['set'](_0xe8ac('0x22'),_0x36759c+'-'+_0x59df3d+'/'+_0xe1c52e)[_0xe8ac('0x1d')](_0x224bda);}return null;};}function patchUpdates(_0x47e63e){return function(_0x6258f8){try{jsonpatch[_0xe8ac('0x23')](_0x6258f8,_0x47e63e,!![]);}catch(_0x13aa7c){return BPromise[_0xe8ac('0x24')](_0x13aa7c);}return _0x6258f8['save']();};}function saveUpdates(_0x6a7dbd,_0x59a9ea){return function(_0x1eb5f1){if(_0x1eb5f1){return _0x1eb5f1[_0xe8ac('0x25')](_0x6a7dbd)[_0xe8ac('0x26')](function(_0x252440){return _0x252440;});}return null;};}function removeEntity(_0x36108c,_0x31956a){return function(_0x38565d){if(_0x38565d){return _0x38565d['destroy']()[_0xe8ac('0x26')](function(){_0x36108c[_0xe8ac('0x1b')](0xcc)[_0xe8ac('0x1c')]();});}};}function handleEntityNotFound(_0x7c3450,_0x340ae0){return function(_0x3a92e1){if(!_0x3a92e1){_0x7c3450[_0xe8ac('0x1a')](0x194);}return _0x3a92e1;};}function handleError(_0x3e3fc2,_0x44b07c){_0x44b07c=_0x44b07c||0x1f4;return function(_0x562e44){logger['error'](_0x562e44[_0xe8ac('0x27')]);if(_0x562e44[_0xe8ac('0x28')]){delete _0x562e44['name'];}_0x3e3fc2[_0xe8ac('0x1b')](_0x44b07c)[_0xe8ac('0x29')](_0x562e44);};}exports['index']=function(_0x4c1d08,_0x1f1e44){var _0x41294e={},_0x3798c5={},_0x5d7562={'count':0x0,'rows':[]};var _0x156550=_[_0xe8ac('0x2a')](db[_0xe8ac('0x2b')]['rawAttributes'],function(_0xc1947d){return{'name':_0xc1947d['fieldName'],'type':_0xc1947d[_0xe8ac('0x2c')]['key']};});_0x3798c5['model']=_['map'](_0x156550,'name');_0x3798c5[_0xe8ac('0x2d')]=_[_0xe8ac('0x2e')](_0x4c1d08[_0xe8ac('0x2d')]);_0x3798c5[_0xe8ac('0x2f')]=_[_0xe8ac('0x30')](_0x3798c5[_0xe8ac('0x31')],_0x3798c5[_0xe8ac('0x2d')]);_0x41294e['attributes']=_[_0xe8ac('0x30')](_0x3798c5['model'],qs['fields'](_0x4c1d08['query'][_0xe8ac('0x32')]));_0x41294e[_0xe8ac('0x33')]=_0x41294e[_0xe8ac('0x33')]['length']?_0x41294e['attributes']:_0x3798c5[_0xe8ac('0x31')];if(!_0x4c1d08[_0xe8ac('0x2d')][_0xe8ac('0x34')](_0xe8ac('0x35'))){_0x41294e['limit']=qs[_0xe8ac('0x1f')](_0x4c1d08[_0xe8ac('0x2d')][_0xe8ac('0x1f')]);_0x41294e[_0xe8ac('0x21')]=qs[_0xe8ac('0x21')](_0x4c1d08[_0xe8ac('0x2d')][_0xe8ac('0x21')]);}_0x41294e['order']=qs[_0xe8ac('0x36')](_0x4c1d08[_0xe8ac('0x2d')]['sort']);_0x41294e[_0xe8ac('0x37')]=qs[_0xe8ac('0x2f')](_[_0xe8ac('0x38')](_0x4c1d08[_0xe8ac('0x2d')],_0x3798c5['filters']),_0x156550);if(_0x4c1d08[_0xe8ac('0x2d')]['filter']){_0x41294e['where']=_[_0xe8ac('0x39')](_0x41294e[_0xe8ac('0x37')],{'$or':_[_0xe8ac('0x2a')](_0x156550,function(_0x7f3445){if(_0x7f3445[_0xe8ac('0x2c')]!==_0xe8ac('0x3a')){var _0x78f1ea={};_0x78f1ea[_0x7f3445[_0xe8ac('0x28')]]={'$like':'%'+_0x4c1d08[_0xe8ac('0x2d')]['filter']+'%'};return _0x78f1ea;}})});}_0x41294e=_['merge']({},_0x41294e,_0x4c1d08[_0xe8ac('0x3b')]);var _0x10a9e8={'where':_0x41294e['where']};return db['MailQueueReport']['count'](_0x10a9e8)[_0xe8ac('0x26')](function(_0x46f291){_0x5d7562[_0xe8ac('0x20')]=_0x46f291;if(_0x4c1d08[_0xe8ac('0x2d')]['includeAll']){_0x41294e[_0xe8ac('0x3c')]=[{'all':!![]}];}return db[_0xe8ac('0x2b')]['findAll'](_0x41294e);})[_0xe8ac('0x26')](function(_0x41bbc2){_0x5d7562[_0xe8ac('0x3d')]=_0x41bbc2;return _0x5d7562;})[_0xe8ac('0x26')](respondWithFilteredResult(_0x1f1e44,_0x41294e))['catch'](handleError(_0x1f1e44,null));};exports['show']=function(_0x4e0f3d,_0x3710f4){var _0x2c2f18={'raw':!![],'where':{'id':_0x4e0f3d[_0xe8ac('0x3e')]['id']}},_0x28a913={};_0x28a913['model']=_['keys'](db[_0xe8ac('0x2b')][_0xe8ac('0x3f')]);_0x28a913[_0xe8ac('0x2d')]=_[_0xe8ac('0x2e')](_0x4e0f3d[_0xe8ac('0x2d')]);_0x28a913[_0xe8ac('0x2f')]=_[_0xe8ac('0x30')](_0x28a913[_0xe8ac('0x31')],_0x28a913[_0xe8ac('0x2d')]);_0x2c2f18[_0xe8ac('0x33')]=_[_0xe8ac('0x30')](_0x28a913[_0xe8ac('0x31')],qs[_0xe8ac('0x32')](_0x4e0f3d[_0xe8ac('0x2d')]['fields']));_0x2c2f18[_0xe8ac('0x33')]=_0x2c2f18['attributes']['length']?_0x2c2f18['attributes']:_0x28a913['model'];if(_0x4e0f3d[_0xe8ac('0x2d')]['includeAll']){_0x2c2f18[_0xe8ac('0x3c')]=[{'all':!![]}];}_0x2c2f18=_['merge']({},_0x2c2f18,_0x4e0f3d[_0xe8ac('0x3b')]);return db[_0xe8ac('0x2b')]['find'](_0x2c2f18)[_0xe8ac('0x26')](handleEntityNotFound(_0x3710f4,null))['then'](respondWithResult(_0x3710f4,null))[_0xe8ac('0x40')](handleError(_0x3710f4,null));};exports[_0xe8ac('0x41')]=function(_0x386aca,_0x5346d8){return db[_0xe8ac('0x2b')][_0xe8ac('0x41')](_0x386aca[_0xe8ac('0x42')],{})['then'](respondWithResult(_0x5346d8,0xc9))[_0xe8ac('0x40')](handleError(_0x5346d8,null));};exports[_0xe8ac('0x25')]=function(_0x2ed574,_0x478a0c){if(_0x2ed574[_0xe8ac('0x42')]['id']){delete _0x2ed574['body']['id'];}return db[_0xe8ac('0x2b')][_0xe8ac('0x43')]({'where':{'id':_0x2ed574[_0xe8ac('0x3e')]['id']}})['then'](handleEntityNotFound(_0x478a0c,null))[_0xe8ac('0x26')](saveUpdates(_0x2ed574[_0xe8ac('0x42')],null))[_0xe8ac('0x26')](respondWithResult(_0x478a0c,null))[_0xe8ac('0x40')](handleError(_0x478a0c,null));};exports[_0xe8ac('0x44')]=function(_0x406eb0,_0x1e7eb5){return db[_0xe8ac('0x2b')][_0xe8ac('0x43')]({'where':{'id':_0x406eb0[_0xe8ac('0x3e')]['id']}})['then'](handleEntityNotFound(_0x1e7eb5,null))[_0xe8ac('0x26')](removeEntity(_0x1e7eb5,null))[_0xe8ac('0x40')](handleError(_0x1e7eb5,null));};exports[_0xe8ac('0x45')]=function(_0x5daa4a,_0xce6848){return db[_0xe8ac('0x2b')][_0xe8ac('0x45')]()[_0xe8ac('0x26')](respondWithResult(_0xce6848,null))[_0xe8ac('0x40')](handleError(_0xce6848,null));}; \ No newline at end of file +var _0x8e3f=['save','update','destroy','then','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','sort','where','filters','pick','merge','filter','options','MailQueueReport','includeAll','include','findAll','catch','show','params','create','body','find','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','undefined','limit','count','offset','set','Content-Range','json','apply','reject'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0x8e3f,0xc1));var _0xf8e3=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x8e3f[_0x4a9fb1];return _0x348672;};'use strict';var emlformat=require(_0xf8e3('0x0'));var rimraf=require(_0xf8e3('0x1'));var zipdir=require(_0xf8e3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf8e3('0x3'));var moment=require(_0xf8e3('0x4'));var BPromise=require(_0xf8e3('0x5'));var Mustache=require('mustache');var util=require(_0xf8e3('0x6'));var path=require(_0xf8e3('0x7'));var sox=require('sox');var csv=require(_0xf8e3('0x8'));var ejs=require(_0xf8e3('0x9'));var fs=require('fs');var fs_extra=require(_0xf8e3('0xa'));var _=require(_0xf8e3('0xb'));var squel=require('squel');var crypto=require(_0xf8e3('0xc'));var jsforce=require(_0xf8e3('0xd'));var deskjs=require(_0xf8e3('0xe'));var toCsv=require(_0xf8e3('0x8'));var querystring=require(_0xf8e3('0xf'));var Papa=require(_0xf8e3('0x10'));var Redis=require(_0xf8e3('0x11'));var authService=require(_0xf8e3('0x12'));var qs=require(_0xf8e3('0x13'));var as=require(_0xf8e3('0x14'));var hardwareService=require(_0xf8e3('0x15'));var logger=require(_0xf8e3('0x16'))('api');var utils=require(_0xf8e3('0x17'));var config=require(_0xf8e3('0x18'));var licenseUtil=require(_0xf8e3('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x40ae02,_0x41f85e){_0x41f85e=_0x41f85e||0xcc;return function(_0x336790){if(_0x336790){return _0x40ae02[_0xf8e3('0x1a')](_0x41f85e);}return _0x40ae02['status'](_0x41f85e)[_0xf8e3('0x1b')]();};}function respondWithResult(_0xa856f5,_0x2fe631){_0x2fe631=_0x2fe631||0xc8;return function(_0x4af736){if(_0x4af736){return _0xa856f5[_0xf8e3('0x1c')](_0x2fe631)['json'](_0x4af736);}};}function respondWithFilteredResult(_0x1ec773,_0x40c196){return function(_0x460629){if(_0x460629){var _0x570ee3=typeof _0x40c196['offset']===_0xf8e3('0x1d')&&typeof _0x40c196[_0xf8e3('0x1e')]===_0xf8e3('0x1d');var _0x3b01ac=_0x460629[_0xf8e3('0x1f')];var _0x11d4cc=_0x570ee3?0x0:_0x40c196[_0xf8e3('0x20')];var _0x2e27e3=_0x570ee3?_0x460629[_0xf8e3('0x1f')]:_0x40c196[_0xf8e3('0x20')]+_0x40c196['limit'];var _0x20cc64;if(_0x2e27e3>=_0x3b01ac){_0x2e27e3=_0x3b01ac;_0x20cc64=0xc8;}else{_0x20cc64=0xce;}_0x1ec773[_0xf8e3('0x1c')](_0x20cc64);return _0x1ec773[_0xf8e3('0x21')](_0xf8e3('0x22'),_0x11d4cc+'-'+_0x2e27e3+'/'+_0x3b01ac)[_0xf8e3('0x23')](_0x460629);}return null;};}function patchUpdates(_0x11c58e){return function(_0x1cae53){try{jsonpatch[_0xf8e3('0x24')](_0x1cae53,_0x11c58e,!![]);}catch(_0x5b99b1){return BPromise[_0xf8e3('0x25')](_0x5b99b1);}return _0x1cae53[_0xf8e3('0x26')]();};}function saveUpdates(_0x3c636d,_0xccbcc0){return function(_0x4a1e5f){if(_0x4a1e5f){return _0x4a1e5f[_0xf8e3('0x27')](_0x3c636d)['then'](function(_0x286059){return _0x286059;});}return null;};}function removeEntity(_0x225a1b,_0x33d526){return function(_0x2dc856){if(_0x2dc856){return _0x2dc856[_0xf8e3('0x28')]()[_0xf8e3('0x29')](function(){_0x225a1b['status'](0xcc)[_0xf8e3('0x1b')]();});}};}function handleEntityNotFound(_0x2fc674,_0x3373ca){return function(_0x417b42){if(!_0x417b42){_0x2fc674[_0xf8e3('0x1a')](0x194);}return _0x417b42;};}function handleError(_0x3b41a1,_0x2963ed){_0x2963ed=_0x2963ed||0x1f4;return function(_0x157a2d){logger['error'](_0x157a2d[_0xf8e3('0x2a')]);if(_0x157a2d[_0xf8e3('0x2b')]){delete _0x157a2d[_0xf8e3('0x2b')];}_0x3b41a1[_0xf8e3('0x1c')](_0x2963ed)[_0xf8e3('0x2c')](_0x157a2d);};}exports[_0xf8e3('0x2d')]=function(_0x16485e,_0xfaf15d){var _0x4f2ae9={},_0x21e1c0={},_0x243e28={'count':0x0,'rows':[]};var _0x492694=_[_0xf8e3('0x2e')](db['MailQueueReport'][_0xf8e3('0x2f')],function(_0x10cf28){return{'name':_0x10cf28[_0xf8e3('0x30')],'type':_0x10cf28[_0xf8e3('0x31')][_0xf8e3('0x32')]};});_0x21e1c0[_0xf8e3('0x33')]=_[_0xf8e3('0x2e')](_0x492694,_0xf8e3('0x2b'));_0x21e1c0['query']=_[_0xf8e3('0x34')](_0x16485e[_0xf8e3('0x35')]);_0x21e1c0['filters']=_['intersection'](_0x21e1c0['model'],_0x21e1c0[_0xf8e3('0x35')]);_0x4f2ae9['attributes']=_[_0xf8e3('0x36')](_0x21e1c0[_0xf8e3('0x33')],qs[_0xf8e3('0x37')](_0x16485e[_0xf8e3('0x35')]['fields']));_0x4f2ae9['attributes']=_0x4f2ae9[_0xf8e3('0x38')][_0xf8e3('0x39')]?_0x4f2ae9[_0xf8e3('0x38')]:_0x21e1c0[_0xf8e3('0x33')];if(!_0x16485e[_0xf8e3('0x35')][_0xf8e3('0x3a')]('nolimit')){_0x4f2ae9[_0xf8e3('0x1e')]=qs['limit'](_0x16485e['query'][_0xf8e3('0x1e')]);_0x4f2ae9[_0xf8e3('0x20')]=qs[_0xf8e3('0x20')](_0x16485e[_0xf8e3('0x35')]['offset']);}_0x4f2ae9['order']=qs[_0xf8e3('0x3b')](_0x16485e[_0xf8e3('0x35')]['sort']);_0x4f2ae9[_0xf8e3('0x3c')]=qs[_0xf8e3('0x3d')](_[_0xf8e3('0x3e')](_0x16485e[_0xf8e3('0x35')],_0x21e1c0['filters']),_0x492694);if(_0x16485e['query']['filter']){_0x4f2ae9[_0xf8e3('0x3c')]=_[_0xf8e3('0x3f')](_0x4f2ae9[_0xf8e3('0x3c')],{'$or':_[_0xf8e3('0x2e')](_0x492694,function(_0x53160a){if(_0x53160a[_0xf8e3('0x31')]!=='VIRTUAL'){var _0x20909b={};_0x20909b[_0x53160a[_0xf8e3('0x2b')]]={'$like':'%'+_0x16485e[_0xf8e3('0x35')][_0xf8e3('0x40')]+'%'};return _0x20909b;}})});}_0x4f2ae9=_[_0xf8e3('0x3f')]({},_0x4f2ae9,_0x16485e[_0xf8e3('0x41')]);var _0x82e778={'where':_0x4f2ae9[_0xf8e3('0x3c')]};return db[_0xf8e3('0x42')]['count'](_0x82e778)[_0xf8e3('0x29')](function(_0x537089){_0x243e28[_0xf8e3('0x1f')]=_0x537089;if(_0x16485e[_0xf8e3('0x35')][_0xf8e3('0x43')]){_0x4f2ae9[_0xf8e3('0x44')]=[{'all':!![]}];}return db[_0xf8e3('0x42')][_0xf8e3('0x45')](_0x4f2ae9);})[_0xf8e3('0x29')](function(_0x2f05b7){_0x243e28['rows']=_0x2f05b7;return _0x243e28;})[_0xf8e3('0x29')](respondWithFilteredResult(_0xfaf15d,_0x4f2ae9))[_0xf8e3('0x46')](handleError(_0xfaf15d,null));};exports[_0xf8e3('0x47')]=function(_0x382dbb,_0x6dd110){var _0xe7fcb9={'raw':!![],'where':{'id':_0x382dbb[_0xf8e3('0x48')]['id']}},_0x792190={};_0x792190['model']=_['keys'](db['MailQueueReport'][_0xf8e3('0x2f')]);_0x792190[_0xf8e3('0x35')]=_['keys'](_0x382dbb[_0xf8e3('0x35')]);_0x792190['filters']=_[_0xf8e3('0x36')](_0x792190[_0xf8e3('0x33')],_0x792190['query']);_0xe7fcb9[_0xf8e3('0x38')]=_['intersection'](_0x792190[_0xf8e3('0x33')],qs[_0xf8e3('0x37')](_0x382dbb['query'][_0xf8e3('0x37')]));_0xe7fcb9[_0xf8e3('0x38')]=_0xe7fcb9[_0xf8e3('0x38')][_0xf8e3('0x39')]?_0xe7fcb9['attributes']:_0x792190['model'];if(_0x382dbb['query'][_0xf8e3('0x43')]){_0xe7fcb9[_0xf8e3('0x44')]=[{'all':!![]}];}_0xe7fcb9=_[_0xf8e3('0x3f')]({},_0xe7fcb9,_0x382dbb['options']);return db[_0xf8e3('0x42')]['find'](_0xe7fcb9)[_0xf8e3('0x29')](handleEntityNotFound(_0x6dd110,null))[_0xf8e3('0x29')](respondWithResult(_0x6dd110,null))['catch'](handleError(_0x6dd110,null));};exports['create']=function(_0x128234,_0x2939e6){return db[_0xf8e3('0x42')][_0xf8e3('0x49')](_0x128234[_0xf8e3('0x4a')],{})[_0xf8e3('0x29')](respondWithResult(_0x2939e6,0xc9))[_0xf8e3('0x46')](handleError(_0x2939e6,null));};exports[_0xf8e3('0x27')]=function(_0xdc2430,_0x81898e){if(_0xdc2430[_0xf8e3('0x4a')]['id']){delete _0xdc2430['body']['id'];}return db[_0xf8e3('0x42')][_0xf8e3('0x4b')]({'where':{'id':_0xdc2430[_0xf8e3('0x48')]['id']}})[_0xf8e3('0x29')](handleEntityNotFound(_0x81898e,null))[_0xf8e3('0x29')](saveUpdates(_0xdc2430[_0xf8e3('0x4a')],null))['then'](respondWithResult(_0x81898e,null))[_0xf8e3('0x46')](handleError(_0x81898e,null));};exports[_0xf8e3('0x28')]=function(_0x39caae,_0x3e60a6){return db[_0xf8e3('0x42')][_0xf8e3('0x4b')]({'where':{'id':_0x39caae['params']['id']}})[_0xf8e3('0x29')](handleEntityNotFound(_0x3e60a6,null))[_0xf8e3('0x29')](removeEntity(_0x3e60a6,null))[_0xf8e3('0x46')](handleError(_0x3e60a6,null));};exports[_0xf8e3('0x4c')]=function(_0x113404,_0x2fef16){return db['MailQueueReport'][_0xf8e3('0x4c')]()[_0xf8e3('0x29')](respondWithResult(_0x2fef16,null))[_0xf8e3('0x46')](handleError(_0x2fef16,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 795c618..d3e99eb 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 _0x3239=['moment','bluebird','request-promise','rimraf','../../config/environment','./mailQueueReport.attributes','exports','define','uniqueid','lodash','util','../../config/logger','api'];(function(_0x4c4bc4,_0x1d84f3){var _0x1d3214=function(_0x5dab05){while(--_0x5dab05){_0x4c4bc4['push'](_0x4c4bc4['shift']());}};_0x1d3214(++_0x1d84f3);}(_0x3239,0xcc));var _0x9323=function(_0x334343,_0x28757f){_0x334343=_0x334343-0x0;var _0x2d920a=_0x3239[_0x334343];return _0x2d920a;};'use strict';var _=require(_0x9323('0x0'));var util=require(_0x9323('0x1'));var logger=require(_0x9323('0x2'))(_0x9323('0x3'));var moment=require(_0x9323('0x4'));var BPromise=require(_0x9323('0x5'));var rp=require(_0x9323('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9323('0x7'));var config=require(_0x9323('0x8'));var attributes=require(_0x9323('0x9'));module[_0x9323('0xa')]=function(_0x40e298,_0x5ede09){return _0x40e298[_0x9323('0xb')]('MailQueueReport',attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':_0x9323('0xc'),'fields':[_0x9323('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd805=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./mailQueueReport.attributes','MailQueueReport','report_mail_queue','uniqueid','util'];(function(_0x43f967,_0xb4b42d){var _0xfd6032=function(_0x37be33){while(--_0x37be33){_0x43f967['push'](_0x43f967['shift']());}};_0xfd6032(++_0xb4b42d);}(_0xd805,0xcb));var _0x5d80=function(_0x3730b1,_0x28a04b){_0x3730b1=_0x3730b1-0x0;var _0x2a75db=_0xd805[_0x3730b1];return _0x2a75db;};'use strict';var _=require('lodash');var util=require(_0x5d80('0x0'));var logger=require(_0x5d80('0x1'))(_0x5d80('0x2'));var moment=require(_0x5d80('0x3'));var BPromise=require('bluebird');var rp=require(_0x5d80('0x4'));var fs=require('fs');var path=require(_0x5d80('0x5'));var rimraf=require(_0x5d80('0x6'));var config=require(_0x5d80('0x7'));var attributes=require(_0x5d80('0x8'));module['exports']=function(_0x4cc8b1,_0x242e87){return _0x4cc8b1['define'](_0x5d80('0x9'),attributes,{'tableName':_0x5d80('0xa'),'paranoid':![],'indexes':[{'name':_0x5d80('0xb'),'fields':[_0x5d80('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 609fe16..20e5ecd 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 _0xadb5=['MailQueueReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateMailQueueReport','create','options','raw','debug','MailQueueReport','body','attributes','limit','UpdateMailQueueReport','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info'];(function(_0x269224,_0x5299cb){var _0x5045ae=function(_0x3a6f77){while(--_0x3a6f77){_0x269224['push'](_0x269224['shift']());}};_0x5045ae(++_0x5299cb);}(_0xadb5,0xad));var _0x5adb=function(_0x1f14f7,_0x590e42){_0x1f14f7=_0x1f14f7-0x0;var _0x12d34d=_0xadb5[_0x1f14f7];return _0x12d34d;};'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']('MailQueueReport,\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);});});}exports[_0x5adb('0x15')]=function(_0x529b65){var _0x3fff62=this;return new Promise(function(_0x5de028,_0x1d9e86){return db['MailQueueReport'][_0x5adb('0x16')](_0x529b65['body'],{'raw':_0x529b65['options']?_0x529b65[_0x5adb('0x17')][_0x5adb('0x18')]===undefined?!![]:![]:!![]})[_0x5adb('0xb')](function(_0x1fd4a7){logger[_0x5adb('0xc')]('CreateMailQueueReport',_0x529b65);logger[_0x5adb('0x19')]('CreateMailQueueReport',_0x529b65,JSON['stringify'](_0x1fd4a7));_0x5de028(_0x1fd4a7);})[_0x5adb('0x14')](function(_0x379b33){logger[_0x5adb('0x10')](_0x5adb('0x15'),_0x379b33[_0x5adb('0x12')],_0x529b65);_0x1d9e86(_0x3fff62[_0x5adb('0x10')](0x1f4,_0x379b33[_0x5adb('0x12')]));});});};exports['UpdateMailQueueReport']=function(_0x4b1957){var _0x373cc3=this;return new Promise(function(_0x3220cd,_0x3839fb){return db[_0x5adb('0x1a')]['update'](_0x4b1957[_0x5adb('0x1b')],{'raw':_0x4b1957[_0x5adb('0x17')]?_0x4b1957['options'][_0x5adb('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4b1957[_0x5adb('0x17')]?_0x4b1957[_0x5adb('0x17')]['where']||null:null,'attributes':_0x4b1957[_0x5adb('0x17')]?_0x4b1957[_0x5adb('0x17')][_0x5adb('0x1c')]||null:null,'limit':_0x4b1957[_0x5adb('0x17')]?_0x4b1957[_0x5adb('0x17')][_0x5adb('0x1d')]||null:null})['then'](function(_0x49992e){logger['info'](_0x5adb('0x1e'),_0x4b1957);logger[_0x5adb('0x19')](_0x5adb('0x1e'),_0x4b1957,JSON[_0x5adb('0xf')](_0x49992e));_0x3220cd(_0x49992e);})[_0x5adb('0x14')](function(_0x4de310){logger[_0x5adb('0x10')](_0x5adb('0x1e'),_0x4de310[_0x5adb('0x12')],_0x4b1957);_0x3839fb(_0x373cc3[_0x5adb('0x10')](0x1f4,_0x4de310[_0x5adb('0x12')]));});});}; \ 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(_0x3e49be,_0x32573b){var _0x3c0873=function(_0x4e3d9f){while(--_0x4e3d9f){_0x3e49be['push'](_0x3e49be['shift']());}};_0x3c0873(++_0x32573b);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0xc4aa[_0x32f7d7];return _0x133d09;};'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 a2d6fea..b7d77d0 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(_0x451d28,_0x1bca56){var _0x3a4497=function(_0x30bdb5){while(--_0x30bdb5){_0x451d28['push'](_0x451d28['shift']());}};_0x3a4497(++_0x1bca56);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0xa9e0[_0x1b349a];return _0x5d1f7c;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0x9c44,0x178));var _0x49c4=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x9c44[_0xfae23b];return _0x200640;};'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/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 33f2507..1ca7422 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 _0x2124=['INTEGER','INBOX','sequelize','STRING','BOOLEAN'];(function(_0x8b6e83,_0x2cabd6){var _0x21ecd5=function(_0x5c063d){while(--_0x5c063d){_0x8b6e83['push'](_0x8b6e83['shift']());}};_0x21ecd5(++_0x2cabd6);}(_0x2124,0x151));var _0x4212=function(_0x25e401,_0x137231){_0x25e401=_0x25e401-0x0;var _0x2b6ef6=_0x2124[_0x25e401];return _0x2b6ef6;};'use strict';var Sequelize=require(_0x4212('0x0'));module['exports']={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x4212('0x1')]},'authentication':{'type':Sequelize[_0x4212('0x2')],'defaultValue':!![]},'user':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x4212('0x1')]},'port':{'type':Sequelize[_0x4212('0x3')]},'tls':{'type':Sequelize[_0x4212('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x4212('0x1')],'defaultValue':_0x4212('0x4')},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x4212('0x3')],'defaultValue':0x5},'service':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x51f4=['exports','STRING','INTEGER','BOOLEAN','INBOX','sequelize'];(function(_0x305875,_0x21022c){var _0x7e987=function(_0x1fce03){while(--_0x1fce03){_0x305875['push'](_0x305875['shift']());}};_0x7e987(++_0x21022c);}(_0x51f4,0x10d));var _0x451f=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x51f4[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x451f('0x0'));module[_0x451f('0x1')]={'description':{'type':Sequelize[_0x451f('0x2')]},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'user':{'type':Sequelize[_0x451f('0x2')]},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x451f('0x3')]},'tls':{'type':Sequelize[_0x451f('0x4')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x451f('0x2')],'defaultValue':_0x451f('0x5')},'connTimeout':{'type':Sequelize[_0x451f('0x3')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x451f('0x3')],'defaultValue':0x5},'service':{'type':Sequelize[_0x451f('0x2')]},'modernAuthentication':{'type':Sequelize[_0x451f('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 067370f..c25af69 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 _0x0cfe=['rimraf','../../config/environment','exports','define','MailServerIn','mail_servers_in','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x4b3007,_0x11ce76){var _0x4ae5f0=function(_0x5ed2d7){while(--_0x5ed2d7){_0x4b3007['push'](_0x4b3007['shift']());}};_0x4ae5f0(++_0x11ce76);}(_0x0cfe,0x124));var _0xe0cf=function(_0x2ccea9,_0x4a7395){_0x2ccea9=_0x2ccea9-0x0;var _0x4a9cdc=_0x0cfe[_0x2ccea9];return _0x4a9cdc;};'use strict';var _=require(_0xe0cf('0x0'));var util=require(_0xe0cf('0x1'));var logger=require(_0xe0cf('0x2'))(_0xe0cf('0x3'));var moment=require(_0xe0cf('0x4'));var BPromise=require(_0xe0cf('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe0cf('0x6'));var rimraf=require(_0xe0cf('0x7'));var config=require(_0xe0cf('0x8'));var attributes=require('./mailServerIn.attributes');module[_0xe0cf('0x9')]=function(_0x40ed8f,_0xf92f36){return _0x40ed8f[_0xe0cf('0xa')](_0xe0cf('0xb'),attributes,{'tableName':_0xe0cf('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xda6e=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./mailServerIn.attributes','define','mail_servers_in'];(function(_0xf65df5,_0x4f8a9f){var _0x90fac=function(_0x568b4c){while(--_0x568b4c){_0xf65df5['push'](_0xf65df5['shift']());}};_0x90fac(++_0x4f8a9f);}(_0xda6e,0x118));var _0xeda6=function(_0x3594bb,_0x2758c4){_0x3594bb=_0x3594bb-0x0;var _0x783930=_0xda6e[_0x3594bb];return _0x783930;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xeda6('0x0'))(_0xeda6('0x1'));var moment=require(_0xeda6('0x2'));var BPromise=require(_0xeda6('0x3'));var rp=require(_0xeda6('0x4'));var fs=require('fs');var path=require(_0xeda6('0x5'));var rimraf=require('rimraf');var config=require(_0xeda6('0x6'));var attributes=require(_0xeda6('0x7'));module['exports']=function(_0x341472,_0x5c3f7b){return _0x341472[_0xeda6('0x8')]('MailServerIn',attributes,{'tableName':_0xeda6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.rpc.js b/server/api/mailServerIn/mailServerIn.rpc.js index 5458e7b..c63d88e 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 _0x4860=['map','then','GetMailServerIn','stringify','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','info','MailServerIn,\x20%s,\x20%s','debug','error','code','message','request\x20sent','result','catch','MailServerIn','findAll','options','raw','limit','include','model','attributes'];(function(_0x58a242,_0x803cc6){var _0x375e32=function(_0x72a7d5){while(--_0x72a7d5){_0x58a242['push'](_0x58a242['shift']());}};_0x375e32(++_0x803cc6);}(_0x4860,0x197));var _0x0486=function(_0x6ea54c,_0x37e62e){_0x6ea54c=_0x6ea54c-0x0;var _0x50c588=_0x4860[_0x6ea54c];return _0x50c588;};'use strict';var _=require(_0x0486('0x0'));var util=require(_0x0486('0x1'));var moment=require(_0x0486('0x2'));var BPromise=require('bluebird');var rs=require(_0x0486('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0486('0x4'))['db'];var utils=require(_0x0486('0x5'));var logger=require('../../config/logger')(_0x0486('0x6'));var config=require(_0x0486('0x7'));var jayson=require(_0x0486('0x8'));var client=jayson['client'][_0x0486('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x147b1b,_0x550286,_0x3ceb75){return new BPromise(function(_0x61918a,_0x8ff7c7){return client['request'](_0x147b1b,_0x3ceb75)['then'](function(_0x14f579){logger[_0x0486('0xa')](_0x0486('0xb'),_0x550286,'request\x20sent');logger[_0x0486('0xc')]('MailServerIn,\x20%s,\x20%s,\x20%s',_0x550286,'request\x20sent',JSON['stringify'](_0x14f579));if(_0x14f579['error']){if(_0x14f579[_0x0486('0xd')][_0x0486('0xe')]===0x1f4){logger[_0x0486('0xd')](_0x0486('0xb'),_0x550286,_0x14f579[_0x0486('0xd')][_0x0486('0xf')]);return _0x8ff7c7(_0x14f579[_0x0486('0xd')]['message']);}logger['error']('MailServerIn,\x20%s,\x20%s',_0x550286,_0x14f579[_0x0486('0xd')][_0x0486('0xf')]);return _0x61918a(_0x14f579[_0x0486('0xd')]['message']);}else{logger['info']('MailServerIn,\x20%s,\x20%s',_0x550286,_0x0486('0x10'));_0x61918a(_0x14f579[_0x0486('0x11')][_0x0486('0xf')]);}})[_0x0486('0x12')](function(_0x285675){logger[_0x0486('0xd')](_0x0486('0xb'),_0x550286,_0x285675);_0x8ff7c7(_0x285675);});});}exports['GetMailServerIn']=function(_0x1c1206){var _0xe362ee=this;return new Promise(function(_0x2129ba,_0x178764){return db[_0x0486('0x13')][_0x0486('0x14')]({'raw':_0x1c1206[_0x0486('0x15')]?_0x1c1206['options'][_0x0486('0x16')]===undefined?!![]:![]:!![],'where':_0x1c1206['options']?_0x1c1206[_0x0486('0x15')]['where']||null:null,'attributes':_0x1c1206[_0x0486('0x15')]?_0x1c1206[_0x0486('0x15')]['attributes']||null:null,'limit':_0x1c1206[_0x0486('0x15')]?_0x1c1206[_0x0486('0x15')][_0x0486('0x17')]||null:null,'include':_0x1c1206[_0x0486('0x15')]?_0x1c1206['options'][_0x0486('0x18')]?_['map'](_0x1c1206[_0x0486('0x15')][_0x0486('0x18')],function(_0x1acfc1){return{'model':db[_0x1acfc1[_0x0486('0x19')]],'as':_0x1acfc1['as'],'attributes':_0x1acfc1[_0x0486('0x1a')],'include':_0x1acfc1[_0x0486('0x18')]?_[_0x0486('0x1b')](_0x1acfc1[_0x0486('0x18')],function(_0x3e0356){return{'model':db[_0x3e0356[_0x0486('0x19')]],'as':_0x3e0356['as'],'attributes':_0x3e0356[_0x0486('0x1a')],'include':_0x3e0356[_0x0486('0x18')]?_['map'](_0x3e0356['include'],function(_0x2e32e4){return{'model':db[_0x2e32e4[_0x0486('0x19')]],'as':_0x2e32e4['as'],'attributes':_0x2e32e4[_0x0486('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x0486('0x1c')](function(_0x3f454d){logger[_0x0486('0xa')](_0x0486('0x1d'),_0x1c1206);logger[_0x0486('0xc')]('GetMailServerIn',_0x1c1206,JSON[_0x0486('0x1e')](_0x3f454d));_0x2129ba(_0x3f454d);})[_0x0486('0x12')](function(_0x39de52){logger[_0x0486('0xd')]('GetMailServerIn',_0x39de52[_0x0486('0xf')],_0x1c1206);_0x178764(_0xe362ee[_0x0486('0xd')](0x1f4,_0x39de52[_0x0486('0xf')]));});});}; \ No newline at end of file +var _0x3140=['include','map','model','then','GetMailServerIn','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','MailServerIn,\x20%s,\x20%s','message','catch','MailServerIn','findAll','options','where','attributes','limit'];(function(_0x53f0fd,_0x48fa41){var _0x416a85=function(_0x37b2c2){while(--_0x37b2c2){_0x53f0fd['push'](_0x53f0fd['shift']());}};_0x416a85(++_0x48fa41);}(_0x3140,0xaf));var _0x0314=function(_0x56d1b7,_0x1d88f5){_0x56d1b7=_0x56d1b7-0x0;var _0x184d91=_0x3140[_0x56d1b7];return _0x184d91;};'use strict';var _=require(_0x0314('0x0'));var util=require(_0x0314('0x1'));var moment=require(_0x0314('0x2'));var BPromise=require(_0x0314('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0314('0x4'))['db'];var utils=require(_0x0314('0x5'));var logger=require(_0x0314('0x6'))(_0x0314('0x7'));var config=require(_0x0314('0x8'));var jayson=require(_0x0314('0x9'));var client=jayson[_0x0314('0xa')][_0x0314('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x11ee94,_0x44762d,_0x176944){return new BPromise(function(_0x495b27,_0x26031f){return client[_0x0314('0xc')](_0x11ee94,_0x176944)['then'](function(_0x5e9bca){logger[_0x0314('0xd')]('MailServerIn,\x20%s,\x20%s',_0x44762d,_0x0314('0xe'));logger[_0x0314('0xf')](_0x0314('0x10'),_0x44762d,_0x0314('0xe'),JSON[_0x0314('0x11')](_0x5e9bca));if(_0x5e9bca[_0x0314('0x12')]){if(_0x5e9bca['error'][_0x0314('0x13')]===0x1f4){logger[_0x0314('0x12')](_0x0314('0x14'),_0x44762d,_0x5e9bca[_0x0314('0x12')][_0x0314('0x15')]);return _0x26031f(_0x5e9bca[_0x0314('0x12')][_0x0314('0x15')]);}logger['error'](_0x0314('0x14'),_0x44762d,_0x5e9bca[_0x0314('0x12')][_0x0314('0x15')]);return _0x495b27(_0x5e9bca[_0x0314('0x12')][_0x0314('0x15')]);}else{logger[_0x0314('0xd')](_0x0314('0x14'),_0x44762d,_0x0314('0xe'));_0x495b27(_0x5e9bca['result'][_0x0314('0x15')]);}})[_0x0314('0x16')](function(_0x1f23c6){logger['error'](_0x0314('0x14'),_0x44762d,_0x1f23c6);_0x26031f(_0x1f23c6);});});}exports['GetMailServerIn']=function(_0x575b68){var _0x39db0b=this;return new Promise(function(_0x329679,_0x583d39){return db[_0x0314('0x17')][_0x0314('0x18')]({'raw':_0x575b68['options']?_0x575b68[_0x0314('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x575b68[_0x0314('0x19')]?_0x575b68[_0x0314('0x19')][_0x0314('0x1a')]||null:null,'attributes':_0x575b68[_0x0314('0x19')]?_0x575b68[_0x0314('0x19')][_0x0314('0x1b')]||null:null,'limit':_0x575b68['options']?_0x575b68['options'][_0x0314('0x1c')]||null:null,'include':_0x575b68[_0x0314('0x19')]?_0x575b68[_0x0314('0x19')][_0x0314('0x1d')]?_[_0x0314('0x1e')](_0x575b68[_0x0314('0x19')]['include'],function(_0x3c743e){return{'model':db[_0x3c743e[_0x0314('0x1f')]],'as':_0x3c743e['as'],'attributes':_0x3c743e['attributes'],'include':_0x3c743e[_0x0314('0x1d')]?_[_0x0314('0x1e')](_0x3c743e[_0x0314('0x1d')],function(_0x26c6a4){return{'model':db[_0x26c6a4[_0x0314('0x1f')]],'as':_0x26c6a4['as'],'attributes':_0x26c6a4[_0x0314('0x1b')],'include':_0x26c6a4['include']?_[_0x0314('0x1e')](_0x26c6a4[_0x0314('0x1d')],function(_0x2d636b){return{'model':db[_0x2d636b['model']],'as':_0x2d636b['as'],'attributes':_0x2d636b[_0x0314('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0314('0x20')](function(_0x47c102){logger['info'](_0x0314('0x21'),_0x575b68);logger[_0x0314('0xf')]('GetMailServerIn',_0x575b68,JSON[_0x0314('0x11')](_0x47c102));_0x329679(_0x47c102);})[_0x0314('0x16')](function(_0x5291c2){logger['error'](_0x0314('0x21'),_0x5291c2[_0x0314('0x15')],_0x575b68);_0x583d39(_0x39db0b['error'](0x1f4,_0x5291c2[_0x0314('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 74b1768..5fdadb1 100644 --- a/server/api/mailServerOut/index.js +++ b/server/api/mailServerOut/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get'];(function(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0x7a54,0x106));var _0x47a5=function(_0x5de0a0,_0x46e53b){_0x5de0a0=_0x5de0a0-0x0;var _0x2ded44=_0x7a54[_0x5de0a0];return _0x2ded44;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file +var _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailServerOut.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0xae7c2f,_0xf31e04){var _0x5d7001=function(_0x4eeadb){while(--_0x4eeadb){_0xae7c2f['push'](_0xae7c2f['shift']());}};_0x5d7001(++_0xf31e04);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index 8ea26c9..43fe12c 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 _0xbaf0=['INTEGER','BOOLEAN','exports','STRING'];(function(_0x398acc,_0x21f70b){var _0x6a9478=function(_0x57591d){while(--_0x57591d){_0x398acc['push'](_0x398acc['shift']());}};_0x6a9478(++_0x21f70b);}(_0xbaf0,0x12a));var _0x0baf=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xbaf0[_0x432682];return _0x463d05;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'description':{'type':Sequelize[_0x0baf('0x1')]},'host':{'type':Sequelize[_0x0baf('0x1')]},'user':{'type':Sequelize[_0x0baf('0x1')]},'pass':{'type':Sequelize[_0x0baf('0x1')]},'port':{'type':Sequelize[_0x0baf('0x2')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize[_0x0baf('0x1')]},'authentication':{'type':Sequelize[_0x0baf('0x3')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x0baf('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xe2cf=['BOOLEAN','exports','STRING','INTEGER'];(function(_0x15ceb9,_0x3bd34c){var _0x145606=function(_0x2bf411){while(--_0x2bf411){_0x15ceb9['push'](_0x15ceb9['shift']());}};_0x145606(++_0x3bd34c);}(_0xe2cf,0x1a1));var _0xfe2c=function(_0xe3bb46,_0x4ba544){_0xe3bb46=_0xe3bb46-0x0;var _0x45001c=_0xe2cf[_0xe3bb46];return _0x45001c;};'use strict';var Sequelize=require('sequelize');module[_0xfe2c('0x0')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xfe2c('0x1')]},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize[_0xfe2c('0x1')]},'port':{'type':Sequelize[_0xfe2c('0x2')]},'secure':{'type':Sequelize[_0xfe2c('0x3')],'defaultValue':![]},'service':{'type':Sequelize[_0xfe2c('0x1')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0xfe2c('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 2656d17..efb9fb5 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 _0x37c9=['../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','MailServerOut','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','findAll','rows','catch','show','params','keys','include','create','body','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x33589,_0x35d1d3){var _0x455465=function(_0x16ee6b){while(--_0x16ee6b){_0x33589['push'](_0x33589['shift']());}};_0x455465(++_0x35d1d3);}(_0x37c9,0xc7));var _0x937c=function(_0x598004,_0x1bbc94){_0x598004=_0x598004-0x0;var _0x2d2f41=_0x37c9[_0x598004];return _0x2d2f41;};'use strict';var emlformat=require(_0x937c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x937c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x937c('0x2'));var moment=require(_0x937c('0x3'));var BPromise=require(_0x937c('0x4'));var Mustache=require(_0x937c('0x5'));var util=require(_0x937c('0x6'));var path=require('path');var sox=require(_0x937c('0x7'));var csv=require('to-csv');var ejs=require(_0x937c('0x8'));var fs=require('fs');var fs_extra=require(_0x937c('0x9'));var _=require(_0x937c('0xa'));var squel=require(_0x937c('0xb'));var crypto=require(_0x937c('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x937c('0xd'));var toCsv=require('to-csv');var querystring=require(_0x937c('0xe'));var Papa=require('papaparse');var Redis=require(_0x937c('0xf'));var authService=require(_0x937c('0x10'));var qs=require(_0x937c('0x11'));var as=require(_0x937c('0x12'));var hardwareService=require(_0x937c('0x13'));var logger=require(_0x937c('0x14'))('api');var utils=require(_0x937c('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x937c('0x16'));var db=require(_0x937c('0x17'))['db'];function respondWithStatusCode(_0x3f8ddc,_0x91d8d9){_0x91d8d9=_0x91d8d9||0xcc;return function(_0x233bc8){if(_0x233bc8){return _0x3f8ddc[_0x937c('0x18')](_0x91d8d9);}return _0x3f8ddc[_0x937c('0x19')](_0x91d8d9)['end']();};}function respondWithResult(_0x5e16e9,_0x6282c1){_0x6282c1=_0x6282c1||0xc8;return function(_0x350a18){if(_0x350a18){return _0x5e16e9[_0x937c('0x19')](_0x6282c1)[_0x937c('0x1a')](_0x350a18);}};}function respondWithFilteredResult(_0x185d9d,_0x5e5802){return function(_0x80489e){if(_0x80489e){var _0x266a02=typeof _0x5e5802[_0x937c('0x1b')]===_0x937c('0x1c')&&typeof _0x5e5802[_0x937c('0x1d')]===_0x937c('0x1c');var _0x258d91=_0x80489e[_0x937c('0x1e')];var _0x333201=_0x266a02?0x0:_0x5e5802[_0x937c('0x1b')];var _0x4206a6=_0x266a02?_0x80489e[_0x937c('0x1e')]:_0x5e5802[_0x937c('0x1b')]+_0x5e5802[_0x937c('0x1d')];var _0x5b5f77;if(_0x4206a6>=_0x258d91){_0x4206a6=_0x258d91;_0x5b5f77=0xc8;}else{_0x5b5f77=0xce;}_0x185d9d['status'](_0x5b5f77);return _0x185d9d[_0x937c('0x1f')](_0x937c('0x20'),_0x333201+'-'+_0x4206a6+'/'+_0x258d91)[_0x937c('0x1a')](_0x80489e);}return null;};}function patchUpdates(_0x4452e1){return function(_0x258877){try{jsonpatch['apply'](_0x258877,_0x4452e1,!![]);}catch(_0x1f9122){return BPromise[_0x937c('0x21')](_0x1f9122);}return _0x258877[_0x937c('0x22')]();};}function saveUpdates(_0xfddf65,_0x1cec70){return function(_0x319db3){if(_0x319db3){return _0x319db3[_0x937c('0x23')](_0xfddf65)[_0x937c('0x24')](function(_0x234b33){return _0x234b33;});}return null;};}function removeEntity(_0x514351,_0x243f84){return function(_0xd05080){if(_0xd05080){return _0xd05080[_0x937c('0x25')]()[_0x937c('0x24')](function(){_0x514351[_0x937c('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x46f99d,_0x4fe5f8){return function(_0x4d1123){if(!_0x4d1123){_0x46f99d['sendStatus'](0x194);}return _0x4d1123;};}function handleError(_0x8d152d,_0x1d1c25){_0x1d1c25=_0x1d1c25||0x1f4;return function(_0x5d5bc4){logger[_0x937c('0x26')](_0x5d5bc4[_0x937c('0x27')]);if(_0x5d5bc4[_0x937c('0x28')]){delete _0x5d5bc4[_0x937c('0x28')];}_0x8d152d[_0x937c('0x19')](_0x1d1c25)[_0x937c('0x29')](_0x5d5bc4);};}exports[_0x937c('0x2a')]=function(_0x570c2b,_0x3c2268){var _0x433dba={},_0x4ddb9b={},_0x5d43fc={'count':0x0,'rows':[]};var _0x1a9c80=_['map'](db[_0x937c('0x2b')][_0x937c('0x2c')],function(_0x330424){return{'name':_0x330424[_0x937c('0x2d')],'type':_0x330424[_0x937c('0x2e')][_0x937c('0x2f')]};});_0x4ddb9b[_0x937c('0x30')]=_[_0x937c('0x31')](_0x1a9c80,_0x937c('0x28'));_0x4ddb9b['query']=_['keys'](_0x570c2b[_0x937c('0x32')]);_0x4ddb9b[_0x937c('0x33')]=_[_0x937c('0x34')](_0x4ddb9b[_0x937c('0x30')],_0x4ddb9b[_0x937c('0x32')]);_0x433dba[_0x937c('0x35')]=_[_0x937c('0x34')](_0x4ddb9b[_0x937c('0x30')],qs[_0x937c('0x36')](_0x570c2b[_0x937c('0x32')]['fields']));_0x433dba[_0x937c('0x35')]=_0x433dba[_0x937c('0x35')][_0x937c('0x37')]?_0x433dba[_0x937c('0x35')]:_0x4ddb9b[_0x937c('0x30')];if(!_0x570c2b[_0x937c('0x32')]['hasOwnProperty'](_0x937c('0x38'))){_0x433dba[_0x937c('0x1d')]=qs['limit'](_0x570c2b[_0x937c('0x32')]['limit']);_0x433dba['offset']=qs[_0x937c('0x1b')](_0x570c2b['query'][_0x937c('0x1b')]);}_0x433dba[_0x937c('0x39')]=qs[_0x937c('0x3a')](_0x570c2b[_0x937c('0x32')][_0x937c('0x3a')]);_0x433dba[_0x937c('0x3b')]=qs[_0x937c('0x33')](_['pick'](_0x570c2b[_0x937c('0x32')],_0x4ddb9b[_0x937c('0x33')]),_0x1a9c80);if(_0x570c2b[_0x937c('0x32')][_0x937c('0x3c')]){_0x433dba['where']=_[_0x937c('0x3d')](_0x433dba[_0x937c('0x3b')],{'$or':_[_0x937c('0x31')](_0x1a9c80,function(_0x428edc){if(_0x428edc[_0x937c('0x2e')]!==_0x937c('0x3e')){var _0x4b0c1a={};_0x4b0c1a[_0x428edc[_0x937c('0x28')]]={'$like':'%'+_0x570c2b[_0x937c('0x32')][_0x937c('0x3c')]+'%'};return _0x4b0c1a;}})});}_0x433dba=_[_0x937c('0x3d')]({},_0x433dba,_0x570c2b[_0x937c('0x3f')]);var _0x1e6c1a={'where':_0x433dba[_0x937c('0x3b')]};return db[_0x937c('0x2b')][_0x937c('0x1e')](_0x1e6c1a)[_0x937c('0x24')](function(_0x3472d5){_0x5d43fc[_0x937c('0x1e')]=_0x3472d5;if(_0x570c2b[_0x937c('0x32')]['includeAll']){_0x433dba['include']=[{'all':!![]}];}return db[_0x937c('0x2b')][_0x937c('0x40')](_0x433dba);})[_0x937c('0x24')](function(_0x39595d){_0x5d43fc[_0x937c('0x41')]=_0x39595d;return _0x5d43fc;})[_0x937c('0x24')](respondWithFilteredResult(_0x3c2268,_0x433dba))[_0x937c('0x42')](handleError(_0x3c2268,null));};exports[_0x937c('0x43')]=function(_0xee26ba,_0x1fa9ef){var _0xf6b0d8={'raw':!![],'where':{'id':_0xee26ba[_0x937c('0x44')]['id']}},_0x54c181={};_0x54c181[_0x937c('0x30')]=_['keys'](db[_0x937c('0x2b')][_0x937c('0x2c')]);_0x54c181[_0x937c('0x32')]=_[_0x937c('0x45')](_0xee26ba[_0x937c('0x32')]);_0x54c181[_0x937c('0x33')]=_[_0x937c('0x34')](_0x54c181[_0x937c('0x30')],_0x54c181['query']);_0xf6b0d8[_0x937c('0x35')]=_[_0x937c('0x34')](_0x54c181[_0x937c('0x30')],qs[_0x937c('0x36')](_0xee26ba[_0x937c('0x32')][_0x937c('0x36')]));_0xf6b0d8[_0x937c('0x35')]=_0xf6b0d8[_0x937c('0x35')]['length']?_0xf6b0d8[_0x937c('0x35')]:_0x54c181[_0x937c('0x30')];if(_0xee26ba[_0x937c('0x32')]['includeAll']){_0xf6b0d8[_0x937c('0x46')]=[{'all':!![]}];}_0xf6b0d8=_[_0x937c('0x3d')]({},_0xf6b0d8,_0xee26ba[_0x937c('0x3f')]);return db[_0x937c('0x2b')]['find'](_0xf6b0d8)['then'](handleEntityNotFound(_0x1fa9ef,null))[_0x937c('0x24')](respondWithResult(_0x1fa9ef,null))[_0x937c('0x42')](handleError(_0x1fa9ef,null));};exports[_0x937c('0x47')]=function(_0x19e3c0,_0x4ead0d){return db['MailServerOut']['create'](_0x19e3c0[_0x937c('0x48')],{})[_0x937c('0x24')](respondWithResult(_0x4ead0d,0xc9))[_0x937c('0x42')](handleError(_0x4ead0d,null));};exports[_0x937c('0x23')]=function(_0x5afcee,_0x41157a){if(_0x5afcee[_0x937c('0x48')]['id']){delete _0x5afcee['body']['id'];}return db[_0x937c('0x2b')]['find']({'where':{'id':_0x5afcee['params']['id']}})[_0x937c('0x24')](handleEntityNotFound(_0x41157a,null))['then'](saveUpdates(_0x5afcee[_0x937c('0x48')],null))[_0x937c('0x24')](respondWithResult(_0x41157a,null))[_0x937c('0x42')](handleError(_0x41157a,null));};exports['destroy']=function(_0x12985e,_0x9c9867){return db[_0x937c('0x2b')]['find']({'where':{'id':_0x12985e[_0x937c('0x44')]['id']}})[_0x937c('0x24')](handleEntityNotFound(_0x9c9867,null))[_0x937c('0x24')](removeEntity(_0x9c9867,null))[_0x937c('0x42')](handleError(_0x9c9867,null));}; \ No newline at end of file +var _0x6671=['request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','destroy','then','error','stack','name','send','index','map','MailServerOut','fieldName','type','key','filters','intersection','query','attributes','model','fields','hasOwnProperty','nolimit','order','sort','filter','where','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','length','merge','options','find','create','body','zip-dir'];(function(_0xc3450e,_0x214a1f){var _0x195fc9=function(_0x2116e9){while(--_0x2116e9){_0xc3450e['push'](_0xc3450e['shift']());}};_0x195fc9(++_0x214a1f);}(_0x6671,0x1bb));var _0x1667=function(_0x5b2568,_0x186e15){_0x5b2568=_0x5b2568-0x0;var _0xa533a9=_0x6671[_0x5b2568];return _0xa533a9;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1667('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1667('0x1'));var moment=require(_0x1667('0x2'));var BPromise=require(_0x1667('0x3'));var Mustache=require(_0x1667('0x4'));var util=require(_0x1667('0x5'));var path=require(_0x1667('0x6'));var sox=require(_0x1667('0x7'));var csv=require(_0x1667('0x8'));var ejs=require(_0x1667('0x9'));var fs=require('fs');var fs_extra=require(_0x1667('0xa'));var _=require('lodash');var squel=require(_0x1667('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x1667('0xc'));var toCsv=require(_0x1667('0x8'));var querystring=require(_0x1667('0xd'));var Papa=require(_0x1667('0xe'));var Redis=require(_0x1667('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x1667('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x1667('0x11'))(_0x1667('0x12'));var utils=require('../../config/utils');var config=require(_0x1667('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x1667('0x14'))['db'];function respondWithStatusCode(_0x5c0be3,_0x39d3fb){_0x39d3fb=_0x39d3fb||0xcc;return function(_0x59d403){if(_0x59d403){return _0x5c0be3[_0x1667('0x15')](_0x39d3fb);}return _0x5c0be3[_0x1667('0x16')](_0x39d3fb)[_0x1667('0x17')]();};}function respondWithResult(_0x1c8086,_0x4291d9){_0x4291d9=_0x4291d9||0xc8;return function(_0x47761d){if(_0x47761d){return _0x1c8086[_0x1667('0x16')](_0x4291d9)['json'](_0x47761d);}};}function respondWithFilteredResult(_0x3c30eb,_0x5cd61c){return function(_0x4bd2b8){if(_0x4bd2b8){var _0x44c9a7=typeof _0x5cd61c[_0x1667('0x18')]===_0x1667('0x19')&&typeof _0x5cd61c[_0x1667('0x1a')]===_0x1667('0x19');var _0x165491=_0x4bd2b8[_0x1667('0x1b')];var _0x35e52a=_0x44c9a7?0x0:_0x5cd61c[_0x1667('0x18')];var _0x2ab251=_0x44c9a7?_0x4bd2b8[_0x1667('0x1b')]:_0x5cd61c[_0x1667('0x18')]+_0x5cd61c['limit'];var _0x59ed91;if(_0x2ab251>=_0x165491){_0x2ab251=_0x165491;_0x59ed91=0xc8;}else{_0x59ed91=0xce;}_0x3c30eb['status'](_0x59ed91);return _0x3c30eb[_0x1667('0x1c')](_0x1667('0x1d'),_0x35e52a+'-'+_0x2ab251+'/'+_0x165491)[_0x1667('0x1e')](_0x4bd2b8);}return null;};}function patchUpdates(_0x5c48ef){return function(_0xab3668){try{jsonpatch[_0x1667('0x1f')](_0xab3668,_0x5c48ef,!![]);}catch(_0x842883){return BPromise[_0x1667('0x20')](_0x842883);}return _0xab3668['save']();};}function saveUpdates(_0x426d19,_0x35138b){return function(_0x45f34b){if(_0x45f34b){return _0x45f34b[_0x1667('0x21')](_0x426d19)['then'](function(_0x2250b1){return _0x2250b1;});}return null;};}function removeEntity(_0x1afb62,_0xb4d74f){return function(_0x54edc9){if(_0x54edc9){return _0x54edc9[_0x1667('0x22')]()[_0x1667('0x23')](function(){_0x1afb62[_0x1667('0x16')](0xcc)[_0x1667('0x17')]();});}};}function handleEntityNotFound(_0x335b32,_0x1922d5){return function(_0x13505e){if(!_0x13505e){_0x335b32[_0x1667('0x15')](0x194);}return _0x13505e;};}function handleError(_0x7f81e3,_0xf20714){_0xf20714=_0xf20714||0x1f4;return function(_0x1b9c92){logger[_0x1667('0x24')](_0x1b9c92[_0x1667('0x25')]);if(_0x1b9c92[_0x1667('0x26')]){delete _0x1b9c92[_0x1667('0x26')];}_0x7f81e3[_0x1667('0x16')](_0xf20714)[_0x1667('0x27')](_0x1b9c92);};}exports[_0x1667('0x28')]=function(_0x15b8a4,_0x36b97f){var _0x4d36e2={},_0x486db1={},_0x571966={'count':0x0,'rows':[]};var _0x268b7a=_[_0x1667('0x29')](db[_0x1667('0x2a')]['rawAttributes'],function(_0x5c73a1){return{'name':_0x5c73a1[_0x1667('0x2b')],'type':_0x5c73a1[_0x1667('0x2c')][_0x1667('0x2d')]};});_0x486db1['model']=_[_0x1667('0x29')](_0x268b7a,_0x1667('0x26'));_0x486db1['query']=_['keys'](_0x15b8a4['query']);_0x486db1[_0x1667('0x2e')]=_[_0x1667('0x2f')](_0x486db1['model'],_0x486db1[_0x1667('0x30')]);_0x4d36e2[_0x1667('0x31')]=_[_0x1667('0x2f')](_0x486db1[_0x1667('0x32')],qs[_0x1667('0x33')](_0x15b8a4[_0x1667('0x30')][_0x1667('0x33')]));_0x4d36e2['attributes']=_0x4d36e2[_0x1667('0x31')]['length']?_0x4d36e2[_0x1667('0x31')]:_0x486db1[_0x1667('0x32')];if(!_0x15b8a4[_0x1667('0x30')][_0x1667('0x34')](_0x1667('0x35'))){_0x4d36e2[_0x1667('0x1a')]=qs[_0x1667('0x1a')](_0x15b8a4['query'][_0x1667('0x1a')]);_0x4d36e2[_0x1667('0x18')]=qs[_0x1667('0x18')](_0x15b8a4[_0x1667('0x30')]['offset']);}_0x4d36e2[_0x1667('0x36')]=qs[_0x1667('0x37')](_0x15b8a4[_0x1667('0x30')][_0x1667('0x37')]);_0x4d36e2['where']=qs['filters'](_['pick'](_0x15b8a4[_0x1667('0x30')],_0x486db1[_0x1667('0x2e')]),_0x268b7a);if(_0x15b8a4[_0x1667('0x30')][_0x1667('0x38')]){_0x4d36e2[_0x1667('0x39')]=_['merge'](_0x4d36e2[_0x1667('0x39')],{'$or':_[_0x1667('0x29')](_0x268b7a,function(_0x2206e3){if(_0x2206e3['type']!==_0x1667('0x3a')){var _0x3b752c={};_0x3b752c[_0x2206e3[_0x1667('0x26')]]={'$like':'%'+_0x15b8a4[_0x1667('0x30')][_0x1667('0x38')]+'%'};return _0x3b752c;}})});}_0x4d36e2=_['merge']({},_0x4d36e2,_0x15b8a4['options']);var _0x3c9201={'where':_0x4d36e2[_0x1667('0x39')]};return db[_0x1667('0x2a')][_0x1667('0x1b')](_0x3c9201)['then'](function(_0x4308cc){_0x571966[_0x1667('0x1b')]=_0x4308cc;if(_0x15b8a4[_0x1667('0x30')][_0x1667('0x3b')]){_0x4d36e2[_0x1667('0x3c')]=[{'all':!![]}];}return db[_0x1667('0x2a')][_0x1667('0x3d')](_0x4d36e2);})[_0x1667('0x23')](function(_0x425717){_0x571966[_0x1667('0x3e')]=_0x425717;return _0x571966;})['then'](respondWithFilteredResult(_0x36b97f,_0x4d36e2))[_0x1667('0x3f')](handleError(_0x36b97f,null));};exports[_0x1667('0x40')]=function(_0x2f4d75,_0x33b86c){var _0x5c4861={'raw':!![],'where':{'id':_0x2f4d75[_0x1667('0x41')]['id']}},_0x515161={};_0x515161['model']=_[_0x1667('0x42')](db[_0x1667('0x2a')][_0x1667('0x43')]);_0x515161[_0x1667('0x30')]=_[_0x1667('0x42')](_0x2f4d75[_0x1667('0x30')]);_0x515161[_0x1667('0x2e')]=_[_0x1667('0x2f')](_0x515161[_0x1667('0x32')],_0x515161[_0x1667('0x30')]);_0x5c4861['attributes']=_[_0x1667('0x2f')](_0x515161['model'],qs[_0x1667('0x33')](_0x2f4d75[_0x1667('0x30')]['fields']));_0x5c4861['attributes']=_0x5c4861['attributes'][_0x1667('0x44')]?_0x5c4861[_0x1667('0x31')]:_0x515161[_0x1667('0x32')];if(_0x2f4d75[_0x1667('0x30')]['includeAll']){_0x5c4861[_0x1667('0x3c')]=[{'all':!![]}];}_0x5c4861=_[_0x1667('0x45')]({},_0x5c4861,_0x2f4d75[_0x1667('0x46')]);return db[_0x1667('0x2a')][_0x1667('0x47')](_0x5c4861)[_0x1667('0x23')](handleEntityNotFound(_0x33b86c,null))['then'](respondWithResult(_0x33b86c,null))['catch'](handleError(_0x33b86c,null));};exports['create']=function(_0x2a64f8,_0x3bb2fa){return db[_0x1667('0x2a')][_0x1667('0x48')](_0x2a64f8[_0x1667('0x49')],{})[_0x1667('0x23')](respondWithResult(_0x3bb2fa,0xc9))[_0x1667('0x3f')](handleError(_0x3bb2fa,null));};exports[_0x1667('0x21')]=function(_0x41813b,_0x1c86c6){if(_0x41813b['body']['id']){delete _0x41813b[_0x1667('0x49')]['id'];}return db[_0x1667('0x2a')][_0x1667('0x47')]({'where':{'id':_0x41813b['params']['id']}})[_0x1667('0x23')](handleEntityNotFound(_0x1c86c6,null))[_0x1667('0x23')](saveUpdates(_0x41813b[_0x1667('0x49')],null))[_0x1667('0x23')](respondWithResult(_0x1c86c6,null))['catch'](handleError(_0x1c86c6,null));};exports[_0x1667('0x22')]=function(_0x3a0cc9,_0x41e821){return db['MailServerOut']['find']({'where':{'id':_0x3a0cc9[_0x1667('0x41')]['id']}})['then'](handleEntityNotFound(_0x41e821,null))[_0x1667('0x23')](removeEntity(_0x41e821,null))[_0x1667('0x3f')](handleError(_0x41e821,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 9ba42bb..70d54ed 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 _0x99d5=['mail_servers_out','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailServerOut.attributes','define'];(function(_0x590b63,_0x14debb){var _0x3c9380=function(_0x58fc67){while(--_0x58fc67){_0x590b63['push'](_0x590b63['shift']());}};_0x3c9380(++_0x14debb);}(_0x99d5,0x1cf));var _0x599d=function(_0x3130cd,_0x23d467){_0x3130cd=_0x3130cd-0x0;var _0x3f658c=_0x99d5[_0x3130cd];return _0x3f658c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x599d('0x0'))(_0x599d('0x1'));var moment=require(_0x599d('0x2'));var BPromise=require(_0x599d('0x3'));var rp=require(_0x599d('0x4'));var fs=require('fs');var path=require(_0x599d('0x5'));var rimraf=require(_0x599d('0x6'));var config=require(_0x599d('0x7'));var attributes=require(_0x599d('0x8'));module['exports']=function(_0x4073f7,_0x18e757){return _0x4073f7[_0x599d('0x9')]('MailServerOut',attributes,{'tableName':_0x599d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1a7f=['../../config/environment','./mailServerOut.attributes','exports','define','mail_servers_out','lodash','api','moment','bluebird','path','rimraf'];(function(_0x30a458,_0x41e4f4){var _0x3220f1=function(_0x524480){while(--_0x524480){_0x30a458['push'](_0x30a458['shift']());}};_0x3220f1(++_0x41e4f4);}(_0x1a7f,0x1bd));var _0xf1a7=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x1a7f[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0xf1a7('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf1a7('0x1'));var moment=require(_0xf1a7('0x2'));var BPromise=require(_0xf1a7('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf1a7('0x4'));var rimraf=require(_0xf1a7('0x5'));var config=require(_0xf1a7('0x6'));var attributes=require(_0xf1a7('0x7'));module[_0xf1a7('0x8')]=function(_0x52a9a4,_0x4429db){return _0x52a9a4[_0xf1a7('0x9')]('MailServerOut',attributes,{'tableName':_0xf1a7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.rpc.js b/server/api/mailServerOut/mailServerOut.rpc.js index b6a9e24..75650ae 100644 --- a/server/api/mailServerOut/mailServerOut.rpc.js +++ b/server/api/mailServerOut/mailServerOut.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','MailServerOut,\x20%s,\x20%s','MailServerOut,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x131e60,_0x5352ce){var _0x4bc497=function(_0x2a758e){while(--_0x2a758e){_0x131e60['push'](_0x131e60['shift']());}};_0x4bc497(++_0x5352ce);}(_0x2ef3,0xba));var _0x32ef=function(_0x78ebdb,_0x2193de){_0x78ebdb=_0x78ebdb-0x0;var _0xa93ce2=_0x2ef3[_0x78ebdb];return _0xa93ce2;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0089,_0x4bfcf8,_0x367c39){return new BPromise(function(_0x2fb8eb,_0x234863){return client[_0x32ef('0xa')](_0x2c0089,_0x367c39)[_0x32ef('0xb')](function(_0x2bbb50){logger[_0x32ef('0xc')](_0x32ef('0xd'),_0x4bfcf8,'request\x20sent');logger['debug'](_0x32ef('0xe'),_0x4bfcf8,_0x32ef('0xf'),JSON[_0x32ef('0x10')](_0x2bbb50));if(_0x2bbb50[_0x32ef('0x11')]){if(_0x2bbb50['error'][_0x32ef('0x12')]===0x1f4){logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x234863(_0x2bbb50[_0x32ef('0x11')]['message']);}logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x2fb8eb(_0x2bbb50[_0x32ef('0x11')][_0x32ef('0x13')]);}else{logger[_0x32ef('0xc')]('MailServerOut,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('MailServerOut,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});} \ No newline at end of file +var _0x2ef3=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','MailServerOut,\x20%s,\x20%s','MailServerOut,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x26439d,_0x19e1ae){var _0xe2adde=function(_0x2edad8){while(--_0x2edad8){_0x26439d['push'](_0x26439d['shift']());}};_0xe2adde(++_0x19e1ae);}(_0x2ef3,0xba));var _0x32ef=function(_0x52af40,_0x415c49){_0x52af40=_0x52af40-0x0;var _0x2d8570=_0x2ef3[_0x52af40];return _0x2d8570;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0089,_0x4bfcf8,_0x367c39){return new BPromise(function(_0x2fb8eb,_0x234863){return client[_0x32ef('0xa')](_0x2c0089,_0x367c39)[_0x32ef('0xb')](function(_0x2bbb50){logger[_0x32ef('0xc')](_0x32ef('0xd'),_0x4bfcf8,'request\x20sent');logger['debug'](_0x32ef('0xe'),_0x4bfcf8,_0x32ef('0xf'),JSON[_0x32ef('0x10')](_0x2bbb50));if(_0x2bbb50[_0x32ef('0x11')]){if(_0x2bbb50['error'][_0x32ef('0x12')]===0x1f4){logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x234863(_0x2bbb50[_0x32ef('0x11')]['message']);}logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x2fb8eb(_0x2bbb50[_0x32ef('0x11')][_0x32ef('0x13')]);}else{logger[_0x32ef('0xc')]('MailServerOut,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('MailServerOut,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 42cb98a..32e2b50 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 _0xdcfe=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','update','delete','destroy','exports'];(function(_0x1a5f94,_0x19b888){var _0x352348=function(_0x16c899){while(--_0x16c899){_0x1a5f94['push'](_0x1a5f94['shift']());}};_0x352348(++_0x19b888);}(_0xdcfe,0x11e));var _0xedcf=function(_0x3bdd38,_0x182678){_0x3bdd38=_0x3bdd38-0x0;var _0x2c9a2e=_0xdcfe[_0x3bdd38];return _0x2c9a2e;};'use strict';var multer=require('multer');var util=require(_0xedcf('0x0'));var path=require(_0xedcf('0x1'));var timeout=require(_0xedcf('0x2'));var express=require(_0xedcf('0x3'));var router=express[_0xedcf('0x4')]();var fs_extra=require(_0xedcf('0x5'));var auth=require(_0xedcf('0x6'));var interaction=require(_0xedcf('0x7'));var config=require(_0xedcf('0x8'));var controller=require(_0xedcf('0x9'));router[_0xedcf('0xa')]('/',auth[_0xedcf('0xb')](),controller['index']);router[_0xedcf('0xa')](_0xedcf('0xc'),auth['isAuthenticated'](),controller[_0xedcf('0xd')]);router['get'](_0xedcf('0xe'),auth[_0xedcf('0xb')](),controller[_0xedcf('0xf')]);router[_0xedcf('0x10')]('/',auth[_0xedcf('0xb')](),controller[_0xedcf('0x11')]);router['put'](_0xedcf('0xe'),auth[_0xedcf('0xb')](),controller[_0xedcf('0x12')]);router[_0xedcf('0x13')]('/:id',auth[_0xedcf('0xb')](),controller[_0xedcf('0x14')]);module[_0xedcf('0x15')]=router; \ No newline at end of file +var _0x72ea=['/:id','update','delete','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','isAuthenticated','index','get','/describe','describe','show','post','create','put'];(function(_0x3bab91,_0x495b57){var _0x4698a0=function(_0x536395){while(--_0x536395){_0x3bab91['push'](_0x3bab91['shift']());}};_0x4698a0(++_0x495b57);}(_0x72ea,0x1a5));var _0xa72e=function(_0x2fc28b,_0x5aabcc){_0x2fc28b=_0x2fc28b-0x0;var _0x107356=_0x72ea[_0x2fc28b];return _0x107356;};'use strict';var multer=require(_0xa72e('0x0'));var util=require(_0xa72e('0x1'));var path=require(_0xa72e('0x2'));var timeout=require(_0xa72e('0x3'));var express=require('express');var router=express[_0xa72e('0x4')]();var fs_extra=require(_0xa72e('0x5'));var auth=require(_0xa72e('0x6'));var interaction=require(_0xa72e('0x7'));var config=require(_0xa72e('0x8'));var controller=require(_0xa72e('0x9'));router['get']('/',auth[_0xa72e('0xa')](),controller[_0xa72e('0xb')]);router[_0xa72e('0xc')](_0xa72e('0xd'),auth[_0xa72e('0xa')](),controller[_0xa72e('0xe')]);router[_0xa72e('0xc')]('/:id',auth[_0xa72e('0xa')](),controller[_0xa72e('0xf')]);router[_0xa72e('0x10')]('/',auth[_0xa72e('0xa')](),controller[_0xa72e('0x11')]);router[_0xa72e('0x12')](_0xa72e('0x13'),auth[_0xa72e('0xa')](),controller[_0xa72e('0x14')]);router[_0xa72e('0x15')](_0xa72e('0x13'),auth[_0xa72e('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index d782702..0adff93 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 _0x8506=['exports','name'];(function(_0x3709cf,_0x49f163){var _0x53c92d=function(_0x9aee44){while(--_0x9aee44){_0x3709cf['push'](_0x3709cf['shift']());}};_0x53c92d(++_0x49f163);}(_0x8506,0xe8));var _0x6850=function(_0x14e4af,_0x3269f5){_0x14e4af=_0x14e4af-0x0;var _0x1412cb=_0x8506[_0x14e4af];return _0x1412cb;};'use strict';var Sequelize=require('sequelize');module[_0x6850('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x6850('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x0295=['sequelize','name'];(function(_0x31bab3,_0x44554f){var _0x4fd382=function(_0x42b336){while(--_0x42b336){_0x31bab3['push'](_0x31bab3['shift']());}};_0x4fd382(++_0x44554f);}(_0x0295,0x1f0));var _0x5029=function(_0xcf2382,_0x1da16e){_0xcf2382=_0xcf2382-0x0;var _0x1ade36=_0x0295[_0xcf2382];return _0x1ade36;};'use strict';var Sequelize=require(_0x5029('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x5029('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 8497fc3..cc8e61e 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 _0xc484=['body','find','params','eml-format','fast-json-patch','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','update','then','destroy','name','send','rawAttributes','fieldName','type','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','MailSubstatus','includeAll','findAll','rows','catch','keys','filters','include','options','create'];(function(_0x1501a3,_0x3d927b){var _0x3c0c79=function(_0x508630){while(--_0x508630){_0x1501a3['push'](_0x1501a3['shift']());}};_0x3c0c79(++_0x3d927b);}(_0xc484,0x10f));var _0x4c48=function(_0x4db46b,_0xadcb1a){_0x4db46b=_0x4db46b-0x0;var _0x565be8=_0xc484[_0x4db46b];return _0x565be8;};'use strict';var emlformat=require(_0x4c48('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x4c48('0x1'));var rp=require('request-promise');var moment=require(_0x4c48('0x2'));var BPromise=require(_0x4c48('0x3'));var Mustache=require('mustache');var util=require(_0x4c48('0x4'));var path=require(_0x4c48('0x5'));var sox=require(_0x4c48('0x6'));var csv=require(_0x4c48('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4c48('0x8'));var _=require(_0x4c48('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4c48('0x7'));var querystring=require(_0x4c48('0xa'));var Papa=require(_0x4c48('0xb'));var Redis=require(_0x4c48('0xc'));var authService=require(_0x4c48('0xd'));var qs=require(_0x4c48('0xe'));var as=require(_0x4c48('0xf'));var hardwareService=require(_0x4c48('0x10'));var logger=require(_0x4c48('0x11'))('api');var utils=require(_0x4c48('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x4c48('0x13'));var db=require(_0x4c48('0x14'))['db'];function respondWithStatusCode(_0x15adc1,_0x576977){_0x576977=_0x576977||0xcc;return function(_0x200676){if(_0x200676){return _0x15adc1['sendStatus'](_0x576977);}return _0x15adc1[_0x4c48('0x15')](_0x576977)[_0x4c48('0x16')]();};}function respondWithResult(_0x3c5d55,_0x576498){_0x576498=_0x576498||0xc8;return function(_0x571295){if(_0x571295){return _0x3c5d55['status'](_0x576498)[_0x4c48('0x17')](_0x571295);}};}function respondWithFilteredResult(_0x2567a2,_0xfa12ad){return function(_0x274a08){if(_0x274a08){var _0x184d12=typeof _0xfa12ad[_0x4c48('0x18')]==='undefined'&&typeof _0xfa12ad['limit']===_0x4c48('0x19');var _0x2e039e=_0x274a08[_0x4c48('0x1a')];var _0x1375b4=_0x184d12?0x0:_0xfa12ad[_0x4c48('0x18')];var _0x2810d3=_0x184d12?_0x274a08[_0x4c48('0x1a')]:_0xfa12ad[_0x4c48('0x18')]+_0xfa12ad[_0x4c48('0x1b')];var _0x4007c2;if(_0x2810d3>=_0x2e039e){_0x2810d3=_0x2e039e;_0x4007c2=0xc8;}else{_0x4007c2=0xce;}_0x2567a2[_0x4c48('0x15')](_0x4007c2);return _0x2567a2[_0x4c48('0x1c')](_0x4c48('0x1d'),_0x1375b4+'-'+_0x2810d3+'/'+_0x2e039e)[_0x4c48('0x17')](_0x274a08);}return null;};}function patchUpdates(_0xac8c70){return function(_0x393e0d){try{jsonpatch[_0x4c48('0x1e')](_0x393e0d,_0xac8c70,!![]);}catch(_0x2f2579){return BPromise['reject'](_0x2f2579);}return _0x393e0d['save']();};}function saveUpdates(_0x2385b6,_0x126675){return function(_0x25e2f3){if(_0x25e2f3){return _0x25e2f3[_0x4c48('0x1f')](_0x2385b6)[_0x4c48('0x20')](function(_0x918b49){return _0x918b49;});}return null;};}function removeEntity(_0x5ae6df,_0x17651d){return function(_0x1e0a0d){if(_0x1e0a0d){return _0x1e0a0d[_0x4c48('0x21')]()[_0x4c48('0x20')](function(){_0x5ae6df['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4aca43,_0x522506){return function(_0x36d14d){if(!_0x36d14d){_0x4aca43['sendStatus'](0x194);}return _0x36d14d;};}function handleError(_0xbadf32,_0x497955){_0x497955=_0x497955||0x1f4;return function(_0x34fbf8){logger['error'](_0x34fbf8['stack']);if(_0x34fbf8[_0x4c48('0x22')]){delete _0x34fbf8[_0x4c48('0x22')];}_0xbadf32[_0x4c48('0x15')](_0x497955)[_0x4c48('0x23')](_0x34fbf8);};}exports['index']=function(_0x145878,_0x3e7cbd){var _0x5c14c3={},_0x37d4e3={},_0x4f2ec4={'count':0x0,'rows':[]};var _0x227c7a=_['map'](db['MailSubstatus'][_0x4c48('0x24')],function(_0x1d256b){return{'name':_0x1d256b[_0x4c48('0x25')],'type':_0x1d256b[_0x4c48('0x26')]['key']};});_0x37d4e3[_0x4c48('0x27')]=_['map'](_0x227c7a,_0x4c48('0x22'));_0x37d4e3['query']=_['keys'](_0x145878[_0x4c48('0x28')]);_0x37d4e3['filters']=_[_0x4c48('0x29')](_0x37d4e3[_0x4c48('0x27')],_0x37d4e3['query']);_0x5c14c3[_0x4c48('0x2a')]=_[_0x4c48('0x29')](_0x37d4e3['model'],qs[_0x4c48('0x2b')](_0x145878[_0x4c48('0x28')][_0x4c48('0x2b')]));_0x5c14c3[_0x4c48('0x2a')]=_0x5c14c3[_0x4c48('0x2a')][_0x4c48('0x2c')]?_0x5c14c3['attributes']:_0x37d4e3['model'];if(!_0x145878['query'][_0x4c48('0x2d')](_0x4c48('0x2e'))){_0x5c14c3[_0x4c48('0x1b')]=qs[_0x4c48('0x1b')](_0x145878[_0x4c48('0x28')]['limit']);_0x5c14c3[_0x4c48('0x18')]=qs[_0x4c48('0x18')](_0x145878['query'][_0x4c48('0x18')]);}_0x5c14c3[_0x4c48('0x2f')]=qs['sort'](_0x145878['query'][_0x4c48('0x30')]);_0x5c14c3[_0x4c48('0x31')]=qs['filters'](_[_0x4c48('0x32')](_0x145878[_0x4c48('0x28')],_0x37d4e3['filters']),_0x227c7a);if(_0x145878[_0x4c48('0x28')][_0x4c48('0x33')]){_0x5c14c3[_0x4c48('0x31')]=_[_0x4c48('0x34')](_0x5c14c3[_0x4c48('0x31')],{'$or':_[_0x4c48('0x35')](_0x227c7a,function(_0x1d645b){if(_0x1d645b[_0x4c48('0x26')]!=='VIRTUAL'){var _0x308229={};_0x308229[_0x1d645b[_0x4c48('0x22')]]={'$like':'%'+_0x145878[_0x4c48('0x28')][_0x4c48('0x33')]+'%'};return _0x308229;}})});}_0x5c14c3=_[_0x4c48('0x34')]({},_0x5c14c3,_0x145878['options']);var _0x484e53={'where':_0x5c14c3[_0x4c48('0x31')]};return db[_0x4c48('0x36')]['count'](_0x484e53)[_0x4c48('0x20')](function(_0x13928d){_0x4f2ec4[_0x4c48('0x1a')]=_0x13928d;if(_0x145878[_0x4c48('0x28')][_0x4c48('0x37')]){_0x5c14c3['include']=[{'all':!![]}];}return db[_0x4c48('0x36')][_0x4c48('0x38')](_0x5c14c3);})[_0x4c48('0x20')](function(_0x3ba9c6){_0x4f2ec4[_0x4c48('0x39')]=_0x3ba9c6;return _0x4f2ec4;})['then'](respondWithFilteredResult(_0x3e7cbd,_0x5c14c3))[_0x4c48('0x3a')](handleError(_0x3e7cbd,null));};exports['show']=function(_0x498269,_0x4d85d8){var _0x386b2b={'raw':!![],'where':{'id':_0x498269['params']['id']}},_0x51ac86={};_0x51ac86[_0x4c48('0x27')]=_[_0x4c48('0x3b')](db[_0x4c48('0x36')]['rawAttributes']);_0x51ac86[_0x4c48('0x28')]=_[_0x4c48('0x3b')](_0x498269['query']);_0x51ac86[_0x4c48('0x3c')]=_[_0x4c48('0x29')](_0x51ac86['model'],_0x51ac86['query']);_0x386b2b[_0x4c48('0x2a')]=_[_0x4c48('0x29')](_0x51ac86['model'],qs[_0x4c48('0x2b')](_0x498269['query']['fields']));_0x386b2b[_0x4c48('0x2a')]=_0x386b2b[_0x4c48('0x2a')][_0x4c48('0x2c')]?_0x386b2b[_0x4c48('0x2a')]:_0x51ac86[_0x4c48('0x27')];if(_0x498269['query'][_0x4c48('0x37')]){_0x386b2b[_0x4c48('0x3d')]=[{'all':!![]}];}_0x386b2b=_[_0x4c48('0x34')]({},_0x386b2b,_0x498269[_0x4c48('0x3e')]);return db['MailSubstatus']['find'](_0x386b2b)[_0x4c48('0x20')](handleEntityNotFound(_0x4d85d8,null))['then'](respondWithResult(_0x4d85d8,null))['catch'](handleError(_0x4d85d8,null));};exports[_0x4c48('0x3f')]=function(_0x31fd0b,_0x4dd29b){return db[_0x4c48('0x36')][_0x4c48('0x3f')](_0x31fd0b[_0x4c48('0x40')],{})[_0x4c48('0x20')](respondWithResult(_0x4dd29b,0xc9))['catch'](handleError(_0x4dd29b,null));};exports[_0x4c48('0x1f')]=function(_0x7e4fea,_0x41b29c){if(_0x7e4fea[_0x4c48('0x40')]['id']){delete _0x7e4fea['body']['id'];}return db[_0x4c48('0x36')][_0x4c48('0x41')]({'where':{'id':_0x7e4fea[_0x4c48('0x42')]['id']}})[_0x4c48('0x20')](handleEntityNotFound(_0x41b29c,null))[_0x4c48('0x20')](saveUpdates(_0x7e4fea[_0x4c48('0x40')],null))[_0x4c48('0x20')](respondWithResult(_0x41b29c,null))[_0x4c48('0x3a')](handleError(_0x41b29c,null));};exports[_0x4c48('0x21')]=function(_0x4c8497,_0x49a2d0){return db[_0x4c48('0x36')][_0x4c48('0x41')]({'where':{'id':_0x4c8497[_0x4c48('0x42')]['id']}})[_0x4c48('0x20')](handleEntityNotFound(_0x49a2d0,null))[_0x4c48('0x20')](removeEntity(_0x49a2d0,null))['catch'](handleError(_0x49a2d0,null));};exports['describe']=function(_0x40fe99,_0x37ab4f){return db[_0x4c48('0x36')]['describe']()[_0x4c48('0x20')](respondWithResult(_0x37ab4f,null))[_0x4c48('0x3a')](handleError(_0x37ab4f,null));}; \ No newline at end of file +var _0x3490=['json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','index','MailSubstatus','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','catch','show','params','rawAttributes','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status'];(function(_0xab4c6c,_0x22ec80){var _0x3219d4=function(_0x26c8f7){while(--_0x26c8f7){_0xab4c6c['push'](_0xab4c6c['shift']());}};_0x3219d4(++_0x22ec80);}(_0x3490,0x83));var _0x0349=function(_0x245c4c,_0x312a5b){_0x245c4c=_0x245c4c-0x0;var _0x2b8e9f=_0x3490[_0x245c4c];return _0x2b8e9f;};'use strict';var emlformat=require(_0x0349('0x0'));var rimraf=require(_0x0349('0x1'));var zipdir=require(_0x0349('0x2'));var jsonpatch=require(_0x0349('0x3'));var rp=require(_0x0349('0x4'));var moment=require(_0x0349('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0349('0x6'));var util=require('util');var path=require(_0x0349('0x7'));var sox=require(_0x0349('0x8'));var csv=require(_0x0349('0x9'));var ejs=require(_0x0349('0xa'));var fs=require('fs');var fs_extra=require(_0x0349('0xb'));var _=require(_0x0349('0xc'));var squel=require('squel');var crypto=require(_0x0349('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x0349('0xe'));var toCsv=require(_0x0349('0x9'));var querystring=require(_0x0349('0xf'));var Papa=require(_0x0349('0x10'));var Redis=require(_0x0349('0x11'));var authService=require(_0x0349('0x12'));var qs=require(_0x0349('0x13'));var as=require(_0x0349('0x14'));var hardwareService=require(_0x0349('0x15'));var logger=require(_0x0349('0x16'))(_0x0349('0x17'));var utils=require(_0x0349('0x18'));var config=require(_0x0349('0x19'));var licenseUtil=require(_0x0349('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5b58b2,_0x36baff){_0x36baff=_0x36baff||0xcc;return function(_0x351d2f){if(_0x351d2f){return _0x5b58b2[_0x0349('0x1b')](_0x36baff);}return _0x5b58b2[_0x0349('0x1c')](_0x36baff)['end']();};}function respondWithResult(_0xa7d231,_0x2c6fef){_0x2c6fef=_0x2c6fef||0xc8;return function(_0x21993e){if(_0x21993e){return _0xa7d231[_0x0349('0x1c')](_0x2c6fef)[_0x0349('0x1d')](_0x21993e);}};}function respondWithFilteredResult(_0x17c959,_0x174c65){return function(_0x3d0fc1){if(_0x3d0fc1){var _0x3b4caa=typeof _0x174c65['offset']==='undefined'&&typeof _0x174c65[_0x0349('0x1e')]===_0x0349('0x1f');var _0x2bc9f6=_0x3d0fc1[_0x0349('0x20')];var _0x2a8dc1=_0x3b4caa?0x0:_0x174c65[_0x0349('0x21')];var _0x2e1c5a=_0x3b4caa?_0x3d0fc1['count']:_0x174c65['offset']+_0x174c65[_0x0349('0x1e')];var _0x560eff;if(_0x2e1c5a>=_0x2bc9f6){_0x2e1c5a=_0x2bc9f6;_0x560eff=0xc8;}else{_0x560eff=0xce;}_0x17c959[_0x0349('0x1c')](_0x560eff);return _0x17c959[_0x0349('0x22')](_0x0349('0x23'),_0x2a8dc1+'-'+_0x2e1c5a+'/'+_0x2bc9f6)[_0x0349('0x1d')](_0x3d0fc1);}return null;};}function patchUpdates(_0x5f369d){return function(_0x56468a){try{jsonpatch[_0x0349('0x24')](_0x56468a,_0x5f369d,!![]);}catch(_0xf5118f){return BPromise[_0x0349('0x25')](_0xf5118f);}return _0x56468a[_0x0349('0x26')]();};}function saveUpdates(_0x37efcc,_0x15bb0d){return function(_0x46885f){if(_0x46885f){return _0x46885f[_0x0349('0x27')](_0x37efcc)[_0x0349('0x28')](function(_0x220772){return _0x220772;});}return null;};}function removeEntity(_0x480d34,_0x2ebbab){return function(_0x2d0064){if(_0x2d0064){return _0x2d0064[_0x0349('0x29')]()[_0x0349('0x28')](function(){_0x480d34['status'](0xcc)[_0x0349('0x2a')]();});}};}function handleEntityNotFound(_0xbbc993,_0x34e8ab){return function(_0x24dc6d){if(!_0x24dc6d){_0xbbc993[_0x0349('0x1b')](0x194);}return _0x24dc6d;};}function handleError(_0x194eed,_0x4291bb){_0x4291bb=_0x4291bb||0x1f4;return function(_0x110643){logger[_0x0349('0x2b')](_0x110643[_0x0349('0x2c')]);if(_0x110643[_0x0349('0x2d')]){delete _0x110643[_0x0349('0x2d')];}_0x194eed[_0x0349('0x1c')](_0x4291bb)['send'](_0x110643);};}exports[_0x0349('0x2e')]=function(_0x128bfa,_0x2bf17e){var _0x284453={},_0x54b8f8={},_0x36d1fe={'count':0x0,'rows':[]};var _0x6bce11=_['map'](db[_0x0349('0x2f')]['rawAttributes'],function(_0x28a0b6){return{'name':_0x28a0b6[_0x0349('0x30')],'type':_0x28a0b6[_0x0349('0x31')][_0x0349('0x32')]};});_0x54b8f8[_0x0349('0x33')]=_[_0x0349('0x34')](_0x6bce11,'name');_0x54b8f8['query']=_[_0x0349('0x35')](_0x128bfa[_0x0349('0x36')]);_0x54b8f8[_0x0349('0x37')]=_[_0x0349('0x38')](_0x54b8f8['model'],_0x54b8f8[_0x0349('0x36')]);_0x284453[_0x0349('0x39')]=_[_0x0349('0x38')](_0x54b8f8[_0x0349('0x33')],qs[_0x0349('0x3a')](_0x128bfa[_0x0349('0x36')][_0x0349('0x3a')]));_0x284453[_0x0349('0x39')]=_0x284453[_0x0349('0x39')][_0x0349('0x3b')]?_0x284453[_0x0349('0x39')]:_0x54b8f8[_0x0349('0x33')];if(!_0x128bfa['query'][_0x0349('0x3c')](_0x0349('0x3d'))){_0x284453['limit']=qs[_0x0349('0x1e')](_0x128bfa[_0x0349('0x36')][_0x0349('0x1e')]);_0x284453['offset']=qs[_0x0349('0x21')](_0x128bfa[_0x0349('0x36')][_0x0349('0x21')]);}_0x284453[_0x0349('0x3e')]=qs[_0x0349('0x3f')](_0x128bfa[_0x0349('0x36')]['sort']);_0x284453[_0x0349('0x40')]=qs['filters'](_[_0x0349('0x41')](_0x128bfa['query'],_0x54b8f8[_0x0349('0x37')]),_0x6bce11);if(_0x128bfa[_0x0349('0x36')][_0x0349('0x42')]){_0x284453['where']=_[_0x0349('0x43')](_0x284453[_0x0349('0x40')],{'$or':_[_0x0349('0x34')](_0x6bce11,function(_0x2f89b1){if(_0x2f89b1['type']!==_0x0349('0x44')){var _0x540653={};_0x540653[_0x2f89b1[_0x0349('0x2d')]]={'$like':'%'+_0x128bfa[_0x0349('0x36')]['filter']+'%'};return _0x540653;}})});}_0x284453=_['merge']({},_0x284453,_0x128bfa[_0x0349('0x45')]);var _0x5f0a4={'where':_0x284453[_0x0349('0x40')]};return db['MailSubstatus'][_0x0349('0x20')](_0x5f0a4)[_0x0349('0x28')](function(_0x1274dc){_0x36d1fe[_0x0349('0x20')]=_0x1274dc;if(_0x128bfa[_0x0349('0x36')]['includeAll']){_0x284453[_0x0349('0x46')]=[{'all':!![]}];}return db['MailSubstatus'][_0x0349('0x47')](_0x284453);})[_0x0349('0x28')](function(_0x4b9c6b){_0x36d1fe['rows']=_0x4b9c6b;return _0x36d1fe;})[_0x0349('0x28')](respondWithFilteredResult(_0x2bf17e,_0x284453))[_0x0349('0x48')](handleError(_0x2bf17e,null));};exports[_0x0349('0x49')]=function(_0xa389ee,_0x51889c){var _0x299dbd={'raw':!![],'where':{'id':_0xa389ee[_0x0349('0x4a')]['id']}},_0x2c3631={};_0x2c3631[_0x0349('0x33')]=_[_0x0349('0x35')](db[_0x0349('0x2f')][_0x0349('0x4b')]);_0x2c3631['query']=_[_0x0349('0x35')](_0xa389ee[_0x0349('0x36')]);_0x2c3631['filters']=_[_0x0349('0x38')](_0x2c3631[_0x0349('0x33')],_0x2c3631[_0x0349('0x36')]);_0x299dbd[_0x0349('0x39')]=_[_0x0349('0x38')](_0x2c3631[_0x0349('0x33')],qs[_0x0349('0x3a')](_0xa389ee[_0x0349('0x36')][_0x0349('0x3a')]));_0x299dbd[_0x0349('0x39')]=_0x299dbd[_0x0349('0x39')]['length']?_0x299dbd['attributes']:_0x2c3631[_0x0349('0x33')];if(_0xa389ee[_0x0349('0x36')]['includeAll']){_0x299dbd[_0x0349('0x46')]=[{'all':!![]}];}_0x299dbd=_[_0x0349('0x43')]({},_0x299dbd,_0xa389ee[_0x0349('0x45')]);return db[_0x0349('0x2f')]['find'](_0x299dbd)[_0x0349('0x28')](handleEntityNotFound(_0x51889c,null))[_0x0349('0x28')](respondWithResult(_0x51889c,null))['catch'](handleError(_0x51889c,null));};exports[_0x0349('0x4c')]=function(_0x1b3c62,_0x3261c9){return db[_0x0349('0x2f')][_0x0349('0x4c')](_0x1b3c62['body'],{})[_0x0349('0x28')](respondWithResult(_0x3261c9,0xc9))[_0x0349('0x48')](handleError(_0x3261c9,null));};exports[_0x0349('0x27')]=function(_0x491821,_0x22bd06){if(_0x491821['body']['id']){delete _0x491821[_0x0349('0x4d')]['id'];}return db[_0x0349('0x2f')][_0x0349('0x4e')]({'where':{'id':_0x491821[_0x0349('0x4a')]['id']}})[_0x0349('0x28')](handleEntityNotFound(_0x22bd06,null))[_0x0349('0x28')](saveUpdates(_0x491821[_0x0349('0x4d')],null))[_0x0349('0x28')](respondWithResult(_0x22bd06,null))['catch'](handleError(_0x22bd06,null));};exports[_0x0349('0x29')]=function(_0xea3ea2,_0x346c8d){return db['MailSubstatus'][_0x0349('0x4e')]({'where':{'id':_0xea3ea2[_0x0349('0x4a')]['id']}})[_0x0349('0x28')](handleEntityNotFound(_0x346c8d,null))[_0x0349('0x28')](removeEntity(_0x346c8d,null))[_0x0349('0x48')](handleError(_0x346c8d,null));};exports[_0x0349('0x4f')]=function(_0x2f7f4e,_0x32aa87){return db['MailSubstatus'][_0x0349('0x4f')]()['then'](respondWithResult(_0x32aa87,null))[_0x0349('0x48')](handleError(_0x32aa87,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index 0763301..07337c6 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 _0x3134=['exports','events','../../mysqldb','MailSubstatus','setMaxListeners','update','emit','hasOwnProperty'];(function(_0x2c7101,_0x2cff23){var _0x3bb677=function(_0x3c0fa4){while(--_0x3c0fa4){_0x2c7101['push'](_0x2c7101['shift']());}};_0x3bb677(++_0x2cff23);}(_0x3134,0x139));var _0x4313=function(_0x5f1e9e,_0x1a1c01){_0x5f1e9e=_0x5f1e9e-0x0;var _0x114842=_0x3134[_0x5f1e9e];return _0x114842;};'use strict';var EventEmitter=require(_0x4313('0x0'));var MailSubstatus=require(_0x4313('0x1'))['db'][_0x4313('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x4313('0x3')](0x0);var events={'afterUpdate':_0x4313('0x4')};function emitEvent(_0x1ef1ad){return function(_0x2116d8,_0x5bc2b8,_0x274d87){MailSubstatusEvents[_0x4313('0x5')](_0x1ef1ad+':'+_0x2116d8['id'],_0x2116d8);MailSubstatusEvents['emit'](_0x1ef1ad,_0x2116d8);_0x274d87(null);};}for(var e in events){if(events[_0x4313('0x6')](e)){var event=events[e];MailSubstatus['hook'](e,emitEvent(event));}}module[_0x4313('0x7')]=MailSubstatusEvents; \ No newline at end of file +var _0x9b07=['../../mysqldb','setMaxListeners','update','emit','hasOwnProperty','hook','events'];(function(_0x3f85b3,_0x5870a3){var _0x741189=function(_0x2e305e){while(--_0x2e305e){_0x3f85b3['push'](_0x3f85b3['shift']());}};_0x741189(++_0x5870a3);}(_0x9b07,0x1d4));var _0x79b0=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x9b07[_0x3ab51d];return _0x29a04e;};'use strict';var EventEmitter=require(_0x79b0('0x0'));var MailSubstatus=require(_0x79b0('0x1'))['db']['MailSubstatus'];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x79b0('0x2')](0x0);var events={'afterUpdate':_0x79b0('0x3')};function emitEvent(_0x89ecb0){return function(_0x5c3d97,_0x1bc73c,_0x24ada7){MailSubstatusEvents[_0x79b0('0x4')](_0x89ecb0+':'+_0x5c3d97['id'],_0x5c3d97);MailSubstatusEvents[_0x79b0('0x4')](_0x89ecb0,_0x5c3d97);_0x24ada7(null);};}for(var e in events){if(events[_0x79b0('0x5')](e)){var event=events[e];MailSubstatus[_0x79b0('0x6')](e,emitEvent(event));}}module['exports']=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index bc1d327..4138b05 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 _0x84e7=['mail_substatuses','update','name','mailSubstatus','catch','./mailSubstatus.attributes','models'];(function(_0x14d145,_0x2da870){var _0x566d5d=function(_0x2b522c){while(--_0x2b522c){_0x14d145['push'](_0x14d145['shift']());}};_0x566d5d(++_0x2da870);}(_0x84e7,0x171));var _0x784e=function(_0x2bdff8,_0x624681){_0x2bdff8=_0x2bdff8-0x0;var _0x517b79=_0x84e7[_0x2bdff8];return _0x517b79;};'use strict';var attributes=require(_0x784e('0x0'));module['exports']=function(_0x982717){var _0x4e3419=_0x982717[_0x784e('0x1')];return _0x982717['define']('MailSubstatus',attributes,{'tableName':_0x784e('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x339c78,_0x2b5b5a,_0x118c70){return _0x4e3419['Condition'][_0x784e('0x3')]({'value':_0x339c78[_0x784e('0x4')]},{'where':{'field':_0x784e('0x5'),'value':_0x339c78['_previousDataValues']['name']}})['then'](function(){_0x118c70();})[_0x784e('0x6')](function(_0x34ea57){_0x118c70(_0x34ea57);});}}});}; \ No newline at end of file +var _0xb910=['name','mailSubstatus','_previousDataValues','then','catch','./mailSubstatus.attributes','models','define','MailSubstatus','mail_substatuses','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb910,0x1b2));var _0x0b91=function(_0x1abb09,_0x18ee91){_0x1abb09=_0x1abb09-0x0;var _0xea1c07=_0xb910[_0x1abb09];return _0xea1c07;};'use strict';var attributes=require(_0x0b91('0x0'));module['exports']=function(_0x3164da){var _0x9c5a53=_0x3164da[_0x0b91('0x1')];return _0x3164da[_0x0b91('0x2')](_0x0b91('0x3'),attributes,{'tableName':_0x0b91('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x5e63c2,_0x1853ce,_0x21ab47){return _0x9c5a53['Condition'][_0x0b91('0x5')]({'value':_0x5e63c2[_0x0b91('0x6')]},{'where':{'field':_0x0b91('0x7'),'value':_0x5e63c2[_0x0b91('0x8')]['name']}})[_0x0b91('0x9')](function(){_0x21ab47();})[_0x0b91('0xa')](function(_0x470a9d){_0x21ab47(_0x470a9d);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index c837689..b6cb18e 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 _0x22f1=['lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','MailSubstatus,\x20%s,\x20%s','request\x20sent','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result'];(function(_0x4c8775,_0x3f458c){var _0x4ec743=function(_0x433426){while(--_0x433426){_0x4c8775['push'](_0x4c8775['shift']());}};_0x4ec743(++_0x3f458c);}(_0x22f1,0xbd));var _0x122f=function(_0x5e21fa,_0x501e52){_0x5e21fa=_0x5e21fa-0x0;var _0x11d56d=_0x22f1[_0x5e21fa];return _0x11d56d;};'use strict';var _=require(_0x122f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x122f('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x122f('0x2'));var db=require(_0x122f('0x3'))['db'];var utils=require(_0x122f('0x4'));var logger=require(_0x122f('0x5'))(_0x122f('0x6'));var config=require(_0x122f('0x7'));var jayson=require(_0x122f('0x8'));var client=jayson[_0x122f('0x9')][_0x122f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x766b2c,_0x1d95fc,_0x5ea110){return new BPromise(function(_0x261fa6,_0x35f0e9){return client[_0x122f('0xb')](_0x766b2c,_0x5ea110)['then'](function(_0x40eefd){logger['info'](_0x122f('0xc'),_0x1d95fc,_0x122f('0xd'));logger['debug'](_0x122f('0xe'),_0x1d95fc,_0x122f('0xd'),JSON[_0x122f('0xf')](_0x40eefd));if(_0x40eefd[_0x122f('0x10')]){if(_0x40eefd[_0x122f('0x10')][_0x122f('0x11')]===0x1f4){logger['error'](_0x122f('0xc'),_0x1d95fc,_0x40eefd[_0x122f('0x10')][_0x122f('0x12')]);return _0x35f0e9(_0x40eefd['error'][_0x122f('0x12')]);}logger[_0x122f('0x10')](_0x122f('0xc'),_0x1d95fc,_0x40eefd[_0x122f('0x10')][_0x122f('0x12')]);return _0x261fa6(_0x40eefd['error'][_0x122f('0x12')]);}else{logger[_0x122f('0x13')](_0x122f('0xc'),_0x1d95fc,_0x122f('0xd'));_0x261fa6(_0x40eefd[_0x122f('0x14')]['message']);}})['catch'](function(_0x24d3bb){logger[_0x122f('0x10')](_0x122f('0xc'),_0x1d95fc,_0x24d3bb);_0x35f0e9(_0x24d3bb);});});} \ No newline at end of file +var _0x115b=['then','info','MailSubstatus,\x20%s,\x20%s','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','request'];(function(_0x3a29ef,_0xe4270e){var _0x5de1d3=function(_0x3b206e){while(--_0x3b206e){_0x3a29ef['push'](_0x3a29ef['shift']());}};_0x5de1d3(++_0xe4270e);}(_0x115b,0x102));var _0xb115=function(_0x52f800,_0x114169){_0x52f800=_0x52f800-0x0;var _0x1c3e74=_0x115b[_0x52f800];return _0x1c3e74;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xb115('0x0'));var rs=require(_0xb115('0x1'));var fs=require('fs');var Redis=require(_0xb115('0x2'));var db=require(_0xb115('0x3'))['db'];var utils=require(_0xb115('0x4'));var logger=require(_0xb115('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb115('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x475dad,_0x4b588b,_0x515478){return new BPromise(function(_0x1ad65b,_0x112161){return client[_0xb115('0x7')](_0x475dad,_0x515478)[_0xb115('0x8')](function(_0x33218d){logger[_0xb115('0x9')](_0xb115('0xa'),_0x4b588b,'request\x20sent');logger[_0xb115('0xb')](_0xb115('0xc'),_0x4b588b,_0xb115('0xd'),JSON[_0xb115('0xe')](_0x33218d));if(_0x33218d[_0xb115('0xf')]){if(_0x33218d[_0xb115('0xf')][_0xb115('0x10')]===0x1f4){logger['error'](_0xb115('0xa'),_0x4b588b,_0x33218d[_0xb115('0xf')][_0xb115('0x11')]);return _0x112161(_0x33218d[_0xb115('0xf')][_0xb115('0x11')]);}logger['error'](_0xb115('0xa'),_0x4b588b,_0x33218d[_0xb115('0xf')][_0xb115('0x11')]);return _0x1ad65b(_0x33218d['error']['message']);}else{logger[_0xb115('0x9')](_0xb115('0xa'),_0x4b588b,_0xb115('0xd'));_0x1ad65b(_0x33218d['result'][_0xb115('0x11')]);}})[_0xb115('0x12')](function(_0x59f421){logger[_0xb115('0xf')](_0xb115('0xa'),_0x4b588b,_0x59f421);_0x112161(_0x59f421);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index e5f2c19..226cf33 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 _0xbeba=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','post','put'];(function(_0x2a32c4,_0x1a097){var _0xc691df=function(_0x50479e){while(--_0x50479e){_0x2a32c4['push'](_0x2a32c4['shift']());}};_0xc691df(++_0x1a097);}(_0xbeba,0x11c));var _0xabeb=function(_0x283251,_0x65a7d1){_0x283251=_0x283251-0x0;var _0xccf556=_0xbeba[_0x283251];return _0xccf556;};'use strict';var multer=require(_0xabeb('0x0'));var util=require(_0xabeb('0x1'));var path=require(_0xabeb('0x2'));var timeout=require(_0xabeb('0x3'));var express=require(_0xabeb('0x4'));var router=express[_0xabeb('0x5')]();var fs_extra=require(_0xabeb('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xabeb('0x7'));var config=require(_0xabeb('0x8'));var controller=require('./mailTransferReport.controller');router[_0xabeb('0x9')]('/',auth[_0xabeb('0xa')](),controller[_0xabeb('0xb')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0xabeb('0xc')]);router[_0xabeb('0x9')](_0xabeb('0xd'),auth[_0xabeb('0xa')](),controller['show']);router[_0xabeb('0xe')]('/',auth[_0xabeb('0xa')](),controller['create']);router[_0xabeb('0xf')](_0xabeb('0xd'),auth[_0xabeb('0xa')](),controller[_0xabeb('0x10')]);router[_0xabeb('0x11')](_0xabeb('0xd'),auth[_0xabeb('0xa')](),controller[_0xabeb('0x12')]);module[_0xabeb('0x13')]=router; \ No newline at end of file +var _0xe6a9=['describe','show','create','put','/:id','update','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./mailTransferReport.controller','get','/describe','isAuthenticated'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe6a9,0x1aa));var _0x9e6a=function(_0x5aa90c,_0x40e79b){_0x5aa90c=_0x5aa90c-0x0;var _0x228251=_0xe6a9[_0x5aa90c];return _0x228251;};'use strict';var multer=require(_0x9e6a('0x0'));var util=require('util');var path=require(_0x9e6a('0x1'));var timeout=require(_0x9e6a('0x2'));var express=require(_0x9e6a('0x3'));var router=express[_0x9e6a('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9e6a('0x5'));var interaction=require(_0x9e6a('0x6'));var config=require('../../config/environment');var controller=require(_0x9e6a('0x7'));router[_0x9e6a('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x9e6a('0x8')](_0x9e6a('0x9'),auth[_0x9e6a('0xa')](),controller[_0x9e6a('0xb')]);router[_0x9e6a('0x8')]('/:id',auth[_0x9e6a('0xa')](),controller[_0x9e6a('0xc')]);router['post']('/',auth[_0x9e6a('0xa')](),controller[_0x9e6a('0xd')]);router[_0x9e6a('0xe')](_0x9e6a('0xf'),auth['isAuthenticated'](),controller[_0x9e6a('0x10')]);router['delete'](_0x9e6a('0xf'),auth[_0x9e6a('0xa')](),controller[_0x9e6a('0x11')]);module[_0x9e6a('0x12')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 17e4245..50084eb 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 _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x5214ec,_0x58864e){var _0x40cc3c=function(_0xefa8f7){while(--_0xefa8f7){_0x5214ec['push'](_0x5214ec['shift']());}};_0x40cc3c(++_0x58864e);}(_0xaa88,0x137));var _0x8aa8=function(_0x4a5494,_0x3ad336){_0x4a5494=_0x4a5494-0x0;var _0x57cbb5=_0xaa88[_0x4a5494];return _0x57cbb5;};'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 +var _0x9bde=['NOW','sequelize','STRING','account','agent','queue','DATE'];(function(_0x20aae1,_0x51efd4){var _0x510601=function(_0x20895f){while(--_0x20895f){_0x20aae1['push'](_0x20aae1['shift']());}};_0x510601(++_0x51efd4);}(_0x9bde,0xe1));var _0xe9bd=function(_0x19bd0f,_0x26f6f3){_0x19bd0f=_0x19bd0f-0x0;var _0xef83ae=_0x9bde[_0x19bd0f];return _0xef83ae;};'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 be626de..ed63b1d 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 _0x6bee=['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','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','then','error','stack','name','send','map','MailTransferReport','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','options','includeAll','include','findAll','rows','show','params','keys','find','catch','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce'];(function(_0x37acc7,_0x169745){var _0x2b861c=function(_0x5e2e4a){while(--_0x5e2e4a){_0x37acc7['push'](_0x37acc7['shift']());}};_0x2b861c(++_0x169745);}(_0x6bee,0x93));var _0xe6be=function(_0x28fb19,_0x3e5e9a){_0x28fb19=_0x28fb19-0x0;var _0x2b9222=_0x6bee[_0x28fb19];return _0x2b9222;};'use strict';var emlformat=require(_0xe6be('0x0'));var rimraf=require(_0xe6be('0x1'));var zipdir=require(_0xe6be('0x2'));var jsonpatch=require(_0xe6be('0x3'));var rp=require('request-promise');var moment=require(_0xe6be('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xe6be('0x5'));var util=require(_0xe6be('0x6'));var path=require(_0xe6be('0x7'));var sox=require(_0xe6be('0x8'));var csv=require('to-csv');var ejs=require(_0xe6be('0x9'));var fs=require('fs');var fs_extra=require(_0xe6be('0xa'));var _=require(_0xe6be('0xb'));var squel=require(_0xe6be('0xc'));var crypto=require(_0xe6be('0xd'));var jsforce=require(_0xe6be('0xe'));var deskjs=require(_0xe6be('0xf'));var toCsv=require(_0xe6be('0x10'));var querystring=require(_0xe6be('0x11'));var Papa=require(_0xe6be('0x12'));var Redis=require(_0xe6be('0x13'));var authService=require(_0xe6be('0x14'));var qs=require(_0xe6be('0x15'));var as=require(_0xe6be('0x16'));var hardwareService=require(_0xe6be('0x17'));var logger=require(_0xe6be('0x18'))(_0xe6be('0x19'));var utils=require(_0xe6be('0x1a'));var config=require(_0xe6be('0x1b'));var licenseUtil=require(_0xe6be('0x1c'));var db=require(_0xe6be('0x1d'))['db'];function respondWithStatusCode(_0x51f4a7,_0x5ce338){_0x5ce338=_0x5ce338||0xcc;return function(_0x441146){if(_0x441146){return _0x51f4a7[_0xe6be('0x1e')](_0x5ce338);}return _0x51f4a7[_0xe6be('0x1f')](_0x5ce338)[_0xe6be('0x20')]();};}function respondWithResult(_0x520fc8,_0x12fc15){_0x12fc15=_0x12fc15||0xc8;return function(_0x31c4fb){if(_0x31c4fb){return _0x520fc8[_0xe6be('0x1f')](_0x12fc15)['json'](_0x31c4fb);}};}function respondWithFilteredResult(_0xce03ed,_0x3b9ff0){return function(_0xb1ea07){if(_0xb1ea07){var _0x451b55=typeof _0x3b9ff0[_0xe6be('0x21')]==='undefined'&&typeof _0x3b9ff0[_0xe6be('0x22')]===_0xe6be('0x23');var _0x58caf6=_0xb1ea07[_0xe6be('0x24')];var _0x2c8028=_0x451b55?0x0:_0x3b9ff0['offset'];var _0x2a8c0f=_0x451b55?_0xb1ea07[_0xe6be('0x24')]:_0x3b9ff0[_0xe6be('0x21')]+_0x3b9ff0['limit'];var _0x4f5558;if(_0x2a8c0f>=_0x58caf6){_0x2a8c0f=_0x58caf6;_0x4f5558=0xc8;}else{_0x4f5558=0xce;}_0xce03ed['status'](_0x4f5558);return _0xce03ed[_0xe6be('0x25')](_0xe6be('0x26'),_0x2c8028+'-'+_0x2a8c0f+'/'+_0x58caf6)[_0xe6be('0x27')](_0xb1ea07);}return null;};}function patchUpdates(_0xce86f9){return function(_0x3a5cfe){try{jsonpatch[_0xe6be('0x28')](_0x3a5cfe,_0xce86f9,!![]);}catch(_0x1f66fa){return BPromise[_0xe6be('0x29')](_0x1f66fa);}return _0x3a5cfe[_0xe6be('0x2a')]();};}function saveUpdates(_0x1bc8bc,_0x2c91f2){return function(_0x29022a){if(_0x29022a){return _0x29022a[_0xe6be('0x2b')](_0x1bc8bc)[_0xe6be('0x2c')](function(_0x24c4cd){return _0x24c4cd;});}return null;};}function removeEntity(_0x4e13a6,_0x1cdbaa){return function(_0x2aa745){if(_0x2aa745){return _0x2aa745['destroy']()['then'](function(){_0x4e13a6[_0xe6be('0x1f')](0xcc)[_0xe6be('0x20')]();});}};}function handleEntityNotFound(_0x4ce199,_0x368015){return function(_0x4a1704){if(!_0x4a1704){_0x4ce199[_0xe6be('0x1e')](0x194);}return _0x4a1704;};}function handleError(_0x5d698b,_0x288922){_0x288922=_0x288922||0x1f4;return function(_0x479051){logger[_0xe6be('0x2d')](_0x479051[_0xe6be('0x2e')]);if(_0x479051[_0xe6be('0x2f')]){delete _0x479051[_0xe6be('0x2f')];}_0x5d698b['status'](_0x288922)[_0xe6be('0x30')](_0x479051);};}exports['index']=function(_0x936e9a,_0x13f525){var _0x4d6b3a={},_0x15c6ce={},_0x13c9b4={'count':0x0,'rows':[]};var _0x13921a=_[_0xe6be('0x31')](db[_0xe6be('0x32')][_0xe6be('0x33')],function(_0x8c8fe5){return{'name':_0x8c8fe5[_0xe6be('0x34')],'type':_0x8c8fe5['type'][_0xe6be('0x35')]};});_0x15c6ce[_0xe6be('0x36')]=_[_0xe6be('0x31')](_0x13921a,_0xe6be('0x2f'));_0x15c6ce['query']=_['keys'](_0x936e9a[_0xe6be('0x37')]);_0x15c6ce[_0xe6be('0x38')]=_[_0xe6be('0x39')](_0x15c6ce[_0xe6be('0x36')],_0x15c6ce[_0xe6be('0x37')]);_0x4d6b3a[_0xe6be('0x3a')]=_[_0xe6be('0x39')](_0x15c6ce['model'],qs[_0xe6be('0x3b')](_0x936e9a[_0xe6be('0x37')][_0xe6be('0x3b')]));_0x4d6b3a[_0xe6be('0x3a')]=_0x4d6b3a[_0xe6be('0x3a')][_0xe6be('0x3c')]?_0x4d6b3a[_0xe6be('0x3a')]:_0x15c6ce[_0xe6be('0x36')];if(!_0x936e9a[_0xe6be('0x37')]['hasOwnProperty'](_0xe6be('0x3d'))){_0x4d6b3a[_0xe6be('0x22')]=qs['limit'](_0x936e9a[_0xe6be('0x37')][_0xe6be('0x22')]);_0x4d6b3a['offset']=qs[_0xe6be('0x21')](_0x936e9a[_0xe6be('0x37')][_0xe6be('0x21')]);}_0x4d6b3a[_0xe6be('0x3e')]=qs['sort'](_0x936e9a[_0xe6be('0x37')][_0xe6be('0x3f')]);_0x4d6b3a[_0xe6be('0x40')]=qs['filters'](_['pick'](_0x936e9a[_0xe6be('0x37')],_0x15c6ce[_0xe6be('0x38')]),_0x13921a);if(_0x936e9a[_0xe6be('0x37')][_0xe6be('0x41')]){_0x4d6b3a[_0xe6be('0x40')]=_['merge'](_0x4d6b3a[_0xe6be('0x40')],{'$or':_['map'](_0x13921a,function(_0x49392d){if(_0x49392d['type']!=='VIRTUAL'){var _0x153bb8={};_0x153bb8[_0x49392d[_0xe6be('0x2f')]]={'$like':'%'+_0x936e9a[_0xe6be('0x37')][_0xe6be('0x41')]+'%'};return _0x153bb8;}})});}_0x4d6b3a=_[_0xe6be('0x42')]({},_0x4d6b3a,_0x936e9a[_0xe6be('0x43')]);var _0x3ec9a4={'where':_0x4d6b3a[_0xe6be('0x40')]};return db[_0xe6be('0x32')][_0xe6be('0x24')](_0x3ec9a4)['then'](function(_0xe3ddf5){_0x13c9b4['count']=_0xe3ddf5;if(_0x936e9a[_0xe6be('0x37')][_0xe6be('0x44')]){_0x4d6b3a[_0xe6be('0x45')]=[{'all':!![]}];}return db[_0xe6be('0x32')][_0xe6be('0x46')](_0x4d6b3a);})[_0xe6be('0x2c')](function(_0x3e3fc8){_0x13c9b4[_0xe6be('0x47')]=_0x3e3fc8;return _0x13c9b4;})[_0xe6be('0x2c')](respondWithFilteredResult(_0x13f525,_0x4d6b3a))['catch'](handleError(_0x13f525,null));};exports[_0xe6be('0x48')]=function(_0x16ec48,_0x5502dd){var _0x1de412={'raw':!![],'where':{'id':_0x16ec48[_0xe6be('0x49')]['id']}},_0x1ad37b={};_0x1ad37b['model']=_[_0xe6be('0x4a')](db[_0xe6be('0x32')][_0xe6be('0x33')]);_0x1ad37b[_0xe6be('0x37')]=_['keys'](_0x16ec48[_0xe6be('0x37')]);_0x1ad37b[_0xe6be('0x38')]=_[_0xe6be('0x39')](_0x1ad37b[_0xe6be('0x36')],_0x1ad37b['query']);_0x1de412[_0xe6be('0x3a')]=_['intersection'](_0x1ad37b[_0xe6be('0x36')],qs[_0xe6be('0x3b')](_0x16ec48['query'][_0xe6be('0x3b')]));_0x1de412[_0xe6be('0x3a')]=_0x1de412[_0xe6be('0x3a')]['length']?_0x1de412['attributes']:_0x1ad37b[_0xe6be('0x36')];if(_0x16ec48['query'][_0xe6be('0x44')]){_0x1de412[_0xe6be('0x45')]=[{'all':!![]}];}_0x1de412=_[_0xe6be('0x42')]({},_0x1de412,_0x16ec48[_0xe6be('0x43')]);return db[_0xe6be('0x32')][_0xe6be('0x4b')](_0x1de412)['then'](handleEntityNotFound(_0x5502dd,null))[_0xe6be('0x2c')](respondWithResult(_0x5502dd,null))[_0xe6be('0x4c')](handleError(_0x5502dd,null));};exports[_0xe6be('0x4d')]=function(_0x4cba47,_0x32e471){return db[_0xe6be('0x32')][_0xe6be('0x4d')](_0x4cba47[_0xe6be('0x4e')],{})[_0xe6be('0x2c')](respondWithResult(_0x32e471,0xc9))[_0xe6be('0x4c')](handleError(_0x32e471,null));};exports['update']=function(_0x385802,_0x1ec3a0){if(_0x385802['body']['id']){delete _0x385802[_0xe6be('0x4e')]['id'];}return db[_0xe6be('0x32')][_0xe6be('0x4b')]({'where':{'id':_0x385802[_0xe6be('0x49')]['id']}})[_0xe6be('0x2c')](handleEntityNotFound(_0x1ec3a0,null))['then'](saveUpdates(_0x385802[_0xe6be('0x4e')],null))[_0xe6be('0x2c')](respondWithResult(_0x1ec3a0,null))[_0xe6be('0x4c')](handleError(_0x1ec3a0,null));};exports[_0xe6be('0x4f')]=function(_0x422076,_0x4fd1c1){return db['MailTransferReport'][_0xe6be('0x4b')]({'where':{'id':_0x422076[_0xe6be('0x49')]['id']}})[_0xe6be('0x2c')](handleEntityNotFound(_0x4fd1c1,null))[_0xe6be('0x2c')](removeEntity(_0x4fd1c1,null))[_0xe6be('0x4c')](handleError(_0x4fd1c1,null));};exports[_0xe6be('0x50')]=function(_0x143a66,_0x2bf619){return db[_0xe6be('0x32')][_0xe6be('0x50')]()[_0xe6be('0x2c')](respondWithResult(_0x2bf619,null))[_0xe6be('0x4c')](handleError(_0x2bf619,null));}; \ No newline at end of file +var _0xf9f5=['lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','Content-Range','reject','save','update','destroy','then','error','stack','name','index','MailTransferReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','show','params','options','find','catch','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','ejs','fs-extra'];(function(_0xca167c,_0x439d26){var _0x30cc8b=function(_0x18ade9){while(--_0x18ade9){_0xca167c['push'](_0xca167c['shift']());}};_0x30cc8b(++_0x439d26);}(_0xf9f5,0x181));var _0x5f9f=function(_0x52f635,_0x3e910d){_0x52f635=_0x52f635-0x0;var _0x2a652c=_0xf9f5[_0x52f635];return _0x2a652c;};'use strict';var emlformat=require(_0x5f9f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5f9f('0x1'));var jsonpatch=require(_0x5f9f('0x2'));var rp=require(_0x5f9f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x5f9f('0x4'));var util=require(_0x5f9f('0x5'));var path=require(_0x5f9f('0x6'));var sox=require(_0x5f9f('0x7'));var csv=require('to-csv');var ejs=require(_0x5f9f('0x8'));var fs=require('fs');var fs_extra=require(_0x5f9f('0x9'));var _=require(_0x5f9f('0xa'));var squel=require(_0x5f9f('0xb'));var crypto=require(_0x5f9f('0xc'));var jsforce=require(_0x5f9f('0xd'));var deskjs=require(_0x5f9f('0xe'));var toCsv=require(_0x5f9f('0xf'));var querystring=require(_0x5f9f('0x10'));var Papa=require(_0x5f9f('0x11'));var Redis=require(_0x5f9f('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x5f9f('0x13'));var hardwareService=require(_0x5f9f('0x14'));var logger=require(_0x5f9f('0x15'))(_0x5f9f('0x16'));var utils=require(_0x5f9f('0x17'));var config=require(_0x5f9f('0x18'));var licenseUtil=require(_0x5f9f('0x19'));var db=require(_0x5f9f('0x1a'))['db'];function respondWithStatusCode(_0x5937ae,_0x1196ce){_0x1196ce=_0x1196ce||0xcc;return function(_0x5a8f51){if(_0x5a8f51){return _0x5937ae[_0x5f9f('0x1b')](_0x1196ce);}return _0x5937ae['status'](_0x1196ce)[_0x5f9f('0x1c')]();};}function respondWithResult(_0xbe5448,_0x2244b9){_0x2244b9=_0x2244b9||0xc8;return function(_0x23a5dd){if(_0x23a5dd){return _0xbe5448[_0x5f9f('0x1d')](_0x2244b9)['json'](_0x23a5dd);}};}function respondWithFilteredResult(_0x2b9492,_0x530476){return function(_0x25ae9c){if(_0x25ae9c){var _0x360815=typeof _0x530476[_0x5f9f('0x1e')]===_0x5f9f('0x1f')&&typeof _0x530476[_0x5f9f('0x20')]===_0x5f9f('0x1f');var _0x41c4bf=_0x25ae9c[_0x5f9f('0x21')];var _0x42f594=_0x360815?0x0:_0x530476['offset'];var _0x21e31b=_0x360815?_0x25ae9c[_0x5f9f('0x21')]:_0x530476[_0x5f9f('0x1e')]+_0x530476[_0x5f9f('0x20')];var _0x2ba5ba;if(_0x21e31b>=_0x41c4bf){_0x21e31b=_0x41c4bf;_0x2ba5ba=0xc8;}else{_0x2ba5ba=0xce;}_0x2b9492[_0x5f9f('0x1d')](_0x2ba5ba);return _0x2b9492['set'](_0x5f9f('0x22'),_0x42f594+'-'+_0x21e31b+'/'+_0x41c4bf)['json'](_0x25ae9c);}return null;};}function patchUpdates(_0x1f46ce){return function(_0x34127c){try{jsonpatch['apply'](_0x34127c,_0x1f46ce,!![]);}catch(_0x5b0319){return BPromise[_0x5f9f('0x23')](_0x5b0319);}return _0x34127c[_0x5f9f('0x24')]();};}function saveUpdates(_0x3860cd,_0x241bde){return function(_0x574449){if(_0x574449){return _0x574449[_0x5f9f('0x25')](_0x3860cd)['then'](function(_0x2046e1){return _0x2046e1;});}return null;};}function removeEntity(_0x4563fa,_0x4f78f1){return function(_0x46e849){if(_0x46e849){return _0x46e849[_0x5f9f('0x26')]()[_0x5f9f('0x27')](function(){_0x4563fa[_0x5f9f('0x1d')](0xcc)[_0x5f9f('0x1c')]();});}};}function handleEntityNotFound(_0x546dd3,_0x54e541){return function(_0x4d662c){if(!_0x4d662c){_0x546dd3['sendStatus'](0x194);}return _0x4d662c;};}function handleError(_0x35544a,_0x39545b){_0x39545b=_0x39545b||0x1f4;return function(_0x4a2326){logger[_0x5f9f('0x28')](_0x4a2326[_0x5f9f('0x29')]);if(_0x4a2326[_0x5f9f('0x2a')]){delete _0x4a2326[_0x5f9f('0x2a')];}_0x35544a['status'](_0x39545b)['send'](_0x4a2326);};}exports[_0x5f9f('0x2b')]=function(_0x2c7a79,_0x3c28cf){var _0x31af0f={},_0x5be3d3={},_0x4755a6={'count':0x0,'rows':[]};var _0x1669ca=_['map'](db[_0x5f9f('0x2c')][_0x5f9f('0x2d')],function(_0x2d3285){return{'name':_0x2d3285[_0x5f9f('0x2e')],'type':_0x2d3285[_0x5f9f('0x2f')][_0x5f9f('0x30')]};});_0x5be3d3[_0x5f9f('0x31')]=_[_0x5f9f('0x32')](_0x1669ca,'name');_0x5be3d3[_0x5f9f('0x33')]=_[_0x5f9f('0x34')](_0x2c7a79[_0x5f9f('0x33')]);_0x5be3d3[_0x5f9f('0x35')]=_[_0x5f9f('0x36')](_0x5be3d3[_0x5f9f('0x31')],_0x5be3d3['query']);_0x31af0f[_0x5f9f('0x37')]=_['intersection'](_0x5be3d3[_0x5f9f('0x31')],qs[_0x5f9f('0x38')](_0x2c7a79['query'][_0x5f9f('0x38')]));_0x31af0f['attributes']=_0x31af0f[_0x5f9f('0x37')][_0x5f9f('0x39')]?_0x31af0f['attributes']:_0x5be3d3[_0x5f9f('0x31')];if(!_0x2c7a79['query'][_0x5f9f('0x3a')](_0x5f9f('0x3b'))){_0x31af0f[_0x5f9f('0x20')]=qs[_0x5f9f('0x20')](_0x2c7a79[_0x5f9f('0x33')][_0x5f9f('0x20')]);_0x31af0f['offset']=qs[_0x5f9f('0x1e')](_0x2c7a79[_0x5f9f('0x33')]['offset']);}_0x31af0f[_0x5f9f('0x3c')]=qs['sort'](_0x2c7a79[_0x5f9f('0x33')][_0x5f9f('0x3d')]);_0x31af0f[_0x5f9f('0x3e')]=qs['filters'](_[_0x5f9f('0x3f')](_0x2c7a79[_0x5f9f('0x33')],_0x5be3d3[_0x5f9f('0x35')]),_0x1669ca);if(_0x2c7a79[_0x5f9f('0x33')]['filter']){_0x31af0f['where']=_[_0x5f9f('0x40')](_0x31af0f[_0x5f9f('0x3e')],{'$or':_[_0x5f9f('0x32')](_0x1669ca,function(_0x54acb7){if(_0x54acb7[_0x5f9f('0x2f')]!==_0x5f9f('0x41')){var _0x5d45de={};_0x5d45de[_0x54acb7['name']]={'$like':'%'+_0x2c7a79[_0x5f9f('0x33')][_0x5f9f('0x42')]+'%'};return _0x5d45de;}})});}_0x31af0f=_['merge']({},_0x31af0f,_0x2c7a79['options']);var _0x5473af={'where':_0x31af0f['where']};return db[_0x5f9f('0x2c')][_0x5f9f('0x21')](_0x5473af)[_0x5f9f('0x27')](function(_0x50d5d2){_0x4755a6[_0x5f9f('0x21')]=_0x50d5d2;if(_0x2c7a79[_0x5f9f('0x33')][_0x5f9f('0x43')]){_0x31af0f[_0x5f9f('0x44')]=[{'all':!![]}];}return db[_0x5f9f('0x2c')][_0x5f9f('0x45')](_0x31af0f);})[_0x5f9f('0x27')](function(_0x1ed82e){_0x4755a6[_0x5f9f('0x46')]=_0x1ed82e;return _0x4755a6;})[_0x5f9f('0x27')](respondWithFilteredResult(_0x3c28cf,_0x31af0f))['catch'](handleError(_0x3c28cf,null));};exports[_0x5f9f('0x47')]=function(_0x548a54,_0xeff8ec){var _0x2815ec={'raw':!![],'where':{'id':_0x548a54[_0x5f9f('0x48')]['id']}},_0x51829a={};_0x51829a[_0x5f9f('0x31')]=_[_0x5f9f('0x34')](db[_0x5f9f('0x2c')][_0x5f9f('0x2d')]);_0x51829a['query']=_[_0x5f9f('0x34')](_0x548a54[_0x5f9f('0x33')]);_0x51829a[_0x5f9f('0x35')]=_[_0x5f9f('0x36')](_0x51829a[_0x5f9f('0x31')],_0x51829a['query']);_0x2815ec[_0x5f9f('0x37')]=_[_0x5f9f('0x36')](_0x51829a[_0x5f9f('0x31')],qs[_0x5f9f('0x38')](_0x548a54[_0x5f9f('0x33')][_0x5f9f('0x38')]));_0x2815ec[_0x5f9f('0x37')]=_0x2815ec['attributes'][_0x5f9f('0x39')]?_0x2815ec['attributes']:_0x51829a[_0x5f9f('0x31')];if(_0x548a54[_0x5f9f('0x33')][_0x5f9f('0x43')]){_0x2815ec[_0x5f9f('0x44')]=[{'all':!![]}];}_0x2815ec=_['merge']({},_0x2815ec,_0x548a54[_0x5f9f('0x49')]);return db[_0x5f9f('0x2c')][_0x5f9f('0x4a')](_0x2815ec)[_0x5f9f('0x27')](handleEntityNotFound(_0xeff8ec,null))['then'](respondWithResult(_0xeff8ec,null))[_0x5f9f('0x4b')](handleError(_0xeff8ec,null));};exports[_0x5f9f('0x4c')]=function(_0x4f54d7,_0x2eca01){return db[_0x5f9f('0x2c')][_0x5f9f('0x4c')](_0x4f54d7[_0x5f9f('0x4d')],{})['then'](respondWithResult(_0x2eca01,0xc9))[_0x5f9f('0x4b')](handleError(_0x2eca01,null));};exports[_0x5f9f('0x25')]=function(_0x10350e,_0x551f66){if(_0x10350e[_0x5f9f('0x4d')]['id']){delete _0x10350e[_0x5f9f('0x4d')]['id'];}return db[_0x5f9f('0x2c')]['find']({'where':{'id':_0x10350e[_0x5f9f('0x48')]['id']}})[_0x5f9f('0x27')](handleEntityNotFound(_0x551f66,null))[_0x5f9f('0x27')](saveUpdates(_0x10350e[_0x5f9f('0x4d')],null))[_0x5f9f('0x27')](respondWithResult(_0x551f66,null))[_0x5f9f('0x4b')](handleError(_0x551f66,null));};exports[_0x5f9f('0x26')]=function(_0xc119c6,_0x28e70d){return db[_0x5f9f('0x2c')][_0x5f9f('0x4a')]({'where':{'id':_0xc119c6['params']['id']}})[_0x5f9f('0x27')](handleEntityNotFound(_0x28e70d,null))[_0x5f9f('0x27')](removeEntity(_0x28e70d,null))[_0x5f9f('0x4b')](handleError(_0x28e70d,null));};exports[_0x5f9f('0x4e')]=function(_0x149694,_0x34b185){return db['MailTransferReport']['describe']()[_0x5f9f('0x27')](respondWithResult(_0x34b185,null))[_0x5f9f('0x4b')](handleError(_0x34b185,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 68616a4..d937fbf 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 _0x9f62=['define','MailTransferReport','report_mail_transfer','uniqueid','util','api','moment','bluebird','rimraf','../../config/environment','./mailTransferReport.attributes','exports'];(function(_0x257642,_0x270a80){var _0x3d813b=function(_0x2a1c8a){while(--_0x2a1c8a){_0x257642['push'](_0x257642['shift']());}};_0x3d813b(++_0x270a80);}(_0x9f62,0x154));var _0x29f6=function(_0x10c676,_0x3afed4){_0x10c676=_0x10c676-0x0;var _0xca206d=_0x9f62[_0x10c676];return _0xca206d;};'use strict';var _=require('lodash');var util=require(_0x29f6('0x0'));var logger=require('../../config/logger')(_0x29f6('0x1'));var moment=require(_0x29f6('0x2'));var BPromise=require(_0x29f6('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x29f6('0x4'));var config=require(_0x29f6('0x5'));var attributes=require(_0x29f6('0x6'));module[_0x29f6('0x7')]=function(_0x595034,_0xf66137){return _0x595034[_0x29f6('0x8')](_0x29f6('0x9'),attributes,{'tableName':_0x29f6('0xa'),'paranoid':![],'indexes':[{'name':_0x29f6('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xd6d2=['util','api','moment','request-promise','rimraf','../../config/environment','./mailTransferReport.attributes','define','MailTransferReport','report_mail_transfer','uniqueid','lodash'];(function(_0x4f676e,_0x571ace){var _0x542a9b=function(_0x31a202){while(--_0x31a202){_0x4f676e['push'](_0x4f676e['shift']());}};_0x542a9b(++_0x571ace);}(_0xd6d2,0xcb));var _0x2d6d=function(_0x2f3e0b,_0x589362){_0x2f3e0b=_0x2f3e0b-0x0;var _0x14ca0c=_0xd6d2[_0x2f3e0b];return _0x14ca0c;};'use strict';var _=require(_0x2d6d('0x0'));var util=require(_0x2d6d('0x1'));var logger=require('../../config/logger')(_0x2d6d('0x2'));var moment=require(_0x2d6d('0x3'));var BPromise=require('bluebird');var rp=require(_0x2d6d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2d6d('0x5'));var config=require(_0x2d6d('0x6'));var attributes=require(_0x2d6d('0x7'));module['exports']=function(_0xfcdb1d,_0x132361){return _0xfcdb1d[_0x2d6d('0x8')](_0x2d6d('0x9'),attributes,{'tableName':_0x2d6d('0xa'),'paranoid':![],'indexes':[{'name':_0x2d6d('0xb'),'fields':[_0x2d6d('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 53357d9..ec8c62d 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 _0xdc4f=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','error','code','MailTransferReport,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird'];(function(_0x3150bf,_0x36fe5a){var _0x2c93e0=function(_0x301cc0){while(--_0x301cc0){_0x3150bf['push'](_0x3150bf['shift']());}};_0x2c93e0(++_0x36fe5a);}(_0xdc4f,0x9d));var _0xfdc4=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xdc4f[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xfdc4('0x0'));var util=require(_0xfdc4('0x1'));var moment=require(_0xfdc4('0x2'));var BPromise=require(_0xfdc4('0x3'));var rs=require(_0xfdc4('0x4'));var fs=require('fs');var Redis=require(_0xfdc4('0x5'));var db=require(_0xfdc4('0x6'))['db'];var utils=require(_0xfdc4('0x7'));var logger=require(_0xfdc4('0x8'))(_0xfdc4('0x9'));var config=require(_0xfdc4('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xfdc4('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x195fce,_0x11fada,_0x34f619){return new BPromise(function(_0x579c3a,_0x1cf83c){return client[_0xfdc4('0xc')](_0x195fce,_0x34f619)[_0xfdc4('0xd')](function(_0x1642dc){logger[_0xfdc4('0xe')]('MailTransferReport,\x20%s,\x20%s',_0x11fada,_0xfdc4('0xf'));logger[_0xfdc4('0x10')](_0xfdc4('0x11'),_0x11fada,_0xfdc4('0xf'),JSON['stringify'](_0x1642dc));if(_0x1642dc[_0xfdc4('0x12')]){if(_0x1642dc[_0xfdc4('0x12')][_0xfdc4('0x13')]===0x1f4){logger[_0xfdc4('0x12')](_0xfdc4('0x14'),_0x11fada,_0x1642dc[_0xfdc4('0x12')][_0xfdc4('0x15')]);return _0x1cf83c(_0x1642dc[_0xfdc4('0x12')][_0xfdc4('0x15')]);}logger[_0xfdc4('0x12')](_0xfdc4('0x14'),_0x11fada,_0x1642dc[_0xfdc4('0x12')][_0xfdc4('0x15')]);return _0x579c3a(_0x1642dc[_0xfdc4('0x12')][_0xfdc4('0x15')]);}else{logger[_0xfdc4('0xe')](_0xfdc4('0x14'),_0x11fada,_0xfdc4('0xf'));_0x579c3a(_0x1642dc[_0xfdc4('0x16')][_0xfdc4('0x15')]);}})['catch'](function(_0x20795a){logger[_0xfdc4('0x12')](_0xfdc4('0x14'),_0x11fada,_0x20795a);_0x1cf83c(_0x20795a);});});} \ No newline at end of file +var _0x4754=['MailTransferReport,\x20%s,\x20%s','message','catch','moment','bluebird','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x4bc7e5,_0x54c463){var _0x35c7da=function(_0x52dcb5){while(--_0x52dcb5){_0x4bc7e5['push'](_0x4bc7e5['shift']());}};_0x35c7da(++_0x54c463);}(_0x4754,0x75));var _0x4475=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4754[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4475('0x0'));var BPromise=require(_0x4475('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4475('0x2'))['db'];var utils=require(_0x4475('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0x4475('0x4'));var jayson=require(_0x4475('0x5'));var client=jayson[_0x4475('0x6')][_0x4475('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x103799,_0x99ae52,_0x41c0d3){return new BPromise(function(_0x57a445,_0x4abb91){return client[_0x4475('0x8')](_0x103799,_0x41c0d3)[_0x4475('0x9')](function(_0x423a4a){logger[_0x4475('0xa')]('MailTransferReport,\x20%s,\x20%s',_0x99ae52,_0x4475('0xb'));logger[_0x4475('0xc')](_0x4475('0xd'),_0x99ae52,_0x4475('0xb'),JSON[_0x4475('0xe')](_0x423a4a));if(_0x423a4a[_0x4475('0xf')]){if(_0x423a4a[_0x4475('0xf')]['code']===0x1f4){logger['error'](_0x4475('0x10'),_0x99ae52,_0x423a4a['error']['message']);return _0x4abb91(_0x423a4a[_0x4475('0xf')]['message']);}logger[_0x4475('0xf')](_0x4475('0x10'),_0x99ae52,_0x423a4a[_0x4475('0xf')][_0x4475('0x11')]);return _0x57a445(_0x423a4a['error'][_0x4475('0x11')]);}else{logger[_0x4475('0xa')](_0x4475('0x10'),_0x99ae52,_0x4475('0xb'));_0x57a445(_0x423a4a['result'][_0x4475('0x11')]);}})[_0x4475('0x12')](function(_0x4f9bb7){logger[_0x4475('0xf')]('MailTransferReport,\x20%s,\x20%s',_0x99ae52,_0x4f9bb7);_0x4abb91(_0x4f9bb7);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 2733f4e..5541b30 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 _0x703f=['show','post','create','put','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./memberReport.controller','get','isAuthenticated','/describe','describe','/:id'];(function(_0x2cdf1f,_0x94f532){var _0x3e6af9=function(_0x2680de){while(--_0x2680de){_0x2cdf1f['push'](_0x2cdf1f['shift']());}};_0x3e6af9(++_0x94f532);}(_0x703f,0xf6));var _0xf703=function(_0x3a285d,_0x449b5a){_0x3a285d=_0x3a285d-0x0;var _0x378bfd=_0x703f[_0x3a285d];return _0x378bfd;};'use strict';var multer=require(_0xf703('0x0'));var util=require(_0xf703('0x1'));var path=require('path');var timeout=require(_0xf703('0x2'));var express=require(_0xf703('0x3'));var router=express[_0xf703('0x4')]();var fs_extra=require(_0xf703('0x5'));var auth=require(_0xf703('0x6'));var interaction=require(_0xf703('0x7'));var config=require('../../config/environment');var controller=require(_0xf703('0x8'));router[_0xf703('0x9')]('/',auth[_0xf703('0xa')](),controller['index']);router['get'](_0xf703('0xb'),auth['isAuthenticated'](),controller[_0xf703('0xc')]);router['get'](_0xf703('0xd'),auth['isAuthenticated'](),controller[_0xf703('0xe')]);router[_0xf703('0xf')]('/',auth[_0xf703('0xa')](),controller[_0xf703('0x10')]);router[_0xf703('0x11')]('/:id',auth[_0xf703('0xa')](),controller['update']);router['delete'](_0xf703('0xd'),auth['isAuthenticated'](),controller[_0xf703('0x12')]);module[_0xf703('0x13')]=router; \ No newline at end of file +var _0x85d7=['../../config/environment','./memberReport.controller','get','isAuthenticated','/describe','/:id','show','post','create','put','delete','destroy','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x48a8ec,_0x35e2f0){var _0x2998a2=function(_0x223042){while(--_0x223042){_0x48a8ec['push'](_0x48a8ec['shift']());}};_0x2998a2(++_0x35e2f0);}(_0x85d7,0x188));var _0x785d=function(_0x599aaf,_0x3d3622){_0x599aaf=_0x599aaf-0x0;var _0xd995f3=_0x85d7[_0x599aaf];return _0xd995f3;};'use strict';var multer=require(_0x785d('0x0'));var util=require('util');var path=require(_0x785d('0x1'));var timeout=require(_0x785d('0x2'));var express=require(_0x785d('0x3'));var router=express[_0x785d('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x785d('0x5'));var interaction=require(_0x785d('0x6'));var config=require(_0x785d('0x7'));var controller=require(_0x785d('0x8'));router[_0x785d('0x9')]('/',auth[_0x785d('0xa')](),controller['index']);router['get'](_0x785d('0xb'),auth[_0x785d('0xa')](),controller['describe']);router[_0x785d('0x9')](_0x785d('0xc'),auth[_0x785d('0xa')](),controller[_0x785d('0xd')]);router[_0x785d('0xe')]('/',auth[_0x785d('0xa')](),controller[_0x785d('0xf')]);router[_0x785d('0x10')](_0x785d('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x785d('0x11')](_0x785d('0xc'),auth[_0x785d('0xa')](),controller[_0x785d('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 c4c4316..8dc84aa 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 _0x42d6=['duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','enterAt','seconds','setDataValue','exitAt'];(function(_0x72f0d6,_0x1ba28b){var _0x1a73e8=function(_0x883490){while(--_0x883490){_0x72f0d6['push'](_0x72f0d6['shift']());}};_0x1a73e8(++_0x1ba28b);}(_0x42d6,0x1f4));var _0x642d=function(_0x550ac9,_0x5e8504){_0x550ac9=_0x550ac9-0x0;var _0x54a679=_0x42d6[_0x550ac9];return _0x54a679;};'use strict';var Sequelize=require(_0x642d('0x0'));var moment=require(_0x642d('0x1'));module[_0x642d('0x2')]={'channel':{'type':Sequelize[_0x642d('0x3')]},'membername':{'type':Sequelize[_0x642d('0x3')]},'interface':{'type':Sequelize[_0x642d('0x3')]},'type':{'type':Sequelize[_0x642d('0x3')],'defaultValue':_0x642d('0x4'),'comment':_0x642d('0x5')},'duration':{'type':Sequelize[_0x642d('0x6')]},'enterAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x642d('0x7')],'set':function(_0x2f661f){var _0x383ea9=moment(_0x2f661f);var _0x3eb478=moment(this[_0x642d('0x8')](_0x642d('0x9')));var _0x5c868f=_0x383ea9['diff'](_0x3eb478,_0x642d('0xa'));this[_0x642d('0xb')](_0x642d('0xc'),_0x2f661f);this[_0x642d('0xb')](_0x642d('0xd'),_0x5c868f>=0x0?_0x5c868f:null);}},'data1':{'type':Sequelize[_0x642d('0x3')],'comment':_0x642d('0xe')},'data2':{'type':Sequelize[_0x642d('0x3')],'comment':_0x642d('0xf')},'data3':{'type':Sequelize['STRING'],'comment':_0x642d('0x10')},'data4':{'type':Sequelize[_0x642d('0x3')],'comment':_0x642d('0x11')},'data5':{'type':Sequelize[_0x642d('0x3')],'comment':_0x642d('0x12')},'role':{'type':Sequelize[_0x642d('0x3')]},'internal':{'type':Sequelize[_0x642d('0x6')]},'uniqueid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x56c7=['exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[dial\x20string]','sequelize','moment','exports','STRING','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','enterAt','seconds','setDataValue'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x56c7,0x6e));var _0x756c=function(_0x566168,_0x4c39af){_0x566168=_0x566168-0x0;var _0x4e1f7a=_0x56c7[_0x566168];return _0x4e1f7a;};'use strict';var Sequelize=require(_0x756c('0x0'));var moment=require(_0x756c('0x1'));module[_0x756c('0x2')]={'channel':{'type':Sequelize[_0x756c('0x3')]},'membername':{'type':Sequelize[_0x756c('0x3')]},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x756c('0x3')],'defaultValue':'DEFAULT\x20PAUSE','comment':_0x756c('0x4')},'duration':{'type':Sequelize[_0x756c('0x5')]},'enterAt':{'type':Sequelize[_0x756c('0x6')]},'exitAt':{'type':Sequelize['DATE'],'set':function(_0x24a105){var _0x3161d2=moment(_0x24a105);var _0x5a52e9=moment(this['getDataValue'](_0x756c('0x7')));var _0x12e5f0=_0x3161d2['diff'](_0x5a52e9,_0x756c('0x8'));this[_0x756c('0x9')](_0x756c('0xa'),_0x24a105);this['setDataValue'](_0x756c('0xb'),_0x12e5f0>=0x0?_0x12e5f0:null);}},'data1':{'type':Sequelize[_0x756c('0x3')],'comment':_0x756c('0xc')},'data2':{'type':Sequelize['STRING'],'comment':_0x756c('0xd')},'data3':{'type':Sequelize['STRING'],'comment':'talk:[destination]'},'data4':{'type':Sequelize[_0x756c('0x3')],'comment':_0x756c('0xe')},'data5':{'type':Sequelize[_0x756c('0x3')],'comment':'talk:[queue]'},'role':{'type':Sequelize[_0x756c('0x3')]},'internal':{'type':Sequelize[_0x756c('0x5')]},'uniqueid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index d43a27a..5bfd064 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 _0x55ca=['merge','filter','includeAll','include','findAll','rawAttributes','options','create','body','find','params','catch','destroy','describe','eml-format','rimraf','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','reject','update','then','end','sendStatus','error','stack','name','send','index','map','MemberReport','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x55ca,0x126));var _0xa55c=function(_0x3dc587,_0x2ebc6c){_0x3dc587=_0x3dc587-0x0;var _0x29f93a=_0x55ca[_0x3dc587];return _0x29f93a;};'use strict';var emlformat=require(_0xa55c('0x0'));var rimraf=require(_0xa55c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa55c('0x2'));var BPromise=require(_0xa55c('0x3'));var Mustache=require('mustache');var util=require(_0xa55c('0x4'));var path=require(_0xa55c('0x5'));var sox=require(_0xa55c('0x6'));var csv=require(_0xa55c('0x7'));var ejs=require(_0xa55c('0x8'));var fs=require('fs');var fs_extra=require(_0xa55c('0x9'));var _=require(_0xa55c('0xa'));var squel=require('squel');var crypto=require(_0xa55c('0xb'));var jsforce=require(_0xa55c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa55c('0x7'));var querystring=require(_0xa55c('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa55c('0xe'));var qs=require(_0xa55c('0xf'));var as=require(_0xa55c('0x10'));var hardwareService=require(_0xa55c('0x11'));var logger=require(_0xa55c('0x12'))(_0xa55c('0x13'));var utils=require(_0xa55c('0x14'));var config=require(_0xa55c('0x15'));var licenseUtil=require(_0xa55c('0x16'));var db=require(_0xa55c('0x17'))['db'];function respondWithStatusCode(_0x5d47ff,_0x59d84a){_0x59d84a=_0x59d84a||0xcc;return function(_0x2a35be){if(_0x2a35be){return _0x5d47ff['sendStatus'](_0x59d84a);}return _0x5d47ff['status'](_0x59d84a)['end']();};}function respondWithResult(_0x18ee85,_0x3930e4){_0x3930e4=_0x3930e4||0xc8;return function(_0x462cd6){if(_0x462cd6){return _0x18ee85[_0xa55c('0x18')](_0x3930e4)[_0xa55c('0x19')](_0x462cd6);}};}function respondWithFilteredResult(_0x247e77,_0x4e0b2f){return function(_0x3ccf65){if(_0x3ccf65){var _0x3dcf4f=typeof _0x4e0b2f[_0xa55c('0x1a')]===_0xa55c('0x1b')&&typeof _0x4e0b2f[_0xa55c('0x1c')]===_0xa55c('0x1b');var _0x51590e=_0x3ccf65[_0xa55c('0x1d')];var _0x24783b=_0x3dcf4f?0x0:_0x4e0b2f['offset'];var _0x3d4c9e=_0x3dcf4f?_0x3ccf65[_0xa55c('0x1d')]:_0x4e0b2f[_0xa55c('0x1a')]+_0x4e0b2f[_0xa55c('0x1c')];var _0x23a1ae;if(_0x3d4c9e>=_0x51590e){_0x3d4c9e=_0x51590e;_0x23a1ae=0xc8;}else{_0x23a1ae=0xce;}_0x247e77[_0xa55c('0x18')](_0x23a1ae);return _0x247e77['set']('Content-Range',_0x24783b+'-'+_0x3d4c9e+'/'+_0x51590e)[_0xa55c('0x19')](_0x3ccf65);}return null;};}function patchUpdates(_0x3776ac){return function(_0xade4c4){try{jsonpatch['apply'](_0xade4c4,_0x3776ac,!![]);}catch(_0x383d92){return BPromise[_0xa55c('0x1e')](_0x383d92);}return _0xade4c4['save']();};}function saveUpdates(_0x187a87,_0x133096){return function(_0x940f28){if(_0x940f28){return _0x940f28[_0xa55c('0x1f')](_0x187a87)[_0xa55c('0x20')](function(_0x49ed04){return _0x49ed04;});}return null;};}function removeEntity(_0x1fc828,_0x504c24){return function(_0x5ba836){if(_0x5ba836){return _0x5ba836['destroy']()[_0xa55c('0x20')](function(){_0x1fc828['status'](0xcc)[_0xa55c('0x21')]();});}};}function handleEntityNotFound(_0x190757,_0x3f64de){return function(_0xf0e574){if(!_0xf0e574){_0x190757[_0xa55c('0x22')](0x194);}return _0xf0e574;};}function handleError(_0x170ba4,_0x1da633){_0x1da633=_0x1da633||0x1f4;return function(_0x11e7f7){logger[_0xa55c('0x23')](_0x11e7f7[_0xa55c('0x24')]);if(_0x11e7f7[_0xa55c('0x25')]){delete _0x11e7f7['name'];}_0x170ba4[_0xa55c('0x18')](_0x1da633)[_0xa55c('0x26')](_0x11e7f7);};}exports[_0xa55c('0x27')]=function(_0x906caa,_0x5d940d){var _0x1377b0={},_0x22f6b6={},_0x1b8388={'count':0x0,'rows':[]};var _0x201941=_[_0xa55c('0x28')](db[_0xa55c('0x29')]['rawAttributes'],function(_0x23e698){return{'name':_0x23e698['fieldName'],'type':_0x23e698[_0xa55c('0x2a')][_0xa55c('0x2b')]};});_0x22f6b6[_0xa55c('0x2c')]=_[_0xa55c('0x28')](_0x201941,'name');_0x22f6b6[_0xa55c('0x2d')]=_[_0xa55c('0x2e')](_0x906caa[_0xa55c('0x2d')]);_0x22f6b6[_0xa55c('0x2f')]=_[_0xa55c('0x30')](_0x22f6b6[_0xa55c('0x2c')],_0x22f6b6[_0xa55c('0x2d')]);_0x1377b0[_0xa55c('0x31')]=_[_0xa55c('0x30')](_0x22f6b6[_0xa55c('0x2c')],qs[_0xa55c('0x32')](_0x906caa['query']['fields']));_0x1377b0[_0xa55c('0x31')]=_0x1377b0[_0xa55c('0x31')]['length']?_0x1377b0[_0xa55c('0x31')]:_0x22f6b6[_0xa55c('0x2c')];if(!_0x906caa[_0xa55c('0x2d')][_0xa55c('0x33')](_0xa55c('0x34'))){_0x1377b0[_0xa55c('0x1c')]=qs[_0xa55c('0x1c')](_0x906caa[_0xa55c('0x2d')][_0xa55c('0x1c')]);_0x1377b0['offset']=qs['offset'](_0x906caa['query'][_0xa55c('0x1a')]);}_0x1377b0[_0xa55c('0x35')]=qs[_0xa55c('0x36')](_0x906caa['query'][_0xa55c('0x36')]);_0x1377b0['where']=qs[_0xa55c('0x2f')](_['pick'](_0x906caa[_0xa55c('0x2d')],_0x22f6b6[_0xa55c('0x2f')]),_0x201941);if(_0x906caa[_0xa55c('0x2d')]['filter']){_0x1377b0[_0xa55c('0x37')]=_[_0xa55c('0x38')](_0x1377b0['where'],{'$or':_[_0xa55c('0x28')](_0x201941,function(_0x194e78){if(_0x194e78['type']!=='VIRTUAL'){var _0x235f6b={};_0x235f6b[_0x194e78['name']]={'$like':'%'+_0x906caa[_0xa55c('0x2d')][_0xa55c('0x39')]+'%'};return _0x235f6b;}})});}_0x1377b0=_['merge']({},_0x1377b0,_0x906caa['options']);var _0x5e50b6={'where':_0x1377b0['where']};return db[_0xa55c('0x29')][_0xa55c('0x1d')](_0x5e50b6)[_0xa55c('0x20')](function(_0x99c4f8){_0x1b8388[_0xa55c('0x1d')]=_0x99c4f8;if(_0x906caa['query'][_0xa55c('0x3a')]){_0x1377b0[_0xa55c('0x3b')]=[{'all':!![]}];}return db[_0xa55c('0x29')][_0xa55c('0x3c')](_0x1377b0);})[_0xa55c('0x20')](function(_0x23cef5){_0x1b8388['rows']=_0x23cef5;return _0x1b8388;})[_0xa55c('0x20')](respondWithFilteredResult(_0x5d940d,_0x1377b0))['catch'](handleError(_0x5d940d,null));};exports['show']=function(_0x404e7f,_0x1f63d8){var _0x496920={'raw':!![],'where':{'id':_0x404e7f['params']['id']}},_0x2bd98b={};_0x2bd98b['model']=_[_0xa55c('0x2e')](db[_0xa55c('0x29')][_0xa55c('0x3d')]);_0x2bd98b['query']=_[_0xa55c('0x2e')](_0x404e7f[_0xa55c('0x2d')]);_0x2bd98b['filters']=_[_0xa55c('0x30')](_0x2bd98b['model'],_0x2bd98b[_0xa55c('0x2d')]);_0x496920[_0xa55c('0x31')]=_['intersection'](_0x2bd98b[_0xa55c('0x2c')],qs[_0xa55c('0x32')](_0x404e7f['query'][_0xa55c('0x32')]));_0x496920[_0xa55c('0x31')]=_0x496920[_0xa55c('0x31')]['length']?_0x496920[_0xa55c('0x31')]:_0x2bd98b['model'];if(_0x404e7f[_0xa55c('0x2d')][_0xa55c('0x3a')]){_0x496920[_0xa55c('0x3b')]=[{'all':!![]}];}_0x496920=_['merge']({},_0x496920,_0x404e7f[_0xa55c('0x3e')]);return db[_0xa55c('0x29')]['find'](_0x496920)[_0xa55c('0x20')](handleEntityNotFound(_0x1f63d8,null))[_0xa55c('0x20')](respondWithResult(_0x1f63d8,null))['catch'](handleError(_0x1f63d8,null));};exports[_0xa55c('0x3f')]=function(_0xd3fe78,_0x52f9a7){return db[_0xa55c('0x29')][_0xa55c('0x3f')](_0xd3fe78[_0xa55c('0x40')],{})[_0xa55c('0x20')](respondWithResult(_0x52f9a7,0xc9))['catch'](handleError(_0x52f9a7,null));};exports[_0xa55c('0x1f')]=function(_0x58a7ea,_0x2157d6){if(_0x58a7ea[_0xa55c('0x40')]['id']){delete _0x58a7ea[_0xa55c('0x40')]['id'];}return db['MemberReport'][_0xa55c('0x41')]({'where':{'id':_0x58a7ea[_0xa55c('0x42')]['id']}})['then'](handleEntityNotFound(_0x2157d6,null))[_0xa55c('0x20')](saveUpdates(_0x58a7ea[_0xa55c('0x40')],null))[_0xa55c('0x20')](respondWithResult(_0x2157d6,null))[_0xa55c('0x43')](handleError(_0x2157d6,null));};exports[_0xa55c('0x44')]=function(_0x1c84d9,_0x1e1293){return db[_0xa55c('0x29')][_0xa55c('0x41')]({'where':{'id':_0x1c84d9[_0xa55c('0x42')]['id']}})['then'](handleEntityNotFound(_0x1e1293,null))[_0xa55c('0x20')](removeEntity(_0x1e1293,null))[_0xa55c('0x43')](handleError(_0x1e1293,null));};exports[_0xa55c('0x45')]=function(_0x4f73b6,_0x4c3095){return db[_0xa55c('0x29')]['describe']()[_0xa55c('0x20')](respondWithResult(_0x4c3095,null))['catch'](handleError(_0x4c3095,null));}; \ No newline at end of file +var _0x3e74=['show','params','options','find','catch','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','end','json','undefined','limit','offset','count','status','set','Content-Range','apply','save','update','then','destroy','sendStatus','name','send','index','map','MemberReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows'];(function(_0x465178,_0x550786){var _0xfad3f3=function(_0x5d8b9b){while(--_0x5d8b9b){_0x465178['push'](_0x465178['shift']());}};_0xfad3f3(++_0x550786);}(_0x3e74,0x175));var _0x43e7=function(_0x474f1e,_0x128f29){_0x474f1e=_0x474f1e-0x0;var _0x31be22=_0x3e74[_0x474f1e];return _0x31be22;};'use strict';var emlformat=require(_0x43e7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x43e7('0x1'));var jsonpatch=require(_0x43e7('0x2'));var rp=require(_0x43e7('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x43e7('0x4'));var util=require('util');var path=require(_0x43e7('0x5'));var sox=require(_0x43e7('0x6'));var csv=require(_0x43e7('0x7'));var ejs=require(_0x43e7('0x8'));var fs=require('fs');var fs_extra=require(_0x43e7('0x9'));var _=require('lodash');var squel=require(_0x43e7('0xa'));var crypto=require(_0x43e7('0xb'));var jsforce=require(_0x43e7('0xc'));var deskjs=require(_0x43e7('0xd'));var toCsv=require(_0x43e7('0x7'));var querystring=require('querystring');var Papa=require(_0x43e7('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x43e7('0xf'));var as=require(_0x43e7('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x43e7('0x11'))('api');var utils=require(_0x43e7('0x12'));var config=require(_0x43e7('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x43e7('0x14'))['db'];function respondWithStatusCode(_0xc960ea,_0x2718d3){_0x2718d3=_0x2718d3||0xcc;return function(_0x3bb83f){if(_0x3bb83f){return _0xc960ea['sendStatus'](_0x2718d3);}return _0xc960ea['status'](_0x2718d3)[_0x43e7('0x15')]();};}function respondWithResult(_0x21fdd3,_0x44b0bd){_0x44b0bd=_0x44b0bd||0xc8;return function(_0x51b974){if(_0x51b974){return _0x21fdd3['status'](_0x44b0bd)[_0x43e7('0x16')](_0x51b974);}};}function respondWithFilteredResult(_0x14c146,_0x203378){return function(_0x328445){if(_0x328445){var _0x4de324=typeof _0x203378['offset']===_0x43e7('0x17')&&typeof _0x203378[_0x43e7('0x18')]===_0x43e7('0x17');var _0x5d346f=_0x328445['count'];var _0x446986=_0x4de324?0x0:_0x203378[_0x43e7('0x19')];var _0x9037d3=_0x4de324?_0x328445[_0x43e7('0x1a')]:_0x203378[_0x43e7('0x19')]+_0x203378[_0x43e7('0x18')];var _0x619236;if(_0x9037d3>=_0x5d346f){_0x9037d3=_0x5d346f;_0x619236=0xc8;}else{_0x619236=0xce;}_0x14c146[_0x43e7('0x1b')](_0x619236);return _0x14c146[_0x43e7('0x1c')](_0x43e7('0x1d'),_0x446986+'-'+_0x9037d3+'/'+_0x5d346f)[_0x43e7('0x16')](_0x328445);}return null;};}function patchUpdates(_0x177ee1){return function(_0x4b5d64){try{jsonpatch[_0x43e7('0x1e')](_0x4b5d64,_0x177ee1,!![]);}catch(_0x3c6625){return BPromise['reject'](_0x3c6625);}return _0x4b5d64[_0x43e7('0x1f')]();};}function saveUpdates(_0x3e281e,_0x3945bb){return function(_0x28aacc){if(_0x28aacc){return _0x28aacc[_0x43e7('0x20')](_0x3e281e)[_0x43e7('0x21')](function(_0x54a9e7){return _0x54a9e7;});}return null;};}function removeEntity(_0x454359,_0x4eea52){return function(_0x4c9df3){if(_0x4c9df3){return _0x4c9df3[_0x43e7('0x22')]()[_0x43e7('0x21')](function(){_0x454359['status'](0xcc)[_0x43e7('0x15')]();});}};}function handleEntityNotFound(_0x4ca5cf,_0x326dab){return function(_0x5c5e67){if(!_0x5c5e67){_0x4ca5cf[_0x43e7('0x23')](0x194);}return _0x5c5e67;};}function handleError(_0x1b5f50,_0x20888b){_0x20888b=_0x20888b||0x1f4;return function(_0x405f85){logger['error'](_0x405f85['stack']);if(_0x405f85[_0x43e7('0x24')]){delete _0x405f85['name'];}_0x1b5f50[_0x43e7('0x1b')](_0x20888b)[_0x43e7('0x25')](_0x405f85);};}exports[_0x43e7('0x26')]=function(_0xb1fc63,_0x5087d7){var _0x33a1a5={},_0x4690a6={},_0x45b675={'count':0x0,'rows':[]};var _0x50f9f5=_[_0x43e7('0x27')](db[_0x43e7('0x28')][_0x43e7('0x29')],function(_0x31b2a6){return{'name':_0x31b2a6[_0x43e7('0x2a')],'type':_0x31b2a6[_0x43e7('0x2b')][_0x43e7('0x2c')]};});_0x4690a6[_0x43e7('0x2d')]=_[_0x43e7('0x27')](_0x50f9f5,_0x43e7('0x24'));_0x4690a6['query']=_[_0x43e7('0x2e')](_0xb1fc63[_0x43e7('0x2f')]);_0x4690a6[_0x43e7('0x30')]=_[_0x43e7('0x31')](_0x4690a6[_0x43e7('0x2d')],_0x4690a6['query']);_0x33a1a5[_0x43e7('0x32')]=_[_0x43e7('0x31')](_0x4690a6[_0x43e7('0x2d')],qs[_0x43e7('0x33')](_0xb1fc63['query']['fields']));_0x33a1a5['attributes']=_0x33a1a5[_0x43e7('0x32')][_0x43e7('0x34')]?_0x33a1a5[_0x43e7('0x32')]:_0x4690a6[_0x43e7('0x2d')];if(!_0xb1fc63[_0x43e7('0x2f')][_0x43e7('0x35')]('nolimit')){_0x33a1a5['limit']=qs['limit'](_0xb1fc63['query']['limit']);_0x33a1a5['offset']=qs['offset'](_0xb1fc63[_0x43e7('0x2f')]['offset']);}_0x33a1a5[_0x43e7('0x36')]=qs[_0x43e7('0x37')](_0xb1fc63[_0x43e7('0x2f')][_0x43e7('0x37')]);_0x33a1a5[_0x43e7('0x38')]=qs[_0x43e7('0x30')](_[_0x43e7('0x39')](_0xb1fc63['query'],_0x4690a6['filters']),_0x50f9f5);if(_0xb1fc63['query'][_0x43e7('0x3a')]){_0x33a1a5[_0x43e7('0x38')]=_[_0x43e7('0x3b')](_0x33a1a5[_0x43e7('0x38')],{'$or':_[_0x43e7('0x27')](_0x50f9f5,function(_0x1ed538){if(_0x1ed538[_0x43e7('0x2b')]!==_0x43e7('0x3c')){var _0x55c798={};_0x55c798[_0x1ed538[_0x43e7('0x24')]]={'$like':'%'+_0xb1fc63[_0x43e7('0x2f')]['filter']+'%'};return _0x55c798;}})});}_0x33a1a5=_[_0x43e7('0x3b')]({},_0x33a1a5,_0xb1fc63['options']);var _0x44d8e4={'where':_0x33a1a5[_0x43e7('0x38')]};return db[_0x43e7('0x28')][_0x43e7('0x1a')](_0x44d8e4)[_0x43e7('0x21')](function(_0x234d8f){_0x45b675['count']=_0x234d8f;if(_0xb1fc63['query'][_0x43e7('0x3d')]){_0x33a1a5[_0x43e7('0x3e')]=[{'all':!![]}];}return db[_0x43e7('0x28')][_0x43e7('0x3f')](_0x33a1a5);})[_0x43e7('0x21')](function(_0x4a4a85){_0x45b675[_0x43e7('0x40')]=_0x4a4a85;return _0x45b675;})[_0x43e7('0x21')](respondWithFilteredResult(_0x5087d7,_0x33a1a5))['catch'](handleError(_0x5087d7,null));};exports[_0x43e7('0x41')]=function(_0x51a69c,_0x2ad8ef){var _0x504101={'raw':!![],'where':{'id':_0x51a69c[_0x43e7('0x42')]['id']}},_0x3d81ae={};_0x3d81ae[_0x43e7('0x2d')]=_[_0x43e7('0x2e')](db['MemberReport']['rawAttributes']);_0x3d81ae[_0x43e7('0x2f')]=_[_0x43e7('0x2e')](_0x51a69c[_0x43e7('0x2f')]);_0x3d81ae[_0x43e7('0x30')]=_['intersection'](_0x3d81ae['model'],_0x3d81ae['query']);_0x504101[_0x43e7('0x32')]=_['intersection'](_0x3d81ae[_0x43e7('0x2d')],qs['fields'](_0x51a69c['query'][_0x43e7('0x33')]));_0x504101['attributes']=_0x504101[_0x43e7('0x32')][_0x43e7('0x34')]?_0x504101[_0x43e7('0x32')]:_0x3d81ae[_0x43e7('0x2d')];if(_0x51a69c['query'][_0x43e7('0x3d')]){_0x504101[_0x43e7('0x3e')]=[{'all':!![]}];}_0x504101=_[_0x43e7('0x3b')]({},_0x504101,_0x51a69c[_0x43e7('0x43')]);return db[_0x43e7('0x28')][_0x43e7('0x44')](_0x504101)['then'](handleEntityNotFound(_0x2ad8ef,null))['then'](respondWithResult(_0x2ad8ef,null))[_0x43e7('0x45')](handleError(_0x2ad8ef,null));};exports[_0x43e7('0x46')]=function(_0x212841,_0x4c00a8){return db['MemberReport']['create'](_0x212841[_0x43e7('0x47')],{})[_0x43e7('0x21')](respondWithResult(_0x4c00a8,0xc9))['catch'](handleError(_0x4c00a8,null));};exports[_0x43e7('0x20')]=function(_0x47686e,_0x3c96fe){if(_0x47686e['body']['id']){delete _0x47686e['body']['id'];}return db['MemberReport']['find']({'where':{'id':_0x47686e[_0x43e7('0x42')]['id']}})[_0x43e7('0x21')](handleEntityNotFound(_0x3c96fe,null))['then'](saveUpdates(_0x47686e[_0x43e7('0x47')],null))[_0x43e7('0x21')](respondWithResult(_0x3c96fe,null))[_0x43e7('0x45')](handleError(_0x3c96fe,null));};exports[_0x43e7('0x22')]=function(_0x4a0ce5,_0x2718d5){return db['MemberReport']['find']({'where':{'id':_0x4a0ce5[_0x43e7('0x42')]['id']}})[_0x43e7('0x21')](handleEntityNotFound(_0x2718d5,null))[_0x43e7('0x21')](removeEntity(_0x2718d5,null))[_0x43e7('0x45')](handleError(_0x2718d5,null));};exports[_0x43e7('0x48')]=function(_0x2351cf,_0x1cd87c){return db[_0x43e7('0x28')][_0x43e7('0x48')]()[_0x43e7('0x21')](respondWithResult(_0x1cd87c,null))['catch'](handleError(_0x1cd87c,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 8e1d0fa..6a4a053 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 _0x5836=['lodash','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./memberReport.attributes','exports','define','MemberReport','report_member','membername_interface','membername','interface'];(function(_0x72a833,_0x31c60e){var _0x2977ed=function(_0x5a80cd){while(--_0x5a80cd){_0x72a833['push'](_0x72a833['shift']());}};_0x2977ed(++_0x31c60e);}(_0x5836,0x12c));var _0x6583=function(_0x1daaa9,_0x220393){_0x1daaa9=_0x1daaa9-0x0;var _0x1dd221=_0x5836[_0x1daaa9];return _0x1dd221;};'use strict';var _=require(_0x6583('0x0'));var util=require('util');var logger=require(_0x6583('0x1'))(_0x6583('0x2'));var moment=require('moment');var BPromise=require(_0x6583('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6583('0x4'));var rimraf=require(_0x6583('0x5'));var config=require(_0x6583('0x6'));var attributes=require(_0x6583('0x7'));module[_0x6583('0x8')]=function(_0x4cd71c,_0x17d685){return _0x4cd71c[_0x6583('0x9')](_0x6583('0xa'),attributes,{'tableName':_0x6583('0xb'),'paranoid':![],'indexes':[{'name':_0x6583('0xc'),'fields':[_0x6583('0xd'),_0x6583('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf51f=['path','rimraf','../../config/environment','./memberReport.attributes','exports','define','MemberReport','membername','interface','lodash','util','api','moment','request-promise'];(function(_0x1115fc,_0x3f6384){var _0x4fd5d5=function(_0x4a22b9){while(--_0x4a22b9){_0x1115fc['push'](_0x1115fc['shift']());}};_0x4fd5d5(++_0x3f6384);}(_0xf51f,0x19f));var _0xff51=function(_0x1b1e76,_0x31695b){_0x1b1e76=_0x1b1e76-0x0;var _0x3d743a=_0xf51f[_0x1b1e76];return _0x3d743a;};'use strict';var _=require(_0xff51('0x0'));var util=require(_0xff51('0x1'));var logger=require('../../config/logger')(_0xff51('0x2'));var moment=require(_0xff51('0x3'));var BPromise=require('bluebird');var rp=require(_0xff51('0x4'));var fs=require('fs');var path=require(_0xff51('0x5'));var rimraf=require(_0xff51('0x6'));var config=require(_0xff51('0x7'));var attributes=require(_0xff51('0x8'));module[_0xff51('0x9')]=function(_0x38e3bc,_0x1cf663){return _0x38e3bc[_0xff51('0xa')](_0xff51('0xb'),attributes,{'tableName':'report_member','paranoid':![],'indexes':[{'name':'membername_interface','fields':[_0xff51('0xc'),_0xff51('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 03feb2d..1b71bb7 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 _0xae30=['debug','CreateMemberReport','create','body','raw','where','UpdateMemberReport','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','MemberReport,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','GetMemberReport','findAll','options','attributes','limit','include','model','map'];(function(_0x20b031,_0x2d2893){var _0x3bfebd=function(_0x3bd8d9){while(--_0x3bd8d9){_0x20b031['push'](_0x20b031['shift']());}};_0x3bfebd(++_0x2d2893);}(_0xae30,0x10a));var _0x0ae3=function(_0x2fe959,_0x351d77){_0x2fe959=_0x2fe959-0x0;var _0x2f6ace=_0xae30[_0x2fe959];return _0x2f6ace;};'use strict';var _=require(_0x0ae3('0x0'));var util=require(_0x0ae3('0x1'));var moment=require(_0x0ae3('0x2'));var BPromise=require('bluebird');var rs=require(_0x0ae3('0x3'));var fs=require('fs');var Redis=require(_0x0ae3('0x4'));var db=require(_0x0ae3('0x5'))['db'];var utils=require(_0x0ae3('0x6'));var logger=require('../../config/logger')(_0x0ae3('0x7'));var config=require(_0x0ae3('0x8'));var jayson=require(_0x0ae3('0x9'));var client=jayson[_0x0ae3('0xa')][_0x0ae3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xda3853,_0x2b81f4,_0x15b7e2){return new BPromise(function(_0x32ea6e,_0x34e783){return client[_0x0ae3('0xc')](_0xda3853,_0x15b7e2)[_0x0ae3('0xd')](function(_0x32ca2c){logger['info'](_0x0ae3('0xe'),_0x2b81f4,_0x0ae3('0xf'));logger['debug']('MemberReport,\x20%s,\x20%s,\x20%s',_0x2b81f4,_0x0ae3('0xf'),JSON[_0x0ae3('0x10')](_0x32ca2c));if(_0x32ca2c[_0x0ae3('0x11')]){if(_0x32ca2c[_0x0ae3('0x11')]['code']===0x1f4){logger['error'](_0x0ae3('0xe'),_0x2b81f4,_0x32ca2c[_0x0ae3('0x11')]['message']);return _0x34e783(_0x32ca2c['error'][_0x0ae3('0x12')]);}logger['error'](_0x0ae3('0xe'),_0x2b81f4,_0x32ca2c[_0x0ae3('0x11')][_0x0ae3('0x12')]);return _0x32ea6e(_0x32ca2c[_0x0ae3('0x11')][_0x0ae3('0x12')]);}else{logger[_0x0ae3('0x13')](_0x0ae3('0xe'),_0x2b81f4,'request\x20sent');_0x32ea6e(_0x32ca2c[_0x0ae3('0x14')]['message']);}})[_0x0ae3('0x15')](function(_0x254a0f){logger[_0x0ae3('0x11')](_0x0ae3('0xe'),_0x2b81f4,_0x254a0f);_0x34e783(_0x254a0f);});});}exports[_0x0ae3('0x16')]=function(_0x40edc6){var _0x146c15=this;return new Promise(function(_0x1bf406,_0x37adcd){return db['MemberReport'][_0x0ae3('0x17')]({'raw':_0x40edc6['options']?_0x40edc6['options']['raw']===undefined?!![]:![]:!![],'where':_0x40edc6['options']?_0x40edc6['options']['where']||null:null,'attributes':_0x40edc6['options']?_0x40edc6[_0x0ae3('0x18')][_0x0ae3('0x19')]||null:null,'limit':_0x40edc6[_0x0ae3('0x18')]?_0x40edc6['options'][_0x0ae3('0x1a')]||null:null,'include':_0x40edc6['options']?_0x40edc6[_0x0ae3('0x18')]['include']?_['map'](_0x40edc6['options'][_0x0ae3('0x1b')],function(_0x3b49a0){return{'model':db[_0x3b49a0[_0x0ae3('0x1c')]],'as':_0x3b49a0['as'],'attributes':_0x3b49a0['attributes'],'include':_0x3b49a0['include']?_[_0x0ae3('0x1d')](_0x3b49a0[_0x0ae3('0x1b')],function(_0x5a76e5){return{'model':db[_0x5a76e5[_0x0ae3('0x1c')]],'as':_0x5a76e5['as'],'attributes':_0x5a76e5[_0x0ae3('0x19')],'include':_0x5a76e5[_0x0ae3('0x1b')]?_['map'](_0x5a76e5[_0x0ae3('0x1b')],function(_0x1f9cde){return{'model':db[_0x1f9cde[_0x0ae3('0x1c')]],'as':_0x1f9cde['as'],'attributes':_0x1f9cde['attributes']};}):[]};}):[]};}):[]:[]})[_0x0ae3('0xd')](function(_0x3edb9f){logger[_0x0ae3('0x13')]('GetMemberReport',_0x40edc6);logger[_0x0ae3('0x1e')](_0x0ae3('0x16'),_0x40edc6,JSON[_0x0ae3('0x10')](_0x3edb9f));_0x1bf406(_0x3edb9f);})[_0x0ae3('0x15')](function(_0x1f8f61){logger[_0x0ae3('0x11')](_0x0ae3('0x16'),_0x1f8f61[_0x0ae3('0x12')],_0x40edc6);_0x37adcd(_0x146c15[_0x0ae3('0x11')](0x1f4,_0x1f8f61[_0x0ae3('0x12')]));});});};exports[_0x0ae3('0x1f')]=function(_0x2567db){var _0x23f213=this;return new Promise(function(_0xecfe38,_0x10a48a){return db['MemberReport'][_0x0ae3('0x20')](_0x2567db[_0x0ae3('0x21')],{'raw':_0x2567db[_0x0ae3('0x18')]?_0x2567db[_0x0ae3('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x0ae3('0xd')](function(_0xfbae19){logger[_0x0ae3('0x13')](_0x0ae3('0x1f'),_0x2567db);logger[_0x0ae3('0x1e')](_0x0ae3('0x1f'),_0x2567db,JSON['stringify'](_0xfbae19));_0xecfe38(_0xfbae19);})[_0x0ae3('0x15')](function(_0xebfbf6){logger[_0x0ae3('0x11')](_0x0ae3('0x1f'),_0xebfbf6[_0x0ae3('0x12')],_0x2567db);_0x10a48a(_0x23f213[_0x0ae3('0x11')](0x1f4,_0xebfbf6[_0x0ae3('0x12')]));});});};exports['UpdateMemberReport']=function(_0x512045){var _0x34b91a=this;return new Promise(function(_0x45ac7d,_0x104ae9){return db['MemberReport']['update'](_0x512045[_0x0ae3('0x21')],{'raw':_0x512045[_0x0ae3('0x18')]?_0x512045[_0x0ae3('0x18')][_0x0ae3('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x512045[_0x0ae3('0x18')]?_0x512045[_0x0ae3('0x18')][_0x0ae3('0x23')]||null:null,'attributes':_0x512045['options']?_0x512045[_0x0ae3('0x18')][_0x0ae3('0x19')]||null:null,'limit':_0x512045[_0x0ae3('0x18')]?_0x512045['options']['limit']||null:null})['then'](function(_0x76fe78){logger[_0x0ae3('0x13')]('UpdateMemberReport',_0x512045);logger[_0x0ae3('0x1e')](_0x0ae3('0x24'),_0x512045,JSON[_0x0ae3('0x10')](_0x76fe78));_0x45ac7d(_0x76fe78);})['catch'](function(_0x2534d3){logger['error'](_0x0ae3('0x24'),_0x2534d3[_0x0ae3('0x12')],_0x512045);_0x104ae9(_0x34b91a['error'](0x1f4,_0x2534d3[_0x0ae3('0x12')]));});});}; \ No newline at end of file +var _0x90b1=['util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','http','request','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMemberReport','MemberReport','findAll','options','raw','where','attributes','limit','map','include','model','then','create','CreateMemberReport','UpdateMemberReport','update','body','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x90b1,0x1bb));var _0x190b=function(_0x29d34a,_0x3632d9){_0x29d34a=_0x29d34a-0x0;var _0x4baaa8=_0x90b1[_0x29d34a];return _0x4baaa8;};'use strict';var _=require(_0x190b('0x0'));var util=require(_0x190b('0x1'));var moment=require(_0x190b('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x190b('0x3'));var db=require(_0x190b('0x4'))['db'];var utils=require(_0x190b('0x5'));var logger=require(_0x190b('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x190b('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x34a689,_0x3b57f7,_0x626aa1){return new BPromise(function(_0x311161,_0x802924){return client[_0x190b('0x8')](_0x34a689,_0x626aa1)['then'](function(_0x14b93d){logger[_0x190b('0x9')](_0x190b('0xa'),_0x3b57f7,_0x190b('0xb'));logger[_0x190b('0xc')](_0x190b('0xd'),_0x3b57f7,_0x190b('0xb'),JSON[_0x190b('0xe')](_0x14b93d));if(_0x14b93d['error']){if(_0x14b93d[_0x190b('0xf')][_0x190b('0x10')]===0x1f4){logger['error'](_0x190b('0xa'),_0x3b57f7,_0x14b93d[_0x190b('0xf')][_0x190b('0x11')]);return _0x802924(_0x14b93d[_0x190b('0xf')][_0x190b('0x11')]);}logger[_0x190b('0xf')](_0x190b('0xa'),_0x3b57f7,_0x14b93d[_0x190b('0xf')][_0x190b('0x11')]);return _0x311161(_0x14b93d[_0x190b('0xf')][_0x190b('0x11')]);}else{logger[_0x190b('0x9')](_0x190b('0xa'),_0x3b57f7,_0x190b('0xb'));_0x311161(_0x14b93d[_0x190b('0x12')][_0x190b('0x11')]);}})[_0x190b('0x13')](function(_0x5c63d9){logger[_0x190b('0xf')]('MemberReport,\x20%s,\x20%s',_0x3b57f7,_0x5c63d9);_0x802924(_0x5c63d9);});});}exports[_0x190b('0x14')]=function(_0x21e458){var _0x56d07a=this;return new Promise(function(_0x16c009,_0x50a3c4){return db[_0x190b('0x15')][_0x190b('0x16')]({'raw':_0x21e458[_0x190b('0x17')]?_0x21e458[_0x190b('0x17')][_0x190b('0x18')]===undefined?!![]:![]:!![],'where':_0x21e458[_0x190b('0x17')]?_0x21e458['options'][_0x190b('0x19')]||null:null,'attributes':_0x21e458[_0x190b('0x17')]?_0x21e458['options'][_0x190b('0x1a')]||null:null,'limit':_0x21e458['options']?_0x21e458['options'][_0x190b('0x1b')]||null:null,'include':_0x21e458[_0x190b('0x17')]?_0x21e458[_0x190b('0x17')]['include']?_[_0x190b('0x1c')](_0x21e458[_0x190b('0x17')][_0x190b('0x1d')],function(_0x292ce3){return{'model':db[_0x292ce3[_0x190b('0x1e')]],'as':_0x292ce3['as'],'attributes':_0x292ce3[_0x190b('0x1a')],'include':_0x292ce3[_0x190b('0x1d')]?_['map'](_0x292ce3['include'],function(_0x262a63){return{'model':db[_0x262a63[_0x190b('0x1e')]],'as':_0x262a63['as'],'attributes':_0x262a63['attributes'],'include':_0x262a63['include']?_[_0x190b('0x1c')](_0x262a63['include'],function(_0x328e5e){return{'model':db[_0x328e5e[_0x190b('0x1e')]],'as':_0x328e5e['as'],'attributes':_0x328e5e['attributes']};}):[]};}):[]};}):[]:[]})[_0x190b('0x1f')](function(_0x1deea6){logger['info'](_0x190b('0x14'),_0x21e458);logger[_0x190b('0xc')](_0x190b('0x14'),_0x21e458,JSON['stringify'](_0x1deea6));_0x16c009(_0x1deea6);})['catch'](function(_0x3730cc){logger['error'](_0x190b('0x14'),_0x3730cc[_0x190b('0x11')],_0x21e458);_0x50a3c4(_0x56d07a['error'](0x1f4,_0x3730cc[_0x190b('0x11')]));});});};exports['CreateMemberReport']=function(_0x40d060){var _0x4ff5a6=this;return new Promise(function(_0x19600d,_0x5650e1){return db[_0x190b('0x15')][_0x190b('0x20')](_0x40d060['body'],{'raw':_0x40d060[_0x190b('0x17')]?_0x40d060[_0x190b('0x17')][_0x190b('0x18')]===undefined?!![]:![]:!![]})[_0x190b('0x1f')](function(_0x3c7488){logger[_0x190b('0x9')](_0x190b('0x21'),_0x40d060);logger[_0x190b('0xc')]('CreateMemberReport',_0x40d060,JSON['stringify'](_0x3c7488));_0x19600d(_0x3c7488);})[_0x190b('0x13')](function(_0x2e44ed){logger['error'](_0x190b('0x21'),_0x2e44ed[_0x190b('0x11')],_0x40d060);_0x5650e1(_0x4ff5a6[_0x190b('0xf')](0x1f4,_0x2e44ed[_0x190b('0x11')]));});});};exports[_0x190b('0x22')]=function(_0x228c73){var _0x5bda80=this;return new Promise(function(_0x5492b0,_0x5f3b45){return db[_0x190b('0x15')][_0x190b('0x23')](_0x228c73[_0x190b('0x24')],{'raw':_0x228c73['options']?_0x228c73[_0x190b('0x17')][_0x190b('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x228c73[_0x190b('0x17')]?_0x228c73['options'][_0x190b('0x19')]||null:null,'attributes':_0x228c73['options']?_0x228c73['options'][_0x190b('0x1a')]||null:null,'limit':_0x228c73[_0x190b('0x17')]?_0x228c73['options'][_0x190b('0x1b')]||null:null})[_0x190b('0x1f')](function(_0x161756){logger['info'](_0x190b('0x22'),_0x228c73);logger[_0x190b('0xc')]('UpdateMemberReport',_0x228c73,JSON['stringify'](_0x161756));_0x5492b0(_0x161756);})[_0x190b('0x13')](function(_0x4ab72d){logger[_0x190b('0xf')](_0x190b('0x22'),_0x4ab72d[_0x190b('0x11')],_0x228c73);_0x5f3b45(_0x5bda80[_0x190b('0xf')](0x1f4,_0x4ab72d['message']));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 61fbe7b..f460828 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 _0x0fc8=['../../components/auth/service','./migration.controller','get','index','exports','multer','util','path','Router','fs-extra'];(function(_0xae7c2f,_0xf31e04){var _0x5d7001=function(_0x4eeadb){while(--_0x4eeadb){_0xae7c2f['push'](_0xae7c2f['shift']());}};_0x5d7001(++_0xf31e04);}(_0x0fc8,0xe1));var _0x80fc=function(_0x2c66f0,_0x408c9c){_0x2c66f0=_0x2c66f0-0x0;var _0x545c8b=_0x0fc8[_0x2c66f0];return _0x545c8b;};'use strict';var multer=require(_0x80fc('0x0'));var util=require(_0x80fc('0x1'));var path=require(_0x80fc('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x80fc('0x3')]();var fs_extra=require(_0x80fc('0x4'));var auth=require(_0x80fc('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x80fc('0x6'));router[_0x80fc('0x7')]('/',controller[_0x80fc('0x8')]);module[_0x80fc('0x9')]=router; \ No newline at end of file +var _0x9559=['index','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','./migration.controller'];(function(_0x4ba48c,_0x56b83c){var _0x6d98c7=function(_0x1ad7d2){while(--_0x1ad7d2){_0x4ba48c['push'](_0x4ba48c['shift']());}};_0x6d98c7(++_0x56b83c);}(_0x9559,0x12b));var _0x9955=function(_0x2650e9,_0xb91cc){_0x2650e9=_0x2650e9-0x0;var _0x3511c8=_0x9559[_0x2650e9];return _0x3511c8;};'use strict';var multer=require(_0x9955('0x0'));var util=require('util');var path=require(_0x9955('0x1'));var timeout=require('connect-timeout');var express=require(_0x9955('0x2'));var router=express[_0x9955('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x9955('0x4'));var interaction=require(_0x9955('0x5'));var config=require('../../config/environment');var controller=require(_0x9955('0x6'));router['get']('/',controller[_0x9955('0x7')]);module[_0x9955('0x8')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index a701208..0659d7a 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 _0x78f1=['STRING','version','sequelize'];(function(_0x4b2b03,_0xbf34ee){var _0x1bf0ed=function(_0x562785){while(--_0x562785){_0x4b2b03['push'](_0x4b2b03['shift']());}};_0x1bf0ed(++_0xbf34ee);}(_0x78f1,0x1af));var _0x178f=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x78f1[_0x2b4411];return _0x8e41ef;};'use strict';var Sequelize=require(_0x178f('0x0'));module['exports']={'version':{'type':Sequelize[_0x178f('0x1')],'unique':_0x178f('0x2')}}; \ No newline at end of file +var _0xef0e=['version','exports','STRING'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0xef0e,0xee));var _0xeef0=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0xef0e[_0x178e48];return _0x440d7e;};'use strict';var Sequelize=require('sequelize');module[_0xeef0('0x0')]={'version':{'type':Sequelize[_0xeef0('0x1')],'unique':_0xeef0('0x2')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index a924df4..da74be0 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 _0x395c=['attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','catch','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','save','update','destroy','then','sendStatus','name','send','index','map','Migration','rawAttributes','type','key','model','query','keys','filters'];(function(_0x483aac,_0x36d314){var _0x55bf9e=function(_0x871bf0){while(--_0x871bf0){_0x483aac['push'](_0x483aac['shift']());}};_0x55bf9e(++_0x36d314);}(_0x395c,0x8f));var _0xc395=function(_0x2054a8,_0x120df4){_0x2054a8=_0x2054a8-0x0;var _0xb84987=_0x395c[_0x2054a8];return _0xb84987;};'use strict';var emlformat=require(_0xc395('0x0'));var rimraf=require(_0xc395('0x1'));var zipdir=require(_0xc395('0x2'));var jsonpatch=require(_0xc395('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xc395('0x4'));var util=require(_0xc395('0x5'));var path=require('path');var sox=require(_0xc395('0x6'));var csv=require('to-csv');var ejs=require(_0xc395('0x7'));var fs=require('fs');var fs_extra=require(_0xc395('0x8'));var _=require(_0xc395('0x9'));var squel=require(_0xc395('0xa'));var crypto=require(_0xc395('0xb'));var jsforce=require(_0xc395('0xc'));var deskjs=require(_0xc395('0xd'));var toCsv=require('to-csv');var querystring=require(_0xc395('0xe'));var Papa=require('papaparse');var Redis=require(_0xc395('0xf'));var authService=require(_0xc395('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xc395('0x11'));var hardwareService=require(_0xc395('0x12'));var logger=require(_0xc395('0x13'))('api');var utils=require(_0xc395('0x14'));var config=require(_0xc395('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xc395('0x16'))['db'];function respondWithStatusCode(_0x4d9219,_0x1c1448){_0x1c1448=_0x1c1448||0xcc;return function(_0x3f73d3){if(_0x3f73d3){return _0x4d9219['sendStatus'](_0x1c1448);}return _0x4d9219[_0xc395('0x17')](_0x1c1448)[_0xc395('0x18')]();};}function respondWithResult(_0x295d6d,_0x507dd2){_0x507dd2=_0x507dd2||0xc8;return function(_0x1ae47f){if(_0x1ae47f){return _0x295d6d['status'](_0x507dd2)['json'](_0x1ae47f);}};}function respondWithFilteredResult(_0x4fc5c6,_0x5231df){return function(_0x2eb975){if(_0x2eb975){var _0x3ea937=typeof _0x5231df[_0xc395('0x19')]===_0xc395('0x1a')&&typeof _0x5231df[_0xc395('0x1b')]===_0xc395('0x1a');var _0x5261b7=_0x2eb975[_0xc395('0x1c')];var _0x22750c=_0x3ea937?0x0:_0x5231df['offset'];var _0x6ab3f9=_0x3ea937?_0x2eb975[_0xc395('0x1c')]:_0x5231df[_0xc395('0x19')]+_0x5231df[_0xc395('0x1b')];var _0x428fe3;if(_0x6ab3f9>=_0x5261b7){_0x6ab3f9=_0x5261b7;_0x428fe3=0xc8;}else{_0x428fe3=0xce;}_0x4fc5c6['status'](_0x428fe3);return _0x4fc5c6[_0xc395('0x1d')](_0xc395('0x1e'),_0x22750c+'-'+_0x6ab3f9+'/'+_0x5261b7)[_0xc395('0x1f')](_0x2eb975);}return null;};}function patchUpdates(_0x2838ff){return function(_0x2c4b37){try{jsonpatch['apply'](_0x2c4b37,_0x2838ff,!![]);}catch(_0x5190c1){return BPromise['reject'](_0x5190c1);}return _0x2c4b37[_0xc395('0x20')]();};}function saveUpdates(_0x5d0238,_0x4d076f){return function(_0x3491f9){if(_0x3491f9){return _0x3491f9[_0xc395('0x21')](_0x5d0238)['then'](function(_0x3bc531){return _0x3bc531;});}return null;};}function removeEntity(_0x48e2d7,_0x512894){return function(_0x4380a5){if(_0x4380a5){return _0x4380a5[_0xc395('0x22')]()[_0xc395('0x23')](function(){_0x48e2d7[_0xc395('0x17')](0xcc)[_0xc395('0x18')]();});}};}function handleEntityNotFound(_0x417ea6,_0x462258){return function(_0x5c6ae0){if(!_0x5c6ae0){_0x417ea6[_0xc395('0x24')](0x194);}return _0x5c6ae0;};}function handleError(_0xf9ed78,_0x2b08f8){_0x2b08f8=_0x2b08f8||0x1f4;return function(_0x13cbee){logger['error'](_0x13cbee['stack']);if(_0x13cbee['name']){delete _0x13cbee[_0xc395('0x25')];}_0xf9ed78[_0xc395('0x17')](_0x2b08f8)[_0xc395('0x26')](_0x13cbee);};}exports[_0xc395('0x27')]=function(_0x3c92f9,_0x416b6a){var _0x30b808={},_0x2fea82={},_0x362a10={'count':0x0,'rows':[]};var _0x58f1b1=_[_0xc395('0x28')](db[_0xc395('0x29')][_0xc395('0x2a')],function(_0x256e7b){return{'name':_0x256e7b['fieldName'],'type':_0x256e7b[_0xc395('0x2b')][_0xc395('0x2c')]};});_0x2fea82[_0xc395('0x2d')]=_[_0xc395('0x28')](_0x58f1b1,_0xc395('0x25'));_0x2fea82[_0xc395('0x2e')]=_[_0xc395('0x2f')](_0x3c92f9[_0xc395('0x2e')]);_0x2fea82[_0xc395('0x30')]=_['intersection'](_0x2fea82[_0xc395('0x2d')],_0x2fea82['query']);_0x30b808[_0xc395('0x31')]=_['intersection'](_0x2fea82[_0xc395('0x2d')],qs[_0xc395('0x32')](_0x3c92f9[_0xc395('0x2e')][_0xc395('0x32')]));_0x30b808[_0xc395('0x31')]=_0x30b808[_0xc395('0x31')][_0xc395('0x33')]?_0x30b808['attributes']:_0x2fea82[_0xc395('0x2d')];if(!_0x3c92f9[_0xc395('0x2e')]['hasOwnProperty'](_0xc395('0x34'))){_0x30b808[_0xc395('0x1b')]=qs[_0xc395('0x1b')](_0x3c92f9[_0xc395('0x2e')][_0xc395('0x1b')]);_0x30b808[_0xc395('0x19')]=qs[_0xc395('0x19')](_0x3c92f9[_0xc395('0x2e')][_0xc395('0x19')]);}_0x30b808[_0xc395('0x35')]=qs[_0xc395('0x36')](_0x3c92f9[_0xc395('0x2e')][_0xc395('0x36')]);_0x30b808[_0xc395('0x37')]=qs['filters'](_[_0xc395('0x38')](_0x3c92f9[_0xc395('0x2e')],_0x2fea82['filters']),_0x58f1b1);if(_0x3c92f9[_0xc395('0x2e')][_0xc395('0x39')]){_0x30b808[_0xc395('0x37')]=_[_0xc395('0x3a')](_0x30b808['where'],{'$or':_[_0xc395('0x28')](_0x58f1b1,function(_0x5def4e){if(_0x5def4e[_0xc395('0x2b')]!==_0xc395('0x3b')){var _0x1d4f59={};_0x1d4f59[_0x5def4e[_0xc395('0x25')]]={'$like':'%'+_0x3c92f9[_0xc395('0x2e')][_0xc395('0x39')]+'%'};return _0x1d4f59;}})});}_0x30b808=_[_0xc395('0x3a')]({},_0x30b808,_0x3c92f9[_0xc395('0x3c')]);var _0x4f335d={'where':_0x30b808[_0xc395('0x37')]};return db[_0xc395('0x29')]['count'](_0x4f335d)[_0xc395('0x23')](function(_0x46729b){_0x362a10[_0xc395('0x1c')]=_0x46729b;if(_0x3c92f9[_0xc395('0x2e')]['includeAll']){_0x30b808[_0xc395('0x3d')]=[{'all':!![]}];}return db[_0xc395('0x29')][_0xc395('0x3e')](_0x30b808);})[_0xc395('0x23')](function(_0xb9bf88){_0x362a10['rows']=_0xb9bf88;return _0x362a10;})[_0xc395('0x23')](respondWithFilteredResult(_0x416b6a,_0x30b808))[_0xc395('0x3f')](handleError(_0x416b6a,null));}; \ No newline at end of file +var _0xb987=['hasOwnProperty','nolimit','sort','filters','filter','merge','VIRTUAL','options','where','includeAll','include','findAll','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','end','offset','undefined','count','limit','status','set','Content-Range','json','apply','reject','update','then','destroy','sendStatus','error','name','send','map','Migration','type','model','query','keys','attributes','intersection','fields','length'];(function(_0x3afea1,_0x508b08){var _0x40890d=function(_0x5540d6){while(--_0x5540d6){_0x3afea1['push'](_0x3afea1['shift']());}};_0x40890d(++_0x508b08);}(_0xb987,0x134));var _0x7b98=function(_0x57c60f,_0x508f52){_0x57c60f=_0x57c60f-0x0;var _0x8d8df=_0xb987[_0x57c60f];return _0x8d8df;};'use strict';var emlformat=require(_0x7b98('0x0'));var rimraf=require(_0x7b98('0x1'));var zipdir=require(_0x7b98('0x2'));var jsonpatch=require(_0x7b98('0x3'));var rp=require(_0x7b98('0x4'));var moment=require('moment');var BPromise=require(_0x7b98('0x5'));var Mustache=require(_0x7b98('0x6'));var util=require('util');var path=require('path');var sox=require(_0x7b98('0x7'));var csv=require(_0x7b98('0x8'));var ejs=require(_0x7b98('0x9'));var fs=require('fs');var fs_extra=require(_0x7b98('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x7b98('0xb'));var jsforce=require(_0x7b98('0xc'));var deskjs=require(_0x7b98('0xd'));var toCsv=require('to-csv');var querystring=require(_0x7b98('0xe'));var Papa=require(_0x7b98('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7b98('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7b98('0x11'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2fa5dd,_0x4ad8a8){_0x4ad8a8=_0x4ad8a8||0xcc;return function(_0xb153bd){if(_0xb153bd){return _0x2fa5dd['sendStatus'](_0x4ad8a8);}return _0x2fa5dd['status'](_0x4ad8a8)[_0x7b98('0x12')]();};}function respondWithResult(_0x100305,_0x41d1bf){_0x41d1bf=_0x41d1bf||0xc8;return function(_0x4951f7){if(_0x4951f7){return _0x100305['status'](_0x41d1bf)['json'](_0x4951f7);}};}function respondWithFilteredResult(_0x1e6a65,_0x3bc31d){return function(_0xb4e839){if(_0xb4e839){var _0x5c9fd7=typeof _0x3bc31d[_0x7b98('0x13')]===_0x7b98('0x14')&&typeof _0x3bc31d['limit']===_0x7b98('0x14');var _0x2b6fb5=_0xb4e839['count'];var _0x3cd151=_0x5c9fd7?0x0:_0x3bc31d[_0x7b98('0x13')];var _0x2d617e=_0x5c9fd7?_0xb4e839[_0x7b98('0x15')]:_0x3bc31d['offset']+_0x3bc31d[_0x7b98('0x16')];var _0x48f39a;if(_0x2d617e>=_0x2b6fb5){_0x2d617e=_0x2b6fb5;_0x48f39a=0xc8;}else{_0x48f39a=0xce;}_0x1e6a65[_0x7b98('0x17')](_0x48f39a);return _0x1e6a65[_0x7b98('0x18')](_0x7b98('0x19'),_0x3cd151+'-'+_0x2d617e+'/'+_0x2b6fb5)[_0x7b98('0x1a')](_0xb4e839);}return null;};}function patchUpdates(_0xb0bb5c){return function(_0x2f2be6){try{jsonpatch[_0x7b98('0x1b')](_0x2f2be6,_0xb0bb5c,!![]);}catch(_0x1952d5){return BPromise[_0x7b98('0x1c')](_0x1952d5);}return _0x2f2be6['save']();};}function saveUpdates(_0x22b0c1,_0x99720f){return function(_0x2797f8){if(_0x2797f8){return _0x2797f8[_0x7b98('0x1d')](_0x22b0c1)[_0x7b98('0x1e')](function(_0x388c4d){return _0x388c4d;});}return null;};}function removeEntity(_0x2a2030,_0x3145a0){return function(_0x4a2b00){if(_0x4a2b00){return _0x4a2b00[_0x7b98('0x1f')]()[_0x7b98('0x1e')](function(){_0x2a2030[_0x7b98('0x17')](0xcc)[_0x7b98('0x12')]();});}};}function handleEntityNotFound(_0x2171c2,_0x203108){return function(_0x45d276){if(!_0x45d276){_0x2171c2[_0x7b98('0x20')](0x194);}return _0x45d276;};}function handleError(_0x3e23bc,_0x362c1b){_0x362c1b=_0x362c1b||0x1f4;return function(_0x55dad4){logger[_0x7b98('0x21')](_0x55dad4['stack']);if(_0x55dad4[_0x7b98('0x22')]){delete _0x55dad4[_0x7b98('0x22')];}_0x3e23bc[_0x7b98('0x17')](_0x362c1b)[_0x7b98('0x23')](_0x55dad4);};}exports['index']=function(_0x52bb9a,_0x498986){var _0x3ca5e4={},_0x1f92dd={},_0xeabb38={'count':0x0,'rows':[]};var _0x19be09=_[_0x7b98('0x24')](db[_0x7b98('0x25')]['rawAttributes'],function(_0x4584ff){return{'name':_0x4584ff['fieldName'],'type':_0x4584ff[_0x7b98('0x26')]['key']};});_0x1f92dd[_0x7b98('0x27')]=_['map'](_0x19be09,'name');_0x1f92dd[_0x7b98('0x28')]=_[_0x7b98('0x29')](_0x52bb9a[_0x7b98('0x28')]);_0x1f92dd['filters']=_['intersection'](_0x1f92dd[_0x7b98('0x27')],_0x1f92dd[_0x7b98('0x28')]);_0x3ca5e4[_0x7b98('0x2a')]=_[_0x7b98('0x2b')](_0x1f92dd['model'],qs[_0x7b98('0x2c')](_0x52bb9a['query'][_0x7b98('0x2c')]));_0x3ca5e4[_0x7b98('0x2a')]=_0x3ca5e4[_0x7b98('0x2a')][_0x7b98('0x2d')]?_0x3ca5e4[_0x7b98('0x2a')]:_0x1f92dd[_0x7b98('0x27')];if(!_0x52bb9a['query'][_0x7b98('0x2e')](_0x7b98('0x2f'))){_0x3ca5e4[_0x7b98('0x16')]=qs[_0x7b98('0x16')](_0x52bb9a[_0x7b98('0x28')][_0x7b98('0x16')]);_0x3ca5e4[_0x7b98('0x13')]=qs[_0x7b98('0x13')](_0x52bb9a[_0x7b98('0x28')][_0x7b98('0x13')]);}_0x3ca5e4['order']=qs[_0x7b98('0x30')](_0x52bb9a['query'][_0x7b98('0x30')]);_0x3ca5e4['where']=qs[_0x7b98('0x31')](_['pick'](_0x52bb9a[_0x7b98('0x28')],_0x1f92dd[_0x7b98('0x31')]),_0x19be09);if(_0x52bb9a[_0x7b98('0x28')][_0x7b98('0x32')]){_0x3ca5e4['where']=_[_0x7b98('0x33')](_0x3ca5e4['where'],{'$or':_[_0x7b98('0x24')](_0x19be09,function(_0x5941f2){if(_0x5941f2[_0x7b98('0x26')]!==_0x7b98('0x34')){var _0x2133a4={};_0x2133a4[_0x5941f2[_0x7b98('0x22')]]={'$like':'%'+_0x52bb9a['query'][_0x7b98('0x32')]+'%'};return _0x2133a4;}})});}_0x3ca5e4=_[_0x7b98('0x33')]({},_0x3ca5e4,_0x52bb9a[_0x7b98('0x35')]);var _0x55487f={'where':_0x3ca5e4[_0x7b98('0x36')]};return db[_0x7b98('0x25')][_0x7b98('0x15')](_0x55487f)[_0x7b98('0x1e')](function(_0x48526f){_0xeabb38[_0x7b98('0x15')]=_0x48526f;if(_0x52bb9a[_0x7b98('0x28')][_0x7b98('0x37')]){_0x3ca5e4[_0x7b98('0x38')]=[{'all':!![]}];}return db[_0x7b98('0x25')][_0x7b98('0x39')](_0x3ca5e4);})[_0x7b98('0x1e')](function(_0x4e3b01){_0xeabb38['rows']=_0x4e3b01;return _0xeabb38;})[_0x7b98('0x1e')](respondWithFilteredResult(_0x498986,_0x3ca5e4))[_0x7b98('0x3a')](handleError(_0x498986,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 8806937..aa4809b 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 _0xa28f=['request-promise','path','rimraf','exports','define','Migration','migrations','lodash','util','api','moment','bluebird'];(function(_0x1bf8cc,_0x118778){var _0x322d20=function(_0x36953d){while(--_0x36953d){_0x1bf8cc['push'](_0x1bf8cc['shift']());}};_0x322d20(++_0x118778);}(_0xa28f,0x1ab));var _0xfa28=function(_0x19117c,_0x2e3a00){_0x19117c=_0x19117c-0x0;var _0x51d580=_0xa28f[_0x19117c];return _0x51d580;};'use strict';var _=require(_0xfa28('0x0'));var util=require(_0xfa28('0x1'));var logger=require('../../config/logger')(_0xfa28('0x2'));var moment=require(_0xfa28('0x3'));var BPromise=require(_0xfa28('0x4'));var rp=require(_0xfa28('0x5'));var fs=require('fs');var path=require(_0xfa28('0x6'));var rimraf=require(_0xfa28('0x7'));var config=require('../../config/environment');var attributes=require('./migration.attributes');module[_0xfa28('0x8')]=function(_0x4b2651,_0x33ec65){return _0x4b2651[_0xfa28('0x9')](_0xfa28('0xa'),attributes,{'tableName':_0xfa28('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6cf1=['../../config/logger','moment','bluebird','request-promise','path','rimraf','exports','define','lodash','util'];(function(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0x6cf1,0x9e));var _0x16cf=function(_0x4be75e,_0x8423){_0x4be75e=_0x4be75e-0x0;var _0xb4d4b6=_0x6cf1[_0x4be75e];return _0xb4d4b6;};'use strict';var _=require(_0x16cf('0x0'));var util=require(_0x16cf('0x1'));var logger=require(_0x16cf('0x2'))('api');var moment=require(_0x16cf('0x3'));var BPromise=require(_0x16cf('0x4'));var rp=require(_0x16cf('0x5'));var fs=require('fs');var path=require(_0x16cf('0x6'));var rimraf=require(_0x16cf('0x7'));var config=require('../../config/environment');var attributes=require('./migration.attributes');module[_0x16cf('0x8')]=function(_0x4f3a7b,_0x20b8f9){return _0x4f3a7b[_0x16cf('0x9')]('Migration',attributes,{'tableName':'migrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/migration/migration.rpc.js b/server/api/migration/migration.rpc.js index 9e02978..0ea8a80 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 _0x1bd1=['message','catch','lodash','util','moment','randomstring','rpc','../../config/environment','jayson/promise','client','then','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x2c61b0,_0x200775){var _0x11b39d=function(_0x1f99b2){while(--_0x1f99b2){_0x2c61b0['push'](_0x2c61b0['shift']());}};_0x11b39d(++_0x200775);}(_0x1bd1,0x123));var _0x11bd=function(_0x4ee461,_0x36191a){_0x4ee461=_0x4ee461-0x0;var _0x451a1e=_0x1bd1[_0x4ee461];return _0x451a1e;};'use strict';var _=require(_0x11bd('0x0'));var util=require(_0x11bd('0x1'));var moment=require(_0x11bd('0x2'));var BPromise=require('bluebird');var rs=require(_0x11bd('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x11bd('0x4'));var config=require(_0x11bd('0x5'));var jayson=require(_0x11bd('0x6'));var client=jayson[_0x11bd('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x336255,_0x1f813c,_0x359f21){return new BPromise(function(_0x3940cf,_0x361ecf){return client['request'](_0x336255,_0x359f21)[_0x11bd('0x8')](function(_0x553727){logger['info'](_0x11bd('0x9'),_0x1f813c,_0x11bd('0xa'));logger[_0x11bd('0xb')](_0x11bd('0xc'),_0x1f813c,_0x11bd('0xa'),JSON[_0x11bd('0xd')](_0x553727));if(_0x553727[_0x11bd('0xe')]){if(_0x553727[_0x11bd('0xe')]['code']===0x1f4){logger[_0x11bd('0xe')](_0x11bd('0x9'),_0x1f813c,_0x553727[_0x11bd('0xe')][_0x11bd('0xf')]);return _0x361ecf(_0x553727[_0x11bd('0xe')][_0x11bd('0xf')]);}logger[_0x11bd('0xe')]('Migration,\x20%s,\x20%s',_0x1f813c,_0x553727['error'][_0x11bd('0xf')]);return _0x3940cf(_0x553727[_0x11bd('0xe')][_0x11bd('0xf')]);}else{logger['info'](_0x11bd('0x9'),_0x1f813c,'request\x20sent');_0x3940cf(_0x553727['result'][_0x11bd('0xf')]);}})[_0x11bd('0x10')](function(_0xab4cde){logger[_0x11bd('0xe')](_0x11bd('0x9'),_0x1f813c,_0xab4cde);_0x361ecf(_0xab4cde);});});} \ No newline at end of file +var _0x073e=['debug','Migration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','lodash','util','moment','bluebird','../../config/utils','../../config/logger','rpc','http','then','info','Migration,\x20%s,\x20%s'];(function(_0xc54b52,_0x41294e){var _0x29287f=function(_0x25de9a){while(--_0x25de9a){_0xc54b52['push'](_0xc54b52['shift']());}};_0x29287f(++_0x41294e);}(_0x073e,0x181));var _0xe073=function(_0x5c8e89,_0x459e5c){_0x5c8e89=_0x5c8e89-0x0;var _0x3aa724=_0x073e[_0x5c8e89];return _0x3aa724;};'use strict';var _=require(_0xe073('0x0'));var util=require(_0xe073('0x1'));var moment=require(_0xe073('0x2'));var BPromise=require(_0xe073('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe073('0x4'));var logger=require(_0xe073('0x5'))(_0xe073('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xe073('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x44092d,_0x1bcaae,_0x3b4fc7){return new BPromise(function(_0x373bf6,_0x1a93da){return client['request'](_0x44092d,_0x3b4fc7)[_0xe073('0x8')](function(_0x7a1f21){logger[_0xe073('0x9')](_0xe073('0xa'),_0x1bcaae,'request\x20sent');logger[_0xe073('0xb')](_0xe073('0xc'),_0x1bcaae,_0xe073('0xd'),JSON[_0xe073('0xe')](_0x7a1f21));if(_0x7a1f21[_0xe073('0xf')]){if(_0x7a1f21[_0xe073('0xf')]['code']===0x1f4){logger[_0xe073('0xf')]('Migration,\x20%s,\x20%s',_0x1bcaae,_0x7a1f21[_0xe073('0xf')]['message']);return _0x1a93da(_0x7a1f21[_0xe073('0xf')]['message']);}logger[_0xe073('0xf')](_0xe073('0xa'),_0x1bcaae,_0x7a1f21[_0xe073('0xf')][_0xe073('0x10')]);return _0x373bf6(_0x7a1f21[_0xe073('0xf')][_0xe073('0x10')]);}else{logger[_0xe073('0x9')](_0xe073('0xa'),_0x1bcaae,_0xe073('0xd'));_0x373bf6(_0x7a1f21[_0xe073('0x11')][_0xe073('0x10')]);}})['catch'](function(_0x511ab2){logger['error'](_0xe073('0xa'),_0x1bcaae,_0x511ab2);_0x1a93da(_0x511ab2);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 76f78a0..01e91d4 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 _0x896e=['show','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller','get','index','/:id','isAuthenticated'];(function(_0x26462c,_0xd20a35){var _0x509a42=function(_0x1b22c9){while(--_0x1b22c9){_0x26462c['push'](_0x26462c['shift']());}};_0x509a42(++_0xd20a35);}(_0x896e,0x1e9));var _0xe896=function(_0x1d66f7,_0x28b7e2){_0x1d66f7=_0x1d66f7-0x0;var _0x431c43=_0x896e[_0x1d66f7];return _0x431c43;};'use strict';var multer=require(_0xe896('0x0'));var util=require(_0xe896('0x1'));var path=require(_0xe896('0x2'));var timeout=require(_0xe896('0x3'));var express=require(_0xe896('0x4'));var router=express[_0xe896('0x5')]();var fs_extra=require(_0xe896('0x6'));var auth=require(_0xe896('0x7'));var interaction=require(_0xe896('0x8'));var config=require(_0xe896('0x9'));var controller=require(_0xe896('0xa'));router[_0xe896('0xb')]('/',auth['isAuthenticated'](),controller[_0xe896('0xc')]);router[_0xe896('0xb')](_0xe896('0xd'),auth[_0xe896('0xe')](),controller[_0xe896('0xf')]);router['post']('/',auth[_0xe896('0xe')](),controller[_0xe896('0x10')]);router[_0xe896('0x11')]('/:id',auth[_0xe896('0xe')](),controller['update']);router[_0xe896('0x12')]('/:id',auth[_0xe896('0xe')](),controller[_0xe896('0x13')]);module[_0xe896('0x14')]=router; \ No newline at end of file +var _0x404d=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./network.controller','get','index','show','post','put','/:id','isAuthenticated','update','destroy','multer','util','path','connect-timeout','express'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x404d,0x1e9));var _0xd404=function(_0x4ed1a2,_0x7b259e){_0x4ed1a2=_0x4ed1a2-0x0;var _0x5727f4=_0x404d[_0x4ed1a2];return _0x5727f4;};'use strict';var multer=require(_0xd404('0x0'));var util=require(_0xd404('0x1'));var path=require(_0xd404('0x2'));var timeout=require(_0xd404('0x3'));var express=require(_0xd404('0x4'));var router=express[_0xd404('0x5')]();var fs_extra=require(_0xd404('0x6'));var auth=require(_0xd404('0x7'));var interaction=require(_0xd404('0x8'));var config=require('../../config/environment');var controller=require(_0xd404('0x9'));router[_0xd404('0xa')]('/',auth['isAuthenticated'](),controller[_0xd404('0xb')]);router[_0xd404('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xd404('0xc')]);router[_0xd404('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xd404('0xe')](_0xd404('0xf'),auth[_0xd404('0x10')](),controller[_0xd404('0x11')]);router['delete']('/:id',auth[_0xd404('0x10')](),controller[_0xd404('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 2078247..9a10da2 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 _0xf2e3=['exports','localnet','externip','stun','turn','STRING','sequelize'];(function(_0x3f5688,_0x22b187){var _0x245cc0=function(_0x3f712b){while(--_0x3f712b){_0x3f5688['push'](_0x3f5688['shift']());}};_0x245cc0(++_0x22b187);}(_0xf2e3,0x1db));var _0x3f2e=function(_0x31a371,_0x50828e){_0x31a371=_0x31a371-0x0;var _0x2a5bd6=_0xf2e3[_0x31a371];return _0x2a5bd6;};'use strict';var Sequelize=require(_0x3f2e('0x0'));module[_0x3f2e('0x1')]={'type':{'type':Sequelize['ENUM'](_0x3f2e('0x2'),_0x3f2e('0x3'),_0x3f2e('0x4'),_0x3f2e('0x5'))},'value':{'type':Sequelize[_0x3f2e('0x6')]},'username':{'type':Sequelize[_0x3f2e('0x6')]},'password':{'type':Sequelize[_0x3f2e('0x6')]}}; \ No newline at end of file +var _0x4f52=['stun','turn','STRING','sequelize','ENUM','localnet','externip'];(function(_0x4c6232,_0x482617){var _0x2ed951=function(_0x406e6a){while(--_0x406e6a){_0x4c6232['push'](_0x4c6232['shift']());}};_0x2ed951(++_0x482617);}(_0x4f52,0x6c));var _0x24f5=function(_0x503c02,_0x1fefcb){_0x503c02=_0x503c02-0x0;var _0x1a49bf=_0x4f52[_0x503c02];return _0x1a49bf;};'use strict';var Sequelize=require(_0x24f5('0x0'));module['exports']={'type':{'type':Sequelize[_0x24f5('0x1')](_0x24f5('0x2'),_0x24f5('0x3'),_0x24f5('0x4'),_0x24f5('0x5'))},'value':{'type':Sequelize[_0x24f5('0x6')]},'username':{'type':Sequelize[_0x24f5('0x6')]},'password':{'type':Sequelize[_0x24f5('0x6')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index c3dd60f..ad5c490 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 _0xb4fc=['toLowerCase','chan_sip.so','sequelize','server/files/templates/stun_multiple.ejs','TURN','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','request','then','info','request\x20sent','stringify','error','Network,\x20%s,\x20%s','message','result','catch','sendStatus','end','status','offset','limit','undefined','count','set','Content-Range','json','reject','save','update','destroy','stack','name','send','index','Network','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','filter','merge','options','include','findAll','rows','show','params','includeAll','find','transaction','create','body','STUN','readFileSync','join','root','utf8','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','toUpperCase','server/files/templates/turn_multiple.ejs','render','/etc/asterisk/turn_xcally.conf','res_stun_monitor.so','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf'];(function(_0x3fa631,_0x24392c){var _0x5c9dec=function(_0x36d01a){while(--_0x36d01a){_0x3fa631['push'](_0x3fa631['shift']());}};_0x5c9dec(++_0x24392c);}(_0xb4fc,0xdd));var _0xcb4f=function(_0x1fc4a0,_0x32e235){_0x1fc4a0=_0x1fc4a0-0x0;var _0x1b08c5=_0xb4fc[_0x1fc4a0];return _0x1b08c5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcb4f('0x0'));var zipdir=require(_0xcb4f('0x1'));var jsonpatch=require(_0xcb4f('0x2'));var rp=require(_0xcb4f('0x3'));var moment=require(_0xcb4f('0x4'));var BPromise=require(_0xcb4f('0x5'));var Mustache=require(_0xcb4f('0x6'));var util=require(_0xcb4f('0x7'));var path=require(_0xcb4f('0x8'));var sox=require(_0xcb4f('0x9'));var csv=require(_0xcb4f('0xa'));var ejs=require(_0xcb4f('0xb'));var fs=require('fs');var fs_extra=require(_0xcb4f('0xc'));var _=require(_0xcb4f('0xd'));var squel=require('squel');var crypto=require(_0xcb4f('0xe'));var jsforce=require(_0xcb4f('0xf'));var deskjs=require(_0xcb4f('0x10'));var toCsv=require('to-csv');var querystring=require(_0xcb4f('0x11'));var Papa=require(_0xcb4f('0x12'));var Redis=require(_0xcb4f('0x13'));var authService=require(_0xcb4f('0x14'));var qs=require(_0xcb4f('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcb4f('0x16'));var logger=require('../../config/logger')(_0xcb4f('0x17'));var utils=require(_0xcb4f('0x18'));var config=require(_0xcb4f('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xcb4f('0x1a'))['db'];var jayson=require(_0xcb4f('0x1b'));var client=jayson[_0xcb4f('0x1c')][_0xcb4f('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x53bcce,_0x10b56d,_0x589fbd,_0x22a32e){return new BPromise(function(_0x169f31,_0x4517dd){var _0x5b2b0f=_0x22a32e||client;return _0x5b2b0f[_0xcb4f('0x1e')](_0x53bcce,_0x589fbd)[_0xcb4f('0x1f')](function(_0x2eed72){logger[_0xcb4f('0x20')]('Network,\x20%s,\x20%s',_0x10b56d,_0xcb4f('0x21'));logger['debug']('Network,\x20%s,\x20%s,\x20%s',_0x10b56d,_0xcb4f('0x21'),JSON[_0xcb4f('0x22')](_0x2eed72));if(_0x2eed72[_0xcb4f('0x23')]){if(_0x2eed72[_0xcb4f('0x23')]['code']===0x1f4){logger[_0xcb4f('0x23')](_0xcb4f('0x24'),_0x10b56d,_0x2eed72[_0xcb4f('0x23')][_0xcb4f('0x25')]);return _0x4517dd(_0x2eed72['error'][_0xcb4f('0x25')]);}logger[_0xcb4f('0x23')](_0xcb4f('0x24'),_0x10b56d,_0x2eed72['error'][_0xcb4f('0x25')]);return _0x169f31(_0x2eed72[_0xcb4f('0x23')][_0xcb4f('0x25')]);}else{logger[_0xcb4f('0x20')](_0xcb4f('0x24'),_0x10b56d,_0xcb4f('0x21'));_0x169f31(_0x2eed72[_0xcb4f('0x26')][_0xcb4f('0x25')]);}})[_0xcb4f('0x27')](function(_0xaa939e){logger[_0xcb4f('0x23')](_0xcb4f('0x24'),_0x10b56d,_0xaa939e);_0x4517dd(_0xaa939e);});});}function respondWithStatusCode(_0x4ee411,_0x50c794){_0x50c794=_0x50c794||0xcc;return function(_0x28cc2b){if(_0x28cc2b){return _0x4ee411[_0xcb4f('0x28')](_0x50c794);}return _0x4ee411['status'](_0x50c794)[_0xcb4f('0x29')]();};}function respondWithResult(_0x481f16,_0x4ca17b){_0x4ca17b=_0x4ca17b||0xc8;return function(_0x4853da){if(_0x4853da){return _0x481f16[_0xcb4f('0x2a')](_0x4ca17b)['json'](_0x4853da);}};}function respondWithFilteredResult(_0x29e9c2,_0x3d4d2a){return function(_0xfd0b4){if(_0xfd0b4){var _0x4624f8=typeof _0x3d4d2a[_0xcb4f('0x2b')]==='undefined'&&typeof _0x3d4d2a[_0xcb4f('0x2c')]===_0xcb4f('0x2d');var _0x128895=_0xfd0b4['count'];var _0x5a3234=_0x4624f8?0x0:_0x3d4d2a['offset'];var _0x57e0bc=_0x4624f8?_0xfd0b4[_0xcb4f('0x2e')]:_0x3d4d2a[_0xcb4f('0x2b')]+_0x3d4d2a[_0xcb4f('0x2c')];var _0x19bd68;if(_0x57e0bc>=_0x128895){_0x57e0bc=_0x128895;_0x19bd68=0xc8;}else{_0x19bd68=0xce;}_0x29e9c2['status'](_0x19bd68);return _0x29e9c2[_0xcb4f('0x2f')](_0xcb4f('0x30'),_0x5a3234+'-'+_0x57e0bc+'/'+_0x128895)[_0xcb4f('0x31')](_0xfd0b4);}return null;};}function patchUpdates(_0x3a832c){return function(_0x202975){try{jsonpatch['apply'](_0x202975,_0x3a832c,!![]);}catch(_0x1127ac){return BPromise[_0xcb4f('0x32')](_0x1127ac);}return _0x202975[_0xcb4f('0x33')]();};}function saveUpdates(_0x436ae8,_0x3dbe3d){return function(_0x145298){if(_0x145298){return _0x145298[_0xcb4f('0x34')](_0x436ae8)[_0xcb4f('0x1f')](function(_0x43bc7f){return _0x43bc7f;});}return null;};}function removeEntity(_0x102efc,_0x1310a7){return function(_0xa5b931){if(_0xa5b931){return _0xa5b931[_0xcb4f('0x35')]()[_0xcb4f('0x1f')](function(){_0x102efc[_0xcb4f('0x2a')](0xcc)[_0xcb4f('0x29')]();});}};}function handleEntityNotFound(_0x18d0e7,_0x5f017f){return function(_0x572031){if(!_0x572031){_0x18d0e7['sendStatus'](0x194);}return _0x572031;};}function handleError(_0x451792,_0x354c8d){_0x354c8d=_0x354c8d||0x1f4;return function(_0x1b3ed6){logger[_0xcb4f('0x23')](_0x1b3ed6[_0xcb4f('0x36')]);if(_0x1b3ed6[_0xcb4f('0x37')]){delete _0x1b3ed6[_0xcb4f('0x37')];}_0x451792[_0xcb4f('0x2a')](_0x354c8d)[_0xcb4f('0x38')](_0x1b3ed6);};}exports[_0xcb4f('0x39')]=function(_0xdf553b,_0x147ba3){var _0x1140e9={},_0x379408={},_0x52806f={'count':0x0,'rows':[]};var _0x26d700=_['map'](db[_0xcb4f('0x3a')][_0xcb4f('0x3b')],function(_0x46001d){return{'name':_0x46001d[_0xcb4f('0x3c')],'type':_0x46001d[_0xcb4f('0x3d')]['key']};});_0x379408[_0xcb4f('0x3e')]=_[_0xcb4f('0x3f')](_0x26d700,_0xcb4f('0x37'));_0x379408[_0xcb4f('0x40')]=_[_0xcb4f('0x41')](_0xdf553b[_0xcb4f('0x40')]);_0x379408[_0xcb4f('0x42')]=_[_0xcb4f('0x43')](_0x379408[_0xcb4f('0x3e')],_0x379408[_0xcb4f('0x40')]);_0x1140e9[_0xcb4f('0x44')]=_['intersection'](_0x379408[_0xcb4f('0x3e')],qs[_0xcb4f('0x45')](_0xdf553b[_0xcb4f('0x40')][_0xcb4f('0x45')]));_0x1140e9[_0xcb4f('0x44')]=_0x1140e9[_0xcb4f('0x44')][_0xcb4f('0x46')]?_0x1140e9[_0xcb4f('0x44')]:_0x379408[_0xcb4f('0x3e')];if(!_0xdf553b['query']['hasOwnProperty'](_0xcb4f('0x47'))){_0x1140e9[_0xcb4f('0x2c')]=qs['limit'](_0xdf553b[_0xcb4f('0x40')][_0xcb4f('0x2c')]);_0x1140e9[_0xcb4f('0x2b')]=qs[_0xcb4f('0x2b')](_0xdf553b['query'][_0xcb4f('0x2b')]);}_0x1140e9['order']=qs[_0xcb4f('0x48')](_0xdf553b[_0xcb4f('0x40')][_0xcb4f('0x48')]);_0x1140e9[_0xcb4f('0x49')]=qs[_0xcb4f('0x42')](_['pick'](_0xdf553b['query'],_0x379408['filters']),_0x26d700);if(_0xdf553b[_0xcb4f('0x40')][_0xcb4f('0x4a')]){_0x1140e9['where']=_['merge'](_0x1140e9[_0xcb4f('0x49')],{'$or':_[_0xcb4f('0x3f')](_0x26d700,function(_0x12050c){if(_0x12050c['type']!=='VIRTUAL'){var _0xc1b5b3={};_0xc1b5b3[_0x12050c[_0xcb4f('0x37')]]={'$like':'%'+_0xdf553b[_0xcb4f('0x40')][_0xcb4f('0x4a')]+'%'};return _0xc1b5b3;}})});}_0x1140e9=_[_0xcb4f('0x4b')]({},_0x1140e9,_0xdf553b[_0xcb4f('0x4c')]);var _0x1ab80c={'where':_0x1140e9[_0xcb4f('0x49')]};return db['Network']['count'](_0x1ab80c)[_0xcb4f('0x1f')](function(_0x38fb22){_0x52806f[_0xcb4f('0x2e')]=_0x38fb22;if(_0xdf553b[_0xcb4f('0x40')]['includeAll']){_0x1140e9[_0xcb4f('0x4d')]=[{'all':!![]}];}return db[_0xcb4f('0x3a')][_0xcb4f('0x4e')](_0x1140e9);})['then'](function(_0x433088){_0x52806f[_0xcb4f('0x4f')]=_0x433088;return _0x52806f;})[_0xcb4f('0x1f')](respondWithFilteredResult(_0x147ba3,_0x1140e9))[_0xcb4f('0x27')](handleError(_0x147ba3,null));};exports[_0xcb4f('0x50')]=function(_0x2521c8,_0x1e0c20){var _0x8476ea={'raw':!![],'where':{'id':_0x2521c8[_0xcb4f('0x51')]['id']}},_0xf4b2e5={};_0xf4b2e5[_0xcb4f('0x3e')]=_[_0xcb4f('0x41')](db['Network'][_0xcb4f('0x3b')]);_0xf4b2e5[_0xcb4f('0x40')]=_[_0xcb4f('0x41')](_0x2521c8[_0xcb4f('0x40')]);_0xf4b2e5['filters']=_[_0xcb4f('0x43')](_0xf4b2e5[_0xcb4f('0x3e')],_0xf4b2e5[_0xcb4f('0x40')]);_0x8476ea[_0xcb4f('0x44')]=_['intersection'](_0xf4b2e5[_0xcb4f('0x3e')],qs[_0xcb4f('0x45')](_0x2521c8[_0xcb4f('0x40')][_0xcb4f('0x45')]));_0x8476ea['attributes']=_0x8476ea[_0xcb4f('0x44')][_0xcb4f('0x46')]?_0x8476ea[_0xcb4f('0x44')]:_0xf4b2e5[_0xcb4f('0x3e')];if(_0x2521c8[_0xcb4f('0x40')][_0xcb4f('0x52')]){_0x8476ea[_0xcb4f('0x4d')]=[{'all':!![]}];}_0x8476ea=_[_0xcb4f('0x4b')]({},_0x8476ea,_0x2521c8[_0xcb4f('0x4c')]);return db[_0xcb4f('0x3a')][_0xcb4f('0x53')](_0x8476ea)['then'](handleEntityNotFound(_0x1e0c20,null))[_0xcb4f('0x1f')](respondWithResult(_0x1e0c20,null))[_0xcb4f('0x27')](handleError(_0x1e0c20,null));};exports['create']=function(_0x44f5e7,_0x2d4839,_0x115778){var _0x1f1c5c;return db['sequelize'][_0xcb4f('0x54')](function(_0x1b4367){return db[_0xcb4f('0x3a')][_0xcb4f('0x55')](_0x44f5e7['body'],{'raw':!![]})['then'](function(_0x21f05d){_0x1f1c5c=_0x21f05d;return db['Network'][_0xcb4f('0x4e')]({'where':{'type':_0x44f5e7[_0xcb4f('0x56')][_0xcb4f('0x3d')]},'raw':!![]});})[_0xcb4f('0x1f')](function(_0x2c1266){if(_0x1f1c5c[_0xcb4f('0x3d')]['toUpperCase']()==_0xcb4f('0x57')){var _0x91b993=fs[_0xcb4f('0x58')](path[_0xcb4f('0x59')](config[_0xcb4f('0x5a')],'server/files/templates/stun_multiple.ejs'),_0xcb4f('0x5b'));var _0x307490=ejs['render'](_0x91b993,{'networks':_0x2c1266||[]});fs[_0xcb4f('0x5c')](_0xcb4f('0x5d'),_0x307490);return respondWithRpcPromise(_0xcb4f('0x5e'),_0xcb4f('0x55'),{'module':'res_stun_monitor.so'});}else if(_0x1f1c5c[_0xcb4f('0x3d')][_0xcb4f('0x5f')]()=='TURN'){var _0x195172=fs[_0xcb4f('0x58')](path[_0xcb4f('0x59')](config['root'],_0xcb4f('0x60')),'utf8');var _0x222b1f=ejs[_0xcb4f('0x61')](_0x195172,{'networks':_0x2c1266||[]});fs[_0xcb4f('0x5c')](_0xcb4f('0x62'),_0x222b1f);return respondWithRpcPromise(_0xcb4f('0x5e'),_0xcb4f('0x55'),{'module':_0xcb4f('0x63')});}else{var _0x2070be=fs[_0xcb4f('0x58')](path[_0xcb4f('0x59')](config[_0xcb4f('0x5a')],_0xcb4f('0x64')),_0xcb4f('0x5b'));var _0x48ed0b=ejs[_0xcb4f('0x61')](_0x2070be,{'networks':_0x2c1266||[]});fs['writeFileSync'](util[_0xcb4f('0x65')](_0xcb4f('0x66'),_0x44f5e7[_0xcb4f('0x56')][_0xcb4f('0x3d')][_0xcb4f('0x67')]()),_0x48ed0b);return respondWithRpcPromise(_0xcb4f('0x5e'),'create',{'module':_0xcb4f('0x68')});}return null;})[_0xcb4f('0x1f')](function(){return _0x1f1c5c;});})[_0xcb4f('0x1f')](respondWithResult(_0x2d4839,0xc9))[_0xcb4f('0x27')](handleError(_0x2d4839,null));};exports[_0xcb4f('0x34')]=function(_0x3b23d2,_0x41ceed,_0x10dbfa){var _0x727efc;return db[_0xcb4f('0x69')]['transaction'](function(_0x1ddd46){return db[_0xcb4f('0x3a')][_0xcb4f('0x53')]({'where':{'id':_0x3b23d2[_0xcb4f('0x51')]['id']}})[_0xcb4f('0x1f')](handleEntityNotFound(_0x41ceed,null))[_0xcb4f('0x1f')](saveUpdates(_0x3b23d2[_0xcb4f('0x56')],null))[_0xcb4f('0x1f')](function(_0xaa70b2){if(_0xaa70b2){_0x727efc=_0xaa70b2;return db[_0xcb4f('0x3a')]['findAll']({'where':{'type':_0x727efc[_0xcb4f('0x3d')]},'raw':!![]});}return null;})[_0xcb4f('0x1f')](function(_0x2c73f5){if(_0x727efc[_0xcb4f('0x3d')][_0xcb4f('0x5f')]()==_0xcb4f('0x57')){var _0x5937b9=fs['readFileSync'](path[_0xcb4f('0x59')](config['root'],_0xcb4f('0x6a')),_0xcb4f('0x5b'));var _0x4984c5=ejs[_0xcb4f('0x61')](_0x5937b9,{'networks':_0x2c73f5||[]});fs['writeFileSync'](_0xcb4f('0x5d'),_0x4984c5);return respondWithRpcPromise('Reload',_0xcb4f('0x34'),{'module':_0xcb4f('0x63')});}else if(_0x727efc[_0xcb4f('0x3d')][_0xcb4f('0x5f')]()==_0xcb4f('0x6b')){var _0x9f6c14=fs[_0xcb4f('0x58')](path[_0xcb4f('0x59')](config[_0xcb4f('0x5a')],_0xcb4f('0x60')),_0xcb4f('0x5b'));var _0x2ce66e=ejs[_0xcb4f('0x61')](_0x9f6c14,{'networks':_0x2c73f5||[]});fs['writeFileSync']('/etc/asterisk/turn_xcally.conf',_0x2ce66e);return respondWithRpcPromise(_0xcb4f('0x5e'),_0xcb4f('0x34'),{'module':_0xcb4f('0x63')});}else{var _0x2be64f=fs['readFileSync'](path[_0xcb4f('0x59')](config['root'],_0xcb4f('0x64')),_0xcb4f('0x5b'));var _0x2b9312=ejs[_0xcb4f('0x61')](_0x2be64f,{'networks':_0x2c73f5||[]});fs[_0xcb4f('0x5c')](util[_0xcb4f('0x65')](_0xcb4f('0x66'),_0x3b23d2['body'][_0xcb4f('0x3d')][_0xcb4f('0x67')]()),_0x2b9312);return respondWithRpcPromise(_0xcb4f('0x5e'),_0xcb4f('0x34'),{'module':_0xcb4f('0x68')});}return null;})['then'](function(_0x2900c4){if(_0x2900c4){return _0x727efc;}return null;});})['then'](respondWithResult(_0x41ceed,null))[_0xcb4f('0x27')](handleError(_0x41ceed,null));};exports[_0xcb4f('0x35')]=function(_0x302002,_0x358898,_0x126697){var _0x2e41f3;return db[_0xcb4f('0x3a')]['find']({'where':{'id':_0x302002['params']['id']}})[_0xcb4f('0x1f')](function(_0x4765bf){_0x2e41f3=_0x4765bf;return _0x4765bf;})['then'](handleEntityNotFound(_0x358898,null))['then'](removeEntity(_0x358898,null))['then'](function(){if(_0x2e41f3){return db[_0xcb4f('0x3a')][_0xcb4f('0x4e')]({'where':{'type':_0x2e41f3[_0xcb4f('0x3d')]},'raw':!![]});}})[_0xcb4f('0x1f')](function(_0x2be313){if(_0x2e41f3[_0xcb4f('0x3d')][_0xcb4f('0x5f')]()==_0xcb4f('0x57')){var _0xc2a0fc=fs[_0xcb4f('0x58')](path[_0xcb4f('0x59')](config[_0xcb4f('0x5a')],_0xcb4f('0x6a')),_0xcb4f('0x5b'));var _0x1f2476=ejs['render'](_0xc2a0fc,{'networks':_0x2be313||[]});fs['writeFileSync']('/etc/asterisk/stun_xcally.conf',_0x1f2476);return respondWithRpcPromise(_0xcb4f('0x5e'),_0xcb4f('0x35'),{'module':_0xcb4f('0x63')});}else if(_0x2e41f3['type']['toUpperCase']()==_0xcb4f('0x6b')){var _0x43c8a8=fs[_0xcb4f('0x58')](path[_0xcb4f('0x59')](config[_0xcb4f('0x5a')],_0xcb4f('0x60')),'utf8');var _0x2f58fd=ejs[_0xcb4f('0x61')](_0x43c8a8,{'networks':_0x2be313||[]});fs[_0xcb4f('0x5c')]('/etc/asterisk/turn_xcally.conf',_0x2f58fd);return respondWithRpcPromise(_0xcb4f('0x5e'),'destroy',{'module':_0xcb4f('0x63')});}else{var _0x177ca8=fs[_0xcb4f('0x58')](path[_0xcb4f('0x59')](config[_0xcb4f('0x5a')],'server/files/templates/network.ejs'),_0xcb4f('0x5b'));var _0x50b88e=ejs['render'](_0x177ca8,{'networks':_0x2be313||[]});fs['writeFileSync'](util[_0xcb4f('0x65')](_0xcb4f('0x66'),_0x302002[_0xcb4f('0x56')][_0xcb4f('0x3d')][_0xcb4f('0x67')]()),_0x50b88e);return respondWithRpcPromise(_0xcb4f('0x5e'),_0xcb4f('0x35'),{'module':'chan_sip.so'});}return null;})[_0xcb4f('0x27')](handleError(_0x358898,null));}; \ No newline at end of file +var _0x416d=['/etc/asterisk/turn_xcally.conf','res_stun_monitor.so','toLowerCase','server/files/templates/network.ejs','chan_sip.so','params','format','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','http','request','then','Network,\x20%s,\x20%s','request\x20sent','Network,\x20%s,\x20%s,\x20%s','error','code','message','info','result','end','status','offset','undefined','limit','count','set','json','apply','reject','save','update','destroy','sendStatus','stack','name','send','index','map','Network','fieldName','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','rawAttributes','keys','include','find','create','sequelize','body','toUpperCase','STUN','readFileSync','join','root','server/files/templates/stun_multiple.ejs','utf8','/etc/asterisk/stun_xcally.conf','Reload','TURN','server/files/templates/turn_multiple.ejs','render','writeFileSync'];(function(_0x39f70c,_0x383618){var _0x53e782=function(_0x2c23f9){while(--_0x2c23f9){_0x39f70c['push'](_0x39f70c['shift']());}};_0x53e782(++_0x383618);}(_0x416d,0x1b7));var _0xd416=function(_0x4fb614,_0x3f1326){_0x4fb614=_0x4fb614-0x0;var _0x14222b=_0x416d[_0x4fb614];return _0x14222b;};'use strict';var emlformat=require(_0xd416('0x0'));var rimraf=require(_0xd416('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd416('0x2'));var rp=require(_0xd416('0x3'));var moment=require(_0xd416('0x4'));var BPromise=require(_0xd416('0x5'));var Mustache=require(_0xd416('0x6'));var util=require(_0xd416('0x7'));var path=require(_0xd416('0x8'));var sox=require(_0xd416('0x9'));var csv=require(_0xd416('0xa'));var ejs=require(_0xd416('0xb'));var fs=require('fs');var fs_extra=require(_0xd416('0xc'));var _=require('lodash');var squel=require(_0xd416('0xd'));var crypto=require(_0xd416('0xe'));var jsforce=require(_0xd416('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xd416('0xa'));var querystring=require(_0xd416('0x10'));var Papa=require(_0xd416('0x11'));var Redis=require(_0xd416('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd416('0x13'));var logger=require(_0xd416('0x14'))(_0xd416('0x15'));var utils=require(_0xd416('0x16'));var config=require(_0xd416('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xd416('0x18'))['db'];var jayson=require(_0xd416('0x19'));var client=jayson['client'][_0xd416('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x10809b,_0xb9c49e,_0x45851e,_0x3c069d){return new BPromise(function(_0x43bda0,_0x16f8e1){var _0x5e0d5b=_0x3c069d||client;return _0x5e0d5b[_0xd416('0x1b')](_0x10809b,_0x45851e)[_0xd416('0x1c')](function(_0x26772b){logger['info'](_0xd416('0x1d'),_0xb9c49e,_0xd416('0x1e'));logger['debug'](_0xd416('0x1f'),_0xb9c49e,_0xd416('0x1e'),JSON['stringify'](_0x26772b));if(_0x26772b[_0xd416('0x20')]){if(_0x26772b[_0xd416('0x20')][_0xd416('0x21')]===0x1f4){logger[_0xd416('0x20')](_0xd416('0x1d'),_0xb9c49e,_0x26772b[_0xd416('0x20')]['message']);return _0x16f8e1(_0x26772b['error']['message']);}logger['error'](_0xd416('0x1d'),_0xb9c49e,_0x26772b['error'][_0xd416('0x22')]);return _0x43bda0(_0x26772b[_0xd416('0x20')][_0xd416('0x22')]);}else{logger[_0xd416('0x23')]('Network,\x20%s,\x20%s',_0xb9c49e,_0xd416('0x1e'));_0x43bda0(_0x26772b[_0xd416('0x24')][_0xd416('0x22')]);}})['catch'](function(_0x539c31){logger[_0xd416('0x20')](_0xd416('0x1d'),_0xb9c49e,_0x539c31);_0x16f8e1(_0x539c31);});});}function respondWithStatusCode(_0x3acae7,_0x1b3125){_0x1b3125=_0x1b3125||0xcc;return function(_0x1ccdde){if(_0x1ccdde){return _0x3acae7['sendStatus'](_0x1b3125);}return _0x3acae7['status'](_0x1b3125)[_0xd416('0x25')]();};}function respondWithResult(_0x31804e,_0x4e4eeb){_0x4e4eeb=_0x4e4eeb||0xc8;return function(_0x27a373){if(_0x27a373){return _0x31804e[_0xd416('0x26')](_0x4e4eeb)['json'](_0x27a373);}};}function respondWithFilteredResult(_0x50bd5d,_0x3580b0){return function(_0x823293){if(_0x823293){var _0x61f446=typeof _0x3580b0[_0xd416('0x27')]===_0xd416('0x28')&&typeof _0x3580b0[_0xd416('0x29')]==='undefined';var _0x404a86=_0x823293[_0xd416('0x2a')];var _0x14c57c=_0x61f446?0x0:_0x3580b0['offset'];var _0xc0e911=_0x61f446?_0x823293[_0xd416('0x2a')]:_0x3580b0[_0xd416('0x27')]+_0x3580b0[_0xd416('0x29')];var _0x11b24e;if(_0xc0e911>=_0x404a86){_0xc0e911=_0x404a86;_0x11b24e=0xc8;}else{_0x11b24e=0xce;}_0x50bd5d[_0xd416('0x26')](_0x11b24e);return _0x50bd5d[_0xd416('0x2b')]('Content-Range',_0x14c57c+'-'+_0xc0e911+'/'+_0x404a86)[_0xd416('0x2c')](_0x823293);}return null;};}function patchUpdates(_0x3077be){return function(_0x30e76f){try{jsonpatch[_0xd416('0x2d')](_0x30e76f,_0x3077be,!![]);}catch(_0x4da09e){return BPromise[_0xd416('0x2e')](_0x4da09e);}return _0x30e76f[_0xd416('0x2f')]();};}function saveUpdates(_0x4dc4be,_0x57fb9d){return function(_0x1f23bd){if(_0x1f23bd){return _0x1f23bd[_0xd416('0x30')](_0x4dc4be)['then'](function(_0x14a80e){return _0x14a80e;});}return null;};}function removeEntity(_0x3683d1,_0x367874){return function(_0xe279fa){if(_0xe279fa){return _0xe279fa[_0xd416('0x31')]()[_0xd416('0x1c')](function(){_0x3683d1[_0xd416('0x26')](0xcc)[_0xd416('0x25')]();});}};}function handleEntityNotFound(_0x16466f,_0x3b43f5){return function(_0x210072){if(!_0x210072){_0x16466f[_0xd416('0x32')](0x194);}return _0x210072;};}function handleError(_0x49cf60,_0xa83b91){_0xa83b91=_0xa83b91||0x1f4;return function(_0x3daf53){logger['error'](_0x3daf53[_0xd416('0x33')]);if(_0x3daf53[_0xd416('0x34')]){delete _0x3daf53[_0xd416('0x34')];}_0x49cf60[_0xd416('0x26')](_0xa83b91)[_0xd416('0x35')](_0x3daf53);};}exports[_0xd416('0x36')]=function(_0x4b70a6,_0x487e68){var _0x5772f8={},_0x299ac9={},_0xa18697={'count':0x0,'rows':[]};var _0x57f311=_[_0xd416('0x37')](db[_0xd416('0x38')]['rawAttributes'],function(_0xd714ee){return{'name':_0xd714ee[_0xd416('0x39')],'type':_0xd714ee['type']['key']};});_0x299ac9['model']=_[_0xd416('0x37')](_0x57f311,_0xd416('0x34'));_0x299ac9[_0xd416('0x3a')]=_['keys'](_0x4b70a6['query']);_0x299ac9[_0xd416('0x3b')]=_[_0xd416('0x3c')](_0x299ac9[_0xd416('0x3d')],_0x299ac9[_0xd416('0x3a')]);_0x5772f8['attributes']=_[_0xd416('0x3c')](_0x299ac9[_0xd416('0x3d')],qs[_0xd416('0x3e')](_0x4b70a6[_0xd416('0x3a')][_0xd416('0x3e')]));_0x5772f8[_0xd416('0x3f')]=_0x5772f8[_0xd416('0x3f')][_0xd416('0x40')]?_0x5772f8[_0xd416('0x3f')]:_0x299ac9[_0xd416('0x3d')];if(!_0x4b70a6[_0xd416('0x3a')][_0xd416('0x41')](_0xd416('0x42'))){_0x5772f8['limit']=qs['limit'](_0x4b70a6['query'][_0xd416('0x29')]);_0x5772f8[_0xd416('0x27')]=qs[_0xd416('0x27')](_0x4b70a6[_0xd416('0x3a')]['offset']);}_0x5772f8[_0xd416('0x43')]=qs['sort'](_0x4b70a6[_0xd416('0x3a')][_0xd416('0x44')]);_0x5772f8[_0xd416('0x45')]=qs[_0xd416('0x3b')](_[_0xd416('0x46')](_0x4b70a6[_0xd416('0x3a')],_0x299ac9[_0xd416('0x3b')]),_0x57f311);if(_0x4b70a6[_0xd416('0x3a')]['filter']){_0x5772f8[_0xd416('0x45')]=_[_0xd416('0x47')](_0x5772f8['where'],{'$or':_[_0xd416('0x37')](_0x57f311,function(_0x218553){if(_0x218553[_0xd416('0x48')]!==_0xd416('0x49')){var _0x1f8f72={};_0x1f8f72[_0x218553[_0xd416('0x34')]]={'$like':'%'+_0x4b70a6['query'][_0xd416('0x4a')]+'%'};return _0x1f8f72;}})});}_0x5772f8=_[_0xd416('0x47')]({},_0x5772f8,_0x4b70a6[_0xd416('0x4b')]);var _0x5ec044={'where':_0x5772f8[_0xd416('0x45')]};return db['Network']['count'](_0x5ec044)[_0xd416('0x1c')](function(_0x464deb){_0xa18697[_0xd416('0x2a')]=_0x464deb;if(_0x4b70a6[_0xd416('0x3a')][_0xd416('0x4c')]){_0x5772f8['include']=[{'all':!![]}];}return db['Network'][_0xd416('0x4d')](_0x5772f8);})['then'](function(_0x21b758){_0xa18697[_0xd416('0x4e')]=_0x21b758;return _0xa18697;})[_0xd416('0x1c')](respondWithFilteredResult(_0x487e68,_0x5772f8))[_0xd416('0x4f')](handleError(_0x487e68,null));};exports[_0xd416('0x50')]=function(_0x44d2f9,_0x143e03){var _0x34897c={'raw':!![],'where':{'id':_0x44d2f9['params']['id']}},_0x1cd57e={};_0x1cd57e['model']=_['keys'](db[_0xd416('0x38')][_0xd416('0x51')]);_0x1cd57e[_0xd416('0x3a')]=_[_0xd416('0x52')](_0x44d2f9['query']);_0x1cd57e[_0xd416('0x3b')]=_['intersection'](_0x1cd57e[_0xd416('0x3d')],_0x1cd57e[_0xd416('0x3a')]);_0x34897c[_0xd416('0x3f')]=_[_0xd416('0x3c')](_0x1cd57e['model'],qs[_0xd416('0x3e')](_0x44d2f9[_0xd416('0x3a')][_0xd416('0x3e')]));_0x34897c[_0xd416('0x3f')]=_0x34897c[_0xd416('0x3f')]['length']?_0x34897c['attributes']:_0x1cd57e[_0xd416('0x3d')];if(_0x44d2f9['query'][_0xd416('0x4c')]){_0x34897c[_0xd416('0x53')]=[{'all':!![]}];}_0x34897c=_[_0xd416('0x47')]({},_0x34897c,_0x44d2f9['options']);return db[_0xd416('0x38')][_0xd416('0x54')](_0x34897c)[_0xd416('0x1c')](handleEntityNotFound(_0x143e03,null))[_0xd416('0x1c')](respondWithResult(_0x143e03,null))['catch'](handleError(_0x143e03,null));};exports[_0xd416('0x55')]=function(_0x4c3af2,_0x4c7610,_0x299065){var _0xc5412b;return db[_0xd416('0x56')]['transaction'](function(_0x494e20){return db[_0xd416('0x38')][_0xd416('0x55')](_0x4c3af2[_0xd416('0x57')],{'raw':!![]})['then'](function(_0x56d641){_0xc5412b=_0x56d641;return db[_0xd416('0x38')][_0xd416('0x4d')]({'where':{'type':_0x4c3af2[_0xd416('0x57')]['type']},'raw':!![]});})[_0xd416('0x1c')](function(_0x15d734){if(_0xc5412b[_0xd416('0x48')][_0xd416('0x58')]()==_0xd416('0x59')){var _0x4218a1=fs[_0xd416('0x5a')](path[_0xd416('0x5b')](config[_0xd416('0x5c')],_0xd416('0x5d')),_0xd416('0x5e'));var _0x3ea2c2=ejs['render'](_0x4218a1,{'networks':_0x15d734||[]});fs['writeFileSync'](_0xd416('0x5f'),_0x3ea2c2);return respondWithRpcPromise(_0xd416('0x60'),'create',{'module':'res_stun_monitor.so'});}else if(_0xc5412b[_0xd416('0x48')][_0xd416('0x58')]()==_0xd416('0x61')){var _0x1b8a61=fs[_0xd416('0x5a')](path[_0xd416('0x5b')](config['root'],_0xd416('0x62')),_0xd416('0x5e'));var _0x37ad67=ejs[_0xd416('0x63')](_0x1b8a61,{'networks':_0x15d734||[]});fs[_0xd416('0x64')](_0xd416('0x65'),_0x37ad67);return respondWithRpcPromise(_0xd416('0x60'),_0xd416('0x55'),{'module':_0xd416('0x66')});}else{var _0x457d4a=fs[_0xd416('0x5a')](path[_0xd416('0x5b')](config[_0xd416('0x5c')],'server/files/templates/network.ejs'),_0xd416('0x5e'));var _0x3c45a9=ejs[_0xd416('0x63')](_0x457d4a,{'networks':_0x15d734||[]});fs[_0xd416('0x64')](util['format']('/etc/asterisk/sip_xcally_%s.conf',_0x4c3af2[_0xd416('0x57')][_0xd416('0x48')][_0xd416('0x67')]()),_0x3c45a9);return respondWithRpcPromise(_0xd416('0x60'),_0xd416('0x55'),{'module':'chan_sip.so'});}return null;})[_0xd416('0x1c')](function(){return _0xc5412b;});})[_0xd416('0x1c')](respondWithResult(_0x4c7610,0xc9))[_0xd416('0x4f')](handleError(_0x4c7610,null));};exports['update']=function(_0x135627,_0x4249dc,_0x5f292){var _0x24020e;return db[_0xd416('0x56')]['transaction'](function(_0x18662c){return db[_0xd416('0x38')][_0xd416('0x54')]({'where':{'id':_0x135627['params']['id']}})['then'](handleEntityNotFound(_0x4249dc,null))[_0xd416('0x1c')](saveUpdates(_0x135627['body'],null))[_0xd416('0x1c')](function(_0x46b884){if(_0x46b884){_0x24020e=_0x46b884;return db[_0xd416('0x38')][_0xd416('0x4d')]({'where':{'type':_0x24020e['type']},'raw':!![]});}return null;})[_0xd416('0x1c')](function(_0x13fb3c){if(_0x24020e['type'][_0xd416('0x58')]()==_0xd416('0x59')){var _0x5c030b=fs['readFileSync'](path[_0xd416('0x5b')](config[_0xd416('0x5c')],_0xd416('0x5d')),_0xd416('0x5e'));var _0x53d57a=ejs[_0xd416('0x63')](_0x5c030b,{'networks':_0x13fb3c||[]});fs[_0xd416('0x64')]('/etc/asterisk/stun_xcally.conf',_0x53d57a);return respondWithRpcPromise(_0xd416('0x60'),_0xd416('0x30'),{'module':_0xd416('0x66')});}else if(_0x24020e['type'][_0xd416('0x58')]()==_0xd416('0x61')){var _0x316f6b=fs[_0xd416('0x5a')](path[_0xd416('0x5b')](config[_0xd416('0x5c')],_0xd416('0x62')),'utf8');var _0x3a6d05=ejs[_0xd416('0x63')](_0x316f6b,{'networks':_0x13fb3c||[]});fs[_0xd416('0x64')]('/etc/asterisk/turn_xcally.conf',_0x3a6d05);return respondWithRpcPromise(_0xd416('0x60'),_0xd416('0x30'),{'module':_0xd416('0x66')});}else{var _0x52c8cb=fs[_0xd416('0x5a')](path[_0xd416('0x5b')](config[_0xd416('0x5c')],_0xd416('0x68')),'utf8');var _0x1caf40=ejs['render'](_0x52c8cb,{'networks':_0x13fb3c||[]});fs['writeFileSync'](util['format']('/etc/asterisk/sip_xcally_%s.conf',_0x135627[_0xd416('0x57')]['type'][_0xd416('0x67')]()),_0x1caf40);return respondWithRpcPromise('Reload',_0xd416('0x30'),{'module':_0xd416('0x69')});}return null;})[_0xd416('0x1c')](function(_0x1dece5){if(_0x1dece5){return _0x24020e;}return null;});})['then'](respondWithResult(_0x4249dc,null))[_0xd416('0x4f')](handleError(_0x4249dc,null));};exports[_0xd416('0x31')]=function(_0x31173c,_0xd255ef,_0x25daa7){var _0x2df8ca;return db['Network'][_0xd416('0x54')]({'where':{'id':_0x31173c[_0xd416('0x6a')]['id']}})[_0xd416('0x1c')](function(_0x5532a7){_0x2df8ca=_0x5532a7;return _0x5532a7;})[_0xd416('0x1c')](handleEntityNotFound(_0xd255ef,null))[_0xd416('0x1c')](removeEntity(_0xd255ef,null))[_0xd416('0x1c')](function(){if(_0x2df8ca){return db['Network'][_0xd416('0x4d')]({'where':{'type':_0x2df8ca[_0xd416('0x48')]},'raw':!![]});}})[_0xd416('0x1c')](function(_0x1ca22d){if(_0x2df8ca[_0xd416('0x48')][_0xd416('0x58')]()=='STUN'){var _0x59db08=fs[_0xd416('0x5a')](path[_0xd416('0x5b')](config[_0xd416('0x5c')],_0xd416('0x5d')),'utf8');var _0x59ad97=ejs['render'](_0x59db08,{'networks':_0x1ca22d||[]});fs[_0xd416('0x64')](_0xd416('0x5f'),_0x59ad97);return respondWithRpcPromise(_0xd416('0x60'),_0xd416('0x31'),{'module':_0xd416('0x66')});}else if(_0x2df8ca[_0xd416('0x48')][_0xd416('0x58')]()==_0xd416('0x61')){var _0x42d894=fs[_0xd416('0x5a')](path[_0xd416('0x5b')](config['root'],_0xd416('0x62')),'utf8');var _0x21933d=ejs[_0xd416('0x63')](_0x42d894,{'networks':_0x1ca22d||[]});fs[_0xd416('0x64')](_0xd416('0x65'),_0x21933d);return respondWithRpcPromise(_0xd416('0x60'),_0xd416('0x31'),{'module':_0xd416('0x66')});}else{var _0x2b832b=fs[_0xd416('0x5a')](path[_0xd416('0x5b')](config[_0xd416('0x5c')],_0xd416('0x68')),_0xd416('0x5e'));var _0x3aaa6a=ejs[_0xd416('0x63')](_0x2b832b,{'networks':_0x1ca22d||[]});fs['writeFileSync'](util[_0xd416('0x6b')]('/etc/asterisk/sip_xcally_%s.conf',_0x31173c[_0xd416('0x57')][_0xd416('0x48')]['toLowerCase']()),_0x3aaa6a);return respondWithRpcPromise('Reload',_0xd416('0x31'),{'module':_0xd416('0x69')});}return null;})[_0xd416('0x4f')](handleError(_0xd255ef,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 2fdfbd1..1e30163 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 _0x8b29=['lodash','../../config/logger','api','request-promise','path','../../config/environment','exports','define','Network','network'];(function(_0x4902a3,_0x418aac){var _0x52ff3b=function(_0xe5a61f){while(--_0xe5a61f){_0x4902a3['push'](_0x4902a3['shift']());}};_0x52ff3b(++_0x418aac);}(_0x8b29,0xbe));var _0x98b2=function(_0x5f04ea,_0x3b4c1d){_0x5f04ea=_0x5f04ea-0x0;var _0x5ed591=_0x8b29[_0x5f04ea];return _0x5ed591;};'use strict';var _=require(_0x98b2('0x0'));var util=require('util');var logger=require(_0x98b2('0x1'))(_0x98b2('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x98b2('0x3'));var fs=require('fs');var path=require(_0x98b2('0x4'));var rimraf=require('rimraf');var config=require(_0x98b2('0x5'));var attributes=require('./network.attributes');module[_0x98b2('0x6')]=function(_0xa3c251,_0xb0082c){return _0xa3c251[_0x98b2('0x7')](_0x98b2('0x8'),attributes,{'tableName':_0x98b2('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3a25=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./network.attributes','exports','define','network','lodash'];(function(_0x23fdfb,_0x1814d4){var _0x2133e4=function(_0x4ab780){while(--_0x4ab780){_0x23fdfb['push'](_0x23fdfb['shift']());}};_0x2133e4(++_0x1814d4);}(_0x3a25,0x15d));var _0x53a2=function(_0x30d1c1,_0x340855){_0x30d1c1=_0x30d1c1-0x0;var _0x240b48=_0x3a25[_0x30d1c1];return _0x240b48;};'use strict';var _=require(_0x53a2('0x0'));var util=require(_0x53a2('0x1'));var logger=require(_0x53a2('0x2'))(_0x53a2('0x3'));var moment=require(_0x53a2('0x4'));var BPromise=require(_0x53a2('0x5'));var rp=require(_0x53a2('0x6'));var fs=require('fs');var path=require(_0x53a2('0x7'));var rimraf=require(_0x53a2('0x8'));var config=require(_0x53a2('0x9'));var attributes=require(_0x53a2('0xa'));module[_0x53a2('0xb')]=function(_0x2b4011,_0x346fc7){return _0x2b4011[_0x53a2('0xc')]('Network',attributes,{'tableName':_0x53a2('0xd'),'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 ff3566f..15e3448 100644 --- a/server/api/network/network.rpc.js +++ b/server/api/network/network.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x7a54,0x106));var _0x47a5=function(_0x129af0,_0x943bb6){_0x129af0=_0x129af0-0x0;var _0xc735b2=_0x7a54[_0x129af0];return _0xc735b2;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +var _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x1d1e2e,_0x560855){var _0x22c325=function(_0x45b3b2){while(--_0x45b3b2){_0x1d1e2e['push'](_0x1d1e2e['shift']());}};_0x22c325(++_0x560855);}(_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 diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index f84c583..16a387a 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 _0x450b=['/:id/users','addAgents','/:id/send','send','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/applications','getApplications','/:id/interactions','getInteractions','getAgents','post','create','addAnswer','/:id/notify','notify','addApplications'];(function(_0x2dadca,_0x56aaba){var _0x1595a7=function(_0x558746){while(--_0x558746){_0x2dadca['push'](_0x2dadca['shift']());}};_0x1595a7(++_0x56aaba);}(_0x450b,0x102));var _0xb450=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x450b[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xb450('0x0'));var util=require(_0xb450('0x1'));var path=require('path');var timeout=require(_0xb450('0x2'));var express=require(_0xb450('0x3'));var router=express[_0xb450('0x4')]();var fs_extra=require(_0xb450('0x5'));var auth=require(_0xb450('0x6'));var interaction=require(_0xb450('0x7'));var config=require(_0xb450('0x8'));var controller=require('./openchannelAccount.controller');router['get']('/',auth[_0xb450('0x9')](),controller[_0xb450('0xa')]);router[_0xb450('0xb')](_0xb450('0xc'),auth[_0xb450('0x9')](),controller['describe']);router[_0xb450('0xb')](_0xb450('0xd'),auth[_0xb450('0x9')](),controller[_0xb450('0xe')]);router[_0xb450('0xb')](_0xb450('0xf'),auth[_0xb450('0x9')](),controller[_0xb450('0x10')]);router[_0xb450('0xb')](_0xb450('0x11'),auth[_0xb450('0x9')](),controller['getAnswers']);router[_0xb450('0xb')](_0xb450('0x12'),auth[_0xb450('0x9')](),controller[_0xb450('0x13')]);router[_0xb450('0xb')](_0xb450('0x14'),auth[_0xb450('0x9')](),controller[_0xb450('0x15')]);router[_0xb450('0xb')]('/:id/users',auth['isAuthenticated'](),controller[_0xb450('0x16')]);router[_0xb450('0x17')]('/',auth[_0xb450('0x9')](),controller[_0xb450('0x18')]);router[_0xb450('0x17')]('/:id/dispositions',auth['isAuthenticated'](),controller['addDisposition']);router[_0xb450('0x17')](_0xb450('0x11'),auth[_0xb450('0x9')](),controller[_0xb450('0x19')]);router[_0xb450('0x17')](_0xb450('0x1a'),controller[_0xb450('0x1b')]);router['post'](_0xb450('0x12'),auth['isAuthenticated'](),controller[_0xb450('0x1c')]);router[_0xb450('0x17')](_0xb450('0x1d'),auth[_0xb450('0x9')](),controller[_0xb450('0x1e')]);router[_0xb450('0x17')](_0xb450('0x1f'),auth[_0xb450('0x9')](),controller[_0xb450('0x20')]);router[_0xb450('0x21')](_0xb450('0xd'),auth['isAuthenticated'](),controller[_0xb450('0x22')]);router[_0xb450('0x23')](_0xb450('0xd'),auth[_0xb450('0x9')](),controller[_0xb450('0x24')]);router[_0xb450('0x23')](_0xb450('0xf'),auth['isAuthenticated'](),controller[_0xb450('0x25')]);router['delete']('/:id/canned_answers',auth[_0xb450('0x9')](),controller[_0xb450('0x26')]);router[_0xb450('0x23')]('/:id/users',auth[_0xb450('0x9')](),controller[_0xb450('0x27')]);module[_0xb450('0x28')]=router; \ No newline at end of file +var _0x2597=['get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','/:id/canned_answers','/:id/applications','getApplications','/:id/interactions','getInteractions','getAgents','post','create','addDisposition','addAnswer','notify','addApplications','/:id/users','send','put','/:id','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2597,0xf4));var _0x7259=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0x2597[_0x12fc8d];return _0x3f9d04;};'use strict';var multer=require(_0x7259('0x0'));var util=require(_0x7259('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x7259('0x2')]();var fs_extra=require(_0x7259('0x3'));var auth=require(_0x7259('0x4'));var interaction=require(_0x7259('0x5'));var config=require(_0x7259('0x6'));var controller=require(_0x7259('0x7'));router[_0x7259('0x8')]('/',auth[_0x7259('0x9')](),controller[_0x7259('0xa')]);router[_0x7259('0x8')](_0x7259('0xb'),auth[_0x7259('0x9')](),controller[_0x7259('0xc')]);router['get']('/:id',auth[_0x7259('0x9')](),controller[_0x7259('0xd')]);router[_0x7259('0x8')](_0x7259('0xe'),auth[_0x7259('0x9')](),controller['getDispositions']);router['get'](_0x7259('0xf'),auth[_0x7259('0x9')](),controller['getAnswers']);router['get'](_0x7259('0x10'),auth[_0x7259('0x9')](),controller[_0x7259('0x11')]);router['get'](_0x7259('0x12'),auth[_0x7259('0x9')](),controller[_0x7259('0x13')]);router[_0x7259('0x8')]('/:id/users',auth[_0x7259('0x9')](),controller[_0x7259('0x14')]);router[_0x7259('0x15')]('/',auth[_0x7259('0x9')](),controller[_0x7259('0x16')]);router[_0x7259('0x15')](_0x7259('0xe'),auth[_0x7259('0x9')](),controller[_0x7259('0x17')]);router[_0x7259('0x15')](_0x7259('0xf'),auth['isAuthenticated'](),controller[_0x7259('0x18')]);router[_0x7259('0x15')]('/:id/notify',controller[_0x7259('0x19')]);router[_0x7259('0x15')](_0x7259('0x10'),auth[_0x7259('0x9')](),controller[_0x7259('0x1a')]);router['post'](_0x7259('0x1b'),auth[_0x7259('0x9')](),controller['addAgents']);router[_0x7259('0x15')]('/:id/send',auth[_0x7259('0x9')](),controller[_0x7259('0x1c')]);router[_0x7259('0x1d')](_0x7259('0x1e'),auth[_0x7259('0x9')](),controller['update']);router[_0x7259('0x1f')](_0x7259('0x1e'),auth['isAuthenticated'](),controller['destroy']);router[_0x7259('0x1f')](_0x7259('0xe'),auth[_0x7259('0x9')](),controller[_0x7259('0x20')]);router[_0x7259('0x1f')](_0x7259('0xf'),auth[_0x7259('0x9')](),controller[_0x7259('0x21')]);router[_0x7259('0x1f')](_0x7259('0x1b'),auth[_0x7259('0x9')](),controller[_0x7259('0x22')]);module[_0x7259('0x23')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index cd03dce..744bd46 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 _0x6d46=['name','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','setDataValue','sequelize','randomstring','STRING'];(function(_0x2e41e2,_0x4e7250){var _0x2844d6=function(_0x28ce24){while(--_0x28ce24){_0x2e41e2['push'](_0x2e41e2['shift']());}};_0x2844d6(++_0x4e7250);}(_0x6d46,0x7f));var _0x66d4=function(_0x508dc5,_0x1aa23c){_0x508dc5=_0x508dc5-0x0;var _0x403554=_0x6d46[_0x508dc5];return _0x403554;};'use strict';var Sequelize=require(_0x66d4('0x0'));var rs=require(_0x66d4('0x1'));module['exports']={'name':{'type':Sequelize[_0x66d4('0x2')],'unique':_0x66d4('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x66d4('0x2')]},'token':{'type':Sequelize[_0x66d4('0x2')],'defaultValue':function(){return rs[_0x66d4('0x4')]();}},'replyUri':{'type':Sequelize[_0x66d4('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x66d4('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x66d4('0x5')],'defaultValue':function(){return _0x66d4('0x6');}},'notificationSound':{'type':Sequelize[_0x66d4('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x66d4('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x66d4('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x66d4('0x2')]},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x66d4('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x66d4('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x66d4('0x8')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x66d4('0x7')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x2efaeb){if(!_0x2efaeb)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0x66d4('0x9')]('mandatoryDisposition',_0x2efaeb);}}}; \ No newline at end of file +var _0x34b9=['generate','TEXT','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','randomstring','exports','STRING','name'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x34b9,0x8c));var _0x934b=function(_0x445879,_0x575780){_0x445879=_0x445879-0x0;var _0x325d43=_0x34b9[_0x445879];return _0x325d43;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x934b('0x0'));module[_0x934b('0x1')]={'name':{'type':Sequelize[_0x934b('0x2')],'unique':_0x934b('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x934b('0x4')]();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x934b('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x934b('0x5')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x934b('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x934b('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x934b('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x934b('0x2')]},'queueTransfer':{'type':Sequelize[_0x934b('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x934b('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x934b('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x934b('0x7')],'allowNull':!![],'defaultValue':null,'comment':_0x934b('0x8')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x934b('0x9'),'set':function(_0xdf9400){if(!_0xdf9400)this[_0x934b('0xa')](_0x934b('0xb'),null);this[_0x934b('0xa')]('mandatoryDisposition',_0xdf9400);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index d05ddd1..05c4677 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 _0xec13=['transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','OpenchannelApplication','findAndCountAll','finally','getApplications','Contact','Owner','fullname','Tag','Tags','color','tag','addAgents','omit','emit','removeAgents','userOpenchannelAccount:remove','getAgents','CmList','out','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','jayson/promise','client','then','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','OpenchannelAccount,\x20%s,\x20%s','message','info','result','catch','status','end','json','undefined','limit','count','set','Content-Range','reject','save','update','get','OpenchannelAccounts','UserProfileResource','destroy','sendStatus','stack','name','send','index','Pause','map','OpenchannelAccount','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','params','mandatoryDispositionPause','create','body','user','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','OpenchannelAccountId','getDispositions','findOne','rawAttributes','Disposition','removeDispositions','ids','CannedAnswer','removeAnswers','notify','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','isNil','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','List','DESC','Applications','account','applications','orderBy','priority','asc','Contacts','contact','threadId','externalUrl','OpenchannelInteraction','ContactId','spread','messageId','created','autoclose','push','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','interaction','UserId','User','unshift','agent','forcedOwnership','Start','startRouting','EventManager','addApplications','sequelize'];(function(_0x42e538,_0x1eb5bc){var _0x2cc98c=function(_0x8e3239){while(--_0x8e3239){_0x42e538['push'](_0x42e538['shift']());}};_0x2cc98c(++_0x1eb5bc);}(_0xec13,0xcf));var _0x3ec1=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0xec13[_0x5bd426];return _0x23a7eb;};'use strict';var emlformat=require(_0x3ec1('0x0'));var rimraf=require(_0x3ec1('0x1'));var zipdir=require(_0x3ec1('0x2'));var jsonpatch=require(_0x3ec1('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3ec1('0x4'));var Mustache=require(_0x3ec1('0x5'));var util=require(_0x3ec1('0x6'));var path=require(_0x3ec1('0x7'));var sox=require('sox');var csv=require(_0x3ec1('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3ec1('0x9'));var _=require(_0x3ec1('0xa'));var squel=require(_0x3ec1('0xb'));var crypto=require(_0x3ec1('0xc'));var jsforce=require(_0x3ec1('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x3ec1('0x8'));var querystring=require(_0x3ec1('0xe'));var Papa=require(_0x3ec1('0xf'));var Redis=require('ioredis');var authService=require(_0x3ec1('0x10'));var qs=require(_0x3ec1('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3ec1('0x12'));var logger=require(_0x3ec1('0x13'))('api');var utils=require(_0x3ec1('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x3ec1('0x15'));var db=require(_0x3ec1('0x16'))['db'];config[_0x3ec1('0x17')]=_[_0x3ec1('0x18')](config[_0x3ec1('0x17')],{'host':_0x3ec1('0x19'),'port':0x18eb});var socket=require(_0x3ec1('0x1a'))(new Redis(config['redis']));require('./openchannelAccount.socket')['register'](socket);var jayson=require(_0x3ec1('0x1b'));var client=jayson[_0x3ec1('0x1c')]['http']({'port':0x232c});var client9002=jayson[_0x3ec1('0x1c')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1dc7b0,_0x304c0a,_0x49e4b9,_0x2eb340){return new BPromise(function(_0x3cbc18,_0xf2cb7f){var _0x12a8b8=_0x2eb340||client;return _0x12a8b8['request'](_0x1dc7b0,_0x49e4b9)[_0x3ec1('0x1d')](function(_0x47d62d){logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x304c0a,'request\x20sent');logger['debug'](_0x3ec1('0x1e'),_0x304c0a,_0x3ec1('0x1f'),JSON[_0x3ec1('0x20')](_0x47d62d));if(_0x47d62d[_0x3ec1('0x21')]){if(_0x47d62d[_0x3ec1('0x21')][_0x3ec1('0x22')]===0x1f4){logger[_0x3ec1('0x21')](_0x3ec1('0x23'),_0x304c0a,_0x47d62d[_0x3ec1('0x21')]['message']);return _0xf2cb7f(_0x47d62d[_0x3ec1('0x21')][_0x3ec1('0x24')]);}logger[_0x3ec1('0x21')]('OpenchannelAccount,\x20%s,\x20%s',_0x304c0a,_0x47d62d[_0x3ec1('0x21')][_0x3ec1('0x24')]);return _0x3cbc18(_0x47d62d['error']['message']);}else{logger[_0x3ec1('0x25')](_0x3ec1('0x23'),_0x304c0a,_0x3ec1('0x1f'));_0x3cbc18(_0x47d62d[_0x3ec1('0x26')][_0x3ec1('0x24')]);}})[_0x3ec1('0x27')](function(_0x4b2a8d){logger['error'](_0x3ec1('0x23'),_0x304c0a,_0x4b2a8d);_0xf2cb7f(_0x4b2a8d);});});}function respondWithStatusCode(_0x3213c9,_0x578680){_0x578680=_0x578680||0xcc;return function(_0x5c1393){if(_0x5c1393){return _0x3213c9['sendStatus'](_0x578680);}return _0x3213c9[_0x3ec1('0x28')](_0x578680)[_0x3ec1('0x29')]();};}function respondWithResult(_0x556b4e,_0x3c3735){_0x3c3735=_0x3c3735||0xc8;return function(_0xe5ba0){if(_0xe5ba0){return _0x556b4e['status'](_0x3c3735)[_0x3ec1('0x2a')](_0xe5ba0);}};}function respondWithFilteredResult(_0x1b584c,_0x207f93){return function(_0x5cef51){if(_0x5cef51){var _0x2d9d3a=typeof _0x207f93['offset']===_0x3ec1('0x2b')&&typeof _0x207f93[_0x3ec1('0x2c')]===_0x3ec1('0x2b');var _0x411d05=_0x5cef51['count'];var _0x1fa2c8=_0x2d9d3a?0x0:_0x207f93['offset'];var _0x559614=_0x2d9d3a?_0x5cef51[_0x3ec1('0x2d')]:_0x207f93['offset']+_0x207f93['limit'];var _0x595f44;if(_0x559614>=_0x411d05){_0x559614=_0x411d05;_0x595f44=0xc8;}else{_0x595f44=0xce;}_0x1b584c[_0x3ec1('0x28')](_0x595f44);return _0x1b584c[_0x3ec1('0x2e')](_0x3ec1('0x2f'),_0x1fa2c8+'-'+_0x559614+'/'+_0x411d05)[_0x3ec1('0x2a')](_0x5cef51);}return null;};}function patchUpdates(_0x21a62e){return function(_0x3c7559){try{jsonpatch['apply'](_0x3c7559,_0x21a62e,!![]);}catch(_0x21dbe2){return BPromise[_0x3ec1('0x30')](_0x21dbe2);}return _0x3c7559[_0x3ec1('0x31')]();};}function saveUpdates(_0x233be7,_0x58a19f){return function(_0x4e17cb){if(_0x4e17cb){return _0x4e17cb[_0x3ec1('0x32')](_0x233be7)[_0x3ec1('0x1d')](function(_0xb8a1ec){return _0xb8a1ec;});}return null;};}function removeEntity(_0xe99ff1,_0x6ad893){return function(_0x208275){if(_0x208275){return _0x208275['destroy']()['then'](function(){var _0x51c673=_0x208275[_0x3ec1('0x33')]({'plain':!![]});var _0x5c3de6=_0x3ec1('0x34');return db[_0x3ec1('0x35')][_0x3ec1('0x36')]({'where':{'type':_0x5c3de6,'resourceId':_0x51c673['id']}})[_0x3ec1('0x1d')](function(){return _0x208275;});})[_0x3ec1('0x1d')](function(){_0xe99ff1[_0x3ec1('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x151133,_0xfa6d6e){return function(_0x4ff88b){if(!_0x4ff88b){_0x151133[_0x3ec1('0x37')](0x194);}return _0x4ff88b;};}function handleError(_0x5035f6,_0x5dc695){_0x5dc695=_0x5dc695||0x1f4;return function(_0x1bbd08){logger[_0x3ec1('0x21')](_0x1bbd08[_0x3ec1('0x38')]);if(_0x1bbd08[_0x3ec1('0x39')]){delete _0x1bbd08[_0x3ec1('0x39')];}_0x5035f6[_0x3ec1('0x28')](_0x5dc695)[_0x3ec1('0x3a')](_0x1bbd08);};}exports[_0x3ec1('0x3b')]=function(_0x21a936,_0x4bf855){var _0xd19e1f={'include':[{'model':db[_0x3ec1('0x3c')],'as':'mandatoryDispositionPause'}]},_0x268059={},_0x4fdf46={'count':0x0,'rows':[]};var _0x5a2896=_[_0x3ec1('0x3d')](db[_0x3ec1('0x3e')]['rawAttributes'],function(_0x3ce9b1){return{'name':_0x3ce9b1[_0x3ec1('0x3f')],'type':_0x3ce9b1['type'][_0x3ec1('0x40')]};});_0x268059['model']=_[_0x3ec1('0x3d')](_0x5a2896,_0x3ec1('0x39'));_0x268059[_0x3ec1('0x41')]=_[_0x3ec1('0x42')](_0x21a936['query']);_0x268059[_0x3ec1('0x43')]=_[_0x3ec1('0x44')](_0x268059[_0x3ec1('0x45')],_0x268059['query']);_0xd19e1f[_0x3ec1('0x46')]=_[_0x3ec1('0x44')](_0x268059[_0x3ec1('0x45')],qs[_0x3ec1('0x47')](_0x21a936[_0x3ec1('0x41')]['fields']));_0xd19e1f[_0x3ec1('0x46')]=_0xd19e1f['attributes'][_0x3ec1('0x48')]?_0xd19e1f[_0x3ec1('0x46')]:_0x268059[_0x3ec1('0x45')];if(!_0x21a936[_0x3ec1('0x41')][_0x3ec1('0x49')](_0x3ec1('0x4a'))){_0xd19e1f['limit']=qs[_0x3ec1('0x2c')](_0x21a936[_0x3ec1('0x41')][_0x3ec1('0x2c')]);_0xd19e1f[_0x3ec1('0x4b')]=qs['offset'](_0x21a936[_0x3ec1('0x41')][_0x3ec1('0x4b')]);}_0xd19e1f[_0x3ec1('0x4c')]=qs['sort'](_0x21a936[_0x3ec1('0x41')][_0x3ec1('0x4d')]);_0xd19e1f[_0x3ec1('0x4e')]=qs[_0x3ec1('0x43')](_[_0x3ec1('0x4f')](_0x21a936[_0x3ec1('0x41')],_0x268059[_0x3ec1('0x43')]),_0x5a2896);if(_0x21a936['query'][_0x3ec1('0x50')]){_0xd19e1f[_0x3ec1('0x4e')]=_[_0x3ec1('0x51')](_0xd19e1f[_0x3ec1('0x4e')],{'$or':_[_0x3ec1('0x3d')](_0x5a2896,function(_0x17c73d){if(_0x17c73d['type']!=='VIRTUAL'){var _0x539751={};_0x539751[_0x17c73d[_0x3ec1('0x39')]]={'$like':'%'+_0x21a936[_0x3ec1('0x41')][_0x3ec1('0x50')]+'%'};return _0x539751;}})});}_0xd19e1f=_[_0x3ec1('0x51')]({},_0xd19e1f,_0x21a936[_0x3ec1('0x52')]);var _0x4d8ec7={'where':_0xd19e1f[_0x3ec1('0x4e')]};return db[_0x3ec1('0x3e')][_0x3ec1('0x2d')](_0x4d8ec7)[_0x3ec1('0x1d')](function(_0x47ee31){_0x4fdf46[_0x3ec1('0x2d')]=_0x47ee31;if(_0x21a936[_0x3ec1('0x41')][_0x3ec1('0x53')]){_0xd19e1f[_0x3ec1('0x54')]=[{'all':!![]}];}return db['OpenchannelAccount'][_0x3ec1('0x55')](_0xd19e1f);})['then'](function(_0x1fe868){_0x4fdf46[_0x3ec1('0x56')]=_0x1fe868;return _0x4fdf46;})[_0x3ec1('0x1d')](respondWithFilteredResult(_0x4bf855,_0xd19e1f))['catch'](handleError(_0x4bf855,null));};exports[_0x3ec1('0x57')]=function(_0x35851a,_0x46456c){var _0x4eba3d={'raw':![],'where':{'id':_0x35851a[_0x3ec1('0x58')]['id']},'include':[{'model':db[_0x3ec1('0x3c')],'as':_0x3ec1('0x59')}]},_0x6083f7={};_0x6083f7[_0x3ec1('0x45')]=_['keys'](db[_0x3ec1('0x3e')]['rawAttributes']);_0x6083f7['query']=_[_0x3ec1('0x42')](_0x35851a[_0x3ec1('0x41')]);_0x6083f7['filters']=_[_0x3ec1('0x44')](_0x6083f7[_0x3ec1('0x45')],_0x6083f7[_0x3ec1('0x41')]);_0x4eba3d['attributes']=_[_0x3ec1('0x44')](_0x6083f7[_0x3ec1('0x45')],qs['fields'](_0x35851a[_0x3ec1('0x41')][_0x3ec1('0x47')]));_0x4eba3d[_0x3ec1('0x46')]=_0x4eba3d[_0x3ec1('0x46')][_0x3ec1('0x48')]?_0x4eba3d[_0x3ec1('0x46')]:_0x6083f7[_0x3ec1('0x45')];if(_0x35851a[_0x3ec1('0x41')][_0x3ec1('0x53')]){_0x4eba3d[_0x3ec1('0x54')]=[{'all':!![]}];}_0x4eba3d=_[_0x3ec1('0x51')]({},_0x4eba3d,_0x35851a[_0x3ec1('0x52')]);return db[_0x3ec1('0x3e')]['find'](_0x4eba3d)[_0x3ec1('0x1d')](handleEntityNotFound(_0x46456c,null))[_0x3ec1('0x1d')](respondWithResult(_0x46456c,null))[_0x3ec1('0x27')](handleError(_0x46456c,null));};exports[_0x3ec1('0x5a')]=function(_0x4e8f59,_0x335820){return db['OpenchannelAccount'][_0x3ec1('0x5a')](_0x4e8f59[_0x3ec1('0x5b')],{})[_0x3ec1('0x1d')](function(_0x33d131){var _0xd92f20=_0x4e8f59[_0x3ec1('0x5c')][_0x3ec1('0x33')]({'plain':!![]});if(!_0xd92f20)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xd92f20['role']===_0x3ec1('0x5c')){var _0x26aee1=_0x33d131[_0x3ec1('0x33')]({'plain':!![]});var _0xb522a3=_0x3ec1('0x34');return db[_0x3ec1('0x5d')][_0x3ec1('0x5e')]({'where':{'name':_0xb522a3,'userProfileId':_0xd92f20['userProfileId']},'raw':!![]})[_0x3ec1('0x1d')](function(_0xa62338){if(_0xa62338&&_0xa62338[_0x3ec1('0x5f')]===0x0){return db[_0x3ec1('0x35')]['create']({'name':_0x26aee1[_0x3ec1('0x39')],'resourceId':_0x26aee1['id'],'type':_0xa62338[_0x3ec1('0x39')],'sectionId':_0xa62338['id']},{})['then'](function(){return _0x33d131;});}else{return _0x33d131;}})[_0x3ec1('0x27')](function(_0x30505b){logger[_0x3ec1('0x21')](_0x3ec1('0x60'),_0x30505b);throw _0x30505b;});}return _0x33d131;})[_0x3ec1('0x1d')](respondWithResult(_0x335820,0xc9))[_0x3ec1('0x27')](handleError(_0x335820,null));};exports['update']=function(_0x5b4ecd,_0x1872be){if(_0x5b4ecd[_0x3ec1('0x5b')]['id']){delete _0x5b4ecd[_0x3ec1('0x5b')]['id'];}return db[_0x3ec1('0x3e')][_0x3ec1('0x5e')]({'where':{'id':_0x5b4ecd[_0x3ec1('0x58')]['id']},'include':[{'model':db[_0x3ec1('0x3c')],'as':_0x3ec1('0x59')}]})['then'](handleEntityNotFound(_0x1872be,null))[_0x3ec1('0x1d')](saveUpdates(_0x5b4ecd['body'],null))[_0x3ec1('0x1d')](respondWithResult(_0x1872be,null))['catch'](handleError(_0x1872be,null));};exports[_0x3ec1('0x36')]=function(_0x43846b,_0x198f76){return db[_0x3ec1('0x3e')][_0x3ec1('0x5e')]({'where':{'id':_0x43846b[_0x3ec1('0x58')]['id']}})[_0x3ec1('0x1d')](handleEntityNotFound(_0x198f76,null))['then'](removeEntity(_0x198f76,null))[_0x3ec1('0x27')](handleError(_0x198f76,null));};exports[_0x3ec1('0x61')]=function(_0xf3a2c6,_0x315b43){return db[_0x3ec1('0x3e')]['describe']()[_0x3ec1('0x1d')](respondWithResult(_0x315b43,null))[_0x3ec1('0x27')](handleError(_0x315b43,null));};exports['addDisposition']=function(_0x575252,_0x81094,_0x437e2b){if(_0x575252[_0x3ec1('0x5b')]['id']){delete _0x575252[_0x3ec1('0x5b')]['id'];}return db[_0x3ec1('0x3e')][_0x3ec1('0x5e')]({'where':{'id':_0x575252[_0x3ec1('0x58')]['id']}})['then'](handleEntityNotFound(_0x81094,null))[_0x3ec1('0x1d')](function(_0x1a0a93){if(_0x1a0a93){_0x575252[_0x3ec1('0x5b')][_0x3ec1('0x62')]=_0x1a0a93['id'];return db['Disposition'][_0x3ec1('0x5a')](_0x575252[_0x3ec1('0x5b')]);}})['then'](respondWithResult(_0x81094,null))[_0x3ec1('0x27')](handleError(_0x81094,null));};exports[_0x3ec1('0x63')]=function(_0x8509d0,_0x9a3f41,_0x25bc4b){var _0x4ba42a={'raw':![],'where':{}};var _0x51ca80={};var _0x2884ac={'count':0x0,'rows':[]};return db[_0x3ec1('0x3e')][_0x3ec1('0x64')]({'where':{'id':_0x8509d0[_0x3ec1('0x58')]['id']}})[_0x3ec1('0x1d')](handleEntityNotFound(_0x9a3f41,null))[_0x3ec1('0x1d')](function(_0x44f8bb){if(_0x44f8bb){_0x51ca80[_0x3ec1('0x45')]=_['keys'](db['Disposition'][_0x3ec1('0x65')]);_0x51ca80[_0x3ec1('0x41')]=_[_0x3ec1('0x42')](_0x8509d0['query']);_0x51ca80[_0x3ec1('0x43')]=_[_0x3ec1('0x44')](_0x51ca80[_0x3ec1('0x45')],_0x51ca80['query']);_0x4ba42a[_0x3ec1('0x46')]=_[_0x3ec1('0x44')](_0x51ca80[_0x3ec1('0x45')],qs[_0x3ec1('0x47')](_0x8509d0[_0x3ec1('0x41')][_0x3ec1('0x47')]));_0x4ba42a['attributes']=_0x4ba42a[_0x3ec1('0x46')]['length']?_0x4ba42a[_0x3ec1('0x46')]:_0x51ca80[_0x3ec1('0x45')];if(!_0x8509d0[_0x3ec1('0x41')]['hasOwnProperty']('nolimit')){_0x4ba42a['limit']=qs[_0x3ec1('0x2c')](_0x8509d0[_0x3ec1('0x41')][_0x3ec1('0x2c')]);_0x4ba42a[_0x3ec1('0x4b')]=qs[_0x3ec1('0x4b')](_0x8509d0[_0x3ec1('0x41')]['offset']);}_0x4ba42a[_0x3ec1('0x4c')]=qs['sort'](_0x8509d0[_0x3ec1('0x41')]['sort']);_0x4ba42a[_0x3ec1('0x4e')]=qs[_0x3ec1('0x43')](_[_0x3ec1('0x4f')](_0x8509d0['query'],_0x51ca80['filters']));_0x4ba42a[_0x3ec1('0x4e')][_0x3ec1('0x62')]=_0x44f8bb['id'];if(_0x8509d0[_0x3ec1('0x41')][_0x3ec1('0x50')]){_0x4ba42a[_0x3ec1('0x4e')]=_['merge'](_0x4ba42a[_0x3ec1('0x4e')],{'$or':_['map'](_0x4ba42a['attributes'],function(_0xb24066){var _0x200f61={};_0x200f61[_0xb24066]={'$like':'%'+_0x8509d0[_0x3ec1('0x41')][_0x3ec1('0x50')]+'%'};return _0x200f61;})});}_0x4ba42a=_['merge']({},_0x4ba42a,_0x8509d0[_0x3ec1('0x52')]);return db[_0x3ec1('0x66')][_0x3ec1('0x2d')]({'where':_0x4ba42a[_0x3ec1('0x4e')]})[_0x3ec1('0x1d')](function(_0x5b36fc){_0x2884ac['count']=_0x5b36fc;if(_0x8509d0[_0x3ec1('0x41')][_0x3ec1('0x53')]){_0x4ba42a[_0x3ec1('0x54')]=[{'all':!![]}];}return db[_0x3ec1('0x66')]['findAll'](_0x4ba42a);})['then'](function(_0x5c92f8){_0x2884ac[_0x3ec1('0x56')]=_0x5c92f8;return _0x2884ac;});}})['then'](respondWithFilteredResult(_0x9a3f41,_0x4ba42a))[_0x3ec1('0x27')](handleError(_0x9a3f41,null));};exports['removeDispositions']=function(_0x12c6dd,_0x141a97,_0x2e2896){return db['OpenchannelAccount']['find']({'where':{'id':_0x12c6dd[_0x3ec1('0x58')]['id']}})[_0x3ec1('0x1d')](handleEntityNotFound(_0x141a97,null))['then'](function(_0x4fea4b){if(_0x4fea4b){return _0x4fea4b[_0x3ec1('0x67')](_0x12c6dd['query'][_0x3ec1('0x68')]);}})[_0x3ec1('0x1d')](respondWithStatusCode(_0x141a97,null))[_0x3ec1('0x27')](handleError(_0x141a97,null));};exports['addAnswer']=function(_0xc37026,_0x176e3c,_0x24e674){if(_0xc37026['body']['id']){delete _0xc37026[_0x3ec1('0x5b')]['id'];}return db[_0x3ec1('0x3e')][_0x3ec1('0x5e')]({'where':{'id':_0xc37026[_0x3ec1('0x58')]['id']}})[_0x3ec1('0x1d')](handleEntityNotFound(_0x176e3c,null))['then'](function(_0x50bd67){if(_0x50bd67){_0xc37026[_0x3ec1('0x5b')]['OpenchannelAccountId']=_0x50bd67['id'];return db[_0x3ec1('0x69')][_0x3ec1('0x5a')](_0xc37026[_0x3ec1('0x5b')]);}})[_0x3ec1('0x1d')](respondWithResult(_0x176e3c,null))[_0x3ec1('0x27')](handleError(_0x176e3c,null));};exports['getAnswers']=function(_0x9c191c,_0x50a41e,_0x822a1){var _0x473fa9={'raw':![],'where':{}};var _0x5e98a2={};var _0x5687e2={'count':0x0,'rows':[]};return db[_0x3ec1('0x3e')][_0x3ec1('0x64')]({'where':{'id':_0x9c191c[_0x3ec1('0x58')]['id']}})[_0x3ec1('0x1d')](handleEntityNotFound(_0x50a41e,null))[_0x3ec1('0x1d')](function(_0x4146d1){if(_0x4146d1){_0x5e98a2[_0x3ec1('0x45')]=_[_0x3ec1('0x42')](db[_0x3ec1('0x69')]['rawAttributes']);_0x5e98a2[_0x3ec1('0x41')]=_[_0x3ec1('0x42')](_0x9c191c[_0x3ec1('0x41')]);_0x5e98a2['filters']=_[_0x3ec1('0x44')](_0x5e98a2[_0x3ec1('0x45')],_0x5e98a2[_0x3ec1('0x41')]);_0x473fa9['attributes']=_[_0x3ec1('0x44')](_0x5e98a2[_0x3ec1('0x45')],qs[_0x3ec1('0x47')](_0x9c191c[_0x3ec1('0x41')][_0x3ec1('0x47')]));_0x473fa9[_0x3ec1('0x46')]=_0x473fa9['attributes'][_0x3ec1('0x48')]?_0x473fa9[_0x3ec1('0x46')]:_0x5e98a2['model'];if(!_0x9c191c[_0x3ec1('0x41')][_0x3ec1('0x49')](_0x3ec1('0x4a'))){_0x473fa9[_0x3ec1('0x2c')]=qs[_0x3ec1('0x2c')](_0x9c191c[_0x3ec1('0x41')][_0x3ec1('0x2c')]);_0x473fa9[_0x3ec1('0x4b')]=qs[_0x3ec1('0x4b')](_0x9c191c[_0x3ec1('0x41')]['offset']);}_0x473fa9[_0x3ec1('0x4c')]=qs[_0x3ec1('0x4d')](_0x9c191c[_0x3ec1('0x41')][_0x3ec1('0x4d')]);_0x473fa9[_0x3ec1('0x4e')]=qs[_0x3ec1('0x43')](_[_0x3ec1('0x4f')](_0x9c191c[_0x3ec1('0x41')],_0x5e98a2[_0x3ec1('0x43')]));_0x473fa9[_0x3ec1('0x4e')][_0x3ec1('0x62')]=_0x4146d1['id'];if(_0x9c191c['query'][_0x3ec1('0x50')]){_0x473fa9[_0x3ec1('0x4e')]=_[_0x3ec1('0x51')](_0x473fa9[_0x3ec1('0x4e')],{'$or':_[_0x3ec1('0x3d')](_0x473fa9[_0x3ec1('0x46')],function(_0x493e93){var _0x435f88={};_0x435f88[_0x493e93]={'$like':'%'+_0x9c191c['query']['filter']+'%'};return _0x435f88;})});}_0x473fa9=_[_0x3ec1('0x51')]({},_0x473fa9,_0x9c191c[_0x3ec1('0x52')]);return db[_0x3ec1('0x69')]['count']({'where':_0x473fa9[_0x3ec1('0x4e')]})['then'](function(_0x1a3449){_0x5687e2[_0x3ec1('0x2d')]=_0x1a3449;if(_0x9c191c['query'][_0x3ec1('0x53')]){_0x473fa9['include']=[{'all':!![]}];}return db[_0x3ec1('0x69')]['findAll'](_0x473fa9);})[_0x3ec1('0x1d')](function(_0x36f28b){_0x5687e2[_0x3ec1('0x56')]=_0x36f28b;return _0x5687e2;});}})[_0x3ec1('0x1d')](respondWithFilteredResult(_0x50a41e,_0x473fa9))[_0x3ec1('0x27')](handleError(_0x50a41e,null));};exports[_0x3ec1('0x6a')]=function(_0x42c2b4,_0x105cdc,_0x473fd1){return db[_0x3ec1('0x3e')]['find']({'where':{'id':_0x42c2b4['params']['id']}})[_0x3ec1('0x1d')](handleEntityNotFound(_0x105cdc,null))[_0x3ec1('0x1d')](function(_0x2de3fe){if(_0x2de3fe){return _0x2de3fe['removeAnswers'](_0x42c2b4[_0x3ec1('0x41')][_0x3ec1('0x68')]);}})['then'](respondWithStatusCode(_0x105cdc,null))[_0x3ec1('0x27')](handleError(_0x105cdc,null));};exports[_0x3ec1('0x6b')]=function(_0x13c6ec,_0x3ab836,_0x4723fc){var _0x5152cf={'body':_0x13c6ec[_0x3ec1('0x5b')],'channel':'openchannel'};var _0x319450=[];var _0x1647eb=[];var _0x44a228={};var _0x28591f=![];return db[_0x3ec1('0x6c')]['describe']()[_0x3ec1('0x1d')](function(_0x39c878){if(!_0x39c878){throw new db[(_0x3ec1('0x6d'))][(_0x3ec1('0x6e'))](_0x3ec1('0x6f'));}_0x319450=_[_0x3ec1('0x70')](_[_0x3ec1('0x42')](_0x39c878),[_0x3ec1('0x71'),_0x3ec1('0x72')]);_0x1647eb=_[_0x3ec1('0x70')](_[_0x3ec1('0x42')](_0x39c878),[_0x3ec1('0x71'),'updatedAt',_0x3ec1('0x73'),_0x3ec1('0x74')]);if(_0x13c6ec['body']['id']){delete _0x13c6ec[_0x3ec1('0x5b')]['id'];}if(_[_0x3ec1('0x75')](_0x13c6ec[_0x3ec1('0x5b')][_0x3ec1('0x76')])){throw new db[(_0x3ec1('0x6d'))][(_0x3ec1('0x6e'))]('from\x20is\x20mandatory');}if(_[_0x3ec1('0x75')](_0x13c6ec[_0x3ec1('0x5b')][_0x3ec1('0x5b')])||_0x13c6ec[_0x3ec1('0x5b')]['body']===''){throw new db[(_0x3ec1('0x6d'))][(_0x3ec1('0x6e'))](_0x3ec1('0x77'));}if(_[_0x3ec1('0x75')](_0x13c6ec[_0x3ec1('0x5b')][_0x3ec1('0x78')])){throw new db[(_0x3ec1('0x6d'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1647eb);}if(!_['includes'](_0x1647eb,_0x13c6ec[_0x3ec1('0x5b')][_0x3ec1('0x78')])){throw new db[(_0x3ec1('0x6d'))][(_0x3ec1('0x6e'))](_0x3ec1('0x79')+_0x1647eb);}_0x44a228[_0x13c6ec['body'][_0x3ec1('0x78')]]=_0x13c6ec[_0x3ec1('0x5b')][_0x3ec1('0x76')];})['then'](function(){return db[_0x3ec1('0x3e')][_0x3ec1('0x5e')]({'where':{'id':_0x13c6ec[_0x3ec1('0x58')]['id']},'include':[{'model':db['CmList'],'as':_0x3ec1('0x7a'),'include':[{'model':db[_0x3ec1('0x6c')],'as':'Contacts','where':_0x44a228,'limit':0x1,'order':[[_0x3ec1('0x72'),_0x3ec1('0x7b')]]}]},{'model':db['OpenchannelApplication'],'as':_0x3ec1('0x7c')}]});})[_0x3ec1('0x1d')](handleEntityNotFound(_0x3ab836,null))[_0x3ec1('0x1d')](function(_0x290080){if(_0x290080&&_0x290080[_0x3ec1('0x7a')]){_0x5152cf[_0x3ec1('0x7d')]=_0x290080;_0x5152cf['applications']=_0x290080[_0x3ec1('0x7c')];_0x5152cf['list']=_0x290080[_0x3ec1('0x7a')];_0x5152cf[_0x3ec1('0x7e')]=_[_0x3ec1('0x7f')](_0x5152cf[_0x3ec1('0x7e')],[_0x3ec1('0x80')],[_0x3ec1('0x81')]);if(_0x5152cf[_0x3ec1('0x7d')]['Applications']){delete _0x5152cf[_0x3ec1('0x7d')][_0x3ec1('0x7c')];}if(_0x5152cf[_0x3ec1('0x7d')][_0x3ec1('0x7a')]&&_0x5152cf['account']['List'][_0x3ec1('0x82')][_0x3ec1('0x48')]){return _0x5152cf[_0x3ec1('0x7d')][_0x3ec1('0x7a')][_0x3ec1('0x82')][0x0];}var _0x426cb4=_['defaults'](_0x13c6ec[_0x3ec1('0x5b')],{'firstName':_0x13c6ec['body'][_0x3ec1('0x76')],'ListId':_0x290080[_0x3ec1('0x74')]});_0x426cb4[_0x13c6ec['body'][_0x3ec1('0x78')]]=_0x13c6ec['body'][_0x3ec1('0x76')];return db[_0x3ec1('0x6c')][_0x3ec1('0x5a')](_0x426cb4,{'fields':_0x319450,'raw':!![]});}})[_0x3ec1('0x1d')](handleEntityNotFound(_0x3ab836,null))[_0x3ec1('0x1d')](function(_0x5d1ebd){_0x5152cf[_0x3ec1('0x83')]=_0x5d1ebd;if(_0x5d1ebd){var _0x5d91b5={'ContactId':_0x5d1ebd['id'],'OpenchannelAccountId':_0x13c6ec[_0x3ec1('0x58')]['id'],'from':(_0x5d1ebd['firstName']||'')+'\x20'+(_0x5d1ebd['lastName']||'')};var _0x3f66a9={'OpenchannelAccountId':_0x13c6ec['params']['id'],'closed':![]};if(_0x13c6ec[_0x3ec1('0x5b')][_0x3ec1('0x84')]){_0x3f66a9[_0x3ec1('0x84')]=_0x13c6ec[_0x3ec1('0x5b')][_0x3ec1('0x84')];return db['OpenchannelInteraction'][_0x3ec1('0x5e')]({'where':_0x3f66a9})[_0x3ec1('0x1d')](function(_0x121aaf){if(_0x121aaf){return[_0x121aaf,![]];}_0x5d91b5['threadId']=_0x13c6ec[_0x3ec1('0x5b')]['threadId'];_0x5d91b5[_0x3ec1('0x85')]=_0x13c6ec[_0x3ec1('0x5b')][_0x3ec1('0x85')];return db[_0x3ec1('0x86')]['create'](_0x5d91b5)[_0x3ec1('0x1d')](function(_0x472591){return[_0x472591,!![]];});});}else{_0x3f66a9['threadId']=null;}_0x3f66a9[_0x3ec1('0x87')]=_0x5d1ebd['id'];return db[_0x3ec1('0x86')]['find']({'where':_0x3f66a9})['then'](function(_0x14d796){if(_0x14d796){return[_0x14d796,![]];}return db[_0x3ec1('0x86')][_0x3ec1('0x5a')](_0x5d91b5)[_0x3ec1('0x1d')](function(_0x397271){return[_0x397271,!![]];});});}})[_0x3ec1('0x88')](function(_0x447446,_0x1b3758){if(_0x447446){_0x28591f=_0x1b3758;if(!_0x1b3758){var _0x945213={'from':(_0x5152cf[_0x3ec1('0x83')]['firstName']||'')+'\x20'+(_0x5152cf[_0x3ec1('0x83')]['lastName']||'')};if(_0x13c6ec[_0x3ec1('0x5b')][_0x3ec1('0x84')]&&_0x13c6ec[_0x3ec1('0x5b')][_0x3ec1('0x89')]&&_0x13c6ec[_0x3ec1('0x5b')][_0x3ec1('0x84')]!=_0x13c6ec['body'][_0x3ec1('0x89')]){_0x945213[_0x3ec1('0x84')]=_0x13c6ec[_0x3ec1('0x5b')][_0x3ec1('0x89')];}return _0x447446[_0x3ec1('0x32')](_0x945213);}else{return _0x447446;}}})[_0x3ec1('0x1d')](function(_0x1736a5){_0x5152cf['interaction']=_0x1736a5[_0x3ec1('0x33')]({'plain':!![]});_0x5152cf['interaction'][_0x3ec1('0x8a')]=_0x28591f;if(_0x5152cf['interaction'][_0x3ec1('0x8a')]){if(_0x5152cf[_0x3ec1('0x7d')][_0x3ec1('0x8b')]){_0x5152cf['applications'][_0x3ec1('0x8c')]({'id':0x0,'priority':_0x5152cf[_0x3ec1('0x7e')][_0x3ec1('0x48')]+0x1,'app':_0x3ec1('0x8d'),'appdata':_0x3ec1('0x8e'),'interval':_0x3ec1('0x8f')});}}return db[_0x3ec1('0x90')]['create']({'body':_0x13c6ec['body'][_0x3ec1('0x5b')],'OpenchannelAccountId':_0x13c6ec[_0x3ec1('0x58')]['id'],'OpenchannelInteractionId':_0x1736a5['id'],'direction':'in','ContactId':_0x5152cf[_0x3ec1('0x83')]['id'],'AttachmentId':_0x13c6ec[_0x3ec1('0x5b')][_0x3ec1('0x91')]});})['then'](function(_0x4f2a17){_0x5152cf[_0x3ec1('0x24')]=_0x4f2a17;if(_0x5152cf[_0x3ec1('0x92')][_0x3ec1('0x93')]){return db[_0x3ec1('0x94')]['find']({'attributes':['id','name'],'where':{'id':_0x5152cf[_0x3ec1('0x92')][_0x3ec1('0x93')]}})['then'](function(_0x692abf){if(_0x692abf){_0x5152cf[_0x3ec1('0x7e')][_0x3ec1('0x95')]({'id':0x0,'priority':0x0,'app':_0x3ec1('0x96'),'appdata':_0x692abf[_0x3ec1('0x39')]+','+(_0x5152cf[_0x3ec1('0x7d')]['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});_0x5152cf[_0x3ec1('0x97')]=![];}return respondWithRpcPromise(_0x3ec1('0x98'),_0x3ec1('0x99'),_0x5152cf);});}return respondWithRpcPromise(_0x3ec1('0x98'),_0x3ec1('0x99'),_0x5152cf);})[_0x3ec1('0x1d')](function(_0x2e2119){respondWithRpcPromise(_0x3ec1('0x9a'),'EventManager',{'event':_0x3ec1('0x6b'),'message':_0x2e2119},client9002);return _0x2e2119;})[_0x3ec1('0x1d')](respondWithResult(_0x3ab836,null))['catch'](handleError(_0x3ab836,null));};exports[_0x3ec1('0x9b')]=function(_0x2b53fb,_0x2be3bd){var _0x4bbc80=_0x2b53fb['params']['id'];var _0x1106ff=_0x2b53fb[_0x3ec1('0x5b')];var _0x48d451=0xc8;var _0x3cf5ae=null;return db[_0x3ec1('0x9c')][_0x3ec1('0x9d')]({'isolationLevel':db[_0x3ec1('0x9c')][_0x3ec1('0x9e')][_0x3ec1('0x9f')][_0x3ec1('0xa0')]},function(_0x566327){return db[_0x3ec1('0x3e')][_0x3ec1('0x64')]({'where':{'id':_0x4bbc80},'transaction':_0x566327})[_0x3ec1('0x1d')](function(_0x5b150e){if(_0x5b150e){return db[_0x3ec1('0xa1')]['destroy']({'where':{'OpenchannelAccountId':_0x4bbc80},'transaction':_0x566327})['then'](function(){var _0xb8d3d6=_[_0x3ec1('0x3d')](_0x1106ff,function(_0x2b8e3a){_0x2b8e3a[_0x3ec1('0x62')]=_0x4bbc80;return _0x2b8e3a;});return db[_0x3ec1('0xa1')]['bulkCreate'](_0xb8d3d6,{'transaction':_0x566327});});}else{_0x48d451=0x194;_0x3cf5ae=[];}});})['then'](function(){if(_0x48d451!==0x194){return db[_0x3ec1('0xa1')][_0x3ec1('0xa2')]({'where':{'OpenchannelAccountId':_0x4bbc80},'order':_0x3ec1('0x80')})['then'](function(_0x455e3b){_0x3cf5ae=_0x455e3b;});}})[_0x3ec1('0x27')](function(_0x376d9c){_0x48d451=0x1f4;logger[_0x3ec1('0x21')](_0x376d9c[_0x3ec1('0x38')]);if(_0x376d9c[_0x3ec1('0x39')]){delete _0x376d9c[_0x3ec1('0x39')];}_0x3cf5ae=_0x376d9c;})[_0x3ec1('0xa3')](function(){if(_0x3cf5ae===null){_0x2be3bd[_0x3ec1('0x37')](_0x48d451);}else{if(_0x48d451===0x1f4){_0x2be3bd['status'](_0x48d451)[_0x3ec1('0x3a')](_0x3cf5ae);}else{_0x2be3bd[_0x3ec1('0x28')](_0x48d451)[_0x3ec1('0x2a')](_0x3cf5ae);}}});};exports[_0x3ec1('0xa4')]=function(_0x331008,_0x1ebb56,_0xf49b91){var _0xb71f47={};var _0x1993f5={};var _0x15bee4;var _0x1e0686;return db[_0x3ec1('0x3e')][_0x3ec1('0x64')]({'where':{'id':_0x331008['params']['id']}})[_0x3ec1('0x1d')](handleEntityNotFound(_0x1ebb56,null))[_0x3ec1('0x1d')](function(_0x7e62d6){if(_0x7e62d6){_0x15bee4=_0x7e62d6;_0x1993f5[_0x3ec1('0x45')]=_[_0x3ec1('0x42')](db['OpenchannelApplication'][_0x3ec1('0x65')]);_0x1993f5[_0x3ec1('0x41')]=_[_0x3ec1('0x42')](_0x331008[_0x3ec1('0x41')]);_0x1993f5[_0x3ec1('0x43')]=_['intersection'](_0x1993f5[_0x3ec1('0x45')],_0x1993f5['query']);_0xb71f47['attributes']=_[_0x3ec1('0x44')](_0x1993f5['model'],qs['fields'](_0x331008[_0x3ec1('0x41')][_0x3ec1('0x47')]));_0xb71f47[_0x3ec1('0x46')]=_0xb71f47['attributes'][_0x3ec1('0x48')]?_0xb71f47['attributes']:_0x1993f5[_0x3ec1('0x45')];_0xb71f47[_0x3ec1('0x4c')]=qs[_0x3ec1('0x4d')](_0x331008[_0x3ec1('0x41')]['sort']);_0xb71f47[_0x3ec1('0x4e')]=qs[_0x3ec1('0x43')](_[_0x3ec1('0x4f')](_0x331008['query'],_0x1993f5[_0x3ec1('0x43')]));if(_0x331008[_0x3ec1('0x41')][_0x3ec1('0x50')]){_0xb71f47[_0x3ec1('0x4e')]=_[_0x3ec1('0x51')](_0xb71f47[_0x3ec1('0x4e')],{'$or':_[_0x3ec1('0x3d')](_0xb71f47[_0x3ec1('0x46')],function(_0x1903fe){var _0x12cc36={};_0x12cc36[_0x1903fe]={'$like':'%'+_0x331008[_0x3ec1('0x41')][_0x3ec1('0x50')]+'%'};return _0x12cc36;})});}_0xb71f47=_[_0x3ec1('0x51')]({},_0xb71f47,_0x331008[_0x3ec1('0x52')]);return _0x15bee4[_0x3ec1('0xa4')](_0xb71f47);}})['then'](function(_0x1b1720){if(_0x1b1720){_0x1e0686=_0x1b1720[_0x3ec1('0x48')];if(!_0x331008['query'][_0x3ec1('0x49')]('nolimit')){_0xb71f47[_0x3ec1('0x2c')]=qs[_0x3ec1('0x2c')](_0x331008[_0x3ec1('0x41')][_0x3ec1('0x2c')]);_0xb71f47[_0x3ec1('0x4b')]=qs['offset'](_0x331008[_0x3ec1('0x41')][_0x3ec1('0x4b')]);}return _0x15bee4[_0x3ec1('0xa4')](_0xb71f47);}})[_0x3ec1('0x1d')](function(_0x4e4071){if(_0x4e4071){return _0x4e4071?{'count':_0x1e0686,'rows':_0x4e4071}:null;}})[_0x3ec1('0x1d')](respondWithResult(_0x1ebb56,null))[_0x3ec1('0x27')](handleError(_0x1ebb56,null));};exports['getInteractions']=function(_0x5018b7,_0x23888a,_0x29d76d){var _0x40d507={'raw':![],'where':{}};var _0x1eb34e={};var _0x3b15b0={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x3ec1('0x64')]({'where':{'id':_0x5018b7['params']['id']}})[_0x3ec1('0x1d')](handleEntityNotFound(_0x23888a,null))[_0x3ec1('0x1d')](function(_0x507b4d){if(_0x507b4d){_0x1eb34e[_0x3ec1('0x45')]=_[_0x3ec1('0x42')](db[_0x3ec1('0x86')][_0x3ec1('0x65')]);_0x1eb34e['query']=_['keys'](_0x5018b7[_0x3ec1('0x41')]);_0x1eb34e['filters']=_[_0x3ec1('0x44')](_0x1eb34e[_0x3ec1('0x45')],_0x1eb34e[_0x3ec1('0x41')]);_0x40d507[_0x3ec1('0x46')]=_[_0x3ec1('0x44')](_0x1eb34e['model'],qs[_0x3ec1('0x47')](_0x5018b7[_0x3ec1('0x41')][_0x3ec1('0x47')]));_0x40d507[_0x3ec1('0x46')]=_0x40d507[_0x3ec1('0x46')][_0x3ec1('0x48')]?_0x40d507['attributes']:_0x1eb34e[_0x3ec1('0x45')];if(!_0x5018b7[_0x3ec1('0x41')]['hasOwnProperty'](_0x3ec1('0x4a'))){_0x40d507[_0x3ec1('0x2c')]=qs['limit'](_0x5018b7[_0x3ec1('0x41')][_0x3ec1('0x2c')]);_0x40d507[_0x3ec1('0x4b')]=qs['offset'](_0x5018b7[_0x3ec1('0x41')][_0x3ec1('0x4b')]);}_0x40d507[_0x3ec1('0x4c')]=qs[_0x3ec1('0x4d')](_0x5018b7['query'][_0x3ec1('0x4d')]);_0x40d507[_0x3ec1('0x4e')]=qs[_0x3ec1('0x43')](_['pick'](_0x5018b7[_0x3ec1('0x41')],_0x1eb34e[_0x3ec1('0x43')]));_0x40d507[_0x3ec1('0x4e')][_0x3ec1('0x62')]=_0x507b4d['id'];if(_0x5018b7[_0x3ec1('0x41')]['filter']){_0x40d507[_0x3ec1('0x4e')]=_[_0x3ec1('0x51')](_0x40d507['where'],{'$or':_[_0x3ec1('0x3d')](_0x40d507[_0x3ec1('0x46')],function(_0x1665c0){var _0x189afe={};_0x189afe[_0x1665c0]={'$like':'%'+_0x5018b7['query'][_0x3ec1('0x50')]+'%'};return _0x189afe;})});}_0x40d507=_[_0x3ec1('0x51')]({},_0x40d507,_0x5018b7[_0x3ec1('0x52')]);return db['OpenchannelInteraction']['count']({'where':_0x40d507[_0x3ec1('0x4e')]})[_0x3ec1('0x1d')](function(_0x219c80){_0x3b15b0['count']=_0x219c80;if(_0x5018b7[_0x3ec1('0x41')][_0x3ec1('0x53')]){_0x40d507[_0x3ec1('0x54')]=[{'model':db[_0x3ec1('0x6c')],'as':_0x3ec1('0xa5'),'required':![]},{'model':db[_0x3ec1('0x94')],'as':_0x3ec1('0xa6'),'attributes':[_0x3ec1('0x39'),_0x3ec1('0xa7'),'internal'],'required':![]},{'model':db[_0x3ec1('0xa8')],'as':_0x3ec1('0xa9'),'attributes':['id',_0x3ec1('0x39'),_0x3ec1('0xaa')],'where':_0x5018b7[_0x3ec1('0x41')][_0x3ec1('0xab')]?{'id':_0x5018b7[_0x3ec1('0x41')][_0x3ec1('0xab')]}:undefined,'required':_0x5018b7[_0x3ec1('0x41')][_0x3ec1('0xab')]?!![]:![]}];}return db[_0x3ec1('0x86')]['findAll'](_0x40d507);})['then'](function(_0x5ac8d4){_0x3b15b0[_0x3ec1('0x56')]=_0x5ac8d4;return _0x3b15b0;});}})[_0x3ec1('0x1d')](respondWithFilteredResult(_0x23888a,_0x40d507))[_0x3ec1('0x27')](handleError(_0x23888a,null));};exports[_0x3ec1('0xac')]=function(_0x12c9e5,_0x1a64b0,_0x1f523d){return db[_0x3ec1('0x3e')][_0x3ec1('0x5e')]({'where':{'id':_0x12c9e5[_0x3ec1('0x58')]['id']}})['then'](handleEntityNotFound(_0x1a64b0,null))[_0x3ec1('0x1d')](function(_0xe9b538){if(_0xe9b538){return _0xe9b538[_0x3ec1('0xac')](_0x12c9e5['body'][_0x3ec1('0x68')],_[_0x3ec1('0xad')](_0x12c9e5['body'],[_0x3ec1('0x68'),'id'])||{})[_0x3ec1('0x88')](function(_0x278607){for(var _0xb00a5b=0x0;_0xb00a5b<_0x12c9e5[_0x3ec1('0x5b')][_0x3ec1('0x68')][_0x3ec1('0x48')];_0xb00a5b+=0x1){socket[_0x3ec1('0xae')]('userOpenchannelAccount:save',{'UserId':Number(_0x12c9e5[_0x3ec1('0x5b')][_0x3ec1('0x68')][_0xb00a5b]),'OpenchannelAccountId':Number(_0x12c9e5['params']['id'])});}return _0x278607;});}})[_0x3ec1('0x1d')](respondWithResult(_0x1a64b0,null))[_0x3ec1('0x27')](handleError(_0x1a64b0,null));};exports[_0x3ec1('0xaf')]=function(_0x564df2,_0x8c6f5b,_0xf0ffd){return db['OpenchannelAccount'][_0x3ec1('0x5e')]({'where':{'id':_0x564df2[_0x3ec1('0x58')]['id']}})[_0x3ec1('0x1d')](handleEntityNotFound(_0x8c6f5b,null))[_0x3ec1('0x1d')](function(_0x2a5728){if(_0x2a5728){return _0x2a5728[_0x3ec1('0xaf')](_0x564df2[_0x3ec1('0x41')][_0x3ec1('0x68')])[_0x3ec1('0x1d')](function(){if(_['isArray'](_0x564df2[_0x3ec1('0x41')][_0x3ec1('0x68')])){for(var _0x25e707=0x0;_0x25e707<_0x564df2[_0x3ec1('0x41')][_0x3ec1('0x68')][_0x3ec1('0x48')];_0x25e707+=0x1){socket[_0x3ec1('0xae')](_0x3ec1('0xb0'),{'UserId':Number(_0x564df2['query'][_0x3ec1('0x68')][_0x25e707]),'OpenchannelAccountId':Number(_0x564df2[_0x3ec1('0x58')]['id'])});}}else{socket[_0x3ec1('0xae')](_0x3ec1('0xb0'),{'UserId':Number(_0x564df2[_0x3ec1('0x41')]['ids']),'OpenchannelAccountId':Number(_0x564df2[_0x3ec1('0x58')]['id'])});}});}})[_0x3ec1('0x1d')](respondWithStatusCode(_0x8c6f5b,null))[_0x3ec1('0x27')](handleError(_0x8c6f5b,null));};exports['getAgents']=function(_0xbf60ab,_0x5e73b7,_0x169b39){var _0x4a18da={};var _0x506555={};var _0x111483;var _0x2dd3bc;return db[_0x3ec1('0x3e')][_0x3ec1('0x64')]({'where':{'id':_0xbf60ab[_0x3ec1('0x58')]['id']}})[_0x3ec1('0x1d')](handleEntityNotFound(_0x5e73b7,null))[_0x3ec1('0x1d')](function(_0x1ed047){if(_0x1ed047){_0x111483=_0x1ed047;_0x506555[_0x3ec1('0x45')]=_['keys'](db['User'][_0x3ec1('0x65')]);_0x506555[_0x3ec1('0x41')]=_[_0x3ec1('0x42')](_0xbf60ab['query']);_0x506555['filters']=_['intersection'](_0x506555[_0x3ec1('0x45')],_0x506555[_0x3ec1('0x41')]);_0x4a18da['attributes']=_['intersection'](_0x506555[_0x3ec1('0x45')],qs[_0x3ec1('0x47')](_0xbf60ab[_0x3ec1('0x41')][_0x3ec1('0x47')]));_0x4a18da[_0x3ec1('0x46')]=_0x4a18da[_0x3ec1('0x46')][_0x3ec1('0x48')]?_0x4a18da['attributes']:_0x506555[_0x3ec1('0x45')];_0x4a18da['order']=qs[_0x3ec1('0x4d')](_0xbf60ab[_0x3ec1('0x41')][_0x3ec1('0x4d')]);_0x4a18da['where']=qs['filters'](_['pick'](_0xbf60ab[_0x3ec1('0x41')],_0x506555[_0x3ec1('0x43')]));if(_0xbf60ab['query'][_0x3ec1('0x50')]){_0x4a18da[_0x3ec1('0x4e')]=_[_0x3ec1('0x51')](_0x4a18da[_0x3ec1('0x4e')],{'$or':_[_0x3ec1('0x3d')](_0x4a18da[_0x3ec1('0x46')],function(_0x518214){var _0x283162={};_0x283162[_0x518214]={'$like':'%'+_0xbf60ab[_0x3ec1('0x41')]['filter']+'%'};return _0x283162;})});}_0x4a18da=_[_0x3ec1('0x51')]({},_0x4a18da,_0xbf60ab[_0x3ec1('0x52')]);return _0x111483['getAgents'](_0x4a18da);}})['then'](function(_0x47e3d9){if(_0x47e3d9){_0x2dd3bc=_0x47e3d9['length'];if(!_0xbf60ab[_0x3ec1('0x41')][_0x3ec1('0x49')](_0x3ec1('0x4a'))){_0x4a18da['limit']=qs['limit'](_0xbf60ab[_0x3ec1('0x41')][_0x3ec1('0x2c')]);_0x4a18da[_0x3ec1('0x4b')]=qs['offset'](_0xbf60ab['query'][_0x3ec1('0x4b')]);}return _0x111483[_0x3ec1('0xb1')](_0x4a18da);}})[_0x3ec1('0x1d')](function(_0x3c7fd8){if(_0x3c7fd8){return _0x3c7fd8?{'count':_0x2dd3bc,'rows':_0x3c7fd8}:null;}})[_0x3ec1('0x1d')](respondWithResult(_0x5e73b7,null))[_0x3ec1('0x27')](handleError(_0x5e73b7,null));};exports['send']=function(_0x2d5703,_0x556995,_0x3e6c58){var _0x261a62,_0x7a1b3f,_0x55c9df;if(_[_0x3ec1('0x75')](_0x2d5703['body'][_0x3ec1('0x5b')])||_0x2d5703[_0x3ec1('0x5b')][_0x3ec1('0x5b')]===''){throw new db['Sequelize'][(_0x3ec1('0x6e'))](_0x3ec1('0x77'));}if(_[_0x3ec1('0x75')](_0x2d5703[_0x3ec1('0x5b')]['to'])){}_0x261a62=_0x2d5703[_0x3ec1('0x5b')]['to'];return db['OpenchannelAccount'][_0x3ec1('0x64')]({'where':{'id':_0x2d5703[_0x3ec1('0x58')]['id']}})['then'](handleEntityNotFound(_0x556995,null))['then'](function(_0x16de39){if(_0x16de39){return db[_0x3ec1('0x3e')][_0x3ec1('0x5e')]({'where':{'id':_0x16de39['id']},'include':[{'model':db[_0x3ec1('0xb2')],'as':_0x3ec1('0x7a'),'include':[{'model':db[_0x3ec1('0x6c')],'as':_0x3ec1('0x82'),'where':{[_0x16de39['mapKey']]:_0x261a62},'limit':0x1,'order':[[_0x3ec1('0x72'),_0x3ec1('0x7b')]]}]}]})[_0x3ec1('0x1d')](handleEntityNotFound(_0x556995,null))['then'](function(_0x14fe79){if(_0x14fe79&&_0x14fe79[_0x3ec1('0x7a')]){_0x7a1b3f=_0x14fe79[_0x3ec1('0x33')]({'plain':!![]});if(_0x7a1b3f[_0x3ec1('0x7a')]&&_0x7a1b3f[_0x3ec1('0x7a')][_0x3ec1('0x82')][_0x3ec1('0x48')]){return _0x7a1b3f[_0x3ec1('0x7a')][_0x3ec1('0x82')][0x0];}return db[_0x3ec1('0x6c')][_0x3ec1('0x5a')](_[_0x3ec1('0x18')](_0x2d5703[_0x3ec1('0x5b')],{'firstName':_0x261a62,[_0x14fe79['mapKey']]:_0x261a62,'phone':_0x261a62,'ListId':_0x7a1b3f[_0x3ec1('0x74')]}));}})[_0x3ec1('0x1d')](handleEntityNotFound(_0x556995,null))[_0x3ec1('0x1d')](function(_0x4538d2){if(_0x4538d2){_0x55c9df=_0x4538d2;return db[_0x3ec1('0x86')][_0x3ec1('0x5e')]({'where':{'ContactId':_0x55c9df['id'],'closed':![],'OpenchannelAccountId':_0x7a1b3f['id']}})[_0x3ec1('0x1d')](function(_0x13026a){if(_0x13026a){return[_0x13026a,![]];}return db['OpenchannelInteraction'][_0x3ec1('0x5a')]({'UserId':_0x2d5703[_0x3ec1('0x5c')]['id'],'ContactId':_0x55c9df['id'],'OpenchannelAccountId':_0x7a1b3f['id'],'lastMsgDirection':_0x3ec1('0xb3'),'Messages':[_[_0x3ec1('0x51')](_0x2d5703[_0x3ec1('0x5b')],{'read':![],'body':_0x2d5703[_0x3ec1('0x5b')][_0x3ec1('0x5b')],'OpenchannelAccountId':_0x7a1b3f['id'],'UserId':_0x2d5703[_0x3ec1('0x5c')]['id'],'ContactId':_0x55c9df['id']})]},{'include':[{'model':db[_0x3ec1('0x90')],'as':_0x3ec1('0xb4')}]})['then'](function(_0x11aae7){return[_0x11aae7,!![]];});});}})[_0x3ec1('0x88')](function(_0x2f81d5,_0xf35ac5){if(_0xf35ac5){return _0x2f81d5;}return db[_0x3ec1('0x90')][_0x3ec1('0x5a')](_['merge'](_0x2d5703[_0x3ec1('0x5b')],{'read':![],'body':_0x2d5703[_0x3ec1('0x5b')][_0x3ec1('0x5b')],'OpenchannelAccountId':_0x7a1b3f['id'],'OpenchannelInteractionId':_0x2f81d5['id'],'UserId':_0x2d5703[_0x3ec1('0x5c')]['id'],'ContactId':_0x55c9df['id']}))[_0x3ec1('0x1d')](function(_0x285df3){_0x2f81d5[_0x3ec1('0xb5')][_0x3ec1('0xb4')]=[];_0x2f81d5[_0x3ec1('0xb5')][_0x3ec1('0xb4')][_0x3ec1('0x8c')](_0x285df3['dataValues']);return _0x2f81d5;});});}})[_0x3ec1('0x1d')](respondWithResult(_0x556995,null))[_0x3ec1('0x27')](handleError(_0x556995,null));}; \ No newline at end of file +var _0x7c0f=['catch','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','get','OpenchannelAccounts','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','rows','show','params','options','find','create','body','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','Disposition','getDispositions','findOne','OpenchannelAccountId','removeDispositions','ids','addAnswer','CannedAnswer','findAll','removeAnswers','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','List','Contacts','DESC','OpenchannelApplication','Applications','account','applications','orderBy','priority','asc','ListId','firstName','threadId','externalUrl','ContactId','OpenchannelInteraction','spread','contact','lastName','messageId','interaction','created','autoclose','close','*,*,*,*','AttachmentId','UserId','User','forcedOwnership','Start','startRouting','addApplications','sequelize','transaction','Transaction','findAndCountAll','finally','getApplications','Contact','Owner','internal','Tag','color','tag','addAgents','omit','emit','removeAgents','userOpenchannelAccount:remove','getAgents','CmList','defaults','user','OpenchannelMessage','dataValues','Messages','push','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','client','http','request','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x5a57bf,_0x39f906){var _0x6a6949=function(_0x1da6ce){while(--_0x1da6ce){_0x5a57bf['push'](_0x5a57bf['shift']());}};_0x6a6949(++_0x39f906);}(_0x7c0f,0x91));var _0xf7c0=function(_0x4f6f94,_0x28f451){_0x4f6f94=_0x4f6f94-0x0;var _0x525925=_0x7c0f[_0x4f6f94];return _0x525925;};'use strict';var emlformat=require(_0xf7c0('0x0'));var rimraf=require(_0xf7c0('0x1'));var zipdir=require(_0xf7c0('0x2'));var jsonpatch=require(_0xf7c0('0x3'));var rp=require(_0xf7c0('0x4'));var moment=require(_0xf7c0('0x5'));var BPromise=require(_0xf7c0('0x6'));var Mustache=require(_0xf7c0('0x7'));var util=require(_0xf7c0('0x8'));var path=require(_0xf7c0('0x9'));var sox=require(_0xf7c0('0xa'));var csv=require(_0xf7c0('0xb'));var ejs=require(_0xf7c0('0xc'));var fs=require('fs');var fs_extra=require(_0xf7c0('0xd'));var _=require('lodash');var squel=require(_0xf7c0('0xe'));var crypto=require('crypto');var jsforce=require(_0xf7c0('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xf7c0('0x10'));var Redis=require(_0xf7c0('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xf7c0('0x12'));var as=require(_0xf7c0('0x13'));var hardwareService=require(_0xf7c0('0x14'));var logger=require(_0xf7c0('0x15'))(_0xf7c0('0x16'));var utils=require(_0xf7c0('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xf7c0('0x18'));var db=require(_0xf7c0('0x19'))['db'];config[_0xf7c0('0x1a')]=_['defaults'](config[_0xf7c0('0x1a')],{'host':_0xf7c0('0x1b'),'port':0x18eb});var socket=require(_0xf7c0('0x1c'))(new Redis(config[_0xf7c0('0x1a')]));require('./openchannelAccount.socket')['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0xf7c0('0x1d')][_0xf7c0('0x1e')]({'port':0x232c});var client9002=jayson[_0xf7c0('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x16990a,_0x2c64a0,_0x117390,_0x369f86){return new BPromise(function(_0x14170d,_0x118bc0){var _0x29daf6=_0x369f86||client;return _0x29daf6[_0xf7c0('0x1f')](_0x16990a,_0x117390)['then'](function(_0x13745b){logger[_0xf7c0('0x20')](_0xf7c0('0x21'),_0x2c64a0,_0xf7c0('0x22'));logger[_0xf7c0('0x23')](_0xf7c0('0x24'),_0x2c64a0,_0xf7c0('0x22'),JSON[_0xf7c0('0x25')](_0x13745b));if(_0x13745b[_0xf7c0('0x26')]){if(_0x13745b[_0xf7c0('0x26')][_0xf7c0('0x27')]===0x1f4){logger['error'](_0xf7c0('0x21'),_0x2c64a0,_0x13745b['error'][_0xf7c0('0x28')]);return _0x118bc0(_0x13745b[_0xf7c0('0x26')][_0xf7c0('0x28')]);}logger['error'](_0xf7c0('0x21'),_0x2c64a0,_0x13745b[_0xf7c0('0x26')]['message']);return _0x14170d(_0x13745b[_0xf7c0('0x26')][_0xf7c0('0x28')]);}else{logger[_0xf7c0('0x20')](_0xf7c0('0x21'),_0x2c64a0,_0xf7c0('0x22'));_0x14170d(_0x13745b['result'][_0xf7c0('0x28')]);}})[_0xf7c0('0x29')](function(_0x55298c){logger['error'](_0xf7c0('0x21'),_0x2c64a0,_0x55298c);_0x118bc0(_0x55298c);});});}function respondWithStatusCode(_0x2468d8,_0x1dbbb5){_0x1dbbb5=_0x1dbbb5||0xcc;return function(_0x45bc29){if(_0x45bc29){return _0x2468d8[_0xf7c0('0x2a')](_0x1dbbb5);}return _0x2468d8['status'](_0x1dbbb5)[_0xf7c0('0x2b')]();};}function respondWithResult(_0x108d67,_0x438d40){_0x438d40=_0x438d40||0xc8;return function(_0x49133b){if(_0x49133b){return _0x108d67[_0xf7c0('0x2c')](_0x438d40)[_0xf7c0('0x2d')](_0x49133b);}};}function respondWithFilteredResult(_0x167a6e,_0x53368a){return function(_0x5f09c8){if(_0x5f09c8){var _0x597247=typeof _0x53368a[_0xf7c0('0x2e')]===_0xf7c0('0x2f')&&typeof _0x53368a[_0xf7c0('0x30')]===_0xf7c0('0x2f');var _0x2a2c15=_0x5f09c8[_0xf7c0('0x31')];var _0x2ae721=_0x597247?0x0:_0x53368a[_0xf7c0('0x2e')];var _0x1ef53d=_0x597247?_0x5f09c8[_0xf7c0('0x31')]:_0x53368a['offset']+_0x53368a[_0xf7c0('0x30')];var _0x3cfb94;if(_0x1ef53d>=_0x2a2c15){_0x1ef53d=_0x2a2c15;_0x3cfb94=0xc8;}else{_0x3cfb94=0xce;}_0x167a6e['status'](_0x3cfb94);return _0x167a6e[_0xf7c0('0x32')](_0xf7c0('0x33'),_0x2ae721+'-'+_0x1ef53d+'/'+_0x2a2c15)[_0xf7c0('0x2d')](_0x5f09c8);}return null;};}function patchUpdates(_0x254656){return function(_0x14ca8c){try{jsonpatch[_0xf7c0('0x34')](_0x14ca8c,_0x254656,!![]);}catch(_0x561adb){return BPromise['reject'](_0x561adb);}return _0x14ca8c[_0xf7c0('0x35')]();};}function saveUpdates(_0x51d868,_0x52a66f){return function(_0x3a5e32){if(_0x3a5e32){return _0x3a5e32['update'](_0x51d868)[_0xf7c0('0x36')](function(_0x92fd83){return _0x92fd83;});}return null;};}function removeEntity(_0x38c03f,_0x56ed0a){return function(_0x44f03d){if(_0x44f03d){return _0x44f03d[_0xf7c0('0x37')]()[_0xf7c0('0x36')](function(){var _0xb333b4=_0x44f03d[_0xf7c0('0x38')]({'plain':!![]});var _0x4d4ab0=_0xf7c0('0x39');return db[_0xf7c0('0x3a')][_0xf7c0('0x37')]({'where':{'type':_0x4d4ab0,'resourceId':_0xb333b4['id']}})[_0xf7c0('0x36')](function(){return _0x44f03d;});})[_0xf7c0('0x36')](function(){_0x38c03f[_0xf7c0('0x2c')](0xcc)[_0xf7c0('0x2b')]();});}};}function handleEntityNotFound(_0x265638,_0x146356){return function(_0xd2b6e9){if(!_0xd2b6e9){_0x265638['sendStatus'](0x194);}return _0xd2b6e9;};}function handleError(_0x3ffcc7,_0x177971){_0x177971=_0x177971||0x1f4;return function(_0x452a81){logger['error'](_0x452a81[_0xf7c0('0x3b')]);if(_0x452a81[_0xf7c0('0x3c')]){delete _0x452a81[_0xf7c0('0x3c')];}_0x3ffcc7['status'](_0x177971)[_0xf7c0('0x3d')](_0x452a81);};}exports[_0xf7c0('0x3e')]=function(_0x313c3f,_0x4ccb22){var _0x1993c2={'include':[{'model':db[_0xf7c0('0x3f')],'as':_0xf7c0('0x40')}]},_0x163d38={},_0x5b8e1a={'count':0x0,'rows':[]};var _0x2c9dea=_[_0xf7c0('0x41')](db[_0xf7c0('0x42')][_0xf7c0('0x43')],function(_0x2f0261){return{'name':_0x2f0261['fieldName'],'type':_0x2f0261[_0xf7c0('0x44')][_0xf7c0('0x45')]};});_0x163d38['model']=_[_0xf7c0('0x41')](_0x2c9dea,'name');_0x163d38[_0xf7c0('0x46')]=_[_0xf7c0('0x47')](_0x313c3f[_0xf7c0('0x46')]);_0x163d38[_0xf7c0('0x48')]=_[_0xf7c0('0x49')](_0x163d38['model'],_0x163d38[_0xf7c0('0x46')]);_0x1993c2['attributes']=_['intersection'](_0x163d38[_0xf7c0('0x4a')],qs[_0xf7c0('0x4b')](_0x313c3f['query']['fields']));_0x1993c2[_0xf7c0('0x4c')]=_0x1993c2[_0xf7c0('0x4c')][_0xf7c0('0x4d')]?_0x1993c2[_0xf7c0('0x4c')]:_0x163d38[_0xf7c0('0x4a')];if(!_0x313c3f['query'][_0xf7c0('0x4e')](_0xf7c0('0x4f'))){_0x1993c2[_0xf7c0('0x30')]=qs[_0xf7c0('0x30')](_0x313c3f['query']['limit']);_0x1993c2['offset']=qs['offset'](_0x313c3f['query'][_0xf7c0('0x2e')]);}_0x1993c2[_0xf7c0('0x50')]=qs[_0xf7c0('0x51')](_0x313c3f['query'][_0xf7c0('0x51')]);_0x1993c2[_0xf7c0('0x52')]=qs[_0xf7c0('0x48')](_[_0xf7c0('0x53')](_0x313c3f['query'],_0x163d38[_0xf7c0('0x48')]),_0x2c9dea);if(_0x313c3f[_0xf7c0('0x46')]['filter']){_0x1993c2[_0xf7c0('0x52')]=_[_0xf7c0('0x54')](_0x1993c2[_0xf7c0('0x52')],{'$or':_[_0xf7c0('0x41')](_0x2c9dea,function(_0x8471cd){if(_0x8471cd[_0xf7c0('0x44')]!==_0xf7c0('0x55')){var _0xe2fb55={};_0xe2fb55[_0x8471cd[_0xf7c0('0x3c')]]={'$like':'%'+_0x313c3f[_0xf7c0('0x46')][_0xf7c0('0x56')]+'%'};return _0xe2fb55;}})});}_0x1993c2=_[_0xf7c0('0x54')]({},_0x1993c2,_0x313c3f['options']);var _0x2797b8={'where':_0x1993c2[_0xf7c0('0x52')]};return db[_0xf7c0('0x42')][_0xf7c0('0x31')](_0x2797b8)[_0xf7c0('0x36')](function(_0x576a51){_0x5b8e1a['count']=_0x576a51;if(_0x313c3f[_0xf7c0('0x46')][_0xf7c0('0x57')]){_0x1993c2[_0xf7c0('0x58')]=[{'all':!![]}];}return db[_0xf7c0('0x42')]['findAll'](_0x1993c2);})[_0xf7c0('0x36')](function(_0x4c1ee6){_0x5b8e1a[_0xf7c0('0x59')]=_0x4c1ee6;return _0x5b8e1a;})[_0xf7c0('0x36')](respondWithFilteredResult(_0x4ccb22,_0x1993c2))[_0xf7c0('0x29')](handleError(_0x4ccb22,null));};exports[_0xf7c0('0x5a')]=function(_0x5707c9,_0x1781a7){var _0x41920f={'raw':![],'where':{'id':_0x5707c9[_0xf7c0('0x5b')]['id']},'include':[{'model':db[_0xf7c0('0x3f')],'as':_0xf7c0('0x40')}]},_0x44983a={};_0x44983a['model']=_[_0xf7c0('0x47')](db[_0xf7c0('0x42')][_0xf7c0('0x43')]);_0x44983a[_0xf7c0('0x46')]=_['keys'](_0x5707c9[_0xf7c0('0x46')]);_0x44983a[_0xf7c0('0x48')]=_[_0xf7c0('0x49')](_0x44983a['model'],_0x44983a[_0xf7c0('0x46')]);_0x41920f[_0xf7c0('0x4c')]=_[_0xf7c0('0x49')](_0x44983a[_0xf7c0('0x4a')],qs[_0xf7c0('0x4b')](_0x5707c9[_0xf7c0('0x46')][_0xf7c0('0x4b')]));_0x41920f[_0xf7c0('0x4c')]=_0x41920f[_0xf7c0('0x4c')]['length']?_0x41920f[_0xf7c0('0x4c')]:_0x44983a[_0xf7c0('0x4a')];if(_0x5707c9[_0xf7c0('0x46')][_0xf7c0('0x57')]){_0x41920f[_0xf7c0('0x58')]=[{'all':!![]}];}_0x41920f=_[_0xf7c0('0x54')]({},_0x41920f,_0x5707c9[_0xf7c0('0x5c')]);return db[_0xf7c0('0x42')][_0xf7c0('0x5d')](_0x41920f)[_0xf7c0('0x36')](handleEntityNotFound(_0x1781a7,null))[_0xf7c0('0x36')](respondWithResult(_0x1781a7,null))[_0xf7c0('0x29')](handleError(_0x1781a7,null));};exports[_0xf7c0('0x5e')]=function(_0x5587e,_0x39ef18){return db[_0xf7c0('0x42')][_0xf7c0('0x5e')](_0x5587e[_0xf7c0('0x5f')],{})[_0xf7c0('0x36')](function(_0x4188d2){var _0x16621b=_0x5587e['user'][_0xf7c0('0x38')]({'plain':!![]});if(!_0x16621b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x16621b[_0xf7c0('0x60')]==='user'){var _0x75a9f7=_0x4188d2[_0xf7c0('0x38')]({'plain':!![]});var _0x59bd09=_0xf7c0('0x39');return db[_0xf7c0('0x61')][_0xf7c0('0x5d')]({'where':{'name':_0x59bd09,'userProfileId':_0x16621b[_0xf7c0('0x62')]},'raw':!![]})[_0xf7c0('0x36')](function(_0x499093){if(_0x499093&&_0x499093[_0xf7c0('0x63')]===0x0){return db['UserProfileResource']['create']({'name':_0x75a9f7['name'],'resourceId':_0x75a9f7['id'],'type':_0x499093[_0xf7c0('0x3c')],'sectionId':_0x499093['id']},{})['then'](function(){return _0x4188d2;});}else{return _0x4188d2;}})[_0xf7c0('0x29')](function(_0x2ac7e3){logger[_0xf7c0('0x26')](_0xf7c0('0x64'),_0x2ac7e3);throw _0x2ac7e3;});}return _0x4188d2;})[_0xf7c0('0x36')](respondWithResult(_0x39ef18,0xc9))[_0xf7c0('0x29')](handleError(_0x39ef18,null));};exports[_0xf7c0('0x65')]=function(_0x4ad69f,_0x2fa247){if(_0x4ad69f[_0xf7c0('0x5f')]['id']){delete _0x4ad69f[_0xf7c0('0x5f')]['id'];}return db[_0xf7c0('0x42')][_0xf7c0('0x5d')]({'where':{'id':_0x4ad69f['params']['id']},'include':[{'model':db[_0xf7c0('0x3f')],'as':_0xf7c0('0x40')}]})[_0xf7c0('0x36')](handleEntityNotFound(_0x2fa247,null))[_0xf7c0('0x36')](saveUpdates(_0x4ad69f[_0xf7c0('0x5f')],null))['then'](respondWithResult(_0x2fa247,null))[_0xf7c0('0x29')](handleError(_0x2fa247,null));};exports[_0xf7c0('0x37')]=function(_0x87a0b,_0x63512f){return db['OpenchannelAccount'][_0xf7c0('0x5d')]({'where':{'id':_0x87a0b[_0xf7c0('0x5b')]['id']}})[_0xf7c0('0x36')](handleEntityNotFound(_0x63512f,null))[_0xf7c0('0x36')](removeEntity(_0x63512f,null))[_0xf7c0('0x29')](handleError(_0x63512f,null));};exports['describe']=function(_0x1cdbc3,_0x11131c){return db[_0xf7c0('0x42')][_0xf7c0('0x66')]()[_0xf7c0('0x36')](respondWithResult(_0x11131c,null))[_0xf7c0('0x29')](handleError(_0x11131c,null));};exports['addDisposition']=function(_0xcf4729,_0x5c8c7d,_0x3ea068){if(_0xcf4729[_0xf7c0('0x5f')]['id']){delete _0xcf4729[_0xf7c0('0x5f')]['id'];}return db['OpenchannelAccount'][_0xf7c0('0x5d')]({'where':{'id':_0xcf4729[_0xf7c0('0x5b')]['id']}})[_0xf7c0('0x36')](handleEntityNotFound(_0x5c8c7d,null))[_0xf7c0('0x36')](function(_0x3e6acf){if(_0x3e6acf){_0xcf4729[_0xf7c0('0x5f')]['OpenchannelAccountId']=_0x3e6acf['id'];return db[_0xf7c0('0x67')][_0xf7c0('0x5e')](_0xcf4729[_0xf7c0('0x5f')]);}})['then'](respondWithResult(_0x5c8c7d,null))[_0xf7c0('0x29')](handleError(_0x5c8c7d,null));};exports[_0xf7c0('0x68')]=function(_0x37b5ba,_0x230340,_0x5460d2){var _0x52cdee={'raw':![],'where':{}};var _0x44dd49={};var _0x4d987a={'count':0x0,'rows':[]};return db[_0xf7c0('0x42')][_0xf7c0('0x69')]({'where':{'id':_0x37b5ba['params']['id']}})[_0xf7c0('0x36')](handleEntityNotFound(_0x230340,null))[_0xf7c0('0x36')](function(_0x536feb){if(_0x536feb){_0x44dd49['model']=_[_0xf7c0('0x47')](db['Disposition']['rawAttributes']);_0x44dd49[_0xf7c0('0x46')]=_[_0xf7c0('0x47')](_0x37b5ba['query']);_0x44dd49['filters']=_[_0xf7c0('0x49')](_0x44dd49[_0xf7c0('0x4a')],_0x44dd49[_0xf7c0('0x46')]);_0x52cdee[_0xf7c0('0x4c')]=_[_0xf7c0('0x49')](_0x44dd49[_0xf7c0('0x4a')],qs['fields'](_0x37b5ba[_0xf7c0('0x46')][_0xf7c0('0x4b')]));_0x52cdee['attributes']=_0x52cdee['attributes'][_0xf7c0('0x4d')]?_0x52cdee[_0xf7c0('0x4c')]:_0x44dd49['model'];if(!_0x37b5ba[_0xf7c0('0x46')][_0xf7c0('0x4e')]('nolimit')){_0x52cdee[_0xf7c0('0x30')]=qs['limit'](_0x37b5ba[_0xf7c0('0x46')][_0xf7c0('0x30')]);_0x52cdee[_0xf7c0('0x2e')]=qs[_0xf7c0('0x2e')](_0x37b5ba['query']['offset']);}_0x52cdee[_0xf7c0('0x50')]=qs[_0xf7c0('0x51')](_0x37b5ba['query']['sort']);_0x52cdee[_0xf7c0('0x52')]=qs[_0xf7c0('0x48')](_['pick'](_0x37b5ba[_0xf7c0('0x46')],_0x44dd49[_0xf7c0('0x48')]));_0x52cdee[_0xf7c0('0x52')][_0xf7c0('0x6a')]=_0x536feb['id'];if(_0x37b5ba[_0xf7c0('0x46')][_0xf7c0('0x56')]){_0x52cdee['where']=_[_0xf7c0('0x54')](_0x52cdee[_0xf7c0('0x52')],{'$or':_[_0xf7c0('0x41')](_0x52cdee['attributes'],function(_0x78fa99){var _0x3d7050={};_0x3d7050[_0x78fa99]={'$like':'%'+_0x37b5ba[_0xf7c0('0x46')][_0xf7c0('0x56')]+'%'};return _0x3d7050;})});}_0x52cdee=_[_0xf7c0('0x54')]({},_0x52cdee,_0x37b5ba[_0xf7c0('0x5c')]);return db['Disposition'][_0xf7c0('0x31')]({'where':_0x52cdee['where']})['then'](function(_0x348227){_0x4d987a[_0xf7c0('0x31')]=_0x348227;if(_0x37b5ba[_0xf7c0('0x46')][_0xf7c0('0x57')]){_0x52cdee[_0xf7c0('0x58')]=[{'all':!![]}];}return db[_0xf7c0('0x67')]['findAll'](_0x52cdee);})['then'](function(_0x5957f1){_0x4d987a[_0xf7c0('0x59')]=_0x5957f1;return _0x4d987a;});}})[_0xf7c0('0x36')](respondWithFilteredResult(_0x230340,_0x52cdee))[_0xf7c0('0x29')](handleError(_0x230340,null));};exports[_0xf7c0('0x6b')]=function(_0x5b490c,_0x4a2c4f,_0x88f760){return db[_0xf7c0('0x42')][_0xf7c0('0x5d')]({'where':{'id':_0x5b490c['params']['id']}})[_0xf7c0('0x36')](handleEntityNotFound(_0x4a2c4f,null))[_0xf7c0('0x36')](function(_0x2717de){if(_0x2717de){return _0x2717de['removeDispositions'](_0x5b490c['query'][_0xf7c0('0x6c')]);}})[_0xf7c0('0x36')](respondWithStatusCode(_0x4a2c4f,null))['catch'](handleError(_0x4a2c4f,null));};exports[_0xf7c0('0x6d')]=function(_0x1aab5d,_0x2c08d1,_0x3535d8){if(_0x1aab5d['body']['id']){delete _0x1aab5d[_0xf7c0('0x5f')]['id'];}return db['OpenchannelAccount'][_0xf7c0('0x5d')]({'where':{'id':_0x1aab5d['params']['id']}})['then'](handleEntityNotFound(_0x2c08d1,null))[_0xf7c0('0x36')](function(_0x2392ae){if(_0x2392ae){_0x1aab5d[_0xf7c0('0x5f')][_0xf7c0('0x6a')]=_0x2392ae['id'];return db[_0xf7c0('0x6e')][_0xf7c0('0x5e')](_0x1aab5d[_0xf7c0('0x5f')]);}})[_0xf7c0('0x36')](respondWithResult(_0x2c08d1,null))[_0xf7c0('0x29')](handleError(_0x2c08d1,null));};exports['getAnswers']=function(_0x222f3c,_0x502ae7,_0x2b80c3){var _0x55dfad={'raw':![],'where':{}};var _0x1f9b1b={};var _0x4a65a1={'count':0x0,'rows':[]};return db[_0xf7c0('0x42')][_0xf7c0('0x69')]({'where':{'id':_0x222f3c[_0xf7c0('0x5b')]['id']}})[_0xf7c0('0x36')](handleEntityNotFound(_0x502ae7,null))[_0xf7c0('0x36')](function(_0x32919c){if(_0x32919c){_0x1f9b1b[_0xf7c0('0x4a')]=_['keys'](db[_0xf7c0('0x6e')][_0xf7c0('0x43')]);_0x1f9b1b[_0xf7c0('0x46')]=_[_0xf7c0('0x47')](_0x222f3c[_0xf7c0('0x46')]);_0x1f9b1b[_0xf7c0('0x48')]=_[_0xf7c0('0x49')](_0x1f9b1b[_0xf7c0('0x4a')],_0x1f9b1b[_0xf7c0('0x46')]);_0x55dfad[_0xf7c0('0x4c')]=_[_0xf7c0('0x49')](_0x1f9b1b[_0xf7c0('0x4a')],qs[_0xf7c0('0x4b')](_0x222f3c[_0xf7c0('0x46')]['fields']));_0x55dfad[_0xf7c0('0x4c')]=_0x55dfad[_0xf7c0('0x4c')]['length']?_0x55dfad['attributes']:_0x1f9b1b[_0xf7c0('0x4a')];if(!_0x222f3c[_0xf7c0('0x46')]['hasOwnProperty']('nolimit')){_0x55dfad[_0xf7c0('0x30')]=qs[_0xf7c0('0x30')](_0x222f3c['query'][_0xf7c0('0x30')]);_0x55dfad[_0xf7c0('0x2e')]=qs['offset'](_0x222f3c[_0xf7c0('0x46')]['offset']);}_0x55dfad[_0xf7c0('0x50')]=qs[_0xf7c0('0x51')](_0x222f3c[_0xf7c0('0x46')][_0xf7c0('0x51')]);_0x55dfad[_0xf7c0('0x52')]=qs[_0xf7c0('0x48')](_[_0xf7c0('0x53')](_0x222f3c['query'],_0x1f9b1b[_0xf7c0('0x48')]));_0x55dfad[_0xf7c0('0x52')][_0xf7c0('0x6a')]=_0x32919c['id'];if(_0x222f3c['query'][_0xf7c0('0x56')]){_0x55dfad[_0xf7c0('0x52')]=_['merge'](_0x55dfad[_0xf7c0('0x52')],{'$or':_[_0xf7c0('0x41')](_0x55dfad['attributes'],function(_0x442a04){var _0x2ef726={};_0x2ef726[_0x442a04]={'$like':'%'+_0x222f3c[_0xf7c0('0x46')]['filter']+'%'};return _0x2ef726;})});}_0x55dfad=_[_0xf7c0('0x54')]({},_0x55dfad,_0x222f3c[_0xf7c0('0x5c')]);return db[_0xf7c0('0x6e')]['count']({'where':_0x55dfad['where']})[_0xf7c0('0x36')](function(_0x1d6efb){_0x4a65a1[_0xf7c0('0x31')]=_0x1d6efb;if(_0x222f3c[_0xf7c0('0x46')]['includeAll']){_0x55dfad[_0xf7c0('0x58')]=[{'all':!![]}];}return db['CannedAnswer'][_0xf7c0('0x6f')](_0x55dfad);})[_0xf7c0('0x36')](function(_0x5e905f){_0x4a65a1[_0xf7c0('0x59')]=_0x5e905f;return _0x4a65a1;});}})[_0xf7c0('0x36')](respondWithFilteredResult(_0x502ae7,_0x55dfad))[_0xf7c0('0x29')](handleError(_0x502ae7,null));};exports[_0xf7c0('0x70')]=function(_0x365133,_0x51b807,_0x4ece12){return db[_0xf7c0('0x42')]['find']({'where':{'id':_0x365133[_0xf7c0('0x5b')]['id']}})[_0xf7c0('0x36')](handleEntityNotFound(_0x51b807,null))['then'](function(_0x549132){if(_0x549132){return _0x549132['removeAnswers'](_0x365133[_0xf7c0('0x46')][_0xf7c0('0x6c')]);}})['then'](respondWithStatusCode(_0x51b807,null))[_0xf7c0('0x29')](handleError(_0x51b807,null));};exports['notify']=function(_0x5da1cd,_0x471d03,_0x4cdc4d){var _0x1c0e33={'body':_0x5da1cd[_0xf7c0('0x5f')],'channel':'openchannel'};var _0x212ef5=[];var _0x316e7d=[];var _0x6600be={};var _0x6c0080=![];return db[_0xf7c0('0x71')]['describe']()['then'](function(_0x2586d9){if(!_0x2586d9){throw new db[(_0xf7c0('0x72'))][(_0xf7c0('0x73'))](_0xf7c0('0x74'));}_0x212ef5=_[_0xf7c0('0x75')](_[_0xf7c0('0x47')](_0x2586d9),[_0xf7c0('0x76'),_0xf7c0('0x77')]);_0x316e7d=_['difference'](_[_0xf7c0('0x47')](_0x2586d9),[_0xf7c0('0x76'),_0xf7c0('0x77'),_0xf7c0('0x78'),'ListId']);if(_0x5da1cd['body']['id']){delete _0x5da1cd[_0xf7c0('0x5f')]['id'];}if(_[_0xf7c0('0x79')](_0x5da1cd[_0xf7c0('0x5f')]['from'])){throw new db['Sequelize']['ValidationError'](_0xf7c0('0x7a'));}if(_[_0xf7c0('0x79')](_0x5da1cd[_0xf7c0('0x5f')]['body'])||_0x5da1cd[_0xf7c0('0x5f')][_0xf7c0('0x5f')]===''){throw new db[(_0xf7c0('0x72'))][(_0xf7c0('0x73'))](_0xf7c0('0x7b'));}if(_[_0xf7c0('0x79')](_0x5da1cd[_0xf7c0('0x5f')][_0xf7c0('0x7c')])){throw new db[(_0xf7c0('0x72'))][(_0xf7c0('0x73'))](_0xf7c0('0x7d')+_0x316e7d);}if(!_[_0xf7c0('0x7e')](_0x316e7d,_0x5da1cd[_0xf7c0('0x5f')]['mapKey'])){throw new db[(_0xf7c0('0x72'))][(_0xf7c0('0x73'))](_0xf7c0('0x7f')+_0x316e7d);}_0x6600be[_0x5da1cd[_0xf7c0('0x5f')][_0xf7c0('0x7c')]]=_0x5da1cd['body'][_0xf7c0('0x80')];})[_0xf7c0('0x36')](function(){return db[_0xf7c0('0x42')][_0xf7c0('0x5d')]({'where':{'id':_0x5da1cd[_0xf7c0('0x5b')]['id']},'include':[{'model':db['CmList'],'as':_0xf7c0('0x81'),'include':[{'model':db[_0xf7c0('0x71')],'as':_0xf7c0('0x82'),'where':_0x6600be,'limit':0x1,'order':[['updatedAt',_0xf7c0('0x83')]]}]},{'model':db[_0xf7c0('0x84')],'as':_0xf7c0('0x85')}]});})[_0xf7c0('0x36')](handleEntityNotFound(_0x471d03,null))[_0xf7c0('0x36')](function(_0x1f465e){if(_0x1f465e&&_0x1f465e[_0xf7c0('0x81')]){_0x1c0e33[_0xf7c0('0x86')]=_0x1f465e;_0x1c0e33[_0xf7c0('0x87')]=_0x1f465e[_0xf7c0('0x85')];_0x1c0e33['list']=_0x1f465e['List'];_0x1c0e33[_0xf7c0('0x87')]=_[_0xf7c0('0x88')](_0x1c0e33['applications'],[_0xf7c0('0x89')],[_0xf7c0('0x8a')]);if(_0x1c0e33[_0xf7c0('0x86')][_0xf7c0('0x85')]){delete _0x1c0e33[_0xf7c0('0x86')][_0xf7c0('0x85')];}if(_0x1c0e33[_0xf7c0('0x86')]['List']&&_0x1c0e33[_0xf7c0('0x86')][_0xf7c0('0x81')][_0xf7c0('0x82')][_0xf7c0('0x4d')]){return _0x1c0e33['account'][_0xf7c0('0x81')][_0xf7c0('0x82')][0x0];}var _0x558caf=_['defaults'](_0x5da1cd[_0xf7c0('0x5f')],{'firstName':_0x5da1cd[_0xf7c0('0x5f')][_0xf7c0('0x80')],'ListId':_0x1f465e[_0xf7c0('0x8b')]});_0x558caf[_0x5da1cd['body']['mapKey']]=_0x5da1cd[_0xf7c0('0x5f')]['from'];return db[_0xf7c0('0x71')][_0xf7c0('0x5e')](_0x558caf,{'fields':_0x212ef5,'raw':!![]});}})[_0xf7c0('0x36')](handleEntityNotFound(_0x471d03,null))[_0xf7c0('0x36')](function(_0x39a708){_0x1c0e33['contact']=_0x39a708;if(_0x39a708){var _0x29a207={'ContactId':_0x39a708['id'],'OpenchannelAccountId':_0x5da1cd['params']['id'],'from':(_0x39a708[_0xf7c0('0x8c')]||'')+'\x20'+(_0x39a708['lastName']||'')};var _0x344786={'OpenchannelAccountId':_0x5da1cd['params']['id'],'closed':![]};if(_0x5da1cd[_0xf7c0('0x5f')]['threadId']){_0x344786[_0xf7c0('0x8d')]=_0x5da1cd[_0xf7c0('0x5f')][_0xf7c0('0x8d')];return db['OpenchannelInteraction']['find']({'where':_0x344786})[_0xf7c0('0x36')](function(_0x3ee0d5){if(_0x3ee0d5){return[_0x3ee0d5,![]];}_0x29a207[_0xf7c0('0x8d')]=_0x5da1cd[_0xf7c0('0x5f')]['threadId'];_0x29a207[_0xf7c0('0x8e')]=_0x5da1cd[_0xf7c0('0x5f')][_0xf7c0('0x8e')];return db['OpenchannelInteraction'][_0xf7c0('0x5e')](_0x29a207)[_0xf7c0('0x36')](function(_0x4977a2){return[_0x4977a2,!![]];});});}else{_0x344786[_0xf7c0('0x8d')]=null;}_0x344786[_0xf7c0('0x8f')]=_0x39a708['id'];return db['OpenchannelInteraction']['find']({'where':_0x344786})[_0xf7c0('0x36')](function(_0xb657b9){if(_0xb657b9){return[_0xb657b9,![]];}return db[_0xf7c0('0x90')][_0xf7c0('0x5e')](_0x29a207)[_0xf7c0('0x36')](function(_0x16d596){return[_0x16d596,!![]];});});}})[_0xf7c0('0x91')](function(_0x4d0769,_0x281401){if(_0x4d0769){_0x6c0080=_0x281401;if(!_0x281401){var _0x4d0287={'from':(_0x1c0e33[_0xf7c0('0x92')]['firstName']||'')+'\x20'+(_0x1c0e33[_0xf7c0('0x92')][_0xf7c0('0x93')]||'')};if(_0x5da1cd['body'][_0xf7c0('0x8d')]&&_0x5da1cd[_0xf7c0('0x5f')]['messageId']&&_0x5da1cd['body'][_0xf7c0('0x8d')]!=_0x5da1cd[_0xf7c0('0x5f')][_0xf7c0('0x94')]){_0x4d0287[_0xf7c0('0x8d')]=_0x5da1cd['body'][_0xf7c0('0x94')];}return _0x4d0769[_0xf7c0('0x65')](_0x4d0287);}else{return _0x4d0769;}}})[_0xf7c0('0x36')](function(_0xb78048){_0x1c0e33[_0xf7c0('0x95')]=_0xb78048['get']({'plain':!![]});_0x1c0e33[_0xf7c0('0x95')][_0xf7c0('0x96')]=_0x6c0080;if(_0x1c0e33['interaction'][_0xf7c0('0x96')]){if(_0x1c0e33[_0xf7c0('0x86')][_0xf7c0('0x97')]){_0x1c0e33[_0xf7c0('0x87')]['push']({'id':0x0,'priority':_0x1c0e33['applications'][_0xf7c0('0x4d')]+0x1,'app':_0xf7c0('0x98'),'appdata':'unmanaged','interval':_0xf7c0('0x99')});}}return db['OpenchannelMessage'][_0xf7c0('0x5e')]({'body':_0x5da1cd['body'][_0xf7c0('0x5f')],'OpenchannelAccountId':_0x5da1cd['params']['id'],'OpenchannelInteractionId':_0xb78048['id'],'direction':'in','ContactId':_0x1c0e33[_0xf7c0('0x92')]['id'],'AttachmentId':_0x5da1cd[_0xf7c0('0x5f')][_0xf7c0('0x9a')]});})[_0xf7c0('0x36')](function(_0x2e226a){_0x1c0e33[_0xf7c0('0x28')]=_0x2e226a;if(_0x1c0e33[_0xf7c0('0x95')][_0xf7c0('0x9b')]){return db[_0xf7c0('0x9c')][_0xf7c0('0x5d')]({'attributes':['id','name'],'where':{'id':_0x1c0e33['interaction'][_0xf7c0('0x9b')]}})[_0xf7c0('0x36')](function(_0x18bc78){if(_0x18bc78){_0x1c0e33[_0xf7c0('0x87')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x18bc78['name']+','+(_0x1c0e33[_0xf7c0('0x86')]['waitForTheAssignedAgent']||0xa),'interval':_0xf7c0('0x99')});_0x1c0e33[_0xf7c0('0x9d')]=![];}return respondWithRpcPromise(_0xf7c0('0x9e'),'startRouting',_0x1c0e33);});}return respondWithRpcPromise('Start',_0xf7c0('0x9f'),_0x1c0e33);})[_0xf7c0('0x36')](function(_0x28323a){respondWithRpcPromise('EventManager','EventManager',{'event':'notify','message':_0x28323a},client9002);return _0x28323a;})[_0xf7c0('0x36')](respondWithResult(_0x471d03,null))[_0xf7c0('0x29')](handleError(_0x471d03,null));};exports[_0xf7c0('0xa0')]=function(_0x45a1f1,_0x4e79a8){var _0x381d29=_0x45a1f1[_0xf7c0('0x5b')]['id'];var _0x5a5c9d=_0x45a1f1[_0xf7c0('0x5f')];var _0x4031fa=0xc8;var _0x14af4b=null;return db[_0xf7c0('0xa1')][_0xf7c0('0xa2')]({'isolationLevel':db['sequelize'][_0xf7c0('0xa3')]['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x186abb){return db[_0xf7c0('0x42')][_0xf7c0('0x69')]({'where':{'id':_0x381d29},'transaction':_0x186abb})['then'](function(_0x1a6aac){if(_0x1a6aac){return db[_0xf7c0('0x84')][_0xf7c0('0x37')]({'where':{'OpenchannelAccountId':_0x381d29},'transaction':_0x186abb})[_0xf7c0('0x36')](function(){var _0xec0758=_[_0xf7c0('0x41')](_0x5a5c9d,function(_0x2543c3){_0x2543c3['OpenchannelAccountId']=_0x381d29;return _0x2543c3;});return db[_0xf7c0('0x84')]['bulkCreate'](_0xec0758,{'transaction':_0x186abb});});}else{_0x4031fa=0x194;_0x14af4b=[];}});})[_0xf7c0('0x36')](function(){if(_0x4031fa!==0x194){return db['OpenchannelApplication'][_0xf7c0('0xa4')]({'where':{'OpenchannelAccountId':_0x381d29},'order':_0xf7c0('0x89')})[_0xf7c0('0x36')](function(_0x5d93f8){_0x14af4b=_0x5d93f8;});}})[_0xf7c0('0x29')](function(_0x16cb39){_0x4031fa=0x1f4;logger[_0xf7c0('0x26')](_0x16cb39['stack']);if(_0x16cb39[_0xf7c0('0x3c')]){delete _0x16cb39[_0xf7c0('0x3c')];}_0x14af4b=_0x16cb39;})[_0xf7c0('0xa5')](function(){if(_0x14af4b===null){_0x4e79a8['sendStatus'](_0x4031fa);}else{if(_0x4031fa===0x1f4){_0x4e79a8['status'](_0x4031fa)[_0xf7c0('0x3d')](_0x14af4b);}else{_0x4e79a8[_0xf7c0('0x2c')](_0x4031fa)[_0xf7c0('0x2d')](_0x14af4b);}}});};exports['getApplications']=function(_0x2b7ad3,_0x5ee323,_0x45d0a0){var _0x10e9fb={};var _0x2c8e3d={};var _0x52fae0;var _0x4817a0;return db['OpenchannelAccount'][_0xf7c0('0x69')]({'where':{'id':_0x2b7ad3[_0xf7c0('0x5b')]['id']}})[_0xf7c0('0x36')](handleEntityNotFound(_0x5ee323,null))[_0xf7c0('0x36')](function(_0x7efbd9){if(_0x7efbd9){_0x52fae0=_0x7efbd9;_0x2c8e3d[_0xf7c0('0x4a')]=_[_0xf7c0('0x47')](db[_0xf7c0('0x84')][_0xf7c0('0x43')]);_0x2c8e3d[_0xf7c0('0x46')]=_[_0xf7c0('0x47')](_0x2b7ad3[_0xf7c0('0x46')]);_0x2c8e3d['filters']=_['intersection'](_0x2c8e3d['model'],_0x2c8e3d[_0xf7c0('0x46')]);_0x10e9fb[_0xf7c0('0x4c')]=_[_0xf7c0('0x49')](_0x2c8e3d[_0xf7c0('0x4a')],qs[_0xf7c0('0x4b')](_0x2b7ad3['query']['fields']));_0x10e9fb[_0xf7c0('0x4c')]=_0x10e9fb['attributes'][_0xf7c0('0x4d')]?_0x10e9fb[_0xf7c0('0x4c')]:_0x2c8e3d[_0xf7c0('0x4a')];_0x10e9fb[_0xf7c0('0x50')]=qs['sort'](_0x2b7ad3[_0xf7c0('0x46')][_0xf7c0('0x51')]);_0x10e9fb['where']=qs[_0xf7c0('0x48')](_['pick'](_0x2b7ad3[_0xf7c0('0x46')],_0x2c8e3d[_0xf7c0('0x48')]));if(_0x2b7ad3[_0xf7c0('0x46')][_0xf7c0('0x56')]){_0x10e9fb[_0xf7c0('0x52')]=_['merge'](_0x10e9fb['where'],{'$or':_[_0xf7c0('0x41')](_0x10e9fb[_0xf7c0('0x4c')],function(_0xa03036){var _0x1b94a3={};_0x1b94a3[_0xa03036]={'$like':'%'+_0x2b7ad3[_0xf7c0('0x46')]['filter']+'%'};return _0x1b94a3;})});}_0x10e9fb=_[_0xf7c0('0x54')]({},_0x10e9fb,_0x2b7ad3[_0xf7c0('0x5c')]);return _0x52fae0['getApplications'](_0x10e9fb);}})[_0xf7c0('0x36')](function(_0x2d3ceb){if(_0x2d3ceb){_0x4817a0=_0x2d3ceb['length'];if(!_0x2b7ad3[_0xf7c0('0x46')][_0xf7c0('0x4e')]('nolimit')){_0x10e9fb[_0xf7c0('0x30')]=qs[_0xf7c0('0x30')](_0x2b7ad3[_0xf7c0('0x46')][_0xf7c0('0x30')]);_0x10e9fb[_0xf7c0('0x2e')]=qs[_0xf7c0('0x2e')](_0x2b7ad3[_0xf7c0('0x46')][_0xf7c0('0x2e')]);}return _0x52fae0[_0xf7c0('0xa6')](_0x10e9fb);}})['then'](function(_0x159883){if(_0x159883){return _0x159883?{'count':_0x4817a0,'rows':_0x159883}:null;}})[_0xf7c0('0x36')](respondWithResult(_0x5ee323,null))[_0xf7c0('0x29')](handleError(_0x5ee323,null));};exports['getInteractions']=function(_0x5849f3,_0x454630,_0x1adea9){var _0x41d5a1={'raw':![],'where':{}};var _0x6db79f={};var _0x1a4ffc={'count':0x0,'rows':[]};return db[_0xf7c0('0x42')][_0xf7c0('0x69')]({'where':{'id':_0x5849f3[_0xf7c0('0x5b')]['id']}})['then'](handleEntityNotFound(_0x454630,null))[_0xf7c0('0x36')](function(_0x5b4216){if(_0x5b4216){_0x6db79f[_0xf7c0('0x4a')]=_[_0xf7c0('0x47')](db[_0xf7c0('0x90')]['rawAttributes']);_0x6db79f[_0xf7c0('0x46')]=_[_0xf7c0('0x47')](_0x5849f3['query']);_0x6db79f[_0xf7c0('0x48')]=_[_0xf7c0('0x49')](_0x6db79f[_0xf7c0('0x4a')],_0x6db79f[_0xf7c0('0x46')]);_0x41d5a1[_0xf7c0('0x4c')]=_[_0xf7c0('0x49')](_0x6db79f[_0xf7c0('0x4a')],qs[_0xf7c0('0x4b')](_0x5849f3[_0xf7c0('0x46')][_0xf7c0('0x4b')]));_0x41d5a1[_0xf7c0('0x4c')]=_0x41d5a1[_0xf7c0('0x4c')][_0xf7c0('0x4d')]?_0x41d5a1[_0xf7c0('0x4c')]:_0x6db79f['model'];if(!_0x5849f3[_0xf7c0('0x46')]['hasOwnProperty'](_0xf7c0('0x4f'))){_0x41d5a1['limit']=qs[_0xf7c0('0x30')](_0x5849f3[_0xf7c0('0x46')][_0xf7c0('0x30')]);_0x41d5a1[_0xf7c0('0x2e')]=qs[_0xf7c0('0x2e')](_0x5849f3[_0xf7c0('0x46')]['offset']);}_0x41d5a1['order']=qs[_0xf7c0('0x51')](_0x5849f3[_0xf7c0('0x46')][_0xf7c0('0x51')]);_0x41d5a1[_0xf7c0('0x52')]=qs[_0xf7c0('0x48')](_[_0xf7c0('0x53')](_0x5849f3[_0xf7c0('0x46')],_0x6db79f[_0xf7c0('0x48')]));_0x41d5a1['where'][_0xf7c0('0x6a')]=_0x5b4216['id'];if(_0x5849f3[_0xf7c0('0x46')]['filter']){_0x41d5a1[_0xf7c0('0x52')]=_[_0xf7c0('0x54')](_0x41d5a1[_0xf7c0('0x52')],{'$or':_[_0xf7c0('0x41')](_0x41d5a1[_0xf7c0('0x4c')],function(_0x3c3534){var _0x271caa={};_0x271caa[_0x3c3534]={'$like':'%'+_0x5849f3[_0xf7c0('0x46')][_0xf7c0('0x56')]+'%'};return _0x271caa;})});}_0x41d5a1=_['merge']({},_0x41d5a1,_0x5849f3['options']);return db[_0xf7c0('0x90')][_0xf7c0('0x31')]({'where':_0x41d5a1[_0xf7c0('0x52')]})[_0xf7c0('0x36')](function(_0x328b5b){_0x1a4ffc[_0xf7c0('0x31')]=_0x328b5b;if(_0x5849f3[_0xf7c0('0x46')][_0xf7c0('0x57')]){_0x41d5a1[_0xf7c0('0x58')]=[{'model':db[_0xf7c0('0x71')],'as':_0xf7c0('0xa7'),'required':![]},{'model':db[_0xf7c0('0x9c')],'as':_0xf7c0('0xa8'),'attributes':['name','fullname',_0xf7c0('0xa9')],'required':![]},{'model':db[_0xf7c0('0xaa')],'as':'Tags','attributes':['id',_0xf7c0('0x3c'),_0xf7c0('0xab')],'where':_0x5849f3['query'][_0xf7c0('0xac')]?{'id':_0x5849f3[_0xf7c0('0x46')][_0xf7c0('0xac')]}:undefined,'required':_0x5849f3[_0xf7c0('0x46')][_0xf7c0('0xac')]?!![]:![]}];}return db[_0xf7c0('0x90')][_0xf7c0('0x6f')](_0x41d5a1);})[_0xf7c0('0x36')](function(_0x99ad2a){_0x1a4ffc[_0xf7c0('0x59')]=_0x99ad2a;return _0x1a4ffc;});}})['then'](respondWithFilteredResult(_0x454630,_0x41d5a1))[_0xf7c0('0x29')](handleError(_0x454630,null));};exports['addAgents']=function(_0x2f5862,_0x468353,_0x5f7803){return db[_0xf7c0('0x42')][_0xf7c0('0x5d')]({'where':{'id':_0x2f5862['params']['id']}})['then'](handleEntityNotFound(_0x468353,null))[_0xf7c0('0x36')](function(_0x7b367a){if(_0x7b367a){return _0x7b367a[_0xf7c0('0xad')](_0x2f5862['body'][_0xf7c0('0x6c')],_[_0xf7c0('0xae')](_0x2f5862[_0xf7c0('0x5f')],[_0xf7c0('0x6c'),'id'])||{})[_0xf7c0('0x91')](function(_0x32a22a){for(var _0x350c45=0x0;_0x350c45<_0x2f5862['body']['ids'][_0xf7c0('0x4d')];_0x350c45+=0x1){socket[_0xf7c0('0xaf')]('userOpenchannelAccount:save',{'UserId':Number(_0x2f5862[_0xf7c0('0x5f')][_0xf7c0('0x6c')][_0x350c45]),'OpenchannelAccountId':Number(_0x2f5862[_0xf7c0('0x5b')]['id'])});}return _0x32a22a;});}})[_0xf7c0('0x36')](respondWithResult(_0x468353,null))[_0xf7c0('0x29')](handleError(_0x468353,null));};exports[_0xf7c0('0xb0')]=function(_0x2b2e80,_0x361d1b,_0x2d06a9){return db[_0xf7c0('0x42')][_0xf7c0('0x5d')]({'where':{'id':_0x2b2e80[_0xf7c0('0x5b')]['id']}})[_0xf7c0('0x36')](handleEntityNotFound(_0x361d1b,null))[_0xf7c0('0x36')](function(_0x38fea5){if(_0x38fea5){return _0x38fea5[_0xf7c0('0xb0')](_0x2b2e80[_0xf7c0('0x46')][_0xf7c0('0x6c')])['then'](function(){if(_['isArray'](_0x2b2e80['query'][_0xf7c0('0x6c')])){for(var _0x4fbe1b=0x0;_0x4fbe1b<_0x2b2e80['query']['ids'][_0xf7c0('0x4d')];_0x4fbe1b+=0x1){socket['emit']('userOpenchannelAccount:remove',{'UserId':Number(_0x2b2e80[_0xf7c0('0x46')][_0xf7c0('0x6c')][_0x4fbe1b]),'OpenchannelAccountId':Number(_0x2b2e80[_0xf7c0('0x5b')]['id'])});}}else{socket[_0xf7c0('0xaf')](_0xf7c0('0xb1'),{'UserId':Number(_0x2b2e80['query'][_0xf7c0('0x6c')]),'OpenchannelAccountId':Number(_0x2b2e80[_0xf7c0('0x5b')]['id'])});}});}})['then'](respondWithStatusCode(_0x361d1b,null))[_0xf7c0('0x29')](handleError(_0x361d1b,null));};exports[_0xf7c0('0xb2')]=function(_0x36f9ee,_0x5b2255,_0x46bcfe){var _0x351e88={};var _0x2dd778={};var _0x340f32;var _0x2707f2;return db[_0xf7c0('0x42')][_0xf7c0('0x69')]({'where':{'id':_0x36f9ee[_0xf7c0('0x5b')]['id']}})[_0xf7c0('0x36')](handleEntityNotFound(_0x5b2255,null))[_0xf7c0('0x36')](function(_0x59f2b6){if(_0x59f2b6){_0x340f32=_0x59f2b6;_0x2dd778[_0xf7c0('0x4a')]=_[_0xf7c0('0x47')](db[_0xf7c0('0x9c')]['rawAttributes']);_0x2dd778[_0xf7c0('0x46')]=_['keys'](_0x36f9ee[_0xf7c0('0x46')]);_0x2dd778[_0xf7c0('0x48')]=_[_0xf7c0('0x49')](_0x2dd778[_0xf7c0('0x4a')],_0x2dd778[_0xf7c0('0x46')]);_0x351e88[_0xf7c0('0x4c')]=_[_0xf7c0('0x49')](_0x2dd778[_0xf7c0('0x4a')],qs[_0xf7c0('0x4b')](_0x36f9ee[_0xf7c0('0x46')][_0xf7c0('0x4b')]));_0x351e88[_0xf7c0('0x4c')]=_0x351e88['attributes'][_0xf7c0('0x4d')]?_0x351e88['attributes']:_0x2dd778[_0xf7c0('0x4a')];_0x351e88[_0xf7c0('0x50')]=qs[_0xf7c0('0x51')](_0x36f9ee[_0xf7c0('0x46')][_0xf7c0('0x51')]);_0x351e88[_0xf7c0('0x52')]=qs['filters'](_[_0xf7c0('0x53')](_0x36f9ee[_0xf7c0('0x46')],_0x2dd778[_0xf7c0('0x48')]));if(_0x36f9ee[_0xf7c0('0x46')][_0xf7c0('0x56')]){_0x351e88['where']=_[_0xf7c0('0x54')](_0x351e88[_0xf7c0('0x52')],{'$or':_[_0xf7c0('0x41')](_0x351e88[_0xf7c0('0x4c')],function(_0x5962d4){var _0x454dc0={};_0x454dc0[_0x5962d4]={'$like':'%'+_0x36f9ee['query'][_0xf7c0('0x56')]+'%'};return _0x454dc0;})});}_0x351e88=_[_0xf7c0('0x54')]({},_0x351e88,_0x36f9ee['options']);return _0x340f32[_0xf7c0('0xb2')](_0x351e88);}})[_0xf7c0('0x36')](function(_0x549067){if(_0x549067){_0x2707f2=_0x549067[_0xf7c0('0x4d')];if(!_0x36f9ee[_0xf7c0('0x46')][_0xf7c0('0x4e')]('nolimit')){_0x351e88[_0xf7c0('0x30')]=qs[_0xf7c0('0x30')](_0x36f9ee[_0xf7c0('0x46')][_0xf7c0('0x30')]);_0x351e88[_0xf7c0('0x2e')]=qs[_0xf7c0('0x2e')](_0x36f9ee[_0xf7c0('0x46')]['offset']);}return _0x340f32[_0xf7c0('0xb2')](_0x351e88);}})[_0xf7c0('0x36')](function(_0x421ca1){if(_0x421ca1){return _0x421ca1?{'count':_0x2707f2,'rows':_0x421ca1}:null;}})[_0xf7c0('0x36')](respondWithResult(_0x5b2255,null))[_0xf7c0('0x29')](handleError(_0x5b2255,null));};exports['send']=function(_0x489b10,_0x10a6b1,_0x19071f){var _0x359a00,_0x21fc46,_0x422116;if(_['isNil'](_0x489b10[_0xf7c0('0x5f')]['body'])||_0x489b10[_0xf7c0('0x5f')][_0xf7c0('0x5f')]===''){throw new db[(_0xf7c0('0x72'))][(_0xf7c0('0x73'))](_0xf7c0('0x7b'));}if(_[_0xf7c0('0x79')](_0x489b10[_0xf7c0('0x5f')]['to'])){}_0x359a00=_0x489b10[_0xf7c0('0x5f')]['to'];return db[_0xf7c0('0x42')][_0xf7c0('0x69')]({'where':{'id':_0x489b10[_0xf7c0('0x5b')]['id']}})[_0xf7c0('0x36')](handleEntityNotFound(_0x10a6b1,null))['then'](function(_0x2b5d7d){if(_0x2b5d7d){return db[_0xf7c0('0x42')][_0xf7c0('0x5d')]({'where':{'id':_0x2b5d7d['id']},'include':[{'model':db[_0xf7c0('0xb3')],'as':_0xf7c0('0x81'),'include':[{'model':db[_0xf7c0('0x71')],'as':_0xf7c0('0x82'),'where':{[_0x2b5d7d[_0xf7c0('0x7c')]]:_0x359a00},'limit':0x1,'order':[[_0xf7c0('0x77'),'DESC']]}]}]})[_0xf7c0('0x36')](handleEntityNotFound(_0x10a6b1,null))[_0xf7c0('0x36')](function(_0x18249d){if(_0x18249d&&_0x18249d['List']){_0x21fc46=_0x18249d[_0xf7c0('0x38')]({'plain':!![]});if(_0x21fc46[_0xf7c0('0x81')]&&_0x21fc46[_0xf7c0('0x81')]['Contacts'][_0xf7c0('0x4d')]){return _0x21fc46['List']['Contacts'][0x0];}return db[_0xf7c0('0x71')][_0xf7c0('0x5e')](_[_0xf7c0('0xb4')](_0x489b10[_0xf7c0('0x5f')],{'firstName':_0x359a00,[_0x18249d[_0xf7c0('0x7c')]]:_0x359a00,'phone':_0x359a00,'ListId':_0x21fc46[_0xf7c0('0x8b')]}));}})['then'](handleEntityNotFound(_0x10a6b1,null))[_0xf7c0('0x36')](function(_0x520344){if(_0x520344){_0x422116=_0x520344;return db[_0xf7c0('0x90')][_0xf7c0('0x5d')]({'where':{'ContactId':_0x422116['id'],'closed':![],'OpenchannelAccountId':_0x21fc46['id']}})[_0xf7c0('0x36')](function(_0x419f5b){if(_0x419f5b){return[_0x419f5b,![]];}return db[_0xf7c0('0x90')][_0xf7c0('0x5e')]({'UserId':_0x489b10['user']['id'],'ContactId':_0x422116['id'],'OpenchannelAccountId':_0x21fc46['id'],'lastMsgDirection':'out','Messages':[_[_0xf7c0('0x54')](_0x489b10[_0xf7c0('0x5f')],{'read':![],'body':_0x489b10[_0xf7c0('0x5f')][_0xf7c0('0x5f')],'OpenchannelAccountId':_0x21fc46['id'],'UserId':_0x489b10[_0xf7c0('0xb5')]['id'],'ContactId':_0x422116['id']})]},{'include':[{'model':db[_0xf7c0('0xb6')],'as':'Messages'}]})[_0xf7c0('0x36')](function(_0x690066){return[_0x690066,!![]];});});}})[_0xf7c0('0x91')](function(_0x1d956f,_0x35bc5b){if(_0x35bc5b){return _0x1d956f;}return db[_0xf7c0('0xb6')]['create'](_[_0xf7c0('0x54')](_0x489b10[_0xf7c0('0x5f')],{'read':![],'body':_0x489b10[_0xf7c0('0x5f')][_0xf7c0('0x5f')],'OpenchannelAccountId':_0x21fc46['id'],'OpenchannelInteractionId':_0x1d956f['id'],'UserId':_0x489b10[_0xf7c0('0xb5')]['id'],'ContactId':_0x422116['id']}))[_0xf7c0('0x36')](function(_0xe7eeba){_0x1d956f['dataValues']['Messages']=[];_0x1d956f[_0xf7c0('0xb7')][_0xf7c0('0xb8')][_0xf7c0('0xb9')](_0xe7eeba[_0xf7c0('0xb7')]);return _0x1d956f;});});}})[_0xf7c0('0x36')](respondWithResult(_0x10a6b1,null))[_0xf7c0('0x29')](handleError(_0x10a6b1,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index be02604..d125dac 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 _0x70e0=['emit','events','../../mysqldb','OpenchannelAccount','update','remove'];(function(_0x27acbf,_0xe7afec){var _0xf93fc8=function(_0x1a91f7){while(--_0x1a91f7){_0x27acbf['push'](_0x27acbf['shift']());}};_0xf93fc8(++_0xe7afec);}(_0x70e0,0x17b));var _0x070e=function(_0x5cb953,_0x3e1094){_0x5cb953=_0x5cb953-0x0;var _0x2b2d6e=_0x70e0[_0x5cb953];return _0x2b2d6e;};'use strict';var EventEmitter=require(_0x070e('0x0'));var OpenchannelAccount=require(_0x070e('0x1'))['db'][_0x070e('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x070e('0x3'),'afterDestroy':_0x070e('0x4')};function emitEvent(_0x277d32){return function(_0x2593e5,_0x5c90fc,_0x7bce9b){OpenchannelAccountEvents['emit'](_0x277d32+':'+_0x2593e5['id'],_0x2593e5);OpenchannelAccountEvents[_0x070e('0x5')](_0x277d32,_0x2593e5);_0x7bce9b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount['hook'](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file +var _0x9c44=['save','update','remove','emit','hasOwnProperty','hook','exports','OpenchannelAccount','setMaxListeners'];(function(_0x24584d,_0x58da0c){var _0x2e3fc7=function(_0x31358e){while(--_0x31358e){_0x24584d['push'](_0x24584d['shift']());}};_0x2e3fc7(++_0x58da0c);}(_0x9c44,0x178));var _0x49c4=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0x9c44[_0x13b02f];return _0x12e9a6;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require('../../mysqldb')['db'][_0x49c4('0x0')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x49c4('0x1')](0x0);var events={'afterCreate':_0x49c4('0x2'),'afterUpdate':_0x49c4('0x3'),'afterDestroy':_0x49c4('0x4')};function emitEvent(_0x2ad237){return function(_0x4e0313,_0x4941f1,_0x41a183){OpenchannelAccountEvents['emit'](_0x2ad237+':'+_0x4e0313['id'],_0x4e0313);OpenchannelAccountEvents[_0x49c4('0x5')](_0x2ad237,_0x4e0313);_0x41a183(null);};}for(var e in events){if(events[_0x49c4('0x6')](e)){var event=events[e];OpenchannelAccount[_0x49c4('0x7')](e,emitEvent(event));}}module[_0x49c4('0x8')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index bae930d..b76ba38 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(_0x4248cb,_0x3d45c4){var _0x404232=function(_0x4f15bc){while(--_0x4f15bc){_0x4248cb['push'](_0x4248cb['shift']());}};_0x404232(++_0x3d45c4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'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(_0x3e9a45,_0x426236){var _0xd89851=function(_0x15eb69){while(--_0x15eb69){_0x3e9a45['push'](_0x3e9a45['shift']());}};_0xd89851(++_0x426236);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0xa9e0[_0x1b349a];return _0x5d1f7c;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'openchannel_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.rpc.js b/server/api/openchannelAccount/openchannelAccount.rpc.js index fe70ad3..29b8f92 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 _0x6f2f=['socket.io-emitter','./openchannelAccount.socket','register','request','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','ioredis','../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost'];(function(_0x1d5507,_0x48c4d9){var _0x144d50=function(_0x5d81e2){while(--_0x5d81e2){_0x1d5507['push'](_0x1d5507['shift']());}};_0x144d50(++_0x48c4d9);}(_0x6f2f,0xbe));var _0xf6f2=function(_0x5a79e2,_0x319b1a){_0x5a79e2=_0x5a79e2-0x0;var _0x266c45=_0x6f2f[_0x5a79e2];return _0x266c45;};'use strict';var _=require(_0xf6f2('0x0'));var util=require(_0xf6f2('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf6f2('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf6f2('0x3'))(_0xf6f2('0x4'));var config=require(_0xf6f2('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf6f2('0x6')]({'port':0x232a});config[_0xf6f2('0x7')]=_[_0xf6f2('0x8')](config[_0xf6f2('0x7')],{'host':_0xf6f2('0x9'),'port':0x18eb});var socket=require(_0xf6f2('0xa'))(new Redis(config[_0xf6f2('0x7')]));require(_0xf6f2('0xb'))[_0xf6f2('0xc')](socket);function respondWithRpcPromise(_0x17ffd2,_0x55a260,_0x109271){return new BPromise(function(_0x266c6e,_0x2a4325){return client[_0xf6f2('0xd')](_0x17ffd2,_0x109271)['then'](function(_0x4ca76a){logger['info'](_0xf6f2('0xe'),_0x55a260,_0xf6f2('0xf'));logger[_0xf6f2('0x10')](_0xf6f2('0x11'),_0x55a260,_0xf6f2('0xf'),JSON[_0xf6f2('0x12')](_0x4ca76a));if(_0x4ca76a['error']){if(_0x4ca76a[_0xf6f2('0x13')][_0xf6f2('0x14')]===0x1f4){logger[_0xf6f2('0x13')](_0xf6f2('0xe'),_0x55a260,_0x4ca76a[_0xf6f2('0x13')]['message']);return _0x2a4325(_0x4ca76a[_0xf6f2('0x13')][_0xf6f2('0x15')]);}logger[_0xf6f2('0x13')](_0xf6f2('0xe'),_0x55a260,_0x4ca76a[_0xf6f2('0x13')][_0xf6f2('0x15')]);return _0x266c6e(_0x4ca76a[_0xf6f2('0x13')][_0xf6f2('0x15')]);}else{logger[_0xf6f2('0x16')](_0xf6f2('0xe'),_0x55a260,_0xf6f2('0xf'));_0x266c6e(_0x4ca76a[_0xf6f2('0x17')][_0xf6f2('0x15')]);}})[_0xf6f2('0x18')](function(_0xb05611){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x55a260,_0xb05611);_0x2a4325(_0xb05611);});});} \ No newline at end of file +var _0xed3c=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','localhost','register','request','then','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','moment'];(function(_0x4e2007,_0x4610a6){var _0x2e024f=function(_0x3e6800){while(--_0x3e6800){_0x4e2007['push'](_0x4e2007['shift']());}};_0x2e024f(++_0x4610a6);}(_0xed3c,0x1a6));var _0xced3=function(_0x31c7b6,_0x5778bb){_0x31c7b6=_0x31c7b6-0x0;var _0x5ea4cc=_0xed3c[_0x31c7b6];return _0x5ea4cc;};'use strict';var _=require(_0xced3('0x0'));var util=require(_0xced3('0x1'));var moment=require(_0xced3('0x2'));var BPromise=require(_0xced3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xced3('0x4'));var db=require(_0xced3('0x5'))['db'];var utils=require(_0xced3('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xced3('0x7'));var jayson=require(_0xced3('0x8'));var client=jayson[_0xced3('0x9')][_0xced3('0xa')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0xced3('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./openchannelAccount.socket')[_0xced3('0xc')](socket);function respondWithRpcPromise(_0x321c42,_0x3e5a04,_0x12612f){return new BPromise(function(_0x1cb639,_0x5934b2){return client[_0xced3('0xd')](_0x321c42,_0x12612f)[_0xced3('0xe')](function(_0x3da0ff){logger['info'](_0xced3('0xf'),_0x3e5a04,_0xced3('0x10'));logger[_0xced3('0x11')](_0xced3('0x12'),_0x3e5a04,_0xced3('0x10'),JSON[_0xced3('0x13')](_0x3da0ff));if(_0x3da0ff[_0xced3('0x14')]){if(_0x3da0ff['error'][_0xced3('0x15')]===0x1f4){logger['error'](_0xced3('0xf'),_0x3e5a04,_0x3da0ff[_0xced3('0x14')][_0xced3('0x16')]);return _0x5934b2(_0x3da0ff[_0xced3('0x14')]['message']);}logger[_0xced3('0x14')](_0xced3('0xf'),_0x3e5a04,_0x3da0ff['error'][_0xced3('0x16')]);return _0x1cb639(_0x3da0ff[_0xced3('0x14')][_0xced3('0x16')]);}else{logger[_0xced3('0x17')]('OpenchannelAccount,\x20%s,\x20%s',_0x3e5a04,_0xced3('0x10'));_0x1cb639(_0x3da0ff['result'][_0xced3('0x16')]);}})[_0xced3('0x18')](function(_0x32c402){logger[_0xced3('0x14')](_0xced3('0xf'),_0x3e5a04,_0x32c402);_0x5934b2(_0x32c402);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 7b26760..aa55877 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 _0xbe99=['./openchannelAccount.events','save','remove','update','removeListener','register','openchannelAccount:'];(function(_0x23a6a3,_0x1baca8){var _0x6df639=function(_0x2e783f){while(--_0x2e783f){_0x23a6a3['push'](_0x23a6a3['shift']());}};_0x6df639(++_0x1baca8);}(_0xbe99,0x196));var _0x9be9=function(_0x3f88bc,_0xe38cf5){_0x3f88bc=_0x3f88bc-0x0;var _0x4df1c4=_0xbe99[_0x3f88bc];return _0x4df1c4;};'use strict';var OpenchannelAccountEvents=require(_0x9be9('0x0'));var events=[_0x9be9('0x1'),_0x9be9('0x2'),_0x9be9('0x3')];function createListener(_0x34fc81,_0x598d7e){return function(_0x3a0621){_0x598d7e['emit'](_0x34fc81,_0x3a0621);};}function removeListener(_0x3bc6d5,_0x3cfcaa){return function(){OpenchannelAccountEvents[_0x9be9('0x4')](_0x3bc6d5,_0x3cfcaa);};}exports[_0x9be9('0x5')]=function(_0x52da35){for(var _0x2134e7=0x0,_0x1eccd7=events['length'];_0x2134e7<_0x1eccd7;_0x2134e7++){var _0x49694d=events[_0x2134e7];var _0x7e0cd=createListener(_0x9be9('0x6')+_0x49694d,_0x52da35);OpenchannelAccountEvents['on'](_0x49694d,_0x7e0cd);}}; \ No newline at end of file +var _0xca66=['update','emit','register','length','./openchannelAccount.events'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xca66,0x8b));var _0x6ca6=function(_0x8fc917,_0x5b8be0){_0x8fc917=_0x8fc917-0x0;var _0xa6ecbc=_0xca66[_0x8fc917];return _0xa6ecbc;};'use strict';var OpenchannelAccountEvents=require(_0x6ca6('0x0'));var events=['save','remove',_0x6ca6('0x1')];function createListener(_0x1a863a,_0x44d1de){return function(_0x571335){_0x44d1de[_0x6ca6('0x2')](_0x1a863a,_0x571335);};}function removeListener(_0x4b1a10,_0x3ab489){return function(){OpenchannelAccountEvents['removeListener'](_0x4b1a10,_0x3ab489);};}exports[_0x6ca6('0x3')]=function(_0x27d8c6){for(var _0x34836f=0x0,_0x44019c=events[_0x6ca6('0x4')];_0x34836f<_0x44019c;_0x34836f++){var _0x27a210=events[_0x34836f];var _0x27d280=createListener('openchannelAccount:'+_0x27a210,_0x27d8c6);OpenchannelAccountEvents['on'](_0x27a210,_0x27d280);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 5b29381..0a7c1b7 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 _0x5e0f=['../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','index','/:id','isAuthenticated','destroy','exports','multer','util','connect-timeout','express','fs-extra'];(function(_0x2a6fd5,_0x3d6deb){var _0x43c6a4=function(_0x3aecb3){while(--_0x3aecb3){_0x2a6fd5['push'](_0x2a6fd5['shift']());}};_0x43c6a4(++_0x3d6deb);}(_0x5e0f,0xcd));var _0xf5e0=function(_0xe12571,_0x3d1192){_0xe12571=_0xe12571-0x0;var _0x5a4cb3=_0x5e0f[_0xe12571];return _0x5a4cb3;};'use strict';var multer=require(_0xf5e0('0x0'));var util=require(_0xf5e0('0x1'));var path=require('path');var timeout=require(_0xf5e0('0x2'));var express=require(_0xf5e0('0x3'));var router=express['Router']();var fs_extra=require(_0xf5e0('0x4'));var auth=require(_0xf5e0('0x5'));var interaction=require(_0xf5e0('0x6'));var config=require(_0xf5e0('0x7'));var controller=require(_0xf5e0('0x8'));router[_0xf5e0('0x9')]('/',auth['isAuthenticated'](),controller[_0xf5e0('0xa')]);router[_0xf5e0('0x9')](_0xf5e0('0xb'),auth[_0xf5e0('0xc')](),controller['show']);router['post']('/',auth[_0xf5e0('0xc')](),controller['create']);router['put'](_0xf5e0('0xb'),auth[_0xf5e0('0xc')](),controller['update']);router['delete'](_0xf5e0('0xb'),auth['isAuthenticated'](),controller[_0xf5e0('0xd')]);module[_0xf5e0('0xe')]=router; \ No newline at end of file +var _0xab97=['exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelApplication.controller','isAuthenticated','index','/:id','show','post','put','delete','destroy'];(function(_0x15fd5d,_0x9dff69){var _0x10f87e=function(_0x480eaf){while(--_0x480eaf){_0x15fd5d['push'](_0x15fd5d['shift']());}};_0x10f87e(++_0x9dff69);}(_0xab97,0x1bb));var _0x7ab9=function(_0x3f70d4,_0x552cdf){_0x3f70d4=_0x3f70d4-0x0;var _0x13bc23=_0xab97[_0x3f70d4];return _0x13bc23;};'use strict';var multer=require('multer');var util=require(_0x7ab9('0x0'));var path=require(_0x7ab9('0x1'));var timeout=require(_0x7ab9('0x2'));var express=require(_0x7ab9('0x3'));var router=express['Router']();var fs_extra=require(_0x7ab9('0x4'));var auth=require(_0x7ab9('0x5'));var interaction=require(_0x7ab9('0x6'));var config=require('../../config/environment');var controller=require(_0x7ab9('0x7'));router['get']('/',auth[_0x7ab9('0x8')](),controller[_0x7ab9('0x9')]);router['get'](_0x7ab9('0xa'),auth[_0x7ab9('0x8')](),controller[_0x7ab9('0xb')]);router[_0x7ab9('0xc')]('/',auth[_0x7ab9('0x8')](),controller['create']);router[_0x7ab9('0xd')](_0x7ab9('0xa'),auth[_0x7ab9('0x8')](),controller['update']);router[_0x7ab9('0xe')](_0x7ab9('0xa'),auth['isAuthenticated'](),controller[_0x7ab9('0xf')]);module[_0x7ab9('0x10')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 1c79c22..4b63e14 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 _0x953e=['TEXT','sequelize','STRING','noop'];(function(_0x4d07cc,_0x587613){var _0x42de3b=function(_0x201f78){while(--_0x201f78){_0x4d07cc['push'](_0x4d07cc['shift']());}};_0x42de3b(++_0x587613);}(_0x953e,0x1b5));var _0xe953=function(_0x4b36b8,_0x4231c3){_0x4b36b8=_0x4b36b8-0x0;var _0x53ef78=_0x953e[_0x4b36b8];return _0x53ef78;};'use strict';var Sequelize=require(_0xe953('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xe953('0x1')],'allowNull':![],'defaultValue':_0xe953('0x2')},'appdata':{'type':Sequelize[_0xe953('0x3')]()},'description':{'type':Sequelize[_0xe953('0x1')]},'interval':{'type':Sequelize[_0xe953('0x1')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xb6e9=['INTEGER','STRING','TEXT','sequelize','exports'];(function(_0x22f4e4,_0x16841b){var _0x325131=function(_0x3647f1){while(--_0x3647f1){_0x22f4e4['push'](_0x22f4e4['shift']());}};_0x325131(++_0x16841b);}(_0xb6e9,0x189));var _0x9b6e=function(_0x1a0030,_0x57793e){_0x1a0030=_0x1a0030-0x0;var _0x589db7=_0xb6e9[_0x1a0030];return _0x589db7;};'use strict';var Sequelize=require(_0x9b6e('0x0'));module[_0x9b6e('0x1')]={'priority':{'type':Sequelize[_0x9b6e('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x9b6e('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x9b6e('0x4')]()},'description':{'type':Sequelize[_0x9b6e('0x3')]},'interval':{'type':Sequelize[_0x9b6e('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 4069cbe..936acc5 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 _0xaa4e=['api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','then','destroy','error','stack','name','send','index','OpenchannelApplication','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','sort','where','pick','filter','merge','map','VIRTUAL','options','count','includeAll','findAll','catch','show','params','include','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger'];(function(_0x80f5e7,_0x4a63bd){var _0xbcbe0e=function(_0x3658a6){while(--_0x3658a6){_0x80f5e7['push'](_0x80f5e7['shift']());}};_0xbcbe0e(++_0x4a63bd);}(_0xaa4e,0xcc));var _0xeaa4=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xaa4e[_0x3ab51d];return _0x29a04e;};'use strict';var emlformat=require(_0xeaa4('0x0'));var rimraf=require(_0xeaa4('0x1'));var zipdir=require(_0xeaa4('0x2'));var jsonpatch=require(_0xeaa4('0x3'));var rp=require(_0xeaa4('0x4'));var moment=require(_0xeaa4('0x5'));var BPromise=require(_0xeaa4('0x6'));var Mustache=require('mustache');var util=require(_0xeaa4('0x7'));var path=require(_0xeaa4('0x8'));var sox=require(_0xeaa4('0x9'));var csv=require(_0xeaa4('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xeaa4('0xb'));var _=require(_0xeaa4('0xc'));var squel=require(_0xeaa4('0xd'));var crypto=require(_0xeaa4('0xe'));var jsforce=require(_0xeaa4('0xf'));var deskjs=require(_0xeaa4('0x10'));var toCsv=require(_0xeaa4('0xa'));var querystring=require(_0xeaa4('0x11'));var Papa=require(_0xeaa4('0x12'));var Redis=require(_0xeaa4('0x13'));var authService=require(_0xeaa4('0x14'));var qs=require(_0xeaa4('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xeaa4('0x16'));var logger=require(_0xeaa4('0x17'))(_0xeaa4('0x18'));var utils=require('../../config/utils');var config=require(_0xeaa4('0x19'));var licenseUtil=require(_0xeaa4('0x1a'));var db=require(_0xeaa4('0x1b'))['db'];function respondWithStatusCode(_0x1f9dfb,_0x1c04eb){_0x1c04eb=_0x1c04eb||0xcc;return function(_0x28a8e3){if(_0x28a8e3){return _0x1f9dfb[_0xeaa4('0x1c')](_0x1c04eb);}return _0x1f9dfb[_0xeaa4('0x1d')](_0x1c04eb)[_0xeaa4('0x1e')]();};}function respondWithResult(_0x245de5,_0x49bd40){_0x49bd40=_0x49bd40||0xc8;return function(_0xe473a7){if(_0xe473a7){return _0x245de5[_0xeaa4('0x1d')](_0x49bd40)[_0xeaa4('0x1f')](_0xe473a7);}};}function respondWithFilteredResult(_0x3e991e,_0x4df5e2){return function(_0x47d83a){if(_0x47d83a){var _0x3a3611=typeof _0x4df5e2[_0xeaa4('0x20')]===_0xeaa4('0x21')&&typeof _0x4df5e2[_0xeaa4('0x22')]===_0xeaa4('0x21');var _0xc803bd=_0x47d83a['count'];var _0x11fe01=_0x3a3611?0x0:_0x4df5e2[_0xeaa4('0x20')];var _0x16597b=_0x3a3611?_0x47d83a['count']:_0x4df5e2['offset']+_0x4df5e2[_0xeaa4('0x22')];var _0x280356;if(_0x16597b>=_0xc803bd){_0x16597b=_0xc803bd;_0x280356=0xc8;}else{_0x280356=0xce;}_0x3e991e[_0xeaa4('0x1d')](_0x280356);return _0x3e991e[_0xeaa4('0x23')](_0xeaa4('0x24'),_0x11fe01+'-'+_0x16597b+'/'+_0xc803bd)['json'](_0x47d83a);}return null;};}function patchUpdates(_0x2c7acb){return function(_0x1383de){try{jsonpatch[_0xeaa4('0x25')](_0x1383de,_0x2c7acb,!![]);}catch(_0x577b3a){return BPromise['reject'](_0x577b3a);}return _0x1383de['save']();};}function saveUpdates(_0x296c4a,_0x314f8f){return function(_0x2d6dbe){if(_0x2d6dbe){return _0x2d6dbe['update'](_0x296c4a)[_0xeaa4('0x26')](function(_0x3a6f92){return _0x3a6f92;});}return null;};}function removeEntity(_0xf9138a,_0x43cba5){return function(_0x59d145){if(_0x59d145){return _0x59d145[_0xeaa4('0x27')]()['then'](function(){_0xf9138a[_0xeaa4('0x1d')](0xcc)[_0xeaa4('0x1e')]();});}};}function handleEntityNotFound(_0x53fe00,_0x5a1d1d){return function(_0x8d4e40){if(!_0x8d4e40){_0x53fe00[_0xeaa4('0x1c')](0x194);}return _0x8d4e40;};}function handleError(_0x4102f2,_0x53ee2e){_0x53ee2e=_0x53ee2e||0x1f4;return function(_0x170940){logger[_0xeaa4('0x28')](_0x170940[_0xeaa4('0x29')]);if(_0x170940['name']){delete _0x170940[_0xeaa4('0x2a')];}_0x4102f2[_0xeaa4('0x1d')](_0x53ee2e)[_0xeaa4('0x2b')](_0x170940);};}exports[_0xeaa4('0x2c')]=function(_0x111646,_0x37f73c){var _0x21490c={},_0x36fe54={},_0x242f95={'count':0x0,'rows':[]};var _0x14c807=_['map'](db[_0xeaa4('0x2d')][_0xeaa4('0x2e')],function(_0xd8ec59){return{'name':_0xd8ec59['fieldName'],'type':_0xd8ec59[_0xeaa4('0x2f')][_0xeaa4('0x30')]};});_0x36fe54[_0xeaa4('0x31')]=_['map'](_0x14c807,_0xeaa4('0x2a'));_0x36fe54[_0xeaa4('0x32')]=_[_0xeaa4('0x33')](_0x111646[_0xeaa4('0x32')]);_0x36fe54[_0xeaa4('0x34')]=_[_0xeaa4('0x35')](_0x36fe54[_0xeaa4('0x31')],_0x36fe54[_0xeaa4('0x32')]);_0x21490c['attributes']=_[_0xeaa4('0x35')](_0x36fe54[_0xeaa4('0x31')],qs[_0xeaa4('0x36')](_0x111646[_0xeaa4('0x32')][_0xeaa4('0x36')]));_0x21490c[_0xeaa4('0x37')]=_0x21490c[_0xeaa4('0x37')][_0xeaa4('0x38')]?_0x21490c['attributes']:_0x36fe54[_0xeaa4('0x31')];if(!_0x111646[_0xeaa4('0x32')]['hasOwnProperty'](_0xeaa4('0x39'))){_0x21490c[_0xeaa4('0x22')]=qs[_0xeaa4('0x22')](_0x111646[_0xeaa4('0x32')][_0xeaa4('0x22')]);_0x21490c[_0xeaa4('0x20')]=qs[_0xeaa4('0x20')](_0x111646[_0xeaa4('0x32')][_0xeaa4('0x20')]);}_0x21490c['order']=qs[_0xeaa4('0x3a')](_0x111646[_0xeaa4('0x32')][_0xeaa4('0x3a')]);_0x21490c[_0xeaa4('0x3b')]=qs['filters'](_[_0xeaa4('0x3c')](_0x111646[_0xeaa4('0x32')],_0x36fe54[_0xeaa4('0x34')]),_0x14c807);if(_0x111646[_0xeaa4('0x32')][_0xeaa4('0x3d')]){_0x21490c[_0xeaa4('0x3b')]=_[_0xeaa4('0x3e')](_0x21490c[_0xeaa4('0x3b')],{'$or':_[_0xeaa4('0x3f')](_0x14c807,function(_0x22e750){if(_0x22e750[_0xeaa4('0x2f')]!==_0xeaa4('0x40')){var _0x5e2c3f={};_0x5e2c3f[_0x22e750[_0xeaa4('0x2a')]]={'$like':'%'+_0x111646[_0xeaa4('0x32')]['filter']+'%'};return _0x5e2c3f;}})});}_0x21490c=_[_0xeaa4('0x3e')]({},_0x21490c,_0x111646[_0xeaa4('0x41')]);var _0x5c1f63={'where':_0x21490c[_0xeaa4('0x3b')]};return db[_0xeaa4('0x2d')][_0xeaa4('0x42')](_0x5c1f63)[_0xeaa4('0x26')](function(_0x7d026e){_0x242f95[_0xeaa4('0x42')]=_0x7d026e;if(_0x111646['query'][_0xeaa4('0x43')]){_0x21490c['include']=[{'all':!![]}];}return db[_0xeaa4('0x2d')][_0xeaa4('0x44')](_0x21490c);})[_0xeaa4('0x26')](function(_0x57fce7){_0x242f95['rows']=_0x57fce7;return _0x242f95;})[_0xeaa4('0x26')](respondWithFilteredResult(_0x37f73c,_0x21490c))[_0xeaa4('0x45')](handleError(_0x37f73c,null));};exports[_0xeaa4('0x46')]=function(_0x1692db,_0x1c1b3f){var _0x4c81d4={'raw':!![],'where':{'id':_0x1692db[_0xeaa4('0x47')]['id']}},_0x3f3451={};_0x3f3451[_0xeaa4('0x31')]=_[_0xeaa4('0x33')](db[_0xeaa4('0x2d')][_0xeaa4('0x2e')]);_0x3f3451[_0xeaa4('0x32')]=_[_0xeaa4('0x33')](_0x1692db['query']);_0x3f3451[_0xeaa4('0x34')]=_[_0xeaa4('0x35')](_0x3f3451[_0xeaa4('0x31')],_0x3f3451['query']);_0x4c81d4[_0xeaa4('0x37')]=_[_0xeaa4('0x35')](_0x3f3451[_0xeaa4('0x31')],qs['fields'](_0x1692db['query'][_0xeaa4('0x36')]));_0x4c81d4[_0xeaa4('0x37')]=_0x4c81d4[_0xeaa4('0x37')][_0xeaa4('0x38')]?_0x4c81d4[_0xeaa4('0x37')]:_0x3f3451['model'];if(_0x1692db[_0xeaa4('0x32')][_0xeaa4('0x43')]){_0x4c81d4[_0xeaa4('0x48')]=[{'all':!![]}];}_0x4c81d4=_['merge']({},_0x4c81d4,_0x1692db['options']);return db[_0xeaa4('0x2d')][_0xeaa4('0x49')](_0x4c81d4)[_0xeaa4('0x26')](handleEntityNotFound(_0x1c1b3f,null))[_0xeaa4('0x26')](respondWithResult(_0x1c1b3f,null))[_0xeaa4('0x45')](handleError(_0x1c1b3f,null));};exports[_0xeaa4('0x4a')]=function(_0x3e4264,_0x233a24){return db[_0xeaa4('0x2d')]['create'](_0x3e4264[_0xeaa4('0x4b')],{})[_0xeaa4('0x26')](respondWithResult(_0x233a24,0xc9))[_0xeaa4('0x45')](handleError(_0x233a24,null));};exports['update']=function(_0x5b7e6d,_0x411f9d){if(_0x5b7e6d[_0xeaa4('0x4b')]['id']){delete _0x5b7e6d[_0xeaa4('0x4b')]['id'];}return db[_0xeaa4('0x2d')][_0xeaa4('0x49')]({'where':{'id':_0x5b7e6d[_0xeaa4('0x47')]['id']}})['then'](handleEntityNotFound(_0x411f9d,null))[_0xeaa4('0x26')](saveUpdates(_0x5b7e6d[_0xeaa4('0x4b')],null))[_0xeaa4('0x26')](respondWithResult(_0x411f9d,null))[_0xeaa4('0x45')](handleError(_0x411f9d,null));};exports['destroy']=function(_0x368837,_0xd10213){return db[_0xeaa4('0x2d')][_0xeaa4('0x49')]({'where':{'id':_0x368837[_0xeaa4('0x47')]['id']}})[_0xeaa4('0x26')](handleEntityNotFound(_0xd10213,null))[_0xeaa4('0x26')](removeEntity(_0xd10213,null))['catch'](handleError(_0xd10213,null));}; \ No newline at end of file +var _0x2d8a=['to-csv','ejs','fs-extra','lodash','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','update','then','destroy','error','name','index','map','OpenchannelApplication','rawAttributes','type','key','query','filters','model','attributes','intersection','fields','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','length','find','create','body','eml-format','rimraf','fast-json-patch','bluebird','path','sox'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x2d8a,0x149));var _0xa2d8=function(_0x5968aa,_0x522247){_0x5968aa=_0x5968aa-0x0;var _0x9cab36=_0x2d8a[_0x5968aa];return _0x9cab36;};'use strict';var emlformat=require(_0xa2d8('0x0'));var rimraf=require(_0xa2d8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa2d8('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa2d8('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0xa2d8('0x4'));var sox=require(_0xa2d8('0x5'));var csv=require(_0xa2d8('0x6'));var ejs=require(_0xa2d8('0x7'));var fs=require('fs');var fs_extra=require(_0xa2d8('0x8'));var _=require(_0xa2d8('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa2d8('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xa2d8('0x6'));var querystring=require(_0xa2d8('0xb'));var Papa=require(_0xa2d8('0xc'));var Redis=require(_0xa2d8('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xa2d8('0xe'));var as=require(_0xa2d8('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa2d8('0x10'))('api');var utils=require(_0xa2d8('0x11'));var config=require(_0xa2d8('0x12'));var licenseUtil=require(_0xa2d8('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3bfae0,_0x76cab0){_0x76cab0=_0x76cab0||0xcc;return function(_0x4b505d){if(_0x4b505d){return _0x3bfae0[_0xa2d8('0x14')](_0x76cab0);}return _0x3bfae0[_0xa2d8('0x15')](_0x76cab0)[_0xa2d8('0x16')]();};}function respondWithResult(_0x3e7812,_0x23f172){_0x23f172=_0x23f172||0xc8;return function(_0x3db36c){if(_0x3db36c){return _0x3e7812[_0xa2d8('0x15')](_0x23f172)[_0xa2d8('0x17')](_0x3db36c);}};}function respondWithFilteredResult(_0x57b072,_0x48ceea){return function(_0x574168){if(_0x574168){var _0x1c5944=typeof _0x48ceea[_0xa2d8('0x18')]==='undefined'&&typeof _0x48ceea[_0xa2d8('0x19')]===_0xa2d8('0x1a');var _0x316f85=_0x574168['count'];var _0x47b1e6=_0x1c5944?0x0:_0x48ceea[_0xa2d8('0x18')];var _0x5a735a=_0x1c5944?_0x574168[_0xa2d8('0x1b')]:_0x48ceea[_0xa2d8('0x18')]+_0x48ceea['limit'];var _0x6c8b1a;if(_0x5a735a>=_0x316f85){_0x5a735a=_0x316f85;_0x6c8b1a=0xc8;}else{_0x6c8b1a=0xce;}_0x57b072['status'](_0x6c8b1a);return _0x57b072[_0xa2d8('0x1c')]('Content-Range',_0x47b1e6+'-'+_0x5a735a+'/'+_0x316f85)['json'](_0x574168);}return null;};}function patchUpdates(_0x154f93){return function(_0x2c0db8){try{jsonpatch[_0xa2d8('0x1d')](_0x2c0db8,_0x154f93,!![]);}catch(_0x1d7e5d){return BPromise[_0xa2d8('0x1e')](_0x1d7e5d);}return _0x2c0db8['save']();};}function saveUpdates(_0x208346,_0x5a30f4){return function(_0x14b087){if(_0x14b087){return _0x14b087[_0xa2d8('0x1f')](_0x208346)[_0xa2d8('0x20')](function(_0x53a95c){return _0x53a95c;});}return null;};}function removeEntity(_0x540ed5,_0x260b2a){return function(_0x4ec174){if(_0x4ec174){return _0x4ec174[_0xa2d8('0x21')]()[_0xa2d8('0x20')](function(){_0x540ed5[_0xa2d8('0x15')](0xcc)[_0xa2d8('0x16')]();});}};}function handleEntityNotFound(_0x37fc62,_0x2bfe1f){return function(_0x36cd1d){if(!_0x36cd1d){_0x37fc62['sendStatus'](0x194);}return _0x36cd1d;};}function handleError(_0x1d98a5,_0x365f9c){_0x365f9c=_0x365f9c||0x1f4;return function(_0x46b05a){logger[_0xa2d8('0x22')](_0x46b05a['stack']);if(_0x46b05a[_0xa2d8('0x23')]){delete _0x46b05a[_0xa2d8('0x23')];}_0x1d98a5['status'](_0x365f9c)['send'](_0x46b05a);};}exports[_0xa2d8('0x24')]=function(_0x4f5622,_0x16b702){var _0x1311a0={},_0x387428={},_0x4c9106={'count':0x0,'rows':[]};var _0x4f6871=_[_0xa2d8('0x25')](db[_0xa2d8('0x26')][_0xa2d8('0x27')],function(_0x47c16f){return{'name':_0x47c16f['fieldName'],'type':_0x47c16f[_0xa2d8('0x28')][_0xa2d8('0x29')]};});_0x387428['model']=_[_0xa2d8('0x25')](_0x4f6871,_0xa2d8('0x23'));_0x387428[_0xa2d8('0x2a')]=_['keys'](_0x4f5622[_0xa2d8('0x2a')]);_0x387428[_0xa2d8('0x2b')]=_['intersection'](_0x387428[_0xa2d8('0x2c')],_0x387428['query']);_0x1311a0[_0xa2d8('0x2d')]=_[_0xa2d8('0x2e')](_0x387428[_0xa2d8('0x2c')],qs[_0xa2d8('0x2f')](_0x4f5622[_0xa2d8('0x2a')][_0xa2d8('0x2f')]));_0x1311a0[_0xa2d8('0x2d')]=_0x1311a0[_0xa2d8('0x2d')]['length']?_0x1311a0[_0xa2d8('0x2d')]:_0x387428[_0xa2d8('0x2c')];if(!_0x4f5622[_0xa2d8('0x2a')]['hasOwnProperty']('nolimit')){_0x1311a0[_0xa2d8('0x19')]=qs[_0xa2d8('0x19')](_0x4f5622[_0xa2d8('0x2a')][_0xa2d8('0x19')]);_0x1311a0[_0xa2d8('0x18')]=qs[_0xa2d8('0x18')](_0x4f5622[_0xa2d8('0x2a')][_0xa2d8('0x18')]);}_0x1311a0[_0xa2d8('0x30')]=qs[_0xa2d8('0x31')](_0x4f5622[_0xa2d8('0x2a')]['sort']);_0x1311a0[_0xa2d8('0x32')]=qs[_0xa2d8('0x2b')](_[_0xa2d8('0x33')](_0x4f5622[_0xa2d8('0x2a')],_0x387428['filters']),_0x4f6871);if(_0x4f5622[_0xa2d8('0x2a')][_0xa2d8('0x34')]){_0x1311a0[_0xa2d8('0x32')]=_['merge'](_0x1311a0[_0xa2d8('0x32')],{'$or':_['map'](_0x4f6871,function(_0x39c98a){if(_0x39c98a['type']!=='VIRTUAL'){var _0x2b323d={};_0x2b323d[_0x39c98a[_0xa2d8('0x23')]]={'$like':'%'+_0x4f5622[_0xa2d8('0x2a')][_0xa2d8('0x34')]+'%'};return _0x2b323d;}})});}_0x1311a0=_[_0xa2d8('0x35')]({},_0x1311a0,_0x4f5622[_0xa2d8('0x36')]);var _0xb0539e={'where':_0x1311a0[_0xa2d8('0x32')]};return db[_0xa2d8('0x26')][_0xa2d8('0x1b')](_0xb0539e)['then'](function(_0x149429){_0x4c9106[_0xa2d8('0x1b')]=_0x149429;if(_0x4f5622[_0xa2d8('0x2a')][_0xa2d8('0x37')]){_0x1311a0[_0xa2d8('0x38')]=[{'all':!![]}];}return db['OpenchannelApplication'][_0xa2d8('0x39')](_0x1311a0);})['then'](function(_0x39a565){_0x4c9106[_0xa2d8('0x3a')]=_0x39a565;return _0x4c9106;})[_0xa2d8('0x20')](respondWithFilteredResult(_0x16b702,_0x1311a0))[_0xa2d8('0x3b')](handleError(_0x16b702,null));};exports[_0xa2d8('0x3c')]=function(_0x591b1d,_0x45c612){var _0x129c37={'raw':!![],'where':{'id':_0x591b1d[_0xa2d8('0x3d')]['id']}},_0x3dac71={};_0x3dac71['model']=_[_0xa2d8('0x3e')](db[_0xa2d8('0x26')][_0xa2d8('0x27')]);_0x3dac71[_0xa2d8('0x2a')]=_[_0xa2d8('0x3e')](_0x591b1d[_0xa2d8('0x2a')]);_0x3dac71['filters']=_[_0xa2d8('0x2e')](_0x3dac71[_0xa2d8('0x2c')],_0x3dac71[_0xa2d8('0x2a')]);_0x129c37[_0xa2d8('0x2d')]=_[_0xa2d8('0x2e')](_0x3dac71[_0xa2d8('0x2c')],qs['fields'](_0x591b1d[_0xa2d8('0x2a')][_0xa2d8('0x2f')]));_0x129c37[_0xa2d8('0x2d')]=_0x129c37[_0xa2d8('0x2d')][_0xa2d8('0x3f')]?_0x129c37[_0xa2d8('0x2d')]:_0x3dac71['model'];if(_0x591b1d[_0xa2d8('0x2a')][_0xa2d8('0x37')]){_0x129c37['include']=[{'all':!![]}];}_0x129c37=_[_0xa2d8('0x35')]({},_0x129c37,_0x591b1d[_0xa2d8('0x36')]);return db['OpenchannelApplication'][_0xa2d8('0x40')](_0x129c37)[_0xa2d8('0x20')](handleEntityNotFound(_0x45c612,null))[_0xa2d8('0x20')](respondWithResult(_0x45c612,null))[_0xa2d8('0x3b')](handleError(_0x45c612,null));};exports[_0xa2d8('0x41')]=function(_0x533300,_0x4da02c){return db[_0xa2d8('0x26')][_0xa2d8('0x41')](_0x533300[_0xa2d8('0x42')],{})[_0xa2d8('0x20')](respondWithResult(_0x4da02c,0xc9))[_0xa2d8('0x3b')](handleError(_0x4da02c,null));};exports[_0xa2d8('0x1f')]=function(_0x49f5ff,_0xc42297){if(_0x49f5ff['body']['id']){delete _0x49f5ff[_0xa2d8('0x42')]['id'];}return db['OpenchannelApplication']['find']({'where':{'id':_0x49f5ff['params']['id']}})['then'](handleEntityNotFound(_0xc42297,null))[_0xa2d8('0x20')](saveUpdates(_0x49f5ff[_0xa2d8('0x42')],null))[_0xa2d8('0x20')](respondWithResult(_0xc42297,null))[_0xa2d8('0x3b')](handleError(_0xc42297,null));};exports[_0xa2d8('0x21')]=function(_0x1b6a32,_0x2428d8){return db[_0xa2d8('0x26')][_0xa2d8('0x40')]({'where':{'id':_0x1b6a32[_0xa2d8('0x3d')]['id']}})[_0xa2d8('0x20')](handleEntityNotFound(_0x2428d8,null))[_0xa2d8('0x20')](removeEntity(_0x2428d8,null))[_0xa2d8('0x3b')](handleError(_0x2428d8,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 8ed4c10..2d29a3e 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 _0x6d78=['bluebird','rimraf','../../config/environment','./openchannelApplication.attributes','exports','OpenchannelApplication','openchannel_applications','utf8mb4','lodash','util','../../config/logger','moment'];(function(_0x1a36a5,_0x746928){var _0x746243=function(_0x481966){while(--_0x481966){_0x1a36a5['push'](_0x1a36a5['shift']());}};_0x746243(++_0x746928);}(_0x6d78,0xd4));var _0x86d7=function(_0x5d9179,_0x55a8b5){_0x5d9179=_0x5d9179-0x0;var _0x1d2141=_0x6d78[_0x5d9179];return _0x1d2141;};'use strict';var _=require(_0x86d7('0x0'));var util=require(_0x86d7('0x1'));var logger=require(_0x86d7('0x2'))('api');var moment=require(_0x86d7('0x3'));var BPromise=require(_0x86d7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x86d7('0x5'));var config=require(_0x86d7('0x6'));var attributes=require(_0x86d7('0x7'));module[_0x86d7('0x8')]=function(_0x2b6c17,_0x556f3f){return _0x2b6c17['define'](_0x86d7('0x9'),attributes,{'tableName':_0x86d7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x86d7('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xbe4d=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelApplication.attributes','exports','define','OpenchannelApplication','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xbe4d,0xad));var _0xdbe4=function(_0x14dfb7,_0x1fc019){_0x14dfb7=_0x14dfb7-0x0;var _0x5b9373=_0xbe4d[_0x14dfb7];return _0x5b9373;};'use strict';var _=require('lodash');var util=require(_0xdbe4('0x0'));var logger=require(_0xdbe4('0x1'))(_0xdbe4('0x2'));var moment=require(_0xdbe4('0x3'));var BPromise=require(_0xdbe4('0x4'));var rp=require(_0xdbe4('0x5'));var fs=require('fs');var path=require(_0xdbe4('0x6'));var rimraf=require(_0xdbe4('0x7'));var config=require(_0xdbe4('0x8'));var attributes=require(_0xdbe4('0x9'));module[_0xdbe4('0xa')]=function(_0xf52379,_0x55bf92){return _0xf52379[_0xdbe4('0xb')](_0xdbe4('0xc'),attributes,{'tableName':_0xdbe4('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xdbe4('0xe'),'collate':_0xdbe4('0xf')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 3d8b913..5bc5752 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 _0xae2e=['result','UpdateOpenchannelApplication','update','options','raw','where','attributes','limit','debug','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','OpenchannelApplication,\x20%s,\x20%s','message'];(function(_0x68ee8b,_0x3cc6c5){var _0x5148f7=function(_0x5dcbd5){while(--_0x5dcbd5){_0x68ee8b['push'](_0x68ee8b['shift']());}};_0x5148f7(++_0x3cc6c5);}(_0xae2e,0x190));var _0xeae2=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xae2e[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0xeae2('0x0'));var util=require(_0xeae2('0x1'));var moment=require(_0xeae2('0x2'));var BPromise=require(_0xeae2('0x3'));var rs=require(_0xeae2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xeae2('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xeae2('0x6'))(_0xeae2('0x7'));var config=require(_0xeae2('0x8'));var jayson=require(_0xeae2('0x9'));var client=jayson[_0xeae2('0xa')][_0xeae2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5ddd62,_0x2c9ac5,_0x2d40c9){return new BPromise(function(_0x4136ed,_0x326ba7){return client['request'](_0x5ddd62,_0x2d40c9)[_0xeae2('0xc')](function(_0x250471){logger[_0xeae2('0xd')]('OpenchannelApplication,\x20%s,\x20%s',_0x2c9ac5,_0xeae2('0xe'));logger['debug'](_0xeae2('0xf'),_0x2c9ac5,_0xeae2('0xe'),JSON[_0xeae2('0x10')](_0x250471));if(_0x250471['error']){if(_0x250471[_0xeae2('0x11')]['code']===0x1f4){logger['error'](_0xeae2('0x12'),_0x2c9ac5,_0x250471[_0xeae2('0x11')][_0xeae2('0x13')]);return _0x326ba7(_0x250471[_0xeae2('0x11')][_0xeae2('0x13')]);}logger[_0xeae2('0x11')](_0xeae2('0x12'),_0x2c9ac5,_0x250471[_0xeae2('0x11')][_0xeae2('0x13')]);return _0x4136ed(_0x250471[_0xeae2('0x11')][_0xeae2('0x13')]);}else{logger[_0xeae2('0xd')](_0xeae2('0x12'),_0x2c9ac5,_0xeae2('0xe'));_0x4136ed(_0x250471[_0xeae2('0x14')][_0xeae2('0x13')]);}})['catch'](function(_0x452942){logger['error']('OpenchannelApplication,\x20%s,\x20%s',_0x2c9ac5,_0x452942);_0x326ba7(_0x452942);});});}exports[_0xeae2('0x15')]=function(_0x2e166a){var _0x56a52a=this;return new Promise(function(_0x30ef33,_0x4773f6){return db['OpenchannelApplication'][_0xeae2('0x16')](_0x2e166a['body'],{'raw':_0x2e166a[_0xeae2('0x17')]?_0x2e166a['options'][_0xeae2('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2e166a['options']?_0x2e166a[_0xeae2('0x17')][_0xeae2('0x19')]||null:null,'attributes':_0x2e166a[_0xeae2('0x17')]?_0x2e166a['options'][_0xeae2('0x1a')]||null:null,'limit':_0x2e166a['options']?_0x2e166a['options'][_0xeae2('0x1b')]||null:null})[_0xeae2('0xc')](function(_0xc36b94){logger[_0xeae2('0xd')](_0xeae2('0x15'),_0x2e166a);logger[_0xeae2('0x1c')](_0xeae2('0x15'),_0x2e166a,JSON[_0xeae2('0x10')](_0xc36b94));_0x30ef33(_0xc36b94);})[_0xeae2('0x1d')](function(_0x351a34){logger[_0xeae2('0x11')](_0xeae2('0x15'),_0x351a34[_0xeae2('0x13')],_0x2e166a);_0x4773f6(_0x56a52a['error'](0x1f4,_0x351a34[_0xeae2('0x13')]));});});}; \ No newline at end of file +var _0xebe6=['body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','request','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateOpenchannelApplication','OpenchannelApplication'];(function(_0x2f7c40,_0xb36203){var _0x57a4a5=function(_0x47db35){while(--_0x47db35){_0x2f7c40['push'](_0x2f7c40['shift']());}};_0x57a4a5(++_0xb36203);}(_0xebe6,0x1f0));var _0x6ebe=function(_0x46891a,_0x3e3051){_0x46891a=_0x46891a-0x0;var _0x4c578d=_0xebe6[_0x46891a];return _0x4c578d;};'use strict';var _=require(_0x6ebe('0x0'));var util=require(_0x6ebe('0x1'));var moment=require(_0x6ebe('0x2'));var BPromise=require(_0x6ebe('0x3'));var rs=require(_0x6ebe('0x4'));var fs=require('fs');var Redis=require(_0x6ebe('0x5'));var db=require(_0x6ebe('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x6ebe('0x7'))('rpc');var config=require(_0x6ebe('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x6ebe('0x9')][_0x6ebe('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4517f1,_0x4ef648,_0x1ba205){return new BPromise(function(_0x589951,_0x545140){return client[_0x6ebe('0xb')](_0x4517f1,_0x1ba205)[_0x6ebe('0xc')](function(_0xfd2ba3){logger[_0x6ebe('0xd')](_0x6ebe('0xe'),_0x4ef648,_0x6ebe('0xf'));logger[_0x6ebe('0x10')](_0x6ebe('0x11'),_0x4ef648,_0x6ebe('0xf'),JSON[_0x6ebe('0x12')](_0xfd2ba3));if(_0xfd2ba3[_0x6ebe('0x13')]){if(_0xfd2ba3[_0x6ebe('0x13')][_0x6ebe('0x14')]===0x1f4){logger['error'](_0x6ebe('0xe'),_0x4ef648,_0xfd2ba3[_0x6ebe('0x13')][_0x6ebe('0x15')]);return _0x545140(_0xfd2ba3[_0x6ebe('0x13')][_0x6ebe('0x15')]);}logger[_0x6ebe('0x13')](_0x6ebe('0xe'),_0x4ef648,_0xfd2ba3[_0x6ebe('0x13')][_0x6ebe('0x15')]);return _0x589951(_0xfd2ba3['error']['message']);}else{logger['info']('OpenchannelApplication,\x20%s,\x20%s',_0x4ef648,'request\x20sent');_0x589951(_0xfd2ba3[_0x6ebe('0x16')][_0x6ebe('0x15')]);}})[_0x6ebe('0x17')](function(_0x1fcb45){logger[_0x6ebe('0x13')](_0x6ebe('0xe'),_0x4ef648,_0x1fcb45);_0x545140(_0x1fcb45);});});}exports[_0x6ebe('0x18')]=function(_0x26bab4){var _0xc3b801=this;return new Promise(function(_0x4fc253,_0x438798){return db[_0x6ebe('0x19')]['update'](_0x26bab4[_0x6ebe('0x1a')],{'raw':_0x26bab4[_0x6ebe('0x1b')]?_0x26bab4[_0x6ebe('0x1b')][_0x6ebe('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x26bab4[_0x6ebe('0x1b')]?_0x26bab4['options']['where']||null:null,'attributes':_0x26bab4[_0x6ebe('0x1b')]?_0x26bab4[_0x6ebe('0x1b')]['attributes']||null:null,'limit':_0x26bab4['options']?_0x26bab4[_0x6ebe('0x1b')]['limit']||null:null})['then'](function(_0x2ce4fb){logger['info']('UpdateOpenchannelApplication',_0x26bab4);logger[_0x6ebe('0x10')](_0x6ebe('0x18'),_0x26bab4,JSON[_0x6ebe('0x12')](_0x2ce4fb));_0x4fc253(_0x2ce4fb);})[_0x6ebe('0x17')](function(_0x16ee58){logger[_0x6ebe('0x13')](_0x6ebe('0x18'),_0x16ee58[_0x6ebe('0x15')],_0x26bab4);_0x438798(_0xc3b801[_0x6ebe('0x13')](0x1f4,_0x16ee58['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 0e3d868..54808d9 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 _0x8fb5=['./openchannelInteraction.controller','get','isAuthenticated','index','show','/:id/messages','/:id/download','download','create','post','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','addTags','put','openchannelinteraction:update','delete','/:id','destroy','removeTags','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x613ebf,_0x14e555){var _0x1a37aa=function(_0x54bc87){while(--_0x54bc87){_0x613ebf['push'](_0x613ebf['shift']());}};_0x1a37aa(++_0x14e555);}(_0x8fb5,0x91));var _0x58fb=function(_0x1dfc98,_0x3264e9){_0x1dfc98=_0x1dfc98-0x0;var _0x57430f=_0x8fb5[_0x1dfc98];return _0x57430f;};'use strict';var multer=require(_0x58fb('0x0'));var util=require(_0x58fb('0x1'));var path=require(_0x58fb('0x2'));var timeout=require(_0x58fb('0x3'));var express=require(_0x58fb('0x4'));var router=express[_0x58fb('0x5')]();var fs_extra=require(_0x58fb('0x6'));var auth=require(_0x58fb('0x7'));var interaction=require(_0x58fb('0x8'));var config=require(_0x58fb('0x9'));var controller=require(_0x58fb('0xa'));router[_0x58fb('0xb')]('/',auth[_0x58fb('0xc')](),controller[_0x58fb('0xd')]);router[_0x58fb('0xb')]('/describe',auth[_0x58fb('0xc')](),controller['describe']);router[_0x58fb('0xb')]('/:id',auth[_0x58fb('0xc')](),controller[_0x58fb('0xe')]);router[_0x58fb('0xb')](_0x58fb('0xf'),auth[_0x58fb('0xc')](),controller['getMessages']);router[_0x58fb('0xb')](_0x58fb('0x10'),auth[_0x58fb('0xc')](),controller[_0x58fb('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0x58fb('0x12')]);router[_0x58fb('0x13')](_0x58fb('0xf'),auth[_0x58fb('0xc')](),controller['addMessage']);router[_0x58fb('0x13')](_0x58fb('0x14'),auth[_0x58fb('0xc')](),interaction[_0x58fb('0x15')](_0x58fb('0x16'),_0x58fb('0x17')),controller[_0x58fb('0x18')]);router[_0x58fb('0x19')]('/:id',auth[_0x58fb('0xc')](),interaction['tracked'](_0x58fb('0x16'),_0x58fb('0x1a')),controller['update']);router[_0x58fb('0x1b')](_0x58fb('0x1c'),auth[_0x58fb('0xc')](),interaction[_0x58fb('0x15')](_0x58fb('0x16'),'openchannelinteraction:destroy'),controller[_0x58fb('0x1d')]);router['delete'](_0x58fb('0x14'),auth[_0x58fb('0xc')](),controller[_0x58fb('0x1e')]);module['exports']=router; \ No newline at end of file +var _0x5f00=['post','/:id/tags','tracked','openchannelinteraction:addtags','put','update','delete','/:id','openchannel','openchannelinteraction:destroy','destroy','removeTags','util','path','express','fs-extra','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','/describe','show','/:id/messages','getMessages','/:id/download','download'];(function(_0x1b5c09,_0x4acc27){var _0x148081=function(_0x3251b2){while(--_0x3251b2){_0x1b5c09['push'](_0x1b5c09['shift']());}};_0x148081(++_0x4acc27);}(_0x5f00,0x186));var _0x05f0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5f00[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x05f0('0x0'));var path=require(_0x05f0('0x1'));var timeout=require('connect-timeout');var express=require(_0x05f0('0x2'));var router=express['Router']();var fs_extra=require(_0x05f0('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x05f0('0x4'));var config=require(_0x05f0('0x5'));var controller=require(_0x05f0('0x6'));router[_0x05f0('0x7')]('/',auth[_0x05f0('0x8')](),controller['index']);router[_0x05f0('0x7')](_0x05f0('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0x05f0('0x7')]('/:id',auth[_0x05f0('0x8')](),controller[_0x05f0('0xa')]);router[_0x05f0('0x7')](_0x05f0('0xb'),auth[_0x05f0('0x8')](),controller[_0x05f0('0xc')]);router['get'](_0x05f0('0xd'),auth[_0x05f0('0x8')](),controller[_0x05f0('0xe')]);router[_0x05f0('0xf')]('/',auth[_0x05f0('0x8')](),controller['create']);router[_0x05f0('0xf')](_0x05f0('0xb'),auth[_0x05f0('0x8')](),controller['addMessage']);router[_0x05f0('0xf')](_0x05f0('0x10'),auth[_0x05f0('0x8')](),interaction[_0x05f0('0x11')]('openchannel',_0x05f0('0x12')),controller['addTags']);router[_0x05f0('0x13')]('/:id',auth[_0x05f0('0x8')](),interaction['tracked']('openchannel','openchannelinteraction:update'),controller[_0x05f0('0x14')]);router[_0x05f0('0x15')](_0x05f0('0x16'),auth[_0x05f0('0x8')](),interaction[_0x05f0('0x11')](_0x05f0('0x17'),_0x05f0('0x18')),controller[_0x05f0('0x19')]);router[_0x05f0('0x15')](_0x05f0('0x10'),auth[_0x05f0('0x8')](),controller[_0x05f0('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 8a35566..5cf1375 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 _0xabe8=['sequelize','exports','BOOLEAN','STRING','DATE','ENUM','out'];(function(_0x1d5da7,_0x33d1b8){var _0x183bd4=function(_0x480b23){while(--_0x480b23){_0x1d5da7['push'](_0x1d5da7['shift']());}};_0x183bd4(++_0x33d1b8);}(_0xabe8,0x8c));var _0x8abe=function(_0x4f9bee,_0x52d982){_0x4f9bee=_0x4f9bee-0x0;var _0x44924f=_0xabe8[_0x4f9bee];return _0x44924f;};'use strict';var Sequelize=require(_0x8abe('0x0'));module[_0x8abe('0x1')]={'closed':{'type':Sequelize[_0x8abe('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x8abe('0x3')]},'secondDisposition':{'type':Sequelize[_0x8abe('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x8abe('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize[_0x8abe('0x3')]},'externalUrl':{'type':Sequelize[_0x8abe('0x3')]},'lastMsgAt':{'type':Sequelize[_0x8abe('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x8abe('0x5')]('in',_0x8abe('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xecd9=['DATE','STRING','ENUM','out','sequelize','exports','BOOLEAN'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xecd9,0x13f));var _0x9ecd=function(_0x34d14d,_0x48cfff){_0x34d14d=_0x34d14d-0x0;var _0x33c5b2=_0xecd9[_0x34d14d];return _0x33c5b2;};'use strict';var Sequelize=require(_0x9ecd('0x0'));module[_0x9ecd('0x1')]={'closed':{'type':Sequelize[_0x9ecd('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x9ecd('0x3')]},'disposition':{'type':Sequelize[_0x9ecd('0x4')]},'secondDisposition':{'type':Sequelize[_0x9ecd('0x4')]},'thirdDisposition':{'type':Sequelize[_0x9ecd('0x4')]},'note':{'type':Sequelize[_0x9ecd('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize[_0x9ecd('0x4')]},'externalUrl':{'type':Sequelize[_0x9ecd('0x4')]},'lastMsgAt':{'type':Sequelize[_0x9ecd('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x9ecd('0x5')]('in',_0x9ecd('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']},'autoreplyExecuted':{'type':Sequelize[_0x9ecd('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 7ca03a5..a293920 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 _0x1d92=['ui.OpenchannelInteractionId','user_has_openchannel_interactions','left_join','users','u.id\x20=\x20ui.UserId','from','openchannel_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','length','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','Tag','forEach','union','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','type','start','body','buildExpression','some','compact','isEmpty','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','QueryTypes','clone','t.id\x20IN\x20?','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','sequelize','toString','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','Account.key','a.mandatoryDisposition','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','Contact.firstName','Contact.lastName','Contact.email','c.phone','Contact.phone','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','ui.OpenchannelInteractionId\x20IN\x20?','all','rows','options','create','destroy','params','describe','addMessage','omit','ids','getMessages','findOne','OpenchannelMessage','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','spread','emit','removeTags','download','unix','join','root','server','files','transcript-%d-%s.zip','User','firstName','lastName','attachments','Attachment','Messages','direction','secret','OpenchannelAccount','get','mkdirSync','Openchannel','Account','N.A.','closedAt','disposition','threadId','Public','Private','basename','createWriteStream','out','System','views','transcript-','.pdf','createPdfFromHTML','log','unlinkSync','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','ejs','fs-extra','squel','crypto','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/license/util','redis','socket.io-emitter','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','stack','name','send','Users','fullname','TagIds','Tags','split','push','catch','waiting','talking','answered','total','closed','UserId','index','map','OpenchannelInteraction','rawAttributes','fieldName','key','model','keys','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','select','field','u.id'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x1d92,0x9a));var _0x21d9=function(_0x402125,_0x3546a9){_0x402125=_0x402125-0x0;var _0x183c8b=_0x1d92[_0x402125];return _0x183c8b;};'use strict';var emlformat=require(_0x21d9('0x0'));var rimraf=require(_0x21d9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x21d9('0x2'));var rp=require(_0x21d9('0x3'));var moment=require('moment');var BPromise=require(_0x21d9('0x4'));var Mustache=require(_0x21d9('0x5'));var util=require(_0x21d9('0x6'));var path=require(_0x21d9('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x21d9('0x8'));var fs=require('fs');var fs_extra=require(_0x21d9('0x9'));var _=require('lodash');var squel=require(_0x21d9('0xa'));var crypto=require(_0x21d9('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x21d9('0xc'));var querystring=require(_0x21d9('0xd'));var Papa=require('papaparse');var Redis=require(_0x21d9('0xe'));var authService=require(_0x21d9('0xf'));var qs=require(_0x21d9('0x10'));var as=require(_0x21d9('0x11'));var pdf=require(_0x21d9('0x12'));var hardwareService=require(_0x21d9('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x21d9('0x14'));var db=require('../../mysqldb')['db'];config[_0x21d9('0x15')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x21d9('0x16'))(new Redis(config[_0x21d9('0x15')]));require('./openchannelInteraction.socket')['register'](socket);function respondWithStatusCode(_0xb33b65,_0x547251){_0x547251=_0x547251||0xcc;return function(_0x1cecff){if(_0x1cecff){return _0xb33b65[_0x21d9('0x17')](_0x547251);}return _0xb33b65[_0x21d9('0x18')](_0x547251)[_0x21d9('0x19')]();};}function respondWithResult(_0x1fe285,_0x393840){_0x393840=_0x393840||0xc8;return function(_0x3ba0c6){if(_0x3ba0c6){return _0x1fe285[_0x21d9('0x18')](_0x393840)[_0x21d9('0x1a')](_0x3ba0c6);}};}function respondWithFilteredResult(_0x2aa263,_0xa57e19){return function(_0xa02446){if(_0xa02446){var _0x2fe46c=typeof _0xa57e19[_0x21d9('0x1b')]===_0x21d9('0x1c')&&typeof _0xa57e19[_0x21d9('0x1d')]===_0x21d9('0x1c');var _0x63662b=_0xa02446[_0x21d9('0x1e')];var _0x1bff8e=_0x2fe46c?0x0:_0xa57e19[_0x21d9('0x1b')];var _0x802f5b=_0x2fe46c?_0xa02446[_0x21d9('0x1e')]:_0xa57e19['offset']+_0xa57e19[_0x21d9('0x1d')];var _0x4eec98;if(_0x802f5b>=_0x63662b){_0x802f5b=_0x63662b;_0x4eec98=0xc8;}else{_0x4eec98=0xce;}_0x2aa263[_0x21d9('0x18')](_0x4eec98);return _0x2aa263[_0x21d9('0x1f')](_0x21d9('0x20'),_0x1bff8e+'-'+_0x802f5b+'/'+_0x63662b)[_0x21d9('0x1a')](_0xa02446);}return null;};}function patchUpdates(_0x10efea){return function(_0x11d1f6){try{jsonpatch[_0x21d9('0x21')](_0x11d1f6,_0x10efea,!![]);}catch(_0xa80751){return BPromise['reject'](_0xa80751);}return _0x11d1f6[_0x21d9('0x22')]();};}function saveUpdates(_0x1de86b,_0x5e8051){return function(_0x505f57){if(_0x505f57){return _0x505f57[_0x21d9('0x23')](_0x1de86b)['then'](function(_0x2218b4){return _0x2218b4;});}return null;};}function removeEntity(_0x53cc15,_0x20c225){return function(_0x34d9d1){if(_0x34d9d1){return _0x34d9d1['destroy']()[_0x21d9('0x24')](function(){_0x53cc15['status'](0xcc)[_0x21d9('0x19')]();});}};}function handleEntityNotFound(_0x2e815c,_0x507bfc){return function(_0xecb669){if(!_0xecb669){_0x2e815c['sendStatus'](0x194);}return _0xecb669;};}function handleError(_0x6fdc9d,_0x29eb13){_0x29eb13=_0x29eb13||0x1f4;return function(_0x8c9a4a){logger['error'](_0x8c9a4a[_0x21d9('0x25')]);if(_0x8c9a4a['name']){delete _0x8c9a4a[_0x21d9('0x26')];}_0x6fdc9d[_0x21d9('0x18')](_0x29eb13)[_0x21d9('0x27')](_0x8c9a4a);};}function getInteractionUsers(_0x1a937c,_0x595169){return new BPromise(function(_0xeaf7e0,_0x331fc4){try{if(_0x595169[_0x1a937c['id']]){_0x1a937c[_0x21d9('0x28')]=_['map'](_0x595169[_0x1a937c['id']],function(_0x53cb4c){return{'id':_0x53cb4c['id'],'fullname':_0x53cb4c[_0x21d9('0x29')]};});}}catch(_0x1727d2){_0x331fc4(_0x1727d2);}_0xeaf7e0(_0x1a937c);});}function getInteractionTags(_0x1cbfce,_0x4eebff){return new BPromise(function(_0x2d4f94,_0x3f2319){try{if(_0x1cbfce[_0x21d9('0x2a')]){_0x1cbfce[_0x21d9('0x2b')]=[];_0x1cbfce[_0x21d9('0x2a')][_0x21d9('0x2c')](',')['forEach'](function(_0x217ab0){_0x1cbfce[_0x21d9('0x2b')][_0x21d9('0x2d')](_0x4eebff[_0x217ab0]);});}delete _0x1cbfce[_0x21d9('0x2a')];}catch(_0x1fe530){_0x3f2319(_0x1fe530);}_0x2d4f94(_0x1cbfce);});}function updateOpenchannelInteraction(_0x577008,_0x395762,_0xf6cf91){return new BPromise(function(_0x53d040,_0x1ef0c6){return getInteractionUsers(_0x577008,_0xf6cf91)['then'](function(_0x4d0226){return getInteractionTags(_0x4d0226,_0x395762);})['then'](function(_0x368811){return getStateInteraction(_0x368811);})['then'](function(_0x533c42){_0x53d040(_0x533c42);})[_0x21d9('0x2e')](function(_0x416a19){_0x1ef0c6(_0x416a19);});});}function getStateInteraction(_0x1eed15){return new BPromise(function(_0x2824e0){_0x1eed15[_0x21d9('0x2f')]=0x0;_0x1eed15[_0x21d9('0x30')]=0x0;_0x1eed15[_0x21d9('0x31')]=0x0;_0x1eed15['unmanaged']=0x0;_0x1eed15[_0x21d9('0x32')]=0x0;if(!_0x1eed15[_0x21d9('0x33')]&&!_0x1eed15['UserId']){_0x1eed15[_0x21d9('0x2f')]+=0x1;}if(!_0x1eed15['closed']&&_0x1eed15[_0x21d9('0x34')]){_0x1eed15[_0x21d9('0x30')]+=0x1;if(_0x1eed15[_0x21d9('0x2f')]){_0x1eed15[_0x21d9('0x2f')]-=0x1;}}if(_0x1eed15[_0x21d9('0x33')]&&_0x1eed15['UserId']){_0x1eed15[_0x21d9('0x31')]+=0x1;if(_0x1eed15[_0x21d9('0x30')]){_0x1eed15[_0x21d9('0x30')]-=0x1;}}if(_0x1eed15[_0x21d9('0x33')]&&!_0x1eed15[_0x21d9('0x34')]){_0x1eed15['unmanaged']+=0x1;if(_0x1eed15['waiting']){_0x1eed15['waiting']-=0x1;}}_0x1eed15['total']+=0x1;_0x2824e0(_0x1eed15);});}exports[_0x21d9('0x35')]=function(_0x2d915a,_0x285cb7){var _0x48ac43={},_0xeca65f={},_0x3aa661={'count':0x0,'rows':[]};var _0x56eca2=_[_0x21d9('0x36')](db[_0x21d9('0x37')][_0x21d9('0x38')],function(_0x2574ed){return{'name':_0x2574ed[_0x21d9('0x39')],'type':_0x2574ed['type'][_0x21d9('0x3a')]};});_0xeca65f[_0x21d9('0x3b')]=_['map'](_0x56eca2,_0x21d9('0x26'));_0xeca65f['query']=_[_0x21d9('0x3c')](_0x2d915a['query']);_0xeca65f[_0x21d9('0x3d')]=_[_0x21d9('0x3e')](_0xeca65f[_0x21d9('0x3b')],_0xeca65f[_0x21d9('0x3f')]);_0x48ac43[_0x21d9('0x40')]=_[_0x21d9('0x3e')](_0xeca65f['model'],qs[_0x21d9('0x41')](_0x2d915a['query'][_0x21d9('0x41')]));_0x48ac43[_0x21d9('0x40')]=_0x48ac43['attributes']['length']?_0x48ac43[_0x21d9('0x40')]:_0xeca65f['model'];if(!_0x2d915a[_0x21d9('0x3f')][_0x21d9('0x42')](_0x21d9('0x43'))){_0x48ac43[_0x21d9('0x1d')]=qs[_0x21d9('0x1d')](_0x2d915a['query'][_0x21d9('0x1d')]);_0x48ac43['offset']=qs[_0x21d9('0x1b')](_0x2d915a[_0x21d9('0x3f')]['offset']);}_0x48ac43[_0x21d9('0x44')]=qs[_0x21d9('0x45')](_0x2d915a[_0x21d9('0x3f')][_0x21d9('0x45')]);_0x48ac43[_0x21d9('0x46')]=qs['filters'](_[_0x21d9('0x47')](_0x2d915a[_0x21d9('0x3f')],_0xeca65f[_0x21d9('0x3d')]),_0x56eca2);var _0x24176f=[];var _0x53fb7f=squel[_0x21d9('0x48')]()[_0x21d9('0x49')]('id')['field'](_0x21d9('0x26'))[_0x21d9('0x49')]('color')['from']('tools_tags');var _0x4ade62=squel[_0x21d9('0x48')]()[_0x21d9('0x49')](_0x21d9('0x4a'))[_0x21d9('0x49')]('u.fullname')[_0x21d9('0x49')](_0x21d9('0x4b'))['from'](_0x21d9('0x4c'),'ui')[_0x21d9('0x4d')](_0x21d9('0x4e'),'u',_0x21d9('0x4f'));var _0x11d7f3=squel[_0x21d9('0x48')]()[_0x21d9('0x50')](_0x21d9('0x51'),'i')['left_join'](_0x21d9('0x52'),'c',_0x21d9('0x53'))['left_join']('users','o','o.id\x20=\x20i.UserId')['left_join']('openchannel_accounts','a',_0x21d9('0x54'))[_0x21d9('0x4d')](_0x21d9('0x55'),'me',_0x21d9('0x56'))[_0x21d9('0x4d')](_0x21d9('0x57'),'it',_0x21d9('0x58'))['left_join'](_0x21d9('0x59'),'t',_0x21d9('0x5a'));var _0x47dfd6=squel[_0x21d9('0x5b')]();var _0x59b8be=[];var _0x316a64=squel[_0x21d9('0x5b')]();var _0x5cc49f;if(_0x2d915a['query'][_0x21d9('0x5c')]){_0x5cc49f=as[_0x21d9('0x5d')](_0x2d915a[_0x21d9('0x3f')]['search']);var _0x17380b=_0x5cc49f[_0x21d9('0x5e')];for(var _0x5b059b=0x0;_0x5b059b<_0x5cc49f[_0x21d9('0x5f')][_0x21d9('0x60')];_0x5b059b++){var _0x4b40a3=_0x5cc49f[_0x21d9('0x5f')][_0x5b059b];var _0xaca8e8='i';var _0x27ba59=_[_0x21d9('0x61')](_0x56eca2,['name',_0x4b40a3['field']]);if(!_0x27ba59){switch(_0x4b40a3[_0x21d9('0x49')]){case _0x21d9('0x62'):if(_0x4b40a3[_0x21d9('0x63')]==0x1){_0x11d7f3[_0x21d9('0x64')]('`'+_0x4b40a3['field']+_0x21d9('0x65'));}else{_0x11d7f3[_0x21d9('0x64')]('`'+_0x4b40a3[_0x21d9('0x49')]+_0x21d9('0x66'));}break;case _0x21d9('0x67'):if(_0x4b40a3[_0x21d9('0x68')]==='$substring'){if(_0x4b40a3[_0x21d9('0x63')][_0x21d9('0x2c')]('\x20')[_0x21d9('0x60')]>0x1){_0x47dfd6[_0x17380b](_0x21d9('0x69'),qs[_0x21d9('0x6a')](_0x4b40a3['value']),null);}else{var _0x4aa671='%'+_0x4b40a3[_0x21d9('0x63')]+'%';_0x47dfd6[_0x17380b](_0x21d9('0x6b'),_0x4aa671,_0x4aa671,_0x4aa671);}}else{_0x27ba59=_['find'](_0x56eca2,['name','ContactId']);_0x4b40a3['field']=_0x21d9('0x6c');_0x156b6d=as['buildExpression'](_0xaca8e8,_0x27ba59['type'],_0x4b40a3);_0x47dfd6[_0x17380b](_0x156b6d[_0x21d9('0x6d')],_0x156b6d['value']['start'],_0x156b6d[_0x21d9('0x63')][_0x21d9('0x19')]);}break;case _0x21d9('0x6e'):var _0x2eba86=_0x4b40a3[_0x21d9('0x63')]['split'](',')[_0x21d9('0x36')](function(_0x8b516d){return Number(_0x8b516d);});_0x2eba86[_0x21d9('0x6f')](function(_0x3f9a6f){_0x316a64['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x3f9a6f+',%');});_0x59b8be=_[_0x21d9('0x70')](_0x59b8be,_0x2eba86);break;case'User':if(_0x4b40a3[_0x21d9('0x68')]===_0x21d9('0x71')){_0x47dfd6[_0x17380b](_0x21d9('0x72'),'%'+_0x4b40a3[_0x21d9('0x63')]+'%',null);}else{_0x27ba59=_[_0x21d9('0x61')](_0x56eca2,[_0x21d9('0x26'),_0x21d9('0x34')]);_0x4b40a3['field']=_0x21d9('0x34');_0x156b6d=as['buildExpression'](_0xaca8e8,_0x27ba59[_0x21d9('0x73')],_0x4b40a3);_0x47dfd6[_0x17380b](_0x156b6d[_0x21d9('0x6d')],_0x156b6d[_0x21d9('0x63')][_0x21d9('0x74')],_0x156b6d[_0x21d9('0x63')][_0x21d9('0x19')]);}break;case _0x21d9('0x75'):_0x156b6d=as[_0x21d9('0x76')]('me',null,_0x4b40a3);_0x47dfd6[_0x17380b](_0x156b6d[_0x21d9('0x6d')],_0x156b6d[_0x21d9('0x63')]['start'],_0x156b6d['value'][_0x21d9('0x19')]);break;}}else{var _0x156b6d=as['buildExpression'](_0xaca8e8,_0x27ba59['type'],_0x4b40a3);_0x47dfd6[_0x17380b](_0x156b6d[_0x21d9('0x6d')],_0x156b6d['value'][_0x21d9('0x74')],_0x156b6d[_0x21d9('0x63')][_0x21d9('0x19')]);}}}else{var _0x3f3935=_(_0x2d915a[_0x21d9('0x3f')])[_0x21d9('0x3c')]()[_0x21d9('0x36')](function(_0x3375fe){return _[_0x21d9('0x77')](_0x56eca2,[_0x21d9('0x26'),_0x3375fe])?_0x3375fe:undefined;})[_0x21d9('0x78')]()[_0x21d9('0x63')]();if(!_[_0x21d9('0x79')](_0x3f3935)){_0x3f3935[_0x21d9('0x6f')](function(_0x507aa2){if(_0x507aa2===_0x21d9('0x7a')){_0x11d7f3[_0x21d9('0x46')](_0x21d9('0x7b'),[][_0x21d9('0x7c')](_0x2d915a[_0x21d9('0x3f')][_0x507aa2]));}else if(_0x507aa2===_0x21d9('0x7d')){var _0x1a9a43=JSON['parse'](_0x2d915a[_0x21d9('0x3f')][_0x507aa2])[_0x21d9('0x7e')];var _0x560c71=JSON['parse'](_0x2d915a[_0x21d9('0x3f')][_0x507aa2])['$lte'];_0x11d7f3[_0x21d9('0x46')](_0x21d9('0x7f'),_0x1a9a43,_0x560c71);}else{if(_0x2d915a[_0x21d9('0x3f')][_0x507aa2]===_0x21d9('0x80')){_0x11d7f3[_0x21d9('0x46')]('i.'+_0x507aa2+'\x20IS\x20NULL');}else{_0x11d7f3[_0x21d9('0x46')]('i.'+_0x507aa2+_0x21d9('0x81'),_0x2d915a['query'][_0x507aa2]);}}});}if(_0x2d915a[_0x21d9('0x3f')][_0x21d9('0x82')]){if(_0x2d915a['query'][_0x21d9('0x82')]==0x1){_0x11d7f3['having'](_0x21d9('0x83'));}else{_0x11d7f3[_0x21d9('0x64')](_0x21d9('0x84'));}}if(_0x2d915a['query'][_0x21d9('0x85')]){_0x59b8be=_['isArray'](_0x2d915a[_0x21d9('0x3f')][_0x21d9('0x85')])?_0x2d915a[_0x21d9('0x3f')][_0x21d9('0x85')]:new Array(_0x2d915a[_0x21d9('0x3f')]['tag']);_0x59b8be[_0x21d9('0x6f')](function(_0x495222){_0x316a64['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x495222+',%');});}if(_0x2d915a[_0x21d9('0x3f')][_0x21d9('0x86')]){var _0x230295=_0x2d915a['query'][_0x21d9('0x86')][_0x21d9('0x87')]('\x5c','\x5c\x5c')[_0x21d9('0x87')](/'/g,'\x27\x27');if(qs[_0x21d9('0x88')](_0x230295)){_0x47dfd6['or'](_0x21d9('0x89'),_0x230295+'%');}else{_0x47dfd6['or'](_0x21d9('0x8a'),qs[_0x21d9('0x6a')](_0x230295))['or'](_0x21d9('0x8b'),_0x230295+'%')['or'](_0x21d9('0x8c'),_0x230295+'%');}}}_0x11d7f3['where'](_0x47dfd6);_0x11d7f3['group'](_0x21d9('0x8d'));var _0x5c8abc={'type':db[_0x21d9('0x8e')][_0x21d9('0x8f')]['SELECT'],'raw':!![]};var _0x359e79=_0x11d7f3[_0x21d9('0x90')]();_0x359e79[_0x21d9('0x49')](_0x21d9('0x8d'));_0x359e79['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');if(_0x48ac43[_0x21d9('0x44')]){_0x48ac43[_0x21d9('0x44')][_0x21d9('0x6f')](function(_0x3f922a){var _0x3fe0e6=_0x3f922a[0x0]==='contactName'?_0x3f922a[0x0]:'i.'+_0x3f922a[0x0];_0x11d7f3['order'](_0x3fe0e6,_0x3f922a[0x1]==='DESC'?![]:!![]);});}if(!_[_0x21d9('0x79')](_0x59b8be)){_0x11d7f3[_0x21d9('0x64')](_0x316a64);_0x359e79[_0x21d9('0x46')](_0x21d9('0x91'),_0x59b8be);}BPromise['resolve']()[_0x21d9('0x24')](function(){if(!_0x5cc49f){if(_0x2d915a[_0x21d9('0x3f')]['OpenchannelAccountId'])return;_0x359e79[_0x21d9('0x46')](_0x21d9('0x92'));_0x11d7f3[_0x21d9('0x46')]('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x2d915a[_0x21d9('0x93')][_0x21d9('0x94')]!==_0x21d9('0x95'))return;return _0x2d915a[_0x21d9('0x93')][_0x21d9('0x96')]({'attributes':['id'],'raw':!![]})[_0x21d9('0x24')](function(_0xe326ce){if(_['isEmpty'](_0xe326ce)){_0x359e79['where'](_0x21d9('0x97'));_0x11d7f3[_0x21d9('0x46')](_0x21d9('0x97'));}else{_0x359e79[_0x21d9('0x46')](_0x21d9('0x7b'),_['map'](_0xe326ce,'id'));_0x11d7f3[_0x21d9('0x46')](_0x21d9('0x7b'),_[_0x21d9('0x36')](_0xe326ce,'id'));}});})[_0x21d9('0x24')](function(){if(_0x2d915a[_0x21d9('0x93')][_0x21d9('0x94')]===_0x21d9('0x95')&&!_0x5cc49f&&!_0x2d915a[_0x21d9('0x3f')]['OpenchannelAccountId'])return[];return db[_0x21d9('0x98')]['query'](_0x359e79[_0x21d9('0x99')](),_0x5c8abc);})[_0x21d9('0x24')](function(_0x29df49){_0x3aa661[_0x21d9('0x1e')]=_0x29df49[_0x21d9('0x60')];if(_0x3aa661['count']===0x0)return[];return db[_0x21d9('0x98')][_0x21d9('0x3f')](_0x53fb7f['toString'](),_0x5c8abc)['then'](function(_0x1f86a1){_0x24176f=_['keyBy'](_0x1f86a1,'id');_0x5c8abc=_[_0x21d9('0x9a')](_0x5c8abc,{'model':db[_0x21d9('0x37')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2d915a['query'][_0x21d9('0x41')]){_0x48ac43[_0x21d9('0x40')][_0x21d9('0x6f')](function(_0x36cb88){_0x11d7f3[_0x21d9('0x49')]('i.'+_0x36cb88);});}else{_0x11d7f3[_0x21d9('0x49')](_0x21d9('0x9b'),'unreadMessages');_0x11d7f3[_0x21d9('0x49')]('a.key',_0x21d9('0x9c'));_0x11d7f3[_0x21d9('0x49')](_0x21d9('0x9d'),'Account.mandatoryDisposition');_0x11d7f3[_0x21d9('0x49')](_0x21d9('0x9e'),_0x21d9('0x9f'));_0x11d7f3[_0x21d9('0x49')]('i.*');_0x11d7f3['field']('c.firstName',_0x21d9('0xa0'));_0x11d7f3['field']('c.lastName',_0x21d9('0xa1'));_0x11d7f3[_0x21d9('0x49')]('c.email',_0x21d9('0xa2'));_0x11d7f3[_0x21d9('0x49')](_0x21d9('0xa3'),_0x21d9('0xa4'));_0x11d7f3[_0x21d9('0x49')]('c.mobile',_0x21d9('0xa5'));_0x11d7f3['field'](_0x21d9('0xa6'),_0x21d9('0xa7'));_0x11d7f3[_0x21d9('0x49')](_0x21d9('0xa8'),_0x21d9('0xa9'));_0x11d7f3[_0x21d9('0x49')](_0x21d9('0xaa'),_0x21d9('0xab'));_0x11d7f3[_0x21d9('0x49')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x21d9('0x2a'));}if(_0x48ac43[_0x21d9('0x1d')])_0x11d7f3[_0x21d9('0x1d')](_0x48ac43[_0x21d9('0x1d')]);if(_0x48ac43[_0x21d9('0x1b')])_0x11d7f3[_0x21d9('0x1b')](_0x48ac43[_0x21d9('0x1b')]);return db['sequelize'][_0x21d9('0x3f')](_0x11d7f3['toString'](),_0x5c8abc);})[_0x21d9('0x24')](function(_0x17bc36){if(_0x17bc36[_0x21d9('0x60')]>0x0)_0x4ade62[_0x21d9('0x46')](_0x21d9('0xac'),_['map'](_0x17bc36,'id'));return db['sequelize']['query'](_0x4ade62[_0x21d9('0x99')](),_0x5c8abc)[_0x21d9('0x24')](function(_0x38d2e4){var _0x923bb6=_['groupBy'](_0x38d2e4,'OpenchannelInteractionId');var _0x1ea022=[];_0x17bc36['forEach'](function(_0x5d79cd){_0x1ea022[_0x21d9('0x2d')](updateOpenchannelInteraction(_0x5d79cd,_0x24176f,_0x923bb6));});return BPromise[_0x21d9('0xad')](_0x1ea022);});});})[_0x21d9('0x24')](function(_0x3bbf93){_0x3aa661[_0x21d9('0xae')]=_0x3bbf93;return _0x3aa661;})['then'](respondWithFilteredResult(_0x285cb7,_0x48ac43))['catch'](handleError(_0x285cb7,null));};exports['show']=function(_0x4d8656,_0x480892){var _0x378867={};if(_0x4d8656[_0x21d9('0x3f')][_0x21d9('0x73')]&&_0x4d8656[_0x21d9('0x3f')][_0x21d9('0x73')]===_0x21d9('0x50')){_0x378867[_0x21d9('0x50')]=_0x4d8656['params']['id'];}else{_0x378867['id']=_0x4d8656['params']['id'];}var _0x4f3dfe={'raw':![],'where':_0x378867},_0x230443={};_0x230443['model']=_[_0x21d9('0x3c')](db[_0x21d9('0x37')][_0x21d9('0x38')]);_0x230443[_0x21d9('0x3f')]=_['keys'](_0x4d8656[_0x21d9('0x3f')]);_0x230443['filters']=_['intersection'](_0x230443[_0x21d9('0x3b')],_0x230443[_0x21d9('0x3f')]);_0x4f3dfe[_0x21d9('0x40')]=_[_0x21d9('0x3e')](_0x230443[_0x21d9('0x3b')],qs[_0x21d9('0x41')](_0x4d8656[_0x21d9('0x3f')][_0x21d9('0x41')]));_0x4f3dfe['attributes']=_0x4f3dfe['attributes'][_0x21d9('0x60')]?_0x4f3dfe[_0x21d9('0x40')]:_0x230443[_0x21d9('0x3b')];if(_0x4d8656['query']['includeAll']){_0x4f3dfe['include']=[{'all':!![]}];}_0x4f3dfe=_['merge']({},_0x4f3dfe,_0x4d8656[_0x21d9('0xaf')]);return db[_0x21d9('0x37')][_0x21d9('0x61')](_0x4f3dfe)[_0x21d9('0x24')](handleEntityNotFound(_0x480892,null))['then'](respondWithResult(_0x480892,null))[_0x21d9('0x2e')](handleError(_0x480892,null));};exports[_0x21d9('0xb0')]=function(_0x19e36f,_0x5200a1){return db[_0x21d9('0x37')][_0x21d9('0xb0')](_0x19e36f[_0x21d9('0x75')],{})[_0x21d9('0x24')](respondWithResult(_0x5200a1,0xc9))[_0x21d9('0x2e')](handleError(_0x5200a1,null));};exports[_0x21d9('0x23')]=function(_0x390c90,_0x1eb3b9){if(_0x390c90[_0x21d9('0x75')]['id']){delete _0x390c90[_0x21d9('0x75')]['id'];}return db['OpenchannelInteraction']['find']({'where':{'id':_0x390c90['params']['id']}})[_0x21d9('0x24')](handleEntityNotFound(_0x1eb3b9,null))[_0x21d9('0x24')](saveUpdates(_0x390c90[_0x21d9('0x75')],null))[_0x21d9('0x24')](respondWithResult(_0x1eb3b9,null))[_0x21d9('0x2e')](handleError(_0x1eb3b9,null));};exports[_0x21d9('0xb1')]=function(_0x560191,_0x5be64f){return db[_0x21d9('0x37')]['find']({'where':{'id':_0x560191[_0x21d9('0xb2')]['id']}})[_0x21d9('0x24')](handleEntityNotFound(_0x5be64f,null))['then'](removeEntity(_0x5be64f,null))[_0x21d9('0x2e')](handleError(_0x5be64f,null));};exports[_0x21d9('0xb3')]=function(_0x9409ef,_0x42e2c9){return db[_0x21d9('0x37')][_0x21d9('0xb3')]()[_0x21d9('0x24')](respondWithResult(_0x42e2c9,null))[_0x21d9('0x2e')](handleError(_0x42e2c9,null));};exports[_0x21d9('0xb4')]=function(_0x3a544d,_0x3b891d,_0x16411e){return db['OpenchannelMessage']['find']({'where':{'id':_0x3a544d['params']['id']}})[_0x21d9('0x24')](handleEntityNotFound(_0x3b891d,null))[_0x21d9('0x24')](function(_0x434bf1){if(_0x434bf1){return _0x434bf1[_0x21d9('0xb4')](_0x3a544d[_0x21d9('0x75')]['ids'],_[_0x21d9('0xb5')](_0x3a544d[_0x21d9('0x75')],[_0x21d9('0xb6'),'id'])||{});}})['then'](respondWithResult(_0x3b891d,null))[_0x21d9('0x2e')](handleError(_0x3b891d,null));};exports[_0x21d9('0xb7')]=function(_0x5aeceb,_0xf719db,_0x3aadca){var _0x5160f3={'raw':![],'where':{}};var _0x251d07={};var _0x39d96a={'count':0x0,'rows':[]};return db[_0x21d9('0x37')][_0x21d9('0xb8')]({'where':{'id':_0x5aeceb[_0x21d9('0xb2')]['id']}})[_0x21d9('0x24')](handleEntityNotFound(_0xf719db,null))[_0x21d9('0x24')](function(_0x49a03c){if(_0x49a03c){_0x251d07['model']=_['keys'](db[_0x21d9('0xb9')][_0x21d9('0x38')]);_0x251d07[_0x21d9('0x3f')]=_['keys'](_0x5aeceb['query']);_0x251d07[_0x21d9('0x3d')]=_[_0x21d9('0x3e')](_0x251d07[_0x21d9('0x3b')],_0x251d07['query']);_0x5160f3['attributes']=_['intersection'](_0x251d07[_0x21d9('0x3b')],qs[_0x21d9('0x41')](_0x5aeceb[_0x21d9('0x3f')]['fields']));_0x5160f3['attributes']=_0x5160f3[_0x21d9('0x40')][_0x21d9('0x60')]?_0x5160f3['attributes']:_0x251d07[_0x21d9('0x3b')];if(!_0x5aeceb['query'][_0x21d9('0x42')]('nolimit')){_0x5160f3[_0x21d9('0x1d')]=qs[_0x21d9('0x1d')](_0x5aeceb[_0x21d9('0x3f')][_0x21d9('0x1d')]);_0x5160f3[_0x21d9('0x1b')]=qs[_0x21d9('0x1b')](_0x5aeceb[_0x21d9('0x3f')]['offset']);}_0x5160f3[_0x21d9('0x44')]=qs[_0x21d9('0x45')](_0x5aeceb[_0x21d9('0x3f')][_0x21d9('0x45')]);_0x5160f3['where']=qs[_0x21d9('0x3d')](_[_0x21d9('0x47')](_0x5aeceb[_0x21d9('0x3f')],_0x251d07[_0x21d9('0x3d')]));_0x5160f3[_0x21d9('0x46')]['OpenchannelInteractionId']=_0x49a03c['id'];if(_0x5aeceb[_0x21d9('0x3f')][_0x21d9('0x86')]){_0x5160f3['where']=_[_0x21d9('0x9a')](_0x5160f3['where'],{'$or':_[_0x21d9('0x36')](_0x5160f3[_0x21d9('0x40')],function(_0x6ba596){var _0x4675a9={};_0x4675a9[_0x6ba596]={'$like':'%'+_0x5aeceb['query']['filter']+'%'};return _0x4675a9;})});}if(_0x5aeceb['query'][_0x21d9('0x7e')]){var _0x4cf3b1=_0x5aeceb['query'][_0x21d9('0x7e')][_0x21d9('0x2c')](',');var _0x4f540f={};_0x4f540f[_0x4cf3b1[0x0]]={'$gte':moment(_0x4cf3b1[0x1])[_0x21d9('0xba')](_0x21d9('0xbb'))};_0x5160f3[_0x21d9('0x46')]=_[_0x21d9('0x9a')](_0x5160f3[_0x21d9('0x46')],_0x4f540f);}_0x5160f3=_[_0x21d9('0x9a')]({},_0x5160f3,_0x5aeceb[_0x21d9('0xaf')]);return db[_0x21d9('0xb9')][_0x21d9('0x1e')]({'where':_0x5160f3['where']})[_0x21d9('0x24')](function(_0x52659c){_0x39d96a['count']=_0x52659c;if(_0x5aeceb[_0x21d9('0x3f')]['includeAll']){_0x5160f3['include']=[{'all':!![]}];}return db[_0x21d9('0xb9')][_0x21d9('0xbc')](_0x5160f3);})[_0x21d9('0x24')](function(_0x31237b){_0x39d96a[_0x21d9('0xae')]=_0x31237b;return _0x39d96a;});}})[_0x21d9('0x24')](respondWithFilteredResult(_0xf719db,_0x5160f3))[_0x21d9('0x2e')](handleError(_0xf719db,null));};exports[_0x21d9('0xbd')]=function(_0x43a30d,_0x1af019,_0x344458){return db[_0x21d9('0x37')][_0x21d9('0x61')]({'where':{'id':_0x43a30d[_0x21d9('0xb2')]['id']}})[_0x21d9('0x24')](handleEntityNotFound(_0x1af019,null))[_0x21d9('0x24')](function(_0x5eaaf5){if(_0x5eaaf5){return _0x5eaaf5['setTags'](_0x43a30d[_0x21d9('0x75')][_0x21d9('0xb6')],_[_0x21d9('0xb5')](_0x43a30d[_0x21d9('0x75')],[_0x21d9('0xb6'),'id'])||{})[_0x21d9('0xbe')](function(){return db['Tag'][_0x21d9('0xbc')]({'attributes':['id',_0x21d9('0x26'),'color'],'where':{'id':_0x43a30d['body'][_0x21d9('0xb6')]}});})[_0x21d9('0x24')](function(_0x2b7e7b){socket[_0x21d9('0xbf')]('openchannelInteractionTags:save',{'id':Number(_0x43a30d[_0x21d9('0xb2')]['id']),'tags':_0x2b7e7b||[]});return{'id':Number(_0x43a30d['params']['id']),'tags':_0x2b7e7b||[]};});}})[_0x21d9('0x24')](respondWithResult(_0x1af019,null))['catch'](handleError(_0x1af019,null));};exports['removeTags']=function(_0x4a35e7,_0xa862c8,_0x490e71){return db[_0x21d9('0x37')][_0x21d9('0x61')]({'where':{'id':_0x4a35e7[_0x21d9('0xb2')]['id']}})['then'](handleEntityNotFound(_0xa862c8,null))[_0x21d9('0x24')](function(_0x7bd763){if(_0x7bd763){return _0x7bd763[_0x21d9('0xc0')](_0x4a35e7[_0x21d9('0x3f')][_0x21d9('0xb6')]);}})[_0x21d9('0x24')](respondWithStatusCode(_0xa862c8,null))[_0x21d9('0x2e')](handleError(_0xa862c8,null));};exports[_0x21d9('0xc1')]=function(_0x74fb19,_0x4d2bed){var _0x3eb03b=moment()[_0x21d9('0xc2')]()[_0x21d9('0x99')]();var _0x4799f3=path[_0x21d9('0xc3')](config[_0x21d9('0xc4')],_0x21d9('0xc5'),_0x21d9('0xc6'),'tmp');var _0x1e0b66=path[_0x21d9('0xc3')](config[_0x21d9('0xc4')],_0x21d9('0xc5'),'files','attachments');var _0x5633ab=path['join'](_0x4799f3,_0x3eb03b);var _0x283c9f=util[_0x21d9('0xba')](_0x21d9('0xc7'),_0x74fb19[_0x21d9('0xb2')]['id'],_0x3eb03b);var _0x4d7a0b=path[_0x21d9('0xc3')](_0x4799f3,_0x283c9f);var _0x33fd93=[];_0x33fd93[_0x21d9('0x2d')]({'model':db[_0x21d9('0xc8')],'as':_0x21d9('0xc8'),'attributes':['id',_0x21d9('0x29')],'raw':!![]});_0x33fd93[_0x21d9('0x2d')]({'model':db['CmContact'],'as':'Contact','attributes':['id',_0x21d9('0xc9'),_0x21d9('0xca')],'raw':!![]});if(_0x74fb19[_0x21d9('0x3f')][_0x21d9('0xcb')]){_0x33fd93[_0x21d9('0x2d')]({'model':db[_0x21d9('0xcc')],'as':'Attachment','raw':!![]});}var _0x512211=[{'model':db[_0x21d9('0xb9')],'as':_0x21d9('0xcd'),'attributes':['id',_0x21d9('0x75'),_0x21d9('0x7d'),_0x21d9('0xce'),_0x21d9('0xcf'),_0x21d9('0x82')],'include':_0x33fd93}];_0x512211[_0x21d9('0x2d')]({'model':db[_0x21d9('0xd0')],'as':'Account','attributes':['id',_0x21d9('0x26')]});_0x512211[_0x21d9('0x2d')]({'model':db[_0x21d9('0xc8')],'as':'Owner','attributes':['id','fullname']});return db['OpenchannelInteraction']['find']({'where':{'id':_0x74fb19[_0x21d9('0xb2')]['id']},'include':_0x512211})[_0x21d9('0x24')](handleEntityNotFound(_0x4d2bed,null))[_0x21d9('0x24')](function(_0xd8a25){if(_0xd8a25){var _0x2d5cd0=_0xd8a25[_0x21d9('0xd1')]({'plain':!![]});fs[_0x21d9('0xd2')](_0x5633ab);var _0x2505c6={'channel':_0x21d9('0xd3'),'account':_0x2d5cd0[_0x21d9('0xd4')][_0x21d9('0x26')],'agent':_0x2d5cd0['Owner']?_0x2d5cd0['Owner'][_0x21d9('0x29')]:_0x21d9('0xd5'),'createdAt':moment(_0x2d5cd0[_0x21d9('0x7d')])[_0x21d9('0xba')](_0x21d9('0xbb'))[_0x21d9('0x99')](),'closedAt':_0x2d5cd0[_0x21d9('0x33')]?moment(_0x2d5cd0[_0x21d9('0xd6')])['format'](_0x21d9('0xbb'))[_0x21d9('0x99')]():'','disposition':_0x2d5cd0[_0x21d9('0xd7')],'visibility':_0x2d5cd0[_0x21d9('0xd8')]?_0x21d9('0xd9'):_0x21d9('0xda'),'messages':_(_0x2d5cd0[_0x21d9('0xcd')])[_0x21d9('0x86')]({'secret':![]})[_0x21d9('0x36')](function(_0x5a0d13){if(_0x5a0d13['Attachment']){var _0x1e83af=path['join'](_0x1e0b66,_0x5a0d13['Attachment'][_0x21d9('0xdb')]);if(fs['existsSync'](_0x1e83af)){fs['createReadStream'](_0x1e83af)['pipe'](fs[_0x21d9('0xdc')](path[_0x21d9('0xc3')](_0x5633ab,_0x5a0d13['Attachment'][_0x21d9('0xdb')])));}}return{'date':moment(_0x5a0d13[_0x21d9('0x7d')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x21d9('0x99')](),'sender':_0x5a0d13[_0x21d9('0xce')]===_0x21d9('0xdd')?_0x5a0d13['User']?_0x5a0d13[_0x21d9('0xc8')][_0x21d9('0x29')]:_0x21d9('0xde'):_0x5a0d13['Contact'][_0x21d9('0xc9')]+(_0x5a0d13[_0x21d9('0x67')]['lastName']?'\x20'+_0x5a0d13['Contact']['lastName']:''),'body':_0x5a0d13[_0x21d9('0xcc')]?_0x5a0d13['Attachment'][_0x21d9('0xdb')]:_0x5a0d13['body'],'direction':_0x5a0d13[_0x21d9('0xce')]===_0x21d9('0xdd')?'A':'C','secret':_0x5a0d13[_0x21d9('0xcf')],'read':_0x5a0d13[_0x21d9('0x82')],'attachment':_0x5a0d13[_0x21d9('0xcc')]};})[_0x21d9('0x63')]()};return ejs['renderFile'](path[_0x21d9('0xc3')](config[_0x21d9('0xc4')],'server',_0x21d9('0xdf'),'downloadInteraction.ejs'),{'interaction':_0x2505c6})[_0x21d9('0x24')](function(_0x5454a0){var _0x1a8de3=path['join'](_0x5633ab,_0x21d9('0xe0')+_0x2d5cd0['id']+'-'+_0x3eb03b+_0x21d9('0xe1'));var _0x280bee={'path':_0x1a8de3,'channel':'Openchannel','interactionId':_0x2d5cd0['id']};return pdf[_0x21d9('0xe2')](_0x5454a0,_0x280bee);})['then'](function(){return new BPromise(function(_0x2a3a1f,_0x1a814f){zipdir(_0x5633ab,{'saveTo':_0x4d7a0b},function(_0x8bb7c2,_0x160ce4){if(_0x8bb7c2)return _0x1a814f(_0x8bb7c2);return _0x2a3a1f(_0x160ce4);});})['then'](function(){return new BPromise(function(_0x2ddb06,_0x52bdad){rimraf(_0x5633ab,function(_0x3c3c67){if(_0x3c3c67)_0x52bdad(_0x3c3c67);return _0x2ddb06();});});})[_0x21d9('0x24')](function(){return _0x4d2bed[_0x21d9('0xc1')](_0x4d7a0b,_0x283c9f,function(_0x2b93d0){if(_0x2b93d0){console[_0x21d9('0xe3')]('err',_0x2b93d0);}else{fs[_0x21d9('0xe4')](_0x4d7a0b);}});});});}else{return _0x4d2bed['sendStatus'](0xc8);}})[_0x21d9('0x2e')](handleError(_0x4d2bed,null));}; \ No newline at end of file +var _0x2a15=['value','having','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','start','end','Tag','split','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','type','buildExpression','some','compact','isEmpty','parse','$gte','$lte','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','t.id\x20IN\x20?','resolve','OpenchannelAccountId','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','role','agent','user','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','i.OpenchannelAccountId\x20IN\x20?','sequelize','toString','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','Contact.lastName','c.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','push','all','rows','catch','show','params','intersection','includeAll','include','options','create','body','update','destroy','describe','addMessage','ids','omit','getMessages','OpenchannelMessage','OpenchannelInteractionId','YYYY-MM-DD\x20HH:mm:ss','addTags','setTags','spread','findAll','openchannelInteractionTags:save','removeTags','download','unix','join','root','files','tmp','server','attachments','format','transcript-%d-%s.zip','User','CmContact','lastName','Attachment','Messages','createdAt','secret','Account','Owner','get','mkdirSync','N.A.','closedAt','disposition','threadId','Public','Private','basename','pipe','createWriteStream','direction','System','firstName','out','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','Openchannel','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','json','offset','limit','count','set','Content-Range','apply','reject','save','then','error','stack','name','send','Users','map','fullname','TagIds','Tags','waiting','talking','UserId','closed','answered','OpenchannelInteraction','rawAttributes','fieldName','key','model','query','keys','filters','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','from','tools_tags','u.fullname','user_has_openchannel_interactions','left_join','users','u.id\x20=\x20ui.UserId','openchannel_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages'];(function(_0xa905bb,_0x554951){var _0x1a79ed=function(_0x29b944){while(--_0x29b944){_0xa905bb['push'](_0xa905bb['shift']());}};_0x1a79ed(++_0x554951);}(_0x2a15,0x96));var _0x52a1=function(_0x115c1d,_0x21c2e9){_0x115c1d=_0x115c1d-0x0;var _0x1b0bc7=_0x2a15[_0x115c1d];return _0x1b0bc7;};'use strict';var emlformat=require(_0x52a1('0x0'));var rimraf=require(_0x52a1('0x1'));var zipdir=require(_0x52a1('0x2'));var jsonpatch=require(_0x52a1('0x3'));var rp=require('request-promise');var moment=require(_0x52a1('0x4'));var BPromise=require(_0x52a1('0x5'));var Mustache=require('mustache');var util=require(_0x52a1('0x6'));var path=require(_0x52a1('0x7'));var sox=require('sox');var csv=require(_0x52a1('0x8'));var ejs=require(_0x52a1('0x9'));var fs=require('fs');var fs_extra=require(_0x52a1('0xa'));var _=require(_0x52a1('0xb'));var squel=require(_0x52a1('0xc'));var crypto=require(_0x52a1('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x52a1('0xe'));var toCsv=require(_0x52a1('0x8'));var querystring=require(_0x52a1('0xf'));var Papa=require(_0x52a1('0x10'));var Redis=require(_0x52a1('0x11'));var authService=require(_0x52a1('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x52a1('0x13'));var pdf=require(_0x52a1('0x14'));var hardwareService=require(_0x52a1('0x15'));var logger=require(_0x52a1('0x16'))(_0x52a1('0x17'));var utils=require(_0x52a1('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x52a1('0x19'));var db=require(_0x52a1('0x1a'))['db'];config[_0x52a1('0x1b')]=_[_0x52a1('0x1c')](config['redis'],{'host':_0x52a1('0x1d'),'port':0x18eb});var socket=require(_0x52a1('0x1e'))(new Redis(config[_0x52a1('0x1b')]));require(_0x52a1('0x1f'))[_0x52a1('0x20')](socket);function respondWithStatusCode(_0x5511bc,_0x1e5a8b){_0x1e5a8b=_0x1e5a8b||0xcc;return function(_0x4d2051){if(_0x4d2051){return _0x5511bc[_0x52a1('0x21')](_0x1e5a8b);}return _0x5511bc[_0x52a1('0x22')](_0x1e5a8b)['end']();};}function respondWithResult(_0x2d1efb,_0x36bd86){_0x36bd86=_0x36bd86||0xc8;return function(_0x5240ac){if(_0x5240ac){return _0x2d1efb[_0x52a1('0x22')](_0x36bd86)[_0x52a1('0x23')](_0x5240ac);}};}function respondWithFilteredResult(_0x314406,_0x249184){return function(_0x145d54){if(_0x145d54){var _0x45df8e=typeof _0x249184[_0x52a1('0x24')]==='undefined'&&typeof _0x249184[_0x52a1('0x25')]==='undefined';var _0x3f8d52=_0x145d54[_0x52a1('0x26')];var _0x399c9b=_0x45df8e?0x0:_0x249184[_0x52a1('0x24')];var _0x5ea749=_0x45df8e?_0x145d54['count']:_0x249184[_0x52a1('0x24')]+_0x249184[_0x52a1('0x25')];var _0x39a57d;if(_0x5ea749>=_0x3f8d52){_0x5ea749=_0x3f8d52;_0x39a57d=0xc8;}else{_0x39a57d=0xce;}_0x314406[_0x52a1('0x22')](_0x39a57d);return _0x314406[_0x52a1('0x27')](_0x52a1('0x28'),_0x399c9b+'-'+_0x5ea749+'/'+_0x3f8d52)[_0x52a1('0x23')](_0x145d54);}return null;};}function patchUpdates(_0x56dd3f){return function(_0x4efbe0){try{jsonpatch[_0x52a1('0x29')](_0x4efbe0,_0x56dd3f,!![]);}catch(_0x52a5fd){return BPromise[_0x52a1('0x2a')](_0x52a5fd);}return _0x4efbe0[_0x52a1('0x2b')]();};}function saveUpdates(_0x18e412,_0x1a23c6){return function(_0xb85e44){if(_0xb85e44){return _0xb85e44['update'](_0x18e412)[_0x52a1('0x2c')](function(_0x12ceae){return _0x12ceae;});}return null;};}function removeEntity(_0xa01c38,_0x133dab){return function(_0x3f2aaf){if(_0x3f2aaf){return _0x3f2aaf['destroy']()['then'](function(){_0xa01c38[_0x52a1('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1440f4,_0x5ce7c6){return function(_0x58b4ee){if(!_0x58b4ee){_0x1440f4['sendStatus'](0x194);}return _0x58b4ee;};}function handleError(_0x4d8960,_0x4730c0){_0x4730c0=_0x4730c0||0x1f4;return function(_0x100bb9){logger[_0x52a1('0x2d')](_0x100bb9[_0x52a1('0x2e')]);if(_0x100bb9[_0x52a1('0x2f')]){delete _0x100bb9['name'];}_0x4d8960[_0x52a1('0x22')](_0x4730c0)[_0x52a1('0x30')](_0x100bb9);};}function getInteractionUsers(_0x41a6fd,_0x5a7fec){return new BPromise(function(_0x1f0415,_0x2c594f){try{if(_0x5a7fec[_0x41a6fd['id']]){_0x41a6fd[_0x52a1('0x31')]=_[_0x52a1('0x32')](_0x5a7fec[_0x41a6fd['id']],function(_0x3b3207){return{'id':_0x3b3207['id'],'fullname':_0x3b3207[_0x52a1('0x33')]};});}}catch(_0xc7b4ae){_0x2c594f(_0xc7b4ae);}_0x1f0415(_0x41a6fd);});}function getInteractionTags(_0xcd0e4a,_0x4ea472){return new BPromise(function(_0x497194,_0x41ba16){try{if(_0xcd0e4a[_0x52a1('0x34')]){_0xcd0e4a[_0x52a1('0x35')]=[];_0xcd0e4a['TagIds']['split'](',')['forEach'](function(_0x2aeaa3){_0xcd0e4a['Tags']['push'](_0x4ea472[_0x2aeaa3]);});}delete _0xcd0e4a[_0x52a1('0x34')];}catch(_0x344939){_0x41ba16(_0x344939);}_0x497194(_0xcd0e4a);});}function updateOpenchannelInteraction(_0xa502dd,_0x570da6,_0x7d7c46){return new BPromise(function(_0x5bef44,_0x579dfc){return getInteractionUsers(_0xa502dd,_0x7d7c46)[_0x52a1('0x2c')](function(_0x513ad2){return getInteractionTags(_0x513ad2,_0x570da6);})[_0x52a1('0x2c')](function(_0x4090bd){return getStateInteraction(_0x4090bd);})[_0x52a1('0x2c')](function(_0x4fc8f8){_0x5bef44(_0x4fc8f8);})['catch'](function(_0x4638ea){_0x579dfc(_0x4638ea);});});}function getStateInteraction(_0x31abf6){return new BPromise(function(_0x51d35d){_0x31abf6[_0x52a1('0x36')]=0x0;_0x31abf6[_0x52a1('0x37')]=0x0;_0x31abf6['answered']=0x0;_0x31abf6['unmanaged']=0x0;_0x31abf6['total']=0x0;if(!_0x31abf6['closed']&&!_0x31abf6[_0x52a1('0x38')]){_0x31abf6[_0x52a1('0x36')]+=0x1;}if(!_0x31abf6[_0x52a1('0x39')]&&_0x31abf6[_0x52a1('0x38')]){_0x31abf6[_0x52a1('0x37')]+=0x1;if(_0x31abf6['waiting']){_0x31abf6[_0x52a1('0x36')]-=0x1;}}if(_0x31abf6[_0x52a1('0x39')]&&_0x31abf6[_0x52a1('0x38')]){_0x31abf6[_0x52a1('0x3a')]+=0x1;if(_0x31abf6[_0x52a1('0x37')]){_0x31abf6[_0x52a1('0x37')]-=0x1;}}if(_0x31abf6[_0x52a1('0x39')]&&!_0x31abf6['UserId']){_0x31abf6['unmanaged']+=0x1;if(_0x31abf6[_0x52a1('0x36')]){_0x31abf6[_0x52a1('0x36')]-=0x1;}}_0x31abf6['total']+=0x1;_0x51d35d(_0x31abf6);});}exports['index']=function(_0x4338e8,_0x8522fd){var _0x3d5477={},_0x3259af={},_0xc901c8={'count':0x0,'rows':[]};var _0x2f3393=_['map'](db[_0x52a1('0x3b')][_0x52a1('0x3c')],function(_0x1da5b6){return{'name':_0x1da5b6[_0x52a1('0x3d')],'type':_0x1da5b6['type'][_0x52a1('0x3e')]};});_0x3259af[_0x52a1('0x3f')]=_['map'](_0x2f3393,_0x52a1('0x2f'));_0x3259af[_0x52a1('0x40')]=_[_0x52a1('0x41')](_0x4338e8[_0x52a1('0x40')]);_0x3259af[_0x52a1('0x42')]=_['intersection'](_0x3259af['model'],_0x3259af[_0x52a1('0x40')]);_0x3d5477['attributes']=_['intersection'](_0x3259af[_0x52a1('0x3f')],qs[_0x52a1('0x43')](_0x4338e8['query'][_0x52a1('0x43')]));_0x3d5477[_0x52a1('0x44')]=_0x3d5477['attributes'][_0x52a1('0x45')]?_0x3d5477[_0x52a1('0x44')]:_0x3259af[_0x52a1('0x3f')];if(!_0x4338e8[_0x52a1('0x40')][_0x52a1('0x46')](_0x52a1('0x47'))){_0x3d5477[_0x52a1('0x25')]=qs[_0x52a1('0x25')](_0x4338e8[_0x52a1('0x40')]['limit']);_0x3d5477['offset']=qs[_0x52a1('0x24')](_0x4338e8[_0x52a1('0x40')][_0x52a1('0x24')]);}_0x3d5477[_0x52a1('0x48')]=qs[_0x52a1('0x49')](_0x4338e8[_0x52a1('0x40')][_0x52a1('0x49')]);_0x3d5477[_0x52a1('0x4a')]=qs['filters'](_[_0x52a1('0x4b')](_0x4338e8[_0x52a1('0x40')],_0x3259af[_0x52a1('0x42')]),_0x2f3393);var _0x22d85b=[];var _0x2ad034=squel[_0x52a1('0x4c')]()[_0x52a1('0x4d')]('id')[_0x52a1('0x4d')](_0x52a1('0x2f'))['field'](_0x52a1('0x4e'))[_0x52a1('0x4f')](_0x52a1('0x50'));var _0x3b41f8=squel['select']()[_0x52a1('0x4d')]('u.id')[_0x52a1('0x4d')](_0x52a1('0x51'))[_0x52a1('0x4d')]('ui.OpenchannelInteractionId')['from'](_0x52a1('0x52'),'ui')[_0x52a1('0x53')](_0x52a1('0x54'),'u',_0x52a1('0x55'));var _0xea5968=squel[_0x52a1('0x4c')]()['from'](_0x52a1('0x56'),'i')[_0x52a1('0x53')](_0x52a1('0x57'),'c',_0x52a1('0x58'))['left_join']('users','o',_0x52a1('0x59'))[_0x52a1('0x53')](_0x52a1('0x5a'),'a',_0x52a1('0x5b'))[_0x52a1('0x53')]('openchannel_messages','me','me.OpenchannelInteractionId\x20=\x20i.id')[_0x52a1('0x53')](_0x52a1('0x5c'),'it',_0x52a1('0x5d'))[_0x52a1('0x53')](_0x52a1('0x50'),'t',_0x52a1('0x5e'));var _0x24a492=squel[_0x52a1('0x5f')]();var _0x2c5e45=[];var _0x2a028e=squel[_0x52a1('0x5f')]();var _0x24b853;if(_0x4338e8[_0x52a1('0x40')][_0x52a1('0x60')]){_0x24b853=as[_0x52a1('0x61')](_0x4338e8['query'][_0x52a1('0x60')]);var _0x1bf25c=_0x24b853[_0x52a1('0x62')];for(var _0xa88f03=0x0;_0xa88f03<_0x24b853['conditions']['length'];_0xa88f03++){var _0x15eac6=_0x24b853[_0x52a1('0x63')][_0xa88f03];var _0x172f2a='i';var _0x2a3d10=_[_0x52a1('0x64')](_0x2f3393,[_0x52a1('0x2f'),_0x15eac6['field']]);if(!_0x2a3d10){switch(_0x15eac6[_0x52a1('0x4d')]){case _0x52a1('0x65'):if(_0x15eac6[_0x52a1('0x66')]==0x1){_0xea5968[_0x52a1('0x67')]('`'+_0x15eac6[_0x52a1('0x4d')]+'`\x20=\x200');}else{_0xea5968[_0x52a1('0x67')]('`'+_0x15eac6[_0x52a1('0x4d')]+_0x52a1('0x68'));}break;case _0x52a1('0x69'):if(_0x15eac6[_0x52a1('0x6a')]===_0x52a1('0x6b')){if(_0x15eac6[_0x52a1('0x66')]['split']('\x20')[_0x52a1('0x45')]>0x1){_0x24a492[_0x1bf25c](_0x52a1('0x6c'),qs['getFullTextValue'](_0x15eac6[_0x52a1('0x66')]),null);}else{var _0x47ae6a='%'+_0x15eac6[_0x52a1('0x66')]+'%';_0x24a492[_0x1bf25c](_0x52a1('0x6d'),_0x47ae6a,_0x47ae6a,_0x47ae6a);}}else{_0x2a3d10=_[_0x52a1('0x64')](_0x2f3393,[_0x52a1('0x2f'),_0x52a1('0x6e')]);_0x15eac6[_0x52a1('0x4d')]=_0x52a1('0x6e');_0x28970c=as['buildExpression'](_0x172f2a,_0x2a3d10['type'],_0x15eac6);_0x24a492[_0x1bf25c](_0x28970c[_0x52a1('0x6f')],_0x28970c[_0x52a1('0x66')][_0x52a1('0x70')],_0x28970c['value'][_0x52a1('0x71')]);}break;case _0x52a1('0x72'):var _0x424ad8=_0x15eac6['value'][_0x52a1('0x73')](',')[_0x52a1('0x32')](function(_0x201ee3){return Number(_0x201ee3);});_0x424ad8[_0x52a1('0x74')](function(_0x28a71c){_0x2a028e['or'](_0x52a1('0x75'),'%,'+_0x28a71c+',%');});_0x2c5e45=_['union'](_0x2c5e45,_0x424ad8);break;case'User':if(_0x15eac6[_0x52a1('0x6a')]===_0x52a1('0x6b')){_0x24a492[_0x1bf25c](_0x52a1('0x76'),'%'+_0x15eac6[_0x52a1('0x66')]+'%',null);}else{_0x2a3d10=_['find'](_0x2f3393,[_0x52a1('0x2f'),_0x52a1('0x38')]);_0x15eac6[_0x52a1('0x4d')]='UserId';_0x28970c=as['buildExpression'](_0x172f2a,_0x2a3d10[_0x52a1('0x77')],_0x15eac6);_0x24a492[_0x1bf25c](_0x28970c[_0x52a1('0x6f')],_0x28970c[_0x52a1('0x66')][_0x52a1('0x70')],_0x28970c[_0x52a1('0x66')]['end']);}break;case'body':_0x28970c=as[_0x52a1('0x78')]('me',null,_0x15eac6);_0x24a492[_0x1bf25c](_0x28970c[_0x52a1('0x6f')],_0x28970c[_0x52a1('0x66')][_0x52a1('0x70')],_0x28970c[_0x52a1('0x66')][_0x52a1('0x71')]);break;}}else{var _0x28970c=as[_0x52a1('0x78')](_0x172f2a,_0x2a3d10['type'],_0x15eac6);_0x24a492[_0x1bf25c](_0x28970c['text'],_0x28970c[_0x52a1('0x66')][_0x52a1('0x70')],_0x28970c[_0x52a1('0x66')]['end']);}}}else{var _0x388db8=_(_0x4338e8[_0x52a1('0x40')])[_0x52a1('0x41')]()[_0x52a1('0x32')](function(_0x23e255){return _[_0x52a1('0x79')](_0x2f3393,[_0x52a1('0x2f'),_0x23e255])?_0x23e255:undefined;})[_0x52a1('0x7a')]()['value']();if(!_[_0x52a1('0x7b')](_0x388db8)){_0x388db8[_0x52a1('0x74')](function(_0xd0ff16){if(_0xd0ff16==='OpenchannelAccountId'){_0xea5968['where']('i.OpenchannelAccountId\x20IN\x20?',[]['concat'](_0x4338e8[_0x52a1('0x40')][_0xd0ff16]));}else if(_0xd0ff16==='createdAt'){var _0x3315dd=JSON[_0x52a1('0x7c')](_0x4338e8[_0x52a1('0x40')][_0xd0ff16])[_0x52a1('0x7d')];var _0x15c131=JSON[_0x52a1('0x7c')](_0x4338e8[_0x52a1('0x40')][_0xd0ff16])[_0x52a1('0x7e')];_0xea5968['where']('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x3315dd,_0x15c131);}else{if(_0x4338e8['query'][_0xd0ff16]==='null'){_0xea5968[_0x52a1('0x4a')]('i.'+_0xd0ff16+'\x20IS\x20NULL');}else{_0xea5968['where']('i.'+_0xd0ff16+_0x52a1('0x7f'),_0x4338e8[_0x52a1('0x40')][_0xd0ff16]);}}});}if(_0x4338e8[_0x52a1('0x40')][_0x52a1('0x80')]){if(_0x4338e8[_0x52a1('0x40')]['read']==0x1){_0xea5968[_0x52a1('0x67')]('`unreadMessages`\x20=\x200');}else{_0xea5968[_0x52a1('0x67')](_0x52a1('0x81'));}}if(_0x4338e8[_0x52a1('0x40')][_0x52a1('0x82')]){_0x2c5e45=_[_0x52a1('0x83')](_0x4338e8[_0x52a1('0x40')][_0x52a1('0x82')])?_0x4338e8[_0x52a1('0x40')]['tag']:new Array(_0x4338e8[_0x52a1('0x40')]['tag']);_0x2c5e45[_0x52a1('0x74')](function(_0x3cae0a){_0x2a028e['or'](_0x52a1('0x75'),'%,'+_0x3cae0a+',%');});}if(_0x4338e8[_0x52a1('0x40')][_0x52a1('0x84')]){var _0x19a3ef=_0x4338e8[_0x52a1('0x40')][_0x52a1('0x84')][_0x52a1('0x85')]('\x5c','\x5c\x5c')[_0x52a1('0x85')](/'/g,'\x27\x27');if(qs[_0x52a1('0x86')](_0x19a3ef)){_0x24a492['or'](_0x52a1('0x87'),_0x19a3ef+'%');}else{_0x24a492['or'](_0x52a1('0x88'),qs[_0x52a1('0x89')](_0x19a3ef))['or']('i.from\x20LIKE\x20?',_0x19a3ef+'%')['or'](_0x52a1('0x8a'),_0x19a3ef+'%');}}}_0xea5968[_0x52a1('0x4a')](_0x24a492);_0xea5968[_0x52a1('0x8b')](_0x52a1('0x8c'));var _0x534116={'type':db['Sequelize'][_0x52a1('0x8d')][_0x52a1('0x8e')],'raw':!![]};var _0x1a568b=_0xea5968[_0x52a1('0x8f')]();_0x1a568b[_0x52a1('0x4d')](_0x52a1('0x8c'));_0x1a568b[_0x52a1('0x4d')](_0x52a1('0x90'),_0x52a1('0x65'));if(_0x3d5477['order']){_0x3d5477[_0x52a1('0x48')][_0x52a1('0x74')](function(_0x3baaab){var _0x1f1301=_0x3baaab[0x0]===_0x52a1('0x91')?_0x3baaab[0x0]:'i.'+_0x3baaab[0x0];_0xea5968[_0x52a1('0x48')](_0x1f1301,_0x3baaab[0x1]==='DESC'?![]:!![]);});}if(!_['isEmpty'](_0x2c5e45)){_0xea5968[_0x52a1('0x67')](_0x2a028e);_0x1a568b['where'](_0x52a1('0x92'),_0x2c5e45);}BPromise[_0x52a1('0x93')]()[_0x52a1('0x2c')](function(){if(!_0x24b853){if(_0x4338e8[_0x52a1('0x40')][_0x52a1('0x94')])return;_0x1a568b['where'](_0x52a1('0x95'));_0xea5968['where'](_0x52a1('0x95'));return;}if(_0x4338e8['user'][_0x52a1('0x96')]!==_0x52a1('0x97'))return;return _0x4338e8[_0x52a1('0x98')][_0x52a1('0x99')]({'attributes':['id'],'raw':!![]})[_0x52a1('0x2c')](function(_0x5c01da){if(_[_0x52a1('0x7b')](_0x5c01da)){_0x1a568b[_0x52a1('0x4a')](_0x52a1('0x9a'));_0xea5968[_0x52a1('0x4a')](_0x52a1('0x9a'));}else{_0x1a568b[_0x52a1('0x4a')]('i.OpenchannelAccountId\x20IN\x20?',_[_0x52a1('0x32')](_0x5c01da,'id'));_0xea5968[_0x52a1('0x4a')](_0x52a1('0x9b'),_[_0x52a1('0x32')](_0x5c01da,'id'));}});})['then'](function(){if(_0x4338e8['user']['role']===_0x52a1('0x97')&&!_0x24b853&&!_0x4338e8[_0x52a1('0x40')][_0x52a1('0x94')])return[];return db[_0x52a1('0x9c')][_0x52a1('0x40')](_0x1a568b[_0x52a1('0x9d')](),_0x534116);})[_0x52a1('0x2c')](function(_0xb03878){_0xc901c8[_0x52a1('0x26')]=_0xb03878[_0x52a1('0x45')];if(_0xc901c8['count']===0x0)return[];return db['sequelize']['query'](_0x2ad034[_0x52a1('0x9d')](),_0x534116)[_0x52a1('0x2c')](function(_0x4cee7c){_0x22d85b=_[_0x52a1('0x9e')](_0x4cee7c,'id');_0x534116=_[_0x52a1('0x9f')](_0x534116,{'model':db[_0x52a1('0x3b')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4338e8[_0x52a1('0x40')][_0x52a1('0x43')]){_0x3d5477['attributes'][_0x52a1('0x74')](function(_0x5e7311){_0xea5968[_0x52a1('0x4d')]('i.'+_0x5e7311);});}else{_0xea5968[_0x52a1('0x4d')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x52a1('0x65'));_0xea5968[_0x52a1('0x4d')](_0x52a1('0xa0'),_0x52a1('0xa1'));_0xea5968[_0x52a1('0x4d')](_0x52a1('0xa2'),_0x52a1('0xa3'));_0xea5968[_0x52a1('0x4d')](_0x52a1('0xa4'),_0x52a1('0x91'));_0xea5968[_0x52a1('0x4d')](_0x52a1('0xa5'));_0xea5968[_0x52a1('0x4d')](_0x52a1('0xa6'),_0x52a1('0xa7'));_0xea5968[_0x52a1('0x4d')]('c.lastName',_0x52a1('0xa8'));_0xea5968[_0x52a1('0x4d')](_0x52a1('0xa9'),'Contact.email');_0xea5968['field'](_0x52a1('0xaa'),_0x52a1('0xab'));_0xea5968[_0x52a1('0x4d')](_0x52a1('0xac'),_0x52a1('0xad'));_0xea5968[_0x52a1('0x4d')](_0x52a1('0xae'),_0x52a1('0xaf'));_0xea5968[_0x52a1('0x4d')](_0x52a1('0xb0'),'Owner.fullname');_0xea5968[_0x52a1('0x4d')](_0x52a1('0xb1'),'Owner.internal');_0xea5968['field'](_0x52a1('0xb2'),_0x52a1('0x34'));}if(_0x3d5477[_0x52a1('0x25')])_0xea5968[_0x52a1('0x25')](_0x3d5477['limit']);if(_0x3d5477[_0x52a1('0x24')])_0xea5968[_0x52a1('0x24')](_0x3d5477['offset']);return db['sequelize'][_0x52a1('0x40')](_0xea5968[_0x52a1('0x9d')](),_0x534116);})[_0x52a1('0x2c')](function(_0x2415a2){if(_0x2415a2[_0x52a1('0x45')]>0x0)_0x3b41f8[_0x52a1('0x4a')](_0x52a1('0xb3'),_[_0x52a1('0x32')](_0x2415a2,'id'));return db[_0x52a1('0x9c')]['query'](_0x3b41f8[_0x52a1('0x9d')](),_0x534116)['then'](function(_0x3b6b4f){var _0x40c126=_[_0x52a1('0xb4')](_0x3b6b4f,'OpenchannelInteractionId');var _0x1c3944=[];_0x2415a2['forEach'](function(_0x3033bd){_0x1c3944[_0x52a1('0xb5')](updateOpenchannelInteraction(_0x3033bd,_0x22d85b,_0x40c126));});return BPromise[_0x52a1('0xb6')](_0x1c3944);});});})['then'](function(_0x4748eb){_0xc901c8[_0x52a1('0xb7')]=_0x4748eb;return _0xc901c8;})[_0x52a1('0x2c')](respondWithFilteredResult(_0x8522fd,_0x3d5477))[_0x52a1('0xb8')](handleError(_0x8522fd,null));};exports[_0x52a1('0xb9')]=function(_0x357a8d,_0x3798b6){var _0x222a90={};if(_0x357a8d[_0x52a1('0x40')][_0x52a1('0x77')]&&_0x357a8d[_0x52a1('0x40')][_0x52a1('0x77')]===_0x52a1('0x4f')){_0x222a90[_0x52a1('0x4f')]=_0x357a8d[_0x52a1('0xba')]['id'];}else{_0x222a90['id']=_0x357a8d[_0x52a1('0xba')]['id'];}var _0x4b1da2={'raw':![],'where':_0x222a90},_0xe582d7={};_0xe582d7['model']=_[_0x52a1('0x41')](db[_0x52a1('0x3b')][_0x52a1('0x3c')]);_0xe582d7[_0x52a1('0x40')]=_[_0x52a1('0x41')](_0x357a8d['query']);_0xe582d7[_0x52a1('0x42')]=_[_0x52a1('0xbb')](_0xe582d7['model'],_0xe582d7[_0x52a1('0x40')]);_0x4b1da2[_0x52a1('0x44')]=_[_0x52a1('0xbb')](_0xe582d7[_0x52a1('0x3f')],qs[_0x52a1('0x43')](_0x357a8d[_0x52a1('0x40')][_0x52a1('0x43')]));_0x4b1da2[_0x52a1('0x44')]=_0x4b1da2['attributes'][_0x52a1('0x45')]?_0x4b1da2['attributes']:_0xe582d7[_0x52a1('0x3f')];if(_0x357a8d[_0x52a1('0x40')][_0x52a1('0xbc')]){_0x4b1da2[_0x52a1('0xbd')]=[{'all':!![]}];}_0x4b1da2=_['merge']({},_0x4b1da2,_0x357a8d[_0x52a1('0xbe')]);return db[_0x52a1('0x3b')][_0x52a1('0x64')](_0x4b1da2)[_0x52a1('0x2c')](handleEntityNotFound(_0x3798b6,null))[_0x52a1('0x2c')](respondWithResult(_0x3798b6,null))['catch'](handleError(_0x3798b6,null));};exports[_0x52a1('0xbf')]=function(_0x3584bd,_0x3d9499){return db[_0x52a1('0x3b')][_0x52a1('0xbf')](_0x3584bd[_0x52a1('0xc0')],{})[_0x52a1('0x2c')](respondWithResult(_0x3d9499,0xc9))['catch'](handleError(_0x3d9499,null));};exports[_0x52a1('0xc1')]=function(_0x47d73a,_0x3bcb15){if(_0x47d73a[_0x52a1('0xc0')]['id']){delete _0x47d73a[_0x52a1('0xc0')]['id'];}return db[_0x52a1('0x3b')][_0x52a1('0x64')]({'where':{'id':_0x47d73a[_0x52a1('0xba')]['id']}})['then'](handleEntityNotFound(_0x3bcb15,null))['then'](saveUpdates(_0x47d73a[_0x52a1('0xc0')],null))[_0x52a1('0x2c')](respondWithResult(_0x3bcb15,null))['catch'](handleError(_0x3bcb15,null));};exports[_0x52a1('0xc2')]=function(_0x1c0b4d,_0x54ab34){return db[_0x52a1('0x3b')][_0x52a1('0x64')]({'where':{'id':_0x1c0b4d['params']['id']}})['then'](handleEntityNotFound(_0x54ab34,null))[_0x52a1('0x2c')](removeEntity(_0x54ab34,null))[_0x52a1('0xb8')](handleError(_0x54ab34,null));};exports['describe']=function(_0x385f69,_0x6bc59c){return db[_0x52a1('0x3b')][_0x52a1('0xc3')]()['then'](respondWithResult(_0x6bc59c,null))[_0x52a1('0xb8')](handleError(_0x6bc59c,null));};exports['addMessage']=function(_0x11a5d5,_0x380c20,_0x52f29a){return db['OpenchannelMessage'][_0x52a1('0x64')]({'where':{'id':_0x11a5d5['params']['id']}})[_0x52a1('0x2c')](handleEntityNotFound(_0x380c20,null))['then'](function(_0x4888ae){if(_0x4888ae){return _0x4888ae[_0x52a1('0xc4')](_0x11a5d5['body'][_0x52a1('0xc5')],_[_0x52a1('0xc6')](_0x11a5d5['body'],[_0x52a1('0xc5'),'id'])||{});}})[_0x52a1('0x2c')](respondWithResult(_0x380c20,null))[_0x52a1('0xb8')](handleError(_0x380c20,null));};exports[_0x52a1('0xc7')]=function(_0x545ee8,_0x60e53e,_0x35f0d4){var _0x384c19={'raw':![],'where':{}};var _0x1d82c4={};var _0x18c734={'count':0x0,'rows':[]};return db[_0x52a1('0x3b')]['findOne']({'where':{'id':_0x545ee8['params']['id']}})[_0x52a1('0x2c')](handleEntityNotFound(_0x60e53e,null))[_0x52a1('0x2c')](function(_0x55599e){if(_0x55599e){_0x1d82c4[_0x52a1('0x3f')]=_[_0x52a1('0x41')](db[_0x52a1('0xc8')][_0x52a1('0x3c')]);_0x1d82c4['query']=_[_0x52a1('0x41')](_0x545ee8[_0x52a1('0x40')]);_0x1d82c4['filters']=_[_0x52a1('0xbb')](_0x1d82c4['model'],_0x1d82c4['query']);_0x384c19['attributes']=_[_0x52a1('0xbb')](_0x1d82c4['model'],qs[_0x52a1('0x43')](_0x545ee8[_0x52a1('0x40')][_0x52a1('0x43')]));_0x384c19[_0x52a1('0x44')]=_0x384c19[_0x52a1('0x44')][_0x52a1('0x45')]?_0x384c19[_0x52a1('0x44')]:_0x1d82c4[_0x52a1('0x3f')];if(!_0x545ee8['query'][_0x52a1('0x46')](_0x52a1('0x47'))){_0x384c19[_0x52a1('0x25')]=qs[_0x52a1('0x25')](_0x545ee8[_0x52a1('0x40')][_0x52a1('0x25')]);_0x384c19[_0x52a1('0x24')]=qs[_0x52a1('0x24')](_0x545ee8[_0x52a1('0x40')]['offset']);}_0x384c19[_0x52a1('0x48')]=qs['sort'](_0x545ee8['query'][_0x52a1('0x49')]);_0x384c19[_0x52a1('0x4a')]=qs[_0x52a1('0x42')](_[_0x52a1('0x4b')](_0x545ee8['query'],_0x1d82c4['filters']));_0x384c19[_0x52a1('0x4a')][_0x52a1('0xc9')]=_0x55599e['id'];if(_0x545ee8[_0x52a1('0x40')][_0x52a1('0x84')]){_0x384c19['where']=_[_0x52a1('0x9f')](_0x384c19[_0x52a1('0x4a')],{'$or':_[_0x52a1('0x32')](_0x384c19[_0x52a1('0x44')],function(_0x4879b5){var _0x1390a0={};_0x1390a0[_0x4879b5]={'$like':'%'+_0x545ee8[_0x52a1('0x40')][_0x52a1('0x84')]+'%'};return _0x1390a0;})});}if(_0x545ee8[_0x52a1('0x40')]['$gte']){var _0x11bd29=_0x545ee8['query'][_0x52a1('0x7d')][_0x52a1('0x73')](',');var _0x3f6d51={};_0x3f6d51[_0x11bd29[0x0]]={'$gte':moment(_0x11bd29[0x1])['format'](_0x52a1('0xca'))};_0x384c19['where']=_[_0x52a1('0x9f')](_0x384c19[_0x52a1('0x4a')],_0x3f6d51);}_0x384c19=_['merge']({},_0x384c19,_0x545ee8['options']);return db[_0x52a1('0xc8')]['count']({'where':_0x384c19['where']})['then'](function(_0xbc838f){_0x18c734['count']=_0xbc838f;if(_0x545ee8[_0x52a1('0x40')][_0x52a1('0xbc')]){_0x384c19[_0x52a1('0xbd')]=[{'all':!![]}];}return db['OpenchannelMessage']['findAll'](_0x384c19);})[_0x52a1('0x2c')](function(_0x538a69){_0x18c734['rows']=_0x538a69;return _0x18c734;});}})['then'](respondWithFilteredResult(_0x60e53e,_0x384c19))[_0x52a1('0xb8')](handleError(_0x60e53e,null));};exports[_0x52a1('0xcb')]=function(_0x3e88f0,_0x1d0f4f,_0x365cf7){return db['OpenchannelInteraction'][_0x52a1('0x64')]({'where':{'id':_0x3e88f0['params']['id']}})[_0x52a1('0x2c')](handleEntityNotFound(_0x1d0f4f,null))[_0x52a1('0x2c')](function(_0x135b11){if(_0x135b11){return _0x135b11[_0x52a1('0xcc')](_0x3e88f0['body'][_0x52a1('0xc5')],_[_0x52a1('0xc6')](_0x3e88f0['body'],['ids','id'])||{})[_0x52a1('0xcd')](function(){return db[_0x52a1('0x72')][_0x52a1('0xce')]({'attributes':['id','name',_0x52a1('0x4e')],'where':{'id':_0x3e88f0[_0x52a1('0xc0')][_0x52a1('0xc5')]}});})[_0x52a1('0x2c')](function(_0x1364ac){socket['emit'](_0x52a1('0xcf'),{'id':Number(_0x3e88f0[_0x52a1('0xba')]['id']),'tags':_0x1364ac||[]});return{'id':Number(_0x3e88f0[_0x52a1('0xba')]['id']),'tags':_0x1364ac||[]};});}})['then'](respondWithResult(_0x1d0f4f,null))[_0x52a1('0xb8')](handleError(_0x1d0f4f,null));};exports[_0x52a1('0xd0')]=function(_0xfb711d,_0x1f9e50,_0x379b4e){return db[_0x52a1('0x3b')][_0x52a1('0x64')]({'where':{'id':_0xfb711d['params']['id']}})[_0x52a1('0x2c')](handleEntityNotFound(_0x1f9e50,null))[_0x52a1('0x2c')](function(_0x1ecf2d){if(_0x1ecf2d){return _0x1ecf2d[_0x52a1('0xd0')](_0xfb711d[_0x52a1('0x40')][_0x52a1('0xc5')]);}})[_0x52a1('0x2c')](respondWithStatusCode(_0x1f9e50,null))[_0x52a1('0xb8')](handleError(_0x1f9e50,null));};exports[_0x52a1('0xd1')]=function(_0x409b2a,_0x163db6){var _0x23a645=moment()[_0x52a1('0xd2')]()['toString']();var _0x2be8a5=path[_0x52a1('0xd3')](config[_0x52a1('0xd4')],'server',_0x52a1('0xd5'),_0x52a1('0xd6'));var _0xd52fa1=path[_0x52a1('0xd3')](config[_0x52a1('0xd4')],_0x52a1('0xd7'),'files',_0x52a1('0xd8'));var _0x1c1606=path['join'](_0x2be8a5,_0x23a645);var _0x3bb37c=util[_0x52a1('0xd9')](_0x52a1('0xda'),_0x409b2a[_0x52a1('0xba')]['id'],_0x23a645);var _0x3e1c2e=path[_0x52a1('0xd3')](_0x2be8a5,_0x3bb37c);var _0x179191=[];_0x179191[_0x52a1('0xb5')]({'model':db['User'],'as':_0x52a1('0xdb'),'attributes':['id',_0x52a1('0x33')],'raw':!![]});_0x179191['push']({'model':db[_0x52a1('0xdc')],'as':'Contact','attributes':['id','firstName',_0x52a1('0xdd')],'raw':!![]});if(_0x409b2a['query'][_0x52a1('0xd8')]){_0x179191[_0x52a1('0xb5')]({'model':db[_0x52a1('0xde')],'as':'Attachment','raw':!![]});}var _0x2f57d6=[{'model':db[_0x52a1('0xc8')],'as':_0x52a1('0xdf'),'attributes':['id','body',_0x52a1('0xe0'),'direction',_0x52a1('0xe1'),_0x52a1('0x80')],'include':_0x179191}];_0x2f57d6[_0x52a1('0xb5')]({'model':db['OpenchannelAccount'],'as':_0x52a1('0xe2'),'attributes':['id',_0x52a1('0x2f')]});_0x2f57d6[_0x52a1('0xb5')]({'model':db['User'],'as':_0x52a1('0xe3'),'attributes':['id','fullname']});return db[_0x52a1('0x3b')][_0x52a1('0x64')]({'where':{'id':_0x409b2a['params']['id']},'include':_0x2f57d6})[_0x52a1('0x2c')](handleEntityNotFound(_0x163db6,null))[_0x52a1('0x2c')](function(_0x28a303){if(_0x28a303){var _0x4d37c8=_0x28a303[_0x52a1('0xe4')]({'plain':!![]});fs[_0x52a1('0xe5')](_0x1c1606);var _0x1a63bd={'channel':'Openchannel','account':_0x4d37c8[_0x52a1('0xe2')]['name'],'agent':_0x4d37c8[_0x52a1('0xe3')]?_0x4d37c8[_0x52a1('0xe3')]['fullname']:_0x52a1('0xe6'),'createdAt':moment(_0x4d37c8['createdAt'])[_0x52a1('0xd9')](_0x52a1('0xca'))['toString'](),'closedAt':_0x4d37c8['closed']?moment(_0x4d37c8[_0x52a1('0xe7')])[_0x52a1('0xd9')](_0x52a1('0xca'))[_0x52a1('0x9d')]():'','disposition':_0x4d37c8[_0x52a1('0xe8')],'visibility':_0x4d37c8[_0x52a1('0xe9')]?_0x52a1('0xea'):_0x52a1('0xeb'),'messages':_(_0x4d37c8[_0x52a1('0xdf')])[_0x52a1('0x84')]({'secret':![]})[_0x52a1('0x32')](function(_0x5921dd){if(_0x5921dd[_0x52a1('0xde')]){var _0x5857f7=path['join'](_0xd52fa1,_0x5921dd[_0x52a1('0xde')][_0x52a1('0xec')]);if(fs['existsSync'](_0x5857f7)){fs['createReadStream'](_0x5857f7)[_0x52a1('0xed')](fs[_0x52a1('0xee')](path[_0x52a1('0xd3')](_0x1c1606,_0x5921dd[_0x52a1('0xde')]['basename'])));}}return{'date':moment(_0x5921dd[_0x52a1('0xe0')])[_0x52a1('0xd9')](_0x52a1('0xca'))['toString'](),'sender':_0x5921dd[_0x52a1('0xef')]==='out'?_0x5921dd[_0x52a1('0xdb')]?_0x5921dd[_0x52a1('0xdb')][_0x52a1('0x33')]:_0x52a1('0xf0'):_0x5921dd[_0x52a1('0x69')][_0x52a1('0xf1')]+(_0x5921dd[_0x52a1('0x69')]['lastName']?'\x20'+_0x5921dd[_0x52a1('0x69')][_0x52a1('0xdd')]:''),'body':_0x5921dd[_0x52a1('0xde')]?_0x5921dd[_0x52a1('0xde')][_0x52a1('0xec')]:_0x5921dd[_0x52a1('0xc0')],'direction':_0x5921dd[_0x52a1('0xef')]===_0x52a1('0xf2')?'A':'C','secret':_0x5921dd['secret'],'read':_0x5921dd[_0x52a1('0x80')],'attachment':_0x5921dd[_0x52a1('0xde')]};})[_0x52a1('0x66')]()};return ejs[_0x52a1('0xf3')](path['join'](config[_0x52a1('0xd4')],'server',_0x52a1('0xf4'),_0x52a1('0xf5')),{'interaction':_0x1a63bd})[_0x52a1('0x2c')](function(_0x26b273){var _0x5f7fdf=path[_0x52a1('0xd3')](_0x1c1606,_0x52a1('0xf6')+_0x4d37c8['id']+'-'+_0x23a645+_0x52a1('0xf7'));var _0x7f8075={'path':_0x5f7fdf,'channel':_0x52a1('0xf8'),'interactionId':_0x4d37c8['id']};return pdf['createPdfFromHTML'](_0x26b273,_0x7f8075);})[_0x52a1('0x2c')](function(){return new BPromise(function(_0xf82150,_0x330b1a){zipdir(_0x1c1606,{'saveTo':_0x3e1c2e},function(_0x5b53b6,_0x55a509){if(_0x5b53b6)return _0x330b1a(_0x5b53b6);return _0xf82150(_0x55a509);});})[_0x52a1('0x2c')](function(){return new BPromise(function(_0x3c4b9e,_0x423af3){rimraf(_0x1c1606,function(_0x415be5){if(_0x415be5)_0x423af3(_0x415be5);return _0x3c4b9e();});});})['then'](function(){return _0x163db6[_0x52a1('0xd1')](_0x3e1c2e,_0x3bb37c,function(_0x268794){if(_0x268794){console[_0x52a1('0xf9')](_0x52a1('0xfa'),_0x268794);}else{fs[_0x52a1('0xfb')](_0x3e1c2e);}});});});}else{return _0x163db6[_0x52a1('0x21')](0xc8);}})[_0x52a1('0xb8')](handleError(_0x163db6,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 1ca888e..2a2e3bd 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 _0x5791=['unreadMessages','emit','catch','hook','events','../../mysqldb','OpenchannelMessage','setMaxListeners','save','update','remove','getUsers','then','map','findAll','setDataValue'];(function(_0x147c96,_0x309657){var _0x4ec711=function(_0x3cf7c9){while(--_0x3cf7c9){_0x147c96['push'](_0x147c96['shift']());}};_0x4ec711(++_0x309657);}(_0x5791,0x114));var _0x1579=function(_0x2ed502,_0x3b7fab){_0x2ed502=_0x2ed502-0x0;var _0x191886=_0x5791[_0x2ed502];return _0x191886;};'use strict';var EventEmitter=require(_0x1579('0x0'));var OpenchannelInteraction=require(_0x1579('0x1'))['db']['OpenchannelInteraction'];var OpenchannelMessage=require(_0x1579('0x1'))['db'][_0x1579('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x1579('0x3')](0x0);var events={'afterCreate':_0x1579('0x4'),'afterUpdate':_0x1579('0x5'),'afterDestroy':_0x1579('0x6')};function emitEvent(_0x26299d){return function(_0x418bce,_0x346209,_0xa766b2){_0x418bce[_0x1579('0x7')]({'attributes':['id'],'raw':!![]})[_0x1579('0x8')](function(_0x330085){_0x418bce['setDataValue']('Users',_0x330085[_0x1579('0x9')](function(_0x5c4bf5){return{'id':_0x5c4bf5['id']};}));return OpenchannelMessage[_0x1579('0xa')]({'where':{'OpenchannelInteractionId':_0x418bce['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x957e54){_0x418bce[_0x1579('0xb')](_0x1579('0xc'),_0x957e54['length']);OpenchannelInteractionEvents[_0x1579('0xd')](_0x26299d+':'+_0x418bce['id'],_0x418bce);OpenchannelInteractionEvents[_0x1579('0xd')](_0x26299d,_0x418bce);_0xa766b2(null);})[_0x1579('0xe')](_0xa766b2(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction[_0x1579('0xf')](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents; \ No newline at end of file +var _0x5548=['remove','getUsers','then','setDataValue','Users','findAll','unreadMessages','length','emit','catch','hook','events','../../mysqldb','OpenchannelMessage','save','update'];(function(_0x569baa,_0x54f3df){var _0x472ff4=function(_0x580b3e){while(--_0x580b3e){_0x569baa['push'](_0x569baa['shift']());}};_0x472ff4(++_0x54f3df);}(_0x5548,0xfb));var _0x8554=function(_0x2beeb9,_0x415c85){_0x2beeb9=_0x2beeb9-0x0;var _0x3f7f25=_0x5548[_0x2beeb9];return _0x3f7f25;};'use strict';var EventEmitter=require(_0x8554('0x0'));var OpenchannelInteraction=require(_0x8554('0x1'))['db']['OpenchannelInteraction'];var OpenchannelMessage=require('../../mysqldb')['db'][_0x8554('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8554('0x3'),'afterUpdate':_0x8554('0x4'),'afterDestroy':_0x8554('0x5')};function emitEvent(_0x1878a1){return function(_0x27dd27,_0x3432c7,_0x13e0f1){_0x27dd27[_0x8554('0x6')]({'attributes':['id'],'raw':!![]})[_0x8554('0x7')](function(_0x42c298){_0x27dd27[_0x8554('0x8')](_0x8554('0x9'),_0x42c298['map'](function(_0x3d9fed){return{'id':_0x3d9fed['id']};}));return OpenchannelMessage[_0x8554('0xa')]({'where':{'OpenchannelInteractionId':_0x27dd27['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x1eb655){_0x27dd27['setDataValue'](_0x8554('0xb'),_0x1eb655[_0x8554('0xc')]);OpenchannelInteractionEvents[_0x8554('0xd')](_0x1878a1+':'+_0x27dd27['id'],_0x27dd27);OpenchannelInteractionEvents[_0x8554('0xd')](_0x1878a1,_0x27dd27);_0x13e0f1(null);})[_0x8554('0xe')](_0x13e0f1(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction[_0x8554('0xf')](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 664fe07..73e202c 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 _0xb89a=['format','YYYY-MM-DD\x20HH:mm:ss','util','api','request-promise','path','../../config/environment','./openchannelInteraction.attributes','exports','define','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','changed'];(function(_0x287a34,_0x1f8f03){var _0x45f5e2=function(_0x164b96){while(--_0x164b96){_0x287a34['push'](_0x287a34['shift']());}};_0x45f5e2(++_0x1f8f03);}(_0xb89a,0xd4));var _0xab89=function(_0x5a27fe,_0x43993b){_0x5a27fe=_0x5a27fe-0x0;var _0x121c88=_0xb89a[_0x5a27fe];return _0x121c88;};'use strict';var _=require('lodash');var util=require(_0xab89('0x0'));var logger=require('../../config/logger')(_0xab89('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xab89('0x2'));var fs=require('fs');var path=require(_0xab89('0x3'));var rimraf=require('rimraf');var config=require(_0xab89('0x4'));var attributes=require(_0xab89('0x5'));module[_0xab89('0x6')]=function(_0x5a938b,_0x2b8c85){return _0x5a938b[_0xab89('0x7')]('OpenchannelInteraction',attributes,{'tableName':_0xab89('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xab89('0x9'),'collate':_0xab89('0xa'),'hooks':{'beforeUpdate':function(_0x3633d3,_0x33641b,_0x83a246){if(_0x3633d3[_0xab89('0xb')]('closed')){_0x3633d3['closedAt']=moment()[_0xab89('0xc')](_0xab89('0xd'));}_0x83a246(null,_0x3633d3);}}});}; \ No newline at end of file +var _0x9f6b=['format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','bluebird','request-promise','../../config/environment','exports','define','OpenchannelInteraction','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','closed','closedAt'];(function(_0x58d66a,_0xc7f43f){var _0x3681bc=function(_0x12092b){while(--_0x12092b){_0x58d66a['push'](_0x58d66a['shift']());}};_0x3681bc(++_0xc7f43f);}(_0x9f6b,0x112));var _0xb9f6=function(_0x48e509,_0xd1975c){_0x48e509=_0x48e509-0x0;var _0x27d257=_0x9f6b[_0x48e509];return _0x27d257;};'use strict';var _=require(_0xb9f6('0x0'));var util=require(_0xb9f6('0x1'));var logger=require(_0xb9f6('0x2'))(_0xb9f6('0x3'));var moment=require('moment');var BPromise=require(_0xb9f6('0x4'));var rp=require(_0xb9f6('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb9f6('0x6'));var attributes=require('./openchannelInteraction.attributes');module[_0xb9f6('0x7')]=function(_0x3364fc,_0x5b379a){return _0x3364fc[_0xb9f6('0x8')](_0xb9f6('0x9'),attributes,{'tableName':_0xb9f6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb9f6('0xb'),'collate':_0xb9f6('0xc'),'hooks':{'beforeUpdate':function(_0x42d003,_0x20fc23,_0x1f74b9){if(_0x42d003['changed'](_0xb9f6('0xd'))){_0x42d003[_0xb9f6('0xe')]=moment()[_0xb9f6('0xf')](_0xb9f6('0x10'));}_0x1f74b9(null,_0x42d003);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index d86cd69..a9b6e71 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 _0x34df=['where','attributes','limit','UpdateOpenchannelInteraction','catch','AddTagsToOpenchannelInteraction','find','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','then','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelInteraction,\x20%s,\x20%s','message','info','result','OpenchannelInteraction','update','body','options','raw'];(function(_0x533d0a,_0x35c5e8){var _0x522822=function(_0x1dd447){while(--_0x1dd447){_0x533d0a['push'](_0x533d0a['shift']());}};_0x522822(++_0x35c5e8);}(_0x34df,0x90));var _0xf34d=function(_0x1ccbcc,_0x5c948b){_0x1ccbcc=_0x1ccbcc-0x0;var _0x1e873f=_0x34df[_0x1ccbcc];return _0x1e873f;};'use strict';var _=require(_0xf34d('0x0'));var util=require(_0xf34d('0x1'));var moment=require(_0xf34d('0x2'));var BPromise=require(_0xf34d('0x3'));var rs=require(_0xf34d('0x4'));var fs=require('fs');var Redis=require(_0xf34d('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xf34d('0x6'));var logger=require(_0xf34d('0x7'))(_0xf34d('0x8'));var config=require('../../config/environment');var jayson=require(_0xf34d('0x9'));var client=jayson['client'][_0xf34d('0xa')]({'port':0x232a});config[_0xf34d('0xb')]=_[_0xf34d('0xc')](config[_0xf34d('0xb')],{'host':_0xf34d('0xd'),'port':0x18eb});var socket=require(_0xf34d('0xe'))(new Redis(config[_0xf34d('0xb')]));require(_0xf34d('0xf'))['register'](socket);function respondWithRpcPromise(_0x2cd476,_0x19e4c6,_0x1c4ba1){return new BPromise(function(_0x5c96c4,_0x332651){return client['request'](_0x2cd476,_0x1c4ba1)[_0xf34d('0x10')](function(_0x8a0545){logger['info']('OpenchannelInteraction,\x20%s,\x20%s',_0x19e4c6,_0xf34d('0x11'));logger[_0xf34d('0x12')](_0xf34d('0x13'),_0x19e4c6,_0xf34d('0x11'),JSON[_0xf34d('0x14')](_0x8a0545));if(_0x8a0545['error']){if(_0x8a0545[_0xf34d('0x15')][_0xf34d('0x16')]===0x1f4){logger[_0xf34d('0x15')](_0xf34d('0x17'),_0x19e4c6,_0x8a0545['error'][_0xf34d('0x18')]);return _0x332651(_0x8a0545['error'][_0xf34d('0x18')]);}logger[_0xf34d('0x15')](_0xf34d('0x17'),_0x19e4c6,_0x8a0545['error'][_0xf34d('0x18')]);return _0x5c96c4(_0x8a0545[_0xf34d('0x15')]['message']);}else{logger[_0xf34d('0x19')](_0xf34d('0x17'),_0x19e4c6,_0xf34d('0x11'));_0x5c96c4(_0x8a0545[_0xf34d('0x1a')][_0xf34d('0x18')]);}})['catch'](function(_0xce7209){logger[_0xf34d('0x15')](_0xf34d('0x17'),_0x19e4c6,_0xce7209);_0x332651(_0xce7209);});});}exports['UpdateOpenchannelInteraction']=function(_0x2a386c){var _0x1d4e83=this;return new Promise(function(_0x37ff01,_0x3670c9){return db[_0xf34d('0x1b')][_0xf34d('0x1c')](_0x2a386c[_0xf34d('0x1d')],{'raw':_0x2a386c[_0xf34d('0x1e')]?_0x2a386c['options'][_0xf34d('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2a386c[_0xf34d('0x1e')]?_0x2a386c['options'][_0xf34d('0x20')]||null:null,'attributes':_0x2a386c[_0xf34d('0x1e')]?_0x2a386c[_0xf34d('0x1e')][_0xf34d('0x21')]||null:null,'limit':_0x2a386c[_0xf34d('0x1e')]?_0x2a386c[_0xf34d('0x1e')][_0xf34d('0x22')]||null:null})['then'](function(_0x324036){logger[_0xf34d('0x19')](_0xf34d('0x23'),_0x2a386c);logger[_0xf34d('0x12')](_0xf34d('0x23'),_0x2a386c,JSON[_0xf34d('0x14')](_0x324036));_0x37ff01(_0x324036);})[_0xf34d('0x24')](function(_0x335632){logger['error'](_0xf34d('0x23'),_0x335632[_0xf34d('0x18')],_0x2a386c);_0x3670c9(_0x1d4e83['error'](0x1f4,_0x335632[_0xf34d('0x18')]));});});};exports[_0xf34d('0x25')]=function(_0x23009e){return new Promise(function(_0x3616aa,_0x2f8ea9){return db['OpenchannelInteraction'][_0xf34d('0x26')]({'where':_0x23009e[_0xf34d('0x1e')]?_0x23009e['options'][_0xf34d('0x20')]||null:null})[_0xf34d('0x10')](function(_0x280889){if(_0x280889){return _0x280889[_0xf34d('0x27')](_0x23009e[_0xf34d('0x1d')][_0xf34d('0x28')],_[_0xf34d('0x29')](_0x23009e['body'],[_0xf34d('0x28'),'id'])||{});}})[_0xf34d('0x2a')](function(_0x308ec1){logger['info'](_0xf34d('0x2b'),_0x23009e);logger[_0xf34d('0x12')]('AddTags',_0x23009e,JSON[_0xf34d('0x14')](_0x308ec1));_0x3616aa(_0x308ec1);})[_0xf34d('0x24')](function(_0xdec613){logger[_0xf34d('0x15')](_0xf34d('0x2b'),_0xdec613[_0xf34d('0x18')],_0x23009e);_0x2f8ea9(_this['error'](0x1f4,_0xdec613['message']));});});}; \ No newline at end of file +var _0xe506=['limit','then','stringify','AddTagsToOpenchannelInteraction','find','where','addTags','omit','ids','spread','AddTags','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','request','info','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','code','error','message','OpenchannelInteraction,\x20%s,\x20%s','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','raw','attributes'];(function(_0x15cea8,_0x16e264){var _0xd4515e=function(_0x3b5779){while(--_0x3b5779){_0x15cea8['push'](_0x15cea8['shift']());}};_0xd4515e(++_0x16e264);}(_0xe506,0x1cd));var _0x6e50=function(_0x29f241,_0x1e8fd8){_0x29f241=_0x29f241-0x0;var _0x5d0ca8=_0xe506[_0x29f241];return _0x5d0ca8;};'use strict';var _=require(_0x6e50('0x0'));var util=require(_0x6e50('0x1'));var moment=require(_0x6e50('0x2'));var BPromise=require(_0x6e50('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6e50('0x4'));var db=require(_0x6e50('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6e50('0x6'))(_0x6e50('0x7'));var config=require(_0x6e50('0x8'));var jayson=require(_0x6e50('0x9'));var client=jayson[_0x6e50('0xa')]['http']({'port':0x232a});config[_0x6e50('0xb')]=_[_0x6e50('0xc')](config[_0x6e50('0xb')],{'host':_0x6e50('0xd'),'port':0x18eb});var socket=require(_0x6e50('0xe'))(new Redis(config[_0x6e50('0xb')]));require(_0x6e50('0xf'))['register'](socket);function respondWithRpcPromise(_0x46de3c,_0x3dca4f,_0x224d81){return new BPromise(function(_0x5db44a,_0x5626a5){return client[_0x6e50('0x10')](_0x46de3c,_0x224d81)['then'](function(_0x43107a){logger[_0x6e50('0x11')]('OpenchannelInteraction,\x20%s,\x20%s',_0x3dca4f,_0x6e50('0x12'));logger[_0x6e50('0x13')](_0x6e50('0x14'),_0x3dca4f,_0x6e50('0x12'),JSON['stringify'](_0x43107a));if(_0x43107a['error']){if(_0x43107a['error'][_0x6e50('0x15')]===0x1f4){logger[_0x6e50('0x16')]('OpenchannelInteraction,\x20%s,\x20%s',_0x3dca4f,_0x43107a[_0x6e50('0x16')][_0x6e50('0x17')]);return _0x5626a5(_0x43107a[_0x6e50('0x16')][_0x6e50('0x17')]);}logger[_0x6e50('0x16')](_0x6e50('0x18'),_0x3dca4f,_0x43107a[_0x6e50('0x16')][_0x6e50('0x17')]);return _0x5db44a(_0x43107a['error'][_0x6e50('0x17')]);}else{logger[_0x6e50('0x11')](_0x6e50('0x18'),_0x3dca4f,_0x6e50('0x12'));_0x5db44a(_0x43107a[_0x6e50('0x19')][_0x6e50('0x17')]);}})[_0x6e50('0x1a')](function(_0x2eb440){logger['error'](_0x6e50('0x18'),_0x3dca4f,_0x2eb440);_0x5626a5(_0x2eb440);});});}exports[_0x6e50('0x1b')]=function(_0x3d02ad){var _0x2aa129=this;return new Promise(function(_0x31684a,_0xbb3b02){return db[_0x6e50('0x1c')][_0x6e50('0x1d')](_0x3d02ad[_0x6e50('0x1e')],{'raw':_0x3d02ad['options']?_0x3d02ad[_0x6e50('0x1f')][_0x6e50('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3d02ad[_0x6e50('0x1f')]?_0x3d02ad['options']['where']||null:null,'attributes':_0x3d02ad['options']?_0x3d02ad[_0x6e50('0x1f')][_0x6e50('0x21')]||null:null,'limit':_0x3d02ad['options']?_0x3d02ad['options'][_0x6e50('0x22')]||null:null})[_0x6e50('0x23')](function(_0x34e987){logger[_0x6e50('0x11')]('UpdateOpenchannelInteraction',_0x3d02ad);logger[_0x6e50('0x13')]('UpdateOpenchannelInteraction',_0x3d02ad,JSON[_0x6e50('0x24')](_0x34e987));_0x31684a(_0x34e987);})[_0x6e50('0x1a')](function(_0x1ed048){logger['error'](_0x6e50('0x1b'),_0x1ed048[_0x6e50('0x17')],_0x3d02ad);_0xbb3b02(_0x2aa129['error'](0x1f4,_0x1ed048[_0x6e50('0x17')]));});});};exports[_0x6e50('0x25')]=function(_0xcdc486){return new Promise(function(_0xff6a50,_0x1794c0){return db[_0x6e50('0x1c')][_0x6e50('0x26')]({'where':_0xcdc486[_0x6e50('0x1f')]?_0xcdc486[_0x6e50('0x1f')][_0x6e50('0x27')]||null:null})[_0x6e50('0x23')](function(_0x43dd61){if(_0x43dd61){return _0x43dd61[_0x6e50('0x28')](_0xcdc486['body']['ids'],_[_0x6e50('0x29')](_0xcdc486[_0x6e50('0x1e')],[_0x6e50('0x2a'),'id'])||{});}})[_0x6e50('0x2b')](function(_0x23e49d){logger[_0x6e50('0x11')](_0x6e50('0x2c'),_0xcdc486);logger['debug']('AddTags',_0xcdc486,JSON['stringify'](_0x23e49d));_0xff6a50(_0x23e49d);})[_0x6e50('0x1a')](function(_0x2a168a){logger[_0x6e50('0x16')](_0x6e50('0x2c'),_0x2a168a[_0x6e50('0x17')],_0xcdc486);_0x1794c0(_this[_0x6e50('0x16')](0x1f4,_0x2a168a[_0x6e50('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index ab5b640..ccf3bb9 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 _0x1855=['emit','register','openchannelInteraction:','save','remove','update'];(function(_0x321f6c,_0x5627aa){var _0x34c3f9=function(_0x50a9bf){while(--_0x50a9bf){_0x321f6c['push'](_0x321f6c['shift']());}};_0x34c3f9(++_0x5627aa);}(_0x1855,0x117));var _0x5185=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0x1855[_0x3ce3c];return _0x55a2c9;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=[_0x5185('0x0'),_0x5185('0x1'),_0x5185('0x2')];function createListener(_0x4d7359,_0x137b1b){return function(_0x79c3ac){_0x137b1b[_0x5185('0x3')](_0x4d7359,_0x79c3ac);};}function removeListener(_0x16d0dd,_0x27c35b){return function(){OpenchannelInteractionEvents['removeListener'](_0x16d0dd,_0x27c35b);};}exports[_0x5185('0x4')]=function(_0x26ac6c){for(var _0x19da0a=0x0,_0x1fff99=events['length'];_0x19da0a<_0x1fff99;_0x19da0a++){var _0x52ea01=events[_0x19da0a];var _0x4c7ff2=createListener(_0x5185('0x5')+_0x52ea01,_0x26ac6c);OpenchannelInteractionEvents['on'](_0x52ea01,_0x4c7ff2);}}; \ No newline at end of file +var _0x0104=['removeListener','register','length','openchannelInteraction:','./openchannelInteraction.events','save','remove','emit'];(function(_0x5ed3b1,_0x3e59b2){var _0x3cc545=function(_0x2ed553){while(--_0x2ed553){_0x5ed3b1['push'](_0x5ed3b1['shift']());}};_0x3cc545(++_0x3e59b2);}(_0x0104,0x184));var _0x4010=function(_0xb83526,_0x473f03){_0xb83526=_0xb83526-0x0;var _0x1d686d=_0x0104[_0xb83526];return _0x1d686d;};'use strict';var OpenchannelInteractionEvents=require(_0x4010('0x0'));var events=[_0x4010('0x1'),_0x4010('0x2'),'update'];function createListener(_0x5b0a03,_0x517673){return function(_0xc65990){_0x517673[_0x4010('0x3')](_0x5b0a03,_0xc65990);};}function removeListener(_0x32591e,_0x665cf6){return function(){OpenchannelInteractionEvents[_0x4010('0x4')](_0x32591e,_0x665cf6);};}exports[_0x4010('0x5')]=function(_0x2691b0){for(var _0x313e13=0x0,_0xbc609d=events[_0x4010('0x6')];_0x313e13<_0xbc609d;_0x313e13++){var _0x17fc74=events[_0x313e13];var _0x2e02a1=createListener(_0x4010('0x7')+_0x17fc74,_0x2691b0);OpenchannelInteractionEvents['on'](_0x17fc74,_0x2e02a1);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 6f2f70b..c789fb8 100644 --- a/server/api/openchannelMessage/index.js +++ b/server/api/openchannelMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['get','isAuthenticated','index','/describe','describe','/:id','post','tracked','openchannel','openchannelmessage:create','put','update','accept','/:id/reject','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelMessage.controller'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var controller=require(_0x3071('0x7'));router[_0x3071('0x8')]('/',auth[_0x3071('0x9')](),controller[_0x3071('0xa')]);router[_0x3071('0x8')](_0x3071('0xb'),auth[_0x3071('0x9')](),controller[_0x3071('0xc')]);router[_0x3071('0x8')](_0x3071('0xd'),auth[_0x3071('0x9')](),controller['show']);router[_0x3071('0xe')]('/',auth[_0x3071('0x9')](),interaction[_0x3071('0xf')](_0x3071('0x10'),_0x3071('0x11')),controller['create']);router[_0x3071('0x12')](_0x3071('0xd'),auth[_0x3071('0x9')](),controller[_0x3071('0x13')]);router[_0x3071('0x12')]('/:id/accept',auth['isAuthenticated'](),controller[_0x3071('0x14')]);router['put'](_0x3071('0x15'),auth[_0x3071('0x9')](),controller['reject']);router[_0x3071('0x16')]('/:id',auth[_0x3071('0x9')](),controller[_0x3071('0x17')]);module[_0x3071('0x18')]=router; \ No newline at end of file +var _0x0713=['get','isAuthenticated','index','/describe','describe','/:id','post','tracked','openchannel','openchannelmessage:create','put','update','accept','/:id/reject','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelMessage.controller'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var controller=require(_0x3071('0x7'));router[_0x3071('0x8')]('/',auth[_0x3071('0x9')](),controller[_0x3071('0xa')]);router[_0x3071('0x8')](_0x3071('0xb'),auth[_0x3071('0x9')](),controller[_0x3071('0xc')]);router[_0x3071('0x8')](_0x3071('0xd'),auth[_0x3071('0x9')](),controller['show']);router[_0x3071('0xe')]('/',auth[_0x3071('0x9')](),interaction[_0x3071('0xf')](_0x3071('0x10'),_0x3071('0x11')),controller['create']);router[_0x3071('0x12')](_0x3071('0xd'),auth[_0x3071('0x9')](),controller[_0x3071('0x13')]);router[_0x3071('0x12')]('/:id/accept',auth['isAuthenticated'](),controller[_0x3071('0x14')]);router['put'](_0x3071('0x15'),auth[_0x3071('0x9')](),controller['reject']);router[_0x3071('0x16')]('/:id',auth[_0x3071('0x9')](),controller[_0x3071('0x17')]);module[_0x3071('0x18')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index f65af8f..be8abe1 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 _0xae2b=['BOOLEAN','ENUM','out','STRING','sequelize','exports','medium'];(function(_0x5b720e,_0x3c7991){var _0x2193ca=function(_0x3fdcc6){while(--_0x3fdcc6){_0x5b720e['push'](_0x5b720e['shift']());}};_0x2193ca(++_0x3c7991);}(_0xae2b,0xb3));var _0xbae2=function(_0x593121,_0x14080e){_0x593121=_0x593121-0x0;var _0x3185e7=_0xae2b[_0x593121];return _0x3185e7;};'use strict';var Sequelize=require(_0xbae2('0x0'));module[_0xbae2('0x1')]={'body':{'type':Sequelize['TEXT'](_0xbae2('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xbae2('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0xbae2('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xbae2('0x4')]('in',_0xbae2('0x5')),'defaultValue':_0xbae2('0x5'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0xbae2('0x6')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x9ffd=['DATE','STRING','sequelize','exports','TEXT','BOOLEAN','ENUM','out'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x1452e7,_0x4e97da){_0x1452e7=_0x1452e7-0x0;var _0x32dfff=_0x9ffd[_0x1452e7];return _0x32dfff;};'use strict';var Sequelize=require(_0xd9ff('0x0'));module[_0xd9ff('0x1')]={'body':{'type':Sequelize[_0xd9ff('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xd9ff('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0xd9ff('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xd9ff('0x4')]('in',_0xd9ff('0x5')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0xd9ff('0x6')]},'providerName':{'type':Sequelize[_0xd9ff('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 95af6fd..d1d1ffe 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 _0xe64b=['rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','./openchannelMessage.socket','jayson/promise','http','client','request','then','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','OpenchannelMessage,\x20%s,\x20%s','message','info','result','catch','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','destroy','name','send','index','map','OpenchannelMessage','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','filter','merge','options','includeAll','include','rows','rawAttributes','find','create','body','update','params','describe','openchannel-interactions','openchannel','read','format','UserId','user','agent','get','OpenchannelInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','acceptMessage','sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','OpenchannelInteraction','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','rejectmessage','eml-format'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe64b,0x188));var _0xbe64=function(_0x28d48a,_0x233331){_0x28d48a=_0x28d48a-0x0;var _0x447585=_0xe64b[_0x28d48a];return _0x447585;};'use strict';var emlformat=require(_0xbe64('0x0'));var rimraf=require(_0xbe64('0x1'));var zipdir=require(_0xbe64('0x2'));var jsonpatch=require(_0xbe64('0x3'));var rp=require(_0xbe64('0x4'));var moment=require(_0xbe64('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xbe64('0x6'));var util=require('util');var path=require(_0xbe64('0x7'));var sox=require(_0xbe64('0x8'));var csv=require(_0xbe64('0x9'));var ejs=require(_0xbe64('0xa'));var fs=require('fs');var fs_extra=require(_0xbe64('0xb'));var _=require(_0xbe64('0xc'));var squel=require(_0xbe64('0xd'));var crypto=require(_0xbe64('0xe'));var jsforce=require(_0xbe64('0xf'));var deskjs=require(_0xbe64('0x10'));var toCsv=require(_0xbe64('0x9'));var querystring=require(_0xbe64('0x11'));var Papa=require(_0xbe64('0x12'));var Redis=require(_0xbe64('0x13'));var authService=require(_0xbe64('0x14'));var qs=require(_0xbe64('0x15'));var as=require(_0xbe64('0x16'));var hardwareService=require(_0xbe64('0x17'));var logger=require(_0xbe64('0x18'))(_0xbe64('0x19'));var utils=require('../../config/utils');var config=require(_0xbe64('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0xbe64('0x1b'))['db'];config[_0xbe64('0x1c')]=_['defaults'](config[_0xbe64('0x1c')],{'host':_0xbe64('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xbe64('0x1e'))['register'](socket);var jayson=require(_0xbe64('0x1f'));var client=jayson['client'][_0xbe64('0x20')]({'port':0x232c});var client9002=jayson[_0xbe64('0x21')][_0xbe64('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x50e7f6,_0x34c3e9,_0x4bc3a3,_0x24b5bb){return new BPromise(function(_0x2fe890,_0x2192e8){var _0x3aaa89=_0x24b5bb||client;return _0x3aaa89[_0xbe64('0x22')](_0x50e7f6,_0x4bc3a3)[_0xbe64('0x23')](function(_0x110a5a){logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0x34c3e9,'request\x20sent');logger[_0xbe64('0x24')](_0xbe64('0x25'),_0x34c3e9,_0xbe64('0x26'),JSON[_0xbe64('0x27')](_0x110a5a));if(_0x110a5a[_0xbe64('0x28')]){if(_0x110a5a[_0xbe64('0x28')][_0xbe64('0x29')]===0x1f4){logger['error'](_0xbe64('0x2a'),_0x34c3e9,_0x110a5a[_0xbe64('0x28')]['message']);return _0x2192e8(_0x110a5a[_0xbe64('0x28')][_0xbe64('0x2b')]);}logger[_0xbe64('0x28')](_0xbe64('0x2a'),_0x34c3e9,_0x110a5a[_0xbe64('0x28')][_0xbe64('0x2b')]);return _0x2fe890(_0x110a5a[_0xbe64('0x28')]['message']);}else{logger[_0xbe64('0x2c')](_0xbe64('0x2a'),_0x34c3e9,'request\x20sent');_0x2fe890(_0x110a5a[_0xbe64('0x2d')]['message']);}})[_0xbe64('0x2e')](function(_0x38f3a6){logger['error'](_0xbe64('0x2a'),_0x34c3e9,_0x38f3a6);_0x2192e8(_0x38f3a6);});});}function respondWithStatusCode(_0x5558a5,_0x4896a0){_0x4896a0=_0x4896a0||0xcc;return function(_0x448792){if(_0x448792){return _0x5558a5['sendStatus'](_0x4896a0);}return _0x5558a5[_0xbe64('0x2f')](_0x4896a0)[_0xbe64('0x30')]();};}function respondWithResult(_0x3b6ba9,_0x4ef80f){_0x4ef80f=_0x4ef80f||0xc8;return function(_0x3dfbba){if(_0x3dfbba){return _0x3b6ba9['status'](_0x4ef80f)['json'](_0x3dfbba);}};}function respondWithFilteredResult(_0x627fa3,_0x1e54b5){return function(_0x5e6502){if(_0x5e6502){var _0x20cc91=typeof _0x1e54b5[_0xbe64('0x31')]===_0xbe64('0x32')&&typeof _0x1e54b5[_0xbe64('0x33')]==='undefined';var _0x1c673a=_0x5e6502[_0xbe64('0x34')];var _0x197c7c=_0x20cc91?0x0:_0x1e54b5[_0xbe64('0x31')];var _0x52a137=_0x20cc91?_0x5e6502['count']:_0x1e54b5[_0xbe64('0x31')]+_0x1e54b5['limit'];var _0x909a17;if(_0x52a137>=_0x1c673a){_0x52a137=_0x1c673a;_0x909a17=0xc8;}else{_0x909a17=0xce;}_0x627fa3[_0xbe64('0x2f')](_0x909a17);return _0x627fa3[_0xbe64('0x35')](_0xbe64('0x36'),_0x197c7c+'-'+_0x52a137+'/'+_0x1c673a)[_0xbe64('0x37')](_0x5e6502);}return null;};}function patchUpdates(_0x1b2cc){return function(_0x23c0d3){try{jsonpatch[_0xbe64('0x38')](_0x23c0d3,_0x1b2cc,!![]);}catch(_0x3ee91a){return BPromise[_0xbe64('0x39')](_0x3ee91a);}return _0x23c0d3['save']();};}function saveUpdates(_0x31f959,_0xbb2a55){return function(_0x467932){if(_0x467932){return _0x467932['update'](_0x31f959)[_0xbe64('0x23')](function(_0x1e75f8){return _0x1e75f8;});}return null;};}function removeEntity(_0x5a3ee0,_0x3f2195){return function(_0xbd9de9){if(_0xbd9de9){return _0xbd9de9[_0xbe64('0x3a')]()[_0xbe64('0x23')](function(){_0x5a3ee0[_0xbe64('0x2f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x10e90e,_0x59a935){return function(_0x1f97fb){if(!_0x1f97fb){_0x10e90e['sendStatus'](0x194);}return _0x1f97fb;};}function handleError(_0x49ca6c,_0x1d9eb1){_0x1d9eb1=_0x1d9eb1||0x1f4;return function(_0x9b0757){logger[_0xbe64('0x28')](_0x9b0757['stack']);if(_0x9b0757[_0xbe64('0x3b')]){delete _0x9b0757[_0xbe64('0x3b')];}_0x49ca6c[_0xbe64('0x2f')](_0x1d9eb1)[_0xbe64('0x3c')](_0x9b0757);};}exports[_0xbe64('0x3d')]=function(_0x2e8259,_0x139ad8){var _0x380fbb={},_0x4c330c={},_0x3206bc={'count':0x0,'rows':[]};var _0x171fdb=_[_0xbe64('0x3e')](db[_0xbe64('0x3f')]['rawAttributes'],function(_0x1ca6e1){return{'name':_0x1ca6e1[_0xbe64('0x40')],'type':_0x1ca6e1[_0xbe64('0x41')][_0xbe64('0x42')]};});_0x4c330c[_0xbe64('0x43')]=_[_0xbe64('0x3e')](_0x171fdb,_0xbe64('0x3b'));_0x4c330c[_0xbe64('0x44')]=_[_0xbe64('0x45')](_0x2e8259[_0xbe64('0x44')]);_0x4c330c[_0xbe64('0x46')]=_[_0xbe64('0x47')](_0x4c330c['model'],_0x4c330c[_0xbe64('0x44')]);_0x380fbb[_0xbe64('0x48')]=_[_0xbe64('0x47')](_0x4c330c['model'],qs['fields'](_0x2e8259[_0xbe64('0x44')][_0xbe64('0x49')]));_0x380fbb[_0xbe64('0x48')]=_0x380fbb[_0xbe64('0x48')][_0xbe64('0x4a')]?_0x380fbb[_0xbe64('0x48')]:_0x4c330c[_0xbe64('0x43')];if(!_0x2e8259[_0xbe64('0x44')]['hasOwnProperty']('nolimit')){_0x380fbb[_0xbe64('0x33')]=qs[_0xbe64('0x33')](_0x2e8259[_0xbe64('0x44')][_0xbe64('0x33')]);_0x380fbb[_0xbe64('0x31')]=qs[_0xbe64('0x31')](_0x2e8259[_0xbe64('0x44')]['offset']);}_0x380fbb[_0xbe64('0x4b')]=qs[_0xbe64('0x4c')](_0x2e8259['query']['sort']);_0x380fbb[_0xbe64('0x4d')]=qs[_0xbe64('0x46')](_['pick'](_0x2e8259[_0xbe64('0x44')],_0x4c330c[_0xbe64('0x46')]),_0x171fdb);if(_0x2e8259[_0xbe64('0x44')][_0xbe64('0x4e')]){_0x380fbb['where']=_[_0xbe64('0x4f')](_0x380fbb['where'],{'$or':_[_0xbe64('0x3e')](_0x171fdb,function(_0x11e254){if(_0x11e254[_0xbe64('0x41')]!=='VIRTUAL'){var _0x4d7fd7={};_0x4d7fd7[_0x11e254[_0xbe64('0x3b')]]={'$like':'%'+_0x2e8259[_0xbe64('0x44')][_0xbe64('0x4e')]+'%'};return _0x4d7fd7;}})});}_0x380fbb=_[_0xbe64('0x4f')]({},_0x380fbb,_0x2e8259[_0xbe64('0x50')]);var _0x294b35={'where':_0x380fbb[_0xbe64('0x4d')]};return db[_0xbe64('0x3f')][_0xbe64('0x34')](_0x294b35)['then'](function(_0x54c7a1){_0x3206bc[_0xbe64('0x34')]=_0x54c7a1;if(_0x2e8259[_0xbe64('0x44')][_0xbe64('0x51')]){_0x380fbb[_0xbe64('0x52')]=[{'all':!![]}];}return db[_0xbe64('0x3f')]['findAll'](_0x380fbb);})[_0xbe64('0x23')](function(_0x1a0908){_0x3206bc[_0xbe64('0x53')]=_0x1a0908;return _0x3206bc;})[_0xbe64('0x23')](respondWithFilteredResult(_0x139ad8,_0x380fbb))['catch'](handleError(_0x139ad8,null));};exports['show']=function(_0x536c15,_0x3117a8){var _0x17dfe0={'raw':!![],'where':{'id':_0x536c15['params']['id']}},_0x46762d={};_0x46762d[_0xbe64('0x43')]=_[_0xbe64('0x45')](db['OpenchannelMessage'][_0xbe64('0x54')]);_0x46762d[_0xbe64('0x44')]=_[_0xbe64('0x45')](_0x536c15[_0xbe64('0x44')]);_0x46762d[_0xbe64('0x46')]=_[_0xbe64('0x47')](_0x46762d[_0xbe64('0x43')],_0x46762d[_0xbe64('0x44')]);_0x17dfe0[_0xbe64('0x48')]=_[_0xbe64('0x47')](_0x46762d['model'],qs[_0xbe64('0x49')](_0x536c15[_0xbe64('0x44')][_0xbe64('0x49')]));_0x17dfe0[_0xbe64('0x48')]=_0x17dfe0[_0xbe64('0x48')][_0xbe64('0x4a')]?_0x17dfe0['attributes']:_0x46762d[_0xbe64('0x43')];if(_0x536c15[_0xbe64('0x44')][_0xbe64('0x51')]){_0x17dfe0[_0xbe64('0x52')]=[{'all':!![]}];}_0x17dfe0=_['merge']({},_0x17dfe0,_0x536c15['options']);return db[_0xbe64('0x3f')][_0xbe64('0x55')](_0x17dfe0)['then'](handleEntityNotFound(_0x3117a8,null))[_0xbe64('0x23')](respondWithResult(_0x3117a8,null))[_0xbe64('0x2e')](handleError(_0x3117a8,null));};exports['create']=function(_0x43637a,_0x397ead){return db[_0xbe64('0x3f')][_0xbe64('0x56')](_0x43637a[_0xbe64('0x57')],{})[_0xbe64('0x23')](respondWithResult(_0x397ead,0xc9))[_0xbe64('0x2e')](handleError(_0x397ead,null));};exports[_0xbe64('0x58')]=function(_0xf29db6,_0x4f44a2){if(_0xf29db6[_0xbe64('0x57')]['id']){delete _0xf29db6[_0xbe64('0x57')]['id'];}return db[_0xbe64('0x3f')][_0xbe64('0x55')]({'where':{'id':_0xf29db6[_0xbe64('0x59')]['id']}})[_0xbe64('0x23')](handleEntityNotFound(_0x4f44a2,null))[_0xbe64('0x23')](saveUpdates(_0xf29db6[_0xbe64('0x57')],null))[_0xbe64('0x23')](respondWithResult(_0x4f44a2,null))[_0xbe64('0x2e')](handleError(_0x4f44a2,null));};exports[_0xbe64('0x3a')]=function(_0xfc6613,_0x48e3b3){return db[_0xbe64('0x3f')][_0xbe64('0x55')]({'where':{'id':_0xfc6613[_0xbe64('0x59')]['id']}})[_0xbe64('0x23')](handleEntityNotFound(_0x48e3b3,null))[_0xbe64('0x23')](removeEntity(_0x48e3b3,null))[_0xbe64('0x2e')](handleError(_0x48e3b3,null));};exports[_0xbe64('0x5a')]=function(_0x1326f1,_0x5a98bd){return db[_0xbe64('0x3f')][_0xbe64('0x5a')]()[_0xbe64('0x23')](respondWithResult(_0x5a98bd,null))['catch'](handleError(_0x5a98bd,null));};var interaction_log=require(_0xbe64('0x18'))(_0xbe64('0x5b'));exports['accept']=function(_0x494e6e,_0x13235c,_0x44cf6c){var _0x29e038={'agent':{},'channel':_0xbe64('0x5c')};if(_0x494e6e[_0xbe64('0x57')]['id']){delete _0x494e6e[_0xbe64('0x57')]['id'];}_0x494e6e['body'][_0xbe64('0x5d')]=!![];_0x494e6e['body']['readAt']=moment()[_0xbe64('0x5e')]('YYYY-MM-DD\x20HH:mm:ss');_0x494e6e[_0xbe64('0x57')]['UserId']=_0x494e6e[_0xbe64('0x57')][_0xbe64('0x5f')]||_0x494e6e[_0xbe64('0x60')]['id'];_0x29e038[_0xbe64('0x61')]['id']=_0x494e6e[_0xbe64('0x57')][_0xbe64('0x5f')];return db[_0xbe64('0x3f')][_0xbe64('0x55')]({'where':{'id':_0x494e6e[_0xbe64('0x59')]['id'],'UserId':null}})[_0xbe64('0x23')](handleEntityNotFound(_0x13235c,null))[_0xbe64('0x23')](saveUpdates(_0x494e6e[_0xbe64('0x57')],null))[_0xbe64('0x23')](function(_0x41c811){if(_0x41c811){_0x29e038['message']=_0x41c811[_0xbe64('0x62')]({'plain':!![]});return db['OpenchannelInteraction'][_0xbe64('0x55')]({'where':{'id':_0x41c811[_0xbe64('0x63')]}});}return null;})[_0xbe64('0x23')](handleEntityNotFound(_0x13235c,null))['then'](function(_0xd2393){if(_0xd2393){return _0xd2393[_0xbe64('0x58')]({'UserId':_0x494e6e[_0xbe64('0x57')][_0xbe64('0x5f')],'read1stAt':_[_0xbe64('0x64')](_0xd2393[_0xbe64('0x65')])?moment()[_0xbe64('0x5e')](_0xbe64('0x66')):undefined});}return null;})[_0xbe64('0x23')](function(_0x1c4209){if(_0x1c4209){_0x29e038[_0xbe64('0x67')]=_0x1c4209[_0xbe64('0x62')]({'plain':!![]});interaction_log[_0xbe64('0x2c')](_0xbe64('0x68'),_0x494e6e['user']['id'],_0x494e6e['user'][_0xbe64('0x3b')],_0x494e6e[_0xbe64('0x60')]['role'],_0x29e038[_0xbe64('0x67')]['id'],_0x494e6e[_0xbe64('0x57')]?JSON[_0xbe64('0x27')](_0x494e6e[_0xbe64('0x57')]):_0xbe64('0x69'));return respondWithRpcPromise(_0xbe64('0x6a'),_0xbe64('0x6b'),_0x29e038);}return null;})['then'](function(_0xe4d9c2){var _0x29054a='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0xe4d9c2[_0xbe64('0x2b')]['ContactId'];return db[_0xbe64('0x6c')][_0xbe64('0x44')](_0x29054a,{'type':db['Sequelize'][_0xbe64('0x6d')][_0xbe64('0x6e')],'raw':!![]})[_0xbe64('0x23')](function(_0x1a3a5b){return _0x1a3a5b;});})['then'](function(_0x5c64b4){if(_0x5c64b4){_0x29e038[_0xbe64('0x2b')][_0xbe64('0x6f')]=_0x5c64b4[0x0];if(!_0x494e6e['body'][_0xbe64('0x5f')])return;return db[_0xbe64('0x70')][_0xbe64('0x55')]({'where':{'id':_0x494e6e[_0xbe64('0x57')][_0xbe64('0x5f')],'role':'agent'},'attributes':['id','name',_0xbe64('0x71'),_0xbe64('0x72'),_0xbe64('0x73')],'raw':!![]});}return null;})[_0xbe64('0x23')](function(_0x291e5b){if(!_0x291e5b)return null;_0x29e038[_0xbe64('0x2b')]['agent']=_0x291e5b;return _0x29e038;})[_0xbe64('0x23')](function(_0xb389f2){if(_0xb389f2){if(_0x494e6e['body'][_0xbe64('0x74')]){_0x29e038['message'][_0xbe64('0x75')]=util[_0xbe64('0x5e')](_0xbe64('0x76'),_0x494e6e[_0xbe64('0x60')][_0xbe64('0x3b')]);_0x29e038[_0xbe64('0x2b')][_0xbe64('0x77')]=_0x29e038[_0xbe64('0x77')];_0x29e038[_0xbe64('0x2b')]['motionChannel']=_0x29e038[_0xbe64('0x77')];_0x29e038[_0xbe64('0x2b')][_0xbe64('0x78')]='accept';return respondWithRpcPromise(_0xbe64('0x79'),_0xbe64('0x79'),{'event':_0xbe64('0x7a'),'message':_0x29e038[_0xbe64('0x2b')]},client9002)['then'](function(){return _0x29e038;});}return _0x29e038;}return null;})['then'](respondWithResult(_0x13235c,null))['catch'](handleError(_0x13235c,null));};var interaction_log=require(_0xbe64('0x18'))('openchannel-interactions');exports[_0xbe64('0x39')]=function(_0x2232d4,_0x3af7b5,_0x4d142d){var _0x745fd6={'agent':{},'channel':_0xbe64('0x5c')};if(_0x2232d4['body']['id']){delete _0x2232d4[_0xbe64('0x57')]['id'];}_0x2232d4[_0xbe64('0x57')]['UserId']=_0x2232d4[_0xbe64('0x57')][_0xbe64('0x5f')]||_0x2232d4['user']['id'];_0x745fd6[_0xbe64('0x61')]['id']=_0x2232d4[_0xbe64('0x57')][_0xbe64('0x5f')];return db['OpenchannelMessage'][_0xbe64('0x55')]({'where':{'id':_0x2232d4['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x3af7b5,null))[_0xbe64('0x23')](function(_0x4644b8){if(_0x4644b8){_0x745fd6[_0xbe64('0x2b')]=_0x4644b8[_0xbe64('0x62')]({'plain':!![]});return db[_0xbe64('0x7b')][_0xbe64('0x55')]({'where':{'id':_0x4644b8['OpenchannelInteractionId']}});}return null;})[_0xbe64('0x23')](handleEntityNotFound(_0x3af7b5,null))[_0xbe64('0x23')](function(_0x39e35c){if(_0x39e35c){_0x745fd6[_0xbe64('0x67')]=_0x39e35c[_0xbe64('0x62')]({'plain':!![]});interaction_log[_0xbe64('0x2c')](_0xbe64('0x7c'),_0x2232d4[_0xbe64('0x60')]['id'],_0x2232d4[_0xbe64('0x60')]['name'],_0x2232d4[_0xbe64('0x60')][_0xbe64('0x7d')],_0x745fd6[_0xbe64('0x67')]['id'],_0x2232d4[_0xbe64('0x57')]?JSON[_0xbe64('0x27')](_0x2232d4[_0xbe64('0x57')]):_0xbe64('0x69'));return respondWithRpcPromise(_0xbe64('0x7e'),_0xbe64('0x7f'),_0x745fd6);}return null;})['then'](function(_0x2ef917){var _0xee5e3d=_0xbe64('0x80')+_0x2ef917[_0xbe64('0x2b')][_0xbe64('0x81')];return db[_0xbe64('0x6c')][_0xbe64('0x44')](_0xee5e3d,{'type':db['Sequelize'][_0xbe64('0x6d')][_0xbe64('0x6e')],'raw':!![]})[_0xbe64('0x23')](function(_0x498df4){return _0x498df4;});})[_0xbe64('0x23')](function(_0x22827e){if(_0x22827e){_0x745fd6[_0xbe64('0x2b')]['contact']=_0x22827e[0x0];if(!_0x2232d4[_0xbe64('0x57')]['UserId'])return;return db[_0xbe64('0x70')][_0xbe64('0x55')]({'where':{'id':_0x2232d4[_0xbe64('0x57')][_0xbe64('0x5f')],'role':_0xbe64('0x61')},'attributes':['id',_0xbe64('0x3b'),_0xbe64('0x71'),_0xbe64('0x72'),_0xbe64('0x73')],'raw':!![]});}return null;})[_0xbe64('0x23')](function(_0x42dfd9){if(!_0x42dfd9)return null;_0x745fd6[_0xbe64('0x2b')][_0xbe64('0x61')]=_0x42dfd9;return _0x745fd6;})[_0xbe64('0x23')](function(_0x1dfc88){if(_0x1dfc88){_0x1dfc88[_0xbe64('0x2b')]['interface']=util['format'](_0xbe64('0x76'),_0x2232d4[_0xbe64('0x60')][_0xbe64('0x3b')]);_0x1dfc88['message']['channel']=_0x745fd6[_0xbe64('0x77')];_0x1dfc88[_0xbe64('0x2b')]['motionChannel']=_0x745fd6['channel'];_0x1dfc88[_0xbe64('0x2b')][_0xbe64('0x78')]='reject';respondWithRpcPromise(_0xbe64('0x79'),_0xbe64('0x79'),{'event':_0xbe64('0x82'),'message':_0x1dfc88[_0xbe64('0x2b')]},client9002);return _0x745fd6;}return null;})[_0xbe64('0x23')](respondWithResult(_0x3af7b5,null))[_0xbe64('0x2e')](handleError(_0x3af7b5,null));}; \ No newline at end of file +var _0x00cd=['redis','register','client','http','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','stack','name','send','index','map','OpenchannelMessage','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','filter','options','includeAll','include','findAll','rows','show','params','keys','length','create','body','find','describe','../../config/logger','openchannel-interactions','read','readAt','format','user','UserId','get','OpenchannelInteraction','OpenchannelInteractionId','update','isNil','YYYY-MM-DD\x20HH:mm:ss','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','contact','User','agent','fullname','email','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','sequelize','internal','rejectmessage','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','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/environment','../../config/license/util','localhost','socket.io-emitter'];(function(_0x3b606e,_0x1e94e4){var _0x14722c=function(_0x53441e){while(--_0x53441e){_0x3b606e['push'](_0x3b606e['shift']());}};_0x14722c(++_0x1e94e4);}(_0x00cd,0xee));var _0xd00c=function(_0xf2f332,_0x299fbf){_0xf2f332=_0xf2f332-0x0;var _0x56cce3=_0x00cd[_0xf2f332];return _0x56cce3;};'use strict';var emlformat=require(_0xd00c('0x0'));var rimraf=require(_0xd00c('0x1'));var zipdir=require(_0xd00c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xd00c('0x3'));var BPromise=require(_0xd00c('0x4'));var Mustache=require(_0xd00c('0x5'));var util=require(_0xd00c('0x6'));var path=require(_0xd00c('0x7'));var sox=require('sox');var csv=require(_0xd00c('0x8'));var ejs=require(_0xd00c('0x9'));var fs=require('fs');var fs_extra=require(_0xd00c('0xa'));var _=require(_0xd00c('0xb'));var squel=require(_0xd00c('0xc'));var crypto=require(_0xd00c('0xd'));var jsforce=require(_0xd00c('0xe'));var deskjs=require(_0xd00c('0xf'));var toCsv=require(_0xd00c('0x8'));var querystring=require(_0xd00c('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xd00c('0x11'));var qs=require(_0xd00c('0x12'));var as=require(_0xd00c('0x13'));var hardwareService=require(_0xd00c('0x14'));var logger=require('../../config/logger')(_0xd00c('0x15'));var utils=require('../../config/utils');var config=require(_0xd00c('0x16'));var licenseUtil=require(_0xd00c('0x17'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config['redis'],{'host':_0xd00c('0x18'),'port':0x18eb});var socket=require(_0xd00c('0x19'))(new Redis(config[_0xd00c('0x1a')]));require('./openchannelMessage.socket')[_0xd00c('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson[_0xd00c('0x1c')][_0xd00c('0x1d')]({'port':0x232c});var client9002=jayson[_0xd00c('0x1c')]['http']({'port':0x232a});function respondWithRpcPromise(_0x50b22e,_0x41f67c,_0x3ccf95,_0x15fddd){return new BPromise(function(_0x1d7728,_0x3462ca){var _0x2a5531=_0x15fddd||client;return _0x2a5531[_0xd00c('0x1e')](_0x50b22e,_0x3ccf95)[_0xd00c('0x1f')](function(_0x4e21ac){logger[_0xd00c('0x20')](_0xd00c('0x21'),_0x41f67c,_0xd00c('0x22'));logger['debug']('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x41f67c,_0xd00c('0x22'),JSON[_0xd00c('0x23')](_0x4e21ac));if(_0x4e21ac[_0xd00c('0x24')]){if(_0x4e21ac[_0xd00c('0x24')][_0xd00c('0x25')]===0x1f4){logger[_0xd00c('0x24')](_0xd00c('0x21'),_0x41f67c,_0x4e21ac['error'][_0xd00c('0x26')]);return _0x3462ca(_0x4e21ac[_0xd00c('0x24')][_0xd00c('0x26')]);}logger[_0xd00c('0x24')](_0xd00c('0x21'),_0x41f67c,_0x4e21ac['error']['message']);return _0x1d7728(_0x4e21ac[_0xd00c('0x24')][_0xd00c('0x26')]);}else{logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0x41f67c,'request\x20sent');_0x1d7728(_0x4e21ac[_0xd00c('0x27')]['message']);}})[_0xd00c('0x28')](function(_0x4a918f){logger[_0xd00c('0x24')](_0xd00c('0x21'),_0x41f67c,_0x4a918f);_0x3462ca(_0x4a918f);});});}function respondWithStatusCode(_0x4fc631,_0x4c78e9){_0x4c78e9=_0x4c78e9||0xcc;return function(_0x24f5c8){if(_0x24f5c8){return _0x4fc631[_0xd00c('0x29')](_0x4c78e9);}return _0x4fc631[_0xd00c('0x2a')](_0x4c78e9)[_0xd00c('0x2b')]();};}function respondWithResult(_0x56f50f,_0x2f8853){_0x2f8853=_0x2f8853||0xc8;return function(_0x322b2e){if(_0x322b2e){return _0x56f50f[_0xd00c('0x2a')](_0x2f8853)[_0xd00c('0x2c')](_0x322b2e);}};}function respondWithFilteredResult(_0x4987c5,_0x17e58d){return function(_0x5bb7c4){if(_0x5bb7c4){var _0x3e7e2c=typeof _0x17e58d[_0xd00c('0x2d')]===_0xd00c('0x2e')&&typeof _0x17e58d[_0xd00c('0x2f')]===_0xd00c('0x2e');var _0x399f2d=_0x5bb7c4[_0xd00c('0x30')];var _0x2a4fa4=_0x3e7e2c?0x0:_0x17e58d[_0xd00c('0x2d')];var _0x4ad9b0=_0x3e7e2c?_0x5bb7c4[_0xd00c('0x30')]:_0x17e58d[_0xd00c('0x2d')]+_0x17e58d[_0xd00c('0x2f')];var _0x3a0837;if(_0x4ad9b0>=_0x399f2d){_0x4ad9b0=_0x399f2d;_0x3a0837=0xc8;}else{_0x3a0837=0xce;}_0x4987c5[_0xd00c('0x2a')](_0x3a0837);return _0x4987c5[_0xd00c('0x31')](_0xd00c('0x32'),_0x2a4fa4+'-'+_0x4ad9b0+'/'+_0x399f2d)[_0xd00c('0x2c')](_0x5bb7c4);}return null;};}function patchUpdates(_0x4af28e){return function(_0x560370){try{jsonpatch[_0xd00c('0x33')](_0x560370,_0x4af28e,!![]);}catch(_0x4b0eff){return BPromise[_0xd00c('0x34')](_0x4b0eff);}return _0x560370[_0xd00c('0x35')]();};}function saveUpdates(_0x3bc464,_0x1af90a){return function(_0x408ea5){if(_0x408ea5){return _0x408ea5['update'](_0x3bc464)[_0xd00c('0x1f')](function(_0x33850f){return _0x33850f;});}return null;};}function removeEntity(_0x4e894b,_0x7388d3){return function(_0x400ca1){if(_0x400ca1){return _0x400ca1[_0xd00c('0x36')]()[_0xd00c('0x1f')](function(){_0x4e894b[_0xd00c('0x2a')](0xcc)[_0xd00c('0x2b')]();});}};}function handleEntityNotFound(_0x57a91f,_0x40c501){return function(_0x5b6345){if(!_0x5b6345){_0x57a91f[_0xd00c('0x29')](0x194);}return _0x5b6345;};}function handleError(_0x55199e,_0x4ac41e){_0x4ac41e=_0x4ac41e||0x1f4;return function(_0x5c1773){logger[_0xd00c('0x24')](_0x5c1773[_0xd00c('0x37')]);if(_0x5c1773[_0xd00c('0x38')]){delete _0x5c1773['name'];}_0x55199e[_0xd00c('0x2a')](_0x4ac41e)[_0xd00c('0x39')](_0x5c1773);};}exports[_0xd00c('0x3a')]=function(_0x572b8e,_0x3ffd0a){var _0x3c2560={},_0x2a61d9={},_0x21b6be={'count':0x0,'rows':[]};var _0x19fb28=_[_0xd00c('0x3b')](db[_0xd00c('0x3c')][_0xd00c('0x3d')],function(_0x1fdc4d){return{'name':_0x1fdc4d[_0xd00c('0x3e')],'type':_0x1fdc4d['type'][_0xd00c('0x3f')]};});_0x2a61d9[_0xd00c('0x40')]=_['map'](_0x19fb28,_0xd00c('0x38'));_0x2a61d9[_0xd00c('0x41')]=_['keys'](_0x572b8e[_0xd00c('0x41')]);_0x2a61d9[_0xd00c('0x42')]=_[_0xd00c('0x43')](_0x2a61d9[_0xd00c('0x40')],_0x2a61d9[_0xd00c('0x41')]);_0x3c2560[_0xd00c('0x44')]=_[_0xd00c('0x43')](_0x2a61d9[_0xd00c('0x40')],qs['fields'](_0x572b8e[_0xd00c('0x41')][_0xd00c('0x45')]));_0x3c2560[_0xd00c('0x44')]=_0x3c2560[_0xd00c('0x44')]['length']?_0x3c2560[_0xd00c('0x44')]:_0x2a61d9[_0xd00c('0x40')];if(!_0x572b8e['query'][_0xd00c('0x46')](_0xd00c('0x47'))){_0x3c2560[_0xd00c('0x2f')]=qs['limit'](_0x572b8e[_0xd00c('0x41')]['limit']);_0x3c2560['offset']=qs[_0xd00c('0x2d')](_0x572b8e['query'][_0xd00c('0x2d')]);}_0x3c2560[_0xd00c('0x48')]=qs[_0xd00c('0x49')](_0x572b8e[_0xd00c('0x41')][_0xd00c('0x49')]);_0x3c2560[_0xd00c('0x4a')]=qs[_0xd00c('0x42')](_[_0xd00c('0x4b')](_0x572b8e[_0xd00c('0x41')],_0x2a61d9[_0xd00c('0x42')]),_0x19fb28);if(_0x572b8e[_0xd00c('0x41')]['filter']){_0x3c2560[_0xd00c('0x4a')]=_[_0xd00c('0x4c')](_0x3c2560[_0xd00c('0x4a')],{'$or':_['map'](_0x19fb28,function(_0x4316e4){if(_0x4316e4[_0xd00c('0x4d')]!=='VIRTUAL'){var _0x594d70={};_0x594d70[_0x4316e4['name']]={'$like':'%'+_0x572b8e[_0xd00c('0x41')][_0xd00c('0x4e')]+'%'};return _0x594d70;}})});}_0x3c2560=_[_0xd00c('0x4c')]({},_0x3c2560,_0x572b8e[_0xd00c('0x4f')]);var _0x9b2c24={'where':_0x3c2560[_0xd00c('0x4a')]};return db[_0xd00c('0x3c')][_0xd00c('0x30')](_0x9b2c24)['then'](function(_0x240b55){_0x21b6be[_0xd00c('0x30')]=_0x240b55;if(_0x572b8e[_0xd00c('0x41')][_0xd00c('0x50')]){_0x3c2560[_0xd00c('0x51')]=[{'all':!![]}];}return db[_0xd00c('0x3c')][_0xd00c('0x52')](_0x3c2560);})[_0xd00c('0x1f')](function(_0x1ec799){_0x21b6be[_0xd00c('0x53')]=_0x1ec799;return _0x21b6be;})[_0xd00c('0x1f')](respondWithFilteredResult(_0x3ffd0a,_0x3c2560))[_0xd00c('0x28')](handleError(_0x3ffd0a,null));};exports[_0xd00c('0x54')]=function(_0x3d0917,_0x570c0b){var _0x815a5d={'raw':!![],'where':{'id':_0x3d0917[_0xd00c('0x55')]['id']}},_0x2b69a4={};_0x2b69a4[_0xd00c('0x40')]=_[_0xd00c('0x56')](db[_0xd00c('0x3c')]['rawAttributes']);_0x2b69a4[_0xd00c('0x41')]=_[_0xd00c('0x56')](_0x3d0917[_0xd00c('0x41')]);_0x2b69a4['filters']=_[_0xd00c('0x43')](_0x2b69a4[_0xd00c('0x40')],_0x2b69a4[_0xd00c('0x41')]);_0x815a5d['attributes']=_['intersection'](_0x2b69a4[_0xd00c('0x40')],qs[_0xd00c('0x45')](_0x3d0917[_0xd00c('0x41')][_0xd00c('0x45')]));_0x815a5d[_0xd00c('0x44')]=_0x815a5d['attributes'][_0xd00c('0x57')]?_0x815a5d['attributes']:_0x2b69a4[_0xd00c('0x40')];if(_0x3d0917['query']['includeAll']){_0x815a5d[_0xd00c('0x51')]=[{'all':!![]}];}_0x815a5d=_[_0xd00c('0x4c')]({},_0x815a5d,_0x3d0917[_0xd00c('0x4f')]);return db[_0xd00c('0x3c')]['find'](_0x815a5d)['then'](handleEntityNotFound(_0x570c0b,null))['then'](respondWithResult(_0x570c0b,null))[_0xd00c('0x28')](handleError(_0x570c0b,null));};exports['create']=function(_0x283309,_0x451fdf){return db[_0xd00c('0x3c')][_0xd00c('0x58')](_0x283309[_0xd00c('0x59')],{})[_0xd00c('0x1f')](respondWithResult(_0x451fdf,0xc9))['catch'](handleError(_0x451fdf,null));};exports['update']=function(_0x2ea075,_0xf30c00){if(_0x2ea075['body']['id']){delete _0x2ea075[_0xd00c('0x59')]['id'];}return db['OpenchannelMessage'][_0xd00c('0x5a')]({'where':{'id':_0x2ea075[_0xd00c('0x55')]['id']}})['then'](handleEntityNotFound(_0xf30c00,null))[_0xd00c('0x1f')](saveUpdates(_0x2ea075[_0xd00c('0x59')],null))['then'](respondWithResult(_0xf30c00,null))[_0xd00c('0x28')](handleError(_0xf30c00,null));};exports['destroy']=function(_0x374a8c,_0x2e60f2){return db[_0xd00c('0x3c')][_0xd00c('0x5a')]({'where':{'id':_0x374a8c[_0xd00c('0x55')]['id']}})['then'](handleEntityNotFound(_0x2e60f2,null))[_0xd00c('0x1f')](removeEntity(_0x2e60f2,null))[_0xd00c('0x28')](handleError(_0x2e60f2,null));};exports[_0xd00c('0x5b')]=function(_0x188381,_0x5dc79f){return db[_0xd00c('0x3c')][_0xd00c('0x5b')]()['then'](respondWithResult(_0x5dc79f,null))[_0xd00c('0x28')](handleError(_0x5dc79f,null));};var interaction_log=require(_0xd00c('0x5c'))(_0xd00c('0x5d'));exports['accept']=function(_0x1fdc6e,_0x32a224,_0x5627cb){var _0x30b608={'agent':{},'channel':'openchannel'};if(_0x1fdc6e[_0xd00c('0x59')]['id']){delete _0x1fdc6e[_0xd00c('0x59')]['id'];}_0x1fdc6e[_0xd00c('0x59')][_0xd00c('0x5e')]=!![];_0x1fdc6e[_0xd00c('0x59')][_0xd00c('0x5f')]=moment()[_0xd00c('0x60')]('YYYY-MM-DD\x20HH:mm:ss');_0x1fdc6e[_0xd00c('0x59')]['UserId']=_0x1fdc6e[_0xd00c('0x59')]['UserId']||_0x1fdc6e[_0xd00c('0x61')]['id'];_0x30b608['agent']['id']=_0x1fdc6e['body'][_0xd00c('0x62')];return db[_0xd00c('0x3c')][_0xd00c('0x5a')]({'where':{'id':_0x1fdc6e[_0xd00c('0x55')]['id'],'UserId':null}})[_0xd00c('0x1f')](handleEntityNotFound(_0x32a224,null))['then'](saveUpdates(_0x1fdc6e['body'],null))[_0xd00c('0x1f')](function(_0x3c3cb8){if(_0x3c3cb8){_0x30b608[_0xd00c('0x26')]=_0x3c3cb8[_0xd00c('0x63')]({'plain':!![]});return db[_0xd00c('0x64')][_0xd00c('0x5a')]({'where':{'id':_0x3c3cb8[_0xd00c('0x65')]}});}return null;})[_0xd00c('0x1f')](handleEntityNotFound(_0x32a224,null))['then'](function(_0x421b11){if(_0x421b11){return _0x421b11[_0xd00c('0x66')]({'UserId':_0x1fdc6e[_0xd00c('0x59')]['UserId'],'read1stAt':_[_0xd00c('0x67')](_0x421b11['read1stAt'])?moment()[_0xd00c('0x60')](_0xd00c('0x68')):undefined});}return null;})[_0xd00c('0x1f')](function(_0x29d5a2){if(_0x29d5a2){_0x30b608[_0xd00c('0x69')]=_0x29d5a2['get']({'plain':!![]});interaction_log['info'](_0xd00c('0x6a'),_0x1fdc6e[_0xd00c('0x61')]['id'],_0x1fdc6e[_0xd00c('0x61')]['name'],_0x1fdc6e['user'][_0xd00c('0x6b')],_0x30b608['interaction']['id'],_0x1fdc6e[_0xd00c('0x59')]?JSON['stringify'](_0x1fdc6e['body']):_0xd00c('0x6c'));return respondWithRpcPromise('AcceptMessage',_0xd00c('0x6d'),_0x30b608);}return null;})['then'](function(_0x5808fd){var _0x44071f=_0xd00c('0x6e')+_0x5808fd[_0xd00c('0x26')][_0xd00c('0x6f')];return db['sequelize'][_0xd00c('0x41')](_0x44071f,{'type':db[_0xd00c('0x70')][_0xd00c('0x71')][_0xd00c('0x72')],'raw':!![]})[_0xd00c('0x1f')](function(_0x483b01){return _0x483b01;});})[_0xd00c('0x1f')](function(_0x24a6ec){if(_0x24a6ec){_0x30b608[_0xd00c('0x26')][_0xd00c('0x73')]=_0x24a6ec[0x0];if(!_0x1fdc6e['body']['UserId'])return;return db[_0xd00c('0x74')][_0xd00c('0x5a')]({'where':{'id':_0x1fdc6e[_0xd00c('0x59')][_0xd00c('0x62')],'role':_0xd00c('0x75')},'attributes':['id',_0xd00c('0x38'),_0xd00c('0x76'),_0xd00c('0x77'),'internal'],'raw':!![]});}return null;})[_0xd00c('0x1f')](function(_0x540130){if(!_0x540130)return null;_0x30b608[_0xd00c('0x26')][_0xd00c('0x75')]=_0x540130;return _0x30b608;})[_0xd00c('0x1f')](function(_0x278db9){if(_0x278db9){if(_0x1fdc6e[_0xd00c('0x59')][_0xd00c('0x78')]){_0x30b608[_0xd00c('0x26')][_0xd00c('0x79')]=util[_0xd00c('0x60')](_0xd00c('0x7a'),_0x1fdc6e[_0xd00c('0x61')][_0xd00c('0x38')]);_0x30b608[_0xd00c('0x26')][_0xd00c('0x7b')]=_0x30b608[_0xd00c('0x7b')];_0x30b608[_0xd00c('0x26')][_0xd00c('0x7c')]=_0x30b608[_0xd00c('0x7b')];_0x30b608[_0xd00c('0x26')][_0xd00c('0x7d')]='accept';return respondWithRpcPromise(_0xd00c('0x7e'),_0xd00c('0x7e'),{'event':'acceptmessage','message':_0x30b608['message']},client9002)[_0xd00c('0x1f')](function(){return _0x30b608;});}return _0x30b608;}return null;})[_0xd00c('0x1f')](respondWithResult(_0x32a224,null))[_0xd00c('0x28')](handleError(_0x32a224,null));};var interaction_log=require('../../config/logger')('openchannel-interactions');exports['reject']=function(_0x366cad,_0xfc5884,_0x425d6b){var _0x3e3b61={'agent':{},'channel':'openchannel'};if(_0x366cad[_0xd00c('0x59')]['id']){delete _0x366cad[_0xd00c('0x59')]['id'];}_0x366cad[_0xd00c('0x59')][_0xd00c('0x62')]=_0x366cad[_0xd00c('0x59')][_0xd00c('0x62')]||_0x366cad[_0xd00c('0x61')]['id'];_0x3e3b61[_0xd00c('0x75')]['id']=_0x366cad[_0xd00c('0x59')]['UserId'];return db[_0xd00c('0x3c')]['find']({'where':{'id':_0x366cad[_0xd00c('0x55')]['id'],'UserId':null}})[_0xd00c('0x1f')](handleEntityNotFound(_0xfc5884,null))[_0xd00c('0x1f')](function(_0x110242){if(_0x110242){_0x3e3b61['message']=_0x110242[_0xd00c('0x63')]({'plain':!![]});return db[_0xd00c('0x64')]['find']({'where':{'id':_0x110242[_0xd00c('0x65')]}});}return null;})[_0xd00c('0x1f')](handleEntityNotFound(_0xfc5884,null))['then'](function(_0x3586c5){if(_0x3586c5){_0x3e3b61[_0xd00c('0x69')]=_0x3586c5[_0xd00c('0x63')]({'plain':!![]});interaction_log[_0xd00c('0x20')](_0xd00c('0x7f'),_0x366cad[_0xd00c('0x61')]['id'],_0x366cad[_0xd00c('0x61')][_0xd00c('0x38')],_0x366cad[_0xd00c('0x61')][_0xd00c('0x6b')],_0x3e3b61[_0xd00c('0x69')]['id'],_0x366cad[_0xd00c('0x59')]?JSON[_0xd00c('0x23')](_0x366cad[_0xd00c('0x59')]):_0xd00c('0x6c'));return respondWithRpcPromise(_0xd00c('0x80'),'rejectMessage',_0x3e3b61);}return null;})[_0xd00c('0x1f')](function(_0x9e95c5){var _0x5426cc=_0xd00c('0x6e')+_0x9e95c5[_0xd00c('0x26')]['ContactId'];return db[_0xd00c('0x81')][_0xd00c('0x41')](_0x5426cc,{'type':db['Sequelize'][_0xd00c('0x71')][_0xd00c('0x72')],'raw':!![]})['then'](function(_0x35e56f){return _0x35e56f;});})['then'](function(_0x16b377){if(_0x16b377){_0x3e3b61[_0xd00c('0x26')][_0xd00c('0x73')]=_0x16b377[0x0];if(!_0x366cad['body']['UserId'])return;return db[_0xd00c('0x74')][_0xd00c('0x5a')]({'where':{'id':_0x366cad[_0xd00c('0x59')][_0xd00c('0x62')],'role':'agent'},'attributes':['id','name',_0xd00c('0x76'),_0xd00c('0x77'),_0xd00c('0x82')],'raw':!![]});}return null;})[_0xd00c('0x1f')](function(_0x366ec8){if(!_0x366ec8)return null;_0x3e3b61[_0xd00c('0x26')][_0xd00c('0x75')]=_0x366ec8;return _0x3e3b61;})[_0xd00c('0x1f')](function(_0x20dc16){if(_0x20dc16){_0x20dc16[_0xd00c('0x26')]['interface']=util[_0xd00c('0x60')]('SIP/%s',_0x366cad[_0xd00c('0x61')][_0xd00c('0x38')]);_0x20dc16[_0xd00c('0x26')][_0xd00c('0x7b')]=_0x3e3b61['channel'];_0x20dc16[_0xd00c('0x26')][_0xd00c('0x7c')]=_0x3e3b61[_0xd00c('0x7b')];_0x20dc16[_0xd00c('0x26')]['event']='reject';respondWithRpcPromise(_0xd00c('0x7e'),'EventManager',{'event':_0xd00c('0x83'),'message':_0x20dc16['message']},client9002);return _0x3e3b61;}return null;})[_0xd00c('0x1f')](respondWithResult(_0xfc5884,null))[_0xd00c('0x28')](handleError(_0xfc5884,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index c1e6b01..c6fdc7a 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 _0x2e30=['../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x5395a,_0x4bbdbc){var _0x1328e4=function(_0x45954c){while(--_0x45954c){_0x5395a['push'](_0x5395a['shift']());}};_0x1328e4(++_0x4bbdbc);}(_0x2e30,0x18f));var _0x02e3=function(_0x471a02,_0x2dbb8a){_0x471a02=_0x471a02-0x0;var _0xc90727=_0x2e30[_0x471a02];return _0xc90727;};'use strict';var EventEmitter=require(_0x02e3('0x0'));var OpenchannelMessage=require(_0x02e3('0x1'))['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x02e3('0x2')](0x0);var events={'afterCreate':_0x02e3('0x3'),'afterUpdate':_0x02e3('0x4'),'afterDestroy':_0x02e3('0x5')};function emitEvent(_0x216b0a){return function(_0x3dd25e,_0x43b064,_0x5e8f8a){OpenchannelMessageEvents[_0x02e3('0x6')](_0x216b0a+':'+_0x3dd25e['id'],_0x3dd25e);OpenchannelMessageEvents[_0x02e3('0x6')](_0x216b0a,_0x3dd25e);_0x5e8f8a(null);};}for(var e in events){if(events[_0x02e3('0x7')](e)){var event=events[e];OpenchannelMessage[_0x02e3('0x8')](e,emitEvent(event));}}module[_0x02e3('0x9')]=OpenchannelMessageEvents; \ No newline at end of file +var _0x1aee=['events','../../mysqldb','OpenchannelMessage','save','update','remove','emit','exports'];(function(_0x5a26db,_0x2c5ccd){var _0x4619dd=function(_0x21e28f){while(--_0x21e28f){_0x5a26db['push'](_0x5a26db['shift']());}};_0x4619dd(++_0x2c5ccd);}(_0x1aee,0x1d0));var _0xe1ae=function(_0x10004e,_0xd701e6){_0x10004e=_0x10004e-0x0;var _0x5af990=_0x1aee[_0x10004e];return _0x5af990;};'use strict';var EventEmitter=require(_0xe1ae('0x0'));var OpenchannelMessage=require(_0xe1ae('0x1'))['db'][_0xe1ae('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe1ae('0x3'),'afterUpdate':_0xe1ae('0x4'),'afterDestroy':_0xe1ae('0x5')};function emitEvent(_0x4f450f){return function(_0x3c0db6,_0x5d2e12,_0x449ce4){OpenchannelMessageEvents['emit'](_0x4f450f+':'+_0x3c0db6['id'],_0x3c0db6);OpenchannelMessageEvents[_0xe1ae('0x6')](_0x4f450f,_0x3c0db6);_0x449ce4(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage['hook'](e,emitEvent(event));}}module[_0xe1ae('0x7')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index fbc5637..6dcdb86 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 _0x757a=['find','OpenchannelAccountId','OpenchannelInteraction','Interactions','keys','replyUri','info','format','Forwarding\x20message\x20%d\x20to\x20%s','length','Interaction','omit','Contact','POST','method','OpenchannelMessage,\x20%s,\x20%s','threadId','afterCreate','inspect','finally','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','models','get','direction','toLowerCase','UserId','OpenchannelInteractionId','update','createdAt','catch','error','out','secret','CmContact','describe','then'];(function(_0x3b5b94,_0x1b1d80){var _0x507e9e=function(_0x2375e3){while(--_0x2375e3){_0x3b5b94['push'](_0x3b5b94['shift']());}};_0x507e9e(++_0x1b1d80);}(_0x757a,0xde));var _0xa757=function(_0x12fc72,_0x126c43){_0x12fc72=_0x12fc72-0x0;var _0x220a33=_0x757a[_0x12fc72];return _0x220a33;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var logger=require(_0xa757('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa757('0x2'));var fs=require('fs');var path=require(_0xa757('0x3'));var rimraf=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var attributes=require(_0xa757('0x6'));module[_0xa757('0x7')]=function(_0x5edca8,_0xae0e7c){return _0x5edca8[_0xa757('0x8')]('OpenchannelMessage',attributes,{'tableName':_0xa757('0x9'),'paranoid':![],'indexes':[{'name':_0xa757('0xa'),'fields':[_0xa757('0xb')],'type':_0xa757('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3a3db6,_0x5aef8a,_0x89c630){var _0x2ca96f=_0x5edca8[_0xa757('0xd')];var _0x3e2c9a=_0x3a3db6[_0xa757('0xe')]({'plain':!![]});if(_0x3e2c9a[_0xa757('0xf')][_0xa757('0x10')]()==='in'||_0x3e2c9a['direction']['toLowerCase']()==='out'&&!_0x3e2c9a['secret']&&!_['isNil'](_0x3e2c9a[_0xa757('0x11')])){_0x2ca96f['OpenchannelInteraction']['findOne']({'where':{'id':_0x3e2c9a[_0xa757('0x12')]}})['then'](function(_0x481508){if(_0x481508){_0x481508[_0xa757('0x13')]({'lastMsgAt':_0x3e2c9a[_0xa757('0x14')],'lastMsgDirection':_0x3e2c9a[_0xa757('0xf')][_0xa757('0x10')]()});}})[_0xa757('0x15')](function(_0x31cfd2){console[_0xa757('0x16')](_0x31cfd2);});}if(_0x3e2c9a[_0xa757('0xf')]===_0xa757('0x17')&&!_0x3e2c9a[_0xa757('0x18')]){var _0x50aac1;_0x2ca96f[_0xa757('0x19')][_0xa757('0x1a')]()[_0xa757('0x1b')](function(_0x4d9f58){return _0x2ca96f['OpenchannelAccount'][_0xa757('0x1c')]({'where':{'id':_0x3e2c9a[_0xa757('0x1d')]},'include':[{'model':_0x2ca96f[_0xa757('0x1e')],'as':_0xa757('0x1f'),'where':{'id':_0x3e2c9a[_0xa757('0x12')]},'limit':0x1,'include':[{'model':_0x2ca96f[_0xa757('0x19')],'as':'Contact','attributes':_[_0xa757('0x20')](_0x4d9f58)}]}]});})['then'](function(_0x32c2a1){_0x50aac1=_0x32c2a1[_0xa757('0xe')]({'plain':!![]});if(_0x50aac1&&_0x50aac1[_0xa757('0x21')]){logger[_0xa757('0x22')]('OpenchannelMessage,\x20%s,\x20%s','afterCreate',util[_0xa757('0x23')](_0xa757('0x24'),_0x3e2c9a['id'],_0x50aac1[_0xa757('0x21')]));if(_0x50aac1[_0xa757('0x1f')]&&_0x50aac1[_0xa757('0x1f')][_0xa757('0x25')]){_0x3e2c9a[_0xa757('0x26')]=_[_0xa757('0x27')](_0x50aac1[_0xa757('0x1f')][0x0],'Contact');_0x3e2c9a[_0xa757('0x28')]=_0x50aac1['Interactions'][0x0][_0xa757('0x28')];}var _0x5aef8a={'method':_0xa757('0x29'),'uri':encodeURI(_0x50aac1[_0xa757('0x21')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x5aef8a[_0xa757('0x2a')]){case'GET':_0x5aef8a['qs']=_0x3e2c9a;break;case _0xa757('0x29'):_0x5aef8a[_0xa757('0xb')]=_0x3e2c9a;break;}return rp(_0x5aef8a)[_0xa757('0x1b')](function(_0x3bf7f3){logger['info'](_0xa757('0x2b'),'afterCreate',util['format']('Message\x20%d\x20forwarded\x20to\x20%s',_0x3e2c9a['id'],_0x50aac1['replyUri']));if(_0x3bf7f3[_0xa757('0xb')]['threadId']&&_0x3bf7f3[_0xa757('0xb')][_0xa757('0x2c')]!=_0x3e2c9a['Interaction'][_0xa757('0x2c')]){return _0x2ca96f['OpenchannelInteraction'][_0xa757('0x13')]({'threadId':_0x3bf7f3[_0xa757('0xb')]['threadId']},{'logging':!![],'where':{'id':_0x3e2c9a[_0xa757('0x26')]['id']}});}else{return;}})['then'](function(){return _0x3a3db6[_0xa757('0x13')]({'read':!![]});})[_0xa757('0x15')](function(_0x458974){logger[_0xa757('0x16')](_0xa757('0x2b'),_0xa757('0x2d'),util[_0xa757('0x2e')](_0x458974,{'showHidden':![],'depth':null}));_0x89c630();});}else{_0x89c630();}})[_0xa757('0x2f')](function(){_0x89c630();});}else{_0x89c630();}}},'charset':_0xa757('0x30'),'collate':_0xa757('0x31')});}; \ No newline at end of file +var _0xb688=['then','replyUri','info','format','length','Interaction','omit','Contact','POST','threadId','update','OpenchannelMessage,\x20%s,\x20%s','afterCreate','inspect','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./openchannelMessage.attributes','exports','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','catch','CmContact','describe','OpenchannelAccount','OpenchannelAccountId','Interactions','keys'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb688,0xcf));var _0x8b68=function(_0xd8192b,_0x1060c4){_0xd8192b=_0xd8192b-0x0;var _0x3c3a12=_0xb688[_0xd8192b];return _0x3c3a12;};'use strict';var _=require('lodash');var util=require(_0x8b68('0x0'));var logger=require(_0x8b68('0x1'))(_0x8b68('0x2'));var moment=require(_0x8b68('0x3'));var BPromise=require(_0x8b68('0x4'));var rp=require(_0x8b68('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8b68('0x6'));var config=require(_0x8b68('0x7'));var attributes=require(_0x8b68('0x8'));module[_0x8b68('0x9')]=function(_0x583d16,_0x34314e){return _0x583d16['define'](_0x8b68('0xa'),attributes,{'tableName':_0x8b68('0xb'),'paranoid':![],'indexes':[{'name':_0x8b68('0xc'),'fields':[_0x8b68('0xd')],'type':_0x8b68('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3f9685,_0x261753,_0x21d944){var _0x24e0b0=_0x583d16[_0x8b68('0xf')];var _0x418775=_0x3f9685[_0x8b68('0x10')]({'plain':!![]});if(_0x418775[_0x8b68('0x11')]['toLowerCase']()==='in'||_0x418775[_0x8b68('0x11')][_0x8b68('0x12')]()===_0x8b68('0x13')&&!_0x418775[_0x8b68('0x14')]&&!_[_0x8b68('0x15')](_0x418775[_0x8b68('0x16')])){_0x24e0b0[_0x8b68('0x17')][_0x8b68('0x18')]({'where':{'id':_0x418775[_0x8b68('0x19')]}})['then'](function(_0xb2df35){if(_0xb2df35){_0xb2df35['update']({'lastMsgAt':_0x418775['createdAt'],'lastMsgDirection':_0x418775[_0x8b68('0x11')][_0x8b68('0x12')]()});}})[_0x8b68('0x1a')](function(_0x5d3468){console['error'](_0x5d3468);});}if(_0x418775[_0x8b68('0x11')]==='out'&&!_0x418775[_0x8b68('0x14')]){var _0xb44923;_0x24e0b0[_0x8b68('0x1b')][_0x8b68('0x1c')]()['then'](function(_0xd17693){return _0x24e0b0[_0x8b68('0x1d')]['find']({'where':{'id':_0x418775[_0x8b68('0x1e')]},'include':[{'model':_0x24e0b0[_0x8b68('0x17')],'as':_0x8b68('0x1f'),'where':{'id':_0x418775[_0x8b68('0x19')]},'limit':0x1,'include':[{'model':_0x24e0b0[_0x8b68('0x1b')],'as':'Contact','attributes':_[_0x8b68('0x20')](_0xd17693)}]}]});})[_0x8b68('0x21')](function(_0x59e9b1){_0xb44923=_0x59e9b1[_0x8b68('0x10')]({'plain':!![]});if(_0xb44923&&_0xb44923[_0x8b68('0x22')]){logger[_0x8b68('0x23')]('OpenchannelMessage,\x20%s,\x20%s','afterCreate',util[_0x8b68('0x24')]('Forwarding\x20message\x20%d\x20to\x20%s',_0x418775['id'],_0xb44923[_0x8b68('0x22')]));if(_0xb44923[_0x8b68('0x1f')]&&_0xb44923[_0x8b68('0x1f')][_0x8b68('0x25')]){_0x418775[_0x8b68('0x26')]=_[_0x8b68('0x27')](_0xb44923['Interactions'][0x0],_0x8b68('0x28'));_0x418775[_0x8b68('0x28')]=_0xb44923['Interactions'][0x0][_0x8b68('0x28')];}var _0x261753={'method':_0x8b68('0x29'),'uri':encodeURI(_0xb44923['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x261753['method']){case'GET':_0x261753['qs']=_0x418775;break;case _0x8b68('0x29'):_0x261753[_0x8b68('0xd')]=_0x418775;break;}return rp(_0x261753)[_0x8b68('0x21')](function(_0x583476){logger[_0x8b68('0x23')]('OpenchannelMessage,\x20%s,\x20%s','afterCreate',util[_0x8b68('0x24')]('Message\x20%d\x20forwarded\x20to\x20%s',_0x418775['id'],_0xb44923[_0x8b68('0x22')]));if(_0x583476[_0x8b68('0xd')]['threadId']&&_0x583476['body'][_0x8b68('0x2a')]!=_0x418775[_0x8b68('0x26')][_0x8b68('0x2a')]){return _0x24e0b0[_0x8b68('0x17')][_0x8b68('0x2b')]({'threadId':_0x583476[_0x8b68('0xd')][_0x8b68('0x2a')]},{'logging':!![],'where':{'id':_0x418775['Interaction']['id']}});}else{return;}})[_0x8b68('0x21')](function(){return _0x3f9685['update']({'read':!![]});})[_0x8b68('0x1a')](function(_0x133b75){logger['error'](_0x8b68('0x2c'),_0x8b68('0x2d'),util[_0x8b68('0x2e')](_0x133b75,{'showHidden':![],'depth':null}));_0x21d944();});}else{_0x21d944();}})['finally'](function(){_0x21d944();});}else{_0x21d944();}}},'charset':'utf8mb4','collate':_0x8b68('0x2f')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 1ae0bb4..bf8743e 100644 --- a/server/api/openchannelMessage/openchannelMessage.rpc.js +++ b/server/api/openchannelMessage/openchannelMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1261=['../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','localhost','socket.io-emitter','./openchannelMessage.socket','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','OpenchannelMessage','options','raw','then','CreateOpenchannelMessage','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x5aa286,_0x3ec7a5){var _0x12551d=function(_0x3b1633){while(--_0x3b1633){_0x5aa286['push'](_0x5aa286['shift']());}};_0x12551d(++_0x3ec7a5);}(_0x1261,0x144));var _0x1126=function(_0x2d991c,_0x1583d4){_0x2d991c=_0x2d991c-0x0;var _0x3d5af5=_0x1261[_0x2d991c];return _0x3d5af5;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});config[_0x1126('0xb')]=_['defaults'](config[_0x1126('0xb')],{'host':_0x1126('0xc'),'port':0x18eb});var socket=require(_0x1126('0xd'))(new Redis(config[_0x1126('0xb')]));require(_0x1126('0xe'))['register'](socket);function respondWithRpcPromise(_0x3f09ac,_0x18dbe6,_0x167ef1){return new BPromise(function(_0x5e72e2,_0x34571c){return client['request'](_0x3f09ac,_0x167ef1)['then'](function(_0x15c071){logger['info'](_0x1126('0xf'),_0x18dbe6,_0x1126('0x10'));logger[_0x1126('0x11')](_0x1126('0x12'),_0x18dbe6,_0x1126('0x10'),JSON[_0x1126('0x13')](_0x15c071));if(_0x15c071[_0x1126('0x14')]){if(_0x15c071[_0x1126('0x14')][_0x1126('0x15')]===0x1f4){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x18dbe6,_0x15c071[_0x1126('0x14')][_0x1126('0x16')]);return _0x34571c(_0x15c071[_0x1126('0x14')]['message']);}logger[_0x1126('0x14')]('OpenchannelMessage,\x20%s,\x20%s',_0x18dbe6,_0x15c071[_0x1126('0x14')][_0x1126('0x16')]);return _0x5e72e2(_0x15c071[_0x1126('0x14')]['message']);}else{logger[_0x1126('0x17')](_0x1126('0xf'),_0x18dbe6,'request\x20sent');_0x5e72e2(_0x15c071['result'][_0x1126('0x16')]);}})[_0x1126('0x18')](function(_0x58d11a){logger['error'](_0x1126('0xf'),_0x18dbe6,_0x58d11a);_0x34571c(_0x58d11a);});});}exports['CreateOpenchannelMessage']=function(_0x22ed37){var _0x1d6d19=this;return new Promise(function(_0x2f70ac,_0x54400a){return db[_0x1126('0x19')]['create'](_0x22ed37['body'],{'raw':_0x22ed37[_0x1126('0x1a')]?_0x22ed37[_0x1126('0x1a')][_0x1126('0x1b')]===undefined?!![]:![]:!![]})[_0x1126('0x1c')](function(_0x526ca1){logger[_0x1126('0x17')](_0x1126('0x1d'),_0x22ed37);logger['debug'](_0x1126('0x1d'),_0x22ed37,JSON['stringify'](_0x526ca1));_0x2f70ac(_0x526ca1);})['catch'](function(_0x4b57ab){logger[_0x1126('0x14')](_0x1126('0x1d'),_0x4b57ab[_0x1126('0x16')],_0x22ed37);_0x54400a(_0x1d6d19[_0x1126('0x14')](0x1f4,_0x4b57ab[_0x1126('0x16')]));});});}; \ No newline at end of file +var _0xdb28=['then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','CreateOpenchannelMessage','OpenchannelMessage','create','body','options','raw','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./openchannelMessage.socket','register','request'];(function(_0x8e85da,_0x123600){var _0x419c05=function(_0x36d5ab){while(--_0x36d5ab){_0x8e85da['push'](_0x8e85da['shift']());}};_0x419c05(++_0x123600);}(_0xdb28,0x106));var _0x8db2=function(_0x1b6394,_0x2b649b){_0x1b6394=_0x1b6394-0x0;var _0x59547f=_0xdb28[_0x1b6394];return _0x59547f;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});config['redis']=_[_0x8db2('0xb')](config[_0x8db2('0xc')],{'host':_0x8db2('0xd'),'port':0x18eb});var socket=require(_0x8db2('0xe'))(new Redis(config[_0x8db2('0xc')]));require(_0x8db2('0xf'))[_0x8db2('0x10')](socket);function respondWithRpcPromise(_0x4ba340,_0x30dc90,_0x476216){return new BPromise(function(_0x1f62af,_0x57015f){return client[_0x8db2('0x11')](_0x4ba340,_0x476216)[_0x8db2('0x12')](function(_0x576475){logger[_0x8db2('0x13')](_0x8db2('0x14'),_0x30dc90,_0x8db2('0x15'));logger[_0x8db2('0x16')](_0x8db2('0x17'),_0x30dc90,'request\x20sent',JSON['stringify'](_0x576475));if(_0x576475[_0x8db2('0x18')]){if(_0x576475[_0x8db2('0x18')][_0x8db2('0x19')]===0x1f4){logger[_0x8db2('0x18')](_0x8db2('0x14'),_0x30dc90,_0x576475[_0x8db2('0x18')][_0x8db2('0x1a')]);return _0x57015f(_0x576475[_0x8db2('0x18')][_0x8db2('0x1a')]);}logger[_0x8db2('0x18')]('OpenchannelMessage,\x20%s,\x20%s',_0x30dc90,_0x576475[_0x8db2('0x18')][_0x8db2('0x1a')]);return _0x1f62af(_0x576475['error'][_0x8db2('0x1a')]);}else{logger[_0x8db2('0x13')](_0x8db2('0x14'),_0x30dc90,_0x8db2('0x15'));_0x1f62af(_0x576475[_0x8db2('0x1b')][_0x8db2('0x1a')]);}})['catch'](function(_0x5df464){logger[_0x8db2('0x18')](_0x8db2('0x14'),_0x30dc90,_0x5df464);_0x57015f(_0x5df464);});});}exports[_0x8db2('0x1c')]=function(_0x1b64e4){var _0x58562e=this;return new Promise(function(_0x431d60,_0x36a9ff){return db[_0x8db2('0x1d')][_0x8db2('0x1e')](_0x1b64e4[_0x8db2('0x1f')],{'raw':_0x1b64e4['options']?_0x1b64e4[_0x8db2('0x20')][_0x8db2('0x21')]===undefined?!![]:![]:!![]})[_0x8db2('0x12')](function(_0x125be2){logger[_0x8db2('0x13')](_0x8db2('0x1c'),_0x1b64e4);logger[_0x8db2('0x16')]('CreateOpenchannelMessage',_0x1b64e4,JSON[_0x8db2('0x22')](_0x125be2));_0x431d60(_0x125be2);})['catch'](function(_0x5725f0){logger['error']('CreateOpenchannelMessage',_0x5725f0[_0x8db2('0x1a')],_0x1b64e4);_0x36a9ff(_0x58562e[_0x8db2('0x18')](0x1f4,_0x5725f0[_0x8db2('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index d531adb..f387426 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 _0x743d=['update','emit','register','length','openchannelMessage:','remove'];(function(_0x3e223b,_0x407ced){var _0x2b2d3d=function(_0x2f76b1){while(--_0x2f76b1){_0x3e223b['push'](_0x3e223b['shift']());}};_0x2b2d3d(++_0x407ced);}(_0x743d,0xa1));var _0xd743=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x743d[_0x432682];return _0x463d05;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=['save',_0xd743('0x0'),_0xd743('0x1')];function createListener(_0x35bc6a,_0x284c2b){return function(_0x57eef3){_0x284c2b[_0xd743('0x2')](_0x35bc6a,_0x57eef3);};}function removeListener(_0x513e5c,_0xab6119){return function(){OpenchannelMessageEvents['removeListener'](_0x513e5c,_0xab6119);};}exports[_0xd743('0x3')]=function(_0x5942e6){for(var _0x59b38f=0x0,_0x3a442f=events[_0xd743('0x4')];_0x59b38f<_0x3a442f;_0x59b38f++){var _0x31312e=events[_0x59b38f];var _0x2e4a8f=createListener(_0xd743('0x5')+_0x31312e,_0x5942e6);OpenchannelMessageEvents['on'](_0x31312e,_0x2e4a8f);}}; \ No newline at end of file +var _0x0d55=['remove','emit','removeListener','register','openchannelMessage:','./openchannelMessage.events'];(function(_0x568a61,_0x2124f8){var _0x334c3b=function(_0x1afc39){while(--_0x1afc39){_0x568a61['push'](_0x568a61['shift']());}};_0x334c3b(++_0x2124f8);}(_0x0d55,0x179));var _0x50d5=function(_0x45b380,_0x478cbd){_0x45b380=_0x45b380-0x0;var _0x4cdb76=_0x0d55[_0x45b380];return _0x4cdb76;};'use strict';var OpenchannelMessageEvents=require(_0x50d5('0x0'));var events=['save',_0x50d5('0x1'),'update'];function createListener(_0x2c3984,_0x5f3c8b){return function(_0x15ced9){_0x5f3c8b[_0x50d5('0x2')](_0x2c3984,_0x15ced9);};}function removeListener(_0x1d4fb6,_0x16d217){return function(){OpenchannelMessageEvents[_0x50d5('0x3')](_0x1d4fb6,_0x16d217);};}exports[_0x50d5('0x4')]=function(_0x10716f){for(var _0x2e3fc5=0x0,_0xb0383f=events['length'];_0x2e3fc5<_0xb0383f;_0x2e3fc5++){var _0x32924d=events[_0x2e3fc5];var _0x23dadb=createListener(_0x50d5('0x5')+_0x32924d,_0x10716f);OpenchannelMessageEvents['on'](_0x32924d,_0x23dadb);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index b6d6b7c..08fc4fd 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 _0x7552=['express','Router','fs-extra','../../components/auth/service','../../config/environment','./openchannelQueue.controller','isAuthenticated','index','get','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','delete','exports','util','path','connect-timeout'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x7552,0xf9));var _0x2755=function(_0x94f1d6,_0x500192){_0x94f1d6=_0x94f1d6-0x0;var _0x5f1f85=_0x7552[_0x94f1d6];return _0x5f1f85;};'use strict';var multer=require('multer');var util=require(_0x2755('0x0'));var path=require(_0x2755('0x1'));var timeout=require(_0x2755('0x2'));var express=require(_0x2755('0x3'));var router=express[_0x2755('0x4')]();var fs_extra=require(_0x2755('0x5'));var auth=require(_0x2755('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x2755('0x7'));var controller=require(_0x2755('0x8'));router['get']('/',auth[_0x2755('0x9')](),controller[_0x2755('0xa')]);router[_0x2755('0xb')]('/describe',auth[_0x2755('0x9')](),controller[_0x2755('0xc')]);router[_0x2755('0xb')](_0x2755('0xd'),auth[_0x2755('0x9')](),controller[_0x2755('0xe')]);router[_0x2755('0xb')](_0x2755('0xf'),auth[_0x2755('0x9')](),controller[_0x2755('0x10')]);router['get'](_0x2755('0x11'),auth[_0x2755('0x9')](),controller[_0x2755('0x12')]);router['get'](_0x2755('0x13'),auth['isAuthenticated'](),controller[_0x2755('0x14')]);router[_0x2755('0x15')]('/',auth[_0x2755('0x9')](),controller[_0x2755('0x16')]);router[_0x2755('0x15')](_0x2755('0x11'),auth[_0x2755('0x9')](),controller[_0x2755('0x17')]);router[_0x2755('0x15')](_0x2755('0x13'),auth['isAuthenticated'](),controller[_0x2755('0x18')]);router[_0x2755('0x19')](_0x2755('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x2755('0x1a')](_0x2755('0xd'),auth[_0x2755('0x9')](),controller['destroy']);router['delete'](_0x2755('0x11'),auth[_0x2755('0x9')](),controller['removeTeams']);router['delete'](_0x2755('0x13'),auth[_0x2755('0x9')](),controller['removeAgents']);module[_0x2755('0x1b')]=router; \ No newline at end of file +var _0x06e6=['/:id/members','/:id/teams','getTeams','/:id/users','post','create','addTeams','put','update','destroy','delete','removeAgents','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','isAuthenticated','index','get','/describe','describe','/:id','show'];(function(_0x65d0ee,_0x2c7c57){var _0x4a506a=function(_0x388aa2){while(--_0x388aa2){_0x65d0ee['push'](_0x65d0ee['shift']());}};_0x4a506a(++_0x2c7c57);}(_0x06e6,0x112));var _0x606e=function(_0x69a748,_0x7e2ee1){_0x69a748=_0x69a748-0x0;var _0x116db0=_0x06e6[_0x69a748];return _0x116db0;};'use strict';var multer=require(_0x606e('0x0'));var util=require('util');var path=require(_0x606e('0x1'));var timeout=require(_0x606e('0x2'));var express=require(_0x606e('0x3'));var router=express['Router']();var fs_extra=require(_0x606e('0x4'));var auth=require(_0x606e('0x5'));var interaction=require(_0x606e('0x6'));var config=require(_0x606e('0x7'));var controller=require(_0x606e('0x8'));router['get']('/',auth[_0x606e('0x9')](),controller[_0x606e('0xa')]);router[_0x606e('0xb')](_0x606e('0xc'),auth['isAuthenticated'](),controller[_0x606e('0xd')]);router[_0x606e('0xb')](_0x606e('0xe'),auth['isAuthenticated'](),controller[_0x606e('0xf')]);router['get'](_0x606e('0x10'),auth['isAuthenticated'](),controller['getMembers']);router[_0x606e('0xb')](_0x606e('0x11'),auth['isAuthenticated'](),controller[_0x606e('0x12')]);router[_0x606e('0xb')](_0x606e('0x13'),auth[_0x606e('0x9')](),controller['getAgents']);router[_0x606e('0x14')]('/',auth[_0x606e('0x9')](),controller[_0x606e('0x15')]);router[_0x606e('0x14')]('/:id/teams',auth[_0x606e('0x9')](),controller[_0x606e('0x16')]);router[_0x606e('0x14')](_0x606e('0x13'),auth[_0x606e('0x9')](),controller['addAgents']);router[_0x606e('0x17')](_0x606e('0xe'),auth[_0x606e('0x9')](),controller[_0x606e('0x18')]);router['delete']('/:id',auth[_0x606e('0x9')](),controller[_0x606e('0x19')]);router['delete'](_0x606e('0x11'),auth[_0x606e('0x9')](),controller['removeTeams']);router[_0x606e('0x1a')]('/:id/users',auth[_0x606e('0x9')](),controller[_0x606e('0x1b')]);module[_0x606e('0x1c')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index a25a97c..4c58c65 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 _0x49a2=['ENUM','rrmemory','beepall','roundrobin','exports','STRING','INTEGER'];(function(_0x470ce2,_0x4b3815){var _0x739076=function(_0x1f16f3){while(--_0x1f16f3){_0x470ce2['push'](_0x470ce2['shift']());}};_0x739076(++_0x4b3815);}(_0x49a2,0x82));var _0x249a=function(_0x484ad6,_0x4efaee){_0x484ad6=_0x484ad6-0x0;var _0x4950d0=_0x49a2[_0x484ad6];return _0x4950d0;};'use strict';var Sequelize=require('sequelize');module[_0x249a('0x0')]={'name':{'type':Sequelize[_0x249a('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x249a('0x1')]},'timeout':{'type':Sequelize[_0x249a('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x249a('0x3')](_0x249a('0x4'),_0x249a('0x5'),_0x249a('0x6'))}}; \ No newline at end of file +var _0xff61=['roundrobin','sequelize','exports','STRING','name','ENUM','rrmemory'];(function(_0x9be508,_0x10c8ba){var _0x16f3c3=function(_0x35c330){while(--_0x35c330){_0x9be508['push'](_0x9be508['shift']());}};_0x16f3c3(++_0x10c8ba);}(_0xff61,0x13c));var _0x1ff6=function(_0x5be446,_0xbbd82d){_0x5be446=_0x5be446-0x0;var _0x335111=_0xff61[_0x5be446];return _0x335111;};'use strict';var Sequelize=require(_0x1ff6('0x0'));module[_0x1ff6('0x1')]={'name':{'type':Sequelize[_0x1ff6('0x2')],'unique':_0x1ff6('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x1ff6('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x1ff6('0x4')](_0x1ff6('0x5'),'beepall',_0x1ff6('0x6'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 7f08225..1d0e08e 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 _0x4a7e=['push','toString','QueryTypes','every','includes','all','union','compact','value','removeAgents','forEach','userOpenchannelQueue:remove','addAgents','omit','spread','isArray','getAgents','zip-dir','request-promise','moment','bluebird','path','sox','ejs','fs-extra','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','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','OpenchannelQueues','send','index','map','OpenchannelQueue','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','VIRTUAL','name','filter','options','includeAll','findAll','rows','catch','show','params','fields','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','body','describe','getMembers','pick','merge','User','findAndCountAll','UserId','agent','openchannelPause','createdAt','format','%s/%s','SIP','updatedAt','getTeams','findOne','Team','order','addTeams','Agents','online','voicePause','interface','sequelize','transaction','findOrCreate','emit','removeTeams','ids','select','field','from','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone'];(function(_0x436db1,_0x3866f3){var _0x1493c7=function(_0x3424b8){while(--_0x3424b8){_0x436db1['push'](_0x436db1['shift']());}};_0x1493c7(++_0x3866f3);}(_0x4a7e,0x9c));var _0xe4a7=function(_0x43c789,_0x41c25c){_0x43c789=_0x43c789-0x0;var _0x17fd90=_0x4a7e[_0x43c789];return _0x17fd90;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe4a7('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe4a7('0x1'));var moment=require(_0xe4a7('0x2'));var BPromise=require(_0xe4a7('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0xe4a7('0x4'));var sox=require(_0xe4a7('0x5'));var csv=require('to-csv');var ejs=require(_0xe4a7('0x6'));var fs=require('fs');var fs_extra=require(_0xe4a7('0x7'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xe4a7('0x8'));var jsforce=require(_0xe4a7('0x9'));var deskjs=require(_0xe4a7('0xa'));var toCsv=require('to-csv');var querystring=require(_0xe4a7('0xb'));var Papa=require(_0xe4a7('0xc'));var Redis=require(_0xe4a7('0xd'));var authService=require(_0xe4a7('0xe'));var qs=require(_0xe4a7('0xf'));var as=require(_0xe4a7('0x10'));var hardwareService=require(_0xe4a7('0x11'));var logger=require(_0xe4a7('0x12'))('api');var utils=require(_0xe4a7('0x13'));var config=require(_0xe4a7('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xe4a7('0x15'))['db'];config[_0xe4a7('0x16')]=_['defaults'](config[_0xe4a7('0x16')],{'host':_0xe4a7('0x17'),'port':0x18eb});var socket=require(_0xe4a7('0x18'))(new Redis(config[_0xe4a7('0x16')]));require(_0xe4a7('0x19'))[_0xe4a7('0x1a')](socket);function respondWithStatusCode(_0xddd207,_0x11f4af){_0x11f4af=_0x11f4af||0xcc;return function(_0x5610b2){if(_0x5610b2){return _0xddd207[_0xe4a7('0x1b')](_0x11f4af);}return _0xddd207['status'](_0x11f4af)[_0xe4a7('0x1c')]();};}function respondWithResult(_0x6c337b,_0x377467){_0x377467=_0x377467||0xc8;return function(_0x40756b){if(_0x40756b){return _0x6c337b[_0xe4a7('0x1d')](_0x377467)[_0xe4a7('0x1e')](_0x40756b);}};}function respondWithFilteredResult(_0xde2c26,_0x58a734){return function(_0x4b9795){if(_0x4b9795){var _0xc48fa6=typeof _0x58a734[_0xe4a7('0x1f')]===_0xe4a7('0x20')&&typeof _0x58a734[_0xe4a7('0x21')]===_0xe4a7('0x20');var _0x12b0ec=_0x4b9795[_0xe4a7('0x22')];var _0x527481=_0xc48fa6?0x0:_0x58a734[_0xe4a7('0x1f')];var _0x234c20=_0xc48fa6?_0x4b9795[_0xe4a7('0x22')]:_0x58a734[_0xe4a7('0x1f')]+_0x58a734[_0xe4a7('0x21')];var _0x52edf9;if(_0x234c20>=_0x12b0ec){_0x234c20=_0x12b0ec;_0x52edf9=0xc8;}else{_0x52edf9=0xce;}_0xde2c26[_0xe4a7('0x1d')](_0x52edf9);return _0xde2c26[_0xe4a7('0x23')](_0xe4a7('0x24'),_0x527481+'-'+_0x234c20+'/'+_0x12b0ec)[_0xe4a7('0x1e')](_0x4b9795);}return null;};}function patchUpdates(_0x1bfc89){return function(_0x534464){try{jsonpatch[_0xe4a7('0x25')](_0x534464,_0x1bfc89,!![]);}catch(_0x27aa75){return BPromise[_0xe4a7('0x26')](_0x27aa75);}return _0x534464[_0xe4a7('0x27')]();};}function saveUpdates(_0x474a54,_0x26e30e){return function(_0x138a82){if(_0x138a82){return _0x138a82[_0xe4a7('0x28')](_0x474a54)[_0xe4a7('0x29')](function(_0x1dd76d){return _0x1dd76d;});}return null;};}function removeEntity(_0x5fac00,_0x1ab159){return function(_0x43f431){if(_0x43f431){return _0x43f431[_0xe4a7('0x2a')]()[_0xe4a7('0x29')](function(){var _0x483d46=_0x43f431[_0xe4a7('0x2b')]({'plain':!![]});var _0x5bd9b4=_0xe4a7('0x2c');return db['UserProfileResource'][_0xe4a7('0x2a')]({'where':{'type':_0x5bd9b4,'resourceId':_0x483d46['id']}})[_0xe4a7('0x29')](function(){return _0x43f431;});})[_0xe4a7('0x29')](function(){_0x5fac00[_0xe4a7('0x1d')](0xcc)[_0xe4a7('0x1c')]();});}};}function handleEntityNotFound(_0x38e6bf,_0x321979){return function(_0x13494f){if(!_0x13494f){_0x38e6bf[_0xe4a7('0x1b')](0x194);}return _0x13494f;};}function handleError(_0x1fe8a2,_0x60153f){_0x60153f=_0x60153f||0x1f4;return function(_0x329121){logger['error'](_0x329121['stack']);if(_0x329121['name']){delete _0x329121['name'];}_0x1fe8a2[_0xe4a7('0x1d')](_0x60153f)[_0xe4a7('0x2d')](_0x329121);};}exports[_0xe4a7('0x2e')]=function(_0x18946e,_0x580fc2){var _0x340492={},_0x4598df={},_0x39dc69={'count':0x0,'rows':[]};var _0x43ab6f=_[_0xe4a7('0x2f')](db[_0xe4a7('0x30')][_0xe4a7('0x31')],function(_0x2b3148){return{'name':_0x2b3148[_0xe4a7('0x32')],'type':_0x2b3148[_0xe4a7('0x33')][_0xe4a7('0x34')]};});_0x4598df[_0xe4a7('0x35')]=_[_0xe4a7('0x2f')](_0x43ab6f,'name');_0x4598df['query']=_[_0xe4a7('0x36')](_0x18946e[_0xe4a7('0x37')]);_0x4598df[_0xe4a7('0x38')]=_[_0xe4a7('0x39')](_0x4598df[_0xe4a7('0x35')],_0x4598df[_0xe4a7('0x37')]);_0x340492['attributes']=_['intersection'](_0x4598df[_0xe4a7('0x35')],qs['fields'](_0x18946e[_0xe4a7('0x37')]['fields']));_0x340492['attributes']=_0x340492[_0xe4a7('0x3a')][_0xe4a7('0x3b')]?_0x340492[_0xe4a7('0x3a')]:_0x4598df[_0xe4a7('0x35')];if(!_0x18946e[_0xe4a7('0x37')][_0xe4a7('0x3c')](_0xe4a7('0x3d'))){_0x340492[_0xe4a7('0x21')]=qs[_0xe4a7('0x21')](_0x18946e[_0xe4a7('0x37')][_0xe4a7('0x21')]);_0x340492[_0xe4a7('0x1f')]=qs[_0xe4a7('0x1f')](_0x18946e[_0xe4a7('0x37')][_0xe4a7('0x1f')]);}_0x340492['order']=qs[_0xe4a7('0x3e')](_0x18946e[_0xe4a7('0x37')][_0xe4a7('0x3e')]);_0x340492[_0xe4a7('0x3f')]=qs[_0xe4a7('0x38')](_['pick'](_0x18946e[_0xe4a7('0x37')],_0x4598df[_0xe4a7('0x38')]),_0x43ab6f);if(_0x18946e['query']['filter']){_0x340492[_0xe4a7('0x3f')]=_['merge'](_0x340492[_0xe4a7('0x3f')],{'$or':_['map'](_0x43ab6f,function(_0x4cbc2a){if(_0x4cbc2a['type']!==_0xe4a7('0x40')){var _0x235a03={};_0x235a03[_0x4cbc2a[_0xe4a7('0x41')]]={'$like':'%'+_0x18946e[_0xe4a7('0x37')][_0xe4a7('0x42')]+'%'};return _0x235a03;}})});}_0x340492=_['merge']({},_0x340492,_0x18946e[_0xe4a7('0x43')]);var _0x3073a1={'where':_0x340492[_0xe4a7('0x3f')]};return db['OpenchannelQueue']['count'](_0x3073a1)[_0xe4a7('0x29')](function(_0x418205){_0x39dc69[_0xe4a7('0x22')]=_0x418205;if(_0x18946e[_0xe4a7('0x37')][_0xe4a7('0x44')]){_0x340492['include']=[{'all':!![]}];}return db['OpenchannelQueue'][_0xe4a7('0x45')](_0x340492);})['then'](function(_0x2455d4){_0x39dc69[_0xe4a7('0x46')]=_0x2455d4;return _0x39dc69;})[_0xe4a7('0x29')](respondWithFilteredResult(_0x580fc2,_0x340492))[_0xe4a7('0x47')](handleError(_0x580fc2,null));};exports[_0xe4a7('0x48')]=function(_0x5b3bab,_0x40acf7){var _0xf28d9e={'raw':!![],'where':{'id':_0x5b3bab[_0xe4a7('0x49')]['id']}},_0x4e82f0={};_0x4e82f0[_0xe4a7('0x35')]=_[_0xe4a7('0x36')](db[_0xe4a7('0x30')][_0xe4a7('0x31')]);_0x4e82f0[_0xe4a7('0x37')]=_[_0xe4a7('0x36')](_0x5b3bab[_0xe4a7('0x37')]);_0x4e82f0[_0xe4a7('0x38')]=_[_0xe4a7('0x39')](_0x4e82f0[_0xe4a7('0x35')],_0x4e82f0[_0xe4a7('0x37')]);_0xf28d9e[_0xe4a7('0x3a')]=_[_0xe4a7('0x39')](_0x4e82f0[_0xe4a7('0x35')],qs[_0xe4a7('0x4a')](_0x5b3bab[_0xe4a7('0x37')][_0xe4a7('0x4a')]));_0xf28d9e[_0xe4a7('0x3a')]=_0xf28d9e['attributes'][_0xe4a7('0x3b')]?_0xf28d9e[_0xe4a7('0x3a')]:_0x4e82f0[_0xe4a7('0x35')];if(_0x5b3bab[_0xe4a7('0x37')][_0xe4a7('0x44')]){_0xf28d9e['include']=[{'all':!![]}];}_0xf28d9e=_['merge']({},_0xf28d9e,_0x5b3bab[_0xe4a7('0x43')]);return db['OpenchannelQueue']['find'](_0xf28d9e)[_0xe4a7('0x29')](handleEntityNotFound(_0x40acf7,null))[_0xe4a7('0x29')](respondWithResult(_0x40acf7,null))[_0xe4a7('0x47')](handleError(_0x40acf7,null));};exports[_0xe4a7('0x4b')]=function(_0x3e9117,_0x53cf39){return db[_0xe4a7('0x30')][_0xe4a7('0x4b')](_0x3e9117['body'],{})[_0xe4a7('0x29')](function(_0x5229c7){var _0x43582f=_0x3e9117[_0xe4a7('0x4c')][_0xe4a7('0x2b')]({'plain':!![]});if(!_0x43582f)throw new Error(_0xe4a7('0x4d'));if(_0x43582f[_0xe4a7('0x4e')]===_0xe4a7('0x4c')){var _0x454ae1=_0x5229c7['get']({'plain':!![]});var _0x1c38f2='OpenchannelQueues';return db[_0xe4a7('0x4f')][_0xe4a7('0x50')]({'where':{'name':_0x1c38f2,'userProfileId':_0x43582f[_0xe4a7('0x51')]},'raw':!![]})[_0xe4a7('0x29')](function(_0xaeefe1){if(_0xaeefe1&&_0xaeefe1[_0xe4a7('0x52')]===0x0){return db[_0xe4a7('0x53')][_0xe4a7('0x4b')]({'name':_0x454ae1[_0xe4a7('0x41')],'resourceId':_0x454ae1['id'],'type':_0xaeefe1[_0xe4a7('0x41')],'sectionId':_0xaeefe1['id']},{})['then'](function(){return _0x5229c7;});}else{return _0x5229c7;}})[_0xe4a7('0x47')](function(_0x38aa7d){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x38aa7d);throw _0x38aa7d;});}return _0x5229c7;})['then'](respondWithResult(_0x53cf39,0xc9))[_0xe4a7('0x47')](handleError(_0x53cf39,null));};exports[_0xe4a7('0x28')]=function(_0x2f63ba,_0x36d26f){if(_0x2f63ba[_0xe4a7('0x54')]['id']){delete _0x2f63ba[_0xe4a7('0x54')]['id'];}return db[_0xe4a7('0x30')][_0xe4a7('0x50')]({'where':{'id':_0x2f63ba[_0xe4a7('0x49')]['id']}})[_0xe4a7('0x29')](handleEntityNotFound(_0x36d26f,null))[_0xe4a7('0x29')](saveUpdates(_0x2f63ba[_0xe4a7('0x54')],null))[_0xe4a7('0x29')](respondWithResult(_0x36d26f,null))[_0xe4a7('0x47')](handleError(_0x36d26f,null));};exports[_0xe4a7('0x2a')]=function(_0x1c2172,_0x3c514c){return db[_0xe4a7('0x30')][_0xe4a7('0x50')]({'where':{'id':_0x1c2172['params']['id']}})[_0xe4a7('0x29')](handleEntityNotFound(_0x3c514c,null))[_0xe4a7('0x29')](removeEntity(_0x3c514c,null))['catch'](handleError(_0x3c514c,null));};exports[_0xe4a7('0x55')]=function(_0x13036e,_0x2c0f7f){return db[_0xe4a7('0x30')][_0xe4a7('0x55')]()[_0xe4a7('0x29')](respondWithResult(_0x2c0f7f,null))['catch'](handleError(_0x2c0f7f,null));};exports[_0xe4a7('0x56')]=function(_0x7a10dc,_0x220e5a,_0xfb5412){var _0x4a538b={'raw':!![],'where':{}},_0x51869e={},_0x6a515d;return db[_0xe4a7('0x30')]['findOne']({'where':{'id':_0x7a10dc[_0xe4a7('0x49')]['id']}})[_0xe4a7('0x29')](handleEntityNotFound(_0x220e5a,null))[_0xe4a7('0x29')](function(_0x1b857d){if(_0x1b857d){_0x6a515d=_0x1b857d[_0xe4a7('0x2b')]({'plain':!![]});_0x51869e[_0xe4a7('0x35')]=_['keys'](db['UserOpenchannelQueue'][_0xe4a7('0x31')]);_0x51869e[_0xe4a7('0x37')]=_['keys'](_0x7a10dc[_0xe4a7('0x37')]);_0x51869e[_0xe4a7('0x38')]=_['intersection'](_0x51869e[_0xe4a7('0x35')],_0x51869e[_0xe4a7('0x37')]);_0x4a538b['attributes']=_[_0xe4a7('0x39')](_0x51869e[_0xe4a7('0x35')],qs[_0xe4a7('0x4a')](_0x7a10dc['query'][_0xe4a7('0x4a')]));_0x4a538b[_0xe4a7('0x3a')]=_0x4a538b['attributes'][_0xe4a7('0x3b')]?_0x4a538b[_0xe4a7('0x3a')]:_0x51869e[_0xe4a7('0x35')];if(!_0x7a10dc[_0xe4a7('0x37')][_0xe4a7('0x3c')](_0xe4a7('0x3d'))){_0x4a538b[_0xe4a7('0x21')]=qs[_0xe4a7('0x21')](_0x7a10dc[_0xe4a7('0x37')][_0xe4a7('0x21')]);_0x4a538b[_0xe4a7('0x1f')]=qs[_0xe4a7('0x1f')](_0x7a10dc[_0xe4a7('0x37')][_0xe4a7('0x1f')]);}_0x4a538b['order']=qs[_0xe4a7('0x3e')](_0x7a10dc[_0xe4a7('0x37')]['sort']);_0x4a538b['where']=qs[_0xe4a7('0x38')](_[_0xe4a7('0x57')](_0x7a10dc[_0xe4a7('0x37')],_0x51869e['filters']));_0x4a538b[_0xe4a7('0x3f')]['OpenchannelQueueId']=_0x1b857d['id'];if(_0x7a10dc['query']['filter']){_0x4a538b[_0xe4a7('0x3f')]=_[_0xe4a7('0x58')](_0x4a538b['where'],{'$or':_[_0xe4a7('0x2f')](_0x4a538b[_0xe4a7('0x3a')],function(_0x4cbe78){var _0x45d143={};_0x45d143[_0x4cbe78]={'$like':'%'+_0x7a10dc['query'][_0xe4a7('0x42')]+'%'};return _0x45d143;})});}_0x4a538b=_[_0xe4a7('0x58')]({},_0x4a538b,_0x7a10dc[_0xe4a7('0x43')]);return db['UserOpenchannelQueue'][_0xe4a7('0x45')](_0x4a538b);}})['then'](function(_0x29f096){if(_0x29f096){return db[_0xe4a7('0x59')][_0xe4a7('0x5a')]({'where':{'id':_[_0xe4a7('0x2f')](_0x29f096,_0xe4a7('0x5b')),'role':_0xe4a7('0x5c')},'attributes':['id',_0xe4a7('0x41'),_0xe4a7('0x5d'),'updatedAt',_0xe4a7('0x5e')]});}})[_0xe4a7('0x29')](function(_0x53d1d1){if(_0x53d1d1){return{'count':_0x53d1d1['count'],'rows':_[_0xe4a7('0x2f')](_0x53d1d1[_0xe4a7('0x46')],function(_0x25179c){return{'membername':_0x25179c[_0xe4a7('0x41')],'UserId':_0x25179c['id'],'queue_name':_0x6a515d['name'],'OpenchannelQueueId':_0x6a515d['id'],'interface':util[_0xe4a7('0x5f')](_0xe4a7('0x60'),_0xe4a7('0x61'),_0x25179c[_0xe4a7('0x41')]),'penalty':0x0,'paused':_0x25179c[_0xe4a7('0x5d')],'createdAt':_0x25179c[_0xe4a7('0x5e')],'updatedAt':_0x25179c[_0xe4a7('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xe4a7('0x29')](respondWithFilteredResult(_0x220e5a,_0x4a538b))[_0xe4a7('0x47')](handleError(_0x220e5a,null));};exports[_0xe4a7('0x63')]=function(_0x76ddb6,_0x16f5ef,_0x7d9da8){var _0x47f3bf={};var _0x313444={};var _0x491941;var _0x1033cc;return db['OpenchannelQueue'][_0xe4a7('0x64')]({'where':{'id':_0x76ddb6[_0xe4a7('0x49')]['id']}})['then'](handleEntityNotFound(_0x16f5ef,null))[_0xe4a7('0x29')](function(_0x34e395){if(_0x34e395){_0x491941=_0x34e395;_0x313444[_0xe4a7('0x35')]=_[_0xe4a7('0x36')](db[_0xe4a7('0x65')][_0xe4a7('0x31')]);_0x313444[_0xe4a7('0x37')]=_[_0xe4a7('0x36')](_0x76ddb6[_0xe4a7('0x37')]);_0x313444[_0xe4a7('0x38')]=_[_0xe4a7('0x39')](_0x313444['model'],_0x313444[_0xe4a7('0x37')]);_0x47f3bf[_0xe4a7('0x3a')]=_[_0xe4a7('0x39')](_0x313444[_0xe4a7('0x35')],qs[_0xe4a7('0x4a')](_0x76ddb6['query'][_0xe4a7('0x4a')]));_0x47f3bf[_0xe4a7('0x3a')]=_0x47f3bf[_0xe4a7('0x3a')][_0xe4a7('0x3b')]?_0x47f3bf[_0xe4a7('0x3a')]:_0x313444[_0xe4a7('0x35')];_0x47f3bf[_0xe4a7('0x66')]=qs[_0xe4a7('0x3e')](_0x76ddb6['query'][_0xe4a7('0x3e')]);_0x47f3bf[_0xe4a7('0x3f')]=qs[_0xe4a7('0x38')](_['pick'](_0x76ddb6[_0xe4a7('0x37')],_0x313444['filters']));if(_0x76ddb6[_0xe4a7('0x37')]['filter']){_0x47f3bf[_0xe4a7('0x3f')]=_[_0xe4a7('0x58')](_0x47f3bf[_0xe4a7('0x3f')],{'$or':_[_0xe4a7('0x2f')](_0x47f3bf['attributes'],function(_0x24b939){var _0x55c941={};_0x55c941[_0x24b939]={'$like':'%'+_0x76ddb6['query'][_0xe4a7('0x42')]+'%'};return _0x55c941;})});}_0x47f3bf=_[_0xe4a7('0x58')]({},_0x47f3bf,_0x76ddb6[_0xe4a7('0x43')]);return _0x491941['getTeams'](_0x47f3bf);}})[_0xe4a7('0x29')](function(_0x4ecdcf){if(_0x4ecdcf){_0x1033cc=_0x4ecdcf[_0xe4a7('0x3b')];if(!_0x76ddb6['query']['hasOwnProperty'](_0xe4a7('0x3d'))){_0x47f3bf[_0xe4a7('0x21')]=qs['limit'](_0x76ddb6['query'][_0xe4a7('0x21')]);_0x47f3bf['offset']=qs[_0xe4a7('0x1f')](_0x76ddb6[_0xe4a7('0x37')][_0xe4a7('0x1f')]);}return _0x491941[_0xe4a7('0x63')](_0x47f3bf);}})[_0xe4a7('0x29')](function(_0x26f545){if(_0x26f545){return _0x26f545?{'count':_0x1033cc,'rows':_0x26f545}:null;}})[_0xe4a7('0x29')](respondWithResult(_0x16f5ef,null))[_0xe4a7('0x47')](handleError(_0x16f5ef,null));};exports[_0xe4a7('0x67')]=function(_0x21b882,_0x590a31,_0x3de2a0){var _0x3b5696=_0x21b882[_0xe4a7('0x54')]['ids'];return db[_0xe4a7('0x65')]['findAll']({'where':{'id':_0x3b5696},'attributes':['id'],'include':[{'model':db[_0xe4a7('0x59')],'as':_0xe4a7('0x68'),'attributes':['id',_0xe4a7('0x41'),_0xe4a7('0x69'),_0xe4a7('0x6a'),_0xe4a7('0x6b')],'raw':!![]}]})[_0xe4a7('0x29')](function(_0x121260){if(_0x121260){var _0x55abf2=_['flatMap'](_0x121260,function(_0x219f72){var _0x3d747c=_0x219f72[_0xe4a7('0x2b')]({'plain':!![]});return _0x3d747c[_0xe4a7('0x68')];});return db[_0xe4a7('0x30')][_0xe4a7('0x50')]({'where':{'id':_0x21b882[_0xe4a7('0x49')]['id']}})[_0xe4a7('0x29')](function(_0x2d3906){return db[_0xe4a7('0x6c')][_0xe4a7('0x6d')](function(_0x152937){return _0x2d3906['addTeams'](_0x3b5696,{'transaction':_0x152937})[_0xe4a7('0x29')](function(){return BPromise['each'](_0x55abf2,function(_0xe8eb62){return db['UserOpenchannelQueue'][_0xe4a7('0x6e')]({'where':{'UserId':_0xe8eb62['id'],'OpenchannelQueueId':_0x21b882[_0xe4a7('0x49')]['id']},'transaction':_0x152937});});})[_0xe4a7('0x29')](function(){_0x55abf2['forEach'](function(_0x2c10cc){socket[_0xe4a7('0x6f')]('userOpenchannelQueue:save',{'UserId':_0x2c10cc['id'],'OpenchannelQueueId':_0x2d3906['id']});});});});});}})[_0xe4a7('0x29')](respondWithStatusCode(_0x590a31,null))['catch'](handleError(_0x590a31,null));};exports[_0xe4a7('0x70')]=function(_0x500c24,_0x1a6d6e,_0x10a682){return db[_0xe4a7('0x65')][_0xe4a7('0x45')]({'where':{'id':_0x500c24[_0xe4a7('0x37')][_0xe4a7('0x71')]},'attributes':['id'],'include':[{'model':db[_0xe4a7('0x59')],'as':_0xe4a7('0x68'),'attributes':['id'],'raw':!![]}]})[_0xe4a7('0x29')](handleEntityNotFound(_0x1a6d6e,null))[_0xe4a7('0x29')](function(_0x1c85fb){var _0x20b231=_[_0xe4a7('0x2f')](_0x1c85fb,'id');var _0x4bc9d4=[];var _0xfa338a=[];var _0x9d1c81=squel[_0xe4a7('0x72')]();_0x9d1c81[_0xe4a7('0x73')]('tq.TeamId')[_0xe4a7('0x74')](_0xe4a7('0x75'),'tq')[_0xe4a7('0x76')](_0xe4a7('0x77'),'ut',_0xe4a7('0x78'))[_0xe4a7('0x3f')]('OpenchannelQueueId\x20=\x20?',_0x500c24['params']['id']);for(var _0x4a2dc1=0x0;_0x4a2dc1<_0x1c85fb['length'];_0x4a2dc1+=0x1){let _0xffeebe=_0x1c85fb[_0x4a2dc1];for(var _0x323c40=0x0;_0x323c40<_0xffeebe[_0xe4a7('0x68')][_0xe4a7('0x3b')];_0x323c40+=0x1){let _0x331a13=_0xffeebe['Agents'][_0x323c40];var _0x11e217=_0x9d1c81[_0xe4a7('0x79')]();_0x11e217[_0xe4a7('0x3f')]('ut.UserId\x20=\x20?',_0x331a13['id']);_0xfa338a[_0xe4a7('0x7a')](db[_0xe4a7('0x6c')][_0xe4a7('0x37')](_0x11e217[_0xe4a7('0x7b')](),{'type':db[_0xe4a7('0x6c')][_0xe4a7('0x7c')]['SELECT']})[_0xe4a7('0x29')](function(_0x6a32cb){if(_0x6a32cb['length']===0x1){return _0x331a13['id'];}else{var _0x50da0f=_[_0xe4a7('0x7d')](_[_0xe4a7('0x2f')](_0x6a32cb,'TeamId'),function(_0x4d5e7d){return _[_0xe4a7('0x7e')](_0x20b231,_0x4d5e7d);});if(_0x50da0f){return _0x331a13['id'];}}}));}}return BPromise[_0xe4a7('0x7f')](_0xfa338a)[_0xe4a7('0x29')](function(_0x32e24e){_0x4bc9d4=_(_0x4bc9d4)[_0xe4a7('0x80')](_0x32e24e)[_0xe4a7('0x81')]()[_0xe4a7('0x82')]();return db[_0xe4a7('0x30')][_0xe4a7('0x50')]({'where':{'id':_0x500c24[_0xe4a7('0x49')]['id']}})['then'](function(_0xd7495c){return db[_0xe4a7('0x6c')][_0xe4a7('0x6d')](function(_0x18118f){return _0xd7495c[_0xe4a7('0x70')](_0x500c24[_0xe4a7('0x37')]['ids'],{'transaction':_0x18118f})[_0xe4a7('0x29')](function(){if(!_['isEmpty'](_0x4bc9d4)){return _0xd7495c[_0xe4a7('0x83')](_0x4bc9d4,{'transaction':_0x18118f});}})[_0xe4a7('0x29')](function(){_0x4bc9d4[_0xe4a7('0x84')](function(_0x335a48){socket[_0xe4a7('0x6f')](_0xe4a7('0x85'),{'UserId':_0x335a48,'OpenchannelQueueId':_0xd7495c['id']});});});});});});})['then'](respondWithStatusCode(_0x1a6d6e,null))[_0xe4a7('0x47')](handleError(_0x1a6d6e,null));};exports[_0xe4a7('0x86')]=function(_0x64fa5e,_0xd9e5ed,_0x18a2d6){return db[_0xe4a7('0x30')][_0xe4a7('0x50')]({'where':{'id':_0x64fa5e[_0xe4a7('0x49')]['id']}})[_0xe4a7('0x29')](handleEntityNotFound(_0xd9e5ed,null))[_0xe4a7('0x29')](function(_0x39d6e3){if(_0x39d6e3){return _0x39d6e3[_0xe4a7('0x86')](_0x64fa5e[_0xe4a7('0x54')][_0xe4a7('0x71')],_[_0xe4a7('0x87')](_0x64fa5e[_0xe4a7('0x54')],[_0xe4a7('0x71'),'id'])||{})[_0xe4a7('0x88')](function(_0xf2b3fb){for(var _0x36ad53=0x0;_0x36ad53<_0x64fa5e[_0xe4a7('0x54')]['ids'][_0xe4a7('0x3b')];_0x36ad53+=0x1){socket['emit']('userOpenchannelQueue:save',{'UserId':Number(_0x64fa5e[_0xe4a7('0x54')][_0xe4a7('0x71')][_0x36ad53]),'OpenchannelQueueId':Number(_0x64fa5e[_0xe4a7('0x49')]['id'])});}return _0xf2b3fb;});}})['then'](respondWithResult(_0xd9e5ed,null))[_0xe4a7('0x47')](handleError(_0xd9e5ed,null));};exports['removeAgents']=function(_0x570654,_0x184710,_0x166a1d){return db[_0xe4a7('0x30')][_0xe4a7('0x50')]({'where':{'id':_0x570654['params']['id']}})[_0xe4a7('0x29')](handleEntityNotFound(_0x184710,null))['then'](function(_0x2448d4){if(_0x2448d4){return _0x2448d4[_0xe4a7('0x83')](_0x570654[_0xe4a7('0x37')][_0xe4a7('0x71')])[_0xe4a7('0x29')](function(){if(_[_0xe4a7('0x89')](_0x570654[_0xe4a7('0x37')][_0xe4a7('0x71')])){for(var _0x4b840d=0x0;_0x4b840d<_0x570654[_0xe4a7('0x37')][_0xe4a7('0x71')][_0xe4a7('0x3b')];_0x4b840d+=0x1){socket[_0xe4a7('0x6f')](_0xe4a7('0x85'),{'UserId':Number(_0x570654[_0xe4a7('0x37')][_0xe4a7('0x71')][_0x4b840d]),'OpenchannelQueueId':Number(_0x570654[_0xe4a7('0x49')]['id'])});}}else{socket['emit'](_0xe4a7('0x85'),{'UserId':Number(_0x570654['query'][_0xe4a7('0x71')]),'OpenchannelQueueId':Number(_0x570654[_0xe4a7('0x49')]['id'])});}});}})[_0xe4a7('0x29')](respondWithStatusCode(_0x184710,null))[_0xe4a7('0x47')](handleError(_0x184710,null));};exports[_0xe4a7('0x8a')]=function(_0x50ed82,_0x5450c7,_0x5350fd){var _0x3b0706={};var _0x417b0a={};var _0x2fffc1;var _0x361667;return db[_0xe4a7('0x30')]['findOne']({'where':{'id':_0x50ed82[_0xe4a7('0x49')]['id']}})[_0xe4a7('0x29')](handleEntityNotFound(_0x5450c7,null))['then'](function(_0x4104d0){if(_0x4104d0){_0x2fffc1=_0x4104d0;_0x417b0a[_0xe4a7('0x35')]=_[_0xe4a7('0x36')](db['User'][_0xe4a7('0x31')]);_0x417b0a[_0xe4a7('0x37')]=_[_0xe4a7('0x36')](_0x50ed82[_0xe4a7('0x37')]);_0x417b0a[_0xe4a7('0x38')]=_[_0xe4a7('0x39')](_0x417b0a[_0xe4a7('0x35')],_0x417b0a['query']);_0x3b0706[_0xe4a7('0x3a')]=_[_0xe4a7('0x39')](_0x417b0a[_0xe4a7('0x35')],qs[_0xe4a7('0x4a')](_0x50ed82[_0xe4a7('0x37')][_0xe4a7('0x4a')]));_0x3b0706[_0xe4a7('0x3a')]=_0x3b0706[_0xe4a7('0x3a')][_0xe4a7('0x3b')]?_0x3b0706[_0xe4a7('0x3a')]:_0x417b0a['model'];_0x3b0706[_0xe4a7('0x66')]=qs[_0xe4a7('0x3e')](_0x50ed82[_0xe4a7('0x37')][_0xe4a7('0x3e')]);_0x3b0706[_0xe4a7('0x3f')]=qs[_0xe4a7('0x38')](_['pick'](_0x50ed82['query'],_0x417b0a[_0xe4a7('0x38')]));if(_0x50ed82[_0xe4a7('0x37')][_0xe4a7('0x42')]){_0x3b0706['where']=_[_0xe4a7('0x58')](_0x3b0706[_0xe4a7('0x3f')],{'$or':_[_0xe4a7('0x2f')](_0x3b0706['attributes'],function(_0x10c20d){var _0x958082={};_0x958082[_0x10c20d]={'$like':'%'+_0x50ed82[_0xe4a7('0x37')][_0xe4a7('0x42')]+'%'};return _0x958082;})});}_0x3b0706=_[_0xe4a7('0x58')]({},_0x3b0706,_0x50ed82['options']);return _0x2fffc1[_0xe4a7('0x8a')](_0x3b0706);}})[_0xe4a7('0x29')](function(_0x1f538c){if(_0x1f538c){_0x361667=_0x1f538c[_0xe4a7('0x3b')];if(!_0x50ed82[_0xe4a7('0x37')]['hasOwnProperty'](_0xe4a7('0x3d'))){_0x3b0706[_0xe4a7('0x21')]=qs[_0xe4a7('0x21')](_0x50ed82[_0xe4a7('0x37')]['limit']);_0x3b0706[_0xe4a7('0x1f')]=qs[_0xe4a7('0x1f')](_0x50ed82[_0xe4a7('0x37')][_0xe4a7('0x1f')]);}return _0x2fffc1[_0xe4a7('0x8a')](_0x3b0706);}})[_0xe4a7('0x29')](function(_0x3103fe){if(_0x3103fe){return _0x3103fe?{'count':_0x361667,'rows':_0x3103fe}:null;}})['then'](respondWithResult(_0x5450c7,null))['catch'](handleError(_0x5450c7,null));}; \ No newline at end of file +var _0x9a7d=['../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','end','status','offset','undefined','count','limit','set','Content-Range','apply','reject','update','get','OpenchannelQueues','UserProfileResource','destroy','then','error','stack','name','send','index','OpenchannelQueue','fieldName','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserOpenchannelQueue','nolimit','OpenchannelQueueId','filter','User','findAndCountAll','UserId','openchannelPause','updatedAt','format','createdAt','Team','addTeams','ids','online','voicePause','interface','flatMap','Agents','sequelize','each','findOrCreate','userOpenchannelQueue:save','field','from','team_has_openchannel_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','includes','all','union','compact','value','transaction','isEmpty','forEach','emit','addAgents','omit','spread','removeAgents','userOpenchannelQueue:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','ioredis'];(function(_0x4a0340,_0x245814){var _0x4cb1ac=function(_0x5f5c9b){while(--_0x5f5c9b){_0x4a0340['push'](_0x4a0340['shift']());}};_0x4cb1ac(++_0x245814);}(_0x9a7d,0x7c));var _0xd9a7=function(_0x2578b1,_0x2dbb90){_0x2578b1=_0x2578b1-0x0;var _0x1c42b4=_0x9a7d[_0x2578b1];return _0x1c42b4;};'use strict';var emlformat=require(_0xd9a7('0x0'));var rimraf=require(_0xd9a7('0x1'));var zipdir=require(_0xd9a7('0x2'));var jsonpatch=require(_0xd9a7('0x3'));var rp=require(_0xd9a7('0x4'));var moment=require(_0xd9a7('0x5'));var BPromise=require(_0xd9a7('0x6'));var Mustache=require(_0xd9a7('0x7'));var util=require('util');var path=require(_0xd9a7('0x8'));var sox=require(_0xd9a7('0x9'));var csv=require(_0xd9a7('0xa'));var ejs=require(_0xd9a7('0xb'));var fs=require('fs');var fs_extra=require(_0xd9a7('0xc'));var _=require(_0xd9a7('0xd'));var squel=require('squel');var crypto=require(_0xd9a7('0xe'));var jsforce=require(_0xd9a7('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xd9a7('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd9a7('0x10'));var authService=require(_0xd9a7('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xd9a7('0x12'));var hardwareService=require(_0xd9a7('0x13'));var logger=require(_0xd9a7('0x14'))(_0xd9a7('0x15'));var utils=require(_0xd9a7('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xd9a7('0x17'));var db=require(_0xd9a7('0x18'))['db'];config[_0xd9a7('0x19')]=_[_0xd9a7('0x1a')](config[_0xd9a7('0x19')],{'host':_0xd9a7('0x1b'),'port':0x18eb});var socket=require(_0xd9a7('0x1c'))(new Redis(config[_0xd9a7('0x19')]));require(_0xd9a7('0x1d'))[_0xd9a7('0x1e')](socket);function respondWithStatusCode(_0x41943b,_0xaf400d){_0xaf400d=_0xaf400d||0xcc;return function(_0x1d879f){if(_0x1d879f){return _0x41943b[_0xd9a7('0x1f')](_0xaf400d);}return _0x41943b['status'](_0xaf400d)[_0xd9a7('0x20')]();};}function respondWithResult(_0xfa5e99,_0x184a8b){_0x184a8b=_0x184a8b||0xc8;return function(_0x17fa8f){if(_0x17fa8f){return _0xfa5e99[_0xd9a7('0x21')](_0x184a8b)['json'](_0x17fa8f);}};}function respondWithFilteredResult(_0x5b7850,_0x31df5d){return function(_0xfad32e){if(_0xfad32e){var _0x68e26d=typeof _0x31df5d[_0xd9a7('0x22')]==='undefined'&&typeof _0x31df5d['limit']===_0xd9a7('0x23');var _0x31e423=_0xfad32e[_0xd9a7('0x24')];var _0x380502=_0x68e26d?0x0:_0x31df5d[_0xd9a7('0x22')];var _0x31005a=_0x68e26d?_0xfad32e[_0xd9a7('0x24')]:_0x31df5d[_0xd9a7('0x22')]+_0x31df5d[_0xd9a7('0x25')];var _0x5c4c91;if(_0x31005a>=_0x31e423){_0x31005a=_0x31e423;_0x5c4c91=0xc8;}else{_0x5c4c91=0xce;}_0x5b7850[_0xd9a7('0x21')](_0x5c4c91);return _0x5b7850[_0xd9a7('0x26')](_0xd9a7('0x27'),_0x380502+'-'+_0x31005a+'/'+_0x31e423)['json'](_0xfad32e);}return null;};}function patchUpdates(_0x48bb21){return function(_0x3276d1){try{jsonpatch[_0xd9a7('0x28')](_0x3276d1,_0x48bb21,!![]);}catch(_0x3bd9c1){return BPromise[_0xd9a7('0x29')](_0x3bd9c1);}return _0x3276d1['save']();};}function saveUpdates(_0x43dfe4,_0x1332db){return function(_0x43a0a5){if(_0x43a0a5){return _0x43a0a5[_0xd9a7('0x2a')](_0x43dfe4)['then'](function(_0x4821dc){return _0x4821dc;});}return null;};}function removeEntity(_0x511382,_0x4f33dd){return function(_0x1d5107){if(_0x1d5107){return _0x1d5107['destroy']()['then'](function(){var _0x1a0411=_0x1d5107[_0xd9a7('0x2b')]({'plain':!![]});var _0x4f676e=_0xd9a7('0x2c');return db[_0xd9a7('0x2d')][_0xd9a7('0x2e')]({'where':{'type':_0x4f676e,'resourceId':_0x1a0411['id']}})['then'](function(){return _0x1d5107;});})[_0xd9a7('0x2f')](function(){_0x511382[_0xd9a7('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x206e3c,_0x506d87){return function(_0x981e46){if(!_0x981e46){_0x206e3c[_0xd9a7('0x1f')](0x194);}return _0x981e46;};}function handleError(_0x14a7f3,_0x2a99db){_0x2a99db=_0x2a99db||0x1f4;return function(_0x34f6e9){logger[_0xd9a7('0x30')](_0x34f6e9[_0xd9a7('0x31')]);if(_0x34f6e9['name']){delete _0x34f6e9[_0xd9a7('0x32')];}_0x14a7f3[_0xd9a7('0x21')](_0x2a99db)[_0xd9a7('0x33')](_0x34f6e9);};}exports[_0xd9a7('0x34')]=function(_0x3f4450,_0x28cf87){var _0x20f7bd={},_0x7d42a2={},_0x1ec85e={'count':0x0,'rows':[]};var _0x5d3b96=_['map'](db[_0xd9a7('0x35')]['rawAttributes'],function(_0x3584dd){return{'name':_0x3584dd[_0xd9a7('0x36')],'type':_0x3584dd['type']['key']};});_0x7d42a2['model']=_['map'](_0x5d3b96,'name');_0x7d42a2['query']=_[_0xd9a7('0x37')](_0x3f4450[_0xd9a7('0x38')]);_0x7d42a2[_0xd9a7('0x39')]=_[_0xd9a7('0x3a')](_0x7d42a2[_0xd9a7('0x3b')],_0x7d42a2[_0xd9a7('0x38')]);_0x20f7bd[_0xd9a7('0x3c')]=_[_0xd9a7('0x3a')](_0x7d42a2[_0xd9a7('0x3b')],qs[_0xd9a7('0x3d')](_0x3f4450['query'][_0xd9a7('0x3d')]));_0x20f7bd[_0xd9a7('0x3c')]=_0x20f7bd['attributes'][_0xd9a7('0x3e')]?_0x20f7bd[_0xd9a7('0x3c')]:_0x7d42a2['model'];if(!_0x3f4450[_0xd9a7('0x38')][_0xd9a7('0x3f')]('nolimit')){_0x20f7bd[_0xd9a7('0x25')]=qs['limit'](_0x3f4450[_0xd9a7('0x38')][_0xd9a7('0x25')]);_0x20f7bd[_0xd9a7('0x22')]=qs['offset'](_0x3f4450['query'][_0xd9a7('0x22')]);}_0x20f7bd[_0xd9a7('0x40')]=qs[_0xd9a7('0x41')](_0x3f4450[_0xd9a7('0x38')][_0xd9a7('0x41')]);_0x20f7bd[_0xd9a7('0x42')]=qs[_0xd9a7('0x39')](_[_0xd9a7('0x43')](_0x3f4450[_0xd9a7('0x38')],_0x7d42a2[_0xd9a7('0x39')]),_0x5d3b96);if(_0x3f4450['query']['filter']){_0x20f7bd['where']=_[_0xd9a7('0x44')](_0x20f7bd['where'],{'$or':_[_0xd9a7('0x45')](_0x5d3b96,function(_0x4e2e49){if(_0x4e2e49['type']!==_0xd9a7('0x46')){var _0x567f37={};_0x567f37[_0x4e2e49['name']]={'$like':'%'+_0x3f4450[_0xd9a7('0x38')]['filter']+'%'};return _0x567f37;}})});}_0x20f7bd=_['merge']({},_0x20f7bd,_0x3f4450[_0xd9a7('0x47')]);var _0x53ac36={'where':_0x20f7bd[_0xd9a7('0x42')]};return db[_0xd9a7('0x35')]['count'](_0x53ac36)['then'](function(_0x58bc22){_0x1ec85e[_0xd9a7('0x24')]=_0x58bc22;if(_0x3f4450['query'][_0xd9a7('0x48')]){_0x20f7bd[_0xd9a7('0x49')]=[{'all':!![]}];}return db[_0xd9a7('0x35')][_0xd9a7('0x4a')](_0x20f7bd);})[_0xd9a7('0x2f')](function(_0x503543){_0x1ec85e[_0xd9a7('0x4b')]=_0x503543;return _0x1ec85e;})[_0xd9a7('0x2f')](respondWithFilteredResult(_0x28cf87,_0x20f7bd))[_0xd9a7('0x4c')](handleError(_0x28cf87,null));};exports['show']=function(_0x23ec5b,_0x581fa3){var _0x4878b4={'raw':!![],'where':{'id':_0x23ec5b[_0xd9a7('0x4d')]['id']}},_0x19cadd={};_0x19cadd[_0xd9a7('0x3b')]=_[_0xd9a7('0x37')](db[_0xd9a7('0x35')][_0xd9a7('0x4e')]);_0x19cadd[_0xd9a7('0x38')]=_[_0xd9a7('0x37')](_0x23ec5b[_0xd9a7('0x38')]);_0x19cadd['filters']=_['intersection'](_0x19cadd[_0xd9a7('0x3b')],_0x19cadd[_0xd9a7('0x38')]);_0x4878b4[_0xd9a7('0x3c')]=_[_0xd9a7('0x3a')](_0x19cadd[_0xd9a7('0x3b')],qs[_0xd9a7('0x3d')](_0x23ec5b['query'][_0xd9a7('0x3d')]));_0x4878b4['attributes']=_0x4878b4['attributes']['length']?_0x4878b4[_0xd9a7('0x3c')]:_0x19cadd[_0xd9a7('0x3b')];if(_0x23ec5b['query'][_0xd9a7('0x48')]){_0x4878b4[_0xd9a7('0x49')]=[{'all':!![]}];}_0x4878b4=_[_0xd9a7('0x44')]({},_0x4878b4,_0x23ec5b[_0xd9a7('0x47')]);return db[_0xd9a7('0x35')][_0xd9a7('0x4f')](_0x4878b4)['then'](handleEntityNotFound(_0x581fa3,null))[_0xd9a7('0x2f')](respondWithResult(_0x581fa3,null))['catch'](handleError(_0x581fa3,null));};exports[_0xd9a7('0x50')]=function(_0x2a8ae6,_0x11cc3e){return db['OpenchannelQueue']['create'](_0x2a8ae6[_0xd9a7('0x51')],{})[_0xd9a7('0x2f')](function(_0x46d1a0){var _0x130c82=_0x2a8ae6[_0xd9a7('0x52')][_0xd9a7('0x2b')]({'plain':!![]});if(!_0x130c82)throw new Error(_0xd9a7('0x53'));if(_0x130c82['role']===_0xd9a7('0x52')){var _0x35d032=_0x46d1a0[_0xd9a7('0x2b')]({'plain':!![]});var _0x1d8e11=_0xd9a7('0x2c');return db[_0xd9a7('0x54')][_0xd9a7('0x4f')]({'where':{'name':_0x1d8e11,'userProfileId':_0x130c82[_0xd9a7('0x55')]},'raw':!![]})[_0xd9a7('0x2f')](function(_0x2d31d8){if(_0x2d31d8&&_0x2d31d8[_0xd9a7('0x56')]===0x0){return db['UserProfileResource'][_0xd9a7('0x50')]({'name':_0x35d032[_0xd9a7('0x32')],'resourceId':_0x35d032['id'],'type':_0x2d31d8[_0xd9a7('0x32')],'sectionId':_0x2d31d8['id']},{})[_0xd9a7('0x2f')](function(){return _0x46d1a0;});}else{return _0x46d1a0;}})[_0xd9a7('0x4c')](function(_0x4cd161){logger[_0xd9a7('0x30')](_0xd9a7('0x57'),_0x4cd161);throw _0x4cd161;});}return _0x46d1a0;})['then'](respondWithResult(_0x11cc3e,0xc9))['catch'](handleError(_0x11cc3e,null));};exports[_0xd9a7('0x2a')]=function(_0x1b0fcd,_0x5a09f7){if(_0x1b0fcd[_0xd9a7('0x51')]['id']){delete _0x1b0fcd[_0xd9a7('0x51')]['id'];}return db['OpenchannelQueue'][_0xd9a7('0x4f')]({'where':{'id':_0x1b0fcd[_0xd9a7('0x4d')]['id']}})['then'](handleEntityNotFound(_0x5a09f7,null))[_0xd9a7('0x2f')](saveUpdates(_0x1b0fcd[_0xd9a7('0x51')],null))['then'](respondWithResult(_0x5a09f7,null))[_0xd9a7('0x4c')](handleError(_0x5a09f7,null));};exports[_0xd9a7('0x2e')]=function(_0x1096e1,_0x352a47){return db[_0xd9a7('0x35')][_0xd9a7('0x4f')]({'where':{'id':_0x1096e1[_0xd9a7('0x4d')]['id']}})[_0xd9a7('0x2f')](handleEntityNotFound(_0x352a47,null))[_0xd9a7('0x2f')](removeEntity(_0x352a47,null))[_0xd9a7('0x4c')](handleError(_0x352a47,null));};exports[_0xd9a7('0x58')]=function(_0x22c340,_0x5c16eb){return db['OpenchannelQueue'][_0xd9a7('0x58')]()[_0xd9a7('0x2f')](respondWithResult(_0x5c16eb,null))['catch'](handleError(_0x5c16eb,null));};exports[_0xd9a7('0x59')]=function(_0x8dd64e,_0x45c302,_0x328627){var _0x5797f8={'raw':!![],'where':{}},_0x57a5b1={},_0x3095af;return db['OpenchannelQueue'][_0xd9a7('0x5a')]({'where':{'id':_0x8dd64e['params']['id']}})[_0xd9a7('0x2f')](handleEntityNotFound(_0x45c302,null))[_0xd9a7('0x2f')](function(_0x2bddc7){if(_0x2bddc7){_0x3095af=_0x2bddc7[_0xd9a7('0x2b')]({'plain':!![]});_0x57a5b1[_0xd9a7('0x3b')]=_[_0xd9a7('0x37')](db[_0xd9a7('0x5b')]['rawAttributes']);_0x57a5b1[_0xd9a7('0x38')]=_[_0xd9a7('0x37')](_0x8dd64e[_0xd9a7('0x38')]);_0x57a5b1[_0xd9a7('0x39')]=_['intersection'](_0x57a5b1[_0xd9a7('0x3b')],_0x57a5b1['query']);_0x5797f8[_0xd9a7('0x3c')]=_[_0xd9a7('0x3a')](_0x57a5b1[_0xd9a7('0x3b')],qs['fields'](_0x8dd64e[_0xd9a7('0x38')]['fields']));_0x5797f8[_0xd9a7('0x3c')]=_0x5797f8['attributes']['length']?_0x5797f8[_0xd9a7('0x3c')]:_0x57a5b1['model'];if(!_0x8dd64e[_0xd9a7('0x38')][_0xd9a7('0x3f')](_0xd9a7('0x5c'))){_0x5797f8[_0xd9a7('0x25')]=qs['limit'](_0x8dd64e[_0xd9a7('0x38')]['limit']);_0x5797f8[_0xd9a7('0x22')]=qs['offset'](_0x8dd64e[_0xd9a7('0x38')][_0xd9a7('0x22')]);}_0x5797f8['order']=qs[_0xd9a7('0x41')](_0x8dd64e['query'][_0xd9a7('0x41')]);_0x5797f8[_0xd9a7('0x42')]=qs[_0xd9a7('0x39')](_[_0xd9a7('0x43')](_0x8dd64e['query'],_0x57a5b1[_0xd9a7('0x39')]));_0x5797f8[_0xd9a7('0x42')][_0xd9a7('0x5d')]=_0x2bddc7['id'];if(_0x8dd64e[_0xd9a7('0x38')][_0xd9a7('0x5e')]){_0x5797f8[_0xd9a7('0x42')]=_[_0xd9a7('0x44')](_0x5797f8['where'],{'$or':_[_0xd9a7('0x45')](_0x5797f8[_0xd9a7('0x3c')],function(_0xadba55){var _0x3cdf0b={};_0x3cdf0b[_0xadba55]={'$like':'%'+_0x8dd64e[_0xd9a7('0x38')][_0xd9a7('0x5e')]+'%'};return _0x3cdf0b;})});}_0x5797f8=_[_0xd9a7('0x44')]({},_0x5797f8,_0x8dd64e[_0xd9a7('0x47')]);return db['UserOpenchannelQueue']['findAll'](_0x5797f8);}})[_0xd9a7('0x2f')](function(_0x1c03e1){if(_0x1c03e1){return db[_0xd9a7('0x5f')][_0xd9a7('0x60')]({'where':{'id':_[_0xd9a7('0x45')](_0x1c03e1,_0xd9a7('0x61')),'role':'agent'},'attributes':['id',_0xd9a7('0x32'),_0xd9a7('0x62'),_0xd9a7('0x63'),'createdAt']});}})[_0xd9a7('0x2f')](function(_0x81578c){if(_0x81578c){return{'count':_0x81578c[_0xd9a7('0x24')],'rows':_['map'](_0x81578c[_0xd9a7('0x4b')],function(_0x14c45c){return{'membername':_0x14c45c[_0xd9a7('0x32')],'UserId':_0x14c45c['id'],'queue_name':_0x3095af[_0xd9a7('0x32')],'OpenchannelQueueId':_0x3095af['id'],'interface':util[_0xd9a7('0x64')]('%s/%s','SIP',_0x14c45c[_0xd9a7('0x32')]),'penalty':0x0,'paused':_0x14c45c[_0xd9a7('0x62')],'createdAt':_0x14c45c[_0xd9a7('0x65')],'updatedAt':_0x14c45c[_0xd9a7('0x63')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xd9a7('0x2f')](respondWithFilteredResult(_0x45c302,_0x5797f8))[_0xd9a7('0x4c')](handleError(_0x45c302,null));};exports['getTeams']=function(_0x60f7f1,_0x31a255,_0x5eaa84){var _0x38376e={};var _0x573271={};var _0xe005f2;var _0x23f11b;return db[_0xd9a7('0x35')][_0xd9a7('0x5a')]({'where':{'id':_0x60f7f1[_0xd9a7('0x4d')]['id']}})['then'](handleEntityNotFound(_0x31a255,null))[_0xd9a7('0x2f')](function(_0x27ba16){if(_0x27ba16){_0xe005f2=_0x27ba16;_0x573271[_0xd9a7('0x3b')]=_[_0xd9a7('0x37')](db[_0xd9a7('0x66')]['rawAttributes']);_0x573271[_0xd9a7('0x38')]=_[_0xd9a7('0x37')](_0x60f7f1['query']);_0x573271[_0xd9a7('0x39')]=_[_0xd9a7('0x3a')](_0x573271['model'],_0x573271['query']);_0x38376e['attributes']=_['intersection'](_0x573271['model'],qs[_0xd9a7('0x3d')](_0x60f7f1[_0xd9a7('0x38')][_0xd9a7('0x3d')]));_0x38376e[_0xd9a7('0x3c')]=_0x38376e[_0xd9a7('0x3c')][_0xd9a7('0x3e')]?_0x38376e[_0xd9a7('0x3c')]:_0x573271['model'];_0x38376e[_0xd9a7('0x40')]=qs[_0xd9a7('0x41')](_0x60f7f1[_0xd9a7('0x38')][_0xd9a7('0x41')]);_0x38376e[_0xd9a7('0x42')]=qs[_0xd9a7('0x39')](_[_0xd9a7('0x43')](_0x60f7f1[_0xd9a7('0x38')],_0x573271[_0xd9a7('0x39')]));if(_0x60f7f1[_0xd9a7('0x38')][_0xd9a7('0x5e')]){_0x38376e[_0xd9a7('0x42')]=_[_0xd9a7('0x44')](_0x38376e[_0xd9a7('0x42')],{'$or':_[_0xd9a7('0x45')](_0x38376e['attributes'],function(_0x439115){var _0x5c7ce6={};_0x5c7ce6[_0x439115]={'$like':'%'+_0x60f7f1[_0xd9a7('0x38')][_0xd9a7('0x5e')]+'%'};return _0x5c7ce6;})});}_0x38376e=_[_0xd9a7('0x44')]({},_0x38376e,_0x60f7f1[_0xd9a7('0x47')]);return _0xe005f2['getTeams'](_0x38376e);}})[_0xd9a7('0x2f')](function(_0x815758){if(_0x815758){_0x23f11b=_0x815758['length'];if(!_0x60f7f1[_0xd9a7('0x38')][_0xd9a7('0x3f')](_0xd9a7('0x5c'))){_0x38376e[_0xd9a7('0x25')]=qs[_0xd9a7('0x25')](_0x60f7f1[_0xd9a7('0x38')][_0xd9a7('0x25')]);_0x38376e[_0xd9a7('0x22')]=qs[_0xd9a7('0x22')](_0x60f7f1['query'][_0xd9a7('0x22')]);}return _0xe005f2['getTeams'](_0x38376e);}})[_0xd9a7('0x2f')](function(_0x10f2a2){if(_0x10f2a2){return _0x10f2a2?{'count':_0x23f11b,'rows':_0x10f2a2}:null;}})[_0xd9a7('0x2f')](respondWithResult(_0x31a255,null))[_0xd9a7('0x4c')](handleError(_0x31a255,null));};exports[_0xd9a7('0x67')]=function(_0xda2228,_0x4c7370,_0xdfa542){var _0x338958=_0xda2228['body'][_0xd9a7('0x68')];return db[_0xd9a7('0x66')][_0xd9a7('0x4a')]({'where':{'id':_0x338958},'attributes':['id'],'include':[{'model':db[_0xd9a7('0x5f')],'as':'Agents','attributes':['id',_0xd9a7('0x32'),_0xd9a7('0x69'),_0xd9a7('0x6a'),_0xd9a7('0x6b')],'raw':!![]}]})[_0xd9a7('0x2f')](function(_0x1b6575){if(_0x1b6575){var _0x255ae4=_[_0xd9a7('0x6c')](_0x1b6575,function(_0x5c2203){var _0x2659a1=_0x5c2203['get']({'plain':!![]});return _0x2659a1[_0xd9a7('0x6d')];});return db['OpenchannelQueue'][_0xd9a7('0x4f')]({'where':{'id':_0xda2228[_0xd9a7('0x4d')]['id']}})[_0xd9a7('0x2f')](function(_0x4a8106){return db[_0xd9a7('0x6e')]['transaction'](function(_0x38d3a8){return _0x4a8106[_0xd9a7('0x67')](_0x338958,{'transaction':_0x38d3a8})[_0xd9a7('0x2f')](function(){return BPromise[_0xd9a7('0x6f')](_0x255ae4,function(_0x2ba45e){return db['UserOpenchannelQueue'][_0xd9a7('0x70')]({'where':{'UserId':_0x2ba45e['id'],'OpenchannelQueueId':_0xda2228['params']['id']},'transaction':_0x38d3a8});});})[_0xd9a7('0x2f')](function(){_0x255ae4['forEach'](function(_0x2be435){socket['emit'](_0xd9a7('0x71'),{'UserId':_0x2be435['id'],'OpenchannelQueueId':_0x4a8106['id']});});});});});}})['then'](respondWithStatusCode(_0x4c7370,null))[_0xd9a7('0x4c')](handleError(_0x4c7370,null));};exports['removeTeams']=function(_0x1ea5b5,_0x5a15c8,_0x10cf3c){return db[_0xd9a7('0x66')]['findAll']({'where':{'id':_0x1ea5b5['query'][_0xd9a7('0x68')]},'attributes':['id'],'include':[{'model':db[_0xd9a7('0x5f')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xd9a7('0x2f')](handleEntityNotFound(_0x5a15c8,null))['then'](function(_0x2804ef){var _0x3e8a2d=_['map'](_0x2804ef,'id');var _0x50fe02=[];var _0x140cb9=[];var _0x4a0fe4=squel['select']();_0x4a0fe4[_0xd9a7('0x72')]('tq.TeamId')[_0xd9a7('0x73')](_0xd9a7('0x74'),'tq')['join'](_0xd9a7('0x75'),'ut',_0xd9a7('0x76'))[_0xd9a7('0x42')](_0xd9a7('0x77'),_0x1ea5b5[_0xd9a7('0x4d')]['id']);for(var _0x288945=0x0;_0x288945<_0x2804ef[_0xd9a7('0x3e')];_0x288945+=0x1){let _0x44efa7=_0x2804ef[_0x288945];for(var _0x1ec03c=0x0;_0x1ec03c<_0x44efa7[_0xd9a7('0x6d')][_0xd9a7('0x3e')];_0x1ec03c+=0x1){let _0x47a89c=_0x44efa7['Agents'][_0x1ec03c];var _0x1fa7fe=_0x4a0fe4[_0xd9a7('0x78')]();_0x1fa7fe[_0xd9a7('0x42')](_0xd9a7('0x79'),_0x47a89c['id']);_0x140cb9[_0xd9a7('0x7a')](db['sequelize'][_0xd9a7('0x38')](_0x1fa7fe[_0xd9a7('0x7b')](),{'type':db[_0xd9a7('0x6e')][_0xd9a7('0x7c')][_0xd9a7('0x7d')]})[_0xd9a7('0x2f')](function(_0x4c9ef6){if(_0x4c9ef6['length']===0x1){return _0x47a89c['id'];}else{var _0x2bbb4d=_['every'](_[_0xd9a7('0x45')](_0x4c9ef6,'TeamId'),function(_0x2b2593){return _[_0xd9a7('0x7e')](_0x3e8a2d,_0x2b2593);});if(_0x2bbb4d){return _0x47a89c['id'];}}}));}}return BPromise[_0xd9a7('0x7f')](_0x140cb9)['then'](function(_0x13f311){_0x50fe02=_(_0x50fe02)[_0xd9a7('0x80')](_0x13f311)[_0xd9a7('0x81')]()[_0xd9a7('0x82')]();return db[_0xd9a7('0x35')][_0xd9a7('0x4f')]({'where':{'id':_0x1ea5b5[_0xd9a7('0x4d')]['id']}})[_0xd9a7('0x2f')](function(_0x5df5d8){return db[_0xd9a7('0x6e')][_0xd9a7('0x83')](function(_0x1e2894){return _0x5df5d8['removeTeams'](_0x1ea5b5[_0xd9a7('0x38')]['ids'],{'transaction':_0x1e2894})[_0xd9a7('0x2f')](function(){if(!_[_0xd9a7('0x84')](_0x50fe02)){return _0x5df5d8['removeAgents'](_0x50fe02,{'transaction':_0x1e2894});}})['then'](function(){_0x50fe02[_0xd9a7('0x85')](function(_0x3a82fa){socket[_0xd9a7('0x86')]('userOpenchannelQueue:remove',{'UserId':_0x3a82fa,'OpenchannelQueueId':_0x5df5d8['id']});});});});});});})[_0xd9a7('0x2f')](respondWithStatusCode(_0x5a15c8,null))['catch'](handleError(_0x5a15c8,null));};exports[_0xd9a7('0x87')]=function(_0x3e15b0,_0x293369,_0x4955d0){return db[_0xd9a7('0x35')][_0xd9a7('0x4f')]({'where':{'id':_0x3e15b0[_0xd9a7('0x4d')]['id']}})['then'](handleEntityNotFound(_0x293369,null))[_0xd9a7('0x2f')](function(_0x250d1b){if(_0x250d1b){return _0x250d1b[_0xd9a7('0x87')](_0x3e15b0[_0xd9a7('0x51')][_0xd9a7('0x68')],_[_0xd9a7('0x88')](_0x3e15b0[_0xd9a7('0x51')],[_0xd9a7('0x68'),'id'])||{})[_0xd9a7('0x89')](function(_0x76ff72){for(var _0x48028b=0x0;_0x48028b<_0x3e15b0['body'][_0xd9a7('0x68')][_0xd9a7('0x3e')];_0x48028b+=0x1){socket[_0xd9a7('0x86')](_0xd9a7('0x71'),{'UserId':Number(_0x3e15b0[_0xd9a7('0x51')][_0xd9a7('0x68')][_0x48028b]),'OpenchannelQueueId':Number(_0x3e15b0[_0xd9a7('0x4d')]['id'])});}return _0x76ff72;});}})[_0xd9a7('0x2f')](respondWithResult(_0x293369,null))[_0xd9a7('0x4c')](handleError(_0x293369,null));};exports[_0xd9a7('0x8a')]=function(_0x3d003e,_0x39fac2,_0x1e3c3d){return db[_0xd9a7('0x35')][_0xd9a7('0x4f')]({'where':{'id':_0x3d003e[_0xd9a7('0x4d')]['id']}})['then'](handleEntityNotFound(_0x39fac2,null))['then'](function(_0x4bcb04){if(_0x4bcb04){return _0x4bcb04[_0xd9a7('0x8a')](_0x3d003e[_0xd9a7('0x38')][_0xd9a7('0x68')])['then'](function(){if(_['isArray'](_0x3d003e[_0xd9a7('0x38')][_0xd9a7('0x68')])){for(var _0x563b6a=0x0;_0x563b6a<_0x3d003e['query']['ids']['length'];_0x563b6a+=0x1){socket[_0xd9a7('0x86')](_0xd9a7('0x8b'),{'UserId':Number(_0x3d003e[_0xd9a7('0x38')][_0xd9a7('0x68')][_0x563b6a]),'OpenchannelQueueId':Number(_0x3d003e[_0xd9a7('0x4d')]['id'])});}}else{socket[_0xd9a7('0x86')](_0xd9a7('0x8b'),{'UserId':Number(_0x3d003e[_0xd9a7('0x38')][_0xd9a7('0x68')]),'OpenchannelQueueId':Number(_0x3d003e['params']['id'])});}});}})['then'](respondWithStatusCode(_0x39fac2,null))[_0xd9a7('0x4c')](handleError(_0x39fac2,null));};exports[_0xd9a7('0x8c')]=function(_0x30ea1b,_0x49858c,_0x7a9251){var _0x545015={};var _0x32d16a={};var _0x1593ad;var _0x3cc867;return db[_0xd9a7('0x35')][_0xd9a7('0x5a')]({'where':{'id':_0x30ea1b[_0xd9a7('0x4d')]['id']}})[_0xd9a7('0x2f')](handleEntityNotFound(_0x49858c,null))[_0xd9a7('0x2f')](function(_0xf116ef){if(_0xf116ef){_0x1593ad=_0xf116ef;_0x32d16a[_0xd9a7('0x3b')]=_[_0xd9a7('0x37')](db[_0xd9a7('0x5f')][_0xd9a7('0x4e')]);_0x32d16a['query']=_[_0xd9a7('0x37')](_0x30ea1b[_0xd9a7('0x38')]);_0x32d16a[_0xd9a7('0x39')]=_['intersection'](_0x32d16a[_0xd9a7('0x3b')],_0x32d16a['query']);_0x545015[_0xd9a7('0x3c')]=_[_0xd9a7('0x3a')](_0x32d16a[_0xd9a7('0x3b')],qs[_0xd9a7('0x3d')](_0x30ea1b[_0xd9a7('0x38')][_0xd9a7('0x3d')]));_0x545015[_0xd9a7('0x3c')]=_0x545015[_0xd9a7('0x3c')]['length']?_0x545015['attributes']:_0x32d16a['model'];_0x545015[_0xd9a7('0x40')]=qs[_0xd9a7('0x41')](_0x30ea1b['query'][_0xd9a7('0x41')]);_0x545015[_0xd9a7('0x42')]=qs[_0xd9a7('0x39')](_[_0xd9a7('0x43')](_0x30ea1b['query'],_0x32d16a[_0xd9a7('0x39')]));if(_0x30ea1b['query']['filter']){_0x545015[_0xd9a7('0x42')]=_[_0xd9a7('0x44')](_0x545015[_0xd9a7('0x42')],{'$or':_['map'](_0x545015[_0xd9a7('0x3c')],function(_0x41bd8d){var _0xb325b1={};_0xb325b1[_0x41bd8d]={'$like':'%'+_0x30ea1b[_0xd9a7('0x38')][_0xd9a7('0x5e')]+'%'};return _0xb325b1;})});}_0x545015=_['merge']({},_0x545015,_0x30ea1b['options']);return _0x1593ad[_0xd9a7('0x8c')](_0x545015);}})[_0xd9a7('0x2f')](function(_0x256c16){if(_0x256c16){_0x3cc867=_0x256c16['length'];if(!_0x30ea1b[_0xd9a7('0x38')][_0xd9a7('0x3f')](_0xd9a7('0x5c'))){_0x545015[_0xd9a7('0x25')]=qs['limit'](_0x30ea1b[_0xd9a7('0x38')][_0xd9a7('0x25')]);_0x545015[_0xd9a7('0x22')]=qs[_0xd9a7('0x22')](_0x30ea1b[_0xd9a7('0x38')][_0xd9a7('0x22')]);}return _0x1593ad[_0xd9a7('0x8c')](_0x545015);}})['then'](function(_0x4cfabd){if(_0x4cfabd){return _0x4cfabd?{'count':_0x3cc867,'rows':_0x4cfabd}:null;}})[_0xd9a7('0x2f')](respondWithResult(_0x49858c,null))[_0xd9a7('0x4c')](handleError(_0x49858c,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 072b01c..178dd63 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 _0x021c=['exports','events','../../mysqldb','OpenchannelQueue','setMaxListeners','save','remove','emit','hook'];(function(_0x4d6c31,_0xcc39a){var _0x1652bb=function(_0x372824){while(--_0x372824){_0x4d6c31['push'](_0x4d6c31['shift']());}};_0x1652bb(++_0xcc39a);}(_0x021c,0xa3));var _0xc021=function(_0x4a57b0,_0x3ee928){_0x4a57b0=_0x4a57b0-0x0;var _0x5e82c8=_0x021c[_0x4a57b0];return _0x5e82c8;};'use strict';var EventEmitter=require(_0xc021('0x0'));var OpenchannelQueue=require(_0xc021('0x1'))['db'][_0xc021('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xc021('0x3')](0x0);var events={'afterCreate':_0xc021('0x4'),'afterUpdate':'update','afterDestroy':_0xc021('0x5')};function emitEvent(_0x1f6e52){return function(_0x151d85,_0x5ce6cd,_0xd7267a){OpenchannelQueueEvents[_0xc021('0x6')](_0x1f6e52+':'+_0x151d85['id'],_0x151d85);OpenchannelQueueEvents[_0xc021('0x6')](_0x1f6e52,_0x151d85);_0xd7267a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue[_0xc021('0x7')](e,emitEvent(event));}}module[_0xc021('0x8')]=OpenchannelQueueEvents; \ No newline at end of file +var _0x5ecd=['../../mysqldb','save','update','remove','emit','hasOwnProperty','exports','events'];(function(_0x58ea32,_0x17c124){var _0x28273e=function(_0x8899ac){while(--_0x8899ac){_0x58ea32['push'](_0x58ea32['shift']());}};_0x28273e(++_0x17c124);}(_0x5ecd,0x137));var _0xd5ec=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5ecd[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xd5ec('0x0'));var OpenchannelQueue=require(_0xd5ec('0x1'))['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd5ec('0x2'),'afterUpdate':_0xd5ec('0x3'),'afterDestroy':_0xd5ec('0x4')};function emitEvent(_0x380a76){return function(_0x593892,_0x5aee7f,_0x5e6414){OpenchannelQueueEvents[_0xd5ec('0x5')](_0x380a76+':'+_0x593892['id'],_0x593892);OpenchannelQueueEvents['emit'](_0x380a76,_0x593892);_0x5e6414(null);};}for(var e in events){if(events[_0xd5ec('0x6')](e)){var event=events[e];OpenchannelQueue['hook'](e,emitEvent(event));}}module[_0xd5ec('0x7')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 535efd6..12c32ae 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 _0x3eac=['define','openchannel_queues','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x5d7093,_0x360b02){var _0x2ec547=function(_0x96c8eb){while(--_0x96c8eb){_0x5d7093['push'](_0x5d7093['shift']());}};_0x2ec547(++_0x360b02);}(_0x3eac,0x176));var _0xc3ea=function(_0x284807,_0x4be925){_0x284807=_0x284807-0x0;var _0x50c774=_0x3eac[_0x284807];return _0x50c774;};'use strict';var _=require(_0xc3ea('0x0'));var util=require(_0xc3ea('0x1'));var logger=require(_0xc3ea('0x2'))('api');var moment=require(_0xc3ea('0x3'));var BPromise=require(_0xc3ea('0x4'));var rp=require(_0xc3ea('0x5'));var fs=require('fs');var path=require(_0xc3ea('0x6'));var rimraf=require(_0xc3ea('0x7'));var config=require(_0xc3ea('0x8'));var attributes=require('./openchannelQueue.attributes');module[_0xc3ea('0x9')]=function(_0x22e88e,_0x15065a){return _0x22e88e[_0xc3ea('0xa')]('OpenchannelQueue',attributes,{'tableName':_0xc3ea('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6bad=['OpenchannelQueue','openchannel_queues','util','api','moment','request-promise','rimraf','define'];(function(_0x1c7f72,_0x391abe){var _0x1f98b5=function(_0x19436b){while(--_0x19436b){_0x1c7f72['push'](_0x1c7f72['shift']());}};_0x1f98b5(++_0x391abe);}(_0x6bad,0x82));var _0xd6ba=function(_0x584ac1,_0x4c62d1){_0x584ac1=_0x584ac1-0x0;var _0x44e797=_0x6bad[_0x584ac1];return _0x44e797;};'use strict';var _=require('lodash');var util=require(_0xd6ba('0x0'));var logger=require('../../config/logger')(_0xd6ba('0x1'));var moment=require(_0xd6ba('0x2'));var BPromise=require('bluebird');var rp=require(_0xd6ba('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd6ba('0x4'));var config=require('../../config/environment');var attributes=require('./openchannelQueue.attributes');module['exports']=function(_0x5b1d9f,_0x2d6712){return _0x5b1d9f[_0xd6ba('0x5')](_0xd6ba('0x6'),attributes,{'tableName':_0xd6ba('0x7'),'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 0120495..f3239b6 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 _0xb3bf=['options','raw','attributes','limit','include','map','model','find','where','then','ShowOpenchannelQueue','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./openchannelQueue.socket','register','request','info','OpenchannelQueue,\x20%s,\x20%s','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','GetOpenchannelQueue','OpenchannelQueue'];(function(_0x22154f,_0x1fc734){var _0x4d2d4d=function(_0x400d50){while(--_0x400d50){_0x22154f['push'](_0x22154f['shift']());}};_0x4d2d4d(++_0x1fc734);}(_0xb3bf,0x1ce));var _0xfb3b=function(_0x2fbe5f,_0x4c5c13){_0x2fbe5f=_0x2fbe5f-0x0;var _0x21db60=_0xb3bf[_0x2fbe5f];return _0x21db60;};'use strict';var _=require(_0xfb3b('0x0'));var util=require(_0xfb3b('0x1'));var moment=require(_0xfb3b('0x2'));var BPromise=require(_0xfb3b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfb3b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xfb3b('0x5'));var logger=require(_0xfb3b('0x6'))(_0xfb3b('0x7'));var config=require(_0xfb3b('0x8'));var jayson=require(_0xfb3b('0x9'));var client=jayson[_0xfb3b('0xa')][_0xfb3b('0xb')]({'port':0x232a});config[_0xfb3b('0xc')]=_['defaults'](config['redis'],{'host':_0xfb3b('0xd'),'port':0x18eb});var socket=require(_0xfb3b('0xe'))(new Redis(config[_0xfb3b('0xc')]));require(_0xfb3b('0xf'))[_0xfb3b('0x10')](socket);function respondWithRpcPromise(_0x3b2ab7,_0x566ff5,_0x3aad92){return new BPromise(function(_0x4f3e82,_0x513e33){return client[_0xfb3b('0x11')](_0x3b2ab7,_0x3aad92)['then'](function(_0x2f34d2){logger[_0xfb3b('0x12')](_0xfb3b('0x13'),_0x566ff5,'request\x20sent');logger[_0xfb3b('0x14')](_0xfb3b('0x15'),_0x566ff5,_0xfb3b('0x16'),JSON[_0xfb3b('0x17')](_0x2f34d2));if(_0x2f34d2[_0xfb3b('0x18')]){if(_0x2f34d2['error'][_0xfb3b('0x19')]===0x1f4){logger[_0xfb3b('0x18')](_0xfb3b('0x13'),_0x566ff5,_0x2f34d2[_0xfb3b('0x18')][_0xfb3b('0x1a')]);return _0x513e33(_0x2f34d2[_0xfb3b('0x18')]['message']);}logger[_0xfb3b('0x18')]('OpenchannelQueue,\x20%s,\x20%s',_0x566ff5,_0x2f34d2['error'][_0xfb3b('0x1a')]);return _0x4f3e82(_0x2f34d2[_0xfb3b('0x18')]['message']);}else{logger[_0xfb3b('0x12')](_0xfb3b('0x13'),_0x566ff5,_0xfb3b('0x16'));_0x4f3e82(_0x2f34d2['result'][_0xfb3b('0x1a')]);}})[_0xfb3b('0x1b')](function(_0x543558){logger['error'](_0xfb3b('0x13'),_0x566ff5,_0x543558);_0x513e33(_0x543558);});});}exports[_0xfb3b('0x1c')]=function(_0x303c46){var _0x4172b4=this;return new Promise(function(_0x1b5961,_0x38e8c8){return db[_0xfb3b('0x1d')]['findAll']({'raw':_0x303c46['options']?_0x303c46[_0xfb3b('0x1e')][_0xfb3b('0x1f')]===undefined?!![]:![]:!![],'where':_0x303c46[_0xfb3b('0x1e')]?_0x303c46[_0xfb3b('0x1e')]['where']||null:null,'attributes':_0x303c46[_0xfb3b('0x1e')]?_0x303c46[_0xfb3b('0x1e')][_0xfb3b('0x20')]||null:null,'limit':_0x303c46[_0xfb3b('0x1e')]?_0x303c46['options'][_0xfb3b('0x21')]||null:null,'include':_0x303c46['options']?_0x303c46['options'][_0xfb3b('0x22')]?_[_0xfb3b('0x23')](_0x303c46[_0xfb3b('0x1e')]['include'],function(_0x49d9b8){return{'model':db[_0x49d9b8[_0xfb3b('0x24')]],'as':_0x49d9b8['as'],'attributes':_0x49d9b8[_0xfb3b('0x20')],'include':_0x49d9b8[_0xfb3b('0x22')]?_[_0xfb3b('0x23')](_0x49d9b8['include'],function(_0x5b2cf7){return{'model':db[_0x5b2cf7[_0xfb3b('0x24')]],'as':_0x5b2cf7['as'],'attributes':_0x5b2cf7['attributes'],'include':_0x5b2cf7[_0xfb3b('0x22')]?_['map'](_0x5b2cf7[_0xfb3b('0x22')],function(_0x286f94){return{'model':db[_0x286f94['model']],'as':_0x286f94['as'],'attributes':_0x286f94[_0xfb3b('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5c22f1){logger['info']('GetOpenchannelQueue',_0x303c46);logger[_0xfb3b('0x14')](_0xfb3b('0x1c'),_0x303c46,JSON[_0xfb3b('0x17')](_0x5c22f1));_0x1b5961(_0x5c22f1);})['catch'](function(_0x53d5be){logger[_0xfb3b('0x18')](_0xfb3b('0x1c'),_0x53d5be['message'],_0x303c46);_0x38e8c8(_0x4172b4[_0xfb3b('0x18')](0x1f4,_0x53d5be[_0xfb3b('0x1a')]));});});};exports['ShowOpenchannelQueue']=function(_0x145067){var _0xdc4ac7=this;return new Promise(function(_0x5419ab,_0x4b31ef){return db[_0xfb3b('0x1d')][_0xfb3b('0x25')]({'raw':_0x145067[_0xfb3b('0x1e')]?_0x145067[_0xfb3b('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x145067[_0xfb3b('0x1e')]?_0x145067['options'][_0xfb3b('0x26')]||null:null,'attributes':_0x145067[_0xfb3b('0x1e')]?_0x145067[_0xfb3b('0x1e')][_0xfb3b('0x20')]||null:null,'include':_0x145067[_0xfb3b('0x1e')]?_0x145067[_0xfb3b('0x1e')][_0xfb3b('0x22')]?_[_0xfb3b('0x23')](_0x145067[_0xfb3b('0x1e')]['include'],function(_0x1d31f2){return{'model':db[_0x1d31f2[_0xfb3b('0x24')]],'as':_0x1d31f2['as'],'attributes':_0x1d31f2[_0xfb3b('0x20')],'include':_0x1d31f2[_0xfb3b('0x22')]?_[_0xfb3b('0x23')](_0x1d31f2[_0xfb3b('0x22')],function(_0x103dc3){return{'model':db[_0x103dc3[_0xfb3b('0x24')]],'as':_0x103dc3['as'],'attributes':_0x103dc3[_0xfb3b('0x20')],'include':_0x103dc3['include']?_[_0xfb3b('0x23')](_0x103dc3['include'],function(_0x11c231){return{'model':db[_0x11c231['model']],'as':_0x11c231['as'],'attributes':_0x11c231[_0xfb3b('0x20')]};}):[]};}):[]};}):[]:[]})[_0xfb3b('0x27')](function(_0x2f0afe){logger[_0xfb3b('0x12')](_0xfb3b('0x28'),_0x145067);logger[_0xfb3b('0x14')]('ShowOpenchannelQueue',_0x145067,JSON[_0xfb3b('0x17')](_0x2f0afe));_0x5419ab(_0x2f0afe);})[_0xfb3b('0x1b')](function(_0x135c99){logger[_0xfb3b('0x18')](_0xfb3b('0x28'),_0x135c99['message'],_0x145067);_0x4b31ef(_0xdc4ac7[_0xfb3b('0x18')](0x1f4,_0x135c99[_0xfb3b('0x1a')]));});});}; \ No newline at end of file +var _0xf70f=['where','ShowOpenchannelQueue','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','request','then','info','debug','request\x20sent','stringify','error','code','message','OpenchannelQueue,\x20%s,\x20%s','result','findAll','options','raw','attributes','limit','include','map','model','GetOpenchannelQueue','catch','OpenchannelQueue','find'];(function(_0x539e41,_0x46658f){var _0x416858=function(_0x5b27f0){while(--_0x5b27f0){_0x539e41['push'](_0x539e41['shift']());}};_0x416858(++_0x46658f);}(_0xf70f,0x188));var _0xff70=function(_0xd4e399,_0x4a8481){_0xd4e399=_0xd4e399-0x0;var _0x1186c9=_0xf70f[_0xd4e399];return _0x1186c9;};'use strict';var _=require('lodash');var util=require(_0xff70('0x0'));var moment=require('moment');var BPromise=require(_0xff70('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xff70('0x2'));var db=require(_0xff70('0x3'))['db'];var utils=require(_0xff70('0x4'));var logger=require(_0xff70('0x5'))(_0xff70('0x6'));var config=require(_0xff70('0x7'));var jayson=require(_0xff70('0x8'));var client=jayson[_0xff70('0x9')][_0xff70('0xa')]({'port':0x232a});config[_0xff70('0xb')]=_[_0xff70('0xc')](config[_0xff70('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xff70('0xd'))(new Redis(config['redis']));require('./openchannelQueue.socket')['register'](socket);function respondWithRpcPromise(_0x42fd38,_0x1255d8,_0x2b0506){return new BPromise(function(_0x222e7c,_0x631af1){return client[_0xff70('0xe')](_0x42fd38,_0x2b0506)[_0xff70('0xf')](function(_0x5e6c26){logger[_0xff70('0x10')]('OpenchannelQueue,\x20%s,\x20%s',_0x1255d8,'request\x20sent');logger[_0xff70('0x11')]('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x1255d8,_0xff70('0x12'),JSON[_0xff70('0x13')](_0x5e6c26));if(_0x5e6c26['error']){if(_0x5e6c26[_0xff70('0x14')][_0xff70('0x15')]===0x1f4){logger[_0xff70('0x14')]('OpenchannelQueue,\x20%s,\x20%s',_0x1255d8,_0x5e6c26[_0xff70('0x14')]['message']);return _0x631af1(_0x5e6c26[_0xff70('0x14')][_0xff70('0x16')]);}logger[_0xff70('0x14')](_0xff70('0x17'),_0x1255d8,_0x5e6c26[_0xff70('0x14')]['message']);return _0x222e7c(_0x5e6c26[_0xff70('0x14')][_0xff70('0x16')]);}else{logger[_0xff70('0x10')](_0xff70('0x17'),_0x1255d8,_0xff70('0x12'));_0x222e7c(_0x5e6c26[_0xff70('0x18')][_0xff70('0x16')]);}})['catch'](function(_0xd23b23){logger['error'](_0xff70('0x17'),_0x1255d8,_0xd23b23);_0x631af1(_0xd23b23);});});}exports['GetOpenchannelQueue']=function(_0x369b44){var _0x3650d1=this;return new Promise(function(_0x13db47,_0x55dfcc){return db['OpenchannelQueue'][_0xff70('0x19')]({'raw':_0x369b44[_0xff70('0x1a')]?_0x369b44[_0xff70('0x1a')][_0xff70('0x1b')]===undefined?!![]:![]:!![],'where':_0x369b44[_0xff70('0x1a')]?_0x369b44['options']['where']||null:null,'attributes':_0x369b44[_0xff70('0x1a')]?_0x369b44[_0xff70('0x1a')][_0xff70('0x1c')]||null:null,'limit':_0x369b44['options']?_0x369b44[_0xff70('0x1a')][_0xff70('0x1d')]||null:null,'include':_0x369b44[_0xff70('0x1a')]?_0x369b44[_0xff70('0x1a')][_0xff70('0x1e')]?_[_0xff70('0x1f')](_0x369b44[_0xff70('0x1a')][_0xff70('0x1e')],function(_0x151d80){return{'model':db[_0x151d80[_0xff70('0x20')]],'as':_0x151d80['as'],'attributes':_0x151d80[_0xff70('0x1c')],'include':_0x151d80[_0xff70('0x1e')]?_[_0xff70('0x1f')](_0x151d80[_0xff70('0x1e')],function(_0x12dc01){return{'model':db[_0x12dc01['model']],'as':_0x12dc01['as'],'attributes':_0x12dc01[_0xff70('0x1c')],'include':_0x12dc01[_0xff70('0x1e')]?_[_0xff70('0x1f')](_0x12dc01[_0xff70('0x1e')],function(_0x1bd360){return{'model':db[_0x1bd360['model']],'as':_0x1bd360['as'],'attributes':_0x1bd360['attributes']};}):[]};}):[]};}):[]:[]})[_0xff70('0xf')](function(_0xecaa92){logger[_0xff70('0x10')](_0xff70('0x21'),_0x369b44);logger['debug'](_0xff70('0x21'),_0x369b44,JSON[_0xff70('0x13')](_0xecaa92));_0x13db47(_0xecaa92);})[_0xff70('0x22')](function(_0xec1b95){logger[_0xff70('0x14')]('GetOpenchannelQueue',_0xec1b95['message'],_0x369b44);_0x55dfcc(_0x3650d1[_0xff70('0x14')](0x1f4,_0xec1b95[_0xff70('0x16')]));});});};exports['ShowOpenchannelQueue']=function(_0x2352cf){var _0x4ef635=this;return new Promise(function(_0x55450d,_0x2f2cfe){return db[_0xff70('0x23')][_0xff70('0x24')]({'raw':_0x2352cf[_0xff70('0x1a')]?_0x2352cf['options'][_0xff70('0x1b')]===undefined?!![]:![]:!![],'where':_0x2352cf['options']?_0x2352cf[_0xff70('0x1a')][_0xff70('0x25')]||null:null,'attributes':_0x2352cf[_0xff70('0x1a')]?_0x2352cf[_0xff70('0x1a')][_0xff70('0x1c')]||null:null,'include':_0x2352cf[_0xff70('0x1a')]?_0x2352cf[_0xff70('0x1a')][_0xff70('0x1e')]?_[_0xff70('0x1f')](_0x2352cf[_0xff70('0x1a')][_0xff70('0x1e')],function(_0x4b54cc){return{'model':db[_0x4b54cc[_0xff70('0x20')]],'as':_0x4b54cc['as'],'attributes':_0x4b54cc[_0xff70('0x1c')],'include':_0x4b54cc['include']?_[_0xff70('0x1f')](_0x4b54cc['include'],function(_0x42e5f1){return{'model':db[_0x42e5f1[_0xff70('0x20')]],'as':_0x42e5f1['as'],'attributes':_0x42e5f1[_0xff70('0x1c')],'include':_0x42e5f1[_0xff70('0x1e')]?_[_0xff70('0x1f')](_0x42e5f1[_0xff70('0x1e')],function(_0x347e22){return{'model':db[_0x347e22[_0xff70('0x20')]],'as':_0x347e22['as'],'attributes':_0x347e22[_0xff70('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xff70('0xf')](function(_0x56fc55){logger['info']('ShowOpenchannelQueue',_0x2352cf);logger[_0xff70('0x11')](_0xff70('0x26'),_0x2352cf,JSON[_0xff70('0x13')](_0x56fc55));_0x55450d(_0x56fc55);})[_0xff70('0x22')](function(_0x1bc913){logger[_0xff70('0x14')](_0xff70('0x26'),_0x1bc913['message'],_0x2352cf);_0x2f2cfe(_0x4ef635[_0xff70('0x14')](0x1f4,_0x1bc913[_0xff70('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 659861d..7c841d0 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 _0x557d=['./openchannelQueue.events','save','remove','update','emit','register','length'];(function(_0x4c1910,_0x22af21){var _0x38c027=function(_0x5cf615){while(--_0x5cf615){_0x4c1910['push'](_0x4c1910['shift']());}};_0x38c027(++_0x22af21);}(_0x557d,0xcb));var _0xd557=function(_0x30ba07,_0x32e827){_0x30ba07=_0x30ba07-0x0;var _0x17d24a=_0x557d[_0x30ba07];return _0x17d24a;};'use strict';var OpenchannelQueueEvents=require(_0xd557('0x0'));var events=[_0xd557('0x1'),_0xd557('0x2'),_0xd557('0x3')];function createListener(_0x4aa27b,_0x479f66){return function(_0x2ee354){_0x479f66[_0xd557('0x4')](_0x4aa27b,_0x2ee354);};}function removeListener(_0x49f9e8,_0x5f19d7){return function(){OpenchannelQueueEvents['removeListener'](_0x49f9e8,_0x5f19d7);};}exports[_0xd557('0x5')]=function(_0x598348){for(var _0x477de0=0x0,_0x2d3ccd=events[_0xd557('0x6')];_0x477de0<_0x2d3ccd;_0x477de0++){var _0x559202=events[_0x477de0];var _0x37d3ec=createListener('openchannelQueue:'+_0x559202,_0x598348);OpenchannelQueueEvents['on'](_0x559202,_0x37d3ec);}}; \ No newline at end of file +var _0xb945=['remove','register','length','./openchannelQueue.events','save'];(function(_0xcbd0bd,_0x2495d7){var _0x55105b=function(_0x2e39de){while(--_0x2e39de){_0xcbd0bd['push'](_0xcbd0bd['shift']());}};_0x55105b(++_0x2495d7);}(_0xb945,0x1ca));var _0x5b94=function(_0x6007a9,_0x187458){_0x6007a9=_0x6007a9-0x0;var _0x56cb7a=_0xb945[_0x6007a9];return _0x56cb7a;};'use strict';var OpenchannelQueueEvents=require(_0x5b94('0x0'));var events=[_0x5b94('0x1'),_0x5b94('0x2'),'update'];function createListener(_0x26e87c,_0x4c7cf3){return function(_0x3ba98b){_0x4c7cf3['emit'](_0x26e87c,_0x3ba98b);};}function removeListener(_0x4fb47e,_0x4e6e1a){return function(){OpenchannelQueueEvents['removeListener'](_0x4fb47e,_0x4e6e1a);};}exports[_0x5b94('0x3')]=function(_0x1f2421){for(var _0x2ed8c8=0x0,_0x3dc8da=events[_0x5b94('0x4')];_0x2ed8c8<_0x3dc8da;_0x2ed8c8++){var _0x5116f3=events[_0x2ed8c8];var _0x48bb89=createListener('openchannelQueue:'+_0x5116f3,_0x1f2421);OpenchannelQueueEvents['on'](_0x5116f3,_0x48bb89);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 077a111..86e4d16 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 _0x7414=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','create','put','update','delete','destroy','exports','multer'];(function(_0x425f19,_0x425977){var _0x4fcd8c=function(_0x595575){while(--_0x595575){_0x425f19['push'](_0x425f19['shift']());}};_0x4fcd8c(++_0x425977);}(_0x7414,0xf1));var _0x4741=function(_0x4c322b,_0x45ffae){_0x4c322b=_0x4c322b-0x0;var _0x534b91=_0x7414[_0x4c322b];return _0x534b91;};'use strict';var multer=require(_0x4741('0x0'));var util=require('util');var path=require(_0x4741('0x1'));var timeout=require(_0x4741('0x2'));var express=require('express');var router=express[_0x4741('0x3')]();var fs_extra=require(_0x4741('0x4'));var auth=require(_0x4741('0x5'));var interaction=require(_0x4741('0x6'));var config=require(_0x4741('0x7'));var controller=require(_0x4741('0x8'));router[_0x4741('0x9')]('/',auth['isAuthenticated'](),controller[_0x4741('0xa')]);router[_0x4741('0x9')](_0x4741('0xb'),auth[_0x4741('0xc')](),controller[_0x4741('0xd')]);router[_0x4741('0x9')](_0x4741('0xe'),auth[_0x4741('0xc')](),controller[_0x4741('0xf')]);router['post']('/',auth[_0x4741('0xc')](),controller[_0x4741('0x10')]);router[_0x4741('0x11')](_0x4741('0xe'),auth[_0x4741('0xc')](),controller[_0x4741('0x12')]);router[_0x4741('0x13')](_0x4741('0xe'),auth['isAuthenticated'](),controller[_0x4741('0x14')]);module[_0x4741('0x15')]=router; \ No newline at end of file +var _0x890e=['../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','/describe','isAuthenticated','/:id','put','delete','destroy','util','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x3e663f,_0x37ca6d){var _0xc48015=function(_0x40e7eb){while(--_0x40e7eb){_0x3e663f['push'](_0x3e663f['shift']());}};_0xc48015(++_0x37ca6d);}(_0x890e,0xaf));var _0xe890=function(_0x1ebbbb,_0x320187){_0x1ebbbb=_0x1ebbbb-0x0;var _0x57d8d8=_0x890e[_0x1ebbbb];return _0x57d8d8;};'use strict';var multer=require('multer');var util=require(_0xe890('0x0'));var path=require('path');var timeout=require(_0xe890('0x1'));var express=require(_0xe890('0x2'));var router=express['Router']();var fs_extra=require(_0xe890('0x3'));var auth=require(_0xe890('0x4'));var interaction=require(_0xe890('0x5'));var config=require(_0xe890('0x6'));var controller=require(_0xe890('0x7'));router[_0xe890('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xe890('0x8')](_0xe890('0x9'),auth[_0xe890('0xa')](),controller['describe']);router[_0xe890('0x8')](_0xe890('0xb'),auth[_0xe890('0xa')](),controller['show']);router['post']('/',auth[_0xe890('0xa')](),controller['create']);router[_0xe890('0xc')](_0xe890('0xb'),auth[_0xe890('0xa')](),controller['update']);router[_0xe890('0xd')](_0xe890('0xb'),auth[_0xe890('0xa')](),controller[_0xe890('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 454af88..682eee9 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 _0xd1af=['sequelize','exports','STRING','DATE','moment'];(function(_0x2077c2,_0x275ab5){var _0x312f9f=function(_0x331435){while(--_0x331435){_0x2077c2['push'](_0x2077c2['shift']());}};_0x312f9f(++_0x275ab5);}(_0xd1af,0xe5));var _0xfd1a=function(_0x30fe92,_0x31779c){_0x30fe92=_0x30fe92-0x0;var _0xb849c1=_0xd1af[_0x30fe92];return _0xb849c1;};'use strict';var moment=require(_0xfd1a('0x0'));var Sequelize=require(_0xfd1a('0x1'));module[_0xfd1a('0x2')]={'uniqueid':{'type':Sequelize[_0xfd1a('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xfd1a('0x4')]},'acceptAt':{'type':Sequelize[_0xfd1a('0x4')]},'exitAt':{'type':Sequelize[_0xfd1a('0x4')]},'reason':{'type':Sequelize[_0xfd1a('0x3')]}}; \ No newline at end of file +var _0x7801=['STRING','DATE','sequelize','exports'];(function(_0x40de1a,_0x581dc4){var _0x3b9c43=function(_0x4f25f9){while(--_0x4f25f9){_0x40de1a['push'](_0x40de1a['shift']());}};_0x3b9c43(++_0x581dc4);}(_0x7801,0x11a));var _0x1780=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0x7801[_0x209941];return _0x1e8729;};'use strict';var moment=require('moment');var Sequelize=require(_0x1780('0x0'));module[_0x1780('0x1')]={'uniqueid':{'type':Sequelize[_0x1780('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x1780('0x2')]},'joinAt':{'type':Sequelize[_0x1780('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x1780('0x3')]},'exitAt':{'type':Sequelize[_0x1780('0x3')]},'reason':{'type':Sequelize[_0x1780('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index de4f449..5953399 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 _0x65cd=['reject','save','update','destroy','then','error','stack','name','send','index','map','OpenchannelQueueReport','fieldName','type','key','model','keys','filters','intersection','fields','query','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','catch','show','length','options','create','body','find','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','offset','undefined','limit','count','status','set','Content-Range','json','apply'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x65cd,0x76));var _0xd65c=function(_0x51d4ee,_0xdead36){_0x51d4ee=_0x51d4ee-0x0;var _0x2939b0=_0x65cd[_0x51d4ee];return _0x2939b0;};'use strict';var emlformat=require(_0xd65c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd65c('0x1'));var jsonpatch=require(_0xd65c('0x2'));var rp=require(_0xd65c('0x3'));var moment=require(_0xd65c('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd65c('0x5'));var util=require(_0xd65c('0x6'));var path=require(_0xd65c('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd65c('0x8'));var fs=require('fs');var fs_extra=require(_0xd65c('0x9'));var _=require(_0xd65c('0xa'));var squel=require(_0xd65c('0xb'));var crypto=require(_0xd65c('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd65c('0xd'));var Redis=require(_0xd65c('0xe'));var authService=require(_0xd65c('0xf'));var qs=require(_0xd65c('0x10'));var as=require(_0xd65c('0x11'));var hardwareService=require(_0xd65c('0x12'));var logger=require(_0xd65c('0x13'))(_0xd65c('0x14'));var utils=require(_0xd65c('0x15'));var config=require(_0xd65c('0x16'));var licenseUtil=require(_0xd65c('0x17'));var db=require(_0xd65c('0x18'))['db'];function respondWithStatusCode(_0x1fb24b,_0xdbf34c){_0xdbf34c=_0xdbf34c||0xcc;return function(_0x3d0bbf){if(_0x3d0bbf){return _0x1fb24b[_0xd65c('0x19')](_0xdbf34c);}return _0x1fb24b['status'](_0xdbf34c)[_0xd65c('0x1a')]();};}function respondWithResult(_0x4cd28e,_0x3f8bb0){_0x3f8bb0=_0x3f8bb0||0xc8;return function(_0x2df7c9){if(_0x2df7c9){return _0x4cd28e['status'](_0x3f8bb0)['json'](_0x2df7c9);}};}function respondWithFilteredResult(_0x27b470,_0xb8792b){return function(_0x2fb958){if(_0x2fb958){var _0x27fdd3=typeof _0xb8792b[_0xd65c('0x1b')]===_0xd65c('0x1c')&&typeof _0xb8792b[_0xd65c('0x1d')]===_0xd65c('0x1c');var _0x39c9a9=_0x2fb958[_0xd65c('0x1e')];var _0x29407a=_0x27fdd3?0x0:_0xb8792b['offset'];var _0x1058dc=_0x27fdd3?_0x2fb958['count']:_0xb8792b[_0xd65c('0x1b')]+_0xb8792b[_0xd65c('0x1d')];var _0x489cfb;if(_0x1058dc>=_0x39c9a9){_0x1058dc=_0x39c9a9;_0x489cfb=0xc8;}else{_0x489cfb=0xce;}_0x27b470[_0xd65c('0x1f')](_0x489cfb);return _0x27b470[_0xd65c('0x20')](_0xd65c('0x21'),_0x29407a+'-'+_0x1058dc+'/'+_0x39c9a9)[_0xd65c('0x22')](_0x2fb958);}return null;};}function patchUpdates(_0x415487){return function(_0x5c10fe){try{jsonpatch[_0xd65c('0x23')](_0x5c10fe,_0x415487,!![]);}catch(_0x597aea){return BPromise[_0xd65c('0x24')](_0x597aea);}return _0x5c10fe[_0xd65c('0x25')]();};}function saveUpdates(_0x3ef214,_0x35eed0){return function(_0x5acc89){if(_0x5acc89){return _0x5acc89[_0xd65c('0x26')](_0x3ef214)['then'](function(_0x846a66){return _0x846a66;});}return null;};}function removeEntity(_0x51267c,_0x17c0e3){return function(_0x3a43c4){if(_0x3a43c4){return _0x3a43c4[_0xd65c('0x27')]()[_0xd65c('0x28')](function(){_0x51267c[_0xd65c('0x1f')](0xcc)[_0xd65c('0x1a')]();});}};}function handleEntityNotFound(_0x2ce474,_0x100f21){return function(_0x515a7a){if(!_0x515a7a){_0x2ce474[_0xd65c('0x19')](0x194);}return _0x515a7a;};}function handleError(_0x1f93bc,_0x3529d2){_0x3529d2=_0x3529d2||0x1f4;return function(_0x4deb27){logger[_0xd65c('0x29')](_0x4deb27[_0xd65c('0x2a')]);if(_0x4deb27[_0xd65c('0x2b')]){delete _0x4deb27[_0xd65c('0x2b')];}_0x1f93bc[_0xd65c('0x1f')](_0x3529d2)[_0xd65c('0x2c')](_0x4deb27);};}exports[_0xd65c('0x2d')]=function(_0x36469b,_0x16581f){var _0x34bb35={},_0x3999f2={},_0x3f3671={'count':0x0,'rows':[]};var _0x2759eb=_[_0xd65c('0x2e')](db[_0xd65c('0x2f')]['rawAttributes'],function(_0x22fe6b){return{'name':_0x22fe6b[_0xd65c('0x30')],'type':_0x22fe6b[_0xd65c('0x31')][_0xd65c('0x32')]};});_0x3999f2[_0xd65c('0x33')]=_[_0xd65c('0x2e')](_0x2759eb,'name');_0x3999f2['query']=_[_0xd65c('0x34')](_0x36469b['query']);_0x3999f2[_0xd65c('0x35')]=_[_0xd65c('0x36')](_0x3999f2[_0xd65c('0x33')],_0x3999f2['query']);_0x34bb35['attributes']=_[_0xd65c('0x36')](_0x3999f2['model'],qs[_0xd65c('0x37')](_0x36469b[_0xd65c('0x38')][_0xd65c('0x37')]));_0x34bb35[_0xd65c('0x39')]=_0x34bb35[_0xd65c('0x39')]['length']?_0x34bb35['attributes']:_0x3999f2[_0xd65c('0x33')];if(!_0x36469b[_0xd65c('0x38')][_0xd65c('0x3a')]('nolimit')){_0x34bb35[_0xd65c('0x1d')]=qs[_0xd65c('0x1d')](_0x36469b[_0xd65c('0x38')]['limit']);_0x34bb35[_0xd65c('0x1b')]=qs[_0xd65c('0x1b')](_0x36469b[_0xd65c('0x38')]['offset']);}_0x34bb35[_0xd65c('0x3b')]=qs[_0xd65c('0x3c')](_0x36469b[_0xd65c('0x38')][_0xd65c('0x3c')]);_0x34bb35[_0xd65c('0x3d')]=qs[_0xd65c('0x35')](_[_0xd65c('0x3e')](_0x36469b[_0xd65c('0x38')],_0x3999f2[_0xd65c('0x35')]),_0x2759eb);if(_0x36469b[_0xd65c('0x38')][_0xd65c('0x3f')]){_0x34bb35[_0xd65c('0x3d')]=_[_0xd65c('0x40')](_0x34bb35[_0xd65c('0x3d')],{'$or':_[_0xd65c('0x2e')](_0x2759eb,function(_0x10734e){if(_0x10734e[_0xd65c('0x31')]!==_0xd65c('0x41')){var _0x16db62={};_0x16db62[_0x10734e[_0xd65c('0x2b')]]={'$like':'%'+_0x36469b[_0xd65c('0x38')][_0xd65c('0x3f')]+'%'};return _0x16db62;}})});}_0x34bb35=_[_0xd65c('0x40')]({},_0x34bb35,_0x36469b['options']);var _0xbe31e2={'where':_0x34bb35[_0xd65c('0x3d')]};return db['OpenchannelQueueReport'][_0xd65c('0x1e')](_0xbe31e2)[_0xd65c('0x28')](function(_0x17e949){_0x3f3671[_0xd65c('0x1e')]=_0x17e949;if(_0x36469b['query'][_0xd65c('0x42')]){_0x34bb35[_0xd65c('0x43')]=[{'all':!![]}];}return db[_0xd65c('0x2f')]['findAll'](_0x34bb35);})[_0xd65c('0x28')](function(_0x14801b){_0x3f3671['rows']=_0x14801b;return _0x3f3671;})[_0xd65c('0x28')](respondWithFilteredResult(_0x16581f,_0x34bb35))[_0xd65c('0x44')](handleError(_0x16581f,null));};exports[_0xd65c('0x45')]=function(_0x163c60,_0x3532d3){var _0x5fab24={'raw':!![],'where':{'id':_0x163c60['params']['id']}},_0x27d3b7={};_0x27d3b7['model']=_[_0xd65c('0x34')](db[_0xd65c('0x2f')]['rawAttributes']);_0x27d3b7['query']=_['keys'](_0x163c60[_0xd65c('0x38')]);_0x27d3b7[_0xd65c('0x35')]=_[_0xd65c('0x36')](_0x27d3b7[_0xd65c('0x33')],_0x27d3b7[_0xd65c('0x38')]);_0x5fab24[_0xd65c('0x39')]=_[_0xd65c('0x36')](_0x27d3b7[_0xd65c('0x33')],qs['fields'](_0x163c60[_0xd65c('0x38')][_0xd65c('0x37')]));_0x5fab24[_0xd65c('0x39')]=_0x5fab24[_0xd65c('0x39')][_0xd65c('0x46')]?_0x5fab24[_0xd65c('0x39')]:_0x27d3b7[_0xd65c('0x33')];if(_0x163c60[_0xd65c('0x38')]['includeAll']){_0x5fab24[_0xd65c('0x43')]=[{'all':!![]}];}_0x5fab24=_[_0xd65c('0x40')]({},_0x5fab24,_0x163c60[_0xd65c('0x47')]);return db[_0xd65c('0x2f')]['find'](_0x5fab24)[_0xd65c('0x28')](handleEntityNotFound(_0x3532d3,null))[_0xd65c('0x28')](respondWithResult(_0x3532d3,null))[_0xd65c('0x44')](handleError(_0x3532d3,null));};exports['create']=function(_0xb3ddae,_0x34a074){return db['OpenchannelQueueReport'][_0xd65c('0x48')](_0xb3ddae[_0xd65c('0x49')],{})[_0xd65c('0x28')](respondWithResult(_0x34a074,0xc9))['catch'](handleError(_0x34a074,null));};exports[_0xd65c('0x26')]=function(_0x3fe9e0,_0x2d4285){if(_0x3fe9e0['body']['id']){delete _0x3fe9e0[_0xd65c('0x49')]['id'];}return db[_0xd65c('0x2f')][_0xd65c('0x4a')]({'where':{'id':_0x3fe9e0[_0xd65c('0x4b')]['id']}})[_0xd65c('0x28')](handleEntityNotFound(_0x2d4285,null))[_0xd65c('0x28')](saveUpdates(_0x3fe9e0[_0xd65c('0x49')],null))['then'](respondWithResult(_0x2d4285,null))[_0xd65c('0x44')](handleError(_0x2d4285,null));};exports['destroy']=function(_0x497e63,_0x4a9f0a){return db[_0xd65c('0x2f')][_0xd65c('0x4a')]({'where':{'id':_0x497e63[_0xd65c('0x4b')]['id']}})[_0xd65c('0x28')](handleEntityNotFound(_0x4a9f0a,null))[_0xd65c('0x28')](removeEntity(_0x4a9f0a,null))[_0xd65c('0x44')](handleError(_0x4a9f0a,null));};exports[_0xd65c('0x4c')]=function(_0x4c388b,_0x48219e){return db['OpenchannelQueueReport'][_0xd65c('0x4c')]()[_0xd65c('0x28')](respondWithResult(_0x48219e,null))[_0xd65c('0x44')](handleError(_0x48219e,null));}; \ No newline at end of file +var _0x43eb=['find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','stack','name','send','index','map','OpenchannelQueueReport','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','type','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','length','create','body'];(function(_0x4ada92,_0x133919){var _0x357aeb=function(_0x3cb111){while(--_0x3cb111){_0x4ada92['push'](_0x4ada92['shift']());}};_0x357aeb(++_0x133919);}(_0x43eb,0x1e2));var _0xb43e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x43eb[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xb43e('0x0'));var rimraf=require(_0xb43e('0x1'));var zipdir=require(_0xb43e('0x2'));var jsonpatch=require(_0xb43e('0x3'));var rp=require(_0xb43e('0x4'));var moment=require(_0xb43e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb43e('0x6'));var util=require(_0xb43e('0x7'));var path=require(_0xb43e('0x8'));var sox=require(_0xb43e('0x9'));var csv=require('to-csv');var ejs=require(_0xb43e('0xa'));var fs=require('fs');var fs_extra=require(_0xb43e('0xb'));var _=require(_0xb43e('0xc'));var squel=require(_0xb43e('0xd'));var crypto=require(_0xb43e('0xe'));var jsforce=require(_0xb43e('0xf'));var deskjs=require(_0xb43e('0x10'));var toCsv=require(_0xb43e('0x11'));var querystring=require(_0xb43e('0x12'));var Papa=require(_0xb43e('0x13'));var Redis=require(_0xb43e('0x14'));var authService=require(_0xb43e('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0xb43e('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb43e('0x17'))(_0xb43e('0x18'));var utils=require(_0xb43e('0x19'));var config=require(_0xb43e('0x1a'));var licenseUtil=require(_0xb43e('0x1b'));var db=require(_0xb43e('0x1c'))['db'];function respondWithStatusCode(_0x99ec8e,_0xc2aa0e){_0xc2aa0e=_0xc2aa0e||0xcc;return function(_0x16b5a0){if(_0x16b5a0){return _0x99ec8e[_0xb43e('0x1d')](_0xc2aa0e);}return _0x99ec8e[_0xb43e('0x1e')](_0xc2aa0e)[_0xb43e('0x1f')]();};}function respondWithResult(_0x2c547f,_0xebbaaf){_0xebbaaf=_0xebbaaf||0xc8;return function(_0x30400b){if(_0x30400b){return _0x2c547f[_0xb43e('0x1e')](_0xebbaaf)[_0xb43e('0x20')](_0x30400b);}};}function respondWithFilteredResult(_0x16db35,_0x4380cd){return function(_0x50b44d){if(_0x50b44d){var _0x5a8e46=typeof _0x4380cd[_0xb43e('0x21')]===_0xb43e('0x22')&&typeof _0x4380cd[_0xb43e('0x23')]===_0xb43e('0x22');var _0x342aac=_0x50b44d['count'];var _0x343566=_0x5a8e46?0x0:_0x4380cd[_0xb43e('0x21')];var _0x35fd2a=_0x5a8e46?_0x50b44d[_0xb43e('0x24')]:_0x4380cd[_0xb43e('0x21')]+_0x4380cd[_0xb43e('0x23')];var _0x55c64d;if(_0x35fd2a>=_0x342aac){_0x35fd2a=_0x342aac;_0x55c64d=0xc8;}else{_0x55c64d=0xce;}_0x16db35[_0xb43e('0x1e')](_0x55c64d);return _0x16db35[_0xb43e('0x25')](_0xb43e('0x26'),_0x343566+'-'+_0x35fd2a+'/'+_0x342aac)['json'](_0x50b44d);}return null;};}function patchUpdates(_0x4218e5){return function(_0xeb7919){try{jsonpatch['apply'](_0xeb7919,_0x4218e5,!![]);}catch(_0x4201fa){return BPromise[_0xb43e('0x27')](_0x4201fa);}return _0xeb7919[_0xb43e('0x28')]();};}function saveUpdates(_0x1c5396,_0x751429){return function(_0xae7ad5){if(_0xae7ad5){return _0xae7ad5[_0xb43e('0x29')](_0x1c5396)[_0xb43e('0x2a')](function(_0x3cf5f5){return _0x3cf5f5;});}return null;};}function removeEntity(_0x56fa66,_0x2bc1eb){return function(_0x4ca00d){if(_0x4ca00d){return _0x4ca00d[_0xb43e('0x2b')]()[_0xb43e('0x2a')](function(){_0x56fa66[_0xb43e('0x1e')](0xcc)[_0xb43e('0x1f')]();});}};}function handleEntityNotFound(_0x15ae18,_0x3c534a){return function(_0x31da74){if(!_0x31da74){_0x15ae18[_0xb43e('0x1d')](0x194);}return _0x31da74;};}function handleError(_0x3bc610,_0xaaee4a){_0xaaee4a=_0xaaee4a||0x1f4;return function(_0x44327c){logger['error'](_0x44327c[_0xb43e('0x2c')]);if(_0x44327c[_0xb43e('0x2d')]){delete _0x44327c['name'];}_0x3bc610[_0xb43e('0x1e')](_0xaaee4a)[_0xb43e('0x2e')](_0x44327c);};}exports[_0xb43e('0x2f')]=function(_0x49f116,_0x2c3143){var _0x52bf2f={},_0x1e3db2={},_0x69f56b={'count':0x0,'rows':[]};var _0x2ccd06=_[_0xb43e('0x30')](db[_0xb43e('0x31')]['rawAttributes'],function(_0x1c63b3){return{'name':_0x1c63b3['fieldName'],'type':_0x1c63b3['type'][_0xb43e('0x32')]};});_0x1e3db2[_0xb43e('0x33')]=_[_0xb43e('0x30')](_0x2ccd06,_0xb43e('0x2d'));_0x1e3db2['query']=_[_0xb43e('0x34')](_0x49f116[_0xb43e('0x35')]);_0x1e3db2[_0xb43e('0x36')]=_[_0xb43e('0x37')](_0x1e3db2[_0xb43e('0x33')],_0x1e3db2[_0xb43e('0x35')]);_0x52bf2f[_0xb43e('0x38')]=_[_0xb43e('0x37')](_0x1e3db2['model'],qs['fields'](_0x49f116[_0xb43e('0x35')][_0xb43e('0x39')]));_0x52bf2f['attributes']=_0x52bf2f[_0xb43e('0x38')]['length']?_0x52bf2f[_0xb43e('0x38')]:_0x1e3db2[_0xb43e('0x33')];if(!_0x49f116[_0xb43e('0x35')][_0xb43e('0x3a')]('nolimit')){_0x52bf2f[_0xb43e('0x23')]=qs[_0xb43e('0x23')](_0x49f116[_0xb43e('0x35')][_0xb43e('0x23')]);_0x52bf2f[_0xb43e('0x21')]=qs[_0xb43e('0x21')](_0x49f116['query'][_0xb43e('0x21')]);}_0x52bf2f[_0xb43e('0x3b')]=qs[_0xb43e('0x3c')](_0x49f116[_0xb43e('0x35')][_0xb43e('0x3c')]);_0x52bf2f[_0xb43e('0x3d')]=qs['filters'](_[_0xb43e('0x3e')](_0x49f116[_0xb43e('0x35')],_0x1e3db2[_0xb43e('0x36')]),_0x2ccd06);if(_0x49f116[_0xb43e('0x35')]['filter']){_0x52bf2f[_0xb43e('0x3d')]=_['merge'](_0x52bf2f['where'],{'$or':_[_0xb43e('0x30')](_0x2ccd06,function(_0x23494d){if(_0x23494d[_0xb43e('0x3f')]!==_0xb43e('0x40')){var _0x26c461={};_0x26c461[_0x23494d['name']]={'$like':'%'+_0x49f116[_0xb43e('0x35')][_0xb43e('0x41')]+'%'};return _0x26c461;}})});}_0x52bf2f=_[_0xb43e('0x42')]({},_0x52bf2f,_0x49f116[_0xb43e('0x43')]);var _0x33523c={'where':_0x52bf2f['where']};return db[_0xb43e('0x31')][_0xb43e('0x24')](_0x33523c)['then'](function(_0x22e0f7){_0x69f56b[_0xb43e('0x24')]=_0x22e0f7;if(_0x49f116[_0xb43e('0x35')][_0xb43e('0x44')]){_0x52bf2f[_0xb43e('0x45')]=[{'all':!![]}];}return db['OpenchannelQueueReport'][_0xb43e('0x46')](_0x52bf2f);})[_0xb43e('0x2a')](function(_0xbd676a){_0x69f56b[_0xb43e('0x47')]=_0xbd676a;return _0x69f56b;})[_0xb43e('0x2a')](respondWithFilteredResult(_0x2c3143,_0x52bf2f))[_0xb43e('0x48')](handleError(_0x2c3143,null));};exports[_0xb43e('0x49')]=function(_0x444fbf,_0x355eb0){var _0x33466d={'raw':!![],'where':{'id':_0x444fbf[_0xb43e('0x4a')]['id']}},_0x1ee239={};_0x1ee239['model']=_[_0xb43e('0x34')](db[_0xb43e('0x31')]['rawAttributes']);_0x1ee239[_0xb43e('0x35')]=_[_0xb43e('0x34')](_0x444fbf[_0xb43e('0x35')]);_0x1ee239[_0xb43e('0x36')]=_['intersection'](_0x1ee239[_0xb43e('0x33')],_0x1ee239['query']);_0x33466d[_0xb43e('0x38')]=_[_0xb43e('0x37')](_0x1ee239[_0xb43e('0x33')],qs[_0xb43e('0x39')](_0x444fbf[_0xb43e('0x35')][_0xb43e('0x39')]));_0x33466d[_0xb43e('0x38')]=_0x33466d[_0xb43e('0x38')][_0xb43e('0x4b')]?_0x33466d['attributes']:_0x1ee239[_0xb43e('0x33')];if(_0x444fbf[_0xb43e('0x35')][_0xb43e('0x44')]){_0x33466d[_0xb43e('0x45')]=[{'all':!![]}];}_0x33466d=_['merge']({},_0x33466d,_0x444fbf[_0xb43e('0x43')]);return db[_0xb43e('0x31')]['find'](_0x33466d)[_0xb43e('0x2a')](handleEntityNotFound(_0x355eb0,null))[_0xb43e('0x2a')](respondWithResult(_0x355eb0,null))[_0xb43e('0x48')](handleError(_0x355eb0,null));};exports[_0xb43e('0x4c')]=function(_0xff6644,_0x4ffc2f){return db[_0xb43e('0x31')][_0xb43e('0x4c')](_0xff6644[_0xb43e('0x4d')],{})[_0xb43e('0x2a')](respondWithResult(_0x4ffc2f,0xc9))[_0xb43e('0x48')](handleError(_0x4ffc2f,null));};exports[_0xb43e('0x29')]=function(_0x4ceafc,_0x296467){if(_0x4ceafc[_0xb43e('0x4d')]['id']){delete _0x4ceafc[_0xb43e('0x4d')]['id'];}return db[_0xb43e('0x31')]['find']({'where':{'id':_0x4ceafc[_0xb43e('0x4a')]['id']}})[_0xb43e('0x2a')](handleEntityNotFound(_0x296467,null))[_0xb43e('0x2a')](saveUpdates(_0x4ceafc[_0xb43e('0x4d')],null))[_0xb43e('0x2a')](respondWithResult(_0x296467,null))[_0xb43e('0x48')](handleError(_0x296467,null));};exports['destroy']=function(_0x2f052a,_0x2aa05d){return db[_0xb43e('0x31')][_0xb43e('0x4e')]({'where':{'id':_0x2f052a[_0xb43e('0x4a')]['id']}})[_0xb43e('0x2a')](handleEntityNotFound(_0x2aa05d,null))[_0xb43e('0x2a')](removeEntity(_0x2aa05d,null))['catch'](handleError(_0x2aa05d,null));};exports[_0xb43e('0x4f')]=function(_0x42531c,_0x2d58a5){return db['OpenchannelQueueReport'][_0xb43e('0x4f')]()[_0xb43e('0x2a')](respondWithResult(_0x2d58a5,null))[_0xb43e('0x48')](handleError(_0x2d58a5,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 6ae5112..f24cd18 100644 --- a/server/api/openchannelQueueReport/openchannelQueueReport.model.js +++ b/server/api/openchannelQueueReport/openchannelQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['report_openchannel_queue','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','OpenchannelQueueReport'];(function(_0x2f92c3,_0x4e0c44){var _0x1c6859=function(_0x3e1844){while(--_0x3e1844){_0x2f92c3['push'](_0x2f92c3['shift']());}};_0x1c6859(++_0x4e0c44);}(_0x7a54,0x106));var _0x47a5=function(_0x174952,_0x1f703d){_0x174952=_0x174952-0x0;var _0x1ceaee=_0x7a54[_0x174952];return _0x1ceaee;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x47a5('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1261=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','define','report_openchannel_queue','uniqueid','util'];(function(_0x2f4621,_0x2e320b){var _0x162716=function(_0xd5160b){while(--_0xd5160b){_0x2f4621['push'](_0x2f4621['shift']());}};_0x162716(++_0x2e320b);}(_0x1261,0x144));var _0x1126=function(_0x1966f3,_0x210ea3){_0x1966f3=_0x1966f3-0x0;var _0x17575f=_0x1261[_0x1966f3];return _0x17575f;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var logger=require(_0x1126('0x1'))(_0x1126('0x2'));var moment=require(_0x1126('0x3'));var BPromise=require(_0x1126('0x4'));var rp=require(_0x1126('0x5'));var fs=require('fs');var path=require(_0x1126('0x6'));var rimraf=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var attributes=require(_0x1126('0x9'));module['exports']=function(_0x5c68c8,_0x40ba58){return _0x5c68c8[_0x1126('0xa')]('OpenchannelQueueReport',attributes,{'tableName':_0x1126('0xb'),'paranoid':![],'indexes':[{'name':_0x1126('0xc'),'fields':[_0x1126('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index e406361..25cd05c 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 _0x23a3=['debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','raw','UpdateOpenchannelQueueReport','body','options','where','attributes','limit','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent'];(function(_0x26721d,_0x448ba5){var _0x1035c5=function(_0x1c1b86){while(--_0x1c1b86){_0x26721d['push'](_0x26721d['shift']());}};_0x1035c5(++_0x448ba5);}(_0x23a3,0x131));var _0x323a=function(_0x19a3bf,_0x1acf91){_0x19a3bf=_0x19a3bf-0x0;var _0x38f7a1=_0x23a3[_0x19a3bf];return _0x38f7a1;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x323a('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x323a('0x1'));var db=require(_0x323a('0x2'))['db'];var utils=require(_0x323a('0x3'));var logger=require(_0x323a('0x4'))(_0x323a('0x5'));var config=require(_0x323a('0x6'));var jayson=require(_0x323a('0x7'));var client=jayson[_0x323a('0x8')][_0x323a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x50ad5a,_0x3452d3,_0x3544bd){return new BPromise(function(_0x568996,_0x385a54){return client[_0x323a('0xa')](_0x50ad5a,_0x3544bd)[_0x323a('0xb')](function(_0x4a74bd){logger[_0x323a('0xc')](_0x323a('0xd'),_0x3452d3,_0x323a('0xe'));logger[_0x323a('0xf')](_0x323a('0x10'),_0x3452d3,_0x323a('0xe'),JSON[_0x323a('0x11')](_0x4a74bd));if(_0x4a74bd[_0x323a('0x12')]){if(_0x4a74bd[_0x323a('0x12')][_0x323a('0x13')]===0x1f4){logger[_0x323a('0x12')](_0x323a('0xd'),_0x3452d3,_0x4a74bd[_0x323a('0x12')][_0x323a('0x14')]);return _0x385a54(_0x4a74bd['error'][_0x323a('0x14')]);}logger['error'](_0x323a('0xd'),_0x3452d3,_0x4a74bd['error']['message']);return _0x568996(_0x4a74bd[_0x323a('0x12')]['message']);}else{logger[_0x323a('0xc')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x3452d3,_0x323a('0xe'));_0x568996(_0x4a74bd[_0x323a('0x15')]['message']);}})[_0x323a('0x16')](function(_0x32674f){logger['error']('OpenchannelQueueReport,\x20%s,\x20%s',_0x3452d3,_0x32674f);_0x385a54(_0x32674f);});});}exports[_0x323a('0x17')]=function(_0x221ae4){var _0x2feed1=this;return new Promise(function(_0x29dd21,_0x303338){return db[_0x323a('0x18')]['create'](_0x221ae4['body'],{'raw':_0x221ae4['options']?_0x221ae4['options'][_0x323a('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0xc0f3e4){logger[_0x323a('0xc')](_0x323a('0x17'),_0x221ae4);logger[_0x323a('0xf')]('CreateOpenchannelQueueReport',_0x221ae4,JSON[_0x323a('0x11')](_0xc0f3e4));_0x29dd21(_0xc0f3e4);})['catch'](function(_0x12c8d7){logger[_0x323a('0x12')](_0x323a('0x17'),_0x12c8d7['message'],_0x221ae4);_0x303338(_0x2feed1[_0x323a('0x12')](0x1f4,_0x12c8d7[_0x323a('0x14')]));});});};exports[_0x323a('0x1a')]=function(_0x2960e0){var _0x35f8ec=this;return new Promise(function(_0x204f76,_0x5ba015){return db[_0x323a('0x18')]['update'](_0x2960e0[_0x323a('0x1b')],{'raw':_0x2960e0[_0x323a('0x1c')]?_0x2960e0[_0x323a('0x1c')][_0x323a('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2960e0[_0x323a('0x1c')]?_0x2960e0['options'][_0x323a('0x1d')]||null:null,'attributes':_0x2960e0[_0x323a('0x1c')]?_0x2960e0[_0x323a('0x1c')][_0x323a('0x1e')]||null:null,'limit':_0x2960e0[_0x323a('0x1c')]?_0x2960e0['options'][_0x323a('0x1f')]||null:null})['then'](function(_0x24747b){logger[_0x323a('0xc')](_0x323a('0x1a'),_0x2960e0);logger[_0x323a('0xf')](_0x323a('0x1a'),_0x2960e0,JSON[_0x323a('0x11')](_0x24747b));_0x204f76(_0x24747b);})['catch'](function(_0x2a1a85){logger[_0x323a('0x12')]('UpdateOpenchannelQueueReport',_0x2a1a85[_0x323a('0x14')],_0x2960e0);_0x5ba015(_0x35f8ec['error'](0x1f4,_0x2a1a85['message']));});});}; \ No newline at end of file +var _0x7fce=['options','raw','CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport','OpenchannelQueueReport','update','where','attributes','limit','stringify','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','client','then','info','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','error','OpenchannelQueueReport,\x20%s,\x20%s','message','result','catch','create','body'];(function(_0x53faa3,_0x791da2){var _0x2b3ae8=function(_0x27f6e5){while(--_0x27f6e5){_0x53faa3['push'](_0x53faa3['shift']());}};_0x2b3ae8(++_0x791da2);}(_0x7fce,0xdc));var _0xe7fc=function(_0x3c24d3,_0x4d8806){_0x3c24d3=_0x3c24d3-0x0;var _0x4c3956=_0x7fce[_0x3c24d3];return _0x4c3956;};'use strict';var _=require(_0xe7fc('0x0'));var util=require(_0xe7fc('0x1'));var moment=require(_0xe7fc('0x2'));var BPromise=require('bluebird');var rs=require(_0xe7fc('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe7fc('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xe7fc('0x5'))(_0xe7fc('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe7fc('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4665f6,_0x161dca,_0x296b2e){return new BPromise(function(_0x19eeef,_0x22fabf){return client['request'](_0x4665f6,_0x296b2e)[_0xe7fc('0x8')](function(_0x4a1209){logger[_0xe7fc('0x9')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x161dca,_0xe7fc('0xa'));logger[_0xe7fc('0xb')](_0xe7fc('0xc'),_0x161dca,_0xe7fc('0xa'),JSON['stringify'](_0x4a1209));if(_0x4a1209[_0xe7fc('0xd')]){if(_0x4a1209[_0xe7fc('0xd')]['code']===0x1f4){logger['error'](_0xe7fc('0xe'),_0x161dca,_0x4a1209['error'][_0xe7fc('0xf')]);return _0x22fabf(_0x4a1209['error']['message']);}logger[_0xe7fc('0xd')](_0xe7fc('0xe'),_0x161dca,_0x4a1209[_0xe7fc('0xd')][_0xe7fc('0xf')]);return _0x19eeef(_0x4a1209[_0xe7fc('0xd')]['message']);}else{logger[_0xe7fc('0x9')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x161dca,'request\x20sent');_0x19eeef(_0x4a1209[_0xe7fc('0x10')][_0xe7fc('0xf')]);}})[_0xe7fc('0x11')](function(_0x3a44a6){logger['error']('OpenchannelQueueReport,\x20%s,\x20%s',_0x161dca,_0x3a44a6);_0x22fabf(_0x3a44a6);});});}exports['CreateOpenchannelQueueReport']=function(_0x4aa4f0){var _0x52902f=this;return new Promise(function(_0x490a99,_0x14515d){return db['OpenchannelQueueReport'][_0xe7fc('0x12')](_0x4aa4f0[_0xe7fc('0x13')],{'raw':_0x4aa4f0[_0xe7fc('0x14')]?_0x4aa4f0[_0xe7fc('0x14')][_0xe7fc('0x15')]===undefined?!![]:![]:!![]})[_0xe7fc('0x8')](function(_0x329051){logger[_0xe7fc('0x9')]('CreateOpenchannelQueueReport',_0x4aa4f0);logger[_0xe7fc('0xb')](_0xe7fc('0x16'),_0x4aa4f0,JSON['stringify'](_0x329051));_0x490a99(_0x329051);})['catch'](function(_0x35bb53){logger[_0xe7fc('0xd')](_0xe7fc('0x16'),_0x35bb53[_0xe7fc('0xf')],_0x4aa4f0);_0x14515d(_0x52902f[_0xe7fc('0xd')](0x1f4,_0x35bb53[_0xe7fc('0xf')]));});});};exports[_0xe7fc('0x17')]=function(_0x1731b6){var _0xb00cb9=this;return new Promise(function(_0x3e7e7e,_0x1d1348){return db[_0xe7fc('0x18')][_0xe7fc('0x19')](_0x1731b6['body'],{'raw':_0x1731b6[_0xe7fc('0x14')]?_0x1731b6[_0xe7fc('0x14')][_0xe7fc('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1731b6[_0xe7fc('0x14')]?_0x1731b6[_0xe7fc('0x14')][_0xe7fc('0x1a')]||null:null,'attributes':_0x1731b6['options']?_0x1731b6[_0xe7fc('0x14')][_0xe7fc('0x1b')]||null:null,'limit':_0x1731b6[_0xe7fc('0x14')]?_0x1731b6[_0xe7fc('0x14')][_0xe7fc('0x1c')]||null:null})[_0xe7fc('0x8')](function(_0x383ca6){logger['info'](_0xe7fc('0x17'),_0x1731b6);logger[_0xe7fc('0xb')]('UpdateOpenchannelQueueReport',_0x1731b6,JSON[_0xe7fc('0x1d')](_0x383ca6));_0x3e7e7e(_0x383ca6);})['catch'](function(_0x39d908){logger[_0xe7fc('0xd')]('UpdateOpenchannelQueueReport',_0x39d908[_0xe7fc('0xf')],_0x1731b6);_0x1d1348(_0xb00cb9['error'](0x1f4,_0x39d908[_0xe7fc('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 744daab..8f6aeec 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 _0x8ee2=['update','delete','exports','multer','path','express','Router','fs-extra','../../components/auth/service','./openchannelTransferReport.controller','get','isAuthenticated','index','/describe','show','post','create','put','/:id'];(function(_0x95942,_0x85da80){var _0x6d7f81=function(_0x510549){while(--_0x510549){_0x95942['push'](_0x95942['shift']());}};_0x6d7f81(++_0x85da80);}(_0x8ee2,0xae));var _0x28ee=function(_0x5cb87f,_0x5300df){_0x5cb87f=_0x5cb87f-0x0;var _0x397517=_0x8ee2[_0x5cb87f];return _0x397517;};'use strict';var multer=require(_0x28ee('0x0'));var util=require('util');var path=require(_0x28ee('0x1'));var timeout=require('connect-timeout');var express=require(_0x28ee('0x2'));var router=express[_0x28ee('0x3')]();var fs_extra=require(_0x28ee('0x4'));var auth=require(_0x28ee('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x28ee('0x6'));router[_0x28ee('0x7')]('/',auth[_0x28ee('0x8')](),controller[_0x28ee('0x9')]);router['get'](_0x28ee('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x28ee('0x7')]('/:id',auth[_0x28ee('0x8')](),controller[_0x28ee('0xb')]);router[_0x28ee('0xc')]('/',auth[_0x28ee('0x8')](),controller[_0x28ee('0xd')]);router[_0x28ee('0xe')](_0x28ee('0xf'),auth[_0x28ee('0x8')](),controller[_0x28ee('0x10')]);router[_0x28ee('0x11')](_0x28ee('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0x28ee('0x12')]=router; \ No newline at end of file +var _0x6a64=['get','/describe','show','post','create','/:id','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','isAuthenticated','index'];(function(_0xea17a7,_0x3f7d93){var _0x247ed5=function(_0x54e1be){while(--_0x54e1be){_0xea17a7['push'](_0xea17a7['shift']());}};_0x247ed5(++_0x3f7d93);}(_0x6a64,0x144));var _0x46a6=function(_0x78826,_0x3ae9b2){_0x78826=_0x78826-0x0;var _0x4403a9=_0x6a64[_0x78826];return _0x4403a9;};'use strict';var multer=require('multer');var util=require(_0x46a6('0x0'));var path=require(_0x46a6('0x1'));var timeout=require(_0x46a6('0x2'));var express=require(_0x46a6('0x3'));var router=express[_0x46a6('0x4')]();var fs_extra=require(_0x46a6('0x5'));var auth=require(_0x46a6('0x6'));var interaction=require(_0x46a6('0x7'));var config=require(_0x46a6('0x8'));var controller=require(_0x46a6('0x9'));router['get']('/',auth[_0x46a6('0xa')](),controller[_0x46a6('0xb')]);router[_0x46a6('0xc')](_0x46a6('0xd'),auth['isAuthenticated'](),controller['describe']);router[_0x46a6('0xc')]('/:id',auth[_0x46a6('0xa')](),controller[_0x46a6('0xe')]);router[_0x46a6('0xf')]('/',auth['isAuthenticated'](),controller[_0x46a6('0x10')]);router['put'](_0x46a6('0x11'),auth[_0x46a6('0xa')](),controller[_0x46a6('0x12')]);router[_0x46a6('0x13')](_0x46a6('0x11'),auth[_0x46a6('0xa')](),controller['destroy']);module[_0x46a6('0x14')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index de18816..9066919 100644 --- a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js +++ b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x54ef=['agent','queue','DATE','NOW','moment','sequelize','exports','ENUM','account'];(function(_0x25c044,_0xbd05f8){var _0x558ee5=function(_0x5de5d2){while(--_0x5de5d2){_0x25c044['push'](_0x25c044['shift']());}};_0x558ee5(++_0xbd05f8);}(_0x54ef,0x112));var _0xf54e=function(_0x30284d,_0x321080){_0x30284d=_0x30284d-0x0;var _0x548a85=_0x54ef[_0x30284d];return _0x548a85;};'use strict';var moment=require(_0xf54e('0x0'));var Sequelize=require(_0xf54e('0x1'));module[_0xf54e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xf54e('0x3')](_0xf54e('0x4'),_0xf54e('0x5'),_0xf54e('0x6')),'allowNull':![],'defaultValue':_0xf54e('0x6')},'transferredAt':{'type':Sequelize[_0xf54e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xf54e('0x8')]}}; \ No newline at end of file +var _0x34e8=['queue','DATE','NOW','moment','sequelize','exports','STRING','account','agent'];(function(_0x13639d,_0x3c996b){var _0x52ef14=function(_0x3faf51){while(--_0x3faf51){_0x13639d['push'](_0x13639d['shift']());}};_0x52ef14(++_0x3c996b);}(_0x34e8,0x12c));var _0x834e=function(_0x34b36b,_0x6b057b){_0x34b36b=_0x34b36b-0x0;var _0x495325=_0x34e8[_0x34b36b];return _0x495325;};'use strict';var moment=require(_0x834e('0x0'));var Sequelize=require(_0x834e('0x1'));module[_0x834e('0x2')]={'uniqueid':{'type':Sequelize[_0x834e('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x834e('0x4'),_0x834e('0x5'),_0x834e('0x6')),'allowNull':![],'defaultValue':_0x834e('0x6')},'transferredAt':{'type':Sequelize[_0x834e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x834e('0x8')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index be678bb..d7e0536 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 _0xe672=['sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','name','send','index','map','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','merge','where','type','VIRTUAL','filter','options','includeAll','OpenchannelTransferReport','findAll','rows','show','params','include','find','catch','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment'];(function(_0x55b3b5,_0x254983){var _0x5297a9=function(_0x5f302f){while(--_0x5f302f){_0x55b3b5['push'](_0x55b3b5['shift']());}};_0x5297a9(++_0x254983);}(_0xe672,0x154));var _0x2e67=function(_0x3df60c,_0x573229){_0x3df60c=_0x3df60c-0x0;var _0x50202b=_0xe672[_0x3df60c];return _0x50202b;};'use strict';var emlformat=require(_0x2e67('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2e67('0x1'));var jsonpatch=require(_0x2e67('0x2'));var rp=require(_0x2e67('0x3'));var moment=require('moment');var BPromise=require(_0x2e67('0x4'));var Mustache=require('mustache');var util=require(_0x2e67('0x5'));var path=require('path');var sox=require(_0x2e67('0x6'));var csv=require(_0x2e67('0x7'));var ejs=require(_0x2e67('0x8'));var fs=require('fs');var fs_extra=require(_0x2e67('0x9'));var _=require('lodash');var squel=require(_0x2e67('0xa'));var crypto=require(_0x2e67('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x2e67('0xc'));var toCsv=require(_0x2e67('0x7'));var querystring=require('querystring');var Papa=require(_0x2e67('0xd'));var Redis=require('ioredis');var authService=require(_0x2e67('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x2e67('0xf'));var hardwareService=require(_0x2e67('0x10'));var logger=require(_0x2e67('0x11'))('api');var utils=require(_0x2e67('0x12'));var config=require(_0x2e67('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4f0144,_0x28ab11){_0x28ab11=_0x28ab11||0xcc;return function(_0x140fbf){if(_0x140fbf){return _0x4f0144[_0x2e67('0x14')](_0x28ab11);}return _0x4f0144[_0x2e67('0x15')](_0x28ab11)['end']();};}function respondWithResult(_0x1235f9,_0x25391c){_0x25391c=_0x25391c||0xc8;return function(_0xc0a73f){if(_0xc0a73f){return _0x1235f9['status'](_0x25391c)[_0x2e67('0x16')](_0xc0a73f);}};}function respondWithFilteredResult(_0x261365,_0x4cf457){return function(_0x139169){if(_0x139169){var _0x12fb58=typeof _0x4cf457[_0x2e67('0x17')]===_0x2e67('0x18')&&typeof _0x4cf457[_0x2e67('0x19')]==='undefined';var _0xa6ea25=_0x139169[_0x2e67('0x1a')];var _0x46707b=_0x12fb58?0x0:_0x4cf457[_0x2e67('0x17')];var _0x23c4f8=_0x12fb58?_0x139169[_0x2e67('0x1a')]:_0x4cf457['offset']+_0x4cf457[_0x2e67('0x19')];var _0x8d70c1;if(_0x23c4f8>=_0xa6ea25){_0x23c4f8=_0xa6ea25;_0x8d70c1=0xc8;}else{_0x8d70c1=0xce;}_0x261365[_0x2e67('0x15')](_0x8d70c1);return _0x261365[_0x2e67('0x1b')](_0x2e67('0x1c'),_0x46707b+'-'+_0x23c4f8+'/'+_0xa6ea25)[_0x2e67('0x16')](_0x139169);}return null;};}function patchUpdates(_0x1a29e0){return function(_0x318ccd){try{jsonpatch[_0x2e67('0x1d')](_0x318ccd,_0x1a29e0,!![]);}catch(_0x40d614){return BPromise[_0x2e67('0x1e')](_0x40d614);}return _0x318ccd[_0x2e67('0x1f')]();};}function saveUpdates(_0x26557b,_0x241398){return function(_0x40f1bc){if(_0x40f1bc){return _0x40f1bc[_0x2e67('0x20')](_0x26557b)[_0x2e67('0x21')](function(_0x3bc985){return _0x3bc985;});}return null;};}function removeEntity(_0x292272,_0x51dda0){return function(_0x2eae64){if(_0x2eae64){return _0x2eae64[_0x2e67('0x22')]()['then'](function(){_0x292272[_0x2e67('0x15')](0xcc)[_0x2e67('0x23')]();});}};}function handleEntityNotFound(_0x46179e,_0x207df1){return function(_0x1085cf){if(!_0x1085cf){_0x46179e['sendStatus'](0x194);}return _0x1085cf;};}function handleError(_0x7a14fd,_0x94645b){_0x94645b=_0x94645b||0x1f4;return function(_0xca589e){logger['error'](_0xca589e['stack']);if(_0xca589e[_0x2e67('0x24')]){delete _0xca589e[_0x2e67('0x24')];}_0x7a14fd[_0x2e67('0x15')](_0x94645b)[_0x2e67('0x25')](_0xca589e);};}exports[_0x2e67('0x26')]=function(_0xb9411f,_0x45fc2d){var _0x180832={},_0xaba3db={},_0x439856={'count':0x0,'rows':[]};var _0x294ab5=_[_0x2e67('0x27')](db['OpenchannelTransferReport'][_0x2e67('0x28')],function(_0x2cbb9f){return{'name':_0x2cbb9f['fieldName'],'type':_0x2cbb9f['type'][_0x2e67('0x29')]};});_0xaba3db[_0x2e67('0x2a')]=_[_0x2e67('0x27')](_0x294ab5,_0x2e67('0x24'));_0xaba3db[_0x2e67('0x2b')]=_[_0x2e67('0x2c')](_0xb9411f[_0x2e67('0x2b')]);_0xaba3db[_0x2e67('0x2d')]=_[_0x2e67('0x2e')](_0xaba3db[_0x2e67('0x2a')],_0xaba3db[_0x2e67('0x2b')]);_0x180832[_0x2e67('0x2f')]=_['intersection'](_0xaba3db[_0x2e67('0x2a')],qs['fields'](_0xb9411f[_0x2e67('0x2b')][_0x2e67('0x30')]));_0x180832['attributes']=_0x180832[_0x2e67('0x2f')][_0x2e67('0x31')]?_0x180832[_0x2e67('0x2f')]:_0xaba3db[_0x2e67('0x2a')];if(!_0xb9411f['query']['hasOwnProperty'](_0x2e67('0x32'))){_0x180832[_0x2e67('0x19')]=qs[_0x2e67('0x19')](_0xb9411f['query'][_0x2e67('0x19')]);_0x180832[_0x2e67('0x17')]=qs[_0x2e67('0x17')](_0xb9411f['query'][_0x2e67('0x17')]);}_0x180832[_0x2e67('0x33')]=qs[_0x2e67('0x34')](_0xb9411f[_0x2e67('0x2b')][_0x2e67('0x34')]);_0x180832['where']=qs[_0x2e67('0x2d')](_[_0x2e67('0x35')](_0xb9411f[_0x2e67('0x2b')],_0xaba3db[_0x2e67('0x2d')]),_0x294ab5);if(_0xb9411f[_0x2e67('0x2b')]['filter']){_0x180832['where']=_[_0x2e67('0x36')](_0x180832[_0x2e67('0x37')],{'$or':_['map'](_0x294ab5,function(_0x44d05f){if(_0x44d05f[_0x2e67('0x38')]!==_0x2e67('0x39')){var _0x852867={};_0x852867[_0x44d05f[_0x2e67('0x24')]]={'$like':'%'+_0xb9411f[_0x2e67('0x2b')][_0x2e67('0x3a')]+'%'};return _0x852867;}})});}_0x180832=_[_0x2e67('0x36')]({},_0x180832,_0xb9411f[_0x2e67('0x3b')]);var _0x447377={'where':_0x180832[_0x2e67('0x37')]};return db['OpenchannelTransferReport'][_0x2e67('0x1a')](_0x447377)[_0x2e67('0x21')](function(_0x1a0204){_0x439856[_0x2e67('0x1a')]=_0x1a0204;if(_0xb9411f[_0x2e67('0x2b')][_0x2e67('0x3c')]){_0x180832['include']=[{'all':!![]}];}return db[_0x2e67('0x3d')][_0x2e67('0x3e')](_0x180832);})['then'](function(_0x1c702b){_0x439856[_0x2e67('0x3f')]=_0x1c702b;return _0x439856;})[_0x2e67('0x21')](respondWithFilteredResult(_0x45fc2d,_0x180832))['catch'](handleError(_0x45fc2d,null));};exports[_0x2e67('0x40')]=function(_0x46c948,_0x4ca805){var _0x2fe5c2={'raw':!![],'where':{'id':_0x46c948[_0x2e67('0x41')]['id']}},_0x549bc1={};_0x549bc1[_0x2e67('0x2a')]=_[_0x2e67('0x2c')](db[_0x2e67('0x3d')]['rawAttributes']);_0x549bc1[_0x2e67('0x2b')]=_['keys'](_0x46c948[_0x2e67('0x2b')]);_0x549bc1[_0x2e67('0x2d')]=_[_0x2e67('0x2e')](_0x549bc1[_0x2e67('0x2a')],_0x549bc1[_0x2e67('0x2b')]);_0x2fe5c2[_0x2e67('0x2f')]=_[_0x2e67('0x2e')](_0x549bc1['model'],qs[_0x2e67('0x30')](_0x46c948[_0x2e67('0x2b')]['fields']));_0x2fe5c2['attributes']=_0x2fe5c2[_0x2e67('0x2f')]['length']?_0x2fe5c2[_0x2e67('0x2f')]:_0x549bc1[_0x2e67('0x2a')];if(_0x46c948['query']['includeAll']){_0x2fe5c2[_0x2e67('0x42')]=[{'all':!![]}];}_0x2fe5c2=_[_0x2e67('0x36')]({},_0x2fe5c2,_0x46c948[_0x2e67('0x3b')]);return db[_0x2e67('0x3d')][_0x2e67('0x43')](_0x2fe5c2)[_0x2e67('0x21')](handleEntityNotFound(_0x4ca805,null))[_0x2e67('0x21')](respondWithResult(_0x4ca805,null))[_0x2e67('0x44')](handleError(_0x4ca805,null));};exports[_0x2e67('0x45')]=function(_0x4c80ec,_0x60a5f7){return db[_0x2e67('0x3d')]['create'](_0x4c80ec[_0x2e67('0x46')],{})['then'](respondWithResult(_0x60a5f7,0xc9))['catch'](handleError(_0x60a5f7,null));};exports[_0x2e67('0x20')]=function(_0x224120,_0x1e167c){if(_0x224120[_0x2e67('0x46')]['id']){delete _0x224120[_0x2e67('0x46')]['id'];}return db[_0x2e67('0x3d')][_0x2e67('0x43')]({'where':{'id':_0x224120[_0x2e67('0x41')]['id']}})[_0x2e67('0x21')](handleEntityNotFound(_0x1e167c,null))[_0x2e67('0x21')](saveUpdates(_0x224120[_0x2e67('0x46')],null))['then'](respondWithResult(_0x1e167c,null))[_0x2e67('0x44')](handleError(_0x1e167c,null));};exports[_0x2e67('0x22')]=function(_0x3074d9,_0x3d54ef){return db[_0x2e67('0x3d')]['find']({'where':{'id':_0x3074d9[_0x2e67('0x41')]['id']}})[_0x2e67('0x21')](handleEntityNotFound(_0x3d54ef,null))['then'](removeEntity(_0x3d54ef,null))[_0x2e67('0x44')](handleError(_0x3d54ef,null));};exports[_0x2e67('0x47')]=function(_0x55058b,_0x16ae46){return db[_0x2e67('0x3d')][_0x2e67('0x47')]()['then'](respondWithResult(_0x16ae46,null))['catch'](handleError(_0x16ae46,null));}; \ No newline at end of file +var _0x8c73=['options','findAll','rows','show','params','rawAttributes','intersection','length','includeAll','include','merge','find','body','catch','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','squel','crypto','jsforce','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','set','apply','reject','save','update','then','destroy','error','stack','name','send','OpenchannelTransferReport','fieldName','model','map','query','keys','filters','attributes','fields','limit','sort','where','pick','filter','VIRTUAL'];(function(_0x411017,_0x4a8117){var _0x2adeea=function(_0x545222){while(--_0x545222){_0x411017['push'](_0x411017['shift']());}};_0x2adeea(++_0x4a8117);}(_0x8c73,0xde));var _0x38c7=function(_0x267beb,_0x10ddd9){_0x267beb=_0x267beb-0x0;var _0x248765=_0x8c73[_0x267beb];return _0x248765;};'use strict';var emlformat=require(_0x38c7('0x0'));var rimraf=require(_0x38c7('0x1'));var zipdir=require(_0x38c7('0x2'));var jsonpatch=require(_0x38c7('0x3'));var rp=require(_0x38c7('0x4'));var moment=require(_0x38c7('0x5'));var BPromise=require(_0x38c7('0x6'));var Mustache=require(_0x38c7('0x7'));var util=require('util');var path=require(_0x38c7('0x8'));var sox=require(_0x38c7('0x9'));var csv=require(_0x38c7('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x38c7('0xb'));var crypto=require(_0x38c7('0xc'));var jsforce=require(_0x38c7('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x38c7('0xa'));var querystring=require('querystring');var Papa=require(_0x38c7('0xe'));var Redis=require('ioredis');var authService=require(_0x38c7('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x38c7('0x10'));var logger=require(_0x38c7('0x11'))(_0x38c7('0x12'));var utils=require('../../config/utils');var config=require(_0x38c7('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x38c7('0x14'))['db'];function respondWithStatusCode(_0x41cff4,_0x393a2c){_0x393a2c=_0x393a2c||0xcc;return function(_0x381923){if(_0x381923){return _0x41cff4[_0x38c7('0x15')](_0x393a2c);}return _0x41cff4[_0x38c7('0x16')](_0x393a2c)[_0x38c7('0x17')]();};}function respondWithResult(_0x45ed5f,_0x235bdf){_0x235bdf=_0x235bdf||0xc8;return function(_0x1806e7){if(_0x1806e7){return _0x45ed5f[_0x38c7('0x16')](_0x235bdf)[_0x38c7('0x18')](_0x1806e7);}};}function respondWithFilteredResult(_0x209306,_0x1dc9da){return function(_0x14c57b){if(_0x14c57b){var _0x245077=typeof _0x1dc9da['offset']===_0x38c7('0x19')&&typeof _0x1dc9da['limit']==='undefined';var _0x827f4f=_0x14c57b[_0x38c7('0x1a')];var _0x478b45=_0x245077?0x0:_0x1dc9da['offset'];var _0x587b7a=_0x245077?_0x14c57b[_0x38c7('0x1a')]:_0x1dc9da[_0x38c7('0x1b')]+_0x1dc9da['limit'];var _0x161a40;if(_0x587b7a>=_0x827f4f){_0x587b7a=_0x827f4f;_0x161a40=0xc8;}else{_0x161a40=0xce;}_0x209306[_0x38c7('0x16')](_0x161a40);return _0x209306[_0x38c7('0x1c')]('Content-Range',_0x478b45+'-'+_0x587b7a+'/'+_0x827f4f)['json'](_0x14c57b);}return null;};}function patchUpdates(_0x2b6331){return function(_0x2b9089){try{jsonpatch[_0x38c7('0x1d')](_0x2b9089,_0x2b6331,!![]);}catch(_0x5dc7e5){return BPromise[_0x38c7('0x1e')](_0x5dc7e5);}return _0x2b9089[_0x38c7('0x1f')]();};}function saveUpdates(_0x297c6f,_0x2f3447){return function(_0x568602){if(_0x568602){return _0x568602[_0x38c7('0x20')](_0x297c6f)[_0x38c7('0x21')](function(_0x1e0473){return _0x1e0473;});}return null;};}function removeEntity(_0x188d00,_0x2b3ea6){return function(_0x15e960){if(_0x15e960){return _0x15e960[_0x38c7('0x22')]()[_0x38c7('0x21')](function(){_0x188d00['status'](0xcc)[_0x38c7('0x17')]();});}};}function handleEntityNotFound(_0x154a69,_0x4c6312){return function(_0x2b4221){if(!_0x2b4221){_0x154a69[_0x38c7('0x15')](0x194);}return _0x2b4221;};}function handleError(_0x1f1065,_0x1540da){_0x1540da=_0x1540da||0x1f4;return function(_0x2c4fb2){logger[_0x38c7('0x23')](_0x2c4fb2[_0x38c7('0x24')]);if(_0x2c4fb2[_0x38c7('0x25')]){delete _0x2c4fb2['name'];}_0x1f1065[_0x38c7('0x16')](_0x1540da)[_0x38c7('0x26')](_0x2c4fb2);};}exports['index']=function(_0x56a26e,_0x386a74){var _0x2815c6={},_0x4808d6={},_0x2afdcd={'count':0x0,'rows':[]};var _0x5d4f6b=_['map'](db[_0x38c7('0x27')]['rawAttributes'],function(_0x4cbd28){return{'name':_0x4cbd28[_0x38c7('0x28')],'type':_0x4cbd28['type']['key']};});_0x4808d6[_0x38c7('0x29')]=_[_0x38c7('0x2a')](_0x5d4f6b,'name');_0x4808d6[_0x38c7('0x2b')]=_[_0x38c7('0x2c')](_0x56a26e[_0x38c7('0x2b')]);_0x4808d6[_0x38c7('0x2d')]=_['intersection'](_0x4808d6[_0x38c7('0x29')],_0x4808d6[_0x38c7('0x2b')]);_0x2815c6[_0x38c7('0x2e')]=_['intersection'](_0x4808d6[_0x38c7('0x29')],qs[_0x38c7('0x2f')](_0x56a26e['query'][_0x38c7('0x2f')]));_0x2815c6[_0x38c7('0x2e')]=_0x2815c6[_0x38c7('0x2e')]['length']?_0x2815c6['attributes']:_0x4808d6['model'];if(!_0x56a26e[_0x38c7('0x2b')]['hasOwnProperty']('nolimit')){_0x2815c6['limit']=qs[_0x38c7('0x30')](_0x56a26e[_0x38c7('0x2b')][_0x38c7('0x30')]);_0x2815c6[_0x38c7('0x1b')]=qs['offset'](_0x56a26e[_0x38c7('0x2b')]['offset']);}_0x2815c6['order']=qs[_0x38c7('0x31')](_0x56a26e[_0x38c7('0x2b')][_0x38c7('0x31')]);_0x2815c6[_0x38c7('0x32')]=qs[_0x38c7('0x2d')](_[_0x38c7('0x33')](_0x56a26e[_0x38c7('0x2b')],_0x4808d6[_0x38c7('0x2d')]),_0x5d4f6b);if(_0x56a26e[_0x38c7('0x2b')][_0x38c7('0x34')]){_0x2815c6[_0x38c7('0x32')]=_['merge'](_0x2815c6['where'],{'$or':_[_0x38c7('0x2a')](_0x5d4f6b,function(_0x36fe93){if(_0x36fe93['type']!==_0x38c7('0x35')){var _0x502342={};_0x502342[_0x36fe93[_0x38c7('0x25')]]={'$like':'%'+_0x56a26e[_0x38c7('0x2b')][_0x38c7('0x34')]+'%'};return _0x502342;}})});}_0x2815c6=_['merge']({},_0x2815c6,_0x56a26e[_0x38c7('0x36')]);var _0x3ffedf={'where':_0x2815c6['where']};return db[_0x38c7('0x27')][_0x38c7('0x1a')](_0x3ffedf)['then'](function(_0x5d3614){_0x2afdcd[_0x38c7('0x1a')]=_0x5d3614;if(_0x56a26e['query']['includeAll']){_0x2815c6['include']=[{'all':!![]}];}return db[_0x38c7('0x27')][_0x38c7('0x37')](_0x2815c6);})['then'](function(_0x1efbbd){_0x2afdcd[_0x38c7('0x38')]=_0x1efbbd;return _0x2afdcd;})[_0x38c7('0x21')](respondWithFilteredResult(_0x386a74,_0x2815c6))['catch'](handleError(_0x386a74,null));};exports[_0x38c7('0x39')]=function(_0x1524d0,_0x8a5a31){var _0x1480d4={'raw':!![],'where':{'id':_0x1524d0[_0x38c7('0x3a')]['id']}},_0x3dd473={};_0x3dd473['model']=_[_0x38c7('0x2c')](db['OpenchannelTransferReport'][_0x38c7('0x3b')]);_0x3dd473[_0x38c7('0x2b')]=_[_0x38c7('0x2c')](_0x1524d0[_0x38c7('0x2b')]);_0x3dd473['filters']=_[_0x38c7('0x3c')](_0x3dd473[_0x38c7('0x29')],_0x3dd473[_0x38c7('0x2b')]);_0x1480d4[_0x38c7('0x2e')]=_[_0x38c7('0x3c')](_0x3dd473[_0x38c7('0x29')],qs[_0x38c7('0x2f')](_0x1524d0[_0x38c7('0x2b')][_0x38c7('0x2f')]));_0x1480d4[_0x38c7('0x2e')]=_0x1480d4[_0x38c7('0x2e')][_0x38c7('0x3d')]?_0x1480d4[_0x38c7('0x2e')]:_0x3dd473['model'];if(_0x1524d0['query'][_0x38c7('0x3e')]){_0x1480d4[_0x38c7('0x3f')]=[{'all':!![]}];}_0x1480d4=_[_0x38c7('0x40')]({},_0x1480d4,_0x1524d0['options']);return db['OpenchannelTransferReport'][_0x38c7('0x41')](_0x1480d4)[_0x38c7('0x21')](handleEntityNotFound(_0x8a5a31,null))[_0x38c7('0x21')](respondWithResult(_0x8a5a31,null))['catch'](handleError(_0x8a5a31,null));};exports['create']=function(_0xcadba0,_0x4a3cd2){return db[_0x38c7('0x27')]['create'](_0xcadba0[_0x38c7('0x42')],{})[_0x38c7('0x21')](respondWithResult(_0x4a3cd2,0xc9))['catch'](handleError(_0x4a3cd2,null));};exports[_0x38c7('0x20')]=function(_0x3bd114,_0x4b1d96){if(_0x3bd114[_0x38c7('0x42')]['id']){delete _0x3bd114[_0x38c7('0x42')]['id'];}return db['OpenchannelTransferReport']['find']({'where':{'id':_0x3bd114[_0x38c7('0x3a')]['id']}})[_0x38c7('0x21')](handleEntityNotFound(_0x4b1d96,null))[_0x38c7('0x21')](saveUpdates(_0x3bd114[_0x38c7('0x42')],null))[_0x38c7('0x21')](respondWithResult(_0x4b1d96,null))[_0x38c7('0x43')](handleError(_0x4b1d96,null));};exports['destroy']=function(_0x561741,_0xfa1247){return db[_0x38c7('0x27')][_0x38c7('0x41')]({'where':{'id':_0x561741[_0x38c7('0x3a')]['id']}})['then'](handleEntityNotFound(_0xfa1247,null))[_0x38c7('0x21')](removeEntity(_0xfa1247,null))[_0x38c7('0x43')](handleError(_0xfa1247,null));};exports['describe']=function(_0x4cf5e4,_0x2cf908){return db[_0x38c7('0x27')][_0x38c7('0x44')]()[_0x38c7('0x21')](respondWithResult(_0x2cf908,null))['catch'](handleError(_0x2cf908,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 527ef81..a234b9e 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 _0xacb5=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./openchannelTransferReport.attributes','exports','define','OpenchannelTransferReport','lodash'];(function(_0x52449f,_0x2a6b98){var _0x12e6ed=function(_0x87f010){while(--_0x87f010){_0x52449f['push'](_0x52449f['shift']());}};_0x12e6ed(++_0x2a6b98);}(_0xacb5,0x197));var _0x5acb=function(_0x3875b1,_0x47cf1a){_0x3875b1=_0x3875b1-0x0;var _0x1e9c55=_0xacb5[_0x3875b1];return _0x1e9c55;};'use strict';var _=require(_0x5acb('0x0'));var util=require('util');var logger=require(_0x5acb('0x1'))(_0x5acb('0x2'));var moment=require(_0x5acb('0x3'));var BPromise=require(_0x5acb('0x4'));var rp=require(_0x5acb('0x5'));var fs=require('fs');var path=require(_0x5acb('0x6'));var rimraf=require(_0x5acb('0x7'));var config=require('../../config/environment');var attributes=require(_0x5acb('0x8'));module[_0x5acb('0x9')]=function(_0x2a9806,_0x4d76bc){return _0x2a9806[_0x5acb('0xa')](_0x5acb('0xb'),attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x0ea2=['define','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports'];(function(_0x3a59e2,_0x502e43){var _0x226b63=function(_0x3f184b){while(--_0x3f184b){_0x3a59e2['push'](_0x3a59e2['shift']());}};_0x226b63(++_0x502e43);}(_0x0ea2,0x12e));var _0x20ea=function(_0x4fb721,_0x245cab){_0x4fb721=_0x4fb721-0x0;var _0x8e7738=_0x0ea2[_0x4fb721];return _0x8e7738;};'use strict';var _=require(_0x20ea('0x0'));var util=require(_0x20ea('0x1'));var logger=require(_0x20ea('0x2'))(_0x20ea('0x3'));var moment=require(_0x20ea('0x4'));var BPromise=require(_0x20ea('0x5'));var rp=require(_0x20ea('0x6'));var fs=require('fs');var path=require(_0x20ea('0x7'));var rimraf=require('rimraf');var config=require(_0x20ea('0x8'));var attributes=require('./openchannelTransferReport.attributes');module[_0x20ea('0x9')]=function(_0x1945e2,_0x2db861){return _0x1945e2[_0x20ea('0xa')]('OpenchannelTransferReport',attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x20ea('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index c99bc86..1d95fc3 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 _0x1db9=['../../config/utils','../../config/logger','jayson/promise','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x454daa,_0x28cb38){var _0x400436=function(_0x307e79){while(--_0x307e79){_0x454daa['push'](_0x454daa['shift']());}};_0x400436(++_0x28cb38);}(_0x1db9,0x176));var _0x91db=function(_0x47b1cb,_0x2ecb31){_0x47b1cb=_0x47b1cb-0x0;var _0x5131e9=_0x1db9[_0x47b1cb];return _0x5131e9;};'use strict';var _=require(_0x91db('0x0'));var util=require(_0x91db('0x1'));var moment=require(_0x91db('0x2'));var BPromise=require(_0x91db('0x3'));var rs=require(_0x91db('0x4'));var fs=require('fs');var Redis=require(_0x91db('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x91db('0x6'));var logger=require(_0x91db('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x91db('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x433c75,_0x3b0c53,_0x45fea0){return new BPromise(function(_0x2330c2,_0x2d89a1){return client['request'](_0x433c75,_0x45fea0)[_0x91db('0x9')](function(_0x58cda2){logger[_0x91db('0xa')](_0x91db('0xb'),_0x3b0c53,_0x91db('0xc'));logger['debug'](_0x91db('0xd'),_0x3b0c53,'request\x20sent',JSON['stringify'](_0x58cda2));if(_0x58cda2['error']){if(_0x58cda2[_0x91db('0xe')][_0x91db('0xf')]===0x1f4){logger['error']('OpenchannelTransferReport,\x20%s,\x20%s',_0x3b0c53,_0x58cda2[_0x91db('0xe')][_0x91db('0x10')]);return _0x2d89a1(_0x58cda2[_0x91db('0xe')][_0x91db('0x10')]);}logger[_0x91db('0xe')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x3b0c53,_0x58cda2[_0x91db('0xe')][_0x91db('0x10')]);return _0x2330c2(_0x58cda2[_0x91db('0xe')][_0x91db('0x10')]);}else{logger[_0x91db('0xa')](_0x91db('0xb'),_0x3b0c53,_0x91db('0xc'));_0x2330c2(_0x58cda2[_0x91db('0x11')][_0x91db('0x10')]);}})[_0x91db('0x12')](function(_0x1e9679){logger[_0x91db('0xe')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x3b0c53,_0x1e9679);_0x2d89a1(_0x1e9679);});});} \ No newline at end of file +var _0xd13e=['OpenchannelTransferReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','request','then','info','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x3235c2,_0x1db520){var _0x3b9041=function(_0x593926){while(--_0x593926){_0x3235c2['push'](_0x3235c2['shift']());}};_0x3b9041(++_0x1db520);}(_0xd13e,0x193));var _0xed13=function(_0x51d0ab,_0x4fc3b6){_0x51d0ab=_0x51d0ab-0x0;var _0x3cf2a8=_0xd13e[_0x51d0ab];return _0x3cf2a8;};'use strict';var _=require(_0xed13('0x0'));var util=require(_0xed13('0x1'));var moment=require(_0xed13('0x2'));var BPromise=require(_0xed13('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xed13('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xed13('0x5'));var logger=require('../../config/logger')(_0xed13('0x6'));var config=require(_0xed13('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x95ff4c,_0x134929,_0xab0fff){return new BPromise(function(_0x3b3984,_0x369798){return client[_0xed13('0x8')](_0x95ff4c,_0xab0fff)[_0xed13('0x9')](function(_0x9bc191){logger[_0xed13('0xa')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x134929,_0xed13('0xb'));logger[_0xed13('0xc')](_0xed13('0xd'),_0x134929,_0xed13('0xb'),JSON[_0xed13('0xe')](_0x9bc191));if(_0x9bc191['error']){if(_0x9bc191[_0xed13('0xf')][_0xed13('0x10')]===0x1f4){logger[_0xed13('0xf')](_0xed13('0x11'),_0x134929,_0x9bc191[_0xed13('0xf')][_0xed13('0x12')]);return _0x369798(_0x9bc191['error'][_0xed13('0x12')]);}logger['error'](_0xed13('0x11'),_0x134929,_0x9bc191['error'][_0xed13('0x12')]);return _0x3b3984(_0x9bc191['error'][_0xed13('0x12')]);}else{logger['info'](_0xed13('0x11'),_0x134929,_0xed13('0xb'));_0x3b3984(_0x9bc191[_0xed13('0x13')][_0xed13('0x12')]);}})[_0xed13('0x14')](function(_0x1f8585){logger[_0xed13('0xf')](_0xed13('0x11'),_0x134929,_0x1f8585);_0x369798(_0x1f8585);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 9c28996..393bb89 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 _0x28b5=['path','connect-timeout','express','fs-extra','../../config/environment','./pause.controller','get','isAuthenticated','show','post','/:id','update','delete','destroy','exports','multer'];(function(_0x415eb1,_0x428fbb){var _0x3457b3=function(_0x1dd4e5){while(--_0x1dd4e5){_0x415eb1['push'](_0x415eb1['shift']());}};_0x3457b3(++_0x428fbb);}(_0x28b5,0x13f));var _0x528b=function(_0x12db5b,_0x17dec0){_0x12db5b=_0x12db5b-0x0;var _0xf0f483=_0x28b5[_0x12db5b];return _0xf0f483;};'use strict';var multer=require(_0x528b('0x0'));var util=require('util');var path=require(_0x528b('0x1'));var timeout=require(_0x528b('0x2'));var express=require(_0x528b('0x3'));var router=express['Router']();var fs_extra=require(_0x528b('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x528b('0x5'));var controller=require(_0x528b('0x6'));router[_0x528b('0x7')]('/',auth[_0x528b('0x8')](),controller['index']);router[_0x528b('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x528b('0x9')]);router[_0x528b('0xa')]('/',auth[_0x528b('0x8')](),controller['create']);router['put'](_0x528b('0xb'),auth[_0x528b('0x8')](),controller[_0x528b('0xc')]);router[_0x528b('0xd')](_0x528b('0xb'),auth['isAuthenticated'](),controller[_0x528b('0xe')]);module[_0x528b('0xf')]=router; \ No newline at end of file +var _0xd72b=['show','post','create','put','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../config/environment','./pause.controller','isAuthenticated','index','/:id'];(function(_0x21205e,_0x7eb8e7){var _0x136ebb=function(_0x54aac2){while(--_0x54aac2){_0x21205e['push'](_0x21205e['shift']());}};_0x136ebb(++_0x7eb8e7);}(_0xd72b,0x1ed));var _0xbd72=function(_0x1a0ff4,_0x1baf76){_0x1a0ff4=_0x1a0ff4-0x0;var _0x418132=_0xd72b[_0x1a0ff4];return _0x418132;};'use strict';var multer=require(_0xbd72('0x0'));var util=require(_0xbd72('0x1'));var path=require('path');var timeout=require(_0xbd72('0x2'));var express=require(_0xbd72('0x3'));var router=express[_0xbd72('0x4')]();var fs_extra=require(_0xbd72('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xbd72('0x6'));var controller=require(_0xbd72('0x7'));router['get']('/',auth[_0xbd72('0x8')](),controller[_0xbd72('0x9')]);router['get'](_0xbd72('0xa'),auth['isAuthenticated'](),controller[_0xbd72('0xb')]);router[_0xbd72('0xc')]('/',auth[_0xbd72('0x8')](),controller[_0xbd72('0xd')]);router[_0xbd72('0xe')](_0xbd72('0xa'),auth['isAuthenticated'](),controller['update']);router[_0xbd72('0xf')](_0xbd72('0xa'),auth[_0xbd72('0x8')](),controller[_0xbd72('0x10')]);module[_0xbd72('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 91de850..782bf19 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 _0xdec8=['sequelize','exports','STRING'];(function(_0x41ee7c,_0x3a8deb){var _0x54f982=function(_0x265baf){while(--_0x265baf){_0x41ee7c['push'](_0x41ee7c['shift']());}};_0x54f982(++_0x3a8deb);}(_0xdec8,0xcf));var _0x8dec=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xdec8[_0x25bea7];return _0x175952;};'use strict';var Sequelize=require(_0x8dec('0x0'));module[_0x8dec('0x1')]={'name':{'type':Sequelize[_0x8dec('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x21da=['sequelize','exports','name','STRING'];(function(_0x279cc3,_0xa71b8){var _0x443bf8=function(_0x50e0c8){while(--_0x50e0c8){_0x279cc3['push'](_0x279cc3['shift']());}};_0x443bf8(++_0xa71b8);}(_0x21da,0xc4));var _0xa21d=function(_0xaf0510,_0x16791d){_0xaf0510=_0xaf0510-0x0;var _0x12791d=_0x21da[_0xaf0510];return _0x12791d;};'use strict';var Sequelize=require(_0xa21d('0x0'));module[_0xa21d('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xa21d('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0xa21d('0x3')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index aa7e6f8..bb16b2a 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 _0x127b=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','Pauses','UserProfileResource','error','name','send','index','map','Pause','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body'];(function(_0x3ff0c6,_0x497a79){var _0x2ff3ed=function(_0x4d49a3){while(--_0x4d49a3){_0x3ff0c6['push'](_0x3ff0c6['shift']());}};_0x2ff3ed(++_0x497a79);}(_0x127b,0x1a9));var _0xb127=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0x127b[_0x12fc8d];return _0x3f9d04;};'use strict';var emlformat=require(_0xb127('0x0'));var rimraf=require(_0xb127('0x1'));var zipdir=require(_0xb127('0x2'));var jsonpatch=require(_0xb127('0x3'));var rp=require(_0xb127('0x4'));var moment=require(_0xb127('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xb127('0x6'));var sox=require(_0xb127('0x7'));var csv=require('to-csv');var ejs=require(_0xb127('0x8'));var fs=require('fs');var fs_extra=require(_0xb127('0x9'));var _=require(_0xb127('0xa'));var squel=require(_0xb127('0xb'));var crypto=require('crypto');var jsforce=require(_0xb127('0xc'));var deskjs=require(_0xb127('0xd'));var toCsv=require(_0xb127('0xe'));var querystring=require(_0xb127('0xf'));var Papa=require('papaparse');var Redis=require(_0xb127('0x10'));var authService=require(_0xb127('0x11'));var qs=require(_0xb127('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb127('0x13'));var logger=require(_0xb127('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xb127('0x15'));var licenseUtil=require(_0xb127('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x264961,_0x27dcf7){_0x27dcf7=_0x27dcf7||0xcc;return function(_0x47bbde){if(_0x47bbde){return _0x264961[_0xb127('0x17')](_0x27dcf7);}return _0x264961[_0xb127('0x18')](_0x27dcf7)[_0xb127('0x19')]();};}function respondWithResult(_0x1a8e04,_0x56efe7){_0x56efe7=_0x56efe7||0xc8;return function(_0x342551){if(_0x342551){return _0x1a8e04[_0xb127('0x18')](_0x56efe7)[_0xb127('0x1a')](_0x342551);}};}function respondWithFilteredResult(_0x1ad326,_0x368fc5){return function(_0x3bccd8){if(_0x3bccd8){var _0x33f4de=typeof _0x368fc5['offset']===_0xb127('0x1b')&&typeof _0x368fc5[_0xb127('0x1c')]===_0xb127('0x1b');var _0x242d5e=_0x3bccd8[_0xb127('0x1d')];var _0x18f1cd=_0x33f4de?0x0:_0x368fc5[_0xb127('0x1e')];var _0x40b1df=_0x33f4de?_0x3bccd8['count']:_0x368fc5[_0xb127('0x1e')]+_0x368fc5[_0xb127('0x1c')];var _0x364f34;if(_0x40b1df>=_0x242d5e){_0x40b1df=_0x242d5e;_0x364f34=0xc8;}else{_0x364f34=0xce;}_0x1ad326['status'](_0x364f34);return _0x1ad326[_0xb127('0x1f')](_0xb127('0x20'),_0x18f1cd+'-'+_0x40b1df+'/'+_0x242d5e)[_0xb127('0x1a')](_0x3bccd8);}return null;};}function patchUpdates(_0x3148cc){return function(_0xcfe1fc){try{jsonpatch[_0xb127('0x21')](_0xcfe1fc,_0x3148cc,!![]);}catch(_0x58da71){return BPromise[_0xb127('0x22')](_0x58da71);}return _0xcfe1fc[_0xb127('0x23')]();};}function saveUpdates(_0x4b14a2,_0x54ed78){return function(_0x539555){if(_0x539555){return _0x539555[_0xb127('0x24')](_0x4b14a2)[_0xb127('0x25')](function(_0x4a29f9){return _0x4a29f9;});}return null;};}function removeEntity(_0x5d2498,_0x25b1cf){return function(_0x17fe20){if(_0x17fe20){return _0x17fe20[_0xb127('0x26')]()['then'](function(){var _0x3cd555=_0x17fe20[_0xb127('0x27')]({'plain':!![]});var _0x359308=_0xb127('0x28');return db[_0xb127('0x29')][_0xb127('0x26')]({'where':{'type':_0x359308,'resourceId':_0x3cd555['id']}})[_0xb127('0x25')](function(){return _0x17fe20;});})['then'](function(){_0x5d2498['status'](0xcc)[_0xb127('0x19')]();});}};}function handleEntityNotFound(_0x111627,_0x76f0ba){return function(_0x2a0add){if(!_0x2a0add){_0x111627[_0xb127('0x17')](0x194);}return _0x2a0add;};}function handleError(_0x14998d,_0xc13042){_0xc13042=_0xc13042||0x1f4;return function(_0x5e13bb){logger[_0xb127('0x2a')](_0x5e13bb['stack']);if(_0x5e13bb['name']){delete _0x5e13bb[_0xb127('0x2b')];}_0x14998d[_0xb127('0x18')](_0xc13042)[_0xb127('0x2c')](_0x5e13bb);};}exports[_0xb127('0x2d')]=function(_0x2e5065,_0x61d5fd){var _0xb3821c={},_0x55f52b={},_0x270b49={'count':0x0,'rows':[]};var _0x5f23ac=_[_0xb127('0x2e')](db[_0xb127('0x2f')][_0xb127('0x30')],function(_0x3bd83){return{'name':_0x3bd83[_0xb127('0x31')],'type':_0x3bd83[_0xb127('0x32')][_0xb127('0x33')]};});_0x55f52b[_0xb127('0x34')]=_['map'](_0x5f23ac,_0xb127('0x2b'));_0x55f52b[_0xb127('0x35')]=_[_0xb127('0x36')](_0x2e5065[_0xb127('0x35')]);_0x55f52b['filters']=_[_0xb127('0x37')](_0x55f52b['model'],_0x55f52b[_0xb127('0x35')]);_0xb3821c[_0xb127('0x38')]=_[_0xb127('0x37')](_0x55f52b[_0xb127('0x34')],qs[_0xb127('0x39')](_0x2e5065['query'][_0xb127('0x39')]));_0xb3821c[_0xb127('0x38')]=_0xb3821c[_0xb127('0x38')][_0xb127('0x3a')]?_0xb3821c[_0xb127('0x38')]:_0x55f52b[_0xb127('0x34')];if(!_0x2e5065[_0xb127('0x35')][_0xb127('0x3b')](_0xb127('0x3c'))){_0xb3821c['limit']=qs[_0xb127('0x1c')](_0x2e5065[_0xb127('0x35')]['limit']);_0xb3821c[_0xb127('0x1e')]=qs[_0xb127('0x1e')](_0x2e5065[_0xb127('0x35')][_0xb127('0x1e')]);}_0xb3821c[_0xb127('0x3d')]=qs[_0xb127('0x3e')](_0x2e5065[_0xb127('0x35')]['sort']);_0xb3821c[_0xb127('0x3f')]=qs[_0xb127('0x40')](_[_0xb127('0x41')](_0x2e5065[_0xb127('0x35')],_0x55f52b['filters']),_0x5f23ac);if(_0x2e5065[_0xb127('0x35')]['filter']){_0xb3821c[_0xb127('0x3f')]=_[_0xb127('0x42')](_0xb3821c[_0xb127('0x3f')],{'$or':_['map'](_0x5f23ac,function(_0x21e3f4){if(_0x21e3f4[_0xb127('0x32')]!==_0xb127('0x43')){var _0x54db6a={};_0x54db6a[_0x21e3f4['name']]={'$like':'%'+_0x2e5065[_0xb127('0x35')]['filter']+'%'};return _0x54db6a;}})});}_0xb3821c=_[_0xb127('0x42')]({},_0xb3821c,_0x2e5065[_0xb127('0x44')]);var _0x101e8c={'where':_0xb3821c[_0xb127('0x3f')]};return db[_0xb127('0x2f')][_0xb127('0x1d')](_0x101e8c)[_0xb127('0x25')](function(_0x2b02ee){_0x270b49[_0xb127('0x1d')]=_0x2b02ee;if(_0x2e5065['query'][_0xb127('0x45')]){_0xb3821c[_0xb127('0x46')]=[{'all':!![]}];}return db['Pause'][_0xb127('0x47')](_0xb3821c);})[_0xb127('0x25')](function(_0x4b3ac7){_0x270b49[_0xb127('0x48')]=_0x4b3ac7;return _0x270b49;})[_0xb127('0x25')](respondWithFilteredResult(_0x61d5fd,_0xb3821c))[_0xb127('0x49')](handleError(_0x61d5fd,null));};exports[_0xb127('0x4a')]=function(_0xbf7214,_0x465102){var _0x2d90c3={'raw':!![],'where':{'id':_0xbf7214[_0xb127('0x4b')]['id']}},_0x42fdd0={};_0x42fdd0[_0xb127('0x34')]=_[_0xb127('0x36')](db[_0xb127('0x2f')]['rawAttributes']);_0x42fdd0[_0xb127('0x35')]=_[_0xb127('0x36')](_0xbf7214['query']);_0x42fdd0[_0xb127('0x40')]=_[_0xb127('0x37')](_0x42fdd0[_0xb127('0x34')],_0x42fdd0[_0xb127('0x35')]);_0x2d90c3[_0xb127('0x38')]=_[_0xb127('0x37')](_0x42fdd0[_0xb127('0x34')],qs[_0xb127('0x39')](_0xbf7214[_0xb127('0x35')][_0xb127('0x39')]));_0x2d90c3['attributes']=_0x2d90c3[_0xb127('0x38')]['length']?_0x2d90c3[_0xb127('0x38')]:_0x42fdd0['model'];if(_0xbf7214['query'][_0xb127('0x45')]){_0x2d90c3[_0xb127('0x46')]=[{'all':!![]}];}_0x2d90c3=_[_0xb127('0x42')]({},_0x2d90c3,_0xbf7214[_0xb127('0x44')]);return db[_0xb127('0x2f')][_0xb127('0x4c')](_0x2d90c3)[_0xb127('0x25')](handleEntityNotFound(_0x465102,null))[_0xb127('0x25')](respondWithResult(_0x465102,null))[_0xb127('0x49')](handleError(_0x465102,null));};exports[_0xb127('0x4d')]=function(_0xc53a09,_0x3e90ac){return db['Pause'][_0xb127('0x4d')](_0xc53a09['body'],{})[_0xb127('0x25')](function(_0x4ed3ce){var _0x228b94=_0xc53a09[_0xb127('0x4e')][_0xb127('0x27')]({'plain':!![]});if(!_0x228b94)throw new Error(_0xb127('0x4f'));if(_0x228b94[_0xb127('0x50')]==='user'){var _0x10b13d=_0x4ed3ce['get']({'plain':!![]});var _0x272971=_0xb127('0x28');return db['UserProfileSection'][_0xb127('0x4c')]({'where':{'name':_0x272971,'userProfileId':_0x228b94[_0xb127('0x51')]},'raw':!![]})[_0xb127('0x25')](function(_0x500486){if(_0x500486&&_0x500486[_0xb127('0x52')]===0x0){return db[_0xb127('0x29')][_0xb127('0x4d')]({'name':_0x10b13d[_0xb127('0x2b')],'resourceId':_0x10b13d['id'],'type':_0x500486[_0xb127('0x2b')],'sectionId':_0x500486['id']},{})[_0xb127('0x25')](function(){return _0x4ed3ce;});}else{return _0x4ed3ce;}})[_0xb127('0x49')](function(_0x12cf5e){logger['error'](_0xb127('0x53'),_0x12cf5e);throw _0x12cf5e;});}return _0x4ed3ce;})[_0xb127('0x25')](respondWithResult(_0x3e90ac,0xc9))[_0xb127('0x49')](handleError(_0x3e90ac,null));};exports[_0xb127('0x24')]=function(_0x433b0b,_0xda26db){if(_0x433b0b[_0xb127('0x54')]['id']){delete _0x433b0b['body']['id'];}return db[_0xb127('0x2f')][_0xb127('0x4c')]({'where':{'id':_0x433b0b['params']['id']}})['then'](handleEntityNotFound(_0xda26db,null))['then'](saveUpdates(_0x433b0b['body'],null))[_0xb127('0x25')](respondWithResult(_0xda26db,null))[_0xb127('0x49')](handleError(_0xda26db,null));};exports['destroy']=function(_0x3deb59,_0x426cc9){return db[_0xb127('0x2f')][_0xb127('0x4c')]({'where':{'id':_0x3deb59['params']['id']}})['then'](handleEntityNotFound(_0x426cc9,null))[_0xb127('0x25')](removeEntity(_0x426cc9,null))[_0xb127('0x49')](handleError(_0x426cc9,null));}; \ No newline at end of file +var _0x23cd=['nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','show','params','length','merge','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','error','update','body','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','then','destroy','get','Pauses','UserProfileResource','sendStatus','stack','name','index','map','Pause','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields'];(function(_0x49bedd,_0x291387){var _0x1f2535=function(_0x451450){while(--_0x451450){_0x49bedd['push'](_0x49bedd['shift']());}};_0x1f2535(++_0x291387);}(_0x23cd,0x160));var _0xd23c=function(_0x113cc2,_0x3d0e2a){_0x113cc2=_0x113cc2-0x0;var _0x55d73b=_0x23cd[_0x113cc2];return _0x55d73b;};'use strict';var emlformat=require(_0xd23c('0x0'));var rimraf=require(_0xd23c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd23c('0x2'));var rp=require(_0xd23c('0x3'));var moment=require(_0xd23c('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd23c('0x5'));var util=require(_0xd23c('0x6'));var path=require(_0xd23c('0x7'));var sox=require(_0xd23c('0x8'));var csv=require('to-csv');var ejs=require(_0xd23c('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd23c('0xa'));var squel=require(_0xd23c('0xb'));var crypto=require(_0xd23c('0xc'));var jsforce=require(_0xd23c('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd23c('0xe'));var Papa=require(_0xd23c('0xf'));var Redis=require('ioredis');var authService=require(_0xd23c('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xd23c('0x11'))(_0xd23c('0x12'));var utils=require(_0xd23c('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xd23c('0x14'));var db=require(_0xd23c('0x15'))['db'];function respondWithStatusCode(_0xbe87c5,_0x527861){_0x527861=_0x527861||0xcc;return function(_0x5e52ff){if(_0x5e52ff){return _0xbe87c5['sendStatus'](_0x527861);}return _0xbe87c5[_0xd23c('0x16')](_0x527861)[_0xd23c('0x17')]();};}function respondWithResult(_0x4e689b,_0x4f2dfd){_0x4f2dfd=_0x4f2dfd||0xc8;return function(_0x4c07d5){if(_0x4c07d5){return _0x4e689b[_0xd23c('0x16')](_0x4f2dfd)[_0xd23c('0x18')](_0x4c07d5);}};}function respondWithFilteredResult(_0x3e58ed,_0x3a721b){return function(_0x22ef83){if(_0x22ef83){var _0x3ee44e=typeof _0x3a721b[_0xd23c('0x19')]===_0xd23c('0x1a')&&typeof _0x3a721b[_0xd23c('0x1b')]===_0xd23c('0x1a');var _0x336a06=_0x22ef83[_0xd23c('0x1c')];var _0x438f77=_0x3ee44e?0x0:_0x3a721b[_0xd23c('0x19')];var _0x49276f=_0x3ee44e?_0x22ef83[_0xd23c('0x1c')]:_0x3a721b[_0xd23c('0x19')]+_0x3a721b[_0xd23c('0x1b')];var _0xb90f02;if(_0x49276f>=_0x336a06){_0x49276f=_0x336a06;_0xb90f02=0xc8;}else{_0xb90f02=0xce;}_0x3e58ed['status'](_0xb90f02);return _0x3e58ed['set'](_0xd23c('0x1d'),_0x438f77+'-'+_0x49276f+'/'+_0x336a06)[_0xd23c('0x18')](_0x22ef83);}return null;};}function patchUpdates(_0x4360f1){return function(_0x43cf7c){try{jsonpatch[_0xd23c('0x1e')](_0x43cf7c,_0x4360f1,!![]);}catch(_0x3fc25d){return BPromise['reject'](_0x3fc25d);}return _0x43cf7c[_0xd23c('0x1f')]();};}function saveUpdates(_0x5f1131,_0x3d2dd8){return function(_0xf4891c){if(_0xf4891c){return _0xf4891c['update'](_0x5f1131)[_0xd23c('0x20')](function(_0x3f10c2){return _0x3f10c2;});}return null;};}function removeEntity(_0x3319c5,_0x2eb271){return function(_0x432af9){if(_0x432af9){return _0x432af9[_0xd23c('0x21')]()[_0xd23c('0x20')](function(){var _0x2a217e=_0x432af9[_0xd23c('0x22')]({'plain':!![]});var _0x1c7053=_0xd23c('0x23');return db[_0xd23c('0x24')][_0xd23c('0x21')]({'where':{'type':_0x1c7053,'resourceId':_0x2a217e['id']}})[_0xd23c('0x20')](function(){return _0x432af9;});})[_0xd23c('0x20')](function(){_0x3319c5['status'](0xcc)[_0xd23c('0x17')]();});}};}function handleEntityNotFound(_0x453cae,_0x49e002){return function(_0x5b51f0){if(!_0x5b51f0){_0x453cae[_0xd23c('0x25')](0x194);}return _0x5b51f0;};}function handleError(_0x19be62,_0x596258){_0x596258=_0x596258||0x1f4;return function(_0x28831a){logger['error'](_0x28831a[_0xd23c('0x26')]);if(_0x28831a[_0xd23c('0x27')]){delete _0x28831a[_0xd23c('0x27')];}_0x19be62[_0xd23c('0x16')](_0x596258)['send'](_0x28831a);};}exports[_0xd23c('0x28')]=function(_0x2c8ed0,_0x2e05fa){var _0x910197={},_0x57943f={},_0x48a9a1={'count':0x0,'rows':[]};var _0xe7f13c=_[_0xd23c('0x29')](db[_0xd23c('0x2a')][_0xd23c('0x2b')],function(_0x331d04){return{'name':_0x331d04[_0xd23c('0x2c')],'type':_0x331d04['type'][_0xd23c('0x2d')]};});_0x57943f['model']=_[_0xd23c('0x29')](_0xe7f13c,_0xd23c('0x27'));_0x57943f[_0xd23c('0x2e')]=_[_0xd23c('0x2f')](_0x2c8ed0[_0xd23c('0x2e')]);_0x57943f[_0xd23c('0x30')]=_[_0xd23c('0x31')](_0x57943f[_0xd23c('0x32')],_0x57943f[_0xd23c('0x2e')]);_0x910197[_0xd23c('0x33')]=_[_0xd23c('0x31')](_0x57943f[_0xd23c('0x32')],qs[_0xd23c('0x34')](_0x2c8ed0[_0xd23c('0x2e')][_0xd23c('0x34')]));_0x910197[_0xd23c('0x33')]=_0x910197['attributes']['length']?_0x910197['attributes']:_0x57943f[_0xd23c('0x32')];if(!_0x2c8ed0['query']['hasOwnProperty'](_0xd23c('0x35'))){_0x910197[_0xd23c('0x1b')]=qs['limit'](_0x2c8ed0[_0xd23c('0x2e')][_0xd23c('0x1b')]);_0x910197[_0xd23c('0x19')]=qs[_0xd23c('0x19')](_0x2c8ed0[_0xd23c('0x2e')][_0xd23c('0x19')]);}_0x910197[_0xd23c('0x36')]=qs[_0xd23c('0x37')](_0x2c8ed0['query'][_0xd23c('0x37')]);_0x910197[_0xd23c('0x38')]=qs['filters'](_[_0xd23c('0x39')](_0x2c8ed0[_0xd23c('0x2e')],_0x57943f[_0xd23c('0x30')]),_0xe7f13c);if(_0x2c8ed0[_0xd23c('0x2e')][_0xd23c('0x3a')]){_0x910197[_0xd23c('0x38')]=_['merge'](_0x910197['where'],{'$or':_['map'](_0xe7f13c,function(_0x241d03){if(_0x241d03['type']!==_0xd23c('0x3b')){var _0x4498b4={};_0x4498b4[_0x241d03['name']]={'$like':'%'+_0x2c8ed0[_0xd23c('0x2e')]['filter']+'%'};return _0x4498b4;}})});}_0x910197=_['merge']({},_0x910197,_0x2c8ed0[_0xd23c('0x3c')]);var _0x51c3c5={'where':_0x910197[_0xd23c('0x38')]};return db[_0xd23c('0x2a')][_0xd23c('0x1c')](_0x51c3c5)['then'](function(_0x352df6){_0x48a9a1[_0xd23c('0x1c')]=_0x352df6;if(_0x2c8ed0[_0xd23c('0x2e')][_0xd23c('0x3d')]){_0x910197[_0xd23c('0x3e')]=[{'all':!![]}];}return db[_0xd23c('0x2a')][_0xd23c('0x3f')](_0x910197);})[_0xd23c('0x20')](function(_0x207603){_0x48a9a1[_0xd23c('0x40')]=_0x207603;return _0x48a9a1;})['then'](respondWithFilteredResult(_0x2e05fa,_0x910197))['catch'](handleError(_0x2e05fa,null));};exports[_0xd23c('0x41')]=function(_0x11f72a,_0x2a92c1){var _0x508b62={'raw':!![],'where':{'id':_0x11f72a[_0xd23c('0x42')]['id']}},_0x3669b2={};_0x3669b2[_0xd23c('0x32')]=_[_0xd23c('0x2f')](db['Pause'][_0xd23c('0x2b')]);_0x3669b2[_0xd23c('0x2e')]=_[_0xd23c('0x2f')](_0x11f72a[_0xd23c('0x2e')]);_0x3669b2[_0xd23c('0x30')]=_[_0xd23c('0x31')](_0x3669b2[_0xd23c('0x32')],_0x3669b2[_0xd23c('0x2e')]);_0x508b62[_0xd23c('0x33')]=_[_0xd23c('0x31')](_0x3669b2[_0xd23c('0x32')],qs[_0xd23c('0x34')](_0x11f72a[_0xd23c('0x2e')][_0xd23c('0x34')]));_0x508b62[_0xd23c('0x33')]=_0x508b62[_0xd23c('0x33')][_0xd23c('0x43')]?_0x508b62[_0xd23c('0x33')]:_0x3669b2[_0xd23c('0x32')];if(_0x11f72a[_0xd23c('0x2e')]['includeAll']){_0x508b62[_0xd23c('0x3e')]=[{'all':!![]}];}_0x508b62=_[_0xd23c('0x44')]({},_0x508b62,_0x11f72a[_0xd23c('0x3c')]);return db[_0xd23c('0x2a')]['find'](_0x508b62)['then'](handleEntityNotFound(_0x2a92c1,null))[_0xd23c('0x20')](respondWithResult(_0x2a92c1,null))[_0xd23c('0x45')](handleError(_0x2a92c1,null));};exports[_0xd23c('0x46')]=function(_0xf3443a,_0x407a3c){return db['Pause'][_0xd23c('0x46')](_0xf3443a['body'],{})[_0xd23c('0x20')](function(_0x5bbcae){var _0x33e515=_0xf3443a[_0xd23c('0x47')][_0xd23c('0x22')]({'plain':!![]});if(!_0x33e515)throw new Error(_0xd23c('0x48'));if(_0x33e515[_0xd23c('0x49')]===_0xd23c('0x47')){var _0x3b1a71=_0x5bbcae[_0xd23c('0x22')]({'plain':!![]});var _0x1a830e=_0xd23c('0x23');return db[_0xd23c('0x4a')][_0xd23c('0x4b')]({'where':{'name':_0x1a830e,'userProfileId':_0x33e515[_0xd23c('0x4c')]},'raw':!![]})['then'](function(_0x4d4ebb){if(_0x4d4ebb&&_0x4d4ebb[_0xd23c('0x4d')]===0x0){return db[_0xd23c('0x24')][_0xd23c('0x46')]({'name':_0x3b1a71[_0xd23c('0x27')],'resourceId':_0x3b1a71['id'],'type':_0x4d4ebb['name'],'sectionId':_0x4d4ebb['id']},{})[_0xd23c('0x20')](function(){return _0x5bbcae;});}else{return _0x5bbcae;}})[_0xd23c('0x45')](function(_0x31ad55){logger[_0xd23c('0x4e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x31ad55);throw _0x31ad55;});}return _0x5bbcae;})[_0xd23c('0x20')](respondWithResult(_0x407a3c,0xc9))[_0xd23c('0x45')](handleError(_0x407a3c,null));};exports[_0xd23c('0x4f')]=function(_0x49d189,_0x1fabd7){if(_0x49d189[_0xd23c('0x50')]['id']){delete _0x49d189[_0xd23c('0x50')]['id'];}return db['Pause'][_0xd23c('0x4b')]({'where':{'id':_0x49d189[_0xd23c('0x42')]['id']}})[_0xd23c('0x20')](handleEntityNotFound(_0x1fabd7,null))[_0xd23c('0x20')](saveUpdates(_0x49d189[_0xd23c('0x50')],null))[_0xd23c('0x20')](respondWithResult(_0x1fabd7,null))[_0xd23c('0x45')](handleError(_0x1fabd7,null));};exports['destroy']=function(_0x1fdfdd,_0x1793c3){return db[_0xd23c('0x2a')][_0xd23c('0x4b')]({'where':{'id':_0x1fdfdd[_0xd23c('0x42')]['id']}})[_0xd23c('0x20')](handleEntityNotFound(_0x1793c3,null))[_0xd23c('0x20')](removeEntity(_0x1793c3,null))[_0xd23c('0x45')](handleError(_0x1793c3,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index ac19a97..ba72df3 100644 --- a/server/api/pause/pause.model.js +++ b/server/api/pause/pause.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8ef6=['exports','define','Pause','tools_pauses','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./pause.attributes'];(function(_0x510b98,_0x4c4cbb){var _0x45e775=function(_0x29ec11){while(--_0x29ec11){_0x510b98['push'](_0x510b98['shift']());}};_0x45e775(++_0x4c4cbb);}(_0x8ef6,0xf2));var _0x68ef=function(_0x483540,_0x528036){_0x483540=_0x483540-0x0;var _0x2c8ea3=_0x8ef6[_0x483540];return _0x2c8ea3;};'use strict';var _=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var logger=require(_0x68ef('0x2'))(_0x68ef('0x3'));var moment=require(_0x68ef('0x4'));var BPromise=require(_0x68ef('0x5'));var rp=require(_0x68ef('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x68ef('0x7'));var config=require(_0x68ef('0x8'));var attributes=require(_0x68ef('0x9'));module[_0x68ef('0xa')]=function(_0x4d26e3,_0x4f77f3){return _0x4d26e3[_0x68ef('0xb')](_0x68ef('0xc'),attributes,{'tableName':_0x68ef('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x53ec=['bluebird','path','../../config/environment','./pause.attributes','define','Pause','lodash','util','../../config/logger','api','moment'];(function(_0x26e40e,_0x37b9a4){var _0x5b3b0f=function(_0x1c5258){while(--_0x1c5258){_0x26e40e['push'](_0x26e40e['shift']());}};_0x5b3b0f(++_0x37b9a4);}(_0x53ec,0x192));var _0xc53e=function(_0x426dd2,_0x4b0012){_0x426dd2=_0x426dd2-0x0;var _0x4bc76c=_0x53ec[_0x426dd2];return _0x4bc76c;};'use strict';var _=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var logger=require(_0xc53e('0x2'))(_0xc53e('0x3'));var moment=require(_0xc53e('0x4'));var BPromise=require(_0xc53e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc53e('0x6'));var rimraf=require('rimraf');var config=require(_0xc53e('0x7'));var attributes=require(_0xc53e('0x8'));module['exports']=function(_0x2f1414,_0x4f989b){return _0x2f1414[_0xc53e('0x9')](_0xc53e('0xa'),attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index 63bea16..e2aff13 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(_0x4ea78f,_0x1a2fcf){var _0x3ad3c4=function(_0x2c7f01){while(--_0x2c7f01){_0x4ea78f['push'](_0x4ea78f['shift']());}};_0x3ad3c4(++_0x1a2fcf);}(_0xb10b,0x12a));var _0xbb10=function(_0x45c569,_0x255cd0){_0x45c569=_0x45c569-0x0;var _0x1cc195=_0xb10b[_0x45c569];return _0x1cc195;};'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 _0x7a54=['message','request\x20sent','result','catch','Pause','find','options','raw','where','attributes','map','include','model','ShowPause','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Pause,\x20%s,\x20%s','debug','stringify','error','code'];(function(_0x173465,_0x8d6e68){var _0x1434be=function(_0x21a50a){while(--_0x21a50a){_0x173465['push'](_0x173465['shift']());}};_0x1434be(++_0x8d6e68);}(_0x7a54,0x106));var _0x47a5=function(_0x4e44c7,_0x10d378){_0x4e44c7=_0x4e44c7-0x0;var _0x107fb4=_0x7a54[_0x4e44c7];return _0x107fb4;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Pause,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['ShowPause']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')]({'raw':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')][_0x47a5('0x18')]===undefined?!![]:![]:!![],'where':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x19')]||null:null,'attributes':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x1a')]||null:null,'include':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')]['include']?_[_0x47a5('0x1b')](_0x5247fd[_0x47a5('0x17')][_0x47a5('0x1c')],function(_0x7a9f9e){return{'model':db[_0x7a9f9e['model']],'as':_0x7a9f9e['as'],'attributes':_0x7a9f9e[_0x47a5('0x1a')],'include':_0x7a9f9e[_0x47a5('0x1c')]?_['map'](_0x7a9f9e[_0x47a5('0x1c')],function(_0xc4cd63){return{'model':db[_0xc4cd63[_0x47a5('0x1d')]],'as':_0xc4cd63['as'],'attributes':_0xc4cd63[_0x47a5('0x1a')],'include':_0xc4cd63[_0x47a5('0x1c')]?_['map'](_0xc4cd63['include'],function(_0x136745){return{'model':db[_0x136745['model']],'as':_0x136745['as'],'attributes':_0x136745[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23cb77){logger[_0x47a5('0xb')](_0x47a5('0x1e'),_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1e'),_0x5247fd,JSON[_0x47a5('0xe')](_0x23cb77));_0xaf70a6(_0x23cb77);})[_0x47a5('0x14')](function(_0x136b14){logger[_0x47a5('0xf')](_0x47a5('0x1e'),_0x136b14[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81[_0x47a5('0xf')](0x1f4,_0x136b14[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index d61a408..45c9e94 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 _0xaba6=['get','webhookGet','isAuthenticated','show','/:id/download','download','diskStorage','root','server/files/plugins','originalname','format','%s-%s%s','basename','extname','now','post','single','file','upload','/webhook','put','/:id','delete','multer','util','fs-extra','../../components/auth/service','../../config/environment','./plugin.controller'];(function(_0x12ba59,_0x139b9d){var _0x147a9c=function(_0xf1804a){while(--_0xf1804a){_0x12ba59['push'](_0x12ba59['shift']());}};_0x147a9c(++_0x139b9d);}(_0xaba6,0xe2));var _0x6aba=function(_0x577169,_0x42e882){_0x577169=_0x577169-0x0;var _0x41e5fb=_0xaba6[_0x577169];return _0x41e5fb;};'use strict';var multer=require(_0x6aba('0x0'));var util=require(_0x6aba('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x6aba('0x2'));var auth=require(_0x6aba('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x6aba('0x4'));var controller=require(_0x6aba('0x5'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x6aba('0x6')]('/webhook',controller[_0x6aba('0x7')]);router[_0x6aba('0x6')]('/:id',auth[_0x6aba('0x8')](),controller[_0x6aba('0x9')]);router['get'](_0x6aba('0xa'),auth[_0x6aba('0x8')](),controller[_0x6aba('0xb')]);var upload=multer({'storage':multer[_0x6aba('0xc')]({'destination':function(_0xdbc119,_0x4089c6,_0x181426){_0x181426(null,path['join'](config[_0x6aba('0xd')],_0x6aba('0xe')));},'filename':function(_0x43867b,_0x254007,_0x53e604){_0x254007[_0x6aba('0xf')]=_0x254007[_0x6aba('0xf')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x53e604(null,util[_0x6aba('0x10')](_0x6aba('0x11'),path[_0x6aba('0x12')](_0x254007['originalname'],path[_0x6aba('0x13')](_0x254007[_0x6aba('0xf')])),Date[_0x6aba('0x14')](),path['extname'](_0x254007[_0x6aba('0xf')])));}})});router[_0x6aba('0x15')]('/',upload[_0x6aba('0x16')](_0x6aba('0x17')),controller[_0x6aba('0x18')]);router[_0x6aba('0x15')](_0x6aba('0x19'),controller['webhookPost']);router[_0x6aba('0x1a')](_0x6aba('0x1b'),auth[_0x6aba('0x8')](),controller['update']);router[_0x6aba('0x1c')]('/:id',auth['isAuthenticated'](),controller[_0x6aba('0x1c')]);module['exports']=router; \ No newline at end of file +var _0x2123=['join','root','server/files/plugins','originalname','replace','format','%s-%s%s','basename','extname','now','single','file','upload','post','webhookPost','put','update','/:id','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','get','index','/webhook','isAuthenticated','show','/:id/download','diskStorage'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x2123,0x190));var _0x3212=function(_0x4b4d06,_0x4666f4){_0x4b4d06=_0x4b4d06-0x0;var _0x5c541a=_0x2123[_0x4b4d06];return _0x5c541a;};'use strict';var multer=require(_0x3212('0x0'));var util=require(_0x3212('0x1'));var path=require(_0x3212('0x2'));var timeout=require(_0x3212('0x3'));var express=require(_0x3212('0x4'));var router=express[_0x3212('0x5')]();var fs_extra=require(_0x3212('0x6'));var auth=require(_0x3212('0x7'));var interaction=require(_0x3212('0x8'));var config=require(_0x3212('0x9'));var controller=require(_0x3212('0xa'));router[_0x3212('0xb')]('/',auth['isAuthenticated'](),controller[_0x3212('0xc')]);router[_0x3212('0xb')](_0x3212('0xd'),controller['webhookGet']);router[_0x3212('0xb')]('/:id',auth[_0x3212('0xe')](),controller[_0x3212('0xf')]);router[_0x3212('0xb')](_0x3212('0x10'),auth['isAuthenticated'](),controller['download']);var upload=multer({'storage':multer[_0x3212('0x11')]({'destination':function(_0xf166c2,_0x1a3b2f,_0x23f7e3){_0x23f7e3(null,path[_0x3212('0x12')](config[_0x3212('0x13')],_0x3212('0x14')));},'filename':function(_0x359cef,_0x26c1c8,_0x2d5fce){_0x26c1c8[_0x3212('0x15')]=_0x26c1c8[_0x3212('0x15')][_0x3212('0x16')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x2d5fce(null,util[_0x3212('0x17')](_0x3212('0x18'),path[_0x3212('0x19')](_0x26c1c8[_0x3212('0x15')],path[_0x3212('0x1a')](_0x26c1c8[_0x3212('0x15')])),Date[_0x3212('0x1b')](),path[_0x3212('0x1a')](_0x26c1c8[_0x3212('0x15')])));}})});router['post']('/',upload[_0x3212('0x1c')](_0x3212('0x1d')),controller[_0x3212('0x1e')]);router[_0x3212('0x1f')](_0x3212('0xd'),controller[_0x3212('0x20')]);router[_0x3212('0x21')]('/:id',auth['isAuthenticated'](),controller[_0x3212('0x22')]);router['delete'](_0x3212('0x23'),auth[_0x3212('0xe')](),controller[_0x3212('0x24')]);module[_0x3212('0x25')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index f9a1a4e..db98f5c 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 _0xc2df=['always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','STRING','html','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','ENUM','adminOnly','agentOnly'];(function(_0x5d91aa,_0x2e1ffd){var _0x4f54a2=function(_0x2353e9){while(--_0x2353e9){_0x5d91aa['push'](_0x5d91aa['shift']());}};_0x4f54a2(++_0x2e1ffd);}(_0xc2df,0x152));var _0xfc2d=function(_0xc48a3c,_0x2591d6){_0xc48a3c=_0xc48a3c-0x0;var _0x495703=_0xc2df[_0xc48a3c];return _0x495703;};'use strict';var Sequelize=require(_0xfc2d('0x0'));module[_0xfc2d('0x1')]={'name':{'type':Sequelize[_0xfc2d('0x2')]},'type':{'type':Sequelize['ENUM'](_0xfc2d('0x3'),_0xfc2d('0x4'))},'description':{'type':Sequelize[_0xfc2d('0x5')]},'version':{'type':Sequelize[_0xfc2d('0x5')]},'path':{'type':Sequelize[_0xfc2d('0x2')],'comment':_0xfc2d('0x6')},'active':{'type':Sequelize[_0xfc2d('0x7')],'defaultValue':0x0,'comment':_0xfc2d('0x8')},'sidebar':{'type':Sequelize[_0xfc2d('0x9')](_0xfc2d('0xa'),_0xfc2d('0xb'),'always','never'),'defaultValue':_0xfc2d('0xc'),'comment':_0xfc2d('0xd')},'icon':{'type':Sequelize[_0xfc2d('0x2')]},'adminUrl':{'type':Sequelize[_0xfc2d('0x2')]},'agentUrl':{'type':Sequelize[_0xfc2d('0x2')]},'scriptName':{'type':Sequelize[_0xfc2d('0x2')]},'scriptPath':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xaca1=['ENUM','html','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','STRING'];(function(_0x599f13,_0x1c0140){var _0x1ebd6a=function(_0x598f23){while(--_0x598f23){_0x599f13['push'](_0x599f13['shift']());}};_0x1ebd6a(++_0x1c0140);}(_0xaca1,0x13f));var _0x1aca=function(_0xfc11f4,_0x169022){_0xfc11f4=_0xfc11f4-0x0;var _0xa2082b=_0xaca1[_0xfc11f4];return _0xa2082b;};'use strict';var Sequelize=require(_0x1aca('0x0'));module[_0x1aca('0x1')]={'name':{'type':Sequelize[_0x1aca('0x2')]},'type':{'type':Sequelize[_0x1aca('0x3')](_0x1aca('0x4'),_0x1aca('0x5'))},'description':{'type':Sequelize[_0x1aca('0x6')]},'version':{'type':Sequelize[_0x1aca('0x6')]},'path':{'type':Sequelize[_0x1aca('0x2')],'comment':_0x1aca('0x7')},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x1aca('0x8')},'sidebar':{'type':Sequelize[_0x1aca('0x3')](_0x1aca('0x9'),_0x1aca('0xa'),_0x1aca('0xb'),_0x1aca('0xc')),'defaultValue':_0x1aca('0xb'),'comment':_0x1aca('0xd')},'icon':{'type':Sequelize[_0x1aca('0x2')]},'adminUrl':{'type':Sequelize[_0x1aca('0x2')]},'agentUrl':{'type':Sequelize[_0x1aca('0x2')]},'scriptName':{'type':Sequelize[_0x1aca('0x2')]},'scriptPath':{'type':Sequelize[_0x1aca('0x2')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index d7e7578..e60064d 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 _0x26a0=['offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','get','Plugins','UserProfileResource','error','stack','name','index','fieldName','type','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','map','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','keys','Plugin','rawAttributes','find','download','params','path','server/files/plugins','basename','createWriteStream','zip','warning','code','ENOENT','Sequelize','Error','pipe','glob','**/*','join','root','dirname','node_modules/**/*','attachments/**/*','finalize','close','Plugin\x20not\x20found','format','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','file','extname','filename','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','Invalid\x20plugin\x20structure','isDirectory','readdirSync','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','Invalid\x20manifest:\x20name\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','views','Invalid\x20manifest:\x20views\x20missing','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','description','sidebar','always','icon','html','admin','test','plugins','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','send','Zip\x20archive\x20removed','webhookGet','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','headers','content-length','content-type','endsWith','statusCode','webhookPost','resolve','encoding','%s%s','fast-json-patch','request-promise','moment','bluebird','util','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','extract-zip','rimraf','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./plugin.socket','sendStatus','status','end','json'];(function(_0x565836,_0xd9d455){var _0x5eb222=function(_0xc8d4d3){while(--_0xc8d4d3){_0x565836['push'](_0x565836['shift']());}};_0x5eb222(++_0xd9d455);}(_0x26a0,0x12d));var _0x026a=function(_0x175255,_0x35b47f){_0x175255=_0x175255-0x0;var _0x1b14d1=_0x26a0[_0x175255];return _0x1b14d1;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x026a('0x0'));var rp=require(_0x026a('0x1'));var moment=require(_0x026a('0x2'));var BPromise=require(_0x026a('0x3'));var Mustache=require('mustache');var util=require(_0x026a('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0x026a('0x5'));var ejs=require(_0x026a('0x6'));var fs=require('fs');var fs_extra=require(_0x026a('0x7'));var _=require(_0x026a('0x8'));var squel=require(_0x026a('0x9'));var crypto=require('crypto');var jsforce=require(_0x026a('0xa'));var deskjs=require(_0x026a('0xb'));var toCsv=require(_0x026a('0x5'));var querystring=require('querystring');var Papa=require(_0x026a('0xc'));var extract=require(_0x026a('0xd'));var rimraf=require(_0x026a('0xe'));var archiver=require(_0x026a('0xf'));var Redis=require(_0x026a('0x10'));var authService=require(_0x026a('0x11'));var qs=require(_0x026a('0x12'));var as=require(_0x026a('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x026a('0x14'))(_0x026a('0x15'));var utils=require(_0x026a('0x16'));var config=require(_0x026a('0x17'));var licenseUtil=require(_0x026a('0x18'));var db=require(_0x026a('0x19'))['db'];config[_0x026a('0x1a')]=_['defaults'](config[_0x026a('0x1a')],{'host':_0x026a('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x026a('0x1a')]));require(_0x026a('0x1c'))['register'](socket);function respondWithStatusCode(_0x21f7dd,_0x45824f){_0x45824f=_0x45824f||0xcc;return function(_0x4b2fa3){if(_0x4b2fa3){return _0x21f7dd[_0x026a('0x1d')](_0x45824f);}return _0x21f7dd[_0x026a('0x1e')](_0x45824f)[_0x026a('0x1f')]();};}function respondWithResult(_0x2c7c6c,_0x1a267a){_0x1a267a=_0x1a267a||0xc8;return function(_0x69359e){if(_0x69359e){return _0x2c7c6c['status'](_0x1a267a)[_0x026a('0x20')](_0x69359e);}};}function respondWithFilteredResult(_0x455f2b,_0x280909){return function(_0x93bc7e){if(_0x93bc7e){var _0x149a44=typeof _0x280909[_0x026a('0x21')]===_0x026a('0x22')&&typeof _0x280909[_0x026a('0x23')]===_0x026a('0x22');var _0x1557f9=_0x93bc7e[_0x026a('0x24')];var _0x2d7c95=_0x149a44?0x0:_0x280909[_0x026a('0x21')];var _0x40a897=_0x149a44?_0x93bc7e['count']:_0x280909[_0x026a('0x21')]+_0x280909[_0x026a('0x23')];var _0x157f67;if(_0x40a897>=_0x1557f9){_0x40a897=_0x1557f9;_0x157f67=0xc8;}else{_0x157f67=0xce;}_0x455f2b[_0x026a('0x1e')](_0x157f67);return _0x455f2b[_0x026a('0x25')](_0x026a('0x26'),_0x2d7c95+'-'+_0x40a897+'/'+_0x1557f9)[_0x026a('0x20')](_0x93bc7e);}return null;};}function patchUpdates(_0x39c81e){return function(_0x3fcd42){try{jsonpatch['apply'](_0x3fcd42,_0x39c81e,!![]);}catch(_0x147e45){return BPromise[_0x026a('0x27')](_0x147e45);}return _0x3fcd42['save']();};}function saveUpdates(_0x1201c2,_0x1e1fc5){return function(_0x5b93f5){if(_0x5b93f5){return _0x5b93f5[_0x026a('0x28')](_0x1201c2)[_0x026a('0x29')](function(_0x5c6d1f){return _0x5c6d1f;});}return null;};}function removeEntity(_0x28fe89,_0x56b0c2){return function(_0x442692){if(_0x442692){return _0x442692[_0x026a('0x2a')]()[_0x026a('0x29')](function(){var _0x38decc=_0x442692[_0x026a('0x2b')]({'plain':!![]});var _0x16d89c=_0x026a('0x2c');return db[_0x026a('0x2d')]['destroy']({'where':{'type':_0x16d89c,'resourceId':_0x38decc['id']}})[_0x026a('0x29')](function(){return _0x442692;});})['then'](function(){_0x28fe89[_0x026a('0x1e')](0xcc)[_0x026a('0x1f')]();});}};}function handleEntityNotFound(_0x4f4907,_0x1a90e7){return function(_0xe2c43a){if(!_0xe2c43a){_0x4f4907[_0x026a('0x1d')](0x194);}return _0xe2c43a;};}function handleError(_0x2df6b8,_0x44fe4d){_0x44fe4d=_0x44fe4d||0x1f4;return function(_0xbce60){logger[_0x026a('0x2e')](_0xbce60[_0x026a('0x2f')]);if(_0xbce60['name']){delete _0xbce60[_0x026a('0x30')];}_0x2df6b8[_0x026a('0x1e')](_0x44fe4d)['send'](_0xbce60);};}exports[_0x026a('0x31')]=function(_0x5c57be,_0x644f8b){var _0x433f29={},_0xb5a421={},_0x3f3f4f={'count':0x0,'rows':[]};var _0x3603dd=_['map'](db['Plugin']['rawAttributes'],function(_0x421992){return{'name':_0x421992[_0x026a('0x32')],'type':_0x421992[_0x026a('0x33')]['key']};});_0xb5a421[_0x026a('0x34')]=_['map'](_0x3603dd,_0x026a('0x30'));_0xb5a421[_0x026a('0x35')]=_['keys'](_0x5c57be['query']);_0xb5a421['filters']=_['intersection'](_0xb5a421[_0x026a('0x34')],_0xb5a421[_0x026a('0x35')]);_0x433f29['attributes']=_[_0x026a('0x36')](_0xb5a421['model'],qs[_0x026a('0x37')](_0x5c57be[_0x026a('0x35')]['fields']));_0x433f29[_0x026a('0x38')]=_0x433f29['attributes'][_0x026a('0x39')]?_0x433f29[_0x026a('0x38')]:_0xb5a421[_0x026a('0x34')];if(!_0x5c57be[_0x026a('0x35')][_0x026a('0x3a')](_0x026a('0x3b'))){_0x433f29['limit']=qs[_0x026a('0x23')](_0x5c57be[_0x026a('0x35')][_0x026a('0x23')]);_0x433f29[_0x026a('0x21')]=qs['offset'](_0x5c57be['query'][_0x026a('0x21')]);}_0x433f29[_0x026a('0x3c')]=qs[_0x026a('0x3d')](_0x5c57be[_0x026a('0x35')]['sort']);_0x433f29[_0x026a('0x3e')]=qs[_0x026a('0x3f')](_[_0x026a('0x40')](_0x5c57be['query'],_0xb5a421[_0x026a('0x3f')]),_0x3603dd);if(_0x5c57be[_0x026a('0x35')]['filter']){_0x433f29['where']=_[_0x026a('0x41')](_0x433f29['where'],{'$or':_[_0x026a('0x42')](_0x3603dd,function(_0x427b6a){if(_0x427b6a['type']!==_0x026a('0x43')){var _0x300636={};_0x300636[_0x427b6a[_0x026a('0x30')]]={'$like':'%'+_0x5c57be[_0x026a('0x35')][_0x026a('0x44')]+'%'};return _0x300636;}})});}_0x433f29=_[_0x026a('0x41')]({},_0x433f29,_0x5c57be[_0x026a('0x45')]);var _0x58a46c={'where':_0x433f29['where']};return db['Plugin']['count'](_0x58a46c)[_0x026a('0x29')](function(_0x19a5b9){_0x3f3f4f[_0x026a('0x24')]=_0x19a5b9;if(_0x5c57be[_0x026a('0x35')][_0x026a('0x46')]){_0x433f29[_0x026a('0x47')]=[{'all':!![]}];}return db['Plugin'][_0x026a('0x48')](_0x433f29);})[_0x026a('0x29')](function(_0x42360d){_0x3f3f4f[_0x026a('0x49')]=_0x42360d;return _0x3f3f4f;})[_0x026a('0x29')](respondWithFilteredResult(_0x644f8b,_0x433f29))[_0x026a('0x4a')](handleError(_0x644f8b,null));};exports['show']=function(_0x43806a,_0x38a377){var _0x1ee615={'raw':!![],'where':{'id':_0x43806a['params']['id']}},_0xb0ee2c={};_0xb0ee2c[_0x026a('0x34')]=_[_0x026a('0x4b')](db[_0x026a('0x4c')][_0x026a('0x4d')]);_0xb0ee2c[_0x026a('0x35')]=_[_0x026a('0x4b')](_0x43806a[_0x026a('0x35')]);_0xb0ee2c[_0x026a('0x3f')]=_['intersection'](_0xb0ee2c[_0x026a('0x34')],_0xb0ee2c[_0x026a('0x35')]);_0x1ee615[_0x026a('0x38')]=_[_0x026a('0x36')](_0xb0ee2c[_0x026a('0x34')],qs[_0x026a('0x37')](_0x43806a[_0x026a('0x35')]['fields']));_0x1ee615['attributes']=_0x1ee615['attributes'][_0x026a('0x39')]?_0x1ee615[_0x026a('0x38')]:_0xb0ee2c[_0x026a('0x34')];if(_0x43806a[_0x026a('0x35')][_0x026a('0x46')]){_0x1ee615['include']=[{'all':!![]}];}_0x1ee615=_['merge']({},_0x1ee615,_0x43806a[_0x026a('0x45')]);return db[_0x026a('0x4c')][_0x026a('0x4e')](_0x1ee615)[_0x026a('0x29')](handleEntityNotFound(_0x38a377,null))[_0x026a('0x29')](respondWithResult(_0x38a377,null))[_0x026a('0x4a')](handleError(_0x38a377,null));};exports[_0x026a('0x4f')]=function(_0x3d9241,_0x4f4f6f,_0x341920){return db[_0x026a('0x4c')]['find']({'where':{'id':_0x3d9241[_0x026a('0x50')]['id']},'attributes':[_0x026a('0x30'),_0x026a('0x51')],'raw':!![]})[_0x026a('0x29')](handleEntityNotFound(_0x4f4f6f,null))[_0x026a('0x29')](function(_0x1678bb){if(_0x1678bb){var _0x3f4bc4=path['join'](config['root'],_0x026a('0x52'),util['format']('%s.zip',path[_0x026a('0x53')](_0x1678bb[_0x026a('0x51')])));var _0x35f0ae=fs[_0x026a('0x54')](_0x3f4bc4);var _0xcdaa85=archiver(_0x026a('0x55'),{'zlib':{'level':0x9}});_0xcdaa85['on'](_0x026a('0x56'),function(_0x2d0724){if(_0x2d0724[_0x026a('0x57')]===_0x026a('0x58')){logger[_0x026a('0x2e')](_0x2d0724);}else{throw new db[(_0x026a('0x59'))][(_0x026a('0x5a'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');}});_0xcdaa85['on']('error',function(_0x475d39){throw new db['Sequelize'][(_0x026a('0x5a'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');});_0xcdaa85[_0x026a('0x5b')](_0x35f0ae);_0xcdaa85[_0x026a('0x5c')](_0x026a('0x5d'),{'cwd':path[_0x026a('0x5e')](config[_0x026a('0x5f')],_0x026a('0x52'),path[_0x026a('0x60')](_0x1678bb[_0x026a('0x51')])),'ignore':[path[_0x026a('0x5e')](path[_0x026a('0x53')](_0x1678bb[_0x026a('0x51')]),_0x026a('0x61')),path[_0x026a('0x5e')](path[_0x026a('0x53')](_0x1678bb[_0x026a('0x51')]),_0x026a('0x62'))],'nodir':!![]})[_0x026a('0x63')]();_0x35f0ae['on'](_0x026a('0x64'),function(){if(!fs['existsSync'](_0x3f4bc4)){throw new db[(_0x026a('0x59'))]['Error'](_0x026a('0x65'));}return _0x4f4f6f[_0x026a('0x4f')](_0x3f4bc4,util[_0x026a('0x66')]('%s.zip',path['basename'](_0x1678bb[_0x026a('0x51')])),function(_0x372fed){if(_0x372fed){throw new db[(_0x026a('0x59'))][(_0x026a('0x5a'))]('Error\x20while\x20downloading\x20the\x20plugin');}fs[_0x026a('0x67')](_0x3f4bc4);logger[_0x026a('0x68')](_0x026a('0x69'));logger[_0x026a('0x68')](_0x026a('0x6a'));});});}return null;})[_0x026a('0x4a')](handleError(_0x4f4f6f,null));};exports['upload']=function(_0xf825dc,_0x307292,_0x53e8f3){var _0x40b608=path[_0x026a('0x53')](_0xf825dc[_0x026a('0x6b')]['filename'],path[_0x026a('0x6c')](_0xf825dc[_0x026a('0x6b')][_0x026a('0x6d')]));var _0x550070=path[_0x026a('0x5e')](config[_0x026a('0x5f')],_0x026a('0x52'),_0xf825dc[_0x026a('0x6b')]['filename']);var _0x49c6bd=path[_0x026a('0x5e')](config[_0x026a('0x5f')],_0x026a('0x52'),_0x40b608);logger[_0x026a('0x68')](_0x026a('0x6e'),_0x550070);logger['info'](_0x026a('0x6f'),_0x49c6bd);try{fs['chmodSync'](_0x550070,parseInt('0777',0x8));extract(_0x550070,{'dir':_0x49c6bd},function(_0x240e57){if(_0x240e57){logger[_0x026a('0x2e')](_0x240e57);handleError(_0x240e57,!![]);};var _0x3f6177=fs['readdirSync'](_0x49c6bd);if(_0x3f6177[_0x026a('0x39')]>0x1){removeReferences(_0x550070,_0x49c6bd);logger['error'](_0x026a('0x70'));return _0x53e8f3(new Error(_0x026a('0x70')));}var _0x3df19d=fs['lstatSync'](path[_0x026a('0x5e')](_0x49c6bd,_0x3f6177[0x0]));if(_0x3df19d['isFile']()){removeReferences(_0x550070,_0x49c6bd);logger[_0x026a('0x2e')](_0x026a('0x70'));return _0x53e8f3(new Error(_0x026a('0x70')));}if(_0x3df19d[_0x026a('0x71')]()){var _0x2f0b92=fs[_0x026a('0x72')](path[_0x026a('0x5e')](_0x49c6bd,_0x3f6177[0x0]));if(_0x2f0b92[_0x026a('0x39')]===0x0){removeReferences(_0x550070,_0x49c6bd);logger['error'](_0x026a('0x70'));return _0x53e8f3(new Error(_0x026a('0x70')));}var _0x8c38f1=_0x2f0b92[_0x026a('0x73')](function(_0x175979){return _0x175979===_0x026a('0x74');});if(!_0x8c38f1){return _0x53e8f3(new Error(_0x026a('0x75')));}var _0x2cf5fe=fs[_0x026a('0x76')](path['join'](_0x49c6bd,_0x3f6177[0x0],_0x026a('0x74')));var _0xb5d8d7=JSON[_0x026a('0x77')](_0x2cf5fe);if('undefined'==typeof _0xb5d8d7[_0x026a('0x30')]){return _0x53e8f3(new Error(_0x026a('0x78')));}if(_0x026a('0x22')==typeof _0xb5d8d7[_0x026a('0x33')]){return _0x53e8f3(new Error('Invalid\x20manifest:\x20type\x20missing'));}if(_0x026a('0x22')==typeof _0xb5d8d7[_0x026a('0x79')]){return _0x53e8f3(new Error(_0x026a('0x7a')));}if(_0x026a('0x22')==typeof _0xb5d8d7[_0x026a('0x7b')]){return _0x53e8f3(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0xb5d8d7['type']==='html'){if('undefined'==typeof _0xb5d8d7[_0x026a('0x7b')][_0x026a('0x7c')]){return _0x53e8f3(new Error(_0x026a('0x7d')));}if(_0x026a('0x22')==typeof _0xb5d8d7[_0x026a('0x7b')][_0x026a('0x7c')]['admin']&&_0x026a('0x22')==typeof _0xb5d8d7[_0x026a('0x7b')]['views'][_0x026a('0x7e')]){return _0x53e8f3(new Error(_0x026a('0x7f')));}}else if(_0xb5d8d7[_0x026a('0x33')]===_0x026a('0x80')){if(_0x026a('0x22')==typeof _0xb5d8d7[_0x026a('0x7b')][_0x026a('0x81')]){return _0x53e8f3(new Error(_0x026a('0x82')));}if('undefined'==typeof _0xb5d8d7['parameters'][_0x026a('0x83')]){return _0x53e8f3(new Error(_0x026a('0x84')));}}else{return _0x53e8f3(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0xa7c8c5=_0xb5d8d7[_0x026a('0x30')];var _0x66d98=_0xb5d8d7[_0x026a('0x85')];var _0x4ba972=_0xb5d8d7[_0x026a('0x33')];var _0xa8ef5c=_0xb5d8d7[_0x026a('0x86')]?_0xb5d8d7[_0x026a('0x86')]:_0x026a('0x87');var _0xeb0753=_0xb5d8d7[_0x026a('0x88')]?_0xb5d8d7[_0x026a('0x88')]:'icon-apps';var _0x49829c='';var _0xe4ebd3='';var _0x5a47bc='';var _0x209281='';var _0x4d85fe=_0xb5d8d7[_0x026a('0x79')];if(_0x4ba972===_0x026a('0x89')){if(_0x026a('0x22')!=typeof _0xb5d8d7[_0x026a('0x7b')][_0x026a('0x7c')][_0x026a('0x8a')]){var _0x616c3=_0xb5d8d7['parameters'][_0x026a('0x7c')][_0x026a('0x8a')];if(!/^(f|ht)tps?:\/\//i[_0x026a('0x8b')](_0x616c3)){_0x49829c=path[_0x026a('0x5e')](_0x026a('0x8c'),_0x40b608,_0x3f6177[0x0],_0x616c3);}else{_0x49829c=_0x616c3;}}else{logger[_0x026a('0x68')]('Warning:\x20admin\x20view\x20not\x20specified');}if(_0x026a('0x22')!=typeof _0xb5d8d7[_0x026a('0x7b')][_0x026a('0x7c')][_0x026a('0x7e')]){var _0x1cbca7=_0xb5d8d7['parameters'][_0x026a('0x7c')][_0x026a('0x7e')];if(!/^(f|ht)tps?:\/\//i[_0x026a('0x8b')](_0x1cbca7)){_0xe4ebd3=path[_0x026a('0x5e')](_0x026a('0x8c'),_0x40b608,_0x3f6177[0x0],_0x1cbca7);}else{_0xe4ebd3=_0x1cbca7;}}else{logger[_0x026a('0x68')]('Warning:\x20agent\x20view\x20not\x20specified');}}else if(_0x4ba972===_0x026a('0x80')){_0x5a47bc=_0xb5d8d7['parameters']['scriptName'];_0x209281=_0xb5d8d7['parameters'][_0x026a('0x83')];if(_0x026a('0x22')!=typeof _0xb5d8d7['parameters']['views']){if(_0x026a('0x22')!=typeof _0xb5d8d7['parameters'][_0x026a('0x7c')][_0x026a('0x8a')]){var _0x616c3=_0xb5d8d7[_0x026a('0x7b')][_0x026a('0x7c')][_0x026a('0x8a')];if(!/^(f|ht)tps?:\/\//i['test'](_0x616c3)){_0x49829c=path['join'](_0x026a('0x8c'),_0x40b608,_0x3f6177[0x0],_0x616c3);}else{_0x49829c=_0x616c3;}}if(_0x026a('0x22')!=typeof _0xb5d8d7[_0x026a('0x7b')][_0x026a('0x7c')][_0x026a('0x7e')]){var _0x1cbca7=_0xb5d8d7['parameters']['views'][_0x026a('0x7e')];if(!/^(f|ht)tps?:\/\//i['test'](_0x1cbca7)){_0xe4ebd3=path[_0x026a('0x5e')](_0x026a('0x8c'),_0x40b608,_0x3f6177[0x0],_0x1cbca7);}else{_0xe4ebd3=_0x1cbca7;}}}}var _0x36b803={'name':_0xa7c8c5,'description':_0x66d98,'path':path[_0x026a('0x5e')](_0x40b608,_0x3f6177[0x0]),'type':_0x4ba972,'sidebar':_0xa8ef5c,'icon':_0xeb0753,'adminUrl':_0x49829c,'agentUrl':_0xe4ebd3,'scriptName':_0x5a47bc,'scriptPath':_0x209281,'version':_0x4d85fe};removeReferences(_0x550070,null);return db[_0x026a('0x4c')][_0x026a('0x8d')](_0x36b803)[_0x026a('0x29')](function(_0x4a25ab){var _0xa2c358={'role':_0xf825dc[_0x026a('0x8e')][_0x026a('0x8f')],'userProfileId':_0xf825dc[_0x026a('0x8e')][_0x026a('0x90')]};if(!_0xa2c358)throw new Error(_0x026a('0x91'));if(_0xa2c358[_0x026a('0x8f')]===_0x026a('0x92')){var _0x156d5e=_0x4a25ab[_0x026a('0x2b')]({'plain':!![]});return db[_0x026a('0x93')]['find']({'where':{'name':_0x026a('0x2c'),'userProfileId':_0xa2c358[_0x026a('0x90')]},'raw':!![]})['then'](function(_0x4183cd){if(_0x4183cd&&_0x4183cd[_0x026a('0x94')]===0x0){return db[_0x026a('0x2d')]['create']({'name':_0x156d5e[_0x026a('0x30')],'resourceId':_0x156d5e['id'],'type':_0x4183cd[_0x026a('0x30')],'sectionId':_0x4183cd['id']},{})[_0x026a('0x29')](function(){return _0x4a25ab;});}else{return _0x4a25ab;}})[_0x026a('0x4a')](function(_0x21c489){logger[_0x026a('0x2e')](_0x026a('0x95'),_0x21c489);throw _0x21c489;});}return _0x4a25ab;})[_0x026a('0x29')](respondWithResult(_0x307292,null))[_0x026a('0x4a')](handleError(_0x307292,null));}});}catch(_0x2f91a8){_0x307292[_0x026a('0x1e')](0x1f4)[_0x026a('0x96')](_0x2f91a8);}};function removeReferences(_0x222aac,_0x5008c3){try{if(_0x222aac){fs[_0x026a('0x67')](_0x222aac);logger['info'](_0x026a('0x97'));}if(_0x5008c3){rimraf(_0x5008c3,function(){});logger[_0x026a('0x68')]('Extracted\x20folder\x20removed');}}catch(_0x1b45a5){logger[_0x026a('0x2e')](_0x1b45a5);}}exports[_0x026a('0x28')]=function(_0x23a03f,_0x2804eb,_0x5f5c5d){return db[_0x026a('0x4c')]['find']({'where':{'id':_0x23a03f[_0x026a('0x50')]['id']}})['then'](handleEntityNotFound(_0x2804eb,null))[_0x026a('0x29')](saveUpdates(_0x23a03f[_0x026a('0x8e')],null))['then'](respondWithResult(_0x2804eb,null))[_0x026a('0x4a')](handleError(_0x2804eb,null));};exports['delete']=function(_0x2c107f,_0x8a21e3,_0x3b59c9){return db[_0x026a('0x4c')]['find']({'where':{'id':_0x2c107f[_0x026a('0x50')]['id']}})[_0x026a('0x29')](function(_0x39a848){if(_0x39a848){return _0x39a848[_0x026a('0x2a')]();}})[_0x026a('0x29')](function(_0x1dc370){rimraf(path[_0x026a('0x5e')](config[_0x026a('0x5f')],_0x026a('0x52'),path[_0x026a('0x60')](_0x1dc370[_0x026a('0x51')])),function(){});return _0x1dc370;})[_0x026a('0x29')](handleEntityNotFound(_0x8a21e3,null))[_0x026a('0x29')](respondWithStatusCode(_0x8a21e3,null))[_0x026a('0x4a')](handleError(_0x8a21e3,null));};exports[_0x026a('0x98')]=function(_0x69425a,_0x412df5,_0x34dfa1){return BPromise['resolve']()[_0x026a('0x29')](function(){if(!_0x69425a['query'][_0x026a('0x51')]){throw new Error(_0x026a('0x99'));}if(!_0x69425a['query'][_0x026a('0x9a')]){throw new Error(_0x026a('0x9b'));}var _0x140305=_0x69425a['query'][_0x026a('0x9c')]?_0x69425a[_0x026a('0x35')][_0x026a('0x9c')]+':'+_0x69425a[_0x026a('0x35')][_0x026a('0x9a')]:_0x026a('0x9d')+_0x69425a['query']['port'];var _0x284602=_0x69425a[_0x026a('0x35')][_0x026a('0x20')]?_0x69425a[_0x026a('0x35')][_0x026a('0x20')]:!![];var _0x382e10=_0x69425a[_0x026a('0x35')]['encoding']?_0x69425a[_0x026a('0x35')]['encoding']:null;var _0x4daa68={'method':_0x69425a['method'],'uri':util[_0x026a('0x66')]('%s%s',_0x140305,_0x69425a[_0x026a('0x35')][_0x026a('0x51')]),'json':_0x284602,'resolveWithFullResponse':!![],'encoding':_0x382e10,'qs':_0x69425a[_0x026a('0x35')]};if(_0x69425a[_0x026a('0x9e')]){_0x4daa68[_0x026a('0x9e')]=_0x69425a[_0x026a('0x9e')];if(_0x4daa68[_0x026a('0x9e')]['content-length']){delete _0x4daa68[_0x026a('0x9e')][_0x026a('0x9f')];}}if(_0x4daa68['headers'][_0x026a('0xa0')]){delete _0x4daa68[_0x026a('0x9e')]['content-type'];}return rp(_0x4daa68);})['then'](function(_0x3822d2){if(_0x3822d2){_0x412df5[_0x026a('0x25')](_0x3822d2[_0x026a('0x9e')]);logger[_0x026a('0x68')](_0x3822d2['body']);if(_[_0x026a('0xa1')](_0x69425a[_0x026a('0x35')]['path'],'download')&&_0x3822d2['statusCode']==0x1f4){return _0x412df5[_0x026a('0x1d')](_0x3822d2['statusCode']);}else{return _0x412df5[_0x026a('0x1e')](_0x3822d2[_0x026a('0xa2')])[_0x026a('0x96')](_0x3822d2[_0x026a('0x8e')]);}}else{return _0x412df5[_0x026a('0x1d')](0xc8);}})[_0x026a('0x4a')](handleError(_0x412df5,null));};exports[_0x026a('0xa3')]=function(_0x4ece18,_0x992ceb,_0x54c133){return BPromise[_0x026a('0xa4')]()['then'](function(){if(!_0x4ece18['query'][_0x026a('0x51')]){throw new Error(_0x026a('0x99'));}if(!_0x4ece18['query']['port']){throw new Error(_0x026a('0x9b'));}var _0x2a1385=_0x4ece18[_0x026a('0x35')][_0x026a('0x9c')]?_0x4ece18[_0x026a('0x35')][_0x026a('0x9c')]+':'+_0x4ece18['query']['port']:_0x026a('0x9d')+_0x4ece18['query'][_0x026a('0x9a')];var _0x39f576=_0x4ece18[_0x026a('0x35')][_0x026a('0x20')]?_0x4ece18['query'][_0x026a('0x20')]:!![];var _0x429749=_0x4ece18['query'][_0x026a('0xa5')]?_0x4ece18[_0x026a('0x35')][_0x026a('0xa5')]:null;var _0x3c2fa6={'method':_0x4ece18['method'],'uri':util[_0x026a('0x66')](_0x026a('0xa6'),_0x2a1385,_0x4ece18[_0x026a('0x35')][_0x026a('0x51')]),'json':_0x39f576,'resolveWithFullResponse':!![],'encoding':_0x429749,'body':_0x4ece18[_0x026a('0x8e')]};if(_0x4ece18['headers']){_0x3c2fa6[_0x026a('0x9e')]=_0x4ece18[_0x026a('0x9e')];if(_0x3c2fa6[_0x026a('0x9e')][_0x026a('0x9f')]){delete _0x3c2fa6[_0x026a('0x9e')][_0x026a('0x9f')];}}if(_0x3c2fa6[_0x026a('0x9e')][_0x026a('0xa0')]){delete _0x3c2fa6[_0x026a('0x9e')][_0x026a('0xa0')];}return rp(_0x3c2fa6);})[_0x026a('0x29')](function(_0x3e25a6){if(_0x3e25a6){_0x992ceb[_0x026a('0x25')](_0x3e25a6['headers']);logger[_0x026a('0x68')](_0x3e25a6[_0x026a('0x8e')]);return _0x992ceb[_0x026a('0x1e')](_0x3e25a6['statusCode'])[_0x026a('0x96')](_0x3e25a6[_0x026a('0x8e')]);}else{return _0x992ceb['sendStatus'](0xc8);}})['catch'](handleError(_0x992ceb,null));}; \ No newline at end of file +var _0xcd00=['lstatSync','isFile','isDirectory','some','manifest.json','readFileSync','parse','Invalid\x20manifest:\x20name\x20missing','type','Invalid\x20manifest:\x20type\x20missing','version','parameters','views','Invalid\x20manifest:\x20views\x20missing','agent','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','always','icon','icon-apps','html','admin','plugins','test','Warning:\x20agent\x20view\x20not\x20specified','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','resolve','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','endsWith','statusCode','\x27PATH\x27\x20parameter\x20not\x20specified','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','extract-zip','rimraf','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','offset','undefined','limit','count','status','set','Content-Range','json','apply','save','update','then','get','Plugins','UserProfileResource','destroy','sendStatus','error','name','send','index','Plugin','key','model','map','query','keys','filters','intersection','attributes','length','hasOwnProperty','sort','where','filter','merge','VIRTUAL','includeAll','include','rows','catch','params','rawAttributes','fields','options','find','download','root','server/files/plugins','%s.zip','createWriteStream','zip','warning','code','ENOENT','Sequelize','Error\x20while\x20generating\x20the\x20zip\x20archive','Error','pipe','glob','**/*','join','dirname','basename','node_modules/**/*','attachments/**/*','finalize','Plugin\x20not\x20found','format','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','upload','file','filename','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','readdirSync','Invalid\x20plugin\x20structure'];(function(_0x1442cc,_0x35c091){var _0x4a597e=function(_0x4ec0fe){while(--_0x4ec0fe){_0x1442cc['push'](_0x1442cc['shift']());}};_0x4a597e(++_0x35c091);}(_0xcd00,0x17e));var _0x0cd0=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0xcd00[_0x51020b];return _0x371e47;};'use strict';var emlformat=require(_0x0cd0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0cd0('0x1'));var jsonpatch=require(_0x0cd0('0x2'));var rp=require(_0x0cd0('0x3'));var moment=require('moment');var BPromise=require(_0x0cd0('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x0cd0('0x5'));var sox=require(_0x0cd0('0x6'));var csv=require(_0x0cd0('0x7'));var ejs=require(_0x0cd0('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x0cd0('0x9'));var crypto=require(_0x0cd0('0xa'));var jsforce=require(_0x0cd0('0xb'));var deskjs=require(_0x0cd0('0xc'));var toCsv=require('to-csv');var querystring=require(_0x0cd0('0xd'));var Papa=require('papaparse');var extract=require(_0x0cd0('0xe'));var rimraf=require(_0x0cd0('0xf'));var archiver=require('archiver');var Redis=require(_0x0cd0('0x10'));var authService=require(_0x0cd0('0x11'));var qs=require(_0x0cd0('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0cd0('0x13'));var logger=require(_0x0cd0('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x0cd0('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x0cd0('0x16'))['db'];config[_0x0cd0('0x17')]=_[_0x0cd0('0x18')](config['redis'],{'host':_0x0cd0('0x19'),'port':0x18eb});var socket=require(_0x0cd0('0x1a'))(new Redis(config[_0x0cd0('0x17')]));require(_0x0cd0('0x1b'))[_0x0cd0('0x1c')](socket);function respondWithStatusCode(_0x256865,_0x3f4173){_0x3f4173=_0x3f4173||0xcc;return function(_0x857744){if(_0x857744){return _0x256865['sendStatus'](_0x3f4173);}return _0x256865['status'](_0x3f4173)['end']();};}function respondWithResult(_0x1f132e,_0x3dc6f2){_0x3dc6f2=_0x3dc6f2||0xc8;return function(_0x1f0073){if(_0x1f0073){return _0x1f132e['status'](_0x3dc6f2)['json'](_0x1f0073);}};}function respondWithFilteredResult(_0x878e4,_0x2ec1f5){return function(_0x315020){if(_0x315020){var _0x6e3547=typeof _0x2ec1f5[_0x0cd0('0x1d')]===_0x0cd0('0x1e')&&typeof _0x2ec1f5[_0x0cd0('0x1f')]==='undefined';var _0x3db651=_0x315020[_0x0cd0('0x20')];var _0x3bad68=_0x6e3547?0x0:_0x2ec1f5[_0x0cd0('0x1d')];var _0x7c413b=_0x6e3547?_0x315020[_0x0cd0('0x20')]:_0x2ec1f5[_0x0cd0('0x1d')]+_0x2ec1f5['limit'];var _0x77edbc;if(_0x7c413b>=_0x3db651){_0x7c413b=_0x3db651;_0x77edbc=0xc8;}else{_0x77edbc=0xce;}_0x878e4[_0x0cd0('0x21')](_0x77edbc);return _0x878e4[_0x0cd0('0x22')](_0x0cd0('0x23'),_0x3bad68+'-'+_0x7c413b+'/'+_0x3db651)[_0x0cd0('0x24')](_0x315020);}return null;};}function patchUpdates(_0x3ffbeb){return function(_0x51be80){try{jsonpatch[_0x0cd0('0x25')](_0x51be80,_0x3ffbeb,!![]);}catch(_0x4bf7e4){return BPromise['reject'](_0x4bf7e4);}return _0x51be80[_0x0cd0('0x26')]();};}function saveUpdates(_0x27a184,_0x1815a0){return function(_0x4d3ba6){if(_0x4d3ba6){return _0x4d3ba6[_0x0cd0('0x27')](_0x27a184)[_0x0cd0('0x28')](function(_0x2a872f){return _0x2a872f;});}return null;};}function removeEntity(_0x36411e,_0xa21283){return function(_0xf4bf55){if(_0xf4bf55){return _0xf4bf55['destroy']()[_0x0cd0('0x28')](function(){var _0x1258ed=_0xf4bf55[_0x0cd0('0x29')]({'plain':!![]});var _0x56cdb3=_0x0cd0('0x2a');return db[_0x0cd0('0x2b')][_0x0cd0('0x2c')]({'where':{'type':_0x56cdb3,'resourceId':_0x1258ed['id']}})[_0x0cd0('0x28')](function(){return _0xf4bf55;});})[_0x0cd0('0x28')](function(){_0x36411e[_0x0cd0('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x561a99,_0x3657ff){return function(_0x56bddd){if(!_0x56bddd){_0x561a99[_0x0cd0('0x2d')](0x194);}return _0x56bddd;};}function handleError(_0x252699,_0x2e1a0f){_0x2e1a0f=_0x2e1a0f||0x1f4;return function(_0x26d58e){logger[_0x0cd0('0x2e')](_0x26d58e['stack']);if(_0x26d58e[_0x0cd0('0x2f')]){delete _0x26d58e[_0x0cd0('0x2f')];}_0x252699['status'](_0x2e1a0f)[_0x0cd0('0x30')](_0x26d58e);};}exports[_0x0cd0('0x31')]=function(_0x381fab,_0xe5c2d0){var _0x3103ea={},_0x4efb80={},_0x11df4b={'count':0x0,'rows':[]};var _0xc045f4=_['map'](db[_0x0cd0('0x32')]['rawAttributes'],function(_0x1a29aa){return{'name':_0x1a29aa['fieldName'],'type':_0x1a29aa['type'][_0x0cd0('0x33')]};});_0x4efb80[_0x0cd0('0x34')]=_[_0x0cd0('0x35')](_0xc045f4,'name');_0x4efb80[_0x0cd0('0x36')]=_[_0x0cd0('0x37')](_0x381fab[_0x0cd0('0x36')]);_0x4efb80[_0x0cd0('0x38')]=_[_0x0cd0('0x39')](_0x4efb80[_0x0cd0('0x34')],_0x4efb80['query']);_0x3103ea[_0x0cd0('0x3a')]=_[_0x0cd0('0x39')](_0x4efb80[_0x0cd0('0x34')],qs['fields'](_0x381fab[_0x0cd0('0x36')]['fields']));_0x3103ea[_0x0cd0('0x3a')]=_0x3103ea[_0x0cd0('0x3a')][_0x0cd0('0x3b')]?_0x3103ea[_0x0cd0('0x3a')]:_0x4efb80['model'];if(!_0x381fab[_0x0cd0('0x36')][_0x0cd0('0x3c')]('nolimit')){_0x3103ea['limit']=qs[_0x0cd0('0x1f')](_0x381fab['query'][_0x0cd0('0x1f')]);_0x3103ea['offset']=qs[_0x0cd0('0x1d')](_0x381fab[_0x0cd0('0x36')][_0x0cd0('0x1d')]);}_0x3103ea['order']=qs[_0x0cd0('0x3d')](_0x381fab['query'][_0x0cd0('0x3d')]);_0x3103ea[_0x0cd0('0x3e')]=qs[_0x0cd0('0x38')](_['pick'](_0x381fab['query'],_0x4efb80['filters']),_0xc045f4);if(_0x381fab[_0x0cd0('0x36')][_0x0cd0('0x3f')]){_0x3103ea[_0x0cd0('0x3e')]=_[_0x0cd0('0x40')](_0x3103ea[_0x0cd0('0x3e')],{'$or':_[_0x0cd0('0x35')](_0xc045f4,function(_0x1ea82c){if(_0x1ea82c['type']!==_0x0cd0('0x41')){var _0x5d9356={};_0x5d9356[_0x1ea82c['name']]={'$like':'%'+_0x381fab[_0x0cd0('0x36')][_0x0cd0('0x3f')]+'%'};return _0x5d9356;}})});}_0x3103ea=_[_0x0cd0('0x40')]({},_0x3103ea,_0x381fab['options']);var _0x3bbe5e={'where':_0x3103ea[_0x0cd0('0x3e')]};return db[_0x0cd0('0x32')][_0x0cd0('0x20')](_0x3bbe5e)['then'](function(_0x3591ac){_0x11df4b[_0x0cd0('0x20')]=_0x3591ac;if(_0x381fab['query'][_0x0cd0('0x42')]){_0x3103ea[_0x0cd0('0x43')]=[{'all':!![]}];}return db[_0x0cd0('0x32')]['findAll'](_0x3103ea);})[_0x0cd0('0x28')](function(_0x3bc149){_0x11df4b[_0x0cd0('0x44')]=_0x3bc149;return _0x11df4b;})[_0x0cd0('0x28')](respondWithFilteredResult(_0xe5c2d0,_0x3103ea))[_0x0cd0('0x45')](handleError(_0xe5c2d0,null));};exports['show']=function(_0x55f23d,_0x23df44){var _0x2b002b={'raw':!![],'where':{'id':_0x55f23d[_0x0cd0('0x46')]['id']}},_0x31d9b2={};_0x31d9b2[_0x0cd0('0x34')]=_[_0x0cd0('0x37')](db[_0x0cd0('0x32')][_0x0cd0('0x47')]);_0x31d9b2[_0x0cd0('0x36')]=_[_0x0cd0('0x37')](_0x55f23d[_0x0cd0('0x36')]);_0x31d9b2[_0x0cd0('0x38')]=_['intersection'](_0x31d9b2[_0x0cd0('0x34')],_0x31d9b2[_0x0cd0('0x36')]);_0x2b002b['attributes']=_[_0x0cd0('0x39')](_0x31d9b2[_0x0cd0('0x34')],qs['fields'](_0x55f23d[_0x0cd0('0x36')][_0x0cd0('0x48')]));_0x2b002b[_0x0cd0('0x3a')]=_0x2b002b[_0x0cd0('0x3a')][_0x0cd0('0x3b')]?_0x2b002b[_0x0cd0('0x3a')]:_0x31d9b2[_0x0cd0('0x34')];if(_0x55f23d[_0x0cd0('0x36')][_0x0cd0('0x42')]){_0x2b002b[_0x0cd0('0x43')]=[{'all':!![]}];}_0x2b002b=_[_0x0cd0('0x40')]({},_0x2b002b,_0x55f23d[_0x0cd0('0x49')]);return db['Plugin'][_0x0cd0('0x4a')](_0x2b002b)[_0x0cd0('0x28')](handleEntityNotFound(_0x23df44,null))[_0x0cd0('0x28')](respondWithResult(_0x23df44,null))[_0x0cd0('0x45')](handleError(_0x23df44,null));};exports[_0x0cd0('0x4b')]=function(_0x24a30d,_0x30802d,_0xb7021d){return db[_0x0cd0('0x32')]['find']({'where':{'id':_0x24a30d[_0x0cd0('0x46')]['id']},'attributes':['name',_0x0cd0('0x5')],'raw':!![]})[_0x0cd0('0x28')](handleEntityNotFound(_0x30802d,null))[_0x0cd0('0x28')](function(_0x5a2f61){if(_0x5a2f61){var _0x5089cd=path['join'](config[_0x0cd0('0x4c')],_0x0cd0('0x4d'),util['format'](_0x0cd0('0x4e'),path['basename'](_0x5a2f61[_0x0cd0('0x5')])));var _0x1812f7=fs[_0x0cd0('0x4f')](_0x5089cd);var _0x627e23=archiver(_0x0cd0('0x50'),{'zlib':{'level':0x9}});_0x627e23['on'](_0x0cd0('0x51'),function(_0x2f2817){if(_0x2f2817[_0x0cd0('0x52')]===_0x0cd0('0x53')){logger[_0x0cd0('0x2e')](_0x2f2817);}else{throw new db[(_0x0cd0('0x54'))]['Error'](_0x0cd0('0x55'));}});_0x627e23['on']('error',function(_0x4fda9e){throw new db[(_0x0cd0('0x54'))][(_0x0cd0('0x56'))](_0x0cd0('0x55'));});_0x627e23[_0x0cd0('0x57')](_0x1812f7);_0x627e23[_0x0cd0('0x58')](_0x0cd0('0x59'),{'cwd':path[_0x0cd0('0x5a')](config[_0x0cd0('0x4c')],_0x0cd0('0x4d'),path[_0x0cd0('0x5b')](_0x5a2f61[_0x0cd0('0x5')])),'ignore':[path[_0x0cd0('0x5a')](path[_0x0cd0('0x5c')](_0x5a2f61[_0x0cd0('0x5')]),_0x0cd0('0x5d')),path['join'](path[_0x0cd0('0x5c')](_0x5a2f61[_0x0cd0('0x5')]),_0x0cd0('0x5e'))],'nodir':!![]})[_0x0cd0('0x5f')]();_0x1812f7['on']('close',function(){if(!fs['existsSync'](_0x5089cd)){throw new db[(_0x0cd0('0x54'))][(_0x0cd0('0x56'))](_0x0cd0('0x60'));}return _0x30802d[_0x0cd0('0x4b')](_0x5089cd,util[_0x0cd0('0x61')]('%s.zip',path[_0x0cd0('0x5c')](_0x5a2f61[_0x0cd0('0x5')])),function(_0x2d1d6d){if(_0x2d1d6d){throw new db[(_0x0cd0('0x54'))][(_0x0cd0('0x56'))]('Error\x20while\x20downloading\x20the\x20plugin');}fs[_0x0cd0('0x62')](_0x5089cd);logger[_0x0cd0('0x63')](_0x0cd0('0x64'));logger[_0x0cd0('0x63')](_0x0cd0('0x65'));});});}return null;})[_0x0cd0('0x45')](handleError(_0x30802d,null));};exports[_0x0cd0('0x66')]=function(_0x2d3df8,_0x1fea8f,_0x34b495){var _0x4b0e70=path[_0x0cd0('0x5c')](_0x2d3df8[_0x0cd0('0x67')][_0x0cd0('0x68')],path['extname'](_0x2d3df8[_0x0cd0('0x67')][_0x0cd0('0x68')]));var _0x2e3d4f=path[_0x0cd0('0x5a')](config[_0x0cd0('0x4c')],'server/files/plugins',_0x2d3df8['file'][_0x0cd0('0x68')]);var _0x5f3ad8=path[_0x0cd0('0x5a')](config[_0x0cd0('0x4c')],_0x0cd0('0x4d'),_0x4b0e70);logger['info'](_0x0cd0('0x69'),_0x2e3d4f);logger[_0x0cd0('0x63')](_0x0cd0('0x6a'),_0x5f3ad8);try{fs[_0x0cd0('0x6b')](_0x2e3d4f,parseInt('0777',0x8));extract(_0x2e3d4f,{'dir':_0x5f3ad8},function(_0x1958d0){if(_0x1958d0){logger[_0x0cd0('0x2e')](_0x1958d0);handleError(_0x1958d0,!![]);};var _0x26cb31=fs[_0x0cd0('0x6c')](_0x5f3ad8);if(_0x26cb31[_0x0cd0('0x3b')]>0x1){removeReferences(_0x2e3d4f,_0x5f3ad8);logger[_0x0cd0('0x2e')](_0x0cd0('0x6d'));return _0x34b495(new Error('Invalid\x20plugin\x20structure'));}var _0x28eab0=fs[_0x0cd0('0x6e')](path[_0x0cd0('0x5a')](_0x5f3ad8,_0x26cb31[0x0]));if(_0x28eab0[_0x0cd0('0x6f')]()){removeReferences(_0x2e3d4f,_0x5f3ad8);logger[_0x0cd0('0x2e')](_0x0cd0('0x6d'));return _0x34b495(new Error(_0x0cd0('0x6d')));}if(_0x28eab0[_0x0cd0('0x70')]()){var _0x371c54=fs['readdirSync'](path['join'](_0x5f3ad8,_0x26cb31[0x0]));if(_0x371c54[_0x0cd0('0x3b')]===0x0){removeReferences(_0x2e3d4f,_0x5f3ad8);logger[_0x0cd0('0x2e')]('Invalid\x20plugin\x20structure');return _0x34b495(new Error('Invalid\x20plugin\x20structure'));}var _0x2eee13=_0x371c54[_0x0cd0('0x71')](function(_0x47f8d5){return _0x47f8d5===_0x0cd0('0x72');});if(!_0x2eee13){return _0x34b495(new Error('Plugin\x20manifest\x20missing'));}var _0x2f2c11=fs[_0x0cd0('0x73')](path[_0x0cd0('0x5a')](_0x5f3ad8,_0x26cb31[0x0],_0x0cd0('0x72')));var _0x1f23dd=JSON[_0x0cd0('0x74')](_0x2f2c11);if(_0x0cd0('0x1e')==typeof _0x1f23dd[_0x0cd0('0x2f')]){return _0x34b495(new Error(_0x0cd0('0x75')));}if(_0x0cd0('0x1e')==typeof _0x1f23dd[_0x0cd0('0x76')]){return _0x34b495(new Error(_0x0cd0('0x77')));}if('undefined'==typeof _0x1f23dd[_0x0cd0('0x78')]){return _0x34b495(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if(_0x0cd0('0x1e')==typeof _0x1f23dd[_0x0cd0('0x79')]){return _0x34b495(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x1f23dd['type']==='html'){if(_0x0cd0('0x1e')==typeof _0x1f23dd[_0x0cd0('0x79')][_0x0cd0('0x7a')]){return _0x34b495(new Error(_0x0cd0('0x7b')));}if(_0x0cd0('0x1e')==typeof _0x1f23dd[_0x0cd0('0x79')][_0x0cd0('0x7a')]['admin']&&_0x0cd0('0x1e')==typeof _0x1f23dd[_0x0cd0('0x79')][_0x0cd0('0x7a')][_0x0cd0('0x7c')]){return _0x34b495(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x1f23dd[_0x0cd0('0x76')]===_0x0cd0('0x7d')){if(_0x0cd0('0x1e')==typeof _0x1f23dd[_0x0cd0('0x79')][_0x0cd0('0x7e')]){return _0x34b495(new Error(_0x0cd0('0x7f')));}if(_0x0cd0('0x1e')==typeof _0x1f23dd[_0x0cd0('0x79')][_0x0cd0('0x80')]){return _0x34b495(new Error(_0x0cd0('0x81')));}}else{return _0x34b495(new Error(_0x0cd0('0x82')));}var _0xbac81=_0x1f23dd[_0x0cd0('0x2f')];var _0x14f037=_0x1f23dd['description'];var _0x53c198=_0x1f23dd[_0x0cd0('0x76')];var _0x23a6eb=_0x1f23dd['sidebar']?_0x1f23dd['sidebar']:_0x0cd0('0x83');var _0x312a4b=_0x1f23dd[_0x0cd0('0x84')]?_0x1f23dd['icon']:_0x0cd0('0x85');var _0x4316b6='';var _0x31045f='';var _0x3a352a='';var _0x32352e='';var _0x35f434=_0x1f23dd[_0x0cd0('0x78')];if(_0x53c198===_0x0cd0('0x86')){if(_0x0cd0('0x1e')!=typeof _0x1f23dd[_0x0cd0('0x79')]['views'][_0x0cd0('0x87')]){var _0x48b1d0=_0x1f23dd[_0x0cd0('0x79')][_0x0cd0('0x7a')][_0x0cd0('0x87')];if(!/^(f|ht)tps?:\/\//i['test'](_0x48b1d0)){_0x4316b6=path[_0x0cd0('0x5a')](_0x0cd0('0x88'),_0x4b0e70,_0x26cb31[0x0],_0x48b1d0);}else{_0x4316b6=_0x48b1d0;}}else{logger[_0x0cd0('0x63')]('Warning:\x20admin\x20view\x20not\x20specified');}if('undefined'!=typeof _0x1f23dd['parameters'][_0x0cd0('0x7a')]['agent']){var _0x2cf0d1=_0x1f23dd[_0x0cd0('0x79')][_0x0cd0('0x7a')][_0x0cd0('0x7c')];if(!/^(f|ht)tps?:\/\//i[_0x0cd0('0x89')](_0x2cf0d1)){_0x31045f=path['join'](_0x0cd0('0x88'),_0x4b0e70,_0x26cb31[0x0],_0x2cf0d1);}else{_0x31045f=_0x2cf0d1;}}else{logger['info'](_0x0cd0('0x8a'));}}else if(_0x53c198===_0x0cd0('0x7d')){_0x3a352a=_0x1f23dd[_0x0cd0('0x79')][_0x0cd0('0x7e')];_0x32352e=_0x1f23dd[_0x0cd0('0x79')][_0x0cd0('0x80')];if('undefined'!=typeof _0x1f23dd['parameters']['views']){if(_0x0cd0('0x1e')!=typeof _0x1f23dd[_0x0cd0('0x79')][_0x0cd0('0x7a')][_0x0cd0('0x87')]){var _0x48b1d0=_0x1f23dd[_0x0cd0('0x79')][_0x0cd0('0x7a')][_0x0cd0('0x87')];if(!/^(f|ht)tps?:\/\//i['test'](_0x48b1d0)){_0x4316b6=path['join'](_0x0cd0('0x88'),_0x4b0e70,_0x26cb31[0x0],_0x48b1d0);}else{_0x4316b6=_0x48b1d0;}}if(_0x0cd0('0x1e')!=typeof _0x1f23dd[_0x0cd0('0x79')]['views'][_0x0cd0('0x7c')]){var _0x2cf0d1=_0x1f23dd['parameters'][_0x0cd0('0x7a')][_0x0cd0('0x7c')];if(!/^(f|ht)tps?:\/\//i[_0x0cd0('0x89')](_0x2cf0d1)){_0x31045f=path['join'](_0x0cd0('0x88'),_0x4b0e70,_0x26cb31[0x0],_0x2cf0d1);}else{_0x31045f=_0x2cf0d1;}}}}var _0x5a663f={'name':_0xbac81,'description':_0x14f037,'path':path[_0x0cd0('0x5a')](_0x4b0e70,_0x26cb31[0x0]),'type':_0x53c198,'sidebar':_0x23a6eb,'icon':_0x312a4b,'adminUrl':_0x4316b6,'agentUrl':_0x31045f,'scriptName':_0x3a352a,'scriptPath':_0x32352e,'version':_0x35f434};removeReferences(_0x2e3d4f,null);return db[_0x0cd0('0x32')][_0x0cd0('0x8b')](_0x5a663f)[_0x0cd0('0x28')](function(_0x3d4d33){var _0x42cbf5={'role':_0x2d3df8[_0x0cd0('0x8c')][_0x0cd0('0x8d')],'userProfileId':_0x2d3df8[_0x0cd0('0x8c')][_0x0cd0('0x8e')]};if(!_0x42cbf5)throw new Error(_0x0cd0('0x8f'));if(_0x42cbf5[_0x0cd0('0x8d')]===_0x0cd0('0x90')){var _0x449289=_0x3d4d33[_0x0cd0('0x29')]({'plain':!![]});return db[_0x0cd0('0x91')]['find']({'where':{'name':_0x0cd0('0x2a'),'userProfileId':_0x42cbf5['userProfileId']},'raw':!![]})[_0x0cd0('0x28')](function(_0x2ab46a){if(_0x2ab46a&&_0x2ab46a[_0x0cd0('0x92')]===0x0){return db[_0x0cd0('0x2b')][_0x0cd0('0x8b')]({'name':_0x449289[_0x0cd0('0x2f')],'resourceId':_0x449289['id'],'type':_0x2ab46a[_0x0cd0('0x2f')],'sectionId':_0x2ab46a['id']},{})[_0x0cd0('0x28')](function(){return _0x3d4d33;});}else{return _0x3d4d33;}})[_0x0cd0('0x45')](function(_0x294cf9){logger[_0x0cd0('0x2e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x294cf9);throw _0x294cf9;});}return _0x3d4d33;})[_0x0cd0('0x28')](respondWithResult(_0x1fea8f,null))['catch'](handleError(_0x1fea8f,null));}});}catch(_0x91c53e){_0x1fea8f[_0x0cd0('0x21')](0x1f4)[_0x0cd0('0x30')](_0x91c53e);}};function removeReferences(_0x10586f,_0x307580){try{if(_0x10586f){fs['unlinkSync'](_0x10586f);logger[_0x0cd0('0x63')](_0x0cd0('0x93'));}if(_0x307580){rimraf(_0x307580,function(){});logger[_0x0cd0('0x63')](_0x0cd0('0x94'));}}catch(_0xf0eadf){logger[_0x0cd0('0x2e')](_0xf0eadf);}}exports[_0x0cd0('0x27')]=function(_0x1de4a9,_0x57e6b2,_0x319dfe){return db[_0x0cd0('0x32')][_0x0cd0('0x4a')]({'where':{'id':_0x1de4a9['params']['id']}})[_0x0cd0('0x28')](handleEntityNotFound(_0x57e6b2,null))['then'](saveUpdates(_0x1de4a9['body'],null))['then'](respondWithResult(_0x57e6b2,null))[_0x0cd0('0x45')](handleError(_0x57e6b2,null));};exports[_0x0cd0('0x95')]=function(_0x22ae1d,_0x3919a1,_0x33ffb5){return db[_0x0cd0('0x32')]['find']({'where':{'id':_0x22ae1d[_0x0cd0('0x46')]['id']}})[_0x0cd0('0x28')](function(_0x4c3fdd){if(_0x4c3fdd){return _0x4c3fdd['destroy']();}})['then'](function(_0x898726){rimraf(path['join'](config[_0x0cd0('0x4c')],'server/files/plugins',path[_0x0cd0('0x5b')](_0x898726[_0x0cd0('0x5')])),function(){});return _0x898726;})['then'](handleEntityNotFound(_0x3919a1,null))[_0x0cd0('0x28')](respondWithStatusCode(_0x3919a1,null))[_0x0cd0('0x45')](handleError(_0x3919a1,null));};exports['webhookGet']=function(_0xa8ab35,_0x3fe8ef,_0x2c6fd6){return BPromise[_0x0cd0('0x96')]()[_0x0cd0('0x28')](function(){if(!_0xa8ab35[_0x0cd0('0x36')][_0x0cd0('0x5')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0xa8ab35[_0x0cd0('0x36')][_0x0cd0('0x97')]){throw new Error(_0x0cd0('0x98'));}var _0x52e940=_0xa8ab35['query']['hostname']?_0xa8ab35[_0x0cd0('0x36')][_0x0cd0('0x99')]+':'+_0xa8ab35[_0x0cd0('0x36')][_0x0cd0('0x97')]:_0x0cd0('0x9a')+_0xa8ab35['query'][_0x0cd0('0x97')];var _0x59a49c=_0xa8ab35[_0x0cd0('0x36')][_0x0cd0('0x24')]?_0xa8ab35[_0x0cd0('0x36')][_0x0cd0('0x24')]:!![];var _0x1b1779=_0xa8ab35[_0x0cd0('0x36')][_0x0cd0('0x9b')]?_0xa8ab35[_0x0cd0('0x36')]['encoding']:null;var _0x20e74a={'method':_0xa8ab35[_0x0cd0('0x9c')],'uri':util[_0x0cd0('0x61')](_0x0cd0('0x9d'),_0x52e940,_0xa8ab35['query']['path']),'json':_0x59a49c,'resolveWithFullResponse':!![],'encoding':_0x1b1779,'qs':_0xa8ab35[_0x0cd0('0x36')]};if(_0xa8ab35[_0x0cd0('0x9e')]){_0x20e74a[_0x0cd0('0x9e')]=_0xa8ab35[_0x0cd0('0x9e')];if(_0x20e74a[_0x0cd0('0x9e')][_0x0cd0('0x9f')]){delete _0x20e74a[_0x0cd0('0x9e')]['content-length'];}}if(_0x20e74a[_0x0cd0('0x9e')]['content-type']){delete _0x20e74a[_0x0cd0('0x9e')][_0x0cd0('0xa0')];}return rp(_0x20e74a);})[_0x0cd0('0x28')](function(_0x4d421d){if(_0x4d421d){_0x3fe8ef['set'](_0x4d421d[_0x0cd0('0x9e')]);logger[_0x0cd0('0x63')](_0x4d421d[_0x0cd0('0x8c')]);if(_[_0x0cd0('0xa1')](_0xa8ab35[_0x0cd0('0x36')][_0x0cd0('0x5')],_0x0cd0('0x4b'))&&_0x4d421d[_0x0cd0('0xa2')]==0x1f4){return _0x3fe8ef['sendStatus'](_0x4d421d[_0x0cd0('0xa2')]);}else{return _0x3fe8ef[_0x0cd0('0x21')](_0x4d421d[_0x0cd0('0xa2')])[_0x0cd0('0x30')](_0x4d421d[_0x0cd0('0x8c')]);}}else{return _0x3fe8ef[_0x0cd0('0x2d')](0xc8);}})[_0x0cd0('0x45')](handleError(_0x3fe8ef,null));};exports['webhookPost']=function(_0x31026e,_0x14fa19,_0x33f228){return BPromise[_0x0cd0('0x96')]()[_0x0cd0('0x28')](function(){if(!_0x31026e[_0x0cd0('0x36')]['path']){throw new Error(_0x0cd0('0xa3'));}if(!_0x31026e[_0x0cd0('0x36')][_0x0cd0('0x97')]){throw new Error(_0x0cd0('0x98'));}var _0x231060=_0x31026e[_0x0cd0('0x36')][_0x0cd0('0x99')]?_0x31026e[_0x0cd0('0x36')]['hostname']+':'+_0x31026e[_0x0cd0('0x36')][_0x0cd0('0x97')]:'http://localhost:'+_0x31026e['query'][_0x0cd0('0x97')];var _0x59e0eb=_0x31026e[_0x0cd0('0x36')][_0x0cd0('0x24')]?_0x31026e['query'][_0x0cd0('0x24')]:!![];var _0x4519e2=_0x31026e['query'][_0x0cd0('0x9b')]?_0x31026e[_0x0cd0('0x36')][_0x0cd0('0x9b')]:null;var _0x39e320={'method':_0x31026e['method'],'uri':util[_0x0cd0('0x61')](_0x0cd0('0x9d'),_0x231060,_0x31026e[_0x0cd0('0x36')][_0x0cd0('0x5')]),'json':_0x59e0eb,'resolveWithFullResponse':!![],'encoding':_0x4519e2,'body':_0x31026e[_0x0cd0('0x8c')]};if(_0x31026e[_0x0cd0('0x9e')]){_0x39e320['headers']=_0x31026e[_0x0cd0('0x9e')];if(_0x39e320[_0x0cd0('0x9e')]['content-length']){delete _0x39e320['headers'][_0x0cd0('0x9f')];}}if(_0x39e320[_0x0cd0('0x9e')]['content-type']){delete _0x39e320[_0x0cd0('0x9e')]['content-type'];}return rp(_0x39e320);})[_0x0cd0('0x28')](function(_0x238ec9){if(_0x238ec9){_0x14fa19['set'](_0x238ec9[_0x0cd0('0x9e')]);logger[_0x0cd0('0x63')](_0x238ec9['body']);return _0x14fa19[_0x0cd0('0x21')](_0x238ec9[_0x0cd0('0xa2')])[_0x0cd0('0x30')](_0x238ec9[_0x0cd0('0x8c')]);}else{return _0x14fa19[_0x0cd0('0x2d')](0xc8);}})[_0x0cd0('0x45')](handleError(_0x14fa19,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 8f4625a..0230591 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 _0xd991=['Plugin','setMaxListeners','save','remove','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x137cd7,_0x28f679){var _0x9ca7cd=function(_0x37bb60){while(--_0x37bb60){_0x137cd7['push'](_0x137cd7['shift']());}};_0x9ca7cd(++_0x28f679);}(_0xd991,0x115));var _0x1d99=function(_0x5e9122,_0x27e2b1){_0x5e9122=_0x5e9122-0x0;var _0x1e6e4b=_0xd991[_0x5e9122];return _0x1e6e4b;};'use strict';var EventEmitter=require(_0x1d99('0x0'));var Plugin=require(_0x1d99('0x1'))['db'][_0x1d99('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x1d99('0x3')](0x0);var events={'afterCreate':_0x1d99('0x4'),'afterUpdate':'update','afterDestroy':_0x1d99('0x5')};function emitEvent(_0xe9aefb){return function(_0xf03459,_0x1f6da3,_0x300c32){PluginEvents[_0x1d99('0x6')](_0xe9aefb+':'+_0xf03459['id'],_0xf03459);PluginEvents['emit'](_0xe9aefb,_0xf03459);_0x300c32(null);};}for(var e in events){if(events[_0x1d99('0x7')](e)){var event=events[e];Plugin[_0x1d99('0x8')](e,emitEvent(event));}}module['exports']=PluginEvents; \ No newline at end of file +var _0x49df=['hook','exports','Plugin','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x40403d,_0x58deeb){var _0x13c2fa=function(_0x407748){while(--_0x407748){_0x40403d['push'](_0x40403d['shift']());}};_0x13c2fa(++_0x58deeb);}(_0x49df,0xad));var _0xf49d=function(_0x2db055,_0x5bde11){_0x2db055=_0x2db055-0x0;var _0xb2f3a4=_0x49df[_0x2db055];return _0xb2f3a4;};'use strict';var EventEmitter=require('events');var Plugin=require('../../mysqldb')['db'][_0xf49d('0x0')];var PluginEvents=new EventEmitter();PluginEvents[_0xf49d('0x1')](0x0);var events={'afterCreate':_0xf49d('0x2'),'afterUpdate':_0xf49d('0x3'),'afterDestroy':_0xf49d('0x4')};function emitEvent(_0x1ff84c){return function(_0x44b37e,_0x59cb9d,_0x4c519f){PluginEvents[_0xf49d('0x5')](_0x1ff84c+':'+_0x44b37e['id'],_0x44b37e);PluginEvents[_0xf49d('0x5')](_0x1ff84c,_0x44b37e);_0x4c519f(null);};}for(var e in events){if(events[_0xf49d('0x6')](e)){var event=events[e];Plugin[_0xf49d('0x7')](e,emitEvent(event));}}module[_0xf49d('0x8')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index f6a569f..84b4b62 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 _0x3322=['api','moment','bluebird','request-promise','path','../../config/environment','./plugin.attributes','exports','define','Plugin','plugins','lodash','util','../../config/logger'];(function(_0x553a22,_0x447fef){var _0x4edf22=function(_0x8b63e2){while(--_0x8b63e2){_0x553a22['push'](_0x553a22['shift']());}};_0x4edf22(++_0x447fef);}(_0x3322,0x1d9));var _0x2332=function(_0x2c5e5d,_0x3d231b){_0x2c5e5d=_0x2c5e5d-0x0;var _0x15d693=_0x3322[_0x2c5e5d];return _0x15d693;};'use strict';var _=require(_0x2332('0x0'));var util=require(_0x2332('0x1'));var logger=require(_0x2332('0x2'))(_0x2332('0x3'));var moment=require(_0x2332('0x4'));var BPromise=require(_0x2332('0x5'));var rp=require(_0x2332('0x6'));var fs=require('fs');var path=require(_0x2332('0x7'));var rimraf=require('rimraf');var config=require(_0x2332('0x8'));var attributes=require(_0x2332('0x9'));module[_0x2332('0xa')]=function(_0x4d49c0,_0x5b4e33){return _0x4d49c0[_0x2332('0xb')](_0x2332('0xc'),attributes,{'tableName':_0x2332('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe3c5=['define','Plugin','plugins','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./plugin.attributes','exports'];(function(_0x39c734,_0x2f3e06){var _0xb2a2f9=function(_0x502f3f){while(--_0x502f3f){_0x39c734['push'](_0x39c734['shift']());}};_0xb2a2f9(++_0x2f3e06);}(_0xe3c5,0x17d));var _0x5e3c=function(_0x507403,_0x3f954d){_0x507403=_0x507403-0x0;var _0x1327c=_0xe3c5[_0x507403];return _0x1327c;};'use strict';var _=require(_0x5e3c('0x0'));var util=require(_0x5e3c('0x1'));var logger=require(_0x5e3c('0x2'))(_0x5e3c('0x3'));var moment=require(_0x5e3c('0x4'));var BPromise=require(_0x5e3c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5e3c('0x6'));var rimraf=require(_0x5e3c('0x7'));var config=require(_0x5e3c('0x8'));var attributes=require(_0x5e3c('0x9'));module[_0x5e3c('0xa')]=function(_0x31a878,_0x1e631d){return _0x31a878[_0x5e3c('0xb')](_0x5e3c('0xc'),attributes,{'tableName':_0x5e3c('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 009fa7e..0d158b8 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 _0x5e65=['stringify','error','message','CreatePlugin','Plugin','create','options','then','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','request','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x5e65,0xcf));var _0x55e6=function(_0x924a2b,_0x477c10){_0x924a2b=_0x924a2b-0x0;var _0x3d701d=_0x5e65[_0x924a2b];return _0x3d701d;};'use strict';var _=require(_0x55e6('0x0'));var util=require(_0x55e6('0x1'));var moment=require('moment');var BPromise=require(_0x55e6('0x2'));var rs=require(_0x55e6('0x3'));var fs=require('fs');var Redis=require(_0x55e6('0x4'));var db=require(_0x55e6('0x5'))['db'];var utils=require(_0x55e6('0x6'));var logger=require(_0x55e6('0x7'))(_0x55e6('0x8'));var config=require(_0x55e6('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x55e6('0xa')][_0x55e6('0xb')]({'port':0x232a});config[_0x55e6('0xc')]=_[_0x55e6('0xd')](config[_0x55e6('0xc')],{'host':_0x55e6('0xe'),'port':0x18eb});var socket=require(_0x55e6('0xf'))(new Redis(config[_0x55e6('0xc')]));require(_0x55e6('0x10'))[_0x55e6('0x11')](socket);function respondWithRpcPromise(_0x23aac9,_0x421158,_0x1c3f87){return new BPromise(function(_0x5dc167,_0x3121b5){return client[_0x55e6('0x12')](_0x23aac9,_0x1c3f87)['then'](function(_0x2ef71c){logger[_0x55e6('0x13')](_0x55e6('0x14'),_0x421158,_0x55e6('0x15'));logger[_0x55e6('0x16')](_0x55e6('0x17'),_0x421158,'request\x20sent',JSON[_0x55e6('0x18')](_0x2ef71c));if(_0x2ef71c[_0x55e6('0x19')]){if(_0x2ef71c['error']['code']===0x1f4){logger['error'](_0x55e6('0x14'),_0x421158,_0x2ef71c[_0x55e6('0x19')][_0x55e6('0x1a')]);return _0x3121b5(_0x2ef71c[_0x55e6('0x19')][_0x55e6('0x1a')]);}logger['error'](_0x55e6('0x14'),_0x421158,_0x2ef71c[_0x55e6('0x19')][_0x55e6('0x1a')]);return _0x5dc167(_0x2ef71c[_0x55e6('0x19')][_0x55e6('0x1a')]);}else{logger[_0x55e6('0x13')](_0x55e6('0x14'),_0x421158,_0x55e6('0x15'));_0x5dc167(_0x2ef71c['result'][_0x55e6('0x1a')]);}})['catch'](function(_0xcbb2ab){logger[_0x55e6('0x19')](_0x55e6('0x14'),_0x421158,_0xcbb2ab);_0x3121b5(_0xcbb2ab);});});}exports[_0x55e6('0x1b')]=function(_0x58e5f7){var _0x1dd16d=this;return new Promise(function(_0x4fc98e,_0x35966c){return db[_0x55e6('0x1c')][_0x55e6('0x1d')](_0x58e5f7['body'],{'raw':_0x58e5f7[_0x55e6('0x1e')]?_0x58e5f7[_0x55e6('0x1e')]['raw']===undefined?!![]:![]:!![]})[_0x55e6('0x1f')](function(_0x4ffffb){logger[_0x55e6('0x13')](_0x55e6('0x1b'),_0x58e5f7);logger[_0x55e6('0x16')](_0x55e6('0x1b'),_0x58e5f7,JSON[_0x55e6('0x18')](_0x4ffffb));_0x4fc98e(_0x4ffffb);})[_0x55e6('0x20')](function(_0x1e49df){logger[_0x55e6('0x19')](_0x55e6('0x1b'),_0x1e49df[_0x55e6('0x1a')],_0x58e5f7);_0x35966c(_0x1dd16d[_0x55e6('0x19')](0x1f4,_0x1e49df[_0x55e6('0x1a')]));});});}; \ No newline at end of file +var _0x9c5e=['info','Plugin,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','Plugin','options','CreatePlugin','stringify','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./plugin.socket','register','request','then'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x9c5e,0x8d));var _0xe9c5=function(_0x9e166e,_0xcb527a){_0x9e166e=_0x9e166e-0x0;var _0x380aa0=_0x9c5e[_0x9e166e];return _0x380aa0;};'use strict';var _=require(_0xe9c5('0x0'));var util=require(_0xe9c5('0x1'));var moment=require(_0xe9c5('0x2'));var BPromise=require(_0xe9c5('0x3'));var rs=require(_0xe9c5('0x4'));var fs=require('fs');var Redis=require(_0xe9c5('0x5'));var db=require(_0xe9c5('0x6'))['db'];var utils=require(_0xe9c5('0x7'));var logger=require('../../config/logger')(_0xe9c5('0x8'));var config=require(_0xe9c5('0x9'));var jayson=require(_0xe9c5('0xa'));var client=jayson[_0xe9c5('0xb')]['http']({'port':0x232a});config[_0xe9c5('0xc')]=_['defaults'](config['redis'],{'host':_0xe9c5('0xd'),'port':0x18eb});var socket=require(_0xe9c5('0xe'))(new Redis(config[_0xe9c5('0xc')]));require(_0xe9c5('0xf'))[_0xe9c5('0x10')](socket);function respondWithRpcPromise(_0x2099f0,_0x291fa9,_0x3f1284){return new BPromise(function(_0x197baa,_0x17cc07){return client[_0xe9c5('0x11')](_0x2099f0,_0x3f1284)[_0xe9c5('0x12')](function(_0x1624bf){logger[_0xe9c5('0x13')](_0xe9c5('0x14'),_0x291fa9,_0xe9c5('0x15'));logger[_0xe9c5('0x16')]('Plugin,\x20%s,\x20%s,\x20%s',_0x291fa9,_0xe9c5('0x15'),JSON['stringify'](_0x1624bf));if(_0x1624bf[_0xe9c5('0x17')]){if(_0x1624bf['error'][_0xe9c5('0x18')]===0x1f4){logger['error']('Plugin,\x20%s,\x20%s',_0x291fa9,_0x1624bf[_0xe9c5('0x17')][_0xe9c5('0x19')]);return _0x17cc07(_0x1624bf[_0xe9c5('0x17')][_0xe9c5('0x19')]);}logger['error']('Plugin,\x20%s,\x20%s',_0x291fa9,_0x1624bf[_0xe9c5('0x17')][_0xe9c5('0x19')]);return _0x197baa(_0x1624bf[_0xe9c5('0x17')][_0xe9c5('0x19')]);}else{logger[_0xe9c5('0x13')]('Plugin,\x20%s,\x20%s',_0x291fa9,'request\x20sent');_0x197baa(_0x1624bf[_0xe9c5('0x1a')][_0xe9c5('0x19')]);}})['catch'](function(_0x50e1b5){logger[_0xe9c5('0x17')]('Plugin,\x20%s,\x20%s',_0x291fa9,_0x50e1b5);_0x17cc07(_0x50e1b5);});});}exports['CreatePlugin']=function(_0x53d512){var _0x5dee62=this;return new Promise(function(_0x2c19f8,_0x468c30){return db[_0xe9c5('0x1b')]['create'](_0x53d512['body'],{'raw':_0x53d512['options']?_0x53d512[_0xe9c5('0x1c')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x5286ca){logger[_0xe9c5('0x13')]('CreatePlugin',_0x53d512);logger[_0xe9c5('0x16')](_0xe9c5('0x1d'),_0x53d512,JSON[_0xe9c5('0x1e')](_0x5286ca));_0x2c19f8(_0x5286ca);})[_0xe9c5('0x1f')](function(_0x5f3f6f){logger[_0xe9c5('0x17')](_0xe9c5('0x1d'),_0x5f3f6f['message'],_0x53d512);_0x468c30(_0x5dee62[_0xe9c5('0x17')](0x1f4,_0x5f3f6f[_0xe9c5('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index bb9960b..e2c50ee 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 _0xc5e6=['emit','removeListener','register','length','plugin:','./plugin.events','save','remove'];(function(_0x392f26,_0x4a7fa5){var _0x27d0cf=function(_0xec9923){while(--_0xec9923){_0x392f26['push'](_0x392f26['shift']());}};_0x27d0cf(++_0x4a7fa5);}(_0xc5e6,0x165));var _0x6c5e=function(_0x101e7b,_0x4ef05b){_0x101e7b=_0x101e7b-0x0;var _0x4995c0=_0xc5e6[_0x101e7b];return _0x4995c0;};'use strict';var PluginEvents=require(_0x6c5e('0x0'));var events=[_0x6c5e('0x1'),_0x6c5e('0x2'),'update'];function createListener(_0xd9e6d2,_0x4032de){return function(_0x41bbff){_0x4032de[_0x6c5e('0x3')](_0xd9e6d2,_0x41bbff);};}function removeListener(_0x4d9bf8,_0xdb0e08){return function(){PluginEvents[_0x6c5e('0x4')](_0x4d9bf8,_0xdb0e08);};}exports[_0x6c5e('0x5')]=function(_0x43b5d4){for(var _0x17959c=0x0,_0x4371a1=events[_0x6c5e('0x6')];_0x17959c<_0x4371a1;_0x17959c++){var _0x50d8e8=events[_0x17959c];var _0x31297d=createListener(_0x6c5e('0x7')+_0x50d8e8,_0x43b5d4);PluginEvents['on'](_0x50d8e8,_0x31297d);}}; \ No newline at end of file +var _0x521f=['plugin:','./plugin.events','save','update','emit','removeListener','register'];(function(_0x372050,_0x5985d2){var _0x354c9d=function(_0x448d6b){while(--_0x448d6b){_0x372050['push'](_0x372050['shift']());}};_0x354c9d(++_0x5985d2);}(_0x521f,0xe8));var _0xf521=function(_0x2d2565,_0x4bce39){_0x2d2565=_0x2d2565-0x0;var _0x22f96b=_0x521f[_0x2d2565];return _0x22f96b;};'use strict';var PluginEvents=require(_0xf521('0x0'));var events=[_0xf521('0x1'),'remove',_0xf521('0x2')];function createListener(_0x128ee4,_0x2cb032){return function(_0x5abdf1){_0x2cb032[_0xf521('0x3')](_0x128ee4,_0x5abdf1);};}function removeListener(_0x201c06,_0x264719){return function(){PluginEvents[_0xf521('0x4')](_0x201c06,_0x264719);};}exports[_0xf521('0x5')]=function(_0x118887){for(var _0x1c6d36=0x0,_0x177ea0=events['length'];_0x1c6d36<_0x177ea0;_0x1c6d36++){var _0x20a054=events[_0x1c6d36];var _0x5ed0ad=createListener(_0xf521('0x6')+_0x20a054,_0x118887);PluginEvents['on'](_0x20a054,_0x5ed0ad);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 666a4e7..06bbcc9 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(_0x19360a,_0x124f84){var _0x164092=function(_0x526b64){while(--_0x526b64){_0x19360a['push'](_0x19360a['shift']());}};_0x164092(++_0x124f84);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'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(_0x595bc3,_0x5722ab){var _0x73ff32=function(_0x1f3fe9){while(--_0x1f3fe9){_0x595bc3['push'](_0x595bc3['shift']());}};_0x73ff32(++_0x5722ab);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xa9e0[_0x34bf97];return _0x292719;};'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 ef661ab..73ed80c 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 _0x524a=['sendStatus','json','error','stack','name','send','list','express','motion2','length','then','show','describe','params','catch','body','join','../../files/plugins','script','chdir','dirname','start','status','Missing\x20name\x20and/or\x20path','update','restart','hasOwnProperty','Unknown\x20status','destroy','lodash','../../config/pm2','../../config/logger','api','child_process','exec','bluebird'];(function(_0x44bfff,_0x54d6b4){var _0xbefe3d=function(_0x19799f){while(--_0x19799f){_0x44bfff['push'](_0x44bfff['shift']());}};_0xbefe3d(++_0x54d6b4);}(_0x524a,0xf5));var _0xa524=function(_0x57518d,_0xdc27db){_0x57518d=_0x57518d-0x0;var _0x5f1550=_0x524a[_0x57518d];return _0x5f1550;};'use strict';var _=require(_0xa524('0x0'));var pm2=require(_0xa524('0x1'));var logger=require(_0xa524('0x2'))(_0xa524('0x3'));var path=require('path');var exec=require(_0xa524('0x4'))[_0xa524('0x5')];var BPromise=require(_0xa524('0x6'));function handleEntityNotFound(_0x56ab08,_0x50ec75){return function(_0x34a665){if(!_0x34a665){_0x56ab08[_0xa524('0x7')](0x194);;}return _0x34a665;};}function respondWithResult(_0x16227b,_0x5f472f){_0x5f472f=_0x5f472f||0xc8;return function(_0x460738){if(_0x460738){return _0x16227b['status'](_0x5f472f)[_0xa524('0x8')](_0x460738);}return null;};}function handleError(_0x11aa98,_0x56849e){_0x56849e=_0x56849e||0x1f4;return function(_0x1316b0){logger[_0xa524('0x9')](_0x1316b0[_0xa524('0xa')]);if(_0x1316b0[_0xa524('0xb')]){delete _0x1316b0[_0xa524('0xb')];}_0x11aa98['status'](_0x56849e)[_0xa524('0xc')](_0x1316b0);};}function execChildProcess(){return new BPromise(function(_0x2ebea2,_0x59660a){exec('npm\x20install',function(_0x2fc0f9,_0xdbba15,_0x116fb9){logger['info'](_0xdbba15);logger['info'](_0x116fb9);if(_0x2fc0f9){logger[_0xa524('0x9')](_0x2fc0f9);return _0x59660a(_0x2fc0f9);}return _0x2ebea2(_0xdbba15);});});}exports['index']=function(_0x3f4ffc,_0x494cff){return pm2[_0xa524('0xd')]()['then'](function(_0x75bfe8){if(_0x75bfe8){var _0x281137=_['reject'](_0x75bfe8,function(_0x2d8bdb){return _0x2d8bdb[_0xa524('0xb')]===_0xa524('0xe')||_0x2d8bdb[_0xa524('0xb')]===_0xa524('0xf');});return{'rows':_0x281137,'count':_0x281137[_0xa524('0x10')]};}return null;})[_0xa524('0x11')](respondWithResult(_0x494cff,null))['catch'](handleError(_0x494cff,null));};exports[_0xa524('0x12')]=function(_0x3d8494,_0x1fd8f5){return pm2[_0xa524('0x13')](_0x3d8494[_0xa524('0x14')]['id'])[_0xa524('0x11')](respondWithResult(_0x1fd8f5,null))[_0xa524('0x11')](handleEntityNotFound(_0x1fd8f5,null))[_0xa524('0x15')](handleError(_0x1fd8f5,null));};exports['create']=function(_0x304dea,_0x20f8e1){if(_0x304dea[_0xa524('0x16')][_0xa524('0xb')]&&_0x304dea['body']['script']){var _0x40f4bd=path[_0xa524('0x17')](__dirname,_0xa524('0x18'),_0x304dea[_0xa524('0x16')][_0xa524('0x19')]);var _0x3866e2=process['cwd']();process[_0xa524('0x1a')](path[_0xa524('0x1b')](_0x40f4bd));return execChildProcess()[_0xa524('0x11')](function(_0x40fb4b){process[_0xa524('0x1a')](_0x3866e2);return pm2[_0xa524('0x1c')]({'name':_0x304dea[_0xa524('0x16')]['name'],'script':_0x40f4bd});})[_0xa524('0x11')](function(_0x221bf){pm2['dump']();return _0x221bf[0x0];})['then'](respondWithResult(_0x20f8e1,0xc9))[_0xa524('0x15')](handleError(_0x20f8e1,null));}else{return _0x20f8e1[_0xa524('0x1d')](0x1f4)[_0xa524('0xc')]({'message':_0xa524('0x1e')});}};exports[_0xa524('0x1f')]=function(_0x546060,_0x4f484a){if(_0x546060[_0xa524('0x16')]['id']){delete _0x546060[_0xa524('0x16')]['id'];}var _0x1582fa={'online':_0xa524('0x20'),'stopped':'stop'};if(_0x1582fa[_0xa524('0x21')](_0x546060[_0xa524('0x16')]['status'])){return pm2[_0x1582fa[_0x546060[_0xa524('0x16')][_0xa524('0x1d')]]](_0x546060['params']['id'])[_0xa524('0x11')](respondWithResult(_0x4f484a,0xc8))['catch'](handleError(_0x4f484a,null));}else{return _0x4f484a[_0xa524('0x1d')](0x1f4)[_0xa524('0xc')]({'message':_0xa524('0x22')});}};exports[_0xa524('0x23')]=function(_0x136e83,_0x1c706b){if(_0x136e83[_0xa524('0x16')]['id']){delete _0x136e83[_0xa524('0x16')]['id'];}if(_0x136e83[_0xa524('0x14')]['id']){return pm2['delete'](_0x136e83['params']['id'])[_0xa524('0x11')](function(_0x52dd9f){pm2['dump']();return _0x52dd9f[0x0];})[_0xa524('0x11')](respondWithResult(_0x1c706b,null))[_0xa524('0x15')](handleError(_0x1c706b,null));}else{return _0x1c706b[_0xa524('0x1d')](0x1f4)[_0xa524('0xc')]({'message':'Unknown\x20id'});}}; \ No newline at end of file +var _0x9b9b=['Unknown\x20status','delete','Unknown\x20id','../../config/pm2','path','child_process','exec','bluebird','sendStatus','status','json','name','npm\x20install','info','error','index','list','reject','express','motion2','length','then','show','describe','params','catch','create','body','script','join','../../files/plugins','cwd','chdir','dirname','dump','send','update','restart','hasOwnProperty'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9b9b,0x114));var _0xb9b9=function(_0xeed09a,_0x463e45){_0xeed09a=_0xeed09a-0x0;var _0x4ce84e=_0x9b9b[_0xeed09a];return _0x4ce84e;};'use strict';var _=require('lodash');var pm2=require(_0xb9b9('0x0'));var logger=require('../../config/logger')('api');var path=require(_0xb9b9('0x1'));var exec=require(_0xb9b9('0x2'))[_0xb9b9('0x3')];var BPromise=require(_0xb9b9('0x4'));function handleEntityNotFound(_0x1d6ab6,_0x43c8ff){return function(_0x23b016){if(!_0x23b016){_0x1d6ab6[_0xb9b9('0x5')](0x194);;}return _0x23b016;};}function respondWithResult(_0x79dd,_0x3d1a95){_0x3d1a95=_0x3d1a95||0xc8;return function(_0x85eec){if(_0x85eec){return _0x79dd[_0xb9b9('0x6')](_0x3d1a95)[_0xb9b9('0x7')](_0x85eec);}return null;};}function handleError(_0x297cb6,_0x222cba){_0x222cba=_0x222cba||0x1f4;return function(_0x319bb8){logger['error'](_0x319bb8['stack']);if(_0x319bb8[_0xb9b9('0x8')]){delete _0x319bb8[_0xb9b9('0x8')];}_0x297cb6[_0xb9b9('0x6')](_0x222cba)['send'](_0x319bb8);};}function execChildProcess(){return new BPromise(function(_0x3949d0,_0x3b6bb9){exec(_0xb9b9('0x9'),function(_0x4d8856,_0x3430a6,_0x277d86){logger[_0xb9b9('0xa')](_0x3430a6);logger[_0xb9b9('0xa')](_0x277d86);if(_0x4d8856){logger[_0xb9b9('0xb')](_0x4d8856);return _0x3b6bb9(_0x4d8856);}return _0x3949d0(_0x3430a6);});});}exports[_0xb9b9('0xc')]=function(_0x5bd18c,_0x539449){return pm2[_0xb9b9('0xd')]()['then'](function(_0xe78d58){if(_0xe78d58){var _0x50e5d6=_[_0xb9b9('0xe')](_0xe78d58,function(_0x23bac9){return _0x23bac9[_0xb9b9('0x8')]===_0xb9b9('0xf')||_0x23bac9[_0xb9b9('0x8')]===_0xb9b9('0x10');});return{'rows':_0x50e5d6,'count':_0x50e5d6[_0xb9b9('0x11')]};}return null;})[_0xb9b9('0x12')](respondWithResult(_0x539449,null))['catch'](handleError(_0x539449,null));};exports[_0xb9b9('0x13')]=function(_0x48d9ae,_0x403a5b){return pm2[_0xb9b9('0x14')](_0x48d9ae[_0xb9b9('0x15')]['id'])[_0xb9b9('0x12')](respondWithResult(_0x403a5b,null))['then'](handleEntityNotFound(_0x403a5b,null))[_0xb9b9('0x16')](handleError(_0x403a5b,null));};exports[_0xb9b9('0x17')]=function(_0x398f3d,_0xb01198){if(_0x398f3d[_0xb9b9('0x18')][_0xb9b9('0x8')]&&_0x398f3d[_0xb9b9('0x18')][_0xb9b9('0x19')]){var _0xb16391=path[_0xb9b9('0x1a')](__dirname,_0xb9b9('0x1b'),_0x398f3d[_0xb9b9('0x18')][_0xb9b9('0x19')]);var _0x4e33a0=process[_0xb9b9('0x1c')]();process[_0xb9b9('0x1d')](path[_0xb9b9('0x1e')](_0xb16391));return execChildProcess()['then'](function(_0x9898bc){process[_0xb9b9('0x1d')](_0x4e33a0);return pm2['start']({'name':_0x398f3d[_0xb9b9('0x18')][_0xb9b9('0x8')],'script':_0xb16391});})[_0xb9b9('0x12')](function(_0x40b801){pm2[_0xb9b9('0x1f')]();return _0x40b801[0x0];})['then'](respondWithResult(_0xb01198,0xc9))['catch'](handleError(_0xb01198,null));}else{return _0xb01198[_0xb9b9('0x6')](0x1f4)[_0xb9b9('0x20')]({'message':'Missing\x20name\x20and/or\x20path'});}};exports[_0xb9b9('0x21')]=function(_0x134ed6,_0x20ffc1){if(_0x134ed6[_0xb9b9('0x18')]['id']){delete _0x134ed6[_0xb9b9('0x18')]['id'];}var _0x54bf18={'online':_0xb9b9('0x22'),'stopped':'stop'};if(_0x54bf18[_0xb9b9('0x23')](_0x134ed6[_0xb9b9('0x18')]['status'])){return pm2[_0x54bf18[_0x134ed6[_0xb9b9('0x18')][_0xb9b9('0x6')]]](_0x134ed6[_0xb9b9('0x15')]['id'])['then'](respondWithResult(_0x20ffc1,0xc8))[_0xb9b9('0x16')](handleError(_0x20ffc1,null));}else{return _0x20ffc1[_0xb9b9('0x6')](0x1f4)[_0xb9b9('0x20')]({'message':_0xb9b9('0x24')});}};exports['destroy']=function(_0xc40dda,_0xdbc1f1){if(_0xc40dda['body']['id']){delete _0xc40dda[_0xb9b9('0x18')]['id'];}if(_0xc40dda[_0xb9b9('0x15')]['id']){return pm2[_0xb9b9('0x25')](_0xc40dda[_0xb9b9('0x15')]['id'])['then'](function(_0xd66ace){pm2[_0xb9b9('0x1f')]();return _0xd66ace[0x0];})[_0xb9b9('0x12')](respondWithResult(_0xdbc1f1,null))[_0xb9b9('0x16')](handleError(_0xdbc1f1,null));}else{return _0xdbc1f1['status'](0x1f4)[_0xb9b9('0x20')]({'message':_0xb9b9('0x26')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index 70038d9..5ac8b8d 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 _0x0f4f=['getQueues','exports','express','Router','../../components/auth/service','./realtime.controller','get','/agents','isAuthenticated','getAgents'];(function(_0x18cd5b,_0x10240b){var _0x5eaa52=function(_0x2bccad){while(--_0x2bccad){_0x18cd5b['push'](_0x18cd5b['shift']());}};_0x5eaa52(++_0x10240b);}(_0x0f4f,0xc0));var _0xf0f4=function(_0x4b79da,_0xe5f318){_0x4b79da=_0x4b79da-0x0;var _0x1d221b=_0x0f4f[_0x4b79da];return _0x1d221b;};'use strict';var express=require(_0xf0f4('0x0'));var router=express[_0xf0f4('0x1')]();var auth=require(_0xf0f4('0x2'));var controller=require(_0xf0f4('0x3'));router[_0xf0f4('0x4')](_0xf0f4('0x5'),auth[_0xf0f4('0x6')](),controller[_0xf0f4('0x7')]);router[_0xf0f4('0x4')]('/queues',auth[_0xf0f4('0x6')](),controller[_0xf0f4('0x8')]);module[_0xf0f4('0x9')]=router; \ No newline at end of file +var _0xc2f4=['../../components/auth/service','./realtime.controller','get','isAuthenticated','/queues','getQueues','exports','Router'];(function(_0x3de51e,_0x24bf04){var _0x282f84=function(_0x21bdb4){while(--_0x21bdb4){_0x3de51e['push'](_0x3de51e['shift']());}};_0x282f84(++_0x24bf04);}(_0xc2f4,0x157));var _0x4c2f=function(_0x48bee1,_0x29f43d){_0x48bee1=_0x48bee1-0x0;var _0x582372=_0xc2f4[_0x48bee1];return _0x582372;};'use strict';var express=require('express');var router=express[_0x4c2f('0x0')]();var auth=require(_0x4c2f('0x1'));var controller=require(_0x4c2f('0x2'));router[_0x4c2f('0x3')]('/agents',auth[_0x4c2f('0x4')](),controller['getAgents']);router[_0x4c2f('0x3')](_0x4c2f('0x5'),auth[_0x4c2f('0x4')](),controller[_0x4c2f('0x6')]);module[_0x4c2f('0x7')]=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index 82f85cc..3291d3a 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 _0x5d17=['Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','VoiceQueuesChannels','loggedIn','available','waiting','outbound','pTalking','message','dialActive','dialMethod','Trunk','startPredictive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveIntervalMaxThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','map','get','agents','paused','talking','busy','originated','find','pick','length','some','connectedlinenum','internal','toString','getMembers','UserId','accountcode','online','voiceStatus','loggedInDb','push','User','Queue','findAll','QueueId','idle','unknown','unavailable','ringing','faxPause','mailPause','openchannelPause','voicePause','whatsappPause','every','filter','pause','faxStatus','mailStatus','openchannelStatus','whatsappStatus','getAgents','userpic','lastPauseAt','chatPause','smsPause','openchannelCapacity','mailCapacity','smsCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','smsStatus','chatStatusTime','openchannelStatusTime','mailStatusTime','smsStatusTime','faxStatusTime','destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','resolve','rawAttributes','fieldName','type','key','role','agent','query','getOptions','raw','user','userProfileId','sort','UserProfile','getResources','findAndCountAll','count','rows','omit','globalStatus','globalStatusFilter','pauseTypeFilter','pauseType','getQueues','mail','chat','sms','openchannel','fax','whatsapp','channel','includes','toLowerCase','QueueCampaigns','all','util','lodash','../../config/logger','api','../../mysqldb','http','client','offset','undefined','limit','status','set','Content-Range','json','error','stack','name','request','Agents','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','then','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','catch','voice','startCase','Queues'];(function(_0x4fbfd9,_0x3ab91a){var _0x31dc94=function(_0x11e53b){while(--_0x11e53b){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x31dc94(++_0x3ab91a);}(_0x5d17,0x114));var _0x75d1=function(_0x26d034,_0x2c22db){_0x26d034=_0x26d034-0x0;var _0x3015aa=_0x5d17[_0x26d034];return _0x3015aa;};'use strict';var util=require(_0x75d1('0x0'));var _=require(_0x75d1('0x1'));var jayson=require('jayson/promise');var qs=require('../../components/parsers/qs');var logger=require(_0x75d1('0x2'))(_0x75d1('0x3'));var db=require(_0x75d1('0x4'))['db'];var amiClient=jayson['client'][_0x75d1('0x5')]({'port':0x232a});var routingClient=jayson[_0x75d1('0x6')][_0x75d1('0x5')]({'port':0x232c});function respondWithFilteredResult(_0x32bd45,_0x56ac0a){return function(_0x458681){if(_0x458681){var _0x116a51=typeof _0x56ac0a[_0x75d1('0x7')]===_0x75d1('0x8')&&typeof _0x56ac0a[_0x75d1('0x9')]===_0x75d1('0x8');var _0xf9f8e=_0x458681['count'];var _0x4cf632=_0x116a51?0x0:_0x56ac0a[_0x75d1('0x7')];var _0x4a3bb3=_0x116a51?_0x458681['count']:_0x56ac0a[_0x75d1('0x7')]+_0x56ac0a[_0x75d1('0x9')];var _0x4d4aa1;if(_0x4a3bb3>=_0xf9f8e){_0x4a3bb3=_0xf9f8e;_0x4d4aa1=0xc8;}else{_0x4d4aa1=0xce;}_0x32bd45[_0x75d1('0xa')](_0x4d4aa1);return _0x32bd45[_0x75d1('0xb')](_0x75d1('0xc'),_0x4cf632+'-'+_0x4a3bb3+'/'+_0xf9f8e)[_0x75d1('0xd')](_0x458681);}return null;};}function handleError(_0x6c1265,_0xd089cf){_0xd089cf=_0xd089cf||0x1f4;return function(_0x49667a){logger[_0x75d1('0xe')](_0x49667a[_0x75d1('0xf')]);if(_0x49667a[_0x75d1('0x10')]){delete _0x49667a[_0x75d1('0x10')];}_0x6c1265['status'](_0xd089cf)['send'](_0x49667a);};}function getRealtimeAgents(){return new Promise(function(_0x55b8a0,_0x24ba98){return amiClient[_0x75d1('0x11')](_0x75d1('0x12'),{})['then'](function(_0x1f9620){if(_0x1f9620[_0x75d1('0xe')])throw new Error(_0x75d1('0x13'));var _0x269e82=_0x1f9620[_0x75d1('0x14')];return routingClient[_0x75d1('0x11')](_0x75d1('0x12'),{})[_0x75d1('0x15')](function(_0x1bc5de){if(_0x1bc5de[_0x75d1('0xe')])throw new Error(_0x75d1('0x16'));var _0x5761db=_0x1bc5de['result'];return _0x55b8a0(_[_0x75d1('0x17')]({},_0x269e82,_0x5761db));});})[_0x75d1('0x18')](function(_0x56730d){_0x24ba98(_0x56730d);});});}function getRealtimeQueues(_0x31eb88,_0x406143){return new Promise(function(_0x579731,_0xf6cc70){var _0xa42dbe=_0x406143===_0x75d1('0x19')?amiClient:routingClient;return _0xa42dbe['request'](_[_0x75d1('0x1a')](_0x406143)+_0x75d1('0x1b'),_0x31eb88)['then'](function(_0x1cb58c){if(_0x1cb58c[_0x75d1('0xe')])throw new Error(util['format'](_0x75d1('0x1c'),_0x406143));return _0x579731(_0x1cb58c['result']);})[_0x75d1('0x18')](function(_0xc256af){_0xf6cc70(_0xc256af);});});}function getRealtimeVoiceQueueChannels(){return new Promise(function(_0x345cf5,_0x4b2a25){return amiClient['request'](_0x75d1('0x1d'),{})[_0x75d1('0x15')](function(_0x315ce5){if(_0x315ce5[_0x75d1('0xe')])throw new Error('Unable\x20to\x20retrieve\x20voice\x20queues\x20channels');return _0x345cf5(_0x315ce5[_0x75d1('0x14')]);})[_0x75d1('0x18')](function(_0x367238){_0x4b2a25(_0x367238);});});}function initializeQueues(_0x51138e,_0x54095d,_0x57efd6,_0x364dc9){var _0x30d9f3=[_0x75d1('0x1e'),_0x75d1('0x1f'),_0x75d1('0x20'),'talking','paused'];if(_0x57efd6===_0x75d1('0x19')&&_0x364dc9===_0x75d1('0x21')){_0x30d9f3['push'](_0x75d1('0x22'),'originated',_0x75d1('0x23'),_0x75d1('0x24'),_0x75d1('0x25'),_0x75d1('0x26'),_0x75d1('0x27'),'startProgressive',_0x75d1('0x28'),_0x75d1('0x29'),_0x75d1('0x2a'),_0x75d1('0x2b'),'dialPredictiveInterval',_0x75d1('0x2c'),'dialPredictiveIntervalMinThreshold',_0x75d1('0x2d'),_0x75d1('0x2e'),'predictiveIntervalAnsweredCalls',_0x75d1('0x2f'),_0x75d1('0x30'),_0x75d1('0x31'),_0x75d1('0x32'));}return _0x51138e[_0x75d1('0x33')](function(_0x495aa4){var _0x23f94a=_0x495aa4[_0x75d1('0x34')]({'plain':!![]});_0x23f94a[_0x75d1('0x35')]=[];_0x23f94a[_0x75d1('0x36')]=0x0;_0x23f94a['loggedInDb']=0x0;_0x23f94a['loggedIn']=0x0;_0x23f94a['available']=0x0;_0x23f94a[_0x75d1('0x20')]=0x0;if(_0x57efd6===_0x75d1('0x19')){_0x23f94a[_0x75d1('0x37')]=0x0;_0x23f94a[_0x75d1('0x38')]=0x0;if(_0x364dc9===_0x75d1('0x21')){_0x23f94a[_0x75d1('0x22')]=0x0;_0x23f94a[_0x75d1('0x39')]=0x0;}}var _0x2dce68=_[_0x75d1('0x3a')](_0x54095d,['id',_0x23f94a['id']]);if(_0x2dce68)_['merge'](_0x23f94a,_[_0x75d1('0x3b')](_0x2dce68,_0x30d9f3));return _0x23f94a;});}function updateAgentVoiceStatus(_0x429c38,_0x39ac3e,_0x62b37e){var _0x6d48a5=_['filter'](_0x62b37e,['queue',_0x39ac3e['name']]);if(_0x6d48a5[_0x75d1('0x3c')]===0x0)return _0x429c38[_0x75d1('0x38')]=!![];if(_[_0x75d1('0x3d')](_0x6d48a5,[_0x75d1('0x3e'),_0x429c38[_0x75d1('0x3f')][_0x75d1('0x40')]()]))return _0x429c38['talking']=!![];if(!_0x429c38['talking'])return _0x429c38['busy']=!![];}function getVoiceQueueAgents(_0x3f2569,_0x4cb084,_0x53a1af,_0x450aa5){var _0x21bfd8=_[_0x75d1('0x3a')](_0x4cb084,['id',_0x3f2569['id']]);if(!_0x21bfd8)return _0x3f2569;return _0x21bfd8[_0x75d1('0x41')]({'raw':!![]})['then'](function(_0x44e6c2){for(var _0x2acdc8=0x0;_0x2acdc8<_0x44e6c2[_0x75d1('0x3c')];_0x2acdc8++){var _0x3d4137=_[_0x75d1('0x3a')](_0x53a1af,['id',_0x44e6c2[_0x2acdc8][_0x75d1('0x42')]]);if(!_0x3d4137){_0x3d4137={'id':_0x44e6c2[_0x2acdc8][_0x75d1('0x42')],'name':_0x44e6c2[_0x2acdc8][_0x75d1('0x42')],'accountcode':'','online':![]};}var _0x2c88f2={'id':_0x3d4137['id'],'name':_0x3d4137[_0x75d1('0x10')],'internal':_0x3d4137[_0x75d1('0x43')],'online':Boolean(_0x3d4137[_0x75d1('0x44')]),'paused':Boolean(_0x44e6c2[_0x2acdc8][_0x75d1('0x36')])};if(_0x3d4137[_0x75d1('0x45')]===_0x75d1('0x37'))updateAgentVoiceStatus(_0x2c88f2,_0x3f2569,_0x450aa5);if(_0x2c88f2[_0x75d1('0x44')])_0x3f2569[_0x75d1('0x46')]++;if(_0x2c88f2[_0x75d1('0x38')])_0x3f2569[_0x75d1('0x38')]++;if(_0x2c88f2[_0x75d1('0x36')]&&!_0x2c88f2[_0x75d1('0x38')]&&!_0x2c88f2[_0x75d1('0x37')])_0x3f2569['paused']++;_0x3f2569['agents'][_0x75d1('0x47')](_0x2c88f2);}return _0x3f2569;});}function getQueueAgents(_0x40b74e,_0x429909,_0x1d9853){var _0x4af3bb=_0x75d1('0x48')+_[_0x75d1('0x1a')](_0x1d9853)+_0x75d1('0x49');var _0x329cec=_0x1d9853+'Pause';return db[_0x4af3bb][_0x75d1('0x4a')]({'where':{[_[_0x75d1('0x1a')](_0x1d9853)+_0x75d1('0x4b')]:_0x40b74e['id']},'raw':!![]})[_0x75d1('0x15')](function(_0x5b486d){for(var _0x34d132=0x0;_0x34d132<_0x5b486d['length'];_0x34d132++){var _0x130dd3=_[_0x75d1('0x3a')](_0x429909,['id',_0x5b486d[_0x34d132][_0x75d1('0x42')]]);if(!_0x130dd3){_0x130dd3={'id':_0x5b486d[_0x34d132][_0x75d1('0x42')],'name':_0x5b486d[_0x34d132][_0x75d1('0x42')],'online':![],['pauseField']:![]};}var _0x2137e1={'id':_0x130dd3['id'],'name':_0x130dd3['name'],'online':Boolean(_0x130dd3[_0x75d1('0x44')]),'paused':Boolean(_0x130dd3[_0x329cec])};if(_0x2137e1['online'])_0x40b74e['loggedInDb']++;_0x40b74e[_0x75d1('0x35')][_0x75d1('0x47')](_0x2137e1);}return _0x40b74e;});}function isIdle(_0x4760cf){return _0x4760cf===_0x75d1('0x4c')||_0x4760cf===_0x75d1('0x4d')||_0x4760cf===_0x75d1('0x4e')||_0x4760cf===_0x75d1('0x4f')||_['isNil'](_0x4760cf);}function isAgentPaused(_0x5d7ebf,_0x1edc9d){var _0x8ce3d2=[_0x5d7ebf['chatPause'],_0x5d7ebf[_0x75d1('0x50')],_0x5d7ebf[_0x75d1('0x51')],_0x5d7ebf[_0x75d1('0x52')],_0x5d7ebf['smsPause'],_0x5d7ebf[_0x75d1('0x53')],_0x5d7ebf[_0x75d1('0x54')]];if(!_0x1edc9d)return _[_0x75d1('0x55')](_0x8ce3d2);var _0x3be4b5=_[_0x75d1('0x56')](_0x8ce3d2);return _0x3be4b5[_0x75d1('0x3c')]>0x0&&_0x3be4b5[_0x75d1('0x3c')]<_0x8ce3d2['length']?!![]:![];}function isAgentIdle(_0x1eaa66){if(_0x1eaa66[_0x75d1('0x45')]!==_0x75d1('0x4c')&&_0x1eaa66[_0x75d1('0x53')]){_0x1eaa66[_0x75d1('0x45')]=_0x75d1('0x57');return![];}return _[_0x75d1('0x55')]([_0x1eaa66['chatStatus'],_0x1eaa66[_0x75d1('0x58')],_0x1eaa66[_0x75d1('0x59')],_0x1eaa66[_0x75d1('0x5a')],_0x1eaa66['smsStatus'],_0x1eaa66[_0x75d1('0x45')],_0x1eaa66[_0x75d1('0x5b')]],isIdle);}function getAgentStatus(_0x16c51){var _0x382760=_0x75d1('0x4d');if(isAgentPaused(_0x16c51))_0x382760=_0x75d1('0x57');else if(isAgentPaused(_0x16c51,!![]))_0x382760='*pause';else if(isAgentIdle(_0x16c51))_0x382760=_0x75d1('0x4c');else _0x382760=_0x75d1('0x38');return _0x382760;}exports[_0x75d1('0x5c')]=function(_0x46e665,_0x2e746a){var _0x2f6048={'count':0x0,'rows':[]},_0x2d1648={},_0x104a44,_0x131082,_0x43769e=[_0x75d1('0x5d'),'online','lastLoginAt',_0x75d1('0x5e'),'pauseType',_0x75d1('0x5e'),_0x75d1('0x3f'),'address',_0x75d1('0x5f'),_0x75d1('0x52'),_0x75d1('0x51'),_0x75d1('0x60'),_0x75d1('0x54'),_0x75d1('0x50'),_0x75d1('0x53'),'chatCapacity',_0x75d1('0x61'),_0x75d1('0x62'),_0x75d1('0x63'),_0x75d1('0x64'),_0x75d1('0x65'),_0x75d1('0x66'),_0x75d1('0x67'),_0x75d1('0x68'),_0x75d1('0x69'),_0x75d1('0x6a'),'faxCurrentCapacity','chatStatus',_0x75d1('0x5a'),_0x75d1('0x59'),_0x75d1('0x6b'),'whatsappStatus',_0x75d1('0x58'),'voiceStatus',_0x75d1('0x6c'),_0x75d1('0x6d'),_0x75d1('0x6e'),_0x75d1('0x6f'),'whatsappStatusTime',_0x75d1('0x70'),'voiceStatusTime','queue',_0x75d1('0x71'),_0x75d1('0x72'),_0x75d1('0x73'),_0x75d1('0x74'),'routealias'],_0x1038d2=['chatPause',_0x75d1('0x52'),_0x75d1('0x51'),_0x75d1('0x60'),_0x75d1('0x54'),_0x75d1('0x50'),'voicePause',_0x75d1('0x44')];Promise[_0x75d1('0x75')]()[_0x75d1('0x15')](function(){var _0x3c6bd7=_[_0x75d1('0x33')](db[_0x75d1('0x48')][_0x75d1('0x76')],function(_0x1092fb){return{'name':_0x1092fb[_0x75d1('0x77')],'type':_0x1092fb[_0x75d1('0x78')][_0x75d1('0x79')]};});_0x46e665['query'][_0x75d1('0x7a')]=_0x75d1('0x7b');_0x46e665[_0x75d1('0x7c')][_0x75d1('0x44')]=!![];_0x2d1648=qs[_0x75d1('0x7d')](_0x3c6bd7,_0x46e665);_0x2d1648[_0x75d1('0x7e')]=!![];if(_0x46e665[_0x75d1('0x7f')]['role']==='user'){var _0x1b1cc4={'params':{'id':_0x46e665[_0x75d1('0x7f')][_0x75d1('0x80')]},'query':{'section':_0x75d1('0x12'),'role':_0x75d1('0x7b'),'online':!![],'nolimit':_0x46e665['query']['nolimit'],'sort':_0x46e665[_0x75d1('0x7c')][_0x75d1('0x81')],'filter':_0x46e665['query'][_0x75d1('0x56')],'raw':!![]}};return db[_0x75d1('0x82')][_0x75d1('0x83')](_0x1b1cc4);}return db[_0x75d1('0x48')][_0x75d1('0x84')](_0x2d1648);})[_0x75d1('0x15')](function(_0x5a4abc){_0x2f6048['count']=_0x5a4abc[_0x75d1('0x85')];_0x104a44=_0x5a4abc[_0x75d1('0x86')];return getRealtimeAgents();})['then'](function(_0x45e61a){_0x131082=_0x45e61a['rows'];return _0x104a44[_0x75d1('0x33')](function(_0x2730f6){var _0x30fd13=_['find'](_0x131082,['id',_0x2730f6['id']]);if(_0x30fd13)_[_0x75d1('0x17')](_0x2730f6,_[_0x75d1('0x3b')](_[_0x75d1('0x87')](_0x30fd13,_0x1038d2),_0x43769e));_0x2730f6[_0x75d1('0x88')]=getAgentStatus(_0x2730f6);return _0x2730f6;});})[_0x75d1('0x15')](function(_0x50d202){if(_0x46e665['query'][_0x75d1('0x89')]){var _0x58d20b=_[_0x75d1('0x56')](_0x50d202,[_0x75d1('0x88'),_0x46e665[_0x75d1('0x7c')]['globalStatusFilter']]);if(_0x46e665['query'][_0x75d1('0x8a')]){_0x58d20b=_['filter'](_0x58d20b,[_0x75d1('0x8b'),_0x46e665[_0x75d1('0x7c')][_0x75d1('0x8a')]]);}}_0x2f6048['rows']=_0x58d20b||_0x50d202;return _0x2f6048;})[_0x75d1('0x15')](respondWithFilteredResult(_0x2e746a,_0x2d1648))[_0x75d1('0x18')](handleError(_0x2e746a,null));};exports[_0x75d1('0x8c')]=function(_0x41981f,_0x3e2334){var _0x1a40b5=[_0x75d1('0x8d'),_0x75d1('0x8e'),_0x75d1('0x8f'),_0x75d1('0x90'),_0x75d1('0x91'),_0x75d1('0x92'),_0x75d1('0x19')];var _0x44ef76={'count':0x0,'rows':[]},_0x4b4a52={},_0x574cb0,_0x410fa1,_0x1eb55e,_0x58079c,_0xf54f;Promise['resolve']()['then'](function(){if(_0x41981f['query'][_0x75d1('0x93')]){if(!_[_0x75d1('0x94')](_0x1a40b5,_0x41981f[_0x75d1('0x7c')][_0x75d1('0x93')][_0x75d1('0x95')]()))throw new Error('Invalid\x20channel');_0x574cb0=_0x41981f[_0x75d1('0x7c')][_0x75d1('0x93')][_0x75d1('0x95')]();}var _0x13f54a=_[_0x75d1('0x1a')](_0x574cb0)+'Queue';var _0x1113a8=_['map'](db[_0x13f54a][_0x75d1('0x76')],function(_0x26e1ad){return{'name':_0x26e1ad[_0x75d1('0x77')],'type':_0x26e1ad['type']['key']};});_0x4b4a52=qs['getOptions'](_0x1113a8,_0x41981f);if(_0x41981f[_0x75d1('0x7f')][_0x75d1('0x7a')]===_0x75d1('0x7f')){var _0x22caf3={'params':{'id':_0x41981f[_0x75d1('0x7f')][_0x75d1('0x80')]},'query':{'section':_0x574cb0==='voice'&&_0x41981f[_0x75d1('0x7c')][_0x75d1('0x78')]==='outbound'?_0x75d1('0x96'):_['startCase'](_0x574cb0)+'Queues','type':_0x41981f['query'][_0x75d1('0x78')],'nolimit':!![],'sort':'name','filter':_0x41981f['query'][_0x75d1('0x56')]}};return db['UserProfile'][_0x75d1('0x83')](_0x22caf3);}return db[_0x13f54a][_0x75d1('0x84')](_0x4b4a52);})[_0x75d1('0x15')](function(_0xc939c9){_0x44ef76[_0x75d1('0x85')]=_0xc939c9[_0x75d1('0x85')];_0x410fa1=_0xc939c9[_0x75d1('0x86')];return getRealtimeQueues(_0x41981f,_0x574cb0);})[_0x75d1('0x15')](function(_0x51b682){_0x58079c=_0x51b682[_0x75d1('0x86')];return getRealtimeAgents();})['then'](function(_0x9ec663){_0x1eb55e=_0x9ec663[_0x75d1('0x86')];if(_0x574cb0!=_0x75d1('0x19'))return;return getRealtimeVoiceQueueChannels();})['then'](function(_0x10bc92){_0xf54f=_0x10bc92?_0x10bc92[_0x75d1('0x86')]:[];return initializeQueues(_0x410fa1,_0x58079c,_0x574cb0,_0x41981f[_0x75d1('0x7c')][_0x75d1('0x78')]);})[_0x75d1('0x15')](function(_0x2ee3a0){var _0x1bb574=_0x2ee3a0['map'](function(_0xccae6a){if(_0x574cb0===_0x75d1('0x19'))return getVoiceQueueAgents(_0xccae6a,_0x410fa1,_0x1eb55e,_0xf54f);else return getQueueAgents(_0xccae6a,_0x1eb55e,_0x574cb0);});return Promise[_0x75d1('0x97')](_0x1bb574);})[_0x75d1('0x15')](function(_0x44143e){_0x44ef76['rows']=_0x44143e;return _0x44ef76;})['then'](respondWithFilteredResult(_0x3e2334,_0x4b4a52))[_0x75d1('0x18')](handleError(_0x3e2334,null));}; \ No newline at end of file +var _0x9536=['talking','busy','pick','filter','queue','length','some','connectedlinenum','internal','toString','find','UserId','accountcode','online','voiceStatus','agents','push','Pause','findAll','loggedInDb','idle','unknown','unavailable','isNil','chatPause','faxPause','mailPause','openchannelPause','smsPause','voicePause','whatsappPause','every','pause','chatStatus','faxStatus','whatsappStatus','*pause','userpic','lastPauseAt','pauseType','chatCapacity','smsCapacity','whatsappCapacity','faxCapacity','mailCurrentCapacity','smsCurrentCapacity','faxCurrentCapacity','mailStatus','smsStatus','openchannelStatusTime','mailStatusTime','smsStatusTime','voiceStatusTime','destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent','routealias','resolve','rawAttributes','fieldName','type','key','agent','getOptions','raw','user','userProfileId','query','nolimit','sort','UserProfile','getResources','User','rows','globalStatusFilter','globalStatus','pauseTypeFilter','mail','sms','openchannel','fax','whatsapp','channel','includes','toLowerCase','Queue','role','QueueCampaigns','Queues','findAndCountAll','all','util','lodash','jayson/promise','../../components/parsers/qs','api','client','http','offset','undefined','limit','count','status','set','Content-Range','json','error','stack','name','send','request','Agents','then','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','catch','startCase','format','VoiceQueuesChannels','loggedIn','waiting','paused','voice','outbound','pTalking','originated','message','dialMethod','Trunk','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMinThreshold','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','map','available'];(function(_0x34d94a,_0x3cfd9a){var _0x6e6ff1=function(_0x39df54){while(--_0x39df54){_0x34d94a['push'](_0x34d94a['shift']());}};_0x6e6ff1(++_0x3cfd9a);}(_0x9536,0x179));var _0x6953=function(_0x5c8827,_0x5bc5d7){_0x5c8827=_0x5c8827-0x0;var _0x50ffd5=_0x9536[_0x5c8827];return _0x50ffd5;};'use strict';var util=require(_0x6953('0x0'));var _=require(_0x6953('0x1'));var jayson=require(_0x6953('0x2'));var qs=require(_0x6953('0x3'));var logger=require('../../config/logger')(_0x6953('0x4'));var db=require('../../mysqldb')['db'];var amiClient=jayson[_0x6953('0x5')][_0x6953('0x6')]({'port':0x232a});var routingClient=jayson[_0x6953('0x5')][_0x6953('0x6')]({'port':0x232c});function respondWithFilteredResult(_0x2f3cc3,_0x494ac2){return function(_0x2b273e){if(_0x2b273e){var _0x2bb026=typeof _0x494ac2[_0x6953('0x7')]===_0x6953('0x8')&&typeof _0x494ac2[_0x6953('0x9')]==='undefined';var _0x3e8786=_0x2b273e[_0x6953('0xa')];var _0x449acb=_0x2bb026?0x0:_0x494ac2['offset'];var _0x41f41b=_0x2bb026?_0x2b273e[_0x6953('0xa')]:_0x494ac2[_0x6953('0x7')]+_0x494ac2[_0x6953('0x9')];var _0x448c89;if(_0x41f41b>=_0x3e8786){_0x41f41b=_0x3e8786;_0x448c89=0xc8;}else{_0x448c89=0xce;}_0x2f3cc3[_0x6953('0xb')](_0x448c89);return _0x2f3cc3[_0x6953('0xc')](_0x6953('0xd'),_0x449acb+'-'+_0x41f41b+'/'+_0x3e8786)[_0x6953('0xe')](_0x2b273e);}return null;};}function handleError(_0x57652e,_0x358388){_0x358388=_0x358388||0x1f4;return function(_0x513dd0){logger[_0x6953('0xf')](_0x513dd0[_0x6953('0x10')]);if(_0x513dd0[_0x6953('0x11')]){delete _0x513dd0[_0x6953('0x11')];}_0x57652e[_0x6953('0xb')](_0x358388)[_0x6953('0x12')](_0x513dd0);};}function getRealtimeAgents(){return new Promise(function(_0x175fa9,_0x27a57c){return amiClient[_0x6953('0x13')](_0x6953('0x14'),{})[_0x6953('0x15')](function(_0x548473){if(_0x548473['error'])throw new Error(_0x6953('0x16'));var _0x44e8a2=_0x548473[_0x6953('0x17')];return routingClient[_0x6953('0x13')]('Agents',{})[_0x6953('0x15')](function(_0x2da771){if(_0x2da771['error'])throw new Error(_0x6953('0x18'));var _0x3207dd=_0x2da771[_0x6953('0x17')];return _0x175fa9(_[_0x6953('0x19')]({},_0x44e8a2,_0x3207dd));});})[_0x6953('0x1a')](function(_0x4a450c){_0x27a57c(_0x4a450c);});});}function getRealtimeQueues(_0x3a93e1,_0x1b7123){return new Promise(function(_0x31d5fd,_0x2ba433){var _0x41f021=_0x1b7123==='voice'?amiClient:routingClient;return _0x41f021[_0x6953('0x13')](_[_0x6953('0x1b')](_0x1b7123)+'Queues',_0x3a93e1)[_0x6953('0x15')](function(_0x40c9d1){if(_0x40c9d1[_0x6953('0xf')])throw new Error(util[_0x6953('0x1c')]('Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues',_0x1b7123));return _0x31d5fd(_0x40c9d1[_0x6953('0x17')]);})[_0x6953('0x1a')](function(_0x2a7f6a){_0x2ba433(_0x2a7f6a);});});}function getRealtimeVoiceQueueChannels(){return new Promise(function(_0x508ea7,_0x495ebd){return amiClient['request'](_0x6953('0x1d'),{})[_0x6953('0x15')](function(_0x550be4){if(_0x550be4[_0x6953('0xf')])throw new Error('Unable\x20to\x20retrieve\x20voice\x20queues\x20channels');return _0x508ea7(_0x550be4[_0x6953('0x17')]);})[_0x6953('0x1a')](function(_0xcdbce8){_0x495ebd(_0xcdbce8);});});}function initializeQueues(_0x2cc01e,_0x191d80,_0x1497e3,_0x53d3dc){var _0x3dd890=[_0x6953('0x1e'),'available',_0x6953('0x1f'),'talking',_0x6953('0x20')];if(_0x1497e3===_0x6953('0x21')&&_0x53d3dc===_0x6953('0x22')){_0x3dd890['push'](_0x6953('0x23'),_0x6953('0x24'),_0x6953('0x25'),'dialActive',_0x6953('0x26'),_0x6953('0x27'),'startPredictive','startProgressive',_0x6953('0x28'),_0x6953('0x29'),_0x6953('0x2a'),_0x6953('0x2b'),_0x6953('0x2c'),'dialPredictiveIntervalMaxThreshold',_0x6953('0x2d'),'predictiveIntervalAvailable',_0x6953('0x2e'),_0x6953('0x2f'),'predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit',_0x6953('0x30'),_0x6953('0x31'));}return _0x2cc01e[_0x6953('0x32')](function(_0x4ffa69){var _0x28cb92=_0x4ffa69['get']({'plain':!![]});_0x28cb92['agents']=[];_0x28cb92['paused']=0x0;_0x28cb92['loggedInDb']=0x0;_0x28cb92[_0x6953('0x1e')]=0x0;_0x28cb92[_0x6953('0x33')]=0x0;_0x28cb92[_0x6953('0x1f')]=0x0;if(_0x1497e3===_0x6953('0x21')){_0x28cb92[_0x6953('0x34')]=0x0;_0x28cb92[_0x6953('0x35')]=0x0;if(_0x53d3dc==='outbound'){_0x28cb92[_0x6953('0x23')]=0x0;_0x28cb92['originated']=0x0;}}var _0x199c67=_['find'](_0x191d80,['id',_0x28cb92['id']]);if(_0x199c67)_[_0x6953('0x19')](_0x28cb92,_[_0x6953('0x36')](_0x199c67,_0x3dd890));return _0x28cb92;});}function updateAgentVoiceStatus(_0xd81149,_0x248fe7,_0x562792){var _0x13c677=_[_0x6953('0x37')](_0x562792,[_0x6953('0x38'),_0x248fe7[_0x6953('0x11')]]);if(_0x13c677[_0x6953('0x39')]===0x0)return _0xd81149[_0x6953('0x35')]=!![];if(_[_0x6953('0x3a')](_0x13c677,[_0x6953('0x3b'),_0xd81149[_0x6953('0x3c')][_0x6953('0x3d')]()]))return _0xd81149[_0x6953('0x34')]=!![];if(!_0xd81149['talking'])return _0xd81149[_0x6953('0x35')]=!![];}function getVoiceQueueAgents(_0x3c03ab,_0x1f6571,_0x5dff18,_0x47e7e7){var _0x44faff=_['find'](_0x1f6571,['id',_0x3c03ab['id']]);if(!_0x44faff)return _0x3c03ab;return _0x44faff['getMembers']({'raw':!![]})[_0x6953('0x15')](function(_0x7e7b68){for(var _0x4b5e1c=0x0;_0x4b5e1c<_0x7e7b68[_0x6953('0x39')];_0x4b5e1c++){var _0x263728=_[_0x6953('0x3e')](_0x5dff18,['id',_0x7e7b68[_0x4b5e1c][_0x6953('0x3f')]]);if(!_0x263728){_0x263728={'id':_0x7e7b68[_0x4b5e1c][_0x6953('0x3f')],'name':_0x7e7b68[_0x4b5e1c][_0x6953('0x3f')],'accountcode':'','online':![]};}var _0x51137b={'id':_0x263728['id'],'name':_0x263728[_0x6953('0x11')],'internal':_0x263728[_0x6953('0x40')],'online':Boolean(_0x263728[_0x6953('0x41')]),'paused':Boolean(_0x7e7b68[_0x4b5e1c][_0x6953('0x20')])};if(_0x263728[_0x6953('0x42')]===_0x6953('0x34'))updateAgentVoiceStatus(_0x51137b,_0x3c03ab,_0x47e7e7);if(_0x51137b['online'])_0x3c03ab['loggedInDb']++;if(_0x51137b[_0x6953('0x35')])_0x3c03ab['busy']++;if(_0x51137b['paused']&&!_0x51137b[_0x6953('0x35')]&&!_0x51137b[_0x6953('0x34')])_0x3c03ab[_0x6953('0x20')]++;_0x3c03ab[_0x6953('0x43')][_0x6953('0x44')](_0x51137b);}return _0x3c03ab;});}function getQueueAgents(_0x5ac8f7,_0x4d43fd,_0x1de4e4){var _0x452b69='User'+_[_0x6953('0x1b')](_0x1de4e4)+'Queue';var _0x166b13=_0x1de4e4+_0x6953('0x45');return db[_0x452b69][_0x6953('0x46')]({'where':{[_[_0x6953('0x1b')](_0x1de4e4)+'QueueId']:_0x5ac8f7['id']},'raw':!![]})[_0x6953('0x15')](function(_0x424621){for(var _0x4d3868=0x0;_0x4d3868<_0x424621[_0x6953('0x39')];_0x4d3868++){var _0x296d81=_[_0x6953('0x3e')](_0x4d43fd,['id',_0x424621[_0x4d3868][_0x6953('0x3f')]]);if(!_0x296d81){_0x296d81={'id':_0x424621[_0x4d3868][_0x6953('0x3f')],'name':_0x424621[_0x4d3868][_0x6953('0x3f')],'online':![],['pauseField']:![]};}var _0x13d1a6={'id':_0x296d81['id'],'name':_0x296d81[_0x6953('0x11')],'online':Boolean(_0x296d81[_0x6953('0x41')]),'paused':Boolean(_0x296d81[_0x166b13])};if(_0x13d1a6[_0x6953('0x41')])_0x5ac8f7[_0x6953('0x47')]++;_0x5ac8f7['agents'][_0x6953('0x44')](_0x13d1a6);}return _0x5ac8f7;});}function isIdle(_0x4c9d36){return _0x4c9d36===_0x6953('0x48')||_0x4c9d36===_0x6953('0x49')||_0x4c9d36===_0x6953('0x4a')||_0x4c9d36==='ringing'||_[_0x6953('0x4b')](_0x4c9d36);}function isAgentPaused(_0x2a4e54,_0x506561){var _0x525145=[_0x2a4e54[_0x6953('0x4c')],_0x2a4e54[_0x6953('0x4d')],_0x2a4e54[_0x6953('0x4e')],_0x2a4e54[_0x6953('0x4f')],_0x2a4e54[_0x6953('0x50')],_0x2a4e54[_0x6953('0x51')],_0x2a4e54[_0x6953('0x52')]];if(!_0x506561)return _[_0x6953('0x53')](_0x525145);var _0x2baf90=_[_0x6953('0x37')](_0x525145);return _0x2baf90[_0x6953('0x39')]>0x0&&_0x2baf90['length']<_0x525145['length']?!![]:![];}function isAgentIdle(_0x14a7bf){if(_0x14a7bf[_0x6953('0x42')]!==_0x6953('0x48')&&_0x14a7bf[_0x6953('0x51')]){_0x14a7bf[_0x6953('0x42')]=_0x6953('0x54');return![];}return _[_0x6953('0x53')]([_0x14a7bf[_0x6953('0x55')],_0x14a7bf[_0x6953('0x56')],_0x14a7bf['mailStatus'],_0x14a7bf['openchannelStatus'],_0x14a7bf['smsStatus'],_0x14a7bf['voiceStatus'],_0x14a7bf[_0x6953('0x57')]],isIdle);}function getAgentStatus(_0x20ceda){var _0x51372b='unknown';if(isAgentPaused(_0x20ceda))_0x51372b='pause';else if(isAgentPaused(_0x20ceda,!![]))_0x51372b=_0x6953('0x58');else if(isAgentIdle(_0x20ceda))_0x51372b=_0x6953('0x48');else _0x51372b=_0x6953('0x35');return _0x51372b;}exports['getAgents']=function(_0x5b696e,_0x400486){var _0x40033a={'count':0x0,'rows':[]},_0x53e631={},_0x58fcb3,_0x29937b,_0xafbd35=[_0x6953('0x59'),_0x6953('0x41'),'lastLoginAt',_0x6953('0x5a'),_0x6953('0x5b'),'lastPauseAt',_0x6953('0x3c'),'address',_0x6953('0x4c'),_0x6953('0x4f'),_0x6953('0x4e'),_0x6953('0x50'),'whatsappPause',_0x6953('0x4d'),_0x6953('0x51'),_0x6953('0x5c'),'openchannelCapacity','mailCapacity',_0x6953('0x5d'),_0x6953('0x5e'),_0x6953('0x5f'),'chatCurrentCapacity','openchannelCurrentCapacity',_0x6953('0x60'),_0x6953('0x61'),'whatsappCurrentCapacity',_0x6953('0x62'),_0x6953('0x55'),'openchannelStatus',_0x6953('0x63'),_0x6953('0x64'),_0x6953('0x57'),_0x6953('0x56'),_0x6953('0x42'),'chatStatusTime',_0x6953('0x65'),_0x6953('0x66'),_0x6953('0x67'),'whatsappStatusTime','faxStatusTime',_0x6953('0x68'),_0x6953('0x38'),_0x6953('0x69'),_0x6953('0x6a'),_0x6953('0x6b'),'phoneBarEnableAutomaticScreenRecording',_0x6953('0x6c')],_0x414096=[_0x6953('0x4c'),_0x6953('0x4f'),_0x6953('0x4e'),_0x6953('0x50'),_0x6953('0x52'),_0x6953('0x4d'),_0x6953('0x51'),_0x6953('0x41')];Promise[_0x6953('0x6d')]()[_0x6953('0x15')](function(){var _0x390ba0=_[_0x6953('0x32')](db['User'][_0x6953('0x6e')],function(_0x1d264a){return{'name':_0x1d264a[_0x6953('0x6f')],'type':_0x1d264a[_0x6953('0x70')][_0x6953('0x71')]};});_0x5b696e['query']['role']=_0x6953('0x72');_0x5b696e['query'][_0x6953('0x41')]=!![];_0x53e631=qs[_0x6953('0x73')](_0x390ba0,_0x5b696e);_0x53e631[_0x6953('0x74')]=!![];if(_0x5b696e[_0x6953('0x75')]['role']===_0x6953('0x75')){var _0x3091fc={'params':{'id':_0x5b696e[_0x6953('0x75')][_0x6953('0x76')]},'query':{'section':_0x6953('0x14'),'role':_0x6953('0x72'),'online':!![],'nolimit':_0x5b696e[_0x6953('0x77')][_0x6953('0x78')],'sort':_0x5b696e[_0x6953('0x77')][_0x6953('0x79')],'filter':_0x5b696e[_0x6953('0x77')][_0x6953('0x37')],'raw':!![]}};return db[_0x6953('0x7a')][_0x6953('0x7b')](_0x3091fc);}return db[_0x6953('0x7c')]['findAndCountAll'](_0x53e631);})[_0x6953('0x15')](function(_0x3624fc){_0x40033a[_0x6953('0xa')]=_0x3624fc[_0x6953('0xa')];_0x58fcb3=_0x3624fc[_0x6953('0x7d')];return getRealtimeAgents();})[_0x6953('0x15')](function(_0x3e19f1){_0x29937b=_0x3e19f1['rows'];return _0x58fcb3[_0x6953('0x32')](function(_0x403d81){var _0x4eba55=_[_0x6953('0x3e')](_0x29937b,['id',_0x403d81['id']]);if(_0x4eba55)_[_0x6953('0x19')](_0x403d81,_[_0x6953('0x36')](_['omit'](_0x4eba55,_0x414096),_0xafbd35));_0x403d81['globalStatus']=getAgentStatus(_0x403d81);return _0x403d81;});})[_0x6953('0x15')](function(_0x12987e){if(_0x5b696e[_0x6953('0x77')][_0x6953('0x7e')]){var _0x1ad883=_[_0x6953('0x37')](_0x12987e,[_0x6953('0x7f'),_0x5b696e[_0x6953('0x77')][_0x6953('0x7e')]]);if(_0x5b696e['query'][_0x6953('0x80')]){_0x1ad883=_[_0x6953('0x37')](_0x1ad883,[_0x6953('0x5b'),_0x5b696e[_0x6953('0x77')]['pauseTypeFilter']]);}}_0x40033a[_0x6953('0x7d')]=_0x1ad883||_0x12987e;return _0x40033a;})[_0x6953('0x15')](respondWithFilteredResult(_0x400486,_0x53e631))[_0x6953('0x1a')](handleError(_0x400486,null));};exports['getQueues']=function(_0x16898a,_0x12285e){var _0x208038=[_0x6953('0x81'),'chat',_0x6953('0x82'),_0x6953('0x83'),_0x6953('0x84'),_0x6953('0x85'),'voice'];var _0x4eaebb={'count':0x0,'rows':[]},_0x513495={},_0x2310b2,_0x5c9f02,_0x5a7607,_0x3ebd20,_0x147cd4;Promise[_0x6953('0x6d')]()[_0x6953('0x15')](function(){if(_0x16898a['query'][_0x6953('0x86')]){if(!_[_0x6953('0x87')](_0x208038,_0x16898a['query'][_0x6953('0x86')][_0x6953('0x88')]()))throw new Error('Invalid\x20channel');_0x2310b2=_0x16898a['query']['channel'][_0x6953('0x88')]();}var _0x1cdee0=_[_0x6953('0x1b')](_0x2310b2)+_0x6953('0x89');var _0x1efbb9=_[_0x6953('0x32')](db[_0x1cdee0][_0x6953('0x6e')],function(_0x24b888){return{'name':_0x24b888['fieldName'],'type':_0x24b888[_0x6953('0x70')][_0x6953('0x71')]};});_0x513495=qs[_0x6953('0x73')](_0x1efbb9,_0x16898a);if(_0x16898a[_0x6953('0x75')][_0x6953('0x8a')]===_0x6953('0x75')){var _0x481102={'params':{'id':_0x16898a[_0x6953('0x75')]['userProfileId']},'query':{'section':_0x2310b2===_0x6953('0x21')&&_0x16898a['query'][_0x6953('0x70')]===_0x6953('0x22')?_0x6953('0x8b'):_['startCase'](_0x2310b2)+_0x6953('0x8c'),'type':_0x16898a[_0x6953('0x77')][_0x6953('0x70')],'nolimit':!![],'sort':_0x6953('0x11'),'filter':_0x16898a[_0x6953('0x77')][_0x6953('0x37')]}};return db['UserProfile'][_0x6953('0x7b')](_0x481102);}return db[_0x1cdee0][_0x6953('0x8d')](_0x513495);})[_0x6953('0x15')](function(_0x4464d1){_0x4eaebb[_0x6953('0xa')]=_0x4464d1[_0x6953('0xa')];_0x5c9f02=_0x4464d1[_0x6953('0x7d')];return getRealtimeQueues(_0x16898a,_0x2310b2);})[_0x6953('0x15')](function(_0xefb593){_0x3ebd20=_0xefb593[_0x6953('0x7d')];return getRealtimeAgents();})[_0x6953('0x15')](function(_0x47c935){_0x5a7607=_0x47c935[_0x6953('0x7d')];if(_0x2310b2!=_0x6953('0x21'))return;return getRealtimeVoiceQueueChannels();})[_0x6953('0x15')](function(_0x396a9f){_0x147cd4=_0x396a9f?_0x396a9f[_0x6953('0x7d')]:[];return initializeQueues(_0x5c9f02,_0x3ebd20,_0x2310b2,_0x16898a[_0x6953('0x77')][_0x6953('0x70')]);})[_0x6953('0x15')](function(_0x384021){var _0x39dd70=_0x384021[_0x6953('0x32')](function(_0x590d1f){if(_0x2310b2===_0x6953('0x21'))return getVoiceQueueAgents(_0x590d1f,_0x5c9f02,_0x5a7607,_0x147cd4);else return getQueueAgents(_0x590d1f,_0x5a7607,_0x2310b2);});return Promise[_0x6953('0x8e')](_0x39dd70);})[_0x6953('0x15')](function(_0x5a74ab){_0x4eaebb[_0x6953('0x7d')]=_0x5a74ab;return _0x4eaebb;})['then'](respondWithFilteredResult(_0x12285e,_0x513495))['catch'](handleError(_0x12285e,null));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 6f4bc6d..c38f122 100644 --- a/server/api/reportAgentPreview/index.js +++ b/server/api/reportAgentPreview/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x26190c,_0x39e540){var _0x3ebdc4=function(_0x2c968c){while(--_0x2c968c){_0x26190c['push'](_0x26190c['shift']());}};_0x3ebdc4(++_0x39e540);}(_0xedd9,0xfc));var _0x9edd=function(_0x526137,_0x43ff1c){_0x526137=_0x526137-0x0;var _0x92cec=_0xedd9[_0x526137];return _0x92cec;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x478035,_0x54c7ff){var _0x50aac4=function(_0x104b33){while(--_0x104b33){_0x478035['push'](_0x478035['shift']());}};_0x50aac4(++_0x54c7ff);}(_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/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 308f3c3..02c55a2 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 _0xf96b=['sequelize','exports','INTEGER','STRING','DATE'];(function(_0x2e7eba,_0x220747){var _0x541058=function(_0x4817c5){while(--_0x4817c5){_0x2e7eba['push'](_0x2e7eba['shift']());}};_0x541058(++_0x220747);}(_0xf96b,0x109));var _0xbf96=function(_0x36f141,_0x246fce){_0x36f141=_0x36f141-0x0;var _0x37920e=_0xf96b[_0x36f141];return _0x37920e;};'use strict';var Sequelize=require(_0xbf96('0x0'));module[_0xbf96('0x1')]={'state':{'type':Sequelize[_0xbf96('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xbf96('0x3')]},'scheduledat':{'type':Sequelize[_0xbf96('0x4')]},'uniqueid':{'type':Sequelize[_0xbf96('0x3')]},'starttime':{'type':Sequelize[_0xbf96('0x4')]},'responsetime':{'type':Sequelize[_0xbf96('0x4')]},'ringtime':{'type':Sequelize[_0xbf96('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xbf96('0x3')]},'campaigntype':{'type':Sequelize[_0xbf96('0x3')]},'membername':{'type':Sequelize[_0xbf96('0x3')]}}; \ No newline at end of file +var _0x2706=['INTEGER','STRING','DATE','exports'];(function(_0x10004e,_0xd701e6){var _0x5af990=function(_0x4bab6a){while(--_0x4bab6a){_0x10004e['push'](_0x10004e['shift']());}};_0x5af990(++_0xd701e6);}(_0x2706,0x107));var _0x6270=function(_0x142322,_0x80403b){_0x142322=_0x142322-0x0;var _0x5c30c6=_0x2706[_0x142322];return _0x5c30c6;};'use strict';var Sequelize=require('sequelize');module[_0x6270('0x0')]={'state':{'type':Sequelize[_0x6270('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x6270('0x2')]},'scheduledat':{'type':Sequelize[_0x6270('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x6270('0x3')]},'responsetime':{'type':Sequelize[_0x6270('0x3')]},'ringtime':{'type':Sequelize[_0x6270('0x1')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x6270('0x2')]},'campaigntype':{'type':Sequelize[_0x6270('0x2')]},'membername':{'type':Sequelize[_0x6270('0x2')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 962bc24..178c149 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 _0xa9ff=['../../config/logger','moment','request-promise','path','rimraf','exports','define','ReportAgentPreview','lodash','util'];(function(_0x274940,_0xf2816){var _0xc17d01=function(_0x2952da){while(--_0x2952da){_0x274940['push'](_0x274940['shift']());}};_0xc17d01(++_0xf2816);}(_0xa9ff,0x12a));var _0xfa9f=function(_0x12e1fa,_0x2da3b8){_0x12e1fa=_0x12e1fa-0x0;var _0x498b71=_0xa9ff[_0x12e1fa];return _0x498b71;};'use strict';var _=require(_0xfa9f('0x0'));var util=require(_0xfa9f('0x1'));var logger=require(_0xfa9f('0x2'))('api');var moment=require(_0xfa9f('0x3'));var BPromise=require('bluebird');var rp=require(_0xfa9f('0x4'));var fs=require('fs');var path=require(_0xfa9f('0x5'));var rimraf=require(_0xfa9f('0x6'));var config=require('../../config/environment');var attributes=require('./reportAgentPreview.attributes');module[_0xfa9f('0x7')]=function(_0x238c94,_0x399394){return _0x238c94[_0xfa9f('0x8')](_0xfa9f('0x9'),attributes,{'tableName':'report_agent_preview','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5bb2=['lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./reportAgentPreview.attributes','exports','define','ReportAgentPreview','report_agent_preview'];(function(_0x486de9,_0x35dc61){var _0x24647a=function(_0x20721c){while(--_0x20721c){_0x486de9['push'](_0x486de9['shift']());}};_0x24647a(++_0x35dc61);}(_0x5bb2,0xa8));var _0x25bb=function(_0x2af384,_0x221c3c){_0x2af384=_0x2af384-0x0;var _0x790553=_0x5bb2[_0x2af384];return _0x790553;};'use strict';var _=require(_0x25bb('0x0'));var util=require(_0x25bb('0x1'));var logger=require(_0x25bb('0x2'))(_0x25bb('0x3'));var moment=require(_0x25bb('0x4'));var BPromise=require('bluebird');var rp=require(_0x25bb('0x5'));var fs=require('fs');var path=require(_0x25bb('0x6'));var rimraf=require(_0x25bb('0x7'));var config=require(_0x25bb('0x8'));var attributes=require(_0x25bb('0x9'));module[_0x25bb('0xa')]=function(_0x328528,_0x45950e){return _0x328528[_0x25bb('0xb')](_0x25bb('0xc'),attributes,{'tableName':_0x25bb('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.rpc.js b/server/api/reportAgentPreview/reportAgentPreview.rpc.js index 3712dea..25b4326 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 _0x284f=['ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','request','info','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','ReportAgentPreview,\x20%s,\x20%s','message','result','CreateReportAgentPreview','ReportAgentPreview','create','body','options','raw','then','stringify','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x489ce5,_0x431c16){var _0x413132=function(_0x4039b8){while(--_0x4039b8){_0x489ce5['push'](_0x489ce5['shift']());}};_0x413132(++_0x431c16);}(_0x284f,0x127));var _0xf284=function(_0x368fb9,_0x1a9895){_0x368fb9=_0x368fb9-0x0;var _0x4892fb=_0x284f[_0x368fb9];return _0x4892fb;};'use strict';var _=require(_0xf284('0x0'));var util=require(_0xf284('0x1'));var moment=require(_0xf284('0x2'));var BPromise=require(_0xf284('0x3'));var rs=require(_0xf284('0x4'));var fs=require('fs');var Redis=require(_0xf284('0x5'));var db=require(_0xf284('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xf284('0x7'))('rpc');var config=require(_0xf284('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xf284('0x9')][_0xf284('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x127582,_0x5874ab,_0x201fcd){return new BPromise(function(_0x598f49,_0x1ab66b){return client[_0xf284('0xb')](_0x127582,_0x201fcd)['then'](function(_0x2581d8){logger[_0xf284('0xc')]('ReportAgentPreview,\x20%s,\x20%s',_0x5874ab,'request\x20sent');logger[_0xf284('0xd')](_0xf284('0xe'),_0x5874ab,_0xf284('0xf'),JSON['stringify'](_0x2581d8));if(_0x2581d8['error']){if(_0x2581d8[_0xf284('0x10')][_0xf284('0x11')]===0x1f4){logger[_0xf284('0x10')](_0xf284('0x12'),_0x5874ab,_0x2581d8[_0xf284('0x10')][_0xf284('0x13')]);return _0x1ab66b(_0x2581d8[_0xf284('0x10')][_0xf284('0x13')]);}logger[_0xf284('0x10')](_0xf284('0x12'),_0x5874ab,_0x2581d8[_0xf284('0x10')][_0xf284('0x13')]);return _0x598f49(_0x2581d8[_0xf284('0x10')][_0xf284('0x13')]);}else{logger[_0xf284('0xc')]('ReportAgentPreview,\x20%s,\x20%s',_0x5874ab,_0xf284('0xf'));_0x598f49(_0x2581d8[_0xf284('0x14')][_0xf284('0x13')]);}})['catch'](function(_0xc5715a){logger[_0xf284('0x10')](_0xf284('0x12'),_0x5874ab,_0xc5715a);_0x1ab66b(_0xc5715a);});});}exports[_0xf284('0x15')]=function(_0x37cbf8){var _0x164d7d=this;return new Promise(function(_0x3418c6,_0x24f31b){return db[_0xf284('0x16')][_0xf284('0x17')](_0x37cbf8[_0xf284('0x18')],{'raw':_0x37cbf8[_0xf284('0x19')]?_0x37cbf8[_0xf284('0x19')][_0xf284('0x1a')]===undefined?!![]:![]:!![]})[_0xf284('0x1b')](function(_0x301077){logger[_0xf284('0xc')](_0xf284('0x15'),_0x37cbf8);logger[_0xf284('0xd')](_0xf284('0x15'),_0x37cbf8,JSON[_0xf284('0x1c')](_0x301077));_0x3418c6(_0x301077);})[_0xf284('0x1d')](function(_0x2536a6){logger[_0xf284('0x10')](_0xf284('0x15'),_0x2536a6[_0xf284('0x13')],_0x37cbf8);_0x24f31b(_0x164d7d['error'](0x1f4,_0x2536a6[_0xf284('0x13')]));});});}; \ No newline at end of file +var _0xc6d7=['stringify','code','error','message','info','result','catch','create','options','raw','then','CreateReportAgentPreview','lodash','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','http','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s'];(function(_0x42020e,_0x4b92fb){var _0x561551=function(_0xf8216){while(--_0xf8216){_0x42020e['push'](_0x42020e['shift']());}};_0x561551(++_0x4b92fb);}(_0xc6d7,0x174));var _0x7c6d=function(_0x1cbeaa,_0x4a4246){_0x1cbeaa=_0x1cbeaa-0x0;var _0x2638d6=_0xc6d7[_0x1cbeaa];return _0x2638d6;};'use strict';var _=require(_0x7c6d('0x0'));var util=require('util');var moment=require(_0x7c6d('0x1'));var BPromise=require(_0x7c6d('0x2'));var rs=require(_0x7c6d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7c6d('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7c6d('0x5'));var config=require(_0x7c6d('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7c6d('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x30a90c,_0xbe91a9,_0x44277d){return new BPromise(function(_0x2b8ea2,_0x107d2c){return client['request'](_0x30a90c,_0x44277d)['then'](function(_0x252daa){logger['info'](_0x7c6d('0x8'),_0xbe91a9,_0x7c6d('0x9'));logger[_0x7c6d('0xa')](_0x7c6d('0xb'),_0xbe91a9,'request\x20sent',JSON[_0x7c6d('0xc')](_0x252daa));if(_0x252daa['error']){if(_0x252daa['error'][_0x7c6d('0xd')]===0x1f4){logger[_0x7c6d('0xe')](_0x7c6d('0x8'),_0xbe91a9,_0x252daa['error']['message']);return _0x107d2c(_0x252daa[_0x7c6d('0xe')][_0x7c6d('0xf')]);}logger['error'](_0x7c6d('0x8'),_0xbe91a9,_0x252daa[_0x7c6d('0xe')][_0x7c6d('0xf')]);return _0x2b8ea2(_0x252daa[_0x7c6d('0xe')][_0x7c6d('0xf')]);}else{logger[_0x7c6d('0x10')]('ReportAgentPreview,\x20%s,\x20%s',_0xbe91a9,_0x7c6d('0x9'));_0x2b8ea2(_0x252daa[_0x7c6d('0x11')][_0x7c6d('0xf')]);}})[_0x7c6d('0x12')](function(_0x2bd9d3){logger['error'](_0x7c6d('0x8'),_0xbe91a9,_0x2bd9d3);_0x107d2c(_0x2bd9d3);});});}exports['CreateReportAgentPreview']=function(_0x855d7a){var _0x3c9951=this;return new Promise(function(_0x5990c7,_0x48a606){return db['ReportAgentPreview'][_0x7c6d('0x13')](_0x855d7a['body'],{'raw':_0x855d7a[_0x7c6d('0x14')]?_0x855d7a[_0x7c6d('0x14')][_0x7c6d('0x15')]===undefined?!![]:![]:!![]})[_0x7c6d('0x16')](function(_0x22210c){logger[_0x7c6d('0x10')]('CreateReportAgentPreview',_0x855d7a);logger['debug'](_0x7c6d('0x17'),_0x855d7a,JSON[_0x7c6d('0xc')](_0x22210c));_0x5990c7(_0x22210c);})[_0x7c6d('0x12')](function(_0x311d73){logger[_0x7c6d('0xe')]('CreateReportAgentPreview',_0x311d73[_0x7c6d('0xf')],_0x855d7a);_0x48a606(_0x3c9951['error'](0x1f4,_0x311d73[_0x7c6d('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 4199afc..337f62d 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 _0xfa76=['put','/outbound','outbound','/outbound/channels','outboundChannels','/agents','agents','/agents/:id/capacity','agentCapacity','/telephones','/trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','post','queueNotify','/mail/queues/:id','showMailQueues','chat','/chat/queues/:id','showChatQueues','fax','/fax/queues/:id','showFaxQueues','openchannel','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','agentNotify','exports','multer','path','express','Router','../../components/auth/service','get','voiceChannels','/voice/channels/:uniqueid/mixmonitor','isAuthenticated','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','chatQueues','/mail/queues','mailQueues','/mail/accounts','/openchannel/queues','openchannelQueues','smsQueues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','/voice/queues/channels/:uniqueid/redirect/:exten','/voice/queues/:id','showVoiceQueues'];(function(_0x238227,_0x2ec574){var _0xb84c18=function(_0x4ecbfb){while(--_0x4ecbfb){_0x238227['push'](_0x238227['shift']());}};_0xb84c18(++_0x2ec574);}(_0xfa76,0x116));var _0x6fa7=function(_0x52ddf2,_0x2ff25f){_0x52ddf2=_0x52ddf2-0x0;var _0x2dce61=_0xfa76[_0x52ddf2];return _0x2dce61;};'use strict';var multer=require(_0x6fa7('0x0'));var util=require('util');var path=require(_0x6fa7('0x1'));var express=require(_0x6fa7('0x2'));var router=express[_0x6fa7('0x3')]();var auth=require(_0x6fa7('0x4'));var controller=require('./rpc.controller');router[_0x6fa7('0x5')]('/voice/channels',auth['isAuthenticated'](),controller[_0x6fa7('0x6')]);router[_0x6fa7('0x5')](_0x6fa7('0x7'),auth[_0x6fa7('0x8')](),controller['voiceChannelMixMonitor']);router['get'](_0x6fa7('0x9'),auth['isAuthenticated'](),controller[_0x6fa7('0xa')]);router['get'](_0x6fa7('0xb'),auth[_0x6fa7('0x8')](),controller['voiceQueues']);router[_0x6fa7('0x5')]('/chat/queues',auth['isAuthenticated'](),controller[_0x6fa7('0xc')]);router[_0x6fa7('0x5')](_0x6fa7('0xd'),auth[_0x6fa7('0x8')](),controller[_0x6fa7('0xe')]);router['get'](_0x6fa7('0xf'),auth['isAuthenticated'](),controller['mailAccounts']);router[_0x6fa7('0x5')](_0x6fa7('0x10'),auth[_0x6fa7('0x8')](),controller[_0x6fa7('0x11')]);router[_0x6fa7('0x5')]('/sms/queues',auth[_0x6fa7('0x8')](),controller[_0x6fa7('0x12')]);router[_0x6fa7('0x5')]('/whatsapp/queues',auth['isAuthenticated'](),controller[_0x6fa7('0x13')]);router[_0x6fa7('0x5')](_0x6fa7('0x14'),auth[_0x6fa7('0x8')](),controller[_0x6fa7('0x15')]);router['get']('/voice/queues/preview/:id',auth[_0x6fa7('0x8')](),controller['voiceQueuesPreview']);router['get'](_0x6fa7('0x16'),auth[_0x6fa7('0x8')](),controller[_0x6fa7('0x17')]);router[_0x6fa7('0x5')](_0x6fa7('0x18'),auth['isAuthenticated'](),controller[_0x6fa7('0x19')]);router[_0x6fa7('0x5')](_0x6fa7('0x1a'),auth[_0x6fa7('0x8')](),controller['voiceQueuesChannelHangup']);router[_0x6fa7('0x5')](_0x6fa7('0x1b'),auth['isAuthenticated'](),controller['voiceQueuesChannelRedirect']);router['get'](_0x6fa7('0x1c'),auth[_0x6fa7('0x8')](),controller[_0x6fa7('0x1d')]);router[_0x6fa7('0x1e')](_0x6fa7('0x1c'),auth[_0x6fa7('0x8')](),controller['updateVoiceQueue']);router['get'](_0x6fa7('0x1f'),auth[_0x6fa7('0x8')](),controller[_0x6fa7('0x20')]);router[_0x6fa7('0x5')](_0x6fa7('0x21'),auth['isAuthenticated'](),controller[_0x6fa7('0x22')]);router[_0x6fa7('0x5')](_0x6fa7('0x23'),auth[_0x6fa7('0x8')](),controller[_0x6fa7('0x24')]);router[_0x6fa7('0x1e')](_0x6fa7('0x25'),auth['isAuthenticated'](),controller[_0x6fa7('0x26')]);router[_0x6fa7('0x5')](_0x6fa7('0x27'),auth['isAuthenticated'](),controller['telephones']);router[_0x6fa7('0x5')](_0x6fa7('0x28'),auth[_0x6fa7('0x8')](),controller['trunks']);router[_0x6fa7('0x5')](_0x6fa7('0x29'),auth['isAuthenticated'](),controller[_0x6fa7('0x2a')]);router[_0x6fa7('0x5')](_0x6fa7('0x2b'),auth[_0x6fa7('0x8')](),controller[_0x6fa7('0x2c')]);router['get'](_0x6fa7('0x2d'),auth[_0x6fa7('0x8')](),controller[_0x6fa7('0x2e')]);router['get'](_0x6fa7('0x2f'),auth[_0x6fa7('0x8')](),controller[_0x6fa7('0x30')]);router[_0x6fa7('0x5')](_0x6fa7('0x31'),auth['isAuthenticated'](),controller[_0x6fa7('0x32')]);router['get']('/openchannel/queues/:id/waitinginteractions',auth[_0x6fa7('0x8')](),controller[_0x6fa7('0x33')]);router[_0x6fa7('0x5')]('/sms/queues/waitinginteractions',auth[_0x6fa7('0x8')](),controller[_0x6fa7('0x34')]);router[_0x6fa7('0x5')](_0x6fa7('0x35'),auth[_0x6fa7('0x8')](),controller[_0x6fa7('0x36')]);router[_0x6fa7('0x5')](_0x6fa7('0x37'),auth[_0x6fa7('0x8')](),controller['faxQueuesWaitingInteractions']);router[_0x6fa7('0x38')]('/mail/queues/:id/notify',auth[_0x6fa7('0x8')](),controller[_0x6fa7('0x39')]('mail'));router[_0x6fa7('0x5')](_0x6fa7('0x3a'),auth[_0x6fa7('0x8')](),controller[_0x6fa7('0x3b')]);router[_0x6fa7('0x38')]('/chat/queues/:id/notify',auth['isAuthenticated'](),controller[_0x6fa7('0x39')](_0x6fa7('0x3c')));router[_0x6fa7('0x5')](_0x6fa7('0x3d'),auth[_0x6fa7('0x8')](),controller[_0x6fa7('0x3e')]);router[_0x6fa7('0x38')]('/fax/queues/:id/notify',auth['isAuthenticated'](),controller[_0x6fa7('0x39')](_0x6fa7('0x3f')));router[_0x6fa7('0x5')](_0x6fa7('0x40'),auth[_0x6fa7('0x8')](),controller[_0x6fa7('0x41')]);router[_0x6fa7('0x38')]('/openchannel/queues/:id/notify',auth[_0x6fa7('0x8')](),controller['queueNotify'](_0x6fa7('0x42')));router[_0x6fa7('0x5')]('/openchannel/queues/:id',auth[_0x6fa7('0x8')](),controller[_0x6fa7('0x43')]);router[_0x6fa7('0x38')](_0x6fa7('0x44'),auth[_0x6fa7('0x8')](),controller[_0x6fa7('0x39')](_0x6fa7('0x45')));router['post'](_0x6fa7('0x46'),auth[_0x6fa7('0x8')](),controller['queueNotify']('whatsapp'));router[_0x6fa7('0x5')](_0x6fa7('0x47'),auth[_0x6fa7('0x8')](),controller[_0x6fa7('0x48')]);router['get'](_0x6fa7('0x49'),auth[_0x6fa7('0x8')](),controller[_0x6fa7('0x4a')]);router['post']('/agents/:id/notify',auth[_0x6fa7('0x8')](),controller[_0x6fa7('0x4b')]);module[_0x6fa7('0x4c')]=router; \ No newline at end of file +var _0xa2a3=['whatsappQueues','/fax/queues','/voice/queues/preview/:id','/voice/queues/channels/:uniqueid','/voice/queues/channels/:uniqueid/hangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','put','updateVoiceQueue','/outbound','/outbound/channels','outboundChannels','/agents','agents','/agents/:id/capacity','agentCapacity','/telephones','telephones','/trunks','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','/whatsapp/queues/waitinginteractions','/fax/queues/waitinginteractions','post','/mail/queues/:id/notify','queueNotify','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','showFaxQueues','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','/agents/:id/notify','agentNotify','multer','util','path','express','Router','./rpc.controller','/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','get','/voice/queues','/chat/queues','mailQueues','/mail/accounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues'];(function(_0x46d8b2,_0x3829c4){var _0x1a351f=function(_0x279ce5){while(--_0x279ce5){_0x46d8b2['push'](_0x46d8b2['shift']());}};_0x1a351f(++_0x3829c4);}(_0xa2a3,0x120));var _0x3a2a=function(_0x377ddf,_0x102e9a){_0x377ddf=_0x377ddf-0x0;var _0x5b8465=_0xa2a3[_0x377ddf];return _0x5b8465;};'use strict';var multer=require(_0x3a2a('0x0'));var util=require(_0x3a2a('0x1'));var path=require(_0x3a2a('0x2'));var express=require(_0x3a2a('0x3'));var router=express[_0x3a2a('0x4')]();var auth=require('../../components/auth/service');var controller=require(_0x3a2a('0x5'));router['get'](_0x3a2a('0x6'),auth[_0x3a2a('0x7')](),controller[_0x3a2a('0x8')]);router['get'](_0x3a2a('0x9'),auth[_0x3a2a('0x7')](),controller['voiceChannelMixMonitor']);router['get']('/voice/channels/:uniqueid/stopmixmonitor',auth[_0x3a2a('0x7')](),controller['voiceChannelStopMixMonitor']);router[_0x3a2a('0xa')](_0x3a2a('0xb'),auth[_0x3a2a('0x7')](),controller['voiceQueues']);router[_0x3a2a('0xa')](_0x3a2a('0xc'),auth[_0x3a2a('0x7')](),controller['chatQueues']);router[_0x3a2a('0xa')]('/mail/queues',auth[_0x3a2a('0x7')](),controller[_0x3a2a('0xd')]);router[_0x3a2a('0xa')](_0x3a2a('0xe'),auth[_0x3a2a('0x7')](),controller['mailAccounts']);router[_0x3a2a('0xa')](_0x3a2a('0xf'),auth['isAuthenticated'](),controller[_0x3a2a('0x10')]);router[_0x3a2a('0xa')](_0x3a2a('0x11'),auth[_0x3a2a('0x7')](),controller[_0x3a2a('0x12')]);router[_0x3a2a('0xa')](_0x3a2a('0x13'),auth[_0x3a2a('0x7')](),controller[_0x3a2a('0x14')]);router[_0x3a2a('0xa')](_0x3a2a('0x15'),auth[_0x3a2a('0x7')](),controller['faxQueues']);router['get'](_0x3a2a('0x16'),auth[_0x3a2a('0x7')](),controller['voiceQueuesPreview']);router[_0x3a2a('0xa')]('/voice/queues/channels',auth['isAuthenticated'](),controller['voiceQueuesChannels']);router[_0x3a2a('0xa')](_0x3a2a('0x17'),auth[_0x3a2a('0x7')](),controller['voiceQueuesChannel']);router['get'](_0x3a2a('0x18'),auth[_0x3a2a('0x7')](),controller['voiceQueuesChannelHangup']);router[_0x3a2a('0xa')](_0x3a2a('0x19'),auth[_0x3a2a('0x7')](),controller[_0x3a2a('0x1a')]);router[_0x3a2a('0xa')](_0x3a2a('0x1b'),auth[_0x3a2a('0x7')](),controller[_0x3a2a('0x1c')]);router[_0x3a2a('0x1d')](_0x3a2a('0x1b'),auth[_0x3a2a('0x7')](),controller[_0x3a2a('0x1e')]);router[_0x3a2a('0xa')](_0x3a2a('0x1f'),auth['isAuthenticated'](),controller['outbound']);router['get'](_0x3a2a('0x20'),auth[_0x3a2a('0x7')](),controller[_0x3a2a('0x21')]);router[_0x3a2a('0xa')](_0x3a2a('0x22'),auth[_0x3a2a('0x7')](),controller[_0x3a2a('0x23')]);router[_0x3a2a('0x1d')](_0x3a2a('0x24'),auth['isAuthenticated'](),controller[_0x3a2a('0x25')]);router['get'](_0x3a2a('0x26'),auth['isAuthenticated'](),controller[_0x3a2a('0x27')]);router[_0x3a2a('0xa')](_0x3a2a('0x28'),auth[_0x3a2a('0x7')](),controller[_0x3a2a('0x29')]);router[_0x3a2a('0xa')](_0x3a2a('0x2a'),auth[_0x3a2a('0x7')](),controller['campaigns']);router['get'](_0x3a2a('0x2b'),auth[_0x3a2a('0x7')](),controller[_0x3a2a('0x2c')]);router[_0x3a2a('0xa')](_0x3a2a('0x2d'),auth['isAuthenticated'](),controller[_0x3a2a('0x2e')]);router[_0x3a2a('0xa')](_0x3a2a('0x2f'),auth[_0x3a2a('0x7')](),controller[_0x3a2a('0x30')]);router[_0x3a2a('0xa')](_0x3a2a('0x31'),auth[_0x3a2a('0x7')](),controller[_0x3a2a('0x32')]);router[_0x3a2a('0xa')](_0x3a2a('0x33'),auth[_0x3a2a('0x7')](),controller['openchannelQueuesIdWaitingInteractions']);router[_0x3a2a('0xa')](_0x3a2a('0x34'),auth[_0x3a2a('0x7')](),controller[_0x3a2a('0x35')]);router['get'](_0x3a2a('0x36'),auth[_0x3a2a('0x7')](),controller['whatsappQueuesWaitingInteractions']);router[_0x3a2a('0xa')](_0x3a2a('0x37'),auth['isAuthenticated'](),controller['faxQueuesWaitingInteractions']);router[_0x3a2a('0x38')](_0x3a2a('0x39'),auth[_0x3a2a('0x7')](),controller[_0x3a2a('0x3a')]('mail'));router[_0x3a2a('0xa')](_0x3a2a('0x3b'),auth[_0x3a2a('0x7')](),controller[_0x3a2a('0x3c')]);router['post'](_0x3a2a('0x3d'),auth[_0x3a2a('0x7')](),controller['queueNotify'](_0x3a2a('0x3e')));router[_0x3a2a('0xa')](_0x3a2a('0x3f'),auth[_0x3a2a('0x7')](),controller[_0x3a2a('0x40')]);router[_0x3a2a('0x38')]('/fax/queues/:id/notify',auth[_0x3a2a('0x7')](),controller[_0x3a2a('0x3a')]('fax'));router[_0x3a2a('0xa')]('/fax/queues/:id',auth[_0x3a2a('0x7')](),controller[_0x3a2a('0x41')]);router['post']('/openchannel/queues/:id/notify',auth[_0x3a2a('0x7')](),controller[_0x3a2a('0x3a')](_0x3a2a('0x42')));router[_0x3a2a('0xa')](_0x3a2a('0x43'),auth[_0x3a2a('0x7')](),controller[_0x3a2a('0x44')]);router[_0x3a2a('0x38')](_0x3a2a('0x45'),auth[_0x3a2a('0x7')](),controller[_0x3a2a('0x3a')](_0x3a2a('0x46')));router['post'](_0x3a2a('0x47'),auth[_0x3a2a('0x7')](),controller[_0x3a2a('0x3a')]('whatsapp'));router[_0x3a2a('0xa')](_0x3a2a('0x48'),auth[_0x3a2a('0x7')](),controller[_0x3a2a('0x49')]);router[_0x3a2a('0xa')](_0x3a2a('0x4a'),auth[_0x3a2a('0x7')](),controller['showWhatsappQueues']);router[_0x3a2a('0x38')](_0x3a2a('0x4b'),auth['isAuthenticated'](),controller[_0x3a2a('0x4c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 11c5a6e..b85f1e1 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 _0xdc97=['agents','Agents','agentCapacity','user','interaction','hasOwnProperty','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','interface','agent','internal','AgentCapacity','telephones','Telephones','trunks','Trunks','campaigns','Campaigns','chatQueues','ChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','openchannelQueues','showOpenchannelQueues','OpenchannelQueues','smsQueues','showSmsQueues','SmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','showFaxQueues','FaxQueues','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','rows','filter','map','value','indexOf','queue_id','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','FaxQueuesWaitingInteractions','capitalize','chat','Website','Account','findOne','\x20Queue\x20not\x20found','Interaction','update','MessageId','From','TransferReport','create','Start','queue','*,*,*,*','channel','User','Agent\x20not\x20found','Message','messageId','\x20Message\x20not\x20found','InteractionId','bluebird','moment','lodash','../../mysqldb','api','jayson/promise','http','client','request','then','error','code','message','json','sendStatus','name','status','send','isNil','find','voiceChannels','VoiceChannels','query','catch','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','voiceQueues','updateVoiceQueue','UpdateVoiceQueue','body','voiceQueuesChannels','VoiceQueuesChannel','VoiceQueuesChannelHangup','outbound','Outbound','outboundChannels','OutboundChannels'];(function(_0x24d3ab,_0x1e5a77){var _0x3e8c74=function(_0x33c65d){while(--_0x33c65d){_0x24d3ab['push'](_0x24d3ab['shift']());}};_0x3e8c74(++_0x1e5a77);}(_0xdc97,0x13b));var _0x7dc9=function(_0x1c545a,_0x344840){_0x1c545a=_0x1c545a-0x0;var _0x328902=_0xdc97[_0x1c545a];return _0x328902;};'use strict';var BPromise=require(_0x7dc9('0x0'));var moment=require(_0x7dc9('0x1'));var _=require(_0x7dc9('0x2'));var util=require('util');var db=require(_0x7dc9('0x3'))['db'];var logger=require('../../config/logger')(_0x7dc9('0x4'));var jayson=require(_0x7dc9('0x5'));var amiClient=jayson['client'][_0x7dc9('0x6')]({'port':0x232a});var mailClient=jayson[_0x7dc9('0x7')][_0x7dc9('0x6')]({'port':0x232b});var routingClient=jayson[_0x7dc9('0x7')]['http']({'port':0x232c});function respondWithRpcPromise(_0x2636ef,_0x4f91c7,_0x4b3229){return new BPromise(function(_0x2ff923,_0x23737d){var _0x3318ea=_0x4b3229?_0x4b3229:amiClient;return _0x3318ea[_0x7dc9('0x8')](_0x2636ef,_0x4f91c7)[_0x7dc9('0x9')](function(_0x5ca05b){if(_0x5ca05b[_0x7dc9('0xa')]){if(_0x5ca05b[_0x7dc9('0xa')][_0x7dc9('0xb')]===0x1f4){return _0x23737d(_0x5ca05b[_0x7dc9('0xa')][_0x7dc9('0xc')]);}return _0x2ff923(_0x5ca05b[_0x7dc9('0xa')][_0x7dc9('0xc')]);}else{_0x2ff923(_0x5ca05b['result']);}})['catch'](function(_0x4be1c8){_0x23737d(_0x4be1c8);});});}function respondWithResult(_0x599ef1,_0x94c75a){_0x94c75a=_0x94c75a||0xc8;return function(_0x14e5db){if(_0x14e5db){return _0x599ef1['status'](_0x94c75a)[_0x7dc9('0xd')](_0x14e5db);}return _0x599ef1[_0x7dc9('0xe')](0x194);};}function handleError(_0xaadf2,_0xf37bc7){_0xf37bc7=_0xf37bc7||0x1f4;return function(_0x31d43d){logger[_0x7dc9('0xa')](_0x31d43d['stack']);if(_0x31d43d[_0x7dc9('0xf')]){delete _0x31d43d[_0x7dc9('0xf')];}_0xaadf2[_0x7dc9('0x10')](_0xf37bc7)[_0x7dc9('0x11')](_0x31d43d);};}function findById(_0x11606f){return function(_0xbe0437){if(!_[_0x7dc9('0x12')](_0x11606f)&&!_[_0x7dc9('0x12')](_0xbe0437)&&!_[_0x7dc9('0x12')](_0xbe0437['rows'])){return _[_0x7dc9('0x13')](_0xbe0437['rows'],function(_0x1f5906){return _0x1f5906['id']==_0x11606f;});}return null;};}exports[_0x7dc9('0x14')]=function(_0x5d61d7,_0x41f66e){return respondWithRpcPromise(_0x7dc9('0x15'),_0x5d61d7[_0x7dc9('0x16')])[_0x7dc9('0x9')](respondWithResult(_0x41f66e,null))[_0x7dc9('0x17')](handleError(_0x41f66e,null));};exports[_0x7dc9('0x18')]=function(_0x2dad65,_0x2895f5){return respondWithRpcPromise(_0x7dc9('0x19'),_[_0x7dc9('0x1a')](_0x2dad65['query'],_0x2dad65['params']))[_0x7dc9('0x9')](respondWithResult(_0x2895f5,null))[_0x7dc9('0x17')](handleError(_0x2895f5,null));};exports['voiceChannelStopMixMonitor']=function(_0x349001,_0x27f7fa){return respondWithRpcPromise('VoiceChannelStopMixMonitor',_[_0x7dc9('0x1a')](_0x349001[_0x7dc9('0x16')],_0x349001[_0x7dc9('0x1b')]))['then'](respondWithResult(_0x27f7fa,null))[_0x7dc9('0x17')](handleError(_0x27f7fa,null));};exports[_0x7dc9('0x1c')]=function(_0xf95336,_0x55a482){return respondWithRpcPromise('VoiceQueues',_0xf95336['query'])[_0x7dc9('0x9')](respondWithResult(_0x55a482,null))[_0x7dc9('0x17')](handleError(_0x55a482,null));};exports['showVoiceQueues']=function(_0x585eef,_0x47771b){return respondWithRpcPromise('VoiceQueues',_0x585eef[_0x7dc9('0x16')])[_0x7dc9('0x9')](findById(_0x585eef[_0x7dc9('0x1b')]['id']))[_0x7dc9('0x9')](respondWithResult(_0x47771b,null))[_0x7dc9('0x17')](handleError(_0x47771b,null));};exports[_0x7dc9('0x1d')]=function(_0x236d42,_0x229f8e){return respondWithRpcPromise(_0x7dc9('0x1e'),_[_0x7dc9('0x1a')](_0x236d42[_0x7dc9('0x1f')],_0x236d42[_0x7dc9('0x1b')]))['then'](respondWithResult(_0x229f8e,null))['catch'](handleError(_0x229f8e,null));};exports['voiceQueuesPreview']=function(_0x49a4a5,_0x4a68f0){return respondWithRpcPromise('VoiceQueuesPreview',_['merge'](_0x49a4a5['query'],_0x49a4a5[_0x7dc9('0x1b')]))[_0x7dc9('0x9')](respondWithResult(_0x4a68f0,null))[_0x7dc9('0x17')](handleError(_0x4a68f0,null));};exports[_0x7dc9('0x20')]=function(_0x3300ff,_0x154e22){return respondWithRpcPromise('VoiceQueuesChannels',_0x3300ff['query'])['then'](respondWithResult(_0x154e22,null))[_0x7dc9('0x17')](handleError(_0x154e22,null));};exports['voiceQueuesChannel']=function(_0x2b9ca0,_0x448e46){return respondWithRpcPromise(_0x7dc9('0x21'),_[_0x7dc9('0x1a')](_0x2b9ca0[_0x7dc9('0x16')],_0x2b9ca0[_0x7dc9('0x1b')]))[_0x7dc9('0x9')](respondWithResult(_0x448e46,null))[_0x7dc9('0x17')](handleError(_0x448e46,null));};exports['voiceQueuesChannelHangup']=function(_0x2b56d7,_0x4cdec4){return respondWithRpcPromise(_0x7dc9('0x22'),_[_0x7dc9('0x1a')](_0x2b56d7[_0x7dc9('0x16')],_0x2b56d7[_0x7dc9('0x1b')]))['then'](respondWithResult(_0x4cdec4,null))[_0x7dc9('0x17')](handleError(_0x4cdec4,null));};exports['voiceQueuesChannelRedirect']=function(_0x289560,_0x4f47af){return respondWithRpcPromise('VoiceQueuesChannelRedirect',_[_0x7dc9('0x1a')](_0x289560[_0x7dc9('0x16')],_0x289560[_0x7dc9('0x1b')]))[_0x7dc9('0x9')](respondWithResult(_0x4f47af,null))['catch'](handleError(_0x4f47af,null));};exports[_0x7dc9('0x23')]=function(_0x183d87,_0x138f33){return respondWithRpcPromise(_0x7dc9('0x24'),_0x183d87[_0x7dc9('0x16')])[_0x7dc9('0x9')](respondWithResult(_0x138f33,null))[_0x7dc9('0x17')](handleError(_0x138f33,null));};exports[_0x7dc9('0x25')]=function(_0x166906,_0x21bcfc){return respondWithRpcPromise(_0x7dc9('0x26'),_0x166906[_0x7dc9('0x16')])['then'](respondWithResult(_0x21bcfc,null))[_0x7dc9('0x17')](handleError(_0x21bcfc,null));};exports[_0x7dc9('0x27')]=function(_0x466b02,_0xfd2612){var _0x4bcdce;return respondWithRpcPromise(_0x7dc9('0x28'),_0x466b02[_0x7dc9('0x16')])[_0x7dc9('0x9')](function(_0x3876b6){_0x4bcdce=_0x3876b6;return respondWithRpcPromise(_0x7dc9('0x28'),_0x466b02[_0x7dc9('0x16')],routingClient);})['then'](function(_0x553230){return _[_0x7dc9('0x1a')]({},_0x553230,_0x4bcdce);})[_0x7dc9('0x9')](respondWithResult(_0xfd2612,null))['catch'](handleError(_0xfd2612,null));};exports[_0x7dc9('0x29')]=function(_0x4a37ec,_0x315d65){if(_0x4a37ec[_0x7dc9('0x1f')]&&_0x4a37ec[_0x7dc9('0x1f')]['interaction']&&_0x4a37ec[_0x7dc9('0x2a')]&&_0x4a37ec[_0x7dc9('0x2a')][_0x7dc9('0xf')]){for(var _0x95513c in _0x4a37ec[_0x7dc9('0x1f')][_0x7dc9('0x2b')]){if(_0x4a37ec[_0x7dc9('0x1f')]['interaction'][_0x7dc9('0x2c')](_0x95513c)){db['MemberReport']['findAll']({'where':{'channel':_0x95513c,'membername':_0x4a37ec[_0x7dc9('0x2a')][_0x7dc9('0xf')],'type':_0x7dc9('0x2d'),'exitAt':null,'uniqueid':_0x4a37ec[_0x7dc9('0x1f')][_0x7dc9('0x2b')][_0x95513c]&&_0x4a37ec[_0x7dc9('0x1f')][_0x7dc9('0x2b')][_0x95513c][_0x7dc9('0x2e')]?{'$notIn':_0x4a37ec[_0x7dc9('0x1f')]['interaction'][_0x95513c]}:{'$ne':null}}})[_0x7dc9('0x9')](function(_0x1971c7){var _0x3c4d4c=moment()[_0x7dc9('0x2f')](_0x7dc9('0x30'));for(var _0x19957f=0x0,_0x575393=_0x1971c7[_0x7dc9('0x2e')];_0x19957f<_0x575393;_0x19957f+=0x1){_0x1971c7[_0x19957f][_0x7dc9('0x31')]({'exitAt':_0x3c4d4c});}});for(var _0x49bffe=0x0;_0x49bffe<_0x4a37ec[_0x7dc9('0x1f')][_0x7dc9('0x2b')][_0x95513c][_0x7dc9('0x2e')];_0x49bffe+=0x1){db['MemberReport'][_0x7dc9('0x32')]({'where':{'channel':_0x95513c,'membername':_0x4a37ec['user']['name'],'type':_0x7dc9('0x2d'),'uniqueid':_0x4a37ec[_0x7dc9('0x1f')][_0x7dc9('0x2b')][_0x95513c][_0x49bffe],'exitAt':null},'defaults':{'channel':_0x95513c,'membername':_0x4a37ec['user']['name'],'interface':_[_0x7dc9('0x12')](_0x4a37ec['user'][_0x7dc9('0x33')])?util[_0x7dc9('0x2f')]('SIP/%s',_0x4a37ec[_0x7dc9('0x2a')][_0x7dc9('0xf')]):_0x4a37ec[_0x7dc9('0x2a')][_0x7dc9('0x33')],'type':_0x7dc9('0x2d'),'enterAt':moment()[_0x7dc9('0x2f')](_0x7dc9('0x30')),'role':_0x7dc9('0x34'),'internal':_0x4a37ec[_0x7dc9('0x2a')][_0x7dc9('0x35')],'uniqueid':_0x4a37ec[_0x7dc9('0x1f')][_0x7dc9('0x2b')][_0x95513c][_0x49bffe]}});}}}}return respondWithRpcPromise(_0x7dc9('0x36'),{'id':_0x4a37ec['params']['id'],'capacity':_0x4a37ec[_0x7dc9('0x1f')]['capacity']},routingClient)['then'](respondWithResult(_0x315d65,null))[_0x7dc9('0x17')](handleError(_0x315d65,null));};exports[_0x7dc9('0x37')]=function(_0x40e382,_0x3902aa){return respondWithRpcPromise(_0x7dc9('0x38'),_0x40e382['query'])[_0x7dc9('0x9')](respondWithResult(_0x3902aa,null))[_0x7dc9('0x17')](handleError(_0x3902aa,null));};exports[_0x7dc9('0x39')]=function(_0x4a9b75,_0x341909){return respondWithRpcPromise(_0x7dc9('0x3a'),_0x4a9b75[_0x7dc9('0x16')])[_0x7dc9('0x9')](respondWithResult(_0x341909,null))[_0x7dc9('0x17')](handleError(_0x341909,null));};exports[_0x7dc9('0x3b')]=function(_0x593132,_0x366b8b){return respondWithRpcPromise(_0x7dc9('0x3c'),_0x593132[_0x7dc9('0x16')])[_0x7dc9('0x9')](respondWithResult(_0x366b8b,null))[_0x7dc9('0x17')](handleError(_0x366b8b,null));};exports[_0x7dc9('0x3d')]=function(_0x31baf1,_0x24abb6){return respondWithRpcPromise(_0x7dc9('0x3e'),_0x31baf1[_0x7dc9('0x16')],routingClient)[_0x7dc9('0x9')](respondWithResult(_0x24abb6,null))[_0x7dc9('0x17')](handleError(_0x24abb6,null));};exports['showChatQueues']=function(_0x1767b6,_0x39be46){return respondWithRpcPromise(_0x7dc9('0x3e'),_0x1767b6[_0x7dc9('0x16')],routingClient)[_0x7dc9('0x9')](findById(_0x1767b6['params']['id']))[_0x7dc9('0x9')](respondWithResult(_0x39be46,null))[_0x7dc9('0x17')](handleError(_0x39be46,null));};exports[_0x7dc9('0x3f')]=function(_0x17ed6c,_0x2a1db8){return respondWithRpcPromise(_0x7dc9('0x40'),_0x17ed6c['query'],routingClient)['then'](respondWithResult(_0x2a1db8,null))['catch'](handleError(_0x2a1db8,null));};exports[_0x7dc9('0x41')]=function(_0x3daf33,_0x32a64f){return respondWithRpcPromise(_0x7dc9('0x40'),_0x3daf33['query'],routingClient)['then'](findById(_0x3daf33[_0x7dc9('0x1b')]['id']))[_0x7dc9('0x9')](respondWithResult(_0x32a64f,null))[_0x7dc9('0x17')](handleError(_0x32a64f,null));};exports[_0x7dc9('0x42')]=function(_0x2caf7f,_0x2272ef){return respondWithRpcPromise(_0x7dc9('0x43'),_0x2caf7f['query'],mailClient)[_0x7dc9('0x9')](respondWithResult(_0x2272ef,null))[_0x7dc9('0x17')](handleError(_0x2272ef,null));};exports[_0x7dc9('0x44')]=function(_0x1dad95,_0x4683b3){return respondWithRpcPromise('OpenchannelQueues',_0x1dad95[_0x7dc9('0x16')],routingClient)[_0x7dc9('0x9')](respondWithResult(_0x4683b3,null))[_0x7dc9('0x17')](handleError(_0x4683b3,null));};exports[_0x7dc9('0x45')]=function(_0x2454d7,_0x3a93c4){return respondWithRpcPromise(_0x7dc9('0x46'),_0x2454d7[_0x7dc9('0x16')],routingClient)[_0x7dc9('0x9')](findById(_0x2454d7[_0x7dc9('0x1b')]['id']))[_0x7dc9('0x9')](respondWithResult(_0x3a93c4,null))[_0x7dc9('0x17')](handleError(_0x3a93c4,null));};exports[_0x7dc9('0x47')]=function(_0x5eee27,_0x3485b6){return respondWithRpcPromise('SmsQueues',_0x5eee27[_0x7dc9('0x16')],routingClient)[_0x7dc9('0x9')](respondWithResult(_0x3485b6,null))['catch'](handleError(_0x3485b6,null));};exports[_0x7dc9('0x48')]=function(_0x24d2c7,_0x50e9a9){return respondWithRpcPromise(_0x7dc9('0x49'),_0x24d2c7[_0x7dc9('0x16')],routingClient)[_0x7dc9('0x9')](findById(_0x24d2c7['params']['id']))['then'](respondWithResult(_0x50e9a9,null))[_0x7dc9('0x17')](handleError(_0x50e9a9,null));};exports[_0x7dc9('0x4a')]=function(_0x4ed60e,_0x3aba59){return respondWithRpcPromise(_0x7dc9('0x4b'),_0x4ed60e[_0x7dc9('0x16')],routingClient)[_0x7dc9('0x9')](respondWithResult(_0x3aba59,null))[_0x7dc9('0x17')](handleError(_0x3aba59,null));};exports[_0x7dc9('0x4c')]=function(_0x51b834,_0x35f31e){return respondWithRpcPromise(_0x7dc9('0x4b'),_0x51b834[_0x7dc9('0x16')],routingClient)['then'](findById(_0x51b834['params']['id']))[_0x7dc9('0x9')](respondWithResult(_0x35f31e,null))[_0x7dc9('0x17')](handleError(_0x35f31e,null));};exports[_0x7dc9('0x4d')]=function(_0x2cf485,_0x59f3bd){return respondWithRpcPromise('FaxQueues',_0x2cf485[_0x7dc9('0x16')],routingClient)[_0x7dc9('0x9')](respondWithResult(_0x59f3bd,null))[_0x7dc9('0x17')](handleError(_0x59f3bd,null));};exports[_0x7dc9('0x4e')]=function(_0x5d211b,_0xea1728){return respondWithRpcPromise(_0x7dc9('0x4f'),_0x5d211b[_0x7dc9('0x16')],routingClient)[_0x7dc9('0x9')](findById(_0x5d211b[_0x7dc9('0x1b')]['id']))[_0x7dc9('0x9')](respondWithResult(_0xea1728,null))[_0x7dc9('0x17')](handleError(_0xea1728,null));};exports['faxAccounts']=function(_0x2d7c33,_0x2cde0c){return respondWithRpcPromise('FaxAccounts',_0x2d7c33['query'])[_0x7dc9('0x9')](respondWithResult(_0x2cde0c,null))['catch'](handleError(_0x2cde0c,null));};exports[_0x7dc9('0x50')]=function(_0x466602,_0xd99a2){return respondWithRpcPromise(_0x7dc9('0x51'),_0x466602[_0x7dc9('0x16')],routingClient)[_0x7dc9('0x9')](respondWithResult(_0xd99a2,null))[_0x7dc9('0x17')](handleError(_0xd99a2,null));};exports[_0x7dc9('0x52')]=function(_0x25f970,_0x30ce2f){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x25f970[_0x7dc9('0x16')],routingClient)[_0x7dc9('0x9')](respondWithResult(_0x30ce2f,null))[_0x7dc9('0x17')](handleError(_0x30ce2f,null));};exports['openchannelQueuesWaitingInteractions']=function(_0x45c1b3,_0x585e42){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x45c1b3[_0x7dc9('0x16')],routingClient)[_0x7dc9('0x9')](respondWithResult(_0x585e42,null))['catch'](handleError(_0x585e42,null));};exports[_0x7dc9('0x53')]=function(_0x533738,_0x5a585a){return respondWithRpcPromise(_0x7dc9('0x54'),_0x533738[_0x7dc9('0x16')],routingClient)[_0x7dc9('0x9')](function(_0xb8be9){if(_0x533738['query'][_0x7dc9('0x55')]!==undefined){var _0xe944a4=_(_0xb8be9[_0x7dc9('0x56')])[_0x7dc9('0x57')]([_0x533738[_0x7dc9('0x16')][_0x7dc9('0x55')],_0x533738[_0x7dc9('0x1b')]['id']])[_0x7dc9('0x58')]('queue_id')['uniq']()[_0x7dc9('0x59')]();return _0xb8be9['rows'][_0x7dc9('0x57')](function(_0x1da142){return _0xe944a4[_0x7dc9('0x5a')](_0x1da142[_0x7dc9('0x5b')])>-0x1;});}else{return _0xb8be9['rows'][_0x7dc9('0x57')](function(_0x51a7e5){return _0x51a7e5['queue_id']===parseInt(_0x533738[_0x7dc9('0x1b')]['id']);});}})[_0x7dc9('0x9')](respondWithResult(_0x5a585a,null))[_0x7dc9('0x17')](handleError(_0x5a585a,null));};exports[_0x7dc9('0x5c')]=function(_0x5bc1c3,_0x2c3434){return respondWithRpcPromise(_0x7dc9('0x5d'),_0x5bc1c3['query'],routingClient)['then'](respondWithResult(_0x2c3434,null))[_0x7dc9('0x17')](handleError(_0x2c3434,null));};exports[_0x7dc9('0x5e')]=function(_0x49d7ef,_0x114078){return respondWithRpcPromise('WhatsappQueuesWaitingInteractions',_0x49d7ef[_0x7dc9('0x16')],routingClient)[_0x7dc9('0x9')](respondWithResult(_0x114078,null))[_0x7dc9('0x17')](handleError(_0x114078,null));};exports['faxQueuesWaitingInteractions']=function(_0x33d68c,_0x3c7daf){return respondWithRpcPromise(_0x7dc9('0x5f'),_0x33d68c['query'],routingClient)[_0x7dc9('0x9')](respondWithResult(_0x3c7daf,null))['catch'](handleError(_0x3c7daf,null));};exports['queueNotify']=function(_0xa899){return function(_0x26244a,_0x31faa4){var _0x3657b6,_0x26d94e;var _0x56a00d=_[_0x7dc9('0x60')](_0xa899);var _0x1daf80=_0xa899===_0x7dc9('0x61')?_0x7dc9('0x62'):_0x7dc9('0x63');return db[_0x56a00d+'Queue'][_0x7dc9('0x64')]({'raw':!![],'where':{'id':_0x26244a[_0x7dc9('0x1b')]['id']}})[_0x7dc9('0x9')](function(_0x200df7){if(_['isNil'](_0x200df7)){throw new Error(_0x56a00d+_0x7dc9('0x65'));}_0x3657b6=_0x200df7;return db[_0x56a00d+'Message']['findOne']({'where':{'id':_0x26244a[_0x7dc9('0x1f')]['messageId']},'include':[{'model':db[_0x56a00d+_0x7dc9('0x66')],'as':_0x7dc9('0x66')},{'model':db[_0x56a00d+_0x1daf80],'as':_0x7dc9('0x63')}]});})[_0x7dc9('0x9')](function(_0x38dccc){if(_[_0x7dc9('0x12')](_0x38dccc)){throw new Error(_0x56a00d+'\x20Message\x20not\x20found');}_0x26d94e=_0x38dccc;return _0x38dccc[_0x7dc9('0x67')]({'read':0x0,'readAt':null,'UserId':null});})[_0x7dc9('0x9')](function(){var _0x1a4bfb={'uniqueid':_0xa899+'.'+_0x26d94e['id']+'.'+_0x26d94e[_0x7dc9('0x66')]['id'],'FromUserId':_0x26244a[_0x7dc9('0x2a')]['id'],'type':'queue'};_0x1a4bfb[_0x56a00d+_0x7dc9('0x68')]=_0x26d94e['id'];_0x1a4bfb[_0x56a00d+'InteractionId']=_0x26d94e[_0x7dc9('0x66')]['id'];_0x1a4bfb[_0x7dc9('0x69')+_0x56a00d+_0x1daf80+'Id']=_0x26d94e[_0x7dc9('0x63')]['id'];_0x1a4bfb['To'+_0x56a00d+'QueueId']=_0x3657b6['id'];return db[_0x56a00d+_0x7dc9('0x6a')][_0x7dc9('0x6b')](_0x1a4bfb);})['then'](function(){return respondWithRpcPromise(_0x7dc9('0x6c'),{'channel':_0xa899,'interaction':_0x26d94e[_0x7dc9('0x66')],'message':_0x26d94e,'account':_0x26d94e[_0x7dc9('0x63')],'applications':[{'id':0x0,'priority':0x1,'app':_0x7dc9('0x6d'),'appdata':_0x3657b6['name']+','+(_0x26d94e[_0x7dc9('0x63')]['queueTransferTimeout']||0x12c),'interval':_0x7dc9('0x6e')}]},routingClient);})[_0x7dc9('0x9')](respondWithResult(_0x31faa4,null))[_0x7dc9('0x17')](handleError(_0x31faa4,null));};};exports['agentNotify']=function(_0x160bf0,_0x4588a7){var _0x23da2e,_0x568705;if(_['isNil'](_0x160bf0[_0x7dc9('0x1f')][_0x7dc9('0x6f')])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0x573fa9=_0x160bf0[_0x7dc9('0x1f')][_0x7dc9('0x6f')];var _0x5f3487=_[_0x7dc9('0x60')](_0x573fa9);var _0x5a44a1=_0x573fa9===_0x7dc9('0x61')?_0x7dc9('0x62'):_0x7dc9('0x63');return db[_0x7dc9('0x70')][_0x7dc9('0x64')]({'raw':!![],'where':{'id':_0x160bf0[_0x7dc9('0x1b')]['id'],'role':'agent'}})[_0x7dc9('0x9')](function(_0x3fb268){if(_[_0x7dc9('0x12')](_0x3fb268)){throw new Error(_0x7dc9('0x71'));}_0x23da2e=_0x3fb268;return db[_0x5f3487+_0x7dc9('0x72')]['findOne']({'where':{'id':_0x160bf0[_0x7dc9('0x1f')][_0x7dc9('0x73')]},'include':[{'model':db[_0x5f3487+_0x7dc9('0x66')],'as':_0x7dc9('0x66')},{'model':db[_0x5f3487+_0x5a44a1],'as':'Account'}]});})[_0x7dc9('0x9')](function(_0x54bd64){if(_['isNil'](_0x54bd64)){throw new Error(_0x5f3487+_0x7dc9('0x74'));}_0x568705=_0x54bd64;return _0x54bd64['update']({'read':0x0,'readAt':null,'UserId':null});})[_0x7dc9('0x9')](function(){var _0x19c880={'uniqueid':_0x573fa9+'.'+_0x568705['id']+'.'+_0x568705[_0x7dc9('0x66')]['id'],'FromUserId':_0x160bf0[_0x7dc9('0x2a')]['id'],'type':_0x7dc9('0x6d'),'ToUserId':_0x23da2e['id']};_0x19c880[_0x5f3487+_0x7dc9('0x68')]=_0x568705['id'];_0x19c880[_0x5f3487+_0x7dc9('0x75')]=_0x568705[_0x7dc9('0x66')]['id'];_0x19c880['From'+_0x5f3487+_0x5a44a1+'Id']=_0x568705[_0x7dc9('0x63')]['id'];return db[_0x5f3487+_0x7dc9('0x6a')][_0x7dc9('0x6b')](_0x19c880);})[_0x7dc9('0x9')](function(){return respondWithRpcPromise(_0x7dc9('0x6c'),{'channel':_0x573fa9,'interaction':_0x568705['Interaction'],'message':_0x568705,'account':_0x568705[_0x7dc9('0x63')],'applications':[{'id':0x0,'priority':0x1,'app':_0x7dc9('0x34'),'appdata':_0x23da2e[_0x7dc9('0xf')]+','+(_0x568705[_0x7dc9('0x63')]['agentTransferTimeout']||0x12c),'interval':_0x7dc9('0x6e')}]},routingClient);})['then'](respondWithResult(_0x4588a7,null))[_0x7dc9('0x17')](handleError(_0x4588a7,null));}; \ No newline at end of file +var _0x3e74=['http','client','then','error','code','message','result','sendStatus','stack','name','status','isNil','find','rows','voiceChannels','VoiceChannels','query','catch','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','voiceChannelStopMixMonitor','VoiceQueues','showVoiceQueues','updateVoiceQueue','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','Outbound','outboundChannels','OutboundChannels','Agents','agentCapacity','interaction','user','MemberReport','findAll','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','INTERACTION','interface','SIP/%s','agent','internal','AgentCapacity','capacity','telephones','Telephones','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','mailAccounts','MailAccounts','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','whatsappQueues','showWhatsappQueues','WhatsappQueues','showFaxQueues','FaxQueues','faxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','filter','map','queue_id','uniq','value','indexOf','smsQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','\x20Queue\x20not\x20found','Message','findOne','messageId','Interaction','Account','\x20Message\x20not\x20found','update','queue','MessageId','From','TransferReport','create','Start','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','User','Agent\x20not\x20found','InteractionId','agentTransferTimeout','bluebird','lodash','util','../../mysqldb','jayson/promise'];(function(_0x451009,_0x2b7f20){var _0x5e8d6e=function(_0x5e4784){while(--_0x5e4784){_0x451009['push'](_0x451009['shift']());}};_0x5e8d6e(++_0x2b7f20);}(_0x3e74,0x175));var _0x43e7=function(_0x2e5883,_0x50b5fd){_0x2e5883=_0x2e5883-0x0;var _0x59fa6a=_0x3e74[_0x2e5883];return _0x59fa6a;};'use strict';var BPromise=require(_0x43e7('0x0'));var moment=require('moment');var _=require(_0x43e7('0x1'));var util=require(_0x43e7('0x2'));var db=require(_0x43e7('0x3'))['db'];var logger=require('../../config/logger')('api');var jayson=require(_0x43e7('0x4'));var amiClient=jayson['client'][_0x43e7('0x5')]({'port':0x232a});var mailClient=jayson[_0x43e7('0x6')][_0x43e7('0x5')]({'port':0x232b});var routingClient=jayson[_0x43e7('0x6')][_0x43e7('0x5')]({'port':0x232c});function respondWithRpcPromise(_0x503698,_0x45a0d1,_0x3491d6){return new BPromise(function(_0x2ede2d,_0x8528fc){var _0x21f491=_0x3491d6?_0x3491d6:amiClient;return _0x21f491['request'](_0x503698,_0x45a0d1)[_0x43e7('0x7')](function(_0x554d44){if(_0x554d44['error']){if(_0x554d44[_0x43e7('0x8')][_0x43e7('0x9')]===0x1f4){return _0x8528fc(_0x554d44['error'][_0x43e7('0xa')]);}return _0x2ede2d(_0x554d44['error'][_0x43e7('0xa')]);}else{_0x2ede2d(_0x554d44[_0x43e7('0xb')]);}})['catch'](function(_0x3eb206){_0x8528fc(_0x3eb206);});});}function respondWithResult(_0xc960ea,_0x2718d3){_0x2718d3=_0x2718d3||0xc8;return function(_0x3bb83f){if(_0x3bb83f){return _0xc960ea['status'](_0x2718d3)['json'](_0x3bb83f);}return _0xc960ea[_0x43e7('0xc')](0x194);};}function handleError(_0x21fdd3,_0x44b0bd){_0x44b0bd=_0x44b0bd||0x1f4;return function(_0x51b974){logger['error'](_0x51b974[_0x43e7('0xd')]);if(_0x51b974[_0x43e7('0xe')]){delete _0x51b974[_0x43e7('0xe')];}_0x21fdd3[_0x43e7('0xf')](_0x44b0bd)['send'](_0x51b974);};}function findById(_0x5c4eaa){return function(_0xdf16c){if(!_[_0x43e7('0x10')](_0x5c4eaa)&&!_[_0x43e7('0x10')](_0xdf16c)&&!_['isNil'](_0xdf16c['rows'])){return _[_0x43e7('0x11')](_0xdf16c[_0x43e7('0x12')],function(_0x9037d3){return _0x9037d3['id']==_0x5c4eaa;});}return null;};}exports[_0x43e7('0x13')]=function(_0x3776f5,_0x1f24fb){return respondWithRpcPromise(_0x43e7('0x14'),_0x3776f5[_0x43e7('0x15')])[_0x43e7('0x7')](respondWithResult(_0x1f24fb,null))[_0x43e7('0x16')](handleError(_0x1f24fb,null));};exports[_0x43e7('0x17')]=function(_0x177ee1,_0x4b5d64){return respondWithRpcPromise(_0x43e7('0x18'),_[_0x43e7('0x19')](_0x177ee1['query'],_0x177ee1[_0x43e7('0x1a')]))[_0x43e7('0x7')](respondWithResult(_0x4b5d64,null))[_0x43e7('0x16')](handleError(_0x4b5d64,null));};exports[_0x43e7('0x1b')]=function(_0x4077fb,_0x2f4cb4){return respondWithRpcPromise('VoiceChannelStopMixMonitor',_[_0x43e7('0x19')](_0x4077fb['query'],_0x4077fb['params']))[_0x43e7('0x7')](respondWithResult(_0x2f4cb4,null))[_0x43e7('0x16')](handleError(_0x2f4cb4,null));};exports['voiceQueues']=function(_0x1f0673,_0x4ca5cf){return respondWithRpcPromise(_0x43e7('0x1c'),_0x1f0673['query'])[_0x43e7('0x7')](respondWithResult(_0x4ca5cf,null))[_0x43e7('0x16')](handleError(_0x4ca5cf,null));};exports[_0x43e7('0x1d')]=function(_0x405f85,_0x51f4d7){return respondWithRpcPromise('VoiceQueues',_0x405f85[_0x43e7('0x15')])['then'](findById(_0x405f85[_0x43e7('0x1a')]['id']))[_0x43e7('0x7')](respondWithResult(_0x51f4d7,null))[_0x43e7('0x16')](handleError(_0x51f4d7,null));};exports[_0x43e7('0x1e')]=function(_0x5087d7,_0x33a1a5){return respondWithRpcPromise(_0x43e7('0x1f'),_[_0x43e7('0x19')](_0x5087d7[_0x43e7('0x20')],_0x5087d7[_0x43e7('0x1a')]))[_0x43e7('0x7')](respondWithResult(_0x33a1a5,null))[_0x43e7('0x16')](handleError(_0x33a1a5,null));};exports[_0x43e7('0x21')]=function(_0x3bf475,_0x35dbcd){return respondWithRpcPromise(_0x43e7('0x22'),_[_0x43e7('0x19')](_0x3bf475[_0x43e7('0x15')],_0x3bf475[_0x43e7('0x1a')]))['then'](respondWithResult(_0x35dbcd,null))[_0x43e7('0x16')](handleError(_0x35dbcd,null));};exports[_0x43e7('0x23')]=function(_0x3b8f78,_0x183c81){return respondWithRpcPromise(_0x43e7('0x24'),_0x3b8f78['query'])[_0x43e7('0x7')](respondWithResult(_0x183c81,null))[_0x43e7('0x16')](handleError(_0x183c81,null));};exports[_0x43e7('0x25')]=function(_0x3f280d,_0x4c61b9){return respondWithRpcPromise('VoiceQueuesChannel',_['merge'](_0x3f280d[_0x43e7('0x15')],_0x3f280d[_0x43e7('0x1a')]))[_0x43e7('0x7')](respondWithResult(_0x4c61b9,null))[_0x43e7('0x16')](handleError(_0x4c61b9,null));};exports[_0x43e7('0x26')]=function(_0xde7ed,_0x485c6c){return respondWithRpcPromise('VoiceQueuesChannelHangup',_['merge'](_0xde7ed['query'],_0xde7ed['params']))['then'](respondWithResult(_0x485c6c,null))['catch'](handleError(_0x485c6c,null));};exports[_0x43e7('0x27')]=function(_0x49cda6,_0x2b4bfd){return respondWithRpcPromise(_0x43e7('0x28'),_[_0x43e7('0x19')](_0x49cda6[_0x43e7('0x15')],_0x49cda6[_0x43e7('0x1a')]))[_0x43e7('0x7')](respondWithResult(_0x2b4bfd,null))[_0x43e7('0x16')](handleError(_0x2b4bfd,null));};exports['outbound']=function(_0x5332d9,_0x5d84f4){return respondWithRpcPromise(_0x43e7('0x29'),_0x5332d9[_0x43e7('0x15')])[_0x43e7('0x7')](respondWithResult(_0x5d84f4,null))[_0x43e7('0x16')](handleError(_0x5d84f4,null));};exports[_0x43e7('0x2a')]=function(_0x1ed538,_0x1d4589){return respondWithRpcPromise(_0x43e7('0x2b'),_0x1ed538['query'])[_0x43e7('0x7')](respondWithResult(_0x1d4589,null))[_0x43e7('0x16')](handleError(_0x1d4589,null));};exports['agents']=function(_0x2d54c1,_0x4c0c7a){var _0x44d8e4;return respondWithRpcPromise(_0x43e7('0x2c'),_0x2d54c1[_0x43e7('0x15')])[_0x43e7('0x7')](function(_0x35ac85){_0x44d8e4=_0x35ac85;return respondWithRpcPromise(_0x43e7('0x2c'),_0x2d54c1['query'],routingClient);})['then'](function(_0x30dfa9){return _[_0x43e7('0x19')]({},_0x30dfa9,_0x44d8e4);})[_0x43e7('0x7')](respondWithResult(_0x4c0c7a,null))[_0x43e7('0x16')](handleError(_0x4c0c7a,null));};exports[_0x43e7('0x2d')]=function(_0x4a4a85,_0x32a451){if(_0x4a4a85[_0x43e7('0x20')]&&_0x4a4a85['body'][_0x43e7('0x2e')]&&_0x4a4a85['user']&&_0x4a4a85[_0x43e7('0x2f')]['name']){for(var _0x3d81ae in _0x4a4a85[_0x43e7('0x20')][_0x43e7('0x2e')]){if(_0x4a4a85[_0x43e7('0x20')]['interaction']['hasOwnProperty'](_0x3d81ae)){db[_0x43e7('0x30')][_0x43e7('0x31')]({'where':{'channel':_0x3d81ae,'membername':_0x4a4a85[_0x43e7('0x2f')][_0x43e7('0xe')],'type':'INTERACTION','exitAt':null,'uniqueid':_0x4a4a85['body']['interaction'][_0x3d81ae]&&_0x4a4a85[_0x43e7('0x20')]['interaction'][_0x3d81ae][_0x43e7('0x32')]?{'$notIn':_0x4a4a85['body']['interaction'][_0x3d81ae]}:{'$ne':null}}})[_0x43e7('0x7')](function(_0x5ee1c5){var _0x2de14f=moment()[_0x43e7('0x33')](_0x43e7('0x34'));for(var _0x99b9e1=0x0,_0x4fc5e8=_0x5ee1c5[_0x43e7('0x32')];_0x99b9e1<_0x4fc5e8;_0x99b9e1+=0x1){_0x5ee1c5[_0x99b9e1][_0x43e7('0x35')]({'exitAt':_0x2de14f});}});for(var _0x23a611=0x0;_0x23a611<_0x4a4a85[_0x43e7('0x20')][_0x43e7('0x2e')][_0x3d81ae][_0x43e7('0x32')];_0x23a611+=0x1){db['MemberReport']['findOrCreate']({'where':{'channel':_0x3d81ae,'membername':_0x4a4a85[_0x43e7('0x2f')][_0x43e7('0xe')],'type':_0x43e7('0x36'),'uniqueid':_0x4a4a85['body']['interaction'][_0x3d81ae][_0x23a611],'exitAt':null},'defaults':{'channel':_0x3d81ae,'membername':_0x4a4a85['user'][_0x43e7('0xe')],'interface':_[_0x43e7('0x10')](_0x4a4a85['user'][_0x43e7('0x37')])?util[_0x43e7('0x33')](_0x43e7('0x38'),_0x4a4a85['user']['name']):_0x4a4a85['user']['interface'],'type':_0x43e7('0x36'),'enterAt':moment()[_0x43e7('0x33')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x43e7('0x39'),'internal':_0x4a4a85[_0x43e7('0x2f')][_0x43e7('0x3a')],'uniqueid':_0x4a4a85[_0x43e7('0x20')]['interaction'][_0x3d81ae][_0x23a611]}});}}}}return respondWithRpcPromise(_0x43e7('0x3b'),{'id':_0x4a4a85['params']['id'],'capacity':_0x4a4a85['body'][_0x43e7('0x3c')]},routingClient)[_0x43e7('0x7')](respondWithResult(_0x32a451,null))[_0x43e7('0x16')](handleError(_0x32a451,null));};exports[_0x43e7('0x3d')]=function(_0x13503c,_0x2351cf){return respondWithRpcPromise(_0x43e7('0x3e'),_0x13503c[_0x43e7('0x15')])[_0x43e7('0x7')](respondWithResult(_0x2351cf,null))[_0x43e7('0x16')](handleError(_0x2351cf,null));};exports['trunks']=function(_0x119d34,_0x46c910){return respondWithRpcPromise('Trunks',_0x119d34[_0x43e7('0x15')])['then'](respondWithResult(_0x46c910,null))[_0x43e7('0x16')](handleError(_0x46c910,null));};exports[_0x43e7('0x3f')]=function(_0x34e2ec,_0x1f561f){return respondWithRpcPromise(_0x43e7('0x40'),_0x34e2ec['query'])['then'](respondWithResult(_0x1f561f,null))[_0x43e7('0x16')](handleError(_0x1f561f,null));};exports[_0x43e7('0x41')]=function(_0x399942,_0x29c53d){return respondWithRpcPromise(_0x43e7('0x42'),_0x399942[_0x43e7('0x15')],routingClient)[_0x43e7('0x7')](respondWithResult(_0x29c53d,null))[_0x43e7('0x16')](handleError(_0x29c53d,null));};exports[_0x43e7('0x43')]=function(_0x24e758,_0x312306){return respondWithRpcPromise('ChatQueues',_0x24e758[_0x43e7('0x15')],routingClient)[_0x43e7('0x7')](findById(_0x24e758['params']['id']))[_0x43e7('0x7')](respondWithResult(_0x312306,null))[_0x43e7('0x16')](handleError(_0x312306,null));};exports[_0x43e7('0x44')]=function(_0x558d54,_0x5d63c6){return respondWithRpcPromise(_0x43e7('0x45'),_0x558d54[_0x43e7('0x15')],routingClient)['then'](respondWithResult(_0x5d63c6,null))[_0x43e7('0x16')](handleError(_0x5d63c6,null));};exports['showMailQueues']=function(_0x49a6ce,_0x1fa3f6){return respondWithRpcPromise(_0x43e7('0x45'),_0x49a6ce[_0x43e7('0x15')],routingClient)[_0x43e7('0x7')](findById(_0x49a6ce[_0x43e7('0x1a')]['id']))['then'](respondWithResult(_0x1fa3f6,null))[_0x43e7('0x16')](handleError(_0x1fa3f6,null));};exports[_0x43e7('0x46')]=function(_0x4d89bd,_0x20283b){return respondWithRpcPromise(_0x43e7('0x47'),_0x4d89bd[_0x43e7('0x15')],mailClient)['then'](respondWithResult(_0x20283b,null))['catch'](handleError(_0x20283b,null));};exports['openchannelQueues']=function(_0x2ada55,_0x4058ce){return respondWithRpcPromise(_0x43e7('0x48'),_0x2ada55[_0x43e7('0x15')],routingClient)['then'](respondWithResult(_0x4058ce,null))['catch'](handleError(_0x4058ce,null));};exports[_0x43e7('0x49')]=function(_0x8b50bb,_0x140438){return respondWithRpcPromise(_0x43e7('0x48'),_0x8b50bb['query'],routingClient)[_0x43e7('0x7')](findById(_0x8b50bb[_0x43e7('0x1a')]['id']))[_0x43e7('0x7')](respondWithResult(_0x140438,null))[_0x43e7('0x16')](handleError(_0x140438,null));};exports[_0x43e7('0x4a')]=function(_0xd41e79,_0x4665db){return respondWithRpcPromise(_0x43e7('0x4b'),_0xd41e79[_0x43e7('0x15')],routingClient)[_0x43e7('0x7')](respondWithResult(_0x4665db,null))[_0x43e7('0x16')](handleError(_0x4665db,null));};exports['showSmsQueues']=function(_0x5f3824,_0x2b0711){return respondWithRpcPromise('SmsQueues',_0x5f3824['query'],routingClient)['then'](findById(_0x5f3824[_0x43e7('0x1a')]['id']))[_0x43e7('0x7')](respondWithResult(_0x2b0711,null))['catch'](handleError(_0x2b0711,null));};exports[_0x43e7('0x4c')]=function(_0x135791,_0x1d8438){return respondWithRpcPromise('WhatsappQueues',_0x135791[_0x43e7('0x15')],routingClient)[_0x43e7('0x7')](respondWithResult(_0x1d8438,null))[_0x43e7('0x16')](handleError(_0x1d8438,null));};exports[_0x43e7('0x4d')]=function(_0x2f43d7,_0x472a19){return respondWithRpcPromise(_0x43e7('0x4e'),_0x2f43d7['query'],routingClient)[_0x43e7('0x7')](findById(_0x2f43d7[_0x43e7('0x1a')]['id']))[_0x43e7('0x7')](respondWithResult(_0x472a19,null))['catch'](handleError(_0x472a19,null));};exports['faxQueues']=function(_0x30377a,_0x5c3ad8){return respondWithRpcPromise('FaxQueues',_0x30377a[_0x43e7('0x15')],routingClient)[_0x43e7('0x7')](respondWithResult(_0x5c3ad8,null))['catch'](handleError(_0x5c3ad8,null));};exports[_0x43e7('0x4f')]=function(_0x28b21d,_0x1e2fed){return respondWithRpcPromise(_0x43e7('0x50'),_0x28b21d[_0x43e7('0x15')],routingClient)[_0x43e7('0x7')](findById(_0x28b21d[_0x43e7('0x1a')]['id']))['then'](respondWithResult(_0x1e2fed,null))[_0x43e7('0x16')](handleError(_0x1e2fed,null));};exports[_0x43e7('0x51')]=function(_0x4e5956,_0x418213){return respondWithRpcPromise('FaxAccounts',_0x4e5956[_0x43e7('0x15')])[_0x43e7('0x7')](respondWithResult(_0x418213,null))[_0x43e7('0x16')](handleError(_0x418213,null));};exports[_0x43e7('0x52')]=function(_0x506361,_0x2d25b5){return respondWithRpcPromise(_0x43e7('0x53'),_0x506361[_0x43e7('0x15')],routingClient)['then'](respondWithResult(_0x2d25b5,null))[_0x43e7('0x16')](handleError(_0x2d25b5,null));};exports[_0x43e7('0x54')]=function(_0x219dc6,_0x703a30){return respondWithRpcPromise(_0x43e7('0x55'),_0x219dc6['query'],routingClient)[_0x43e7('0x7')](respondWithResult(_0x703a30,null))[_0x43e7('0x16')](handleError(_0x703a30,null));};exports[_0x43e7('0x56')]=function(_0x2499ef,_0x433d3c){return respondWithRpcPromise(_0x43e7('0x57'),_0x2499ef[_0x43e7('0x15')],routingClient)['then'](respondWithResult(_0x433d3c,null))['catch'](handleError(_0x433d3c,null));};exports[_0x43e7('0x58')]=function(_0x536477,_0x550036){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x536477[_0x43e7('0x15')],routingClient)[_0x43e7('0x7')](function(_0x230fda){if(_0x536477[_0x43e7('0x15')][_0x43e7('0x59')]!==undefined){var _0x1ae0c8=_(_0x230fda['rows'])[_0x43e7('0x5a')]([_0x536477[_0x43e7('0x15')][_0x43e7('0x59')],_0x536477['params']['id']])[_0x43e7('0x5b')](_0x43e7('0x5c'))[_0x43e7('0x5d')]()[_0x43e7('0x5e')]();return _0x230fda[_0x43e7('0x12')][_0x43e7('0x5a')](function(_0x1d4a29){return _0x1ae0c8[_0x43e7('0x5f')](_0x1d4a29['queue_id'])>-0x1;});}else{return _0x230fda['rows']['filter'](function(_0x156074){return _0x156074[_0x43e7('0x5c')]===parseInt(_0x536477['params']['id']);});}})[_0x43e7('0x7')](respondWithResult(_0x550036,null))[_0x43e7('0x16')](handleError(_0x550036,null));};exports[_0x43e7('0x60')]=function(_0x8e60f1,_0x5a5565){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x8e60f1['query'],routingClient)[_0x43e7('0x7')](respondWithResult(_0x5a5565,null))[_0x43e7('0x16')](handleError(_0x5a5565,null));};exports['whatsappQueuesWaitingInteractions']=function(_0x58cbb7,_0x21adf7){return respondWithRpcPromise(_0x43e7('0x61'),_0x58cbb7[_0x43e7('0x15')],routingClient)['then'](respondWithResult(_0x21adf7,null))[_0x43e7('0x16')](handleError(_0x21adf7,null));};exports[_0x43e7('0x62')]=function(_0x401654,_0xb04082){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x401654[_0x43e7('0x15')],routingClient)['then'](respondWithResult(_0xb04082,null))[_0x43e7('0x16')](handleError(_0xb04082,null));};exports[_0x43e7('0x63')]=function(_0x24a168){return function(_0x90667c,_0xa7cb2c){var _0x45adef,_0x126133;var _0x5e8d4e=_[_0x43e7('0x64')](_0x24a168);var _0x40257e=_0x24a168===_0x43e7('0x65')?_0x43e7('0x66'):'Account';return db[_0x5e8d4e+'Queue']['findOne']({'raw':!![],'where':{'id':_0x90667c[_0x43e7('0x1a')]['id']}})['then'](function(_0x240f0d){if(_[_0x43e7('0x10')](_0x240f0d)){throw new Error(_0x5e8d4e+_0x43e7('0x67'));}_0x45adef=_0x240f0d;return db[_0x5e8d4e+_0x43e7('0x68')][_0x43e7('0x69')]({'where':{'id':_0x90667c[_0x43e7('0x20')][_0x43e7('0x6a')]},'include':[{'model':db[_0x5e8d4e+_0x43e7('0x6b')],'as':_0x43e7('0x6b')},{'model':db[_0x5e8d4e+_0x40257e],'as':_0x43e7('0x6c')}]});})[_0x43e7('0x7')](function(_0x5b3565){if(_[_0x43e7('0x10')](_0x5b3565)){throw new Error(_0x5e8d4e+_0x43e7('0x6d'));}_0x126133=_0x5b3565;return _0x5b3565[_0x43e7('0x6e')]({'read':0x0,'readAt':null,'UserId':null});})[_0x43e7('0x7')](function(){var _0x206e54={'uniqueid':_0x24a168+'.'+_0x126133['id']+'.'+_0x126133['Interaction']['id'],'FromUserId':_0x90667c['user']['id'],'type':_0x43e7('0x6f')};_0x206e54[_0x5e8d4e+_0x43e7('0x70')]=_0x126133['id'];_0x206e54[_0x5e8d4e+'InteractionId']=_0x126133[_0x43e7('0x6b')]['id'];_0x206e54[_0x43e7('0x71')+_0x5e8d4e+_0x40257e+'Id']=_0x126133['Account']['id'];_0x206e54['To'+_0x5e8d4e+'QueueId']=_0x45adef['id'];return db[_0x5e8d4e+_0x43e7('0x72')][_0x43e7('0x73')](_0x206e54);})[_0x43e7('0x7')](function(){return respondWithRpcPromise(_0x43e7('0x74'),{'channel':_0x24a168,'interaction':_0x126133[_0x43e7('0x6b')],'message':_0x126133,'account':_0x126133['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x45adef[_0x43e7('0xe')]+','+(_0x126133[_0x43e7('0x6c')][_0x43e7('0x75')]||0x12c),'interval':_0x43e7('0x76')}]},routingClient);})['then'](respondWithResult(_0xa7cb2c,null))[_0x43e7('0x16')](handleError(_0xa7cb2c,null));};};exports[_0x43e7('0x77')]=function(_0x1ed590,_0x15ee83){var _0x5bc060,_0x3a4962;if(_[_0x43e7('0x10')](_0x1ed590[_0x43e7('0x20')][_0x43e7('0x78')])){throw new Error(_0x43e7('0x79'));}var _0x4ef289=_0x1ed590[_0x43e7('0x20')][_0x43e7('0x78')];var _0x509d8d=_[_0x43e7('0x64')](_0x4ef289);var _0x2ca6fb=_0x4ef289===_0x43e7('0x65')?_0x43e7('0x66'):'Account';return db[_0x43e7('0x7a')]['findOne']({'raw':!![],'where':{'id':_0x1ed590[_0x43e7('0x1a')]['id'],'role':_0x43e7('0x39')}})[_0x43e7('0x7')](function(_0x2614ff){if(_[_0x43e7('0x10')](_0x2614ff)){throw new Error(_0x43e7('0x7b'));}_0x5bc060=_0x2614ff;return db[_0x509d8d+_0x43e7('0x68')][_0x43e7('0x69')]({'where':{'id':_0x1ed590[_0x43e7('0x20')]['messageId']},'include':[{'model':db[_0x509d8d+_0x43e7('0x6b')],'as':_0x43e7('0x6b')},{'model':db[_0x509d8d+_0x2ca6fb],'as':_0x43e7('0x6c')}]});})[_0x43e7('0x7')](function(_0x56593f){if(_['isNil'](_0x56593f)){throw new Error(_0x509d8d+_0x43e7('0x6d'));}_0x3a4962=_0x56593f;return _0x56593f[_0x43e7('0x6e')]({'read':0x0,'readAt':null,'UserId':null});})[_0x43e7('0x7')](function(){var _0x4d30f7={'uniqueid':_0x4ef289+'.'+_0x3a4962['id']+'.'+_0x3a4962[_0x43e7('0x6b')]['id'],'FromUserId':_0x1ed590['user']['id'],'type':'queue','ToUserId':_0x5bc060['id']};_0x4d30f7[_0x509d8d+'MessageId']=_0x3a4962['id'];_0x4d30f7[_0x509d8d+_0x43e7('0x7c')]=_0x3a4962['Interaction']['id'];_0x4d30f7[_0x43e7('0x71')+_0x509d8d+_0x2ca6fb+'Id']=_0x3a4962[_0x43e7('0x6c')]['id'];return db[_0x509d8d+_0x43e7('0x72')][_0x43e7('0x73')](_0x4d30f7);})[_0x43e7('0x7')](function(){return respondWithRpcPromise('Start',{'channel':_0x4ef289,'interaction':_0x3a4962['Interaction'],'message':_0x3a4962,'account':_0x3a4962[_0x43e7('0x6c')],'applications':[{'id':0x0,'priority':0x1,'app':_0x43e7('0x39'),'appdata':_0x5bc060['name']+','+(_0x3a4962[_0x43e7('0x6c')][_0x43e7('0x7d')]||0x12c),'interval':_0x43e7('0x76')}]},routingClient);})[_0x43e7('0x7')](respondWithResult(_0x15ee83,null))[_0x43e7('0x16')](handleError(_0x15ee83,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index f4db08d..3c2dbd8 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 _0xa44d=['show','run','post','create','put','/:id','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./schedule.controller','get','isAuthenticated','index'];(function(_0xabd731,_0x43241d){var _0x9c7930=function(_0x1fc16){while(--_0x1fc16){_0xabd731['push'](_0xabd731['shift']());}};_0x9c7930(++_0x43241d);}(_0xa44d,0x72));var _0xda44=function(_0x470bfb,_0x389787){_0x470bfb=_0x470bfb-0x0;var _0x2f5d97=_0xa44d[_0x470bfb];return _0x2f5d97;};'use strict';var multer=require(_0xda44('0x0'));var util=require(_0xda44('0x1'));var path=require(_0xda44('0x2'));var timeout=require(_0xda44('0x3'));var express=require(_0xda44('0x4'));var router=express[_0xda44('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xda44('0x6'));var config=require(_0xda44('0x7'));var controller=require(_0xda44('0x8'));router[_0xda44('0x9')]('/',auth[_0xda44('0xa')](),controller[_0xda44('0xb')]);router[_0xda44('0x9')]('/:id',auth[_0xda44('0xa')](),controller[_0xda44('0xc')]);router['get']('/:id/run',auth['isAuthenticated'](),controller[_0xda44('0xd')]);router[_0xda44('0xe')]('/',auth['isAuthenticated'](),controller[_0xda44('0xf')]);router[_0xda44('0x10')](_0xda44('0x11'),auth[_0xda44('0xa')](),controller[_0xda44('0x12')]);router[_0xda44('0x13')](_0xda44('0x11'),auth[_0xda44('0xa')](),controller['destroy']);module[_0xda44('0x14')]=router; \ No newline at end of file +var _0xb620=['run','create','put','update','delete','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','/:id','isAuthenticated','show','/:id/run'];(function(_0x39eb62,_0x2094e5){var _0x1ec179=function(_0x294ff1){while(--_0x294ff1){_0x39eb62['push'](_0x39eb62['shift']());}};_0x1ec179(++_0x2094e5);}(_0xb620,0x92));var _0x0b62=function(_0x1eaf12,_0x1ef3bf){_0x1eaf12=_0x1eaf12-0x0;var _0x10451c=_0xb620[_0x1eaf12];return _0x10451c;};'use strict';var multer=require(_0x0b62('0x0'));var util=require(_0x0b62('0x1'));var path=require(_0x0b62('0x2'));var timeout=require('connect-timeout');var express=require(_0x0b62('0x3'));var router=express[_0x0b62('0x4')]();var fs_extra=require(_0x0b62('0x5'));var auth=require(_0x0b62('0x6'));var interaction=require(_0x0b62('0x7'));var config=require('../../config/environment');var controller=require('./schedule.controller');router[_0x0b62('0x8')]('/',auth['isAuthenticated'](),controller[_0x0b62('0x9')]);router[_0x0b62('0x8')](_0x0b62('0xa'),auth[_0x0b62('0xb')](),controller[_0x0b62('0xc')]);router[_0x0b62('0x8')](_0x0b62('0xd'),auth[_0x0b62('0xb')](),controller[_0x0b62('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x0b62('0xf')]);router[_0x0b62('0x10')](_0x0b62('0xa'),auth['isAuthenticated'](),controller[_0x0b62('0x11')]);router[_0x0b62('0x12')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x0b62('0x13')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 794da1b..abb0f3e 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 _0x00ef=['days','hours','csv','xlsx','custom','TEXT','sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years','quarters','months','weeks'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x00ef,0x126));var _0xf00e=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x00ef[_0x21a9d9];return _0x46adce;};'use strict';var Sequelize=require(_0xf00e('0x0'));module[_0xf00e('0x1')]={'name':{'type':Sequelize[_0xf00e('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xf00e('0x2')]},'active':{'type':Sequelize[_0xf00e('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xf00e('0x2')],'allowNull':![],'defaultValue':_0xf00e('0x4')},'startAt':{'type':Sequelize[_0xf00e('0x5')],'allowNull':![]},'endAt':{'type':Sequelize[_0xf00e('0x5')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xf00e('0x6')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xf00e('0x7')](_0xf00e('0x8'),_0xf00e('0x9'),_0xf00e('0xa'),_0xf00e('0xb'),_0xf00e('0xc'),_0xf00e('0xd'),'minutes'),'allowNull':![],'defaultValue':_0xf00e('0xc')},'output':{'type':Sequelize['ENUM'](_0xf00e('0xe'),'pdf',_0xf00e('0xf')),'allowNull':![],'defaultValue':_0xf00e('0xe')},'type':{'type':Sequelize[_0xf00e('0x7')](_0xf00e('0x10'),'default'),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize[_0xf00e('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0xf00e('0x2')]},'cc':{'type':Sequelize[_0xf00e('0x11')]},'bcc':{'type':Sequelize[_0xf00e('0x11')]},'sendIfEmpty':{'type':Sequelize[_0xf00e('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x7101=['DATE','INTEGER','years','days','hours','ENUM','csv','pdf','xlsx','default','custom','TEXT','sequelize','exports','STRING','BOOLEAN'];(function(_0x505cba,_0x160403){var _0x1c800b=function(_0x360e6d){while(--_0x360e6d){_0x505cba['push'](_0x505cba['shift']());}};_0x1c800b(++_0x160403);}(_0x7101,0x9c));var _0x1710=function(_0x357d4f,_0x4a6935){_0x357d4f=_0x357d4f-0x0;var _0x2ed6a4=_0x7101[_0x357d4f];return _0x2ed6a4;};'use strict';var Sequelize=require(_0x1710('0x0'));module[_0x1710('0x1')]={'name':{'type':Sequelize[_0x1710('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x1710('0x2')]},'active':{'type':Sequelize[_0x1710('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize[_0x1710('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x1710('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM'](_0x1710('0x6'),'quarters','months','weeks',_0x1710('0x7'),_0x1710('0x8'),'minutes'),'allowNull':![],'defaultValue':_0x1710('0x7')},'output':{'type':Sequelize[_0x1710('0x9')](_0x1710('0xa'),_0x1710('0xb'),_0x1710('0xc')),'allowNull':![],'defaultValue':_0x1710('0xa')},'type':{'type':Sequelize['ENUM']('custom',_0x1710('0xd')),'allowNull':![],'defaultValue':_0x1710('0xe')},'sendMail':{'type':Sequelize[_0x1710('0x3')],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x1710('0xf')]},'bcc':{'type':Sequelize[_0x1710('0xf')]},'sendIfEmpty':{'type':Sequelize[_0x1710('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 867d8c7..7c727d3 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 _0xf3bd=['../../config/license/util','../../mysqldb','sendStatus','json','offset','limit','count','status','set','update','then','destroy','get','Scheduler','UserProfileResource','end','error','stack','name','map','Schedule','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','where','merge','options','includeAll','include','findAll','catch','show','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','../../config/schedule','run','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment'];(function(_0x4637fa,_0x47a241){var _0x6f7950=function(_0x59cf0b){while(--_0x59cf0b){_0x4637fa['push'](_0x4637fa['shift']());}};_0x6f7950(++_0x47a241);}(_0xf3bd,0x161));var _0xdf3b=function(_0x2377b8,_0x4f7adb){_0x2377b8=_0x2377b8-0x0;var _0xe9b877=_0xf3bd[_0x2377b8];return _0xe9b877;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xdf3b('0x0'));var jsonpatch=require(_0xdf3b('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xdf3b('0x2'));var Mustache=require(_0xdf3b('0x3'));var util=require(_0xdf3b('0x4'));var path=require(_0xdf3b('0x5'));var sox=require(_0xdf3b('0x6'));var csv=require(_0xdf3b('0x7'));var ejs=require(_0xdf3b('0x8'));var fs=require('fs');var fs_extra=require(_0xdf3b('0x9'));var _=require(_0xdf3b('0xa'));var squel=require(_0xdf3b('0xb'));var crypto=require(_0xdf3b('0xc'));var jsforce=require(_0xdf3b('0xd'));var deskjs=require(_0xdf3b('0xe'));var toCsv=require(_0xdf3b('0x7'));var querystring=require(_0xdf3b('0xf'));var Papa=require(_0xdf3b('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xdf3b('0x11'));var as=require(_0xdf3b('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xdf3b('0x13'));var utils=require(_0xdf3b('0x14'));var config=require(_0xdf3b('0x15'));var licenseUtil=require(_0xdf3b('0x16'));var db=require(_0xdf3b('0x17'))['db'];function respondWithStatusCode(_0xddd2c1,_0x18f1db){_0x18f1db=_0x18f1db||0xcc;return function(_0xefde15){if(_0xefde15){return _0xddd2c1[_0xdf3b('0x18')](_0x18f1db);}return _0xddd2c1['status'](_0x18f1db)['end']();};}function respondWithResult(_0x184781,_0x43763d){_0x43763d=_0x43763d||0xc8;return function(_0x45c41e){if(_0x45c41e){return _0x184781['status'](_0x43763d)[_0xdf3b('0x19')](_0x45c41e);}};}function respondWithFilteredResult(_0x590e02,_0x2ee055){return function(_0x40b7da){if(_0x40b7da){var _0xba510e=typeof _0x2ee055[_0xdf3b('0x1a')]==='undefined'&&typeof _0x2ee055[_0xdf3b('0x1b')]==='undefined';var _0x5b1340=_0x40b7da[_0xdf3b('0x1c')];var _0x44dff6=_0xba510e?0x0:_0x2ee055[_0xdf3b('0x1a')];var _0xdaf649=_0xba510e?_0x40b7da['count']:_0x2ee055[_0xdf3b('0x1a')]+_0x2ee055[_0xdf3b('0x1b')];var _0x1a6b07;if(_0xdaf649>=_0x5b1340){_0xdaf649=_0x5b1340;_0x1a6b07=0xc8;}else{_0x1a6b07=0xce;}_0x590e02[_0xdf3b('0x1d')](_0x1a6b07);return _0x590e02[_0xdf3b('0x1e')]('Content-Range',_0x44dff6+'-'+_0xdaf649+'/'+_0x5b1340)[_0xdf3b('0x19')](_0x40b7da);}return null;};}function patchUpdates(_0x569804){return function(_0x10f134){try{jsonpatch['apply'](_0x10f134,_0x569804,!![]);}catch(_0x35f27f){return BPromise['reject'](_0x35f27f);}return _0x10f134['save']();};}function saveUpdates(_0x52b326,_0x3dc37b){return function(_0x13afb2){if(_0x13afb2){return _0x13afb2[_0xdf3b('0x1f')](_0x52b326)[_0xdf3b('0x20')](function(_0x4d62c6){return _0x4d62c6;});}return null;};}function removeEntity(_0x545b51,_0x5f37e4){return function(_0xebebd0){if(_0xebebd0){return _0xebebd0[_0xdf3b('0x21')]()[_0xdf3b('0x20')](function(){var _0xa0bd11=_0xebebd0[_0xdf3b('0x22')]({'plain':!![]});var _0x56c70c=_0xdf3b('0x23');return db[_0xdf3b('0x24')][_0xdf3b('0x21')]({'where':{'type':_0x56c70c,'resourceId':_0xa0bd11['id']}})[_0xdf3b('0x20')](function(){return _0xebebd0;});})[_0xdf3b('0x20')](function(){_0x545b51[_0xdf3b('0x1d')](0xcc)[_0xdf3b('0x25')]();});}};}function handleEntityNotFound(_0x457d5a,_0x1f01bb){return function(_0x1d0916){if(!_0x1d0916){_0x457d5a['sendStatus'](0x194);}return _0x1d0916;};}function handleError(_0x4925b4,_0x230cfa){_0x230cfa=_0x230cfa||0x1f4;return function(_0x1d4f00){logger[_0xdf3b('0x26')](_0x1d4f00[_0xdf3b('0x27')]);if(_0x1d4f00[_0xdf3b('0x28')]){delete _0x1d4f00[_0xdf3b('0x28')];}_0x4925b4['status'](_0x230cfa)['send'](_0x1d4f00);};}exports['index']=function(_0x4d49b8,_0x4bd427){var _0x2bccf1={},_0x1178cd={},_0x1296a6={'count':0x0,'rows':[]};var _0x4beb2c=_[_0xdf3b('0x29')](db[_0xdf3b('0x2a')][_0xdf3b('0x2b')],function(_0x247532){return{'name':_0x247532[_0xdf3b('0x2c')],'type':_0x247532[_0xdf3b('0x2d')]['key']};});_0x1178cd[_0xdf3b('0x2e')]=_[_0xdf3b('0x29')](_0x4beb2c,_0xdf3b('0x28'));_0x1178cd[_0xdf3b('0x2f')]=_['keys'](_0x4d49b8['query']);_0x1178cd[_0xdf3b('0x30')]=_[_0xdf3b('0x31')](_0x1178cd[_0xdf3b('0x2e')],_0x1178cd[_0xdf3b('0x2f')]);_0x2bccf1[_0xdf3b('0x32')]=_[_0xdf3b('0x31')](_0x1178cd[_0xdf3b('0x2e')],qs['fields'](_0x4d49b8['query'][_0xdf3b('0x33')]));_0x2bccf1['attributes']=_0x2bccf1['attributes'][_0xdf3b('0x34')]?_0x2bccf1[_0xdf3b('0x32')]:_0x1178cd[_0xdf3b('0x2e')];if(!_0x4d49b8['query'][_0xdf3b('0x35')]('nolimit')){_0x2bccf1[_0xdf3b('0x1b')]=qs[_0xdf3b('0x1b')](_0x4d49b8['query'][_0xdf3b('0x1b')]);_0x2bccf1[_0xdf3b('0x1a')]=qs['offset'](_0x4d49b8[_0xdf3b('0x2f')][_0xdf3b('0x1a')]);}_0x2bccf1[_0xdf3b('0x36')]=qs['sort'](_0x4d49b8['query']['sort']);_0x2bccf1[_0xdf3b('0x37')]=qs[_0xdf3b('0x30')](_['pick'](_0x4d49b8[_0xdf3b('0x2f')],_0x1178cd[_0xdf3b('0x30')]),_0x4beb2c);if(_0x4d49b8['query']['filter']){_0x2bccf1[_0xdf3b('0x37')]=_[_0xdf3b('0x38')](_0x2bccf1['where'],{'$or':_['map'](_0x4beb2c,function(_0x5c1fa2){if(_0x5c1fa2[_0xdf3b('0x2d')]!=='VIRTUAL'){var _0x2981b2={};_0x2981b2[_0x5c1fa2[_0xdf3b('0x28')]]={'$like':'%'+_0x4d49b8[_0xdf3b('0x2f')]['filter']+'%'};return _0x2981b2;}})});}_0x2bccf1=_[_0xdf3b('0x38')]({},_0x2bccf1,_0x4d49b8[_0xdf3b('0x39')]);var _0x38ff73={'where':_0x2bccf1[_0xdf3b('0x37')]};return db[_0xdf3b('0x2a')][_0xdf3b('0x1c')](_0x38ff73)[_0xdf3b('0x20')](function(_0x154136){_0x1296a6[_0xdf3b('0x1c')]=_0x154136;if(_0x4d49b8[_0xdf3b('0x2f')][_0xdf3b('0x3a')]){_0x2bccf1[_0xdf3b('0x3b')]=[{'all':!![]}];}return db['Schedule'][_0xdf3b('0x3c')](_0x2bccf1);})[_0xdf3b('0x20')](function(_0x2bba8f){_0x1296a6['rows']=_0x2bba8f;return _0x1296a6;})[_0xdf3b('0x20')](respondWithFilteredResult(_0x4bd427,_0x2bccf1))[_0xdf3b('0x3d')](handleError(_0x4bd427,null));};exports[_0xdf3b('0x3e')]=function(_0x1ecbd8,_0x2a8efe){var _0x235e35={'raw':![],'where':{'id':_0x1ecbd8[_0xdf3b('0x3f')]['id']}},_0x5dddda={};_0x5dddda[_0xdf3b('0x2e')]=_[_0xdf3b('0x40')](db[_0xdf3b('0x2a')][_0xdf3b('0x2b')]);_0x5dddda[_0xdf3b('0x2f')]=_[_0xdf3b('0x40')](_0x1ecbd8['query']);_0x5dddda[_0xdf3b('0x30')]=_['intersection'](_0x5dddda[_0xdf3b('0x2e')],_0x5dddda[_0xdf3b('0x2f')]);_0x235e35[_0xdf3b('0x32')]=_[_0xdf3b('0x31')](_0x5dddda[_0xdf3b('0x2e')],qs[_0xdf3b('0x33')](_0x1ecbd8[_0xdf3b('0x2f')][_0xdf3b('0x33')]));_0x235e35['attributes']=_0x235e35['attributes'][_0xdf3b('0x34')]?_0x235e35[_0xdf3b('0x32')]:_0x5dddda[_0xdf3b('0x2e')];if(_0x1ecbd8['query']['includeAll']){_0x235e35[_0xdf3b('0x3b')]=[{'all':!![]}];}_0x235e35=_[_0xdf3b('0x38')]({},_0x235e35,_0x1ecbd8['options']);return db[_0xdf3b('0x2a')][_0xdf3b('0x41')](_0x235e35)[_0xdf3b('0x20')](handleEntityNotFound(_0x2a8efe,null))[_0xdf3b('0x20')](respondWithResult(_0x2a8efe,null))[_0xdf3b('0x3d')](handleError(_0x2a8efe,null));};exports[_0xdf3b('0x42')]=function(_0x2cb724,_0x1d4699){return db['Schedule'][_0xdf3b('0x42')](_0x2cb724[_0xdf3b('0x43')],{})[_0xdf3b('0x20')](function(_0x27ae24){var _0x5802d8=_0x2cb724[_0xdf3b('0x44')]['get']({'plain':!![]});if(!_0x5802d8)throw new Error(_0xdf3b('0x45'));if(_0x5802d8[_0xdf3b('0x46')]==='user'){var _0x11d5f4=_0x27ae24['get']({'plain':!![]});var _0x5a4194=_0xdf3b('0x23');return db[_0xdf3b('0x47')][_0xdf3b('0x41')]({'where':{'name':_0x5a4194,'userProfileId':_0x5802d8['userProfileId']},'raw':!![]})[_0xdf3b('0x20')](function(_0x92fc25){if(_0x92fc25&&_0x92fc25['autoAssociation']===0x0){return db['UserProfileResource'][_0xdf3b('0x42')]({'name':_0x11d5f4[_0xdf3b('0x28')],'resourceId':_0x11d5f4['id'],'type':_0x92fc25[_0xdf3b('0x28')],'sectionId':_0x92fc25['id']},{})[_0xdf3b('0x20')](function(){return _0x27ae24;});}else{return _0x27ae24;}})['catch'](function(_0xdf1bed){logger[_0xdf3b('0x26')](_0xdf3b('0x48'),_0xdf1bed);throw _0xdf1bed;});}return _0x27ae24;})['then'](respondWithResult(_0x1d4699,0xc9))['catch'](handleError(_0x1d4699,null));};exports[_0xdf3b('0x1f')]=function(_0x4bac9b,_0x3b0ebb){if(_0x4bac9b[_0xdf3b('0x43')]['id']){delete _0x4bac9b[_0xdf3b('0x43')]['id'];}return db[_0xdf3b('0x2a')][_0xdf3b('0x41')]({'where':{'id':_0x4bac9b[_0xdf3b('0x3f')]['id']}})[_0xdf3b('0x20')](handleEntityNotFound(_0x3b0ebb,null))[_0xdf3b('0x20')](saveUpdates(_0x4bac9b[_0xdf3b('0x43')],null))[_0xdf3b('0x20')](respondWithResult(_0x3b0ebb,null))[_0xdf3b('0x3d')](handleError(_0x3b0ebb,null));};exports[_0xdf3b('0x21')]=function(_0xac220f,_0x3a8019){return db['Schedule']['find']({'where':{'id':_0xac220f[_0xdf3b('0x3f')]['id']}})['then'](handleEntityNotFound(_0x3a8019,null))[_0xdf3b('0x20')](removeEntity(_0x3a8019,null))[_0xdf3b('0x3d')](handleError(_0x3a8019,null));};exports['run']=function(_0x176fd5,_0x402b2f,_0x56c84d){var _0x4ba2b1=require(_0xdf3b('0x49'));return db['Schedule'][_0xdf3b('0x41')]({'where':{'id':_0x176fd5[_0xdf3b('0x3f')]['id']},'raw':!![]})[_0xdf3b('0x20')](handleEntityNotFound(_0x402b2f,null))['then'](function(){_0x4ba2b1[_0xdf3b('0x4a')](_0x176fd5[_0xdf3b('0x3f')]['id']);})[_0xdf3b('0x20')](respondWithStatusCode(_0x402b2f,null))['catch'](handleError(_0x402b2f,null));}; \ No newline at end of file +var _0xa0f7=['key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','Schedule','findAll','catch','show','params','rawAttributes','includeAll','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','update','run','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','reject','then','destroy','get','Scheduler','UserProfileResource','error','stack','name','index','map','fieldName'];(function(_0x193874,_0x30c7e3){var _0xebba4=function(_0x4d2e44){while(--_0x4d2e44){_0x193874['push'](_0x193874['shift']());}};_0xebba4(++_0x30c7e3);}(_0xa0f7,0x117));var _0x7a0f=function(_0x4ec834,_0x4feb6a){_0x4ec834=_0x4ec834-0x0;var _0x13d6ce=_0xa0f7[_0x4ec834];return _0x13d6ce;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7a0f('0x0'));var zipdir=require(_0x7a0f('0x1'));var jsonpatch=require(_0x7a0f('0x2'));var rp=require(_0x7a0f('0x3'));var moment=require('moment');var BPromise=require(_0x7a0f('0x4'));var Mustache=require(_0x7a0f('0x5'));var util=require('util');var path=require(_0x7a0f('0x6'));var sox=require('sox');var csv=require(_0x7a0f('0x7'));var ejs=require(_0x7a0f('0x8'));var fs=require('fs');var fs_extra=require(_0x7a0f('0x9'));var _=require(_0x7a0f('0xa'));var squel=require(_0x7a0f('0xb'));var crypto=require(_0x7a0f('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x7a0f('0xd'));var toCsv=require(_0x7a0f('0x7'));var querystring=require(_0x7a0f('0xe'));var Papa=require(_0x7a0f('0xf'));var Redis=require(_0x7a0f('0x10'));var authService=require(_0x7a0f('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x7a0f('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7a0f('0x13'))(_0x7a0f('0x14'));var utils=require('../../config/utils');var config=require(_0x7a0f('0x15'));var licenseUtil=require(_0x7a0f('0x16'));var db=require(_0x7a0f('0x17'))['db'];function respondWithStatusCode(_0x56ec42,_0x35f217){_0x35f217=_0x35f217||0xcc;return function(_0x863653){if(_0x863653){return _0x56ec42[_0x7a0f('0x18')](_0x35f217);}return _0x56ec42['status'](_0x35f217)[_0x7a0f('0x19')]();};}function respondWithResult(_0x5b92f9,_0x1c8882){_0x1c8882=_0x1c8882||0xc8;return function(_0x30684e){if(_0x30684e){return _0x5b92f9[_0x7a0f('0x1a')](_0x1c8882)[_0x7a0f('0x1b')](_0x30684e);}};}function respondWithFilteredResult(_0x19388c,_0x4ef699){return function(_0xa9c875){if(_0xa9c875){var _0x2b9f8a=typeof _0x4ef699[_0x7a0f('0x1c')]===_0x7a0f('0x1d')&&typeof _0x4ef699[_0x7a0f('0x1e')]==='undefined';var _0x4f5ea4=_0xa9c875[_0x7a0f('0x1f')];var _0x4f6d0a=_0x2b9f8a?0x0:_0x4ef699[_0x7a0f('0x1c')];var _0x5ea117=_0x2b9f8a?_0xa9c875[_0x7a0f('0x1f')]:_0x4ef699[_0x7a0f('0x1c')]+_0x4ef699[_0x7a0f('0x1e')];var _0x1f14fe;if(_0x5ea117>=_0x4f5ea4){_0x5ea117=_0x4f5ea4;_0x1f14fe=0xc8;}else{_0x1f14fe=0xce;}_0x19388c[_0x7a0f('0x1a')](_0x1f14fe);return _0x19388c['set'](_0x7a0f('0x20'),_0x4f6d0a+'-'+_0x5ea117+'/'+_0x4f5ea4)[_0x7a0f('0x1b')](_0xa9c875);}return null;};}function patchUpdates(_0x2359d5){return function(_0x4eebc3){try{jsonpatch['apply'](_0x4eebc3,_0x2359d5,!![]);}catch(_0x273b1a){return BPromise[_0x7a0f('0x21')](_0x273b1a);}return _0x4eebc3['save']();};}function saveUpdates(_0x1e5cd7,_0x89b88){return function(_0x2c839b){if(_0x2c839b){return _0x2c839b['update'](_0x1e5cd7)[_0x7a0f('0x22')](function(_0x26495d){return _0x26495d;});}return null;};}function removeEntity(_0x638ea2,_0x9663b1){return function(_0x59be35){if(_0x59be35){return _0x59be35[_0x7a0f('0x23')]()[_0x7a0f('0x22')](function(){var _0x252f16=_0x59be35[_0x7a0f('0x24')]({'plain':!![]});var _0x58e34d=_0x7a0f('0x25');return db[_0x7a0f('0x26')][_0x7a0f('0x23')]({'where':{'type':_0x58e34d,'resourceId':_0x252f16['id']}})[_0x7a0f('0x22')](function(){return _0x59be35;});})[_0x7a0f('0x22')](function(){_0x638ea2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x31db26,_0x4f390e){return function(_0x5805b4){if(!_0x5805b4){_0x31db26[_0x7a0f('0x18')](0x194);}return _0x5805b4;};}function handleError(_0x46ace3,_0x29cc9d){_0x29cc9d=_0x29cc9d||0x1f4;return function(_0x926b84){logger[_0x7a0f('0x27')](_0x926b84[_0x7a0f('0x28')]);if(_0x926b84['name']){delete _0x926b84[_0x7a0f('0x29')];}_0x46ace3[_0x7a0f('0x1a')](_0x29cc9d)['send'](_0x926b84);};}exports[_0x7a0f('0x2a')]=function(_0x3d369a,_0x180b73){var _0x5f0bd6={},_0x2b4df3={},_0xea3429={'count':0x0,'rows':[]};var _0x1dd60e=_[_0x7a0f('0x2b')](db['Schedule']['rawAttributes'],function(_0x3585af){return{'name':_0x3585af[_0x7a0f('0x2c')],'type':_0x3585af['type'][_0x7a0f('0x2d')]};});_0x2b4df3[_0x7a0f('0x2e')]=_['map'](_0x1dd60e,_0x7a0f('0x29'));_0x2b4df3[_0x7a0f('0x2f')]=_[_0x7a0f('0x30')](_0x3d369a[_0x7a0f('0x2f')]);_0x2b4df3[_0x7a0f('0x31')]=_[_0x7a0f('0x32')](_0x2b4df3[_0x7a0f('0x2e')],_0x2b4df3[_0x7a0f('0x2f')]);_0x5f0bd6[_0x7a0f('0x33')]=_['intersection'](_0x2b4df3[_0x7a0f('0x2e')],qs[_0x7a0f('0x34')](_0x3d369a[_0x7a0f('0x2f')][_0x7a0f('0x34')]));_0x5f0bd6[_0x7a0f('0x33')]=_0x5f0bd6['attributes'][_0x7a0f('0x35')]?_0x5f0bd6['attributes']:_0x2b4df3[_0x7a0f('0x2e')];if(!_0x3d369a[_0x7a0f('0x2f')][_0x7a0f('0x36')](_0x7a0f('0x37'))){_0x5f0bd6[_0x7a0f('0x1e')]=qs[_0x7a0f('0x1e')](_0x3d369a[_0x7a0f('0x2f')][_0x7a0f('0x1e')]);_0x5f0bd6['offset']=qs[_0x7a0f('0x1c')](_0x3d369a[_0x7a0f('0x2f')][_0x7a0f('0x1c')]);}_0x5f0bd6[_0x7a0f('0x38')]=qs[_0x7a0f('0x39')](_0x3d369a[_0x7a0f('0x2f')][_0x7a0f('0x39')]);_0x5f0bd6[_0x7a0f('0x3a')]=qs['filters'](_['pick'](_0x3d369a[_0x7a0f('0x2f')],_0x2b4df3[_0x7a0f('0x31')]),_0x1dd60e);if(_0x3d369a[_0x7a0f('0x2f')][_0x7a0f('0x3b')]){_0x5f0bd6['where']=_[_0x7a0f('0x3c')](_0x5f0bd6[_0x7a0f('0x3a')],{'$or':_[_0x7a0f('0x2b')](_0x1dd60e,function(_0x59ab7b){if(_0x59ab7b['type']!==_0x7a0f('0x3d')){var _0x42352f={};_0x42352f[_0x59ab7b[_0x7a0f('0x29')]]={'$like':'%'+_0x3d369a[_0x7a0f('0x2f')]['filter']+'%'};return _0x42352f;}})});}_0x5f0bd6=_['merge']({},_0x5f0bd6,_0x3d369a[_0x7a0f('0x3e')]);var _0x4e45ba={'where':_0x5f0bd6['where']};return db[_0x7a0f('0x3f')][_0x7a0f('0x1f')](_0x4e45ba)[_0x7a0f('0x22')](function(_0x2fc299){_0xea3429[_0x7a0f('0x1f')]=_0x2fc299;if(_0x3d369a[_0x7a0f('0x2f')]['includeAll']){_0x5f0bd6['include']=[{'all':!![]}];}return db[_0x7a0f('0x3f')][_0x7a0f('0x40')](_0x5f0bd6);})[_0x7a0f('0x22')](function(_0x312e31){_0xea3429['rows']=_0x312e31;return _0xea3429;})[_0x7a0f('0x22')](respondWithFilteredResult(_0x180b73,_0x5f0bd6))[_0x7a0f('0x41')](handleError(_0x180b73,null));};exports[_0x7a0f('0x42')]=function(_0x234ef9,_0x15da8b){var _0x52c15f={'raw':![],'where':{'id':_0x234ef9[_0x7a0f('0x43')]['id']}},_0x2e6164={};_0x2e6164[_0x7a0f('0x2e')]=_[_0x7a0f('0x30')](db[_0x7a0f('0x3f')][_0x7a0f('0x44')]);_0x2e6164[_0x7a0f('0x2f')]=_[_0x7a0f('0x30')](_0x234ef9['query']);_0x2e6164[_0x7a0f('0x31')]=_[_0x7a0f('0x32')](_0x2e6164[_0x7a0f('0x2e')],_0x2e6164[_0x7a0f('0x2f')]);_0x52c15f[_0x7a0f('0x33')]=_[_0x7a0f('0x32')](_0x2e6164['model'],qs[_0x7a0f('0x34')](_0x234ef9['query'][_0x7a0f('0x34')]));_0x52c15f['attributes']=_0x52c15f[_0x7a0f('0x33')][_0x7a0f('0x35')]?_0x52c15f['attributes']:_0x2e6164[_0x7a0f('0x2e')];if(_0x234ef9[_0x7a0f('0x2f')][_0x7a0f('0x45')]){_0x52c15f[_0x7a0f('0x46')]=[{'all':!![]}];}_0x52c15f=_[_0x7a0f('0x3c')]({},_0x52c15f,_0x234ef9[_0x7a0f('0x3e')]);return db['Schedule'][_0x7a0f('0x47')](_0x52c15f)['then'](handleEntityNotFound(_0x15da8b,null))[_0x7a0f('0x22')](respondWithResult(_0x15da8b,null))['catch'](handleError(_0x15da8b,null));};exports[_0x7a0f('0x48')]=function(_0x2fd117,_0x455aff){return db[_0x7a0f('0x3f')][_0x7a0f('0x48')](_0x2fd117[_0x7a0f('0x49')],{})[_0x7a0f('0x22')](function(_0x2c769a){var _0x2f1d6c=_0x2fd117[_0x7a0f('0x4a')][_0x7a0f('0x24')]({'plain':!![]});if(!_0x2f1d6c)throw new Error(_0x7a0f('0x4b'));if(_0x2f1d6c[_0x7a0f('0x4c')]===_0x7a0f('0x4a')){var _0x5c593b=_0x2c769a['get']({'plain':!![]});var _0x263aaf=_0x7a0f('0x25');return db[_0x7a0f('0x4d')][_0x7a0f('0x47')]({'where':{'name':_0x263aaf,'userProfileId':_0x2f1d6c['userProfileId']},'raw':!![]})[_0x7a0f('0x22')](function(_0x298ca8){if(_0x298ca8&&_0x298ca8[_0x7a0f('0x4e')]===0x0){return db[_0x7a0f('0x26')][_0x7a0f('0x48')]({'name':_0x5c593b['name'],'resourceId':_0x5c593b['id'],'type':_0x298ca8['name'],'sectionId':_0x298ca8['id']},{})['then'](function(){return _0x2c769a;});}else{return _0x2c769a;}})[_0x7a0f('0x41')](function(_0xf3fb47){logger[_0x7a0f('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xf3fb47);throw _0xf3fb47;});}return _0x2c769a;})[_0x7a0f('0x22')](respondWithResult(_0x455aff,0xc9))[_0x7a0f('0x41')](handleError(_0x455aff,null));};exports[_0x7a0f('0x4f')]=function(_0x108a76,_0x5d005f){if(_0x108a76[_0x7a0f('0x49')]['id']){delete _0x108a76[_0x7a0f('0x49')]['id'];}return db[_0x7a0f('0x3f')][_0x7a0f('0x47')]({'where':{'id':_0x108a76[_0x7a0f('0x43')]['id']}})['then'](handleEntityNotFound(_0x5d005f,null))[_0x7a0f('0x22')](saveUpdates(_0x108a76[_0x7a0f('0x49')],null))[_0x7a0f('0x22')](respondWithResult(_0x5d005f,null))['catch'](handleError(_0x5d005f,null));};exports[_0x7a0f('0x23')]=function(_0x1d646c,_0x9a6acb){return db[_0x7a0f('0x3f')][_0x7a0f('0x47')]({'where':{'id':_0x1d646c[_0x7a0f('0x43')]['id']}})[_0x7a0f('0x22')](handleEntityNotFound(_0x9a6acb,null))['then'](removeEntity(_0x9a6acb,null))[_0x7a0f('0x41')](handleError(_0x9a6acb,null));};exports[_0x7a0f('0x50')]=function(_0x43cb15,_0x465afd,_0x29423d){var _0x4a3e69=require('../../config/schedule');return db[_0x7a0f('0x3f')][_0x7a0f('0x47')]({'where':{'id':_0x43cb15[_0x7a0f('0x43')]['id']},'raw':!![]})[_0x7a0f('0x22')](handleEntityNotFound(_0x465afd,null))['then'](function(){_0x4a3e69[_0x7a0f('0x50')](_0x43cb15['params']['id']);})['then'](respondWithStatusCode(_0x465afd,null))[_0x7a0f('0x41')](handleError(_0x465afd,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 253f583..2fdede7 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 _0x33d7=['request-promise','path','../../config/environment','define','Schedule','tools_schedules','lodash','util','../../config/logger','api','bluebird'];(function(_0x4617ce,_0x1dc445){var _0x51ca6e=function(_0x26f542){while(--_0x26f542){_0x4617ce['push'](_0x4617ce['shift']());}};_0x51ca6e(++_0x1dc445);}(_0x33d7,0x15b));var _0x733d=function(_0x1b348d,_0x2ab7db){_0x1b348d=_0x1b348d-0x0;var _0x195fd2=_0x33d7[_0x1b348d];return _0x195fd2;};'use strict';var _=require(_0x733d('0x0'));var util=require(_0x733d('0x1'));var logger=require(_0x733d('0x2'))(_0x733d('0x3'));var moment=require('moment');var BPromise=require(_0x733d('0x4'));var rp=require(_0x733d('0x5'));var fs=require('fs');var path=require(_0x733d('0x6'));var rimraf=require('rimraf');var config=require(_0x733d('0x7'));var attributes=require('./schedule.attributes');module['exports']=function(_0x141738,_0x7d4951){return _0x141738[_0x733d('0x8')](_0x733d('0x9'),attributes,{'tableName':_0x733d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdd38=['lodash','util','../../config/logger','api','bluebird','request-promise','path','define','Schedule','tools_schedules'];(function(_0x13b918,_0x4260bf){var _0x5492bb=function(_0x3099a8){while(--_0x3099a8){_0x13b918['push'](_0x13b918['shift']());}};_0x5492bb(++_0x4260bf);}(_0xdd38,0x12c));var _0x8dd3=function(_0x222472,_0x33ea87){_0x222472=_0x222472-0x0;var _0x5d601f=_0xdd38[_0x222472];return _0x5d601f;};'use strict';var _=require(_0x8dd3('0x0'));var util=require(_0x8dd3('0x1'));var logger=require(_0x8dd3('0x2'))(_0x8dd3('0x3'));var moment=require('moment');var BPromise=require(_0x8dd3('0x4'));var rp=require(_0x8dd3('0x5'));var fs=require('fs');var path=require(_0x8dd3('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./schedule.attributes');module['exports']=function(_0x2c7f6e,_0x565ec4){return _0x2c7f6e[_0x8dd3('0x7')](_0x8dd3('0x8'),attributes,{'tableName':_0x8dd3('0x9'),'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 a8a4934..0f0083d 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 _0x407a=['../../config/logger','rpc','jayson/promise','http','then','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','randomstring','ioredis'];(function(_0x4cc59b,_0xac7281){var _0x5ac3a2=function(_0x52199b){while(--_0x52199b){_0x4cc59b['push'](_0x4cc59b['shift']());}};_0x5ac3a2(++_0xac7281);}(_0x407a,0x10b));var _0xa407=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x407a[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xa407('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa407('0x1'));var fs=require('fs');var Redis=require(_0xa407('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xa407('0x3'))(_0xa407('0x4'));var config=require('../../config/environment');var jayson=require(_0xa407('0x5'));var client=jayson['client'][_0xa407('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x1921bc,_0x43f3a5,_0x19ec83){return new BPromise(function(_0x140519,_0x28fa61){return client['request'](_0x1921bc,_0x19ec83)[_0xa407('0x7')](function(_0x1ec02d){logger[_0xa407('0x8')](_0xa407('0x9'),_0x43f3a5,_0xa407('0xa'));logger[_0xa407('0xb')](_0xa407('0xc'),_0x43f3a5,_0xa407('0xa'),JSON[_0xa407('0xd')](_0x1ec02d));if(_0x1ec02d[_0xa407('0xe')]){if(_0x1ec02d['error'][_0xa407('0xf')]===0x1f4){logger[_0xa407('0xe')](_0xa407('0x9'),_0x43f3a5,_0x1ec02d['error']['message']);return _0x28fa61(_0x1ec02d['error'][_0xa407('0x10')]);}logger[_0xa407('0xe')](_0xa407('0x9'),_0x43f3a5,_0x1ec02d[_0xa407('0xe')][_0xa407('0x10')]);return _0x140519(_0x1ec02d['error'][_0xa407('0x10')]);}else{logger[_0xa407('0x8')](_0xa407('0x9'),_0x43f3a5,_0xa407('0xa'));_0x140519(_0x1ec02d['result']['message']);}})[_0xa407('0x11')](function(_0xcb620e){logger[_0xa407('0xe')]('Schedule,\x20%s,\x20%s',_0x43f3a5,_0xcb620e);_0x28fa61(_0xcb620e);});});} \ No newline at end of file +var _0x3ccf=['catch','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Schedule,\x20%s,\x20%s','request\x20sent','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x17df09,_0x44dd69){var _0x143aab=function(_0xeab9d5){while(--_0xeab9d5){_0x17df09['push'](_0x17df09['shift']());}};_0x143aab(++_0x44dd69);}(_0x3ccf,0x18d));var _0xf3cc=function(_0x58c725,_0x286bc2){_0x58c725=_0x58c725-0x0;var _0x44f202=_0x3ccf[_0x58c725];return _0x44f202;};'use strict';var _=require(_0xf3cc('0x0'));var util=require('util');var moment=require(_0xf3cc('0x1'));var BPromise=require(_0xf3cc('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf3cc('0x3'))['db'];var utils=require(_0xf3cc('0x4'));var logger=require(_0xf3cc('0x5'))(_0xf3cc('0x6'));var config=require(_0xf3cc('0x7'));var jayson=require(_0xf3cc('0x8'));var client=jayson[_0xf3cc('0x9')][_0xf3cc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1227cc,_0x5beaae,_0x5a1ea5){return new BPromise(function(_0x574401,_0x4ce5a2){return client[_0xf3cc('0xb')](_0x1227cc,_0x5a1ea5)[_0xf3cc('0xc')](function(_0x35aef){logger[_0xf3cc('0xd')](_0xf3cc('0xe'),_0x5beaae,_0xf3cc('0xf'));logger['debug'](_0xf3cc('0x10'),_0x5beaae,'request\x20sent',JSON[_0xf3cc('0x11')](_0x35aef));if(_0x35aef[_0xf3cc('0x12')]){if(_0x35aef[_0xf3cc('0x12')]['code']===0x1f4){logger[_0xf3cc('0x12')]('Schedule,\x20%s,\x20%s',_0x5beaae,_0x35aef['error'][_0xf3cc('0x13')]);return _0x4ce5a2(_0x35aef[_0xf3cc('0x12')]['message']);}logger['error'](_0xf3cc('0xe'),_0x5beaae,_0x35aef['error'][_0xf3cc('0x13')]);return _0x574401(_0x35aef[_0xf3cc('0x12')]['message']);}else{logger[_0xf3cc('0xd')]('Schedule,\x20%s,\x20%s',_0x5beaae,_0xf3cc('0xf'));_0x574401(_0x35aef[_0xf3cc('0x14')][_0xf3cc('0x13')]);}})[_0xf3cc('0x15')](function(_0x14f0d0){logger[_0xf3cc('0x12')](_0xf3cc('0xe'),_0x5beaae,_0x14f0d0);_0x4ce5a2(_0x14f0d0);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 153d7d0..c1e3af2 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 _0xa1a6=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./screenRecording.controller','get','isAuthenticated','/describe','describe','/:id/download','download','post','create','put','/:id','delete'];(function(_0x1112bf,_0x43c73a){var _0x2f497c=function(_0x5d1c20){while(--_0x5d1c20){_0x1112bf['push'](_0x1112bf['shift']());}};_0x2f497c(++_0x43c73a);}(_0xa1a6,0x172));var _0x6a1a=function(_0x5eb22e,_0x27cbac){_0x5eb22e=_0x5eb22e-0x0;var _0x27fed5=_0xa1a6[_0x5eb22e];return _0x27fed5;};'use strict';var multer=require(_0x6a1a('0x0'));var util=require(_0x6a1a('0x1'));var path=require(_0x6a1a('0x2'));var timeout=require(_0x6a1a('0x3'));var express=require(_0x6a1a('0x4'));var router=express[_0x6a1a('0x5')]();var fs_extra=require(_0x6a1a('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x6a1a('0x7'));var config=require(_0x6a1a('0x8'));var controller=require(_0x6a1a('0x9'));router[_0x6a1a('0xa')]('/',auth[_0x6a1a('0xb')](),controller['index']);router[_0x6a1a('0xa')](_0x6a1a('0xc'),auth['isAuthenticated'](),controller[_0x6a1a('0xd')]);router[_0x6a1a('0xa')]('/:id',auth[_0x6a1a('0xb')](),controller['show']);router[_0x6a1a('0xa')](_0x6a1a('0xe'),auth[_0x6a1a('0xb')](),controller[_0x6a1a('0xf')]);router[_0x6a1a('0x10')]('/',auth['isAuthenticated'](),controller[_0x6a1a('0x11')]);router[_0x6a1a('0x12')](_0x6a1a('0x13'),auth['isAuthenticated'](),controller['update']);router[_0x6a1a('0x14')](_0x6a1a('0x13'),auth[_0x6a1a('0xb')](),controller[_0x6a1a('0x15')]);module[_0x6a1a('0x16')]=router; \ No newline at end of file +var _0x5d8d=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller','/describe','isAuthenticated','describe','get','/:id','download','post','create','put','update','multer','util','path'];(function(_0x9ef61e,_0x2837d9){var _0x1fc375=function(_0x213a35){while(--_0x213a35){_0x9ef61e['push'](_0x9ef61e['shift']());}};_0x1fc375(++_0x2837d9);}(_0x5d8d,0x166));var _0xd5d8=function(_0x95a0f6,_0x1988ca){_0x95a0f6=_0x95a0f6-0x0;var _0x26abf0=_0x5d8d[_0x95a0f6];return _0x26abf0;};'use strict';var multer=require(_0xd5d8('0x0'));var util=require(_0xd5d8('0x1'));var path=require(_0xd5d8('0x2'));var timeout=require('connect-timeout');var express=require(_0xd5d8('0x3'));var router=express[_0xd5d8('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd5d8('0x5'));var interaction=require(_0xd5d8('0x6'));var config=require(_0xd5d8('0x7'));var controller=require(_0xd5d8('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xd5d8('0x9'),auth[_0xd5d8('0xa')](),controller[_0xd5d8('0xb')]);router[_0xd5d8('0xc')](_0xd5d8('0xd'),auth[_0xd5d8('0xa')](),controller['show']);router[_0xd5d8('0xc')]('/:id/download',auth[_0xd5d8('0xa')](),controller[_0xd5d8('0xe')]);router[_0xd5d8('0xf')]('/',auth[_0xd5d8('0xa')](),controller[_0xd5d8('0x10')]);router[_0xd5d8('0x11')]('/:id',auth[_0xd5d8('0xa')](),controller[_0xd5d8('0x12')]);router['delete'](_0xd5d8('0xd'),auth[_0xd5d8('0xa')](),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 970c7a2..c58a802 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 _0x887b=['subtract','closedAt','duration','DATE','toString','format','createdAt','MM-DD-YYYY\x20HH:mm','updatedAt','sequelize','moment','path','../../config/environment','exports','VIRTUAL','getDataValue','value','extname','INTEGER','startedAt'];(function(_0x4de8d0,_0x5064d4){var _0x3b01ce=function(_0x228651){while(--_0x228651){_0x4de8d0['push'](_0x4de8d0['shift']());}};_0x3b01ce(++_0x5064d4);}(_0x887b,0x185));var _0xb887=function(_0x43c735,_0x11c07e){_0x43c735=_0x43c735-0x0;var _0x440265=_0x887b[_0x43c735];return _0x440265;};'use strict';var Sequelize=require(_0xb887('0x0'));var moment=require(_0xb887('0x1'));var path=require(_0xb887('0x2'));var config=require(_0xb887('0x3'));module[_0xb887('0x4')]={'format':{'type':Sequelize[_0xb887('0x5')],'get':function(){return this[_0xb887('0x6')](_0xb887('0x7'))?path[_0xb887('0x8')](this['getDataValue'](_0xb887('0x7'))):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize['STRING'],'set':function(_0x332507){var _0x353587=_0x332507['replace'](/\\/g,'/');this['setDataValue'](_0xb887('0x7'),_0x353587);}},'rating':{'type':Sequelize[_0xb887('0x9')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0x49962f){this['setDataValue'](_0xb887('0xa'),moment()[_0xb887('0xb')](_0x49962f,'ms'));this['setDataValue'](_0xb887('0xc'),moment());this['setDataValue'](_0xb887('0xd'),_0x49962f);}},'startedAt':{'type':Sequelize[_0xb887('0xe')],'get':function(){return moment(this[_0xb887('0x6')](_0xb887('0xa')))['format']('MM-DD-YYYY\x20HH:mm')[_0xb887('0xf')]();}},'closedAt':{'type':Sequelize[_0xb887('0xe')],'get':function(){return moment(this[_0xb887('0x6')](_0xb887('0xc')))[_0xb887('0x10')]('MM-DD-YYYY\x20HH:mm')[_0xb887('0xf')]();}},'createdAt':{'type':Sequelize[_0xb887('0xe')],'get':function(){return moment(this[_0xb887('0x6')](_0xb887('0x11')))[_0xb887('0x10')](_0xb887('0x12'))[_0xb887('0xf')]();}},'updatedAt':{'type':Sequelize[_0xb887('0xe')],'get':function(){return moment(this[_0xb887('0x6')](_0xb887('0x13')))[_0xb887('0x10')](_0xb887('0x12'))['toString']();}}}; \ No newline at end of file +var _0xccde=['startedAt','MM-DD-YYYY\x20HH:mm','toString','closedAt','format','createdAt','sequelize','path','exports','VIRTUAL','extname','getDataValue','value','STRING','replace','setDataValue','INTEGER','duration','DATE'];(function(_0x5aca71,_0x583dfa){var _0x375f79=function(_0x3b2d5e){while(--_0x3b2d5e){_0x5aca71['push'](_0x5aca71['shift']());}};_0x375f79(++_0x583dfa);}(_0xccde,0x1e1));var _0xeccd=function(_0x3fb5eb,_0x5947a6){_0x3fb5eb=_0x3fb5eb-0x0;var _0x481291=_0xccde[_0x3fb5eb];return _0x481291;};'use strict';var Sequelize=require(_0xeccd('0x0'));var moment=require('moment');var path=require(_0xeccd('0x1'));var config=require('../../config/environment');module[_0xeccd('0x2')]={'format':{'type':Sequelize[_0xeccd('0x3')],'get':function(){return this['getDataValue']('value')?path[_0xeccd('0x4')](this[_0xeccd('0x5')](_0xeccd('0x6'))):undefined;}},'interactionid':{'type':Sequelize[_0xeccd('0x7')]},'channel':{'type':Sequelize[_0xeccd('0x7')]},'value':{'type':Sequelize['STRING'],'set':function(_0x338742){var _0x130f1c=_0x338742[_0xeccd('0x8')](/\\/g,'/');this[_0xeccd('0x9')]('value',_0x130f1c);}},'rating':{'type':Sequelize[_0xeccd('0xa')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xeccd('0xa')],'set':function(_0x9dccd){this[_0xeccd('0x9')]('startedAt',moment()['subtract'](_0x9dccd,'ms'));this['setDataValue']('closedAt',moment());this[_0xeccd('0x9')](_0xeccd('0xb'),_0x9dccd);}},'startedAt':{'type':Sequelize[_0xeccd('0xc')],'get':function(){return moment(this[_0xeccd('0x5')](_0xeccd('0xd')))['format'](_0xeccd('0xe'))[_0xeccd('0xf')]();}},'closedAt':{'type':Sequelize[_0xeccd('0xc')],'get':function(){return moment(this[_0xeccd('0x5')](_0xeccd('0x10')))[_0xeccd('0x11')]('MM-DD-YYYY\x20HH:mm')['toString']();}},'createdAt':{'type':Sequelize[_0xeccd('0xc')],'get':function(){return moment(this[_0xeccd('0x5')](_0xeccd('0x12')))[_0xeccd('0x11')]('MM-DD-YYYY\x20HH:mm')[_0xeccd('0xf')]();}},'updatedAt':{'type':Sequelize[_0xeccd('0xc')],'get':function(){return moment(this['getDataValue']('updatedAt'))[_0xeccd('0x11')](_0xeccd('0xe'))[_0xeccd('0xf')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 09eb416..6800220 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 _0xed1f=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','name','send','ScreenRecording','rawAttributes','fieldName','type','key','differenceBy','map','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','includeAll','include','findAll','show','params','merge','options','catch','create','body','duration','createdAt','closedAt','value','find','describe','download','../../components/encryptor','uniqueid','join','root','server/files/screen_recordings','format','decryptFile','secrets','recording','existsSync','Sequelize','ValidationError','filename','extname','unlink','message','ScreenRecording\x20not\x20found','Not\x20found','isNil','Entity\x20not\x20found','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','eml-format','rimraf'];(function(_0x12295c,_0x4d6d39){var _0x3e9c3b=function(_0x3dd87b){while(--_0x3dd87b){_0x12295c['push'](_0x12295c['shift']());}};_0x3e9c3b(++_0x4d6d39);}(_0xed1f,0x6a));var _0xfed1=function(_0x576170,_0x1712ae){_0x576170=_0x576170-0x0;var _0x397c70=_0xed1f[_0x576170];return _0x397c70;};'use strict';var emlformat=require(_0xfed1('0x0'));var rimraf=require(_0xfed1('0x1'));var zipdir=require(_0xfed1('0x2'));var jsonpatch=require(_0xfed1('0x3'));var rp=require(_0xfed1('0x4'));var moment=require(_0xfed1('0x5'));var BPromise=require(_0xfed1('0x6'));var Mustache=require(_0xfed1('0x7'));var util=require(_0xfed1('0x8'));var path=require(_0xfed1('0x9'));var sox=require(_0xfed1('0xa'));var csv=require(_0xfed1('0xb'));var ejs=require(_0xfed1('0xc'));var fs=require('fs');var fs_extra=require(_0xfed1('0xd'));var _=require(_0xfed1('0xe'));var squel=require(_0xfed1('0xf'));var crypto=require(_0xfed1('0x10'));var jsforce=require(_0xfed1('0x11'));var deskjs=require('desk.js');var toCsv=require(_0xfed1('0xb'));var querystring=require(_0xfed1('0x12'));var Papa=require('papaparse');var Redis=require(_0xfed1('0x13'));var authService=require(_0xfed1('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xfed1('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfed1('0x16'))(_0xfed1('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xfed1('0x18'));var db=require(_0xfed1('0x19'))['db'];function respondWithStatusCode(_0x569a6e,_0x17f4fe){_0x17f4fe=_0x17f4fe||0xcc;return function(_0x5a3469){if(_0x5a3469){return _0x569a6e['sendStatus'](_0x17f4fe);}return _0x569a6e[_0xfed1('0x1a')](_0x17f4fe)[_0xfed1('0x1b')]();};}function respondWithResult(_0x532537,_0x2dde3a){_0x2dde3a=_0x2dde3a||0xc8;return function(_0x5b9455){if(_0x5b9455){return _0x532537['status'](_0x2dde3a)[_0xfed1('0x1c')](_0x5b9455);}};}function respondWithFilteredResult(_0x39aa0c,_0x1fbb7a){return function(_0x123c46){if(_0x123c46){var _0x582e67=typeof _0x1fbb7a[_0xfed1('0x1d')]==='undefined'&&typeof _0x1fbb7a[_0xfed1('0x1e')]===_0xfed1('0x1f');var _0x489a0f=_0x123c46[_0xfed1('0x20')];var _0xa72a20=_0x582e67?0x0:_0x1fbb7a['offset'];var _0x59509b=_0x582e67?_0x123c46['count']:_0x1fbb7a[_0xfed1('0x1d')]+_0x1fbb7a['limit'];var _0x201f18;if(_0x59509b>=_0x489a0f){_0x59509b=_0x489a0f;_0x201f18=0xc8;}else{_0x201f18=0xce;}_0x39aa0c[_0xfed1('0x1a')](_0x201f18);return _0x39aa0c['set'](_0xfed1('0x21'),_0xa72a20+'-'+_0x59509b+'/'+_0x489a0f)[_0xfed1('0x1c')](_0x123c46);}return null;};}function patchUpdates(_0x59ee9d){return function(_0x3ce944){try{jsonpatch[_0xfed1('0x22')](_0x3ce944,_0x59ee9d,!![]);}catch(_0xff4842){return BPromise[_0xfed1('0x23')](_0xff4842);}return _0x3ce944['save']();};}function saveUpdates(_0x203cec,_0x59333e){return function(_0x446558){if(_0x446558){return _0x446558[_0xfed1('0x24')](_0x203cec)[_0xfed1('0x25')](function(_0x532ec2){return _0x532ec2;});}return null;};}function removeEntity(_0x41d22c,_0x594917){return function(_0x460555){if(_0x460555){return _0x460555[_0xfed1('0x26')]()[_0xfed1('0x25')](function(){_0x41d22c[_0xfed1('0x1a')](0xcc)[_0xfed1('0x1b')]();});}};}function handleEntityNotFound(_0x1199b7,_0x527fc7){return function(_0x465ce6){if(!_0x465ce6){_0x1199b7[_0xfed1('0x27')](0x194);}return _0x465ce6;};}function handleError(_0x49072b,_0x1d6c72){_0x1d6c72=_0x1d6c72||0x1f4;return function(_0x2b9dd2){logger[_0xfed1('0x28')](_0x2b9dd2[_0xfed1('0x29')]);if(_0x2b9dd2[_0xfed1('0x2a')]){delete _0x2b9dd2[_0xfed1('0x2a')];}_0x49072b['status'](_0x1d6c72)[_0xfed1('0x2b')](_0x2b9dd2);};}exports['index']=function(_0x3106ee,_0x4e5249){var _0x53b0c9={},_0x1cec64={},_0x42c950={'count':0x0,'rows':[]};var _0x2d334e=_['map'](db[_0xfed1('0x2c')][_0xfed1('0x2d')],function(_0x13f414){return{'name':_0x13f414[_0xfed1('0x2e')],'type':_0x13f414[_0xfed1('0x2f')][_0xfed1('0x30')]};});_0x1cec64['model']=_[_0xfed1('0x31')](_[_0xfed1('0x32')](_0x2d334e,'name'),['format']);_0x1cec64[_0xfed1('0x33')]=_[_0xfed1('0x34')](_0x3106ee[_0xfed1('0x33')]);_0x1cec64[_0xfed1('0x35')]=_[_0xfed1('0x36')](_0x1cec64['model'],_0x1cec64[_0xfed1('0x33')]);_0x53b0c9[_0xfed1('0x37')]=_[_0xfed1('0x36')](_0x1cec64[_0xfed1('0x38')],qs[_0xfed1('0x39')](_0x3106ee['query'][_0xfed1('0x39')]));_0x53b0c9['attributes']=_0x53b0c9[_0xfed1('0x37')][_0xfed1('0x3a')]?_0x53b0c9[_0xfed1('0x37')]:_0x1cec64[_0xfed1('0x38')];if(!_0x3106ee[_0xfed1('0x33')][_0xfed1('0x3b')](_0xfed1('0x3c'))){_0x53b0c9[_0xfed1('0x1e')]=qs['limit'](_0x3106ee[_0xfed1('0x33')][_0xfed1('0x1e')]);_0x53b0c9[_0xfed1('0x1d')]=qs[_0xfed1('0x1d')](_0x3106ee['query']['offset']);}_0x53b0c9[_0xfed1('0x3d')]=qs[_0xfed1('0x3e')](_0x3106ee[_0xfed1('0x33')][_0xfed1('0x3e')]);_0x53b0c9[_0xfed1('0x3f')]=qs[_0xfed1('0x35')](_[_0xfed1('0x40')](_0x3106ee[_0xfed1('0x33')],_0x1cec64['filters']),_0x2d334e);if(_0x3106ee['query'][_0xfed1('0x41')]){_0x53b0c9[_0xfed1('0x3f')]=_['merge'](_0x53b0c9[_0xfed1('0x3f')],{'$or':_[_0xfed1('0x32')](_0x2d334e,function(_0x3b0973){if(_0x3b0973[_0xfed1('0x2f')]!==_0xfed1('0x42')){var _0x31ffeb={};_0x31ffeb[_0x3b0973[_0xfed1('0x2a')]]={'$like':'%'+_0x3106ee[_0xfed1('0x33')][_0xfed1('0x41')]+'%'};return _0x31ffeb;}})});}_0x53b0c9=_['merge']({},_0x53b0c9,_0x3106ee['options']);var _0x5598dc={'where':_0x53b0c9[_0xfed1('0x3f')]};return db[_0xfed1('0x2c')][_0xfed1('0x20')](_0x5598dc)['then'](function(_0x3454e6){_0x42c950['count']=_0x3454e6;if(_0x3106ee[_0xfed1('0x33')][_0xfed1('0x43')]){_0x53b0c9[_0xfed1('0x44')]=[{'all':!![]}];}return db['ScreenRecording'][_0xfed1('0x45')](_0x53b0c9);})[_0xfed1('0x25')](function(_0x422433){_0x42c950['rows']=_0x422433;return _0x42c950;})[_0xfed1('0x25')](respondWithFilteredResult(_0x4e5249,_0x53b0c9))['catch'](handleError(_0x4e5249,null));};exports[_0xfed1('0x46')]=function(_0xf1f739,_0x229fc7){var _0x13c087={'raw':![],'where':{'id':_0xf1f739[_0xfed1('0x47')]['id']}},_0x1bfbe8={};_0x1bfbe8[_0xfed1('0x38')]=_[_0xfed1('0x34')](db[_0xfed1('0x2c')]['rawAttributes']);_0x1bfbe8[_0xfed1('0x33')]=_[_0xfed1('0x34')](_0xf1f739[_0xfed1('0x33')]);_0x1bfbe8['filters']=_['intersection'](_0x1bfbe8[_0xfed1('0x38')],_0x1bfbe8[_0xfed1('0x33')]);_0x13c087[_0xfed1('0x37')]=_[_0xfed1('0x36')](_0x1bfbe8[_0xfed1('0x38')],qs[_0xfed1('0x39')](_0xf1f739[_0xfed1('0x33')][_0xfed1('0x39')]));_0x13c087[_0xfed1('0x37')]=_0x13c087[_0xfed1('0x37')][_0xfed1('0x3a')]?_0x13c087[_0xfed1('0x37')]:_0x1bfbe8['model'];if(_0xf1f739[_0xfed1('0x33')][_0xfed1('0x43')]){_0x13c087[_0xfed1('0x44')]=[{'all':!![]}];}_0x13c087=_[_0xfed1('0x48')]({},_0x13c087,_0xf1f739[_0xfed1('0x49')]);return db[_0xfed1('0x2c')]['find'](_0x13c087)[_0xfed1('0x25')](handleEntityNotFound(_0x229fc7,null))[_0xfed1('0x25')](respondWithResult(_0x229fc7,null))[_0xfed1('0x4a')](handleError(_0x229fc7,null));};exports['create']=function(_0x22874a,_0x10f98d){return db[_0xfed1('0x2c')][_0xfed1('0x4b')](_0x22874a['body'],{})[_0xfed1('0x25')](respondWithResult(_0x10f98d,0xc9))[_0xfed1('0x4a')](handleError(_0x10f98d,null));};exports[_0xfed1('0x24')]=function(_0x42761f,_0x14745e){if(_0x42761f[_0xfed1('0x4c')]['id']){delete _0x42761f[_0xfed1('0x4c')]['id'];}delete _0x42761f[_0xfed1('0x4c')][_0xfed1('0x4d')];delete _0x42761f[_0xfed1('0x4c')][_0xfed1('0x4e')];delete _0x42761f[_0xfed1('0x4c')][_0xfed1('0x4f')];delete _0x42761f[_0xfed1('0x4c')][_0xfed1('0x50')];return db[_0xfed1('0x2c')][_0xfed1('0x51')]({'where':{'id':_0x42761f[_0xfed1('0x47')]['id']}})['then'](handleEntityNotFound(_0x14745e,null))['then'](saveUpdates(_0x42761f[_0xfed1('0x4c')],null))[_0xfed1('0x25')](respondWithResult(_0x14745e,null))[_0xfed1('0x4a')](handleError(_0x14745e,null));};exports[_0xfed1('0x52')]=function(_0x5da599,_0x3c2534){return db[_0xfed1('0x2c')]['describe']()['then'](respondWithResult(_0x3c2534,null))['catch'](handleError(_0x3c2534,null));};exports[_0xfed1('0x53')]=function(_0x1aaa3d,_0x15e90f,_0x1d8ef2){var _0x2665c8=require(_0xfed1('0x54'));var _0x1a9f22=![];var _0x144102={};if(_0x1aaa3d[_0xfed1('0x33')][_0xfed1('0x2f')]&&_0x1aaa3d['query']['type']===_0xfed1('0x55')){_0x144102[_0xfed1('0x55')]=_0x1aaa3d[_0xfed1('0x47')]['id'];}else{_0x144102['id']=_0x1aaa3d[_0xfed1('0x47')]['id'];}return db[_0xfed1('0x2c')][_0xfed1('0x51')]({'where':_0x144102,'attributes':['id',_0xfed1('0x50')],'raw':!![]})[_0xfed1('0x25')](handleEntityNotFound(_0x15e90f,null))[_0xfed1('0x25')](function(_0x427fa6){if(_0x427fa6){var _0xbd49dc=path[_0xfed1('0x56')](config[_0xfed1('0x57')],_0xfed1('0x58'),_0x427fa6[_0xfed1('0x50')]);var _0x3a7a42=util[_0xfed1('0x59')]('%s.cypher',_0xbd49dc);if(fs['existsSync'](_0x3a7a42)){_0x1a9f22=!![];return _0x2665c8[_0xfed1('0x5a')](_0x3a7a42,_0xbd49dc,config[_0xfed1('0x5b')][_0xfed1('0x5c')])[_0xfed1('0x25')](function(){return _0x427fa6;});}return _0x427fa6;}})[_0xfed1('0x25')](function(_0x41a22a){if(_0x41a22a){var _0x2ccdc3=path[_0xfed1('0x56')](config[_0xfed1('0x57')],_0xfed1('0x58'),_0x41a22a[_0xfed1('0x50')]);if(!fs[_0xfed1('0x5d')](_0x2ccdc3)){throw new db[(_0xfed1('0x5e'))][(_0xfed1('0x5f'))]('ScreenRecording\x20not\x20found');}if(_0x41a22a[_0xfed1('0x60')]){return _0x15e90f['download'](_0x2ccdc3,_0x41a22a['filename']+path[_0xfed1('0x61')](_0x2ccdc3),function(){if(_0x1a9f22){fs['unlink'](_0x2ccdc3);}});}else{return _0x15e90f[_0xfed1('0x53')](_0x2ccdc3,function(_0x5acc45){if(_0x1a9f22){fs[_0xfed1('0x62')](_0x2ccdc3);}});}}})[_0xfed1('0x4a')](function(_0x53f0ab){if(_0x53f0ab[_0xfed1('0x63')]===_0xfed1('0x64')){_0x15e90f['status'](0x194)[_0xfed1('0x2b')](_0xfed1('0x65'));}else{return handleError(_0x15e90f,null);}});};exports[_0xfed1('0x26')]=function(_0x2f37b9,_0x59a23a){return db[_0xfed1('0x2c')][_0xfed1('0x51')]({'where':{'id':_0x2f37b9[_0xfed1('0x47')]['id']}})[_0xfed1('0x25')](function(_0x23347a){if(_[_0xfed1('0x66')](_0x23347a)){throw new ReferenceError(_0xfed1('0x67'));}return _0x23347a;})[_0xfed1('0x25')](function(_0x5c043d){var _0x2d66ec=path[_0xfed1('0x56')](config[_0xfed1('0x57')],_0xfed1('0x58'),_0x5c043d[_0xfed1('0x50')]);logger[_0xfed1('0x68')]('cancellazione\x20fisica\x20documento\x20%s',_0x2d66ec);if(!_['isNil'](_0x5c043d['value'])&&fs[_0xfed1('0x5d')](_0x2d66ec)){logger[_0xfed1('0x68')](_0xfed1('0x69')+_0x2d66ec+_0xfed1('0x6a'));fs['unlinkSync'](_0x2d66ec);}_0x2d66ec=_0x2d66ec+_0xfed1('0x6b');if(!_['isNil'](_0x5c043d[_0xfed1('0x50')])&&fs[_0xfed1('0x5d')](_0x2d66ec)){logger[_0xfed1('0x68')](_0xfed1('0x69')+_0x2d66ec+_0xfed1('0x6a'));fs['unlinkSync'](_0x2d66ec);}return _0x5c043d;})[_0xfed1('0x25')](function(_0x6b74cb){if(!_0x6b74cb)throw new InternalError();return _0x6b74cb[_0xfed1('0x26')]();})['then'](function(){_0x59a23a[_0xfed1('0x1a')](0xcc)[_0xfed1('0x1b')]();})[_0xfed1('0x4a')](handleError(_0x59a23a,null));}; \ No newline at end of file +var _0x0e85=['duration','createdAt','closedAt','params','describe','download','uniqueid','join','root','value','existsSync','secrets','recording','server/files/screen_recordings','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','fast-json-patch','request-promise','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','error','stack','name','send','map','ScreenRecording','rawAttributes','fieldName','key','model','format','query','filters','intersection','attributes','length','nolimit','sort','filter','where','merge','type','options','include','findAll','rows','catch','keys','fields','find','create','body'];(function(_0x334fea,_0x1f1e18){var _0x3c5829=function(_0x4fd6ac){while(--_0x4fd6ac){_0x334fea['push'](_0x334fea['shift']());}};_0x3c5829(++_0x1f1e18);}(_0x0e85,0x7c));var _0x50e8=function(_0x4e9d3c,_0x1f4b98){_0x4e9d3c=_0x4e9d3c-0x0;var _0x2d0825=_0x0e85[_0x4e9d3c];return _0x2d0825;};'use strict';var emlformat=require(_0x50e8('0x0'));var rimraf=require(_0x50e8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x50e8('0x2'));var rp=require(_0x50e8('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x50e8('0x4'));var path=require('path');var sox=require(_0x50e8('0x5'));var csv=require(_0x50e8('0x6'));var ejs=require(_0x50e8('0x7'));var fs=require('fs');var fs_extra=require(_0x50e8('0x8'));var _=require('lodash');var squel=require(_0x50e8('0x9'));var crypto=require(_0x50e8('0xa'));var jsforce=require(_0x50e8('0xb'));var deskjs=require(_0x50e8('0xc'));var toCsv=require(_0x50e8('0x6'));var querystring=require(_0x50e8('0xd'));var Papa=require('papaparse');var Redis=require(_0x50e8('0xe'));var authService=require(_0x50e8('0xf'));var qs=require(_0x50e8('0x10'));var as=require(_0x50e8('0x11'));var hardwareService=require(_0x50e8('0x12'));var logger=require(_0x50e8('0x13'))(_0x50e8('0x14'));var utils=require(_0x50e8('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x50e8('0x16'))['db'];function respondWithStatusCode(_0x24d381,_0x508377){_0x508377=_0x508377||0xcc;return function(_0x49e02f){if(_0x49e02f){return _0x24d381[_0x50e8('0x17')](_0x508377);}return _0x24d381[_0x50e8('0x18')](_0x508377)[_0x50e8('0x19')]();};}function respondWithResult(_0x473aa7,_0x54efd3){_0x54efd3=_0x54efd3||0xc8;return function(_0x18596f){if(_0x18596f){return _0x473aa7[_0x50e8('0x18')](_0x54efd3)[_0x50e8('0x1a')](_0x18596f);}};}function respondWithFilteredResult(_0x5c3baa,_0x5524a3){return function(_0x30a872){if(_0x30a872){var _0xf02b48=typeof _0x5524a3[_0x50e8('0x1b')]===_0x50e8('0x1c')&&typeof _0x5524a3[_0x50e8('0x1d')]===_0x50e8('0x1c');var _0x5642bf=_0x30a872['count'];var _0x441f25=_0xf02b48?0x0:_0x5524a3[_0x50e8('0x1b')];var _0x40d060=_0xf02b48?_0x30a872[_0x50e8('0x1e')]:_0x5524a3[_0x50e8('0x1b')]+_0x5524a3[_0x50e8('0x1d')];var _0x1a451d;if(_0x40d060>=_0x5642bf){_0x40d060=_0x5642bf;_0x1a451d=0xc8;}else{_0x1a451d=0xce;}_0x5c3baa['status'](_0x1a451d);return _0x5c3baa[_0x50e8('0x1f')]('Content-Range',_0x441f25+'-'+_0x40d060+'/'+_0x5642bf)[_0x50e8('0x1a')](_0x30a872);}return null;};}function patchUpdates(_0xe04a5c){return function(_0xd263d){try{jsonpatch[_0x50e8('0x20')](_0xd263d,_0xe04a5c,!![]);}catch(_0x46af8e){return BPromise['reject'](_0x46af8e);}return _0xd263d[_0x50e8('0x21')]();};}function saveUpdates(_0x1e4e0d,_0x58110d){return function(_0x31d23c){if(_0x31d23c){return _0x31d23c[_0x50e8('0x22')](_0x1e4e0d)['then'](function(_0x1ce7fc){return _0x1ce7fc;});}return null;};}function removeEntity(_0xe7e56c,_0x4f56b7){return function(_0x47a3d8){if(_0x47a3d8){return _0x47a3d8['destroy']()[_0x50e8('0x23')](function(){_0xe7e56c[_0x50e8('0x18')](0xcc)[_0x50e8('0x19')]();});}};}function handleEntityNotFound(_0x371a1f,_0xc2f832){return function(_0x13b6e9){if(!_0x13b6e9){_0x371a1f['sendStatus'](0x194);}return _0x13b6e9;};}function handleError(_0x3a6442,_0x396611){_0x396611=_0x396611||0x1f4;return function(_0x4b3a09){logger[_0x50e8('0x24')](_0x4b3a09[_0x50e8('0x25')]);if(_0x4b3a09[_0x50e8('0x26')]){delete _0x4b3a09[_0x50e8('0x26')];}_0x3a6442['status'](_0x396611)[_0x50e8('0x27')](_0x4b3a09);};}exports['index']=function(_0x30fedf,_0x39c0c6){var _0x42bbef={},_0x4f0b88={},_0x1041b9={'count':0x0,'rows':[]};var _0x126c99=_[_0x50e8('0x28')](db[_0x50e8('0x29')][_0x50e8('0x2a')],function(_0x18aa31){return{'name':_0x18aa31[_0x50e8('0x2b')],'type':_0x18aa31['type'][_0x50e8('0x2c')]};});_0x4f0b88[_0x50e8('0x2d')]=_['differenceBy'](_['map'](_0x126c99,_0x50e8('0x26')),[_0x50e8('0x2e')]);_0x4f0b88[_0x50e8('0x2f')]=_['keys'](_0x30fedf['query']);_0x4f0b88[_0x50e8('0x30')]=_[_0x50e8('0x31')](_0x4f0b88['model'],_0x4f0b88[_0x50e8('0x2f')]);_0x42bbef[_0x50e8('0x32')]=_[_0x50e8('0x31')](_0x4f0b88[_0x50e8('0x2d')],qs['fields'](_0x30fedf[_0x50e8('0x2f')]['fields']));_0x42bbef[_0x50e8('0x32')]=_0x42bbef[_0x50e8('0x32')][_0x50e8('0x33')]?_0x42bbef['attributes']:_0x4f0b88[_0x50e8('0x2d')];if(!_0x30fedf[_0x50e8('0x2f')]['hasOwnProperty'](_0x50e8('0x34'))){_0x42bbef[_0x50e8('0x1d')]=qs[_0x50e8('0x1d')](_0x30fedf[_0x50e8('0x2f')]['limit']);_0x42bbef[_0x50e8('0x1b')]=qs[_0x50e8('0x1b')](_0x30fedf[_0x50e8('0x2f')][_0x50e8('0x1b')]);}_0x42bbef['order']=qs[_0x50e8('0x35')](_0x30fedf[_0x50e8('0x2f')][_0x50e8('0x35')]);_0x42bbef['where']=qs['filters'](_['pick'](_0x30fedf[_0x50e8('0x2f')],_0x4f0b88[_0x50e8('0x30')]),_0x126c99);if(_0x30fedf[_0x50e8('0x2f')][_0x50e8('0x36')]){_0x42bbef[_0x50e8('0x37')]=_[_0x50e8('0x38')](_0x42bbef[_0x50e8('0x37')],{'$or':_[_0x50e8('0x28')](_0x126c99,function(_0x35f802){if(_0x35f802[_0x50e8('0x39')]!=='VIRTUAL'){var _0x3371a4={};_0x3371a4[_0x35f802[_0x50e8('0x26')]]={'$like':'%'+_0x30fedf[_0x50e8('0x2f')][_0x50e8('0x36')]+'%'};return _0x3371a4;}})});}_0x42bbef=_['merge']({},_0x42bbef,_0x30fedf[_0x50e8('0x3a')]);var _0x944e46={'where':_0x42bbef[_0x50e8('0x37')]};return db[_0x50e8('0x29')][_0x50e8('0x1e')](_0x944e46)['then'](function(_0x53b198){_0x1041b9[_0x50e8('0x1e')]=_0x53b198;if(_0x30fedf[_0x50e8('0x2f')]['includeAll']){_0x42bbef[_0x50e8('0x3b')]=[{'all':!![]}];}return db[_0x50e8('0x29')][_0x50e8('0x3c')](_0x42bbef);})[_0x50e8('0x23')](function(_0x251e1c){_0x1041b9[_0x50e8('0x3d')]=_0x251e1c;return _0x1041b9;})[_0x50e8('0x23')](respondWithFilteredResult(_0x39c0c6,_0x42bbef))[_0x50e8('0x3e')](handleError(_0x39c0c6,null));};exports['show']=function(_0x3d26bd,_0x44e0ca){var _0x3ea251={'raw':![],'where':{'id':_0x3d26bd['params']['id']}},_0x2adae0={};_0x2adae0[_0x50e8('0x2d')]=_[_0x50e8('0x3f')](db[_0x50e8('0x29')][_0x50e8('0x2a')]);_0x2adae0['query']=_[_0x50e8('0x3f')](_0x3d26bd['query']);_0x2adae0['filters']=_['intersection'](_0x2adae0[_0x50e8('0x2d')],_0x2adae0[_0x50e8('0x2f')]);_0x3ea251['attributes']=_[_0x50e8('0x31')](_0x2adae0[_0x50e8('0x2d')],qs[_0x50e8('0x40')](_0x3d26bd[_0x50e8('0x2f')][_0x50e8('0x40')]));_0x3ea251[_0x50e8('0x32')]=_0x3ea251['attributes'][_0x50e8('0x33')]?_0x3ea251['attributes']:_0x2adae0[_0x50e8('0x2d')];if(_0x3d26bd[_0x50e8('0x2f')]['includeAll']){_0x3ea251[_0x50e8('0x3b')]=[{'all':!![]}];}_0x3ea251=_['merge']({},_0x3ea251,_0x3d26bd[_0x50e8('0x3a')]);return db[_0x50e8('0x29')][_0x50e8('0x41')](_0x3ea251)[_0x50e8('0x23')](handleEntityNotFound(_0x44e0ca,null))[_0x50e8('0x23')](respondWithResult(_0x44e0ca,null))[_0x50e8('0x3e')](handleError(_0x44e0ca,null));};exports[_0x50e8('0x42')]=function(_0x3e52b3,_0x141bd4){return db[_0x50e8('0x29')][_0x50e8('0x42')](_0x3e52b3['body'],{})[_0x50e8('0x23')](respondWithResult(_0x141bd4,0xc9))[_0x50e8('0x3e')](handleError(_0x141bd4,null));};exports['update']=function(_0x3692ba,_0x58f14e){if(_0x3692ba[_0x50e8('0x43')]['id']){delete _0x3692ba['body']['id'];}delete _0x3692ba[_0x50e8('0x43')][_0x50e8('0x44')];delete _0x3692ba[_0x50e8('0x43')][_0x50e8('0x45')];delete _0x3692ba[_0x50e8('0x43')][_0x50e8('0x46')];delete _0x3692ba[_0x50e8('0x43')]['value'];return db[_0x50e8('0x29')][_0x50e8('0x41')]({'where':{'id':_0x3692ba[_0x50e8('0x47')]['id']}})[_0x50e8('0x23')](handleEntityNotFound(_0x58f14e,null))[_0x50e8('0x23')](saveUpdates(_0x3692ba[_0x50e8('0x43')],null))['then'](respondWithResult(_0x58f14e,null))[_0x50e8('0x3e')](handleError(_0x58f14e,null));};exports[_0x50e8('0x48')]=function(_0xff2e24,_0x27c80a){return db['ScreenRecording'][_0x50e8('0x48')]()[_0x50e8('0x23')](respondWithResult(_0x27c80a,null))[_0x50e8('0x3e')](handleError(_0x27c80a,null));};exports[_0x50e8('0x49')]=function(_0x207f06,_0x1372e3,_0x320b00){var _0x5f5220=require('../../components/encryptor');var _0x55083e=![];var _0x2b54ad={};if(_0x207f06[_0x50e8('0x2f')][_0x50e8('0x39')]&&_0x207f06[_0x50e8('0x2f')][_0x50e8('0x39')]===_0x50e8('0x4a')){_0x2b54ad['uniqueid']=_0x207f06[_0x50e8('0x47')]['id'];}else{_0x2b54ad['id']=_0x207f06[_0x50e8('0x47')]['id'];}return db[_0x50e8('0x29')][_0x50e8('0x41')]({'where':_0x2b54ad,'attributes':['id','value'],'raw':!![]})[_0x50e8('0x23')](handleEntityNotFound(_0x1372e3,null))[_0x50e8('0x23')](function(_0x373b41){if(_0x373b41){var _0x1cc5ba=path[_0x50e8('0x4b')](config[_0x50e8('0x4c')],'server/files/screen_recordings',_0x373b41[_0x50e8('0x4d')]);var _0x5d0d54=util['format']('%s.cypher',_0x1cc5ba);if(fs[_0x50e8('0x4e')](_0x5d0d54)){_0x55083e=!![];return _0x5f5220['decryptFile'](_0x5d0d54,_0x1cc5ba,config[_0x50e8('0x4f')][_0x50e8('0x50')])[_0x50e8('0x23')](function(){return _0x373b41;});}return _0x373b41;}})[_0x50e8('0x23')](function(_0x279cf4){if(_0x279cf4){var _0x12224d=path[_0x50e8('0x4b')](config['root'],_0x50e8('0x51'),_0x279cf4[_0x50e8('0x4d')]);if(!fs[_0x50e8('0x4e')](_0x12224d)){throw new db['Sequelize']['ValidationError']('ScreenRecording\x20not\x20found');}if(_0x279cf4[_0x50e8('0x52')]){return _0x1372e3[_0x50e8('0x49')](_0x12224d,_0x279cf4[_0x50e8('0x52')]+path[_0x50e8('0x53')](_0x12224d),function(){if(_0x55083e){fs[_0x50e8('0x54')](_0x12224d);}});}else{return _0x1372e3[_0x50e8('0x49')](_0x12224d,function(_0x583d6a){if(_0x55083e){fs[_0x50e8('0x54')](_0x12224d);}});}}})['catch'](function(_0x255b48){if(_0x255b48[_0x50e8('0x55')]==='ScreenRecording\x20not\x20found'){_0x1372e3['status'](0x194)['send'](_0x50e8('0x56'));}else{return handleError(_0x1372e3,null);}});};exports[_0x50e8('0x57')]=function(_0x5d1fc8,_0x351047){return db[_0x50e8('0x29')][_0x50e8('0x41')]({'where':{'id':_0x5d1fc8[_0x50e8('0x47')]['id']}})[_0x50e8('0x23')](function(_0x47b428){if(_[_0x50e8('0x58')](_0x47b428)){throw new ReferenceError(_0x50e8('0x59'));}return _0x47b428;})[_0x50e8('0x23')](function(_0x4b80ac){var _0x583e58=path[_0x50e8('0x4b')](config[_0x50e8('0x4c')],_0x50e8('0x51'),_0x4b80ac[_0x50e8('0x4d')]);logger[_0x50e8('0x5a')](_0x50e8('0x5b'),_0x583e58);if(!_['isNil'](_0x4b80ac['value'])&&fs[_0x50e8('0x4e')](_0x583e58)){logger['info'](_0x50e8('0x5c')+_0x583e58+_0x50e8('0x5d'));fs['unlinkSync'](_0x583e58);}_0x583e58=_0x583e58+_0x50e8('0x5e');if(!_['isNil'](_0x4b80ac['value'])&&fs['existsSync'](_0x583e58)){logger[_0x50e8('0x5a')](_0x50e8('0x5c')+_0x583e58+_0x50e8('0x5d'));fs[_0x50e8('0x5f')](_0x583e58);}return _0x4b80ac;})['then'](function(_0x480362){if(!_0x480362)throw new InternalError();return _0x480362[_0x50e8('0x57')]();})[_0x50e8('0x23')](function(){_0x351047[_0x50e8('0x18')](0xcc)[_0x50e8('0x19')]();})[_0x50e8('0x3e')](handleError(_0x351047,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 96eb7ae..a51c2c9 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 _0x35c8=['../../config/environment','exports','define','screen_recordings','interactionid','../../config/logger','moment','bluebird','request-promise'];(function(_0x17397c,_0x2e2208){var _0x58aa5f=function(_0xf2c324){while(--_0xf2c324){_0x17397c['push'](_0x17397c['shift']());}};_0x58aa5f(++_0x2e2208);}(_0x35c8,0x125));var _0x835c=function(_0x4b1ef3,_0x26dae8){_0x4b1ef3=_0x4b1ef3-0x0;var _0x1cab56=_0x35c8[_0x4b1ef3];return _0x1cab56;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x835c('0x0'))('api');var moment=require(_0x835c('0x1'));var BPromise=require(_0x835c('0x2'));var rp=require(_0x835c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x835c('0x4'));var attributes=require('./screenRecording.attributes');module[_0x835c('0x5')]=function(_0x4fbc51,_0x14347d){return _0x4fbc51[_0x835c('0x6')]('ScreenRecording',attributes,{'tableName':_0x835c('0x7'),'paranoid':![],'indexes':[{'name':_0x835c('0x8'),'fields':[_0x835c('0x8')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8c3a=['interactionid','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./screenRecording.attributes','exports','define','ScreenRecording','screen_recordings'];(function(_0x3946d4,_0xd67c03){var _0x6e1edf=function(_0x30423b){while(--_0x30423b){_0x3946d4['push'](_0x3946d4['shift']());}};_0x6e1edf(++_0xd67c03);}(_0x8c3a,0x14b));var _0xa8c3=function(_0x135670,_0x4e71b8){_0x135670=_0x135670-0x0;var _0x2f7b12=_0x8c3a[_0x135670];return _0x2f7b12;};'use strict';var _=require(_0xa8c3('0x0'));var util=require(_0xa8c3('0x1'));var logger=require(_0xa8c3('0x2'))(_0xa8c3('0x3'));var moment=require(_0xa8c3('0x4'));var BPromise=require('bluebird');var rp=require(_0xa8c3('0x5'));var fs=require('fs');var path=require(_0xa8c3('0x6'));var rimraf=require(_0xa8c3('0x7'));var config=require(_0xa8c3('0x8'));var attributes=require(_0xa8c3('0x9'));module[_0xa8c3('0xa')]=function(_0x2a3c3a,_0x1aee54){return _0x2a3c3a[_0xa8c3('0xb')](_0xa8c3('0xc'),attributes,{'tableName':_0xa8c3('0xd'),'paranoid':![],'indexes':[{'name':_0xa8c3('0xe'),'fields':[_0xa8c3('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 9e4bd3b..fb45739 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 _0x4bc2=['jayson/promise','client','http','request','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','error','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x56503a,_0x1c4b81){var _0x52e0d4=function(_0x4544d0){while(--_0x4544d0){_0x56503a['push'](_0x56503a['shift']());}};_0x52e0d4(++_0x1c4b81);}(_0x4bc2,0x1c6));var _0x24bc=function(_0x4ed8ef,_0x56cb79){_0x4ed8ef=_0x4ed8ef-0x0;var _0x211de0=_0x4bc2[_0x4ed8ef];return _0x211de0;};'use strict';var _=require('lodash');var util=require(_0x24bc('0x0'));var moment=require('moment');var BPromise=require(_0x24bc('0x1'));var rs=require(_0x24bc('0x2'));var fs=require('fs');var Redis=require(_0x24bc('0x3'));var db=require(_0x24bc('0x4'))['db'];var utils=require(_0x24bc('0x5'));var logger=require(_0x24bc('0x6'))('rpc');var config=require(_0x24bc('0x7'));var jayson=require(_0x24bc('0x8'));var client=jayson[_0x24bc('0x9')][_0x24bc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2b79ec,_0x39eb8c,_0x5c9822){return new BPromise(function(_0x31b555,_0x375a71){return client[_0x24bc('0xb')](_0x2b79ec,_0x5c9822)['then'](function(_0xf4c23){logger[_0x24bc('0xc')](_0x24bc('0xd'),_0x39eb8c,_0x24bc('0xe'));logger[_0x24bc('0xf')](_0x24bc('0x10'),_0x39eb8c,_0x24bc('0xe'),JSON['stringify'](_0xf4c23));if(_0xf4c23[_0x24bc('0x11')]){if(_0xf4c23[_0x24bc('0x11')]['code']===0x1f4){logger[_0x24bc('0x11')](_0x24bc('0xd'),_0x39eb8c,_0xf4c23[_0x24bc('0x11')][_0x24bc('0x12')]);return _0x375a71(_0xf4c23[_0x24bc('0x11')][_0x24bc('0x12')]);}logger['error'](_0x24bc('0xd'),_0x39eb8c,_0xf4c23[_0x24bc('0x11')][_0x24bc('0x12')]);return _0x31b555(_0xf4c23[_0x24bc('0x11')][_0x24bc('0x12')]);}else{logger[_0x24bc('0xc')]('ScreenRecording,\x20%s,\x20%s',_0x39eb8c,'request\x20sent');_0x31b555(_0xf4c23[_0x24bc('0x13')]['message']);}})[_0x24bc('0x14')](function(_0x5f3bc5){logger[_0x24bc('0x11')](_0x24bc('0xd'),_0x39eb8c,_0x5f3bc5);_0x375a71(_0x5f3bc5);});});} \ No newline at end of file +var _0xe04e=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','http','request','then','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x2cb84f,_0x1c0944){var _0x52086b=function(_0x149856){while(--_0x149856){_0x2cb84f['push'](_0x2cb84f['shift']());}};_0x52086b(++_0x1c0944);}(_0xe04e,0x12b));var _0xee04=function(_0x5f343d,_0x1de7e2){_0x5f343d=_0x5f343d-0x0;var _0x47dbd7=_0xe04e[_0x5f343d];return _0x47dbd7;};'use strict';var _=require(_0xee04('0x0'));var util=require(_0xee04('0x1'));var moment=require(_0xee04('0x2'));var BPromise=require(_0xee04('0x3'));var rs=require(_0xee04('0x4'));var fs=require('fs');var Redis=require(_0xee04('0x5'));var db=require(_0xee04('0x6'))['db'];var utils=require(_0xee04('0x7'));var logger=require('../../config/logger')(_0xee04('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xee04('0x9')][_0xee04('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x246fe5,_0x5e6119,_0x670a5b){return new BPromise(function(_0x285e48,_0x31e588){return client[_0xee04('0xb')](_0x246fe5,_0x670a5b)[_0xee04('0xc')](function(_0x229993){logger[_0xee04('0xd')](_0xee04('0xe'),_0x5e6119,_0xee04('0xf'));logger['debug'](_0xee04('0x10'),_0x5e6119,_0xee04('0xf'),JSON[_0xee04('0x11')](_0x229993));if(_0x229993[_0xee04('0x12')]){if(_0x229993['error'][_0xee04('0x13')]===0x1f4){logger['error'](_0xee04('0xe'),_0x5e6119,_0x229993[_0xee04('0x12')][_0xee04('0x14')]);return _0x31e588(_0x229993[_0xee04('0x12')][_0xee04('0x14')]);}logger['error']('ScreenRecording,\x20%s,\x20%s',_0x5e6119,_0x229993['error'][_0xee04('0x14')]);return _0x285e48(_0x229993[_0xee04('0x12')]['message']);}else{logger['info'](_0xee04('0xe'),_0x5e6119,_0xee04('0xf'));_0x285e48(_0x229993[_0xee04('0x15')][_0xee04('0x14')]);}})[_0xee04('0x16')](function(_0x7dd0f3){logger[_0xee04('0x12')]('ScreenRecording,\x20%s,\x20%s',_0x5e6119,_0x7dd0f3);_0x31e588(_0x7dd0f3);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index c279ffa..194e837 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 _0x19a2=['get','index','/now','getDate','/:id','/:id/logo','getLogoLogin','gdpr','/:id/preferred','getPreferred','getFavicon','diskStorage','join','root','server/files/images/logos/','%s%s','logo','originalname','post','single','file','addLogo','format','logologin','extname','/:id/logo_login','preferred','addPreferred','/:id/favicon','addFavicon','put','isAuthenticated','update','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller'];(function(_0x29bfed,_0xd70136){var _0x203884=function(_0x3a6eee){while(--_0x3a6eee){_0x29bfed['push'](_0x29bfed['shift']());}};_0x203884(++_0xd70136);}(_0x19a2,0x124));var _0x219a=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x19a2[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x219a('0x0'));var util=require('util');var path=require(_0x219a('0x1'));var timeout=require(_0x219a('0x2'));var express=require('express');var router=express[_0x219a('0x3')]();var fs_extra=require(_0x219a('0x4'));var auth=require(_0x219a('0x5'));var interaction=require(_0x219a('0x6'));var config=require(_0x219a('0x7'));var controller=require(_0x219a('0x8'));router[_0x219a('0x9')]('/',auth['isAuthenticated'](),controller[_0x219a('0xa')]);router[_0x219a('0x9')](_0x219a('0xb'),controller[_0x219a('0xc')]);router['get'](_0x219a('0xd'),controller['show']);router[_0x219a('0x9')](_0x219a('0xe'),controller['getLogo']);router[_0x219a('0x9')]('/:id/logo_login',controller[_0x219a('0xf')]);router['get']('/:id/gdpr',controller[_0x219a('0x10')]);router[_0x219a('0x9')](_0x219a('0x11'),controller[_0x219a('0x12')]);router['get']('/:id/favicon',controller[_0x219a('0x13')]);var upload=multer({'storage':multer[_0x219a('0x14')]({'destination':function(_0x18241b,_0x201ca6,_0x4d3644){_0x4d3644(null,path[_0x219a('0x15')](config[_0x219a('0x16')],_0x219a('0x17')));},'filename':function(_0x1ff84d,_0x3fa505,_0x126ab4){_0x126ab4(null,util['format'](_0x219a('0x18'),_0x219a('0x19'),path['extname'](_0x3fa505[_0x219a('0x1a')])));}})});router[_0x219a('0x1b')](_0x219a('0xe'),upload[_0x219a('0x1c')](_0x219a('0x1d')),controller[_0x219a('0x1e')]);var upload=multer({'storage':multer[_0x219a('0x14')]({'destination':function(_0x18f9c4,_0x6d6b4c,_0x1d5e1c){_0x1d5e1c(null,path[_0x219a('0x15')](config[_0x219a('0x16')],_0x219a('0x17')));},'filename':function(_0x10238a,_0x5c0b38,_0x1a3efe){_0x1a3efe(null,util[_0x219a('0x1f')]('%s%s',_0x219a('0x20'),path[_0x219a('0x21')](_0x5c0b38[_0x219a('0x1a')])));}})});router[_0x219a('0x1b')](_0x219a('0x22'),upload[_0x219a('0x1c')](_0x219a('0x1d')),controller['addLogoLogin']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3dab0d,_0x2b927,_0x1fbce9){_0x1fbce9(null,path[_0x219a('0x15')](config[_0x219a('0x16')],_0x219a('0x17')));},'filename':function(_0x1ade57,_0x43c798,_0x4a8f26){_0x4a8f26(null,util['format'](_0x219a('0x18'),_0x219a('0x23'),path[_0x219a('0x21')](_0x43c798[_0x219a('0x1a')])));}})});router[_0x219a('0x1b')](_0x219a('0x11'),upload[_0x219a('0x1c')](_0x219a('0x1d')),controller[_0x219a('0x24')]);var upload=multer({'storage':multer[_0x219a('0x14')]({'destination':function(_0x1810d4,_0x1e3a17,_0x40a7d2){_0x40a7d2(null,path['join'](config['root'],_0x219a('0x17')));},'filename':function(_0x1ba9fa,_0x4aac22,_0x49ffb2){_0x49ffb2(null,util['format'](_0x219a('0x18'),'favicon',path[_0x219a('0x21')](_0x4aac22[_0x219a('0x1a')])));}})});router[_0x219a('0x1b')](_0x219a('0x25'),upload[_0x219a('0x1c')](_0x219a('0x1d')),controller[_0x219a('0x26')]);router[_0x219a('0x27')](_0x219a('0xd'),auth[_0x219a('0x28')](),controller[_0x219a('0x29')]);module[_0x219a('0x2a')]=router; \ No newline at end of file +var _0xcac9=['diskStorage','preferred','post','/:id/preferred','addPreferred','favicon','addFavicon','/:id','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/now','getDate','show','getLogo','/:id/logo_login','getPreferred','/:id/favicon','getFavicon','join','root','%s%s','logo','extname','originalname','/:id/logo','single','file','addLogo','server/files/images/logos/','format','addLogoLogin'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcac9,0x162));var _0x9cac=function(_0x1c8c28,_0x3ee093){_0x1c8c28=_0x1c8c28-0x0;var _0x1f59b4=_0xcac9[_0x1c8c28];return _0x1f59b4;};'use strict';var multer=require(_0x9cac('0x0'));var util=require(_0x9cac('0x1'));var path=require(_0x9cac('0x2'));var timeout=require(_0x9cac('0x3'));var express=require(_0x9cac('0x4'));var router=express[_0x9cac('0x5')]();var fs_extra=require(_0x9cac('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x9cac('0x7'));var config=require(_0x9cac('0x8'));var controller=require('./setting.controller');router['get']('/',auth[_0x9cac('0x9')](),controller[_0x9cac('0xa')]);router[_0x9cac('0xb')](_0x9cac('0xc'),controller[_0x9cac('0xd')]);router[_0x9cac('0xb')]('/:id',controller[_0x9cac('0xe')]);router[_0x9cac('0xb')]('/:id/logo',controller[_0x9cac('0xf')]);router[_0x9cac('0xb')](_0x9cac('0x10'),controller['getLogoLogin']);router[_0x9cac('0xb')]('/:id/gdpr',controller['gdpr']);router[_0x9cac('0xb')]('/:id/preferred',controller[_0x9cac('0x11')]);router[_0x9cac('0xb')](_0x9cac('0x12'),controller[_0x9cac('0x13')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3889ce,_0x1aa9d7,_0x1eb310){_0x1eb310(null,path[_0x9cac('0x14')](config[_0x9cac('0x15')],'server/files/images/logos/'));},'filename':function(_0x5e88ba,_0x28ef7b,_0x14d4fc){_0x14d4fc(null,util['format'](_0x9cac('0x16'),_0x9cac('0x17'),path[_0x9cac('0x18')](_0x28ef7b[_0x9cac('0x19')])));}})});router['post'](_0x9cac('0x1a'),upload[_0x9cac('0x1b')](_0x9cac('0x1c')),controller[_0x9cac('0x1d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x52fac9,_0x54e853,_0x2a0c32){_0x2a0c32(null,path['join'](config['root'],_0x9cac('0x1e')));},'filename':function(_0x24c8e5,_0xb447d2,_0x57be67){_0x57be67(null,util[_0x9cac('0x1f')]('%s%s','logologin',path[_0x9cac('0x18')](_0xb447d2[_0x9cac('0x19')])));}})});router['post'](_0x9cac('0x10'),upload[_0x9cac('0x1b')](_0x9cac('0x1c')),controller[_0x9cac('0x20')]);var upload=multer({'storage':multer[_0x9cac('0x21')]({'destination':function(_0x2077cd,_0x268697,_0x5b53fa){_0x5b53fa(null,path[_0x9cac('0x14')](config[_0x9cac('0x15')],_0x9cac('0x1e')));},'filename':function(_0x3d4d80,_0x12351d,_0x4fc716){_0x4fc716(null,util[_0x9cac('0x1f')](_0x9cac('0x16'),_0x9cac('0x22'),path[_0x9cac('0x18')](_0x12351d[_0x9cac('0x19')])));}})});router[_0x9cac('0x23')](_0x9cac('0x24'),upload[_0x9cac('0x1b')](_0x9cac('0x1c')),controller[_0x9cac('0x25')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1570b2,_0x5ac6c6,_0x414644){_0x414644(null,path['join'](config[_0x9cac('0x15')],'server/files/images/logos/'));},'filename':function(_0x3b9b04,_0x144ecf,_0x645ecc){_0x645ecc(null,util[_0x9cac('0x1f')]('%s%s',_0x9cac('0x26'),path[_0x9cac('0x18')](_0x144ecf['originalname'])));}})});router[_0x9cac('0x23')](_0x9cac('0x12'),upload['single']('file'),controller[_0x9cac('0x27')]);router['put'](_0x9cac('0x28'),auth[_0x9cac('0x9')](),controller[_0x9cac('0x29')]);module[_0x9cac('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 07b337a..f6fd534 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 _0x47c5=['/var/opt/motion2/server/files/sounds/converted','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','UNSIGNED','sequelize','exports','INTEGER','min_internal','min_mailbox','STRING'];(function(_0x16d9d7,_0x4cc7fd){var _0x596ed0=function(_0x500b6e){while(--_0x500b6e){_0x16d9d7['push'](_0x16d9d7['shift']());}};_0x596ed0(++_0x4cc7fd);}(_0x47c5,0x165));var _0x547c=function(_0x2466ec,_0x4260dc){_0x2466ec=_0x2466ec-0x0;var _0x450c0b=_0x47c5[_0x2466ec];return _0x450c0b;};'use strict';var Sequelize=require(_0x547c('0x0'));module[_0x547c('0x1')]={'min_internal':{'type':Sequelize[_0x547c('0x2')](0xb),'unique':_0x547c('0x3'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x547c('0x2')](0xb),'unique':_0x547c('0x4'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x547c('0x5')],'defaultValue':_0x547c('0x6')},'logo':{'type':Sequelize['STRING']},'defaultLogo':{'type':Sequelize[_0x547c('0x7')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x547c('0x5')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x547c('0x5')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x547c('0x7')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x547c('0x7')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x547c('0x7')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x547c('0x5')]},'turnaddr':{'type':Sequelize[_0x547c('0x5')]},'turnusername':{'type':Sequelize[_0x547c('0x5')]},'turnpassword':{'type':Sequelize[_0x547c('0x5')]},'pageTitle':{'type':Sequelize[_0x547c('0x5')]},'defaultPageTitle':{'type':Sequelize[_0x547c('0x7')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x547c('0x7')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x547c('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x547c('0x7')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x547c('0x5')],'defaultValue':_0x547c('0x8')},'enableEmailPreview':{'type':Sequelize[_0x547c('0x7')],'defaultValue':![]},'split':{'type':Sequelize[_0x547c('0x7')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x547c('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x547c('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0x547c('0x9')},'chatTimeout':{'type':Sequelize[_0x547c('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x547c('0x7')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x547c('0x5')]},'defaultPreferred':{'type':Sequelize[_0x547c('0x7')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x547c('0x7')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x547c('0x5')]},'allowedLoginAttempts':{'type':Sequelize[_0x547c('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x547c('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x547c('0x5')]},'defaultFavicon':{'type':Sequelize[_0x547c('0x7')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x547c('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x547c('0x7')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x547c('0x7')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x547c('0x2')]},'transcribeRegion':{'type':Sequelize[_0x547c('0x5')]},'sentiment':{'type':Sequelize[_0x547c('0x7')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x547c('0x7')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize['INTEGER']},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x547c('0x5')]},'bucket':{'type':Sequelize[_0x547c('0x5')]},'googleSsoEnabled':{'type':Sequelize[_0x547c('0x7')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x547c('0x7')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x547c('0x2')](0x2)[_0x547c('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize['INTEGER'](0x2)[_0x547c('0xa')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x547c('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize['INTEGER'](0x2)[_0x547c('0xa')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x547c('0x7')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0x547c('0x2')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x547c('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0x547c('0x2')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x547c('0x7')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x547c('0x7')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x547c('0x2')],'defaultValue':0x5},'disabledCookie':{'type':Sequelize[_0x547c('0x7')],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x547c('0x2')],'defaultValue':0x14}}; \ No newline at end of file +var _0x4f98=['min_mailbox','/var/opt/motion2/server/files/sounds/converted','STRING','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','UNSIGNED','sequelize','exports','INTEGER','min_internal'];(function(_0x504bbc,_0x497f18){var _0x1dac57=function(_0xbd99a4){while(--_0xbd99a4){_0x504bbc['push'](_0x504bbc['shift']());}};_0x1dac57(++_0x497f18);}(_0x4f98,0x196));var _0x84f9=function(_0x64aff8,_0x106082){_0x64aff8=_0x64aff8-0x0;var _0x5488a3=_0x4f98[_0x64aff8];return _0x5488a3;};'use strict';var Sequelize=require(_0x84f9('0x0'));module[_0x84f9('0x1')]={'min_internal':{'type':Sequelize[_0x84f9('0x2')](0xb),'unique':_0x84f9('0x3'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x84f9('0x2')](0xb),'unique':_0x84f9('0x4'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x84f9('0x2')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize['STRING'],'defaultValue':_0x84f9('0x5')},'logo':{'type':Sequelize[_0x84f9('0x6')]},'defaultLogo':{'type':Sequelize[_0x84f9('0x7')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x84f9('0x6')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x84f9('0x6')]},'defaultHeaderWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'securePassword':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x84f9('0x7')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x84f9('0x6')]},'turnaddr':{'type':Sequelize[_0x84f9('0x6')]},'turnusername':{'type':Sequelize[_0x84f9('0x6')]},'turnpassword':{'type':Sequelize[_0x84f9('0x6')]},'pageTitle':{'type':Sequelize[_0x84f9('0x6')]},'defaultPageTitle':{'type':Sequelize[_0x84f9('0x7')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x84f9('0x7')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x84f9('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x84f9('0x7')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x84f9('0x6')],'defaultValue':_0x84f9('0x8')},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize[_0x84f9('0x7')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x84f9('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x84f9('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x84f9('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x84f9('0x6')],'defaultValue':'alternate'},'chatTimeout':{'type':Sequelize[_0x84f9('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x84f9('0x7')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x84f9('0x7')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x84f9('0x6')]},'allowedLoginAttempts':{'type':Sequelize[_0x84f9('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'favicon':{'type':Sequelize['STRING']},'defaultFavicon':{'type':Sequelize[_0x84f9('0x7')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize['INTEGER'],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x84f9('0x7')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x84f9('0x2')]},'transcribeRegion':{'type':Sequelize['STRING']},'sentiment':{'type':Sequelize[_0x84f9('0x7')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x84f9('0x7')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x84f9('0x2')]},'sentimentRegion':{'type':Sequelize[_0x84f9('0x6')]},'language':{'type':Sequelize[_0x84f9('0x6')]},'bucket':{'type':Sequelize[_0x84f9('0x6')]},'googleSsoEnabled':{'type':Sequelize[_0x84f9('0x7')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x84f9('0x7')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x84f9('0x2')](0x2)[_0x84f9('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize['INTEGER'](0x2)[_0x84f9('0x9')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x84f9('0x2')](0x2)[_0x84f9('0x9')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x84f9('0x2')](0x2)[_0x84f9('0x9')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x84f9('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0x84f9('0x2')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x84f9('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0x84f9('0x2')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x84f9('0x7')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x84f9('0x7')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x84f9('0x2')],'defaultValue':0x5},'disabledCookie':{'type':Sequelize[_0x84f9('0x7')],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x84f9('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 ac02ebb..6b01f91 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 _0x4020=['gdpr','securePassword','addPreferred','getPreferred','default_preferred.png','default','addFavicon','getDate','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','jayson/promise','http','info','request\x20sent','debug','stringify','error','code','Setting,\x20%s,\x20%s','message','result','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','name','send','index','map','rawAttributes','type','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','Setting','includeAll','findAll','rows','show','length','include','find','catch','body','addLogo','file','filename','logo','params','addLogoLogin','getLogo','server/files/images/logos','loginLogo','preferred','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','join','root','toLower','upperFirst','custom','Sequelize','ValidationError','\x20not\x20found','getLogoLogin','getLicense','default_loginLogo.svg','download'];(function(_0x17acb2,_0x33f502){var _0x535dfa=function(_0x430104){while(--_0x430104){_0x17acb2['push'](_0x17acb2['shift']());}};_0x535dfa(++_0x33f502);}(_0x4020,0x1f0));var _0x0402=function(_0x5d747c,_0x322ca2){_0x5d747c=_0x5d747c-0x0;var _0x5dbe6a=_0x4020[_0x5d747c];return _0x5dbe6a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0402('0x0'));var zipdir=require(_0x0402('0x1'));var jsonpatch=require(_0x0402('0x2'));var rp=require(_0x0402('0x3'));var moment=require(_0x0402('0x4'));var BPromise=require(_0x0402('0x5'));var Mustache=require('mustache');var util=require(_0x0402('0x6'));var path=require(_0x0402('0x7'));var sox=require(_0x0402('0x8'));var csv=require(_0x0402('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0402('0xa'));var _=require('lodash');var squel=require(_0x0402('0xb'));var crypto=require(_0x0402('0xc'));var jsforce=require(_0x0402('0xd'));var deskjs=require(_0x0402('0xe'));var toCsv=require(_0x0402('0x9'));var querystring=require(_0x0402('0xf'));var Papa=require(_0x0402('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0402('0x11'));var logger=require(_0x0402('0x12'))(_0x0402('0x13'));var utils=require('../../config/utils');var config=require(_0x0402('0x14'));var licenseUtil=require(_0x0402('0x15'));var db=require('../../mysqldb')['db'];var jayson=require(_0x0402('0x16'));var client=jayson['client'][_0x0402('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x24c91c,_0x5574b3,_0xc2e5bf,_0x907f68){return new BPromise(function(_0x5959af,_0x1648e1){var _0x36b2eb=_0x907f68||client;return _0x36b2eb['request'](_0x24c91c,_0xc2e5bf)['then'](function(_0x59000d){logger[_0x0402('0x18')]('Setting,\x20%s,\x20%s',_0x5574b3,_0x0402('0x19'));logger[_0x0402('0x1a')]('Setting,\x20%s,\x20%s,\x20%s',_0x5574b3,_0x0402('0x19'),JSON[_0x0402('0x1b')](_0x59000d));if(_0x59000d[_0x0402('0x1c')]){if(_0x59000d[_0x0402('0x1c')][_0x0402('0x1d')]===0x1f4){logger[_0x0402('0x1c')](_0x0402('0x1e'),_0x5574b3,_0x59000d['error'][_0x0402('0x1f')]);return _0x1648e1(_0x59000d['error']['message']);}logger[_0x0402('0x1c')](_0x0402('0x1e'),_0x5574b3,_0x59000d[_0x0402('0x1c')][_0x0402('0x1f')]);return _0x5959af(_0x59000d[_0x0402('0x1c')][_0x0402('0x1f')]);}else{logger['info'](_0x0402('0x1e'),_0x5574b3,_0x0402('0x19'));_0x5959af(_0x59000d[_0x0402('0x20')][_0x0402('0x1f')]);}})['catch'](function(_0x2dc44b){logger[_0x0402('0x1c')]('Setting,\x20%s,\x20%s',_0x5574b3,_0x2dc44b);_0x1648e1(_0x2dc44b);});});}function respondWithStatusCode(_0x4f1b4d,_0x49411b){_0x49411b=_0x49411b||0xcc;return function(_0x3cf648){if(_0x3cf648){return _0x4f1b4d[_0x0402('0x21')](_0x49411b);}return _0x4f1b4d[_0x0402('0x22')](_0x49411b)[_0x0402('0x23')]();};}function respondWithResult(_0x19e5d4,_0x1e9934){_0x1e9934=_0x1e9934||0xc8;return function(_0x37ee76){if(_0x37ee76){return _0x19e5d4[_0x0402('0x22')](_0x1e9934)[_0x0402('0x24')](_0x37ee76);}};}function respondWithFilteredResult(_0x3ccb8b,_0x13b02e){return function(_0x4b3751){if(_0x4b3751){var _0x95f5e1=typeof _0x13b02e[_0x0402('0x25')]==='undefined'&&typeof _0x13b02e[_0x0402('0x26')]===_0x0402('0x27');var _0x30f51a=_0x4b3751['count'];var _0x1c2e55=_0x95f5e1?0x0:_0x13b02e['offset'];var _0x554fb1=_0x95f5e1?_0x4b3751[_0x0402('0x28')]:_0x13b02e[_0x0402('0x25')]+_0x13b02e['limit'];var _0x109c32;if(_0x554fb1>=_0x30f51a){_0x554fb1=_0x30f51a;_0x109c32=0xc8;}else{_0x109c32=0xce;}_0x3ccb8b[_0x0402('0x22')](_0x109c32);return _0x3ccb8b[_0x0402('0x29')](_0x0402('0x2a'),_0x1c2e55+'-'+_0x554fb1+'/'+_0x30f51a)[_0x0402('0x24')](_0x4b3751);}return null;};}function patchUpdates(_0x5d75e5){return function(_0x14448c){try{jsonpatch[_0x0402('0x2b')](_0x14448c,_0x5d75e5,!![]);}catch(_0x54f95c){return BPromise[_0x0402('0x2c')](_0x54f95c);}return _0x14448c[_0x0402('0x2d')]();};}function saveUpdates(_0x27527a,_0x25d163){return function(_0x1a57a0){if(_0x1a57a0){return _0x1a57a0[_0x0402('0x2e')](_0x27527a)[_0x0402('0x2f')](function(_0x3f1f6f){return _0x3f1f6f;});}return null;};}function removeEntity(_0x3fbaa3,_0x37ed13){return function(_0x49f0d4){if(_0x49f0d4){return _0x49f0d4[_0x0402('0x30')]()[_0x0402('0x2f')](function(){_0x3fbaa3[_0x0402('0x22')](0xcc)[_0x0402('0x23')]();});}};}function handleEntityNotFound(_0x528413,_0x32a95e){return function(_0x25b16f){if(!_0x25b16f){_0x528413['sendStatus'](0x194);}return _0x25b16f;};}function handleError(_0x544ac9,_0x4fc90f){_0x4fc90f=_0x4fc90f||0x1f4;return function(_0x26add6){logger[_0x0402('0x1c')](_0x26add6['stack']);if(_0x26add6['name']){delete _0x26add6[_0x0402('0x31')];}_0x544ac9[_0x0402('0x22')](_0x4fc90f)[_0x0402('0x32')](_0x26add6);};}exports[_0x0402('0x33')]=function(_0xdd363f,_0xbec02f){var _0x35093d={},_0x5ee01e={},_0x405dca={'count':0x0,'rows':[]};var _0x27a940=_[_0x0402('0x34')](db['Setting'][_0x0402('0x35')],function(_0x31cf30){return{'name':_0x31cf30['fieldName'],'type':_0x31cf30[_0x0402('0x36')]['key']};});_0x5ee01e[_0x0402('0x37')]=_['map'](_0x27a940,_0x0402('0x31'));_0x5ee01e['query']=_[_0x0402('0x38')](_0xdd363f[_0x0402('0x39')]);_0x5ee01e[_0x0402('0x3a')]=_[_0x0402('0x3b')](_0x5ee01e[_0x0402('0x37')],_0x5ee01e[_0x0402('0x39')]);_0x35093d[_0x0402('0x3c')]=_['intersection'](_0x5ee01e['model'],qs[_0x0402('0x3d')](_0xdd363f[_0x0402('0x39')][_0x0402('0x3d')]));_0x35093d[_0x0402('0x3c')]=_0x35093d['attributes']['length']?_0x35093d['attributes']:_0x5ee01e[_0x0402('0x37')];if(!_0xdd363f[_0x0402('0x39')][_0x0402('0x3e')]('nolimit')){_0x35093d[_0x0402('0x26')]=qs['limit'](_0xdd363f[_0x0402('0x39')][_0x0402('0x26')]);_0x35093d[_0x0402('0x25')]=qs[_0x0402('0x25')](_0xdd363f['query'][_0x0402('0x25')]);}_0x35093d[_0x0402('0x3f')]=qs['sort'](_0xdd363f[_0x0402('0x39')][_0x0402('0x40')]);_0x35093d[_0x0402('0x41')]=qs[_0x0402('0x3a')](_[_0x0402('0x42')](_0xdd363f[_0x0402('0x39')],_0x5ee01e[_0x0402('0x3a')]),_0x27a940);if(_0xdd363f[_0x0402('0x39')][_0x0402('0x43')]){_0x35093d[_0x0402('0x41')]=_[_0x0402('0x44')](_0x35093d['where'],{'$or':_[_0x0402('0x34')](_0x27a940,function(_0x15fc05){if(_0x15fc05['type']!==_0x0402('0x45')){var _0x20a577={};_0x20a577[_0x15fc05[_0x0402('0x31')]]={'$like':'%'+_0xdd363f[_0x0402('0x39')][_0x0402('0x43')]+'%'};return _0x20a577;}})});}_0x35093d=_[_0x0402('0x44')]({},_0x35093d,_0xdd363f[_0x0402('0x46')]);var _0x153588={'where':_0x35093d[_0x0402('0x41')]};return db[_0x0402('0x47')][_0x0402('0x28')](_0x153588)[_0x0402('0x2f')](function(_0x1e7cbe){_0x405dca[_0x0402('0x28')]=_0x1e7cbe;if(_0xdd363f[_0x0402('0x39')][_0x0402('0x48')]){_0x35093d['include']=[{'all':!![]}];}return db[_0x0402('0x47')][_0x0402('0x49')](_0x35093d);})[_0x0402('0x2f')](function(_0x572e24){_0x405dca[_0x0402('0x4a')]=_0x572e24;return _0x405dca;})['then'](respondWithFilteredResult(_0xbec02f,_0x35093d))['catch'](handleError(_0xbec02f,null));};exports[_0x0402('0x4b')]=function(_0x3d2dec,_0x34855a){var _0xb0e03f={'raw':![],'where':{'id':_0x3d2dec['params']['id']}},_0x2b3d31={};_0x2b3d31[_0x0402('0x37')]=_[_0x0402('0x38')](db[_0x0402('0x47')][_0x0402('0x35')]);_0x2b3d31[_0x0402('0x39')]=_[_0x0402('0x38')](_0x3d2dec[_0x0402('0x39')]);_0x2b3d31[_0x0402('0x3a')]=_[_0x0402('0x3b')](_0x2b3d31[_0x0402('0x37')],_0x2b3d31[_0x0402('0x39')]);_0xb0e03f[_0x0402('0x3c')]=_[_0x0402('0x3b')](_0x2b3d31[_0x0402('0x37')],qs['fields'](_0x3d2dec[_0x0402('0x39')]['fields']));_0xb0e03f[_0x0402('0x3c')]=_0xb0e03f[_0x0402('0x3c')][_0x0402('0x4c')]?_0xb0e03f[_0x0402('0x3c')]:_0x2b3d31[_0x0402('0x37')];if(_0x3d2dec[_0x0402('0x39')][_0x0402('0x48')]){_0xb0e03f[_0x0402('0x4d')]=[{'all':!![]}];}_0xb0e03f=_[_0x0402('0x44')]({},_0xb0e03f,_0x3d2dec['options']);return db[_0x0402('0x47')][_0x0402('0x4e')](_0xb0e03f)['then'](handleEntityNotFound(_0x34855a,null))[_0x0402('0x2f')](respondWithResult(_0x34855a,null))[_0x0402('0x4f')](handleError(_0x34855a,null));};exports[_0x0402('0x2e')]=function(_0xc6b310,_0x307eeb){if(_0xc6b310[_0x0402('0x50')]['id']){delete _0xc6b310[_0x0402('0x50')]['id'];}return db['Setting'][_0x0402('0x4e')]({'where':{'id':_0xc6b310['params']['id']}})[_0x0402('0x2f')](handleEntityNotFound(_0x307eeb,null))[_0x0402('0x2f')](saveUpdates(_0xc6b310[_0x0402('0x50')],null))[_0x0402('0x2f')](respondWithResult(_0x307eeb,null))[_0x0402('0x4f')](handleError(_0x307eeb,null));};exports[_0x0402('0x51')]=function(_0x348978,_0x4c5f82,_0x37b1ef){if(_0x348978[_0x0402('0x52')]&&_0x348978[_0x0402('0x52')][_0x0402('0x53')]){_0x348978[_0x0402('0x50')][_0x0402('0x54')]=_0x348978[_0x0402('0x52')][_0x0402('0x53')];}return db[_0x0402('0x47')][_0x0402('0x4e')]({'where':{'id':_0x348978[_0x0402('0x55')]['id']}})[_0x0402('0x2f')](handleEntityNotFound(_0x4c5f82,null))[_0x0402('0x2f')](saveUpdates(_0x348978[_0x0402('0x50')],null))['then'](respondWithResult(_0x4c5f82,null))['catch'](handleError(_0x4c5f82,null));};exports[_0x0402('0x56')]=function(_0x5cc3ac,_0x330c2e,_0x554feb){if(_0x5cc3ac[_0x0402('0x52')]&&_0x5cc3ac[_0x0402('0x52')]['filename']){_0x5cc3ac[_0x0402('0x50')]['loginLogo']=_0x5cc3ac[_0x0402('0x52')]['filename'];}return db['Setting'][_0x0402('0x4e')]({'where':{'id':_0x5cc3ac['params']['id']}})[_0x0402('0x2f')](handleEntityNotFound(_0x330c2e,null))['then'](saveUpdates(_0x5cc3ac[_0x0402('0x50')],null))[_0x0402('0x2f')](respondWithResult(_0x330c2e,null))[_0x0402('0x4f')](handleError(_0x330c2e,null));};var utilLicense=require(_0x0402('0x15'));exports[_0x0402('0x57')]=function(_0x29379a,_0x5d77ec,_0x3b4415){var _0x20fc14=_0x0402('0x58');var _0x1a68b9={'custom':![]};return utilLicense['getLicense']()['then'](function(_0xd0d0c8){if(_0xd0d0c8){_0x1a68b9=_0xd0d0c8;}return db[_0x0402('0x47')]['find']({'where':{'id':_0x29379a['params']['id']},'attributes':[_0x0402('0x54'),_0x0402('0x59'),_0x0402('0x5a'),_0x0402('0x5b'),_0x0402('0x5c'),_0x0402('0x5d'),_0x0402('0x5e'),_0x0402('0x5f')],'raw':!![]});})['then'](handleEntityNotFound(_0x5d77ec,null))[_0x0402('0x2f')](function(_0x1a83b2){if(_0x1a83b2){var _0x433ddb=_0x1a83b2[_0x0402('0x54')]&&fs[_0x0402('0x60')](path[_0x0402('0x61')](config[_0x0402('0x62')],_0x20fc14,_['toLower'](_0x1a83b2[_0x0402('0x54')])))?path[_0x0402('0x61')](config[_0x0402('0x62')],_0x20fc14,_[_0x0402('0x63')](_0x1a83b2['logo'])):path['join'](config[_0x0402('0x62')],_0x20fc14,_[_0x0402('0x63')]('default_logo.svg'));var _0x3be8a5='default'+_[_0x0402('0x64')](_0x0402('0x54'));if(_0x1a83b2[_0x3be8a5]||!_0x1a68b9[_0x0402('0x65')]){_0x433ddb=path[_0x0402('0x61')](config[_0x0402('0x62')],_0x20fc14,_[_0x0402('0x63')]('default_logo.svg'));}if(!fs[_0x0402('0x60')](_0x433ddb)){throw new db[(_0x0402('0x66'))][(_0x0402('0x67'))](_['upperFirst'](_0x0402('0x54'))+_0x0402('0x68'));}return _0x5d77ec['download'](_0x433ddb);}})[_0x0402('0x4f')](handleError(_0x5d77ec,null));};var utilLicense=require(_0x0402('0x15'));exports[_0x0402('0x69')]=function(_0x5c4faa,_0xc64633,_0x11b6f5){var _0x7252c9='server/files/images/logos';var _0x2d567f={'custom':![]};return utilLicense[_0x0402('0x6a')]()['then'](function(_0x242b99){if(_0x242b99){_0x2d567f=_0x242b99;}return db['Setting'][_0x0402('0x4e')]({'where':{'id':_0x5c4faa[_0x0402('0x55')]['id']},'attributes':[_0x0402('0x54'),_0x0402('0x59'),_0x0402('0x5a'),_0x0402('0x5b'),_0x0402('0x5c'),_0x0402('0x5d'),_0x0402('0x5e'),_0x0402('0x5f')],'raw':!![]});})['then'](handleEntityNotFound(_0xc64633,null))[_0x0402('0x2f')](function(_0x1dcec0){if(_0x1dcec0){var _0x8aa484=_0x1dcec0['loginLogo']&&fs['existsSync'](path[_0x0402('0x61')](config[_0x0402('0x62')],_0x7252c9,_[_0x0402('0x63')](_0x1dcec0[_0x0402('0x59')])))?path[_0x0402('0x61')](config['root'],_0x7252c9,_[_0x0402('0x63')](_0x1dcec0[_0x0402('0x59')])):path['join'](config[_0x0402('0x62')],_0x7252c9,_[_0x0402('0x63')](_0x0402('0x6b')));var _0x292ace='default'+_[_0x0402('0x64')]('loginLogo');if(_0x1dcec0[_0x292ace]||!_0x2d567f[_0x0402('0x65')]){_0x8aa484=path[_0x0402('0x61')](config[_0x0402('0x62')],_0x7252c9,_[_0x0402('0x63')](_0x0402('0x6b')));}if(!fs['existsSync'](_0x8aa484)){throw new db[(_0x0402('0x66'))][(_0x0402('0x67'))](_[_0x0402('0x64')](_0x0402('0x59'))+_0x0402('0x68'));}return _0xc64633[_0x0402('0x6c')](_0x8aa484);}})[_0x0402('0x4f')](handleError(_0xc64633,null));};exports[_0x0402('0x6d')]=function(_0x44e4bd,_0x52e3fb){return db[_0x0402('0x47')][_0x0402('0x4e')]({'where':{'id':_0x44e4bd[_0x0402('0x55')]['id']},'attributes':[_0x0402('0x6e')]})[_0x0402('0x2f')](respondWithResult(_0x52e3fb,null))[_0x0402('0x4f')](handleError(_0x52e3fb,null));};exports[_0x0402('0x6f')]=function(_0x21e87c,_0x24ed10,_0x3ef58a){if(_0x21e87c['file']&&_0x21e87c[_0x0402('0x52')][_0x0402('0x53')]){_0x21e87c[_0x0402('0x50')]['preferred']=_0x21e87c[_0x0402('0x52')][_0x0402('0x53')];}return db[_0x0402('0x47')][_0x0402('0x4e')]({'where':{'id':_0x21e87c[_0x0402('0x55')]['id']}})[_0x0402('0x2f')](handleEntityNotFound(_0x24ed10,null))[_0x0402('0x2f')](saveUpdates(_0x21e87c[_0x0402('0x50')],null))[_0x0402('0x2f')](respondWithResult(_0x24ed10,null))['catch'](handleError(_0x24ed10,null));};var utilLicense=require(_0x0402('0x15'));exports[_0x0402('0x70')]=function(_0x9c75f5,_0xce6f3f,_0x214567){var _0x2f4690=_0x0402('0x58');var _0x410f2e={'custom':![]};return utilLicense[_0x0402('0x6a')]()['then'](function(_0x5e2984){if(_0x5e2984){_0x410f2e=_0x5e2984;}return db[_0x0402('0x47')][_0x0402('0x4e')]({'where':{'id':_0x9c75f5[_0x0402('0x55')]['id']},'attributes':[_0x0402('0x54'),'loginLogo',_0x0402('0x5a'),_0x0402('0x5b'),_0x0402('0x5c'),_0x0402('0x5d'),'defaultPreferred',_0x0402('0x5f')],'raw':!![]});})['then'](handleEntityNotFound(_0xce6f3f,null))[_0x0402('0x2f')](function(_0x49e425){if(_0x49e425){var _0x4902a1=_0x49e425[_0x0402('0x5a')]&&fs[_0x0402('0x60')](path[_0x0402('0x61')](config[_0x0402('0x62')],_0x2f4690,_['toLower'](_0x49e425['preferred'])))?path[_0x0402('0x61')](config[_0x0402('0x62')],_0x2f4690,_['toLower'](_0x49e425['preferred'])):path[_0x0402('0x61')](config[_0x0402('0x62')],_0x2f4690,_[_0x0402('0x63')](_0x0402('0x71')));var _0x59145f=_0x0402('0x72')+_[_0x0402('0x64')](_0x0402('0x5a'));if(_0x49e425[_0x59145f]||!_0x410f2e[_0x0402('0x65')]||!_0x410f2e[_0x0402('0x5a')]){_0x4902a1=path[_0x0402('0x61')](config[_0x0402('0x62')],_0x2f4690,_['toLower']('default_preferred.png'));}if(!fs[_0x0402('0x60')](_0x4902a1)){throw new db['Sequelize'][(_0x0402('0x67'))](_[_0x0402('0x64')](_0x0402('0x5a'))+_0x0402('0x68'));}return _0xce6f3f[_0x0402('0x6c')](_0x4902a1);}})['catch'](handleError(_0xce6f3f,null));};exports[_0x0402('0x73')]=function(_0xeaa965,_0x2d2461,_0x4a135b){if(_0xeaa965[_0x0402('0x52')]&&_0xeaa965[_0x0402('0x52')][_0x0402('0x53')]){_0xeaa965[_0x0402('0x50')][_0x0402('0x5b')]=_0xeaa965['file'][_0x0402('0x53')];}return db[_0x0402('0x47')][_0x0402('0x4e')]({'where':{'id':_0xeaa965[_0x0402('0x55')]['id']}})[_0x0402('0x2f')](handleEntityNotFound(_0x2d2461,null))[_0x0402('0x2f')](saveUpdates(_0xeaa965['body'],null))[_0x0402('0x2f')](respondWithResult(_0x2d2461,null))[_0x0402('0x4f')](handleError(_0x2d2461,null));};var utilLicense=require(_0x0402('0x15'));exports['getFavicon']=function(_0x8dae95,_0x5a0b3c,_0x3dca98){var _0x414fc0=_0x0402('0x58');var _0x17bbf3={'custom':![]};return utilLicense['getLicense']()[_0x0402('0x2f')](function(_0x3053d3){if(_0x3053d3){_0x17bbf3=_0x3053d3;}return db['Setting'][_0x0402('0x4e')]({'where':{'id':_0x8dae95[_0x0402('0x55')]['id']},'attributes':['logo',_0x0402('0x59'),_0x0402('0x5a'),_0x0402('0x5b'),'defaultLogo',_0x0402('0x5d'),_0x0402('0x5e'),_0x0402('0x5f')],'raw':!![]});})['then'](handleEntityNotFound(_0x5a0b3c,null))[_0x0402('0x2f')](function(_0x193060){if(_0x193060){var _0x3c812f=_0x193060[_0x0402('0x5b')]&&fs[_0x0402('0x60')](path[_0x0402('0x61')](config[_0x0402('0x62')],_0x414fc0,_[_0x0402('0x63')](_0x193060[_0x0402('0x5b')])))?path[_0x0402('0x61')](config['root'],_0x414fc0,_[_0x0402('0x63')](_0x193060[_0x0402('0x5b')])):path[_0x0402('0x61')](config[_0x0402('0x62')],_0x414fc0,_[_0x0402('0x63')]('default_favicon.ico'));var _0x4b4653='default'+_[_0x0402('0x64')](_0x0402('0x5b'));if(_0x193060[_0x4b4653]||!_0x17bbf3[_0x0402('0x65')]){_0x3c812f=path[_0x0402('0x61')](config[_0x0402('0x62')],_0x414fc0,_[_0x0402('0x63')]('default_favicon.ico'));}if(!fs[_0x0402('0x60')](_0x3c812f)){throw new db['Sequelize'][(_0x0402('0x67'))](_[_0x0402('0x64')](_0x0402('0x5b'))+'\x20not\x20found');}return _0x5a0b3c[_0x0402('0x6c')](_0x3c812f);}})[_0x0402('0x4f')](handleError(_0x5a0b3c,null));};exports[_0x0402('0x74')]=function(_0x255353,_0x3528d7){var _0x21431a={'offset':moment()[_0x0402('0x75')]()};_0x21431a[_0x0402('0x76')]=moment()[_0x0402('0x75')](_0x21431a[_0x0402('0x25')])[_0x0402('0x77')](_0x0402('0x78'));return _0x3528d7[_0x0402('0x22')](0xc8)[_0x0402('0x32')](_0x21431a);}; \ No newline at end of file +var _0x59e5=['error','code','message','result','catch','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','merge','Setting','includeAll','include','rows','show','params','rawAttributes','options','body','find','addLogo','file','filename','logo','loginLogo','getLogo','server/files/images/logos','getLicense','preferred','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','join','root','toLower','default_logo.svg','default','upperFirst','custom','existsSync','Sequelize','getLogoLogin','favicon','default_loginLogo.svg','ValidationError','download','gdpr','../../config/license/util','getPreferred','default_preferred.png','\x20not\x20found','addFavicon','default_favicon.ico','getDate','utcOffset','now','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','jayson/promise','client','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s'];(function(_0x56ca6b,_0x1339dc){var _0x35634d=function(_0x15bc95){while(--_0x15bc95){_0x56ca6b['push'](_0x56ca6b['shift']());}};_0x35634d(++_0x1339dc);}(_0x59e5,0x14d));var _0x559e=function(_0x25f12c,_0x4bb260){_0x25f12c=_0x25f12c-0x0;var _0xcf430f=_0x59e5[_0x25f12c];return _0xcf430f;};'use strict';var emlformat=require(_0x559e('0x0'));var rimraf=require(_0x559e('0x1'));var zipdir=require(_0x559e('0x2'));var jsonpatch=require(_0x559e('0x3'));var rp=require(_0x559e('0x4'));var moment=require('moment');var BPromise=require(_0x559e('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x559e('0x6'));var sox=require(_0x559e('0x7'));var csv=require('to-csv');var ejs=require(_0x559e('0x8'));var fs=require('fs');var fs_extra=require(_0x559e('0x9'));var _=require(_0x559e('0xa'));var squel=require(_0x559e('0xb'));var crypto=require(_0x559e('0xc'));var jsforce=require(_0x559e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x559e('0xe'));var querystring=require(_0x559e('0xf'));var Papa=require(_0x559e('0x10'));var Redis=require(_0x559e('0x11'));var authService=require(_0x559e('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x559e('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x559e('0x14'))('api');var utils=require(_0x559e('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x559e('0x16'))['db'];var jayson=require(_0x559e('0x17'));var client=jayson[_0x559e('0x18')][_0x559e('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x3eae8d,_0x180215,_0x337216,_0x4fc005){return new BPromise(function(_0x1dded5,_0x122453){var _0x3878e1=_0x4fc005||client;return _0x3878e1[_0x559e('0x1a')](_0x3eae8d,_0x337216)[_0x559e('0x1b')](function(_0x547dec){logger[_0x559e('0x1c')](_0x559e('0x1d'),_0x180215,_0x559e('0x1e'));logger[_0x559e('0x1f')](_0x559e('0x20'),_0x180215,_0x559e('0x1e'),JSON['stringify'](_0x547dec));if(_0x547dec[_0x559e('0x21')]){if(_0x547dec[_0x559e('0x21')][_0x559e('0x22')]===0x1f4){logger['error'](_0x559e('0x1d'),_0x180215,_0x547dec[_0x559e('0x21')][_0x559e('0x23')]);return _0x122453(_0x547dec['error'][_0x559e('0x23')]);}logger['error'](_0x559e('0x1d'),_0x180215,_0x547dec[_0x559e('0x21')][_0x559e('0x23')]);return _0x1dded5(_0x547dec[_0x559e('0x21')]['message']);}else{logger['info'](_0x559e('0x1d'),_0x180215,_0x559e('0x1e'));_0x1dded5(_0x547dec[_0x559e('0x24')][_0x559e('0x23')]);}})[_0x559e('0x25')](function(_0x4d7762){logger[_0x559e('0x21')](_0x559e('0x1d'),_0x180215,_0x4d7762);_0x122453(_0x4d7762);});});}function respondWithStatusCode(_0x3aeb59,_0x6a2f89){_0x6a2f89=_0x6a2f89||0xcc;return function(_0x154e7a){if(_0x154e7a){return _0x3aeb59[_0x559e('0x26')](_0x6a2f89);}return _0x3aeb59['status'](_0x6a2f89)[_0x559e('0x27')]();};}function respondWithResult(_0x3c7814,_0x5c1f63){_0x5c1f63=_0x5c1f63||0xc8;return function(_0x3964af){if(_0x3964af){return _0x3c7814[_0x559e('0x28')](_0x5c1f63)[_0x559e('0x29')](_0x3964af);}};}function respondWithFilteredResult(_0x1faf55,_0x4d74db){return function(_0x50bae0){if(_0x50bae0){var _0x2c69ef=typeof _0x4d74db['offset']===_0x559e('0x2a')&&typeof _0x4d74db[_0x559e('0x2b')]===_0x559e('0x2a');var _0x242d27=_0x50bae0[_0x559e('0x2c')];var _0x41a284=_0x2c69ef?0x0:_0x4d74db[_0x559e('0x2d')];var _0x61e1a2=_0x2c69ef?_0x50bae0['count']:_0x4d74db[_0x559e('0x2d')]+_0x4d74db[_0x559e('0x2b')];var _0x3910a0;if(_0x61e1a2>=_0x242d27){_0x61e1a2=_0x242d27;_0x3910a0=0xc8;}else{_0x3910a0=0xce;}_0x1faf55[_0x559e('0x28')](_0x3910a0);return _0x1faf55[_0x559e('0x2e')](_0x559e('0x2f'),_0x41a284+'-'+_0x61e1a2+'/'+_0x242d27)[_0x559e('0x29')](_0x50bae0);}return null;};}function patchUpdates(_0x5ec168){return function(_0x1e50ee){try{jsonpatch[_0x559e('0x30')](_0x1e50ee,_0x5ec168,!![]);}catch(_0x33a469){return BPromise[_0x559e('0x31')](_0x33a469);}return _0x1e50ee[_0x559e('0x32')]();};}function saveUpdates(_0x343c40,_0x4a5745){return function(_0x564400){if(_0x564400){return _0x564400[_0x559e('0x33')](_0x343c40)[_0x559e('0x1b')](function(_0x3497e7){return _0x3497e7;});}return null;};}function removeEntity(_0x2e7ead,_0x219f00){return function(_0x3e2d4a){if(_0x3e2d4a){return _0x3e2d4a[_0x559e('0x34')]()['then'](function(){_0x2e7ead['status'](0xcc)[_0x559e('0x27')]();});}};}function handleEntityNotFound(_0x4f69f8,_0x39143){return function(_0x133f89){if(!_0x133f89){_0x4f69f8[_0x559e('0x26')](0x194);}return _0x133f89;};}function handleError(_0x33a959,_0x671583){_0x671583=_0x671583||0x1f4;return function(_0x543d23){logger[_0x559e('0x21')](_0x543d23[_0x559e('0x35')]);if(_0x543d23[_0x559e('0x36')]){delete _0x543d23[_0x559e('0x36')];}_0x33a959[_0x559e('0x28')](_0x671583)[_0x559e('0x37')](_0x543d23);};}exports[_0x559e('0x38')]=function(_0x1c9c04,_0x1b4538){var _0x24c8a8={},_0x29765b={},_0x2eb92e={'count':0x0,'rows':[]};var _0x4c932d=_[_0x559e('0x39')](db['Setting']['rawAttributes'],function(_0x271c70){return{'name':_0x271c70[_0x559e('0x3a')],'type':_0x271c70[_0x559e('0x3b')][_0x559e('0x3c')]};});_0x29765b[_0x559e('0x3d')]=_[_0x559e('0x39')](_0x4c932d,_0x559e('0x36'));_0x29765b[_0x559e('0x3e')]=_[_0x559e('0x3f')](_0x1c9c04[_0x559e('0x3e')]);_0x29765b[_0x559e('0x40')]=_['intersection'](_0x29765b['model'],_0x29765b[_0x559e('0x3e')]);_0x24c8a8[_0x559e('0x41')]=_[_0x559e('0x42')](_0x29765b[_0x559e('0x3d')],qs[_0x559e('0x43')](_0x1c9c04[_0x559e('0x3e')][_0x559e('0x43')]));_0x24c8a8[_0x559e('0x41')]=_0x24c8a8['attributes'][_0x559e('0x44')]?_0x24c8a8[_0x559e('0x41')]:_0x29765b[_0x559e('0x3d')];if(!_0x1c9c04[_0x559e('0x3e')][_0x559e('0x45')]('nolimit')){_0x24c8a8[_0x559e('0x2b')]=qs[_0x559e('0x2b')](_0x1c9c04['query'][_0x559e('0x2b')]);_0x24c8a8[_0x559e('0x2d')]=qs['offset'](_0x1c9c04[_0x559e('0x3e')][_0x559e('0x2d')]);}_0x24c8a8[_0x559e('0x46')]=qs[_0x559e('0x47')](_0x1c9c04[_0x559e('0x3e')][_0x559e('0x47')]);_0x24c8a8[_0x559e('0x48')]=qs[_0x559e('0x40')](_[_0x559e('0x49')](_0x1c9c04[_0x559e('0x3e')],_0x29765b[_0x559e('0x40')]),_0x4c932d);if(_0x1c9c04[_0x559e('0x3e')]['filter']){_0x24c8a8[_0x559e('0x48')]=_[_0x559e('0x4a')](_0x24c8a8[_0x559e('0x48')],{'$or':_[_0x559e('0x39')](_0x4c932d,function(_0x16ff48){if(_0x16ff48[_0x559e('0x3b')]!=='VIRTUAL'){var _0x15683c={};_0x15683c[_0x16ff48['name']]={'$like':'%'+_0x1c9c04['query']['filter']+'%'};return _0x15683c;}})});}_0x24c8a8=_[_0x559e('0x4a')]({},_0x24c8a8,_0x1c9c04['options']);var _0x351950={'where':_0x24c8a8['where']};return db[_0x559e('0x4b')][_0x559e('0x2c')](_0x351950)[_0x559e('0x1b')](function(_0x25a55e){_0x2eb92e[_0x559e('0x2c')]=_0x25a55e;if(_0x1c9c04[_0x559e('0x3e')][_0x559e('0x4c')]){_0x24c8a8[_0x559e('0x4d')]=[{'all':!![]}];}return db['Setting']['findAll'](_0x24c8a8);})[_0x559e('0x1b')](function(_0x873109){_0x2eb92e[_0x559e('0x4e')]=_0x873109;return _0x2eb92e;})[_0x559e('0x1b')](respondWithFilteredResult(_0x1b4538,_0x24c8a8))[_0x559e('0x25')](handleError(_0x1b4538,null));};exports[_0x559e('0x4f')]=function(_0x8e7413,_0x486a58){var _0x2621fc={'raw':![],'where':{'id':_0x8e7413[_0x559e('0x50')]['id']}},_0x1f9c20={};_0x1f9c20['model']=_[_0x559e('0x3f')](db[_0x559e('0x4b')][_0x559e('0x51')]);_0x1f9c20[_0x559e('0x3e')]=_[_0x559e('0x3f')](_0x8e7413[_0x559e('0x3e')]);_0x1f9c20[_0x559e('0x40')]=_[_0x559e('0x42')](_0x1f9c20[_0x559e('0x3d')],_0x1f9c20[_0x559e('0x3e')]);_0x2621fc[_0x559e('0x41')]=_['intersection'](_0x1f9c20[_0x559e('0x3d')],qs[_0x559e('0x43')](_0x8e7413['query'][_0x559e('0x43')]));_0x2621fc[_0x559e('0x41')]=_0x2621fc[_0x559e('0x41')][_0x559e('0x44')]?_0x2621fc[_0x559e('0x41')]:_0x1f9c20[_0x559e('0x3d')];if(_0x8e7413[_0x559e('0x3e')]['includeAll']){_0x2621fc[_0x559e('0x4d')]=[{'all':!![]}];}_0x2621fc=_[_0x559e('0x4a')]({},_0x2621fc,_0x8e7413[_0x559e('0x52')]);return db[_0x559e('0x4b')]['find'](_0x2621fc)['then'](handleEntityNotFound(_0x486a58,null))[_0x559e('0x1b')](respondWithResult(_0x486a58,null))[_0x559e('0x25')](handleError(_0x486a58,null));};exports['update']=function(_0x838c90,_0x3f1f06){if(_0x838c90[_0x559e('0x53')]['id']){delete _0x838c90[_0x559e('0x53')]['id'];}return db['Setting'][_0x559e('0x54')]({'where':{'id':_0x838c90[_0x559e('0x50')]['id']}})[_0x559e('0x1b')](handleEntityNotFound(_0x3f1f06,null))[_0x559e('0x1b')](saveUpdates(_0x838c90[_0x559e('0x53')],null))[_0x559e('0x1b')](respondWithResult(_0x3f1f06,null))[_0x559e('0x25')](handleError(_0x3f1f06,null));};exports[_0x559e('0x55')]=function(_0x587452,_0x33d0d3,_0x2b98e0){if(_0x587452[_0x559e('0x56')]&&_0x587452['file'][_0x559e('0x57')]){_0x587452[_0x559e('0x53')][_0x559e('0x58')]=_0x587452[_0x559e('0x56')][_0x559e('0x57')];}return db[_0x559e('0x4b')][_0x559e('0x54')]({'where':{'id':_0x587452[_0x559e('0x50')]['id']}})[_0x559e('0x1b')](handleEntityNotFound(_0x33d0d3,null))[_0x559e('0x1b')](saveUpdates(_0x587452[_0x559e('0x53')],null))[_0x559e('0x1b')](respondWithResult(_0x33d0d3,null))[_0x559e('0x25')](handleError(_0x33d0d3,null));};exports['addLogoLogin']=function(_0x409b37,_0x379a0d,_0x2ece31){if(_0x409b37['file']&&_0x409b37[_0x559e('0x56')]['filename']){_0x409b37[_0x559e('0x53')][_0x559e('0x59')]=_0x409b37['file'][_0x559e('0x57')];}return db[_0x559e('0x4b')]['find']({'where':{'id':_0x409b37[_0x559e('0x50')]['id']}})['then'](handleEntityNotFound(_0x379a0d,null))[_0x559e('0x1b')](saveUpdates(_0x409b37['body'],null))[_0x559e('0x1b')](respondWithResult(_0x379a0d,null))[_0x559e('0x25')](handleError(_0x379a0d,null));};var utilLicense=require('../../config/license/util');exports[_0x559e('0x5a')]=function(_0x31583c,_0x4b77e7,_0xf05be3){var _0x3048ae=_0x559e('0x5b');var _0x57f0cc={'custom':![]};return utilLicense[_0x559e('0x5c')]()[_0x559e('0x1b')](function(_0x4fa794){if(_0x4fa794){_0x57f0cc=_0x4fa794;}return db['Setting']['find']({'where':{'id':_0x31583c[_0x559e('0x50')]['id']},'attributes':[_0x559e('0x58'),'loginLogo',_0x559e('0x5d'),'favicon',_0x559e('0x5e'),_0x559e('0x5f'),_0x559e('0x60'),_0x559e('0x61')],'raw':!![]});})[_0x559e('0x1b')](handleEntityNotFound(_0x4b77e7,null))[_0x559e('0x1b')](function(_0x3cc3a9){if(_0x3cc3a9){var _0x16c59f=_0x3cc3a9['logo']&&fs['existsSync'](path[_0x559e('0x62')](config[_0x559e('0x63')],_0x3048ae,_[_0x559e('0x64')](_0x3cc3a9[_0x559e('0x58')])))?path['join'](config[_0x559e('0x63')],_0x3048ae,_[_0x559e('0x64')](_0x3cc3a9[_0x559e('0x58')])):path['join'](config[_0x559e('0x63')],_0x3048ae,_[_0x559e('0x64')](_0x559e('0x65')));var _0x36f19=_0x559e('0x66')+_[_0x559e('0x67')](_0x559e('0x58'));if(_0x3cc3a9[_0x36f19]||!_0x57f0cc[_0x559e('0x68')]){_0x16c59f=path[_0x559e('0x62')](config['root'],_0x3048ae,_['toLower'](_0x559e('0x65')));}if(!fs[_0x559e('0x69')](_0x16c59f)){throw new db[(_0x559e('0x6a'))]['ValidationError'](_[_0x559e('0x67')](_0x559e('0x58'))+'\x20not\x20found');}return _0x4b77e7['download'](_0x16c59f);}})[_0x559e('0x25')](handleError(_0x4b77e7,null));};var utilLicense=require('../../config/license/util');exports[_0x559e('0x6b')]=function(_0x4ea26b,_0x4e88cf,_0x423507){var _0x2bbc87='server/files/images/logos';var _0xdae88b={'custom':![]};return utilLicense[_0x559e('0x5c')]()[_0x559e('0x1b')](function(_0x58679b){if(_0x58679b){_0xdae88b=_0x58679b;}return db[_0x559e('0x4b')][_0x559e('0x54')]({'where':{'id':_0x4ea26b[_0x559e('0x50')]['id']},'attributes':[_0x559e('0x58'),_0x559e('0x59'),'preferred',_0x559e('0x6c'),_0x559e('0x5e'),_0x559e('0x5f'),_0x559e('0x60'),_0x559e('0x61')],'raw':!![]});})[_0x559e('0x1b')](handleEntityNotFound(_0x4e88cf,null))[_0x559e('0x1b')](function(_0x3af82e){if(_0x3af82e){var _0x481cf0=_0x3af82e[_0x559e('0x59')]&&fs[_0x559e('0x69')](path['join'](config['root'],_0x2bbc87,_[_0x559e('0x64')](_0x3af82e[_0x559e('0x59')])))?path['join'](config[_0x559e('0x63')],_0x2bbc87,_[_0x559e('0x64')](_0x3af82e[_0x559e('0x59')])):path['join'](config[_0x559e('0x63')],_0x2bbc87,_[_0x559e('0x64')](_0x559e('0x6d')));var _0x2021e9='default'+_[_0x559e('0x67')]('loginLogo');if(_0x3af82e[_0x2021e9]||!_0xdae88b['custom']){_0x481cf0=path[_0x559e('0x62')](config[_0x559e('0x63')],_0x2bbc87,_[_0x559e('0x64')](_0x559e('0x6d')));}if(!fs[_0x559e('0x69')](_0x481cf0)){throw new db[(_0x559e('0x6a'))][(_0x559e('0x6e'))](_[_0x559e('0x67')]('loginLogo')+'\x20not\x20found');}return _0x4e88cf[_0x559e('0x6f')](_0x481cf0);}})['catch'](handleError(_0x4e88cf,null));};exports[_0x559e('0x70')]=function(_0x53219a,_0x2768d2){return db['Setting'][_0x559e('0x54')]({'where':{'id':_0x53219a[_0x559e('0x50')]['id']},'attributes':['securePassword']})[_0x559e('0x1b')](respondWithResult(_0x2768d2,null))['catch'](handleError(_0x2768d2,null));};exports['addPreferred']=function(_0x29065c,_0x24e0fb,_0x3f64f1){if(_0x29065c['file']&&_0x29065c['file'][_0x559e('0x57')]){_0x29065c[_0x559e('0x53')][_0x559e('0x5d')]=_0x29065c['file'][_0x559e('0x57')];}return db['Setting'][_0x559e('0x54')]({'where':{'id':_0x29065c[_0x559e('0x50')]['id']}})[_0x559e('0x1b')](handleEntityNotFound(_0x24e0fb,null))[_0x559e('0x1b')](saveUpdates(_0x29065c[_0x559e('0x53')],null))['then'](respondWithResult(_0x24e0fb,null))[_0x559e('0x25')](handleError(_0x24e0fb,null));};var utilLicense=require(_0x559e('0x71'));exports[_0x559e('0x72')]=function(_0x4ae242,_0x5f36f2,_0x2f8e08){var _0x3e9ec9=_0x559e('0x5b');var _0x160596={'custom':![]};return utilLicense[_0x559e('0x5c')]()['then'](function(_0x1a2a91){if(_0x1a2a91){_0x160596=_0x1a2a91;}return db[_0x559e('0x4b')][_0x559e('0x54')]({'where':{'id':_0x4ae242[_0x559e('0x50')]['id']},'attributes':[_0x559e('0x58'),_0x559e('0x59'),_0x559e('0x5d'),'favicon',_0x559e('0x5e'),_0x559e('0x5f'),_0x559e('0x60'),_0x559e('0x61')],'raw':!![]});})[_0x559e('0x1b')](handleEntityNotFound(_0x5f36f2,null))[_0x559e('0x1b')](function(_0x338d06){if(_0x338d06){var _0x3391e8=_0x338d06['preferred']&&fs['existsSync'](path[_0x559e('0x62')](config[_0x559e('0x63')],_0x3e9ec9,_[_0x559e('0x64')](_0x338d06[_0x559e('0x5d')])))?path[_0x559e('0x62')](config[_0x559e('0x63')],_0x3e9ec9,_[_0x559e('0x64')](_0x338d06[_0x559e('0x5d')])):path[_0x559e('0x62')](config[_0x559e('0x63')],_0x3e9ec9,_[_0x559e('0x64')](_0x559e('0x73')));var _0x41711c=_0x559e('0x66')+_[_0x559e('0x67')](_0x559e('0x5d'));if(_0x338d06[_0x41711c]||!_0x160596[_0x559e('0x68')]||!_0x160596[_0x559e('0x5d')]){_0x3391e8=path['join'](config[_0x559e('0x63')],_0x3e9ec9,_[_0x559e('0x64')](_0x559e('0x73')));}if(!fs[_0x559e('0x69')](_0x3391e8)){throw new db[(_0x559e('0x6a'))][(_0x559e('0x6e'))](_[_0x559e('0x67')]('preferred')+_0x559e('0x74'));}return _0x5f36f2[_0x559e('0x6f')](_0x3391e8);}})[_0x559e('0x25')](handleError(_0x5f36f2,null));};exports[_0x559e('0x75')]=function(_0x3990b6,_0xd0d602,_0x175f30){if(_0x3990b6[_0x559e('0x56')]&&_0x3990b6['file'][_0x559e('0x57')]){_0x3990b6[_0x559e('0x53')]['favicon']=_0x3990b6['file'][_0x559e('0x57')];}return db[_0x559e('0x4b')][_0x559e('0x54')]({'where':{'id':_0x3990b6[_0x559e('0x50')]['id']}})['then'](handleEntityNotFound(_0xd0d602,null))[_0x559e('0x1b')](saveUpdates(_0x3990b6[_0x559e('0x53')],null))[_0x559e('0x1b')](respondWithResult(_0xd0d602,null))[_0x559e('0x25')](handleError(_0xd0d602,null));};var utilLicense=require(_0x559e('0x71'));exports['getFavicon']=function(_0x266245,_0x57775f,_0x9d1d33){var _0x2e5b7b=_0x559e('0x5b');var _0x4510f4={'custom':![]};return utilLicense[_0x559e('0x5c')]()['then'](function(_0xc43d37){if(_0xc43d37){_0x4510f4=_0xc43d37;}return db[_0x559e('0x4b')]['find']({'where':{'id':_0x266245[_0x559e('0x50')]['id']},'attributes':['logo',_0x559e('0x59'),'preferred',_0x559e('0x6c'),_0x559e('0x5e'),_0x559e('0x5f'),_0x559e('0x60'),'defaultFavicon'],'raw':!![]});})[_0x559e('0x1b')](handleEntityNotFound(_0x57775f,null))[_0x559e('0x1b')](function(_0x2bb8a4){if(_0x2bb8a4){var _0x2afcd9=_0x2bb8a4[_0x559e('0x6c')]&&fs[_0x559e('0x69')](path[_0x559e('0x62')](config[_0x559e('0x63')],_0x2e5b7b,_[_0x559e('0x64')](_0x2bb8a4[_0x559e('0x6c')])))?path[_0x559e('0x62')](config[_0x559e('0x63')],_0x2e5b7b,_[_0x559e('0x64')](_0x2bb8a4[_0x559e('0x6c')])):path[_0x559e('0x62')](config[_0x559e('0x63')],_0x2e5b7b,_[_0x559e('0x64')](_0x559e('0x76')));var _0x1f6c4d=_0x559e('0x66')+_[_0x559e('0x67')](_0x559e('0x6c'));if(_0x2bb8a4[_0x1f6c4d]||!_0x4510f4[_0x559e('0x68')]){_0x2afcd9=path[_0x559e('0x62')](config[_0x559e('0x63')],_0x2e5b7b,_[_0x559e('0x64')]('default_favicon.ico'));}if(!fs['existsSync'](_0x2afcd9)){throw new db[(_0x559e('0x6a'))]['ValidationError'](_[_0x559e('0x67')](_0x559e('0x6c'))+'\x20not\x20found');}return _0x57775f[_0x559e('0x6f')](_0x2afcd9);}})[_0x559e('0x25')](handleError(_0x57775f,null));};exports[_0x559e('0x77')]=function(_0xd569e6,_0x18a834){var _0x1d2eae={'offset':moment()[_0x559e('0x78')]()};_0x1d2eae[_0x559e('0x79')]=moment()['utcOffset'](_0x1d2eae[_0x559e('0x2d')])['format']('YYYY-MM-DD\x20HH:mm:ss:SSS');return _0x18a834[_0x559e('0x28')](0xc8)[_0x559e('0x37')](_0x1d2eae);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 2129921..9dc6eed 100644 --- a/server/api/setting/setting.model.js +++ b/server/api/setting/setting.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['exports','Setting','settings','lodash','../../config/logger','api','moment','path','../../config/environment','./setting.attributes'];(function(_0x118afa,_0x4bf0c1){var _0x167d76=function(_0x2c529b){while(--_0x2c529b){_0x118afa['push'](_0x118afa['shift']());}};_0x167d76(++_0x4bf0c1);}(_0x3e74,0x175));var _0x43e7=function(_0x6f6db7,_0xd14453){_0x6f6db7=_0x6f6db7-0x0;var _0x4f598a=_0x3e74[_0x6f6db7];return _0x4f598a;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var logger=require(_0x43e7('0x1'))(_0x43e7('0x2'));var moment=require(_0x43e7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x43e7('0x4'));var rimraf=require('rimraf');var config=require(_0x43e7('0x5'));var attributes=require(_0x43e7('0x6'));module[_0x43e7('0x7')]=function(_0x1c503b,_0xc98b9c){return _0x1c503b['define'](_0x43e7('0x8'),attributes,{'tableName':_0x43e7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9957=['exports','define','Setting','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./setting.attributes'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'settings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index fd8eead..d37f4b3 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 _0x2863=['Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSetting','find','options','raw','attributes','include','map','model','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3df238,_0x2e1000){var _0x356824=function(_0x359d1e){while(--_0x359d1e){_0x3df238['push'](_0x3df238['shift']());}};_0x356824(++_0x2e1000);}(_0x2863,0xcf));var _0x3286=function(_0x381f3d,_0x3730e0){_0x381f3d=_0x381f3d-0x0;var _0x1b7eed=_0x2863[_0x381f3d];return _0x1b7eed;};'use strict';var _=require('lodash');var util=require(_0x3286('0x0'));var moment=require(_0x3286('0x1'));var BPromise=require(_0x3286('0x2'));var rs=require(_0x3286('0x3'));var fs=require('fs');var Redis=require(_0x3286('0x4'));var db=require(_0x3286('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x3286('0x6'))(_0x3286('0x7'));var config=require(_0x3286('0x8'));var jayson=require(_0x3286('0x9'));var client=jayson[_0x3286('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xfaa969,_0xd3debf,_0x5120f8){return new BPromise(function(_0x1c7bd4,_0x3b2ae2){return client[_0x3286('0xb')](_0xfaa969,_0x5120f8)[_0x3286('0xc')](function(_0x2f05d6){logger[_0x3286('0xd')](_0x3286('0xe'),_0xd3debf,_0x3286('0xf'));logger[_0x3286('0x10')](_0x3286('0x11'),_0xd3debf,'request\x20sent',JSON[_0x3286('0x12')](_0x2f05d6));if(_0x2f05d6['error']){if(_0x2f05d6[_0x3286('0x13')][_0x3286('0x14')]===0x1f4){logger['error'](_0x3286('0xe'),_0xd3debf,_0x2f05d6[_0x3286('0x13')][_0x3286('0x15')]);return _0x3b2ae2(_0x2f05d6['error'][_0x3286('0x15')]);}logger['error']('Setting,\x20%s,\x20%s',_0xd3debf,_0x2f05d6[_0x3286('0x13')][_0x3286('0x15')]);return _0x1c7bd4(_0x2f05d6[_0x3286('0x13')][_0x3286('0x15')]);}else{logger['info'](_0x3286('0xe'),_0xd3debf,'request\x20sent');_0x1c7bd4(_0x2f05d6[_0x3286('0x16')][_0x3286('0x15')]);}})[_0x3286('0x17')](function(_0x2088e8){logger[_0x3286('0x13')](_0x3286('0xe'),_0xd3debf,_0x2088e8);_0x3b2ae2(_0x2088e8);});});}exports[_0x3286('0x18')]=function(_0x3f2075){var _0x496210=this;return new Promise(function(_0x1e3731,_0x42c9dc){return db['Setting'][_0x3286('0x19')]({'raw':_0x3f2075[_0x3286('0x1a')]?_0x3f2075['options'][_0x3286('0x1b')]===undefined?!![]:![]:!![],'where':_0x3f2075[_0x3286('0x1a')]?_0x3f2075[_0x3286('0x1a')]['where']||null:null,'attributes':_0x3f2075['options']?_0x3f2075[_0x3286('0x1a')][_0x3286('0x1c')]||null:null,'include':_0x3f2075[_0x3286('0x1a')]?_0x3f2075[_0x3286('0x1a')][_0x3286('0x1d')]?_[_0x3286('0x1e')](_0x3f2075[_0x3286('0x1a')][_0x3286('0x1d')],function(_0x132556){return{'model':db[_0x132556[_0x3286('0x1f')]],'as':_0x132556['as'],'attributes':_0x132556['attributes'],'include':_0x132556['include']?_[_0x3286('0x1e')](_0x132556[_0x3286('0x1d')],function(_0x2f38ad){return{'model':db[_0x2f38ad[_0x3286('0x1f')]],'as':_0x2f38ad['as'],'attributes':_0x2f38ad[_0x3286('0x1c')],'include':_0x2f38ad['include']?_[_0x3286('0x1e')](_0x2f38ad['include'],function(_0x4d7fb2){return{'model':db[_0x4d7fb2['model']],'as':_0x4d7fb2['as'],'attributes':_0x4d7fb2[_0x3286('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5575f5){logger['info'](_0x3286('0x18'),_0x3f2075);logger[_0x3286('0x10')](_0x3286('0x18'),_0x3f2075,JSON['stringify'](_0x5575f5));_0x1e3731(_0x5575f5);})[_0x3286('0x17')](function(_0x380bea){logger[_0x3286('0x13')](_0x3286('0x18'),_0x380bea[_0x3286('0x15')],_0x3f2075);_0x42c9dc(_0x496210['error'](0x1f4,_0x380bea[_0x3286('0x15')]));});});}; \ No newline at end of file +var _0x2031=['ShowSetting','Setting','options','raw','where','attributes','map','include','model','stringify','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','then','info','Setting,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch'];(function(_0x1cbbfe,_0x4a0eef){var _0x55bf8b=function(_0x4feda5){while(--_0x4feda5){_0x1cbbfe['push'](_0x1cbbfe['shift']());}};_0x55bf8b(++_0x4a0eef);}(_0x2031,0xfa));var _0x1203=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x2031[_0x57b54c];return _0x59cc19;};'use strict';var _=require('lodash');var util=require(_0x1203('0x0'));var moment=require('moment');var BPromise=require(_0x1203('0x1'));var rs=require(_0x1203('0x2'));var fs=require('fs');var Redis=require(_0x1203('0x3'));var db=require(_0x1203('0x4'))['db'];var utils=require(_0x1203('0x5'));var logger=require('../../config/logger')(_0x1203('0x6'));var config=require('../../config/environment');var jayson=require(_0x1203('0x7'));var client=jayson[_0x1203('0x8')][_0x1203('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x325b41,_0x527a35,_0x3ab745){return new BPromise(function(_0x38b96d,_0x42c2ac){return client['request'](_0x325b41,_0x3ab745)[_0x1203('0xa')](function(_0x54067e){logger[_0x1203('0xb')](_0x1203('0xc'),_0x527a35,'request\x20sent');logger[_0x1203('0xd')]('Setting,\x20%s,\x20%s,\x20%s',_0x527a35,_0x1203('0xe'),JSON['stringify'](_0x54067e));if(_0x54067e[_0x1203('0xf')]){if(_0x54067e['error'][_0x1203('0x10')]===0x1f4){logger[_0x1203('0xf')](_0x1203('0xc'),_0x527a35,_0x54067e[_0x1203('0xf')][_0x1203('0x11')]);return _0x42c2ac(_0x54067e[_0x1203('0xf')][_0x1203('0x11')]);}logger[_0x1203('0xf')](_0x1203('0xc'),_0x527a35,_0x54067e[_0x1203('0xf')]['message']);return _0x38b96d(_0x54067e[_0x1203('0xf')]['message']);}else{logger[_0x1203('0xb')](_0x1203('0xc'),_0x527a35,_0x1203('0xe'));_0x38b96d(_0x54067e[_0x1203('0x12')]['message']);}})[_0x1203('0x13')](function(_0x29ace1){logger[_0x1203('0xf')](_0x1203('0xc'),_0x527a35,_0x29ace1);_0x42c2ac(_0x29ace1);});});}exports[_0x1203('0x14')]=function(_0x2c8138){var _0x5051e3=this;return new Promise(function(_0x5c0614,_0x1bc769){return db[_0x1203('0x15')]['find']({'raw':_0x2c8138['options']?_0x2c8138[_0x1203('0x16')][_0x1203('0x17')]===undefined?!![]:![]:!![],'where':_0x2c8138[_0x1203('0x16')]?_0x2c8138['options'][_0x1203('0x18')]||null:null,'attributes':_0x2c8138[_0x1203('0x16')]?_0x2c8138[_0x1203('0x16')][_0x1203('0x19')]||null:null,'include':_0x2c8138[_0x1203('0x16')]?_0x2c8138[_0x1203('0x16')]['include']?_[_0x1203('0x1a')](_0x2c8138['options'][_0x1203('0x1b')],function(_0x31a11c){return{'model':db[_0x31a11c[_0x1203('0x1c')]],'as':_0x31a11c['as'],'attributes':_0x31a11c['attributes'],'include':_0x31a11c['include']?_['map'](_0x31a11c[_0x1203('0x1b')],function(_0x45b724){return{'model':db[_0x45b724[_0x1203('0x1c')]],'as':_0x45b724['as'],'attributes':_0x45b724[_0x1203('0x19')],'include':_0x45b724[_0x1203('0x1b')]?_[_0x1203('0x1a')](_0x45b724[_0x1203('0x1b')],function(_0x24dac3){return{'model':db[_0x24dac3[_0x1203('0x1c')]],'as':_0x24dac3['as'],'attributes':_0x24dac3['attributes']};}):[]};}):[]};}):[]:[]})[_0x1203('0xa')](function(_0x36c222){logger[_0x1203('0xb')](_0x1203('0x14'),_0x2c8138);logger[_0x1203('0xd')](_0x1203('0x14'),_0x2c8138,JSON[_0x1203('0x1d')](_0x36c222));_0x5c0614(_0x36c222);})[_0x1203('0x13')](function(_0x13db03){logger['error'](_0x1203('0x14'),_0x13db03[_0x1203('0x11')],_0x2c8138);_0x1bc769(_0x5051e3['error'](0x1f4,_0x13db03[_0x1203('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index e5369a5..63af134 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 _0xf494=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','isAuthenticated','index','describe','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','getApplications','/:id/interactions','getInteractions','/:id/status','statusGet','getAgents','post','/:id/applications','addApplications','/:id/send','send','/:id/users','put','update','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf494,0x1c6));var _0x4f49=function(_0x455a15,_0xc76064){_0x455a15=_0x455a15-0x0;var _0x82c420=_0xf494[_0x455a15];return _0x82c420;};'use strict';var multer=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var path=require(_0x4f49('0x2'));var timeout=require('connect-timeout');var express=require(_0x4f49('0x3'));var router=express[_0x4f49('0x4')]();var fs_extra=require(_0x4f49('0x5'));var auth=require(_0x4f49('0x6'));var interaction=require(_0x4f49('0x7'));var config=require(_0x4f49('0x8'));var controller=require(_0x4f49('0x9'));router[_0x4f49('0xa')]('/',auth[_0x4f49('0xb')](),controller[_0x4f49('0xc')]);router[_0x4f49('0xa')]('/describe',auth['isAuthenticated'](),controller[_0x4f49('0xd')]);router[_0x4f49('0xa')](_0x4f49('0xe'),auth[_0x4f49('0xb')](),controller[_0x4f49('0xf')]);router[_0x4f49('0xa')](_0x4f49('0x10'),auth[_0x4f49('0xb')](),controller['getDispositions']);router[_0x4f49('0xa')](_0x4f49('0x11'),auth['isAuthenticated'](),controller[_0x4f49('0x12')]);router['get']('/:id/applications',auth[_0x4f49('0xb')](),controller[_0x4f49('0x13')]);router['get'](_0x4f49('0x14'),auth[_0x4f49('0xb')](),controller[_0x4f49('0x15')]);router[_0x4f49('0xa')](_0x4f49('0x16'),controller[_0x4f49('0x17')]);router[_0x4f49('0xa')]('/:id/users',auth[_0x4f49('0xb')](),controller[_0x4f49('0x18')]);router[_0x4f49('0x19')]('/',auth['isAuthenticated'](),controller['create']);router[_0x4f49('0x19')](_0x4f49('0x10'),auth[_0x4f49('0xb')](),controller['addDisposition']);router[_0x4f49('0x19')](_0x4f49('0x11'),auth[_0x4f49('0xb')](),controller['addAnswer']);router['post']('/:id/notify',controller['notify']);router[_0x4f49('0x19')](_0x4f49('0x1a'),auth[_0x4f49('0xb')](),controller[_0x4f49('0x1b')]);router['post'](_0x4f49('0x1c'),auth[_0x4f49('0xb')](),controller[_0x4f49('0x1d')]);router[_0x4f49('0x19')](_0x4f49('0x16'),controller['status']);router[_0x4f49('0x19')](_0x4f49('0x1e'),auth[_0x4f49('0xb')](),controller['addAgents']);router[_0x4f49('0x1f')](_0x4f49('0xe'),auth[_0x4f49('0xb')](),controller[_0x4f49('0x20')]);router[_0x4f49('0x21')](_0x4f49('0xe'),auth['isAuthenticated'](),controller['destroy']);router[_0x4f49('0x21')](_0x4f49('0x10'),auth['isAuthenticated'](),controller[_0x4f49('0x22')]);router[_0x4f49('0x21')](_0x4f49('0x11'),auth['isAuthenticated'](),controller[_0x4f49('0x23')]);router[_0x4f49('0x21')](_0x4f49('0x1e'),auth[_0x4f49('0xb')](),controller[_0x4f49('0x24')]);module[_0x4f49('0x25')]=router; \ No newline at end of file +var _0x326f=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','isAuthenticated','/describe','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','getInteractions','/:id/status','getAgents','post','create','addDisposition','addAnswer','/:id/notify','notify','addApplications','send','status','addAgents','put','update','delete','/:id','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer'];(function(_0x345ac8,_0x2daa49){var _0x552f86=function(_0x2210b8){while(--_0x2210b8){_0x345ac8['push'](_0x345ac8['shift']());}};_0x552f86(++_0x2daa49);}(_0x326f,0xd1));var _0xf326=function(_0xbb39ec,_0x4ad256){_0xbb39ec=_0xbb39ec-0x0;var _0x2722a7=_0x326f[_0xbb39ec];return _0x2722a7;};'use strict';var multer=require(_0xf326('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf326('0x1'));var express=require(_0xf326('0x2'));var router=express[_0xf326('0x3')]();var fs_extra=require(_0xf326('0x4'));var auth=require(_0xf326('0x5'));var interaction=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var controller=require(_0xf326('0x8'));router[_0xf326('0x9')]('/',auth[_0xf326('0xa')](),controller['index']);router[_0xf326('0x9')](_0xf326('0xb'),auth[_0xf326('0xa')](),controller[_0xf326('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xf326('0xd')]);router[_0xf326('0x9')](_0xf326('0xe'),auth[_0xf326('0xa')](),controller[_0xf326('0xf')]);router['get'](_0xf326('0x10'),auth['isAuthenticated'](),controller[_0xf326('0x11')]);router['get'](_0xf326('0x12'),auth['isAuthenticated'](),controller[_0xf326('0x13')]);router[_0xf326('0x9')]('/:id/interactions',auth[_0xf326('0xa')](),controller[_0xf326('0x14')]);router[_0xf326('0x9')](_0xf326('0x15'),controller['statusGet']);router[_0xf326('0x9')]('/:id/users',auth['isAuthenticated'](),controller[_0xf326('0x16')]);router[_0xf326('0x17')]('/',auth[_0xf326('0xa')](),controller[_0xf326('0x18')]);router[_0xf326('0x17')](_0xf326('0xe'),auth[_0xf326('0xa')](),controller[_0xf326('0x19')]);router['post'](_0xf326('0x10'),auth[_0xf326('0xa')](),controller[_0xf326('0x1a')]);router[_0xf326('0x17')](_0xf326('0x1b'),controller[_0xf326('0x1c')]);router['post']('/:id/applications',auth['isAuthenticated'](),controller[_0xf326('0x1d')]);router[_0xf326('0x17')]('/:id/send',auth['isAuthenticated'](),controller[_0xf326('0x1e')]);router['post']('/:id/status',controller[_0xf326('0x1f')]);router[_0xf326('0x17')]('/:id/users',auth['isAuthenticated'](),controller[_0xf326('0x20')]);router[_0xf326('0x21')]('/:id',auth[_0xf326('0xa')](),controller[_0xf326('0x22')]);router[_0xf326('0x23')](_0xf326('0x24'),auth[_0xf326('0xa')](),controller[_0xf326('0x25')]);router['delete']('/:id/dispositions',auth['isAuthenticated'](),controller[_0xf326('0x26')]);router[_0xf326('0x23')](_0xf326('0x10'),auth[_0xf326('0xa')](),controller[_0xf326('0x27')]);router[_0xf326('0x23')]('/:id/users',auth[_0xf326('0xa')](),controller[_0xf326('0x28')]);module[_0xf326('0x29')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 0f30486..b85e3bb 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 _0x4bc0=['connectel','clicksend','plivo','bandwidth','csc','intelepeer','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','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','randomstring','exports','STRING','name','twilio','skebby'];(function(_0x65605f,_0x3c1119){var _0x5f421a=function(_0x365a50){while(--_0x365a50){_0x65605f['push'](_0x65605f['shift']());}};_0x5f421a(++_0x3c1119);}(_0x4bc0,0x1c8));var _0x04bc=function(_0x117343,_0x14a8e0){_0x117343=_0x117343-0x0;var _0x542aa7=_0x4bc0[_0x117343];return _0x542aa7;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x04bc('0x0'));module[_0x04bc('0x1')]={'name':{'type':Sequelize[_0x04bc('0x2')],'unique':_0x04bc('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x04bc('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x04bc('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0x04bc('0x2')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0x04bc('0x2')]},'type':{'type':Sequelize['ENUM'](_0x04bc('0x4'),_0x04bc('0x5'),_0x04bc('0x6'),_0x04bc('0x7'),_0x04bc('0x8'),'clickatell',_0x04bc('0x9'),_0x04bc('0xa'),'infobip',_0x04bc('0xb'))},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x04bc('0x2')]},'smsMethod':{'type':Sequelize[_0x04bc('0xc')]('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize['STRING']},'applicationId':{'type':Sequelize[_0x04bc('0x2')]},'accountId':{'type':Sequelize[_0x04bc('0x2')]},'senderString':{'type':Sequelize[_0x04bc('0x2')]},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x04bc('0xd')],'defaultValue':function(){return _0x04bc('0xe');}},'notificationSound':{'type':Sequelize[_0x04bc('0xf')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x04bc('0xf')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x04bc('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x04bc('0xf')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x04bc('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x04bc('0xf')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x04bc('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x04bc('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x04bc('0x10')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x04bc('0xf')],'defaultValue':![],'comment':_0x04bc('0x11'),'set':function(_0x1b81d6){if(!_0x1b81d6)this[_0x04bc('0x12')](_0x04bc('0x13'),null);this[_0x04bc('0x12')](_0x04bc('0x14'),_0x1b81d6);}}}; \ No newline at end of file +var _0x4236=['twilio','skebby','connectel','clicksend','plivo','clickatell','bandwidth','infobip','intelepeer','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','randomstring','STRING','name','generate','ENUM'];(function(_0x471d07,_0x30eaad){var _0x204c40=function(_0x20d7ed){while(--_0x20d7ed){_0x471d07['push'](_0x471d07['shift']());}};_0x204c40(++_0x30eaad);}(_0x4236,0x6e));var _0x6423=function(_0x2ac4e1,_0x1c3e95){_0x2ac4e1=_0x2ac4e1-0x0;var _0x1891a7=_0x4236[_0x2ac4e1];return _0x1891a7;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x6423('0x0'));module['exports']={'name':{'type':Sequelize[_0x6423('0x1')],'unique':_0x6423('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0x6423('0x1')],'allowNull':![]},'remote':{'type':Sequelize[_0x6423('0x1')],'allowNull':![]},'token':{'type':Sequelize[_0x6423('0x1')],'defaultValue':function(){return rs[_0x6423('0x3')]();}},'phone':{'type':Sequelize[_0x6423('0x1')]},'type':{'type':Sequelize[_0x6423('0x4')](_0x6423('0x5'),_0x6423('0x6'),_0x6423('0x7'),_0x6423('0x8'),_0x6423('0x9'),_0x6423('0xa'),_0x6423('0xb'),'csc',_0x6423('0xc'),_0x6423('0xd'))},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize[_0x6423('0x1')]},'authToken':{'type':Sequelize[_0x6423('0x1')]},'smsMethod':{'type':Sequelize[_0x6423('0x4')]('SI','TI','GP')},'username':{'type':Sequelize[_0x6423('0x1')]},'password':{'type':Sequelize[_0x6423('0x1')]},'apiKey':{'type':Sequelize['STRING']},'applicationId':{'type':Sequelize['STRING']},'accountId':{'type':Sequelize[_0x6423('0x1')]},'senderString':{'type':Sequelize[_0x6423('0x1')]},'deliveryReport':{'type':Sequelize[_0x6423('0xe')],'defaultValue':![]},'description':{'type':Sequelize[_0x6423('0x1')]},'notificationTemplate':{'type':Sequelize[_0x6423('0xf')],'defaultValue':function(){return _0x6423('0x10');}},'notificationSound':{'type':Sequelize[_0x6423('0xe')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x6423('0xe')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x6423('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x6423('0xe')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x6423('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x6423('0x1')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6423('0x11')],'comment':_0x6423('0x12')},'mandatoryDisposition':{'type':Sequelize[_0x6423('0xe')],'defaultValue':![],'comment':_0x6423('0x13'),'set':function(_0x3e1e78){if(!_0x3e1e78)this[_0x6423('0x14')](_0x6423('0x15'),null);this['setDataValue'](_0x6423('0x16'),_0x3e1e78);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 06b76b6..2c8c834 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 _0xa4e3=['defaults','localhost','socket.io-emitter','./smsAccount.socket','jayson/promise','client','http','request','then','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','result','sendStatus','end','json','undefined','offset','count','status','set','reject','save','update','destroy','get','stack','name','send','index','mandatoryDispositionPause','SmsAccount','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','options','rows','show','Pause','rawAttributes','includeAll','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','SmsAccounts','UserProfileSection','userProfileId','UserProfileResource','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','Disposition','findOne','SmsAccountId','findAll','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','SmsApplication','Applications','account','applications','orderBy','priority','asc','CmContact','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','From','messageId','MessageSid','skebby','text','clicksend','message_id','plivo','Text','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','replyMessageId','bandwidth','intelepeer','refid','isNil','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','omit','contact','SmsInteraction','spread','interaction','created','autoclose','push','close','unmanaged','SmsMessage','ContactId','AttachmentId','UserId','User','agent','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','entity\x20found','stringify','Content-Type','text/xml','\x0a','addApplications','sequelize','transaction','READ_COMMITTED','bulkCreate','findAndCountAll','getApplications','pick','getInteractions','Owner','Tags','color','tag','List','out','Messages','dataValues','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','connectel','requestid','statusInt','status_code','infobip','groupName','redif','DELIVERED','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','DELIVRD','ACCEPTD','message-id','state','addAgents','emit','userSmsAccount:save','removeAgents','userSmsAccount:remove','getAgents','rimraf','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/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis'];(function(_0x5a109f,_0x32ff07){var _0x38c441=function(_0x2210b7){while(--_0x2210b7){_0x5a109f['push'](_0x5a109f['shift']());}};_0x38c441(++_0x32ff07);}(_0xa4e3,0x1b5));var _0x3a4e=function(_0x57ac45,_0x4b408e){_0x57ac45=_0x57ac45-0x0;var _0x72340c=_0xa4e3[_0x57ac45];return _0x72340c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3a4e('0x0'));var zipdir=require(_0x3a4e('0x1'));var jsonpatch=require(_0x3a4e('0x2'));var rp=require(_0x3a4e('0x3'));var moment=require(_0x3a4e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3a4e('0x5'));var util=require(_0x3a4e('0x6'));var path=require(_0x3a4e('0x7'));var sox=require(_0x3a4e('0x8'));var csv=require(_0x3a4e('0x9'));var ejs=require(_0x3a4e('0xa'));var fs=require('fs');var fs_extra=require(_0x3a4e('0xb'));var _=require(_0x3a4e('0xc'));var squel=require(_0x3a4e('0xd'));var crypto=require(_0x3a4e('0xe'));var jsforce=require(_0x3a4e('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x3a4e('0x9'));var querystring=require(_0x3a4e('0x10'));var Papa=require(_0x3a4e('0x11'));var Redis=require(_0x3a4e('0x12'));var authService=require(_0x3a4e('0x13'));var qs=require(_0x3a4e('0x14'));var as=require(_0x3a4e('0x15'));var hardwareService=require(_0x3a4e('0x16'));var logger=require('../../config/logger')(_0x3a4e('0x17'));var utils=require(_0x3a4e('0x18'));var config=require(_0x3a4e('0x19'));var licenseUtil=require(_0x3a4e('0x1a'));var db=require(_0x3a4e('0x1b'))['db'];config[_0x3a4e('0x1c')]=_[_0x3a4e('0x1d')](config['redis'],{'host':_0x3a4e('0x1e'),'port':0x18eb});var socket=require(_0x3a4e('0x1f'))(new Redis(config[_0x3a4e('0x1c')]));require(_0x3a4e('0x20'))['register'](socket);var jayson=require(_0x3a4e('0x21'));var client=jayson[_0x3a4e('0x22')][_0x3a4e('0x23')]({'port':0x232c});function respondWithRpcPromise(_0x12b5c6,_0x245133,_0x323b45,_0x209fe3){return new BPromise(function(_0x44d8a7,_0x4fe4ea){var _0x585092=_0x209fe3||client;return _0x585092[_0x3a4e('0x24')](_0x12b5c6,_0x323b45)[_0x3a4e('0x25')](function(_0x7b3d66){logger['info'](_0x3a4e('0x26'),_0x245133,_0x3a4e('0x27'));logger[_0x3a4e('0x28')](_0x3a4e('0x29'),_0x245133,_0x3a4e('0x27'),JSON['stringify'](_0x7b3d66));if(_0x7b3d66[_0x3a4e('0x2a')]){if(_0x7b3d66['error'][_0x3a4e('0x2b')]===0x1f4){logger[_0x3a4e('0x2a')](_0x3a4e('0x26'),_0x245133,_0x7b3d66[_0x3a4e('0x2a')][_0x3a4e('0x2c')]);return _0x4fe4ea(_0x7b3d66['error'][_0x3a4e('0x2c')]);}logger[_0x3a4e('0x2a')](_0x3a4e('0x26'),_0x245133,_0x7b3d66[_0x3a4e('0x2a')][_0x3a4e('0x2c')]);return _0x44d8a7(_0x7b3d66[_0x3a4e('0x2a')]['message']);}else{logger[_0x3a4e('0x2d')]('SmsAccount,\x20%s,\x20%s',_0x245133,'request\x20sent');_0x44d8a7(_0x7b3d66[_0x3a4e('0x2e')][_0x3a4e('0x2c')]);}})['catch'](function(_0x5e6e6a){logger[_0x3a4e('0x2a')](_0x3a4e('0x26'),_0x245133,_0x5e6e6a);_0x4fe4ea(_0x5e6e6a);});});}function respondWithStatusCode(_0x17f1fe,_0x14ccfb){_0x14ccfb=_0x14ccfb||0xcc;return function(_0x205a94){if(_0x205a94){return _0x17f1fe[_0x3a4e('0x2f')](_0x14ccfb);}return _0x17f1fe['status'](_0x14ccfb)[_0x3a4e('0x30')]();};}function respondWithResult(_0x5bb67c,_0x5ddccf){_0x5ddccf=_0x5ddccf||0xc8;return function(_0x188bf7){if(_0x188bf7){return _0x5bb67c['status'](_0x5ddccf)[_0x3a4e('0x31')](_0x188bf7);}};}function respondWithFilteredResult(_0x363fda,_0x20aa51){return function(_0x1e250b){if(_0x1e250b){var _0x41da44=typeof _0x20aa51['offset']===_0x3a4e('0x32')&&typeof _0x20aa51['limit']===_0x3a4e('0x32');var _0x2d9589=_0x1e250b['count'];var _0x1647af=_0x41da44?0x0:_0x20aa51[_0x3a4e('0x33')];var _0x3cdf68=_0x41da44?_0x1e250b[_0x3a4e('0x34')]:_0x20aa51[_0x3a4e('0x33')]+_0x20aa51['limit'];var _0x135490;if(_0x3cdf68>=_0x2d9589){_0x3cdf68=_0x2d9589;_0x135490=0xc8;}else{_0x135490=0xce;}_0x363fda[_0x3a4e('0x35')](_0x135490);return _0x363fda[_0x3a4e('0x36')]('Content-Range',_0x1647af+'-'+_0x3cdf68+'/'+_0x2d9589)[_0x3a4e('0x31')](_0x1e250b);}return null;};}function patchUpdates(_0x436bf2){return function(_0x391caa){try{jsonpatch['apply'](_0x391caa,_0x436bf2,!![]);}catch(_0x37389){return BPromise[_0x3a4e('0x37')](_0x37389);}return _0x391caa[_0x3a4e('0x38')]();};}function saveUpdates(_0x301731,_0x175ed6){return function(_0x15f2dd){if(_0x15f2dd){return _0x15f2dd[_0x3a4e('0x39')](_0x301731)['then'](function(_0x387a18){return _0x387a18;});}return null;};}function removeEntity(_0x34836e,_0x488961){return function(_0x3adba9){if(_0x3adba9){return _0x3adba9[_0x3a4e('0x3a')]()[_0x3a4e('0x25')](function(){var _0x350548=_0x3adba9[_0x3a4e('0x3b')]({'plain':!![]});var _0x42d367='SmsAccounts';return db['UserProfileResource'][_0x3a4e('0x3a')]({'where':{'type':_0x42d367,'resourceId':_0x350548['id']}})[_0x3a4e('0x25')](function(){return _0x3adba9;});})[_0x3a4e('0x25')](function(){_0x34836e[_0x3a4e('0x35')](0xcc)['end']();});}};}function handleEntityNotFound(_0x34e01e,_0x2b4b22){return function(_0x4f66ee){if(!_0x4f66ee){_0x34e01e[_0x3a4e('0x2f')](0x194);}return _0x4f66ee;};}function handleError(_0x4f0791,_0x47dd67){_0x47dd67=_0x47dd67||0x1f4;return function(_0xe8e2cf){logger[_0x3a4e('0x2a')](_0xe8e2cf[_0x3a4e('0x3c')]);if(_0xe8e2cf[_0x3a4e('0x3d')]){delete _0xe8e2cf[_0x3a4e('0x3d')];}_0x4f0791[_0x3a4e('0x35')](_0x47dd67)[_0x3a4e('0x3e')](_0xe8e2cf);};}exports[_0x3a4e('0x3f')]=function(_0x2235a2,_0x740af6){var _0x496895={'include':[{'model':db['Pause'],'as':_0x3a4e('0x40')}]},_0x1169ad={},_0x1b11af={'count':0x0,'rows':[]};var _0x81bdac=_['map'](db[_0x3a4e('0x41')]['rawAttributes'],function(_0x13ccd8){return{'name':_0x13ccd8[_0x3a4e('0x42')],'type':_0x13ccd8[_0x3a4e('0x43')][_0x3a4e('0x44')]};});_0x1169ad['model']=_[_0x3a4e('0x45')](_0x81bdac,_0x3a4e('0x3d'));_0x1169ad[_0x3a4e('0x46')]=_[_0x3a4e('0x47')](_0x2235a2['query']);_0x1169ad[_0x3a4e('0x48')]=_[_0x3a4e('0x49')](_0x1169ad[_0x3a4e('0x4a')],_0x1169ad[_0x3a4e('0x46')]);_0x496895[_0x3a4e('0x4b')]=_[_0x3a4e('0x49')](_0x1169ad[_0x3a4e('0x4a')],qs[_0x3a4e('0x4c')](_0x2235a2[_0x3a4e('0x46')]['fields']));_0x496895[_0x3a4e('0x4b')]=_0x496895[_0x3a4e('0x4b')][_0x3a4e('0x4d')]?_0x496895[_0x3a4e('0x4b')]:_0x1169ad[_0x3a4e('0x4a')];if(!_0x2235a2['query'][_0x3a4e('0x4e')](_0x3a4e('0x4f'))){_0x496895[_0x3a4e('0x50')]=qs[_0x3a4e('0x50')](_0x2235a2[_0x3a4e('0x46')][_0x3a4e('0x50')]);_0x496895[_0x3a4e('0x33')]=qs[_0x3a4e('0x33')](_0x2235a2[_0x3a4e('0x46')][_0x3a4e('0x33')]);}_0x496895[_0x3a4e('0x51')]=qs[_0x3a4e('0x52')](_0x2235a2[_0x3a4e('0x46')][_0x3a4e('0x52')]);_0x496895[_0x3a4e('0x53')]=qs[_0x3a4e('0x48')](_['pick'](_0x2235a2[_0x3a4e('0x46')],_0x1169ad[_0x3a4e('0x48')]),_0x81bdac);if(_0x2235a2[_0x3a4e('0x46')][_0x3a4e('0x54')]){_0x496895[_0x3a4e('0x53')]=_[_0x3a4e('0x55')](_0x496895[_0x3a4e('0x53')],{'$or':_[_0x3a4e('0x45')](_0x81bdac,function(_0x4c428d){if(_0x4c428d[_0x3a4e('0x43')]!==_0x3a4e('0x56')){var _0x551c0e={};_0x551c0e[_0x4c428d['name']]={'$like':'%'+_0x2235a2[_0x3a4e('0x46')][_0x3a4e('0x54')]+'%'};return _0x551c0e;}})});}_0x496895=_[_0x3a4e('0x55')]({},_0x496895,_0x2235a2[_0x3a4e('0x57')]);var _0x569a99={'where':_0x496895[_0x3a4e('0x53')]};return db[_0x3a4e('0x41')][_0x3a4e('0x34')](_0x569a99)['then'](function(_0x1ebaff){_0x1b11af[_0x3a4e('0x34')]=_0x1ebaff;if(_0x2235a2[_0x3a4e('0x46')]['includeAll']){_0x496895['include']=[{'all':!![]}];}return db['SmsAccount']['findAll'](_0x496895);})[_0x3a4e('0x25')](function(_0x3550b7){_0x1b11af[_0x3a4e('0x58')]=_0x3550b7;return _0x1b11af;})[_0x3a4e('0x25')](respondWithFilteredResult(_0x740af6,_0x496895))['catch'](handleError(_0x740af6,null));};exports[_0x3a4e('0x59')]=function(_0x599a72,_0x34bd83){var _0x45a078={'raw':![],'where':{'id':_0x599a72['params']['id']},'include':[{'model':db[_0x3a4e('0x5a')],'as':_0x3a4e('0x40')}]},_0x59ac3e={};_0x59ac3e[_0x3a4e('0x4a')]=_[_0x3a4e('0x47')](db[_0x3a4e('0x41')][_0x3a4e('0x5b')]);_0x59ac3e['query']=_[_0x3a4e('0x47')](_0x599a72[_0x3a4e('0x46')]);_0x59ac3e[_0x3a4e('0x48')]=_[_0x3a4e('0x49')](_0x59ac3e[_0x3a4e('0x4a')],_0x59ac3e[_0x3a4e('0x46')]);_0x45a078[_0x3a4e('0x4b')]=_['intersection'](_0x59ac3e[_0x3a4e('0x4a')],qs[_0x3a4e('0x4c')](_0x599a72[_0x3a4e('0x46')][_0x3a4e('0x4c')]));_0x45a078['attributes']=_0x45a078['attributes'][_0x3a4e('0x4d')]?_0x45a078['attributes']:_0x59ac3e['model'];if(_0x599a72[_0x3a4e('0x46')][_0x3a4e('0x5c')]){_0x45a078[_0x3a4e('0x5d')]=[{'all':!![]}];}_0x45a078=_['merge']({},_0x45a078,_0x599a72[_0x3a4e('0x57')]);return db[_0x3a4e('0x41')][_0x3a4e('0x5e')](_0x45a078)[_0x3a4e('0x25')](handleEntityNotFound(_0x34bd83,null))[_0x3a4e('0x25')](respondWithResult(_0x34bd83,null))['catch'](handleError(_0x34bd83,null));};exports[_0x3a4e('0x5f')]=function(_0x110aa4,_0x1575b5){return db[_0x3a4e('0x41')][_0x3a4e('0x5f')](_0x110aa4[_0x3a4e('0x60')],{})[_0x3a4e('0x25')](function(_0x58e49c){var _0x256366=_0x110aa4[_0x3a4e('0x61')][_0x3a4e('0x3b')]({'plain':!![]});if(!_0x256366)throw new Error(_0x3a4e('0x62'));if(_0x256366['role']===_0x3a4e('0x61')){var _0x3916b6=_0x58e49c[_0x3a4e('0x3b')]({'plain':!![]});var _0x45ec63=_0x3a4e('0x63');return db[_0x3a4e('0x64')][_0x3a4e('0x5e')]({'where':{'name':_0x45ec63,'userProfileId':_0x256366[_0x3a4e('0x65')]},'raw':!![]})[_0x3a4e('0x25')](function(_0x4fcf20){if(_0x4fcf20&&_0x4fcf20['autoAssociation']===0x0){return db[_0x3a4e('0x66')]['create']({'name':_0x3916b6[_0x3a4e('0x3d')],'resourceId':_0x3916b6['id'],'type':_0x4fcf20['name'],'sectionId':_0x4fcf20['id']},{})[_0x3a4e('0x25')](function(){return _0x58e49c;});}else{return _0x58e49c;}})[_0x3a4e('0x67')](function(_0x4b2b5f){logger[_0x3a4e('0x2a')](_0x3a4e('0x68'),_0x4b2b5f);throw _0x4b2b5f;});}return _0x58e49c;})[_0x3a4e('0x25')](respondWithResult(_0x1575b5,0xc9))[_0x3a4e('0x67')](handleError(_0x1575b5,null));};exports['update']=function(_0x2eb2c2,_0x52efdd){if(_0x2eb2c2[_0x3a4e('0x60')]['id']){delete _0x2eb2c2[_0x3a4e('0x60')]['id'];}return db['SmsAccount']['find']({'where':{'id':_0x2eb2c2[_0x3a4e('0x69')]['id']},'include':[{'model':db[_0x3a4e('0x5a')],'as':_0x3a4e('0x40')}]})[_0x3a4e('0x25')](handleEntityNotFound(_0x52efdd,null))[_0x3a4e('0x25')](saveUpdates(_0x2eb2c2[_0x3a4e('0x60')],null))[_0x3a4e('0x25')](respondWithResult(_0x52efdd,null))['catch'](handleError(_0x52efdd,null));};exports[_0x3a4e('0x3a')]=function(_0xd94516,_0x11273a){return db['SmsAccount'][_0x3a4e('0x5e')]({'where':{'id':_0xd94516['params']['id']}})[_0x3a4e('0x25')](handleEntityNotFound(_0x11273a,null))[_0x3a4e('0x25')](removeEntity(_0x11273a,null))[_0x3a4e('0x67')](handleError(_0x11273a,null));};exports['describe']=function(_0x212073,_0x362505){return db['SmsAccount'][_0x3a4e('0x6a')]()[_0x3a4e('0x25')](respondWithResult(_0x362505,null))[_0x3a4e('0x67')](handleError(_0x362505,null));};exports[_0x3a4e('0x6b')]=function(_0x12494f,_0x4f9fda,_0x1cd1b0){if(_0x12494f[_0x3a4e('0x60')]['id']){delete _0x12494f[_0x3a4e('0x60')]['id'];}return db[_0x3a4e('0x41')][_0x3a4e('0x5e')]({'where':{'id':_0x12494f['params']['id']}})[_0x3a4e('0x25')](handleEntityNotFound(_0x4f9fda,null))[_0x3a4e('0x25')](function(_0x250c8d){if(_0x250c8d){_0x12494f[_0x3a4e('0x60')]['SmsAccountId']=_0x250c8d['id'];return db[_0x3a4e('0x6c')][_0x3a4e('0x5f')](_0x12494f[_0x3a4e('0x60')]);}})['then'](respondWithResult(_0x4f9fda,null))['catch'](handleError(_0x4f9fda,null));};exports['getDispositions']=function(_0x448a45,_0x1490cb,_0x27cec6){var _0x21ced2={'raw':![],'where':{}};var _0x57f4dd={};var _0x99e2dc={'count':0x0,'rows':[]};return db['SmsAccount'][_0x3a4e('0x6d')]({'where':{'id':_0x448a45[_0x3a4e('0x69')]['id']}})['then'](handleEntityNotFound(_0x1490cb,null))[_0x3a4e('0x25')](function(_0x19c7ec){if(_0x19c7ec){_0x57f4dd['model']=_[_0x3a4e('0x47')](db['Disposition'][_0x3a4e('0x5b')]);_0x57f4dd['query']=_[_0x3a4e('0x47')](_0x448a45[_0x3a4e('0x46')]);_0x57f4dd['filters']=_['intersection'](_0x57f4dd[_0x3a4e('0x4a')],_0x57f4dd[_0x3a4e('0x46')]);_0x21ced2[_0x3a4e('0x4b')]=_[_0x3a4e('0x49')](_0x57f4dd[_0x3a4e('0x4a')],qs[_0x3a4e('0x4c')](_0x448a45[_0x3a4e('0x46')][_0x3a4e('0x4c')]));_0x21ced2[_0x3a4e('0x4b')]=_0x21ced2[_0x3a4e('0x4b')][_0x3a4e('0x4d')]?_0x21ced2[_0x3a4e('0x4b')]:_0x57f4dd['model'];if(!_0x448a45['query'][_0x3a4e('0x4e')]('nolimit')){_0x21ced2[_0x3a4e('0x50')]=qs[_0x3a4e('0x50')](_0x448a45['query'][_0x3a4e('0x50')]);_0x21ced2['offset']=qs[_0x3a4e('0x33')](_0x448a45[_0x3a4e('0x46')][_0x3a4e('0x33')]);}_0x21ced2['order']=qs[_0x3a4e('0x52')](_0x448a45[_0x3a4e('0x46')][_0x3a4e('0x52')]);_0x21ced2[_0x3a4e('0x53')]=qs[_0x3a4e('0x48')](_['pick'](_0x448a45[_0x3a4e('0x46')],_0x57f4dd[_0x3a4e('0x48')]));_0x21ced2[_0x3a4e('0x53')][_0x3a4e('0x6e')]=_0x19c7ec['id'];if(_0x448a45[_0x3a4e('0x46')][_0x3a4e('0x54')]){_0x21ced2[_0x3a4e('0x53')]=_[_0x3a4e('0x55')](_0x21ced2['where'],{'$or':_[_0x3a4e('0x45')](_0x21ced2['attributes'],function(_0x170fe0){var _0x5d021c={};_0x5d021c[_0x170fe0]={'$like':'%'+_0x448a45[_0x3a4e('0x46')]['filter']+'%'};return _0x5d021c;})});}_0x21ced2=_['merge']({},_0x21ced2,_0x448a45[_0x3a4e('0x57')]);return db[_0x3a4e('0x6c')][_0x3a4e('0x34')]({'where':_0x21ced2[_0x3a4e('0x53')]})[_0x3a4e('0x25')](function(_0x1f08cb){_0x99e2dc[_0x3a4e('0x34')]=_0x1f08cb;if(_0x448a45[_0x3a4e('0x46')][_0x3a4e('0x5c')]){_0x21ced2['include']=[{'all':!![]}];}return db['Disposition'][_0x3a4e('0x6f')](_0x21ced2);})[_0x3a4e('0x25')](function(_0x190436){_0x99e2dc['rows']=_0x190436;return _0x99e2dc;});}})[_0x3a4e('0x25')](respondWithFilteredResult(_0x1490cb,_0x21ced2))[_0x3a4e('0x67')](handleError(_0x1490cb,null));};exports[_0x3a4e('0x70')]=function(_0xd1599b,_0x38a0e1,_0x8d003b){return db[_0x3a4e('0x41')]['find']({'where':{'id':_0xd1599b[_0x3a4e('0x69')]['id']}})[_0x3a4e('0x25')](handleEntityNotFound(_0x38a0e1,null))[_0x3a4e('0x25')](function(_0x330100){if(_0x330100){return _0x330100[_0x3a4e('0x70')](_0xd1599b[_0x3a4e('0x46')][_0x3a4e('0x71')]);}})[_0x3a4e('0x25')](respondWithStatusCode(_0x38a0e1,null))[_0x3a4e('0x67')](handleError(_0x38a0e1,null));};exports[_0x3a4e('0x72')]=function(_0x153c40,_0x1264c8,_0x25e6cb){if(_0x153c40['body']['id']){delete _0x153c40['body']['id'];}return db['SmsAccount'][_0x3a4e('0x5e')]({'where':{'id':_0x153c40['params']['id']}})[_0x3a4e('0x25')](handleEntityNotFound(_0x1264c8,null))['then'](function(_0x3ba7e0){if(_0x3ba7e0){_0x153c40[_0x3a4e('0x60')]['SmsAccountId']=_0x3ba7e0['id'];return db[_0x3a4e('0x73')][_0x3a4e('0x5f')](_0x153c40['body']);}})[_0x3a4e('0x25')](respondWithResult(_0x1264c8,null))[_0x3a4e('0x67')](handleError(_0x1264c8,null));};exports['getAnswers']=function(_0x535446,_0x36fd21,_0x3feee6){var _0x1d511c={'raw':![],'where':{}};var _0x2ff44f={};var _0x51def2={'count':0x0,'rows':[]};return db['SmsAccount'][_0x3a4e('0x6d')]({'where':{'id':_0x535446['params']['id']}})[_0x3a4e('0x25')](handleEntityNotFound(_0x36fd21,null))[_0x3a4e('0x25')](function(_0x220597){if(_0x220597){_0x2ff44f[_0x3a4e('0x4a')]=_[_0x3a4e('0x47')](db['CannedAnswer'][_0x3a4e('0x5b')]);_0x2ff44f[_0x3a4e('0x46')]=_[_0x3a4e('0x47')](_0x535446[_0x3a4e('0x46')]);_0x2ff44f[_0x3a4e('0x48')]=_[_0x3a4e('0x49')](_0x2ff44f['model'],_0x2ff44f[_0x3a4e('0x46')]);_0x1d511c[_0x3a4e('0x4b')]=_[_0x3a4e('0x49')](_0x2ff44f[_0x3a4e('0x4a')],qs[_0x3a4e('0x4c')](_0x535446[_0x3a4e('0x46')]['fields']));_0x1d511c[_0x3a4e('0x4b')]=_0x1d511c[_0x3a4e('0x4b')][_0x3a4e('0x4d')]?_0x1d511c[_0x3a4e('0x4b')]:_0x2ff44f[_0x3a4e('0x4a')];if(!_0x535446[_0x3a4e('0x46')][_0x3a4e('0x4e')]('nolimit')){_0x1d511c[_0x3a4e('0x50')]=qs['limit'](_0x535446[_0x3a4e('0x46')][_0x3a4e('0x50')]);_0x1d511c[_0x3a4e('0x33')]=qs['offset'](_0x535446[_0x3a4e('0x46')]['offset']);}_0x1d511c[_0x3a4e('0x51')]=qs[_0x3a4e('0x52')](_0x535446['query'][_0x3a4e('0x52')]);_0x1d511c['where']=qs[_0x3a4e('0x48')](_['pick'](_0x535446['query'],_0x2ff44f[_0x3a4e('0x48')]));_0x1d511c['where'][_0x3a4e('0x6e')]=_0x220597['id'];if(_0x535446['query'][_0x3a4e('0x54')]){_0x1d511c[_0x3a4e('0x53')]=_[_0x3a4e('0x55')](_0x1d511c['where'],{'$or':_[_0x3a4e('0x45')](_0x1d511c[_0x3a4e('0x4b')],function(_0x4b45c8){var _0x2bdb64={};_0x2bdb64[_0x4b45c8]={'$like':'%'+_0x535446['query']['filter']+'%'};return _0x2bdb64;})});}_0x1d511c=_[_0x3a4e('0x55')]({},_0x1d511c,_0x535446[_0x3a4e('0x57')]);return db[_0x3a4e('0x73')]['count']({'where':_0x1d511c[_0x3a4e('0x53')]})['then'](function(_0x161fd8){_0x51def2[_0x3a4e('0x34')]=_0x161fd8;if(_0x535446[_0x3a4e('0x46')][_0x3a4e('0x5c')]){_0x1d511c[_0x3a4e('0x5d')]=[{'all':!![]}];}return db[_0x3a4e('0x73')][_0x3a4e('0x6f')](_0x1d511c);})['then'](function(_0x3a50c6){_0x51def2['rows']=_0x3a50c6;return _0x51def2;});}})[_0x3a4e('0x25')](respondWithFilteredResult(_0x36fd21,_0x1d511c))['catch'](handleError(_0x36fd21,null));};exports['removeAnswers']=function(_0x30008c,_0x46f143,_0x225ec8){return db[_0x3a4e('0x41')][_0x3a4e('0x5e')]({'where':{'id':_0x30008c[_0x3a4e('0x69')]['id']}})[_0x3a4e('0x25')](handleEntityNotFound(_0x46f143,null))[_0x3a4e('0x25')](function(_0xc98502){if(_0xc98502){return _0xc98502[_0x3a4e('0x74')](_0x30008c[_0x3a4e('0x46')][_0x3a4e('0x71')]);}})['then'](respondWithStatusCode(_0x46f143,null))[_0x3a4e('0x67')](handleError(_0x46f143,null));};exports['notify']=function(_0x1c2b67,_0x3d588c,_0x531e3b){var _0x206d27={'channel':'sms'};var _0xb8aaa6=[];var _0x328e9f=[];var _0x304f55={};return db[_0x3a4e('0x41')][_0x3a4e('0x5e')]({'where':{'id':_0x1c2b67[_0x3a4e('0x69')]['id']},'include':[{'model':db[_0x3a4e('0x75')],'as':_0x3a4e('0x76')}]})[_0x3a4e('0x25')](handleEntityNotFound(_0x3d588c,null))[_0x3a4e('0x25')](function(_0x2c20b0){_0x206d27[_0x3a4e('0x77')]=_0x2c20b0;_0x206d27[_0x3a4e('0x78')]=_[_0x3a4e('0x79')](_0x2c20b0['Applications'],[_0x3a4e('0x7a')],[_0x3a4e('0x7b')]);if(_0x206d27[_0x3a4e('0x77')][_0x3a4e('0x76')]){delete _0x206d27[_0x3a4e('0x77')][_0x3a4e('0x76')];}return db[_0x3a4e('0x7c')]['describe']();})[_0x3a4e('0x25')](function(_0x11f052){if(!_0x11f052){throw new db['Sequelize'][(_0x3a4e('0x7d'))](_0x3a4e('0x7e'));}_0xb8aaa6=_[_0x3a4e('0x7f')](_[_0x3a4e('0x47')](_0x11f052),[_0x3a4e('0x80'),'updatedAt']);_0x328e9f=_[_0x3a4e('0x7f')](_[_0x3a4e('0x47')](_0x11f052),[_0x3a4e('0x80'),_0x3a4e('0x81'),_0x3a4e('0x82'),_0x3a4e('0x83')]);_0x206d27[_0x3a4e('0x60')]={'mapKey':_0x3a4e('0x84')};if(_0x206d27['account'][_0x3a4e('0x43')]){switch(_0x206d27['account'][_0x3a4e('0x43')]){case _0x3a4e('0x85'):_0x206d27[_0x3a4e('0x60')][_0x3a4e('0x86')]=_0x1c2b67[_0x3a4e('0x60')][_0x3a4e('0x87')];_0x206d27[_0x3a4e('0x60')][_0x3a4e('0x60')]=_0x1c2b67[_0x3a4e('0x60')]['Body'];_0x206d27[_0x3a4e('0x60')][_0x3a4e('0x88')]=_0x1c2b67[_0x3a4e('0x60')][_0x3a4e('0x89')];break;case _0x3a4e('0x8a'):_0x206d27[_0x3a4e('0x60')][_0x3a4e('0x86')]='+'+_0x1c2b67[_0x3a4e('0x60')]['sender'];_0x206d27[_0x3a4e('0x60')]['body']=_0x1c2b67['body'][_0x3a4e('0x8b')];break;case'connectel':_0x206d27['body'][_0x3a4e('0x86')]=_0x1c2b67[_0x3a4e('0x60')][_0x3a4e('0x86')];_0x206d27['body']['body']=_0x1c2b67[_0x3a4e('0x60')][_0x3a4e('0x2c')];break;case _0x3a4e('0x8c'):_0x206d27['body'][_0x3a4e('0x86')]=_0x1c2b67['body'][_0x3a4e('0x86')];_0x206d27[_0x3a4e('0x60')][_0x3a4e('0x60')]=_0x1c2b67[_0x3a4e('0x60')][_0x3a4e('0x60')];_0x206d27[_0x3a4e('0x60')][_0x3a4e('0x88')]=_0x1c2b67[_0x3a4e('0x60')][_0x3a4e('0x8d')];break;case _0x3a4e('0x8e'):_0x206d27[_0x3a4e('0x60')]['from']=_0x1c2b67[_0x3a4e('0x60')][_0x3a4e('0x87')];_0x206d27['body'][_0x3a4e('0x60')]=_0x1c2b67[_0x3a4e('0x60')][_0x3a4e('0x8f')];_0x206d27[_0x3a4e('0x60')][_0x3a4e('0x88')]=_0x1c2b67['body']['MessageUUID'];break;case'infobip':_0x206d27[_0x3a4e('0x60')][_0x3a4e('0x86')]='+'+_0x1c2b67[_0x3a4e('0x60')][_0x3a4e('0x90')][0x0][_0x3a4e('0x86')];_0x206d27[_0x3a4e('0x60')]['body']=_0x1c2b67[_0x3a4e('0x60')]['results'][0x0]['text'];_0x206d27[_0x3a4e('0x60')][_0x3a4e('0x88')]=_0x1c2b67[_0x3a4e('0x60')]['results'][0x0][_0x3a4e('0x88')];break;case _0x3a4e('0x91'):_0x206d27[_0x3a4e('0x60')][_0x3a4e('0x86')]=_0x1c2b67['body'][_0x3a4e('0x92')];_0x206d27[_0x3a4e('0x60')][_0x3a4e('0x60')]=_0x1c2b67[_0x3a4e('0x60')][_0x3a4e('0x93')][_0x3a4e('0x2c')];break;case _0x3a4e('0x94'):_0x206d27['body'][_0x3a4e('0x86')]=_0x1c2b67[_0x3a4e('0x60')][_0x3a4e('0x95')];_0x206d27['body']['body']=_0x1c2b67['body'][_0x3a4e('0x8b')];_0x206d27[_0x3a4e('0x60')][_0x3a4e('0x88')]=_0x1c2b67[_0x3a4e('0x60')][_0x3a4e('0x96')];break;case _0x3a4e('0x97'):_0x206d27[_0x3a4e('0x60')][_0x3a4e('0x88')]=_0x1c2b67[_0x3a4e('0x60')][0x0][_0x3a4e('0x2c')]['id'];_0x206d27[_0x3a4e('0x60')][_0x3a4e('0x86')]=_0x1c2b67[_0x3a4e('0x60')][0x0][_0x3a4e('0x2c')]['from'];_0x206d27['body'][_0x3a4e('0x60')]=_0x1c2b67[_0x3a4e('0x60')][0x0]['message'][_0x3a4e('0x8b')];break;case _0x3a4e('0x98'):_0x206d27[_0x3a4e('0x60')][_0x3a4e('0x86')]=_0x1c2b67['body'][_0x3a4e('0x86')];_0x206d27[_0x3a4e('0x60')]['body']=_0x1c2b67['body'][_0x3a4e('0x2c')];_0x206d27[_0x3a4e('0x60')]['messageId']=_0x1c2b67['body'][_0x3a4e('0x99')];break;}}if(_0x206d27[_0x3a4e('0x60')]['id']){delete _0x206d27[_0x3a4e('0x60')]['id'];}if(_[_0x3a4e('0x9a')](_0x206d27[_0x3a4e('0x60')]['from'])){throw new db[(_0x3a4e('0x9b'))]['ValidationError'](_0x3a4e('0x9c'));}if(_[_0x3a4e('0x9a')](_0x206d27[_0x3a4e('0x60')][_0x3a4e('0x60')])||_0x206d27[_0x3a4e('0x60')][_0x3a4e('0x60')]===''){throw new db[(_0x3a4e('0x9b'))][(_0x3a4e('0x7d'))](_0x3a4e('0x9d'));}if(_['isNil'](_0x206d27[_0x3a4e('0x60')][_0x3a4e('0x9e')])){throw new db[(_0x3a4e('0x9b'))]['ValidationError'](_0x3a4e('0x9f')+_0x328e9f);}if(!_[_0x3a4e('0xa0')](_0x328e9f,_0x206d27['body'][_0x3a4e('0x9e')])){throw new db[(_0x3a4e('0x9b'))][(_0x3a4e('0x7d'))](_0x3a4e('0xa1')+_0x328e9f);}_0x304f55[_0x206d27[_0x3a4e('0x60')][_0x3a4e('0x9e')]]=_0x206d27[_0x3a4e('0x60')][_0x3a4e('0x86')];return db[_0x3a4e('0xa2')][_0x3a4e('0x5e')]({'where':{'id':_0x206d27['account'][_0x3a4e('0x83')]},'include':[{'model':db['CmContact'],'as':_0x3a4e('0xa3'),'where':_0x304f55,'limit':0x1,'order':[['updatedAt',_0x3a4e('0xa4')]]}]});})[_0x3a4e('0x25')](handleEntityNotFound(_0x3d588c,null))[_0x3a4e('0x25')](function(_0x1218d8){if(_0x1218d8){_0x206d27[_0x3a4e('0xa5')]=_[_0x3a4e('0xa6')](_0x1218d8,[_0x3a4e('0xa3')]);if(_0x1218d8['Contacts'][_0x3a4e('0x4d')]){return _0x1218d8[_0x3a4e('0xa3')][0x0];}var _0x1f40cf=_['defaults'](_0x206d27['body'],{'firstName':_0x206d27[_0x3a4e('0x60')]['from'],'ListId':_0x1218d8['id']});_0x1f40cf[_0x206d27[_0x3a4e('0x60')]['mapKey']]=_0x206d27[_0x3a4e('0x60')][_0x3a4e('0x86')];return db[_0x3a4e('0x7c')]['create'](_0x1f40cf,{'fields':_0xb8aaa6,'raw':!![]});}})[_0x3a4e('0x25')](handleEntityNotFound(_0x3d588c,null))[_0x3a4e('0x25')](function(_0x33ef1f){if(_0x33ef1f){_0x206d27[_0x3a4e('0xa7')]=_0x33ef1f;var _0xad74a9={'ContactId':_0x33ef1f['id'],'phone':_0x206d27['body'][_0x3a4e('0x86')],'SmsAccountId':_0x1c2b67['params']['id']};var _0x45b37a={'ContactId':_0x33ef1f['id'],'SmsAccountId':_0x1c2b67['params']['id'],'closed':![]};return db['SmsInteraction'][_0x3a4e('0x5e')]({'where':_0x45b37a})[_0x3a4e('0x25')](function(_0x1f72a5){if(_0x1f72a5){return[_0x1f72a5,![]];}return db[_0x3a4e('0xa8')][_0x3a4e('0x5f')](_0xad74a9)[_0x3a4e('0x25')](function(_0x259eca){return[_0x259eca,!![]];});});}})[_0x3a4e('0xa9')](function(_0x5e8fe6,_0x4b9197){_0x206d27['interaction']=_0x5e8fe6[_0x3a4e('0x3b')]({'plain':!![]});_0x206d27[_0x3a4e('0xaa')][_0x3a4e('0xab')]=![];if(_0x4b9197){if(_0x206d27[_0x3a4e('0x77')][_0x3a4e('0xac')]){_0x206d27[_0x3a4e('0x78')][_0x3a4e('0xad')]({'id':0x0,'priority':_0x206d27[_0x3a4e('0x78')][_0x3a4e('0x4d')]+0x1,'app':_0x3a4e('0xae'),'appdata':_0x3a4e('0xaf'),'interval':'*,*,*,*'});}_0x206d27[_0x3a4e('0xaa')][_0x3a4e('0xab')]=!![];}return db[_0x3a4e('0xb0')][_0x3a4e('0x5f')]({'phone':_0x206d27[_0x3a4e('0x60')][_0x3a4e('0x86')],'messageId':_0x206d27[_0x3a4e('0x60')]['messageId'],'body':_0x206d27['body']['body'],'SmsAccountId':_0x1c2b67[_0x3a4e('0x69')]['id'],'SmsInteractionId':_0x5e8fe6['id'],'direction':'in','ContactId':_0x5e8fe6[_0x3a4e('0xb1')],'AttachmentId':_0x206d27[_0x3a4e('0x60')][_0x3a4e('0xb2')]});})[_0x3a4e('0x25')](function(_0x46675f){_0x206d27['message']=_0x46675f;if(_0x206d27['interaction'][_0x3a4e('0xb3')]){return db[_0x3a4e('0xb4')][_0x3a4e('0x5e')]({'attributes':['id',_0x3a4e('0x3d')],'where':{'id':_0x206d27[_0x3a4e('0xaa')][_0x3a4e('0xb3')]}})[_0x3a4e('0x25')](function(_0x35526b){if(_0x35526b){_0x206d27[_0x3a4e('0x78')]['unshift']({'id':0x0,'priority':0x0,'app':_0x3a4e('0xb5'),'appdata':_0x35526b['name']+','+(_0x206d27[_0x3a4e('0x77')][_0x3a4e('0xb6')]||0xa),'interval':_0x3a4e('0xb7')});}return respondWithRpcPromise('Start','startRouting',_0x206d27);});}return respondWithRpcPromise(_0x3a4e('0xb8'),_0x3a4e('0xb9'),_0x206d27);})[_0x3a4e('0x25')](function(_0x13df4c){if(_0x13df4c){var _0x50f97e=0xc8;var _0x3ff45f='receiveMessage';logger[_0x3a4e('0x2d')](_0x3a4e('0x29'),_0x3ff45f,_0x50f97e,'entity\x20found');logger[_0x3a4e('0x28')](_0x3a4e('0xba'),_0x3ff45f,_0x50f97e,_0x3a4e('0xbb'),JSON[_0x3a4e('0xbc')](_0x13df4c));if(_0x206d27[_0x3a4e('0x77')][_0x3a4e('0x43')]===_0x3a4e('0x85')){return _0x3d588c[_0x3a4e('0x35')](_0x50f97e)[_0x3a4e('0x36')](_0x3a4e('0xbd'),_0x3a4e('0xbe'))[_0x3a4e('0x3e')](_0x3a4e('0xbf'));}else{return _0x3d588c['status'](_0x50f97e)['json'](_0x13df4c);}}})[_0x3a4e('0x67')](handleError(_0x3d588c,null));};exports[_0x3a4e('0xc0')]=function(_0x381ccd,_0x5a37ec){var _0x2bdc51=_0x381ccd[_0x3a4e('0x69')]['id'];var _0x449779=_0x381ccd[_0x3a4e('0x60')];var _0x182913=0xc8;var _0x386e38=null;return db[_0x3a4e('0xc1')][_0x3a4e('0xc2')]({'isolationLevel':db[_0x3a4e('0xc1')]['Transaction']['ISOLATION_LEVELS'][_0x3a4e('0xc3')]},function(_0xddcab){return db['SmsAccount'][_0x3a4e('0x6d')]({'where':{'id':_0x2bdc51},'transaction':_0xddcab})[_0x3a4e('0x25')](function(_0x56b665){if(_0x56b665){return db[_0x3a4e('0x75')]['destroy']({'where':{'SmsAccountId':_0x2bdc51},'transaction':_0xddcab})['then'](function(){var _0x4b54fc=_[_0x3a4e('0x45')](_0x449779,function(_0x4f76f7){_0x4f76f7['SmsAccountId']=_0x2bdc51;return _0x4f76f7;});return db['SmsApplication'][_0x3a4e('0xc4')](_0x4b54fc,{'transaction':_0xddcab});});}else{_0x182913=0x194;_0x386e38=[];}});})[_0x3a4e('0x25')](function(){if(_0x182913!==0x194){return db['SmsApplication'][_0x3a4e('0xc5')]({'where':{'SmsAccountId':_0x2bdc51},'order':_0x3a4e('0x7a')})[_0x3a4e('0x25')](function(_0x41144f){_0x386e38=_0x41144f;});}})[_0x3a4e('0x67')](function(_0x218f69){_0x182913=0x1f4;logger['error'](_0x218f69[_0x3a4e('0x3c')]);if(_0x218f69['name']){delete _0x218f69[_0x3a4e('0x3d')];}_0x386e38=_0x218f69;})['finally'](function(){if(_0x386e38===null){_0x5a37ec[_0x3a4e('0x2f')](_0x182913);}else{if(_0x182913===0x1f4){_0x5a37ec[_0x3a4e('0x35')](_0x182913)[_0x3a4e('0x3e')](_0x386e38);}else{_0x5a37ec[_0x3a4e('0x35')](_0x182913)[_0x3a4e('0x31')](_0x386e38);}}});};exports[_0x3a4e('0xc6')]=function(_0x40e1a8,_0x5e2298,_0x49b2db){var _0x54f3aa={};var _0x4b30e9={};var _0x1418ab;var _0x2d76c9;return db[_0x3a4e('0x41')][_0x3a4e('0x6d')]({'where':{'id':_0x40e1a8[_0x3a4e('0x69')]['id']}})[_0x3a4e('0x25')](handleEntityNotFound(_0x5e2298,null))[_0x3a4e('0x25')](function(_0x52fa5f){if(_0x52fa5f){_0x1418ab=_0x52fa5f;_0x4b30e9['model']=_[_0x3a4e('0x47')](db[_0x3a4e('0x75')][_0x3a4e('0x5b')]);_0x4b30e9[_0x3a4e('0x46')]=_[_0x3a4e('0x47')](_0x40e1a8['query']);_0x4b30e9[_0x3a4e('0x48')]=_[_0x3a4e('0x49')](_0x4b30e9[_0x3a4e('0x4a')],_0x4b30e9[_0x3a4e('0x46')]);_0x54f3aa[_0x3a4e('0x4b')]=_[_0x3a4e('0x49')](_0x4b30e9[_0x3a4e('0x4a')],qs[_0x3a4e('0x4c')](_0x40e1a8[_0x3a4e('0x46')][_0x3a4e('0x4c')]));_0x54f3aa['attributes']=_0x54f3aa[_0x3a4e('0x4b')][_0x3a4e('0x4d')]?_0x54f3aa[_0x3a4e('0x4b')]:_0x4b30e9['model'];_0x54f3aa['order']=qs[_0x3a4e('0x52')](_0x40e1a8[_0x3a4e('0x46')][_0x3a4e('0x52')]);_0x54f3aa[_0x3a4e('0x53')]=qs['filters'](_[_0x3a4e('0xc7')](_0x40e1a8[_0x3a4e('0x46')],_0x4b30e9[_0x3a4e('0x48')]));if(_0x40e1a8[_0x3a4e('0x46')][_0x3a4e('0x54')]){_0x54f3aa[_0x3a4e('0x53')]=_['merge'](_0x54f3aa[_0x3a4e('0x53')],{'$or':_[_0x3a4e('0x45')](_0x54f3aa[_0x3a4e('0x4b')],function(_0x42c4dc){var _0x37a8ad={};_0x37a8ad[_0x42c4dc]={'$like':'%'+_0x40e1a8['query']['filter']+'%'};return _0x37a8ad;})});}_0x54f3aa=_['merge']({},_0x54f3aa,_0x40e1a8[_0x3a4e('0x57')]);return _0x1418ab['getApplications'](_0x54f3aa);}})['then'](function(_0x2a786b){if(_0x2a786b){_0x2d76c9=_0x2a786b[_0x3a4e('0x4d')];if(!_0x40e1a8['query']['hasOwnProperty'](_0x3a4e('0x4f'))){_0x54f3aa[_0x3a4e('0x50')]=qs[_0x3a4e('0x50')](_0x40e1a8[_0x3a4e('0x46')]['limit']);_0x54f3aa[_0x3a4e('0x33')]=qs[_0x3a4e('0x33')](_0x40e1a8[_0x3a4e('0x46')][_0x3a4e('0x33')]);}return _0x1418ab[_0x3a4e('0xc6')](_0x54f3aa);}})[_0x3a4e('0x25')](function(_0x53e058){if(_0x53e058){return _0x53e058?{'count':_0x2d76c9,'rows':_0x53e058}:null;}})[_0x3a4e('0x25')](respondWithResult(_0x5e2298,null))['catch'](handleError(_0x5e2298,null));};exports[_0x3a4e('0xc8')]=function(_0x4a730b,_0x54f269,_0x4b5828){var _0x125ed8={'raw':![],'where':{}};var _0x45e776={};var _0x12b15c={'count':0x0,'rows':[]};return db[_0x3a4e('0x41')][_0x3a4e('0x6d')]({'where':{'id':_0x4a730b['params']['id']}})[_0x3a4e('0x25')](handleEntityNotFound(_0x54f269,null))['then'](function(_0x351211){if(_0x351211){_0x45e776['model']=_[_0x3a4e('0x47')](db[_0x3a4e('0xa8')]['rawAttributes']);_0x45e776[_0x3a4e('0x46')]=_[_0x3a4e('0x47')](_0x4a730b[_0x3a4e('0x46')]);_0x45e776[_0x3a4e('0x48')]=_['intersection'](_0x45e776[_0x3a4e('0x4a')],_0x45e776[_0x3a4e('0x46')]);_0x125ed8[_0x3a4e('0x4b')]=_[_0x3a4e('0x49')](_0x45e776[_0x3a4e('0x4a')],qs[_0x3a4e('0x4c')](_0x4a730b['query'][_0x3a4e('0x4c')]));_0x125ed8['attributes']=_0x125ed8['attributes'][_0x3a4e('0x4d')]?_0x125ed8[_0x3a4e('0x4b')]:_0x45e776['model'];if(!_0x4a730b[_0x3a4e('0x46')]['hasOwnProperty'](_0x3a4e('0x4f'))){_0x125ed8[_0x3a4e('0x50')]=qs[_0x3a4e('0x50')](_0x4a730b['query']['limit']);_0x125ed8['offset']=qs[_0x3a4e('0x33')](_0x4a730b[_0x3a4e('0x46')][_0x3a4e('0x33')]);}_0x125ed8[_0x3a4e('0x51')]=qs['sort'](_0x4a730b[_0x3a4e('0x46')][_0x3a4e('0x52')]);_0x125ed8[_0x3a4e('0x53')]=qs[_0x3a4e('0x48')](_[_0x3a4e('0xc7')](_0x4a730b[_0x3a4e('0x46')],_0x45e776[_0x3a4e('0x48')]));_0x125ed8[_0x3a4e('0x53')][_0x3a4e('0x6e')]=_0x351211['id'];if(_0x4a730b[_0x3a4e('0x46')][_0x3a4e('0x54')]){_0x125ed8[_0x3a4e('0x53')]=_['merge'](_0x125ed8[_0x3a4e('0x53')],{'$or':_[_0x3a4e('0x45')](_0x125ed8['attributes'],function(_0x231624){var _0x59c99d={};_0x59c99d[_0x231624]={'$like':'%'+_0x4a730b[_0x3a4e('0x46')][_0x3a4e('0x54')]+'%'};return _0x59c99d;})});}_0x125ed8=_[_0x3a4e('0x55')]({},_0x125ed8,_0x4a730b['options']);return db[_0x3a4e('0xa8')][_0x3a4e('0x34')]({'where':_0x125ed8[_0x3a4e('0x53')]})['then'](function(_0x3bee19){_0x12b15c['count']=_0x3bee19;if(_0x4a730b[_0x3a4e('0x46')]['includeAll']){_0x125ed8[_0x3a4e('0x5d')]=[{'model':db[_0x3a4e('0x7c')],'as':'Contact','required':![]},{'model':db[_0x3a4e('0xb4')],'as':_0x3a4e('0xc9'),'attributes':[_0x3a4e('0x3d'),'fullname','internal'],'required':![]},{'model':db['Tag'],'as':_0x3a4e('0xca'),'attributes':['id','name',_0x3a4e('0xcb')],'where':_0x4a730b['query'][_0x3a4e('0xcc')]?{'id':_0x4a730b['query'][_0x3a4e('0xcc')]}:undefined,'required':_0x4a730b[_0x3a4e('0x46')][_0x3a4e('0xcc')]?!![]:![]}];}return db[_0x3a4e('0xa8')]['findAll'](_0x125ed8);})[_0x3a4e('0x25')](function(_0x6d4724){_0x12b15c[_0x3a4e('0x58')]=_0x6d4724;return _0x12b15c;});}})[_0x3a4e('0x25')](respondWithFilteredResult(_0x54f269,_0x125ed8))[_0x3a4e('0x67')](handleError(_0x54f269,null));};exports[_0x3a4e('0x3e')]=function(_0x51a26c,_0x10bf0e,_0x5c24f4){var _0x239368,_0x33c607,_0x376c31;if(_[_0x3a4e('0x9a')](_0x51a26c[_0x3a4e('0x60')]['body'])||_0x51a26c[_0x3a4e('0x60')][_0x3a4e('0x60')]===''){throw new db[(_0x3a4e('0x9b'))][(_0x3a4e('0x7d'))](_0x3a4e('0x9d'));}if(_[_0x3a4e('0x9a')](_0x51a26c[_0x3a4e('0x60')]['to'])){throw new db[(_0x3a4e('0x9b'))][(_0x3a4e('0x7d'))]('to\x20is\x20mandatory');}_0x239368=_0x51a26c['body']['to'];return db['SmsAccount'][_0x3a4e('0x5e')]({'where':{'id':_0x51a26c[_0x3a4e('0x69')]['id']},'include':[{'model':db[_0x3a4e('0xa2')],'as':'List','include':[{'model':db[_0x3a4e('0x7c')],'as':'Contacts','where':{'mobile':_0x239368},'limit':0x1,'order':[[_0x3a4e('0x81'),'DESC']]}]}]})[_0x3a4e('0x25')](handleEntityNotFound(_0x10bf0e,null))[_0x3a4e('0x25')](function(_0x154c79){if(_0x154c79&&_0x154c79[_0x3a4e('0xcd')]){_0x33c607=_0x154c79[_0x3a4e('0x3b')]({'plain':!![]});if(_0x33c607['List']&&_0x33c607['List']['Contacts'][_0x3a4e('0x4d')]){return _0x33c607[_0x3a4e('0xcd')][_0x3a4e('0xa3')][0x0];}return db[_0x3a4e('0x7c')][_0x3a4e('0x5f')](_['defaults'](_0x51a26c['body'],{'firstName':_0x239368,'mobile':_0x239368,'phone':_0x239368,'ListId':_0x33c607['ListId']}));}})[_0x3a4e('0x25')](handleEntityNotFound(_0x10bf0e,null))[_0x3a4e('0x25')](function(_0x42fc62){if(_0x42fc62){_0x376c31=_0x42fc62;return db[_0x3a4e('0xa8')][_0x3a4e('0x5e')]({'where':{'ContactId':_0x376c31['id'],'closed':![],'SmsAccountId':_0x33c607['id']}})['then'](function(_0x220699){if(_0x220699){return[_0x220699,![]];}return db[_0x3a4e('0xa8')][_0x3a4e('0x5f')]({'UserId':_0x51a26c['user']['id'],'ContactId':_0x376c31['id'],'SmsAccountId':_0x33c607['id'],'phone':_0x239368,'firstMsgDirection':_0x3a4e('0xce'),'Messages':[_['merge'](_0x51a26c[_0x3a4e('0x60')],{'read':![],'body':_0x51a26c[_0x3a4e('0x60')][_0x3a4e('0x60')],'phone':_0x239368,'SmsAccountId':_0x33c607['id'],'UserId':_0x51a26c[_0x3a4e('0x61')]['id'],'ContactId':_0x376c31['id']})]},{'include':[{'model':db[_0x3a4e('0xb0')],'as':_0x3a4e('0xcf')}]})[_0x3a4e('0x25')](function(_0x492e00){return[_0x492e00,!![]];});});}})[_0x3a4e('0xa9')](function(_0x7c1872,_0x1d0886){if(_0x1d0886){return _0x7c1872;}return db[_0x3a4e('0xb0')][_0x3a4e('0x5f')](_[_0x3a4e('0x55')](_0x51a26c['body'],{'read':![],'body':_0x51a26c[_0x3a4e('0x60')][_0x3a4e('0x60')],'phone':_0x239368,'SmsAccountId':_0x33c607['id'],'SmsInteractionId':_0x7c1872['id'],'UserId':_0x51a26c[_0x3a4e('0x61')]['id'],'ContactId':_0x376c31['id']}))[_0x3a4e('0x25')](function(_0x2b63f7){_0x7c1872[_0x3a4e('0xd0')]['Messages']=[];_0x7c1872[_0x3a4e('0xd0')][_0x3a4e('0xcf')][_0x3a4e('0xad')](_0x2b63f7['dataValues']);return _0x7c1872;});})['then'](respondWithResult(_0x10bf0e,null))['catch'](handleError(_0x10bf0e,null));};exports['status']=function(_0x1b914b,_0x506e13,_0x2e0a05){if(_0x1b914b[_0x3a4e('0x60')]['id']){delete _0x1b914b['body']['id'];}var _0x290eb5,_0x6331ad,_0x56b030;return db[_0x3a4e('0x41')][_0x3a4e('0x5e')]({'where':{'id':_0x1b914b[_0x3a4e('0x69')]['id']}})[_0x3a4e('0x25')](handleEntityNotFound(_0x506e13,null))['then'](function(_0x5cc73){if(_0x5cc73){_0x56b030=_0x5cc73;logger[_0x3a4e('0x28')](_0x3a4e('0x29'),_0x3a4e('0x35'),_0x3a4e('0xd1'),_0x5cc73['type'],util[_0x3a4e('0xd2')](_0x1b914b[_0x3a4e('0x60')],{'showHidden':![],'depth':null}));switch(_0x5cc73[_0x3a4e('0x43')]){case'skebby':if(_0x1b914b['body']['skebby_dispatch_id']&&_0x1b914b[_0x3a4e('0x60')][_0x3a4e('0x35')]){_0x6331ad=_0x1b914b[_0x3a4e('0x60')][_0x3a4e('0x35')];return db[_0x3a4e('0xb0')][_0x3a4e('0x5e')]({'where':{'messageId':_0x1b914b['body'][_0x3a4e('0xd3')]}});}break;case _0x3a4e('0xd4'):if(_0x1b914b[_0x3a4e('0x60')][_0x3a4e('0xd5')]&&_0x1b914b[_0x3a4e('0x60')]['statusInt']){_0x6331ad=_0x1b914b[_0x3a4e('0x60')][_0x3a4e('0xd6')];return db[_0x3a4e('0xb0')][_0x3a4e('0x5e')]({'where':{'messageId':_0x1b914b['body'][_0x3a4e('0xd5')]}});}break;case _0x3a4e('0x8c'):if(_0x1b914b[_0x3a4e('0x60')][_0x3a4e('0x8d')]&&_0x1b914b['body'][_0x3a4e('0xd7')]){_0x6331ad=_0x1b914b[_0x3a4e('0x60')][_0x3a4e('0xd7')];return db['SmsMessage']['find']({'where':{'messageId':_0x1b914b[_0x3a4e('0x60')][_0x3a4e('0x8d')]}});}break;case _0x3a4e('0xd8'):var _0x1bf09f=_0x1b914b['body'][_0x3a4e('0x90')][0x0];if(_0x1bf09f[_0x3a4e('0x88')]&&_0x1bf09f['status'][_0x3a4e('0xd9')]==='DELIVERED'){_0x6331ad=_0x1bf09f['status'][_0x3a4e('0xd9')];return db[_0x3a4e('0xb0')]['find']({'where':{'messageId':_0x1bf09f[_0x3a4e('0x88')]}});}break;case _0x3a4e('0x94'):if(_0x1b914b[_0x3a4e('0x60')]['messageId']&&_0x1b914b[_0x3a4e('0x60')][_0x3a4e('0x35')]){_0x6331ad=_0x1b914b[_0x3a4e('0x60')]['status'];return db[_0x3a4e('0xb0')][_0x3a4e('0x5e')]({'where':{'messageId':_0x1b914b['body'][_0x3a4e('0x88')]}});}break;case _0x3a4e('0x97'):if(_0x1b914b['body'][0x0][_0x3a4e('0x2c')]['id']){_0x6331ad=_0x1b914b[_0x3a4e('0x60')][0x0][_0x3a4e('0x43')];return db[_0x3a4e('0xb0')][_0x3a4e('0x5e')]({'where':{'messageId':_0x1b914b[_0x3a4e('0x60')][0x0][_0x3a4e('0x2c')]['id']}});}break;case'intelepeer':if(_0x1b914b['body'][_0x3a4e('0xda')]&&_0x1b914b[_0x3a4e('0x60')][_0x3a4e('0x35')]){_0x6331ad=_0x1b914b[_0x3a4e('0x60')][_0x3a4e('0x35')];return db['SmsMessage']['find']({'where':{'messageId':_0x1b914b[_0x3a4e('0x60')][_0x3a4e('0xda')]}});}break;}}})[_0x3a4e('0x25')](handleEntityNotFound(_0x506e13,null))[_0x3a4e('0x25')](function(_0x4560ff){if(_0x4560ff){_0x290eb5=_0x4560ff;switch(_0x56b030[_0x3a4e('0x43')]){case _0x3a4e('0x8a'):if(_0x6331ad===_0x3a4e('0xdb')){return _0x290eb5[_0x3a4e('0x39')]({'read':!![]});}else{logger[_0x3a4e('0x2a')](_0x3a4e('0x29'),_0x3a4e('0x35'),_0x3a4e('0x8a'),util['inspect'](_0x1b914b[_0x3a4e('0x60')],{'showHidden':![],'depth':null}));}break;case _0x3a4e('0xd4'):if(_0x6331ad==='1'){return _0x290eb5[_0x3a4e('0x39')]({'read':!![]});}else{logger['error'](_0x3a4e('0x29'),'status',_0x3a4e('0x8a'),util[_0x3a4e('0xd2')](_0x1b914b[_0x3a4e('0x60')],{'showHidden':![],'depth':null}));}break;case _0x3a4e('0x8c'):if(!_0x1b914b[_0x3a4e('0x60')][_0x3a4e('0xdc')]&&_0x6331ad>=0xc8&&_0x6331ad<=0xce){return _0x290eb5[_0x3a4e('0x39')]({'read':!![]});}else{logger['error'](_0x3a4e('0x29'),_0x3a4e('0x35'),_0x3a4e('0x8c'),util[_0x3a4e('0xd2')](_0x1b914b[_0x3a4e('0x60')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x1e8a1c=_0x1b914b[_0x3a4e('0x60')][_0x3a4e('0x90')][0x0];if(_0x1e8a1c[_0x3a4e('0x35')][_0x3a4e('0xd9')]==='DELIVERED'){return _0x290eb5['update']({'read':!![]});}else{logger[_0x3a4e('0x2a')](_0x3a4e('0x29'),_0x3a4e('0x35'),_0x3a4e('0xd8'),util['inspect'](_0x1b914b['body'],{'showHidden':![],'depth':null}));}break;case _0x3a4e('0x94'):if(_0x6331ad==_0x3a4e('0xdd')||_0x6331ad==_0x3a4e('0xde')){return _0x290eb5[_0x3a4e('0x39')]({'read':!![]});}else{logger[_0x3a4e('0x2a')](_0x3a4e('0x29'),'status',_0x3a4e('0x94'),util[_0x3a4e('0xd2')](_0x1b914b[_0x3a4e('0x60')],{'showHidden':![],'depth':null}));}break;case _0x3a4e('0x97'):if(_0x6331ad=='message-delivered'){return _0x290eb5[_0x3a4e('0x39')]({'read':!![]});}else{logger['error'](_0x3a4e('0x29'),_0x3a4e('0x35'),_0x3a4e('0x97'),util[_0x3a4e('0xd2')](_0x1b914b[_0x3a4e('0x60')],{'showHidden':![],'depth':null}));}break;case _0x3a4e('0x98'):if(_0x6331ad===_0x3a4e('0xdf')||_0x6331ad===_0x3a4e('0xe0')){return _0x290eb5['update']({'read':!![]});}else{logger['error'](_0x3a4e('0x29'),_0x3a4e('0x35'),'intelepeer',util['inspect'](_0x1b914b[_0x3a4e('0x60')],{'showHidden':![],'depth':null}));}break;}return _0x290eb5;}})[_0x3a4e('0x25')](respondWithResult(_0x506e13,null))['catch'](handleError(_0x506e13,null));};exports['statusGet']=function(_0x319c65,_0x309d95,_0x4fbb35){var _0x223ef7,_0x3c8b7d,_0x2d882e;return db[_0x3a4e('0x41')][_0x3a4e('0x5e')]({'where':{'id':_0x319c65['params']['id']}})['then'](handleEntityNotFound(_0x309d95,null))[_0x3a4e('0x25')](function(_0x5217d1){if(_0x5217d1){_0x2d882e=_0x5217d1;logger[_0x3a4e('0x28')](_0x3a4e('0x29'),_0x3a4e('0x35'),'received\x20delivery\x20report\x20from',_0x5217d1['type'],util[_0x3a4e('0xd2')](_0x319c65[_0x3a4e('0x46')],{'showHidden':![],'depth':null}));switch(_0x5217d1['type']){case'csc':if(_0x319c65[_0x3a4e('0x46')][_0x3a4e('0xe1')]&&_0x319c65['query'][_0x3a4e('0xe2')]){_0x3c8b7d=_0x319c65[_0x3a4e('0x46')][_0x3a4e('0xe2')];return db[_0x3a4e('0xb0')][_0x3a4e('0x5e')]({'where':{'messageId':_0x319c65['query'][_0x3a4e('0xe1')]}});}break;}}})[_0x3a4e('0x25')](handleEntityNotFound(_0x309d95,null))[_0x3a4e('0x25')](function(_0x41b211){if(_0x41b211){_0x223ef7=_0x41b211;switch(_0x2d882e[_0x3a4e('0x43')]){case _0x3a4e('0x91'):if(_0x3c8b7d==='2'||_0x3c8b7d==='6'){return _0x223ef7['update']({'read':!![]});}else{logger['error'](_0x3a4e('0x29'),_0x3a4e('0x35'),_0x3a4e('0x91'),util['inspect'](_0x319c65[_0x3a4e('0x46')],{'showHidden':![],'depth':null}));};break;}return _0x223ef7;}})[_0x3a4e('0x25')](respondWithResult(_0x309d95,null))[_0x3a4e('0x67')](handleError(_0x309d95,null));};exports[_0x3a4e('0xe3')]=function(_0x15f3ac,_0x1fcb88,_0x28601e){return db['SmsAccount'][_0x3a4e('0x5e')]({'where':{'id':_0x15f3ac[_0x3a4e('0x69')]['id']}})[_0x3a4e('0x25')](handleEntityNotFound(_0x1fcb88,null))[_0x3a4e('0x25')](function(_0x482086){if(_0x482086){return _0x482086[_0x3a4e('0xe3')](_0x15f3ac['body']['ids'],_['omit'](_0x15f3ac[_0x3a4e('0x60')],[_0x3a4e('0x71'),'id'])||{})[_0x3a4e('0xa9')](function(_0x28bf37){for(var _0x577952=0x0;_0x577952<_0x15f3ac[_0x3a4e('0x60')][_0x3a4e('0x71')][_0x3a4e('0x4d')];_0x577952+=0x1){socket[_0x3a4e('0xe4')](_0x3a4e('0xe5'),{'UserId':Number(_0x15f3ac[_0x3a4e('0x60')][_0x3a4e('0x71')][_0x577952]),'SmsAccountId':Number(_0x15f3ac[_0x3a4e('0x69')]['id'])});}return _0x28bf37;});}})[_0x3a4e('0x25')](respondWithResult(_0x1fcb88,null))[_0x3a4e('0x67')](handleError(_0x1fcb88,null));};exports[_0x3a4e('0xe6')]=function(_0x39928d,_0x493501,_0x44afb5){return db[_0x3a4e('0x41')][_0x3a4e('0x5e')]({'where':{'id':_0x39928d[_0x3a4e('0x69')]['id']}})['then'](handleEntityNotFound(_0x493501,null))[_0x3a4e('0x25')](function(_0x2376a7){if(_0x2376a7){return _0x2376a7[_0x3a4e('0xe6')](_0x39928d[_0x3a4e('0x46')]['ids'])[_0x3a4e('0x25')](function(){if(_['isArray'](_0x39928d[_0x3a4e('0x46')]['ids'])){for(var _0x578ae4=0x0;_0x578ae4<_0x39928d[_0x3a4e('0x46')][_0x3a4e('0x71')][_0x3a4e('0x4d')];_0x578ae4+=0x1){socket['emit'](_0x3a4e('0xe7'),{'UserId':Number(_0x39928d[_0x3a4e('0x46')]['ids'][_0x578ae4]),'SmsAccountId':Number(_0x39928d['params']['id'])});}}else{socket[_0x3a4e('0xe4')]('userSmsAccount:remove',{'UserId':Number(_0x39928d['query']['ids']),'SmsAccountId':Number(_0x39928d[_0x3a4e('0x69')]['id'])});}});}})[_0x3a4e('0x25')](respondWithStatusCode(_0x493501,null))['catch'](handleError(_0x493501,null));};exports[_0x3a4e('0xe8')]=function(_0x17bdd1,_0x12470f,_0x522bb9){var _0x1e7e39={};var _0x4d075a={};var _0x5e0a9f;var _0x2b9a26;return db['SmsAccount'][_0x3a4e('0x6d')]({'where':{'id':_0x17bdd1[_0x3a4e('0x69')]['id']}})['then'](handleEntityNotFound(_0x12470f,null))[_0x3a4e('0x25')](function(_0x36c8ea){if(_0x36c8ea){_0x5e0a9f=_0x36c8ea;_0x4d075a['model']=_['keys'](db[_0x3a4e('0xb4')]['rawAttributes']);_0x4d075a[_0x3a4e('0x46')]=_[_0x3a4e('0x47')](_0x17bdd1[_0x3a4e('0x46')]);_0x4d075a[_0x3a4e('0x48')]=_[_0x3a4e('0x49')](_0x4d075a[_0x3a4e('0x4a')],_0x4d075a[_0x3a4e('0x46')]);_0x1e7e39[_0x3a4e('0x4b')]=_[_0x3a4e('0x49')](_0x4d075a[_0x3a4e('0x4a')],qs['fields'](_0x17bdd1[_0x3a4e('0x46')][_0x3a4e('0x4c')]));_0x1e7e39[_0x3a4e('0x4b')]=_0x1e7e39[_0x3a4e('0x4b')][_0x3a4e('0x4d')]?_0x1e7e39[_0x3a4e('0x4b')]:_0x4d075a[_0x3a4e('0x4a')];_0x1e7e39[_0x3a4e('0x51')]=qs[_0x3a4e('0x52')](_0x17bdd1[_0x3a4e('0x46')][_0x3a4e('0x52')]);_0x1e7e39['where']=qs[_0x3a4e('0x48')](_[_0x3a4e('0xc7')](_0x17bdd1[_0x3a4e('0x46')],_0x4d075a[_0x3a4e('0x48')]));if(_0x17bdd1[_0x3a4e('0x46')][_0x3a4e('0x54')]){_0x1e7e39[_0x3a4e('0x53')]=_[_0x3a4e('0x55')](_0x1e7e39[_0x3a4e('0x53')],{'$or':_[_0x3a4e('0x45')](_0x1e7e39[_0x3a4e('0x4b')],function(_0x5cc170){var _0x20d1d4={};_0x20d1d4[_0x5cc170]={'$like':'%'+_0x17bdd1[_0x3a4e('0x46')]['filter']+'%'};return _0x20d1d4;})});}_0x1e7e39=_[_0x3a4e('0x55')]({},_0x1e7e39,_0x17bdd1[_0x3a4e('0x57')]);return _0x5e0a9f[_0x3a4e('0xe8')](_0x1e7e39);}})['then'](function(_0x55a0ee){if(_0x55a0ee){_0x2b9a26=_0x55a0ee['length'];if(!_0x17bdd1[_0x3a4e('0x46')][_0x3a4e('0x4e')](_0x3a4e('0x4f'))){_0x1e7e39[_0x3a4e('0x50')]=qs['limit'](_0x17bdd1['query'][_0x3a4e('0x50')]);_0x1e7e39[_0x3a4e('0x33')]=qs[_0x3a4e('0x33')](_0x17bdd1[_0x3a4e('0x46')][_0x3a4e('0x33')]);}return _0x5e0a9f['getAgents'](_0x1e7e39);}})[_0x3a4e('0x25')](function(_0x2af152){if(_0x2af152){return _0x2af152?{'count':_0x2b9a26,'rows':_0x2af152}:null;}})[_0x3a4e('0x25')](respondWithResult(_0x12470f,null))[_0x3a4e('0x67')](handleError(_0x12470f,null));}; \ No newline at end of file +var _0xcd04=['removeAgents','userSmsAccount:remove','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','jayson/promise','client','http','request','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','status','end','offset','undefined','count','limit','set','Content-Range','json','reject','update','then','destroy','UserProfileResource','stack','name','send','index','mandatoryDispositionPause','SmsAccount','rawAttributes','fieldName','type','key','model','keys','filters','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','map','VIRTUAL','merge','options','includeAll','rows','show','params','Pause','include','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','SmsAccounts','userProfileId','autoAssociation','describe','addDisposition','getDispositions','findOne','Disposition','SmsAccountId','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','SmsApplication','account','orderBy','Applications','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','From','Body','MessageSid','skebby','sender','clicksend','from','messageId','message_id','plivo','Text','infobip','results','text','originatingAddress','segmentedMessage','clickatell','fromNumber','replyMessageId','bandwidth','intelepeer','refid','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','DESC','list','omit','Contacts','contact','SmsInteraction','spread','interaction','created','autoclose','applications','push','close','unmanaged','*,*,*,*','SmsMessage','ContactId','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','sequelize','transaction','READ_COMMITTED','bulkCreate','sendStatus','getApplications','Contact','User','internal','Tag','Tags','color','tag','List','out','Messages','dataValues','inspect','skebby_dispatch_id','connectel','statusInt','status_code','DELIVERED','redif','error_code','groupName','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','DELIVRD','ACCEPTD','statusGet','received\x20delivery\x20report\x20from','csc','state','addAgents','emit'];(function(_0x2f7078,_0x9ef005){var _0x4e5655=function(_0x4b5739){while(--_0x4b5739){_0x2f7078['push'](_0x2f7078['shift']());}};_0x4e5655(++_0x9ef005);}(_0xcd04,0xe6));var _0x4cd0=function(_0x10c57c,_0x57827d){_0x10c57c=_0x10c57c-0x0;var _0x565f5f=_0xcd04[_0x10c57c];return _0x565f5f;};'use strict';var emlformat=require(_0x4cd0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4cd0('0x1'));var jsonpatch=require(_0x4cd0('0x2'));var rp=require(_0x4cd0('0x3'));var moment=require(_0x4cd0('0x4'));var BPromise=require(_0x4cd0('0x5'));var Mustache=require(_0x4cd0('0x6'));var util=require('util');var path=require(_0x4cd0('0x7'));var sox=require(_0x4cd0('0x8'));var csv=require(_0x4cd0('0x9'));var ejs=require(_0x4cd0('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4cd0('0xb'));var squel=require(_0x4cd0('0xc'));var crypto=require('crypto');var jsforce=require(_0x4cd0('0xd'));var deskjs=require(_0x4cd0('0xe'));var toCsv=require(_0x4cd0('0x9'));var querystring=require(_0x4cd0('0xf'));var Papa=require(_0x4cd0('0x10'));var Redis=require(_0x4cd0('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x4cd0('0x12'));var hardwareService=require(_0x4cd0('0x13'));var logger=require(_0x4cd0('0x14'))(_0x4cd0('0x15'));var utils=require(_0x4cd0('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x4cd0('0x17'));var db=require(_0x4cd0('0x18'))['db'];config[_0x4cd0('0x19')]=_[_0x4cd0('0x1a')](config[_0x4cd0('0x19')],{'host':_0x4cd0('0x1b'),'port':0x18eb});var socket=require(_0x4cd0('0x1c'))(new Redis(config[_0x4cd0('0x19')]));require(_0x4cd0('0x1d'))[_0x4cd0('0x1e')](socket);var jayson=require(_0x4cd0('0x1f'));var client=jayson[_0x4cd0('0x20')][_0x4cd0('0x21')]({'port':0x232c});function respondWithRpcPromise(_0x226ff8,_0x4db88e,_0x2ff8b8,_0x358618){return new BPromise(function(_0x29d7a6,_0x389bab){var _0x391486=_0x358618||client;return _0x391486[_0x4cd0('0x22')](_0x226ff8,_0x2ff8b8)['then'](function(_0x1068f8){logger['info'](_0x4cd0('0x23'),_0x4db88e,_0x4cd0('0x24'));logger[_0x4cd0('0x25')](_0x4cd0('0x26'),_0x4db88e,_0x4cd0('0x24'),JSON[_0x4cd0('0x27')](_0x1068f8));if(_0x1068f8[_0x4cd0('0x28')]){if(_0x1068f8[_0x4cd0('0x28')]['code']===0x1f4){logger[_0x4cd0('0x28')](_0x4cd0('0x23'),_0x4db88e,_0x1068f8[_0x4cd0('0x28')]['message']);return _0x389bab(_0x1068f8[_0x4cd0('0x28')][_0x4cd0('0x29')]);}logger[_0x4cd0('0x28')](_0x4cd0('0x23'),_0x4db88e,_0x1068f8[_0x4cd0('0x28')][_0x4cd0('0x29')]);return _0x29d7a6(_0x1068f8['error']['message']);}else{logger[_0x4cd0('0x2a')](_0x4cd0('0x23'),_0x4db88e,_0x4cd0('0x24'));_0x29d7a6(_0x1068f8[_0x4cd0('0x2b')][_0x4cd0('0x29')]);}})[_0x4cd0('0x2c')](function(_0x44c851){logger[_0x4cd0('0x28')](_0x4cd0('0x23'),_0x4db88e,_0x44c851);_0x389bab(_0x44c851);});});}function respondWithStatusCode(_0x1edbe4,_0x41b8d3){_0x41b8d3=_0x41b8d3||0xcc;return function(_0x2a26a9){if(_0x2a26a9){return _0x1edbe4['sendStatus'](_0x41b8d3);}return _0x1edbe4[_0x4cd0('0x2d')](_0x41b8d3)[_0x4cd0('0x2e')]();};}function respondWithResult(_0x10f66a,_0x47cd0d){_0x47cd0d=_0x47cd0d||0xc8;return function(_0x2d4c66){if(_0x2d4c66){return _0x10f66a[_0x4cd0('0x2d')](_0x47cd0d)['json'](_0x2d4c66);}};}function respondWithFilteredResult(_0x49d831,_0x2c7998){return function(_0x1ab6fa){if(_0x1ab6fa){var _0x1b4f7f=typeof _0x2c7998[_0x4cd0('0x2f')]===_0x4cd0('0x30')&&typeof _0x2c7998['limit']===_0x4cd0('0x30');var _0x277a60=_0x1ab6fa[_0x4cd0('0x31')];var _0x2064bb=_0x1b4f7f?0x0:_0x2c7998[_0x4cd0('0x2f')];var _0x2cc151=_0x1b4f7f?_0x1ab6fa[_0x4cd0('0x31')]:_0x2c7998[_0x4cd0('0x2f')]+_0x2c7998[_0x4cd0('0x32')];var _0x56a609;if(_0x2cc151>=_0x277a60){_0x2cc151=_0x277a60;_0x56a609=0xc8;}else{_0x56a609=0xce;}_0x49d831[_0x4cd0('0x2d')](_0x56a609);return _0x49d831[_0x4cd0('0x33')](_0x4cd0('0x34'),_0x2064bb+'-'+_0x2cc151+'/'+_0x277a60)[_0x4cd0('0x35')](_0x1ab6fa);}return null;};}function patchUpdates(_0x488af3){return function(_0x176a0d){try{jsonpatch['apply'](_0x176a0d,_0x488af3,!![]);}catch(_0x287f68){return BPromise[_0x4cd0('0x36')](_0x287f68);}return _0x176a0d['save']();};}function saveUpdates(_0x1bf9fb,_0x1fee25){return function(_0x3557b7){if(_0x3557b7){return _0x3557b7[_0x4cd0('0x37')](_0x1bf9fb)[_0x4cd0('0x38')](function(_0x29fe6d){return _0x29fe6d;});}return null;};}function removeEntity(_0x2c965e,_0xad3a76){return function(_0x43db94){if(_0x43db94){return _0x43db94[_0x4cd0('0x39')]()[_0x4cd0('0x38')](function(){var _0x560011=_0x43db94['get']({'plain':!![]});var _0x178942='SmsAccounts';return db[_0x4cd0('0x3a')]['destroy']({'where':{'type':_0x178942,'resourceId':_0x560011['id']}})[_0x4cd0('0x38')](function(){return _0x43db94;});})[_0x4cd0('0x38')](function(){_0x2c965e[_0x4cd0('0x2d')](0xcc)[_0x4cd0('0x2e')]();});}};}function handleEntityNotFound(_0x59e28b,_0x287ca4){return function(_0xb962d9){if(!_0xb962d9){_0x59e28b['sendStatus'](0x194);}return _0xb962d9;};}function handleError(_0x38ec65,_0x30a510){_0x30a510=_0x30a510||0x1f4;return function(_0x117fff){logger[_0x4cd0('0x28')](_0x117fff[_0x4cd0('0x3b')]);if(_0x117fff[_0x4cd0('0x3c')]){delete _0x117fff['name'];}_0x38ec65[_0x4cd0('0x2d')](_0x30a510)[_0x4cd0('0x3d')](_0x117fff);};}exports[_0x4cd0('0x3e')]=function(_0x570ba3,_0xff2d08){var _0x26a1b0={'include':[{'model':db['Pause'],'as':_0x4cd0('0x3f')}]},_0x3f6081={},_0x229c1e={'count':0x0,'rows':[]};var _0x1eaafe=_['map'](db[_0x4cd0('0x40')][_0x4cd0('0x41')],function(_0x4e0f6c){return{'name':_0x4e0f6c[_0x4cd0('0x42')],'type':_0x4e0f6c[_0x4cd0('0x43')][_0x4cd0('0x44')]};});_0x3f6081[_0x4cd0('0x45')]=_['map'](_0x1eaafe,_0x4cd0('0x3c'));_0x3f6081['query']=_[_0x4cd0('0x46')](_0x570ba3['query']);_0x3f6081[_0x4cd0('0x47')]=_['intersection'](_0x3f6081['model'],_0x3f6081[_0x4cd0('0x48')]);_0x26a1b0[_0x4cd0('0x49')]=_[_0x4cd0('0x4a')](_0x3f6081[_0x4cd0('0x45')],qs[_0x4cd0('0x4b')](_0x570ba3['query'][_0x4cd0('0x4b')]));_0x26a1b0[_0x4cd0('0x49')]=_0x26a1b0[_0x4cd0('0x49')][_0x4cd0('0x4c')]?_0x26a1b0[_0x4cd0('0x49')]:_0x3f6081[_0x4cd0('0x45')];if(!_0x570ba3[_0x4cd0('0x48')][_0x4cd0('0x4d')](_0x4cd0('0x4e'))){_0x26a1b0[_0x4cd0('0x32')]=qs['limit'](_0x570ba3['query'][_0x4cd0('0x32')]);_0x26a1b0['offset']=qs[_0x4cd0('0x2f')](_0x570ba3[_0x4cd0('0x48')][_0x4cd0('0x2f')]);}_0x26a1b0[_0x4cd0('0x4f')]=qs[_0x4cd0('0x50')](_0x570ba3[_0x4cd0('0x48')][_0x4cd0('0x50')]);_0x26a1b0[_0x4cd0('0x51')]=qs['filters'](_[_0x4cd0('0x52')](_0x570ba3[_0x4cd0('0x48')],_0x3f6081[_0x4cd0('0x47')]),_0x1eaafe);if(_0x570ba3['query'][_0x4cd0('0x53')]){_0x26a1b0['where']=_['merge'](_0x26a1b0[_0x4cd0('0x51')],{'$or':_[_0x4cd0('0x54')](_0x1eaafe,function(_0x3fad41){if(_0x3fad41[_0x4cd0('0x43')]!==_0x4cd0('0x55')){var _0xc75a56={};_0xc75a56[_0x3fad41[_0x4cd0('0x3c')]]={'$like':'%'+_0x570ba3['query']['filter']+'%'};return _0xc75a56;}})});}_0x26a1b0=_[_0x4cd0('0x56')]({},_0x26a1b0,_0x570ba3[_0x4cd0('0x57')]);var _0x35ca01={'where':_0x26a1b0[_0x4cd0('0x51')]};return db[_0x4cd0('0x40')][_0x4cd0('0x31')](_0x35ca01)['then'](function(_0x558397){_0x229c1e[_0x4cd0('0x31')]=_0x558397;if(_0x570ba3[_0x4cd0('0x48')][_0x4cd0('0x58')]){_0x26a1b0['include']=[{'all':!![]}];}return db['SmsAccount']['findAll'](_0x26a1b0);})[_0x4cd0('0x38')](function(_0x3b63d2){_0x229c1e[_0x4cd0('0x59')]=_0x3b63d2;return _0x229c1e;})[_0x4cd0('0x38')](respondWithFilteredResult(_0xff2d08,_0x26a1b0))[_0x4cd0('0x2c')](handleError(_0xff2d08,null));};exports[_0x4cd0('0x5a')]=function(_0x5ed00f,_0x3c7d82){var _0x50a30a={'raw':![],'where':{'id':_0x5ed00f[_0x4cd0('0x5b')]['id']},'include':[{'model':db[_0x4cd0('0x5c')],'as':_0x4cd0('0x3f')}]},_0x393c55={};_0x393c55['model']=_[_0x4cd0('0x46')](db[_0x4cd0('0x40')][_0x4cd0('0x41')]);_0x393c55['query']=_[_0x4cd0('0x46')](_0x5ed00f[_0x4cd0('0x48')]);_0x393c55['filters']=_[_0x4cd0('0x4a')](_0x393c55[_0x4cd0('0x45')],_0x393c55[_0x4cd0('0x48')]);_0x50a30a['attributes']=_[_0x4cd0('0x4a')](_0x393c55[_0x4cd0('0x45')],qs[_0x4cd0('0x4b')](_0x5ed00f['query']['fields']));_0x50a30a[_0x4cd0('0x49')]=_0x50a30a[_0x4cd0('0x49')]['length']?_0x50a30a['attributes']:_0x393c55[_0x4cd0('0x45')];if(_0x5ed00f[_0x4cd0('0x48')][_0x4cd0('0x58')]){_0x50a30a[_0x4cd0('0x5d')]=[{'all':!![]}];}_0x50a30a=_[_0x4cd0('0x56')]({},_0x50a30a,_0x5ed00f[_0x4cd0('0x57')]);return db[_0x4cd0('0x40')][_0x4cd0('0x5e')](_0x50a30a)['then'](handleEntityNotFound(_0x3c7d82,null))[_0x4cd0('0x38')](respondWithResult(_0x3c7d82,null))[_0x4cd0('0x2c')](handleError(_0x3c7d82,null));};exports[_0x4cd0('0x5f')]=function(_0x42801d,_0x44370b){return db['SmsAccount'][_0x4cd0('0x5f')](_0x42801d[_0x4cd0('0x60')],{})[_0x4cd0('0x38')](function(_0x571638){var _0x3a9336=_0x42801d[_0x4cd0('0x61')][_0x4cd0('0x62')]({'plain':!![]});if(!_0x3a9336)throw new Error(_0x4cd0('0x63'));if(_0x3a9336[_0x4cd0('0x64')]===_0x4cd0('0x61')){var _0x56588f=_0x571638[_0x4cd0('0x62')]({'plain':!![]});var _0x2708e3=_0x4cd0('0x65');return db['UserProfileSection']['find']({'where':{'name':_0x2708e3,'userProfileId':_0x3a9336[_0x4cd0('0x66')]},'raw':!![]})[_0x4cd0('0x38')](function(_0x492cfb){if(_0x492cfb&&_0x492cfb[_0x4cd0('0x67')]===0x0){return db[_0x4cd0('0x3a')]['create']({'name':_0x56588f[_0x4cd0('0x3c')],'resourceId':_0x56588f['id'],'type':_0x492cfb[_0x4cd0('0x3c')],'sectionId':_0x492cfb['id']},{})[_0x4cd0('0x38')](function(){return _0x571638;});}else{return _0x571638;}})['catch'](function(_0x4b56bc){logger[_0x4cd0('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4b56bc);throw _0x4b56bc;});}return _0x571638;})[_0x4cd0('0x38')](respondWithResult(_0x44370b,0xc9))[_0x4cd0('0x2c')](handleError(_0x44370b,null));};exports[_0x4cd0('0x37')]=function(_0x2ee458,_0x4a20c6){if(_0x2ee458[_0x4cd0('0x60')]['id']){delete _0x2ee458[_0x4cd0('0x60')]['id'];}return db[_0x4cd0('0x40')]['find']({'where':{'id':_0x2ee458[_0x4cd0('0x5b')]['id']},'include':[{'model':db[_0x4cd0('0x5c')],'as':_0x4cd0('0x3f')}]})[_0x4cd0('0x38')](handleEntityNotFound(_0x4a20c6,null))[_0x4cd0('0x38')](saveUpdates(_0x2ee458[_0x4cd0('0x60')],null))[_0x4cd0('0x38')](respondWithResult(_0x4a20c6,null))['catch'](handleError(_0x4a20c6,null));};exports[_0x4cd0('0x39')]=function(_0x3ccab7,_0xfbad8){return db['SmsAccount'][_0x4cd0('0x5e')]({'where':{'id':_0x3ccab7['params']['id']}})[_0x4cd0('0x38')](handleEntityNotFound(_0xfbad8,null))[_0x4cd0('0x38')](removeEntity(_0xfbad8,null))[_0x4cd0('0x2c')](handleError(_0xfbad8,null));};exports[_0x4cd0('0x68')]=function(_0x2f4de3,_0x50ee45){return db[_0x4cd0('0x40')][_0x4cd0('0x68')]()[_0x4cd0('0x38')](respondWithResult(_0x50ee45,null))[_0x4cd0('0x2c')](handleError(_0x50ee45,null));};exports[_0x4cd0('0x69')]=function(_0x2a3ba9,_0x146947,_0x43f7c3){if(_0x2a3ba9[_0x4cd0('0x60')]['id']){delete _0x2a3ba9[_0x4cd0('0x60')]['id'];}return db[_0x4cd0('0x40')][_0x4cd0('0x5e')]({'where':{'id':_0x2a3ba9[_0x4cd0('0x5b')]['id']}})[_0x4cd0('0x38')](handleEntityNotFound(_0x146947,null))['then'](function(_0x521a07){if(_0x521a07){_0x2a3ba9[_0x4cd0('0x60')]['SmsAccountId']=_0x521a07['id'];return db['Disposition']['create'](_0x2a3ba9[_0x4cd0('0x60')]);}})[_0x4cd0('0x38')](respondWithResult(_0x146947,null))[_0x4cd0('0x2c')](handleError(_0x146947,null));};exports[_0x4cd0('0x6a')]=function(_0x10fc59,_0x290485,_0x43f451){var _0x5e1abf={'raw':![],'where':{}};var _0x2a4478={};var _0x1d13db={'count':0x0,'rows':[]};return db[_0x4cd0('0x40')][_0x4cd0('0x6b')]({'where':{'id':_0x10fc59[_0x4cd0('0x5b')]['id']}})[_0x4cd0('0x38')](handleEntityNotFound(_0x290485,null))[_0x4cd0('0x38')](function(_0x1c9dd4){if(_0x1c9dd4){_0x2a4478[_0x4cd0('0x45')]=_['keys'](db[_0x4cd0('0x6c')][_0x4cd0('0x41')]);_0x2a4478[_0x4cd0('0x48')]=_[_0x4cd0('0x46')](_0x10fc59['query']);_0x2a4478['filters']=_[_0x4cd0('0x4a')](_0x2a4478['model'],_0x2a4478['query']);_0x5e1abf[_0x4cd0('0x49')]=_[_0x4cd0('0x4a')](_0x2a4478['model'],qs[_0x4cd0('0x4b')](_0x10fc59['query'][_0x4cd0('0x4b')]));_0x5e1abf[_0x4cd0('0x49')]=_0x5e1abf[_0x4cd0('0x49')][_0x4cd0('0x4c')]?_0x5e1abf[_0x4cd0('0x49')]:_0x2a4478[_0x4cd0('0x45')];if(!_0x10fc59['query']['hasOwnProperty']('nolimit')){_0x5e1abf[_0x4cd0('0x32')]=qs[_0x4cd0('0x32')](_0x10fc59[_0x4cd0('0x48')][_0x4cd0('0x32')]);_0x5e1abf['offset']=qs['offset'](_0x10fc59[_0x4cd0('0x48')][_0x4cd0('0x2f')]);}_0x5e1abf[_0x4cd0('0x4f')]=qs[_0x4cd0('0x50')](_0x10fc59[_0x4cd0('0x48')][_0x4cd0('0x50')]);_0x5e1abf[_0x4cd0('0x51')]=qs['filters'](_[_0x4cd0('0x52')](_0x10fc59['query'],_0x2a4478[_0x4cd0('0x47')]));_0x5e1abf[_0x4cd0('0x51')][_0x4cd0('0x6d')]=_0x1c9dd4['id'];if(_0x10fc59['query'][_0x4cd0('0x53')]){_0x5e1abf[_0x4cd0('0x51')]=_[_0x4cd0('0x56')](_0x5e1abf[_0x4cd0('0x51')],{'$or':_[_0x4cd0('0x54')](_0x5e1abf[_0x4cd0('0x49')],function(_0x30971c){var _0x286123={};_0x286123[_0x30971c]={'$like':'%'+_0x10fc59[_0x4cd0('0x48')][_0x4cd0('0x53')]+'%'};return _0x286123;})});}_0x5e1abf=_[_0x4cd0('0x56')]({},_0x5e1abf,_0x10fc59[_0x4cd0('0x57')]);return db['Disposition'][_0x4cd0('0x31')]({'where':_0x5e1abf['where']})[_0x4cd0('0x38')](function(_0x1b744b){_0x1d13db[_0x4cd0('0x31')]=_0x1b744b;if(_0x10fc59[_0x4cd0('0x48')]['includeAll']){_0x5e1abf['include']=[{'all':!![]}];}return db['Disposition'][_0x4cd0('0x6e')](_0x5e1abf);})[_0x4cd0('0x38')](function(_0xc9697d){_0x1d13db[_0x4cd0('0x59')]=_0xc9697d;return _0x1d13db;});}})[_0x4cd0('0x38')](respondWithFilteredResult(_0x290485,_0x5e1abf))[_0x4cd0('0x2c')](handleError(_0x290485,null));};exports['removeDispositions']=function(_0x6721a,_0xd20a89,_0x1ddb3e){return db[_0x4cd0('0x40')]['find']({'where':{'id':_0x6721a['params']['id']}})['then'](handleEntityNotFound(_0xd20a89,null))['then'](function(_0x144d73){if(_0x144d73){return _0x144d73[_0x4cd0('0x6f')](_0x6721a['query'][_0x4cd0('0x70')]);}})[_0x4cd0('0x38')](respondWithStatusCode(_0xd20a89,null))[_0x4cd0('0x2c')](handleError(_0xd20a89,null));};exports[_0x4cd0('0x71')]=function(_0x34c7f7,_0x4d3345,_0xd74deb){if(_0x34c7f7['body']['id']){delete _0x34c7f7[_0x4cd0('0x60')]['id'];}return db[_0x4cd0('0x40')]['find']({'where':{'id':_0x34c7f7[_0x4cd0('0x5b')]['id']}})['then'](handleEntityNotFound(_0x4d3345,null))['then'](function(_0x20126c){if(_0x20126c){_0x34c7f7[_0x4cd0('0x60')]['SmsAccountId']=_0x20126c['id'];return db[_0x4cd0('0x72')][_0x4cd0('0x5f')](_0x34c7f7[_0x4cd0('0x60')]);}})['then'](respondWithResult(_0x4d3345,null))[_0x4cd0('0x2c')](handleError(_0x4d3345,null));};exports[_0x4cd0('0x73')]=function(_0x37323d,_0x3a4d33,_0xb32f0f){var _0x1ff7c6={'raw':![],'where':{}};var _0x42770f={};var _0x1ed195={'count':0x0,'rows':[]};return db['SmsAccount']['findOne']({'where':{'id':_0x37323d['params']['id']}})[_0x4cd0('0x38')](handleEntityNotFound(_0x3a4d33,null))[_0x4cd0('0x38')](function(_0x439078){if(_0x439078){_0x42770f['model']=_[_0x4cd0('0x46')](db[_0x4cd0('0x72')][_0x4cd0('0x41')]);_0x42770f[_0x4cd0('0x48')]=_['keys'](_0x37323d[_0x4cd0('0x48')]);_0x42770f[_0x4cd0('0x47')]=_[_0x4cd0('0x4a')](_0x42770f[_0x4cd0('0x45')],_0x42770f['query']);_0x1ff7c6['attributes']=_[_0x4cd0('0x4a')](_0x42770f[_0x4cd0('0x45')],qs[_0x4cd0('0x4b')](_0x37323d[_0x4cd0('0x48')]['fields']));_0x1ff7c6['attributes']=_0x1ff7c6[_0x4cd0('0x49')][_0x4cd0('0x4c')]?_0x1ff7c6['attributes']:_0x42770f[_0x4cd0('0x45')];if(!_0x37323d[_0x4cd0('0x48')][_0x4cd0('0x4d')](_0x4cd0('0x4e'))){_0x1ff7c6[_0x4cd0('0x32')]=qs['limit'](_0x37323d[_0x4cd0('0x48')][_0x4cd0('0x32')]);_0x1ff7c6[_0x4cd0('0x2f')]=qs[_0x4cd0('0x2f')](_0x37323d[_0x4cd0('0x48')][_0x4cd0('0x2f')]);}_0x1ff7c6[_0x4cd0('0x4f')]=qs[_0x4cd0('0x50')](_0x37323d[_0x4cd0('0x48')][_0x4cd0('0x50')]);_0x1ff7c6['where']=qs[_0x4cd0('0x47')](_['pick'](_0x37323d[_0x4cd0('0x48')],_0x42770f[_0x4cd0('0x47')]));_0x1ff7c6['where'][_0x4cd0('0x6d')]=_0x439078['id'];if(_0x37323d[_0x4cd0('0x48')][_0x4cd0('0x53')]){_0x1ff7c6[_0x4cd0('0x51')]=_['merge'](_0x1ff7c6[_0x4cd0('0x51')],{'$or':_[_0x4cd0('0x54')](_0x1ff7c6[_0x4cd0('0x49')],function(_0x16bc48){var _0x3a5dc9={};_0x3a5dc9[_0x16bc48]={'$like':'%'+_0x37323d['query'][_0x4cd0('0x53')]+'%'};return _0x3a5dc9;})});}_0x1ff7c6=_[_0x4cd0('0x56')]({},_0x1ff7c6,_0x37323d['options']);return db[_0x4cd0('0x72')]['count']({'where':_0x1ff7c6[_0x4cd0('0x51')]})['then'](function(_0x585c84){_0x1ed195[_0x4cd0('0x31')]=_0x585c84;if(_0x37323d['query'][_0x4cd0('0x58')]){_0x1ff7c6['include']=[{'all':!![]}];}return db[_0x4cd0('0x72')]['findAll'](_0x1ff7c6);})[_0x4cd0('0x38')](function(_0x194342){_0x1ed195[_0x4cd0('0x59')]=_0x194342;return _0x1ed195;});}})[_0x4cd0('0x38')](respondWithFilteredResult(_0x3a4d33,_0x1ff7c6))[_0x4cd0('0x2c')](handleError(_0x3a4d33,null));};exports[_0x4cd0('0x74')]=function(_0x249a10,_0x217d08,_0x288fda){return db[_0x4cd0('0x40')]['find']({'where':{'id':_0x249a10[_0x4cd0('0x5b')]['id']}})[_0x4cd0('0x38')](handleEntityNotFound(_0x217d08,null))[_0x4cd0('0x38')](function(_0x59155c){if(_0x59155c){return _0x59155c[_0x4cd0('0x74')](_0x249a10[_0x4cd0('0x48')][_0x4cd0('0x70')]);}})[_0x4cd0('0x38')](respondWithStatusCode(_0x217d08,null))[_0x4cd0('0x2c')](handleError(_0x217d08,null));};exports[_0x4cd0('0x75')]=function(_0x45df70,_0x1dd66c,_0x578132){var _0x47cba8={'channel':'sms'};var _0x5211e9=[];var _0x1c729e=[];var _0x1ac607={};return db[_0x4cd0('0x40')][_0x4cd0('0x5e')]({'where':{'id':_0x45df70[_0x4cd0('0x5b')]['id']},'include':[{'model':db[_0x4cd0('0x76')],'as':'Applications'}]})[_0x4cd0('0x38')](handleEntityNotFound(_0x1dd66c,null))[_0x4cd0('0x38')](function(_0x28c5ba){_0x47cba8[_0x4cd0('0x77')]=_0x28c5ba;_0x47cba8['applications']=_[_0x4cd0('0x78')](_0x28c5ba[_0x4cd0('0x79')],['priority'],['asc']);if(_0x47cba8[_0x4cd0('0x77')]['Applications']){delete _0x47cba8['account'][_0x4cd0('0x79')];}return db[_0x4cd0('0x7a')][_0x4cd0('0x68')]();})[_0x4cd0('0x38')](function(_0x3c8849){if(!_0x3c8849){throw new db[(_0x4cd0('0x7b'))][(_0x4cd0('0x7c'))](_0x4cd0('0x7d'));}_0x5211e9=_['difference'](_[_0x4cd0('0x46')](_0x3c8849),[_0x4cd0('0x7e'),_0x4cd0('0x7f')]);_0x1c729e=_['difference'](_[_0x4cd0('0x46')](_0x3c8849),[_0x4cd0('0x7e'),_0x4cd0('0x7f'),_0x4cd0('0x80'),_0x4cd0('0x81')]);_0x47cba8['body']={'mapKey':_0x4cd0('0x82')};if(_0x47cba8['account'][_0x4cd0('0x43')]){switch(_0x47cba8[_0x4cd0('0x77')][_0x4cd0('0x43')]){case _0x4cd0('0x83'):_0x47cba8[_0x4cd0('0x60')]['from']=_0x45df70[_0x4cd0('0x60')][_0x4cd0('0x84')];_0x47cba8[_0x4cd0('0x60')][_0x4cd0('0x60')]=_0x45df70[_0x4cd0('0x60')][_0x4cd0('0x85')];_0x47cba8[_0x4cd0('0x60')]['messageId']=_0x45df70[_0x4cd0('0x60')][_0x4cd0('0x86')];break;case _0x4cd0('0x87'):_0x47cba8[_0x4cd0('0x60')]['from']='+'+_0x45df70[_0x4cd0('0x60')][_0x4cd0('0x88')];_0x47cba8[_0x4cd0('0x60')][_0x4cd0('0x60')]=_0x45df70[_0x4cd0('0x60')]['text'];break;case'connectel':_0x47cba8['body']['from']=_0x45df70['body']['from'];_0x47cba8['body']['body']=_0x45df70[_0x4cd0('0x60')][_0x4cd0('0x29')];break;case _0x4cd0('0x89'):_0x47cba8['body'][_0x4cd0('0x8a')]=_0x45df70[_0x4cd0('0x60')][_0x4cd0('0x8a')];_0x47cba8['body'][_0x4cd0('0x60')]=_0x45df70['body'][_0x4cd0('0x60')];_0x47cba8[_0x4cd0('0x60')][_0x4cd0('0x8b')]=_0x45df70[_0x4cd0('0x60')][_0x4cd0('0x8c')];break;case _0x4cd0('0x8d'):_0x47cba8[_0x4cd0('0x60')][_0x4cd0('0x8a')]=_0x45df70[_0x4cd0('0x60')][_0x4cd0('0x84')];_0x47cba8[_0x4cd0('0x60')][_0x4cd0('0x60')]=_0x45df70[_0x4cd0('0x60')][_0x4cd0('0x8e')];_0x47cba8[_0x4cd0('0x60')]['messageId']=_0x45df70[_0x4cd0('0x60')]['MessageUUID'];break;case _0x4cd0('0x8f'):_0x47cba8[_0x4cd0('0x60')]['from']='+'+_0x45df70[_0x4cd0('0x60')][_0x4cd0('0x90')][0x0]['from'];_0x47cba8[_0x4cd0('0x60')][_0x4cd0('0x60')]=_0x45df70['body']['results'][0x0][_0x4cd0('0x91')];_0x47cba8['body']['messageId']=_0x45df70['body'][_0x4cd0('0x90')][0x0][_0x4cd0('0x8b')];break;case'csc':_0x47cba8['body']['from']=_0x45df70['body'][_0x4cd0('0x92')];_0x47cba8['body']['body']=_0x45df70[_0x4cd0('0x60')][_0x4cd0('0x93')][_0x4cd0('0x29')];break;case _0x4cd0('0x94'):_0x47cba8[_0x4cd0('0x60')][_0x4cd0('0x8a')]=_0x45df70[_0x4cd0('0x60')][_0x4cd0('0x95')];_0x47cba8[_0x4cd0('0x60')][_0x4cd0('0x60')]=_0x45df70[_0x4cd0('0x60')][_0x4cd0('0x91')];_0x47cba8['body'][_0x4cd0('0x8b')]=_0x45df70[_0x4cd0('0x60')][_0x4cd0('0x96')];break;case _0x4cd0('0x97'):_0x47cba8[_0x4cd0('0x60')][_0x4cd0('0x8b')]=_0x45df70['body'][0x0][_0x4cd0('0x29')]['id'];_0x47cba8[_0x4cd0('0x60')]['from']=_0x45df70[_0x4cd0('0x60')][0x0][_0x4cd0('0x29')][_0x4cd0('0x8a')];_0x47cba8[_0x4cd0('0x60')][_0x4cd0('0x60')]=_0x45df70['body'][0x0][_0x4cd0('0x29')][_0x4cd0('0x91')];break;case _0x4cd0('0x98'):_0x47cba8[_0x4cd0('0x60')][_0x4cd0('0x8a')]=_0x45df70[_0x4cd0('0x60')][_0x4cd0('0x8a')];_0x47cba8[_0x4cd0('0x60')][_0x4cd0('0x60')]=_0x45df70[_0x4cd0('0x60')][_0x4cd0('0x29')];_0x47cba8[_0x4cd0('0x60')][_0x4cd0('0x8b')]=_0x45df70[_0x4cd0('0x60')][_0x4cd0('0x99')];break;}}if(_0x47cba8[_0x4cd0('0x60')]['id']){delete _0x47cba8[_0x4cd0('0x60')]['id'];}if(_['isNil'](_0x47cba8[_0x4cd0('0x60')][_0x4cd0('0x8a')])){throw new db['Sequelize']['ValidationError']('from\x20is\x20mandatory');}if(_[_0x4cd0('0x9a')](_0x47cba8[_0x4cd0('0x60')][_0x4cd0('0x60')])||_0x47cba8[_0x4cd0('0x60')][_0x4cd0('0x60')]===''){throw new db[(_0x4cd0('0x7b'))][(_0x4cd0('0x7c'))](_0x4cd0('0x9b'));}if(_['isNil'](_0x47cba8[_0x4cd0('0x60')]['mapKey'])){throw new db['Sequelize'][(_0x4cd0('0x7c'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1c729e);}if(!_[_0x4cd0('0x9c')](_0x1c729e,_0x47cba8[_0x4cd0('0x60')][_0x4cd0('0x9d')])){throw new db[(_0x4cd0('0x7b'))][(_0x4cd0('0x7c'))](_0x4cd0('0x9e')+_0x1c729e);}_0x1ac607[_0x47cba8[_0x4cd0('0x60')][_0x4cd0('0x9d')]]=_0x47cba8[_0x4cd0('0x60')][_0x4cd0('0x8a')];return db[_0x4cd0('0x9f')][_0x4cd0('0x5e')]({'where':{'id':_0x47cba8[_0x4cd0('0x77')][_0x4cd0('0x81')]},'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x1ac607,'limit':0x1,'order':[[_0x4cd0('0x7f'),_0x4cd0('0xa0')]]}]});})[_0x4cd0('0x38')](handleEntityNotFound(_0x1dd66c,null))[_0x4cd0('0x38')](function(_0x22f7cc){if(_0x22f7cc){_0x47cba8[_0x4cd0('0xa1')]=_[_0x4cd0('0xa2')](_0x22f7cc,[_0x4cd0('0xa3')]);if(_0x22f7cc[_0x4cd0('0xa3')][_0x4cd0('0x4c')]){return _0x22f7cc['Contacts'][0x0];}var _0x23df8f=_[_0x4cd0('0x1a')](_0x47cba8['body'],{'firstName':_0x47cba8[_0x4cd0('0x60')][_0x4cd0('0x8a')],'ListId':_0x22f7cc['id']});_0x23df8f[_0x47cba8[_0x4cd0('0x60')][_0x4cd0('0x9d')]]=_0x47cba8[_0x4cd0('0x60')][_0x4cd0('0x8a')];return db[_0x4cd0('0x7a')]['create'](_0x23df8f,{'fields':_0x5211e9,'raw':!![]});}})[_0x4cd0('0x38')](handleEntityNotFound(_0x1dd66c,null))[_0x4cd0('0x38')](function(_0x34c3a7){if(_0x34c3a7){_0x47cba8[_0x4cd0('0xa4')]=_0x34c3a7;var _0x58fa11={'ContactId':_0x34c3a7['id'],'phone':_0x47cba8['body'][_0x4cd0('0x8a')],'SmsAccountId':_0x45df70[_0x4cd0('0x5b')]['id']};var _0x4001c3={'ContactId':_0x34c3a7['id'],'SmsAccountId':_0x45df70[_0x4cd0('0x5b')]['id'],'closed':![]};return db[_0x4cd0('0xa5')][_0x4cd0('0x5e')]({'where':_0x4001c3})[_0x4cd0('0x38')](function(_0x4dd4ed){if(_0x4dd4ed){return[_0x4dd4ed,![]];}return db[_0x4cd0('0xa5')][_0x4cd0('0x5f')](_0x58fa11)[_0x4cd0('0x38')](function(_0x96655a){return[_0x96655a,!![]];});});}})[_0x4cd0('0xa6')](function(_0x94e724,_0xe16ffe){_0x47cba8[_0x4cd0('0xa7')]=_0x94e724['get']({'plain':!![]});_0x47cba8[_0x4cd0('0xa7')][_0x4cd0('0xa8')]=![];if(_0xe16ffe){if(_0x47cba8[_0x4cd0('0x77')][_0x4cd0('0xa9')]){_0x47cba8[_0x4cd0('0xaa')][_0x4cd0('0xab')]({'id':0x0,'priority':_0x47cba8[_0x4cd0('0xaa')][_0x4cd0('0x4c')]+0x1,'app':_0x4cd0('0xac'),'appdata':_0x4cd0('0xad'),'interval':_0x4cd0('0xae')});}_0x47cba8[_0x4cd0('0xa7')][_0x4cd0('0xa8')]=!![];}return db[_0x4cd0('0xaf')][_0x4cd0('0x5f')]({'phone':_0x47cba8[_0x4cd0('0x60')]['from'],'messageId':_0x47cba8[_0x4cd0('0x60')][_0x4cd0('0x8b')],'body':_0x47cba8[_0x4cd0('0x60')][_0x4cd0('0x60')],'SmsAccountId':_0x45df70['params']['id'],'SmsInteractionId':_0x94e724['id'],'direction':'in','ContactId':_0x94e724[_0x4cd0('0xb0')],'AttachmentId':_0x47cba8['body'][_0x4cd0('0xb1')]});})[_0x4cd0('0x38')](function(_0x2b9aa7){_0x47cba8[_0x4cd0('0x29')]=_0x2b9aa7;if(_0x47cba8[_0x4cd0('0xa7')][_0x4cd0('0xb2')]){return db['User'][_0x4cd0('0x5e')]({'attributes':['id',_0x4cd0('0x3c')],'where':{'id':_0x47cba8['interaction'][_0x4cd0('0xb2')]}})[_0x4cd0('0x38')](function(_0x3501be){if(_0x3501be){_0x47cba8[_0x4cd0('0xaa')][_0x4cd0('0xb3')]({'id':0x0,'priority':0x0,'app':_0x4cd0('0xb4'),'appdata':_0x3501be[_0x4cd0('0x3c')]+','+(_0x47cba8[_0x4cd0('0x77')][_0x4cd0('0xb5')]||0xa),'interval':_0x4cd0('0xae')});}return respondWithRpcPromise(_0x4cd0('0xb6'),_0x4cd0('0xb7'),_0x47cba8);});}return respondWithRpcPromise(_0x4cd0('0xb6'),_0x4cd0('0xb7'),_0x47cba8);})[_0x4cd0('0x38')](function(_0x3f2411){if(_0x3f2411){var _0x1a2b7b=0xc8;var _0x4d1f07=_0x4cd0('0xb8');logger[_0x4cd0('0x2a')](_0x4cd0('0x26'),_0x4d1f07,_0x1a2b7b,_0x4cd0('0xb9'));logger[_0x4cd0('0x25')](_0x4cd0('0xba'),_0x4d1f07,_0x1a2b7b,_0x4cd0('0xb9'),JSON[_0x4cd0('0x27')](_0x3f2411));if(_0x47cba8[_0x4cd0('0x77')][_0x4cd0('0x43')]==='twilio'){return _0x1dd66c[_0x4cd0('0x2d')](_0x1a2b7b)['set'](_0x4cd0('0xbb'),'text/xml')[_0x4cd0('0x3d')]('\x0a');}else{return _0x1dd66c['status'](_0x1a2b7b)[_0x4cd0('0x35')](_0x3f2411);}}})[_0x4cd0('0x2c')](handleError(_0x1dd66c,null));};exports['addApplications']=function(_0x3bfdf5,_0x325010){var _0x2233fa=_0x3bfdf5['params']['id'];var _0x4461f5=_0x3bfdf5['body'];var _0x2edfc6=0xc8;var _0x4f6cf5=null;return db[_0x4cd0('0xbc')][_0x4cd0('0xbd')]({'isolationLevel':db['sequelize']['Transaction']['ISOLATION_LEVELS'][_0x4cd0('0xbe')]},function(_0x5d8a10){return db[_0x4cd0('0x40')][_0x4cd0('0x6b')]({'where':{'id':_0x2233fa},'transaction':_0x5d8a10})[_0x4cd0('0x38')](function(_0x3ae0ab){if(_0x3ae0ab){return db[_0x4cd0('0x76')]['destroy']({'where':{'SmsAccountId':_0x2233fa},'transaction':_0x5d8a10})[_0x4cd0('0x38')](function(){var _0x271c3a=_[_0x4cd0('0x54')](_0x4461f5,function(_0x3a9598){_0x3a9598[_0x4cd0('0x6d')]=_0x2233fa;return _0x3a9598;});return db[_0x4cd0('0x76')][_0x4cd0('0xbf')](_0x271c3a,{'transaction':_0x5d8a10});});}else{_0x2edfc6=0x194;_0x4f6cf5=[];}});})[_0x4cd0('0x38')](function(){if(_0x2edfc6!==0x194){return db[_0x4cd0('0x76')]['findAndCountAll']({'where':{'SmsAccountId':_0x2233fa},'order':'priority'})[_0x4cd0('0x38')](function(_0x483854){_0x4f6cf5=_0x483854;});}})[_0x4cd0('0x2c')](function(_0x3e6649){_0x2edfc6=0x1f4;logger[_0x4cd0('0x28')](_0x3e6649[_0x4cd0('0x3b')]);if(_0x3e6649[_0x4cd0('0x3c')]){delete _0x3e6649[_0x4cd0('0x3c')];}_0x4f6cf5=_0x3e6649;})['finally'](function(){if(_0x4f6cf5===null){_0x325010[_0x4cd0('0xc0')](_0x2edfc6);}else{if(_0x2edfc6===0x1f4){_0x325010[_0x4cd0('0x2d')](_0x2edfc6)['send'](_0x4f6cf5);}else{_0x325010[_0x4cd0('0x2d')](_0x2edfc6)[_0x4cd0('0x35')](_0x4f6cf5);}}});};exports[_0x4cd0('0xc1')]=function(_0x2d094a,_0x35071e,_0x251ae9){var _0x5f0a7b={};var _0xc29f87={};var _0x40ae1c;var _0x171f11;return db[_0x4cd0('0x40')][_0x4cd0('0x6b')]({'where':{'id':_0x2d094a[_0x4cd0('0x5b')]['id']}})[_0x4cd0('0x38')](handleEntityNotFound(_0x35071e,null))[_0x4cd0('0x38')](function(_0x5835c3){if(_0x5835c3){_0x40ae1c=_0x5835c3;_0xc29f87[_0x4cd0('0x45')]=_[_0x4cd0('0x46')](db[_0x4cd0('0x76')][_0x4cd0('0x41')]);_0xc29f87[_0x4cd0('0x48')]=_[_0x4cd0('0x46')](_0x2d094a[_0x4cd0('0x48')]);_0xc29f87[_0x4cd0('0x47')]=_[_0x4cd0('0x4a')](_0xc29f87['model'],_0xc29f87['query']);_0x5f0a7b['attributes']=_[_0x4cd0('0x4a')](_0xc29f87['model'],qs[_0x4cd0('0x4b')](_0x2d094a[_0x4cd0('0x48')][_0x4cd0('0x4b')]));_0x5f0a7b['attributes']=_0x5f0a7b[_0x4cd0('0x49')]['length']?_0x5f0a7b['attributes']:_0xc29f87[_0x4cd0('0x45')];_0x5f0a7b[_0x4cd0('0x4f')]=qs[_0x4cd0('0x50')](_0x2d094a['query'][_0x4cd0('0x50')]);_0x5f0a7b[_0x4cd0('0x51')]=qs['filters'](_[_0x4cd0('0x52')](_0x2d094a[_0x4cd0('0x48')],_0xc29f87[_0x4cd0('0x47')]));if(_0x2d094a['query'][_0x4cd0('0x53')]){_0x5f0a7b[_0x4cd0('0x51')]=_[_0x4cd0('0x56')](_0x5f0a7b['where'],{'$or':_[_0x4cd0('0x54')](_0x5f0a7b[_0x4cd0('0x49')],function(_0x4c182d){var _0x45caa5={};_0x45caa5[_0x4c182d]={'$like':'%'+_0x2d094a['query'][_0x4cd0('0x53')]+'%'};return _0x45caa5;})});}_0x5f0a7b=_['merge']({},_0x5f0a7b,_0x2d094a[_0x4cd0('0x57')]);return _0x40ae1c[_0x4cd0('0xc1')](_0x5f0a7b);}})[_0x4cd0('0x38')](function(_0x542722){if(_0x542722){_0x171f11=_0x542722[_0x4cd0('0x4c')];if(!_0x2d094a['query'][_0x4cd0('0x4d')]('nolimit')){_0x5f0a7b[_0x4cd0('0x32')]=qs[_0x4cd0('0x32')](_0x2d094a['query'][_0x4cd0('0x32')]);_0x5f0a7b[_0x4cd0('0x2f')]=qs['offset'](_0x2d094a[_0x4cd0('0x48')][_0x4cd0('0x2f')]);}return _0x40ae1c['getApplications'](_0x5f0a7b);}})['then'](function(_0x165458){if(_0x165458){return _0x165458?{'count':_0x171f11,'rows':_0x165458}:null;}})[_0x4cd0('0x38')](respondWithResult(_0x35071e,null))[_0x4cd0('0x2c')](handleError(_0x35071e,null));};exports['getInteractions']=function(_0x2448d9,_0x75861d,_0x420ded){var _0x4e3803={'raw':![],'where':{}};var _0x272c7e={};var _0x18a7d8={'count':0x0,'rows':[]};return db[_0x4cd0('0x40')][_0x4cd0('0x6b')]({'where':{'id':_0x2448d9[_0x4cd0('0x5b')]['id']}})['then'](handleEntityNotFound(_0x75861d,null))['then'](function(_0x4feae4){if(_0x4feae4){_0x272c7e[_0x4cd0('0x45')]=_['keys'](db[_0x4cd0('0xa5')]['rawAttributes']);_0x272c7e[_0x4cd0('0x48')]=_[_0x4cd0('0x46')](_0x2448d9[_0x4cd0('0x48')]);_0x272c7e[_0x4cd0('0x47')]=_[_0x4cd0('0x4a')](_0x272c7e[_0x4cd0('0x45')],_0x272c7e[_0x4cd0('0x48')]);_0x4e3803[_0x4cd0('0x49')]=_[_0x4cd0('0x4a')](_0x272c7e['model'],qs[_0x4cd0('0x4b')](_0x2448d9[_0x4cd0('0x48')][_0x4cd0('0x4b')]));_0x4e3803[_0x4cd0('0x49')]=_0x4e3803[_0x4cd0('0x49')][_0x4cd0('0x4c')]?_0x4e3803[_0x4cd0('0x49')]:_0x272c7e['model'];if(!_0x2448d9['query'][_0x4cd0('0x4d')](_0x4cd0('0x4e'))){_0x4e3803['limit']=qs['limit'](_0x2448d9[_0x4cd0('0x48')][_0x4cd0('0x32')]);_0x4e3803[_0x4cd0('0x2f')]=qs[_0x4cd0('0x2f')](_0x2448d9[_0x4cd0('0x48')][_0x4cd0('0x2f')]);}_0x4e3803[_0x4cd0('0x4f')]=qs[_0x4cd0('0x50')](_0x2448d9[_0x4cd0('0x48')][_0x4cd0('0x50')]);_0x4e3803[_0x4cd0('0x51')]=qs[_0x4cd0('0x47')](_[_0x4cd0('0x52')](_0x2448d9[_0x4cd0('0x48')],_0x272c7e['filters']));_0x4e3803[_0x4cd0('0x51')]['SmsAccountId']=_0x4feae4['id'];if(_0x2448d9[_0x4cd0('0x48')][_0x4cd0('0x53')]){_0x4e3803[_0x4cd0('0x51')]=_[_0x4cd0('0x56')](_0x4e3803[_0x4cd0('0x51')],{'$or':_[_0x4cd0('0x54')](_0x4e3803['attributes'],function(_0x27330f){var _0xad5a7={};_0xad5a7[_0x27330f]={'$like':'%'+_0x2448d9[_0x4cd0('0x48')][_0x4cd0('0x53')]+'%'};return _0xad5a7;})});}_0x4e3803=_['merge']({},_0x4e3803,_0x2448d9[_0x4cd0('0x57')]);return db[_0x4cd0('0xa5')]['count']({'where':_0x4e3803[_0x4cd0('0x51')]})['then'](function(_0x308454){_0x18a7d8[_0x4cd0('0x31')]=_0x308454;if(_0x2448d9[_0x4cd0('0x48')]['includeAll']){_0x4e3803[_0x4cd0('0x5d')]=[{'model':db[_0x4cd0('0x7a')],'as':_0x4cd0('0xc2'),'required':![]},{'model':db[_0x4cd0('0xc3')],'as':'Owner','attributes':[_0x4cd0('0x3c'),'fullname',_0x4cd0('0xc4')],'required':![]},{'model':db[_0x4cd0('0xc5')],'as':_0x4cd0('0xc6'),'attributes':['id',_0x4cd0('0x3c'),_0x4cd0('0xc7')],'where':_0x2448d9['query']['tag']?{'id':_0x2448d9[_0x4cd0('0x48')][_0x4cd0('0xc8')]}:undefined,'required':_0x2448d9[_0x4cd0('0x48')][_0x4cd0('0xc8')]?!![]:![]}];}return db[_0x4cd0('0xa5')][_0x4cd0('0x6e')](_0x4e3803);})[_0x4cd0('0x38')](function(_0x1574a4){_0x18a7d8[_0x4cd0('0x59')]=_0x1574a4;return _0x18a7d8;});}})[_0x4cd0('0x38')](respondWithFilteredResult(_0x75861d,_0x4e3803))['catch'](handleError(_0x75861d,null));};exports['send']=function(_0x4f2a18,_0x1d5d89,_0x3c597c){var _0xd6ecab,_0x417651,_0x17922e;if(_[_0x4cd0('0x9a')](_0x4f2a18[_0x4cd0('0x60')][_0x4cd0('0x60')])||_0x4f2a18[_0x4cd0('0x60')]['body']===''){throw new db['Sequelize']['ValidationError'](_0x4cd0('0x9b'));}if(_[_0x4cd0('0x9a')](_0x4f2a18[_0x4cd0('0x60')]['to'])){throw new db['Sequelize']['ValidationError']('to\x20is\x20mandatory');}_0xd6ecab=_0x4f2a18[_0x4cd0('0x60')]['to'];return db[_0x4cd0('0x40')][_0x4cd0('0x5e')]({'where':{'id':_0x4f2a18[_0x4cd0('0x5b')]['id']},'include':[{'model':db[_0x4cd0('0x9f')],'as':'List','include':[{'model':db[_0x4cd0('0x7a')],'as':_0x4cd0('0xa3'),'where':{'mobile':_0xd6ecab},'limit':0x1,'order':[[_0x4cd0('0x7f'),_0x4cd0('0xa0')]]}]}]})[_0x4cd0('0x38')](handleEntityNotFound(_0x1d5d89,null))['then'](function(_0x48c4fd){if(_0x48c4fd&&_0x48c4fd['List']){_0x417651=_0x48c4fd[_0x4cd0('0x62')]({'plain':!![]});if(_0x417651['List']&&_0x417651[_0x4cd0('0xc9')][_0x4cd0('0xa3')][_0x4cd0('0x4c')]){return _0x417651[_0x4cd0('0xc9')][_0x4cd0('0xa3')][0x0];}return db[_0x4cd0('0x7a')][_0x4cd0('0x5f')](_['defaults'](_0x4f2a18[_0x4cd0('0x60')],{'firstName':_0xd6ecab,'mobile':_0xd6ecab,'phone':_0xd6ecab,'ListId':_0x417651[_0x4cd0('0x81')]}));}})[_0x4cd0('0x38')](handleEntityNotFound(_0x1d5d89,null))['then'](function(_0x218662){if(_0x218662){_0x17922e=_0x218662;return db[_0x4cd0('0xa5')]['find']({'where':{'ContactId':_0x17922e['id'],'closed':![],'SmsAccountId':_0x417651['id']}})[_0x4cd0('0x38')](function(_0x5d3cc1){if(_0x5d3cc1){return[_0x5d3cc1,![]];}return db[_0x4cd0('0xa5')][_0x4cd0('0x5f')]({'UserId':_0x4f2a18[_0x4cd0('0x61')]['id'],'ContactId':_0x17922e['id'],'SmsAccountId':_0x417651['id'],'phone':_0xd6ecab,'firstMsgDirection':_0x4cd0('0xca'),'Messages':[_[_0x4cd0('0x56')](_0x4f2a18[_0x4cd0('0x60')],{'read':![],'body':_0x4f2a18[_0x4cd0('0x60')]['body'],'phone':_0xd6ecab,'SmsAccountId':_0x417651['id'],'UserId':_0x4f2a18['user']['id'],'ContactId':_0x17922e['id']})]},{'include':[{'model':db[_0x4cd0('0xaf')],'as':_0x4cd0('0xcb')}]})[_0x4cd0('0x38')](function(_0x5cc0b3){return[_0x5cc0b3,!![]];});});}})[_0x4cd0('0xa6')](function(_0x34f88d,_0x44eddc){if(_0x44eddc){return _0x34f88d;}return db[_0x4cd0('0xaf')]['create'](_[_0x4cd0('0x56')](_0x4f2a18['body'],{'read':![],'body':_0x4f2a18[_0x4cd0('0x60')][_0x4cd0('0x60')],'phone':_0xd6ecab,'SmsAccountId':_0x417651['id'],'SmsInteractionId':_0x34f88d['id'],'UserId':_0x4f2a18['user']['id'],'ContactId':_0x17922e['id']}))[_0x4cd0('0x38')](function(_0x5e3e38){_0x34f88d['dataValues']['Messages']=[];_0x34f88d['dataValues'][_0x4cd0('0xcb')][_0x4cd0('0xab')](_0x5e3e38[_0x4cd0('0xcc')]);return _0x34f88d;});})[_0x4cd0('0x38')](respondWithResult(_0x1d5d89,null))[_0x4cd0('0x2c')](handleError(_0x1d5d89,null));};exports[_0x4cd0('0x2d')]=function(_0x158ad7,_0x22c65a,_0x323c65){if(_0x158ad7['body']['id']){delete _0x158ad7[_0x4cd0('0x60')]['id'];}var _0x417ea5,_0x3e6436,_0x40d257;return db[_0x4cd0('0x40')][_0x4cd0('0x5e')]({'where':{'id':_0x158ad7[_0x4cd0('0x5b')]['id']}})[_0x4cd0('0x38')](handleEntityNotFound(_0x22c65a,null))[_0x4cd0('0x38')](function(_0xd3f401){if(_0xd3f401){_0x40d257=_0xd3f401;logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x4cd0('0x2d'),'received\x20delivery\x20report\x20from',_0xd3f401[_0x4cd0('0x43')],util[_0x4cd0('0xcd')](_0x158ad7['body'],{'showHidden':![],'depth':null}));switch(_0xd3f401['type']){case _0x4cd0('0x87'):if(_0x158ad7['body'][_0x4cd0('0xce')]&&_0x158ad7[_0x4cd0('0x60')][_0x4cd0('0x2d')]){_0x3e6436=_0x158ad7[_0x4cd0('0x60')][_0x4cd0('0x2d')];return db[_0x4cd0('0xaf')][_0x4cd0('0x5e')]({'where':{'messageId':_0x158ad7['body'][_0x4cd0('0xce')]}});}break;case _0x4cd0('0xcf'):if(_0x158ad7[_0x4cd0('0x60')]['requestid']&&_0x158ad7[_0x4cd0('0x60')][_0x4cd0('0xd0')]){_0x3e6436=_0x158ad7[_0x4cd0('0x60')]['statusInt'];return db[_0x4cd0('0xaf')][_0x4cd0('0x5e')]({'where':{'messageId':_0x158ad7[_0x4cd0('0x60')]['requestid']}});}break;case _0x4cd0('0x89'):if(_0x158ad7[_0x4cd0('0x60')][_0x4cd0('0x8c')]&&_0x158ad7['body'][_0x4cd0('0xd1')]){_0x3e6436=_0x158ad7['body']['status_code'];return db[_0x4cd0('0xaf')][_0x4cd0('0x5e')]({'where':{'messageId':_0x158ad7[_0x4cd0('0x60')][_0x4cd0('0x8c')]}});}break;case _0x4cd0('0x8f'):var _0x317220=_0x158ad7['body'][_0x4cd0('0x90')][0x0];if(_0x317220[_0x4cd0('0x8b')]&&_0x317220[_0x4cd0('0x2d')]['groupName']===_0x4cd0('0xd2')){_0x3e6436=_0x317220[_0x4cd0('0x2d')]['groupName'];return db[_0x4cd0('0xaf')]['find']({'where':{'messageId':_0x317220[_0x4cd0('0x8b')]}});}break;case'clickatell':if(_0x158ad7[_0x4cd0('0x60')][_0x4cd0('0x8b')]&&_0x158ad7[_0x4cd0('0x60')][_0x4cd0('0x2d')]){_0x3e6436=_0x158ad7['body']['status'];return db[_0x4cd0('0xaf')][_0x4cd0('0x5e')]({'where':{'messageId':_0x158ad7[_0x4cd0('0x60')][_0x4cd0('0x8b')]}});}break;case _0x4cd0('0x97'):if(_0x158ad7[_0x4cd0('0x60')][0x0][_0x4cd0('0x29')]['id']){_0x3e6436=_0x158ad7[_0x4cd0('0x60')][0x0]['type'];return db['SmsMessage'][_0x4cd0('0x5e')]({'where':{'messageId':_0x158ad7['body'][0x0][_0x4cd0('0x29')]['id']}});}break;case _0x4cd0('0x98'):if(_0x158ad7[_0x4cd0('0x60')][_0x4cd0('0xd3')]&&_0x158ad7[_0x4cd0('0x60')][_0x4cd0('0x2d')]){_0x3e6436=_0x158ad7[_0x4cd0('0x60')]['status'];return db[_0x4cd0('0xaf')][_0x4cd0('0x5e')]({'where':{'messageId':_0x158ad7[_0x4cd0('0x60')]['redif']}});}break;}}})[_0x4cd0('0x38')](handleEntityNotFound(_0x22c65a,null))['then'](function(_0x11bc9b){if(_0x11bc9b){_0x417ea5=_0x11bc9b;switch(_0x40d257[_0x4cd0('0x43')]){case _0x4cd0('0x87'):if(_0x3e6436==='DELIVERED'){return _0x417ea5[_0x4cd0('0x37')]({'read':!![]});}else{logger['error'](_0x4cd0('0x26'),_0x4cd0('0x2d'),_0x4cd0('0x87'),util['inspect'](_0x158ad7[_0x4cd0('0x60')],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0x3e6436==='1'){return _0x417ea5[_0x4cd0('0x37')]({'read':!![]});}else{logger[_0x4cd0('0x28')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x4cd0('0x2d'),'skebby',util[_0x4cd0('0xcd')](_0x158ad7['body'],{'showHidden':![],'depth':null}));}break;case _0x4cd0('0x89'):if(!_0x158ad7['body'][_0x4cd0('0xd4')]&&_0x3e6436>=0xc8&&_0x3e6436<=0xce){return _0x417ea5[_0x4cd0('0x37')]({'read':!![]});}else{logger['error'](_0x4cd0('0x26'),_0x4cd0('0x2d'),_0x4cd0('0x89'),util[_0x4cd0('0xcd')](_0x158ad7[_0x4cd0('0x60')],{'showHidden':![],'depth':null}));}break;case _0x4cd0('0x8f'):var _0x47b5ec=_0x158ad7[_0x4cd0('0x60')][_0x4cd0('0x90')][0x0];if(_0x47b5ec[_0x4cd0('0x2d')][_0x4cd0('0xd5')]===_0x4cd0('0xd2')){return _0x417ea5[_0x4cd0('0x37')]({'read':!![]});}else{logger[_0x4cd0('0x28')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x4cd0('0x2d'),'infobip',util[_0x4cd0('0xcd')](_0x158ad7[_0x4cd0('0x60')],{'showHidden':![],'depth':null}));}break;case _0x4cd0('0x94'):if(_0x3e6436==_0x4cd0('0xd6')||_0x3e6436==_0x4cd0('0xd7')){return _0x417ea5['update']({'read':!![]});}else{logger[_0x4cd0('0x28')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x4cd0('0x2d'),_0x4cd0('0x94'),util[_0x4cd0('0xcd')](_0x158ad7[_0x4cd0('0x60')],{'showHidden':![],'depth':null}));}break;case _0x4cd0('0x97'):if(_0x3e6436=='message-delivered'){return _0x417ea5['update']({'read':!![]});}else{logger[_0x4cd0('0x28')](_0x4cd0('0x26'),'status',_0x4cd0('0x97'),util['inspect'](_0x158ad7[_0x4cd0('0x60')],{'showHidden':![],'depth':null}));}break;case _0x4cd0('0x98'):if(_0x3e6436===_0x4cd0('0xd8')||_0x3e6436===_0x4cd0('0xd9')){return _0x417ea5[_0x4cd0('0x37')]({'read':!![]});}else{logger[_0x4cd0('0x28')](_0x4cd0('0x26'),_0x4cd0('0x2d'),'intelepeer',util[_0x4cd0('0xcd')](_0x158ad7['body'],{'showHidden':![],'depth':null}));}break;}return _0x417ea5;}})[_0x4cd0('0x38')](respondWithResult(_0x22c65a,null))['catch'](handleError(_0x22c65a,null));};exports[_0x4cd0('0xda')]=function(_0x43177f,_0x195a95,_0x524c4e){var _0x1536c8,_0x5dfeca,_0x32f6b2;return db[_0x4cd0('0x40')][_0x4cd0('0x5e')]({'where':{'id':_0x43177f['params']['id']}})[_0x4cd0('0x38')](handleEntityNotFound(_0x195a95,null))[_0x4cd0('0x38')](function(_0x100637){if(_0x100637){_0x32f6b2=_0x100637;logger[_0x4cd0('0x25')](_0x4cd0('0x26'),'status',_0x4cd0('0xdb'),_0x100637[_0x4cd0('0x43')],util[_0x4cd0('0xcd')](_0x43177f[_0x4cd0('0x48')],{'showHidden':![],'depth':null}));switch(_0x100637[_0x4cd0('0x43')]){case _0x4cd0('0xdc'):if(_0x43177f[_0x4cd0('0x48')]['message-id']&&_0x43177f['query'][_0x4cd0('0xdd')]){_0x5dfeca=_0x43177f[_0x4cd0('0x48')][_0x4cd0('0xdd')];return db['SmsMessage'][_0x4cd0('0x5e')]({'where':{'messageId':_0x43177f[_0x4cd0('0x48')]['message-id']}});}break;}}})[_0x4cd0('0x38')](handleEntityNotFound(_0x195a95,null))['then'](function(_0x25ff69){if(_0x25ff69){_0x1536c8=_0x25ff69;switch(_0x32f6b2['type']){case'csc':if(_0x5dfeca==='2'||_0x5dfeca==='6'){return _0x1536c8[_0x4cd0('0x37')]({'read':!![]});}else{logger[_0x4cd0('0x28')](_0x4cd0('0x26'),'status',_0x4cd0('0xdc'),util['inspect'](_0x43177f[_0x4cd0('0x48')],{'showHidden':![],'depth':null}));};break;}return _0x1536c8;}})[_0x4cd0('0x38')](respondWithResult(_0x195a95,null))['catch'](handleError(_0x195a95,null));};exports[_0x4cd0('0xde')]=function(_0x181d32,_0x283369,_0x23fe3b){return db['SmsAccount']['find']({'where':{'id':_0x181d32['params']['id']}})[_0x4cd0('0x38')](handleEntityNotFound(_0x283369,null))[_0x4cd0('0x38')](function(_0x18d8cf){if(_0x18d8cf){return _0x18d8cf[_0x4cd0('0xde')](_0x181d32[_0x4cd0('0x60')][_0x4cd0('0x70')],_[_0x4cd0('0xa2')](_0x181d32[_0x4cd0('0x60')],[_0x4cd0('0x70'),'id'])||{})['spread'](function(_0x4b1574){for(var _0x2bd4c6=0x0;_0x2bd4c6<_0x181d32[_0x4cd0('0x60')][_0x4cd0('0x70')][_0x4cd0('0x4c')];_0x2bd4c6+=0x1){socket[_0x4cd0('0xdf')]('userSmsAccount:save',{'UserId':Number(_0x181d32[_0x4cd0('0x60')]['ids'][_0x2bd4c6]),'SmsAccountId':Number(_0x181d32['params']['id'])});}return _0x4b1574;});}})['then'](respondWithResult(_0x283369,null))[_0x4cd0('0x2c')](handleError(_0x283369,null));};exports[_0x4cd0('0xe0')]=function(_0xf9c8f4,_0x36f324,_0x4de66a){return db[_0x4cd0('0x40')][_0x4cd0('0x5e')]({'where':{'id':_0xf9c8f4[_0x4cd0('0x5b')]['id']}})['then'](handleEntityNotFound(_0x36f324,null))['then'](function(_0x26d097){if(_0x26d097){return _0x26d097[_0x4cd0('0xe0')](_0xf9c8f4[_0x4cd0('0x48')]['ids'])[_0x4cd0('0x38')](function(){if(_['isArray'](_0xf9c8f4[_0x4cd0('0x48')][_0x4cd0('0x70')])){for(var _0x44f156=0x0;_0x44f156<_0xf9c8f4[_0x4cd0('0x48')][_0x4cd0('0x70')][_0x4cd0('0x4c')];_0x44f156+=0x1){socket[_0x4cd0('0xdf')]('userSmsAccount:remove',{'UserId':Number(_0xf9c8f4[_0x4cd0('0x48')][_0x4cd0('0x70')][_0x44f156]),'SmsAccountId':Number(_0xf9c8f4['params']['id'])});}}else{socket[_0x4cd0('0xdf')](_0x4cd0('0xe1'),{'UserId':Number(_0xf9c8f4[_0x4cd0('0x48')][_0x4cd0('0x70')]),'SmsAccountId':Number(_0xf9c8f4[_0x4cd0('0x5b')]['id'])});}});}})['then'](respondWithStatusCode(_0x36f324,null))[_0x4cd0('0x2c')](handleError(_0x36f324,null));};exports[_0x4cd0('0xe2')]=function(_0xf32261,_0x158044,_0x463f93){var _0xc78fdc={};var _0x2c1837={};var _0x23db52;var _0x39f174;return db[_0x4cd0('0x40')][_0x4cd0('0x6b')]({'where':{'id':_0xf32261['params']['id']}})[_0x4cd0('0x38')](handleEntityNotFound(_0x158044,null))[_0x4cd0('0x38')](function(_0x49dcab){if(_0x49dcab){_0x23db52=_0x49dcab;_0x2c1837['model']=_[_0x4cd0('0x46')](db[_0x4cd0('0xc3')][_0x4cd0('0x41')]);_0x2c1837[_0x4cd0('0x48')]=_['keys'](_0xf32261[_0x4cd0('0x48')]);_0x2c1837[_0x4cd0('0x47')]=_[_0x4cd0('0x4a')](_0x2c1837[_0x4cd0('0x45')],_0x2c1837[_0x4cd0('0x48')]);_0xc78fdc[_0x4cd0('0x49')]=_[_0x4cd0('0x4a')](_0x2c1837[_0x4cd0('0x45')],qs[_0x4cd0('0x4b')](_0xf32261[_0x4cd0('0x48')][_0x4cd0('0x4b')]));_0xc78fdc[_0x4cd0('0x49')]=_0xc78fdc[_0x4cd0('0x49')][_0x4cd0('0x4c')]?_0xc78fdc[_0x4cd0('0x49')]:_0x2c1837[_0x4cd0('0x45')];_0xc78fdc['order']=qs['sort'](_0xf32261[_0x4cd0('0x48')][_0x4cd0('0x50')]);_0xc78fdc[_0x4cd0('0x51')]=qs['filters'](_['pick'](_0xf32261[_0x4cd0('0x48')],_0x2c1837[_0x4cd0('0x47')]));if(_0xf32261['query'][_0x4cd0('0x53')]){_0xc78fdc[_0x4cd0('0x51')]=_['merge'](_0xc78fdc[_0x4cd0('0x51')],{'$or':_[_0x4cd0('0x54')](_0xc78fdc[_0x4cd0('0x49')],function(_0x56e3c0){var _0x528fa3={};_0x528fa3[_0x56e3c0]={'$like':'%'+_0xf32261['query'][_0x4cd0('0x53')]+'%'};return _0x528fa3;})});}_0xc78fdc=_['merge']({},_0xc78fdc,_0xf32261[_0x4cd0('0x57')]);return _0x23db52[_0x4cd0('0xe2')](_0xc78fdc);}})[_0x4cd0('0x38')](function(_0x2496f5){if(_0x2496f5){_0x39f174=_0x2496f5['length'];if(!_0xf32261[_0x4cd0('0x48')][_0x4cd0('0x4d')](_0x4cd0('0x4e'))){_0xc78fdc['limit']=qs[_0x4cd0('0x32')](_0xf32261['query'][_0x4cd0('0x32')]);_0xc78fdc[_0x4cd0('0x2f')]=qs['offset'](_0xf32261['query'][_0x4cd0('0x2f')]);}return _0x23db52[_0x4cd0('0xe2')](_0xc78fdc);}})[_0x4cd0('0x38')](function(_0x26f7ef){if(_0x26f7ef){return _0x26f7ef?{'count':_0x39f174,'rows':_0x26f7ef}:null;}})[_0x4cd0('0x38')](respondWithResult(_0x158044,null))['catch'](handleError(_0x158044,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 2b8eef3..9a34808 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 _0xdc46=['exports','events','../../mysqldb','SmsAccount','save','remove','emit','hasOwnProperty'];(function(_0x1e6e07,_0x372e98){var _0x4b3b9d=function(_0xb87b93){while(--_0xb87b93){_0x1e6e07['push'](_0x1e6e07['shift']());}};_0x4b3b9d(++_0x372e98);}(_0xdc46,0x141));var _0x6dc4=function(_0x54c87f,_0x815985){_0x54c87f=_0x54c87f-0x0;var _0x524173=_0xdc46[_0x54c87f];return _0x524173;};'use strict';var EventEmitter=require(_0x6dc4('0x0'));var SmsAccount=require(_0x6dc4('0x1'))['db'][_0x6dc4('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6dc4('0x3'),'afterUpdate':'update','afterDestroy':_0x6dc4('0x4')};function emitEvent(_0x387ccb){return function(_0x42bebe,_0x4b1d37,_0x5015b5){SmsAccountEvents['emit'](_0x387ccb+':'+_0x42bebe['id'],_0x42bebe);SmsAccountEvents[_0x6dc4('0x5')](_0x387ccb,_0x42bebe);_0x5015b5(null);};}for(var e in events){if(events[_0x6dc4('0x6')](e)){var event=events[e];SmsAccount['hook'](e,emitEvent(event));}}module[_0x6dc4('0x7')]=SmsAccountEvents; \ No newline at end of file +var _0xe5fe=['SmsAccount','setMaxListeners','save','update','remove','hasOwnProperty','events','../../mysqldb'];(function(_0x3c5203,_0x63fb03){var _0x46c93e=function(_0x593edd){while(--_0x593edd){_0x3c5203['push'](_0x3c5203['shift']());}};_0x46c93e(++_0x63fb03);}(_0xe5fe,0xe6));var _0xee5f=function(_0x70297b,_0x21dc91){_0x70297b=_0x70297b-0x0;var _0x37dbfc=_0xe5fe[_0x70297b];return _0x37dbfc;};'use strict';var EventEmitter=require(_0xee5f('0x0'));var SmsAccount=require(_0xee5f('0x1'))['db'][_0xee5f('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xee5f('0x3')](0x0);var events={'afterCreate':_0xee5f('0x4'),'afterUpdate':_0xee5f('0x5'),'afterDestroy':_0xee5f('0x6')};function emitEvent(_0x52e578){return function(_0x1fdb32,_0x526f41,_0x1c61a2){SmsAccountEvents['emit'](_0x52e578+':'+_0x1fdb32['id'],_0x1fdb32);SmsAccountEvents['emit'](_0x52e578,_0x1fdb32);_0x1c61a2(null);};}for(var e in events){if(events[_0xee5f('0x7')](e)){var event=events[e];SmsAccount['hook'](e,emitEvent(event));}}module['exports']=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index f80ceda..34165b5 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 _0x1544=['exports','define','SmsAccount','sms_accounts','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./smsAccount.attributes'];(function(_0x146915,_0x32dda1){var _0x1a463a=function(_0x173c96){while(--_0x173c96){_0x146915['push'](_0x146915['shift']());}};_0x1a463a(++_0x32dda1);}(_0x1544,0x115));var _0x4154=function(_0x4f6610,_0x11d9ae){_0x4f6610=_0x4f6610-0x0;var _0x44e7d3=_0x1544[_0x4f6610];return _0x44e7d3;};'use strict';var _=require(_0x4154('0x0'));var util=require(_0x4154('0x1'));var logger=require(_0x4154('0x2'))(_0x4154('0x3'));var moment=require(_0x4154('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4154('0x5'));var rimraf=require(_0x4154('0x6'));var config=require(_0x4154('0x7'));var attributes=require(_0x4154('0x8'));module[_0x4154('0x9')]=function(_0x75049c,_0x37e3f2){return _0x75049c[_0x4154('0xa')](_0x4154('0xb'),attributes,{'tableName':_0x4154('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5db0=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsAccount.attributes','exports','define','SmsAccount','sms_accounts'];(function(_0x1aeda2,_0x1217eb){var _0x32dc6d=function(_0x34a460){while(--_0x34a460){_0x1aeda2['push'](_0x1aeda2['shift']());}};_0x32dc6d(++_0x1217eb);}(_0x5db0,0x142));var _0x05db=function(_0x1f9402,_0x3a236c){_0x1f9402=_0x1f9402-0x0;var _0x230918=_0x5db0[_0x1f9402];return _0x230918;};'use strict';var _=require(_0x05db('0x0'));var util=require(_0x05db('0x1'));var logger=require('../../config/logger')(_0x05db('0x2'));var moment=require(_0x05db('0x3'));var BPromise=require(_0x05db('0x4'));var rp=require(_0x05db('0x5'));var fs=require('fs');var path=require(_0x05db('0x6'));var rimraf=require(_0x05db('0x7'));var config=require(_0x05db('0x8'));var attributes=require(_0x05db('0x9'));module[_0x05db('0xa')]=function(_0x22e736,_0x126ee5){return _0x22e736[_0x05db('0xb')](_0x05db('0xc'),attributes,{'tableName':_0x05db('0xd'),'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 c45fe8a..4b64775 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 _0x1219=['include','map','model','attributes','ShowSmsAccount','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','./smsAccount.socket','register','then','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SmsAccount,\x20%s,\x20%s','info','SmsAccount','find','options','where'];(function(_0x48999d,_0x1e02cb){var _0x1ad0d1=function(_0x3f974e){while(--_0x3f974e){_0x48999d['push'](_0x48999d['shift']());}};_0x1ad0d1(++_0x1e02cb);}(_0x1219,0x137));var _0x9121=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1219[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x9121('0x0'));var util=require('util');var moment=require(_0x9121('0x1'));var BPromise=require(_0x9121('0x2'));var rs=require(_0x9121('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9121('0x4'))['db'];var utils=require(_0x9121('0x5'));var logger=require(_0x9121('0x6'))('rpc');var config=require(_0x9121('0x7'));var jayson=require(_0x9121('0x8'));var client=jayson['client'][_0x9121('0x9')]({'port':0x232a});config[_0x9121('0xa')]=_[_0x9121('0xb')](config[_0x9121('0xa')],{'host':_0x9121('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9121('0xa')]));require(_0x9121('0xd'))[_0x9121('0xe')](socket);function respondWithRpcPromise(_0x13ed43,_0x53b861,_0x37f4bf){return new BPromise(function(_0xaa0c1e,_0x58ad7b){return client['request'](_0x13ed43,_0x37f4bf)[_0x9121('0xf')](function(_0x1c7575){logger['info']('SmsAccount,\x20%s,\x20%s',_0x53b861,_0x9121('0x10'));logger[_0x9121('0x11')](_0x9121('0x12'),_0x53b861,_0x9121('0x10'),JSON[_0x9121('0x13')](_0x1c7575));if(_0x1c7575[_0x9121('0x14')]){if(_0x1c7575[_0x9121('0x14')][_0x9121('0x15')]===0x1f4){logger[_0x9121('0x14')]('SmsAccount,\x20%s,\x20%s',_0x53b861,_0x1c7575[_0x9121('0x14')][_0x9121('0x16')]);return _0x58ad7b(_0x1c7575[_0x9121('0x14')][_0x9121('0x16')]);}logger['error'](_0x9121('0x17'),_0x53b861,_0x1c7575['error'][_0x9121('0x16')]);return _0xaa0c1e(_0x1c7575['error'][_0x9121('0x16')]);}else{logger[_0x9121('0x18')](_0x9121('0x17'),_0x53b861,_0x9121('0x10'));_0xaa0c1e(_0x1c7575['result'][_0x9121('0x16')]);}})['catch'](function(_0x3b393a){logger[_0x9121('0x14')](_0x9121('0x17'),_0x53b861,_0x3b393a);_0x58ad7b(_0x3b393a);});});}exports['ShowSmsAccount']=function(_0x4a24aa){var _0x1d1753=this;return new Promise(function(_0x416b12,_0x4fa367){return db[_0x9121('0x19')][_0x9121('0x1a')]({'raw':_0x4a24aa['options']?_0x4a24aa['options']['raw']===undefined?!![]:![]:!![],'where':_0x4a24aa[_0x9121('0x1b')]?_0x4a24aa[_0x9121('0x1b')][_0x9121('0x1c')]||null:null,'attributes':_0x4a24aa[_0x9121('0x1b')]?_0x4a24aa[_0x9121('0x1b')]['attributes']||null:null,'include':_0x4a24aa[_0x9121('0x1b')]?_0x4a24aa[_0x9121('0x1b')][_0x9121('0x1d')]?_[_0x9121('0x1e')](_0x4a24aa[_0x9121('0x1b')][_0x9121('0x1d')],function(_0x42b673){return{'model':db[_0x42b673[_0x9121('0x1f')]],'as':_0x42b673['as'],'attributes':_0x42b673['attributes'],'include':_0x42b673[_0x9121('0x1d')]?_[_0x9121('0x1e')](_0x42b673[_0x9121('0x1d')],function(_0x3d2264){return{'model':db[_0x3d2264['model']],'as':_0x3d2264['as'],'attributes':_0x3d2264[_0x9121('0x20')],'include':_0x3d2264[_0x9121('0x1d')]?_['map'](_0x3d2264[_0x9121('0x1d')],function(_0x12eb49){return{'model':db[_0x12eb49['model']],'as':_0x12eb49['as'],'attributes':_0x12eb49[_0x9121('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x571b10){logger['info']('ShowSmsAccount',_0x4a24aa);logger[_0x9121('0x11')](_0x9121('0x21'),_0x4a24aa,JSON[_0x9121('0x13')](_0x571b10));_0x416b12(_0x571b10);})['catch'](function(_0x484df4){logger[_0x9121('0x14')]('ShowSmsAccount',_0x484df4[_0x9121('0x16')],_0x4a24aa);_0x4fa367(_0x1d1753[_0x9121('0x14')](0x1f4,_0x484df4[_0x9121('0x16')]));});});}; \ No newline at end of file +var _0x2061=['error','message','catch','ShowSmsAccount','SmsAccount','find','options','where','attributes','include','model','map','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','register','request','then','info','SmsAccount,\x20%s,\x20%s','debug','request\x20sent','stringify'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0x2061,0x147));var _0x1206=function(_0x1d222f,_0x35168f){_0x1d222f=_0x1d222f-0x0;var _0x188692=_0x2061[_0x1d222f];return _0x188692;};'use strict';var _=require('lodash');var util=require(_0x1206('0x0'));var moment=require(_0x1206('0x1'));var BPromise=require(_0x1206('0x2'));var rs=require(_0x1206('0x3'));var fs=require('fs');var Redis=require(_0x1206('0x4'));var db=require(_0x1206('0x5'))['db'];var utils=require(_0x1206('0x6'));var logger=require(_0x1206('0x7'))(_0x1206('0x8'));var config=require('../../config/environment');var jayson=require(_0x1206('0x9'));var client=jayson[_0x1206('0xa')][_0x1206('0xb')]({'port':0x232a});config[_0x1206('0xc')]=_[_0x1206('0xd')](config[_0x1206('0xc')],{'host':_0x1206('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./smsAccount.socket')[_0x1206('0xf')](socket);function respondWithRpcPromise(_0x2c17d6,_0x413d7d,_0x143665){return new BPromise(function(_0x48a36d,_0xdc9ccb){return client[_0x1206('0x10')](_0x2c17d6,_0x143665)[_0x1206('0x11')](function(_0x4c6ea3){logger[_0x1206('0x12')](_0x1206('0x13'),_0x413d7d,'request\x20sent');logger[_0x1206('0x14')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x413d7d,_0x1206('0x15'),JSON[_0x1206('0x16')](_0x4c6ea3));if(_0x4c6ea3[_0x1206('0x17')]){if(_0x4c6ea3[_0x1206('0x17')]['code']===0x1f4){logger[_0x1206('0x17')](_0x1206('0x13'),_0x413d7d,_0x4c6ea3[_0x1206('0x17')][_0x1206('0x18')]);return _0xdc9ccb(_0x4c6ea3[_0x1206('0x17')][_0x1206('0x18')]);}logger[_0x1206('0x17')](_0x1206('0x13'),_0x413d7d,_0x4c6ea3[_0x1206('0x17')][_0x1206('0x18')]);return _0x48a36d(_0x4c6ea3['error']['message']);}else{logger['info'](_0x1206('0x13'),_0x413d7d,_0x1206('0x15'));_0x48a36d(_0x4c6ea3['result']['message']);}})[_0x1206('0x19')](function(_0x43a7d5){logger[_0x1206('0x17')]('SmsAccount,\x20%s,\x20%s',_0x413d7d,_0x43a7d5);_0xdc9ccb(_0x43a7d5);});});}exports[_0x1206('0x1a')]=function(_0x22935c){var _0xbf0170=this;return new Promise(function(_0x759910,_0x495637){return db[_0x1206('0x1b')][_0x1206('0x1c')]({'raw':_0x22935c[_0x1206('0x1d')]?_0x22935c['options']['raw']===undefined?!![]:![]:!![],'where':_0x22935c[_0x1206('0x1d')]?_0x22935c['options'][_0x1206('0x1e')]||null:null,'attributes':_0x22935c[_0x1206('0x1d')]?_0x22935c[_0x1206('0x1d')][_0x1206('0x1f')]||null:null,'include':_0x22935c[_0x1206('0x1d')]?_0x22935c[_0x1206('0x1d')]['include']?_['map'](_0x22935c[_0x1206('0x1d')][_0x1206('0x20')],function(_0xeef410){return{'model':db[_0xeef410[_0x1206('0x21')]],'as':_0xeef410['as'],'attributes':_0xeef410['attributes'],'include':_0xeef410[_0x1206('0x20')]?_['map'](_0xeef410[_0x1206('0x20')],function(_0x524af3){return{'model':db[_0x524af3['model']],'as':_0x524af3['as'],'attributes':_0x524af3['attributes'],'include':_0x524af3['include']?_[_0x1206('0x22')](_0x524af3[_0x1206('0x20')],function(_0x5bfd9d){return{'model':db[_0x5bfd9d[_0x1206('0x21')]],'as':_0x5bfd9d['as'],'attributes':_0x5bfd9d[_0x1206('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x1206('0x11')](function(_0x3ea3c2){logger[_0x1206('0x12')](_0x1206('0x1a'),_0x22935c);logger[_0x1206('0x14')]('ShowSmsAccount',_0x22935c,JSON[_0x1206('0x16')](_0x3ea3c2));_0x759910(_0x3ea3c2);})['catch'](function(_0x4c4506){logger[_0x1206('0x17')]('ShowSmsAccount',_0x4c4506['message'],_0x22935c);_0x495637(_0xbf0170[_0x1206('0x17')](0x1f4,_0x4c4506[_0x1206('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index b1d07f4..b37c60b 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(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xa9e0[_0x187ee1];return _0x388160;};'use strict';var SmsAccountEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){SmsAccountEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);SmsAccountEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file +var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xa9e0[_0x2b4411];return _0x8e41ef;};'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 e26fffb..b246e65 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 _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(_0x3db005,_0x3c0c4f){var _0x2738ad=function(_0x43c5c7){while(--_0x43c5c7){_0x3db005['push'](_0x3db005['shift']());}};_0x2738ad(++_0x3c0c4f);}(_0xedd9,0xfc));var _0x9edd=function(_0x10715d,_0x17ebdb){_0x10715d=_0x10715d-0x0;var _0x51b210=_0xedd9[_0x10715d];return _0x51b210;};'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 +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(_0xb5ddac,_0x2bb10c){var _0x1b3825=function(_0x1ef597){while(--_0x1ef597){_0xb5ddac['push'](_0xb5ddac['shift']());}};_0x1b3825(++_0x2bb10c);}(_0xedd9,0xfc));var _0x9edd=function(_0x2db2a1,_0x51f025){_0x2db2a1=_0x2db2a1-0x0;var _0x5bfe42=_0xedd9[_0x2db2a1];return _0x5bfe42;};'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 23791a9..281d16e 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 _0x16af=['STRING','noop','TEXT','*,*,*,*','sequelize','INTEGER'];(function(_0x1da04e,_0x31024b){var _0xdd8c41=function(_0x2036f9){while(--_0x2036f9){_0x1da04e['push'](_0x1da04e['shift']());}};_0xdd8c41(++_0x31024b);}(_0x16af,0xca));var _0xf16a=function(_0x541a68,_0x3fdb9){_0x541a68=_0x541a68-0x0;var _0x38dc56=_0x16af[_0x541a68];return _0x38dc56;};'use strict';var Sequelize=require(_0xf16a('0x0'));module['exports']={'priority':{'type':Sequelize[_0xf16a('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xf16a('0x2')],'allowNull':![],'defaultValue':_0xf16a('0x3')},'appdata':{'type':Sequelize[_0xf16a('0x4')]()},'description':{'type':Sequelize[_0xf16a('0x2')]},'interval':{'type':Sequelize[_0xf16a('0x2')],'defaultValue':_0xf16a('0x5')}}; \ No newline at end of file +var _0x1d09=['noop','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1d09,0x85));var _0x91d0=function(_0x19691f,_0x159737){_0x19691f=_0x19691f-0x0;var _0x5677b6=_0x1d09[_0x19691f];return _0x5677b6;};'use strict';var Sequelize=require('sequelize');module[_0x91d0('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x91d0('0x1')],'allowNull':![],'defaultValue':_0x91d0('0x2')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x91d0('0x1')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index aed19bf..fb14248 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 _0x835a=['name','send','index','map','rawAttributes','fieldName','type','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','VIRTUAL','options','SmsApplication','includeAll','include','findAll','rows','show','params','catch','create','body','find','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x835a,0x156));var _0xa835=function(_0x589163,_0x20abf4){_0x589163=_0x589163-0x0;var _0x463fd3=_0x835a[_0x589163];return _0x463fd3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa835('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa835('0x1'));var rp=require(_0xa835('0x2'));var moment=require('moment');var BPromise=require(_0xa835('0x3'));var Mustache=require(_0xa835('0x4'));var util=require(_0xa835('0x5'));var path=require(_0xa835('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa835('0x7'));var _=require(_0xa835('0x8'));var squel=require(_0xa835('0x9'));var crypto=require(_0xa835('0xa'));var jsforce=require(_0xa835('0xb'));var deskjs=require(_0xa835('0xc'));var toCsv=require(_0xa835('0xd'));var querystring=require(_0xa835('0xe'));var Papa=require('papaparse');var Redis=require(_0xa835('0xf'));var authService=require(_0xa835('0x10'));var qs=require(_0xa835('0x11'));var as=require(_0xa835('0x12'));var hardwareService=require(_0xa835('0x13'));var logger=require(_0xa835('0x14'))(_0xa835('0x15'));var utils=require(_0xa835('0x16'));var config=require(_0xa835('0x17'));var licenseUtil=require(_0xa835('0x18'));var db=require(_0xa835('0x19'))['db'];function respondWithStatusCode(_0xb86b5a,_0x501256){_0x501256=_0x501256||0xcc;return function(_0x16a9fe){if(_0x16a9fe){return _0xb86b5a['sendStatus'](_0x501256);}return _0xb86b5a[_0xa835('0x1a')](_0x501256)[_0xa835('0x1b')]();};}function respondWithResult(_0x252cea,_0x5dbcd4){_0x5dbcd4=_0x5dbcd4||0xc8;return function(_0x59edc5){if(_0x59edc5){return _0x252cea[_0xa835('0x1a')](_0x5dbcd4)[_0xa835('0x1c')](_0x59edc5);}};}function respondWithFilteredResult(_0x1e9414,_0x111bd5){return function(_0x354134){if(_0x354134){var _0x1659ed=typeof _0x111bd5[_0xa835('0x1d')]==='undefined'&&typeof _0x111bd5[_0xa835('0x1e')]===_0xa835('0x1f');var _0x3e249d=_0x354134[_0xa835('0x20')];var _0x3236d5=_0x1659ed?0x0:_0x111bd5[_0xa835('0x1d')];var _0x1e9bd2=_0x1659ed?_0x354134[_0xa835('0x20')]:_0x111bd5[_0xa835('0x1d')]+_0x111bd5[_0xa835('0x1e')];var _0x19e28b;if(_0x1e9bd2>=_0x3e249d){_0x1e9bd2=_0x3e249d;_0x19e28b=0xc8;}else{_0x19e28b=0xce;}_0x1e9414[_0xa835('0x1a')](_0x19e28b);return _0x1e9414['set'](_0xa835('0x21'),_0x3236d5+'-'+_0x1e9bd2+'/'+_0x3e249d)[_0xa835('0x1c')](_0x354134);}return null;};}function patchUpdates(_0x383d37){return function(_0x1ef12f){try{jsonpatch[_0xa835('0x22')](_0x1ef12f,_0x383d37,!![]);}catch(_0x206d3f){return BPromise[_0xa835('0x23')](_0x206d3f);}return _0x1ef12f[_0xa835('0x24')]();};}function saveUpdates(_0x4f3f23,_0x55ede5){return function(_0x374221){if(_0x374221){return _0x374221[_0xa835('0x25')](_0x4f3f23)[_0xa835('0x26')](function(_0x2de323){return _0x2de323;});}return null;};}function removeEntity(_0x3a5570,_0x1a6f4e){return function(_0x330250){if(_0x330250){return _0x330250[_0xa835('0x27')]()[_0xa835('0x26')](function(){_0x3a5570[_0xa835('0x1a')](0xcc)[_0xa835('0x1b')]();});}};}function handleEntityNotFound(_0x41b934,_0x4ab755){return function(_0x1b5733){if(!_0x1b5733){_0x41b934[_0xa835('0x28')](0x194);}return _0x1b5733;};}function handleError(_0xb36269,_0x39bf9f){_0x39bf9f=_0x39bf9f||0x1f4;return function(_0x4e6eae){logger[_0xa835('0x29')](_0x4e6eae[_0xa835('0x2a')]);if(_0x4e6eae[_0xa835('0x2b')]){delete _0x4e6eae[_0xa835('0x2b')];}_0xb36269[_0xa835('0x1a')](_0x39bf9f)[_0xa835('0x2c')](_0x4e6eae);};}exports[_0xa835('0x2d')]=function(_0x508c8f,_0xb6a5e3){var _0x4b2977={},_0x285166={},_0x5d74e8={'count':0x0,'rows':[]};var _0x14a3bb=_[_0xa835('0x2e')](db['SmsApplication'][_0xa835('0x2f')],function(_0x46d61f){return{'name':_0x46d61f[_0xa835('0x30')],'type':_0x46d61f[_0xa835('0x31')]['key']};});_0x285166[_0xa835('0x32')]=_[_0xa835('0x2e')](_0x14a3bb,_0xa835('0x2b'));_0x285166[_0xa835('0x33')]=_[_0xa835('0x34')](_0x508c8f['query']);_0x285166['filters']=_[_0xa835('0x35')](_0x285166['model'],_0x285166[_0xa835('0x33')]);_0x4b2977['attributes']=_[_0xa835('0x35')](_0x285166['model'],qs[_0xa835('0x36')](_0x508c8f[_0xa835('0x33')][_0xa835('0x36')]));_0x4b2977[_0xa835('0x37')]=_0x4b2977['attributes'][_0xa835('0x38')]?_0x4b2977[_0xa835('0x37')]:_0x285166[_0xa835('0x32')];if(!_0x508c8f[_0xa835('0x33')][_0xa835('0x39')](_0xa835('0x3a'))){_0x4b2977[_0xa835('0x1e')]=qs['limit'](_0x508c8f[_0xa835('0x33')][_0xa835('0x1e')]);_0x4b2977['offset']=qs[_0xa835('0x1d')](_0x508c8f['query']['offset']);}_0x4b2977['order']=qs['sort'](_0x508c8f[_0xa835('0x33')][_0xa835('0x3b')]);_0x4b2977[_0xa835('0x3c')]=qs[_0xa835('0x3d')](_[_0xa835('0x3e')](_0x508c8f[_0xa835('0x33')],_0x285166[_0xa835('0x3d')]),_0x14a3bb);if(_0x508c8f[_0xa835('0x33')][_0xa835('0x3f')]){_0x4b2977['where']=_['merge'](_0x4b2977['where'],{'$or':_[_0xa835('0x2e')](_0x14a3bb,function(_0x420e31){if(_0x420e31[_0xa835('0x31')]!==_0xa835('0x40')){var _0x45dbd8={};_0x45dbd8[_0x420e31['name']]={'$like':'%'+_0x508c8f[_0xa835('0x33')]['filter']+'%'};return _0x45dbd8;}})});}_0x4b2977=_['merge']({},_0x4b2977,_0x508c8f[_0xa835('0x41')]);var _0x45f6cb={'where':_0x4b2977['where']};return db[_0xa835('0x42')][_0xa835('0x20')](_0x45f6cb)[_0xa835('0x26')](function(_0x1fbf3b){_0x5d74e8[_0xa835('0x20')]=_0x1fbf3b;if(_0x508c8f['query'][_0xa835('0x43')]){_0x4b2977[_0xa835('0x44')]=[{'all':!![]}];}return db['SmsApplication'][_0xa835('0x45')](_0x4b2977);})[_0xa835('0x26')](function(_0x4144b3){_0x5d74e8[_0xa835('0x46')]=_0x4144b3;return _0x5d74e8;})[_0xa835('0x26')](respondWithFilteredResult(_0xb6a5e3,_0x4b2977))['catch'](handleError(_0xb6a5e3,null));};exports[_0xa835('0x47')]=function(_0x115cde,_0x2f707c){var _0xc3dbdc={'raw':!![],'where':{'id':_0x115cde[_0xa835('0x48')]['id']}},_0x146b18={};_0x146b18['model']=_[_0xa835('0x34')](db['SmsApplication'][_0xa835('0x2f')]);_0x146b18[_0xa835('0x33')]=_[_0xa835('0x34')](_0x115cde[_0xa835('0x33')]);_0x146b18[_0xa835('0x3d')]=_[_0xa835('0x35')](_0x146b18[_0xa835('0x32')],_0x146b18['query']);_0xc3dbdc['attributes']=_[_0xa835('0x35')](_0x146b18[_0xa835('0x32')],qs[_0xa835('0x36')](_0x115cde[_0xa835('0x33')]['fields']));_0xc3dbdc[_0xa835('0x37')]=_0xc3dbdc[_0xa835('0x37')]['length']?_0xc3dbdc['attributes']:_0x146b18[_0xa835('0x32')];if(_0x115cde['query'][_0xa835('0x43')]){_0xc3dbdc[_0xa835('0x44')]=[{'all':!![]}];}_0xc3dbdc=_['merge']({},_0xc3dbdc,_0x115cde['options']);return db['SmsApplication']['find'](_0xc3dbdc)['then'](handleEntityNotFound(_0x2f707c,null))[_0xa835('0x26')](respondWithResult(_0x2f707c,null))[_0xa835('0x49')](handleError(_0x2f707c,null));};exports[_0xa835('0x4a')]=function(_0x283110,_0x5cb15a){return db[_0xa835('0x42')][_0xa835('0x4a')](_0x283110['body'],{})[_0xa835('0x26')](respondWithResult(_0x5cb15a,0xc9))[_0xa835('0x49')](handleError(_0x5cb15a,null));};exports[_0xa835('0x25')]=function(_0x13d8dc,_0x43c12e){if(_0x13d8dc['body']['id']){delete _0x13d8dc[_0xa835('0x4b')]['id'];}return db['SmsApplication']['find']({'where':{'id':_0x13d8dc['params']['id']}})[_0xa835('0x26')](handleEntityNotFound(_0x43c12e,null))[_0xa835('0x26')](saveUpdates(_0x13d8dc[_0xa835('0x4b')],null))[_0xa835('0x26')](respondWithResult(_0x43c12e,null))[_0xa835('0x49')](handleError(_0x43c12e,null));};exports[_0xa835('0x27')]=function(_0xec2114,_0x3b66b8){return db[_0xa835('0x42')][_0xa835('0x4c')]({'where':{'id':_0xec2114['params']['id']}})[_0xa835('0x26')](handleEntityNotFound(_0x3b66b8,null))[_0xa835('0x26')](removeEntity(_0x3b66b8,null))[_0xa835('0x49')](handleError(_0x3b66b8,null));}; \ No newline at end of file +var _0xe27e=['attributes','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','limit','set','Content-Range','reject','save','then','destroy','sendStatus','error','name','index','map','SmsApplication','rawAttributes','fieldName','type','keys','filters','intersection','model','query','fields'];(function(_0x28c1dc,_0x1910ca){var _0x15aeaf=function(_0x5cac44){while(--_0x5cac44){_0x28c1dc['push'](_0x28c1dc['shift']());}};_0x15aeaf(++_0x1910ca);}(_0xe27e,0x135));var _0xee27=function(_0x3186aa,_0x34c21e){_0x3186aa=_0x3186aa-0x0;var _0x2d8c36=_0xe27e[_0x3186aa];return _0x2d8c36;};'use strict';var emlformat=require(_0xee27('0x0'));var rimraf=require(_0xee27('0x1'));var zipdir=require(_0xee27('0x2'));var jsonpatch=require(_0xee27('0x3'));var rp=require('request-promise');var moment=require(_0xee27('0x4'));var BPromise=require(_0xee27('0x5'));var Mustache=require('mustache');var util=require(_0xee27('0x6'));var path=require(_0xee27('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xee27('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xee27('0x9'));var squel=require(_0xee27('0xa'));var crypto=require(_0xee27('0xb'));var jsforce=require(_0xee27('0xc'));var deskjs=require(_0xee27('0xd'));var toCsv=require(_0xee27('0xe'));var querystring=require('querystring');var Papa=require(_0xee27('0xf'));var Redis=require(_0xee27('0x10'));var authService=require(_0xee27('0x11'));var qs=require(_0xee27('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xee27('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xee27('0x14'));var config=require(_0xee27('0x15'));var licenseUtil=require(_0xee27('0x16'));var db=require(_0xee27('0x17'))['db'];function respondWithStatusCode(_0x4cf33d,_0x159da9){_0x159da9=_0x159da9||0xcc;return function(_0x35f9b2){if(_0x35f9b2){return _0x4cf33d['sendStatus'](_0x159da9);}return _0x4cf33d[_0xee27('0x18')](_0x159da9)['end']();};}function respondWithResult(_0x392ca7,_0x43c031){_0x43c031=_0x43c031||0xc8;return function(_0xc51912){if(_0xc51912){return _0x392ca7[_0xee27('0x18')](_0x43c031)[_0xee27('0x19')](_0xc51912);}};}function respondWithFilteredResult(_0x4d7157,_0x410cc7){return function(_0x4528d4){if(_0x4528d4){var _0x322016=typeof _0x410cc7[_0xee27('0x1a')]===_0xee27('0x1b')&&typeof _0x410cc7['limit']===_0xee27('0x1b');var _0x5241a2=_0x4528d4['count'];var _0x2a9198=_0x322016?0x0:_0x410cc7[_0xee27('0x1a')];var _0x4e98ba=_0x322016?_0x4528d4[_0xee27('0x1c')]:_0x410cc7['offset']+_0x410cc7[_0xee27('0x1d')];var _0x2fb9a1;if(_0x4e98ba>=_0x5241a2){_0x4e98ba=_0x5241a2;_0x2fb9a1=0xc8;}else{_0x2fb9a1=0xce;}_0x4d7157[_0xee27('0x18')](_0x2fb9a1);return _0x4d7157[_0xee27('0x1e')](_0xee27('0x1f'),_0x2a9198+'-'+_0x4e98ba+'/'+_0x5241a2)[_0xee27('0x19')](_0x4528d4);}return null;};}function patchUpdates(_0x441751){return function(_0x402742){try{jsonpatch['apply'](_0x402742,_0x441751,!![]);}catch(_0x3015a3){return BPromise[_0xee27('0x20')](_0x3015a3);}return _0x402742[_0xee27('0x21')]();};}function saveUpdates(_0x25d213,_0x2083fc){return function(_0xddb1be){if(_0xddb1be){return _0xddb1be['update'](_0x25d213)[_0xee27('0x22')](function(_0x451747){return _0x451747;});}return null;};}function removeEntity(_0x3be1c2,_0x1fac1c){return function(_0x3433af){if(_0x3433af){return _0x3433af[_0xee27('0x23')]()['then'](function(){_0x3be1c2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x335e0a,_0x17ce71){return function(_0xee48d0){if(!_0xee48d0){_0x335e0a[_0xee27('0x24')](0x194);}return _0xee48d0;};}function handleError(_0xfa8bf6,_0x4656e2){_0x4656e2=_0x4656e2||0x1f4;return function(_0x24f947){logger[_0xee27('0x25')](_0x24f947['stack']);if(_0x24f947[_0xee27('0x26')]){delete _0x24f947['name'];}_0xfa8bf6[_0xee27('0x18')](_0x4656e2)['send'](_0x24f947);};}exports[_0xee27('0x27')]=function(_0x58537d,_0x4e1a44){var _0x2257b7={},_0x45318f={},_0x2e885c={'count':0x0,'rows':[]};var _0x33bf52=_[_0xee27('0x28')](db[_0xee27('0x29')][_0xee27('0x2a')],function(_0x3344dc){return{'name':_0x3344dc[_0xee27('0x2b')],'type':_0x3344dc[_0xee27('0x2c')]['key']};});_0x45318f['model']=_[_0xee27('0x28')](_0x33bf52,'name');_0x45318f['query']=_[_0xee27('0x2d')](_0x58537d['query']);_0x45318f[_0xee27('0x2e')]=_[_0xee27('0x2f')](_0x45318f[_0xee27('0x30')],_0x45318f[_0xee27('0x31')]);_0x2257b7['attributes']=_[_0xee27('0x2f')](_0x45318f[_0xee27('0x30')],qs[_0xee27('0x32')](_0x58537d[_0xee27('0x31')][_0xee27('0x32')]));_0x2257b7[_0xee27('0x33')]=_0x2257b7[_0xee27('0x33')][_0xee27('0x34')]?_0x2257b7[_0xee27('0x33')]:_0x45318f[_0xee27('0x30')];if(!_0x58537d[_0xee27('0x31')][_0xee27('0x35')]('nolimit')){_0x2257b7[_0xee27('0x1d')]=qs['limit'](_0x58537d[_0xee27('0x31')][_0xee27('0x1d')]);_0x2257b7[_0xee27('0x1a')]=qs[_0xee27('0x1a')](_0x58537d['query'][_0xee27('0x1a')]);}_0x2257b7[_0xee27('0x36')]=qs[_0xee27('0x37')](_0x58537d[_0xee27('0x31')]['sort']);_0x2257b7[_0xee27('0x38')]=qs[_0xee27('0x2e')](_['pick'](_0x58537d['query'],_0x45318f[_0xee27('0x2e')]),_0x33bf52);if(_0x58537d['query'][_0xee27('0x39')]){_0x2257b7[_0xee27('0x38')]=_[_0xee27('0x3a')](_0x2257b7[_0xee27('0x38')],{'$or':_[_0xee27('0x28')](_0x33bf52,function(_0x578248){if(_0x578248['type']!==_0xee27('0x3b')){var _0x549dbf={};_0x549dbf[_0x578248[_0xee27('0x26')]]={'$like':'%'+_0x58537d[_0xee27('0x31')][_0xee27('0x39')]+'%'};return _0x549dbf;}})});}_0x2257b7=_[_0xee27('0x3a')]({},_0x2257b7,_0x58537d[_0xee27('0x3c')]);var _0x23a982={'where':_0x2257b7['where']};return db['SmsApplication'][_0xee27('0x1c')](_0x23a982)[_0xee27('0x22')](function(_0x47c652){_0x2e885c[_0xee27('0x1c')]=_0x47c652;if(_0x58537d[_0xee27('0x31')][_0xee27('0x3d')]){_0x2257b7[_0xee27('0x3e')]=[{'all':!![]}];}return db['SmsApplication'][_0xee27('0x3f')](_0x2257b7);})[_0xee27('0x22')](function(_0x1307fd){_0x2e885c[_0xee27('0x40')]=_0x1307fd;return _0x2e885c;})[_0xee27('0x22')](respondWithFilteredResult(_0x4e1a44,_0x2257b7))[_0xee27('0x41')](handleError(_0x4e1a44,null));};exports[_0xee27('0x42')]=function(_0x2a4c26,_0x5278e3){var _0x4f0ea3={'raw':!![],'where':{'id':_0x2a4c26[_0xee27('0x43')]['id']}},_0x1c6d7e={};_0x1c6d7e[_0xee27('0x30')]=_[_0xee27('0x2d')](db['SmsApplication'][_0xee27('0x2a')]);_0x1c6d7e[_0xee27('0x31')]=_[_0xee27('0x2d')](_0x2a4c26[_0xee27('0x31')]);_0x1c6d7e[_0xee27('0x2e')]=_['intersection'](_0x1c6d7e[_0xee27('0x30')],_0x1c6d7e['query']);_0x4f0ea3[_0xee27('0x33')]=_[_0xee27('0x2f')](_0x1c6d7e[_0xee27('0x30')],qs[_0xee27('0x32')](_0x2a4c26[_0xee27('0x31')][_0xee27('0x32')]));_0x4f0ea3[_0xee27('0x33')]=_0x4f0ea3[_0xee27('0x33')][_0xee27('0x34')]?_0x4f0ea3[_0xee27('0x33')]:_0x1c6d7e[_0xee27('0x30')];if(_0x2a4c26[_0xee27('0x31')][_0xee27('0x3d')]){_0x4f0ea3['include']=[{'all':!![]}];}_0x4f0ea3=_[_0xee27('0x3a')]({},_0x4f0ea3,_0x2a4c26[_0xee27('0x3c')]);return db['SmsApplication'][_0xee27('0x44')](_0x4f0ea3)[_0xee27('0x22')](handleEntityNotFound(_0x5278e3,null))['then'](respondWithResult(_0x5278e3,null))[_0xee27('0x41')](handleError(_0x5278e3,null));};exports[_0xee27('0x45')]=function(_0x1ca963,_0x217c6d){return db[_0xee27('0x29')]['create'](_0x1ca963[_0xee27('0x46')],{})['then'](respondWithResult(_0x217c6d,0xc9))['catch'](handleError(_0x217c6d,null));};exports[_0xee27('0x47')]=function(_0x3307ad,_0x12b311){if(_0x3307ad[_0xee27('0x46')]['id']){delete _0x3307ad['body']['id'];}return db[_0xee27('0x29')]['find']({'where':{'id':_0x3307ad[_0xee27('0x43')]['id']}})['then'](handleEntityNotFound(_0x12b311,null))['then'](saveUpdates(_0x3307ad['body'],null))[_0xee27('0x22')](respondWithResult(_0x12b311,null))[_0xee27('0x41')](handleError(_0x12b311,null));};exports[_0xee27('0x23')]=function(_0x54feef,_0x25fef2){return db[_0xee27('0x29')]['find']({'where':{'id':_0x54feef['params']['id']}})[_0xee27('0x22')](handleEntityNotFound(_0x25fef2,null))[_0xee27('0x22')](removeEntity(_0x25fef2,null))[_0xee27('0x41')](handleError(_0x25fef2,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index b74f0e7..9ee6868 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 _0xb56a=['utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsApplication.attributes','SmsApplication','sms_applications'];(function(_0x5550b3,_0x2d0ee0){var _0x4b8fc4=function(_0x22393a){while(--_0x22393a){_0x5550b3['push'](_0x5550b3['shift']());}};_0x4b8fc4(++_0x2d0ee0);}(_0xb56a,0xab));var _0xab56=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0xb56a[_0x2dadb9];return _0x2f0097;};'use strict';var _=require('lodash');var util=require(_0xab56('0x0'));var logger=require(_0xab56('0x1'))(_0xab56('0x2'));var moment=require(_0xab56('0x3'));var BPromise=require(_0xab56('0x4'));var rp=require(_0xab56('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xab56('0x6'));var config=require(_0xab56('0x7'));var attributes=require(_0xab56('0x8'));module['exports']=function(_0x2c4a9e,_0x25b929){return _0x2c4a9e['define'](_0xab56('0x9'),attributes,{'tableName':_0xab56('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xab56('0xb'),'collate':_0xab56('0xc')});}; \ No newline at end of file +var _0x293a=['rimraf','exports','define','utf8mb4','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x34d6f7,_0x3ebb28){var _0x171bf1=function(_0x3a175f){while(--_0x3a175f){_0x34d6f7['push'](_0x34d6f7['shift']());}};_0x171bf1(++_0x3ebb28);}(_0x293a,0x7d));var _0xa293=function(_0x676452,_0x515240){_0x676452=_0x676452-0x0;var _0x2a8187=_0x293a[_0x676452];return _0x2a8187;};'use strict';var _=require(_0xa293('0x0'));var util=require(_0xa293('0x1'));var logger=require(_0xa293('0x2'))('api');var moment=require(_0xa293('0x3'));var BPromise=require(_0xa293('0x4'));var rp=require(_0xa293('0x5'));var fs=require('fs');var path=require(_0xa293('0x6'));var rimraf=require(_0xa293('0x7'));var config=require('../../config/environment');var attributes=require('./smsApplication.attributes');module[_0xa293('0x8')]=function(_0x4cfdec,_0x4e74ce){return _0x4cfdec[_0xa293('0x9')]('SmsApplication',attributes,{'tableName':'sms_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa293('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index c02cf53..dd720fa 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 _0x4d5a=['info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request'];(function(_0x1a367e,_0x3f1d49){var _0x2be23d=function(_0x5bf4d2){while(--_0x5bf4d2){_0x1a367e['push'](_0x1a367e['shift']());}};_0x2be23d(++_0x3f1d49);}(_0x4d5a,0x15e));var _0xa4d5=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x4d5a[_0x3b380d];return _0x54502b;};'use strict';var _=require('lodash');var util=require(_0xa4d5('0x0'));var moment=require(_0xa4d5('0x1'));var BPromise=require(_0xa4d5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa4d5('0x3'));var db=require(_0xa4d5('0x4'))['db'];var utils=require(_0xa4d5('0x5'));var logger=require(_0xa4d5('0x6'))('rpc');var config=require(_0xa4d5('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xa4d5('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1856aa,_0x166db3,_0x318315){return new BPromise(function(_0x408db0,_0x3bed6b){return client[_0xa4d5('0x9')](_0x1856aa,_0x318315)['then'](function(_0x5586de){logger[_0xa4d5('0xa')](_0xa4d5('0xb'),_0x166db3,_0xa4d5('0xc'));logger[_0xa4d5('0xd')](_0xa4d5('0xe'),_0x166db3,_0xa4d5('0xc'),JSON[_0xa4d5('0xf')](_0x5586de));if(_0x5586de[_0xa4d5('0x10')]){if(_0x5586de['error']['code']===0x1f4){logger[_0xa4d5('0x10')](_0xa4d5('0xb'),_0x166db3,_0x5586de[_0xa4d5('0x10')][_0xa4d5('0x11')]);return _0x3bed6b(_0x5586de['error']['message']);}logger[_0xa4d5('0x10')](_0xa4d5('0xb'),_0x166db3,_0x5586de[_0xa4d5('0x10')][_0xa4d5('0x11')]);return _0x408db0(_0x5586de[_0xa4d5('0x10')][_0xa4d5('0x11')]);}else{logger['info']('SmsApplication,\x20%s,\x20%s',_0x166db3,_0xa4d5('0xc'));_0x408db0(_0x5586de[_0xa4d5('0x12')]['message']);}})[_0xa4d5('0x13')](function(_0x31eed7){logger[_0xa4d5('0x10')](_0xa4d5('0xb'),_0x166db3,_0x31eed7);_0x3bed6b(_0x31eed7);});});} \ No newline at end of file +var _0x881e=['stringify','error','code','message','result','catch','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','SmsApplication,\x20%s,\x20%s','debug','request\x20sent'];(function(_0xbef953,_0x37b241){var _0x30dbd1=function(_0x45666f){while(--_0x45666f){_0xbef953['push'](_0xbef953['shift']());}};_0x30dbd1(++_0x37b241);}(_0x881e,0x146));var _0xe881=function(_0x104648,_0x36d686){_0x104648=_0x104648-0x0;var _0x54463d=_0x881e[_0x104648];return _0x54463d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe881('0x0'));var BPromise=require(_0xe881('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe881('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xe881('0x3'));var logger=require(_0xe881('0x4'))(_0xe881('0x5'));var config=require(_0xe881('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xe881('0x7')][_0xe881('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x561c1c,_0x3f6894,_0x2413dc){return new BPromise(function(_0xe16d23,_0x547217){return client['request'](_0x561c1c,_0x2413dc)[_0xe881('0x9')](function(_0x26e29e){logger[_0xe881('0xa')](_0xe881('0xb'),_0x3f6894,'request\x20sent');logger[_0xe881('0xc')]('SmsApplication,\x20%s,\x20%s,\x20%s',_0x3f6894,_0xe881('0xd'),JSON[_0xe881('0xe')](_0x26e29e));if(_0x26e29e[_0xe881('0xf')]){if(_0x26e29e[_0xe881('0xf')][_0xe881('0x10')]===0x1f4){logger[_0xe881('0xf')](_0xe881('0xb'),_0x3f6894,_0x26e29e['error'][_0xe881('0x11')]);return _0x547217(_0x26e29e[_0xe881('0xf')][_0xe881('0x11')]);}logger['error'](_0xe881('0xb'),_0x3f6894,_0x26e29e['error'][_0xe881('0x11')]);return _0xe16d23(_0x26e29e[_0xe881('0xf')][_0xe881('0x11')]);}else{logger[_0xe881('0xa')]('SmsApplication,\x20%s,\x20%s',_0x3f6894,_0xe881('0xd'));_0xe16d23(_0x26e29e[_0xe881('0x12')][_0xe881('0x11')]);}})[_0xe881('0x13')](function(_0x59b441){logger[_0xe881('0xf')](_0xe881('0xb'),_0x3f6894,_0x59b441);_0x547217(_0x59b441);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 6610c6f..0087b06 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 _0xac4a=['util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./smsInteraction.controller','isAuthenticated','get','describe','getMessages','/:id/download','download','create','post','/:id/messages','addMessage','tracked','sms','smsinteraction:addtags','addTags','put','/:id','smsinteraction:update','update','delete','destroy','/:id/tags','removeTags','exports','multer'];(function(_0x265519,_0x520522){var _0x25c349=function(_0x3918f1){while(--_0x3918f1){_0x265519['push'](_0x265519['shift']());}};_0x25c349(++_0x520522);}(_0xac4a,0x13f));var _0xaac4=function(_0x2f66ff,_0x24197e){_0x2f66ff=_0x2f66ff-0x0;var _0x1c6359=_0xac4a[_0x2f66ff];return _0x1c6359;};'use strict';var multer=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var path=require(_0xaac4('0x2'));var timeout=require(_0xaac4('0x3'));var express=require(_0xaac4('0x4'));var router=express[_0xaac4('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xaac4('0x6'));var config=require(_0xaac4('0x7'));var controller=require(_0xaac4('0x8'));router['get']('/',auth[_0xaac4('0x9')](),controller['index']);router[_0xaac4('0xa')]('/describe',auth[_0xaac4('0x9')](),controller[_0xaac4('0xb')]);router['get']('/:id',auth[_0xaac4('0x9')](),controller['show']);router[_0xaac4('0xa')]('/:id/messages',auth['isAuthenticated'](),controller[_0xaac4('0xc')]);router[_0xaac4('0xa')](_0xaac4('0xd'),auth[_0xaac4('0x9')](),controller[_0xaac4('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0xaac4('0xf')]);router[_0xaac4('0x10')](_0xaac4('0x11'),auth['isAuthenticated'](),controller[_0xaac4('0x12')]);router[_0xaac4('0x10')]('/:id/tags',auth[_0xaac4('0x9')](),interaction[_0xaac4('0x13')](_0xaac4('0x14'),_0xaac4('0x15')),controller[_0xaac4('0x16')]);router[_0xaac4('0x17')](_0xaac4('0x18'),auth[_0xaac4('0x9')](),interaction[_0xaac4('0x13')](_0xaac4('0x14'),_0xaac4('0x19')),controller[_0xaac4('0x1a')]);router[_0xaac4('0x1b')]('/:id',auth[_0xaac4('0x9')](),interaction['tracked'](_0xaac4('0x14'),'smsinteraction:destroy'),controller[_0xaac4('0x1c')]);router[_0xaac4('0x1b')](_0xaac4('0x1d'),auth[_0xaac4('0x9')](),controller[_0xaac4('0x1e')]);module[_0xaac4('0x1f')]=router; \ No newline at end of file +var _0x8603=['sms','addTags','put','/:id','smsinteraction:update','update','delete','destroy','removeTags','exports','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./smsInteraction.controller','isAuthenticated','index','get','/describe','show','/:id/messages','/:id/download','download','post','create','addMessage','/:id/tags','tracked'];(function(_0x1ab13e,_0x44507a){var _0xa28f8=function(_0x231213){while(--_0x231213){_0x1ab13e['push'](_0x1ab13e['shift']());}};_0xa28f8(++_0x44507a);}(_0x8603,0x190));var _0x3860=function(_0x3f3aab,_0x10dd37){_0x3f3aab=_0x3f3aab-0x0;var _0x563c94=_0x8603[_0x3f3aab];return _0x563c94;};'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['describe']);router['get']('/:id',auth[_0x3860('0x7')](),controller[_0x3860('0xb')]);router['get'](_0x3860('0xc'),auth[_0x3860('0x7')](),controller['getMessages']);router[_0x3860('0x9')](_0x3860('0xd'),auth['isAuthenticated'](),controller[_0x3860('0xe')]);router[_0x3860('0xf')]('/',auth['isAuthenticated'](),controller[_0x3860('0x10')]);router[_0x3860('0xf')](_0x3860('0xc'),auth[_0x3860('0x7')](),controller[_0x3860('0x11')]);router[_0x3860('0xf')](_0x3860('0x12'),auth[_0x3860('0x7')](),interaction[_0x3860('0x13')](_0x3860('0x14'),'smsinteraction:addtags'),controller[_0x3860('0x15')]);router[_0x3860('0x16')](_0x3860('0x17'),auth[_0x3860('0x7')](),interaction[_0x3860('0x13')](_0x3860('0x14'),_0x3860('0x18')),controller[_0x3860('0x19')]);router[_0x3860('0x1a')](_0x3860('0x17'),auth[_0x3860('0x7')](),interaction[_0x3860('0x13')]('sms','smsinteraction:destroy'),controller[_0x3860('0x1b')]);router[_0x3860('0x1a')](_0x3860('0x12'),auth['isAuthenticated'](),controller[_0x3860('0x1c')]);module[_0x3860('0x1d')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 9a5d4a8..ab69843 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 _0xb079=['ENUM','moment','exports','BOOLEAN','DATE','STRING'];(function(_0x2ca249,_0x5cb677){var _0x526cda=function(_0x10d8cf){while(--_0x10d8cf){_0x2ca249['push'](_0x2ca249['shift']());}};_0x526cda(++_0x5cb677);}(_0xb079,0x1c9));var _0x9b07=function(_0x4e730e,_0x4c367a){_0x4e730e=_0x4e730e-0x0;var _0x28c3af=_0xb079[_0x4e730e];return _0x28c3af;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x9b07('0x0'));module[_0x9b07('0x1')]={'closed':{'type':Sequelize[_0x9b07('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x9b07('0x3')]},'disposition':{'type':Sequelize[_0x9b07('0x4')]},'secondDisposition':{'type':Sequelize[_0x9b07('0x4')]},'thirdDisposition':{'type':Sequelize[_0x9b07('0x4')]},'note':{'type':Sequelize[_0x9b07('0x4')]},'phone':{'type':Sequelize[_0x9b07('0x4')]},'read1stAt':{'type':Sequelize[_0x9b07('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x9b07('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x9b07('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x9b07('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x9b07('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x1ffe=['BOOLEAN','DATE','STRING','ENUM','out','sequelize','moment','exports'];(function(_0xb6f264,_0x3737a8){var _0x570e78=function(_0x4963b6){while(--_0x4963b6){_0xb6f264['push'](_0xb6f264['shift']());}};_0x570e78(++_0x3737a8);}(_0x1ffe,0xa5));var _0xe1ff=function(_0x146539,_0x57dc50){_0x146539=_0x146539-0x0;var _0x4c4b01=_0x1ffe[_0x146539];return _0x4c4b01;};'use strict';var Sequelize=require(_0xe1ff('0x0'));var moment=require(_0xe1ff('0x1'));module[_0xe1ff('0x2')]={'closed':{'type':Sequelize[_0xe1ff('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xe1ff('0x4')]},'disposition':{'type':Sequelize[_0xe1ff('0x5')]},'secondDisposition':{'type':Sequelize[_0xe1ff('0x5')]},'thirdDisposition':{'type':Sequelize[_0xe1ff('0x5')]},'note':{'type':Sequelize[_0xe1ff('0x5')]},'phone':{'type':Sequelize[_0xe1ff('0x5')]},'read1stAt':{'type':Sequelize[_0xe1ff('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xe1ff('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xe1ff('0x6')]('in',_0xe1ff('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xe1ff('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 0af78cb..9ff135d 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 _0x0237=['../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','defaults','socket.io-emitter','redis','./smsInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','stack','name','send','Users','map','fullname','TagIds','split','forEach','push','catch','waiting','unmanaged','total','closed','talking','UserId','answered','index','rawAttributes','fieldName','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','select','field','from','tools_tags','u.id','u.fullname','ui.SmsInteractionId','user_has_sms_interactions','left_join','users','u.id\x20=\x20ui.UserId','sms_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','sms_accounts','a.id\x20=\x20i.SmsAccountId','sms_messages','sms_interaction_has_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','type','text','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','body','start','compact','SmsAccountId','where','i.SmsAccountId\x20IN\x20?','concat','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','isEmpty','user','role','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','agent','toString','sequelize','keyBy','merge','SmsInteraction','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','all','show','params','keys','includeAll','include','options','create','describe','addMessage','SmsMessage','ids','omit','getMessages','findOne','SmsInteractionId','format','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','addTags','setTags','spread','color','emit','removeTags','download','join','server','files','root','attachments','transcript-%d-%s.zip','CmContact','firstName','lastName','Messages','createdAt','direction','secret','Sms','Account','Owner','N.A.','disposition','out','System','read','renderFile','views','transcript-','.pdf','createPdfFromHTML','err','unlinkSync','rimraf','zip-dir','request-promise','moment','bluebird','util','sox','to-csv','lodash','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../components/export/pdf'];(function(_0x8ee7ac,_0x5735fa){var _0x368f73=function(_0x4220b3){while(--_0x4220b3){_0x8ee7ac['push'](_0x8ee7ac['shift']());}};_0x368f73(++_0x5735fa);}(_0x0237,0xda));var _0x7023=function(_0x3f8f46,_0x362cd4){_0x3f8f46=_0x3f8f46-0x0;var _0x496f4e=_0x0237[_0x3f8f46];return _0x496f4e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7023('0x0'));var zipdir=require(_0x7023('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7023('0x2'));var moment=require(_0x7023('0x3'));var BPromise=require(_0x7023('0x4'));var Mustache=require('mustache');var util=require(_0x7023('0x5'));var path=require('path');var sox=require(_0x7023('0x6'));var csv=require(_0x7023('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7023('0x8'));var squel=require('squel');var crypto=require(_0x7023('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x7023('0xa'));var toCsv=require(_0x7023('0x7'));var querystring=require('querystring');var Papa=require(_0x7023('0xb'));var Redis=require('ioredis');var authService=require(_0x7023('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0x7023('0xd'));var pdf=require(_0x7023('0xe'));var hardwareService=require(_0x7023('0xf'));var logger=require(_0x7023('0x10'))('api');var utils=require(_0x7023('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x7023('0x12'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x7023('0x13')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x7023('0x14'))(new Redis(config[_0x7023('0x15')]));require(_0x7023('0x16'))[_0x7023('0x17')](socket);function respondWithStatusCode(_0x1bf3ec,_0x425431){_0x425431=_0x425431||0xcc;return function(_0x3d841d){if(_0x3d841d){return _0x1bf3ec[_0x7023('0x18')](_0x425431);}return _0x1bf3ec[_0x7023('0x19')](_0x425431)[_0x7023('0x1a')]();};}function respondWithResult(_0x1c302a,_0x52d35b){_0x52d35b=_0x52d35b||0xc8;return function(_0x2df13e){if(_0x2df13e){return _0x1c302a[_0x7023('0x19')](_0x52d35b)[_0x7023('0x1b')](_0x2df13e);}};}function respondWithFilteredResult(_0x9543af,_0x40eee9){return function(_0x4d4716){if(_0x4d4716){var _0x14a7a5=typeof _0x40eee9[_0x7023('0x1c')]===_0x7023('0x1d')&&typeof _0x40eee9[_0x7023('0x1e')]===_0x7023('0x1d');var _0x3be4f4=_0x4d4716[_0x7023('0x1f')];var _0x18d41c=_0x14a7a5?0x0:_0x40eee9[_0x7023('0x1c')];var _0x439cc0=_0x14a7a5?_0x4d4716[_0x7023('0x1f')]:_0x40eee9['offset']+_0x40eee9[_0x7023('0x1e')];var _0x4582c3;if(_0x439cc0>=_0x3be4f4){_0x439cc0=_0x3be4f4;_0x4582c3=0xc8;}else{_0x4582c3=0xce;}_0x9543af[_0x7023('0x19')](_0x4582c3);return _0x9543af['set'](_0x7023('0x20'),_0x18d41c+'-'+_0x439cc0+'/'+_0x3be4f4)[_0x7023('0x1b')](_0x4d4716);}return null;};}function patchUpdates(_0x502d2e){return function(_0xc8d798){try{jsonpatch[_0x7023('0x21')](_0xc8d798,_0x502d2e,!![]);}catch(_0x718485){return BPromise['reject'](_0x718485);}return _0xc8d798[_0x7023('0x22')]();};}function saveUpdates(_0x16f84f,_0x24197a){return function(_0x34f372){if(_0x34f372){return _0x34f372[_0x7023('0x23')](_0x16f84f)[_0x7023('0x24')](function(_0x1316e6){return _0x1316e6;});}return null;};}function removeEntity(_0x4175da,_0x455340){return function(_0x24e12e){if(_0x24e12e){return _0x24e12e[_0x7023('0x25')]()[_0x7023('0x24')](function(){_0x4175da[_0x7023('0x19')](0xcc)[_0x7023('0x1a')]();});}};}function handleEntityNotFound(_0x6e3c32,_0x5f23cb){return function(_0x346ec2){if(!_0x346ec2){_0x6e3c32[_0x7023('0x18')](0x194);}return _0x346ec2;};}function handleError(_0x401497,_0x23d4e){_0x23d4e=_0x23d4e||0x1f4;return function(_0x143a7f){logger['error'](_0x143a7f[_0x7023('0x26')]);if(_0x143a7f[_0x7023('0x27')]){delete _0x143a7f['name'];}_0x401497['status'](_0x23d4e)[_0x7023('0x28')](_0x143a7f);};}function getInteractionUsers(_0x19f0a0,_0x1a1da4){return new BPromise(function(_0x544f53,_0x5336b5){try{if(_0x1a1da4[_0x19f0a0['id']]){_0x19f0a0[_0x7023('0x29')]=_[_0x7023('0x2a')](_0x1a1da4[_0x19f0a0['id']],function(_0x6b045c){return{'id':_0x6b045c['id'],'fullname':_0x6b045c[_0x7023('0x2b')]};});}}catch(_0x5940d3){_0x5336b5(_0x5940d3);}_0x544f53(_0x19f0a0);});}function getInteractionTags(_0x36c185,_0x312393){return new BPromise(function(_0x3d2fd8,_0x36c8e2){try{if(_0x36c185[_0x7023('0x2c')]){_0x36c185['Tags']=[];_0x36c185[_0x7023('0x2c')][_0x7023('0x2d')](',')[_0x7023('0x2e')](function(_0x32b560){_0x36c185['Tags'][_0x7023('0x2f')](_0x312393[_0x32b560]);});}delete _0x36c185[_0x7023('0x2c')];}catch(_0x20d362){_0x36c8e2(_0x20d362);}_0x3d2fd8(_0x36c185);});}function updateSmsInteraction(_0x15d31d,_0x5a50e6,_0x276e67){return new BPromise(function(_0x29b864,_0x2f89a5){return getInteractionUsers(_0x15d31d,_0x276e67)[_0x7023('0x24')](function(_0x1d736c){return getInteractionTags(_0x1d736c,_0x5a50e6);})[_0x7023('0x24')](function(_0x179451){return getStateInteraction(_0x179451);})[_0x7023('0x24')](function(_0x35b2d3){_0x29b864(_0x35b2d3);})[_0x7023('0x30')](function(_0x135327){_0x2f89a5(_0x135327);});});}function getStateInteraction(_0x47c38e){return new BPromise(function(_0x2a51e9){_0x47c38e[_0x7023('0x31')]=0x0;_0x47c38e['talking']=0x0;_0x47c38e['answered']=0x0;_0x47c38e[_0x7023('0x32')]=0x0;_0x47c38e[_0x7023('0x33')]=0x0;if(!_0x47c38e[_0x7023('0x34')]&&!_0x47c38e['UserId']){_0x47c38e[_0x7023('0x31')]+=0x1;}if(!_0x47c38e[_0x7023('0x34')]&&_0x47c38e['UserId']){_0x47c38e[_0x7023('0x35')]+=0x1;if(_0x47c38e[_0x7023('0x31')]){_0x47c38e['waiting']-=0x1;}}if(_0x47c38e[_0x7023('0x34')]&&_0x47c38e[_0x7023('0x36')]){_0x47c38e[_0x7023('0x37')]+=0x1;if(_0x47c38e[_0x7023('0x35')]){_0x47c38e[_0x7023('0x35')]-=0x1;}}if(_0x47c38e[_0x7023('0x34')]&&!_0x47c38e['UserId']){_0x47c38e[_0x7023('0x32')]+=0x1;if(_0x47c38e[_0x7023('0x31')]){_0x47c38e['waiting']-=0x1;}}_0x47c38e['total']+=0x1;_0x2a51e9(_0x47c38e);});}exports[_0x7023('0x38')]=function(_0x4430a0,_0x2df9fa){var _0x5e6544={},_0x8e246c={},_0x8e11aa={'count':0x0,'rows':[]};var _0x419099=_[_0x7023('0x2a')](db['SmsInteraction'][_0x7023('0x39')],function(_0x551955){return{'name':_0x551955[_0x7023('0x3a')],'type':_0x551955['type']['key']};});_0x8e246c[_0x7023('0x3b')]=_[_0x7023('0x2a')](_0x419099,_0x7023('0x27'));_0x8e246c[_0x7023('0x3c')]=_['keys'](_0x4430a0['query']);_0x8e246c[_0x7023('0x3d')]=_[_0x7023('0x3e')](_0x8e246c['model'],_0x8e246c[_0x7023('0x3c')]);_0x5e6544['attributes']=_[_0x7023('0x3e')](_0x8e246c[_0x7023('0x3b')],qs[_0x7023('0x3f')](_0x4430a0[_0x7023('0x3c')][_0x7023('0x3f')]));_0x5e6544[_0x7023('0x40')]=_0x5e6544['attributes'][_0x7023('0x41')]?_0x5e6544[_0x7023('0x40')]:_0x8e246c[_0x7023('0x3b')];if(!_0x4430a0[_0x7023('0x3c')][_0x7023('0x42')](_0x7023('0x43'))){_0x5e6544[_0x7023('0x1e')]=qs[_0x7023('0x1e')](_0x4430a0[_0x7023('0x3c')][_0x7023('0x1e')]);_0x5e6544[_0x7023('0x1c')]=qs[_0x7023('0x1c')](_0x4430a0['query'][_0x7023('0x1c')]);}_0x5e6544[_0x7023('0x44')]=qs[_0x7023('0x45')](_0x4430a0[_0x7023('0x3c')][_0x7023('0x45')]);_0x5e6544['where']=qs[_0x7023('0x3d')](_[_0x7023('0x46')](_0x4430a0[_0x7023('0x3c')],_0x8e246c[_0x7023('0x3d')]),_0x419099);var _0x58f4a2=[];var _0x2a947a=squel[_0x7023('0x47')]()[_0x7023('0x48')]('id')[_0x7023('0x48')](_0x7023('0x27'))[_0x7023('0x48')]('color')[_0x7023('0x49')](_0x7023('0x4a'));var _0x162ce7=squel['select']()[_0x7023('0x48')](_0x7023('0x4b'))['field'](_0x7023('0x4c'))[_0x7023('0x48')](_0x7023('0x4d'))[_0x7023('0x49')](_0x7023('0x4e'),'ui')[_0x7023('0x4f')](_0x7023('0x50'),'u',_0x7023('0x51'));var _0x31796d=squel[_0x7023('0x47')]()['from'](_0x7023('0x52'),'i')[_0x7023('0x4f')]('cm_contacts','c',_0x7023('0x53'))[_0x7023('0x4f')](_0x7023('0x50'),'o',_0x7023('0x54'))[_0x7023('0x4f')](_0x7023('0x55'),'a',_0x7023('0x56'))[_0x7023('0x4f')](_0x7023('0x57'),'me','me.SmsInteractionId\x20=\x20i.id')[_0x7023('0x4f')](_0x7023('0x58'),'it','it.SmsInteractionId\x20=\x20i.id')['left_join'](_0x7023('0x4a'),'t',_0x7023('0x59'));var _0x59c821=squel[_0x7023('0x5a')]();var _0x147041=[];var _0x76af88=squel[_0x7023('0x5a')]();var _0x3470e6;if(_0x4430a0[_0x7023('0x3c')][_0x7023('0x5b')]){_0x3470e6=as[_0x7023('0x5c')](_0x4430a0['query'][_0x7023('0x5b')]);var _0x9fbcb5=_0x3470e6[_0x7023('0x5d')];for(var _0x406e23=0x0;_0x406e23<_0x3470e6[_0x7023('0x5e')][_0x7023('0x41')];_0x406e23++){var _0x4a930d=_0x3470e6[_0x7023('0x5e')][_0x406e23];var _0x32eacc='i';var _0x1e6237=_['find'](_0x419099,[_0x7023('0x27'),_0x4a930d['field']]);if(!_0x1e6237){switch(_0x4a930d[_0x7023('0x48')]){case _0x7023('0x5f'):if(_0x4a930d[_0x7023('0x60')]==0x1){_0x31796d[_0x7023('0x61')]('`'+_0x4a930d[_0x7023('0x48')]+_0x7023('0x62'));}else{_0x31796d['having']('`'+_0x4a930d['field']+_0x7023('0x63'));}break;case _0x7023('0x64'):if(_0x4a930d[_0x7023('0x65')]===_0x7023('0x66')){if(_0x4a930d['value'][_0x7023('0x2d')]('\x20')[_0x7023('0x41')]>0x1){_0x59c821[_0x9fbcb5](_0x7023('0x67'),qs[_0x7023('0x68')](_0x4a930d[_0x7023('0x60')]),null);}else{var _0x44ef02='%'+_0x4a930d[_0x7023('0x60')]+'%';_0x59c821[_0x9fbcb5](_0x7023('0x69'),_0x44ef02,_0x44ef02,_0x44ef02);}}else{_0x1e6237=_[_0x7023('0x6a')](_0x419099,[_0x7023('0x27'),_0x7023('0x6b')]);_0x4a930d['field']='ContactId';_0x229724=as[_0x7023('0x6c')](_0x32eacc,_0x1e6237[_0x7023('0x6d')],_0x4a930d);_0x59c821[_0x9fbcb5](_0x229724[_0x7023('0x6e')],_0x229724[_0x7023('0x60')]['start'],_0x229724['value'][_0x7023('0x1a')]);}break;case'Tag':var _0x1020a7=_0x4a930d['value'][_0x7023('0x2d')](',')[_0x7023('0x2a')](function(_0x5e92f4){return Number(_0x5e92f4);});_0x1020a7[_0x7023('0x2e')](function(_0x17196d){_0x76af88['or'](_0x7023('0x6f'),'%,'+_0x17196d+',%');});_0x147041=_[_0x7023('0x70')](_0x147041,_0x1020a7);break;case _0x7023('0x71'):if(_0x4a930d[_0x7023('0x65')]===_0x7023('0x66')){_0x59c821[_0x9fbcb5]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x4a930d[_0x7023('0x60')]+'%',null);}else{_0x1e6237=_[_0x7023('0x6a')](_0x419099,[_0x7023('0x27'),_0x7023('0x36')]);_0x4a930d[_0x7023('0x48')]=_0x7023('0x36');_0x229724=as[_0x7023('0x6c')](_0x32eacc,_0x1e6237[_0x7023('0x6d')],_0x4a930d);_0x59c821[_0x9fbcb5](_0x229724['text'],_0x229724['value']['start'],_0x229724['value'][_0x7023('0x1a')]);}break;case _0x7023('0x72'):_0x229724=as[_0x7023('0x6c')]('me',null,_0x4a930d);_0x59c821[_0x9fbcb5](_0x229724['text'],_0x229724[_0x7023('0x60')][_0x7023('0x73')],_0x229724[_0x7023('0x60')][_0x7023('0x1a')]);break;}}else{var _0x229724=as[_0x7023('0x6c')](_0x32eacc,_0x1e6237[_0x7023('0x6d')],_0x4a930d);_0x59c821[_0x9fbcb5](_0x229724[_0x7023('0x6e')],_0x229724['value'][_0x7023('0x73')],_0x229724[_0x7023('0x60')][_0x7023('0x1a')]);}}}else{var _0xc77919=_(_0x4430a0[_0x7023('0x3c')])['keys']()[_0x7023('0x2a')](function(_0x11c464){return _['some'](_0x419099,[_0x7023('0x27'),_0x11c464])?_0x11c464:undefined;})[_0x7023('0x74')]()[_0x7023('0x60')]();if(!_['isEmpty'](_0xc77919)){_0xc77919[_0x7023('0x2e')](function(_0x164bee){if(_0x164bee===_0x7023('0x75')){_0x31796d[_0x7023('0x76')](_0x7023('0x77'),[][_0x7023('0x78')](_0x4430a0[_0x7023('0x3c')][_0x164bee]));}else if(_0x164bee==='createdAt'){var _0x251b4f=JSON[_0x7023('0x79')](_0x4430a0[_0x7023('0x3c')][_0x164bee])[_0x7023('0x7a')];var _0x3d78b1=JSON['parse'](_0x4430a0[_0x7023('0x3c')][_0x164bee])[_0x7023('0x7b')];_0x31796d[_0x7023('0x76')](_0x7023('0x7c'),_0x251b4f,_0x3d78b1);}else{if(_0x4430a0[_0x7023('0x3c')][_0x164bee]==='null'){_0x31796d['where']('i.'+_0x164bee+'\x20IS\x20NULL');}else{_0x31796d['where']('i.'+_0x164bee+'\x20=\x20?',_0x4430a0['query'][_0x164bee]);}}});}if(_0x4430a0[_0x7023('0x3c')]['read']){if(_0x4430a0[_0x7023('0x3c')]['read']==0x1){_0x31796d[_0x7023('0x61')]('`unreadMessages`\x20=\x200');}else{_0x31796d['having'](_0x7023('0x7d'));}}if(_0x4430a0[_0x7023('0x3c')][_0x7023('0x7e')]){_0x147041=_[_0x7023('0x7f')](_0x4430a0[_0x7023('0x3c')][_0x7023('0x7e')])?_0x4430a0[_0x7023('0x3c')][_0x7023('0x7e')]:new Array(_0x4430a0[_0x7023('0x3c')][_0x7023('0x7e')]);_0x147041['forEach'](function(_0xfdd239){_0x76af88['or'](_0x7023('0x6f'),'%,'+_0xfdd239+',%');});}if(_0x4430a0['query']['filter']){var _0x1e8381=_0x4430a0['query'][_0x7023('0x80')][_0x7023('0x81')]('\x5c','\x5c\x5c')[_0x7023('0x81')](/'/g,'\x27\x27');if(qs[_0x7023('0x82')](_0x1e8381)){_0x59c821['or']('i.id\x20LIKE\x20?',_0x1e8381+'%')['or'](_0x7023('0x83'),_0x1e8381+'%');}else{_0x59c821['or'](_0x7023('0x84'),qs[_0x7023('0x68')](_0x1e8381))['or'](_0x7023('0x85'),_0x1e8381+'%');}}}_0x31796d[_0x7023('0x76')](_0x59c821);_0x31796d[_0x7023('0x86')](_0x7023('0x87'));var _0xe015be={'type':db[_0x7023('0x88')][_0x7023('0x89')][_0x7023('0x8a')],'raw':!![]};var _0x25fe20=_0x31796d[_0x7023('0x8b')]();_0x25fe20[_0x7023('0x48')](_0x7023('0x87'));_0x25fe20[_0x7023('0x48')](_0x7023('0x8c'),'unreadMessages');if(_0x5e6544[_0x7023('0x44')]){_0x5e6544[_0x7023('0x44')]['forEach'](function(_0x25e03b){var _0x50cc74=_0x25e03b[0x0]===_0x7023('0x8d')?_0x25e03b[0x0]:'i.'+_0x25e03b[0x0];_0x31796d[_0x7023('0x44')](_0x50cc74,_0x25e03b[0x1]===_0x7023('0x8e')?![]:!![]);});}if(!_[_0x7023('0x8f')](_0x147041)){_0x31796d[_0x7023('0x61')](_0x76af88);_0x25fe20[_0x7023('0x76')]('t.id\x20IN\x20?',_0x147041);}BPromise['resolve']()[_0x7023('0x24')](function(){if(!_0x3470e6){if(_0x4430a0['query'][_0x7023('0x75')])return;_0x25fe20[_0x7023('0x76')]('i.SmsAccountId\x20IS\x20NOT\x20NULL');_0x31796d['where']('i.SmsAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x4430a0[_0x7023('0x90')][_0x7023('0x91')]!=='agent')return;return _0x4430a0[_0x7023('0x90')][_0x7023('0x92')]({'attributes':['id'],'raw':!![]})[_0x7023('0x24')](function(_0x3fdadc){if(_[_0x7023('0x8f')](_0x3fdadc)){_0x25fe20['where'](_0x7023('0x93'));_0x31796d[_0x7023('0x76')]('i.SmsAccountId\x20IS\x20NULL');}else{_0x25fe20[_0x7023('0x76')](_0x7023('0x77'),_['map'](_0x3fdadc,'id'));_0x31796d['where'](_0x7023('0x77'),_['map'](_0x3fdadc,'id'));}});})[_0x7023('0x24')](function(){if(_0x4430a0[_0x7023('0x90')]['role']===_0x7023('0x94')&&!_0x3470e6&&!_0x4430a0['query'][_0x7023('0x75')])return[];return db['sequelize'][_0x7023('0x3c')](_0x25fe20[_0x7023('0x95')](),_0xe015be);})['then'](function(_0x2ad1b9){_0x8e11aa[_0x7023('0x1f')]=_0x2ad1b9[_0x7023('0x41')];if(_0x8e11aa[_0x7023('0x1f')]===0x0)return[];return db[_0x7023('0x96')][_0x7023('0x3c')](_0x2a947a['toString'](),_0xe015be)[_0x7023('0x24')](function(_0x241593){_0x58f4a2=_[_0x7023('0x97')](_0x241593,'id');_0xe015be=_[_0x7023('0x98')](_0xe015be,{'model':db[_0x7023('0x99')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4430a0[_0x7023('0x3c')][_0x7023('0x3f')]){_0x5e6544['attributes'][_0x7023('0x2e')](function(_0x49cc80){_0x31796d['field']('i.'+_0x49cc80);});}else{_0x31796d[_0x7023('0x48')](_0x7023('0x8c'),_0x7023('0x5f'));_0x31796d[_0x7023('0x48')](_0x7023('0x9a'),_0x7023('0x9b'));_0x31796d['field'](_0x7023('0x9c'),_0x7023('0x9d'));_0x31796d['field'](_0x7023('0x9e'),_0x7023('0x8d'));_0x31796d[_0x7023('0x48')](_0x7023('0x9f'));_0x31796d[_0x7023('0x48')](_0x7023('0xa0'),_0x7023('0xa1'));_0x31796d[_0x7023('0x48')](_0x7023('0xa2'),_0x7023('0xa3'));_0x31796d[_0x7023('0x48')](_0x7023('0xa4'),_0x7023('0xa5'));_0x31796d[_0x7023('0x48')](_0x7023('0xa6'),_0x7023('0xa7'));_0x31796d[_0x7023('0x48')](_0x7023('0xa8'),_0x7023('0xa9'));_0x31796d[_0x7023('0x48')](_0x7023('0xaa'),_0x7023('0xab'));_0x31796d[_0x7023('0x48')](_0x7023('0xac'),_0x7023('0xad'));_0x31796d[_0x7023('0x48')](_0x7023('0xae'),_0x7023('0xaf'));_0x31796d[_0x7023('0x48')](_0x7023('0xb0'),_0x7023('0x2c'));}if(_0x5e6544[_0x7023('0x1e')])_0x31796d[_0x7023('0x1e')](_0x5e6544['limit']);if(_0x5e6544['offset'])_0x31796d[_0x7023('0x1c')](_0x5e6544[_0x7023('0x1c')]);return db[_0x7023('0x96')]['query'](_0x31796d[_0x7023('0x95')](),_0xe015be);})[_0x7023('0x24')](function(_0x3d69be){if(_0x3d69be[_0x7023('0x41')]>0x0)_0x162ce7[_0x7023('0x76')]('ui.SmsInteractionId\x20IN\x20?',_[_0x7023('0x2a')](_0x3d69be,'id'));return db[_0x7023('0x96')][_0x7023('0x3c')](_0x162ce7[_0x7023('0x95')](),_0xe015be)[_0x7023('0x24')](function(_0x5eaa4e){var _0x4fb664=_[_0x7023('0xb1')](_0x5eaa4e,'SmsInteractionId');var _0xa3eb9=[];_0x3d69be[_0x7023('0x2e')](function(_0x2615e4){_0xa3eb9[_0x7023('0x2f')](updateSmsInteraction(_0x2615e4,_0x58f4a2,_0x4fb664));});return BPromise[_0x7023('0xb2')](_0xa3eb9);});});})[_0x7023('0x24')](function(_0x41be54){_0x8e11aa['rows']=_0x41be54;return _0x8e11aa;})[_0x7023('0x24')](respondWithFilteredResult(_0x2df9fa,_0x5e6544))[_0x7023('0x30')](handleError(_0x2df9fa,null));};exports[_0x7023('0xb3')]=function(_0x594616,_0x3594b4){var _0x146150={'raw':![],'where':{'id':_0x594616[_0x7023('0xb4')]['id']}},_0x2d6109={};_0x2d6109[_0x7023('0x3b')]=_[_0x7023('0xb5')](db['SmsInteraction'][_0x7023('0x39')]);_0x2d6109[_0x7023('0x3c')]=_[_0x7023('0xb5')](_0x594616[_0x7023('0x3c')]);_0x2d6109[_0x7023('0x3d')]=_[_0x7023('0x3e')](_0x2d6109['model'],_0x2d6109['query']);_0x146150[_0x7023('0x40')]=_['intersection'](_0x2d6109[_0x7023('0x3b')],qs[_0x7023('0x3f')](_0x594616[_0x7023('0x3c')]['fields']));_0x146150['attributes']=_0x146150[_0x7023('0x40')]['length']?_0x146150[_0x7023('0x40')]:_0x2d6109[_0x7023('0x3b')];if(_0x594616[_0x7023('0x3c')][_0x7023('0xb6')]){_0x146150[_0x7023('0xb7')]=[{'all':!![]}];}_0x146150=_[_0x7023('0x98')]({},_0x146150,_0x594616[_0x7023('0xb8')]);return db[_0x7023('0x99')][_0x7023('0x6a')](_0x146150)[_0x7023('0x24')](handleEntityNotFound(_0x3594b4,null))[_0x7023('0x24')](respondWithResult(_0x3594b4,null))[_0x7023('0x30')](handleError(_0x3594b4,null));};exports[_0x7023('0xb9')]=function(_0x106687,_0x13dfe4){return db[_0x7023('0x99')]['create'](_0x106687[_0x7023('0x72')],{})[_0x7023('0x24')](respondWithResult(_0x13dfe4,0xc9))['catch'](handleError(_0x13dfe4,null));};exports[_0x7023('0x23')]=function(_0x3d5c65,_0x1ec000){if(_0x3d5c65[_0x7023('0x72')]['id']){delete _0x3d5c65['body']['id'];}return db[_0x7023('0x99')][_0x7023('0x6a')]({'where':{'id':_0x3d5c65[_0x7023('0xb4')]['id']}})[_0x7023('0x24')](handleEntityNotFound(_0x1ec000,null))[_0x7023('0x24')](saveUpdates(_0x3d5c65[_0x7023('0x72')],null))[_0x7023('0x24')](respondWithResult(_0x1ec000,null))[_0x7023('0x30')](handleError(_0x1ec000,null));};exports[_0x7023('0x25')]=function(_0x25454e,_0x59a8c0){return db[_0x7023('0x99')][_0x7023('0x6a')]({'where':{'id':_0x25454e[_0x7023('0xb4')]['id']}})['then'](handleEntityNotFound(_0x59a8c0,null))['then'](removeEntity(_0x59a8c0,null))['catch'](handleError(_0x59a8c0,null));};exports[_0x7023('0xba')]=function(_0xe6cb08,_0x4a3f0e){return db[_0x7023('0x99')][_0x7023('0xba')]()[_0x7023('0x24')](respondWithResult(_0x4a3f0e,null))[_0x7023('0x30')](handleError(_0x4a3f0e,null));};exports[_0x7023('0xbb')]=function(_0x49c7a3,_0x38ac93,_0x1e14db){return db[_0x7023('0xbc')][_0x7023('0x6a')]({'where':{'id':_0x49c7a3[_0x7023('0xb4')]['id']}})[_0x7023('0x24')](handleEntityNotFound(_0x38ac93,null))[_0x7023('0x24')](function(_0xe4a76e){if(_0xe4a76e){return _0xe4a76e[_0x7023('0xbb')](_0x49c7a3[_0x7023('0x72')][_0x7023('0xbd')],_[_0x7023('0xbe')](_0x49c7a3[_0x7023('0x72')],[_0x7023('0xbd'),'id'])||{});}})[_0x7023('0x24')](respondWithResult(_0x38ac93,null))[_0x7023('0x30')](handleError(_0x38ac93,null));};exports[_0x7023('0xbf')]=function(_0x28234c,_0x4c5915,_0x3bc613){var _0x502e17={'raw':![],'where':{}};var _0x2d6125={};var _0x533403={'count':0x0,'rows':[]};return db[_0x7023('0x99')][_0x7023('0xc0')]({'where':{'id':_0x28234c[_0x7023('0xb4')]['id']}})[_0x7023('0x24')](handleEntityNotFound(_0x4c5915,null))[_0x7023('0x24')](function(_0x1c4ac0){if(_0x1c4ac0){_0x2d6125[_0x7023('0x3b')]=_[_0x7023('0xb5')](db[_0x7023('0xbc')]['rawAttributes']);_0x2d6125[_0x7023('0x3c')]=_['keys'](_0x28234c[_0x7023('0x3c')]);_0x2d6125['filters']=_['intersection'](_0x2d6125[_0x7023('0x3b')],_0x2d6125['query']);_0x502e17[_0x7023('0x40')]=_[_0x7023('0x3e')](_0x2d6125['model'],qs['fields'](_0x28234c[_0x7023('0x3c')][_0x7023('0x3f')]));_0x502e17['attributes']=_0x502e17[_0x7023('0x40')][_0x7023('0x41')]?_0x502e17[_0x7023('0x40')]:_0x2d6125[_0x7023('0x3b')];if(!_0x28234c[_0x7023('0x3c')][_0x7023('0x42')](_0x7023('0x43'))){_0x502e17['limit']=qs[_0x7023('0x1e')](_0x28234c[_0x7023('0x3c')][_0x7023('0x1e')]);_0x502e17[_0x7023('0x1c')]=qs['offset'](_0x28234c['query'][_0x7023('0x1c')]);}_0x502e17[_0x7023('0x44')]=qs[_0x7023('0x45')](_0x28234c[_0x7023('0x3c')][_0x7023('0x45')]);_0x502e17['where']=qs[_0x7023('0x3d')](_[_0x7023('0x46')](_0x28234c[_0x7023('0x3c')],_0x2d6125['filters']));_0x502e17[_0x7023('0x76')][_0x7023('0xc1')]=_0x1c4ac0['id'];if(_0x28234c[_0x7023('0x3c')]['filter']){_0x502e17[_0x7023('0x76')]=_[_0x7023('0x98')](_0x502e17[_0x7023('0x76')],{'$or':_[_0x7023('0x2a')](_0x502e17[_0x7023('0x40')],function(_0x3c89a){var _0xab9388={};_0xab9388[_0x3c89a]={'$like':'%'+_0x28234c['query']['filter']+'%'};return _0xab9388;})});}if(_0x28234c[_0x7023('0x3c')]['$gte']){var _0x1c714b=_0x28234c[_0x7023('0x3c')][_0x7023('0x7a')]['split'](',');var _0x4c30f2={};_0x4c30f2[_0x1c714b[0x0]]={'$gte':moment(_0x1c714b[0x1])[_0x7023('0xc2')](_0x7023('0xc3'))};_0x502e17[_0x7023('0x76')]=_[_0x7023('0x98')](_0x502e17[_0x7023('0x76')],_0x4c30f2);}_0x502e17=_['merge']({},_0x502e17,_0x28234c['options']);return db[_0x7023('0xbc')][_0x7023('0x1f')]({'where':_0x502e17[_0x7023('0x76')]})['then'](function(_0x5d5476){_0x533403['count']=_0x5d5476;if(_0x28234c[_0x7023('0x3c')][_0x7023('0xb6')]){_0x502e17['include']=[{'all':!![]}];}return db[_0x7023('0xbc')][_0x7023('0xc4')](_0x502e17);})[_0x7023('0x24')](function(_0x51586b){_0x533403[_0x7023('0xc5')]=_0x51586b;return _0x533403;});}})[_0x7023('0x24')](respondWithFilteredResult(_0x4c5915,_0x502e17))[_0x7023('0x30')](handleError(_0x4c5915,null));};exports[_0x7023('0xc6')]=function(_0x47ca02,_0x53b5d4,_0x3bd72c){return db[_0x7023('0x99')][_0x7023('0x6a')]({'where':{'id':_0x47ca02[_0x7023('0xb4')]['id']}})[_0x7023('0x24')](handleEntityNotFound(_0x53b5d4,null))[_0x7023('0x24')](function(_0x5c5979){if(_0x5c5979){return _0x5c5979[_0x7023('0xc7')](_0x47ca02[_0x7023('0x72')]['ids'],_[_0x7023('0xbe')](_0x47ca02[_0x7023('0x72')],['ids','id'])||{})[_0x7023('0xc8')](function(){return db['Tag'][_0x7023('0xc4')]({'attributes':['id','name',_0x7023('0xc9')],'where':{'id':_0x47ca02['body'][_0x7023('0xbd')]}});})[_0x7023('0x24')](function(_0x179317){socket[_0x7023('0xca')]('smsInteractionTags:save',{'id':Number(_0x47ca02['params']['id']),'tags':_0x179317||[]});return{'id':Number(_0x47ca02[_0x7023('0xb4')]['id']),'tags':_0x179317||[]};});}})[_0x7023('0x24')](respondWithResult(_0x53b5d4,null))[_0x7023('0x30')](handleError(_0x53b5d4,null));};exports['removeTags']=function(_0x424b08,_0x2b9608,_0x506799){return db[_0x7023('0x99')]['find']({'where':{'id':_0x424b08[_0x7023('0xb4')]['id']}})['then'](handleEntityNotFound(_0x2b9608,null))['then'](function(_0x22d888){if(_0x22d888){return _0x22d888[_0x7023('0xcb')](_0x424b08['query'][_0x7023('0xbd')]);}})[_0x7023('0x24')](respondWithStatusCode(_0x2b9608,null))[_0x7023('0x30')](handleError(_0x2b9608,null));};exports[_0x7023('0xcc')]=function(_0x487790,_0x1659f7){var _0xe34a81=moment()['unix']()[_0x7023('0x95')]();var _0x489554=path[_0x7023('0xcd')](config['root'],_0x7023('0xce'),_0x7023('0xcf'),'tmp');var _0xd01639=path[_0x7023('0xcd')](config[_0x7023('0xd0')],_0x7023('0xce'),_0x7023('0xcf'),_0x7023('0xd1'));var _0x3e0b54=path[_0x7023('0xcd')](_0x489554,_0xe34a81);var _0x1b3706=util[_0x7023('0xc2')](_0x7023('0xd2'),_0x487790[_0x7023('0xb4')]['id'],_0xe34a81);var _0x1a6d36=path[_0x7023('0xcd')](_0x489554,_0x1b3706);var _0x254666=[];_0x254666[_0x7023('0x2f')]({'model':db['User'],'as':_0x7023('0x71'),'attributes':['id','fullname'],'raw':!![]});_0x254666[_0x7023('0x2f')]({'model':db[_0x7023('0xd3')],'as':_0x7023('0x64'),'attributes':['id',_0x7023('0xd4'),_0x7023('0xd5')],'raw':!![]});var _0x2850e6=[{'model':db['SmsMessage'],'as':_0x7023('0xd6'),'attributes':['id',_0x7023('0x72'),_0x7023('0xd7'),_0x7023('0xd8'),_0x7023('0xd9'),'read'],'include':_0x254666}];_0x2850e6[_0x7023('0x2f')]({'model':db['SmsAccount'],'as':'Account','attributes':['id','name']});_0x2850e6['push']({'model':db[_0x7023('0x71')],'as':'Owner','attributes':['id',_0x7023('0x2b')]});return db[_0x7023('0x99')][_0x7023('0x6a')]({'where':{'id':_0x487790[_0x7023('0xb4')]['id']},'include':_0x2850e6})[_0x7023('0x24')](handleEntityNotFound(_0x1659f7,null))[_0x7023('0x24')](function(_0x514c4e){if(_0x514c4e){var _0x3f3a4b=_0x514c4e['get']({'plain':!![]});fs['mkdirSync'](_0x3e0b54);var _0x310f83={'channel':_0x7023('0xda'),'account':_0x3f3a4b[_0x7023('0xdb')][_0x7023('0x27')],'agent':_0x3f3a4b[_0x7023('0xdc')]?_0x3f3a4b[_0x7023('0xdc')][_0x7023('0x2b')]:_0x7023('0xdd'),'createdAt':moment(_0x3f3a4b[_0x7023('0xd7')])[_0x7023('0xc2')](_0x7023('0xc3'))[_0x7023('0x95')](),'closedAt':_0x3f3a4b[_0x7023('0x34')]?moment(_0x3f3a4b['closedAt'])[_0x7023('0xc2')](_0x7023('0xc3'))[_0x7023('0x95')]():'','disposition':_0x3f3a4b[_0x7023('0xde')],'messages':_(_0x3f3a4b[_0x7023('0xd6')])[_0x7023('0x80')]({'secret':![]})[_0x7023('0x2a')](function(_0x4cfb60){return{'date':moment(_0x4cfb60[_0x7023('0xd7')])['format'](_0x7023('0xc3'))[_0x7023('0x95')](),'sender':_0x4cfb60[_0x7023('0xd8')]===_0x7023('0xdf')?_0x4cfb60[_0x7023('0x71')]?_0x4cfb60[_0x7023('0x71')][_0x7023('0x2b')]:_0x7023('0xe0'):_0x4cfb60['Contact'][_0x7023('0xd4')]+(_0x4cfb60[_0x7023('0x64')][_0x7023('0xd5')]?'\x20'+_0x4cfb60[_0x7023('0x64')][_0x7023('0xd5')]:''),'body':_0x4cfb60[_0x7023('0x72')],'direction':_0x4cfb60['direction']==='out'?'A':'C','secret':_0x4cfb60[_0x7023('0xd9')],'read':_0x4cfb60[_0x7023('0xe1')]};})[_0x7023('0x60')]()};return ejs[_0x7023('0xe2')](path[_0x7023('0xcd')](config['root'],_0x7023('0xce'),_0x7023('0xe3'),'downloadInteraction.ejs'),{'interaction':_0x310f83})['then'](function(_0x13e200){var _0x72667b=path['join'](_0x3e0b54,_0x7023('0xe4')+_0x3f3a4b['id']+'-'+_0xe34a81+_0x7023('0xe5'));var _0x484361={'path':_0x72667b,'channel':_0x7023('0xda'),'interactionId':_0x3f3a4b['id']};return pdf[_0x7023('0xe6')](_0x13e200,_0x484361);})[_0x7023('0x24')](function(){return new BPromise(function(_0x45d22a,_0x92b399){zipdir(_0x3e0b54,{'saveTo':_0x1a6d36},function(_0x4e87df,_0x13ac41){if(_0x4e87df)return _0x92b399(_0x4e87df);return _0x45d22a(_0x13ac41);});})[_0x7023('0x24')](function(){return new BPromise(function(_0x94b3f4,_0x324012){rimraf(_0x3e0b54,function(_0x26dc30){if(_0x26dc30)_0x324012(_0x26dc30);return _0x94b3f4();});});})[_0x7023('0x24')](function(){return _0x1659f7[_0x7023('0xcc')](_0x1a6d36,_0x1b3706,function(_0xcd5b7f){if(_0xcd5b7f){console['log'](_0x7023('0xe7'),_0xcd5b7f);}else{fs[_0x7023('0xe8')](_0x1a6d36);}});});});}else{return _0x1659f7[_0x7023('0x18')](0xc8);}})[_0x7023('0x30')](handleError(_0x1659f7,null));}; \ No newline at end of file +var _0xed0e=['i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','agent','i.SmsAccountId\x20IS\x20NULL','role','sequelize','toString','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','Owner.fullname','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','SmsInteractionId','all','rows','catch','show','params','rawAttributes','include','create','destroy','describe','addMessage','SmsMessage','ids','omit','getMessages','includeAll','addTags','setTags','spread','findAll','emit','removeTags','download','unix','join','root','server','files','tmp','transcript-%d-%s.zip','firstName','lastName','Messages','direction','secret','SmsAccount','Owner','get','mkdirSync','Sms','Account','N.A.','format','YYYY-MM-DD\x20HH:mm:ss','closedAt','out','renderFile','transcript-','.pdf','createPdfFromHTML','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','defaults','localhost','socket.io-emitter','redis','register','status','end','json','undefined','offset','count','limit','set','Content-Range','apply','reject','save','update','then','sendStatus','error','name','Users','map','fullname','TagIds','Tags','push','waiting','talking','answered','total','closed','UserId','index','SmsInteraction','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','tools_tags','u.id','u.fullname','ui.SmsInteractionId','left_join','from','sms_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','sms_messages','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','expr','search','parseSearch','conditions','unreadMessages','value','having','`\x20>\x200','Contact','$substring','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','text','Tag','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','start','body','some','isEmpty','SmsAccountId','i.SmsAccountId\x20IN\x20?','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','Sequelize','QueryTypes','SELECT'];(function(_0x43b1f2,_0x596e38){var _0x451987=function(_0x299f61){while(--_0x299f61){_0x43b1f2['push'](_0x43b1f2['shift']());}};_0x451987(++_0x596e38);}(_0xed0e,0x13d));var _0xeed0=function(_0x2283dc,_0x2fcfc5){_0x2283dc=_0x2283dc-0x0;var _0x16db90=_0xed0e[_0x2283dc];return _0x16db90;};'use strict';var emlformat=require(_0xeed0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xeed0('0x1'));var jsonpatch=require(_0xeed0('0x2'));var rp=require('request-promise');var moment=require(_0xeed0('0x3'));var BPromise=require(_0xeed0('0x4'));var Mustache=require(_0xeed0('0x5'));var util=require(_0xeed0('0x6'));var path=require(_0xeed0('0x7'));var sox=require(_0xeed0('0x8'));var csv=require(_0xeed0('0x9'));var ejs=require(_0xeed0('0xa'));var fs=require('fs');var fs_extra=require(_0xeed0('0xb'));var _=require(_0xeed0('0xc'));var squel=require(_0xeed0('0xd'));var crypto=require(_0xeed0('0xe'));var jsforce=require(_0xeed0('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xeed0('0x9'));var querystring=require('querystring');var Papa=require(_0xeed0('0x10'));var Redis=require(_0xeed0('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xeed0('0x12'));var as=require(_0xeed0('0x13'));var pdf=require(_0xeed0('0x14'));var hardwareService=require(_0xeed0('0x15'));var logger=require(_0xeed0('0x16'))(_0xeed0('0x17'));var utils=require(_0xeed0('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xeed0('0x19'))['db'];config['redis']=_[_0xeed0('0x1a')](config['redis'],{'host':_0xeed0('0x1b'),'port':0x18eb});var socket=require(_0xeed0('0x1c'))(new Redis(config[_0xeed0('0x1d')]));require('./smsInteraction.socket')[_0xeed0('0x1e')](socket);function respondWithStatusCode(_0x6748b3,_0x565a2b){_0x565a2b=_0x565a2b||0xcc;return function(_0x3d9677){if(_0x3d9677){return _0x6748b3['sendStatus'](_0x565a2b);}return _0x6748b3[_0xeed0('0x1f')](_0x565a2b)[_0xeed0('0x20')]();};}function respondWithResult(_0x505a6e,_0x14db8b){_0x14db8b=_0x14db8b||0xc8;return function(_0x7e7a37){if(_0x7e7a37){return _0x505a6e['status'](_0x14db8b)[_0xeed0('0x21')](_0x7e7a37);}};}function respondWithFilteredResult(_0x873378,_0x407255){return function(_0x2fd078){if(_0x2fd078){var _0x43058b=typeof _0x407255['offset']===_0xeed0('0x22')&&typeof _0x407255['limit']===_0xeed0('0x22');var _0x4b5510=_0x2fd078['count'];var _0x5ba28c=_0x43058b?0x0:_0x407255[_0xeed0('0x23')];var _0x703072=_0x43058b?_0x2fd078[_0xeed0('0x24')]:_0x407255[_0xeed0('0x23')]+_0x407255[_0xeed0('0x25')];var _0x1387de;if(_0x703072>=_0x4b5510){_0x703072=_0x4b5510;_0x1387de=0xc8;}else{_0x1387de=0xce;}_0x873378[_0xeed0('0x1f')](_0x1387de);return _0x873378[_0xeed0('0x26')](_0xeed0('0x27'),_0x5ba28c+'-'+_0x703072+'/'+_0x4b5510)[_0xeed0('0x21')](_0x2fd078);}return null;};}function patchUpdates(_0x54d906){return function(_0x1c10c9){try{jsonpatch[_0xeed0('0x28')](_0x1c10c9,_0x54d906,!![]);}catch(_0x248432){return BPromise[_0xeed0('0x29')](_0x248432);}return _0x1c10c9[_0xeed0('0x2a')]();};}function saveUpdates(_0x18f83b,_0x4bebd7){return function(_0x4b7b19){if(_0x4b7b19){return _0x4b7b19[_0xeed0('0x2b')](_0x18f83b)['then'](function(_0x1f336f){return _0x1f336f;});}return null;};}function removeEntity(_0x1b6c39,_0x33bf25){return function(_0x323417){if(_0x323417){return _0x323417['destroy']()[_0xeed0('0x2c')](function(){_0x1b6c39[_0xeed0('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x395cbc,_0x3a5120){return function(_0x14656d){if(!_0x14656d){_0x395cbc[_0xeed0('0x2d')](0x194);}return _0x14656d;};}function handleError(_0x59adc9,_0x1d705b){_0x1d705b=_0x1d705b||0x1f4;return function(_0x2ee582){logger[_0xeed0('0x2e')](_0x2ee582['stack']);if(_0x2ee582[_0xeed0('0x2f')]){delete _0x2ee582['name'];}_0x59adc9[_0xeed0('0x1f')](_0x1d705b)['send'](_0x2ee582);};}function getInteractionUsers(_0x5ed0af,_0x1356be){return new BPromise(function(_0x43be6d,_0x4800c4){try{if(_0x1356be[_0x5ed0af['id']]){_0x5ed0af[_0xeed0('0x30')]=_[_0xeed0('0x31')](_0x1356be[_0x5ed0af['id']],function(_0x48a590){return{'id':_0x48a590['id'],'fullname':_0x48a590[_0xeed0('0x32')]};});}}catch(_0x2c1a0f){_0x4800c4(_0x2c1a0f);}_0x43be6d(_0x5ed0af);});}function getInteractionTags(_0xe3d2c4,_0x893451){return new BPromise(function(_0x34e53d,_0x15d2bf){try{if(_0xe3d2c4[_0xeed0('0x33')]){_0xe3d2c4[_0xeed0('0x34')]=[];_0xe3d2c4['TagIds']['split'](',')['forEach'](function(_0xd66a8f){_0xe3d2c4[_0xeed0('0x34')][_0xeed0('0x35')](_0x893451[_0xd66a8f]);});}delete _0xe3d2c4['TagIds'];}catch(_0x2a6415){_0x15d2bf(_0x2a6415);}_0x34e53d(_0xe3d2c4);});}function updateSmsInteraction(_0x58a7ab,_0x45b8ea,_0x36c3bb){return new BPromise(function(_0x4f6885,_0x23167e){return getInteractionUsers(_0x58a7ab,_0x36c3bb)[_0xeed0('0x2c')](function(_0x56418e){return getInteractionTags(_0x56418e,_0x45b8ea);})['then'](function(_0x19557e){return getStateInteraction(_0x19557e);})[_0xeed0('0x2c')](function(_0x1744b9){_0x4f6885(_0x1744b9);})['catch'](function(_0x5c5325){_0x23167e(_0x5c5325);});});}function getStateInteraction(_0x159eb7){return new BPromise(function(_0x394fec){_0x159eb7[_0xeed0('0x36')]=0x0;_0x159eb7[_0xeed0('0x37')]=0x0;_0x159eb7[_0xeed0('0x38')]=0x0;_0x159eb7['unmanaged']=0x0;_0x159eb7[_0xeed0('0x39')]=0x0;if(!_0x159eb7[_0xeed0('0x3a')]&&!_0x159eb7[_0xeed0('0x3b')]){_0x159eb7[_0xeed0('0x36')]+=0x1;}if(!_0x159eb7['closed']&&_0x159eb7[_0xeed0('0x3b')]){_0x159eb7[_0xeed0('0x37')]+=0x1;if(_0x159eb7[_0xeed0('0x36')]){_0x159eb7[_0xeed0('0x36')]-=0x1;}}if(_0x159eb7[_0xeed0('0x3a')]&&_0x159eb7[_0xeed0('0x3b')]){_0x159eb7['answered']+=0x1;if(_0x159eb7[_0xeed0('0x37')]){_0x159eb7[_0xeed0('0x37')]-=0x1;}}if(_0x159eb7['closed']&&!_0x159eb7[_0xeed0('0x3b')]){_0x159eb7['unmanaged']+=0x1;if(_0x159eb7[_0xeed0('0x36')]){_0x159eb7[_0xeed0('0x36')]-=0x1;}}_0x159eb7[_0xeed0('0x39')]+=0x1;_0x394fec(_0x159eb7);});}exports[_0xeed0('0x3c')]=function(_0x4a652f,_0x3983c3){var _0x15115e={},_0x5e02bd={},_0x1f19de={'count':0x0,'rows':[]};var _0x1e9dc7=_['map'](db[_0xeed0('0x3d')]['rawAttributes'],function(_0x23c9ec){return{'name':_0x23c9ec[_0xeed0('0x3e')],'type':_0x23c9ec[_0xeed0('0x3f')][_0xeed0('0x40')]};});_0x5e02bd[_0xeed0('0x41')]=_[_0xeed0('0x31')](_0x1e9dc7,_0xeed0('0x2f'));_0x5e02bd[_0xeed0('0x42')]=_[_0xeed0('0x43')](_0x4a652f['query']);_0x5e02bd[_0xeed0('0x44')]=_[_0xeed0('0x45')](_0x5e02bd[_0xeed0('0x41')],_0x5e02bd[_0xeed0('0x42')]);_0x15115e['attributes']=_['intersection'](_0x5e02bd[_0xeed0('0x41')],qs[_0xeed0('0x46')](_0x4a652f[_0xeed0('0x42')][_0xeed0('0x46')]));_0x15115e[_0xeed0('0x47')]=_0x15115e[_0xeed0('0x47')][_0xeed0('0x48')]?_0x15115e[_0xeed0('0x47')]:_0x5e02bd[_0xeed0('0x41')];if(!_0x4a652f['query'][_0xeed0('0x49')](_0xeed0('0x4a'))){_0x15115e[_0xeed0('0x25')]=qs[_0xeed0('0x25')](_0x4a652f['query'][_0xeed0('0x25')]);_0x15115e[_0xeed0('0x23')]=qs['offset'](_0x4a652f['query'][_0xeed0('0x23')]);}_0x15115e[_0xeed0('0x4b')]=qs[_0xeed0('0x4c')](_0x4a652f[_0xeed0('0x42')][_0xeed0('0x4c')]);_0x15115e[_0xeed0('0x4d')]=qs[_0xeed0('0x44')](_[_0xeed0('0x4e')](_0x4a652f[_0xeed0('0x42')],_0x5e02bd[_0xeed0('0x44')]),_0x1e9dc7);var _0x355c9d=[];var _0x17760f=squel[_0xeed0('0x4f')]()[_0xeed0('0x50')]('id')[_0xeed0('0x50')](_0xeed0('0x2f'))[_0xeed0('0x50')](_0xeed0('0x51'))['from'](_0xeed0('0x52'));var _0x3a6221=squel[_0xeed0('0x4f')]()['field'](_0xeed0('0x53'))['field'](_0xeed0('0x54'))[_0xeed0('0x50')](_0xeed0('0x55'))['from']('user_has_sms_interactions','ui')[_0xeed0('0x56')]('users','u','u.id\x20=\x20ui.UserId');var _0x32c7e0=squel[_0xeed0('0x4f')]()[_0xeed0('0x57')](_0xeed0('0x58'),'i')[_0xeed0('0x56')]('cm_contacts','c',_0xeed0('0x59'))[_0xeed0('0x56')](_0xeed0('0x5a'),'o',_0xeed0('0x5b'))[_0xeed0('0x56')]('sms_accounts','a','a.id\x20=\x20i.SmsAccountId')[_0xeed0('0x56')](_0xeed0('0x5c'),'me','me.SmsInteractionId\x20=\x20i.id')['left_join'](_0xeed0('0x5d'),'it',_0xeed0('0x5e'))[_0xeed0('0x56')](_0xeed0('0x52'),'t','t.id\x20=\x20it.TagId');var _0x1874bc=squel[_0xeed0('0x5f')]();var _0x58b140=[];var _0x1d89e6=squel[_0xeed0('0x5f')]();var _0x1c56ff;if(_0x4a652f[_0xeed0('0x42')][_0xeed0('0x60')]){_0x1c56ff=as[_0xeed0('0x61')](_0x4a652f[_0xeed0('0x42')][_0xeed0('0x60')]);var _0x83f9a3=_0x1c56ff['sqlOperator'];for(var _0x7b2428=0x0;_0x7b2428<_0x1c56ff[_0xeed0('0x62')]['length'];_0x7b2428++){var _0x59a1dd=_0x1c56ff[_0xeed0('0x62')][_0x7b2428];var _0x16d4ae='i';var _0x5680aa=_['find'](_0x1e9dc7,[_0xeed0('0x2f'),_0x59a1dd['field']]);if(!_0x5680aa){switch(_0x59a1dd[_0xeed0('0x50')]){case _0xeed0('0x63'):if(_0x59a1dd[_0xeed0('0x64')]==0x1){_0x32c7e0[_0xeed0('0x65')]('`'+_0x59a1dd[_0xeed0('0x50')]+'`\x20=\x200');}else{_0x32c7e0[_0xeed0('0x65')]('`'+_0x59a1dd[_0xeed0('0x50')]+_0xeed0('0x66'));}break;case _0xeed0('0x67'):if(_0x59a1dd['operator']===_0xeed0('0x68')){if(_0x59a1dd[_0xeed0('0x64')][_0xeed0('0x69')]('\x20')[_0xeed0('0x48')]>0x1){_0x1874bc[_0x83f9a3](_0xeed0('0x6a'),qs[_0xeed0('0x6b')](_0x59a1dd['value']),null);}else{var _0x1ac48b='%'+_0x59a1dd['value']+'%';_0x1874bc[_0x83f9a3](_0xeed0('0x6c'),_0x1ac48b,_0x1ac48b,_0x1ac48b);}}else{_0x5680aa=_[_0xeed0('0x6d')](_0x1e9dc7,['name',_0xeed0('0x6e')]);_0x59a1dd[_0xeed0('0x50')]=_0xeed0('0x6e');_0x4350cb=as[_0xeed0('0x6f')](_0x16d4ae,_0x5680aa[_0xeed0('0x3f')],_0x59a1dd);_0x1874bc[_0x83f9a3](_0x4350cb[_0xeed0('0x70')],_0x4350cb[_0xeed0('0x64')]['start'],_0x4350cb['value']['end']);}break;case _0xeed0('0x71'):var _0x3b9cba=_0x59a1dd['value'][_0xeed0('0x69')](',')[_0xeed0('0x31')](function(_0x167e7e){return Number(_0x167e7e);});_0x3b9cba[_0xeed0('0x72')](function(_0x556e0d){_0x1d89e6['or'](_0xeed0('0x73'),'%,'+_0x556e0d+',%');});_0x58b140=_[_0xeed0('0x74')](_0x58b140,_0x3b9cba);break;case _0xeed0('0x75'):if(_0x59a1dd[_0xeed0('0x76')]===_0xeed0('0x68')){_0x1874bc[_0x83f9a3](_0xeed0('0x77'),'%'+_0x59a1dd[_0xeed0('0x64')]+'%',null);}else{_0x5680aa=_[_0xeed0('0x6d')](_0x1e9dc7,[_0xeed0('0x2f'),'UserId']);_0x59a1dd[_0xeed0('0x50')]=_0xeed0('0x3b');_0x4350cb=as[_0xeed0('0x6f')](_0x16d4ae,_0x5680aa['type'],_0x59a1dd);_0x1874bc[_0x83f9a3](_0x4350cb['text'],_0x4350cb[_0xeed0('0x64')][_0xeed0('0x78')],_0x4350cb[_0xeed0('0x64')]['end']);}break;case _0xeed0('0x79'):_0x4350cb=as[_0xeed0('0x6f')]('me',null,_0x59a1dd);_0x1874bc[_0x83f9a3](_0x4350cb[_0xeed0('0x70')],_0x4350cb[_0xeed0('0x64')][_0xeed0('0x78')],_0x4350cb[_0xeed0('0x64')][_0xeed0('0x20')]);break;}}else{var _0x4350cb=as[_0xeed0('0x6f')](_0x16d4ae,_0x5680aa['type'],_0x59a1dd);_0x1874bc[_0x83f9a3](_0x4350cb['text'],_0x4350cb[_0xeed0('0x64')][_0xeed0('0x78')],_0x4350cb[_0xeed0('0x64')]['end']);}}}else{var _0x4cafaa=_(_0x4a652f['query'])['keys']()[_0xeed0('0x31')](function(_0x246eae){return _[_0xeed0('0x7a')](_0x1e9dc7,[_0xeed0('0x2f'),_0x246eae])?_0x246eae:undefined;})['compact']()[_0xeed0('0x64')]();if(!_[_0xeed0('0x7b')](_0x4cafaa)){_0x4cafaa['forEach'](function(_0x271346){if(_0x271346===_0xeed0('0x7c')){_0x32c7e0[_0xeed0('0x4d')](_0xeed0('0x7d'),[]['concat'](_0x4a652f[_0xeed0('0x42')][_0x271346]));}else if(_0x271346===_0xeed0('0x7e')){var _0x1bde34=JSON[_0xeed0('0x7f')](_0x4a652f[_0xeed0('0x42')][_0x271346])[_0xeed0('0x80')];var _0x5c2c24=JSON[_0xeed0('0x7f')](_0x4a652f[_0xeed0('0x42')][_0x271346])[_0xeed0('0x81')];_0x32c7e0[_0xeed0('0x4d')](_0xeed0('0x82'),_0x1bde34,_0x5c2c24);}else{if(_0x4a652f[_0xeed0('0x42')][_0x271346]===_0xeed0('0x83')){_0x32c7e0['where']('i.'+_0x271346+_0xeed0('0x84'));}else{_0x32c7e0['where']('i.'+_0x271346+'\x20=\x20?',_0x4a652f[_0xeed0('0x42')][_0x271346]);}}});}if(_0x4a652f[_0xeed0('0x42')][_0xeed0('0x85')]){if(_0x4a652f[_0xeed0('0x42')][_0xeed0('0x85')]==0x1){_0x32c7e0[_0xeed0('0x65')](_0xeed0('0x86'));}else{_0x32c7e0['having'](_0xeed0('0x87'));}}if(_0x4a652f['query'][_0xeed0('0x88')]){_0x58b140=_[_0xeed0('0x89')](_0x4a652f[_0xeed0('0x42')][_0xeed0('0x88')])?_0x4a652f[_0xeed0('0x42')][_0xeed0('0x88')]:new Array(_0x4a652f[_0xeed0('0x42')][_0xeed0('0x88')]);_0x58b140[_0xeed0('0x72')](function(_0x5ec363){_0x1d89e6['or'](_0xeed0('0x73'),'%,'+_0x5ec363+',%');});}if(_0x4a652f[_0xeed0('0x42')][_0xeed0('0x8a')]){var _0x41007e=_0x4a652f[_0xeed0('0x42')][_0xeed0('0x8a')]['replace']('\x5c','\x5c\x5c')[_0xeed0('0x8b')](/'/g,'\x27\x27');if(qs[_0xeed0('0x8c')](_0x41007e)){_0x1874bc['or'](_0xeed0('0x8d'),_0x41007e+'%')['or'](_0xeed0('0x8e'),_0x41007e+'%');}else{_0x1874bc['or'](_0xeed0('0x8f'),qs[_0xeed0('0x6b')](_0x41007e))['or'](_0xeed0('0x90'),_0x41007e+'%');}}}_0x32c7e0[_0xeed0('0x4d')](_0x1874bc);_0x32c7e0[_0xeed0('0x91')]('i.id');var _0xefa0dd={'type':db[_0xeed0('0x92')][_0xeed0('0x93')][_0xeed0('0x94')],'raw':!![]};var _0x450eae=_0x32c7e0['clone']();_0x450eae[_0xeed0('0x50')](_0xeed0('0x95'));_0x450eae[_0xeed0('0x50')](_0xeed0('0x96'),'unreadMessages');if(_0x15115e[_0xeed0('0x4b')]){_0x15115e[_0xeed0('0x4b')][_0xeed0('0x72')](function(_0x56e4a6){var _0x2a7e15=_0x56e4a6[0x0]===_0xeed0('0x97')?_0x56e4a6[0x0]:'i.'+_0x56e4a6[0x0];_0x32c7e0[_0xeed0('0x4b')](_0x2a7e15,_0x56e4a6[0x1]===_0xeed0('0x98')?![]:!![]);});}if(!_[_0xeed0('0x7b')](_0x58b140)){_0x32c7e0[_0xeed0('0x65')](_0x1d89e6);_0x450eae[_0xeed0('0x4d')](_0xeed0('0x99'),_0x58b140);}BPromise[_0xeed0('0x9a')]()[_0xeed0('0x2c')](function(){if(!_0x1c56ff){if(_0x4a652f[_0xeed0('0x42')][_0xeed0('0x7c')])return;_0x450eae[_0xeed0('0x4d')](_0xeed0('0x9b'));_0x32c7e0['where']('i.SmsAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x4a652f[_0xeed0('0x9c')]['role']!==_0xeed0('0x9d'))return;return _0x4a652f[_0xeed0('0x9c')]['getSmsAccounts']({'attributes':['id'],'raw':!![]})[_0xeed0('0x2c')](function(_0x5452ce){if(_[_0xeed0('0x7b')](_0x5452ce)){_0x450eae['where'](_0xeed0('0x9e'));_0x32c7e0['where'](_0xeed0('0x9e'));}else{_0x450eae[_0xeed0('0x4d')](_0xeed0('0x7d'),_[_0xeed0('0x31')](_0x5452ce,'id'));_0x32c7e0[_0xeed0('0x4d')]('i.SmsAccountId\x20IN\x20?',_[_0xeed0('0x31')](_0x5452ce,'id'));}});})['then'](function(){if(_0x4a652f['user'][_0xeed0('0x9f')]===_0xeed0('0x9d')&&!_0x1c56ff&&!_0x4a652f['query']['SmsAccountId'])return[];return db[_0xeed0('0xa0')][_0xeed0('0x42')](_0x450eae[_0xeed0('0xa1')](),_0xefa0dd);})[_0xeed0('0x2c')](function(_0x438140){_0x1f19de[_0xeed0('0x24')]=_0x438140[_0xeed0('0x48')];if(_0x1f19de['count']===0x0)return[];return db[_0xeed0('0xa0')]['query'](_0x17760f[_0xeed0('0xa1')](),_0xefa0dd)['then'](function(_0x2f0ad5){_0x355c9d=_[_0xeed0('0xa2')](_0x2f0ad5,'id');_0xefa0dd=_[_0xeed0('0xa3')](_0xefa0dd,{'model':db[_0xeed0('0x3d')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4a652f['query'][_0xeed0('0x46')]){_0x15115e[_0xeed0('0x47')][_0xeed0('0x72')](function(_0x49f21c){_0x32c7e0[_0xeed0('0x50')]('i.'+_0x49f21c);});}else{_0x32c7e0[_0xeed0('0x50')](_0xeed0('0x96'),_0xeed0('0x63'));_0x32c7e0['field'](_0xeed0('0xa4'),_0xeed0('0xa5'));_0x32c7e0[_0xeed0('0x50')](_0xeed0('0xa6'),_0xeed0('0xa7'));_0x32c7e0[_0xeed0('0x50')](_0xeed0('0xa8'),_0xeed0('0x97'));_0x32c7e0['field']('i.*');_0x32c7e0[_0xeed0('0x50')](_0xeed0('0xa9'),_0xeed0('0xaa'));_0x32c7e0['field'](_0xeed0('0xab'),_0xeed0('0xac'));_0x32c7e0[_0xeed0('0x50')](_0xeed0('0xad'),'Contact.email');_0x32c7e0[_0xeed0('0x50')]('c.phone',_0xeed0('0xae'));_0x32c7e0['field'](_0xeed0('0xaf'),_0xeed0('0xb0'));_0x32c7e0[_0xeed0('0x50')](_0xeed0('0xb1'),_0xeed0('0xb2'));_0x32c7e0['field']('o.fullname',_0xeed0('0xb3'));_0x32c7e0[_0xeed0('0x50')]('o.internal','Owner.internal');_0x32c7e0[_0xeed0('0x50')](_0xeed0('0xb4'),_0xeed0('0x33'));}if(_0x15115e[_0xeed0('0x25')])_0x32c7e0[_0xeed0('0x25')](_0x15115e[_0xeed0('0x25')]);if(_0x15115e['offset'])_0x32c7e0[_0xeed0('0x23')](_0x15115e[_0xeed0('0x23')]);return db['sequelize']['query'](_0x32c7e0[_0xeed0('0xa1')](),_0xefa0dd);})['then'](function(_0x39c56a){if(_0x39c56a[_0xeed0('0x48')]>0x0)_0x3a6221[_0xeed0('0x4d')](_0xeed0('0xb5'),_['map'](_0x39c56a,'id'));return db[_0xeed0('0xa0')][_0xeed0('0x42')](_0x3a6221[_0xeed0('0xa1')](),_0xefa0dd)['then'](function(_0x124630){var _0x3a0070=_['groupBy'](_0x124630,_0xeed0('0xb6'));var _0x1af5d5=[];_0x39c56a[_0xeed0('0x72')](function(_0x984db5){_0x1af5d5[_0xeed0('0x35')](updateSmsInteraction(_0x984db5,_0x355c9d,_0x3a0070));});return BPromise[_0xeed0('0xb7')](_0x1af5d5);});});})[_0xeed0('0x2c')](function(_0x24b404){_0x1f19de[_0xeed0('0xb8')]=_0x24b404;return _0x1f19de;})['then'](respondWithFilteredResult(_0x3983c3,_0x15115e))[_0xeed0('0xb9')](handleError(_0x3983c3,null));};exports[_0xeed0('0xba')]=function(_0x3274d4,_0x173c2d){var _0x5944d5={'raw':![],'where':{'id':_0x3274d4[_0xeed0('0xbb')]['id']}},_0x5dcb37={};_0x5dcb37[_0xeed0('0x41')]=_[_0xeed0('0x43')](db['SmsInteraction'][_0xeed0('0xbc')]);_0x5dcb37[_0xeed0('0x42')]=_[_0xeed0('0x43')](_0x3274d4[_0xeed0('0x42')]);_0x5dcb37[_0xeed0('0x44')]=_[_0xeed0('0x45')](_0x5dcb37[_0xeed0('0x41')],_0x5dcb37[_0xeed0('0x42')]);_0x5944d5[_0xeed0('0x47')]=_['intersection'](_0x5dcb37[_0xeed0('0x41')],qs[_0xeed0('0x46')](_0x3274d4[_0xeed0('0x42')]['fields']));_0x5944d5[_0xeed0('0x47')]=_0x5944d5[_0xeed0('0x47')][_0xeed0('0x48')]?_0x5944d5['attributes']:_0x5dcb37['model'];if(_0x3274d4[_0xeed0('0x42')]['includeAll']){_0x5944d5[_0xeed0('0xbd')]=[{'all':!![]}];}_0x5944d5=_[_0xeed0('0xa3')]({},_0x5944d5,_0x3274d4['options']);return db['SmsInteraction']['find'](_0x5944d5)['then'](handleEntityNotFound(_0x173c2d,null))[_0xeed0('0x2c')](respondWithResult(_0x173c2d,null))[_0xeed0('0xb9')](handleError(_0x173c2d,null));};exports[_0xeed0('0xbe')]=function(_0x5c1015,_0x10e00d){return db[_0xeed0('0x3d')][_0xeed0('0xbe')](_0x5c1015[_0xeed0('0x79')],{})['then'](respondWithResult(_0x10e00d,0xc9))[_0xeed0('0xb9')](handleError(_0x10e00d,null));};exports[_0xeed0('0x2b')]=function(_0x43a8e0,_0x3cc02f){if(_0x43a8e0[_0xeed0('0x79')]['id']){delete _0x43a8e0[_0xeed0('0x79')]['id'];}return db[_0xeed0('0x3d')]['find']({'where':{'id':_0x43a8e0[_0xeed0('0xbb')]['id']}})['then'](handleEntityNotFound(_0x3cc02f,null))[_0xeed0('0x2c')](saveUpdates(_0x43a8e0[_0xeed0('0x79')],null))[_0xeed0('0x2c')](respondWithResult(_0x3cc02f,null))[_0xeed0('0xb9')](handleError(_0x3cc02f,null));};exports[_0xeed0('0xbf')]=function(_0x5879b9,_0x2dc963){return db[_0xeed0('0x3d')][_0xeed0('0x6d')]({'where':{'id':_0x5879b9[_0xeed0('0xbb')]['id']}})[_0xeed0('0x2c')](handleEntityNotFound(_0x2dc963,null))[_0xeed0('0x2c')](removeEntity(_0x2dc963,null))[_0xeed0('0xb9')](handleError(_0x2dc963,null));};exports[_0xeed0('0xc0')]=function(_0x14ac0e,_0xa46fae){return db[_0xeed0('0x3d')][_0xeed0('0xc0')]()['then'](respondWithResult(_0xa46fae,null))[_0xeed0('0xb9')](handleError(_0xa46fae,null));};exports[_0xeed0('0xc1')]=function(_0x3d9ce3,_0x25639c,_0x108165){return db[_0xeed0('0xc2')][_0xeed0('0x6d')]({'where':{'id':_0x3d9ce3[_0xeed0('0xbb')]['id']}})['then'](handleEntityNotFound(_0x25639c,null))[_0xeed0('0x2c')](function(_0x376c76){if(_0x376c76){return _0x376c76['addMessage'](_0x3d9ce3[_0xeed0('0x79')][_0xeed0('0xc3')],_[_0xeed0('0xc4')](_0x3d9ce3['body'],[_0xeed0('0xc3'),'id'])||{});}})[_0xeed0('0x2c')](respondWithResult(_0x25639c,null))[_0xeed0('0xb9')](handleError(_0x25639c,null));};exports[_0xeed0('0xc5')]=function(_0x1f9016,_0x380c0c,_0x5ac555){var _0x2c2434={'raw':![],'where':{}};var _0x507c50={};var _0x289914={'count':0x0,'rows':[]};return db[_0xeed0('0x3d')]['findOne']({'where':{'id':_0x1f9016[_0xeed0('0xbb')]['id']}})[_0xeed0('0x2c')](handleEntityNotFound(_0x380c0c,null))['then'](function(_0x569d0d){if(_0x569d0d){_0x507c50[_0xeed0('0x41')]=_[_0xeed0('0x43')](db[_0xeed0('0xc2')][_0xeed0('0xbc')]);_0x507c50[_0xeed0('0x42')]=_[_0xeed0('0x43')](_0x1f9016[_0xeed0('0x42')]);_0x507c50[_0xeed0('0x44')]=_[_0xeed0('0x45')](_0x507c50[_0xeed0('0x41')],_0x507c50[_0xeed0('0x42')]);_0x2c2434['attributes']=_[_0xeed0('0x45')](_0x507c50[_0xeed0('0x41')],qs[_0xeed0('0x46')](_0x1f9016[_0xeed0('0x42')][_0xeed0('0x46')]));_0x2c2434[_0xeed0('0x47')]=_0x2c2434[_0xeed0('0x47')][_0xeed0('0x48')]?_0x2c2434[_0xeed0('0x47')]:_0x507c50['model'];if(!_0x1f9016[_0xeed0('0x42')]['hasOwnProperty'](_0xeed0('0x4a'))){_0x2c2434['limit']=qs['limit'](_0x1f9016[_0xeed0('0x42')][_0xeed0('0x25')]);_0x2c2434[_0xeed0('0x23')]=qs['offset'](_0x1f9016[_0xeed0('0x42')][_0xeed0('0x23')]);}_0x2c2434[_0xeed0('0x4b')]=qs[_0xeed0('0x4c')](_0x1f9016[_0xeed0('0x42')][_0xeed0('0x4c')]);_0x2c2434[_0xeed0('0x4d')]=qs[_0xeed0('0x44')](_[_0xeed0('0x4e')](_0x1f9016['query'],_0x507c50['filters']));_0x2c2434[_0xeed0('0x4d')][_0xeed0('0xb6')]=_0x569d0d['id'];if(_0x1f9016[_0xeed0('0x42')][_0xeed0('0x8a')]){_0x2c2434[_0xeed0('0x4d')]=_[_0xeed0('0xa3')](_0x2c2434['where'],{'$or':_['map'](_0x2c2434[_0xeed0('0x47')],function(_0x51fcfa){var _0x42ea29={};_0x42ea29[_0x51fcfa]={'$like':'%'+_0x1f9016[_0xeed0('0x42')][_0xeed0('0x8a')]+'%'};return _0x42ea29;})});}if(_0x1f9016['query'][_0xeed0('0x80')]){var _0x49c275=_0x1f9016[_0xeed0('0x42')][_0xeed0('0x80')]['split'](',');var _0x30097b={};_0x30097b[_0x49c275[0x0]]={'$gte':moment(_0x49c275[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x2c2434[_0xeed0('0x4d')]=_['merge'](_0x2c2434[_0xeed0('0x4d')],_0x30097b);}_0x2c2434=_[_0xeed0('0xa3')]({},_0x2c2434,_0x1f9016['options']);return db['SmsMessage']['count']({'where':_0x2c2434[_0xeed0('0x4d')]})[_0xeed0('0x2c')](function(_0x2468e8){_0x289914[_0xeed0('0x24')]=_0x2468e8;if(_0x1f9016['query'][_0xeed0('0xc6')]){_0x2c2434[_0xeed0('0xbd')]=[{'all':!![]}];}return db['SmsMessage']['findAll'](_0x2c2434);})[_0xeed0('0x2c')](function(_0x2ebf42){_0x289914[_0xeed0('0xb8')]=_0x2ebf42;return _0x289914;});}})[_0xeed0('0x2c')](respondWithFilteredResult(_0x380c0c,_0x2c2434))[_0xeed0('0xb9')](handleError(_0x380c0c,null));};exports[_0xeed0('0xc7')]=function(_0x11e4ab,_0xba074e,_0x176eff){return db[_0xeed0('0x3d')][_0xeed0('0x6d')]({'where':{'id':_0x11e4ab['params']['id']}})['then'](handleEntityNotFound(_0xba074e,null))[_0xeed0('0x2c')](function(_0xb23cbc){if(_0xb23cbc){return _0xb23cbc[_0xeed0('0xc8')](_0x11e4ab[_0xeed0('0x79')][_0xeed0('0xc3')],_[_0xeed0('0xc4')](_0x11e4ab[_0xeed0('0x79')],['ids','id'])||{})[_0xeed0('0xc9')](function(){return db['Tag'][_0xeed0('0xca')]({'attributes':['id','name',_0xeed0('0x51')],'where':{'id':_0x11e4ab[_0xeed0('0x79')][_0xeed0('0xc3')]}});})[_0xeed0('0x2c')](function(_0x5e07b1){socket[_0xeed0('0xcb')]('smsInteractionTags:save',{'id':Number(_0x11e4ab[_0xeed0('0xbb')]['id']),'tags':_0x5e07b1||[]});return{'id':Number(_0x11e4ab['params']['id']),'tags':_0x5e07b1||[]};});}})[_0xeed0('0x2c')](respondWithResult(_0xba074e,null))[_0xeed0('0xb9')](handleError(_0xba074e,null));};exports[_0xeed0('0xcc')]=function(_0x174079,_0x56c575,_0x49a2b9){return db[_0xeed0('0x3d')]['find']({'where':{'id':_0x174079['params']['id']}})[_0xeed0('0x2c')](handleEntityNotFound(_0x56c575,null))[_0xeed0('0x2c')](function(_0x148847){if(_0x148847){return _0x148847[_0xeed0('0xcc')](_0x174079[_0xeed0('0x42')][_0xeed0('0xc3')]);}})['then'](respondWithStatusCode(_0x56c575,null))[_0xeed0('0xb9')](handleError(_0x56c575,null));};exports[_0xeed0('0xcd')]=function(_0x3b76ba,_0x33e266){var _0x31e719=moment()[_0xeed0('0xce')]()[_0xeed0('0xa1')]();var _0x1bdcfd=path[_0xeed0('0xcf')](config[_0xeed0('0xd0')],_0xeed0('0xd1'),_0xeed0('0xd2'),_0xeed0('0xd3'));var _0x6b7f65=path[_0xeed0('0xcf')](config[_0xeed0('0xd0')],_0xeed0('0xd1'),_0xeed0('0xd2'),'attachments');var _0x44ce02=path[_0xeed0('0xcf')](_0x1bdcfd,_0x31e719);var _0x32432b=util['format'](_0xeed0('0xd4'),_0x3b76ba[_0xeed0('0xbb')]['id'],_0x31e719);var _0x10d4e3=path['join'](_0x1bdcfd,_0x32432b);var _0x54e79c=[];_0x54e79c[_0xeed0('0x35')]({'model':db[_0xeed0('0x75')],'as':_0xeed0('0x75'),'attributes':['id',_0xeed0('0x32')],'raw':!![]});_0x54e79c[_0xeed0('0x35')]({'model':db['CmContact'],'as':_0xeed0('0x67'),'attributes':['id',_0xeed0('0xd5'),_0xeed0('0xd6')],'raw':!![]});var _0x4917cb=[{'model':db[_0xeed0('0xc2')],'as':_0xeed0('0xd7'),'attributes':['id','body',_0xeed0('0x7e'),_0xeed0('0xd8'),_0xeed0('0xd9'),_0xeed0('0x85')],'include':_0x54e79c}];_0x4917cb[_0xeed0('0x35')]({'model':db[_0xeed0('0xda')],'as':'Account','attributes':['id',_0xeed0('0x2f')]});_0x4917cb['push']({'model':db['User'],'as':_0xeed0('0xdb'),'attributes':['id','fullname']});return db[_0xeed0('0x3d')]['find']({'where':{'id':_0x3b76ba['params']['id']},'include':_0x4917cb})[_0xeed0('0x2c')](handleEntityNotFound(_0x33e266,null))[_0xeed0('0x2c')](function(_0x2877e3){if(_0x2877e3){var _0x1d2136=_0x2877e3[_0xeed0('0xdc')]({'plain':!![]});fs[_0xeed0('0xdd')](_0x44ce02);var _0x16e272={'channel':_0xeed0('0xde'),'account':_0x1d2136[_0xeed0('0xdf')][_0xeed0('0x2f')],'agent':_0x1d2136['Owner']?_0x1d2136[_0xeed0('0xdb')][_0xeed0('0x32')]:_0xeed0('0xe0'),'createdAt':moment(_0x1d2136[_0xeed0('0x7e')])[_0xeed0('0xe1')](_0xeed0('0xe2'))[_0xeed0('0xa1')](),'closedAt':_0x1d2136['closed']?moment(_0x1d2136[_0xeed0('0xe3')])[_0xeed0('0xe1')](_0xeed0('0xe2'))[_0xeed0('0xa1')]():'','disposition':_0x1d2136['disposition'],'messages':_(_0x1d2136[_0xeed0('0xd7')])[_0xeed0('0x8a')]({'secret':![]})['map'](function(_0x1172ec){return{'date':moment(_0x1172ec[_0xeed0('0x7e')])[_0xeed0('0xe1')](_0xeed0('0xe2'))[_0xeed0('0xa1')](),'sender':_0x1172ec[_0xeed0('0xd8')]===_0xeed0('0xe4')?_0x1172ec['User']?_0x1172ec[_0xeed0('0x75')][_0xeed0('0x32')]:'System':_0x1172ec[_0xeed0('0x67')][_0xeed0('0xd5')]+(_0x1172ec[_0xeed0('0x67')][_0xeed0('0xd6')]?'\x20'+_0x1172ec['Contact'][_0xeed0('0xd6')]:''),'body':_0x1172ec[_0xeed0('0x79')],'direction':_0x1172ec[_0xeed0('0xd8')]===_0xeed0('0xe4')?'A':'C','secret':_0x1172ec[_0xeed0('0xd9')],'read':_0x1172ec[_0xeed0('0x85')]};})['value']()};return ejs[_0xeed0('0xe5')](path[_0xeed0('0xcf')](config['root'],_0xeed0('0xd1'),'views','downloadInteraction.ejs'),{'interaction':_0x16e272})[_0xeed0('0x2c')](function(_0x2f9e2a){var _0x2e07e7=path[_0xeed0('0xcf')](_0x44ce02,_0xeed0('0xe6')+_0x1d2136['id']+'-'+_0x31e719+_0xeed0('0xe7'));var _0x14db2d={'path':_0x2e07e7,'channel':_0xeed0('0xde'),'interactionId':_0x1d2136['id']};return pdf[_0xeed0('0xe8')](_0x2f9e2a,_0x14db2d);})[_0xeed0('0x2c')](function(){return new BPromise(function(_0x4f0700,_0x256650){zipdir(_0x44ce02,{'saveTo':_0x10d4e3},function(_0x15d729,_0x20d104){if(_0x15d729)return _0x256650(_0x15d729);return _0x4f0700(_0x20d104);});})[_0xeed0('0x2c')](function(){return new BPromise(function(_0x20f5b0,_0x1c13fc){rimraf(_0x44ce02,function(_0x4d869f){if(_0x4d869f)_0x1c13fc(_0x4d869f);return _0x20f5b0();});});})[_0xeed0('0x2c')](function(){return _0x33e266[_0xeed0('0xcd')](_0x10d4e3,_0x32432b,function(_0xda52){if(_0xda52){console['log']('err',_0xda52);}else{fs['unlinkSync'](_0x10d4e3);}});});});}else{return _0x33e266[_0xeed0('0x2d')](0xc8);}})[_0xeed0('0xb9')](handleError(_0x33e266,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index b846b9f..47e6aa8 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 _0xadb5=['update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','emit','catch','hasOwnProperty','exports','../../mysqldb','SmsMessage','setMaxListeners'];(function(_0x1be180,_0xd744bd){var _0x253a07=function(_0x3477ac){while(--_0x3477ac){_0x1be180['push'](_0x1be180['shift']());}};_0x253a07(++_0xd744bd);}(_0xadb5,0xad));var _0x5adb=function(_0x412b5b,_0x2019cd){_0x412b5b=_0x412b5b-0x0;var _0x56fc24=_0xadb5[_0x412b5b];return _0x56fc24;};'use strict';var EventEmitter=require('events');var SmsInteraction=require(_0x5adb('0x0'))['db']['SmsInteraction'];var SmsMessage=require(_0x5adb('0x0'))['db'][_0x5adb('0x1')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x5adb('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x5adb('0x3'),'afterDestroy':_0x5adb('0x4')};function emitEvent(_0x2e3ef4){return function(_0x4cb1d1,_0x35a5d3,_0x168d89){_0x4cb1d1[_0x5adb('0x5')]({'attributes':['id'],'raw':!![]})[_0x5adb('0x6')](function(_0xdf3776){_0x4cb1d1[_0x5adb('0x7')](_0x5adb('0x8'),_0xdf3776[_0x5adb('0x9')](function(_0x41261c){return{'id':_0x41261c['id']};}));return SmsMessage[_0x5adb('0xa')]({'where':{'SmsInteractionId':_0x4cb1d1['id'],'direction':'in','read':![]},'raw':!![]});})[_0x5adb('0x6')](function(_0x336bad){_0x4cb1d1[_0x5adb('0x7')](_0x5adb('0xb'),_0x336bad['length']);SmsInteractionEvents['emit'](_0x2e3ef4+':'+_0x4cb1d1['id'],_0x4cb1d1);SmsInteractionEvents[_0x5adb('0xc')](_0x2e3ef4,_0x4cb1d1);_0x168d89(null);})[_0x5adb('0xd')](_0x168d89(null));};}for(var e in events){if(events[_0x5adb('0xe')](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module[_0x5adb('0xf')]=SmsInteractionEvents; \ No newline at end of file +var _0x583c=['../../mysqldb','SmsInteraction','setMaxListeners','save','getUsers','then','Users','map','findAll','setDataValue','unreadMessages','emit','hasOwnProperty','hook','events'];(function(_0x280604,_0x4e3836){var _0x524697=function(_0x552adc){while(--_0x552adc){_0x280604['push'](_0x280604['shift']());}};_0x524697(++_0x4e3836);}(_0x583c,0x12b));var _0xc583=function(_0x72895a,_0x433607){_0x72895a=_0x72895a-0x0;var _0x5226d5=_0x583c[_0x72895a];return _0x5226d5;};'use strict';var EventEmitter=require(_0xc583('0x0'));var SmsInteraction=require(_0xc583('0x1'))['db'][_0xc583('0x2')];var SmsMessage=require(_0xc583('0x1'))['db']['SmsMessage'];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xc583('0x3')](0x0);var events={'afterCreate':_0xc583('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x13b8a7){return function(_0xf03852,_0x5b7292,_0xd3a750){_0xf03852[_0xc583('0x5')]({'attributes':['id'],'raw':!![]})[_0xc583('0x6')](function(_0x1dd37c){_0xf03852['setDataValue'](_0xc583('0x7'),_0x1dd37c[_0xc583('0x8')](function(_0x5b456e){return{'id':_0x5b456e['id']};}));return SmsMessage[_0xc583('0x9')]({'where':{'SmsInteractionId':_0xf03852['id'],'direction':'in','read':![]},'raw':!![]});})[_0xc583('0x6')](function(_0x25f8d3){_0xf03852[_0xc583('0xa')](_0xc583('0xb'),_0x25f8d3['length']);SmsInteractionEvents[_0xc583('0xc')](_0x13b8a7+':'+_0xf03852['id'],_0xf03852);SmsInteractionEvents[_0xc583('0xc')](_0x13b8a7,_0xf03852);_0xd3a750(null);})['catch'](_0xd3a750(null));};}for(var e in events){if(events[_0xc583('0xd')](e)){var event=events[e];SmsInteraction[_0xc583('0xe')](e,emitEvent(event));}}module['exports']=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 9e422db..0bc1f6b 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 _0x305c=['exports','define','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','api','bluebird','request-promise','path','../../config/environment','./smsInteraction.attributes'];(function(_0x900ae2,_0x3b6c0c){var _0x2eef08=function(_0x17ceb7){while(--_0x17ceb7){_0x900ae2['push'](_0x900ae2['shift']());}};_0x2eef08(++_0x3b6c0c);}(_0x305c,0x95));var _0xc305=function(_0x41c44d,_0x31d1eb){_0x41c44d=_0x41c44d-0x0;var _0x5e00f5=_0x305c[_0x41c44d];return _0x5e00f5;};'use strict';var _=require(_0xc305('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc305('0x1'));var moment=require('moment');var BPromise=require(_0xc305('0x2'));var rp=require(_0xc305('0x3'));var fs=require('fs');var path=require(_0xc305('0x4'));var rimraf=require('rimraf');var config=require(_0xc305('0x5'));var attributes=require(_0xc305('0x6'));module[_0xc305('0x7')]=function(_0x348b2c,_0x336b08){return _0x348b2c[_0xc305('0x8')]('SmsInteraction',attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xeb8cd1,_0x4b1038,_0x36b79a){if(_0xeb8cd1['changed'](_0xc305('0x9'))){_0xeb8cd1[_0xc305('0xa')]=moment()['format'](_0xc305('0xb'));}_0x36b79a(null,_0xeb8cd1);}}});}; \ No newline at end of file +var _0x0895=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','sms_interactions','changed','closedAt','format'];(function(_0x2d948d,_0x2b55cd){var _0x766a39=function(_0x2498d0){while(--_0x2498d0){_0x2d948d['push'](_0x2d948d['shift']());}};_0x766a39(++_0x2b55cd);}(_0x0895,0x1c7));var _0x5089=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0895[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x5089('0x0'));var util=require(_0x5089('0x1'));var logger=require(_0x5089('0x2'))(_0x5089('0x3'));var moment=require(_0x5089('0x4'));var BPromise=require(_0x5089('0x5'));var rp=require(_0x5089('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5089('0x7'));var config=require(_0x5089('0x8'));var attributes=require('./smsInteraction.attributes');module['exports']=function(_0x392b9f,_0x9f8b63){return _0x392b9f['define']('SmsInteraction',attributes,{'tableName':_0x5089('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x32c346,_0x5b14c4,_0x422cd0){if(_0x32c346[_0x5089('0xa')]('closed')){_0x32c346[_0x5089('0xb')]=moment()[_0x5089('0xc')]('YYYY-MM-DD\x20HH:mm:ss');}_0x422cd0(null,_0x32c346);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 3b85dd2..a6bd835 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 _0x357d=['SmsInteraction','options','raw','attributes','limit','UpdateSmsInteraction','debug','find','then','body','ids','omit','spread','AddTags','lodash','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','localhost','socket.io-emitter','redis','./smsInteraction.socket','register','request','SmsInteraction,\x20%s,\x20%s','request\x20sent','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch'];(function(_0x5e79db,_0x22b81f){var _0x2bc823=function(_0x4ffafd){while(--_0x4ffafd){_0x5e79db['push'](_0x5e79db['shift']());}};_0x2bc823(++_0x22b81f);}(_0x357d,0xae));var _0xd357=function(_0x5e428a,_0x1cf613){_0x5e428a=_0x5e428a-0x0;var _0x13cbc2=_0x357d[_0x5e428a];return _0x13cbc2;};'use strict';var _=require(_0xd357('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xd357('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd357('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xd357('0x3'));var logger=require(_0xd357('0x4'))(_0xd357('0x5'));var config=require(_0xd357('0x6'));var jayson=require(_0xd357('0x7'));var client=jayson[_0xd357('0x8')][_0xd357('0x9')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0xd357('0xa'),'port':0x18eb});var socket=require(_0xd357('0xb'))(new Redis(config[_0xd357('0xc')]));require(_0xd357('0xd'))[_0xd357('0xe')](socket);function respondWithRpcPromise(_0x81f92e,_0x468aef,_0x1fbefc){return new BPromise(function(_0xc35e1f,_0x11a818){return client[_0xd357('0xf')](_0x81f92e,_0x1fbefc)['then'](function(_0x5f5aa9){logger['info'](_0xd357('0x10'),_0x468aef,_0xd357('0x11'));logger['debug'](_0xd357('0x12'),_0x468aef,_0xd357('0x11'),JSON[_0xd357('0x13')](_0x5f5aa9));if(_0x5f5aa9['error']){if(_0x5f5aa9[_0xd357('0x14')][_0xd357('0x15')]===0x1f4){logger['error'](_0xd357('0x10'),_0x468aef,_0x5f5aa9[_0xd357('0x14')][_0xd357('0x16')]);return _0x11a818(_0x5f5aa9[_0xd357('0x14')]['message']);}logger[_0xd357('0x14')](_0xd357('0x10'),_0x468aef,_0x5f5aa9[_0xd357('0x14')][_0xd357('0x16')]);return _0xc35e1f(_0x5f5aa9[_0xd357('0x14')]['message']);}else{logger[_0xd357('0x17')](_0xd357('0x10'),_0x468aef,_0xd357('0x11'));_0xc35e1f(_0x5f5aa9[_0xd357('0x18')][_0xd357('0x16')]);}})[_0xd357('0x19')](function(_0x26396b){logger[_0xd357('0x14')]('SmsInteraction,\x20%s,\x20%s',_0x468aef,_0x26396b);_0x11a818(_0x26396b);});});}exports['UpdateSmsInteraction']=function(_0x3f852c){var _0x3dc6c8=this;return new Promise(function(_0x4378b3,_0x5e9d30){return db[_0xd357('0x1a')]['update'](_0x3f852c['body'],{'raw':_0x3f852c[_0xd357('0x1b')]?_0x3f852c[_0xd357('0x1b')][_0xd357('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3f852c[_0xd357('0x1b')]?_0x3f852c['options']['where']||null:null,'attributes':_0x3f852c[_0xd357('0x1b')]?_0x3f852c[_0xd357('0x1b')][_0xd357('0x1d')]||null:null,'limit':_0x3f852c[_0xd357('0x1b')]?_0x3f852c['options'][_0xd357('0x1e')]||null:null})['then'](function(_0x3a44dc){logger[_0xd357('0x17')](_0xd357('0x1f'),_0x3f852c);logger[_0xd357('0x20')](_0xd357('0x1f'),_0x3f852c,JSON['stringify'](_0x3a44dc));_0x4378b3(_0x3a44dc);})[_0xd357('0x19')](function(_0xdf47e2){logger[_0xd357('0x14')](_0xd357('0x1f'),_0xdf47e2[_0xd357('0x16')],_0x3f852c);_0x5e9d30(_0x3dc6c8[_0xd357('0x14')](0x1f4,_0xdf47e2[_0xd357('0x16')]));});});};exports['AddTagsToSmsInteraction']=function(_0x4c73b9){return new Promise(function(_0x2e04f0,_0x426cd0){return db[_0xd357('0x1a')][_0xd357('0x21')]({'where':_0x4c73b9[_0xd357('0x1b')]?_0x4c73b9[_0xd357('0x1b')]['where']||null:null})[_0xd357('0x22')](function(_0x1758b5){if(_0x1758b5){return _0x1758b5['addTags'](_0x4c73b9[_0xd357('0x23')][_0xd357('0x24')],_[_0xd357('0x25')](_0x4c73b9[_0xd357('0x23')],[_0xd357('0x24'),'id'])||{});}})[_0xd357('0x26')](function(_0x3bac1c){logger[_0xd357('0x17')](_0xd357('0x27'),_0x4c73b9);logger[_0xd357('0x20')](_0xd357('0x27'),_0x4c73b9,JSON[_0xd357('0x13')](_0x3bac1c));_0x2e04f0(_0x3bac1c);})['catch'](function(_0x4b67ac){logger[_0xd357('0x14')](_0xd357('0x27'),_0x4b67ac['message'],_0x4c73b9);_0x426cd0(_this[_0xd357('0x14')](0x1f4,_0x4b67ac[_0xd357('0x16')]));});});}; \ No newline at end of file +var _0x65a6=['http','redis','localhost','socket.io-emitter','./smsInteraction.socket','register','request','then','SmsInteraction,\x20%s,\x20%s','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','SmsInteraction','update','body','options','raw','where','attributes','UpdateSmsInteraction','AddTagsToSmsInteraction','addTags','ids','AddTags','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x1095fc,_0x371fd8){var _0xd801f8=function(_0xd51217){while(--_0xd51217){_0x1095fc['push'](_0x1095fc['shift']());}};_0xd801f8(++_0x371fd8);}(_0x65a6,0x73));var _0x665a=function(_0x21353c,_0x2ea587){_0x21353c=_0x21353c-0x0;var _0xa99120=_0x65a6[_0x21353c];return _0xa99120;};'use strict';var _=require('lodash');var util=require(_0x665a('0x0'));var moment=require(_0x665a('0x1'));var BPromise=require(_0x665a('0x2'));var rs=require(_0x665a('0x3'));var fs=require('fs');var Redis=require(_0x665a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x665a('0x5'));var logger=require(_0x665a('0x6'))(_0x665a('0x7'));var config=require(_0x665a('0x8'));var jayson=require(_0x665a('0x9'));var client=jayson[_0x665a('0xa')][_0x665a('0xb')]({'port':0x232a});config[_0x665a('0xc')]=_['defaults'](config[_0x665a('0xc')],{'host':_0x665a('0xd'),'port':0x18eb});var socket=require(_0x665a('0xe'))(new Redis(config[_0x665a('0xc')]));require(_0x665a('0xf'))[_0x665a('0x10')](socket);function respondWithRpcPromise(_0x46fca6,_0x4e7ff8,_0x203e72){return new BPromise(function(_0x223c42,_0x554a45){return client[_0x665a('0x11')](_0x46fca6,_0x203e72)[_0x665a('0x12')](function(_0x381269){logger['info'](_0x665a('0x13'),_0x4e7ff8,'request\x20sent');logger[_0x665a('0x14')](_0x665a('0x15'),_0x4e7ff8,_0x665a('0x16'),JSON[_0x665a('0x17')](_0x381269));if(_0x381269['error']){if(_0x381269[_0x665a('0x18')][_0x665a('0x19')]===0x1f4){logger['error'](_0x665a('0x13'),_0x4e7ff8,_0x381269['error'][_0x665a('0x1a')]);return _0x554a45(_0x381269[_0x665a('0x18')]['message']);}logger[_0x665a('0x18')](_0x665a('0x13'),_0x4e7ff8,_0x381269[_0x665a('0x18')][_0x665a('0x1a')]);return _0x223c42(_0x381269[_0x665a('0x18')][_0x665a('0x1a')]);}else{logger[_0x665a('0x1b')](_0x665a('0x13'),_0x4e7ff8,_0x665a('0x16'));_0x223c42(_0x381269[_0x665a('0x1c')][_0x665a('0x1a')]);}})['catch'](function(_0x1addf7){logger[_0x665a('0x18')]('SmsInteraction,\x20%s,\x20%s',_0x4e7ff8,_0x1addf7);_0x554a45(_0x1addf7);});});}exports['UpdateSmsInteraction']=function(_0x106fa0){var _0x13f1f7=this;return new Promise(function(_0x3c49a1,_0x167980){return db[_0x665a('0x1d')][_0x665a('0x1e')](_0x106fa0[_0x665a('0x1f')],{'raw':_0x106fa0[_0x665a('0x20')]?_0x106fa0[_0x665a('0x20')][_0x665a('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x106fa0[_0x665a('0x20')]?_0x106fa0[_0x665a('0x20')][_0x665a('0x22')]||null:null,'attributes':_0x106fa0['options']?_0x106fa0['options'][_0x665a('0x23')]||null:null,'limit':_0x106fa0[_0x665a('0x20')]?_0x106fa0['options']['limit']||null:null})['then'](function(_0x28470a){logger['info'](_0x665a('0x24'),_0x106fa0);logger[_0x665a('0x14')]('UpdateSmsInteraction',_0x106fa0,JSON[_0x665a('0x17')](_0x28470a));_0x3c49a1(_0x28470a);})['catch'](function(_0x26969a){logger['error'](_0x665a('0x24'),_0x26969a[_0x665a('0x1a')],_0x106fa0);_0x167980(_0x13f1f7[_0x665a('0x18')](0x1f4,_0x26969a['message']));});});};exports[_0x665a('0x25')]=function(_0x540d28){return new Promise(function(_0x3238bd,_0x3766d0){return db['SmsInteraction']['find']({'where':_0x540d28[_0x665a('0x20')]?_0x540d28['options'][_0x665a('0x22')]||null:null})[_0x665a('0x12')](function(_0x3b6be1){if(_0x3b6be1){return _0x3b6be1[_0x665a('0x26')](_0x540d28[_0x665a('0x1f')][_0x665a('0x27')],_['omit'](_0x540d28[_0x665a('0x1f')],[_0x665a('0x27'),'id'])||{});}})['spread'](function(_0x246e83){logger['info']('AddTags',_0x540d28);logger['debug'](_0x665a('0x28'),_0x540d28,JSON['stringify'](_0x246e83));_0x3238bd(_0x246e83);})[_0x665a('0x29')](function(_0x1b0685){logger[_0x665a('0x18')](_0x665a('0x28'),_0x1b0685[_0x665a('0x1a')],_0x540d28);_0x3766d0(_this[_0x665a('0x18')](0x1f4,_0x1b0685[_0x665a('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index d801fcc..0fa2495 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 _0xdf49=['smsInteraction:','./smsInteraction.events','save','remove','removeListener','register','length'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xdf49,0xc5));var _0x9df4=function(_0x355adc,_0xac51ab){_0x355adc=_0x355adc-0x0;var _0x4df04f=_0xdf49[_0x355adc];return _0x4df04f;};'use strict';var SmsInteractionEvents=require(_0x9df4('0x0'));var events=[_0x9df4('0x1'),_0x9df4('0x2'),'update'];function createListener(_0x1e824f,_0x393e24){return function(_0x1471c1){_0x393e24['emit'](_0x1e824f,_0x1471c1);};}function removeListener(_0x255023,_0x56123c){return function(){SmsInteractionEvents[_0x9df4('0x3')](_0x255023,_0x56123c);};}exports[_0x9df4('0x4')]=function(_0x14974e){for(var _0x56c7ee=0x0,_0x1d8444=events[_0x9df4('0x5')];_0x56c7ee<_0x1d8444;_0x56c7ee++){var _0x4df4dc=events[_0x56c7ee];var _0x32a0e7=createListener(_0x9df4('0x6')+_0x4df4dc,_0x14974e);SmsInteractionEvents['on'](_0x4df4dc,_0x32a0e7);}}; \ No newline at end of file +var _0x198f=['./smsInteraction.events','emit','removeListener','register','length'];(function(_0x402b7e,_0x35fdf7){var _0x55f359=function(_0x20721e){while(--_0x20721e){_0x402b7e['push'](_0x402b7e['shift']());}};_0x55f359(++_0x35fdf7);}(_0x198f,0xa5));var _0xf198=function(_0xe90990,_0x539ad6){_0xe90990=_0xe90990-0x0;var _0x3d7171=_0x198f[_0xe90990];return _0x3d7171;};'use strict';var SmsInteractionEvents=require(_0xf198('0x0'));var events=['save','remove','update'];function createListener(_0x164d4a,_0xf50ea){return function(_0x4b3fe5){_0xf50ea[_0xf198('0x1')](_0x164d4a,_0x4b3fe5);};}function removeListener(_0x362794,_0x3b6445){return function(){SmsInteractionEvents[_0xf198('0x2')](_0x362794,_0x3b6445);};}exports[_0xf198('0x3')]=function(_0x49b316){for(var _0x235059=0x0,_0x1ae999=events[_0xf198('0x4')];_0x235059<_0x1ae999;_0x235059++){var _0x4dc5f7=events[_0x235059];var _0x4dfb02=createListener('smsInteraction:'+_0x4dc5f7,_0x49b316);SmsInteractionEvents['on'](_0x4dc5f7,_0x4dfb02);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index a87d07c..bd1f8d0 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 _0x0dd9=['show','tracked','sms','smsmessage:create','create','post','/:id/status','/:id','update','put','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x468493,_0x475605){var _0x4164dd=function(_0xf865cb){while(--_0xf865cb){_0x468493['push'](_0x468493['shift']());}};_0x4164dd(++_0x475605);}(_0x0dd9,0x84));var _0x90dd=function(_0x642acf,_0x3f3893){_0x642acf=_0x642acf-0x0;var _0x5cceb3=_0x0dd9[_0x642acf];return _0x5cceb3;};'use strict';var multer=require(_0x90dd('0x0'));var util=require(_0x90dd('0x1'));var path=require('path');var timeout=require(_0x90dd('0x2'));var express=require(_0x90dd('0x3'));var router=express['Router']();var fs_extra=require(_0x90dd('0x4'));var auth=require(_0x90dd('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x90dd('0x6'));var controller=require(_0x90dd('0x7'));router[_0x90dd('0x8')]('/',auth[_0x90dd('0x9')](),controller[_0x90dd('0xa')]);router[_0x90dd('0x8')](_0x90dd('0xb'),auth['isAuthenticated'](),controller[_0x90dd('0xc')]);router[_0x90dd('0x8')]('/:id',auth[_0x90dd('0x9')](),controller[_0x90dd('0xd')]);router['post']('/',auth[_0x90dd('0x9')](),interaction[_0x90dd('0xe')](_0x90dd('0xf'),_0x90dd('0x10')),controller[_0x90dd('0x11')]);router[_0x90dd('0x12')](_0x90dd('0x13'),controller['status']);router['put'](_0x90dd('0x14'),auth[_0x90dd('0x9')](),controller[_0x90dd('0x15')]);router[_0x90dd('0x16')](_0x90dd('0x17'),auth[_0x90dd('0x9')](),controller[_0x90dd('0x18')]);router[_0x90dd('0x16')](_0x90dd('0x19'),auth[_0x90dd('0x9')](),controller[_0x90dd('0x1a')]);router[_0x90dd('0x1b')](_0x90dd('0x14'),auth[_0x90dd('0x9')](),controller[_0x90dd('0x1c')]);module['exports']=router; \ No newline at end of file +var _0xfba1=['get','index','/describe','describe','/:id','isAuthenticated','show','tracked','sms','smsmessage:create','post','/:id/status','status','put','update','/:id/accept','accept','/:id/reject','reject','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsMessage.controller'];(function(_0x3f9890,_0x5b969a){var _0xb60ab6=function(_0x3813fb){while(--_0x3813fb){_0x3f9890['push'](_0x3f9890['shift']());}};_0xb60ab6(++_0x5b969a);}(_0xfba1,0x1e5));var _0x1fba=function(_0x593bc8,_0x16635a){_0x593bc8=_0x593bc8-0x0;var _0x1e2089=_0xfba1[_0x593bc8];return _0x1e2089;};'use strict';var multer=require('multer');var util=require(_0x1fba('0x0'));var path=require('path');var timeout=require(_0x1fba('0x1'));var express=require(_0x1fba('0x2'));var router=express[_0x1fba('0x3')]();var fs_extra=require(_0x1fba('0x4'));var auth=require(_0x1fba('0x5'));var interaction=require(_0x1fba('0x6'));var config=require('../../config/environment');var controller=require(_0x1fba('0x7'));router[_0x1fba('0x8')]('/',auth['isAuthenticated'](),controller[_0x1fba('0x9')]);router[_0x1fba('0x8')](_0x1fba('0xa'),auth['isAuthenticated'](),controller[_0x1fba('0xb')]);router['get'](_0x1fba('0xc'),auth[_0x1fba('0xd')](),controller[_0x1fba('0xe')]);router['post']('/',auth['isAuthenticated'](),interaction[_0x1fba('0xf')](_0x1fba('0x10'),_0x1fba('0x11')),controller['create']);router[_0x1fba('0x12')](_0x1fba('0x13'),controller[_0x1fba('0x14')]);router[_0x1fba('0x15')](_0x1fba('0xc'),auth[_0x1fba('0xd')](),controller[_0x1fba('0x16')]);router[_0x1fba('0x15')](_0x1fba('0x17'),auth[_0x1fba('0xd')](),controller[_0x1fba('0x18')]);router['put'](_0x1fba('0x19'),auth[_0x1fba('0xd')](),controller[_0x1fba('0x1a')]);router['delete'](_0x1fba('0xc'),auth[_0x1fba('0xd')](),controller[_0x1fba('0x1b')]);module[_0x1fba('0x1c')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 837e5b8..e114bfd 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 _0xb4a0=['medium','BOOLEAN','ENUM','out','STRING','sequelize','TEXT'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xb4a0,0x1e8));var _0x0b4a=function(_0x485610,_0x3e4b0a){_0x485610=_0x485610-0x0;var _0x4245d2=_0xb4a0[_0x485610];return _0x4245d2;};'use strict';var Sequelize=require(_0x0b4a('0x0'));module['exports']={'body':{'type':Sequelize[_0x0b4a('0x1')](_0x0b4a('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x0b4a('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x0b4a('0x4')]('in',_0x0b4a('0x5')),'defaultValue':_0x0b4a('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x0b4a('0x6')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0x0b4a('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x0b4a('0x6')]},'providerResponse':{'type':Sequelize[_0x0b4a('0x1')]}}; \ No newline at end of file +var _0x9494=['out','STRING','DATE','TEXT','exports','BOOLEAN','ENUM'];(function(_0xcee9e8,_0x26cbf4){var _0x5cad14=function(_0xe4ebb2){while(--_0xe4ebb2){_0xcee9e8['push'](_0xcee9e8['shift']());}};_0x5cad14(++_0x26cbf4);}(_0x9494,0xcf));var _0x4949=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9494[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x4949('0x0')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x4949('0x1')],'defaultValue':![]},'direction':{'type':Sequelize[_0x4949('0x2')]('in',_0x4949('0x3')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x4949('0x4')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x4949('0x5')]},'secret':{'type':Sequelize[_0x4949('0x1')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x4949('0x6')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 9b0e655..b78cabe 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 _0xc17d=['delivered','Status','infobip','results','groupName','SmsAccount,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','fs-extra','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','socket.io-emitter','register','client','http','request','then','info','SmsMessage,\x20%s,\x20%s','debug','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','sendStatus','status','end','offset','undefined','count','limit','reject','destroy','stack','name','send','index','map','SmsMessage','rawAttributes','fieldName','type','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','include','rows','show','params','includeAll','find','create','body','update','describe','sms-interactions','accept','sms','read','UserId','user','agent','SmsInteraction','SmsInteractionId','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','get','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','contact','User','fullname','email','internal','manual','interface','format','SIP/%s','channel','motionChannel','event','EventManager','../../config/logger','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','QueryTypes','rejectmessage','SmsAccount','received\x20delivery\x20report\x20from','inspect','MessageSid','messageId','twilio','MessageUUID','indexOf','sent'];(function(_0x54d52,_0x2473ba){var _0x968345=function(_0x3fcd06){while(--_0x3fcd06){_0x54d52['push'](_0x54d52['shift']());}};_0x968345(++_0x2473ba);}(_0xc17d,0x96));var _0xdc17=function(_0x27a68e,_0x1eaf96){_0x27a68e=_0x27a68e-0x0;var _0x5eb387=_0xc17d[_0x27a68e];return _0x5eb387;};'use strict';var emlformat=require(_0xdc17('0x0'));var rimraf=require(_0xdc17('0x1'));var zipdir=require(_0xdc17('0x2'));var jsonpatch=require(_0xdc17('0x3'));var rp=require('request-promise');var moment=require(_0xdc17('0x4'));var BPromise=require(_0xdc17('0x5'));var Mustache=require(_0xdc17('0x6'));var util=require(_0xdc17('0x7'));var path=require('path');var sox=require(_0xdc17('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdc17('0x9'));var _=require('lodash');var squel=require(_0xdc17('0xa'));var crypto=require(_0xdc17('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xdc17('0xc'));var querystring=require(_0xdc17('0xd'));var Papa=require(_0xdc17('0xe'));var Redis=require(_0xdc17('0xf'));var authService=require(_0xdc17('0x10'));var qs=require(_0xdc17('0x11'));var as=require(_0xdc17('0x12'));var hardwareService=require(_0xdc17('0x13'));var logger=require('../../config/logger')(_0xdc17('0x14'));var utils=require(_0xdc17('0x15'));var config=require(_0xdc17('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xdc17('0x17'))['db'];config['redis']=_[_0xdc17('0x18')](config[_0xdc17('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xdc17('0x1a'))(new Redis(config[_0xdc17('0x19')]));require('./smsMessage.socket')[_0xdc17('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson[_0xdc17('0x1c')][_0xdc17('0x1d')]({'port':0x232c});var client9002=jayson['client'][_0xdc17('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x428c8c,_0x17ff01,_0x30f50a,_0x5d847f){return new BPromise(function(_0x3adc90,_0x50eadc){var _0x324272=_0x5d847f||client;return _0x324272[_0xdc17('0x1e')](_0x428c8c,_0x30f50a)[_0xdc17('0x1f')](function(_0x3f578b){logger[_0xdc17('0x20')](_0xdc17('0x21'),_0x17ff01,'request\x20sent');logger[_0xdc17('0x22')](_0xdc17('0x23'),_0x17ff01,_0xdc17('0x24'),JSON[_0xdc17('0x25')](_0x3f578b));if(_0x3f578b[_0xdc17('0x26')]){if(_0x3f578b[_0xdc17('0x26')]['code']===0x1f4){logger[_0xdc17('0x26')](_0xdc17('0x21'),_0x17ff01,_0x3f578b['error'][_0xdc17('0x27')]);return _0x50eadc(_0x3f578b[_0xdc17('0x26')][_0xdc17('0x27')]);}logger[_0xdc17('0x26')](_0xdc17('0x21'),_0x17ff01,_0x3f578b['error'][_0xdc17('0x27')]);return _0x3adc90(_0x3f578b[_0xdc17('0x26')]['message']);}else{logger['info'](_0xdc17('0x21'),_0x17ff01,'request\x20sent');_0x3adc90(_0x3f578b[_0xdc17('0x28')]['message']);}})[_0xdc17('0x29')](function(_0x519795){logger['error'](_0xdc17('0x21'),_0x17ff01,_0x519795);_0x50eadc(_0x519795);});});}function respondWithStatusCode(_0x443ddb,_0x25930f){_0x25930f=_0x25930f||0xcc;return function(_0x177ee){if(_0x177ee){return _0x443ddb[_0xdc17('0x2a')](_0x25930f);}return _0x443ddb[_0xdc17('0x2b')](_0x25930f)[_0xdc17('0x2c')]();};}function respondWithResult(_0x2aede3,_0x20f45b){_0x20f45b=_0x20f45b||0xc8;return function(_0x573f37){if(_0x573f37){return _0x2aede3[_0xdc17('0x2b')](_0x20f45b)['json'](_0x573f37);}};}function respondWithFilteredResult(_0x879d4b,_0xc167e5){return function(_0x10f197){if(_0x10f197){var _0x49fd56=typeof _0xc167e5[_0xdc17('0x2d')]===_0xdc17('0x2e')&&typeof _0xc167e5['limit']===_0xdc17('0x2e');var _0x4b0212=_0x10f197[_0xdc17('0x2f')];var _0x593265=_0x49fd56?0x0:_0xc167e5['offset'];var _0x1863da=_0x49fd56?_0x10f197['count']:_0xc167e5['offset']+_0xc167e5[_0xdc17('0x30')];var _0x8b3d82;if(_0x1863da>=_0x4b0212){_0x1863da=_0x4b0212;_0x8b3d82=0xc8;}else{_0x8b3d82=0xce;}_0x879d4b['status'](_0x8b3d82);return _0x879d4b['set']('Content-Range',_0x593265+'-'+_0x1863da+'/'+_0x4b0212)['json'](_0x10f197);}return null;};}function patchUpdates(_0xfe067){return function(_0x5ba44a){try{jsonpatch['apply'](_0x5ba44a,_0xfe067,!![]);}catch(_0x5b38a5){return BPromise[_0xdc17('0x31')](_0x5b38a5);}return _0x5ba44a['save']();};}function saveUpdates(_0x3ee4ce,_0x3d7e3f){return function(_0x14a1cb){if(_0x14a1cb){return _0x14a1cb['update'](_0x3ee4ce)[_0xdc17('0x1f')](function(_0x4ad744){return _0x4ad744;});}return null;};}function removeEntity(_0xc794fc,_0x1ef572){return function(_0x3082ac){if(_0x3082ac){return _0x3082ac[_0xdc17('0x32')]()[_0xdc17('0x1f')](function(){_0xc794fc[_0xdc17('0x2b')](0xcc)[_0xdc17('0x2c')]();});}};}function handleEntityNotFound(_0x478711,_0x2e1dcf){return function(_0xaddd44){if(!_0xaddd44){_0x478711['sendStatus'](0x194);}return _0xaddd44;};}function handleError(_0x488a26,_0x33527c){_0x33527c=_0x33527c||0x1f4;return function(_0x10f5a4){logger['error'](_0x10f5a4[_0xdc17('0x33')]);if(_0x10f5a4[_0xdc17('0x34')]){delete _0x10f5a4[_0xdc17('0x34')];}_0x488a26[_0xdc17('0x2b')](_0x33527c)[_0xdc17('0x35')](_0x10f5a4);};}exports[_0xdc17('0x36')]=function(_0x1b34a8,_0x1881a5){var _0x338a34={},_0x1c106c={},_0x31cc9a={'count':0x0,'rows':[]};var _0x4682f4=_[_0xdc17('0x37')](db[_0xdc17('0x38')][_0xdc17('0x39')],function(_0x1dcf3b){return{'name':_0x1dcf3b[_0xdc17('0x3a')],'type':_0x1dcf3b[_0xdc17('0x3b')]['key']};});_0x1c106c[_0xdc17('0x3c')]=_['map'](_0x4682f4,_0xdc17('0x34'));_0x1c106c['query']=_[_0xdc17('0x3d')](_0x1b34a8[_0xdc17('0x3e')]);_0x1c106c[_0xdc17('0x3f')]=_[_0xdc17('0x40')](_0x1c106c[_0xdc17('0x3c')],_0x1c106c[_0xdc17('0x3e')]);_0x338a34['attributes']=_[_0xdc17('0x40')](_0x1c106c[_0xdc17('0x3c')],qs[_0xdc17('0x41')](_0x1b34a8[_0xdc17('0x3e')][_0xdc17('0x41')]));_0x338a34[_0xdc17('0x42')]=_0x338a34[_0xdc17('0x42')][_0xdc17('0x43')]?_0x338a34[_0xdc17('0x42')]:_0x1c106c['model'];if(!_0x1b34a8[_0xdc17('0x3e')][_0xdc17('0x44')]('nolimit')){_0x338a34[_0xdc17('0x30')]=qs[_0xdc17('0x30')](_0x1b34a8[_0xdc17('0x3e')][_0xdc17('0x30')]);_0x338a34['offset']=qs['offset'](_0x1b34a8[_0xdc17('0x3e')][_0xdc17('0x2d')]);}_0x338a34[_0xdc17('0x45')]=qs[_0xdc17('0x46')](_0x1b34a8[_0xdc17('0x3e')]['sort']);_0x338a34[_0xdc17('0x47')]=qs[_0xdc17('0x3f')](_[_0xdc17('0x48')](_0x1b34a8[_0xdc17('0x3e')],_0x1c106c[_0xdc17('0x3f')]),_0x4682f4);if(_0x1b34a8[_0xdc17('0x3e')][_0xdc17('0x49')]){_0x338a34[_0xdc17('0x47')]=_[_0xdc17('0x4a')](_0x338a34[_0xdc17('0x47')],{'$or':_['map'](_0x4682f4,function(_0x21a632){if(_0x21a632[_0xdc17('0x3b')]!==_0xdc17('0x4b')){var _0x4f913b={};_0x4f913b[_0x21a632[_0xdc17('0x34')]]={'$like':'%'+_0x1b34a8[_0xdc17('0x3e')]['filter']+'%'};return _0x4f913b;}})});}_0x338a34=_[_0xdc17('0x4a')]({},_0x338a34,_0x1b34a8[_0xdc17('0x4c')]);var _0x467a53={'where':_0x338a34['where']};return db[_0xdc17('0x38')][_0xdc17('0x2f')](_0x467a53)['then'](function(_0x43a1f6){_0x31cc9a[_0xdc17('0x2f')]=_0x43a1f6;if(_0x1b34a8['query']['includeAll']){_0x338a34[_0xdc17('0x4d')]=[{'all':!![]}];}return db[_0xdc17('0x38')]['findAll'](_0x338a34);})[_0xdc17('0x1f')](function(_0xe2411){_0x31cc9a[_0xdc17('0x4e')]=_0xe2411;return _0x31cc9a;})[_0xdc17('0x1f')](respondWithFilteredResult(_0x1881a5,_0x338a34))[_0xdc17('0x29')](handleError(_0x1881a5,null));};exports[_0xdc17('0x4f')]=function(_0x3118c2,_0x5aaa2d){var _0x433f51={'raw':!![],'where':{'id':_0x3118c2[_0xdc17('0x50')]['id']}},_0x2abfd8={};_0x2abfd8[_0xdc17('0x3c')]=_[_0xdc17('0x3d')](db[_0xdc17('0x38')]['rawAttributes']);_0x2abfd8[_0xdc17('0x3e')]=_[_0xdc17('0x3d')](_0x3118c2[_0xdc17('0x3e')]);_0x2abfd8[_0xdc17('0x3f')]=_[_0xdc17('0x40')](_0x2abfd8[_0xdc17('0x3c')],_0x2abfd8[_0xdc17('0x3e')]);_0x433f51[_0xdc17('0x42')]=_['intersection'](_0x2abfd8['model'],qs[_0xdc17('0x41')](_0x3118c2[_0xdc17('0x3e')][_0xdc17('0x41')]));_0x433f51[_0xdc17('0x42')]=_0x433f51[_0xdc17('0x42')][_0xdc17('0x43')]?_0x433f51['attributes']:_0x2abfd8[_0xdc17('0x3c')];if(_0x3118c2[_0xdc17('0x3e')][_0xdc17('0x51')]){_0x433f51[_0xdc17('0x4d')]=[{'all':!![]}];}_0x433f51=_[_0xdc17('0x4a')]({},_0x433f51,_0x3118c2[_0xdc17('0x4c')]);return db[_0xdc17('0x38')][_0xdc17('0x52')](_0x433f51)[_0xdc17('0x1f')](handleEntityNotFound(_0x5aaa2d,null))[_0xdc17('0x1f')](respondWithResult(_0x5aaa2d,null))[_0xdc17('0x29')](handleError(_0x5aaa2d,null));};exports[_0xdc17('0x53')]=function(_0x357d34,_0x40bd27){return db[_0xdc17('0x38')][_0xdc17('0x53')](_0x357d34[_0xdc17('0x54')],{})[_0xdc17('0x1f')](respondWithResult(_0x40bd27,0xc9))[_0xdc17('0x29')](handleError(_0x40bd27,null));};exports[_0xdc17('0x55')]=function(_0x21955a,_0x136859){if(_0x21955a[_0xdc17('0x54')]['id']){delete _0x21955a[_0xdc17('0x54')]['id'];}return db[_0xdc17('0x38')][_0xdc17('0x52')]({'where':{'id':_0x21955a[_0xdc17('0x50')]['id']}})['then'](handleEntityNotFound(_0x136859,null))[_0xdc17('0x1f')](saveUpdates(_0x21955a[_0xdc17('0x54')],null))[_0xdc17('0x1f')](respondWithResult(_0x136859,null))[_0xdc17('0x29')](handleError(_0x136859,null));};exports[_0xdc17('0x32')]=function(_0xa06b0b,_0x2b293b){return db[_0xdc17('0x38')][_0xdc17('0x52')]({'where':{'id':_0xa06b0b['params']['id']}})['then'](handleEntityNotFound(_0x2b293b,null))[_0xdc17('0x1f')](removeEntity(_0x2b293b,null))[_0xdc17('0x29')](handleError(_0x2b293b,null));};exports[_0xdc17('0x56')]=function(_0xce6d5b,_0xf29943){return db[_0xdc17('0x38')][_0xdc17('0x56')]()[_0xdc17('0x1f')](respondWithResult(_0xf29943,null))[_0xdc17('0x29')](handleError(_0xf29943,null));};var interaction_log=require('../../config/logger')(_0xdc17('0x57'));exports[_0xdc17('0x58')]=function(_0x55415d,_0x1dfb48,_0x44736c){var _0x1a735a={'agent':{},'channel':_0xdc17('0x59')};if(_0x55415d[_0xdc17('0x54')]['id']){delete _0x55415d[_0xdc17('0x54')]['id'];}_0x55415d[_0xdc17('0x54')][_0xdc17('0x5a')]=!![];_0x55415d[_0xdc17('0x54')]['readAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x55415d[_0xdc17('0x54')]['UserId']=_0x55415d[_0xdc17('0x54')][_0xdc17('0x5b')]||_0x55415d[_0xdc17('0x5c')]['id'];_0x1a735a[_0xdc17('0x5d')]['id']=_0x55415d[_0xdc17('0x54')][_0xdc17('0x5b')];return db[_0xdc17('0x38')][_0xdc17('0x52')]({'where':{'id':_0x55415d[_0xdc17('0x50')]['id'],'UserId':null}})[_0xdc17('0x1f')](handleEntityNotFound(_0x1dfb48,null))['then'](saveUpdates(_0x55415d['body'],null))[_0xdc17('0x1f')](function(_0x227ba0){if(_0x227ba0){_0x1a735a[_0xdc17('0x27')]=_0x227ba0['get']({'plain':!![]});return db[_0xdc17('0x5e')][_0xdc17('0x52')]({'where':{'id':_0x227ba0[_0xdc17('0x5f')]}});}return null;})[_0xdc17('0x1f')](handleEntityNotFound(_0x1dfb48,null))[_0xdc17('0x1f')](function(_0x3fce8d){if(_0x3fce8d){return _0x3fce8d[_0xdc17('0x55')]({'UserId':_0x55415d[_0xdc17('0x54')][_0xdc17('0x5b')],'read1stAt':_['isNil'](_0x3fce8d[_0xdc17('0x60')])?moment()['format'](_0xdc17('0x61')):undefined});}return null;})[_0xdc17('0x1f')](function(_0x43a782){if(_0x43a782){_0x1a735a[_0xdc17('0x62')]=_0x43a782[_0xdc17('0x63')]({'plain':!![]});interaction_log[_0xdc17('0x20')](_0xdc17('0x64'),_0x55415d[_0xdc17('0x5c')]['id'],_0x55415d[_0xdc17('0x5c')]['name'],_0x55415d[_0xdc17('0x5c')]['role'],_0x1a735a[_0xdc17('0x62')]['id'],_0x55415d[_0xdc17('0x54')]?JSON['stringify'](_0x55415d[_0xdc17('0x54')]):_0xdc17('0x65'));return respondWithRpcPromise(_0xdc17('0x66'),_0xdc17('0x67'),_0x1a735a);}return null;})['then'](function(_0x3016b1){var _0x450c88=_0xdc17('0x68')+_0x3016b1[_0xdc17('0x27')][_0xdc17('0x69')];return db[_0xdc17('0x6a')]['query'](_0x450c88,{'type':db[_0xdc17('0x6b')]['QueryTypes'][_0xdc17('0x6c')],'raw':!![]})[_0xdc17('0x1f')](function(_0x3afcbc){return _0x3afcbc;});})[_0xdc17('0x1f')](function(_0x187cc3){if(_0x187cc3){_0x1a735a[_0xdc17('0x27')][_0xdc17('0x6d')]=_0x187cc3[0x0];if(!_0x55415d['body'][_0xdc17('0x5b')])return;return db[_0xdc17('0x6e')][_0xdc17('0x52')]({'where':{'id':_0x55415d[_0xdc17('0x54')]['UserId'],'role':_0xdc17('0x5d')},'attributes':['id',_0xdc17('0x34'),_0xdc17('0x6f'),_0xdc17('0x70'),_0xdc17('0x71')],'raw':!![]});}return null;})[_0xdc17('0x1f')](function(_0xcd9b4){if(!_0xcd9b4)return null;_0x1a735a[_0xdc17('0x27')]['agent']=_0xcd9b4;return _0x1a735a;})[_0xdc17('0x1f')](function(_0x2ed4c1){if(_0x2ed4c1){if(_0x55415d['body'][_0xdc17('0x72')]){_0x1a735a[_0xdc17('0x27')][_0xdc17('0x73')]=util[_0xdc17('0x74')](_0xdc17('0x75'),_0x55415d[_0xdc17('0x5c')][_0xdc17('0x34')]);_0x1a735a[_0xdc17('0x27')][_0xdc17('0x76')]=_0x1a735a[_0xdc17('0x76')];_0x1a735a[_0xdc17('0x27')][_0xdc17('0x77')]=_0x1a735a['channel'];_0x1a735a['message'][_0xdc17('0x78')]=_0xdc17('0x58');return respondWithRpcPromise(_0xdc17('0x79'),'EventManager',{'event':'acceptmessage','message':_0x1a735a['message']},client9002)[_0xdc17('0x1f')](function(){return _0x1a735a;});}return _0x1a735a;}return null;})['then'](respondWithResult(_0x1dfb48,null))[_0xdc17('0x29')](handleError(_0x1dfb48,null));};var interaction_log=require(_0xdc17('0x7a'))(_0xdc17('0x57'));exports[_0xdc17('0x31')]=function(_0x4f2557,_0x28e60d,_0x4ba6b6){var _0x194fdc={'agent':{},'channel':_0xdc17('0x59')};if(_0x4f2557[_0xdc17('0x54')]['id']){delete _0x4f2557[_0xdc17('0x54')]['id'];}_0x4f2557['body'][_0xdc17('0x5b')]=_0x4f2557[_0xdc17('0x54')][_0xdc17('0x5b')]||_0x4f2557[_0xdc17('0x5c')]['id'];_0x194fdc[_0xdc17('0x5d')]['id']=_0x4f2557[_0xdc17('0x54')]['UserId'];return db[_0xdc17('0x38')]['find']({'where':{'id':_0x4f2557[_0xdc17('0x50')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x28e60d,null))[_0xdc17('0x1f')](function(_0x5d0d8b){if(_0x5d0d8b){_0x194fdc[_0xdc17('0x27')]=_0x5d0d8b[_0xdc17('0x63')]({'plain':!![]});return db[_0xdc17('0x5e')]['find']({'where':{'id':_0x5d0d8b[_0xdc17('0x5f')]}});}return null;})['then'](handleEntityNotFound(_0x28e60d,null))[_0xdc17('0x1f')](function(_0x24fee6){if(_0x24fee6){_0x194fdc[_0xdc17('0x62')]=_0x24fee6[_0xdc17('0x63')]({'plain':!![]});interaction_log['info'](_0xdc17('0x7b'),_0x4f2557[_0xdc17('0x5c')]['id'],_0x4f2557[_0xdc17('0x5c')][_0xdc17('0x34')],_0x4f2557[_0xdc17('0x5c')][_0xdc17('0x7c')],_0x194fdc[_0xdc17('0x62')]['id'],_0x4f2557[_0xdc17('0x54')]?JSON[_0xdc17('0x25')](_0x4f2557[_0xdc17('0x54')]):_0xdc17('0x65'));return respondWithRpcPromise(_0xdc17('0x7d'),_0xdc17('0x7e'),_0x194fdc);}return null;})[_0xdc17('0x1f')](function(_0x26843a){var _0x5b2a98=_0xdc17('0x68')+_0x26843a[_0xdc17('0x27')][_0xdc17('0x69')];return db[_0xdc17('0x6a')][_0xdc17('0x3e')](_0x5b2a98,{'type':db[_0xdc17('0x6b')][_0xdc17('0x7f')][_0xdc17('0x6c')],'raw':!![]})[_0xdc17('0x1f')](function(_0x2a1dd7){return _0x2a1dd7;});})[_0xdc17('0x1f')](function(_0x4eeae8){if(_0x4eeae8){_0x194fdc[_0xdc17('0x27')][_0xdc17('0x6d')]=_0x4eeae8[0x0];if(!_0x4f2557[_0xdc17('0x54')][_0xdc17('0x5b')])return;return db['User']['find']({'where':{'id':_0x4f2557['body'][_0xdc17('0x5b')],'role':_0xdc17('0x5d')},'attributes':['id',_0xdc17('0x34'),_0xdc17('0x6f'),_0xdc17('0x70'),_0xdc17('0x71')],'raw':!![]});}return null;})[_0xdc17('0x1f')](function(_0x5dbe82){if(!_0x5dbe82)return null;_0x194fdc['message']['agent']=_0x5dbe82;return _0x194fdc;})[_0xdc17('0x1f')](function(_0x27d124){if(_0x27d124){_0x27d124['message'][_0xdc17('0x73')]=util[_0xdc17('0x74')](_0xdc17('0x75'),_0x4f2557[_0xdc17('0x5c')][_0xdc17('0x34')]);_0x27d124['message'][_0xdc17('0x76')]=_0x194fdc[_0xdc17('0x76')];_0x27d124[_0xdc17('0x27')][_0xdc17('0x77')]=_0x194fdc['channel'];_0x27d124[_0xdc17('0x27')][_0xdc17('0x78')]=_0xdc17('0x31');respondWithRpcPromise(_0xdc17('0x79'),_0xdc17('0x79'),{'event':_0xdc17('0x80'),'message':_0x27d124[_0xdc17('0x27')]},client9002);return _0x194fdc;}return null;})[_0xdc17('0x1f')](respondWithResult(_0x28e60d,null))[_0xdc17('0x29')](handleError(_0x28e60d,null));};exports[_0xdc17('0x2b')]=function(_0x5c789b,_0x5ee1c9,_0x292002){if(_0x5c789b[_0xdc17('0x54')]['id']){delete _0x5c789b[_0xdc17('0x54')]['id'];}var _0x2a9e67;return db[_0xdc17('0x38')][_0xdc17('0x52')]({'where':{'id':_0x5c789b[_0xdc17('0x50')]['id']}})[_0xdc17('0x1f')](handleEntityNotFound(_0x5ee1c9,null))[_0xdc17('0x1f')](function(_0x56156b){if(_0x56156b){_0x2a9e67=_0x56156b;return db[_0xdc17('0x81')]['find']({'where':{'id':_0x56156b['SmsAccountId']}});}})['then'](handleEntityNotFound(_0x5ee1c9,null))['then'](function(_0x47ede9){if(_0x47ede9){logger[_0xdc17('0x22')](_0xdc17('0x23'),'status',_0xdc17('0x82'),_0x47ede9[_0xdc17('0x3b')],util[_0xdc17('0x83')](_0x5c789b[_0xdc17('0x54')],{'showHidden':![],'depth':null}));switch(_0x47ede9[_0xdc17('0x3b')]){case'twilio':if(_0x5c789b[_0xdc17('0x54')][_0xdc17('0x84')]&&_0x5c789b['body'][_0xdc17('0x84')]===_0x2a9e67[_0xdc17('0x85')]){return _0x2a9e67['update']({'read':!![]});}else{logger[_0xdc17('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xdc17('0x2b'),_0xdc17('0x86'),util[_0xdc17('0x83')](_0x5c789b[_0xdc17('0x54')],{'showHidden':![],'depth':null}));}break;case'plivo':if(_0x5c789b[_0xdc17('0x54')][_0xdc17('0x87')]&&_0x5c789b[_0xdc17('0x54')][_0xdc17('0x87')]===_0x2a9e67[_0xdc17('0x85')]&&_[_0xdc17('0x88')]([_0xdc17('0x89'),_0xdc17('0x8a')],_0x5c789b[_0xdc17('0x54')][_0xdc17('0x8b')])>=0x0){return _0x2a9e67['update']({'read':!![]});}else{logger[_0xdc17('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s','status','plivio',util[_0xdc17('0x83')](_0x5c789b[_0xdc17('0x54')],{'showHidden':![],'depth':null}));}break;case _0xdc17('0x8c'):var _0x1e8ad4=_0x5c789b[_0xdc17('0x54')][_0xdc17('0x8d')][0x0];if(_0x1e8ad4[_0xdc17('0x2b')][_0xdc17('0x8e')]==='DELIVERED'){return _0x2a9e67[_0xdc17('0x55')]({'read':!![]});}else{logger[_0xdc17('0x26')](_0xdc17('0x8f'),_0xdc17('0x2b'),_0xdc17('0x8c'),util[_0xdc17('0x83')](_0x5c789b[_0xdc17('0x54')],{'showHidden':![],'depth':null}));}break;}return _0x2a9e67;}})['then'](respondWithResult(_0x5ee1c9,null))[_0xdc17('0x29')](handleError(_0x5ee1c9,null));}; \ No newline at end of file +var _0xd4ad=['UserId','user','agent','get','isNil','read1stAt','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','AcceptMessage','acceptMessage','sequelize','QueryTypes','SELECT','contact','User','email','internal','manual','interface','channel','event','EventManager','acceptmessage','sms-interactions','reject','SmsInteraction','SmsInteractionId','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','fullname','SIP/%s','motionChannel','rejectmessage','SmsAccountId','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageUUID','sent','delivered','SmsAccount,\x20%s,\x20%s,\x20%s','plivio','infobip','results','groupName','DELIVERED','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','ejs','lodash','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','socket.io-emitter','./smsMessage.socket','client','request','info','request\x20sent','debug','stringify','error','code','SmsMessage,\x20%s,\x20%s','message','result','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','update','destroy','stack','name','index','rawAttributes','type','key','model','map','keys','query','filters','attributes','intersection','fields','length','nolimit','order','sort','where','filter','VIRTUAL','merge','options','SmsMessage','then','includeAll','include','findAll','rows','show','params','create','body','catch','find','describe','accept','sms','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x6907a5,_0x5861a8){var _0x5d852c=function(_0x19a651){while(--_0x19a651){_0x6907a5['push'](_0x6907a5['shift']());}};_0x5d852c(++_0x5861a8);}(_0xd4ad,0x158));var _0xdd4a=function(_0x22af33,_0x490a9d){_0x22af33=_0x22af33-0x0;var _0x4d1b60=_0xd4ad[_0x22af33];return _0x4d1b60;};'use strict';var emlformat=require(_0xdd4a('0x0'));var rimraf=require(_0xdd4a('0x1'));var zipdir=require(_0xdd4a('0x2'));var jsonpatch=require(_0xdd4a('0x3'));var rp=require('request-promise');var moment=require(_0xdd4a('0x4'));var BPromise=require(_0xdd4a('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xdd4a('0x6'));var sox=require(_0xdd4a('0x7'));var csv=require('to-csv');var ejs=require(_0xdd4a('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdd4a('0x9'));var squel=require(_0xdd4a('0xa'));var crypto=require('crypto');var jsforce=require(_0xdd4a('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xdd4a('0xc'));var querystring=require(_0xdd4a('0xd'));var Papa=require(_0xdd4a('0xe'));var Redis=require(_0xdd4a('0xf'));var authService=require(_0xdd4a('0x10'));var qs=require(_0xdd4a('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xdd4a('0x12'))('api');var utils=require(_0xdd4a('0x13'));var config=require(_0xdd4a('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xdd4a('0x15'))['db'];config[_0xdd4a('0x16')]=_['defaults'](config[_0xdd4a('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0xdd4a('0x17'))(new Redis(config['redis']));require(_0xdd4a('0x18'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0xdd4a('0x19')]['http']({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2971b6,_0x898d87,_0xe41bc0,_0x2bdd14){return new BPromise(function(_0x37d755,_0x335bb6){var _0x154364=_0x2bdd14||client;return _0x154364[_0xdd4a('0x1a')](_0x2971b6,_0xe41bc0)['then'](function(_0x3c3fdd){logger[_0xdd4a('0x1b')]('SmsMessage,\x20%s,\x20%s',_0x898d87,_0xdd4a('0x1c'));logger[_0xdd4a('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x898d87,_0xdd4a('0x1c'),JSON[_0xdd4a('0x1e')](_0x3c3fdd));if(_0x3c3fdd[_0xdd4a('0x1f')]){if(_0x3c3fdd[_0xdd4a('0x1f')][_0xdd4a('0x20')]===0x1f4){logger[_0xdd4a('0x1f')](_0xdd4a('0x21'),_0x898d87,_0x3c3fdd['error']['message']);return _0x335bb6(_0x3c3fdd['error']['message']);}logger[_0xdd4a('0x1f')](_0xdd4a('0x21'),_0x898d87,_0x3c3fdd[_0xdd4a('0x1f')][_0xdd4a('0x22')]);return _0x37d755(_0x3c3fdd[_0xdd4a('0x1f')]['message']);}else{logger[_0xdd4a('0x1b')](_0xdd4a('0x21'),_0x898d87,_0xdd4a('0x1c'));_0x37d755(_0x3c3fdd[_0xdd4a('0x23')]['message']);}})['catch'](function(_0x5301ee){logger['error'](_0xdd4a('0x21'),_0x898d87,_0x5301ee);_0x335bb6(_0x5301ee);});});}function respondWithStatusCode(_0x516667,_0x537099){_0x537099=_0x537099||0xcc;return function(_0x26846d){if(_0x26846d){return _0x516667[_0xdd4a('0x24')](_0x537099);}return _0x516667[_0xdd4a('0x25')](_0x537099)[_0xdd4a('0x26')]();};}function respondWithResult(_0x6eaea3,_0x28e499){_0x28e499=_0x28e499||0xc8;return function(_0x4d2b89){if(_0x4d2b89){return _0x6eaea3[_0xdd4a('0x25')](_0x28e499)[_0xdd4a('0x27')](_0x4d2b89);}};}function respondWithFilteredResult(_0x540597,_0x10cf52){return function(_0x48cd1e){if(_0x48cd1e){var _0x5f1a9e=typeof _0x10cf52[_0xdd4a('0x28')]===_0xdd4a('0x29')&&typeof _0x10cf52[_0xdd4a('0x2a')]==='undefined';var _0x117d2a=_0x48cd1e[_0xdd4a('0x2b')];var _0x292d67=_0x5f1a9e?0x0:_0x10cf52['offset'];var _0x2b6d01=_0x5f1a9e?_0x48cd1e['count']:_0x10cf52[_0xdd4a('0x28')]+_0x10cf52[_0xdd4a('0x2a')];var _0x87a9a7;if(_0x2b6d01>=_0x117d2a){_0x2b6d01=_0x117d2a;_0x87a9a7=0xc8;}else{_0x87a9a7=0xce;}_0x540597['status'](_0x87a9a7);return _0x540597[_0xdd4a('0x2c')](_0xdd4a('0x2d'),_0x292d67+'-'+_0x2b6d01+'/'+_0x117d2a)['json'](_0x48cd1e);}return null;};}function patchUpdates(_0x40c826){return function(_0x456627){try{jsonpatch['apply'](_0x456627,_0x40c826,!![]);}catch(_0x17f253){return BPromise['reject'](_0x17f253);}return _0x456627[_0xdd4a('0x2e')]();};}function saveUpdates(_0x20c9d5,_0x122d4a){return function(_0x342182){if(_0x342182){return _0x342182[_0xdd4a('0x2f')](_0x20c9d5)['then'](function(_0x1bc986){return _0x1bc986;});}return null;};}function removeEntity(_0xff5437,_0x32abdd){return function(_0x18777b){if(_0x18777b){return _0x18777b[_0xdd4a('0x30')]()['then'](function(){_0xff5437['status'](0xcc)[_0xdd4a('0x26')]();});}};}function handleEntityNotFound(_0x19b9df,_0x50c38d){return function(_0x187660){if(!_0x187660){_0x19b9df['sendStatus'](0x194);}return _0x187660;};}function handleError(_0x1fd026,_0x14b9b0){_0x14b9b0=_0x14b9b0||0x1f4;return function(_0x52abd1){logger[_0xdd4a('0x1f')](_0x52abd1[_0xdd4a('0x31')]);if(_0x52abd1['name']){delete _0x52abd1[_0xdd4a('0x32')];}_0x1fd026['status'](_0x14b9b0)['send'](_0x52abd1);};}exports[_0xdd4a('0x33')]=function(_0x26cb9e,_0x1d4eed){var _0x441646={},_0x2b2cc6={},_0x72710b={'count':0x0,'rows':[]};var _0x3f676e=_['map'](db['SmsMessage'][_0xdd4a('0x34')],function(_0x2f4417){return{'name':_0x2f4417['fieldName'],'type':_0x2f4417[_0xdd4a('0x35')][_0xdd4a('0x36')]};});_0x2b2cc6[_0xdd4a('0x37')]=_[_0xdd4a('0x38')](_0x3f676e,'name');_0x2b2cc6['query']=_[_0xdd4a('0x39')](_0x26cb9e[_0xdd4a('0x3a')]);_0x2b2cc6[_0xdd4a('0x3b')]=_['intersection'](_0x2b2cc6[_0xdd4a('0x37')],_0x2b2cc6[_0xdd4a('0x3a')]);_0x441646[_0xdd4a('0x3c')]=_[_0xdd4a('0x3d')](_0x2b2cc6[_0xdd4a('0x37')],qs['fields'](_0x26cb9e[_0xdd4a('0x3a')][_0xdd4a('0x3e')]));_0x441646[_0xdd4a('0x3c')]=_0x441646[_0xdd4a('0x3c')][_0xdd4a('0x3f')]?_0x441646['attributes']:_0x2b2cc6[_0xdd4a('0x37')];if(!_0x26cb9e[_0xdd4a('0x3a')]['hasOwnProperty'](_0xdd4a('0x40'))){_0x441646[_0xdd4a('0x2a')]=qs[_0xdd4a('0x2a')](_0x26cb9e[_0xdd4a('0x3a')]['limit']);_0x441646['offset']=qs[_0xdd4a('0x28')](_0x26cb9e['query'][_0xdd4a('0x28')]);}_0x441646[_0xdd4a('0x41')]=qs[_0xdd4a('0x42')](_0x26cb9e[_0xdd4a('0x3a')][_0xdd4a('0x42')]);_0x441646[_0xdd4a('0x43')]=qs[_0xdd4a('0x3b')](_['pick'](_0x26cb9e[_0xdd4a('0x3a')],_0x2b2cc6[_0xdd4a('0x3b')]),_0x3f676e);if(_0x26cb9e[_0xdd4a('0x3a')][_0xdd4a('0x44')]){_0x441646[_0xdd4a('0x43')]=_['merge'](_0x441646[_0xdd4a('0x43')],{'$or':_[_0xdd4a('0x38')](_0x3f676e,function(_0x3572fb){if(_0x3572fb[_0xdd4a('0x35')]!==_0xdd4a('0x45')){var _0x235f1b={};_0x235f1b[_0x3572fb[_0xdd4a('0x32')]]={'$like':'%'+_0x26cb9e[_0xdd4a('0x3a')][_0xdd4a('0x44')]+'%'};return _0x235f1b;}})});}_0x441646=_[_0xdd4a('0x46')]({},_0x441646,_0x26cb9e[_0xdd4a('0x47')]);var _0x2e1544={'where':_0x441646[_0xdd4a('0x43')]};return db[_0xdd4a('0x48')][_0xdd4a('0x2b')](_0x2e1544)[_0xdd4a('0x49')](function(_0x583cfb){_0x72710b[_0xdd4a('0x2b')]=_0x583cfb;if(_0x26cb9e['query'][_0xdd4a('0x4a')]){_0x441646[_0xdd4a('0x4b')]=[{'all':!![]}];}return db[_0xdd4a('0x48')][_0xdd4a('0x4c')](_0x441646);})[_0xdd4a('0x49')](function(_0x543b31){_0x72710b[_0xdd4a('0x4d')]=_0x543b31;return _0x72710b;})['then'](respondWithFilteredResult(_0x1d4eed,_0x441646))['catch'](handleError(_0x1d4eed,null));};exports[_0xdd4a('0x4e')]=function(_0x24da0c,_0x1df8ee){var _0x5ef072={'raw':!![],'where':{'id':_0x24da0c[_0xdd4a('0x4f')]['id']}},_0x36d033={};_0x36d033['model']=_[_0xdd4a('0x39')](db[_0xdd4a('0x48')]['rawAttributes']);_0x36d033[_0xdd4a('0x3a')]=_[_0xdd4a('0x39')](_0x24da0c['query']);_0x36d033[_0xdd4a('0x3b')]=_[_0xdd4a('0x3d')](_0x36d033['model'],_0x36d033[_0xdd4a('0x3a')]);_0x5ef072[_0xdd4a('0x3c')]=_[_0xdd4a('0x3d')](_0x36d033[_0xdd4a('0x37')],qs[_0xdd4a('0x3e')](_0x24da0c['query']['fields']));_0x5ef072[_0xdd4a('0x3c')]=_0x5ef072[_0xdd4a('0x3c')][_0xdd4a('0x3f')]?_0x5ef072[_0xdd4a('0x3c')]:_0x36d033[_0xdd4a('0x37')];if(_0x24da0c['query'][_0xdd4a('0x4a')]){_0x5ef072[_0xdd4a('0x4b')]=[{'all':!![]}];}_0x5ef072=_[_0xdd4a('0x46')]({},_0x5ef072,_0x24da0c[_0xdd4a('0x47')]);return db[_0xdd4a('0x48')]['find'](_0x5ef072)['then'](handleEntityNotFound(_0x1df8ee,null))[_0xdd4a('0x49')](respondWithResult(_0x1df8ee,null))['catch'](handleError(_0x1df8ee,null));};exports[_0xdd4a('0x50')]=function(_0x303f3b,_0xc5b22){return db[_0xdd4a('0x48')][_0xdd4a('0x50')](_0x303f3b[_0xdd4a('0x51')],{})['then'](respondWithResult(_0xc5b22,0xc9))[_0xdd4a('0x52')](handleError(_0xc5b22,null));};exports[_0xdd4a('0x2f')]=function(_0xa71a66,_0x5f097e){if(_0xa71a66[_0xdd4a('0x51')]['id']){delete _0xa71a66['body']['id'];}return db[_0xdd4a('0x48')][_0xdd4a('0x53')]({'where':{'id':_0xa71a66['params']['id']}})['then'](handleEntityNotFound(_0x5f097e,null))[_0xdd4a('0x49')](saveUpdates(_0xa71a66[_0xdd4a('0x51')],null))[_0xdd4a('0x49')](respondWithResult(_0x5f097e,null))['catch'](handleError(_0x5f097e,null));};exports[_0xdd4a('0x30')]=function(_0x419c1f,_0x5dcfe1){return db[_0xdd4a('0x48')][_0xdd4a('0x53')]({'where':{'id':_0x419c1f[_0xdd4a('0x4f')]['id']}})['then'](handleEntityNotFound(_0x5dcfe1,null))['then'](removeEntity(_0x5dcfe1,null))[_0xdd4a('0x52')](handleError(_0x5dcfe1,null));};exports[_0xdd4a('0x54')]=function(_0x2cdcff,_0x36a6d3){return db[_0xdd4a('0x48')][_0xdd4a('0x54')]()['then'](respondWithResult(_0x36a6d3,null))[_0xdd4a('0x52')](handleError(_0x36a6d3,null));};var interaction_log=require(_0xdd4a('0x12'))('sms-interactions');exports[_0xdd4a('0x55')]=function(_0x5040b4,_0x342d4f,_0x14fbb9){var _0x371ca3={'agent':{},'channel':_0xdd4a('0x56')};if(_0x5040b4[_0xdd4a('0x51')]['id']){delete _0x5040b4[_0xdd4a('0x51')]['id'];}_0x5040b4[_0xdd4a('0x51')][_0xdd4a('0x57')]=!![];_0x5040b4[_0xdd4a('0x51')][_0xdd4a('0x58')]=moment()[_0xdd4a('0x59')](_0xdd4a('0x5a'));_0x5040b4[_0xdd4a('0x51')][_0xdd4a('0x5b')]=_0x5040b4['body'][_0xdd4a('0x5b')]||_0x5040b4[_0xdd4a('0x5c')]['id'];_0x371ca3[_0xdd4a('0x5d')]['id']=_0x5040b4[_0xdd4a('0x51')][_0xdd4a('0x5b')];return db[_0xdd4a('0x48')][_0xdd4a('0x53')]({'where':{'id':_0x5040b4[_0xdd4a('0x4f')]['id'],'UserId':null}})[_0xdd4a('0x49')](handleEntityNotFound(_0x342d4f,null))[_0xdd4a('0x49')](saveUpdates(_0x5040b4[_0xdd4a('0x51')],null))['then'](function(_0x12a3d3){if(_0x12a3d3){_0x371ca3[_0xdd4a('0x22')]=_0x12a3d3[_0xdd4a('0x5e')]({'plain':!![]});return db['SmsInteraction'][_0xdd4a('0x53')]({'where':{'id':_0x12a3d3['SmsInteractionId']}});}return null;})[_0xdd4a('0x49')](handleEntityNotFound(_0x342d4f,null))['then'](function(_0x549933){if(_0x549933){return _0x549933[_0xdd4a('0x2f')]({'UserId':_0x5040b4[_0xdd4a('0x51')]['UserId'],'read1stAt':_[_0xdd4a('0x5f')](_0x549933[_0xdd4a('0x60')])?moment()[_0xdd4a('0x59')](_0xdd4a('0x5a')):undefined});}return null;})[_0xdd4a('0x49')](function(_0x52136f){if(_0x52136f){_0x371ca3['interaction']=_0x52136f[_0xdd4a('0x5e')]({'plain':!![]});interaction_log[_0xdd4a('0x1b')](_0xdd4a('0x61'),_0x5040b4[_0xdd4a('0x5c')]['id'],_0x5040b4[_0xdd4a('0x5c')]['name'],_0x5040b4[_0xdd4a('0x5c')][_0xdd4a('0x62')],_0x371ca3[_0xdd4a('0x63')]['id'],_0x5040b4[_0xdd4a('0x51')]?JSON[_0xdd4a('0x1e')](_0x5040b4['body']):_0xdd4a('0x64'));return respondWithRpcPromise(_0xdd4a('0x65'),_0xdd4a('0x66'),_0x371ca3);}return null;})[_0xdd4a('0x49')](function(_0x17ffb2){var _0x1a96f2='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x17ffb2[_0xdd4a('0x22')]['ContactId'];return db[_0xdd4a('0x67')][_0xdd4a('0x3a')](_0x1a96f2,{'type':db['Sequelize'][_0xdd4a('0x68')][_0xdd4a('0x69')],'raw':!![]})[_0xdd4a('0x49')](function(_0x52ea04){return _0x52ea04;});})[_0xdd4a('0x49')](function(_0x4b5202){if(_0x4b5202){_0x371ca3[_0xdd4a('0x22')][_0xdd4a('0x6a')]=_0x4b5202[0x0];if(!_0x5040b4['body'][_0xdd4a('0x5b')])return;return db[_0xdd4a('0x6b')]['find']({'where':{'id':_0x5040b4[_0xdd4a('0x51')][_0xdd4a('0x5b')],'role':'agent'},'attributes':['id',_0xdd4a('0x32'),'fullname',_0xdd4a('0x6c'),_0xdd4a('0x6d')],'raw':!![]});}return null;})[_0xdd4a('0x49')](function(_0x31ee1e){if(!_0x31ee1e)return null;_0x371ca3[_0xdd4a('0x22')][_0xdd4a('0x5d')]=_0x31ee1e;return _0x371ca3;})[_0xdd4a('0x49')](function(_0x7e6e50){if(_0x7e6e50){if(_0x5040b4['body'][_0xdd4a('0x6e')]){_0x371ca3[_0xdd4a('0x22')][_0xdd4a('0x6f')]=util['format']('SIP/%s',_0x5040b4[_0xdd4a('0x5c')][_0xdd4a('0x32')]);_0x371ca3[_0xdd4a('0x22')]['channel']=_0x371ca3['channel'];_0x371ca3[_0xdd4a('0x22')]['motionChannel']=_0x371ca3[_0xdd4a('0x70')];_0x371ca3[_0xdd4a('0x22')][_0xdd4a('0x71')]=_0xdd4a('0x55');return respondWithRpcPromise(_0xdd4a('0x72'),'EventManager',{'event':_0xdd4a('0x73'),'message':_0x371ca3[_0xdd4a('0x22')]},client9002)['then'](function(){return _0x371ca3;});}return _0x371ca3;}return null;})['then'](respondWithResult(_0x342d4f,null))['catch'](handleError(_0x342d4f,null));};var interaction_log=require(_0xdd4a('0x12'))(_0xdd4a('0x74'));exports[_0xdd4a('0x75')]=function(_0x51d996,_0x2715e0,_0x1a1e12){var _0x23ffe7={'agent':{},'channel':'sms'};if(_0x51d996[_0xdd4a('0x51')]['id']){delete _0x51d996[_0xdd4a('0x51')]['id'];}_0x51d996[_0xdd4a('0x51')][_0xdd4a('0x5b')]=_0x51d996[_0xdd4a('0x51')][_0xdd4a('0x5b')]||_0x51d996['user']['id'];_0x23ffe7['agent']['id']=_0x51d996[_0xdd4a('0x51')][_0xdd4a('0x5b')];return db[_0xdd4a('0x48')][_0xdd4a('0x53')]({'where':{'id':_0x51d996[_0xdd4a('0x4f')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x2715e0,null))[_0xdd4a('0x49')](function(_0xb957be){if(_0xb957be){_0x23ffe7[_0xdd4a('0x22')]=_0xb957be[_0xdd4a('0x5e')]({'plain':!![]});return db[_0xdd4a('0x76')][_0xdd4a('0x53')]({'where':{'id':_0xb957be[_0xdd4a('0x77')]}});}return null;})[_0xdd4a('0x49')](handleEntityNotFound(_0x2715e0,null))[_0xdd4a('0x49')](function(_0x2ece25){if(_0x2ece25){_0x23ffe7[_0xdd4a('0x63')]=_0x2ece25[_0xdd4a('0x5e')]({'plain':!![]});interaction_log['info'](_0xdd4a('0x78'),_0x51d996[_0xdd4a('0x5c')]['id'],_0x51d996[_0xdd4a('0x5c')][_0xdd4a('0x32')],_0x51d996[_0xdd4a('0x5c')][_0xdd4a('0x62')],_0x23ffe7[_0xdd4a('0x63')]['id'],_0x51d996[_0xdd4a('0x51')]?JSON['stringify'](_0x51d996['body']):_0xdd4a('0x64'));return respondWithRpcPromise(_0xdd4a('0x79'),_0xdd4a('0x7a'),_0x23ffe7);}return null;})[_0xdd4a('0x49')](function(_0x1bca5f){var _0x61e573=_0xdd4a('0x7b')+_0x1bca5f['message'][_0xdd4a('0x7c')];return db[_0xdd4a('0x67')][_0xdd4a('0x3a')](_0x61e573,{'type':db[_0xdd4a('0x7d')][_0xdd4a('0x68')]['SELECT'],'raw':!![]})[_0xdd4a('0x49')](function(_0x4a29da){return _0x4a29da;});})[_0xdd4a('0x49')](function(_0x471d4f){if(_0x471d4f){_0x23ffe7[_0xdd4a('0x22')]['contact']=_0x471d4f[0x0];if(!_0x51d996['body']['UserId'])return;return db[_0xdd4a('0x6b')][_0xdd4a('0x53')]({'where':{'id':_0x51d996[_0xdd4a('0x51')]['UserId'],'role':_0xdd4a('0x5d')},'attributes':['id','name',_0xdd4a('0x7e'),'email',_0xdd4a('0x6d')],'raw':!![]});}return null;})[_0xdd4a('0x49')](function(_0x10097f){if(!_0x10097f)return null;_0x23ffe7[_0xdd4a('0x22')][_0xdd4a('0x5d')]=_0x10097f;return _0x23ffe7;})[_0xdd4a('0x49')](function(_0x147732){if(_0x147732){_0x147732[_0xdd4a('0x22')][_0xdd4a('0x6f')]=util[_0xdd4a('0x59')](_0xdd4a('0x7f'),_0x51d996['user']['name']);_0x147732['message'][_0xdd4a('0x70')]=_0x23ffe7[_0xdd4a('0x70')];_0x147732[_0xdd4a('0x22')][_0xdd4a('0x80')]=_0x23ffe7[_0xdd4a('0x70')];_0x147732[_0xdd4a('0x22')]['event']=_0xdd4a('0x75');respondWithRpcPromise(_0xdd4a('0x72'),'EventManager',{'event':_0xdd4a('0x81'),'message':_0x147732[_0xdd4a('0x22')]},client9002);return _0x23ffe7;}return null;})['then'](respondWithResult(_0x2715e0,null))[_0xdd4a('0x52')](handleError(_0x2715e0,null));};exports[_0xdd4a('0x25')]=function(_0x1fba0e,_0x2f86dd,_0x530eab){if(_0x1fba0e[_0xdd4a('0x51')]['id']){delete _0x1fba0e[_0xdd4a('0x51')]['id'];}var _0x326df2;return db[_0xdd4a('0x48')][_0xdd4a('0x53')]({'where':{'id':_0x1fba0e[_0xdd4a('0x4f')]['id']}})[_0xdd4a('0x49')](handleEntityNotFound(_0x2f86dd,null))[_0xdd4a('0x49')](function(_0x5acb5b){if(_0x5acb5b){_0x326df2=_0x5acb5b;return db['SmsAccount'][_0xdd4a('0x53')]({'where':{'id':_0x5acb5b[_0xdd4a('0x82')]}});}})[_0xdd4a('0x49')](handleEntityNotFound(_0x2f86dd,null))[_0xdd4a('0x49')](function(_0x2f5e23){if(_0x2f5e23){logger[_0xdd4a('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xdd4a('0x25'),_0xdd4a('0x83'),_0x2f5e23[_0xdd4a('0x35')],util[_0xdd4a('0x84')](_0x1fba0e[_0xdd4a('0x51')],{'showHidden':![],'depth':null}));switch(_0x2f5e23[_0xdd4a('0x35')]){case _0xdd4a('0x85'):if(_0x1fba0e['body'][_0xdd4a('0x86')]&&_0x1fba0e[_0xdd4a('0x51')][_0xdd4a('0x86')]===_0x326df2[_0xdd4a('0x87')]){return _0x326df2[_0xdd4a('0x2f')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0xdd4a('0x25'),_0xdd4a('0x85'),util[_0xdd4a('0x84')](_0x1fba0e[_0xdd4a('0x51')],{'showHidden':![],'depth':null}));}break;case'plivo':if(_0x1fba0e[_0xdd4a('0x51')][_0xdd4a('0x88')]&&_0x1fba0e[_0xdd4a('0x51')][_0xdd4a('0x88')]===_0x326df2[_0xdd4a('0x87')]&&_['indexOf']([_0xdd4a('0x89'),_0xdd4a('0x8a')],_0x1fba0e[_0xdd4a('0x51')]['Status'])>=0x0){return _0x326df2['update']({'read':!![]});}else{logger[_0xdd4a('0x1f')](_0xdd4a('0x8b'),'status',_0xdd4a('0x8c'),util[_0xdd4a('0x84')](_0x1fba0e[_0xdd4a('0x51')],{'showHidden':![],'depth':null}));}break;case _0xdd4a('0x8d'):var _0x21db59=_0x1fba0e['body'][_0xdd4a('0x8e')][0x0];if(_0x21db59['status'][_0xdd4a('0x8f')]===_0xdd4a('0x90')){return _0x326df2[_0xdd4a('0x2f')]({'read':!![]});}else{logger['error'](_0xdd4a('0x8b'),_0xdd4a('0x25'),_0xdd4a('0x8d'),util[_0xdd4a('0x84')](_0x1fba0e[_0xdd4a('0x51')],{'showHidden':![],'depth':null}));}break;}return _0x326df2;}})[_0xdd4a('0x49')](respondWithResult(_0x2f86dd,null))['catch'](handleError(_0x2f86dd,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 6515bcd..cafdeb8 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 _0xa8aa=['setMaxListeners','update','emit','hasOwnProperty','exports','events','SmsMessage'];(function(_0x3cac51,_0x4ef11b){var _0xcd7854=function(_0x419d56){while(--_0x419d56){_0x3cac51['push'](_0x3cac51['shift']());}};_0xcd7854(++_0x4ef11b);}(_0xa8aa,0x1d3));var _0xaa8a=function(_0x9009df,_0x5d10e4){_0x9009df=_0x9009df-0x0;var _0x3f6eeb=_0xa8aa[_0x9009df];return _0x3f6eeb;};'use strict';var EventEmitter=require(_0xaa8a('0x0'));var SmsMessage=require('../../mysqldb')['db'][_0xaa8a('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xaa8a('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xaa8a('0x3'),'afterDestroy':'remove'};function emitEvent(_0x3f9778){return function(_0x5c22ea,_0x52a466,_0x59fc00){SmsMessageEvents[_0xaa8a('0x4')](_0x3f9778+':'+_0x5c22ea['id'],_0x5c22ea);SmsMessageEvents['emit'](_0x3f9778,_0x5c22ea);_0x59fc00(null);};}for(var e in events){if(events[_0xaa8a('0x5')](e)){var event=events[e];SmsMessage['hook'](e,emitEvent(event));}}module[_0xaa8a('0x6')]=SmsMessageEvents; \ No newline at end of file +var _0xd7a6=['exports','../../mysqldb','setMaxListeners','save','remove','emit','hasOwnProperty','hook'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd7a6,0x1a9));var _0x6d7a=function(_0x113913,_0x2f9301){_0x113913=_0x113913-0x0;var _0x4afad0=_0xd7a6[_0x113913];return _0x4afad0;};'use strict';var EventEmitter=require('events');var SmsMessage=require(_0x6d7a('0x0'))['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x6d7a('0x1')](0x0);var events={'afterCreate':_0x6d7a('0x2'),'afterUpdate':'update','afterDestroy':_0x6d7a('0x3')};function emitEvent(_0x1c8011){return function(_0x281210,_0x37831f,_0x2f353e){SmsMessageEvents[_0x6d7a('0x4')](_0x1c8011+':'+_0x281210['id'],_0x281210);SmsMessageEvents[_0x6d7a('0x4')](_0x1c8011,_0x281210);_0x2f353e(null);};}for(var e in events){if(events[_0x6d7a('0x5')](e)){var event=events[e];SmsMessage[_0x6d7a('0x6')](e,emitEvent(event));}}module[_0x6d7a('0x7')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index 64c7a6d..0ce957a 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 _0x14ff=['text','timestamp','length','md5','digest','hex','signature=','csc','Missing\x20parameters:\x20apiKey','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','clickatell','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','Bearer\x20','status','refid','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','define','sms_messages','messageId','fti_sms_messages','body','models','get','direction','toLowerCase','out','isNil','UserId','SmsInteractionId','SmsInteraction','findOne','then','update','createdAt','catch','error','secret','SmsAccount','find','SmsAccountId','type','twilio','accountSid','authToken','phone','messages','create','remote','/api/sms/messages/','/status?token=','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','https://api.skebby.it/API/v1.0/REST/','smsMethod','login?username=','username','&password=','password','GET','sms','POST','user_key','session_key','total_sent','deliveryReport','skebby','inspect','Missing\x20parameters:\x20username,\x20password','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','connectel','Missing\x20parameters:\x20authToken','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','http_code','data','head','message_id','clickSend','plivo','authId','https://api.plivo.com/v1/Account/%s/Message/','base64','message_uuid','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','read','Missing\x20parameters:\x20base_url','crypto','apiKey','login','sender'];(function(_0x3ec879,_0x16c654){var _0x2dce22=function(_0x17fb2d){while(--_0x17fb2d){_0x3ec879['push'](_0x3ec879['shift']());}};_0x2dce22(++_0x16c654);}(_0x14ff,0x194));var _0xf14f=function(_0x3b86a2,_0x682008){_0x3b86a2=_0x3b86a2-0x0;var _0x3eeca7=_0x14ff[_0x3b86a2];return _0x3eeca7;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xf14f('0x0'))(_0xf14f('0x1'));var moment=require(_0xf14f('0x2'));var BPromise=require('bluebird');var rp=require(_0xf14f('0x3'));var fs=require('fs');var path=require(_0xf14f('0x4'));var rimraf=require(_0xf14f('0x5'));var config=require(_0xf14f('0x6'));var attributes=require('./smsMessage.attributes');module[_0xf14f('0x7')]=function(_0x583403,_0x136ea5){return _0x583403[_0xf14f('0x8')]('SmsMessage',attributes,{'tableName':_0xf14f('0x9'),'paranoid':![],'indexes':[{'name':_0xf14f('0xa'),'fields':['messageId']},{'name':_0xf14f('0xb'),'fields':[_0xf14f('0xc')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5a8602,_0xd69bbb,_0x49daa7){var _0x392f84=_0x583403[_0xf14f('0xd')];var _0xc72b62=_0x5a8602[_0xf14f('0xe')]({'plain':!![]});if(_0xc72b62[_0xf14f('0xf')][_0xf14f('0x10')]()==='in'||_0xc72b62[_0xf14f('0xf')][_0xf14f('0x10')]()===_0xf14f('0x11')&&!_0xc72b62['secret']&&!_[_0xf14f('0x12')](_0xc72b62[_0xf14f('0x13')])&&!_[_0xf14f('0x12')](_0xc72b62[_0xf14f('0x14')])){_0x392f84[_0xf14f('0x15')][_0xf14f('0x16')]({'where':{'id':_0xc72b62[_0xf14f('0x14')]}})[_0xf14f('0x17')](function(_0x46ba58){if(_0x46ba58){_0x46ba58[_0xf14f('0x18')]({'lastMsgAt':_0xc72b62[_0xf14f('0x19')],'lastMsgDirection':_0xc72b62[_0xf14f('0xf')][_0xf14f('0x10')]()});}})[_0xf14f('0x1a')](function(_0x436156){console[_0xf14f('0x1b')](_0x436156);});}if(_0xc72b62[_0xf14f('0xf')]===_0xf14f('0x11')&&!_0xc72b62[_0xf14f('0x1c')]){var _0x36fb49;_0x392f84[_0xf14f('0x1d')][_0xf14f('0x1e')]({'where':{'id':_0xc72b62[_0xf14f('0x1f')]},'raw':!![]})[_0xf14f('0x17')](function(_0x205bf5){_0x36fb49=_0x205bf5;if(_0x36fb49&&_0x36fb49[_0xf14f('0x20')]){switch(_0x36fb49['type']){case _0xf14f('0x21'):var _0x4daca2=require(_0xf14f('0x21'));if(_0x36fb49[_0xf14f('0x22')]&&_0x36fb49[_0xf14f('0x23')]&&_0x36fb49[_0xf14f('0x24')]){var _0x29c191=new _0x4daca2(_0x36fb49[_0xf14f('0x22')],_0x36fb49[_0xf14f('0x23')]);_0x29c191[_0xf14f('0x25')][_0xf14f('0x26')]({'body':_0xc72b62[_0xf14f('0xc')],'to':_0xc72b62['phone'],'from':_0x36fb49[_0xf14f('0x24')],'statusCallback':_0x36fb49[_0xf14f('0x27')]+_0xf14f('0x28')+_0xc72b62['id']+_0xf14f('0x29')+_0x36fb49[_0xf14f('0x2a')]})[_0xf14f('0x17')](function(_0x277d06){if(_0x277d06[_0xf14f('0x2b')]){return _0x5a8602[_0xf14f('0x18')]({'messageId':_0x277d06[_0xf14f('0x2b')]});}})[_0xf14f('0x1a')](function(_0x51e3e7){logger['error'](_0xf14f('0x2c'),_0xf14f('0x2d'),'twilio',util['inspect'](_0x51e3e7,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xf14f('0x2c'),_0xf14f('0x2d'),'twilio',_0xf14f('0x2e'));}break;case'skebby':var _0x4d5152=_0xf14f('0x2f');if(_0x36fb49['username']&&_0x36fb49['password']){var _0x86ec49={'recipient':[_0xc72b62[_0xf14f('0x24')]],'message':_0xc72b62['body'],'message_type':_0x36fb49[_0xf14f('0x30')]};if(_0x36fb49['smsMethod']&&_0x36fb49[_0xf14f('0x30')]!=='SI'){_0x86ec49['sender']=_0x36fb49[_0xf14f('0x24')];}var _0x499bed={'url':_0x4d5152+_0xf14f('0x31')+_0x36fb49[_0xf14f('0x32')]+_0xf14f('0x33')+_0x36fb49[_0xf14f('0x34')],'method':_0xf14f('0x35')};rp(_0x499bed)[_0xf14f('0x17')](function(_0x4a6dbc){var _0x3002e7=_0x4a6dbc['split'](';');var _0x2d3344={'user_key':_0x3002e7[0x0],'session_key':_0x3002e7[0x1]};_0x499bed={'url':_0x4d5152+_0xf14f('0x36'),'method':_0xf14f('0x37'),'headers':{'user_key':_0x2d3344[_0xf14f('0x38')],'Session_key':_0x2d3344[_0xf14f('0x39')]},'json':!![],'body':_0x86ec49};return rp(_0x499bed);})[_0xf14f('0x17')](function(_0x1b63b6){if(_0x1b63b6[_0xf14f('0x3a')]>=0x1){var _0x390f38={'messageId':_0x1b63b6['internal_order_id']};if(_0x36fb49['smsMethod']!=='GP'||!_0x36fb49[_0xf14f('0x3b')]){_0x390f38['read']=!![];}return _0x5a8602[_0xf14f('0x18')](_0x390f38);}else{return logger[_0xf14f('0x1b')](_0xf14f('0x2c'),_0xf14f('0x2d'),_0xf14f('0x3c'),util['inspect'](_0x1b63b6,{'showHidden':![],'depth':null}));}})['catch'](function(_0x5b8648){return logger[_0xf14f('0x1b')](_0xf14f('0x2c'),_0xf14f('0x2d'),_0xf14f('0x3c'),util[_0xf14f('0x3d')](_0x5b8648,{'showHidden':![],'depth':null}));});}else{logger[_0xf14f('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf14f('0x2d'),_0xf14f('0x3c'),_0xf14f('0x3e'));}break;case'connectel':if(_0x36fb49['authToken']){var _0x2273c6={'recipient':_0xc72b62[_0xf14f('0x24')],'message':_0xc72b62[_0xf14f('0xc')],'sender':_0x36fb49[_0xf14f('0x3f')]||_0x36fb49[_0xf14f('0x24')],'authorization':_0x36fb49['authToken']};var _0xd69bbb={'method':'POST','uri':_0xf14f('0x40'),'body':_0x2273c6,'json':!![]};rp(_0xd69bbb)['then'](function(_0xfdd5e6){var _0x5e3e0c={'messageId':_0xfdd5e6[_0xf14f('0x41')]};if(!_0x36fb49[_0xf14f('0x3b')]){_0x5e3e0c['read']=!![];}return _0x5a8602['update'](_0x5e3e0c);})[_0xf14f('0x1a')](function(_0x48afa2){logger['error'](_0xf14f('0x2c'),_0xf14f('0x2d'),_0xf14f('0x42'),util[_0xf14f('0x3d')](_0x48afa2,{'showHidden':![],'depth':null}));});}else{logger[_0xf14f('0x1b')](_0xf14f('0x2c'),_0xf14f('0x2d'),'connectel',_0xf14f('0x43'));}break;case'clicksend':if(_0x36fb49['username']&&_0x36fb49[_0xf14f('0x34')]){var _0x2273c6={'messages':[{'source':_0xf14f('0x44'),'to':_0xc72b62['phone'],'body':_0xc72b62[_0xf14f('0xc')],'from':_0x36fb49['senderString']||_0x36fb49[_0xf14f('0x24')]}]};var _0x387e3a=util[_0xf14f('0x45')](_0xf14f('0x46'),_0x36fb49['username'],_0x36fb49['password']);var _0xd69bbb={'method':_0xf14f('0x37'),'uri':_0xf14f('0x47'),'body':_0x2273c6,'headers':{'Authorization':util[_0xf14f('0x45')](_0xf14f('0x48'),new Buffer(_0x387e3a)[_0xf14f('0x49')]('base64'))},'json':!![]};rp(_0xd69bbb)['then'](function(_0x26f7a7){if(_0x26f7a7[_0xf14f('0x4a')]>=0xc8&&_0x26f7a7['http_code']<=0xce){if(_0x26f7a7[_0xf14f('0x4b')]&&_0x26f7a7[_0xf14f('0x4b')]['queued_count']>0x0){var _0xb24c82=_[_0xf14f('0x4c')](_0x26f7a7[_0xf14f('0x4b')][_0xf14f('0x25')]);var _0x581e31={'messageId':_0xb24c82[_0xf14f('0x4d')]};if(!_0x36fb49[_0xf14f('0x3b')]){_0x581e31['read']=!![];}return _0x5a8602[_0xf14f('0x18')](_0x581e31);}else{logger['error'](_0xf14f('0x2c'),_0xf14f('0x2d'),_0xf14f('0x4e'),util[_0xf14f('0x3d')](_0x26f7a7,{'showHidden':![],'depth':null}));}}else{logger[_0xf14f('0x1b')](_0xf14f('0x2c'),'afterCreate',_0xf14f('0x4e'),util[_0xf14f('0x3d')](_0x26f7a7,{'showHidden':![],'depth':null}));}})[_0xf14f('0x1a')](function(_0x251d34){logger['error'](_0xf14f('0x2c'),_0xf14f('0x2d'),'clickSend',util[_0xf14f('0x3d')](_0x251d34,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xf14f('0x2c'),_0xf14f('0x2d'),_0xf14f('0x4e'),_0xf14f('0x3e'));}break;case _0xf14f('0x4f'):if(_0x36fb49[_0xf14f('0x50')]&&_0x36fb49[_0xf14f('0x23')]){var _0x2273c6={'dst':_0xc72b62[_0xf14f('0x24')],'text':_0xc72b62[_0xf14f('0xc')],'src':_0x36fb49[_0xf14f('0x3f')]||_0x36fb49[_0xf14f('0x24')],'url':_0x36fb49[_0xf14f('0x27')]+'/api/sms/messages/'+_0xc72b62['id']+_0xf14f('0x29')+_0x36fb49[_0xf14f('0x2a')]};var _0x387e3a=util['format'](_0xf14f('0x46'),_0x36fb49[_0xf14f('0x50')],_0x36fb49['authToken']);var _0xd69bbb={'method':_0xf14f('0x37'),'uri':util['format'](_0xf14f('0x51'),_0x36fb49[_0xf14f('0x50')]),'body':_0x2273c6,'headers':{'Authorization':util[_0xf14f('0x45')]('Basic\x20%s',new Buffer(_0x387e3a)[_0xf14f('0x49')](_0xf14f('0x52')))},'json':!![]};rp(_0xd69bbb)[_0xf14f('0x17')](function(_0x3521f7){var _0xf09c5b={'messageId':_0x3521f7[_0xf14f('0x53')][0x0]};return _0x5a8602[_0xf14f('0x18')](_0xf09c5b);})['catch'](function(_0xce18cb){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xf14f('0x4f'),util[_0xf14f('0x3d')](_0xce18cb,{'showHidden':![],'depth':null}));});}else{logger[_0xf14f('0x1b')](_0xf14f('0x2c'),_0xf14f('0x2d'),_0xf14f('0x4f'),'Missing\x20parameters:\x20authId,\x20authToken');}break;case _0xf14f('0x54'):if(_0x36fb49['username']&&_0x36fb49[_0xf14f('0x34')]){if(_0x36fb49['baseUrl']){var _0xdf65e7={'method':_0xf14f('0x37'),'uri':_0x36fb49[_0xf14f('0x55')]+_0xf14f('0x56'),'body':{'username':_0x36fb49[_0xf14f('0x32')],'password':_0x36fb49[_0xf14f('0x34')]},'json':!![]};return rp(_0xdf65e7)[_0xf14f('0x17')](function(_0x197c17){var _0x4e41d9={'method':_0xf14f('0x37'),'uri':_0x36fb49[_0xf14f('0x55')]+_0xf14f('0x57'),'body':{'messages':[{'from':_0x36fb49[_0xf14f('0x24')],'destinations':[{'to':_0xc72b62[_0xf14f('0x24')]}],'text':_0xc72b62['body'],'notifyUrl':_0x36fb49['remote']+_0xf14f('0x28')+_0xc72b62['id']+_0xf14f('0x29')+_0x36fb49['token'],'notifyContentType':_0xf14f('0x58'),'callbackData':_0x36fb49[_0xf14f('0x24')]+';'+_0xc72b62[_0xf14f('0xc')]}]},'headers':{'Authorization':_0xf14f('0x59')+_0x197c17[_0xf14f('0x2a')]},'json':!![]};return rp(_0x4e41d9)[_0xf14f('0x17')](function(_0x1bc49c){if(_0x1bc49c['messages']){var _0x573126={'messageId':_0x1bc49c[_0xf14f('0x25')][0x0]['messageId']};if(!_0x36fb49[_0xf14f('0x3b')]){_0x573126[_0xf14f('0x5a')]=!![];}return _0x5a8602['update'](_0x573126);}else{return logger[_0xf14f('0x1b')](_0xf14f('0x2c'),_0xf14f('0x2d'),'infobip',util['inspect'](_0x1bc49c,{'showHidden':![],'depth':null}));}});})[_0xf14f('0x1a')](function(_0x2ece29){return logger[_0xf14f('0x1b')](_0xf14f('0x2c'),_0xf14f('0x2d'),_0xf14f('0x54'),util[_0xf14f('0x3d')](_0x2ece29,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xf14f('0x2c'),_0xf14f('0x2d'),_0xf14f('0x54'),_0xf14f('0x5b'));}}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf14f('0x2d'),_0xf14f('0x54'),_0xf14f('0x3e'));}break;case'csc':var _0x4f3ac5=require(_0xf14f('0x5c'));if(_0x36fb49[_0xf14f('0x5d')]){var _0x3180a4={};_0x3180a4[_0xf14f('0x5e')]=_0x36fb49[_0xf14f('0x32')];_0x3180a4[_0xf14f('0x24')]=_0xc72b62[_0xf14f('0x24')];_0x3180a4[_0xf14f('0x5f')]=_0x36fb49['phone'];_0x3180a4[_0xf14f('0x60')]=_0xc72b62[_0xf14f('0xc')];_0x3180a4[_0xf14f('0x61')]=+new Date();var _0x4f331c='';var _0x59ece8='';var _0x3a0f04=Object['keys'](_0x3180a4);_0x3a0f04['sort']();for(var _0x82a10e=0x0;_0x82a10e<_0x3a0f04[_0xf14f('0x62')];_0x82a10e++){if(_0x4f331c!=''){_0x4f331c+='&';}_0x4f331c+=_0x3a0f04[_0x82a10e]+'='+encodeURIComponent(_0x3180a4[_0x3a0f04[_0x82a10e]]);_0x59ece8+=_0x3180a4[_0x3a0f04[_0x82a10e]];}_0x59ece8+=_0x36fb49[_0xf14f('0x5d')];_0x59ece8=_0x4f3ac5['createHash'](_0xf14f('0x63'))['update'](_0x59ece8)[_0xf14f('0x64')](_0xf14f('0x65'));if(_0x4f331c!==''){_0x4f331c+='&';}_0x4f331c+=_0xf14f('0x66')+_0x59ece8;var _0x499bed={'method':'GET','uri':_0x36fb49[_0xf14f('0x55')]+'/external/get/send.php?'+_0x4f331c,'json':!![]};return rp(_0x499bed)[_0xf14f('0x17')](function(_0x211c9f){var _0x593845=Object['keys'](_0x211c9f);if(_0x211c9f[_0x593845[0x0]][_0xf14f('0x1b')]&&parseInt(_0x211c9f[_0x593845[0x0]][_0xf14f('0x1b')])===0x0){var _0x431d8b={'messageId':_0x211c9f[_0x593845[0x0]]['id_sms']};if(!_0x36fb49['deliveryReport']){_0x431d8b[_0xf14f('0x5a')]=!![];}return _0x5a8602[_0xf14f('0x18')](_0x431d8b);}else{return logger[_0xf14f('0x1b')](_0xf14f('0x2c'),_0xf14f('0x2d'),'csc',util['inspect'](_0x211c9f[_0xf14f('0x1b')],{'showHidden':![],'depth':null}));}})[_0xf14f('0x1a')](function(_0x58ac77){return logger[_0xf14f('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf14f('0x2d'),'csc',util[_0xf14f('0x3d')](_0x58ac77,{'showHidden':![],'depth':null}));});}else{logger[_0xf14f('0x1b')](_0xf14f('0x2c'),_0xf14f('0x2d'),_0xf14f('0x67'),_0xf14f('0x68'));}break;case'clickatell':if(_0x36fb49['apiKey']){var _0x34b204={'method':_0xf14f('0x37'),'uri':_0xf14f('0x69'),'headers':{'Authorization':_0x36fb49['apiKey']},'body':{'content':_0xc72b62[_0xf14f('0xc')],'to':[_0xc72b62['phone']],'from':_0x36fb49[_0xf14f('0x24')],'binary':![],'clientMessageId':_0xf14f('0x6a'),'charset':_0xf14f('0x6b')},'json':!![]};rp(_0x34b204)['then'](function(_0x76e426){if(!_0x76e426['error']){var _0x535644={'messageId':_0x76e426[_0xf14f('0x25')][0x0][_0xf14f('0x6c')]};if(!_0x36fb49[_0xf14f('0x3b')]){_0x535644[_0xf14f('0x5a')]=!![];}return _0x5a8602[_0xf14f('0x18')](_0x535644);}else{return logger[_0xf14f('0x1b')](_0xf14f('0x2c'),_0xf14f('0x2d'),_0xf14f('0x6d'),util[_0xf14f('0x3d')](_0x76e426[_0xf14f('0x1b')],{'showHidden':![],'depth':null}));}})[_0xf14f('0x1a')](function(_0x6e5251){return logger[_0xf14f('0x1b')](_0xf14f('0x2c'),_0xf14f('0x2d'),_0xf14f('0x6d'),util[_0xf14f('0x3d')](_0x6e5251,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xf14f('0x2c'),_0xf14f('0x2d'),'clickatell',_0xf14f('0x68'));}break;case _0xf14f('0x6e'):if(_0x36fb49['username']&&_0x36fb49[_0xf14f('0x34')]){var _0x387e3a=util['format']('%s:%s',_0x36fb49[_0xf14f('0x32')],_0x36fb49['password']);var _0xd69bbb={'method':_0xf14f('0x37'),'uri':_0xf14f('0x6f')+_0x36fb49[_0xf14f('0x70')]+_0xf14f('0x71'),'body':{'to':[_0xc72b62['phone']],'text':_0xc72b62[_0xf14f('0xc')],'from':_0x36fb49['phone'],'applicationId':_0x36fb49['applicationId']},'headers':{'Authorization':util[_0xf14f('0x45')](_0xf14f('0x48'),new Buffer(_0x387e3a)[_0xf14f('0x49')]('base64'))},'json':!![]};rp(_0xd69bbb)['then'](function(_0xf83754){if(_0xf83754['id']){var _0x5658d2={'messageId':_0xf83754['id']};return _0x5a8602[_0xf14f('0x18')](_0x5658d2);}else{logger['error'](_0xf14f('0x2c'),'afterCreate',_0xf14f('0x6e'),util[_0xf14f('0x3d')](_0xf83754,{'showHidden':![],'depth':null}));}})[_0xf14f('0x1a')](function(_0x12a952){logger['error'](_0xf14f('0x2c'),_0xf14f('0x2d'),_0xf14f('0x6e'),util[_0xf14f('0x3d')](_0x12a952,{'showHidden':![],'depth':null}));});}else{logger[_0xf14f('0x1b')](_0xf14f('0x2c'),_0xf14f('0x2d'),_0xf14f('0x6e'),_0xf14f('0x3e'));}break;case _0xf14f('0x72'):if(_0x36fb49[_0xf14f('0x5d')]){var _0x47318c={};var _0x499bed={'method':_0xf14f('0x37'),'uri':_0xf14f('0x73'),'headers':{'Authorization':'Bearer\x20'+_0x36fb49[_0xf14f('0x5d')],'Content-Type':_0xf14f('0x58')},'body':{'from':_0x36fb49[_0xf14f('0x24')],'to':_0xc72b62[_0xf14f('0x24')],'text':_0xc72b62[_0xf14f('0xc')]},'json':!![]};return rp(_0x499bed)['then'](function(_0x1ecb54){if(_0x1ecb54['code']==0xca){_0x47318c[_0xf14f('0x74')]=_0x1ecb54;var _0x5e88d1={'method':_0xf14f('0x37'),'uri':_0xf14f('0x75'),'headers':{'Authorization':_0xf14f('0x76')+_0x36fb49[_0xf14f('0x5d')],'Content-Type':_0xf14f('0x58')},'body':{'refid':_0x47318c[_0xf14f('0x74')]['refid']},'json':!![]};return rp(_0x5e88d1)['then'](function(_0x55a1e9){_0x47318c[_0xf14f('0x77')]=_0x55a1e9;var _0x269594={'messageId':_0x47318c[_0xf14f('0x74')][_0xf14f('0x78')],'read':!![]};return _0x5a8602[_0xf14f('0x18')](_0x269594);});}else{return logger[_0xf14f('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf14f('0x2d'),_0xf14f('0x72'),util[_0xf14f('0x3d')](_0x1ecb54,{'showHidden':![],'depth':null}));}})[_0xf14f('0x1a')](function(_0x2e682){return logger[_0xf14f('0x1b')](_0xf14f('0x2c'),_0xf14f('0x2d'),_0xf14f('0x72'),util[_0xf14f('0x3d')](_0x2e682,{'showHidden':![],'depth':null}));});}else{return logger[_0xf14f('0x1b')](_0xf14f('0x2c'),_0xf14f('0x2d'),_0xf14f('0x72'),_0xf14f('0x79'));}break;}}})[_0xf14f('0x7a')](function(){_0x49daa7();});}else{_0x49daa7();}}},'charset':_0xf14f('0x7b'),'collate':_0xf14f('0x7c')});}; \ No newline at end of file +var _0xa00d=['get','direction','toLowerCase','secret','UserId','SmsInteractionId','SmsInteraction','then','createdAt','error','SmsAccount','SmsAccountId','type','twilio','authToken','phone','accountSid','create','remote','/api/sms/messages/','/status?token=','token','sid','update','catch','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','login?username=','&password=','GET','split','sms','POST','total_sent','internal_order_id','deliveryReport','read','skebby','inspect','connectel','senderString','requestid','Missing\x20parameters:\x20authToken','xCALLY\x20Motion','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','base64','http_code','data','queued_count','head','message_id','clickSend','Missing\x20parameters:\x20username,\x20password','plivo','authId','format','https://api.plivo.com/v1/Account/%s/Message/','toString','message_uuid','infobip','baseUrl','/auth/1/session','application/json','IBSSO\x20','messages','Missing\x20parameters:\x20base_url','csc','crypto','login','text','timestamp','keys','sort','apiKey','md5','digest','hex','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','https://platform.clickatell.com/messages','uuid','apiMessageId','clickatell','bandwidth','accountId','/messages','applicationId','intelepeer','Bearer\x20','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsMessage.attributes','exports','SmsMessage','messageId','body','models'];(function(_0x367995,_0x129ae2){var _0x22daa8=function(_0x4a2ceb){while(--_0x4a2ceb){_0x367995['push'](_0x367995['shift']());}};_0x22daa8(++_0x129ae2);}(_0xa00d,0xe5));var _0xda00=function(_0x143d8a,_0x51a218){_0x143d8a=_0x143d8a-0x0;var _0x4b7474=_0xa00d[_0x143d8a];return _0x4b7474;};'use strict';var _=require(_0xda00('0x0'));var util=require(_0xda00('0x1'));var logger=require(_0xda00('0x2'))(_0xda00('0x3'));var moment=require(_0xda00('0x4'));var BPromise=require(_0xda00('0x5'));var rp=require(_0xda00('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xda00('0x7'));var config=require(_0xda00('0x8'));var attributes=require(_0xda00('0x9'));module[_0xda00('0xa')]=function(_0x1ab1e9,_0x551aa1){return _0x1ab1e9['define'](_0xda00('0xb'),attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':_0xda00('0xc'),'fields':['messageId']},{'name':'fti_sms_messages','fields':[_0xda00('0xd')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x465e72,_0x2cd58f,_0x234581){var _0x436629=_0x1ab1e9[_0xda00('0xe')];var _0x369597=_0x465e72[_0xda00('0xf')]({'plain':!![]});if(_0x369597[_0xda00('0x10')][_0xda00('0x11')]()==='in'||_0x369597[_0xda00('0x10')][_0xda00('0x11')]()==='out'&&!_0x369597[_0xda00('0x12')]&&!_['isNil'](_0x369597[_0xda00('0x13')])&&!_['isNil'](_0x369597[_0xda00('0x14')])){_0x436629[_0xda00('0x15')]['findOne']({'where':{'id':_0x369597['SmsInteractionId']}})[_0xda00('0x16')](function(_0x4cdeab){if(_0x4cdeab){_0x4cdeab['update']({'lastMsgAt':_0x369597[_0xda00('0x17')],'lastMsgDirection':_0x369597[_0xda00('0x10')][_0xda00('0x11')]()});}})['catch'](function(_0x350749){console[_0xda00('0x18')](_0x350749);});}if(_0x369597[_0xda00('0x10')]==='out'&&!_0x369597[_0xda00('0x12')]){var _0x3917f8;_0x436629[_0xda00('0x19')]['find']({'where':{'id':_0x369597[_0xda00('0x1a')]},'raw':!![]})[_0xda00('0x16')](function(_0xef0c09){_0x3917f8=_0xef0c09;if(_0x3917f8&&_0x3917f8['type']){switch(_0x3917f8[_0xda00('0x1b')]){case _0xda00('0x1c'):var _0x4b7ff9=require(_0xda00('0x1c'));if(_0x3917f8['accountSid']&&_0x3917f8[_0xda00('0x1d')]&&_0x3917f8[_0xda00('0x1e')]){var _0xcdecfa=new _0x4b7ff9(_0x3917f8[_0xda00('0x1f')],_0x3917f8[_0xda00('0x1d')]);_0xcdecfa['messages'][_0xda00('0x20')]({'body':_0x369597[_0xda00('0xd')],'to':_0x369597['phone'],'from':_0x3917f8['phone'],'statusCallback':_0x3917f8[_0xda00('0x21')]+_0xda00('0x22')+_0x369597['id']+_0xda00('0x23')+_0x3917f8[_0xda00('0x24')]})[_0xda00('0x16')](function(_0x72ef7f){if(_0x72ef7f[_0xda00('0x25')]){return _0x465e72[_0xda00('0x26')]({'messageId':_0x72ef7f[_0xda00('0x25')]});}})[_0xda00('0x27')](function(_0x2749ee){logger[_0xda00('0x18')](_0xda00('0x28'),_0xda00('0x29'),_0xda00('0x1c'),util['inspect'](_0x2749ee,{'showHidden':![],'depth':null}));});}else{logger[_0xda00('0x18')](_0xda00('0x28'),_0xda00('0x29'),'twilio',_0xda00('0x2a'));}break;case'skebby':var _0x459d87=_0xda00('0x2b');if(_0x3917f8[_0xda00('0x2c')]&&_0x3917f8[_0xda00('0x2d')]){var _0x168c82={'recipient':[_0x369597[_0xda00('0x1e')]],'message':_0x369597[_0xda00('0xd')],'message_type':_0x3917f8[_0xda00('0x2e')]};if(_0x3917f8['smsMethod']&&_0x3917f8[_0xda00('0x2e')]!=='SI'){_0x168c82[_0xda00('0x2f')]=_0x3917f8[_0xda00('0x1e')];}var _0x4c5c83={'url':_0x459d87+_0xda00('0x30')+_0x3917f8['username']+_0xda00('0x31')+_0x3917f8[_0xda00('0x2d')],'method':_0xda00('0x32')};rp(_0x4c5c83)['then'](function(_0x5444fa){var _0x2fd4a6=_0x5444fa[_0xda00('0x33')](';');var _0x51ce03={'user_key':_0x2fd4a6[0x0],'session_key':_0x2fd4a6[0x1]};_0x4c5c83={'url':_0x459d87+_0xda00('0x34'),'method':_0xda00('0x35'),'headers':{'user_key':_0x51ce03['user_key'],'Session_key':_0x51ce03['session_key']},'json':!![],'body':_0x168c82};return rp(_0x4c5c83);})[_0xda00('0x16')](function(_0x2d8ce6){if(_0x2d8ce6[_0xda00('0x36')]>=0x1){var _0x39b3f7={'messageId':_0x2d8ce6[_0xda00('0x37')]};if(_0x3917f8['smsMethod']!=='GP'||!_0x3917f8[_0xda00('0x38')]){_0x39b3f7[_0xda00('0x39')]=!![];}return _0x465e72[_0xda00('0x26')](_0x39b3f7);}else{return logger[_0xda00('0x18')](_0xda00('0x28'),'afterCreate',_0xda00('0x3a'),util[_0xda00('0x3b')](_0x2d8ce6,{'showHidden':![],'depth':null}));}})[_0xda00('0x27')](function(_0x22982f){return logger[_0xda00('0x18')](_0xda00('0x28'),_0xda00('0x29'),_0xda00('0x3a'),util[_0xda00('0x3b')](_0x22982f,{'showHidden':![],'depth':null}));});}else{logger[_0xda00('0x18')](_0xda00('0x28'),'afterCreate','skebby','Missing\x20parameters:\x20username,\x20password');}break;case _0xda00('0x3c'):if(_0x3917f8[_0xda00('0x1d')]){var _0x37fcd2={'recipient':_0x369597[_0xda00('0x1e')],'message':_0x369597[_0xda00('0xd')],'sender':_0x3917f8[_0xda00('0x3d')]||_0x3917f8[_0xda00('0x1e')],'authorization':_0x3917f8['authToken']};var _0x2cd58f={'method':'POST','uri':'https://smsapi.connectel.se/api/v2/send/','body':_0x37fcd2,'json':!![]};rp(_0x2cd58f)[_0xda00('0x16')](function(_0x20e417){var _0x555e96={'messageId':_0x20e417[_0xda00('0x3e')]};if(!_0x3917f8['deliveryReport']){_0x555e96['read']=!![];}return _0x465e72[_0xda00('0x26')](_0x555e96);})[_0xda00('0x27')](function(_0x12abfd){logger['error'](_0xda00('0x28'),'afterCreate',_0xda00('0x3c'),util[_0xda00('0x3b')](_0x12abfd,{'showHidden':![],'depth':null}));});}else{logger[_0xda00('0x18')](_0xda00('0x28'),_0xda00('0x29'),_0xda00('0x3c'),_0xda00('0x3f'));}break;case'clicksend':if(_0x3917f8[_0xda00('0x2c')]&&_0x3917f8[_0xda00('0x2d')]){var _0x37fcd2={'messages':[{'source':_0xda00('0x40'),'to':_0x369597[_0xda00('0x1e')],'body':_0x369597[_0xda00('0xd')],'from':_0x3917f8[_0xda00('0x3d')]||_0x3917f8[_0xda00('0x1e')]}]};var _0x50de6a=util['format'](_0xda00('0x41'),_0x3917f8[_0xda00('0x2c')],_0x3917f8[_0xda00('0x2d')]);var _0x2cd58f={'method':_0xda00('0x35'),'uri':_0xda00('0x42'),'body':_0x37fcd2,'headers':{'Authorization':util['format'](_0xda00('0x43'),new Buffer(_0x50de6a)['toString'](_0xda00('0x44')))},'json':!![]};rp(_0x2cd58f)['then'](function(_0x4d6653){if(_0x4d6653[_0xda00('0x45')]>=0xc8&&_0x4d6653[_0xda00('0x45')]<=0xce){if(_0x4d6653[_0xda00('0x46')]&&_0x4d6653[_0xda00('0x46')][_0xda00('0x47')]>0x0){var _0x2695c6=_[_0xda00('0x48')](_0x4d6653[_0xda00('0x46')]['messages']);var _0x2a3e33={'messageId':_0x2695c6[_0xda00('0x49')]};if(!_0x3917f8[_0xda00('0x38')]){_0x2a3e33['read']=!![];}return _0x465e72['update'](_0x2a3e33);}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xda00('0x29'),'clickSend',util[_0xda00('0x3b')](_0x4d6653,{'showHidden':![],'depth':null}));}}else{logger['error'](_0xda00('0x28'),_0xda00('0x29'),_0xda00('0x4a'),util[_0xda00('0x3b')](_0x4d6653,{'showHidden':![],'depth':null}));}})[_0xda00('0x27')](function(_0x4d3d93){logger['error'](_0xda00('0x28'),_0xda00('0x29'),_0xda00('0x4a'),util[_0xda00('0x3b')](_0x4d3d93,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xda00('0x28'),'afterCreate',_0xda00('0x4a'),_0xda00('0x4b'));}break;case _0xda00('0x4c'):if(_0x3917f8[_0xda00('0x4d')]&&_0x3917f8['authToken']){var _0x37fcd2={'dst':_0x369597[_0xda00('0x1e')],'text':_0x369597[_0xda00('0xd')],'src':_0x3917f8[_0xda00('0x3d')]||_0x3917f8[_0xda00('0x1e')],'url':_0x3917f8['remote']+_0xda00('0x22')+_0x369597['id']+_0xda00('0x23')+_0x3917f8['token']};var _0x50de6a=util[_0xda00('0x4e')](_0xda00('0x41'),_0x3917f8[_0xda00('0x4d')],_0x3917f8[_0xda00('0x1d')]);var _0x2cd58f={'method':_0xda00('0x35'),'uri':util[_0xda00('0x4e')](_0xda00('0x4f'),_0x3917f8[_0xda00('0x4d')]),'body':_0x37fcd2,'headers':{'Authorization':util[_0xda00('0x4e')](_0xda00('0x43'),new Buffer(_0x50de6a)[_0xda00('0x50')]('base64'))},'json':!![]};rp(_0x2cd58f)[_0xda00('0x16')](function(_0x37f101){var _0x104ea7={'messageId':_0x37f101[_0xda00('0x51')][0x0]};return _0x465e72['update'](_0x104ea7);})[_0xda00('0x27')](function(_0x17311a){logger[_0xda00('0x18')](_0xda00('0x28'),_0xda00('0x29'),_0xda00('0x4c'),util[_0xda00('0x3b')](_0x17311a,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xda00('0x29'),'plivo','Missing\x20parameters:\x20authId,\x20authToken');}break;case _0xda00('0x52'):if(_0x3917f8[_0xda00('0x2c')]&&_0x3917f8[_0xda00('0x2d')]){if(_0x3917f8['baseUrl']){var _0x5a40bf={'method':_0xda00('0x35'),'uri':_0x3917f8[_0xda00('0x53')]+_0xda00('0x54'),'body':{'username':_0x3917f8[_0xda00('0x2c')],'password':_0x3917f8[_0xda00('0x2d')]},'json':!![]};return rp(_0x5a40bf)[_0xda00('0x16')](function(_0x469297){var _0x3d8048={'method':_0xda00('0x35'),'uri':_0x3917f8[_0xda00('0x53')]+'/sms/2/text/advanced','body':{'messages':[{'from':_0x3917f8[_0xda00('0x1e')],'destinations':[{'to':_0x369597[_0xda00('0x1e')]}],'text':_0x369597['body'],'notifyUrl':_0x3917f8[_0xda00('0x21')]+_0xda00('0x22')+_0x369597['id']+'/status?token='+_0x3917f8['token'],'notifyContentType':_0xda00('0x55'),'callbackData':_0x3917f8[_0xda00('0x1e')]+';'+_0x369597[_0xda00('0xd')]}]},'headers':{'Authorization':_0xda00('0x56')+_0x469297['token']},'json':!![]};return rp(_0x3d8048)[_0xda00('0x16')](function(_0x3fa73f){if(_0x3fa73f[_0xda00('0x57')]){var _0x3bd877={'messageId':_0x3fa73f['messages'][0x0][_0xda00('0xc')]};if(!_0x3917f8[_0xda00('0x38')]){_0x3bd877['read']=!![];}return _0x465e72[_0xda00('0x26')](_0x3bd877);}else{return logger[_0xda00('0x18')](_0xda00('0x28'),_0xda00('0x29'),_0xda00('0x52'),util[_0xda00('0x3b')](_0x3fa73f,{'showHidden':![],'depth':null}));}});})[_0xda00('0x27')](function(_0x1adfa1){return logger[_0xda00('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xda00('0x29'),_0xda00('0x52'),util['inspect'](_0x1adfa1,{'showHidden':![],'depth':null}));});}else{logger[_0xda00('0x18')](_0xda00('0x28'),_0xda00('0x29'),_0xda00('0x52'),_0xda00('0x58'));}}else{logger[_0xda00('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xda00('0x29'),_0xda00('0x52'),'Missing\x20parameters:\x20username,\x20password');}break;case _0xda00('0x59'):var _0xe280f2=require(_0xda00('0x5a'));if(_0x3917f8['apiKey']){var _0x31c627={};_0x31c627[_0xda00('0x5b')]=_0x3917f8[_0xda00('0x2c')];_0x31c627[_0xda00('0x1e')]=_0x369597[_0xda00('0x1e')];_0x31c627[_0xda00('0x2f')]=_0x3917f8[_0xda00('0x1e')];_0x31c627[_0xda00('0x5c')]=_0x369597[_0xda00('0xd')];_0x31c627[_0xda00('0x5d')]=+new Date();var _0x8306c9='';var _0x2d73e2='';var _0x146fb6=Object[_0xda00('0x5e')](_0x31c627);_0x146fb6[_0xda00('0x5f')]();for(var _0x5b711e=0x0;_0x5b711e<_0x146fb6['length'];_0x5b711e++){if(_0x8306c9!=''){_0x8306c9+='&';}_0x8306c9+=_0x146fb6[_0x5b711e]+'='+encodeURIComponent(_0x31c627[_0x146fb6[_0x5b711e]]);_0x2d73e2+=_0x31c627[_0x146fb6[_0x5b711e]];}_0x2d73e2+=_0x3917f8[_0xda00('0x60')];_0x2d73e2=_0xe280f2['createHash'](_0xda00('0x61'))['update'](_0x2d73e2)[_0xda00('0x62')](_0xda00('0x63'));if(_0x8306c9!==''){_0x8306c9+='&';}_0x8306c9+='signature='+_0x2d73e2;var _0x4c5c83={'method':_0xda00('0x32'),'uri':_0x3917f8[_0xda00('0x53')]+_0xda00('0x64')+_0x8306c9,'json':!![]};return rp(_0x4c5c83)['then'](function(_0x7949ee){var _0x210caa=Object[_0xda00('0x5e')](_0x7949ee);if(_0x7949ee[_0x210caa[0x0]][_0xda00('0x18')]&&parseInt(_0x7949ee[_0x210caa[0x0]]['error'])===0x0){var _0xff0d84={'messageId':_0x7949ee[_0x210caa[0x0]][_0xda00('0x65')]};if(!_0x3917f8['deliveryReport']){_0xff0d84[_0xda00('0x39')]=!![];}return _0x465e72[_0xda00('0x26')](_0xff0d84);}else{return logger[_0xda00('0x18')](_0xda00('0x28'),'afterCreate',_0xda00('0x59'),util[_0xda00('0x3b')](_0x7949ee[_0xda00('0x18')],{'showHidden':![],'depth':null}));}})[_0xda00('0x27')](function(_0x264183){return logger[_0xda00('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xda00('0x29'),_0xda00('0x59'),util[_0xda00('0x3b')](_0x264183,{'showHidden':![],'depth':null}));});}else{logger[_0xda00('0x18')](_0xda00('0x28'),_0xda00('0x29'),'csc',_0xda00('0x66'));}break;case'clickatell':if(_0x3917f8[_0xda00('0x60')]){var _0x25a0a0={'method':'POST','uri':_0xda00('0x67'),'headers':{'Authorization':_0x3917f8[_0xda00('0x60')]},'body':{'content':_0x369597['body'],'to':[_0x369597['phone']],'from':_0x3917f8[_0xda00('0x1e')],'binary':![],'clientMessageId':_0xda00('0x68'),'charset':'UTF-8'},'json':!![]};rp(_0x25a0a0)[_0xda00('0x16')](function(_0x577954){if(!_0x577954[_0xda00('0x18')]){var _0x2bd5bb={'messageId':_0x577954[_0xda00('0x57')][0x0][_0xda00('0x69')]};if(!_0x3917f8[_0xda00('0x38')]){_0x2bd5bb[_0xda00('0x39')]=!![];}return _0x465e72[_0xda00('0x26')](_0x2bd5bb);}else{return logger[_0xda00('0x18')](_0xda00('0x28'),_0xda00('0x29'),_0xda00('0x6a'),util[_0xda00('0x3b')](_0x577954[_0xda00('0x18')],{'showHidden':![],'depth':null}));}})[_0xda00('0x27')](function(_0x405de2){return logger[_0xda00('0x18')](_0xda00('0x28'),_0xda00('0x29'),_0xda00('0x6a'),util[_0xda00('0x3b')](_0x405de2,{'showHidden':![],'depth':null}));});}else{logger[_0xda00('0x18')](_0xda00('0x28'),'afterCreate',_0xda00('0x6a'),_0xda00('0x66'));}break;case _0xda00('0x6b'):if(_0x3917f8['username']&&_0x3917f8['password']){var _0x50de6a=util[_0xda00('0x4e')]('%s:%s',_0x3917f8[_0xda00('0x2c')],_0x3917f8[_0xda00('0x2d')]);var _0x2cd58f={'method':_0xda00('0x35'),'uri':'https://messaging.bandwidth.com/api/v2/users/'+_0x3917f8[_0xda00('0x6c')]+_0xda00('0x6d'),'body':{'to':[_0x369597[_0xda00('0x1e')]],'text':_0x369597[_0xda00('0xd')],'from':_0x3917f8['phone'],'applicationId':_0x3917f8[_0xda00('0x6e')]},'headers':{'Authorization':util['format'](_0xda00('0x43'),new Buffer(_0x50de6a)[_0xda00('0x50')](_0xda00('0x44')))},'json':!![]};rp(_0x2cd58f)['then'](function(_0x464f80){if(_0x464f80['id']){var _0x29d32c={'messageId':_0x464f80['id']};return _0x465e72[_0xda00('0x26')](_0x29d32c);}else{logger['error'](_0xda00('0x28'),_0xda00('0x29'),_0xda00('0x6b'),util[_0xda00('0x3b')](_0x464f80,{'showHidden':![],'depth':null}));}})['catch'](function(_0x3e6a7e){logger['error'](_0xda00('0x28'),_0xda00('0x29'),_0xda00('0x6b'),util['inspect'](_0x3e6a7e,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xda00('0x29'),_0xda00('0x6b'),'Missing\x20parameters:\x20username,\x20password');}break;case _0xda00('0x6f'):if(_0x3917f8['apiKey']){var _0x2f4ea9={};var _0x4c5c83={'method':_0xda00('0x35'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':_0xda00('0x70')+_0x3917f8[_0xda00('0x60')],'Content-Type':_0xda00('0x55')},'body':{'from':_0x3917f8[_0xda00('0x1e')],'to':_0x369597[_0xda00('0x1e')],'text':_0x369597[_0xda00('0xd')]},'json':!![]};return rp(_0x4c5c83)[_0xda00('0x16')](function(_0x78365d){if(_0x78365d[_0xda00('0x71')]==0xca){_0x2f4ea9[_0xda00('0x72')]=_0x78365d;var _0x4d65e2={'method':'POST','uri':_0xda00('0x73'),'headers':{'Authorization':'Bearer\x20'+_0x3917f8[_0xda00('0x60')],'Content-Type':_0xda00('0x55')},'body':{'refid':_0x2f4ea9[_0xda00('0x72')][_0xda00('0x74')]},'json':!![]};return rp(_0x4d65e2)['then'](function(_0x4880ef){_0x2f4ea9[_0xda00('0x75')]=_0x4880ef;var _0x2d00e7={'messageId':_0x2f4ea9['message'][_0xda00('0x74')],'read':!![]};return _0x465e72[_0xda00('0x26')](_0x2d00e7);});}else{return logger[_0xda00('0x18')](_0xda00('0x28'),_0xda00('0x29'),'intelepeer',util['inspect'](_0x78365d,{'showHidden':![],'depth':null}));}})[_0xda00('0x27')](function(_0x18a30f){return logger[_0xda00('0x18')](_0xda00('0x28'),_0xda00('0x29'),_0xda00('0x6f'),util['inspect'](_0x18a30f,{'showHidden':![],'depth':null}));});}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xda00('0x29'),_0xda00('0x6f'),_0xda00('0x76'));}break;}}})[_0xda00('0x77')](function(){_0x234581();});}else{_0x234581();}}},'charset':_0xda00('0x78'),'collate':_0xda00('0x79')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 16fbe74..5ea6e7a 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 _0x8f05=['bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','register','then','info','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsMessage,\x20%s,\x20%s','message','result','create','body','options','CreateSmsMessage','debug','catch','lodash','util','moment'];(function(_0x2e913b,_0x4b7071){var _0x173899=function(_0x2a7d22){while(--_0x2a7d22){_0x2e913b['push'](_0x2e913b['shift']());}};_0x173899(++_0x4b7071);}(_0x8f05,0x1bf));var _0x58f0=function(_0x4e4c39,_0x3a894d){_0x4e4c39=_0x4e4c39-0x0;var _0x11306e=_0x8f05[_0x4e4c39];return _0x11306e;};'use strict';var _=require(_0x58f0('0x0'));var util=require(_0x58f0('0x1'));var moment=require(_0x58f0('0x2'));var BPromise=require(_0x58f0('0x3'));var rs=require(_0x58f0('0x4'));var fs=require('fs');var Redis=require(_0x58f0('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x58f0('0x6'));var logger=require('../../config/logger')(_0x58f0('0x7'));var config=require(_0x58f0('0x8'));var jayson=require(_0x58f0('0x9'));var client=jayson['client'][_0x58f0('0xa')]({'port':0x232a});config[_0x58f0('0xb')]=_[_0x58f0('0xc')](config[_0x58f0('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x58f0('0xb')]));require('./smsMessage.socket')[_0x58f0('0xd')](socket);function respondWithRpcPromise(_0x3873d7,_0x3646dc,_0x34554b){return new BPromise(function(_0x480b21,_0x4b590c){return client['request'](_0x3873d7,_0x34554b)[_0x58f0('0xe')](function(_0x3beae5){logger[_0x58f0('0xf')]('SmsMessage,\x20%s,\x20%s',_0x3646dc,_0x58f0('0x10'));logger['debug'](_0x58f0('0x11'),_0x3646dc,_0x58f0('0x10'),JSON[_0x58f0('0x12')](_0x3beae5));if(_0x3beae5['error']){if(_0x3beae5[_0x58f0('0x13')][_0x58f0('0x14')]===0x1f4){logger[_0x58f0('0x13')](_0x58f0('0x15'),_0x3646dc,_0x3beae5[_0x58f0('0x13')][_0x58f0('0x16')]);return _0x4b590c(_0x3beae5[_0x58f0('0x13')]['message']);}logger[_0x58f0('0x13')](_0x58f0('0x15'),_0x3646dc,_0x3beae5[_0x58f0('0x13')]['message']);return _0x480b21(_0x3beae5[_0x58f0('0x13')]['message']);}else{logger[_0x58f0('0xf')](_0x58f0('0x15'),_0x3646dc,_0x58f0('0x10'));_0x480b21(_0x3beae5[_0x58f0('0x17')][_0x58f0('0x16')]);}})['catch'](function(_0x2255bb){logger[_0x58f0('0x13')]('SmsMessage,\x20%s,\x20%s',_0x3646dc,_0x2255bb);_0x4b590c(_0x2255bb);});});}exports['CreateSmsMessage']=function(_0xbff732){var _0x2b2050=this;return new Promise(function(_0x2d6c44,_0x324d29){return db['SmsMessage'][_0x58f0('0x18')](_0xbff732[_0x58f0('0x19')],{'raw':_0xbff732[_0x58f0('0x1a')]?_0xbff732['options']['raw']===undefined?!![]:![]:!![]})[_0x58f0('0xe')](function(_0x387616){logger[_0x58f0('0xf')](_0x58f0('0x1b'),_0xbff732);logger[_0x58f0('0x1c')]('CreateSmsMessage',_0xbff732,JSON[_0x58f0('0x12')](_0x387616));_0x2d6c44(_0x387616);})[_0x58f0('0x1d')](function(_0x5c59aa){logger['error'](_0x58f0('0x1b'),_0x5c59aa['message'],_0xbff732);_0x324d29(_0x2b2050['error'](0x1f4,_0x5c59aa['message']));});});}; \ No newline at end of file +var _0xd8b3=['request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','CreateSmsMessage','create','body','options','raw','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./smsMessage.socket','register','request','then','info','SmsMessage,\x20%s,\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd8b3,0xd2));var _0x3d8b=function(_0x5c8827,_0x5bc5d7){_0x5c8827=_0x5c8827-0x0;var _0x50ffd5=_0xd8b3[_0x5c8827];return _0x50ffd5;};'use strict';var _=require(_0x3d8b('0x0'));var util=require(_0x3d8b('0x1'));var moment=require('moment');var BPromise=require(_0x3d8b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3d8b('0x3'));var db=require(_0x3d8b('0x4'))['db'];var utils=require(_0x3d8b('0x5'));var logger=require(_0x3d8b('0x6'))(_0x3d8b('0x7'));var config=require(_0x3d8b('0x8'));var jayson=require(_0x3d8b('0x9'));var client=jayson[_0x3d8b('0xa')][_0x3d8b('0xb')]({'port':0x232a});config[_0x3d8b('0xc')]=_['defaults'](config[_0x3d8b('0xc')],{'host':_0x3d8b('0xd'),'port':0x18eb});var socket=require(_0x3d8b('0xe'))(new Redis(config[_0x3d8b('0xc')]));require(_0x3d8b('0xf'))[_0x3d8b('0x10')](socket);function respondWithRpcPromise(_0x2b8fa7,_0x4ed95b,_0x299cb9){return new BPromise(function(_0x379814,_0x34f95f){return client[_0x3d8b('0x11')](_0x2b8fa7,_0x299cb9)[_0x3d8b('0x12')](function(_0xec179f){logger[_0x3d8b('0x13')](_0x3d8b('0x14'),_0x4ed95b,_0x3d8b('0x15'));logger['debug'](_0x3d8b('0x16'),_0x4ed95b,_0x3d8b('0x15'),JSON[_0x3d8b('0x17')](_0xec179f));if(_0xec179f[_0x3d8b('0x18')]){if(_0xec179f[_0x3d8b('0x18')]['code']===0x1f4){logger[_0x3d8b('0x18')](_0x3d8b('0x14'),_0x4ed95b,_0xec179f[_0x3d8b('0x18')][_0x3d8b('0x19')]);return _0x34f95f(_0xec179f[_0x3d8b('0x18')][_0x3d8b('0x19')]);}logger[_0x3d8b('0x18')](_0x3d8b('0x14'),_0x4ed95b,_0xec179f[_0x3d8b('0x18')][_0x3d8b('0x19')]);return _0x379814(_0xec179f[_0x3d8b('0x18')]['message']);}else{logger['info']('SmsMessage,\x20%s,\x20%s',_0x4ed95b,'request\x20sent');_0x379814(_0xec179f[_0x3d8b('0x1a')][_0x3d8b('0x19')]);}})['catch'](function(_0x331c96){logger[_0x3d8b('0x18')]('SmsMessage,\x20%s,\x20%s',_0x4ed95b,_0x331c96);_0x34f95f(_0x331c96);});});}exports[_0x3d8b('0x1b')]=function(_0x52d679){var _0x1d7b33=this;return new Promise(function(_0x281c6b,_0x349a58){return db['SmsMessage'][_0x3d8b('0x1c')](_0x52d679[_0x3d8b('0x1d')],{'raw':_0x52d679['options']?_0x52d679[_0x3d8b('0x1e')][_0x3d8b('0x1f')]===undefined?!![]:![]:!![]})[_0x3d8b('0x12')](function(_0x52a640){logger['info'](_0x3d8b('0x1b'),_0x52d679);logger['debug'](_0x3d8b('0x1b'),_0x52d679,JSON[_0x3d8b('0x17')](_0x52a640));_0x281c6b(_0x52a640);})[_0x3d8b('0x20')](function(_0x1ea05c){logger['error'](_0x3d8b('0x1b'),_0x1ea05c[_0x3d8b('0x19')],_0x52d679);_0x349a58(_0x1d7b33[_0x3d8b('0x18')](0x1f4,_0x1ea05c[_0x3d8b('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 0c2cd01..5c62763 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 _0x3d91=['./smsMessage.events','save','remove','update','smsMessage:'];(function(_0x204a82,_0x1c4d74){var _0x46a603=function(_0xce4dce){while(--_0xce4dce){_0x204a82['push'](_0x204a82['shift']());}};_0x46a603(++_0x1c4d74);}(_0x3d91,0x172));var _0x13d9=function(_0x49b076,_0x4fb74e){_0x49b076=_0x49b076-0x0;var _0xa3609=_0x3d91[_0x49b076];return _0xa3609;};'use strict';var SmsMessageEvents=require(_0x13d9('0x0'));var events=[_0x13d9('0x1'),_0x13d9('0x2'),_0x13d9('0x3')];function createListener(_0x948021,_0x4e1623){return function(_0x2aa1b4){_0x4e1623['emit'](_0x948021,_0x2aa1b4);};}function removeListener(_0x3e1378,_0x1bfefa){return function(){SmsMessageEvents['removeListener'](_0x3e1378,_0x1bfefa);};}exports['register']=function(_0x3c402d){for(var _0x4f445b=0x0,_0x3e043f=events['length'];_0x4f445b<_0x3e043f;_0x4f445b++){var _0x28055f=events[_0x4f445b];var _0x5f9132=createListener(_0x13d9('0x4')+_0x28055f,_0x3c402d);SmsMessageEvents['on'](_0x28055f,_0x5f9132);}}; \ No newline at end of file +var _0xd49d=['length','smsMessage:','./smsMessage.events','save','remove','emit','removeListener'];(function(_0x140308,_0x3443fc){var _0xc1f132=function(_0x26c0e6){while(--_0x26c0e6){_0x140308['push'](_0x140308['shift']());}};_0xc1f132(++_0x3443fc);}(_0xd49d,0x13d));var _0xdd49=function(_0x5ae6e8,_0x32052c){_0x5ae6e8=_0x5ae6e8-0x0;var _0x2f1fdd=_0xd49d[_0x5ae6e8];return _0x2f1fdd;};'use strict';var SmsMessageEvents=require(_0xdd49('0x0'));var events=[_0xdd49('0x1'),_0xdd49('0x2'),'update'];function createListener(_0x712d81,_0x5a2baf){return function(_0x2a5313){_0x5a2baf[_0xdd49('0x3')](_0x712d81,_0x2a5313);};}function removeListener(_0xfbf979,_0x52dc43){return function(){SmsMessageEvents[_0xdd49('0x4')](_0xfbf979,_0x52dc43);};}exports['register']=function(_0x379e46){for(var _0x3a26b3=0x0,_0x3dfe3f=events[_0xdd49('0x5')];_0x3a26b3<_0x3dfe3f;_0x3a26b3++){var _0x537903=events[_0x3a26b3];var _0x542c59=createListener(_0xdd49('0x6')+_0x537903,_0x379e46);SmsMessageEvents['on'](_0x537903,_0x542c59);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 1d81322..4d8d2cd 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 _0x3a52=['removeAgents','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','isAuthenticated','index','get','/describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post','create','addAgents','put','update','delete','destroy','removeTeams'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3a52,0x1b5));var _0x23a5=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3a52[_0x20a584];return _0x4b41a8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x23a5('0x0'));var timeout=require(_0x23a5('0x1'));var express=require(_0x23a5('0x2'));var router=express[_0x23a5('0x3')]();var fs_extra=require(_0x23a5('0x4'));var auth=require(_0x23a5('0x5'));var interaction=require(_0x23a5('0x6'));var config=require(_0x23a5('0x7'));var controller=require(_0x23a5('0x8'));router['get']('/',auth[_0x23a5('0x9')](),controller[_0x23a5('0xa')]);router[_0x23a5('0xb')](_0x23a5('0xc'),auth[_0x23a5('0x9')](),controller['describe']);router[_0x23a5('0xb')](_0x23a5('0xd'),auth[_0x23a5('0x9')](),controller['show']);router[_0x23a5('0xb')](_0x23a5('0xe'),auth[_0x23a5('0x9')](),controller[_0x23a5('0xf')]);router[_0x23a5('0xb')](_0x23a5('0x10'),auth[_0x23a5('0x9')](),controller[_0x23a5('0x11')]);router['get'](_0x23a5('0x12'),auth['isAuthenticated'](),controller['getAgents']);router[_0x23a5('0x13')]('/',auth[_0x23a5('0x9')](),controller[_0x23a5('0x14')]);router[_0x23a5('0x13')](_0x23a5('0x10'),auth[_0x23a5('0x9')](),controller['addTeams']);router[_0x23a5('0x13')](_0x23a5('0x12'),auth[_0x23a5('0x9')](),controller[_0x23a5('0x15')]);router[_0x23a5('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x23a5('0x17')]);router[_0x23a5('0x18')]('/:id',auth[_0x23a5('0x9')](),controller[_0x23a5('0x19')]);router[_0x23a5('0x18')]('/:id/teams',auth[_0x23a5('0x9')](),controller[_0x23a5('0x1a')]);router[_0x23a5('0x18')](_0x23a5('0x12'),auth[_0x23a5('0x9')](),controller[_0x23a5('0x1b')]);module[_0x23a5('0x1c')]=router; \ No newline at end of file +var _0x012a=['/describe','isAuthenticated','describe','show','getMembers','getTeams','getAgents','post','create','/:id/teams','addTeams','/:id/users','addAgents','put','/:id','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','index'];(function(_0x5c950c,_0x3e2032){var _0x16e034=function(_0x19d311){while(--_0x19d311){_0x5c950c['push'](_0x5c950c['shift']());}};_0x16e034(++_0x3e2032);}(_0x012a,0x115));var _0xa012=function(_0x5e244c,_0x2f9ee4){_0x5e244c=_0x5e244c-0x0;var _0x236356=_0x012a[_0x5e244c];return _0x236356;};'use strict';var multer=require(_0xa012('0x0'));var util=require(_0xa012('0x1'));var path=require(_0xa012('0x2'));var timeout=require(_0xa012('0x3'));var express=require('express');var router=express[_0xa012('0x4')]();var fs_extra=require(_0xa012('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xa012('0x6'));var config=require(_0xa012('0x7'));var controller=require(_0xa012('0x8'));router[_0xa012('0x9')]('/',auth['isAuthenticated'](),controller[_0xa012('0xa')]);router[_0xa012('0x9')](_0xa012('0xb'),auth[_0xa012('0xc')](),controller[_0xa012('0xd')]);router[_0xa012('0x9')]('/:id',auth[_0xa012('0xc')](),controller[_0xa012('0xe')]);router['get']('/:id/members',auth[_0xa012('0xc')](),controller[_0xa012('0xf')]);router[_0xa012('0x9')]('/:id/teams',auth[_0xa012('0xc')](),controller[_0xa012('0x10')]);router[_0xa012('0x9')]('/:id/users',auth['isAuthenticated'](),controller[_0xa012('0x11')]);router[_0xa012('0x12')]('/',auth[_0xa012('0xc')](),controller[_0xa012('0x13')]);router['post'](_0xa012('0x14'),auth['isAuthenticated'](),controller[_0xa012('0x15')]);router[_0xa012('0x12')](_0xa012('0x16'),auth['isAuthenticated'](),controller[_0xa012('0x17')]);router[_0xa012('0x18')](_0xa012('0x19'),auth[_0xa012('0xc')](),controller[_0xa012('0x1a')]);router[_0xa012('0x1b')](_0xa012('0x19'),auth[_0xa012('0xc')](),controller[_0xa012('0x1c')]);router['delete'](_0xa012('0x14'),auth[_0xa012('0xc')](),controller[_0xa012('0x1d')]);router['delete'](_0xa012('0x16'),auth[_0xa012('0xc')](),controller[_0xa012('0x1e')]);module[_0xa012('0x1f')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index b9382c0..e5fa5c1 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 _0xb309=['STRING','ENUM','rrmemory','roundrobin','sequelize','exports','name'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xb309,0x89));var _0x9b30=function(_0x3b6278,_0x2deeea){_0x3b6278=_0x3b6278-0x0;var _0xfa3347=_0xb309[_0x3b6278];return _0xfa3347;};'use strict';var Sequelize=require(_0x9b30('0x0'));module[_0x9b30('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x9b30('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x9b30('0x3')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x9b30('0x4')](_0x9b30('0x5'),'beepall',_0x9b30('0x6'))}}; \ No newline at end of file +var _0xe86d=['sequelize','exports','STRING','name','ENUM','rrmemory','beepall'];(function(_0x3f2fea,_0x3c4ea8){var _0x69a4d5=function(_0x223109){while(--_0x223109){_0x3f2fea['push'](_0x3f2fea['shift']());}};_0x69a4d5(++_0x3c4ea8);}(_0xe86d,0x1d5));var _0xde86=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe86d[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xde86('0x0'));module[_0xde86('0x1')]={'name':{'type':Sequelize[_0xde86('0x2')],'unique':_0xde86('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xde86('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xde86('0x4')](_0xde86('0x5'),_0xde86('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 400417f..6667fa0 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 _0xfc5c=['UserProfileResource','error','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','SmsQueue','findAll','catch','show','find','create','body','user','role','SmsQueues','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','getMembers','findOne','UserSmsQueue','SmsQueueId','User','findAndCountAll','UserId','updatedAt','createdAt','rows','format','%s/%s','SIP','smsPause','getTeams','ids','Team','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','forEach','userSmsQueue:save','field','tq.TeamId','from','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','all','union','value','removeTeams','isEmpty','removeAgents','emit','userSmsQueue:remove','addAgents','omit','spread','isArray','getAgents','rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./smsQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','get'];(function(_0x49ca18,_0x5e6d05){var _0x145d54=function(_0x30b9be){while(--_0x30b9be){_0x49ca18['push'](_0x49ca18['shift']());}};_0x145d54(++_0x5e6d05);}(_0xfc5c,0x185));var _0xcfc5=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0xfc5c[_0x1694f5];return _0x5b4321;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcfc5('0x0'));var zipdir=require(_0xcfc5('0x1'));var jsonpatch=require(_0xcfc5('0x2'));var rp=require('request-promise');var moment=require(_0xcfc5('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xcfc5('0x4'));var util=require('util');var path=require(_0xcfc5('0x5'));var sox=require(_0xcfc5('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcfc5('0x7'));var _=require(_0xcfc5('0x8'));var squel=require(_0xcfc5('0x9'));var crypto=require(_0xcfc5('0xa'));var jsforce=require(_0xcfc5('0xb'));var deskjs=require(_0xcfc5('0xc'));var toCsv=require(_0xcfc5('0xd'));var querystring=require(_0xcfc5('0xe'));var Papa=require(_0xcfc5('0xf'));var Redis=require(_0xcfc5('0x10'));var authService=require(_0xcfc5('0x11'));var qs=require(_0xcfc5('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcfc5('0x13'));var logger=require(_0xcfc5('0x14'))(_0xcfc5('0x15'));var utils=require('../../config/utils');var config=require(_0xcfc5('0x16'));var licenseUtil=require(_0xcfc5('0x17'));var db=require(_0xcfc5('0x18'))['db'];config['redis']=_[_0xcfc5('0x19')](config['redis'],{'host':_0xcfc5('0x1a'),'port':0x18eb});var socket=require(_0xcfc5('0x1b'))(new Redis(config[_0xcfc5('0x1c')]));require(_0xcfc5('0x1d'))[_0xcfc5('0x1e')](socket);function respondWithStatusCode(_0x5e2778,_0x52a024){_0x52a024=_0x52a024||0xcc;return function(_0x1a3069){if(_0x1a3069){return _0x5e2778[_0xcfc5('0x1f')](_0x52a024);}return _0x5e2778[_0xcfc5('0x20')](_0x52a024)[_0xcfc5('0x21')]();};}function respondWithResult(_0x3343f1,_0x291b9a){_0x291b9a=_0x291b9a||0xc8;return function(_0x5bc849){if(_0x5bc849){return _0x3343f1['status'](_0x291b9a)[_0xcfc5('0x22')](_0x5bc849);}};}function respondWithFilteredResult(_0xd000c4,_0x3cb546){return function(_0x1757c9){if(_0x1757c9){var _0x24d6c1=typeof _0x3cb546[_0xcfc5('0x23')]===_0xcfc5('0x24')&&typeof _0x3cb546[_0xcfc5('0x25')]===_0xcfc5('0x24');var _0xc58856=_0x1757c9[_0xcfc5('0x26')];var _0x165cee=_0x24d6c1?0x0:_0x3cb546['offset'];var _0x254033=_0x24d6c1?_0x1757c9[_0xcfc5('0x26')]:_0x3cb546['offset']+_0x3cb546[_0xcfc5('0x25')];var _0x4506f7;if(_0x254033>=_0xc58856){_0x254033=_0xc58856;_0x4506f7=0xc8;}else{_0x4506f7=0xce;}_0xd000c4[_0xcfc5('0x20')](_0x4506f7);return _0xd000c4[_0xcfc5('0x27')](_0xcfc5('0x28'),_0x165cee+'-'+_0x254033+'/'+_0xc58856)[_0xcfc5('0x22')](_0x1757c9);}return null;};}function patchUpdates(_0xfb5148){return function(_0x5f59fe){try{jsonpatch[_0xcfc5('0x29')](_0x5f59fe,_0xfb5148,!![]);}catch(_0x1f0d69){return BPromise['reject'](_0x1f0d69);}return _0x5f59fe['save']();};}function saveUpdates(_0x1805a5,_0x3667d2){return function(_0x1cae10){if(_0x1cae10){return _0x1cae10[_0xcfc5('0x2a')](_0x1805a5)[_0xcfc5('0x2b')](function(_0x13eb68){return _0x13eb68;});}return null;};}function removeEntity(_0x49b842,_0x3d758b){return function(_0x5d8e79){if(_0x5d8e79){return _0x5d8e79[_0xcfc5('0x2c')]()[_0xcfc5('0x2b')](function(){var _0x1a87d5=_0x5d8e79[_0xcfc5('0x2d')]({'plain':!![]});var _0x29f89c='SmsQueues';return db[_0xcfc5('0x2e')][_0xcfc5('0x2c')]({'where':{'type':_0x29f89c,'resourceId':_0x1a87d5['id']}})['then'](function(){return _0x5d8e79;});})[_0xcfc5('0x2b')](function(){_0x49b842[_0xcfc5('0x20')](0xcc)[_0xcfc5('0x21')]();});}};}function handleEntityNotFound(_0x3a5c2c,_0x51435a){return function(_0x101061){if(!_0x101061){_0x3a5c2c[_0xcfc5('0x1f')](0x194);}return _0x101061;};}function handleError(_0x53097b,_0xb54a81){_0xb54a81=_0xb54a81||0x1f4;return function(_0x3cc56d){logger[_0xcfc5('0x2f')](_0x3cc56d['stack']);if(_0x3cc56d['name']){delete _0x3cc56d[_0xcfc5('0x30')];}_0x53097b[_0xcfc5('0x20')](_0xb54a81)[_0xcfc5('0x31')](_0x3cc56d);};}exports['index']=function(_0x4a3787,_0x4b79f3){var _0x797fe9={},_0x53c504={},_0x224dc7={'count':0x0,'rows':[]};var _0x142e25=_[_0xcfc5('0x32')](db['SmsQueue'][_0xcfc5('0x33')],function(_0x169fe7){return{'name':_0x169fe7[_0xcfc5('0x34')],'type':_0x169fe7[_0xcfc5('0x35')][_0xcfc5('0x36')]};});_0x53c504[_0xcfc5('0x37')]=_['map'](_0x142e25,_0xcfc5('0x30'));_0x53c504[_0xcfc5('0x38')]=_[_0xcfc5('0x39')](_0x4a3787[_0xcfc5('0x38')]);_0x53c504[_0xcfc5('0x3a')]=_[_0xcfc5('0x3b')](_0x53c504[_0xcfc5('0x37')],_0x53c504[_0xcfc5('0x38')]);_0x797fe9[_0xcfc5('0x3c')]=_[_0xcfc5('0x3b')](_0x53c504[_0xcfc5('0x37')],qs['fields'](_0x4a3787['query'][_0xcfc5('0x3d')]));_0x797fe9['attributes']=_0x797fe9[_0xcfc5('0x3c')][_0xcfc5('0x3e')]?_0x797fe9[_0xcfc5('0x3c')]:_0x53c504[_0xcfc5('0x37')];if(!_0x4a3787[_0xcfc5('0x38')][_0xcfc5('0x3f')](_0xcfc5('0x40'))){_0x797fe9['limit']=qs[_0xcfc5('0x25')](_0x4a3787['query'][_0xcfc5('0x25')]);_0x797fe9[_0xcfc5('0x23')]=qs[_0xcfc5('0x23')](_0x4a3787[_0xcfc5('0x38')][_0xcfc5('0x23')]);}_0x797fe9[_0xcfc5('0x41')]=qs['sort'](_0x4a3787[_0xcfc5('0x38')][_0xcfc5('0x42')]);_0x797fe9[_0xcfc5('0x43')]=qs['filters'](_[_0xcfc5('0x44')](_0x4a3787[_0xcfc5('0x38')],_0x53c504[_0xcfc5('0x3a')]),_0x142e25);if(_0x4a3787['query'][_0xcfc5('0x45')]){_0x797fe9[_0xcfc5('0x43')]=_['merge'](_0x797fe9[_0xcfc5('0x43')],{'$or':_[_0xcfc5('0x32')](_0x142e25,function(_0x29dee9){if(_0x29dee9[_0xcfc5('0x35')]!==_0xcfc5('0x46')){var _0x59d102={};_0x59d102[_0x29dee9[_0xcfc5('0x30')]]={'$like':'%'+_0x4a3787[_0xcfc5('0x38')]['filter']+'%'};return _0x59d102;}})});}_0x797fe9=_[_0xcfc5('0x47')]({},_0x797fe9,_0x4a3787[_0xcfc5('0x48')]);var _0x3ab52b={'where':_0x797fe9['where']};return db['SmsQueue']['count'](_0x3ab52b)[_0xcfc5('0x2b')](function(_0x2a597e){_0x224dc7['count']=_0x2a597e;if(_0x4a3787[_0xcfc5('0x38')][_0xcfc5('0x49')]){_0x797fe9[_0xcfc5('0x4a')]=[{'all':!![]}];}return db[_0xcfc5('0x4b')][_0xcfc5('0x4c')](_0x797fe9);})[_0xcfc5('0x2b')](function(_0x429aa0){_0x224dc7['rows']=_0x429aa0;return _0x224dc7;})[_0xcfc5('0x2b')](respondWithFilteredResult(_0x4b79f3,_0x797fe9))[_0xcfc5('0x4d')](handleError(_0x4b79f3,null));};exports[_0xcfc5('0x4e')]=function(_0x34bc5c,_0x535a62){var _0x21aa84={'raw':!![],'where':{'id':_0x34bc5c['params']['id']}},_0x287611={};_0x287611[_0xcfc5('0x37')]=_[_0xcfc5('0x39')](db['SmsQueue'][_0xcfc5('0x33')]);_0x287611[_0xcfc5('0x38')]=_['keys'](_0x34bc5c[_0xcfc5('0x38')]);_0x287611['filters']=_[_0xcfc5('0x3b')](_0x287611['model'],_0x287611['query']);_0x21aa84[_0xcfc5('0x3c')]=_[_0xcfc5('0x3b')](_0x287611['model'],qs['fields'](_0x34bc5c[_0xcfc5('0x38')]['fields']));_0x21aa84[_0xcfc5('0x3c')]=_0x21aa84[_0xcfc5('0x3c')][_0xcfc5('0x3e')]?_0x21aa84[_0xcfc5('0x3c')]:_0x287611['model'];if(_0x34bc5c[_0xcfc5('0x38')][_0xcfc5('0x49')]){_0x21aa84[_0xcfc5('0x4a')]=[{'all':!![]}];}_0x21aa84=_[_0xcfc5('0x47')]({},_0x21aa84,_0x34bc5c[_0xcfc5('0x48')]);return db['SmsQueue'][_0xcfc5('0x4f')](_0x21aa84)[_0xcfc5('0x2b')](handleEntityNotFound(_0x535a62,null))[_0xcfc5('0x2b')](respondWithResult(_0x535a62,null))[_0xcfc5('0x4d')](handleError(_0x535a62,null));};exports[_0xcfc5('0x50')]=function(_0xd88e6a,_0x5f4457){return db[_0xcfc5('0x4b')][_0xcfc5('0x50')](_0xd88e6a[_0xcfc5('0x51')],{})[_0xcfc5('0x2b')](function(_0x3a3518){var _0x24d6fa=_0xd88e6a[_0xcfc5('0x52')][_0xcfc5('0x2d')]({'plain':!![]});if(!_0x24d6fa)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x24d6fa[_0xcfc5('0x53')]===_0xcfc5('0x52')){var _0x5d8f9e=_0x3a3518['get']({'plain':!![]});var _0x46eadf=_0xcfc5('0x54');return db[_0xcfc5('0x55')][_0xcfc5('0x4f')]({'where':{'name':_0x46eadf,'userProfileId':_0x24d6fa[_0xcfc5('0x56')]},'raw':!![]})[_0xcfc5('0x2b')](function(_0x305a45){if(_0x305a45&&_0x305a45[_0xcfc5('0x57')]===0x0){return db[_0xcfc5('0x2e')][_0xcfc5('0x50')]({'name':_0x5d8f9e[_0xcfc5('0x30')],'resourceId':_0x5d8f9e['id'],'type':_0x305a45[_0xcfc5('0x30')],'sectionId':_0x305a45['id']},{})['then'](function(){return _0x3a3518;});}else{return _0x3a3518;}})[_0xcfc5('0x4d')](function(_0x376020){logger[_0xcfc5('0x2f')](_0xcfc5('0x58'),_0x376020);throw _0x376020;});}return _0x3a3518;})[_0xcfc5('0x2b')](respondWithResult(_0x5f4457,0xc9))[_0xcfc5('0x4d')](handleError(_0x5f4457,null));};exports[_0xcfc5('0x2a')]=function(_0x1afde2,_0x4e12fb){if(_0x1afde2[_0xcfc5('0x51')]['id']){delete _0x1afde2[_0xcfc5('0x51')]['id'];}return db[_0xcfc5('0x4b')]['find']({'where':{'id':_0x1afde2[_0xcfc5('0x59')]['id']}})[_0xcfc5('0x2b')](handleEntityNotFound(_0x4e12fb,null))[_0xcfc5('0x2b')](saveUpdates(_0x1afde2[_0xcfc5('0x51')],null))[_0xcfc5('0x2b')](respondWithResult(_0x4e12fb,null))[_0xcfc5('0x4d')](handleError(_0x4e12fb,null));};exports[_0xcfc5('0x2c')]=function(_0x4a166c,_0x54f135){return db['SmsQueue']['find']({'where':{'id':_0x4a166c[_0xcfc5('0x59')]['id']}})[_0xcfc5('0x2b')](handleEntityNotFound(_0x54f135,null))['then'](removeEntity(_0x54f135,null))['catch'](handleError(_0x54f135,null));};exports['describe']=function(_0x309bb3,_0x15f312){return db['SmsQueue']['describe']()['then'](respondWithResult(_0x15f312,null))[_0xcfc5('0x4d')](handleError(_0x15f312,null));};exports[_0xcfc5('0x5a')]=function(_0x21ff12,_0x39d7f5,_0x156cae){var _0x5f0406={'raw':!![],'where':{}},_0x2d5d1e={},_0x16a779;return db[_0xcfc5('0x4b')][_0xcfc5('0x5b')]({'where':{'id':_0x21ff12[_0xcfc5('0x59')]['id']}})[_0xcfc5('0x2b')](handleEntityNotFound(_0x39d7f5,null))['then'](function(_0x49e354){if(_0x49e354){_0x16a779=_0x49e354[_0xcfc5('0x2d')]({'plain':!![]});_0x2d5d1e['model']=_[_0xcfc5('0x39')](db[_0xcfc5('0x5c')]['rawAttributes']);_0x2d5d1e[_0xcfc5('0x38')]=_['keys'](_0x21ff12[_0xcfc5('0x38')]);_0x2d5d1e['filters']=_[_0xcfc5('0x3b')](_0x2d5d1e[_0xcfc5('0x37')],_0x2d5d1e[_0xcfc5('0x38')]);_0x5f0406[_0xcfc5('0x3c')]=_[_0xcfc5('0x3b')](_0x2d5d1e[_0xcfc5('0x37')],qs[_0xcfc5('0x3d')](_0x21ff12[_0xcfc5('0x38')]['fields']));_0x5f0406[_0xcfc5('0x3c')]=_0x5f0406['attributes']['length']?_0x5f0406[_0xcfc5('0x3c')]:_0x2d5d1e['model'];if(!_0x21ff12[_0xcfc5('0x38')][_0xcfc5('0x3f')](_0xcfc5('0x40'))){_0x5f0406[_0xcfc5('0x25')]=qs[_0xcfc5('0x25')](_0x21ff12[_0xcfc5('0x38')][_0xcfc5('0x25')]);_0x5f0406['offset']=qs['offset'](_0x21ff12['query'][_0xcfc5('0x23')]);}_0x5f0406[_0xcfc5('0x41')]=qs['sort'](_0x21ff12[_0xcfc5('0x38')][_0xcfc5('0x42')]);_0x5f0406[_0xcfc5('0x43')]=qs[_0xcfc5('0x3a')](_[_0xcfc5('0x44')](_0x21ff12[_0xcfc5('0x38')],_0x2d5d1e[_0xcfc5('0x3a')]));_0x5f0406[_0xcfc5('0x43')][_0xcfc5('0x5d')]=_0x49e354['id'];if(_0x21ff12[_0xcfc5('0x38')][_0xcfc5('0x45')]){_0x5f0406['where']=_['merge'](_0x5f0406[_0xcfc5('0x43')],{'$or':_[_0xcfc5('0x32')](_0x5f0406[_0xcfc5('0x3c')],function(_0x56505e){var _0x430398={};_0x430398[_0x56505e]={'$like':'%'+_0x21ff12[_0xcfc5('0x38')][_0xcfc5('0x45')]+'%'};return _0x430398;})});}_0x5f0406=_[_0xcfc5('0x47')]({},_0x5f0406,_0x21ff12['options']);return db['UserSmsQueue'][_0xcfc5('0x4c')](_0x5f0406);}})[_0xcfc5('0x2b')](function(_0x2675c7){if(_0x2675c7){return db[_0xcfc5('0x5e')][_0xcfc5('0x5f')]({'where':{'id':_[_0xcfc5('0x32')](_0x2675c7,_0xcfc5('0x60')),'role':'agent'},'attributes':['id',_0xcfc5('0x30'),'smsPause',_0xcfc5('0x61'),_0xcfc5('0x62')]});}})[_0xcfc5('0x2b')](function(_0xd4bfff){if(_0xd4bfff){return{'count':_0xd4bfff[_0xcfc5('0x26')],'rows':_[_0xcfc5('0x32')](_0xd4bfff[_0xcfc5('0x63')],function(_0x13c4f6){return{'membername':_0x13c4f6[_0xcfc5('0x30')],'UserId':_0x13c4f6['id'],'queue_name':_0x16a779[_0xcfc5('0x30')],'SmsQueueId':_0x16a779['id'],'interface':util[_0xcfc5('0x64')](_0xcfc5('0x65'),_0xcfc5('0x66'),_0x13c4f6[_0xcfc5('0x30')]),'penalty':0x0,'paused':_0x13c4f6[_0xcfc5('0x67')],'createdAt':_0x13c4f6['createdAt'],'updatedAt':_0x13c4f6[_0xcfc5('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xcfc5('0x2b')](respondWithFilteredResult(_0x39d7f5,_0x5f0406))['catch'](handleError(_0x39d7f5,null));};exports[_0xcfc5('0x68')]=function(_0x1c61c5,_0x5a10cf,_0x42afe1){var _0x3bb36f={};var _0x26c2d5={};var _0x395219;var _0x590ae3;return db[_0xcfc5('0x4b')][_0xcfc5('0x5b')]({'where':{'id':_0x1c61c5[_0xcfc5('0x59')]['id']}})[_0xcfc5('0x2b')](handleEntityNotFound(_0x5a10cf,null))['then'](function(_0x11b795){if(_0x11b795){_0x395219=_0x11b795;_0x26c2d5[_0xcfc5('0x37')]=_[_0xcfc5('0x39')](db['Team'][_0xcfc5('0x33')]);_0x26c2d5[_0xcfc5('0x38')]=_[_0xcfc5('0x39')](_0x1c61c5[_0xcfc5('0x38')]);_0x26c2d5[_0xcfc5('0x3a')]=_[_0xcfc5('0x3b')](_0x26c2d5['model'],_0x26c2d5['query']);_0x3bb36f[_0xcfc5('0x3c')]=_[_0xcfc5('0x3b')](_0x26c2d5['model'],qs[_0xcfc5('0x3d')](_0x1c61c5['query'][_0xcfc5('0x3d')]));_0x3bb36f['attributes']=_0x3bb36f[_0xcfc5('0x3c')]['length']?_0x3bb36f[_0xcfc5('0x3c')]:_0x26c2d5[_0xcfc5('0x37')];_0x3bb36f[_0xcfc5('0x41')]=qs['sort'](_0x1c61c5[_0xcfc5('0x38')][_0xcfc5('0x42')]);_0x3bb36f[_0xcfc5('0x43')]=qs['filters'](_[_0xcfc5('0x44')](_0x1c61c5[_0xcfc5('0x38')],_0x26c2d5[_0xcfc5('0x3a')]));if(_0x1c61c5[_0xcfc5('0x38')][_0xcfc5('0x45')]){_0x3bb36f[_0xcfc5('0x43')]=_['merge'](_0x3bb36f[_0xcfc5('0x43')],{'$or':_[_0xcfc5('0x32')](_0x3bb36f['attributes'],function(_0xc53b44){var _0x709519={};_0x709519[_0xc53b44]={'$like':'%'+_0x1c61c5[_0xcfc5('0x38')][_0xcfc5('0x45')]+'%'};return _0x709519;})});}_0x3bb36f=_[_0xcfc5('0x47')]({},_0x3bb36f,_0x1c61c5[_0xcfc5('0x48')]);return _0x395219['getTeams'](_0x3bb36f);}})[_0xcfc5('0x2b')](function(_0x1c91d0){if(_0x1c91d0){_0x590ae3=_0x1c91d0[_0xcfc5('0x3e')];if(!_0x1c61c5[_0xcfc5('0x38')]['hasOwnProperty']('nolimit')){_0x3bb36f['limit']=qs[_0xcfc5('0x25')](_0x1c61c5['query'][_0xcfc5('0x25')]);_0x3bb36f[_0xcfc5('0x23')]=qs['offset'](_0x1c61c5[_0xcfc5('0x38')][_0xcfc5('0x23')]);}return _0x395219[_0xcfc5('0x68')](_0x3bb36f);}})[_0xcfc5('0x2b')](function(_0x2d618c){if(_0x2d618c){return _0x2d618c?{'count':_0x590ae3,'rows':_0x2d618c}:null;}})[_0xcfc5('0x2b')](respondWithResult(_0x5a10cf,null))[_0xcfc5('0x4d')](handleError(_0x5a10cf,null));};exports['addTeams']=function(_0x42d626,_0x391b95,_0x5a51c3){var _0xbd0dd=_0x42d626[_0xcfc5('0x51')][_0xcfc5('0x69')];return db[_0xcfc5('0x6a')]['findAll']({'where':{'id':_0xbd0dd},'attributes':['id'],'include':[{'model':db[_0xcfc5('0x5e')],'as':_0xcfc5('0x6b'),'attributes':['id',_0xcfc5('0x30'),_0xcfc5('0x6c'),_0xcfc5('0x6d'),_0xcfc5('0x6e')],'raw':!![]}]})['then'](function(_0x51a029){if(_0x51a029){var _0x2b64f6=_[_0xcfc5('0x6f')](_0x51a029,function(_0x5ad256){var _0x4a580b=_0x5ad256[_0xcfc5('0x2d')]({'plain':!![]});return _0x4a580b[_0xcfc5('0x6b')];});return db['SmsQueue'][_0xcfc5('0x4f')]({'where':{'id':_0x42d626[_0xcfc5('0x59')]['id']}})[_0xcfc5('0x2b')](function(_0x1e4fa3){return db[_0xcfc5('0x70')][_0xcfc5('0x71')](function(_0x394f55){return _0x1e4fa3['addTeams'](_0xbd0dd,{'transaction':_0x394f55})[_0xcfc5('0x2b')](function(){return BPromise[_0xcfc5('0x72')](_0x2b64f6,function(_0x565813){return db['UserSmsQueue']['findOrCreate']({'where':{'UserId':_0x565813['id'],'SmsQueueId':_0x42d626[_0xcfc5('0x59')]['id']},'transaction':_0x394f55});});})['then'](function(){_0x2b64f6[_0xcfc5('0x73')](function(_0x35b7f7){socket['emit'](_0xcfc5('0x74'),{'UserId':_0x35b7f7['id'],'SmsQueueId':_0x1e4fa3['id']});});});});});}})[_0xcfc5('0x2b')](respondWithStatusCode(_0x391b95,null))[_0xcfc5('0x4d')](handleError(_0x391b95,null));};exports['removeTeams']=function(_0x1b72a3,_0xf79cbe,_0x464d36){return db[_0xcfc5('0x6a')][_0xcfc5('0x4c')]({'where':{'id':_0x1b72a3['query'][_0xcfc5('0x69')]},'attributes':['id'],'include':[{'model':db[_0xcfc5('0x5e')],'as':_0xcfc5('0x6b'),'attributes':['id'],'raw':!![]}]})[_0xcfc5('0x2b')](handleEntityNotFound(_0xf79cbe,null))[_0xcfc5('0x2b')](function(_0x53ad43){var _0x57069a=_[_0xcfc5('0x32')](_0x53ad43,'id');var _0x5b1598=[];var _0x508494=[];var _0x1058ba=squel['select']();_0x1058ba[_0xcfc5('0x75')](_0xcfc5('0x76'))[_0xcfc5('0x77')](_0xcfc5('0x78'),'tq')[_0xcfc5('0x79')](_0xcfc5('0x7a'),'ut',_0xcfc5('0x7b'))['where'](_0xcfc5('0x7c'),_0x1b72a3[_0xcfc5('0x59')]['id']);for(var _0x1e3ade=0x0;_0x1e3ade<_0x53ad43[_0xcfc5('0x3e')];_0x1e3ade+=0x1){let _0x8f1cd=_0x53ad43[_0x1e3ade];for(var _0x3ea874=0x0;_0x3ea874<_0x8f1cd[_0xcfc5('0x6b')][_0xcfc5('0x3e')];_0x3ea874+=0x1){let _0xe783ac=_0x8f1cd[_0xcfc5('0x6b')][_0x3ea874];var _0x419a26=_0x1058ba[_0xcfc5('0x7d')]();_0x419a26[_0xcfc5('0x43')](_0xcfc5('0x7e'),_0xe783ac['id']);_0x508494[_0xcfc5('0x7f')](db[_0xcfc5('0x70')][_0xcfc5('0x38')](_0x419a26[_0xcfc5('0x80')](),{'type':db[_0xcfc5('0x70')][_0xcfc5('0x81')][_0xcfc5('0x82')]})['then'](function(_0x5989a4){if(_0x5989a4['length']===0x1){return _0xe783ac['id'];}else{var _0x41b844=_['every'](_[_0xcfc5('0x32')](_0x5989a4,_0xcfc5('0x83')),function(_0x501899){return _['includes'](_0x57069a,_0x501899);});if(_0x41b844){return _0xe783ac['id'];}}}));}}return BPromise[_0xcfc5('0x84')](_0x508494)['then'](function(_0x5463a3){_0x5b1598=_(_0x5b1598)[_0xcfc5('0x85')](_0x5463a3)['compact']()[_0xcfc5('0x86')]();return db[_0xcfc5('0x4b')]['find']({'where':{'id':_0x1b72a3['params']['id']}})['then'](function(_0x7a3ab4){return db[_0xcfc5('0x70')][_0xcfc5('0x71')](function(_0x3c081e){return _0x7a3ab4[_0xcfc5('0x87')](_0x1b72a3[_0xcfc5('0x38')]['ids'],{'transaction':_0x3c081e})[_0xcfc5('0x2b')](function(){if(!_[_0xcfc5('0x88')](_0x5b1598)){return _0x7a3ab4[_0xcfc5('0x89')](_0x5b1598,{'transaction':_0x3c081e});}})[_0xcfc5('0x2b')](function(){_0x5b1598['forEach'](function(_0x5df35e){socket[_0xcfc5('0x8a')](_0xcfc5('0x8b'),{'UserId':_0x5df35e,'SmsQueueId':_0x7a3ab4['id']});});});});});});})[_0xcfc5('0x2b')](respondWithStatusCode(_0xf79cbe,null))[_0xcfc5('0x4d')](handleError(_0xf79cbe,null));};exports[_0xcfc5('0x8c')]=function(_0x51f352,_0x21d3cd,_0x57c2f6){return db['SmsQueue'][_0xcfc5('0x4f')]({'where':{'id':_0x51f352[_0xcfc5('0x59')]['id']}})[_0xcfc5('0x2b')](handleEntityNotFound(_0x21d3cd,null))['then'](function(_0xbddfcf){if(_0xbddfcf){return _0xbddfcf[_0xcfc5('0x8c')](_0x51f352[_0xcfc5('0x51')][_0xcfc5('0x69')],_[_0xcfc5('0x8d')](_0x51f352['body'],[_0xcfc5('0x69'),'id'])||{})[_0xcfc5('0x8e')](function(_0x4201db){for(var _0x4a58f5=0x0;_0x4a58f5<_0x51f352[_0xcfc5('0x51')][_0xcfc5('0x69')][_0xcfc5('0x3e')];_0x4a58f5+=0x1){socket['emit']('userSmsQueue:save',{'UserId':Number(_0x51f352[_0xcfc5('0x51')][_0xcfc5('0x69')][_0x4a58f5]),'SmsQueueId':Number(_0x51f352[_0xcfc5('0x59')]['id'])});}return _0x4201db;});}})[_0xcfc5('0x2b')](respondWithResult(_0x21d3cd,null))[_0xcfc5('0x4d')](handleError(_0x21d3cd,null));};exports['removeAgents']=function(_0x847868,_0x35b1cf,_0x228bdd){return db[_0xcfc5('0x4b')][_0xcfc5('0x4f')]({'where':{'id':_0x847868[_0xcfc5('0x59')]['id']}})[_0xcfc5('0x2b')](handleEntityNotFound(_0x35b1cf,null))[_0xcfc5('0x2b')](function(_0x21de0c){if(_0x21de0c){return _0x21de0c['removeAgents'](_0x847868[_0xcfc5('0x38')][_0xcfc5('0x69')])[_0xcfc5('0x2b')](function(){if(_[_0xcfc5('0x8f')](_0x847868['query'][_0xcfc5('0x69')])){for(var _0x1e762e=0x0;_0x1e762e<_0x847868[_0xcfc5('0x38')][_0xcfc5('0x69')]['length'];_0x1e762e+=0x1){socket[_0xcfc5('0x8a')](_0xcfc5('0x8b'),{'UserId':Number(_0x847868[_0xcfc5('0x38')][_0xcfc5('0x69')][_0x1e762e]),'SmsQueueId':Number(_0x847868[_0xcfc5('0x59')]['id'])});}}else{socket[_0xcfc5('0x8a')](_0xcfc5('0x8b'),{'UserId':Number(_0x847868[_0xcfc5('0x38')][_0xcfc5('0x69')]),'SmsQueueId':Number(_0x847868['params']['id'])});}});}})[_0xcfc5('0x2b')](respondWithStatusCode(_0x35b1cf,null))[_0xcfc5('0x4d')](handleError(_0x35b1cf,null));};exports[_0xcfc5('0x90')]=function(_0x403ca5,_0x60dfb1,_0x48cc8d){var _0x224005={};var _0x9e736e={};var _0x35aa9a;var _0x1f911f;return db[_0xcfc5('0x4b')]['findOne']({'where':{'id':_0x403ca5['params']['id']}})['then'](handleEntityNotFound(_0x60dfb1,null))['then'](function(_0x31928e){if(_0x31928e){_0x35aa9a=_0x31928e;_0x9e736e[_0xcfc5('0x37')]=_[_0xcfc5('0x39')](db['User'][_0xcfc5('0x33')]);_0x9e736e[_0xcfc5('0x38')]=_[_0xcfc5('0x39')](_0x403ca5['query']);_0x9e736e[_0xcfc5('0x3a')]=_['intersection'](_0x9e736e['model'],_0x9e736e[_0xcfc5('0x38')]);_0x224005[_0xcfc5('0x3c')]=_['intersection'](_0x9e736e[_0xcfc5('0x37')],qs[_0xcfc5('0x3d')](_0x403ca5[_0xcfc5('0x38')][_0xcfc5('0x3d')]));_0x224005[_0xcfc5('0x3c')]=_0x224005[_0xcfc5('0x3c')]['length']?_0x224005[_0xcfc5('0x3c')]:_0x9e736e['model'];_0x224005[_0xcfc5('0x41')]=qs[_0xcfc5('0x42')](_0x403ca5[_0xcfc5('0x38')][_0xcfc5('0x42')]);_0x224005[_0xcfc5('0x43')]=qs[_0xcfc5('0x3a')](_['pick'](_0x403ca5[_0xcfc5('0x38')],_0x9e736e[_0xcfc5('0x3a')]));if(_0x403ca5[_0xcfc5('0x38')]['filter']){_0x224005[_0xcfc5('0x43')]=_[_0xcfc5('0x47')](_0x224005[_0xcfc5('0x43')],{'$or':_[_0xcfc5('0x32')](_0x224005[_0xcfc5('0x3c')],function(_0x39c5b9){var _0xd9bcd9={};_0xd9bcd9[_0x39c5b9]={'$like':'%'+_0x403ca5['query'][_0xcfc5('0x45')]+'%'};return _0xd9bcd9;})});}_0x224005=_[_0xcfc5('0x47')]({},_0x224005,_0x403ca5[_0xcfc5('0x48')]);return _0x35aa9a[_0xcfc5('0x90')](_0x224005);}})['then'](function(_0xe3bd0){if(_0xe3bd0){_0x1f911f=_0xe3bd0['length'];if(!_0x403ca5[_0xcfc5('0x38')][_0xcfc5('0x3f')](_0xcfc5('0x40'))){_0x224005[_0xcfc5('0x25')]=qs[_0xcfc5('0x25')](_0x403ca5[_0xcfc5('0x38')]['limit']);_0x224005['offset']=qs[_0xcfc5('0x23')](_0x403ca5[_0xcfc5('0x38')][_0xcfc5('0x23')]);}return _0x35aa9a[_0xcfc5('0x90')](_0x224005);}})[_0xcfc5('0x2b')](function(_0x2de679){if(_0x2de679){return _0x2de679?{'count':_0x1f911f,'rows':_0x2de679}:null;}})['then'](respondWithResult(_0x60dfb1,null))['catch'](handleError(_0x60dfb1,null));}; \ No newline at end of file +var _0x1b07=['to-csv','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','get','SmsQueues','UserProfileResource','destroy','error','name','send','index','SmsQueue','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','merge','where','options','includeAll','findAll','catch','show','params','include','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','body','find','describe','nolimit','SmsQueueId','UserSmsQueue','findAndCountAll','UserId','smsPause','updatedAt','createdAt','map','rows','format','SIP','getTeams','Team','addTeams','User','Agents','voicePause','interface','flatMap','sequelize','transaction','each','emit','userSmsQueue:save','removeTeams','select','field','tq.TeamId','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','QueryTypes','every','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','addAgents','ids','omit','spread','isArray','userSmsQueue:remove','getAgents','findOne','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox'];(function(_0x1caee0,_0x3debcd){var _0x28d148=function(_0x285da7){while(--_0x285da7){_0x1caee0['push'](_0x1caee0['shift']());}};_0x28d148(++_0x3debcd);}(_0x1b07,0x198));var _0x71b0=function(_0x1d7300,_0x17f109){_0x1d7300=_0x1d7300-0x0;var _0x46ee98=_0x1b07[_0x1d7300];return _0x46ee98;};'use strict';var emlformat=require(_0x71b0('0x0'));var rimraf=require(_0x71b0('0x1'));var zipdir=require(_0x71b0('0x2'));var jsonpatch=require(_0x71b0('0x3'));var rp=require('request-promise');var moment=require(_0x71b0('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x71b0('0x5'));var util=require(_0x71b0('0x6'));var path=require(_0x71b0('0x7'));var sox=require(_0x71b0('0x8'));var csv=require(_0x71b0('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x71b0('0xa'));var _=require('lodash');var squel=require(_0x71b0('0xb'));var crypto=require(_0x71b0('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x71b0('0xd'));var toCsv=require('to-csv');var querystring=require(_0x71b0('0xe'));var Papa=require(_0x71b0('0xf'));var Redis=require(_0x71b0('0x10'));var authService=require(_0x71b0('0x11'));var qs=require(_0x71b0('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x71b0('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x71b0('0x14'));var config=require(_0x71b0('0x15'));var licenseUtil=require(_0x71b0('0x16'));var db=require(_0x71b0('0x17'))['db'];config[_0x71b0('0x18')]=_[_0x71b0('0x19')](config[_0x71b0('0x18')],{'host':_0x71b0('0x1a'),'port':0x18eb});var socket=require(_0x71b0('0x1b'))(new Redis(config[_0x71b0('0x18')]));require('./smsQueue.socket')[_0x71b0('0x1c')](socket);function respondWithStatusCode(_0x38c588,_0x52215c){_0x52215c=_0x52215c||0xcc;return function(_0x22a878){if(_0x22a878){return _0x38c588['sendStatus'](_0x52215c);}return _0x38c588[_0x71b0('0x1d')](_0x52215c)[_0x71b0('0x1e')]();};}function respondWithResult(_0x4832ee,_0x467bdc){_0x467bdc=_0x467bdc||0xc8;return function(_0x55d343){if(_0x55d343){return _0x4832ee[_0x71b0('0x1d')](_0x467bdc)[_0x71b0('0x1f')](_0x55d343);}};}function respondWithFilteredResult(_0x24cf0b,_0x2cbf01){return function(_0x1a2934){if(_0x1a2934){var _0x3fbdce=typeof _0x2cbf01[_0x71b0('0x20')]===_0x71b0('0x21')&&typeof _0x2cbf01[_0x71b0('0x22')]===_0x71b0('0x21');var _0x5c7359=_0x1a2934[_0x71b0('0x23')];var _0x270963=_0x3fbdce?0x0:_0x2cbf01[_0x71b0('0x20')];var _0x3b2866=_0x3fbdce?_0x1a2934['count']:_0x2cbf01['offset']+_0x2cbf01[_0x71b0('0x22')];var _0x162846;if(_0x3b2866>=_0x5c7359){_0x3b2866=_0x5c7359;_0x162846=0xc8;}else{_0x162846=0xce;}_0x24cf0b[_0x71b0('0x1d')](_0x162846);return _0x24cf0b[_0x71b0('0x24')](_0x71b0('0x25'),_0x270963+'-'+_0x3b2866+'/'+_0x5c7359)[_0x71b0('0x1f')](_0x1a2934);}return null;};}function patchUpdates(_0xf6b808){return function(_0x30d450){try{jsonpatch[_0x71b0('0x26')](_0x30d450,_0xf6b808,!![]);}catch(_0x4faad1){return BPromise[_0x71b0('0x27')](_0x4faad1);}return _0x30d450[_0x71b0('0x28')]();};}function saveUpdates(_0x94e361,_0x1b4e7d){return function(_0x4590db){if(_0x4590db){return _0x4590db[_0x71b0('0x29')](_0x94e361)[_0x71b0('0x2a')](function(_0x1b4921){return _0x1b4921;});}return null;};}function removeEntity(_0x2191f4,_0x1ec02b){return function(_0x55cb16){if(_0x55cb16){return _0x55cb16['destroy']()[_0x71b0('0x2a')](function(){var _0x3f54ab=_0x55cb16[_0x71b0('0x2b')]({'plain':!![]});var _0x1874a0=_0x71b0('0x2c');return db[_0x71b0('0x2d')][_0x71b0('0x2e')]({'where':{'type':_0x1874a0,'resourceId':_0x3f54ab['id']}})['then'](function(){return _0x55cb16;});})[_0x71b0('0x2a')](function(){_0x2191f4['status'](0xcc)[_0x71b0('0x1e')]();});}};}function handleEntityNotFound(_0x309052,_0x3062b3){return function(_0x53ca45){if(!_0x53ca45){_0x309052['sendStatus'](0x194);}return _0x53ca45;};}function handleError(_0x78b0b5,_0x100aa3){_0x100aa3=_0x100aa3||0x1f4;return function(_0x13fabd){logger[_0x71b0('0x2f')](_0x13fabd['stack']);if(_0x13fabd[_0x71b0('0x30')]){delete _0x13fabd[_0x71b0('0x30')];}_0x78b0b5[_0x71b0('0x1d')](_0x100aa3)[_0x71b0('0x31')](_0x13fabd);};}exports[_0x71b0('0x32')]=function(_0x2cce89,_0x26cdb4){var _0x2f89cc={},_0x248004={},_0x267883={'count':0x0,'rows':[]};var _0x4f8b11=_['map'](db[_0x71b0('0x33')][_0x71b0('0x34')],function(_0x14caaa){return{'name':_0x14caaa[_0x71b0('0x35')],'type':_0x14caaa[_0x71b0('0x36')][_0x71b0('0x37')]};});_0x248004[_0x71b0('0x38')]=_['map'](_0x4f8b11,_0x71b0('0x30'));_0x248004[_0x71b0('0x39')]=_[_0x71b0('0x3a')](_0x2cce89[_0x71b0('0x39')]);_0x248004[_0x71b0('0x3b')]=_[_0x71b0('0x3c')](_0x248004[_0x71b0('0x38')],_0x248004['query']);_0x2f89cc['attributes']=_[_0x71b0('0x3c')](_0x248004[_0x71b0('0x38')],qs['fields'](_0x2cce89[_0x71b0('0x39')][_0x71b0('0x3d')]));_0x2f89cc[_0x71b0('0x3e')]=_0x2f89cc['attributes'][_0x71b0('0x3f')]?_0x2f89cc['attributes']:_0x248004[_0x71b0('0x38')];if(!_0x2cce89['query'][_0x71b0('0x40')]('nolimit')){_0x2f89cc[_0x71b0('0x22')]=qs['limit'](_0x2cce89[_0x71b0('0x39')][_0x71b0('0x22')]);_0x2f89cc[_0x71b0('0x20')]=qs['offset'](_0x2cce89[_0x71b0('0x39')]['offset']);}_0x2f89cc[_0x71b0('0x41')]=qs[_0x71b0('0x42')](_0x2cce89[_0x71b0('0x39')]['sort']);_0x2f89cc['where']=qs[_0x71b0('0x3b')](_[_0x71b0('0x43')](_0x2cce89[_0x71b0('0x39')],_0x248004[_0x71b0('0x3b')]),_0x4f8b11);if(_0x2cce89[_0x71b0('0x39')][_0x71b0('0x44')]){_0x2f89cc['where']=_[_0x71b0('0x45')](_0x2f89cc[_0x71b0('0x46')],{'$or':_['map'](_0x4f8b11,function(_0x3d054b){if(_0x3d054b[_0x71b0('0x36')]!=='VIRTUAL'){var _0xbc8454={};_0xbc8454[_0x3d054b[_0x71b0('0x30')]]={'$like':'%'+_0x2cce89[_0x71b0('0x39')]['filter']+'%'};return _0xbc8454;}})});}_0x2f89cc=_['merge']({},_0x2f89cc,_0x2cce89[_0x71b0('0x47')]);var _0x33e7e9={'where':_0x2f89cc['where']};return db[_0x71b0('0x33')]['count'](_0x33e7e9)['then'](function(_0x4dcfd1){_0x267883[_0x71b0('0x23')]=_0x4dcfd1;if(_0x2cce89[_0x71b0('0x39')][_0x71b0('0x48')]){_0x2f89cc['include']=[{'all':!![]}];}return db['SmsQueue'][_0x71b0('0x49')](_0x2f89cc);})[_0x71b0('0x2a')](function(_0x4ae2e0){_0x267883['rows']=_0x4ae2e0;return _0x267883;})['then'](respondWithFilteredResult(_0x26cdb4,_0x2f89cc))[_0x71b0('0x4a')](handleError(_0x26cdb4,null));};exports[_0x71b0('0x4b')]=function(_0x28ed42,_0xaf12a){var _0x368044={'raw':!![],'where':{'id':_0x28ed42[_0x71b0('0x4c')]['id']}},_0x199bc2={};_0x199bc2[_0x71b0('0x38')]=_['keys'](db[_0x71b0('0x33')]['rawAttributes']);_0x199bc2[_0x71b0('0x39')]=_[_0x71b0('0x3a')](_0x28ed42['query']);_0x199bc2['filters']=_[_0x71b0('0x3c')](_0x199bc2[_0x71b0('0x38')],_0x199bc2[_0x71b0('0x39')]);_0x368044[_0x71b0('0x3e')]=_[_0x71b0('0x3c')](_0x199bc2[_0x71b0('0x38')],qs[_0x71b0('0x3d')](_0x28ed42[_0x71b0('0x39')][_0x71b0('0x3d')]));_0x368044[_0x71b0('0x3e')]=_0x368044[_0x71b0('0x3e')][_0x71b0('0x3f')]?_0x368044[_0x71b0('0x3e')]:_0x199bc2[_0x71b0('0x38')];if(_0x28ed42[_0x71b0('0x39')][_0x71b0('0x48')]){_0x368044[_0x71b0('0x4d')]=[{'all':!![]}];}_0x368044=_[_0x71b0('0x45')]({},_0x368044,_0x28ed42[_0x71b0('0x47')]);return db[_0x71b0('0x33')]['find'](_0x368044)['then'](handleEntityNotFound(_0xaf12a,null))[_0x71b0('0x2a')](respondWithResult(_0xaf12a,null))[_0x71b0('0x4a')](handleError(_0xaf12a,null));};exports[_0x71b0('0x4e')]=function(_0x443744,_0x5bfa41){return db[_0x71b0('0x33')][_0x71b0('0x4e')](_0x443744['body'],{})[_0x71b0('0x2a')](function(_0x2a62f5){var _0x47f78a=_0x443744[_0x71b0('0x4f')][_0x71b0('0x2b')]({'plain':!![]});if(!_0x47f78a)throw new Error(_0x71b0('0x50'));if(_0x47f78a['role']===_0x71b0('0x4f')){var _0x168577=_0x2a62f5[_0x71b0('0x2b')]({'plain':!![]});var _0x37fc43=_0x71b0('0x2c');return db['UserProfileSection']['find']({'where':{'name':_0x37fc43,'userProfileId':_0x47f78a[_0x71b0('0x51')]},'raw':!![]})['then'](function(_0x24f50c){if(_0x24f50c&&_0x24f50c[_0x71b0('0x52')]===0x0){return db[_0x71b0('0x2d')][_0x71b0('0x4e')]({'name':_0x168577[_0x71b0('0x30')],'resourceId':_0x168577['id'],'type':_0x24f50c[_0x71b0('0x30')],'sectionId':_0x24f50c['id']},{})[_0x71b0('0x2a')](function(){return _0x2a62f5;});}else{return _0x2a62f5;}})[_0x71b0('0x4a')](function(_0x42287d){logger[_0x71b0('0x2f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x42287d);throw _0x42287d;});}return _0x2a62f5;})[_0x71b0('0x2a')](respondWithResult(_0x5bfa41,0xc9))[_0x71b0('0x4a')](handleError(_0x5bfa41,null));};exports['update']=function(_0x5df56d,_0x3fc865){if(_0x5df56d[_0x71b0('0x53')]['id']){delete _0x5df56d[_0x71b0('0x53')]['id'];}return db[_0x71b0('0x33')][_0x71b0('0x54')]({'where':{'id':_0x5df56d[_0x71b0('0x4c')]['id']}})['then'](handleEntityNotFound(_0x3fc865,null))[_0x71b0('0x2a')](saveUpdates(_0x5df56d['body'],null))['then'](respondWithResult(_0x3fc865,null))[_0x71b0('0x4a')](handleError(_0x3fc865,null));};exports[_0x71b0('0x2e')]=function(_0x495aee,_0x2d0b9d){return db[_0x71b0('0x33')][_0x71b0('0x54')]({'where':{'id':_0x495aee[_0x71b0('0x4c')]['id']}})['then'](handleEntityNotFound(_0x2d0b9d,null))[_0x71b0('0x2a')](removeEntity(_0x2d0b9d,null))[_0x71b0('0x4a')](handleError(_0x2d0b9d,null));};exports[_0x71b0('0x55')]=function(_0x560814,_0x2feb5c){return db[_0x71b0('0x33')][_0x71b0('0x55')]()[_0x71b0('0x2a')](respondWithResult(_0x2feb5c,null))[_0x71b0('0x4a')](handleError(_0x2feb5c,null));};exports['getMembers']=function(_0x5f3351,_0xd376cb,_0x48696a){var _0x52f00c={'raw':!![],'where':{}},_0x1b817f={},_0x468da2;return db['SmsQueue']['findOne']({'where':{'id':_0x5f3351['params']['id']}})[_0x71b0('0x2a')](handleEntityNotFound(_0xd376cb,null))[_0x71b0('0x2a')](function(_0x76c96a){if(_0x76c96a){_0x468da2=_0x76c96a['get']({'plain':!![]});_0x1b817f['model']=_[_0x71b0('0x3a')](db['UserSmsQueue'][_0x71b0('0x34')]);_0x1b817f[_0x71b0('0x39')]=_[_0x71b0('0x3a')](_0x5f3351[_0x71b0('0x39')]);_0x1b817f[_0x71b0('0x3b')]=_[_0x71b0('0x3c')](_0x1b817f[_0x71b0('0x38')],_0x1b817f[_0x71b0('0x39')]);_0x52f00c[_0x71b0('0x3e')]=_[_0x71b0('0x3c')](_0x1b817f[_0x71b0('0x38')],qs[_0x71b0('0x3d')](_0x5f3351['query']['fields']));_0x52f00c[_0x71b0('0x3e')]=_0x52f00c[_0x71b0('0x3e')][_0x71b0('0x3f')]?_0x52f00c[_0x71b0('0x3e')]:_0x1b817f['model'];if(!_0x5f3351[_0x71b0('0x39')][_0x71b0('0x40')](_0x71b0('0x56'))){_0x52f00c[_0x71b0('0x22')]=qs[_0x71b0('0x22')](_0x5f3351[_0x71b0('0x39')][_0x71b0('0x22')]);_0x52f00c['offset']=qs[_0x71b0('0x20')](_0x5f3351[_0x71b0('0x39')]['offset']);}_0x52f00c['order']=qs[_0x71b0('0x42')](_0x5f3351['query'][_0x71b0('0x42')]);_0x52f00c[_0x71b0('0x46')]=qs[_0x71b0('0x3b')](_[_0x71b0('0x43')](_0x5f3351['query'],_0x1b817f[_0x71b0('0x3b')]));_0x52f00c[_0x71b0('0x46')][_0x71b0('0x57')]=_0x76c96a['id'];if(_0x5f3351[_0x71b0('0x39')][_0x71b0('0x44')]){_0x52f00c[_0x71b0('0x46')]=_[_0x71b0('0x45')](_0x52f00c[_0x71b0('0x46')],{'$or':_['map'](_0x52f00c[_0x71b0('0x3e')],function(_0x368cce){var _0xc1a7dd={};_0xc1a7dd[_0x368cce]={'$like':'%'+_0x5f3351['query'][_0x71b0('0x44')]+'%'};return _0xc1a7dd;})});}_0x52f00c=_[_0x71b0('0x45')]({},_0x52f00c,_0x5f3351['options']);return db[_0x71b0('0x58')]['findAll'](_0x52f00c);}})[_0x71b0('0x2a')](function(_0x5433f9){if(_0x5433f9){return db['User'][_0x71b0('0x59')]({'where':{'id':_['map'](_0x5433f9,_0x71b0('0x5a')),'role':'agent'},'attributes':['id',_0x71b0('0x30'),_0x71b0('0x5b'),_0x71b0('0x5c'),_0x71b0('0x5d')]});}})['then'](function(_0x17a6cf){if(_0x17a6cf){return{'count':_0x17a6cf[_0x71b0('0x23')],'rows':_[_0x71b0('0x5e')](_0x17a6cf[_0x71b0('0x5f')],function(_0xb24caf){return{'membername':_0xb24caf[_0x71b0('0x30')],'UserId':_0xb24caf['id'],'queue_name':_0x468da2['name'],'SmsQueueId':_0x468da2['id'],'interface':util[_0x71b0('0x60')]('%s/%s',_0x71b0('0x61'),_0xb24caf[_0x71b0('0x30')]),'penalty':0x0,'paused':_0xb24caf[_0x71b0('0x5b')],'createdAt':_0xb24caf['createdAt'],'updatedAt':_0xb24caf[_0x71b0('0x5c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x71b0('0x2a')](respondWithFilteredResult(_0xd376cb,_0x52f00c))[_0x71b0('0x4a')](handleError(_0xd376cb,null));};exports[_0x71b0('0x62')]=function(_0x50cc8e,_0x47186a,_0x97f461){var _0x57f10b={};var _0x295b5f={};var _0x4a01c0;var _0x7847;return db[_0x71b0('0x33')]['findOne']({'where':{'id':_0x50cc8e[_0x71b0('0x4c')]['id']}})['then'](handleEntityNotFound(_0x47186a,null))[_0x71b0('0x2a')](function(_0x556692){if(_0x556692){_0x4a01c0=_0x556692;_0x295b5f['model']=_[_0x71b0('0x3a')](db[_0x71b0('0x63')][_0x71b0('0x34')]);_0x295b5f[_0x71b0('0x39')]=_[_0x71b0('0x3a')](_0x50cc8e[_0x71b0('0x39')]);_0x295b5f[_0x71b0('0x3b')]=_['intersection'](_0x295b5f[_0x71b0('0x38')],_0x295b5f['query']);_0x57f10b[_0x71b0('0x3e')]=_[_0x71b0('0x3c')](_0x295b5f['model'],qs[_0x71b0('0x3d')](_0x50cc8e[_0x71b0('0x39')][_0x71b0('0x3d')]));_0x57f10b['attributes']=_0x57f10b[_0x71b0('0x3e')][_0x71b0('0x3f')]?_0x57f10b['attributes']:_0x295b5f[_0x71b0('0x38')];_0x57f10b['order']=qs[_0x71b0('0x42')](_0x50cc8e[_0x71b0('0x39')][_0x71b0('0x42')]);_0x57f10b[_0x71b0('0x46')]=qs[_0x71b0('0x3b')](_[_0x71b0('0x43')](_0x50cc8e[_0x71b0('0x39')],_0x295b5f[_0x71b0('0x3b')]));if(_0x50cc8e[_0x71b0('0x39')]['filter']){_0x57f10b[_0x71b0('0x46')]=_[_0x71b0('0x45')](_0x57f10b[_0x71b0('0x46')],{'$or':_[_0x71b0('0x5e')](_0x57f10b[_0x71b0('0x3e')],function(_0x88ea4d){var _0x54280c={};_0x54280c[_0x88ea4d]={'$like':'%'+_0x50cc8e[_0x71b0('0x39')]['filter']+'%'};return _0x54280c;})});}_0x57f10b=_[_0x71b0('0x45')]({},_0x57f10b,_0x50cc8e[_0x71b0('0x47')]);return _0x4a01c0[_0x71b0('0x62')](_0x57f10b);}})[_0x71b0('0x2a')](function(_0x1742a2){if(_0x1742a2){_0x7847=_0x1742a2[_0x71b0('0x3f')];if(!_0x50cc8e[_0x71b0('0x39')][_0x71b0('0x40')](_0x71b0('0x56'))){_0x57f10b['limit']=qs[_0x71b0('0x22')](_0x50cc8e[_0x71b0('0x39')][_0x71b0('0x22')]);_0x57f10b[_0x71b0('0x20')]=qs[_0x71b0('0x20')](_0x50cc8e[_0x71b0('0x39')]['offset']);}return _0x4a01c0[_0x71b0('0x62')](_0x57f10b);}})[_0x71b0('0x2a')](function(_0x4bd050){if(_0x4bd050){return _0x4bd050?{'count':_0x7847,'rows':_0x4bd050}:null;}})[_0x71b0('0x2a')](respondWithResult(_0x47186a,null))[_0x71b0('0x4a')](handleError(_0x47186a,null));};exports[_0x71b0('0x64')]=function(_0x1a243e,_0x393bb3,_0x43ac9e){var _0x2b9a5b=_0x1a243e[_0x71b0('0x53')]['ids'];return db['Team']['findAll']({'where':{'id':_0x2b9a5b},'attributes':['id'],'include':[{'model':db[_0x71b0('0x65')],'as':_0x71b0('0x66'),'attributes':['id',_0x71b0('0x30'),'online',_0x71b0('0x67'),_0x71b0('0x68')],'raw':!![]}]})[_0x71b0('0x2a')](function(_0x14486e){if(_0x14486e){var _0x1aa286=_[_0x71b0('0x69')](_0x14486e,function(_0x4d7c0b){var _0xd23f3a=_0x4d7c0b[_0x71b0('0x2b')]({'plain':!![]});return _0xd23f3a['Agents'];});return db[_0x71b0('0x33')][_0x71b0('0x54')]({'where':{'id':_0x1a243e[_0x71b0('0x4c')]['id']}})[_0x71b0('0x2a')](function(_0x289541){return db[_0x71b0('0x6a')][_0x71b0('0x6b')](function(_0x37a4e7){return _0x289541['addTeams'](_0x2b9a5b,{'transaction':_0x37a4e7})[_0x71b0('0x2a')](function(){return BPromise[_0x71b0('0x6c')](_0x1aa286,function(_0x223365){return db[_0x71b0('0x58')]['findOrCreate']({'where':{'UserId':_0x223365['id'],'SmsQueueId':_0x1a243e['params']['id']},'transaction':_0x37a4e7});});})['then'](function(){_0x1aa286['forEach'](function(_0x4c566e){socket[_0x71b0('0x6d')](_0x71b0('0x6e'),{'UserId':_0x4c566e['id'],'SmsQueueId':_0x289541['id']});});});});});}})[_0x71b0('0x2a')](respondWithStatusCode(_0x393bb3,null))[_0x71b0('0x4a')](handleError(_0x393bb3,null));};exports[_0x71b0('0x6f')]=function(_0x4eec07,_0x3822c1,_0x580709){return db['Team'][_0x71b0('0x49')]({'where':{'id':_0x4eec07[_0x71b0('0x39')]['ids']},'attributes':['id'],'include':[{'model':db[_0x71b0('0x65')],'as':_0x71b0('0x66'),'attributes':['id'],'raw':!![]}]})[_0x71b0('0x2a')](handleEntityNotFound(_0x3822c1,null))['then'](function(_0x218a3e){var _0x5cc9df=_[_0x71b0('0x5e')](_0x218a3e,'id');var _0x5ded9a=[];var _0x2fcb57=[];var _0x438ec1=squel[_0x71b0('0x70')]();_0x438ec1[_0x71b0('0x71')](_0x71b0('0x72'))['from'](_0x71b0('0x73'),'tq')[_0x71b0('0x74')](_0x71b0('0x75'),'ut',_0x71b0('0x76'))['where']('SmsQueueId\x20=\x20?',_0x4eec07['params']['id']);for(var _0x53eb86=0x0;_0x53eb86<_0x218a3e[_0x71b0('0x3f')];_0x53eb86+=0x1){let _0x2b86e4=_0x218a3e[_0x53eb86];for(var _0x5b4183=0x0;_0x5b4183<_0x2b86e4[_0x71b0('0x66')][_0x71b0('0x3f')];_0x5b4183+=0x1){let _0x3a7233=_0x2b86e4[_0x71b0('0x66')][_0x5b4183];var _0x1845b2=_0x438ec1[_0x71b0('0x77')]();_0x1845b2[_0x71b0('0x46')](_0x71b0('0x78'),_0x3a7233['id']);_0x2fcb57['push'](db['sequelize'][_0x71b0('0x39')](_0x1845b2['toString'](),{'type':db[_0x71b0('0x6a')][_0x71b0('0x79')]['SELECT']})[_0x71b0('0x2a')](function(_0x4b6b91){if(_0x4b6b91[_0x71b0('0x3f')]===0x1){return _0x3a7233['id'];}else{var _0x2ace7e=_[_0x71b0('0x7a')](_[_0x71b0('0x5e')](_0x4b6b91,_0x71b0('0x7b')),function(_0x35850f){return _[_0x71b0('0x7c')](_0x5cc9df,_0x35850f);});if(_0x2ace7e){return _0x3a7233['id'];}}}));}}return BPromise[_0x71b0('0x7d')](_0x2fcb57)['then'](function(_0x30407a){_0x5ded9a=_(_0x5ded9a)[_0x71b0('0x7e')](_0x30407a)[_0x71b0('0x7f')]()[_0x71b0('0x80')]();return db[_0x71b0('0x33')]['find']({'where':{'id':_0x4eec07[_0x71b0('0x4c')]['id']}})['then'](function(_0x4d23c6){return db['sequelize']['transaction'](function(_0x2e6fb5){return _0x4d23c6[_0x71b0('0x6f')](_0x4eec07[_0x71b0('0x39')]['ids'],{'transaction':_0x2e6fb5})[_0x71b0('0x2a')](function(){if(!_[_0x71b0('0x81')](_0x5ded9a)){return _0x4d23c6[_0x71b0('0x82')](_0x5ded9a,{'transaction':_0x2e6fb5});}})[_0x71b0('0x2a')](function(){_0x5ded9a['forEach'](function(_0x302ae5){socket[_0x71b0('0x6d')]('userSmsQueue:remove',{'UserId':_0x302ae5,'SmsQueueId':_0x4d23c6['id']});});});});});});})[_0x71b0('0x2a')](respondWithStatusCode(_0x3822c1,null))['catch'](handleError(_0x3822c1,null));};exports[_0x71b0('0x83')]=function(_0x49c113,_0x55c155,_0x15775e){return db[_0x71b0('0x33')][_0x71b0('0x54')]({'where':{'id':_0x49c113[_0x71b0('0x4c')]['id']}})[_0x71b0('0x2a')](handleEntityNotFound(_0x55c155,null))[_0x71b0('0x2a')](function(_0x5a3a39){if(_0x5a3a39){return _0x5a3a39['addAgents'](_0x49c113[_0x71b0('0x53')][_0x71b0('0x84')],_[_0x71b0('0x85')](_0x49c113[_0x71b0('0x53')],[_0x71b0('0x84'),'id'])||{})[_0x71b0('0x86')](function(_0x138ee9){for(var _0x5b068a=0x0;_0x5b068a<_0x49c113['body'][_0x71b0('0x84')][_0x71b0('0x3f')];_0x5b068a+=0x1){socket[_0x71b0('0x6d')](_0x71b0('0x6e'),{'UserId':Number(_0x49c113['body'][_0x71b0('0x84')][_0x5b068a]),'SmsQueueId':Number(_0x49c113['params']['id'])});}return _0x138ee9;});}})[_0x71b0('0x2a')](respondWithResult(_0x55c155,null))[_0x71b0('0x4a')](handleError(_0x55c155,null));};exports['removeAgents']=function(_0x1b2f00,_0x4a2ac2,_0x5f27c8){return db[_0x71b0('0x33')][_0x71b0('0x54')]({'where':{'id':_0x1b2f00[_0x71b0('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4a2ac2,null))[_0x71b0('0x2a')](function(_0x3e97d8){if(_0x3e97d8){return _0x3e97d8['removeAgents'](_0x1b2f00['query'][_0x71b0('0x84')])[_0x71b0('0x2a')](function(){if(_[_0x71b0('0x87')](_0x1b2f00[_0x71b0('0x39')]['ids'])){for(var _0x58bd88=0x0;_0x58bd88<_0x1b2f00[_0x71b0('0x39')]['ids'][_0x71b0('0x3f')];_0x58bd88+=0x1){socket[_0x71b0('0x6d')](_0x71b0('0x88'),{'UserId':Number(_0x1b2f00[_0x71b0('0x39')][_0x71b0('0x84')][_0x58bd88]),'SmsQueueId':Number(_0x1b2f00[_0x71b0('0x4c')]['id'])});}}else{socket['emit']('userSmsQueue:remove',{'UserId':Number(_0x1b2f00[_0x71b0('0x39')][_0x71b0('0x84')]),'SmsQueueId':Number(_0x1b2f00['params']['id'])});}});}})['then'](respondWithStatusCode(_0x4a2ac2,null))[_0x71b0('0x4a')](handleError(_0x4a2ac2,null));};exports[_0x71b0('0x89')]=function(_0x21bf3c,_0x54d5e5,_0x40df2b){var _0x531319={};var _0x4e1e6f={};var _0x4229b0;var _0x3c6e24;return db[_0x71b0('0x33')][_0x71b0('0x8a')]({'where':{'id':_0x21bf3c[_0x71b0('0x4c')]['id']}})[_0x71b0('0x2a')](handleEntityNotFound(_0x54d5e5,null))[_0x71b0('0x2a')](function(_0x9c2f46){if(_0x9c2f46){_0x4229b0=_0x9c2f46;_0x4e1e6f[_0x71b0('0x38')]=_[_0x71b0('0x3a')](db['User'][_0x71b0('0x34')]);_0x4e1e6f[_0x71b0('0x39')]=_[_0x71b0('0x3a')](_0x21bf3c[_0x71b0('0x39')]);_0x4e1e6f[_0x71b0('0x3b')]=_['intersection'](_0x4e1e6f[_0x71b0('0x38')],_0x4e1e6f[_0x71b0('0x39')]);_0x531319['attributes']=_[_0x71b0('0x3c')](_0x4e1e6f['model'],qs[_0x71b0('0x3d')](_0x21bf3c['query'][_0x71b0('0x3d')]));_0x531319[_0x71b0('0x3e')]=_0x531319['attributes'][_0x71b0('0x3f')]?_0x531319[_0x71b0('0x3e')]:_0x4e1e6f[_0x71b0('0x38')];_0x531319[_0x71b0('0x41')]=qs[_0x71b0('0x42')](_0x21bf3c[_0x71b0('0x39')][_0x71b0('0x42')]);_0x531319['where']=qs[_0x71b0('0x3b')](_[_0x71b0('0x43')](_0x21bf3c[_0x71b0('0x39')],_0x4e1e6f[_0x71b0('0x3b')]));if(_0x21bf3c['query'][_0x71b0('0x44')]){_0x531319[_0x71b0('0x46')]=_[_0x71b0('0x45')](_0x531319[_0x71b0('0x46')],{'$or':_[_0x71b0('0x5e')](_0x531319[_0x71b0('0x3e')],function(_0x5ef150){var _0x4dca7b={};_0x4dca7b[_0x5ef150]={'$like':'%'+_0x21bf3c['query']['filter']+'%'};return _0x4dca7b;})});}_0x531319=_['merge']({},_0x531319,_0x21bf3c['options']);return _0x4229b0[_0x71b0('0x89')](_0x531319);}})[_0x71b0('0x2a')](function(_0x120e98){if(_0x120e98){_0x3c6e24=_0x120e98[_0x71b0('0x3f')];if(!_0x21bf3c[_0x71b0('0x39')]['hasOwnProperty'](_0x71b0('0x56'))){_0x531319[_0x71b0('0x22')]=qs[_0x71b0('0x22')](_0x21bf3c[_0x71b0('0x39')][_0x71b0('0x22')]);_0x531319[_0x71b0('0x20')]=qs[_0x71b0('0x20')](_0x21bf3c[_0x71b0('0x39')][_0x71b0('0x20')]);}return _0x4229b0[_0x71b0('0x89')](_0x531319);}})[_0x71b0('0x2a')](function(_0x2257e3){if(_0x2257e3){return _0x2257e3?{'count':_0x3c6e24,'rows':_0x2257e3}:null;}})[_0x71b0('0x2a')](respondWithResult(_0x54d5e5,null))[_0x71b0('0x4a')](handleError(_0x54d5e5,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index c29d7c7..80bed09 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 _0x82e4=['update','remove','emit','hasOwnProperty','exports','events','save'];(function(_0x3b4091,_0x5b8285){var _0x2a1d99=function(_0x1b0828){while(--_0x1b0828){_0x3b4091['push'](_0x3b4091['shift']());}};_0x2a1d99(++_0x5b8285);}(_0x82e4,0x147));var _0x482e=function(_0x368fb9,_0x1a9895){_0x368fb9=_0x368fb9-0x0;var _0x4892fb=_0x82e4[_0x368fb9];return _0x4892fb;};'use strict';var EventEmitter=require(_0x482e('0x0'));var SmsQueue=require('../../mysqldb')['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x482e('0x1'),'afterUpdate':_0x482e('0x2'),'afterDestroy':_0x482e('0x3')};function emitEvent(_0x2284b5){return function(_0x32a404,_0xbb1ecd,_0x5c1a51){SmsQueueEvents[_0x482e('0x4')](_0x2284b5+':'+_0x32a404['id'],_0x32a404);SmsQueueEvents['emit'](_0x2284b5,_0x32a404);_0x5c1a51(null);};}for(var e in events){if(events[_0x482e('0x5')](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module[_0x482e('0x6')]=SmsQueueEvents; \ No newline at end of file +var _0xc8b2=['../../mysqldb','SmsQueue','setMaxListeners','save','remove','emit','hook','exports'];(function(_0x1adf6b,_0x357418){var _0x1a7fcc=function(_0x1a20c7){while(--_0x1a20c7){_0x1adf6b['push'](_0x1adf6b['shift']());}};_0x1a7fcc(++_0x357418);}(_0xc8b2,0xc0));var _0x2c8b=function(_0x369b32,_0x3ed53f){_0x369b32=_0x369b32-0x0;var _0x50172b=_0xc8b2[_0x369b32];return _0x50172b;};'use strict';var EventEmitter=require('events');var SmsQueue=require(_0x2c8b('0x0'))['db'][_0x2c8b('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x2c8b('0x2')](0x0);var events={'afterCreate':_0x2c8b('0x3'),'afterUpdate':'update','afterDestroy':_0x2c8b('0x4')};function emitEvent(_0x5ed03b){return function(_0x3176ff,_0x5bad2e,_0x2b3cd7){SmsQueueEvents[_0x2c8b('0x5')](_0x5ed03b+':'+_0x3176ff['id'],_0x3176ff);SmsQueueEvents[_0x2c8b('0x5')](_0x5ed03b,_0x3176ff);_0x2b3cd7(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue[_0x2c8b('0x6')](e,emitEvent(event));}}module[_0x2c8b('0x7')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 24e8cac..863947b 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 _0xc3c0=['path','exports','define','SmsQueue','sms_queues','lodash','util','../../config/logger'];(function(_0x23c6fb,_0x2cc1fd){var _0x2cb154=function(_0x599b02){while(--_0x599b02){_0x23c6fb['push'](_0x23c6fb['shift']());}};_0x2cb154(++_0x2cc1fd);}(_0xc3c0,0x115));var _0x0c3c=function(_0x1c5b6a,_0x2e6947){_0x1c5b6a=_0x1c5b6a-0x0;var _0x56c83b=_0xc3c0[_0x1c5b6a];return _0x56c83b;};'use strict';var _=require(_0x0c3c('0x0'));var util=require(_0x0c3c('0x1'));var logger=require(_0x0c3c('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x0c3c('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./smsQueue.attributes');module[_0x0c3c('0x4')]=function(_0x2d7a02,_0x3a642f){return _0x2d7a02[_0x0c3c('0x5')](_0x0c3c('0x6'),attributes,{'tableName':_0x0c3c('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x63b1=['SmsQueue','sms_queues','lodash','util','../../config/logger','api','path','../../config/environment','./smsQueue.attributes','exports','define'];(function(_0x138fc4,_0x2a4d0e){var _0x37b82d=function(_0x4c3fd1){while(--_0x4c3fd1){_0x138fc4['push'](_0x138fc4['shift']());}};_0x37b82d(++_0x2a4d0e);}(_0x63b1,0x120));var _0x163b=function(_0x31e964,_0x533231){_0x31e964=_0x31e964-0x0;var _0x5d443d=_0x63b1[_0x31e964];return _0x5d443d;};'use strict';var _=require(_0x163b('0x0'));var util=require(_0x163b('0x1'));var logger=require(_0x163b('0x2'))(_0x163b('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x163b('0x4'));var rimraf=require('rimraf');var config=require(_0x163b('0x5'));var attributes=require(_0x163b('0x6'));module[_0x163b('0x7')]=function(_0x3e5179,_0x918000){return _0x3e5179[_0x163b('0x8')](_0x163b('0x9'),attributes,{'tableName':_0x163b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.rpc.js b/server/api/smsQueue/smsQueue.rpc.js index 367d8cd..245580a 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 _0x10ec=['util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','./smsQueue.socket','register','request','then','SmsQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','GetSmsQueue','SmsQueue','findAll','raw','options','attributes','include','map','model','catch','ShowSmsQueue','find','where','info'];(function(_0xeefec5,_0x4c9f98){var _0x38ea5d=function(_0x11c629){while(--_0x11c629){_0xeefec5['push'](_0xeefec5['shift']());}};_0x38ea5d(++_0x4c9f98);}(_0x10ec,0x98));var _0xc10e=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x10ec[_0x465a0c];return _0x1e202e;};'use strict';var _=require('lodash');var util=require(_0xc10e('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc10e('0x1'));var db=require(_0xc10e('0x2'))['db'];var utils=require(_0xc10e('0x3'));var logger=require(_0xc10e('0x4'))(_0xc10e('0x5'));var config=require(_0xc10e('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xc10e('0x7')][_0xc10e('0x8')]({'port':0x232a});config[_0xc10e('0x9')]=_[_0xc10e('0xa')](config[_0xc10e('0x9')],{'host':_0xc10e('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xc10e('0xc'))[_0xc10e('0xd')](socket);function respondWithRpcPromise(_0x5804d4,_0x14b956,_0x196499){return new BPromise(function(_0x849eec,_0x1a5482){return client[_0xc10e('0xe')](_0x5804d4,_0x196499)[_0xc10e('0xf')](function(_0x1b1a53){logger['info'](_0xc10e('0x10'),_0x14b956,'request\x20sent');logger[_0xc10e('0x11')]('SmsQueue,\x20%s,\x20%s,\x20%s',_0x14b956,_0xc10e('0x12'),JSON[_0xc10e('0x13')](_0x1b1a53));if(_0x1b1a53[_0xc10e('0x14')]){if(_0x1b1a53['error'][_0xc10e('0x15')]===0x1f4){logger[_0xc10e('0x14')]('SmsQueue,\x20%s,\x20%s',_0x14b956,_0x1b1a53[_0xc10e('0x14')][_0xc10e('0x16')]);return _0x1a5482(_0x1b1a53['error']['message']);}logger[_0xc10e('0x14')](_0xc10e('0x10'),_0x14b956,_0x1b1a53[_0xc10e('0x14')]['message']);return _0x849eec(_0x1b1a53[_0xc10e('0x14')]['message']);}else{logger['info'](_0xc10e('0x10'),_0x14b956,_0xc10e('0x12'));_0x849eec(_0x1b1a53[_0xc10e('0x17')][_0xc10e('0x16')]);}})['catch'](function(_0x1cfc6e){logger['error']('SmsQueue,\x20%s,\x20%s',_0x14b956,_0x1cfc6e);_0x1a5482(_0x1cfc6e);});});}exports[_0xc10e('0x18')]=function(_0xc71a09){var _0x4884f4=this;return new Promise(function(_0x3df795,_0x4b9606){return db[_0xc10e('0x19')][_0xc10e('0x1a')]({'raw':_0xc71a09['options']?_0xc71a09['options'][_0xc10e('0x1b')]===undefined?!![]:![]:!![],'where':_0xc71a09[_0xc10e('0x1c')]?_0xc71a09[_0xc10e('0x1c')]['where']||null:null,'attributes':_0xc71a09[_0xc10e('0x1c')]?_0xc71a09[_0xc10e('0x1c')][_0xc10e('0x1d')]||null:null,'limit':_0xc71a09[_0xc10e('0x1c')]?_0xc71a09[_0xc10e('0x1c')]['limit']||null:null,'include':_0xc71a09[_0xc10e('0x1c')]?_0xc71a09['options'][_0xc10e('0x1e')]?_[_0xc10e('0x1f')](_0xc71a09[_0xc10e('0x1c')][_0xc10e('0x1e')],function(_0x14ff9d){return{'model':db[_0x14ff9d[_0xc10e('0x20')]],'as':_0x14ff9d['as'],'attributes':_0x14ff9d[_0xc10e('0x1d')],'include':_0x14ff9d['include']?_[_0xc10e('0x1f')](_0x14ff9d[_0xc10e('0x1e')],function(_0x12eadd){return{'model':db[_0x12eadd['model']],'as':_0x12eadd['as'],'attributes':_0x12eadd['attributes'],'include':_0x12eadd['include']?_[_0xc10e('0x1f')](_0x12eadd[_0xc10e('0x1e')],function(_0xd2ca87){return{'model':db[_0xd2ca87[_0xc10e('0x20')]],'as':_0xd2ca87['as'],'attributes':_0xd2ca87['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5ab6a3){logger['info'](_0xc10e('0x18'),_0xc71a09);logger['debug']('GetSmsQueue',_0xc71a09,JSON[_0xc10e('0x13')](_0x5ab6a3));_0x3df795(_0x5ab6a3);})[_0xc10e('0x21')](function(_0x2f0132){logger[_0xc10e('0x14')](_0xc10e('0x18'),_0x2f0132['message'],_0xc71a09);_0x4b9606(_0x4884f4['error'](0x1f4,_0x2f0132[_0xc10e('0x16')]));});});};exports[_0xc10e('0x22')]=function(_0x1aaf01){var _0x107daf=this;return new Promise(function(_0x5ae636,_0x58ace6){return db[_0xc10e('0x19')][_0xc10e('0x23')]({'raw':_0x1aaf01[_0xc10e('0x1c')]?_0x1aaf01[_0xc10e('0x1c')][_0xc10e('0x1b')]===undefined?!![]:![]:!![],'where':_0x1aaf01[_0xc10e('0x1c')]?_0x1aaf01[_0xc10e('0x1c')][_0xc10e('0x24')]||null:null,'attributes':_0x1aaf01['options']?_0x1aaf01[_0xc10e('0x1c')][_0xc10e('0x1d')]||null:null,'include':_0x1aaf01[_0xc10e('0x1c')]?_0x1aaf01[_0xc10e('0x1c')][_0xc10e('0x1e')]?_[_0xc10e('0x1f')](_0x1aaf01[_0xc10e('0x1c')][_0xc10e('0x1e')],function(_0x24dd49){return{'model':db[_0x24dd49['model']],'as':_0x24dd49['as'],'attributes':_0x24dd49[_0xc10e('0x1d')],'include':_0x24dd49[_0xc10e('0x1e')]?_[_0xc10e('0x1f')](_0x24dd49['include'],function(_0x5d84b8){return{'model':db[_0x5d84b8['model']],'as':_0x5d84b8['as'],'attributes':_0x5d84b8[_0xc10e('0x1d')],'include':_0x5d84b8[_0xc10e('0x1e')]?_[_0xc10e('0x1f')](_0x5d84b8[_0xc10e('0x1e')],function(_0x4c2213){return{'model':db[_0x4c2213[_0xc10e('0x20')]],'as':_0x4c2213['as'],'attributes':_0x4c2213[_0xc10e('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xc10e('0xf')](function(_0x28d18b){logger[_0xc10e('0x25')]('ShowSmsQueue',_0x1aaf01);logger['debug'](_0xc10e('0x22'),_0x1aaf01,JSON[_0xc10e('0x13')](_0x28d18b));_0x5ae636(_0x28d18b);})['catch'](function(_0x123e66){logger[_0xc10e('0x14')]('ShowSmsQueue',_0x123e66[_0xc10e('0x16')],_0x1aaf01);_0x58ace6(_0x107daf[_0xc10e('0x14')](0x1f4,_0x123e66[_0xc10e('0x16')]));});});}; \ No newline at end of file +var _0xb5a3=['lodash','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','GetSmsQueue','SmsQueue','findAll','options','raw','attributes','limit','include','map','model','ShowSmsQueue','find','where'];(function(_0x1490cf,_0x31f4e8){var _0x3002cb=function(_0xbafdb2){while(--_0xbafdb2){_0x1490cf['push'](_0x1490cf['shift']());}};_0x3002cb(++_0x31f4e8);}(_0xb5a3,0x138));var _0x3b5a=function(_0x1f3aec,_0x24c18e){_0x1f3aec=_0x1f3aec-0x0;var _0x409f0d=_0xb5a3[_0x1f3aec];return _0x409f0d;};'use strict';var _=require(_0x3b5a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3b5a('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3b5a('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x3b5a('0x3'));var logger=require(_0x3b5a('0x4'))(_0x3b5a('0x5'));var config=require(_0x3b5a('0x6'));var jayson=require(_0x3b5a('0x7'));var client=jayson[_0x3b5a('0x8')][_0x3b5a('0x9')]({'port':0x232a});config[_0x3b5a('0xa')]=_[_0x3b5a('0xb')](config['redis'],{'host':_0x3b5a('0xc'),'port':0x18eb});var socket=require(_0x3b5a('0xd'))(new Redis(config[_0x3b5a('0xa')]));require(_0x3b5a('0xe'))[_0x3b5a('0xf')](socket);function respondWithRpcPromise(_0x3eb1d8,_0x32ff24,_0x2cdd29){return new BPromise(function(_0x34e75a,_0x642142){return client['request'](_0x3eb1d8,_0x2cdd29)[_0x3b5a('0x10')](function(_0x1e1ada){logger[_0x3b5a('0x11')](_0x3b5a('0x12'),_0x32ff24,_0x3b5a('0x13'));logger[_0x3b5a('0x14')]('SmsQueue,\x20%s,\x20%s,\x20%s',_0x32ff24,_0x3b5a('0x13'),JSON[_0x3b5a('0x15')](_0x1e1ada));if(_0x1e1ada['error']){if(_0x1e1ada[_0x3b5a('0x16')][_0x3b5a('0x17')]===0x1f4){logger[_0x3b5a('0x16')](_0x3b5a('0x12'),_0x32ff24,_0x1e1ada[_0x3b5a('0x16')][_0x3b5a('0x18')]);return _0x642142(_0x1e1ada[_0x3b5a('0x16')][_0x3b5a('0x18')]);}logger[_0x3b5a('0x16')]('SmsQueue,\x20%s,\x20%s',_0x32ff24,_0x1e1ada[_0x3b5a('0x16')]['message']);return _0x34e75a(_0x1e1ada['error']['message']);}else{logger[_0x3b5a('0x11')](_0x3b5a('0x12'),_0x32ff24,_0x3b5a('0x13'));_0x34e75a(_0x1e1ada['result'][_0x3b5a('0x18')]);}})[_0x3b5a('0x19')](function(_0xc771cc){logger[_0x3b5a('0x16')](_0x3b5a('0x12'),_0x32ff24,_0xc771cc);_0x642142(_0xc771cc);});});}exports[_0x3b5a('0x1a')]=function(_0x35b7c4){var _0x15f661=this;return new Promise(function(_0x25fd4b,_0x1d6245){return db[_0x3b5a('0x1b')][_0x3b5a('0x1c')]({'raw':_0x35b7c4[_0x3b5a('0x1d')]?_0x35b7c4['options'][_0x3b5a('0x1e')]===undefined?!![]:![]:!![],'where':_0x35b7c4['options']?_0x35b7c4[_0x3b5a('0x1d')]['where']||null:null,'attributes':_0x35b7c4[_0x3b5a('0x1d')]?_0x35b7c4[_0x3b5a('0x1d')][_0x3b5a('0x1f')]||null:null,'limit':_0x35b7c4[_0x3b5a('0x1d')]?_0x35b7c4['options'][_0x3b5a('0x20')]||null:null,'include':_0x35b7c4[_0x3b5a('0x1d')]?_0x35b7c4[_0x3b5a('0x1d')]['include']?_['map'](_0x35b7c4[_0x3b5a('0x1d')]['include'],function(_0x10fd70){return{'model':db[_0x10fd70['model']],'as':_0x10fd70['as'],'attributes':_0x10fd70[_0x3b5a('0x1f')],'include':_0x10fd70[_0x3b5a('0x21')]?_[_0x3b5a('0x22')](_0x10fd70[_0x3b5a('0x21')],function(_0x9bf644){return{'model':db[_0x9bf644['model']],'as':_0x9bf644['as'],'attributes':_0x9bf644[_0x3b5a('0x1f')],'include':_0x9bf644[_0x3b5a('0x21')]?_['map'](_0x9bf644[_0x3b5a('0x21')],function(_0x2ea494){return{'model':db[_0x2ea494[_0x3b5a('0x23')]],'as':_0x2ea494['as'],'attributes':_0x2ea494[_0x3b5a('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x160461){logger[_0x3b5a('0x11')](_0x3b5a('0x1a'),_0x35b7c4);logger[_0x3b5a('0x14')]('GetSmsQueue',_0x35b7c4,JSON[_0x3b5a('0x15')](_0x160461));_0x25fd4b(_0x160461);})[_0x3b5a('0x19')](function(_0x5e50c7){logger[_0x3b5a('0x16')](_0x3b5a('0x1a'),_0x5e50c7[_0x3b5a('0x18')],_0x35b7c4);_0x1d6245(_0x15f661['error'](0x1f4,_0x5e50c7['message']));});});};exports[_0x3b5a('0x24')]=function(_0x3b169e){var _0x379625=this;return new Promise(function(_0x3662cd,_0xa33e8f){return db[_0x3b5a('0x1b')][_0x3b5a('0x25')]({'raw':_0x3b169e[_0x3b5a('0x1d')]?_0x3b169e[_0x3b5a('0x1d')][_0x3b5a('0x1e')]===undefined?!![]:![]:!![],'where':_0x3b169e[_0x3b5a('0x1d')]?_0x3b169e['options'][_0x3b5a('0x26')]||null:null,'attributes':_0x3b169e['options']?_0x3b169e['options'][_0x3b5a('0x1f')]||null:null,'include':_0x3b169e[_0x3b5a('0x1d')]?_0x3b169e[_0x3b5a('0x1d')][_0x3b5a('0x21')]?_[_0x3b5a('0x22')](_0x3b169e['options'][_0x3b5a('0x21')],function(_0x3d48e7){return{'model':db[_0x3d48e7[_0x3b5a('0x23')]],'as':_0x3d48e7['as'],'attributes':_0x3d48e7[_0x3b5a('0x1f')],'include':_0x3d48e7[_0x3b5a('0x21')]?_[_0x3b5a('0x22')](_0x3d48e7['include'],function(_0x264f85){return{'model':db[_0x264f85['model']],'as':_0x264f85['as'],'attributes':_0x264f85[_0x3b5a('0x1f')],'include':_0x264f85[_0x3b5a('0x21')]?_[_0x3b5a('0x22')](_0x264f85[_0x3b5a('0x21')],function(_0x2818a6){return{'model':db[_0x2818a6[_0x3b5a('0x23')]],'as':_0x2818a6['as'],'attributes':_0x2818a6[_0x3b5a('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x3b5a('0x10')](function(_0x56163d){logger[_0x3b5a('0x11')](_0x3b5a('0x24'),_0x3b169e);logger['debug'](_0x3b5a('0x24'),_0x3b169e,JSON[_0x3b5a('0x15')](_0x56163d));_0x3662cd(_0x56163d);})[_0x3b5a('0x19')](function(_0x542b15){logger[_0x3b5a('0x16')](_0x3b5a('0x24'),_0x542b15[_0x3b5a('0x18')],_0x3b169e);_0xa33e8f(_0x379625['error'](0x1f4,_0x542b15[_0x3b5a('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 35ada6f..f4d77ee 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 _0x8d0d=['smsQueue:','save','remove','emit','removeListener','register','length'];(function(_0x496cdc,_0x9d6db3){var _0x103a8e=function(_0x1c625a){while(--_0x1c625a){_0x496cdc['push'](_0x496cdc['shift']());}};_0x103a8e(++_0x9d6db3);}(_0x8d0d,0x1c1));var _0xd8d0=function(_0x4fefca,_0x1a74df){_0x4fefca=_0x4fefca-0x0;var _0x2a21d3=_0x8d0d[_0x4fefca];return _0x2a21d3;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=[_0xd8d0('0x0'),_0xd8d0('0x1'),'update'];function createListener(_0x1ed02d,_0x1a34b8){return function(_0x3ca226){_0x1a34b8[_0xd8d0('0x2')](_0x1ed02d,_0x3ca226);};}function removeListener(_0xba221c,_0x41a202){return function(){SmsQueueEvents[_0xd8d0('0x3')](_0xba221c,_0x41a202);};}exports[_0xd8d0('0x4')]=function(_0x232614){for(var _0x13e0c3=0x0,_0x3854b3=events[_0xd8d0('0x5')];_0x13e0c3<_0x3854b3;_0x13e0c3++){var _0x25d4a8=events[_0x13e0c3];var _0x1c06f6=createListener(_0xd8d0('0x6')+_0x25d4a8,_0x232614);SmsQueueEvents['on'](_0x25d4a8,_0x1c06f6);}}; \ No newline at end of file +var _0x6e96=['smsQueue:','length'];(function(_0x151ae3,_0x3a9195){var _0x564680=function(_0x244bf7){while(--_0x244bf7){_0x151ae3['push'](_0x151ae3['shift']());}};_0x564680(++_0x3a9195);}(_0x6e96,0x89));var _0x66e9=function(_0x1f2002,_0x4b63f7){_0x1f2002=_0x1f2002-0x0;var _0x3814e2=_0x6e96[_0x1f2002];return _0x3814e2;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=['save','remove','update'];function createListener(_0x28e4b2,_0x2a4862){return function(_0x1cd73d){_0x2a4862['emit'](_0x28e4b2,_0x1cd73d);};}function removeListener(_0x2679a6,_0x23a686){return function(){SmsQueueEvents['removeListener'](_0x2679a6,_0x23a686);};}exports['register']=function(_0x283804){for(var _0x4ee7ad=0x0,_0xd2d892=events[_0x66e9('0x0')];_0x4ee7ad<_0xd2d892;_0x4ee7ad++){var _0x2f83eb=events[_0x4ee7ad];var _0x26d53c=createListener(_0x66e9('0x1')+_0x2f83eb,_0x283804);SmsQueueEvents['on'](_0x2f83eb,_0x26d53c);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 06322f1..d048228 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 _0x3dc1=['post','put','/:id','update','delete','destroy','exports','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','show'];(function(_0x6d8070,_0x37866b){var _0x3ae618=function(_0x3ca55d){while(--_0x3ca55d){_0x6d8070['push'](_0x6d8070['shift']());}};_0x3ae618(++_0x37866b);}(_0x3dc1,0x127));var _0x13dc=function(_0x41ee6a,_0x300f6a){_0x41ee6a=_0x41ee6a-0x0;var _0x471405=_0x3dc1[_0x41ee6a];return _0x471405;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x13dc('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x13dc('0x1')]();var fs_extra=require(_0x13dc('0x2'));var auth=require(_0x13dc('0x3'));var interaction=require(_0x13dc('0x4'));var config=require(_0x13dc('0x5'));var controller=require('./smsQueueReport.controller');router[_0x13dc('0x6')]('/',auth[_0x13dc('0x7')](),controller['index']);router['get'](_0x13dc('0x8'),auth['isAuthenticated'](),controller[_0x13dc('0x9')]);router[_0x13dc('0x6')]('/:id',auth[_0x13dc('0x7')](),controller[_0x13dc('0xa')]);router[_0x13dc('0xb')]('/',auth[_0x13dc('0x7')](),controller['create']);router[_0x13dc('0xc')](_0x13dc('0xd'),auth['isAuthenticated'](),controller[_0x13dc('0xe')]);router[_0x13dc('0xf')](_0x13dc('0xd'),auth['isAuthenticated'](),controller[_0x13dc('0x10')]);module[_0x13dc('0x11')]=router; \ No newline at end of file +var _0x1e6c=['describe','/:id','show','post','create','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','index','/describe'];(function(_0x57db49,_0x288094){var _0xd0636f=function(_0x227787){while(--_0x227787){_0x57db49['push'](_0x57db49['shift']());}};_0xd0636f(++_0x288094);}(_0x1e6c,0x11a));var _0xc1e6=function(_0x12f4af,_0x4a2bb9){_0x12f4af=_0x12f4af-0x0;var _0x4c4d50=_0x1e6c[_0x12f4af];return _0x4c4d50;};'use strict';var multer=require(_0xc1e6('0x0'));var util=require('util');var path=require(_0xc1e6('0x1'));var timeout=require(_0xc1e6('0x2'));var express=require(_0xc1e6('0x3'));var router=express[_0xc1e6('0x4')]();var fs_extra=require(_0xc1e6('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc1e6('0x6'));var controller=require(_0xc1e6('0x7'));router[_0xc1e6('0x8')]('/',auth[_0xc1e6('0x9')](),controller[_0xc1e6('0xa')]);router[_0xc1e6('0x8')](_0xc1e6('0xb'),auth['isAuthenticated'](),controller[_0xc1e6('0xc')]);router['get'](_0xc1e6('0xd'),auth['isAuthenticated'](),controller[_0xc1e6('0xe')]);router[_0xc1e6('0xf')]('/',auth[_0xc1e6('0x9')](),controller[_0xc1e6('0x10')]);router['put']('/:id',auth[_0xc1e6('0x9')](),controller[_0xc1e6('0x11')]);router[_0xc1e6('0x12')]('/:id',auth[_0xc1e6('0x9')](),controller[_0xc1e6('0x13')]);module[_0xc1e6('0x14')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 23fef09..9816d97 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 _0xe103=['sequelize','STRING','DATE','moment'];(function(_0x20a1cf,_0x48ea4e){var _0x27b3dc=function(_0x366c88){while(--_0x366c88){_0x20a1cf['push'](_0x20a1cf['shift']());}};_0x27b3dc(++_0x48ea4e);}(_0xe103,0x12f));var _0x3e10=function(_0x15f287,_0x511407){_0x15f287=_0x15f287-0x0;var _0x3c858a=_0xe103[_0x15f287];return _0x3c858a;};'use strict';var moment=require(_0x3e10('0x0'));var Sequelize=require(_0x3e10('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x3e10('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x3e10('0x2')]},'joinAt':{'type':Sequelize[_0x3e10('0x3')]},'leaveAt':{'type':Sequelize[_0x3e10('0x3')]},'acceptAt':{'type':Sequelize[_0x3e10('0x3')]},'exitAt':{'type':Sequelize[_0x3e10('0x3')]},'reason':{'type':Sequelize[_0x3e10('0x2')]}}; \ No newline at end of file +var _0xa258=['moment','sequelize','exports','STRING','DATE'];(function(_0x18183c,_0xc6873a){var _0x4c5764=function(_0x3e0d1c){while(--_0x3e0d1c){_0x18183c['push'](_0x18183c['shift']());}};_0x4c5764(++_0xc6873a);}(_0xa258,0x78));var _0x8a25=function(_0x44d892,_0x28a1c0){_0x44d892=_0x44d892-0x0;var _0x19097d=_0xa258[_0x44d892];return _0x19097d;};'use strict';var moment=require(_0x8a25('0x0'));var Sequelize=require(_0x8a25('0x1'));module[_0x8a25('0x2')]={'uniqueid':{'type':Sequelize[_0x8a25('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x8a25('0x4')]},'leaveAt':{'type':Sequelize[_0x8a25('0x4')]},'acceptAt':{'type':Sequelize[_0x8a25('0x4')]},'exitAt':{'type':Sequelize[_0x8a25('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 5d74781..6a72734 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 _0x46db=['hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','include','findAll','catch','show','includeAll','find','create','body','params','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','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/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','SmsQueueReport','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','attributes','model','fields'];(function(_0x3bd45c,_0x4782d0){var _0x1d559f=function(_0x3cfe35){while(--_0x3cfe35){_0x3bd45c['push'](_0x3bd45c['shift']());}};_0x1d559f(++_0x4782d0);}(_0x46db,0x193));var _0xb46d=function(_0xcb706d,_0x6d20c6){_0xcb706d=_0xcb706d-0x0;var _0x351a95=_0x46db[_0xcb706d];return _0x351a95;};'use strict';var emlformat=require(_0xb46d('0x0'));var rimraf=require(_0xb46d('0x1'));var zipdir=require(_0xb46d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb46d('0x3'));var moment=require(_0xb46d('0x4'));var BPromise=require(_0xb46d('0x5'));var Mustache=require(_0xb46d('0x6'));var util=require(_0xb46d('0x7'));var path=require(_0xb46d('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb46d('0x9'));var _=require(_0xb46d('0xa'));var squel=require(_0xb46d('0xb'));var crypto=require(_0xb46d('0xc'));var jsforce=require(_0xb46d('0xd'));var deskjs=require(_0xb46d('0xe'));var toCsv=require('to-csv');var querystring=require(_0xb46d('0xf'));var Papa=require(_0xb46d('0x10'));var Redis=require(_0xb46d('0x11'));var authService=require(_0xb46d('0x12'));var qs=require(_0xb46d('0x13'));var as=require(_0xb46d('0x14'));var hardwareService=require(_0xb46d('0x15'));var logger=require(_0xb46d('0x16'))('api');var utils=require('../../config/utils');var config=require(_0xb46d('0x17'));var licenseUtil=require(_0xb46d('0x18'));var db=require(_0xb46d('0x19'))['db'];function respondWithStatusCode(_0x5f4573,_0x53a2a2){_0x53a2a2=_0x53a2a2||0xcc;return function(_0x4b6704){if(_0x4b6704){return _0x5f4573[_0xb46d('0x1a')](_0x53a2a2);}return _0x5f4573[_0xb46d('0x1b')](_0x53a2a2)[_0xb46d('0x1c')]();};}function respondWithResult(_0x56d9bc,_0x44474d){_0x44474d=_0x44474d||0xc8;return function(_0x33e25f){if(_0x33e25f){return _0x56d9bc[_0xb46d('0x1b')](_0x44474d)[_0xb46d('0x1d')](_0x33e25f);}};}function respondWithFilteredResult(_0x44bf8f,_0x3e93d4){return function(_0x48bce0){if(_0x48bce0){var _0x81e55c=typeof _0x3e93d4[_0xb46d('0x1e')]==='undefined'&&typeof _0x3e93d4[_0xb46d('0x1f')]===_0xb46d('0x20');var _0x25b654=_0x48bce0[_0xb46d('0x21')];var _0x7dfc55=_0x81e55c?0x0:_0x3e93d4[_0xb46d('0x1e')];var _0x4a78cc=_0x81e55c?_0x48bce0['count']:_0x3e93d4[_0xb46d('0x1e')]+_0x3e93d4[_0xb46d('0x1f')];var _0x43d26b;if(_0x4a78cc>=_0x25b654){_0x4a78cc=_0x25b654;_0x43d26b=0xc8;}else{_0x43d26b=0xce;}_0x44bf8f[_0xb46d('0x1b')](_0x43d26b);return _0x44bf8f[_0xb46d('0x22')](_0xb46d('0x23'),_0x7dfc55+'-'+_0x4a78cc+'/'+_0x25b654)['json'](_0x48bce0);}return null;};}function patchUpdates(_0x58ad00){return function(_0x56f8c3){try{jsonpatch[_0xb46d('0x24')](_0x56f8c3,_0x58ad00,!![]);}catch(_0x584fa4){return BPromise[_0xb46d('0x25')](_0x584fa4);}return _0x56f8c3[_0xb46d('0x26')]();};}function saveUpdates(_0x45ffdf,_0x4e0439){return function(_0x9f143f){if(_0x9f143f){return _0x9f143f[_0xb46d('0x27')](_0x45ffdf)[_0xb46d('0x28')](function(_0x410ba2){return _0x410ba2;});}return null;};}function removeEntity(_0x5831aa,_0x5b7332){return function(_0xc5943e){if(_0xc5943e){return _0xc5943e[_0xb46d('0x29')]()[_0xb46d('0x28')](function(){_0x5831aa[_0xb46d('0x1b')](0xcc)[_0xb46d('0x1c')]();});}};}function handleEntityNotFound(_0x13658a,_0x24038a){return function(_0x4b4f5d){if(!_0x4b4f5d){_0x13658a[_0xb46d('0x1a')](0x194);}return _0x4b4f5d;};}function handleError(_0xd0513c,_0x34820d){_0x34820d=_0x34820d||0x1f4;return function(_0x3cba87){logger[_0xb46d('0x2a')](_0x3cba87[_0xb46d('0x2b')]);if(_0x3cba87[_0xb46d('0x2c')]){delete _0x3cba87[_0xb46d('0x2c')];}_0xd0513c[_0xb46d('0x1b')](_0x34820d)['send'](_0x3cba87);};}exports[_0xb46d('0x2d')]=function(_0x33715e,_0x5ac606){var _0x2b1b9={},_0x47c06e={},_0x24ddd2={'count':0x0,'rows':[]};var _0xc918ce=_['map'](db[_0xb46d('0x2e')][_0xb46d('0x2f')],function(_0x4f9a04){return{'name':_0x4f9a04[_0xb46d('0x30')],'type':_0x4f9a04[_0xb46d('0x31')][_0xb46d('0x32')]};});_0x47c06e['model']=_[_0xb46d('0x33')](_0xc918ce,_0xb46d('0x2c'));_0x47c06e[_0xb46d('0x34')]=_[_0xb46d('0x35')](_0x33715e[_0xb46d('0x34')]);_0x47c06e[_0xb46d('0x36')]=_[_0xb46d('0x37')](_0x47c06e['model'],_0x47c06e[_0xb46d('0x34')]);_0x2b1b9[_0xb46d('0x38')]=_[_0xb46d('0x37')](_0x47c06e[_0xb46d('0x39')],qs['fields'](_0x33715e['query'][_0xb46d('0x3a')]));_0x2b1b9[_0xb46d('0x38')]=_0x2b1b9[_0xb46d('0x38')]['length']?_0x2b1b9[_0xb46d('0x38')]:_0x47c06e[_0xb46d('0x39')];if(!_0x33715e['query'][_0xb46d('0x3b')]('nolimit')){_0x2b1b9[_0xb46d('0x1f')]=qs[_0xb46d('0x1f')](_0x33715e['query'][_0xb46d('0x1f')]);_0x2b1b9[_0xb46d('0x1e')]=qs[_0xb46d('0x1e')](_0x33715e[_0xb46d('0x34')][_0xb46d('0x1e')]);}_0x2b1b9[_0xb46d('0x3c')]=qs[_0xb46d('0x3d')](_0x33715e[_0xb46d('0x34')][_0xb46d('0x3d')]);_0x2b1b9[_0xb46d('0x3e')]=qs[_0xb46d('0x36')](_[_0xb46d('0x3f')](_0x33715e[_0xb46d('0x34')],_0x47c06e[_0xb46d('0x36')]),_0xc918ce);if(_0x33715e[_0xb46d('0x34')][_0xb46d('0x40')]){_0x2b1b9['where']=_[_0xb46d('0x41')](_0x2b1b9[_0xb46d('0x3e')],{'$or':_['map'](_0xc918ce,function(_0x3b6df7){if(_0x3b6df7[_0xb46d('0x31')]!==_0xb46d('0x42')){var _0x578892={};_0x578892[_0x3b6df7[_0xb46d('0x2c')]]={'$like':'%'+_0x33715e[_0xb46d('0x34')][_0xb46d('0x40')]+'%'};return _0x578892;}})});}_0x2b1b9=_['merge']({},_0x2b1b9,_0x33715e['options']);var _0x5e66c9={'where':_0x2b1b9[_0xb46d('0x3e')]};return db[_0xb46d('0x2e')][_0xb46d('0x21')](_0x5e66c9)[_0xb46d('0x28')](function(_0x1cf7c7){_0x24ddd2['count']=_0x1cf7c7;if(_0x33715e['query']['includeAll']){_0x2b1b9[_0xb46d('0x43')]=[{'all':!![]}];}return db[_0xb46d('0x2e')][_0xb46d('0x44')](_0x2b1b9);})[_0xb46d('0x28')](function(_0x2c599f){_0x24ddd2['rows']=_0x2c599f;return _0x24ddd2;})[_0xb46d('0x28')](respondWithFilteredResult(_0x5ac606,_0x2b1b9))[_0xb46d('0x45')](handleError(_0x5ac606,null));};exports[_0xb46d('0x46')]=function(_0x887675,_0x32449f){var _0x21bdb6={'raw':!![],'where':{'id':_0x887675['params']['id']}},_0x5ebe0e={};_0x5ebe0e['model']=_[_0xb46d('0x35')](db[_0xb46d('0x2e')][_0xb46d('0x2f')]);_0x5ebe0e['query']=_['keys'](_0x887675[_0xb46d('0x34')]);_0x5ebe0e[_0xb46d('0x36')]=_[_0xb46d('0x37')](_0x5ebe0e[_0xb46d('0x39')],_0x5ebe0e[_0xb46d('0x34')]);_0x21bdb6['attributes']=_[_0xb46d('0x37')](_0x5ebe0e['model'],qs[_0xb46d('0x3a')](_0x887675['query'][_0xb46d('0x3a')]));_0x21bdb6[_0xb46d('0x38')]=_0x21bdb6[_0xb46d('0x38')]['length']?_0x21bdb6[_0xb46d('0x38')]:_0x5ebe0e['model'];if(_0x887675[_0xb46d('0x34')][_0xb46d('0x47')]){_0x21bdb6[_0xb46d('0x43')]=[{'all':!![]}];}_0x21bdb6=_[_0xb46d('0x41')]({},_0x21bdb6,_0x887675['options']);return db['SmsQueueReport'][_0xb46d('0x48')](_0x21bdb6)[_0xb46d('0x28')](handleEntityNotFound(_0x32449f,null))[_0xb46d('0x28')](respondWithResult(_0x32449f,null))[_0xb46d('0x45')](handleError(_0x32449f,null));};exports['create']=function(_0x6db5ae,_0x589b4a){return db[_0xb46d('0x2e')][_0xb46d('0x49')](_0x6db5ae[_0xb46d('0x4a')],{})[_0xb46d('0x28')](respondWithResult(_0x589b4a,0xc9))[_0xb46d('0x45')](handleError(_0x589b4a,null));};exports[_0xb46d('0x27')]=function(_0x22a626,_0x19f83d){if(_0x22a626['body']['id']){delete _0x22a626[_0xb46d('0x4a')]['id'];}return db['SmsQueueReport'][_0xb46d('0x48')]({'where':{'id':_0x22a626[_0xb46d('0x4b')]['id']}})[_0xb46d('0x28')](handleEntityNotFound(_0x19f83d,null))[_0xb46d('0x28')](saveUpdates(_0x22a626[_0xb46d('0x4a')],null))[_0xb46d('0x28')](respondWithResult(_0x19f83d,null))[_0xb46d('0x45')](handleError(_0x19f83d,null));};exports[_0xb46d('0x29')]=function(_0x2b1e4c,_0x2e228d){return db[_0xb46d('0x2e')]['find']({'where':{'id':_0x2b1e4c[_0xb46d('0x4b')]['id']}})[_0xb46d('0x28')](handleEntityNotFound(_0x2e228d,null))[_0xb46d('0x28')](removeEntity(_0x2e228d,null))[_0xb46d('0x45')](handleError(_0x2e228d,null));};exports['describe']=function(_0x34ef0a,_0x444089){return db[_0xb46d('0x2e')][_0xb46d('0x4c')]()[_0xb46d('0x28')](respondWithResult(_0x444089,null))[_0xb46d('0x45')](handleError(_0x444089,null));}; \ No newline at end of file +var _0xcca3=['../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','Content-Range','json','reject','save','update','then','error','name','send','map','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','merge','where','options','SmsQueueReport','includeAll','include','rows','catch','show','params','create','body','find','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware'];(function(_0x35c33d,_0x46defa){var _0x5139b3=function(_0x427391){while(--_0x427391){_0x35c33d['push'](_0x35c33d['shift']());}};_0x5139b3(++_0x46defa);}(_0xcca3,0x10c));var _0x3cca=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0xcca3[_0x3511d3];return _0x5d6321;};'use strict';var emlformat=require(_0x3cca('0x0'));var rimraf=require(_0x3cca('0x1'));var zipdir=require(_0x3cca('0x2'));var jsonpatch=require(_0x3cca('0x3'));var rp=require('request-promise');var moment=require(_0x3cca('0x4'));var BPromise=require(_0x3cca('0x5'));var Mustache=require(_0x3cca('0x6'));var util=require(_0x3cca('0x7'));var path=require('path');var sox=require(_0x3cca('0x8'));var csv=require('to-csv');var ejs=require(_0x3cca('0x9'));var fs=require('fs');var fs_extra=require(_0x3cca('0xa'));var _=require(_0x3cca('0xb'));var squel=require(_0x3cca('0xc'));var crypto=require('crypto');var jsforce=require(_0x3cca('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3cca('0xe'));var Papa=require(_0x3cca('0xf'));var Redis=require(_0x3cca('0x10'));var authService=require(_0x3cca('0x11'));var qs=require(_0x3cca('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3cca('0x13'));var logger=require(_0x3cca('0x14'))(_0x3cca('0x15'));var utils=require(_0x3cca('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x3cca('0x17'))['db'];function respondWithStatusCode(_0x20523c,_0x1c8dea){_0x1c8dea=_0x1c8dea||0xcc;return function(_0x28731b){if(_0x28731b){return _0x20523c[_0x3cca('0x18')](_0x1c8dea);}return _0x20523c[_0x3cca('0x19')](_0x1c8dea)[_0x3cca('0x1a')]();};}function respondWithResult(_0x6bade6,_0x58c10f){_0x58c10f=_0x58c10f||0xc8;return function(_0x152dea){if(_0x152dea){return _0x6bade6['status'](_0x58c10f)['json'](_0x152dea);}};}function respondWithFilteredResult(_0x3f87d5,_0x48da1b){return function(_0x284b58){if(_0x284b58){var _0x26dd5f=typeof _0x48da1b[_0x3cca('0x1b')]==='undefined'&&typeof _0x48da1b['limit']===_0x3cca('0x1c');var _0x52edaf=_0x284b58[_0x3cca('0x1d')];var _0x4c7f15=_0x26dd5f?0x0:_0x48da1b['offset'];var _0x1ba8bd=_0x26dd5f?_0x284b58[_0x3cca('0x1d')]:_0x48da1b[_0x3cca('0x1b')]+_0x48da1b[_0x3cca('0x1e')];var _0x3a164d;if(_0x1ba8bd>=_0x52edaf){_0x1ba8bd=_0x52edaf;_0x3a164d=0xc8;}else{_0x3a164d=0xce;}_0x3f87d5[_0x3cca('0x19')](_0x3a164d);return _0x3f87d5['set'](_0x3cca('0x1f'),_0x4c7f15+'-'+_0x1ba8bd+'/'+_0x52edaf)[_0x3cca('0x20')](_0x284b58);}return null;};}function patchUpdates(_0x5586ea){return function(_0x3c6adb){try{jsonpatch['apply'](_0x3c6adb,_0x5586ea,!![]);}catch(_0x45afdc){return BPromise[_0x3cca('0x21')](_0x45afdc);}return _0x3c6adb[_0x3cca('0x22')]();};}function saveUpdates(_0x11b4b7,_0x484ef8){return function(_0x16f3c9){if(_0x16f3c9){return _0x16f3c9[_0x3cca('0x23')](_0x11b4b7)['then'](function(_0x53beff){return _0x53beff;});}return null;};}function removeEntity(_0x333572,_0x30a443){return function(_0x1d5435){if(_0x1d5435){return _0x1d5435['destroy']()[_0x3cca('0x24')](function(){_0x333572['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x451366,_0x4445a8){return function(_0x50facf){if(!_0x50facf){_0x451366['sendStatus'](0x194);}return _0x50facf;};}function handleError(_0x1d3762,_0x386e6b){_0x386e6b=_0x386e6b||0x1f4;return function(_0x2e7b94){logger[_0x3cca('0x25')](_0x2e7b94['stack']);if(_0x2e7b94[_0x3cca('0x26')]){delete _0x2e7b94[_0x3cca('0x26')];}_0x1d3762[_0x3cca('0x19')](_0x386e6b)[_0x3cca('0x27')](_0x2e7b94);};}exports['index']=function(_0x3092ba,_0x205455){var _0x38f899={},_0x269e14={},_0x845917={'count':0x0,'rows':[]};var _0x45039d=_[_0x3cca('0x28')](db['SmsQueueReport']['rawAttributes'],function(_0x3f1e69){return{'name':_0x3f1e69[_0x3cca('0x29')],'type':_0x3f1e69[_0x3cca('0x2a')][_0x3cca('0x2b')]};});_0x269e14['model']=_[_0x3cca('0x28')](_0x45039d,_0x3cca('0x26'));_0x269e14['query']=_[_0x3cca('0x2c')](_0x3092ba[_0x3cca('0x2d')]);_0x269e14[_0x3cca('0x2e')]=_[_0x3cca('0x2f')](_0x269e14[_0x3cca('0x30')],_0x269e14[_0x3cca('0x2d')]);_0x38f899[_0x3cca('0x31')]=_[_0x3cca('0x2f')](_0x269e14[_0x3cca('0x30')],qs['fields'](_0x3092ba[_0x3cca('0x2d')][_0x3cca('0x32')]));_0x38f899['attributes']=_0x38f899[_0x3cca('0x31')][_0x3cca('0x33')]?_0x38f899[_0x3cca('0x31')]:_0x269e14[_0x3cca('0x30')];if(!_0x3092ba[_0x3cca('0x2d')][_0x3cca('0x34')]('nolimit')){_0x38f899[_0x3cca('0x1e')]=qs[_0x3cca('0x1e')](_0x3092ba[_0x3cca('0x2d')][_0x3cca('0x1e')]);_0x38f899[_0x3cca('0x1b')]=qs[_0x3cca('0x1b')](_0x3092ba[_0x3cca('0x2d')][_0x3cca('0x1b')]);}_0x38f899[_0x3cca('0x35')]=qs[_0x3cca('0x36')](_0x3092ba[_0x3cca('0x2d')]['sort']);_0x38f899['where']=qs[_0x3cca('0x2e')](_[_0x3cca('0x37')](_0x3092ba[_0x3cca('0x2d')],_0x269e14[_0x3cca('0x2e')]),_0x45039d);if(_0x3092ba['query'][_0x3cca('0x38')]){_0x38f899['where']=_[_0x3cca('0x39')](_0x38f899[_0x3cca('0x3a')],{'$or':_[_0x3cca('0x28')](_0x45039d,function(_0x551dc7){if(_0x551dc7['type']!=='VIRTUAL'){var _0x50ac0b={};_0x50ac0b[_0x551dc7[_0x3cca('0x26')]]={'$like':'%'+_0x3092ba[_0x3cca('0x2d')][_0x3cca('0x38')]+'%'};return _0x50ac0b;}})});}_0x38f899=_[_0x3cca('0x39')]({},_0x38f899,_0x3092ba[_0x3cca('0x3b')]);var _0x144439={'where':_0x38f899[_0x3cca('0x3a')]};return db[_0x3cca('0x3c')][_0x3cca('0x1d')](_0x144439)[_0x3cca('0x24')](function(_0x177f74){_0x845917[_0x3cca('0x1d')]=_0x177f74;if(_0x3092ba[_0x3cca('0x2d')][_0x3cca('0x3d')]){_0x38f899[_0x3cca('0x3e')]=[{'all':!![]}];}return db[_0x3cca('0x3c')]['findAll'](_0x38f899);})[_0x3cca('0x24')](function(_0x3d7a2c){_0x845917[_0x3cca('0x3f')]=_0x3d7a2c;return _0x845917;})['then'](respondWithFilteredResult(_0x205455,_0x38f899))[_0x3cca('0x40')](handleError(_0x205455,null));};exports[_0x3cca('0x41')]=function(_0x1133e4,_0x8aeedb){var _0x2f8f3d={'raw':!![],'where':{'id':_0x1133e4[_0x3cca('0x42')]['id']}},_0x2231d3={};_0x2231d3[_0x3cca('0x30')]=_[_0x3cca('0x2c')](db['SmsQueueReport']['rawAttributes']);_0x2231d3[_0x3cca('0x2d')]=_[_0x3cca('0x2c')](_0x1133e4[_0x3cca('0x2d')]);_0x2231d3[_0x3cca('0x2e')]=_[_0x3cca('0x2f')](_0x2231d3[_0x3cca('0x30')],_0x2231d3[_0x3cca('0x2d')]);_0x2f8f3d[_0x3cca('0x31')]=_[_0x3cca('0x2f')](_0x2231d3[_0x3cca('0x30')],qs[_0x3cca('0x32')](_0x1133e4['query'][_0x3cca('0x32')]));_0x2f8f3d[_0x3cca('0x31')]=_0x2f8f3d['attributes']['length']?_0x2f8f3d[_0x3cca('0x31')]:_0x2231d3[_0x3cca('0x30')];if(_0x1133e4[_0x3cca('0x2d')][_0x3cca('0x3d')]){_0x2f8f3d['include']=[{'all':!![]}];}_0x2f8f3d=_[_0x3cca('0x39')]({},_0x2f8f3d,_0x1133e4[_0x3cca('0x3b')]);return db['SmsQueueReport']['find'](_0x2f8f3d)[_0x3cca('0x24')](handleEntityNotFound(_0x8aeedb,null))[_0x3cca('0x24')](respondWithResult(_0x8aeedb,null))[_0x3cca('0x40')](handleError(_0x8aeedb,null));};exports[_0x3cca('0x43')]=function(_0x123503,_0x527a4c){return db[_0x3cca('0x3c')][_0x3cca('0x43')](_0x123503[_0x3cca('0x44')],{})[_0x3cca('0x24')](respondWithResult(_0x527a4c,0xc9))[_0x3cca('0x40')](handleError(_0x527a4c,null));};exports[_0x3cca('0x23')]=function(_0x4ece24,_0xf5ac90){if(_0x4ece24['body']['id']){delete _0x4ece24['body']['id'];}return db[_0x3cca('0x3c')][_0x3cca('0x45')]({'where':{'id':_0x4ece24[_0x3cca('0x42')]['id']}})[_0x3cca('0x24')](handleEntityNotFound(_0xf5ac90,null))[_0x3cca('0x24')](saveUpdates(_0x4ece24[_0x3cca('0x44')],null))[_0x3cca('0x24')](respondWithResult(_0xf5ac90,null))[_0x3cca('0x40')](handleError(_0xf5ac90,null));};exports[_0x3cca('0x46')]=function(_0x1b993e,_0x3f89d1){return db['SmsQueueReport'][_0x3cca('0x45')]({'where':{'id':_0x1b993e[_0x3cca('0x42')]['id']}})[_0x3cca('0x24')](handleEntityNotFound(_0x3f89d1,null))[_0x3cca('0x24')](removeEntity(_0x3f89d1,null))[_0x3cca('0x40')](handleError(_0x3f89d1,null));};exports[_0x3cca('0x47')]=function(_0x434680,_0x102b12){return db[_0x3cca('0x3c')][_0x3cca('0x47')]()['then'](respondWithResult(_0x102b12,null))[_0x3cca('0x40')](handleError(_0x102b12,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index b32caff..9d7f9f3 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 _0xa9e0=['define','SmsQueueReport','uniqueid','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./smsQueueReport.attributes','exports'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0xa9e0[_0x1b349a];return _0x5d1f7c;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'report_sms_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0a9e('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid','lodash','util'];(function(_0x27d443,_0x4ee5ec){var _0x21b822=function(_0x4c6296){while(--_0x4c6296){_0x27d443['push'](_0x27d443['shift']());}};_0x21b822(++_0x4ee5ec);}(_0xe706,0xa3));var _0x6e70=function(_0x44216d,_0x4938a7){_0x44216d=_0x44216d-0x0;var _0xeca523=_0xe706[_0x44216d];return _0xeca523;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));module[_0x6e70('0xa')]=function(_0x1b0389,_0x4381d1){return _0x1b0389[_0x6e70('0xb')](_0x6e70('0xc'),attributes,{'tableName':_0x6e70('0xd'),'paranoid':![],'indexes':[{'name':_0x6e70('0xe'),'fields':[_0x6e70('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index abca249..a05b4d0 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 _0x0ab2=['catch','UpdateSmsQueueReport','where','attributes','limit','lodash','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','code','error','SmsQueueReport,\x20%s,\x20%s','message','info','result','CreateSmsQueueReport','create','body','options','raw'];(function(_0x1a7d87,_0x523f81){var _0x26dd0b=function(_0x53fff9){while(--_0x53fff9){_0x1a7d87['push'](_0x1a7d87['shift']());}};_0x26dd0b(++_0x523f81);}(_0x0ab2,0xb3));var _0x20ab=function(_0x39100d,_0x2f566f){_0x39100d=_0x39100d-0x0;var _0x498812=_0x0ab2[_0x39100d];return _0x498812;};'use strict';var _=require(_0x20ab('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(_0x20ab('0x1'))['db'];var utils=require(_0x20ab('0x2'));var logger=require(_0x20ab('0x3'))(_0x20ab('0x4'));var config=require(_0x20ab('0x5'));var jayson=require(_0x20ab('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x891da,_0x2efdf4,_0x4c2316){return new BPromise(function(_0xbce0d,_0x247fa5){return client[_0x20ab('0x7')](_0x891da,_0x4c2316)[_0x20ab('0x8')](function(_0xff52c2){logger['info']('SmsQueueReport,\x20%s,\x20%s',_0x2efdf4,_0x20ab('0x9'));logger[_0x20ab('0xa')](_0x20ab('0xb'),_0x2efdf4,_0x20ab('0x9'),JSON[_0x20ab('0xc')](_0xff52c2));if(_0xff52c2['error']){if(_0xff52c2['error'][_0x20ab('0xd')]===0x1f4){logger[_0x20ab('0xe')](_0x20ab('0xf'),_0x2efdf4,_0xff52c2[_0x20ab('0xe')]['message']);return _0x247fa5(_0xff52c2[_0x20ab('0xe')]['message']);}logger[_0x20ab('0xe')](_0x20ab('0xf'),_0x2efdf4,_0xff52c2[_0x20ab('0xe')][_0x20ab('0x10')]);return _0xbce0d(_0xff52c2['error'][_0x20ab('0x10')]);}else{logger[_0x20ab('0x11')](_0x20ab('0xf'),_0x2efdf4,'request\x20sent');_0xbce0d(_0xff52c2[_0x20ab('0x12')][_0x20ab('0x10')]);}})['catch'](function(_0xd89dc0){logger['error'](_0x20ab('0xf'),_0x2efdf4,_0xd89dc0);_0x247fa5(_0xd89dc0);});});}exports[_0x20ab('0x13')]=function(_0x2f9092){var _0x128acd=this;return new Promise(function(_0x35a6e4,_0x43d13f){return db['SmsQueueReport'][_0x20ab('0x14')](_0x2f9092[_0x20ab('0x15')],{'raw':_0x2f9092['options']?_0x2f9092[_0x20ab('0x16')][_0x20ab('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x5c468f){logger[_0x20ab('0x11')](_0x20ab('0x13'),_0x2f9092);logger[_0x20ab('0xa')](_0x20ab('0x13'),_0x2f9092,JSON['stringify'](_0x5c468f));_0x35a6e4(_0x5c468f);})[_0x20ab('0x18')](function(_0x46263e){logger[_0x20ab('0xe')]('CreateSmsQueueReport',_0x46263e[_0x20ab('0x10')],_0x2f9092);_0x43d13f(_0x128acd[_0x20ab('0xe')](0x1f4,_0x46263e[_0x20ab('0x10')]));});});};exports[_0x20ab('0x19')]=function(_0x16ad2b){var _0x31bec9=this;return new Promise(function(_0x301ec1,_0x5139c9){return db['SmsQueueReport']['update'](_0x16ad2b[_0x20ab('0x15')],{'raw':_0x16ad2b[_0x20ab('0x16')]?_0x16ad2b[_0x20ab('0x16')][_0x20ab('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x16ad2b[_0x20ab('0x16')]?_0x16ad2b[_0x20ab('0x16')][_0x20ab('0x1a')]||null:null,'attributes':_0x16ad2b[_0x20ab('0x16')]?_0x16ad2b['options'][_0x20ab('0x1b')]||null:null,'limit':_0x16ad2b[_0x20ab('0x16')]?_0x16ad2b[_0x20ab('0x16')][_0x20ab('0x1c')]||null:null})[_0x20ab('0x8')](function(_0x28989c){logger[_0x20ab('0x11')]('UpdateSmsQueueReport',_0x16ad2b);logger[_0x20ab('0xa')](_0x20ab('0x19'),_0x16ad2b,JSON[_0x20ab('0xc')](_0x28989c));_0x301ec1(_0x28989c);})[_0x20ab('0x18')](function(_0x4380ce){logger[_0x20ab('0xe')](_0x20ab('0x19'),_0x4380ce[_0x20ab('0x10')],_0x16ad2b);_0x5139c9(_0x31bec9[_0x20ab('0xe')](0x1f4,_0x4380ce[_0x20ab('0x10')]));});});}; \ No newline at end of file +var _0xfb91=['UpdateSmsQueueReport','update','where','limit','then','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','info','SmsQueueReport,\x20%s,\x20%s','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','CreateSmsQueueReport','SmsQueueReport','body','options','raw','catch'];(function(_0x5eb868,_0x3edfb0){var _0x278458=function(_0x266273){while(--_0x266273){_0x5eb868['push'](_0x5eb868['shift']());}};_0x278458(++_0x3edfb0);}(_0xfb91,0xe5));var _0x1fb9=function(_0x247090,_0x48c119){_0x247090=_0x247090-0x0;var _0x31696b=_0xfb91[_0x247090];return _0x31696b;};'use strict';var _=require(_0x1fb9('0x0'));var util=require(_0x1fb9('0x1'));var moment=require('moment');var BPromise=require(_0x1fb9('0x2'));var rs=require(_0x1fb9('0x3'));var fs=require('fs');var Redis=require(_0x1fb9('0x4'));var db=require(_0x1fb9('0x5'))['db'];var utils=require(_0x1fb9('0x6'));var logger=require(_0x1fb9('0x7'))(_0x1fb9('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1fb9('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x208a87,_0x23c11d,_0x3b458d){return new BPromise(function(_0x2e43a7,_0x2daa4d){return client[_0x1fb9('0xa')](_0x208a87,_0x3b458d)['then'](function(_0x4d6dc8){logger[_0x1fb9('0xb')](_0x1fb9('0xc'),_0x23c11d,'request\x20sent');logger[_0x1fb9('0xd')](_0x1fb9('0xe'),_0x23c11d,_0x1fb9('0xf'),JSON[_0x1fb9('0x10')](_0x4d6dc8));if(_0x4d6dc8[_0x1fb9('0x11')]){if(_0x4d6dc8['error'][_0x1fb9('0x12')]===0x1f4){logger[_0x1fb9('0x11')](_0x1fb9('0xc'),_0x23c11d,_0x4d6dc8[_0x1fb9('0x11')]['message']);return _0x2daa4d(_0x4d6dc8[_0x1fb9('0x11')][_0x1fb9('0x13')]);}logger[_0x1fb9('0x11')](_0x1fb9('0xc'),_0x23c11d,_0x4d6dc8[_0x1fb9('0x11')][_0x1fb9('0x13')]);return _0x2e43a7(_0x4d6dc8[_0x1fb9('0x11')][_0x1fb9('0x13')]);}else{logger['info'](_0x1fb9('0xc'),_0x23c11d,'request\x20sent');_0x2e43a7(_0x4d6dc8[_0x1fb9('0x14')][_0x1fb9('0x13')]);}})['catch'](function(_0x130339){logger[_0x1fb9('0x11')](_0x1fb9('0xc'),_0x23c11d,_0x130339);_0x2daa4d(_0x130339);});});}exports[_0x1fb9('0x15')]=function(_0x57e64c){var _0x34c1a3=this;return new Promise(function(_0x4d6fbc,_0x446530){return db[_0x1fb9('0x16')]['create'](_0x57e64c[_0x1fb9('0x17')],{'raw':_0x57e64c[_0x1fb9('0x18')]?_0x57e64c[_0x1fb9('0x18')][_0x1fb9('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x5a09d3){logger[_0x1fb9('0xb')](_0x1fb9('0x15'),_0x57e64c);logger[_0x1fb9('0xd')](_0x1fb9('0x15'),_0x57e64c,JSON['stringify'](_0x5a09d3));_0x4d6fbc(_0x5a09d3);})[_0x1fb9('0x1a')](function(_0xb9e56e){logger[_0x1fb9('0x11')](_0x1fb9('0x15'),_0xb9e56e[_0x1fb9('0x13')],_0x57e64c);_0x446530(_0x34c1a3[_0x1fb9('0x11')](0x1f4,_0xb9e56e[_0x1fb9('0x13')]));});});};exports[_0x1fb9('0x1b')]=function(_0x4cde44){var _0x365036=this;return new Promise(function(_0x19a83c,_0x2f11c6){return db[_0x1fb9('0x16')][_0x1fb9('0x1c')](_0x4cde44[_0x1fb9('0x17')],{'raw':_0x4cde44['options']?_0x4cde44[_0x1fb9('0x18')][_0x1fb9('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4cde44[_0x1fb9('0x18')]?_0x4cde44['options'][_0x1fb9('0x1d')]||null:null,'attributes':_0x4cde44['options']?_0x4cde44[_0x1fb9('0x18')]['attributes']||null:null,'limit':_0x4cde44['options']?_0x4cde44[_0x1fb9('0x18')][_0x1fb9('0x1e')]||null:null})[_0x1fb9('0x1f')](function(_0x564e66){logger[_0x1fb9('0xb')](_0x1fb9('0x1b'),_0x4cde44);logger[_0x1fb9('0xd')](_0x1fb9('0x1b'),_0x4cde44,JSON[_0x1fb9('0x10')](_0x564e66));_0x19a83c(_0x564e66);})[_0x1fb9('0x1a')](function(_0x59499a){logger[_0x1fb9('0x11')]('UpdateSmsQueueReport',_0x59499a['message'],_0x4cde44);_0x2f11c6(_0x365036[_0x1fb9('0x11')](0x1f4,_0x59499a[_0x1fb9('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 0df5d79..bac778c 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 _0x4873=['./smsTransferReport.controller','get','isAuthenticated','index','describe','/:id','post','create','put','update','delete','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x6fe380,_0x147f69){var _0x251d29=function(_0x393ef6){while(--_0x393ef6){_0x6fe380['push'](_0x6fe380['shift']());}};_0x251d29(++_0x147f69);}(_0x4873,0x1df));var _0x3487=function(_0x1cf80c,_0x46a677){_0x1cf80c=_0x1cf80c-0x0;var _0x3f8e4c=_0x4873[_0x1cf80c];return _0x3f8e4c;};'use strict';var multer=require(_0x3487('0x0'));var util=require(_0x3487('0x1'));var path=require(_0x3487('0x2'));var timeout=require('connect-timeout');var express=require(_0x3487('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x3487('0x4'));var interaction=require(_0x3487('0x5'));var config=require(_0x3487('0x6'));var controller=require(_0x3487('0x7'));router[_0x3487('0x8')]('/',auth[_0x3487('0x9')](),controller[_0x3487('0xa')]);router[_0x3487('0x8')]('/describe',auth[_0x3487('0x9')](),controller[_0x3487('0xb')]);router[_0x3487('0x8')](_0x3487('0xc'),auth[_0x3487('0x9')](),controller['show']);router[_0x3487('0xd')]('/',auth['isAuthenticated'](),controller[_0x3487('0xe')]);router[_0x3487('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x3487('0x10')]);router[_0x3487('0x11')]('/:id',auth[_0x3487('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x3e74=['get','isAuthenticated','index','/describe','describe','/:id','show','create','put','delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../config/environment','./smsTransferReport.controller'];(function(_0x790467,_0x496fd6){var _0x4bdcae=function(_0x2b0421){while(--_0x2b0421){_0x790467['push'](_0x790467['shift']());}};_0x4bdcae(++_0x496fd6);}(_0x3e74,0x175));var _0x43e7=function(_0x20f547,_0x37b575){_0x20f547=_0x20f547-0x0;var _0x5812ea=_0x3e74[_0x20f547];return _0x5812ea;};'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['post']('/',auth['isAuthenticated'](),controller[_0x43e7('0xe')]);router[_0x43e7('0xf')]('/:id',auth[_0x43e7('0x8')](),controller['update']);router[_0x43e7('0x10')](_0x43e7('0xc'),auth['isAuthenticated'](),controller[_0x43e7('0x11')]);module[_0x43e7('0x12')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 7470cff..93f2f7b 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 _0xf4eb=['NOW','moment','account','queue','DATE'];(function(_0x4aaabd,_0x549448){var _0x58a4de=function(_0x55ce1f){while(--_0x55ce1f){_0x4aaabd['push'](_0x4aaabd['shift']());}};_0x58a4de(++_0x549448);}(_0xf4eb,0xec));var _0xbf4e=function(_0xab9df9,_0x157cc5){_0xab9df9=_0xab9df9-0x0;var _0x2cf1b5=_0xf4eb[_0xab9df9];return _0x2cf1b5;};'use strict';var moment=require(_0xbf4e('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xbf4e('0x1'),'agent','queue'),'allowNull':![],'defaultValue':_0xbf4e('0x2')},'transferredAt':{'type':Sequelize[_0xbf4e('0x3')],'allowNull':![],'defaultValue':Sequelize[_0xbf4e('0x4')]}}; \ No newline at end of file +var _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0x42dd22,_0x24d2d7){var _0x1cd42a=function(_0x116de6){while(--_0x116de6){_0x42dd22['push'](_0x42dd22['shift']());}};_0x1cd42a(++_0x24d2d7);}(_0x70e0,0x17b));var _0x070e=function(_0xddb8b5,_0x2a3af0){_0xddb8b5=_0xddb8b5-0x0;var _0x9d9d9e=_0x70e0[_0xddb8b5];return _0x9d9d9e;};'use strict';var moment=require(_0x070e('0x0'));var Sequelize=require(_0x070e('0x1'));module[_0x070e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5')),'allowNull':![],'defaultValue':_0x070e('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x070e('0x6')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index cfd3c2a..1c47ecc 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 _0xa484=['squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','offset','undefined','limit','set','Content-Range','json','reject','save','update','destroy','sendStatus','error','stack','name','send','map','SmsTransferReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','count','then','includeAll','findAll','rows','catch','rawAttributes','length','include','create','body','find','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash'];(function(_0x14df80,_0xdedde9){var _0x2fa5cd=function(_0x670151){while(--_0x670151){_0x14df80['push'](_0x14df80['shift']());}};_0x2fa5cd(++_0xdedde9);}(_0xa484,0x128));var _0x4a48=function(_0x3c9c6d,_0x4f3cfb){_0x3c9c6d=_0x3c9c6d-0x0;var _0x4d5bbb=_0xa484[_0x3c9c6d];return _0x4d5bbb;};'use strict';var emlformat=require(_0x4a48('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4a48('0x1'));var jsonpatch=require(_0x4a48('0x2'));var rp=require(_0x4a48('0x3'));var moment=require(_0x4a48('0x4'));var BPromise=require(_0x4a48('0x5'));var Mustache=require('mustache');var util=require(_0x4a48('0x6'));var path=require('path');var sox=require(_0x4a48('0x7'));var csv=require(_0x4a48('0x8'));var ejs=require(_0x4a48('0x9'));var fs=require('fs');var fs_extra=require(_0x4a48('0xa'));var _=require(_0x4a48('0xb'));var squel=require(_0x4a48('0xc'));var crypto=require(_0x4a48('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x4a48('0xe'));var toCsv=require(_0x4a48('0x8'));var querystring=require(_0x4a48('0xf'));var Papa=require(_0x4a48('0x10'));var Redis=require(_0x4a48('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x4a48('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x4a48('0x13'));var utils=require(_0x4a48('0x14'));var config=require(_0x4a48('0x15'));var licenseUtil=require(_0x4a48('0x16'));var db=require(_0x4a48('0x17'))['db'];function respondWithStatusCode(_0x55b51a,_0x4f48f0){_0x4f48f0=_0x4f48f0||0xcc;return function(_0x49391f){if(_0x49391f){return _0x55b51a['sendStatus'](_0x4f48f0);}return _0x55b51a['status'](_0x4f48f0)[_0x4a48('0x18')]();};}function respondWithResult(_0x3e1c8a,_0x5ae242){_0x5ae242=_0x5ae242||0xc8;return function(_0x36ed95){if(_0x36ed95){return _0x3e1c8a[_0x4a48('0x19')](_0x5ae242)['json'](_0x36ed95);}};}function respondWithFilteredResult(_0xbd957b,_0x4377e3){return function(_0x44d19d){if(_0x44d19d){var _0x27d0b7=typeof _0x4377e3[_0x4a48('0x1a')]===_0x4a48('0x1b')&&typeof _0x4377e3['limit']===_0x4a48('0x1b');var _0x27f326=_0x44d19d['count'];var _0x2b5dc2=_0x27d0b7?0x0:_0x4377e3[_0x4a48('0x1a')];var _0x5a9243=_0x27d0b7?_0x44d19d['count']:_0x4377e3[_0x4a48('0x1a')]+_0x4377e3[_0x4a48('0x1c')];var _0x49790c;if(_0x5a9243>=_0x27f326){_0x5a9243=_0x27f326;_0x49790c=0xc8;}else{_0x49790c=0xce;}_0xbd957b[_0x4a48('0x19')](_0x49790c);return _0xbd957b[_0x4a48('0x1d')](_0x4a48('0x1e'),_0x2b5dc2+'-'+_0x5a9243+'/'+_0x27f326)[_0x4a48('0x1f')](_0x44d19d);}return null;};}function patchUpdates(_0xbcdb75){return function(_0x10cb4e){try{jsonpatch['apply'](_0x10cb4e,_0xbcdb75,!![]);}catch(_0x3bd444){return BPromise[_0x4a48('0x20')](_0x3bd444);}return _0x10cb4e[_0x4a48('0x21')]();};}function saveUpdates(_0x204acf,_0x528839){return function(_0x3dc67e){if(_0x3dc67e){return _0x3dc67e[_0x4a48('0x22')](_0x204acf)['then'](function(_0x560742){return _0x560742;});}return null;};}function removeEntity(_0x16e66c,_0x317fe4){return function(_0x5b956e){if(_0x5b956e){return _0x5b956e[_0x4a48('0x23')]()['then'](function(){_0x16e66c[_0x4a48('0x19')](0xcc)[_0x4a48('0x18')]();});}};}function handleEntityNotFound(_0x1a0432,_0x3bdbb0){return function(_0x49c13c){if(!_0x49c13c){_0x1a0432[_0x4a48('0x24')](0x194);}return _0x49c13c;};}function handleError(_0x4b7a2c,_0x2565a8){_0x2565a8=_0x2565a8||0x1f4;return function(_0x44bca6){logger[_0x4a48('0x25')](_0x44bca6[_0x4a48('0x26')]);if(_0x44bca6[_0x4a48('0x27')]){delete _0x44bca6['name'];}_0x4b7a2c[_0x4a48('0x19')](_0x2565a8)[_0x4a48('0x28')](_0x44bca6);};}exports['index']=function(_0x4310b7,_0x322b66){var _0x57ad14={},_0x2ea573={},_0x332a24={'count':0x0,'rows':[]};var _0x41ecd8=_[_0x4a48('0x29')](db[_0x4a48('0x2a')]['rawAttributes'],function(_0x50f232){return{'name':_0x50f232[_0x4a48('0x2b')],'type':_0x50f232[_0x4a48('0x2c')][_0x4a48('0x2d')]};});_0x2ea573[_0x4a48('0x2e')]=_[_0x4a48('0x29')](_0x41ecd8,_0x4a48('0x27'));_0x2ea573[_0x4a48('0x2f')]=_[_0x4a48('0x30')](_0x4310b7[_0x4a48('0x2f')]);_0x2ea573[_0x4a48('0x31')]=_[_0x4a48('0x32')](_0x2ea573[_0x4a48('0x2e')],_0x2ea573[_0x4a48('0x2f')]);_0x57ad14[_0x4a48('0x33')]=_['intersection'](_0x2ea573[_0x4a48('0x2e')],qs[_0x4a48('0x34')](_0x4310b7[_0x4a48('0x2f')][_0x4a48('0x34')]));_0x57ad14[_0x4a48('0x33')]=_0x57ad14[_0x4a48('0x33')]['length']?_0x57ad14['attributes']:_0x2ea573[_0x4a48('0x2e')];if(!_0x4310b7[_0x4a48('0x2f')][_0x4a48('0x35')](_0x4a48('0x36'))){_0x57ad14[_0x4a48('0x1c')]=qs[_0x4a48('0x1c')](_0x4310b7['query']['limit']);_0x57ad14['offset']=qs[_0x4a48('0x1a')](_0x4310b7['query'][_0x4a48('0x1a')]);}_0x57ad14[_0x4a48('0x37')]=qs[_0x4a48('0x38')](_0x4310b7[_0x4a48('0x2f')][_0x4a48('0x38')]);_0x57ad14[_0x4a48('0x39')]=qs[_0x4a48('0x31')](_[_0x4a48('0x3a')](_0x4310b7[_0x4a48('0x2f')],_0x2ea573[_0x4a48('0x31')]),_0x41ecd8);if(_0x4310b7[_0x4a48('0x2f')][_0x4a48('0x3b')]){_0x57ad14[_0x4a48('0x39')]=_['merge'](_0x57ad14[_0x4a48('0x39')],{'$or':_[_0x4a48('0x29')](_0x41ecd8,function(_0x46d4f1){if(_0x46d4f1[_0x4a48('0x2c')]!==_0x4a48('0x3c')){var _0x43462f={};_0x43462f[_0x46d4f1[_0x4a48('0x27')]]={'$like':'%'+_0x4310b7['query'][_0x4a48('0x3b')]+'%'};return _0x43462f;}})});}_0x57ad14=_[_0x4a48('0x3d')]({},_0x57ad14,_0x4310b7[_0x4a48('0x3e')]);var _0x413258={'where':_0x57ad14[_0x4a48('0x39')]};return db['SmsTransferReport'][_0x4a48('0x3f')](_0x413258)[_0x4a48('0x40')](function(_0x4bd3de){_0x332a24[_0x4a48('0x3f')]=_0x4bd3de;if(_0x4310b7['query'][_0x4a48('0x41')]){_0x57ad14['include']=[{'all':!![]}];}return db[_0x4a48('0x2a')][_0x4a48('0x42')](_0x57ad14);})['then'](function(_0x22df0d){_0x332a24[_0x4a48('0x43')]=_0x22df0d;return _0x332a24;})['then'](respondWithFilteredResult(_0x322b66,_0x57ad14))[_0x4a48('0x44')](handleError(_0x322b66,null));};exports['show']=function(_0x2e4f39,_0x466ce0){var _0x221247={'raw':!![],'where':{'id':_0x2e4f39['params']['id']}},_0xdc76ba={};_0xdc76ba[_0x4a48('0x2e')]=_['keys'](db[_0x4a48('0x2a')][_0x4a48('0x45')]);_0xdc76ba[_0x4a48('0x2f')]=_[_0x4a48('0x30')](_0x2e4f39['query']);_0xdc76ba['filters']=_[_0x4a48('0x32')](_0xdc76ba[_0x4a48('0x2e')],_0xdc76ba[_0x4a48('0x2f')]);_0x221247['attributes']=_[_0x4a48('0x32')](_0xdc76ba['model'],qs[_0x4a48('0x34')](_0x2e4f39[_0x4a48('0x2f')][_0x4a48('0x34')]));_0x221247['attributes']=_0x221247[_0x4a48('0x33')][_0x4a48('0x46')]?_0x221247['attributes']:_0xdc76ba[_0x4a48('0x2e')];if(_0x2e4f39[_0x4a48('0x2f')][_0x4a48('0x41')]){_0x221247[_0x4a48('0x47')]=[{'all':!![]}];}_0x221247=_[_0x4a48('0x3d')]({},_0x221247,_0x2e4f39[_0x4a48('0x3e')]);return db['SmsTransferReport']['find'](_0x221247)['then'](handleEntityNotFound(_0x466ce0,null))['then'](respondWithResult(_0x466ce0,null))[_0x4a48('0x44')](handleError(_0x466ce0,null));};exports[_0x4a48('0x48')]=function(_0x500051,_0x1e74f6){return db['SmsTransferReport'][_0x4a48('0x48')](_0x500051[_0x4a48('0x49')],{})[_0x4a48('0x40')](respondWithResult(_0x1e74f6,0xc9))['catch'](handleError(_0x1e74f6,null));};exports['update']=function(_0xf55a5f,_0x32e94c){if(_0xf55a5f[_0x4a48('0x49')]['id']){delete _0xf55a5f[_0x4a48('0x49')]['id'];}return db[_0x4a48('0x2a')][_0x4a48('0x4a')]({'where':{'id':_0xf55a5f['params']['id']}})[_0x4a48('0x40')](handleEntityNotFound(_0x32e94c,null))['then'](saveUpdates(_0xf55a5f['body'],null))['then'](respondWithResult(_0x32e94c,null))[_0x4a48('0x44')](handleError(_0x32e94c,null));};exports[_0x4a48('0x23')]=function(_0x26081c,_0x1047e7){return db[_0x4a48('0x2a')][_0x4a48('0x4a')]({'where':{'id':_0x26081c[_0x4a48('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1047e7,null))[_0x4a48('0x40')](removeEntity(_0x1047e7,null))[_0x4a48('0x44')](handleError(_0x1047e7,null));};exports[_0x4a48('0x4c')]=function(_0xd1b052,_0x2276b4){return db[_0x4a48('0x2a')][_0x4a48('0x4c')]()['then'](respondWithResult(_0x2276b4,null))[_0x4a48('0x44')](handleError(_0x2276b4,null));}; \ No newline at end of file +var _0x5718=['end','status','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','rawAttributes','key','map','keys','query','filters','intersection','model','fields','attributes','order','sort','where','pick','filter','merge','includeAll','include','findAll','rows','params','SmsTransferReport','length','options','find','body','catch','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x5e53ae,_0x24af4f){var _0x27a8a2=function(_0xa6a715){while(--_0xa6a715){_0x5e53ae['push'](_0x5e53ae['shift']());}};_0x27a8a2(++_0x24af4f);}(_0x5718,0xc2));var _0x8571=function(_0x5858f3,_0x2c5430){_0x5858f3=_0x5858f3-0x0;var _0x2abeda=_0x5718[_0x5858f3];return _0x2abeda;};'use strict';var emlformat=require(_0x8571('0x0'));var rimraf=require(_0x8571('0x1'));var zipdir=require(_0x8571('0x2'));var jsonpatch=require(_0x8571('0x3'));var rp=require(_0x8571('0x4'));var moment=require(_0x8571('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x8571('0x6'));var util=require(_0x8571('0x7'));var path=require(_0x8571('0x8'));var sox=require(_0x8571('0x9'));var csv=require(_0x8571('0xa'));var ejs=require(_0x8571('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8571('0xc'));var squel=require(_0x8571('0xd'));var crypto=require(_0x8571('0xe'));var jsforce=require(_0x8571('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x8571('0xa'));var querystring=require(_0x8571('0x10'));var Papa=require(_0x8571('0x11'));var Redis=require(_0x8571('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8571('0x13'));var hardwareService=require(_0x8571('0x14'));var logger=require(_0x8571('0x15'))(_0x8571('0x16'));var utils=require(_0x8571('0x17'));var config=require(_0x8571('0x18'));var licenseUtil=require(_0x8571('0x19'));var db=require(_0x8571('0x1a'))['db'];function respondWithStatusCode(_0x504e3b,_0x489d63){_0x489d63=_0x489d63||0xcc;return function(_0x34fd45){if(_0x34fd45){return _0x504e3b[_0x8571('0x1b')](_0x489d63);}return _0x504e3b['status'](_0x489d63)[_0x8571('0x1c')]();};}function respondWithResult(_0x5ee125,_0xce656b){_0xce656b=_0xce656b||0xc8;return function(_0x31b71d){if(_0x31b71d){return _0x5ee125[_0x8571('0x1d')](_0xce656b)[_0x8571('0x1e')](_0x31b71d);}};}function respondWithFilteredResult(_0x2903b1,_0x3cb682){return function(_0x57beef){if(_0x57beef){var _0x4c9666=typeof _0x3cb682[_0x8571('0x1f')]===_0x8571('0x20')&&typeof _0x3cb682[_0x8571('0x21')]===_0x8571('0x20');var _0x394195=_0x57beef[_0x8571('0x22')];var _0x21dfda=_0x4c9666?0x0:_0x3cb682['offset'];var _0x137265=_0x4c9666?_0x57beef[_0x8571('0x22')]:_0x3cb682[_0x8571('0x1f')]+_0x3cb682[_0x8571('0x21')];var _0x4dca82;if(_0x137265>=_0x394195){_0x137265=_0x394195;_0x4dca82=0xc8;}else{_0x4dca82=0xce;}_0x2903b1[_0x8571('0x1d')](_0x4dca82);return _0x2903b1['set'](_0x8571('0x23'),_0x21dfda+'-'+_0x137265+'/'+_0x394195)[_0x8571('0x1e')](_0x57beef);}return null;};}function patchUpdates(_0x4f63c2){return function(_0x38df9d){try{jsonpatch[_0x8571('0x24')](_0x38df9d,_0x4f63c2,!![]);}catch(_0x19001e){return BPromise['reject'](_0x19001e);}return _0x38df9d[_0x8571('0x25')]();};}function saveUpdates(_0x1d2e43,_0x5c075b){return function(_0x105c42){if(_0x105c42){return _0x105c42[_0x8571('0x26')](_0x1d2e43)[_0x8571('0x27')](function(_0x3f65f5){return _0x3f65f5;});}return null;};}function removeEntity(_0x3c9e77,_0x424205){return function(_0x4e53f8){if(_0x4e53f8){return _0x4e53f8[_0x8571('0x28')]()[_0x8571('0x27')](function(){_0x3c9e77[_0x8571('0x1d')](0xcc)[_0x8571('0x1c')]();});}};}function handleEntityNotFound(_0x28ad5e,_0x38041e){return function(_0x345452){if(!_0x345452){_0x28ad5e[_0x8571('0x1b')](0x194);}return _0x345452;};}function handleError(_0x75146e,_0x9f813d){_0x9f813d=_0x9f813d||0x1f4;return function(_0x5054f5){logger[_0x8571('0x29')](_0x5054f5[_0x8571('0x2a')]);if(_0x5054f5[_0x8571('0x2b')]){delete _0x5054f5['name'];}_0x75146e[_0x8571('0x1d')](_0x9f813d)[_0x8571('0x2c')](_0x5054f5);};}exports[_0x8571('0x2d')]=function(_0x5151f9,_0x108340){var _0x16643e={},_0x2d81ee={},_0x237943={'count':0x0,'rows':[]};var _0xbfdd33=_['map'](db['SmsTransferReport'][_0x8571('0x2e')],function(_0x5c1b23){return{'name':_0x5c1b23['fieldName'],'type':_0x5c1b23['type'][_0x8571('0x2f')]};});_0x2d81ee['model']=_[_0x8571('0x30')](_0xbfdd33,_0x8571('0x2b'));_0x2d81ee['query']=_[_0x8571('0x31')](_0x5151f9[_0x8571('0x32')]);_0x2d81ee[_0x8571('0x33')]=_[_0x8571('0x34')](_0x2d81ee['model'],_0x2d81ee[_0x8571('0x32')]);_0x16643e['attributes']=_['intersection'](_0x2d81ee[_0x8571('0x35')],qs['fields'](_0x5151f9[_0x8571('0x32')][_0x8571('0x36')]));_0x16643e[_0x8571('0x37')]=_0x16643e[_0x8571('0x37')]['length']?_0x16643e[_0x8571('0x37')]:_0x2d81ee[_0x8571('0x35')];if(!_0x5151f9['query']['hasOwnProperty']('nolimit')){_0x16643e['limit']=qs[_0x8571('0x21')](_0x5151f9[_0x8571('0x32')][_0x8571('0x21')]);_0x16643e[_0x8571('0x1f')]=qs[_0x8571('0x1f')](_0x5151f9[_0x8571('0x32')][_0x8571('0x1f')]);}_0x16643e[_0x8571('0x38')]=qs[_0x8571('0x39')](_0x5151f9[_0x8571('0x32')]['sort']);_0x16643e[_0x8571('0x3a')]=qs[_0x8571('0x33')](_[_0x8571('0x3b')](_0x5151f9[_0x8571('0x32')],_0x2d81ee[_0x8571('0x33')]),_0xbfdd33);if(_0x5151f9['query'][_0x8571('0x3c')]){_0x16643e[_0x8571('0x3a')]=_[_0x8571('0x3d')](_0x16643e[_0x8571('0x3a')],{'$or':_['map'](_0xbfdd33,function(_0x3854bc){if(_0x3854bc['type']!=='VIRTUAL'){var _0x273d17={};_0x273d17[_0x3854bc[_0x8571('0x2b')]]={'$like':'%'+_0x5151f9[_0x8571('0x32')]['filter']+'%'};return _0x273d17;}})});}_0x16643e=_['merge']({},_0x16643e,_0x5151f9['options']);var _0x113b82={'where':_0x16643e['where']};return db['SmsTransferReport']['count'](_0x113b82)[_0x8571('0x27')](function(_0x185930){_0x237943[_0x8571('0x22')]=_0x185930;if(_0x5151f9[_0x8571('0x32')][_0x8571('0x3e')]){_0x16643e[_0x8571('0x3f')]=[{'all':!![]}];}return db['SmsTransferReport'][_0x8571('0x40')](_0x16643e);})['then'](function(_0xd38140){_0x237943[_0x8571('0x41')]=_0xd38140;return _0x237943;})[_0x8571('0x27')](respondWithFilteredResult(_0x108340,_0x16643e))['catch'](handleError(_0x108340,null));};exports['show']=function(_0x5f10c9,_0x1a9589){var _0x359ce9={'raw':!![],'where':{'id':_0x5f10c9[_0x8571('0x42')]['id']}},_0x5f1435={};_0x5f1435[_0x8571('0x35')]=_[_0x8571('0x31')](db[_0x8571('0x43')][_0x8571('0x2e')]);_0x5f1435[_0x8571('0x32')]=_[_0x8571('0x31')](_0x5f10c9[_0x8571('0x32')]);_0x5f1435['filters']=_[_0x8571('0x34')](_0x5f1435['model'],_0x5f1435[_0x8571('0x32')]);_0x359ce9[_0x8571('0x37')]=_[_0x8571('0x34')](_0x5f1435['model'],qs[_0x8571('0x36')](_0x5f10c9[_0x8571('0x32')]['fields']));_0x359ce9[_0x8571('0x37')]=_0x359ce9[_0x8571('0x37')][_0x8571('0x44')]?_0x359ce9['attributes']:_0x5f1435[_0x8571('0x35')];if(_0x5f10c9[_0x8571('0x32')][_0x8571('0x3e')]){_0x359ce9['include']=[{'all':!![]}];}_0x359ce9=_[_0x8571('0x3d')]({},_0x359ce9,_0x5f10c9[_0x8571('0x45')]);return db['SmsTransferReport'][_0x8571('0x46')](_0x359ce9)[_0x8571('0x27')](handleEntityNotFound(_0x1a9589,null))[_0x8571('0x27')](respondWithResult(_0x1a9589,null))['catch'](handleError(_0x1a9589,null));};exports['create']=function(_0x228483,_0x2d634f){return db[_0x8571('0x43')]['create'](_0x228483[_0x8571('0x47')],{})[_0x8571('0x27')](respondWithResult(_0x2d634f,0xc9))[_0x8571('0x48')](handleError(_0x2d634f,null));};exports[_0x8571('0x26')]=function(_0x257310,_0x2a871d){if(_0x257310['body']['id']){delete _0x257310[_0x8571('0x47')]['id'];}return db['SmsTransferReport'][_0x8571('0x46')]({'where':{'id':_0x257310[_0x8571('0x42')]['id']}})['then'](handleEntityNotFound(_0x2a871d,null))[_0x8571('0x27')](saveUpdates(_0x257310[_0x8571('0x47')],null))[_0x8571('0x27')](respondWithResult(_0x2a871d,null))['catch'](handleError(_0x2a871d,null));};exports['destroy']=function(_0x51e138,_0x314bf2){return db[_0x8571('0x43')][_0x8571('0x46')]({'where':{'id':_0x51e138[_0x8571('0x42')]['id']}})[_0x8571('0x27')](handleEntityNotFound(_0x314bf2,null))['then'](removeEntity(_0x314bf2,null))[_0x8571('0x48')](handleError(_0x314bf2,null));};exports[_0x8571('0x49')]=function(_0x45d35e,_0x594314){return db[_0x8571('0x43')][_0x8571('0x49')]()[_0x8571('0x27')](respondWithResult(_0x594314,null))['catch'](handleError(_0x594314,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index afa47c9..1023773 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 _0x5270=['define','SmsTransferReport','uniqueid','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./smsTransferReport.attributes'];(function(_0x1706cc,_0x2e3a7d){var _0x2dda99=function(_0x3f18ef){while(--_0x3f18ef){_0x1706cc['push'](_0x1706cc['shift']());}};_0x2dda99(++_0x2e3a7d);}(_0x5270,0xab));var _0x0527=function(_0x586e17,_0x23d62a){_0x586e17=_0x586e17-0x0;var _0x261c59=_0x5270[_0x586e17];return _0x261c59;};'use strict';var _=require(_0x0527('0x0'));var util=require(_0x0527('0x1'));var logger=require('../../config/logger')(_0x0527('0x2'));var moment=require(_0x0527('0x3'));var BPromise=require(_0x0527('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0527('0x5'));var rimraf=require(_0x0527('0x6'));var config=require(_0x0527('0x7'));var attributes=require(_0x0527('0x8'));module['exports']=function(_0x3dd3b9,_0x3dd735){return _0x3dd3b9[_0x0527('0x9')](_0x0527('0xa'),attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':_0x0527('0xb'),'fields':[_0x0527('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9c5b=['define','report_sms_transfer','uniqueid','lodash','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./smsTransferReport.attributes','exports'];(function(_0x1eba25,_0x434961){var _0x3851c6=function(_0x109248){while(--_0x109248){_0x1eba25['push'](_0x1eba25['shift']());}};_0x3851c6(++_0x434961);}(_0x9c5b,0x1cb));var _0xb9c5=function(_0x1fed24,_0x43cb6b){_0x1fed24=_0x1fed24-0x0;var _0x1cbf4d=_0x9c5b[_0x1fed24];return _0x1cbf4d;};'use strict';var _=require(_0xb9c5('0x0'));var util=require('util');var logger=require(_0xb9c5('0x1'))('api');var moment=require(_0xb9c5('0x2'));var BPromise=require(_0xb9c5('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb9c5('0x4'));var rimraf=require(_0xb9c5('0x5'));var config=require(_0xb9c5('0x6'));var attributes=require(_0xb9c5('0x7'));module[_0xb9c5('0x8')]=function(_0x4a4dd7,_0x44675b){return _0x4a4dd7[_0xb9c5('0x9')]('SmsTransferReport',attributes,{'tableName':_0xb9c5('0xa'),'paranoid':![],'indexes':[{'name':_0xb9c5('0xb'),'fields':[_0xb9c5('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 17f0c38..3920673 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 _0xce1a=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','SmsTransferReport,\x20%s,\x20%s,\x20%s','error','message','result','lodash'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xce1a,0xbf));var _0xace1=function(_0x2dae76,_0x4e28bf){_0x2dae76=_0x2dae76-0x0;var _0xb15a55=_0xce1a[_0x2dae76];return _0xb15a55;};'use strict';var _=require(_0xace1('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xace1('0x1'));var fs=require('fs');var Redis=require(_0xace1('0x2'));var db=require(_0xace1('0x3'))['db'];var utils=require(_0xace1('0x4'));var logger=require(_0xace1('0x5'))('rpc');var config=require(_0xace1('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xace1('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x7c8f64,_0x2203ef,_0x7f3613){return new BPromise(function(_0x576b34,_0x495cff){return client[_0xace1('0x8')](_0x7c8f64,_0x7f3613)['then'](function(_0x3c8579){logger[_0xace1('0x9')](_0xace1('0xa'),_0x2203ef,_0xace1('0xb'));logger['debug'](_0xace1('0xc'),_0x2203ef,_0xace1('0xb'),JSON['stringify'](_0x3c8579));if(_0x3c8579[_0xace1('0xd')]){if(_0x3c8579[_0xace1('0xd')]['code']===0x1f4){logger['error']('SmsTransferReport,\x20%s,\x20%s',_0x2203ef,_0x3c8579[_0xace1('0xd')][_0xace1('0xe')]);return _0x495cff(_0x3c8579[_0xace1('0xd')]['message']);}logger['error']('SmsTransferReport,\x20%s,\x20%s',_0x2203ef,_0x3c8579[_0xace1('0xd')][_0xace1('0xe')]);return _0x576b34(_0x3c8579[_0xace1('0xd')][_0xace1('0xe')]);}else{logger[_0xace1('0x9')](_0xace1('0xa'),_0x2203ef,_0xace1('0xb'));_0x576b34(_0x3c8579[_0xace1('0xf')]['message']);}})['catch'](function(_0x42dd0e){logger[_0xace1('0xd')]('SmsTransferReport,\x20%s,\x20%s',_0x2203ef,_0x42dd0e);_0x495cff(_0x42dd0e);});});} \ No newline at end of file +var _0x00bb=['stringify','error','message','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','request','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s'];(function(_0x5b1edc,_0xd5fa84){var _0xe44ac8=function(_0x5532bd){while(--_0x5532bd){_0x5b1edc['push'](_0x5b1edc['shift']());}};_0xe44ac8(++_0xd5fa84);}(_0x00bb,0x1d8));var _0xb00b=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x00bb[_0x618414];return _0x21c19a;};'use strict';var _=require(_0xb00b('0x0'));var util=require(_0xb00b('0x1'));var moment=require(_0xb00b('0x2'));var BPromise=require('bluebird');var rs=require(_0xb00b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb00b('0x4'))['db'];var utils=require(_0xb00b('0x5'));var logger=require('../../config/logger')(_0xb00b('0x6'));var config=require(_0xb00b('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x36e363,_0xf737d0,_0x41dfc9){return new BPromise(function(_0x37f07d,_0xfa4181){return client[_0xb00b('0x8')](_0x36e363,_0x41dfc9)['then'](function(_0x51d12b){logger[_0xb00b('0x9')](_0xb00b('0xa'),_0xf737d0,_0xb00b('0xb'));logger[_0xb00b('0xc')](_0xb00b('0xd'),_0xf737d0,'request\x20sent',JSON[_0xb00b('0xe')](_0x51d12b));if(_0x51d12b['error']){if(_0x51d12b['error']['code']===0x1f4){logger[_0xb00b('0xf')](_0xb00b('0xa'),_0xf737d0,_0x51d12b[_0xb00b('0xf')][_0xb00b('0x10')]);return _0xfa4181(_0x51d12b[_0xb00b('0xf')][_0xb00b('0x10')]);}logger['error'](_0xb00b('0xa'),_0xf737d0,_0x51d12b[_0xb00b('0xf')]['message']);return _0x37f07d(_0x51d12b[_0xb00b('0xf')][_0xb00b('0x10')]);}else{logger['info']('SmsTransferReport,\x20%s,\x20%s',_0xf737d0,_0xb00b('0xb'));_0x37f07d(_0x51d12b['result']['message']);}})[_0xb00b('0x11')](function(_0x638443){logger[_0xb00b('0xf')](_0xb00b('0xa'),_0xf737d0,_0x638443);_0xfa4181(_0x638443);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index e8c13ed..aa8d17b 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 _0xcefe=['multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./sound.controller','isAuthenticated','get','/:id','show','download','join','root','server/files/sounds/original/','originalname','replace','format','%s-%s%s','basename','extname','post','single','file','create','put','update','delete','exports'];(function(_0x41d52c,_0x361699){var _0x4f30ba=function(_0x367fa1){while(--_0x367fa1){_0x41d52c['push'](_0x41d52c['shift']());}};_0x4f30ba(++_0x361699);}(_0xcefe,0xd2));var _0xecef=function(_0x103aef,_0x17a372){_0x103aef=_0x103aef-0x0;var _0x5dea5c=_0xcefe[_0x103aef];return _0x5dea5c;};'use strict';var multer=require(_0xecef('0x0'));var util=require(_0xecef('0x1'));var path=require('path');var timeout=require(_0xecef('0x2'));var express=require(_0xecef('0x3'));var router=express['Router']();var fs_extra=require(_0xecef('0x4'));var auth=require(_0xecef('0x5'));var interaction=require(_0xecef('0x6'));var config=require('../../config/environment');var controller=require(_0xecef('0x7'));router['get']('/',auth[_0xecef('0x8')](),controller['index']);router[_0xecef('0x9')](_0xecef('0xa'),auth[_0xecef('0x8')](),controller[_0xecef('0xb')]);router[_0xecef('0x9')]('/:id/download',auth[_0xecef('0x8')](),controller[_0xecef('0xc')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1e7dce,_0xcf84c0,_0x5802c9){_0x5802c9(null,path[_0xecef('0xd')](config[_0xecef('0xe')],_0xecef('0xf')));},'filename':function(_0x36a9d2,_0x37fe0c,_0x25deb0){_0x37fe0c[_0xecef('0x10')]=_0x37fe0c[_0xecef('0x10')][_0xecef('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x25deb0(null,util[_0xecef('0x12')](_0xecef('0x13'),path[_0xecef('0x14')](_0x37fe0c[_0xecef('0x10')],path[_0xecef('0x15')](_0x37fe0c[_0xecef('0x10')])),Date['now'](),path['extname'](_0x37fe0c['originalname'])));}})});router[_0xecef('0x16')]('/',upload[_0xecef('0x17')](_0xecef('0x18')),controller[_0xecef('0x19')]);router[_0xecef('0x1a')](_0xecef('0xa'),auth[_0xecef('0x8')](),controller[_0xecef('0x1b')]);router[_0xecef('0x1c')](_0xecef('0xa'),auth['isAuthenticated'](),controller[_0xecef('0x1c')]);module[_0xecef('0x1d')]=router; \ No newline at end of file +var _0x7f6d=['get','isAuthenticated','index','/:id','show','download','diskStorage','join','root','server/files/sounds/original/','originalname','replace','format','%s-%s%s','extname','now','post','single','file','create','update','delete','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller'];(function(_0x5985ff,_0x5621a5){var _0x5cbe61=function(_0x3e712b){while(--_0x3e712b){_0x5985ff['push'](_0x5985ff['shift']());}};_0x5cbe61(++_0x5621a5);}(_0x7f6d,0x97));var _0xd7f6=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0x7f6d[_0xa148b7];return _0x51efd3;};'use strict';var multer=require(_0xd7f6('0x0'));var util=require(_0xd7f6('0x1'));var path=require(_0xd7f6('0x2'));var timeout=require(_0xd7f6('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xd7f6('0x4'));var auth=require(_0xd7f6('0x5'));var interaction=require(_0xd7f6('0x6'));var config=require(_0xd7f6('0x7'));var controller=require(_0xd7f6('0x8'));router[_0xd7f6('0x9')]('/',auth[_0xd7f6('0xa')](),controller[_0xd7f6('0xb')]);router[_0xd7f6('0x9')](_0xd7f6('0xc'),auth[_0xd7f6('0xa')](),controller[_0xd7f6('0xd')]);router[_0xd7f6('0x9')]('/:id/download',auth[_0xd7f6('0xa')](),controller[_0xd7f6('0xe')]);var upload=multer({'storage':multer[_0xd7f6('0xf')]({'destination':function(_0x2865c9,_0xb46d95,_0x29e3ce){_0x29e3ce(null,path[_0xd7f6('0x10')](config[_0xd7f6('0x11')],_0xd7f6('0x12')));},'filename':function(_0x2c60ff,_0x5a3f6b,_0x199b13){_0x5a3f6b[_0xd7f6('0x13')]=_0x5a3f6b['originalname'][_0xd7f6('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x199b13(null,util[_0xd7f6('0x15')](_0xd7f6('0x16'),path['basename'](_0x5a3f6b['originalname'],path[_0xd7f6('0x17')](_0x5a3f6b['originalname'])),Date[_0xd7f6('0x18')](),path['extname'](_0x5a3f6b[_0xd7f6('0x13')])));}})});router[_0xd7f6('0x19')]('/',upload[_0xd7f6('0x1a')](_0xd7f6('0x1b')),controller[_0xd7f6('0x1c')]);router['put'](_0xd7f6('0xc'),auth[_0xd7f6('0xa')](),controller[_0xd7f6('0x1d')]);router[_0xd7f6('0x1e')](_0xd7f6('0xc'),auth[_0xd7f6('0xa')](),controller[_0xd7f6('0x1e')]);module[_0xd7f6('0x1f')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 5da7ae7..21da832 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 _0xf7e3=['STRING','FLOAT','BIGINT','INTEGER','name'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xf7e3,0x171));var _0x3f7e=function(_0x27435a,_0x4f94e7){_0x27435a=_0x27435a-0x0;var _0x1f93de=_0xf7e3[_0x27435a];return _0x1f93de;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x3f7e('0x0'),'allowNull':![]},'save_name':{'type':Sequelize[_0x3f7e('0x1')]},'display_name':{'type':Sequelize[_0x3f7e('0x1')],'defaultValue':''},'description':{'type':Sequelize[_0x3f7e('0x1')]},'original_format':{'type':Sequelize[_0x3f7e('0x1')]},'original_duration':{'type':Sequelize[_0x3f7e('0x2')]},'original_sampleCount':{'type':Sequelize[_0x3f7e('0x3')]},'original_channelCount':{'type':Sequelize[_0x3f7e('0x4')]},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize[_0x3f7e('0x1')]},'converted_duration':{'type':Sequelize[_0x3f7e('0x2')]},'converted_sampleCount':{'type':Sequelize[_0x3f7e('0x3')]},'converted_channelCount':{'type':Sequelize[_0x3f7e('0x4')]},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize[_0x3f7e('0x4')]}}; \ No newline at end of file +var _0xb56f=['exports','STRING','FLOAT','INTEGER','BIGINT','sequelize'];(function(_0x57fe19,_0xa1b632){var _0x3488f7=function(_0xf46cff){while(--_0xf46cff){_0x57fe19['push'](_0x57fe19['shift']());}};_0x3488f7(++_0xa1b632);}(_0xb56f,0x113));var _0xfb56=function(_0x1cb571,_0x581903){_0x1cb571=_0x1cb571-0x0;var _0x5afa85=_0xb56f[_0x1cb571];return _0x5afa85;};'use strict';var Sequelize=require(_0xfb56('0x0'));module[_0xfb56('0x1')]={'name':{'type':Sequelize[_0xfb56('0x2')],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize[_0xfb56('0x2')]},'display_name':{'type':Sequelize[_0xfb56('0x2')],'defaultValue':''},'description':{'type':Sequelize['STRING']},'original_format':{'type':Sequelize[_0xfb56('0x2')]},'original_duration':{'type':Sequelize[_0xfb56('0x3')]},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize[_0xfb56('0x4')]},'original_bitRate':{'type':Sequelize[_0xfb56('0x5')]},'original_sampleRate':{'type':Sequelize[_0xfb56('0x4')]},'converted_format':{'type':Sequelize[_0xfb56('0x2')]},'converted_duration':{'type':Sequelize[_0xfb56('0x3')]},'converted_sampleCount':{'type':Sequelize[_0xfb56('0x5')]},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize[_0xfb56('0x4')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index dfe8c99..e1153e1 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 _0x12f6=['converted_channelCount','converted_bitRate','converted_sampleRate','create','role','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','description','delete','unlinkSync','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','offset','count','limit','set','Content-Range','apply','reject','save','update','then','get','Sounds','UserProfileResource','destroy','error','stack','name','send','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','sort','where','filters','pick','filter','VIRTUAL','options','Sound','includeAll','findAll','catch','show','include','merge','download','find','params','save_name','converted_format','existsSync','join','root','server/files/sounds/converted','Sequelize','ValidationError','format','%s.%s','basename','file','originalname','extname','substring','filename','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','wav','src','original_duration','duration','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','converted_duration','converted_sampleCount'];(function(_0x565160,_0x406323){var _0x44ef98=function(_0x1ec0be){while(--_0x1ec0be){_0x565160['push'](_0x565160['shift']());}};_0x44ef98(++_0x406323);}(_0x12f6,0x10b));var _0x612f=function(_0x17c56a,_0x329fc8){_0x17c56a=_0x17c56a-0x0;var _0x15cbfc=_0x12f6[_0x17c56a];return _0x15cbfc;};'use strict';var emlformat=require(_0x612f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x612f('0x1'));var rp=require(_0x612f('0x2'));var moment=require(_0x612f('0x3'));var BPromise=require(_0x612f('0x4'));var Mustache=require(_0x612f('0x5'));var util=require(_0x612f('0x6'));var path=require(_0x612f('0x7'));var sox=require(_0x612f('0x8'));var csv=require(_0x612f('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x612f('0xa'));var _=require(_0x612f('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x612f('0xc'));var deskjs=require(_0x612f('0xd'));var toCsv=require('to-csv');var querystring=require(_0x612f('0xe'));var Papa=require(_0x612f('0xf'));var Redis=require(_0x612f('0x10'));var authService=require(_0x612f('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x612f('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x612f('0x13'))('api');var utils=require(_0x612f('0x14'));var config=require(_0x612f('0x15'));var licenseUtil=require(_0x612f('0x16'));var db=require(_0x612f('0x17'))['db'];function respondWithStatusCode(_0x10793d,_0x385f0f){_0x385f0f=_0x385f0f||0xcc;return function(_0x144a52){if(_0x144a52){return _0x10793d[_0x612f('0x18')](_0x385f0f);}return _0x10793d[_0x612f('0x19')](_0x385f0f)[_0x612f('0x1a')]();};}function respondWithResult(_0x11166b,_0x336f38){_0x336f38=_0x336f38||0xc8;return function(_0x16ebeb){if(_0x16ebeb){return _0x11166b[_0x612f('0x19')](_0x336f38)[_0x612f('0x1b')](_0x16ebeb);}};}function respondWithFilteredResult(_0x4e9592,_0x176443){return function(_0x4480ea){if(_0x4480ea){var _0x3369fd=typeof _0x176443['offset']===_0x612f('0x1c')&&typeof _0x176443['limit']===_0x612f('0x1c');var _0x503c84=_0x4480ea['count'];var _0x328172=_0x3369fd?0x0:_0x176443[_0x612f('0x1d')];var _0x13b08d=_0x3369fd?_0x4480ea[_0x612f('0x1e')]:_0x176443[_0x612f('0x1d')]+_0x176443[_0x612f('0x1f')];var _0x2d353c;if(_0x13b08d>=_0x503c84){_0x13b08d=_0x503c84;_0x2d353c=0xc8;}else{_0x2d353c=0xce;}_0x4e9592[_0x612f('0x19')](_0x2d353c);return _0x4e9592[_0x612f('0x20')](_0x612f('0x21'),_0x328172+'-'+_0x13b08d+'/'+_0x503c84)[_0x612f('0x1b')](_0x4480ea);}return null;};}function patchUpdates(_0x4910b7){return function(_0x3a2b6b){try{jsonpatch[_0x612f('0x22')](_0x3a2b6b,_0x4910b7,!![]);}catch(_0x3db440){return BPromise[_0x612f('0x23')](_0x3db440);}return _0x3a2b6b[_0x612f('0x24')]();};}function saveUpdates(_0x277d00,_0x58df15){return function(_0x597b8a){if(_0x597b8a){return _0x597b8a[_0x612f('0x25')](_0x277d00)[_0x612f('0x26')](function(_0x46fb1f){return _0x46fb1f;});}return null;};}function removeEntity(_0x3386cc,_0x2c91ff){return function(_0x4ef90f){if(_0x4ef90f){return _0x4ef90f['destroy']()[_0x612f('0x26')](function(){var _0x4d25a4=_0x4ef90f[_0x612f('0x27')]({'plain':!![]});var _0x46af04=_0x612f('0x28');return db[_0x612f('0x29')][_0x612f('0x2a')]({'where':{'type':_0x46af04,'resourceId':_0x4d25a4['id']}})[_0x612f('0x26')](function(){return _0x4ef90f;});})['then'](function(){_0x3386cc[_0x612f('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5237a0,_0x2aa83c){return function(_0x1927c7){if(!_0x1927c7){_0x5237a0[_0x612f('0x18')](0x194);}return _0x1927c7;};}function handleError(_0x57d384,_0x439410){_0x439410=_0x439410||0x1f4;return function(_0x36069d){logger[_0x612f('0x2b')](_0x36069d[_0x612f('0x2c')]);if(_0x36069d['name']){delete _0x36069d[_0x612f('0x2d')];}_0x57d384[_0x612f('0x19')](_0x439410)[_0x612f('0x2e')](_0x36069d);};}exports['index']=function(_0x2a4974,_0x4d32db){var _0x139acc={},_0x55454f={},_0x33e9e9={'count':0x0,'rows':[]};var _0x50fb59=_['map'](db['Sound'][_0x612f('0x2f')],function(_0x577a65){return{'name':_0x577a65[_0x612f('0x30')],'type':_0x577a65[_0x612f('0x31')][_0x612f('0x32')]};});_0x55454f[_0x612f('0x33')]=_[_0x612f('0x34')](_0x50fb59,'name');_0x55454f[_0x612f('0x35')]=_[_0x612f('0x36')](_0x2a4974['query']);_0x55454f['filters']=_[_0x612f('0x37')](_0x55454f[_0x612f('0x33')],_0x55454f['query']);_0x139acc[_0x612f('0x38')]=_[_0x612f('0x37')](_0x55454f[_0x612f('0x33')],qs['fields'](_0x2a4974[_0x612f('0x35')][_0x612f('0x39')]));_0x139acc[_0x612f('0x38')]=_0x139acc['attributes'][_0x612f('0x3a')]?_0x139acc['attributes']:_0x55454f['model'];if(!_0x2a4974[_0x612f('0x35')][_0x612f('0x3b')]('nolimit')){_0x139acc[_0x612f('0x1f')]=qs[_0x612f('0x1f')](_0x2a4974[_0x612f('0x35')][_0x612f('0x1f')]);_0x139acc[_0x612f('0x1d')]=qs[_0x612f('0x1d')](_0x2a4974[_0x612f('0x35')][_0x612f('0x1d')]);}_0x139acc['order']=qs[_0x612f('0x3c')](_0x2a4974[_0x612f('0x35')][_0x612f('0x3c')]);_0x139acc[_0x612f('0x3d')]=qs[_0x612f('0x3e')](_[_0x612f('0x3f')](_0x2a4974[_0x612f('0x35')],_0x55454f[_0x612f('0x3e')]),_0x50fb59);if(_0x2a4974[_0x612f('0x35')][_0x612f('0x40')]){_0x139acc[_0x612f('0x3d')]=_['merge'](_0x139acc[_0x612f('0x3d')],{'$or':_[_0x612f('0x34')](_0x50fb59,function(_0x12a44d){if(_0x12a44d['type']!==_0x612f('0x41')){var _0x263fbf={};_0x263fbf[_0x12a44d[_0x612f('0x2d')]]={'$like':'%'+_0x2a4974[_0x612f('0x35')][_0x612f('0x40')]+'%'};return _0x263fbf;}})});}_0x139acc=_['merge']({},_0x139acc,_0x2a4974[_0x612f('0x42')]);var _0x967271={'where':_0x139acc[_0x612f('0x3d')]};return db[_0x612f('0x43')][_0x612f('0x1e')](_0x967271)[_0x612f('0x26')](function(_0x58ffc6){_0x33e9e9[_0x612f('0x1e')]=_0x58ffc6;if(_0x2a4974[_0x612f('0x35')][_0x612f('0x44')]){_0x139acc['include']=[{'all':!![]}];}return db[_0x612f('0x43')][_0x612f('0x45')](_0x139acc);})[_0x612f('0x26')](function(_0x103b1a){_0x33e9e9['rows']=_0x103b1a;return _0x33e9e9;})[_0x612f('0x26')](respondWithFilteredResult(_0x4d32db,_0x139acc))[_0x612f('0x46')](handleError(_0x4d32db,null));};exports[_0x612f('0x47')]=function(_0x4594ab,_0x36c5ef){var _0x582e01={'raw':!![],'where':{'id':_0x4594ab['params']['id']}},_0x2ae621={};_0x2ae621[_0x612f('0x33')]=_['keys'](db['Sound'][_0x612f('0x2f')]);_0x2ae621[_0x612f('0x35')]=_[_0x612f('0x36')](_0x4594ab[_0x612f('0x35')]);_0x2ae621[_0x612f('0x3e')]=_[_0x612f('0x37')](_0x2ae621[_0x612f('0x33')],_0x2ae621['query']);_0x582e01[_0x612f('0x38')]=_[_0x612f('0x37')](_0x2ae621[_0x612f('0x33')],qs[_0x612f('0x39')](_0x4594ab[_0x612f('0x35')]['fields']));_0x582e01[_0x612f('0x38')]=_0x582e01['attributes'][_0x612f('0x3a')]?_0x582e01[_0x612f('0x38')]:_0x2ae621['model'];if(_0x4594ab['query'][_0x612f('0x44')]){_0x582e01[_0x612f('0x48')]=[{'all':!![]}];}_0x582e01=_[_0x612f('0x49')]({},_0x582e01,_0x4594ab[_0x612f('0x42')]);return db[_0x612f('0x43')]['find'](_0x582e01)[_0x612f('0x26')](handleEntityNotFound(_0x36c5ef,null))[_0x612f('0x26')](respondWithResult(_0x36c5ef,null))[_0x612f('0x46')](handleError(_0x36c5ef,null));};exports[_0x612f('0x4a')]=function(_0x312ace,_0x2b6a58,_0x4d58cf){return db[_0x612f('0x43')][_0x612f('0x4b')]({'where':{'id':_0x312ace[_0x612f('0x4c')]['id']},'attributes':[_0x612f('0x2d'),_0x612f('0x4d'),_0x612f('0x4e')],'raw':!![]})[_0x612f('0x26')](handleEntityNotFound(_0x2b6a58,null))['then'](function(_0x38390c){if(_0x38390c){if(!fs[_0x612f('0x4f')](path[_0x612f('0x50')](config[_0x612f('0x51')],_0x612f('0x52'),_0x38390c['save_name']+'.'+_0x38390c[_0x612f('0x4e')]))){throw new db[(_0x612f('0x53'))][(_0x612f('0x54'))]('Sound\x20not\x20found');}return _0x2b6a58[_0x612f('0x4a')](path['join'](config['root'],'server/files/sounds/converted',util[_0x612f('0x55')](_0x612f('0x56'),_0x38390c[_0x612f('0x4d')],_0x38390c[_0x612f('0x4e')])),util['format'](_0x612f('0x56'),_0x38390c[_0x612f('0x2d')],_0x38390c[_0x612f('0x4e')]));}return null;})[_0x612f('0x46')](handleError(_0x2b6a58,null));};exports['create']=function(_0x523254,_0x431b2c,_0x6a3303){var _0x36ffc1={'name':path[_0x612f('0x57')](_0x523254[_0x612f('0x58')][_0x612f('0x59')],path['extname'](_0x523254[_0x612f('0x58')][_0x612f('0x59')])),'save_name':path['basename'](_0x523254[_0x612f('0x58')]['filename'],path[_0x612f('0x5a')](_0x523254[_0x612f('0x58')]['filename'])),'original_format':path[_0x612f('0x5a')](_0x523254['file'][_0x612f('0x59')])[_0x612f('0x5b')](0x1),'converted_format':'wav'};var _0x6d3f3e=path[_0x612f('0x50')](config['root'],'server/files/sounds/original',_0x523254[_0x612f('0x58')][_0x612f('0x5c')]);var _0x4a2703=path[_0x612f('0x50')](config[_0x612f('0x51')],_0x612f('0x52'),util[_0x612f('0x55')](_0x612f('0x56'),path[_0x612f('0x57')](_0x523254[_0x612f('0x58')][_0x612f('0x5c')],path[_0x612f('0x5a')](_0x523254[_0x612f('0x58')]['filename'])),_0x36ffc1[_0x612f('0x4e')]));logger[_0x612f('0x5d')](_0x612f('0x5e'),_0x6d3f3e);logger[_0x612f('0x5d')](_0x612f('0x5f'),_0x4a2703);try{fs[_0x612f('0x60')](_0x6d3f3e,parseInt(_0x612f('0x61'),0x8));var _0x1a5232=sox['transcode'](_0x6d3f3e,_0x4a2703,{'sampleRate':0x1f40,'format':_0x612f('0x62'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x1a5232['on'](_0x612f('0x2b'),function(_0x2be81c){fs['unlinkSync'](_0x6d3f3e);_0x431b2c[_0x612f('0x19')](0x1f4)[_0x612f('0x2e')](_0x2be81c);});_0x1a5232['on'](_0x612f('0x63'),function(_0x2cd4d8){_0x36ffc1[_0x612f('0x64')]=isNaN(_0x2cd4d8[_0x612f('0x65')])?null:_0x2cd4d8[_0x612f('0x65')]*0x3e8;_0x36ffc1['original_sampleCount']=isNaN(_0x2cd4d8[_0x612f('0x66')])?null:_0x2cd4d8[_0x612f('0x66')];_0x36ffc1[_0x612f('0x67')]=isNaN(_0x2cd4d8[_0x612f('0x68')])?null:_0x2cd4d8['channelCount'];_0x36ffc1[_0x612f('0x69')]=isNaN(_0x2cd4d8[_0x612f('0x6a')])?null:_0x2cd4d8[_0x612f('0x6a')];_0x36ffc1[_0x612f('0x6b')]=isNaN(_0x2cd4d8[_0x612f('0x6c')])?null:_0x2cd4d8['sampleRate'];});_0x1a5232['on']('dest',function(_0x255967){_0x36ffc1[_0x612f('0x6d')]=isNaN(_0x255967[_0x612f('0x65')])?null:_0x255967[_0x612f('0x65')]*0x3e8;_0x36ffc1[_0x612f('0x6e')]=isNaN(_0x255967[_0x612f('0x66')])?null:_0x255967[_0x612f('0x66')];_0x36ffc1[_0x612f('0x6f')]=isNaN(_0x255967[_0x612f('0x68')])?null:_0x255967[_0x612f('0x68')];_0x36ffc1[_0x612f('0x70')]=isNaN(_0x255967[_0x612f('0x6a')])?null:_0x255967[_0x612f('0x6a')];_0x36ffc1[_0x612f('0x71')]=isNaN(_0x255967['sampleRate'])?null:_0x255967['sampleRate'];});_0x1a5232['on'](_0x612f('0x1a'),function(){fs[_0x612f('0x60')](_0x4a2703,parseInt(_0x612f('0x61'),0x8));return db[_0x612f('0x43')][_0x612f('0x72')](_0x36ffc1)[_0x612f('0x26')](function(_0x2b0d33){var _0x12a660={'role':_0x523254['body'][_0x612f('0x73')],'userProfileId':_0x523254[_0x612f('0x74')]['userProfileId']};if(!_0x12a660)throw new Error(_0x612f('0x75'));if(_0x12a660[_0x612f('0x73')]==='user'){var _0x424b50=_0x2b0d33[_0x612f('0x27')]({'plain':!![]});return db[_0x612f('0x76')]['find']({'where':{'name':_0x612f('0x28'),'userProfileId':_0x12a660[_0x612f('0x77')]},'raw':!![]})['then'](function(_0x404ad8){if(_0x404ad8&&_0x404ad8[_0x612f('0x78')]===0x0){return db['UserProfileResource'][_0x612f('0x72')]({'name':_0x424b50['name'],'resourceId':_0x424b50['id'],'type':_0x404ad8[_0x612f('0x2d')],'sectionId':_0x404ad8['id']},{})[_0x612f('0x26')](function(){return _0x2b0d33;});}else{return _0x2b0d33;}})['catch'](function(_0x48373c){logger['error'](_0x612f('0x79'),_0x48373c);throw _0x48373c;});}return _0x2b0d33;})[_0x612f('0x26')](respondWithResult(_0x431b2c,null))['catch'](handleError(_0x431b2c,null));});_0x1a5232[_0x612f('0x7a')]();}catch(_0x1c024e){_0x431b2c['status'](0x1f4)[_0x612f('0x2e')](_0x1c024e);}};exports[_0x612f('0x25')]=function(_0x1f484b,_0xb1142e,_0x585675){return db[_0x612f('0x43')]['find']({'where':{'id':_0x1f484b[_0x612f('0x4c')]['id']}})[_0x612f('0x26')](handleEntityNotFound(_0xb1142e,null))[_0x612f('0x26')](saveUpdates(_[_0x612f('0x3f')](_0x1f484b[_0x612f('0x74')],[_0x612f('0x2d'),_0x612f('0x7b')]),null))[_0x612f('0x26')](respondWithResult(_0xb1142e,null))['catch'](handleError(_0xb1142e,null));};exports[_0x612f('0x7c')]=function(_0x287635,_0x584094,_0x323e01){return db[_0x612f('0x43')][_0x612f('0x4b')]({'where':{'id':_0x287635[_0x612f('0x4c')]['id']}})['then'](function(_0x4abb4c){if(_0x4abb4c){return _0x4abb4c[_0x612f('0x2a')]();}})[_0x612f('0x26')](function(_0x288379){var _0x44d6dd=path['join'](config[_0x612f('0x51')],'server/files/sounds/original',util['format'](_0x612f('0x56'),_0x288379['save_name'],_0x288379['original_format']));var _0x459c5e=path['join'](config['root'],'server/files/sounds/converted',util[_0x612f('0x55')](_0x612f('0x56'),_0x288379[_0x612f('0x4d')],_0x288379[_0x612f('0x4e')]));fs[_0x612f('0x7d')](_0x44d6dd);fs[_0x612f('0x7d')](_0x459c5e);return _0x288379;})[_0x612f('0x26')](function(_0x49b9f9){if(_0x49b9f9){return _0x584094[_0x612f('0x19')](0xcc)[_0x612f('0x1a')]();}})[_0x612f('0x26')](handleEntityNotFound(_0x584094,null))['catch'](handleError(_0x584094,null));}; \ No newline at end of file +var _0xf5da=['save','update','then','destroy','get','Sounds','UserProfileResource','error','name','send','index','map','Sound','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','includeAll','include','catch','show','params','rawAttributes','keys','options','find','download','converted_format','existsSync','join','root','server/files/sounds/converted','save_name','Sequelize','Sound\x20not\x20found','format','%s.%s','create','basename','file','originalname','extname','substring','wav','server/files/sounds/original','filename','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','transcode','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_bitRate','converted_sampleRate','0777','body','role','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','description','delete','original_format','unlinkSync','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject'];(function(_0x34cd28,_0x5ecccb){var _0x3b8f62=function(_0x13e33e){while(--_0x13e33e){_0x34cd28['push'](_0x34cd28['shift']());}};_0x3b8f62(++_0x5ecccb);}(_0xf5da,0x15e));var _0xaf5d=function(_0x54aea3,_0xae7d81){_0x54aea3=_0x54aea3-0x0;var _0x21ae46=_0xf5da[_0x54aea3];return _0x21ae46;};'use strict';var emlformat=require(_0xaf5d('0x0'));var rimraf=require(_0xaf5d('0x1'));var zipdir=require(_0xaf5d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xaf5d('0x3'));var moment=require(_0xaf5d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xaf5d('0x5'));var util=require(_0xaf5d('0x6'));var path=require(_0xaf5d('0x7'));var sox=require(_0xaf5d('0x8'));var csv=require('to-csv');var ejs=require(_0xaf5d('0x9'));var fs=require('fs');var fs_extra=require(_0xaf5d('0xa'));var _=require(_0xaf5d('0xb'));var squel=require(_0xaf5d('0xc'));var crypto=require(_0xaf5d('0xd'));var jsforce=require(_0xaf5d('0xe'));var deskjs=require(_0xaf5d('0xf'));var toCsv=require(_0xaf5d('0x10'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xaf5d('0x11'));var authService=require(_0xaf5d('0x12'));var qs=require(_0xaf5d('0x13'));var as=require(_0xaf5d('0x14'));var hardwareService=require(_0xaf5d('0x15'));var logger=require(_0xaf5d('0x16'))('api');var utils=require(_0xaf5d('0x17'));var config=require(_0xaf5d('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xaf5d('0x19'))['db'];function respondWithStatusCode(_0x2d930d,_0x40bfb8){_0x40bfb8=_0x40bfb8||0xcc;return function(_0x228775){if(_0x228775){return _0x2d930d[_0xaf5d('0x1a')](_0x40bfb8);}return _0x2d930d[_0xaf5d('0x1b')](_0x40bfb8)[_0xaf5d('0x1c')]();};}function respondWithResult(_0x70405e,_0xde119c){_0xde119c=_0xde119c||0xc8;return function(_0x1a2758){if(_0x1a2758){return _0x70405e['status'](_0xde119c)[_0xaf5d('0x1d')](_0x1a2758);}};}function respondWithFilteredResult(_0x1fefef,_0x63ecc5){return function(_0x5bd3d9){if(_0x5bd3d9){var _0x20060f=typeof _0x63ecc5[_0xaf5d('0x1e')]===_0xaf5d('0x1f')&&typeof _0x63ecc5[_0xaf5d('0x20')]===_0xaf5d('0x1f');var _0x502299=_0x5bd3d9[_0xaf5d('0x21')];var _0x44379a=_0x20060f?0x0:_0x63ecc5[_0xaf5d('0x1e')];var _0x3c7255=_0x20060f?_0x5bd3d9[_0xaf5d('0x21')]:_0x63ecc5[_0xaf5d('0x1e')]+_0x63ecc5[_0xaf5d('0x20')];var _0x28e397;if(_0x3c7255>=_0x502299){_0x3c7255=_0x502299;_0x28e397=0xc8;}else{_0x28e397=0xce;}_0x1fefef[_0xaf5d('0x1b')](_0x28e397);return _0x1fefef[_0xaf5d('0x22')](_0xaf5d('0x23'),_0x44379a+'-'+_0x3c7255+'/'+_0x502299)['json'](_0x5bd3d9);}return null;};}function patchUpdates(_0x3024e4){return function(_0x54cf72){try{jsonpatch['apply'](_0x54cf72,_0x3024e4,!![]);}catch(_0x27a4ca){return BPromise[_0xaf5d('0x24')](_0x27a4ca);}return _0x54cf72[_0xaf5d('0x25')]();};}function saveUpdates(_0x48f7ef,_0x47de7c){return function(_0xaa7326){if(_0xaa7326){return _0xaa7326[_0xaf5d('0x26')](_0x48f7ef)[_0xaf5d('0x27')](function(_0x7cfd37){return _0x7cfd37;});}return null;};}function removeEntity(_0x11c73d,_0x473fa4){return function(_0x5a7f1d){if(_0x5a7f1d){return _0x5a7f1d[_0xaf5d('0x28')]()[_0xaf5d('0x27')](function(){var _0x14a5a7=_0x5a7f1d[_0xaf5d('0x29')]({'plain':!![]});var _0x25225a=_0xaf5d('0x2a');return db[_0xaf5d('0x2b')][_0xaf5d('0x28')]({'where':{'type':_0x25225a,'resourceId':_0x14a5a7['id']}})[_0xaf5d('0x27')](function(){return _0x5a7f1d;});})[_0xaf5d('0x27')](function(){_0x11c73d[_0xaf5d('0x1b')](0xcc)[_0xaf5d('0x1c')]();});}};}function handleEntityNotFound(_0x3d78a9,_0x1f6ddf){return function(_0x34c763){if(!_0x34c763){_0x3d78a9[_0xaf5d('0x1a')](0x194);}return _0x34c763;};}function handleError(_0x39a4bd,_0x2077cd){_0x2077cd=_0x2077cd||0x1f4;return function(_0xc76249){logger[_0xaf5d('0x2c')](_0xc76249['stack']);if(_0xc76249[_0xaf5d('0x2d')]){delete _0xc76249[_0xaf5d('0x2d')];}_0x39a4bd[_0xaf5d('0x1b')](_0x2077cd)[_0xaf5d('0x2e')](_0xc76249);};}exports[_0xaf5d('0x2f')]=function(_0x3b8f8b,_0x1233c3){var _0x1a1292={},_0x15923c={},_0x2d2a50={'count':0x0,'rows':[]};var _0x570d65=_[_0xaf5d('0x30')](db[_0xaf5d('0x31')]['rawAttributes'],function(_0x29c201){return{'name':_0x29c201[_0xaf5d('0x32')],'type':_0x29c201[_0xaf5d('0x33')][_0xaf5d('0x34')]};});_0x15923c[_0xaf5d('0x35')]=_[_0xaf5d('0x30')](_0x570d65,_0xaf5d('0x2d'));_0x15923c[_0xaf5d('0x36')]=_['keys'](_0x3b8f8b[_0xaf5d('0x36')]);_0x15923c[_0xaf5d('0x37')]=_[_0xaf5d('0x38')](_0x15923c[_0xaf5d('0x35')],_0x15923c[_0xaf5d('0x36')]);_0x1a1292[_0xaf5d('0x39')]=_[_0xaf5d('0x38')](_0x15923c[_0xaf5d('0x35')],qs[_0xaf5d('0x3a')](_0x3b8f8b[_0xaf5d('0x36')][_0xaf5d('0x3a')]));_0x1a1292[_0xaf5d('0x39')]=_0x1a1292[_0xaf5d('0x39')][_0xaf5d('0x3b')]?_0x1a1292[_0xaf5d('0x39')]:_0x15923c['model'];if(!_0x3b8f8b[_0xaf5d('0x36')][_0xaf5d('0x3c')](_0xaf5d('0x3d'))){_0x1a1292[_0xaf5d('0x20')]=qs['limit'](_0x3b8f8b[_0xaf5d('0x36')][_0xaf5d('0x20')]);_0x1a1292[_0xaf5d('0x1e')]=qs[_0xaf5d('0x1e')](_0x3b8f8b[_0xaf5d('0x36')][_0xaf5d('0x1e')]);}_0x1a1292[_0xaf5d('0x3e')]=qs[_0xaf5d('0x3f')](_0x3b8f8b[_0xaf5d('0x36')][_0xaf5d('0x3f')]);_0x1a1292['where']=qs[_0xaf5d('0x37')](_[_0xaf5d('0x40')](_0x3b8f8b[_0xaf5d('0x36')],_0x15923c[_0xaf5d('0x37')]),_0x570d65);if(_0x3b8f8b['query'][_0xaf5d('0x41')]){_0x1a1292[_0xaf5d('0x42')]=_[_0xaf5d('0x43')](_0x1a1292[_0xaf5d('0x42')],{'$or':_[_0xaf5d('0x30')](_0x570d65,function(_0x317f2e){if(_0x317f2e[_0xaf5d('0x33')]!=='VIRTUAL'){var _0x5e33d5={};_0x5e33d5[_0x317f2e[_0xaf5d('0x2d')]]={'$like':'%'+_0x3b8f8b[_0xaf5d('0x36')][_0xaf5d('0x41')]+'%'};return _0x5e33d5;}})});}_0x1a1292=_[_0xaf5d('0x43')]({},_0x1a1292,_0x3b8f8b['options']);var _0x530e6a={'where':_0x1a1292[_0xaf5d('0x42')]};return db[_0xaf5d('0x31')][_0xaf5d('0x21')](_0x530e6a)[_0xaf5d('0x27')](function(_0x5cb423){_0x2d2a50['count']=_0x5cb423;if(_0x3b8f8b[_0xaf5d('0x36')][_0xaf5d('0x44')]){_0x1a1292[_0xaf5d('0x45')]=[{'all':!![]}];}return db[_0xaf5d('0x31')]['findAll'](_0x1a1292);})['then'](function(_0x26d704){_0x2d2a50['rows']=_0x26d704;return _0x2d2a50;})[_0xaf5d('0x27')](respondWithFilteredResult(_0x1233c3,_0x1a1292))[_0xaf5d('0x46')](handleError(_0x1233c3,null));};exports[_0xaf5d('0x47')]=function(_0x4a01c6,_0x233016){var _0x657065={'raw':!![],'where':{'id':_0x4a01c6[_0xaf5d('0x48')]['id']}},_0x3c60bd={};_0x3c60bd['model']=_['keys'](db['Sound'][_0xaf5d('0x49')]);_0x3c60bd[_0xaf5d('0x36')]=_[_0xaf5d('0x4a')](_0x4a01c6['query']);_0x3c60bd[_0xaf5d('0x37')]=_[_0xaf5d('0x38')](_0x3c60bd[_0xaf5d('0x35')],_0x3c60bd['query']);_0x657065[_0xaf5d('0x39')]=_['intersection'](_0x3c60bd[_0xaf5d('0x35')],qs[_0xaf5d('0x3a')](_0x4a01c6[_0xaf5d('0x36')]['fields']));_0x657065[_0xaf5d('0x39')]=_0x657065[_0xaf5d('0x39')]['length']?_0x657065['attributes']:_0x3c60bd[_0xaf5d('0x35')];if(_0x4a01c6[_0xaf5d('0x36')][_0xaf5d('0x44')]){_0x657065[_0xaf5d('0x45')]=[{'all':!![]}];}_0x657065=_['merge']({},_0x657065,_0x4a01c6[_0xaf5d('0x4b')]);return db['Sound'][_0xaf5d('0x4c')](_0x657065)[_0xaf5d('0x27')](handleEntityNotFound(_0x233016,null))[_0xaf5d('0x27')](respondWithResult(_0x233016,null))[_0xaf5d('0x46')](handleError(_0x233016,null));};exports[_0xaf5d('0x4d')]=function(_0x2615fb,_0x454288,_0x14e4f6){return db[_0xaf5d('0x31')][_0xaf5d('0x4c')]({'where':{'id':_0x2615fb['params']['id']},'attributes':['name','save_name',_0xaf5d('0x4e')],'raw':!![]})[_0xaf5d('0x27')](handleEntityNotFound(_0x454288,null))['then'](function(_0x5d9be1){if(_0x5d9be1){if(!fs[_0xaf5d('0x4f')](path[_0xaf5d('0x50')](config[_0xaf5d('0x51')],_0xaf5d('0x52'),_0x5d9be1[_0xaf5d('0x53')]+'.'+_0x5d9be1[_0xaf5d('0x4e')]))){throw new db[(_0xaf5d('0x54'))]['ValidationError'](_0xaf5d('0x55'));}return _0x454288[_0xaf5d('0x4d')](path[_0xaf5d('0x50')](config[_0xaf5d('0x51')],_0xaf5d('0x52'),util[_0xaf5d('0x56')](_0xaf5d('0x57'),_0x5d9be1[_0xaf5d('0x53')],_0x5d9be1['converted_format'])),util[_0xaf5d('0x56')](_0xaf5d('0x57'),_0x5d9be1[_0xaf5d('0x2d')],_0x5d9be1[_0xaf5d('0x4e')]));}return null;})[_0xaf5d('0x46')](handleError(_0x454288,null));};exports[_0xaf5d('0x58')]=function(_0x5434df,_0x33ada4,_0x50bd8a){var _0x99face={'name':path[_0xaf5d('0x59')](_0x5434df[_0xaf5d('0x5a')][_0xaf5d('0x5b')],path['extname'](_0x5434df['file']['originalname'])),'save_name':path[_0xaf5d('0x59')](_0x5434df['file']['filename'],path[_0xaf5d('0x5c')](_0x5434df[_0xaf5d('0x5a')]['filename'])),'original_format':path[_0xaf5d('0x5c')](_0x5434df['file']['originalname'])[_0xaf5d('0x5d')](0x1),'converted_format':_0xaf5d('0x5e')};var _0x67dca3=path[_0xaf5d('0x50')](config[_0xaf5d('0x51')],_0xaf5d('0x5f'),_0x5434df[_0xaf5d('0x5a')][_0xaf5d('0x60')]);var _0x5e7578=path[_0xaf5d('0x50')](config[_0xaf5d('0x51')],_0xaf5d('0x52'),util[_0xaf5d('0x56')](_0xaf5d('0x57'),path['basename'](_0x5434df[_0xaf5d('0x5a')][_0xaf5d('0x60')],path[_0xaf5d('0x5c')](_0x5434df[_0xaf5d('0x5a')][_0xaf5d('0x60')])),_0x99face['converted_format']));logger[_0xaf5d('0x61')](_0xaf5d('0x62'),_0x67dca3);logger['info'](_0xaf5d('0x63'),_0x5e7578);try{fs[_0xaf5d('0x64')](_0x67dca3,parseInt('0777',0x8));var _0x6cae63=sox[_0xaf5d('0x65')](_0x67dca3,_0x5e7578,{'sampleRate':0x1f40,'format':_0xaf5d('0x5e'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x6cae63['on'](_0xaf5d('0x2c'),function(_0x15d5a9){fs['unlinkSync'](_0x67dca3);_0x33ada4[_0xaf5d('0x1b')](0x1f4)['send'](_0x15d5a9);});_0x6cae63['on'](_0xaf5d('0x66'),function(_0x8533de){_0x99face[_0xaf5d('0x67')]=isNaN(_0x8533de[_0xaf5d('0x68')])?null:_0x8533de['duration']*0x3e8;_0x99face[_0xaf5d('0x69')]=isNaN(_0x8533de['sampleCount'])?null:_0x8533de[_0xaf5d('0x6a')];_0x99face[_0xaf5d('0x6b')]=isNaN(_0x8533de[_0xaf5d('0x6c')])?null:_0x8533de[_0xaf5d('0x6c')];_0x99face[_0xaf5d('0x6d')]=isNaN(_0x8533de['bitRate'])?null:_0x8533de[_0xaf5d('0x6e')];_0x99face[_0xaf5d('0x6f')]=isNaN(_0x8533de['sampleRate'])?null:_0x8533de[_0xaf5d('0x70')];});_0x6cae63['on'](_0xaf5d('0x71'),function(_0xc02f63){_0x99face[_0xaf5d('0x72')]=isNaN(_0xc02f63['duration'])?null:_0xc02f63[_0xaf5d('0x68')]*0x3e8;_0x99face['converted_sampleCount']=isNaN(_0xc02f63[_0xaf5d('0x6a')])?null:_0xc02f63[_0xaf5d('0x6a')];_0x99face['converted_channelCount']=isNaN(_0xc02f63[_0xaf5d('0x6c')])?null:_0xc02f63[_0xaf5d('0x6c')];_0x99face[_0xaf5d('0x73')]=isNaN(_0xc02f63[_0xaf5d('0x6e')])?null:_0xc02f63[_0xaf5d('0x6e')];_0x99face[_0xaf5d('0x74')]=isNaN(_0xc02f63[_0xaf5d('0x70')])?null:_0xc02f63[_0xaf5d('0x70')];});_0x6cae63['on']('end',function(){fs['chmodSync'](_0x5e7578,parseInt(_0xaf5d('0x75'),0x8));return db[_0xaf5d('0x31')][_0xaf5d('0x58')](_0x99face)[_0xaf5d('0x27')](function(_0x1cbe8a){var _0x45db91={'role':_0x5434df[_0xaf5d('0x76')][_0xaf5d('0x77')],'userProfileId':_0x5434df[_0xaf5d('0x76')]['userProfileId']};if(!_0x45db91)throw new Error(_0xaf5d('0x78'));if(_0x45db91[_0xaf5d('0x77')]===_0xaf5d('0x79')){var _0x97af96=_0x1cbe8a[_0xaf5d('0x29')]({'plain':!![]});return db[_0xaf5d('0x7a')][_0xaf5d('0x4c')]({'where':{'name':_0xaf5d('0x2a'),'userProfileId':_0x45db91['userProfileId']},'raw':!![]})[_0xaf5d('0x27')](function(_0xd85a03){if(_0xd85a03&&_0xd85a03[_0xaf5d('0x7b')]===0x0){return db[_0xaf5d('0x2b')][_0xaf5d('0x58')]({'name':_0x97af96[_0xaf5d('0x2d')],'resourceId':_0x97af96['id'],'type':_0xd85a03[_0xaf5d('0x2d')],'sectionId':_0xd85a03['id']},{})[_0xaf5d('0x27')](function(){return _0x1cbe8a;});}else{return _0x1cbe8a;}})['catch'](function(_0x5e6876){logger[_0xaf5d('0x2c')](_0xaf5d('0x7c'),_0x5e6876);throw _0x5e6876;});}return _0x1cbe8a;})[_0xaf5d('0x27')](respondWithResult(_0x33ada4,null))[_0xaf5d('0x46')](handleError(_0x33ada4,null));});_0x6cae63['start']();}catch(_0x1e5eb5){_0x33ada4[_0xaf5d('0x1b')](0x1f4)[_0xaf5d('0x2e')](_0x1e5eb5);}};exports['update']=function(_0x30a309,_0x5bcec1,_0x29f7f9){return db[_0xaf5d('0x31')][_0xaf5d('0x4c')]({'where':{'id':_0x30a309[_0xaf5d('0x48')]['id']}})[_0xaf5d('0x27')](handleEntityNotFound(_0x5bcec1,null))[_0xaf5d('0x27')](saveUpdates(_[_0xaf5d('0x40')](_0x30a309[_0xaf5d('0x76')],[_0xaf5d('0x2d'),_0xaf5d('0x7d')]),null))[_0xaf5d('0x27')](respondWithResult(_0x5bcec1,null))[_0xaf5d('0x46')](handleError(_0x5bcec1,null));};exports[_0xaf5d('0x7e')]=function(_0x4903db,_0x1b4552,_0xc8d0e0){return db[_0xaf5d('0x31')]['find']({'where':{'id':_0x4903db[_0xaf5d('0x48')]['id']}})['then'](function(_0x4b1b6b){if(_0x4b1b6b){return _0x4b1b6b[_0xaf5d('0x28')]();}})[_0xaf5d('0x27')](function(_0x320910){var _0x352cc6=path[_0xaf5d('0x50')](config[_0xaf5d('0x51')],_0xaf5d('0x5f'),util[_0xaf5d('0x56')](_0xaf5d('0x57'),_0x320910[_0xaf5d('0x53')],_0x320910[_0xaf5d('0x7f')]));var _0x16a43f=path['join'](config[_0xaf5d('0x51')],'server/files/sounds/converted',util['format'](_0xaf5d('0x57'),_0x320910[_0xaf5d('0x53')],_0x320910[_0xaf5d('0x4e')]));fs[_0xaf5d('0x80')](_0x352cc6);fs[_0xaf5d('0x80')](_0x16a43f);return _0x320910;})[_0xaf5d('0x27')](function(_0x1522b){if(_0x1522b){return _0x1b4552[_0xaf5d('0x1b')](0xcc)[_0xaf5d('0x1c')]();}})[_0xaf5d('0x27')](handleEntityNotFound(_0x1b4552,null))['catch'](handleError(_0x1b4552,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index ae0aa98..0fbcf3c 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 _0x0476=['rimraf','./sound.attributes','exports','define','Sound','tools_sounds','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0476,0x6e));var _0x6047=function(_0x50007c,_0x1cbf11){_0x50007c=_0x50007c-0x0;var _0x5c1ec7=_0x0476[_0x50007c];return _0x5c1ec7;};'use strict';var _=require('lodash');var util=require(_0x6047('0x0'));var logger=require(_0x6047('0x1'))(_0x6047('0x2'));var moment=require(_0x6047('0x3'));var BPromise=require(_0x6047('0x4'));var rp=require(_0x6047('0x5'));var fs=require('fs');var path=require(_0x6047('0x6'));var rimraf=require(_0x6047('0x7'));var config=require('../../config/environment');var attributes=require(_0x6047('0x8'));module[_0x6047('0x9')]=function(_0x94d054,_0xb0b14a){return _0x94d054[_0x6047('0xa')](_0x6047('0xb'),attributes,{'tableName':_0x6047('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9a97=['../../config/environment','./sound.attributes','exports','define','tools_sounds','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x42f009,_0x5e27b1){var _0x22a1e0=function(_0x297993){while(--_0x297993){_0x42f009['push'](_0x42f009['shift']());}};_0x22a1e0(++_0x5e27b1);}(_0x9a97,0x7d));var _0x79a9=function(_0x555f06,_0x15b692){_0x555f06=_0x555f06-0x0;var _0x1c9e4c=_0x9a97[_0x555f06];return _0x1c9e4c;};'use strict';var _=require(_0x79a9('0x0'));var util=require('util');var logger=require(_0x79a9('0x1'))(_0x79a9('0x2'));var moment=require(_0x79a9('0x3'));var BPromise=require(_0x79a9('0x4'));var rp=require(_0x79a9('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x79a9('0x6'));var config=require(_0x79a9('0x7'));var attributes=require(_0x79a9('0x8'));module[_0x79a9('0x9')]=function(_0x37f0f9,_0x1cfeec){return _0x37f0f9[_0x79a9('0xa')]('Sound',attributes,{'tableName':_0x79a9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/sound/sound.rpc.js b/server/api/sound/sound.rpc.js index de9405c..ba58e89 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 _0xd4c6=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','debug','Sound,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Sound,\x20%s,\x20%s','message','info','catch','ShowSound','options','where','attributes','map','model','include','then','lodash','bluebird','randomstring','ioredis'];(function(_0x5615d7,_0x57a510){var _0x553ab0=function(_0x181cb6){while(--_0x181cb6){_0x5615d7['push'](_0x5615d7['shift']());}};_0x553ab0(++_0x57a510);}(_0xd4c6,0x11e));var _0x6d4c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xd4c6[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x6d4c('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x6d4c('0x1'));var rs=require(_0x6d4c('0x2'));var fs=require('fs');var Redis=require(_0x6d4c('0x3'));var db=require(_0x6d4c('0x4'))['db'];var utils=require(_0x6d4c('0x5'));var logger=require(_0x6d4c('0x6'))('rpc');var config=require(_0x6d4c('0x7'));var jayson=require(_0x6d4c('0x8'));var client=jayson['client'][_0x6d4c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x847629,_0x2bceb7,_0x34e03b){return new BPromise(function(_0x37669d,_0x22cf68){return client[_0x6d4c('0xa')](_0x847629,_0x34e03b)['then'](function(_0x2eb959){logger['info']('Sound,\x20%s,\x20%s',_0x2bceb7,'request\x20sent');logger[_0x6d4c('0xb')](_0x6d4c('0xc'),_0x2bceb7,_0x6d4c('0xd'),JSON[_0x6d4c('0xe')](_0x2eb959));if(_0x2eb959[_0x6d4c('0xf')]){if(_0x2eb959[_0x6d4c('0xf')][_0x6d4c('0x10')]===0x1f4){logger[_0x6d4c('0xf')](_0x6d4c('0x11'),_0x2bceb7,_0x2eb959['error'][_0x6d4c('0x12')]);return _0x22cf68(_0x2eb959[_0x6d4c('0xf')][_0x6d4c('0x12')]);}logger['error'](_0x6d4c('0x11'),_0x2bceb7,_0x2eb959[_0x6d4c('0xf')][_0x6d4c('0x12')]);return _0x37669d(_0x2eb959[_0x6d4c('0xf')]['message']);}else{logger[_0x6d4c('0x13')](_0x6d4c('0x11'),_0x2bceb7,_0x6d4c('0xd'));_0x37669d(_0x2eb959['result'][_0x6d4c('0x12')]);}})[_0x6d4c('0x14')](function(_0x24a391){logger[_0x6d4c('0xf')](_0x6d4c('0x11'),_0x2bceb7,_0x24a391);_0x22cf68(_0x24a391);});});}exports[_0x6d4c('0x15')]=function(_0x2e82c9){var _0x158a62=this;return new Promise(function(_0x19760a,_0xfe817c){return db['Sound']['find']({'raw':_0x2e82c9[_0x6d4c('0x16')]?_0x2e82c9[_0x6d4c('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x2e82c9[_0x6d4c('0x16')]?_0x2e82c9[_0x6d4c('0x16')][_0x6d4c('0x17')]||null:null,'attributes':_0x2e82c9[_0x6d4c('0x16')]?_0x2e82c9[_0x6d4c('0x16')][_0x6d4c('0x18')]||null:null,'include':_0x2e82c9[_0x6d4c('0x16')]?_0x2e82c9[_0x6d4c('0x16')]['include']?_[_0x6d4c('0x19')](_0x2e82c9['options']['include'],function(_0x199048){return{'model':db[_0x199048[_0x6d4c('0x1a')]],'as':_0x199048['as'],'attributes':_0x199048[_0x6d4c('0x18')],'include':_0x199048[_0x6d4c('0x1b')]?_[_0x6d4c('0x19')](_0x199048[_0x6d4c('0x1b')],function(_0x1c7584){return{'model':db[_0x1c7584[_0x6d4c('0x1a')]],'as':_0x1c7584['as'],'attributes':_0x1c7584[_0x6d4c('0x18')],'include':_0x1c7584[_0x6d4c('0x1b')]?_[_0x6d4c('0x19')](_0x1c7584['include'],function(_0x26f3ed){return{'model':db[_0x26f3ed[_0x6d4c('0x1a')]],'as':_0x26f3ed['as'],'attributes':_0x26f3ed[_0x6d4c('0x18')]};}):[]};}):[]};}):[]:[]})[_0x6d4c('0x1c')](function(_0x1dfe22){logger['info'](_0x6d4c('0x15'),_0x2e82c9);logger[_0x6d4c('0xb')]('ShowSound',_0x2e82c9,JSON[_0x6d4c('0xe')](_0x1dfe22));_0x19760a(_0x1dfe22);})[_0x6d4c('0x14')](function(_0x53f1c6){logger[_0x6d4c('0xf')]('ShowSound',_0x53f1c6[_0x6d4c('0x12')],_0x2e82c9);_0xfe817c(_0x158a62['error'](0x1f4,_0x53f1c6['message']));});});}; \ No newline at end of file +var _0xcbfa=['result','catch','options','where','attributes','model','include','map','ShowSound','lodash','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','Sound,\x20%s,\x20%s','request\x20sent','Sound,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x53f005,_0xfae300){var _0x3c3464=function(_0xb01fe8){while(--_0xb01fe8){_0x53f005['push'](_0x53f005['shift']());}};_0x3c3464(++_0xfae300);}(_0xcbfa,0x1b9));var _0xacbf=function(_0x5ca58f,_0x31ee9a){_0x5ca58f=_0x5ca58f-0x0;var _0x59eefb=_0xcbfa[_0x5ca58f];return _0x59eefb;};'use strict';var _=require(_0xacbf('0x0'));var util=require('util');var moment=require(_0xacbf('0x1'));var BPromise=require('bluebird');var rs=require(_0xacbf('0x2'));var fs=require('fs');var Redis=require(_0xacbf('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xacbf('0x4'))(_0xacbf('0x5'));var config=require(_0xacbf('0x6'));var jayson=require(_0xacbf('0x7'));var client=jayson['client'][_0xacbf('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x248b7d,_0x4ff871,_0x502266){return new BPromise(function(_0x1ae334,_0x228326){return client['request'](_0x248b7d,_0x502266)[_0xacbf('0x9')](function(_0x533c12){logger[_0xacbf('0xa')](_0xacbf('0xb'),_0x4ff871,_0xacbf('0xc'));logger['debug'](_0xacbf('0xd'),_0x4ff871,_0xacbf('0xc'),JSON[_0xacbf('0xe')](_0x533c12));if(_0x533c12[_0xacbf('0xf')]){if(_0x533c12[_0xacbf('0xf')][_0xacbf('0x10')]===0x1f4){logger[_0xacbf('0xf')](_0xacbf('0xb'),_0x4ff871,_0x533c12[_0xacbf('0xf')]['message']);return _0x228326(_0x533c12[_0xacbf('0xf')]['message']);}logger[_0xacbf('0xf')](_0xacbf('0xb'),_0x4ff871,_0x533c12[_0xacbf('0xf')][_0xacbf('0x11')]);return _0x1ae334(_0x533c12[_0xacbf('0xf')][_0xacbf('0x11')]);}else{logger[_0xacbf('0xa')](_0xacbf('0xb'),_0x4ff871,_0xacbf('0xc'));_0x1ae334(_0x533c12[_0xacbf('0x12')][_0xacbf('0x11')]);}})[_0xacbf('0x13')](function(_0x468708){logger[_0xacbf('0xf')]('Sound,\x20%s,\x20%s',_0x4ff871,_0x468708);_0x228326(_0x468708);});});}exports['ShowSound']=function(_0x798e85){var _0x1d20f5=this;return new Promise(function(_0x8d8199,_0x139a4d){return db['Sound']['find']({'raw':_0x798e85[_0xacbf('0x14')]?_0x798e85['options']['raw']===undefined?!![]:![]:!![],'where':_0x798e85['options']?_0x798e85[_0xacbf('0x14')][_0xacbf('0x15')]||null:null,'attributes':_0x798e85[_0xacbf('0x14')]?_0x798e85[_0xacbf('0x14')][_0xacbf('0x16')]||null:null,'include':_0x798e85[_0xacbf('0x14')]?_0x798e85['options']['include']?_['map'](_0x798e85[_0xacbf('0x14')]['include'],function(_0x3cde3a){return{'model':db[_0x3cde3a[_0xacbf('0x17')]],'as':_0x3cde3a['as'],'attributes':_0x3cde3a[_0xacbf('0x16')],'include':_0x3cde3a[_0xacbf('0x18')]?_['map'](_0x3cde3a['include'],function(_0x370cd2){return{'model':db[_0x370cd2[_0xacbf('0x17')]],'as':_0x370cd2['as'],'attributes':_0x370cd2[_0xacbf('0x16')],'include':_0x370cd2[_0xacbf('0x18')]?_[_0xacbf('0x19')](_0x370cd2['include'],function(_0x17cda2){return{'model':db[_0x17cda2['model']],'as':_0x17cda2['as'],'attributes':_0x17cda2[_0xacbf('0x16')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4358b9){logger[_0xacbf('0xa')](_0xacbf('0x1a'),_0x798e85);logger['debug'](_0xacbf('0x1a'),_0x798e85,JSON[_0xacbf('0xe')](_0x4358b9));_0x8d8199(_0x4358b9);})[_0xacbf('0x13')](function(_0x4d3bab){logger['error'](_0xacbf('0x1a'),_0x4d3bab['message'],_0x798e85);_0x139a4d(_0x1d20f5[_0xacbf('0xf')](0x1f4,_0x4d3bab['message']));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 51564e6..151eb33 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 _0x0b0e=['./squareMessage.controller','get','isAuthenticated','index','show','post','create','/:id','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4605a6,_0x4ee25f){var _0x18bc7a=function(_0x2f1228){while(--_0x2f1228){_0x4605a6['push'](_0x4605a6['shift']());}};_0x18bc7a(++_0x4ee25f);}(_0x0b0e,0x187));var _0xe0b0=function(_0x967959,_0x53c5c1){_0x967959=_0x967959-0x0;var _0x5c4489=_0x0b0e[_0x967959];return _0x5c4489;};'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('0xd')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xe')]);router['put'](_0xe0b0('0xf'),auth[_0xe0b0('0xa')](),controller['update']);router[_0xe0b0('0x10')](_0xe0b0('0xf'),auth['isAuthenticated'](),controller[_0xe0b0('0x11')]);module[_0xe0b0('0x12')]=router; \ No newline at end of file +var _0xda2d=['isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../config/environment','./squareMessage.controller','get'];(function(_0x423b10,_0x36cad4){var _0x1338d9=function(_0xeb09ac){while(--_0xeb09ac){_0x423b10['push'](_0x423b10['shift']());}};_0x1338d9(++_0x36cad4);}(_0xda2d,0x102));var _0xdda2=function(_0xbd8439,_0xdf569f){_0xbd8439=_0xbd8439-0x0;var _0x57e1eb=_0xda2d[_0xbd8439];return _0x57e1eb;};'use strict';var multer=require('multer');var util=require(_0xdda2('0x0'));var path=require(_0xdda2('0x1'));var timeout=require(_0xdda2('0x2'));var express=require(_0xdda2('0x3'));var router=express[_0xdda2('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xdda2('0x5'));var controller=require(_0xdda2('0x6'));router[_0xdda2('0x7')]('/',auth[_0xdda2('0x8')](),controller[_0xdda2('0x9')]);router[_0xdda2('0x7')](_0xdda2('0xa'),auth[_0xdda2('0x8')](),controller[_0xdda2('0xb')]);router[_0xdda2('0xc')]('/',auth['isAuthenticated'](),controller[_0xdda2('0xd')]);router[_0xdda2('0xe')]('/:id',auth[_0xdda2('0x8')](),controller[_0xdda2('0xf')]);router[_0xdda2('0x10')](_0xdda2('0xa'),auth[_0xdda2('0x8')](),controller[_0xdda2('0x11')]);module[_0xdda2('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 ff169b2..2e1e23d 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 _0xb1b5=['out','sequelize','exports','STRING','TEXT','medium','ENUM'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xb1b5,0xe8));var _0x5b1b=function(_0x7c228e,_0x443a8c){_0x7c228e=_0x7c228e-0x0;var _0x56091c=_0xb1b5[_0x7c228e];return _0x56091c;};'use strict';var Sequelize=require(_0x5b1b('0x0'));module[_0x5b1b('0x1')]={'uniqueid':{'type':Sequelize[_0x5b1b('0x2')]},'body':{'type':Sequelize[_0x5b1b('0x3')](_0x5b1b('0x4')),'allowNull':![]},'direction':{'type':Sequelize[_0x5b1b('0x5')]('in',_0x5b1b('0x6')),'defaultValue':_0x5b1b('0x6'),'allowNull':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xddba=['exports','STRING','TEXT','medium','out','sequelize'];(function(_0x399d5c,_0x526cf0){var _0x128d52=function(_0x2f6351){while(--_0x2f6351){_0x399d5c['push'](_0x399d5c['shift']());}};_0x128d52(++_0x526cf0);}(_0xddba,0x6b));var _0xaddb=function(_0x57a963,_0x3cd742){_0x57a963=_0x57a963-0x0;var _0x126377=_0xddba[_0x57a963];return _0x126377;};'use strict';var Sequelize=require(_0xaddb('0x0'));module[_0xaddb('0x1')]={'uniqueid':{'type':Sequelize[_0xaddb('0x2')]},'body':{'type':Sequelize[_0xaddb('0x3')](_0xaddb('0x4')),'allowNull':![]},'direction':{'type':Sequelize['ENUM']('in',_0xaddb('0x5')),'defaultValue':_0xaddb('0x5'),'allowNull':![]},'providerName':{'type':Sequelize[_0xaddb('0x2')]},'providerResponse':{'type':Sequelize[_0xaddb('0x3')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 065b2f3..74acb35 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 _0x0c19=['pick','filters','filter','merge','where','SquareMessage','include','findAll','rows','params','includeAll','options','find','create','body','catch','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort'];(function(_0x48fe25,_0x15851b){var _0x1f3abe=function(_0x3f605a){while(--_0x3f605a){_0x48fe25['push'](_0x48fe25['shift']());}};_0x1f3abe(++_0x15851b);}(_0x0c19,0xf5));var _0x90c1=function(_0x43d43d,_0x5e8c3d){_0x43d43d=_0x43d43d-0x0;var _0x1494ee=_0x0c19[_0x43d43d];return _0x1494ee;};'use strict';var emlformat=require(_0x90c1('0x0'));var rimraf=require(_0x90c1('0x1'));var zipdir=require(_0x90c1('0x2'));var jsonpatch=require(_0x90c1('0x3'));var rp=require(_0x90c1('0x4'));var moment=require(_0x90c1('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x90c1('0x6'));var util=require(_0x90c1('0x7'));var path=require(_0x90c1('0x8'));var sox=require('sox');var csv=require(_0x90c1('0x9'));var ejs=require(_0x90c1('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x90c1('0xb'));var squel=require(_0x90c1('0xc'));var crypto=require(_0x90c1('0xd'));var jsforce=require(_0x90c1('0xe'));var deskjs=require(_0x90c1('0xf'));var toCsv=require(_0x90c1('0x9'));var querystring=require(_0x90c1('0x10'));var Papa=require('papaparse');var Redis=require(_0x90c1('0x11'));var authService=require(_0x90c1('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x90c1('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x90c1('0x14'));var utils=require('../../config/utils');var config=require(_0x90c1('0x15'));var licenseUtil=require(_0x90c1('0x16'));var db=require(_0x90c1('0x17'))['db'];function respondWithStatusCode(_0x2d9964,_0x4aa112){_0x4aa112=_0x4aa112||0xcc;return function(_0x59a0ca){if(_0x59a0ca){return _0x2d9964[_0x90c1('0x18')](_0x4aa112);}return _0x2d9964[_0x90c1('0x19')](_0x4aa112)[_0x90c1('0x1a')]();};}function respondWithResult(_0x3a8b82,_0x52a659){_0x52a659=_0x52a659||0xc8;return function(_0xaaab35){if(_0xaaab35){return _0x3a8b82[_0x90c1('0x19')](_0x52a659)[_0x90c1('0x1b')](_0xaaab35);}};}function respondWithFilteredResult(_0x139c67,_0x38fcea){return function(_0x1cfb86){if(_0x1cfb86){var _0x4f77bf=typeof _0x38fcea[_0x90c1('0x1c')]===_0x90c1('0x1d')&&typeof _0x38fcea[_0x90c1('0x1e')]===_0x90c1('0x1d');var _0x2fefb9=_0x1cfb86[_0x90c1('0x1f')];var _0x3b6671=_0x4f77bf?0x0:_0x38fcea[_0x90c1('0x1c')];var _0x372949=_0x4f77bf?_0x1cfb86[_0x90c1('0x1f')]:_0x38fcea[_0x90c1('0x1c')]+_0x38fcea['limit'];var _0x302ca2;if(_0x372949>=_0x2fefb9){_0x372949=_0x2fefb9;_0x302ca2=0xc8;}else{_0x302ca2=0xce;}_0x139c67[_0x90c1('0x19')](_0x302ca2);return _0x139c67[_0x90c1('0x20')](_0x90c1('0x21'),_0x3b6671+'-'+_0x372949+'/'+_0x2fefb9)[_0x90c1('0x1b')](_0x1cfb86);}return null;};}function patchUpdates(_0x3c8cc6){return function(_0x5a8358){try{jsonpatch[_0x90c1('0x22')](_0x5a8358,_0x3c8cc6,!![]);}catch(_0x5bfe28){return BPromise[_0x90c1('0x23')](_0x5bfe28);}return _0x5a8358['save']();};}function saveUpdates(_0x4b0480,_0x18323c){return function(_0x512cd9){if(_0x512cd9){return _0x512cd9['update'](_0x4b0480)[_0x90c1('0x24')](function(_0x5f4c05){return _0x5f4c05;});}return null;};}function removeEntity(_0x4d53fd,_0x36fe37){return function(_0x5e7258){if(_0x5e7258){return _0x5e7258[_0x90c1('0x25')]()['then'](function(){_0x4d53fd[_0x90c1('0x19')](0xcc)[_0x90c1('0x1a')]();});}};}function handleEntityNotFound(_0x309f83,_0x2625af){return function(_0x174506){if(!_0x174506){_0x309f83[_0x90c1('0x18')](0x194);}return _0x174506;};}function handleError(_0x2a60fb,_0x5b38f5){_0x5b38f5=_0x5b38f5||0x1f4;return function(_0x26ee39){logger[_0x90c1('0x26')](_0x26ee39[_0x90c1('0x27')]);if(_0x26ee39[_0x90c1('0x28')]){delete _0x26ee39[_0x90c1('0x28')];}_0x2a60fb[_0x90c1('0x19')](_0x5b38f5)[_0x90c1('0x29')](_0x26ee39);};}exports[_0x90c1('0x2a')]=function(_0x40c45d,_0x1ed79c){var _0x17b923={},_0x2f85dc={},_0x46c65b={'count':0x0,'rows':[]};var _0x39f856=_[_0x90c1('0x2b')](db['SquareMessage'][_0x90c1('0x2c')],function(_0x435e56){return{'name':_0x435e56[_0x90c1('0x2d')],'type':_0x435e56[_0x90c1('0x2e')][_0x90c1('0x2f')]};});_0x2f85dc[_0x90c1('0x30')]=_[_0x90c1('0x2b')](_0x39f856,_0x90c1('0x28'));_0x2f85dc[_0x90c1('0x31')]=_[_0x90c1('0x32')](_0x40c45d[_0x90c1('0x31')]);_0x2f85dc['filters']=_[_0x90c1('0x33')](_0x2f85dc[_0x90c1('0x30')],_0x2f85dc[_0x90c1('0x31')]);_0x17b923['attributes']=_[_0x90c1('0x33')](_0x2f85dc[_0x90c1('0x30')],qs[_0x90c1('0x34')](_0x40c45d[_0x90c1('0x31')][_0x90c1('0x34')]));_0x17b923[_0x90c1('0x35')]=_0x17b923[_0x90c1('0x35')][_0x90c1('0x36')]?_0x17b923[_0x90c1('0x35')]:_0x2f85dc[_0x90c1('0x30')];if(!_0x40c45d[_0x90c1('0x31')][_0x90c1('0x37')](_0x90c1('0x38'))){_0x17b923[_0x90c1('0x1e')]=qs['limit'](_0x40c45d[_0x90c1('0x31')][_0x90c1('0x1e')]);_0x17b923[_0x90c1('0x1c')]=qs[_0x90c1('0x1c')](_0x40c45d['query']['offset']);}_0x17b923[_0x90c1('0x39')]=qs[_0x90c1('0x3a')](_0x40c45d[_0x90c1('0x31')][_0x90c1('0x3a')]);_0x17b923['where']=qs['filters'](_[_0x90c1('0x3b')](_0x40c45d[_0x90c1('0x31')],_0x2f85dc[_0x90c1('0x3c')]),_0x39f856);if(_0x40c45d[_0x90c1('0x31')][_0x90c1('0x3d')]){_0x17b923['where']=_['merge'](_0x17b923['where'],{'$or':_[_0x90c1('0x2b')](_0x39f856,function(_0x18c35d){if(_0x18c35d[_0x90c1('0x2e')]!=='VIRTUAL'){var _0x32bc3d={};_0x32bc3d[_0x18c35d['name']]={'$like':'%'+_0x40c45d['query'][_0x90c1('0x3d')]+'%'};return _0x32bc3d;}})});}_0x17b923=_[_0x90c1('0x3e')]({},_0x17b923,_0x40c45d['options']);var _0x3ace43={'where':_0x17b923[_0x90c1('0x3f')]};return db[_0x90c1('0x40')][_0x90c1('0x1f')](_0x3ace43)[_0x90c1('0x24')](function(_0x275731){_0x46c65b['count']=_0x275731;if(_0x40c45d[_0x90c1('0x31')]['includeAll']){_0x17b923[_0x90c1('0x41')]=[{'all':!![]}];}return db[_0x90c1('0x40')][_0x90c1('0x42')](_0x17b923);})[_0x90c1('0x24')](function(_0x8c47ec){_0x46c65b[_0x90c1('0x43')]=_0x8c47ec;return _0x46c65b;})[_0x90c1('0x24')](respondWithFilteredResult(_0x1ed79c,_0x17b923))['catch'](handleError(_0x1ed79c,null));};exports['show']=function(_0x2cd0fa,_0x118104){var _0x1699a1={'raw':!![],'where':{'id':_0x2cd0fa[_0x90c1('0x44')]['id']}},_0x4175d1={};_0x4175d1['model']=_['keys'](db[_0x90c1('0x40')][_0x90c1('0x2c')]);_0x4175d1['query']=_[_0x90c1('0x32')](_0x2cd0fa['query']);_0x4175d1['filters']=_[_0x90c1('0x33')](_0x4175d1['model'],_0x4175d1[_0x90c1('0x31')]);_0x1699a1['attributes']=_['intersection'](_0x4175d1[_0x90c1('0x30')],qs[_0x90c1('0x34')](_0x2cd0fa[_0x90c1('0x31')][_0x90c1('0x34')]));_0x1699a1['attributes']=_0x1699a1[_0x90c1('0x35')][_0x90c1('0x36')]?_0x1699a1[_0x90c1('0x35')]:_0x4175d1[_0x90c1('0x30')];if(_0x2cd0fa['query'][_0x90c1('0x45')]){_0x1699a1[_0x90c1('0x41')]=[{'all':!![]}];}_0x1699a1=_['merge']({},_0x1699a1,_0x2cd0fa[_0x90c1('0x46')]);return db[_0x90c1('0x40')][_0x90c1('0x47')](_0x1699a1)[_0x90c1('0x24')](handleEntityNotFound(_0x118104,null))[_0x90c1('0x24')](respondWithResult(_0x118104,null))['catch'](handleError(_0x118104,null));};exports[_0x90c1('0x48')]=function(_0x4bde8e,_0x304011){return db['SquareMessage'][_0x90c1('0x48')](_0x4bde8e[_0x90c1('0x49')],{})[_0x90c1('0x24')](respondWithResult(_0x304011,0xc9))[_0x90c1('0x4a')](handleError(_0x304011,null));};exports[_0x90c1('0x4b')]=function(_0x3aa812,_0x1d00e4){if(_0x3aa812[_0x90c1('0x49')]['id']){delete _0x3aa812[_0x90c1('0x49')]['id'];}return db['SquareMessage'][_0x90c1('0x47')]({'where':{'id':_0x3aa812['params']['id']}})[_0x90c1('0x24')](handleEntityNotFound(_0x1d00e4,null))[_0x90c1('0x24')](saveUpdates(_0x3aa812[_0x90c1('0x49')],null))[_0x90c1('0x24')](respondWithResult(_0x1d00e4,null))[_0x90c1('0x4a')](handleError(_0x1d00e4,null));};exports[_0x90c1('0x25')]=function(_0x201674,_0x177a53){return db[_0x90c1('0x40')][_0x90c1('0x47')]({'where':{'id':_0x201674[_0x90c1('0x44')]['id']}})['then'](handleEntityNotFound(_0x177a53,null))[_0x90c1('0x24')](removeEntity(_0x177a53,null))[_0x90c1('0x4a')](handleError(_0x177a53,null));}; \ No newline at end of file +var _0xbc72=['ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','reject','update','then','destroy','error','stack','name','index','map','rawAttributes','type','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','options','includeAll','include','SquareMessage','findAll','rows','catch','params','find','create','body','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring'];(function(_0x159dcf,_0x1c75f9){var _0x531d85=function(_0x5a8563){while(--_0x5a8563){_0x159dcf['push'](_0x159dcf['shift']());}};_0x531d85(++_0x1c75f9);}(_0xbc72,0x18e));var _0x2bc7=function(_0x4356af,_0x20fbe7){_0x4356af=_0x4356af-0x0;var _0x884e96=_0xbc72[_0x4356af];return _0x884e96;};'use strict';var emlformat=require(_0x2bc7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2bc7('0x1'));var jsonpatch=require(_0x2bc7('0x2'));var rp=require('request-promise');var moment=require(_0x2bc7('0x3'));var BPromise=require(_0x2bc7('0x4'));var Mustache=require('mustache');var util=require(_0x2bc7('0x5'));var path=require(_0x2bc7('0x6'));var sox=require('sox');var csv=require(_0x2bc7('0x7'));var ejs=require(_0x2bc7('0x8'));var fs=require('fs');var fs_extra=require(_0x2bc7('0x9'));var _=require(_0x2bc7('0xa'));var squel=require(_0x2bc7('0xb'));var crypto=require(_0x2bc7('0xc'));var jsforce=require(_0x2bc7('0xd'));var deskjs=require(_0x2bc7('0xe'));var toCsv=require(_0x2bc7('0x7'));var querystring=require(_0x2bc7('0xf'));var Papa=require('papaparse');var Redis=require(_0x2bc7('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x2bc7('0x11'));var hardwareService=require(_0x2bc7('0x12'));var logger=require(_0x2bc7('0x13'))('api');var utils=require(_0x2bc7('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x2bc7('0x15'));var db=require(_0x2bc7('0x16'))['db'];function respondWithStatusCode(_0x2637af,_0x27ee4a){_0x27ee4a=_0x27ee4a||0xcc;return function(_0x1e2141){if(_0x1e2141){return _0x2637af[_0x2bc7('0x17')](_0x27ee4a);}return _0x2637af[_0x2bc7('0x18')](_0x27ee4a)[_0x2bc7('0x19')]();};}function respondWithResult(_0x317ab2,_0x69f582){_0x69f582=_0x69f582||0xc8;return function(_0x58ae98){if(_0x58ae98){return _0x317ab2[_0x2bc7('0x18')](_0x69f582)[_0x2bc7('0x1a')](_0x58ae98);}};}function respondWithFilteredResult(_0x5a1d7d,_0x339e43){return function(_0x50e00c){if(_0x50e00c){var _0x52a23d=typeof _0x339e43[_0x2bc7('0x1b')]==='undefined'&&typeof _0x339e43[_0x2bc7('0x1c')]===_0x2bc7('0x1d');var _0x1724ed=_0x50e00c[_0x2bc7('0x1e')];var _0x56a504=_0x52a23d?0x0:_0x339e43[_0x2bc7('0x1b')];var _0x12b7d0=_0x52a23d?_0x50e00c['count']:_0x339e43[_0x2bc7('0x1b')]+_0x339e43[_0x2bc7('0x1c')];var _0x27ca93;if(_0x12b7d0>=_0x1724ed){_0x12b7d0=_0x1724ed;_0x27ca93=0xc8;}else{_0x27ca93=0xce;}_0x5a1d7d[_0x2bc7('0x18')](_0x27ca93);return _0x5a1d7d['set'](_0x2bc7('0x1f'),_0x56a504+'-'+_0x12b7d0+'/'+_0x1724ed)['json'](_0x50e00c);}return null;};}function patchUpdates(_0x456b49){return function(_0x49a073){try{jsonpatch['apply'](_0x49a073,_0x456b49,!![]);}catch(_0xc0ad24){return BPromise[_0x2bc7('0x20')](_0xc0ad24);}return _0x49a073['save']();};}function saveUpdates(_0x57ae67,_0x80950a){return function(_0x5edd4a){if(_0x5edd4a){return _0x5edd4a[_0x2bc7('0x21')](_0x57ae67)[_0x2bc7('0x22')](function(_0xe56ed5){return _0xe56ed5;});}return null;};}function removeEntity(_0x491c3b,_0x3e9ee6){return function(_0x4240d4){if(_0x4240d4){return _0x4240d4[_0x2bc7('0x23')]()[_0x2bc7('0x22')](function(){_0x491c3b['status'](0xcc)[_0x2bc7('0x19')]();});}};}function handleEntityNotFound(_0x33a78b,_0x4515a0){return function(_0x1e82f7){if(!_0x1e82f7){_0x33a78b[_0x2bc7('0x17')](0x194);}return _0x1e82f7;};}function handleError(_0x199faa,_0x446342){_0x446342=_0x446342||0x1f4;return function(_0x54e2b7){logger[_0x2bc7('0x24')](_0x54e2b7[_0x2bc7('0x25')]);if(_0x54e2b7[_0x2bc7('0x26')]){delete _0x54e2b7['name'];}_0x199faa[_0x2bc7('0x18')](_0x446342)['send'](_0x54e2b7);};}exports[_0x2bc7('0x27')]=function(_0x26fcb1,_0x1f2431){var _0x4f81ef={},_0xc54fd4={},_0x53e7c5={'count':0x0,'rows':[]};var _0x29e3d7=_[_0x2bc7('0x28')](db['SquareMessage'][_0x2bc7('0x29')],function(_0x58a382){return{'name':_0x58a382['fieldName'],'type':_0x58a382[_0x2bc7('0x2a')]['key']};});_0xc54fd4['model']=_['map'](_0x29e3d7,_0x2bc7('0x26'));_0xc54fd4[_0x2bc7('0x2b')]=_[_0x2bc7('0x2c')](_0x26fcb1[_0x2bc7('0x2b')]);_0xc54fd4[_0x2bc7('0x2d')]=_[_0x2bc7('0x2e')](_0xc54fd4[_0x2bc7('0x2f')],_0xc54fd4[_0x2bc7('0x2b')]);_0x4f81ef['attributes']=_['intersection'](_0xc54fd4[_0x2bc7('0x2f')],qs[_0x2bc7('0x30')](_0x26fcb1[_0x2bc7('0x2b')][_0x2bc7('0x30')]));_0x4f81ef['attributes']=_0x4f81ef[_0x2bc7('0x31')][_0x2bc7('0x32')]?_0x4f81ef[_0x2bc7('0x31')]:_0xc54fd4[_0x2bc7('0x2f')];if(!_0x26fcb1['query'][_0x2bc7('0x33')](_0x2bc7('0x34'))){_0x4f81ef[_0x2bc7('0x1c')]=qs[_0x2bc7('0x1c')](_0x26fcb1[_0x2bc7('0x2b')]['limit']);_0x4f81ef['offset']=qs[_0x2bc7('0x1b')](_0x26fcb1[_0x2bc7('0x2b')]['offset']);}_0x4f81ef[_0x2bc7('0x35')]=qs[_0x2bc7('0x36')](_0x26fcb1[_0x2bc7('0x2b')][_0x2bc7('0x36')]);_0x4f81ef['where']=qs[_0x2bc7('0x2d')](_['pick'](_0x26fcb1['query'],_0xc54fd4['filters']),_0x29e3d7);if(_0x26fcb1[_0x2bc7('0x2b')][_0x2bc7('0x37')]){_0x4f81ef[_0x2bc7('0x38')]=_[_0x2bc7('0x39')](_0x4f81ef[_0x2bc7('0x38')],{'$or':_[_0x2bc7('0x28')](_0x29e3d7,function(_0x266a0f){if(_0x266a0f['type']!=='VIRTUAL'){var _0x29cd3b={};_0x29cd3b[_0x266a0f[_0x2bc7('0x26')]]={'$like':'%'+_0x26fcb1[_0x2bc7('0x2b')][_0x2bc7('0x37')]+'%'};return _0x29cd3b;}})});}_0x4f81ef=_[_0x2bc7('0x39')]({},_0x4f81ef,_0x26fcb1[_0x2bc7('0x3a')]);var _0x5bf6d7={'where':_0x4f81ef[_0x2bc7('0x38')]};return db['SquareMessage'][_0x2bc7('0x1e')](_0x5bf6d7)[_0x2bc7('0x22')](function(_0x14ee18){_0x53e7c5['count']=_0x14ee18;if(_0x26fcb1['query'][_0x2bc7('0x3b')]){_0x4f81ef[_0x2bc7('0x3c')]=[{'all':!![]}];}return db[_0x2bc7('0x3d')][_0x2bc7('0x3e')](_0x4f81ef);})[_0x2bc7('0x22')](function(_0x434306){_0x53e7c5[_0x2bc7('0x3f')]=_0x434306;return _0x53e7c5;})[_0x2bc7('0x22')](respondWithFilteredResult(_0x1f2431,_0x4f81ef))[_0x2bc7('0x40')](handleError(_0x1f2431,null));};exports['show']=function(_0x1eeacc,_0x2ed559){var _0x110969={'raw':!![],'where':{'id':_0x1eeacc[_0x2bc7('0x41')]['id']}},_0x8cddf={};_0x8cddf['model']=_[_0x2bc7('0x2c')](db[_0x2bc7('0x3d')][_0x2bc7('0x29')]);_0x8cddf[_0x2bc7('0x2b')]=_[_0x2bc7('0x2c')](_0x1eeacc['query']);_0x8cddf[_0x2bc7('0x2d')]=_[_0x2bc7('0x2e')](_0x8cddf[_0x2bc7('0x2f')],_0x8cddf['query']);_0x110969[_0x2bc7('0x31')]=_['intersection'](_0x8cddf[_0x2bc7('0x2f')],qs[_0x2bc7('0x30')](_0x1eeacc['query'][_0x2bc7('0x30')]));_0x110969[_0x2bc7('0x31')]=_0x110969[_0x2bc7('0x31')][_0x2bc7('0x32')]?_0x110969[_0x2bc7('0x31')]:_0x8cddf[_0x2bc7('0x2f')];if(_0x1eeacc[_0x2bc7('0x2b')][_0x2bc7('0x3b')]){_0x110969['include']=[{'all':!![]}];}_0x110969=_[_0x2bc7('0x39')]({},_0x110969,_0x1eeacc[_0x2bc7('0x3a')]);return db[_0x2bc7('0x3d')][_0x2bc7('0x42')](_0x110969)[_0x2bc7('0x22')](handleEntityNotFound(_0x2ed559,null))[_0x2bc7('0x22')](respondWithResult(_0x2ed559,null))[_0x2bc7('0x40')](handleError(_0x2ed559,null));};exports[_0x2bc7('0x43')]=function(_0x2e4c04,_0x1b3f07){return db[_0x2bc7('0x3d')][_0x2bc7('0x43')](_0x2e4c04[_0x2bc7('0x44')],{})[_0x2bc7('0x22')](respondWithResult(_0x1b3f07,0xc9))['catch'](handleError(_0x1b3f07,null));};exports[_0x2bc7('0x21')]=function(_0x3e1ed4,_0xf928cb){if(_0x3e1ed4[_0x2bc7('0x44')]['id']){delete _0x3e1ed4[_0x2bc7('0x44')]['id'];}return db['SquareMessage']['find']({'where':{'id':_0x3e1ed4['params']['id']}})['then'](handleEntityNotFound(_0xf928cb,null))[_0x2bc7('0x22')](saveUpdates(_0x3e1ed4[_0x2bc7('0x44')],null))[_0x2bc7('0x22')](respondWithResult(_0xf928cb,null))[_0x2bc7('0x40')](handleError(_0xf928cb,null));};exports[_0x2bc7('0x23')]=function(_0x4626c6,_0x2c345d){return db[_0x2bc7('0x3d')][_0x2bc7('0x42')]({'where':{'id':_0x4626c6[_0x2bc7('0x41')]['id']}})[_0x2bc7('0x22')](handleEntityNotFound(_0x2c345d,null))[_0x2bc7('0x22')](removeEntity(_0x2c345d,null))['catch'](handleError(_0x2c345d,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index cce924a..5a117ad 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 _0xebf0=['api','bluebird','path','./squareMessage.attributes','exports','define','lodash','../../config/logger'];(function(_0x5c028d,_0x546f2c){var _0x216864=function(_0x41ec43){while(--_0x41ec43){_0x5c028d['push'](_0x5c028d['shift']());}};_0x216864(++_0x546f2c);}(_0xebf0,0x10e));var _0x0ebf=function(_0xe2e7e0,_0x21c042){_0xe2e7e0=_0xe2e7e0-0x0;var _0x1b734a=_0xebf0[_0xe2e7e0];return _0x1b734a;};'use strict';var _=require(_0x0ebf('0x0'));var util=require('util');var logger=require(_0x0ebf('0x1'))(_0x0ebf('0x2'));var moment=require('moment');var BPromise=require(_0x0ebf('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0ebf('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x0ebf('0x5'));module[_0x0ebf('0x6')]=function(_0x56fca5,_0x513c6f){return _0x56fca5[_0x0ebf('0x7')]('SquareMessage',attributes,{'tableName':'square_messages','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbd2e=['path','rimraf','../../config/environment','./squareMessage.attributes','define','SquareMessage','square_messages','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xbd2e,0x166));var _0xebd2=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xbd2e[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0xebd2('0x0'));var util=require('util');var logger=require(_0xebd2('0x1'))(_0xebd2('0x2'));var moment=require(_0xebd2('0x3'));var BPromise=require(_0xebd2('0x4'));var rp=require(_0xebd2('0x5'));var fs=require('fs');var path=require(_0xebd2('0x6'));var rimraf=require(_0xebd2('0x7'));var config=require(_0xebd2('0x8'));var attributes=require(_0xebd2('0x9'));module['exports']=function(_0x9ce4a0,_0xcd59){return _0x9ce4a0[_0xebd2('0xa')](_0xebd2('0xb'),attributes,{'tableName':_0xebd2('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 d1aeef4..752479b 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 _0xefb6=['rpc','jayson/promise','request','then','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','SquareMessage','body','options','raw','CreateSquareMessage','lodash','util','randomstring','ioredis','../../config/logger'];(function(_0xadf34d,_0x54e631){var _0xedf1bc=function(_0x4e9fa6){while(--_0x4e9fa6){_0xadf34d['push'](_0xadf34d['shift']());}};_0xedf1bc(++_0x54e631);}(_0xefb6,0x19d));var _0x6efb=function(_0x44216d,_0x4938a7){_0x44216d=_0x44216d-0x0;var _0xeca523=_0xefb6[_0x44216d];return _0xeca523;};'use strict';var _=require(_0x6efb('0x0'));var util=require(_0x6efb('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6efb('0x2'));var fs=require('fs');var Redis=require(_0x6efb('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6efb('0x4'))(_0x6efb('0x5'));var config=require('../../config/environment');var jayson=require(_0x6efb('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x46998b,_0x206a3a,_0x2b46ec){return new BPromise(function(_0x3c133b,_0x34db34){return client[_0x6efb('0x7')](_0x46998b,_0x2b46ec)[_0x6efb('0x8')](function(_0x295767){logger['info'](_0x6efb('0x9'),_0x206a3a,_0x6efb('0xa'));logger[_0x6efb('0xb')]('SquareMessage,\x20%s,\x20%s,\x20%s',_0x206a3a,_0x6efb('0xa'),JSON[_0x6efb('0xc')](_0x295767));if(_0x295767['error']){if(_0x295767[_0x6efb('0xd')][_0x6efb('0xe')]===0x1f4){logger[_0x6efb('0xd')](_0x6efb('0x9'),_0x206a3a,_0x295767[_0x6efb('0xd')][_0x6efb('0xf')]);return _0x34db34(_0x295767[_0x6efb('0xd')][_0x6efb('0xf')]);}logger['error'](_0x6efb('0x9'),_0x206a3a,_0x295767['error'][_0x6efb('0xf')]);return _0x3c133b(_0x295767[_0x6efb('0xd')]['message']);}else{logger['info'](_0x6efb('0x9'),_0x206a3a,_0x6efb('0xa'));_0x3c133b(_0x295767['result'][_0x6efb('0xf')]);}})[_0x6efb('0x10')](function(_0x379658){logger['error'](_0x6efb('0x9'),_0x206a3a,_0x379658);_0x34db34(_0x379658);});});}exports['CreateSquareMessage']=function(_0x26480e){var _0x42fe1e=this;return new Promise(function(_0x3429ba,_0x497483){return db[_0x6efb('0x11')]['create'](_0x26480e[_0x6efb('0x12')],{'raw':_0x26480e[_0x6efb('0x13')]?_0x26480e[_0x6efb('0x13')][_0x6efb('0x14')]===undefined?!![]:![]:!![]})[_0x6efb('0x8')](function(_0x2a5709){logger['info'](_0x6efb('0x15'),_0x26480e);logger[_0x6efb('0xb')](_0x6efb('0x15'),_0x26480e,JSON[_0x6efb('0xc')](_0x2a5709));_0x3429ba(_0x2a5709);})[_0x6efb('0x10')](function(_0x442437){logger['error']('CreateSquareMessage',_0x442437[_0x6efb('0xf')],_0x26480e);_0x497483(_0x42fe1e['error'](0x1f4,_0x442437[_0x6efb('0xf')]));});});}; \ No newline at end of file +var _0x46b3=['code','message','catch','CreateSquareMessage','create','body','options','raw','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0x46b3,0x1ac));var _0x346b=function(_0x475a96,_0x3fecf8){_0x475a96=_0x475a96-0x0;var _0x34bf94=_0x46b3[_0x475a96];return _0x34bf94;};'use strict';var _=require(_0x346b('0x0'));var util=require(_0x346b('0x1'));var moment=require('moment');var BPromise=require(_0x346b('0x2'));var rs=require(_0x346b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x346b('0x4'))['db'];var utils=require(_0x346b('0x5'));var logger=require('../../config/logger')(_0x346b('0x6'));var config=require(_0x346b('0x7'));var jayson=require(_0x346b('0x8'));var client=jayson[_0x346b('0x9')][_0x346b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x307ba2,_0x80444c,_0x132a57){return new BPromise(function(_0x2554f5,_0x2393da){return client[_0x346b('0xb')](_0x307ba2,_0x132a57)[_0x346b('0xc')](function(_0x28895f){logger[_0x346b('0xd')](_0x346b('0xe'),_0x80444c,_0x346b('0xf'));logger[_0x346b('0x10')](_0x346b('0x11'),_0x80444c,_0x346b('0xf'),JSON[_0x346b('0x12')](_0x28895f));if(_0x28895f[_0x346b('0x13')]){if(_0x28895f['error'][_0x346b('0x14')]===0x1f4){logger[_0x346b('0x13')](_0x346b('0xe'),_0x80444c,_0x28895f[_0x346b('0x13')][_0x346b('0x15')]);return _0x2393da(_0x28895f[_0x346b('0x13')][_0x346b('0x15')]);}logger['error'](_0x346b('0xe'),_0x80444c,_0x28895f[_0x346b('0x13')][_0x346b('0x15')]);return _0x2554f5(_0x28895f[_0x346b('0x13')][_0x346b('0x15')]);}else{logger[_0x346b('0xd')](_0x346b('0xe'),_0x80444c,_0x346b('0xf'));_0x2554f5(_0x28895f['result'][_0x346b('0x15')]);}})[_0x346b('0x16')](function(_0x3163b0){logger['error'](_0x346b('0xe'),_0x80444c,_0x3163b0);_0x2393da(_0x3163b0);});});}exports[_0x346b('0x17')]=function(_0x1f520d){var _0x4f5a26=this;return new Promise(function(_0x1206ca,_0x381416){return db['SquareMessage'][_0x346b('0x18')](_0x1f520d[_0x346b('0x19')],{'raw':_0x1f520d[_0x346b('0x1a')]?_0x1f520d[_0x346b('0x1a')][_0x346b('0x1b')]===undefined?!![]:![]:!![]})[_0x346b('0xc')](function(_0xef1a36){logger[_0x346b('0xd')]('CreateSquareMessage',_0x1f520d);logger[_0x346b('0x10')](_0x346b('0x17'),_0x1f520d,JSON[_0x346b('0x12')](_0xef1a36));_0x1206ca(_0xef1a36);})['catch'](function(_0x231ad6){logger[_0x346b('0x13')](_0x346b('0x17'),_0x231ad6[_0x346b('0x15')],_0x1f520d);_0x381416(_0x4f5a26[_0x346b('0x13')](0x1f4,_0x231ad6[_0x346b('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 582662b..d8a652f 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 _0x0224=['/:id/test','15s','test','post','create','put','update','delete','destroy','exports','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','index','/:id'];(function(_0xa1291,_0x60ad1f){var _0x5946d8=function(_0x25ca4b){while(--_0x25ca4b){_0xa1291['push'](_0xa1291['shift']());}};_0x5946d8(++_0x60ad1f);}(_0x0224,0x130));var _0x4022=function(_0x22ba6,_0x18dc12){_0x22ba6=_0x22ba6-0x0;var _0x4dca2e=_0x0224[_0x22ba6];return _0x4dca2e;};'use strict';var multer=require('multer');var util=require(_0x4022('0x0'));var path=require('path');var timeout=require(_0x4022('0x1'));var express=require(_0x4022('0x2'));var router=express[_0x4022('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x4022('0x4'));var config=require(_0x4022('0x5'));var controller=require(_0x4022('0x6'));router[_0x4022('0x7')]('/',auth[_0x4022('0x8')](),controller[_0x4022('0x9')]);router[_0x4022('0x7')](_0x4022('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x4022('0x7')](_0x4022('0xb'),auth['isAuthenticated'](),timeout(_0x4022('0xc')),controller[_0x4022('0xd')]);router[_0x4022('0xe')]('/',auth['isAuthenticated'](),controller[_0x4022('0xf')]);router[_0x4022('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x4022('0x11')]);router[_0x4022('0x12')](_0x4022('0xa'),auth['isAuthenticated'](),controller[_0x4022('0x13')]);module[_0x4022('0x14')]=router; \ No newline at end of file +var _0x3531=['multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','index','/:id','show','test','post','create','update','delete','destroy','exports'];(function(_0x32444a,_0x1d1591){var _0x431bee=function(_0x3bd4b3){while(--_0x3bd4b3){_0x32444a['push'](_0x32444a['shift']());}};_0x431bee(++_0x1d1591);}(_0x3531,0x165));var _0x1353=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0x3531[_0x4c7fb5];return _0x2e10ac;};'use strict';var multer=require(_0x1353('0x0'));var util=require(_0x1353('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1353('0x2'));var router=express[_0x1353('0x3')]();var fs_extra=require(_0x1353('0x4'));var auth=require(_0x1353('0x5'));var interaction=require(_0x1353('0x6'));var config=require(_0x1353('0x7'));var controller=require(_0x1353('0x8'));router[_0x1353('0x9')]('/',auth[_0x1353('0xa')](),controller[_0x1353('0xb')]);router[_0x1353('0x9')](_0x1353('0xc'),auth[_0x1353('0xa')](),controller[_0x1353('0xd')]);router['get']('/:id/test',auth[_0x1353('0xa')](),timeout('15s'),controller[_0x1353('0xe')]);router[_0x1353('0xf')]('/',auth[_0x1353('0xa')](),controller[_0x1353('0x10')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x1353('0x11')]);router[_0x1353('0x12')](_0x1353('0xc'),auth[_0x1353('0xa')](),controller[_0x1353('0x13')]);module[_0x1353('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index ca7d506..890a160 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 _0x8db0=['sequelize','exports','name','STRING'];(function(_0x2dcfe1,_0x3feb2a){var _0x3732f0=function(_0x1b4f10){while(--_0x1b4f10){_0x2dcfe1['push'](_0x2dcfe1['shift']());}};_0x3732f0(++_0x3feb2a);}(_0x8db0,0xec));var _0x08db=function(_0x5c2a2b,_0x22c94e){_0x5c2a2b=_0x5c2a2b-0x0;var _0x19921f=_0x8db0[_0x5c2a2b];return _0x19921f;};'use strict';var Sequelize=require(_0x08db('0x0'));module[_0x08db('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x08db('0x2'),'allowNull':![]},'dsn':{'type':Sequelize[_0x08db('0x3')]},'description':{'type':Sequelize[_0x08db('0x3')]}}; \ No newline at end of file +var _0x7db1=['sequelize','exports','STRING','name'];(function(_0x57414f,_0x2f2ca9){var _0xe98996=function(_0x2430b6){while(--_0x2430b6){_0x57414f['push'](_0x57414f['shift']());}};_0xe98996(++_0x2f2ca9);}(_0x7db1,0xa0));var _0x17db=function(_0x559e51,_0x2836f7){_0x559e51=_0x559e51-0x0;var _0x3d228c=_0x7db1[_0x559e51];return _0x3d228c;};'use strict';var Sequelize=require(_0x17db('0x0'));module[_0x17db('0x1')]={'name':{'type':Sequelize[_0x17db('0x2')],'unique':_0x17db('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0x17db('0x2')]},'description':{'type':Sequelize[_0x17db('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 6d11f10..797c0af 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 _0xa5b0=['util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','get','ODBC','UserProfileResource','destroy','error','name','send','index','map','SquareOdbc','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','findAll','show','keys','rawAttributes','include','find','catch','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','create','params','test','dsn','odbc','openSync','closeSync','eml-format','rimraf','zip-dir','fast-json-patch','bluebird'];(function(_0x5553b3,_0x337912){var _0x52d9a3=function(_0x4d4b56){while(--_0x4d4b56){_0x5553b3['push'](_0x5553b3['shift']());}};_0x52d9a3(++_0x337912);}(_0xa5b0,0xf7));var _0x0a5b=function(_0x540041,_0x388ca0){_0x540041=_0x540041-0x0;var _0x5a4898=_0xa5b0[_0x540041];return _0x5a4898;};'use strict';var emlformat=require(_0x0a5b('0x0'));var rimraf=require(_0x0a5b('0x1'));var zipdir=require(_0x0a5b('0x2'));var jsonpatch=require(_0x0a5b('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0a5b('0x4'));var Mustache=require('mustache');var util=require(_0x0a5b('0x5'));var path=require('path');var sox=require(_0x0a5b('0x6'));var csv=require(_0x0a5b('0x7'));var ejs=require(_0x0a5b('0x8'));var fs=require('fs');var fs_extra=require(_0x0a5b('0x9'));var _=require(_0x0a5b('0xa'));var squel=require(_0x0a5b('0xb'));var crypto=require(_0x0a5b('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0a5b('0x7'));var querystring=require(_0x0a5b('0xd'));var Papa=require(_0x0a5b('0xe'));var Redis=require('ioredis');var authService=require(_0x0a5b('0xf'));var qs=require(_0x0a5b('0x10'));var as=require(_0x0a5b('0x11'));var hardwareService=require(_0x0a5b('0x12'));var logger=require(_0x0a5b('0x13'))(_0x0a5b('0x14'));var utils=require(_0x0a5b('0x15'));var config=require(_0x0a5b('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2e6a71,_0x49be80){_0x49be80=_0x49be80||0xcc;return function(_0xcc1c88){if(_0xcc1c88){return _0x2e6a71[_0x0a5b('0x17')](_0x49be80);}return _0x2e6a71['status'](_0x49be80)[_0x0a5b('0x18')]();};}function respondWithResult(_0xb7a801,_0x12bd5d){_0x12bd5d=_0x12bd5d||0xc8;return function(_0xf82cf){if(_0xf82cf){return _0xb7a801[_0x0a5b('0x19')](_0x12bd5d)[_0x0a5b('0x1a')](_0xf82cf);}};}function respondWithFilteredResult(_0x411f56,_0x41e055){return function(_0x433f22){if(_0x433f22){var _0x304b24=typeof _0x41e055[_0x0a5b('0x1b')]===_0x0a5b('0x1c')&&typeof _0x41e055[_0x0a5b('0x1d')]==='undefined';var _0x496708=_0x433f22[_0x0a5b('0x1e')];var _0x333074=_0x304b24?0x0:_0x41e055[_0x0a5b('0x1b')];var _0x3c50fa=_0x304b24?_0x433f22[_0x0a5b('0x1e')]:_0x41e055[_0x0a5b('0x1b')]+_0x41e055['limit'];var _0x104f95;if(_0x3c50fa>=_0x496708){_0x3c50fa=_0x496708;_0x104f95=0xc8;}else{_0x104f95=0xce;}_0x411f56[_0x0a5b('0x19')](_0x104f95);return _0x411f56[_0x0a5b('0x1f')]('Content-Range',_0x333074+'-'+_0x3c50fa+'/'+_0x496708)[_0x0a5b('0x1a')](_0x433f22);}return null;};}function patchUpdates(_0x585c66){return function(_0x23fb2f){try{jsonpatch[_0x0a5b('0x20')](_0x23fb2f,_0x585c66,!![]);}catch(_0x5d2c26){return BPromise[_0x0a5b('0x21')](_0x5d2c26);}return _0x23fb2f[_0x0a5b('0x22')]();};}function saveUpdates(_0x2d5bd7,_0x24794e){return function(_0x55af61){if(_0x55af61){return _0x55af61[_0x0a5b('0x23')](_0x2d5bd7)['then'](function(_0x5a2d76){return _0x5a2d76;});}return null;};}function removeEntity(_0x19f29c,_0x30827e){return function(_0xd25313){if(_0xd25313){return _0xd25313['destroy']()[_0x0a5b('0x24')](function(){var _0x1b3112=_0xd25313[_0x0a5b('0x25')]({'plain':!![]});var _0x3b519d=_0x0a5b('0x26');return db[_0x0a5b('0x27')][_0x0a5b('0x28')]({'where':{'type':_0x3b519d,'resourceId':_0x1b3112['id']}})[_0x0a5b('0x24')](function(){return _0xd25313;});})['then'](function(){_0x19f29c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5122ba,_0x4839ce){return function(_0x4ceb23){if(!_0x4ceb23){_0x5122ba[_0x0a5b('0x17')](0x194);}return _0x4ceb23;};}function handleError(_0x987a9e,_0x20872b){_0x20872b=_0x20872b||0x1f4;return function(_0x4c98d9){logger[_0x0a5b('0x29')](_0x4c98d9['stack']);if(_0x4c98d9[_0x0a5b('0x2a')]){delete _0x4c98d9[_0x0a5b('0x2a')];}_0x987a9e[_0x0a5b('0x19')](_0x20872b)[_0x0a5b('0x2b')](_0x4c98d9);};}exports[_0x0a5b('0x2c')]=function(_0x7d3a88,_0x346d32){var _0x1afe43={},_0x257461={},_0x569263={'count':0x0,'rows':[]};var _0x33bc52=_[_0x0a5b('0x2d')](db[_0x0a5b('0x2e')]['rawAttributes'],function(_0x528cb3){return{'name':_0x528cb3['fieldName'],'type':_0x528cb3['type']['key']};});_0x257461[_0x0a5b('0x2f')]=_[_0x0a5b('0x2d')](_0x33bc52,_0x0a5b('0x2a'));_0x257461[_0x0a5b('0x30')]=_['keys'](_0x7d3a88[_0x0a5b('0x30')]);_0x257461[_0x0a5b('0x31')]=_['intersection'](_0x257461['model'],_0x257461[_0x0a5b('0x30')]);_0x1afe43[_0x0a5b('0x32')]=_[_0x0a5b('0x33')](_0x257461[_0x0a5b('0x2f')],qs[_0x0a5b('0x34')](_0x7d3a88[_0x0a5b('0x30')][_0x0a5b('0x34')]));_0x1afe43[_0x0a5b('0x32')]=_0x1afe43[_0x0a5b('0x32')][_0x0a5b('0x35')]?_0x1afe43[_0x0a5b('0x32')]:_0x257461['model'];if(!_0x7d3a88[_0x0a5b('0x30')][_0x0a5b('0x36')](_0x0a5b('0x37'))){_0x1afe43[_0x0a5b('0x1d')]=qs[_0x0a5b('0x1d')](_0x7d3a88[_0x0a5b('0x30')]['limit']);_0x1afe43[_0x0a5b('0x1b')]=qs[_0x0a5b('0x1b')](_0x7d3a88['query']['offset']);}_0x1afe43[_0x0a5b('0x38')]=qs['sort'](_0x7d3a88[_0x0a5b('0x30')][_0x0a5b('0x39')]);_0x1afe43[_0x0a5b('0x3a')]=qs['filters'](_['pick'](_0x7d3a88[_0x0a5b('0x30')],_0x257461[_0x0a5b('0x31')]),_0x33bc52);if(_0x7d3a88['query']['filter']){_0x1afe43['where']=_[_0x0a5b('0x3b')](_0x1afe43['where'],{'$or':_[_0x0a5b('0x2d')](_0x33bc52,function(_0x1d2da9){if(_0x1d2da9['type']!==_0x0a5b('0x3c')){var _0x4fd0ac={};_0x4fd0ac[_0x1d2da9['name']]={'$like':'%'+_0x7d3a88[_0x0a5b('0x30')][_0x0a5b('0x3d')]+'%'};return _0x4fd0ac;}})});}_0x1afe43=_[_0x0a5b('0x3b')]({},_0x1afe43,_0x7d3a88[_0x0a5b('0x3e')]);var _0x44a5b2={'where':_0x1afe43[_0x0a5b('0x3a')]};return db['SquareOdbc'][_0x0a5b('0x1e')](_0x44a5b2)[_0x0a5b('0x24')](function(_0x3b9834){_0x569263[_0x0a5b('0x1e')]=_0x3b9834;if(_0x7d3a88['query'][_0x0a5b('0x3f')]){_0x1afe43['include']=[{'all':!![]}];}return db[_0x0a5b('0x2e')][_0x0a5b('0x40')](_0x1afe43);})[_0x0a5b('0x24')](function(_0x22ac66){_0x569263['rows']=_0x22ac66;return _0x569263;})['then'](respondWithFilteredResult(_0x346d32,_0x1afe43))['catch'](handleError(_0x346d32,null));};exports[_0x0a5b('0x41')]=function(_0x4eb0db,_0xcca97d){var _0x3593a7={'raw':!![],'where':{'id':_0x4eb0db['params']['id']}},_0x1c0269={};_0x1c0269[_0x0a5b('0x2f')]=_[_0x0a5b('0x42')](db[_0x0a5b('0x2e')][_0x0a5b('0x43')]);_0x1c0269[_0x0a5b('0x30')]=_['keys'](_0x4eb0db['query']);_0x1c0269[_0x0a5b('0x31')]=_['intersection'](_0x1c0269[_0x0a5b('0x2f')],_0x1c0269[_0x0a5b('0x30')]);_0x3593a7[_0x0a5b('0x32')]=_['intersection'](_0x1c0269[_0x0a5b('0x2f')],qs[_0x0a5b('0x34')](_0x4eb0db[_0x0a5b('0x30')][_0x0a5b('0x34')]));_0x3593a7[_0x0a5b('0x32')]=_0x3593a7[_0x0a5b('0x32')][_0x0a5b('0x35')]?_0x3593a7[_0x0a5b('0x32')]:_0x1c0269[_0x0a5b('0x2f')];if(_0x4eb0db[_0x0a5b('0x30')][_0x0a5b('0x3f')]){_0x3593a7[_0x0a5b('0x44')]=[{'all':!![]}];}_0x3593a7=_[_0x0a5b('0x3b')]({},_0x3593a7,_0x4eb0db[_0x0a5b('0x3e')]);return db[_0x0a5b('0x2e')][_0x0a5b('0x45')](_0x3593a7)[_0x0a5b('0x24')](handleEntityNotFound(_0xcca97d,null))[_0x0a5b('0x24')](respondWithResult(_0xcca97d,null))[_0x0a5b('0x46')](handleError(_0xcca97d,null));};exports['create']=function(_0x1ec45a,_0x38ed3d){return db['SquareOdbc']['create'](_0x1ec45a[_0x0a5b('0x47')],{})[_0x0a5b('0x24')](function(_0x45bcdf){var _0x72981e=_0x1ec45a[_0x0a5b('0x48')][_0x0a5b('0x25')]({'plain':!![]});if(!_0x72981e)throw new Error(_0x0a5b('0x49'));if(_0x72981e[_0x0a5b('0x4a')]===_0x0a5b('0x48')){var _0x5a4966=_0x45bcdf['get']({'plain':!![]});var _0x545758=_0x0a5b('0x26');return db[_0x0a5b('0x4b')]['find']({'where':{'name':_0x545758,'userProfileId':_0x72981e[_0x0a5b('0x4c')]},'raw':!![]})[_0x0a5b('0x24')](function(_0x3bb90e){if(_0x3bb90e&&_0x3bb90e['autoAssociation']===0x0){return db[_0x0a5b('0x27')][_0x0a5b('0x4d')]({'name':_0x5a4966[_0x0a5b('0x2a')],'resourceId':_0x5a4966['id'],'type':_0x3bb90e[_0x0a5b('0x2a')],'sectionId':_0x3bb90e['id']},{})[_0x0a5b('0x24')](function(){return _0x45bcdf;});}else{return _0x45bcdf;}})[_0x0a5b('0x46')](function(_0xc00d78){logger[_0x0a5b('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xc00d78);throw _0xc00d78;});}return _0x45bcdf;})[_0x0a5b('0x24')](respondWithResult(_0x38ed3d,0xc9))[_0x0a5b('0x46')](handleError(_0x38ed3d,null));};exports['update']=function(_0x3638ae,_0x4c1603){if(_0x3638ae[_0x0a5b('0x47')]['id']){delete _0x3638ae[_0x0a5b('0x47')]['id'];}return db[_0x0a5b('0x2e')][_0x0a5b('0x45')]({'where':{'id':_0x3638ae['params']['id']}})[_0x0a5b('0x24')](handleEntityNotFound(_0x4c1603,null))[_0x0a5b('0x24')](saveUpdates(_0x3638ae[_0x0a5b('0x47')],null))[_0x0a5b('0x24')](respondWithResult(_0x4c1603,null))['catch'](handleError(_0x4c1603,null));};exports[_0x0a5b('0x28')]=function(_0x4829a0,_0x2f3d2e){return db[_0x0a5b('0x2e')][_0x0a5b('0x45')]({'where':{'id':_0x4829a0[_0x0a5b('0x4e')]['id']}})['then'](handleEntityNotFound(_0x2f3d2e,null))[_0x0a5b('0x24')](removeEntity(_0x2f3d2e,null))[_0x0a5b('0x46')](handleError(_0x2f3d2e,null));};exports[_0x0a5b('0x4f')]=function(_0x5b86ff,_0x179da4,_0x229f2f){var _0x4c0662;return db[_0x0a5b('0x2e')][_0x0a5b('0x45')]({'where':{'id':_0x5b86ff[_0x0a5b('0x4e')]['id']},'attributes':['id',_0x0a5b('0x50')]})[_0x0a5b('0x24')](handleEntityNotFound(_0x179da4,null))['then'](function(_0x4312de){if(_0x4312de){var _0x5a22b6=require(_0x0a5b('0x51'))();_0x5a22b6[_0x0a5b('0x52')](_0x4312de['dsn']);_0x5a22b6[_0x0a5b('0x53')]();return _0x4312de;}})[_0x0a5b('0x24')](respondWithResult(_0x179da4,null))['catch'](handleError(_0x179da4,null));}; \ No newline at end of file +var _0xc32e=['Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','test','odbc','openSync','dsn','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','crypto','desk.js','to-csv','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','count','limit','set','Content-Range','apply','reject','then','get','ODBC','destroy','error','name','send','index','map','rawAttributes','fieldName','type','model','query','intersection','fields','attributes','hasOwnProperty','nolimit','where','filters','pick','filter','VIRTUAL','merge','options','SquareOdbc','includeAll','include','findAll','rows','show','params','keys','length','find','catch','create','user'];(function(_0x50a684,_0x13e443){var _0x3e3fe3=function(_0x24b6bf){while(--_0x24b6bf){_0x50a684['push'](_0x50a684['shift']());}};_0x3e3fe3(++_0x13e443);}(_0xc32e,0xac));var _0xec32=function(_0x1ce86e,_0x2008d3){_0x1ce86e=_0x1ce86e-0x0;var _0x3e4c87=_0xc32e[_0x1ce86e];return _0x3e4c87;};'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(_0xec32('0x0'));var moment=require(_0xec32('0x1'));var BPromise=require(_0xec32('0x2'));var Mustache=require(_0xec32('0x3'));var util=require('util');var path=require('path');var sox=require(_0xec32('0x4'));var csv=require('to-csv');var ejs=require(_0xec32('0x5'));var fs=require('fs');var fs_extra=require(_0xec32('0x6'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xec32('0x7'));var jsforce=require('jsforce');var deskjs=require(_0xec32('0x8'));var toCsv=require(_0xec32('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xec32('0xa'));var authService=require(_0xec32('0xb'));var qs=require(_0xec32('0xc'));var as=require(_0xec32('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xec32('0xe'))(_0xec32('0xf'));var utils=require(_0xec32('0x10'));var config=require(_0xec32('0x11'));var licenseUtil=require(_0xec32('0x12'));var db=require(_0xec32('0x13'))['db'];function respondWithStatusCode(_0x47c99a,_0x4553ca){_0x4553ca=_0x4553ca||0xcc;return function(_0x3d07d7){if(_0x3d07d7){return _0x47c99a[_0xec32('0x14')](_0x4553ca);}return _0x47c99a[_0xec32('0x15')](_0x4553ca)[_0xec32('0x16')]();};}function respondWithResult(_0x4f370f,_0xb4ab64){_0xb4ab64=_0xb4ab64||0xc8;return function(_0x472b02){if(_0x472b02){return _0x4f370f[_0xec32('0x15')](_0xb4ab64)[_0xec32('0x17')](_0x472b02);}};}function respondWithFilteredResult(_0x5f3a78,_0x96b1e6){return function(_0x479c81){if(_0x479c81){var _0x2808e3=typeof _0x96b1e6[_0xec32('0x18')]===_0xec32('0x19')&&typeof _0x96b1e6['limit']===_0xec32('0x19');var _0x49dfe3=_0x479c81[_0xec32('0x1a')];var _0x14b069=_0x2808e3?0x0:_0x96b1e6[_0xec32('0x18')];var _0x112173=_0x2808e3?_0x479c81[_0xec32('0x1a')]:_0x96b1e6[_0xec32('0x18')]+_0x96b1e6[_0xec32('0x1b')];var _0x925777;if(_0x112173>=_0x49dfe3){_0x112173=_0x49dfe3;_0x925777=0xc8;}else{_0x925777=0xce;}_0x5f3a78[_0xec32('0x15')](_0x925777);return _0x5f3a78[_0xec32('0x1c')](_0xec32('0x1d'),_0x14b069+'-'+_0x112173+'/'+_0x49dfe3)['json'](_0x479c81);}return null;};}function patchUpdates(_0x34c1de){return function(_0x2c12bc){try{jsonpatch[_0xec32('0x1e')](_0x2c12bc,_0x34c1de,!![]);}catch(_0x25b678){return BPromise[_0xec32('0x1f')](_0x25b678);}return _0x2c12bc['save']();};}function saveUpdates(_0x473fbd,_0x5b5b7d){return function(_0x17d8d2){if(_0x17d8d2){return _0x17d8d2['update'](_0x473fbd)[_0xec32('0x20')](function(_0xc5c732){return _0xc5c732;});}return null;};}function removeEntity(_0x121e2b,_0x5a7d82){return function(_0x3f205d){if(_0x3f205d){return _0x3f205d['destroy']()[_0xec32('0x20')](function(){var _0x445a4d=_0x3f205d[_0xec32('0x21')]({'plain':!![]});var _0x3fbca6=_0xec32('0x22');return db['UserProfileResource'][_0xec32('0x23')]({'where':{'type':_0x3fbca6,'resourceId':_0x445a4d['id']}})['then'](function(){return _0x3f205d;});})['then'](function(){_0x121e2b[_0xec32('0x15')](0xcc)[_0xec32('0x16')]();});}};}function handleEntityNotFound(_0x445672,_0x3e3549){return function(_0x297e4b){if(!_0x297e4b){_0x445672['sendStatus'](0x194);}return _0x297e4b;};}function handleError(_0x3167ac,_0x574046){_0x574046=_0x574046||0x1f4;return function(_0x4a3794){logger[_0xec32('0x24')](_0x4a3794['stack']);if(_0x4a3794[_0xec32('0x25')]){delete _0x4a3794['name'];}_0x3167ac[_0xec32('0x15')](_0x574046)[_0xec32('0x26')](_0x4a3794);};}exports[_0xec32('0x27')]=function(_0x4c7373,_0x4b5c09){var _0x2b55bd={},_0x4e18be={},_0x1d4a76={'count':0x0,'rows':[]};var _0x16a34b=_[_0xec32('0x28')](db['SquareOdbc'][_0xec32('0x29')],function(_0x4cf14d){return{'name':_0x4cf14d[_0xec32('0x2a')],'type':_0x4cf14d[_0xec32('0x2b')]['key']};});_0x4e18be[_0xec32('0x2c')]=_[_0xec32('0x28')](_0x16a34b,_0xec32('0x25'));_0x4e18be[_0xec32('0x2d')]=_['keys'](_0x4c7373[_0xec32('0x2d')]);_0x4e18be['filters']=_['intersection'](_0x4e18be[_0xec32('0x2c')],_0x4e18be[_0xec32('0x2d')]);_0x2b55bd['attributes']=_[_0xec32('0x2e')](_0x4e18be[_0xec32('0x2c')],qs[_0xec32('0x2f')](_0x4c7373[_0xec32('0x2d')][_0xec32('0x2f')]));_0x2b55bd[_0xec32('0x30')]=_0x2b55bd['attributes']['length']?_0x2b55bd[_0xec32('0x30')]:_0x4e18be[_0xec32('0x2c')];if(!_0x4c7373[_0xec32('0x2d')][_0xec32('0x31')](_0xec32('0x32'))){_0x2b55bd[_0xec32('0x1b')]=qs[_0xec32('0x1b')](_0x4c7373[_0xec32('0x2d')][_0xec32('0x1b')]);_0x2b55bd[_0xec32('0x18')]=qs['offset'](_0x4c7373[_0xec32('0x2d')]['offset']);}_0x2b55bd['order']=qs['sort'](_0x4c7373['query']['sort']);_0x2b55bd[_0xec32('0x33')]=qs[_0xec32('0x34')](_[_0xec32('0x35')](_0x4c7373[_0xec32('0x2d')],_0x4e18be['filters']),_0x16a34b);if(_0x4c7373[_0xec32('0x2d')][_0xec32('0x36')]){_0x2b55bd[_0xec32('0x33')]=_['merge'](_0x2b55bd[_0xec32('0x33')],{'$or':_['map'](_0x16a34b,function(_0x43304f){if(_0x43304f['type']!==_0xec32('0x37')){var _0xc48db4={};_0xc48db4[_0x43304f['name']]={'$like':'%'+_0x4c7373['query'][_0xec32('0x36')]+'%'};return _0xc48db4;}})});}_0x2b55bd=_[_0xec32('0x38')]({},_0x2b55bd,_0x4c7373[_0xec32('0x39')]);var _0x349d80={'where':_0x2b55bd[_0xec32('0x33')]};return db[_0xec32('0x3a')][_0xec32('0x1a')](_0x349d80)[_0xec32('0x20')](function(_0x518a0f){_0x1d4a76['count']=_0x518a0f;if(_0x4c7373[_0xec32('0x2d')][_0xec32('0x3b')]){_0x2b55bd[_0xec32('0x3c')]=[{'all':!![]}];}return db[_0xec32('0x3a')][_0xec32('0x3d')](_0x2b55bd);})[_0xec32('0x20')](function(_0x24b195){_0x1d4a76[_0xec32('0x3e')]=_0x24b195;return _0x1d4a76;})['then'](respondWithFilteredResult(_0x4b5c09,_0x2b55bd))['catch'](handleError(_0x4b5c09,null));};exports[_0xec32('0x3f')]=function(_0x59e529,_0x4041ea){var _0xd4b2d0={'raw':!![],'where':{'id':_0x59e529[_0xec32('0x40')]['id']}},_0x14ae8a={};_0x14ae8a[_0xec32('0x2c')]=_[_0xec32('0x41')](db[_0xec32('0x3a')][_0xec32('0x29')]);_0x14ae8a[_0xec32('0x2d')]=_['keys'](_0x59e529[_0xec32('0x2d')]);_0x14ae8a[_0xec32('0x34')]=_['intersection'](_0x14ae8a[_0xec32('0x2c')],_0x14ae8a[_0xec32('0x2d')]);_0xd4b2d0[_0xec32('0x30')]=_[_0xec32('0x2e')](_0x14ae8a[_0xec32('0x2c')],qs[_0xec32('0x2f')](_0x59e529[_0xec32('0x2d')][_0xec32('0x2f')]));_0xd4b2d0[_0xec32('0x30')]=_0xd4b2d0[_0xec32('0x30')][_0xec32('0x42')]?_0xd4b2d0['attributes']:_0x14ae8a[_0xec32('0x2c')];if(_0x59e529[_0xec32('0x2d')]['includeAll']){_0xd4b2d0[_0xec32('0x3c')]=[{'all':!![]}];}_0xd4b2d0=_['merge']({},_0xd4b2d0,_0x59e529[_0xec32('0x39')]);return db['SquareOdbc'][_0xec32('0x43')](_0xd4b2d0)[_0xec32('0x20')](handleEntityNotFound(_0x4041ea,null))[_0xec32('0x20')](respondWithResult(_0x4041ea,null))[_0xec32('0x44')](handleError(_0x4041ea,null));};exports['create']=function(_0x301622,_0x11aaa3){return db[_0xec32('0x3a')][_0xec32('0x45')](_0x301622['body'],{})['then'](function(_0x59fd56){var _0x339529=_0x301622[_0xec32('0x46')][_0xec32('0x21')]({'plain':!![]});if(!_0x339529)throw new Error(_0xec32('0x47'));if(_0x339529['role']===_0xec32('0x46')){var _0x4b89bb=_0x59fd56['get']({'plain':!![]});var _0x32e81c=_0xec32('0x22');return db[_0xec32('0x48')]['find']({'where':{'name':_0x32e81c,'userProfileId':_0x339529['userProfileId']},'raw':!![]})[_0xec32('0x20')](function(_0x2806aa){if(_0x2806aa&&_0x2806aa[_0xec32('0x49')]===0x0){return db[_0xec32('0x4a')]['create']({'name':_0x4b89bb[_0xec32('0x25')],'resourceId':_0x4b89bb['id'],'type':_0x2806aa['name'],'sectionId':_0x2806aa['id']},{})['then'](function(){return _0x59fd56;});}else{return _0x59fd56;}})[_0xec32('0x44')](function(_0x24ebdb){logger[_0xec32('0x24')](_0xec32('0x4b'),_0x24ebdb);throw _0x24ebdb;});}return _0x59fd56;})[_0xec32('0x20')](respondWithResult(_0x11aaa3,0xc9))[_0xec32('0x44')](handleError(_0x11aaa3,null));};exports['update']=function(_0x41ec9b,_0x2dafb9){if(_0x41ec9b[_0xec32('0x4c')]['id']){delete _0x41ec9b['body']['id'];}return db[_0xec32('0x3a')][_0xec32('0x43')]({'where':{'id':_0x41ec9b[_0xec32('0x40')]['id']}})[_0xec32('0x20')](handleEntityNotFound(_0x2dafb9,null))[_0xec32('0x20')](saveUpdates(_0x41ec9b['body'],null))['then'](respondWithResult(_0x2dafb9,null))[_0xec32('0x44')](handleError(_0x2dafb9,null));};exports[_0xec32('0x23')]=function(_0x377ba8,_0x245214){return db[_0xec32('0x3a')]['find']({'where':{'id':_0x377ba8['params']['id']}})[_0xec32('0x20')](handleEntityNotFound(_0x245214,null))[_0xec32('0x20')](removeEntity(_0x245214,null))[_0xec32('0x44')](handleError(_0x245214,null));};exports[_0xec32('0x4d')]=function(_0x558049,_0x244d7d,_0x526516){var _0xde101a;return db[_0xec32('0x3a')][_0xec32('0x43')]({'where':{'id':_0x558049[_0xec32('0x40')]['id']},'attributes':['id','dsn']})[_0xec32('0x20')](handleEntityNotFound(_0x244d7d,null))[_0xec32('0x20')](function(_0x511334){if(_0x511334){var _0x45883f=require(_0xec32('0x4e'))();_0x45883f[_0xec32('0x4f')](_0x511334[_0xec32('0x50')]);_0x45883f['closeSync']();return _0x511334;}})[_0xec32('0x20')](respondWithResult(_0x244d7d,null))[_0xec32('0x44')](handleError(_0x244d7d,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 4dcc226..dc27629 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 _0xd2e6=['exports','square_odbc','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareOdbc.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd2e6,0x70));var _0x6d2e=function(_0x411a91,_0x32b137){_0x411a91=_0x411a91-0x0;var _0x4446c5=_0xd2e6[_0x411a91];return _0x4446c5;};'use strict';var _=require('lodash');var util=require(_0x6d2e('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x6d2e('0x1'));var BPromise=require(_0x6d2e('0x2'));var rp=require(_0x6d2e('0x3'));var fs=require('fs');var path=require(_0x6d2e('0x4'));var rimraf=require(_0x6d2e('0x5'));var config=require(_0x6d2e('0x6'));var attributes=require(_0x6d2e('0x7'));module[_0x6d2e('0x8')]=function(_0x28e18a,_0x493018){return _0x28e18a['define']('SquareOdbc',attributes,{'tableName':_0x6d2e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa6aa=['SquareOdbc','square_odbc','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./squareOdbc.attributes','define'];(function(_0x24ee3c,_0x2b1b1e){var _0x2900bf=function(_0x3486c9){while(--_0x3486c9){_0x24ee3c['push'](_0x24ee3c['shift']());}};_0x2900bf(++_0x2b1b1e);}(_0xa6aa,0x182));var _0xaa6a=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0xa6aa[_0x3ab9ee];return _0x82ee88;};'use strict';var _=require(_0xaa6a('0x0'));var util=require(_0xaa6a('0x1'));var logger=require('../../config/logger')(_0xaa6a('0x2'));var moment=require(_0xaa6a('0x3'));var BPromise=require(_0xaa6a('0x4'));var rp=require(_0xaa6a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xaa6a('0x6'));var config=require(_0xaa6a('0x7'));var attributes=require(_0xaa6a('0x8'));module['exports']=function(_0x36593c,_0x3fa6c9){return _0x36593c[_0xaa6a('0x9')](_0xaa6a('0xa'),attributes,{'tableName':_0xaa6a('0xb'),'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 5085fdb..58da3d0 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 _0x36f7=['attributes','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','client','request','then','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSquareOdbc','SquareOdbc','find','options','raw','where','include','map','model'];(function(_0x50b955,_0x4600e){var _0x28241b=function(_0x4cd2d6){while(--_0x4cd2d6){_0x50b955['push'](_0x50b955['shift']());}};_0x28241b(++_0x4600e);}(_0x36f7,0x1e1));var _0x736f=function(_0x5c8391,_0x197b5b){_0x5c8391=_0x5c8391-0x0;var _0xbf46e7=_0x36f7[_0x5c8391];return _0xbf46e7;};'use strict';var _=require(_0x736f('0x0'));var util=require(_0x736f('0x1'));var moment=require(_0x736f('0x2'));var BPromise=require(_0x736f('0x3'));var rs=require(_0x736f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x736f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x736f('0x6'))(_0x736f('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x736f('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3a0ca0,_0x4ad2ba,_0x48b811){return new BPromise(function(_0x244fce,_0x747d6d){return client[_0x736f('0x9')](_0x3a0ca0,_0x48b811)[_0x736f('0xa')](function(_0x17be10){logger[_0x736f('0xb')](_0x736f('0xc'),_0x4ad2ba,_0x736f('0xd'));logger[_0x736f('0xe')](_0x736f('0xf'),_0x4ad2ba,_0x736f('0xd'),JSON[_0x736f('0x10')](_0x17be10));if(_0x17be10[_0x736f('0x11')]){if(_0x17be10['error'][_0x736f('0x12')]===0x1f4){logger[_0x736f('0x11')](_0x736f('0xc'),_0x4ad2ba,_0x17be10['error']['message']);return _0x747d6d(_0x17be10['error']['message']);}logger['error'](_0x736f('0xc'),_0x4ad2ba,_0x17be10[_0x736f('0x11')][_0x736f('0x13')]);return _0x244fce(_0x17be10['error']['message']);}else{logger[_0x736f('0xb')](_0x736f('0xc'),_0x4ad2ba,_0x736f('0xd'));_0x244fce(_0x17be10[_0x736f('0x14')][_0x736f('0x13')]);}})[_0x736f('0x15')](function(_0xd2a632){logger['error'](_0x736f('0xc'),_0x4ad2ba,_0xd2a632);_0x747d6d(_0xd2a632);});});}exports[_0x736f('0x16')]=function(_0x2a9e39){var _0x322da7=this;return new Promise(function(_0x44f45f,_0x38636f){return db[_0x736f('0x17')][_0x736f('0x18')]({'raw':_0x2a9e39[_0x736f('0x19')]?_0x2a9e39[_0x736f('0x19')][_0x736f('0x1a')]===undefined?!![]:![]:!![],'where':_0x2a9e39['options']?_0x2a9e39['options'][_0x736f('0x1b')]||null:null,'attributes':_0x2a9e39[_0x736f('0x19')]?_0x2a9e39[_0x736f('0x19')]['attributes']||null:null,'include':_0x2a9e39[_0x736f('0x19')]?_0x2a9e39[_0x736f('0x19')][_0x736f('0x1c')]?_[_0x736f('0x1d')](_0x2a9e39['options'][_0x736f('0x1c')],function(_0x869fab){return{'model':db[_0x869fab[_0x736f('0x1e')]],'as':_0x869fab['as'],'attributes':_0x869fab[_0x736f('0x1f')],'include':_0x869fab['include']?_[_0x736f('0x1d')](_0x869fab[_0x736f('0x1c')],function(_0x1b5c89){return{'model':db[_0x1b5c89[_0x736f('0x1e')]],'as':_0x1b5c89['as'],'attributes':_0x1b5c89[_0x736f('0x1f')],'include':_0x1b5c89[_0x736f('0x1c')]?_[_0x736f('0x1d')](_0x1b5c89[_0x736f('0x1c')],function(_0x3f6cf4){return{'model':db[_0x3f6cf4['model']],'as':_0x3f6cf4['as'],'attributes':_0x3f6cf4[_0x736f('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x736f('0xa')](function(_0xc70cc9){logger[_0x736f('0xb')](_0x736f('0x16'),_0x2a9e39);logger[_0x736f('0xe')](_0x736f('0x16'),_0x2a9e39,JSON[_0x736f('0x10')](_0xc70cc9));_0x44f45f(_0xc70cc9);})[_0x736f('0x15')](function(_0x4df553){logger[_0x736f('0x11')](_0x736f('0x16'),_0x4df553[_0x736f('0x13')],_0x2a9e39);_0x38636f(_0x322da7['error'](0x1f4,_0x4df553['message']));});});}; \ No newline at end of file +var _0x6d53=['client','http','request','then','info','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareOdbc,\x20%s,\x20%s','message','request\x20sent','result','catch','ShowSquareOdbc','SquareOdbc','find','options','where','include','model','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0x6d53,0x1af));var _0x36d5=function(_0x5b869d,_0x4fdce9){_0x5b869d=_0x5b869d-0x0;var _0x35eec9=_0x6d53[_0x5b869d];return _0x35eec9;};'use strict';var _=require(_0x36d5('0x0'));var util=require(_0x36d5('0x1'));var moment=require(_0x36d5('0x2'));var BPromise=require(_0x36d5('0x3'));var rs=require(_0x36d5('0x4'));var fs=require('fs');var Redis=require(_0x36d5('0x5'));var db=require(_0x36d5('0x6'))['db'];var utils=require(_0x36d5('0x7'));var logger=require(_0x36d5('0x8'))(_0x36d5('0x9'));var config=require(_0x36d5('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x36d5('0xb')][_0x36d5('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x33f150,_0x30b3fe,_0x2d57bd){return new BPromise(function(_0x1598cf,_0xcb6c34){return client[_0x36d5('0xd')](_0x33f150,_0x2d57bd)[_0x36d5('0xe')](function(_0x11be67){logger[_0x36d5('0xf')]('SquareOdbc,\x20%s,\x20%s',_0x30b3fe,'request\x20sent');logger[_0x36d5('0x10')](_0x36d5('0x11'),_0x30b3fe,'request\x20sent',JSON[_0x36d5('0x12')](_0x11be67));if(_0x11be67[_0x36d5('0x13')]){if(_0x11be67[_0x36d5('0x13')][_0x36d5('0x14')]===0x1f4){logger[_0x36d5('0x13')]('SquareOdbc,\x20%s,\x20%s',_0x30b3fe,_0x11be67[_0x36d5('0x13')]['message']);return _0xcb6c34(_0x11be67['error']['message']);}logger['error'](_0x36d5('0x15'),_0x30b3fe,_0x11be67[_0x36d5('0x13')][_0x36d5('0x16')]);return _0x1598cf(_0x11be67[_0x36d5('0x13')][_0x36d5('0x16')]);}else{logger[_0x36d5('0xf')](_0x36d5('0x15'),_0x30b3fe,_0x36d5('0x17'));_0x1598cf(_0x11be67[_0x36d5('0x18')][_0x36d5('0x16')]);}})[_0x36d5('0x19')](function(_0x3b66cd){logger[_0x36d5('0x13')]('SquareOdbc,\x20%s,\x20%s',_0x30b3fe,_0x3b66cd);_0xcb6c34(_0x3b66cd);});});}exports[_0x36d5('0x1a')]=function(_0x26c3c2){var _0x3827a6=this;return new Promise(function(_0x14fabd,_0x3a01fb){return db[_0x36d5('0x1b')][_0x36d5('0x1c')]({'raw':_0x26c3c2[_0x36d5('0x1d')]?_0x26c3c2[_0x36d5('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x26c3c2[_0x36d5('0x1d')]?_0x26c3c2[_0x36d5('0x1d')][_0x36d5('0x1e')]||null:null,'attributes':_0x26c3c2['options']?_0x26c3c2[_0x36d5('0x1d')]['attributes']||null:null,'include':_0x26c3c2[_0x36d5('0x1d')]?_0x26c3c2[_0x36d5('0x1d')][_0x36d5('0x1f')]?_['map'](_0x26c3c2['options'][_0x36d5('0x1f')],function(_0x4d2e58){return{'model':db[_0x4d2e58[_0x36d5('0x20')]],'as':_0x4d2e58['as'],'attributes':_0x4d2e58[_0x36d5('0x21')],'include':_0x4d2e58[_0x36d5('0x1f')]?_['map'](_0x4d2e58['include'],function(_0x39eece){return{'model':db[_0x39eece[_0x36d5('0x20')]],'as':_0x39eece['as'],'attributes':_0x39eece[_0x36d5('0x21')],'include':_0x39eece['include']?_['map'](_0x39eece[_0x36d5('0x1f')],function(_0x4ae06c){return{'model':db[_0x4ae06c['model']],'as':_0x4ae06c['as'],'attributes':_0x4ae06c['attributes']};}):[]};}):[]};}):[]:[]})[_0x36d5('0xe')](function(_0xd29649){logger[_0x36d5('0xf')]('ShowSquareOdbc',_0x26c3c2);logger[_0x36d5('0x10')](_0x36d5('0x1a'),_0x26c3c2,JSON[_0x36d5('0x12')](_0xd29649));_0x14fabd(_0xd29649);})['catch'](function(_0x8dcab1){logger[_0x36d5('0x13')](_0x36d5('0x1a'),_0x8dcab1[_0x36d5('0x16')],_0x26c3c2);_0x3a01fb(_0x3827a6[_0x36d5('0x13')](0x1f4,_0x8dcab1[_0x36d5('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 12a5626..55db3ba 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 _0xcdc2=['../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','get','isAuthenticated','show','/:id/users','addUsers','put','/:id','destroy','delete','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x58d8d7,_0x108377){var _0x339d20=function(_0x45849e){while(--_0x45849e){_0x58d8d7['push'](_0x58d8d7['shift']());}};_0x339d20(++_0x108377);}(_0xcdc2,0x19d));var _0x2cdc=function(_0x45a04b,_0x5d5fa6){_0x45a04b=_0x45a04b-0x0;var _0x275bc6=_0xcdc2[_0x45a04b];return _0x275bc6;};'use strict';var multer=require(_0x2cdc('0x0'));var util=require(_0x2cdc('0x1'));var path=require(_0x2cdc('0x2'));var timeout=require(_0x2cdc('0x3'));var express=require(_0x2cdc('0x4'));var router=express[_0x2cdc('0x5')]();var fs_extra=require(_0x2cdc('0x6'));var auth=require(_0x2cdc('0x7'));var interaction=require(_0x2cdc('0x8'));var config=require(_0x2cdc('0x9'));var controller=require(_0x2cdc('0xa'));router[_0x2cdc('0xb')]('/',auth['isAuthenticated'](),controller['index']);router[_0x2cdc('0xb')]('/:id',auth[_0x2cdc('0xc')](),controller[_0x2cdc('0xd')]);router[_0x2cdc('0xb')]('/:id/users',auth[_0x2cdc('0xc')](),controller['getUsers']);router['post']('/',auth[_0x2cdc('0xc')](),controller['create']);router['post'](_0x2cdc('0xe'),auth['isAuthenticated'](),controller[_0x2cdc('0xf')]);router[_0x2cdc('0x10')](_0x2cdc('0x11'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x2cdc('0x12')]);router[_0x2cdc('0x13')](_0x2cdc('0xe'),auth[_0x2cdc('0xc')](),controller['removeUsers']);module['exports']=router; \ No newline at end of file +var _0x23a3=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','get','isAuthenticated','index','/:id','/:id/users','post','create','addUsers','put','update','delete','connect-timeout'];(function(_0x532112,_0x37d94b){var _0x23e5fb=function(_0x690ac8){while(--_0x690ac8){_0x532112['push'](_0x532112['shift']());}};_0x23e5fb(++_0x37d94b);}(_0x23a3,0x131));var _0x323a=function(_0x2ef4fc,_0x841c7c){_0x2ef4fc=_0x2ef4fc-0x0;var _0x568bc1=_0x23a3[_0x2ef4fc];return _0x568bc1;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x323a('0x0'));var express=require('express');var router=express[_0x323a('0x1')]();var fs_extra=require(_0x323a('0x2'));var auth=require(_0x323a('0x3'));var interaction=require(_0x323a('0x4'));var config=require(_0x323a('0x5'));var controller=require(_0x323a('0x6'));router[_0x323a('0x7')]('/',auth[_0x323a('0x8')](),controller[_0x323a('0x9')]);router['get'](_0x323a('0xa'),auth[_0x323a('0x8')](),controller['show']);router[_0x323a('0x7')](_0x323a('0xb'),auth[_0x323a('0x8')](),controller['getUsers']);router[_0x323a('0xc')]('/',auth[_0x323a('0x8')](),controller[_0x323a('0xd')]);router[_0x323a('0xc')](_0x323a('0xb'),auth[_0x323a('0x8')](),controller[_0x323a('0xe')]);router[_0x323a('0xf')](_0x323a('0xa'),auth[_0x323a('0x8')](),controller[_0x323a('0x10')]);router[_0x323a('0x11')](_0x323a('0xa'),auth[_0x323a('0x8')](),controller['destroy']);router[_0x323a('0x11')]('/:id/users',auth[_0x323a('0x8')](),controller['removeUsers']);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 09c70e5..7fa4def 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 _0xba34=['preproduction','toString','utf8','BLOB','production','DATE','sequelize','exports','STRING','name','getDataValue'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0xba34,0x119));var _0x4ba3=function(_0x35d2b3,_0x283554){_0x35d2b3=_0x35d2b3-0x0;var _0x2f6f9b=_0xba34[_0x35d2b3];return _0x2f6f9b;};'use strict';var Sequelize=require(_0x4ba3('0x0'));module[_0x4ba3('0x1')]={'name':{'type':Sequelize[_0x4ba3('0x2')],'unique':_0x4ba3('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x4ba3('0x2')]},'notes':{'type':Sequelize['TEXT']},'preproduction':{'type':Sequelize['BLOB']('long'),'get':function(){if(this[_0x4ba3('0x4')](_0x4ba3('0x5'))){return this[_0x4ba3('0x4')](_0x4ba3('0x5'))[_0x4ba3('0x6')](_0x4ba3('0x7'));}}},'production':{'type':Sequelize[_0x4ba3('0x8')]('long'),'get':function(){if(this[_0x4ba3('0x4')](_0x4ba3('0x9'))){return this[_0x4ba3('0x4')](_0x4ba3('0x9'))[_0x4ba3('0x6')](_0x4ba3('0x7'));}}},'savedAt':{'type':Sequelize[_0x4ba3('0xa')]},'publishedAt':{'type':Sequelize[_0x4ba3('0xa')]}}; \ No newline at end of file +var _0x80c4=['long','preproduction','getDataValue','toString','utf8','production','DATE','sequelize','STRING','name','TEXT','BLOB'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x80c4,0xa3));var _0x480c=function(_0x6b47e2,_0x9a9230){_0x6b47e2=_0x6b47e2-0x0;var _0x494494=_0x80c4[_0x6b47e2];return _0x494494;};'use strict';var Sequelize=require(_0x480c('0x0'));module['exports']={'name':{'type':Sequelize[_0x480c('0x1')],'unique':_0x480c('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x480c('0x1')]},'notes':{'type':Sequelize[_0x480c('0x3')]},'preproduction':{'type':Sequelize[_0x480c('0x4')](_0x480c('0x5')),'get':function(){if(this['getDataValue'](_0x480c('0x6'))){return this[_0x480c('0x7')](_0x480c('0x6'))[_0x480c('0x8')](_0x480c('0x9'));}}},'production':{'type':Sequelize[_0x480c('0x4')](_0x480c('0x5')),'get':function(){if(this[_0x480c('0x7')](_0x480c('0xa'))){return this['getDataValue'](_0x480c('0xa'))[_0x480c('0x8')](_0x480c('0x9'));}}},'savedAt':{'type':Sequelize[_0x480c('0xb')]},'publishedAt':{'type':Sequelize[_0x480c('0xb')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 703640d..cbfb0c9 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 _0x21da=['User','order','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','get','SquareProjects','UserProfileResource','then','stack','name','send','SquareProject','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','show','params','keys','rawAttributes','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addUsers','ids','omit','removeUsers','isArray','emit','userSquareProject:remove','getUsers','findOne'];(function(_0x5e2290,_0x24d2d8){var _0x1bbfa2=function(_0x17d018){while(--_0x17d018){_0x5e2290['push'](_0x5e2290['shift']());}};_0x1bbfa2(++_0x24d2d8);}(_0x21da,0x6a));var _0xa21d=function(_0x1774ee,_0x590e9f){_0x1774ee=_0x1774ee-0x0;var _0x2d8b53=_0x21da[_0x1774ee];return _0x2d8b53;};'use strict';var emlformat=require(_0xa21d('0x0'));var rimraf=require(_0xa21d('0x1'));var zipdir=require(_0xa21d('0x2'));var jsonpatch=require(_0xa21d('0x3'));var rp=require(_0xa21d('0x4'));var moment=require(_0xa21d('0x5'));var BPromise=require(_0xa21d('0x6'));var Mustache=require(_0xa21d('0x7'));var util=require(_0xa21d('0x8'));var path=require(_0xa21d('0x9'));var sox=require(_0xa21d('0xa'));var csv=require(_0xa21d('0xb'));var ejs=require(_0xa21d('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa21d('0xd'));var squel=require(_0xa21d('0xe'));var crypto=require(_0xa21d('0xf'));var jsforce=require(_0xa21d('0x10'));var deskjs=require(_0xa21d('0x11'));var toCsv=require('to-csv');var querystring=require(_0xa21d('0x12'));var Papa=require(_0xa21d('0x13'));var Redis=require(_0xa21d('0x14'));var authService=require(_0xa21d('0x15'));var qs=require(_0xa21d('0x16'));var as=require(_0xa21d('0x17'));var hardwareService=require(_0xa21d('0x18'));var logger=require(_0xa21d('0x19'))(_0xa21d('0x1a'));var utils=require('../../config/utils');var config=require(_0xa21d('0x1b'));var licenseUtil=require(_0xa21d('0x1c'));var db=require(_0xa21d('0x1d'))['db'];config[_0xa21d('0x1e')]=_[_0xa21d('0x1f')](config['redis'],{'host':_0xa21d('0x20'),'port':0x18eb});var socket=require(_0xa21d('0x21'))(new Redis(config[_0xa21d('0x1e')]));require('./squareProject.socket')[_0xa21d('0x22')](socket);function respondWithStatusCode(_0x5532e9,_0x174a28){_0x174a28=_0x174a28||0xcc;return function(_0x5d8009){if(_0x5d8009){return _0x5532e9[_0xa21d('0x23')](_0x174a28);}return _0x5532e9[_0xa21d('0x24')](_0x174a28)['end']();};}function respondWithResult(_0x808873,_0x4127bc){_0x4127bc=_0x4127bc||0xc8;return function(_0x277970){if(_0x277970){return _0x808873[_0xa21d('0x24')](_0x4127bc)[_0xa21d('0x25')](_0x277970);}};}function respondWithFilteredResult(_0xaefd24,_0x3652e0){return function(_0x1ac3b6){if(_0x1ac3b6){var _0x5204ba=typeof _0x3652e0[_0xa21d('0x26')]===_0xa21d('0x27')&&typeof _0x3652e0[_0xa21d('0x28')]==='undefined';var _0x3b2992=_0x1ac3b6[_0xa21d('0x29')];var _0x51b773=_0x5204ba?0x0:_0x3652e0[_0xa21d('0x26')];var _0x20eb19=_0x5204ba?_0x1ac3b6['count']:_0x3652e0[_0xa21d('0x26')]+_0x3652e0[_0xa21d('0x28')];var _0x46c224;if(_0x20eb19>=_0x3b2992){_0x20eb19=_0x3b2992;_0x46c224=0xc8;}else{_0x46c224=0xce;}_0xaefd24[_0xa21d('0x24')](_0x46c224);return _0xaefd24[_0xa21d('0x2a')]('Content-Range',_0x51b773+'-'+_0x20eb19+'/'+_0x3b2992)['json'](_0x1ac3b6);}return null;};}function patchUpdates(_0xda5553){return function(_0x13a2ff){try{jsonpatch[_0xa21d('0x2b')](_0x13a2ff,_0xda5553,!![]);}catch(_0x6f27cd){return BPromise[_0xa21d('0x2c')](_0x6f27cd);}return _0x13a2ff[_0xa21d('0x2d')]();};}function saveUpdates(_0x224652,_0x412be4){return function(_0x5e01c8){if(_0x5e01c8){return _0x5e01c8[_0xa21d('0x2e')](_0x224652)['then'](function(_0x32e63a){return _0x32e63a;});}return null;};}function removeEntity(_0x226d65,_0x4b8f47){return function(_0x41e498){if(_0x41e498){return _0x41e498[_0xa21d('0x2f')]()['then'](function(){var _0x5746a6=_0x41e498[_0xa21d('0x30')]({'plain':!![]});var _0x522669=_0xa21d('0x31');return db[_0xa21d('0x32')]['destroy']({'where':{'type':_0x522669,'resourceId':_0x5746a6['id']}})[_0xa21d('0x33')](function(){return _0x41e498;});})['then'](function(){_0x226d65['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x454a07,_0x51e677){return function(_0x12a2f0){if(!_0x12a2f0){_0x454a07[_0xa21d('0x23')](0x194);}return _0x12a2f0;};}function handleError(_0x2fab2a,_0xbfbc8f){_0xbfbc8f=_0xbfbc8f||0x1f4;return function(_0x2553aa){logger['error'](_0x2553aa[_0xa21d('0x34')]);if(_0x2553aa[_0xa21d('0x35')]){delete _0x2553aa[_0xa21d('0x35')];}_0x2fab2a[_0xa21d('0x24')](_0xbfbc8f)[_0xa21d('0x36')](_0x2553aa);};}exports['index']=function(_0x1aea79,_0x3bbab7){var _0x5f3d1a={},_0x21eb06={},_0x45e78b={'count':0x0,'rows':[]};var _0x3bda4e=_['map'](db[_0xa21d('0x37')]['rawAttributes'],function(_0x443cd3){return{'name':_0x443cd3[_0xa21d('0x38')],'type':_0x443cd3[_0xa21d('0x39')][_0xa21d('0x3a')]};});_0x21eb06[_0xa21d('0x3b')]=_[_0xa21d('0x3c')](_0x3bda4e,'name');_0x21eb06[_0xa21d('0x3d')]=_['keys'](_0x1aea79['query']);_0x21eb06[_0xa21d('0x3e')]=_[_0xa21d('0x3f')](_0x21eb06[_0xa21d('0x3b')],_0x21eb06[_0xa21d('0x3d')]);_0x5f3d1a[_0xa21d('0x40')]=_[_0xa21d('0x3f')](_0x21eb06[_0xa21d('0x3b')],qs['fields'](_0x1aea79[_0xa21d('0x3d')][_0xa21d('0x41')]));_0x5f3d1a['attributes']=_0x5f3d1a[_0xa21d('0x40')][_0xa21d('0x42')]?_0x5f3d1a[_0xa21d('0x40')]:_0x21eb06['model'];if(!_0x1aea79[_0xa21d('0x3d')][_0xa21d('0x43')](_0xa21d('0x44'))){_0x5f3d1a[_0xa21d('0x28')]=qs[_0xa21d('0x28')](_0x1aea79[_0xa21d('0x3d')][_0xa21d('0x28')]);_0x5f3d1a[_0xa21d('0x26')]=qs[_0xa21d('0x26')](_0x1aea79[_0xa21d('0x3d')][_0xa21d('0x26')]);}_0x5f3d1a['order']=qs[_0xa21d('0x45')](_0x1aea79[_0xa21d('0x3d')][_0xa21d('0x45')]);_0x5f3d1a[_0xa21d('0x46')]=qs[_0xa21d('0x3e')](_[_0xa21d('0x47')](_0x1aea79['query'],_0x21eb06[_0xa21d('0x3e')]),_0x3bda4e);if(_0x1aea79[_0xa21d('0x3d')][_0xa21d('0x48')]){_0x5f3d1a['where']=_[_0xa21d('0x49')](_0x5f3d1a[_0xa21d('0x46')],{'$or':_[_0xa21d('0x3c')](_0x3bda4e,function(_0x5c97db){if(_0x5c97db['type']!=='VIRTUAL'){var _0x571d3f={};_0x571d3f[_0x5c97db['name']]={'$like':'%'+_0x1aea79[_0xa21d('0x3d')][_0xa21d('0x48')]+'%'};return _0x571d3f;}})});}_0x5f3d1a=_[_0xa21d('0x49')]({},_0x5f3d1a,_0x1aea79[_0xa21d('0x4a')]);var _0x153c1c={'where':_0x5f3d1a[_0xa21d('0x46')]};return db[_0xa21d('0x37')][_0xa21d('0x29')](_0x153c1c)[_0xa21d('0x33')](function(_0x371821){_0x45e78b[_0xa21d('0x29')]=_0x371821;if(_0x1aea79['query'][_0xa21d('0x4b')]){_0x5f3d1a['include']=[{'all':!![]}];}return db[_0xa21d('0x37')][_0xa21d('0x4c')](_0x5f3d1a);})[_0xa21d('0x33')](function(_0x5ef15a){_0x45e78b[_0xa21d('0x4d')]=_0x5ef15a;return _0x45e78b;})[_0xa21d('0x33')](respondWithFilteredResult(_0x3bbab7,_0x5f3d1a))[_0xa21d('0x4e')](handleError(_0x3bbab7,null));};exports[_0xa21d('0x4f')]=function(_0x47c2e3,_0x5069ef){var _0x69dff3={'raw':![],'where':{'id':_0x47c2e3[_0xa21d('0x50')]['id']}},_0x44fad9={};_0x44fad9[_0xa21d('0x3b')]=_[_0xa21d('0x51')](db[_0xa21d('0x37')][_0xa21d('0x52')]);_0x44fad9[_0xa21d('0x3d')]=_[_0xa21d('0x51')](_0x47c2e3[_0xa21d('0x3d')]);_0x44fad9[_0xa21d('0x3e')]=_[_0xa21d('0x3f')](_0x44fad9['model'],_0x44fad9[_0xa21d('0x3d')]);_0x69dff3[_0xa21d('0x40')]=_['intersection'](_0x44fad9[_0xa21d('0x3b')],qs[_0xa21d('0x41')](_0x47c2e3[_0xa21d('0x3d')][_0xa21d('0x41')]));_0x69dff3['attributes']=_0x69dff3[_0xa21d('0x40')][_0xa21d('0x42')]?_0x69dff3['attributes']:_0x44fad9[_0xa21d('0x3b')];if(_0x47c2e3[_0xa21d('0x3d')][_0xa21d('0x4b')]){_0x69dff3[_0xa21d('0x53')]=[{'all':!![]}];}_0x69dff3=_['merge']({},_0x69dff3,_0x47c2e3[_0xa21d('0x4a')]);return db[_0xa21d('0x37')][_0xa21d('0x54')](_0x69dff3)['then'](handleEntityNotFound(_0x5069ef,null))[_0xa21d('0x33')](respondWithResult(_0x5069ef,null))['catch'](handleError(_0x5069ef,null));};exports[_0xa21d('0x55')]=function(_0x1c2112,_0xf12731){return db[_0xa21d('0x37')][_0xa21d('0x55')](_0x1c2112[_0xa21d('0x56')],{})[_0xa21d('0x33')](function(_0x438cc6){var _0x3f2bcb=_0x1c2112[_0xa21d('0x57')][_0xa21d('0x30')]({'plain':!![]});if(!_0x3f2bcb)throw new Error(_0xa21d('0x58'));if(_0x3f2bcb[_0xa21d('0x59')]===_0xa21d('0x57')){var _0x165e59=_0x438cc6[_0xa21d('0x30')]({'plain':!![]});var _0x2c693c=_0xa21d('0x31');return db['UserProfileSection']['find']({'where':{'name':_0x2c693c,'userProfileId':_0x3f2bcb[_0xa21d('0x5a')]},'raw':!![]})[_0xa21d('0x33')](function(_0x50bd10){if(_0x50bd10&&_0x50bd10[_0xa21d('0x5b')]===0x0){return db[_0xa21d('0x32')][_0xa21d('0x55')]({'name':_0x165e59[_0xa21d('0x35')],'resourceId':_0x165e59['id'],'type':_0x50bd10[_0xa21d('0x35')],'sectionId':_0x50bd10['id']},{})[_0xa21d('0x33')](function(){return _0x438cc6;});}else{return _0x438cc6;}})['catch'](function(_0x57da30){logger['error'](_0xa21d('0x5c'),_0x57da30);throw _0x57da30;});}return _0x438cc6;})['then'](respondWithResult(_0xf12731,0xc9))['catch'](handleError(_0xf12731,null));};exports[_0xa21d('0x2e')]=function(_0x33190f,_0x41ab77){if(_0x33190f[_0xa21d('0x56')]['id']){delete _0x33190f[_0xa21d('0x56')]['id'];}return db[_0xa21d('0x37')]['find']({'where':{'id':_0x33190f['params']['id']}})['then'](handleEntityNotFound(_0x41ab77,null))['then'](saveUpdates(_0x33190f[_0xa21d('0x56')],null))[_0xa21d('0x33')](respondWithResult(_0x41ab77,null))[_0xa21d('0x4e')](handleError(_0x41ab77,null));};exports[_0xa21d('0x2f')]=function(_0x36c258,_0x3f8df3){return db[_0xa21d('0x37')]['find']({'where':{'id':_0x36c258[_0xa21d('0x50')]['id']}})[_0xa21d('0x33')](handleEntityNotFound(_0x3f8df3,null))[_0xa21d('0x33')](removeEntity(_0x3f8df3,null))[_0xa21d('0x4e')](handleError(_0x3f8df3,null));};exports['addUsers']=function(_0xf5e5d0,_0x45ac20,_0x17b87d){return db[_0xa21d('0x37')]['find']({'where':{'id':_0xf5e5d0[_0xa21d('0x50')]['id']}})['then'](handleEntityNotFound(_0x45ac20,null))['then'](function(_0x24f671){if(_0x24f671){return _0x24f671[_0xa21d('0x5d')](_0xf5e5d0[_0xa21d('0x56')][_0xa21d('0x5e')],_[_0xa21d('0x5f')](_0xf5e5d0['body'],[_0xa21d('0x5e'),'id'])||{});}})[_0xa21d('0x33')](respondWithResult(_0x45ac20,null))[_0xa21d('0x4e')](handleError(_0x45ac20,null));};exports[_0xa21d('0x60')]=function(_0x18aed0,_0x406d37,_0x2e4319){return db[_0xa21d('0x37')][_0xa21d('0x54')]({'where':{'id':_0x18aed0[_0xa21d('0x50')]['id']}})[_0xa21d('0x33')](handleEntityNotFound(_0x406d37,null))['then'](function(_0x468284){if(_0x468284){return _0x468284['removeUsers'](_0x18aed0[_0xa21d('0x3d')][_0xa21d('0x5e')])[_0xa21d('0x33')](function(){if(_[_0xa21d('0x61')](_0x18aed0['query'][_0xa21d('0x5e')])){for(var _0x269917=0x0;_0x269917<_0x18aed0['query']['ids'][_0xa21d('0x42')];_0x269917+=0x1){socket[_0xa21d('0x62')](_0xa21d('0x63'),{'UserId':Number(_0x18aed0['query'][_0xa21d('0x5e')][_0x269917]),'SquareProjectId':Number(_0x18aed0['params']['id'])});}}else{socket[_0xa21d('0x62')]('userSquareProject:remove',{'UserId':Number(_0x18aed0['query'][_0xa21d('0x5e')]),'SquareProjectId':Number(_0x18aed0[_0xa21d('0x50')]['id'])});}});}})[_0xa21d('0x33')](respondWithStatusCode(_0x406d37,null))[_0xa21d('0x4e')](handleError(_0x406d37,null));};exports[_0xa21d('0x64')]=function(_0x246a48,_0x3e08c9,_0x4ced51){var _0x3c1ab1={};var _0x4015ca={};var _0x41b63d;var _0x56323d;return db[_0xa21d('0x37')][_0xa21d('0x65')]({'where':{'id':_0x246a48[_0xa21d('0x50')]['id']}})[_0xa21d('0x33')](handleEntityNotFound(_0x3e08c9,null))[_0xa21d('0x33')](function(_0x19d307){if(_0x19d307){_0x41b63d=_0x19d307;_0x4015ca[_0xa21d('0x3b')]=_['keys'](db[_0xa21d('0x66')]['rawAttributes']);_0x4015ca[_0xa21d('0x3d')]=_[_0xa21d('0x51')](_0x246a48[_0xa21d('0x3d')]);_0x4015ca[_0xa21d('0x3e')]=_[_0xa21d('0x3f')](_0x4015ca[_0xa21d('0x3b')],_0x4015ca[_0xa21d('0x3d')]);_0x3c1ab1[_0xa21d('0x40')]=_[_0xa21d('0x3f')](_0x4015ca[_0xa21d('0x3b')],qs[_0xa21d('0x41')](_0x246a48[_0xa21d('0x3d')][_0xa21d('0x41')]));_0x3c1ab1[_0xa21d('0x40')]=_0x3c1ab1[_0xa21d('0x40')]['length']?_0x3c1ab1[_0xa21d('0x40')]:_0x4015ca['model'];_0x3c1ab1[_0xa21d('0x67')]=qs[_0xa21d('0x45')](_0x246a48[_0xa21d('0x3d')][_0xa21d('0x45')]);_0x3c1ab1[_0xa21d('0x46')]=qs[_0xa21d('0x3e')](_[_0xa21d('0x47')](_0x246a48[_0xa21d('0x3d')],_0x4015ca['filters']));if(_0x246a48[_0xa21d('0x3d')]['filter']){_0x3c1ab1[_0xa21d('0x46')]=_[_0xa21d('0x49')](_0x3c1ab1[_0xa21d('0x46')],{'$or':_[_0xa21d('0x3c')](_0x3c1ab1['attributes'],function(_0x140bfe){var _0x55a88b={};_0x55a88b[_0x140bfe]={'$like':'%'+_0x246a48[_0xa21d('0x3d')][_0xa21d('0x48')]+'%'};return _0x55a88b;})});}_0x3c1ab1=_[_0xa21d('0x49')]({},_0x3c1ab1,_0x246a48[_0xa21d('0x4a')]);return _0x41b63d[_0xa21d('0x64')](_0x3c1ab1);}})[_0xa21d('0x33')](function(_0x376865){if(_0x376865){_0x56323d=_0x376865[_0xa21d('0x42')];if(!_0x246a48['query'][_0xa21d('0x43')](_0xa21d('0x44'))){_0x3c1ab1['limit']=qs[_0xa21d('0x28')](_0x246a48[_0xa21d('0x3d')]['limit']);_0x3c1ab1[_0xa21d('0x26')]=qs[_0xa21d('0x26')](_0x246a48[_0xa21d('0x3d')][_0xa21d('0x26')]);}return _0x41b63d[_0xa21d('0x64')](_0x3c1ab1);}})['then'](function(_0x142e43){if(_0x142e43){return _0x142e43?{'count':_0x56323d,'rows':_0x142e43}:null;}})[_0xa21d('0x33')](respondWithResult(_0x3e08c9,null))[_0xa21d('0x4e')](handleError(_0x3e08c9,null));}; \ No newline at end of file +var _0x5c7c=['nolimit','eml-format','rimraf','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./squareProject.socket','register','end','status','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','destroy','SquareProjects','UserProfileResource','sendStatus','stack','name','map','SquareProject','rawAttributes','fieldName','key','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','options','includeAll','include','rows','show','params','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addUsers','ids','omit','removeUsers','isArray','emit','userSquareProject:remove','getUsers','User'];(function(_0x5c4585,_0x59300c){var _0x32962a=function(_0x53323e){while(--_0x53323e){_0x5c4585['push'](_0x5c4585['shift']());}};_0x32962a(++_0x59300c);}(_0x5c7c,0xb9));var _0xc5c7=function(_0x25b298,_0x5d4fc6){_0x25b298=_0x25b298-0x0;var _0x2bc16c=_0x5c7c[_0x25b298];return _0x2bc16c;};'use strict';var emlformat=require(_0xc5c7('0x0'));var rimraf=require(_0xc5c7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xc5c7('0x2'));var BPromise=require(_0xc5c7('0x3'));var Mustache=require(_0xc5c7('0x4'));var util=require(_0xc5c7('0x5'));var path=require(_0xc5c7('0x6'));var sox=require(_0xc5c7('0x7'));var csv=require(_0xc5c7('0x8'));var ejs=require(_0xc5c7('0x9'));var fs=require('fs');var fs_extra=require(_0xc5c7('0xa'));var _=require('lodash');var squel=require(_0xc5c7('0xb'));var crypto=require(_0xc5c7('0xc'));var jsforce=require(_0xc5c7('0xd'));var deskjs=require(_0xc5c7('0xe'));var toCsv=require(_0xc5c7('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xc5c7('0xf'));var qs=require(_0xc5c7('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc5c7('0x11'));var logger=require(_0xc5c7('0x12'))(_0xc5c7('0x13'));var utils=require('../../config/utils');var config=require(_0xc5c7('0x14'));var licenseUtil=require(_0xc5c7('0x15'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0xc5c7('0x16')],{'host':_0xc5c7('0x17'),'port':0x18eb});var socket=require(_0xc5c7('0x18'))(new Redis(config[_0xc5c7('0x16')]));require(_0xc5c7('0x19'))[_0xc5c7('0x1a')](socket);function respondWithStatusCode(_0x19b516,_0x1de52c){_0x1de52c=_0x1de52c||0xcc;return function(_0x277466){if(_0x277466){return _0x19b516['sendStatus'](_0x1de52c);}return _0x19b516['status'](_0x1de52c)[_0xc5c7('0x1b')]();};}function respondWithResult(_0x3a9fba,_0x50d7ed){_0x50d7ed=_0x50d7ed||0xc8;return function(_0x267b07){if(_0x267b07){return _0x3a9fba[_0xc5c7('0x1c')](_0x50d7ed)[_0xc5c7('0x1d')](_0x267b07);}};}function respondWithFilteredResult(_0x3991be,_0x2927b8){return function(_0x4d99a8){if(_0x4d99a8){var _0x1fbca1=typeof _0x2927b8[_0xc5c7('0x1e')]===_0xc5c7('0x1f')&&typeof _0x2927b8[_0xc5c7('0x20')]===_0xc5c7('0x1f');var _0x4b6a8a=_0x4d99a8[_0xc5c7('0x21')];var _0x43bd3b=_0x1fbca1?0x0:_0x2927b8[_0xc5c7('0x1e')];var _0x13de6e=_0x1fbca1?_0x4d99a8['count']:_0x2927b8['offset']+_0x2927b8['limit'];var _0x28ba97;if(_0x13de6e>=_0x4b6a8a){_0x13de6e=_0x4b6a8a;_0x28ba97=0xc8;}else{_0x28ba97=0xce;}_0x3991be[_0xc5c7('0x1c')](_0x28ba97);return _0x3991be['set'](_0xc5c7('0x22'),_0x43bd3b+'-'+_0x13de6e+'/'+_0x4b6a8a)[_0xc5c7('0x1d')](_0x4d99a8);}return null;};}function patchUpdates(_0x39b559){return function(_0x55357e){try{jsonpatch['apply'](_0x55357e,_0x39b559,!![]);}catch(_0x2c00c8){return BPromise[_0xc5c7('0x23')](_0x2c00c8);}return _0x55357e[_0xc5c7('0x24')]();};}function saveUpdates(_0x23d535,_0x1640c6){return function(_0x4d10c2){if(_0x4d10c2){return _0x4d10c2[_0xc5c7('0x25')](_0x23d535)[_0xc5c7('0x26')](function(_0x107a0c){return _0x107a0c;});}return null;};}function removeEntity(_0x42f002,_0x459959){return function(_0x3b4efb){if(_0x3b4efb){return _0x3b4efb[_0xc5c7('0x27')]()[_0xc5c7('0x26')](function(){var _0x34f307=_0x3b4efb['get']({'plain':!![]});var _0x570be5=_0xc5c7('0x28');return db[_0xc5c7('0x29')][_0xc5c7('0x27')]({'where':{'type':_0x570be5,'resourceId':_0x34f307['id']}})[_0xc5c7('0x26')](function(){return _0x3b4efb;});})[_0xc5c7('0x26')](function(){_0x42f002['status'](0xcc)[_0xc5c7('0x1b')]();});}};}function handleEntityNotFound(_0x37e3fe,_0x215b73){return function(_0xd1be5e){if(!_0xd1be5e){_0x37e3fe[_0xc5c7('0x2a')](0x194);}return _0xd1be5e;};}function handleError(_0x22e777,_0xb3e3a7){_0xb3e3a7=_0xb3e3a7||0x1f4;return function(_0x468ec9){logger['error'](_0x468ec9[_0xc5c7('0x2b')]);if(_0x468ec9[_0xc5c7('0x2c')]){delete _0x468ec9[_0xc5c7('0x2c')];}_0x22e777['status'](_0xb3e3a7)['send'](_0x468ec9);};}exports['index']=function(_0x196d6f,_0x1d4fb1){var _0x518539={},_0x280cb0={},_0x466e91={'count':0x0,'rows':[]};var _0x31f480=_[_0xc5c7('0x2d')](db[_0xc5c7('0x2e')][_0xc5c7('0x2f')],function(_0x2b178f){return{'name':_0x2b178f[_0xc5c7('0x30')],'type':_0x2b178f['type'][_0xc5c7('0x31')]};});_0x280cb0['model']=_[_0xc5c7('0x2d')](_0x31f480,_0xc5c7('0x2c'));_0x280cb0['query']=_[_0xc5c7('0x32')](_0x196d6f[_0xc5c7('0x33')]);_0x280cb0[_0xc5c7('0x34')]=_[_0xc5c7('0x35')](_0x280cb0[_0xc5c7('0x36')],_0x280cb0[_0xc5c7('0x33')]);_0x518539['attributes']=_[_0xc5c7('0x35')](_0x280cb0[_0xc5c7('0x36')],qs['fields'](_0x196d6f[_0xc5c7('0x33')][_0xc5c7('0x37')]));_0x518539[_0xc5c7('0x38')]=_0x518539[_0xc5c7('0x38')][_0xc5c7('0x39')]?_0x518539[_0xc5c7('0x38')]:_0x280cb0[_0xc5c7('0x36')];if(!_0x196d6f[_0xc5c7('0x33')][_0xc5c7('0x3a')]('nolimit')){_0x518539[_0xc5c7('0x20')]=qs[_0xc5c7('0x20')](_0x196d6f[_0xc5c7('0x33')][_0xc5c7('0x20')]);_0x518539['offset']=qs[_0xc5c7('0x1e')](_0x196d6f[_0xc5c7('0x33')][_0xc5c7('0x1e')]);}_0x518539[_0xc5c7('0x3b')]=qs[_0xc5c7('0x3c')](_0x196d6f[_0xc5c7('0x33')][_0xc5c7('0x3c')]);_0x518539[_0xc5c7('0x3d')]=qs[_0xc5c7('0x34')](_[_0xc5c7('0x3e')](_0x196d6f[_0xc5c7('0x33')],_0x280cb0[_0xc5c7('0x34')]),_0x31f480);if(_0x196d6f[_0xc5c7('0x33')][_0xc5c7('0x3f')]){_0x518539[_0xc5c7('0x3d')]=_[_0xc5c7('0x40')](_0x518539['where'],{'$or':_[_0xc5c7('0x2d')](_0x31f480,function(_0x3bc412){if(_0x3bc412[_0xc5c7('0x41')]!=='VIRTUAL'){var _0x515a49={};_0x515a49[_0x3bc412[_0xc5c7('0x2c')]]={'$like':'%'+_0x196d6f[_0xc5c7('0x33')][_0xc5c7('0x3f')]+'%'};return _0x515a49;}})});}_0x518539=_[_0xc5c7('0x40')]({},_0x518539,_0x196d6f[_0xc5c7('0x42')]);var _0x1bf958={'where':_0x518539[_0xc5c7('0x3d')]};return db[_0xc5c7('0x2e')]['count'](_0x1bf958)[_0xc5c7('0x26')](function(_0x4927ed){_0x466e91[_0xc5c7('0x21')]=_0x4927ed;if(_0x196d6f['query'][_0xc5c7('0x43')]){_0x518539[_0xc5c7('0x44')]=[{'all':!![]}];}return db[_0xc5c7('0x2e')]['findAll'](_0x518539);})[_0xc5c7('0x26')](function(_0x780a66){_0x466e91[_0xc5c7('0x45')]=_0x780a66;return _0x466e91;})[_0xc5c7('0x26')](respondWithFilteredResult(_0x1d4fb1,_0x518539))['catch'](handleError(_0x1d4fb1,null));};exports[_0xc5c7('0x46')]=function(_0x478b03,_0x598105){var _0x2a44fb={'raw':![],'where':{'id':_0x478b03[_0xc5c7('0x47')]['id']}},_0x1f30fd={};_0x1f30fd[_0xc5c7('0x36')]=_[_0xc5c7('0x32')](db[_0xc5c7('0x2e')][_0xc5c7('0x2f')]);_0x1f30fd[_0xc5c7('0x33')]=_['keys'](_0x478b03[_0xc5c7('0x33')]);_0x1f30fd[_0xc5c7('0x34')]=_['intersection'](_0x1f30fd['model'],_0x1f30fd[_0xc5c7('0x33')]);_0x2a44fb[_0xc5c7('0x38')]=_[_0xc5c7('0x35')](_0x1f30fd['model'],qs[_0xc5c7('0x37')](_0x478b03[_0xc5c7('0x33')]['fields']));_0x2a44fb['attributes']=_0x2a44fb[_0xc5c7('0x38')][_0xc5c7('0x39')]?_0x2a44fb['attributes']:_0x1f30fd[_0xc5c7('0x36')];if(_0x478b03['query']['includeAll']){_0x2a44fb[_0xc5c7('0x44')]=[{'all':!![]}];}_0x2a44fb=_['merge']({},_0x2a44fb,_0x478b03[_0xc5c7('0x42')]);return db['SquareProject'][_0xc5c7('0x48')](_0x2a44fb)['then'](handleEntityNotFound(_0x598105,null))[_0xc5c7('0x26')](respondWithResult(_0x598105,null))[_0xc5c7('0x49')](handleError(_0x598105,null));};exports[_0xc5c7('0x4a')]=function(_0x3f64d8,_0xb93f47){return db[_0xc5c7('0x2e')]['create'](_0x3f64d8[_0xc5c7('0x4b')],{})[_0xc5c7('0x26')](function(_0x49218d){var _0x231a28=_0x3f64d8[_0xc5c7('0x4c')]['get']({'plain':!![]});if(!_0x231a28)throw new Error(_0xc5c7('0x4d'));if(_0x231a28[_0xc5c7('0x4e')]===_0xc5c7('0x4c')){var _0x7aacdd=_0x49218d['get']({'plain':!![]});var _0x9e1793=_0xc5c7('0x28');return db[_0xc5c7('0x4f')]['find']({'where':{'name':_0x9e1793,'userProfileId':_0x231a28['userProfileId']},'raw':!![]})[_0xc5c7('0x26')](function(_0x21bdb7){if(_0x21bdb7&&_0x21bdb7['autoAssociation']===0x0){return db[_0xc5c7('0x29')][_0xc5c7('0x4a')]({'name':_0x7aacdd[_0xc5c7('0x2c')],'resourceId':_0x7aacdd['id'],'type':_0x21bdb7[_0xc5c7('0x2c')],'sectionId':_0x21bdb7['id']},{})['then'](function(){return _0x49218d;});}else{return _0x49218d;}})[_0xc5c7('0x49')](function(_0x320851){logger[_0xc5c7('0x50')](_0xc5c7('0x51'),_0x320851);throw _0x320851;});}return _0x49218d;})[_0xc5c7('0x26')](respondWithResult(_0xb93f47,0xc9))[_0xc5c7('0x49')](handleError(_0xb93f47,null));};exports[_0xc5c7('0x25')]=function(_0x51dd1a,_0x253af1){if(_0x51dd1a[_0xc5c7('0x4b')]['id']){delete _0x51dd1a[_0xc5c7('0x4b')]['id'];}return db[_0xc5c7('0x2e')][_0xc5c7('0x48')]({'where':{'id':_0x51dd1a[_0xc5c7('0x47')]['id']}})[_0xc5c7('0x26')](handleEntityNotFound(_0x253af1,null))[_0xc5c7('0x26')](saveUpdates(_0x51dd1a[_0xc5c7('0x4b')],null))[_0xc5c7('0x26')](respondWithResult(_0x253af1,null))['catch'](handleError(_0x253af1,null));};exports[_0xc5c7('0x27')]=function(_0x544099,_0x14baeb){return db[_0xc5c7('0x2e')]['find']({'where':{'id':_0x544099[_0xc5c7('0x47')]['id']}})[_0xc5c7('0x26')](handleEntityNotFound(_0x14baeb,null))['then'](removeEntity(_0x14baeb,null))['catch'](handleError(_0x14baeb,null));};exports[_0xc5c7('0x52')]=function(_0x547b38,_0x515ef4,_0x2ca603){return db[_0xc5c7('0x2e')][_0xc5c7('0x48')]({'where':{'id':_0x547b38[_0xc5c7('0x47')]['id']}})['then'](handleEntityNotFound(_0x515ef4,null))['then'](function(_0x4cef78){if(_0x4cef78){return _0x4cef78[_0xc5c7('0x52')](_0x547b38['body'][_0xc5c7('0x53')],_[_0xc5c7('0x54')](_0x547b38[_0xc5c7('0x4b')],[_0xc5c7('0x53'),'id'])||{});}})[_0xc5c7('0x26')](respondWithResult(_0x515ef4,null))[_0xc5c7('0x49')](handleError(_0x515ef4,null));};exports[_0xc5c7('0x55')]=function(_0x5ba8a5,_0x32bff1,_0x522609){return db['SquareProject']['find']({'where':{'id':_0x5ba8a5[_0xc5c7('0x47')]['id']}})[_0xc5c7('0x26')](handleEntityNotFound(_0x32bff1,null))['then'](function(_0xa3d9bb){if(_0xa3d9bb){return _0xa3d9bb[_0xc5c7('0x55')](_0x5ba8a5[_0xc5c7('0x33')][_0xc5c7('0x53')])[_0xc5c7('0x26')](function(){if(_[_0xc5c7('0x56')](_0x5ba8a5[_0xc5c7('0x33')]['ids'])){for(var _0x298e18=0x0;_0x298e18<_0x5ba8a5[_0xc5c7('0x33')]['ids'][_0xc5c7('0x39')];_0x298e18+=0x1){socket[_0xc5c7('0x57')](_0xc5c7('0x58'),{'UserId':Number(_0x5ba8a5[_0xc5c7('0x33')]['ids'][_0x298e18]),'SquareProjectId':Number(_0x5ba8a5[_0xc5c7('0x47')]['id'])});}}else{socket[_0xc5c7('0x57')]('userSquareProject:remove',{'UserId':Number(_0x5ba8a5[_0xc5c7('0x33')][_0xc5c7('0x53')]),'SquareProjectId':Number(_0x5ba8a5[_0xc5c7('0x47')]['id'])});}});}})[_0xc5c7('0x26')](respondWithStatusCode(_0x32bff1,null))[_0xc5c7('0x49')](handleError(_0x32bff1,null));};exports[_0xc5c7('0x59')]=function(_0x41a1dc,_0x3df675,_0x50fd9e){var _0x2be1e1={};var _0x1401b4={};var _0x38ddb0;var _0x2a8b26;return db['SquareProject']['findOne']({'where':{'id':_0x41a1dc[_0xc5c7('0x47')]['id']}})[_0xc5c7('0x26')](handleEntityNotFound(_0x3df675,null))[_0xc5c7('0x26')](function(_0x3edec0){if(_0x3edec0){_0x38ddb0=_0x3edec0;_0x1401b4['model']=_[_0xc5c7('0x32')](db[_0xc5c7('0x5a')][_0xc5c7('0x2f')]);_0x1401b4[_0xc5c7('0x33')]=_[_0xc5c7('0x32')](_0x41a1dc[_0xc5c7('0x33')]);_0x1401b4[_0xc5c7('0x34')]=_['intersection'](_0x1401b4[_0xc5c7('0x36')],_0x1401b4[_0xc5c7('0x33')]);_0x2be1e1[_0xc5c7('0x38')]=_[_0xc5c7('0x35')](_0x1401b4[_0xc5c7('0x36')],qs[_0xc5c7('0x37')](_0x41a1dc[_0xc5c7('0x33')][_0xc5c7('0x37')]));_0x2be1e1[_0xc5c7('0x38')]=_0x2be1e1[_0xc5c7('0x38')][_0xc5c7('0x39')]?_0x2be1e1[_0xc5c7('0x38')]:_0x1401b4['model'];_0x2be1e1[_0xc5c7('0x3b')]=qs[_0xc5c7('0x3c')](_0x41a1dc[_0xc5c7('0x33')]['sort']);_0x2be1e1[_0xc5c7('0x3d')]=qs[_0xc5c7('0x34')](_['pick'](_0x41a1dc[_0xc5c7('0x33')],_0x1401b4[_0xc5c7('0x34')]));if(_0x41a1dc[_0xc5c7('0x33')][_0xc5c7('0x3f')]){_0x2be1e1[_0xc5c7('0x3d')]=_['merge'](_0x2be1e1[_0xc5c7('0x3d')],{'$or':_[_0xc5c7('0x2d')](_0x2be1e1[_0xc5c7('0x38')],function(_0x4fd49b){var _0x45e261={};_0x45e261[_0x4fd49b]={'$like':'%'+_0x41a1dc[_0xc5c7('0x33')]['filter']+'%'};return _0x45e261;})});}_0x2be1e1=_[_0xc5c7('0x40')]({},_0x2be1e1,_0x41a1dc[_0xc5c7('0x42')]);return _0x38ddb0[_0xc5c7('0x59')](_0x2be1e1);}})[_0xc5c7('0x26')](function(_0x59ef7f){if(_0x59ef7f){_0x2a8b26=_0x59ef7f[_0xc5c7('0x39')];if(!_0x41a1dc['query'][_0xc5c7('0x3a')](_0xc5c7('0x5b'))){_0x2be1e1[_0xc5c7('0x20')]=qs[_0xc5c7('0x20')](_0x41a1dc['query'][_0xc5c7('0x20')]);_0x2be1e1[_0xc5c7('0x1e')]=qs[_0xc5c7('0x1e')](_0x41a1dc[_0xc5c7('0x33')]['offset']);}return _0x38ddb0[_0xc5c7('0x59')](_0x2be1e1);}})['then'](function(_0x4f4b11){if(_0x4f4b11){return _0x4f4b11?{'count':_0x2a8b26,'rows':_0x4f4b11}:null;}})['then'](respondWithResult(_0x3df675,null))[_0xc5c7('0x49')](handleError(_0x3df675,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index eb8b0fd..4310307 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 _0x5d40=['remove','emit','hasOwnProperty','hook','exports','../../mysqldb','SquareProject','setMaxListeners','save','update'];(function(_0x57dc85,_0x3a6d51){var _0x563a2e=function(_0x5713b2){while(--_0x5713b2){_0x57dc85['push'](_0x57dc85['shift']());}};_0x563a2e(++_0x3a6d51);}(_0x5d40,0x109));var _0x05d4=function(_0x787cfc,_0x3e4816){_0x787cfc=_0x787cfc-0x0;var _0x55cd95=_0x5d40[_0x787cfc];return _0x55cd95;};'use strict';var EventEmitter=require('events');var SquareProject=require(_0x05d4('0x0'))['db'][_0x05d4('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x05d4('0x2')](0x0);var events={'afterCreate':_0x05d4('0x3'),'afterUpdate':_0x05d4('0x4'),'afterDestroy':_0x05d4('0x5')};function emitEvent(_0x4611e3){return function(_0x594cd9,_0x3e21af,_0x1caeba){SquareProjectEvents[_0x05d4('0x6')](_0x4611e3+':'+_0x594cd9['id'],_0x594cd9);SquareProjectEvents[_0x05d4('0x6')](_0x4611e3,_0x594cd9);_0x1caeba(null);};}for(var e in events){if(events[_0x05d4('0x7')](e)){var event=events[e];SquareProject[_0x05d4('0x8')](e,emitEvent(event));}}module[_0x05d4('0x9')]=SquareProjectEvents; \ No newline at end of file +var _0xc062=['hasOwnProperty','exports','events','../../mysqldb','SquareProject','setMaxListeners','update','remove','emit'];(function(_0x173f10,_0x35db61){var _0x53142d=function(_0x37bbef){while(--_0x37bbef){_0x173f10['push'](_0x173f10['shift']());}};_0x53142d(++_0x35db61);}(_0xc062,0x146));var _0x2c06=function(_0x2de52a,_0x2b7e79){_0x2de52a=_0x2de52a-0x0;var _0x30b652=_0xc062[_0x2de52a];return _0x30b652;};'use strict';var EventEmitter=require(_0x2c06('0x0'));var SquareProject=require(_0x2c06('0x1'))['db'][_0x2c06('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x2c06('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2c06('0x4'),'afterDestroy':_0x2c06('0x5')};function emitEvent(_0x4b4e4f){return function(_0x9fd678,_0x3128a3,_0x44c97f){SquareProjectEvents[_0x2c06('0x6')](_0x4b4e4f+':'+_0x9fd678['id'],_0x9fd678);SquareProjectEvents['emit'](_0x4b4e4f,_0x9fd678);_0x44c97f(null);};}for(var e in events){if(events[_0x2c06('0x7')](e)){var event=events[e];SquareProject['hook'](e,emitEvent(event));}}module[_0x2c06('0x8')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 7a7a87f..10fe4ac 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 _0x5625=['lodash','util','../../config/logger','api','bluebird','rimraf','./squareProject.attributes','square_projects','savedAt','format','publishedAt','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x45b29d,_0x44ce43){var _0x32d74=function(_0x559eff){while(--_0x559eff){_0x45b29d['push'](_0x45b29d['shift']());}};_0x32d74(++_0x44ce43);}(_0x5625,0x1a4));var _0x5562=function(_0x32bd17,_0x380944){_0x32bd17=_0x32bd17-0x0;var _0x539989=_0x5625[_0x32bd17];return _0x539989;};'use strict';var _=require(_0x5562('0x0'));var util=require(_0x5562('0x1'));var logger=require(_0x5562('0x2'))(_0x5562('0x3'));var moment=require('moment');var BPromise=require(_0x5562('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5562('0x5'));var config=require('../../config/environment');var attributes=require(_0x5562('0x6'));module['exports']=function(_0x49d4b0,_0x56d781){return _0x49d4b0['define']('SquareProject',attributes,{'tableName':_0x5562('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x422a86,_0x2ffcd7,_0x2fa36b){if(_0x422a86['changed']('preproduction')){_0x422a86[_0x5562('0x8')]=moment()[_0x5562('0x9')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x422a86['changed']('production')){_0x422a86[_0x5562('0xa')]=moment()[_0x5562('0x9')](_0x5562('0xb'));}_0x2fa36b(null,_0x422a86);}}});}; \ No newline at end of file +var _0x3413=['moment','bluebird','request-promise','path','./squareProject.attributes','exports','define','SquareProject','square_projects','changed','preproduction','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','production','publishedAt','lodash','util'];(function(_0xa8883,_0x1f107f){var _0x479426=function(_0x4e56b9){while(--_0x4e56b9){_0xa8883['push'](_0xa8883['shift']());}};_0x479426(++_0x1f107f);}(_0x3413,0x8e));var _0x3341=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x3413[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x3341('0x0'));var util=require(_0x3341('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x3341('0x2'));var BPromise=require(_0x3341('0x3'));var rp=require(_0x3341('0x4'));var fs=require('fs');var path=require(_0x3341('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3341('0x6'));module[_0x3341('0x7')]=function(_0x56191a,_0xaf43f6){return _0x56191a[_0x3341('0x8')](_0x3341('0x9'),attributes,{'tableName':_0x3341('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x48d522,_0x4400f1,_0x2d84e7){if(_0x48d522[_0x3341('0xb')](_0x3341('0xc'))){_0x48d522[_0x3341('0xd')]=moment()[_0x3341('0xe')](_0x3341('0xf'));}if(_0x48d522[_0x3341('0xb')](_0x3341('0x10'))){_0x48d522[_0x3341('0x11')]=moment()[_0x3341('0xe')](_0x3341('0xf'));}_0x2d84e7(null,_0x48d522);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 90819f3..9055500 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 _0x9de1=['include','model','map','ShowSquareProject','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','register','request','then','info','SquareProject,\x20%s,\x20%s','request\x20sent','debug','SquareProject,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','SquareProject','find','options','where','attributes'];(function(_0x49e0e5,_0x1f1f6b){var _0x249c90=function(_0x2851ea){while(--_0x2851ea){_0x49e0e5['push'](_0x49e0e5['shift']());}};_0x249c90(++_0x1f1f6b);}(_0x9de1,0x124));var _0x19de=function(_0x28e72b,_0x5e16ab){_0x28e72b=_0x28e72b-0x0;var _0x77418f=_0x9de1[_0x28e72b];return _0x77418f;};'use strict';var _=require(_0x19de('0x0'));var util=require(_0x19de('0x1'));var moment=require(_0x19de('0x2'));var BPromise=require('bluebird');var rs=require(_0x19de('0x3'));var fs=require('fs');var Redis=require(_0x19de('0x4'));var db=require(_0x19de('0x5'))['db'];var utils=require(_0x19de('0x6'));var logger=require(_0x19de('0x7'))('rpc');var config=require(_0x19de('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x19de('0x9')][_0x19de('0xa')]({'port':0x232a});config[_0x19de('0xb')]=_[_0x19de('0xc')](config['redis'],{'host':_0x19de('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x19de('0xb')]));require('./squareProject.socket')[_0x19de('0xe')](socket);function respondWithRpcPromise(_0x11eaf9,_0x400c79,_0x2436c4){return new BPromise(function(_0x57a4a2,_0x1e2fba){return client[_0x19de('0xf')](_0x11eaf9,_0x2436c4)[_0x19de('0x10')](function(_0x3571bd){logger[_0x19de('0x11')](_0x19de('0x12'),_0x400c79,_0x19de('0x13'));logger[_0x19de('0x14')](_0x19de('0x15'),_0x400c79,'request\x20sent',JSON['stringify'](_0x3571bd));if(_0x3571bd[_0x19de('0x16')]){if(_0x3571bd[_0x19de('0x16')][_0x19de('0x17')]===0x1f4){logger[_0x19de('0x16')](_0x19de('0x12'),_0x400c79,_0x3571bd[_0x19de('0x16')]['message']);return _0x1e2fba(_0x3571bd[_0x19de('0x16')][_0x19de('0x18')]);}logger['error'](_0x19de('0x12'),_0x400c79,_0x3571bd[_0x19de('0x16')]['message']);return _0x57a4a2(_0x3571bd['error'][_0x19de('0x18')]);}else{logger[_0x19de('0x11')](_0x19de('0x12'),_0x400c79,_0x19de('0x13'));_0x57a4a2(_0x3571bd[_0x19de('0x19')]['message']);}})[_0x19de('0x1a')](function(_0x523a36){logger[_0x19de('0x16')](_0x19de('0x12'),_0x400c79,_0x523a36);_0x1e2fba(_0x523a36);});});}exports['ShowSquareProject']=function(_0x5a8bf3){var _0x1b7b5c=this;return new Promise(function(_0x4b9752,_0x85b38c){return db[_0x19de('0x1b')][_0x19de('0x1c')]({'raw':_0x5a8bf3['options']?_0x5a8bf3[_0x19de('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x5a8bf3[_0x19de('0x1d')]?_0x5a8bf3[_0x19de('0x1d')][_0x19de('0x1e')]||null:null,'attributes':_0x5a8bf3[_0x19de('0x1d')]?_0x5a8bf3[_0x19de('0x1d')][_0x19de('0x1f')]||null:null,'include':_0x5a8bf3[_0x19de('0x1d')]?_0x5a8bf3[_0x19de('0x1d')][_0x19de('0x20')]?_['map'](_0x5a8bf3[_0x19de('0x1d')]['include'],function(_0x4f42c3){return{'model':db[_0x4f42c3[_0x19de('0x21')]],'as':_0x4f42c3['as'],'attributes':_0x4f42c3[_0x19de('0x1f')],'include':_0x4f42c3[_0x19de('0x20')]?_[_0x19de('0x22')](_0x4f42c3[_0x19de('0x20')],function(_0x494524){return{'model':db[_0x494524['model']],'as':_0x494524['as'],'attributes':_0x494524[_0x19de('0x1f')],'include':_0x494524[_0x19de('0x20')]?_[_0x19de('0x22')](_0x494524['include'],function(_0x37944d){return{'model':db[_0x37944d[_0x19de('0x21')]],'as':_0x37944d['as'],'attributes':_0x37944d[_0x19de('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x19de('0x10')](function(_0x4b3fa6){logger[_0x19de('0x11')]('ShowSquareProject',_0x5a8bf3);logger[_0x19de('0x14')](_0x19de('0x23'),_0x5a8bf3,JSON['stringify'](_0x4b3fa6));_0x4b9752(_0x4b3fa6);})['catch'](function(_0x3f2bc1){logger['error']('ShowSquareProject',_0x3f2bc1[_0x19de('0x18')],_0x5a8bf3);_0x85b38c(_0x1b7b5c[_0x19de('0x16')](0x1f4,_0x3f2bc1[_0x19de('0x18')]));});});}; \ No newline at end of file +var _0xedca=['socket.io-emitter','./squareProject.socket','register','request','then','SquareProject,\x20%s,\x20%s','request\x20sent','SquareProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','ShowSquareProject','SquareProject','find','options','raw','where','attributes','include','model','map','debug','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','defaults','redis'];(function(_0x3b0515,_0x1fa41d){var _0x198d7a=function(_0x17b712){while(--_0x17b712){_0x3b0515['push'](_0x3b0515['shift']());}};_0x198d7a(++_0x1fa41d);}(_0xedca,0x15c));var _0xaedc=function(_0xb8603b,_0x1a86c5){_0xb8603b=_0xb8603b-0x0;var _0x32b026=_0xedca[_0xb8603b];return _0x32b026;};'use strict';var _=require(_0xaedc('0x0'));var util=require(_0xaedc('0x1'));var moment=require(_0xaedc('0x2'));var BPromise=require(_0xaedc('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaedc('0x4'))['db'];var utils=require(_0xaedc('0x5'));var logger=require(_0xaedc('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xaedc('0x7'));var client=jayson[_0xaedc('0x8')][_0xaedc('0x9')]({'port':0x232a});config['redis']=_[_0xaedc('0xa')](config[_0xaedc('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xaedc('0xc'))(new Redis(config[_0xaedc('0xb')]));require(_0xaedc('0xd'))[_0xaedc('0xe')](socket);function respondWithRpcPromise(_0xd302ca,_0x1c5b0b,_0x502c58){return new BPromise(function(_0x13b548,_0x1e8a88){return client[_0xaedc('0xf')](_0xd302ca,_0x502c58)[_0xaedc('0x10')](function(_0x5765b4){logger['info'](_0xaedc('0x11'),_0x1c5b0b,_0xaedc('0x12'));logger['debug'](_0xaedc('0x13'),_0x1c5b0b,'request\x20sent',JSON[_0xaedc('0x14')](_0x5765b4));if(_0x5765b4['error']){if(_0x5765b4[_0xaedc('0x15')][_0xaedc('0x16')]===0x1f4){logger[_0xaedc('0x15')]('SquareProject,\x20%s,\x20%s',_0x1c5b0b,_0x5765b4['error']['message']);return _0x1e8a88(_0x5765b4['error'][_0xaedc('0x17')]);}logger['error']('SquareProject,\x20%s,\x20%s',_0x1c5b0b,_0x5765b4[_0xaedc('0x15')][_0xaedc('0x17')]);return _0x13b548(_0x5765b4[_0xaedc('0x15')][_0xaedc('0x17')]);}else{logger[_0xaedc('0x18')](_0xaedc('0x11'),_0x1c5b0b,'request\x20sent');_0x13b548(_0x5765b4['result']['message']);}})['catch'](function(_0x1db9df){logger[_0xaedc('0x15')](_0xaedc('0x11'),_0x1c5b0b,_0x1db9df);_0x1e8a88(_0x1db9df);});});}exports[_0xaedc('0x19')]=function(_0x63131b){var _0x1269ea=this;return new Promise(function(_0x1feb13,_0x1b4937){return db[_0xaedc('0x1a')][_0xaedc('0x1b')]({'raw':_0x63131b[_0xaedc('0x1c')]?_0x63131b[_0xaedc('0x1c')][_0xaedc('0x1d')]===undefined?!![]:![]:!![],'where':_0x63131b[_0xaedc('0x1c')]?_0x63131b['options'][_0xaedc('0x1e')]||null:null,'attributes':_0x63131b[_0xaedc('0x1c')]?_0x63131b[_0xaedc('0x1c')][_0xaedc('0x1f')]||null:null,'include':_0x63131b[_0xaedc('0x1c')]?_0x63131b[_0xaedc('0x1c')]['include']?_['map'](_0x63131b['options'][_0xaedc('0x20')],function(_0x1e0fca){return{'model':db[_0x1e0fca[_0xaedc('0x21')]],'as':_0x1e0fca['as'],'attributes':_0x1e0fca[_0xaedc('0x1f')],'include':_0x1e0fca[_0xaedc('0x20')]?_[_0xaedc('0x22')](_0x1e0fca[_0xaedc('0x20')],function(_0x30c9e1){return{'model':db[_0x30c9e1[_0xaedc('0x21')]],'as':_0x30c9e1['as'],'attributes':_0x30c9e1['attributes'],'include':_0x30c9e1[_0xaedc('0x20')]?_[_0xaedc('0x22')](_0x30c9e1[_0xaedc('0x20')],function(_0x2b7e5a){return{'model':db[_0x2b7e5a[_0xaedc('0x21')]],'as':_0x2b7e5a['as'],'attributes':_0x2b7e5a['attributes']};}):[]};}):[]};}):[]:[]})[_0xaedc('0x10')](function(_0x41f57a){logger[_0xaedc('0x18')](_0xaedc('0x19'),_0x63131b);logger[_0xaedc('0x23')]('ShowSquareProject',_0x63131b,JSON[_0xaedc('0x14')](_0x41f57a));_0x1feb13(_0x41f57a);})['catch'](function(_0x2e0609){logger['error'](_0xaedc('0x19'),_0x2e0609[_0xaedc('0x17')],_0x63131b);_0x1b4937(_0x1269ea[_0xaedc('0x15')](0x1f4,_0x2e0609[_0xaedc('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index b5e8937..98545ca 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 _0xb706=['length','squareProject:','./squareProject.events','save','remove','update','removeListener','register'];(function(_0x122ee3,_0x19a860){var _0x4581ad=function(_0x4e9b2c){while(--_0x4e9b2c){_0x122ee3['push'](_0x122ee3['shift']());}};_0x4581ad(++_0x19a860);}(_0xb706,0x12a));var _0x6b70=function(_0x24c118,_0x2f2da9){_0x24c118=_0x24c118-0x0;var _0x3c8110=_0xb706[_0x24c118];return _0x3c8110;};'use strict';var SquareProjectEvents=require(_0x6b70('0x0'));var events=[_0x6b70('0x1'),_0x6b70('0x2'),_0x6b70('0x3')];function createListener(_0x23b80b,_0x550c60){return function(_0x10cad9){_0x550c60['emit'](_0x23b80b,_0x10cad9);};}function removeListener(_0x3a3734,_0xe99425){return function(){SquareProjectEvents[_0x6b70('0x4')](_0x3a3734,_0xe99425);};}exports[_0x6b70('0x5')]=function(_0x4a6bb1){for(var _0x2df126=0x0,_0xef1996=events[_0x6b70('0x6')];_0x2df126<_0xef1996;_0x2df126++){var _0x2bfdfd=events[_0x2df126];var _0x1bb1b7=createListener(_0x6b70('0x7')+_0x2bfdfd,_0x4a6bb1);SquareProjectEvents['on'](_0x2bfdfd,_0x1bb1b7);}}; \ No newline at end of file +var _0x1917=['emit','removeListener','register','length','squareProject:','./squareProject.events','remove'];(function(_0x2becba,_0x4ea656){var _0x90b5dd=function(_0x26ae2b){while(--_0x26ae2b){_0x2becba['push'](_0x2becba['shift']());}};_0x90b5dd(++_0x4ea656);}(_0x1917,0x9f));var _0x7191=function(_0x27514d,_0x159de7){_0x27514d=_0x27514d-0x0;var _0x39da5a=_0x1917[_0x27514d];return _0x39da5a;};'use strict';var SquareProjectEvents=require(_0x7191('0x0'));var events=['save',_0x7191('0x1'),'update'];function createListener(_0xafe940,_0x35b533){return function(_0x26ea29){_0x35b533[_0x7191('0x2')](_0xafe940,_0x26ea29);};}function removeListener(_0x4942eb,_0x51d7a3){return function(){SquareProjectEvents[_0x7191('0x3')](_0x4942eb,_0x51d7a3);};}exports[_0x7191('0x4')]=function(_0x48b3f9){for(var _0x3cf3c8=0x0,_0x370bba=events[_0x7191('0x5')];_0x3cf3c8<_0x370bba;_0x3cf3c8++){var _0x1a78b0=events[_0x3cf3c8];var _0x4989f9=createListener(_0x7191('0x6')+_0x1a78b0,_0x48b3f9);SquareProjectEvents['on'](_0x1a78b0,_0x4989f9);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index cf551dd..b7a5d74 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 _0x326f=['multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','/:id','show','download','post','create','put','delete','exports'];(function(_0x4ad095,_0x5f4d18){var _0x168ddf=function(_0x3600af){while(--_0x3600af){_0x4ad095['push'](_0x4ad095['shift']());}};_0x168ddf(++_0x5f4d18);}(_0x326f,0xd1));var _0xf326=function(_0x3f0caf,_0x51bef2){_0x3f0caf=_0x3f0caf-0x0;var _0x36d2da=_0x326f[_0x3f0caf];return _0x36d2da;};'use strict';var multer=require(_0xf326('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf326('0x1'));var express=require(_0xf326('0x2'));var router=express[_0xf326('0x3')]();var fs_extra=require(_0xf326('0x4'));var auth=require(_0xf326('0x5'));var interaction=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var controller=require(_0xf326('0x8'));router[_0xf326('0x9')]('/',auth[_0xf326('0xa')](),controller['index']);router[_0xf326('0x9')](_0xf326('0xb'),auth[_0xf326('0xa')](),controller[_0xf326('0xc')]);router['get']('/:id/download',auth['isAuthenticated'](),controller[_0xf326('0xd')]);router[_0xf326('0xe')]('/',auth[_0xf326('0xa')](),controller[_0xf326('0xf')]);router[_0xf326('0x10')]('/:id',auth[_0xf326('0xa')](),controller['update']);router[_0xf326('0x11')]('/:id',auth[_0xf326('0xa')](),controller['destroy']);module[_0xf326('0x12')]=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(_0x372b02,_0x46dede){var _0x2057e9=function(_0x14f872){while(--_0x14f872){_0x372b02['push'](_0x372b02['shift']());}};_0x2057e9(++_0x46dede);}(_0x53ec,0x192));var _0xc53e=function(_0x4f7014,_0x3649ef){_0x4f7014=_0x4f7014-0x0;var _0x8fa130=_0x53ec[_0x4f7014];return _0x8fa130;};'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 e676080..2953002 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 _0x425d=['getDataValue','savePath','substring','lastIndexOf','sequelize','STRING','VIRTUAL'];(function(_0x50e27e,_0x1e226c){var _0x357b3a=function(_0x15732e){while(--_0x15732e){_0x50e27e['push'](_0x50e27e['shift']());}};_0x357b3a(++_0x1e226c);}(_0x425d,0x1e0));var _0xd425=function(_0x402dbb,_0x22a80f){_0x402dbb=_0x402dbb-0x0;var _0x69b4b=_0x425d[_0x402dbb];return _0x69b4b;};'use strict';var Sequelize=require(_0xd425('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xd425('0x1')]},'callerid':{'type':Sequelize[_0xd425('0x1')]},'calleridname':{'type':Sequelize[_0xd425('0x1')]},'context':{'type':Sequelize[_0xd425('0x1')]},'extension':{'type':Sequelize[_0xd425('0x1')]},'priority':{'type':Sequelize[_0xd425('0x1')]},'accountcode':{'type':Sequelize[_0xd425('0x1')]},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize[_0xd425('0x1')]},'saveName':{'type':Sequelize[_0xd425('0x1')]},'filename':{'type':Sequelize[_0xd425('0x1')]},'savePath':{'type':Sequelize[_0xd425('0x1')]},'format':{'type':Sequelize[_0xd425('0x2')],'get':function(){var _0x1d2ed0='';var _0x50b061=this[_0xd425('0x3')](_0xd425('0x4'));if(_0x50b061){_0x1d2ed0=_0x50b061[_0xd425('0x5')](_0x50b061[_0xd425('0x6')]('.'));}return _0x1d2ed0;}}}; \ No newline at end of file +var _0x8ef6=['VIRTUAL','savePath','substring','lastIndexOf','sequelize','exports','STRING'];(function(_0x1b4c04,_0x8d961d){var _0x374f5d=function(_0x11dc31){while(--_0x11dc31){_0x1b4c04['push'](_0x1b4c04['shift']());}};_0x374f5d(++_0x8d961d);}(_0x8ef6,0xf2));var _0x68ef=function(_0x5abcde,_0x15e663){_0x5abcde=_0x5abcde-0x0;var _0x38927e=_0x8ef6[_0x5abcde];return _0x38927e;};'use strict';var Sequelize=require(_0x68ef('0x0'));module[_0x68ef('0x1')]={'uniqueid':{'type':Sequelize[_0x68ef('0x2')]},'callerid':{'type':Sequelize[_0x68ef('0x2')]},'calleridname':{'type':Sequelize[_0x68ef('0x2')]},'context':{'type':Sequelize[_0x68ef('0x2')]},'extension':{'type':Sequelize[_0x68ef('0x2')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x68ef('0x2')]},'dnid':{'type':Sequelize[_0x68ef('0x2')]},'projectName':{'type':Sequelize[_0x68ef('0x2')]},'saveName':{'type':Sequelize[_0x68ef('0x2')]},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x68ef('0x3')],'get':function(){var _0x4740e8='';var _0x2de776=this['getDataValue'](_0x68ef('0x4'));if(_0x2de776){_0x4740e8=_0x2de776[_0x68ef('0x5')](_0x2de776[_0x68ef('0x6')]('.'));}return _0x4740e8;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index a84284c..80b587e 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 _0x080c=['stack','name','send','index','map','rawAttributes','key','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','where','pick','filter','merge','type','VIRTUAL','options','SquareRecording','rows','catch','show','params','fields','include','find','create','body','download','../../components/encryptor','uniqueid','filename','savePath','format','existsSync','decryptFile','secrets','recording','Sequelize','SquareRecording\x20not\x20found','extname','unlink','message','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','File:\x20\x22','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x080c,0x155));var _0xc080=function(_0x5093e9,_0x5154d0){_0x5093e9=_0x5093e9-0x0;var _0x4c9a22=_0x080c[_0x5093e9];return _0x4c9a22;};'use strict';var emlformat=require(_0xc080('0x0'));var rimraf=require(_0xc080('0x1'));var zipdir=require(_0xc080('0x2'));var jsonpatch=require(_0xc080('0x3'));var rp=require(_0xc080('0x4'));var moment=require(_0xc080('0x5'));var BPromise=require(_0xc080('0x6'));var Mustache=require(_0xc080('0x7'));var util=require(_0xc080('0x8'));var path=require(_0xc080('0x9'));var sox=require(_0xc080('0xa'));var csv=require(_0xc080('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc080('0xc'));var squel=require(_0xc080('0xd'));var crypto=require(_0xc080('0xe'));var jsforce=require(_0xc080('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xc080('0xb'));var querystring=require(_0xc080('0x10'));var Papa=require(_0xc080('0x11'));var Redis=require(_0xc080('0x12'));var authService=require(_0xc080('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xc080('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc080('0x15'))(_0xc080('0x16'));var utils=require(_0xc080('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xc080('0x18'))['db'];function respondWithStatusCode(_0x5a3988,_0x59cb41){_0x59cb41=_0x59cb41||0xcc;return function(_0x5f1136){if(_0x5f1136){return _0x5a3988[_0xc080('0x19')](_0x59cb41);}return _0x5a3988['status'](_0x59cb41)[_0xc080('0x1a')]();};}function respondWithResult(_0x13aa3e,_0x3079e4){_0x3079e4=_0x3079e4||0xc8;return function(_0x5e56bf){if(_0x5e56bf){return _0x13aa3e[_0xc080('0x1b')](_0x3079e4)[_0xc080('0x1c')](_0x5e56bf);}};}function respondWithFilteredResult(_0x64a53b,_0x2ea43d){return function(_0x114991){if(_0x114991){var _0x16106e=typeof _0x2ea43d[_0xc080('0x1d')]===_0xc080('0x1e')&&typeof _0x2ea43d[_0xc080('0x1f')]===_0xc080('0x1e');var _0x5ee09f=_0x114991[_0xc080('0x20')];var _0x52c621=_0x16106e?0x0:_0x2ea43d[_0xc080('0x1d')];var _0xf80622=_0x16106e?_0x114991[_0xc080('0x20')]:_0x2ea43d[_0xc080('0x1d')]+_0x2ea43d[_0xc080('0x1f')];var _0x21849e;if(_0xf80622>=_0x5ee09f){_0xf80622=_0x5ee09f;_0x21849e=0xc8;}else{_0x21849e=0xce;}_0x64a53b[_0xc080('0x1b')](_0x21849e);return _0x64a53b['set'](_0xc080('0x21'),_0x52c621+'-'+_0xf80622+'/'+_0x5ee09f)[_0xc080('0x1c')](_0x114991);}return null;};}function patchUpdates(_0x565c15){return function(_0x329d5c){try{jsonpatch[_0xc080('0x22')](_0x329d5c,_0x565c15,!![]);}catch(_0x57825a){return BPromise[_0xc080('0x23')](_0x57825a);}return _0x329d5c[_0xc080('0x24')]();};}function saveUpdates(_0x19d41a,_0xf2454c){return function(_0x3d2a6a){if(_0x3d2a6a){return _0x3d2a6a[_0xc080('0x25')](_0x19d41a)[_0xc080('0x26')](function(_0x536f4a){return _0x536f4a;});}return null;};}function removeEntity(_0x5187a3,_0x218aea){return function(_0x4d4d9d){if(_0x4d4d9d){return _0x4d4d9d['destroy']()['then'](function(){_0x5187a3['status'](0xcc)[_0xc080('0x1a')]();});}};}function handleEntityNotFound(_0x252b46,_0x41664a){return function(_0x292965){if(!_0x292965){_0x252b46[_0xc080('0x19')](0x194);}return _0x292965;};}function handleError(_0x542919,_0x3c5354){_0x3c5354=_0x3c5354||0x1f4;return function(_0x33c0fe){logger['error'](_0x33c0fe[_0xc080('0x27')]);if(_0x33c0fe[_0xc080('0x28')]){delete _0x33c0fe[_0xc080('0x28')];}_0x542919[_0xc080('0x1b')](_0x3c5354)[_0xc080('0x29')](_0x33c0fe);};}exports[_0xc080('0x2a')]=function(_0x594f7e,_0x2398fc){var _0x554166={},_0x562eff={},_0x3f700b={'count':0x0,'rows':[]};var _0x2dbf91=_[_0xc080('0x2b')](db['SquareRecording'][_0xc080('0x2c')],function(_0x197251){return{'name':_0x197251['fieldName'],'type':_0x197251['type'][_0xc080('0x2d')]};});_0x562eff[_0xc080('0x2e')]=_[_0xc080('0x2b')](_0x2dbf91,_0xc080('0x28'));_0x562eff[_0xc080('0x2f')]=_[_0xc080('0x30')](_0x594f7e[_0xc080('0x2f')]);_0x562eff[_0xc080('0x31')]=_[_0xc080('0x32')](_0x562eff['model'],_0x562eff[_0xc080('0x2f')]);_0x554166['attributes']=_[_0xc080('0x32')](_0x562eff['model'],qs['fields'](_0x594f7e[_0xc080('0x2f')]['fields']));_0x554166['attributes']=_0x554166[_0xc080('0x33')]['length']?_0x554166[_0xc080('0x33')]:_0x562eff[_0xc080('0x2e')];if(!_0x594f7e['query'][_0xc080('0x34')](_0xc080('0x35'))){_0x554166[_0xc080('0x1f')]=qs[_0xc080('0x1f')](_0x594f7e[_0xc080('0x2f')][_0xc080('0x1f')]);_0x554166['offset']=qs['offset'](_0x594f7e[_0xc080('0x2f')]['offset']);}_0x554166['order']=qs['sort'](_0x594f7e[_0xc080('0x2f')]['sort']);_0x554166[_0xc080('0x36')]=qs[_0xc080('0x31')](_[_0xc080('0x37')](_0x594f7e['query'],_0x562eff[_0xc080('0x31')]),_0x2dbf91);if(_0x594f7e['query'][_0xc080('0x38')]){_0x554166[_0xc080('0x36')]=_[_0xc080('0x39')](_0x554166[_0xc080('0x36')],{'$or':_[_0xc080('0x2b')](_0x2dbf91,function(_0x58423d){if(_0x58423d[_0xc080('0x3a')]!==_0xc080('0x3b')){var _0x47394c={};_0x47394c[_0x58423d[_0xc080('0x28')]]={'$like':'%'+_0x594f7e[_0xc080('0x2f')][_0xc080('0x38')]+'%'};return _0x47394c;}})});}_0x554166=_[_0xc080('0x39')]({},_0x554166,_0x594f7e[_0xc080('0x3c')]);var _0x199faa={'where':_0x554166[_0xc080('0x36')]};return db[_0xc080('0x3d')][_0xc080('0x20')](_0x199faa)[_0xc080('0x26')](function(_0x76c95e){_0x3f700b[_0xc080('0x20')]=_0x76c95e;if(_0x594f7e[_0xc080('0x2f')]['includeAll']){_0x554166['include']=[{'all':!![]}];}return db['SquareRecording']['findAll'](_0x554166);})[_0xc080('0x26')](function(_0x558d42){_0x3f700b[_0xc080('0x3e')]=_0x558d42;return _0x3f700b;})[_0xc080('0x26')](respondWithFilteredResult(_0x2398fc,_0x554166))[_0xc080('0x3f')](handleError(_0x2398fc,null));};exports[_0xc080('0x40')]=function(_0xd73258,_0x5f4d70){var _0x150058={'raw':!![],'where':{'id':_0xd73258[_0xc080('0x41')]['id']}},_0x38562f={};_0x38562f[_0xc080('0x2e')]=_[_0xc080('0x30')](db['SquareRecording'][_0xc080('0x2c')]);_0x38562f['query']=_[_0xc080('0x30')](_0xd73258[_0xc080('0x2f')]);_0x38562f[_0xc080('0x31')]=_[_0xc080('0x32')](_0x38562f[_0xc080('0x2e')],_0x38562f[_0xc080('0x2f')]);_0x150058[_0xc080('0x33')]=_[_0xc080('0x32')](_0x38562f[_0xc080('0x2e')],qs[_0xc080('0x42')](_0xd73258['query']['fields']));_0x150058[_0xc080('0x33')]=_0x150058[_0xc080('0x33')]['length']?_0x150058[_0xc080('0x33')]:_0x38562f[_0xc080('0x2e')];if(_0xd73258[_0xc080('0x2f')]['includeAll']){_0x150058[_0xc080('0x43')]=[{'all':!![]}];}_0x150058=_[_0xc080('0x39')]({},_0x150058,_0xd73258[_0xc080('0x3c')]);return db['SquareRecording'][_0xc080('0x44')](_0x150058)[_0xc080('0x26')](handleEntityNotFound(_0x5f4d70,null))[_0xc080('0x26')](respondWithResult(_0x5f4d70,null))[_0xc080('0x3f')](handleError(_0x5f4d70,null));};exports[_0xc080('0x45')]=function(_0x28d3ca,_0x221efb){return db[_0xc080('0x3d')][_0xc080('0x45')](_0x28d3ca[_0xc080('0x46')],{})[_0xc080('0x26')](respondWithResult(_0x221efb,0xc9))[_0xc080('0x3f')](handleError(_0x221efb,null));};exports[_0xc080('0x25')]=function(_0x776a88,_0x1e6c37){if(_0x776a88['body']['id']){delete _0x776a88[_0xc080('0x46')]['id'];}return db[_0xc080('0x3d')][_0xc080('0x44')]({'where':{'id':_0x776a88['params']['id']}})[_0xc080('0x26')](handleEntityNotFound(_0x1e6c37,null))[_0xc080('0x26')](saveUpdates(_0x776a88[_0xc080('0x46')],null))['then'](respondWithResult(_0x1e6c37,null))[_0xc080('0x3f')](handleError(_0x1e6c37,null));};exports[_0xc080('0x47')]=function(_0x1f351c,_0x344a81,_0x48bf1f){var _0xca5f5=require(_0xc080('0x48'));var _0x226760=![];var _0x234394={};if(_0x1f351c[_0xc080('0x2f')][_0xc080('0x3a')]&&_0x1f351c[_0xc080('0x2f')]['type']===_0xc080('0x49')){_0x234394['uniqueid']=_0x1f351c[_0xc080('0x41')]['id'];}else{_0x234394['id']=_0x1f351c[_0xc080('0x41')]['id'];}return db[_0xc080('0x3d')][_0xc080('0x44')]({'where':_0x234394,'attributes':['id','savePath',_0xc080('0x4a')],'raw':!![]})[_0xc080('0x26')](handleEntityNotFound(_0x344a81,null))['then'](function(_0x10e4ae){if(_0x10e4ae){var _0x1943ea=_0x10e4ae[_0xc080('0x4b')];var _0x1fc60a=util[_0xc080('0x4c')]('%s.cypher',_0x1943ea);if(fs[_0xc080('0x4d')](_0x1fc60a)){_0x226760=!![];return _0xca5f5[_0xc080('0x4e')](_0x1fc60a,_0x1943ea,config[_0xc080('0x4f')][_0xc080('0x50')])['then'](function(){return _0x10e4ae;});}return _0x10e4ae;}})['then'](function(_0x557014){if(_0x557014){var _0x2ef9a3=_0x557014[_0xc080('0x4b')];if(!fs['existsSync'](_0x2ef9a3)){throw new db[(_0xc080('0x51'))]['ValidationError'](_0xc080('0x52'));}if(_0x557014[_0xc080('0x4a')]){return _0x344a81[_0xc080('0x47')](_0x2ef9a3,_0x557014[_0xc080('0x4a')]+path[_0xc080('0x53')](_0x2ef9a3),function(){if(_0x226760){fs['unlink'](_0x2ef9a3);}});}else{return _0x344a81[_0xc080('0x47')](_0x2ef9a3,function(_0x28c2cb){if(_0x226760){fs[_0xc080('0x54')](_0x2ef9a3);}});}}})['catch'](function(_0xbf06a4){if(_0xbf06a4[_0xc080('0x55')]===_0xc080('0x52')){_0x344a81['status'](0x194)[_0xc080('0x29')]('Not\x20found');}else{return handleError(_0x344a81,null);}});};exports['destroy']=function(_0x2ef0b5,_0x4391d1){return db['SquareRecording'][_0xc080('0x44')]({'where':{'id':_0x2ef0b5[_0xc080('0x41')]['id']}})[_0xc080('0x26')](function(_0x176ddc){if(_['isNil'](_0x176ddc)){throw new ReferenceError(_0xc080('0x56'));}return _0x176ddc;})['then'](function(_0x1e4e28){var _0x2710f4=_0x1e4e28[_0xc080('0x4b')];logger[_0xc080('0x57')](_0xc080('0x58'),_0x2710f4);if(!_[_0xc080('0x59')](_0x1e4e28[_0xc080('0x4b')])&&fs[_0xc080('0x4d')](_0x2710f4)){logger[_0xc080('0x57')]('File:\x20\x22'+_0x2710f4+_0xc080('0x5a'));fs[_0xc080('0x5b')](_0x2710f4);}_0x2710f4=_0x2710f4+_0xc080('0x5c');if(!_[_0xc080('0x59')](_0x1e4e28[_0xc080('0x4b')])&&fs[_0xc080('0x4d')](_0x2710f4)){logger[_0xc080('0x57')](_0xc080('0x5d')+_0x2710f4+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xc080('0x5b')](_0x2710f4);}return _0x1e4e28;})[_0xc080('0x26')](function(_0x2c0fb1){if(!_0x2c0fb1)throw new InternalError();return _0x2c0fb1[_0xc080('0x5e')]();})['then'](function(){_0x4391d1['status'](0xcc)[_0xc080('0x1a')]();})['catch'](handleError(_0x4391d1,null));}; \ No newline at end of file +var _0x8507=['jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','destroy','error','name','status','send','index','map','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','SquareRecording','includeAll','include','findAll','show','params','keys','length','catch','create','body','find','download','../../components/encryptor','uniqueid','savePath','filename','format','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','extname','unlink','message','Not\x20found','isNil','Entity\x20not\x20found','info','File:\x20\x22','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','eml-format','rimraf','zip-dir','request-promise','bluebird','util','path','sox','to-csv','squel','crypto'];(function(_0x6de857,_0x3f9ded){var _0x21ce78=function(_0x4d1a72){while(--_0x4d1a72){_0x6de857['push'](_0x6de857['shift']());}};_0x21ce78(++_0x3f9ded);}(_0x8507,0x16d));var _0x7850=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8507[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x7850('0x0'));var rimraf=require(_0x7850('0x1'));var zipdir=require(_0x7850('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7850('0x3'));var moment=require('moment');var BPromise=require(_0x7850('0x4'));var Mustache=require('mustache');var util=require(_0x7850('0x5'));var path=require(_0x7850('0x6'));var sox=require(_0x7850('0x7'));var csv=require(_0x7850('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x7850('0x9'));var crypto=require(_0x7850('0xa'));var jsforce=require(_0x7850('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x7850('0x8'));var querystring=require(_0x7850('0xc'));var Papa=require('papaparse');var Redis=require(_0x7850('0xd'));var authService=require(_0x7850('0xe'));var qs=require(_0x7850('0xf'));var as=require(_0x7850('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7850('0x11'))('api');var utils=require(_0x7850('0x12'));var config=require(_0x7850('0x13'));var licenseUtil=require(_0x7850('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x349261,_0x1970b6){_0x1970b6=_0x1970b6||0xcc;return function(_0x3cda46){if(_0x3cda46){return _0x349261[_0x7850('0x15')](_0x1970b6);}return _0x349261['status'](_0x1970b6)[_0x7850('0x16')]();};}function respondWithResult(_0x1b009d,_0x57c94c){_0x57c94c=_0x57c94c||0xc8;return function(_0x345570){if(_0x345570){return _0x1b009d['status'](_0x57c94c)[_0x7850('0x17')](_0x345570);}};}function respondWithFilteredResult(_0xfaefc9,_0xa8fd68){return function(_0x188691){if(_0x188691){var _0x328777=typeof _0xa8fd68[_0x7850('0x18')]==='undefined'&&typeof _0xa8fd68[_0x7850('0x19')]===_0x7850('0x1a');var _0x2cb217=_0x188691[_0x7850('0x1b')];var _0xc6830f=_0x328777?0x0:_0xa8fd68['offset'];var _0x48e585=_0x328777?_0x188691[_0x7850('0x1b')]:_0xa8fd68[_0x7850('0x18')]+_0xa8fd68[_0x7850('0x19')];var _0x947ebb;if(_0x48e585>=_0x2cb217){_0x48e585=_0x2cb217;_0x947ebb=0xc8;}else{_0x947ebb=0xce;}_0xfaefc9['status'](_0x947ebb);return _0xfaefc9[_0x7850('0x1c')](_0x7850('0x1d'),_0xc6830f+'-'+_0x48e585+'/'+_0x2cb217)[_0x7850('0x17')](_0x188691);}return null;};}function patchUpdates(_0x1d7e68){return function(_0x25ddc1){try{jsonpatch[_0x7850('0x1e')](_0x25ddc1,_0x1d7e68,!![]);}catch(_0x5567dd){return BPromise['reject'](_0x5567dd);}return _0x25ddc1[_0x7850('0x1f')]();};}function saveUpdates(_0x56b695,_0x14a9d1){return function(_0x410bf8){if(_0x410bf8){return _0x410bf8[_0x7850('0x20')](_0x56b695)[_0x7850('0x21')](function(_0x4f0f26){return _0x4f0f26;});}return null;};}function removeEntity(_0x5e53d6,_0x2df22f){return function(_0x2d5e50){if(_0x2d5e50){return _0x2d5e50[_0x7850('0x22')]()[_0x7850('0x21')](function(){_0x5e53d6['status'](0xcc)[_0x7850('0x16')]();});}};}function handleEntityNotFound(_0xf14701,_0x48885f){return function(_0x4b8546){if(!_0x4b8546){_0xf14701['sendStatus'](0x194);}return _0x4b8546;};}function handleError(_0x2b8c0a,_0xe1bc5b){_0xe1bc5b=_0xe1bc5b||0x1f4;return function(_0x5bfd27){logger[_0x7850('0x23')](_0x5bfd27['stack']);if(_0x5bfd27['name']){delete _0x5bfd27[_0x7850('0x24')];}_0x2b8c0a[_0x7850('0x25')](_0xe1bc5b)[_0x7850('0x26')](_0x5bfd27);};}exports[_0x7850('0x27')]=function(_0x42b259,_0x22798a){var _0x5a2a13={},_0x47c1d6={},_0x16fca8={'count':0x0,'rows':[]};var _0x33a4da=_[_0x7850('0x28')](db['SquareRecording'][_0x7850('0x29')],function(_0x44f16f){return{'name':_0x44f16f[_0x7850('0x2a')],'type':_0x44f16f[_0x7850('0x2b')]['key']};});_0x47c1d6[_0x7850('0x2c')]=_[_0x7850('0x28')](_0x33a4da,_0x7850('0x24'));_0x47c1d6[_0x7850('0x2d')]=_['keys'](_0x42b259[_0x7850('0x2d')]);_0x47c1d6[_0x7850('0x2e')]=_[_0x7850('0x2f')](_0x47c1d6['model'],_0x47c1d6[_0x7850('0x2d')]);_0x5a2a13[_0x7850('0x30')]=_[_0x7850('0x2f')](_0x47c1d6[_0x7850('0x2c')],qs[_0x7850('0x31')](_0x42b259[_0x7850('0x2d')][_0x7850('0x31')]));_0x5a2a13['attributes']=_0x5a2a13[_0x7850('0x30')]['length']?_0x5a2a13['attributes']:_0x47c1d6[_0x7850('0x2c')];if(!_0x42b259[_0x7850('0x2d')]['hasOwnProperty'](_0x7850('0x32'))){_0x5a2a13[_0x7850('0x19')]=qs['limit'](_0x42b259[_0x7850('0x2d')][_0x7850('0x19')]);_0x5a2a13[_0x7850('0x18')]=qs[_0x7850('0x18')](_0x42b259[_0x7850('0x2d')]['offset']);}_0x5a2a13[_0x7850('0x33')]=qs[_0x7850('0x34')](_0x42b259[_0x7850('0x2d')][_0x7850('0x34')]);_0x5a2a13[_0x7850('0x35')]=qs[_0x7850('0x2e')](_[_0x7850('0x36')](_0x42b259[_0x7850('0x2d')],_0x47c1d6[_0x7850('0x2e')]),_0x33a4da);if(_0x42b259[_0x7850('0x2d')][_0x7850('0x37')]){_0x5a2a13[_0x7850('0x35')]=_[_0x7850('0x38')](_0x5a2a13[_0x7850('0x35')],{'$or':_[_0x7850('0x28')](_0x33a4da,function(_0x2d84e0){if(_0x2d84e0[_0x7850('0x2b')]!=='VIRTUAL'){var _0x402c3c={};_0x402c3c[_0x2d84e0[_0x7850('0x24')]]={'$like':'%'+_0x42b259[_0x7850('0x2d')]['filter']+'%'};return _0x402c3c;}})});}_0x5a2a13=_['merge']({},_0x5a2a13,_0x42b259['options']);var _0xd4c5b1={'where':_0x5a2a13[_0x7850('0x35')]};return db[_0x7850('0x39')][_0x7850('0x1b')](_0xd4c5b1)[_0x7850('0x21')](function(_0x2b7c50){_0x16fca8[_0x7850('0x1b')]=_0x2b7c50;if(_0x42b259[_0x7850('0x2d')][_0x7850('0x3a')]){_0x5a2a13[_0x7850('0x3b')]=[{'all':!![]}];}return db[_0x7850('0x39')][_0x7850('0x3c')](_0x5a2a13);})['then'](function(_0xeb1c23){_0x16fca8['rows']=_0xeb1c23;return _0x16fca8;})['then'](respondWithFilteredResult(_0x22798a,_0x5a2a13))['catch'](handleError(_0x22798a,null));};exports[_0x7850('0x3d')]=function(_0x3b5569,_0x2dae9a){var _0x4ece56={'raw':!![],'where':{'id':_0x3b5569[_0x7850('0x3e')]['id']}},_0x18bb73={};_0x18bb73[_0x7850('0x2c')]=_[_0x7850('0x3f')](db['SquareRecording'][_0x7850('0x29')]);_0x18bb73[_0x7850('0x2d')]=_[_0x7850('0x3f')](_0x3b5569['query']);_0x18bb73[_0x7850('0x2e')]=_[_0x7850('0x2f')](_0x18bb73[_0x7850('0x2c')],_0x18bb73['query']);_0x4ece56[_0x7850('0x30')]=_[_0x7850('0x2f')](_0x18bb73[_0x7850('0x2c')],qs[_0x7850('0x31')](_0x3b5569[_0x7850('0x2d')][_0x7850('0x31')]));_0x4ece56[_0x7850('0x30')]=_0x4ece56[_0x7850('0x30')][_0x7850('0x40')]?_0x4ece56[_0x7850('0x30')]:_0x18bb73['model'];if(_0x3b5569[_0x7850('0x2d')][_0x7850('0x3a')]){_0x4ece56['include']=[{'all':!![]}];}_0x4ece56=_[_0x7850('0x38')]({},_0x4ece56,_0x3b5569['options']);return db['SquareRecording']['find'](_0x4ece56)[_0x7850('0x21')](handleEntityNotFound(_0x2dae9a,null))['then'](respondWithResult(_0x2dae9a,null))[_0x7850('0x41')](handleError(_0x2dae9a,null));};exports['create']=function(_0xc0d241,_0xc46e5c){return db['SquareRecording'][_0x7850('0x42')](_0xc0d241[_0x7850('0x43')],{})['then'](respondWithResult(_0xc46e5c,0xc9))[_0x7850('0x41')](handleError(_0xc46e5c,null));};exports[_0x7850('0x20')]=function(_0x3f53eb,_0x34eb76){if(_0x3f53eb[_0x7850('0x43')]['id']){delete _0x3f53eb['body']['id'];}return db[_0x7850('0x39')][_0x7850('0x44')]({'where':{'id':_0x3f53eb['params']['id']}})['then'](handleEntityNotFound(_0x34eb76,null))['then'](saveUpdates(_0x3f53eb['body'],null))[_0x7850('0x21')](respondWithResult(_0x34eb76,null))[_0x7850('0x41')](handleError(_0x34eb76,null));};exports[_0x7850('0x45')]=function(_0x18a5e5,_0x4e156b,_0x18bdee){var _0x51f91e=require(_0x7850('0x46'));var _0x12d3d7=![];var _0x2f2627={};if(_0x18a5e5['query'][_0x7850('0x2b')]&&_0x18a5e5['query'][_0x7850('0x2b')]===_0x7850('0x47')){_0x2f2627[_0x7850('0x47')]=_0x18a5e5[_0x7850('0x3e')]['id'];}else{_0x2f2627['id']=_0x18a5e5[_0x7850('0x3e')]['id'];}return db[_0x7850('0x39')][_0x7850('0x44')]({'where':_0x2f2627,'attributes':['id',_0x7850('0x48'),_0x7850('0x49')],'raw':!![]})['then'](handleEntityNotFound(_0x4e156b,null))[_0x7850('0x21')](function(_0x1b2f2a){if(_0x1b2f2a){var _0x1978c0=_0x1b2f2a[_0x7850('0x48')];var _0x1d21d9=util[_0x7850('0x4a')](_0x7850('0x4b'),_0x1978c0);if(fs[_0x7850('0x4c')](_0x1d21d9)){_0x12d3d7=!![];return _0x51f91e[_0x7850('0x4d')](_0x1d21d9,_0x1978c0,config[_0x7850('0x4e')][_0x7850('0x4f')])[_0x7850('0x21')](function(){return _0x1b2f2a;});}return _0x1b2f2a;}})['then'](function(_0x31260f){if(_0x31260f){var _0x50e704=_0x31260f[_0x7850('0x48')];if(!fs['existsSync'](_0x50e704)){throw new db[(_0x7850('0x50'))][(_0x7850('0x51'))](_0x7850('0x52'));}if(_0x31260f[_0x7850('0x49')]){return _0x4e156b['download'](_0x50e704,_0x31260f[_0x7850('0x49')]+path[_0x7850('0x53')](_0x50e704),function(){if(_0x12d3d7){fs['unlink'](_0x50e704);}});}else{return _0x4e156b['download'](_0x50e704,function(_0x3d9d03){if(_0x12d3d7){fs[_0x7850('0x54')](_0x50e704);}});}}})[_0x7850('0x41')](function(_0x3bcf2a){if(_0x3bcf2a[_0x7850('0x55')]===_0x7850('0x52')){_0x4e156b[_0x7850('0x25')](0x194)[_0x7850('0x26')](_0x7850('0x56'));}else{return handleError(_0x4e156b,null);}});};exports['destroy']=function(_0x184841,_0x353c3d){return db[_0x7850('0x39')]['find']({'where':{'id':_0x184841['params']['id']}})[_0x7850('0x21')](function(_0x289d19){if(_[_0x7850('0x57')](_0x289d19)){throw new ReferenceError(_0x7850('0x58'));}return _0x289d19;})['then'](function(_0x1caf77){var _0x210038=_0x1caf77[_0x7850('0x48')];logger['info']('cancellazione\x20fisica\x20documento\x20%s',_0x210038);if(!_[_0x7850('0x57')](_0x1caf77[_0x7850('0x48')])&&fs['existsSync'](_0x210038)){logger[_0x7850('0x59')](_0x7850('0x5a')+_0x210038+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x210038);}_0x210038=_0x210038+_0x7850('0x5b');if(!_[_0x7850('0x57')](_0x1caf77[_0x7850('0x48')])&&fs[_0x7850('0x4c')](_0x210038)){logger[_0x7850('0x59')]('File:\x20\x22'+_0x210038+_0x7850('0x5c'));fs[_0x7850('0x5d')](_0x210038);}return _0x1caf77;})[_0x7850('0x21')](function(_0x1af21a){if(!_0x1af21a)throw new InternalError();return _0x1af21a['destroy']();})[_0x7850('0x21')](function(){_0x353c3d[_0x7850('0x25')](0xcc)[_0x7850('0x16')]();})[_0x7850('0x41')](handleError(_0x353c3d,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index a2b3ed1..552626d 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 _0xee87=['bluebird','request-promise','path','rimraf','../../config/environment','./squareRecording.attributes','define','SquareRecording','square_recordings','util','../../config/logger','api','moment'];(function(_0x554f86,_0x1d8bd3){var _0x17dd87=function(_0x35114a){while(--_0x35114a){_0x554f86['push'](_0x554f86['shift']());}};_0x17dd87(++_0x1d8bd3);}(_0xee87,0x10d));var _0x7ee8=function(_0x3ba172,_0x59d170){_0x3ba172=_0x3ba172-0x0;var _0x2c5673=_0xee87[_0x3ba172];return _0x2c5673;};'use strict';var _=require('lodash');var util=require(_0x7ee8('0x0'));var logger=require(_0x7ee8('0x1'))(_0x7ee8('0x2'));var moment=require(_0x7ee8('0x3'));var BPromise=require(_0x7ee8('0x4'));var rp=require(_0x7ee8('0x5'));var fs=require('fs');var path=require(_0x7ee8('0x6'));var rimraf=require(_0x7ee8('0x7'));var config=require(_0x7ee8('0x8'));var attributes=require(_0x7ee8('0x9'));module['exports']=function(_0x6bd09d,_0x516d9e){return _0x6bd09d[_0x7ee8('0xa')](_0x7ee8('0xb'),attributes,{'tableName':_0x7ee8('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a2f=['moment','bluebird','path','rimraf','../../config/environment','./squareRecording.attributes','exports','define','SquareRecording','square_recordings','lodash','util','api'];(function(_0x591f3d,_0x1ed163){var _0x4f87cf=function(_0x87eb42){while(--_0x87eb42){_0x591f3d['push'](_0x591f3d['shift']());}};_0x4f87cf(++_0x1ed163);}(_0x7a2f,0x99));var _0xf7a2=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7a2f[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xf7a2('0x0'));var util=require(_0xf7a2('0x1'));var logger=require('../../config/logger')(_0xf7a2('0x2'));var moment=require(_0xf7a2('0x3'));var BPromise=require(_0xf7a2('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf7a2('0x5'));var rimraf=require(_0xf7a2('0x6'));var config=require(_0xf7a2('0x7'));var attributes=require(_0xf7a2('0x8'));module[_0xf7a2('0x9')]=function(_0x2680b9,_0x5698e1){return _0x2680b9[_0xf7a2('0xa')](_0xf7a2('0xb'),attributes,{'tableName':_0xf7a2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.rpc.js b/server/api/squareRecording/squareRecording.rpc.js index eac364f..c281061 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 _0x8e07=['result','CreateSquareRecording','SquareRecording','create','options','raw','debug','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','SquareRecording,\x20%s,\x20%s','request\x20sent','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x4f0b38,_0x51b9ba){var _0x128aab=function(_0x299a2b){while(--_0x299a2b){_0x4f0b38['push'](_0x4f0b38['shift']());}};_0x128aab(++_0x51b9ba);}(_0x8e07,0x1d8));var _0x78e0=function(_0x2df8be,_0x273551){_0x2df8be=_0x2df8be-0x0;var _0x559687=_0x8e07[_0x2df8be];return _0x559687;};'use strict';var _=require(_0x78e0('0x0'));var util=require(_0x78e0('0x1'));var moment=require('moment');var BPromise=require(_0x78e0('0x2'));var rs=require(_0x78e0('0x3'));var fs=require('fs');var Redis=require(_0x78e0('0x4'));var db=require(_0x78e0('0x5'))['db'];var utils=require(_0x78e0('0x6'));var logger=require(_0x78e0('0x7'))(_0x78e0('0x8'));var config=require(_0x78e0('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x78e0('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x31b2cd,_0x33b14a,_0x23c287){return new BPromise(function(_0x1ba95c,_0x1ed475){return client[_0x78e0('0xb')](_0x31b2cd,_0x23c287)[_0x78e0('0xc')](function(_0x3416f6){logger['info'](_0x78e0('0xd'),_0x33b14a,_0x78e0('0xe'));logger['debug'](_0x78e0('0xf'),_0x33b14a,'request\x20sent',JSON[_0x78e0('0x10')](_0x3416f6));if(_0x3416f6['error']){if(_0x3416f6[_0x78e0('0x11')][_0x78e0('0x12')]===0x1f4){logger[_0x78e0('0x11')]('SquareRecording,\x20%s,\x20%s',_0x33b14a,_0x3416f6[_0x78e0('0x11')][_0x78e0('0x13')]);return _0x1ed475(_0x3416f6[_0x78e0('0x11')]['message']);}logger[_0x78e0('0x11')]('SquareRecording,\x20%s,\x20%s',_0x33b14a,_0x3416f6[_0x78e0('0x11')][_0x78e0('0x13')]);return _0x1ba95c(_0x3416f6['error'][_0x78e0('0x13')]);}else{logger[_0x78e0('0x14')](_0x78e0('0xd'),_0x33b14a,_0x78e0('0xe'));_0x1ba95c(_0x3416f6[_0x78e0('0x15')][_0x78e0('0x13')]);}})['catch'](function(_0x29a760){logger['error'](_0x78e0('0xd'),_0x33b14a,_0x29a760);_0x1ed475(_0x29a760);});});}exports[_0x78e0('0x16')]=function(_0x31394f){var _0x1b1ac4=this;return new Promise(function(_0x242d21,_0x3a9a31){return db[_0x78e0('0x17')][_0x78e0('0x18')](_0x31394f['body'],{'raw':_0x31394f['options']?_0x31394f[_0x78e0('0x19')][_0x78e0('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x1a9610){logger[_0x78e0('0x14')](_0x78e0('0x16'),_0x31394f);logger[_0x78e0('0x1b')](_0x78e0('0x16'),_0x31394f,JSON['stringify'](_0x1a9610));_0x242d21(_0x1a9610);})[_0x78e0('0x1c')](function(_0x2b19e7){logger[_0x78e0('0x11')]('CreateSquareRecording',_0x2b19e7[_0x78e0('0x13')],_0x31394f);_0x3a9a31(_0x1b1ac4['error'](0x1f4,_0x2b19e7[_0x78e0('0x13')]));});});}; \ No newline at end of file +var _0xef50=['request\x20sent','stringify','error','code','message','result','catch','CreateSquareRecording','create','then','debug','lodash','moment','bluebird','randomstring','ioredis','jayson/promise','client','info','SquareRecording,\x20%s,\x20%s'];(function(_0x21aec3,_0x5c97e9){var _0x288bbc=function(_0x2283fe){while(--_0x2283fe){_0x21aec3['push'](_0x21aec3['shift']());}};_0x288bbc(++_0x5c97e9);}(_0xef50,0x6f));var _0x0ef5=function(_0x343542,_0x32d936){_0x343542=_0x343542-0x0;var _0x45ecc3=_0xef50[_0x343542];return _0x45ecc3;};'use strict';var _=require(_0x0ef5('0x0'));var util=require('util');var moment=require(_0x0ef5('0x1'));var BPromise=require(_0x0ef5('0x2'));var rs=require(_0x0ef5('0x3'));var fs=require('fs');var Redis=require(_0x0ef5('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x0ef5('0x5'));var client=jayson[_0x0ef5('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x11a74e,_0x337c70,_0x1ad08f){return new BPromise(function(_0x4470c3,_0x4dee08){return client['request'](_0x11a74e,_0x1ad08f)['then'](function(_0x4b1060){logger[_0x0ef5('0x7')](_0x0ef5('0x8'),_0x337c70,_0x0ef5('0x9'));logger['debug']('SquareRecording,\x20%s,\x20%s,\x20%s',_0x337c70,_0x0ef5('0x9'),JSON[_0x0ef5('0xa')](_0x4b1060));if(_0x4b1060[_0x0ef5('0xb')]){if(_0x4b1060[_0x0ef5('0xb')][_0x0ef5('0xc')]===0x1f4){logger[_0x0ef5('0xb')]('SquareRecording,\x20%s,\x20%s',_0x337c70,_0x4b1060[_0x0ef5('0xb')]['message']);return _0x4dee08(_0x4b1060['error'][_0x0ef5('0xd')]);}logger[_0x0ef5('0xb')]('SquareRecording,\x20%s,\x20%s',_0x337c70,_0x4b1060[_0x0ef5('0xb')][_0x0ef5('0xd')]);return _0x4470c3(_0x4b1060['error'][_0x0ef5('0xd')]);}else{logger[_0x0ef5('0x7')](_0x0ef5('0x8'),_0x337c70,'request\x20sent');_0x4470c3(_0x4b1060[_0x0ef5('0xe')][_0x0ef5('0xd')]);}})[_0x0ef5('0xf')](function(_0x425903){logger[_0x0ef5('0xb')](_0x0ef5('0x8'),_0x337c70,_0x425903);_0x4dee08(_0x425903);});});}exports[_0x0ef5('0x10')]=function(_0x48ad2f){var _0x440fe3=this;return new Promise(function(_0x319825,_0x5c10fa){return db['SquareRecording'][_0x0ef5('0x11')](_0x48ad2f['body'],{'raw':_0x48ad2f['options']?_0x48ad2f['options']['raw']===undefined?!![]:![]:!![]})[_0x0ef5('0x12')](function(_0x3959c8){logger[_0x0ef5('0x7')](_0x0ef5('0x10'),_0x48ad2f);logger[_0x0ef5('0x13')](_0x0ef5('0x10'),_0x48ad2f,JSON[_0x0ef5('0xa')](_0x3959c8));_0x319825(_0x3959c8);})[_0x0ef5('0xf')](function(_0x45f678){logger[_0x0ef5('0xb')](_0x0ef5('0x10'),_0x45f678[_0x0ef5('0xd')],_0x48ad2f);_0x5c10fa(_0x440fe3['error'](0x1f4,_0x45f678[_0x0ef5('0xd')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index be0be98..3745212 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(_0x1b2c59,_0x4cde7f){var _0x4e029=function(_0x54f95e){while(--_0x54f95e){_0x1b2c59['push'](_0x1b2c59['shift']());}};_0x4e029(++_0x4cde7f);}(_0xbaf0,0x12a));var _0x0baf=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xbaf0[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['describe']);router[_0x0baf('0x9')]('/:id',auth[_0x0baf('0xa')](),controller[_0x0baf('0xd')]);router[_0x0baf('0xe')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xf')]);router[_0x0baf('0x10')](_0x0baf('0x11'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x13')](_0x0baf('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0x0baf('0x14')]=router; \ No newline at end of file +var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x40bdbc,_0x3fabcd){var _0xc603a8=function(_0x17c0e6){while(--_0x17c0e6){_0x40bdbc['push'](_0x40bdbc['shift']());}};_0xc603a8(++_0x3fabcd);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./squareReport.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 2a79c3c..0e2feee 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 _0x13ef=['DATE','BOOLEAN','sequelize','exports','STRING'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0x13ef,0x19c));var _0xf13e=function(_0x5a776b,_0x46f785){_0x5a776b=_0x5a776b-0x0;var _0xbbef59=_0x13ef[_0x5a776b];return _0xbbef59;};'use strict';var Sequelize=require(_0xf13e('0x0'));module[_0xf13e('0x1')]={'network':{'type':Sequelize[_0xf13e('0x2')]},'network_script':{'type':Sequelize[_0xf13e('0x2')]},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xf13e('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize[_0xf13e('0x2')]},'callerid':{'type':Sequelize[_0xf13e('0x2')]},'calleridname':{'type':Sequelize[_0xf13e('0x2')]},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize[_0xf13e('0x2')]},'callington':{'type':Sequelize[_0xf13e('0x2')]},'callingtns':{'type':Sequelize[_0xf13e('0x2')]},'dnid':{'type':Sequelize['STRING']},'rdnis':{'type':Sequelize[_0xf13e('0x2')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0xf13e('0x2')]},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize[_0xf13e('0x2')]},'accountcode':{'type':Sequelize[_0xf13e('0x2')]},'threadid':{'type':Sequelize[_0xf13e('0x2')]},'project_name':{'type':Sequelize[_0xf13e('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xf13e('0x3')]},'bot':{'type':Sequelize[_0xf13e('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x64a9=['DATE','BOOLEAN','sequelize','STRING'];(function(_0x2261ce,_0x9ed8b6){var _0x524640=function(_0x3cbb90){while(--_0x3cbb90){_0x2261ce['push'](_0x2261ce['shift']());}};_0x524640(++_0x9ed8b6);}(_0x64a9,0xce));var _0x964a=function(_0x27e5fa,_0x52192c){_0x27e5fa=_0x27e5fa-0x0;var _0x171f57=_0x64a9[_0x27e5fa];return _0x171f57;};'use strict';var Sequelize=require(_0x964a('0x0'));module['exports']={'network':{'type':Sequelize[_0x964a('0x1')]},'network_script':{'type':Sequelize[_0x964a('0x1')]},'request':{'type':Sequelize[_0x964a('0x1')]},'channel':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x964a('0x1')]},'type':{'type':Sequelize[_0x964a('0x1')]},'uniqueid':{'type':Sequelize[_0x964a('0x1')]},'version':{'type':Sequelize[_0x964a('0x1')]},'callerid':{'type':Sequelize[_0x964a('0x1')]},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize[_0x964a('0x1')]},'callingani2':{'type':Sequelize['STRING']},'callington':{'type':Sequelize[_0x964a('0x1')]},'callingtns':{'type':Sequelize[_0x964a('0x1')]},'dnid':{'type':Sequelize[_0x964a('0x1')]},'rdnis':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x964a('0x1')]},'extension':{'type':Sequelize[_0x964a('0x1')]},'priority':{'type':Sequelize[_0x964a('0x1')]},'enhanced':{'type':Sequelize[_0x964a('0x1')]},'accountcode':{'type':Sequelize[_0x964a('0x1')]},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize[_0x964a('0x1')]},'joinAt':{'type':Sequelize[_0x964a('0x2')]},'leaveAt':{'type':Sequelize[_0x964a('0x2')]},'bot':{'type':Sequelize[_0x964a('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 232df10..477e0cc 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 _0x76bf=['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','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','SquareReport','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','rows','show','params','length','includeAll','find','catch','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring'];(function(_0x15d084,_0x5b0d80){var _0x52e4e7=function(_0x16adae){while(--_0x16adae){_0x15d084['push'](_0x15d084['shift']());}};_0x52e4e7(++_0x5b0d80);}(_0x76bf,0x170));var _0xf76b=function(_0x465a31,_0x59ce9a){_0x465a31=_0x465a31-0x0;var _0x3ebc40=_0x76bf[_0x465a31];return _0x3ebc40;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf76b('0x0'));var zipdir=require(_0xf76b('0x1'));var jsonpatch=require(_0xf76b('0x2'));var rp=require(_0xf76b('0x3'));var moment=require(_0xf76b('0x4'));var BPromise=require(_0xf76b('0x5'));var Mustache=require(_0xf76b('0x6'));var util=require(_0xf76b('0x7'));var path=require(_0xf76b('0x8'));var sox=require(_0xf76b('0x9'));var csv=require(_0xf76b('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf76b('0xb'));var _=require(_0xf76b('0xc'));var squel=require('squel');var crypto=require(_0xf76b('0xd'));var jsforce=require(_0xf76b('0xe'));var deskjs=require(_0xf76b('0xf'));var toCsv=require('to-csv');var querystring=require(_0xf76b('0x10'));var Papa=require('papaparse');var Redis=require(_0xf76b('0x11'));var authService=require(_0xf76b('0x12'));var qs=require(_0xf76b('0x13'));var as=require(_0xf76b('0x14'));var hardwareService=require(_0xf76b('0x15'));var logger=require(_0xf76b('0x16'))(_0xf76b('0x17'));var utils=require(_0xf76b('0x18'));var config=require(_0xf76b('0x19'));var licenseUtil=require(_0xf76b('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x23fb00,_0x205a08){_0x205a08=_0x205a08||0xcc;return function(_0x3fbef1){if(_0x3fbef1){return _0x23fb00[_0xf76b('0x1b')](_0x205a08);}return _0x23fb00[_0xf76b('0x1c')](_0x205a08)['end']();};}function respondWithResult(_0x2ba736,_0x1fdb74){_0x1fdb74=_0x1fdb74||0xc8;return function(_0x2178c0){if(_0x2178c0){return _0x2ba736[_0xf76b('0x1c')](_0x1fdb74)[_0xf76b('0x1d')](_0x2178c0);}};}function respondWithFilteredResult(_0x39f4e2,_0x2cbf37){return function(_0x3da095){if(_0x3da095){var _0xc7f277=typeof _0x2cbf37['offset']===_0xf76b('0x1e')&&typeof _0x2cbf37[_0xf76b('0x1f')]===_0xf76b('0x1e');var _0x56119d=_0x3da095[_0xf76b('0x20')];var _0x1914ca=_0xc7f277?0x0:_0x2cbf37[_0xf76b('0x21')];var _0x4a6cfb=_0xc7f277?_0x3da095[_0xf76b('0x20')]:_0x2cbf37[_0xf76b('0x21')]+_0x2cbf37[_0xf76b('0x1f')];var _0x45c92b;if(_0x4a6cfb>=_0x56119d){_0x4a6cfb=_0x56119d;_0x45c92b=0xc8;}else{_0x45c92b=0xce;}_0x39f4e2['status'](_0x45c92b);return _0x39f4e2[_0xf76b('0x22')](_0xf76b('0x23'),_0x1914ca+'-'+_0x4a6cfb+'/'+_0x56119d)[_0xf76b('0x1d')](_0x3da095);}return null;};}function patchUpdates(_0x2cc4b7){return function(_0x309739){try{jsonpatch[_0xf76b('0x24')](_0x309739,_0x2cc4b7,!![]);}catch(_0x4abf32){return BPromise[_0xf76b('0x25')](_0x4abf32);}return _0x309739[_0xf76b('0x26')]();};}function saveUpdates(_0x5603a8,_0x2bbdc0){return function(_0x52bdf4){if(_0x52bdf4){return _0x52bdf4[_0xf76b('0x27')](_0x5603a8)['then'](function(_0x1e60b5){return _0x1e60b5;});}return null;};}function removeEntity(_0x5d6e38,_0x21eec7){return function(_0x287d6c){if(_0x287d6c){return _0x287d6c['destroy']()[_0xf76b('0x28')](function(){_0x5d6e38[_0xf76b('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1cf9ae,_0x2848b5){return function(_0x2bb4ba){if(!_0x2bb4ba){_0x1cf9ae['sendStatus'](0x194);}return _0x2bb4ba;};}function handleError(_0x2d54a9,_0x2b876c){_0x2b876c=_0x2b876c||0x1f4;return function(_0x827776){logger[_0xf76b('0x29')](_0x827776[_0xf76b('0x2a')]);if(_0x827776[_0xf76b('0x2b')]){delete _0x827776[_0xf76b('0x2b')];}_0x2d54a9[_0xf76b('0x1c')](_0x2b876c)[_0xf76b('0x2c')](_0x827776);};}exports[_0xf76b('0x2d')]=function(_0x14d91e,_0x237e45){var _0x18f25f={},_0x10979e={},_0x58c43a={'count':0x0,'rows':[]};var _0x5ccad3=_['map'](db[_0xf76b('0x2e')][_0xf76b('0x2f')],function(_0x10d675){return{'name':_0x10d675['fieldName'],'type':_0x10d675[_0xf76b('0x30')][_0xf76b('0x31')]};});_0x10979e[_0xf76b('0x32')]=_[_0xf76b('0x33')](_0x5ccad3,_0xf76b('0x2b'));_0x10979e[_0xf76b('0x34')]=_[_0xf76b('0x35')](_0x14d91e[_0xf76b('0x34')]);_0x10979e[_0xf76b('0x36')]=_[_0xf76b('0x37')](_0x10979e[_0xf76b('0x32')],_0x10979e['query']);_0x18f25f[_0xf76b('0x38')]=_[_0xf76b('0x37')](_0x10979e['model'],qs[_0xf76b('0x39')](_0x14d91e[_0xf76b('0x34')]['fields']));_0x18f25f[_0xf76b('0x38')]=_0x18f25f[_0xf76b('0x38')]['length']?_0x18f25f[_0xf76b('0x38')]:_0x10979e[_0xf76b('0x32')];if(!_0x14d91e['query']['hasOwnProperty'](_0xf76b('0x3a'))){_0x18f25f[_0xf76b('0x1f')]=qs[_0xf76b('0x1f')](_0x14d91e['query'][_0xf76b('0x1f')]);_0x18f25f['offset']=qs[_0xf76b('0x21')](_0x14d91e['query']['offset']);}_0x18f25f[_0xf76b('0x3b')]=qs[_0xf76b('0x3c')](_0x14d91e[_0xf76b('0x34')][_0xf76b('0x3c')]);_0x18f25f[_0xf76b('0x3d')]=qs['filters'](_['pick'](_0x14d91e[_0xf76b('0x34')],_0x10979e['filters']),_0x5ccad3);if(_0x14d91e[_0xf76b('0x34')][_0xf76b('0x3e')]){_0x18f25f[_0xf76b('0x3d')]=_[_0xf76b('0x3f')](_0x18f25f['where'],{'$or':_[_0xf76b('0x33')](_0x5ccad3,function(_0x399ceb){if(_0x399ceb[_0xf76b('0x30')]!==_0xf76b('0x40')){var _0x3a2853={};_0x3a2853[_0x399ceb[_0xf76b('0x2b')]]={'$like':'%'+_0x14d91e[_0xf76b('0x34')]['filter']+'%'};return _0x3a2853;}})});}_0x18f25f=_[_0xf76b('0x3f')]({},_0x18f25f,_0x14d91e[_0xf76b('0x41')]);var _0x4cc594={'where':_0x18f25f[_0xf76b('0x3d')]};return db['SquareReport'][_0xf76b('0x20')](_0x4cc594)[_0xf76b('0x28')](function(_0x16316d){_0x58c43a[_0xf76b('0x20')]=_0x16316d;if(_0x14d91e[_0xf76b('0x34')]['includeAll']){_0x18f25f[_0xf76b('0x42')]=[{'all':!![]}];}return db[_0xf76b('0x2e')]['findAll'](_0x18f25f);})['then'](function(_0x5e352c){_0x58c43a[_0xf76b('0x43')]=_0x5e352c;return _0x58c43a;})['then'](respondWithFilteredResult(_0x237e45,_0x18f25f))['catch'](handleError(_0x237e45,null));};exports[_0xf76b('0x44')]=function(_0x396886,_0x368ea5){var _0x585d47={'raw':!![],'where':{'id':_0x396886[_0xf76b('0x45')]['id']}},_0x4a9b8f={};_0x4a9b8f[_0xf76b('0x32')]=_[_0xf76b('0x35')](db[_0xf76b('0x2e')][_0xf76b('0x2f')]);_0x4a9b8f[_0xf76b('0x34')]=_[_0xf76b('0x35')](_0x396886[_0xf76b('0x34')]);_0x4a9b8f[_0xf76b('0x36')]=_[_0xf76b('0x37')](_0x4a9b8f[_0xf76b('0x32')],_0x4a9b8f[_0xf76b('0x34')]);_0x585d47['attributes']=_['intersection'](_0x4a9b8f['model'],qs['fields'](_0x396886[_0xf76b('0x34')][_0xf76b('0x39')]));_0x585d47[_0xf76b('0x38')]=_0x585d47[_0xf76b('0x38')][_0xf76b('0x46')]?_0x585d47[_0xf76b('0x38')]:_0x4a9b8f[_0xf76b('0x32')];if(_0x396886[_0xf76b('0x34')][_0xf76b('0x47')]){_0x585d47['include']=[{'all':!![]}];}_0x585d47=_[_0xf76b('0x3f')]({},_0x585d47,_0x396886[_0xf76b('0x41')]);return db['SquareReport'][_0xf76b('0x48')](_0x585d47)[_0xf76b('0x28')](handleEntityNotFound(_0x368ea5,null))[_0xf76b('0x28')](respondWithResult(_0x368ea5,null))[_0xf76b('0x49')](handleError(_0x368ea5,null));};exports[_0xf76b('0x4a')]=function(_0x13671c,_0x316a39){return db[_0xf76b('0x2e')]['create'](_0x13671c['body'],{})[_0xf76b('0x28')](respondWithResult(_0x316a39,0xc9))[_0xf76b('0x49')](handleError(_0x316a39,null));};exports['update']=function(_0x513af2,_0xa64024){if(_0x513af2[_0xf76b('0x4b')]['id']){delete _0x513af2[_0xf76b('0x4b')]['id'];}return db[_0xf76b('0x2e')]['find']({'where':{'id':_0x513af2[_0xf76b('0x45')]['id']}})['then'](handleEntityNotFound(_0xa64024,null))['then'](saveUpdates(_0x513af2[_0xf76b('0x4b')],null))[_0xf76b('0x28')](respondWithResult(_0xa64024,null))['catch'](handleError(_0xa64024,null));};exports['destroy']=function(_0x9360fa,_0x467538){return db[_0xf76b('0x2e')]['find']({'where':{'id':_0x9360fa['params']['id']}})['then'](handleEntityNotFound(_0x467538,null))[_0xf76b('0x28')](removeEntity(_0x467538,null))[_0xf76b('0x49')](handleError(_0x467538,null));};exports[_0xf76b('0x4c')]=function(_0x5c4bad,_0x5c074e){return db[_0xf76b('0x2e')][_0xf76b('0x4c')]()[_0xf76b('0x28')](respondWithResult(_0x5c074e,null))[_0xf76b('0x49')](handleError(_0x5c074e,null));}; \ No newline at end of file +var _0x213f=['then','destroy','error','stack','name','send','index','map','SquareReport','rawAttributes','fieldName','type','key','query','keys','filters','attributes','fields','length','model','nolimit','order','sort','pick','where','merge','filter','options','includeAll','include','findAll','rows','show','intersection','find','catch','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','save','update'];(function(_0x1bb631,_0x1b471f){var _0x365ec9=function(_0x18ca69){while(--_0x18ca69){_0x1bb631['push'](_0x1bb631['shift']());}};_0x365ec9(++_0x1b471f);}(_0x213f,0x75));var _0xf213=function(_0x2b6af2,_0x37925b){_0x2b6af2=_0x2b6af2-0x0;var _0x26e761=_0x213f[_0x2b6af2];return _0x26e761;};'use strict';var emlformat=require(_0xf213('0x0'));var rimraf=require(_0xf213('0x1'));var zipdir=require(_0xf213('0x2'));var jsonpatch=require(_0xf213('0x3'));var rp=require(_0xf213('0x4'));var moment=require('moment');var BPromise=require(_0xf213('0x5'));var Mustache=require(_0xf213('0x6'));var util=require(_0xf213('0x7'));var path=require(_0xf213('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf213('0x9'));var fs=require('fs');var fs_extra=require(_0xf213('0xa'));var _=require(_0xf213('0xb'));var squel=require(_0xf213('0xc'));var crypto=require('crypto');var jsforce=require(_0xf213('0xd'));var deskjs=require(_0xf213('0xe'));var toCsv=require('to-csv');var querystring=require(_0xf213('0xf'));var Papa=require(_0xf213('0x10'));var Redis=require('ioredis');var authService=require(_0xf213('0x11'));var qs=require(_0xf213('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf213('0x13'));var logger=require(_0xf213('0x14'))(_0xf213('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xf213('0x16'));var db=require(_0xf213('0x17'))['db'];function respondWithStatusCode(_0x214fec,_0x23bc83){_0x23bc83=_0x23bc83||0xcc;return function(_0x673575){if(_0x673575){return _0x214fec[_0xf213('0x18')](_0x23bc83);}return _0x214fec['status'](_0x23bc83)[_0xf213('0x19')]();};}function respondWithResult(_0x148e56,_0x18fd79){_0x18fd79=_0x18fd79||0xc8;return function(_0x314189){if(_0x314189){return _0x148e56[_0xf213('0x1a')](_0x18fd79)[_0xf213('0x1b')](_0x314189);}};}function respondWithFilteredResult(_0x124eee,_0x3eb66c){return function(_0x4984a9){if(_0x4984a9){var _0x1664bf=typeof _0x3eb66c[_0xf213('0x1c')]===_0xf213('0x1d')&&typeof _0x3eb66c['limit']===_0xf213('0x1d');var _0x2d570d=_0x4984a9[_0xf213('0x1e')];var _0x1aa88=_0x1664bf?0x0:_0x3eb66c[_0xf213('0x1c')];var _0x55755b=_0x1664bf?_0x4984a9['count']:_0x3eb66c[_0xf213('0x1c')]+_0x3eb66c[_0xf213('0x1f')];var _0x13200e;if(_0x55755b>=_0x2d570d){_0x55755b=_0x2d570d;_0x13200e=0xc8;}else{_0x13200e=0xce;}_0x124eee[_0xf213('0x1a')](_0x13200e);return _0x124eee[_0xf213('0x20')](_0xf213('0x21'),_0x1aa88+'-'+_0x55755b+'/'+_0x2d570d)[_0xf213('0x1b')](_0x4984a9);}return null;};}function patchUpdates(_0x331dab){return function(_0x3b7515){try{jsonpatch[_0xf213('0x22')](_0x3b7515,_0x331dab,!![]);}catch(_0x4d8a8e){return BPromise['reject'](_0x4d8a8e);}return _0x3b7515[_0xf213('0x23')]();};}function saveUpdates(_0x495cc0,_0x59aa3e){return function(_0x26735a){if(_0x26735a){return _0x26735a[_0xf213('0x24')](_0x495cc0)[_0xf213('0x25')](function(_0x3fc421){return _0x3fc421;});}return null;};}function removeEntity(_0x3959c1,_0x1f162d){return function(_0x5166bf){if(_0x5166bf){return _0x5166bf[_0xf213('0x26')]()[_0xf213('0x25')](function(){_0x3959c1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x525d2d,_0x37a41d){return function(_0x47594c){if(!_0x47594c){_0x525d2d[_0xf213('0x18')](0x194);}return _0x47594c;};}function handleError(_0x1e818d,_0x295b52){_0x295b52=_0x295b52||0x1f4;return function(_0x5966f4){logger[_0xf213('0x27')](_0x5966f4[_0xf213('0x28')]);if(_0x5966f4[_0xf213('0x29')]){delete _0x5966f4[_0xf213('0x29')];}_0x1e818d['status'](_0x295b52)[_0xf213('0x2a')](_0x5966f4);};}exports[_0xf213('0x2b')]=function(_0x37dd0e,_0x2d93fa){var _0x2bba8f={},_0x2eeeca={},_0xe6a700={'count':0x0,'rows':[]};var _0x2e18d2=_[_0xf213('0x2c')](db[_0xf213('0x2d')][_0xf213('0x2e')],function(_0x1728c9){return{'name':_0x1728c9[_0xf213('0x2f')],'type':_0x1728c9[_0xf213('0x30')][_0xf213('0x31')]};});_0x2eeeca['model']=_['map'](_0x2e18d2,_0xf213('0x29'));_0x2eeeca[_0xf213('0x32')]=_[_0xf213('0x33')](_0x37dd0e[_0xf213('0x32')]);_0x2eeeca[_0xf213('0x34')]=_['intersection'](_0x2eeeca['model'],_0x2eeeca['query']);_0x2bba8f[_0xf213('0x35')]=_['intersection'](_0x2eeeca['model'],qs['fields'](_0x37dd0e[_0xf213('0x32')][_0xf213('0x36')]));_0x2bba8f[_0xf213('0x35')]=_0x2bba8f[_0xf213('0x35')][_0xf213('0x37')]?_0x2bba8f[_0xf213('0x35')]:_0x2eeeca[_0xf213('0x38')];if(!_0x37dd0e[_0xf213('0x32')]['hasOwnProperty'](_0xf213('0x39'))){_0x2bba8f[_0xf213('0x1f')]=qs[_0xf213('0x1f')](_0x37dd0e[_0xf213('0x32')]['limit']);_0x2bba8f[_0xf213('0x1c')]=qs['offset'](_0x37dd0e[_0xf213('0x32')][_0xf213('0x1c')]);}_0x2bba8f[_0xf213('0x3a')]=qs[_0xf213('0x3b')](_0x37dd0e[_0xf213('0x32')][_0xf213('0x3b')]);_0x2bba8f['where']=qs[_0xf213('0x34')](_[_0xf213('0x3c')](_0x37dd0e[_0xf213('0x32')],_0x2eeeca[_0xf213('0x34')]),_0x2e18d2);if(_0x37dd0e[_0xf213('0x32')]['filter']){_0x2bba8f[_0xf213('0x3d')]=_[_0xf213('0x3e')](_0x2bba8f[_0xf213('0x3d')],{'$or':_[_0xf213('0x2c')](_0x2e18d2,function(_0x38ad6b){if(_0x38ad6b['type']!=='VIRTUAL'){var _0x3e0359={};_0x3e0359[_0x38ad6b['name']]={'$like':'%'+_0x37dd0e[_0xf213('0x32')][_0xf213('0x3f')]+'%'};return _0x3e0359;}})});}_0x2bba8f=_[_0xf213('0x3e')]({},_0x2bba8f,_0x37dd0e[_0xf213('0x40')]);var _0x33990={'where':_0x2bba8f[_0xf213('0x3d')]};return db[_0xf213('0x2d')][_0xf213('0x1e')](_0x33990)[_0xf213('0x25')](function(_0x450c95){_0xe6a700[_0xf213('0x1e')]=_0x450c95;if(_0x37dd0e['query'][_0xf213('0x41')]){_0x2bba8f[_0xf213('0x42')]=[{'all':!![]}];}return db[_0xf213('0x2d')][_0xf213('0x43')](_0x2bba8f);})['then'](function(_0x2a9f26){_0xe6a700[_0xf213('0x44')]=_0x2a9f26;return _0xe6a700;})['then'](respondWithFilteredResult(_0x2d93fa,_0x2bba8f))['catch'](handleError(_0x2d93fa,null));};exports[_0xf213('0x45')]=function(_0x56f973,_0x2b65aa){var _0x3a77d9={'raw':!![],'where':{'id':_0x56f973['params']['id']}},_0x23f9f9={};_0x23f9f9[_0xf213('0x38')]=_[_0xf213('0x33')](db[_0xf213('0x2d')][_0xf213('0x2e')]);_0x23f9f9[_0xf213('0x32')]=_[_0xf213('0x33')](_0x56f973['query']);_0x23f9f9[_0xf213('0x34')]=_[_0xf213('0x46')](_0x23f9f9[_0xf213('0x38')],_0x23f9f9[_0xf213('0x32')]);_0x3a77d9[_0xf213('0x35')]=_[_0xf213('0x46')](_0x23f9f9[_0xf213('0x38')],qs[_0xf213('0x36')](_0x56f973[_0xf213('0x32')][_0xf213('0x36')]));_0x3a77d9[_0xf213('0x35')]=_0x3a77d9[_0xf213('0x35')][_0xf213('0x37')]?_0x3a77d9[_0xf213('0x35')]:_0x23f9f9[_0xf213('0x38')];if(_0x56f973[_0xf213('0x32')][_0xf213('0x41')]){_0x3a77d9[_0xf213('0x42')]=[{'all':!![]}];}_0x3a77d9=_[_0xf213('0x3e')]({},_0x3a77d9,_0x56f973[_0xf213('0x40')]);return db['SquareReport'][_0xf213('0x47')](_0x3a77d9)[_0xf213('0x25')](handleEntityNotFound(_0x2b65aa,null))[_0xf213('0x25')](respondWithResult(_0x2b65aa,null))[_0xf213('0x48')](handleError(_0x2b65aa,null));};exports['create']=function(_0x4fae66,_0xf6c824){return db[_0xf213('0x2d')][_0xf213('0x49')](_0x4fae66[_0xf213('0x4a')],{})['then'](respondWithResult(_0xf6c824,0xc9))[_0xf213('0x48')](handleError(_0xf6c824,null));};exports['update']=function(_0x3090ac,_0x555753){if(_0x3090ac[_0xf213('0x4a')]['id']){delete _0x3090ac[_0xf213('0x4a')]['id'];}return db['SquareReport'][_0xf213('0x47')]({'where':{'id':_0x3090ac[_0xf213('0x4b')]['id']}})[_0xf213('0x25')](handleEntityNotFound(_0x555753,null))[_0xf213('0x25')](saveUpdates(_0x3090ac[_0xf213('0x4a')],null))[_0xf213('0x25')](respondWithResult(_0x555753,null))[_0xf213('0x48')](handleError(_0x555753,null));};exports['destroy']=function(_0x25e2e1,_0x2f4bfe){return db[_0xf213('0x2d')]['find']({'where':{'id':_0x25e2e1[_0xf213('0x4b')]['id']}})[_0xf213('0x25')](handleEntityNotFound(_0x2f4bfe,null))[_0xf213('0x25')](removeEntity(_0x2f4bfe,null))[_0xf213('0x48')](handleError(_0x2f4bfe,null));};exports[_0xf213('0x4c')]=function(_0x1d107b,_0x5c3527){return db[_0xf213('0x2d')][_0xf213('0x4c')]()[_0xf213('0x25')](respondWithResult(_0x5c3527,null))[_0xf213('0x48')](handleError(_0x5c3527,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index bc627de..a80b3bb 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 _0x5ab5=['lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./squareReport.attributes','exports','define','SquareReport','report_square','uid_pname','uniqueid','project_name','leaveAt'];(function(_0x115039,_0x4059e4){var _0x3df66c=function(_0x23ad4f){while(--_0x23ad4f){_0x115039['push'](_0x115039['shift']());}};_0x3df66c(++_0x4059e4);}(_0x5ab5,0x1dc));var _0x55ab=function(_0x366d80,_0x188aa6){_0x366d80=_0x366d80-0x0;var _0xacbcb4=_0x5ab5[_0x366d80];return _0xacbcb4;};'use strict';var _=require(_0x55ab('0x0'));var util=require('util');var logger=require(_0x55ab('0x1'))(_0x55ab('0x2'));var moment=require(_0x55ab('0x3'));var BPromise=require('bluebird');var rp=require(_0x55ab('0x4'));var fs=require('fs');var path=require(_0x55ab('0x5'));var rimraf=require(_0x55ab('0x6'));var config=require(_0x55ab('0x7'));var attributes=require(_0x55ab('0x8'));module[_0x55ab('0x9')]=function(_0x462177,_0xb24ba2){return _0x462177[_0x55ab('0xa')](_0x55ab('0xb'),attributes,{'tableName':_0x55ab('0xc'),'paranoid':![],'indexes':[{'name':_0x55ab('0xd'),'fields':[_0x55ab('0xe'),_0x55ab('0xf')]},{'name':_0x55ab('0x10'),'fields':[_0x55ab('0x10')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe894=['api','moment','bluebird','request-promise','../../config/environment','./squareReport.attributes','exports','define','SquareReport','uniqueid','project_name','leaveAt','util','../../config/logger'];(function(_0x4663f9,_0x4ca70b){var _0x144a8a=function(_0x4dd860){while(--_0x4dd860){_0x4663f9['push'](_0x4663f9['shift']());}};_0x144a8a(++_0x4ca70b);}(_0xe894,0x1a2));var _0x4e89=function(_0x50f112,_0xd38e53){_0x50f112=_0x50f112-0x0;var _0x4ecf28=_0xe894[_0x50f112];return _0x4ecf28;};'use strict';var _=require('lodash');var util=require(_0x4e89('0x0'));var logger=require(_0x4e89('0x1'))(_0x4e89('0x2'));var moment=require(_0x4e89('0x3'));var BPromise=require(_0x4e89('0x4'));var rp=require(_0x4e89('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4e89('0x6'));var attributes=require(_0x4e89('0x7'));module[_0x4e89('0x8')]=function(_0x1bcc76,_0x34ef4d){return _0x1bcc76[_0x4e89('0x9')](_0x4e89('0xa'),attributes,{'tableName':'report_square','paranoid':![],'indexes':[{'name':'uid_pname','fields':[_0x4e89('0xb'),_0x4e89('0xc')]},{'name':_0x4e89('0xd'),'fields':[_0x4e89('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index d3f3210..cc0aaa3 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 _0xb9a0=['util','moment','randomstring','../../mysqldb','../../config/logger','rpc','client','http','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','SquareReport','create','options','raw','CreateSquareReport','UpdateSquareReport','update','body','attributes','limit'];(function(_0x5bd4f6,_0xf4e45c){var _0x33a165=function(_0x37eef6){while(--_0x37eef6){_0x5bd4f6['push'](_0x5bd4f6['shift']());}};_0x33a165(++_0xf4e45c);}(_0xb9a0,0xd2));var _0x0b9a=function(_0x1abc8d,_0x1e9760){_0x1abc8d=_0x1abc8d-0x0;var _0xa3c72f=_0xb9a0[_0x1abc8d];return _0xa3c72f;};'use strict';var _=require('lodash');var util=require(_0x0b9a('0x0'));var moment=require(_0x0b9a('0x1'));var BPromise=require('bluebird');var rs=require(_0x0b9a('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0b9a('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x0b9a('0x4'))(_0x0b9a('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0b9a('0x6')][_0x0b9a('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1bb01a,_0x1e9511,_0x918c2e){return new BPromise(function(_0x42b4c6,_0x4edada){return client['request'](_0x1bb01a,_0x918c2e)[_0x0b9a('0x8')](function(_0x5a7478){logger[_0x0b9a('0x9')](_0x0b9a('0xa'),_0x1e9511,_0x0b9a('0xb'));logger[_0x0b9a('0xc')](_0x0b9a('0xd'),_0x1e9511,_0x0b9a('0xb'),JSON[_0x0b9a('0xe')](_0x5a7478));if(_0x5a7478['error']){if(_0x5a7478[_0x0b9a('0xf')][_0x0b9a('0x10')]===0x1f4){logger[_0x0b9a('0xf')]('SquareReport,\x20%s,\x20%s',_0x1e9511,_0x5a7478[_0x0b9a('0xf')][_0x0b9a('0x11')]);return _0x4edada(_0x5a7478[_0x0b9a('0xf')][_0x0b9a('0x11')]);}logger[_0x0b9a('0xf')](_0x0b9a('0xa'),_0x1e9511,_0x5a7478[_0x0b9a('0xf')]['message']);return _0x42b4c6(_0x5a7478[_0x0b9a('0xf')][_0x0b9a('0x11')]);}else{logger[_0x0b9a('0x9')](_0x0b9a('0xa'),_0x1e9511,_0x0b9a('0xb'));_0x42b4c6(_0x5a7478[_0x0b9a('0x12')]['message']);}})[_0x0b9a('0x13')](function(_0x25954c){logger[_0x0b9a('0xf')]('SquareReport,\x20%s,\x20%s',_0x1e9511,_0x25954c);_0x4edada(_0x25954c);});});}exports['CreateSquareReport']=function(_0x5b5d54){var _0x2f25b7=this;return new Promise(function(_0x1054dd,_0x6b080c){return db[_0x0b9a('0x14')][_0x0b9a('0x15')](_0x5b5d54['body'],{'raw':_0x5b5d54[_0x0b9a('0x16')]?_0x5b5d54['options'][_0x0b9a('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x25e205){logger[_0x0b9a('0x9')](_0x0b9a('0x18'),_0x5b5d54);logger[_0x0b9a('0xc')](_0x0b9a('0x18'),_0x5b5d54,JSON[_0x0b9a('0xe')](_0x25e205));_0x1054dd(_0x25e205);})[_0x0b9a('0x13')](function(_0x26c7d8){logger[_0x0b9a('0xf')]('CreateSquareReport',_0x26c7d8['message'],_0x5b5d54);_0x6b080c(_0x2f25b7['error'](0x1f4,_0x26c7d8[_0x0b9a('0x11')]));});});};exports[_0x0b9a('0x19')]=function(_0x58118a){var _0x2fab16=this;return new Promise(function(_0x39e66b,_0x328680){return db[_0x0b9a('0x14')][_0x0b9a('0x1a')](_0x58118a[_0x0b9a('0x1b')],{'raw':_0x58118a[_0x0b9a('0x16')]?_0x58118a[_0x0b9a('0x16')][_0x0b9a('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x58118a['options']?_0x58118a['options']['where']||null:null,'attributes':_0x58118a['options']?_0x58118a[_0x0b9a('0x16')][_0x0b9a('0x1c')]||null:null,'limit':_0x58118a[_0x0b9a('0x16')]?_0x58118a[_0x0b9a('0x16')][_0x0b9a('0x1d')]||null:null})[_0x0b9a('0x8')](function(_0x3bc742){logger[_0x0b9a('0x9')]('UpdateSquareReport',_0x58118a);logger[_0x0b9a('0xc')](_0x0b9a('0x19'),_0x58118a,JSON[_0x0b9a('0xe')](_0x3bc742));_0x39e66b(_0x3bc742);})[_0x0b9a('0x13')](function(_0xf143d0){logger['error'](_0x0b9a('0x19'),_0xf143d0[_0x0b9a('0x11')],_0x58118a);_0x328680(_0x2fab16[_0x0b9a('0xf')](0x1f4,_0xf143d0[_0x0b9a('0x11')]));});});}; \ No newline at end of file +var _0x0f9e=['http','request','then','request\x20sent','debug','stringify','code','error','SquareReport,\x20%s,\x20%s','message','info','result','catch','SquareReport','create','body','options','CreateSquareReport','UpdateSquareReport','raw','where','attributes','limit','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client'];(function(_0x51765e,_0x418d33){var _0x59ca09=function(_0x5218ea){while(--_0x5218ea){_0x51765e['push'](_0x51765e['shift']());}};_0x59ca09(++_0x418d33);}(_0x0f9e,0x137));var _0xe0f9=function(_0x1fa943,_0x5d8094){_0x1fa943=_0x1fa943-0x0;var _0x543e1a=_0x0f9e[_0x1fa943];return _0x543e1a;};'use strict';var _=require(_0xe0f9('0x0'));var util=require(_0xe0f9('0x1'));var moment=require(_0xe0f9('0x2'));var BPromise=require('bluebird');var rs=require(_0xe0f9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe0f9('0x4'))['db'];var utils=require(_0xe0f9('0x5'));var logger=require(_0xe0f9('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xe0f9('0x7'));var client=jayson[_0xe0f9('0x8')][_0xe0f9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2bf003,_0x99cb5f,_0x1b421e){return new BPromise(function(_0xaf8398,_0x52932a){return client[_0xe0f9('0xa')](_0x2bf003,_0x1b421e)[_0xe0f9('0xb')](function(_0x301d79){logger['info']('SquareReport,\x20%s,\x20%s',_0x99cb5f,_0xe0f9('0xc'));logger[_0xe0f9('0xd')]('SquareReport,\x20%s,\x20%s,\x20%s',_0x99cb5f,'request\x20sent',JSON[_0xe0f9('0xe')](_0x301d79));if(_0x301d79['error']){if(_0x301d79['error'][_0xe0f9('0xf')]===0x1f4){logger[_0xe0f9('0x10')](_0xe0f9('0x11'),_0x99cb5f,_0x301d79[_0xe0f9('0x10')][_0xe0f9('0x12')]);return _0x52932a(_0x301d79['error'][_0xe0f9('0x12')]);}logger[_0xe0f9('0x10')](_0xe0f9('0x11'),_0x99cb5f,_0x301d79['error'][_0xe0f9('0x12')]);return _0xaf8398(_0x301d79[_0xe0f9('0x10')]['message']);}else{logger[_0xe0f9('0x13')](_0xe0f9('0x11'),_0x99cb5f,_0xe0f9('0xc'));_0xaf8398(_0x301d79[_0xe0f9('0x14')]['message']);}})[_0xe0f9('0x15')](function(_0x8db866){logger['error'](_0xe0f9('0x11'),_0x99cb5f,_0x8db866);_0x52932a(_0x8db866);});});}exports['CreateSquareReport']=function(_0x5ca074){var _0x539b36=this;return new Promise(function(_0x5cda52,_0x1a1d78){return db[_0xe0f9('0x16')][_0xe0f9('0x17')](_0x5ca074[_0xe0f9('0x18')],{'raw':_0x5ca074[_0xe0f9('0x19')]?_0x5ca074[_0xe0f9('0x19')]['raw']===undefined?!![]:![]:!![]})[_0xe0f9('0xb')](function(_0x4994c7){logger['info'](_0xe0f9('0x1a'),_0x5ca074);logger[_0xe0f9('0xd')]('CreateSquareReport',_0x5ca074,JSON[_0xe0f9('0xe')](_0x4994c7));_0x5cda52(_0x4994c7);})[_0xe0f9('0x15')](function(_0x3f66d7){logger[_0xe0f9('0x10')](_0xe0f9('0x1a'),_0x3f66d7['message'],_0x5ca074);_0x1a1d78(_0x539b36[_0xe0f9('0x10')](0x1f4,_0x3f66d7['message']));});});};exports[_0xe0f9('0x1b')]=function(_0x567460){var _0x415d89=this;return new Promise(function(_0xed9a19,_0x193478){return db[_0xe0f9('0x16')]['update'](_0x567460[_0xe0f9('0x18')],{'raw':_0x567460[_0xe0f9('0x19')]?_0x567460['options'][_0xe0f9('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x567460[_0xe0f9('0x19')]?_0x567460[_0xe0f9('0x19')][_0xe0f9('0x1d')]||null:null,'attributes':_0x567460[_0xe0f9('0x19')]?_0x567460[_0xe0f9('0x19')][_0xe0f9('0x1e')]||null:null,'limit':_0x567460[_0xe0f9('0x19')]?_0x567460[_0xe0f9('0x19')][_0xe0f9('0x1f')]||null:null})['then'](function(_0x356262){logger[_0xe0f9('0x13')](_0xe0f9('0x1b'),_0x567460);logger[_0xe0f9('0xd')](_0xe0f9('0x1b'),_0x567460,JSON[_0xe0f9('0xe')](_0x356262));_0xed9a19(_0x356262);})[_0xe0f9('0x15')](function(_0x23ae67){logger[_0xe0f9('0x10')](_0xe0f9('0x1b'),_0x23ae67[_0xe0f9('0x12')],_0x567460);_0x193478(_0x415d89['error'](0x1f4,_0x23ae67['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 469e60a..88f756c 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 _0x9eca=['../../components/auth/service','../../config/environment','./squareReportDetail.controller','index','/describe','isAuthenticated','get','show','post','create','put','/:id','update','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x433a86,_0x175b5c){var _0x23000c=function(_0x4b1fa0){while(--_0x4b1fa0){_0x433a86['push'](_0x433a86['shift']());}};_0x23000c(++_0x175b5c);}(_0x9eca,0x1ee));var _0xa9ec=function(_0x51a65c,_0x41dc34){_0x51a65c=_0x51a65c-0x0;var _0x31e6e0=_0x9eca[_0x51a65c];return _0x31e6e0;};'use strict';var multer=require(_0xa9ec('0x0'));var util=require(_0xa9ec('0x1'));var path=require(_0xa9ec('0x2'));var timeout=require(_0xa9ec('0x3'));var express=require(_0xa9ec('0x4'));var router=express[_0xa9ec('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xa9ec('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xa9ec('0x7'));var controller=require(_0xa9ec('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xa9ec('0x9')]);router['get'](_0xa9ec('0xa'),auth[_0xa9ec('0xb')](),controller['describe']);router[_0xa9ec('0xc')]('/:id',auth[_0xa9ec('0xb')](),controller[_0xa9ec('0xd')]);router[_0xa9ec('0xe')]('/',auth[_0xa9ec('0xb')](),controller[_0xa9ec('0xf')]);router[_0xa9ec('0x10')](_0xa9ec('0x11'),auth[_0xa9ec('0xb')](),controller[_0xa9ec('0x12')]);router['delete'](_0xa9ec('0x11'),auth[_0xa9ec('0xb')](),controller['destroy']);module[_0xa9ec('0x13')]=router; \ No newline at end of file +var _0x59f4=['/:id','show','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./squareReportDetail.controller','get','isAuthenticated','/describe'];(function(_0x185fed,_0x31d3d8){var _0x2fd2a3=function(_0x1c2135){while(--_0x1c2135){_0x185fed['push'](_0x185fed['shift']());}};_0x2fd2a3(++_0x31d3d8);}(_0x59f4,0x112));var _0x459f=function(_0x367a3d,_0x452717){_0x367a3d=_0x367a3d-0x0;var _0x460539=_0x59f4[_0x367a3d];return _0x460539;};'use strict';var multer=require('multer');var util=require(_0x459f('0x0'));var path=require(_0x459f('0x1'));var timeout=require(_0x459f('0x2'));var express=require(_0x459f('0x3'));var router=express[_0x459f('0x4')]();var fs_extra=require(_0x459f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x459f('0x6'));var config=require('../../config/environment');var controller=require(_0x459f('0x7'));router[_0x459f('0x8')]('/',auth[_0x459f('0x9')](),controller['index']);router['get'](_0x459f('0xa'),auth[_0x459f('0x9')](),controller['describe']);router[_0x459f('0x8')](_0x459f('0xb'),auth[_0x459f('0x9')](),controller[_0x459f('0xc')]);router['post']('/',auth[_0x459f('0x9')](),controller[_0x459f('0xd')]);router[_0x459f('0xe')](_0x459f('0xb'),auth[_0x459f('0x9')](),controller[_0x459f('0xf')]);router[_0x459f('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x459f('0x11')]);module[_0x459f('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 3feb07c..0c3af64 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 _0xbae3=['STRING','TEXT','sequelize','exports'];(function(_0x5a6f23,_0x2c4383){var _0xb521c=function(_0x4b0cf1){while(--_0x4b0cf1){_0x5a6f23['push'](_0x5a6f23['shift']());}};_0xb521c(++_0x2c4383);}(_0xbae3,0xa6));var _0x3bae=function(_0x351f05,_0x37394d){_0x351f05=_0x351f05-0x0;var _0x27ab39=_0xbae3[_0x351f05];return _0x27ab39;};'use strict';var Sequelize=require(_0x3bae('0x0'));module[_0x3bae('0x1')]={'uniqueid':{'type':Sequelize[_0x3bae('0x2')]},'node':{'type':Sequelize[_0x3bae('0x2')]},'application':{'type':Sequelize[_0x3bae('0x2')]},'data':{'type':Sequelize[_0x3bae('0x3')]},'project_name':{'type':Sequelize[_0x3bae('0x2')]},'callerid':{'type':Sequelize[_0x3bae('0x2')]}}; \ No newline at end of file +var _0xde65=['STRING','TEXT','exports'];(function(_0x2ff3ef,_0x40d335){var _0x2c00c9=function(_0x305954){while(--_0x305954){_0x2ff3ef['push'](_0x2ff3ef['shift']());}};_0x2c00c9(++_0x40d335);}(_0xde65,0x98));var _0x5de6=function(_0xc3d8b4,_0x213cc3){_0xc3d8b4=_0xc3d8b4-0x0;var _0x35f4fe=_0xde65[_0xc3d8b4];return _0x35f4fe;};'use strict';var Sequelize=require('sequelize');module[_0x5de6('0x0')]={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize[_0x5de6('0x1')]},'application':{'type':Sequelize[_0x5de6('0x1')]},'data':{'type':Sequelize[_0x5de6('0x2')]},'project_name':{'type':Sequelize[_0x5de6('0x1')]},'callerid':{'type':Sequelize[_0x5de6('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index a53e0ca..a13ad4a 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 _0x53f8=['to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','status','end','json','offset','limit','undefined','Content-Range','save','update','then','destroy','sendStatus','error','name','send','map','SquareDetailsReport','rawAttributes','fieldName','type','key','model','query','attributes','fields','length','nolimit','order','sort','pick','filters','filter','where','merge','count','includeAll','findAll','catch','show','keys','intersection','options','find','create','body','params','describe','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x53f8,0x15a));var _0x853f=function(_0x166742,_0x55520c){_0x166742=_0x166742-0x0;var _0xb7814a=_0x53f8[_0x166742];return _0xb7814a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x853f('0x0'));var zipdir=require(_0x853f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x853f('0x2'));var moment=require(_0x853f('0x3'));var BPromise=require(_0x853f('0x4'));var Mustache=require(_0x853f('0x5'));var util=require(_0x853f('0x6'));var path=require(_0x853f('0x7'));var sox=require(_0x853f('0x8'));var csv=require(_0x853f('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x853f('0xa'));var _=require(_0x853f('0xb'));var squel=require('squel');var crypto=require(_0x853f('0xc'));var jsforce=require(_0x853f('0xd'));var deskjs=require(_0x853f('0xe'));var toCsv=require(_0x853f('0x9'));var querystring=require(_0x853f('0xf'));var Papa=require(_0x853f('0x10'));var Redis=require(_0x853f('0x11'));var authService=require(_0x853f('0x12'));var qs=require(_0x853f('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x853f('0x14'));var logger=require(_0x853f('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x853f('0x16'));var licenseUtil=require(_0x853f('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x117b55,_0x26f173){_0x26f173=_0x26f173||0xcc;return function(_0x5d30f3){if(_0x5d30f3){return _0x117b55['sendStatus'](_0x26f173);}return _0x117b55[_0x853f('0x18')](_0x26f173)[_0x853f('0x19')]();};}function respondWithResult(_0x250300,_0x4fe21c){_0x4fe21c=_0x4fe21c||0xc8;return function(_0x54b07d){if(_0x54b07d){return _0x250300['status'](_0x4fe21c)[_0x853f('0x1a')](_0x54b07d);}};}function respondWithFilteredResult(_0x3c7c02,_0x55f46a){return function(_0x2b1235){if(_0x2b1235){var _0x50dce1=typeof _0x55f46a[_0x853f('0x1b')]==='undefined'&&typeof _0x55f46a[_0x853f('0x1c')]===_0x853f('0x1d');var _0x3546ba=_0x2b1235['count'];var _0x207eed=_0x50dce1?0x0:_0x55f46a['offset'];var _0x185b26=_0x50dce1?_0x2b1235['count']:_0x55f46a['offset']+_0x55f46a[_0x853f('0x1c')];var _0x16aefe;if(_0x185b26>=_0x3546ba){_0x185b26=_0x3546ba;_0x16aefe=0xc8;}else{_0x16aefe=0xce;}_0x3c7c02[_0x853f('0x18')](_0x16aefe);return _0x3c7c02['set'](_0x853f('0x1e'),_0x207eed+'-'+_0x185b26+'/'+_0x3546ba)['json'](_0x2b1235);}return null;};}function patchUpdates(_0x5cfa60){return function(_0x5172c0){try{jsonpatch['apply'](_0x5172c0,_0x5cfa60,!![]);}catch(_0x378409){return BPromise['reject'](_0x378409);}return _0x5172c0[_0x853f('0x1f')]();};}function saveUpdates(_0x4bdfe0,_0x5b08e8){return function(_0x51d0d5){if(_0x51d0d5){return _0x51d0d5[_0x853f('0x20')](_0x4bdfe0)[_0x853f('0x21')](function(_0x2801f5){return _0x2801f5;});}return null;};}function removeEntity(_0x2cc0a7,_0x3565fe){return function(_0x34bc2a){if(_0x34bc2a){return _0x34bc2a[_0x853f('0x22')]()[_0x853f('0x21')](function(){_0x2cc0a7[_0x853f('0x18')](0xcc)[_0x853f('0x19')]();});}};}function handleEntityNotFound(_0x232d81,_0x1403f0){return function(_0x3f9eeb){if(!_0x3f9eeb){_0x232d81[_0x853f('0x23')](0x194);}return _0x3f9eeb;};}function handleError(_0x5bde5a,_0x3d69ac){_0x3d69ac=_0x3d69ac||0x1f4;return function(_0x711a64){logger[_0x853f('0x24')](_0x711a64['stack']);if(_0x711a64[_0x853f('0x25')]){delete _0x711a64[_0x853f('0x25')];}_0x5bde5a[_0x853f('0x18')](_0x3d69ac)[_0x853f('0x26')](_0x711a64);};}exports['index']=function(_0x19aca7,_0x35c0c7){var _0x41524b={},_0x19264a={},_0x32f4e0={'count':0x0,'rows':[]};var _0x3f6409=_[_0x853f('0x27')](db[_0x853f('0x28')][_0x853f('0x29')],function(_0x30bde3){return{'name':_0x30bde3[_0x853f('0x2a')],'type':_0x30bde3[_0x853f('0x2b')][_0x853f('0x2c')]};});_0x19264a[_0x853f('0x2d')]=_['map'](_0x3f6409,'name');_0x19264a['query']=_['keys'](_0x19aca7[_0x853f('0x2e')]);_0x19264a['filters']=_['intersection'](_0x19264a[_0x853f('0x2d')],_0x19264a['query']);_0x41524b[_0x853f('0x2f')]=_['intersection'](_0x19264a[_0x853f('0x2d')],qs['fields'](_0x19aca7[_0x853f('0x2e')][_0x853f('0x30')]));_0x41524b[_0x853f('0x2f')]=_0x41524b['attributes'][_0x853f('0x31')]?_0x41524b['attributes']:_0x19264a[_0x853f('0x2d')];if(!_0x19aca7[_0x853f('0x2e')]['hasOwnProperty'](_0x853f('0x32'))){_0x41524b['limit']=qs[_0x853f('0x1c')](_0x19aca7[_0x853f('0x2e')][_0x853f('0x1c')]);_0x41524b[_0x853f('0x1b')]=qs[_0x853f('0x1b')](_0x19aca7[_0x853f('0x2e')][_0x853f('0x1b')]);}_0x41524b[_0x853f('0x33')]=qs[_0x853f('0x34')](_0x19aca7[_0x853f('0x2e')][_0x853f('0x34')]);_0x41524b['where']=qs['filters'](_[_0x853f('0x35')](_0x19aca7[_0x853f('0x2e')],_0x19264a[_0x853f('0x36')]),_0x3f6409);if(_0x19aca7[_0x853f('0x2e')][_0x853f('0x37')]){_0x41524b[_0x853f('0x38')]=_[_0x853f('0x39')](_0x41524b[_0x853f('0x38')],{'$or':_[_0x853f('0x27')](_0x3f6409,function(_0x8ceb7e){if(_0x8ceb7e['type']!=='VIRTUAL'){var _0x1ad801={};_0x1ad801[_0x8ceb7e[_0x853f('0x25')]]={'$like':'%'+_0x19aca7[_0x853f('0x2e')][_0x853f('0x37')]+'%'};return _0x1ad801;}})});}_0x41524b=_[_0x853f('0x39')]({},_0x41524b,_0x19aca7['options']);var _0x18ed68={'where':_0x41524b['where']};return db[_0x853f('0x28')]['count'](_0x18ed68)[_0x853f('0x21')](function(_0x50f1cd){_0x32f4e0[_0x853f('0x3a')]=_0x50f1cd;if(_0x19aca7[_0x853f('0x2e')][_0x853f('0x3b')]){_0x41524b['include']=[{'all':!![]}];}return db['SquareDetailsReport'][_0x853f('0x3c')](_0x41524b);})[_0x853f('0x21')](function(_0x1f296d){_0x32f4e0['rows']=_0x1f296d;return _0x32f4e0;})[_0x853f('0x21')](respondWithFilteredResult(_0x35c0c7,_0x41524b))[_0x853f('0x3d')](handleError(_0x35c0c7,null));};exports[_0x853f('0x3e')]=function(_0x5d15af,_0x4b72d9){var _0x3a84f7={'raw':!![],'where':{'id':_0x5d15af['params']['id']}},_0x30066c={};_0x30066c['model']=_[_0x853f('0x3f')](db[_0x853f('0x28')][_0x853f('0x29')]);_0x30066c[_0x853f('0x2e')]=_[_0x853f('0x3f')](_0x5d15af[_0x853f('0x2e')]);_0x30066c['filters']=_[_0x853f('0x40')](_0x30066c[_0x853f('0x2d')],_0x30066c[_0x853f('0x2e')]);_0x3a84f7[_0x853f('0x2f')]=_[_0x853f('0x40')](_0x30066c[_0x853f('0x2d')],qs['fields'](_0x5d15af[_0x853f('0x2e')][_0x853f('0x30')]));_0x3a84f7[_0x853f('0x2f')]=_0x3a84f7['attributes'][_0x853f('0x31')]?_0x3a84f7['attributes']:_0x30066c[_0x853f('0x2d')];if(_0x5d15af['query'][_0x853f('0x3b')]){_0x3a84f7['include']=[{'all':!![]}];}_0x3a84f7=_[_0x853f('0x39')]({},_0x3a84f7,_0x5d15af[_0x853f('0x41')]);return db[_0x853f('0x28')][_0x853f('0x42')](_0x3a84f7)[_0x853f('0x21')](handleEntityNotFound(_0x4b72d9,null))[_0x853f('0x21')](respondWithResult(_0x4b72d9,null))['catch'](handleError(_0x4b72d9,null));};exports['create']=function(_0x48a3fd,_0x5b4a2a){return db[_0x853f('0x28')][_0x853f('0x43')](_0x48a3fd[_0x853f('0x44')],{})[_0x853f('0x21')](respondWithResult(_0x5b4a2a,0xc9))[_0x853f('0x3d')](handleError(_0x5b4a2a,null));};exports['update']=function(_0x21e92c,_0x55c119){if(_0x21e92c[_0x853f('0x44')]['id']){delete _0x21e92c[_0x853f('0x44')]['id'];}return db[_0x853f('0x28')][_0x853f('0x42')]({'where':{'id':_0x21e92c[_0x853f('0x45')]['id']}})[_0x853f('0x21')](handleEntityNotFound(_0x55c119,null))[_0x853f('0x21')](saveUpdates(_0x21e92c[_0x853f('0x44')],null))['then'](respondWithResult(_0x55c119,null))[_0x853f('0x3d')](handleError(_0x55c119,null));};exports[_0x853f('0x22')]=function(_0x407d05,_0x311ef6){return db['SquareDetailsReport'][_0x853f('0x42')]({'where':{'id':_0x407d05['params']['id']}})[_0x853f('0x21')](handleEntityNotFound(_0x311ef6,null))[_0x853f('0x21')](removeEntity(_0x311ef6,null))[_0x853f('0x3d')](handleError(_0x311ef6,null));};exports[_0x853f('0x46')]=function(_0x536939,_0x518c99){return db[_0x853f('0x28')]['describe']()['then'](respondWithResult(_0x518c99,null))['catch'](handleError(_0x518c99,null));}; \ No newline at end of file +var _0xe33a=['offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','type','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','SquareDetailsReport','includeAll','include','findAll','rows','catch','show','params','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','ejs','fs-extra','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json'];(function(_0x135330,_0x5e0b48){var _0x3f731a=function(_0x42569f){while(--_0x42569f){_0x135330['push'](_0x135330['shift']());}};_0x3f731a(++_0x5e0b48);}(_0xe33a,0x7c));var _0xae33=function(_0x125044,_0x3033dd){_0x125044=_0x125044-0x0;var _0x281a3b=_0xe33a[_0x125044];return _0x281a3b;};'use strict';var emlformat=require(_0xae33('0x0'));var rimraf=require(_0xae33('0x1'));var zipdir=require(_0xae33('0x2'));var jsonpatch=require(_0xae33('0x3'));var rp=require(_0xae33('0x4'));var moment=require(_0xae33('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xae33('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xae33('0x7'));var fs=require('fs');var fs_extra=require(_0xae33('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xae33('0x9'));var deskjs=require('desk.js');var toCsv=require(_0xae33('0xa'));var querystring=require('querystring');var Papa=require(_0xae33('0xb'));var Redis=require(_0xae33('0xc'));var authService=require(_0xae33('0xd'));var qs=require(_0xae33('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xae33('0xf'));var logger=require(_0xae33('0x10'))(_0xae33('0x11'));var utils=require(_0xae33('0x12'));var config=require(_0xae33('0x13'));var licenseUtil=require(_0xae33('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2838fe,_0x4a30e8){_0x4a30e8=_0x4a30e8||0xcc;return function(_0x182a8b){if(_0x182a8b){return _0x2838fe['sendStatus'](_0x4a30e8);}return _0x2838fe[_0xae33('0x15')](_0x4a30e8)[_0xae33('0x16')]();};}function respondWithResult(_0x1798f1,_0x44bdac){_0x44bdac=_0x44bdac||0xc8;return function(_0xaca076){if(_0xaca076){return _0x1798f1[_0xae33('0x15')](_0x44bdac)[_0xae33('0x17')](_0xaca076);}};}function respondWithFilteredResult(_0x9cb7a3,_0x1e7d96){return function(_0x2ce17a){if(_0x2ce17a){var _0xe64a62=typeof _0x1e7d96[_0xae33('0x18')]===_0xae33('0x19')&&typeof _0x1e7d96[_0xae33('0x1a')]==='undefined';var _0x1eaf81=_0x2ce17a[_0xae33('0x1b')];var _0x4225a5=_0xe64a62?0x0:_0x1e7d96[_0xae33('0x18')];var _0x4f6a10=_0xe64a62?_0x2ce17a[_0xae33('0x1b')]:_0x1e7d96['offset']+_0x1e7d96[_0xae33('0x1a')];var _0x9aea6b;if(_0x4f6a10>=_0x1eaf81){_0x4f6a10=_0x1eaf81;_0x9aea6b=0xc8;}else{_0x9aea6b=0xce;}_0x9cb7a3[_0xae33('0x15')](_0x9aea6b);return _0x9cb7a3[_0xae33('0x1c')]('Content-Range',_0x4225a5+'-'+_0x4f6a10+'/'+_0x1eaf81)[_0xae33('0x17')](_0x2ce17a);}return null;};}function patchUpdates(_0x3a65bb){return function(_0x1dc3c3){try{jsonpatch[_0xae33('0x1d')](_0x1dc3c3,_0x3a65bb,!![]);}catch(_0x53503c){return BPromise[_0xae33('0x1e')](_0x53503c);}return _0x1dc3c3[_0xae33('0x1f')]();};}function saveUpdates(_0x206ab0,_0x2e5d4a){return function(_0x4d581d){if(_0x4d581d){return _0x4d581d[_0xae33('0x20')](_0x206ab0)[_0xae33('0x21')](function(_0x4bd20b){return _0x4bd20b;});}return null;};}function removeEntity(_0x48edcf,_0x59f0b3){return function(_0x57d4b2){if(_0x57d4b2){return _0x57d4b2[_0xae33('0x22')]()[_0xae33('0x21')](function(){_0x48edcf['status'](0xcc)[_0xae33('0x16')]();});}};}function handleEntityNotFound(_0x161150,_0x38a5ca){return function(_0x30dfc7){if(!_0x30dfc7){_0x161150[_0xae33('0x23')](0x194);}return _0x30dfc7;};}function handleError(_0x177c50,_0x1846f6){_0x1846f6=_0x1846f6||0x1f4;return function(_0x2b24ee){logger[_0xae33('0x24')](_0x2b24ee[_0xae33('0x25')]);if(_0x2b24ee[_0xae33('0x26')]){delete _0x2b24ee[_0xae33('0x26')];}_0x177c50[_0xae33('0x15')](_0x1846f6)[_0xae33('0x27')](_0x2b24ee);};}exports[_0xae33('0x28')]=function(_0x4261d5,_0x3f6ac8){var _0x5ece4b={},_0x11f51b={},_0x167b2d={'count':0x0,'rows':[]};var _0x50259e=_[_0xae33('0x29')](db['SquareDetailsReport'][_0xae33('0x2a')],function(_0x243d8f){return{'name':_0x243d8f['fieldName'],'type':_0x243d8f[_0xae33('0x2b')]['key']};});_0x11f51b['model']=_['map'](_0x50259e,_0xae33('0x26'));_0x11f51b[_0xae33('0x2c')]=_[_0xae33('0x2d')](_0x4261d5['query']);_0x11f51b[_0xae33('0x2e')]=_['intersection'](_0x11f51b[_0xae33('0x2f')],_0x11f51b[_0xae33('0x2c')]);_0x5ece4b[_0xae33('0x30')]=_[_0xae33('0x31')](_0x11f51b[_0xae33('0x2f')],qs[_0xae33('0x32')](_0x4261d5[_0xae33('0x2c')][_0xae33('0x32')]));_0x5ece4b['attributes']=_0x5ece4b[_0xae33('0x30')][_0xae33('0x33')]?_0x5ece4b['attributes']:_0x11f51b[_0xae33('0x2f')];if(!_0x4261d5['query'][_0xae33('0x34')](_0xae33('0x35'))){_0x5ece4b[_0xae33('0x1a')]=qs[_0xae33('0x1a')](_0x4261d5['query'][_0xae33('0x1a')]);_0x5ece4b[_0xae33('0x18')]=qs[_0xae33('0x18')](_0x4261d5[_0xae33('0x2c')][_0xae33('0x18')]);}_0x5ece4b[_0xae33('0x36')]=qs[_0xae33('0x37')](_0x4261d5[_0xae33('0x2c')][_0xae33('0x37')]);_0x5ece4b[_0xae33('0x38')]=qs[_0xae33('0x2e')](_[_0xae33('0x39')](_0x4261d5['query'],_0x11f51b[_0xae33('0x2e')]),_0x50259e);if(_0x4261d5[_0xae33('0x2c')]['filter']){_0x5ece4b['where']=_['merge'](_0x5ece4b[_0xae33('0x38')],{'$or':_[_0xae33('0x29')](_0x50259e,function(_0x58f63b){if(_0x58f63b[_0xae33('0x2b')]!==_0xae33('0x3a')){var _0x288b85={};_0x288b85[_0x58f63b['name']]={'$like':'%'+_0x4261d5[_0xae33('0x2c')][_0xae33('0x3b')]+'%'};return _0x288b85;}})});}_0x5ece4b=_[_0xae33('0x3c')]({},_0x5ece4b,_0x4261d5[_0xae33('0x3d')]);var _0x1b4b88={'where':_0x5ece4b[_0xae33('0x38')]};return db[_0xae33('0x3e')][_0xae33('0x1b')](_0x1b4b88)['then'](function(_0x7927f){_0x167b2d[_0xae33('0x1b')]=_0x7927f;if(_0x4261d5[_0xae33('0x2c')][_0xae33('0x3f')]){_0x5ece4b[_0xae33('0x40')]=[{'all':!![]}];}return db[_0xae33('0x3e')][_0xae33('0x41')](_0x5ece4b);})[_0xae33('0x21')](function(_0xbeb569){_0x167b2d[_0xae33('0x42')]=_0xbeb569;return _0x167b2d;})[_0xae33('0x21')](respondWithFilteredResult(_0x3f6ac8,_0x5ece4b))[_0xae33('0x43')](handleError(_0x3f6ac8,null));};exports[_0xae33('0x44')]=function(_0x5e7a13,_0x5485aa){var _0x2e68bf={'raw':!![],'where':{'id':_0x5e7a13[_0xae33('0x45')]['id']}},_0x2de1aa={};_0x2de1aa['model']=_[_0xae33('0x2d')](db[_0xae33('0x3e')]['rawAttributes']);_0x2de1aa[_0xae33('0x2c')]=_[_0xae33('0x2d')](_0x5e7a13[_0xae33('0x2c')]);_0x2de1aa['filters']=_[_0xae33('0x31')](_0x2de1aa[_0xae33('0x2f')],_0x2de1aa['query']);_0x2e68bf[_0xae33('0x30')]=_[_0xae33('0x31')](_0x2de1aa['model'],qs['fields'](_0x5e7a13[_0xae33('0x2c')][_0xae33('0x32')]));_0x2e68bf[_0xae33('0x30')]=_0x2e68bf['attributes'][_0xae33('0x33')]?_0x2e68bf[_0xae33('0x30')]:_0x2de1aa[_0xae33('0x2f')];if(_0x5e7a13[_0xae33('0x2c')]['includeAll']){_0x2e68bf[_0xae33('0x40')]=[{'all':!![]}];}_0x2e68bf=_['merge']({},_0x2e68bf,_0x5e7a13[_0xae33('0x3d')]);return db[_0xae33('0x3e')]['find'](_0x2e68bf)[_0xae33('0x21')](handleEntityNotFound(_0x5485aa,null))[_0xae33('0x21')](respondWithResult(_0x5485aa,null))['catch'](handleError(_0x5485aa,null));};exports[_0xae33('0x46')]=function(_0x8d21a7,_0x439a3d){return db['SquareDetailsReport']['create'](_0x8d21a7[_0xae33('0x47')],{})['then'](respondWithResult(_0x439a3d,0xc9))[_0xae33('0x43')](handleError(_0x439a3d,null));};exports[_0xae33('0x20')]=function(_0x1ad135,_0xb77dfa){if(_0x1ad135[_0xae33('0x47')]['id']){delete _0x1ad135[_0xae33('0x47')]['id'];}return db[_0xae33('0x3e')]['find']({'where':{'id':_0x1ad135[_0xae33('0x45')]['id']}})[_0xae33('0x21')](handleEntityNotFound(_0xb77dfa,null))['then'](saveUpdates(_0x1ad135[_0xae33('0x47')],null))[_0xae33('0x21')](respondWithResult(_0xb77dfa,null))[_0xae33('0x43')](handleError(_0xb77dfa,null));};exports[_0xae33('0x22')]=function(_0x520833,_0x196ea7){return db[_0xae33('0x3e')][_0xae33('0x48')]({'where':{'id':_0x520833['params']['id']}})['then'](handleEntityNotFound(_0x196ea7,null))[_0xae33('0x21')](removeEntity(_0x196ea7,null))[_0xae33('0x43')](handleError(_0x196ea7,null));};exports[_0xae33('0x49')]=function(_0x38a065,_0x2aa4e0){return db[_0xae33('0x3e')]['describe']()[_0xae33('0x21')](respondWithResult(_0x2aa4e0,null))[_0xae33('0x43')](handleError(_0x2aa4e0,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index e43be2f..59cd681 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 _0xe63c=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareReportDetail.attributes','define','report_square_details','util'];(function(_0x333ebb,_0x36693a){var _0x1d8f86=function(_0x31b6f5){while(--_0x31b6f5){_0x333ebb['push'](_0x333ebb['shift']());}};_0x1d8f86(++_0x36693a);}(_0xe63c,0x1a3));var _0xce63=function(_0x1f0724,_0x3a58bf){_0x1f0724=_0x1f0724-0x0;var _0x253ffb=_0xe63c[_0x1f0724];return _0x253ffb;};'use strict';var _=require('lodash');var util=require(_0xce63('0x0'));var logger=require(_0xce63('0x1'))(_0xce63('0x2'));var moment=require(_0xce63('0x3'));var BPromise=require(_0xce63('0x4'));var rp=require(_0xce63('0x5'));var fs=require('fs');var path=require(_0xce63('0x6'));var rimraf=require(_0xce63('0x7'));var config=require(_0xce63('0x8'));var attributes=require(_0xce63('0x9'));module['exports']=function(_0xe3755e,_0xf7f998){return _0xe3755e[_0xce63('0xa')]('SquareDetailsReport',attributes,{'tableName':_0xce63('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb720=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./squareReportDetail.attributes','exports','define','SquareDetailsReport','report_square_details','lodash','util','../../config/logger'];(function(_0x258c43,_0x4deb0a){var _0x2f3330=function(_0x206457){while(--_0x206457){_0x258c43['push'](_0x258c43['shift']());}};_0x2f3330(++_0x4deb0a);}(_0xb720,0xeb));var _0x0b72=function(_0x6ca7f4,_0x51a5df){_0x6ca7f4=_0x6ca7f4-0x0;var _0x494fa6=_0xb720[_0x6ca7f4];return _0x494fa6;};'use strict';var _=require(_0x0b72('0x0'));var util=require(_0x0b72('0x1'));var logger=require(_0x0b72('0x2'))(_0x0b72('0x3'));var moment=require(_0x0b72('0x4'));var BPromise=require(_0x0b72('0x5'));var rp=require(_0x0b72('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0b72('0x7'));var config=require(_0x0b72('0x8'));var attributes=require(_0x0b72('0x9'));module[_0x0b72('0xa')]=function(_0xd55828,_0x548a9f){return _0xd55828[_0x0b72('0xb')](_0x0b72('0xc'),attributes,{'tableName':_0x0b72('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.rpc.js b/server/api/squareReportDetail/squareReportDetail.rpc.js index 0c88b1d..48644d5 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 _0xe493=['randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','then','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateSquareDetailsReport','create','options','raw','lodash','util','moment','bluebird'];(function(_0x15e80a,_0x530b9d){var _0xeba70e=function(_0x5a5e68){while(--_0x5a5e68){_0x15e80a['push'](_0x15e80a['shift']());}};_0xeba70e(++_0x530b9d);}(_0xe493,0x7e));var _0x3e49=function(_0x35db52,_0x1fd62c){_0x35db52=_0x35db52-0x0;var _0x448118=_0xe493[_0x35db52];return _0x448118;};'use strict';var _=require(_0x3e49('0x0'));var util=require(_0x3e49('0x1'));var moment=require(_0x3e49('0x2'));var BPromise=require(_0x3e49('0x3'));var rs=require(_0x3e49('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3e49('0x5'))['db'];var utils=require(_0x3e49('0x6'));var logger=require('../../config/logger')(_0x3e49('0x7'));var config=require('../../config/environment');var jayson=require(_0x3e49('0x8'));var client=jayson[_0x3e49('0x9')][_0x3e49('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3f7821,_0x12dd84,_0x3626b6){return new BPromise(function(_0x4e96ac,_0x56b767){return client['request'](_0x3f7821,_0x3626b6)[_0x3e49('0xb')](function(_0x8b8c0e){logger[_0x3e49('0xc')](_0x3e49('0xd'),_0x12dd84,_0x3e49('0xe'));logger[_0x3e49('0xf')](_0x3e49('0x10'),_0x12dd84,_0x3e49('0xe'),JSON[_0x3e49('0x11')](_0x8b8c0e));if(_0x8b8c0e[_0x3e49('0x12')]){if(_0x8b8c0e[_0x3e49('0x12')]['code']===0x1f4){logger[_0x3e49('0x12')](_0x3e49('0xd'),_0x12dd84,_0x8b8c0e['error'][_0x3e49('0x13')]);return _0x56b767(_0x8b8c0e[_0x3e49('0x12')]['message']);}logger[_0x3e49('0x12')](_0x3e49('0xd'),_0x12dd84,_0x8b8c0e['error'][_0x3e49('0x13')]);return _0x4e96ac(_0x8b8c0e[_0x3e49('0x12')][_0x3e49('0x13')]);}else{logger[_0x3e49('0xc')](_0x3e49('0xd'),_0x12dd84,_0x3e49('0xe'));_0x4e96ac(_0x8b8c0e[_0x3e49('0x14')][_0x3e49('0x13')]);}})[_0x3e49('0x15')](function(_0x1d9cce){logger[_0x3e49('0x12')](_0x3e49('0xd'),_0x12dd84,_0x1d9cce);_0x56b767(_0x1d9cce);});});}exports[_0x3e49('0x16')]=function(_0x3ae5f4){var _0x448c36=this;return new Promise(function(_0x4e1cdf,_0xf33205){return db['SquareDetailsReport'][_0x3e49('0x17')](_0x3ae5f4['body'],{'raw':_0x3ae5f4[_0x3e49('0x18')]?_0x3ae5f4['options'][_0x3e49('0x19')]===undefined?!![]:![]:!![]})[_0x3e49('0xb')](function(_0x420d7b){logger['info'](_0x3e49('0x16'),_0x3ae5f4);logger['debug'](_0x3e49('0x16'),_0x3ae5f4,JSON[_0x3e49('0x11')](_0x420d7b));_0x4e1cdf(_0x420d7b);})[_0x3e49('0x15')](function(_0x5e0f1d){logger['error'](_0x3e49('0x16'),_0x5e0f1d['message'],_0x3ae5f4);_0xf33205(_0x448c36[_0x3e49('0x12')](0x1f4,_0x5e0f1d[_0x3e49('0x13')]));});});}; \ No newline at end of file +var _0x94df=['client','http','request','then','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateSquareDetailsReport','SquareDetailsReport','body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x128c2b,_0x3c64b0){var _0x3c0b7c=function(_0x4c0a8c){while(--_0x4c0a8c){_0x128c2b['push'](_0x128c2b['shift']());}};_0x3c0b7c(++_0x3c64b0);}(_0x94df,0xa3));var _0xf94d=function(_0x35ab62,_0x36daaa){_0x35ab62=_0x35ab62-0x0;var _0x1f711a=_0x94df[_0x35ab62];return _0x1f711a;};'use strict';var _=require(_0xf94d('0x0'));var util=require(_0xf94d('0x1'));var moment=require(_0xf94d('0x2'));var BPromise=require(_0xf94d('0x3'));var rs=require(_0xf94d('0x4'));var fs=require('fs');var Redis=require(_0xf94d('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xf94d('0x6'));var logger=require(_0xf94d('0x7'))(_0xf94d('0x8'));var config=require(_0xf94d('0x9'));var jayson=require(_0xf94d('0xa'));var client=jayson[_0xf94d('0xb')][_0xf94d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x18a11a,_0x1ebc19,_0xf285b5){return new BPromise(function(_0x1832e9,_0x504670){return client[_0xf94d('0xd')](_0x18a11a,_0xf285b5)[_0xf94d('0xe')](function(_0x145f5b){logger[_0xf94d('0xf')](_0xf94d('0x10'),_0x1ebc19,_0xf94d('0x11'));logger['debug'](_0xf94d('0x12'),_0x1ebc19,_0xf94d('0x11'),JSON[_0xf94d('0x13')](_0x145f5b));if(_0x145f5b[_0xf94d('0x14')]){if(_0x145f5b[_0xf94d('0x14')]['code']===0x1f4){logger['error'](_0xf94d('0x10'),_0x1ebc19,_0x145f5b[_0xf94d('0x14')][_0xf94d('0x15')]);return _0x504670(_0x145f5b[_0xf94d('0x14')][_0xf94d('0x15')]);}logger[_0xf94d('0x14')]('SquareDetailsReport,\x20%s,\x20%s',_0x1ebc19,_0x145f5b[_0xf94d('0x14')][_0xf94d('0x15')]);return _0x1832e9(_0x145f5b[_0xf94d('0x14')][_0xf94d('0x15')]);}else{logger[_0xf94d('0xf')](_0xf94d('0x10'),_0x1ebc19,_0xf94d('0x11'));_0x1832e9(_0x145f5b[_0xf94d('0x16')]['message']);}})[_0xf94d('0x17')](function(_0x5cd967){logger[_0xf94d('0x14')]('SquareDetailsReport,\x20%s,\x20%s',_0x1ebc19,_0x5cd967);_0x504670(_0x5cd967);});});}exports[_0xf94d('0x18')]=function(_0x559e0c){var _0x30d231=this;return new Promise(function(_0x3bf001,_0x510eef){return db[_0xf94d('0x19')]['create'](_0x559e0c[_0xf94d('0x1a')],{'raw':_0x559e0c['options']?_0x559e0c[_0xf94d('0x1b')][_0xf94d('0x1c')]===undefined?!![]:![]:!![]})[_0xf94d('0xe')](function(_0x2ede5b){logger['info'](_0xf94d('0x18'),_0x559e0c);logger['debug'](_0xf94d('0x18'),_0x559e0c,JSON[_0xf94d('0x13')](_0x2ede5b));_0x3bf001(_0x2ede5b);})[_0xf94d('0x17')](function(_0x56e5f5){logger[_0xf94d('0x14')](_0xf94d('0x18'),_0x56e5f5[_0xf94d('0x15')],_0x559e0c);_0x510eef(_0x30d231[_0xf94d('0x14')](0x1f4,_0x56e5f5[_0xf94d('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index d158214..acaf018 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 _0x4e28=['exports','express','./system.controller','get','isAuthenticated','index','killProcess'];(function(_0x3e9832,_0x37e43f){var _0x20b148=function(_0x42a334){while(--_0x42a334){_0x3e9832['push'](_0x3e9832['shift']());}};_0x20b148(++_0x37e43f);}(_0x4e28,0xda));var _0x84e2=function(_0x7b87e7,_0x4d5fcb){_0x7b87e7=_0x7b87e7-0x0;var _0x2f812c=_0x4e28[_0x7b87e7];return _0x2f812c;};'use strict';var express=require(_0x84e2('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0x84e2('0x1'));router[_0x84e2('0x2')]('/',auth[_0x84e2('0x3')](),controller[_0x84e2('0x4')]);router['get']('/process/:pid/kill',auth[_0x84e2('0x3')](),controller[_0x84e2('0x5')]);module[_0x84e2('0x6')]=router; \ No newline at end of file +var _0xb764=['killProcess','exports','../../components/auth/service','./system.controller','get','isAuthenticated','index','/process/:pid/kill'];(function(_0x397cfb,_0xb8f317){var _0x15fed9=function(_0x3eba43){while(--_0x3eba43){_0x397cfb['push'](_0x397cfb['shift']());}};_0x15fed9(++_0xb8f317);}(_0xb764,0x1c2));var _0x4b76=function(_0x23601a,_0x148985){_0x23601a=_0x23601a-0x0;var _0x35bd1d=_0xb764[_0x23601a];return _0x35bd1d;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0x4b76('0x0'));var controller=require(_0x4b76('0x1'));router[_0x4b76('0x2')]('/',auth[_0x4b76('0x3')](),controller[_0x4b76('0x4')]);router[_0x4b76('0x2')](_0x4b76('0x5'),auth['isAuthenticated'](),controller[_0x4b76('0x6')]);module[_0x4b76('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 f261174..3078c7b 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 _0xb378=['status','send','index','getAllData','then','json','catch','killProcess','components/import/cm','format','params','pid','split','length','indexOf','kill','SIGINT','exec','../../config/logger','api','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name'];(function(_0x8f536c,_0x49dbba){var _0x26aac9=function(_0x34ebd8){while(--_0x34ebd8){_0x8f536c['push'](_0x8f536c['shift']());}};_0x26aac9(++_0x49dbba);}(_0xb378,0xad));var _0x8b37=function(_0x5b8a3a,_0x55e356){_0x5b8a3a=_0x5b8a3a-0x0;var _0x5a95f7=_0xb378[_0x5b8a3a];return _0x5a95f7;};'use strict';var info=require('systeminformation');var exec=require('child_process')[_0x8b37('0x0')];var logger=require(_0x8b37('0x1'))(_0x8b37('0x2'));var util=require('util');var BPromise=require(_0x8b37('0x3'));var _=require(_0x8b37('0x4'));function handleError(_0x5e5443,_0x16612a,_0x259b05){_0x16612a=_0x16612a||0x1f4;return function(_0x245311){logger[_0x8b37('0x5')](_0x8b37('0x6'),_0x259b05,_0x16612a,util[_0x8b37('0x7')](_0x245311,{'showHidden':![],'depth':null}));delete _0x245311[_0x8b37('0x8')];_0x5e5443[_0x8b37('0x9')](_0x16612a)[_0x8b37('0xa')](_0x245311);};}exports[_0x8b37('0xb')]=function(_0x3c8e0f,_0x5f3083){return info[_0x8b37('0xc')]()[_0x8b37('0xd')](function(_0x2fbd15){return _0x5f3083[_0x8b37('0x9')](0xc8)[_0x8b37('0xe')](_0x2fbd15);})[_0x8b37('0xf')](function(_0x5939d0){return _0x5f3083[_0x8b37('0x9')](0x1f4)[_0x8b37('0xe')](_0x5939d0);});};exports[_0x8b37('0x10')]=function(_0x99be3a,_0x3f663d){var _0x2f57d0=[_0x8b37('0x11')];return new BPromise(function(_0x1b0b68,_0x39f3fa){return exec(util[_0x8b37('0x12')]('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x99be3a[_0x8b37('0x13')][_0x8b37('0x14')]),function(_0x1781a5,_0x3acc4c,_0x138f3a){if(_0x1781a5){return _0x39f3fa(_0x1781a5);}return _0x1b0b68(_0x3acc4c);});})['then'](function(_0x50abc3){var _0x15e54c=![];var _0x282cbb=_0x50abc3[_0x8b37('0x15')](/\n/);for(var _0x2a1caa=0x0,_0x2bcf27=_0x2f57d0[_0x8b37('0x16')];_0x2a1caa<_0x2bcf27,_0x15e54c===![];_0x2a1caa+=0x1){if(_0x50abc3[_0x8b37('0x17')](_0x2f57d0[_0x2a1caa])>=0x0){_0x15e54c=!![];}}if(!_0x15e54c){throw new Error(util['format']('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x99be3a[_0x8b37('0x13')][_0x8b37('0x14')]));}process[_0x8b37('0x18')](_0x99be3a[_0x8b37('0x13')][_0x8b37('0x14')],_0x8b37('0x19'));return _0x3f663d['status'](0xc8)[_0x8b37('0xe')]({'message':util[_0x8b37('0x12')]('Process\x20with\x20pid\x20%s\x20killed\x20correctly',_0x99be3a[_0x8b37('0x13')][_0x8b37('0x14')])});})[_0x8b37('0xf')](handleError(_0x3f663d,null,_0x8b37('0x10')));}; \ No newline at end of file +var _0x4cf8=['then','status','json','catch','killProcess','components/import/cm','format','params','pid','split','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','exec','../../config/logger','api','util','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','send'];(function(_0x5ed1cb,_0x4388e4){var _0x4823b9=function(_0x227b6b){while(--_0x227b6b){_0x5ed1cb['push'](_0x5ed1cb['shift']());}};_0x4823b9(++_0x4388e4);}(_0x4cf8,0x7f));var _0x84cf=function(_0x33feca,_0x2bd9ae){_0x33feca=_0x33feca-0x0;var _0x3c558f=_0x4cf8[_0x33feca];return _0x3c558f;};'use strict';var info=require(_0x84cf('0x0'));var exec=require(_0x84cf('0x1'))[_0x84cf('0x2')];var logger=require(_0x84cf('0x3'))(_0x84cf('0x4'));var util=require(_0x84cf('0x5'));var BPromise=require(_0x84cf('0x6'));var _=require(_0x84cf('0x7'));function handleError(_0x3379da,_0x30f1c0,_0x55632b){_0x30f1c0=_0x30f1c0||0x1f4;return function(_0x5bf5f9){logger[_0x84cf('0x8')](_0x84cf('0x9'),_0x55632b,_0x30f1c0,util[_0x84cf('0xa')](_0x5bf5f9,{'showHidden':![],'depth':null}));delete _0x5bf5f9[_0x84cf('0xb')];_0x3379da['status'](_0x30f1c0)[_0x84cf('0xc')](_0x5bf5f9);};}exports['index']=function(_0x1f7b46,_0x4b9243){return info['getAllData']()[_0x84cf('0xd')](function(_0x38e46c){return _0x4b9243[_0x84cf('0xe')](0xc8)[_0x84cf('0xf')](_0x38e46c);})[_0x84cf('0x10')](function(_0x990acf){return _0x4b9243[_0x84cf('0xe')](0x1f4)[_0x84cf('0xf')](_0x990acf);});};exports[_0x84cf('0x11')]=function(_0x59696f,_0x2f077c){var _0x44160d=[_0x84cf('0x12')];return new BPromise(function(_0x530b7e,_0x18a42e){return exec(util[_0x84cf('0x13')]('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x59696f[_0x84cf('0x14')][_0x84cf('0x15')]),function(_0x579709,_0x1e7e7e,_0x5078b5){if(_0x579709){return _0x18a42e(_0x579709);}return _0x530b7e(_0x1e7e7e);});})[_0x84cf('0xd')](function(_0x2bef26){var _0x2c9d91=![];var _0x2c8449=_0x2bef26[_0x84cf('0x16')](/\n/);for(var _0x4aaf5e=0x0,_0xab36cd=_0x44160d['length'];_0x4aaf5e<_0xab36cd,_0x2c9d91===![];_0x4aaf5e+=0x1){if(_0x2bef26[_0x84cf('0x17')](_0x44160d[_0x4aaf5e])>=0x0){_0x2c9d91=!![];}}if(!_0x2c9d91){throw new Error(util['format'](_0x84cf('0x18'),_0x59696f['params'][_0x84cf('0x15')]));}process[_0x84cf('0x19')](_0x59696f['params'][_0x84cf('0x15')],_0x84cf('0x1a'));return _0x2f077c['status'](0xc8)[_0x84cf('0xf')]({'message':util['format'](_0x84cf('0x1b'),_0x59696f[_0x84cf('0x14')]['pid'])});})[_0x84cf('0x10')](handleError(_0x2f077c,null,_0x84cf('0x11')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 6469ee2..10963d8 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 _0xf65d=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','get','index','isAuthenticated','show','post','create','put','delete','/:id','multer'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf65d,0x9f));var _0xdf65=function(_0x3e0e6c,_0x4757cd){_0x3e0e6c=_0x3e0e6c-0x0;var _0xad2be9=_0xf65d[_0x3e0e6c];return _0xad2be9;};'use strict';var multer=require(_0xdf65('0x0'));var util=require('util');var path=require(_0xdf65('0x1'));var timeout=require(_0xdf65('0x2'));var express=require(_0xdf65('0x3'));var router=express[_0xdf65('0x4')]();var fs_extra=require(_0xdf65('0x5'));var auth=require(_0xdf65('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./tag.controller');router[_0xdf65('0x7')]('/',auth['isAuthenticated'](),controller[_0xdf65('0x8')]);router[_0xdf65('0x7')]('/:id',auth[_0xdf65('0x9')](),controller[_0xdf65('0xa')]);router[_0xdf65('0xb')]('/',auth[_0xdf65('0x9')](),controller[_0xdf65('0xc')]);router[_0xdf65('0xd')]('/:id',auth[_0xdf65('0x9')](),controller['update']);router[_0xdf65('0xe')](_0xdf65('0xf'),auth[_0xdf65('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xee24=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','index','get','/:id','isAuthenticated','post','create','update','exports','multer','util','path','connect-timeout','express'];(function(_0x5ca58f,_0x31ee9a){var _0x59eefb=function(_0x5c90fb){while(--_0x5c90fb){_0x5ca58f['push'](_0x5ca58f['shift']());}};_0x59eefb(++_0x31ee9a);}(_0xee24,0x80));var _0x4ee2=function(_0x4c5e48,_0xc065e){_0x4c5e48=_0x4c5e48-0x0;var _0x39e96d=_0xee24[_0x4c5e48];return _0x39e96d;};'use strict';var multer=require(_0x4ee2('0x0'));var util=require(_0x4ee2('0x1'));var path=require(_0x4ee2('0x2'));var timeout=require(_0x4ee2('0x3'));var express=require(_0x4ee2('0x4'));var router=express[_0x4ee2('0x5')]();var fs_extra=require(_0x4ee2('0x6'));var auth=require(_0x4ee2('0x7'));var interaction=require(_0x4ee2('0x8'));var config=require(_0x4ee2('0x9'));var controller=require(_0x4ee2('0xa'));router['get']('/',auth['isAuthenticated'](),controller[_0x4ee2('0xb')]);router[_0x4ee2('0xc')](_0x4ee2('0xd'),auth[_0x4ee2('0xe')](),controller['show']);router[_0x4ee2('0xf')]('/',auth[_0x4ee2('0xe')](),controller[_0x4ee2('0x10')]);router['put'](_0x4ee2('0xd'),auth['isAuthenticated'](),controller[_0x4ee2('0x11')]);router['delete'](_0x4ee2('0xd'),auth[_0x4ee2('0xe')](),controller['destroy']);module[_0x4ee2('0x12')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index baaca20..3eb9a3b 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 _0x7c59=['exports','STRING','name'];(function(_0x1af103,_0x589885){var _0x324769=function(_0x576c11){while(--_0x576c11){_0x1af103['push'](_0x1af103['shift']());}};_0x324769(++_0x589885);}(_0x7c59,0x147));var _0x97c5=function(_0x10063c,_0x3a8814){_0x10063c=_0x10063c-0x0;var _0x581d02=_0x7c59[_0x10063c];return _0x581d02;};'use strict';var Sequelize=require('sequelize');module[_0x97c5('0x0')]={'name':{'type':Sequelize[_0x97c5('0x1')],'unique':_0x97c5('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x97c5('0x1')],'defaultValue':'#0091EA'},'description':{'type':Sequelize[_0x97c5('0x1')]}}; \ No newline at end of file +var _0x9d9b=['STRING','exports'];(function(_0x209511,_0x231622){var _0x39b937=function(_0x4005a3){while(--_0x4005a3){_0x209511['push'](_0x209511['shift']());}};_0x39b937(++_0x231622);}(_0x9d9b,0x1e1));var _0xb9d9=function(_0x1bd854,_0x83db09){_0x1bd854=_0x1bd854-0x0;var _0x5bb0e8=_0x9d9b[_0x1bd854];return _0x5bb0e8;};'use strict';var Sequelize=require('sequelize');module[_0xb9d9('0x0')]={'name':{'type':Sequelize[_0xb9d9('0x1')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xb9d9('0x1')],'defaultValue':'#0091EA'},'description':{'type':Sequelize[_0xb9d9('0x1')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 57b7093..065d53d 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 _0xe600=['moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','destroy','get','UserProfileResource','stack','name','send','map','rawAttributes','fieldName','type','key','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','Tag','includeAll','include','catch','show','keys','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Tags','UserProfileSection','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','rimraf','fast-json-patch','request-promise'];(function(_0x4ea61a,_0x1eb61b){var _0x46c957=function(_0x591f24){while(--_0x591f24){_0x4ea61a['push'](_0x4ea61a['shift']());}};_0x46c957(++_0x1eb61b);}(_0xe600,0x159));var _0x0e60=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe600[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0e60('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0e60('0x1'));var rp=require(_0x0e60('0x2'));var moment=require(_0x0e60('0x3'));var BPromise=require(_0x0e60('0x4'));var Mustache=require(_0x0e60('0x5'));var util=require(_0x0e60('0x6'));var path=require(_0x0e60('0x7'));var sox=require(_0x0e60('0x8'));var csv=require(_0x0e60('0x9'));var ejs=require(_0x0e60('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0e60('0xb'));var squel=require(_0x0e60('0xc'));var crypto=require(_0x0e60('0xd'));var jsforce=require(_0x0e60('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x0e60('0x9'));var querystring=require(_0x0e60('0xf'));var Papa=require(_0x0e60('0x10'));var Redis=require(_0x0e60('0x11'));var authService=require(_0x0e60('0x12'));var qs=require(_0x0e60('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0e60('0x14'));var logger=require(_0x0e60('0x15'))(_0x0e60('0x16'));var utils=require(_0x0e60('0x17'));var config=require(_0x0e60('0x18'));var licenseUtil=require(_0x0e60('0x19'));var db=require(_0x0e60('0x1a'))['db'];function respondWithStatusCode(_0x2f5ee4,_0x540411){_0x540411=_0x540411||0xcc;return function(_0x2d848f){if(_0x2d848f){return _0x2f5ee4[_0x0e60('0x1b')](_0x540411);}return _0x2f5ee4[_0x0e60('0x1c')](_0x540411)[_0x0e60('0x1d')]();};}function respondWithResult(_0x45328b,_0x37bf95){_0x37bf95=_0x37bf95||0xc8;return function(_0x5d7f84){if(_0x5d7f84){return _0x45328b[_0x0e60('0x1c')](_0x37bf95)['json'](_0x5d7f84);}};}function respondWithFilteredResult(_0x91cd1,_0x128887){return function(_0x170890){if(_0x170890){var _0x5ab4ba=typeof _0x128887[_0x0e60('0x1e')]===_0x0e60('0x1f')&&typeof _0x128887[_0x0e60('0x20')]===_0x0e60('0x1f');var _0x2e6270=_0x170890['count'];var _0x992490=_0x5ab4ba?0x0:_0x128887[_0x0e60('0x1e')];var _0x599c1d=_0x5ab4ba?_0x170890[_0x0e60('0x21')]:_0x128887[_0x0e60('0x1e')]+_0x128887[_0x0e60('0x20')];var _0x504b31;if(_0x599c1d>=_0x2e6270){_0x599c1d=_0x2e6270;_0x504b31=0xc8;}else{_0x504b31=0xce;}_0x91cd1[_0x0e60('0x1c')](_0x504b31);return _0x91cd1['set'](_0x0e60('0x22'),_0x992490+'-'+_0x599c1d+'/'+_0x2e6270)[_0x0e60('0x23')](_0x170890);}return null;};}function patchUpdates(_0xb9f037){return function(_0xabf953){try{jsonpatch[_0x0e60('0x24')](_0xabf953,_0xb9f037,!![]);}catch(_0x31a63e){return BPromise[_0x0e60('0x25')](_0x31a63e);}return _0xabf953[_0x0e60('0x26')]();};}function saveUpdates(_0x352633,_0x10f875){return function(_0x22c0e0){if(_0x22c0e0){return _0x22c0e0[_0x0e60('0x27')](_0x352633)[_0x0e60('0x28')](function(_0x16985f){return _0x16985f;});}return null;};}function removeEntity(_0x4702f,_0x33f9f3){return function(_0x41642c){if(_0x41642c){return _0x41642c[_0x0e60('0x29')]()[_0x0e60('0x28')](function(){var _0x4ba1a8=_0x41642c[_0x0e60('0x2a')]({'plain':!![]});var _0x41ad9a='Tags';return db[_0x0e60('0x2b')]['destroy']({'where':{'type':_0x41ad9a,'resourceId':_0x4ba1a8['id']}})[_0x0e60('0x28')](function(){return _0x41642c;});})['then'](function(){_0x4702f['status'](0xcc)[_0x0e60('0x1d')]();});}};}function handleEntityNotFound(_0x39dae2,_0x526aaa){return function(_0x4eb9b8){if(!_0x4eb9b8){_0x39dae2[_0x0e60('0x1b')](0x194);}return _0x4eb9b8;};}function handleError(_0x54d7ce,_0x73e732){_0x73e732=_0x73e732||0x1f4;return function(_0x548919){logger['error'](_0x548919[_0x0e60('0x2c')]);if(_0x548919[_0x0e60('0x2d')]){delete _0x548919[_0x0e60('0x2d')];}_0x54d7ce['status'](_0x73e732)[_0x0e60('0x2e')](_0x548919);};}exports['index']=function(_0x2e22eb,_0x1d54c0){var _0x5beb5f={},_0x540c2c={},_0xc4a74c={'count':0x0,'rows':[]};var _0x1de60a=_[_0x0e60('0x2f')](db['Tag'][_0x0e60('0x30')],function(_0x3ea4ac){return{'name':_0x3ea4ac[_0x0e60('0x31')],'type':_0x3ea4ac[_0x0e60('0x32')][_0x0e60('0x33')]};});_0x540c2c['model']=_[_0x0e60('0x2f')](_0x1de60a,'name');_0x540c2c[_0x0e60('0x34')]=_['keys'](_0x2e22eb[_0x0e60('0x34')]);_0x540c2c[_0x0e60('0x35')]=_[_0x0e60('0x36')](_0x540c2c['model'],_0x540c2c[_0x0e60('0x34')]);_0x5beb5f[_0x0e60('0x37')]=_[_0x0e60('0x36')](_0x540c2c[_0x0e60('0x38')],qs[_0x0e60('0x39')](_0x2e22eb[_0x0e60('0x34')][_0x0e60('0x39')]));_0x5beb5f[_0x0e60('0x37')]=_0x5beb5f[_0x0e60('0x37')][_0x0e60('0x3a')]?_0x5beb5f[_0x0e60('0x37')]:_0x540c2c[_0x0e60('0x38')];if(!_0x2e22eb['query'][_0x0e60('0x3b')](_0x0e60('0x3c'))){_0x5beb5f[_0x0e60('0x20')]=qs[_0x0e60('0x20')](_0x2e22eb['query']['limit']);_0x5beb5f[_0x0e60('0x1e')]=qs['offset'](_0x2e22eb[_0x0e60('0x34')]['offset']);}_0x5beb5f[_0x0e60('0x3d')]=qs[_0x0e60('0x3e')](_0x2e22eb[_0x0e60('0x34')][_0x0e60('0x3e')]);_0x5beb5f[_0x0e60('0x3f')]=qs[_0x0e60('0x35')](_[_0x0e60('0x40')](_0x2e22eb[_0x0e60('0x34')],_0x540c2c[_0x0e60('0x35')]),_0x1de60a);if(_0x2e22eb[_0x0e60('0x34')][_0x0e60('0x41')]){_0x5beb5f[_0x0e60('0x3f')]=_['merge'](_0x5beb5f[_0x0e60('0x3f')],{'$or':_['map'](_0x1de60a,function(_0x345a12){if(_0x345a12[_0x0e60('0x32')]!=='VIRTUAL'){var _0x482583={};_0x482583[_0x345a12[_0x0e60('0x2d')]]={'$like':'%'+_0x2e22eb[_0x0e60('0x34')]['filter']+'%'};return _0x482583;}})});}_0x5beb5f=_[_0x0e60('0x42')]({},_0x5beb5f,_0x2e22eb[_0x0e60('0x43')]);var _0x50090c={'where':_0x5beb5f[_0x0e60('0x3f')]};return db[_0x0e60('0x44')][_0x0e60('0x21')](_0x50090c)[_0x0e60('0x28')](function(_0x3ac0f0){_0xc4a74c[_0x0e60('0x21')]=_0x3ac0f0;if(_0x2e22eb[_0x0e60('0x34')][_0x0e60('0x45')]){_0x5beb5f[_0x0e60('0x46')]=[{'all':!![]}];}return db['Tag']['findAll'](_0x5beb5f);})['then'](function(_0x39c7d4){_0xc4a74c['rows']=_0x39c7d4;return _0xc4a74c;})[_0x0e60('0x28')](respondWithFilteredResult(_0x1d54c0,_0x5beb5f))[_0x0e60('0x47')](handleError(_0x1d54c0,null));};exports[_0x0e60('0x48')]=function(_0x4bfebf,_0x2b2354){var _0x2432a8={'raw':!![],'where':{'id':_0x4bfebf['params']['id']}},_0x4ce029={};_0x4ce029[_0x0e60('0x38')]=_[_0x0e60('0x49')](db[_0x0e60('0x44')][_0x0e60('0x30')]);_0x4ce029[_0x0e60('0x34')]=_[_0x0e60('0x49')](_0x4bfebf['query']);_0x4ce029[_0x0e60('0x35')]=_[_0x0e60('0x36')](_0x4ce029[_0x0e60('0x38')],_0x4ce029[_0x0e60('0x34')]);_0x2432a8[_0x0e60('0x37')]=_['intersection'](_0x4ce029['model'],qs['fields'](_0x4bfebf[_0x0e60('0x34')][_0x0e60('0x39')]));_0x2432a8[_0x0e60('0x37')]=_0x2432a8[_0x0e60('0x37')]['length']?_0x2432a8['attributes']:_0x4ce029['model'];if(_0x4bfebf[_0x0e60('0x34')][_0x0e60('0x45')]){_0x2432a8[_0x0e60('0x46')]=[{'all':!![]}];}_0x2432a8=_[_0x0e60('0x42')]({},_0x2432a8,_0x4bfebf[_0x0e60('0x43')]);return db['Tag']['find'](_0x2432a8)[_0x0e60('0x28')](handleEntityNotFound(_0x2b2354,null))[_0x0e60('0x28')](respondWithResult(_0x2b2354,null))[_0x0e60('0x47')](handleError(_0x2b2354,null));};exports[_0x0e60('0x4a')]=function(_0x4ad156,_0x36a999){return db[_0x0e60('0x44')][_0x0e60('0x4a')](_0x4ad156['body'],{})[_0x0e60('0x28')](function(_0xc6cee0){var _0x5e710d=_0x4ad156[_0x0e60('0x4b')]['get']({'plain':!![]});if(!_0x5e710d)throw new Error(_0x0e60('0x4c'));if(_0x5e710d[_0x0e60('0x4d')]===_0x0e60('0x4b')){var _0x2e887c=_0xc6cee0[_0x0e60('0x2a')]({'plain':!![]});var _0x4caeed=_0x0e60('0x4e');return db[_0x0e60('0x4f')][_0x0e60('0x50')]({'where':{'name':_0x4caeed,'userProfileId':_0x5e710d[_0x0e60('0x51')]},'raw':!![]})['then'](function(_0x19d7bc){if(_0x19d7bc&&_0x19d7bc[_0x0e60('0x52')]===0x0){return db[_0x0e60('0x2b')][_0x0e60('0x4a')]({'name':_0x2e887c['name'],'resourceId':_0x2e887c['id'],'type':_0x19d7bc[_0x0e60('0x2d')],'sectionId':_0x19d7bc['id']},{})['then'](function(){return _0xc6cee0;});}else{return _0xc6cee0;}})[_0x0e60('0x47')](function(_0x707dc6){logger[_0x0e60('0x53')](_0x0e60('0x54'),_0x707dc6);throw _0x707dc6;});}return _0xc6cee0;})[_0x0e60('0x28')](respondWithResult(_0x36a999,0xc9))[_0x0e60('0x47')](handleError(_0x36a999,null));};exports[_0x0e60('0x27')]=function(_0x49daf6,_0x124b8e){if(_0x49daf6['body']['id']){delete _0x49daf6[_0x0e60('0x55')]['id'];}return db[_0x0e60('0x44')][_0x0e60('0x50')]({'where':{'id':_0x49daf6[_0x0e60('0x56')]['id']}})['then'](handleEntityNotFound(_0x124b8e,null))['then'](saveUpdates(_0x49daf6[_0x0e60('0x55')],null))['then'](respondWithResult(_0x124b8e,null))[_0x0e60('0x47')](handleError(_0x124b8e,null));};exports[_0x0e60('0x29')]=function(_0x313dd2,_0x24ada9){return db[_0x0e60('0x44')][_0x0e60('0x50')]({'where':{'id':_0x313dd2[_0x0e60('0x56')]['id']}})[_0x0e60('0x28')](handleEntityNotFound(_0x24ada9,null))['then'](removeEntity(_0x24ada9,null))[_0x0e60('0x47')](handleError(_0x24ada9,null));}; \ No newline at end of file +var _0x68fc=['params','eml-format','rimraf','zip-dir','moment','mustache','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','limit','undefined','count','offset','set','Content-Range','apply','save','update','then','get','Tags','destroy','end','error','stack','name','send','index','map','Tag','fieldName','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','rawAttributes','find','role','user','UserProfileSection','userProfileId','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body'];(function(_0x203416,_0x4f30fa){var _0x431296=function(_0x27a78c){while(--_0x27a78c){_0x203416['push'](_0x203416['shift']());}};_0x431296(++_0x4f30fa);}(_0x68fc,0xa5));var _0xc68f=function(_0x21bf66,_0x1b7270){_0x21bf66=_0x21bf66-0x0;var _0x320684=_0x68fc[_0x21bf66];return _0x320684;};'use strict';var emlformat=require(_0xc68f('0x0'));var rimraf=require(_0xc68f('0x1'));var zipdir=require(_0xc68f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xc68f('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xc68f('0x4'));var util=require('util');var path=require('path');var sox=require(_0xc68f('0x5'));var csv=require(_0xc68f('0x6'));var ejs=require(_0xc68f('0x7'));var fs=require('fs');var fs_extra=require(_0xc68f('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xc68f('0x9'));var jsforce=require(_0xc68f('0xa'));var deskjs=require(_0xc68f('0xb'));var toCsv=require(_0xc68f('0x6'));var querystring=require(_0xc68f('0xc'));var Papa=require(_0xc68f('0xd'));var Redis=require(_0xc68f('0xe'));var authService=require(_0xc68f('0xf'));var qs=require(_0xc68f('0x10'));var as=require(_0xc68f('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc68f('0x12'))(_0xc68f('0x13'));var utils=require(_0xc68f('0x14'));var config=require(_0xc68f('0x15'));var licenseUtil=require(_0xc68f('0x16'));var db=require(_0xc68f('0x17'))['db'];function respondWithStatusCode(_0x3ccebe,_0x41aeb8){_0x41aeb8=_0x41aeb8||0xcc;return function(_0x151bde){if(_0x151bde){return _0x3ccebe[_0xc68f('0x18')](_0x41aeb8);}return _0x3ccebe[_0xc68f('0x19')](_0x41aeb8)['end']();};}function respondWithResult(_0x2ea1c4,_0x90ccbd){_0x90ccbd=_0x90ccbd||0xc8;return function(_0x2b1d30){if(_0x2b1d30){return _0x2ea1c4[_0xc68f('0x19')](_0x90ccbd)[_0xc68f('0x1a')](_0x2b1d30);}};}function respondWithFilteredResult(_0x2673b4,_0x3d1406){return function(_0x209d16){if(_0x209d16){var _0x4648c6=typeof _0x3d1406['offset']==='undefined'&&typeof _0x3d1406[_0xc68f('0x1b')]===_0xc68f('0x1c');var _0x171eea=_0x209d16[_0xc68f('0x1d')];var _0x2d9d85=_0x4648c6?0x0:_0x3d1406[_0xc68f('0x1e')];var _0x50fab4=_0x4648c6?_0x209d16[_0xc68f('0x1d')]:_0x3d1406[_0xc68f('0x1e')]+_0x3d1406[_0xc68f('0x1b')];var _0x2c058c;if(_0x50fab4>=_0x171eea){_0x50fab4=_0x171eea;_0x2c058c=0xc8;}else{_0x2c058c=0xce;}_0x2673b4[_0xc68f('0x19')](_0x2c058c);return _0x2673b4[_0xc68f('0x1f')](_0xc68f('0x20'),_0x2d9d85+'-'+_0x50fab4+'/'+_0x171eea)[_0xc68f('0x1a')](_0x209d16);}return null;};}function patchUpdates(_0x582301){return function(_0xcc11a3){try{jsonpatch[_0xc68f('0x21')](_0xcc11a3,_0x582301,!![]);}catch(_0x2e27b9){return BPromise['reject'](_0x2e27b9);}return _0xcc11a3[_0xc68f('0x22')]();};}function saveUpdates(_0x1daac5,_0x116203){return function(_0x2064db){if(_0x2064db){return _0x2064db[_0xc68f('0x23')](_0x1daac5)[_0xc68f('0x24')](function(_0x2412a9){return _0x2412a9;});}return null;};}function removeEntity(_0x547d46,_0x38c3a0){return function(_0x288957){if(_0x288957){return _0x288957['destroy']()[_0xc68f('0x24')](function(){var _0x8399e6=_0x288957[_0xc68f('0x25')]({'plain':!![]});var _0x44c4b2=_0xc68f('0x26');return db['UserProfileResource'][_0xc68f('0x27')]({'where':{'type':_0x44c4b2,'resourceId':_0x8399e6['id']}})[_0xc68f('0x24')](function(){return _0x288957;});})['then'](function(){_0x547d46[_0xc68f('0x19')](0xcc)[_0xc68f('0x28')]();});}};}function handleEntityNotFound(_0x4d26e3,_0x3f6c07){return function(_0xdde47e){if(!_0xdde47e){_0x4d26e3[_0xc68f('0x18')](0x194);}return _0xdde47e;};}function handleError(_0x3abc1e,_0x58dd95){_0x58dd95=_0x58dd95||0x1f4;return function(_0x477a1c){logger[_0xc68f('0x29')](_0x477a1c[_0xc68f('0x2a')]);if(_0x477a1c[_0xc68f('0x2b')]){delete _0x477a1c[_0xc68f('0x2b')];}_0x3abc1e[_0xc68f('0x19')](_0x58dd95)[_0xc68f('0x2c')](_0x477a1c);};}exports[_0xc68f('0x2d')]=function(_0x4bb052,_0x37f947){var _0x352eb9={},_0x4b64da={},_0x323677={'count':0x0,'rows':[]};var _0x6d2d34=_[_0xc68f('0x2e')](db[_0xc68f('0x2f')]['rawAttributes'],function(_0x1deee7){return{'name':_0x1deee7[_0xc68f('0x30')],'type':_0x1deee7['type'][_0xc68f('0x31')]};});_0x4b64da[_0xc68f('0x32')]=_[_0xc68f('0x2e')](_0x6d2d34,_0xc68f('0x2b'));_0x4b64da[_0xc68f('0x33')]=_['keys'](_0x4bb052['query']);_0x4b64da[_0xc68f('0x34')]=_[_0xc68f('0x35')](_0x4b64da[_0xc68f('0x32')],_0x4b64da[_0xc68f('0x33')]);_0x352eb9[_0xc68f('0x36')]=_['intersection'](_0x4b64da['model'],qs[_0xc68f('0x37')](_0x4bb052['query'][_0xc68f('0x37')]));_0x352eb9[_0xc68f('0x36')]=_0x352eb9[_0xc68f('0x36')][_0xc68f('0x38')]?_0x352eb9[_0xc68f('0x36')]:_0x4b64da[_0xc68f('0x32')];if(!_0x4bb052[_0xc68f('0x33')]['hasOwnProperty'](_0xc68f('0x39'))){_0x352eb9[_0xc68f('0x1b')]=qs[_0xc68f('0x1b')](_0x4bb052[_0xc68f('0x33')][_0xc68f('0x1b')]);_0x352eb9[_0xc68f('0x1e')]=qs[_0xc68f('0x1e')](_0x4bb052[_0xc68f('0x33')][_0xc68f('0x1e')]);}_0x352eb9[_0xc68f('0x3a')]=qs[_0xc68f('0x3b')](_0x4bb052['query']['sort']);_0x352eb9['where']=qs[_0xc68f('0x34')](_[_0xc68f('0x3c')](_0x4bb052[_0xc68f('0x33')],_0x4b64da[_0xc68f('0x34')]),_0x6d2d34);if(_0x4bb052['query'][_0xc68f('0x3d')]){_0x352eb9[_0xc68f('0x3e')]=_[_0xc68f('0x3f')](_0x352eb9['where'],{'$or':_[_0xc68f('0x2e')](_0x6d2d34,function(_0x4386cb){if(_0x4386cb['type']!==_0xc68f('0x40')){var _0x236684={};_0x236684[_0x4386cb[_0xc68f('0x2b')]]={'$like':'%'+_0x4bb052['query'][_0xc68f('0x3d')]+'%'};return _0x236684;}})});}_0x352eb9=_[_0xc68f('0x3f')]({},_0x352eb9,_0x4bb052[_0xc68f('0x41')]);var _0x1615e6={'where':_0x352eb9[_0xc68f('0x3e')]};return db[_0xc68f('0x2f')][_0xc68f('0x1d')](_0x1615e6)['then'](function(_0x192942){_0x323677[_0xc68f('0x1d')]=_0x192942;if(_0x4bb052[_0xc68f('0x33')][_0xc68f('0x42')]){_0x352eb9[_0xc68f('0x43')]=[{'all':!![]}];}return db[_0xc68f('0x2f')][_0xc68f('0x44')](_0x352eb9);})[_0xc68f('0x24')](function(_0x1e8141){_0x323677['rows']=_0x1e8141;return _0x323677;})[_0xc68f('0x24')](respondWithFilteredResult(_0x37f947,_0x352eb9))[_0xc68f('0x45')](handleError(_0x37f947,null));};exports[_0xc68f('0x46')]=function(_0x34a889,_0x45782f){var _0x3683c0={'raw':!![],'where':{'id':_0x34a889['params']['id']}},_0x3e7b43={};_0x3e7b43[_0xc68f('0x32')]=_['keys'](db['Tag'][_0xc68f('0x47')]);_0x3e7b43[_0xc68f('0x33')]=_['keys'](_0x34a889['query']);_0x3e7b43[_0xc68f('0x34')]=_[_0xc68f('0x35')](_0x3e7b43[_0xc68f('0x32')],_0x3e7b43[_0xc68f('0x33')]);_0x3683c0[_0xc68f('0x36')]=_[_0xc68f('0x35')](_0x3e7b43[_0xc68f('0x32')],qs[_0xc68f('0x37')](_0x34a889[_0xc68f('0x33')][_0xc68f('0x37')]));_0x3683c0[_0xc68f('0x36')]=_0x3683c0['attributes'][_0xc68f('0x38')]?_0x3683c0['attributes']:_0x3e7b43[_0xc68f('0x32')];if(_0x34a889[_0xc68f('0x33')]['includeAll']){_0x3683c0[_0xc68f('0x43')]=[{'all':!![]}];}_0x3683c0=_[_0xc68f('0x3f')]({},_0x3683c0,_0x34a889[_0xc68f('0x41')]);return db[_0xc68f('0x2f')][_0xc68f('0x48')](_0x3683c0)[_0xc68f('0x24')](handleEntityNotFound(_0x45782f,null))[_0xc68f('0x24')](respondWithResult(_0x45782f,null))[_0xc68f('0x45')](handleError(_0x45782f,null));};exports['create']=function(_0x2920d5,_0x15eaa2){return db[_0xc68f('0x2f')]['create'](_0x2920d5['body'],{})['then'](function(_0x27ca32){var _0x237327=_0x2920d5['user'][_0xc68f('0x25')]({'plain':!![]});if(!_0x237327)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x237327[_0xc68f('0x49')]===_0xc68f('0x4a')){var _0x44efa8=_0x27ca32[_0xc68f('0x25')]({'plain':!![]});var _0x3b9a4c=_0xc68f('0x26');return db[_0xc68f('0x4b')][_0xc68f('0x48')]({'where':{'name':_0x3b9a4c,'userProfileId':_0x237327[_0xc68f('0x4c')]},'raw':!![]})[_0xc68f('0x24')](function(_0x1374e0){if(_0x1374e0&&_0x1374e0['autoAssociation']===0x0){return db[_0xc68f('0x4d')][_0xc68f('0x4e')]({'name':_0x44efa8['name'],'resourceId':_0x44efa8['id'],'type':_0x1374e0['name'],'sectionId':_0x1374e0['id']},{})[_0xc68f('0x24')](function(){return _0x27ca32;});}else{return _0x27ca32;}})[_0xc68f('0x45')](function(_0xa9c6b1){logger['error'](_0xc68f('0x4f'),_0xa9c6b1);throw _0xa9c6b1;});}return _0x27ca32;})[_0xc68f('0x24')](respondWithResult(_0x15eaa2,0xc9))['catch'](handleError(_0x15eaa2,null));};exports['update']=function(_0x2eb1e8,_0x4281a5){if(_0x2eb1e8[_0xc68f('0x50')]['id']){delete _0x2eb1e8[_0xc68f('0x50')]['id'];}return db[_0xc68f('0x2f')][_0xc68f('0x48')]({'where':{'id':_0x2eb1e8[_0xc68f('0x51')]['id']}})[_0xc68f('0x24')](handleEntityNotFound(_0x4281a5,null))[_0xc68f('0x24')](saveUpdates(_0x2eb1e8[_0xc68f('0x50')],null))[_0xc68f('0x24')](respondWithResult(_0x4281a5,null))[_0xc68f('0x45')](handleError(_0x4281a5,null));};exports[_0xc68f('0x27')]=function(_0x331d9b,_0x23ebdd){return db[_0xc68f('0x2f')][_0xc68f('0x48')]({'where':{'id':_0x331d9b[_0xc68f('0x51')]['id']}})[_0xc68f('0x24')](handleEntityNotFound(_0x23ebdd,null))[_0xc68f('0x24')](removeEntity(_0x23ebdd,null))[_0xc68f('0x45')](handleError(_0x23ebdd,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 2ded2fc..a981ba9 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 _0x1a1f=['util','api','moment','bluebird','path','rimraf','../../config/environment','./tag.attributes','exports','define','Tag','tools_tags'];(function(_0x7e48b3,_0x51dae5){var _0xabaa46=function(_0x3c63a8){while(--_0x3c63a8){_0x7e48b3['push'](_0x7e48b3['shift']());}};_0xabaa46(++_0x51dae5);}(_0x1a1f,0x180));var _0xf1a1=function(_0x468f0e,_0x1462a0){_0x468f0e=_0x468f0e-0x0;var _0x19a66b=_0x1a1f[_0x468f0e];return _0x19a66b;};'use strict';var _=require('lodash');var util=require(_0xf1a1('0x0'));var logger=require('../../config/logger')(_0xf1a1('0x1'));var moment=require(_0xf1a1('0x2'));var BPromise=require(_0xf1a1('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf1a1('0x4'));var rimraf=require(_0xf1a1('0x5'));var config=require(_0xf1a1('0x6'));var attributes=require(_0xf1a1('0x7'));module[_0xf1a1('0x8')]=function(_0x5a25e2,_0x316fd8){return _0x5a25e2[_0xf1a1('0x9')](_0xf1a1('0xa'),attributes,{'tableName':_0xf1a1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0c66=['../../config/environment','./tag.attributes','exports','Tag','tools_tags','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf'];(function(_0x1400ca,_0x4b79cc){var _0x43e66d=function(_0xbe6ebb){while(--_0xbe6ebb){_0x1400ca['push'](_0x1400ca['shift']());}};_0x43e66d(++_0x4b79cc);}(_0x0c66,0x161));var _0x60c6=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x0c66[_0x3e5086];return _0xfeb102;};'use strict';var _=require(_0x60c6('0x0'));var util=require(_0x60c6('0x1'));var logger=require(_0x60c6('0x2'))('api');var moment=require(_0x60c6('0x3'));var BPromise=require(_0x60c6('0x4'));var rp=require(_0x60c6('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x60c6('0x6'));var config=require(_0x60c6('0x7'));var attributes=require(_0x60c6('0x8'));module[_0x60c6('0x9')]=function(_0x7543ca,_0x3d9367){return _0x7543ca['define'](_0x60c6('0xa'),attributes,{'tableName':_0x60c6('0xb'),'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 bdf1ce1..72a4dc2 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 _0x9c44=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','request\x20sent','debug','stringify','code','error','message','Tag,\x20%s,\x20%s','info','result','catch','moment','bluebird'];(function(_0x2f9310,_0x2856a8){var _0xe4d8e6=function(_0x3d9135){while(--_0x3d9135){_0x2f9310['push'](_0x2f9310['shift']());}};_0xe4d8e6(++_0x2856a8);}(_0x9c44,0x178));var _0x49c4=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x9c44[_0x1969a7];return _0x3d665f;};'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']('Tag,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));logger[_0x49c4('0xc')]('Tag,\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')]('Tag,\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')]('Tag,\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 _0xcb99=['moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','then','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','Tag,\x20%s,\x20%s','message','info','result','catch','lodash'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xcb99,0x8b));var _0x9cb9=function(_0x12d2d7,_0x253ea8){_0x12d2d7=_0x12d2d7-0x0;var _0x1defcb=_0xcb99[_0x12d2d7];return _0x1defcb;};'use strict';var _=require(_0x9cb9('0x0'));var util=require('util');var moment=require(_0x9cb9('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9cb9('0x2'));var db=require(_0x9cb9('0x3'))['db'];var utils=require(_0x9cb9('0x4'));var logger=require('../../config/logger')(_0x9cb9('0x5'));var config=require(_0x9cb9('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x9cb9('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2ed26a,_0xa84493,_0x1bf9b7){return new BPromise(function(_0x1dd62f,_0x82e3e){return client[_0x9cb9('0x8')](_0x2ed26a,_0x1bf9b7)[_0x9cb9('0x9')](function(_0x3da50b){logger['info']('Tag,\x20%s,\x20%s',_0xa84493,_0x9cb9('0xa'));logger[_0x9cb9('0xb')](_0x9cb9('0xc'),_0xa84493,'request\x20sent',JSON[_0x9cb9('0xd')](_0x3da50b));if(_0x3da50b[_0x9cb9('0xe')]){if(_0x3da50b['error']['code']===0x1f4){logger[_0x9cb9('0xe')](_0x9cb9('0xf'),_0xa84493,_0x3da50b[_0x9cb9('0xe')][_0x9cb9('0x10')]);return _0x82e3e(_0x3da50b['error'][_0x9cb9('0x10')]);}logger[_0x9cb9('0xe')](_0x9cb9('0xf'),_0xa84493,_0x3da50b[_0x9cb9('0xe')][_0x9cb9('0x10')]);return _0x1dd62f(_0x3da50b[_0x9cb9('0xe')][_0x9cb9('0x10')]);}else{logger[_0x9cb9('0x11')](_0x9cb9('0xf'),_0xa84493,_0x9cb9('0xa'));_0x1dd62f(_0x3da50b[_0x9cb9('0x12')][_0x9cb9('0x10')]);}})[_0x9cb9('0x13')](function(_0x140910){logger[_0x9cb9('0xe')](_0x9cb9('0xf'),_0xa84493,_0x140910);_0x82e3e(_0x140910);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 3ef9b8c..18b61fa 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(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa9e0[_0x501510];return _0x1e6ee5;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));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(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['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 e792fdc..38c6ad7 100644 --- a/server/api/team/team.attributes.js +++ b/server/api/team/team.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['name','sequelize','STRING'];(function(_0x215082,_0x521b61){var _0x2152cd=function(_0x379971){while(--_0x379971){_0x215082['push'](_0x215082['shift']());}};_0x2152cd(++_0x521b61);}(_0xb10b,0x12a));var _0xbb10=function(_0x18b56f,_0x2d8823){_0x18b56f=_0x18b56f-0x0;var _0x4df0e0=_0xb10b[_0x18b56f];return _0x4df0e0;};'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(_0x57bbd7,_0x5ada0d){var _0x476213=function(_0x416a01){while(--_0x416a01){_0x57bbd7['push'](_0x57bbd7['shift']());}};_0x476213(++_0x5ada0d);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'unique':_0x3071('0x1')},'description':{'type':Sequelize[_0x3071('0x0')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 0c98333..20b2582 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 _0x6f88=['key','name','query','keys','filters','intersection','attributes','fields','length','sort','filter','where','VIRTUAL','options','Team','then','includeAll','include','findAll','catch','show','params','model','merge','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Teams','UserProfileSection','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','sequelize','transaction','Sequelize','QueryTypes','SELECT','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','UserMailQueue','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','OpenchannelQueueId','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserVoicePrefix','VoicePrefixId','end','getQueues','findOne','channel','isValidChannel','ValidationError','Unknown\x20channel','capitalize','Queue','order','toLowerCase','Queues','removeQueues','remove','ids','addAgents','isArray','Voice','Sms','Openchannel','through','penalty','QueueId','User','findOrCreate','emit','Queue:save','online','voicePause','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','interface','TeamVoiceQueue','all','TeamVoicePrefix','spread','removeAgents','Chat','Mail','Fax','Queue:remove','pick','getAgents','hasOwnProperty','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./team.socket','register','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','sendStatus','error','stack','send','index','map','rawAttributes','fieldName','type'];(function(_0xd1a252,_0x16396f){var _0x560ee1=function(_0x35dd90){while(--_0x35dd90){_0xd1a252['push'](_0xd1a252['shift']());}};_0x560ee1(++_0x16396f);}(_0x6f88,0x1a8));var _0x86f8=function(_0x2bf5c0,_0x116255){_0x2bf5c0=_0x2bf5c0-0x0;var _0x36c63c=_0x6f88[_0x2bf5c0];return _0x36c63c;};'use strict';var emlformat=require(_0x86f8('0x0'));var rimraf=require(_0x86f8('0x1'));var zipdir=require(_0x86f8('0x2'));var jsonpatch=require(_0x86f8('0x3'));var rp=require(_0x86f8('0x4'));var moment=require('moment');var BPromise=require(_0x86f8('0x5'));var Mustache=require(_0x86f8('0x6'));var util=require(_0x86f8('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x86f8('0x8'));var ejs=require(_0x86f8('0x9'));var fs=require('fs');var fs_extra=require(_0x86f8('0xa'));var _=require('lodash');var squel=require(_0x86f8('0xb'));var crypto=require('crypto');var jsforce=require(_0x86f8('0xc'));var deskjs=require(_0x86f8('0xd'));var toCsv=require(_0x86f8('0x8'));var querystring=require(_0x86f8('0xe'));var Papa=require('papaparse');var Redis=require(_0x86f8('0xf'));var authService=require(_0x86f8('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x86f8('0x11'));var hardwareService=require(_0x86f8('0x12'));var logger=require(_0x86f8('0x13'))('api');var utils=require(_0x86f8('0x14'));var config=require(_0x86f8('0x15'));var licenseUtil=require(_0x86f8('0x16'));var db=require('../../mysqldb')['db'];config[_0x86f8('0x17')]=_[_0x86f8('0x18')](config[_0x86f8('0x17')],{'host':_0x86f8('0x19'),'port':0x18eb});var socket=require(_0x86f8('0x1a'))(new Redis(config[_0x86f8('0x17')]));require(_0x86f8('0x1b'))[_0x86f8('0x1c')](socket);function respondWithStatusCode(_0x5eaa43,_0x425c5b){_0x425c5b=_0x425c5b||0xcc;return function(_0x21a772){if(_0x21a772){return _0x5eaa43['sendStatus'](_0x425c5b);}return _0x5eaa43[_0x86f8('0x1d')](_0x425c5b)['end']();};}function respondWithResult(_0x4ec96a,_0x545f8c){_0x545f8c=_0x545f8c||0xc8;return function(_0x5d36d9){if(_0x5d36d9){return _0x4ec96a[_0x86f8('0x1d')](_0x545f8c)[_0x86f8('0x1e')](_0x5d36d9);}};}function respondWithFilteredResult(_0x47db25,_0x5e53ae){return function(_0x43db4f){if(_0x43db4f){var _0x2d5b36=typeof _0x5e53ae[_0x86f8('0x1f')]===_0x86f8('0x20')&&typeof _0x5e53ae[_0x86f8('0x21')]===_0x86f8('0x20');var _0x3154b5=_0x43db4f['count'];var _0x25c042=_0x2d5b36?0x0:_0x5e53ae['offset'];var _0x13af26=_0x2d5b36?_0x43db4f[_0x86f8('0x22')]:_0x5e53ae['offset']+_0x5e53ae[_0x86f8('0x21')];var _0xc20320;if(_0x13af26>=_0x3154b5){_0x13af26=_0x3154b5;_0xc20320=0xc8;}else{_0xc20320=0xce;}_0x47db25[_0x86f8('0x1d')](_0xc20320);return _0x47db25[_0x86f8('0x23')](_0x86f8('0x24'),_0x25c042+'-'+_0x13af26+'/'+_0x3154b5)[_0x86f8('0x1e')](_0x43db4f);}return null;};}function patchUpdates(_0x339787){return function(_0x1fde5e){try{jsonpatch[_0x86f8('0x25')](_0x1fde5e,_0x339787,!![]);}catch(_0x3c0767){return BPromise[_0x86f8('0x26')](_0x3c0767);}return _0x1fde5e[_0x86f8('0x27')]();};}function saveUpdates(_0xbcf9b5,_0x1a7413){return function(_0x5e3f3e){if(_0x5e3f3e){return _0x5e3f3e[_0x86f8('0x28')](_0xbcf9b5)['then'](function(_0xbdd944){return _0xbdd944;});}return null;};}function handleEntityNotFound(_0xa55878,_0x562e79){return function(_0x1bda64){if(!_0x1bda64){_0xa55878[_0x86f8('0x29')](0x194);}return _0x1bda64;};}function handleError(_0x5880db,_0x352734){_0x352734=_0x352734||0x1f4;return function(_0x6dbb5e){logger[_0x86f8('0x2a')](_0x6dbb5e[_0x86f8('0x2b')]);if(_0x6dbb5e['name']){delete _0x6dbb5e['name'];}_0x5880db[_0x86f8('0x1d')](_0x352734)[_0x86f8('0x2c')](_0x6dbb5e);};}exports[_0x86f8('0x2d')]=function(_0x31ed90,_0x30eb71){var _0x566184={},_0x3f366d={},_0x4b17f5={'count':0x0,'rows':[]};var _0x1603dd=_[_0x86f8('0x2e')](db['Team'][_0x86f8('0x2f')],function(_0xde0899){return{'name':_0xde0899[_0x86f8('0x30')],'type':_0xde0899[_0x86f8('0x31')][_0x86f8('0x32')]};});_0x3f366d['model']=_[_0x86f8('0x2e')](_0x1603dd,_0x86f8('0x33'));_0x3f366d[_0x86f8('0x34')]=_[_0x86f8('0x35')](_0x31ed90[_0x86f8('0x34')]);_0x3f366d[_0x86f8('0x36')]=_[_0x86f8('0x37')](_0x3f366d['model'],_0x3f366d['query']);_0x566184[_0x86f8('0x38')]=_[_0x86f8('0x37')](_0x3f366d['model'],qs[_0x86f8('0x39')](_0x31ed90['query'][_0x86f8('0x39')]));_0x566184['attributes']=_0x566184[_0x86f8('0x38')][_0x86f8('0x3a')]?_0x566184[_0x86f8('0x38')]:_0x3f366d['model'];if(!_0x31ed90[_0x86f8('0x34')]['hasOwnProperty']('nolimit')){_0x566184[_0x86f8('0x21')]=qs['limit'](_0x31ed90[_0x86f8('0x34')][_0x86f8('0x21')]);_0x566184[_0x86f8('0x1f')]=qs[_0x86f8('0x1f')](_0x31ed90['query'][_0x86f8('0x1f')]);}_0x566184['order']=qs['sort'](_0x31ed90[_0x86f8('0x34')][_0x86f8('0x3b')]);_0x566184['where']=qs[_0x86f8('0x36')](_['pick'](_0x31ed90['query'],_0x3f366d[_0x86f8('0x36')]),_0x1603dd);if(_0x31ed90[_0x86f8('0x34')][_0x86f8('0x3c')]){_0x566184[_0x86f8('0x3d')]=_['merge'](_0x566184[_0x86f8('0x3d')],{'$or':_[_0x86f8('0x2e')](_0x1603dd,function(_0x10b254){if(_0x10b254['type']!==_0x86f8('0x3e')){var _0x55e615={};_0x55e615[_0x10b254['name']]={'$like':'%'+_0x31ed90[_0x86f8('0x34')][_0x86f8('0x3c')]+'%'};return _0x55e615;}})});}_0x566184=_['merge']({},_0x566184,_0x31ed90[_0x86f8('0x3f')]);var _0x19b350={'where':_0x566184['where']};return db[_0x86f8('0x40')][_0x86f8('0x22')](_0x19b350)[_0x86f8('0x41')](function(_0x463cfc){_0x4b17f5[_0x86f8('0x22')]=_0x463cfc;if(_0x31ed90['query'][_0x86f8('0x42')]){_0x566184[_0x86f8('0x43')]=[{'all':!![]}];}return db[_0x86f8('0x40')][_0x86f8('0x44')](_0x566184);})['then'](function(_0x438c78){_0x4b17f5['rows']=_0x438c78;return _0x4b17f5;})['then'](respondWithFilteredResult(_0x30eb71,_0x566184))[_0x86f8('0x45')](handleError(_0x30eb71,null));};exports[_0x86f8('0x46')]=function(_0x32384c,_0x5d1700){var _0x23d4e1={'raw':![],'where':{'id':_0x32384c[_0x86f8('0x47')]['id']}},_0x2035d3={};_0x2035d3[_0x86f8('0x48')]=_[_0x86f8('0x35')](db[_0x86f8('0x40')][_0x86f8('0x2f')]);_0x2035d3[_0x86f8('0x34')]=_['keys'](_0x32384c['query']);_0x2035d3[_0x86f8('0x36')]=_[_0x86f8('0x37')](_0x2035d3['model'],_0x2035d3[_0x86f8('0x34')]);_0x23d4e1['attributes']=_[_0x86f8('0x37')](_0x2035d3[_0x86f8('0x48')],qs[_0x86f8('0x39')](_0x32384c[_0x86f8('0x34')][_0x86f8('0x39')]));_0x23d4e1[_0x86f8('0x38')]=_0x23d4e1[_0x86f8('0x38')][_0x86f8('0x3a')]?_0x23d4e1[_0x86f8('0x38')]:_0x2035d3[_0x86f8('0x48')];if(_0x32384c[_0x86f8('0x34')][_0x86f8('0x42')]){_0x23d4e1[_0x86f8('0x43')]=[{'all':!![]}];}_0x23d4e1=_[_0x86f8('0x49')]({},_0x23d4e1,_0x32384c[_0x86f8('0x3f')]);return db[_0x86f8('0x40')][_0x86f8('0x4a')](_0x23d4e1)[_0x86f8('0x41')](handleEntityNotFound(_0x5d1700,null))['then'](respondWithResult(_0x5d1700,null))[_0x86f8('0x45')](handleError(_0x5d1700,null));};exports[_0x86f8('0x4b')]=function(_0xb4d74d,_0x9e483e){return db['Team'][_0x86f8('0x4b')](_0xb4d74d[_0x86f8('0x4c')],{})[_0x86f8('0x41')](function(_0x4b2c68){var _0x23f61c=_0xb4d74d[_0x86f8('0x4d')][_0x86f8('0x4e')]({'plain':!![]});if(!_0x23f61c)throw new Error(_0x86f8('0x4f'));if(_0x23f61c[_0x86f8('0x50')]===_0x86f8('0x4d')){var _0x3e1d64=_0x4b2c68[_0x86f8('0x4e')]({'plain':!![]});var _0xa9f2de=_0x86f8('0x51');return db[_0x86f8('0x52')][_0x86f8('0x4a')]({'where':{'name':_0xa9f2de,'userProfileId':_0x23f61c['userProfileId']},'raw':!![]})[_0x86f8('0x41')](function(_0x36ab2b){if(_0x36ab2b&&_0x36ab2b['autoAssociation']===0x0){return db[_0x86f8('0x53')]['create']({'name':_0x3e1d64[_0x86f8('0x33')],'resourceId':_0x3e1d64['id'],'type':_0x36ab2b['name'],'sectionId':_0x36ab2b['id']},{})[_0x86f8('0x41')](function(){return _0x4b2c68;});}else{return _0x4b2c68;}})[_0x86f8('0x45')](function(_0x4507f7){logger[_0x86f8('0x2a')](_0x86f8('0x54'),_0x4507f7);throw _0x4507f7;});}return _0x4b2c68;})[_0x86f8('0x41')](respondWithResult(_0x9e483e,0xc9))['catch'](handleError(_0x9e483e,null));};exports[_0x86f8('0x28')]=function(_0x4fb3d9,_0xccf497){if(_0x4fb3d9[_0x86f8('0x4c')]['id']){delete _0x4fb3d9[_0x86f8('0x4c')]['id'];}return db['Team']['find']({'where':{'id':_0x4fb3d9[_0x86f8('0x47')]['id']}})[_0x86f8('0x41')](handleEntityNotFound(_0xccf497,null))[_0x86f8('0x41')](saveUpdates(_0x4fb3d9[_0x86f8('0x4c')],null))['then'](respondWithResult(_0xccf497,null))[_0x86f8('0x45')](handleError(_0xccf497,null));};exports[_0x86f8('0x55')]=function(_0x565c41,_0x28da10){var _0x417341=_0x565c41['params']['id'];var _0xc05376=[];return db[_0x86f8('0x56')][_0x86f8('0x57')](function(_0x26ad47){var _0x4153e9='SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20'+_0x417341;return db['sequelize'][_0x86f8('0x34')](_0x4153e9,{'type':db[_0x86f8('0x58')][_0x86f8('0x59')][_0x86f8('0x5a')],'raw':!![],'transaction':_0x26ad47})[_0x86f8('0x41')](function(_0x5cf52f){_0xc05376=_[_0x86f8('0x2e')](_0x5cf52f,function(_0x2cfc59){return Number(_0x2cfc59[_0x86f8('0x5b')]);});})[_0x86f8('0x41')](function(){var _0x17f8bf=_0x86f8('0x5c')+_0x417341;return db['sequelize'][_0x86f8('0x34')](_0x17f8bf,{'type':db[_0x86f8('0x58')][_0x86f8('0x59')][_0x86f8('0x5a')],'raw':!![],'transaction':_0x26ad47});})[_0x86f8('0x41')](function(_0x1552cc){var _0x81f9a7=_[_0x86f8('0x2e')](_0x1552cc,function(_0x1d280e){return Number(_0x1d280e['VoiceQueueId']);});return db[_0x86f8('0x5d')][_0x86f8('0x55')]({'where':{'UserId':{'$in':_0xc05376},'VoiceQueueId':{'$in':_0x81f9a7}},'transaction':_0x26ad47});})[_0x86f8('0x41')](function(){var _0x3a9d82=_0x86f8('0x5e')+_0x417341;return db[_0x86f8('0x56')][_0x86f8('0x34')](_0x3a9d82,{'type':db[_0x86f8('0x58')][_0x86f8('0x59')]['SELECT'],'raw':!![],'transaction':_0x26ad47});})[_0x86f8('0x41')](function(_0x5c7770){var _0xefd79e=_[_0x86f8('0x2e')](_0x5c7770,function(_0x320199){return Number(_0x320199[_0x86f8('0x5f')]);});return db[_0x86f8('0x60')][_0x86f8('0x55')]({'where':{'UserId':{'$in':_0xc05376},'MailQueueId':{'$in':_0xefd79e}},'transaction':_0x26ad47});})[_0x86f8('0x41')](function(){var _0x50fe2e='SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20'+_0x417341;return db[_0x86f8('0x56')][_0x86f8('0x34')](_0x50fe2e,{'type':db[_0x86f8('0x58')][_0x86f8('0x59')][_0x86f8('0x5a')],'raw':!![],'transaction':_0x26ad47});})['then'](function(_0x1de55f){var _0x227eef=_[_0x86f8('0x2e')](_0x1de55f,function(_0x2dd6e2){return Number(_0x2dd6e2[_0x86f8('0x61')]);});return db[_0x86f8('0x62')][_0x86f8('0x55')]({'where':{'UserId':{'$in':_0xc05376},'SmsQueueId':{'$in':_0x227eef}},'transaction':_0x26ad47});})['then'](function(){var _0x542b81='SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20'+_0x417341;return db[_0x86f8('0x56')][_0x86f8('0x34')](_0x542b81,{'type':db['Sequelize'][_0x86f8('0x59')]['SELECT'],'raw':!![],'transaction':_0x26ad47});})[_0x86f8('0x41')](function(_0x21c942){var _0x4166c5=_[_0x86f8('0x2e')](_0x21c942,function(_0x22c18b){return Number(_0x22c18b[_0x86f8('0x63')]);});return db[_0x86f8('0x64')][_0x86f8('0x55')]({'where':{'UserId':{'$in':_0xc05376},'ChatQueueId':{'$in':_0x4166c5}},'transaction':_0x26ad47});})[_0x86f8('0x41')](function(){var _0x78c41d=_0x86f8('0x65')+_0x417341;return db['sequelize'][_0x86f8('0x34')](_0x78c41d,{'type':db[_0x86f8('0x58')][_0x86f8('0x59')][_0x86f8('0x5a')],'raw':!![],'transaction':_0x26ad47});})[_0x86f8('0x41')](function(_0x2baa00){var _0x55625b=_[_0x86f8('0x2e')](_0x2baa00,function(_0x78fb6b){return Number(_0x78fb6b[_0x86f8('0x66')]);});return db[_0x86f8('0x67')]['destroy']({'where':{'UserId':{'$in':_0xc05376},'FaxQueueId':{'$in':_0x55625b}},'transaction':_0x26ad47});})[_0x86f8('0x41')](function(){var _0x50f2ab=_0x86f8('0x68')+_0x417341;return db[_0x86f8('0x56')][_0x86f8('0x34')](_0x50f2ab,{'type':db['Sequelize'][_0x86f8('0x59')][_0x86f8('0x5a')],'raw':!![],'transaction':_0x26ad47});})[_0x86f8('0x41')](function(_0x47519e){var _0x363941=_[_0x86f8('0x2e')](_0x47519e,function(_0x4f7c19){return Number(_0x4f7c19[_0x86f8('0x69')]);});return db['UserOpenchannelQueue'][_0x86f8('0x55')]({'where':{'UserId':{'$in':_0xc05376},'OpenchannelQueueId':{'$in':_0x363941}},'transaction':_0x26ad47});})['then'](function(){var _0x374bd6=_0x86f8('0x6a')+_0x417341;return db[_0x86f8('0x56')][_0x86f8('0x34')](_0x374bd6,{'type':db[_0x86f8('0x58')][_0x86f8('0x59')]['SELECT'],'raw':!![],'transaction':_0x26ad47});})[_0x86f8('0x41')](function(_0x3dc02d){var _0x5816e5=_[_0x86f8('0x2e')](_0x3dc02d,function(_0x505bd5){return Number(_0x505bd5[_0x86f8('0x6b')]);});return db['UserWhatsappQueue'][_0x86f8('0x55')]({'where':{'UserId':{'$in':_0xc05376},'WhatsappQueueId':{'$in':_0x5816e5}},'transaction':_0x26ad47});})[_0x86f8('0x41')](function(){return db['TeamVoicePrefix'][_0x86f8('0x4a')]({'where':{'TeamId':_0x417341}});})[_0x86f8('0x41')](function(_0x556679){if(_0x556679===null){return;}return db[_0x86f8('0x6c')][_0x86f8('0x55')]({'where':{'UserId':{'$in':_0xc05376},'VoicePrefixId':_0x556679[_0x86f8('0x6d')]},'transaction':_0x26ad47});})[_0x86f8('0x41')](function(){return db[_0x86f8('0x40')]['destroy']({'where':{'id':_0x417341},'cascade':!![],'transaction':_0x26ad47});})[_0x86f8('0x41')](function(_0x5e62c2){if(_0x5e62c2===0x0){_0x28da10[_0x86f8('0x29')](0x194);}else{return db['UserProfileResource'][_0x86f8('0x55')]({'where':{'type':_0x86f8('0x51'),'resourceId':_0x417341},'cascade':!![],'transaction':_0x26ad47})[_0x86f8('0x41')](function(){_0x28da10[_0x86f8('0x1d')](0xcc)[_0x86f8('0x6e')]();});}})[_0x86f8('0x45')](function(_0x55b3bd){_0x28da10['status'](0x1f4)['send'](_0x55b3bd);});});};exports[_0x86f8('0x6f')]=function(_0x396b86,_0x121419,_0x18919d){return db[_0x86f8('0x40')][_0x86f8('0x70')]({'where':{'id':_0x396b86[_0x86f8('0x47')]['id']}})['then'](handleEntityNotFound(_0x121419,null))['then'](function(_0x3a8263){if(!_0x396b86['query'][_0x86f8('0x71')]||!utils[_0x86f8('0x72')](_0x396b86[_0x86f8('0x34')][_0x86f8('0x71')])){throw new db['Sequelize'][(_0x86f8('0x73'))](_0x86f8('0x74'));}var _0x1ccf2e={};var _0x536eab={};_0x536eab[_0x86f8('0x48')]=_['keys'](db[_[_0x86f8('0x75')](_0x396b86[_0x86f8('0x34')]['channel']['toLowerCase']())+_0x86f8('0x76')][_0x86f8('0x2f')]);_0x536eab[_0x86f8('0x34')]=_[_0x86f8('0x35')](_0x396b86[_0x86f8('0x34')]);_0x536eab[_0x86f8('0x36')]=_[_0x86f8('0x37')](_0x536eab[_0x86f8('0x48')],_0x536eab['query']);_0x1ccf2e[_0x86f8('0x38')]=_['intersection'](_0x536eab[_0x86f8('0x48')],qs['fields'](_0x396b86[_0x86f8('0x34')][_0x86f8('0x39')]));_0x1ccf2e['attributes']=_0x1ccf2e[_0x86f8('0x38')][_0x86f8('0x3a')]?_0x1ccf2e[_0x86f8('0x38')]:_0x536eab[_0x86f8('0x48')];_0x1ccf2e[_0x86f8('0x21')]=qs[_0x86f8('0x21')](_0x396b86[_0x86f8('0x34')][_0x86f8('0x21')]);_0x1ccf2e[_0x86f8('0x1f')]=qs[_0x86f8('0x1f')](_0x396b86['query'][_0x86f8('0x1f')]);_0x1ccf2e[_0x86f8('0x77')]=qs['sort'](_0x396b86['query'][_0x86f8('0x3b')]);_0x1ccf2e[_0x86f8('0x3d')]=qs['filters'](_['pick'](_0x396b86['query'],_0x536eab[_0x86f8('0x36')]));_0x1ccf2e=_['merge']({},_0x1ccf2e,_0x396b86[_0x86f8('0x3f')]);return _0x3a8263['get'+_[_0x86f8('0x75')](_0x396b86[_0x86f8('0x34')]['channel'][_0x86f8('0x78')]())+_0x86f8('0x79')](_0x1ccf2e);})[_0x86f8('0x41')](respondWithResult(_0x121419,null))[_0x86f8('0x45')](handleError(_0x121419,null));};exports['addQueues']=function(_0x5c2bc7,_0x43aeb3,_0x3ebc04){return db[_0x86f8('0x40')][_0x86f8('0x70')]({'where':{'id':_0x5c2bc7['params']['id']}})[_0x86f8('0x41')](function(_0x210816){if(_0x210816){if(!_0x5c2bc7['body']['channel']||!utils[_0x86f8('0x72')](_0x5c2bc7[_0x86f8('0x4c')]['channel'])){throw new db[(_0x86f8('0x58'))][(_0x86f8('0x73'))](_0x86f8('0x74'));}return _0x210816['add'+_[_0x86f8('0x75')](_0x5c2bc7['body'][_0x86f8('0x71')][_0x86f8('0x78')]())+_0x86f8('0x79')](_0x5c2bc7[_0x86f8('0x4c')]['ids']);}return null;})[_0x86f8('0x41')](handleEntityNotFound(_0x43aeb3,null))[_0x86f8('0x41')](respondWithStatusCode(_0x43aeb3,null))['catch'](handleError(_0x43aeb3,null));};exports[_0x86f8('0x7a')]=function(_0x24e760,_0x21fd14,_0xa9dc08){return db[_0x86f8('0x40')]['findOne']({'where':{'id':_0x24e760['params']['id']}})[_0x86f8('0x41')](function(_0x52a685){if(_0x52a685){if(!_0x24e760[_0x86f8('0x34')][_0x86f8('0x71')]||!utils[_0x86f8('0x72')](_0x24e760['query'][_0x86f8('0x71')])){throw new db[(_0x86f8('0x58'))][(_0x86f8('0x73'))](_0x86f8('0x74'));}return _0x52a685[_0x86f8('0x7b')+_[_0x86f8('0x75')](_0x24e760[_0x86f8('0x34')][_0x86f8('0x71')][_0x86f8('0x78')]())+'Queues'](_0x24e760[_0x86f8('0x34')][_0x86f8('0x7c')]);}return null;})[_0x86f8('0x41')](handleEntityNotFound(_0x21fd14,null))[_0x86f8('0x41')](respondWithStatusCode(_0x21fd14,null))[_0x86f8('0x45')](handleError(_0x21fd14,null));};exports[_0x86f8('0x7d')]=function(_0x5f4613,_0x51d77b){var _0x4ba208=_[_0x86f8('0x7e')](_0x5f4613[_0x86f8('0x4c')][_0x86f8('0x7c')])?_0x5f4613[_0x86f8('0x4c')][_0x86f8('0x7c')]:[_0x5f4613['body'][_0x86f8('0x7c')]];var _0x4868ac=_0x5f4613[_0x86f8('0x47')]['id'];return db[_0x86f8('0x40')]['find']({'where':{'id':_0x4868ac}})['then'](handleEntityNotFound(_0x51d77b,null))[_0x86f8('0x41')](function(_0x23481b){if(_0x23481b){var _0x493c12=[_0x86f8('0x7f'),'Chat','Mail',_0x86f8('0x80'),'Fax',_0x86f8('0x81'),'Whatsapp'];return db[_0x86f8('0x56')][_0x86f8('0x57')](function(_0x2e4872){var _0x4fe442=_[_0x86f8('0x2e')](_0x493c12,function(_0x2963b4){var _0x4d2460={'attributes':['id',_0x86f8('0x33')]};if(_0x2963b4===_0x86f8('0x7f')){_0x4d2460[_0x86f8('0x82')]={'attributes':[_0x86f8('0x83')]};}return _0x23481b['get'+_0x2963b4+_0x86f8('0x79')](_0x4d2460)[_0x86f8('0x41')](function(_0x561884){var _0x1503ae=_[_0x86f8('0x2e')](_0x561884,function(_0x11834f){var _0x294cf2=_['map'](_0x4ba208,function(_0x319566){var _0x308f07={'where':{'UserId':_0x319566,[_0x2963b4+_0x86f8('0x84')]:_0x11834f['id']},'transaction':_0x2e4872};if(_0x2963b4===_0x86f8('0x7f')){_0x308f07[_0x86f8('0x18')]={'penalty':_0x11834f['TeamVoiceQueue'][_0x86f8('0x83')]};}return db[_0x86f8('0x85')+_0x2963b4+'Queue'][_0x86f8('0x86')](_0x308f07)['then'](function(){socket[_0x86f8('0x87')](_0x86f8('0x4d')+_0x2963b4+_0x86f8('0x88'),{'UserId':_0x319566,[_0x2963b4+_0x86f8('0x84')]:_0x11834f['id']});if(_0x2963b4!==_0x86f8('0x7f')){return;}return db[_0x86f8('0x85')][_0x86f8('0x44')]({'where':{'id':_0x4ba208,'online':0x1},'attributes':['id',_0x86f8('0x33'),_0x86f8('0x89'),_0x86f8('0x8a'),'interface'],'raw':!![]})['then'](function(_0x247c02){var _0x390f42=_[_0x86f8('0x2e')](_0x247c02,function(_0x428c34){return db[_0x86f8('0x8b')][_0x86f8('0x8c')]({'membername':_0x428c34[_0x86f8('0x33')],'UserId':_0x428c34['id'],'queue_name':_0x11834f[_0x86f8('0x33')],'VoiceQueueId':_0x11834f['id'],'interface':_[_0x86f8('0x8d')](_0x428c34['interface'])?util[_0x86f8('0x8e')](_0x86f8('0x8f'),_0x428c34['name']):_0x428c34[_0x86f8('0x90')],'paused':_0x428c34[_0x86f8('0x8a')]||![],'penalty':_0x11834f[_0x86f8('0x91')][_0x86f8('0x83')]},{'transaction':_0x2e4872});});return Promise['all'](_0x390f42);});});});return Promise['all'](_0x294cf2);});return Promise[_0x86f8('0x92')](_0x1503ae);})[_0x86f8('0x41')](function(){return db[_0x86f8('0x93')]['findOne']({'where':{'teamId':_0x4868ac}})[_0x86f8('0x41')](function(_0x1b28ba){if(_0x1b28ba){var _0x4d66f9=_[_0x86f8('0x2e')](_0x4ba208,function(_0x4c9474){db[_0x86f8('0x6c')][_0x86f8('0x8c')]({'UserId':_0x4c9474,'VoicePrefixId':_0x1b28ba[_0x86f8('0x6d')]});});return Promise[_0x86f8('0x92')](_0x4d66f9);}});});});return Promise[_0x86f8('0x92')](_0x4fe442)['then'](function(){return _0x23481b[_0x86f8('0x7d')](_0x4ba208,{'transaction':_0x2e4872})[_0x86f8('0x94')](function(_0x5167e9){return _0x5167e9;});});});}})[_0x86f8('0x41')](respondWithResult(_0x51d77b,null))[_0x86f8('0x45')](handleError(_0x51d77b,null));};exports[_0x86f8('0x95')]=function(_0x5c0dda,_0x32790e){var _0x2951e8=_[_0x86f8('0x7e')](_0x5c0dda[_0x86f8('0x34')][_0x86f8('0x7c')])?_0x5c0dda[_0x86f8('0x34')][_0x86f8('0x7c')]:[_0x5c0dda['query'][_0x86f8('0x7c')]];var _0x5e6b2c=_0x5c0dda['params']['id'];return db[_0x86f8('0x40')][_0x86f8('0x4a')]({'where':{'id':_0x5e6b2c}})['then'](handleEntityNotFound(_0x32790e,null))[_0x86f8('0x41')](function(_0x135312){if(_0x135312){var _0x536666=[_0x86f8('0x7f'),_0x86f8('0x96'),_0x86f8('0x97'),_0x86f8('0x80'),_0x86f8('0x98'),_0x86f8('0x81'),'Whatsapp'];return db[_0x86f8('0x56')][_0x86f8('0x57')](function(_0x4d9243){var _0x5979a4=_[_0x86f8('0x2e')](_0x536666,function(_0x381f62){var _0x41b5ca={'attributes':['id','name']};return _0x135312[_0x86f8('0x4e')+_0x381f62+_0x86f8('0x79')](_0x41b5ca)[_0x86f8('0x41')](function(_0x49f3c0){var _0x13d834=_[_0x86f8('0x2e')](_0x49f3c0,function(_0xd34407){return _0xd34407['removeAgents'](_0x2951e8,{'transaction':_0x4d9243})[_0x86f8('0x41')](function(){var _0x1c039d=_['map'](_0x2951e8,function(_0x53c790){socket[_0x86f8('0x87')](_0x86f8('0x4d')+_0x381f62+_0x86f8('0x99'),{'UserId':Number(_0x53c790),[_0x381f62+_0x86f8('0x84')]:_0xd34407['id']});if(_0x381f62!==_0x86f8('0x7f')){return;}return db[_0x86f8('0x8b')]['destroy']({'where':{'VoiceQueueId':_0xd34407['id'],'UserId':_0x53c790},'transaction':_0x4d9243});});return Promise[_0x86f8('0x92')](_0x1c039d);});});return Promise['all'](_0x13d834);});});return Promise['all'](_0x5979a4)[_0x86f8('0x41')](function(){return _0x135312['removeAgents'](_0x2951e8,{'transaction':_0x4d9243});})['then'](function(){return db[_0x86f8('0x93')][_0x86f8('0x70')]({'where':{'teamId':_0x5e6b2c}})[_0x86f8('0x41')](function(_0x450209){if(_0x450209){var _0x323394=_[_0x86f8('0x2e')](_0x2951e8,function(_0x1468a1){db['UserVoicePrefix'][_0x86f8('0x55')]({'where':{'UserId':_0x1468a1,'VoicePrefixId':_0x450209[_0x86f8('0x6d')]}});});return Promise['all'](_0x323394);}});});});}})['then'](respondWithStatusCode(_0x32790e,null))['catch'](handleError(_0x32790e,null));};exports['getAgents']=function(_0x55d089,_0x4b7b88,_0x21745b){var _0xfb7ec8={};var _0x5dbd31={};var _0x3e6517;var _0x4821da;return db['Team']['findOne']({'where':{'id':_0x55d089[_0x86f8('0x47')]['id']}})[_0x86f8('0x41')](handleEntityNotFound(_0x4b7b88,null))[_0x86f8('0x41')](function(_0x313af1){if(_0x313af1){_0x3e6517=_0x313af1;_0x5dbd31[_0x86f8('0x48')]=_[_0x86f8('0x35')](db['User'][_0x86f8('0x2f')]);_0x5dbd31['query']=_[_0x86f8('0x35')](_0x55d089[_0x86f8('0x34')]);_0x5dbd31[_0x86f8('0x36')]=_['intersection'](_0x5dbd31[_0x86f8('0x48')],_0x5dbd31[_0x86f8('0x34')]);_0xfb7ec8[_0x86f8('0x38')]=_['intersection'](_0x5dbd31[_0x86f8('0x48')],qs[_0x86f8('0x39')](_0x55d089['query'][_0x86f8('0x39')]));_0xfb7ec8[_0x86f8('0x38')]=_0xfb7ec8['attributes'][_0x86f8('0x3a')]?_0xfb7ec8[_0x86f8('0x38')]:_0x5dbd31[_0x86f8('0x48')];_0xfb7ec8[_0x86f8('0x77')]=qs['sort'](_0x55d089[_0x86f8('0x34')]['sort']);_0xfb7ec8[_0x86f8('0x3d')]=qs[_0x86f8('0x36')](_[_0x86f8('0x9a')](_0x55d089[_0x86f8('0x34')],_0x5dbd31[_0x86f8('0x36')]));if(_0x55d089[_0x86f8('0x34')][_0x86f8('0x3c')]){_0xfb7ec8[_0x86f8('0x3d')]=_['merge'](_0xfb7ec8[_0x86f8('0x3d')],{'$or':_[_0x86f8('0x2e')](_0xfb7ec8['attributes'],function(_0x317bc3){var _0x38b205={};_0x38b205[_0x317bc3]={'$like':'%'+_0x55d089[_0x86f8('0x34')][_0x86f8('0x3c')]+'%'};return _0x38b205;})});}_0xfb7ec8=_['merge']({},_0xfb7ec8,_0x55d089[_0x86f8('0x3f')]);return _0x3e6517[_0x86f8('0x9b')](_0xfb7ec8);}})[_0x86f8('0x41')](function(_0x7dd757){if(_0x7dd757){_0x4821da=_0x7dd757[_0x86f8('0x3a')];if(!_0x55d089[_0x86f8('0x34')][_0x86f8('0x9c')](_0x86f8('0x9d'))){_0xfb7ec8[_0x86f8('0x21')]=qs['limit'](_0x55d089[_0x86f8('0x34')][_0x86f8('0x21')]);_0xfb7ec8['offset']=qs[_0x86f8('0x1f')](_0x55d089['query']['offset']);}return _0x3e6517[_0x86f8('0x9b')](_0xfb7ec8);}})[_0x86f8('0x41')](function(_0x5180a5){if(_0x5180a5){return _0x5180a5?{'count':_0x4821da,'rows':_0x5180a5}:null;}})[_0x86f8('0x41')](respondWithResult(_0x4b7b88,null))[_0x86f8('0x45')](handleError(_0x4b7b88,null));}; \ No newline at end of file +var _0x25cd=['key','model','query','filters','intersection','attributes','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','rawAttributes','fields','length','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','destroy','sequelize','transaction','Sequelize','QueryTypes','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','SELECT','MailQueueId','UserMailQueue','SmsQueueId','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserWhatsappQueue','UserVoicePrefix','VoicePrefixId','Teams','send','getQueues','findOne','channel','isValidChannel','ValidationError','Unknown\x20channel','keys','capitalize','toLowerCase','Queue','addQueues','Queues','removeQueues','remove','ids','addAgents','Voice','Chat','Mail','Fax','penalty','QueueId','TeamVoiceQueue','User','findOrCreate','emit','online','voicePause','UserVoiceQueueRt','upsert','isNil','interface','format','SIP/%s','all','TeamVoicePrefix','removeAgents','isArray','Sms','Openchannel','Whatsapp','user','Queue:remove','getAgents','options','hasOwnProperty','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./team.socket','register','sendStatus','status','json','undefined','limit','offset','count','set','Content-Range','apply','save','update','then','error','stack','name','map','Team','fieldName','type'];(function(_0x28ee9c,_0x1ae563){var _0x36f796=function(_0x4b9d9a){while(--_0x4b9d9a){_0x28ee9c['push'](_0x28ee9c['shift']());}};_0x36f796(++_0x1ae563);}(_0x25cd,0x1a7));var _0xd25c=function(_0x45eacc,_0x3727a4){_0x45eacc=_0x45eacc-0x0;var _0x3f1252=_0x25cd[_0x45eacc];return _0x3f1252;};'use strict';var emlformat=require(_0xd25c('0x0'));var rimraf=require(_0xd25c('0x1'));var zipdir=require(_0xd25c('0x2'));var jsonpatch=require(_0xd25c('0x3'));var rp=require('request-promise');var moment=require(_0xd25c('0x4'));var BPromise=require(_0xd25c('0x5'));var Mustache=require(_0xd25c('0x6'));var util=require('util');var path=require(_0xd25c('0x7'));var sox=require('sox');var csv=require(_0xd25c('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd25c('0x9'));var _=require('lodash');var squel=require(_0xd25c('0xa'));var crypto=require(_0xd25c('0xb'));var jsforce=require(_0xd25c('0xc'));var deskjs=require(_0xd25c('0xd'));var toCsv=require(_0xd25c('0x8'));var querystring=require(_0xd25c('0xe'));var Papa=require(_0xd25c('0xf'));var Redis=require(_0xd25c('0x10'));var authService=require(_0xd25c('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd25c('0x12'));var logger=require(_0xd25c('0x13'))(_0xd25c('0x14'));var utils=require(_0xd25c('0x15'));var config=require(_0xd25c('0x16'));var licenseUtil=require(_0xd25c('0x17'));var db=require(_0xd25c('0x18'))['db'];config['redis']=_[_0xd25c('0x19')](config[_0xd25c('0x1a')],{'host':_0xd25c('0x1b'),'port':0x18eb});var socket=require(_0xd25c('0x1c'))(new Redis(config[_0xd25c('0x1a')]));require(_0xd25c('0x1d'))[_0xd25c('0x1e')](socket);function respondWithStatusCode(_0xe74f6c,_0x24b080){_0x24b080=_0x24b080||0xcc;return function(_0x2f7f43){if(_0x2f7f43){return _0xe74f6c[_0xd25c('0x1f')](_0x24b080);}return _0xe74f6c[_0xd25c('0x20')](_0x24b080)['end']();};}function respondWithResult(_0x353c9f,_0x350ad2){_0x350ad2=_0x350ad2||0xc8;return function(_0x3186c0){if(_0x3186c0){return _0x353c9f[_0xd25c('0x20')](_0x350ad2)[_0xd25c('0x21')](_0x3186c0);}};}function respondWithFilteredResult(_0x28953f,_0x6c5f18){return function(_0x32ba39){if(_0x32ba39){var _0x36a656=typeof _0x6c5f18['offset']===_0xd25c('0x22')&&typeof _0x6c5f18[_0xd25c('0x23')]==='undefined';var _0x42b748=_0x32ba39['count'];var _0x279049=_0x36a656?0x0:_0x6c5f18[_0xd25c('0x24')];var _0x41cd65=_0x36a656?_0x32ba39[_0xd25c('0x25')]:_0x6c5f18[_0xd25c('0x24')]+_0x6c5f18[_0xd25c('0x23')];var _0x14a658;if(_0x41cd65>=_0x42b748){_0x41cd65=_0x42b748;_0x14a658=0xc8;}else{_0x14a658=0xce;}_0x28953f[_0xd25c('0x20')](_0x14a658);return _0x28953f[_0xd25c('0x26')](_0xd25c('0x27'),_0x279049+'-'+_0x41cd65+'/'+_0x42b748)[_0xd25c('0x21')](_0x32ba39);}return null;};}function patchUpdates(_0x40a2b7){return function(_0x5d66a7){try{jsonpatch[_0xd25c('0x28')](_0x5d66a7,_0x40a2b7,!![]);}catch(_0x2f3b15){return BPromise['reject'](_0x2f3b15);}return _0x5d66a7[_0xd25c('0x29')]();};}function saveUpdates(_0x42837f,_0x501678){return function(_0x2509a3){if(_0x2509a3){return _0x2509a3[_0xd25c('0x2a')](_0x42837f)[_0xd25c('0x2b')](function(_0x184b64){return _0x184b64;});}return null;};}function handleEntityNotFound(_0x5dfa09,_0x1d6385){return function(_0x1ef8f3){if(!_0x1ef8f3){_0x5dfa09['sendStatus'](0x194);}return _0x1ef8f3;};}function handleError(_0x1a561a,_0x489441){_0x489441=_0x489441||0x1f4;return function(_0x574eff){logger[_0xd25c('0x2c')](_0x574eff[_0xd25c('0x2d')]);if(_0x574eff[_0xd25c('0x2e')]){delete _0x574eff[_0xd25c('0x2e')];}_0x1a561a['status'](_0x489441)['send'](_0x574eff);};}exports['index']=function(_0x4344bc,_0x3d8d83){var _0x282568={},_0x4c6cb8={},_0x505ae4={'count':0x0,'rows':[]};var _0x206ef6=_[_0xd25c('0x2f')](db[_0xd25c('0x30')]['rawAttributes'],function(_0x49e858){return{'name':_0x49e858[_0xd25c('0x31')],'type':_0x49e858[_0xd25c('0x32')][_0xd25c('0x33')]};});_0x4c6cb8[_0xd25c('0x34')]=_[_0xd25c('0x2f')](_0x206ef6,_0xd25c('0x2e'));_0x4c6cb8[_0xd25c('0x35')]=_['keys'](_0x4344bc[_0xd25c('0x35')]);_0x4c6cb8[_0xd25c('0x36')]=_[_0xd25c('0x37')](_0x4c6cb8[_0xd25c('0x34')],_0x4c6cb8['query']);_0x282568[_0xd25c('0x38')]=_[_0xd25c('0x37')](_0x4c6cb8[_0xd25c('0x34')],qs['fields'](_0x4344bc[_0xd25c('0x35')]['fields']));_0x282568[_0xd25c('0x38')]=_0x282568[_0xd25c('0x38')]['length']?_0x282568[_0xd25c('0x38')]:_0x4c6cb8[_0xd25c('0x34')];if(!_0x4344bc[_0xd25c('0x35')]['hasOwnProperty']('nolimit')){_0x282568[_0xd25c('0x23')]=qs[_0xd25c('0x23')](_0x4344bc['query']['limit']);_0x282568[_0xd25c('0x24')]=qs[_0xd25c('0x24')](_0x4344bc[_0xd25c('0x35')][_0xd25c('0x24')]);}_0x282568[_0xd25c('0x39')]=qs[_0xd25c('0x3a')](_0x4344bc[_0xd25c('0x35')][_0xd25c('0x3a')]);_0x282568['where']=qs[_0xd25c('0x36')](_[_0xd25c('0x3b')](_0x4344bc['query'],_0x4c6cb8[_0xd25c('0x36')]),_0x206ef6);if(_0x4344bc[_0xd25c('0x35')][_0xd25c('0x3c')]){_0x282568[_0xd25c('0x3d')]=_[_0xd25c('0x3e')](_0x282568[_0xd25c('0x3d')],{'$or':_[_0xd25c('0x2f')](_0x206ef6,function(_0x462f66){if(_0x462f66[_0xd25c('0x32')]!==_0xd25c('0x3f')){var _0x12f0b2={};_0x12f0b2[_0x462f66[_0xd25c('0x2e')]]={'$like':'%'+_0x4344bc['query'][_0xd25c('0x3c')]+'%'};return _0x12f0b2;}})});}_0x282568=_['merge']({},_0x282568,_0x4344bc['options']);var _0x370fc2={'where':_0x282568[_0xd25c('0x3d')]};return db[_0xd25c('0x30')][_0xd25c('0x25')](_0x370fc2)[_0xd25c('0x2b')](function(_0xf795c4){_0x505ae4[_0xd25c('0x25')]=_0xf795c4;if(_0x4344bc['query'][_0xd25c('0x40')]){_0x282568[_0xd25c('0x41')]=[{'all':!![]}];}return db[_0xd25c('0x30')][_0xd25c('0x42')](_0x282568);})[_0xd25c('0x2b')](function(_0x626ce7){_0x505ae4[_0xd25c('0x43')]=_0x626ce7;return _0x505ae4;})[_0xd25c('0x2b')](respondWithFilteredResult(_0x3d8d83,_0x282568))[_0xd25c('0x44')](handleError(_0x3d8d83,null));};exports[_0xd25c('0x45')]=function(_0x220cc8,_0x1554bc){var _0x20057f={'raw':![],'where':{'id':_0x220cc8[_0xd25c('0x46')]['id']}},_0x5501be={};_0x5501be[_0xd25c('0x34')]=_['keys'](db[_0xd25c('0x30')][_0xd25c('0x47')]);_0x5501be[_0xd25c('0x35')]=_['keys'](_0x220cc8[_0xd25c('0x35')]);_0x5501be['filters']=_[_0xd25c('0x37')](_0x5501be[_0xd25c('0x34')],_0x5501be['query']);_0x20057f[_0xd25c('0x38')]=_[_0xd25c('0x37')](_0x5501be['model'],qs[_0xd25c('0x48')](_0x220cc8[_0xd25c('0x35')]['fields']));_0x20057f[_0xd25c('0x38')]=_0x20057f[_0xd25c('0x38')][_0xd25c('0x49')]?_0x20057f[_0xd25c('0x38')]:_0x5501be[_0xd25c('0x34')];if(_0x220cc8['query'][_0xd25c('0x40')]){_0x20057f[_0xd25c('0x41')]=[{'all':!![]}];}_0x20057f=_['merge']({},_0x20057f,_0x220cc8['options']);return db[_0xd25c('0x30')]['find'](_0x20057f)[_0xd25c('0x2b')](handleEntityNotFound(_0x1554bc,null))[_0xd25c('0x2b')](respondWithResult(_0x1554bc,null))[_0xd25c('0x44')](handleError(_0x1554bc,null));};exports[_0xd25c('0x4a')]=function(_0x3ebb57,_0x360990){return db[_0xd25c('0x30')]['create'](_0x3ebb57['body'],{})[_0xd25c('0x2b')](function(_0x24ea1e){var _0xcdad01=_0x3ebb57['user'][_0xd25c('0x4b')]({'plain':!![]});if(!_0xcdad01)throw new Error(_0xd25c('0x4c'));if(_0xcdad01[_0xd25c('0x4d')]==='user'){var _0x3473e6=_0x24ea1e[_0xd25c('0x4b')]({'plain':!![]});var _0x510d89='Teams';return db[_0xd25c('0x4e')][_0xd25c('0x4f')]({'where':{'name':_0x510d89,'userProfileId':_0xcdad01[_0xd25c('0x50')]},'raw':!![]})[_0xd25c('0x2b')](function(_0x27b43a){if(_0x27b43a&&_0x27b43a[_0xd25c('0x51')]===0x0){return db[_0xd25c('0x52')][_0xd25c('0x4a')]({'name':_0x3473e6['name'],'resourceId':_0x3473e6['id'],'type':_0x27b43a['name'],'sectionId':_0x27b43a['id']},{})[_0xd25c('0x2b')](function(){return _0x24ea1e;});}else{return _0x24ea1e;}})[_0xd25c('0x44')](function(_0x513e27){logger['error'](_0xd25c('0x53'),_0x513e27);throw _0x513e27;});}return _0x24ea1e;})[_0xd25c('0x2b')](respondWithResult(_0x360990,0xc9))[_0xd25c('0x44')](handleError(_0x360990,null));};exports[_0xd25c('0x2a')]=function(_0x59cbb7,_0x51201d){if(_0x59cbb7['body']['id']){delete _0x59cbb7[_0xd25c('0x54')]['id'];}return db[_0xd25c('0x30')][_0xd25c('0x4f')]({'where':{'id':_0x59cbb7[_0xd25c('0x46')]['id']}})[_0xd25c('0x2b')](handleEntityNotFound(_0x51201d,null))[_0xd25c('0x2b')](saveUpdates(_0x59cbb7[_0xd25c('0x54')],null))[_0xd25c('0x2b')](respondWithResult(_0x51201d,null))[_0xd25c('0x44')](handleError(_0x51201d,null));};exports[_0xd25c('0x55')]=function(_0x3d3eed,_0x182ea1){var _0x18ebdc=_0x3d3eed[_0xd25c('0x46')]['id'];var _0x339980=[];return db[_0xd25c('0x56')][_0xd25c('0x57')](function(_0x2d8716){var _0x3d82be='SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20'+_0x18ebdc;return db['sequelize'][_0xd25c('0x35')](_0x3d82be,{'type':db[_0xd25c('0x58')][_0xd25c('0x59')]['SELECT'],'raw':!![],'transaction':_0x2d8716})[_0xd25c('0x2b')](function(_0x3a69a7){_0x339980=_[_0xd25c('0x2f')](_0x3a69a7,function(_0x426797){return Number(_0x426797[_0xd25c('0x5a')]);});})['then'](function(){var _0x513252=_0xd25c('0x5b')+_0x18ebdc;return db[_0xd25c('0x56')][_0xd25c('0x35')](_0x513252,{'type':db[_0xd25c('0x58')][_0xd25c('0x59')][_0xd25c('0x5c')],'raw':!![],'transaction':_0x2d8716});})['then'](function(_0x303afb){var _0x291a93=_['map'](_0x303afb,function(_0x350c38){return Number(_0x350c38['VoiceQueueId']);});return db['UserVoiceQueue'][_0xd25c('0x55')]({'where':{'UserId':{'$in':_0x339980},'VoiceQueueId':{'$in':_0x291a93}},'transaction':_0x2d8716});})[_0xd25c('0x2b')](function(){var _0xc96d94='SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20'+_0x18ebdc;return db[_0xd25c('0x56')][_0xd25c('0x35')](_0xc96d94,{'type':db[_0xd25c('0x58')][_0xd25c('0x59')]['SELECT'],'raw':!![],'transaction':_0x2d8716});})[_0xd25c('0x2b')](function(_0xf82a32){var _0x13a9b7=_[_0xd25c('0x2f')](_0xf82a32,function(_0x1c4ed4){return Number(_0x1c4ed4[_0xd25c('0x5d')]);});return db[_0xd25c('0x5e')][_0xd25c('0x55')]({'where':{'UserId':{'$in':_0x339980},'MailQueueId':{'$in':_0x13a9b7}},'transaction':_0x2d8716});})[_0xd25c('0x2b')](function(){var _0x4d0157='SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20'+_0x18ebdc;return db[_0xd25c('0x56')][_0xd25c('0x35')](_0x4d0157,{'type':db['Sequelize'][_0xd25c('0x59')][_0xd25c('0x5c')],'raw':!![],'transaction':_0x2d8716});})[_0xd25c('0x2b')](function(_0x2adc0d){var _0x88fd58=_[_0xd25c('0x2f')](_0x2adc0d,function(_0x3b5c57){return Number(_0x3b5c57[_0xd25c('0x5f')]);});return db[_0xd25c('0x60')][_0xd25c('0x55')]({'where':{'UserId':{'$in':_0x339980},'SmsQueueId':{'$in':_0x88fd58}},'transaction':_0x2d8716});})['then'](function(){var _0x11209a=_0xd25c('0x61')+_0x18ebdc;return db[_0xd25c('0x56')][_0xd25c('0x35')](_0x11209a,{'type':db[_0xd25c('0x58')][_0xd25c('0x59')][_0xd25c('0x5c')],'raw':!![],'transaction':_0x2d8716});})[_0xd25c('0x2b')](function(_0xa2506e){var _0x2918ca=_['map'](_0xa2506e,function(_0x3ce77a){return Number(_0x3ce77a['ChatQueueId']);});return db[_0xd25c('0x62')]['destroy']({'where':{'UserId':{'$in':_0x339980},'ChatQueueId':{'$in':_0x2918ca}},'transaction':_0x2d8716});})[_0xd25c('0x2b')](function(){var _0x4e528d=_0xd25c('0x63')+_0x18ebdc;return db[_0xd25c('0x56')]['query'](_0x4e528d,{'type':db['Sequelize']['QueryTypes'][_0xd25c('0x5c')],'raw':!![],'transaction':_0x2d8716});})[_0xd25c('0x2b')](function(_0x340232){var _0x242ba2=_[_0xd25c('0x2f')](_0x340232,function(_0x39c7df){return Number(_0x39c7df['FaxQueueId']);});return db[_0xd25c('0x64')]['destroy']({'where':{'UserId':{'$in':_0x339980},'FaxQueueId':{'$in':_0x242ba2}},'transaction':_0x2d8716});})[_0xd25c('0x2b')](function(){var _0x539b9c=_0xd25c('0x65')+_0x18ebdc;return db[_0xd25c('0x56')][_0xd25c('0x35')](_0x539b9c,{'type':db[_0xd25c('0x58')][_0xd25c('0x59')][_0xd25c('0x5c')],'raw':!![],'transaction':_0x2d8716});})[_0xd25c('0x2b')](function(_0x2350b6){var _0x1ccc7a=_['map'](_0x2350b6,function(_0x2f17b1){return Number(_0x2f17b1[_0xd25c('0x66')]);});return db[_0xd25c('0x67')][_0xd25c('0x55')]({'where':{'UserId':{'$in':_0x339980},'OpenchannelQueueId':{'$in':_0x1ccc7a}},'transaction':_0x2d8716});})[_0xd25c('0x2b')](function(){var _0x5474cd=_0xd25c('0x68')+_0x18ebdc;return db[_0xd25c('0x56')][_0xd25c('0x35')](_0x5474cd,{'type':db[_0xd25c('0x58')][_0xd25c('0x59')][_0xd25c('0x5c')],'raw':!![],'transaction':_0x2d8716});})['then'](function(_0x19bc96){var _0x12f99e=_[_0xd25c('0x2f')](_0x19bc96,function(_0x24163c){return Number(_0x24163c[_0xd25c('0x69')]);});return db[_0xd25c('0x6a')][_0xd25c('0x55')]({'where':{'UserId':{'$in':_0x339980},'WhatsappQueueId':{'$in':_0x12f99e}},'transaction':_0x2d8716});})[_0xd25c('0x2b')](function(){return db['TeamVoicePrefix'][_0xd25c('0x4f')]({'where':{'TeamId':_0x18ebdc}});})[_0xd25c('0x2b')](function(_0x1b24c7){if(_0x1b24c7===null){return;}return db[_0xd25c('0x6b')]['destroy']({'where':{'UserId':{'$in':_0x339980},'VoicePrefixId':_0x1b24c7[_0xd25c('0x6c')]},'transaction':_0x2d8716});})['then'](function(){return db[_0xd25c('0x30')]['destroy']({'where':{'id':_0x18ebdc},'cascade':!![],'transaction':_0x2d8716});})[_0xd25c('0x2b')](function(_0x593d2c){if(_0x593d2c===0x0){_0x182ea1[_0xd25c('0x1f')](0x194);}else{return db[_0xd25c('0x52')][_0xd25c('0x55')]({'where':{'type':_0xd25c('0x6d'),'resourceId':_0x18ebdc},'cascade':!![],'transaction':_0x2d8716})[_0xd25c('0x2b')](function(){_0x182ea1[_0xd25c('0x20')](0xcc)['end']();});}})[_0xd25c('0x44')](function(_0x581d23){_0x182ea1[_0xd25c('0x20')](0x1f4)[_0xd25c('0x6e')](_0x581d23);});});};exports[_0xd25c('0x6f')]=function(_0x4af7af,_0x2538f5,_0x3aa697){return db[_0xd25c('0x30')][_0xd25c('0x70')]({'where':{'id':_0x4af7af[_0xd25c('0x46')]['id']}})[_0xd25c('0x2b')](handleEntityNotFound(_0x2538f5,null))['then'](function(_0x468ca4){if(!_0x4af7af[_0xd25c('0x35')][_0xd25c('0x71')]||!utils[_0xd25c('0x72')](_0x4af7af['query'][_0xd25c('0x71')])){throw new db[(_0xd25c('0x58'))][(_0xd25c('0x73'))](_0xd25c('0x74'));}var _0x122b64={};var _0x236bee={};_0x236bee[_0xd25c('0x34')]=_[_0xd25c('0x75')](db[_[_0xd25c('0x76')](_0x4af7af['query'][_0xd25c('0x71')][_0xd25c('0x77')]())+_0xd25c('0x78')]['rawAttributes']);_0x236bee['query']=_['keys'](_0x4af7af[_0xd25c('0x35')]);_0x236bee[_0xd25c('0x36')]=_['intersection'](_0x236bee[_0xd25c('0x34')],_0x236bee[_0xd25c('0x35')]);_0x122b64[_0xd25c('0x38')]=_[_0xd25c('0x37')](_0x236bee[_0xd25c('0x34')],qs[_0xd25c('0x48')](_0x4af7af[_0xd25c('0x35')][_0xd25c('0x48')]));_0x122b64[_0xd25c('0x38')]=_0x122b64['attributes'][_0xd25c('0x49')]?_0x122b64['attributes']:_0x236bee[_0xd25c('0x34')];_0x122b64['limit']=qs[_0xd25c('0x23')](_0x4af7af[_0xd25c('0x35')]['limit']);_0x122b64[_0xd25c('0x24')]=qs[_0xd25c('0x24')](_0x4af7af[_0xd25c('0x35')][_0xd25c('0x24')]);_0x122b64[_0xd25c('0x39')]=qs[_0xd25c('0x3a')](_0x4af7af[_0xd25c('0x35')][_0xd25c('0x3a')]);_0x122b64[_0xd25c('0x3d')]=qs[_0xd25c('0x36')](_[_0xd25c('0x3b')](_0x4af7af[_0xd25c('0x35')],_0x236bee[_0xd25c('0x36')]));_0x122b64=_[_0xd25c('0x3e')]({},_0x122b64,_0x4af7af['options']);return _0x468ca4[_0xd25c('0x4b')+_['capitalize'](_0x4af7af[_0xd25c('0x35')]['channel'][_0xd25c('0x77')]())+'Queues'](_0x122b64);})['then'](respondWithResult(_0x2538f5,null))[_0xd25c('0x44')](handleError(_0x2538f5,null));};exports[_0xd25c('0x79')]=function(_0x294a7f,_0x5c3b86,_0x4b79d4){return db[_0xd25c('0x30')]['findOne']({'where':{'id':_0x294a7f[_0xd25c('0x46')]['id']}})[_0xd25c('0x2b')](function(_0x9c3887){if(_0x9c3887){if(!_0x294a7f['body'][_0xd25c('0x71')]||!utils[_0xd25c('0x72')](_0x294a7f['body'][_0xd25c('0x71')])){throw new db[(_0xd25c('0x58'))][(_0xd25c('0x73'))](_0xd25c('0x74'));}return _0x9c3887['add'+_[_0xd25c('0x76')](_0x294a7f[_0xd25c('0x54')][_0xd25c('0x71')][_0xd25c('0x77')]())+_0xd25c('0x7a')](_0x294a7f['body']['ids']);}return null;})['then'](handleEntityNotFound(_0x5c3b86,null))[_0xd25c('0x2b')](respondWithStatusCode(_0x5c3b86,null))['catch'](handleError(_0x5c3b86,null));};exports[_0xd25c('0x7b')]=function(_0x46b09f,_0xa5052d,_0x20095b){return db[_0xd25c('0x30')][_0xd25c('0x70')]({'where':{'id':_0x46b09f[_0xd25c('0x46')]['id']}})[_0xd25c('0x2b')](function(_0x2670b6){if(_0x2670b6){if(!_0x46b09f[_0xd25c('0x35')][_0xd25c('0x71')]||!utils[_0xd25c('0x72')](_0x46b09f[_0xd25c('0x35')][_0xd25c('0x71')])){throw new db[(_0xd25c('0x58'))]['ValidationError'](_0xd25c('0x74'));}return _0x2670b6[_0xd25c('0x7c')+_[_0xd25c('0x76')](_0x46b09f[_0xd25c('0x35')][_0xd25c('0x71')]['toLowerCase']())+_0xd25c('0x7a')](_0x46b09f[_0xd25c('0x35')][_0xd25c('0x7d')]);}return null;})[_0xd25c('0x2b')](handleEntityNotFound(_0xa5052d,null))[_0xd25c('0x2b')](respondWithStatusCode(_0xa5052d,null))[_0xd25c('0x44')](handleError(_0xa5052d,null));};exports[_0xd25c('0x7e')]=function(_0x51b0a5,_0x117958){var _0x3287f4=_['isArray'](_0x51b0a5[_0xd25c('0x54')][_0xd25c('0x7d')])?_0x51b0a5[_0xd25c('0x54')]['ids']:[_0x51b0a5[_0xd25c('0x54')][_0xd25c('0x7d')]];var _0x49c715=_0x51b0a5[_0xd25c('0x46')]['id'];return db[_0xd25c('0x30')][_0xd25c('0x4f')]({'where':{'id':_0x49c715}})['then'](handleEntityNotFound(_0x117958,null))[_0xd25c('0x2b')](function(_0x138e1e){if(_0x138e1e){var _0x7a2e8c=[_0xd25c('0x7f'),_0xd25c('0x80'),_0xd25c('0x81'),'Sms',_0xd25c('0x82'),'Openchannel','Whatsapp'];return db[_0xd25c('0x56')][_0xd25c('0x57')](function(_0x164eab){var _0x525b72=_['map'](_0x7a2e8c,function(_0x39ce9){var _0x32b11f={'attributes':['id',_0xd25c('0x2e')]};if(_0x39ce9==='Voice'){_0x32b11f['through']={'attributes':[_0xd25c('0x83')]};}return _0x138e1e[_0xd25c('0x4b')+_0x39ce9+'Queues'](_0x32b11f)[_0xd25c('0x2b')](function(_0xed8a30){var _0xdd154e=_[_0xd25c('0x2f')](_0xed8a30,function(_0x4abf3d){var _0x16d1cb=_['map'](_0x3287f4,function(_0x2fed94){var _0x37260a={'where':{'UserId':_0x2fed94,[_0x39ce9+_0xd25c('0x84')]:_0x4abf3d['id']},'transaction':_0x164eab};if(_0x39ce9==='Voice'){_0x37260a[_0xd25c('0x19')]={'penalty':_0x4abf3d[_0xd25c('0x85')][_0xd25c('0x83')]};}return db[_0xd25c('0x86')+_0x39ce9+_0xd25c('0x78')][_0xd25c('0x87')](_0x37260a)[_0xd25c('0x2b')](function(){socket[_0xd25c('0x88')]('user'+_0x39ce9+'Queue:save',{'UserId':_0x2fed94,[_0x39ce9+_0xd25c('0x84')]:_0x4abf3d['id']});if(_0x39ce9!==_0xd25c('0x7f')){return;}return db[_0xd25c('0x86')][_0xd25c('0x42')]({'where':{'id':_0x3287f4,'online':0x1},'attributes':['id',_0xd25c('0x2e'),_0xd25c('0x89'),_0xd25c('0x8a'),'interface'],'raw':!![]})[_0xd25c('0x2b')](function(_0x5de358){var _0xeb2a31=_[_0xd25c('0x2f')](_0x5de358,function(_0x47818f){return db[_0xd25c('0x8b')][_0xd25c('0x8c')]({'membername':_0x47818f[_0xd25c('0x2e')],'UserId':_0x47818f['id'],'queue_name':_0x4abf3d[_0xd25c('0x2e')],'VoiceQueueId':_0x4abf3d['id'],'interface':_[_0xd25c('0x8d')](_0x47818f[_0xd25c('0x8e')])?util[_0xd25c('0x8f')](_0xd25c('0x90'),_0x47818f['name']):_0x47818f[_0xd25c('0x8e')],'paused':_0x47818f[_0xd25c('0x8a')]||![],'penalty':_0x4abf3d[_0xd25c('0x85')][_0xd25c('0x83')]},{'transaction':_0x164eab});});return Promise[_0xd25c('0x91')](_0xeb2a31);});});});return Promise['all'](_0x16d1cb);});return Promise[_0xd25c('0x91')](_0xdd154e);})[_0xd25c('0x2b')](function(){return db[_0xd25c('0x92')][_0xd25c('0x70')]({'where':{'teamId':_0x49c715}})[_0xd25c('0x2b')](function(_0x1d7b25){if(_0x1d7b25){var _0x3cc982=_[_0xd25c('0x2f')](_0x3287f4,function(_0x48fac4){db['UserVoicePrefix']['upsert']({'UserId':_0x48fac4,'VoicePrefixId':_0x1d7b25['VoicePrefixId']});});return Promise[_0xd25c('0x91')](_0x3cc982);}});});});return Promise[_0xd25c('0x91')](_0x525b72)[_0xd25c('0x2b')](function(){return _0x138e1e[_0xd25c('0x7e')](_0x3287f4,{'transaction':_0x164eab})['spread'](function(_0x5d81af){return _0x5d81af;});});});}})[_0xd25c('0x2b')](respondWithResult(_0x117958,null))[_0xd25c('0x44')](handleError(_0x117958,null));};exports[_0xd25c('0x93')]=function(_0x11682a,_0x3b17b5){var _0x2c6ba8=_[_0xd25c('0x94')](_0x11682a[_0xd25c('0x35')][_0xd25c('0x7d')])?_0x11682a[_0xd25c('0x35')][_0xd25c('0x7d')]:[_0x11682a[_0xd25c('0x35')][_0xd25c('0x7d')]];var _0x8f37fe=_0x11682a[_0xd25c('0x46')]['id'];return db[_0xd25c('0x30')][_0xd25c('0x4f')]({'where':{'id':_0x8f37fe}})[_0xd25c('0x2b')](handleEntityNotFound(_0x3b17b5,null))[_0xd25c('0x2b')](function(_0x2e86ed){if(_0x2e86ed){var _0x4cfeae=[_0xd25c('0x7f'),_0xd25c('0x80'),_0xd25c('0x81'),_0xd25c('0x95'),_0xd25c('0x82'),_0xd25c('0x96'),_0xd25c('0x97')];return db[_0xd25c('0x56')]['transaction'](function(_0x104a31){var _0x47ef95=_[_0xd25c('0x2f')](_0x4cfeae,function(_0x269d8c){var _0x8b12e1={'attributes':['id','name']};return _0x2e86ed[_0xd25c('0x4b')+_0x269d8c+_0xd25c('0x7a')](_0x8b12e1)[_0xd25c('0x2b')](function(_0x1a11eb){var _0x4c9dfb=_[_0xd25c('0x2f')](_0x1a11eb,function(_0x43f478){return _0x43f478[_0xd25c('0x93')](_0x2c6ba8,{'transaction':_0x104a31})['then'](function(){var _0x422951=_[_0xd25c('0x2f')](_0x2c6ba8,function(_0x5585e0){socket[_0xd25c('0x88')](_0xd25c('0x98')+_0x269d8c+_0xd25c('0x99'),{'UserId':Number(_0x5585e0),[_0x269d8c+_0xd25c('0x84')]:_0x43f478['id']});if(_0x269d8c!==_0xd25c('0x7f')){return;}return db['UserVoiceQueueRt'][_0xd25c('0x55')]({'where':{'VoiceQueueId':_0x43f478['id'],'UserId':_0x5585e0},'transaction':_0x104a31});});return Promise[_0xd25c('0x91')](_0x422951);});});return Promise[_0xd25c('0x91')](_0x4c9dfb);});});return Promise['all'](_0x47ef95)[_0xd25c('0x2b')](function(){return _0x2e86ed[_0xd25c('0x93')](_0x2c6ba8,{'transaction':_0x104a31});})[_0xd25c('0x2b')](function(){return db[_0xd25c('0x92')]['findOne']({'where':{'teamId':_0x8f37fe}})['then'](function(_0x32ccd4){if(_0x32ccd4){var _0x3f376c=_['map'](_0x2c6ba8,function(_0x11c0a9){db['UserVoicePrefix'][_0xd25c('0x55')]({'where':{'UserId':_0x11c0a9,'VoicePrefixId':_0x32ccd4['VoicePrefixId']}});});return Promise[_0xd25c('0x91')](_0x3f376c);}});});});}})['then'](respondWithStatusCode(_0x3b17b5,null))['catch'](handleError(_0x3b17b5,null));};exports[_0xd25c('0x9a')]=function(_0x4c0b4d,_0x206c09,_0x35a1dc){var _0x2de062={};var _0x42f36c={};var _0x2ad665;var _0x3f8496;return db[_0xd25c('0x30')]['findOne']({'where':{'id':_0x4c0b4d['params']['id']}})[_0xd25c('0x2b')](handleEntityNotFound(_0x206c09,null))[_0xd25c('0x2b')](function(_0x37d619){if(_0x37d619){_0x2ad665=_0x37d619;_0x42f36c[_0xd25c('0x34')]=_[_0xd25c('0x75')](db[_0xd25c('0x86')]['rawAttributes']);_0x42f36c['query']=_[_0xd25c('0x75')](_0x4c0b4d[_0xd25c('0x35')]);_0x42f36c[_0xd25c('0x36')]=_[_0xd25c('0x37')](_0x42f36c[_0xd25c('0x34')],_0x42f36c['query']);_0x2de062[_0xd25c('0x38')]=_[_0xd25c('0x37')](_0x42f36c['model'],qs[_0xd25c('0x48')](_0x4c0b4d[_0xd25c('0x35')][_0xd25c('0x48')]));_0x2de062[_0xd25c('0x38')]=_0x2de062['attributes']['length']?_0x2de062[_0xd25c('0x38')]:_0x42f36c[_0xd25c('0x34')];_0x2de062[_0xd25c('0x39')]=qs[_0xd25c('0x3a')](_0x4c0b4d[_0xd25c('0x35')][_0xd25c('0x3a')]);_0x2de062[_0xd25c('0x3d')]=qs[_0xd25c('0x36')](_[_0xd25c('0x3b')](_0x4c0b4d[_0xd25c('0x35')],_0x42f36c[_0xd25c('0x36')]));if(_0x4c0b4d['query'][_0xd25c('0x3c')]){_0x2de062[_0xd25c('0x3d')]=_['merge'](_0x2de062[_0xd25c('0x3d')],{'$or':_['map'](_0x2de062[_0xd25c('0x38')],function(_0x4922b9){var _0x2e7263={};_0x2e7263[_0x4922b9]={'$like':'%'+_0x4c0b4d[_0xd25c('0x35')][_0xd25c('0x3c')]+'%'};return _0x2e7263;})});}_0x2de062=_[_0xd25c('0x3e')]({},_0x2de062,_0x4c0b4d[_0xd25c('0x9b')]);return _0x2ad665[_0xd25c('0x9a')](_0x2de062);}})[_0xd25c('0x2b')](function(_0x351f32){if(_0x351f32){_0x3f8496=_0x351f32['length'];if(!_0x4c0b4d[_0xd25c('0x35')][_0xd25c('0x9c')](_0xd25c('0x9d'))){_0x2de062[_0xd25c('0x23')]=qs['limit'](_0x4c0b4d['query'][_0xd25c('0x23')]);_0x2de062[_0xd25c('0x24')]=qs['offset'](_0x4c0b4d[_0xd25c('0x35')][_0xd25c('0x24')]);}return _0x2ad665[_0xd25c('0x9a')](_0x2de062);}})[_0xd25c('0x2b')](function(_0x16fe22){if(_0x16fe22){return _0x16fe22?{'count':_0x3f8496,'rows':_0x16fe22}:null;}})[_0xd25c('0x2b')](respondWithResult(_0x206c09,null))[_0xd25c('0x44')](handleError(_0x206c09,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index eb6c13a..16fb091 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 _0x1407=['hook','Team','setMaxListeners','update','remove','emit'];(function(_0xaeb047,_0x9fd6ea){var _0x4cfc83=function(_0x2e086c){while(--_0x2e086c){_0xaeb047['push'](_0xaeb047['shift']());}};_0x4cfc83(++_0x9fd6ea);}(_0x1407,0x1b1));var _0x7140=function(_0xfd144e,_0x18ef55){_0xfd144e=_0xfd144e-0x0;var _0x13e4d3=_0x1407[_0xfd144e];return _0x13e4d3;};'use strict';var EventEmitter=require('events');var Team=require('../../mysqldb')['db'][_0x7140('0x0')];var TeamEvents=new EventEmitter();TeamEvents[_0x7140('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7140('0x2'),'afterDestroy':_0x7140('0x3')};function emitEvent(_0x1de9f7){return function(_0x508b82,_0x4c190e,_0x1f6d9f){TeamEvents[_0x7140('0x4')](_0x1de9f7+':'+_0x508b82['id'],_0x508b82);TeamEvents[_0x7140('0x4')](_0x1de9f7,_0x508b82);_0x1f6d9f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team[_0x7140('0x5')](e,emitEvent(event));}}module['exports']=TeamEvents; \ No newline at end of file +var _0x37b3=['hook','events','../../mysqldb','Team','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x37b3,0xf1));var _0x337b=function(_0x42bb6d,_0x412255){_0x42bb6d=_0x42bb6d-0x0;var _0x1db89b=_0x37b3[_0x42bb6d];return _0x1db89b;};'use strict';var EventEmitter=require(_0x337b('0x0'));var Team=require(_0x337b('0x1'))['db'][_0x337b('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0x337b('0x3')](0x0);var events={'afterCreate':_0x337b('0x4'),'afterUpdate':_0x337b('0x5'),'afterDestroy':_0x337b('0x6')};function emitEvent(_0xcfb269){return function(_0x4d8e5c,_0x31449f,_0x17be91){TeamEvents[_0x337b('0x7')](_0xcfb269+':'+_0x4d8e5c['id'],_0x4d8e5c);TeamEvents[_0x337b('0x7')](_0xcfb269,_0x4d8e5c);_0x17be91(null);};}for(var e in events){if(events[_0x337b('0x8')](e)){var event=events[e];Team[_0x337b('0x9')](e,emitEvent(event));}}module['exports']=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index d5317b9..974d54b 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 _0xe6d4=['util','../../config/logger','moment','bluebird','path','rimraf','exports','Team','teams','lodash'];(function(_0x56a7e3,_0x3cbd6d){var _0x5210cc=function(_0x299298){while(--_0x299298){_0x56a7e3['push'](_0x56a7e3['shift']());}};_0x5210cc(++_0x3cbd6d);}(_0xe6d4,0x153));var _0x4e6d=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xe6d4[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x4e6d('0x0'));var util=require(_0x4e6d('0x1'));var logger=require(_0x4e6d('0x2'))('api');var moment=require(_0x4e6d('0x3'));var BPromise=require(_0x4e6d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4e6d('0x5'));var rimraf=require(_0x4e6d('0x6'));var config=require('../../config/environment');var attributes=require('./team.attributes');module[_0x4e6d('0x7')]=function(_0x6173b1,_0x4dd4d4){return _0x6173b1['define'](_0x4e6d('0x8'),attributes,{'tableName':_0x4e6d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x541f=['define','Team','teams','lodash','util','../../config/logger','api','bluebird','request-promise','path','exports'];(function(_0x57add2,_0x4f2b7d){var _0x4e3670=function(_0x3311b){while(--_0x3311b){_0x57add2['push'](_0x57add2['shift']());}};_0x4e3670(++_0x4f2b7d);}(_0x541f,0x137));var _0xf541=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0x541f[_0x334841];return _0x5beb4b;};'use strict';var _=require(_0xf541('0x0'));var util=require(_0xf541('0x1'));var logger=require(_0xf541('0x2'))(_0xf541('0x3'));var moment=require('moment');var BPromise=require(_0xf541('0x4'));var rp=require(_0xf541('0x5'));var fs=require('fs');var path=require(_0xf541('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./team.attributes');module[_0xf541('0x7')]=function(_0x20302e,_0x3db66d){return _0x20302e[_0xf541('0x8')](_0xf541('0x9'),attributes,{'tableName':_0xf541('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index de2cd79..144e615 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 _0x4036=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./team.socket','register','request','then','info','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','error','code','Team,\x20%s,\x20%s','message','result','lodash','moment','ioredis','../../mysqldb'];(function(_0x51dada,_0x4ddb59){var _0x209d74=function(_0x2e1892){while(--_0x2e1892){_0x51dada['push'](_0x51dada['shift']());}};_0x209d74(++_0x4ddb59);}(_0x4036,0xa4));var _0x6403=function(_0x1e2a66,_0x1bbeed){_0x1e2a66=_0x1e2a66-0x0;var _0xde23fe=_0x4036[_0x1e2a66];return _0xde23fe;};'use strict';var _=require(_0x6403('0x0'));var util=require('util');var moment=require(_0x6403('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6403('0x2'));var db=require(_0x6403('0x3'))['db'];var utils=require(_0x6403('0x4'));var logger=require(_0x6403('0x5'))(_0x6403('0x6'));var config=require(_0x6403('0x7'));var jayson=require(_0x6403('0x8'));var client=jayson[_0x6403('0x9')][_0x6403('0xa')]({'port':0x232a});config[_0x6403('0xb')]=_[_0x6403('0xc')](config[_0x6403('0xb')],{'host':_0x6403('0xd'),'port':0x18eb});var socket=require(_0x6403('0xe'))(new Redis(config[_0x6403('0xb')]));require(_0x6403('0xf'))[_0x6403('0x10')](socket);function respondWithRpcPromise(_0x38748d,_0x341b86,_0x3288c2){return new BPromise(function(_0x56fd53,_0x1074ea){return client[_0x6403('0x11')](_0x38748d,_0x3288c2)[_0x6403('0x12')](function(_0x329731){logger[_0x6403('0x13')]('Team,\x20%s,\x20%s',_0x341b86,_0x6403('0x14'));logger[_0x6403('0x15')](_0x6403('0x16'),_0x341b86,'request\x20sent',JSON['stringify'](_0x329731));if(_0x329731['error']){if(_0x329731[_0x6403('0x17')][_0x6403('0x18')]===0x1f4){logger[_0x6403('0x17')](_0x6403('0x19'),_0x341b86,_0x329731['error'][_0x6403('0x1a')]);return _0x1074ea(_0x329731[_0x6403('0x17')][_0x6403('0x1a')]);}logger[_0x6403('0x17')]('Team,\x20%s,\x20%s',_0x341b86,_0x329731['error'][_0x6403('0x1a')]);return _0x56fd53(_0x329731[_0x6403('0x17')][_0x6403('0x1a')]);}else{logger[_0x6403('0x13')](_0x6403('0x19'),_0x341b86,_0x6403('0x14'));_0x56fd53(_0x329731[_0x6403('0x1b')][_0x6403('0x1a')]);}})['catch'](function(_0x464ab8){logger[_0x6403('0x17')](_0x6403('0x19'),_0x341b86,_0x464ab8);_0x1074ea(_0x464ab8);});});} \ No newline at end of file +var _0x2ac4=['Team,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','Team,\x20%s,\x20%s','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','redis','localhost','socket.io-emitter','./team.socket','request','info','debug'];(function(_0xd2f4f5,_0x341930){var _0x41fc10=function(_0x496824){while(--_0x496824){_0xd2f4f5['push'](_0xd2f4f5['shift']());}};_0x41fc10(++_0x341930);}(_0x2ac4,0x68));var _0x42ac=function(_0x2f1d2f,_0x527d85){_0x2f1d2f=_0x2f1d2f-0x0;var _0x2874cf=_0x2ac4[_0x2f1d2f];return _0x2874cf;};'use strict';var _=require('lodash');var util=require(_0x42ac('0x0'));var moment=require('moment');var BPromise=require(_0x42ac('0x1'));var rs=require(_0x42ac('0x2'));var fs=require('fs');var Redis=require(_0x42ac('0x3'));var db=require(_0x42ac('0x4'))['db'];var utils=require(_0x42ac('0x5'));var logger=require('../../config/logger')(_0x42ac('0x6'));var config=require(_0x42ac('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x42ac('0x8')]['http']({'port':0x232a});config[_0x42ac('0x9')]=_['defaults'](config[_0x42ac('0x9')],{'host':_0x42ac('0xa'),'port':0x18eb});var socket=require(_0x42ac('0xb'))(new Redis(config[_0x42ac('0x9')]));require(_0x42ac('0xc'))['register'](socket);function respondWithRpcPromise(_0x417c05,_0xf2ff24,_0x52134d){return new BPromise(function(_0x558262,_0xd2763){return client[_0x42ac('0xd')](_0x417c05,_0x52134d)['then'](function(_0x955de7){logger[_0x42ac('0xe')]('Team,\x20%s,\x20%s',_0xf2ff24,'request\x20sent');logger[_0x42ac('0xf')](_0x42ac('0x10'),_0xf2ff24,_0x42ac('0x11'),JSON['stringify'](_0x955de7));if(_0x955de7[_0x42ac('0x12')]){if(_0x955de7[_0x42ac('0x12')][_0x42ac('0x13')]===0x1f4){logger[_0x42ac('0x12')](_0x42ac('0x14'),_0xf2ff24,_0x955de7[_0x42ac('0x12')][_0x42ac('0x15')]);return _0xd2763(_0x955de7['error']['message']);}logger[_0x42ac('0x12')]('Team,\x20%s,\x20%s',_0xf2ff24,_0x955de7[_0x42ac('0x12')][_0x42ac('0x15')]);return _0x558262(_0x955de7[_0x42ac('0x12')][_0x42ac('0x15')]);}else{logger[_0x42ac('0xe')](_0x42ac('0x14'),_0xf2ff24,'request\x20sent');_0x558262(_0x955de7[_0x42ac('0x16')][_0x42ac('0x15')]);}})[_0x42ac('0x17')](function(_0x42f384){logger[_0x42ac('0x12')]('Team,\x20%s,\x20%s',_0xf2ff24,_0x42f384);_0xd2763(_0x42f384);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index b647203..67f9bfb 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 _0x0482=['emit','removeListener','register','length','team:','./team.events','save','remove'];(function(_0x5d7b3e,_0x58f3c5){var _0x27b17d=function(_0x5a5b06){while(--_0x5a5b06){_0x5d7b3e['push'](_0x5d7b3e['shift']());}};_0x27b17d(++_0x58f3c5);}(_0x0482,0xc5));var _0x2048=function(_0x1dfdd3,_0x3e1a05){_0x1dfdd3=_0x1dfdd3-0x0;var _0x4dbacf=_0x0482[_0x1dfdd3];return _0x4dbacf;};'use strict';var TeamEvents=require(_0x2048('0x0'));var events=[_0x2048('0x1'),_0x2048('0x2'),'update'];function createListener(_0x25b14b,_0x2d8711){return function(_0x184551){_0x2d8711[_0x2048('0x3')](_0x25b14b,_0x184551);};}function removeListener(_0x4429b6,_0x25ea42){return function(){TeamEvents[_0x2048('0x4')](_0x4429b6,_0x25ea42);};}exports[_0x2048('0x5')]=function(_0x56fbb2){for(var _0x3e7b8f=0x0,_0x4755e9=events[_0x2048('0x6')];_0x3e7b8f<_0x4755e9;_0x3e7b8f++){var _0x37ddbd=events[_0x3e7b8f];var _0x62239=createListener(_0x2048('0x7')+_0x37ddbd,_0x56fbb2);TeamEvents['on'](_0x37ddbd,_0x62239);}}; \ No newline at end of file +var _0x22fb=['save','remove','emit','removeListener','register','length','team:','./team.events'];(function(_0x308f09,_0x9c9367){var _0x2b58fd=function(_0x51b231){while(--_0x51b231){_0x308f09['push'](_0x308f09['shift']());}};_0x2b58fd(++_0x9c9367);}(_0x22fb,0x18f));var _0xb22f=function(_0x44d664,_0x4da8c9){_0x44d664=_0x44d664-0x0;var _0x40540d=_0x22fb[_0x44d664];return _0x40540d;};'use strict';var TeamEvents=require(_0xb22f('0x0'));var events=[_0xb22f('0x1'),_0xb22f('0x2'),'update'];function createListener(_0x2b5587,_0x3ba8e1){return function(_0x51a5b6){_0x3ba8e1[_0xb22f('0x3')](_0x2b5587,_0x51a5b6);};}function removeListener(_0x1936df,_0x16a46e){return function(){TeamEvents[_0xb22f('0x4')](_0x1936df,_0x16a46e);};}exports[_0xb22f('0x5')]=function(_0x179f8a){for(var _0x3485cd=0x0,_0x5bf93a=events[_0xb22f('0x6')];_0x3485cd<_0x5bf93a;_0x3485cd++){var _0x5e1f1b=events[_0x3485cd];var _0x5465c5=createListener(_0xb22f('0x7')+_0x5e1f1b,_0x179f8a);TeamEvents['on'](_0x5e1f1b,_0x5465c5);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 059a35f..5b92db4 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 _0x16e3=['sequelize','INTEGER'];(function(_0x2bd440,_0xfb5a9d){var _0x58f325=function(_0x19847f){while(--_0x19847f){_0x2bd440['push'](_0x2bd440['shift']());}};_0x58f325(++_0xfb5a9d);}(_0x16e3,0x168));var _0x316e=function(_0x575977,_0x3c80b5){_0x575977=_0x575977-0x0;var _0x37739e=_0x16e3[_0x575977];return _0x37739e;};'use strict';var Sequelize=require(_0x316e('0x0'));module['exports']={'TeamId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0x316e('0x1')]}}; \ No newline at end of file +var _0x59e0=['exports','INTEGER'];(function(_0x1508ce,_0x6ff40d){var _0x3011ec=function(_0x297bb7){while(--_0x297bb7){_0x1508ce['push'](_0x1508ce['shift']());}};_0x3011ec(++_0x6ff40d);}(_0x59e0,0x1f4));var _0x059e=function(_0x38ee15,_0x2ac0ae){_0x38ee15=_0x38ee15-0x0;var _0x15df1e=_0x59e0[_0x38ee15];return _0x15df1e;};'use strict';var Sequelize=require('sequelize');module[_0x059e('0x0')]={'TeamId':{'type':Sequelize[_0x059e('0x1')]},'VoicePrefixId':{'type':Sequelize[_0x059e('0x1')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index 360a703..c7f4149 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 _0x81fa=['lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./teamVoicePrefix.attributes','exports','define','TeamVoicePrefix','team_has_voice_prefixes'];(function(_0x3f02c8,_0xab2666){var _0x5c54ed=function(_0x56b2db){while(--_0x56b2db){_0x3f02c8['push'](_0x3f02c8['shift']());}};_0x5c54ed(++_0xab2666);}(_0x81fa,0xdd));var _0xa81f=function(_0x5b78fe,_0x44542c){_0x5b78fe=_0x5b78fe-0x0;var _0x24ac3c=_0x81fa[_0x5b78fe];return _0x24ac3c;};'use strict';var _=require(_0xa81f('0x0'));var util=require(_0xa81f('0x1'));var logger=require('../../config/logger')(_0xa81f('0x2'));var moment=require(_0xa81f('0x3'));var BPromise=require(_0xa81f('0x4'));var rp=require(_0xa81f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa81f('0x6'));var config=require(_0xa81f('0x7'));var attributes=require(_0xa81f('0x8'));module[_0xa81f('0x9')]=function(_0x1dc233,_0x158719){return _0x1dc233[_0xa81f('0xa')](_0xa81f('0xb'),attributes,{'tableName':_0xa81f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4dd3=['rimraf','../../config/environment','exports','define','TeamVoicePrefix','lodash','util','../../config/logger','bluebird','path'];(function(_0x273f29,_0x2b695b){var _0x5140b4=function(_0xc74a54){while(--_0xc74a54){_0x273f29['push'](_0x273f29['shift']());}};_0x5140b4(++_0x2b695b);}(_0x4dd3,0xf5));var _0x34dd=function(_0x363ef8,_0x4ecb1a){_0x363ef8=_0x363ef8-0x0;var _0x148822=_0x4dd3[_0x363ef8];return _0x148822;};'use strict';var _=require(_0x34dd('0x0'));var util=require(_0x34dd('0x1'));var logger=require(_0x34dd('0x2'))('api');var moment=require('moment');var BPromise=require(_0x34dd('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x34dd('0x4'));var rimraf=require(_0x34dd('0x5'));var config=require(_0x34dd('0x6'));var attributes=require('./teamVoicePrefix.attributes');module[_0x34dd('0x7')]=function(_0x704165,_0x37ce1d){return _0x704165[_0x34dd('0x8')](_0x34dd('0x9'),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 a81b224..59ae73d 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x2c249a,_0x4a6096){var _0x3edb89=function(_0x46f832){while(--_0x46f832){_0x2c249a['push'](_0x2c249a['shift']());}};_0x3edb89(++_0x4a6096);}(_0xa9e0,0x123));var _0x0a9e=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0xa9e0[_0x220dbb];return _0x2b77de;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x3f1385,_0x3620ff){var _0x5e13d0=function(_0x13680a){while(--_0x13680a){_0x3f1385['push'](_0x3f1385['shift']());}};_0x5e13d0(++_0x3620ff);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xa9e0[_0x47b58b];return _0x46bebe;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 999a08a..a6d230b 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 _0x8c04=['sequelize','exports','INTEGER'];(function(_0x1db811,_0x5b5d0e){var _0x1b1ac7=function(_0x4639be){while(--_0x4639be){_0x1db811['push'](_0x1db811['shift']());}};_0x1b1ac7(++_0x5b5d0e);}(_0x8c04,0x1a7));var _0x48c0=function(_0xe929f1,_0x27af72){_0xe929f1=_0xe929f1-0x0;var _0x2d625b=_0x8c04[_0xe929f1];return _0x2d625b;};'use strict';var Sequelize=require(_0x48c0('0x0'));module[_0x48c0('0x1')]={'penalty':{'type':Sequelize[_0x48c0('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xf8cc=['sequelize','exports','INTEGER'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xf8cc,0x189));var _0xcf8c=function(_0x1b5138,_0x2047d0){_0x1b5138=_0x1b5138-0x0;var _0x45f453=_0xf8cc[_0x1b5138];return _0x45f453;};'use strict';var Sequelize=require(_0xcf8c('0x0'));module[_0xcf8c('0x1')]={'penalty':{'type':Sequelize[_0xcf8c('0x2')],'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 e6fb7c4..130de1f 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 _0xf1e1=['../../config/environment','./teamVoiceQueue.attributes','exports','define','TeamVoiceQueue','team_has_voice_queues','lodash','../../config/logger','moment','request-promise','path','rimraf'];(function(_0x356670,_0x32ff4b){var _0x5931b3=function(_0x13b343){while(--_0x13b343){_0x356670['push'](_0x356670['shift']());}};_0x5931b3(++_0x32ff4b);}(_0xf1e1,0x102));var _0x1f1e=function(_0x256cc1,_0x568424){_0x256cc1=_0x256cc1-0x0;var _0x330d0a=_0xf1e1[_0x256cc1];return _0x330d0a;};'use strict';var _=require(_0x1f1e('0x0'));var util=require('util');var logger=require(_0x1f1e('0x1'))('api');var moment=require(_0x1f1e('0x2'));var BPromise=require('bluebird');var rp=require(_0x1f1e('0x3'));var fs=require('fs');var path=require(_0x1f1e('0x4'));var rimraf=require(_0x1f1e('0x5'));var config=require(_0x1f1e('0x6'));var attributes=require(_0x1f1e('0x7'));module[_0x1f1e('0x8')]=function(_0x1bdcee,_0x3242af){return _0x1bdcee[_0x1f1e('0x9')](_0x1f1e('0xa'),attributes,{'tableName':_0x1f1e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0d4e=['exports','team_has_voice_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./teamVoiceQueue.attributes'];(function(_0x32e649,_0x228649){var _0x14d386=function(_0x3fb3ed){while(--_0x3fb3ed){_0x32e649['push'](_0x32e649['shift']());}};_0x14d386(++_0x228649);}(_0x0d4e,0x1ca));var _0xe0d4=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x0d4e[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0xe0d4('0x0'));var util=require(_0xe0d4('0x1'));var logger=require(_0xe0d4('0x2'))(_0xe0d4('0x3'));var moment=require(_0xe0d4('0x4'));var BPromise=require(_0xe0d4('0x5'));var rp=require(_0xe0d4('0x6'));var fs=require('fs');var path=require(_0xe0d4('0x7'));var rimraf=require(_0xe0d4('0x8'));var config=require('../../config/environment');var attributes=require(_0xe0d4('0x9'));module[_0xe0d4('0xa')]=function(_0x2cc782,_0x25bdbe){return _0x2cc782['define']('TeamVoiceQueue',attributes,{'tableName':_0xe0d4('0xb'),'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 cfa775c..8679894 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 _0x6ede=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','error','message','result','catch'];(function(_0x23e210,_0x443911){var _0x1ffd85=function(_0x35acc4){while(--_0x35acc4){_0x23e210['push'](_0x23e210['shift']());}};_0x1ffd85(++_0x443911);}(_0x6ede,0x140));var _0xe6ed=function(_0x516ffb,_0x5b5b42){_0x516ffb=_0x516ffb-0x0;var _0x319667=_0x6ede[_0x516ffb];return _0x319667;};'use strict';var _=require('lodash');var util=require(_0xe6ed('0x0'));var moment=require('moment');var BPromise=require(_0xe6ed('0x1'));var rs=require(_0xe6ed('0x2'));var fs=require('fs');var Redis=require(_0xe6ed('0x3'));var db=require(_0xe6ed('0x4'))['db'];var utils=require(_0xe6ed('0x5'));var logger=require(_0xe6ed('0x6'))(_0xe6ed('0x7'));var config=require('../../config/environment');var jayson=require(_0xe6ed('0x8'));var client=jayson[_0xe6ed('0x9')][_0xe6ed('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x22e03b,_0x2e8e4b,_0x2910af){return new BPromise(function(_0x1831f5,_0x33afd9){return client['request'](_0x22e03b,_0x2910af)['then'](function(_0x579126){logger[_0xe6ed('0xb')](_0xe6ed('0xc'),_0x2e8e4b,_0xe6ed('0xd'));logger[_0xe6ed('0xe')](_0xe6ed('0xf'),_0x2e8e4b,_0xe6ed('0xd'),JSON['stringify'](_0x579126));if(_0x579126['error']){if(_0x579126[_0xe6ed('0x10')]['code']===0x1f4){logger[_0xe6ed('0x10')](_0xe6ed('0xc'),_0x2e8e4b,_0x579126['error']['message']);return _0x33afd9(_0x579126['error'][_0xe6ed('0x11')]);}logger['error']('TeamVoiceQueue,\x20%s,\x20%s',_0x2e8e4b,_0x579126[_0xe6ed('0x10')][_0xe6ed('0x11')]);return _0x1831f5(_0x579126[_0xe6ed('0x10')][_0xe6ed('0x11')]);}else{logger[_0xe6ed('0xb')](_0xe6ed('0xc'),_0x2e8e4b,_0xe6ed('0xd'));_0x1831f5(_0x579126[_0xe6ed('0x12')][_0xe6ed('0x11')]);}})[_0xe6ed('0x13')](function(_0x40444d){logger[_0xe6ed('0x10')](_0xe6ed('0xc'),_0x2e8e4b,_0x40444d);_0x33afd9(_0x40444d);});});} \ No newline at end of file +var _0xaad1=['debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','ioredis','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x319e2e,_0x2f727f){var _0x302524=function(_0x5cad9d){while(--_0x5cad9d){_0x319e2e['push'](_0x319e2e['shift']());}};_0x302524(++_0x2f727f);}(_0xaad1,0x148));var _0x1aad=function(_0x348a5b,_0x19379b){_0x348a5b=_0x348a5b-0x0;var _0x91b6a2=_0xaad1[_0x348a5b];return _0x91b6a2;};'use strict';var _=require(_0x1aad('0x0'));var util=require('util');var moment=require(_0x1aad('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1aad('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1aad('0x3'))('rpc');var config=require(_0x1aad('0x4'));var jayson=require(_0x1aad('0x5'));var client=jayson[_0x1aad('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x637b35,_0x57b1cf,_0x5b219e){return new BPromise(function(_0x1f69d4,_0x56f5ad){return client[_0x1aad('0x7')](_0x637b35,_0x5b219e)[_0x1aad('0x8')](function(_0x310112){logger[_0x1aad('0x9')](_0x1aad('0xa'),_0x57b1cf,_0x1aad('0xb'));logger[_0x1aad('0xc')](_0x1aad('0xd'),_0x57b1cf,'request\x20sent',JSON[_0x1aad('0xe')](_0x310112));if(_0x310112[_0x1aad('0xf')]){if(_0x310112['error'][_0x1aad('0x10')]===0x1f4){logger[_0x1aad('0xf')](_0x1aad('0xa'),_0x57b1cf,_0x310112[_0x1aad('0xf')]['message']);return _0x56f5ad(_0x310112[_0x1aad('0xf')][_0x1aad('0x11')]);}logger[_0x1aad('0xf')]('TeamVoiceQueue,\x20%s,\x20%s',_0x57b1cf,_0x310112[_0x1aad('0xf')][_0x1aad('0x11')]);return _0x1f69d4(_0x310112['error'][_0x1aad('0x11')]);}else{logger[_0x1aad('0x9')]('TeamVoiceQueue,\x20%s,\x20%s',_0x57b1cf,_0x1aad('0xb'));_0x1f69d4(_0x310112[_0x1aad('0x12')][_0x1aad('0x11')]);}})[_0x1aad('0x13')](function(_0x2e0a3e){logger[_0x1aad('0xf')](_0x1aad('0xa'),_0x57b1cf,_0x2e0a3e);_0x56f5ad(_0x2e0a3e);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 07bf252..266bfaf 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 _0xd916=['update','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','./template.controller','get','index','/:id','isAuthenticated','show','post'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0xd916,0x18a));var _0x6d91=function(_0x1fea02,_0x2bd088){_0x1fea02=_0x1fea02-0x0;var _0x4ed396=_0xd916[_0x1fea02];return _0x4ed396;};'use strict';var multer=require(_0x6d91('0x0'));var util=require(_0x6d91('0x1'));var path=require(_0x6d91('0x2'));var timeout=require(_0x6d91('0x3'));var express=require(_0x6d91('0x4'));var router=express['Router']();var fs_extra=require(_0x6d91('0x5'));var auth=require(_0x6d91('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x6d91('0x7'));router[_0x6d91('0x8')]('/',auth['isAuthenticated'](),controller[_0x6d91('0x9')]);router[_0x6d91('0x8')](_0x6d91('0xa'),auth[_0x6d91('0xb')](),controller[_0x6d91('0xc')]);router[_0x6d91('0xd')]('/',auth[_0x6d91('0xb')](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x6d91('0xe')]);router[_0x6d91('0xf')](_0x6d91('0xa'),auth[_0x6d91('0xb')](),controller[_0x6d91('0x10')]);module['exports']=router; \ No newline at end of file +var _0xc7bd=['show','post','put','/:id','update','delete','destroy','exports','util','path','express','fs-extra','../../components/interaction/service','../../config/environment','./template.controller','get','isAuthenticated','index'];(function(_0x26502d,_0x167dbd){var _0x780c2b=function(_0x1d224b){while(--_0x1d224b){_0x26502d['push'](_0x26502d['shift']());}};_0x780c2b(++_0x167dbd);}(_0xc7bd,0x86));var _0xdc7b=function(_0x44ac2c,_0x341682){_0x44ac2c=_0x44ac2c-0x0;var _0x34e636=_0xc7bd[_0x44ac2c];return _0x34e636;};'use strict';var multer=require('multer');var util=require(_0xdc7b('0x0'));var path=require(_0xdc7b('0x1'));var timeout=require('connect-timeout');var express=require(_0xdc7b('0x2'));var router=express['Router']();var fs_extra=require(_0xdc7b('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xdc7b('0x4'));var config=require(_0xdc7b('0x5'));var controller=require(_0xdc7b('0x6'));router[_0xdc7b('0x7')]('/',auth[_0xdc7b('0x8')](),controller[_0xdc7b('0x9')]);router[_0xdc7b('0x7')]('/:id',auth[_0xdc7b('0x8')](),controller[_0xdc7b('0xa')]);router[_0xdc7b('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0xdc7b('0xc')](_0xdc7b('0xd'),auth[_0xdc7b('0x8')](),controller[_0xdc7b('0xe')]);router[_0xdc7b('0xf')](_0xdc7b('0xd'),auth['isAuthenticated'](),controller[_0xdc7b('0x10')]);module[_0xdc7b('0x11')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index be93676..2647240 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 _0xfa62=['sequelize','exports','STRING','TEXT'];(function(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0xfa62,0x198));var _0x2fa6=function(_0x1f2f53,_0x3780e5){_0x1f2f53=_0x1f2f53-0x0;var _0x4f5953=_0xfa62[_0x1f2f53];return _0x4f5953;};'use strict';var Sequelize=require(_0x2fa6('0x0'));module[_0x2fa6('0x1')]={'name':{'type':Sequelize[_0x2fa6('0x2')]},'description':{'type':Sequelize[_0x2fa6('0x2')]},'html':{'type':Sequelize[_0x2fa6('0x3')]}}; \ No newline at end of file +var _0x6fcf=['exports','STRING','TEXT','sequelize'];(function(_0x40eb62,_0x4068de){var _0x426309=function(_0x3376e2){while(--_0x3376e2){_0x40eb62['push'](_0x40eb62['shift']());}};_0x426309(++_0x4068de);}(_0x6fcf,0x137));var _0xf6fc=function(_0x208d39,_0x5de94f){_0x208d39=_0x208d39-0x0;var _0x3f96cb=_0x6fcf[_0x208d39];return _0x3f96cb;};'use strict';var Sequelize=require(_0xf6fc('0x0'));module[_0xf6fc('0x1')]={'name':{'type':Sequelize[_0xf6fc('0x2')]},'description':{'type':Sequelize['STRING']},'html':{'type':Sequelize[_0xf6fc('0x3')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 8e33355..ccc3009 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 _0x04a5=['includeAll','options','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','then','Templates','UserProfileResource','error','name','send','map','Template','fieldName','type','key','model','keys','query','filters','intersection','fields','length','attributes','nolimit','where','pick','filter','merge','VIRTUAL','include','findAll','rows','show','params','rawAttributes'];(function(_0x526795,_0x22c832){var _0x56fc28=function(_0x31023f){while(--_0x31023f){_0x526795['push'](_0x526795['shift']());}};_0x56fc28(++_0x22c832);}(_0x04a5,0x158));var _0x504a=function(_0xfcdda0,_0x32479b){_0xfcdda0=_0xfcdda0-0x0;var _0x17ebe3=_0x04a5[_0xfcdda0];return _0x17ebe3;};'use strict';var emlformat=require(_0x504a('0x0'));var rimraf=require(_0x504a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x504a('0x2'));var rp=require(_0x504a('0x3'));var moment=require('moment');var BPromise=require(_0x504a('0x4'));var Mustache=require(_0x504a('0x5'));var util=require(_0x504a('0x6'));var path=require(_0x504a('0x7'));var sox=require(_0x504a('0x8'));var csv=require(_0x504a('0x9'));var ejs=require(_0x504a('0xa'));var fs=require('fs');var fs_extra=require(_0x504a('0xb'));var _=require(_0x504a('0xc'));var squel=require(_0x504a('0xd'));var crypto=require(_0x504a('0xe'));var jsforce=require(_0x504a('0xf'));var deskjs=require(_0x504a('0x10'));var toCsv=require(_0x504a('0x9'));var querystring=require(_0x504a('0x11'));var Papa=require(_0x504a('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x504a('0x13'));var hardwareService=require(_0x504a('0x14'));var logger=require(_0x504a('0x15'))(_0x504a('0x16'));var utils=require(_0x504a('0x17'));var config=require(_0x504a('0x18'));var licenseUtil=require(_0x504a('0x19'));var db=require(_0x504a('0x1a'))['db'];function respondWithStatusCode(_0x2d5f21,_0x4deef4){_0x4deef4=_0x4deef4||0xcc;return function(_0x22b1d1){if(_0x22b1d1){return _0x2d5f21['sendStatus'](_0x4deef4);}return _0x2d5f21['status'](_0x4deef4)[_0x504a('0x1b')]();};}function respondWithResult(_0x34d92b,_0x2b84fe){_0x2b84fe=_0x2b84fe||0xc8;return function(_0x326abb){if(_0x326abb){return _0x34d92b[_0x504a('0x1c')](_0x2b84fe)[_0x504a('0x1d')](_0x326abb);}};}function respondWithFilteredResult(_0x2ddc93,_0x3aa320){return function(_0x45bc99){if(_0x45bc99){var _0x4d68c9=typeof _0x3aa320[_0x504a('0x1e')]===_0x504a('0x1f')&&typeof _0x3aa320[_0x504a('0x20')]==='undefined';var _0x5b6a3c=_0x45bc99[_0x504a('0x21')];var _0x1e4398=_0x4d68c9?0x0:_0x3aa320['offset'];var _0x41afee=_0x4d68c9?_0x45bc99[_0x504a('0x21')]:_0x3aa320['offset']+_0x3aa320['limit'];var _0x5ab39b;if(_0x41afee>=_0x5b6a3c){_0x41afee=_0x5b6a3c;_0x5ab39b=0xc8;}else{_0x5ab39b=0xce;}_0x2ddc93[_0x504a('0x1c')](_0x5ab39b);return _0x2ddc93[_0x504a('0x22')](_0x504a('0x23'),_0x1e4398+'-'+_0x41afee+'/'+_0x5b6a3c)[_0x504a('0x1d')](_0x45bc99);}return null;};}function patchUpdates(_0x273680){return function(_0x4f5cfb){try{jsonpatch[_0x504a('0x24')](_0x4f5cfb,_0x273680,!![]);}catch(_0x4784ae){return BPromise['reject'](_0x4784ae);}return _0x4f5cfb[_0x504a('0x25')]();};}function saveUpdates(_0x4eb782,_0x247453){return function(_0x5d2d7f){if(_0x5d2d7f){return _0x5d2d7f[_0x504a('0x26')](_0x4eb782)['then'](function(_0xde5cbe){return _0xde5cbe;});}return null;};}function removeEntity(_0x150076,_0x156cac){return function(_0x162a38){if(_0x162a38){return _0x162a38[_0x504a('0x27')]()[_0x504a('0x28')](function(){var _0x339624=_0x162a38['get']({'plain':!![]});var _0xc3fead=_0x504a('0x29');return db[_0x504a('0x2a')]['destroy']({'where':{'type':_0xc3fead,'resourceId':_0x339624['id']}})[_0x504a('0x28')](function(){return _0x162a38;});})[_0x504a('0x28')](function(){_0x150076['status'](0xcc)[_0x504a('0x1b')]();});}};}function handleEntityNotFound(_0x5b1b78,_0x14bf22){return function(_0x56829f){if(!_0x56829f){_0x5b1b78['sendStatus'](0x194);}return _0x56829f;};}function handleError(_0x13a6e1,_0x55a4e8){_0x55a4e8=_0x55a4e8||0x1f4;return function(_0x4400b4){logger[_0x504a('0x2b')](_0x4400b4['stack']);if(_0x4400b4[_0x504a('0x2c')]){delete _0x4400b4['name'];}_0x13a6e1[_0x504a('0x1c')](_0x55a4e8)[_0x504a('0x2d')](_0x4400b4);};}exports['index']=function(_0x11ef7d,_0x59a267){var _0x4d94e9={},_0x3e1a10={},_0x33412c={'count':0x0,'rows':[]};var _0xc2108c=_[_0x504a('0x2e')](db[_0x504a('0x2f')]['rawAttributes'],function(_0x1e78d1){return{'name':_0x1e78d1[_0x504a('0x30')],'type':_0x1e78d1[_0x504a('0x31')][_0x504a('0x32')]};});_0x3e1a10[_0x504a('0x33')]=_[_0x504a('0x2e')](_0xc2108c,_0x504a('0x2c'));_0x3e1a10['query']=_[_0x504a('0x34')](_0x11ef7d[_0x504a('0x35')]);_0x3e1a10[_0x504a('0x36')]=_[_0x504a('0x37')](_0x3e1a10['model'],_0x3e1a10[_0x504a('0x35')]);_0x4d94e9['attributes']=_[_0x504a('0x37')](_0x3e1a10[_0x504a('0x33')],qs[_0x504a('0x38')](_0x11ef7d['query'][_0x504a('0x38')]));_0x4d94e9['attributes']=_0x4d94e9['attributes'][_0x504a('0x39')]?_0x4d94e9[_0x504a('0x3a')]:_0x3e1a10[_0x504a('0x33')];if(!_0x11ef7d[_0x504a('0x35')]['hasOwnProperty'](_0x504a('0x3b'))){_0x4d94e9[_0x504a('0x20')]=qs[_0x504a('0x20')](_0x11ef7d[_0x504a('0x35')]['limit']);_0x4d94e9[_0x504a('0x1e')]=qs[_0x504a('0x1e')](_0x11ef7d['query']['offset']);}_0x4d94e9['order']=qs['sort'](_0x11ef7d[_0x504a('0x35')]['sort']);_0x4d94e9[_0x504a('0x3c')]=qs['filters'](_[_0x504a('0x3d')](_0x11ef7d[_0x504a('0x35')],_0x3e1a10['filters']),_0xc2108c);if(_0x11ef7d[_0x504a('0x35')][_0x504a('0x3e')]){_0x4d94e9[_0x504a('0x3c')]=_[_0x504a('0x3f')](_0x4d94e9['where'],{'$or':_[_0x504a('0x2e')](_0xc2108c,function(_0x5cc759){if(_0x5cc759[_0x504a('0x31')]!==_0x504a('0x40')){var _0x22b705={};_0x22b705[_0x5cc759['name']]={'$like':'%'+_0x11ef7d[_0x504a('0x35')][_0x504a('0x3e')]+'%'};return _0x22b705;}})});}_0x4d94e9=_[_0x504a('0x3f')]({},_0x4d94e9,_0x11ef7d['options']);var _0x3b98a3={'where':_0x4d94e9[_0x504a('0x3c')]};return db['Template'][_0x504a('0x21')](_0x3b98a3)['then'](function(_0x1709ba){_0x33412c[_0x504a('0x21')]=_0x1709ba;if(_0x11ef7d['query']['includeAll']){_0x4d94e9[_0x504a('0x41')]=[{'all':!![]}];}return db[_0x504a('0x2f')][_0x504a('0x42')](_0x4d94e9);})[_0x504a('0x28')](function(_0x161e63){_0x33412c[_0x504a('0x43')]=_0x161e63;return _0x33412c;})[_0x504a('0x28')](respondWithFilteredResult(_0x59a267,_0x4d94e9))['catch'](handleError(_0x59a267,null));};exports[_0x504a('0x44')]=function(_0x47f77a,_0x448887){var _0x38495={'raw':!![],'where':{'id':_0x47f77a[_0x504a('0x45')]['id']}},_0x34f04c={};_0x34f04c['model']=_['keys'](db[_0x504a('0x2f')][_0x504a('0x46')]);_0x34f04c[_0x504a('0x35')]=_[_0x504a('0x34')](_0x47f77a[_0x504a('0x35')]);_0x34f04c[_0x504a('0x36')]=_[_0x504a('0x37')](_0x34f04c[_0x504a('0x33')],_0x34f04c[_0x504a('0x35')]);_0x38495['attributes']=_[_0x504a('0x37')](_0x34f04c['model'],qs[_0x504a('0x38')](_0x47f77a[_0x504a('0x35')]['fields']));_0x38495['attributes']=_0x38495['attributes']['length']?_0x38495[_0x504a('0x3a')]:_0x34f04c[_0x504a('0x33')];if(_0x47f77a[_0x504a('0x35')][_0x504a('0x47')]){_0x38495[_0x504a('0x41')]=[{'all':!![]}];}_0x38495=_['merge']({},_0x38495,_0x47f77a[_0x504a('0x48')]);return db[_0x504a('0x2f')][_0x504a('0x49')](_0x38495)[_0x504a('0x28')](handleEntityNotFound(_0x448887,null))[_0x504a('0x28')](respondWithResult(_0x448887,null))[_0x504a('0x4a')](handleError(_0x448887,null));};exports[_0x504a('0x4b')]=function(_0x2b885e,_0x3600c8){return db[_0x504a('0x2f')][_0x504a('0x4b')](_0x2b885e[_0x504a('0x4c')],{})[_0x504a('0x28')](function(_0x1735d5){var _0x177a05=_0x2b885e[_0x504a('0x4d')][_0x504a('0x4e')]({'plain':!![]});if(!_0x177a05)throw new Error(_0x504a('0x4f'));if(_0x177a05['role']==='user'){var _0x5df0d3=_0x1735d5['get']({'plain':!![]});var _0x1a1c55=_0x504a('0x29');return db[_0x504a('0x50')][_0x504a('0x49')]({'where':{'name':_0x1a1c55,'userProfileId':_0x177a05['userProfileId']},'raw':!![]})[_0x504a('0x28')](function(_0x5a4521){if(_0x5a4521&&_0x5a4521[_0x504a('0x51')]===0x0){return db['UserProfileResource']['create']({'name':_0x5df0d3[_0x504a('0x2c')],'resourceId':_0x5df0d3['id'],'type':_0x5a4521['name'],'sectionId':_0x5a4521['id']},{})['then'](function(){return _0x1735d5;});}else{return _0x1735d5;}})[_0x504a('0x4a')](function(_0x2f4901){logger[_0x504a('0x2b')](_0x504a('0x52'),_0x2f4901);throw _0x2f4901;});}return _0x1735d5;})[_0x504a('0x28')](respondWithResult(_0x3600c8,0xc9))['catch'](handleError(_0x3600c8,null));};exports[_0x504a('0x26')]=function(_0x232a5c,_0x7bf206){if(_0x232a5c[_0x504a('0x4c')]['id']){delete _0x232a5c[_0x504a('0x4c')]['id'];}return db[_0x504a('0x2f')][_0x504a('0x49')]({'where':{'id':_0x232a5c[_0x504a('0x45')]['id']}})[_0x504a('0x28')](handleEntityNotFound(_0x7bf206,null))[_0x504a('0x28')](saveUpdates(_0x232a5c[_0x504a('0x4c')],null))[_0x504a('0x28')](respondWithResult(_0x7bf206,null))['catch'](handleError(_0x7bf206,null));};exports[_0x504a('0x27')]=function(_0x348cb3,_0x36d4a1){return db[_0x504a('0x2f')][_0x504a('0x49')]({'where':{'id':_0x348cb3[_0x504a('0x45')]['id']}})[_0x504a('0x28')](handleEntityNotFound(_0x36d4a1,null))[_0x504a('0x28')](removeEntity(_0x36d4a1,null))[_0x504a('0x4a')](handleError(_0x36d4a1,null));}; \ No newline at end of file +var _0x8bcf=['squel','crypto','jsforce','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','set','Content-Range','json','apply','reject','update','then','get','Templates','UserProfileResource','destroy','end','stack','name','send','index','map','Template','rawAttributes','fieldName','type','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','findAll','rows','params','include','find','catch','create','body','userProfileId','autoAssociation','error','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash'];(function(_0x4cb231,_0x3d3c5b){var _0x4d5063=function(_0x4af9d0){while(--_0x4af9d0){_0x4cb231['push'](_0x4cb231['shift']());}};_0x4d5063(++_0x3d3c5b);}(_0x8bcf,0x1d2));var _0xf8bc=function(_0x2c4e71,_0xbb6f15){_0x2c4e71=_0x2c4e71-0x0;var _0xbb9838=_0x8bcf[_0x2c4e71];return _0xbb9838;};'use strict';var emlformat=require(_0xf8bc('0x0'));var rimraf=require(_0xf8bc('0x1'));var zipdir=require(_0xf8bc('0x2'));var jsonpatch=require(_0xf8bc('0x3'));var rp=require(_0xf8bc('0x4'));var moment=require('moment');var BPromise=require(_0xf8bc('0x5'));var Mustache=require(_0xf8bc('0x6'));var util=require(_0xf8bc('0x7'));var path=require(_0xf8bc('0x8'));var sox=require(_0xf8bc('0x9'));var csv=require(_0xf8bc('0xa'));var ejs=require(_0xf8bc('0xb'));var fs=require('fs');var fs_extra=require(_0xf8bc('0xc'));var _=require(_0xf8bc('0xd'));var squel=require(_0xf8bc('0xe'));var crypto=require(_0xf8bc('0xf'));var jsforce=require(_0xf8bc('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xf8bc('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xf8bc('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xf8bc('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf8bc('0x13'));var utils=require(_0xf8bc('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xf8bc('0x15'));var db=require(_0xf8bc('0x16'))['db'];function respondWithStatusCode(_0x4c2b4f,_0x51febe){_0x51febe=_0x51febe||0xcc;return function(_0x4b0c6b){if(_0x4b0c6b){return _0x4c2b4f[_0xf8bc('0x17')](_0x51febe);}return _0x4c2b4f[_0xf8bc('0x18')](_0x51febe)['end']();};}function respondWithResult(_0x555f51,_0x14e5b7){_0x14e5b7=_0x14e5b7||0xc8;return function(_0x2a4e4d){if(_0x2a4e4d){return _0x555f51[_0xf8bc('0x18')](_0x14e5b7)['json'](_0x2a4e4d);}};}function respondWithFilteredResult(_0x210e3f,_0x57ec33){return function(_0x2c3e76){if(_0x2c3e76){var _0x4e6237=typeof _0x57ec33[_0xf8bc('0x19')]===_0xf8bc('0x1a')&&typeof _0x57ec33[_0xf8bc('0x1b')]===_0xf8bc('0x1a');var _0x2e9e65=_0x2c3e76['count'];var _0x269196=_0x4e6237?0x0:_0x57ec33[_0xf8bc('0x19')];var _0x3f1745=_0x4e6237?_0x2c3e76['count']:_0x57ec33[_0xf8bc('0x19')]+_0x57ec33[_0xf8bc('0x1b')];var _0x2029fc;if(_0x3f1745>=_0x2e9e65){_0x3f1745=_0x2e9e65;_0x2029fc=0xc8;}else{_0x2029fc=0xce;}_0x210e3f[_0xf8bc('0x18')](_0x2029fc);return _0x210e3f[_0xf8bc('0x1c')](_0xf8bc('0x1d'),_0x269196+'-'+_0x3f1745+'/'+_0x2e9e65)[_0xf8bc('0x1e')](_0x2c3e76);}return null;};}function patchUpdates(_0x5b03da){return function(_0xe4dd20){try{jsonpatch[_0xf8bc('0x1f')](_0xe4dd20,_0x5b03da,!![]);}catch(_0x8c87c0){return BPromise[_0xf8bc('0x20')](_0x8c87c0);}return _0xe4dd20['save']();};}function saveUpdates(_0x2f2d93,_0xd9605b){return function(_0x49d9a0){if(_0x49d9a0){return _0x49d9a0[_0xf8bc('0x21')](_0x2f2d93)['then'](function(_0x534f74){return _0x534f74;});}return null;};}function removeEntity(_0x159ac3,_0x2a1c3d){return function(_0x244c0d){if(_0x244c0d){return _0x244c0d['destroy']()[_0xf8bc('0x22')](function(){var _0x1f648b=_0x244c0d[_0xf8bc('0x23')]({'plain':!![]});var _0x2225d9=_0xf8bc('0x24');return db[_0xf8bc('0x25')][_0xf8bc('0x26')]({'where':{'type':_0x2225d9,'resourceId':_0x1f648b['id']}})[_0xf8bc('0x22')](function(){return _0x244c0d;});})[_0xf8bc('0x22')](function(){_0x159ac3['status'](0xcc)[_0xf8bc('0x27')]();});}};}function handleEntityNotFound(_0x2fcd8a,_0x8ea3ed){return function(_0x3619d1){if(!_0x3619d1){_0x2fcd8a[_0xf8bc('0x17')](0x194);}return _0x3619d1;};}function handleError(_0x1994b4,_0x3e3780){_0x3e3780=_0x3e3780||0x1f4;return function(_0x404f60){logger['error'](_0x404f60[_0xf8bc('0x28')]);if(_0x404f60[_0xf8bc('0x29')]){delete _0x404f60['name'];}_0x1994b4[_0xf8bc('0x18')](_0x3e3780)[_0xf8bc('0x2a')](_0x404f60);};}exports[_0xf8bc('0x2b')]=function(_0x4f37a8,_0x179a96){var _0x4d0a58={},_0x3f0f43={},_0x58eeb2={'count':0x0,'rows':[]};var _0x13d72a=_[_0xf8bc('0x2c')](db[_0xf8bc('0x2d')][_0xf8bc('0x2e')],function(_0x9ff2f7){return{'name':_0x9ff2f7[_0xf8bc('0x2f')],'type':_0x9ff2f7[_0xf8bc('0x30')]['key']};});_0x3f0f43[_0xf8bc('0x31')]=_['map'](_0x13d72a,_0xf8bc('0x29'));_0x3f0f43['query']=_[_0xf8bc('0x32')](_0x4f37a8[_0xf8bc('0x33')]);_0x3f0f43[_0xf8bc('0x34')]=_[_0xf8bc('0x35')](_0x3f0f43['model'],_0x3f0f43[_0xf8bc('0x33')]);_0x4d0a58['attributes']=_[_0xf8bc('0x35')](_0x3f0f43[_0xf8bc('0x31')],qs[_0xf8bc('0x36')](_0x4f37a8['query']['fields']));_0x4d0a58[_0xf8bc('0x37')]=_0x4d0a58[_0xf8bc('0x37')][_0xf8bc('0x38')]?_0x4d0a58['attributes']:_0x3f0f43[_0xf8bc('0x31')];if(!_0x4f37a8[_0xf8bc('0x33')][_0xf8bc('0x39')](_0xf8bc('0x3a'))){_0x4d0a58[_0xf8bc('0x1b')]=qs['limit'](_0x4f37a8[_0xf8bc('0x33')]['limit']);_0x4d0a58[_0xf8bc('0x19')]=qs[_0xf8bc('0x19')](_0x4f37a8[_0xf8bc('0x33')][_0xf8bc('0x19')]);}_0x4d0a58[_0xf8bc('0x3b')]=qs[_0xf8bc('0x3c')](_0x4f37a8[_0xf8bc('0x33')][_0xf8bc('0x3c')]);_0x4d0a58[_0xf8bc('0x3d')]=qs['filters'](_[_0xf8bc('0x3e')](_0x4f37a8[_0xf8bc('0x33')],_0x3f0f43[_0xf8bc('0x34')]),_0x13d72a);if(_0x4f37a8[_0xf8bc('0x33')][_0xf8bc('0x3f')]){_0x4d0a58[_0xf8bc('0x3d')]=_[_0xf8bc('0x40')](_0x4d0a58[_0xf8bc('0x3d')],{'$or':_['map'](_0x13d72a,function(_0x443f37){if(_0x443f37[_0xf8bc('0x30')]!==_0xf8bc('0x41')){var _0x44c83c={};_0x44c83c[_0x443f37['name']]={'$like':'%'+_0x4f37a8[_0xf8bc('0x33')][_0xf8bc('0x3f')]+'%'};return _0x44c83c;}})});}_0x4d0a58=_['merge']({},_0x4d0a58,_0x4f37a8[_0xf8bc('0x42')]);var _0x6344d9={'where':_0x4d0a58[_0xf8bc('0x3d')]};return db[_0xf8bc('0x2d')][_0xf8bc('0x43')](_0x6344d9)[_0xf8bc('0x22')](function(_0x20c14e){_0x58eeb2[_0xf8bc('0x43')]=_0x20c14e;if(_0x4f37a8['query'][_0xf8bc('0x44')]){_0x4d0a58['include']=[{'all':!![]}];}return db['Template'][_0xf8bc('0x45')](_0x4d0a58);})[_0xf8bc('0x22')](function(_0x23c258){_0x58eeb2[_0xf8bc('0x46')]=_0x23c258;return _0x58eeb2;})['then'](respondWithFilteredResult(_0x179a96,_0x4d0a58))['catch'](handleError(_0x179a96,null));};exports['show']=function(_0x5f3013,_0x5aab07){var _0xf3edc0={'raw':!![],'where':{'id':_0x5f3013[_0xf8bc('0x47')]['id']}},_0x350441={};_0x350441['model']=_[_0xf8bc('0x32')](db[_0xf8bc('0x2d')][_0xf8bc('0x2e')]);_0x350441[_0xf8bc('0x33')]=_[_0xf8bc('0x32')](_0x5f3013[_0xf8bc('0x33')]);_0x350441['filters']=_[_0xf8bc('0x35')](_0x350441['model'],_0x350441[_0xf8bc('0x33')]);_0xf3edc0[_0xf8bc('0x37')]=_[_0xf8bc('0x35')](_0x350441['model'],qs[_0xf8bc('0x36')](_0x5f3013[_0xf8bc('0x33')][_0xf8bc('0x36')]));_0xf3edc0['attributes']=_0xf3edc0['attributes'][_0xf8bc('0x38')]?_0xf3edc0[_0xf8bc('0x37')]:_0x350441['model'];if(_0x5f3013[_0xf8bc('0x33')][_0xf8bc('0x44')]){_0xf3edc0[_0xf8bc('0x48')]=[{'all':!![]}];}_0xf3edc0=_[_0xf8bc('0x40')]({},_0xf3edc0,_0x5f3013['options']);return db[_0xf8bc('0x2d')][_0xf8bc('0x49')](_0xf3edc0)['then'](handleEntityNotFound(_0x5aab07,null))[_0xf8bc('0x22')](respondWithResult(_0x5aab07,null))[_0xf8bc('0x4a')](handleError(_0x5aab07,null));};exports[_0xf8bc('0x4b')]=function(_0x2178af,_0x5bba87){return db[_0xf8bc('0x2d')][_0xf8bc('0x4b')](_0x2178af[_0xf8bc('0x4c')],{})['then'](function(_0x5f1b86){var _0x5368b0=_0x2178af['user']['get']({'plain':!![]});if(!_0x5368b0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5368b0['role']==='user'){var _0x37ab4e=_0x5f1b86[_0xf8bc('0x23')]({'plain':!![]});var _0xc99b35=_0xf8bc('0x24');return db['UserProfileSection'][_0xf8bc('0x49')]({'where':{'name':_0xc99b35,'userProfileId':_0x5368b0[_0xf8bc('0x4d')]},'raw':!![]})[_0xf8bc('0x22')](function(_0x3137e5){if(_0x3137e5&&_0x3137e5[_0xf8bc('0x4e')]===0x0){return db['UserProfileResource'][_0xf8bc('0x4b')]({'name':_0x37ab4e['name'],'resourceId':_0x37ab4e['id'],'type':_0x3137e5[_0xf8bc('0x29')],'sectionId':_0x3137e5['id']},{})[_0xf8bc('0x22')](function(){return _0x5f1b86;});}else{return _0x5f1b86;}})[_0xf8bc('0x4a')](function(_0x1e4865){logger[_0xf8bc('0x4f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1e4865);throw _0x1e4865;});}return _0x5f1b86;})[_0xf8bc('0x22')](respondWithResult(_0x5bba87,0xc9))[_0xf8bc('0x4a')](handleError(_0x5bba87,null));};exports[_0xf8bc('0x21')]=function(_0x263881,_0x180986){if(_0x263881[_0xf8bc('0x4c')]['id']){delete _0x263881[_0xf8bc('0x4c')]['id'];}return db['Template'][_0xf8bc('0x49')]({'where':{'id':_0x263881['params']['id']}})['then'](handleEntityNotFound(_0x180986,null))[_0xf8bc('0x22')](saveUpdates(_0x263881[_0xf8bc('0x4c')],null))[_0xf8bc('0x22')](respondWithResult(_0x180986,null))['catch'](handleError(_0x180986,null));};exports['destroy']=function(_0x22cba0,_0x44f591){return db[_0xf8bc('0x2d')][_0xf8bc('0x49')]({'where':{'id':_0x22cba0['params']['id']}})['then'](handleEntityNotFound(_0x44f591,null))['then'](removeEntity(_0x44f591,null))['catch'](handleError(_0x44f591,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index e324df4..8bac0d4 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 _0xc56c=['lodash','moment','bluebird','path','rimraf','../../config/environment','./template.attributes','exports','define'];(function(_0x4fd0e1,_0x402971){var _0x536d96=function(_0x9303a4){while(--_0x9303a4){_0x4fd0e1['push'](_0x4fd0e1['shift']());}};_0x536d96(++_0x402971);}(_0xc56c,0x99));var _0xcc56=function(_0x27313c,_0x4ab54b){_0x27313c=_0x27313c-0x0;var _0x3aaaf5=_0xc56c[_0x27313c];return _0x3aaaf5;};'use strict';var _=require(_0xcc56('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xcc56('0x1'));var BPromise=require(_0xcc56('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcc56('0x3'));var rimraf=require(_0xcc56('0x4'));var config=require(_0xcc56('0x5'));var attributes=require(_0xcc56('0x6'));module[_0xcc56('0x7')]=function(_0xbf8a86,_0x3f8866){return _0xbf8a86[_0xcc56('0x8')]('Template',attributes,{'tableName':'tools_templates','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xea48=['path','rimraf','../../config/environment','./template.attributes','define','Template','tools_templates','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x284bc4,_0x13816d){var _0x35c1a4=function(_0x3fe90c){while(--_0x3fe90c){_0x284bc4['push'](_0x284bc4['shift']());}};_0x35c1a4(++_0x13816d);}(_0xea48,0x1e8));var _0x8ea4=function(_0x1e3558,_0x2ec979){_0x1e3558=_0x1e3558-0x0;var _0x2287c6=_0xea48[_0x1e3558];return _0x2287c6;};'use strict';var _=require(_0x8ea4('0x0'));var util=require('util');var logger=require(_0x8ea4('0x1'))(_0x8ea4('0x2'));var moment=require(_0x8ea4('0x3'));var BPromise=require(_0x8ea4('0x4'));var rp=require(_0x8ea4('0x5'));var fs=require('fs');var path=require(_0x8ea4('0x6'));var rimraf=require(_0x8ea4('0x7'));var config=require(_0x8ea4('0x8'));var attributes=require(_0x8ea4('0x9'));module['exports']=function(_0x3145e7,_0x172bf0){return _0x3145e7[_0x8ea4('0xa')](_0x8ea4('0xb'),attributes,{'tableName':_0x8ea4('0xc'),'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 bb7127a..5e3ab3e 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 _0x4e24=['include','map','model','then','debug','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Template,\x20%s,\x20%s','request\x20sent','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetTemplate','Template','findAll','options','raw','attributes','limit'];(function(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0x4e24,0x1ef));var _0x44e2=function(_0x48fc96,_0x40c465){_0x48fc96=_0x48fc96-0x0;var _0x4ac64=_0x4e24[_0x48fc96];return _0x4ac64;};'use strict';var _=require(_0x44e2('0x0'));var util=require(_0x44e2('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x44e2('0x2'));var fs=require('fs');var Redis=require(_0x44e2('0x3'));var db=require(_0x44e2('0x4'))['db'];var utils=require(_0x44e2('0x5'));var logger=require(_0x44e2('0x6'))(_0x44e2('0x7'));var config=require(_0x44e2('0x8'));var jayson=require(_0x44e2('0x9'));var client=jayson[_0x44e2('0xa')][_0x44e2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3dff02,_0x551990,_0x47b695){return new BPromise(function(_0x45df1b,_0x17f310){return client[_0x44e2('0xc')](_0x3dff02,_0x47b695)['then'](function(_0x490cfb){logger[_0x44e2('0xd')](_0x44e2('0xe'),_0x551990,_0x44e2('0xf'));logger['debug'](_0x44e2('0x10'),_0x551990,_0x44e2('0xf'),JSON[_0x44e2('0x11')](_0x490cfb));if(_0x490cfb[_0x44e2('0x12')]){if(_0x490cfb[_0x44e2('0x12')][_0x44e2('0x13')]===0x1f4){logger['error'](_0x44e2('0xe'),_0x551990,_0x490cfb['error'][_0x44e2('0x14')]);return _0x17f310(_0x490cfb[_0x44e2('0x12')][_0x44e2('0x14')]);}logger['error'](_0x44e2('0xe'),_0x551990,_0x490cfb[_0x44e2('0x12')]['message']);return _0x45df1b(_0x490cfb[_0x44e2('0x12')][_0x44e2('0x14')]);}else{logger[_0x44e2('0xd')](_0x44e2('0xe'),_0x551990,_0x44e2('0xf'));_0x45df1b(_0x490cfb[_0x44e2('0x15')][_0x44e2('0x14')]);}})[_0x44e2('0x16')](function(_0x5bdf64){logger[_0x44e2('0x12')]('Template,\x20%s,\x20%s',_0x551990,_0x5bdf64);_0x17f310(_0x5bdf64);});});}exports[_0x44e2('0x17')]=function(_0x3364b3){var _0x3610b4=this;return new Promise(function(_0x1b2e9c,_0x3f2a95){return db[_0x44e2('0x18')][_0x44e2('0x19')]({'raw':_0x3364b3[_0x44e2('0x1a')]?_0x3364b3[_0x44e2('0x1a')][_0x44e2('0x1b')]===undefined?!![]:![]:!![],'where':_0x3364b3[_0x44e2('0x1a')]?_0x3364b3['options']['where']||null:null,'attributes':_0x3364b3[_0x44e2('0x1a')]?_0x3364b3[_0x44e2('0x1a')][_0x44e2('0x1c')]||null:null,'limit':_0x3364b3[_0x44e2('0x1a')]?_0x3364b3[_0x44e2('0x1a')][_0x44e2('0x1d')]||null:null,'include':_0x3364b3['options']?_0x3364b3[_0x44e2('0x1a')][_0x44e2('0x1e')]?_[_0x44e2('0x1f')](_0x3364b3[_0x44e2('0x1a')][_0x44e2('0x1e')],function(_0x53f874){return{'model':db[_0x53f874[_0x44e2('0x20')]],'as':_0x53f874['as'],'attributes':_0x53f874[_0x44e2('0x1c')],'include':_0x53f874[_0x44e2('0x1e')]?_[_0x44e2('0x1f')](_0x53f874[_0x44e2('0x1e')],function(_0x5886d9){return{'model':db[_0x5886d9[_0x44e2('0x20')]],'as':_0x5886d9['as'],'attributes':_0x5886d9[_0x44e2('0x1c')],'include':_0x5886d9[_0x44e2('0x1e')]?_[_0x44e2('0x1f')](_0x5886d9[_0x44e2('0x1e')],function(_0x52aa12){return{'model':db[_0x52aa12[_0x44e2('0x20')]],'as':_0x52aa12['as'],'attributes':_0x52aa12[_0x44e2('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x44e2('0x21')](function(_0x283323){logger['info'](_0x44e2('0x17'),_0x3364b3);logger[_0x44e2('0x22')]('GetTemplate',_0x3364b3,JSON[_0x44e2('0x11')](_0x283323));_0x1b2e9c(_0x283323);})[_0x44e2('0x16')](function(_0x51303f){logger[_0x44e2('0x12')](_0x44e2('0x17'),_0x51303f[_0x44e2('0x14')],_0x3364b3);_0x3f2a95(_0x3610b4[_0x44e2('0x12')](0x1f4,_0x51303f[_0x44e2('0x14')]));});});}; \ No newline at end of file +var _0xb235=['error','code','message','catch','GetTemplate','Template','findAll','options','raw','where','attributes','limit','include','map','model','then','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','Template,\x20%s,\x20%s','request\x20sent','Template,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x30cfcc,_0x340db8){var _0x28691f=function(_0x5ae6d0){while(--_0x5ae6d0){_0x30cfcc['push'](_0x30cfcc['shift']());}};_0x28691f(++_0x340db8);}(_0xb235,0xb5));var _0x5b23=function(_0x4695e2,_0x3d5f15){_0x4695e2=_0x4695e2-0x0;var _0x160563=_0xb235[_0x4695e2];return _0x160563;};'use strict';var _=require(_0x5b23('0x0'));var util=require(_0x5b23('0x1'));var moment=require('moment');var BPromise=require(_0x5b23('0x2'));var rs=require(_0x5b23('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5b23('0x4'))['db'];var utils=require(_0x5b23('0x5'));var logger=require(_0x5b23('0x6'))('rpc');var config=require(_0x5b23('0x7'));var jayson=require(_0x5b23('0x8'));var client=jayson[_0x5b23('0x9')][_0x5b23('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d94a4,_0x5e390,_0x5ce7c4){return new BPromise(function(_0xe27265,_0x37e7ce){return client[_0x5b23('0xb')](_0x1d94a4,_0x5ce7c4)['then'](function(_0x5af4e2){logger[_0x5b23('0xc')](_0x5b23('0xd'),_0x5e390,_0x5b23('0xe'));logger['debug'](_0x5b23('0xf'),_0x5e390,'request\x20sent',JSON[_0x5b23('0x10')](_0x5af4e2));if(_0x5af4e2[_0x5b23('0x11')]){if(_0x5af4e2[_0x5b23('0x11')][_0x5b23('0x12')]===0x1f4){logger[_0x5b23('0x11')]('Template,\x20%s,\x20%s',_0x5e390,_0x5af4e2[_0x5b23('0x11')][_0x5b23('0x13')]);return _0x37e7ce(_0x5af4e2[_0x5b23('0x11')][_0x5b23('0x13')]);}logger[_0x5b23('0x11')](_0x5b23('0xd'),_0x5e390,_0x5af4e2[_0x5b23('0x11')]['message']);return _0xe27265(_0x5af4e2[_0x5b23('0x11')][_0x5b23('0x13')]);}else{logger['info'](_0x5b23('0xd'),_0x5e390,_0x5b23('0xe'));_0xe27265(_0x5af4e2['result']['message']);}})[_0x5b23('0x14')](function(_0x515f56){logger[_0x5b23('0x11')](_0x5b23('0xd'),_0x5e390,_0x515f56);_0x37e7ce(_0x515f56);});});}exports[_0x5b23('0x15')]=function(_0x29dfbc){var _0x4e6bc1=this;return new Promise(function(_0x5b754a,_0x447990){return db[_0x5b23('0x16')][_0x5b23('0x17')]({'raw':_0x29dfbc[_0x5b23('0x18')]?_0x29dfbc[_0x5b23('0x18')][_0x5b23('0x19')]===undefined?!![]:![]:!![],'where':_0x29dfbc[_0x5b23('0x18')]?_0x29dfbc[_0x5b23('0x18')][_0x5b23('0x1a')]||null:null,'attributes':_0x29dfbc[_0x5b23('0x18')]?_0x29dfbc['options'][_0x5b23('0x1b')]||null:null,'limit':_0x29dfbc['options']?_0x29dfbc['options'][_0x5b23('0x1c')]||null:null,'include':_0x29dfbc[_0x5b23('0x18')]?_0x29dfbc[_0x5b23('0x18')][_0x5b23('0x1d')]?_[_0x5b23('0x1e')](_0x29dfbc[_0x5b23('0x18')][_0x5b23('0x1d')],function(_0x42e5a1){return{'model':db[_0x42e5a1['model']],'as':_0x42e5a1['as'],'attributes':_0x42e5a1[_0x5b23('0x1b')],'include':_0x42e5a1[_0x5b23('0x1d')]?_[_0x5b23('0x1e')](_0x42e5a1['include'],function(_0x4e672c){return{'model':db[_0x4e672c[_0x5b23('0x1f')]],'as':_0x4e672c['as'],'attributes':_0x4e672c['attributes'],'include':_0x4e672c['include']?_['map'](_0x4e672c['include'],function(_0x4fb113){return{'model':db[_0x4fb113[_0x5b23('0x1f')]],'as':_0x4fb113['as'],'attributes':_0x4fb113[_0x5b23('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x5b23('0x20')](function(_0x1e033d){logger['info'](_0x5b23('0x15'),_0x29dfbc);logger['debug'](_0x5b23('0x15'),_0x29dfbc,JSON[_0x5b23('0x10')](_0x1e033d));_0x5b754a(_0x1e033d);})['catch'](function(_0x256974){logger[_0x5b23('0x11')](_0x5b23('0x15'),_0x256974['message'],_0x29dfbc);_0x447990(_0x4e6bc1[_0x5b23('0x11')](0x1f4,_0x256974[_0x5b23('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index c77b7de..35e7c6f 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 _0x6739=['addAnyCondition','put','update','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./trigger.controller','index','get','/:id','/:id/all_conditions','isAuthenticated','/:id/any_conditions','/:id/actions','getActions','create','post','addAllCondition'];(function(_0x1f2835,_0x41e610){var _0x40990f=function(_0x559286){while(--_0x559286){_0x1f2835['push'](_0x1f2835['shift']());}};_0x40990f(++_0x41e610);}(_0x6739,0xd3));var _0x9673=function(_0x46d0f5,_0x40703a){_0x46d0f5=_0x46d0f5-0x0;var _0x1e8730=_0x6739[_0x46d0f5];return _0x1e8730;};'use strict';var multer=require(_0x9673('0x0'));var util=require(_0x9673('0x1'));var path=require(_0x9673('0x2'));var timeout=require(_0x9673('0x3'));var express=require(_0x9673('0x4'));var router=express[_0x9673('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x9673('0x6'));var config=require('../../config/environment');var controller=require(_0x9673('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x9673('0x8')]);router[_0x9673('0x9')](_0x9673('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x9673('0x9')](_0x9673('0xb'),auth[_0x9673('0xc')](),controller['getAllConditions']);router[_0x9673('0x9')](_0x9673('0xd'),auth[_0x9673('0xc')](),controller['getAnyConditions']);router[_0x9673('0x9')](_0x9673('0xe'),auth[_0x9673('0xc')](),controller[_0x9673('0xf')]);router['post']('/',auth[_0x9673('0xc')](),controller[_0x9673('0x10')]);router[_0x9673('0x11')](_0x9673('0xb'),auth['isAuthenticated'](),controller[_0x9673('0x12')]);router[_0x9673('0x11')]('/:id/any_conditions',auth[_0x9673('0xc')](),controller[_0x9673('0x13')]);router[_0x9673('0x11')]('/:id/actions',auth[_0x9673('0xc')](),controller['addAction']);router[_0x9673('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x9673('0x15')]);router['delete'](_0x9673('0xa'),auth[_0x9673('0xc')](),controller['destroy']);module[_0x9673('0x16')]=router; \ No newline at end of file +var _0x65bd=['getAnyConditions','/:id/actions','getActions','post','create','addAnyCondition','addAction','put','delete','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/all_conditions','/:id/any_conditions'];(function(_0x2f9505,_0x57e485){var _0x105858=function(_0x2c4351){while(--_0x2c4351){_0x2f9505['push'](_0x2f9505['shift']());}};_0x105858(++_0x57e485);}(_0x65bd,0xb3));var _0xd65b=function(_0x5d3db3,_0x5ce18d){_0x5d3db3=_0x5d3db3-0x0;var _0x58817d=_0x65bd[_0x5d3db3];return _0x58817d;};'use strict';var multer=require(_0xd65b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xd65b('0x1'));var express=require(_0xd65b('0x2'));var router=express[_0xd65b('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xd65b('0x4'));var interaction=require(_0xd65b('0x5'));var config=require(_0xd65b('0x6'));var controller=require('./trigger.controller');router[_0xd65b('0x7')]('/',auth[_0xd65b('0x8')](),controller[_0xd65b('0x9')]);router[_0xd65b('0x7')](_0xd65b('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xd65b('0x7')](_0xd65b('0xb'),auth['isAuthenticated'](),controller['getAllConditions']);router[_0xd65b('0x7')](_0xd65b('0xc'),auth[_0xd65b('0x8')](),controller[_0xd65b('0xd')]);router[_0xd65b('0x7')](_0xd65b('0xe'),auth[_0xd65b('0x8')](),controller[_0xd65b('0xf')]);router[_0xd65b('0x10')]('/',auth['isAuthenticated'](),controller[_0xd65b('0x11')]);router[_0xd65b('0x10')]('/:id/all_conditions',auth[_0xd65b('0x8')](),controller['addAllCondition']);router[_0xd65b('0x10')](_0xd65b('0xc'),auth[_0xd65b('0x8')](),controller[_0xd65b('0x12')]);router[_0xd65b('0x10')](_0xd65b('0xe'),auth['isAuthenticated'](),controller[_0xd65b('0x13')]);router[_0xd65b('0x14')](_0xd65b('0xa'),auth[_0xd65b('0x8')](),controller['update']);router[_0xd65b('0x15')](_0xd65b('0xa'),auth[_0xd65b('0x8')](),controller[_0xd65b('0x16')]);module[_0xd65b('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 49498cb..cd96be7 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 _0x8c79=['exports','STRING','BOOLEAN'];(function(_0x5dfed8,_0x2574db){var _0x37d3d1=function(_0x38c154){while(--_0x38c154){_0x5dfed8['push'](_0x5dfed8['shift']());}};_0x37d3d1(++_0x2574db);}(_0x8c79,0xa5));var _0x98c7=function(_0x35ecfc,_0xa522ae){_0x35ecfc=_0x35ecfc-0x0;var _0x5d759d=_0x8c79[_0x35ecfc];return _0x5d759d;};'use strict';var Sequelize=require('sequelize');module[_0x98c7('0x0')]={'name':{'type':Sequelize[_0x98c7('0x1')]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x98c7('0x1')]},'status':{'type':Sequelize[_0x98c7('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0xc547=['exports','STRING','BOOLEAN','sequelize'];(function(_0x3f7cd5,_0x4d1a60){var _0x429e2a=function(_0x161b02){while(--_0x161b02){_0x3f7cd5['push'](_0x3f7cd5['shift']());}};_0x429e2a(++_0x4d1a60);}(_0xc547,0xc7));var _0x7c54=function(_0x59ef06,_0x5ec571){_0x59ef06=_0x59ef06-0x0;var _0x11c420=_0xc547[_0x59ef06];return _0x11c420;};'use strict';var Sequelize=require(_0x7c54('0x0'));module[_0x7c54('0x1')]={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x7c54('0x2')]},'status':{'type':Sequelize[_0x7c54('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 e6dfa94..daa75ae 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 _0xb212=['destroy','end','error','stack','name','send','map','Trigger','rawAttributes','key','keys','query','intersection','attributes','model','fields','hasOwnProperty','order','sort','filters','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addAllCondition','TriggerAllId','Condition','addAnyCondition','getAllConditions','nolimit','findOne','pick','getAnyConditions','addAction','TriggerId','Action','getActions','eml-format','rimraf','fast-json-patch','request-promise','moment','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','update','then','get','Triggers','UserProfileResource'];(function(_0x30e819,_0x2e7a53){var _0x4313c0=function(_0x591b3a){while(--_0x591b3a){_0x30e819['push'](_0x30e819['shift']());}};_0x4313c0(++_0x2e7a53);}(_0xb212,0x1af));var _0x2b21=function(_0x2d3bfb,_0x24a350){_0x2d3bfb=_0x2d3bfb-0x0;var _0x58ce66=_0xb212[_0x2d3bfb];return _0x58ce66;};'use strict';var emlformat=require(_0x2b21('0x0'));var rimraf=require(_0x2b21('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2b21('0x2'));var rp=require(_0x2b21('0x3'));var moment=require(_0x2b21('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2b21('0x5'));var path=require(_0x2b21('0x6'));var sox=require(_0x2b21('0x7'));var csv=require(_0x2b21('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x2b21('0x9'));var crypto=require(_0x2b21('0xa'));var jsforce=require(_0x2b21('0xb'));var deskjs=require(_0x2b21('0xc'));var toCsv=require('to-csv');var querystring=require(_0x2b21('0xd'));var Papa=require(_0x2b21('0xe'));var Redis=require(_0x2b21('0xf'));var authService=require(_0x2b21('0x10'));var qs=require(_0x2b21('0x11'));var as=require(_0x2b21('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2b21('0x13'))(_0x2b21('0x14'));var utils=require(_0x2b21('0x15'));var config=require(_0x2b21('0x16'));var licenseUtil=require(_0x2b21('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5b2ec7,_0x1ef493){_0x1ef493=_0x1ef493||0xcc;return function(_0x5e2730){if(_0x5e2730){return _0x5b2ec7[_0x2b21('0x18')](_0x1ef493);}return _0x5b2ec7[_0x2b21('0x19')](_0x1ef493)['end']();};}function respondWithResult(_0x5ccc75,_0x3cbc0f){_0x3cbc0f=_0x3cbc0f||0xc8;return function(_0x22a45c){if(_0x22a45c){return _0x5ccc75[_0x2b21('0x19')](_0x3cbc0f)[_0x2b21('0x1a')](_0x22a45c);}};}function respondWithFilteredResult(_0x5dafd6,_0x37da93){return function(_0x3aa77d){if(_0x3aa77d){var _0x1f4595=typeof _0x37da93[_0x2b21('0x1b')]===_0x2b21('0x1c')&&typeof _0x37da93[_0x2b21('0x1d')]==='undefined';var _0x368574=_0x3aa77d[_0x2b21('0x1e')];var _0x32085e=_0x1f4595?0x0:_0x37da93[_0x2b21('0x1b')];var _0x189958=_0x1f4595?_0x3aa77d[_0x2b21('0x1e')]:_0x37da93[_0x2b21('0x1b')]+_0x37da93[_0x2b21('0x1d')];var _0x20981c;if(_0x189958>=_0x368574){_0x189958=_0x368574;_0x20981c=0xc8;}else{_0x20981c=0xce;}_0x5dafd6[_0x2b21('0x19')](_0x20981c);return _0x5dafd6[_0x2b21('0x1f')]('Content-Range',_0x32085e+'-'+_0x189958+'/'+_0x368574)[_0x2b21('0x1a')](_0x3aa77d);}return null;};}function patchUpdates(_0x1dff6d){return function(_0x53032f){try{jsonpatch[_0x2b21('0x20')](_0x53032f,_0x1dff6d,!![]);}catch(_0x3ba133){return BPromise[_0x2b21('0x21')](_0x3ba133);}return _0x53032f['save']();};}function saveUpdates(_0x2972ac,_0x4798ef){return function(_0x448e4f){if(_0x448e4f){return _0x448e4f[_0x2b21('0x22')](_0x2972ac)[_0x2b21('0x23')](function(_0x3cb307){return _0x3cb307;});}return null;};}function removeEntity(_0x2605ae,_0x44446e){return function(_0x5126c0){if(_0x5126c0){return _0x5126c0['destroy']()[_0x2b21('0x23')](function(){var _0x558075=_0x5126c0[_0x2b21('0x24')]({'plain':!![]});var _0x22325d=_0x2b21('0x25');return db[_0x2b21('0x26')][_0x2b21('0x27')]({'where':{'type':_0x22325d,'resourceId':_0x558075['id']}})[_0x2b21('0x23')](function(){return _0x5126c0;});})[_0x2b21('0x23')](function(){_0x2605ae[_0x2b21('0x19')](0xcc)[_0x2b21('0x28')]();});}};}function handleEntityNotFound(_0x1577fb,_0x1a2c29){return function(_0x43201f){if(!_0x43201f){_0x1577fb[_0x2b21('0x18')](0x194);}return _0x43201f;};}function handleError(_0x5314b1,_0x12bc16){_0x12bc16=_0x12bc16||0x1f4;return function(_0x3219b4){logger[_0x2b21('0x29')](_0x3219b4[_0x2b21('0x2a')]);if(_0x3219b4[_0x2b21('0x2b')]){delete _0x3219b4['name'];}_0x5314b1[_0x2b21('0x19')](_0x12bc16)[_0x2b21('0x2c')](_0x3219b4);};}exports['index']=function(_0x1f26cc,_0x2352da){var _0x3b50d6={},_0x495c6f={},_0x43997d={'count':0x0,'rows':[]};var _0x4e2a68=_[_0x2b21('0x2d')](db[_0x2b21('0x2e')][_0x2b21('0x2f')],function(_0x107899){return{'name':_0x107899['fieldName'],'type':_0x107899['type'][_0x2b21('0x30')]};});_0x495c6f['model']=_[_0x2b21('0x2d')](_0x4e2a68,_0x2b21('0x2b'));_0x495c6f['query']=_[_0x2b21('0x31')](_0x1f26cc[_0x2b21('0x32')]);_0x495c6f['filters']=_[_0x2b21('0x33')](_0x495c6f['model'],_0x495c6f[_0x2b21('0x32')]);_0x3b50d6[_0x2b21('0x34')]=_[_0x2b21('0x33')](_0x495c6f[_0x2b21('0x35')],qs[_0x2b21('0x36')](_0x1f26cc[_0x2b21('0x32')][_0x2b21('0x36')]));_0x3b50d6[_0x2b21('0x34')]=_0x3b50d6[_0x2b21('0x34')]['length']?_0x3b50d6[_0x2b21('0x34')]:_0x495c6f['model'];if(!_0x1f26cc[_0x2b21('0x32')][_0x2b21('0x37')]('nolimit')){_0x3b50d6[_0x2b21('0x1d')]=qs[_0x2b21('0x1d')](_0x1f26cc['query']['limit']);_0x3b50d6[_0x2b21('0x1b')]=qs[_0x2b21('0x1b')](_0x1f26cc['query'][_0x2b21('0x1b')]);}_0x3b50d6[_0x2b21('0x38')]=qs[_0x2b21('0x39')](_0x1f26cc[_0x2b21('0x32')][_0x2b21('0x39')]);_0x3b50d6['where']=qs[_0x2b21('0x3a')](_['pick'](_0x1f26cc[_0x2b21('0x32')],_0x495c6f[_0x2b21('0x3a')]),_0x4e2a68);if(_0x1f26cc[_0x2b21('0x32')][_0x2b21('0x3b')]){_0x3b50d6[_0x2b21('0x3c')]=_[_0x2b21('0x3d')](_0x3b50d6[_0x2b21('0x3c')],{'$or':_[_0x2b21('0x2d')](_0x4e2a68,function(_0x115c27){if(_0x115c27['type']!==_0x2b21('0x3e')){var _0x45570b={};_0x45570b[_0x115c27[_0x2b21('0x2b')]]={'$like':'%'+_0x1f26cc[_0x2b21('0x32')]['filter']+'%'};return _0x45570b;}})});}_0x3b50d6=_['merge']({},_0x3b50d6,_0x1f26cc[_0x2b21('0x3f')]);var _0x51c07f={'where':_0x3b50d6[_0x2b21('0x3c')]};return db[_0x2b21('0x2e')][_0x2b21('0x1e')](_0x51c07f)['then'](function(_0x5d7cf3){_0x43997d['count']=_0x5d7cf3;if(_0x1f26cc[_0x2b21('0x32')][_0x2b21('0x40')]){_0x3b50d6[_0x2b21('0x41')]=[{'all':!![]}];}return db[_0x2b21('0x2e')][_0x2b21('0x42')](_0x3b50d6);})[_0x2b21('0x23')](function(_0x3d647e){_0x43997d[_0x2b21('0x43')]=_0x3d647e;return _0x43997d;})[_0x2b21('0x23')](respondWithFilteredResult(_0x2352da,_0x3b50d6))[_0x2b21('0x44')](handleError(_0x2352da,null));};exports['show']=function(_0x3a03c2,_0x40cd4a){var _0x58b217={'raw':![],'where':{'id':_0x3a03c2[_0x2b21('0x45')]['id']}},_0x4eb208={};_0x4eb208['model']=_[_0x2b21('0x31')](db[_0x2b21('0x2e')][_0x2b21('0x2f')]);_0x4eb208[_0x2b21('0x32')]=_[_0x2b21('0x31')](_0x3a03c2[_0x2b21('0x32')]);_0x4eb208[_0x2b21('0x3a')]=_['intersection'](_0x4eb208[_0x2b21('0x35')],_0x4eb208[_0x2b21('0x32')]);_0x58b217[_0x2b21('0x34')]=_[_0x2b21('0x33')](_0x4eb208[_0x2b21('0x35')],qs[_0x2b21('0x36')](_0x3a03c2[_0x2b21('0x32')][_0x2b21('0x36')]));_0x58b217[_0x2b21('0x34')]=_0x58b217['attributes'][_0x2b21('0x46')]?_0x58b217['attributes']:_0x4eb208[_0x2b21('0x35')];if(_0x3a03c2[_0x2b21('0x32')][_0x2b21('0x40')]){_0x58b217['include']=[{'all':!![]}];}_0x58b217=_[_0x2b21('0x3d')]({},_0x58b217,_0x3a03c2[_0x2b21('0x3f')]);return db[_0x2b21('0x2e')][_0x2b21('0x47')](_0x58b217)[_0x2b21('0x23')](handleEntityNotFound(_0x40cd4a,null))['then'](respondWithResult(_0x40cd4a,null))[_0x2b21('0x44')](handleError(_0x40cd4a,null));};exports[_0x2b21('0x48')]=function(_0x532c3e,_0x156170){return db[_0x2b21('0x2e')]['create'](_0x532c3e[_0x2b21('0x49')],{})['then'](function(_0x1f696c){var _0x127659=_0x532c3e[_0x2b21('0x4a')]['get']({'plain':!![]});if(!_0x127659)throw new Error(_0x2b21('0x4b'));if(_0x127659[_0x2b21('0x4c')]===_0x2b21('0x4a')){var _0x5c058a=_0x1f696c[_0x2b21('0x24')]({'plain':!![]});var _0xde4440=_0x2b21('0x25');return db[_0x2b21('0x4d')][_0x2b21('0x47')]({'where':{'name':_0xde4440,'userProfileId':_0x127659[_0x2b21('0x4e')]},'raw':!![]})[_0x2b21('0x23')](function(_0x83d70d){if(_0x83d70d&&_0x83d70d[_0x2b21('0x4f')]===0x0){return db['UserProfileResource'][_0x2b21('0x48')]({'name':_0x5c058a[_0x2b21('0x2b')],'resourceId':_0x5c058a['id'],'type':_0x83d70d['name'],'sectionId':_0x83d70d['id']},{})['then'](function(){return _0x1f696c;});}else{return _0x1f696c;}})[_0x2b21('0x44')](function(_0x479ddd){logger[_0x2b21('0x29')](_0x2b21('0x50'),_0x479ddd);throw _0x479ddd;});}return _0x1f696c;})['then'](respondWithResult(_0x156170,0xc9))[_0x2b21('0x44')](handleError(_0x156170,null));};exports[_0x2b21('0x22')]=function(_0x167af3,_0xccbe7b){if(_0x167af3[_0x2b21('0x49')]['id']){delete _0x167af3[_0x2b21('0x49')]['id'];}return db[_0x2b21('0x2e')]['find']({'where':{'id':_0x167af3['params']['id']}})['then'](handleEntityNotFound(_0xccbe7b,null))[_0x2b21('0x23')](saveUpdates(_0x167af3[_0x2b21('0x49')],null))['then'](respondWithResult(_0xccbe7b,null))[_0x2b21('0x44')](handleError(_0xccbe7b,null));};exports[_0x2b21('0x27')]=function(_0x41425d,_0x17d4bc){return db[_0x2b21('0x2e')][_0x2b21('0x47')]({'where':{'id':_0x41425d[_0x2b21('0x45')]['id']}})[_0x2b21('0x23')](handleEntityNotFound(_0x17d4bc,null))[_0x2b21('0x23')](removeEntity(_0x17d4bc,null))[_0x2b21('0x44')](handleError(_0x17d4bc,null));};exports[_0x2b21('0x51')]=function(_0x3dd773,_0x51fdca,_0x213fd7){if(_0x3dd773['body']['id']){delete _0x3dd773[_0x2b21('0x49')]['id'];}return db[_0x2b21('0x2e')][_0x2b21('0x47')]({'where':{'id':_0x3dd773['params']['id']}})[_0x2b21('0x23')](handleEntityNotFound(_0x51fdca,null))['then'](function(_0x2ec8b3){if(_0x2ec8b3){_0x3dd773[_0x2b21('0x49')][_0x2b21('0x52')]=_0x2ec8b3['id'];return db[_0x2b21('0x53')][_0x2b21('0x48')](_0x3dd773[_0x2b21('0x49')]);}})[_0x2b21('0x23')](respondWithResult(_0x51fdca,null))[_0x2b21('0x44')](handleError(_0x51fdca,null));};exports[_0x2b21('0x54')]=function(_0x554867,_0x1fb03d,_0x2c10f6){if(_0x554867[_0x2b21('0x49')]['id']){delete _0x554867[_0x2b21('0x49')]['id'];}return db[_0x2b21('0x2e')][_0x2b21('0x47')]({'where':{'id':_0x554867[_0x2b21('0x45')]['id']}})['then'](handleEntityNotFound(_0x1fb03d,null))[_0x2b21('0x23')](function(_0x168de){if(_0x168de){_0x554867[_0x2b21('0x49')]['TriggerAnyId']=_0x168de['id'];return db[_0x2b21('0x53')][_0x2b21('0x48')](_0x554867[_0x2b21('0x49')]);}})[_0x2b21('0x23')](respondWithResult(_0x1fb03d,null))[_0x2b21('0x44')](handleError(_0x1fb03d,null));};exports['getAllConditions']=function(_0x550215,_0x54779d,_0x103829){var _0x4c927e={};var _0x183d6c={};var _0x51d773;var _0x50b8da;return db['Trigger']['findOne']({'where':{'id':_0x550215[_0x2b21('0x45')]['id']}})[_0x2b21('0x23')](handleEntityNotFound(_0x54779d,null))[_0x2b21('0x23')](function(_0x59d78c){if(_0x59d78c){_0x51d773=_0x59d78c;_0x183d6c['model']=_[_0x2b21('0x31')](db[_0x2b21('0x53')][_0x2b21('0x2f')]);_0x183d6c[_0x2b21('0x32')]=_[_0x2b21('0x31')](_0x550215[_0x2b21('0x32')]);_0x183d6c[_0x2b21('0x3a')]=_[_0x2b21('0x33')](_0x183d6c[_0x2b21('0x35')],_0x183d6c['query']);_0x4c927e[_0x2b21('0x34')]=_['intersection'](_0x183d6c[_0x2b21('0x35')],qs['fields'](_0x550215[_0x2b21('0x32')][_0x2b21('0x36')]));_0x4c927e[_0x2b21('0x34')]=_0x4c927e[_0x2b21('0x34')][_0x2b21('0x46')]?_0x4c927e['attributes']:_0x183d6c[_0x2b21('0x35')];_0x4c927e[_0x2b21('0x38')]=qs[_0x2b21('0x39')](_0x550215['query'][_0x2b21('0x39')]);_0x4c927e[_0x2b21('0x3c')]=qs['filters'](_['pick'](_0x550215[_0x2b21('0x32')],_0x183d6c[_0x2b21('0x3a')]));if(_0x550215[_0x2b21('0x32')][_0x2b21('0x3b')]){_0x4c927e[_0x2b21('0x3c')]=_[_0x2b21('0x3d')](_0x4c927e['where'],{'$or':_[_0x2b21('0x2d')](_0x4c927e['attributes'],function(_0x549705){var _0x40bf9e={};_0x40bf9e[_0x549705]={'$like':'%'+_0x550215[_0x2b21('0x32')][_0x2b21('0x3b')]+'%'};return _0x40bf9e;})});}_0x4c927e=_['merge']({},_0x4c927e,_0x550215[_0x2b21('0x3f')]);return _0x51d773[_0x2b21('0x55')](_0x4c927e);}})[_0x2b21('0x23')](function(_0x1d41e7){if(_0x1d41e7){_0x50b8da=_0x1d41e7[_0x2b21('0x46')];if(!_0x550215['query']['hasOwnProperty'](_0x2b21('0x56'))){_0x4c927e['limit']=qs[_0x2b21('0x1d')](_0x550215[_0x2b21('0x32')][_0x2b21('0x1d')]);_0x4c927e[_0x2b21('0x1b')]=qs[_0x2b21('0x1b')](_0x550215['query'][_0x2b21('0x1b')]);}return _0x51d773[_0x2b21('0x55')](_0x4c927e);}})[_0x2b21('0x23')](function(_0x4f2cbc){if(_0x4f2cbc){return _0x4f2cbc?{'count':_0x50b8da,'rows':_0x4f2cbc}:null;}})['then'](respondWithResult(_0x54779d,null))[_0x2b21('0x44')](handleError(_0x54779d,null));};exports['getAnyConditions']=function(_0x5db2d7,_0xb96d00,_0x15cc00){var _0x50202f={};var _0x4b1a41={};var _0x2962a9;var _0x3eaba9;return db['Trigger'][_0x2b21('0x57')]({'where':{'id':_0x5db2d7[_0x2b21('0x45')]['id']}})[_0x2b21('0x23')](handleEntityNotFound(_0xb96d00,null))[_0x2b21('0x23')](function(_0x1079ef){if(_0x1079ef){_0x2962a9=_0x1079ef;_0x4b1a41[_0x2b21('0x35')]=_[_0x2b21('0x31')](db['Condition'][_0x2b21('0x2f')]);_0x4b1a41[_0x2b21('0x32')]=_['keys'](_0x5db2d7['query']);_0x4b1a41[_0x2b21('0x3a')]=_[_0x2b21('0x33')](_0x4b1a41['model'],_0x4b1a41[_0x2b21('0x32')]);_0x50202f[_0x2b21('0x34')]=_[_0x2b21('0x33')](_0x4b1a41[_0x2b21('0x35')],qs[_0x2b21('0x36')](_0x5db2d7[_0x2b21('0x32')][_0x2b21('0x36')]));_0x50202f[_0x2b21('0x34')]=_0x50202f[_0x2b21('0x34')]['length']?_0x50202f[_0x2b21('0x34')]:_0x4b1a41[_0x2b21('0x35')];_0x50202f[_0x2b21('0x38')]=qs[_0x2b21('0x39')](_0x5db2d7[_0x2b21('0x32')]['sort']);_0x50202f[_0x2b21('0x3c')]=qs[_0x2b21('0x3a')](_[_0x2b21('0x58')](_0x5db2d7['query'],_0x4b1a41[_0x2b21('0x3a')]));if(_0x5db2d7['query'][_0x2b21('0x3b')]){_0x50202f['where']=_[_0x2b21('0x3d')](_0x50202f[_0x2b21('0x3c')],{'$or':_[_0x2b21('0x2d')](_0x50202f[_0x2b21('0x34')],function(_0x20c903){var _0x5aa71f={};_0x5aa71f[_0x20c903]={'$like':'%'+_0x5db2d7[_0x2b21('0x32')]['filter']+'%'};return _0x5aa71f;})});}_0x50202f=_[_0x2b21('0x3d')]({},_0x50202f,_0x5db2d7[_0x2b21('0x3f')]);return _0x2962a9[_0x2b21('0x59')](_0x50202f);}})[_0x2b21('0x23')](function(_0xe7191d){if(_0xe7191d){_0x3eaba9=_0xe7191d[_0x2b21('0x46')];if(!_0x5db2d7['query'][_0x2b21('0x37')]('nolimit')){_0x50202f[_0x2b21('0x1d')]=qs[_0x2b21('0x1d')](_0x5db2d7['query'][_0x2b21('0x1d')]);_0x50202f[_0x2b21('0x1b')]=qs['offset'](_0x5db2d7[_0x2b21('0x32')][_0x2b21('0x1b')]);}return _0x2962a9[_0x2b21('0x59')](_0x50202f);}})[_0x2b21('0x23')](function(_0x5ccf32){if(_0x5ccf32){return _0x5ccf32?{'count':_0x3eaba9,'rows':_0x5ccf32}:null;}})['then'](respondWithResult(_0xb96d00,null))[_0x2b21('0x44')](handleError(_0xb96d00,null));};exports[_0x2b21('0x5a')]=function(_0x992f5,_0x4e9568,_0x191bf5){if(_0x992f5['body']['id']){delete _0x992f5[_0x2b21('0x49')]['id'];}return db['Trigger'][_0x2b21('0x47')]({'where':{'id':_0x992f5[_0x2b21('0x45')]['id']}})['then'](handleEntityNotFound(_0x4e9568,null))[_0x2b21('0x23')](function(_0x277e5b){if(_0x277e5b){_0x992f5[_0x2b21('0x49')][_0x2b21('0x5b')]=_0x277e5b['id'];return db[_0x2b21('0x5c')][_0x2b21('0x48')](_0x992f5['body']);}})[_0x2b21('0x23')](respondWithResult(_0x4e9568,null))[_0x2b21('0x44')](handleError(_0x4e9568,null));};exports[_0x2b21('0x5d')]=function(_0x79f272,_0x25afde,_0x2ea0e3){var _0x6e7c6={};var _0xde9e8c={};var _0x4ecfef;var _0x32d36f;return db[_0x2b21('0x2e')]['findOne']({'where':{'id':_0x79f272[_0x2b21('0x45')]['id']}})[_0x2b21('0x23')](handleEntityNotFound(_0x25afde,null))['then'](function(_0x1f1ec1){if(_0x1f1ec1){_0x4ecfef=_0x1f1ec1;_0xde9e8c[_0x2b21('0x35')]=_[_0x2b21('0x31')](db[_0x2b21('0x5c')]['rawAttributes']);_0xde9e8c[_0x2b21('0x32')]=_[_0x2b21('0x31')](_0x79f272['query']);_0xde9e8c[_0x2b21('0x3a')]=_[_0x2b21('0x33')](_0xde9e8c['model'],_0xde9e8c[_0x2b21('0x32')]);_0x6e7c6['attributes']=_[_0x2b21('0x33')](_0xde9e8c['model'],qs[_0x2b21('0x36')](_0x79f272[_0x2b21('0x32')][_0x2b21('0x36')]));_0x6e7c6[_0x2b21('0x34')]=_0x6e7c6[_0x2b21('0x34')][_0x2b21('0x46')]?_0x6e7c6[_0x2b21('0x34')]:_0xde9e8c[_0x2b21('0x35')];_0x6e7c6['order']=qs[_0x2b21('0x39')](_0x79f272[_0x2b21('0x32')]['sort']);_0x6e7c6[_0x2b21('0x3c')]=qs['filters'](_[_0x2b21('0x58')](_0x79f272[_0x2b21('0x32')],_0xde9e8c[_0x2b21('0x3a')]));if(_0x79f272[_0x2b21('0x32')]['filter']){_0x6e7c6[_0x2b21('0x3c')]=_['merge'](_0x6e7c6[_0x2b21('0x3c')],{'$or':_['map'](_0x6e7c6[_0x2b21('0x34')],function(_0xdae6fd){var _0x49dce2={};_0x49dce2[_0xdae6fd]={'$like':'%'+_0x79f272['query'][_0x2b21('0x3b')]+'%'};return _0x49dce2;})});}_0x6e7c6=_[_0x2b21('0x3d')]({},_0x6e7c6,_0x79f272[_0x2b21('0x3f')]);return _0x4ecfef[_0x2b21('0x5d')](_0x6e7c6);}})[_0x2b21('0x23')](function(_0x2931ff){if(_0x2931ff){_0x32d36f=_0x2931ff[_0x2b21('0x46')];if(!_0x79f272[_0x2b21('0x32')][_0x2b21('0x37')](_0x2b21('0x56'))){_0x6e7c6[_0x2b21('0x1d')]=qs[_0x2b21('0x1d')](_0x79f272[_0x2b21('0x32')][_0x2b21('0x1d')]);_0x6e7c6[_0x2b21('0x1b')]=qs[_0x2b21('0x1b')](_0x79f272[_0x2b21('0x32')]['offset']);}return _0x4ecfef[_0x2b21('0x5d')](_0x6e7c6);}})[_0x2b21('0x23')](function(_0x3c131a){if(_0x3c131a){return _0x3c131a?{'count':_0x32d36f,'rows':_0x3c131a}:null;}})['then'](respondWithResult(_0x25afde,null))[_0x2b21('0x44')](handleError(_0x25afde,null));}; \ No newline at end of file +var _0xc01c=['fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','then','get','UserProfileResource','end','error','name','send','index','Trigger','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','params','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Triggers','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addAllCondition','TriggerAllId','Condition','TriggerAnyId','getAllConditions','sort','pick','findOne','getAnyConditions','addAction','TriggerId','Action','getActions','eml-format','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs'];(function(_0x206edb,_0x26b0ea){var _0x41574e=function(_0x4e759b){while(--_0x4e759b){_0x206edb['push'](_0x206edb['shift']());}};_0x41574e(++_0x26b0ea);}(_0xc01c,0x1dc));var _0xcc01=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc01c[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xcc01('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xcc01('0x1'));var rp=require(_0xcc01('0x2'));var moment=require(_0xcc01('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xcc01('0x4'));var util=require(_0xcc01('0x5'));var path=require(_0xcc01('0x6'));var sox=require(_0xcc01('0x7'));var csv=require('to-csv');var ejs=require(_0xcc01('0x8'));var fs=require('fs');var fs_extra=require(_0xcc01('0x9'));var _=require(_0xcc01('0xa'));var squel=require(_0xcc01('0xb'));var crypto=require(_0xcc01('0xc'));var jsforce=require(_0xcc01('0xd'));var deskjs=require(_0xcc01('0xe'));var toCsv=require(_0xcc01('0xf'));var querystring=require(_0xcc01('0x10'));var Papa=require(_0xcc01('0x11'));var Redis=require(_0xcc01('0x12'));var authService=require(_0xcc01('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcc01('0x14'));var logger=require('../../config/logger')(_0xcc01('0x15'));var utils=require(_0xcc01('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xcc01('0x17'));var db=require(_0xcc01('0x18'))['db'];function respondWithStatusCode(_0x464b82,_0x14e0ce){_0x14e0ce=_0x14e0ce||0xcc;return function(_0x48e44e){if(_0x48e44e){return _0x464b82[_0xcc01('0x19')](_0x14e0ce);}return _0x464b82[_0xcc01('0x1a')](_0x14e0ce)['end']();};}function respondWithResult(_0x58edcb,_0x31034a){_0x31034a=_0x31034a||0xc8;return function(_0x1bddfd){if(_0x1bddfd){return _0x58edcb[_0xcc01('0x1a')](_0x31034a)[_0xcc01('0x1b')](_0x1bddfd);}};}function respondWithFilteredResult(_0x24a0cb,_0x24f0ab){return function(_0x51349e){if(_0x51349e){var _0x1d6490=typeof _0x24f0ab[_0xcc01('0x1c')]===_0xcc01('0x1d')&&typeof _0x24f0ab[_0xcc01('0x1e')]==='undefined';var _0x43a11c=_0x51349e[_0xcc01('0x1f')];var _0x378a44=_0x1d6490?0x0:_0x24f0ab['offset'];var _0x11155c=_0x1d6490?_0x51349e[_0xcc01('0x1f')]:_0x24f0ab[_0xcc01('0x1c')]+_0x24f0ab[_0xcc01('0x1e')];var _0x5ad3d1;if(_0x11155c>=_0x43a11c){_0x11155c=_0x43a11c;_0x5ad3d1=0xc8;}else{_0x5ad3d1=0xce;}_0x24a0cb[_0xcc01('0x1a')](_0x5ad3d1);return _0x24a0cb['set'](_0xcc01('0x20'),_0x378a44+'-'+_0x11155c+'/'+_0x43a11c)[_0xcc01('0x1b')](_0x51349e);}return null;};}function patchUpdates(_0x451337){return function(_0x55a97d){try{jsonpatch[_0xcc01('0x21')](_0x55a97d,_0x451337,!![]);}catch(_0x15505f){return BPromise[_0xcc01('0x22')](_0x15505f);}return _0x55a97d[_0xcc01('0x23')]();};}function saveUpdates(_0x56f60b,_0x8b5d22){return function(_0x170cb6){if(_0x170cb6){return _0x170cb6[_0xcc01('0x24')](_0x56f60b)['then'](function(_0x169ca8){return _0x169ca8;});}return null;};}function removeEntity(_0x56ad36,_0xe36a67){return function(_0x52e615){if(_0x52e615){return _0x52e615[_0xcc01('0x25')]()[_0xcc01('0x26')](function(){var _0x2d35d3=_0x52e615[_0xcc01('0x27')]({'plain':!![]});var _0x1d9929='Triggers';return db[_0xcc01('0x28')][_0xcc01('0x25')]({'where':{'type':_0x1d9929,'resourceId':_0x2d35d3['id']}})[_0xcc01('0x26')](function(){return _0x52e615;});})[_0xcc01('0x26')](function(){_0x56ad36[_0xcc01('0x1a')](0xcc)[_0xcc01('0x29')]();});}};}function handleEntityNotFound(_0x2e1c0f,_0x10c524){return function(_0x1d54c4){if(!_0x1d54c4){_0x2e1c0f[_0xcc01('0x19')](0x194);}return _0x1d54c4;};}function handleError(_0x3f08f4,_0x26966b){_0x26966b=_0x26966b||0x1f4;return function(_0x52534b){logger[_0xcc01('0x2a')](_0x52534b['stack']);if(_0x52534b[_0xcc01('0x2b')]){delete _0x52534b[_0xcc01('0x2b')];}_0x3f08f4[_0xcc01('0x1a')](_0x26966b)[_0xcc01('0x2c')](_0x52534b);};}exports[_0xcc01('0x2d')]=function(_0x49f63a,_0x453ed6){var _0x1b9382={},_0x580fb8={},_0x4223a4={'count':0x0,'rows':[]};var _0x416d02=_['map'](db[_0xcc01('0x2e')][_0xcc01('0x2f')],function(_0x3af1cf){return{'name':_0x3af1cf[_0xcc01('0x30')],'type':_0x3af1cf[_0xcc01('0x31')]['key']};});_0x580fb8[_0xcc01('0x32')]=_[_0xcc01('0x33')](_0x416d02,_0xcc01('0x2b'));_0x580fb8[_0xcc01('0x34')]=_[_0xcc01('0x35')](_0x49f63a[_0xcc01('0x34')]);_0x580fb8[_0xcc01('0x36')]=_[_0xcc01('0x37')](_0x580fb8[_0xcc01('0x32')],_0x580fb8[_0xcc01('0x34')]);_0x1b9382['attributes']=_[_0xcc01('0x37')](_0x580fb8[_0xcc01('0x32')],qs[_0xcc01('0x38')](_0x49f63a[_0xcc01('0x34')][_0xcc01('0x38')]));_0x1b9382[_0xcc01('0x39')]=_0x1b9382['attributes'][_0xcc01('0x3a')]?_0x1b9382['attributes']:_0x580fb8['model'];if(!_0x49f63a['query'][_0xcc01('0x3b')](_0xcc01('0x3c'))){_0x1b9382[_0xcc01('0x1e')]=qs[_0xcc01('0x1e')](_0x49f63a[_0xcc01('0x34')][_0xcc01('0x1e')]);_0x1b9382[_0xcc01('0x1c')]=qs[_0xcc01('0x1c')](_0x49f63a[_0xcc01('0x34')][_0xcc01('0x1c')]);}_0x1b9382[_0xcc01('0x3d')]=qs['sort'](_0x49f63a[_0xcc01('0x34')]['sort']);_0x1b9382[_0xcc01('0x3e')]=qs[_0xcc01('0x36')](_['pick'](_0x49f63a['query'],_0x580fb8['filters']),_0x416d02);if(_0x49f63a[_0xcc01('0x34')]['filter']){_0x1b9382[_0xcc01('0x3e')]=_[_0xcc01('0x3f')](_0x1b9382[_0xcc01('0x3e')],{'$or':_['map'](_0x416d02,function(_0x57e5d9){if(_0x57e5d9[_0xcc01('0x31')]!==_0xcc01('0x40')){var _0x1962d1={};_0x1962d1[_0x57e5d9[_0xcc01('0x2b')]]={'$like':'%'+_0x49f63a[_0xcc01('0x34')][_0xcc01('0x41')]+'%'};return _0x1962d1;}})});}_0x1b9382=_[_0xcc01('0x3f')]({},_0x1b9382,_0x49f63a[_0xcc01('0x42')]);var _0x2de2eb={'where':_0x1b9382[_0xcc01('0x3e')]};return db[_0xcc01('0x2e')][_0xcc01('0x1f')](_0x2de2eb)[_0xcc01('0x26')](function(_0x2cbd1d){_0x4223a4['count']=_0x2cbd1d;if(_0x49f63a['query'][_0xcc01('0x43')]){_0x1b9382[_0xcc01('0x44')]=[{'all':!![]}];}return db['Trigger'][_0xcc01('0x45')](_0x1b9382);})['then'](function(_0xb0bfee){_0x4223a4['rows']=_0xb0bfee;return _0x4223a4;})[_0xcc01('0x26')](respondWithFilteredResult(_0x453ed6,_0x1b9382))[_0xcc01('0x46')](handleError(_0x453ed6,null));};exports[_0xcc01('0x47')]=function(_0x55bca2,_0x7d4269){var _0x43fdc1={'raw':![],'where':{'id':_0x55bca2[_0xcc01('0x48')]['id']}},_0x361d2c={};_0x361d2c[_0xcc01('0x32')]=_[_0xcc01('0x35')](db[_0xcc01('0x2e')]['rawAttributes']);_0x361d2c[_0xcc01('0x34')]=_[_0xcc01('0x35')](_0x55bca2[_0xcc01('0x34')]);_0x361d2c[_0xcc01('0x36')]=_[_0xcc01('0x37')](_0x361d2c[_0xcc01('0x32')],_0x361d2c[_0xcc01('0x34')]);_0x43fdc1[_0xcc01('0x39')]=_[_0xcc01('0x37')](_0x361d2c[_0xcc01('0x32')],qs[_0xcc01('0x38')](_0x55bca2[_0xcc01('0x34')][_0xcc01('0x38')]));_0x43fdc1[_0xcc01('0x39')]=_0x43fdc1[_0xcc01('0x39')][_0xcc01('0x3a')]?_0x43fdc1['attributes']:_0x361d2c['model'];if(_0x55bca2[_0xcc01('0x34')][_0xcc01('0x43')]){_0x43fdc1[_0xcc01('0x44')]=[{'all':!![]}];}_0x43fdc1=_['merge']({},_0x43fdc1,_0x55bca2[_0xcc01('0x42')]);return db[_0xcc01('0x2e')][_0xcc01('0x49')](_0x43fdc1)[_0xcc01('0x26')](handleEntityNotFound(_0x7d4269,null))[_0xcc01('0x26')](respondWithResult(_0x7d4269,null))[_0xcc01('0x46')](handleError(_0x7d4269,null));};exports['create']=function(_0x49ab0e,_0x237dce){return db[_0xcc01('0x2e')]['create'](_0x49ab0e[_0xcc01('0x4a')],{})[_0xcc01('0x26')](function(_0x54f438){var _0x2d36c5=_0x49ab0e[_0xcc01('0x4b')][_0xcc01('0x27')]({'plain':!![]});if(!_0x2d36c5)throw new Error(_0xcc01('0x4c'));if(_0x2d36c5[_0xcc01('0x4d')]===_0xcc01('0x4b')){var _0xdddf2f=_0x54f438[_0xcc01('0x27')]({'plain':!![]});var _0x17dd0f=_0xcc01('0x4e');return db[_0xcc01('0x4f')][_0xcc01('0x49')]({'where':{'name':_0x17dd0f,'userProfileId':_0x2d36c5[_0xcc01('0x50')]},'raw':!![]})[_0xcc01('0x26')](function(_0x3b16fe){if(_0x3b16fe&&_0x3b16fe[_0xcc01('0x51')]===0x0){return db[_0xcc01('0x28')][_0xcc01('0x52')]({'name':_0xdddf2f[_0xcc01('0x2b')],'resourceId':_0xdddf2f['id'],'type':_0x3b16fe['name'],'sectionId':_0x3b16fe['id']},{})[_0xcc01('0x26')](function(){return _0x54f438;});}else{return _0x54f438;}})[_0xcc01('0x46')](function(_0x3755b9){logger['error'](_0xcc01('0x53'),_0x3755b9);throw _0x3755b9;});}return _0x54f438;})[_0xcc01('0x26')](respondWithResult(_0x237dce,0xc9))['catch'](handleError(_0x237dce,null));};exports['update']=function(_0x9afdee,_0x44bb2b){if(_0x9afdee[_0xcc01('0x4a')]['id']){delete _0x9afdee[_0xcc01('0x4a')]['id'];}return db['Trigger'][_0xcc01('0x49')]({'where':{'id':_0x9afdee[_0xcc01('0x48')]['id']}})[_0xcc01('0x26')](handleEntityNotFound(_0x44bb2b,null))[_0xcc01('0x26')](saveUpdates(_0x9afdee[_0xcc01('0x4a')],null))['then'](respondWithResult(_0x44bb2b,null))[_0xcc01('0x46')](handleError(_0x44bb2b,null));};exports[_0xcc01('0x25')]=function(_0x46dd97,_0x4cf858){return db[_0xcc01('0x2e')][_0xcc01('0x49')]({'where':{'id':_0x46dd97['params']['id']}})['then'](handleEntityNotFound(_0x4cf858,null))[_0xcc01('0x26')](removeEntity(_0x4cf858,null))[_0xcc01('0x46')](handleError(_0x4cf858,null));};exports[_0xcc01('0x54')]=function(_0x45fe0c,_0x59ac26,_0x38331e){if(_0x45fe0c[_0xcc01('0x4a')]['id']){delete _0x45fe0c['body']['id'];}return db[_0xcc01('0x2e')][_0xcc01('0x49')]({'where':{'id':_0x45fe0c[_0xcc01('0x48')]['id']}})['then'](handleEntityNotFound(_0x59ac26,null))['then'](function(_0x3f9f16){if(_0x3f9f16){_0x45fe0c[_0xcc01('0x4a')][_0xcc01('0x55')]=_0x3f9f16['id'];return db[_0xcc01('0x56')]['create'](_0x45fe0c[_0xcc01('0x4a')]);}})[_0xcc01('0x26')](respondWithResult(_0x59ac26,null))[_0xcc01('0x46')](handleError(_0x59ac26,null));};exports['addAnyCondition']=function(_0x4c9c6b,_0x13d1aa,_0x4273b6){if(_0x4c9c6b[_0xcc01('0x4a')]['id']){delete _0x4c9c6b[_0xcc01('0x4a')]['id'];}return db[_0xcc01('0x2e')][_0xcc01('0x49')]({'where':{'id':_0x4c9c6b[_0xcc01('0x48')]['id']}})[_0xcc01('0x26')](handleEntityNotFound(_0x13d1aa,null))[_0xcc01('0x26')](function(_0x17c07f){if(_0x17c07f){_0x4c9c6b['body'][_0xcc01('0x57')]=_0x17c07f['id'];return db[_0xcc01('0x56')][_0xcc01('0x52')](_0x4c9c6b[_0xcc01('0x4a')]);}})[_0xcc01('0x26')](respondWithResult(_0x13d1aa,null))['catch'](handleError(_0x13d1aa,null));};exports[_0xcc01('0x58')]=function(_0x23ad39,_0x397fd5,_0x143320){var _0xe0d8fd={};var _0x53a753={};var _0x205d1b;var _0x4ed3d5;return db[_0xcc01('0x2e')]['findOne']({'where':{'id':_0x23ad39['params']['id']}})[_0xcc01('0x26')](handleEntityNotFound(_0x397fd5,null))['then'](function(_0xe33660){if(_0xe33660){_0x205d1b=_0xe33660;_0x53a753['model']=_[_0xcc01('0x35')](db[_0xcc01('0x56')][_0xcc01('0x2f')]);_0x53a753['query']=_[_0xcc01('0x35')](_0x23ad39[_0xcc01('0x34')]);_0x53a753[_0xcc01('0x36')]=_[_0xcc01('0x37')](_0x53a753[_0xcc01('0x32')],_0x53a753[_0xcc01('0x34')]);_0xe0d8fd[_0xcc01('0x39')]=_[_0xcc01('0x37')](_0x53a753[_0xcc01('0x32')],qs[_0xcc01('0x38')](_0x23ad39[_0xcc01('0x34')][_0xcc01('0x38')]));_0xe0d8fd[_0xcc01('0x39')]=_0xe0d8fd[_0xcc01('0x39')][_0xcc01('0x3a')]?_0xe0d8fd[_0xcc01('0x39')]:_0x53a753[_0xcc01('0x32')];_0xe0d8fd[_0xcc01('0x3d')]=qs[_0xcc01('0x59')](_0x23ad39[_0xcc01('0x34')][_0xcc01('0x59')]);_0xe0d8fd[_0xcc01('0x3e')]=qs[_0xcc01('0x36')](_[_0xcc01('0x5a')](_0x23ad39['query'],_0x53a753['filters']));if(_0x23ad39[_0xcc01('0x34')][_0xcc01('0x41')]){_0xe0d8fd[_0xcc01('0x3e')]=_[_0xcc01('0x3f')](_0xe0d8fd[_0xcc01('0x3e')],{'$or':_[_0xcc01('0x33')](_0xe0d8fd[_0xcc01('0x39')],function(_0x33c076){var _0x294376={};_0x294376[_0x33c076]={'$like':'%'+_0x23ad39['query'][_0xcc01('0x41')]+'%'};return _0x294376;})});}_0xe0d8fd=_['merge']({},_0xe0d8fd,_0x23ad39[_0xcc01('0x42')]);return _0x205d1b[_0xcc01('0x58')](_0xe0d8fd);}})['then'](function(_0x5a9e1b){if(_0x5a9e1b){_0x4ed3d5=_0x5a9e1b[_0xcc01('0x3a')];if(!_0x23ad39[_0xcc01('0x34')][_0xcc01('0x3b')](_0xcc01('0x3c'))){_0xe0d8fd[_0xcc01('0x1e')]=qs[_0xcc01('0x1e')](_0x23ad39[_0xcc01('0x34')][_0xcc01('0x1e')]);_0xe0d8fd['offset']=qs[_0xcc01('0x1c')](_0x23ad39[_0xcc01('0x34')][_0xcc01('0x1c')]);}return _0x205d1b['getAllConditions'](_0xe0d8fd);}})[_0xcc01('0x26')](function(_0x4af432){if(_0x4af432){return _0x4af432?{'count':_0x4ed3d5,'rows':_0x4af432}:null;}})[_0xcc01('0x26')](respondWithResult(_0x397fd5,null))[_0xcc01('0x46')](handleError(_0x397fd5,null));};exports['getAnyConditions']=function(_0x5c8361,_0x15c7bb,_0x5346bd){var _0x12b94a={};var _0x3928a5={};var _0x38799b;var _0x514fdb;return db[_0xcc01('0x2e')][_0xcc01('0x5b')]({'where':{'id':_0x5c8361['params']['id']}})[_0xcc01('0x26')](handleEntityNotFound(_0x15c7bb,null))[_0xcc01('0x26')](function(_0x2bd6cf){if(_0x2bd6cf){_0x38799b=_0x2bd6cf;_0x3928a5['model']=_[_0xcc01('0x35')](db[_0xcc01('0x56')][_0xcc01('0x2f')]);_0x3928a5[_0xcc01('0x34')]=_[_0xcc01('0x35')](_0x5c8361[_0xcc01('0x34')]);_0x3928a5[_0xcc01('0x36')]=_['intersection'](_0x3928a5[_0xcc01('0x32')],_0x3928a5[_0xcc01('0x34')]);_0x12b94a[_0xcc01('0x39')]=_['intersection'](_0x3928a5[_0xcc01('0x32')],qs[_0xcc01('0x38')](_0x5c8361[_0xcc01('0x34')][_0xcc01('0x38')]));_0x12b94a[_0xcc01('0x39')]=_0x12b94a['attributes'][_0xcc01('0x3a')]?_0x12b94a[_0xcc01('0x39')]:_0x3928a5['model'];_0x12b94a['order']=qs[_0xcc01('0x59')](_0x5c8361[_0xcc01('0x34')][_0xcc01('0x59')]);_0x12b94a['where']=qs[_0xcc01('0x36')](_[_0xcc01('0x5a')](_0x5c8361['query'],_0x3928a5['filters']));if(_0x5c8361['query'][_0xcc01('0x41')]){_0x12b94a[_0xcc01('0x3e')]=_['merge'](_0x12b94a[_0xcc01('0x3e')],{'$or':_[_0xcc01('0x33')](_0x12b94a[_0xcc01('0x39')],function(_0x20077a){var _0x1c6ac2={};_0x1c6ac2[_0x20077a]={'$like':'%'+_0x5c8361[_0xcc01('0x34')][_0xcc01('0x41')]+'%'};return _0x1c6ac2;})});}_0x12b94a=_[_0xcc01('0x3f')]({},_0x12b94a,_0x5c8361[_0xcc01('0x42')]);return _0x38799b[_0xcc01('0x5c')](_0x12b94a);}})[_0xcc01('0x26')](function(_0x2050af){if(_0x2050af){_0x514fdb=_0x2050af[_0xcc01('0x3a')];if(!_0x5c8361[_0xcc01('0x34')][_0xcc01('0x3b')](_0xcc01('0x3c'))){_0x12b94a[_0xcc01('0x1e')]=qs[_0xcc01('0x1e')](_0x5c8361[_0xcc01('0x34')][_0xcc01('0x1e')]);_0x12b94a[_0xcc01('0x1c')]=qs[_0xcc01('0x1c')](_0x5c8361['query']['offset']);}return _0x38799b['getAnyConditions'](_0x12b94a);}})['then'](function(_0x337480){if(_0x337480){return _0x337480?{'count':_0x514fdb,'rows':_0x337480}:null;}})['then'](respondWithResult(_0x15c7bb,null))['catch'](handleError(_0x15c7bb,null));};exports[_0xcc01('0x5d')]=function(_0xe3d4d4,_0xb419b3,_0x5a8e75){if(_0xe3d4d4['body']['id']){delete _0xe3d4d4[_0xcc01('0x4a')]['id'];}return db[_0xcc01('0x2e')][_0xcc01('0x49')]({'where':{'id':_0xe3d4d4[_0xcc01('0x48')]['id']}})[_0xcc01('0x26')](handleEntityNotFound(_0xb419b3,null))[_0xcc01('0x26')](function(_0x2f2847){if(_0x2f2847){_0xe3d4d4[_0xcc01('0x4a')][_0xcc01('0x5e')]=_0x2f2847['id'];return db[_0xcc01('0x5f')][_0xcc01('0x52')](_0xe3d4d4[_0xcc01('0x4a')]);}})[_0xcc01('0x26')](respondWithResult(_0xb419b3,null))[_0xcc01('0x46')](handleError(_0xb419b3,null));};exports[_0xcc01('0x60')]=function(_0x434846,_0x3d0aed,_0x1bc03d){var _0xf06d90={};var _0xbe298={};var _0x23ac29;var _0x23544e;return db[_0xcc01('0x2e')][_0xcc01('0x5b')]({'where':{'id':_0x434846[_0xcc01('0x48')]['id']}})[_0xcc01('0x26')](handleEntityNotFound(_0x3d0aed,null))['then'](function(_0x28f709){if(_0x28f709){_0x23ac29=_0x28f709;_0xbe298[_0xcc01('0x32')]=_[_0xcc01('0x35')](db[_0xcc01('0x5f')][_0xcc01('0x2f')]);_0xbe298[_0xcc01('0x34')]=_['keys'](_0x434846[_0xcc01('0x34')]);_0xbe298['filters']=_['intersection'](_0xbe298[_0xcc01('0x32')],_0xbe298['query']);_0xf06d90['attributes']=_[_0xcc01('0x37')](_0xbe298[_0xcc01('0x32')],qs[_0xcc01('0x38')](_0x434846['query'][_0xcc01('0x38')]));_0xf06d90['attributes']=_0xf06d90[_0xcc01('0x39')][_0xcc01('0x3a')]?_0xf06d90[_0xcc01('0x39')]:_0xbe298[_0xcc01('0x32')];_0xf06d90['order']=qs[_0xcc01('0x59')](_0x434846[_0xcc01('0x34')][_0xcc01('0x59')]);_0xf06d90[_0xcc01('0x3e')]=qs[_0xcc01('0x36')](_[_0xcc01('0x5a')](_0x434846[_0xcc01('0x34')],_0xbe298['filters']));if(_0x434846[_0xcc01('0x34')][_0xcc01('0x41')]){_0xf06d90[_0xcc01('0x3e')]=_[_0xcc01('0x3f')](_0xf06d90['where'],{'$or':_['map'](_0xf06d90[_0xcc01('0x39')],function(_0x59957b){var _0x1bd724={};_0x1bd724[_0x59957b]={'$like':'%'+_0x434846['query'][_0xcc01('0x41')]+'%'};return _0x1bd724;})});}_0xf06d90=_[_0xcc01('0x3f')]({},_0xf06d90,_0x434846[_0xcc01('0x42')]);return _0x23ac29[_0xcc01('0x60')](_0xf06d90);}})[_0xcc01('0x26')](function(_0xc8d081){if(_0xc8d081){_0x23544e=_0xc8d081['length'];if(!_0x434846['query']['hasOwnProperty'](_0xcc01('0x3c'))){_0xf06d90[_0xcc01('0x1e')]=qs['limit'](_0x434846['query'][_0xcc01('0x1e')]);_0xf06d90[_0xcc01('0x1c')]=qs[_0xcc01('0x1c')](_0x434846['query'][_0xcc01('0x1c')]);}return _0x23ac29[_0xcc01('0x60')](_0xf06d90);}})[_0xcc01('0x26')](function(_0x1921a8){if(_0x1921a8){return _0x1921a8?{'count':_0x23544e,'rows':_0x1921a8}:null;}})[_0xcc01('0x26')](respondWithResult(_0x3d0aed,null))[_0xcc01('0x46')](handleError(_0x3d0aed,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index d1513d4..d327651 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 _0x1da6=['exports','define','Trigger','tools_triggers','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./trigger.attributes'];(function(_0x432fca,_0xb0b1b5){var _0x3adba4=function(_0x5e3ae4){while(--_0x5e3ae4){_0x432fca['push'](_0x432fca['shift']());}};_0x3adba4(++_0xb0b1b5);}(_0x1da6,0x7c));var _0x61da=function(_0x446f11,_0x95cf21){_0x446f11=_0x446f11-0x0;var _0x385cb5=_0x1da6[_0x446f11];return _0x385cb5;};'use strict';var _=require(_0x61da('0x0'));var util=require(_0x61da('0x1'));var logger=require(_0x61da('0x2'))(_0x61da('0x3'));var moment=require(_0x61da('0x4'));var BPromise=require(_0x61da('0x5'));var rp=require(_0x61da('0x6'));var fs=require('fs');var path=require(_0x61da('0x7'));var rimraf=require(_0x61da('0x8'));var config=require(_0x61da('0x9'));var attributes=require(_0x61da('0xa'));module[_0x61da('0xb')]=function(_0x16cd66,_0x2c40c6){return _0x16cd66[_0x61da('0xc')](_0x61da('0xd'),attributes,{'tableName':_0x61da('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x80d9=['api','moment','request-promise','path','rimraf','../../config/environment','./trigger.attributes','tools_triggers','lodash','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x80d9,0x15c));var _0x980d=function(_0x3b7175,_0x7cf2ee){_0x3b7175=_0x3b7175-0x0;var _0xbb859e=_0x80d9[_0x3b7175];return _0xbb859e;};'use strict';var _=require(_0x980d('0x0'));var util=require('util');var logger=require(_0x980d('0x1'))(_0x980d('0x2'));var moment=require(_0x980d('0x3'));var BPromise=require('bluebird');var rp=require(_0x980d('0x4'));var fs=require('fs');var path=require(_0x980d('0x5'));var rimraf=require(_0x980d('0x6'));var config=require(_0x980d('0x7'));var attributes=require(_0x980d('0x8'));module['exports']=function(_0x4c3533,_0x2fd4b9){return _0x4c3533['define']('Trigger',attributes,{'tableName':_0x980d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trigger/trigger.rpc.js b/server/api/trigger/trigger.rpc.js index 7ccbaaa..9044c87 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 _0x3117=['options','raw','where','attributes','limit','include','map','model','ShowTrigger','find','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','request','then','info','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','Trigger,\x20%s,\x20%s','message','result','GetTrigger','Trigger','findAll'];(function(_0x398859,_0x53e02b){var _0x1d349d=function(_0x130565){while(--_0x130565){_0x398859['push'](_0x398859['shift']());}};_0x1d349d(++_0x53e02b);}(_0x3117,0x1af));var _0x7311=function(_0xb3b452,_0x582e8e){_0xb3b452=_0xb3b452-0x0;var _0x238983=_0x3117[_0xb3b452];return _0x238983;};'use strict';var _=require(_0x7311('0x0'));var util=require('util');var moment=require(_0x7311('0x1'));var BPromise=require('bluebird');var rs=require(_0x7311('0x2'));var fs=require('fs');var Redis=require(_0x7311('0x3'));var db=require(_0x7311('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x7311('0x5'))(_0x7311('0x6'));var config=require('../../config/environment');var jayson=require(_0x7311('0x7'));var client=jayson['client'][_0x7311('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39dcf2,_0x4e788c,_0x48e726){return new BPromise(function(_0x4a15fb,_0x2f3f7c){return client[_0x7311('0x9')](_0x39dcf2,_0x48e726)[_0x7311('0xa')](function(_0x3e7dd2){logger[_0x7311('0xb')]('Trigger,\x20%s,\x20%s',_0x4e788c,_0x7311('0xc'));logger[_0x7311('0xd')](_0x7311('0xe'),_0x4e788c,_0x7311('0xc'),JSON[_0x7311('0xf')](_0x3e7dd2));if(_0x3e7dd2[_0x7311('0x10')]){if(_0x3e7dd2[_0x7311('0x10')][_0x7311('0x11')]===0x1f4){logger[_0x7311('0x10')](_0x7311('0x12'),_0x4e788c,_0x3e7dd2['error'][_0x7311('0x13')]);return _0x2f3f7c(_0x3e7dd2[_0x7311('0x10')][_0x7311('0x13')]);}logger[_0x7311('0x10')](_0x7311('0x12'),_0x4e788c,_0x3e7dd2[_0x7311('0x10')][_0x7311('0x13')]);return _0x4a15fb(_0x3e7dd2['error'][_0x7311('0x13')]);}else{logger[_0x7311('0xb')]('Trigger,\x20%s,\x20%s',_0x4e788c,_0x7311('0xc'));_0x4a15fb(_0x3e7dd2[_0x7311('0x14')][_0x7311('0x13')]);}})['catch'](function(_0x3001bc){logger[_0x7311('0x10')](_0x7311('0x12'),_0x4e788c,_0x3001bc);_0x2f3f7c(_0x3001bc);});});}exports[_0x7311('0x15')]=function(_0x1042c4){var _0x5a24fe=this;return new Promise(function(_0x2c2cff,_0x99b7){return db[_0x7311('0x16')][_0x7311('0x17')]({'raw':_0x1042c4[_0x7311('0x18')]?_0x1042c4[_0x7311('0x18')][_0x7311('0x19')]===undefined?!![]:![]:!![],'where':_0x1042c4['options']?_0x1042c4[_0x7311('0x18')][_0x7311('0x1a')]||null:null,'attributes':_0x1042c4[_0x7311('0x18')]?_0x1042c4[_0x7311('0x18')][_0x7311('0x1b')]||null:null,'limit':_0x1042c4[_0x7311('0x18')]?_0x1042c4[_0x7311('0x18')][_0x7311('0x1c')]||null:null,'include':_0x1042c4[_0x7311('0x18')]?_0x1042c4[_0x7311('0x18')][_0x7311('0x1d')]?_[_0x7311('0x1e')](_0x1042c4[_0x7311('0x18')][_0x7311('0x1d')],function(_0xf2cc8d){return{'model':db[_0xf2cc8d[_0x7311('0x1f')]],'as':_0xf2cc8d['as'],'attributes':_0xf2cc8d[_0x7311('0x1b')],'include':_0xf2cc8d[_0x7311('0x1d')]?_[_0x7311('0x1e')](_0xf2cc8d[_0x7311('0x1d')],function(_0x2df9da){return{'model':db[_0x2df9da[_0x7311('0x1f')]],'as':_0x2df9da['as'],'attributes':_0x2df9da[_0x7311('0x1b')],'include':_0x2df9da[_0x7311('0x1d')]?_[_0x7311('0x1e')](_0x2df9da[_0x7311('0x1d')],function(_0xe2dcac){return{'model':db[_0xe2dcac[_0x7311('0x1f')]],'as':_0xe2dcac['as'],'attributes':_0xe2dcac[_0x7311('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x7311('0xa')](function(_0x3148d7){logger[_0x7311('0xb')](_0x7311('0x15'),_0x1042c4);logger[_0x7311('0xd')]('GetTrigger',_0x1042c4,JSON[_0x7311('0xf')](_0x3148d7));_0x2c2cff(_0x3148d7);})['catch'](function(_0x336436){logger[_0x7311('0x10')](_0x7311('0x15'),_0x336436[_0x7311('0x13')],_0x1042c4);_0x99b7(_0x5a24fe[_0x7311('0x10')](0x1f4,_0x336436[_0x7311('0x13')]));});});};exports[_0x7311('0x20')]=function(_0x13c914){var _0x246504=this;return new Promise(function(_0x415830,_0x3867cf){return db[_0x7311('0x16')][_0x7311('0x21')]({'raw':_0x13c914[_0x7311('0x18')]?_0x13c914['options'][_0x7311('0x19')]===undefined?!![]:![]:!![],'where':_0x13c914['options']?_0x13c914[_0x7311('0x18')][_0x7311('0x1a')]||null:null,'attributes':_0x13c914[_0x7311('0x18')]?_0x13c914['options'][_0x7311('0x1b')]||null:null,'include':_0x13c914[_0x7311('0x18')]?_0x13c914['options'][_0x7311('0x1d')]?_[_0x7311('0x1e')](_0x13c914[_0x7311('0x18')][_0x7311('0x1d')],function(_0x512340){return{'model':db[_0x512340[_0x7311('0x1f')]],'as':_0x512340['as'],'attributes':_0x512340[_0x7311('0x1b')],'include':_0x512340[_0x7311('0x1d')]?_[_0x7311('0x1e')](_0x512340[_0x7311('0x1d')],function(_0x15f889){return{'model':db[_0x15f889[_0x7311('0x1f')]],'as':_0x15f889['as'],'attributes':_0x15f889[_0x7311('0x1b')],'include':_0x15f889[_0x7311('0x1d')]?_[_0x7311('0x1e')](_0x15f889[_0x7311('0x1d')],function(_0xa4a8ef){return{'model':db[_0xa4a8ef[_0x7311('0x1f')]],'as':_0xa4a8ef['as'],'attributes':_0xa4a8ef[_0x7311('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x7311('0xa')](function(_0x13b42b){logger[_0x7311('0xb')](_0x7311('0x20'),_0x13c914);logger[_0x7311('0xd')](_0x7311('0x20'),_0x13c914,JSON[_0x7311('0xf')](_0x13b42b));_0x415830(_0x13b42b);})[_0x7311('0x22')](function(_0x52c027){logger[_0x7311('0x10')](_0x7311('0x20'),_0x52c027[_0x7311('0x13')],_0x13c914);_0x3867cf(_0x246504[_0x7311('0x10')](0x1f4,_0x52c027[_0x7311('0x13')]));});});}; \ No newline at end of file +var _0xe267=['raw','ShowTrigger','lodash','util','moment','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Trigger,\x20%s,\x20%s','request\x20sent','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetTrigger','options','where','attributes','limit','include','map','model','debug'];(function(_0x2c0235,_0x50ffce){var _0x148a72=function(_0x4898e1){while(--_0x4898e1){_0x2c0235['push'](_0x2c0235['shift']());}};_0x148a72(++_0x50ffce);}(_0xe267,0x182));var _0x7e26=function(_0x253141,_0x396c1e){_0x253141=_0x253141-0x0;var _0x4472f3=_0xe267[_0x253141];return _0x4472f3;};'use strict';var _=require(_0x7e26('0x0'));var util=require(_0x7e26('0x1'));var moment=require(_0x7e26('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x7e26('0x3'));var logger=require('../../config/logger')(_0x7e26('0x4'));var config=require(_0x7e26('0x5'));var jayson=require(_0x7e26('0x6'));var client=jayson[_0x7e26('0x7')][_0x7e26('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x354da0,_0x262009,_0x246780){return new BPromise(function(_0x2259bf,_0x116e5d){return client[_0x7e26('0x9')](_0x354da0,_0x246780)[_0x7e26('0xa')](function(_0x39756c){logger[_0x7e26('0xb')](_0x7e26('0xc'),_0x262009,_0x7e26('0xd'));logger['debug'](_0x7e26('0xe'),_0x262009,_0x7e26('0xd'),JSON[_0x7e26('0xf')](_0x39756c));if(_0x39756c['error']){if(_0x39756c[_0x7e26('0x10')][_0x7e26('0x11')]===0x1f4){logger[_0x7e26('0x10')](_0x7e26('0xc'),_0x262009,_0x39756c[_0x7e26('0x10')]['message']);return _0x116e5d(_0x39756c[_0x7e26('0x10')][_0x7e26('0x12')]);}logger[_0x7e26('0x10')](_0x7e26('0xc'),_0x262009,_0x39756c['error'][_0x7e26('0x12')]);return _0x2259bf(_0x39756c['error'][_0x7e26('0x12')]);}else{logger['info'](_0x7e26('0xc'),_0x262009,_0x7e26('0xd'));_0x2259bf(_0x39756c[_0x7e26('0x13')]['message']);}})[_0x7e26('0x14')](function(_0x32e69d){logger[_0x7e26('0x10')](_0x7e26('0xc'),_0x262009,_0x32e69d);_0x116e5d(_0x32e69d);});});}exports[_0x7e26('0x15')]=function(_0x100ef7){var _0x3405a9=this;return new Promise(function(_0x5e6978,_0xdd52f8){return db['Trigger']['findAll']({'raw':_0x100ef7['options']?_0x100ef7[_0x7e26('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x100ef7[_0x7e26('0x16')]?_0x100ef7[_0x7e26('0x16')][_0x7e26('0x17')]||null:null,'attributes':_0x100ef7[_0x7e26('0x16')]?_0x100ef7['options'][_0x7e26('0x18')]||null:null,'limit':_0x100ef7[_0x7e26('0x16')]?_0x100ef7[_0x7e26('0x16')][_0x7e26('0x19')]||null:null,'include':_0x100ef7[_0x7e26('0x16')]?_0x100ef7[_0x7e26('0x16')][_0x7e26('0x1a')]?_[_0x7e26('0x1b')](_0x100ef7[_0x7e26('0x16')]['include'],function(_0x4c803e){return{'model':db[_0x4c803e['model']],'as':_0x4c803e['as'],'attributes':_0x4c803e[_0x7e26('0x18')],'include':_0x4c803e[_0x7e26('0x1a')]?_['map'](_0x4c803e[_0x7e26('0x1a')],function(_0x2e4e91){return{'model':db[_0x2e4e91[_0x7e26('0x1c')]],'as':_0x2e4e91['as'],'attributes':_0x2e4e91['attributes'],'include':_0x2e4e91['include']?_[_0x7e26('0x1b')](_0x2e4e91[_0x7e26('0x1a')],function(_0x523c33){return{'model':db[_0x523c33[_0x7e26('0x1c')]],'as':_0x523c33['as'],'attributes':_0x523c33['attributes']};}):[]};}):[]};}):[]:[]})[_0x7e26('0xa')](function(_0x5ece14){logger[_0x7e26('0xb')](_0x7e26('0x15'),_0x100ef7);logger[_0x7e26('0x1d')](_0x7e26('0x15'),_0x100ef7,JSON[_0x7e26('0xf')](_0x5ece14));_0x5e6978(_0x5ece14);})[_0x7e26('0x14')](function(_0x27895f){logger[_0x7e26('0x10')](_0x7e26('0x15'),_0x27895f[_0x7e26('0x12')],_0x100ef7);_0xdd52f8(_0x3405a9[_0x7e26('0x10')](0x1f4,_0x27895f['message']));});});};exports['ShowTrigger']=function(_0x3fe94e){var _0x5d3ba=this;return new Promise(function(_0x22fcf5,_0x1faed1){return db['Trigger']['find']({'raw':_0x3fe94e[_0x7e26('0x16')]?_0x3fe94e[_0x7e26('0x16')][_0x7e26('0x1e')]===undefined?!![]:![]:!![],'where':_0x3fe94e[_0x7e26('0x16')]?_0x3fe94e['options'][_0x7e26('0x17')]||null:null,'attributes':_0x3fe94e[_0x7e26('0x16')]?_0x3fe94e[_0x7e26('0x16')]['attributes']||null:null,'include':_0x3fe94e[_0x7e26('0x16')]?_0x3fe94e[_0x7e26('0x16')][_0x7e26('0x1a')]?_['map'](_0x3fe94e['options'][_0x7e26('0x1a')],function(_0x502894){return{'model':db[_0x502894[_0x7e26('0x1c')]],'as':_0x502894['as'],'attributes':_0x502894[_0x7e26('0x18')],'include':_0x502894['include']?_[_0x7e26('0x1b')](_0x502894['include'],function(_0x52521b){return{'model':db[_0x52521b[_0x7e26('0x1c')]],'as':_0x52521b['as'],'attributes':_0x52521b[_0x7e26('0x18')],'include':_0x52521b['include']?_['map'](_0x52521b[_0x7e26('0x1a')],function(_0x223010){return{'model':db[_0x223010[_0x7e26('0x1c')]],'as':_0x223010['as'],'attributes':_0x223010['attributes']};}):[]};}):[]};}):[]:[]})[_0x7e26('0xa')](function(_0x47dfc0){logger[_0x7e26('0xb')](_0x7e26('0x1f'),_0x3fe94e);logger[_0x7e26('0x1d')](_0x7e26('0x1f'),_0x3fe94e,JSON['stringify'](_0x47dfc0));_0x22fcf5(_0x47dfc0);})[_0x7e26('0x14')](function(_0x1d779e){logger[_0x7e26('0x10')](_0x7e26('0x1f'),_0x1d779e['message'],_0x3fe94e);_0x1faed1(_0x5d3ba[_0x7e26('0x10')](0x1f4,_0x1d779e[_0x7e26('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 0b962de..dad9d29 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 _0xb595=['../../components/auth/service','../../components/interaction/service','get','show','post','/:id/clone','isAuthenticated','/:id','delete','destroy','multer','util','path','express','Router','fs-extra'];(function(_0x249e96,_0x3ea39d){var _0x17444c=function(_0x1221d0){while(--_0x1221d0){_0x249e96['push'](_0x249e96['shift']());}};_0x17444c(++_0x3ea39d);}(_0xb595,0xca));var _0x5b59=function(_0x451231,_0x574bff){_0x451231=_0x451231-0x0;var _0x1b7821=_0xb595[_0x451231];return _0x1b7821;};'use strict';var multer=require(_0x5b59('0x0'));var util=require(_0x5b59('0x1'));var path=require(_0x5b59('0x2'));var timeout=require('connect-timeout');var express=require(_0x5b59('0x3'));var router=express[_0x5b59('0x4')]();var fs_extra=require(_0x5b59('0x5'));var auth=require(_0x5b59('0x6'));var interaction=require(_0x5b59('0x7'));var config=require('../../config/environment');var controller=require('./trunk.controller');router[_0x5b59('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/:id',auth['isAuthenticated'](),controller[_0x5b59('0x9')]);router[_0x5b59('0xa')](_0x5b59('0xb'),auth[_0x5b59('0xc')](),controller['clone']);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x5b59('0xd'),auth[_0x5b59('0xc')](),controller['update']);router[_0x5b59('0xe')]('/:id',auth[_0x5b59('0xc')](),controller[_0x5b59('0xf')]);module['exports']=router; \ No newline at end of file +var _0xfe70=['./trunk.controller','get','isAuthenticated','index','/:id','show','post','/:id/clone','clone','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x250e26,_0x104bbf){var _0x395640=function(_0x178bca){while(--_0x178bca){_0x250e26['push'](_0x250e26['shift']());}};_0x395640(++_0x104bbf);}(_0xfe70,0xfe));var _0x0fe7=function(_0x1dbaf7,_0x3d05b3){_0x1dbaf7=_0x1dbaf7-0x0;var _0x593f05=_0xfe70[_0x1dbaf7];return _0x593f05;};'use strict';var multer=require(_0x0fe7('0x0'));var util=require(_0x0fe7('0x1'));var path=require(_0x0fe7('0x2'));var timeout=require(_0x0fe7('0x3'));var express=require(_0x0fe7('0x4'));var router=express[_0x0fe7('0x5')]();var fs_extra=require(_0x0fe7('0x6'));var auth=require(_0x0fe7('0x7'));var interaction=require(_0x0fe7('0x8'));var config=require(_0x0fe7('0x9'));var controller=require(_0x0fe7('0xa'));router[_0x0fe7('0xb')]('/',auth[_0x0fe7('0xc')](),controller[_0x0fe7('0xd')]);router[_0x0fe7('0xb')](_0x0fe7('0xe'),auth['isAuthenticated'](),controller[_0x0fe7('0xf')]);router[_0x0fe7('0x10')](_0x0fe7('0x11'),auth[_0x0fe7('0xc')](),controller[_0x0fe7('0x12')]);router[_0x0fe7('0x10')]('/',auth[_0x0fe7('0xc')](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x0fe7('0x13')]);router[_0x0fe7('0x14')](_0x0fe7('0xe'),auth[_0x0fe7('0xc')](),controller[_0x0fe7('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 9ce9704..e8f6f10 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 _0x7587=['ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','setDataValue','transport','getDataValue','split','rfc2833','info','shortinfo','inband','auto','update','outgoing','yes','force_rport,comedia','nat','ulaw;alaw;gsm','join','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','pai','fingerprint','passive','actpass','dynamic','nonat','update,nonat','BOOLEAN','sequelize','exports','name','ENUM','user','peer','friend','STRING','from-voip-provider'];(function(_0x15cbdb,_0x350048){var _0x71bb55=function(_0x16622c){while(--_0x16622c){_0x15cbdb['push'](_0x15cbdb['shift']());}};_0x71bb55(++_0x350048);}(_0x7587,0xc3));var _0x7758=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0x7587[_0x433a86];return _0x23000c;};'use strict';var Sequelize=require(_0x7758('0x0'));module[_0x7758('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x7758('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x7758('0x3')]('friend',_0x7758('0x4'),_0x7758('0x5')),'allowNull':![],'defaultValue':_0x7758('0x6')},'context':{'type':Sequelize[_0x7758('0x7')],'allowNull':![],'defaultValue':_0x7758('0x8')},'callingpres':{'type':Sequelize['ENUM'](_0x7758('0x9'),_0x7758('0xa'),'ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED',_0x7758('0xb'),_0x7758('0xc'),_0x7758('0xd'))},'deny':{'type':Sequelize[_0x7758('0x7')]},'permit':{'type':Sequelize[_0x7758('0x7')]},'secret':{'type':Sequelize[_0x7758('0x7')]},'md5secret':{'type':Sequelize['STRING']},'remotesecret':{'type':Sequelize[_0x7758('0x7')]},'transport':{'type':Sequelize['STRING'],'defaultValue':'udp','set':function(_0x2ac33a){this[_0x7758('0xe')]('transport',_0x2ac33a?_0x2ac33a['join'](','):null);},'get':function(){return this['getDataValue'](_0x7758('0xf'))?this[_0x7758('0x10')](_0x7758('0xf'))[_0x7758('0x11')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0x7758('0x3')](_0x7758('0x12'),_0x7758('0x13'),_0x7758('0x14'),_0x7758('0x15'),_0x7758('0x16')),'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x7758('0x3')]('yes','no','nonat',_0x7758('0x17'),_0x7758('0x18')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x7758('0x3')](_0x7758('0x19'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x7758('0x7')]},'directmediadeny':{'type':Sequelize[_0x7758('0x7')]},'nat':{'type':Sequelize[_0x7758('0x7')],'defaultValue':_0x7758('0x1a'),'set':function(_0x53842a){this[_0x7758('0xe')](_0x7758('0x1b'),_0x53842a?_0x53842a['join'](','):null);},'get':function(){return this['getDataValue'](_0x7758('0x1b'))?this[_0x7758('0x10')](_0x7758('0x1b'))[_0x7758('0x11')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0x7758('0x7')]},'pickupgroup':{'type':Sequelize[_0x7758('0x7')]},'namedpickupgroup':{'type':Sequelize[_0x7758('0x7')]},'language':{'type':Sequelize[_0x7758('0x7')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x7758('0x7')],'allowNull':!![]},'disallow':{'type':Sequelize['STRING'],'defaultValue':'all'},'allow':{'type':Sequelize[_0x7758('0x7')],'allowNull':![],'defaultValue':_0x7758('0x1c'),'set':function(_0x3ec965){this['setDataValue']('allow',_0x3ec965?_0x3ec965[_0x7758('0x1d')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0x7758('0x10')](_0x7758('0x1e'))?this[_0x7758('0x10')]('allow')[_0x7758('0x11')](';'):null;},'comment':_0x7758('0x1f')},'autoframing':{'type':Sequelize[_0x7758('0x3')](_0x7758('0x19'),'no')},'insecure':{'type':Sequelize[_0x7758('0x7')],'defaultValue':'port,invite','set':function(_0x5b54e0){this[_0x7758('0xe')](_0x7758('0x20'),_0x5b54e0?_0x5b54e0[_0x7758('0x1d')](','):null);},'get':function(){return this[_0x7758('0x10')]('insecure')?this[_0x7758('0x10')](_0x7758('0x20'))[_0x7758('0x11')](','):null;},'comment':_0x7758('0x21')},'trustrpid':{'type':Sequelize[_0x7758('0x3')](_0x7758('0x19'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x7758('0x3')](_0x7758('0x19'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x7758('0x3')](_0x7758('0x19'),'no',_0x7758('0x22'))},'promiscredir':{'type':Sequelize[_0x7758('0x3')]('yes','no')},'useclientcode':{'type':Sequelize[_0x7758('0x3')]('yes','no')},'accountcode':{'type':Sequelize[_0x7758('0x23')](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x7758('0x7')],'defaultValue':_0x7758('0x24')},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize['ENUM'](_0x7758('0x19'),'no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0x7758('0x23')](0xb)},'allowoverlap':{'type':Sequelize['ENUM']('yes','no')},'allowsubscribe':{'type':Sequelize['ENUM'](_0x7758('0x19'),'no')},'allowtransfer':{'type':Sequelize[_0x7758('0x3')](_0x7758('0x19'),'no')},'ignoresdpversion':{'type':Sequelize[_0x7758('0x3')](_0x7758('0x19'),'no')},'subscribecontext':{'type':Sequelize[_0x7758('0x7')]},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize[_0x7758('0x3')](_0x7758('0x19'),'no',_0x7758('0x25')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x7758('0x19'),'no')},'mailbox':{'type':Sequelize[_0x7758('0x7')]},'session_timers':{'type':Sequelize[_0x7758('0x3')](_0x7758('0x26'),_0x7758('0x27'),_0x7758('0x28'))},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize[_0x7758('0x3')](_0x7758('0x29'),_0x7758('0x2a')),'defaultValue':_0x7758('0x2a')},'t38pt_usertpsource':{'type':Sequelize[_0x7758('0x7')]},'regexten':{'type':Sequelize[_0x7758('0x7')]},'fromdomain':{'type':Sequelize[_0x7758('0x7')]},'fromuser':{'type':Sequelize[_0x7758('0x7')]},'port':{'type':Sequelize[_0x7758('0x23')](0x5)},'qualify':{'type':Sequelize['ENUM'](_0x7758('0x19'),'no'),'defaultValue':_0x7758('0x19')},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize[_0x7758('0x7')]},'defaultuser':{'type':Sequelize[_0x7758('0x7')]},'rtptimeout':{'type':Sequelize[_0x7758('0x23')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x7758('0x23')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x7758('0x23')](0xb)},'sendrpid':{'type':Sequelize[_0x7758('0x3')](_0x7758('0x19'),'no',_0x7758('0x2b')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING']},'callbackextension':{'type':Sequelize[_0x7758('0x7')]},'timert1':{'type':Sequelize[_0x7758('0x23')](0xb)},'timerb':{'type':Sequelize[_0x7758('0x23')](0xb)},'qualifyfreq':{'type':Sequelize[_0x7758('0x23')](0xb)},'contactpermit':{'type':Sequelize[_0x7758('0x7')]},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize[_0x7758('0x7')]},'unsolicited_mailbox':{'type':Sequelize[_0x7758('0x7')]},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize[_0x7758('0x23')](0xb)},'encryption':{'type':Sequelize[_0x7758('0x3')](_0x7758('0x19'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x7758('0x3')](_0x7758('0x19'),'no')},'force_avp':{'type':Sequelize[_0x7758('0x3')](_0x7758('0x19'),'no')},'icesupport':{'type':Sequelize['ENUM'](_0x7758('0x19'),'no')},'dtlsenable':{'type':Sequelize[_0x7758('0x3')]('yes','no')},'dtlsverify':{'type':Sequelize[_0x7758('0x3')](_0x7758('0x19'),'no',_0x7758('0x2c'),'certificate')},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb)},'dtlscertfile':{'type':Sequelize[_0x7758('0x7')]},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize[_0x7758('0x7')]},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize[_0x7758('0x7')]},'dtlssetup':{'type':Sequelize['ENUM']('active',_0x7758('0x2d'),_0x7758('0x2e')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x7758('0x7')]},'usereqphone':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x7758('0x7')]},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize[_0x7758('0x23')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x7758('0x3')](_0x7758('0x19'),'no')},'subscribemwi':{'type':Sequelize[_0x7758('0x3')](_0x7758('0x19'),'no')},'vmexten':{'type':Sequelize[_0x7758('0x7')]},'mohinterpret':{'type':Sequelize['STRING']},'mohsuggest':{'type':Sequelize[_0x7758('0x7')]},'parkinglot':{'type':Sequelize[_0x7758('0x7')]},'description':{'type':Sequelize[_0x7758('0x7')]},'host':{'type':Sequelize[_0x7758('0x7')],'defaultValue':_0x7758('0x2f')},'canreinvite':{'type':Sequelize[_0x7758('0x3')]('yes','no',_0x7758('0x30'),_0x7758('0x17'),_0x7758('0x31')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x7758('0x7')]},'otherFields':{'type':Sequelize[_0x7758('0x7')]},'active':{'type':Sequelize[_0x7758('0x32')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x7758('0x7')],'defaultValue':'no'}}; \ No newline at end of file +var _0xfad6=['INTEGER','always','accept','refuse','uac','uas','pai','fingerprint','certificate','passive','actpass','dynamic','update','BOOLEAN','sequelize','exports','STRING','name','ENUM','friend','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','udp','setDataValue','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','nonat','outgoing','force_rport,comedia','nat','all','ulaw;alaw;gsm','allow','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>'];(function(_0x2306c6,_0x22531b){var _0x2a1df9=function(_0xd3fde5){while(--_0xd3fde5){_0x2306c6['push'](_0x2306c6['shift']());}};_0x2a1df9(++_0x22531b);}(_0xfad6,0x1d0));var _0x6fad=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfad6[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x6fad('0x0'));module[_0x6fad('0x1')]={'name':{'type':Sequelize[_0x6fad('0x2')],'allowNull':![],'unique':_0x6fad('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x6fad('0x4')](_0x6fad('0x5'),'user','peer'),'allowNull':![],'defaultValue':_0x6fad('0x5')},'context':{'type':Sequelize[_0x6fad('0x2')],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize['ENUM']('ALLOWED_NOT_SCREENED',_0x6fad('0x6'),_0x6fad('0x7'),_0x6fad('0x8'),'PROHIB_NOT_SCREENED',_0x6fad('0x9'),_0x6fad('0xa'),'PROHIB')},'deny':{'type':Sequelize['STRING']},'permit':{'type':Sequelize[_0x6fad('0x2')]},'secret':{'type':Sequelize[_0x6fad('0x2')]},'md5secret':{'type':Sequelize[_0x6fad('0x2')]},'remotesecret':{'type':Sequelize[_0x6fad('0x2')]},'transport':{'type':Sequelize[_0x6fad('0x2')],'defaultValue':_0x6fad('0xb'),'set':function(_0x479604){this[_0x6fad('0xc')](_0x6fad('0xd'),_0x479604?_0x479604[_0x6fad('0xe')](','):null);},'get':function(){return this[_0x6fad('0xf')](_0x6fad('0xd'))?this[_0x6fad('0xf')](_0x6fad('0xd'))[_0x6fad('0x10')](','):null;},'comment':_0x6fad('0x11')},'dtmfmode':{'type':Sequelize[_0x6fad('0x4')](_0x6fad('0x12'),_0x6fad('0x13'),_0x6fad('0x14'),_0x6fad('0x15'),_0x6fad('0x16')),'defaultValue':_0x6fad('0x12')},'directmedia':{'type':Sequelize[_0x6fad('0x4')](_0x6fad('0x17'),'no',_0x6fad('0x18'),'update',_0x6fad('0x19')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x6fad('0x4')](_0x6fad('0x17'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x6fad('0x2')]},'directmediadeny':{'type':Sequelize[_0x6fad('0x2')]},'nat':{'type':Sequelize[_0x6fad('0x2')],'defaultValue':_0x6fad('0x1a'),'set':function(_0x341d8f){this[_0x6fad('0xc')](_0x6fad('0x1b'),_0x341d8f?_0x341d8f[_0x6fad('0xe')](','):null);},'get':function(){return this[_0x6fad('0xf')](_0x6fad('0x1b'))?this['getDataValue']('nat')[_0x6fad('0x10')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0x6fad('0x2')]},'pickupgroup':{'type':Sequelize[_0x6fad('0x2')]},'namedpickupgroup':{'type':Sequelize[_0x6fad('0x2')]},'language':{'type':Sequelize[_0x6fad('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x6fad('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x6fad('0x2')],'defaultValue':_0x6fad('0x1c')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x6fad('0x1d'),'set':function(_0x37388e){this[_0x6fad('0xc')](_0x6fad('0x1e'),_0x37388e?_0x37388e[_0x6fad('0xe')](';'):_0x6fad('0x1d'));},'get':function(){return this[_0x6fad('0xf')](_0x6fad('0x1e'))?this[_0x6fad('0xf')](_0x6fad('0x1e'))[_0x6fad('0x10')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize['ENUM']('yes','no')},'insecure':{'type':Sequelize[_0x6fad('0x2')],'defaultValue':_0x6fad('0x1f'),'set':function(_0x16b34e){this[_0x6fad('0xc')](_0x6fad('0x20'),_0x16b34e?_0x16b34e['join'](','):null);},'get':function(){return this[_0x6fad('0xf')]('insecure')?this[_0x6fad('0xf')](_0x6fad('0x20'))[_0x6fad('0x10')](','):null;},'comment':_0x6fad('0x21')},'trustrpid':{'type':Sequelize['ENUM'](_0x6fad('0x17'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x6fad('0x4')](_0x6fad('0x17'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0x6fad('0x17'),'no',_0x6fad('0x22'))},'promiscredir':{'type':Sequelize['ENUM']('yes','no')},'useclientcode':{'type':Sequelize[_0x6fad('0x4')](_0x6fad('0x17'),'no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize[_0x6fad('0x2')]},'callerid':{'type':Sequelize['STRING'],'defaultValue':_0x6fad('0x23')},'amaflags':{'type':Sequelize[_0x6fad('0x2')]},'callcounter':{'type':Sequelize[_0x6fad('0x4')](_0x6fad('0x17'),'no'),'defaultValue':_0x6fad('0x17')},'busylevel':{'type':Sequelize[_0x6fad('0x24')](0xb)},'allowoverlap':{'type':Sequelize[_0x6fad('0x4')](_0x6fad('0x17'),'no')},'allowsubscribe':{'type':Sequelize[_0x6fad('0x4')](_0x6fad('0x17'),'no')},'allowtransfer':{'type':Sequelize[_0x6fad('0x4')](_0x6fad('0x17'),'no')},'ignoresdpversion':{'type':Sequelize['ENUM']('yes','no')},'subscribecontext':{'type':Sequelize[_0x6fad('0x2')]},'template':{'type':Sequelize[_0x6fad('0x2')]},'videosupport':{'type':Sequelize[_0x6fad('0x4')](_0x6fad('0x17'),'no',_0x6fad('0x25')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x6fad('0x24')](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x6fad('0x17'),'no')},'mailbox':{'type':Sequelize[_0x6fad('0x2')]},'session_timers':{'type':Sequelize['ENUM'](_0x6fad('0x26'),_0x6fad('0x27'),'originate')},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize[_0x6fad('0x24')](0xb)},'session_refresher':{'type':Sequelize['ENUM'](_0x6fad('0x28'),_0x6fad('0x29')),'defaultValue':_0x6fad('0x29')},'t38pt_usertpsource':{'type':Sequelize['STRING']},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize[_0x6fad('0x2')]},'fromuser':{'type':Sequelize[_0x6fad('0x2')]},'port':{'type':Sequelize[_0x6fad('0x24')](0x5)},'qualify':{'type':Sequelize[_0x6fad('0x4')]('yes','no'),'defaultValue':_0x6fad('0x17')},'keepalive':{'type':Sequelize[_0x6fad('0x24')](0xb)},'defaultip':{'type':Sequelize[_0x6fad('0x2')]},'defaultuser':{'type':Sequelize[_0x6fad('0x2')]},'rtptimeout':{'type':Sequelize[_0x6fad('0x24')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x6fad('0x24')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x6fad('0x24')](0xb)},'sendrpid':{'type':Sequelize[_0x6fad('0x4')]('yes','no',_0x6fad('0x2a')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x6fad('0x2')]},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize[_0x6fad('0x24')](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize[_0x6fad('0x24')](0xb)},'contactpermit':{'type':Sequelize[_0x6fad('0x2')]},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize[_0x6fad('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0x6fad('0x2')]},'use_q850_reason':{'type':Sequelize[_0x6fad('0x2')]},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize['ENUM'](_0x6fad('0x17'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x6fad('0x4')](_0x6fad('0x17'),'no')},'force_avp':{'type':Sequelize[_0x6fad('0x4')](_0x6fad('0x17'),'no')},'icesupport':{'type':Sequelize[_0x6fad('0x4')](_0x6fad('0x17'),'no')},'dtlsenable':{'type':Sequelize[_0x6fad('0x4')]('yes','no')},'dtlsverify':{'type':Sequelize[_0x6fad('0x4')](_0x6fad('0x17'),'no',_0x6fad('0x2b'),_0x6fad('0x2c'))},'dtlsrekey':{'type':Sequelize[_0x6fad('0x24')](0xb)},'dtlscertfile':{'type':Sequelize[_0x6fad('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0x6fad('0x2')]},'dtlscipher':{'type':Sequelize[_0x6fad('0x2')]},'dtlscafile':{'type':Sequelize[_0x6fad('0x2')]},'dtlscapath':{'type':Sequelize[_0x6fad('0x2')]},'dtlssetup':{'type':Sequelize['ENUM']('active',_0x6fad('0x2d'),_0x6fad('0x2e')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x6fad('0x2')]},'usereqphone':{'type':Sequelize[_0x6fad('0x4')](_0x6fad('0x17'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x6fad('0x2')]},'recordofffeature':{'type':Sequelize[_0x6fad('0x2')]},'call_limit':{'type':Sequelize[_0x6fad('0x24')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM'](_0x6fad('0x17'),'no')},'subscribemwi':{'type':Sequelize[_0x6fad('0x4')]('yes','no')},'vmexten':{'type':Sequelize[_0x6fad('0x2')]},'mohinterpret':{'type':Sequelize[_0x6fad('0x2')]},'mohsuggest':{'type':Sequelize['STRING']},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING'],'defaultValue':_0x6fad('0x2f')},'canreinvite':{'type':Sequelize[_0x6fad('0x4')](_0x6fad('0x17'),'no',_0x6fad('0x18'),_0x6fad('0x30'),'update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x6fad('0x31')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x6fad('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 64c79e8..c34ee2c 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 _0x9c44=['key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','clone','find','omit','createdAt','body','updatedAt','create','user','role','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','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','Reload','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','update','params','/etc/asterisk/sip_xcally_registers.conf','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','client','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','message','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','reject','save','get','Trunks','destroy','stack','name','send','index','Trunk','rawAttributes','fieldName','type'];(function(_0x55e9e9,_0x1afc74){var _0x39cb0c=function(_0x4c02f3){while(--_0x4c02f3){_0x55e9e9['push'](_0x55e9e9['shift']());}};_0x39cb0c(++_0x1afc74);}(_0x9c44,0x178));var _0x49c4=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0x9c44[_0x45d55e];return _0x29812a;};'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'];var jayson=require('jayson/promise');var client=jayson[_0x49c4('0x16')][_0x49c4('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x5f2fd9,_0x1909fe,_0x280996,_0x21f15a){return new BPromise(function(_0x2decee,_0x12777c){var _0x18211c=_0x21f15a||client;return _0x18211c[_0x49c4('0x18')](_0x5f2fd9,_0x280996)[_0x49c4('0x19')](function(_0x58d177){logger[_0x49c4('0x1a')](_0x49c4('0x1b'),_0x1909fe,_0x49c4('0x1c'));logger[_0x49c4('0x1d')](_0x49c4('0x1e'),_0x1909fe,'request\x20sent',JSON[_0x49c4('0x1f')](_0x58d177));if(_0x58d177[_0x49c4('0x20')]){if(_0x58d177['error']['code']===0x1f4){logger[_0x49c4('0x20')](_0x49c4('0x1b'),_0x1909fe,_0x58d177[_0x49c4('0x20')]['message']);return _0x12777c(_0x58d177[_0x49c4('0x20')]['message']);}logger[_0x49c4('0x20')](_0x49c4('0x1b'),_0x1909fe,_0x58d177[_0x49c4('0x20')][_0x49c4('0x21')]);return _0x2decee(_0x58d177[_0x49c4('0x20')][_0x49c4('0x21')]);}else{logger[_0x49c4('0x1a')](_0x49c4('0x1b'),_0x1909fe,_0x49c4('0x1c'));_0x2decee(_0x58d177['result']['message']);}})['catch'](function(_0x1c99b1){logger['error']('Trunk,\x20%s,\x20%s',_0x1909fe,_0x1c99b1);_0x12777c(_0x1c99b1);});});}function respondWithStatusCode(_0x2263ae,_0x15581b){_0x15581b=_0x15581b||0xcc;return function(_0x26c640){if(_0x26c640){return _0x2263ae[_0x49c4('0x22')](_0x15581b);}return _0x2263ae['status'](_0x15581b)['end']();};}function respondWithResult(_0x180276,_0x9cb797){_0x9cb797=_0x9cb797||0xc8;return function(_0x565423){if(_0x565423){return _0x180276[_0x49c4('0x23')](_0x9cb797)[_0x49c4('0x24')](_0x565423);}};}function respondWithFilteredResult(_0x210159,_0xa7a826){return function(_0x531d92){if(_0x531d92){var _0x543ea2=typeof _0xa7a826[_0x49c4('0x25')]==='undefined'&&typeof _0xa7a826[_0x49c4('0x26')]===_0x49c4('0x27');var _0x3f1708=_0x531d92[_0x49c4('0x28')];var _0x5987ae=_0x543ea2?0x0:_0xa7a826[_0x49c4('0x25')];var _0x2b2793=_0x543ea2?_0x531d92[_0x49c4('0x28')]:_0xa7a826[_0x49c4('0x25')]+_0xa7a826[_0x49c4('0x26')];var _0x29f835;if(_0x2b2793>=_0x3f1708){_0x2b2793=_0x3f1708;_0x29f835=0xc8;}else{_0x29f835=0xce;}_0x210159[_0x49c4('0x23')](_0x29f835);return _0x210159[_0x49c4('0x29')](_0x49c4('0x2a'),_0x5987ae+'-'+_0x2b2793+'/'+_0x3f1708)[_0x49c4('0x24')](_0x531d92);}return null;};}function patchUpdates(_0x46f7ea){return function(_0x4ea6ea){try{jsonpatch['apply'](_0x4ea6ea,_0x46f7ea,!![]);}catch(_0x59eb84){return BPromise[_0x49c4('0x2b')](_0x59eb84);}return _0x4ea6ea[_0x49c4('0x2c')]();};}function saveUpdates(_0x1eb035,_0x27e467){return function(_0x28eb47){if(_0x28eb47){return _0x28eb47['update'](_0x1eb035)[_0x49c4('0x19')](function(_0x116eb4){return _0x116eb4;});}return null;};}function removeEntity(_0x2e7a69,_0x24bba9){return function(_0x58e252){if(_0x58e252){return _0x58e252['destroy']()[_0x49c4('0x19')](function(){var _0x9a1bed=_0x58e252[_0x49c4('0x2d')]({'plain':!![]});var _0x13b3b4=_0x49c4('0x2e');return db['UserProfileResource'][_0x49c4('0x2f')]({'where':{'type':_0x13b3b4,'resourceId':_0x9a1bed['id']}})[_0x49c4('0x19')](function(){return _0x58e252;});})[_0x49c4('0x19')](function(){_0x2e7a69['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x85dce2,_0x1991e9){return function(_0x3bec0a){if(!_0x3bec0a){_0x85dce2[_0x49c4('0x22')](0x194);}return _0x3bec0a;};}function handleError(_0x2b45a1,_0x2cf897){_0x2cf897=_0x2cf897||0x1f4;return function(_0x1d1557){logger[_0x49c4('0x20')](_0x1d1557[_0x49c4('0x30')]);if(_0x1d1557['name']){delete _0x1d1557[_0x49c4('0x31')];}_0x2b45a1['status'](_0x2cf897)[_0x49c4('0x32')](_0x1d1557);};}exports[_0x49c4('0x33')]=function(_0x2625a6,_0x1c2830){var _0x4ed4f8={},_0x335f0c={},_0x31f3ff={'count':0x0,'rows':[]};var _0x1c910a=_['map'](db[_0x49c4('0x34')][_0x49c4('0x35')],function(_0x178987){return{'name':_0x178987[_0x49c4('0x36')],'type':_0x178987[_0x49c4('0x37')][_0x49c4('0x38')]};});_0x335f0c[_0x49c4('0x39')]=_[_0x49c4('0x3a')](_0x1c910a,_0x49c4('0x31'));_0x335f0c[_0x49c4('0x3b')]=_[_0x49c4('0x3c')](_0x2625a6['query']);_0x335f0c[_0x49c4('0x3d')]=_[_0x49c4('0x3e')](_0x335f0c[_0x49c4('0x39')],_0x335f0c[_0x49c4('0x3b')]);_0x4ed4f8[_0x49c4('0x3f')]=_[_0x49c4('0x3e')](_0x335f0c[_0x49c4('0x39')],qs[_0x49c4('0x40')](_0x2625a6[_0x49c4('0x3b')][_0x49c4('0x40')]));_0x4ed4f8[_0x49c4('0x3f')]=_0x4ed4f8[_0x49c4('0x3f')][_0x49c4('0x41')]?_0x4ed4f8['attributes']:_0x335f0c[_0x49c4('0x39')];if(!_0x2625a6['query'][_0x49c4('0x42')](_0x49c4('0x43'))){_0x4ed4f8[_0x49c4('0x26')]=qs[_0x49c4('0x26')](_0x2625a6[_0x49c4('0x3b')][_0x49c4('0x26')]);_0x4ed4f8['offset']=qs['offset'](_0x2625a6[_0x49c4('0x3b')][_0x49c4('0x25')]);}_0x4ed4f8[_0x49c4('0x44')]=qs[_0x49c4('0x45')](_0x2625a6['query'][_0x49c4('0x45')]);_0x4ed4f8[_0x49c4('0x46')]=qs[_0x49c4('0x3d')](_[_0x49c4('0x47')](_0x2625a6[_0x49c4('0x3b')],_0x335f0c[_0x49c4('0x3d')]),_0x1c910a);if(_0x2625a6[_0x49c4('0x3b')][_0x49c4('0x48')]){_0x4ed4f8[_0x49c4('0x46')]=_['merge'](_0x4ed4f8[_0x49c4('0x46')],{'$or':_['map'](_0x1c910a,function(_0x33696e){if(_0x33696e[_0x49c4('0x37')]!==_0x49c4('0x49')){var _0x258abe={};_0x258abe[_0x33696e[_0x49c4('0x31')]]={'$like':'%'+_0x2625a6['query'][_0x49c4('0x48')]+'%'};return _0x258abe;}})});}_0x4ed4f8=_[_0x49c4('0x4a')]({},_0x4ed4f8,_0x2625a6[_0x49c4('0x4b')]);var _0x254d07={'where':_0x4ed4f8[_0x49c4('0x46')]};return db[_0x49c4('0x34')][_0x49c4('0x28')](_0x254d07)['then'](function(_0x3bac1b){_0x31f3ff['count']=_0x3bac1b;if(_0x2625a6[_0x49c4('0x3b')][_0x49c4('0x4c')]){_0x4ed4f8[_0x49c4('0x4d')]=[{'all':!![]}];}return db[_0x49c4('0x34')][_0x49c4('0x4e')](_0x4ed4f8);})[_0x49c4('0x19')](function(_0x2c6be1){_0x31f3ff['rows']=_0x2c6be1;return _0x31f3ff;})[_0x49c4('0x19')](respondWithFilteredResult(_0x1c2830,_0x4ed4f8))[_0x49c4('0x4f')](handleError(_0x1c2830,null));};exports['show']=function(_0x1e1ac4,_0xaece5f){var _0xfbe179={'raw':![],'where':{'id':_0x1e1ac4['params']['id']}},_0x242afc={};_0x242afc['model']=_[_0x49c4('0x3c')](db['Trunk'][_0x49c4('0x35')]);_0x242afc[_0x49c4('0x3b')]=_[_0x49c4('0x3c')](_0x1e1ac4[_0x49c4('0x3b')]);_0x242afc[_0x49c4('0x3d')]=_[_0x49c4('0x3e')](_0x242afc[_0x49c4('0x39')],_0x242afc['query']);_0xfbe179[_0x49c4('0x3f')]=_[_0x49c4('0x3e')](_0x242afc[_0x49c4('0x39')],qs[_0x49c4('0x40')](_0x1e1ac4[_0x49c4('0x3b')][_0x49c4('0x40')]));_0xfbe179[_0x49c4('0x3f')]=_0xfbe179[_0x49c4('0x3f')][_0x49c4('0x41')]?_0xfbe179[_0x49c4('0x3f')]:_0x242afc['model'];if(_0x1e1ac4['query'][_0x49c4('0x4c')]){_0xfbe179[_0x49c4('0x4d')]=[{'all':!![]}];}_0xfbe179=_['merge']({},_0xfbe179,_0x1e1ac4['options']);return db[_0x49c4('0x34')]['find'](_0xfbe179)['then'](handleEntityNotFound(_0xaece5f,null))[_0x49c4('0x19')](respondWithResult(_0xaece5f,null))[_0x49c4('0x4f')](handleError(_0xaece5f,null));};exports[_0x49c4('0x50')]=function(_0x38c480,_0x2884ca){var _0x16949a={'where':{'id':_0x38c480['params']['id']}},_0x35724e={};_0x35724e[_0x49c4('0x39')]=_[_0x49c4('0x3c')](db[_0x49c4('0x34')][_0x49c4('0x35')]);_0x16949a[_0x49c4('0x3f')]=_[_0x49c4('0x3e')](_0x35724e['model'],qs['fields'](_0x38c480[_0x49c4('0x3b')][_0x49c4('0x40')]));_0x16949a[_0x49c4('0x3f')]=_0x16949a[_0x49c4('0x3f')][_0x49c4('0x41')]?_0x16949a[_0x49c4('0x3f')]:_0x35724e[_0x49c4('0x39')];if(_0x38c480['query'][_0x49c4('0x4c')]){_0x16949a[_0x49c4('0x4d')]=[{'all':!![]}];}_0x16949a=_['merge']({},_0x16949a,_0x38c480[_0x49c4('0x4b')]);return db['Trunk'][_0x49c4('0x51')](_0x16949a)[_0x49c4('0x19')](handleEntityNotFound(_0x2884ca,null))[_0x49c4('0x19')](function(_0x2fe89a){if(_0x2fe89a){var _0x845f7e=_0x2fe89a[_0x49c4('0x2d')]({'plain':!![]});_0x845f7e=qs[_0x49c4('0x52')](_0x845f7e,['id',_0x49c4('0x53'),'updatedAt']);_0x38c480[_0x49c4('0x54')]=_[_0x49c4('0x52')](_0x38c480['body'],['id',_0x49c4('0x53'),_0x49c4('0x55')]);return db['Trunk'][_0x49c4('0x56')](_[_0x49c4('0x4a')](_0x845f7e,_0x38c480['body']),{'include':_0x38c480['query']['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0xc43386){var _0x54947d=_0x38c480[_0x49c4('0x57')][_0x49c4('0x2d')]({'plain':!![]});if(!_0x54947d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x54947d[_0x49c4('0x58')]===_0x49c4('0x57')){var _0x5ac9f0=_0xc43386[_0x49c4('0x2d')]({'plain':!![]});var _0x3dcf4c=_0x49c4('0x2e');return db[_0x49c4('0x59')]['find']({'where':{'name':_0x3dcf4c,'userProfileId':_0x54947d[_0x49c4('0x5a')]},'raw':!![]})[_0x49c4('0x19')](function(_0x3cc604){if(_0x3cc604&&_0x3cc604[_0x49c4('0x5b')]===0x0){return db['UserProfileResource'][_0x49c4('0x56')]({'name':_0x5ac9f0['name'],'resourceId':_0x5ac9f0['id'],'type':_0x3cc604['name'],'sectionId':_0x3cc604['id']},{})['then'](function(){return _0xc43386;});}else{return _0xc43386;}})['catch'](function(_0x302251){logger[_0x49c4('0x20')](_0x49c4('0x5c'),_0x302251);throw _0x302251;});}return _0xc43386;});}})[_0x49c4('0x19')](respondWithResult(_0x2884ca,0xc9))['catch'](handleError(_0x2884ca,null));};exports['create']=function(_0x340523,_0x109b81,_0x342326){var _0x295ad0;return db[_0x49c4('0x34')][_0x49c4('0x56')](_0x340523[_0x49c4('0x54')],{'raw':!![]})[_0x49c4('0x19')](function(_0x4d49e0){_0x295ad0=_0x4d49e0;return db[_0x49c4('0x34')]['findAll']({'raw':!![]});})[_0x49c4('0x19')](function(_0x264902){var _0x1a5d4c=fs[_0x49c4('0x5d')](path[_0x49c4('0x5e')](config[_0x49c4('0x5f')],_0x49c4('0x60')),_0x49c4('0x61'));var _0x13d951=fs[_0x49c4('0x5d')](path[_0x49c4('0x5e')](config[_0x49c4('0x5f')],_0x49c4('0x62')),_0x49c4('0x61'));var _0x2d5f63=ejs[_0x49c4('0x63')](_0x1a5d4c,{'trunks':_0x264902||[]});fs[_0x49c4('0x64')](_0x49c4('0x65'),_0x2d5f63);if(_0x295ad0['registry']){var _0x5ec201=ejs[_0x49c4('0x63')](_0x13d951,{'trunks':_0x264902||[]});fs[_0x49c4('0x64')]('/etc/asterisk/sip_xcally_registers.conf',_0x5ec201);}})[_0x49c4('0x19')](function(){return respondWithRpcPromise(_0x49c4('0x66'),_0x49c4('0x56'),{'module':_0x49c4('0x67')});})['then'](function(){var _0x5a14a5=_0x340523['user'][_0x49c4('0x2d')]({'plain':!![]});if(!_0x5a14a5)throw new Error(_0x49c4('0x68'));if(_0x5a14a5[_0x49c4('0x58')]===_0x49c4('0x57')){var _0x118fc4=_0x295ad0[_0x49c4('0x2d')]({'plain':!![]});return db[_0x49c4('0x59')][_0x49c4('0x51')]({'where':{'name':_0x49c4('0x2e'),'userProfileId':_0x5a14a5['userProfileId']},'raw':!![]})[_0x49c4('0x19')](function(_0x10fb84){if(_0x10fb84&&_0x10fb84[_0x49c4('0x5b')]===0x0){return db['UserProfileResource'][_0x49c4('0x56')]({'name':_0x118fc4[_0x49c4('0x31')],'resourceId':_0x118fc4['id'],'type':_0x10fb84[_0x49c4('0x31')],'sectionId':_0x10fb84['id']},{})[_0x49c4('0x19')](function(){return _0x295ad0;});}else{return _0x295ad0;}})[_0x49c4('0x4f')](function(_0x2fd749){logger[_0x49c4('0x20')](_0x49c4('0x5c'),_0x2fd749);throw _0x2fd749;});}return _0x295ad0;})['then'](respondWithResult(_0x109b81,0xc9))[_0x49c4('0x4f')](handleError(_0x109b81,null));};exports[_0x49c4('0x69')]=function(_0x85540f,_0x18e82b,_0x1e948a){var _0x4a204d;return db['Trunk'][_0x49c4('0x51')]({'where':{'id':_0x85540f['params']['id']}})[_0x49c4('0x19')](handleEntityNotFound(_0x18e82b,null))['then'](saveUpdates(_0x85540f[_0x49c4('0x54')],null))[_0x49c4('0x19')](function(_0x3b03dd){if(_0x3b03dd){_0x4a204d=_0x3b03dd;return db[_0x49c4('0x34')]['findAll']({'raw':!![]});}})[_0x49c4('0x19')](function(_0x38d7d3){if(_0x38d7d3){var _0x2ceada=fs[_0x49c4('0x5d')](path[_0x49c4('0x5e')](config[_0x49c4('0x5f')],_0x49c4('0x60')),_0x49c4('0x61'));var _0x46477f=fs[_0x49c4('0x5d')](path['join'](config[_0x49c4('0x5f')],_0x49c4('0x62')),'utf8');var _0x15bee0=ejs['render'](_0x2ceada,{'trunks':_0x38d7d3||[]});fs[_0x49c4('0x64')](_0x49c4('0x65'),_0x15bee0);var _0x1f14a6=ejs[_0x49c4('0x63')](_0x46477f,{'trunks':_0x38d7d3||[]});fs[_0x49c4('0x64')]('/etc/asterisk/sip_xcally_registers.conf',_0x1f14a6);return respondWithRpcPromise(_0x49c4('0x66'),_0x49c4('0x69'),{'module':'chan_sip.so'});}return null;})[_0x49c4('0x19')](function(_0x167e41){if(_0x167e41){return _0x4a204d;}})['then'](respondWithResult(_0x18e82b,null))[_0x49c4('0x4f')](handleError(_0x18e82b,null));};exports[_0x49c4('0x2f')]=function(_0x57b137,_0x37fef1,_0x993d00){var _0x25989a;return db[_0x49c4('0x34')]['find']({'where':{'id':_0x57b137[_0x49c4('0x6a')]['id']}})[_0x49c4('0x19')](handleEntityNotFound(_0x37fef1,null))['then'](removeEntity(_0x37fef1,null))[_0x49c4('0x19')](function(){return db['Trunk']['findAll']({'raw':!![]});})[_0x49c4('0x19')](function(_0x507078){var _0x50fd24=fs[_0x49c4('0x5d')](path[_0x49c4('0x5e')](config['root'],_0x49c4('0x60')),'utf8');var _0x578f4b=fs['readFileSync'](path[_0x49c4('0x5e')](config[_0x49c4('0x5f')],_0x49c4('0x62')),_0x49c4('0x61'));var _0x4a5f0b=ejs['render'](_0x50fd24,{'trunks':_0x507078});var _0x348693=ejs['render'](_0x578f4b,{'trunks':_0x507078});fs[_0x49c4('0x64')]('/etc/asterisk/sip_xcally_trunks.conf',_0x4a5f0b);fs[_0x49c4('0x64')](_0x49c4('0x6b'),_0x348693);return respondWithRpcPromise(_0x49c4('0x66'),_0x49c4('0x2f'),{'module':_0x49c4('0x67')});})[_0x49c4('0x4f')](handleError(_0x37fef1,null));}; \ No newline at end of file +var _0xa41a=['server/files/templates/registry.ejs','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','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','catch','sendStatus','status','json','offset','undefined','limit','count','set','reject','update','destroy','get','UserProfileResource','end','name','send','map','Trunk','fieldName','type','key','query','intersection','model','attributes','fields','length','order','filters','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','show','params','keys','rawAttributes','find','createdAt','updatedAt','body','create','user','UserProfileSection','userProfileId','autoAssociation','readFileSync','join','root','server/files/templates/trunk.ejs','utf8','render','/etc/asterisk/sip_xcally_trunks.conf','registry','writeFileSync','/etc/asterisk/sip_xcally_registers.conf','chan_sip.so','role','Trunks','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Reload'];(function(_0x185a70,_0x576d8b){var _0x4d599c=function(_0x1923bb){while(--_0x1923bb){_0x185a70['push'](_0x185a70['shift']());}};_0x4d599c(++_0x576d8b);}(_0xa41a,0x6b));var _0xaa41=function(_0x189d4a,_0x32d334){_0x189d4a=_0x189d4a-0x0;var _0x42bf83=_0xa41a[_0x189d4a];return _0x42bf83;};'use strict';var emlformat=require(_0xaa41('0x0'));var rimraf=require(_0xaa41('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xaa41('0x2'));var rp=require(_0xaa41('0x3'));var moment=require(_0xaa41('0x4'));var BPromise=require(_0xaa41('0x5'));var Mustache=require(_0xaa41('0x6'));var util=require(_0xaa41('0x7'));var path=require(_0xaa41('0x8'));var sox=require(_0xaa41('0x9'));var csv=require('to-csv');var ejs=require(_0xaa41('0xa'));var fs=require('fs');var fs_extra=require(_0xaa41('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xaa41('0xc'));var jsforce=require(_0xaa41('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xaa41('0xe'));var querystring=require(_0xaa41('0xf'));var Papa=require(_0xaa41('0x10'));var Redis=require(_0xaa41('0x11'));var authService=require(_0xaa41('0x12'));var qs=require(_0xaa41('0x13'));var as=require(_0xaa41('0x14'));var hardwareService=require(_0xaa41('0x15'));var logger=require(_0xaa41('0x16'))('api');var utils=require(_0xaa41('0x17'));var config=require(_0xaa41('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require(_0xaa41('0x19'));var client=jayson['client'][_0xaa41('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x12d9e6,_0x2f64bc,_0x889d44,_0x6f9ade){return new BPromise(function(_0x4eaf81,_0x1e9d7f){var _0x178170=_0x6f9ade||client;return _0x178170[_0xaa41('0x1b')](_0x12d9e6,_0x889d44)[_0xaa41('0x1c')](function(_0x2a6988){logger[_0xaa41('0x1d')](_0xaa41('0x1e'),_0x2f64bc,'request\x20sent');logger[_0xaa41('0x1f')](_0xaa41('0x20'),_0x2f64bc,_0xaa41('0x21'),JSON[_0xaa41('0x22')](_0x2a6988));if(_0x2a6988[_0xaa41('0x23')]){if(_0x2a6988[_0xaa41('0x23')][_0xaa41('0x24')]===0x1f4){logger[_0xaa41('0x23')](_0xaa41('0x1e'),_0x2f64bc,_0x2a6988['error']['message']);return _0x1e9d7f(_0x2a6988[_0xaa41('0x23')][_0xaa41('0x25')]);}logger[_0xaa41('0x23')]('Trunk,\x20%s,\x20%s',_0x2f64bc,_0x2a6988[_0xaa41('0x23')][_0xaa41('0x25')]);return _0x4eaf81(_0x2a6988['error']['message']);}else{logger[_0xaa41('0x1d')]('Trunk,\x20%s,\x20%s',_0x2f64bc,_0xaa41('0x21'));_0x4eaf81(_0x2a6988[_0xaa41('0x26')][_0xaa41('0x25')]);}})[_0xaa41('0x27')](function(_0x1d623c){logger['error'](_0xaa41('0x1e'),_0x2f64bc,_0x1d623c);_0x1e9d7f(_0x1d623c);});});}function respondWithStatusCode(_0x43a85c,_0x448a21){_0x448a21=_0x448a21||0xcc;return function(_0x21f596){if(_0x21f596){return _0x43a85c[_0xaa41('0x28')](_0x448a21);}return _0x43a85c[_0xaa41('0x29')](_0x448a21)['end']();};}function respondWithResult(_0x5795f4,_0x16aec5){_0x16aec5=_0x16aec5||0xc8;return function(_0x527cac){if(_0x527cac){return _0x5795f4['status'](_0x16aec5)[_0xaa41('0x2a')](_0x527cac);}};}function respondWithFilteredResult(_0x59707f,_0x536bed){return function(_0x2d0ac0){if(_0x2d0ac0){var _0x9c8c21=typeof _0x536bed[_0xaa41('0x2b')]===_0xaa41('0x2c')&&typeof _0x536bed[_0xaa41('0x2d')]===_0xaa41('0x2c');var _0x57ef96=_0x2d0ac0[_0xaa41('0x2e')];var _0x1f0275=_0x9c8c21?0x0:_0x536bed[_0xaa41('0x2b')];var _0x9a16e3=_0x9c8c21?_0x2d0ac0[_0xaa41('0x2e')]:_0x536bed[_0xaa41('0x2b')]+_0x536bed[_0xaa41('0x2d')];var _0x104a95;if(_0x9a16e3>=_0x57ef96){_0x9a16e3=_0x57ef96;_0x104a95=0xc8;}else{_0x104a95=0xce;}_0x59707f['status'](_0x104a95);return _0x59707f[_0xaa41('0x2f')]('Content-Range',_0x1f0275+'-'+_0x9a16e3+'/'+_0x57ef96)['json'](_0x2d0ac0);}return null;};}function patchUpdates(_0x714537){return function(_0x1176bd){try{jsonpatch['apply'](_0x1176bd,_0x714537,!![]);}catch(_0x392b5d){return BPromise[_0xaa41('0x30')](_0x392b5d);}return _0x1176bd['save']();};}function saveUpdates(_0x5022fb,_0x5c25fb){return function(_0x1cf3da){if(_0x1cf3da){return _0x1cf3da[_0xaa41('0x31')](_0x5022fb)[_0xaa41('0x1c')](function(_0x38afc4){return _0x38afc4;});}return null;};}function removeEntity(_0x58f203,_0x289c4a){return function(_0x45c8fe){if(_0x45c8fe){return _0x45c8fe[_0xaa41('0x32')]()['then'](function(){var _0x387c55=_0x45c8fe[_0xaa41('0x33')]({'plain':!![]});var _0x321eb7='Trunks';return db[_0xaa41('0x34')][_0xaa41('0x32')]({'where':{'type':_0x321eb7,'resourceId':_0x387c55['id']}})['then'](function(){return _0x45c8fe;});})[_0xaa41('0x1c')](function(){_0x58f203[_0xaa41('0x29')](0xcc)[_0xaa41('0x35')]();});}};}function handleEntityNotFound(_0x5cec87,_0x22b272){return function(_0x48335f){if(!_0x48335f){_0x5cec87[_0xaa41('0x28')](0x194);}return _0x48335f;};}function handleError(_0x199b24,_0xf13742){_0xf13742=_0xf13742||0x1f4;return function(_0x49b77a){logger['error'](_0x49b77a['stack']);if(_0x49b77a[_0xaa41('0x36')]){delete _0x49b77a[_0xaa41('0x36')];}_0x199b24[_0xaa41('0x29')](_0xf13742)[_0xaa41('0x37')](_0x49b77a);};}exports['index']=function(_0x53a2e4,_0x267999){var _0x5673c={},_0x951e52={},_0x4e8d2e={'count':0x0,'rows':[]};var _0xba115a=_[_0xaa41('0x38')](db[_0xaa41('0x39')]['rawAttributes'],function(_0x3adc28){return{'name':_0x3adc28[_0xaa41('0x3a')],'type':_0x3adc28[_0xaa41('0x3b')][_0xaa41('0x3c')]};});_0x951e52['model']=_['map'](_0xba115a,_0xaa41('0x36'));_0x951e52[_0xaa41('0x3d')]=_['keys'](_0x53a2e4[_0xaa41('0x3d')]);_0x951e52['filters']=_[_0xaa41('0x3e')](_0x951e52[_0xaa41('0x3f')],_0x951e52[_0xaa41('0x3d')]);_0x5673c[_0xaa41('0x40')]=_[_0xaa41('0x3e')](_0x951e52[_0xaa41('0x3f')],qs[_0xaa41('0x41')](_0x53a2e4[_0xaa41('0x3d')]['fields']));_0x5673c[_0xaa41('0x40')]=_0x5673c[_0xaa41('0x40')][_0xaa41('0x42')]?_0x5673c[_0xaa41('0x40')]:_0x951e52[_0xaa41('0x3f')];if(!_0x53a2e4[_0xaa41('0x3d')]['hasOwnProperty']('nolimit')){_0x5673c[_0xaa41('0x2d')]=qs['limit'](_0x53a2e4[_0xaa41('0x3d')][_0xaa41('0x2d')]);_0x5673c[_0xaa41('0x2b')]=qs[_0xaa41('0x2b')](_0x53a2e4[_0xaa41('0x3d')][_0xaa41('0x2b')]);}_0x5673c[_0xaa41('0x43')]=qs['sort'](_0x53a2e4[_0xaa41('0x3d')]['sort']);_0x5673c['where']=qs[_0xaa41('0x44')](_['pick'](_0x53a2e4['query'],_0x951e52['filters']),_0xba115a);if(_0x53a2e4[_0xaa41('0x3d')]['filter']){_0x5673c[_0xaa41('0x45')]=_[_0xaa41('0x46')](_0x5673c['where'],{'$or':_['map'](_0xba115a,function(_0xe58f5e){if(_0xe58f5e[_0xaa41('0x3b')]!==_0xaa41('0x47')){var _0x2af8ba={};_0x2af8ba[_0xe58f5e[_0xaa41('0x36')]]={'$like':'%'+_0x53a2e4[_0xaa41('0x3d')][_0xaa41('0x48')]+'%'};return _0x2af8ba;}})});}_0x5673c=_[_0xaa41('0x46')]({},_0x5673c,_0x53a2e4[_0xaa41('0x49')]);var _0x4e1ac4={'where':_0x5673c[_0xaa41('0x45')]};return db[_0xaa41('0x39')][_0xaa41('0x2e')](_0x4e1ac4)[_0xaa41('0x1c')](function(_0x206d86){_0x4e8d2e[_0xaa41('0x2e')]=_0x206d86;if(_0x53a2e4['query'][_0xaa41('0x4a')]){_0x5673c[_0xaa41('0x4b')]=[{'all':!![]}];}return db[_0xaa41('0x39')][_0xaa41('0x4c')](_0x5673c);})['then'](function(_0x23bc61){_0x4e8d2e['rows']=_0x23bc61;return _0x4e8d2e;})['then'](respondWithFilteredResult(_0x267999,_0x5673c))[_0xaa41('0x27')](handleError(_0x267999,null));};exports[_0xaa41('0x4d')]=function(_0x3e16ef,_0x4ca114){var _0xb4773b={'raw':![],'where':{'id':_0x3e16ef[_0xaa41('0x4e')]['id']}},_0x3e1a73={};_0x3e1a73['model']=_[_0xaa41('0x4f')](db[_0xaa41('0x39')][_0xaa41('0x50')]);_0x3e1a73[_0xaa41('0x3d')]=_[_0xaa41('0x4f')](_0x3e16ef[_0xaa41('0x3d')]);_0x3e1a73[_0xaa41('0x44')]=_[_0xaa41('0x3e')](_0x3e1a73['model'],_0x3e1a73[_0xaa41('0x3d')]);_0xb4773b['attributes']=_['intersection'](_0x3e1a73[_0xaa41('0x3f')],qs[_0xaa41('0x41')](_0x3e16ef[_0xaa41('0x3d')][_0xaa41('0x41')]));_0xb4773b[_0xaa41('0x40')]=_0xb4773b[_0xaa41('0x40')][_0xaa41('0x42')]?_0xb4773b[_0xaa41('0x40')]:_0x3e1a73['model'];if(_0x3e16ef[_0xaa41('0x3d')][_0xaa41('0x4a')]){_0xb4773b[_0xaa41('0x4b')]=[{'all':!![]}];}_0xb4773b=_['merge']({},_0xb4773b,_0x3e16ef[_0xaa41('0x49')]);return db[_0xaa41('0x39')]['find'](_0xb4773b)[_0xaa41('0x1c')](handleEntityNotFound(_0x4ca114,null))[_0xaa41('0x1c')](respondWithResult(_0x4ca114,null))[_0xaa41('0x27')](handleError(_0x4ca114,null));};exports['clone']=function(_0x2cf32c,_0xc8e626){var _0x4e3b13={'where':{'id':_0x2cf32c[_0xaa41('0x4e')]['id']}},_0x49789a={};_0x49789a[_0xaa41('0x3f')]=_[_0xaa41('0x4f')](db['Trunk'][_0xaa41('0x50')]);_0x4e3b13[_0xaa41('0x40')]=_[_0xaa41('0x3e')](_0x49789a[_0xaa41('0x3f')],qs[_0xaa41('0x41')](_0x2cf32c['query'][_0xaa41('0x41')]));_0x4e3b13['attributes']=_0x4e3b13['attributes'][_0xaa41('0x42')]?_0x4e3b13['attributes']:_0x49789a[_0xaa41('0x3f')];if(_0x2cf32c[_0xaa41('0x3d')][_0xaa41('0x4a')]){_0x4e3b13['include']=[{'all':!![]}];}_0x4e3b13=_[_0xaa41('0x46')]({},_0x4e3b13,_0x2cf32c[_0xaa41('0x49')]);return db[_0xaa41('0x39')][_0xaa41('0x51')](_0x4e3b13)[_0xaa41('0x1c')](handleEntityNotFound(_0xc8e626,null))[_0xaa41('0x1c')](function(_0xc56018){if(_0xc56018){var _0x337059=_0xc56018[_0xaa41('0x33')]({'plain':!![]});_0x337059=qs['omit'](_0x337059,['id',_0xaa41('0x52'),_0xaa41('0x53')]);_0x2cf32c[_0xaa41('0x54')]=_['omit'](_0x2cf32c[_0xaa41('0x54')],['id',_0xaa41('0x52'),_0xaa41('0x53')]);return db[_0xaa41('0x39')][_0xaa41('0x55')](_[_0xaa41('0x46')](_0x337059,_0x2cf32c[_0xaa41('0x54')]),{'include':_0x2cf32c['query']['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x540325){var _0x4ec357=_0x2cf32c['user'][_0xaa41('0x33')]({'plain':!![]});if(!_0x4ec357)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4ec357['role']===_0xaa41('0x56')){var _0x40a524=_0x540325[_0xaa41('0x33')]({'plain':!![]});var _0x312eee='Trunks';return db[_0xaa41('0x57')][_0xaa41('0x51')]({'where':{'name':_0x312eee,'userProfileId':_0x4ec357[_0xaa41('0x58')]},'raw':!![]})[_0xaa41('0x1c')](function(_0xa71432){if(_0xa71432&&_0xa71432[_0xaa41('0x59')]===0x0){return db[_0xaa41('0x34')][_0xaa41('0x55')]({'name':_0x40a524[_0xaa41('0x36')],'resourceId':_0x40a524['id'],'type':_0xa71432['name'],'sectionId':_0xa71432['id']},{})[_0xaa41('0x1c')](function(){return _0x540325;});}else{return _0x540325;}})[_0xaa41('0x27')](function(_0x50170f){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x50170f);throw _0x50170f;});}return _0x540325;});}})[_0xaa41('0x1c')](respondWithResult(_0xc8e626,0xc9))['catch'](handleError(_0xc8e626,null));};exports[_0xaa41('0x55')]=function(_0x5c8028,_0x5423b6,_0x18d18b){var _0x4b1ec4;return db[_0xaa41('0x39')][_0xaa41('0x55')](_0x5c8028[_0xaa41('0x54')],{'raw':!![]})[_0xaa41('0x1c')](function(_0x5a2683){_0x4b1ec4=_0x5a2683;return db['Trunk'][_0xaa41('0x4c')]({'raw':!![]});})[_0xaa41('0x1c')](function(_0x4d6d0c){var _0x5954ba=fs[_0xaa41('0x5a')](path[_0xaa41('0x5b')](config[_0xaa41('0x5c')],_0xaa41('0x5d')),_0xaa41('0x5e'));var _0x5a385e=fs[_0xaa41('0x5a')](path['join'](config['root'],'server/files/templates/registry.ejs'),_0xaa41('0x5e'));var _0x19ec63=ejs[_0xaa41('0x5f')](_0x5954ba,{'trunks':_0x4d6d0c||[]});fs['writeFileSync'](_0xaa41('0x60'),_0x19ec63);if(_0x4b1ec4[_0xaa41('0x61')]){var _0x19ed68=ejs[_0xaa41('0x5f')](_0x5a385e,{'trunks':_0x4d6d0c||[]});fs[_0xaa41('0x62')](_0xaa41('0x63'),_0x19ed68);}})[_0xaa41('0x1c')](function(){return respondWithRpcPromise('Reload',_0xaa41('0x55'),{'module':_0xaa41('0x64')});})[_0xaa41('0x1c')](function(){var _0x175ca9=_0x5c8028['user'][_0xaa41('0x33')]({'plain':!![]});if(!_0x175ca9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x175ca9[_0xaa41('0x65')]===_0xaa41('0x56')){var _0x2b9e68=_0x4b1ec4[_0xaa41('0x33')]({'plain':!![]});return db['UserProfileSection'][_0xaa41('0x51')]({'where':{'name':_0xaa41('0x66'),'userProfileId':_0x175ca9[_0xaa41('0x58')]},'raw':!![]})[_0xaa41('0x1c')](function(_0x59052d){if(_0x59052d&&_0x59052d[_0xaa41('0x59')]===0x0){return db['UserProfileResource'][_0xaa41('0x55')]({'name':_0x2b9e68[_0xaa41('0x36')],'resourceId':_0x2b9e68['id'],'type':_0x59052d['name'],'sectionId':_0x59052d['id']},{})[_0xaa41('0x1c')](function(){return _0x4b1ec4;});}else{return _0x4b1ec4;}})[_0xaa41('0x27')](function(_0x2ba160){logger[_0xaa41('0x23')](_0xaa41('0x67'),_0x2ba160);throw _0x2ba160;});}return _0x4b1ec4;})[_0xaa41('0x1c')](respondWithResult(_0x5423b6,0xc9))[_0xaa41('0x27')](handleError(_0x5423b6,null));};exports[_0xaa41('0x31')]=function(_0x33b5f4,_0x3d4f1e,_0x25a064){var _0x59a30b;return db[_0xaa41('0x39')][_0xaa41('0x51')]({'where':{'id':_0x33b5f4[_0xaa41('0x4e')]['id']}})['then'](handleEntityNotFound(_0x3d4f1e,null))['then'](saveUpdates(_0x33b5f4[_0xaa41('0x54')],null))[_0xaa41('0x1c')](function(_0x59fd6a){if(_0x59fd6a){_0x59a30b=_0x59fd6a;return db[_0xaa41('0x39')][_0xaa41('0x4c')]({'raw':!![]});}})['then'](function(_0x305050){if(_0x305050){var _0x3dd47e=fs[_0xaa41('0x5a')](path[_0xaa41('0x5b')](config[_0xaa41('0x5c')],_0xaa41('0x5d')),_0xaa41('0x5e'));var _0x1472be=fs['readFileSync'](path['join'](config[_0xaa41('0x5c')],'server/files/templates/registry.ejs'),_0xaa41('0x5e'));var _0x44154f=ejs[_0xaa41('0x5f')](_0x3dd47e,{'trunks':_0x305050||[]});fs['writeFileSync'](_0xaa41('0x60'),_0x44154f);var _0x404c38=ejs[_0xaa41('0x5f')](_0x1472be,{'trunks':_0x305050||[]});fs['writeFileSync'](_0xaa41('0x63'),_0x404c38);return respondWithRpcPromise(_0xaa41('0x68'),'update',{'module':_0xaa41('0x64')});}return null;})['then'](function(_0x53faf4){if(_0x53faf4){return _0x59a30b;}})[_0xaa41('0x1c')](respondWithResult(_0x3d4f1e,null))[_0xaa41('0x27')](handleError(_0x3d4f1e,null));};exports['destroy']=function(_0x5a8cb0,_0x241e1a,_0x1726ec){var _0x3c189d;return db[_0xaa41('0x39')]['find']({'where':{'id':_0x5a8cb0[_0xaa41('0x4e')]['id']}})[_0xaa41('0x1c')](handleEntityNotFound(_0x241e1a,null))[_0xaa41('0x1c')](removeEntity(_0x241e1a,null))['then'](function(){return db[_0xaa41('0x39')][_0xaa41('0x4c')]({'raw':!![]});})[_0xaa41('0x1c')](function(_0x5697b6){var _0x183b36=fs['readFileSync'](path['join'](config[_0xaa41('0x5c')],_0xaa41('0x5d')),'utf8');var _0x399fbd=fs[_0xaa41('0x5a')](path[_0xaa41('0x5b')](config['root'],_0xaa41('0x69')),_0xaa41('0x5e'));var _0x1a2deb=ejs[_0xaa41('0x5f')](_0x183b36,{'trunks':_0x5697b6});var _0x38f5d0=ejs['render'](_0x399fbd,{'trunks':_0x5697b6});fs[_0xaa41('0x62')]('/etc/asterisk/sip_xcally_trunks.conf',_0x1a2deb);fs[_0xaa41('0x62')](_0xaa41('0x63'),_0x38f5d0);return respondWithRpcPromise(_0xaa41('0x68'),_0xaa41('0x32'),{'module':_0xaa41('0x64')});})[_0xaa41('0x27')](handleError(_0x241e1a,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index df17255..195f8bd 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 _0xb247=['exports','define','Trunk','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./trunk.attributes'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xb247,0x1cb));var _0x7b24=function(_0x469ac7,_0x38e416){_0x469ac7=_0x469ac7-0x0;var _0x22f3b0=_0xb247[_0x469ac7];return _0x22f3b0;};'use strict';var _=require(_0x7b24('0x0'));var util=require(_0x7b24('0x1'));var logger=require(_0x7b24('0x2'))(_0x7b24('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x7b24('0x4'));var fs=require('fs');var path=require(_0x7b24('0x5'));var rimraf=require(_0x7b24('0x6'));var config=require(_0x7b24('0x7'));var attributes=require(_0x7b24('0x8'));module[_0x7b24('0x9')]=function(_0x17c892,_0x3dd321){return _0x17c892[_0x7b24('0xa')](_0x7b24('0xb'),attributes,{'tableName':'tools_trunks','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x78b5=['../../config/environment','./trunk.attributes','exports','define','Trunk','tools_trunks','lodash','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x15c9b2,_0x45a28d){var _0x237154=function(_0x45ac0b){while(--_0x45ac0b){_0x15c9b2['push'](_0x15c9b2['shift']());}};_0x237154(++_0x45a28d);}(_0x78b5,0xf4));var _0x578b=function(_0x1d4946,_0x33ce4e){_0x1d4946=_0x1d4946-0x0;var _0xe0d9ba=_0x78b5[_0x1d4946];return _0xe0d9ba;};'use strict';var _=require(_0x578b('0x0'));var util=require(_0x578b('0x1'));var logger=require('../../config/logger')(_0x578b('0x2'));var moment=require(_0x578b('0x3'));var BPromise=require(_0x578b('0x4'));var rp=require(_0x578b('0x5'));var fs=require('fs');var path=require(_0x578b('0x6'));var rimraf=require(_0x578b('0x7'));var config=require(_0x578b('0x8'));var attributes=require(_0x578b('0x9'));module[_0x578b('0xa')]=function(_0x4cf4a2,_0x241280){return _0x4cf4a2[_0x578b('0xb')](_0x578b('0xc'),attributes,{'tableName':_0x578b('0xd'),'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 d27a9a5..9f76e79 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 _0x5e7f=['then','request\x20sent','debug','stringify','error','code','Trunk,\x20%s,\x20%s','message','info','result','catch','GetTrunk','Trunk','findAll','options','raw','attributes','limit','include','map','model','ShowTrunk','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0x5e7f,0x11a));var _0xf5e7=function(_0x1e9552,_0x5a4e94){_0x1e9552=_0x1e9552-0x0;var _0x36db8b=_0x5e7f[_0x1e9552];return _0x36db8b;};'use strict';var _=require(_0xf5e7('0x0'));var util=require(_0xf5e7('0x1'));var moment=require(_0xf5e7('0x2'));var BPromise=require(_0xf5e7('0x3'));var rs=require(_0xf5e7('0x4'));var fs=require('fs');var Redis=require(_0xf5e7('0x5'));var db=require(_0xf5e7('0x6'))['db'];var utils=require(_0xf5e7('0x7'));var logger=require(_0xf5e7('0x8'))(_0xf5e7('0x9'));var config=require(_0xf5e7('0xa'));var jayson=require(_0xf5e7('0xb'));var client=jayson[_0xf5e7('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x52eddd,_0x2556dc,_0x1f589d){return new BPromise(function(_0x1df46a,_0x513bb6){return client[_0xf5e7('0xd')](_0x52eddd,_0x1f589d)[_0xf5e7('0xe')](function(_0x361c79){logger['info']('Trunk,\x20%s,\x20%s',_0x2556dc,_0xf5e7('0xf'));logger[_0xf5e7('0x10')]('Trunk,\x20%s,\x20%s,\x20%s',_0x2556dc,_0xf5e7('0xf'),JSON[_0xf5e7('0x11')](_0x361c79));if(_0x361c79[_0xf5e7('0x12')]){if(_0x361c79[_0xf5e7('0x12')][_0xf5e7('0x13')]===0x1f4){logger[_0xf5e7('0x12')](_0xf5e7('0x14'),_0x2556dc,_0x361c79[_0xf5e7('0x12')][_0xf5e7('0x15')]);return _0x513bb6(_0x361c79[_0xf5e7('0x12')]['message']);}logger['error'](_0xf5e7('0x14'),_0x2556dc,_0x361c79[_0xf5e7('0x12')][_0xf5e7('0x15')]);return _0x1df46a(_0x361c79[_0xf5e7('0x12')]['message']);}else{logger[_0xf5e7('0x16')](_0xf5e7('0x14'),_0x2556dc,'request\x20sent');_0x1df46a(_0x361c79[_0xf5e7('0x17')][_0xf5e7('0x15')]);}})[_0xf5e7('0x18')](function(_0x339dd1){logger['error'](_0xf5e7('0x14'),_0x2556dc,_0x339dd1);_0x513bb6(_0x339dd1);});});}exports[_0xf5e7('0x19')]=function(_0x3556a6){var _0x15a4a6=this;return new Promise(function(_0x25652c,_0x3cdb1a){return db[_0xf5e7('0x1a')][_0xf5e7('0x1b')]({'raw':_0x3556a6[_0xf5e7('0x1c')]?_0x3556a6[_0xf5e7('0x1c')][_0xf5e7('0x1d')]===undefined?!![]:![]:!![],'where':_0x3556a6[_0xf5e7('0x1c')]?_0x3556a6[_0xf5e7('0x1c')]['where']||null:null,'attributes':_0x3556a6[_0xf5e7('0x1c')]?_0x3556a6['options'][_0xf5e7('0x1e')]||null:null,'limit':_0x3556a6['options']?_0x3556a6[_0xf5e7('0x1c')][_0xf5e7('0x1f')]||null:null,'include':_0x3556a6[_0xf5e7('0x1c')]?_0x3556a6['options'][_0xf5e7('0x20')]?_[_0xf5e7('0x21')](_0x3556a6['options']['include'],function(_0x11acfc){return{'model':db[_0x11acfc[_0xf5e7('0x22')]],'as':_0x11acfc['as'],'attributes':_0x11acfc[_0xf5e7('0x1e')],'include':_0x11acfc[_0xf5e7('0x20')]?_['map'](_0x11acfc[_0xf5e7('0x20')],function(_0x5acde8){return{'model':db[_0x5acde8['model']],'as':_0x5acde8['as'],'attributes':_0x5acde8[_0xf5e7('0x1e')],'include':_0x5acde8['include']?_['map'](_0x5acde8[_0xf5e7('0x20')],function(_0x5d4531){return{'model':db[_0x5d4531[_0xf5e7('0x22')]],'as':_0x5d4531['as'],'attributes':_0x5d4531['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x11a38b){logger[_0xf5e7('0x16')]('GetTrunk',_0x3556a6);logger[_0xf5e7('0x10')](_0xf5e7('0x19'),_0x3556a6,JSON['stringify'](_0x11a38b));_0x25652c(_0x11a38b);})[_0xf5e7('0x18')](function(_0x46395c){logger['error']('GetTrunk',_0x46395c['message'],_0x3556a6);_0x3cdb1a(_0x15a4a6[_0xf5e7('0x12')](0x1f4,_0x46395c['message']));});});};exports[_0xf5e7('0x23')]=function(_0xd73ffa){var _0x3ded0d=this;return new Promise(function(_0x534cb4,_0x2279a2){return db[_0xf5e7('0x1a')]['find']({'raw':_0xd73ffa[_0xf5e7('0x1c')]?_0xd73ffa[_0xf5e7('0x1c')][_0xf5e7('0x1d')]===undefined?!![]:![]:!![],'where':_0xd73ffa['options']?_0xd73ffa['options'][_0xf5e7('0x24')]||null:null,'attributes':_0xd73ffa[_0xf5e7('0x1c')]?_0xd73ffa[_0xf5e7('0x1c')][_0xf5e7('0x1e')]||null:null,'include':_0xd73ffa['options']?_0xd73ffa[_0xf5e7('0x1c')][_0xf5e7('0x20')]?_[_0xf5e7('0x21')](_0xd73ffa[_0xf5e7('0x1c')][_0xf5e7('0x20')],function(_0x534da7){return{'model':db[_0x534da7[_0xf5e7('0x22')]],'as':_0x534da7['as'],'attributes':_0x534da7[_0xf5e7('0x1e')],'include':_0x534da7[_0xf5e7('0x20')]?_['map'](_0x534da7[_0xf5e7('0x20')],function(_0x38629d){return{'model':db[_0x38629d[_0xf5e7('0x22')]],'as':_0x38629d['as'],'attributes':_0x38629d[_0xf5e7('0x1e')],'include':_0x38629d['include']?_['map'](_0x38629d[_0xf5e7('0x20')],function(_0x217ea5){return{'model':db[_0x217ea5[_0xf5e7('0x22')]],'as':_0x217ea5['as'],'attributes':_0x217ea5['attributes']};}):[]};}):[]};}):[]:[]})[_0xf5e7('0xe')](function(_0xd302a0){logger[_0xf5e7('0x16')]('ShowTrunk',_0xd73ffa);logger[_0xf5e7('0x10')](_0xf5e7('0x23'),_0xd73ffa,JSON[_0xf5e7('0x11')](_0xd302a0));_0x534cb4(_0xd302a0);})['catch'](function(_0x2d8410){logger[_0xf5e7('0x12')]('ShowTrunk',_0x2d8410[_0xf5e7('0x15')],_0xd73ffa);_0x2279a2(_0x3ded0d[_0xf5e7('0x12')](0x1f4,_0x2d8410[_0xf5e7('0x15')]));});});}; \ No newline at end of file +var _0x322f=['request','info','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','Trunk,\x20%s,\x20%s','message','catch','Trunk','findAll','options','raw','where','attributes','limit','include','model','map','then','GetTrunk','ShowTrunk','find','lodash','util','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x322f,0x1bd));var _0xf322=function(_0x323f99,_0x906add){_0x323f99=_0x323f99-0x0;var _0x35eb59=_0x322f[_0x323f99];return _0x35eb59;};'use strict';var _=require(_0xf322('0x0'));var util=require(_0xf322('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf322('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xf322('0x3'));var logger=require(_0xf322('0x4'))(_0xf322('0x5'));var config=require(_0xf322('0x6'));var jayson=require(_0xf322('0x7'));var client=jayson[_0xf322('0x8')][_0xf322('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x31a86e,_0xefc004,_0x511723){return new BPromise(function(_0xbcdf7b,_0x5460db){return client[_0xf322('0xa')](_0x31a86e,_0x511723)['then'](function(_0x505a23){logger[_0xf322('0xb')]('Trunk,\x20%s,\x20%s',_0xefc004,_0xf322('0xc'));logger[_0xf322('0xd')](_0xf322('0xe'),_0xefc004,_0xf322('0xc'),JSON[_0xf322('0xf')](_0x505a23));if(_0x505a23[_0xf322('0x10')]){if(_0x505a23[_0xf322('0x10')][_0xf322('0x11')]===0x1f4){logger[_0xf322('0x10')](_0xf322('0x12'),_0xefc004,_0x505a23[_0xf322('0x10')][_0xf322('0x13')]);return _0x5460db(_0x505a23[_0xf322('0x10')][_0xf322('0x13')]);}logger['error'](_0xf322('0x12'),_0xefc004,_0x505a23[_0xf322('0x10')]['message']);return _0xbcdf7b(_0x505a23[_0xf322('0x10')][_0xf322('0x13')]);}else{logger[_0xf322('0xb')](_0xf322('0x12'),_0xefc004,_0xf322('0xc'));_0xbcdf7b(_0x505a23['result'][_0xf322('0x13')]);}})[_0xf322('0x14')](function(_0x56253f){logger[_0xf322('0x10')](_0xf322('0x12'),_0xefc004,_0x56253f);_0x5460db(_0x56253f);});});}exports['GetTrunk']=function(_0x5800ff){var _0x37b853=this;return new Promise(function(_0x5e738a,_0x58b863){return db[_0xf322('0x15')][_0xf322('0x16')]({'raw':_0x5800ff[_0xf322('0x17')]?_0x5800ff[_0xf322('0x17')][_0xf322('0x18')]===undefined?!![]:![]:!![],'where':_0x5800ff['options']?_0x5800ff['options'][_0xf322('0x19')]||null:null,'attributes':_0x5800ff[_0xf322('0x17')]?_0x5800ff[_0xf322('0x17')][_0xf322('0x1a')]||null:null,'limit':_0x5800ff[_0xf322('0x17')]?_0x5800ff[_0xf322('0x17')][_0xf322('0x1b')]||null:null,'include':_0x5800ff[_0xf322('0x17')]?_0x5800ff[_0xf322('0x17')][_0xf322('0x1c')]?_['map'](_0x5800ff[_0xf322('0x17')][_0xf322('0x1c')],function(_0x3cd5bc){return{'model':db[_0x3cd5bc[_0xf322('0x1d')]],'as':_0x3cd5bc['as'],'attributes':_0x3cd5bc[_0xf322('0x1a')],'include':_0x3cd5bc[_0xf322('0x1c')]?_[_0xf322('0x1e')](_0x3cd5bc['include'],function(_0x1f9441){return{'model':db[_0x1f9441[_0xf322('0x1d')]],'as':_0x1f9441['as'],'attributes':_0x1f9441[_0xf322('0x1a')],'include':_0x1f9441[_0xf322('0x1c')]?_[_0xf322('0x1e')](_0x1f9441[_0xf322('0x1c')],function(_0x1cfc1e){return{'model':db[_0x1cfc1e[_0xf322('0x1d')]],'as':_0x1cfc1e['as'],'attributes':_0x1cfc1e[_0xf322('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xf322('0x1f')](function(_0x476709){logger[_0xf322('0xb')](_0xf322('0x20'),_0x5800ff);logger[_0xf322('0xd')]('GetTrunk',_0x5800ff,JSON[_0xf322('0xf')](_0x476709));_0x5e738a(_0x476709);})[_0xf322('0x14')](function(_0x6c3052){logger[_0xf322('0x10')](_0xf322('0x20'),_0x6c3052['message'],_0x5800ff);_0x58b863(_0x37b853[_0xf322('0x10')](0x1f4,_0x6c3052[_0xf322('0x13')]));});});};exports[_0xf322('0x21')]=function(_0x57db17){var _0xcffdd0=this;return new Promise(function(_0x3e08c8,_0x414e64){return db['Trunk'][_0xf322('0x22')]({'raw':_0x57db17[_0xf322('0x17')]?_0x57db17[_0xf322('0x17')][_0xf322('0x18')]===undefined?!![]:![]:!![],'where':_0x57db17['options']?_0x57db17['options'][_0xf322('0x19')]||null:null,'attributes':_0x57db17['options']?_0x57db17['options'][_0xf322('0x1a')]||null:null,'include':_0x57db17[_0xf322('0x17')]?_0x57db17[_0xf322('0x17')][_0xf322('0x1c')]?_[_0xf322('0x1e')](_0x57db17[_0xf322('0x17')]['include'],function(_0x5caf58){return{'model':db[_0x5caf58[_0xf322('0x1d')]],'as':_0x5caf58['as'],'attributes':_0x5caf58['attributes'],'include':_0x5caf58[_0xf322('0x1c')]?_['map'](_0x5caf58[_0xf322('0x1c')],function(_0x3fd76e){return{'model':db[_0x3fd76e[_0xf322('0x1d')]],'as':_0x3fd76e['as'],'attributes':_0x3fd76e[_0xf322('0x1a')],'include':_0x3fd76e[_0xf322('0x1c')]?_['map'](_0x3fd76e['include'],function(_0x1ce88c){return{'model':db[_0x1ce88c[_0xf322('0x1d')]],'as':_0x1ce88c['as'],'attributes':_0x1ce88c[_0xf322('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xf322('0x1f')](function(_0x3969ff){logger[_0xf322('0xb')](_0xf322('0x21'),_0x57db17);logger['debug'](_0xf322('0x21'),_0x57db17,JSON['stringify'](_0x3969ff));_0x3e08c8(_0x3969ff);})['catch'](function(_0x99d40e){logger[_0xf322('0x10')](_0xf322('0x21'),_0x99d40e[_0xf322('0x13')],_0x57db17);_0x414e64(_0xcffdd0[_0xf322('0x10')](0x1f4,_0x99d40e[_0xf322('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index a65bd8d..100e02e 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 _0xe128=['update','exports','express','Router','../../components/auth/service','./user-setting.controller','put','/:id','isAuthenticated'];(function(_0x3e6093,_0x2c0d44){var _0x414fd2=function(_0x325596){while(--_0x325596){_0x3e6093['push'](_0x3e6093['shift']());}};_0x414fd2(++_0x2c0d44);}(_0xe128,0x80));var _0x8e12=function(_0x18ea8a,_0x32f09f){_0x18ea8a=_0x18ea8a-0x0;var _0x19c99a=_0xe128[_0x18ea8a];return _0x19c99a;};'use strict';var express=require(_0x8e12('0x0'));var router=express[_0x8e12('0x1')]();var auth=require(_0x8e12('0x2'));var controller=require(_0x8e12('0x3'));router[_0x8e12('0x4')](_0x8e12('0x5'),auth[_0x8e12('0x6')](),controller[_0x8e12('0x7')]);module[_0x8e12('0x8')]=router; \ No newline at end of file +var _0x71ec=['./user-setting.controller','put','/:id','isAuthenticated','update','exports','../../components/auth/service'];(function(_0x276a84,_0x579fab){var _0x4893c4=function(_0x28eba7){while(--_0x28eba7){_0x276a84['push'](_0x276a84['shift']());}};_0x4893c4(++_0x579fab);}(_0x71ec,0x13a));var _0xc71e=function(_0x3e25ba,_0x4d5399){_0x3e25ba=_0x3e25ba-0x0;var _0x393fb8=_0x71ec[_0x3e25ba];return _0x393fb8;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0xc71e('0x0'));var controller=require(_0xc71e('0x1'));router[_0xc71e('0x2')](_0xc71e('0x3'),auth[_0xc71e('0x4')](),controller[_0xc71e('0x5')]);module[_0xc71e('0x6')]=router; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.attributes.js b/server/api/user-setting/user-setting.attributes.js index 4d066e4..24990e6 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 _0xd52c=['exports','ENUM','TEXT','DATE','INTEGER','UserId','sequelize','error','warning','info','debug'];(function(_0x4327fe,_0x4f8040){var _0x138651=function(_0x418acc){while(--_0x418acc){_0x4327fe['push'](_0x4327fe['shift']());}};_0x138651(++_0x4f8040);}(_0xd52c,0x19d));var _0xcd52=function(_0xf58288,_0x35333c){_0xf58288=_0xf58288-0x0;var _0x196e87=_0xd52c[_0xf58288];return _0x196e87;};'use strict';var Sequelize=require(_0xcd52('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0xcd52('0x1'),_0xcd52('0x2'),_0xcd52('0x3'),_0xcd52('0x4')];module[_0xcd52('0x5')]={'clientSideLoggingLevel':{'type':Sequelize[_0xcd52('0x6')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':'error','validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0xcd52('0x7')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0xcd52('0x8')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0xcd52('0x9')],'unique':_0xcd52('0xa')}}; \ No newline at end of file +var _0x7184=['error','warning','debug','exports','ENUM','BOOLEAN','TEXT','INTEGER','UserId','sequelize'];(function(_0x20c9b2,_0x55d7b1){var _0x2c6030=function(_0x10845f){while(--_0x10845f){_0x20c9b2['push'](_0x20c9b2['shift']());}};_0x2c6030(++_0x55d7b1);}(_0x7184,0x149));var _0x4718=function(_0xaecc27,_0x3b15ab){_0xaecc27=_0xaecc27-0x0;var _0x2203ec=_0x7184[_0xaecc27];return _0x2203ec;};'use strict';var Sequelize=require(_0x4718('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0x4718('0x1'),_0x4718('0x2'),'info',_0x4718('0x3')];module[_0x4718('0x4')]={'clientSideLoggingLevel':{'type':Sequelize[_0x4718('0x5')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x4718('0x1'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0x4718('0x6')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0x4718('0x7')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize['DATE'],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0x4718('0x8')],'unique':_0x4718('0x9')}}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.controller.js b/server/api/user-setting/user-setting.controller.js index 3df87d1..d095104 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 _0xc820=['redis','register','defaults','localhost','status','json','update','then','sendStatus','error','stack','name','send','user','role','admin','Unauthorized','Invalid\x20user\x20setting\x20id','UserSetting','find','body','catch','ioredis','../../config/logger','api','../../config/environment','../../mysqldb'];(function(_0x10d670,_0x178996){var _0x20d6f8=function(_0x4a4b87){while(--_0x4a4b87){_0x10d670['push'](_0x10d670['shift']());}};_0x20d6f8(++_0x178996);}(_0xc820,0x13f));var _0x0c82=function(_0x17a8cf,_0x14a102){_0x17a8cf=_0x17a8cf-0x0;var _0x28ca77=_0xc820[_0x17a8cf];return _0x28ca77;};'use strict';var _=require('lodash');var Redis=require(_0x0c82('0x0'));var logger=require(_0x0c82('0x1'))(_0x0c82('0x2'));var config=require(_0x0c82('0x3'));var db=require(_0x0c82('0x4'))['db'];var socket=require('socket.io-emitter')(new Redis(config[_0x0c82('0x5')]));require('./user-setting.socket')[_0x0c82('0x6')](socket);config[_0x0c82('0x5')]=_[_0x0c82('0x7')](config[_0x0c82('0x5')],{'host':_0x0c82('0x8'),'port':0x18eb});function respondWithResult(_0x23f783,_0x2d2567){_0x2d2567=_0x2d2567||0xc8;return function(_0x32e9ee){if(_0x32e9ee){return _0x23f783[_0x0c82('0x9')](_0x2d2567)[_0x0c82('0xa')](_0x32e9ee);}};}function saveUpdates(_0x72116){return function(_0x4773de){if(_0x4773de){return _0x4773de[_0x0c82('0xb')](_0x72116)[_0x0c82('0xc')](function(_0x4d14b1){return _0x4d14b1;});}return null;};}function handleEntityNotFound(_0x8c568){return function(_0xc0790d){if(!_0xc0790d){_0x8c568[_0x0c82('0xd')](0x194);}return _0xc0790d;};}function handleError(_0x1d2373,_0xbe6336){_0xbe6336=_0xbe6336||0x1f4;return function(_0xc9ad4f){logger[_0x0c82('0xe')](_0xc9ad4f[_0x0c82('0xf')]);if(_0xc9ad4f[_0x0c82('0x10')]){delete _0xc9ad4f[_0x0c82('0x10')];}_0x1d2373['status'](_0xbe6336)[_0x0c82('0x11')](_0xc9ad4f);};}exports['update']=function(_0x548cf5,_0x2098ae){if(_0x548cf5[_0x0c82('0x12')][_0x0c82('0x13')]!==_0x0c82('0x14'))throw new Error(_0x0c82('0x15'));if(isNaN(Number(_0x548cf5['params']['id'])))throw new Error(_0x0c82('0x16'));return db[_0x0c82('0x17')][_0x0c82('0x18')]({'where':{'id':_0x548cf5['params']['id']}})[_0x0c82('0xc')](handleEntityNotFound(_0x2098ae,null))['then'](saveUpdates(_0x548cf5[_0x0c82('0x19')],null))[_0x0c82('0xc')](respondWithResult(_0x2098ae,null))[_0x0c82('0x1a')](handleError(_0x2098ae,null));}; \ No newline at end of file +var _0x39a9=['json','update','then','sendStatus','error','stack','send','user','role','admin','Unauthorized','params','Invalid\x20user\x20setting\x20id','find','body','catch','lodash','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','socket.io-emitter','redis','./user-setting.socket','register','localhost','status'];(function(_0x5b36bd,_0x4dfb36){var _0x1614fe=function(_0x559b7c){while(--_0x559b7c){_0x5b36bd['push'](_0x5b36bd['shift']());}};_0x1614fe(++_0x4dfb36);}(_0x39a9,0x1d0));var _0x939a=function(_0x525af9,_0x4edd23){_0x525af9=_0x525af9-0x0;var _0x129fbf=_0x39a9[_0x525af9];return _0x129fbf;};'use strict';var _=require(_0x939a('0x0'));var Redis=require(_0x939a('0x1'));var logger=require(_0x939a('0x2'))(_0x939a('0x3'));var config=require(_0x939a('0x4'));var db=require(_0x939a('0x5'))['db'];var socket=require(_0x939a('0x6'))(new Redis(config[_0x939a('0x7')]));require(_0x939a('0x8'))[_0x939a('0x9')](socket);config[_0x939a('0x7')]=_['defaults'](config[_0x939a('0x7')],{'host':_0x939a('0xa'),'port':0x18eb});function respondWithResult(_0x12cd66,_0x1c97c1){_0x1c97c1=_0x1c97c1||0xc8;return function(_0x3bed20){if(_0x3bed20){return _0x12cd66[_0x939a('0xb')](_0x1c97c1)[_0x939a('0xc')](_0x3bed20);}};}function saveUpdates(_0x7a6c61){return function(_0x529156){if(_0x529156){return _0x529156[_0x939a('0xd')](_0x7a6c61)[_0x939a('0xe')](function(_0x27fc39){return _0x27fc39;});}return null;};}function handleEntityNotFound(_0x5e81d6){return function(_0x11d9db){if(!_0x11d9db){_0x5e81d6[_0x939a('0xf')](0x194);}return _0x11d9db;};}function handleError(_0x2f8636,_0x5a84d8){_0x5a84d8=_0x5a84d8||0x1f4;return function(_0x3032c4){logger[_0x939a('0x10')](_0x3032c4[_0x939a('0x11')]);if(_0x3032c4['name']){delete _0x3032c4['name'];}_0x2f8636[_0x939a('0xb')](_0x5a84d8)[_0x939a('0x12')](_0x3032c4);};}exports[_0x939a('0xd')]=function(_0x5e22be,_0x3dbc7f){if(_0x5e22be[_0x939a('0x13')][_0x939a('0x14')]!==_0x939a('0x15'))throw new Error(_0x939a('0x16'));if(isNaN(Number(_0x5e22be[_0x939a('0x17')]['id'])))throw new Error(_0x939a('0x18'));return db['UserSetting'][_0x939a('0x19')]({'where':{'id':_0x5e22be['params']['id']}})[_0x939a('0xe')](handleEntityNotFound(_0x3dbc7f,null))['then'](saveUpdates(_0x5e22be[_0x939a('0x1a')],null))[_0x939a('0xe')](respondWithResult(_0x3dbc7f,null))[_0x939a('0x1b')](handleError(_0x3dbc7f,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 ef9b053..7d6ebbe 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 _0xa1df=['events','UserSetting','save','update','emit','hasOwnProperty','hook','exports'];(function(_0x484fdc,_0x53715a){var _0xcbdb51=function(_0x1f6801){while(--_0x1f6801){_0x484fdc['push'](_0x484fdc['shift']());}};_0xcbdb51(++_0x53715a);}(_0xa1df,0xf8));var _0xfa1d=function(_0x399067,_0x5f3c08){_0x399067=_0x399067-0x0;var _0x239894=_0xa1df[_0x399067];return _0x239894;};'use strict';var EventEmitter=require(_0xfa1d('0x0'));var UserSetting=require('../../mysqldb')['db'][_0xfa1d('0x1')];var UserSettingEvents=new EventEmitter();UserSettingEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xfa1d('0x2'),'afterUpdate':_0xfa1d('0x3'),'afterDestroy':'remove'};function emitEvent(_0x1dfc9e){return function(_0xb1062b,_0x2a6462,_0x22475c){UserSettingEvents[_0xfa1d('0x4')](_0x1dfc9e+':'+_0xb1062b['id'],_0xb1062b);UserSettingEvents[_0xfa1d('0x4')](_0x1dfc9e,_0xb1062b);_0x22475c(null);};}for(var e in events){if(events[_0xfa1d('0x5')](e)){var event=events[e];UserSetting[_0xfa1d('0x6')](e,emitEvent(event));}}module[_0xfa1d('0x7')]=UserSettingEvents; \ No newline at end of file +var _0x4285=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','UserSetting'];(function(_0x9e6439,_0x1686bb){var _0x58fb8f=function(_0x5aaf02){while(--_0x5aaf02){_0x9e6439['push'](_0x9e6439['shift']());}};_0x58fb8f(++_0x1686bb);}(_0x4285,0xb8));var _0x5428=function(_0x59b330,_0x2802d3){_0x59b330=_0x59b330-0x0;var _0x579775=_0x4285[_0x59b330];return _0x579775;};'use strict';var EventEmitter=require(_0x5428('0x0'));var UserSetting=require(_0x5428('0x1'))['db'][_0x5428('0x2')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x5428('0x3')](0x0);var events={'afterCreate':_0x5428('0x4'),'afterUpdate':_0x5428('0x5'),'afterDestroy':_0x5428('0x6')};function emitEvent(_0x445e43){return function(_0x4a4a99,_0x24a0d4,_0x240c72){UserSettingEvents[_0x5428('0x7')](_0x445e43+':'+_0x4a4a99['id'],_0x4a4a99);UserSettingEvents[_0x5428('0x7')](_0x445e43,_0x4a4a99);_0x240c72(null);};}for(var e in events){if(events[_0x5428('0x8')](e)){var event=events[e];UserSetting[_0x5428('0x9')](e,emitEvent(event));}}module[_0x5428('0xa')]=UserSettingEvents; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.model.js b/server/api/user-setting/user-setting.model.js index 8c032df..4ce02db 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 _0x536f=['./user-setting.attributes','user_settings','clientSideLoggingEnabled','clientSideLoggingEnabledSince'];(function(_0x4b2c25,_0x184835){var _0x168b99=function(_0x3339d8){while(--_0x3339d8){_0x4b2c25['push'](_0x4b2c25['shift']());}};_0x168b99(++_0x184835);}(_0x536f,0x70));var _0xf536=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x536f[_0x321bb2];return _0x9c12ed;};'use strict';var attributes=require(_0xf536('0x0'));module['exports']=function(_0x4e4212){return _0x4e4212['define']('UserSetting',attributes,{'tableName':_0xf536('0x1'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1e5e49){if(!_0x1e5e49[_0xf536('0x2')])_0x1e5e49[_0xf536('0x3')]=null;else if(_0x1e5e49['clientSideLoggingEnabledSince']===null)_0x1e5e49[_0xf536('0x3')]=new Date();}}});}; \ No newline at end of file +var _0x878f=['define','UserSetting','user_settings','clientSideLoggingEnabled','clientSideLoggingEnabledSince','exports'];(function(_0x9096d,_0x5b12fa){var _0x15ad4e=function(_0x52010c){while(--_0x52010c){_0x9096d['push'](_0x9096d['shift']());}};_0x15ad4e(++_0x5b12fa);}(_0x878f,0x173));var _0xf878=function(_0x3da7b1,_0x263399){_0x3da7b1=_0x3da7b1-0x0;var _0x56474a=_0x878f[_0x3da7b1];return _0x56474a;};'use strict';var attributes=require('./user-setting.attributes');module[_0xf878('0x0')]=function(_0x658976){return _0x658976[_0xf878('0x1')](_0xf878('0x2'),attributes,{'tableName':_0xf878('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3d74cf){if(!_0x3d74cf[_0xf878('0x4')])_0x3d74cf[_0xf878('0x5')]=null;else if(_0x3d74cf[_0xf878('0x5')]===null)_0x3d74cf[_0xf878('0x5')]=new Date();}}});}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.socket.js b/server/api/user-setting/user-setting.socket.js index 32f09d5..785a947 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 _0x64ae=['remove','emit','user-setting:update:user-','UserId','register','length','user-setting:','./user-setting.events'];(function(_0x21d6fa,_0x5e623a){var _0x405b62=function(_0x54f24a){while(--_0x54f24a){_0x21d6fa['push'](_0x21d6fa['shift']());}};_0x405b62(++_0x5e623a);}(_0x64ae,0x10f));var _0xe64a=function(_0x51ea8e,_0x5da983){_0x51ea8e=_0x51ea8e-0x0;var _0x4abe88=_0x64ae[_0x51ea8e];return _0x4abe88;};'use strict';var UserSettingEvents=require(_0xe64a('0x0'));var events=['save',_0xe64a('0x1'),'update'];function createListener(_0x51c29b,_0x3bc041){return function(_0x206af0){_0x3bc041[_0xe64a('0x2')](_0x51c29b,_0x206af0);if(_0x51c29b==='user-setting:update'){_0x3bc041['emit'](_0xe64a('0x3')+_0x206af0[_0xe64a('0x4')],_0x206af0);}};}exports[_0xe64a('0x5')]=function(_0xfdace6){for(var _0x3eac27=0x0,_0x491bf3=events[_0xe64a('0x6')];_0x3eac27<_0x491bf3;_0x3eac27++){var _0x4f10b8=events[_0x3eac27];var _0x26fa5e=createListener(_0xe64a('0x7')+_0x4f10b8,_0xfdace6);UserSettingEvents['on'](_0x4f10b8,_0x26fa5e);}}; \ No newline at end of file +var _0x8f77=['user-setting:','./user-setting.events','save','remove','update','emit','user-setting:update','user-setting:update:user-','UserId','length'];(function(_0x4d2d43,_0x478abf){var _0x56a718=function(_0x46ed3d){while(--_0x46ed3d){_0x4d2d43['push'](_0x4d2d43['shift']());}};_0x56a718(++_0x478abf);}(_0x8f77,0x19b));var _0x78f7=function(_0x55d85b,_0x4a39d0){_0x55d85b=_0x55d85b-0x0;var _0x183bb0=_0x8f77[_0x55d85b];return _0x183bb0;};'use strict';var UserSettingEvents=require(_0x78f7('0x0'));var events=[_0x78f7('0x1'),_0x78f7('0x2'),_0x78f7('0x3')];function createListener(_0x2d2596,_0x4e69db){return function(_0x496bb7){_0x4e69db[_0x78f7('0x4')](_0x2d2596,_0x496bb7);if(_0x2d2596===_0x78f7('0x5')){_0x4e69db[_0x78f7('0x4')](_0x78f7('0x6')+_0x496bb7[_0x78f7('0x7')],_0x496bb7);}};}exports['register']=function(_0xb2f3c8){for(var _0x33e4e4=0x0,_0x383b36=events[_0x78f7('0x8')];_0x33e4e4<_0x383b36;_0x33e4e4++){var _0x5dcd2f=events[_0x33e4e4];var _0x3fb5cf=createListener(_0x78f7('0x9')+_0x5dcd2f,_0xb2f3c8);UserSettingEvents['on'](_0x5dcd2f,_0x3fb5cf);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 2293dce..4e27e82 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 _0x4994=['removeTeams','removeChatInteractions','/:id/mail_interactions','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeOpenchannelAccounts','removeChatWebsites','removeWhatsappAccounts','removeApiKey','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/describe','describe','/whoami','getPresence','/:id','show','/:id/avatar','getAvatar','/:id/open_tabs','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','getGroups','/:id/recordings','getRecordings','getScreenRecordings','/:id/chat/interactions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getFaxInteractions','/:id/whatsapp/interactions','getTeams','/:id/lists','getLists','/:id/agents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/square_projects','getSquareProjects','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','post','/create_many','addQueues','join','server/files/images/','now','originalname','single','file','addAvatar','/:id/login','login','logout','pause','unpause','addTeams','/:id/chat_interactions','addChatInteractions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addFaxAccounts','addOpenchannelAccounts','addSmsAccounts','createApiKey','put','delete','removeQueues','/:id/teams'];(function(_0x1de1d6,_0x23743d){var _0x637b54=function(_0x19b3ea){while(--_0x19b3ea){_0x1de1d6['push'](_0x1de1d6['shift']());}};_0x637b54(++_0x23743d);}(_0x4994,0x1c2));var _0x4499=function(_0x406885,_0x1a8203){_0x406885=_0x406885-0x0;var _0x538659=_0x4994[_0x406885];return _0x538659;};'use strict';var multer=require(_0x4499('0x0'));var util=require(_0x4499('0x1'));var path=require(_0x4499('0x2'));var timeout=require(_0x4499('0x3'));var express=require(_0x4499('0x4'));var router=express[_0x4499('0x5')]();var fs_extra=require(_0x4499('0x6'));var auth=require(_0x4499('0x7'));var interaction=require(_0x4499('0x8'));var config=require('../../config/environment');var controller=require('./user.controller');router[_0x4499('0x9')]('/',auth[_0x4499('0xa')](),controller['index']);router[_0x4499('0x9')](_0x4499('0xb'),auth[_0x4499('0xa')](),controller[_0x4499('0xc')]);router[_0x4499('0x9')](_0x4499('0xd'),auth['isAuthenticated'](),controller['whoami']);router[_0x4499('0x9')]('/presence',auth[_0x4499('0xa')](),controller[_0x4499('0xe')]);router[_0x4499('0x9')](_0x4499('0xf'),auth['isAuthenticated'](),controller[_0x4499('0x10')]);router[_0x4499('0x9')](_0x4499('0x11'),controller[_0x4499('0x12')]);router['get'](_0x4499('0x13'),auth[_0x4499('0xa')](),controller['getOpenTabs']);router[_0x4499('0x9')](_0x4499('0x14'),auth[_0x4499('0xa')](),controller[_0x4499('0x15')]);router['get'](_0x4499('0x16'),auth[_0x4499('0xa')](),controller[_0x4499('0x17')]);router[_0x4499('0x9')](_0x4499('0x18'),auth['isAuthenticated'](),controller['getVoiceQueuesRt']);router[_0x4499('0x9')]('/:id/groups',auth['isAuthenticated'](),controller[_0x4499('0x19')]);router[_0x4499('0x9')](_0x4499('0x1a'),auth['isAuthenticated'](),controller[_0x4499('0x1b')]);router[_0x4499('0x9')]('/:id/screen_recordings',auth['isAuthenticated'](),controller[_0x4499('0x1c')]);router['get'](_0x4499('0x1d'),auth['isAuthenticated'](),controller['getChatInteractions']);router[_0x4499('0x9')](_0x4499('0x1e'),auth['isAuthenticated'](),controller[_0x4499('0x1f')]);router[_0x4499('0x9')](_0x4499('0x20'),auth[_0x4499('0xa')](),controller[_0x4499('0x21')]);router[_0x4499('0x9')](_0x4499('0x22'),auth[_0x4499('0xa')](),controller['getSmsInteractions']);router[_0x4499('0x9')]('/:id/fax/interactions',auth[_0x4499('0xa')](),controller[_0x4499('0x23')]);router[_0x4499('0x9')](_0x4499('0x24'),auth['isAuthenticated'](),controller['getWhatsappInteractions']);router[_0x4499('0x9')]('/:id/teams',auth['isAuthenticated'](),controller[_0x4499('0x25')]);router[_0x4499('0x9')](_0x4499('0x26'),auth['isAuthenticated'](),controller[_0x4499('0x27')]);router[_0x4499('0x9')](_0x4499('0x28'),auth['isAuthenticated'](),controller['getAgents']);router[_0x4499('0x9')](_0x4499('0x29'),auth['isAuthenticated'](),controller[_0x4499('0x2a')]);router[_0x4499('0x9')](_0x4499('0x2b'),auth[_0x4499('0xa')](),controller[_0x4499('0x2c')]);router[_0x4499('0x9')](_0x4499('0x2d'),auth[_0x4499('0xa')](),controller[_0x4499('0x2e')]);router[_0x4499('0x9')](_0x4499('0x2f'),auth[_0x4499('0xa')](),controller[_0x4499('0x30')]);router['get'](_0x4499('0x31'),auth[_0x4499('0xa')](),controller[_0x4499('0x32')]);router['get'](_0x4499('0x33'),auth[_0x4499('0xa')](),controller[_0x4499('0x34')]);router[_0x4499('0x9')](_0x4499('0x35'),auth[_0x4499('0xa')](),controller[_0x4499('0x36')]);router[_0x4499('0x9')](_0x4499('0x37'),auth[_0x4499('0xa')](),controller[_0x4499('0x38')]);router[_0x4499('0x9')](_0x4499('0x39'),auth['isAuthenticated'](),controller[_0x4499('0x3a')]);router[_0x4499('0x9')](_0x4499('0x3b'),auth[_0x4499('0xa')](),controller[_0x4499('0x3c')]);router[_0x4499('0x3d')](_0x4499('0x14'),auth[_0x4499('0xa')](),controller['addContacts']);router['post']('/',auth[_0x4499('0xa')](),controller['create']);router['post'](_0x4499('0x3e'),auth[_0x4499('0xa')](),controller['bulkCreate']);router['post']('/:id/queues',auth[_0x4499('0xa')](),controller[_0x4499('0x3f')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xdb0a1,_0x57fd37,_0x58cf31){_0x58cf31(null,path[_0x4499('0x40')](config['root'],_0x4499('0x41')));},'filename':function(_0x117923,_0x20b6f7,_0x1389f5){_0x1389f5(null,util['format']('%s-%s',Date[_0x4499('0x42')](),_0x20b6f7[_0x4499('0x43')]));}})});router[_0x4499('0x3d')]('/:id/avatar',upload[_0x4499('0x44')](_0x4499('0x45')),controller[_0x4499('0x46')]);router[_0x4499('0x3d')](_0x4499('0x47'),auth['isAuthenticated'](),controller[_0x4499('0x48')]);router[_0x4499('0x3d')]('/:id/logout',auth[_0x4499('0xa')](),controller[_0x4499('0x49')]);router[_0x4499('0x3d')]('/:id/pause',auth['isAuthenticated'](),controller[_0x4499('0x4a')]);router[_0x4499('0x3d')]('/:id/unpause',auth[_0x4499('0xa')](),controller[_0x4499('0x4b')]);router[_0x4499('0x3d')]('/:id/teams',auth['isAuthenticated'](),controller[_0x4499('0x4c')]);router[_0x4499('0x3d')](_0x4499('0x4d'),auth[_0x4499('0xa')](),controller[_0x4499('0x4e')]);router[_0x4499('0x3d')]('/:id/mail_interactions',auth[_0x4499('0xa')](),controller[_0x4499('0x4f')]);router[_0x4499('0x3d')](_0x4499('0x50'),auth[_0x4499('0xa')](),controller[_0x4499('0x51')]);router[_0x4499('0x3d')](_0x4499('0x52'),auth[_0x4499('0xa')](),controller[_0x4499('0x53')]);router[_0x4499('0x3d')](_0x4499('0x54'),auth['isAuthenticated'](),controller[_0x4499('0x55')]);router['post'](_0x4499('0x56'),auth[_0x4499('0xa')](),controller['addWhatsappInteractions']);router[_0x4499('0x3d')](_0x4499('0x2b'),auth['isAuthenticated'](),controller[_0x4499('0x57')]);router[_0x4499('0x3d')](_0x4499('0x2d'),auth['isAuthenticated'](),controller['addMailAccounts']);router['post'](_0x4499('0x2f'),auth[_0x4499('0xa')](),controller[_0x4499('0x58')]);router[_0x4499('0x3d')](_0x4499('0x31'),auth['isAuthenticated'](),controller[_0x4499('0x59')]);router[_0x4499('0x3d')](_0x4499('0x33'),auth[_0x4499('0xa')](),controller['addChatWebsites']);router[_0x4499('0x3d')](_0x4499('0x35'),auth[_0x4499('0xa')](),controller['addWhatsappAccounts']);router[_0x4499('0x3d')](_0x4499('0x37'),auth[_0x4499('0xa')](),controller['addSquareProjects']);router[_0x4499('0x3d')](_0x4499('0x3b'),auth[_0x4499('0xa')](),controller[_0x4499('0x5a')]);router[_0x4499('0x5b')](_0x4499('0xf'),auth[_0x4499('0xa')](),controller['update']);router['put']('/:id/password',auth[_0x4499('0xa')](),controller['changePassword']);router[_0x4499('0x5c')](_0x4499('0x16'),auth[_0x4499('0xa')](),controller[_0x4499('0x5d')]);router[_0x4499('0x5c')](_0x4499('0x5e'),auth[_0x4499('0xa')](),controller[_0x4499('0x5f')]);router[_0x4499('0x5c')](_0x4499('0xf'),auth['isAuthenticated'](),controller['destroy']);router['delete']('/:id/chat_interactions',auth[_0x4499('0xa')](),controller[_0x4499('0x60')]);router[_0x4499('0x5c')](_0x4499('0x61'),auth[_0x4499('0xa')](),controller[_0x4499('0x62')]);router[_0x4499('0x5c')](_0x4499('0x50'),auth[_0x4499('0xa')](),controller[_0x4499('0x63')]);router[_0x4499('0x5c')](_0x4499('0x52'),auth[_0x4499('0xa')](),controller[_0x4499('0x64')]);router[_0x4499('0x5c')](_0x4499('0x54'),auth[_0x4499('0xa')](),controller[_0x4499('0x65')]);router[_0x4499('0x5c')]('/:id/whatsapp_interactions',auth[_0x4499('0xa')](),controller[_0x4499('0x66')]);router[_0x4499('0x5c')](_0x4499('0x2b'),auth['isAuthenticated'](),controller[_0x4499('0x67')]);router[_0x4499('0x5c')]('/:id/mail_accounts',auth['isAuthenticated'](),controller['removeMailAccounts']);router['delete']('/:id/openchannel_accounts',auth[_0x4499('0xa')](),controller[_0x4499('0x68')]);router[_0x4499('0x5c')]('/:id/sms_accounts',auth[_0x4499('0xa')](),controller['removeSmsAccounts']);router[_0x4499('0x5c')](_0x4499('0x33'),auth['isAuthenticated'](),controller[_0x4499('0x69')]);router[_0x4499('0x5c')](_0x4499('0x35'),auth[_0x4499('0xa')](),controller[_0x4499('0x6a')]);router['delete'](_0x4499('0x37'),auth[_0x4499('0xa')](),controller['removeSquareProjects']);router[_0x4499('0x5c')](_0x4499('0x3b'),auth[_0x4499('0xa')](),controller[_0x4499('0x6b')]);module[_0x4499('0x6c')]=router; \ No newline at end of file +var _0x325f=['bulkCreate','addQueues','diskStorage','join','root','format','%s-%s','now','originalname','single','file','/:id/login','login','/:id/logout','logout','/:id/pause','pause','/:id/unpause','unpause','addTeams','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','/:id/mail_accounts','addMailAccounts','/:id/openchannel_accounts','/:id/sms_accounts','addSmsAccounts','addWhatsappAccounts','addSquareProjects','put','/:id','update','/:id/password','removeQueues','delete','removeTeams','destroy','/:id/chat_interactions','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeOpenchannelAccounts','removeChatWebsites','removeWhatsappAccounts','removeSquareProjects','removeApiKey','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./user.controller','get','index','isAuthenticated','describe','/whoami','whoami','/presence','getPresence','show','getAvatar','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','getOpenchannelAccounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/square_projects','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','post','addContacts','create','/create_many'];(function(_0x2d80e3,_0x3a3a0a){var _0x2b0ba1=function(_0xf96714){while(--_0xf96714){_0x2d80e3['push'](_0x2d80e3['shift']());}};_0x2b0ba1(++_0x3a3a0a);}(_0x325f,0x12a));var _0xf325=function(_0x18fa95,_0x17988d){_0x18fa95=_0x18fa95-0x0;var _0x2ba38f=_0x325f[_0x18fa95];return _0x2ba38f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xf325('0x0'));var timeout=require(_0xf325('0x1'));var express=require(_0xf325('0x2'));var router=express[_0xf325('0x3')]();var fs_extra=require(_0xf325('0x4'));var auth=require(_0xf325('0x5'));var interaction=require(_0xf325('0x6'));var config=require('../../config/environment');var controller=require(_0xf325('0x7'));router[_0xf325('0x8')]('/',auth['isAuthenticated'](),controller[_0xf325('0x9')]);router[_0xf325('0x8')]('/describe',auth[_0xf325('0xa')](),controller[_0xf325('0xb')]);router[_0xf325('0x8')](_0xf325('0xc'),auth['isAuthenticated'](),controller[_0xf325('0xd')]);router[_0xf325('0x8')](_0xf325('0xe'),auth[_0xf325('0xa')](),controller[_0xf325('0xf')]);router[_0xf325('0x8')]('/:id',auth[_0xf325('0xa')](),controller[_0xf325('0x10')]);router['get']('/:id/avatar',controller[_0xf325('0x11')]);router[_0xf325('0x8')]('/:id/open_tabs',auth[_0xf325('0xa')](),controller['getOpenTabs']);router[_0xf325('0x8')](_0xf325('0x12'),auth[_0xf325('0xa')](),controller[_0xf325('0x13')]);router[_0xf325('0x8')](_0xf325('0x14'),auth[_0xf325('0xa')](),controller[_0xf325('0x15')]);router['get'](_0xf325('0x16'),auth['isAuthenticated'](),controller[_0xf325('0x17')]);router['get'](_0xf325('0x18'),auth[_0xf325('0xa')](),controller['getGroups']);router['get']('/:id/recordings',auth[_0xf325('0xa')](),controller[_0xf325('0x19')]);router[_0xf325('0x8')](_0xf325('0x1a'),auth[_0xf325('0xa')](),controller[_0xf325('0x1b')]);router[_0xf325('0x8')](_0xf325('0x1c'),auth[_0xf325('0xa')](),controller[_0xf325('0x1d')]);router[_0xf325('0x8')](_0xf325('0x1e'),auth[_0xf325('0xa')](),controller[_0xf325('0x1f')]);router[_0xf325('0x8')]('/:id/mail/interactions',auth[_0xf325('0xa')](),controller[_0xf325('0x20')]);router['get'](_0xf325('0x21'),auth[_0xf325('0xa')](),controller[_0xf325('0x22')]);router['get'](_0xf325('0x23'),auth[_0xf325('0xa')](),controller['getFaxInteractions']);router[_0xf325('0x8')]('/:id/whatsapp/interactions',auth['isAuthenticated'](),controller[_0xf325('0x24')]);router[_0xf325('0x8')](_0xf325('0x25'),auth[_0xf325('0xa')](),controller[_0xf325('0x26')]);router['get'](_0xf325('0x27'),auth['isAuthenticated'](),controller[_0xf325('0x28')]);router[_0xf325('0x8')](_0xf325('0x29'),auth[_0xf325('0xa')](),controller[_0xf325('0x2a')]);router[_0xf325('0x8')](_0xf325('0x2b'),auth[_0xf325('0xa')](),controller[_0xf325('0x2c')]);router[_0xf325('0x8')](_0xf325('0x2d'),auth[_0xf325('0xa')](),controller[_0xf325('0x2e')]);router['get']('/:id/mail_accounts',auth['isAuthenticated'](),controller['getMailAccounts']);router[_0xf325('0x8')]('/:id/openchannel_accounts',auth[_0xf325('0xa')](),controller[_0xf325('0x2f')]);router[_0xf325('0x8')]('/:id/sms_accounts',auth[_0xf325('0xa')](),controller[_0xf325('0x30')]);router['get'](_0xf325('0x31'),auth['isAuthenticated'](),controller[_0xf325('0x32')]);router[_0xf325('0x8')](_0xf325('0x33'),auth[_0xf325('0xa')](),controller[_0xf325('0x34')]);router[_0xf325('0x8')](_0xf325('0x35'),auth[_0xf325('0xa')](),controller['getSquareProjects']);router[_0xf325('0x8')](_0xf325('0x36'),auth[_0xf325('0xa')](),controller[_0xf325('0x37')]);router[_0xf325('0x8')](_0xf325('0x38'),auth[_0xf325('0xa')](),controller[_0xf325('0x39')]);router[_0xf325('0x3a')](_0xf325('0x12'),auth['isAuthenticated'](),controller[_0xf325('0x3b')]);router[_0xf325('0x3a')]('/',auth[_0xf325('0xa')](),controller[_0xf325('0x3c')]);router[_0xf325('0x3a')](_0xf325('0x3d'),auth[_0xf325('0xa')](),controller[_0xf325('0x3e')]);router[_0xf325('0x3a')](_0xf325('0x14'),auth[_0xf325('0xa')](),controller[_0xf325('0x3f')]);var upload=multer({'storage':multer[_0xf325('0x40')]({'destination':function(_0x233605,_0x4df1e5,_0xea3062){_0xea3062(null,path[_0xf325('0x41')](config[_0xf325('0x42')],'server/files/images/'));},'filename':function(_0x4d5e9a,_0xecf1c,_0x237a24){_0x237a24(null,util[_0xf325('0x43')](_0xf325('0x44'),Date[_0xf325('0x45')](),_0xecf1c[_0xf325('0x46')]));}})});router[_0xf325('0x3a')]('/:id/avatar',upload[_0xf325('0x47')](_0xf325('0x48')),controller['addAvatar']);router['post'](_0xf325('0x49'),auth[_0xf325('0xa')](),controller[_0xf325('0x4a')]);router[_0xf325('0x3a')](_0xf325('0x4b'),auth[_0xf325('0xa')](),controller[_0xf325('0x4c')]);router['post'](_0xf325('0x4d'),auth[_0xf325('0xa')](),controller[_0xf325('0x4e')]);router['post'](_0xf325('0x4f'),auth[_0xf325('0xa')](),controller[_0xf325('0x50')]);router[_0xf325('0x3a')](_0xf325('0x25'),auth['isAuthenticated'](),controller[_0xf325('0x51')]);router[_0xf325('0x3a')]('/:id/chat_interactions',auth[_0xf325('0xa')](),controller[_0xf325('0x52')]);router['post'](_0xf325('0x53'),auth[_0xf325('0xa')](),controller[_0xf325('0x54')]);router['post'](_0xf325('0x55'),auth[_0xf325('0xa')](),controller[_0xf325('0x56')]);router['post'](_0xf325('0x57'),auth[_0xf325('0xa')](),controller[_0xf325('0x58')]);router['post'](_0xf325('0x59'),auth[_0xf325('0xa')](),controller['addOpenchannelInteractions']);router['post'](_0xf325('0x5a'),auth['isAuthenticated'](),controller[_0xf325('0x5b')]);router['post']('/:id/fax_accounts',auth['isAuthenticated'](),controller[_0xf325('0x5c')]);router[_0xf325('0x3a')](_0xf325('0x5d'),auth['isAuthenticated'](),controller[_0xf325('0x5e')]);router['post'](_0xf325('0x5f'),auth['isAuthenticated'](),controller['addOpenchannelAccounts']);router[_0xf325('0x3a')](_0xf325('0x60'),auth['isAuthenticated'](),controller[_0xf325('0x61')]);router[_0xf325('0x3a')]('/:id/chat_websites',auth[_0xf325('0xa')](),controller['addChatWebsites']);router[_0xf325('0x3a')](_0xf325('0x33'),auth[_0xf325('0xa')](),controller[_0xf325('0x62')]);router['post'](_0xf325('0x35'),auth[_0xf325('0xa')](),controller[_0xf325('0x63')]);router['post'](_0xf325('0x38'),auth[_0xf325('0xa')](),controller['createApiKey']);router[_0xf325('0x64')](_0xf325('0x65'),auth[_0xf325('0xa')](),controller[_0xf325('0x66')]);router[_0xf325('0x64')](_0xf325('0x67'),auth[_0xf325('0xa')](),controller['changePassword']);router['delete']('/:id/queues',auth['isAuthenticated'](),controller[_0xf325('0x68')]);router[_0xf325('0x69')](_0xf325('0x25'),auth[_0xf325('0xa')](),controller[_0xf325('0x6a')]);router[_0xf325('0x69')]('/:id',auth['isAuthenticated'](),controller[_0xf325('0x6b')]);router[_0xf325('0x69')](_0xf325('0x6c'),auth[_0xf325('0xa')](),controller['removeChatInteractions']);router['delete']('/:id/mail_interactions',auth['isAuthenticated'](),controller[_0xf325('0x6d')]);router['delete'](_0xf325('0x55'),auth[_0xf325('0xa')](),controller[_0xf325('0x6e')]);router[_0xf325('0x69')]('/:id/sms_interactions',auth['isAuthenticated'](),controller[_0xf325('0x6f')]);router[_0xf325('0x69')](_0xf325('0x59'),auth[_0xf325('0xa')](),controller[_0xf325('0x70')]);router[_0xf325('0x69')](_0xf325('0x5a'),auth[_0xf325('0xa')](),controller[_0xf325('0x71')]);router[_0xf325('0x69')](_0xf325('0x2d'),auth['isAuthenticated'](),controller[_0xf325('0x72')]);router[_0xf325('0x69')](_0xf325('0x5d'),auth[_0xf325('0xa')](),controller['removeMailAccounts']);router['delete'](_0xf325('0x5f'),auth[_0xf325('0xa')](),controller[_0xf325('0x73')]);router[_0xf325('0x69')]('/:id/sms_accounts',auth['isAuthenticated'](),controller['removeSmsAccounts']);router['delete'](_0xf325('0x31'),auth[_0xf325('0xa')](),controller[_0xf325('0x74')]);router[_0xf325('0x69')](_0xf325('0x33'),auth[_0xf325('0xa')](),controller[_0xf325('0x75')]);router[_0xf325('0x69')](_0xf325('0x35'),auth[_0xf325('0xa')](),controller[_0xf325('0x76')]);router[_0xf325('0x69')]('/:id/api_key',auth[_0xf325('0xa')](),controller[_0xf325('0x77')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 392dcc8..a27b05a 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 _0x4bc6=['loginAttempts','UNSIGNED','sequelize','moment','util','lodash','exports','STRING','setDataValue','The\x20name\x20of\x20the\x20user','fullname','callerid','\x22%s\x22\x20<%s>','getDataValue','internal','email','toLowerCase','ENUM','admin','user','agent','telephone','local','INTEGER','accountcode','BOOLEAN','DATE','DEFAULT\x20PAUSE','dynamic','friend','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB','udp','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','shortinfo','inband','auto','rfc2833','yes','nonat','update','outgoing','force_rport,comedia','nat','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','accept','refuse','originate','uas','fingerprint','active','passive','update,nonat','TEXT','showWebBar','get','isArray','wss','encryption','avpf','force_avp','icesupport','dtlsenable','dtlssetup','dtlscertfile','dtlsprivatekey','dtlsverify','actpass','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','rtcp_mux','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','false','screenrecording','blocked','blockedAt'];(function(_0x19e032,_0x2c4dd7){var _0x109dfc=function(_0x5edc1){while(--_0x5edc1){_0x19e032['push'](_0x19e032['shift']());}};_0x109dfc(++_0x2c4dd7);}(_0x4bc6,0xb6));var _0x64bc=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x4bc6[_0x199572];return _0x13cfa3;};'use strict';var Sequelize=require(_0x64bc('0x0'));var moment=require(_0x64bc('0x1'));var util=require(_0x64bc('0x2'));var _=require(_0x64bc('0x3'));module[_0x64bc('0x4')]={'name':{'type':Sequelize[_0x64bc('0x5')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x1eaa62){this[_0x64bc('0x6')]('name',_0x1eaa62);this[_0x64bc('0x6')]('defaultuser',_0x1eaa62);},'comment':_0x64bc('0x7')},'fullname':{'type':Sequelize[_0x64bc('0x5')],'allowNull':![],'set':function(_0xea688b){this['setDataValue'](_0x64bc('0x8'),_0xea688b);this[_0x64bc('0x6')](_0x64bc('0x9'),util['format'](_0x64bc('0xa'),_0xea688b,this[_0x64bc('0xb')](_0x64bc('0xc'))));}},'alias':{'type':Sequelize[_0x64bc('0x5')]},'email':{'type':Sequelize[_0x64bc('0x5')],'allowNull':![],'unique':_0x64bc('0xd'),'validate':{'isEmail':!![]},'set':function(_0x120d3c){if(_0x120d3c){this[_0x64bc('0x6')](_0x64bc('0xd'),_0x120d3c[_0x64bc('0xe')]());}}},'role':{'type':Sequelize[_0x64bc('0xf')](_0x64bc('0x10'),_0x64bc('0x11'),_0x64bc('0x12'),_0x64bc('0x13')),'allowNull':![]},'password':{'type':Sequelize[_0x64bc('0x5')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':_0x64bc('0x14')},'internal':{'type':Sequelize[_0x64bc('0x15')](0xb),'allowNull':![],'unique':'internal','set':function(_0x3178e6){this[_0x64bc('0x6')](_0x64bc('0xc'),_0x3178e6);this[_0x64bc('0x6')](_0x64bc('0x16'),_0x3178e6);this[_0x64bc('0x6')](_0x64bc('0x9'),util['format'](_0x64bc('0xa'),this[_0x64bc('0xb')]('fullname'),_0x3178e6));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x64bc('0x5')]},'address':{'type':Sequelize[_0x64bc('0x5')]},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize[_0x64bc('0x5')]},'city':{'type':Sequelize[_0x64bc('0x5')]},'country':{'type':Sequelize['STRING']},'online':{'type':Sequelize[_0x64bc('0x17')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x64bc('0x18')]},'voicePause':{'type':Sequelize[_0x64bc('0x17')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x64bc('0x17')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x64bc('0x17')],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x64bc('0x17')],'defaultValue':![]},'whatsappPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x64bc('0x17')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x64bc('0x5')],'defaultValue':_0x64bc('0x19')},'lastPauseAt':{'type':Sequelize[_0x64bc('0x18')]},'chatCapacity':{'type':Sequelize[_0x64bc('0x15')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x64bc('0x15')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x64bc('0x15')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x64bc('0x15')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x64bc('0x15')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x64bc('0x15')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x64bc('0x17')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x64bc('0x15')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x64bc('0x17')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x64bc('0x17')],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0x64bc('0x5')],'allowNull':!![]},'host':{'type':Sequelize[_0x64bc('0x5')],'allowNull':!![],'defaultValue':_0x64bc('0x1a')},'ipaddr':{'type':Sequelize['STRING'],'allowNull':!![]},'port':{'type':Sequelize[_0x64bc('0x15')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x64bc('0x15')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize['STRING'],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0x64bc('0x5')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x64bc('0x15')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x64bc('0xf')](_0x64bc('0x1b'),_0x64bc('0x11'),'peer'),'allowNull':!![],'defaultValue':_0x64bc('0x1b')},'context':{'type':Sequelize[_0x64bc('0x5')],'allowNull':!![],'defaultValue':_0x64bc('0x1c')},'callingpres':{'type':Sequelize[_0x64bc('0xf')](_0x64bc('0x1d'),_0x64bc('0x1e'),'ALLOWED_FAILED_SCREEN',_0x64bc('0x1f'),_0x64bc('0x20'),_0x64bc('0x21'),'PROHIB_FAILED_SCREEN',_0x64bc('0x22')),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize[_0x64bc('0x5')],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x64bc('0x5')],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x64bc('0x23'),'set':function(_0x435c54){this[_0x64bc('0x6')](_0x64bc('0x24'),_0x435c54?_0x435c54[_0x64bc('0x25')](','):null);},'get':function(){return this[_0x64bc('0xb')](_0x64bc('0x24'))?this[_0x64bc('0xb')]('transport')[_0x64bc('0x26')](','):null;},'comment':_0x64bc('0x27')},'dtmfmode':{'type':Sequelize[_0x64bc('0xf')]('rfc2833',_0x64bc('0x28'),_0x64bc('0x29'),_0x64bc('0x2a'),_0x64bc('0x2b')),'allowNull':!![],'defaultValue':_0x64bc('0x2c')},'directmedia':{'type':Sequelize['ENUM'](_0x64bc('0x2d'),'no',_0x64bc('0x2e'),_0x64bc('0x2f'),_0x64bc('0x30')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x64bc('0xf')](_0x64bc('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x64bc('0x5')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x64bc('0x31'),'set':function(_0x43fff5){this[_0x64bc('0x6')](_0x64bc('0x32'),_0x43fff5?_0x43fff5[_0x64bc('0x25')](','):null);},'get':function(){return this[_0x64bc('0xb')](_0x64bc('0x32'))?this[_0x64bc('0xb')](_0x64bc('0x32'))[_0x64bc('0x26')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x64bc('0x5')]},'namedcallgroup':{'type':Sequelize[_0x64bc('0x5')]},'pickupgroup':{'type':Sequelize[_0x64bc('0x5')]},'namedpickupgroup':{'type':Sequelize[_0x64bc('0x5')]},'language':{'type':Sequelize[_0x64bc('0x5')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x64bc('0x5')]},'disallow':{'type':Sequelize[_0x64bc('0x5')],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x5b61f1){this[_0x64bc('0x6')](_0x64bc('0x33'),_0x5b61f1?_0x5b61f1[_0x64bc('0x25')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0x64bc('0xb')](_0x64bc('0x33'))?this[_0x64bc('0xb')](_0x64bc('0x33'))[_0x64bc('0x26')](';'):null;},'comment':_0x64bc('0x34')},'autoframing':{'type':Sequelize[_0x64bc('0xf')]('yes','no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x64bc('0x5')],'allowNull':!![],'set':function(_0x1220ae){this[_0x64bc('0x6')]('insecure',_0x1220ae?_0x1220ae[_0x64bc('0x25')](','):null);},'get':function(){return this[_0x64bc('0xb')]('insecure')?this[_0x64bc('0xb')](_0x64bc('0x35'))[_0x64bc('0x26')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x64bc('0xf')](_0x64bc('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x64bc('0xf')](_0x64bc('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0x64bc('0x2d'),'no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x64bc('0xf')](_0x64bc('0x2d'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x64bc('0xf')]('yes','no'),'allowNull':!![]},'accountcode':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x64bc('0x5')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x64bc('0x5')],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0x64bc('0x5')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x64bc('0xf')](_0x64bc('0x2d'),'no'),'allowNull':!![],'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0x64bc('0x15')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x64bc('0xf')](_0x64bc('0x2d'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x64bc('0xf')]('yes','no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x64bc('0xf')](_0x64bc('0x2d'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x64bc('0xf')](_0x64bc('0x2d'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x64bc('0x5')],'allowNull':!![]},'template':{'type':Sequelize[_0x64bc('0x5')],'allowNull':!![]},'videosupport':{'type':Sequelize['ENUM']('yes','no','always'),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x64bc('0x15')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x64bc('0x2d'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x64bc('0x5')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x64bc('0xf')](_0x64bc('0x36'),_0x64bc('0x37'),_0x64bc('0x38')),'allowNull':!![]},'session_expires':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x64bc('0xf')]('uac','uas'),'allowNull':!![],'defaultValue':_0x64bc('0x39')},'t38pt_usertpsource':{'type':Sequelize[_0x64bc('0x5')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x64bc('0x5')],'allowNull':!![]},'fromdomain':{'type':Sequelize['STRING'],'allowNull':!![]},'fromuser':{'type':Sequelize['STRING'],'allowNull':!![]},'qualify':{'type':Sequelize[_0x64bc('0xf')](_0x64bc('0x2d'),'no'),'allowNull':!![],'defaultValue':_0x64bc('0x2d')},'keepalive':{'type':Sequelize[_0x64bc('0x15')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x64bc('0x5')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x64bc('0x15')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x64bc('0x15')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x64bc('0xf')](_0x64bc('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x64bc('0x5')],'allowNull':!![]},'callbackextension':{'type':Sequelize['STRING'],'allowNull':!![]},'timert1':{'type':Sequelize[_0x64bc('0x15')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x64bc('0x15')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x64bc('0x15')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize['STRING'],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x64bc('0xf')](_0x64bc('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x64bc('0x2d'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x64bc('0xf')]('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x64bc('0xf')](_0x64bc('0x2d'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x64bc('0xf')](_0x64bc('0x2d'),'no',_0x64bc('0x3a'),'certificate'),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x64bc('0x15')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x64bc('0x5')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x64bc('0x5')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x64bc('0x5')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x64bc('0x5')],'allowNull':!![]},'dtlssetup':{'type':Sequelize['ENUM'](_0x64bc('0x3b'),_0x64bc('0x3c'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x64bc('0x5')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x64bc('0xf')](_0x64bc('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x64bc('0x5')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x64bc('0x5')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x64bc('0x15')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x64bc('0xf')](_0x64bc('0x2d'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x64bc('0xf')](_0x64bc('0x2d'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x64bc('0x5')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x64bc('0x5')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x64bc('0x5')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x64bc('0x5')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x64bc('0xf')](_0x64bc('0x2d'),'no',_0x64bc('0x2e'),_0x64bc('0x2f'),_0x64bc('0x3d')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x64bc('0x17')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize['STRING']},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0x64bc('0x18')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x64bc('0x3e')]},'showWebBar':{'type':Sequelize[_0x64bc('0x15')],'defaultValue':0x0,'set':function(_0x10c382){this[_0x64bc('0x6')](_0x64bc('0x3f'),_0x10c382);var _0x1ad00e=this[_0x64bc('0x40')]({'plain':!![]});switch(_0x10c382){case 0x0:case 0x1:var _0x138fe3=_0x1ad00e[_0x64bc('0x24')]?_[_0x64bc('0x41')](_0x1ad00e[_0x64bc('0x24')])?_0x1ad00e[_0x64bc('0x24')][_0x64bc('0x25')]():_0x1ad00e[_0x64bc('0x24')]:_0x64bc('0x23');if(_0x138fe3===_0x64bc('0x42')){_0x138fe3=_0x64bc('0x23');}this[_0x64bc('0x6')](_0x64bc('0x24'),_0x138fe3);this[_0x64bc('0x6')](_0x64bc('0x43'),'no');this[_0x64bc('0x6')](_0x64bc('0x44'),null);this[_0x64bc('0x6')](_0x64bc('0x45'),null);this[_0x64bc('0x6')](_0x64bc('0x46'),null);this['setDataValue'](_0x64bc('0x47'),null);this[_0x64bc('0x6')]('dtlsverify',null);this[_0x64bc('0x6')](_0x64bc('0x48'),null);this['setDataValue'](_0x64bc('0x49'),null);this[_0x64bc('0x6')](_0x64bc('0x4a'),null);this[_0x64bc('0x6')]('rtcp_mux','no');break;case 0x2:this[_0x64bc('0x6')](_0x64bc('0x24'),'wss');this[_0x64bc('0x6')]('encryption','yes');this[_0x64bc('0x6')](_0x64bc('0x44'),_0x64bc('0x2d'));this[_0x64bc('0x6')](_0x64bc('0x45'),'yes');this[_0x64bc('0x6')](_0x64bc('0x46'),_0x64bc('0x2d'));this[_0x64bc('0x6')](_0x64bc('0x47'),'yes');this['setDataValue'](_0x64bc('0x4b'),'no');this['setDataValue']('dtlssetup',_0x64bc('0x4c'));this[_0x64bc('0x6')](_0x64bc('0x49'),_0x1ad00e['dtlscertfile']||_0x64bc('0x4d'));this[_0x64bc('0x6')](_0x64bc('0x4a'),_0x1ad00e[_0x64bc('0x4a')]||_0x64bc('0x4e'));this[_0x64bc('0x6')](_0x64bc('0x4f'),_0x64bc('0x2d'));break;default:}}},'permissions':{'type':Sequelize[_0x64bc('0x3e')],'set':function(_0x360a3d){this['setDataValue']('permissions',_0x360a3d?_0x360a3d[_0x64bc('0x25')](','):[]);},'get':function(){return this[_0x64bc('0xb')](_0x64bc('0x50'))?_[_0x64bc('0x51')](this[_0x64bc('0xb')](_0x64bc('0x50'))['split'](','),function(_0x3c6e09){return parseInt(_0x3c6e09,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x64bc('0x5')]},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize['STRING']},'phoneBarUnconditional':{'type':Sequelize[_0x64bc('0x17')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x64bc('0x17')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x64bc('0x17')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x64bc('0x17')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x64bc('0x17')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x64bc('0x15')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x64bc('0x5')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x64bc('0x15')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x64bc('0xf')]('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x64bc('0x17')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x64bc('0x5')]},'phoneBarEnableJaws':{'type':Sequelize[_0x64bc('0x17')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x64bc('0x17')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x64bc('0x52')],'get':function(){return this['getDataValue'](_0x64bc('0x53'))?this[_0x64bc('0xb')](_0x64bc('0x53')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x64bc('0x17')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x64bc('0x17')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x64bc('0x17')],'defaultValue':![]},'interface':{'type':Sequelize[_0x64bc('0x5')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x64bc('0x17')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize['STRING'],'allowNull':!![]},'apiKeyIat':{'type':Sequelize['STRING'],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x4efa50){if(typeof _0x4efa50==='string'){var _0x4e1d55=_0x4efa50==='1'?!![]:_0x4efa50==='0'?![]:_0x4efa50==='true'?!![]:_0x4efa50===_0x64bc('0x54')?![]:![];this['setDataValue']('screenrecording',_0x4e1d55);}else{this[_0x64bc('0x6')](_0x64bc('0x55'),_0x4efa50);}}},'blocked':{'type':Sequelize[_0x64bc('0x17')],'defaultValue':![],'set':function(_0x50684b){this[_0x64bc('0x6')](_0x64bc('0x56'),_0x50684b);if(_0x50684b===!![]){this[_0x64bc('0x6')](_0x64bc('0x57'),moment());this[_0x64bc('0x6')](_0x64bc('0x58'),0x0);}else{this[_0x64bc('0x6')](_0x64bc('0x57'),null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x64bc('0x15')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x64bc('0x17')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x64bc('0x17')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x64bc('0x15')](0x5)[_0x64bc('0x59')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x64bc('0x17')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x64bc('0x17')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x64bc('0x17')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x64bc('0x17')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x64bc('0x17')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x64bc('0x17')],'defaultValue':![]}}; \ No newline at end of file +var _0xf86c=['active','passive','actpass','update,nonat','TEXT','showWebBar','wss','encryption','force_avp','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','icesupport','/etc/pki/tls/private/motion.key','permissions','map','phoneBarEnableScreenRecordingByAgent','true','screenrecording','blocked','blockedAt','loginAttempts','UNSIGNED','sequelize','util','lodash','exports','name','setDataValue','STRING','fullname','callerid','format','getDataValue','internal','email','ENUM','admin','user','agent','local','INTEGER','accountcode','\x22%s\x22\x20<%s>','BOOLEAN','DEFAULT\x20PAUSE','DATE','dynamic','friend','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_PASSED_SCREEN','PROHIB','udp','transport','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','shortinfo','inband','nonat','update','outgoing','yes','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','\x22\x22\x20<>','always','accept','refuse','originate','uac','fingerprint','certificate'];(function(_0x5d2c13,_0x4f6eb6){var _0x2d0d52=function(_0x2c076e){while(--_0x2c076e){_0x5d2c13['push'](_0x5d2c13['shift']());}};_0x2d0d52(++_0x4f6eb6);}(_0xf86c,0x6f));var _0xcf86=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf86c[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xcf86('0x0'));var moment=require('moment');var util=require(_0xcf86('0x1'));var _=require(_0xcf86('0x2'));module[_0xcf86('0x3')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xcf86('0x4'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x24971a){this[_0xcf86('0x5')](_0xcf86('0x4'),_0x24971a);this['setDataValue']('defaultuser',_0x24971a);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0xcf86('0x6')],'allowNull':![],'set':function(_0x4fd088){this[_0xcf86('0x5')](_0xcf86('0x7'),_0x4fd088);this[_0xcf86('0x5')](_0xcf86('0x8'),util[_0xcf86('0x9')]('\x22%s\x22\x20<%s>',_0x4fd088,this[_0xcf86('0xa')](_0xcf86('0xb'))));}},'alias':{'type':Sequelize[_0xcf86('0x6')]},'email':{'type':Sequelize[_0xcf86('0x6')],'allowNull':![],'unique':_0xcf86('0xc'),'validate':{'isEmail':!![]},'set':function(_0x189abf){if(_0x189abf){this[_0xcf86('0x5')](_0xcf86('0xc'),_0x189abf['toLowerCase']());}}},'role':{'type':Sequelize[_0xcf86('0xd')](_0xcf86('0xe'),_0xcf86('0xf'),_0xcf86('0x10'),'telephone'),'allowNull':![]},'password':{'type':Sequelize[_0xcf86('0x6')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0xcf86('0x6')],'defaultValue':_0xcf86('0x11')},'internal':{'type':Sequelize[_0xcf86('0x12')](0xb),'allowNull':![],'unique':'internal','set':function(_0x4ec35b){this['setDataValue'](_0xcf86('0xb'),_0x4ec35b);this[_0xcf86('0x5')](_0xcf86('0x13'),_0x4ec35b);this[_0xcf86('0x5')](_0xcf86('0x8'),util['format'](_0xcf86('0x14'),this['getDataValue'](_0xcf86('0x7')),_0x4ec35b));}},'salt':{'type':Sequelize[_0xcf86('0x6')]},'phone':{'type':Sequelize[_0xcf86('0x6')]},'mobile':{'type':Sequelize[_0xcf86('0x6')]},'address':{'type':Sequelize[_0xcf86('0x6')]},'zipcode':{'type':Sequelize[_0xcf86('0x6')]},'userpic':{'type':Sequelize[_0xcf86('0x6')]},'city':{'type':Sequelize[_0xcf86('0x6')]},'country':{'type':Sequelize[_0xcf86('0x6')]},'online':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize[_0xcf86('0x15')],'defaultValue':![]},'chatPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'mailPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxPause':{'type':Sequelize[_0xcf86('0x15')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0xcf86('0x15')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0xcf86('0x15')],'defaultValue':![]},'openchannelPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'pauseType':{'type':Sequelize[_0xcf86('0x6')],'defaultValue':_0xcf86('0x16')},'lastPauseAt':{'type':Sequelize[_0xcf86('0x17')]},'chatCapacity':{'type':Sequelize[_0xcf86('0x12')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xcf86('0x12')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0xcf86('0x12')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0xcf86('0x12')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0xcf86('0x15')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0xcf86('0x12')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0xcf86('0x12')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xcf86('0x12')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0xcf86('0x15')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0xcf86('0x15')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0xcf86('0x15')],'defaultValue':![]},'description':{'type':Sequelize[_0xcf86('0x6')],'allowNull':!![]},'host':{'type':Sequelize[_0xcf86('0x6')],'allowNull':!![],'defaultValue':_0xcf86('0x18')},'ipaddr':{'type':Sequelize[_0xcf86('0x6')],'allowNull':!![]},'port':{'type':Sequelize[_0xcf86('0x12')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0xcf86('0x6')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0xcf86('0x6')],'allowNull':!![]},'lastms':{'type':Sequelize[_0xcf86('0x12')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0xcf86('0xd')](_0xcf86('0x19'),_0xcf86('0xf'),'peer'),'allowNull':!![],'defaultValue':_0xcf86('0x19')},'context':{'type':Sequelize[_0xcf86('0x6')],'allowNull':!![],'defaultValue':'from-sip'},'callingpres':{'type':Sequelize[_0xcf86('0xd')](_0xcf86('0x1a'),_0xcf86('0x1b'),_0xcf86('0x1c'),_0xcf86('0x1d'),'PROHIB_NOT_SCREENED',_0xcf86('0x1e'),'PROHIB_FAILED_SCREEN',_0xcf86('0x1f')),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize[_0xcf86('0x6')],'allowNull':!![]},'secret':{'type':Sequelize[_0xcf86('0x6')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0xcf86('0x6')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0xcf86('0x6')],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xcf86('0x20'),'set':function(_0x2f5bfa){this[_0xcf86('0x5')](_0xcf86('0x21'),_0x2f5bfa?_0x2f5bfa[_0xcf86('0x22')](','):null);},'get':function(){return this[_0xcf86('0xa')](_0xcf86('0x21'))?this[_0xcf86('0xa')](_0xcf86('0x21'))['split'](','):null;},'comment':_0xcf86('0x23')},'dtmfmode':{'type':Sequelize['ENUM']('rfc2833',_0xcf86('0x24'),_0xcf86('0x25'),_0xcf86('0x26'),'auto'),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0xcf86('0xd')]('yes','no',_0xcf86('0x27'),_0xcf86('0x28'),_0xcf86('0x29')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xcf86('0xd')](_0xcf86('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xcf86('0x6')],'allowNull':!![]},'nat':{'type':Sequelize[_0xcf86('0x6')],'allowNull':!![],'defaultValue':_0xcf86('0x2b'),'set':function(_0x56f445){this[_0xcf86('0x5')](_0xcf86('0x2c'),_0x56f445?_0x56f445[_0xcf86('0x22')](','):null);},'get':function(){return this[_0xcf86('0xa')](_0xcf86('0x2c'))?this['getDataValue'](_0xcf86('0x2c'))[_0xcf86('0x2d')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0xcf86('0x6')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0xcf86('0x6')]},'namedpickupgroup':{'type':Sequelize[_0xcf86('0x6')]},'language':{'type':Sequelize[_0xcf86('0x6')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING']},'disallow':{'type':Sequelize[_0xcf86('0x6')],'allowNull':![],'defaultValue':_0xcf86('0x2e')},'allow':{'type':Sequelize[_0xcf86('0x6')],'allowNull':![],'defaultValue':_0xcf86('0x2f'),'set':function(_0x31fdc3){this[_0xcf86('0x5')]('allow',_0x31fdc3?_0x31fdc3['join'](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0xcf86('0xa')]('allow')?this['getDataValue'](_0xcf86('0x30'))[_0xcf86('0x2d')](';'):null;},'comment':_0xcf86('0x31')},'autoframing':{'type':Sequelize[_0xcf86('0xd')](_0xcf86('0x2a'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize['STRING'],'allowNull':!![],'set':function(_0x186224){this[_0xcf86('0x5')](_0xcf86('0x32'),_0x186224?_0x186224[_0xcf86('0x22')](','):null);},'get':function(){return this[_0xcf86('0xa')]('insecure')?this['getDataValue'](_0xcf86('0x32'))[_0xcf86('0x2d')](','):null;},'comment':_0xcf86('0x33')},'trustrpid':{'type':Sequelize[_0xcf86('0xd')](_0xcf86('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xcf86('0xd')](_0xcf86('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xcf86('0xd')](_0xcf86('0x2a'),'no',_0xcf86('0x34')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0xcf86('0xd')](_0xcf86('0x2a'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0xcf86('0xd')](_0xcf86('0x2a'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0xcf86('0x12')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize['STRING'],'allowNull':!![]},'callerid':{'type':Sequelize[_0xcf86('0x6')],'allowNull':!![],'defaultValue':_0xcf86('0x35')},'amaflags':{'type':Sequelize[_0xcf86('0x6')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0xcf86('0xd')](_0xcf86('0x2a'),'no'),'allowNull':!![],'defaultValue':_0xcf86('0x2a')},'busylevel':{'type':Sequelize[_0xcf86('0x12')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0xcf86('0xd')]('yes','no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM'](_0xcf86('0x2a'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0xcf86('0xd')]('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0xcf86('0xd')](_0xcf86('0x2a'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0xcf86('0x6')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize['ENUM'](_0xcf86('0x2a'),'no',_0xcf86('0x36')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xcf86('0x12')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0xcf86('0xd')](_0xcf86('0x2a'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0xcf86('0x6')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0xcf86('0xd')](_0xcf86('0x37'),_0xcf86('0x38'),_0xcf86('0x39')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0xcf86('0x12')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0xcf86('0x12')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xcf86('0xd')](_0xcf86('0x3a'),'uas'),'allowNull':!![],'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0xcf86('0x6')],'allowNull':!![]},'regexten':{'type':Sequelize[_0xcf86('0x6')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0xcf86('0x6')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xcf86('0x6')],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM'](_0xcf86('0x2a'),'no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0xcf86('0x12')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0xcf86('0x6')],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0xcf86('0x12')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0xcf86('0x12')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0xcf86('0xd')](_0xcf86('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xcf86('0x6')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0xcf86('0x6')],'allowNull':!![]},'timert1':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0xcf86('0x12')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0xcf86('0x12')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0xcf86('0x6')],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize[_0xcf86('0x6')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xcf86('0x6')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0xcf86('0x6')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0xcf86('0x12')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0xcf86('0xd')](_0xcf86('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xcf86('0xd')](_0xcf86('0x2a'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0xcf86('0xd')](_0xcf86('0x2a'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0xcf86('0xd')](_0xcf86('0x2a'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0xcf86('0xd')]('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0xcf86('0xd')](_0xcf86('0x2a'),'no',_0xcf86('0x3b'),_0xcf86('0x3c')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0xcf86('0x6')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0xcf86('0x6')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0xcf86('0x6')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0xcf86('0x6')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0xcf86('0xd')](_0xcf86('0x3d'),_0xcf86('0x3e'),_0xcf86('0x3f')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xcf86('0x6')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0xcf86('0xd')](_0xcf86('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xcf86('0x6')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0xcf86('0x6')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0xcf86('0x12')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0xcf86('0x2a'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0xcf86('0xd')](_0xcf86('0x2a'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0xcf86('0x6')],'allowNull':!![]},'mohinterpret':{'type':Sequelize['STRING'],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0xcf86('0x6')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0xcf86('0x6')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0xcf86('0xd')]('yes','no',_0xcf86('0x27'),_0xcf86('0x28'),_0xcf86('0x40')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xcf86('0x6')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0xcf86('0x17')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0xcf86('0x41')]},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x40da11){this[_0xcf86('0x5')](_0xcf86('0x42'),_0x40da11);var _0x4ce242=this['get']({'plain':!![]});switch(_0x40da11){case 0x0:case 0x1:var _0xee9c3d=_0x4ce242[_0xcf86('0x21')]?_['isArray'](_0x4ce242[_0xcf86('0x21')])?_0x4ce242['transport'][_0xcf86('0x22')]():_0x4ce242[_0xcf86('0x21')]:'udp';if(_0xee9c3d===_0xcf86('0x43')){_0xee9c3d='udp';}this[_0xcf86('0x5')](_0xcf86('0x21'),_0xee9c3d);this['setDataValue'](_0xcf86('0x44'),'no');this[_0xcf86('0x5')]('avpf',null);this[_0xcf86('0x5')](_0xcf86('0x45'),null);this[_0xcf86('0x5')]('icesupport',null);this[_0xcf86('0x5')](_0xcf86('0x46'),null);this['setDataValue'](_0xcf86('0x47'),null);this[_0xcf86('0x5')](_0xcf86('0x48'),null);this['setDataValue'](_0xcf86('0x49'),null);this[_0xcf86('0x5')](_0xcf86('0x4a'),null);this[_0xcf86('0x5')]('rtcp_mux','no');break;case 0x2:this['setDataValue'](_0xcf86('0x21'),_0xcf86('0x43'));this[_0xcf86('0x5')](_0xcf86('0x44'),_0xcf86('0x2a'));this[_0xcf86('0x5')]('avpf','yes');this['setDataValue'](_0xcf86('0x45'),_0xcf86('0x2a'));this[_0xcf86('0x5')](_0xcf86('0x4b'),'yes');this[_0xcf86('0x5')]('dtlsenable',_0xcf86('0x2a'));this[_0xcf86('0x5')](_0xcf86('0x47'),'no');this[_0xcf86('0x5')](_0xcf86('0x48'),'actpass');this['setDataValue'](_0xcf86('0x49'),_0x4ce242['dtlscertfile']||'/etc/pki/tls/certs/motion.crt');this[_0xcf86('0x5')](_0xcf86('0x4a'),_0x4ce242[_0xcf86('0x4a')]||_0xcf86('0x4c'));this[_0xcf86('0x5')]('rtcp_mux','yes');break;default:}}},'permissions':{'type':Sequelize[_0xcf86('0x41')],'set':function(_0x3a0115){this['setDataValue'](_0xcf86('0x4d'),_0x3a0115?_0x3a0115[_0xcf86('0x22')](','):[]);},'get':function(){return this[_0xcf86('0xa')](_0xcf86('0x4d'))?_[_0xcf86('0x4e')](this[_0xcf86('0xa')](_0xcf86('0x4d'))[_0xcf86('0x2d')](','),function(_0x352136){return parseInt(_0x352136,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0xcf86('0x6')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0xcf86('0x6')]},'phoneBarBusyNumber':{'type':Sequelize['STRING']},'phoneBarUnconditional':{'type':Sequelize[_0xcf86('0x15')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0xcf86('0x15')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0xcf86('0x15')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xcf86('0x15')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0xcf86('0x15')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0xcf86('0x12')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0xcf86('0x6')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0xcf86('0x12')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0xcf86('0xd')](_0xcf86('0x2a'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0xcf86('0x15')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0xcf86('0x6')]},'phoneBarEnableJaws':{'type':Sequelize[_0xcf86('0x15')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0xcf86('0x15')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xcf86('0xa')](_0xcf86('0x4f'))?this[_0xcf86('0xa')](_0xcf86('0x4f')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0xcf86('0x15')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0xcf86('0x15')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0xcf86('0x15')],'defaultValue':![]},'interface':{'type':Sequelize[_0xcf86('0x6')],'defaultValue':null},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0xcf86('0x6')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0xcf86('0x6')],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x11f546){if(typeof _0x11f546==='string'){var _0x5ddfef=_0x11f546==='1'?!![]:_0x11f546==='0'?![]:_0x11f546===_0xcf86('0x50')?!![]:_0x11f546==='false'?![]:![];this[_0xcf86('0x5')](_0xcf86('0x51'),_0x5ddfef);}else{this[_0xcf86('0x5')](_0xcf86('0x51'),_0x11f546);}}},'blocked':{'type':Sequelize[_0xcf86('0x15')],'defaultValue':![],'set':function(_0x5c4c92){this[_0xcf86('0x5')](_0xcf86('0x52'),_0x5c4c92);if(_0x5c4c92===!![]){this[_0xcf86('0x5')](_0xcf86('0x53'),moment());this[_0xcf86('0x5')](_0xcf86('0x54'),0x0);}else{this[_0xcf86('0x5')](_0xcf86('0x53'),null);}}},'blockedAt':{'type':Sequelize[_0xcf86('0x17')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0xcf86('0x12')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xcf86('0x15')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0xcf86('0x15')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0xcf86('0x12')](0x5)[_0xcf86('0x55')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0xcf86('0x15')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xcf86('0x15')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xcf86('0x15')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0xcf86('0x15')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0xcf86('0x15')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 7fcf1f9..15a5156 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 _0x373b=['getMailQueues','Sms','getWhatsappQueues','Fax','Openchannel','transaction','addAgent','getDataValue','voicePause','UserVoicePrefix','VoicePrefixId','removeTeams','getVoiceQueues','Mail','getSmsQueues','Whatsapp','getFaxQueues','getOpenchannelQueues','flatten','getLists','getAgents','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','user_has_chat_interactions:save','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','getVoicePrefixes','getFaxAccounts','FaxAccount','removeFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','removeMailAccounts','OpenchannelAccount','getOpenchannelAccounts','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','ChatWebsite','getChatWebsites','addChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','getSquareProjects','addSquareProjects','removeSquareProjects','getScheduledCalls','CmHopper','$gte','$lt','$eq','$between','$in','$notIn','$like','$notLike','$iLike','$notILike','$contains','$contained','$any','lastName','Contact','dialActive','getApiKey','retrieveApiKey','token','No\x20API\x20access\x20key\x20found!','generateApiKey','iat','nonce','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','apiKeyNonce','apiKeyIat','API\x20key\x20not\x20available','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','teams','queues','lower','toString','asc','substring','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','idle','unavailable','voiceStatus','busy','slice','charAt','field','ui.','InteractionId','ui.createdAt','user_has_','_interactions','ui.UserId\x20=\x20?','OpenTabs','moment','bluebird','util','path','lodash','squel','jayson/promise','ioredis','../../components/auth/service','api','../../config/utils','../../config/environment','../../mysqldb','register','defaults','redis','localhost','client','http','request','info','User,\x20%s,\x20%s','request\x20sent','User,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','then','Users','agent','Telephones','filter','ignore','map','value','includes','role','UserProfileResource','end','stack','name','send','User','rawAttributes','password','salt','getOptions','where','query','includeAll','include','true','UserSetting','userSetting','attributes','push','findAll','rows','openTabs','length','chat','sms','dataValues','fax','mail','openchannel','whatsapp','keys','intersection','model','fields','options','find','body','params','describe','addContacts','ids','omit','Setting','findById','securePassword','validatePasswordPattern','max','isNil','internal','min_internal','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)','sequelize','QueryTypes','SELECT','from','voicemail','mailbox','VoiceMail','email','permissions','101','103','110','104','105','107','108','100','111','114','create','Unauthorized','user','admin','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','checkUserLimits','settingsEnabled','userProfileId','autoAssociation','bulkCreate','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','UserProfileSection','Agents','isEmpty','telephone','compact','all','changePassword','oldPassword','newPassword','Sequelize','authenticate','ValidationError','Wrong\x20credentials','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','findOne','enforcePasswordHistory','passwordHistoryLimit','previousPasswords','validatePasswordHistory','updatePasswordsHistory','channel','loginInPause','interface','isValidChannel','Unknown\x20channel','capitalize','toLowerCase','Queues','penalty','spread','QueueId','emit','Queue:save','voice','VoiceQueue','online','SIP/%s','each','upsert','removeQueues','isArray','Queue:remove','UserVoiceQueueRt','addAvatar','userpic','filename','join','root','server/files/images/logos/default_profile.png','download','existsSync','server/files/images/','getOpenTabs','ChatOpenTabs','CHAT','createdAt','FaxOpenTabs','FAX','OpenchannelOpenTabs','OPENCHANNEL','MAIL','SmsOpenTabs','SMS','WhatsappOpenTabs','WHATSAPP','concat','getContacts','CmContact','filters','order','sort','merge','hasOwnProperty','CmList','List','Tag','Tags','color','tag','getQueues','pick','Queue','get','Unknown\x20role','nolimit','getVoiceQueuesRt','getGroups','ChatGroup','getRecordings','VoiceRecording','UserId','getScreenRecordings','ScreenRecording','getChatInteractions','ChatInteraction','getOpenchannelInteractions','OpenchannelInteraction','getMailInteractions','MailInteraction','SmsInteraction','getSmsInteractions','FaxInteraction','getFaxInteractions','getWhatsappInteractions','WhatsappInteraction','phone','mobile','format','LOCAL/%s@from-sip/n','intrf','user:%s','user:forcelogout','connection','remoteAddress','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','UserVoiceQueue.penalty','MemberReport','getChannels','forEach','LOGIN','device','PAUSE','LOGININPAUSE','YYYY-MM-DD\x20HH:mm:ss','isMiddleware','resolve','pause','QueuePause','updateAttributes','DEFAULT\x20PAUSE','type','mailPause','openchannelPause','smsPause','pauseType','lastPauseAt','%s%s','Pause','unpause','manual','getTeams','Team','addTeams','setDataValue','Voice','getChatQueues','Chat'];(function(_0x218581,_0x2610b1){var _0x109d0d=function(_0xaa9dea){while(--_0xaa9dea){_0x218581['push'](_0x218581['shift']());}};_0x109d0d(++_0x2610b1);}(_0x373b,0x7b));var _0xb373=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0x373b[_0xc6be3a];return _0x56a310;};'use strict';var moment=require(_0xb373('0x0'));var BPromise=require(_0xb373('0x1'));var util=require(_0xb373('0x2'));var path=require(_0xb373('0x3'));var fs=require('fs');var _=require(_0xb373('0x4'));var squel=require(_0xb373('0x5'));var jayson=require(_0xb373('0x6'));var Redis=require(_0xb373('0x7'));var authService=require(_0xb373('0x8'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0xb373('0x9'));var utils=require(_0xb373('0xa'));var config=require(_0xb373('0xb'));var licenseUtil=require('../../config/license/util');var db=require(_0xb373('0xc'))['db'];var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./user.socket')[_0xb373('0xd')](socket);config['redis']=_[_0xb373('0xe')](config[_0xb373('0xf')],{'host':_0xb373('0x10'),'port':0x18eb});var client=jayson[_0xb373('0x11')][_0xb373('0x12')]({'port':0x232a});var values;function respondWithRpcPromise(_0x25f544,_0x51a6b7,_0x449d82,_0x245e14){return new BPromise(function(_0x3ee24e,_0x28bc97){var _0x22ef51=_0x245e14||client;return _0x22ef51[_0xb373('0x13')](_0x25f544,_0x449d82)['then'](function(_0xf9819b){logger[_0xb373('0x14')](_0xb373('0x15'),_0x51a6b7,_0xb373('0x16'));logger['debug'](_0xb373('0x17'),_0x51a6b7,_0xb373('0x16'),JSON[_0xb373('0x18')](_0xf9819b));if(_0xf9819b[_0xb373('0x19')]){if(_0xf9819b[_0xb373('0x19')]['code']===0x1f4){logger[_0xb373('0x19')](_0xb373('0x15'),_0x51a6b7,_0xf9819b[_0xb373('0x19')][_0xb373('0x1a')]);return _0x28bc97(_0xf9819b[_0xb373('0x19')][_0xb373('0x1a')]);}logger['error'](_0xb373('0x15'),_0x51a6b7,_0xf9819b['error']['message']);return _0x3ee24e(_0xf9819b[_0xb373('0x19')][_0xb373('0x1a')]);}else{logger['info']('User,\x20%s,\x20%s',_0x51a6b7,_0xb373('0x16'));_0x3ee24e(_0xf9819b[_0xb373('0x1b')][_0xb373('0x1a')]);}})[_0xb373('0x1c')](function(_0x3e3df9){logger[_0xb373('0x19')]('User,\x20%s,\x20%s',_0x51a6b7,_0x3e3df9);_0x28bc97(_0x3e3df9);});});}function respondWithStatusCode(_0x9e1ca4,_0x7143e1){_0x7143e1=_0x7143e1||0xcc;return function(_0x768902){if(_0x768902){return _0x9e1ca4['sendStatus'](_0x7143e1);}return _0x9e1ca4[_0xb373('0x1d')](_0x7143e1)['end']();};}function respondWithResult(_0x196759,_0x2d55cc){_0x2d55cc=_0x2d55cc||0xc8;return function(_0x440644){if(_0x440644){return _0x196759[_0xb373('0x1d')](_0x2d55cc)[_0xb373('0x1e')](_0x440644);}};}function respondWithFilteredResult(_0x2b8bb0,_0x170380){return function(_0x4bbaa1){if(_0x4bbaa1){var _0x2d9a59=typeof _0x170380[_0xb373('0x1f')]===_0xb373('0x20')&&typeof _0x170380[_0xb373('0x21')]===_0xb373('0x20');var _0x560531=_0x4bbaa1['count'];var _0xf7de58=_0x2d9a59?0x0:_0x170380['offset'];var _0xb9ae49=_0x2d9a59?_0x4bbaa1[_0xb373('0x22')]:_0x170380[_0xb373('0x1f')]+_0x170380[_0xb373('0x21')];var _0x2390e9;if(_0xb9ae49>=_0x560531){_0xb9ae49=_0x560531;_0x2390e9=0xc8;}else{_0x2390e9=0xce;}_0x2b8bb0[_0xb373('0x1d')](_0x2390e9);return _0x2b8bb0[_0xb373('0x23')](_0xb373('0x24'),_0xf7de58+'-'+_0xb9ae49+'/'+_0x560531)['json'](_0x4bbaa1);}return null;};}function saveUpdates(_0x38e233){return function(_0x81b2d8){if(_0x81b2d8){return _0x81b2d8[_0xb373('0x25')](_0x38e233)['then'](function(_0x358d7d){return _0x358d7d;});}return null;};}function removeEntity(_0x2cd383){return function(_0x139068){if(_0x139068){return _0x139068[_0xb373('0x26')]()[_0xb373('0x27')](function(){var _0x287d7b=_0x139068['get']({'plain':!![]});if(_0x287d7b['role']==='admin')return;var _0x283af5=[{'name':_0xb373('0x28'),'value':'user','ignore':!![]},{'name':'Agents','value':_0xb373('0x29'),'ignore':![]},{'name':_0xb373('0x2a'),'value':'telephone','ignore':![]}];var _0x17f73d=_(_0x283af5)[_0xb373('0x2b')](_0xb373('0x2c'))[_0xb373('0x2d')](_0xb373('0x2e'))[_0xb373('0x2e')]();if(_[_0xb373('0x2f')](_0x17f73d,_0x287d7b[_0xb373('0x30')])){return;}var _0x3d1585=_['find'](_0x283af5,[_0xb373('0x2e'),_0x287d7b['role']])['name'];return db[_0xb373('0x31')][_0xb373('0x26')]({'where':{'type':_0x3d1585,'resourceId':_0x287d7b['id']}})[_0xb373('0x27')](function(){return _0x139068;});})[_0xb373('0x27')](function(){_0x2cd383[_0xb373('0x1d')](0xcc)[_0xb373('0x32')]();});}};}function handleEntityNotFound(_0x56bc33){return function(_0x1ec180){if(!_0x1ec180){_0x56bc33['sendStatus'](0x194);}return _0x1ec180;};}function handleError(_0x589a6e,_0x28fcb9){_0x28fcb9=_0x28fcb9||0x1f4;return function(_0x4e8377){logger[_0xb373('0x19')](_0x4e8377[_0xb373('0x33')]);if(_0x4e8377['name']){delete _0x4e8377[_0xb373('0x34')];}_0x589a6e[_0xb373('0x1d')](_0x28fcb9)[_0xb373('0x35')](_0x4e8377);};}exports['index']=function(_0x4cb227,_0x506e6e){var _0x52f3b5={},_0x122c2b={'count':0x0,'rows':[]};var _0xf57bc8=_(db[_0xb373('0x36')][_0xb373('0x37')])[_0xb373('0x2d')](function(_0x570629){return{'name':_0x570629['fieldName'],'type':_0x570629['type']['key']};})['filter'](function(_0x166a81){return!_[_0xb373('0x2f')]([_0xb373('0x38'),_0xb373('0x39')],_0x166a81[_0xb373('0x34')]);})['value']();_0x52f3b5=qs[_0xb373('0x3a')](_0xf57bc8,_0x4cb227);var _0xa6794b={'where':_0x52f3b5[_0xb373('0x3b')]};return db[_0xb373('0x36')][_0xb373('0x22')](_0xa6794b)[_0xb373('0x27')](function(_0x73c06){_0x122c2b[_0xb373('0x22')]=_0x73c06;if(_0x4cb227[_0xb373('0x3c')][_0xb373('0x3d')]){_0x52f3b5[_0xb373('0x3e')]=[{'all':!![]}];}if(_0x4cb227[_0xb373('0x3c')]['userSetting']===_0xb373('0x3f')){_0x52f3b5['include']=[{'model':db[_0xb373('0x40')],'as':_0xb373('0x41')}];}if(!_['includes'](_0x52f3b5[_0xb373('0x42')],'id')){_0x52f3b5['attributes'][_0xb373('0x43')]('id');}return db[_0xb373('0x36')][_0xb373('0x44')](_0x52f3b5);})[_0xb373('0x27')](function(_0x45835b){_0x122c2b[_0xb373('0x45')]=_0x45835b;if(_0x4cb227[_0xb373('0x3c')][_0xb373('0x46')]===_0xb373('0x3f')){var _0x2c7a7d=[];for(var _0x4c0fd2=0x0;_0x4c0fd2<_0x122c2b[_0xb373('0x45')][_0xb373('0x47')];_0x4c0fd2++){_0x2c7a7d[_0xb373('0x43')](get_open_tabs(_0xb373('0x48'),_0x122c2b[_0xb373('0x45')][_0x4c0fd2]['dataValues']));_0x2c7a7d['push'](get_open_tabs(_0xb373('0x49'),_0x122c2b['rows'][_0x4c0fd2][_0xb373('0x4a')]));_0x2c7a7d[_0xb373('0x43')](get_open_tabs(_0xb373('0x4b'),_0x122c2b[_0xb373('0x45')][_0x4c0fd2][_0xb373('0x4a')]));_0x2c7a7d[_0xb373('0x43')](get_open_tabs(_0xb373('0x4c'),_0x122c2b[_0xb373('0x45')][_0x4c0fd2][_0xb373('0x4a')]));_0x2c7a7d[_0xb373('0x43')](get_open_tabs(_0xb373('0x4d'),_0x122c2b['rows'][_0x4c0fd2]['dataValues']));_0x2c7a7d[_0xb373('0x43')](get_open_tabs(_0xb373('0x4e'),_0x122c2b[_0xb373('0x45')][_0x4c0fd2][_0xb373('0x4a')]));}return BPromise['all'](_0x2c7a7d)['then'](function(){return _0x122c2b;});}else{return _0x122c2b;}})[_0xb373('0x27')](respondWithFilteredResult(_0x506e6e,_0x52f3b5))[_0xb373('0x1c')](handleError(_0x506e6e,null));};exports['show']=function(_0x285b97,_0x496659){var _0x144b5d={'raw':![],'where':{'id':_0x285b97['params']['id']}},_0x81fe4f={};_0x81fe4f['model']=_['differenceBy'](_[_0xb373('0x4f')](db[_0xb373('0x36')][_0xb373('0x37')]),[_0xb373('0x38'),_0xb373('0x39')]);_0x81fe4f[_0xb373('0x3c')]=_[_0xb373('0x4f')](_0x285b97[_0xb373('0x3c')]);_0x81fe4f['filters']=_[_0xb373('0x50')](_0x81fe4f['model'],_0x81fe4f[_0xb373('0x3c')]);_0x144b5d[_0xb373('0x42')]=_['intersection'](_0x81fe4f[_0xb373('0x51')],qs['fields'](_0x285b97[_0xb373('0x3c')][_0xb373('0x52')]));_0x144b5d[_0xb373('0x42')]=_0x144b5d['attributes'][_0xb373('0x47')]?_0x144b5d['attributes']:_0x81fe4f[_0xb373('0x51')];if(_0x285b97['query'][_0xb373('0x3d')]){_0x144b5d[_0xb373('0x3e')]=[{'all':!![]}];}if(_0x285b97[_0xb373('0x3c')]['userSetting']===_0xb373('0x3f')){_0x144b5d['include']=[{'model':db[_0xb373('0x40')],'as':'userSetting'}];}_0x144b5d=_['merge']({},_0x144b5d,_0x285b97[_0xb373('0x53')]);if(!_['includes'](_0x144b5d[_0xb373('0x42')],'id')){_0x144b5d[_0xb373('0x42')][_0xb373('0x43')]('id');}return db[_0xb373('0x36')][_0xb373('0x54')](_0x144b5d)[_0xb373('0x27')](handleEntityNotFound(_0x496659,null))['then'](function(_0x4fa750){var _0x3ddfe3=[];values=_0x4fa750;if(_0x285b97[_0xb373('0x3c')][_0xb373('0x46')]===_0xb373('0x3f')){_0x3ddfe3['push'](get_open_tabs(_0xb373('0x48'),_0x4fa750['dataValues']));_0x3ddfe3[_0xb373('0x43')](get_open_tabs(_0xb373('0x49'),_0x4fa750['dataValues']));_0x3ddfe3[_0xb373('0x43')](get_open_tabs(_0xb373('0x4d'),_0x4fa750[_0xb373('0x4a')]));_0x3ddfe3[_0xb373('0x43')](get_open_tabs('whatsapp',_0x4fa750[_0xb373('0x4a')]));_0x3ddfe3['push'](get_open_tabs(_0xb373('0x4b'),_0x4fa750[_0xb373('0x4a')]));_0x3ddfe3[_0xb373('0x43')](get_open_tabs(_0xb373('0x4c'),_0x4fa750[_0xb373('0x4a')]));return BPromise['all'](_0x3ddfe3);}else{return values;}})[_0xb373('0x27')](function(){return values;})['then'](respondWithResult(_0x496659,null))['catch'](handleError(_0x496659,null));};exports[_0xb373('0x25')]=function(_0x4853a2,_0x16863b){if(_0x4853a2[_0xb373('0x55')]['id']){delete _0x4853a2['body']['id'];}delete _0x4853a2[_0xb373('0x55')][_0xb373('0x30')];return db[_0xb373('0x36')][_0xb373('0x54')]({'where':{'id':_0x4853a2[_0xb373('0x56')]['id']}})[_0xb373('0x27')](handleEntityNotFound(_0x16863b,null))['then'](saveUpdates(_0x4853a2[_0xb373('0x55')],null))[_0xb373('0x27')](respondWithResult(_0x16863b,null))[_0xb373('0x1c')](handleError(_0x16863b,null));};exports[_0xb373('0x57')]=function(_0x3abcae,_0x379944){return db['User'][_0xb373('0x57')]()['then'](respondWithResult(_0x379944,null))['catch'](handleError(_0x379944,null));};exports['addContacts']=function(_0x2af4a5,_0x55eb7f){return db[_0xb373('0x36')][_0xb373('0x54')]({'where':{'id':_0x2af4a5[_0xb373('0x56')]['id']}})[_0xb373('0x27')](handleEntityNotFound(_0x55eb7f,null))[_0xb373('0x27')](function(_0x4ee169){if(_0x4ee169){return _0x4ee169[_0xb373('0x58')](_0x2af4a5[_0xb373('0x55')][_0xb373('0x59')],_[_0xb373('0x5a')](_0x2af4a5[_0xb373('0x55')],[_0xb373('0x59'),'id'])||{});}})[_0xb373('0x27')](respondWithResult(_0x55eb7f,null))[_0xb373('0x1c')](handleError(_0x55eb7f,null));};function validateUser(_0x5f42b3){return new BPromise(function(_0x3e92c0,_0x19cc6e){if(_0x5f42b3['internal'])return _0x3e92c0(_0x5f42b3);return db[_0xb373('0x5b')][_0xb373('0x5c')](0x1)['then'](function(_0x516229){if(_0x516229[_0xb373('0x5d')])authService[_0xb373('0x5e')](_0x5f42b3[_0xb373('0x38')]);db['User'][_0xb373('0x5f')]('internal')[_0xb373('0x27')](function(_0x101d35){if(_[_0xb373('0x60')](_0x101d35)){_0x5f42b3[_0xb373('0x61')]=_0x516229[_0xb373('0x62')]||0x1;return;}if(_[_0xb373('0x60')](_0x516229[_0xb373('0x62')])||_0x516229[_0xb373('0x62')]===_0x101d35){_0x5f42b3[_0xb373('0x61')]=_0x101d35+0x1;return;}if(_0x516229[_0xb373('0x62')]>_0x101d35){_0x5f42b3['internal']=_0x516229[_0xb373('0x62')];return;}return db['sequelize'][_0xb373('0x3c')](_0xb373('0x63'),{'type':db[_0xb373('0x64')][_0xb373('0x65')][_0xb373('0x66')]})[_0xb373('0x27')](function(_0x1a2d09){if(_0x1a2d09&&_0x1a2d09[_0xb373('0x47')]){for(var _0x4eaecf=0x0,_0x35b9eb=_0x1a2d09[_0xb373('0x47')];_0x4eaecf<_0x35b9eb&&_['isNil'](_0x5f42b3[_0xb373('0x61')]);_0x4eaecf++){if(_0x516229[_0xb373('0x62')]<=_0x1a2d09[_0x4eaecf][_0xb373('0x67')]){_0x5f42b3[_0xb373('0x61')]=_0x1a2d09[_0x4eaecf][_0xb373('0x67')];}else if(_0x516229[_0xb373('0x62')]>_0x1a2d09[_0x4eaecf][_0xb373('0x67')]&&_0x516229[_0xb373('0x62')]<=_0x1a2d09[_0x4eaecf]['to']){_0x5f42b3[_0xb373('0x61')]=_0x516229[_0xb373('0x62')];}}}if(_['isNil'](_0x5f42b3[_0xb373('0x61')])){_0x5f42b3[_0xb373('0x61')]=_0x101d35+0x1;}return _0x3e92c0(_0x5f42b3);});});})['catch'](function(_0x512790){_0x19cc6e(_0x512790);});});}function updateUser(_0x39dae3){return new BPromise(function(_0x43d93d,_0x4e10b8){try{if(_0x39dae3[_0xb373('0x68')]){_0x39dae3[_0xb373('0x69')]=_0x39dae3[_0xb373('0x61')];_0x39dae3[_0xb373('0x6a')]={'mailbox':_0x39dae3['internal'],'password':_0x39dae3[_0xb373('0x38')],'fullname':_0x39dae3['fullname'],'email':_0x39dae3[_0xb373('0x6b')]};}if(_0x39dae3[_0xb373('0x30')]===_0xb373('0x29')){if(!_0x39dae3[_0xb373('0x6c')])_0x39dae3['permissions']=[_0xb373('0x6d'),'102',_0xb373('0x6e'),'113',_0xb373('0x6f'),_0xb373('0x70'),_0xb373('0x71'),'106',_0xb373('0x72'),_0xb373('0x73'),'109',_0xb373('0x74'),_0xb373('0x75'),_0xb373('0x76'),'115'];}_0x43d93d(_0x39dae3);}catch(_0x7fa7e6){_0x4e10b8(_0x7fa7e6);}});}exports[_0xb373('0x77')]=function(_0x146b48,_0x3789d0){if(_0x146b48['user'][_0xb373('0x30')]===_0xb373('0x29'))throw new Error(_0xb373('0x78'));if(_0x146b48['body'][_0xb373('0x30')]===_0xb373('0x79')&&_0x146b48['user'][_0xb373('0x30')]!==_0xb373('0x7a')){throw new Error(_0xb373('0x7b'));}if(_0x146b48[_0xb373('0x55')][_0xb373('0x30')]==='admin'&&_0x146b48[_0xb373('0x79')][_0xb373('0x30')]!==_0xb373('0x7a')){throw new Error(_0xb373('0x7c'));}return licenseUtil[_0xb373('0x7d')]([_0x146b48['body']])[_0xb373('0x27')](function(){return validateUser(_0x146b48[_0xb373('0x55')]);})[_0xb373('0x27')](function(_0x53cf58){return updateUser(_0x53cf58)[_0xb373('0x27')](function(_0x32127a){if(_0x32127a[_0xb373('0x30')]===_0xb373('0x7a')){_0x32127a[_0xb373('0x7e')]=_0x146b48[_0xb373('0x79')][_0xb373('0x7e')];delete _0x32127a[_0xb373('0x7f')];}return _0x32127a;});})[_0xb373('0x27')](function(_0x2e12e1){return db['User'][_0xb373('0x77')](_0x2e12e1,{'include':[{'model':db[_0xb373('0x6a')],'as':_0xb373('0x6a')}]});})[_0xb373('0x27')](function(_0x27370e){if(_0x146b48[_0xb373('0x55')][_0xb373('0x30')]===_0xb373('0x79'))return _0x27370e;if(_0x146b48[_0xb373('0x79')][_0xb373('0x30')]!==_0xb373('0x79'))return _0x27370e;return db['UserProfileSection'][_0xb373('0x54')]({'where':{'name':_0x27370e['role']==='agent'?'Agents':'Telephones','userProfileId':_0x146b48[_0xb373('0x79')][_0xb373('0x7f')]},'raw':!![]})['then'](function(_0x5337aa){if(!_0x5337aa||_0x5337aa[_0xb373('0x80')]!=0x0)return _0x27370e;return db[_0xb373('0x31')][_0xb373('0x77')]({'name':_0x27370e[_0xb373('0x34')],'resourceId':_0x27370e['id'],'type':_0x5337aa[_0xb373('0x34')],'sectionId':_0x5337aa['id']},{})[_0xb373('0x27')](function(){return _0x27370e;});})['catch'](function(_0x14e505){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x14e505);throw _0x14e505;});})[_0xb373('0x27')](respondWithResult(_0x3789d0,0xc9))[_0xb373('0x1c')](handleError(_0x3789d0,null));};exports[_0xb373('0x81')]=function(_0x173eaa,_0x46c645){var _0x4e68f3=_0x173eaa[_0xb373('0x55')];var _0x3d2c10=[];if(_0x173eaa[_0xb373('0x79')]['role']===_0xb373('0x29'))throw new Error(_0xb373('0x78'));if(_[_0xb373('0x82')](_0x4e68f3,[_0xb373('0x30'),_0xb373('0x79')])&&_0x173eaa[_0xb373('0x79')][_0xb373('0x30')]!==_0xb373('0x7a')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_[_0xb373('0x82')](_0x4e68f3,[_0xb373('0x30'),'admin'])&&_0x173eaa[_0xb373('0x79')][_0xb373('0x30')]!==_0xb373('0x7a')){throw new Error(_0xb373('0x83'));}return licenseUtil[_0xb373('0x7d')](_0x4e68f3)[_0xb373('0x27')](function(){return validateUser(_0x4e68f3[0x0]);})[_0xb373('0x27')](function(){for(var _0x35d9ed=0x1;_0x35d9ed<_0x4e68f3['length'];_0x35d9ed++){var _0xbafd61=_0x4e68f3[_0x35d9ed-0x1]['internal'];if(!_0x4e68f3[_0x35d9ed]['internal'])_0x4e68f3[_0x35d9ed]['internal']=_0xbafd61+0x1;_0x3d2c10[_0xb373('0x43')](validateUser(_0x4e68f3[_0x35d9ed]));}return BPromise['all'](_0x3d2c10);})['then'](function(){_0x3d2c10=[];for(var _0x3afde2=0x0;_0x3afde2<_0x4e68f3['length'];_0x3afde2++){_0x3d2c10[_0xb373('0x43')](updateUser(_0x4e68f3[_0x3afde2]));}return BPromise['all'](_0x3d2c10);})[_0xb373('0x27')](function(){return BPromise['each'](_0x4e68f3,function(_0x25df81){return db['User'][_0xb373('0x77')](_0x25df81,{'include':[{'model':db[_0xb373('0x6a')],'as':_0xb373('0x6a')}]})[_0xb373('0x27')](function(_0x51c95a){_0x25df81['id']=_0x51c95a['id'];return _0x25df81;});});})['then'](function(_0x23247d){if(_0x173eaa['body'][_0xb373('0x30')]===_0xb373('0x79'))return _0x23247d;if(_0x173eaa[_0xb373('0x79')][_0xb373('0x30')]!==_0xb373('0x79'))return _0x23247d;var _0x2ab2d9=_[_0xb373('0x82')](_0x23247d,function(_0x292372){return _0x292372[_0xb373('0x30')]===_0xb373('0x29')||_0x292372[_0xb373('0x30')]==='telephone';});if(!_0x2ab2d9)return _0x23247d;return db[_0xb373('0x84')][_0xb373('0x44')]({'where':{'name':{'$or':[_0xb373('0x85'),_0xb373('0x2a')]},'userProfileId':_0x173eaa[_0xb373('0x79')]['userProfileId']},'raw':!![]})[_0xb373('0x27')](function(_0x5748ba){if(_[_0xb373('0x86')](_0x5748ba)||!_[_0xb373('0x82')](_0x5748ba,[_0xb373('0x80'),0x0]))return _0x23247d;_0x3d2c10=[];var _0x4930e5=_(_0x5748ba)['map'](function(_0x63ecdd){if(_0x63ecdd[_0xb373('0x80')]===0x1)return;return _0x63ecdd[_0xb373('0x34')]===_0xb373('0x85')?_0xb373('0x29'):_0xb373('0x87');})[_0xb373('0x88')]()[_0xb373('0x2e')]();for(var _0x46d15e=0x0;_0x46d15e<_0x23247d[_0xb373('0x47')];_0x46d15e++){if(!_[_0xb373('0x2f')](_0x4930e5,_0x23247d[_0x46d15e]['role']))return;var _0x2c6308=_0x23247d[_0x46d15e]['role']===_0xb373('0x29')?_0xb373('0x85'):'Telephones';_0x3d2c10[_0xb373('0x43')](db[_0xb373('0x31')]['create']({'name':_0x23247d[_0x46d15e][_0xb373('0x34')],'resourceId':_0x23247d[_0x46d15e]['id'],'type':_0x2c6308,'sectionId':_[_0xb373('0x54')](_0x5748ba,[_0xb373('0x34'),_0x2c6308])['id']},{}));}return BPromise[_0xb373('0x89')](_0x3d2c10);});})['then'](respondWithResult(_0x46c645,0xc9))[_0xb373('0x1c')](handleError(_0x46c645,null));};exports[_0xb373('0x8a')]=function(_0x2527f3,_0x2624f4){if(_0x2527f3[_0xb373('0x55')]['id']){delete _0x2527f3[_0xb373('0x55')]['id'];}return db[_0xb373('0x36')][_0xb373('0x54')]({'where':{'id':_0x2527f3[_0xb373('0x56')]['id']}})['then'](function(_0x4f6d9a){if(!_0x4f6d9a)return null;if(_0x4f6d9a['id']===_0x2527f3[_0xb373('0x79')]['id']){if(!_0x2527f3['body'][_0xb373('0x8b')]||!_0x2527f3[_0xb373('0x55')][_0xb373('0x8c')]){throw new db[(_0xb373('0x8d'))]['ValidationError']('Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword');}if(!_0x4f6d9a[_0xb373('0x8e')](_0x2527f3[_0xb373('0x55')][_0xb373('0x8b')])){throw new db[(_0xb373('0x8d'))][(_0xb373('0x8f'))](_0xb373('0x90'));}if(_0x2527f3[_0xb373('0x55')][_0xb373('0x8b')]===_0x2527f3[_0xb373('0x55')][_0xb373('0x8c')]){throw new db['Sequelize']['ValidationError'](_0xb373('0x91'));}}else if(_0x2527f3[_0xb373('0x79')][_0xb373('0x30')]===_0xb373('0x7a')){if(!_0x2527f3[_0xb373('0x55')]['newPassword']){throw new db[(_0xb373('0x8d'))][(_0xb373('0x8f'))](_0xb373('0x92'));}}else if(_0x2527f3[_0xb373('0x79')][_0xb373('0x30')]==='user'){if(!_0x2527f3[_0xb373('0x55')][_0xb373('0x8c')]){throw new db[(_0xb373('0x8d'))]['ValidationError'](_0xb373('0x92'));}if(_0x4f6d9a[_0xb373('0x30')]!=='agent'){throw new db[(_0xb373('0x8d'))][(_0xb373('0x8f'))]('Unauthorized');}}else{throw new db['Sequelize'][(_0xb373('0x8f'))](_0xb373('0x78'));}return _0x4f6d9a;})[_0xb373('0x27')](handleEntityNotFound(_0x2624f4,null))['then'](function(_0x16cc52){return db[_0xb373('0x5b')][_0xb373('0x93')]({'attributes':['id','securePassword',_0xb373('0x94'),_0xb373('0x95')]})[_0xb373('0x27')](function(_0x43c6bf){if(_0x43c6bf[_0xb373('0x5d')])authService['validatePasswordPattern'](_0x2527f3[_0xb373('0x55')][_0xb373('0x8c')]);if(!_0x43c6bf[_0xb373('0x94')]||!_0x16cc52[_0xb373('0x96')])return _0x16cc52;authService[_0xb373('0x97')](_0x2527f3[_0xb373('0x55')]['newPassword'],_0x16cc52[_0xb373('0x96')],_0x43c6bf[_0xb373('0x95')]);return _0x16cc52;})['then'](saveUpdates({'password':_0x2527f3[_0xb373('0x55')]['newPassword'],'passwordResetAt':_0x2527f3[_0xb373('0x79')]['id']==_0x2527f3[_0xb373('0x56')]['id']?moment():null,'previousPasswords':authService[_0xb373('0x98')](_0x2527f3['body']['newPassword'],_0x16cc52[_0xb373('0x96')])},null));})[_0xb373('0x27')](respondWithResult(_0x2624f4,null))[_0xb373('0x1c')](handleError(_0x2624f4,null));};exports['addQueues']=function(_0x5c3fce,_0x20908a){var _0x35bc9f=_0x5c3fce['body'][_0xb373('0x99')];return db[_0xb373('0x36')][_0xb373('0x54')]({'where':{'id':_0x5c3fce[_0xb373('0x56')]['id']},'attributes':['id','name','role','online',_0xb373('0x9a'),'voicePause',_0xb373('0x9b')]})['then'](handleEntityNotFound(_0x20908a,null))[_0xb373('0x27')](function(_0x51fed9){if(_0x51fed9){if(!utils[_0xb373('0x9c')](_0x35bc9f)){throw new db[(_0xb373('0x8d'))][(_0xb373('0x8f'))](_0xb373('0x9d'));}return _0x51fed9['add'+_[_0xb373('0x9e')](_0x35bc9f[_0xb373('0x9f')]())+_0xb373('0xa0')](_0x5c3fce[_0xb373('0x55')][_0xb373('0x59')],{'penalty':_0x5c3fce[_0xb373('0x55')][_0xb373('0xa1')]||0x0})[_0xb373('0xa2')](function(_0x340bfd){for(var _0x39a9c4=0x0;_0x39a9c4<_0x5c3fce[_0xb373('0x55')]['ids']['length'];_0x39a9c4+=0x1){var _0x1fc2dc={'UserId':Number(_0x5c3fce[_0xb373('0x56')]['id'])};_0x1fc2dc[_[_0xb373('0x9e')](_0x35bc9f[_0xb373('0x9f')]())+_0xb373('0xa3')]=Number(_0x5c3fce['body'][_0xb373('0x59')][_0x39a9c4]);socket[_0xb373('0xa4')](_0xb373('0x79')+_[_0xb373('0x9e')](_0x35bc9f[_0xb373('0x9f')]())+_0xb373('0xa5'),_0x1fc2dc);}return _0x340bfd;})[_0xb373('0x27')](function(){if(_0x35bc9f===_0xb373('0xa6')){return db[_0xb373('0xa7')][_0xb373('0x44')]({'where':{'id':_0x5c3fce[_0xb373('0x55')][_0xb373('0x59')]||[]},'raw':!![],'attributes':['id',_0xb373('0x34')]});}})[_0xb373('0x27')](function(_0x315874){var _0x38c7df=_0x51fed9['get']({'plain':!![]});var _0x291149=[];if(_0x35bc9f==='voice'&&_0x38c7df[_0xb373('0x30')]===_0xb373('0x29')&&_0x38c7df[_0xb373('0xa8')]){for(var _0x206631=0x0;_0x206631<_0x315874[_0xb373('0x47')];_0x206631+=0x1){_0x291149['push']({'membername':_0x38c7df[_0xb373('0x34')],'UserId':_0x38c7df['id'],'queue_name':_0x315874[_0x206631][_0xb373('0x34')],'VoiceQueueId':_0x315874[_0x206631]['id'],'interface':_[_0xb373('0x60')](_0x38c7df[_0xb373('0x9b')])?util['format'](_0xb373('0xa9'),_0x38c7df[_0xb373('0x34')]):_0x38c7df[_0xb373('0x9b')],'paused':_0x38c7df['voicePause']||![],'penalty':_0x5c3fce[_0xb373('0x55')]['penalty']||0x0});}return BPromise[_0xb373('0xaa')](_0x291149,function(_0x53cb03){return db['UserVoiceQueueRt'][_0xb373('0xab')](_0x53cb03);});}return _0x51fed9;});}})[_0xb373('0x27')](respondWithStatusCode(_0x20908a,null))[_0xb373('0x1c')](handleError(_0x20908a,null));};exports[_0xb373('0xac')]=function(_0xbeef42,_0x301e1f){var _0x44e5e0,_0xef7714;return db['User'][_0xb373('0x54')]({'where':{'id':_0xbeef42[_0xb373('0x56')]['id']},'attributes':['id',_0xb373('0x34'),_0xb373('0x30')]})[_0xb373('0x27')](handleEntityNotFound(_0x301e1f,null))[_0xb373('0x27')](function(_0x2e172e){if(_0x2e172e){_0x44e5e0=_0x2e172e;if(!_0xbeef42[_0xb373('0x3c')][_0xb373('0x99')]||!utils[_0xb373('0x9c')](_0xbeef42[_0xb373('0x3c')][_0xb373('0x99')])){throw new db['Sequelize']['ValidationError'](_0xb373('0x9d'));}return _0x2e172e['remove'+_[_0xb373('0x9e')](_0xbeef42['query'][_0xb373('0x99')][_0xb373('0x9f')]())+_0xb373('0xa0')](_0xbeef42[_0xb373('0x3c')]['ids']);}})[_0xb373('0x27')](function(_0xb2df2){if(_[_0xb373('0xad')](_0xbeef42['query'][_0xb373('0x59')])){for(var _0xe9c959=0x0;_0xe9c959<_0xbeef42['query'][_0xb373('0x59')][_0xb373('0x47')];_0xe9c959+=0x1){_0xef7714={'UserId':Number(_0xbeef42['params']['id'])};_0xef7714[_[_0xb373('0x9e')](_0xbeef42[_0xb373('0x3c')][_0xb373('0x99')][_0xb373('0x9f')]())+'QueueId']=Number(_0xbeef42[_0xb373('0x3c')][_0xb373('0x59')][_0xe9c959]);socket['emit'](_0xb373('0x79')+_[_0xb373('0x9e')](_0xbeef42[_0xb373('0x3c')][_0xb373('0x99')]['toLowerCase']())+_0xb373('0xae'),_0xef7714);}}else{_0xef7714={'UserId':Number(_0xbeef42[_0xb373('0x56')]['id'])};_0xef7714[_[_0xb373('0x9e')](_0xbeef42[_0xb373('0x3c')][_0xb373('0x99')][_0xb373('0x9f')]())+_0xb373('0xa3')]=Number(_0xbeef42[_0xb373('0x3c')][_0xb373('0x59')]);socket[_0xb373('0xa4')](_0xb373('0x79')+_[_0xb373('0x9e')](_0xbeef42[_0xb373('0x3c')]['channel']['toLowerCase']())+_0xb373('0xae'),_0xef7714);}return _0xb2df2;})[_0xb373('0x27')](function(){if(_0xbeef42[_0xb373('0x3c')][_0xb373('0x99')]==='voice'){return db[_0xb373('0xaf')][_0xb373('0x26')]({'where':{'UserId':_0xbeef42[_0xb373('0x56')]['id'],'VoiceQueueId':_0xbeef42[_0xb373('0x3c')][_0xb373('0x59')]},'individualHooks':!![]})[_0xb373('0x27')](function(){return _0x44e5e0;});}return _0x44e5e0;})['then'](respondWithStatusCode(_0x301e1f,null))[_0xb373('0x1c')](handleError(_0x301e1f,null));};exports[_0xb373('0xb0')]=function(_0x2d02cc,_0x54fce3){_0x2d02cc[_0xb373('0x55')][_0xb373('0xb1')]=_0x2d02cc['file'][_0xb373('0xb2')];return db[_0xb373('0x36')][_0xb373('0x54')]({'where':{'id':_0x2d02cc[_0xb373('0x56')]['id']}})[_0xb373('0x27')](handleEntityNotFound(_0x54fce3,null))[_0xb373('0x27')](saveUpdates(_0x2d02cc['body'],null))[_0xb373('0x27')](respondWithResult(_0x54fce3,null))[_0xb373('0x1c')](handleError(_0x54fce3,null));};exports['getAvatar']=function(_0x2fca2e,_0x5c6b6b){var _0x5d9fdd=path[_0xb373('0xb3')](config[_0xb373('0xb4')],_0xb373('0xb5'));return db[_0xb373('0x36')]['find']({'where':{'id':_0x2fca2e[_0xb373('0x56')]['id']},'attributes':['id','userpic'],'raw':!![]})[_0xb373('0x27')](handleEntityNotFound(_0x5c6b6b,null))[_0xb373('0x27')](function(_0x103a31){if(_0x103a31){if(_['isNil'](_0x103a31[_0xb373('0xb1')])){return _0x5c6b6b[_0xb373('0xb6')](_0x5d9fdd);}else{if(!fs[_0xb373('0xb7')](path[_0xb373('0xb3')](config[_0xb373('0xb4')],_0xb373('0xb8'),_0x103a31[_0xb373('0xb1')]))){return _0x5c6b6b[_0xb373('0xb6')](_0x5d9fdd);}return _0x5c6b6b[_0xb373('0xb6')](path[_0xb373('0xb3')](config[_0xb373('0xb4')],'server/files/images/',_0x103a31[_0xb373('0xb1')]));}}})[_0xb373('0x1c')](handleError(_0x5c6b6b,null));};exports[_0xb373('0xb9')]=function(_0x4df320,_0x3953f8){return db[_0xb373('0x36')][_0xb373('0x54')]({'where':{'id':_0x4df320[_0xb373('0x56')]['id']},'attributes':['id']})[_0xb373('0x27')](handleEntityNotFound(_0x3953f8,null))['then'](function(_0x1946d8){var _0x28af12=[];values=_0x1946d8[_0xb373('0x4a')];_0x28af12[_0xb373('0x43')](get_open_tabs('chat',_0x1946d8['dataValues']));_0x28af12['push'](get_open_tabs(_0xb373('0x49'),_0x1946d8[_0xb373('0x4a')]));_0x28af12[_0xb373('0x43')](get_open_tabs(_0xb373('0x4d'),_0x1946d8[_0xb373('0x4a')]));_0x28af12['push'](get_open_tabs(_0xb373('0x4e'),_0x1946d8['dataValues']));_0x28af12['push'](get_open_tabs('fax',_0x1946d8[_0xb373('0x4a')]));_0x28af12[_0xb373('0x43')](get_open_tabs(_0xb373('0x4c'),_0x1946d8[_0xb373('0x4a')]));return BPromise['all'](_0x28af12);})['then'](function(_0x25b6e7){if(_0x25b6e7){var _0x340306=_[_0xb373('0x2d')](values[_0xb373('0xba')],function(_0x4ca066){return{'channel':_0xb373('0xbb'),'id':_0x4ca066['id'],'createdAt':_0x4ca066[_0xb373('0xbc')]};});var _0x425bd2=_[_0xb373('0x2d')](values[_0xb373('0xbd')],function(_0x924e46){return{'channel':_0xb373('0xbe'),'id':_0x924e46['id'],'createdAt':_0x924e46[_0xb373('0xbc')]};});var _0x26c7dd=_[_0xb373('0x2d')](values[_0xb373('0xbf')],function(_0x5cc85e){return{'channel':_0xb373('0xc0'),'id':_0x5cc85e['id'],'createdAt':_0x5cc85e['createdAt']};});var _0x5ac91e=_[_0xb373('0x2d')](values['MailOpenTabs'],function(_0x4b7e03){return{'channel':_0xb373('0xc1'),'id':_0x4b7e03['id'],'createdAt':_0x4b7e03['createdAt']};});var _0x362c15=_[_0xb373('0x2d')](values[_0xb373('0xc2')],function(_0x67cb17){return{'channel':_0xb373('0xc3'),'id':_0x67cb17['id'],'createdAt':_0x67cb17[_0xb373('0xbc')]};});var _0xde702a=_['map'](values[_0xb373('0xc4')],function(_0x54ada9){return{'channel':_0xb373('0xc5'),'id':_0x54ada9['id'],'createdAt':_0x54ada9['createdAt']};});var _0x30470e=_[_0xb373('0xc6')](_0x340306,_0x425bd2,_0x26c7dd,_0x5ac91e,_0x362c15,_0xde702a);var _0x5ac8d2={'count':_0x30470e['length'],'rows':_0x30470e};return _0x5ac8d2;}else return null;})[_0xb373('0x27')](respondWithResult(_0x3953f8,null))[_0xb373('0x1c')](handleError(_0x3953f8,null));};exports[_0xb373('0xc7')]=function(_0x16cc74,_0x5abe34){var _0x205f28={};var _0x4e239c={};var _0x238ce7;var _0xcbf35c;return db[_0xb373('0x36')][_0xb373('0x93')]({'where':{'id':_0x16cc74[_0xb373('0x56')]['id']}})[_0xb373('0x27')](handleEntityNotFound(_0x5abe34,null))[_0xb373('0x27')](function(_0x7549a1){if(_0x7549a1){_0x238ce7=_0x7549a1;_0x4e239c['model']=_[_0xb373('0x4f')](db[_0xb373('0xc8')]['rawAttributes']);_0x4e239c[_0xb373('0x3c')]=_[_0xb373('0x4f')](_0x16cc74[_0xb373('0x3c')]);_0x4e239c[_0xb373('0xc9')]=_[_0xb373('0x50')](_0x4e239c[_0xb373('0x51')],_0x4e239c['query']);_0x205f28['attributes']=_['intersection'](_0x4e239c[_0xb373('0x51')],qs['fields'](_0x16cc74['query'][_0xb373('0x52')]));_0x205f28[_0xb373('0x42')]=_0x205f28['attributes'][_0xb373('0x47')]?_0x205f28[_0xb373('0x42')]:_0x4e239c[_0xb373('0x51')];_0x205f28[_0xb373('0xca')]=qs[_0xb373('0xcb')](_0x16cc74[_0xb373('0x3c')]['sort']);_0x205f28[_0xb373('0x3b')]=qs[_0xb373('0xc9')](_['pick'](_0x16cc74[_0xb373('0x3c')],_0x4e239c[_0xb373('0xc9')]));if(_0x16cc74[_0xb373('0x3c')]['filter']){_0x205f28[_0xb373('0x3b')]=_[_0xb373('0xcc')](_0x205f28['where'],{'$or':_['map'](_0x205f28['attributes'],function(_0x428306){var _0x4e455c={};_0x4e455c[_0x428306]={'$like':'%'+_0x16cc74['query'][_0xb373('0x2b')]+'%'};return _0x4e455c;})});}_0x205f28=_['merge']({},_0x205f28,_0x16cc74['options']);return _0x238ce7[_0xb373('0xc7')](_0x205f28);}})[_0xb373('0x27')](function(_0x4d10bb){if(_0x4d10bb){_0xcbf35c=_0x4d10bb['length'];if(_0x16cc74[_0xb373('0x3c')][_0xb373('0xcd')]('includeAll')){_0x205f28[_0xb373('0x3e')]=[{'model':db[_0xb373('0xce')],'as':_0xb373('0xcf'),'required':![]},{'model':db[_0xb373('0xd0')],'as':_0xb373('0xd1'),'attributes':['id',_0xb373('0x34'),_0xb373('0xd2')],'where':_0x16cc74[_0xb373('0x3c')]['tag']?{'id':_0x16cc74[_0xb373('0x3c')][_0xb373('0xd3')]}:undefined,'required':_0x16cc74[_0xb373('0x3c')][_0xb373('0xd3')]?!![]:![]}];}if(!_0x16cc74[_0xb373('0x3c')][_0xb373('0xcd')]('nolimit')){_0x205f28[_0xb373('0x21')]=qs[_0xb373('0x21')](_0x16cc74[_0xb373('0x3c')][_0xb373('0x21')]);_0x205f28[_0xb373('0x1f')]=qs[_0xb373('0x1f')](_0x16cc74[_0xb373('0x3c')]['offset']);}return _0x238ce7[_0xb373('0xc7')](_0x205f28);}})[_0xb373('0x27')](function(_0x54b9ad){if(_0x54b9ad){return _0x54b9ad?{'count':_0xcbf35c,'rows':_0x54b9ad}:null;}})['then'](respondWithResult(_0x5abe34,null))[_0xb373('0x1c')](handleError(_0x5abe34,null));};exports[_0xb373('0xd4')]=function(_0x76cb94,_0x3c141e){var _0x66ea41;var _0x16a8d8={};var _0x110752;return db['User'][_0xb373('0x93')]({'where':{'id':_0x76cb94[_0xb373('0x56')]['id']},'attributes':['id',_0xb373('0x34'),_0xb373('0x30')]})[_0xb373('0x27')](handleEntityNotFound(_0x3c141e,null))[_0xb373('0x27')](function(_0x4a2e92){if(!utils[_0xb373('0x9c')](_0x76cb94[_0xb373('0x3c')][_0xb373('0x99')])){throw new db[(_0xb373('0x8d'))][(_0xb373('0x8f'))](_0xb373('0x9d'));}_0x66ea41=_0x4a2e92;var _0x33fe4b={};_0x33fe4b['model']=_[_0xb373('0x4f')](db[_[_0xb373('0x9e')](_0x76cb94[_0xb373('0x3c')][_0xb373('0x99')])+'Queue'][_0xb373('0x37')]);_0x33fe4b[_0xb373('0x3c')]=_[_0xb373('0x4f')](_0x76cb94['query']);_0x33fe4b[_0xb373('0xc9')]=_['intersection'](_0x33fe4b[_0xb373('0x51')],_0x33fe4b['query']);_0x16a8d8[_0xb373('0x42')]=_[_0xb373('0x50')](_0x33fe4b['model'],qs['fields'](_0x76cb94[_0xb373('0x3c')][_0xb373('0x52')]));_0x16a8d8[_0xb373('0x42')]=_0x16a8d8[_0xb373('0x42')][_0xb373('0x47')]?_0x16a8d8[_0xb373('0x42')]:_0x33fe4b['model'];_0x16a8d8['order']=qs[_0xb373('0xcb')](_0x76cb94[_0xb373('0x3c')]['sort']);_0x16a8d8['where']=qs['filters'](_[_0xb373('0xd5')](_0x76cb94['query'],_0x33fe4b[_0xb373('0xc9')]));if(_0x76cb94['query'][_0xb373('0x2b')]){_0x16a8d8[_0xb373('0x3b')]=_['merge'](_0x16a8d8[_0xb373('0x3b')],{'$or':_[_0xb373('0x2d')](_0x16a8d8['attributes'],function(_0x97f807){var _0x23ec4a={};_0x23ec4a[_0x97f807]={'$like':'%'+_0x76cb94[_0xb373('0x3c')][_0xb373('0x2b')]+'%'};return _0x23ec4a;})});}_0x16a8d8=_['merge']({},_0x16a8d8,_0x76cb94[_0xb373('0x53')]);switch(_0x66ea41[_0xb373('0x30')]){case'admin':return db[_[_0xb373('0x9e')](_0x76cb94[_0xb373('0x3c')][_0xb373('0x99')])+_0xb373('0xd6')][_0xb373('0x44')](_0x16a8d8);case _0xb373('0x79'):case'agent':return _0x66ea41[_0xb373('0xd7')+_[_0xb373('0x9e')](_0x76cb94[_0xb373('0x3c')]['channel'])+'Queues'](_0x16a8d8);default:throw new db[(_0xb373('0x8d'))][(_0xb373('0x8f'))](_0xb373('0xd8'));}})[_0xb373('0x27')](function(_0x433c0a){_0x110752=_0x433c0a[_0xb373('0x47')];if(!_0x76cb94['query'][_0xb373('0xcd')](_0xb373('0xd9'))){_0x16a8d8[_0xb373('0x21')]=qs[_0xb373('0x21')](_0x76cb94[_0xb373('0x3c')][_0xb373('0x21')]);_0x16a8d8['offset']=qs['offset'](_0x76cb94['query']['offset']);}switch(_0x66ea41[_0xb373('0x30')]){case'admin':return db[_[_0xb373('0x9e')](_0x76cb94[_0xb373('0x3c')][_0xb373('0x99')])+_0xb373('0xd6')][_0xb373('0x44')](_0x16a8d8);case'user':case'agent':return _0x66ea41[_0xb373('0xd7')+_['capitalize'](_0x76cb94[_0xb373('0x3c')]['channel'])+_0xb373('0xa0')](_0x16a8d8);}})[_0xb373('0x27')](function(_0xfa3364){return{'count':_0x110752,'rows':_0xfa3364};})[_0xb373('0x27')](respondWithResult(_0x3c141e,null))[_0xb373('0x1c')](handleError(_0x3c141e,null));};exports[_0xb373('0xda')]=function(_0x373e9e,_0x53c021){var _0x4a3c84={};var _0x24496a={};var _0x59615b;var _0x580a36;return db[_0xb373('0x36')][_0xb373('0x93')]({'where':{'id':_0x373e9e[_0xb373('0x56')]['id']}})[_0xb373('0x27')](handleEntityNotFound(_0x53c021,null))[_0xb373('0x27')](function(_0x1449fb){if(_0x1449fb){_0x59615b=_0x1449fb;_0x24496a['model']=_[_0xb373('0x4f')](db[_0xb373('0xaf')][_0xb373('0x37')]);_0x24496a['query']=_['keys'](_0x373e9e[_0xb373('0x3c')]);_0x24496a[_0xb373('0xc9')]=_['intersection'](_0x24496a[_0xb373('0x51')],_0x24496a[_0xb373('0x3c')]);_0x4a3c84['attributes']=_['intersection'](_0x24496a[_0xb373('0x51')],qs['fields'](_0x373e9e[_0xb373('0x3c')][_0xb373('0x52')]));_0x4a3c84['attributes']=_0x4a3c84[_0xb373('0x42')][_0xb373('0x47')]?_0x4a3c84[_0xb373('0x42')]:_0x24496a['model'];_0x4a3c84[_0xb373('0xca')]=qs[_0xb373('0xcb')](_0x373e9e[_0xb373('0x3c')][_0xb373('0xcb')]);_0x4a3c84[_0xb373('0x3b')]=qs[_0xb373('0xc9')](_['pick'](_0x373e9e[_0xb373('0x3c')],_0x24496a[_0xb373('0xc9')]));if(_0x373e9e[_0xb373('0x3c')][_0xb373('0x2b')]){_0x4a3c84[_0xb373('0x3b')]=_['merge'](_0x4a3c84['where'],{'$or':_[_0xb373('0x2d')](_0x4a3c84[_0xb373('0x42')],function(_0xe831d6){var _0x3813d1={};_0x3813d1[_0xe831d6]={'$like':'%'+_0x373e9e[_0xb373('0x3c')][_0xb373('0x2b')]+'%'};return _0x3813d1;})});}_0x4a3c84=_[_0xb373('0xcc')]({},_0x4a3c84,_0x373e9e[_0xb373('0x53')]);return _0x59615b[_0xb373('0xda')](_0x4a3c84);}})[_0xb373('0x27')](function(_0x48afae){if(_0x48afae){_0x580a36=_0x48afae[_0xb373('0x47')];if(!_0x373e9e[_0xb373('0x3c')]['hasOwnProperty'](_0xb373('0xd9'))){_0x4a3c84[_0xb373('0x21')]=qs['limit'](_0x373e9e[_0xb373('0x3c')][_0xb373('0x21')]);_0x4a3c84['offset']=qs[_0xb373('0x1f')](_0x373e9e[_0xb373('0x3c')][_0xb373('0x1f')]);}return _0x59615b[_0xb373('0xda')](_0x4a3c84);}})[_0xb373('0x27')](function(_0xa481f7){if(_0xa481f7){return _0xa481f7?{'count':_0x580a36,'rows':_0xa481f7}:null;}})[_0xb373('0x27')](respondWithResult(_0x53c021,null))[_0xb373('0x1c')](handleError(_0x53c021,null));};exports[_0xb373('0xdb')]=function(_0x60c3c9,_0x1fddba){var _0x5c2637={};var _0x1d1b68={};var _0x5bb8c8;var _0x570e6b;return db['User'][_0xb373('0x93')]({'where':{'id':_0x60c3c9[_0xb373('0x56')]['id']}})['then'](handleEntityNotFound(_0x1fddba,null))[_0xb373('0x27')](function(_0x1e28d9){if(_0x1e28d9){_0x5bb8c8=_0x1e28d9;_0x1d1b68[_0xb373('0x51')]=_[_0xb373('0x4f')](db[_0xb373('0xdc')][_0xb373('0x37')]);_0x1d1b68[_0xb373('0x3c')]=_['keys'](_0x60c3c9[_0xb373('0x3c')]);_0x1d1b68['filters']=_['intersection'](_0x1d1b68[_0xb373('0x51')],_0x1d1b68[_0xb373('0x3c')]);_0x5c2637[_0xb373('0x42')]=_['intersection'](_0x1d1b68[_0xb373('0x51')],qs['fields'](_0x60c3c9['query'][_0xb373('0x52')]));_0x5c2637[_0xb373('0x42')]=_0x5c2637[_0xb373('0x42')][_0xb373('0x47')]?_0x5c2637[_0xb373('0x42')]:_0x1d1b68['model'];_0x5c2637[_0xb373('0xca')]=qs[_0xb373('0xcb')](_0x60c3c9[_0xb373('0x3c')]['sort']);_0x5c2637[_0xb373('0x3b')]=qs[_0xb373('0xc9')](_['pick'](_0x60c3c9[_0xb373('0x3c')],_0x1d1b68['filters']));if(_0x60c3c9[_0xb373('0x3c')][_0xb373('0x2b')]){_0x5c2637[_0xb373('0x3b')]=_[_0xb373('0xcc')](_0x5c2637[_0xb373('0x3b')],{'$or':_[_0xb373('0x2d')](_0x5c2637[_0xb373('0x42')],function(_0x55eb82){var _0x1b9231={};_0x1b9231[_0x55eb82]={'$like':'%'+_0x60c3c9[_0xb373('0x3c')][_0xb373('0x2b')]+'%'};return _0x1b9231;})});}_0x5c2637=_['merge']({},_0x5c2637,_0x60c3c9[_0xb373('0x53')]);return _0x5bb8c8[_0xb373('0xdb')](_0x5c2637);}})['then'](function(_0x452d71){if(_0x452d71){_0x570e6b=_0x452d71['length'];if(!_0x60c3c9[_0xb373('0x3c')][_0xb373('0xcd')](_0xb373('0xd9'))){_0x5c2637[_0xb373('0x21')]=qs[_0xb373('0x21')](_0x60c3c9[_0xb373('0x3c')][_0xb373('0x21')]);_0x5c2637[_0xb373('0x1f')]=qs['offset'](_0x60c3c9[_0xb373('0x3c')][_0xb373('0x1f')]);}return _0x5bb8c8['getGroups'](_0x5c2637);}})[_0xb373('0x27')](function(_0x1b88ad){if(_0x1b88ad){return _0x1b88ad?{'count':_0x570e6b,'rows':_0x1b88ad}:null;}})[_0xb373('0x27')](respondWithResult(_0x1fddba,null))[_0xb373('0x1c')](handleError(_0x1fddba,null));};exports[_0xb373('0xdd')]=function(_0x19a21a,_0x113f48){var _0x506e61={'raw':!![],'where':{}};var _0x3b5cc7={};var _0x6daade={'count':0x0,'rows':[]};return db['User'][_0xb373('0x93')]({'where':{'id':_0x19a21a['params']['id']}})[_0xb373('0x27')](handleEntityNotFound(_0x113f48,null))[_0xb373('0x27')](function(_0x824681){if(_0x824681){_0x3b5cc7[_0xb373('0x51')]=_[_0xb373('0x4f')](db[_0xb373('0xde')][_0xb373('0x37')]);_0x3b5cc7['query']=_[_0xb373('0x4f')](_0x19a21a['query']);_0x3b5cc7[_0xb373('0xc9')]=_[_0xb373('0x50')](_0x3b5cc7[_0xb373('0x51')],_0x3b5cc7['query']);_0x506e61[_0xb373('0x42')]=_[_0xb373('0x50')](_0x3b5cc7[_0xb373('0x51')],qs[_0xb373('0x52')](_0x19a21a[_0xb373('0x3c')][_0xb373('0x52')]));_0x506e61[_0xb373('0x42')]=_0x506e61[_0xb373('0x42')][_0xb373('0x47')]?_0x506e61[_0xb373('0x42')]:_0x3b5cc7[_0xb373('0x51')];if(!_0x19a21a[_0xb373('0x3c')][_0xb373('0xcd')](_0xb373('0xd9'))){_0x506e61[_0xb373('0x21')]=qs[_0xb373('0x21')](_0x19a21a[_0xb373('0x3c')][_0xb373('0x21')]);_0x506e61['offset']=qs[_0xb373('0x1f')](_0x19a21a[_0xb373('0x3c')]['offset']);}_0x506e61['order']=qs[_0xb373('0xcb')](_0x19a21a[_0xb373('0x3c')][_0xb373('0xcb')]);_0x506e61[_0xb373('0x3b')]=qs['filters'](_['pick'](_0x19a21a['query'],_0x3b5cc7[_0xb373('0xc9')]));_0x506e61[_0xb373('0x3b')][_0xb373('0xdf')]=_0x824681['id'];if(_0x19a21a['query']['filter']){_0x506e61[_0xb373('0x3b')]=_[_0xb373('0xcc')](_0x506e61[_0xb373('0x3b')],{'$or':_[_0xb373('0x2d')](_0x506e61[_0xb373('0x42')],function(_0x4be6ce){var _0x254d4d={};_0x254d4d[_0x4be6ce]={'$like':'%'+_0x19a21a[_0xb373('0x3c')][_0xb373('0x2b')]+'%'};return _0x254d4d;})});}_0x506e61=_[_0xb373('0xcc')]({},_0x506e61,_0x19a21a[_0xb373('0x53')]);return db['VoiceRecording'][_0xb373('0x22')]({'where':_0x506e61[_0xb373('0x3b')]})[_0xb373('0x27')](function(_0x3d9ac1){_0x6daade[_0xb373('0x22')]=_0x3d9ac1;if(_0x19a21a['query'][_0xb373('0x3d')]){_0x506e61[_0xb373('0x3e')]=[{'all':!![]}];}return db[_0xb373('0xde')][_0xb373('0x44')](_0x506e61);})[_0xb373('0x27')](function(_0x139fa7){_0x6daade['rows']=_0x139fa7;return _0x6daade;});}})[_0xb373('0x27')](respondWithFilteredResult(_0x113f48,_0x506e61))[_0xb373('0x1c')](handleError(_0x113f48,null));};exports[_0xb373('0xe0')]=function(_0x5563e8,_0x25224d){var _0x399a2a={'raw':!![],'where':{}};var _0x1dc978={};var _0x2fb6d2={'count':0x0,'rows':[]};return db[_0xb373('0x36')]['findOne']({'where':{'id':_0x5563e8['params']['id']}})[_0xb373('0x27')](handleEntityNotFound(_0x25224d,null))['then'](function(_0x31fab9){if(_0x31fab9){_0x1dc978['model']=_['keys'](db[_0xb373('0xe1')][_0xb373('0x37')]);_0x1dc978['query']=_['keys'](_0x5563e8[_0xb373('0x3c')]);_0x1dc978[_0xb373('0xc9')]=_[_0xb373('0x50')](_0x1dc978['model'],_0x1dc978['query']);_0x399a2a[_0xb373('0x42')]=_['intersection'](_0x1dc978[_0xb373('0x51')],qs['fields'](_0x5563e8['query'][_0xb373('0x52')]));_0x399a2a[_0xb373('0x42')]=_0x399a2a[_0xb373('0x42')]['length']?_0x399a2a[_0xb373('0x42')]:_0x1dc978[_0xb373('0x51')];if(!_0x5563e8[_0xb373('0x3c')]['hasOwnProperty']('nolimit')){_0x399a2a[_0xb373('0x21')]=qs['limit'](_0x5563e8['query'][_0xb373('0x21')]);_0x399a2a['offset']=qs['offset'](_0x5563e8[_0xb373('0x3c')][_0xb373('0x1f')]);}_0x399a2a['order']=qs[_0xb373('0xcb')](_0x5563e8[_0xb373('0x3c')][_0xb373('0xcb')]);_0x399a2a[_0xb373('0x3b')]=qs[_0xb373('0xc9')](_[_0xb373('0xd5')](_0x5563e8[_0xb373('0x3c')],_0x1dc978[_0xb373('0xc9')]));_0x399a2a['where'][_0xb373('0xdf')]=_0x31fab9['id'];if(_0x5563e8[_0xb373('0x3c')][_0xb373('0x2b')]){_0x399a2a[_0xb373('0x3b')]=_[_0xb373('0xcc')](_0x399a2a[_0xb373('0x3b')],{'$or':_[_0xb373('0x2d')](_0x399a2a[_0xb373('0x42')],function(_0x554655){var _0xeb3609={};_0xeb3609[_0x554655]={'$like':'%'+_0x5563e8[_0xb373('0x3c')][_0xb373('0x2b')]+'%'};return _0xeb3609;})});}_0x399a2a=_[_0xb373('0xcc')]({},_0x399a2a,_0x5563e8[_0xb373('0x53')]);return db[_0xb373('0xe1')][_0xb373('0x22')]({'where':_0x399a2a[_0xb373('0x3b')]})['then'](function(_0x71dfd7){_0x2fb6d2[_0xb373('0x22')]=_0x71dfd7;if(_0x5563e8[_0xb373('0x3c')]['includeAll']){_0x399a2a['include']=[{'all':!![]}];}return db[_0xb373('0xe1')][_0xb373('0x44')](_0x399a2a);})[_0xb373('0x27')](function(_0x2e7704){_0x2fb6d2['rows']=_0x2e7704;return _0x2fb6d2;});}})['then'](respondWithFilteredResult(_0x25224d,_0x399a2a))[_0xb373('0x1c')](handleError(_0x25224d,null));};exports[_0xb373('0xe2')]=function(_0x325e5a,_0x5ab1f1){var _0x4707d6={};var _0x4acb13={};var _0x53c524;var _0x45faa0;return db[_0xb373('0x36')]['findOne']({'where':{'id':_0x325e5a['params']['id']}})[_0xb373('0x27')](handleEntityNotFound(_0x5ab1f1,null))[_0xb373('0x27')](function(_0x1c37fb){if(_0x1c37fb){_0x53c524=_0x1c37fb;_0x4acb13[_0xb373('0x51')]=_['keys'](db[_0xb373('0xe3')][_0xb373('0x37')]);_0x4acb13[_0xb373('0x3c')]=_[_0xb373('0x4f')](_0x325e5a[_0xb373('0x3c')]);_0x4acb13[_0xb373('0xc9')]=_[_0xb373('0x50')](_0x4acb13[_0xb373('0x51')],_0x4acb13[_0xb373('0x3c')]);_0x4707d6[_0xb373('0x42')]=_[_0xb373('0x50')](_0x4acb13['model'],qs[_0xb373('0x52')](_0x325e5a[_0xb373('0x3c')][_0xb373('0x52')]));_0x4707d6[_0xb373('0x42')]=_0x4707d6[_0xb373('0x42')]['length']?_0x4707d6[_0xb373('0x42')]:_0x4acb13[_0xb373('0x51')];_0x4707d6[_0xb373('0xca')]=qs['sort'](_0x325e5a[_0xb373('0x3c')][_0xb373('0xcb')]);_0x4707d6[_0xb373('0x3b')]=qs[_0xb373('0xc9')](_['pick'](_0x325e5a[_0xb373('0x3c')],_0x4acb13[_0xb373('0xc9')]));if(_0x325e5a[_0xb373('0x3c')]['filter']){_0x4707d6[_0xb373('0x3b')]=_[_0xb373('0xcc')](_0x4707d6[_0xb373('0x3b')],{'$or':_[_0xb373('0x2d')](_0x4707d6['attributes'],function(_0x1ecacc){var _0x384fc1={};_0x384fc1[_0x1ecacc]={'$like':'%'+_0x325e5a['query'][_0xb373('0x2b')]+'%'};return _0x384fc1;})});}_0x4707d6=_['merge']({},_0x4707d6,_0x325e5a[_0xb373('0x53')]);return _0x53c524[_0xb373('0xe2')](_0x4707d6);}})[_0xb373('0x27')](function(_0x1ede3c){if(_0x1ede3c){_0x45faa0=_0x1ede3c['length'];if(!_0x325e5a[_0xb373('0x3c')]['hasOwnProperty']('nolimit')){_0x4707d6[_0xb373('0x21')]=qs[_0xb373('0x21')](_0x325e5a['query'][_0xb373('0x21')]);_0x4707d6[_0xb373('0x1f')]=qs[_0xb373('0x1f')](_0x325e5a[_0xb373('0x3c')]['offset']);}return _0x53c524['getChatInteractions'](_0x4707d6);}})[_0xb373('0x27')](function(_0x4c2214){if(_0x4c2214){return _0x4c2214?{'count':_0x45faa0,'rows':_0x4c2214}:null;}})[_0xb373('0x27')](respondWithResult(_0x5ab1f1,null))[_0xb373('0x1c')](handleError(_0x5ab1f1,null));};exports[_0xb373('0xe4')]=function(_0x434a3b,_0x295eec){var _0xe22838={};var _0x451b38={};var _0x45afd9;var _0x10903e;return db['User'][_0xb373('0x93')]({'where':{'id':_0x434a3b[_0xb373('0x56')]['id']}})[_0xb373('0x27')](handleEntityNotFound(_0x295eec,null))[_0xb373('0x27')](function(_0x3f783e){if(_0x3f783e){_0x45afd9=_0x3f783e;_0x451b38[_0xb373('0x51')]=_[_0xb373('0x4f')](db[_0xb373('0xe5')]['rawAttributes']);_0x451b38[_0xb373('0x3c')]=_[_0xb373('0x4f')](_0x434a3b['query']);_0x451b38[_0xb373('0xc9')]=_[_0xb373('0x50')](_0x451b38['model'],_0x451b38[_0xb373('0x3c')]);_0xe22838[_0xb373('0x42')]=_[_0xb373('0x50')](_0x451b38[_0xb373('0x51')],qs['fields'](_0x434a3b['query'][_0xb373('0x52')]));_0xe22838[_0xb373('0x42')]=_0xe22838[_0xb373('0x42')][_0xb373('0x47')]?_0xe22838[_0xb373('0x42')]:_0x451b38['model'];_0xe22838[_0xb373('0xca')]=qs[_0xb373('0xcb')](_0x434a3b[_0xb373('0x3c')][_0xb373('0xcb')]);_0xe22838[_0xb373('0x3b')]=qs[_0xb373('0xc9')](_['pick'](_0x434a3b[_0xb373('0x3c')],_0x451b38[_0xb373('0xc9')]));if(_0x434a3b['query'][_0xb373('0x2b')]){_0xe22838['where']=_[_0xb373('0xcc')](_0xe22838[_0xb373('0x3b')],{'$or':_['map'](_0xe22838[_0xb373('0x42')],function(_0x19bf69){var _0x575126={};_0x575126[_0x19bf69]={'$like':'%'+_0x434a3b[_0xb373('0x3c')][_0xb373('0x2b')]+'%'};return _0x575126;})});}_0xe22838=_[_0xb373('0xcc')]({},_0xe22838,_0x434a3b[_0xb373('0x53')]);return _0x45afd9[_0xb373('0xe4')](_0xe22838);}})[_0xb373('0x27')](function(_0x12ce13){if(_0x12ce13){_0x10903e=_0x12ce13[_0xb373('0x47')];if(!_0x434a3b[_0xb373('0x3c')]['hasOwnProperty']('nolimit')){_0xe22838[_0xb373('0x21')]=qs[_0xb373('0x21')](_0x434a3b['query']['limit']);_0xe22838[_0xb373('0x1f')]=qs[_0xb373('0x1f')](_0x434a3b[_0xb373('0x3c')]['offset']);}return _0x45afd9[_0xb373('0xe4')](_0xe22838);}})['then'](function(_0x6d9404){if(_0x6d9404){return _0x6d9404?{'count':_0x10903e,'rows':_0x6d9404}:null;}})['then'](respondWithResult(_0x295eec,null))[_0xb373('0x1c')](handleError(_0x295eec,null));};exports[_0xb373('0xe6')]=function(_0x1e7763,_0xb69cec){var _0x4ded5c={'raw':!![],'where':{}};var _0x97e882={};var _0x209bb0={'count':0x0,'rows':[]};return db[_0xb373('0x36')][_0xb373('0x93')]({'where':{'id':_0x1e7763[_0xb373('0x56')]['id']}})[_0xb373('0x27')](handleEntityNotFound(_0xb69cec,null))[_0xb373('0x27')](function(_0x22fc82){if(_0x22fc82){_0x97e882['model']=_[_0xb373('0x4f')](db[_0xb373('0xe7')]['rawAttributes']);_0x97e882[_0xb373('0x3c')]=_[_0xb373('0x4f')](_0x1e7763[_0xb373('0x3c')]);_0x97e882[_0xb373('0xc9')]=_[_0xb373('0x50')](_0x97e882[_0xb373('0x51')],_0x97e882[_0xb373('0x3c')]);_0x4ded5c[_0xb373('0x42')]=_['intersection'](_0x97e882[_0xb373('0x51')],qs[_0xb373('0x52')](_0x1e7763[_0xb373('0x3c')][_0xb373('0x52')]));_0x4ded5c[_0xb373('0x42')]=_0x4ded5c[_0xb373('0x42')]['length']?_0x4ded5c['attributes']:_0x97e882[_0xb373('0x51')];if(!_0x1e7763[_0xb373('0x3c')][_0xb373('0xcd')](_0xb373('0xd9'))){_0x4ded5c[_0xb373('0x21')]=qs[_0xb373('0x21')](_0x1e7763['query'][_0xb373('0x21')]);_0x4ded5c[_0xb373('0x1f')]=qs[_0xb373('0x1f')](_0x1e7763[_0xb373('0x3c')]['offset']);}_0x4ded5c[_0xb373('0xca')]=qs['sort'](_0x1e7763[_0xb373('0x3c')][_0xb373('0xcb')]);_0x4ded5c['where']=qs[_0xb373('0xc9')](_[_0xb373('0xd5')](_0x1e7763[_0xb373('0x3c')],_0x97e882[_0xb373('0xc9')]));_0x4ded5c[_0xb373('0x3b')][_0xb373('0xdf')]=_0x22fc82['id'];if(_0x1e7763[_0xb373('0x3c')][_0xb373('0x2b')]){_0x4ded5c[_0xb373('0x3b')]=_[_0xb373('0xcc')](_0x4ded5c[_0xb373('0x3b')],{'$or':_['map'](_0x4ded5c['attributes'],function(_0x5af532){var _0x261879={};_0x261879[_0x5af532]={'$like':'%'+_0x1e7763[_0xb373('0x3c')]['filter']+'%'};return _0x261879;})});}_0x4ded5c=_['merge']({},_0x4ded5c,_0x1e7763[_0xb373('0x53')]);return db[_0xb373('0xe7')][_0xb373('0x22')]({'where':_0x4ded5c[_0xb373('0x3b')]})[_0xb373('0x27')](function(_0x43ff8d){_0x209bb0[_0xb373('0x22')]=_0x43ff8d;if(_0x1e7763[_0xb373('0x3c')][_0xb373('0x3d')]){_0x4ded5c[_0xb373('0x3e')]=[{'all':!![]}];}return db[_0xb373('0xe7')][_0xb373('0x44')](_0x4ded5c);})['then'](function(_0x409f81){_0x209bb0[_0xb373('0x45')]=_0x409f81;return _0x209bb0;});}})[_0xb373('0x27')](respondWithFilteredResult(_0xb69cec,_0x4ded5c))['catch'](handleError(_0xb69cec,null));};exports['getSmsInteractions']=function(_0x1a75ec,_0x3bcfa5){var _0x298979={};var _0xeed09b={};var _0x59508c;var _0x44d451;return db[_0xb373('0x36')][_0xb373('0x93')]({'where':{'id':_0x1a75ec[_0xb373('0x56')]['id']}})[_0xb373('0x27')](handleEntityNotFound(_0x3bcfa5,null))[_0xb373('0x27')](function(_0xa1244){if(_0xa1244){_0x59508c=_0xa1244;_0xeed09b['model']=_[_0xb373('0x4f')](db[_0xb373('0xe8')][_0xb373('0x37')]);_0xeed09b[_0xb373('0x3c')]=_[_0xb373('0x4f')](_0x1a75ec[_0xb373('0x3c')]);_0xeed09b[_0xb373('0xc9')]=_[_0xb373('0x50')](_0xeed09b[_0xb373('0x51')],_0xeed09b[_0xb373('0x3c')]);_0x298979[_0xb373('0x42')]=_[_0xb373('0x50')](_0xeed09b[_0xb373('0x51')],qs[_0xb373('0x52')](_0x1a75ec[_0xb373('0x3c')][_0xb373('0x52')]));_0x298979[_0xb373('0x42')]=_0x298979[_0xb373('0x42')]['length']?_0x298979['attributes']:_0xeed09b['model'];_0x298979[_0xb373('0xca')]=qs['sort'](_0x1a75ec[_0xb373('0x3c')][_0xb373('0xcb')]);_0x298979[_0xb373('0x3b')]=qs[_0xb373('0xc9')](_[_0xb373('0xd5')](_0x1a75ec[_0xb373('0x3c')],_0xeed09b[_0xb373('0xc9')]));if(_0x1a75ec[_0xb373('0x3c')][_0xb373('0x2b')]){_0x298979[_0xb373('0x3b')]=_[_0xb373('0xcc')](_0x298979[_0xb373('0x3b')],{'$or':_[_0xb373('0x2d')](_0x298979[_0xb373('0x42')],function(_0x1c06d6){var _0x28c985={};_0x28c985[_0x1c06d6]={'$like':'%'+_0x1a75ec[_0xb373('0x3c')]['filter']+'%'};return _0x28c985;})});}_0x298979=_[_0xb373('0xcc')]({},_0x298979,_0x1a75ec[_0xb373('0x53')]);return _0x59508c[_0xb373('0xe9')](_0x298979);}})[_0xb373('0x27')](function(_0x30f499){if(_0x30f499){_0x44d451=_0x30f499['length'];if(!_0x1a75ec['query'][_0xb373('0xcd')](_0xb373('0xd9'))){_0x298979[_0xb373('0x21')]=qs['limit'](_0x1a75ec['query'][_0xb373('0x21')]);_0x298979[_0xb373('0x1f')]=qs[_0xb373('0x1f')](_0x1a75ec[_0xb373('0x3c')]['offset']);}return _0x59508c[_0xb373('0xe9')](_0x298979);}})[_0xb373('0x27')](function(_0x5752b6){if(_0x5752b6){return _0x5752b6?{'count':_0x44d451,'rows':_0x5752b6}:null;}})[_0xb373('0x27')](respondWithResult(_0x3bcfa5,null))[_0xb373('0x1c')](handleError(_0x3bcfa5,null));};exports['getFaxInteractions']=function(_0x5a048e,_0x31935b){var _0x1a2cf9={};var _0x50951b={};var _0x1d4b23;var _0x430d3e;return db[_0xb373('0x36')]['findOne']({'where':{'id':_0x5a048e[_0xb373('0x56')]['id']}})['then'](handleEntityNotFound(_0x31935b,null))[_0xb373('0x27')](function(_0x14af35){if(_0x14af35){_0x1d4b23=_0x14af35;_0x50951b['model']=_['keys'](db[_0xb373('0xea')][_0xb373('0x37')]);_0x50951b[_0xb373('0x3c')]=_[_0xb373('0x4f')](_0x5a048e[_0xb373('0x3c')]);_0x50951b[_0xb373('0xc9')]=_[_0xb373('0x50')](_0x50951b['model'],_0x50951b[_0xb373('0x3c')]);_0x1a2cf9['attributes']=_[_0xb373('0x50')](_0x50951b['model'],qs[_0xb373('0x52')](_0x5a048e['query']['fields']));_0x1a2cf9[_0xb373('0x42')]=_0x1a2cf9[_0xb373('0x42')]['length']?_0x1a2cf9[_0xb373('0x42')]:_0x50951b['model'];_0x1a2cf9[_0xb373('0xca')]=qs[_0xb373('0xcb')](_0x5a048e[_0xb373('0x3c')]['sort']);_0x1a2cf9[_0xb373('0x3b')]=qs[_0xb373('0xc9')](_[_0xb373('0xd5')](_0x5a048e[_0xb373('0x3c')],_0x50951b[_0xb373('0xc9')]));if(_0x5a048e[_0xb373('0x3c')][_0xb373('0x2b')]){_0x1a2cf9[_0xb373('0x3b')]=_['merge'](_0x1a2cf9[_0xb373('0x3b')],{'$or':_[_0xb373('0x2d')](_0x1a2cf9[_0xb373('0x42')],function(_0x32f14c){var _0x5a7190={};_0x5a7190[_0x32f14c]={'$like':'%'+_0x5a048e[_0xb373('0x3c')]['filter']+'%'};return _0x5a7190;})});}_0x1a2cf9=_[_0xb373('0xcc')]({},_0x1a2cf9,_0x5a048e[_0xb373('0x53')]);return _0x1d4b23[_0xb373('0xeb')](_0x1a2cf9);}})['then'](function(_0x4d5f18){if(_0x4d5f18){_0x430d3e=_0x4d5f18[_0xb373('0x47')];if(!_0x5a048e['query'][_0xb373('0xcd')](_0xb373('0xd9'))){_0x1a2cf9[_0xb373('0x21')]=qs[_0xb373('0x21')](_0x5a048e[_0xb373('0x3c')][_0xb373('0x21')]);_0x1a2cf9[_0xb373('0x1f')]=qs[_0xb373('0x1f')](_0x5a048e[_0xb373('0x3c')][_0xb373('0x1f')]);}return _0x1d4b23[_0xb373('0xeb')](_0x1a2cf9);}})[_0xb373('0x27')](function(_0x327ef7){if(_0x327ef7){return _0x327ef7?{'count':_0x430d3e,'rows':_0x327ef7}:null;}})[_0xb373('0x27')](respondWithResult(_0x31935b,null))[_0xb373('0x1c')](handleError(_0x31935b,null));};exports[_0xb373('0xec')]=function(_0x82b174,_0x2a8dc2){var _0x138bdf={};var _0x485204={};var _0x3b4c74;var _0x186f0a;return db[_0xb373('0x36')][_0xb373('0x93')]({'where':{'id':_0x82b174[_0xb373('0x56')]['id']}})[_0xb373('0x27')](handleEntityNotFound(_0x2a8dc2,null))[_0xb373('0x27')](function(_0x35bf39){if(_0x35bf39){_0x3b4c74=_0x35bf39;_0x485204[_0xb373('0x51')]=_[_0xb373('0x4f')](db[_0xb373('0xed')][_0xb373('0x37')]);_0x485204[_0xb373('0x3c')]=_[_0xb373('0x4f')](_0x82b174[_0xb373('0x3c')]);_0x485204[_0xb373('0xc9')]=_['intersection'](_0x485204[_0xb373('0x51')],_0x485204[_0xb373('0x3c')]);_0x138bdf[_0xb373('0x42')]=_[_0xb373('0x50')](_0x485204[_0xb373('0x51')],qs[_0xb373('0x52')](_0x82b174['query']['fields']));_0x138bdf[_0xb373('0x42')]=_0x138bdf[_0xb373('0x42')][_0xb373('0x47')]?_0x138bdf['attributes']:_0x485204['model'];_0x138bdf[_0xb373('0xca')]=qs[_0xb373('0xcb')](_0x82b174[_0xb373('0x3c')][_0xb373('0xcb')]);_0x138bdf[_0xb373('0x3b')]=qs[_0xb373('0xc9')](_[_0xb373('0xd5')](_0x82b174[_0xb373('0x3c')],_0x485204['filters']));if(_0x82b174[_0xb373('0x3c')]['filter']){_0x138bdf['where']=_['merge'](_0x138bdf['where'],{'$or':_[_0xb373('0x2d')](_0x138bdf['attributes'],function(_0x527d0f){var _0x1615c2={};_0x1615c2[_0x527d0f]={'$like':'%'+_0x82b174[_0xb373('0x3c')][_0xb373('0x2b')]+'%'};return _0x1615c2;})});}_0x138bdf=_[_0xb373('0xcc')]({},_0x138bdf,_0x82b174['options']);return _0x3b4c74[_0xb373('0xec')](_0x138bdf);}})[_0xb373('0x27')](function(_0x54641d){if(_0x54641d){_0x186f0a=_0x54641d['length'];if(!_0x82b174[_0xb373('0x3c')][_0xb373('0xcd')](_0xb373('0xd9'))){_0x138bdf[_0xb373('0x21')]=qs['limit'](_0x82b174['query'][_0xb373('0x21')]);_0x138bdf[_0xb373('0x1f')]=qs[_0xb373('0x1f')](_0x82b174[_0xb373('0x3c')]['offset']);}return _0x3b4c74[_0xb373('0xec')](_0x138bdf);}})['then'](function(_0x470590){if(_0x470590){return _0x470590?{'count':_0x186f0a,'rows':_0x470590}:null;}})[_0xb373('0x27')](respondWithResult(_0x2a8dc2,null))[_0xb373('0x1c')](handleError(_0x2a8dc2,null));};exports['login']=function(_0x20c7d3,_0xa21f14,_0x2b2a38){var _0x56e151;var _0x365b19;var _0xf37531;var _0x50c815=!_[_0xb373('0x60')](_0x20c7d3[_0xb373('0x56')]['id'])?_0x20c7d3['params']['id']:!_['isNil'](_0x20c7d3[_0xb373('0x79')]['id'])?_0x20c7d3[_0xb373('0x79')]['id']:null;return db['User'][_0xb373('0x54')]({'where':{'id':_0x50c815,'role':{'$or':[_0xb373('0x7a'),_0xb373('0x79'),'agent']}},'attributes':['id',_0xb373('0x34'),_0xb373('0xee'),_0xb373('0xef'),_0xb373('0x30'),'internal',_0xb373('0x9a')]})['then'](function(_0x23a080){if(_0x23a080){if(_0x23a080['role']===_0xb373('0x29')){_0x56e151=_0x23a080;if(_0x20c7d3['body'][_0xb373('0x9b')]){_0xf37531=util[_0xb373('0xf0')](_0xb373('0xf1'),_0x56e151[_0x20c7d3['body'][_0xb373('0x9b')]]);}else if(_0x20c7d3[_0xb373('0x55')]['intrf']){_0xf37531=util[_0xb373('0xf0')](_0xb373('0xa9'),_0x20c7d3['body'][_0xb373('0xf2')]);}else{_0xf37531=util['format'](_0xb373('0xa9'),_0x56e151[_0xb373('0x34')]);}socket['to'](util[_0xb373('0xf0')](_0xb373('0xf3'),_0x56e151[_0xb373('0x34')]))[_0xb373('0xa4')](_0xb373('0xf4'),{'user':{'id':_0x56e151['id'],'name':_0x56e151['name']},'ip':_0x20c7d3['headers']['x-forwarded-for']||_0x20c7d3[_0xb373('0xf5')][_0xb373('0xf6')]||_0x20c7d3['socket'][_0xb373('0xf6')]||_0x20c7d3[_0xb373('0xf5')]['socket'][_0xb373('0xf6')]});return db[_0xb373('0xaf')][_0xb373('0x26')]({'where':{'membername':_0x56e151[_0xb373('0x34')]},'individualHooks':!![]});}}else{throw new db[(_0xb373('0x8d'))]['ValidationError'](_0xb373('0xf7'));}})[_0xb373('0x27')](function(){if(_0x56e151){return _0x56e151['getVoiceQueues']({'raw':!![]});}})['then'](function(_0x80a3ee){if(_0x56e151){var _0x500c79=[];if(_0x80a3ee){_0x365b19=_0x80a3ee;if(_0x365b19[_0xb373('0x47')]){for(var _0x40a9af=0x0;_0x40a9af<_0x365b19[_0xb373('0x47')];_0x40a9af++){_0x500c79[_0xb373('0x43')]({'membername':_0x56e151['name'],'UserId':_0x56e151['id'],'queue_name':_0x365b19[_0x40a9af][_0xb373('0x34')],'VoiceQueueId':_0x365b19[_0x40a9af]['id'],'interface':_0xf37531,'paused':_0x56e151[_0xb373('0x9a')]||![],'penalty':_0x365b19[_0x40a9af][_0xb373('0xf8')]||0x0});}return BPromise[_0xb373('0xaa')](_0x500c79,function(_0x5d2b6a){return db[_0xb373('0xaf')][_0xb373('0xab')](_0x5d2b6a);});}}}})[_0xb373('0x27')](function(){if(_0x56e151){return db[_0xb373('0xf9')]['findAll']({'where':{'membername':_0x56e151['name'],'exitAt':null}});}})['then'](function(_0x3c42b2){if(_0x56e151){var _0x3bd67f=[];_0x3c42b2['forEach'](function(_0x14b14b){_0x3bd67f[_0xb373('0x43')](_0x14b14b[_0xb373('0x25')]({'exitAt':moment()[_0xb373('0xf0')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0xb373('0x89')](_0x3bd67f);}})['then'](function(){if(_0x56e151){var _0xba94e8=[];var _0x51250f=[];var _0x752e21=utils[_0xb373('0xfa')]();var _0x13b1f4={'membername':_0x56e151[_0xb373('0x34')],'interface':_0xf37531,'enterAt':moment()[_0xb373('0xf0')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x56e151['role'],'internal':_0x56e151[_0xb373('0x61')]};_0x752e21[_0xb373('0xfb')](function(_0x2f9a69){_0xba94e8[_0xb373('0x43')](_[_0xb373('0xcc')]({'channel':_0x2f9a69,'type':_0xb373('0xfc'),'data1':_0x20c7d3[_0xb373('0x55')][_0xb373('0xfd')],'data2':_0xf37531},_0x13b1f4));if(_0x56e151['loginInPause']){_0x51250f[_0xb373('0x43')](_['merge']({'channel':_0x2f9a69,'type':_0xb373('0xfe'),'data1':_0xb373('0xff')},_0x13b1f4));}});return db['MemberReport'][_0xb373('0x81')](_0xba94e8[_0xb373('0xc6')](_0x51250f),{'individualHooks':!![]});}})[_0xb373('0x27')](function(){if(_0x56e151){return _0x56e151[_0xb373('0x25')]({'online':!![],'lastLoginAt':moment()[_0xb373('0xf0')](_0xb373('0x100')),'voicePause':_0x56e151['loginInPause']||![],'mailPause':_0x56e151[_0xb373('0x9a')]||![],'chatPause':_0x56e151[_0xb373('0x9a')]||![],'faxPause':_0x56e151['loginInPause']||![],'smsPause':_0x56e151[_0xb373('0x9a')]||![],'openchannelPause':_0x56e151[_0xb373('0x9a')]||![],'whatsappPause':_0x56e151['loginInPause']||![],'pauseType':_0x56e151[_0xb373('0x9a')]?_0xb373('0xff'):null,'interface':_0xf37531,'lastPauseAt':moment()[_0xb373('0xf0')]('YYYY-MM-DD\x20HH:mm:ss')});}})[_0xb373('0x27')](function(_0x34258c){if(_0x20c7d3[_0xb373('0x101')]){return _0x2b2a38();}else{return BPromise[_0xb373('0x102')](_0x34258c)[_0xb373('0x27')](respondWithResult(_0xa21f14,null));}})['catch'](handleError(_0xa21f14,null));};exports['logout']=function(_0x1ff2aa,_0x307d57){var _0x5a07aa;return db[_0xb373('0x36')][_0xb373('0x54')]({'where':{'id':_0x1ff2aa[_0xb373('0x56')]['id'],'role':_0xb373('0x29')},'attributes':['id',_0xb373('0x34'),'role']})[_0xb373('0x27')](handleEntityNotFound(_0x307d57,null))[_0xb373('0x27')](function(_0x52215b){if(_0x52215b){_0x5a07aa=_0x52215b;return db[_0xb373('0xaf')][_0xb373('0x26')]({'where':{'membername':_0x5a07aa['name']},'individualHooks':!![]});}})['then'](function(){return db[_0xb373('0xf9')]['findAll']({'where':{'membername':_0x5a07aa['name'],'exitAt':null}});})[_0xb373('0x27')](function(_0x28f682){var _0x391049=[];_0x28f682[_0xb373('0xfb')](function(_0x1addb4){_0x391049[_0xb373('0x43')](_0x1addb4[_0xb373('0x25')]({'exitAt':moment()[_0xb373('0xf0')](_0xb373('0x100'))}));});return BPromise[_0xb373('0x89')](_0x391049);})[_0xb373('0x27')](function(){return _0x5a07aa[_0xb373('0x25')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0xb373('0x27')](respondWithResult(_0x307d57,null))['catch'](handleError(_0x307d57,null));};exports[_0xb373('0x103')]=function(_0x2e0fd1,_0x2f2a17){var _0x5cf94d;return db[_0xb373('0xaf')][_0xb373('0x25')]({'paused':0x1},{'where':{'UserId':_0x2e0fd1['params']['id']},'individualHooks':!![]})[_0xb373('0x27')](function(){return db[_0xb373('0x36')][_0xb373('0x54')]({'where':{'id':_0x2e0fd1[_0xb373('0x56')]['id'],'role':_0xb373('0x29')},'attributes':['id','name',_0xb373('0x30'),_0xb373('0x61'),_0xb373('0x9b')]});})['then'](handleEntityNotFound(_0x2f2a17,null))[_0xb373('0x27')](function(_0x3b74e1){if(_0x3b74e1){_0x5cf94d=_0x3b74e1;return respondWithRpcPromise(_0xb373('0x104'),_0xb373('0x103'),{'id':_0x5cf94d['id'],'name':_0x5cf94d[_0xb373('0x34')],'pause':!![]});}})[_0xb373('0x27')](function(){if(_0x5cf94d){return db[_0xb373('0xf9')][_0xb373('0x44')]({'where':{'membername':_0x5cf94d[_0xb373('0x34')],'type':'PAUSE','exitAt':null}});}})['then'](function(_0x2e289d){if(_0x2e289d[_0xb373('0x47')]){var _0x5b9dfa=moment()['format'](_0xb373('0x100'));for(var _0x1d7cee=0x0,_0x11c630=_0x2e289d[_0xb373('0x47')];_0x1d7cee<_0x11c630;_0x1d7cee++){_0x2e289d[_0x1d7cee][_0xb373('0x105')]({'exitAt':_0x5b9dfa});}}})[_0xb373('0x27')](function(){var _0x51e474=[];var _0x181f79=utils[_0xb373('0xfa')]();_0x181f79[_0xb373('0xfb')](function(_0x534195){_0x51e474[_0xb373('0x43')]({'channel':_0x534195,'membername':_0x5cf94d[_0xb373('0x34')],'interface':_['isNil'](_0x5cf94d[_0xb373('0x9b')])?util[_0xb373('0xf0')](_0xb373('0xa9'),_0x5cf94d[_0xb373('0x34')]):_0x5cf94d[_0xb373('0x9b')],'type':_0xb373('0xfe'),'enterAt':moment()['format'](_0xb373('0x100')),'data1':_0x2e0fd1[_0xb373('0x55')]['type']||_0xb373('0x106'),'role':_0x5cf94d['role'],'internal':_0x5cf94d[_0xb373('0x61')]});});return db[_0xb373('0xf9')][_0xb373('0x81')](_0x51e474,{'individualHooks':!![]});})['then'](function(){return _0x5cf94d['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x2e0fd1[_0xb373('0x55')][_0xb373('0x107')]||_0xb373('0x106'),'lastPauseAt':moment()[_0xb373('0xf0')](_0xb373('0x100'))});})['then'](respondWithResult(_0x2f2a17,null))[_0xb373('0x1c')](handleError(_0x2f2a17,null));};exports['unpause']=function(_0x101544,_0x216e00){var _0x546acc;return db[_0xb373('0x36')][_0xb373('0x54')]({'where':{'id':_0x101544[_0xb373('0x56')]['id']},'attributes':['id',_0xb373('0x34'),_0xb373('0x30'),'voicePause',_0xb373('0x108'),'chatPause','faxPause',_0xb373('0x109'),_0xb373('0x10a'),'whatsapppause',_0xb373('0x10b'),_0xb373('0x10c')]})[_0xb373('0x27')](handleEntityNotFound(_0x216e00,null))[_0xb373('0x27')](function(_0x2a6eed){if(_0x2a6eed){_0x546acc=_0x2a6eed;if(_0x101544[_0xb373('0x55')]['channel']&&!utils[_0xb373('0x9c')](_0x101544['body']['channel'])){throw new db['Sequelize'][(_0xb373('0x8f'))](_0xb373('0x9d'));}switch(_0x101544[_0xb373('0x55')][_0xb373('0x99')]){case _0xb373('0xa6'):return respondWithRpcPromise(_0xb373('0x104'),'unpause',{'id':_0x546acc['id'],'name':_0x546acc[_0xb373('0x34')],'pause':![]})[_0xb373('0x27')](function(){return db[_0xb373('0xaf')][_0xb373('0x25')]({'paused':0x0},{'where':{'UserId':_0x546acc['id']},'individualHooks':!![]});})[_0xb373('0x27')](function(){return db[_0xb373('0xf9')]['find']({'where':{'channel':_0x101544[_0xb373('0x55')][_0xb373('0x99')],'membername':_0x546acc['name'],'type':_0xb373('0xfe'),'exitAt':null}});})[_0xb373('0x27')](function(_0x39b3f2){if(_0x39b3f2){return _0x39b3f2[_0xb373('0x25')]({'exitAt':moment()[_0xb373('0xf0')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':'manual'},{'individualHooks':!![]});}return null;})[_0xb373('0x27')](function(){return _0x546acc[_0xb373('0x25')]({'voicePause':![]});});case'mail':case _0xb373('0x48'):case _0xb373('0x4b'):case'sms':case _0xb373('0x4e'):case _0xb373('0x4d'):return db[_0xb373('0xf9')][_0xb373('0x54')]({'where':{'channel':_0x101544[_0xb373('0x55')][_0xb373('0x99')],'membername':_0x546acc[_0xb373('0x34')],'type':_0xb373('0xfe'),'exitAt':null}})[_0xb373('0x27')](function(_0x1fbd8d){if(_0x1fbd8d){return _0x1fbd8d[_0xb373('0x25')]({'exitAt':moment()[_0xb373('0xf0')](_0xb373('0x100')),'data2':'manual'},{'individualHooks':!![]});}return null;})['then'](function(){var _0x330cf6={};_[_0xb373('0x23')](_0x330cf6,util['format'](_0xb373('0x10d'),_0x101544[_0xb373('0x55')][_0xb373('0x99')],_0xb373('0x10e')),![]);return _0x546acc[_0xb373('0x25')](_0x330cf6);});default:return respondWithRpcPromise(_0xb373('0x104'),_0xb373('0x10f'),{'id':_0x546acc['id'],'name':_0x546acc[_0xb373('0x34')],'pause':![]})[_0xb373('0x27')](function(){return db[_0xb373('0xaf')][_0xb373('0x25')]({'paused':0x0},{'where':{'UserId':_0x546acc['id']}});})[_0xb373('0x27')](function(){return db[_0xb373('0xf9')][_0xb373('0x44')]({'where':{'membername':_0x546acc[_0xb373('0x34')],'type':_0xb373('0xfe'),'exitAt':null}});})[_0xb373('0x27')](function(_0x306a1d){var _0x10d953=[];_0x306a1d[_0xb373('0xfb')](function(_0x2467a7){_0x10d953['push'](_0x2467a7['update']({'exitAt':moment()[_0xb373('0xf0')](_0xb373('0x100')),'data2':_0xb373('0x110')}));});return BPromise[_0xb373('0x89')](_0x10d953);})['then'](function(){return _0x546acc[_0xb373('0x25')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})[_0xb373('0x27')](respondWithResult(_0x216e00,null))[_0xb373('0x1c')](handleError(_0x216e00,null));};exports[_0xb373('0x111')]=function(_0x16a4ff,_0x4af8f4){var _0x1d6f1b={};var _0x59b21a={};var _0x98fb03;var _0x10daef;return db[_0xb373('0x36')][_0xb373('0x93')]({'where':{'id':_0x16a4ff[_0xb373('0x56')]['id']}})['then'](handleEntityNotFound(_0x4af8f4,null))[_0xb373('0x27')](function(_0x1ad2e5){if(_0x1ad2e5){_0x98fb03=_0x1ad2e5;_0x59b21a[_0xb373('0x51')]=_[_0xb373('0x4f')](db[_0xb373('0x112')]['rawAttributes']);_0x59b21a['query']=_[_0xb373('0x4f')](_0x16a4ff[_0xb373('0x3c')]);_0x59b21a['filters']=_[_0xb373('0x50')](_0x59b21a['model'],_0x59b21a['query']);_0x1d6f1b[_0xb373('0x42')]=_[_0xb373('0x50')](_0x59b21a[_0xb373('0x51')],qs[_0xb373('0x52')](_0x16a4ff[_0xb373('0x3c')][_0xb373('0x52')]));_0x1d6f1b['attributes']=_0x1d6f1b['attributes'][_0xb373('0x47')]?_0x1d6f1b[_0xb373('0x42')]:_0x59b21a[_0xb373('0x51')];_0x1d6f1b['order']=qs[_0xb373('0xcb')](_0x16a4ff[_0xb373('0x3c')][_0xb373('0xcb')]);_0x1d6f1b[_0xb373('0x3b')]=qs['filters'](_[_0xb373('0xd5')](_0x16a4ff[_0xb373('0x3c')],_0x59b21a[_0xb373('0xc9')]));if(_0x16a4ff[_0xb373('0x3c')][_0xb373('0x2b')]){_0x1d6f1b[_0xb373('0x3b')]=_[_0xb373('0xcc')](_0x1d6f1b['where'],{'$or':_[_0xb373('0x2d')](_0x1d6f1b[_0xb373('0x42')],function(_0x4bc402){var _0x3c3bb2={};_0x3c3bb2[_0x4bc402]={'$like':'%'+_0x16a4ff['query']['filter']+'%'};return _0x3c3bb2;})});}_0x1d6f1b=_['merge']({},_0x1d6f1b,_0x16a4ff[_0xb373('0x53')]);return _0x98fb03[_0xb373('0x111')](_0x1d6f1b);}})[_0xb373('0x27')](function(_0x54c166){if(_0x54c166){_0x10daef=_0x54c166['length'];if(!_0x16a4ff[_0xb373('0x3c')]['hasOwnProperty'](_0xb373('0xd9'))){_0x1d6f1b[_0xb373('0x21')]=qs[_0xb373('0x21')](_0x16a4ff[_0xb373('0x3c')]['limit']);_0x1d6f1b[_0xb373('0x1f')]=qs[_0xb373('0x1f')](_0x16a4ff[_0xb373('0x3c')]['offset']);}return _0x98fb03[_0xb373('0x111')](_0x1d6f1b);}})[_0xb373('0x27')](function(_0x2f7212){if(_0x2f7212){return _0x2f7212?{'count':_0x10daef,'rows':_0x2f7212}:null;}})['then'](respondWithResult(_0x4af8f4,null))[_0xb373('0x1c')](handleError(_0x4af8f4,null));};exports[_0xb373('0x113')]=function(_0x104165,_0x51656a){return db[_0xb373('0x36')][_0xb373('0x54')]({'where':{'id':_0x104165[_0xb373('0x56')]['id']}})['then'](handleEntityNotFound(_0x51656a,null))[_0xb373('0x27')](function(_0x5f1ade){if(_0x5f1ade){var _0x540ea5=_0x5f1ade['get']({'plain':!![]});return _0x5f1ade[_0xb373('0x113')](_0x104165['body'][_0xb373('0x59')],_['omit'](_0x104165['body'],[_0xb373('0x59'),'id'])||{})[_0xb373('0x27')](function(){for(var _0x325b12=0x0;_0x325b12<_0x104165[_0xb373('0x55')][_0xb373('0x59')][_0xb373('0x47')];_0x325b12++){var _0x2401ee=[];var _0x3cc09a={};db[_0xb373('0x112')][_0xb373('0x93')]({'where':{'id':_0x104165[_0xb373('0x55')][_0xb373('0x59')][_0x325b12]}})[_0xb373('0x27')](function(_0x4550c7){_0x3cc09a=_0x4550c7[_0xb373('0x4a')];_0x2401ee[_0xb373('0x43')](_0x4550c7['getVoiceQueues']()[_0xb373('0x27')](function(_0x3ca3a0){for(var _0x17f456=0x0;_0x17f456<_0x3ca3a0[_0xb373('0x47')];_0x17f456++){_0x3ca3a0[_0x17f456][_0xb373('0x114')](_0xb373('0x99'),_0xb373('0x115'));}return _0x3ca3a0;}));_0x2401ee[_0xb373('0x43')](_0x4550c7[_0xb373('0x116')]()['then'](function(_0x3a2109){for(var _0x741db9=0x0;_0x741db9<_0x3a2109[_0xb373('0x47')];_0x741db9++){_0x3a2109[_0x741db9][_0xb373('0x114')](_0xb373('0x99'),_0xb373('0x117'));}return _0x3a2109;}));_0x2401ee[_0xb373('0x43')](_0x4550c7[_0xb373('0x118')]()[_0xb373('0x27')](function(_0x3a84d8){for(var _0x274d21=0x0;_0x274d21<_0x3a84d8['length'];_0x274d21++){_0x3a84d8[_0x274d21][_0xb373('0x114')](_0xb373('0x99'),'Mail');}return _0x3a84d8;}));_0x2401ee[_0xb373('0x43')](_0x4550c7['getSmsQueues']()[_0xb373('0x27')](function(_0x558a31){for(var _0x118579=0x0;_0x118579<_0x558a31[_0xb373('0x47')];_0x118579++){_0x558a31[_0x118579]['setDataValue']('channel',_0xb373('0x119'));}return _0x558a31;}));_0x2401ee[_0xb373('0x43')](_0x4550c7[_0xb373('0x11a')]()[_0xb373('0x27')](function(_0x218fb7){for(var _0x368ef3=0x0;_0x368ef3<_0x218fb7[_0xb373('0x47')];_0x368ef3++){_0x218fb7[_0x368ef3]['setDataValue'](_0xb373('0x99'),'Whatsapp');}return _0x218fb7;}));_0x2401ee[_0xb373('0x43')](_0x4550c7['getFaxQueues']()['then'](function(_0x1e1280){for(var _0x32681c=0x0;_0x32681c<_0x1e1280[_0xb373('0x47')];_0x32681c++){_0x1e1280[_0x32681c][_0xb373('0x114')](_0xb373('0x99'),_0xb373('0x11b'));}return _0x1e1280;}));_0x2401ee[_0xb373('0x43')](_0x4550c7['getOpenchannelQueues']()[_0xb373('0x27')](function(_0x5afaa1){for(var _0x179eaa=0x0;_0x179eaa<_0x5afaa1[_0xb373('0x47')];_0x179eaa++){_0x5afaa1[_0x179eaa]['setDataValue'](_0xb373('0x99'),_0xb373('0x11c'));}return _0x5afaa1;}));return BPromise[_0xb373('0x89')](_0x2401ee);})[_0xb373('0x27')](function(_0x2001cd){var _0xb3ab60=_['flatten'](_0x2001cd);_0x2401ee=[];return db[_0xb373('0x64')][_0xb373('0x11d')](function(_0xff7f80){for(var _0x5d5174=0x0;_0x5d5174<_0xb3ab60[_0xb373('0x47')];_0x5d5174++){_0x2401ee[_0xb373('0x43')](_0xb3ab60[_0x5d5174][_0xb373('0x11e')](_0x540ea5['id']),{'transaction':_0xff7f80});}return BPromise[_0xb373('0x89')](_0x2401ee)[_0xb373('0x27')](function(){if(_0x540ea5[_0xb373('0xa8')]){return BPromise[_0xb373('0xaa')](_[_0xb373('0x2b')](_0xb3ab60,function(_0xd83cf8){return _0xd83cf8[_0xb373('0x11f')](_0xb373('0x99'))===_0xb373('0x115');}),function(_0x3f2216){return db[_0xb373('0xaf')]['upsert']({'membername':_0x540ea5['name'],'UserId':_0x540ea5['id'],'queue_name':_0x3f2216[_0xb373('0x34')],'VoiceQueueId':_0x3f2216['id'],'interface':_[_0xb373('0x60')](_0x540ea5['interface'])?util[_0xb373('0xf0')]('SIP/%s',_0x540ea5[_0xb373('0x34')]):_0x540ea5['interface'],'paused':_0x540ea5[_0xb373('0x120')]||![],'penalty':_0x540ea5[_0xb373('0xa1')]},{'transaction':_0xff7f80});});}else{return;}})['then'](function(){for(var _0x3b6d5f=0x0;_0x3b6d5f<_0xb3ab60['length'];_0x3b6d5f++){var _0x228f79=_0xb3ab60[_0x3b6d5f][_0xb373('0x11f')]('channel');var _0x1159b5=_0x228f79+_0xb373('0xa3');socket[_0xb373('0xa4')](_0xb373('0x79')+_0x228f79+_0xb373('0xa5'),{'UserId':_0x540ea5['id'],['queueField']:_0xb3ab60[_0x3b6d5f]['id']});}});});})[_0xb373('0x27')](function(){db['TeamVoicePrefix'][_0xb373('0x93')]({'where':{'teamId':_0x3cc09a['id']}})[_0xb373('0x27')](function(_0x1ebe52){if(_0x1ebe52){db[_0xb373('0x121')]['create']({'UserId':_0x104165[_0xb373('0x56')]['id'],'VoicePrefixId':_0x1ebe52[_0xb373('0x122')]});}});});}});}})[_0xb373('0x27')](respondWithStatusCode(_0x51656a,null))[_0xb373('0x1c')](handleError(_0x51656a,null));};exports[_0xb373('0x123')]=function(_0x5559a5,_0x49a68a){return db[_0xb373('0x36')]['findOne']({'where':{'id':_0x5559a5[_0xb373('0x56')]['id']}})[_0xb373('0x27')](handleEntityNotFound(_0x49a68a,null))[_0xb373('0x27')](function(_0x8115d1){if(_0x8115d1){var _0x27ee05=_0x8115d1[_0xb373('0xd7')]({'plain':!![]});var _0x564774=_0x5559a5[_0xb373('0x3c')][_0xb373('0x59')];return _0x8115d1['removeTeams'](_0x564774)[_0xb373('0x27')](function(){for(var _0x3db67d=0x0;_0x3db67d<_0x564774[_0xb373('0x47')];_0x3db67d++){var _0x2073f3=[];var _0xa0dc7a={};db[_0xb373('0x112')][_0xb373('0x93')]({'where':{'id':_0x564774[_0x3db67d]}})['then'](function(_0x494b7b){_0xa0dc7a=_0x494b7b[_0xb373('0x4a')];_0x2073f3[_0xb373('0x43')](_0x494b7b[_0xb373('0x124')]()[_0xb373('0x27')](function(_0x493ca5){for(var _0x5163e1=0x0;_0x5163e1<_0x493ca5[_0xb373('0x47')];_0x5163e1++){_0x493ca5[_0x5163e1][_0xb373('0x114')](_0xb373('0x99'),'Voice');}return _0x493ca5;}));_0x2073f3[_0xb373('0x43')](_0x494b7b['getChatQueues']()[_0xb373('0x27')](function(_0x5854f4){for(var _0x37aee6=0x0;_0x37aee6<_0x5854f4[_0xb373('0x47')];_0x37aee6++){_0x5854f4[_0x37aee6]['setDataValue'](_0xb373('0x99'),'Chat');}return _0x5854f4;}));_0x2073f3[_0xb373('0x43')](_0x494b7b[_0xb373('0x118')]()[_0xb373('0x27')](function(_0x6eb8f4){for(var _0x38a012=0x0;_0x38a012<_0x6eb8f4[_0xb373('0x47')];_0x38a012++){_0x6eb8f4[_0x38a012]['setDataValue'](_0xb373('0x99'),_0xb373('0x125'));}return _0x6eb8f4;}));_0x2073f3['push'](_0x494b7b[_0xb373('0x126')]()[_0xb373('0x27')](function(_0x370be0){for(var _0x1765d1=0x0;_0x1765d1<_0x370be0['length'];_0x1765d1++){_0x370be0[_0x1765d1][_0xb373('0x114')](_0xb373('0x99'),'Sms');}return _0x370be0;}));_0x2073f3['push'](_0x494b7b[_0xb373('0x11a')]()[_0xb373('0x27')](function(_0x37204d){for(var _0x4c719e=0x0;_0x4c719e<_0x37204d[_0xb373('0x47')];_0x4c719e++){_0x37204d[_0x4c719e][_0xb373('0x114')](_0xb373('0x99'),_0xb373('0x127'));}return _0x37204d;}));_0x2073f3[_0xb373('0x43')](_0x494b7b[_0xb373('0x128')]()[_0xb373('0x27')](function(_0x5c44f7){for(var _0x4a3b71=0x0;_0x4a3b71<_0x5c44f7[_0xb373('0x47')];_0x4a3b71++){_0x5c44f7[_0x4a3b71][_0xb373('0x114')](_0xb373('0x99'),_0xb373('0x11b'));}return _0x5c44f7;}));_0x2073f3[_0xb373('0x43')](_0x494b7b[_0xb373('0x129')]()[_0xb373('0x27')](function(_0x5bac1e){for(var _0x51bcfa=0x0;_0x51bcfa<_0x5bac1e[_0xb373('0x47')];_0x51bcfa++){_0x5bac1e[_0x51bcfa]['setDataValue'](_0xb373('0x99'),_0xb373('0x11c'));}return _0x5bac1e;}));return BPromise[_0xb373('0x89')](_0x2073f3);})['then'](function(_0x4ca275){var _0x14f231=_[_0xb373('0x12a')](_0x4ca275);_0x2073f3=[];return db[_0xb373('0x64')][_0xb373('0x11d')](function(_0x1d6861){for(var _0x54474e=0x0;_0x54474e<_0x14f231[_0xb373('0x47')];_0x54474e++){_0x2073f3[_0xb373('0x43')](_0x14f231[_0x54474e]['removeAgent'](_0x27ee05['id']),{'transaction':_0x1d6861});}return BPromise[_0xb373('0x89')](_0x2073f3)[_0xb373('0x27')](function(){if(_0x27ee05[_0xb373('0xa8')]){return BPromise[_0xb373('0xaa')](_['filter'](_0x14f231,function(_0x4fdeac){return _0x4fdeac[_0xb373('0x11f')](_0xb373('0x99'))===_0xb373('0x115');}),function(_0x4517b8){return db[_0xb373('0xaf')][_0xb373('0x26')]({'where':{'VoiceQueueId':_0x4517b8['id'],'UserId':_0x27ee05['id']},'transaction':_0x1d6861});});}else{return;}})[_0xb373('0x27')](function(){db['TeamVoicePrefix'][_0xb373('0x93')]({'where':{'teamId':_0xa0dc7a['id']}})[_0xb373('0x27')](function(_0x17bf0b){if(_0x17bf0b){return db['UserVoicePrefix'][_0xb373('0x26')]({'where':{'UserId':_0x27ee05['id'],'VoicePrefixId':_0x17bf0b[_0xb373('0x4a')][_0xb373('0x122')]}});}});})['then'](function(){for(var _0x261483=0x0;_0x261483<_0x14f231[_0xb373('0x47')];_0x261483++){var _0x58a48d=_0x14f231[_0x261483]['getDataValue'](_0xb373('0x99'));var _0x59b85f=_0x58a48d+'QueueId';socket['emit'](_0xb373('0x79')+_0x58a48d+_0xb373('0xae'),{'UserId':_0x27ee05['id'],['queueField']:_0x14f231[_0x261483]['id']});}});});});}});}})[_0xb373('0x27')](respondWithStatusCode(_0x49a68a,null))[_0xb373('0x1c')](handleError(_0x49a68a,null));};exports[_0xb373('0x12b')]=function(_0x55a5e8,_0x3e170c){var _0xed65c5={};var _0x63ae4f={};var _0x1dc74b;var _0x3550a4;return db[_0xb373('0x36')][_0xb373('0x93')]({'where':{'id':_0x55a5e8['params']['id']}})[_0xb373('0x27')](handleEntityNotFound(_0x3e170c,null))[_0xb373('0x27')](function(_0x337045){if(_0x337045){_0x1dc74b=_0x337045;_0x63ae4f[_0xb373('0x51')]=_['keys'](db[_0xb373('0xce')][_0xb373('0x37')]);_0x63ae4f[_0xb373('0x3c')]=_[_0xb373('0x4f')](_0x55a5e8[_0xb373('0x3c')]);_0x63ae4f[_0xb373('0xc9')]=_[_0xb373('0x50')](_0x63ae4f[_0xb373('0x51')],_0x63ae4f[_0xb373('0x3c')]);_0xed65c5[_0xb373('0x42')]=_[_0xb373('0x50')](_0x63ae4f[_0xb373('0x51')],qs[_0xb373('0x52')](_0x55a5e8['query']['fields']));_0xed65c5['attributes']=_0xed65c5[_0xb373('0x42')][_0xb373('0x47')]?_0xed65c5['attributes']:_0x63ae4f[_0xb373('0x51')];_0xed65c5[_0xb373('0xca')]=qs[_0xb373('0xcb')](_0x55a5e8[_0xb373('0x3c')][_0xb373('0xcb')]);_0xed65c5['where']=qs[_0xb373('0xc9')](_['pick'](_0x55a5e8['query'],_0x63ae4f[_0xb373('0xc9')]));if(_0x55a5e8[_0xb373('0x3c')][_0xb373('0x2b')]){_0xed65c5[_0xb373('0x3b')]=_[_0xb373('0xcc')](_0xed65c5[_0xb373('0x3b')],{'$or':_[_0xb373('0x2d')](_0xed65c5['attributes'],function(_0x4a1448){var _0x3515fb={};_0x3515fb[_0x4a1448]={'$like':'%'+_0x55a5e8[_0xb373('0x3c')]['filter']+'%'};return _0x3515fb;})});}_0xed65c5=_[_0xb373('0xcc')]({},_0xed65c5,_0x55a5e8[_0xb373('0x53')]);return _0x1dc74b['getLists'](_0xed65c5);}})[_0xb373('0x27')](function(_0xcd2eed){if(_0xcd2eed){_0x3550a4=_0xcd2eed[_0xb373('0x47')];if(!_0x55a5e8[_0xb373('0x3c')][_0xb373('0xcd')](_0xb373('0xd9'))){_0xed65c5['limit']=qs[_0xb373('0x21')](_0x55a5e8[_0xb373('0x3c')]['limit']);_0xed65c5[_0xb373('0x1f')]=qs[_0xb373('0x1f')](_0x55a5e8[_0xb373('0x3c')]['offset']);}return _0x1dc74b[_0xb373('0x12b')](_0xed65c5);}})[_0xb373('0x27')](function(_0x5c41bf){if(_0x5c41bf){return _0x5c41bf?{'count':_0x3550a4,'rows':_0x5c41bf}:null;}})[_0xb373('0x27')](respondWithResult(_0x3e170c,null))[_0xb373('0x1c')](handleError(_0x3e170c,null));};exports[_0xb373('0x12c')]=function(_0x292b24,_0x4e1839){var _0x2aeeab={};var _0xea4a56={};var _0x168ccc;return db[_0xb373('0x36')][_0xb373('0x93')]({'where':{'id':_0x292b24['params']['id']}})[_0xb373('0x27')](handleEntityNotFound(_0x4e1839,null))[_0xb373('0x27')](function(_0x30f033){if(_0x30f033){_0x168ccc=_0x30f033;_0xea4a56[_0xb373('0x51')]=_[_0xb373('0x4f')](db[_0xb373('0x36')][_0xb373('0x37')]);_0xea4a56[_0xb373('0x3c')]=_['keys'](_0x292b24[_0xb373('0x3c')]);_0xea4a56[_0xb373('0xc9')]=_['intersection'](_0xea4a56[_0xb373('0x51')],_0xea4a56[_0xb373('0x3c')]);_0x2aeeab[_0xb373('0x42')]=_[_0xb373('0x50')](_0xea4a56[_0xb373('0x51')],qs[_0xb373('0x52')](_0x292b24[_0xb373('0x3c')][_0xb373('0x52')]));_0x2aeeab[_0xb373('0x42')]=_0x2aeeab[_0xb373('0x42')]['length']?_0x2aeeab[_0xb373('0x42')]:_0xea4a56[_0xb373('0x51')];_0x2aeeab[_0xb373('0xca')]=qs['sort'](_0x292b24[_0xb373('0x3c')][_0xb373('0xcb')]);_0x2aeeab['where']=qs['filters'](_[_0xb373('0xd5')](_0x292b24[_0xb373('0x3c')],_0xea4a56[_0xb373('0xc9')]));if(_0x292b24['query'][_0xb373('0x2b')]){_0x2aeeab[_0xb373('0x3b')]=_[_0xb373('0xcc')](_0x2aeeab[_0xb373('0x3b')],{'$or':_[_0xb373('0x2d')](_0x2aeeab[_0xb373('0x42')],function(_0x10bce0){var _0x4b2e9a={};_0x4b2e9a[_0x10bce0]={'$like':'%'+_0x292b24[_0xb373('0x3c')]['filter']+'%'};return _0x4b2e9a;})});}_0x2aeeab[_0xb373('0x51')]=db[_0xb373('0x36')];_0x2aeeab['as']=_0xb373('0x85');_0x2aeeab=_[_0xb373('0xcc')]({},_0x2aeeab,_0x292b24['options']);return _0x168ccc['getVoiceQueues']({'include':[_0x2aeeab]});}})['then'](function(_0x2e4a9c){if(_0x2e4a9c){var _0xe5aeb5={},_0x1188e9=[];for(var _0x2754d7=0x0;_0x2754d7<_0x2e4a9c['length'];_0x2754d7+=0x1){for(var _0x3da17f=0x0,_0x390aa3;_0x3da17f<_0x2e4a9c[_0x2754d7][_0xb373('0x85')][_0xb373('0x47')];_0x3da17f+=0x1){_0x390aa3=_0x2e4a9c[_0x2754d7][_0xb373('0x85')][_0x3da17f][_0xb373('0xd7')]({'plain':!![]});_0xe5aeb5[_0x390aa3['id']]=_0x390aa3;}}_0xe5aeb5=_['values'](_0xe5aeb5);for(var _0x1b51eb=qs['offset'](_0x292b24['query'][_0xb373('0x1f')]);_0x1b51eb<_0xe5aeb5['length']&&_0x1188e9['length']=_0x23783d){_0x5e8b99=_0x23783d;_0x22e9f5=0xc8;}else{_0x22e9f5=0xce;}_0x37c25a[_0xad8b('0x1f')](_0x22e9f5);return _0x37c25a[_0xad8b('0x24')](_0xad8b('0x25'),_0x607df0+'-'+_0x5e8b99+'/'+_0x23783d)[_0xad8b('0x26')](_0x406e41);}return null;};}function saveUpdates(_0x240918){return function(_0x219728){if(_0x219728){return _0x219728['update'](_0x240918)[_0xad8b('0x27')](function(_0x2ea6bc){return _0x2ea6bc;});}return null;};}function removeEntity(_0x493831){return function(_0x2589f2){if(_0x2589f2){return _0x2589f2[_0xad8b('0x28')]()[_0xad8b('0x27')](function(){var _0x3901c3=_0x2589f2[_0xad8b('0x29')]({'plain':!![]});if(_0x3901c3[_0xad8b('0x2a')]===_0xad8b('0x2b'))return;var _0xd43add=[{'name':'Users','value':_0xad8b('0x2c'),'ignore':!![]},{'name':_0xad8b('0x2d'),'value':_0xad8b('0x2e'),'ignore':![]},{'name':'Telephones','value':_0xad8b('0x2f'),'ignore':![]}];var _0x471304=_(_0xd43add)[_0xad8b('0x30')](_0xad8b('0x31'))['map'](_0xad8b('0x32'))[_0xad8b('0x32')]();if(_[_0xad8b('0x33')](_0x471304,_0x3901c3['role'])){return;}var _0x144641=_[_0xad8b('0x34')](_0xd43add,[_0xad8b('0x32'),_0x3901c3['role']])[_0xad8b('0x35')];return db[_0xad8b('0x36')][_0xad8b('0x28')]({'where':{'type':_0x144641,'resourceId':_0x3901c3['id']}})[_0xad8b('0x27')](function(){return _0x2589f2;});})[_0xad8b('0x27')](function(){_0x493831[_0xad8b('0x1f')](0xcc)[_0xad8b('0x37')]();});}};}function handleEntityNotFound(_0x1f428d){return function(_0x2801dc){if(!_0x2801dc){_0x1f428d[_0xad8b('0x1e')](0x194);}return _0x2801dc;};}function handleError(_0x33ea50,_0x3b8035){_0x3b8035=_0x3b8035||0x1f4;return function(_0x18629f){logger[_0xad8b('0x1a')](_0x18629f[_0xad8b('0x38')]);if(_0x18629f[_0xad8b('0x35')]){delete _0x18629f[_0xad8b('0x35')];}_0x33ea50[_0xad8b('0x1f')](_0x3b8035)[_0xad8b('0x39')](_0x18629f);};}exports[_0xad8b('0x3a')]=function(_0x498908,_0x347350){var _0x1927d2={},_0x3ea444={'count':0x0,'rows':[]};var _0x1f93f8=_(db[_0xad8b('0x3b')][_0xad8b('0x3c')])[_0xad8b('0x3d')](function(_0x18f4e1){return{'name':_0x18f4e1[_0xad8b('0x3e')],'type':_0x18f4e1[_0xad8b('0x3f')][_0xad8b('0x40')]};})['filter'](function(_0x528446){return!_[_0xad8b('0x33')]([_0xad8b('0x41'),'salt'],_0x528446['name']);})[_0xad8b('0x32')]();_0x1927d2=qs[_0xad8b('0x42')](_0x1f93f8,_0x498908);var _0x2da81f={'where':_0x1927d2[_0xad8b('0x43')]};return db[_0xad8b('0x3b')][_0xad8b('0x23')](_0x2da81f)[_0xad8b('0x27')](function(_0x210a5b){_0x3ea444[_0xad8b('0x23')]=_0x210a5b;if(_0x498908[_0xad8b('0x44')][_0xad8b('0x45')]){_0x1927d2[_0xad8b('0x46')]=[{'all':!![]}];}if(_0x498908[_0xad8b('0x44')][_0xad8b('0x47')]===_0xad8b('0x48')){_0x1927d2[_0xad8b('0x46')]=[{'model':db[_0xad8b('0x49')],'as':'userSetting'}];}if(!_[_0xad8b('0x33')](_0x1927d2[_0xad8b('0x4a')],'id')){_0x1927d2[_0xad8b('0x4a')][_0xad8b('0x4b')]('id');}return db[_0xad8b('0x3b')]['findAll'](_0x1927d2);})[_0xad8b('0x27')](function(_0x381436){_0x3ea444[_0xad8b('0x4c')]=_0x381436;if(_0x498908[_0xad8b('0x44')]['openTabs']===_0xad8b('0x48')){var _0x16e036=[];for(var _0xca05c8=0x0;_0xca05c8<_0x3ea444[_0xad8b('0x4c')][_0xad8b('0x4d')];_0xca05c8++){_0x16e036[_0xad8b('0x4b')](get_open_tabs(_0xad8b('0x4e'),_0x3ea444['rows'][_0xca05c8][_0xad8b('0x4f')]));_0x16e036[_0xad8b('0x4b')](get_open_tabs(_0xad8b('0x50'),_0x3ea444[_0xad8b('0x4c')][_0xca05c8][_0xad8b('0x4f')]));_0x16e036[_0xad8b('0x4b')](get_open_tabs('fax',_0x3ea444[_0xad8b('0x4c')][_0xca05c8][_0xad8b('0x4f')]));_0x16e036[_0xad8b('0x4b')](get_open_tabs('mail',_0x3ea444[_0xad8b('0x4c')][_0xca05c8][_0xad8b('0x4f')]));_0x16e036[_0xad8b('0x4b')](get_open_tabs(_0xad8b('0x51'),_0x3ea444['rows'][_0xca05c8][_0xad8b('0x4f')]));_0x16e036['push'](get_open_tabs(_0xad8b('0x52'),_0x3ea444['rows'][_0xca05c8][_0xad8b('0x4f')]));}return BPromise['all'](_0x16e036)[_0xad8b('0x27')](function(){return _0x3ea444;});}else{return _0x3ea444;}})[_0xad8b('0x27')](respondWithFilteredResult(_0x347350,_0x1927d2))[_0xad8b('0x1d')](handleError(_0x347350,null));};exports['show']=function(_0x394e98,_0x32217a){var _0x227e3c={'raw':![],'where':{'id':_0x394e98[_0xad8b('0x53')]['id']}},_0x52f7e6={};_0x52f7e6[_0xad8b('0x54')]=_[_0xad8b('0x55')](_['keys'](db[_0xad8b('0x3b')][_0xad8b('0x3c')]),[_0xad8b('0x41'),_0xad8b('0x56')]);_0x52f7e6[_0xad8b('0x44')]=_[_0xad8b('0x57')](_0x394e98['query']);_0x52f7e6['filters']=_['intersection'](_0x52f7e6[_0xad8b('0x54')],_0x52f7e6[_0xad8b('0x44')]);_0x227e3c['attributes']=_[_0xad8b('0x58')](_0x52f7e6['model'],qs[_0xad8b('0x59')](_0x394e98[_0xad8b('0x44')]['fields']));_0x227e3c[_0xad8b('0x4a')]=_0x227e3c[_0xad8b('0x4a')][_0xad8b('0x4d')]?_0x227e3c[_0xad8b('0x4a')]:_0x52f7e6['model'];if(_0x394e98[_0xad8b('0x44')]['includeAll']){_0x227e3c[_0xad8b('0x46')]=[{'all':!![]}];}if(_0x394e98[_0xad8b('0x44')][_0xad8b('0x47')]===_0xad8b('0x48')){_0x227e3c[_0xad8b('0x46')]=[{'model':db[_0xad8b('0x49')],'as':_0xad8b('0x47')}];}_0x227e3c=_[_0xad8b('0x5a')]({},_0x227e3c,_0x394e98['options']);if(!_[_0xad8b('0x33')](_0x227e3c[_0xad8b('0x4a')],'id')){_0x227e3c['attributes'][_0xad8b('0x4b')]('id');}return db[_0xad8b('0x3b')][_0xad8b('0x34')](_0x227e3c)[_0xad8b('0x27')](handleEntityNotFound(_0x32217a,null))[_0xad8b('0x27')](function(_0x4c8048){var _0x1d9a11=[];values=_0x4c8048;if(_0x394e98['query'][_0xad8b('0x5b')]===_0xad8b('0x48')){_0x1d9a11[_0xad8b('0x4b')](get_open_tabs(_0xad8b('0x4e'),_0x4c8048['dataValues']));_0x1d9a11[_0xad8b('0x4b')](get_open_tabs(_0xad8b('0x50'),_0x4c8048[_0xad8b('0x4f')]));_0x1d9a11['push'](get_open_tabs('openchannel',_0x4c8048[_0xad8b('0x4f')]));_0x1d9a11[_0xad8b('0x4b')](get_open_tabs(_0xad8b('0x52'),_0x4c8048[_0xad8b('0x4f')]));_0x1d9a11[_0xad8b('0x4b')](get_open_tabs(_0xad8b('0x5c'),_0x4c8048[_0xad8b('0x4f')]));_0x1d9a11[_0xad8b('0x4b')](get_open_tabs(_0xad8b('0x5d'),_0x4c8048[_0xad8b('0x4f')]));return BPromise['all'](_0x1d9a11);}else{return values;}})[_0xad8b('0x27')](function(){return values;})[_0xad8b('0x27')](respondWithResult(_0x32217a,null))[_0xad8b('0x1d')](handleError(_0x32217a,null));};exports[_0xad8b('0x5e')]=function(_0x1ad7fc,_0x7a0e46){if(_0x1ad7fc[_0xad8b('0x5f')]['id']){delete _0x1ad7fc[_0xad8b('0x5f')]['id'];}delete _0x1ad7fc['body'][_0xad8b('0x2a')];return db[_0xad8b('0x3b')][_0xad8b('0x34')]({'where':{'id':_0x1ad7fc['params']['id']}})['then'](handleEntityNotFound(_0x7a0e46,null))[_0xad8b('0x27')](saveUpdates(_0x1ad7fc[_0xad8b('0x5f')],null))[_0xad8b('0x27')](respondWithResult(_0x7a0e46,null))['catch'](handleError(_0x7a0e46,null));};exports[_0xad8b('0x60')]=function(_0x49f99a,_0x59d001){return db['User'][_0xad8b('0x60')]()[_0xad8b('0x27')](respondWithResult(_0x59d001,null))['catch'](handleError(_0x59d001,null));};exports[_0xad8b('0x61')]=function(_0x3b9a84,_0x1e5f5f){return db['User'][_0xad8b('0x34')]({'where':{'id':_0x3b9a84[_0xad8b('0x53')]['id']}})[_0xad8b('0x27')](handleEntityNotFound(_0x1e5f5f,null))['then'](function(_0x5282a6){if(_0x5282a6){return _0x5282a6['addContacts'](_0x3b9a84[_0xad8b('0x5f')][_0xad8b('0x62')],_[_0xad8b('0x63')](_0x3b9a84[_0xad8b('0x5f')],[_0xad8b('0x62'),'id'])||{});}})[_0xad8b('0x27')](respondWithResult(_0x1e5f5f,null))[_0xad8b('0x1d')](handleError(_0x1e5f5f,null));};function validateUser(_0x579f73){return new BPromise(function(_0x531687,_0x39f977){if(_0x579f73[_0xad8b('0x64')])return _0x531687(_0x579f73);return db[_0xad8b('0x65')][_0xad8b('0x66')](0x1)[_0xad8b('0x27')](function(_0x2b6f81){if(_0x2b6f81['securePassword'])authService[_0xad8b('0x67')](_0x579f73[_0xad8b('0x41')]);db[_0xad8b('0x3b')][_0xad8b('0x68')]('internal')[_0xad8b('0x27')](function(_0x32caf2){if(_[_0xad8b('0x69')](_0x32caf2)){_0x579f73['internal']=_0x2b6f81[_0xad8b('0x6a')]||0x1;return;}if(_[_0xad8b('0x69')](_0x2b6f81[_0xad8b('0x6a')])||_0x2b6f81[_0xad8b('0x6a')]===_0x32caf2){_0x579f73[_0xad8b('0x64')]=_0x32caf2+0x1;return;}if(_0x2b6f81[_0xad8b('0x6a')]>_0x32caf2){_0x579f73[_0xad8b('0x64')]=_0x2b6f81[_0xad8b('0x6a')];return;}return db[_0xad8b('0x6b')]['query']('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'][_0xad8b('0x6c')][_0xad8b('0x6d')]})[_0xad8b('0x27')](function(_0x22cb84){if(_0x22cb84&&_0x22cb84[_0xad8b('0x4d')]){for(var _0x2fc00e=0x0,_0x158d20=_0x22cb84[_0xad8b('0x4d')];_0x2fc00e<_0x158d20&&_[_0xad8b('0x69')](_0x579f73[_0xad8b('0x64')]);_0x2fc00e++){if(_0x2b6f81[_0xad8b('0x6a')]<=_0x22cb84[_0x2fc00e][_0xad8b('0x6e')]){_0x579f73[_0xad8b('0x64')]=_0x22cb84[_0x2fc00e]['from'];}else if(_0x2b6f81[_0xad8b('0x6a')]>_0x22cb84[_0x2fc00e][_0xad8b('0x6e')]&&_0x2b6f81['min_internal']<=_0x22cb84[_0x2fc00e]['to']){_0x579f73[_0xad8b('0x64')]=_0x2b6f81[_0xad8b('0x6a')];}}}if(_[_0xad8b('0x69')](_0x579f73[_0xad8b('0x64')])){_0x579f73['internal']=_0x32caf2+0x1;}return _0x531687(_0x579f73);});});})[_0xad8b('0x1d')](function(_0x179989){_0x39f977(_0x179989);});});}function updateUser(_0x540021){return new BPromise(function(_0x1ec3f6,_0x3250f9){try{if(_0x540021[_0xad8b('0x6f')]){_0x540021[_0xad8b('0x70')]=_0x540021[_0xad8b('0x64')];_0x540021[_0xad8b('0x71')]={'mailbox':_0x540021[_0xad8b('0x64')],'password':_0x540021['password'],'fullname':_0x540021[_0xad8b('0x72')],'email':_0x540021[_0xad8b('0x73')]};}if(_0x540021[_0xad8b('0x2a')]==='agent'){if(!_0x540021[_0xad8b('0x74')])_0x540021[_0xad8b('0x74')]=['101',_0xad8b('0x75'),'103','113','110',_0xad8b('0x76'),_0xad8b('0x77'),_0xad8b('0x78'),_0xad8b('0x79'),_0xad8b('0x7a'),_0xad8b('0x7b'),'100',_0xad8b('0x7c'),_0xad8b('0x7d'),_0xad8b('0x7e')];}_0x1ec3f6(_0x540021);}catch(_0x29a462){_0x3250f9(_0x29a462);}});}exports[_0xad8b('0x7f')]=function(_0x671596,_0x2e472a){if(_0x671596[_0xad8b('0x2c')][_0xad8b('0x2a')]===_0xad8b('0x2e'))throw new Error('Unauthorized');if(_0x671596['body']['role']===_0xad8b('0x2c')&&_0x671596[_0xad8b('0x2c')][_0xad8b('0x2a')]!==_0xad8b('0x2b')){throw new Error(_0xad8b('0x80'));}if(_0x671596['body']['role']===_0xad8b('0x2b')&&_0x671596[_0xad8b('0x2c')][_0xad8b('0x2a')]!==_0xad8b('0x2b')){throw new Error(_0xad8b('0x81'));}return licenseUtil[_0xad8b('0x82')]([_0x671596['body']])[_0xad8b('0x27')](function(){return validateUser(_0x671596[_0xad8b('0x5f')]);})[_0xad8b('0x27')](function(_0x426f92){return updateUser(_0x426f92)[_0xad8b('0x27')](function(_0x45d4c5){if(_0x45d4c5[_0xad8b('0x2a')]===_0xad8b('0x2b')){_0x45d4c5[_0xad8b('0x83')]=_0x671596[_0xad8b('0x2c')]['settingsEnabled'];delete _0x45d4c5[_0xad8b('0x84')];}return _0x45d4c5;});})[_0xad8b('0x27')](function(_0x34c211){return db[_0xad8b('0x3b')][_0xad8b('0x7f')](_0x34c211,{'include':[{'model':db[_0xad8b('0x71')],'as':_0xad8b('0x71')}]});})[_0xad8b('0x27')](function(_0x200f64){if(_0x671596['body'][_0xad8b('0x2a')]===_0xad8b('0x2c'))return _0x200f64;if(_0x671596[_0xad8b('0x2c')]['role']!==_0xad8b('0x2c'))return _0x200f64;return db['UserProfileSection']['find']({'where':{'name':_0x200f64['role']===_0xad8b('0x2e')?_0xad8b('0x2d'):_0xad8b('0x85'),'userProfileId':_0x671596['user'][_0xad8b('0x84')]},'raw':!![]})[_0xad8b('0x27')](function(_0x38d914){if(!_0x38d914||_0x38d914[_0xad8b('0x86')]!=0x0)return _0x200f64;return db[_0xad8b('0x36')][_0xad8b('0x7f')]({'name':_0x200f64[_0xad8b('0x35')],'resourceId':_0x200f64['id'],'type':_0x38d914[_0xad8b('0x35')],'sectionId':_0x38d914['id']},{})[_0xad8b('0x27')](function(){return _0x200f64;});})['catch'](function(_0x617b39){logger[_0xad8b('0x1a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x617b39);throw _0x617b39;});})[_0xad8b('0x27')](respondWithResult(_0x2e472a,0xc9))[_0xad8b('0x1d')](handleError(_0x2e472a,null));};exports[_0xad8b('0x87')]=function(_0x2fc0b2,_0x3a30f2){var _0x27d0d5=_0x2fc0b2[_0xad8b('0x5f')];var _0x45805b=[];if(_0x2fc0b2[_0xad8b('0x2c')][_0xad8b('0x2a')]===_0xad8b('0x2e'))throw new Error(_0xad8b('0x88'));if(_[_0xad8b('0x89')](_0x27d0d5,[_0xad8b('0x2a'),_0xad8b('0x2c')])&&_0x2fc0b2[_0xad8b('0x2c')][_0xad8b('0x2a')]!==_0xad8b('0x2b')){throw new Error(_0xad8b('0x80'));}if(_[_0xad8b('0x89')](_0x27d0d5,[_0xad8b('0x2a'),_0xad8b('0x2b')])&&_0x2fc0b2['user'][_0xad8b('0x2a')]!==_0xad8b('0x2b')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator');}return licenseUtil[_0xad8b('0x82')](_0x27d0d5)[_0xad8b('0x27')](function(){return validateUser(_0x27d0d5[0x0]);})[_0xad8b('0x27')](function(){for(var _0x34cb27=0x1;_0x34cb27<_0x27d0d5[_0xad8b('0x4d')];_0x34cb27++){var _0x51f4a1=_0x27d0d5[_0x34cb27-0x1][_0xad8b('0x64')];if(!_0x27d0d5[_0x34cb27][_0xad8b('0x64')])_0x27d0d5[_0x34cb27][_0xad8b('0x64')]=_0x51f4a1+0x1;_0x45805b[_0xad8b('0x4b')](validateUser(_0x27d0d5[_0x34cb27]));}return BPromise[_0xad8b('0x8a')](_0x45805b);})[_0xad8b('0x27')](function(){_0x45805b=[];for(var _0x4ce2d8=0x0;_0x4ce2d8<_0x27d0d5[_0xad8b('0x4d')];_0x4ce2d8++){_0x45805b[_0xad8b('0x4b')](updateUser(_0x27d0d5[_0x4ce2d8]));}return BPromise[_0xad8b('0x8a')](_0x45805b);})['then'](function(){return BPromise[_0xad8b('0x8b')](_0x27d0d5,function(_0x549ea7){return db[_0xad8b('0x3b')]['create'](_0x549ea7,{'include':[{'model':db[_0xad8b('0x71')],'as':_0xad8b('0x71')}]})[_0xad8b('0x27')](function(_0x210f6e){_0x549ea7['id']=_0x210f6e['id'];return _0x549ea7;});});})['then'](function(_0x1dde7e){if(_0x2fc0b2[_0xad8b('0x5f')][_0xad8b('0x2a')]===_0xad8b('0x2c'))return _0x1dde7e;if(_0x2fc0b2['user'][_0xad8b('0x2a')]!==_0xad8b('0x2c'))return _0x1dde7e;var _0x31342a=_[_0xad8b('0x89')](_0x1dde7e,function(_0x52775d){return _0x52775d[_0xad8b('0x2a')]==='agent'||_0x52775d[_0xad8b('0x2a')]===_0xad8b('0x2f');});if(!_0x31342a)return _0x1dde7e;return db['UserProfileSection'][_0xad8b('0x8c')]({'where':{'name':{'$or':[_0xad8b('0x2d'),_0xad8b('0x85')]},'userProfileId':_0x2fc0b2['user'][_0xad8b('0x84')]},'raw':!![]})[_0xad8b('0x27')](function(_0xa009e8){if(_[_0xad8b('0x8d')](_0xa009e8)||!_[_0xad8b('0x89')](_0xa009e8,['autoAssociation',0x0]))return _0x1dde7e;_0x45805b=[];var _0x327273=_(_0xa009e8)[_0xad8b('0x3d')](function(_0xadcc48){if(_0xadcc48[_0xad8b('0x86')]===0x1)return;return _0xadcc48['name']===_0xad8b('0x2d')?_0xad8b('0x2e'):_0xad8b('0x2f');})[_0xad8b('0x8e')]()[_0xad8b('0x32')]();for(var _0xe734f1=0x0;_0xe734f1<_0x1dde7e['length'];_0xe734f1++){if(!_[_0xad8b('0x33')](_0x327273,_0x1dde7e[_0xe734f1][_0xad8b('0x2a')]))return;var _0x13d2c7=_0x1dde7e[_0xe734f1][_0xad8b('0x2a')]===_0xad8b('0x2e')?_0xad8b('0x2d'):_0xad8b('0x85');_0x45805b[_0xad8b('0x4b')](db[_0xad8b('0x36')][_0xad8b('0x7f')]({'name':_0x1dde7e[_0xe734f1][_0xad8b('0x35')],'resourceId':_0x1dde7e[_0xe734f1]['id'],'type':_0x13d2c7,'sectionId':_[_0xad8b('0x34')](_0xa009e8,[_0xad8b('0x35'),_0x13d2c7])['id']},{}));}return BPromise['all'](_0x45805b);});})[_0xad8b('0x27')](respondWithResult(_0x3a30f2,0xc9))[_0xad8b('0x1d')](handleError(_0x3a30f2,null));};exports[_0xad8b('0x8f')]=function(_0xdf65ce,_0x3eb3ba){if(_0xdf65ce[_0xad8b('0x5f')]['id']){delete _0xdf65ce[_0xad8b('0x5f')]['id'];}return db[_0xad8b('0x3b')]['find']({'where':{'id':_0xdf65ce[_0xad8b('0x53')]['id']}})[_0xad8b('0x27')](function(_0x395c06){if(!_0x395c06)return null;if(_0x395c06['id']===_0xdf65ce[_0xad8b('0x2c')]['id']){if(!_0xdf65ce[_0xad8b('0x5f')][_0xad8b('0x90')]||!_0xdf65ce[_0xad8b('0x5f')]['newPassword']){throw new db['Sequelize'][(_0xad8b('0x91'))](_0xad8b('0x92'));}if(!_0x395c06[_0xad8b('0x93')](_0xdf65ce[_0xad8b('0x5f')][_0xad8b('0x90')])){throw new db[(_0xad8b('0x94'))][(_0xad8b('0x91'))](_0xad8b('0x95'));}if(_0xdf65ce[_0xad8b('0x5f')]['oldPassword']===_0xdf65ce[_0xad8b('0x5f')][_0xad8b('0x96')]){throw new db[(_0xad8b('0x94'))]['ValidationError'](_0xad8b('0x97'));}}else if(_0xdf65ce[_0xad8b('0x2c')][_0xad8b('0x2a')]===_0xad8b('0x2b')){if(!_0xdf65ce[_0xad8b('0x5f')][_0xad8b('0x96')]){throw new db['Sequelize'][(_0xad8b('0x91'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}}else if(_0xdf65ce[_0xad8b('0x2c')][_0xad8b('0x2a')]===_0xad8b('0x2c')){if(!_0xdf65ce['body'][_0xad8b('0x96')]){throw new db['Sequelize'][(_0xad8b('0x91'))](_0xad8b('0x98'));}if(_0x395c06[_0xad8b('0x2a')]!==_0xad8b('0x2e')){throw new db[(_0xad8b('0x94'))][(_0xad8b('0x91'))]('Unauthorized');}}else{throw new db[(_0xad8b('0x94'))][(_0xad8b('0x91'))](_0xad8b('0x88'));}return _0x395c06;})[_0xad8b('0x27')](handleEntityNotFound(_0x3eb3ba,null))[_0xad8b('0x27')](function(_0x423b3a){return db[_0xad8b('0x65')][_0xad8b('0x99')]({'attributes':['id',_0xad8b('0x9a'),'enforcePasswordHistory',_0xad8b('0x9b')]})[_0xad8b('0x27')](function(_0x1adebb){if(_0x1adebb[_0xad8b('0x9a')])authService[_0xad8b('0x67')](_0xdf65ce[_0xad8b('0x5f')]['newPassword']);if(!_0x1adebb['enforcePasswordHistory']||!_0x423b3a[_0xad8b('0x9c')])return _0x423b3a;authService['validatePasswordHistory'](_0xdf65ce[_0xad8b('0x5f')][_0xad8b('0x96')],_0x423b3a[_0xad8b('0x9c')],_0x1adebb[_0xad8b('0x9b')]);return _0x423b3a;})[_0xad8b('0x27')](saveUpdates({'password':_0xdf65ce[_0xad8b('0x5f')][_0xad8b('0x96')],'passwordResetAt':_0xdf65ce['user']['id']==_0xdf65ce['params']['id']?moment():null,'previousPasswords':authService[_0xad8b('0x9d')](_0xdf65ce[_0xad8b('0x5f')][_0xad8b('0x96')],_0x423b3a['previousPasswords'])},null));})[_0xad8b('0x27')](respondWithResult(_0x3eb3ba,null))[_0xad8b('0x1d')](handleError(_0x3eb3ba,null));};exports['addQueues']=function(_0x59e59a,_0x5ac7c7){var _0x93ae65=_0x59e59a[_0xad8b('0x5f')][_0xad8b('0x9e')];return db[_0xad8b('0x3b')][_0xad8b('0x34')]({'where':{'id':_0x59e59a['params']['id']},'attributes':['id',_0xad8b('0x35'),'role',_0xad8b('0x9f'),_0xad8b('0xa0'),'voicePause','interface']})[_0xad8b('0x27')](handleEntityNotFound(_0x5ac7c7,null))[_0xad8b('0x27')](function(_0x53940e){if(_0x53940e){if(!utils[_0xad8b('0xa1')](_0x93ae65)){throw new db[(_0xad8b('0x94'))][(_0xad8b('0x91'))](_0xad8b('0xa2'));}return _0x53940e[_0xad8b('0xa3')+_[_0xad8b('0xa4')](_0x93ae65[_0xad8b('0xa5')]())+_0xad8b('0xa6')](_0x59e59a[_0xad8b('0x5f')][_0xad8b('0x62')],{'penalty':_0x59e59a['body'][_0xad8b('0xa7')]||0x0})[_0xad8b('0xa8')](function(_0x4d0185){for(var _0x3e6065=0x0;_0x3e6065<_0x59e59a[_0xad8b('0x5f')]['ids'][_0xad8b('0x4d')];_0x3e6065+=0x1){var _0x14df4d={'UserId':Number(_0x59e59a['params']['id'])};_0x14df4d[_[_0xad8b('0xa4')](_0x93ae65[_0xad8b('0xa5')]())+_0xad8b('0xa9')]=Number(_0x59e59a[_0xad8b('0x5f')][_0xad8b('0x62')][_0x3e6065]);socket[_0xad8b('0xaa')](_0xad8b('0x2c')+_[_0xad8b('0xa4')](_0x93ae65['toLowerCase']())+_0xad8b('0xab'),_0x14df4d);}return _0x4d0185;})[_0xad8b('0x27')](function(){if(_0x93ae65==='voice'){return db['VoiceQueue'][_0xad8b('0x8c')]({'where':{'id':_0x59e59a[_0xad8b('0x5f')]['ids']||[]},'raw':!![],'attributes':['id','name']});}})['then'](function(_0x2cf508){var _0xef60ee=_0x53940e['get']({'plain':!![]});var _0xae8658=[];if(_0x93ae65===_0xad8b('0xac')&&_0xef60ee[_0xad8b('0x2a')]==='agent'&&_0xef60ee[_0xad8b('0x9f')]){for(var _0x2051f9=0x0;_0x2051f9<_0x2cf508[_0xad8b('0x4d')];_0x2051f9+=0x1){_0xae8658[_0xad8b('0x4b')]({'membername':_0xef60ee[_0xad8b('0x35')],'UserId':_0xef60ee['id'],'queue_name':_0x2cf508[_0x2051f9]['name'],'VoiceQueueId':_0x2cf508[_0x2051f9]['id'],'interface':_[_0xad8b('0x69')](_0xef60ee['interface'])?util['format'](_0xad8b('0xad'),_0xef60ee[_0xad8b('0x35')]):_0xef60ee['interface'],'paused':_0xef60ee[_0xad8b('0xae')]||![],'penalty':_0x59e59a[_0xad8b('0x5f')][_0xad8b('0xa7')]||0x0});}return BPromise[_0xad8b('0x8b')](_0xae8658,function(_0x553b9e){return db[_0xad8b('0xaf')][_0xad8b('0xb0')](_0x553b9e);});}return _0x53940e;});}})[_0xad8b('0x27')](respondWithStatusCode(_0x5ac7c7,null))[_0xad8b('0x1d')](handleError(_0x5ac7c7,null));};exports[_0xad8b('0xb1')]=function(_0x3c738a,_0x187118){var _0x459769,_0x59c870;return db[_0xad8b('0x3b')]['find']({'where':{'id':_0x3c738a['params']['id']},'attributes':['id',_0xad8b('0x35'),'role']})['then'](handleEntityNotFound(_0x187118,null))[_0xad8b('0x27')](function(_0x216431){if(_0x216431){_0x459769=_0x216431;if(!_0x3c738a[_0xad8b('0x44')]['channel']||!utils[_0xad8b('0xa1')](_0x3c738a['query'][_0xad8b('0x9e')])){throw new db[(_0xad8b('0x94'))]['ValidationError'](_0xad8b('0xa2'));}return _0x216431[_0xad8b('0xb2')+_[_0xad8b('0xa4')](_0x3c738a[_0xad8b('0x44')][_0xad8b('0x9e')][_0xad8b('0xa5')]())+_0xad8b('0xa6')](_0x3c738a[_0xad8b('0x44')][_0xad8b('0x62')]);}})['then'](function(_0x2d3e35){if(_[_0xad8b('0xb3')](_0x3c738a[_0xad8b('0x44')][_0xad8b('0x62')])){for(var _0x474f8e=0x0;_0x474f8e<_0x3c738a['query']['ids'][_0xad8b('0x4d')];_0x474f8e+=0x1){_0x59c870={'UserId':Number(_0x3c738a[_0xad8b('0x53')]['id'])};_0x59c870[_[_0xad8b('0xa4')](_0x3c738a['query']['channel'][_0xad8b('0xa5')]())+'QueueId']=Number(_0x3c738a[_0xad8b('0x44')][_0xad8b('0x62')][_0x474f8e]);socket[_0xad8b('0xaa')](_0xad8b('0x2c')+_[_0xad8b('0xa4')](_0x3c738a['query']['channel']['toLowerCase']())+'Queue:remove',_0x59c870);}}else{_0x59c870={'UserId':Number(_0x3c738a[_0xad8b('0x53')]['id'])};_0x59c870[_['capitalize'](_0x3c738a[_0xad8b('0x44')]['channel']['toLowerCase']())+_0xad8b('0xa9')]=Number(_0x3c738a[_0xad8b('0x44')][_0xad8b('0x62')]);socket['emit']('user'+_[_0xad8b('0xa4')](_0x3c738a[_0xad8b('0x44')][_0xad8b('0x9e')][_0xad8b('0xa5')]())+'Queue:remove',_0x59c870);}return _0x2d3e35;})[_0xad8b('0x27')](function(){if(_0x3c738a[_0xad8b('0x44')][_0xad8b('0x9e')]==='voice'){return db['UserVoiceQueueRt'][_0xad8b('0x28')]({'where':{'UserId':_0x3c738a[_0xad8b('0x53')]['id'],'VoiceQueueId':_0x3c738a[_0xad8b('0x44')][_0xad8b('0x62')]},'individualHooks':!![]})['then'](function(){return _0x459769;});}return _0x459769;})[_0xad8b('0x27')](respondWithStatusCode(_0x187118,null))[_0xad8b('0x1d')](handleError(_0x187118,null));};exports[_0xad8b('0xb4')]=function(_0x2c05e7,_0x1a9d6d){_0x2c05e7[_0xad8b('0x5f')][_0xad8b('0xb5')]=_0x2c05e7[_0xad8b('0xb6')][_0xad8b('0xb7')];return db[_0xad8b('0x3b')][_0xad8b('0x34')]({'where':{'id':_0x2c05e7[_0xad8b('0x53')]['id']}})[_0xad8b('0x27')](handleEntityNotFound(_0x1a9d6d,null))['then'](saveUpdates(_0x2c05e7[_0xad8b('0x5f')],null))['then'](respondWithResult(_0x1a9d6d,null))[_0xad8b('0x1d')](handleError(_0x1a9d6d,null));};exports[_0xad8b('0xb8')]=function(_0x36af7c,_0x2924e0){var _0x4e82cf=path['join'](config[_0xad8b('0xb9')],_0xad8b('0xba'));return db[_0xad8b('0x3b')][_0xad8b('0x34')]({'where':{'id':_0x36af7c['params']['id']},'attributes':['id',_0xad8b('0xb5')],'raw':!![]})[_0xad8b('0x27')](handleEntityNotFound(_0x2924e0,null))[_0xad8b('0x27')](function(_0x441cf){if(_0x441cf){if(_[_0xad8b('0x69')](_0x441cf[_0xad8b('0xb5')])){return _0x2924e0[_0xad8b('0xbb')](_0x4e82cf);}else{if(!fs[_0xad8b('0xbc')](path[_0xad8b('0xbd')](config[_0xad8b('0xb9')],_0xad8b('0xbe'),_0x441cf[_0xad8b('0xb5')]))){return _0x2924e0[_0xad8b('0xbb')](_0x4e82cf);}return _0x2924e0[_0xad8b('0xbb')](path['join'](config[_0xad8b('0xb9')],_0xad8b('0xbe'),_0x441cf['userpic']));}}})[_0xad8b('0x1d')](handleError(_0x2924e0,null));};exports[_0xad8b('0xbf')]=function(_0x53a1b5,_0x3701f3){return db[_0xad8b('0x3b')][_0xad8b('0x34')]({'where':{'id':_0x53a1b5[_0xad8b('0x53')]['id']},'attributes':['id']})[_0xad8b('0x27')](handleEntityNotFound(_0x3701f3,null))[_0xad8b('0x27')](function(_0x215839){var _0x135923=[];values=_0x215839[_0xad8b('0x4f')];_0x135923[_0xad8b('0x4b')](get_open_tabs(_0xad8b('0x4e'),_0x215839['dataValues']));_0x135923['push'](get_open_tabs(_0xad8b('0x50'),_0x215839['dataValues']));_0x135923[_0xad8b('0x4b')](get_open_tabs(_0xad8b('0x51'),_0x215839['dataValues']));_0x135923[_0xad8b('0x4b')](get_open_tabs(_0xad8b('0x52'),_0x215839['dataValues']));_0x135923['push'](get_open_tabs(_0xad8b('0x5c'),_0x215839[_0xad8b('0x4f')]));_0x135923['push'](get_open_tabs(_0xad8b('0x5d'),_0x215839[_0xad8b('0x4f')]));return BPromise[_0xad8b('0x8a')](_0x135923);})[_0xad8b('0x27')](function(_0x1e1406){if(_0x1e1406){var _0x52aa95=_[_0xad8b('0x3d')](values[_0xad8b('0xc0')],function(_0x44f508){return{'channel':_0xad8b('0xc1'),'id':_0x44f508['id'],'createdAt':_0x44f508['createdAt']};});var _0x39e981=_[_0xad8b('0x3d')](values[_0xad8b('0xc2')],function(_0x208f19){return{'channel':'FAX','id':_0x208f19['id'],'createdAt':_0x208f19[_0xad8b('0xc3')]};});var _0x249f41=_[_0xad8b('0x3d')](values[_0xad8b('0xc4')],function(_0x4986ad){return{'channel':_0xad8b('0xc5'),'id':_0x4986ad['id'],'createdAt':_0x4986ad[_0xad8b('0xc3')]};});var _0x417569=_[_0xad8b('0x3d')](values[_0xad8b('0xc6')],function(_0x5a5c87){return{'channel':'MAIL','id':_0x5a5c87['id'],'createdAt':_0x5a5c87['createdAt']};});var _0x4bbace=_['map'](values[_0xad8b('0xc7')],function(_0x2c1d13){return{'channel':_0xad8b('0xc8'),'id':_0x2c1d13['id'],'createdAt':_0x2c1d13['createdAt']};});var _0x32916c=_['map'](values[_0xad8b('0xc9')],function(_0x5d199a){return{'channel':_0xad8b('0xca'),'id':_0x5d199a['id'],'createdAt':_0x5d199a[_0xad8b('0xc3')]};});var _0x167cea=_[_0xad8b('0xcb')](_0x52aa95,_0x39e981,_0x249f41,_0x417569,_0x4bbace,_0x32916c);var _0x216a54={'count':_0x167cea[_0xad8b('0x4d')],'rows':_0x167cea};return _0x216a54;}else return null;})[_0xad8b('0x27')](respondWithResult(_0x3701f3,null))['catch'](handleError(_0x3701f3,null));};exports['getContacts']=function(_0x58d654,_0x536450){var _0x38d2bb={};var _0x1b0a6f={};var _0x2ab013;var _0x1ae0e1;return db[_0xad8b('0x3b')][_0xad8b('0x99')]({'where':{'id':_0x58d654[_0xad8b('0x53')]['id']}})[_0xad8b('0x27')](handleEntityNotFound(_0x536450,null))[_0xad8b('0x27')](function(_0x459593){if(_0x459593){_0x2ab013=_0x459593;_0x1b0a6f['model']=_[_0xad8b('0x57')](db['CmContact'][_0xad8b('0x3c')]);_0x1b0a6f['query']=_['keys'](_0x58d654[_0xad8b('0x44')]);_0x1b0a6f[_0xad8b('0xcc')]=_[_0xad8b('0x58')](_0x1b0a6f[_0xad8b('0x54')],_0x1b0a6f[_0xad8b('0x44')]);_0x38d2bb['attributes']=_[_0xad8b('0x58')](_0x1b0a6f[_0xad8b('0x54')],qs['fields'](_0x58d654['query'][_0xad8b('0x59')]));_0x38d2bb['attributes']=_0x38d2bb['attributes'][_0xad8b('0x4d')]?_0x38d2bb['attributes']:_0x1b0a6f[_0xad8b('0x54')];_0x38d2bb[_0xad8b('0xcd')]=qs[_0xad8b('0xce')](_0x58d654['query']['sort']);_0x38d2bb[_0xad8b('0x43')]=qs[_0xad8b('0xcc')](_['pick'](_0x58d654[_0xad8b('0x44')],_0x1b0a6f['filters']));if(_0x58d654[_0xad8b('0x44')]['filter']){_0x38d2bb['where']=_['merge'](_0x38d2bb['where'],{'$or':_[_0xad8b('0x3d')](_0x38d2bb[_0xad8b('0x4a')],function(_0x23b774){var _0x4d1941={};_0x4d1941[_0x23b774]={'$like':'%'+_0x58d654[_0xad8b('0x44')][_0xad8b('0x30')]+'%'};return _0x4d1941;})});}_0x38d2bb=_[_0xad8b('0x5a')]({},_0x38d2bb,_0x58d654[_0xad8b('0xcf')]);return _0x2ab013[_0xad8b('0xd0')](_0x38d2bb);}})[_0xad8b('0x27')](function(_0x544d63){if(_0x544d63){_0x1ae0e1=_0x544d63[_0xad8b('0x4d')];if(_0x58d654[_0xad8b('0x44')][_0xad8b('0xd1')](_0xad8b('0x45'))){_0x38d2bb[_0xad8b('0x46')]=[{'model':db[_0xad8b('0xd2')],'as':_0xad8b('0xd3'),'required':![]},{'model':db[_0xad8b('0xd4')],'as':_0xad8b('0xd5'),'attributes':['id',_0xad8b('0x35'),'color'],'where':_0x58d654['query'][_0xad8b('0xd6')]?{'id':_0x58d654[_0xad8b('0x44')]['tag']}:undefined,'required':_0x58d654[_0xad8b('0x44')][_0xad8b('0xd6')]?!![]:![]}];}if(!_0x58d654['query'][_0xad8b('0xd1')]('nolimit')){_0x38d2bb[_0xad8b('0x22')]=qs[_0xad8b('0x22')](_0x58d654[_0xad8b('0x44')][_0xad8b('0x22')]);_0x38d2bb[_0xad8b('0x20')]=qs[_0xad8b('0x20')](_0x58d654['query']['offset']);}return _0x2ab013[_0xad8b('0xd0')](_0x38d2bb);}})[_0xad8b('0x27')](function(_0x5abb38){if(_0x5abb38){return _0x5abb38?{'count':_0x1ae0e1,'rows':_0x5abb38}:null;}})[_0xad8b('0x27')](respondWithResult(_0x536450,null))[_0xad8b('0x1d')](handleError(_0x536450,null));};exports[_0xad8b('0xd7')]=function(_0x2f1069,_0x1429bc){var _0x23335d;var _0x505c76={};var _0x43abdf;return db[_0xad8b('0x3b')]['findOne']({'where':{'id':_0x2f1069['params']['id']},'attributes':['id',_0xad8b('0x35'),'role']})[_0xad8b('0x27')](handleEntityNotFound(_0x1429bc,null))['then'](function(_0x15a8b9){if(!utils[_0xad8b('0xa1')](_0x2f1069['query']['channel'])){throw new db[(_0xad8b('0x94'))][(_0xad8b('0x91'))](_0xad8b('0xa2'));}_0x23335d=_0x15a8b9;var _0x59dc47={};_0x59dc47[_0xad8b('0x54')]=_[_0xad8b('0x57')](db[_['capitalize'](_0x2f1069[_0xad8b('0x44')]['channel'])+_0xad8b('0xd8')][_0xad8b('0x3c')]);_0x59dc47[_0xad8b('0x44')]=_[_0xad8b('0x57')](_0x2f1069[_0xad8b('0x44')]);_0x59dc47[_0xad8b('0xcc')]=_[_0xad8b('0x58')](_0x59dc47['model'],_0x59dc47['query']);_0x505c76[_0xad8b('0x4a')]=_['intersection'](_0x59dc47[_0xad8b('0x54')],qs[_0xad8b('0x59')](_0x2f1069[_0xad8b('0x44')][_0xad8b('0x59')]));_0x505c76['attributes']=_0x505c76['attributes'][_0xad8b('0x4d')]?_0x505c76[_0xad8b('0x4a')]:_0x59dc47[_0xad8b('0x54')];_0x505c76[_0xad8b('0xcd')]=qs[_0xad8b('0xce')](_0x2f1069['query'][_0xad8b('0xce')]);_0x505c76['where']=qs[_0xad8b('0xcc')](_[_0xad8b('0xd9')](_0x2f1069[_0xad8b('0x44')],_0x59dc47[_0xad8b('0xcc')]));if(_0x2f1069['query']['filter']){_0x505c76[_0xad8b('0x43')]=_[_0xad8b('0x5a')](_0x505c76[_0xad8b('0x43')],{'$or':_[_0xad8b('0x3d')](_0x505c76['attributes'],function(_0x2d952d){var _0xb2e72b={};_0xb2e72b[_0x2d952d]={'$like':'%'+_0x2f1069[_0xad8b('0x44')][_0xad8b('0x30')]+'%'};return _0xb2e72b;})});}_0x505c76=_['merge']({},_0x505c76,_0x2f1069[_0xad8b('0xcf')]);switch(_0x23335d[_0xad8b('0x2a')]){case _0xad8b('0x2b'):return db[_[_0xad8b('0xa4')](_0x2f1069[_0xad8b('0x44')][_0xad8b('0x9e')])+_0xad8b('0xd8')][_0xad8b('0x8c')](_0x505c76);case _0xad8b('0x2c'):case _0xad8b('0x2e'):return _0x23335d['get'+_['capitalize'](_0x2f1069[_0xad8b('0x44')][_0xad8b('0x9e')])+_0xad8b('0xa6')](_0x505c76);default:throw new db[(_0xad8b('0x94'))]['ValidationError'](_0xad8b('0xda'));}})[_0xad8b('0x27')](function(_0x5946f2){_0x43abdf=_0x5946f2[_0xad8b('0x4d')];if(!_0x2f1069[_0xad8b('0x44')][_0xad8b('0xd1')](_0xad8b('0xdb'))){_0x505c76[_0xad8b('0x22')]=qs['limit'](_0x2f1069['query'][_0xad8b('0x22')]);_0x505c76[_0xad8b('0x20')]=qs[_0xad8b('0x20')](_0x2f1069['query']['offset']);}switch(_0x23335d[_0xad8b('0x2a')]){case _0xad8b('0x2b'):return db[_[_0xad8b('0xa4')](_0x2f1069[_0xad8b('0x44')][_0xad8b('0x9e')])+_0xad8b('0xd8')]['findAll'](_0x505c76);case'user':case _0xad8b('0x2e'):return _0x23335d[_0xad8b('0x29')+_[_0xad8b('0xa4')](_0x2f1069[_0xad8b('0x44')]['channel'])+_0xad8b('0xa6')](_0x505c76);}})['then'](function(_0xcee5a2){return{'count':_0x43abdf,'rows':_0xcee5a2};})[_0xad8b('0x27')](respondWithResult(_0x1429bc,null))[_0xad8b('0x1d')](handleError(_0x1429bc,null));};exports[_0xad8b('0xdc')]=function(_0x3777b1,_0x422c92){var _0x5578b5={};var _0x326df0={};var _0x4720af;var _0x520b14;return db[_0xad8b('0x3b')][_0xad8b('0x99')]({'where':{'id':_0x3777b1[_0xad8b('0x53')]['id']}})[_0xad8b('0x27')](handleEntityNotFound(_0x422c92,null))[_0xad8b('0x27')](function(_0x421820){if(_0x421820){_0x4720af=_0x421820;_0x326df0[_0xad8b('0x54')]=_['keys'](db[_0xad8b('0xaf')][_0xad8b('0x3c')]);_0x326df0[_0xad8b('0x44')]=_[_0xad8b('0x57')](_0x3777b1[_0xad8b('0x44')]);_0x326df0[_0xad8b('0xcc')]=_[_0xad8b('0x58')](_0x326df0[_0xad8b('0x54')],_0x326df0[_0xad8b('0x44')]);_0x5578b5[_0xad8b('0x4a')]=_[_0xad8b('0x58')](_0x326df0['model'],qs['fields'](_0x3777b1[_0xad8b('0x44')][_0xad8b('0x59')]));_0x5578b5[_0xad8b('0x4a')]=_0x5578b5[_0xad8b('0x4a')][_0xad8b('0x4d')]?_0x5578b5[_0xad8b('0x4a')]:_0x326df0[_0xad8b('0x54')];_0x5578b5[_0xad8b('0xcd')]=qs[_0xad8b('0xce')](_0x3777b1[_0xad8b('0x44')][_0xad8b('0xce')]);_0x5578b5[_0xad8b('0x43')]=qs[_0xad8b('0xcc')](_[_0xad8b('0xd9')](_0x3777b1['query'],_0x326df0[_0xad8b('0xcc')]));if(_0x3777b1['query'][_0xad8b('0x30')]){_0x5578b5['where']=_[_0xad8b('0x5a')](_0x5578b5[_0xad8b('0x43')],{'$or':_['map'](_0x5578b5[_0xad8b('0x4a')],function(_0x158b34){var _0xc2d3e5={};_0xc2d3e5[_0x158b34]={'$like':'%'+_0x3777b1['query'][_0xad8b('0x30')]+'%'};return _0xc2d3e5;})});}_0x5578b5=_[_0xad8b('0x5a')]({},_0x5578b5,_0x3777b1[_0xad8b('0xcf')]);return _0x4720af[_0xad8b('0xdc')](_0x5578b5);}})[_0xad8b('0x27')](function(_0x515a5e){if(_0x515a5e){_0x520b14=_0x515a5e[_0xad8b('0x4d')];if(!_0x3777b1['query'][_0xad8b('0xd1')]('nolimit')){_0x5578b5['limit']=qs['limit'](_0x3777b1[_0xad8b('0x44')]['limit']);_0x5578b5[_0xad8b('0x20')]=qs[_0xad8b('0x20')](_0x3777b1[_0xad8b('0x44')][_0xad8b('0x20')]);}return _0x4720af[_0xad8b('0xdc')](_0x5578b5);}})[_0xad8b('0x27')](function(_0x5d7097){if(_0x5d7097){return _0x5d7097?{'count':_0x520b14,'rows':_0x5d7097}:null;}})['then'](respondWithResult(_0x422c92,null))['catch'](handleError(_0x422c92,null));};exports[_0xad8b('0xdd')]=function(_0x1c88ce,_0x30c5b2){var _0x2b9b68={};var _0xd6db38={};var _0x50b741;var _0x1d1ba7;return db['User'][_0xad8b('0x99')]({'where':{'id':_0x1c88ce['params']['id']}})['then'](handleEntityNotFound(_0x30c5b2,null))[_0xad8b('0x27')](function(_0x599efb){if(_0x599efb){_0x50b741=_0x599efb;_0xd6db38[_0xad8b('0x54')]=_[_0xad8b('0x57')](db[_0xad8b('0xde')][_0xad8b('0x3c')]);_0xd6db38[_0xad8b('0x44')]=_[_0xad8b('0x57')](_0x1c88ce[_0xad8b('0x44')]);_0xd6db38[_0xad8b('0xcc')]=_[_0xad8b('0x58')](_0xd6db38[_0xad8b('0x54')],_0xd6db38[_0xad8b('0x44')]);_0x2b9b68['attributes']=_[_0xad8b('0x58')](_0xd6db38[_0xad8b('0x54')],qs[_0xad8b('0x59')](_0x1c88ce['query'][_0xad8b('0x59')]));_0x2b9b68[_0xad8b('0x4a')]=_0x2b9b68[_0xad8b('0x4a')]['length']?_0x2b9b68[_0xad8b('0x4a')]:_0xd6db38[_0xad8b('0x54')];_0x2b9b68[_0xad8b('0xcd')]=qs[_0xad8b('0xce')](_0x1c88ce[_0xad8b('0x44')][_0xad8b('0xce')]);_0x2b9b68[_0xad8b('0x43')]=qs[_0xad8b('0xcc')](_[_0xad8b('0xd9')](_0x1c88ce[_0xad8b('0x44')],_0xd6db38[_0xad8b('0xcc')]));if(_0x1c88ce[_0xad8b('0x44')]['filter']){_0x2b9b68['where']=_[_0xad8b('0x5a')](_0x2b9b68[_0xad8b('0x43')],{'$or':_['map'](_0x2b9b68[_0xad8b('0x4a')],function(_0x3e0412){var _0x263512={};_0x263512[_0x3e0412]={'$like':'%'+_0x1c88ce[_0xad8b('0x44')]['filter']+'%'};return _0x263512;})});}_0x2b9b68=_[_0xad8b('0x5a')]({},_0x2b9b68,_0x1c88ce[_0xad8b('0xcf')]);return _0x50b741[_0xad8b('0xdd')](_0x2b9b68);}})[_0xad8b('0x27')](function(_0xfb27f3){if(_0xfb27f3){_0x1d1ba7=_0xfb27f3[_0xad8b('0x4d')];if(!_0x1c88ce['query'][_0xad8b('0xd1')](_0xad8b('0xdb'))){_0x2b9b68[_0xad8b('0x22')]=qs[_0xad8b('0x22')](_0x1c88ce[_0xad8b('0x44')][_0xad8b('0x22')]);_0x2b9b68[_0xad8b('0x20')]=qs[_0xad8b('0x20')](_0x1c88ce[_0xad8b('0x44')]['offset']);}return _0x50b741[_0xad8b('0xdd')](_0x2b9b68);}})['then'](function(_0x43e239){if(_0x43e239){return _0x43e239?{'count':_0x1d1ba7,'rows':_0x43e239}:null;}})[_0xad8b('0x27')](respondWithResult(_0x30c5b2,null))['catch'](handleError(_0x30c5b2,null));};exports[_0xad8b('0xdf')]=function(_0x2ecbc8,_0x5cfd44){var _0x1f6bcb={'raw':!![],'where':{}};var _0x123660={};var _0x572fa4={'count':0x0,'rows':[]};return db[_0xad8b('0x3b')][_0xad8b('0x99')]({'where':{'id':_0x2ecbc8[_0xad8b('0x53')]['id']}})[_0xad8b('0x27')](handleEntityNotFound(_0x5cfd44,null))['then'](function(_0x44d14e){if(_0x44d14e){_0x123660[_0xad8b('0x54')]=_[_0xad8b('0x57')](db[_0xad8b('0xe0')][_0xad8b('0x3c')]);_0x123660['query']=_[_0xad8b('0x57')](_0x2ecbc8[_0xad8b('0x44')]);_0x123660['filters']=_['intersection'](_0x123660[_0xad8b('0x54')],_0x123660[_0xad8b('0x44')]);_0x1f6bcb[_0xad8b('0x4a')]=_[_0xad8b('0x58')](_0x123660[_0xad8b('0x54')],qs['fields'](_0x2ecbc8['query']['fields']));_0x1f6bcb[_0xad8b('0x4a')]=_0x1f6bcb[_0xad8b('0x4a')][_0xad8b('0x4d')]?_0x1f6bcb['attributes']:_0x123660['model'];if(!_0x2ecbc8[_0xad8b('0x44')][_0xad8b('0xd1')](_0xad8b('0xdb'))){_0x1f6bcb[_0xad8b('0x22')]=qs['limit'](_0x2ecbc8[_0xad8b('0x44')][_0xad8b('0x22')]);_0x1f6bcb[_0xad8b('0x20')]=qs[_0xad8b('0x20')](_0x2ecbc8[_0xad8b('0x44')][_0xad8b('0x20')]);}_0x1f6bcb[_0xad8b('0xcd')]=qs['sort'](_0x2ecbc8[_0xad8b('0x44')][_0xad8b('0xce')]);_0x1f6bcb[_0xad8b('0x43')]=qs['filters'](_[_0xad8b('0xd9')](_0x2ecbc8[_0xad8b('0x44')],_0x123660[_0xad8b('0xcc')]));_0x1f6bcb['where'][_0xad8b('0xe1')]=_0x44d14e['id'];if(_0x2ecbc8[_0xad8b('0x44')]['filter']){_0x1f6bcb['where']=_[_0xad8b('0x5a')](_0x1f6bcb['where'],{'$or':_[_0xad8b('0x3d')](_0x1f6bcb[_0xad8b('0x4a')],function(_0x49a9a3){var _0x44a247={};_0x44a247[_0x49a9a3]={'$like':'%'+_0x2ecbc8['query']['filter']+'%'};return _0x44a247;})});}_0x1f6bcb=_[_0xad8b('0x5a')]({},_0x1f6bcb,_0x2ecbc8[_0xad8b('0xcf')]);return db[_0xad8b('0xe0')][_0xad8b('0x23')]({'where':_0x1f6bcb[_0xad8b('0x43')]})['then'](function(_0x5d0e33){_0x572fa4[_0xad8b('0x23')]=_0x5d0e33;if(_0x2ecbc8[_0xad8b('0x44')][_0xad8b('0x45')]){_0x1f6bcb[_0xad8b('0x46')]=[{'all':!![]}];}return db[_0xad8b('0xe0')]['findAll'](_0x1f6bcb);})['then'](function(_0x2b88e7){_0x572fa4[_0xad8b('0x4c')]=_0x2b88e7;return _0x572fa4;});}})[_0xad8b('0x27')](respondWithFilteredResult(_0x5cfd44,_0x1f6bcb))['catch'](handleError(_0x5cfd44,null));};exports[_0xad8b('0xe2')]=function(_0x45c0f8,_0x1331b1){var _0x2ab60d={'raw':!![],'where':{}};var _0x944bff={};var _0x20ceab={'count':0x0,'rows':[]};return db[_0xad8b('0x3b')][_0xad8b('0x99')]({'where':{'id':_0x45c0f8[_0xad8b('0x53')]['id']}})[_0xad8b('0x27')](handleEntityNotFound(_0x1331b1,null))['then'](function(_0x2a4587){if(_0x2a4587){_0x944bff['model']=_['keys'](db[_0xad8b('0xe3')][_0xad8b('0x3c')]);_0x944bff[_0xad8b('0x44')]=_[_0xad8b('0x57')](_0x45c0f8[_0xad8b('0x44')]);_0x944bff[_0xad8b('0xcc')]=_['intersection'](_0x944bff[_0xad8b('0x54')],_0x944bff['query']);_0x2ab60d['attributes']=_[_0xad8b('0x58')](_0x944bff[_0xad8b('0x54')],qs[_0xad8b('0x59')](_0x45c0f8[_0xad8b('0x44')][_0xad8b('0x59')]));_0x2ab60d[_0xad8b('0x4a')]=_0x2ab60d[_0xad8b('0x4a')]['length']?_0x2ab60d['attributes']:_0x944bff[_0xad8b('0x54')];if(!_0x45c0f8[_0xad8b('0x44')][_0xad8b('0xd1')]('nolimit')){_0x2ab60d[_0xad8b('0x22')]=qs[_0xad8b('0x22')](_0x45c0f8[_0xad8b('0x44')][_0xad8b('0x22')]);_0x2ab60d['offset']=qs[_0xad8b('0x20')](_0x45c0f8[_0xad8b('0x44')][_0xad8b('0x20')]);}_0x2ab60d[_0xad8b('0xcd')]=qs[_0xad8b('0xce')](_0x45c0f8['query'][_0xad8b('0xce')]);_0x2ab60d['where']=qs[_0xad8b('0xcc')](_[_0xad8b('0xd9')](_0x45c0f8[_0xad8b('0x44')],_0x944bff[_0xad8b('0xcc')]));_0x2ab60d[_0xad8b('0x43')][_0xad8b('0xe1')]=_0x2a4587['id'];if(_0x45c0f8[_0xad8b('0x44')][_0xad8b('0x30')]){_0x2ab60d[_0xad8b('0x43')]=_[_0xad8b('0x5a')](_0x2ab60d['where'],{'$or':_[_0xad8b('0x3d')](_0x2ab60d[_0xad8b('0x4a')],function(_0x1ccced){var _0x399d18={};_0x399d18[_0x1ccced]={'$like':'%'+_0x45c0f8[_0xad8b('0x44')][_0xad8b('0x30')]+'%'};return _0x399d18;})});}_0x2ab60d=_[_0xad8b('0x5a')]({},_0x2ab60d,_0x45c0f8[_0xad8b('0xcf')]);return db[_0xad8b('0xe3')][_0xad8b('0x23')]({'where':_0x2ab60d['where']})['then'](function(_0x2aaf6a){_0x20ceab['count']=_0x2aaf6a;if(_0x45c0f8[_0xad8b('0x44')]['includeAll']){_0x2ab60d[_0xad8b('0x46')]=[{'all':!![]}];}return db['ScreenRecording'][_0xad8b('0x8c')](_0x2ab60d);})[_0xad8b('0x27')](function(_0x362fbf){_0x20ceab[_0xad8b('0x4c')]=_0x362fbf;return _0x20ceab;});}})[_0xad8b('0x27')](respondWithFilteredResult(_0x1331b1,_0x2ab60d))[_0xad8b('0x1d')](handleError(_0x1331b1,null));};exports['getChatInteractions']=function(_0x34a29b,_0x35b668){var _0xe1d836={};var _0x36f4d={};var _0x5fc09c;var _0x5efa5f;return db[_0xad8b('0x3b')][_0xad8b('0x99')]({'where':{'id':_0x34a29b[_0xad8b('0x53')]['id']}})[_0xad8b('0x27')](handleEntityNotFound(_0x35b668,null))[_0xad8b('0x27')](function(_0x534b84){if(_0x534b84){_0x5fc09c=_0x534b84;_0x36f4d[_0xad8b('0x54')]=_[_0xad8b('0x57')](db['ChatInteraction']['rawAttributes']);_0x36f4d[_0xad8b('0x44')]=_['keys'](_0x34a29b['query']);_0x36f4d[_0xad8b('0xcc')]=_[_0xad8b('0x58')](_0x36f4d['model'],_0x36f4d[_0xad8b('0x44')]);_0xe1d836[_0xad8b('0x4a')]=_[_0xad8b('0x58')](_0x36f4d[_0xad8b('0x54')],qs[_0xad8b('0x59')](_0x34a29b['query'][_0xad8b('0x59')]));_0xe1d836[_0xad8b('0x4a')]=_0xe1d836[_0xad8b('0x4a')][_0xad8b('0x4d')]?_0xe1d836[_0xad8b('0x4a')]:_0x36f4d[_0xad8b('0x54')];_0xe1d836['order']=qs[_0xad8b('0xce')](_0x34a29b[_0xad8b('0x44')][_0xad8b('0xce')]);_0xe1d836[_0xad8b('0x43')]=qs[_0xad8b('0xcc')](_[_0xad8b('0xd9')](_0x34a29b[_0xad8b('0x44')],_0x36f4d[_0xad8b('0xcc')]));if(_0x34a29b['query']['filter']){_0xe1d836['where']=_[_0xad8b('0x5a')](_0xe1d836[_0xad8b('0x43')],{'$or':_[_0xad8b('0x3d')](_0xe1d836[_0xad8b('0x4a')],function(_0x1f08e0){var _0x3e0163={};_0x3e0163[_0x1f08e0]={'$like':'%'+_0x34a29b[_0xad8b('0x44')]['filter']+'%'};return _0x3e0163;})});}_0xe1d836=_['merge']({},_0xe1d836,_0x34a29b[_0xad8b('0xcf')]);return _0x5fc09c[_0xad8b('0xe4')](_0xe1d836);}})[_0xad8b('0x27')](function(_0x276dbb){if(_0x276dbb){_0x5efa5f=_0x276dbb[_0xad8b('0x4d')];if(!_0x34a29b[_0xad8b('0x44')][_0xad8b('0xd1')]('nolimit')){_0xe1d836[_0xad8b('0x22')]=qs['limit'](_0x34a29b[_0xad8b('0x44')][_0xad8b('0x22')]);_0xe1d836[_0xad8b('0x20')]=qs[_0xad8b('0x20')](_0x34a29b[_0xad8b('0x44')][_0xad8b('0x20')]);}return _0x5fc09c[_0xad8b('0xe4')](_0xe1d836);}})[_0xad8b('0x27')](function(_0x4cf758){if(_0x4cf758){return _0x4cf758?{'count':_0x5efa5f,'rows':_0x4cf758}:null;}})['then'](respondWithResult(_0x35b668,null))[_0xad8b('0x1d')](handleError(_0x35b668,null));};exports[_0xad8b('0xe5')]=function(_0x347248,_0x1cb2af){var _0xa62ec4={};var _0x4a58a2={};var _0x1b820a;var _0xe53180;return db['User']['findOne']({'where':{'id':_0x347248[_0xad8b('0x53')]['id']}})[_0xad8b('0x27')](handleEntityNotFound(_0x1cb2af,null))['then'](function(_0x29103b){if(_0x29103b){_0x1b820a=_0x29103b;_0x4a58a2['model']=_[_0xad8b('0x57')](db['OpenchannelInteraction'][_0xad8b('0x3c')]);_0x4a58a2[_0xad8b('0x44')]=_[_0xad8b('0x57')](_0x347248['query']);_0x4a58a2[_0xad8b('0xcc')]=_['intersection'](_0x4a58a2[_0xad8b('0x54')],_0x4a58a2[_0xad8b('0x44')]);_0xa62ec4[_0xad8b('0x4a')]=_['intersection'](_0x4a58a2['model'],qs['fields'](_0x347248[_0xad8b('0x44')]['fields']));_0xa62ec4[_0xad8b('0x4a')]=_0xa62ec4[_0xad8b('0x4a')][_0xad8b('0x4d')]?_0xa62ec4[_0xad8b('0x4a')]:_0x4a58a2['model'];_0xa62ec4[_0xad8b('0xcd')]=qs[_0xad8b('0xce')](_0x347248[_0xad8b('0x44')]['sort']);_0xa62ec4['where']=qs['filters'](_[_0xad8b('0xd9')](_0x347248[_0xad8b('0x44')],_0x4a58a2[_0xad8b('0xcc')]));if(_0x347248[_0xad8b('0x44')]['filter']){_0xa62ec4[_0xad8b('0x43')]=_[_0xad8b('0x5a')](_0xa62ec4['where'],{'$or':_[_0xad8b('0x3d')](_0xa62ec4[_0xad8b('0x4a')],function(_0x3e6da5){var _0xd35e69={};_0xd35e69[_0x3e6da5]={'$like':'%'+_0x347248[_0xad8b('0x44')]['filter']+'%'};return _0xd35e69;})});}_0xa62ec4=_[_0xad8b('0x5a')]({},_0xa62ec4,_0x347248[_0xad8b('0xcf')]);return _0x1b820a[_0xad8b('0xe5')](_0xa62ec4);}})['then'](function(_0x4b956e){if(_0x4b956e){_0xe53180=_0x4b956e[_0xad8b('0x4d')];if(!_0x347248[_0xad8b('0x44')][_0xad8b('0xd1')](_0xad8b('0xdb'))){_0xa62ec4['limit']=qs['limit'](_0x347248['query']['limit']);_0xa62ec4[_0xad8b('0x20')]=qs[_0xad8b('0x20')](_0x347248[_0xad8b('0x44')][_0xad8b('0x20')]);}return _0x1b820a[_0xad8b('0xe5')](_0xa62ec4);}})[_0xad8b('0x27')](function(_0x54d840){if(_0x54d840){return _0x54d840?{'count':_0xe53180,'rows':_0x54d840}:null;}})['then'](respondWithResult(_0x1cb2af,null))['catch'](handleError(_0x1cb2af,null));};exports[_0xad8b('0xe6')]=function(_0x136c51,_0x4ac254){var _0xd9838={'raw':!![],'where':{}};var _0x8853d0={};var _0x1814ac={'count':0x0,'rows':[]};return db[_0xad8b('0x3b')]['findOne']({'where':{'id':_0x136c51[_0xad8b('0x53')]['id']}})[_0xad8b('0x27')](handleEntityNotFound(_0x4ac254,null))[_0xad8b('0x27')](function(_0x5da62f){if(_0x5da62f){_0x8853d0[_0xad8b('0x54')]=_[_0xad8b('0x57')](db[_0xad8b('0xe7')]['rawAttributes']);_0x8853d0[_0xad8b('0x44')]=_[_0xad8b('0x57')](_0x136c51[_0xad8b('0x44')]);_0x8853d0[_0xad8b('0xcc')]=_[_0xad8b('0x58')](_0x8853d0[_0xad8b('0x54')],_0x8853d0[_0xad8b('0x44')]);_0xd9838[_0xad8b('0x4a')]=_[_0xad8b('0x58')](_0x8853d0[_0xad8b('0x54')],qs[_0xad8b('0x59')](_0x136c51[_0xad8b('0x44')][_0xad8b('0x59')]));_0xd9838[_0xad8b('0x4a')]=_0xd9838['attributes']['length']?_0xd9838[_0xad8b('0x4a')]:_0x8853d0[_0xad8b('0x54')];if(!_0x136c51[_0xad8b('0x44')][_0xad8b('0xd1')]('nolimit')){_0xd9838[_0xad8b('0x22')]=qs[_0xad8b('0x22')](_0x136c51[_0xad8b('0x44')][_0xad8b('0x22')]);_0xd9838[_0xad8b('0x20')]=qs[_0xad8b('0x20')](_0x136c51[_0xad8b('0x44')][_0xad8b('0x20')]);}_0xd9838[_0xad8b('0xcd')]=qs[_0xad8b('0xce')](_0x136c51[_0xad8b('0x44')]['sort']);_0xd9838[_0xad8b('0x43')]=qs[_0xad8b('0xcc')](_[_0xad8b('0xd9')](_0x136c51[_0xad8b('0x44')],_0x8853d0[_0xad8b('0xcc')]));_0xd9838['where'][_0xad8b('0xe1')]=_0x5da62f['id'];if(_0x136c51[_0xad8b('0x44')][_0xad8b('0x30')]){_0xd9838['where']=_[_0xad8b('0x5a')](_0xd9838[_0xad8b('0x43')],{'$or':_[_0xad8b('0x3d')](_0xd9838[_0xad8b('0x4a')],function(_0x3828f4){var _0x13a572={};_0x13a572[_0x3828f4]={'$like':'%'+_0x136c51[_0xad8b('0x44')][_0xad8b('0x30')]+'%'};return _0x13a572;})});}_0xd9838=_['merge']({},_0xd9838,_0x136c51[_0xad8b('0xcf')]);return db['MailInteraction'][_0xad8b('0x23')]({'where':_0xd9838[_0xad8b('0x43')]})[_0xad8b('0x27')](function(_0x502353){_0x1814ac[_0xad8b('0x23')]=_0x502353;if(_0x136c51[_0xad8b('0x44')][_0xad8b('0x45')]){_0xd9838[_0xad8b('0x46')]=[{'all':!![]}];}return db['MailInteraction'][_0xad8b('0x8c')](_0xd9838);})[_0xad8b('0x27')](function(_0x31c399){_0x1814ac[_0xad8b('0x4c')]=_0x31c399;return _0x1814ac;});}})[_0xad8b('0x27')](respondWithFilteredResult(_0x4ac254,_0xd9838))[_0xad8b('0x1d')](handleError(_0x4ac254,null));};exports[_0xad8b('0xe8')]=function(_0x32ded9,_0x152ade){var _0x4d1e17={};var _0x13274c={};var _0x1bb0f2;var _0x185a25;return db[_0xad8b('0x3b')][_0xad8b('0x99')]({'where':{'id':_0x32ded9['params']['id']}})[_0xad8b('0x27')](handleEntityNotFound(_0x152ade,null))[_0xad8b('0x27')](function(_0x4119dc){if(_0x4119dc){_0x1bb0f2=_0x4119dc;_0x13274c[_0xad8b('0x54')]=_[_0xad8b('0x57')](db[_0xad8b('0xe9')]['rawAttributes']);_0x13274c[_0xad8b('0x44')]=_[_0xad8b('0x57')](_0x32ded9[_0xad8b('0x44')]);_0x13274c[_0xad8b('0xcc')]=_['intersection'](_0x13274c[_0xad8b('0x54')],_0x13274c[_0xad8b('0x44')]);_0x4d1e17[_0xad8b('0x4a')]=_[_0xad8b('0x58')](_0x13274c['model'],qs['fields'](_0x32ded9[_0xad8b('0x44')]['fields']));_0x4d1e17['attributes']=_0x4d1e17[_0xad8b('0x4a')][_0xad8b('0x4d')]?_0x4d1e17['attributes']:_0x13274c[_0xad8b('0x54')];_0x4d1e17[_0xad8b('0xcd')]=qs[_0xad8b('0xce')](_0x32ded9[_0xad8b('0x44')][_0xad8b('0xce')]);_0x4d1e17['where']=qs['filters'](_[_0xad8b('0xd9')](_0x32ded9[_0xad8b('0x44')],_0x13274c['filters']));if(_0x32ded9[_0xad8b('0x44')]['filter']){_0x4d1e17[_0xad8b('0x43')]=_['merge'](_0x4d1e17[_0xad8b('0x43')],{'$or':_[_0xad8b('0x3d')](_0x4d1e17[_0xad8b('0x4a')],function(_0x28b471){var _0x75b8ca={};_0x75b8ca[_0x28b471]={'$like':'%'+_0x32ded9['query'][_0xad8b('0x30')]+'%'};return _0x75b8ca;})});}_0x4d1e17=_[_0xad8b('0x5a')]({},_0x4d1e17,_0x32ded9[_0xad8b('0xcf')]);return _0x1bb0f2[_0xad8b('0xe8')](_0x4d1e17);}})[_0xad8b('0x27')](function(_0x4bcb35){if(_0x4bcb35){_0x185a25=_0x4bcb35[_0xad8b('0x4d')];if(!_0x32ded9[_0xad8b('0x44')]['hasOwnProperty'](_0xad8b('0xdb'))){_0x4d1e17[_0xad8b('0x22')]=qs['limit'](_0x32ded9[_0xad8b('0x44')][_0xad8b('0x22')]);_0x4d1e17['offset']=qs['offset'](_0x32ded9[_0xad8b('0x44')][_0xad8b('0x20')]);}return _0x1bb0f2[_0xad8b('0xe8')](_0x4d1e17);}})[_0xad8b('0x27')](function(_0x4f2915){if(_0x4f2915){return _0x4f2915?{'count':_0x185a25,'rows':_0x4f2915}:null;}})[_0xad8b('0x27')](respondWithResult(_0x152ade,null))[_0xad8b('0x1d')](handleError(_0x152ade,null));};exports[_0xad8b('0xea')]=function(_0x2e6a57,_0x565434){var _0x48cffb={};var _0x159e80={};var _0x389b54;var _0x6f2d2b;return db[_0xad8b('0x3b')][_0xad8b('0x99')]({'where':{'id':_0x2e6a57['params']['id']}})[_0xad8b('0x27')](handleEntityNotFound(_0x565434,null))[_0xad8b('0x27')](function(_0x4fbce0){if(_0x4fbce0){_0x389b54=_0x4fbce0;_0x159e80[_0xad8b('0x54')]=_['keys'](db[_0xad8b('0xeb')][_0xad8b('0x3c')]);_0x159e80[_0xad8b('0x44')]=_[_0xad8b('0x57')](_0x2e6a57['query']);_0x159e80['filters']=_['intersection'](_0x159e80[_0xad8b('0x54')],_0x159e80[_0xad8b('0x44')]);_0x48cffb['attributes']=_[_0xad8b('0x58')](_0x159e80['model'],qs[_0xad8b('0x59')](_0x2e6a57['query'][_0xad8b('0x59')]));_0x48cffb['attributes']=_0x48cffb['attributes'][_0xad8b('0x4d')]?_0x48cffb['attributes']:_0x159e80[_0xad8b('0x54')];_0x48cffb[_0xad8b('0xcd')]=qs['sort'](_0x2e6a57[_0xad8b('0x44')][_0xad8b('0xce')]);_0x48cffb[_0xad8b('0x43')]=qs[_0xad8b('0xcc')](_['pick'](_0x2e6a57[_0xad8b('0x44')],_0x159e80['filters']));if(_0x2e6a57[_0xad8b('0x44')][_0xad8b('0x30')]){_0x48cffb['where']=_['merge'](_0x48cffb[_0xad8b('0x43')],{'$or':_[_0xad8b('0x3d')](_0x48cffb['attributes'],function(_0x367d8c){var _0xcc85bd={};_0xcc85bd[_0x367d8c]={'$like':'%'+_0x2e6a57[_0xad8b('0x44')][_0xad8b('0x30')]+'%'};return _0xcc85bd;})});}_0x48cffb=_[_0xad8b('0x5a')]({},_0x48cffb,_0x2e6a57[_0xad8b('0xcf')]);return _0x389b54['getFaxInteractions'](_0x48cffb);}})['then'](function(_0x31753c){if(_0x31753c){_0x6f2d2b=_0x31753c['length'];if(!_0x2e6a57[_0xad8b('0x44')][_0xad8b('0xd1')](_0xad8b('0xdb'))){_0x48cffb[_0xad8b('0x22')]=qs[_0xad8b('0x22')](_0x2e6a57['query'][_0xad8b('0x22')]);_0x48cffb[_0xad8b('0x20')]=qs[_0xad8b('0x20')](_0x2e6a57[_0xad8b('0x44')]['offset']);}return _0x389b54[_0xad8b('0xea')](_0x48cffb);}})[_0xad8b('0x27')](function(_0x48b1d8){if(_0x48b1d8){return _0x48b1d8?{'count':_0x6f2d2b,'rows':_0x48b1d8}:null;}})[_0xad8b('0x27')](respondWithResult(_0x565434,null))['catch'](handleError(_0x565434,null));};exports['getWhatsappInteractions']=function(_0x324293,_0x58ea1b){var _0x3d8f6b={};var _0x55a0c8={};var _0xb47bfd;var _0x1ca6c9;return db[_0xad8b('0x3b')][_0xad8b('0x99')]({'where':{'id':_0x324293[_0xad8b('0x53')]['id']}})[_0xad8b('0x27')](handleEntityNotFound(_0x58ea1b,null))[_0xad8b('0x27')](function(_0x2b6835){if(_0x2b6835){_0xb47bfd=_0x2b6835;_0x55a0c8[_0xad8b('0x54')]=_[_0xad8b('0x57')](db[_0xad8b('0xec')]['rawAttributes']);_0x55a0c8[_0xad8b('0x44')]=_[_0xad8b('0x57')](_0x324293[_0xad8b('0x44')]);_0x55a0c8[_0xad8b('0xcc')]=_[_0xad8b('0x58')](_0x55a0c8[_0xad8b('0x54')],_0x55a0c8[_0xad8b('0x44')]);_0x3d8f6b[_0xad8b('0x4a')]=_[_0xad8b('0x58')](_0x55a0c8[_0xad8b('0x54')],qs[_0xad8b('0x59')](_0x324293[_0xad8b('0x44')][_0xad8b('0x59')]));_0x3d8f6b[_0xad8b('0x4a')]=_0x3d8f6b[_0xad8b('0x4a')][_0xad8b('0x4d')]?_0x3d8f6b['attributes']:_0x55a0c8[_0xad8b('0x54')];_0x3d8f6b['order']=qs[_0xad8b('0xce')](_0x324293[_0xad8b('0x44')][_0xad8b('0xce')]);_0x3d8f6b[_0xad8b('0x43')]=qs['filters'](_['pick'](_0x324293[_0xad8b('0x44')],_0x55a0c8[_0xad8b('0xcc')]));if(_0x324293[_0xad8b('0x44')][_0xad8b('0x30')]){_0x3d8f6b['where']=_['merge'](_0x3d8f6b[_0xad8b('0x43')],{'$or':_['map'](_0x3d8f6b['attributes'],function(_0x3d4029){var _0x14839a={};_0x14839a[_0x3d4029]={'$like':'%'+_0x324293[_0xad8b('0x44')][_0xad8b('0x30')]+'%'};return _0x14839a;})});}_0x3d8f6b=_[_0xad8b('0x5a')]({},_0x3d8f6b,_0x324293[_0xad8b('0xcf')]);return _0xb47bfd[_0xad8b('0xed')](_0x3d8f6b);}})[_0xad8b('0x27')](function(_0x4de76f){if(_0x4de76f){_0x1ca6c9=_0x4de76f['length'];if(!_0x324293[_0xad8b('0x44')][_0xad8b('0xd1')](_0xad8b('0xdb'))){_0x3d8f6b['limit']=qs['limit'](_0x324293['query']['limit']);_0x3d8f6b[_0xad8b('0x20')]=qs['offset'](_0x324293[_0xad8b('0x44')]['offset']);}return _0xb47bfd[_0xad8b('0xed')](_0x3d8f6b);}})[_0xad8b('0x27')](function(_0x30e9cf){if(_0x30e9cf){return _0x30e9cf?{'count':_0x1ca6c9,'rows':_0x30e9cf}:null;}})[_0xad8b('0x27')](respondWithResult(_0x58ea1b,null))[_0xad8b('0x1d')](handleError(_0x58ea1b,null));};exports[_0xad8b('0xee')]=function(_0x511f35,_0x4ad5d6,_0x1340a0){var _0x535dff;var _0x2e37a4;var _0x35eaae;var _0x24e089=!_['isNil'](_0x511f35['params']['id'])?_0x511f35[_0xad8b('0x53')]['id']:!_[_0xad8b('0x69')](_0x511f35['user']['id'])?_0x511f35[_0xad8b('0x2c')]['id']:null;return db[_0xad8b('0x3b')][_0xad8b('0x34')]({'where':{'id':_0x24e089,'role':{'$or':[_0xad8b('0x2b'),_0xad8b('0x2c'),'agent']}},'attributes':['id',_0xad8b('0x35'),'phone',_0xad8b('0xef'),_0xad8b('0x2a'),'internal','loginInPause']})[_0xad8b('0x27')](function(_0x3fd82f){if(_0x3fd82f){if(_0x3fd82f[_0xad8b('0x2a')]===_0xad8b('0x2e')){_0x535dff=_0x3fd82f;if(_0x511f35['body'][_0xad8b('0xf0')]){_0x35eaae=util[_0xad8b('0xf1')](_0xad8b('0xf2'),_0x535dff[_0x511f35[_0xad8b('0x5f')][_0xad8b('0xf0')]]);}else if(_0x511f35[_0xad8b('0x5f')][_0xad8b('0xf3')]){_0x35eaae=util[_0xad8b('0xf1')](_0xad8b('0xad'),_0x511f35[_0xad8b('0x5f')]['intrf']);}else{_0x35eaae=util[_0xad8b('0xf1')](_0xad8b('0xad'),_0x535dff[_0xad8b('0x35')]);}socket['to'](util[_0xad8b('0xf1')](_0xad8b('0xf4'),_0x535dff['name']))[_0xad8b('0xaa')](_0xad8b('0xf5'),{'user':{'id':_0x535dff['id'],'name':_0x535dff[_0xad8b('0x35')]},'ip':_0x511f35[_0xad8b('0xf6')][_0xad8b('0xf7')]||_0x511f35[_0xad8b('0xf8')][_0xad8b('0xf9')]||_0x511f35[_0xad8b('0xfa')]['remoteAddress']||_0x511f35[_0xad8b('0xf8')]['socket'][_0xad8b('0xf9')]});return db['UserVoiceQueueRt'][_0xad8b('0x28')]({'where':{'membername':_0x535dff[_0xad8b('0x35')]},'individualHooks':!![]});}}else{throw new db['Sequelize'][(_0xad8b('0x91'))]('User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method');}})[_0xad8b('0x27')](function(){if(_0x535dff){return _0x535dff[_0xad8b('0xfb')]({'raw':!![]});}})[_0xad8b('0x27')](function(_0x135172){if(_0x535dff){var _0x4b124c=[];if(_0x135172){_0x2e37a4=_0x135172;if(_0x2e37a4[_0xad8b('0x4d')]){for(var _0x4b775e=0x0;_0x4b775e<_0x2e37a4['length'];_0x4b775e++){_0x4b124c['push']({'membername':_0x535dff['name'],'UserId':_0x535dff['id'],'queue_name':_0x2e37a4[_0x4b775e]['name'],'VoiceQueueId':_0x2e37a4[_0x4b775e]['id'],'interface':_0x35eaae,'paused':_0x535dff[_0xad8b('0xa0')]||![],'penalty':_0x2e37a4[_0x4b775e][_0xad8b('0xfc')]||0x0});}return BPromise[_0xad8b('0x8b')](_0x4b124c,function(_0x5a0690){return db[_0xad8b('0xaf')][_0xad8b('0xb0')](_0x5a0690);});}}}})['then'](function(){if(_0x535dff){return db['MemberReport'][_0xad8b('0x8c')]({'where':{'membername':_0x535dff['name'],'exitAt':null}});}})[_0xad8b('0x27')](function(_0x4d7b05){if(_0x535dff){var _0x23d93a=[];_0x4d7b05[_0xad8b('0xfd')](function(_0x47104e){_0x23d93a[_0xad8b('0x4b')](_0x47104e[_0xad8b('0x5e')]({'exitAt':moment()[_0xad8b('0xf1')](_0xad8b('0xfe'))}));});return BPromise[_0xad8b('0x8a')](_0x23d93a);}})[_0xad8b('0x27')](function(){if(_0x535dff){var _0x396ec2=[];var _0x317cc8=[];var _0x3136b8=utils[_0xad8b('0xff')]();var _0x4a512c={'membername':_0x535dff['name'],'interface':_0x35eaae,'enterAt':moment()[_0xad8b('0xf1')](_0xad8b('0xfe')),'role':_0x535dff[_0xad8b('0x2a')],'internal':_0x535dff[_0xad8b('0x64')]};_0x3136b8['forEach'](function(_0x210ce3){_0x396ec2[_0xad8b('0x4b')](_[_0xad8b('0x5a')]({'channel':_0x210ce3,'type':_0xad8b('0x100'),'data1':_0x511f35[_0xad8b('0x5f')]['device'],'data2':_0x35eaae},_0x4a512c));if(_0x535dff['loginInPause']){_0x317cc8['push'](_[_0xad8b('0x5a')]({'channel':_0x210ce3,'type':_0xad8b('0x101'),'data1':_0xad8b('0x102')},_0x4a512c));}});return db[_0xad8b('0x103')][_0xad8b('0x87')](_0x396ec2[_0xad8b('0xcb')](_0x317cc8),{'individualHooks':!![]});}})[_0xad8b('0x27')](function(){if(_0x535dff){return _0x535dff[_0xad8b('0x5e')]({'online':!![],'lastLoginAt':moment()[_0xad8b('0xf1')](_0xad8b('0xfe')),'voicePause':_0x535dff[_0xad8b('0xa0')]||![],'mailPause':_0x535dff[_0xad8b('0xa0')]||![],'chatPause':_0x535dff[_0xad8b('0xa0')]||![],'faxPause':_0x535dff[_0xad8b('0xa0')]||![],'smsPause':_0x535dff[_0xad8b('0xa0')]||![],'openchannelPause':_0x535dff['loginInPause']||![],'whatsappPause':_0x535dff[_0xad8b('0xa0')]||![],'pauseType':_0x535dff[_0xad8b('0xa0')]?'LOGININPAUSE':null,'interface':_0x35eaae,'lastPauseAt':moment()[_0xad8b('0xf1')](_0xad8b('0xfe'))});}})['then'](function(_0x54ba82){if(_0x511f35[_0xad8b('0x104')]){return _0x1340a0();}else{return BPromise[_0xad8b('0x105')](_0x54ba82)[_0xad8b('0x27')](respondWithResult(_0x4ad5d6,null));}})['catch'](handleError(_0x4ad5d6,null));};exports[_0xad8b('0x106')]=function(_0x33a46a,_0x3fffe7){var _0x222d66;return db[_0xad8b('0x3b')][_0xad8b('0x34')]({'where':{'id':_0x33a46a['params']['id'],'role':_0xad8b('0x2e')},'attributes':['id',_0xad8b('0x35'),_0xad8b('0x2a')]})[_0xad8b('0x27')](handleEntityNotFound(_0x3fffe7,null))[_0xad8b('0x27')](function(_0x1d43ec){if(_0x1d43ec){_0x222d66=_0x1d43ec;return db['UserVoiceQueueRt']['destroy']({'where':{'membername':_0x222d66[_0xad8b('0x35')]},'individualHooks':!![]});}})[_0xad8b('0x27')](function(){return db['MemberReport'][_0xad8b('0x8c')]({'where':{'membername':_0x222d66[_0xad8b('0x35')],'exitAt':null}});})['then'](function(_0x2ce2d5){var _0x527b4b=[];_0x2ce2d5[_0xad8b('0xfd')](function(_0x44c0b0){_0x527b4b['push'](_0x44c0b0[_0xad8b('0x5e')]({'exitAt':moment()[_0xad8b('0xf1')](_0xad8b('0xfe'))}));});return BPromise[_0xad8b('0x8a')](_0x527b4b);})[_0xad8b('0x27')](function(){return _0x222d66[_0xad8b('0x5e')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})['then'](respondWithResult(_0x3fffe7,null))[_0xad8b('0x1d')](handleError(_0x3fffe7,null));};exports[_0xad8b('0x107')]=function(_0x2bce30,_0x480eb6){var _0x4eefdd;return db[_0xad8b('0xaf')][_0xad8b('0x5e')]({'paused':0x1},{'where':{'UserId':_0x2bce30[_0xad8b('0x53')]['id']},'individualHooks':!![]})['then'](function(){return db[_0xad8b('0x3b')]['find']({'where':{'id':_0x2bce30[_0xad8b('0x53')]['id'],'role':_0xad8b('0x2e')},'attributes':['id',_0xad8b('0x35'),'role','internal',_0xad8b('0xf0')]});})[_0xad8b('0x27')](handleEntityNotFound(_0x480eb6,null))['then'](function(_0x3b8f66){if(_0x3b8f66){_0x4eefdd=_0x3b8f66;return respondWithRpcPromise('QueuePause',_0xad8b('0x107'),{'id':_0x4eefdd['id'],'name':_0x4eefdd[_0xad8b('0x35')],'pause':!![]});}})[_0xad8b('0x27')](function(){if(_0x4eefdd){return db[_0xad8b('0x103')][_0xad8b('0x8c')]({'where':{'membername':_0x4eefdd[_0xad8b('0x35')],'type':'PAUSE','exitAt':null}});}})[_0xad8b('0x27')](function(_0x471fd6){if(_0x471fd6['length']){var _0x177301=moment()[_0xad8b('0xf1')](_0xad8b('0xfe'));for(var _0x227ae4=0x0,_0x83414e=_0x471fd6[_0xad8b('0x4d')];_0x227ae4<_0x83414e;_0x227ae4++){_0x471fd6[_0x227ae4]['updateAttributes']({'exitAt':_0x177301});}}})[_0xad8b('0x27')](function(){var _0x4f6af8=[];var _0x38860a=utils[_0xad8b('0xff')]();_0x38860a['forEach'](function(_0x24a72d){_0x4f6af8['push']({'channel':_0x24a72d,'membername':_0x4eefdd[_0xad8b('0x35')],'interface':_[_0xad8b('0x69')](_0x4eefdd['interface'])?util['format'](_0xad8b('0xad'),_0x4eefdd[_0xad8b('0x35')]):_0x4eefdd[_0xad8b('0xf0')],'type':_0xad8b('0x101'),'enterAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x2bce30[_0xad8b('0x5f')][_0xad8b('0x3f')]||'DEFAULT\x20PAUSE','role':_0x4eefdd[_0xad8b('0x2a')],'internal':_0x4eefdd[_0xad8b('0x64')]});});return db[_0xad8b('0x103')][_0xad8b('0x87')](_0x4f6af8,{'individualHooks':!![]});})[_0xad8b('0x27')](function(){return _0x4eefdd[_0xad8b('0x5e')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x2bce30[_0xad8b('0x5f')][_0xad8b('0x3f')]||_0xad8b('0x108'),'lastPauseAt':moment()[_0xad8b('0xf1')]('YYYY-MM-DD\x20HH:mm:ss')});})[_0xad8b('0x27')](respondWithResult(_0x480eb6,null))[_0xad8b('0x1d')](handleError(_0x480eb6,null));};exports[_0xad8b('0x109')]=function(_0x4c80e9,_0x499018){var _0x24c4dd;return db[_0xad8b('0x3b')]['find']({'where':{'id':_0x4c80e9[_0xad8b('0x53')]['id']},'attributes':['id','name','role',_0xad8b('0xae'),_0xad8b('0x10a'),_0xad8b('0x10b'),_0xad8b('0x10c'),_0xad8b('0x10d'),_0xad8b('0x10e'),_0xad8b('0x10f'),'pauseType',_0xad8b('0x110')]})[_0xad8b('0x27')](handleEntityNotFound(_0x499018,null))[_0xad8b('0x27')](function(_0x132b19){if(_0x132b19){_0x24c4dd=_0x132b19;if(_0x4c80e9[_0xad8b('0x5f')]['channel']&&!utils[_0xad8b('0xa1')](_0x4c80e9[_0xad8b('0x5f')]['channel'])){throw new db['Sequelize'][(_0xad8b('0x91'))](_0xad8b('0xa2'));}switch(_0x4c80e9[_0xad8b('0x5f')][_0xad8b('0x9e')]){case _0xad8b('0xac'):return respondWithRpcPromise(_0xad8b('0x111'),'unpause',{'id':_0x24c4dd['id'],'name':_0x24c4dd[_0xad8b('0x35')],'pause':![]})['then'](function(){return db[_0xad8b('0xaf')][_0xad8b('0x5e')]({'paused':0x0},{'where':{'UserId':_0x24c4dd['id']},'individualHooks':!![]});})[_0xad8b('0x27')](function(){return db[_0xad8b('0x103')][_0xad8b('0x34')]({'where':{'channel':_0x4c80e9['body'][_0xad8b('0x9e')],'membername':_0x24c4dd[_0xad8b('0x35')],'type':_0xad8b('0x101'),'exitAt':null}});})[_0xad8b('0x27')](function(_0x1e7eef){if(_0x1e7eef){return _0x1e7eef['update']({'exitAt':moment()[_0xad8b('0xf1')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0xad8b('0x112')},{'individualHooks':!![]});}return null;})['then'](function(){return _0x24c4dd['update']({'voicePause':![]});});case'mail':case _0xad8b('0x4e'):case _0xad8b('0x5c'):case _0xad8b('0x50'):case'whatsapp':case'openchannel':return db[_0xad8b('0x103')][_0xad8b('0x34')]({'where':{'channel':_0x4c80e9[_0xad8b('0x5f')][_0xad8b('0x9e')],'membername':_0x24c4dd['name'],'type':_0xad8b('0x101'),'exitAt':null}})[_0xad8b('0x27')](function(_0x3f0404){if(_0x3f0404){return _0x3f0404[_0xad8b('0x5e')]({'exitAt':moment()[_0xad8b('0xf1')](_0xad8b('0xfe')),'data2':_0xad8b('0x112')},{'individualHooks':!![]});}return null;})[_0xad8b('0x27')](function(){var _0x5eb573={};_[_0xad8b('0x24')](_0x5eb573,util[_0xad8b('0xf1')](_0xad8b('0x113'),_0x4c80e9[_0xad8b('0x5f')][_0xad8b('0x9e')],_0xad8b('0x114')),![]);return _0x24c4dd[_0xad8b('0x5e')](_0x5eb573);});default:return respondWithRpcPromise(_0xad8b('0x111'),_0xad8b('0x109'),{'id':_0x24c4dd['id'],'name':_0x24c4dd[_0xad8b('0x35')],'pause':![]})[_0xad8b('0x27')](function(){return db[_0xad8b('0xaf')][_0xad8b('0x5e')]({'paused':0x0},{'where':{'UserId':_0x24c4dd['id']}});})['then'](function(){return db[_0xad8b('0x103')][_0xad8b('0x8c')]({'where':{'membername':_0x24c4dd[_0xad8b('0x35')],'type':'PAUSE','exitAt':null}});})[_0xad8b('0x27')](function(_0x3ca64b){var _0xc05685=[];_0x3ca64b['forEach'](function(_0x25b603){_0xc05685['push'](_0x25b603[_0xad8b('0x5e')]({'exitAt':moment()[_0xad8b('0xf1')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':'manual'}));});return BPromise[_0xad8b('0x8a')](_0xc05685);})[_0xad8b('0x27')](function(){return _0x24c4dd[_0xad8b('0x5e')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})[_0xad8b('0x27')](respondWithResult(_0x499018,null))[_0xad8b('0x1d')](handleError(_0x499018,null));};exports[_0xad8b('0x115')]=function(_0x42a6d6,_0x5aa624){var _0x244fe6={};var _0x4b23d1={};var _0x310ea5;var _0x268fec;return db[_0xad8b('0x3b')][_0xad8b('0x99')]({'where':{'id':_0x42a6d6[_0xad8b('0x53')]['id']}})['then'](handleEntityNotFound(_0x5aa624,null))[_0xad8b('0x27')](function(_0x3804a2){if(_0x3804a2){_0x310ea5=_0x3804a2;_0x4b23d1[_0xad8b('0x54')]=_[_0xad8b('0x57')](db[_0xad8b('0x116')][_0xad8b('0x3c')]);_0x4b23d1[_0xad8b('0x44')]=_[_0xad8b('0x57')](_0x42a6d6['query']);_0x4b23d1[_0xad8b('0xcc')]=_[_0xad8b('0x58')](_0x4b23d1[_0xad8b('0x54')],_0x4b23d1[_0xad8b('0x44')]);_0x244fe6[_0xad8b('0x4a')]=_[_0xad8b('0x58')](_0x4b23d1[_0xad8b('0x54')],qs[_0xad8b('0x59')](_0x42a6d6[_0xad8b('0x44')]['fields']));_0x244fe6['attributes']=_0x244fe6[_0xad8b('0x4a')][_0xad8b('0x4d')]?_0x244fe6[_0xad8b('0x4a')]:_0x4b23d1[_0xad8b('0x54')];_0x244fe6[_0xad8b('0xcd')]=qs['sort'](_0x42a6d6['query'][_0xad8b('0xce')]);_0x244fe6[_0xad8b('0x43')]=qs[_0xad8b('0xcc')](_['pick'](_0x42a6d6[_0xad8b('0x44')],_0x4b23d1[_0xad8b('0xcc')]));if(_0x42a6d6['query']['filter']){_0x244fe6[_0xad8b('0x43')]=_[_0xad8b('0x5a')](_0x244fe6[_0xad8b('0x43')],{'$or':_[_0xad8b('0x3d')](_0x244fe6[_0xad8b('0x4a')],function(_0x407495){var _0x4b6dbd={};_0x4b6dbd[_0x407495]={'$like':'%'+_0x42a6d6[_0xad8b('0x44')][_0xad8b('0x30')]+'%'};return _0x4b6dbd;})});}_0x244fe6=_[_0xad8b('0x5a')]({},_0x244fe6,_0x42a6d6[_0xad8b('0xcf')]);return _0x310ea5['getTeams'](_0x244fe6);}})['then'](function(_0x3267d6){if(_0x3267d6){_0x268fec=_0x3267d6[_0xad8b('0x4d')];if(!_0x42a6d6[_0xad8b('0x44')]['hasOwnProperty'](_0xad8b('0xdb'))){_0x244fe6[_0xad8b('0x22')]=qs['limit'](_0x42a6d6['query'][_0xad8b('0x22')]);_0x244fe6[_0xad8b('0x20')]=qs[_0xad8b('0x20')](_0x42a6d6[_0xad8b('0x44')][_0xad8b('0x20')]);}return _0x310ea5[_0xad8b('0x115')](_0x244fe6);}})[_0xad8b('0x27')](function(_0x523d10){if(_0x523d10){return _0x523d10?{'count':_0x268fec,'rows':_0x523d10}:null;}})[_0xad8b('0x27')](respondWithResult(_0x5aa624,null))[_0xad8b('0x1d')](handleError(_0x5aa624,null));};exports[_0xad8b('0x117')]=function(_0x42738a,_0x51dedd){return db[_0xad8b('0x3b')][_0xad8b('0x34')]({'where':{'id':_0x42738a[_0xad8b('0x53')]['id']}})[_0xad8b('0x27')](handleEntityNotFound(_0x51dedd,null))[_0xad8b('0x27')](function(_0x4a84a9){if(_0x4a84a9){var _0x35fd8d=_0x4a84a9['get']({'plain':!![]});return _0x4a84a9['addTeams'](_0x42738a[_0xad8b('0x5f')][_0xad8b('0x62')],_[_0xad8b('0x63')](_0x42738a[_0xad8b('0x5f')],['ids','id'])||{})[_0xad8b('0x27')](function(){for(var _0x5ab324=0x0;_0x5ab324<_0x42738a[_0xad8b('0x5f')][_0xad8b('0x62')][_0xad8b('0x4d')];_0x5ab324++){var _0x49c915=[];var _0x375d44={};db[_0xad8b('0x116')][_0xad8b('0x99')]({'where':{'id':_0x42738a[_0xad8b('0x5f')][_0xad8b('0x62')][_0x5ab324]}})[_0xad8b('0x27')](function(_0x16fcd1){_0x375d44=_0x16fcd1[_0xad8b('0x4f')];_0x49c915[_0xad8b('0x4b')](_0x16fcd1[_0xad8b('0xfb')]()[_0xad8b('0x27')](function(_0x180093){for(var _0x47e913=0x0;_0x47e913<_0x180093['length'];_0x47e913++){_0x180093[_0x47e913][_0xad8b('0x118')](_0xad8b('0x9e'),_0xad8b('0x119'));}return _0x180093;}));_0x49c915[_0xad8b('0x4b')](_0x16fcd1[_0xad8b('0x11a')]()[_0xad8b('0x27')](function(_0x38bde2){for(var _0x3a6f75=0x0;_0x3a6f75<_0x38bde2[_0xad8b('0x4d')];_0x3a6f75++){_0x38bde2[_0x3a6f75]['setDataValue'](_0xad8b('0x9e'),_0xad8b('0x11b'));}return _0x38bde2;}));_0x49c915[_0xad8b('0x4b')](_0x16fcd1['getMailQueues']()[_0xad8b('0x27')](function(_0x14ba54){for(var _0x486f13=0x0;_0x486f13<_0x14ba54[_0xad8b('0x4d')];_0x486f13++){_0x14ba54[_0x486f13][_0xad8b('0x118')](_0xad8b('0x9e'),_0xad8b('0x11c'));}return _0x14ba54;}));_0x49c915[_0xad8b('0x4b')](_0x16fcd1[_0xad8b('0x11d')]()['then'](function(_0x3a896c){for(var _0x586f4c=0x0;_0x586f4c<_0x3a896c[_0xad8b('0x4d')];_0x586f4c++){_0x3a896c[_0x586f4c][_0xad8b('0x118')]('channel',_0xad8b('0x11e'));}return _0x3a896c;}));_0x49c915[_0xad8b('0x4b')](_0x16fcd1['getWhatsappQueues']()[_0xad8b('0x27')](function(_0x363361){for(var _0x1b32a0=0x0;_0x1b32a0<_0x363361[_0xad8b('0x4d')];_0x1b32a0++){_0x363361[_0x1b32a0][_0xad8b('0x118')](_0xad8b('0x9e'),_0xad8b('0x11f'));}return _0x363361;}));_0x49c915['push'](_0x16fcd1['getFaxQueues']()[_0xad8b('0x27')](function(_0xf93ecf){for(var _0xfe50f1=0x0;_0xfe50f1<_0xf93ecf[_0xad8b('0x4d')];_0xfe50f1++){_0xf93ecf[_0xfe50f1]['setDataValue'](_0xad8b('0x9e'),_0xad8b('0x120'));}return _0xf93ecf;}));_0x49c915[_0xad8b('0x4b')](_0x16fcd1['getOpenchannelQueues']()['then'](function(_0x4e56f0){for(var _0x44dd7d=0x0;_0x44dd7d<_0x4e56f0['length'];_0x44dd7d++){_0x4e56f0[_0x44dd7d][_0xad8b('0x118')](_0xad8b('0x9e'),'Openchannel');}return _0x4e56f0;}));return BPromise['all'](_0x49c915);})['then'](function(_0x57733c){var _0x5316e6=_[_0xad8b('0x121')](_0x57733c);_0x49c915=[];return db[_0xad8b('0x6b')][_0xad8b('0x122')](function(_0x2d46ee){for(var _0x462606=0x0;_0x462606<_0x5316e6[_0xad8b('0x4d')];_0x462606++){_0x49c915[_0xad8b('0x4b')](_0x5316e6[_0x462606][_0xad8b('0x123')](_0x35fd8d['id']),{'transaction':_0x2d46ee});}return BPromise[_0xad8b('0x8a')](_0x49c915)[_0xad8b('0x27')](function(){if(_0x35fd8d[_0xad8b('0x9f')]){return BPromise[_0xad8b('0x8b')](_[_0xad8b('0x30')](_0x5316e6,function(_0x4e5a05){return _0x4e5a05[_0xad8b('0x124')](_0xad8b('0x9e'))===_0xad8b('0x119');}),function(_0x4fc97a){return db[_0xad8b('0xaf')][_0xad8b('0xb0')]({'membername':_0x35fd8d[_0xad8b('0x35')],'UserId':_0x35fd8d['id'],'queue_name':_0x4fc97a[_0xad8b('0x35')],'VoiceQueueId':_0x4fc97a['id'],'interface':_[_0xad8b('0x69')](_0x35fd8d[_0xad8b('0xf0')])?util['format'](_0xad8b('0xad'),_0x35fd8d[_0xad8b('0x35')]):_0x35fd8d[_0xad8b('0xf0')],'paused':_0x35fd8d['voicePause']||![],'penalty':_0x35fd8d['penalty']},{'transaction':_0x2d46ee});});}else{return;}})[_0xad8b('0x27')](function(){for(var _0x532187=0x0;_0x532187<_0x5316e6['length'];_0x532187++){var _0x12af7f=_0x5316e6[_0x532187][_0xad8b('0x124')](_0xad8b('0x9e'));var _0x1a46b0=_0x12af7f+'QueueId';socket[_0xad8b('0xaa')]('user'+_0x12af7f+_0xad8b('0xab'),{'UserId':_0x35fd8d['id'],['queueField']:_0x5316e6[_0x532187]['id']});}});});})[_0xad8b('0x27')](function(){db[_0xad8b('0x125')]['findOne']({'where':{'teamId':_0x375d44['id']}})[_0xad8b('0x27')](function(_0x427a2f){if(_0x427a2f){db[_0xad8b('0x126')][_0xad8b('0x7f')]({'UserId':_0x42738a[_0xad8b('0x53')]['id'],'VoicePrefixId':_0x427a2f['VoicePrefixId']});}});});}});}})['then'](respondWithStatusCode(_0x51dedd,null))['catch'](handleError(_0x51dedd,null));};exports['removeTeams']=function(_0x5422ab,_0x44503a){return db[_0xad8b('0x3b')][_0xad8b('0x99')]({'where':{'id':_0x5422ab[_0xad8b('0x53')]['id']}})[_0xad8b('0x27')](handleEntityNotFound(_0x44503a,null))[_0xad8b('0x27')](function(_0x5527c0){if(_0x5527c0){var _0x1c3b83=_0x5527c0[_0xad8b('0x29')]({'plain':!![]});var _0x203f7b=_0x5422ab[_0xad8b('0x44')]['ids'];return _0x5527c0['removeTeams'](_0x203f7b)[_0xad8b('0x27')](function(){for(var _0x2573e6=0x0;_0x2573e6<_0x203f7b[_0xad8b('0x4d')];_0x2573e6++){var _0x29f313=[];var _0x4446bd={};db[_0xad8b('0x116')][_0xad8b('0x99')]({'where':{'id':_0x203f7b[_0x2573e6]}})[_0xad8b('0x27')](function(_0x48c629){_0x4446bd=_0x48c629[_0xad8b('0x4f')];_0x29f313[_0xad8b('0x4b')](_0x48c629[_0xad8b('0xfb')]()[_0xad8b('0x27')](function(_0x5602c2){for(var _0x5e3578=0x0;_0x5e3578<_0x5602c2[_0xad8b('0x4d')];_0x5e3578++){_0x5602c2[_0x5e3578]['setDataValue'](_0xad8b('0x9e'),'Voice');}return _0x5602c2;}));_0x29f313['push'](_0x48c629['getChatQueues']()['then'](function(_0x4c8faa){for(var _0x2a9f5a=0x0;_0x2a9f5a<_0x4c8faa[_0xad8b('0x4d')];_0x2a9f5a++){_0x4c8faa[_0x2a9f5a]['setDataValue']('channel',_0xad8b('0x11b'));}return _0x4c8faa;}));_0x29f313[_0xad8b('0x4b')](_0x48c629['getMailQueues']()[_0xad8b('0x27')](function(_0x3351a1){for(var _0x4a39e9=0x0;_0x4a39e9<_0x3351a1[_0xad8b('0x4d')];_0x4a39e9++){_0x3351a1[_0x4a39e9][_0xad8b('0x118')](_0xad8b('0x9e'),_0xad8b('0x11c'));}return _0x3351a1;}));_0x29f313['push'](_0x48c629[_0xad8b('0x11d')]()[_0xad8b('0x27')](function(_0x54883c){for(var _0x512a19=0x0;_0x512a19<_0x54883c[_0xad8b('0x4d')];_0x512a19++){_0x54883c[_0x512a19][_0xad8b('0x118')](_0xad8b('0x9e'),_0xad8b('0x11e'));}return _0x54883c;}));_0x29f313[_0xad8b('0x4b')](_0x48c629[_0xad8b('0x127')]()['then'](function(_0x365a42){for(var _0x29fed5=0x0;_0x29fed5<_0x365a42[_0xad8b('0x4d')];_0x29fed5++){_0x365a42[_0x29fed5][_0xad8b('0x118')](_0xad8b('0x9e'),_0xad8b('0x11f'));}return _0x365a42;}));_0x29f313['push'](_0x48c629['getFaxQueues']()[_0xad8b('0x27')](function(_0x2e28aa){for(var _0x43f182=0x0;_0x43f182<_0x2e28aa[_0xad8b('0x4d')];_0x43f182++){_0x2e28aa[_0x43f182]['setDataValue'](_0xad8b('0x9e'),_0xad8b('0x120'));}return _0x2e28aa;}));_0x29f313[_0xad8b('0x4b')](_0x48c629[_0xad8b('0x128')]()[_0xad8b('0x27')](function(_0x566285){for(var _0x17c976=0x0;_0x17c976<_0x566285[_0xad8b('0x4d')];_0x17c976++){_0x566285[_0x17c976][_0xad8b('0x118')](_0xad8b('0x9e'),'Openchannel');}return _0x566285;}));return BPromise[_0xad8b('0x8a')](_0x29f313);})[_0xad8b('0x27')](function(_0x134f25){var _0x393e67=_[_0xad8b('0x121')](_0x134f25);_0x29f313=[];return db[_0xad8b('0x6b')]['transaction'](function(_0x4297d5){for(var _0x554a16=0x0;_0x554a16<_0x393e67[_0xad8b('0x4d')];_0x554a16++){_0x29f313[_0xad8b('0x4b')](_0x393e67[_0x554a16][_0xad8b('0x129')](_0x1c3b83['id']),{'transaction':_0x4297d5});}return BPromise['all'](_0x29f313)[_0xad8b('0x27')](function(){if(_0x1c3b83['online']){return BPromise[_0xad8b('0x8b')](_['filter'](_0x393e67,function(_0x23876c){return _0x23876c['getDataValue'](_0xad8b('0x9e'))===_0xad8b('0x119');}),function(_0x2fb446){return db[_0xad8b('0xaf')][_0xad8b('0x28')]({'where':{'VoiceQueueId':_0x2fb446['id'],'UserId':_0x1c3b83['id']},'transaction':_0x4297d5});});}else{return;}})[_0xad8b('0x27')](function(){db[_0xad8b('0x125')][_0xad8b('0x99')]({'where':{'teamId':_0x4446bd['id']}})[_0xad8b('0x27')](function(_0x49169b){if(_0x49169b){return db[_0xad8b('0x126')]['destroy']({'where':{'UserId':_0x1c3b83['id'],'VoicePrefixId':_0x49169b[_0xad8b('0x4f')][_0xad8b('0x12a')]}});}});})[_0xad8b('0x27')](function(){for(var _0x44f857=0x0;_0x44f857<_0x393e67[_0xad8b('0x4d')];_0x44f857++){var _0x2e7fea=_0x393e67[_0x44f857][_0xad8b('0x124')](_0xad8b('0x9e'));var _0x433d5d=_0x2e7fea+_0xad8b('0xa9');socket[_0xad8b('0xaa')]('user'+_0x2e7fea+_0xad8b('0x12b'),{'UserId':_0x1c3b83['id'],['queueField']:_0x393e67[_0x44f857]['id']});}});});});}});}})['then'](respondWithStatusCode(_0x44503a,null))['catch'](handleError(_0x44503a,null));};exports[_0xad8b('0x12c')]=function(_0x22a064,_0x1d505e){var _0x3239f8={};var _0x36a8a9={};var _0x3a216c;var _0x94937e;return db[_0xad8b('0x3b')][_0xad8b('0x99')]({'where':{'id':_0x22a064[_0xad8b('0x53')]['id']}})['then'](handleEntityNotFound(_0x1d505e,null))['then'](function(_0x398ff4){if(_0x398ff4){_0x3a216c=_0x398ff4;_0x36a8a9[_0xad8b('0x54')]=_['keys'](db['CmList'][_0xad8b('0x3c')]);_0x36a8a9['query']=_['keys'](_0x22a064['query']);_0x36a8a9[_0xad8b('0xcc')]=_[_0xad8b('0x58')](_0x36a8a9[_0xad8b('0x54')],_0x36a8a9[_0xad8b('0x44')]);_0x3239f8[_0xad8b('0x4a')]=_[_0xad8b('0x58')](_0x36a8a9['model'],qs[_0xad8b('0x59')](_0x22a064[_0xad8b('0x44')][_0xad8b('0x59')]));_0x3239f8[_0xad8b('0x4a')]=_0x3239f8[_0xad8b('0x4a')][_0xad8b('0x4d')]?_0x3239f8['attributes']:_0x36a8a9['model'];_0x3239f8[_0xad8b('0xcd')]=qs[_0xad8b('0xce')](_0x22a064[_0xad8b('0x44')]['sort']);_0x3239f8[_0xad8b('0x43')]=qs[_0xad8b('0xcc')](_[_0xad8b('0xd9')](_0x22a064[_0xad8b('0x44')],_0x36a8a9[_0xad8b('0xcc')]));if(_0x22a064[_0xad8b('0x44')][_0xad8b('0x30')]){_0x3239f8['where']=_[_0xad8b('0x5a')](_0x3239f8[_0xad8b('0x43')],{'$or':_['map'](_0x3239f8[_0xad8b('0x4a')],function(_0x5ec354){var _0x5d1d38={};_0x5d1d38[_0x5ec354]={'$like':'%'+_0x22a064[_0xad8b('0x44')][_0xad8b('0x30')]+'%'};return _0x5d1d38;})});}_0x3239f8=_[_0xad8b('0x5a')]({},_0x3239f8,_0x22a064[_0xad8b('0xcf')]);return _0x3a216c[_0xad8b('0x12c')](_0x3239f8);}})['then'](function(_0x2b4491){if(_0x2b4491){_0x94937e=_0x2b4491['length'];if(!_0x22a064[_0xad8b('0x44')]['hasOwnProperty']('nolimit')){_0x3239f8[_0xad8b('0x22')]=qs['limit'](_0x22a064[_0xad8b('0x44')][_0xad8b('0x22')]);_0x3239f8[_0xad8b('0x20')]=qs['offset'](_0x22a064[_0xad8b('0x44')][_0xad8b('0x20')]);}return _0x3a216c['getLists'](_0x3239f8);}})[_0xad8b('0x27')](function(_0x276e60){if(_0x276e60){return _0x276e60?{'count':_0x94937e,'rows':_0x276e60}:null;}})['then'](respondWithResult(_0x1d505e,null))[_0xad8b('0x1d')](handleError(_0x1d505e,null));};exports[_0xad8b('0x12d')]=function(_0x23aae5,_0x3db45a){var _0x607542={};var _0x4dd38a={};var _0x2227d0;return db[_0xad8b('0x3b')][_0xad8b('0x99')]({'where':{'id':_0x23aae5[_0xad8b('0x53')]['id']}})[_0xad8b('0x27')](handleEntityNotFound(_0x3db45a,null))[_0xad8b('0x27')](function(_0x316c5d){if(_0x316c5d){_0x2227d0=_0x316c5d;_0x4dd38a['model']=_[_0xad8b('0x57')](db[_0xad8b('0x3b')]['rawAttributes']);_0x4dd38a['query']=_['keys'](_0x23aae5[_0xad8b('0x44')]);_0x4dd38a[_0xad8b('0xcc')]=_[_0xad8b('0x58')](_0x4dd38a[_0xad8b('0x54')],_0x4dd38a['query']);_0x607542[_0xad8b('0x4a')]=_[_0xad8b('0x58')](_0x4dd38a[_0xad8b('0x54')],qs[_0xad8b('0x59')](_0x23aae5[_0xad8b('0x44')][_0xad8b('0x59')]));_0x607542[_0xad8b('0x4a')]=_0x607542[_0xad8b('0x4a')]['length']?_0x607542[_0xad8b('0x4a')]:_0x4dd38a[_0xad8b('0x54')];_0x607542['order']=qs[_0xad8b('0xce')](_0x23aae5[_0xad8b('0x44')][_0xad8b('0xce')]);_0x607542[_0xad8b('0x43')]=qs[_0xad8b('0xcc')](_[_0xad8b('0xd9')](_0x23aae5[_0xad8b('0x44')],_0x4dd38a['filters']));if(_0x23aae5['query'][_0xad8b('0x30')]){_0x607542[_0xad8b('0x43')]=_['merge'](_0x607542['where'],{'$or':_[_0xad8b('0x3d')](_0x607542['attributes'],function(_0x90a642){var _0x1f0d2f={};_0x1f0d2f[_0x90a642]={'$like':'%'+_0x23aae5[_0xad8b('0x44')][_0xad8b('0x30')]+'%'};return _0x1f0d2f;})});}_0x607542[_0xad8b('0x54')]=db[_0xad8b('0x3b')];_0x607542['as']='Agents';_0x607542=_[_0xad8b('0x5a')]({},_0x607542,_0x23aae5[_0xad8b('0xcf')]);return _0x2227d0[_0xad8b('0xfb')]({'include':[_0x607542]});}})['then'](function(_0x187da4){if(_0x187da4){var _0x233feb={},_0x1d8754=[];for(var _0x20d271=0x0;_0x20d271<_0x187da4[_0xad8b('0x4d')];_0x20d271+=0x1){for(var _0x2af08=0x0,_0x2eeb3a;_0x2af08<_0x187da4[_0x20d271][_0xad8b('0x2d')][_0xad8b('0x4d')];_0x2af08+=0x1){_0x2eeb3a=_0x187da4[_0x20d271]['Agents'][_0x2af08]['get']({'plain':!![]});_0x233feb[_0x2eeb3a['id']]=_0x2eeb3a;}}_0x233feb=_[_0xad8b('0x12e')](_0x233feb);for(var _0x233a61=qs[_0xad8b('0x20')](_0x23aae5[_0xad8b('0x44')][_0xad8b('0x20')]);_0x233a61<_0x233feb[_0xad8b('0x4d')]&&_0x1d8754['length']=_0x59adc1[_0xc6ea('0x4d')]){throw new Error(_0xc6ea('0x4e'));}})[_0xc6ea('0x10')](function(){if(_0x29b0f7){return db['UserVoiceQueueRt'][_0xc6ea('0x4f')]({'where':{'membername':_0x29b0f7['name']},'individualHooks':!![]});}})[_0xc6ea('0x10')](function(){if(_0x29b0f7){return _0x29b0f7[_0xc6ea('0x50')]({'raw':!![]});}})[_0xc6ea('0x10')](function(_0xc091fd){if(_0x29b0f7){if(_0xc091fd){var _0x8d8965=[];_0x1cb10f=_0xc091fd;if(_0x1cb10f[_0xc6ea('0x2d')]){for(var _0x4e567f=0x0;_0x4e567f<_0x1cb10f['length'];_0x4e567f++){_0x8d8965['push'](db['UserVoiceQueueRt'][_0xc6ea('0x51')]({'membername':_0x29b0f7[_0xc6ea('0x2b')],'UserId':_0x29b0f7['id'],'queue_name':_0x1cb10f[_0x4e567f][_0xc6ea('0x2b')],'VoiceQueueId':_0x1cb10f[_0x4e567f]['id'],'interface':_0x537d1f,'paused':_0x29b0f7['loginInPause']||![],'penalty':_0x1cb10f[_0x4e567f][_0xc6ea('0x52')]||0x0}));}return BPromise[_0xc6ea('0x49')](_0x8d8965);}}}})[_0xc6ea('0x10')](function(){if(_0x29b0f7){return db[_0xc6ea('0x38')][_0xc6ea('0x1d')]({'where':{'membername':_0x29b0f7[_0xc6ea('0x2b')],'exitAt':null}});}})[_0xc6ea('0x10')](function(_0x3bdb7a){if(_0x29b0f7){if(_0x3bdb7a&&_0x3bdb7a[_0xc6ea('0x2d')]){var _0x3ccee1=[];_0x3bdb7a['forEach'](function(_0xad2f95){_0x3ccee1[_0xc6ea('0x33')](_0xad2f95['update']({'exitAt':moment()[_0xc6ea('0x2e')](_0xc6ea('0x2f'))}));});return BPromise['all'](_0x3ccee1);}}})[_0xc6ea('0x10')](function(_0x151609){if(_0x29b0f7){var _0x29373d=[];var _0x558807=[];var _0x5a6a0b=utils['getChannels']();var _0x587b2d={'membername':_0x29b0f7[_0xc6ea('0x2b')],'interface':_0x537d1f,'enterAt':moment()[_0xc6ea('0x2e')](_0xc6ea('0x2f')),'role':_0x29b0f7[_0xc6ea('0x28')],'internal':_0x29b0f7[_0xc6ea('0x37')]};_0x5a6a0b[_0xc6ea('0x32')](function(_0xfb041f){_0x29373d[_0xc6ea('0x33')](_['merge']({'channel':_0xfb041f,'type':_0xc6ea('0x53'),'data1':'callysquare','data2':_0x537d1f},_0x587b2d));if(_0x29b0f7[_0xc6ea('0x4c')]){_0x558807['push'](_[_0xc6ea('0x54')]({'channel':_0xfb041f,'type':_0xc6ea('0x2c'),'data1':_0xc6ea('0x55')},_0x587b2d));}});return db[_0xc6ea('0x38')][_0xc6ea('0x39')](_0x29373d[_0xc6ea('0x56')](_0x558807),{'individualHooks':!![]});}})[_0xc6ea('0x10')](function(){if(_0x29b0f7){return _0x29b0f7[_0xc6ea('0x2a')]({'online':!![],'lastLoginAt':moment()[_0xc6ea('0x2e')](_0xc6ea('0x2f')),'voicePause':_0x29b0f7[_0xc6ea('0x4c')]||![],'mailPause':_0x29b0f7[_0xc6ea('0x4c')]||![],'chatPause':_0x29b0f7['loginInPause']||![],'faxPause':_0x29b0f7[_0xc6ea('0x4c')]||![],'smsPause':_0x29b0f7['loginInPause']||![],'openchannelPause':_0x29b0f7[_0xc6ea('0x4c')]||![],'pauseType':_0x29b0f7[_0xc6ea('0x4c')]?_0xc6ea('0x55'):null,'lastPauseAt':moment()[_0xc6ea('0x2e')]('YYYY-MM-DD\x20HH:mm:ss'),'interface':_0x537d1f});}})[_0xc6ea('0x10')](function(_0x33a34a){_0x5008f5(_0x33a34a);})['catch'](function(_0x41971e){_0xdc54e1(_0x33248c[_0xc6ea('0x15')](0x1f4,_0x41971e['message']));});});}; \ No newline at end of file +var _0x5006=['redis','localhost','socket.io-emitter','./user.socket','request','then','User,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','GetUser','User','findAll','options','raw','where','attributes','limit','include','map','model','stringify','ShowUser','find','PauseUser','name','role','interface','update','MemberReport','PAUSE','format','YYYY-MM-DD\x20HH:mm:ss','length','updateAttributes','forEach','push','isNil','SIP/%s','body','type','DEFAULT\x20PAUSE','internal','uniqueid','findOne','channel','isValidChannel','UserVoiceQueueRt','system','mail','fax','openchannel','whatsapp','%s%s','Pause','destroy','all','LoginUser','mobile','count','agent','../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','getVoiceQueues','upsert','UserVoiceQueue.penalty','getChannels','merge','LOGIN','loginInPause','concat','LOGININPAUSE','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http'];(function(_0x148947,_0x442f51){var _0x25e3a2=function(_0x23096a){while(--_0x23096a){_0x148947['push'](_0x148947['shift']());}};_0x25e3a2(++_0x442f51);}(_0x5006,0xa5));var _0x6500=function(_0x2fef5d,_0x1c7b98){_0x2fef5d=_0x2fef5d-0x0;var _0x2d99b5=_0x5006[_0x2fef5d];return _0x2d99b5;};'use strict';var _=require(_0x6500('0x0'));var util=require(_0x6500('0x1'));var moment=require('moment');var BPromise=require(_0x6500('0x2'));var rs=require(_0x6500('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6500('0x4'))['db'];var utils=require(_0x6500('0x5'));var logger=require(_0x6500('0x6'))('rpc');var config=require(_0x6500('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x6500('0x8')]({'port':0x232a});config[_0x6500('0x9')]=_['defaults'](config[_0x6500('0x9')],{'host':_0x6500('0xa'),'port':0x18eb});var socket=require(_0x6500('0xb'))(new Redis(config[_0x6500('0x9')]));require(_0x6500('0xc'))['register'](socket);function respondWithRpcPromise(_0x1d9000,_0x1290b9,_0x27b915){return new BPromise(function(_0xd8f3f9,_0x554ba2){return client[_0x6500('0xd')](_0x1d9000,_0x27b915)[_0x6500('0xe')](function(_0x14aace){logger['info'](_0x6500('0xf'),_0x1290b9,_0x6500('0x10'));logger[_0x6500('0x11')]('User,\x20%s,\x20%s,\x20%s',_0x1290b9,_0x6500('0x10'),JSON['stringify'](_0x14aace));if(_0x14aace[_0x6500('0x12')]){if(_0x14aace[_0x6500('0x12')][_0x6500('0x13')]===0x1f4){logger[_0x6500('0x12')](_0x6500('0xf'),_0x1290b9,_0x14aace['error'][_0x6500('0x14')]);return _0x554ba2(_0x14aace[_0x6500('0x12')][_0x6500('0x14')]);}logger[_0x6500('0x12')](_0x6500('0xf'),_0x1290b9,_0x14aace['error'][_0x6500('0x14')]);return _0xd8f3f9(_0x14aace[_0x6500('0x12')]['message']);}else{logger[_0x6500('0x15')]('User,\x20%s,\x20%s',_0x1290b9,_0x6500('0x10'));_0xd8f3f9(_0x14aace['result'][_0x6500('0x14')]);}})[_0x6500('0x16')](function(_0x2d3155){logger[_0x6500('0x12')]('User,\x20%s,\x20%s',_0x1290b9,_0x2d3155);_0x554ba2(_0x2d3155);});});}exports[_0x6500('0x17')]=function(_0x4287ab){var _0x7c6d59=this;return new Promise(function(_0x4d4ef6,_0xd9af0b){return db[_0x6500('0x18')][_0x6500('0x19')]({'raw':_0x4287ab[_0x6500('0x1a')]?_0x4287ab['options'][_0x6500('0x1b')]===undefined?!![]:![]:!![],'where':_0x4287ab['options']?_0x4287ab['options'][_0x6500('0x1c')]||null:null,'attributes':_0x4287ab[_0x6500('0x1a')]?_0x4287ab[_0x6500('0x1a')][_0x6500('0x1d')]||null:null,'limit':_0x4287ab[_0x6500('0x1a')]?_0x4287ab[_0x6500('0x1a')][_0x6500('0x1e')]||null:null,'include':_0x4287ab[_0x6500('0x1a')]?_0x4287ab[_0x6500('0x1a')][_0x6500('0x1f')]?_['map'](_0x4287ab['options'][_0x6500('0x1f')],function(_0x346f12){return{'model':db[_0x346f12['model']],'as':_0x346f12['as'],'attributes':_0x346f12[_0x6500('0x1d')],'include':_0x346f12['include']?_[_0x6500('0x20')](_0x346f12['include'],function(_0x4019b7){return{'model':db[_0x4019b7[_0x6500('0x21')]],'as':_0x4019b7['as'],'attributes':_0x4019b7[_0x6500('0x1d')],'include':_0x4019b7[_0x6500('0x1f')]?_[_0x6500('0x20')](_0x4019b7[_0x6500('0x1f')],function(_0x19f18a){return{'model':db[_0x19f18a[_0x6500('0x21')]],'as':_0x19f18a['as'],'attributes':_0x19f18a[_0x6500('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x6500('0xe')](function(_0x213c64){logger[_0x6500('0x15')](_0x6500('0x17'),_0x4287ab);logger['debug'](_0x6500('0x17'),_0x4287ab,JSON[_0x6500('0x22')](_0x213c64));_0x4d4ef6(_0x213c64);})[_0x6500('0x16')](function(_0x33b001){logger['error'](_0x6500('0x17'),_0x33b001['message'],_0x4287ab);_0xd9af0b(_0x7c6d59[_0x6500('0x12')](0x1f4,_0x33b001[_0x6500('0x14')]));});});};exports[_0x6500('0x23')]=function(_0x19b4a3){var _0x1e1992=this;return new Promise(function(_0x446b7b,_0x245503){return db[_0x6500('0x18')][_0x6500('0x24')]({'raw':_0x19b4a3[_0x6500('0x1a')]?_0x19b4a3[_0x6500('0x1a')][_0x6500('0x1b')]===undefined?!![]:![]:!![],'where':_0x19b4a3['options']?_0x19b4a3['options'][_0x6500('0x1c')]||null:null,'attributes':_0x19b4a3['options']?_0x19b4a3[_0x6500('0x1a')][_0x6500('0x1d')]||null:null,'include':_0x19b4a3[_0x6500('0x1a')]?_0x19b4a3[_0x6500('0x1a')][_0x6500('0x1f')]?_[_0x6500('0x20')](_0x19b4a3[_0x6500('0x1a')][_0x6500('0x1f')],function(_0x2d469c){return{'model':db[_0x2d469c[_0x6500('0x21')]],'as':_0x2d469c['as'],'attributes':_0x2d469c[_0x6500('0x1d')],'include':_0x2d469c[_0x6500('0x1f')]?_[_0x6500('0x20')](_0x2d469c[_0x6500('0x1f')],function(_0x9861df){return{'model':db[_0x9861df['model']],'as':_0x9861df['as'],'attributes':_0x9861df[_0x6500('0x1d')],'include':_0x9861df[_0x6500('0x1f')]?_[_0x6500('0x20')](_0x9861df[_0x6500('0x1f')],function(_0xfb107e){return{'model':db[_0xfb107e[_0x6500('0x21')]],'as':_0xfb107e['as'],'attributes':_0xfb107e[_0x6500('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x6500('0xe')](function(_0xe139aa){logger['info']('ShowUser',_0x19b4a3);logger[_0x6500('0x11')](_0x6500('0x23'),_0x19b4a3,JSON['stringify'](_0xe139aa));_0x446b7b(_0xe139aa);})[_0x6500('0x16')](function(_0x50a8fa){logger[_0x6500('0x12')](_0x6500('0x23'),_0x50a8fa['message'],_0x19b4a3);_0x245503(_0x1e1992[_0x6500('0x12')](0x1f4,_0x50a8fa[_0x6500('0x14')]));});});};exports[_0x6500('0x25')]=function(_0x44cdfa){var _0x571213=this;return new Promise(function(_0x248243,_0x6f951){var _0x49dec7;return db[_0x6500('0x18')][_0x6500('0x24')]({'where':_0x44cdfa[_0x6500('0x1a')][_0x6500('0x1c')]||{},'attributes':['id',_0x6500('0x26'),_0x6500('0x27'),'internal',_0x6500('0x28')]})[_0x6500('0xe')](function(_0x19b660){if(_0x19b660){_0x49dec7=_0x19b660;return db['UserVoiceQueueRt'][_0x6500('0x29')]({'paused':0x1},{'where':{'UserId':_0x49dec7['id']},'individualHooks':!![]});}})[_0x6500('0xe')](function(){if(_0x49dec7){return db[_0x6500('0x2a')][_0x6500('0x19')]({'where':{'membername':_0x49dec7[_0x6500('0x26')],'type':_0x6500('0x2b'),'exitAt':null}});}})[_0x6500('0xe')](function(_0x3a267d){if(_0x49dec7){if(_0x3a267d&&_0x3a267d['length']){var _0x45cd64=moment()[_0x6500('0x2c')](_0x6500('0x2d'));for(var _0x1c5ffe=0x0,_0x48b5fe=_0x3a267d[_0x6500('0x2e')];_0x1c5ffe<_0x48b5fe;_0x1c5ffe++){_0x3a267d[_0x1c5ffe][_0x6500('0x2f')]({'exitAt':_0x45cd64});}}}})['then'](function(){if(_0x49dec7){var _0x2a887c=[];var _0x38472f=utils['getChannels']();_0x38472f[_0x6500('0x30')](function(_0x556779){_0x2a887c[_0x6500('0x31')]({'channel':_0x556779,'membername':_0x49dec7[_0x6500('0x26')],'interface':_[_0x6500('0x32')](_0x49dec7[_0x6500('0x28')])?util[_0x6500('0x2c')](_0x6500('0x33'),_0x49dec7[_0x6500('0x26')]):_0x49dec7[_0x6500('0x28')],'type':_0x6500('0x2b'),'enterAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x44cdfa[_0x6500('0x34')][_0x6500('0x35')]||_0x6500('0x36'),'role':_0x49dec7['role'],'internal':_0x49dec7[_0x6500('0x37')],'uniqueid':_0x44cdfa['body'][_0x6500('0x38')]||null});});return db[_0x6500('0x2a')]['bulkCreate'](_0x2a887c,{'individualHooks':!![]});}})[_0x6500('0xe')](function(){if(_0x49dec7){return _0x49dec7[_0x6500('0x29')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x44cdfa[_0x6500('0x34')]['type']||_0x6500('0x36'),'lastPauseAt':moment()[_0x6500('0x2c')]('YYYY-MM-DD\x20HH:mm:ss')});}})[_0x6500('0xe')](function(_0x3436da){_0x248243(_0x3436da);})['catch'](function(_0xe0a614){_0x6f951(_0x571213[_0x6500('0x12')](0x1f4,_0xe0a614['message']));});});};exports['UnpauseUser']=function(_0x53019a){var _0xe9ab2c=this;return new Promise(function(_0x7851e7,_0x30c03f){var _0x6f0c8d;return db[_0x6500('0x18')][_0x6500('0x39')]({'where':_0x53019a[_0x6500('0x1a')]['where']||{},'attributes':['id',_0x6500('0x26')]})['then'](function(_0x280264){if(_0x280264){_0x6f0c8d=_0x280264;if(_0x53019a['body'][_0x6500('0x3a')]&&!utils[_0x6500('0x3b')](_0x53019a[_0x6500('0x34')][_0x6500('0x3a')])){throw new Error('Unknown\x20channel');}switch(_0x53019a[_0x6500('0x34')][_0x6500('0x3a')]){case'voice':return db[_0x6500('0x3c')][_0x6500('0x29')]({'paused':0x0},{'where':{'UserId':_0x6f0c8d['id']}})[_0x6500('0xe')](function(){return db[_0x6500('0x2a')][_0x6500('0x24')]({'where':{'channel':_0x53019a[_0x6500('0x34')][_0x6500('0x3a')],'membername':_0x6f0c8d[_0x6500('0x26')],'type':_0x6500('0x2b'),'exitAt':null}});})[_0x6500('0xe')](function(_0xcb83ef){if(_0xcb83ef){return _0xcb83ef[_0x6500('0x29')]({'exitAt':moment()[_0x6500('0x2c')](_0x6500('0x2d')),'data2':_0x6500('0x3d')},{'individualHooks':!![]});}return null;})['then'](function(){return _0x6f0c8d[_0x6500('0x29')]({'voicePause':![]});});case _0x6500('0x3e'):case'chat':case _0x6500('0x3f'):case'sms':case _0x6500('0x40'):case _0x6500('0x41'):return db[_0x6500('0x2a')][_0x6500('0x24')]({'where':{'channel':_0x53019a[_0x6500('0x34')][_0x6500('0x3a')],'membername':_0x6f0c8d['name'],'type':_0x6500('0x2b'),'exitAt':null}})[_0x6500('0xe')](function(_0x5eda15){return _0x5eda15[_0x6500('0x29')]({'exitAt':moment()[_0x6500('0x2c')](_0x6500('0x2d')),'data2':_0x6500('0x3d')},{'individualHooks':!![]});})[_0x6500('0xe')](function(){var _0x39c3bf={};_['set'](_0x39c3bf,util[_0x6500('0x2c')](_0x6500('0x42'),_0x53019a[_0x6500('0x34')]['channel'],_0x6500('0x43')),![]);return _0x6f0c8d[_0x6500('0x29')](_0x39c3bf);});default:return db[_0x6500('0x3c')][_0x6500('0x29')]({'paused':0x0},{'where':{'UserId':_0x6f0c8d['id']}})[_0x6500('0xe')](function(){return db['MemberReport']['findAll']({'where':{'membername':_0x6f0c8d['name'],'type':'PAUSE','exitAt':null}});})[_0x6500('0xe')](function(_0x612478){var _0x31a87e=[];_0x612478[_0x6500('0x30')](function(_0x478c27){_0x31a87e[_0x6500('0x31')](_0x478c27[_0x6500('0x29')]({'exitAt':moment()[_0x6500('0x2c')](_0x6500('0x2d')),'data2':_0x6500('0x3d')}));});return BPromise['all'](_0x31a87e);})[_0x6500('0xe')](function(){return _0x6f0c8d[_0x6500('0x29')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![]});});}}})[_0x6500('0xe')](function(_0x2130a2){_0x7851e7(_0x2130a2);})[_0x6500('0x16')](function(_0x61af26){_0x30c03f(_0xe9ab2c[_0x6500('0x12')](0x1f4,_0x61af26[_0x6500('0x14')]));});});};exports['LogoutUser']=function(_0x1047c2){var _0xea11c=this;return new Promise(function(_0x57befc,_0x330a45){var _0x5885ed;return db['User'][_0x6500('0x39')]({'where':_0x1047c2[_0x6500('0x1a')][_0x6500('0x1c')]||{},'attributes':['id','name']})[_0x6500('0xe')](function(_0x38ef09){if(_0x38ef09){_0x5885ed=_0x38ef09;return db[_0x6500('0x3c')][_0x6500('0x44')]({'where':{'membername':_0x5885ed[_0x6500('0x26')]},'individualHooks':!![]});}})['then'](function(){if(_0x5885ed){return db[_0x6500('0x2a')][_0x6500('0x19')]({'where':{'membername':_0x5885ed[_0x6500('0x26')],'exitAt':null}});}})[_0x6500('0xe')](function(_0x20df79){if(_0x5885ed){if(_0x20df79&&_0x20df79[_0x6500('0x2e')]){var _0x397f5c=[];_0x20df79[_0x6500('0x30')](function(_0x2e5e9a){_0x397f5c[_0x6500('0x31')](_0x2e5e9a[_0x6500('0x29')]({'exitAt':moment()[_0x6500('0x2c')](_0x6500('0x2d'))}));});return BPromise[_0x6500('0x45')](_0x397f5c);}}})[_0x6500('0xe')](function(){if(_0x5885ed){return _0x5885ed['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0x6500('0xe')](function(_0x13cb81){_0x57befc(_0x13cb81);})[_0x6500('0x16')](function(_0x5caa95){_0x330a45(_0xea11c[_0x6500('0x12')](0x1f4,_0x5caa95[_0x6500('0x14')]));});});};exports[_0x6500('0x46')]=function(_0x189e57){var _0x3e45b9=this;return new Promise(function(_0x54a291,_0x41f59a){var _0x298387;var _0x59da57;var _0x2c54be;var _0x210cf3;return db['User'][_0x6500('0x39')]({'where':_0x189e57[_0x6500('0x1a')][_0x6500('0x1c')]||{},'attributes':['id',_0x6500('0x26'),_0x6500('0x27'),_0x6500('0x47'),'phone','internal','loginInPause','interface']})[_0x6500('0xe')](function(_0x3e29f7){if(_0x3e29f7){_0x298387=_0x3e29f7;_0x210cf3=_0x189e57['body']['interface']?_0x189e57[_0x6500('0x34')][_0x6500('0x28')]:util[_0x6500('0x2c')](_0x6500('0x33'),_0x298387['name']);return db[_0x6500('0x18')][_0x6500('0x48')]({'where':{'role':_0x6500('0x49'),'online':!![],'id':{'$ne':_0x298387['id']}}});}})[_0x6500('0xe')](function(_0x57271e){if(_0x57271e){_0x2c54be=_0x57271e;return require(_0x6500('0x4a'))[_0x6500('0x4b')]();}})[_0x6500('0xe')](function(_0x261aac){if(_0x261aac&&_0x261aac[_0x6500('0x4c')]&&_0x2c54be>=_0x261aac['agents']){throw new Error(_0x6500('0x4d'));}})[_0x6500('0xe')](function(){if(_0x298387){return db[_0x6500('0x3c')][_0x6500('0x44')]({'where':{'membername':_0x298387[_0x6500('0x26')]},'individualHooks':!![]});}})['then'](function(){if(_0x298387){return _0x298387[_0x6500('0x4e')]({'raw':!![]});}})[_0x6500('0xe')](function(_0x3898d2){if(_0x298387){if(_0x3898d2){var _0x3445ec=[];_0x59da57=_0x3898d2;if(_0x59da57['length']){for(var _0x2abe44=0x0;_0x2abe44<_0x59da57[_0x6500('0x2e')];_0x2abe44++){_0x3445ec[_0x6500('0x31')](db[_0x6500('0x3c')][_0x6500('0x4f')]({'membername':_0x298387[_0x6500('0x26')],'UserId':_0x298387['id'],'queue_name':_0x59da57[_0x2abe44]['name'],'VoiceQueueId':_0x59da57[_0x2abe44]['id'],'interface':_0x210cf3,'paused':_0x298387['loginInPause']||![],'penalty':_0x59da57[_0x2abe44][_0x6500('0x50')]||0x0}));}return BPromise[_0x6500('0x45')](_0x3445ec);}}}})['then'](function(){if(_0x298387){return db[_0x6500('0x2a')]['findAll']({'where':{'membername':_0x298387[_0x6500('0x26')],'exitAt':null}});}})['then'](function(_0x432933){if(_0x298387){if(_0x432933&&_0x432933[_0x6500('0x2e')]){var _0xe66bc8=[];_0x432933['forEach'](function(_0x2dc2e8){_0xe66bc8[_0x6500('0x31')](_0x2dc2e8[_0x6500('0x29')]({'exitAt':moment()[_0x6500('0x2c')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x6500('0x45')](_0xe66bc8);}}})[_0x6500('0xe')](function(_0x4ecc4d){if(_0x298387){var _0x500f79=[];var _0x4c3c56=[];var _0x5c349f=utils[_0x6500('0x51')]();var _0x90b8d2={'membername':_0x298387[_0x6500('0x26')],'interface':_0x210cf3,'enterAt':moment()['format'](_0x6500('0x2d')),'role':_0x298387[_0x6500('0x27')],'internal':_0x298387['internal']};_0x5c349f['forEach'](function(_0x2c5bfc){_0x500f79['push'](_[_0x6500('0x52')]({'channel':_0x2c5bfc,'type':_0x6500('0x53'),'data1':'callysquare','data2':_0x210cf3},_0x90b8d2));if(_0x298387[_0x6500('0x54')]){_0x4c3c56[_0x6500('0x31')](_['merge']({'channel':_0x2c5bfc,'type':_0x6500('0x2b'),'data1':'LOGININPAUSE'},_0x90b8d2));}});return db[_0x6500('0x2a')]['bulkCreate'](_0x500f79[_0x6500('0x55')](_0x4c3c56),{'individualHooks':!![]});}})[_0x6500('0xe')](function(){if(_0x298387){return _0x298387[_0x6500('0x29')]({'online':!![],'lastLoginAt':moment()['format'](_0x6500('0x2d')),'voicePause':_0x298387[_0x6500('0x54')]||![],'mailPause':_0x298387['loginInPause']||![],'chatPause':_0x298387[_0x6500('0x54')]||![],'faxPause':_0x298387[_0x6500('0x54')]||![],'smsPause':_0x298387[_0x6500('0x54')]||![],'openchannelPause':_0x298387['loginInPause']||![],'pauseType':_0x298387[_0x6500('0x54')]?_0x6500('0x56'):null,'lastPauseAt':moment()[_0x6500('0x2c')]('YYYY-MM-DD\x20HH:mm:ss'),'interface':_0x210cf3});}})['then'](function(_0x454f47){_0x54a291(_0x454f47);})[_0x6500('0x16')](function(_0x44f335){_0x41f59a(_0x3e45b9[_0x6500('0x12')](0x1f4,_0x44f335[_0x6500('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index e2775b4..ffab053 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 _0xe497=['user:','./user.events','save','remove','update','emit','register','length'];(function(_0x5c605d,_0x500761){var _0x1bc14c=function(_0x2ae017){while(--_0x2ae017){_0x5c605d['push'](_0x5c605d['shift']());}};_0x1bc14c(++_0x500761);}(_0xe497,0x139));var _0x7e49=function(_0x1ac727,_0x13b5ea){_0x1ac727=_0x1ac727-0x0;var _0xc633c4=_0xe497[_0x1ac727];return _0xc633c4;};'use strict';var UserEvents=require(_0x7e49('0x0'));var events=[_0x7e49('0x1'),_0x7e49('0x2'),_0x7e49('0x3')];function createListener(_0x50d4ca,_0x3cf546){return function(_0xb1063b){_0x3cf546[_0x7e49('0x4')](_0x50d4ca,_0xb1063b);};}function removeListener(_0x5a9b78,_0x3bc44d){return function(){UserEvents['removeListener'](_0x5a9b78,_0x3bc44d);};}exports[_0x7e49('0x5')]=function(_0x4722ee){for(var _0x8cd483=0x0,_0x260072=events[_0x7e49('0x6')];_0x8cd483<_0x260072;_0x8cd483++){var _0x446d6d=events[_0x8cd483];var _0x2481d1=createListener(_0x7e49('0x7')+_0x446d6d,_0x4722ee);UserEvents['on'](_0x446d6d,_0x2481d1);}}; \ No newline at end of file +var _0xb8a0=['emit','removeListener','register','length','./user.events','save','update'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0xb8a0,0x15b));var _0x0b8a=function(_0x27a16c,_0x25b266){_0x27a16c=_0x27a16c-0x0;var _0x5861fc=_0xb8a0[_0x27a16c];return _0x5861fc;};'use strict';var UserEvents=require(_0x0b8a('0x0'));var events=[_0x0b8a('0x1'),'remove',_0x0b8a('0x2')];function createListener(_0x3665f3,_0x5b6a7d){return function(_0x42d44c){_0x5b6a7d[_0x0b8a('0x3')](_0x3665f3,_0x42d44c);};}function removeListener(_0x2ff107,_0x14f885){return function(){UserEvents[_0x0b8a('0x4')](_0x2ff107,_0x14f885);};}exports[_0x0b8a('0x5')]=function(_0x413648){for(var _0x594384=0x0,_0x2089e9=events[_0x0b8a('0x6')];_0x594384<_0x2089e9;_0x594384++){var _0xd1160e=events[_0x594384];var _0x40f4fa=createListener('user:'+_0xd1160e,_0x413648);UserEvents['on'](_0xd1160e,_0x40f4fa);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 60ec2de..865d621 100644 --- a/server/api/userChatQueue/index.js +++ b/server/api/userChatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x69d3ef,_0x4e03ef){var _0x31c788=function(_0x2bb81e){while(--_0x2bb81e){_0x69d3ef['push'](_0x69d3ef['shift']());}};_0x31c788(++_0x4e03ef);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x20d478,_0x2014a5){var _0x47a1d7=function(_0x57860){while(--_0x57860){_0x20d478['push'](_0x20d478['shift']());}};_0x47a1d7(++_0x2014a5);}(_0x70e0,0x17b));var _0x070e=function(_0x5d05e6,_0x462450){_0x5d05e6=_0x5d05e6-0x0;var _0x206d49=_0x70e0[_0x5d05e6];return _0x206d49;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index f2a68fe..3bec2e5 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 _0x4855=['exports','INTEGER','sequelize'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x4855,0x1d9));var _0x5485=function(_0x3b7a06,_0x41f79e){_0x3b7a06=_0x3b7a06-0x0;var _0x363e31=_0x4855[_0x3b7a06];return _0x363e31;};'use strict';var Sequelize=require(_0x5485('0x0'));module[_0x5485('0x1')]={'penalty':{'type':Sequelize[_0x5485('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe58b=['sequelize','exports','INTEGER'];(function(_0x35da42,_0x5c2610){var _0x370035=function(_0x546db5){while(--_0x546db5){_0x35da42['push'](_0x35da42['shift']());}};_0x370035(++_0x5c2610);}(_0xe58b,0x1e3));var _0xbe58=function(_0x122633,_0x22057b){_0x122633=_0x122633-0x0;var _0x2d02e5=_0xe58b[_0x122633];return _0x2d02e5;};'use strict';var Sequelize=require(_0xbe58('0x0'));module[_0xbe58('0x1')]={'penalty':{'type':Sequelize[_0xbe58('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 3a6ea9b..6e86e60 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 _0x972d=['exports','define','user_has_chat_queues','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x197185,_0x251145){var _0x2c8af1=function(_0x1dbcfd){while(--_0x1dbcfd){_0x197185['push'](_0x197185['shift']());}};_0x2c8af1(++_0x251145);}(_0x972d,0xb7));var _0xd972=function(_0x244a95,_0x495cdf){_0x244a95=_0x244a95-0x0;var _0x20428e=_0x972d[_0x244a95];return _0x20428e;};'use strict';var _=require(_0xd972('0x0'));var util=require(_0xd972('0x1'));var logger=require(_0xd972('0x2'))(_0xd972('0x3'));var moment=require(_0xd972('0x4'));var BPromise=require('bluebird');var rp=require(_0xd972('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./userChatQueue.attributes');module[_0xd972('0x6')]=function(_0x503400,_0x2ceb90){return _0x503400[_0xd972('0x7')]('UserChatQueue',attributes,{'tableName':_0xd972('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2565=['../../config/logger','api','moment','bluebird','request-promise','./userChatQueue.attributes','UserChatQueue','user_has_chat_queues','util'];(function(_0x122120,_0x1b9817){var _0xc7e5d0=function(_0x505139){while(--_0x505139){_0x122120['push'](_0x122120['shift']());}};_0xc7e5d0(++_0x1b9817);}(_0x2565,0xfb));var _0x5256=function(_0x3d7d12,_0x273b25){_0x3d7d12=_0x3d7d12-0x0;var _0x94f66=_0x2565[_0x3d7d12];return _0x94f66;};'use strict';var _=require('lodash');var util=require(_0x5256('0x0'));var logger=require(_0x5256('0x1'))(_0x5256('0x2'));var moment=require(_0x5256('0x3'));var BPromise=require(_0x5256('0x4'));var rp=require(_0x5256('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x5256('0x6'));module['exports']=function(_0x3d9695,_0x26a335){return _0x3d9695['define'](_0x5256('0x7'),attributes,{'tableName':_0x5256('0x8'),'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 e765e28..5a98f18 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 _0x59a9=['message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x147497,_0x43e433){var _0x35f45=function(_0x584421){while(--_0x584421){_0x147497['push'](_0x147497['shift']());}};_0x35f45(++_0x43e433);}(_0x59a9,0xa3));var _0x959a=function(_0x3e0295,_0x1361cd){_0x3e0295=_0x3e0295-0x0;var _0x4c3735=_0x59a9[_0x3e0295];return _0x4c3735;};'use strict';var _=require(_0x959a('0x0'));var util=require('util');var moment=require(_0x959a('0x1'));var BPromise=require(_0x959a('0x2'));var rs=require(_0x959a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x959a('0x4'))['db'];var utils=require(_0x959a('0x5'));var logger=require(_0x959a('0x6'))('rpc');var config=require(_0x959a('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x959a('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2c1455,_0x20b63f,_0xa93e44){return new BPromise(function(_0x3a1dc7,_0x386c06){return client[_0x959a('0x9')](_0x2c1455,_0xa93e44)['then'](function(_0x25b13c){logger[_0x959a('0xa')](_0x959a('0xb'),_0x20b63f,_0x959a('0xc'));logger[_0x959a('0xd')](_0x959a('0xe'),_0x20b63f,_0x959a('0xc'),JSON['stringify'](_0x25b13c));if(_0x25b13c[_0x959a('0xf')]){if(_0x25b13c[_0x959a('0xf')][_0x959a('0x10')]===0x1f4){logger[_0x959a('0xf')]('UserChatQueue,\x20%s,\x20%s',_0x20b63f,_0x25b13c[_0x959a('0xf')][_0x959a('0x11')]);return _0x386c06(_0x25b13c[_0x959a('0xf')][_0x959a('0x11')]);}logger[_0x959a('0xf')](_0x959a('0xb'),_0x20b63f,_0x25b13c['error'][_0x959a('0x11')]);return _0x3a1dc7(_0x25b13c['error'][_0x959a('0x11')]);}else{logger[_0x959a('0xa')](_0x959a('0xb'),_0x20b63f,_0x959a('0xc'));_0x3a1dc7(_0x25b13c[_0x959a('0x12')]['message']);}})[_0x959a('0x13')](function(_0x2504da){logger[_0x959a('0xf')](_0x959a('0xb'),_0x20b63f,_0x2504da);_0x386c06(_0x2504da);});});} \ No newline at end of file +var _0x619e=['UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','util','moment','randomstring','ioredis','../../config/logger','../../config/environment','client','http','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x48c713,_0x3139bb){var _0x59c6f3=function(_0x3723c3){while(--_0x3723c3){_0x48c713['push'](_0x48c713['shift']());}};_0x59c6f3(++_0x3139bb);}(_0x619e,0x138));var _0xe619=function(_0xb6b285,_0x596e01){_0xb6b285=_0xb6b285-0x0;var _0x11393c=_0x619e[_0xb6b285];return _0x11393c;};'use strict';var _=require('lodash');var util=require(_0xe619('0x0'));var moment=require(_0xe619('0x1'));var BPromise=require('bluebird');var rs=require(_0xe619('0x2'));var fs=require('fs');var Redis=require(_0xe619('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xe619('0x4'))('rpc');var config=require(_0xe619('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xe619('0x6')][_0xe619('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x459ac6,_0x1f0ad3,_0x18a911){return new BPromise(function(_0x1cceb1,_0x1bda7b){return client['request'](_0x459ac6,_0x18a911)['then'](function(_0x323ade){logger['info'](_0xe619('0x8'),_0x1f0ad3,_0xe619('0x9'));logger[_0xe619('0xa')](_0xe619('0xb'),_0x1f0ad3,_0xe619('0x9'),JSON[_0xe619('0xc')](_0x323ade));if(_0x323ade['error']){if(_0x323ade['error']['code']===0x1f4){logger[_0xe619('0xd')]('UserChatQueue,\x20%s,\x20%s',_0x1f0ad3,_0x323ade[_0xe619('0xd')]['message']);return _0x1bda7b(_0x323ade[_0xe619('0xd')][_0xe619('0xe')]);}logger[_0xe619('0xd')](_0xe619('0x8'),_0x1f0ad3,_0x323ade[_0xe619('0xd')][_0xe619('0xe')]);return _0x1cceb1(_0x323ade[_0xe619('0xd')][_0xe619('0xe')]);}else{logger[_0xe619('0xf')]('UserChatQueue,\x20%s,\x20%s',_0x1f0ad3,'request\x20sent');_0x1cceb1(_0x323ade['result'][_0xe619('0xe')]);}})[_0xe619('0x10')](function(_0x25b0bd){logger[_0xe619('0xd')]('UserChatQueue,\x20%s,\x20%s',_0x1f0ad3,_0x25b0bd);_0x1bda7b(_0x25b0bd);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 8479ee8..3f87594 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x4eeb21,_0xe28a97){var _0x209775=function(_0x310d42){while(--_0x310d42){_0x4eeb21['push'](_0x4eeb21['shift']());}};_0x209775(++_0xe28a97);}(_0x70e0,0x17b));var _0x070e=function(_0xa03fed,_0x574c43){_0xa03fed=_0xa03fed-0x0;var _0x34cdfe=_0x70e0[_0xa03fed];return _0x34cdfe;};'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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x1f0aa5,_0x1e6ca8){var _0x465f98=function(_0x43dc58){while(--_0x43dc58){_0x1f0aa5['push'](_0x1f0aa5['shift']());}};_0x465f98(++_0x1e6ca8);}(_0x70e0,0x17b));var _0x070e=function(_0x382c61,_0x4d5930){_0x382c61=_0x382c61-0x0;var _0x134e8c=_0x70e0[_0x382c61];return _0x134e8c;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 474f963..62b79b7 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 _0x2808=['INTEGER','STRING','sequelize'];(function(_0x2a5d7a,_0x47b143){var _0x231c09=function(_0x48a2a6){while(--_0x48a2a6){_0x2a5d7a['push'](_0x2a5d7a['shift']());}};_0x231c09(++_0x47b143);}(_0x2808,0x104));var _0x8280=function(_0x1b984a,_0x1f4cac){_0x1b984a=_0x1b984a-0x0;var _0x48dd75=_0x2808[_0x1b984a];return _0x48dd75;};'use strict';var Sequelize=require(_0x8280('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x8280('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x8280('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x8280('0x2')]}}; \ No newline at end of file +var _0x0126=['INTEGER','STRING','sequelize','exports'];(function(_0x26462c,_0xd20a35){var _0x509a42=function(_0x1b22c9){while(--_0x1b22c9){_0x26462c['push'](_0x26462c['shift']());}};_0x509a42(++_0xd20a35);}(_0x0126,0x116));var _0x6012=function(_0x874c10,_0xf8740c){_0x874c10=_0x874c10-0x0;var _0x20b492=_0x0126[_0x874c10];return _0x20b492;};'use strict';var Sequelize=require(_0x6012('0x0'));module[_0x6012('0x1')]={'penalty':{'type':Sequelize[_0x6012('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x6012('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x6012('0x3')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 296a330..415fa70 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 _0xa9d7=['exports','user_has_fax_queues','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userFaxQueue.attributes'];(function(_0x59c8fe,_0x2f65ef){var _0x1b9b22=function(_0x2b5ba6){while(--_0x2b5ba6){_0x59c8fe['push'](_0x59c8fe['shift']());}};_0x1b9b22(++_0x2f65ef);}(_0xa9d7,0x15e));var _0x7a9d=function(_0x45bec0,_0x573804){_0x45bec0=_0x45bec0-0x0;var _0x2123c4=_0xa9d7[_0x45bec0];return _0x2123c4;};'use strict';var _=require(_0x7a9d('0x0'));var util=require(_0x7a9d('0x1'));var logger=require(_0x7a9d('0x2'))('api');var moment=require(_0x7a9d('0x3'));var BPromise=require(_0x7a9d('0x4'));var rp=require(_0x7a9d('0x5'));var fs=require('fs');var path=require(_0x7a9d('0x6'));var rimraf=require(_0x7a9d('0x7'));var config=require(_0x7a9d('0x8'));var attributes=require(_0x7a9d('0x9'));module[_0x7a9d('0xa')]=function(_0x4a643e,_0x5be0c7){return _0x4a643e['define']('UserFaxQueue',attributes,{'tableName':_0x7a9d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x37d5=['api','moment','bluebird','path','rimraf','../../config/environment','./userFaxQueue.attributes','exports','define','UserFaxQueue','user_has_fax_queues','lodash','util','../../config/logger'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x37d5,0x177));var _0x537d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x37d5[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x537d('0x0'));var util=require(_0x537d('0x1'));var logger=require(_0x537d('0x2'))(_0x537d('0x3'));var moment=require(_0x537d('0x4'));var BPromise=require(_0x537d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x537d('0x6'));var rimraf=require(_0x537d('0x7'));var config=require(_0x537d('0x8'));var attributes=require(_0x537d('0x9'));module[_0x537d('0xa')]=function(_0x199e44,_0x53234d){return _0x199e44[_0x537d('0xb')](_0x537d('0xc'),attributes,{'tableName':_0x537d('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.rpc.js b/server/api/userFaxQueue/userFaxQueue.rpc.js index 9814b9c..03c4267 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 _0x1e9f=['request\x20sent','debug','error','code','message','catch','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info','UserFaxQueue,\x20%s,\x20%s'];(function(_0x46f6c6,_0x5f337d){var _0x462bb8=function(_0x30c708){while(--_0x30c708){_0x46f6c6['push'](_0x46f6c6['shift']());}};_0x462bb8(++_0x5f337d);}(_0x1e9f,0x16e));var _0xf1e9=function(_0x5b4059,_0x5d27f6){_0x5b4059=_0x5b4059-0x0;var _0x2215f5=_0x1e9f[_0x5b4059];return _0x2215f5;};'use strict';var _=require(_0xf1e9('0x0'));var util=require('util');var moment=require(_0xf1e9('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf1e9('0x2'));var db=require(_0xf1e9('0x3'))['db'];var utils=require(_0xf1e9('0x4'));var logger=require(_0xf1e9('0x5'))(_0xf1e9('0x6'));var config=require(_0xf1e9('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf1e9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x28a4eb,_0x1248f1,_0x44abcd){return new BPromise(function(_0x5f52,_0x1c75fc){return client['request'](_0x28a4eb,_0x44abcd)[_0xf1e9('0x9')](function(_0x3a9a27){logger[_0xf1e9('0xa')](_0xf1e9('0xb'),_0x1248f1,_0xf1e9('0xc'));logger[_0xf1e9('0xd')]('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x1248f1,_0xf1e9('0xc'),JSON['stringify'](_0x3a9a27));if(_0x3a9a27[_0xf1e9('0xe')]){if(_0x3a9a27['error'][_0xf1e9('0xf')]===0x1f4){logger['error'](_0xf1e9('0xb'),_0x1248f1,_0x3a9a27[_0xf1e9('0xe')][_0xf1e9('0x10')]);return _0x1c75fc(_0x3a9a27['error'][_0xf1e9('0x10')]);}logger[_0xf1e9('0xe')](_0xf1e9('0xb'),_0x1248f1,_0x3a9a27['error']['message']);return _0x5f52(_0x3a9a27[_0xf1e9('0xe')][_0xf1e9('0x10')]);}else{logger[_0xf1e9('0xa')]('UserFaxQueue,\x20%s,\x20%s',_0x1248f1,_0xf1e9('0xc'));_0x5f52(_0x3a9a27['result'][_0xf1e9('0x10')]);}})[_0xf1e9('0x11')](function(_0x364fb5){logger[_0xf1e9('0xe')](_0xf1e9('0xb'),_0x1248f1,_0x364fb5);_0x1c75fc(_0x364fb5);});});} \ No newline at end of file +var _0x1af7=['catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','UserFaxQueue,\x20%s,\x20%s','result'];(function(_0x4d9442,_0x1e784a){var _0x5b0d83=function(_0x42a07e){while(--_0x42a07e){_0x4d9442['push'](_0x4d9442['shift']());}};_0x5b0d83(++_0x1e784a);}(_0x1af7,0xfb));var _0x71af=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x1af7[_0x1cc8fe];return _0x230054;};'use strict';var _=require(_0x71af('0x0'));var util=require(_0x71af('0x1'));var moment=require('moment');var BPromise=require(_0x71af('0x2'));var rs=require(_0x71af('0x3'));var fs=require('fs');var Redis=require(_0x71af('0x4'));var db=require(_0x71af('0x5'))['db'];var utils=require(_0x71af('0x6'));var logger=require(_0x71af('0x7'))(_0x71af('0x8'));var config=require(_0x71af('0x9'));var jayson=require(_0x71af('0xa'));var client=jayson[_0x71af('0xb')][_0x71af('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x257284,_0x380a5d,_0x520d0c){return new BPromise(function(_0x52ae5f,_0x2a0eff){return client[_0x71af('0xd')](_0x257284,_0x520d0c)['then'](function(_0x44a031){logger[_0x71af('0xe')]('UserFaxQueue,\x20%s,\x20%s',_0x380a5d,'request\x20sent');logger[_0x71af('0xf')](_0x71af('0x10'),_0x380a5d,_0x71af('0x11'),JSON[_0x71af('0x12')](_0x44a031));if(_0x44a031[_0x71af('0x13')]){if(_0x44a031[_0x71af('0x13')][_0x71af('0x14')]===0x1f4){logger[_0x71af('0x13')]('UserFaxQueue,\x20%s,\x20%s',_0x380a5d,_0x44a031[_0x71af('0x13')][_0x71af('0x15')]);return _0x2a0eff(_0x44a031[_0x71af('0x13')][_0x71af('0x15')]);}logger['error'](_0x71af('0x16'),_0x380a5d,_0x44a031[_0x71af('0x13')]['message']);return _0x52ae5f(_0x44a031[_0x71af('0x13')][_0x71af('0x15')]);}else{logger[_0x71af('0xe')](_0x71af('0x16'),_0x380a5d,_0x71af('0x11'));_0x52ae5f(_0x44a031[_0x71af('0x17')][_0x71af('0x15')]);}})[_0x71af('0x18')](function(_0x2c78a1){logger[_0x71af('0x13')]('UserFaxQueue,\x20%s,\x20%s',_0x380a5d,_0x2c78a1);_0x2a0eff(_0x2c78a1);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index f4fc7d1..4aeff5a 100644 --- a/server/api/userMailQueue/index.js +++ b/server/api/userMailQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x5252ce,_0x133319){var _0x1f0fec=function(_0x1a7403){while(--_0x1a7403){_0x5252ce['push'](_0x5252ce['shift']());}};_0x1f0fec(++_0x133319);}(_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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x177f58,_0x7eb824){var _0x30c13d=function(_0x24d737){while(--_0x24d737){_0x177f58['push'](_0x177f58['shift']());}};_0x30c13d(++_0x7eb824);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xa9e0[_0x47b58b];return _0x46bebe;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 1cf41ce..19b0dc9 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 _0x73f4=['sequelize','exports'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0x73f4,0x1b0));var _0x473f=function(_0x872b02,_0x4f4458){_0x872b02=_0x872b02-0x0;var _0x1a6b24=_0x73f4[_0x872b02];return _0x1a6b24;};'use strict';var Sequelize=require(_0x473f('0x0'));module[_0x473f('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x98a1=['exports','INTEGER','sequelize'];(function(_0x687549,_0x2a09eb){var _0x44e4a0=function(_0xef9ff1){while(--_0xef9ff1){_0x687549['push'](_0x687549['shift']());}};_0x44e4a0(++_0x2a09eb);}(_0x98a1,0x10d));var _0x198a=function(_0x2ce4ca,_0x22ce83){_0x2ce4ca=_0x2ce4ca-0x0;var _0x1ce957=_0x98a1[_0x2ce4ca];return _0x1ce957;};'use strict';var Sequelize=require(_0x198a('0x0'));module[_0x198a('0x1')]={'penalty':{'type':Sequelize[_0x198a('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 47d7b87..f84aa5b 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 _0xf223=['exports','UserMailQueue','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./userMailQueue.attributes'];(function(_0x7033ad,_0x4f191a){var _0x4117fb=function(_0x537976){while(--_0x537976){_0x7033ad['push'](_0x7033ad['shift']());}};_0x4117fb(++_0x4f191a);}(_0xf223,0xc2));var _0x3f22=function(_0x893e48,_0x31660c){_0x893e48=_0x893e48-0x0;var _0x4a9a22=_0xf223[_0x893e48];return _0x4a9a22;};'use strict';var _=require(_0x3f22('0x0'));var util=require(_0x3f22('0x1'));var logger=require(_0x3f22('0x2'))(_0x3f22('0x3'));var moment=require('moment');var BPromise=require(_0x3f22('0x4'));var rp=require(_0x3f22('0x5'));var fs=require('fs');var path=require(_0x3f22('0x6'));var rimraf=require(_0x3f22('0x7'));var config=require(_0x3f22('0x8'));var attributes=require(_0x3f22('0x9'));module[_0x3f22('0xa')]=function(_0x504296,_0x4c864a){return _0x504296['define'](_0x3f22('0xb'),attributes,{'tableName':'user_has_mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9521=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userMailQueue.attributes','exports','define','user_has_mail_queues','lodash'];(function(_0x3e1a6a,_0x3feb78){var _0x2db454=function(_0x1b2cd5){while(--_0x1b2cd5){_0x3e1a6a['push'](_0x3e1a6a['shift']());}};_0x2db454(++_0x3feb78);}(_0x9521,0x16b));var _0x1952=function(_0x3cb3ca,_0x44d697){_0x3cb3ca=_0x3cb3ca-0x0;var _0x214366=_0x9521[_0x3cb3ca];return _0x214366;};'use strict';var _=require(_0x1952('0x0'));var util=require('util');var logger=require(_0x1952('0x1'))(_0x1952('0x2'));var moment=require(_0x1952('0x3'));var BPromise=require(_0x1952('0x4'));var rp=require(_0x1952('0x5'));var fs=require('fs');var path=require(_0x1952('0x6'));var rimraf=require(_0x1952('0x7'));var config=require(_0x1952('0x8'));var attributes=require(_0x1952('0x9'));module[_0x1952('0xa')]=function(_0xb9751b,_0x4eeff2){return _0xb9751b[_0x1952('0xb')]('UserMailQueue',attributes,{'tableName':_0x1952('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.rpc.js b/server/api/userMailQueue/userMailQueue.rpc.js index d6d8200..1f6c2c6 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 _0xf3cd=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','info','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserMailQueue,\x20%s,\x20%s','message','result'];(function(_0x447260,_0x5d2baa){var _0xfd1cc4=function(_0x4e52f3){while(--_0x4e52f3){_0x447260['push'](_0x447260['shift']());}};_0xfd1cc4(++_0x5d2baa);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x3050b5,_0x182c6a){_0x3050b5=_0x3050b5-0x0;var _0x37cceb=_0xf3cd[_0x3050b5];return _0x37cceb;};'use strict';var _=require(_0xdf3c('0x0'));var util=require(_0xdf3c('0x1'));var moment=require(_0xdf3c('0x2'));var BPromise=require(_0xdf3c('0x3'));var rs=require(_0xdf3c('0x4'));var fs=require('fs');var Redis=require(_0xdf3c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xdf3c('0x6'));var logger=require(_0xdf3c('0x7'))(_0xdf3c('0x8'));var config=require('../../config/environment');var jayson=require(_0xdf3c('0x9'));var client=jayson[_0xdf3c('0xa')][_0xdf3c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1f0601,_0x106021,_0x28edae){return new BPromise(function(_0x52c073,_0x15705d){return client['request'](_0x1f0601,_0x28edae)['then'](function(_0x22d8ae){logger[_0xdf3c('0xc')]('UserMailQueue,\x20%s,\x20%s',_0x106021,_0xdf3c('0xd'));logger[_0xdf3c('0xe')](_0xdf3c('0xf'),_0x106021,_0xdf3c('0xd'),JSON[_0xdf3c('0x10')](_0x22d8ae));if(_0x22d8ae[_0xdf3c('0x11')]){if(_0x22d8ae[_0xdf3c('0x11')][_0xdf3c('0x12')]===0x1f4){logger['error'](_0xdf3c('0x13'),_0x106021,_0x22d8ae[_0xdf3c('0x11')][_0xdf3c('0x14')]);return _0x15705d(_0x22d8ae[_0xdf3c('0x11')]['message']);}logger[_0xdf3c('0x11')](_0xdf3c('0x13'),_0x106021,_0x22d8ae[_0xdf3c('0x11')]['message']);return _0x52c073(_0x22d8ae[_0xdf3c('0x11')][_0xdf3c('0x14')]);}else{logger[_0xdf3c('0xc')](_0xdf3c('0x13'),_0x106021,_0xdf3c('0xd'));_0x52c073(_0x22d8ae[_0xdf3c('0x15')][_0xdf3c('0x14')]);}})[_0xdf3c('0x16')](function(_0x2986d0){logger[_0xdf3c('0x11')]('UserMailQueue,\x20%s,\x20%s',_0x106021,_0x2986d0);_0x15705d(_0x2986d0);});});} \ No newline at end of file +var _0xf3cd=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','info','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserMailQueue,\x20%s,\x20%s','message','result'];(function(_0x19cbcc,_0x44384e){var _0x44d405=function(_0x475354){while(--_0x475354){_0x19cbcc['push'](_0x19cbcc['shift']());}};_0x44d405(++_0x44384e);}(_0xf3cd,0xfe));var _0xdf3c=function(_0xeb4c8b,_0x1dc497){_0xeb4c8b=_0xeb4c8b-0x0;var _0x90b0d0=_0xf3cd[_0xeb4c8b];return _0x90b0d0;};'use strict';var _=require(_0xdf3c('0x0'));var util=require(_0xdf3c('0x1'));var moment=require(_0xdf3c('0x2'));var BPromise=require(_0xdf3c('0x3'));var rs=require(_0xdf3c('0x4'));var fs=require('fs');var Redis=require(_0xdf3c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xdf3c('0x6'));var logger=require(_0xdf3c('0x7'))(_0xdf3c('0x8'));var config=require('../../config/environment');var jayson=require(_0xdf3c('0x9'));var client=jayson[_0xdf3c('0xa')][_0xdf3c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1f0601,_0x106021,_0x28edae){return new BPromise(function(_0x52c073,_0x15705d){return client['request'](_0x1f0601,_0x28edae)['then'](function(_0x22d8ae){logger[_0xdf3c('0xc')]('UserMailQueue,\x20%s,\x20%s',_0x106021,_0xdf3c('0xd'));logger[_0xdf3c('0xe')](_0xdf3c('0xf'),_0x106021,_0xdf3c('0xd'),JSON[_0xdf3c('0x10')](_0x22d8ae));if(_0x22d8ae[_0xdf3c('0x11')]){if(_0x22d8ae[_0xdf3c('0x11')][_0xdf3c('0x12')]===0x1f4){logger['error'](_0xdf3c('0x13'),_0x106021,_0x22d8ae[_0xdf3c('0x11')][_0xdf3c('0x14')]);return _0x15705d(_0x22d8ae[_0xdf3c('0x11')]['message']);}logger[_0xdf3c('0x11')](_0xdf3c('0x13'),_0x106021,_0x22d8ae[_0xdf3c('0x11')]['message']);return _0x52c073(_0x22d8ae[_0xdf3c('0x11')][_0xdf3c('0x14')]);}else{logger[_0xdf3c('0xc')](_0xdf3c('0x13'),_0x106021,_0xdf3c('0xd'));_0x52c073(_0x22d8ae[_0xdf3c('0x15')][_0xdf3c('0x14')]);}})[_0xdf3c('0x16')](function(_0x2986d0){logger[_0xdf3c('0x11')]('UserMailQueue,\x20%s,\x20%s',_0x106021,_0x2986d0);_0x15705d(_0x2986d0);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 1ac11c6..a16ce4d 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 _0x311f=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','post','isAuthenticated','sendUserNotification','exports','util'];(function(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0x311f,0x11d));var _0xf311=function(_0x26c75a,_0x5c96b2){_0x26c75a=_0x26c75a-0x0;var _0x4fe968=_0x311f[_0x26c75a];return _0x4fe968;};'use strict';var multer=require('multer');var util=require(_0xf311('0x0'));var path=require('path');var timeout=require(_0xf311('0x1'));var express=require(_0xf311('0x2'));var router=express[_0xf311('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xf311('0x4'));var interaction=require(_0xf311('0x5'));var config=require(_0xf311('0x6'));var controller=require('./userNotification.controller');router[_0xf311('0x7')]('/',auth[_0xf311('0x8')](),controller[_0xf311('0x9')]);module[_0xf311('0xa')]=router; \ No newline at end of file +var _0xa425=['isAuthenticated','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','post'];(function(_0x194afd,_0x3018e2){var _0x12d52c=function(_0x28b3b0){while(--_0x28b3b0){_0x194afd['push'](_0x194afd['shift']());}};_0x12d52c(++_0x3018e2);}(_0xa425,0x10a));var _0x5a42=function(_0x581af1,_0x4f02c5){_0x581af1=_0x581af1-0x0;var _0x54c22e=_0xa425[_0x581af1];return _0x54c22e;};'use strict';var multer=require(_0x5a42('0x0'));var util=require('util');var path=require(_0x5a42('0x1'));var timeout=require(_0x5a42('0x2'));var express=require(_0x5a42('0x3'));var router=express[_0x5a42('0x4')]();var fs_extra=require(_0x5a42('0x5'));var auth=require(_0x5a42('0x6'));var interaction=require(_0x5a42('0x7'));var config=require(_0x5a42('0x8'));var controller=require('./userNotification.controller');router[_0x5a42('0x9')]('/',auth[_0x5a42('0xa')](),controller['sendUserNotification']);module[_0x5a42('0xb')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index 320c3f2..45bf42b 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 _0x4914=['sequelize','exports','TEXT','STRING','BOOLEAN'];(function(_0x401c88,_0x5c9ef9){var _0x3126a0=function(_0x56f75c){while(--_0x56f75c){_0x401c88['push'](_0x401c88['shift']());}};_0x3126a0(++_0x5c9ef9);}(_0x4914,0x11d));var _0x4491=function(_0x3b94fc,_0x44fef4){_0x3b94fc=_0x3b94fc-0x0;var _0x27b1af=_0x4914[_0x3b94fc];return _0x27b1af;};'use strict';var Sequelize=require(_0x4491('0x0'));module[_0x4491('0x1')]={'body':{'type':Sequelize[_0x4491('0x2')]},'senderName':{'type':Sequelize[_0x4491('0x3')]},'recipientsId':{'type':Sequelize[_0x4491('0x2')]},'recipientsDescription':{'type':Sequelize[_0x4491('0x3')]},'beep':{'type':Sequelize[_0x4491('0x4')]}}; \ No newline at end of file +var _0x3d08=['BOOLEAN','exports','TEXT','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3d08,0xa9));var _0x83d0=function(_0x33850d,_0x2f3f72){_0x33850d=_0x33850d-0x0;var _0xb0c6c=_0x3d08[_0x33850d];return _0xb0c6c;};'use strict';var Sequelize=require('sequelize');module[_0x83d0('0x0')]={'body':{'type':Sequelize[_0x83d0('0x1')]},'senderName':{'type':Sequelize[_0x83d0('0x2')]},'recipientsId':{'type':Sequelize[_0x83d0('0x1')]},'recipientsDescription':{'type':Sequelize[_0x83d0('0x2')]},'beep':{'type':Sequelize[_0x83d0('0x3')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index 2d2c512..01f3f88 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 _0xea67=['includes','model','toLowerCase','senderName','user','recipientsDescription','beep','recipientsId','sortBy','join','UserNotification','create','forEach','userNotification:send','catch','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','startCase','User','ids','queue','Queue','push','all','flatten','getAgents','map','rimraf','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','api','../../config/utils','../../config/environment','../../mysqldb','redis','socket.io-emitter','./userNotification.socket','register','sendStatus','status','end','offset','undefined','limit','set','Content-Range','json','apply','save','update','then','destroy','name','send','hasOwnProperty','text','body','TemplateId','ValidationError','view','Missing\x20\x27view\x27\x20parameter','Sequelize','Missing\x20\x27recipients\x27\x20parameter','parse','recipients','error','Invalid\x20\x27recipients\x27\x20object','faxqueue','mailqueue','voicequeue','whatsappqueue','team','some'];(function(_0x9efc39,_0x1be234){var _0x2c5051=function(_0x19e7c7){while(--_0x19e7c7){_0x9efc39['push'](_0x9efc39['shift']());}};_0x2c5051(++_0x1be234);}(_0xea67,0x1d0));var _0x7ea6=function(_0x52d4ee,_0x64e207){_0x52d4ee=_0x52d4ee-0x0;var _0x51d053=_0xea67[_0x52d4ee];return _0x51d053;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7ea6('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7ea6('0x1'));var BPromise=require(_0x7ea6('0x2'));var Mustache=require(_0x7ea6('0x3'));var util=require(_0x7ea6('0x4'));var path=require(_0x7ea6('0x5'));var sox=require(_0x7ea6('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7ea6('0x7'));var squel=require(_0x7ea6('0x8'));var crypto=require(_0x7ea6('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x7ea6('0xa'));var toCsv=require('to-csv');var querystring=require(_0x7ea6('0xb'));var Papa=require(_0x7ea6('0xc'));var Redis=require(_0x7ea6('0xd'));var authService=require(_0x7ea6('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7ea6('0xf'));var utils=require(_0x7ea6('0x10'));var config=require(_0x7ea6('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0x7ea6('0x12'))['db'];config['redis']=_['defaults'](config[_0x7ea6('0x13')],{'host':'localhost','port':0x18eb});var socket=require(_0x7ea6('0x14'))(new Redis(config[_0x7ea6('0x13')]));require(_0x7ea6('0x15'))[_0x7ea6('0x16')](socket);function respondWithStatusCode(_0xb84438,_0x22c980){_0x22c980=_0x22c980||0xcc;return function(_0x2351ec){if(_0x2351ec){return _0xb84438[_0x7ea6('0x17')](_0x22c980);}return _0xb84438[_0x7ea6('0x18')](_0x22c980)[_0x7ea6('0x19')]();};}function respondWithResult(_0xe18989,_0x151c45){_0x151c45=_0x151c45||0xc8;return function(_0x268aac){if(_0x268aac){return _0xe18989[_0x7ea6('0x18')](_0x151c45)['json'](_0x268aac);}};}function respondWithFilteredResult(_0x24d4ad,_0x4c00e2){return function(_0x41267c){if(_0x41267c){var _0x5a309a=typeof _0x4c00e2[_0x7ea6('0x1a')]===_0x7ea6('0x1b')&&typeof _0x4c00e2[_0x7ea6('0x1c')]===_0x7ea6('0x1b');var _0x21c02d=_0x41267c['count'];var _0x1a10f0=_0x5a309a?0x0:_0x4c00e2['offset'];var _0xdeed7c=_0x5a309a?_0x41267c['count']:_0x4c00e2[_0x7ea6('0x1a')]+_0x4c00e2[_0x7ea6('0x1c')];var _0x1e11b1;if(_0xdeed7c>=_0x21c02d){_0xdeed7c=_0x21c02d;_0x1e11b1=0xc8;}else{_0x1e11b1=0xce;}_0x24d4ad['status'](_0x1e11b1);return _0x24d4ad[_0x7ea6('0x1d')](_0x7ea6('0x1e'),_0x1a10f0+'-'+_0xdeed7c+'/'+_0x21c02d)[_0x7ea6('0x1f')](_0x41267c);}return null;};}function patchUpdates(_0x360e8a){return function(_0x472f03){try{jsonpatch[_0x7ea6('0x20')](_0x472f03,_0x360e8a,!![]);}catch(_0xa71686){return BPromise['reject'](_0xa71686);}return _0x472f03[_0x7ea6('0x21')]();};}function saveUpdates(_0x4798ef,_0x23f230){return function(_0x4287c4){if(_0x4287c4){return _0x4287c4[_0x7ea6('0x22')](_0x4798ef)[_0x7ea6('0x23')](function(_0xbb1081){return _0xbb1081;});}return null;};}function removeEntity(_0x4b7e12,_0x154efa){return function(_0x12b2e2){if(_0x12b2e2){return _0x12b2e2[_0x7ea6('0x24')]()[_0x7ea6('0x23')](function(){_0x4b7e12[_0x7ea6('0x18')](0xcc)[_0x7ea6('0x19')]();});}};}function handleEntityNotFound(_0x49d845,_0x29c326){return function(_0x393f9b){if(!_0x393f9b){_0x49d845[_0x7ea6('0x17')](0x194);}return _0x393f9b;};}function handleError(_0x4bd894,_0x38f736){_0x38f736=_0x38f736||0x1f4;return function(_0x2788af){logger['error'](_0x2788af['stack']);if(_0x2788af[_0x7ea6('0x25')]){delete _0x2788af[_0x7ea6('0x25')];}_0x4bd894[_0x7ea6('0x18')](_0x38f736)[_0x7ea6('0x26')](_0x2788af);};}exports['sendUserNotification']=function(_0x1d4fb3,_0x48841d,_0x4c5dfa){if(!_0x1d4fb3['body'][_0x7ea6('0x27')](_0x7ea6('0x28'))&&!_0x1d4fb3[_0x7ea6('0x29')][_0x7ea6('0x27')](_0x7ea6('0x2a'))){throw new db['Sequelize'][(_0x7ea6('0x2b'))]('Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27');}else{if(_0x1d4fb3[_0x7ea6('0x29')][_0x7ea6('0x27')](_0x7ea6('0x2a'))&&!_0x1d4fb3['body'][_0x7ea6('0x27')](_0x7ea6('0x2c'))){throw new db['Sequelize']['ValidationError'](_0x7ea6('0x2d'));}if(!_0x1d4fb3[_0x7ea6('0x29')][_0x7ea6('0x27')]('recipients')){throw new db[(_0x7ea6('0x2e'))][(_0x7ea6('0x2b'))](_0x7ea6('0x2f'));}else{try{var _0x55e44f=JSON[_0x7ea6('0x30')](_0x1d4fb3[_0x7ea6('0x29')][_0x7ea6('0x31')]);}catch(_0x249b73){logger[_0x7ea6('0x32')](_0x249b73);throw new db[(_0x7ea6('0x2e'))]['ValidationError'](_0x7ea6('0x33'));}var _0xe9b0e4=['chatqueue',_0x7ea6('0x34'),_0x7ea6('0x35'),'openchannelqueue','smsqueue',_0x7ea6('0x36'),_0x7ea6('0x37'),_0x7ea6('0x38'),'user'];if(_[_0x7ea6('0x39')](_0x55e44f,function(_0x3df9b7){return!_[_0x7ea6('0x3a')](_0xe9b0e4,_0x3df9b7[_0x7ea6('0x3b')][_0x7ea6('0x3c')]());})){throw new db['Sequelize'][(_0x7ea6('0x2b'))]('Invalid\x20model\x20in\x20\x27recipients\x27\x20object');}}}var _0x385bc9={};_0x385bc9[_0x7ea6('0x3d')]=_0x1d4fb3[_0x7ea6('0x29')][_0x7ea6('0x27')]('senderName')?_0x1d4fb3[_0x7ea6('0x29')][_0x7ea6('0x3d')]:_0x1d4fb3[_0x7ea6('0x3e')]['fullname'];_0x385bc9[_0x7ea6('0x3f')]=_['isEmpty'](_0x1d4fb3['body'][_0x7ea6('0x3f')])?null:_0x1d4fb3[_0x7ea6('0x29')][_0x7ea6('0x3f')];_0x385bc9['beep']=_0x1d4fb3['body'][_0x7ea6('0x40')]||![];_0x385bc9['SenderId']=_0x1d4fb3['user']['id'];return getContent(_0x1d4fb3['body'])[_0x7ea6('0x23')](function(_0x360f80){_0x385bc9[_0x7ea6('0x29')]=_0x360f80;return getRecipients(_0x55e44f);})['then'](function(_0x2f1555){_0x385bc9[_0x7ea6('0x41')]=_[_0x7ea6('0x42')](_0x2f1555)[_0x7ea6('0x43')](',');return db['sequelize']['transaction'](function(_0x26729a){return db[_0x7ea6('0x44')][_0x7ea6('0x45')](_0x385bc9,{'raw':!![],'transaction':_0x26729a})[_0x7ea6('0x23')](function(_0x217ed9){var _0x31142c={'sender':_0x385bc9['senderName'],'description':_0x385bc9[_0x7ea6('0x3f')],'content':_0x385bc9[_0x7ea6('0x29')],'beep':_0x385bc9['beep']};_0x2f1555[_0x7ea6('0x46')](function(_0x4f3da3){_0x31142c['recipient']=_0x4f3da3;socket['emit'](_0x7ea6('0x47'),_0x31142c);});return _0x217ed9;});});})[_0x7ea6('0x23')](respondWithResult(_0x48841d,0xc9))[_0x7ea6('0x48')](handleError(_0x48841d,null));};function getContent(_0x49944d){return new BPromise(function(_0x226fbe,_0x12ca29){if(_0x49944d[_0x7ea6('0x28')]){_0x226fbe(_0x49944d[_0x7ea6('0x28')]);return;}return db['Template'][_0x7ea6('0x49')]({'attributes':[_0x7ea6('0x4a')],'where':{'id':_0x49944d['TemplateId']},'raw':!![]})['then'](function(_0x334481){if(!_0x334481)throw new db['Sequelize'][(_0x7ea6('0x2b'))](_0x7ea6('0x4b'));var _0x3238e5=Mustache[_0x7ea6('0x4c')](_0x334481[_0x7ea6('0x4a')],_0x49944d['view']);_0x226fbe(_0x3238e5);})[_0x7ea6('0x48')](function(_0x3ac36a){_0x12ca29(_0x3ac36a);});});}function getRecipients(_0x373e8e){return new BPromise(function(_0x584fd5,_0x2dbccf){var _0x5bafe5=[];var _0x47daea=[];_0x373e8e['forEach'](function(_0x44cc5f){var _0xd6d775=_[_0x7ea6('0x4d')](_0x44cc5f['model']['toLowerCase']());if(_0xd6d775===_0x7ea6('0x4e')){_0x5bafe5=_['union'](_0x5bafe5,_0x44cc5f[_0x7ea6('0x4f')]);}else{if(_[_0x7ea6('0x3a')](_0xd6d775,_0x7ea6('0x50')))_0xd6d775=_0xd6d775['replace'](_0x7ea6('0x50'),_0x7ea6('0x51'));_0x44cc5f[_0x7ea6('0x4f')][_0x7ea6('0x46')](function(_0x284a55){_0x47daea[_0x7ea6('0x52')](getAgents(_0xd6d775,_0x284a55));});}});return BPromise[_0x7ea6('0x53')](_0x47daea)[_0x7ea6('0x23')](function(_0x2559b4){_0x5bafe5=_['union'](_0x5bafe5,_[_0x7ea6('0x54')](_0x2559b4));_0x584fd5(_0x5bafe5);})[_0x7ea6('0x48')](function(_0xabebb){_0x2dbccf(_0xabebb);});});}function getAgents(_0x3f925a,_0x3d7e99){return new BPromise(function(_0x4913b5,_0xb9ca40){return db[_0x3f925a][_0x7ea6('0x49')]({'where':{'id':_0x3d7e99}})[_0x7ea6('0x23')](function(_0x2ff598){return _0x2ff598[_0x7ea6('0x55')]({'attributes':['id'],'raw':!![]})[_0x7ea6('0x23')](function(_0x56ded7){var _0x1f47a4=_[_0x7ea6('0x56')](_0x56ded7,'id');_0x4913b5(_0x1f47a4);});})[_0x7ea6('0x48')](function(_0x20912d){_0xb9ca40(_0x20912d);});});} \ No newline at end of file +var _0x677f=['../../config/logger','../../config/utils','../../config/environment','defaults','redis','localhost','sendStatus','status','json','undefined','limit','count','offset','Content-Range','apply','reject','update','then','destroy','end','stack','name','send','body','hasOwnProperty','text','TemplateId','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','ValidationError','Missing\x20\x27view\x27\x20parameter','recipients','Sequelize','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','mailqueue','openchannelqueue','smsqueue','whatsappqueue','some','includes','model','toLowerCase','recipientsDescription','isEmpty','beep','user','recipientsId','sortBy','sequelize','UserNotification','senderName','forEach','recipient','emit','userNotification:send','catch','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','startCase','User','union','queue','replace','Queue','all','flatten','map','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x38481f,_0x2d6100){var _0x84a82=function(_0x57648d){while(--_0x57648d){_0x38481f['push'](_0x38481f['shift']());}};_0x84a82(++_0x2d6100);}(_0x677f,0xf9));var _0xf677=function(_0x20cf1b,_0x3f1740){_0x20cf1b=_0x20cf1b-0x0;var _0x57e0af=_0x677f[_0x20cf1b];return _0x57e0af;};'use strict';var emlformat=require(_0xf677('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf677('0x1'));var jsonpatch=require(_0xf677('0x2'));var rp=require('request-promise');var moment=require(_0xf677('0x3'));var BPromise=require(_0xf677('0x4'));var Mustache=require(_0xf677('0x5'));var util=require('util');var path=require(_0xf677('0x6'));var sox=require('sox');var csv=require(_0xf677('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf677('0x8'));var _=require('lodash');var squel=require(_0xf677('0x9'));var crypto=require(_0xf677('0xa'));var jsforce=require(_0xf677('0xb'));var deskjs=require(_0xf677('0xc'));var toCsv=require(_0xf677('0x7'));var querystring=require(_0xf677('0xd'));var Papa=require(_0xf677('0xe'));var Redis=require(_0xf677('0xf'));var authService=require(_0xf677('0x10'));var qs=require(_0xf677('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xf677('0x12'))('api');var utils=require(_0xf677('0x13'));var config=require(_0xf677('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0xf677('0x15')](config[_0xf677('0x16')],{'host':_0xf677('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf677('0x16')]));require('./userNotification.socket')['register'](socket);function respondWithStatusCode(_0x55bd43,_0x5c32a0){_0x5c32a0=_0x5c32a0||0xcc;return function(_0x599b2d){if(_0x599b2d){return _0x55bd43[_0xf677('0x18')](_0x5c32a0);}return _0x55bd43['status'](_0x5c32a0)['end']();};}function respondWithResult(_0x434474,_0x41b769){_0x41b769=_0x41b769||0xc8;return function(_0x4065b7){if(_0x4065b7){return _0x434474[_0xf677('0x19')](_0x41b769)[_0xf677('0x1a')](_0x4065b7);}};}function respondWithFilteredResult(_0x18cf2a,_0x3d51ea){return function(_0x31e72b){if(_0x31e72b){var _0x19180b=typeof _0x3d51ea['offset']===_0xf677('0x1b')&&typeof _0x3d51ea[_0xf677('0x1c')]===_0xf677('0x1b');var _0x531fba=_0x31e72b[_0xf677('0x1d')];var _0x1e32cc=_0x19180b?0x0:_0x3d51ea['offset'];var _0x15c7ef=_0x19180b?_0x31e72b['count']:_0x3d51ea[_0xf677('0x1e')]+_0x3d51ea['limit'];var _0x53603d;if(_0x15c7ef>=_0x531fba){_0x15c7ef=_0x531fba;_0x53603d=0xc8;}else{_0x53603d=0xce;}_0x18cf2a[_0xf677('0x19')](_0x53603d);return _0x18cf2a['set'](_0xf677('0x1f'),_0x1e32cc+'-'+_0x15c7ef+'/'+_0x531fba)[_0xf677('0x1a')](_0x31e72b);}return null;};}function patchUpdates(_0x6d8410){return function(_0x5d7a05){try{jsonpatch[_0xf677('0x20')](_0x5d7a05,_0x6d8410,!![]);}catch(_0x15530b){return BPromise[_0xf677('0x21')](_0x15530b);}return _0x5d7a05['save']();};}function saveUpdates(_0x35294b,_0x4da846){return function(_0x334b53){if(_0x334b53){return _0x334b53[_0xf677('0x22')](_0x35294b)[_0xf677('0x23')](function(_0x5463f5){return _0x5463f5;});}return null;};}function removeEntity(_0x2a634f,_0x100fbc){return function(_0x1ee4e7){if(_0x1ee4e7){return _0x1ee4e7[_0xf677('0x24')]()[_0xf677('0x23')](function(){_0x2a634f[_0xf677('0x19')](0xcc)[_0xf677('0x25')]();});}};}function handleEntityNotFound(_0x76eda8,_0x4ae5ef){return function(_0x5a1456){if(!_0x5a1456){_0x76eda8[_0xf677('0x18')](0x194);}return _0x5a1456;};}function handleError(_0x443aee,_0x22e5e3){_0x22e5e3=_0x22e5e3||0x1f4;return function(_0x5758d4){logger['error'](_0x5758d4[_0xf677('0x26')]);if(_0x5758d4['name']){delete _0x5758d4[_0xf677('0x27')];}_0x443aee['status'](_0x22e5e3)[_0xf677('0x28')](_0x5758d4);};}exports['sendUserNotification']=function(_0x44afaf,_0x5c17dd,_0x3c0695){if(!_0x44afaf[_0xf677('0x29')][_0xf677('0x2a')](_0xf677('0x2b'))&&!_0x44afaf['body']['hasOwnProperty'](_0xf677('0x2c'))){throw new db['Sequelize']['ValidationError'](_0xf677('0x2d'));}else{if(_0x44afaf['body']['hasOwnProperty'](_0xf677('0x2c'))&&!_0x44afaf[_0xf677('0x29')][_0xf677('0x2a')](_0xf677('0x2e'))){throw new db['Sequelize'][(_0xf677('0x2f'))](_0xf677('0x30'));}if(!_0x44afaf[_0xf677('0x29')][_0xf677('0x2a')](_0xf677('0x31'))){throw new db[(_0xf677('0x32'))][(_0xf677('0x2f'))](_0xf677('0x33'));}else{try{var _0x40a1a1=JSON[_0xf677('0x34')](_0x44afaf[_0xf677('0x29')]['recipients']);}catch(_0x5b3213){logger['error'](_0x5b3213);throw new db[(_0xf677('0x32'))][(_0xf677('0x2f'))](_0xf677('0x35'));}var _0x2480d5=['chatqueue','faxqueue',_0xf677('0x36'),_0xf677('0x37'),_0xf677('0x38'),'voicequeue',_0xf677('0x39'),'team','user'];if(_[_0xf677('0x3a')](_0x40a1a1,function(_0x15743e){return!_[_0xf677('0x3b')](_0x2480d5,_0x15743e[_0xf677('0x3c')][_0xf677('0x3d')]());})){throw new db[(_0xf677('0x32'))][(_0xf677('0x2f'))]('Invalid\x20model\x20in\x20\x27recipients\x27\x20object');}}}var _0x5d4270={};_0x5d4270['senderName']=_0x44afaf['body'][_0xf677('0x2a')]('senderName')?_0x44afaf['body']['senderName']:_0x44afaf['user']['fullname'];_0x5d4270[_0xf677('0x3e')]=_[_0xf677('0x3f')](_0x44afaf[_0xf677('0x29')]['recipientsDescription'])?null:_0x44afaf['body'][_0xf677('0x3e')];_0x5d4270[_0xf677('0x40')]=_0x44afaf[_0xf677('0x29')][_0xf677('0x40')]||![];_0x5d4270['SenderId']=_0x44afaf[_0xf677('0x41')]['id'];return getContent(_0x44afaf[_0xf677('0x29')])['then'](function(_0x219988){_0x5d4270[_0xf677('0x29')]=_0x219988;return getRecipients(_0x40a1a1);})[_0xf677('0x23')](function(_0x5afef7){_0x5d4270[_0xf677('0x42')]=_[_0xf677('0x43')](_0x5afef7)['join'](',');return db[_0xf677('0x44')]['transaction'](function(_0x124f33){return db[_0xf677('0x45')]['create'](_0x5d4270,{'raw':!![],'transaction':_0x124f33})[_0xf677('0x23')](function(_0xca0bb2){var _0xc381ff={'sender':_0x5d4270[_0xf677('0x46')],'description':_0x5d4270['recipientsDescription'],'content':_0x5d4270[_0xf677('0x29')],'beep':_0x5d4270[_0xf677('0x40')]};_0x5afef7[_0xf677('0x47')](function(_0x47aee0){_0xc381ff[_0xf677('0x48')]=_0x47aee0;socket[_0xf677('0x49')](_0xf677('0x4a'),_0xc381ff);});return _0xca0bb2;});});})[_0xf677('0x23')](respondWithResult(_0x5c17dd,0xc9))[_0xf677('0x4b')](handleError(_0x5c17dd,null));};function getContent(_0x414a72){return new BPromise(function(_0x38e17f,_0x12ab13){if(_0x414a72[_0xf677('0x2b')]){_0x38e17f(_0x414a72[_0xf677('0x2b')]);return;}return db['Template'][_0xf677('0x4c')]({'attributes':[_0xf677('0x4d')],'where':{'id':_0x414a72[_0xf677('0x2c')]},'raw':!![]})[_0xf677('0x23')](function(_0x89965){if(!_0x89965)throw new db[(_0xf677('0x32'))][(_0xf677('0x2f'))](_0xf677('0x4e'));var _0x5d3e9c=Mustache[_0xf677('0x4f')](_0x89965[_0xf677('0x4d')],_0x414a72[_0xf677('0x2e')]);_0x38e17f(_0x5d3e9c);})[_0xf677('0x4b')](function(_0x1ba485){_0x12ab13(_0x1ba485);});});}function getRecipients(_0x201111){return new BPromise(function(_0x4a161e,_0x2295f5){var _0x3d7f78=[];var _0x48e018=[];_0x201111[_0xf677('0x47')](function(_0x154508){var _0x484721=_[_0xf677('0x50')](_0x154508['model']['toLowerCase']());if(_0x484721===_0xf677('0x51')){_0x3d7f78=_[_0xf677('0x52')](_0x3d7f78,_0x154508['ids']);}else{if(_['includes'](_0x484721,_0xf677('0x53')))_0x484721=_0x484721[_0xf677('0x54')]('queue',_0xf677('0x55'));_0x154508['ids'][_0xf677('0x47')](function(_0x2cf780){_0x48e018['push'](getAgents(_0x484721,_0x2cf780));});}});return BPromise[_0xf677('0x56')](_0x48e018)[_0xf677('0x23')](function(_0x23e722){_0x3d7f78=_['union'](_0x3d7f78,_[_0xf677('0x57')](_0x23e722));_0x4a161e(_0x3d7f78);})['catch'](function(_0x3dca9d){_0x2295f5(_0x3dca9d);});});}function getAgents(_0x5660cc,_0x369beb){return new BPromise(function(_0x4820cb,_0x45b47d){return db[_0x5660cc]['findOne']({'where':{'id':_0x369beb}})[_0xf677('0x23')](function(_0x187985){return _0x187985['getAgents']({'attributes':['id'],'raw':!![]})[_0xf677('0x23')](function(_0x1acbce){var _0x2bf60d=_[_0xf677('0x58')](_0x1acbce,'id');_0x4820cb(_0x2bf60d);});})['catch'](function(_0x2be47b){_0x45b47d(_0x2be47b);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 3775035..919fa3b 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 _0x740b=['emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save','remove'];(function(_0x2ca403,_0x5d8d9f){var _0x578940=function(_0x2b756c){while(--_0x2b756c){_0x2ca403['push'](_0x2ca403['shift']());}};_0x578940(++_0x5d8d9f);}(_0x740b,0xc4));var _0xb740=function(_0x3d6a87,_0x4cd23c){_0x3d6a87=_0x3d6a87-0x0;var _0x1e37fc=_0x740b[_0x3d6a87];return _0x1e37fc;};'use strict';var EventEmitter=require('events');var UserNotification=require(_0xb740('0x0'))['db']['UserNotification'];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0xb740('0x1')](0x0);var events={'afterCreate':_0xb740('0x2'),'afterUpdate':'update','afterDestroy':_0xb740('0x3')};function emitEvent(_0x50f40b){return function(_0x5ca3e5,_0x306c14,_0x3bb39e){UserNotificationEvents[_0xb740('0x4')](_0x50f40b+':'+_0x5ca3e5['id'],_0x5ca3e5);UserNotificationEvents[_0xb740('0x4')](_0x50f40b,_0x5ca3e5);_0x3bb39e(null);};}for(var e in events){if(events[_0xb740('0x5')](e)){var event=events[e];UserNotification[_0xb740('0x6')](e,emitEvent(event));}}module[_0xb740('0x7')]=UserNotificationEvents; \ No newline at end of file +var _0xaf1c=['save','update','remove','emit','hasOwnProperty','hook','exports','events','UserNotification','setMaxListeners'];(function(_0x51c819,_0xd812db){var _0x15c5d2=function(_0x2977f0){while(--_0x2977f0){_0x51c819['push'](_0x51c819['shift']());}};_0x15c5d2(++_0xd812db);}(_0xaf1c,0x1d3));var _0xcaf1=function(_0x56fde8,_0x4abff6){_0x56fde8=_0x56fde8-0x0;var _0x5c7289=_0xaf1c[_0x56fde8];return _0x5c7289;};'use strict';var EventEmitter=require(_0xcaf1('0x0'));var UserNotification=require('../../mysqldb')['db'][_0xcaf1('0x1')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0xcaf1('0x2')](0x0);var events={'afterCreate':_0xcaf1('0x3'),'afterUpdate':_0xcaf1('0x4'),'afterDestroy':_0xcaf1('0x5')};function emitEvent(_0x42ce0c){return function(_0xdd6922,_0x19a5bd,_0x340051){UserNotificationEvents[_0xcaf1('0x6')](_0x42ce0c+':'+_0xdd6922['id'],_0xdd6922);UserNotificationEvents[_0xcaf1('0x6')](_0x42ce0c,_0xdd6922);_0x340051(null);};}for(var e in events){if(events[_0xcaf1('0x7')](e)){var event=events[e];UserNotification[_0xcaf1('0x8')](e,emitEvent(event));}}module[_0xcaf1('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 c9db4de..af4ce8e 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 _0x95de=['utf8mb4','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x3862c4,_0x4de9da){var _0x14d461=function(_0x1ec200){while(--_0x1ec200){_0x3862c4['push'](_0x3862c4['shift']());}};_0x14d461(++_0x4de9da);}(_0x95de,0xd9));var _0xe95d=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x95de[_0x126558];return _0x1f6d14;};'use strict';var _=require(_0xe95d('0x0'));var util=require(_0xe95d('0x1'));var logger=require('../../config/logger')(_0xe95d('0x2'));var moment=require(_0xe95d('0x3'));var BPromise=require(_0xe95d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe95d('0x5'));var rimraf=require(_0xe95d('0x6'));var config=require(_0xe95d('0x7'));var attributes=require('./userNotification.attributes');module['exports']=function(_0x21d67f,_0x355478){return _0x21d67f['define']('UserNotification',attributes,{'tableName':'userNotifications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe95d('0x8'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x5f52=['util','../../config/logger','request-promise','exports','define','userNotifications','utf8mb4_unicode_ci'];(function(_0x257f59,_0x4e0dd5){var _0x4dd3b6=function(_0x31f66b){while(--_0x31f66b){_0x257f59['push'](_0x257f59['shift']());}};_0x4dd3b6(++_0x4e0dd5);}(_0x5f52,0x10a));var _0x25f5=function(_0x56b138,_0x2396d6){_0x56b138=_0x56b138-0x0;var _0x3df878=_0x5f52[_0x56b138];return _0x3df878;};'use strict';var _=require('lodash');var util=require(_0x25f5('0x0'));var logger=require(_0x25f5('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x25f5('0x2'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./userNotification.attributes');module[_0x25f5('0x3')]=function(_0x462e71,_0x3ae3c7){return _0x462e71[_0x25f5('0x4')]('UserNotification',attributes,{'tableName':_0x25f5('0x5'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x25f5('0x6')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index 5bbee3d..4b4778f 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 _0xf4b5=['UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','redis','socket.io-emitter','./userNotification.socket','register','then','info','UserNotification,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0xf4b5,0x14b));var _0x5f4b=function(_0x59d073,_0x55b8fc){_0x59d073=_0x59d073-0x0;var _0x46d3df=_0xf4b5[_0x59d073];return _0x46d3df;};'use strict';var _=require(_0x5f4b('0x0'));var util=require('util');var moment=require(_0x5f4b('0x1'));var BPromise=require(_0x5f4b('0x2'));var rs=require(_0x5f4b('0x3'));var fs=require('fs');var Redis=require(_0x5f4b('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5f4b('0x5'))(_0x5f4b('0x6'));var config=require(_0x5f4b('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5f4b('0x8')][_0x5f4b('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0x5f4b('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x5f4b('0xb'))(new Redis(config[_0x5f4b('0xa')]));require(_0x5f4b('0xc'))[_0x5f4b('0xd')](socket);function respondWithRpcPromise(_0x2903f9,_0x3ce4f8,_0x40afe5){return new BPromise(function(_0x161b7a,_0x54f7b3){return client['request'](_0x2903f9,_0x40afe5)[_0x5f4b('0xe')](function(_0x452ce9){logger[_0x5f4b('0xf')](_0x5f4b('0x10'),_0x3ce4f8,_0x5f4b('0x11'));logger[_0x5f4b('0x12')](_0x5f4b('0x13'),_0x3ce4f8,_0x5f4b('0x11'),JSON[_0x5f4b('0x14')](_0x452ce9));if(_0x452ce9[_0x5f4b('0x15')]){if(_0x452ce9[_0x5f4b('0x15')][_0x5f4b('0x16')]===0x1f4){logger[_0x5f4b('0x15')](_0x5f4b('0x10'),_0x3ce4f8,_0x452ce9['error']['message']);return _0x54f7b3(_0x452ce9[_0x5f4b('0x15')]['message']);}logger[_0x5f4b('0x15')](_0x5f4b('0x10'),_0x3ce4f8,_0x452ce9['error']['message']);return _0x161b7a(_0x452ce9[_0x5f4b('0x15')][_0x5f4b('0x17')]);}else{logger[_0x5f4b('0xf')](_0x5f4b('0x10'),_0x3ce4f8,_0x5f4b('0x11'));_0x161b7a(_0x452ce9['result'][_0x5f4b('0x17')]);}})[_0x5f4b('0x18')](function(_0x605949){logger['error'](_0x5f4b('0x10'),_0x3ce4f8,_0x605949);_0x54f7b3(_0x605949);});});} \ No newline at end of file +var _0xe170=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','register','request','then','info','UserNotification,\x20%s,\x20%s','debug','UserNotification,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','lodash'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe170,0x86));var _0x0e17=function(_0x58284c,_0x52bfa7){_0x58284c=_0x58284c-0x0;var _0x4fc8bb=_0xe170[_0x58284c];return _0x4fc8bb;};'use strict';var _=require(_0x0e17('0x0'));var util=require('util');var moment=require(_0x0e17('0x1'));var BPromise=require(_0x0e17('0x2'));var rs=require(_0x0e17('0x3'));var fs=require('fs');var Redis=require(_0x0e17('0x4'));var db=require(_0x0e17('0x5'))['db'];var utils=require(_0x0e17('0x6'));var logger=require(_0x0e17('0x7'))(_0x0e17('0x8'));var config=require('../../config/environment');var jayson=require(_0x0e17('0x9'));var client=jayson[_0x0e17('0xa')][_0x0e17('0xb')]({'port':0x232a});config[_0x0e17('0xc')]=_[_0x0e17('0xd')](config[_0x0e17('0xc')],{'host':_0x0e17('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0e17('0xc')]));require('./userNotification.socket')[_0x0e17('0xf')](socket);function respondWithRpcPromise(_0x35ad70,_0x4385ea,_0x407935){return new BPromise(function(_0xbc3eb,_0x523686){return client[_0x0e17('0x10')](_0x35ad70,_0x407935)[_0x0e17('0x11')](function(_0x28a19f){logger[_0x0e17('0x12')](_0x0e17('0x13'),_0x4385ea,'request\x20sent');logger[_0x0e17('0x14')](_0x0e17('0x15'),_0x4385ea,_0x0e17('0x16'),JSON[_0x0e17('0x17')](_0x28a19f));if(_0x28a19f[_0x0e17('0x18')]){if(_0x28a19f[_0x0e17('0x18')]['code']===0x1f4){logger['error'](_0x0e17('0x13'),_0x4385ea,_0x28a19f[_0x0e17('0x18')][_0x0e17('0x19')]);return _0x523686(_0x28a19f[_0x0e17('0x18')]['message']);}logger[_0x0e17('0x18')]('UserNotification,\x20%s,\x20%s',_0x4385ea,_0x28a19f[_0x0e17('0x18')][_0x0e17('0x19')]);return _0xbc3eb(_0x28a19f[_0x0e17('0x18')][_0x0e17('0x19')]);}else{logger[_0x0e17('0x12')](_0x0e17('0x13'),_0x4385ea,_0x0e17('0x16'));_0xbc3eb(_0x28a19f[_0x0e17('0x1a')][_0x0e17('0x19')]);}})['catch'](function(_0x2a8b15){logger[_0x0e17('0x18')](_0x0e17('0x13'),_0x4385ea,_0x2a8b15);_0x523686(_0x2a8b15);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 4007258..8427a81 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 _0xbcb4=['update','register','length','userNotification:','./userNotification.events','save','remove'];(function(_0xb9924a,_0x2b5bb5){var _0x42deac=function(_0x1cdcf4){while(--_0x1cdcf4){_0xb9924a['push'](_0xb9924a['shift']());}};_0x42deac(++_0x2b5bb5);}(_0xbcb4,0x185));var _0x4bcb=function(_0xc3f6bf,_0x543611){_0xc3f6bf=_0xc3f6bf-0x0;var _0x3a615a=_0xbcb4[_0xc3f6bf];return _0x3a615a;};'use strict';var UserNotificationEvents=require(_0x4bcb('0x0'));var events=[_0x4bcb('0x1'),_0x4bcb('0x2'),_0x4bcb('0x3')];function createListener(_0x117be1,_0x4d2ac3){return function(_0x19f54d){_0x4d2ac3['emit'](_0x117be1,_0x19f54d);};}function removeListener(_0x207058,_0x3bd447){return function(){UserNotificationEvents['removeListener'](_0x207058,_0x3bd447);};}exports[_0x4bcb('0x4')]=function(_0xd13283){for(var _0x823015=0x0,_0x573146=events[_0x4bcb('0x5')];_0x823015<_0x573146;_0x823015++){var _0x528f40=events[_0x823015];var _0x1d5b2b=createListener(_0x4bcb('0x6')+_0x528f40,_0xd13283);UserNotificationEvents['on'](_0x528f40,_0x1d5b2b);}}; \ No newline at end of file +var _0x5aaa=['emit','removeListener','length','./userNotification.events','save','remove','update'];(function(_0x6182ff,_0x59d492){var _0x1cec22=function(_0x2e96f8){while(--_0x2e96f8){_0x6182ff['push'](_0x6182ff['shift']());}};_0x1cec22(++_0x59d492);}(_0x5aaa,0x18b));var _0xa5aa=function(_0xe603c1,_0x2e5c99){_0xe603c1=_0xe603c1-0x0;var _0x2fb5e3=_0x5aaa[_0xe603c1];return _0x2fb5e3;};'use strict';var UserNotificationEvents=require(_0xa5aa('0x0'));var events=[_0xa5aa('0x1'),_0xa5aa('0x2'),_0xa5aa('0x3')];function createListener(_0x1e2be7,_0x44b41a){return function(_0x38ff28){_0x44b41a[_0xa5aa('0x4')](_0x1e2be7,_0x38ff28);};}function removeListener(_0xf59fc6,_0x4beda8){return function(){UserNotificationEvents[_0xa5aa('0x5')](_0xf59fc6,_0x4beda8);};}exports['register']=function(_0x59ff2e){for(var _0x44ab7a=0x0,_0xc24a41=events[_0xa5aa('0x6')];_0x44ab7a<_0xc24a41;_0x44ab7a++){var _0x422174=events[_0x44ab7a];var _0x1dc5ee=createListener('userNotification:'+_0x422174,_0x59ff2e);UserNotificationEvents['on'](_0x422174,_0x1dc5ee);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 1c3ba6b..6c53623 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(_0x371040,_0x11ead3){var _0x2d6194=function(_0x3f5136){while(--_0x3f5136){_0x371040['push'](_0x371040['shift']());}};_0x2d6194(++_0x11ead3);}(_0xe706,0xa3));var _0x6e70=function(_0x533bcc,_0x1ba26f){_0x533bcc=_0x533bcc-0x0;var _0x364d38=_0xe706[_0x533bcc];return _0x364d38;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0xf19f09,_0x1fe7cc){var _0x4e16e6=function(_0x43f1ad){while(--_0x43f1ad){_0xf19f09['push'](_0xf19f09['shift']());}};_0x4e16e6(++_0x1fe7cc);}(_0xe706,0xa3));var _0x6e70=function(_0x447af3,_0x381c44){_0x447af3=_0x447af3-0x0;var _0x202e95=_0xe706[_0x447af3];return _0x202e95;};'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 1b91ca2..6c92701 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 _0x6a35=['INTEGER','sequelize','exports'];(function(_0x412c8f,_0x11ec94){var _0x27c005=function(_0x127059){while(--_0x127059){_0x412c8f['push'](_0x412c8f['shift']());}};_0x27c005(++_0x11ec94);}(_0x6a35,0xeb));var _0x56a3=function(_0x40a825,_0x3bac79){_0x40a825=_0x40a825-0x0;var _0x273a54=_0x6a35[_0x40a825];return _0x273a54;};'use strict';var Sequelize=require(_0x56a3('0x0'));module[_0x56a3('0x1')]={'penalty':{'type':Sequelize[_0x56a3('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x897c=['INTEGER','sequelize'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0x897c,0x197));var _0xc897=function(_0x269d06,_0x371fa5){_0x269d06=_0x269d06-0x0;var _0x49dbc8=_0x897c[_0x269d06];return _0x49dbc8;};'use strict';var Sequelize=require(_0xc897('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xc897('0x1')],'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 6bd8e88..ca5fba6 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 _0x43bd=['user_has_openchannel_queues','util','request-promise','path','rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','UserOpenchannelQueue'];(function(_0x5bd4fc,_0x4fbd8c){var _0x14b56e=function(_0x361e5c){while(--_0x361e5c){_0x5bd4fc['push'](_0x5bd4fc['shift']());}};_0x14b56e(++_0x4fbd8c);}(_0x43bd,0x10f));var _0xd43b=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x43bd[_0x17d9e3];return _0x14192d;};'use strict';var _=require('lodash');var util=require(_0xd43b('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd43b('0x1'));var fs=require('fs');var path=require(_0xd43b('0x2'));var rimraf=require(_0xd43b('0x3'));var config=require(_0xd43b('0x4'));var attributes=require(_0xd43b('0x5'));module[_0xd43b('0x6')]=function(_0x1e96f2,_0x4bb4f4){return _0x1e96f2['define'](_0xd43b('0x7'),attributes,{'tableName':_0xd43b('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x05d6=['bluebird','path','rimraf','../../config/environment','./userOpenchannelQueue.attributes','define','UserOpenchannelQueue','user_has_openchannel_queues','api','moment'];(function(_0x3358ba,_0x24c5fc){var _0x296e73=function(_0x843ff3){while(--_0x843ff3){_0x3358ba['push'](_0x3358ba['shift']());}};_0x296e73(++_0x24c5fc);}(_0x05d6,0x10c));var _0x605d=function(_0x3452fe,_0x412f2f){_0x3452fe=_0x3452fe-0x0;var _0x39cd3b=_0x05d6[_0x3452fe];return _0x39cd3b;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x605d('0x0'));var moment=require(_0x605d('0x1'));var BPromise=require(_0x605d('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x605d('0x3'));var rimraf=require(_0x605d('0x4'));var config=require(_0x605d('0x5'));var attributes=require(_0x605d('0x6'));module['exports']=function(_0x2cd23b,_0x523fc5){return _0x2cd23b[_0x605d('0x7')](_0x605d('0x8'),attributes,{'tableName':_0x605d('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 527914e..67be1f8 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 _0x8cc2=['rpc','jayson/promise','client','http','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x3c488f,_0x2ba807){var _0x132d22=function(_0x185e43){while(--_0x185e43){_0x3c488f['push'](_0x3c488f['shift']());}};_0x132d22(++_0x2ba807);}(_0x8cc2,0x1d8));var _0x28cc=function(_0x141115,_0x2e7dca){_0x141115=_0x141115-0x0;var _0x320ba9=_0x8cc2[_0x141115];return _0x320ba9;};'use strict';var _=require(_0x28cc('0x0'));var util=require(_0x28cc('0x1'));var moment=require(_0x28cc('0x2'));var BPromise=require(_0x28cc('0x3'));var rs=require(_0x28cc('0x4'));var fs=require('fs');var Redis=require(_0x28cc('0x5'));var db=require(_0x28cc('0x6'))['db'];var utils=require(_0x28cc('0x7'));var logger=require('../../config/logger')(_0x28cc('0x8'));var config=require('../../config/environment');var jayson=require(_0x28cc('0x9'));var client=jayson[_0x28cc('0xa')][_0x28cc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1ac662,_0x37cc6b,_0x157241){return new BPromise(function(_0x422a95,_0x4f3c7b){return client['request'](_0x1ac662,_0x157241)['then'](function(_0x30a971){logger['info'](_0x28cc('0xc'),_0x37cc6b,_0x28cc('0xd'));logger[_0x28cc('0xe')]('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x37cc6b,_0x28cc('0xd'),JSON[_0x28cc('0xf')](_0x30a971));if(_0x30a971[_0x28cc('0x10')]){if(_0x30a971[_0x28cc('0x10')][_0x28cc('0x11')]===0x1f4){logger[_0x28cc('0x10')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x37cc6b,_0x30a971[_0x28cc('0x10')][_0x28cc('0x12')]);return _0x4f3c7b(_0x30a971[_0x28cc('0x10')]['message']);}logger['error']('UserOpenchannelQueue,\x20%s,\x20%s',_0x37cc6b,_0x30a971['error'][_0x28cc('0x12')]);return _0x422a95(_0x30a971[_0x28cc('0x10')][_0x28cc('0x12')]);}else{logger[_0x28cc('0x13')](_0x28cc('0xc'),_0x37cc6b,_0x28cc('0xd'));_0x422a95(_0x30a971['result'][_0x28cc('0x12')]);}})['catch'](function(_0x32545f){logger['error'](_0x28cc('0xc'),_0x37cc6b,_0x32545f);_0x4f3c7b(_0x32545f);});});} \ No newline at end of file +var _0x8bb2=['catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x8bb2,0x1b6));var _0x28bb=function(_0x3ec333,_0x26bcbe){_0x3ec333=_0x3ec333-0x0;var _0x15ccb8=_0x8bb2[_0x3ec333];return _0x15ccb8;};'use strict';var _=require(_0x28bb('0x0'));var util=require(_0x28bb('0x1'));var moment=require(_0x28bb('0x2'));var BPromise=require('bluebird');var rs=require(_0x28bb('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x28bb('0x4'))['db'];var utils=require(_0x28bb('0x5'));var logger=require(_0x28bb('0x6'))(_0x28bb('0x7'));var config=require(_0x28bb('0x8'));var jayson=require(_0x28bb('0x9'));var client=jayson[_0x28bb('0xa')][_0x28bb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x23d66c,_0x5073ab,_0x250dbc){return new BPromise(function(_0x1d1847,_0x530188){return client[_0x28bb('0xc')](_0x23d66c,_0x250dbc)[_0x28bb('0xd')](function(_0x2bcab8){logger[_0x28bb('0xe')](_0x28bb('0xf'),_0x5073ab,_0x28bb('0x10'));logger[_0x28bb('0x11')]('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x5073ab,_0x28bb('0x10'),JSON['stringify'](_0x2bcab8));if(_0x2bcab8[_0x28bb('0x12')]){if(_0x2bcab8[_0x28bb('0x12')][_0x28bb('0x13')]===0x1f4){logger['error'](_0x28bb('0xf'),_0x5073ab,_0x2bcab8[_0x28bb('0x12')][_0x28bb('0x14')]);return _0x530188(_0x2bcab8[_0x28bb('0x12')]['message']);}logger['error'](_0x28bb('0xf'),_0x5073ab,_0x2bcab8[_0x28bb('0x12')]['message']);return _0x1d1847(_0x2bcab8[_0x28bb('0x12')][_0x28bb('0x14')]);}else{logger[_0x28bb('0xe')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x5073ab,_0x28bb('0x10'));_0x1d1847(_0x2bcab8[_0x28bb('0x15')][_0x28bb('0x14')]);}})[_0x28bb('0x16')](function(_0x380b64){logger[_0x28bb('0x12')](_0x28bb('0xf'),_0x5073ab,_0x380b64);_0x530188(_0x380b64);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 9499ebb..85f1667 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 _0x8d29=['update','destroy','delete','/:id/resources','removeResources','exports','express','../../components/auth/service','../../components/interaction/service','./userProfile.controller','get','isAuthenticated','/describe','getSections','getResources','post','create','/:id/clone','clone','/:id/sections','addSections','addResources','put','/:id'];(function(_0xa29c6d,_0x355c0f){var _0x477451=function(_0x8c3491){while(--_0x8c3491){_0xa29c6d['push'](_0xa29c6d['shift']());}};_0x477451(++_0x355c0f);}(_0x8d29,0x156));var _0x98d2=function(_0x301fc9,_0x445cb9){_0x301fc9=_0x301fc9-0x0;var _0x395b28=_0x8d29[_0x301fc9];return _0x395b28;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x98d2('0x0'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x98d2('0x1'));var interaction=require(_0x98d2('0x2'));var config=require('../../config/environment');var controller=require(_0x98d2('0x3'));router[_0x98d2('0x4')]('/',auth[_0x98d2('0x5')](),controller['index']);router[_0x98d2('0x4')](_0x98d2('0x6'),auth[_0x98d2('0x5')](),controller['describe']);router[_0x98d2('0x4')]('/:id',auth[_0x98d2('0x5')](),controller['show']);router[_0x98d2('0x4')]('/:id/sections',auth[_0x98d2('0x5')](),controller[_0x98d2('0x7')]);router[_0x98d2('0x4')]('/:id/resources',auth[_0x98d2('0x5')](),controller[_0x98d2('0x8')]);router[_0x98d2('0x9')]('/',auth[_0x98d2('0x5')](),controller[_0x98d2('0xa')]);router[_0x98d2('0x9')](_0x98d2('0xb'),auth['isAuthenticated'](),controller[_0x98d2('0xc')]);router[_0x98d2('0x9')](_0x98d2('0xd'),auth[_0x98d2('0x5')](),controller[_0x98d2('0xe')]);router['post']('/:id/resources',auth[_0x98d2('0x5')](),controller[_0x98d2('0xf')]);router[_0x98d2('0x10')](_0x98d2('0x11'),auth['isAuthenticated'](),controller[_0x98d2('0x12')]);router['delete'](_0x98d2('0x11'),auth['isAuthenticated'](),controller[_0x98d2('0x13')]);router[_0x98d2('0x14')](_0x98d2('0xd'),auth['isAuthenticated'](),controller['removeSections']);router['delete'](_0x98d2('0x15'),auth[_0x98d2('0x5')](),controller[_0x98d2('0x16')]);module[_0x98d2('0x17')]=router; \ No newline at end of file +var _0x5991=['exports','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./userProfile.controller','get','isAuthenticated','index','/describe','/:id','/:id/sections','getSections','getResources','create','/:id/clone','post','addSections','/:id/resources','addResources','put','update','delete','destroy','removeSections'];(function(_0x5e63c8,_0x9397cd){var _0x267759=function(_0x333de7){while(--_0x333de7){_0x5e63c8['push'](_0x5e63c8['shift']());}};_0x267759(++_0x9397cd);}(_0x5991,0x1d5));var _0x1599=function(_0x1798f5,_0x4010a4){_0x1798f5=_0x1798f5-0x0;var _0x189541=_0x5991[_0x1798f5];return _0x189541;};'use strict';var multer=require('multer');var util=require(_0x1599('0x0'));var path=require('path');var timeout=require(_0x1599('0x1'));var express=require('express');var router=express[_0x1599('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x1599('0x3'));var interaction=require(_0x1599('0x4'));var config=require('../../config/environment');var controller=require(_0x1599('0x5'));router[_0x1599('0x6')]('/',auth[_0x1599('0x7')](),controller[_0x1599('0x8')]);router[_0x1599('0x6')](_0x1599('0x9'),auth[_0x1599('0x7')](),controller['describe']);router['get'](_0x1599('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x1599('0x6')](_0x1599('0xb'),auth['isAuthenticated'](),controller[_0x1599('0xc')]);router[_0x1599('0x6')]('/:id/resources',auth[_0x1599('0x7')](),controller[_0x1599('0xd')]);router['post']('/',auth[_0x1599('0x7')](),controller[_0x1599('0xe')]);router['post'](_0x1599('0xf'),auth[_0x1599('0x7')](),controller['clone']);router[_0x1599('0x10')]('/:id/sections',auth['isAuthenticated'](),controller[_0x1599('0x11')]);router[_0x1599('0x10')](_0x1599('0x12'),auth['isAuthenticated'](),controller[_0x1599('0x13')]);router[_0x1599('0x14')](_0x1599('0xa'),auth[_0x1599('0x7')](),controller[_0x1599('0x15')]);router[_0x1599('0x16')](_0x1599('0xa'),auth['isAuthenticated'](),controller[_0x1599('0x17')]);router[_0x1599('0x16')]('/:id/sections',auth[_0x1599('0x7')](),controller[_0x1599('0x18')]);router['delete']('/:id/resources',auth[_0x1599('0x7')](),controller['removeResources']);module[_0x1599('0x19')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 142681d..81e9ecb 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 _0xdf60=['STRING','name','setDataValue','crudPermissions','getDataValue','split','BOOLEAN','exports'];(function(_0x4637ba,_0x3a3e88){var _0x281d2f=function(_0x208055){while(--_0x208055){_0x4637ba['push'](_0x4637ba['shift']());}};_0x281d2f(++_0x3a3e88);}(_0xdf60,0x14f));var _0x0df6=function(_0x64642b,_0x11f886){_0x64642b=_0x64642b-0x0;var _0xc515e9=_0xdf60[_0x64642b];return _0xc515e9;};'use strict';var Sequelize=require('sequelize');module[_0x0df6('0x0')]={'name':{'type':Sequelize[_0x0df6('0x1')],'allowNull':![],'unique':_0x0df6('0x2')},'crudPermissions':{'type':Sequelize[_0x0df6('0x1')],'set':function(_0x4a5c59){this[_0x0df6('0x3')](_0x0df6('0x4'),_0x4a5c59?_0x4a5c59['join'](''):[]);},'get':function(){return this[_0x0df6('0x5')]('crudPermissions')?this[_0x0df6('0x5')](_0x0df6('0x4'))[_0x0df6('0x6')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x0df6('0x1')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x0df6('0x7')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x0df6('0x7')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x0df6('0x7')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x0df6('0x7')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x0df6('0x7')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x0df6('0x7')],'defaultValue':!![]}}; \ No newline at end of file +var _0xbb7b=['split','BOOLEAN','exports','STRING','name','crudPermissions','join','getDataValue'];(function(_0x2929ba,_0x506aa6){var _0x365e6e=function(_0x206fd3){while(--_0x206fd3){_0x2929ba['push'](_0x2929ba['shift']());}};_0x365e6e(++_0x506aa6);}(_0xbb7b,0x6a));var _0xbbb7=function(_0x14cbce,_0x28701d){_0x14cbce=_0x14cbce-0x0;var _0x4b2073=_0xbb7b[_0x14cbce];return _0x4b2073;};'use strict';var Sequelize=require('sequelize');module[_0xbbb7('0x0')]={'name':{'type':Sequelize[_0xbbb7('0x1')],'allowNull':![],'unique':_0xbbb7('0x2')},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x4c2bdb){this['setDataValue'](_0xbbb7('0x3'),_0x4c2bdb?_0x4c2bdb[_0xbbb7('0x4')](''):[]);},'get':function(){return this[_0xbbb7('0x5')](_0xbbb7('0x3'))?this[_0xbbb7('0x5')](_0xbbb7('0x3'))[_0xbbb7('0x6')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xbbb7('0x1')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0xbbb7('0x7')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0xbbb7('0x7')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0xbbb7('0x7')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0xbbb7('0x7')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0xbbb7('0x7')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xbbb7('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 043e99b..4da3bd4 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 _0x1410=['send','index','map','UserProfile','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','findAll','then','catch','show','params','includeAll','include','find','create','body','get','omit','createdAt','crudPermissions','updatedAt','transaction','each','autoAssociation','UserProfileResource','userProfileId','Resources','describe','addSections','sequelize','UserProfileSection','sectionId','push','removeSections','ids','getSections','enabled','includes','isEmpty','subsections','findOne','Dashboard','forEach','resourceId','Plugin','addResources','bulkCreate','getResources','section','Missing\x20section\x20parameter','hasOwnProperty','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','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','api','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','socket.io-emitter','./userProfile.socket','register','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','destroy','error','stack','name'];(function(_0x1ee43f,_0x4686d8){var _0x1cb212=function(_0x3a8bc6){while(--_0x3a8bc6){_0x1ee43f['push'](_0x1ee43f['shift']());}};_0x1cb212(++_0x4686d8);}(_0x1410,0x130));var _0x0141=function(_0x26f2d4,_0x1252ea){_0x26f2d4=_0x26f2d4-0x0;var _0x3298a0=_0x1410[_0x26f2d4];return _0x3298a0;};'use strict';var emlformat=require(_0x0141('0x0'));var rimraf=require(_0x0141('0x1'));var zipdir=require(_0x0141('0x2'));var jsonpatch=require(_0x0141('0x3'));var rp=require('request-promise');var moment=require(_0x0141('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x0141('0x5'));var util=require('util');var path=require(_0x0141('0x6'));var sox=require(_0x0141('0x7'));var csv=require(_0x0141('0x8'));var ejs=require(_0x0141('0x9'));var fs=require('fs');var fs_extra=require(_0x0141('0xa'));var _=require(_0x0141('0xb'));var squel=require(_0x0141('0xc'));var crypto=require(_0x0141('0xd'));var jsforce=require(_0x0141('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x0141('0x8'));var querystring=require(_0x0141('0xf'));var Papa=require(_0x0141('0x10'));var Redis=require(_0x0141('0x11'));var authService=require(_0x0141('0x12'));var qs=require(_0x0141('0x13'));var as=require(_0x0141('0x14'));var hardwareService=require(_0x0141('0x15'));var logger=require('../../config/logger')(_0x0141('0x16'));var utils=require(_0x0141('0x17'));var config=require(_0x0141('0x18'));var licenseUtil=require(_0x0141('0x19'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x0141('0x1a')](config[_0x0141('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0x0141('0x1c'))(new Redis(config[_0x0141('0x1b')]));require(_0x0141('0x1d'))[_0x0141('0x1e')](socket);function respondWithStatusCode(_0x1665e2,_0x51a855){_0x51a855=_0x51a855||0xcc;return function(_0x12f234){if(_0x12f234){return _0x1665e2['sendStatus'](_0x51a855);}return _0x1665e2[_0x0141('0x1f')](_0x51a855)[_0x0141('0x20')]();};}function respondWithResult(_0x345fbd,_0x310e2b){_0x310e2b=_0x310e2b||0xc8;return function(_0x3bf5b4){if(_0x3bf5b4){return _0x345fbd[_0x0141('0x1f')](_0x310e2b)['json'](_0x3bf5b4);}};}function respondWithFilteredResult(_0x58c3bb,_0x1b48c7){return function(_0x3720f6){if(_0x3720f6){var _0x4f9945=typeof _0x1b48c7[_0x0141('0x21')]===_0x0141('0x22')&&typeof _0x1b48c7[_0x0141('0x23')]===_0x0141('0x22');var _0x5427b5=_0x3720f6[_0x0141('0x24')];var _0x5bf2e8=_0x4f9945?0x0:_0x1b48c7['offset'];var _0x853d4d=_0x4f9945?_0x3720f6[_0x0141('0x24')]:_0x1b48c7[_0x0141('0x21')]+_0x1b48c7[_0x0141('0x23')];var _0x316f70;if(_0x853d4d>=_0x5427b5){_0x853d4d=_0x5427b5;_0x316f70=0xc8;}else{_0x316f70=0xce;}_0x58c3bb[_0x0141('0x1f')](_0x316f70);return _0x58c3bb['set'](_0x0141('0x25'),_0x5bf2e8+'-'+_0x853d4d+'/'+_0x5427b5)[_0x0141('0x26')](_0x3720f6);}return null;};}function patchUpdates(_0x363860){return function(_0x239ea2){try{jsonpatch[_0x0141('0x27')](_0x239ea2,_0x363860,!![]);}catch(_0x1a4b0b){return BPromise[_0x0141('0x28')](_0x1a4b0b);}return _0x239ea2[_0x0141('0x29')]();};}function saveUpdates(_0x12a11e,_0x3869b7){return function(_0x43b105){if(_0x43b105){return _0x43b105[_0x0141('0x2a')](_0x12a11e)['then'](function(_0x4247d){return _0x4247d;});}return null;};}function removeEntity(_0x14ecbf,_0xb80072){return function(_0x3e242c){if(_0x3e242c){return _0x3e242c[_0x0141('0x2b')]()['then'](function(){_0x14ecbf[_0x0141('0x1f')](0xcc)[_0x0141('0x20')]();});}};}function handleEntityNotFound(_0x2bb7c4,_0x4a82a6){return function(_0x29bec2){if(!_0x29bec2){_0x2bb7c4['sendStatus'](0x194);}return _0x29bec2;};}function handleError(_0x15a81e,_0x13d8d1){_0x13d8d1=_0x13d8d1||0x1f4;return function(_0x400602){logger[_0x0141('0x2c')](_0x400602[_0x0141('0x2d')]);if(_0x400602[_0x0141('0x2e')]){delete _0x400602[_0x0141('0x2e')];}_0x15a81e[_0x0141('0x1f')](_0x13d8d1)[_0x0141('0x2f')](_0x400602);};}exports[_0x0141('0x30')]=function(_0x32ce7e,_0x36c409){var _0x19f25f={},_0x48e025={},_0x4201ae={'count':0x0,'rows':[]};var _0x555294=_[_0x0141('0x31')](db[_0x0141('0x32')][_0x0141('0x33')],function(_0xb17adc){return{'name':_0xb17adc[_0x0141('0x34')],'type':_0xb17adc[_0x0141('0x35')]['key']};});_0x48e025[_0x0141('0x36')]=_['map'](_0x555294,_0x0141('0x2e'));_0x48e025[_0x0141('0x37')]=_[_0x0141('0x38')](_0x32ce7e['query']);_0x48e025[_0x0141('0x39')]=_[_0x0141('0x3a')](_0x48e025['model'],_0x48e025[_0x0141('0x37')]);_0x19f25f[_0x0141('0x3b')]=_[_0x0141('0x3a')](_0x48e025[_0x0141('0x36')],qs[_0x0141('0x3c')](_0x32ce7e['query'][_0x0141('0x3c')]));_0x19f25f[_0x0141('0x3b')]=_0x19f25f[_0x0141('0x3b')][_0x0141('0x3d')]?_0x19f25f[_0x0141('0x3b')]:_0x48e025[_0x0141('0x36')];if(!_0x32ce7e['query']['hasOwnProperty'](_0x0141('0x3e'))){_0x19f25f[_0x0141('0x23')]=qs['limit'](_0x32ce7e[_0x0141('0x37')][_0x0141('0x23')]);_0x19f25f[_0x0141('0x21')]=qs['offset'](_0x32ce7e['query']['offset']);}_0x19f25f[_0x0141('0x3f')]=qs[_0x0141('0x40')](_0x32ce7e[_0x0141('0x37')][_0x0141('0x40')]);_0x19f25f[_0x0141('0x41')]=qs[_0x0141('0x39')](_[_0x0141('0x42')](_0x32ce7e['query'],_0x48e025[_0x0141('0x39')]),_0x555294);if(_0x32ce7e[_0x0141('0x37')]['filter']){_0x19f25f[_0x0141('0x41')]=_[_0x0141('0x43')](_0x19f25f[_0x0141('0x41')],{'$or':_[_0x0141('0x31')](_0x555294,function(_0x1a4aa0){if(_0x1a4aa0[_0x0141('0x35')]!==_0x0141('0x44')){var _0x449505={};_0x449505[_0x1a4aa0['name']]={'$like':'%'+_0x32ce7e[_0x0141('0x37')][_0x0141('0x45')]+'%'};return _0x449505;}})});}_0x19f25f=_['merge']({},_0x19f25f,_0x32ce7e[_0x0141('0x46')]);var _0x21baeb={'where':_0x19f25f[_0x0141('0x41')]};return db[_0x0141('0x32')][_0x0141('0x24')](_0x21baeb)['then'](function(_0x1746a1){_0x4201ae['count']=_0x1746a1;if(_0x32ce7e[_0x0141('0x37')]['includeAll']){_0x19f25f['include']=[{'all':!![]}];}return db['UserProfile'][_0x0141('0x47')](_0x19f25f);})[_0x0141('0x48')](function(_0x210a8c){_0x4201ae['rows']=_0x210a8c;return _0x4201ae;})[_0x0141('0x48')](respondWithFilteredResult(_0x36c409,_0x19f25f))[_0x0141('0x49')](handleError(_0x36c409,null));};exports[_0x0141('0x4a')]=function(_0x51de8f,_0x4c64bf){var _0x3caba9={'raw':![],'where':{'id':_0x51de8f[_0x0141('0x4b')]['id']}},_0x268d2a={};_0x268d2a[_0x0141('0x36')]=_[_0x0141('0x38')](db[_0x0141('0x32')][_0x0141('0x33')]);_0x268d2a[_0x0141('0x37')]=_['keys'](_0x51de8f[_0x0141('0x37')]);_0x268d2a[_0x0141('0x39')]=_[_0x0141('0x3a')](_0x268d2a['model'],_0x268d2a[_0x0141('0x37')]);_0x3caba9[_0x0141('0x3b')]=_[_0x0141('0x3a')](_0x268d2a['model'],qs[_0x0141('0x3c')](_0x51de8f['query'][_0x0141('0x3c')]));_0x3caba9['attributes']=_0x3caba9[_0x0141('0x3b')]['length']?_0x3caba9[_0x0141('0x3b')]:_0x268d2a[_0x0141('0x36')];if(_0x51de8f[_0x0141('0x37')][_0x0141('0x4c')]){_0x3caba9[_0x0141('0x4d')]=[{'all':!![]}];}_0x3caba9=_['merge']({},_0x3caba9,_0x51de8f[_0x0141('0x46')]);return db[_0x0141('0x32')][_0x0141('0x4e')](_0x3caba9)['then'](handleEntityNotFound(_0x4c64bf,null))[_0x0141('0x48')](respondWithResult(_0x4c64bf,null))[_0x0141('0x49')](handleError(_0x4c64bf,null));};exports[_0x0141('0x4f')]=function(_0x4978a3,_0x3e30a8){return db['UserProfile'][_0x0141('0x4f')](_0x4978a3[_0x0141('0x50')],{})[_0x0141('0x48')](respondWithResult(_0x3e30a8,0xc9))[_0x0141('0x49')](handleError(_0x3e30a8,null));};exports['clone']=function(_0x28d638,_0x170969){var _0x3abf41={'where':{'id':_0x28d638[_0x0141('0x4b')]['id']}},_0x20260c={};_0x20260c[_0x0141('0x36')]=_[_0x0141('0x38')](db['UserProfile'][_0x0141('0x33')]);_0x3abf41[_0x0141('0x3b')]=_[_0x0141('0x3a')](_0x20260c['model'],qs[_0x0141('0x3c')](_0x28d638[_0x0141('0x37')][_0x0141('0x3c')]));_0x3abf41['attributes']=_0x3abf41[_0x0141('0x3b')]['length']?_0x3abf41[_0x0141('0x3b')]:_0x20260c[_0x0141('0x36')];if(_0x28d638[_0x0141('0x37')][_0x0141('0x4c')]){_0x3abf41[_0x0141('0x4d')]=[{'all':!![]}];}_0x3abf41=_[_0x0141('0x43')]({},_0x3abf41,_0x28d638[_0x0141('0x46')]);return db[_0x0141('0x32')][_0x0141('0x4e')](_0x3abf41)[_0x0141('0x48')](handleEntityNotFound(_0x170969,null))[_0x0141('0x48')](function(_0x53b31f){if(_0x53b31f){var _0x47100e=_0x53b31f[_0x0141('0x51')]({'plain':!![]});_0x47100e=qs[_0x0141('0x52')](_0x47100e,['id',_0x0141('0x53'),'updatedAt',_0x0141('0x54')]);_0x28d638[_0x0141('0x50')]=_[_0x0141('0x52')](_0x28d638[_0x0141('0x50')],['id',_0x0141('0x53'),_0x0141('0x55')]);return db['sequelize'][_0x0141('0x56')](function(_0x51d01c){return db[_0x0141('0x32')][_0x0141('0x4f')](_[_0x0141('0x43')](_0x47100e,_0x28d638[_0x0141('0x50')]),{'include':_0x28d638[_0x0141('0x37')][_0x0141('0x4c')]?[{'all':!![]}]:undefined,'transaction':_0x51d01c})[_0x0141('0x48')](function(_0x4d515e){var _0x55272c=_0x4d515e[_0x0141('0x51')]({'plain':!![]});return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0x28d638[_0x0141('0x4b')]['id']},'raw':!![]})[_0x0141('0x48')](function(_0x2c611c){if(_0x2c611c){return BPromise[_0x0141('0x57')](_0x2c611c,function(_0x4473b4){return new BPromise(function(_0x113a2f,_0x20d836){if(_0x4473b4[_0x0141('0x58')]===null||_0x4473b4[_0x0141('0x58')]===0x1)_0x113a2f(null);return db[_0x0141('0x59')]['findAll']({'where':{'sectionId':_0x4473b4['id']},'raw':!![]})[_0x0141('0x48')](function(_0x25017c){var _0x418c0b=_[_0x0141('0x31')](_0x25017c,function(_0x3d55f3){return qs[_0x0141('0x52')](_0x3d55f3,['id',_0x0141('0x53'),_0x0141('0x55'),'sectionId']);});_0x113a2f(_0x418c0b);})[_0x0141('0x49')](function(_0x2dc025){_0x20d836(_0x2dc025);});})[_0x0141('0x48')](function(_0x351f9f){var _0x3c7ddc=qs['omit'](_0x4473b4,['id','createdAt',_0x0141('0x55')]);_0x3c7ddc[_0x0141('0x5a')]=_0x55272c['id'];if(_0x351f9f)_0x3c7ddc[_0x0141('0x5b')]=_0x351f9f;return _0x3c7ddc;})[_0x0141('0x48')](function(_0x3b6589){return db['UserProfileSection'][_0x0141('0x4f')](_0x3b6589,{'include':[{'model':db[_0x0141('0x59')],'as':_0x0141('0x5b')}],'raw':!![],'transaction':_0x51d01c});});})[_0x0141('0x48')](function(){return _0x55272c;});}});});});}})[_0x0141('0x48')](respondWithResult(_0x170969,0xc9))['catch'](handleError(_0x170969,null));};exports['update']=function(_0x3bd325,_0x39b263){if(_0x3bd325[_0x0141('0x50')]['id']){delete _0x3bd325[_0x0141('0x50')]['id'];}return db['UserProfile'][_0x0141('0x4e')]({'where':{'id':_0x3bd325[_0x0141('0x4b')]['id']}})[_0x0141('0x48')](handleEntityNotFound(_0x39b263,null))[_0x0141('0x48')](saveUpdates(_0x3bd325[_0x0141('0x50')],null))['then'](respondWithResult(_0x39b263,null))[_0x0141('0x49')](handleError(_0x39b263,null));};exports[_0x0141('0x2b')]=function(_0x30d53b,_0x21241e){return db[_0x0141('0x32')]['find']({'where':{'id':_0x30d53b['params']['id']}})['then'](handleEntityNotFound(_0x21241e,null))[_0x0141('0x48')](removeEntity(_0x21241e,null))[_0x0141('0x49')](handleError(_0x21241e,null));};exports[_0x0141('0x5c')]=function(_0x5667f0,_0xf26515){return db[_0x0141('0x32')][_0x0141('0x5c')]()[_0x0141('0x48')](respondWithResult(_0xf26515,null))[_0x0141('0x49')](handleError(_0xf26515,null));};exports[_0x0141('0x5d')]=function(_0x5e3f1c,_0x64d195){var _0x1fbf04=_0x5e3f1c[_0x0141('0x50')];return db[_0x0141('0x32')][_0x0141('0x4e')]({'where':{'id':_0x5e3f1c[_0x0141('0x4b')]['id']}})[_0x0141('0x48')](handleEntityNotFound(_0x64d195,null))[_0x0141('0x48')](function(_0x528122){if(_0x528122){return db[_0x0141('0x5e')][_0x0141('0x56')](function(_0x17ab21){return db[_0x0141('0x5f')]['destroy']({'where':{'userProfileId':_0x5e3f1c['params']['id'],'sectionId':_[_0x0141('0x31')](_0x1fbf04,function(_0x56d68c){return _0x56d68c[_0x0141('0x60')];})},'transaction':_0x17ab21})['then'](function(){var _0xa33afd=_[_0x0141('0x31')](_0x1fbf04,function(_0x14b979){_0x14b979['userProfileId']=_0x5e3f1c[_0x0141('0x4b')]['id'];return _0x14b979;});var _0x276be9=[];return BPromise[_0x0141('0x57')](_0xa33afd,function(_0x4fc114){return db[_0x0141('0x5f')]['create'](_0x4fc114,{'include':[{'model':db[_0x0141('0x59')],'as':'Resources'}],'raw':!![],'transaction':_0x17ab21})[_0x0141('0x48')](function(_0x521ef5){_0x276be9[_0x0141('0x61')](_0x521ef5['get']({'plain':!![]}));});})[_0x0141('0x48')](function(){return _0x276be9;});});});}})[_0x0141('0x48')](function(_0x48cb50){return _0x48cb50;})[_0x0141('0x48')](respondWithResult(_0x64d195,null))['catch'](handleError(_0x64d195,null));};exports[_0x0141('0x62')]=function(_0x57a8da,_0x319328){var _0xe11868;return db[_0x0141('0x32')][_0x0141('0x4e')]({'where':{'id':_0x57a8da[_0x0141('0x4b')]['id']},'attributes':['id',_0x0141('0x2e')]})['then'](handleEntityNotFound(_0x319328,null))['then'](function(_0x3d04ff){if(_0x3d04ff){_0xe11868=_0x3d04ff;return db[_0x0141('0x5f')]['destroy']({'where':{'userProfileId':_0x57a8da['params']['id'],'sectionId':_0x57a8da['query'][_0x0141('0x63')]}});}})[_0x0141('0x48')](function(){return _0xe11868;})[_0x0141('0x48')](respondWithStatusCode(_0x319328,null))[_0x0141('0x49')](handleError(_0x319328,null));};exports[_0x0141('0x64')]=function(_0x1389f3,_0x3d85c1){var _0x392140=[];var _0x462e48=[];return db[_0x0141('0x5f')][_0x0141('0x47')]({'where':{'userProfileId':_0x1389f3[_0x0141('0x4b')]['id']},'raw':!![]})[_0x0141('0x48')](function(_0x3ddb3b){_0x392140=_[_0x0141('0x45')](_0x3ddb3b,function(_0x468bf3){return _0x468bf3[_0x0141('0x65')]===0x1||_[_0x0141('0x66')]([0x3eb,0x709],_0x468bf3['sectionId']);});if(!_[_0x0141('0x67')](_0x392140)){return _[_0x0141('0x31')](_0x392140,function(_0x1520b5){return _0x1520b5['sectionId'];});}else{return;}})[_0x0141('0x48')](function(_0x129d4e){if(_0x129d4e)_0x462e48=_0x129d4e;if(_[_0x0141('0x66')](_0x462e48,0x64)){var _0x4158e4=_['find'](_0x392140,{'sectionId':0x64});return hasDefaultDashboard(_0x4158e4)['then'](function(_0x9d9cbf){return _[_0x0141('0x31')](_0x392140,function(_0x137e47){if(_0x137e47[_0x0141('0x60')]===0x64){_0x137e47['subsections']=_0x9d9cbf;}return _0x137e47;});});}else{return;}})[_0x0141('0x48')](function(_0x3b2fba){if(_0x3b2fba)_0x392140=_0x3b2fba;if(_[_0x0141('0x66')](_0x462e48,0x3eb)){var _0x4a375c=_[_0x0141('0x4e')](_0x392140,{'sectionId':0x3eb});return getCustomDashboards(_0x4a375c)[_0x0141('0x48')](function(_0x15c75a){return _['map'](_0x392140,function(_0x95056e){if(_0x4a375c[_0x0141('0x65')]){if(_0x95056e[_0x0141('0x60')]===0x3eb){_0x95056e[_0x0141('0x68')]=_0x15c75a;}}else{if(_0x95056e['sectionId']===0x64){_0x95056e[_0x0141('0x68')]=_0x15c75a;}}return _0x95056e;});});}else{return;}})[_0x0141('0x48')](function(_0x113999){if(_0x113999)_0x392140=_0x113999;if(_[_0x0141('0x66')](_0x462e48,0x709)){var _0x15826c=_[_0x0141('0x4e')](_0x392140,{'sectionId':0x709});return getPlugins(_0x15826c)[_0x0141('0x48')](function(_0x101c32){if(_0x15826c[_0x0141('0x65')]){return _['map'](_0x392140,function(_0x43758c){if(_0x43758c[_0x0141('0x60')]===0x709){_0x43758c[_0x0141('0x68')]=_0x101c32;}return _0x43758c;});}else{var _0x1879df={'sectionId':0x76c,'enabled':0x1,'subsections':_0x101c32};var _0x2943f9=_[_0x0141('0x31')](_0x392140);_0x2943f9[_0x0141('0x61')](_0x1879df);return _0x2943f9;}});}else{return;}})[_0x0141('0x48')](function(_0x49ef36){if(_0x49ef36)_0x392140=_0x49ef36;return _[_0x0141('0x45')](_0x392140,[_0x0141('0x65'),0x1]);})[_0x0141('0x48')](respondWithResult(_0x3d85c1,null))[_0x0141('0x49')](handleError(_0x3d85c1,null));};function hasDefaultDashboard(_0x23a17a){var _0x10a9a7=[0x65];return new BPromise(function(_0x1d3943,_0x5d661b){try{if(_0x23a17a[_0x0141('0x58')]){_0x1d3943(_0x10a9a7);}else{return db[_0x0141('0x59')][_0x0141('0x69')]({'where':{'sectionId':_0x23a17a['id']},'raw':!![]})[_0x0141('0x48')](function(_0xb6e9da){_0xb6e9da?_0x1d3943(_0x10a9a7):_0x1d3943();});}}catch(_0x975d13){_0x5d661b(_0x975d13);}});}function getCustomDashboards(_0x18f224){var _0x52b5eb=[];return new BPromise(function(_0x5e1e78,_0x4909a7){try{if(_0x18f224['autoAssociation']){return db[_0x0141('0x6a')][_0x0141('0x47')]({'raw':!![]})[_0x0141('0x48')](function(_0x185f6f){_0x185f6f['forEach'](function(_0xee354b){_0x52b5eb['push'](_0xee354b['id']+0x1869f);});_0x5e1e78(_0x52b5eb);});}else{return db[_0x0141('0x59')]['findAll']({'where':{'sectionId':_0x18f224['id']},'raw':!![]})[_0x0141('0x48')](function(_0x293e40){_0x293e40[_0x0141('0x6b')](function(_0x579684){_0x52b5eb['push'](_0x579684[_0x0141('0x6c')]+0x1869f);});_0x5e1e78(_0x52b5eb);});}}catch(_0x1446d5){_0x4909a7(_0x1446d5);}});}function getPlugins(_0x5272e9){var _0xc640df=[];return new BPromise(function(_0x1f231e,_0x453dca){try{if(_0x5272e9[_0x0141('0x58')]){return db[_0x0141('0x6d')][_0x0141('0x47')]({'raw':!![]})[_0x0141('0x48')](function(_0x534759){_0x534759[_0x0141('0x6b')](function(_0x20a77b){_0xc640df[_0x0141('0x61')](_0x20a77b['id']+0x15b38);});_0x1f231e(_0xc640df);});}else{return db[_0x0141('0x59')][_0x0141('0x47')]({'where':{'sectionId':_0x5272e9['id']},'raw':!![]})[_0x0141('0x48')](function(_0x4a7568){_0x4a7568[_0x0141('0x6b')](function(_0x124a29){_0xc640df[_0x0141('0x61')](_0x124a29[_0x0141('0x6c')]+0x15b38);});_0x1f231e(_0xc640df);});}}catch(_0x520185){_0x453dca(_0x520185);}});}exports[_0x0141('0x6e')]=function(_0x4cc6c2,_0x15db8a){return db[_0x0141('0x32')]['find']({'where':{'id':_0x4cc6c2[_0x0141('0x4b')]['id']}})[_0x0141('0x48')](handleEntityNotFound(_0x15db8a,null))[_0x0141('0x48')](function(_0x3096e2){if(_0x3096e2){return db[_0x0141('0x5e')][_0x0141('0x56')](function(_0x5d8a45){return db['UserProfileSection'][_0x0141('0x47')]({'where':{'userProfileId':_0x4cc6c2['params']['id']},'attributes':['id'],'raw':!![]})[_0x0141('0x48')](function(_0x3eff9d){if(_0x3eff9d){return db['UserProfileSection'][_0x0141('0x2b')]({'where':{'userProfileId':_0x4cc6c2[_0x0141('0x4b')]['id'],'id':_['map'](_0x3eff9d,function(_0x131b67){return _0x131b67['id'];})},'transaction':_0x5d8a45});}})[_0x0141('0x48')](function(_0x2449c1){var _0x149326=_[_0x0141('0x31')](_0x4cc6c2[_0x0141('0x50')],function(_0x27fff5){_0x27fff5['userProfileId']=_0x4cc6c2[_0x0141('0x4b')]['id'];return _0x27fff5;});return db[_0x0141('0x5f')][_0x0141('0x6f')](_0x149326,{'raw':!![],'transaction':_0x5d8a45});})[_0x0141('0x48')](function(_0x152ed3){var _0x5d06fe=_[_0x0141('0x45')](_[_0x0141('0x31')](_0x152ed3,function(_0x2f832f){return _0x2f832f[_0x0141('0x51')]({'plain':!![]});}),{'includeAll':![]});if(_0x5d06fe){return db[_0x0141('0x5f')][_0x0141('0x47')]({'where':{'userProfileId':_0x4cc6c2['params']['id'],'sectionId':_['map'](_0x5d06fe,function(_0x494530){return _0x494530['sectionId'];})},'attributes':['id',_0x0141('0x60')],'raw':!![]})[_0x0141('0x48')](function(_0x3a43b5){var _0x16531b=_[_0x0141('0x31')](_0x4cc6c2[_0x0141('0x50')],function(_0x8caa1c){_0x8caa1c[_0x0141('0x5a')]=_0x4cc6c2['params']['id'];return _0x8caa1c;});return db[_0x0141('0x59')][_0x0141('0x6f')](_0x16531b,{'raw':!![],'transaction':_0x5d8a45});});}})[_0x0141('0x49')](handleError(_0x15db8a,null));});}})[_0x0141('0x48')](function(_0x58670c){var _0x59065b=_[_0x0141('0x31')](_0x58670c,function(_0x2b2235){return _0x2b2235[_0x0141('0x51')]({'plain':!![]});});})['then'](respondWithResult(_0x15db8a,null))['catch'](handleError(_0x15db8a,null));};exports['removeResources']=function(_0x24e9c3,_0x3d5058,_0x5cec9f){return db['UserProfile'][_0x0141('0x4e')]({'where':{'id':_0x24e9c3[_0x0141('0x4b')]['id']}})[_0x0141('0x48')](handleEntityNotFound(_0x3d5058,null))[_0x0141('0x48')](function(_0x5ed8ef){if(_0x5ed8ef){return _0x5ed8ef['removeResources'](_0x24e9c3[_0x0141('0x37')]['ids']);}})[_0x0141('0x48')](respondWithStatusCode(_0x3d5058,null))[_0x0141('0x49')](handleError(_0x3d5058,null));};exports[_0x0141('0x70')]=function(_0x21cae8,_0x26c858){var _0x3fcb8f={};if(!_0x21cae8['query'][_0x0141('0x71')])throw new Error(_0x0141('0x72'));if(!_0x21cae8['query'][_0x0141('0x73')](_0x0141('0x3e'))){_0x3fcb8f[_0x0141('0x23')]=qs[_0x0141('0x23')](_0x21cae8[_0x0141('0x37')][_0x0141('0x23')]);_0x3fcb8f[_0x0141('0x21')]=qs[_0x0141('0x21')](_0x21cae8[_0x0141('0x37')]['offset']);}return db['UserProfile']['find']({'where':{'id':_0x21cae8[_0x0141('0x4b')]['id']}})[_0x0141('0x48')](function(_0x429909){if(!_0x429909)throw new Error(_0x0141('0x74')+_0x21cae8[_0x0141('0x4b')]['id']);return db[_0x0141('0x32')]['getResources'](_0x21cae8);})[_0x0141('0x48')](respondWithFilteredResult(_0x26c858,_0x3fcb8f))[_0x0141('0x49')](handleError(_0x26c858,null));}; \ No newline at end of file +var _0x2f56=['undefined','limit','count','offset','set','Content-Range','apply','update','then','destroy','name','send','index','map','UserProfile','rawAttributes','fieldName','key','model','query','intersection','fields','attributes','length','nolimit','sort','filters','pick','where','VIRTUAL','filter','options','includeAll','findAll','params','keys','include','merge','catch','create','body','clone','find','omit','createdAt','updatedAt','crudPermissions','get','each','autoAssociation','UserProfileResource','sectionId','userProfileId','Resources','UserProfileSection','describe','sequelize','transaction','push','ids','getSections','includes','subsections','enabled','Dashboard','forEach','Plugin','resourceId','addResources','bulkCreate','removeResources','getResources','section','Missing\x20section\x20parameter','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./userProfile.socket','register','sendStatus','status','end','json'];(function(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0x2f56,0xb5));var _0x62f5=function(_0x5cc808,_0x223b7b){_0x5cc808=_0x5cc808-0x0;var _0xdfa670=_0x2f56[_0x5cc808];return _0xdfa670;};'use strict';var emlformat=require(_0x62f5('0x0'));var rimraf=require(_0x62f5('0x1'));var zipdir=require(_0x62f5('0x2'));var jsonpatch=require(_0x62f5('0x3'));var rp=require('request-promise');var moment=require(_0x62f5('0x4'));var BPromise=require(_0x62f5('0x5'));var Mustache=require(_0x62f5('0x6'));var util=require(_0x62f5('0x7'));var path=require(_0x62f5('0x8'));var sox=require('sox');var csv=require(_0x62f5('0x9'));var ejs=require(_0x62f5('0xa'));var fs=require('fs');var fs_extra=require(_0x62f5('0xb'));var _=require(_0x62f5('0xc'));var squel=require('squel');var crypto=require(_0x62f5('0xd'));var jsforce=require(_0x62f5('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x62f5('0x9'));var querystring=require(_0x62f5('0xf'));var Papa=require('papaparse');var Redis=require(_0x62f5('0x10'));var authService=require(_0x62f5('0x11'));var qs=require(_0x62f5('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x62f5('0x13'))(_0x62f5('0x14'));var utils=require(_0x62f5('0x15'));var config=require(_0x62f5('0x16'));var licenseUtil=require(_0x62f5('0x17'));var db=require(_0x62f5('0x18'))['db'];config[_0x62f5('0x19')]=_['defaults'](config[_0x62f5('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x62f5('0x1a'))(new Redis(config[_0x62f5('0x19')]));require(_0x62f5('0x1b'))[_0x62f5('0x1c')](socket);function respondWithStatusCode(_0x507eee,_0x1ac04a){_0x1ac04a=_0x1ac04a||0xcc;return function(_0x517467){if(_0x517467){return _0x507eee[_0x62f5('0x1d')](_0x1ac04a);}return _0x507eee[_0x62f5('0x1e')](_0x1ac04a)[_0x62f5('0x1f')]();};}function respondWithResult(_0x256fe2,_0x12ac00){_0x12ac00=_0x12ac00||0xc8;return function(_0xbb421b){if(_0xbb421b){return _0x256fe2[_0x62f5('0x1e')](_0x12ac00)[_0x62f5('0x20')](_0xbb421b);}};}function respondWithFilteredResult(_0x5b49a1,_0x5ed28b){return function(_0x36c77d){if(_0x36c77d){var _0x3cf38b=typeof _0x5ed28b['offset']===_0x62f5('0x21')&&typeof _0x5ed28b[_0x62f5('0x22')]===_0x62f5('0x21');var _0x5952de=_0x36c77d[_0x62f5('0x23')];var _0x160129=_0x3cf38b?0x0:_0x5ed28b[_0x62f5('0x24')];var _0x5de28a=_0x3cf38b?_0x36c77d['count']:_0x5ed28b[_0x62f5('0x24')]+_0x5ed28b[_0x62f5('0x22')];var _0x31d74d;if(_0x5de28a>=_0x5952de){_0x5de28a=_0x5952de;_0x31d74d=0xc8;}else{_0x31d74d=0xce;}_0x5b49a1[_0x62f5('0x1e')](_0x31d74d);return _0x5b49a1[_0x62f5('0x25')](_0x62f5('0x26'),_0x160129+'-'+_0x5de28a+'/'+_0x5952de)[_0x62f5('0x20')](_0x36c77d);}return null;};}function patchUpdates(_0x219ec2){return function(_0x24088d){try{jsonpatch[_0x62f5('0x27')](_0x24088d,_0x219ec2,!![]);}catch(_0x260af5){return BPromise['reject'](_0x260af5);}return _0x24088d['save']();};}function saveUpdates(_0x2e4090,_0x3114a2){return function(_0x104a7a){if(_0x104a7a){return _0x104a7a[_0x62f5('0x28')](_0x2e4090)[_0x62f5('0x29')](function(_0x289b75){return _0x289b75;});}return null;};}function removeEntity(_0x4d8423,_0x28e94a){return function(_0x4ac356){if(_0x4ac356){return _0x4ac356[_0x62f5('0x2a')]()['then'](function(){_0x4d8423[_0x62f5('0x1e')](0xcc)[_0x62f5('0x1f')]();});}};}function handleEntityNotFound(_0x131832,_0x2327da){return function(_0x2068dc){if(!_0x2068dc){_0x131832[_0x62f5('0x1d')](0x194);}return _0x2068dc;};}function handleError(_0x3c597a,_0x486ad2){_0x486ad2=_0x486ad2||0x1f4;return function(_0x21d2c1){logger['error'](_0x21d2c1['stack']);if(_0x21d2c1['name']){delete _0x21d2c1[_0x62f5('0x2b')];}_0x3c597a[_0x62f5('0x1e')](_0x486ad2)[_0x62f5('0x2c')](_0x21d2c1);};}exports[_0x62f5('0x2d')]=function(_0x1ed080,_0x1ea769){var _0x5d4cc9={},_0x12f805={},_0x1862fa={'count':0x0,'rows':[]};var _0x1f2e30=_[_0x62f5('0x2e')](db[_0x62f5('0x2f')][_0x62f5('0x30')],function(_0x49c5a9){return{'name':_0x49c5a9[_0x62f5('0x31')],'type':_0x49c5a9['type'][_0x62f5('0x32')]};});_0x12f805[_0x62f5('0x33')]=_['map'](_0x1f2e30,_0x62f5('0x2b'));_0x12f805['query']=_['keys'](_0x1ed080[_0x62f5('0x34')]);_0x12f805['filters']=_[_0x62f5('0x35')](_0x12f805[_0x62f5('0x33')],_0x12f805[_0x62f5('0x34')]);_0x5d4cc9['attributes']=_['intersection'](_0x12f805[_0x62f5('0x33')],qs['fields'](_0x1ed080['query'][_0x62f5('0x36')]));_0x5d4cc9[_0x62f5('0x37')]=_0x5d4cc9['attributes'][_0x62f5('0x38')]?_0x5d4cc9[_0x62f5('0x37')]:_0x12f805[_0x62f5('0x33')];if(!_0x1ed080[_0x62f5('0x34')]['hasOwnProperty'](_0x62f5('0x39'))){_0x5d4cc9['limit']=qs[_0x62f5('0x22')](_0x1ed080[_0x62f5('0x34')][_0x62f5('0x22')]);_0x5d4cc9['offset']=qs[_0x62f5('0x24')](_0x1ed080[_0x62f5('0x34')]['offset']);}_0x5d4cc9['order']=qs[_0x62f5('0x3a')](_0x1ed080['query']['sort']);_0x5d4cc9['where']=qs[_0x62f5('0x3b')](_[_0x62f5('0x3c')](_0x1ed080[_0x62f5('0x34')],_0x12f805[_0x62f5('0x3b')]),_0x1f2e30);if(_0x1ed080[_0x62f5('0x34')]['filter']){_0x5d4cc9[_0x62f5('0x3d')]=_['merge'](_0x5d4cc9[_0x62f5('0x3d')],{'$or':_[_0x62f5('0x2e')](_0x1f2e30,function(_0x27bd85){if(_0x27bd85['type']!==_0x62f5('0x3e')){var _0x59a661={};_0x59a661[_0x27bd85[_0x62f5('0x2b')]]={'$like':'%'+_0x1ed080[_0x62f5('0x34')][_0x62f5('0x3f')]+'%'};return _0x59a661;}})});}_0x5d4cc9=_['merge']({},_0x5d4cc9,_0x1ed080[_0x62f5('0x40')]);var _0x16162c={'where':_0x5d4cc9[_0x62f5('0x3d')]};return db[_0x62f5('0x2f')]['count'](_0x16162c)[_0x62f5('0x29')](function(_0x4ee947){_0x1862fa['count']=_0x4ee947;if(_0x1ed080[_0x62f5('0x34')][_0x62f5('0x41')]){_0x5d4cc9['include']=[{'all':!![]}];}return db[_0x62f5('0x2f')][_0x62f5('0x42')](_0x5d4cc9);})[_0x62f5('0x29')](function(_0x3b50b8){_0x1862fa['rows']=_0x3b50b8;return _0x1862fa;})[_0x62f5('0x29')](respondWithFilteredResult(_0x1ea769,_0x5d4cc9))['catch'](handleError(_0x1ea769,null));};exports['show']=function(_0x45fae9,_0x441ce6){var _0x443a40={'raw':![],'where':{'id':_0x45fae9[_0x62f5('0x43')]['id']}},_0x2e2fc4={};_0x2e2fc4[_0x62f5('0x33')]=_[_0x62f5('0x44')](db[_0x62f5('0x2f')][_0x62f5('0x30')]);_0x2e2fc4['query']=_[_0x62f5('0x44')](_0x45fae9['query']);_0x2e2fc4['filters']=_[_0x62f5('0x35')](_0x2e2fc4[_0x62f5('0x33')],_0x2e2fc4[_0x62f5('0x34')]);_0x443a40['attributes']=_[_0x62f5('0x35')](_0x2e2fc4[_0x62f5('0x33')],qs['fields'](_0x45fae9[_0x62f5('0x34')][_0x62f5('0x36')]));_0x443a40['attributes']=_0x443a40[_0x62f5('0x37')][_0x62f5('0x38')]?_0x443a40[_0x62f5('0x37')]:_0x2e2fc4[_0x62f5('0x33')];if(_0x45fae9['query']['includeAll']){_0x443a40[_0x62f5('0x45')]=[{'all':!![]}];}_0x443a40=_[_0x62f5('0x46')]({},_0x443a40,_0x45fae9[_0x62f5('0x40')]);return db[_0x62f5('0x2f')]['find'](_0x443a40)[_0x62f5('0x29')](handleEntityNotFound(_0x441ce6,null))[_0x62f5('0x29')](respondWithResult(_0x441ce6,null))[_0x62f5('0x47')](handleError(_0x441ce6,null));};exports[_0x62f5('0x48')]=function(_0x2bcb52,_0x1d8896){return db[_0x62f5('0x2f')][_0x62f5('0x48')](_0x2bcb52[_0x62f5('0x49')],{})[_0x62f5('0x29')](respondWithResult(_0x1d8896,0xc9))[_0x62f5('0x47')](handleError(_0x1d8896,null));};exports[_0x62f5('0x4a')]=function(_0x1617de,_0x206996){var _0x5028fa={'where':{'id':_0x1617de[_0x62f5('0x43')]['id']}},_0x4bfbc6={};_0x4bfbc6[_0x62f5('0x33')]=_[_0x62f5('0x44')](db[_0x62f5('0x2f')][_0x62f5('0x30')]);_0x5028fa[_0x62f5('0x37')]=_['intersection'](_0x4bfbc6[_0x62f5('0x33')],qs['fields'](_0x1617de[_0x62f5('0x34')][_0x62f5('0x36')]));_0x5028fa[_0x62f5('0x37')]=_0x5028fa[_0x62f5('0x37')][_0x62f5('0x38')]?_0x5028fa[_0x62f5('0x37')]:_0x4bfbc6[_0x62f5('0x33')];if(_0x1617de[_0x62f5('0x34')][_0x62f5('0x41')]){_0x5028fa['include']=[{'all':!![]}];}_0x5028fa=_[_0x62f5('0x46')]({},_0x5028fa,_0x1617de['options']);return db['UserProfile'][_0x62f5('0x4b')](_0x5028fa)[_0x62f5('0x29')](handleEntityNotFound(_0x206996,null))['then'](function(_0x1d2481){if(_0x1d2481){var _0x4ea53b=_0x1d2481['get']({'plain':!![]});_0x4ea53b=qs[_0x62f5('0x4c')](_0x4ea53b,['id',_0x62f5('0x4d'),_0x62f5('0x4e'),_0x62f5('0x4f')]);_0x1617de['body']=_[_0x62f5('0x4c')](_0x1617de[_0x62f5('0x49')],['id',_0x62f5('0x4d'),_0x62f5('0x4e')]);return db['sequelize']['transaction'](function(_0x15c627){return db['UserProfile'][_0x62f5('0x48')](_[_0x62f5('0x46')](_0x4ea53b,_0x1617de['body']),{'include':_0x1617de[_0x62f5('0x34')][_0x62f5('0x41')]?[{'all':!![]}]:undefined,'transaction':_0x15c627})[_0x62f5('0x29')](function(_0x1f2617){var _0x844b0f=_0x1f2617[_0x62f5('0x50')]({'plain':!![]});return db['UserProfileSection'][_0x62f5('0x42')]({'where':{'userProfileId':_0x1617de[_0x62f5('0x43')]['id']},'raw':!![]})[_0x62f5('0x29')](function(_0x1410f3){if(_0x1410f3){return BPromise[_0x62f5('0x51')](_0x1410f3,function(_0x4f4c3b){return new BPromise(function(_0x39dee5,_0x41701f){if(_0x4f4c3b[_0x62f5('0x52')]===null||_0x4f4c3b[_0x62f5('0x52')]===0x1)_0x39dee5(null);return db[_0x62f5('0x53')]['findAll']({'where':{'sectionId':_0x4f4c3b['id']},'raw':!![]})[_0x62f5('0x29')](function(_0x2fca48){var _0x43d103=_[_0x62f5('0x2e')](_0x2fca48,function(_0x13e00b){return qs['omit'](_0x13e00b,['id',_0x62f5('0x4d'),_0x62f5('0x4e'),_0x62f5('0x54')]);});_0x39dee5(_0x43d103);})[_0x62f5('0x47')](function(_0x5af425){_0x41701f(_0x5af425);});})[_0x62f5('0x29')](function(_0x4933bd){var _0x33542f=qs[_0x62f5('0x4c')](_0x4f4c3b,['id',_0x62f5('0x4d'),'updatedAt']);_0x33542f[_0x62f5('0x55')]=_0x844b0f['id'];if(_0x4933bd)_0x33542f[_0x62f5('0x56')]=_0x4933bd;return _0x33542f;})[_0x62f5('0x29')](function(_0x175a29){return db[_0x62f5('0x57')][_0x62f5('0x48')](_0x175a29,{'include':[{'model':db['UserProfileResource'],'as':'Resources'}],'raw':!![],'transaction':_0x15c627});});})[_0x62f5('0x29')](function(){return _0x844b0f;});}});});});}})['then'](respondWithResult(_0x206996,0xc9))[_0x62f5('0x47')](handleError(_0x206996,null));};exports[_0x62f5('0x28')]=function(_0x1861e9,_0x24a75f){if(_0x1861e9[_0x62f5('0x49')]['id']){delete _0x1861e9[_0x62f5('0x49')]['id'];}return db[_0x62f5('0x2f')]['find']({'where':{'id':_0x1861e9[_0x62f5('0x43')]['id']}})[_0x62f5('0x29')](handleEntityNotFound(_0x24a75f,null))[_0x62f5('0x29')](saveUpdates(_0x1861e9['body'],null))[_0x62f5('0x29')](respondWithResult(_0x24a75f,null))['catch'](handleError(_0x24a75f,null));};exports[_0x62f5('0x2a')]=function(_0x45ddc7,_0x4a1b07){return db[_0x62f5('0x2f')][_0x62f5('0x4b')]({'where':{'id':_0x45ddc7[_0x62f5('0x43')]['id']}})[_0x62f5('0x29')](handleEntityNotFound(_0x4a1b07,null))['then'](removeEntity(_0x4a1b07,null))[_0x62f5('0x47')](handleError(_0x4a1b07,null));};exports[_0x62f5('0x58')]=function(_0x1dbb78,_0x4d187d){return db['UserProfile'][_0x62f5('0x58')]()[_0x62f5('0x29')](respondWithResult(_0x4d187d,null))['catch'](handleError(_0x4d187d,null));};exports['addSections']=function(_0x40b222,_0x10823f){var _0x458871=_0x40b222['body'];return db[_0x62f5('0x2f')]['find']({'where':{'id':_0x40b222[_0x62f5('0x43')]['id']}})[_0x62f5('0x29')](handleEntityNotFound(_0x10823f,null))[_0x62f5('0x29')](function(_0xe03b45){if(_0xe03b45){return db[_0x62f5('0x59')][_0x62f5('0x5a')](function(_0xd9abdf){return db[_0x62f5('0x57')][_0x62f5('0x2a')]({'where':{'userProfileId':_0x40b222[_0x62f5('0x43')]['id'],'sectionId':_[_0x62f5('0x2e')](_0x458871,function(_0x1b794e){return _0x1b794e[_0x62f5('0x54')];})},'transaction':_0xd9abdf})[_0x62f5('0x29')](function(){var _0x223616=_['map'](_0x458871,function(_0x31299c){_0x31299c[_0x62f5('0x55')]=_0x40b222['params']['id'];return _0x31299c;});var _0xe303a6=[];return BPromise[_0x62f5('0x51')](_0x223616,function(_0x240996){return db[_0x62f5('0x57')][_0x62f5('0x48')](_0x240996,{'include':[{'model':db[_0x62f5('0x53')],'as':'Resources'}],'raw':!![],'transaction':_0xd9abdf})[_0x62f5('0x29')](function(_0x2f1dd3){_0xe303a6[_0x62f5('0x5b')](_0x2f1dd3[_0x62f5('0x50')]({'plain':!![]}));});})['then'](function(){return _0xe303a6;});});});}})[_0x62f5('0x29')](function(_0x3e03b4){return _0x3e03b4;})[_0x62f5('0x29')](respondWithResult(_0x10823f,null))[_0x62f5('0x47')](handleError(_0x10823f,null));};exports['removeSections']=function(_0x24539d,_0x1a4409){var _0x5e81c1;return db['UserProfile'][_0x62f5('0x4b')]({'where':{'id':_0x24539d[_0x62f5('0x43')]['id']},'attributes':['id',_0x62f5('0x2b')]})[_0x62f5('0x29')](handleEntityNotFound(_0x1a4409,null))[_0x62f5('0x29')](function(_0xef4fb7){if(_0xef4fb7){_0x5e81c1=_0xef4fb7;return db[_0x62f5('0x57')][_0x62f5('0x2a')]({'where':{'userProfileId':_0x24539d[_0x62f5('0x43')]['id'],'sectionId':_0x24539d[_0x62f5('0x34')][_0x62f5('0x5c')]}});}})[_0x62f5('0x29')](function(){return _0x5e81c1;})['then'](respondWithStatusCode(_0x1a4409,null))[_0x62f5('0x47')](handleError(_0x1a4409,null));};exports[_0x62f5('0x5d')]=function(_0x310760,_0x1dc99b){var _0x1d157c=[];var _0xe4ee27=[];return db[_0x62f5('0x57')][_0x62f5('0x42')]({'where':{'userProfileId':_0x310760[_0x62f5('0x43')]['id']},'raw':!![]})[_0x62f5('0x29')](function(_0x76dd75){_0x1d157c=_['filter'](_0x76dd75,function(_0x57a77e){return _0x57a77e['enabled']===0x1||_['includes']([0x3eb,0x709],_0x57a77e[_0x62f5('0x54')]);});if(!_['isEmpty'](_0x1d157c)){return _['map'](_0x1d157c,function(_0x5e1b3){return _0x5e1b3[_0x62f5('0x54')];});}else{return;}})['then'](function(_0x5dc5e8){if(_0x5dc5e8)_0xe4ee27=_0x5dc5e8;if(_[_0x62f5('0x5e')](_0xe4ee27,0x64)){var _0x420d02=_[_0x62f5('0x4b')](_0x1d157c,{'sectionId':0x64});return hasDefaultDashboard(_0x420d02)[_0x62f5('0x29')](function(_0x1d0674){return _[_0x62f5('0x2e')](_0x1d157c,function(_0x368fbd){if(_0x368fbd['sectionId']===0x64){_0x368fbd[_0x62f5('0x5f')]=_0x1d0674;}return _0x368fbd;});});}else{return;}})[_0x62f5('0x29')](function(_0x28663b){if(_0x28663b)_0x1d157c=_0x28663b;if(_[_0x62f5('0x5e')](_0xe4ee27,0x3eb)){var _0xaa9aa2=_['find'](_0x1d157c,{'sectionId':0x3eb});return getCustomDashboards(_0xaa9aa2)[_0x62f5('0x29')](function(_0x1d5cd1){return _[_0x62f5('0x2e')](_0x1d157c,function(_0x2bcc58){if(_0xaa9aa2[_0x62f5('0x60')]){if(_0x2bcc58[_0x62f5('0x54')]===0x3eb){_0x2bcc58[_0x62f5('0x5f')]=_0x1d5cd1;}}else{if(_0x2bcc58[_0x62f5('0x54')]===0x64){_0x2bcc58[_0x62f5('0x5f')]=_0x1d5cd1;}}return _0x2bcc58;});});}else{return;}})[_0x62f5('0x29')](function(_0x215396){if(_0x215396)_0x1d157c=_0x215396;if(_[_0x62f5('0x5e')](_0xe4ee27,0x709)){var _0x2a39f7=_[_0x62f5('0x4b')](_0x1d157c,{'sectionId':0x709});return getPlugins(_0x2a39f7)['then'](function(_0x2e3216){if(_0x2a39f7[_0x62f5('0x60')]){return _['map'](_0x1d157c,function(_0x49e4f2){if(_0x49e4f2[_0x62f5('0x54')]===0x709){_0x49e4f2[_0x62f5('0x5f')]=_0x2e3216;}return _0x49e4f2;});}else{var _0x4bee11={'sectionId':0x76c,'enabled':0x1,'subsections':_0x2e3216};var _0x1dbb1a=_[_0x62f5('0x2e')](_0x1d157c);_0x1dbb1a[_0x62f5('0x5b')](_0x4bee11);return _0x1dbb1a;}});}else{return;}})['then'](function(_0x511cd0){if(_0x511cd0)_0x1d157c=_0x511cd0;return _[_0x62f5('0x3f')](_0x1d157c,[_0x62f5('0x60'),0x1]);})['then'](respondWithResult(_0x1dc99b,null))['catch'](handleError(_0x1dc99b,null));};function hasDefaultDashboard(_0x3aeee3){var _0x5c9113=[0x65];return new BPromise(function(_0x1b33b3,_0x1c6d1b){try{if(_0x3aeee3[_0x62f5('0x52')]){_0x1b33b3(_0x5c9113);}else{return db[_0x62f5('0x53')]['findOne']({'where':{'sectionId':_0x3aeee3['id']},'raw':!![]})[_0x62f5('0x29')](function(_0x4b230a){_0x4b230a?_0x1b33b3(_0x5c9113):_0x1b33b3();});}}catch(_0x508ed9){_0x1c6d1b(_0x508ed9);}});}function getCustomDashboards(_0x262fad){var _0x1c01dd=[];return new BPromise(function(_0x578217,_0x1f0284){try{if(_0x262fad['autoAssociation']){return db[_0x62f5('0x61')][_0x62f5('0x42')]({'raw':!![]})[_0x62f5('0x29')](function(_0x421886){_0x421886[_0x62f5('0x62')](function(_0x564d69){_0x1c01dd[_0x62f5('0x5b')](_0x564d69['id']+0x1869f);});_0x578217(_0x1c01dd);});}else{return db[_0x62f5('0x53')][_0x62f5('0x42')]({'where':{'sectionId':_0x262fad['id']},'raw':!![]})['then'](function(_0x1b2e68){_0x1b2e68[_0x62f5('0x62')](function(_0x16f5c8){_0x1c01dd['push'](_0x16f5c8['resourceId']+0x1869f);});_0x578217(_0x1c01dd);});}}catch(_0x422d85){_0x1f0284(_0x422d85);}});}function getPlugins(_0x1b816d){var _0x772910=[];return new BPromise(function(_0x5e30a2,_0x479e83){try{if(_0x1b816d[_0x62f5('0x52')]){return db[_0x62f5('0x63')]['findAll']({'raw':!![]})[_0x62f5('0x29')](function(_0x1ca9f4){_0x1ca9f4['forEach'](function(_0xf00282){_0x772910[_0x62f5('0x5b')](_0xf00282['id']+0x15b38);});_0x5e30a2(_0x772910);});}else{return db[_0x62f5('0x53')][_0x62f5('0x42')]({'where':{'sectionId':_0x1b816d['id']},'raw':!![]})[_0x62f5('0x29')](function(_0x3d1cad){_0x3d1cad[_0x62f5('0x62')](function(_0x53531c){_0x772910['push'](_0x53531c[_0x62f5('0x64')]+0x15b38);});_0x5e30a2(_0x772910);});}}catch(_0x1e1a1e){_0x479e83(_0x1e1a1e);}});}exports[_0x62f5('0x65')]=function(_0x5df87b,_0x116d54){return db['UserProfile'][_0x62f5('0x4b')]({'where':{'id':_0x5df87b[_0x62f5('0x43')]['id']}})['then'](handleEntityNotFound(_0x116d54,null))[_0x62f5('0x29')](function(_0x2fb0f4){if(_0x2fb0f4){return db[_0x62f5('0x59')][_0x62f5('0x5a')](function(_0x34a103){return db['UserProfileSection'][_0x62f5('0x42')]({'where':{'userProfileId':_0x5df87b['params']['id']},'attributes':['id'],'raw':!![]})['then'](function(_0xc0402d){if(_0xc0402d){return db[_0x62f5('0x57')][_0x62f5('0x2a')]({'where':{'userProfileId':_0x5df87b[_0x62f5('0x43')]['id'],'id':_[_0x62f5('0x2e')](_0xc0402d,function(_0x2f7188){return _0x2f7188['id'];})},'transaction':_0x34a103});}})[_0x62f5('0x29')](function(_0x5d623b){var _0x4577e6=_['map'](_0x5df87b['body'],function(_0x2c89a3){_0x2c89a3[_0x62f5('0x55')]=_0x5df87b['params']['id'];return _0x2c89a3;});return db[_0x62f5('0x57')][_0x62f5('0x66')](_0x4577e6,{'raw':!![],'transaction':_0x34a103});})[_0x62f5('0x29')](function(_0x54e4e0){var _0x31e4c1=_['filter'](_[_0x62f5('0x2e')](_0x54e4e0,function(_0x5399fc){return _0x5399fc[_0x62f5('0x50')]({'plain':!![]});}),{'includeAll':![]});if(_0x31e4c1){return db[_0x62f5('0x57')][_0x62f5('0x42')]({'where':{'userProfileId':_0x5df87b[_0x62f5('0x43')]['id'],'sectionId':_[_0x62f5('0x2e')](_0x31e4c1,function(_0x4052cd){return _0x4052cd[_0x62f5('0x54')];})},'attributes':['id',_0x62f5('0x54')],'raw':!![]})[_0x62f5('0x29')](function(_0x44b095){var _0x16325a=_['map'](_0x5df87b[_0x62f5('0x49')],function(_0x5b3585){_0x5b3585[_0x62f5('0x55')]=_0x5df87b[_0x62f5('0x43')]['id'];return _0x5b3585;});return db[_0x62f5('0x53')]['bulkCreate'](_0x16325a,{'raw':!![],'transaction':_0x34a103});});}})[_0x62f5('0x47')](handleError(_0x116d54,null));});}})[_0x62f5('0x29')](function(_0x260cdb){var _0x25b492=_[_0x62f5('0x2e')](_0x260cdb,function(_0x33c257){return _0x33c257[_0x62f5('0x50')]({'plain':!![]});});})[_0x62f5('0x29')](respondWithResult(_0x116d54,null))['catch'](handleError(_0x116d54,null));};exports['removeResources']=function(_0x21936e,_0x377382,_0x4ed002){return db[_0x62f5('0x2f')][_0x62f5('0x4b')]({'where':{'id':_0x21936e[_0x62f5('0x43')]['id']}})['then'](handleEntityNotFound(_0x377382,null))['then'](function(_0x37e05c){if(_0x37e05c){return _0x37e05c[_0x62f5('0x67')](_0x21936e['query'][_0x62f5('0x5c')]);}})['then'](respondWithStatusCode(_0x377382,null))['catch'](handleError(_0x377382,null));};exports[_0x62f5('0x68')]=function(_0x35ed5a,_0x53732a){var _0x2ebcd3={};if(!_0x35ed5a[_0x62f5('0x34')][_0x62f5('0x69')])throw new Error(_0x62f5('0x6a'));if(!_0x35ed5a[_0x62f5('0x34')]['hasOwnProperty'](_0x62f5('0x39'))){_0x2ebcd3[_0x62f5('0x22')]=qs[_0x62f5('0x22')](_0x35ed5a['query']['limit']);_0x2ebcd3['offset']=qs[_0x62f5('0x24')](_0x35ed5a['query'][_0x62f5('0x24')]);}return db[_0x62f5('0x2f')][_0x62f5('0x4b')]({'where':{'id':_0x35ed5a[_0x62f5('0x43')]['id']}})[_0x62f5('0x29')](function(_0x10a216){if(!_0x10a216)throw new Error('No\x20User\x20Profile\x20found\x20for\x20id\x20'+_0x35ed5a['params']['id']);return db['UserProfile'][_0x62f5('0x68')](_0x35ed5a);})[_0x62f5('0x29')](respondWithFilteredResult(_0x53732a,_0x2ebcd3))[_0x62f5('0x47')](handleError(_0x53732a,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 92c6cd5..cd8664c 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 _0xe451=['exports','UserProfile','remove','emit','hasOwnProperty'];(function(_0x46eb8a,_0x121f7e){var _0x50eeeb=function(_0x52ecd3){while(--_0x52ecd3){_0x46eb8a['push'](_0x46eb8a['shift']());}};_0x50eeeb(++_0x121f7e);}(_0xe451,0xec));var _0x1e45=function(_0x392a17,_0x55968c){_0x392a17=_0x392a17-0x0;var _0x61f736=_0xe451[_0x392a17];return _0x61f736;};'use strict';var EventEmitter=require('events');var UserProfile=require('../../mysqldb')['db'][_0x1e45('0x0')];var UserProfileEvents=new EventEmitter();UserProfileEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x1e45('0x1')};function emitEvent(_0x363caa){return function(_0x1f9061,_0x197c03,_0x5cc973){UserProfileEvents[_0x1e45('0x2')](_0x363caa+':'+_0x1f9061['id'],_0x1f9061);UserProfileEvents[_0x1e45('0x2')](_0x363caa,_0x1f9061);_0x5cc973(null);};}for(var e in events){if(events[_0x1e45('0x3')](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module[_0x1e45('0x4')]=UserProfileEvents; \ No newline at end of file +var _0x1c63=['update','remove','emit','hasOwnProperty','events','../../mysqldb','UserProfile','setMaxListeners'];(function(_0x2c9ce8,_0x19783d){var _0x539acd=function(_0x23e74c){while(--_0x23e74c){_0x2c9ce8['push'](_0x2c9ce8['shift']());}};_0x539acd(++_0x19783d);}(_0x1c63,0xdc));var _0x31c6=function(_0x32be74,_0x1c6d78){_0x32be74=_0x32be74-0x0;var _0x59407f=_0x1c63[_0x32be74];return _0x59407f;};'use strict';var EventEmitter=require(_0x31c6('0x0'));var UserProfile=require(_0x31c6('0x1'))['db'][_0x31c6('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x31c6('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x31c6('0x4'),'afterDestroy':_0x31c6('0x5')};function emitEvent(_0x2501a8){return function(_0x598eed,_0x12da33,_0x3c1288){UserProfileEvents[_0x31c6('0x6')](_0x2501a8+':'+_0x598eed['id'],_0x598eed);UserProfileEvents[_0x31c6('0x6')](_0x2501a8,_0x598eed);_0x3c1288(null);};}for(var e in events){if(events[_0x31c6('0x7')](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module['exports']=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 1090643..3361ca0 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 _0x2edd=['ThroughTags','openTabs','true','chat','dataValues','sms','fax','openchannel','lodash','./userProfile.attributes','../../components/parsers/qs','squel','exports','models','filter','field','findAll','then','associatedResources','map','catch','value','model','resolve','UserProfileResource','AnalyticExtractedReport','type','toLowerCase','squareprojects','childModel','SquareProject','odbc','SquareOdbc','SquareRecording','parentSections','SquareProjects','name','projectName','projects','JscriptyProject','CmContact','Lists','ListId','CmList','companies','globalcustomfields','chatqueues','ChatQueue','chatwebsites','ChatWebsite','FaxAccount','outboundroutes','VoiceExtension','contexts','VoiceContext','voicerecordings','VoiceRecording','Agents','User','agent','Telephones','telephone','queue','VoiceQueue','inbound','QueueCampaigns','outbound','musiconholds','VoiceMusicOnHold','chanspies','voiceprefixes','VoicePrefix','ivrcampaigns','mailqueues','MailAccount','MailSubstatus','openchannelqueues','openchannelaccounts','smsqueues','SmsQueue','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','queuecampaigns','VoiceQueues','users','telephones','Users','role','admin','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','customdashboards','intervals','Interval','Pause','scheduler','Sound','tags','Tag','templates','Trigger','trunks','Trunk','variables','Variable','Plugin','extractedreports','Reports','reportId','AnalyticMetric','charAt','toUpperCase','slice','Sequelize','QueryTypes','select','ui.','InteractionId','from','_interactions','where','ui.UserId\x20=\x20?','sequelize','query','OpenTabs','UserProfile','user_profiles','raw','section','mergeResources','isEmpty','length','push','UserProfileSection','find','params','all','union','ignore','autoAssociation','rawAttributes','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','offset','order','sort','pick','merge','key','VIRTUAL','foreignKey','forEach','includeAll','reportType','default','custom','CustomReports','count','rows','include','color','tag'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0x2edd,0xbf));var _0xd2ed=function(_0x5422c8,_0x3ce1fa){_0x5422c8=_0x5422c8-0x0;var _0x2558f7=_0x2edd[_0x5422c8];return _0x2558f7;};'use strict';var _=require(_0xd2ed('0x0'));var attributes=require(_0xd2ed('0x1'));var qs=require(_0xd2ed('0x2'));var squel=require(_0xd2ed('0x3'));module[_0xd2ed('0x4')]=function(_0x372341){var _0x39c04d=_0x372341[_0xd2ed('0x5')];function _0x1788b2(_0x4eb2f5,_0x41424d){return new Promise(function(_0x5e3ddb,_0x3a1b96){if(!_0x41424d)return _0x5e3ddb(null);var _0x486545=_0x41424d[_0xd2ed('0x6')]?{[_0x41424d[_0xd2ed('0x6')][_0xd2ed('0x7')]]:_0x41424d[_0xd2ed('0x6')]['value']}:undefined;return _0x39c04d[_0x4eb2f5][_0xd2ed('0x8')]({'where':_0x486545,'raw':!![]})[_0xd2ed('0x9')](function(_0x4aabf2){_0x41424d[_0xd2ed('0xa')]=_[_0xd2ed('0xb')](_0x4aabf2,'id');_0x5e3ddb(_0x41424d);})[_0xd2ed('0xc')](function(_0x2dc62a){_0x3a1b96(_0x2dc62a);});});}function _0x1d654e(_0x58c47e,_0x354d04){return new Promise(function(_0x495395,_0x3db1a3){var _0x34764f=_0x58c47e[_0xd2ed('0x6')]?{[_0x58c47e['filter'][_0xd2ed('0x7')]]:_0x58c47e[_0xd2ed('0x6')][_0xd2ed('0xd')]}:undefined;return _0x39c04d[_0x58c47e[_0xd2ed('0xe')]][_0xd2ed('0x8')]({'where':_0x34764f,'raw':!![]})['then'](function(_0xc95a25){_0x354d04[_0xd2ed('0xa')]=_['map'](_0xc95a25,function(_0x5d3cd7){return _0x5d3cd7['name'];});_0x495395(_0x354d04);})[_0xd2ed('0xc')](function(_0x2240d4){_0x3db1a3(_0x2240d4);});});}function _0xb98f36(_0x1770ac,_0x47c7a1,_0x129f79){if(!_0x47c7a1)return Promise[_0xd2ed('0xf')](null);return new Promise(function(_0x2e2cd5,_0x46afb3){return _0x39c04d[_0xd2ed('0x10')][_0xd2ed('0x8')]({'where':{'sectionId':_0x47c7a1['id']},'raw':!![]})[_0xd2ed('0x9')](function(_0xdf033e){if(_0x1770ac[_0xd2ed('0x7')]&&_0x1770ac[_0xd2ed('0x7')]!=='id'){_0x47c7a1[_0xd2ed('0xa')]=_[_0xd2ed('0xb')](_0xdf033e,function(_0x14c486){return _0x14c486[_0x1770ac[_0xd2ed('0x7')]];});}else{if(_0x129f79===_0xd2ed('0x11')){_0x47c7a1[_0xd2ed('0xa')]=_['map'](_0xdf033e,function(_0x80bff2){return{'id':_0x80bff2['resourceId'],'type':_0x80bff2[_0xd2ed('0x12')]};});}else{_0x47c7a1[_0xd2ed('0xa')]=_[_0xd2ed('0xb')](_0xdf033e,function(_0x19377e){return _0x19377e['resourceId'];});}}_0x2e2cd5(_0x47c7a1);})[_0xd2ed('0xc')](function(_0x180211){_0x46afb3(_0x180211);});});}function _0x5a8cd5(_0x297c8d,_0x59d391){var _0x2c7be3={'parentSections':[]};switch(_0x297c8d[_0xd2ed('0x13')]()){case _0xd2ed('0x14'):_0x2c7be3[_0xd2ed('0x15')]=_0xd2ed('0x16');break;case _0xd2ed('0x17'):_0x2c7be3[_0xd2ed('0x15')]=_0xd2ed('0x18');break;case'squarerecordings':_0x2c7be3['childModel']=_0xd2ed('0x19');_0x2c7be3[_0xd2ed('0x1a')]=[{'name':_0xd2ed('0x1b'),'field':_0xd2ed('0x1c'),'foreignKey':_0xd2ed('0x1d')}];break;case _0xd2ed('0x1e'):_0x2c7be3[_0xd2ed('0x15')]=_0xd2ed('0x1f');break;case'contacts':_0x2c7be3['childModel']=_0xd2ed('0x20');_0x2c7be3['parentSections']=[{'name':_0xd2ed('0x21'),'field':'id','foreignKey':_0xd2ed('0x22')}];break;case'lists':_0x2c7be3['childModel']=_0xd2ed('0x23');break;case _0xd2ed('0x24'):_0x2c7be3[_0xd2ed('0x15')]='CmCompany';break;case _0xd2ed('0x25'):_0x2c7be3[_0xd2ed('0x15')]='CmCustomField';break;case _0xd2ed('0x26'):_0x2c7be3['childModel']=_0xd2ed('0x27');break;case _0xd2ed('0x28'):_0x2c7be3[_0xd2ed('0x15')]=_0xd2ed('0x29');break;case'faxqueues':_0x2c7be3[_0xd2ed('0x15')]='FaxQueue';break;case'faxaccounts':_0x2c7be3[_0xd2ed('0x15')]=_0xd2ed('0x2a');break;case'inboundroutes':case'internalroutes':case _0xd2ed('0x2b'):_0x2c7be3[_0xd2ed('0x15')]=_0xd2ed('0x2c');break;case _0xd2ed('0x2d'):_0x2c7be3['childModel']=_0xd2ed('0x2e');break;case'voicemails':_0x2c7be3[_0xd2ed('0x15')]='VoiceMail';break;case _0xd2ed('0x2f'):_0x2c7be3[_0xd2ed('0x15')]=_0xd2ed('0x30');_0x2c7be3['parentSections']=[{'name':_0xd2ed('0x31'),'field':_0xd2ed('0x1c'),'foreignKey':'membername','model':_0xd2ed('0x32'),'filter':{'field':'role','value':[_0xd2ed('0x33')]}},{'name':_0xd2ed('0x34'),'field':'name','foreignKey':'membername','model':_0xd2ed('0x32'),'filter':{'field':'role','value':[_0xd2ed('0x35')]}},{'name':'VoiceQueues','field':'name','foreignKey':_0xd2ed('0x36'),'model':_0xd2ed('0x37'),'filter':{'field':_0xd2ed('0x12'),'value':[_0xd2ed('0x38')]}},{'name':_0xd2ed('0x39'),'field':_0xd2ed('0x1c'),'foreignKey':_0xd2ed('0x36'),'model':_0xd2ed('0x37'),'filter':{'field':_0xd2ed('0x12'),'value':[_0xd2ed('0x3a')]}}];break;case _0xd2ed('0x3b'):_0x2c7be3[_0xd2ed('0x15')]=_0xd2ed('0x3c');break;case _0xd2ed('0x3d'):_0x2c7be3[_0xd2ed('0x15')]='VoiceChanSpy';break;case _0xd2ed('0x3e'):_0x2c7be3[_0xd2ed('0x15')]=_0xd2ed('0x3f');break;case _0xd2ed('0x40'):_0x2c7be3[_0xd2ed('0x15')]='Campaign';break;case _0xd2ed('0x41'):_0x2c7be3[_0xd2ed('0x15')]='MailQueue';break;case'mailaccounts':_0x2c7be3[_0xd2ed('0x15')]=_0xd2ed('0x42');break;case'mailsubstatuses':_0x2c7be3[_0xd2ed('0x15')]=_0xd2ed('0x43');break;case _0xd2ed('0x44'):_0x2c7be3['childModel']='OpenchannelQueue';break;case _0xd2ed('0x45'):_0x2c7be3[_0xd2ed('0x15')]='OpenchannelAccount';break;case _0xd2ed('0x46'):_0x2c7be3['childModel']=_0xd2ed('0x47');break;case'smsaccounts':_0x2c7be3[_0xd2ed('0x15')]=_0xd2ed('0x48');break;case _0xd2ed('0x49'):_0x2c7be3[_0xd2ed('0x15')]=_0xd2ed('0x4a');break;case _0xd2ed('0x4b'):_0x2c7be3['childModel']=_0xd2ed('0x4c');break;case _0xd2ed('0x4d'):_0x2c7be3[_0xd2ed('0x15')]='Team';break;case'voicequeues':case _0xd2ed('0x4e'):_0x2c7be3['childModel']=_0xd2ed('0x37');if(_0x59d391){_0x2c7be3['parentSections']=[{'name':_0xd2ed('0x4f')},{'name':_0xd2ed('0x39')}];}break;case _0xd2ed('0x50'):case'agents':case _0xd2ed('0x51'):_0x2c7be3['childModel']=_0xd2ed('0x32');if(_0x59d391){_0x2c7be3[_0xd2ed('0x1a')]=[{'name':_0xd2ed('0x52'),'filter':{'field':_0xd2ed('0x53'),'value':[_0xd2ed('0x54'),'user']},'ignore':!![]},{'name':'Agents'},{'name':_0xd2ed('0x34')}];}break;case _0xd2ed('0x55'):_0x2c7be3[_0xd2ed('0x15')]=_0xd2ed('0x56');break;case _0xd2ed('0x57'):_0x2c7be3[_0xd2ed('0x15')]=_0xd2ed('0x58');break;case _0xd2ed('0x59'):_0x2c7be3['childModel']=_0xd2ed('0x5a');break;case'sugarcrmaccounts':_0x2c7be3[_0xd2ed('0x15')]='SugarcrmAccount';break;case _0xd2ed('0x5b'):_0x2c7be3[_0xd2ed('0x15')]=_0xd2ed('0x5c');break;case _0xd2ed('0x5d'):_0x2c7be3['childModel']=_0xd2ed('0x5e');break;case _0xd2ed('0x5f'):_0x2c7be3[_0xd2ed('0x15')]=_0xd2ed('0x32');break;case _0xd2ed('0x60'):_0x2c7be3[_0xd2ed('0x15')]=_0xd2ed('0x61');break;case'dispositions':_0x2c7be3[_0xd2ed('0x15')]='Disposition';break;case _0xd2ed('0x62'):_0x2c7be3['childModel']='Dashboard';break;case _0xd2ed('0x63'):_0x2c7be3[_0xd2ed('0x15')]=_0xd2ed('0x64');break;case'pauses':_0x2c7be3[_0xd2ed('0x15')]=_0xd2ed('0x65');break;case _0xd2ed('0x66'):_0x2c7be3[_0xd2ed('0x15')]='Schedule';break;case'sounds':_0x2c7be3[_0xd2ed('0x15')]=_0xd2ed('0x67');break;case _0xd2ed('0x68'):_0x2c7be3[_0xd2ed('0x15')]=_0xd2ed('0x69');break;case _0xd2ed('0x6a'):_0x2c7be3['childModel']='Template';break;case'triggers':_0x2c7be3[_0xd2ed('0x15')]=_0xd2ed('0x6b');break;case _0xd2ed('0x6c'):_0x2c7be3['childModel']=_0xd2ed('0x6d');break;case _0xd2ed('0x6e'):_0x2c7be3[_0xd2ed('0x15')]=_0xd2ed('0x6f');break;case'plugins':_0x2c7be3['childModel']=_0xd2ed('0x70');break;case _0xd2ed('0x71'):_0x2c7be3[_0xd2ed('0x15')]=_0xd2ed('0x11');_0x2c7be3[_0xd2ed('0x1a')]=[{'name':_0xd2ed('0x72'),'field':'id','foreignKey':_0xd2ed('0x73')}];break;case'metrics':_0x2c7be3[_0xd2ed('0x15')]=_0xd2ed('0x74');break;}return _0x2c7be3;}function _0x522700(_0x1d2f17,_0xc394b3){var _0x1addac=_0x1d2f17[_0xd2ed('0x75')](0x0)[_0xd2ed('0x76')]()+_0x1d2f17[_0xd2ed('0x77')](0x1);var _0x6af6cb={'type':_0x39c04d[_0xd2ed('0x78')][_0xd2ed('0x79')]['SELECT'],'raw':!![]};return new Promise(function(_0x490692,_0x4f22cc){var _0x2dcdef=squel[_0xd2ed('0x7a')]()[_0xd2ed('0x7')](_0xd2ed('0x7b')+_0x1addac+_0xd2ed('0x7c'),'id')[_0xd2ed('0x7')]('ui.createdAt')[_0xd2ed('0x7d')]('user_has_'+_0x1d2f17+_0xd2ed('0x7e'),'ui')[_0xd2ed('0x7f')](_0xd2ed('0x80'),_0xc394b3['id']);return _0x39c04d[_0xd2ed('0x81')][_0xd2ed('0x82')](_0x2dcdef['toString'](),_0x6af6cb)[_0xd2ed('0x9')](function(_0x3f84a9){_0xc394b3[_0x1addac+_0xd2ed('0x83')]=_0x3f84a9;_0x490692(_0x3f84a9);})[_0xd2ed('0xc')](function(_0x28231d){_0x4f22cc(_0x28231d);});});}return _0x372341['define'](_0xd2ed('0x84'),attributes,{'tableName':_0xd2ed('0x85'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x5209a8){var _0xdd493a={'raw':_0x5209a8[_0xd2ed('0x82')][_0xd2ed('0x86')],'where':{}};var _0x3c30d5={};var _0x5a9003={'count':0x0,'rows':[]};var _0x35bbc1=_0x5209a8[_0xd2ed('0x82')][_0xd2ed('0x87')];var _0x3936a5=_0x5209a8[_0xd2ed('0x82')][_0xd2ed('0x88')]||![];var _0x2b83e7=_0x5a8cd5(_0x35bbc1,_0x3936a5);if(!_0x2b83e7[_0xd2ed('0x15')])throw new Error('Invalid\x20section\x20\x27'+_0x35bbc1+'\x27');var _0x28a539=[{'name':_0x35bbc1}];if(!_[_0xd2ed('0x89')](_0x2b83e7['parentSections']))_0x28a539=_0x2b83e7[_0xd2ed('0x1a')];var _0x2c179a=[];for(var _0x8d520c=0x0;_0x8d520c<_0x28a539[_0xd2ed('0x8a')];_0x8d520c++){_0x2c179a[_0xd2ed('0x8b')](_0x39c04d[_0xd2ed('0x8c')][_0xd2ed('0x8d')]({'where':{'userProfileId':_0x5209a8[_0xd2ed('0x8e')]['id'],'name':_0x28a539[_0x8d520c][_0xd2ed('0x1c')]},'raw':!![]}));}return Promise[_0xd2ed('0x8f')](_0x2c179a)[_0xd2ed('0x9')](function(_0x44b620){var _0x53bed3=_[_0xd2ed('0x6')](_0x44b620,function(_0x175047){return _0x175047?_0x175047:undefined;});var _0x314556=_[_0xd2ed('0x6')](_0x28a539,['ignore',!![]]);var _0x5c6558=_['isEmpty'](_0x53bed3)&&_[_0xd2ed('0x89')](_0x314556)?null:_[_0xd2ed('0x90')](_0x314556,_0x53bed3);if(!_0x5c6558)return null;var _0x5dc1c4=[];for(var _0x356ca0=0x0;_0x356ca0<_0x5c6558[_0xd2ed('0x8a')];_0x356ca0++){var _0x590221=_[_0xd2ed('0x8d')](_0x28a539,function(_0x3cca6c){return _0x5c6558[_0x356ca0]?_0x3cca6c[_0xd2ed('0x1c')]===_0x5c6558[_0x356ca0][_0xd2ed('0x1c')]:null;});if(_0x590221){if(_0x5c6558[_0x356ca0][_0xd2ed('0x91')]){_0x5dc1c4['push'](_0x1788b2(_0x2b83e7[_0xd2ed('0x15')],_0x5c6558[_0x356ca0]));}else{if(!_0x5c6558[_0x356ca0][_0xd2ed('0x92')]){_0x5dc1c4[_0xd2ed('0x8b')](_0xb98f36(_0x590221,_0x5c6558[_0x356ca0],_0x2b83e7[_0xd2ed('0x15')]));}else{if(_0x590221['model']){_0x5dc1c4[_0xd2ed('0x8b')](_0x1d654e(_0x590221,_0x5c6558[_0x356ca0]));}}}}}return Promise['all'](_0x5dc1c4);})[_0xd2ed('0x9')](function(_0x1a40d4){var _0xe0a767=_0x1a40d4;var _0x3278aa=null;if(_0xe0a767){_0x3278aa=_0xe0a767['length']===0x1?_0xe0a767[0x0]:null;}if(!_0x3278aa&&!_0xe0a767)return _0x5a9003;var _0x30e8bd=_0x39c04d[_0x2b83e7['childModel']][_0xd2ed('0x93')];_0x3c30d5['model']=_[_0xd2ed('0x94')](_0x30e8bd);_0x3c30d5[_0xd2ed('0x82')]=_[_0xd2ed('0x94')](_0x5209a8['query']);_0x3c30d5[_0xd2ed('0x95')]=_[_0xd2ed('0x96')](_0x3c30d5[_0xd2ed('0xe')],_0x3c30d5[_0xd2ed('0x82')]);_0xdd493a[_0xd2ed('0x97')]=_['intersection'](_0x3c30d5[_0xd2ed('0xe')],qs[_0xd2ed('0x98')](_0x5209a8[_0xd2ed('0x82')][_0xd2ed('0x98')]));_0xdd493a[_0xd2ed('0x97')]=_0xdd493a['attributes'][_0xd2ed('0x8a')]?_0xdd493a['attributes']:_0x3c30d5[_0xd2ed('0xe')];if(!_0x5209a8[_0xd2ed('0x82')][_0xd2ed('0x99')](_0xd2ed('0x9a'))){_0xdd493a[_0xd2ed('0x9b')]=qs['limit'](_0x5209a8['query'][_0xd2ed('0x9b')]);_0xdd493a[_0xd2ed('0x9c')]=qs[_0xd2ed('0x9c')](_0x5209a8[_0xd2ed('0x82')][_0xd2ed('0x9c')]);}_0xdd493a[_0xd2ed('0x9d')]=qs[_0xd2ed('0x9e')](_0x5209a8['query']['sort']);_0xdd493a['where']=qs['filters'](_[_0xd2ed('0x9f')](_0x5209a8[_0xd2ed('0x82')],_0x3c30d5[_0xd2ed('0x95')]));if(_0x5209a8[_0xd2ed('0x82')][_0xd2ed('0x6')]){_0xdd493a['where']=_[_0xd2ed('0xa0')](_0xdd493a[_0xd2ed('0x7f')],{'$or':_['map'](_0x30e8bd,function(_0x42fed8){if(_0x42fed8[_0xd2ed('0x12')][_0xd2ed('0xa1')]!==_0xd2ed('0xa2')){var _0x5a5391={};_0x5a5391[_0x42fed8[_0xd2ed('0x7')]]={'$like':'%'+_0x5209a8[_0xd2ed('0x82')]['filter']+'%'};return _0x5a5391;}})});}var _0x1a8d1d=[];var _0x5877cb=null;var _0x592831={};if(_0x3278aa){_0x5877cb=_['find'](_0x28a539,[_0xd2ed('0x1c'),_0x3278aa[_0xd2ed('0x1c')]]);if(_0x5877cb['field']){_0x592831={};if(_0x2b83e7[_0xd2ed('0x15')]===_0xd2ed('0x11')){_0x592831[_0x5877cb['foreignKey']]=_[_0xd2ed('0xb')](_0x3278aa['associatedResources'],'id');}else{_0x592831[_0x5877cb[_0xd2ed('0xa3')]]=_0x3278aa[_0xd2ed('0xa')];}_0x1a8d1d['push'](_0x592831);}else{_0xdd493a['where']['id']=_0x3278aa[_0xd2ed('0xa')];}}else{for(var _0xeaa07e=0x0;_0xeaa07e<_0xe0a767[_0xd2ed('0x8a')];_0xeaa07e++){_0x5877cb=_['find'](_0x28a539,[_0xd2ed('0x1c'),_0xe0a767[_0xeaa07e][_0xd2ed('0x1c')]]);if(_0x5877cb[_0xd2ed('0x7')]){_0x592831={};_0x592831[_0x5877cb[_0xd2ed('0xa3')]]=_0xe0a767[_0xeaa07e][_0xd2ed('0xa')];_0x1a8d1d[_0xd2ed('0x8b')](_0x592831);}else{if(!_0xdd493a[_0xd2ed('0x7f')]['id'])_0xdd493a[_0xd2ed('0x7f')]['id']=[];_0xe0a767[_0xeaa07e]['associatedResources'][_0xd2ed('0xa4')](function(_0x4812bc){_0xdd493a['where']['id'][_0xd2ed('0x8b')](_0x4812bc);});}}}if(!_['isEmpty'](_0x1a8d1d)){_0xdd493a['where']=_[_0xd2ed('0xa0')](_0xdd493a[_0xd2ed('0x7f')],{'$and':{'$or':_0x1a8d1d}});}_0xdd493a=_[_0xd2ed('0xa0')]({},_0xdd493a,_0x5209a8['options']);if(_0x3278aa&&!_0x3278aa['autoAssociation']&&_0x2b83e7[_0xd2ed('0x15')]===_0xd2ed('0x11')){if(_0x5209a8[_0xd2ed('0x82')][_0xd2ed('0xa5')]){_0xdd493a['include']=[{'all':!![]}];}return _0x39c04d[_0x2b83e7[_0xd2ed('0x15')]][_0xd2ed('0x8')](_0xdd493a)['then'](function(_0x181071){var _0x3b94b3=[];_0x181071[_0xd2ed('0xa4')](function(_0x4aec2d){var _0x8caaba;switch(_0x4aec2d[_0xd2ed('0xa6')]){case _0xd2ed('0xa7'):_0x8caaba=_['find'](_0x3278aa[_0xd2ed('0xa')],function(_0x451aec){return _0x451aec['id']===_0x4aec2d['reportId']&&_0x451aec[_0xd2ed('0x12')]==='DefaultReports';});break;case _0xd2ed('0xa8'):_0x8caaba=_[_0xd2ed('0x8d')](_0x3278aa[_0xd2ed('0xa')],function(_0x1648a7){return _0x1648a7['id']===_0x4aec2d[_0xd2ed('0x73')]&&_0x1648a7[_0xd2ed('0x12')]===_0xd2ed('0xa9');});break;}if(_0x8caaba)_0x3b94b3['push'](_0x4aec2d);});_0x5a9003[_0xd2ed('0xaa')]=_0x3b94b3['length'];_0x5a9003[_0xd2ed('0xab')]=_0x3b94b3;return _0x5a9003;});}else{return _0x39c04d[_0x2b83e7[_0xd2ed('0x15')]][_0xd2ed('0xaa')]({'where':_0xdd493a[_0xd2ed('0x7f')]})['then'](function(_0x456c2c){_0x5a9003[_0xd2ed('0xaa')]=_0x456c2c;if(_0x5209a8[_0xd2ed('0x82')][_0xd2ed('0xa5')]){if(_0x2b83e7[_0xd2ed('0x15')]===_0xd2ed('0x20')){_0xdd493a[_0xd2ed('0xac')]=[{'model':_0x39c04d[_0xd2ed('0x69')],'as':'Tags','attributes':['id',_0xd2ed('0x1c'),_0xd2ed('0xad')],'required':_0x5209a8[_0xd2ed('0x82')][_0xd2ed('0xae')]?!![]:![]},{'model':_0x39c04d[_0xd2ed('0x69')],'as':_0xd2ed('0xaf'),'attributes':['id',_0xd2ed('0x1c'),_0xd2ed('0xad')],'through':_0x5209a8[_0xd2ed('0x82')][_0xd2ed('0xae')]?{'attributes':[],'where':{'TagId':_0x5209a8[_0xd2ed('0x82')][_0xd2ed('0xae')]||undefined}}:{},'required':_0x5209a8[_0xd2ed('0x82')][_0xd2ed('0xae')]?!![]:![]}];}else{_0xdd493a[_0xd2ed('0xac')]=[{'all':!![]}];}}return _0x39c04d[_0x2b83e7[_0xd2ed('0x15')]][_0xd2ed('0x8')](_0xdd493a);})[_0xd2ed('0x9')](function(_0x31f27c){_0x5a9003[_0xd2ed('0xab')]=_0x31f27c;if(_0x35bbc1===_0xd2ed('0x31')&&_0x5209a8[_0xd2ed('0x82')][_0xd2ed('0xb0')]===_0xd2ed('0xb1')){var _0x1e5b17=[];for(var _0x3121e1=0x0;_0x3121e1<_0x5a9003[_0xd2ed('0xab')][_0xd2ed('0x8a')];_0x3121e1++){_0x1e5b17[_0xd2ed('0x8b')](_0x522700(_0xd2ed('0xb2'),_0x5a9003[_0xd2ed('0xab')][_0x3121e1][_0xd2ed('0xb3')]));_0x1e5b17[_0xd2ed('0x8b')](_0x522700(_0xd2ed('0xb4'),_0x5a9003['rows'][_0x3121e1][_0xd2ed('0xb3')]));_0x1e5b17[_0xd2ed('0x8b')](_0x522700(_0xd2ed('0xb5'),_0x5a9003['rows'][_0x3121e1]['dataValues']));_0x1e5b17['push'](_0x522700('mail',_0x5a9003[_0xd2ed('0xab')][_0x3121e1][_0xd2ed('0xb3')]));_0x1e5b17[_0xd2ed('0x8b')](_0x522700(_0xd2ed('0xb6'),_0x5a9003['rows'][_0x3121e1]['dataValues']));_0x1e5b17[_0xd2ed('0x8b')](_0x522700('whatsapp',_0x5a9003[_0xd2ed('0xab')][_0x3121e1][_0xd2ed('0xb3')]));}return Promise[_0xd2ed('0x8f')](_0x1e5b17)[_0xd2ed('0x9')](function(){return _0x5a9003;});}return _0x5a9003;});}});}}});}; \ No newline at end of file +var _0xb68b=['WhatsappQueue','WhatsappAccount','voicequeues','queuecampaigns','parentSections','users','agents','telephones','admin','user','Telephones','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','CannedAnswer','dispositions','customdashboards','Dashboard','intervals','Interval','pauses','scheduler','Schedule','sounds','Sound','tags','Tag','triggers','Trigger','Trunk','variables','Variable','plugins','Plugin','Reports','reportId','metrics','charAt','toUpperCase','QueryTypes','SELECT','select','ui.','InteractionId','ui.createdAt','sequelize','query','define','UserProfile','raw','section','mergeResources','Invalid\x20section\x20\x27','length','push','UserProfileSection','find','isEmpty','union','ignore','autoAssociation','model','all','keys','filters','intersection','attributes','fields','nolimit','limit','offset','sort','where','pick','key','foreignKey','forEach','merge','options','includeAll','include','reportType','default','DefaultReports','custom','CustomReports','rows','count','Tags','tag','true','chat','dataValues','sms','fax','whatsapp','lodash','./userProfile.attributes','../../components/parsers/qs','squel','models','filter','findAll','associatedResources','catch','value','then','UserProfileResource','field','map','AnalyticExtractedReport','resourceId','type','toLowerCase','SquareProject','odbc','childModel','SquareOdbc','name','projectName','projects','JscriptyProject','contacts','CmContact','Lists','ListId','lists','companies','CmCompany','CmCustomField','chatqueues','ChatQueue','chatwebsites','faxqueues','faxaccounts','FaxAccount','internalroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','voicerecordings','VoiceRecording','Agents','membername','role','agent','User','telephone','VoiceQueues','queue','VoiceQueue','inbound','QueueCampaigns','VoiceMusicOnHold','chanspies','voiceprefixes','Campaign','mailaccounts','MailSubstatus','openchannelqueues','openchannelaccounts','OpenchannelAccount','smsaccounts','SmsAccount'];(function(_0xb9234d,_0x566e12){var _0x55008a=function(_0x2612c1){while(--_0x2612c1){_0xb9234d['push'](_0xb9234d['shift']());}};_0x55008a(++_0x566e12);}(_0xb68b,0x116));var _0xbb68=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0xb68b[_0x25e7cb];return _0x375d92;};'use strict';var _=require(_0xbb68('0x0'));var attributes=require(_0xbb68('0x1'));var qs=require(_0xbb68('0x2'));var squel=require(_0xbb68('0x3'));module['exports']=function(_0x4d023d){var _0x4372d1=_0x4d023d[_0xbb68('0x4')];function _0x307d1d(_0x11f265,_0x4b0a81){return new Promise(function(_0x5c8268,_0x39fc9c){if(!_0x4b0a81)return _0x5c8268(null);var _0x1db7ef=_0x4b0a81[_0xbb68('0x5')]?{[_0x4b0a81[_0xbb68('0x5')]['field']]:_0x4b0a81['filter']['value']}:undefined;return _0x4372d1[_0x11f265][_0xbb68('0x6')]({'where':_0x1db7ef,'raw':!![]})['then'](function(_0x24281e){_0x4b0a81[_0xbb68('0x7')]=_['map'](_0x24281e,'id');_0x5c8268(_0x4b0a81);})[_0xbb68('0x8')](function(_0x54f1ab){_0x39fc9c(_0x54f1ab);});});}function _0x5b7978(_0x3f8620,_0x1aadd8){return new Promise(function(_0x557e86,_0x13ac82){var _0x2b28c6=_0x3f8620[_0xbb68('0x5')]?{[_0x3f8620[_0xbb68('0x5')]['field']]:_0x3f8620[_0xbb68('0x5')][_0xbb68('0x9')]}:undefined;return _0x4372d1[_0x3f8620['model']][_0xbb68('0x6')]({'where':_0x2b28c6,'raw':!![]})[_0xbb68('0xa')](function(_0x33804e){_0x1aadd8[_0xbb68('0x7')]=_['map'](_0x33804e,function(_0x4bc380){return _0x4bc380['name'];});_0x557e86(_0x1aadd8);})['catch'](function(_0x3704bd){_0x13ac82(_0x3704bd);});});}function _0x1b86a0(_0xf6fbcf,_0x3f808d,_0x294381){if(!_0x3f808d)return Promise['resolve'](null);return new Promise(function(_0x3effae,_0xe1b634){return _0x4372d1[_0xbb68('0xb')][_0xbb68('0x6')]({'where':{'sectionId':_0x3f808d['id']},'raw':!![]})[_0xbb68('0xa')](function(_0x3f83be){if(_0xf6fbcf[_0xbb68('0xc')]&&_0xf6fbcf['field']!=='id'){_0x3f808d[_0xbb68('0x7')]=_[_0xbb68('0xd')](_0x3f83be,function(_0x7345cb){return _0x7345cb[_0xf6fbcf[_0xbb68('0xc')]];});}else{if(_0x294381===_0xbb68('0xe')){_0x3f808d[_0xbb68('0x7')]=_[_0xbb68('0xd')](_0x3f83be,function(_0x5ba0b3){return{'id':_0x5ba0b3[_0xbb68('0xf')],'type':_0x5ba0b3[_0xbb68('0x10')]};});}else{_0x3f808d[_0xbb68('0x7')]=_[_0xbb68('0xd')](_0x3f83be,function(_0x10b19b){return _0x10b19b[_0xbb68('0xf')];});}}_0x3effae(_0x3f808d);})[_0xbb68('0x8')](function(_0x345400){_0xe1b634(_0x345400);});});}function _0x4a3c51(_0x403cf9,_0x4f09e4){var _0x5163c={'parentSections':[]};switch(_0x403cf9[_0xbb68('0x11')]()){case'squareprojects':_0x5163c['childModel']=_0xbb68('0x12');break;case _0xbb68('0x13'):_0x5163c[_0xbb68('0x14')]=_0xbb68('0x15');break;case'squarerecordings':_0x5163c[_0xbb68('0x14')]='SquareRecording';_0x5163c['parentSections']=[{'name':'SquareProjects','field':_0xbb68('0x16'),'foreignKey':_0xbb68('0x17')}];break;case _0xbb68('0x18'):_0x5163c[_0xbb68('0x14')]=_0xbb68('0x19');break;case _0xbb68('0x1a'):_0x5163c['childModel']=_0xbb68('0x1b');_0x5163c['parentSections']=[{'name':_0xbb68('0x1c'),'field':'id','foreignKey':_0xbb68('0x1d')}];break;case _0xbb68('0x1e'):_0x5163c[_0xbb68('0x14')]='CmList';break;case _0xbb68('0x1f'):_0x5163c[_0xbb68('0x14')]=_0xbb68('0x20');break;case'globalcustomfields':_0x5163c[_0xbb68('0x14')]=_0xbb68('0x21');break;case _0xbb68('0x22'):_0x5163c[_0xbb68('0x14')]=_0xbb68('0x23');break;case _0xbb68('0x24'):_0x5163c['childModel']='ChatWebsite';break;case _0xbb68('0x25'):_0x5163c['childModel']='FaxQueue';break;case _0xbb68('0x26'):_0x5163c[_0xbb68('0x14')]=_0xbb68('0x27');break;case'inboundroutes':case _0xbb68('0x28'):case _0xbb68('0x29'):_0x5163c[_0xbb68('0x14')]=_0xbb68('0x2a');break;case _0xbb68('0x2b'):_0x5163c[_0xbb68('0x14')]=_0xbb68('0x2c');break;case _0xbb68('0x2d'):_0x5163c[_0xbb68('0x14')]='VoiceMail';break;case _0xbb68('0x2e'):_0x5163c[_0xbb68('0x14')]=_0xbb68('0x2f');_0x5163c['parentSections']=[{'name':_0xbb68('0x30'),'field':_0xbb68('0x16'),'foreignKey':_0xbb68('0x31'),'model':'User','filter':{'field':_0xbb68('0x32'),'value':[_0xbb68('0x33')]}},{'name':'Telephones','field':'name','foreignKey':'membername','model':_0xbb68('0x34'),'filter':{'field':_0xbb68('0x32'),'value':[_0xbb68('0x35')]}},{'name':_0xbb68('0x36'),'field':_0xbb68('0x16'),'foreignKey':_0xbb68('0x37'),'model':_0xbb68('0x38'),'filter':{'field':_0xbb68('0x10'),'value':[_0xbb68('0x39')]}},{'name':_0xbb68('0x3a'),'field':_0xbb68('0x16'),'foreignKey':_0xbb68('0x37'),'model':'VoiceQueue','filter':{'field':_0xbb68('0x10'),'value':['outbound']}}];break;case'musiconholds':_0x5163c[_0xbb68('0x14')]=_0xbb68('0x3b');break;case _0xbb68('0x3c'):_0x5163c[_0xbb68('0x14')]='VoiceChanSpy';break;case _0xbb68('0x3d'):_0x5163c[_0xbb68('0x14')]='VoicePrefix';break;case'ivrcampaigns':_0x5163c[_0xbb68('0x14')]=_0xbb68('0x3e');break;case'mailqueues':_0x5163c[_0xbb68('0x14')]='MailQueue';break;case _0xbb68('0x3f'):_0x5163c[_0xbb68('0x14')]='MailAccount';break;case'mailsubstatuses':_0x5163c[_0xbb68('0x14')]=_0xbb68('0x40');break;case _0xbb68('0x41'):_0x5163c[_0xbb68('0x14')]='OpenchannelQueue';break;case _0xbb68('0x42'):_0x5163c['childModel']=_0xbb68('0x43');break;case'smsqueues':_0x5163c['childModel']='SmsQueue';break;case _0xbb68('0x44'):_0x5163c[_0xbb68('0x14')]=_0xbb68('0x45');break;case'whatsappqueues':_0x5163c[_0xbb68('0x14')]=_0xbb68('0x46');break;case'whatsappaccounts':_0x5163c[_0xbb68('0x14')]=_0xbb68('0x47');break;case'teams':_0x5163c[_0xbb68('0x14')]='Team';break;case _0xbb68('0x48'):case _0xbb68('0x49'):_0x5163c[_0xbb68('0x14')]=_0xbb68('0x38');if(_0x4f09e4){_0x5163c[_0xbb68('0x4a')]=[{'name':_0xbb68('0x36')},{'name':'QueueCampaigns'}];}break;case _0xbb68('0x4b'):case _0xbb68('0x4c'):case _0xbb68('0x4d'):_0x5163c[_0xbb68('0x14')]=_0xbb68('0x34');if(_0x4f09e4){_0x5163c[_0xbb68('0x4a')]=[{'name':'Users','filter':{'field':'role','value':[_0xbb68('0x4e'),_0xbb68('0x4f')]},'ignore':!![]},{'name':'Agents'},{'name':_0xbb68('0x50')}];}break;case _0xbb68('0x51'):_0x5163c[_0xbb68('0x14')]=_0xbb68('0x52');break;case _0xbb68('0x53'):_0x5163c[_0xbb68('0x14')]=_0xbb68('0x54');break;case _0xbb68('0x55'):_0x5163c['childModel']=_0xbb68('0x56');break;case _0xbb68('0x57'):_0x5163c[_0xbb68('0x14')]='SugarcrmAccount';break;case'deskaccounts':_0x5163c[_0xbb68('0x14')]=_0xbb68('0x58');break;case _0xbb68('0x59'):_0x5163c['childModel']=_0xbb68('0x5a');break;case _0xbb68('0x5b'):_0x5163c[_0xbb68('0x14')]=_0xbb68('0x34');break;case'cannedanswers':_0x5163c[_0xbb68('0x14')]=_0xbb68('0x5c');break;case _0xbb68('0x5d'):_0x5163c[_0xbb68('0x14')]='Disposition';break;case _0xbb68('0x5e'):_0x5163c[_0xbb68('0x14')]=_0xbb68('0x5f');break;case _0xbb68('0x60'):_0x5163c[_0xbb68('0x14')]=_0xbb68('0x61');break;case _0xbb68('0x62'):_0x5163c['childModel']='Pause';break;case _0xbb68('0x63'):_0x5163c['childModel']=_0xbb68('0x64');break;case _0xbb68('0x65'):_0x5163c['childModel']=_0xbb68('0x66');break;case _0xbb68('0x67'):_0x5163c['childModel']=_0xbb68('0x68');break;case'templates':_0x5163c[_0xbb68('0x14')]='Template';break;case _0xbb68('0x69'):_0x5163c[_0xbb68('0x14')]=_0xbb68('0x6a');break;case'trunks':_0x5163c['childModel']=_0xbb68('0x6b');break;case _0xbb68('0x6c'):_0x5163c[_0xbb68('0x14')]=_0xbb68('0x6d');break;case _0xbb68('0x6e'):_0x5163c[_0xbb68('0x14')]=_0xbb68('0x6f');break;case'extractedreports':_0x5163c[_0xbb68('0x14')]='AnalyticExtractedReport';_0x5163c[_0xbb68('0x4a')]=[{'name':_0xbb68('0x70'),'field':'id','foreignKey':_0xbb68('0x71')}];break;case _0xbb68('0x72'):_0x5163c[_0xbb68('0x14')]='AnalyticMetric';break;}return _0x5163c;}function _0x27dcac(_0x27771c,_0x5b11e6){var _0x108187=_0x27771c[_0xbb68('0x73')](0x0)[_0xbb68('0x74')]()+_0x27771c['slice'](0x1);var _0x20ddd9={'type':_0x4372d1['Sequelize'][_0xbb68('0x75')][_0xbb68('0x76')],'raw':!![]};return new Promise(function(_0x13f4b1,_0x47534d){var _0x1dfd9d=squel[_0xbb68('0x77')]()['field'](_0xbb68('0x78')+_0x108187+_0xbb68('0x79'),'id')[_0xbb68('0xc')](_0xbb68('0x7a'))['from']('user_has_'+_0x27771c+'_interactions','ui')['where']('ui.UserId\x20=\x20?',_0x5b11e6['id']);return _0x4372d1[_0xbb68('0x7b')][_0xbb68('0x7c')](_0x1dfd9d['toString'](),_0x20ddd9)[_0xbb68('0xa')](function(_0x519cc7){_0x5b11e6[_0x108187+'OpenTabs']=_0x519cc7;_0x13f4b1(_0x519cc7);})[_0xbb68('0x8')](function(_0x5a8a37){_0x47534d(_0x5a8a37);});});}return _0x4d023d[_0xbb68('0x7d')](_0xbb68('0x7e'),attributes,{'tableName':'user_profiles','paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0xf37c73){var _0x5ccd72={'raw':_0xf37c73[_0xbb68('0x7c')][_0xbb68('0x7f')],'where':{}};var _0x325b6e={};var _0x195495={'count':0x0,'rows':[]};var _0x67f3c5=_0xf37c73[_0xbb68('0x7c')][_0xbb68('0x80')];var _0x5759fd=_0xf37c73[_0xbb68('0x7c')][_0xbb68('0x81')]||![];var _0x315611=_0x4a3c51(_0x67f3c5,_0x5759fd);if(!_0x315611['childModel'])throw new Error(_0xbb68('0x82')+_0x67f3c5+'\x27');var _0x45132c=[{'name':_0x67f3c5}];if(!_['isEmpty'](_0x315611[_0xbb68('0x4a')]))_0x45132c=_0x315611['parentSections'];var _0x73fd3f=[];for(var _0x426ffc=0x0;_0x426ffc<_0x45132c[_0xbb68('0x83')];_0x426ffc++){_0x73fd3f[_0xbb68('0x84')](_0x4372d1[_0xbb68('0x85')][_0xbb68('0x86')]({'where':{'userProfileId':_0xf37c73['params']['id'],'name':_0x45132c[_0x426ffc][_0xbb68('0x16')]},'raw':!![]}));}return Promise['all'](_0x73fd3f)['then'](function(_0x21319d){var _0x3b370f=_[_0xbb68('0x5')](_0x21319d,function(_0x2d41a7){return _0x2d41a7?_0x2d41a7:undefined;});var _0x34995a=_[_0xbb68('0x5')](_0x45132c,['ignore',!![]]);var _0x228687=_[_0xbb68('0x87')](_0x3b370f)&&_['isEmpty'](_0x34995a)?null:_[_0xbb68('0x88')](_0x34995a,_0x3b370f);if(!_0x228687)return null;var _0x1efbab=[];for(var _0x14ddc1=0x0;_0x14ddc1<_0x228687['length'];_0x14ddc1++){var _0x3e66bd=_[_0xbb68('0x86')](_0x45132c,function(_0x29818a){return _0x228687[_0x14ddc1]?_0x29818a[_0xbb68('0x16')]===_0x228687[_0x14ddc1][_0xbb68('0x16')]:null;});if(_0x3e66bd){if(_0x228687[_0x14ddc1][_0xbb68('0x89')]){_0x1efbab[_0xbb68('0x84')](_0x307d1d(_0x315611[_0xbb68('0x14')],_0x228687[_0x14ddc1]));}else{if(!_0x228687[_0x14ddc1][_0xbb68('0x8a')]){_0x1efbab[_0xbb68('0x84')](_0x1b86a0(_0x3e66bd,_0x228687[_0x14ddc1],_0x315611[_0xbb68('0x14')]));}else{if(_0x3e66bd[_0xbb68('0x8b')]){_0x1efbab['push'](_0x5b7978(_0x3e66bd,_0x228687[_0x14ddc1]));}}}}}return Promise[_0xbb68('0x8c')](_0x1efbab);})[_0xbb68('0xa')](function(_0x5881ac){var _0x7618ec=_0x5881ac;var _0x183f31=null;if(_0x7618ec){_0x183f31=_0x7618ec[_0xbb68('0x83')]===0x1?_0x7618ec[0x0]:null;}if(!_0x183f31&&!_0x7618ec)return _0x195495;var _0x48e1b7=_0x4372d1[_0x315611['childModel']]['rawAttributes'];_0x325b6e[_0xbb68('0x8b')]=_[_0xbb68('0x8d')](_0x48e1b7);_0x325b6e[_0xbb68('0x7c')]=_[_0xbb68('0x8d')](_0xf37c73[_0xbb68('0x7c')]);_0x325b6e[_0xbb68('0x8e')]=_[_0xbb68('0x8f')](_0x325b6e[_0xbb68('0x8b')],_0x325b6e[_0xbb68('0x7c')]);_0x5ccd72[_0xbb68('0x90')]=_['intersection'](_0x325b6e['model'],qs[_0xbb68('0x91')](_0xf37c73['query'][_0xbb68('0x91')]));_0x5ccd72[_0xbb68('0x90')]=_0x5ccd72[_0xbb68('0x90')][_0xbb68('0x83')]?_0x5ccd72[_0xbb68('0x90')]:_0x325b6e[_0xbb68('0x8b')];if(!_0xf37c73['query']['hasOwnProperty'](_0xbb68('0x92'))){_0x5ccd72[_0xbb68('0x93')]=qs[_0xbb68('0x93')](_0xf37c73[_0xbb68('0x7c')][_0xbb68('0x93')]);_0x5ccd72[_0xbb68('0x94')]=qs[_0xbb68('0x94')](_0xf37c73[_0xbb68('0x7c')][_0xbb68('0x94')]);}_0x5ccd72['order']=qs[_0xbb68('0x95')](_0xf37c73[_0xbb68('0x7c')][_0xbb68('0x95')]);_0x5ccd72[_0xbb68('0x96')]=qs[_0xbb68('0x8e')](_[_0xbb68('0x97')](_0xf37c73[_0xbb68('0x7c')],_0x325b6e[_0xbb68('0x8e')]));if(_0xf37c73[_0xbb68('0x7c')]['filter']){_0x5ccd72['where']=_['merge'](_0x5ccd72[_0xbb68('0x96')],{'$or':_[_0xbb68('0xd')](_0x48e1b7,function(_0x3e0073){if(_0x3e0073[_0xbb68('0x10')][_0xbb68('0x98')]!=='VIRTUAL'){var _0x1c6539={};_0x1c6539[_0x3e0073[_0xbb68('0xc')]]={'$like':'%'+_0xf37c73[_0xbb68('0x7c')][_0xbb68('0x5')]+'%'};return _0x1c6539;}})});}var _0x5531af=[];var _0xd0ebdb=null;var _0x347dc5={};if(_0x183f31){_0xd0ebdb=_[_0xbb68('0x86')](_0x45132c,['name',_0x183f31[_0xbb68('0x16')]]);if(_0xd0ebdb[_0xbb68('0xc')]){_0x347dc5={};if(_0x315611[_0xbb68('0x14')]===_0xbb68('0xe')){_0x347dc5[_0xd0ebdb[_0xbb68('0x99')]]=_[_0xbb68('0xd')](_0x183f31[_0xbb68('0x7')],'id');}else{_0x347dc5[_0xd0ebdb[_0xbb68('0x99')]]=_0x183f31['associatedResources'];}_0x5531af['push'](_0x347dc5);}else{_0x5ccd72[_0xbb68('0x96')]['id']=_0x183f31['associatedResources'];}}else{for(var _0x3cce16=0x0;_0x3cce16<_0x7618ec['length'];_0x3cce16++){_0xd0ebdb=_[_0xbb68('0x86')](_0x45132c,[_0xbb68('0x16'),_0x7618ec[_0x3cce16][_0xbb68('0x16')]]);if(_0xd0ebdb['field']){_0x347dc5={};_0x347dc5[_0xd0ebdb[_0xbb68('0x99')]]=_0x7618ec[_0x3cce16][_0xbb68('0x7')];_0x5531af[_0xbb68('0x84')](_0x347dc5);}else{if(!_0x5ccd72['where']['id'])_0x5ccd72[_0xbb68('0x96')]['id']=[];_0x7618ec[_0x3cce16][_0xbb68('0x7')][_0xbb68('0x9a')](function(_0x222d41){_0x5ccd72[_0xbb68('0x96')]['id'][_0xbb68('0x84')](_0x222d41);});}}}if(!_['isEmpty'](_0x5531af)){_0x5ccd72[_0xbb68('0x96')]=_[_0xbb68('0x9b')](_0x5ccd72[_0xbb68('0x96')],{'$and':{'$or':_0x5531af}});}_0x5ccd72=_[_0xbb68('0x9b')]({},_0x5ccd72,_0xf37c73[_0xbb68('0x9c')]);if(_0x183f31&&!_0x183f31['autoAssociation']&&_0x315611[_0xbb68('0x14')]===_0xbb68('0xe')){if(_0xf37c73[_0xbb68('0x7c')][_0xbb68('0x9d')]){_0x5ccd72[_0xbb68('0x9e')]=[{'all':!![]}];}return _0x4372d1[_0x315611['childModel']][_0xbb68('0x6')](_0x5ccd72)[_0xbb68('0xa')](function(_0x7bb9d5){var _0x2683ee=[];_0x7bb9d5[_0xbb68('0x9a')](function(_0x37d8c6){var _0x3d6e59;switch(_0x37d8c6[_0xbb68('0x9f')]){case _0xbb68('0xa0'):_0x3d6e59=_['find'](_0x183f31[_0xbb68('0x7')],function(_0x284153){return _0x284153['id']===_0x37d8c6[_0xbb68('0x71')]&&_0x284153[_0xbb68('0x10')]===_0xbb68('0xa1');});break;case _0xbb68('0xa2'):_0x3d6e59=_['find'](_0x183f31['associatedResources'],function(_0x16b1ae){return _0x16b1ae['id']===_0x37d8c6[_0xbb68('0x71')]&&_0x16b1ae[_0xbb68('0x10')]===_0xbb68('0xa3');});break;}if(_0x3d6e59)_0x2683ee['push'](_0x37d8c6);});_0x195495['count']=_0x2683ee['length'];_0x195495[_0xbb68('0xa4')]=_0x2683ee;return _0x195495;});}else{return _0x4372d1[_0x315611['childModel']][_0xbb68('0xa5')]({'where':_0x5ccd72['where']})[_0xbb68('0xa')](function(_0x3ea669){_0x195495['count']=_0x3ea669;if(_0xf37c73[_0xbb68('0x7c')][_0xbb68('0x9d')]){if(_0x315611['childModel']===_0xbb68('0x1b')){_0x5ccd72[_0xbb68('0x9e')]=[{'model':_0x4372d1[_0xbb68('0x68')],'as':_0xbb68('0xa6'),'attributes':['id',_0xbb68('0x16'),'color'],'required':_0xf37c73['query'][_0xbb68('0xa7')]?!![]:![]},{'model':_0x4372d1['Tag'],'as':'ThroughTags','attributes':['id','name','color'],'through':_0xf37c73['query'][_0xbb68('0xa7')]?{'attributes':[],'where':{'TagId':_0xf37c73[_0xbb68('0x7c')][_0xbb68('0xa7')]||undefined}}:{},'required':_0xf37c73[_0xbb68('0x7c')][_0xbb68('0xa7')]?!![]:![]}];}else{_0x5ccd72[_0xbb68('0x9e')]=[{'all':!![]}];}}return _0x4372d1[_0x315611[_0xbb68('0x14')]][_0xbb68('0x6')](_0x5ccd72);})['then'](function(_0x276cf9){_0x195495[_0xbb68('0xa4')]=_0x276cf9;if(_0x67f3c5===_0xbb68('0x30')&&_0xf37c73[_0xbb68('0x7c')]['openTabs']===_0xbb68('0xa8')){var _0x51b761=[];for(var _0x18f0ee=0x0;_0x18f0ee<_0x195495[_0xbb68('0xa4')][_0xbb68('0x83')];_0x18f0ee++){_0x51b761['push'](_0x27dcac(_0xbb68('0xa9'),_0x195495['rows'][_0x18f0ee][_0xbb68('0xaa')]));_0x51b761[_0xbb68('0x84')](_0x27dcac(_0xbb68('0xab'),_0x195495[_0xbb68('0xa4')][_0x18f0ee][_0xbb68('0xaa')]));_0x51b761[_0xbb68('0x84')](_0x27dcac(_0xbb68('0xac'),_0x195495[_0xbb68('0xa4')][_0x18f0ee]['dataValues']));_0x51b761['push'](_0x27dcac('mail',_0x195495[_0xbb68('0xa4')][_0x18f0ee][_0xbb68('0xaa')]));_0x51b761['push'](_0x27dcac('openchannel',_0x195495[_0xbb68('0xa4')][_0x18f0ee]['dataValues']));_0x51b761['push'](_0x27dcac(_0xbb68('0xad'),_0x195495['rows'][_0x18f0ee][_0xbb68('0xaa')]));}return Promise[_0xbb68('0x8c')](_0x51b761)[_0xbb68('0xa')](function(){return _0x195495;});}return _0x195495;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index fae68b9..5aff131 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 _0x4312=['request','then','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','register'];(function(_0x4824c1,_0x2657fa){var _0x7cd05a=function(_0x6c3aa9){while(--_0x6c3aa9){_0x4824c1['push'](_0x4824c1['shift']());}};_0x7cd05a(++_0x2657fa);}(_0x4312,0xaf));var _0x2431=function(_0x382b8f,_0x5e0c9f){_0x382b8f=_0x382b8f-0x0;var _0x4c9b0e=_0x4312[_0x382b8f];return _0x4c9b0e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2431('0x0'));var BPromise=require(_0x2431('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2431('0x2'));var db=require(_0x2431('0x3'))['db'];var utils=require(_0x2431('0x4'));var logger=require(_0x2431('0x5'))(_0x2431('0x6'));var config=require(_0x2431('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x2431('0x8')]['http']({'port':0x232a});config[_0x2431('0x9')]=_[_0x2431('0xa')](config['redis'],{'host':_0x2431('0xb'),'port':0x18eb});var socket=require(_0x2431('0xc'))(new Redis(config[_0x2431('0x9')]));require('./userProfile.socket')[_0x2431('0xd')](socket);function respondWithRpcPromise(_0x26b223,_0xb751e,_0x568a96){return new BPromise(function(_0x12615b,_0x4a71f2){return client[_0x2431('0xe')](_0x26b223,_0x568a96)[_0x2431('0xf')](function(_0x384711){logger['info'](_0x2431('0x10'),_0xb751e,_0x2431('0x11'));logger[_0x2431('0x12')](_0x2431('0x13'),_0xb751e,'request\x20sent',JSON[_0x2431('0x14')](_0x384711));if(_0x384711[_0x2431('0x15')]){if(_0x384711[_0x2431('0x15')][_0x2431('0x16')]===0x1f4){logger[_0x2431('0x15')](_0x2431('0x10'),_0xb751e,_0x384711[_0x2431('0x15')][_0x2431('0x17')]);return _0x4a71f2(_0x384711[_0x2431('0x15')]['message']);}logger[_0x2431('0x15')](_0x2431('0x10'),_0xb751e,_0x384711[_0x2431('0x15')][_0x2431('0x17')]);return _0x12615b(_0x384711[_0x2431('0x15')][_0x2431('0x17')]);}else{logger[_0x2431('0x18')](_0x2431('0x10'),_0xb751e,_0x2431('0x11'));_0x12615b(_0x384711[_0x2431('0x19')][_0x2431('0x17')]);}})[_0x2431('0x1a')](function(_0x3b1776){logger[_0x2431('0x15')]('UserProfile,\x20%s,\x20%s',_0xb751e,_0x3b1776);_0x4a71f2(_0x3b1776);});});} \ No newline at end of file +var _0x77d4=['util','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./userProfile.socket','register','then','UserProfile,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x4605dc,_0x3f7ae5){var _0x5d3e81=function(_0x1d0375){while(--_0x1d0375){_0x4605dc['push'](_0x4605dc['shift']());}};_0x5d3e81(++_0x3f7ae5);}(_0x77d4,0x108));var _0x477d=function(_0x2a416a,_0x2f0660){_0x2a416a=_0x2a416a-0x0;var _0x52bb59=_0x77d4[_0x2a416a];return _0x52bb59;};'use strict';var _=require('lodash');var util=require(_0x477d('0x0'));var moment=require('moment');var BPromise=require(_0x477d('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x477d('0x2'));var db=require(_0x477d('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x477d('0x4'));var config=require(_0x477d('0x5'));var jayson=require(_0x477d('0x6'));var client=jayson[_0x477d('0x7')][_0x477d('0x8')]({'port':0x232a});config[_0x477d('0x9')]=_['defaults'](config['redis'],{'host':_0x477d('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x477d('0xb'))[_0x477d('0xc')](socket);function respondWithRpcPromise(_0x204cb9,_0x2c326c,_0x1cef1c){return new BPromise(function(_0x58ff29,_0x932cc9){return client['request'](_0x204cb9,_0x1cef1c)[_0x477d('0xd')](function(_0x462ac1){logger['info'](_0x477d('0xe'),_0x2c326c,_0x477d('0xf'));logger['debug']('UserProfile,\x20%s,\x20%s,\x20%s',_0x2c326c,_0x477d('0xf'),JSON[_0x477d('0x10')](_0x462ac1));if(_0x462ac1['error']){if(_0x462ac1[_0x477d('0x11')][_0x477d('0x12')]===0x1f4){logger['error']('UserProfile,\x20%s,\x20%s',_0x2c326c,_0x462ac1[_0x477d('0x11')]['message']);return _0x932cc9(_0x462ac1[_0x477d('0x11')][_0x477d('0x13')]);}logger[_0x477d('0x11')]('UserProfile,\x20%s,\x20%s',_0x2c326c,_0x462ac1[_0x477d('0x11')][_0x477d('0x13')]);return _0x58ff29(_0x462ac1[_0x477d('0x11')][_0x477d('0x13')]);}else{logger['info'](_0x477d('0xe'),_0x2c326c,'request\x20sent');_0x58ff29(_0x462ac1[_0x477d('0x14')][_0x477d('0x13')]);}})[_0x477d('0x15')](function(_0x458489){logger[_0x477d('0x11')](_0x477d('0xe'),_0x2c326c,_0x458489);_0x932cc9(_0x458489);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index d2263ec..70aa3c4 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 _0xec7a=['emit','removeListener','register','userProfile:','./userProfile.events','save','remove','update'];(function(_0x5eb140,_0x32d463){var _0x306bb6=function(_0x34f886){while(--_0x34f886){_0x5eb140['push'](_0x5eb140['shift']());}};_0x306bb6(++_0x32d463);}(_0xec7a,0x1bc));var _0xaec7=function(_0x9729d7,_0x1b79a8){_0x9729d7=_0x9729d7-0x0;var _0x3c4ac6=_0xec7a[_0x9729d7];return _0x3c4ac6;};'use strict';var UserProfileEvents=require(_0xaec7('0x0'));var events=[_0xaec7('0x1'),_0xaec7('0x2'),_0xaec7('0x3')];function createListener(_0x192f3a,_0x364d6d){return function(_0x2dab87){_0x364d6d[_0xaec7('0x4')](_0x192f3a,_0x2dab87);};}function removeListener(_0x1f3fe6,_0x1dea6a){return function(){UserProfileEvents[_0xaec7('0x5')](_0x1f3fe6,_0x1dea6a);};}exports[_0xaec7('0x6')]=function(_0x37f1a5){for(var _0x273877=0x0,_0x482964=events['length'];_0x273877<_0x482964;_0x273877++){var _0x179c84=events[_0x273877];var _0x51a73d=createListener(_0xaec7('0x7')+_0x179c84,_0x37f1a5);UserProfileEvents['on'](_0x179c84,_0x51a73d);}}; \ No newline at end of file +var _0xdbbc=['remove','update','emit','removeListener','register','length','./userProfile.events'];(function(_0x29d915,_0x54a040){var _0x160f86=function(_0x237dfa){while(--_0x237dfa){_0x29d915['push'](_0x29d915['shift']());}};_0x160f86(++_0x54a040);}(_0xdbbc,0x102));var _0xcdbb=function(_0x291cd6,_0x9e2da8){_0x291cd6=_0x291cd6-0x0;var _0x5927fe=_0xdbbc[_0x291cd6];return _0x5927fe;};'use strict';var UserProfileEvents=require(_0xcdbb('0x0'));var events=['save',_0xcdbb('0x1'),_0xcdbb('0x2')];function createListener(_0x222819,_0x53c298){return function(_0x105bda){_0x53c298[_0xcdbb('0x3')](_0x222819,_0x105bda);};}function removeListener(_0x22d1e9,_0x4ec080){return function(){UserProfileEvents[_0xcdbb('0x4')](_0x22d1e9,_0x4ec080);};}exports[_0xcdbb('0x5')]=function(_0x4ed2ab){for(var _0x458409=0x0,_0x2f69f1=events[_0xcdbb('0x6')];_0x458409<_0x2f69f1;_0x458409++){var _0xce9ccf=events[_0x458409];var _0x4bb022=createListener('userProfile:'+_0xce9ccf,_0x4ed2ab);UserProfileEvents['on'](_0xce9ccf,_0x4bb022);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 3b096b6..ac5ea15 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 _0x19f6=['delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','post','create','update'];(function(_0x5a7680,_0x5f5b67){var _0x2c54b2=function(_0x192d06){while(--_0x192d06){_0x5a7680['push'](_0x5a7680['shift']());}};_0x2c54b2(++_0x5f5b67);}(_0x19f6,0x1ce));var _0x619f=function(_0xb4f7b4,_0x2d5d2d){_0xb4f7b4=_0xb4f7b4-0x0;var _0x52685c=_0x19f6[_0xb4f7b4];return _0x52685c;};'use strict';var multer=require(_0x619f('0x0'));var util=require(_0x619f('0x1'));var path=require(_0x619f('0x2'));var timeout=require(_0x619f('0x3'));var express=require(_0x619f('0x4'));var router=express[_0x619f('0x5')]();var fs_extra=require(_0x619f('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x619f('0x7'));var config=require(_0x619f('0x8'));var controller=require('./userProfileResource.controller');router[_0x619f('0x9')]('/',auth['isAuthenticated'](),controller[_0x619f('0xa')]);router[_0x619f('0x9')](_0x619f('0xb'),auth[_0x619f('0xc')](),controller[_0x619f('0xd')]);router['get'](_0x619f('0xe'),auth[_0x619f('0xc')](),controller['show']);router[_0x619f('0xf')]('/',auth[_0x619f('0xc')](),controller[_0x619f('0x10')]);router['put'](_0x619f('0xe'),auth[_0x619f('0xc')](),controller[_0x619f('0x11')]);router[_0x619f('0x12')]('/:id',auth[_0x619f('0xc')](),controller[_0x619f('0x13')]);module['exports']=router; \ No newline at end of file +var _0x20d6=['../../config/environment','get','isAuthenticated','/describe','/:id','post','create','put','update','delete','destroy','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x4ae625,_0xf396d0){var _0x31accf=function(_0x3ded6b){while(--_0x3ded6b){_0x4ae625['push'](_0x4ae625['shift']());}};_0x31accf(++_0xf396d0);}(_0x20d6,0x181));var _0x620d=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x20d6[_0x501510];return _0x1e6ee5;};'use strict';var multer=require('multer');var util=require(_0x620d('0x0'));var path=require(_0x620d('0x1'));var timeout=require(_0x620d('0x2'));var express=require(_0x620d('0x3'));var router=express[_0x620d('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x620d('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x620d('0x6'));var controller=require('./userProfileResource.controller');router[_0x620d('0x7')]('/',auth[_0x620d('0x8')](),controller['index']);router['get'](_0x620d('0x9'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x620d('0xa'),auth[_0x620d('0x8')](),controller['show']);router[_0x620d('0xb')]('/',auth[_0x620d('0x8')](),controller[_0x620d('0xc')]);router[_0x620d('0xd')](_0x620d('0xa'),auth[_0x620d('0x8')](),controller[_0x620d('0xe')]);router[_0x620d('0xf')](_0x620d('0xa'),auth[_0x620d('0x8')](),controller[_0x620d('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 9659608..6b80a34 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 _0xf0c8=['exports','STRING','INTEGER','sequelize'];(function(_0x2696ff,_0x1d6034){var _0x207573=function(_0x5e4d87){while(--_0x5e4d87){_0x2696ff['push'](_0x2696ff['shift']());}};_0x207573(++_0x1d6034);}(_0xf0c8,0x6b));var _0x8f0c=function(_0x1f530d,_0x18a19e){_0x1f530d=_0x1f530d-0x0;var _0x22103f=_0xf0c8[_0x1f530d];return _0x22103f;};'use strict';var Sequelize=require(_0x8f0c('0x0'));module[_0x8f0c('0x1')]={'name':{'type':Sequelize[_0x8f0c('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x8f0c('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x8f0c('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xd032=['STRING','sequelize','exports'];(function(_0x1cda5c,_0x474778){var _0x544fdf=function(_0x4cb5b6){while(--_0x4cb5b6){_0x1cda5c['push'](_0x1cda5c['shift']());}};_0x544fdf(++_0x474778);}(_0xd032,0x178));var _0x2d03=function(_0x19b3f9,_0xade753){_0x19b3f9=_0x19b3f9-0x0;var _0x18c3f6=_0xd032[_0x19b3f9];return _0x18c3f6;};'use strict';var Sequelize=require(_0x2d03('0x0'));module[_0x2d03('0x1')]={'name':{'type':Sequelize[_0x2d03('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize['INTEGER'],'allowNull':![]},'type':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index 812f137..91f1919 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 _0x57ca=['to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','limit','set','apply','save','update','then','destroy','end','sendStatus','error','stack','name','index','map','UserProfileResource','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','options','includeAll','include','findAll','params','find','catch','create','body','describe','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox'];(function(_0x41c88c,_0x381f8d){var _0x2c97ea=function(_0x35fd44){while(--_0x35fd44){_0x41c88c['push'](_0x41c88c['shift']());}};_0x2c97ea(++_0x381f8d);}(_0x57ca,0x108));var _0xa57c=function(_0x1628a8,_0x1b3a0d){_0x1628a8=_0x1628a8-0x0;var _0x312ced=_0x57ca[_0x1628a8];return _0x312ced;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa57c('0x0'));var zipdir=require(_0xa57c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa57c('0x2'));var moment=require(_0xa57c('0x3'));var BPromise=require(_0xa57c('0x4'));var Mustache=require(_0xa57c('0x5'));var util=require(_0xa57c('0x6'));var path=require('path');var sox=require(_0xa57c('0x7'));var csv=require(_0xa57c('0x8'));var ejs=require(_0xa57c('0x9'));var fs=require('fs');var fs_extra=require(_0xa57c('0xa'));var _=require(_0xa57c('0xb'));var squel=require(_0xa57c('0xc'));var crypto=require(_0xa57c('0xd'));var jsforce=require(_0xa57c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xa57c('0x8'));var querystring=require('querystring');var Papa=require(_0xa57c('0xf'));var Redis=require(_0xa57c('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xa57c('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa57c('0x12'));var logger=require(_0xa57c('0x13'))('api');var utils=require(_0xa57c('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xa57c('0x15'));var db=require(_0xa57c('0x16'))['db'];function respondWithStatusCode(_0x1f2bb5,_0x9e25bf){_0x9e25bf=_0x9e25bf||0xcc;return function(_0x205e72){if(_0x205e72){return _0x1f2bb5['sendStatus'](_0x9e25bf);}return _0x1f2bb5[_0xa57c('0x17')](_0x9e25bf)['end']();};}function respondWithResult(_0x30d23d,_0x3d5995){_0x3d5995=_0x3d5995||0xc8;return function(_0x30940d){if(_0x30940d){return _0x30d23d[_0xa57c('0x17')](_0x3d5995)[_0xa57c('0x18')](_0x30940d);}};}function respondWithFilteredResult(_0x37a323,_0x3f900a){return function(_0x4b4bdb){if(_0x4b4bdb){var _0x26607a=typeof _0x3f900a[_0xa57c('0x19')]===_0xa57c('0x1a')&&typeof _0x3f900a['limit']===_0xa57c('0x1a');var _0x5f33f1=_0x4b4bdb[_0xa57c('0x1b')];var _0x3d781d=_0x26607a?0x0:_0x3f900a[_0xa57c('0x19')];var _0xe3d505=_0x26607a?_0x4b4bdb[_0xa57c('0x1b')]:_0x3f900a[_0xa57c('0x19')]+_0x3f900a[_0xa57c('0x1c')];var _0x595c7a;if(_0xe3d505>=_0x5f33f1){_0xe3d505=_0x5f33f1;_0x595c7a=0xc8;}else{_0x595c7a=0xce;}_0x37a323['status'](_0x595c7a);return _0x37a323[_0xa57c('0x1d')]('Content-Range',_0x3d781d+'-'+_0xe3d505+'/'+_0x5f33f1)['json'](_0x4b4bdb);}return null;};}function patchUpdates(_0x418415){return function(_0xa5b314){try{jsonpatch[_0xa57c('0x1e')](_0xa5b314,_0x418415,!![]);}catch(_0x23bec0){return BPromise['reject'](_0x23bec0);}return _0xa5b314[_0xa57c('0x1f')]();};}function saveUpdates(_0x25715f,_0x34d1bc){return function(_0x2213b2){if(_0x2213b2){return _0x2213b2[_0xa57c('0x20')](_0x25715f)[_0xa57c('0x21')](function(_0x1e0192){return _0x1e0192;});}return null;};}function removeEntity(_0x42038e,_0x2e99ed){return function(_0xdf65dd){if(_0xdf65dd){return _0xdf65dd[_0xa57c('0x22')]()[_0xa57c('0x21')](function(){_0x42038e[_0xa57c('0x17')](0xcc)[_0xa57c('0x23')]();});}};}function handleEntityNotFound(_0x431bec,_0x511a26){return function(_0x2db443){if(!_0x2db443){_0x431bec[_0xa57c('0x24')](0x194);}return _0x2db443;};}function handleError(_0x27884d,_0x5228b9){_0x5228b9=_0x5228b9||0x1f4;return function(_0x315ad7){logger[_0xa57c('0x25')](_0x315ad7[_0xa57c('0x26')]);if(_0x315ad7[_0xa57c('0x27')]){delete _0x315ad7[_0xa57c('0x27')];}_0x27884d[_0xa57c('0x17')](_0x5228b9)['send'](_0x315ad7);};}exports[_0xa57c('0x28')]=function(_0x4c1478,_0x54a18b){var _0x257661={},_0x7d10ec={},_0x5a3e03={'count':0x0,'rows':[]};var _0x12898b=_[_0xa57c('0x29')](db[_0xa57c('0x2a')]['rawAttributes'],function(_0xd779f1){return{'name':_0xd779f1['fieldName'],'type':_0xd779f1[_0xa57c('0x2b')]['key']};});_0x7d10ec[_0xa57c('0x2c')]=_['map'](_0x12898b,_0xa57c('0x27'));_0x7d10ec['query']=_[_0xa57c('0x2d')](_0x4c1478[_0xa57c('0x2e')]);_0x7d10ec[_0xa57c('0x2f')]=_[_0xa57c('0x30')](_0x7d10ec[_0xa57c('0x2c')],_0x7d10ec[_0xa57c('0x2e')]);_0x257661[_0xa57c('0x31')]=_['intersection'](_0x7d10ec[_0xa57c('0x2c')],qs['fields'](_0x4c1478[_0xa57c('0x2e')][_0xa57c('0x32')]));_0x257661[_0xa57c('0x31')]=_0x257661['attributes'][_0xa57c('0x33')]?_0x257661['attributes']:_0x7d10ec[_0xa57c('0x2c')];if(!_0x4c1478['query'][_0xa57c('0x34')]('nolimit')){_0x257661[_0xa57c('0x1c')]=qs[_0xa57c('0x1c')](_0x4c1478['query'][_0xa57c('0x1c')]);_0x257661['offset']=qs[_0xa57c('0x19')](_0x4c1478['query'][_0xa57c('0x19')]);}_0x257661[_0xa57c('0x35')]=qs[_0xa57c('0x36')](_0x4c1478[_0xa57c('0x2e')][_0xa57c('0x36')]);_0x257661[_0xa57c('0x37')]=qs['filters'](_['pick'](_0x4c1478[_0xa57c('0x2e')],_0x7d10ec[_0xa57c('0x2f')]),_0x12898b);if(_0x4c1478[_0xa57c('0x2e')]['filter']){_0x257661[_0xa57c('0x37')]=_['merge'](_0x257661[_0xa57c('0x37')],{'$or':_[_0xa57c('0x29')](_0x12898b,function(_0x5c8256){if(_0x5c8256['type']!=='VIRTUAL'){var _0x3be888={};_0x3be888[_0x5c8256[_0xa57c('0x27')]]={'$like':'%'+_0x4c1478[_0xa57c('0x2e')][_0xa57c('0x38')]+'%'};return _0x3be888;}})});}_0x257661=_[_0xa57c('0x39')]({},_0x257661,_0x4c1478[_0xa57c('0x3a')]);var _0x5a444a={'where':_0x257661[_0xa57c('0x37')]};return db[_0xa57c('0x2a')]['count'](_0x5a444a)['then'](function(_0x5e10b){_0x5a3e03[_0xa57c('0x1b')]=_0x5e10b;if(_0x4c1478['query'][_0xa57c('0x3b')]){_0x257661[_0xa57c('0x3c')]=[{'all':!![]}];}return db[_0xa57c('0x2a')][_0xa57c('0x3d')](_0x257661);})[_0xa57c('0x21')](function(_0x43c1d7){_0x5a3e03['rows']=_0x43c1d7;return _0x5a3e03;})[_0xa57c('0x21')](respondWithFilteredResult(_0x54a18b,_0x257661))['catch'](handleError(_0x54a18b,null));};exports['show']=function(_0x5b3300,_0x520383){var _0x588199={'raw':![],'where':{'id':_0x5b3300[_0xa57c('0x3e')]['id']}},_0x39b20f={};_0x39b20f[_0xa57c('0x2c')]=_['keys'](db['UserProfileResource']['rawAttributes']);_0x39b20f[_0xa57c('0x2e')]=_[_0xa57c('0x2d')](_0x5b3300[_0xa57c('0x2e')]);_0x39b20f[_0xa57c('0x2f')]=_[_0xa57c('0x30')](_0x39b20f[_0xa57c('0x2c')],_0x39b20f['query']);_0x588199[_0xa57c('0x31')]=_[_0xa57c('0x30')](_0x39b20f[_0xa57c('0x2c')],qs[_0xa57c('0x32')](_0x5b3300[_0xa57c('0x2e')][_0xa57c('0x32')]));_0x588199['attributes']=_0x588199[_0xa57c('0x31')][_0xa57c('0x33')]?_0x588199[_0xa57c('0x31')]:_0x39b20f[_0xa57c('0x2c')];if(_0x5b3300[_0xa57c('0x2e')]['includeAll']){_0x588199[_0xa57c('0x3c')]=[{'all':!![]}];}_0x588199=_[_0xa57c('0x39')]({},_0x588199,_0x5b3300[_0xa57c('0x3a')]);return db[_0xa57c('0x2a')][_0xa57c('0x3f')](_0x588199)[_0xa57c('0x21')](handleEntityNotFound(_0x520383,null))['then'](respondWithResult(_0x520383,null))[_0xa57c('0x40')](handleError(_0x520383,null));};exports[_0xa57c('0x41')]=function(_0x247906,_0x44ea0a){return db[_0xa57c('0x2a')][_0xa57c('0x41')](_0x247906['body'],{})['then'](respondWithResult(_0x44ea0a,0xc9))['catch'](handleError(_0x44ea0a,null));};exports['update']=function(_0x232675,_0x49492f){if(_0x232675[_0xa57c('0x42')]['id']){delete _0x232675[_0xa57c('0x42')]['id'];}return db['UserProfileResource'][_0xa57c('0x3f')]({'where':{'id':_0x232675[_0xa57c('0x3e')]['id']}})[_0xa57c('0x21')](handleEntityNotFound(_0x49492f,null))[_0xa57c('0x21')](saveUpdates(_0x232675[_0xa57c('0x42')],null))['then'](respondWithResult(_0x49492f,null))[_0xa57c('0x40')](handleError(_0x49492f,null));};exports[_0xa57c('0x22')]=function(_0x4584e8,_0xd57bac){return db[_0xa57c('0x2a')]['find']({'where':{'id':_0x4584e8[_0xa57c('0x3e')]['id']}})['then'](handleEntityNotFound(_0xd57bac,null))['then'](removeEntity(_0xd57bac,null))[_0xa57c('0x40')](handleError(_0xd57bac,null));};exports[_0xa57c('0x43')]=function(_0x5ded49,_0x5bf336){return db['UserProfileResource'][_0xa57c('0x43')]()[_0xa57c('0x21')](respondWithResult(_0x5bf336,null))[_0xa57c('0x40')](handleError(_0x5bf336,null));}; \ No newline at end of file +var _0x5f2f=['offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','stack','name','send','index','UserProfileResource','rawAttributes','fieldName','type','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','merge','where','options','includeAll','include','findAll','rows','catch','keys','find','body','params','destroy','describe','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'];(function(_0xb15db6,_0x388d94){var _0x1db34d=function(_0x309006){while(--_0x309006){_0xb15db6['push'](_0xb15db6['shift']());}};_0x1db34d(++_0x388d94);}(_0x5f2f,0x73));var _0xf5f2=function(_0x32f5f2,_0x28fc40){_0x32f5f2=_0x32f5f2-0x0;var _0x242184=_0x5f2f[_0x32f5f2];return _0x242184;};'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')]=[{'all':!![]}];}return db[_0xf5f2('0x29')][_0xf5f2('0x3e')](_0x22c826);})[_0xf5f2('0x24')](function(_0x574f24){_0x11c771[_0xf5f2('0x3f')]=_0x574f24;return _0x11c771;})[_0xf5f2('0x24')](respondWithFilteredResult(_0x53cb96,_0x22c826))[_0xf5f2('0x40')](handleError(_0x53cb96,null));};exports['show']=function(_0x509dbc,_0x59eb00){var _0x76d21b={'raw':![],'where':{'id':_0x509dbc['params']['id']}},_0x2ad13c={};_0x2ad13c[_0xf5f2('0x31')]=_[_0xf5f2('0x41')](db[_0xf5f2('0x29')][_0xf5f2('0x2a')]);_0x2ad13c[_0xf5f2('0x2e')]=_[_0xf5f2('0x41')](_0x509dbc[_0xf5f2('0x2e')]);_0x2ad13c[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x2ad13c[_0xf5f2('0x31')],_0x2ad13c[_0xf5f2('0x2e')]);_0x76d21b[_0xf5f2('0x32')]=_[_0xf5f2('0x30')](_0x2ad13c[_0xf5f2('0x31')],qs['fields'](_0x509dbc[_0xf5f2('0x2e')]['fields']));_0x76d21b[_0xf5f2('0x32')]=_0x76d21b[_0xf5f2('0x32')][_0xf5f2('0x34')]?_0x76d21b[_0xf5f2('0x32')]:_0x2ad13c[_0xf5f2('0x31')];if(_0x509dbc[_0xf5f2('0x2e')]['includeAll']){_0x76d21b[_0xf5f2('0x3d')]=[{'all':!![]}];}_0x76d21b=_[_0xf5f2('0x39')]({},_0x76d21b,_0x509dbc[_0xf5f2('0x3b')]);return db[_0xf5f2('0x29')][_0xf5f2('0x42')](_0x76d21b)[_0xf5f2('0x24')](handleEntityNotFound(_0x59eb00,null))[_0xf5f2('0x24')](respondWithResult(_0x59eb00,null))[_0xf5f2('0x40')](handleError(_0x59eb00,null));};exports['create']=function(_0x35dece,_0x33ec29){return db[_0xf5f2('0x29')]['create'](_0x35dece[_0xf5f2('0x43')],{})[_0xf5f2('0x24')](respondWithResult(_0x33ec29,0xc9))[_0xf5f2('0x40')](handleError(_0x33ec29,null));};exports['update']=function(_0x57a7cb,_0x7bb942){if(_0x57a7cb[_0xf5f2('0x43')]['id']){delete _0x57a7cb['body']['id'];}return db[_0xf5f2('0x29')]['find']({'where':{'id':_0x57a7cb[_0xf5f2('0x44')]['id']}})['then'](handleEntityNotFound(_0x7bb942,null))[_0xf5f2('0x24')](saveUpdates(_0x57a7cb['body'],null))[_0xf5f2('0x24')](respondWithResult(_0x7bb942,null))[_0xf5f2('0x40')](handleError(_0x7bb942,null));};exports[_0xf5f2('0x45')]=function(_0x11a083,_0x4fa738){return db[_0xf5f2('0x29')][_0xf5f2('0x42')]({'where':{'id':_0x11a083['params']['id']}})['then'](handleEntityNotFound(_0x4fa738,null))[_0xf5f2('0x24')](removeEntity(_0x4fa738,null))[_0xf5f2('0x40')](handleError(_0x4fa738,null));};exports['describe']=function(_0x22b645,_0xe0ce7f){return db[_0xf5f2('0x29')][_0xf5f2('0x46')]()['then'](respondWithResult(_0xe0ce7f,null))['catch'](handleError(_0xe0ce7f,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 91f0069..7038718 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 _0x56b1=['./userProfileResource.attributes','exports','user_profile_has_resources','compositeIndex','sectionId','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3e169e,_0xed2bf){var _0x1dc0d7=function(_0x99d89f){while(--_0x99d89f){_0x3e169e['push'](_0x3e169e['shift']());}};_0x1dc0d7(++_0xed2bf);}(_0x56b1,0x67));var _0x156b=function(_0x5a850c,_0x349ff1){_0x5a850c=_0x5a850c-0x0;var _0x1fc963=_0x56b1[_0x5a850c];return _0x1fc963;};'use strict';var _=require(_0x156b('0x0'));var util=require(_0x156b('0x1'));var logger=require(_0x156b('0x2'))('api');var moment=require(_0x156b('0x3'));var BPromise=require(_0x156b('0x4'));var rp=require(_0x156b('0x5'));var fs=require('fs');var path=require(_0x156b('0x6'));var rimraf=require(_0x156b('0x7'));var config=require(_0x156b('0x8'));var attributes=require(_0x156b('0x9'));module[_0x156b('0xa')]=function(_0x256e78,_0x216fb5){return _0x256e78['define']('UserProfileResource',attributes,{'tableName':_0x156b('0xb'),'paranoid':![],'indexes':[{'name':_0x156b('0xc'),'fields':['resourceId',_0x156b('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x01f1=['rimraf','../../config/environment','./userProfileResource.attributes','define','UserProfileResource','compositeIndex','resourceId','util','../../config/logger','api','request-promise','path'];(function(_0xd5f088,_0x31afa4){var _0x1e1f17=function(_0x45d63b){while(--_0x45d63b){_0xd5f088['push'](_0xd5f088['shift']());}};_0x1e1f17(++_0x31afa4);}(_0x01f1,0x7f));var _0x101f=function(_0x1e1b5a,_0x13b534){_0x1e1b5a=_0x1e1b5a-0x0;var _0x3206db=_0x01f1[_0x1e1b5a];return _0x3206db;};'use strict';var _=require('lodash');var util=require(_0x101f('0x0'));var logger=require(_0x101f('0x1'))(_0x101f('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x101f('0x3'));var fs=require('fs');var path=require(_0x101f('0x4'));var rimraf=require(_0x101f('0x5'));var config=require(_0x101f('0x6'));var attributes=require(_0x101f('0x7'));module['exports']=function(_0x456f8d,_0x2cff20){return _0x456f8d[_0x101f('0x8')](_0x101f('0x9'),attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':_0x101f('0xa'),'fields':[_0x101f('0xb'),'sectionId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 319f1f8..f7f6eec 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 _0xbd3c=['randomstring','../../config/utils','../../config/logger','rpc','http','request','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xbd3c,0x13e));var _0xcbd3=function(_0x4821ef,_0x4b1e53){_0x4821ef=_0x4821ef-0x0;var _0x35e7a3=_0xbd3c[_0x4821ef];return _0x35e7a3;};'use strict';var _=require(_0xcbd3('0x0'));var util=require(_0xcbd3('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xcbd3('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xcbd3('0x3'));var logger=require(_0xcbd3('0x4'))(_0xcbd3('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xcbd3('0x6')]({'port':0x232a});function respondWithRpcPromise(_0xd90034,_0x2960f4,_0x55595b){return new BPromise(function(_0x4e5c55,_0x59f5f9){return client[_0xcbd3('0x7')](_0xd90034,_0x55595b)['then'](function(_0x1dea67){logger[_0xcbd3('0x8')](_0xcbd3('0x9'),_0x2960f4,_0xcbd3('0xa'));logger['debug']('UserProfileResource,\x20%s,\x20%s,\x20%s',_0x2960f4,_0xcbd3('0xa'),JSON[_0xcbd3('0xb')](_0x1dea67));if(_0x1dea67[_0xcbd3('0xc')]){if(_0x1dea67['error'][_0xcbd3('0xd')]===0x1f4){logger[_0xcbd3('0xc')](_0xcbd3('0x9'),_0x2960f4,_0x1dea67[_0xcbd3('0xc')][_0xcbd3('0xe')]);return _0x59f5f9(_0x1dea67[_0xcbd3('0xc')]['message']);}logger[_0xcbd3('0xc')]('UserProfileResource,\x20%s,\x20%s',_0x2960f4,_0x1dea67[_0xcbd3('0xc')][_0xcbd3('0xe')]);return _0x4e5c55(_0x1dea67[_0xcbd3('0xc')]['message']);}else{logger[_0xcbd3('0x8')](_0xcbd3('0x9'),_0x2960f4,_0xcbd3('0xa'));_0x4e5c55(_0x1dea67[_0xcbd3('0xf')][_0xcbd3('0xe')]);}})['catch'](function(_0x13ba97){logger[_0xcbd3('0xc')](_0xcbd3('0x9'),_0x2960f4,_0x13ba97);_0x59f5f9(_0x13ba97);});});} \ No newline at end of file +var _0xbdad=['catch','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','UserProfileResource,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x102977,_0x3a99a6){var _0x15c466=function(_0x1a6a12){while(--_0x1a6a12){_0x102977['push'](_0x102977['shift']());}};_0x15c466(++_0x3a99a6);}(_0xbdad,0xf1));var _0xdbda=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xbdad[_0xfae23b];return _0x200640;};'use strict';var _=require('lodash');var util=require(_0xdbda('0x0'));var moment=require(_0xdbda('0x1'));var BPromise=require(_0xdbda('0x2'));var rs=require(_0xdbda('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xdbda('0x4'));var logger=require(_0xdbda('0x5'))(_0xdbda('0x6'));var config=require(_0xdbda('0x7'));var jayson=require(_0xdbda('0x8'));var client=jayson[_0xdbda('0x9')][_0xdbda('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x416d69,_0x2d62f5,_0x1d1f75){return new BPromise(function(_0x213f9d,_0x113292){return client[_0xdbda('0xb')](_0x416d69,_0x1d1f75)['then'](function(_0x2ef3d2){logger[_0xdbda('0xc')](_0xdbda('0xd'),_0x2d62f5,_0xdbda('0xe'));logger['debug'](_0xdbda('0xf'),_0x2d62f5,_0xdbda('0xe'),JSON['stringify'](_0x2ef3d2));if(_0x2ef3d2[_0xdbda('0x10')]){if(_0x2ef3d2[_0xdbda('0x10')][_0xdbda('0x11')]===0x1f4){logger[_0xdbda('0x10')](_0xdbda('0xd'),_0x2d62f5,_0x2ef3d2['error'][_0xdbda('0x12')]);return _0x113292(_0x2ef3d2[_0xdbda('0x10')]['message']);}logger[_0xdbda('0x10')](_0xdbda('0xd'),_0x2d62f5,_0x2ef3d2[_0xdbda('0x10')][_0xdbda('0x12')]);return _0x213f9d(_0x2ef3d2[_0xdbda('0x10')][_0xdbda('0x12')]);}else{logger[_0xdbda('0xc')](_0xdbda('0xd'),_0x2d62f5,_0xdbda('0xe'));_0x213f9d(_0x2ef3d2['result']['message']);}})[_0xdbda('0x13')](function(_0x5d83d7){logger[_0xdbda('0x10')](_0xdbda('0xd'),_0x2d62f5,_0x5d83d7);_0x113292(_0x5d83d7);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index ffda437..0ec140f 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 _0x56ba=['index','/describe','describe','/:id','post','create','update','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','./userProfileSection.controller','get','isAuthenticated'];(function(_0x58dca4,_0x5dd8dc){var _0x4b1ca3=function(_0x7ef314){while(--_0x7ef314){_0x58dca4['push'](_0x58dca4['shift']());}};_0x4b1ca3(++_0x5dd8dc);}(_0x56ba,0x171));var _0xa56b=function(_0x3eca59,_0x365394){_0x3eca59=_0x3eca59-0x0;var _0x55ae55=_0x56ba[_0x3eca59];return _0x55ae55;};'use strict';var multer=require(_0xa56b('0x0'));var util=require(_0xa56b('0x1'));var path=require('path');var timeout=require(_0xa56b('0x2'));var express=require(_0xa56b('0x3'));var router=express['Router']();var fs_extra=require(_0xa56b('0x4'));var auth=require(_0xa56b('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa56b('0x6'));router[_0xa56b('0x7')]('/',auth[_0xa56b('0x8')](),controller[_0xa56b('0x9')]);router['get'](_0xa56b('0xa'),auth['isAuthenticated'](),controller[_0xa56b('0xb')]);router[_0xa56b('0x7')](_0xa56b('0xc'),auth[_0xa56b('0x8')](),controller['show']);router[_0xa56b('0xd')]('/',auth['isAuthenticated'](),controller[_0xa56b('0xe')]);router['put']('/:id',auth[_0xa56b('0x8')](),controller[_0xa56b('0xf')]);router['delete'](_0xa56b('0xc'),auth[_0xa56b('0x8')](),controller[_0xa56b('0x10')]);module[_0xa56b('0x11')]=router; \ No newline at end of file +var _0x4cc5=['multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','create','put','delete','destroy','exports'];(function(_0x186591,_0x41385c){var _0x54d42d=function(_0x50e4f9){while(--_0x50e4f9){_0x186591['push'](_0x186591['shift']());}};_0x54d42d(++_0x41385c);}(_0x4cc5,0x1a4));var _0x54cc=function(_0x30851d,_0x1ede8c){_0x30851d=_0x30851d-0x0;var _0x24de2c=_0x4cc5[_0x30851d];return _0x24de2c;};'use strict';var multer=require(_0x54cc('0x0'));var util=require(_0x54cc('0x1'));var path=require(_0x54cc('0x2'));var timeout=require(_0x54cc('0x3'));var express=require(_0x54cc('0x4'));var router=express['Router']();var fs_extra=require(_0x54cc('0x5'));var auth=require(_0x54cc('0x6'));var interaction=require(_0x54cc('0x7'));var config=require(_0x54cc('0x8'));var controller=require('./userProfileSection.controller');router[_0x54cc('0x9')]('/',auth[_0x54cc('0xa')](),controller['index']);router['get'](_0x54cc('0xb'),auth[_0x54cc('0xa')](),controller[_0x54cc('0xc')]);router[_0x54cc('0x9')](_0x54cc('0xd'),auth[_0x54cc('0xa')](),controller[_0x54cc('0xe')]);router['post']('/',auth[_0x54cc('0xa')](),controller[_0x54cc('0xf')]);router[_0x54cc('0x10')]('/:id',auth[_0x54cc('0xa')](),controller['update']);router[_0x54cc('0x11')](_0x54cc('0xd'),auth[_0x54cc('0xa')](),controller[_0x54cc('0x12')]);module[_0x54cc('0x13')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 8b9f18e..d300a89 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(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xb62e,0x1de));var _0xeb62=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0xb62e[_0x2d7f0e];return _0x110b07;};'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 _0x8f4c=['setDataValue','join','crudPermissions','sequelize','exports','STRING','INTEGER','BOOLEAN'];(function(_0x59ea55,_0x550400){var _0x561e90=function(_0x549efb){while(--_0x549efb){_0x59ea55['push'](_0x59ea55['shift']());}};_0x561e90(++_0x550400);}(_0x8f4c,0x113));var _0xc8f4=function(_0x4c2b96,_0x17ab0d){_0x4c2b96=_0x4c2b96-0x0;var _0x2a62bf=_0x8f4c[_0x4c2b96];return _0x2a62bf;};'use strict';var Sequelize=require(_0xc8f4('0x0'));module[_0xc8f4('0x1')]={'name':{'type':Sequelize[_0xc8f4('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0xc8f4('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0xc8f4('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0xc8f4('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xc8f4('0x2')],'set':function(_0x47350d){this[_0xc8f4('0x5')]('crudPermissions',_0x47350d?_0x47350d[_0xc8f4('0x6')](''):[]);},'get':function(){return this['getDataValue']('crudPermissions')?this['getDataValue'](_0xc8f4('0x7'))['split'](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index e7653d4..e658de4 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 _0x5472=['end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','error','send','index','map','UserProfileSection','fieldName','type','key','model','name','query','keys','filters','intersection','fields','attributes','hasOwnProperty','sort','pick','merge','where','VIRTUAL','filter','options','rows','catch','params','rawAttributes','length','includeAll','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status'];(function(_0x16fbff,_0x244266){var _0x547b30=function(_0x448a2e){while(--_0x448a2e){_0x16fbff['push'](_0x16fbff['shift']());}};_0x547b30(++_0x244266);}(_0x5472,0x1ab));var _0x2547=function(_0x40e13e,_0x376d13){_0x40e13e=_0x40e13e-0x0;var _0x5db39e=_0x5472[_0x40e13e];return _0x5db39e;};'use strict';var emlformat=require(_0x2547('0x0'));var rimraf=require(_0x2547('0x1'));var zipdir=require(_0x2547('0x2'));var jsonpatch=require(_0x2547('0x3'));var rp=require(_0x2547('0x4'));var moment=require(_0x2547('0x5'));var BPromise=require(_0x2547('0x6'));var Mustache=require(_0x2547('0x7'));var util=require(_0x2547('0x8'));var path=require(_0x2547('0x9'));var sox=require(_0x2547('0xa'));var csv=require('to-csv');var ejs=require(_0x2547('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2547('0xc'));var squel=require(_0x2547('0xd'));var crypto=require(_0x2547('0xe'));var jsforce=require(_0x2547('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x2547('0x10'));var querystring=require(_0x2547('0x11'));var Papa=require(_0x2547('0x12'));var Redis=require(_0x2547('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x2547('0x14'));var as=require(_0x2547('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2547('0x16'))(_0x2547('0x17'));var utils=require(_0x2547('0x18'));var config=require(_0x2547('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x2547('0x1a'))['db'];function respondWithStatusCode(_0x407da5,_0x24f78c){_0x24f78c=_0x24f78c||0xcc;return function(_0x498214){if(_0x498214){return _0x407da5[_0x2547('0x1b')](_0x24f78c);}return _0x407da5[_0x2547('0x1c')](_0x24f78c)[_0x2547('0x1d')]();};}function respondWithResult(_0x3dda25,_0x3de7dd){_0x3de7dd=_0x3de7dd||0xc8;return function(_0x400e72){if(_0x400e72){return _0x3dda25[_0x2547('0x1c')](_0x3de7dd)[_0x2547('0x1e')](_0x400e72);}};}function respondWithFilteredResult(_0x11ed31,_0x3adca6){return function(_0x35d0aa){if(_0x35d0aa){var _0x35ff77=typeof _0x3adca6[_0x2547('0x1f')]===_0x2547('0x20')&&typeof _0x3adca6['limit']===_0x2547('0x20');var _0x36b859=_0x35d0aa[_0x2547('0x21')];var _0xe064a7=_0x35ff77?0x0:_0x3adca6[_0x2547('0x1f')];var _0x14df9b=_0x35ff77?_0x35d0aa[_0x2547('0x21')]:_0x3adca6[_0x2547('0x1f')]+_0x3adca6[_0x2547('0x22')];var _0x427a23;if(_0x14df9b>=_0x36b859){_0x14df9b=_0x36b859;_0x427a23=0xc8;}else{_0x427a23=0xce;}_0x11ed31[_0x2547('0x1c')](_0x427a23);return _0x11ed31[_0x2547('0x23')](_0x2547('0x24'),_0xe064a7+'-'+_0x14df9b+'/'+_0x36b859)['json'](_0x35d0aa);}return null;};}function patchUpdates(_0x2e10bd){return function(_0x25ad79){try{jsonpatch[_0x2547('0x25')](_0x25ad79,_0x2e10bd,!![]);}catch(_0x507e6b){return BPromise[_0x2547('0x26')](_0x507e6b);}return _0x25ad79['save']();};}function saveUpdates(_0x5c92a2,_0x402e5d){return function(_0x5609a9){if(_0x5609a9){return _0x5609a9[_0x2547('0x27')](_0x5c92a2)[_0x2547('0x28')](function(_0x3e3e74){return _0x3e3e74;});}return null;};}function removeEntity(_0x2dcf64,_0x5460d3){return function(_0x419f50){if(_0x419f50){return _0x419f50['destroy']()[_0x2547('0x28')](function(){_0x2dcf64[_0x2547('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x513d46,_0x4403a6){return function(_0x92a18b){if(!_0x92a18b){_0x513d46[_0x2547('0x1b')](0x194);}return _0x92a18b;};}function handleError(_0x2a0f4e,_0x4cff10){_0x4cff10=_0x4cff10||0x1f4;return function(_0x2c333d){logger[_0x2547('0x29')](_0x2c333d['stack']);if(_0x2c333d['name']){delete _0x2c333d['name'];}_0x2a0f4e[_0x2547('0x1c')](_0x4cff10)[_0x2547('0x2a')](_0x2c333d);};}exports[_0x2547('0x2b')]=function(_0x1f114e,_0x2b1dca){var _0x183371={},_0x372127={},_0x5b39ab={'count':0x0,'rows':[]};var _0x36df99=_[_0x2547('0x2c')](db[_0x2547('0x2d')]['rawAttributes'],function(_0x4c1510){return{'name':_0x4c1510[_0x2547('0x2e')],'type':_0x4c1510[_0x2547('0x2f')][_0x2547('0x30')]};});_0x372127[_0x2547('0x31')]=_[_0x2547('0x2c')](_0x36df99,_0x2547('0x32'));_0x372127[_0x2547('0x33')]=_[_0x2547('0x34')](_0x1f114e['query']);_0x372127[_0x2547('0x35')]=_[_0x2547('0x36')](_0x372127[_0x2547('0x31')],_0x372127[_0x2547('0x33')]);_0x183371['attributes']=_[_0x2547('0x36')](_0x372127['model'],qs[_0x2547('0x37')](_0x1f114e[_0x2547('0x33')]['fields']));_0x183371['attributes']=_0x183371[_0x2547('0x38')]['length']?_0x183371[_0x2547('0x38')]:_0x372127['model'];if(!_0x1f114e['query'][_0x2547('0x39')]('nolimit')){_0x183371['limit']=qs['limit'](_0x1f114e['query'][_0x2547('0x22')]);_0x183371[_0x2547('0x1f')]=qs[_0x2547('0x1f')](_0x1f114e[_0x2547('0x33')]['offset']);}_0x183371['order']=qs[_0x2547('0x3a')](_0x1f114e['query'][_0x2547('0x3a')]);_0x183371['where']=qs[_0x2547('0x35')](_[_0x2547('0x3b')](_0x1f114e[_0x2547('0x33')],_0x372127[_0x2547('0x35')]),_0x36df99);if(_0x1f114e[_0x2547('0x33')]['filter']){_0x183371['where']=_[_0x2547('0x3c')](_0x183371[_0x2547('0x3d')],{'$or':_[_0x2547('0x2c')](_0x36df99,function(_0x5828e4){if(_0x5828e4['type']!==_0x2547('0x3e')){var _0x3f5d40={};_0x3f5d40[_0x5828e4[_0x2547('0x32')]]={'$like':'%'+_0x1f114e[_0x2547('0x33')][_0x2547('0x3f')]+'%'};return _0x3f5d40;}})});}_0x183371=_[_0x2547('0x3c')]({},_0x183371,_0x1f114e[_0x2547('0x40')]);var _0x246da2={'where':_0x183371[_0x2547('0x3d')]};return db['UserProfileSection'][_0x2547('0x21')](_0x246da2)[_0x2547('0x28')](function(_0x3fb304){_0x5b39ab[_0x2547('0x21')]=_0x3fb304;if(_0x1f114e['query']['includeAll']){_0x183371['include']=[{'all':!![]}];}return db[_0x2547('0x2d')]['findAll'](_0x183371);})[_0x2547('0x28')](function(_0xf40a82){_0x5b39ab[_0x2547('0x41')]=_0xf40a82;return _0x5b39ab;})['then'](respondWithFilteredResult(_0x2b1dca,_0x183371))[_0x2547('0x42')](handleError(_0x2b1dca,null));};exports['show']=function(_0x399951,_0x5dec7a){var _0x8c122e={'raw':![],'where':{'id':_0x399951[_0x2547('0x43')]['id']}},_0x4a1ec6={};_0x4a1ec6[_0x2547('0x31')]=_['keys'](db[_0x2547('0x2d')][_0x2547('0x44')]);_0x4a1ec6['query']=_[_0x2547('0x34')](_0x399951[_0x2547('0x33')]);_0x4a1ec6['filters']=_[_0x2547('0x36')](_0x4a1ec6[_0x2547('0x31')],_0x4a1ec6['query']);_0x8c122e[_0x2547('0x38')]=_['intersection'](_0x4a1ec6[_0x2547('0x31')],qs[_0x2547('0x37')](_0x399951['query'][_0x2547('0x37')]));_0x8c122e[_0x2547('0x38')]=_0x8c122e[_0x2547('0x38')][_0x2547('0x45')]?_0x8c122e[_0x2547('0x38')]:_0x4a1ec6[_0x2547('0x31')];if(_0x399951['query'][_0x2547('0x46')]){_0x8c122e[_0x2547('0x47')]=[{'all':!![]}];}_0x8c122e=_[_0x2547('0x3c')]({},_0x8c122e,_0x399951['options']);return db['UserProfileSection'][_0x2547('0x48')](_0x8c122e)[_0x2547('0x28')](handleEntityNotFound(_0x5dec7a,null))['then'](respondWithResult(_0x5dec7a,null))[_0x2547('0x42')](handleError(_0x5dec7a,null));};exports[_0x2547('0x49')]=function(_0x3d3258,_0x597949){return db[_0x2547('0x2d')][_0x2547('0x49')](_0x3d3258[_0x2547('0x4a')],{})[_0x2547('0x28')](respondWithResult(_0x597949,0xc9))[_0x2547('0x42')](handleError(_0x597949,null));};exports[_0x2547('0x27')]=function(_0x52e411,_0x3746a0){if(_0x52e411[_0x2547('0x4a')]['id']){delete _0x52e411[_0x2547('0x4a')]['id'];}return db[_0x2547('0x2d')][_0x2547('0x48')]({'where':{'id':_0x52e411['params']['id']}})[_0x2547('0x28')](handleEntityNotFound(_0x3746a0,null))[_0x2547('0x28')](saveUpdates(_0x52e411[_0x2547('0x4a')],null))[_0x2547('0x28')](respondWithResult(_0x3746a0,null))[_0x2547('0x42')](handleError(_0x3746a0,null));};exports['destroy']=function(_0x565653,_0x1c6bbc){return db[_0x2547('0x2d')][_0x2547('0x48')]({'where':{'id':_0x565653[_0x2547('0x43')]['id']}})[_0x2547('0x28')](handleEntityNotFound(_0x1c6bbc,null))['then'](removeEntity(_0x1c6bbc,null))['catch'](handleError(_0x1c6bbc,null));};exports[_0x2547('0x4b')]=function(_0xe49e71,_0xd1f58e){return db[_0x2547('0x2d')][_0x2547('0x4b')]()['then'](respondWithResult(_0xd1f58e,null))[_0x2547('0x42')](handleError(_0xd1f58e,null));}; \ No newline at end of file +var _0x8319=['moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','UserProfileSection','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','length','attributes','hasOwnProperty','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','find','create','body','catch','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x2dd0b6,_0x550d01){var _0x3d380d=function(_0x19682c){while(--_0x19682c){_0x2dd0b6['push'](_0x2dd0b6['shift']());}};_0x3d380d(++_0x550d01);}(_0x8319,0x1e1));var _0x9831=function(_0x2e3a61,_0x326750){_0x2e3a61=_0x2e3a61-0x0;var _0xa0a33c=_0x8319[_0x2e3a61];return _0xa0a33c;};'use strict';var emlformat=require(_0x9831('0x0'));var rimraf=require(_0x9831('0x1'));var zipdir=require(_0x9831('0x2'));var jsonpatch=require(_0x9831('0x3'));var rp=require(_0x9831('0x4'));var moment=require(_0x9831('0x5'));var BPromise=require(_0x9831('0x6'));var Mustache=require(_0x9831('0x7'));var util=require(_0x9831('0x8'));var path=require(_0x9831('0x9'));var sox=require('sox');var csv=require(_0x9831('0xa'));var ejs=require(_0x9831('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9831('0xc'));var squel=require(_0x9831('0xd'));var crypto=require('crypto');var jsforce=require(_0x9831('0xe'));var deskjs=require(_0x9831('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9831('0x10'));var Redis=require(_0x9831('0x11'));var authService=require(_0x9831('0x12'));var qs=require(_0x9831('0x13'));var as=require(_0x9831('0x14'));var hardwareService=require(_0x9831('0x15'));var logger=require(_0x9831('0x16'))(_0x9831('0x17'));var utils=require(_0x9831('0x18'));var config=require(_0x9831('0x19'));var licenseUtil=require(_0x9831('0x1a'));var db=require(_0x9831('0x1b'))['db'];function respondWithStatusCode(_0x220e4c,_0x20bdde){_0x20bdde=_0x20bdde||0xcc;return function(_0x1c6d67){if(_0x1c6d67){return _0x220e4c[_0x9831('0x1c')](_0x20bdde);}return _0x220e4c[_0x9831('0x1d')](_0x20bdde)[_0x9831('0x1e')]();};}function respondWithResult(_0x5d0441,_0x34f164){_0x34f164=_0x34f164||0xc8;return function(_0x5b9476){if(_0x5b9476){return _0x5d0441['status'](_0x34f164)[_0x9831('0x1f')](_0x5b9476);}};}function respondWithFilteredResult(_0x505c7d,_0x3a5fc3){return function(_0xae37bf){if(_0xae37bf){var _0x40b26a=typeof _0x3a5fc3[_0x9831('0x20')]===_0x9831('0x21')&&typeof _0x3a5fc3[_0x9831('0x22')]==='undefined';var _0x50ad40=_0xae37bf[_0x9831('0x23')];var _0x260fdb=_0x40b26a?0x0:_0x3a5fc3[_0x9831('0x20')];var _0x49c2d7=_0x40b26a?_0xae37bf[_0x9831('0x23')]:_0x3a5fc3[_0x9831('0x20')]+_0x3a5fc3['limit'];var _0x5e124a;if(_0x49c2d7>=_0x50ad40){_0x49c2d7=_0x50ad40;_0x5e124a=0xc8;}else{_0x5e124a=0xce;}_0x505c7d['status'](_0x5e124a);return _0x505c7d['set'](_0x9831('0x24'),_0x260fdb+'-'+_0x49c2d7+'/'+_0x50ad40)[_0x9831('0x1f')](_0xae37bf);}return null;};}function patchUpdates(_0x2d9b46){return function(_0x56854e){try{jsonpatch[_0x9831('0x25')](_0x56854e,_0x2d9b46,!![]);}catch(_0x3baa8c){return BPromise[_0x9831('0x26')](_0x3baa8c);}return _0x56854e[_0x9831('0x27')]();};}function saveUpdates(_0xfd8f52,_0x1f4f68){return function(_0x58cd03){if(_0x58cd03){return _0x58cd03[_0x9831('0x28')](_0xfd8f52)['then'](function(_0x4a0355){return _0x4a0355;});}return null;};}function removeEntity(_0x578109,_0x3ff939){return function(_0x37a473){if(_0x37a473){return _0x37a473['destroy']()[_0x9831('0x29')](function(){_0x578109[_0x9831('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x233580,_0xcaf70b){return function(_0x22e243){if(!_0x22e243){_0x233580[_0x9831('0x1c')](0x194);}return _0x22e243;};}function handleError(_0x453425,_0xb70db9){_0xb70db9=_0xb70db9||0x1f4;return function(_0x1b9982){logger[_0x9831('0x2a')](_0x1b9982[_0x9831('0x2b')]);if(_0x1b9982['name']){delete _0x1b9982[_0x9831('0x2c')];}_0x453425[_0x9831('0x1d')](_0xb70db9)[_0x9831('0x2d')](_0x1b9982);};}exports[_0x9831('0x2e')]=function(_0x2f4eb0,_0x48dae0){var _0x222c86={},_0x5803fb={},_0x4378dd={'count':0x0,'rows':[]};var _0x5768d1=_[_0x9831('0x2f')](db[_0x9831('0x30')][_0x9831('0x31')],function(_0x54bfdd){return{'name':_0x54bfdd[_0x9831('0x32')],'type':_0x54bfdd[_0x9831('0x33')][_0x9831('0x34')]};});_0x5803fb[_0x9831('0x35')]=_[_0x9831('0x2f')](_0x5768d1,_0x9831('0x2c'));_0x5803fb[_0x9831('0x36')]=_[_0x9831('0x37')](_0x2f4eb0['query']);_0x5803fb['filters']=_[_0x9831('0x38')](_0x5803fb[_0x9831('0x35')],_0x5803fb[_0x9831('0x36')]);_0x222c86['attributes']=_[_0x9831('0x38')](_0x5803fb['model'],qs[_0x9831('0x39')](_0x2f4eb0[_0x9831('0x36')]['fields']));_0x222c86['attributes']=_0x222c86['attributes'][_0x9831('0x3a')]?_0x222c86[_0x9831('0x3b')]:_0x5803fb[_0x9831('0x35')];if(!_0x2f4eb0[_0x9831('0x36')][_0x9831('0x3c')]('nolimit')){_0x222c86['limit']=qs['limit'](_0x2f4eb0[_0x9831('0x36')][_0x9831('0x22')]);_0x222c86[_0x9831('0x20')]=qs[_0x9831('0x20')](_0x2f4eb0[_0x9831('0x36')][_0x9831('0x20')]);}_0x222c86['order']=qs[_0x9831('0x3d')](_0x2f4eb0['query'][_0x9831('0x3d')]);_0x222c86[_0x9831('0x3e')]=qs[_0x9831('0x3f')](_[_0x9831('0x40')](_0x2f4eb0[_0x9831('0x36')],_0x5803fb[_0x9831('0x3f')]),_0x5768d1);if(_0x2f4eb0[_0x9831('0x36')]['filter']){_0x222c86[_0x9831('0x3e')]=_[_0x9831('0x41')](_0x222c86[_0x9831('0x3e')],{'$or':_[_0x9831('0x2f')](_0x5768d1,function(_0x3a612d){if(_0x3a612d['type']!==_0x9831('0x42')){var _0x1efdae={};_0x1efdae[_0x3a612d[_0x9831('0x2c')]]={'$like':'%'+_0x2f4eb0[_0x9831('0x36')][_0x9831('0x43')]+'%'};return _0x1efdae;}})});}_0x222c86=_[_0x9831('0x41')]({},_0x222c86,_0x2f4eb0[_0x9831('0x44')]);var _0x2b628e={'where':_0x222c86[_0x9831('0x3e')]};return db[_0x9831('0x30')]['count'](_0x2b628e)[_0x9831('0x29')](function(_0x1c4b1a){_0x4378dd[_0x9831('0x23')]=_0x1c4b1a;if(_0x2f4eb0[_0x9831('0x36')][_0x9831('0x45')]){_0x222c86[_0x9831('0x46')]=[{'all':!![]}];}return db[_0x9831('0x30')][_0x9831('0x47')](_0x222c86);})[_0x9831('0x29')](function(_0x50d41f){_0x4378dd[_0x9831('0x48')]=_0x50d41f;return _0x4378dd;})[_0x9831('0x29')](respondWithFilteredResult(_0x48dae0,_0x222c86))['catch'](handleError(_0x48dae0,null));};exports[_0x9831('0x49')]=function(_0x2d5be9,_0x24bcb3){var _0x4b5caa={'raw':![],'where':{'id':_0x2d5be9[_0x9831('0x4a')]['id']}},_0x49d265={};_0x49d265[_0x9831('0x35')]=_[_0x9831('0x37')](db[_0x9831('0x30')]['rawAttributes']);_0x49d265[_0x9831('0x36')]=_[_0x9831('0x37')](_0x2d5be9[_0x9831('0x36')]);_0x49d265[_0x9831('0x3f')]=_[_0x9831('0x38')](_0x49d265[_0x9831('0x35')],_0x49d265[_0x9831('0x36')]);_0x4b5caa[_0x9831('0x3b')]=_[_0x9831('0x38')](_0x49d265[_0x9831('0x35')],qs[_0x9831('0x39')](_0x2d5be9[_0x9831('0x36')]['fields']));_0x4b5caa[_0x9831('0x3b')]=_0x4b5caa[_0x9831('0x3b')][_0x9831('0x3a')]?_0x4b5caa[_0x9831('0x3b')]:_0x49d265[_0x9831('0x35')];if(_0x2d5be9['query']['includeAll']){_0x4b5caa[_0x9831('0x46')]=[{'all':!![]}];}_0x4b5caa=_[_0x9831('0x41')]({},_0x4b5caa,_0x2d5be9[_0x9831('0x44')]);return db[_0x9831('0x30')][_0x9831('0x4b')](_0x4b5caa)['then'](handleEntityNotFound(_0x24bcb3,null))['then'](respondWithResult(_0x24bcb3,null))['catch'](handleError(_0x24bcb3,null));};exports[_0x9831('0x4c')]=function(_0x1ad6f3,_0x35844b){return db[_0x9831('0x30')][_0x9831('0x4c')](_0x1ad6f3[_0x9831('0x4d')],{})[_0x9831('0x29')](respondWithResult(_0x35844b,0xc9))[_0x9831('0x4e')](handleError(_0x35844b,null));};exports[_0x9831('0x28')]=function(_0x192782,_0x351e10){if(_0x192782[_0x9831('0x4d')]['id']){delete _0x192782[_0x9831('0x4d')]['id'];}return db[_0x9831('0x30')][_0x9831('0x4b')]({'where':{'id':_0x192782[_0x9831('0x4a')]['id']}})[_0x9831('0x29')](handleEntityNotFound(_0x351e10,null))['then'](saveUpdates(_0x192782['body'],null))[_0x9831('0x29')](respondWithResult(_0x351e10,null))[_0x9831('0x4e')](handleError(_0x351e10,null));};exports[_0x9831('0x4f')]=function(_0x23bea2,_0x29ac20){return db[_0x9831('0x30')][_0x9831('0x4b')]({'where':{'id':_0x23bea2['params']['id']}})[_0x9831('0x29')](handleEntityNotFound(_0x29ac20,null))[_0x9831('0x29')](removeEntity(_0x29ac20,null))[_0x9831('0x4e')](handleError(_0x29ac20,null));};exports[_0x9831('0x50')]=function(_0x59e5f3,_0x4727cc){return db[_0x9831('0x30')][_0x9831('0x50')]()['then'](respondWithResult(_0x4727cc,null))[_0x9831('0x4e')](handleError(_0x4727cc,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 1331512..5a802c1 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 _0xa733=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./userProfileSection.attributes','exports','define','UserProfileSection','user_profile_has_sections','compositeIndex','userProfileId','util','../../config/logger'];(function(_0x290a56,_0x5c540a){var _0x89610=function(_0x4e901f){while(--_0x4e901f){_0x290a56['push'](_0x290a56['shift']());}};_0x89610(++_0x5c540a);}(_0xa733,0xee));var _0x3a73=function(_0x1aebd7,_0x4618ff){_0x1aebd7=_0x1aebd7-0x0;var _0x2a238a=_0xa733[_0x1aebd7];return _0x2a238a;};'use strict';var _=require('lodash');var util=require(_0x3a73('0x0'));var logger=require(_0x3a73('0x1'))('api');var moment=require(_0x3a73('0x2'));var BPromise=require(_0x3a73('0x3'));var rp=require(_0x3a73('0x4'));var fs=require('fs');var path=require(_0x3a73('0x5'));var rimraf=require(_0x3a73('0x6'));var config=require(_0x3a73('0x7'));var attributes=require(_0x3a73('0x8'));module[_0x3a73('0x9')]=function(_0x493b84,_0x5c2f12){return _0x493b84[_0x3a73('0xa')](_0x3a73('0xb'),attributes,{'tableName':_0x3a73('0xc'),'paranoid':![],'indexes':[{'name':_0x3a73('0xd'),'fields':['sectionId',_0x3a73('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8338=['define','user_profile_has_sections','compositeIndex','userProfileId','lodash','api','moment','bluebird','path','rimraf','../../config/environment','exports'];(function(_0x47ad2c,_0x545ba4){var _0x484aab=function(_0x493a1a){while(--_0x493a1a){_0x47ad2c['push'](_0x47ad2c['shift']());}};_0x484aab(++_0x545ba4);}(_0x8338,0x88));var _0x8833=function(_0x4080e5,_0x185a1b){_0x4080e5=_0x4080e5-0x0;var _0x4383a0=_0x8338[_0x4080e5];return _0x4383a0;};'use strict';var _=require(_0x8833('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x8833('0x1'));var moment=require(_0x8833('0x2'));var BPromise=require(_0x8833('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8833('0x4'));var rimraf=require(_0x8833('0x5'));var config=require(_0x8833('0x6'));var attributes=require('./userProfileSection.attributes');module[_0x8833('0x7')]=function(_0x13dffe,_0x191a9a){return _0x13dffe[_0x8833('0x8')]('UserProfileSection',attributes,{'tableName':_0x8833('0x9'),'paranoid':![],'indexes':[{'name':_0x8833('0xa'),'fields':['sectionId',_0x8833('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index e318465..0c183f9 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 _0xd46c=['UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','lodash','util','../../config/logger','rpc','jayson/promise','client','http','request','info'];(function(_0x15d308,_0x273bdd){var _0x49740f=function(_0x2ec06d){while(--_0x2ec06d){_0x15d308['push'](_0x15d308['shift']());}};_0x49740f(++_0x273bdd);}(_0xd46c,0x1a7));var _0xcd46=function(_0x58b665,_0x19d106){_0x58b665=_0x58b665-0x0;var _0x4829cf=_0xd46c[_0x58b665];return _0x4829cf;};'use strict';var _=require(_0xcd46('0x0'));var util=require(_0xcd46('0x1'));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('../../config/utils');var logger=require(_0xcd46('0x2'))(_0xcd46('0x3'));var config=require('../../config/environment');var jayson=require(_0xcd46('0x4'));var client=jayson[_0xcd46('0x5')][_0xcd46('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x37e276,_0x5ca978,_0x25d685){return new BPromise(function(_0x5a1e70,_0x3b1d75){return client[_0xcd46('0x7')](_0x37e276,_0x25d685)['then'](function(_0x5557a2){logger[_0xcd46('0x8')](_0xcd46('0x9'),_0x5ca978,_0xcd46('0xa'));logger[_0xcd46('0xb')]('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x5ca978,_0xcd46('0xa'),JSON[_0xcd46('0xc')](_0x5557a2));if(_0x5557a2[_0xcd46('0xd')]){if(_0x5557a2['error']['code']===0x1f4){logger[_0xcd46('0xd')]('UserProfileSection,\x20%s,\x20%s',_0x5ca978,_0x5557a2[_0xcd46('0xd')]['message']);return _0x3b1d75(_0x5557a2[_0xcd46('0xd')][_0xcd46('0xe')]);}logger[_0xcd46('0xd')](_0xcd46('0x9'),_0x5ca978,_0x5557a2['error'][_0xcd46('0xe')]);return _0x5a1e70(_0x5557a2[_0xcd46('0xd')][_0xcd46('0xe')]);}else{logger['info'](_0xcd46('0x9'),_0x5ca978,'request\x20sent');_0x5a1e70(_0x5557a2[_0xcd46('0xf')]['message']);}})['catch'](function(_0x51a443){logger[_0xcd46('0xd')]('UserProfileSection,\x20%s,\x20%s',_0x5ca978,_0x51a443);_0x3b1d75(_0x51a443);});});} \ No newline at end of file +var _0xe93b=['request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','error','code','UserProfileSection,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then'];(function(_0x4a19af,_0x3fa25e){var _0x2e7e5e=function(_0x19831a){while(--_0x19831a){_0x4a19af['push'](_0x4a19af['shift']());}};_0x2e7e5e(++_0x3fa25e);}(_0xe93b,0x16a));var _0xbe93=function(_0x284e85,_0x1bfec9){_0x284e85=_0x284e85-0x0;var _0x59ba3d=_0xe93b[_0x284e85];return _0x59ba3d;};'use strict';var _=require(_0xbe93('0x0'));var util=require(_0xbe93('0x1'));var moment=require(_0xbe93('0x2'));var BPromise=require(_0xbe93('0x3'));var rs=require(_0xbe93('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xbe93('0x5'));var logger=require(_0xbe93('0x6'))(_0xbe93('0x7'));var config=require(_0xbe93('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xbe93('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2dd8aa,_0x2d5f9a,_0x3ab63c){return new BPromise(function(_0x396b8c,_0x1edee5){return client[_0xbe93('0xa')](_0x2dd8aa,_0x3ab63c)[_0xbe93('0xb')](function(_0x35ac7f){logger['info']('UserProfileSection,\x20%s,\x20%s',_0x2d5f9a,_0xbe93('0xc'));logger[_0xbe93('0xd')](_0xbe93('0xe'),_0x2d5f9a,_0xbe93('0xc'),JSON['stringify'](_0x35ac7f));if(_0x35ac7f[_0xbe93('0xf')]){if(_0x35ac7f[_0xbe93('0xf')][_0xbe93('0x10')]===0x1f4){logger[_0xbe93('0xf')](_0xbe93('0x11'),_0x2d5f9a,_0x35ac7f[_0xbe93('0xf')]['message']);return _0x1edee5(_0x35ac7f['error'][_0xbe93('0x12')]);}logger['error']('UserProfileSection,\x20%s,\x20%s',_0x2d5f9a,_0x35ac7f[_0xbe93('0xf')]['message']);return _0x396b8c(_0x35ac7f['error'][_0xbe93('0x12')]);}else{logger[_0xbe93('0x13')](_0xbe93('0x11'),_0x2d5f9a,_0xbe93('0xc'));_0x396b8c(_0x35ac7f[_0xbe93('0x14')][_0xbe93('0x12')]);}})[_0xbe93('0x15')](function(_0x4c159d){logger[_0xbe93('0xf')](_0xbe93('0x11'),_0x2d5f9a,_0x4c159d);_0x1edee5(_0x4c159d);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 45e4a1c..c006f62 100644 --- a/server/api/userSmsQueue/index.js +++ b/server/api/userSmsQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x2f3d2b,_0x450c70){var _0x30e056=function(_0x156dc9){while(--_0x156dc9){_0x2f3d2b['push'](_0x2f3d2b['shift']());}};_0x30e056(++_0x450c70);}(_0xa9e0,0x123));var _0x0a9e=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xa9e0[_0x387777];return _0x3f84c0;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x511577,_0x2ec0cf){var _0x1b9201=function(_0x334aac){while(--_0x334aac){_0x511577['push'](_0x511577['shift']());}};_0x1b9201(++_0x2ec0cf);}(_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/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index ce45360..349fdc5 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 _0x66f7=['INTEGER','exports'];(function(_0x413b13,_0x4a25de){var _0x1cad2e=function(_0x757303){while(--_0x757303){_0x413b13['push'](_0x413b13['shift']());}};_0x1cad2e(++_0x4a25de);}(_0x66f7,0x16b));var _0x766f=function(_0x4a0e68,_0x45c08c){_0x4a0e68=_0x4a0e68-0x0;var _0x4fb274=_0x66f7[_0x4a0e68];return _0x4fb274;};'use strict';var Sequelize=require('sequelize');module[_0x766f('0x0')]={'penalty':{'type':Sequelize[_0x766f('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x492e=['INTEGER','sequelize','exports'];(function(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0x492e,0x1d5));var _0xe492=function(_0x312ab2,_0x1b35a9){_0x312ab2=_0x312ab2-0x0;var _0x321d86=_0x492e[_0x312ab2];return _0x321d86;};'use strict';var Sequelize=require(_0xe492('0x0'));module[_0xe492('0x1')]={'penalty':{'type':Sequelize[_0xe492('0x2')],'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 3d4d82b..269ef08 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 _0xaa64=['../../config/environment','./userSmsQueue.attributes','exports','define','UserSmsQueue','lodash','util','api','bluebird','request-promise','path'];(function(_0x30ec0a,_0x390560){var _0x1c5562=function(_0xf152ac){while(--_0xf152ac){_0x30ec0a['push'](_0x30ec0a['shift']());}};_0x1c5562(++_0x390560);}(_0xaa64,0xf7));var _0x4aa6=function(_0x3829f4,_0x292ff8){_0x3829f4=_0x3829f4-0x0;var _0x453787=_0xaa64[_0x3829f4];return _0x453787;};'use strict';var _=require(_0x4aa6('0x0'));var util=require(_0x4aa6('0x1'));var logger=require('../../config/logger')(_0x4aa6('0x2'));var moment=require('moment');var BPromise=require(_0x4aa6('0x3'));var rp=require(_0x4aa6('0x4'));var fs=require('fs');var path=require(_0x4aa6('0x5'));var rimraf=require('rimraf');var config=require(_0x4aa6('0x6'));var attributes=require(_0x4aa6('0x7'));module[_0x4aa6('0x8')]=function(_0x37a260,_0x426bd6){return _0x37a260[_0x4aa6('0x9')](_0x4aa6('0xa'),attributes,{'tableName':'user_has_sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2d72=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userSmsQueue.attributes','exports','UserSmsQueue','user_has_sms_queues'];(function(_0xa00760,_0x3d0028){var _0x91e171=function(_0x1e8fb5){while(--_0x1e8fb5){_0xa00760['push'](_0xa00760['shift']());}};_0x91e171(++_0x3d0028);}(_0x2d72,0xa8));var _0x22d7=function(_0x3ab737,_0x177d9c){_0x3ab737=_0x3ab737-0x0;var _0x349e9b=_0x2d72[_0x3ab737];return _0x349e9b;};'use strict';var _=require(_0x22d7('0x0'));var util=require(_0x22d7('0x1'));var logger=require(_0x22d7('0x2'))(_0x22d7('0x3'));var moment=require(_0x22d7('0x4'));var BPromise=require(_0x22d7('0x5'));var rp=require(_0x22d7('0x6'));var fs=require('fs');var path=require(_0x22d7('0x7'));var rimraf=require(_0x22d7('0x8'));var config=require(_0x22d7('0x9'));var attributes=require(_0x22d7('0xa'));module[_0x22d7('0xb')]=function(_0x208b5b,_0x100426){return _0x208b5b['define'](_0x22d7('0xc'),attributes,{'tableName':_0x22d7('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.rpc.js b/server/api/userSmsQueue/userSmsQueue.rpc.js index 92ca0f3..3702c29 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 _0x8f1a=['request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','UserSmsQueue,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','request','info'];(function(_0x3de8a4,_0x289a5c){var _0x4635cf=function(_0x2bddb8){while(--_0x2bddb8){_0x3de8a4['push'](_0x3de8a4['shift']());}};_0x4635cf(++_0x289a5c);}(_0x8f1a,0x105));var _0xa8f1=function(_0x449ffe,_0xfc9a){_0x449ffe=_0x449ffe-0x0;var _0xae175a=_0x8f1a[_0x449ffe];return _0xae175a;};'use strict';var _=require(_0xa8f1('0x0'));var util=require(_0xa8f1('0x1'));var moment=require(_0xa8f1('0x2'));var BPromise=require(_0xa8f1('0x3'));var rs=require(_0xa8f1('0x4'));var fs=require('fs');var Redis=require(_0xa8f1('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xa8f1('0x6'));var logger=require(_0xa8f1('0x7'))(_0xa8f1('0x8'));var config=require(_0xa8f1('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x26bb3b,_0x1fd9bd,_0x1d5f0a){return new BPromise(function(_0x3d8534,_0x2cbbe3){return client[_0xa8f1('0xa')](_0x26bb3b,_0x1d5f0a)['then'](function(_0x3cec7b){logger[_0xa8f1('0xb')]('UserSmsQueue,\x20%s,\x20%s',_0x1fd9bd,_0xa8f1('0xc'));logger[_0xa8f1('0xd')](_0xa8f1('0xe'),_0x1fd9bd,'request\x20sent',JSON[_0xa8f1('0xf')](_0x3cec7b));if(_0x3cec7b[_0xa8f1('0x10')]){if(_0x3cec7b['error']['code']===0x1f4){logger[_0xa8f1('0x10')](_0xa8f1('0x11'),_0x1fd9bd,_0x3cec7b['error'][_0xa8f1('0x12')]);return _0x2cbbe3(_0x3cec7b[_0xa8f1('0x10')][_0xa8f1('0x12')]);}logger['error'](_0xa8f1('0x11'),_0x1fd9bd,_0x3cec7b[_0xa8f1('0x10')]['message']);return _0x3d8534(_0x3cec7b[_0xa8f1('0x10')][_0xa8f1('0x12')]);}else{logger[_0xa8f1('0xb')](_0xa8f1('0x11'),_0x1fd9bd,_0xa8f1('0xc'));_0x3d8534(_0x3cec7b[_0xa8f1('0x13')][_0xa8f1('0x12')]);}})[_0xa8f1('0x14')](function(_0x290982){logger['error'](_0xa8f1('0x11'),_0x1fd9bd,_0x290982);_0x2cbbe3(_0x290982);});});} \ No newline at end of file +var _0x3fde=['client','http','then','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0xcab077,_0x477fd2){var _0x392a29=function(_0x15c2ad){while(--_0x15c2ad){_0xcab077['push'](_0xcab077['shift']());}};_0x392a29(++_0x477fd2);}(_0x3fde,0xdd));var _0xe3fd=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x3fde[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xe3fd('0x0'));var util=require(_0xe3fd('0x1'));var moment=require('moment');var BPromise=require(_0xe3fd('0x2'));var rs=require(_0xe3fd('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe3fd('0x4'))['db'];var utils=require(_0xe3fd('0x5'));var logger=require(_0xe3fd('0x6'))(_0xe3fd('0x7'));var config=require(_0xe3fd('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xe3fd('0x9')][_0xe3fd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x33df5f,_0x5ca9d1,_0x5032e4){return new BPromise(function(_0x5e869d,_0x5cac24){return client['request'](_0x33df5f,_0x5032e4)[_0xe3fd('0xb')](function(_0xd50b89){logger['info'](_0xe3fd('0xc'),_0x5ca9d1,_0xe3fd('0xd'));logger[_0xe3fd('0xe')](_0xe3fd('0xf'),_0x5ca9d1,'request\x20sent',JSON[_0xe3fd('0x10')](_0xd50b89));if(_0xd50b89[_0xe3fd('0x11')]){if(_0xd50b89[_0xe3fd('0x11')][_0xe3fd('0x12')]===0x1f4){logger[_0xe3fd('0x11')](_0xe3fd('0xc'),_0x5ca9d1,_0xd50b89[_0xe3fd('0x11')][_0xe3fd('0x13')]);return _0x5cac24(_0xd50b89[_0xe3fd('0x11')][_0xe3fd('0x13')]);}logger[_0xe3fd('0x11')]('UserSmsQueue,\x20%s,\x20%s',_0x5ca9d1,_0xd50b89[_0xe3fd('0x11')]['message']);return _0x5e869d(_0xd50b89['error']['message']);}else{logger[_0xe3fd('0x14')](_0xe3fd('0xc'),_0x5ca9d1,_0xe3fd('0xd'));_0x5e869d(_0xd50b89[_0xe3fd('0x15')][_0xe3fd('0x13')]);}})[_0xe3fd('0x16')](function(_0x310946){logger[_0xe3fd('0x11')]('UserSmsQueue,\x20%s,\x20%s',_0x5ca9d1,_0x310946);_0x5cac24(_0x310946);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index 730c6b3..72bfe0e 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 _0xdfa1=['INTEGER','sequelize','exports'];(function(_0x21fe11,_0x52f846){var _0x5eb704=function(_0x6be159){while(--_0x6be159){_0x21fe11['push'](_0x21fe11['shift']());}};_0x5eb704(++_0x52f846);}(_0xdfa1,0x79));var _0x1dfa=function(_0x54d4a8,_0x585a59){_0x54d4a8=_0x54d4a8-0x0;var _0x3b321b=_0xdfa1[_0x54d4a8];return _0x3b321b;};'use strict';var Sequelize=require(_0x1dfa('0x0'));module[_0x1dfa('0x1')]={'UserId':{'type':Sequelize[_0x1dfa('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x1dfa('0x2')]}}; \ No newline at end of file +var _0xa26c=['sequelize','INTEGER'];(function(_0x5f238d,_0x374658){var _0x43abbc=function(_0x5d472f){while(--_0x5d472f){_0x5f238d['push'](_0x5f238d['shift']());}};_0x43abbc(++_0x374658);}(_0xa26c,0x15c));var _0xca26=function(_0x1d42fc,_0x61ebaf){_0x1d42fc=_0x1d42fc-0x0;var _0x5908c0=_0xa26c[_0x1d42fc];return _0x5908c0;};'use strict';var Sequelize=require(_0xca26('0x0'));module['exports']={'UserId':{'type':Sequelize[_0xca26('0x1')]},'VoicePrefixId':{'type':Sequelize[_0xca26('0x1')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index 63f1185..d2c09c8 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(_0x456752,_0x530aeb){var _0x4b0ffe=function(_0x1cd4ee){while(--_0x1cd4ee){_0x456752['push'](_0x456752['shift']());}};_0x4b0ffe(++_0x530aeb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa9e0[_0x47a7d0];return _0xb9bd08;};'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(_0x149ce6,_0x352151){var _0x1fa4a6=function(_0x37f405){while(--_0x37f405){_0x149ce6['push'](_0x149ce6['shift']());}};_0x1fa4a6(++_0x352151);}(_0xa9e0,0x123));var _0x0a9e=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0xa9e0[_0x12d033];return _0x3b4e80;};'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 c7789b3..e4c74de 100644 --- a/server/api/userVoiceQueue/index.js +++ b/server/api/userVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x2bb7d7,_0x46c9ef){var _0x4547c=function(_0x4a8211){while(--_0x4a8211){_0x2bb7d7['push'](_0x2bb7d7['shift']());}};_0x4547c(++_0x46c9ef);}(_0xe706,0xa3));var _0x6e70=function(_0x36fc1f,_0x27c1c8){_0x36fc1f=_0x36fc1f-0x0;var _0x371281=_0xe706[_0x36fc1f];return _0x371281;};'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(_0x1f99e,_0x1dfdfc){var _0x2e547b=function(_0x2a21d5){while(--_0x2a21d5){_0x1f99e['push'](_0x1f99e['shift']());}};_0x2e547b(++_0x1dfdfc);}(_0xe706,0xa3));var _0x6e70=function(_0x214890,_0x2562c0){_0x214890=_0x214890-0x0;var _0x760050=_0xe706[_0x214890];return _0x760050;};'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 f9b34b3..98839c7 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 _0xe7a5=['sequelize','exports','INTEGER'];(function(_0x18a28a,_0x23e873){var _0x1a9107=function(_0x406fdd){while(--_0x406fdd){_0x18a28a['push'](_0x18a28a['shift']());}};_0x1a9107(++_0x23e873);}(_0xe7a5,0xe4));var _0x5e7a=function(_0x4394b6,_0x12357f){_0x4394b6=_0x4394b6-0x0;var _0x360244=_0xe7a5[_0x4394b6];return _0x360244;};'use strict';var Sequelize=require(_0x5e7a('0x0'));module[_0x5e7a('0x1')]={'penalty':{'type':Sequelize[_0x5e7a('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xdf97=['INTEGER','exports'];(function(_0x4c2114,_0x3a25b5){var _0x4757f6=function(_0x5e7ab2){while(--_0x5e7ab2){_0x4c2114['push'](_0x4c2114['shift']());}};_0x4757f6(++_0x3a25b5);}(_0xdf97,0x11d));var _0x7df9=function(_0x1e9442,_0x18bbd8){_0x1e9442=_0x1e9442-0x0;var _0x403575=_0xdf97[_0x1e9442];return _0x403575;};'use strict';var Sequelize=require('sequelize');module[_0x7df9('0x0')]={'penalty':{'type':Sequelize[_0x7df9('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index 4f37474..d24f8b4 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 _0xbd2f=['bluebird','request-promise','path','../../config/environment','./userVoiceQueue.attributes','exports','define','UserVoiceQueue','user_has_voice_queues','lodash','../../config/logger','api','moment'];(function(_0x37357f,_0x3b23bb){var _0x505ef9=function(_0x42df61){while(--_0x42df61){_0x37357f['push'](_0x37357f['shift']());}};_0x505ef9(++_0x3b23bb);}(_0xbd2f,0x134));var _0xfbd2=function(_0x446f9d,_0x3de91e){_0x446f9d=_0x446f9d-0x0;var _0x58bfbc=_0xbd2f[_0x446f9d];return _0x58bfbc;};'use strict';var _=require(_0xfbd2('0x0'));var util=require('util');var logger=require(_0xfbd2('0x1'))(_0xfbd2('0x2'));var moment=require(_0xfbd2('0x3'));var BPromise=require(_0xfbd2('0x4'));var rp=require(_0xfbd2('0x5'));var fs=require('fs');var path=require(_0xfbd2('0x6'));var rimraf=require('rimraf');var config=require(_0xfbd2('0x7'));var attributes=require(_0xfbd2('0x8'));module[_0xfbd2('0x9')]=function(_0x4a7391,_0x52a555){return _0x4a7391[_0xfbd2('0xa')](_0xfbd2('0xb'),attributes,{'tableName':_0xfbd2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x88c1=['bluebird','request-promise','path','rimraf','../../config/environment','./userVoiceQueue.attributes','define','user_has_voice_queues','util','../../config/logger'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x88c1,0x116));var _0x188c=function(_0x580e6e,_0x4f822f){_0x580e6e=_0x580e6e-0x0;var _0x5a91af=_0x88c1[_0x580e6e];return _0x5a91af;};'use strict';var _=require('lodash');var util=require(_0x188c('0x0'));var logger=require(_0x188c('0x1'))('api');var moment=require('moment');var BPromise=require(_0x188c('0x2'));var rp=require(_0x188c('0x3'));var fs=require('fs');var path=require(_0x188c('0x4'));var rimraf=require(_0x188c('0x5'));var config=require(_0x188c('0x6'));var attributes=require(_0x188c('0x7'));module['exports']=function(_0x174253,_0x160e6b){return _0x174253[_0x188c('0x8')]('UserVoiceQueue',attributes,{'tableName':_0x188c('0x9'),'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 37029e5..299d26a 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 _0x22dd=['UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserVoiceQueue,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','request\x20sent'];(function(_0x2514e2,_0x7490ad){var _0x28b546=function(_0x250a47){while(--_0x250a47){_0x2514e2['push'](_0x2514e2['shift']());}};_0x28b546(++_0x7490ad);}(_0x22dd,0xa2));var _0xd22d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x22dd[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd22d('0x0'));var util=require(_0xd22d('0x1'));var moment=require(_0xd22d('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd22d('0x3'));var db=require(_0xd22d('0x4'))['db'];var utils=require(_0xd22d('0x5'));var logger=require(_0xd22d('0x6'))('rpc');var config=require(_0xd22d('0x7'));var jayson=require(_0xd22d('0x8'));var client=jayson[_0xd22d('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2df689,_0x32d797,_0x48dee5){return new BPromise(function(_0x40da8b,_0x396577){return client[_0xd22d('0xa')](_0x2df689,_0x48dee5)[_0xd22d('0xb')](function(_0x4d53fb){logger[_0xd22d('0xc')]('UserVoiceQueue,\x20%s,\x20%s',_0x32d797,_0xd22d('0xd'));logger['debug'](_0xd22d('0xe'),_0x32d797,_0xd22d('0xd'),JSON[_0xd22d('0xf')](_0x4d53fb));if(_0x4d53fb[_0xd22d('0x10')]){if(_0x4d53fb[_0xd22d('0x10')][_0xd22d('0x11')]===0x1f4){logger['error'](_0xd22d('0x12'),_0x32d797,_0x4d53fb[_0xd22d('0x10')]['message']);return _0x396577(_0x4d53fb[_0xd22d('0x10')][_0xd22d('0x13')]);}logger['error'](_0xd22d('0x12'),_0x32d797,_0x4d53fb[_0xd22d('0x10')][_0xd22d('0x13')]);return _0x40da8b(_0x4d53fb['error'][_0xd22d('0x13')]);}else{logger[_0xd22d('0xc')](_0xd22d('0x12'),_0x32d797,'request\x20sent');_0x40da8b(_0x4d53fb[_0xd22d('0x14')][_0xd22d('0x13')]);}})[_0xd22d('0x15')](function(_0x15f46b){logger['error'](_0xd22d('0x12'),_0x32d797,_0x15f46b);_0x396577(_0x15f46b);});});} \ No newline at end of file +var _0x5521=['../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','stringify','error','message','UserVoiceQueue,\x20%s,\x20%s','result','moment','randomstring','ioredis'];(function(_0x546d03,_0x451d82){var _0xf8a81=function(_0x25d15a){while(--_0x25d15a){_0x546d03['push'](_0x546d03['shift']());}};_0xf8a81(++_0x451d82);}(_0x5521,0x140));var _0x1552=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5521[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1552('0x0'));var BPromise=require('bluebird');var rs=require(_0x1552('0x1'));var fs=require('fs');var Redis=require(_0x1552('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x1552('0x3'));var logger=require(_0x1552('0x4'))(_0x1552('0x5'));var config=require(_0x1552('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x1552('0x7')][_0x1552('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5f227e,_0x21a3c2,_0x12993f){return new BPromise(function(_0xa5cb68,_0x5d82ac){return client[_0x1552('0x9')](_0x5f227e,_0x12993f)[_0x1552('0xa')](function(_0x36ccc6){logger[_0x1552('0xb')]('UserVoiceQueue,\x20%s,\x20%s',_0x21a3c2,_0x1552('0xc'));logger[_0x1552('0xd')]('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x21a3c2,'request\x20sent',JSON[_0x1552('0xe')](_0x36ccc6));if(_0x36ccc6[_0x1552('0xf')]){if(_0x36ccc6[_0x1552('0xf')]['code']===0x1f4){logger[_0x1552('0xf')]('UserVoiceQueue,\x20%s,\x20%s',_0x21a3c2,_0x36ccc6[_0x1552('0xf')][_0x1552('0x10')]);return _0x5d82ac(_0x36ccc6[_0x1552('0xf')][_0x1552('0x10')]);}logger['error'](_0x1552('0x11'),_0x21a3c2,_0x36ccc6['error']['message']);return _0xa5cb68(_0x36ccc6[_0x1552('0xf')][_0x1552('0x10')]);}else{logger['info']('UserVoiceQueue,\x20%s,\x20%s',_0x21a3c2,_0x1552('0xc'));_0xa5cb68(_0x36ccc6[_0x1552('0x12')][_0x1552('0x10')]);}})['catch'](function(_0x114cf2){logger['error'](_0x1552('0x11'),_0x21a3c2,_0x114cf2);_0x5d82ac(_0x114cf2);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 796f381..ddd20cf 100644 --- a/server/api/userVoiceQueueRt/index.js +++ b/server/api/userVoiceQueueRt/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x39df5b,_0xb6aa74){var _0x155106=function(_0x2f5a2a){while(--_0x2f5a2a){_0x39df5b['push'](_0x39df5b['shift']());}};_0x155106(++_0xb6aa74);}(_0xe706,0xa3));var _0x6e70=function(_0x5de7f2,_0x358f95){_0x5de7f2=_0x5de7f2-0x0;var _0x1095d3=_0xe706[_0x5de7f2];return _0x1095d3;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x27bca8,_0x191f63){var _0x370163=function(_0x1329f8){while(--_0x1329f8){_0x27bca8['push'](_0x27bca8['shift']());}};_0x370163(++_0x191f63);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa9e0[_0x5ddb1c];return _0x354adc;};'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 e00eb09..764aeb0 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 _0x104b=['STRING','queue_interface','Required\x20by\x20Asterisk','exports','INTEGER'];(function(_0x1b3b47,_0x43cdaf){var _0x2e7975=function(_0x3de251){while(--_0x3de251){_0x1b3b47['push'](_0x1b3b47['shift']());}};_0x2e7975(++_0x43cdaf);}(_0x104b,0x143));var _0xb104=function(_0x2a446e,_0x526ca0){_0x2a446e=_0x2a446e-0x0;var _0x136947=_0x104b[_0x2a446e];return _0x136947;};'use strict';var Sequelize=require('sequelize');module[_0xb104('0x0')]={'uniqueid':{'type':Sequelize[_0xb104('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':'Required\x20by\x20Asterisk'},'membername':{'type':Sequelize[_0xb104('0x2')],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize[_0xb104('0x1')],'allowNull':![]},'queue_name':{'type':Sequelize[_0xb104('0x2')],'allowNull':![],'unique':_0xb104('0x3'),'comment':_0xb104('0x4')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize[_0xb104('0x2')],'allowNull':![],'unique':_0xb104('0x3'),'comment':_0xb104('0x4')},'penalty':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize[_0xb104('0x1')](0xb),'defaultValue':0x0,'comment':_0xb104('0x4')}}; \ No newline at end of file +var _0xc037=['queue_interface','exports','INTEGER','Required\x20by\x20Asterisk','STRING'];(function(_0x42121d,_0x1c31ab){var _0x2d6fde=function(_0x347a95){while(--_0x347a95){_0x42121d['push'](_0x42121d['shift']());}};_0x2d6fde(++_0x1c31ab);}(_0xc037,0x88));var _0x7c03=function(_0x2fe09e,_0x3e0198){_0x2fe09e=_0x2fe09e-0x0;var _0x2094a5=_0xc037[_0x2fe09e];return _0x2094a5;};'use strict';var Sequelize=require('sequelize');module[_0x7c03('0x0')]={'uniqueid':{'type':Sequelize[_0x7c03('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x7c03('0x2')},'membername':{'type':Sequelize[_0x7c03('0x3')],'allowNull':![],'comment':_0x7c03('0x2')},'UserId':{'type':Sequelize[_0x7c03('0x1')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x7c03('0x3')],'allowNull':![],'unique':_0x7c03('0x4'),'comment':_0x7c03('0x2')},'VoiceQueueId':{'type':Sequelize[_0x7c03('0x1')],'allowNull':![]},'interface':{'type':Sequelize[_0x7c03('0x3')],'allowNull':![],'unique':'queue_interface','comment':_0x7c03('0x2')},'penalty':{'type':Sequelize[_0x7c03('0x1')](0xb),'defaultValue':0x0,'comment':_0x7c03('0x2')},'paused':{'type':Sequelize[_0x7c03('0x1')](0xb),'defaultValue':0x0,'comment':_0x7c03('0x2')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index bd6d7f1..57ba059 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 _0xd3be=['../../mysqldb','UserVoiceQueueRt','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports'];(function(_0x56d4ca,_0x1668e0){var _0x5ab127=function(_0x342060){while(--_0x342060){_0x56d4ca['push'](_0x56d4ca['shift']());}};_0x5ab127(++_0x1668e0);}(_0xd3be,0xcf));var _0xed3b=function(_0x318ee3,_0x357e32){_0x318ee3=_0x318ee3-0x0;var _0x410d8b=_0xd3be[_0x318ee3];return _0x410d8b;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require(_0xed3b('0x0'))['db'][_0xed3b('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xed3b('0x2')](0x0);var events={'afterCreate':_0xed3b('0x3'),'afterUpdate':_0xed3b('0x4'),'afterDestroy':'remove'};function emitEvent(_0x284c26){return function(_0x3311e7,_0x16da17,_0x35c930){UserVoiceQueueRtEvents['emit'](_0x284c26+':'+_0x3311e7['id'],_0x3311e7);UserVoiceQueueRtEvents[_0xed3b('0x5')](_0x284c26,_0x3311e7);_0x35c930(null);};}for(var e in events){if(events[_0xed3b('0x6')](e)){var event=events[e];UserVoiceQueueRt[_0xed3b('0x7')](e,emitEvent(event));}}module[_0xed3b('0x8')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x9999=['save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','UserVoiceQueueRt','setMaxListeners'];(function(_0x47a349,_0x4699d9){var _0x18ab75=function(_0x210796){while(--_0x210796){_0x47a349['push'](_0x47a349['shift']());}};_0x18ab75(++_0x4699d9);}(_0x9999,0x115));var _0x9999=function(_0x24234f,_0x4fb66b){_0x24234f=_0x24234f-0x0;var _0x5c0f2c=_0x9999[_0x24234f];return _0x5c0f2c;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require(_0x9999('0x0'))['db'][_0x9999('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x9999('0x2')](0x0);var events={'afterCreate':_0x9999('0x3'),'afterUpdate':_0x9999('0x4'),'afterDestroy':_0x9999('0x5')};function emitEvent(_0x5b5ad1){return function(_0x332ec3,_0x4f7a85,_0x10328c){UserVoiceQueueRtEvents[_0x9999('0x6')](_0x5b5ad1+':'+_0x332ec3['id'],_0x332ec3);UserVoiceQueueRtEvents[_0x9999('0x6')](_0x5b5ad1,_0x332ec3);_0x10328c(null);};}for(var e in events){if(events[_0x9999('0x7')](e)){var event=events[e];UserVoiceQueueRt[_0x9999('0x8')](e,emitEvent(event));}}module[_0x9999('0x9')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index e6e1971..d45ac26 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 _0xb4ef=['./userVoiceQueueRt.attributes','exports','define','user_has_voice_queues_rt','lodash','../../config/logger','api','moment','request-promise','path'];(function(_0x3d0bea,_0x5ece9f){var _0x1f4b5e=function(_0x336f08){while(--_0x336f08){_0x3d0bea['push'](_0x3d0bea['shift']());}};_0x1f4b5e(++_0x5ece9f);}(_0xb4ef,0x144));var _0xfb4e=function(_0x194ea4,_0x3c5763){_0x194ea4=_0x194ea4-0x0;var _0xebed87=_0xb4ef[_0x194ea4];return _0xebed87;};'use strict';var _=require(_0xfb4e('0x0'));var util=require('util');var logger=require(_0xfb4e('0x1'))(_0xfb4e('0x2'));var moment=require(_0xfb4e('0x3'));var BPromise=require('bluebird');var rp=require(_0xfb4e('0x4'));var fs=require('fs');var path=require(_0xfb4e('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xfb4e('0x6'));module[_0xfb4e('0x7')]=function(_0x1faaa6,_0x3688ff){return _0x1faaa6[_0xfb4e('0x8')]('UserVoiceQueueRt',attributes,{'tableName':_0xfb4e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7964=['../../config/logger','api','moment','bluebird','path','./userVoiceQueueRt.attributes','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7964,0x166));var _0x4796=function(_0x417c89,_0x5011e1){_0x417c89=_0x417c89-0x0;var _0x1e305b=_0x7964[_0x417c89];return _0x1e305b;};'use strict';var _=require(_0x4796('0x0'));var util=require(_0x4796('0x1'));var logger=require(_0x4796('0x2'))(_0x4796('0x3'));var moment=require(_0x4796('0x4'));var BPromise=require(_0x4796('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4796('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4796('0x7'));module['exports']=function(_0x1075a0,_0x4a541c){return _0x1075a0['define'](_0x4796('0x8'),attributes,{'tableName':_0x4796('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js index ea89d42..664d08f 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 _0x561b=['../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','./userVoiceQueueRt.socket','register','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','where','sequelize','COUNT','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x353c41,_0x5abbf3){var _0x17e950=function(_0x12f2ab){while(--_0x12f2ab){_0x353c41['push'](_0x353c41['shift']());}};_0x17e950(++_0x5abbf3);}(_0x561b,0x185));var _0xb561=function(_0x2df342,_0xfb6edb){_0x2df342=_0x2df342-0x0;var _0x4785ac=_0x561b[_0x2df342];return _0x4785ac;};'use strict';var _=require(_0xb561('0x0'));var util=require(_0xb561('0x1'));var moment=require(_0xb561('0x2'));var BPromise=require(_0xb561('0x3'));var rs=require(_0xb561('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb561('0x5'))['db'];var utils=require(_0xb561('0x6'));var logger=require(_0xb561('0x7'))(_0xb561('0x8'));var config=require(_0xb561('0x9'));var jayson=require(_0xb561('0xa'));var client=jayson['client'][_0xb561('0xb')]({'port':0x232a});config[_0xb561('0xc')]=_['defaults'](config[_0xb561('0xc')],{'host':_0xb561('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb561('0xc')]));require(_0xb561('0xe'))[_0xb561('0xf')](socket);function respondWithRpcPromise(_0xdb9113,_0x26eef1,_0x4fb965){return new BPromise(function(_0x14b5b0,_0x33c0db){return client[_0xb561('0x10')](_0xdb9113,_0x4fb965)[_0xb561('0x11')](function(_0x31bcb2){logger[_0xb561('0x12')](_0xb561('0x13'),_0x26eef1,_0xb561('0x14'));logger[_0xb561('0x15')]('UserVoiceQueueRt,\x20%s,\x20%s,\x20%s',_0x26eef1,'request\x20sent',JSON[_0xb561('0x16')](_0x31bcb2));if(_0x31bcb2[_0xb561('0x17')]){if(_0x31bcb2[_0xb561('0x17')][_0xb561('0x18')]===0x1f4){logger[_0xb561('0x17')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x26eef1,_0x31bcb2[_0xb561('0x17')]['message']);return _0x33c0db(_0x31bcb2[_0xb561('0x17')]['message']);}logger[_0xb561('0x17')](_0xb561('0x13'),_0x26eef1,_0x31bcb2[_0xb561('0x17')]['message']);return _0x14b5b0(_0x31bcb2[_0xb561('0x17')][_0xb561('0x19')]);}else{logger[_0xb561('0x12')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x26eef1,_0xb561('0x14'));_0x14b5b0(_0x31bcb2['result'][_0xb561('0x19')]);}})['catch'](function(_0x32f4b8){logger[_0xb561('0x17')](_0xb561('0x13'),_0x26eef1,_0x32f4b8);_0x33c0db(_0x32f4b8);});});}exports[_0xb561('0x1a')]=function(_0x4faaea){var _0xe58e24=this;return new Promise(function(_0x410a1b,_0x347dd0){return db[_0xb561('0x1b')][_0xb561('0x1c')]({'raw':_0x4faaea[_0xb561('0x1d')]?_0x4faaea[_0xb561('0x1d')][_0xb561('0x1e')]===undefined?!![]:![]:!![],'where':_0x4faaea[_0xb561('0x1d')]?_0x4faaea[_0xb561('0x1d')][_0xb561('0x1f')]||null:null,'attributes':[[db[_0xb561('0x20')]['fn'](_0xb561('0x21'),db[_0xb561('0x20')]['fn']('IF',db['sequelize']['literal'](_0xb561('0x22')))),_0xb561('0x23')]]})['then'](function(_0x3fd659){logger[_0xb561('0x12')](_0xb561('0x1a'),_0x4faaea);logger[_0xb561('0x15')](_0xb561('0x1a'),_0x4faaea,JSON[_0xb561('0x16')](_0x3fd659));_0x410a1b(_0x3fd659);})['catch'](function(_0x38553e){logger[_0xb561('0x17')]('GetVoiceQueueRtPauses',_0x38553e[_0xb561('0x19')],_0x4faaea);_0x347dd0(_0xe58e24['error'](0x1f4,_0x38553e[_0xb561('0x19')]));});});}; \ No newline at end of file +var _0xe5cc=['stringify','error','message','info','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','where','sequelize','COUNT','literal','outboundQueuePauses','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','./userVoiceQueueRt.socket','register','request','then','UserVoiceQueueRt,\x20%s,\x20%s','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x2d74f6,_0x57d703){var _0x5a3b93=function(_0x1c477c){while(--_0x1c477c){_0x2d74f6['push'](_0x2d74f6['shift']());}};_0x5a3b93(++_0x57d703);}(_0xe5cc,0x178));var _0xce5c=function(_0x2ad361,_0xb28126){_0x2ad361=_0x2ad361-0x0;var _0x318693=_0xe5cc[_0x2ad361];return _0x318693;};'use strict';var _=require(_0xce5c('0x0'));var util=require('util');var moment=require(_0xce5c('0x1'));var BPromise=require(_0xce5c('0x2'));var rs=require(_0xce5c('0x3'));var fs=require('fs');var Redis=require(_0xce5c('0x4'));var db=require(_0xce5c('0x5'))['db'];var utils=require(_0xce5c('0x6'));var logger=require(_0xce5c('0x7'))(_0xce5c('0x8'));var config=require(_0xce5c('0x9'));var jayson=require(_0xce5c('0xa'));var client=jayson[_0xce5c('0xb')][_0xce5c('0xc')]({'port':0x232a});config['redis']=_[_0xce5c('0xd')](config[_0xce5c('0xe')],{'host':'localhost','port':0x18eb});var socket=require(_0xce5c('0xf'))(new Redis(config[_0xce5c('0xe')]));require(_0xce5c('0x10'))[_0xce5c('0x11')](socket);function respondWithRpcPromise(_0x15adc9,_0x4dc345,_0x58f35a){return new BPromise(function(_0x591275,_0x496d3b){return client[_0xce5c('0x12')](_0x15adc9,_0x58f35a)[_0xce5c('0x13')](function(_0x2453ca){logger['info'](_0xce5c('0x14'),_0x4dc345,'request\x20sent');logger[_0xce5c('0x15')](_0xce5c('0x16'),_0x4dc345,_0xce5c('0x17'),JSON[_0xce5c('0x18')](_0x2453ca));if(_0x2453ca[_0xce5c('0x19')]){if(_0x2453ca[_0xce5c('0x19')]['code']===0x1f4){logger[_0xce5c('0x19')](_0xce5c('0x14'),_0x4dc345,_0x2453ca[_0xce5c('0x19')]['message']);return _0x496d3b(_0x2453ca[_0xce5c('0x19')]['message']);}logger[_0xce5c('0x19')](_0xce5c('0x14'),_0x4dc345,_0x2453ca[_0xce5c('0x19')][_0xce5c('0x1a')]);return _0x591275(_0x2453ca['error'][_0xce5c('0x1a')]);}else{logger[_0xce5c('0x1b')](_0xce5c('0x14'),_0x4dc345,'request\x20sent');_0x591275(_0x2453ca[_0xce5c('0x1c')][_0xce5c('0x1a')]);}})[_0xce5c('0x1d')](function(_0x3936e3){logger[_0xce5c('0x19')](_0xce5c('0x14'),_0x4dc345,_0x3936e3);_0x496d3b(_0x3936e3);});});}exports[_0xce5c('0x1e')]=function(_0xd2dfc0){var _0x10eb56=this;return new Promise(function(_0xe17db5,_0x2722e3){return db[_0xce5c('0x1f')][_0xce5c('0x20')]({'raw':_0xd2dfc0[_0xce5c('0x21')]?_0xd2dfc0['options'][_0xce5c('0x22')]===undefined?!![]:![]:!![],'where':_0xd2dfc0[_0xce5c('0x21')]?_0xd2dfc0[_0xce5c('0x21')][_0xce5c('0x23')]||null:null,'attributes':[[db[_0xce5c('0x24')]['fn'](_0xce5c('0x25'),db[_0xce5c('0x24')]['fn']('IF',db[_0xce5c('0x24')][_0xce5c('0x26')]('`paused`\x20=\x201,\x201,\x20null'))),_0xce5c('0x27')]]})[_0xce5c('0x13')](function(_0x25cb24){logger[_0xce5c('0x1b')](_0xce5c('0x1e'),_0xd2dfc0);logger['debug'](_0xce5c('0x1e'),_0xd2dfc0,JSON['stringify'](_0x25cb24));_0xe17db5(_0x25cb24);})[_0xce5c('0x1d')](function(_0x2e4aa6){logger[_0xce5c('0x19')]('GetVoiceQueueRtPauses',_0x2e4aa6[_0xce5c('0x1a')],_0xd2dfc0);_0x2722e3(_0x10eb56[_0xce5c('0x19')](0x1f4,_0x2e4aa6['message']));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 2166df2..f61fb12 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 _0xafc4=['register','length','userVoiceQueueRt:','./userVoiceQueueRt.events','remove','emit'];(function(_0x305486,_0x24acd4){var _0xa04940=function(_0x29e866){while(--_0x29e866){_0x305486['push'](_0x305486['shift']());}};_0xa04940(++_0x24acd4);}(_0xafc4,0x69));var _0x4afc=function(_0x38a393,_0x4fde3b){_0x38a393=_0x38a393-0x0;var _0x265ac1=_0xafc4[_0x38a393];return _0x265ac1;};'use strict';var UserVoiceQueueRtEvents=require(_0x4afc('0x0'));var events=['save',_0x4afc('0x1'),'update'];function createListener(_0x10aede,_0x11789f){return function(_0x20e443){_0x11789f[_0x4afc('0x2')](_0x10aede,_0x20e443);};}function removeListener(_0x4d9dbd,_0x49f417){return function(){UserVoiceQueueRtEvents['removeListener'](_0x4d9dbd,_0x49f417);};}exports[_0x4afc('0x3')]=function(_0x471d45){for(var _0x16953b=0x0,_0x1bb281=events[_0x4afc('0x4')];_0x16953b<_0x1bb281;_0x16953b++){var _0xaf053d=events[_0x16953b];var _0x5e1e29=createListener(_0x4afc('0x5')+_0xaf053d,_0x471d45);UserVoiceQueueRtEvents['on'](_0xaf053d,_0x5e1e29);}}; \ No newline at end of file +var _0x7d10=['save','remove','emit','removeListener','register','length','userVoiceQueueRt:'];(function(_0x2c0086,_0xbea719){var _0x2e29da=function(_0x25a8d0){while(--_0x25a8d0){_0x2c0086['push'](_0x2c0086['shift']());}};_0x2e29da(++_0xbea719);}(_0x7d10,0x1ce));var _0x07d1=function(_0x6fa2b5,_0x50c251){_0x6fa2b5=_0x6fa2b5-0x0;var _0x43697a=_0x7d10[_0x6fa2b5];return _0x43697a;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=[_0x07d1('0x0'),_0x07d1('0x1'),'update'];function createListener(_0xd63e59,_0x4f305c){return function(_0x5d2b90){_0x4f305c[_0x07d1('0x2')](_0xd63e59,_0x5d2b90);};}function removeListener(_0x104724,_0x4f4d64){return function(){UserVoiceQueueRtEvents[_0x07d1('0x3')](_0x104724,_0x4f4d64);};}exports[_0x07d1('0x4')]=function(_0x1c8f3d){for(var _0x36198a=0x0,_0x4ab5c9=events[_0x07d1('0x5')];_0x36198a<_0x4ab5c9;_0x36198a++){var _0xc20041=events[_0x36198a];var _0x65e41c=createListener(_0x07d1('0x6')+_0xc20041,_0x1c8f3d);UserVoiceQueueRtEvents['on'](_0xc20041,_0x65e41c);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index ca7b695..b30b0ff 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x721ebf,_0x9e9b92){var _0x5b1157=function(_0x5c8b00){while(--_0x5c8b00){_0x721ebf['push'](_0x721ebf['shift']());}};_0x5b1157(++_0x9e9b92);}(_0xe706,0xa3));var _0x6e70=function(_0x10b6ae,_0x56a559){_0x10b6ae=_0x10b6ae-0x0;var _0x1321e9=_0xe706[_0x10b6ae];return _0x1321e9;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x4ceb77,_0x156505){var _0x247391=function(_0x19c727){while(--_0x19c727){_0x4ceb77['push'](_0x4ceb77['shift']());}};_0x247391(++_0x156505);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index a727db1..ed8f0f5 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 _0x9eb9=['exports','INTEGER','sequelize'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0x9eb9,0x11c));var _0x99eb=function(_0x4caf98,_0x370bdf){_0x4caf98=_0x4caf98-0x0;var _0x47d295=_0x9eb9[_0x4caf98];return _0x47d295;};'use strict';var Sequelize=require(_0x99eb('0x0'));module[_0x99eb('0x1')]={'penalty':{'type':Sequelize[_0x99eb('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x2a96=['sequelize','exports'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0x2a96,0xd2));var _0x62a9=function(_0x23463d,_0x2606e5){_0x23463d=_0x23463d-0x0;var _0x576a24=_0x2a96[_0x23463d];return _0x576a24;};'use strict';var Sequelize=require(_0x62a9('0x0'));module[_0x62a9('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index 8ba6691..45bad46 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 _0x081a=['define','UserWhatsappQueue','user_has_whatsapp_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./userWhatsappQueue.attributes','exports'];(function(_0x47b3db,_0x4f8d90){var _0x5a8ff6=function(_0x1dc63f){while(--_0x1dc63f){_0x47b3db['push'](_0x47b3db['shift']());}};_0x5a8ff6(++_0x4f8d90);}(_0x081a,0x1ed));var _0xa081=function(_0xcffcbe,_0x143d81){_0xcffcbe=_0xcffcbe-0x0;var _0x447d0d=_0x081a[_0xcffcbe];return _0x447d0d;};'use strict';var _=require(_0xa081('0x0'));var util=require(_0xa081('0x1'));var logger=require(_0xa081('0x2'))(_0xa081('0x3'));var moment=require(_0xa081('0x4'));var BPromise=require(_0xa081('0x5'));var rp=require(_0xa081('0x6'));var fs=require('fs');var path=require(_0xa081('0x7'));var rimraf=require('rimraf');var config=require(_0xa081('0x8'));var attributes=require(_0xa081('0x9'));module[_0xa081('0xa')]=function(_0x4bc6ac,_0x5c22ff){return _0x4bc6ac[_0xa081('0xb')](_0xa081('0xc'),attributes,{'tableName':_0xa081('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeb61=['bluebird','path','rimraf','../../config/environment','./userWhatsappQueue.attributes','exports','define','UserWhatsappQueue','util','../../config/logger'];(function(_0x19c318,_0x3722f4){var _0x22d6c0=function(_0x37e3a1){while(--_0x37e3a1){_0x19c318['push'](_0x19c318['shift']());}};_0x22d6c0(++_0x3722f4);}(_0xeb61,0x13e));var _0x1eb6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xeb61[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x1eb6('0x0'));var logger=require(_0x1eb6('0x1'))('api');var moment=require('moment');var BPromise=require(_0x1eb6('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1eb6('0x3'));var rimraf=require(_0x1eb6('0x4'));var config=require(_0x1eb6('0x5'));var attributes=require(_0x1eb6('0x6'));module[_0x1eb6('0x7')]=function(_0xeff7db,_0x4dc3e4){return _0xeff7db[_0x1eb6('0x8')](_0x1eb6('0x9'),attributes,{'tableName':'user_has_whatsapp_queues','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 2f56d2a..6b9820a 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 _0x5228=['UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserWhatsappQueue,\x20%s,\x20%s','message','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','then','info','request\x20sent','debug'];(function(_0xed01eb,_0x275edb){var _0x25b9de=function(_0x3c331c){while(--_0x3c331c){_0xed01eb['push'](_0xed01eb['shift']());}};_0x25b9de(++_0x275edb);}(_0x5228,0x1d3));var _0x8522=function(_0x34c187,_0x40148c){_0x34c187=_0x34c187-0x0;var _0x593943=_0x5228[_0x34c187];return _0x593943;};'use strict';var _=require('lodash');var util=require(_0x8522('0x0'));var moment=require(_0x8522('0x1'));var BPromise=require(_0x8522('0x2'));var rs=require(_0x8522('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8522('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x8522('0x5'))(_0x8522('0x6'));var config=require(_0x8522('0x7'));var jayson=require(_0x8522('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5302db,_0x432b5a,_0x4404c){return new BPromise(function(_0x15c5a0,_0x4748cb){return client['request'](_0x5302db,_0x4404c)[_0x8522('0x9')](function(_0x4d0819){logger[_0x8522('0xa')]('UserWhatsappQueue,\x20%s,\x20%s',_0x432b5a,_0x8522('0xb'));logger[_0x8522('0xc')](_0x8522('0xd'),_0x432b5a,_0x8522('0xb'),JSON[_0x8522('0xe')](_0x4d0819));if(_0x4d0819['error']){if(_0x4d0819[_0x8522('0xf')][_0x8522('0x10')]===0x1f4){logger[_0x8522('0xf')](_0x8522('0x11'),_0x432b5a,_0x4d0819['error'][_0x8522('0x12')]);return _0x4748cb(_0x4d0819[_0x8522('0xf')][_0x8522('0x12')]);}logger[_0x8522('0xf')]('UserWhatsappQueue,\x20%s,\x20%s',_0x432b5a,_0x4d0819[_0x8522('0xf')][_0x8522('0x12')]);return _0x15c5a0(_0x4d0819['error'][_0x8522('0x12')]);}else{logger[_0x8522('0xa')]('UserWhatsappQueue,\x20%s,\x20%s',_0x432b5a,_0x8522('0xb'));_0x15c5a0(_0x4d0819['result']['message']);}})[_0x8522('0x13')](function(_0x400fca){logger['error'](_0x8522('0x11'),_0x432b5a,_0x400fca);_0x4748cb(_0x400fca);});});} \ No newline at end of file +var _0x356e=['debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserWhatsappQueue,\x20%s,\x20%s','message','info','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','request\x20sent'];(function(_0x5afeb3,_0x5589c6){var _0x1d6f74=function(_0x4d1ea3){while(--_0x4d1ea3){_0x5afeb3['push'](_0x5afeb3['shift']());}};_0x1d6f74(++_0x5589c6);}(_0x356e,0x1ed));var _0xe356=function(_0x4359fa,_0x4d5f23){_0x4359fa=_0x4359fa-0x0;var _0x3df26d=_0x356e[_0x4359fa];return _0x3df26d;};'use strict';var _=require(_0xe356('0x0'));var util=require(_0xe356('0x1'));var moment=require(_0xe356('0x2'));var BPromise=require('bluebird');var rs=require(_0xe356('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe356('0x4'))['db'];var utils=require(_0xe356('0x5'));var logger=require(_0xe356('0x6'))(_0xe356('0x7'));var config=require(_0xe356('0x8'));var jayson=require(_0xe356('0x9'));var client=jayson[_0xe356('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4d7139,_0x295c8c,_0x505192){return new BPromise(function(_0x18e592,_0x1bf834){return client[_0xe356('0xb')](_0x4d7139,_0x505192)['then'](function(_0x10e72e){logger['info']('UserWhatsappQueue,\x20%s,\x20%s',_0x295c8c,_0xe356('0xc'));logger[_0xe356('0xd')](_0xe356('0xe'),_0x295c8c,_0xe356('0xc'),JSON[_0xe356('0xf')](_0x10e72e));if(_0x10e72e[_0xe356('0x10')]){if(_0x10e72e[_0xe356('0x10')][_0xe356('0x11')]===0x1f4){logger[_0xe356('0x10')](_0xe356('0x12'),_0x295c8c,_0x10e72e['error'][_0xe356('0x13')]);return _0x1bf834(_0x10e72e['error'][_0xe356('0x13')]);}logger[_0xe356('0x10')](_0xe356('0x12'),_0x295c8c,_0x10e72e[_0xe356('0x10')][_0xe356('0x13')]);return _0x18e592(_0x10e72e[_0xe356('0x10')][_0xe356('0x13')]);}else{logger[_0xe356('0x14')](_0xe356('0x12'),_0x295c8c,'request\x20sent');_0x18e592(_0x10e72e['result'][_0xe356('0x13')]);}})[_0xe356('0x15')](function(_0x38f5a3){logger[_0xe356('0x10')](_0xe356('0x12'),_0x295c8c,_0x38f5a3);_0x1bf834(_0x38f5a3);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index aef7c6e..967d29f 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 _0xc978=['post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','get','isAuthenticated','index','/:id','show'];(function(_0x1ff92d,_0x3bfdeb){var _0x129a98=function(_0x45a90b){while(--_0x45a90b){_0x1ff92d['push'](_0x1ff92d['shift']());}};_0x129a98(++_0x3bfdeb);}(_0xc978,0xcd));var _0x8c97=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc978[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x8c97('0x0'));var util=require(_0x8c97('0x1'));var path=require(_0x8c97('0x2'));var timeout=require(_0x8c97('0x3'));var express=require(_0x8c97('0x4'));var router=express[_0x8c97('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x8c97('0x6'));var interaction=require(_0x8c97('0x7'));var config=require(_0x8c97('0x8'));var controller=require(_0x8c97('0x9'));router[_0x8c97('0xa')]('/',auth[_0x8c97('0xb')](),controller[_0x8c97('0xc')]);router['get'](_0x8c97('0xd'),auth[_0x8c97('0xb')](),controller[_0x8c97('0xe')]);router[_0x8c97('0xf')]('/',auth[_0x8c97('0xb')](),controller[_0x8c97('0x10')]);router[_0x8c97('0x11')]('/:id',auth[_0x8c97('0xb')](),controller[_0x8c97('0x12')]);router[_0x8c97('0x13')](_0x8c97('0xd'),auth[_0x8c97('0xb')](),controller[_0x8c97('0x14')]);module[_0x8c97('0x15')]=router; \ No newline at end of file +var _0x5395=['index','/:id','post','create','put','destroy','multer','path','Router','fs-extra','../../components/auth/service','../../config/environment','./variable.controller','get','isAuthenticated'];(function(_0x45071a,_0x406695){var _0x4502ca=function(_0x486222){while(--_0x486222){_0x45071a['push'](_0x45071a['shift']());}};_0x4502ca(++_0x406695);}(_0x5395,0x150));var _0x5539=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x5395[_0x46698a];return _0x356db0;};'use strict';var multer=require(_0x5539('0x0'));var util=require('util');var path=require(_0x5539('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5539('0x2')]();var fs_extra=require(_0x5539('0x3'));var auth=require(_0x5539('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x5539('0x5'));var controller=require(_0x5539('0x6'));router[_0x5539('0x7')]('/',auth[_0x5539('0x8')](),controller[_0x5539('0x9')]);router[_0x5539('0x7')](_0x5539('0xa'),auth[_0x5539('0x8')](),controller['show']);router[_0x5539('0xb')]('/',auth[_0x5539('0x8')](),controller[_0x5539('0xc')]);router[_0x5539('0xd')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0x5539('0xa'),auth['isAuthenticated'](),controller[_0x5539('0xe')]);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 8f94d37..b928cf0 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 _0x1af5=['sequelize','STRING','name'];(function(_0x324ea9,_0x3449d8){var _0x2e7150=function(_0x5c59bb){while(--_0x5c59bb){_0x324ea9['push'](_0x324ea9['shift']());}};_0x2e7150(++_0x3449d8);}(_0x1af5,0x17d));var _0x51af=function(_0x5c1504,_0x1e94d5){_0x5c1504=_0x5c1504-0x0;var _0x87a50e=_0x1af5[_0x5c1504];return _0x87a50e;};'use strict';var Sequelize=require(_0x51af('0x0'));module['exports']={'name':{'type':Sequelize[_0x51af('0x1')],'unique':_0x51af('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x51af('0x1')]}}; \ No newline at end of file +var _0x82d3=['STRING','name','exports'];(function(_0x59c1b9,_0x5c2753){var _0x375dcc=function(_0x2d9c20){while(--_0x2d9c20){_0x59c1b9['push'](_0x59c1b9['shift']());}};_0x375dcc(++_0x5c2753);}(_0x82d3,0xa4));var _0x382d=function(_0x6b83df,_0x5daf1c){_0x6b83df=_0x6b83df-0x0;var _0x11ac08=_0x82d3[_0x6b83df];return _0x11ac08;};'use strict';var Sequelize=require('sequelize');module[_0x382d('0x0')]={'name':{'type':Sequelize[_0x382d('0x1')],'unique':_0x382d('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 64fb72f..e630e46 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 _0x1d07=['nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','intersection','options','find','create','body','role','user','get','UserProfileSection','userProfileId','autoAssociation','fast-json-patch','request-promise','bluebird','util','path','sox','fs-extra','lodash','squel','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','Variables','UserProfileResource','error','stack','name','index','map','Variable','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','hasOwnProperty'];(function(_0x391c55,_0x168617){var _0xa434e0=function(_0x51fa5c){while(--_0x51fa5c){_0x391c55['push'](_0x391c55['shift']());}};_0xa434e0(++_0x168617);}(_0x1d07,0xbb));var _0x71d0=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0x1d07[_0x5c2e3e];return _0x53f64a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x71d0('0x0'));var rp=require(_0x71d0('0x1'));var moment=require('moment');var BPromise=require(_0x71d0('0x2'));var Mustache=require('mustache');var util=require(_0x71d0('0x3'));var path=require(_0x71d0('0x4'));var sox=require(_0x71d0('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x71d0('0x6'));var _=require(_0x71d0('0x7'));var squel=require(_0x71d0('0x8'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x71d0('0x9'));var toCsv=require(_0x71d0('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x71d0('0xb'));var authService=require(_0x71d0('0xc'));var qs=require(_0x71d0('0xd'));var as=require(_0x71d0('0xe'));var hardwareService=require(_0x71d0('0xf'));var logger=require(_0x71d0('0x10'))(_0x71d0('0x11'));var utils=require('../../config/utils');var config=require(_0x71d0('0x12'));var licenseUtil=require(_0x71d0('0x13'));var db=require(_0x71d0('0x14'))['db'];function respondWithStatusCode(_0x2785c8,_0x1bfdea){_0x1bfdea=_0x1bfdea||0xcc;return function(_0x5ab215){if(_0x5ab215){return _0x2785c8[_0x71d0('0x15')](_0x1bfdea);}return _0x2785c8[_0x71d0('0x16')](_0x1bfdea)[_0x71d0('0x17')]();};}function respondWithResult(_0x1775e7,_0x4a00a5){_0x4a00a5=_0x4a00a5||0xc8;return function(_0x8d2b9d){if(_0x8d2b9d){return _0x1775e7['status'](_0x4a00a5)['json'](_0x8d2b9d);}};}function respondWithFilteredResult(_0x2099d0,_0x2c3e20){return function(_0x2b5900){if(_0x2b5900){var _0x4b94e3=typeof _0x2c3e20[_0x71d0('0x18')]===_0x71d0('0x19')&&typeof _0x2c3e20[_0x71d0('0x1a')]===_0x71d0('0x19');var _0x451e3f=_0x2b5900[_0x71d0('0x1b')];var _0x44d960=_0x4b94e3?0x0:_0x2c3e20[_0x71d0('0x18')];var _0xe29fc7=_0x4b94e3?_0x2b5900[_0x71d0('0x1b')]:_0x2c3e20[_0x71d0('0x18')]+_0x2c3e20[_0x71d0('0x1a')];var _0x330265;if(_0xe29fc7>=_0x451e3f){_0xe29fc7=_0x451e3f;_0x330265=0xc8;}else{_0x330265=0xce;}_0x2099d0[_0x71d0('0x16')](_0x330265);return _0x2099d0[_0x71d0('0x1c')](_0x71d0('0x1d'),_0x44d960+'-'+_0xe29fc7+'/'+_0x451e3f)[_0x71d0('0x1e')](_0x2b5900);}return null;};}function patchUpdates(_0x1adeae){return function(_0x3980eb){try{jsonpatch[_0x71d0('0x1f')](_0x3980eb,_0x1adeae,!![]);}catch(_0x49cf47){return BPromise[_0x71d0('0x20')](_0x49cf47);}return _0x3980eb[_0x71d0('0x21')]();};}function saveUpdates(_0x5c2e93,_0x3df355){return function(_0x3e695a){if(_0x3e695a){return _0x3e695a[_0x71d0('0x22')](_0x5c2e93)[_0x71d0('0x23')](function(_0x38ee93){return _0x38ee93;});}return null;};}function removeEntity(_0x6ecbd1,_0x49b171){return function(_0xc82ccf){if(_0xc82ccf){return _0xc82ccf[_0x71d0('0x24')]()['then'](function(){var _0x579b04=_0xc82ccf['get']({'plain':!![]});var _0x4222a0=_0x71d0('0x25');return db[_0x71d0('0x26')][_0x71d0('0x24')]({'where':{'type':_0x4222a0,'resourceId':_0x579b04['id']}})[_0x71d0('0x23')](function(){return _0xc82ccf;});})[_0x71d0('0x23')](function(){_0x6ecbd1[_0x71d0('0x16')](0xcc)[_0x71d0('0x17')]();});}};}function handleEntityNotFound(_0x338ce2,_0x1a74e1){return function(_0x21ad17){if(!_0x21ad17){_0x338ce2[_0x71d0('0x15')](0x194);}return _0x21ad17;};}function handleError(_0x5c74e3,_0x395000){_0x395000=_0x395000||0x1f4;return function(_0x494ca2){logger[_0x71d0('0x27')](_0x494ca2[_0x71d0('0x28')]);if(_0x494ca2[_0x71d0('0x29')]){delete _0x494ca2[_0x71d0('0x29')];}_0x5c74e3[_0x71d0('0x16')](_0x395000)['send'](_0x494ca2);};}exports[_0x71d0('0x2a')]=function(_0x2dd062,_0x5d7b95){var _0x1b7ca4={},_0x853def={},_0x22e567={'count':0x0,'rows':[]};var _0x2146e6=_[_0x71d0('0x2b')](db[_0x71d0('0x2c')][_0x71d0('0x2d')],function(_0x397f56){return{'name':_0x397f56[_0x71d0('0x2e')],'type':_0x397f56[_0x71d0('0x2f')][_0x71d0('0x30')]};});_0x853def[_0x71d0('0x31')]=_['map'](_0x2146e6,_0x71d0('0x29'));_0x853def[_0x71d0('0x32')]=_[_0x71d0('0x33')](_0x2dd062[_0x71d0('0x32')]);_0x853def[_0x71d0('0x34')]=_['intersection'](_0x853def[_0x71d0('0x31')],_0x853def['query']);_0x1b7ca4[_0x71d0('0x35')]=_['intersection'](_0x853def[_0x71d0('0x31')],qs[_0x71d0('0x36')](_0x2dd062[_0x71d0('0x32')][_0x71d0('0x36')]));_0x1b7ca4[_0x71d0('0x35')]=_0x1b7ca4[_0x71d0('0x35')]['length']?_0x1b7ca4[_0x71d0('0x35')]:_0x853def[_0x71d0('0x31')];if(!_0x2dd062[_0x71d0('0x32')][_0x71d0('0x37')](_0x71d0('0x38'))){_0x1b7ca4[_0x71d0('0x1a')]=qs['limit'](_0x2dd062['query'][_0x71d0('0x1a')]);_0x1b7ca4[_0x71d0('0x18')]=qs['offset'](_0x2dd062[_0x71d0('0x32')][_0x71d0('0x18')]);}_0x1b7ca4['order']=qs[_0x71d0('0x39')](_0x2dd062[_0x71d0('0x32')][_0x71d0('0x39')]);_0x1b7ca4[_0x71d0('0x3a')]=qs[_0x71d0('0x34')](_[_0x71d0('0x3b')](_0x2dd062[_0x71d0('0x32')],_0x853def['filters']),_0x2146e6);if(_0x2dd062[_0x71d0('0x32')][_0x71d0('0x3c')]){_0x1b7ca4['where']=_[_0x71d0('0x3d')](_0x1b7ca4[_0x71d0('0x3a')],{'$or':_[_0x71d0('0x2b')](_0x2146e6,function(_0x519bc3){if(_0x519bc3['type']!==_0x71d0('0x3e')){var _0x5b0f43={};_0x5b0f43[_0x519bc3['name']]={'$like':'%'+_0x2dd062['query']['filter']+'%'};return _0x5b0f43;}})});}_0x1b7ca4=_['merge']({},_0x1b7ca4,_0x2dd062['options']);var _0x4e0a5c={'where':_0x1b7ca4[_0x71d0('0x3a')]};return db[_0x71d0('0x2c')]['count'](_0x4e0a5c)[_0x71d0('0x23')](function(_0x893a03){_0x22e567[_0x71d0('0x1b')]=_0x893a03;if(_0x2dd062[_0x71d0('0x32')][_0x71d0('0x3f')]){_0x1b7ca4[_0x71d0('0x40')]=[{'all':!![]}];}return db['Variable'][_0x71d0('0x41')](_0x1b7ca4);})[_0x71d0('0x23')](function(_0x2f60ea){_0x22e567[_0x71d0('0x42')]=_0x2f60ea;return _0x22e567;})[_0x71d0('0x23')](respondWithFilteredResult(_0x5d7b95,_0x1b7ca4))[_0x71d0('0x43')](handleError(_0x5d7b95,null));};exports[_0x71d0('0x44')]=function(_0x50f195,_0x39d7f7){var _0x2295b0={'raw':!![],'where':{'id':_0x50f195[_0x71d0('0x45')]['id']}},_0x142d07={};_0x142d07[_0x71d0('0x31')]=_[_0x71d0('0x33')](db[_0x71d0('0x2c')][_0x71d0('0x2d')]);_0x142d07[_0x71d0('0x32')]=_[_0x71d0('0x33')](_0x50f195[_0x71d0('0x32')]);_0x142d07[_0x71d0('0x34')]=_[_0x71d0('0x46')](_0x142d07[_0x71d0('0x31')],_0x142d07['query']);_0x2295b0[_0x71d0('0x35')]=_[_0x71d0('0x46')](_0x142d07[_0x71d0('0x31')],qs['fields'](_0x50f195[_0x71d0('0x32')][_0x71d0('0x36')]));_0x2295b0[_0x71d0('0x35')]=_0x2295b0[_0x71d0('0x35')]['length']?_0x2295b0[_0x71d0('0x35')]:_0x142d07['model'];if(_0x50f195[_0x71d0('0x32')][_0x71d0('0x3f')]){_0x2295b0[_0x71d0('0x40')]=[{'all':!![]}];}_0x2295b0=_[_0x71d0('0x3d')]({},_0x2295b0,_0x50f195[_0x71d0('0x47')]);return db[_0x71d0('0x2c')][_0x71d0('0x48')](_0x2295b0)[_0x71d0('0x23')](handleEntityNotFound(_0x39d7f7,null))['then'](respondWithResult(_0x39d7f7,null))[_0x71d0('0x43')](handleError(_0x39d7f7,null));};exports['create']=function(_0x55a400,_0x2e0396){return db[_0x71d0('0x2c')][_0x71d0('0x49')](_0x55a400[_0x71d0('0x4a')],{})[_0x71d0('0x23')](function(_0x2ed1c1){var _0x1a1b76=_0x55a400['user']['get']({'plain':!![]});if(!_0x1a1b76)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1a1b76[_0x71d0('0x4b')]===_0x71d0('0x4c')){var _0x3b88f4=_0x2ed1c1[_0x71d0('0x4d')]({'plain':!![]});var _0x33caa8=_0x71d0('0x25');return db[_0x71d0('0x4e')]['find']({'where':{'name':_0x33caa8,'userProfileId':_0x1a1b76[_0x71d0('0x4f')]},'raw':!![]})[_0x71d0('0x23')](function(_0x1105ab){if(_0x1105ab&&_0x1105ab[_0x71d0('0x50')]===0x0){return db[_0x71d0('0x26')][_0x71d0('0x49')]({'name':_0x3b88f4[_0x71d0('0x29')],'resourceId':_0x3b88f4['id'],'type':_0x1105ab['name'],'sectionId':_0x1105ab['id']},{})[_0x71d0('0x23')](function(){return _0x2ed1c1;});}else{return _0x2ed1c1;}})[_0x71d0('0x43')](function(_0x1f8cda){logger[_0x71d0('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1f8cda);throw _0x1f8cda;});}return _0x2ed1c1;})[_0x71d0('0x23')](respondWithResult(_0x2e0396,0xc9))[_0x71d0('0x43')](handleError(_0x2e0396,null));};exports['update']=function(_0x400f32,_0x33e6a7){if(_0x400f32[_0x71d0('0x4a')]['id']){delete _0x400f32[_0x71d0('0x4a')]['id'];}return db[_0x71d0('0x2c')][_0x71d0('0x48')]({'where':{'id':_0x400f32[_0x71d0('0x45')]['id']}})['then'](handleEntityNotFound(_0x33e6a7,null))[_0x71d0('0x23')](saveUpdates(_0x400f32[_0x71d0('0x4a')],null))[_0x71d0('0x23')](respondWithResult(_0x33e6a7,null))[_0x71d0('0x43')](handleError(_0x33e6a7,null));};exports[_0x71d0('0x24')]=function(_0x3ede30,_0x4a7354){return db[_0x71d0('0x2c')]['find']({'where':{'id':_0x3ede30['params']['id']}})[_0x71d0('0x23')](handleEntityNotFound(_0x4a7354,null))['then'](removeEntity(_0x4a7354,null))[_0x71d0('0x43')](handleError(_0x4a7354,null));}; \ No newline at end of file +var _0x35b1=['length','nolimit','order','sort','where','pick','filter','merge','options','Variable','count','includeAll','include','findAll','rows','catch','find','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','eml-format','rimraf','moment','bluebird','mustache','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','json','undefined','offset','limit','status','set','apply','reject','then','destroy','Variables','UserProfileResource','sendStatus','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields'];(function(_0x476702,_0x4c2a22){var _0x2ac5fa=function(_0x5a8fde){while(--_0x5a8fde){_0x476702['push'](_0x476702['shift']());}};_0x2ac5fa(++_0x4c2a22);}(_0x35b1,0x6c));var _0x135b=function(_0x4f3dee,_0x46bb90){_0x4f3dee=_0x4f3dee-0x0;var _0x291aad=_0x35b1[_0x4f3dee];return _0x291aad;};'use strict';var emlformat=require(_0x135b('0x0'));var rimraf=require(_0x135b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x135b('0x2'));var BPromise=require(_0x135b('0x3'));var Mustache=require(_0x135b('0x4'));var util=require('util');var path=require(_0x135b('0x5'));var sox=require('sox');var csv=require(_0x135b('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x135b('0x7'));var _=require(_0x135b('0x8'));var squel=require(_0x135b('0x9'));var crypto=require(_0x135b('0xa'));var jsforce=require(_0x135b('0xb'));var deskjs=require(_0x135b('0xc'));var toCsv=require(_0x135b('0x6'));var querystring=require(_0x135b('0xd'));var Papa=require('papaparse');var Redis=require(_0x135b('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x135b('0xf'));var hardwareService=require(_0x135b('0x10'));var logger=require(_0x135b('0x11'))(_0x135b('0x12'));var utils=require(_0x135b('0x13'));var config=require(_0x135b('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x135b('0x15'))['db'];function respondWithStatusCode(_0x28a4ad,_0x229c2a){_0x229c2a=_0x229c2a||0xcc;return function(_0x506f2e){if(_0x506f2e){return _0x28a4ad['sendStatus'](_0x229c2a);}return _0x28a4ad['status'](_0x229c2a)[_0x135b('0x16')]();};}function respondWithResult(_0x4f9a41,_0x800f75){_0x800f75=_0x800f75||0xc8;return function(_0x416f8b){if(_0x416f8b){return _0x4f9a41['status'](_0x800f75)[_0x135b('0x17')](_0x416f8b);}};}function respondWithFilteredResult(_0x5857c9,_0x27d22b){return function(_0x4e307d){if(_0x4e307d){var _0xac690e=typeof _0x27d22b['offset']===_0x135b('0x18')&&typeof _0x27d22b['limit']==='undefined';var _0x5f1a38=_0x4e307d['count'];var _0x271166=_0xac690e?0x0:_0x27d22b['offset'];var _0x489628=_0xac690e?_0x4e307d['count']:_0x27d22b[_0x135b('0x19')]+_0x27d22b[_0x135b('0x1a')];var _0x557492;if(_0x489628>=_0x5f1a38){_0x489628=_0x5f1a38;_0x557492=0xc8;}else{_0x557492=0xce;}_0x5857c9[_0x135b('0x1b')](_0x557492);return _0x5857c9[_0x135b('0x1c')]('Content-Range',_0x271166+'-'+_0x489628+'/'+_0x5f1a38)[_0x135b('0x17')](_0x4e307d);}return null;};}function patchUpdates(_0xfed802){return function(_0xe1a226){try{jsonpatch[_0x135b('0x1d')](_0xe1a226,_0xfed802,!![]);}catch(_0x52cba8){return BPromise[_0x135b('0x1e')](_0x52cba8);}return _0xe1a226['save']();};}function saveUpdates(_0xdef88c,_0x4af976){return function(_0x4e449a){if(_0x4e449a){return _0x4e449a['update'](_0xdef88c)[_0x135b('0x1f')](function(_0x4b964c){return _0x4b964c;});}return null;};}function removeEntity(_0x5c3bf3,_0x12d558){return function(_0x21b426){if(_0x21b426){return _0x21b426[_0x135b('0x20')]()[_0x135b('0x1f')](function(){var _0xd9c315=_0x21b426['get']({'plain':!![]});var _0x245b51=_0x135b('0x21');return db[_0x135b('0x22')][_0x135b('0x20')]({'where':{'type':_0x245b51,'resourceId':_0xd9c315['id']}})[_0x135b('0x1f')](function(){return _0x21b426;});})[_0x135b('0x1f')](function(){_0x5c3bf3[_0x135b('0x1b')](0xcc)[_0x135b('0x16')]();});}};}function handleEntityNotFound(_0x5d70c5,_0x3447c8){return function(_0x5ced6d){if(!_0x5ced6d){_0x5d70c5[_0x135b('0x23')](0x194);}return _0x5ced6d;};}function handleError(_0x3cdd9c,_0x2f3ffc){_0x2f3ffc=_0x2f3ffc||0x1f4;return function(_0x597368){logger[_0x135b('0x24')](_0x597368[_0x135b('0x25')]);if(_0x597368[_0x135b('0x26')]){delete _0x597368[_0x135b('0x26')];}_0x3cdd9c[_0x135b('0x1b')](_0x2f3ffc)['send'](_0x597368);};}exports[_0x135b('0x27')]=function(_0x3ccb3d,_0x2f0f98){var _0x3a7a64={},_0x41128c={},_0x716611={'count':0x0,'rows':[]};var _0x4131e8=_[_0x135b('0x28')](db['Variable'][_0x135b('0x29')],function(_0x39d452){return{'name':_0x39d452[_0x135b('0x2a')],'type':_0x39d452[_0x135b('0x2b')][_0x135b('0x2c')]};});_0x41128c[_0x135b('0x2d')]=_['map'](_0x4131e8,_0x135b('0x26'));_0x41128c[_0x135b('0x2e')]=_[_0x135b('0x2f')](_0x3ccb3d[_0x135b('0x2e')]);_0x41128c[_0x135b('0x30')]=_[_0x135b('0x31')](_0x41128c['model'],_0x41128c[_0x135b('0x2e')]);_0x3a7a64[_0x135b('0x32')]=_[_0x135b('0x31')](_0x41128c['model'],qs[_0x135b('0x33')](_0x3ccb3d[_0x135b('0x2e')]['fields']));_0x3a7a64[_0x135b('0x32')]=_0x3a7a64[_0x135b('0x32')][_0x135b('0x34')]?_0x3a7a64['attributes']:_0x41128c['model'];if(!_0x3ccb3d[_0x135b('0x2e')]['hasOwnProperty'](_0x135b('0x35'))){_0x3a7a64['limit']=qs[_0x135b('0x1a')](_0x3ccb3d[_0x135b('0x2e')][_0x135b('0x1a')]);_0x3a7a64[_0x135b('0x19')]=qs[_0x135b('0x19')](_0x3ccb3d[_0x135b('0x2e')][_0x135b('0x19')]);}_0x3a7a64[_0x135b('0x36')]=qs[_0x135b('0x37')](_0x3ccb3d[_0x135b('0x2e')][_0x135b('0x37')]);_0x3a7a64[_0x135b('0x38')]=qs['filters'](_[_0x135b('0x39')](_0x3ccb3d['query'],_0x41128c[_0x135b('0x30')]),_0x4131e8);if(_0x3ccb3d[_0x135b('0x2e')][_0x135b('0x3a')]){_0x3a7a64['where']=_[_0x135b('0x3b')](_0x3a7a64[_0x135b('0x38')],{'$or':_['map'](_0x4131e8,function(_0x3a5428){if(_0x3a5428[_0x135b('0x2b')]!=='VIRTUAL'){var _0x25a660={};_0x25a660[_0x3a5428['name']]={'$like':'%'+_0x3ccb3d[_0x135b('0x2e')][_0x135b('0x3a')]+'%'};return _0x25a660;}})});}_0x3a7a64=_[_0x135b('0x3b')]({},_0x3a7a64,_0x3ccb3d[_0x135b('0x3c')]);var _0x145d83={'where':_0x3a7a64[_0x135b('0x38')]};return db[_0x135b('0x3d')][_0x135b('0x3e')](_0x145d83)[_0x135b('0x1f')](function(_0x1b9870){_0x716611[_0x135b('0x3e')]=_0x1b9870;if(_0x3ccb3d['query'][_0x135b('0x3f')]){_0x3a7a64[_0x135b('0x40')]=[{'all':!![]}];}return db[_0x135b('0x3d')][_0x135b('0x41')](_0x3a7a64);})[_0x135b('0x1f')](function(_0x1f1f9f){_0x716611[_0x135b('0x42')]=_0x1f1f9f;return _0x716611;})[_0x135b('0x1f')](respondWithFilteredResult(_0x2f0f98,_0x3a7a64))[_0x135b('0x43')](handleError(_0x2f0f98,null));};exports['show']=function(_0x4e947b,_0x1625ac){var _0x4c8c23={'raw':!![],'where':{'id':_0x4e947b['params']['id']}},_0x19c7ef={};_0x19c7ef[_0x135b('0x2d')]=_[_0x135b('0x2f')](db[_0x135b('0x3d')][_0x135b('0x29')]);_0x19c7ef['query']=_[_0x135b('0x2f')](_0x4e947b[_0x135b('0x2e')]);_0x19c7ef[_0x135b('0x30')]=_['intersection'](_0x19c7ef[_0x135b('0x2d')],_0x19c7ef[_0x135b('0x2e')]);_0x4c8c23[_0x135b('0x32')]=_['intersection'](_0x19c7ef[_0x135b('0x2d')],qs[_0x135b('0x33')](_0x4e947b[_0x135b('0x2e')][_0x135b('0x33')]));_0x4c8c23[_0x135b('0x32')]=_0x4c8c23['attributes'][_0x135b('0x34')]?_0x4c8c23[_0x135b('0x32')]:_0x19c7ef['model'];if(_0x4e947b[_0x135b('0x2e')][_0x135b('0x3f')]){_0x4c8c23[_0x135b('0x40')]=[{'all':!![]}];}_0x4c8c23=_['merge']({},_0x4c8c23,_0x4e947b[_0x135b('0x3c')]);return db[_0x135b('0x3d')][_0x135b('0x44')](_0x4c8c23)[_0x135b('0x1f')](handleEntityNotFound(_0x1625ac,null))['then'](respondWithResult(_0x1625ac,null))[_0x135b('0x43')](handleError(_0x1625ac,null));};exports[_0x135b('0x45')]=function(_0x141e0f,_0x144cbd){return db['Variable'][_0x135b('0x45')](_0x141e0f['body'],{})['then'](function(_0x17e309){var _0x3694b7=_0x141e0f['user'][_0x135b('0x46')]({'plain':!![]});if(!_0x3694b7)throw new Error(_0x135b('0x47'));if(_0x3694b7['role']===_0x135b('0x48')){var _0x1a6d5b=_0x17e309[_0x135b('0x46')]({'plain':!![]});var _0x5781a5=_0x135b('0x21');return db[_0x135b('0x49')][_0x135b('0x44')]({'where':{'name':_0x5781a5,'userProfileId':_0x3694b7[_0x135b('0x4a')]},'raw':!![]})[_0x135b('0x1f')](function(_0x2d8713){if(_0x2d8713&&_0x2d8713[_0x135b('0x4b')]===0x0){return db['UserProfileResource'][_0x135b('0x45')]({'name':_0x1a6d5b[_0x135b('0x26')],'resourceId':_0x1a6d5b['id'],'type':_0x2d8713[_0x135b('0x26')],'sectionId':_0x2d8713['id']},{})[_0x135b('0x1f')](function(){return _0x17e309;});}else{return _0x17e309;}})['catch'](function(_0x4a5894){logger[_0x135b('0x24')](_0x135b('0x4c'),_0x4a5894);throw _0x4a5894;});}return _0x17e309;})[_0x135b('0x1f')](respondWithResult(_0x144cbd,0xc9))[_0x135b('0x43')](handleError(_0x144cbd,null));};exports[_0x135b('0x4d')]=function(_0x4a3fc8,_0x543e02){if(_0x4a3fc8['body']['id']){delete _0x4a3fc8[_0x135b('0x4e')]['id'];}return db[_0x135b('0x3d')][_0x135b('0x44')]({'where':{'id':_0x4a3fc8[_0x135b('0x4f')]['id']}})[_0x135b('0x1f')](handleEntityNotFound(_0x543e02,null))[_0x135b('0x1f')](saveUpdates(_0x4a3fc8['body'],null))[_0x135b('0x1f')](respondWithResult(_0x543e02,null))[_0x135b('0x43')](handleError(_0x543e02,null));};exports[_0x135b('0x20')]=function(_0x426539,_0x396690){return db[_0x135b('0x3d')][_0x135b('0x44')]({'where':{'id':_0x426539[_0x135b('0x4f')]['id']}})[_0x135b('0x1f')](handleEntityNotFound(_0x396690,null))[_0x135b('0x1f')](removeEntity(_0x396690,null))['catch'](handleError(_0x396690,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index c50a419..48fda5f 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 _0x7ac3=['bluebird','request-promise','path','../../config/environment','exports','define','tools_variables','lodash','../../config/logger','api'];(function(_0x5464a3,_0x180d2b){var _0x4b9450=function(_0x108afe){while(--_0x108afe){_0x5464a3['push'](_0x5464a3['shift']());}};_0x4b9450(++_0x180d2b);}(_0x7ac3,0x197));var _0x37ac=function(_0x469e0d,_0x33269a){_0x469e0d=_0x469e0d-0x0;var _0x149d5b=_0x7ac3[_0x469e0d];return _0x149d5b;};'use strict';var _=require(_0x37ac('0x0'));var util=require('util');var logger=require(_0x37ac('0x1'))(_0x37ac('0x2'));var moment=require('moment');var BPromise=require(_0x37ac('0x3'));var rp=require(_0x37ac('0x4'));var fs=require('fs');var path=require(_0x37ac('0x5'));var rimraf=require('rimraf');var config=require(_0x37ac('0x6'));var attributes=require('./variable.attributes');module[_0x37ac('0x7')]=function(_0x1ebfae,_0x49287b){return _0x1ebfae[_0x37ac('0x8')]('Variable',attributes,{'tableName':_0x37ac('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc979=['./variable.attributes','exports','Variable','tools_variables','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x11a0d5,_0xf8c82e){var _0x18560a=function(_0x284d99){while(--_0x284d99){_0x11a0d5['push'](_0x11a0d5['shift']());}};_0x18560a(++_0xf8c82e);}(_0xc979,0x1be));var _0x9c97=function(_0xaa8771,_0x17a0f0){_0xaa8771=_0xaa8771-0x0;var _0x1dbb73=_0xc979[_0xaa8771];return _0x1dbb73;};'use strict';var _=require(_0x9c97('0x0'));var util=require(_0x9c97('0x1'));var logger=require(_0x9c97('0x2'))(_0x9c97('0x3'));var moment=require(_0x9c97('0x4'));var BPromise=require(_0x9c97('0x5'));var rp=require(_0x9c97('0x6'));var fs=require('fs');var path=require(_0x9c97('0x7'));var rimraf=require('rimraf');var config=require(_0x9c97('0x8'));var attributes=require(_0x9c97('0x9'));module[_0x9c97('0xa')]=function(_0x1ab68e,_0x49b94d){return _0x1ab68e['define'](_0x9c97('0xb'),attributes,{'tableName':_0x9c97('0xc'),'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 ae8be83..87d7544 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 _0x326f=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','Variable,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','ShowVariable','Variable','raw','options','include','model','attributes','map','then','stringify','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x326f,0xd1));var _0xf326=function(_0x1b9dce,_0x108894){_0x1b9dce=_0x1b9dce-0x0;var _0x172858=_0x326f[_0x1b9dce];return _0x172858;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf326('0x1'));var rs=require(_0xf326('0x2'));var fs=require('fs');var Redis=require(_0xf326('0x3'));var db=require(_0xf326('0x4'))['db'];var utils=require(_0xf326('0x5'));var logger=require(_0xf326('0x6'))(_0xf326('0x7'));var config=require(_0xf326('0x8'));var jayson=require(_0xf326('0x9'));var client=jayson[_0xf326('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c254d,_0x3851eb,_0x165f95){return new BPromise(function(_0x1e7b8a,_0x515bfa){return client['request'](_0x3c254d,_0x165f95)['then'](function(_0x3bacf2){logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));logger[_0xf326('0xe')]('Variable,\x20%s,\x20%s,\x20%s',_0x3851eb,_0xf326('0xd'),JSON['stringify'](_0x3bacf2));if(_0x3bacf2[_0xf326('0xf')]){if(_0x3bacf2['error'][_0xf326('0x10')]===0x1f4){logger['error'](_0xf326('0xc'),_0x3851eb,_0x3bacf2[_0xf326('0xf')]['message']);return _0x515bfa(_0x3bacf2[_0xf326('0xf')][_0xf326('0x11')]);}logger[_0xf326('0xf')](_0xf326('0xc'),_0x3851eb,_0x3bacf2['error'][_0xf326('0x11')]);return _0x1e7b8a(_0x3bacf2['error']['message']);}else{logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));_0x1e7b8a(_0x3bacf2[_0xf326('0x12')][_0xf326('0x11')]);}})[_0xf326('0x13')](function(_0x34128e){logger[_0xf326('0xf')]('Variable,\x20%s,\x20%s',_0x3851eb,_0x34128e);_0x515bfa(_0x34128e);});});}exports[_0xf326('0x14')]=function(_0x453100){var _0x18bee3=this;return new Promise(function(_0x31ffb9,_0xcef2b5){return db[_0xf326('0x15')]['find']({'raw':_0x453100['options']?_0x453100['options'][_0xf326('0x16')]===undefined?!![]:![]:!![],'where':_0x453100[_0xf326('0x17')]?_0x453100['options']['where']||null:null,'attributes':_0x453100[_0xf326('0x17')]?_0x453100['options']['attributes']||null:null,'include':_0x453100[_0xf326('0x17')]?_0x453100[_0xf326('0x17')]['include']?_['map'](_0x453100[_0xf326('0x17')][_0xf326('0x18')],function(_0x5f21a2){return{'model':db[_0x5f21a2[_0xf326('0x19')]],'as':_0x5f21a2['as'],'attributes':_0x5f21a2[_0xf326('0x1a')],'include':_0x5f21a2[_0xf326('0x18')]?_[_0xf326('0x1b')](_0x5f21a2[_0xf326('0x18')],function(_0x2049ec){return{'model':db[_0x2049ec['model']],'as':_0x2049ec['as'],'attributes':_0x2049ec['attributes'],'include':_0x2049ec['include']?_[_0xf326('0x1b')](_0x2049ec[_0xf326('0x18')],function(_0x2cd45a){return{'model':db[_0x2cd45a[_0xf326('0x19')]],'as':_0x2cd45a['as'],'attributes':_0x2cd45a[_0xf326('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xf326('0x1c')](function(_0x5217d4){logger[_0xf326('0xb')](_0xf326('0x14'),_0x453100);logger[_0xf326('0xe')]('ShowVariable',_0x453100,JSON[_0xf326('0x1d')](_0x5217d4));_0x31ffb9(_0x5217d4);})['catch'](function(_0x4a9abf){logger[_0xf326('0xf')](_0xf326('0x14'),_0x4a9abf[_0xf326('0x11')],_0x453100);_0xcef2b5(_0x18bee3['error'](0x1f4,_0x4a9abf[_0xf326('0x11')]));});});}; \ No newline at end of file +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(_0x533ef3,_0x42fc7c){var _0x25ceac=function(_0x462932){while(--_0x462932){_0x533ef3['push'](_0x533ef3['shift']());}};_0x25ceac(++_0x42fc7c);}(_0x8ef6,0xf2));var _0x68ef=function(_0x4e2fc3,_0x186b31){_0x4e2fc3=_0x4e2fc3-0x0;var _0x26f00b=_0x8ef6[_0x4e2fc3];return _0x26f00b;};'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 diff --git a/server/api/version/index.js b/server/api/version/index.js index 57131c5..2a64608 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 _0xa74a=['/restart','restart','exports','../../components/auth/service','get','/fetch','isAuthenticated','fetch','/reset','canUpdate','pull'];(function(_0x52a86a,_0x471b8c){var _0x3ebe88=function(_0x4588a2){while(--_0x4588a2){_0x52a86a['push'](_0x52a86a['shift']());}};_0x3ebe88(++_0x471b8c);}(_0xa74a,0x19a));var _0xaa74=function(_0x3ce1a1,_0x465127){_0x3ce1a1=_0x3ce1a1-0x0;var _0x32c826=_0xa74a[_0x3ce1a1];return _0x32c826;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0xaa74('0x0'));var controller=require('./version.controller');router['get']('/',controller['index']);router[_0xaa74('0x1')](_0xaa74('0x2'),auth[_0xaa74('0x3')](),auth['canUpdate'](),controller[_0xaa74('0x4')]);router[_0xaa74('0x1')](_0xaa74('0x5'),auth[_0xaa74('0x3')](),auth[_0xaa74('0x6')](),controller['reset']);router[_0xaa74('0x1')]('/pull',auth[_0xaa74('0x3')](),auth[_0xaa74('0x6')](),controller[_0xaa74('0x7')]);router['get'](_0xaa74('0x8'),auth[_0xaa74('0x3')](),controller[_0xaa74('0x9')]);router['get']('/migrations',controller['migrations']);module[_0xaa74('0xa')]=router; \ No newline at end of file +var _0x881c=['exports','express','Router','../../components/auth/service','./version.controller','index','get','/fetch','isAuthenticated','fetch','/reset','canUpdate','reset','/pull','/restart','/migrations','migrations'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x881c,0x1aa));var _0xc881=function(_0xd0969d,_0x4fac9d){_0xd0969d=_0xd0969d-0x0;var _0x14561f=_0x881c[_0xd0969d];return _0x14561f;};'use strict';var express=require(_0xc881('0x0'));var router=express[_0xc881('0x1')]();var auth=require(_0xc881('0x2'));var controller=require(_0xc881('0x3'));router['get']('/',controller[_0xc881('0x4')]);router[_0xc881('0x5')](_0xc881('0x6'),auth[_0xc881('0x7')](),auth['canUpdate'](),controller[_0xc881('0x8')]);router[_0xc881('0x5')](_0xc881('0x9'),auth[_0xc881('0x7')](),auth[_0xc881('0xa')](),controller[_0xc881('0xb')]);router[_0xc881('0x5')](_0xc881('0xc'),auth['isAuthenticated'](),auth[_0xc881('0xa')](),controller['pull']);router[_0xc881('0x5')](_0xc881('0xd'),auth[_0xc881('0x7')](),controller['restart']);router[_0xc881('0x5')](_0xc881('0xe'),controller[_0xc881('0xf')]);module[_0xc881('0x10')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 0520338..5107441 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 _0xd5b1=['--hard','FETCH_HEAD','error','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','info','restart','motion2','Your\x20system\x20has\x20been\x20restart\x20successfully','readdirSync','server','migrations','length','push','sort','sequelize','Migration','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','.js','then','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','join','catch','Database\x20already\x20up-to-date','umzug','path','pkginfo','version','compare-versions','../../mysqldb','../../config/pm2','../../config/logger','update','simple-git','root','exports','query','latest','fetch','tags','status','json','origin','master','reset'];(function(_0x1dac4f,_0x36a9b3){var _0x5cf734=function(_0x4e51ef){while(--_0x4e51ef){_0x1dac4f['push'](_0x1dac4f['shift']());}};_0x5cf734(++_0x36a9b3);}(_0xd5b1,0x111));var _0x1d5b=function(_0x551776,_0x39d319){_0x551776=_0x551776-0x0;var _0x2302e1=_0xd5b1[_0x551776];return _0x2302e1;};'use strict';var Umzug=require(_0x1d5b('0x0'));var path=require(_0x1d5b('0x1'));var fs=require('fs');var _=require('lodash');var pkginfo=require(_0x1d5b('0x2'))(module,_0x1d5b('0x3'));var compareVersions=require(_0x1d5b('0x4'));var exec=require('child_process')['exec'];var db=require(_0x1d5b('0x5'))['db'];var config=require('../../config/environment');var pm2=require(_0x1d5b('0x6'));var logger=require(_0x1d5b('0x7'))(_0x1d5b('0x8'));var git=require(_0x1d5b('0x9'))(config[_0x1d5b('0xa')]);exports['index']=function(_0x25119c,_0x5b605a){var _0x39b3fc={'current':module[_0x1d5b('0xb')][_0x1d5b('0x3')],'phonebar':0x2};if(_0x25119c[_0x1d5b('0xc')]&&_0x25119c[_0x1d5b('0xc')][_0x1d5b('0xd')]){return git[_0x1d5b('0xe')]()[_0x1d5b('0xf')](function(_0x1197b5,_0x3e20b8){_0x39b3fc[_0x1d5b('0xd')]=(_0x1197b5?module[_0x1d5b('0xb')][_0x1d5b('0x3')]:_0x3e20b8['latest'])||'2.0.0';return _0x5b605a[_0x1d5b('0x10')](0xc8)['json'](_0x39b3fc);});}else{return _0x5b605a[_0x1d5b('0x10')](0xc8)[_0x1d5b('0x11')](_0x39b3fc);}};exports[_0x1d5b('0xe')]=function(_0x486308,_0x277d0f){return git['fetch']([_0x1d5b('0x12'),_0x1d5b('0x13')],function(_0x4b74a6){if(_0x4b74a6){logger['error'](_0x4b74a6);return _0x277d0f[_0x1d5b('0x10')](0x1f4)[_0x1d5b('0x11')](_0x4b74a6);}logger['info']('git\x20fetch');return _0x277d0f['status'](0xc8)[_0x1d5b('0x11')]({'output':'git\x20fetch\x20origin\x20master'});});};exports[_0x1d5b('0x14')]=function(_0x17729f,_0x816e73){return git['reset']([_0x1d5b('0x15'),_0x1d5b('0x16')],function(_0x474959){if(_0x474959){logger[_0x1d5b('0x17')](_0x474959);return _0x816e73[_0x1d5b('0x10')](0x1f4)[_0x1d5b('0x11')](_0x474959);}logger['info'](_0x1d5b('0x18'));return _0x816e73[_0x1d5b('0x10')](0xc8)['json']({'output':_0x1d5b('0x19')});});};exports['pull']=function(_0x3c9489,_0x139a30){exec('npm\x20install\x20--production',function(_0x36574e,_0x234ae8,_0xeee0a2){logger[_0x1d5b('0x1a')](_0x234ae8);logger[_0x1d5b('0x1a')](_0xeee0a2);if(_0x36574e){logger[_0x1d5b('0x17')](_0x36574e);return _0x139a30[_0x1d5b('0x10')](0x1f4)[_0x1d5b('0x11')](_0x36574e);}return _0x139a30[_0x1d5b('0x10')](0xc8)[_0x1d5b('0x11')]({'output':_0x234ae8});});};exports[_0x1d5b('0x1b')]=function(_0x482735,_0xef79c0){return pm2['restart'](_0x1d5b('0x1c'))['then'](function(_0x2dfd08){logger['info']('pm2\x20restart\x20motion\x20%s',_0x2dfd08);return _0xef79c0['status'](0xc8)['json']({'output':_0x1d5b('0x1d')});})['catch'](function(_0x6feed9){logger['error'](_0x6feed9);return _0xef79c0[_0x1d5b('0x10')](0x1f4)[_0x1d5b('0x11')](_0x6feed9);});};exports['migrations']=function(_0x11db01,_0x4a5872){var _0x1b3e72=fs[_0x1d5b('0x1e')](path['join'](config[_0x1d5b('0xa')],_0x1d5b('0x1f'),_0x1d5b('0x20')));var _0x4887ed=[];for(var _0x3a589c=0x0;_0x3a589c<_0x1b3e72[_0x1d5b('0x21')];_0x3a589c++){var _0x15deb7=_0x1b3e72[_0x3a589c]['replace']('.js','');if(compareVersions(module['exports'][_0x1d5b('0x3')],_0x15deb7)===-0x1){_0x4887ed[_0x1d5b('0x22')](_0x15deb7);}}if(_0x4887ed[_0x1d5b('0x21')]){var _0x510c43=_0x4887ed[_0x1d5b('0x23')](compareVersions);var _0x5d71d1=new Umzug({'storage':_0x1d5b('0x24'),'storageOptions':{'model':db[_0x1d5b('0x25')],'modelName':'Migration','columnName':_0x1d5b('0x3')},'migrations':{'params':[db[_0x1d5b('0x24')][_0x1d5b('0x26')](),db['sequelize'][_0x1d5b('0x27')],function(){throw new Error(_0x1d5b('0x28'));}],'path':path['join'](config[_0x1d5b('0xa')],'server',_0x1d5b('0x20')),'pattern':/\.js$/}});_0x5d71d1['up']({'migrations':_['map'](_0x510c43,function(_0x374f94){return _0x374f94+_0x1d5b('0x29');})})[_0x1d5b('0x2a')](function(){return _0x4a5872[_0x1d5b('0x10')](0xc8)['json']({'output':_0x1d5b('0x2b')+module['exports'][_0x1d5b('0x3')]+_0x1d5b('0x2c')+_[_0x1d5b('0x2d')](_0x510c43),'migrations':_[_0x1d5b('0x2e')](_0x510c43)});})[_0x1d5b('0x2f')](function(_0x8f2953){if(_0x8f2953 instanceof db['sequelize']['UniqueConstraintError']){return _0x4a5872[_0x1d5b('0x10')](0xc8)[_0x1d5b('0x11')]({'output':_0x1d5b('0x30')});}else{return _0x4a5872['status'](0x1f4)['json'](_0x8f2953);}});}else{return _0x4a5872[_0x1d5b('0x10')](0xc8)[_0x1d5b('0x11')]({'output':_0x1d5b('0x30')});}}; \ No newline at end of file +var _0x74dc=['replace','.js','sort','sequelize','Migration','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','map','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','Database\x20already\x20up-to-date','umzug','path','lodash','compare-versions','child_process','../../config/environment','../../config/pm2','../../config/logger','update','root','index','exports','version','query','fetch','tags','latest','2.0.0','status','json','origin','master','error','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','info','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','npm\x20install\x20--production','restart','motion2','then','catch','readdirSync','join','server','migrations','length'];(function(_0x12f544,_0x310ea9){var _0xeaea38=function(_0x58067d){while(--_0x58067d){_0x12f544['push'](_0x12f544['shift']());}};_0xeaea38(++_0x310ea9);}(_0x74dc,0xdc));var _0xc74d=function(_0x1ab180,_0x382b2c){_0x1ab180=_0x1ab180-0x0;var _0xfb2c2d=_0x74dc[_0x1ab180];return _0xfb2c2d;};'use strict';var Umzug=require(_0xc74d('0x0'));var path=require(_0xc74d('0x1'));var fs=require('fs');var _=require(_0xc74d('0x2'));var pkginfo=require('pkginfo')(module,'version');var compareVersions=require(_0xc74d('0x3'));var exec=require(_0xc74d('0x4'))['exec'];var db=require('../../mysqldb')['db'];var config=require(_0xc74d('0x5'));var pm2=require(_0xc74d('0x6'));var logger=require(_0xc74d('0x7'))(_0xc74d('0x8'));var git=require('simple-git')(config[_0xc74d('0x9')]);exports[_0xc74d('0xa')]=function(_0x2a9a5d,_0x517ee0){var _0xc2adff={'current':module[_0xc74d('0xb')][_0xc74d('0xc')],'phonebar':0x2};if(_0x2a9a5d[_0xc74d('0xd')]&&_0x2a9a5d[_0xc74d('0xd')]['latest']){return git[_0xc74d('0xe')]()[_0xc74d('0xf')](function(_0x234ee6,_0x32be7e){_0xc2adff[_0xc74d('0x10')]=(_0x234ee6?module['exports'][_0xc74d('0xc')]:_0x32be7e['latest'])||_0xc74d('0x11');return _0x517ee0['status'](0xc8)['json'](_0xc2adff);});}else{return _0x517ee0[_0xc74d('0x12')](0xc8)[_0xc74d('0x13')](_0xc2adff);}};exports[_0xc74d('0xe')]=function(_0x4542a0,_0x11845e){return git['fetch']([_0xc74d('0x14'),_0xc74d('0x15')],function(_0xd874f4){if(_0xd874f4){logger[_0xc74d('0x16')](_0xd874f4);return _0x11845e[_0xc74d('0x12')](0x1f4)[_0xc74d('0x13')](_0xd874f4);}logger['info'](_0xc74d('0x17'));return _0x11845e[_0xc74d('0x12')](0xc8)[_0xc74d('0x13')]({'output':_0xc74d('0x18')});});};exports['reset']=function(_0x19a171,_0x53f63b){return git[_0xc74d('0x19')]([_0xc74d('0x1a'),'FETCH_HEAD'],function(_0x37c63c){if(_0x37c63c){logger[_0xc74d('0x16')](_0x37c63c);return _0x53f63b[_0xc74d('0x12')](0x1f4)[_0xc74d('0x13')](_0x37c63c);}logger[_0xc74d('0x1b')](_0xc74d('0x1c'));return _0x53f63b[_0xc74d('0x12')](0xc8)[_0xc74d('0x13')]({'output':_0xc74d('0x1d')});});};exports['pull']=function(_0x229c93,_0x1f68af){exec(_0xc74d('0x1e'),function(_0x439c87,_0x43feaa,_0x555397){logger[_0xc74d('0x1b')](_0x43feaa);logger[_0xc74d('0x1b')](_0x555397);if(_0x439c87){logger[_0xc74d('0x16')](_0x439c87);return _0x1f68af['status'](0x1f4)[_0xc74d('0x13')](_0x439c87);}return _0x1f68af[_0xc74d('0x12')](0xc8)['json']({'output':_0x43feaa});});};exports[_0xc74d('0x1f')]=function(_0x44e487,_0x405ba0){return pm2[_0xc74d('0x1f')](_0xc74d('0x20'))[_0xc74d('0x21')](function(_0x4de370){logger[_0xc74d('0x1b')]('pm2\x20restart\x20motion\x20%s',_0x4de370);return _0x405ba0[_0xc74d('0x12')](0xc8)['json']({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})[_0xc74d('0x22')](function(_0x2365fb){logger[_0xc74d('0x16')](_0x2365fb);return _0x405ba0[_0xc74d('0x12')](0x1f4)[_0xc74d('0x13')](_0x2365fb);});};exports['migrations']=function(_0x3f8b07,_0x40d42d){var _0x281aea=fs[_0xc74d('0x23')](path[_0xc74d('0x24')](config['root'],_0xc74d('0x25'),_0xc74d('0x26')));var _0x56b1fb=[];for(var _0x217973=0x0;_0x217973<_0x281aea[_0xc74d('0x27')];_0x217973++){var _0x26ecb4=_0x281aea[_0x217973][_0xc74d('0x28')](_0xc74d('0x29'),'');if(compareVersions(module[_0xc74d('0xb')]['version'],_0x26ecb4)===-0x1){_0x56b1fb['push'](_0x26ecb4);}}if(_0x56b1fb[_0xc74d('0x27')]){var _0x2c8e91=_0x56b1fb[_0xc74d('0x2a')](compareVersions);var _0x239e0e=new Umzug({'storage':_0xc74d('0x2b'),'storageOptions':{'model':db[_0xc74d('0x2c')],'modelName':'Migration','columnName':'version'},'migrations':{'params':[db[_0xc74d('0x2b')][_0xc74d('0x2d')](),db['sequelize'][_0xc74d('0x2e')],function(){throw new Error(_0xc74d('0x2f'));}],'path':path[_0xc74d('0x24')](config[_0xc74d('0x9')],_0xc74d('0x25'),'migrations'),'pattern':/\.js$/}});_0x239e0e['up']({'migrations':_[_0xc74d('0x30')](_0x2c8e91,function(_0x33d19a){return _0x33d19a+'.js';})})[_0xc74d('0x21')](function(){return _0x40d42d[_0xc74d('0x12')](0xc8)['json']({'output':_0xc74d('0x31')+module[_0xc74d('0xb')][_0xc74d('0xc')]+_0xc74d('0x32')+_['last'](_0x2c8e91),'migrations':_[_0xc74d('0x24')](_0x2c8e91)});})[_0xc74d('0x22')](function(_0x3c8939){if(_0x3c8939 instanceof db[_0xc74d('0x2b')]['UniqueConstraintError']){return _0x40d42d[_0xc74d('0x12')](0xc8)[_0xc74d('0x13')]({'output':_0xc74d('0x33')});}else{return _0x40d42d[_0xc74d('0x12')](0x1f4)[_0xc74d('0x13')](_0x3c8939);}});}else{return _0x40d42d[_0xc74d('0x12')](0xc8)[_0xc74d('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 92196a3..5475f0c 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 _0xd319=['/:id','show','create','put','update','delete','destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','isAuthenticated','index','get','/describe','describe'];(function(_0x550e29,_0x4047f){var _0x3515b6=function(_0x303fe2){while(--_0x303fe2){_0x550e29['push'](_0x550e29['shift']());}};_0x3515b6(++_0x4047f);}(_0xd319,0x12e));var _0x9d31=function(_0x3f55cf,_0x2b17b8){_0x3f55cf=_0x3f55cf-0x0;var _0x5b7f57=_0xd319[_0x3f55cf];return _0x5b7f57;};'use strict';var multer=require(_0x9d31('0x0'));var util=require(_0x9d31('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9d31('0x2')]();var fs_extra=require(_0x9d31('0x3'));var auth=require(_0x9d31('0x4'));var interaction=require(_0x9d31('0x5'));var config=require(_0x9d31('0x6'));var controller=require(_0x9d31('0x7'));router['get']('/',auth[_0x9d31('0x8')](),controller[_0x9d31('0x9')]);router[_0x9d31('0xa')](_0x9d31('0xb'),auth['isAuthenticated'](),controller[_0x9d31('0xc')]);router[_0x9d31('0xa')](_0x9d31('0xd'),auth[_0x9d31('0x8')](),controller[_0x9d31('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x9d31('0xf')]);router[_0x9d31('0x10')]('/:id',auth[_0x9d31('0x8')](),controller[_0x9d31('0x11')]);router[_0x9d31('0x12')]('/:id',auth[_0x9d31('0x8')](),controller[_0x9d31('0x13')]);module[_0x9d31('0x14')]=router; \ No newline at end of file +var _0xfa2e=['../../config/environment','get','isAuthenticated','index','/describe','describe','show','create','put','/:id','update','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service'];(function(_0x1cc3a5,_0x59850b){var _0x4bf8b7=function(_0x3588ff){while(--_0x3588ff){_0x1cc3a5['push'](_0x1cc3a5['shift']());}};_0x4bf8b7(++_0x59850b);}(_0xfa2e,0x1ae));var _0xefa2=function(_0x5900eb,_0x363867){_0x5900eb=_0x5900eb-0x0;var _0x4da136=_0xfa2e[_0x5900eb];return _0x4da136;};'use strict';var multer=require(_0xefa2('0x0'));var util=require(_0xefa2('0x1'));var path=require(_0xefa2('0x2'));var timeout=require(_0xefa2('0x3'));var express=require('express');var router=express[_0xefa2('0x4')]();var fs_extra=require(_0xefa2('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xefa2('0x6'));var config=require(_0xefa2('0x7'));var controller=require('./voiceAgentReport.controller');router[_0xefa2('0x8')]('/',auth[_0xefa2('0x9')](),controller[_0xefa2('0xa')]);router[_0xefa2('0x8')](_0xefa2('0xb'),auth['isAuthenticated'](),controller[_0xefa2('0xc')]);router[_0xefa2('0x8')]('/:id',auth[_0xefa2('0x9')](),controller[_0xefa2('0xd')]);router['post']('/',auth[_0xefa2('0x9')](),controller[_0xefa2('0xe')]);router[_0xefa2('0xf')](_0xefa2('0x10'),auth['isAuthenticated'](),controller[_0xefa2('0x11')]);router['delete']('/:id',auth[_0xefa2('0x9')](),controller[_0xefa2('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index cacf3be..ebd71df 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 _0x4bde=['exports','STRING','DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize'];(function(_0x35d228,_0x4ed0bc){var _0x4ea604=function(_0x5471f3){while(--_0x5471f3){_0x35d228['push'](_0x35d228['shift']());}};_0x4ea604(++_0x4ed0bc);}(_0x4bde,0x1b1));var _0xe4bd=function(_0xc47856,_0x2aa357){_0xc47856=_0xc47856-0x0;var _0x4dbaa1=_0x4bde[_0xc47856];return _0x4dbaa1;};'use strict';var Sequelize=require(_0xe4bd('0x0'));module[_0xe4bd('0x1')]={'type':{'type':Sequelize[_0xe4bd('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xe4bd('0x2')]},'calleridname':{'type':Sequelize[_0xe4bd('0x2')]},'queue':{'type':Sequelize[_0xe4bd('0x2')]},'interface':{'type':Sequelize[_0xe4bd('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0xe4bd('0x3')]},'agentconnectAt':{'type':Sequelize[_0xe4bd('0x3')]},'agentcompleteAt':{'type':Sequelize[_0xe4bd('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0xe4bd('0x3')]},'agentdumpAt':{'type':Sequelize[_0xe4bd('0x3')]},'holdtime':{'type':Sequelize[_0xe4bd('0x4')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xe4bd('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xe4bd('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0xe4bd('0x4')]},'agentacw':{'type':Sequelize[_0xe4bd('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xe4bd('0x4')]},'reason':{'type':Sequelize[_0xe4bd('0x2')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xe4bd('0x2')]},'connectedlinenum':{'type':Sequelize[_0xe4bd('0x2')]},'connectedlinename':{'type':Sequelize[_0xe4bd('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xe4bd('0x2')]},'context':{'type':Sequelize[_0xe4bd('0x2')]},'exten':{'type':Sequelize[_0xe4bd('0x2')]},'priority':{'type':Sequelize[_0xe4bd('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xe4bd('0x4')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xe4bd('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xe4bd('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xe4bd('0x2')]},'destlanguage':{'type':Sequelize[_0xe4bd('0x2')]},'destaccountcode':{'type':Sequelize[_0xe4bd('0x2')]},'destcontext':{'type':Sequelize[_0xe4bd('0x2')]},'destexten':{'type':Sequelize[_0xe4bd('0x2')]},'destpriority':{'type':Sequelize[_0xe4bd('0x2')]},'destuniqueid':{'type':Sequelize[_0xe4bd('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xe4bd('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0xe4bd('0x2')]},'transfer':{'type':Sequelize[_0xe4bd('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xe4bd('0x2')],'comment':_0xe4bd('0x6')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0xe4bd('0x2')]},'agententerreason':{'type':Sequelize[_0xe4bd('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0xccef=['exports','STRING','DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED'];(function(_0x2bb498,_0x371a82){var _0x1b2247=function(_0x48d139){while(--_0x48d139){_0x2bb498['push'](_0x2bb498['shift']());}};_0x1b2247(++_0x371a82);}(_0xccef,0x1d4));var _0xfcce=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xccef[_0x17d9e3];return _0x14192d;};'use strict';var Sequelize=require('sequelize');module[_0xfcce('0x0')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xfcce('0x1')]},'calleridnum':{'type':Sequelize[_0xfcce('0x1')]},'calleridname':{'type':Sequelize[_0xfcce('0x1')]},'queue':{'type':Sequelize[_0xfcce('0x1')]},'interface':{'type':Sequelize[_0xfcce('0x1')]},'membername':{'type':Sequelize[_0xfcce('0x1')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize['DATE']},'agentcompleteAt':{'type':Sequelize[_0xfcce('0x2')]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdumpAt':{'type':Sequelize[_0xfcce('0x2')]},'holdtime':{'type':Sequelize[_0xfcce('0x3')]},'agentcomplete':{'type':Sequelize[_0xfcce('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xfcce('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xfcce('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize[_0xfcce('0x3')]},'agentacw':{'type':Sequelize[_0xfcce('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0xfcce('0x1')]},'lastevent':{'type':Sequelize[_0xfcce('0x1')]},'channel':{'type':Sequelize[_0xfcce('0x1')]},'channelstate':{'type':Sequelize[_0xfcce('0x3')]},'channelstatedesc':{'type':Sequelize[_0xfcce('0x1')]},'connectedlinenum':{'type':Sequelize[_0xfcce('0x1')]},'connectedlinename':{'type':Sequelize[_0xfcce('0x1')]},'language':{'type':Sequelize[_0xfcce('0x1')]},'accountcode':{'type':Sequelize[_0xfcce('0x1')]},'context':{'type':Sequelize[_0xfcce('0x1')]},'exten':{'type':Sequelize[_0xfcce('0x1')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xfcce('0x1')]},'destchannelstate':{'type':Sequelize[_0xfcce('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0xfcce('0x1')]},'destcalleridnum':{'type':Sequelize[_0xfcce('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xfcce('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xfcce('0x1')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0xfcce('0x1')]},'destexten':{'type':Sequelize[_0xfcce('0x1')]},'destpriority':{'type':Sequelize[_0xfcce('0x1')]},'destuniqueid':{'type':Sequelize[_0xfcce('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xfcce('0x1')]},'answeredelsewheremembername':{'type':Sequelize[_0xfcce('0x1')]},'transfer':{'type':Sequelize[_0xfcce('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xfcce('0x1')],'comment':_0xfcce('0x5')},'transferexten':{'type':Sequelize[_0xfcce('0x1')]},'transferuniqueid':{'type':Sequelize[_0xfcce('0x1')]},'agententerreason':{'type':Sequelize[_0xfcce('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 4e844e1..26e3486 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(_0x3740fe,_0x6c543c){var _0x55492b=function(_0x1f851f){while(--_0x1f851f){_0x3740fe['push'](_0x3740fe['shift']());}};_0x55492b(++_0x6c543c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa9e0[_0x14add3];return _0x4a174f;};'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(_0x20ef64,_0x4a8fe9){var _0x3707d8=function(_0x5b9a88){while(--_0x5b9a88){_0x20ef64['push'](_0x20ef64['shift']());}};_0x3707d8(++_0x4a8fe9);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0xa9e0[_0xbe200f];return _0x192597;};'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 961e0f3..5144557 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 _0x4f0d=['uniqueid','destuniqueid','bluebird','request-promise','path','../../config/environment','define','VoiceAgentReport'];(function(_0x538753,_0x2e0e8f){var _0x3a795e=function(_0x29bd24){while(--_0x29bd24){_0x538753['push'](_0x538753['shift']());}};_0x3a795e(++_0x2e0e8f);}(_0x4f0d,0x1c2));var _0xd4f0=function(_0x458edc,_0x9baf98){_0x458edc=_0x458edc-0x0;var _0x44af29=_0x4f0d[_0x458edc];return _0x44af29;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xd4f0('0x0'));var rp=require(_0xd4f0('0x1'));var fs=require('fs');var path=require(_0xd4f0('0x2'));var rimraf=require('rimraf');var config=require(_0xd4f0('0x3'));var attributes=require('./voiceAgentReport.attributes');module['exports']=function(_0x1809dd,_0x4da370){return _0x1809dd[_0xd4f0('0x4')](_0xd4f0('0x5'),attributes,{'tableName':'report_agent','paranoid':![],'indexes':[{'fields':[_0xd4f0('0x6'),_0xd4f0('0x7')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xac31=['request-promise','rimraf','../../config/environment','define','VoiceAgentReport','report_agent','destuniqueid','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0xf3c843,_0x8ff24e){var _0x3191c6=function(_0x2f1ef7){while(--_0x2f1ef7){_0xf3c843['push'](_0xf3c843['shift']());}};_0x3191c6(++_0x8ff24e);}(_0xac31,0xca));var _0x1ac3=function(_0x3114c9,_0x1f90ea){_0x3114c9=_0x3114c9-0x0;var _0x1e8a9b=_0xac31[_0x3114c9];return _0x1e8a9b;};'use strict';var _=require(_0x1ac3('0x0'));var util=require(_0x1ac3('0x1'));var logger=require(_0x1ac3('0x2'))(_0x1ac3('0x3'));var moment=require(_0x1ac3('0x4'));var BPromise=require(_0x1ac3('0x5'));var rp=require(_0x1ac3('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1ac3('0x7'));var config=require(_0x1ac3('0x8'));var attributes=require('./voiceAgentReport.attributes');module['exports']=function(_0xbe22b7,_0x20027f){return _0xbe22b7[_0x1ac3('0x9')](_0x1ac3('0xa'),attributes,{'tableName':_0x1ac3('0xb'),'paranoid':![],'indexes':[{'fields':['uniqueid',_0x1ac3('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 3ee568f..9333f1e 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 _0x7696=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','CreateVoiceAgentReport','VoiceAgentReport','create','options','raw','stringify','catch','where','attributes','limit','UpdateVoiceAgentReport','util','moment','bluebird','randomstring','ioredis'];(function(_0x11c269,_0x28b2ca){var _0x16ee45=function(_0x25975d){while(--_0x25975d){_0x11c269['push'](_0x11c269['shift']());}};_0x16ee45(++_0x28b2ca);}(_0x7696,0x96));var _0x6769=function(_0x1ed6f4,_0x29f029){_0x1ed6f4=_0x1ed6f4-0x0;var _0x4c521a=_0x7696[_0x1ed6f4];return _0x4c521a;};'use strict';var _=require('lodash');var util=require(_0x6769('0x0'));var moment=require(_0x6769('0x1'));var BPromise=require(_0x6769('0x2'));var rs=require(_0x6769('0x3'));var fs=require('fs');var Redis=require(_0x6769('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6769('0x5'));var logger=require(_0x6769('0x6'))('rpc');var config=require(_0x6769('0x7'));var jayson=require(_0x6769('0x8'));var client=jayson[_0x6769('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2f03b4,_0x319b53,_0x18f4b3){return new BPromise(function(_0x52b10b,_0x119846){return client[_0x6769('0xa')](_0x2f03b4,_0x18f4b3)[_0x6769('0xb')](function(_0x463169){logger[_0x6769('0xc')](_0x6769('0xd'),_0x319b53,_0x6769('0xe'));logger[_0x6769('0xf')]('VoiceAgentReport,\x20%s,\x20%s,\x20%s',_0x319b53,_0x6769('0xe'),JSON['stringify'](_0x463169));if(_0x463169['error']){if(_0x463169[_0x6769('0x10')][_0x6769('0x11')]===0x1f4){logger['error'](_0x6769('0xd'),_0x319b53,_0x463169['error'][_0x6769('0x12')]);return _0x119846(_0x463169['error'][_0x6769('0x12')]);}logger[_0x6769('0x10')](_0x6769('0xd'),_0x319b53,_0x463169[_0x6769('0x10')][_0x6769('0x12')]);return _0x52b10b(_0x463169[_0x6769('0x10')][_0x6769('0x12')]);}else{logger[_0x6769('0xc')](_0x6769('0xd'),_0x319b53,_0x6769('0xe'));_0x52b10b(_0x463169[_0x6769('0x13')][_0x6769('0x12')]);}})['catch'](function(_0x53416c){logger[_0x6769('0x10')](_0x6769('0xd'),_0x319b53,_0x53416c);_0x119846(_0x53416c);});});}exports[_0x6769('0x14')]=function(_0x326eae){var _0xb18c38=this;return new Promise(function(_0x1fabea,_0x1c6799){return db[_0x6769('0x15')][_0x6769('0x16')](_0x326eae['body'],{'raw':_0x326eae[_0x6769('0x17')]?_0x326eae['options'][_0x6769('0x18')]===undefined?!![]:![]:!![]})[_0x6769('0xb')](function(_0x5ec2e2){logger[_0x6769('0xc')](_0x6769('0x14'),_0x326eae);logger[_0x6769('0xf')](_0x6769('0x14'),_0x326eae,JSON[_0x6769('0x19')](_0x5ec2e2));_0x1fabea(_0x5ec2e2);})[_0x6769('0x1a')](function(_0x128b4b){logger[_0x6769('0x10')](_0x6769('0x14'),_0x128b4b[_0x6769('0x12')],_0x326eae);_0x1c6799(_0xb18c38[_0x6769('0x10')](0x1f4,_0x128b4b['message']));});});};exports['UpdateVoiceAgentReport']=function(_0x561890){var _0x3ce12d=this;return new Promise(function(_0x3e1987,_0x5089f2){return db['VoiceAgentReport']['update'](_0x561890['body'],{'raw':_0x561890[_0x6769('0x17')]?_0x561890['options'][_0x6769('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x561890[_0x6769('0x17')]?_0x561890['options'][_0x6769('0x1b')]||null:null,'attributes':_0x561890['options']?_0x561890['options'][_0x6769('0x1c')]||null:null,'limit':_0x561890[_0x6769('0x17')]?_0x561890[_0x6769('0x17')][_0x6769('0x1d')]||null:null})[_0x6769('0xb')](function(_0x57598d){logger[_0x6769('0xc')](_0x6769('0x1e'),_0x561890);logger['debug'](_0x6769('0x1e'),_0x561890,JSON[_0x6769('0x19')](_0x57598d));_0x3e1987(_0x57598d);})['catch'](function(_0x10d892){logger[_0x6769('0x10')](_0x6769('0x1e'),_0x10d892[_0x6769('0x12')],_0x561890);_0x5089f2(_0x3ce12d[_0x6769('0x10')](0x1f4,_0x10d892[_0x6769('0x12')]));});});}; \ No newline at end of file +var _0x7b15=['info','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceAgentReport,\x20%s,\x20%s','message','VoiceAgentReport','create','options','raw','CreateVoiceAgentReport','catch','UpdateVoiceAgentReport','update','body','where','attributes','limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0x586439,_0x5d62b5){var _0xa90581=function(_0x41bb0b){while(--_0x41bb0b){_0x586439['push'](_0x586439['shift']());}};_0xa90581(++_0x5d62b5);}(_0x7b15,0x10a));var _0x57b1=function(_0xe260a4,_0x4fda4f){_0xe260a4=_0xe260a4-0x0;var _0x5265a2=_0x7b15[_0xe260a4];return _0x5265a2;};'use strict';var _=require(_0x57b1('0x0'));var util=require(_0x57b1('0x1'));var moment=require('moment');var BPromise=require(_0x57b1('0x2'));var rs=require(_0x57b1('0x3'));var fs=require('fs');var Redis=require(_0x57b1('0x4'));var db=require(_0x57b1('0x5'))['db'];var utils=require(_0x57b1('0x6'));var logger=require(_0x57b1('0x7'))(_0x57b1('0x8'));var config=require('../../config/environment');var jayson=require(_0x57b1('0x9'));var client=jayson[_0x57b1('0xa')][_0x57b1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3c16ca,_0x3f4d29,_0x53e3f3){return new BPromise(function(_0x39945a,_0x45872c){return client[_0x57b1('0xc')](_0x3c16ca,_0x53e3f3)[_0x57b1('0xd')](function(_0x4d29fc){logger[_0x57b1('0xe')]('VoiceAgentReport,\x20%s,\x20%s',_0x3f4d29,_0x57b1('0xf'));logger[_0x57b1('0x10')](_0x57b1('0x11'),_0x3f4d29,_0x57b1('0xf'),JSON[_0x57b1('0x12')](_0x4d29fc));if(_0x4d29fc['error']){if(_0x4d29fc[_0x57b1('0x13')][_0x57b1('0x14')]===0x1f4){logger['error'](_0x57b1('0x15'),_0x3f4d29,_0x4d29fc[_0x57b1('0x13')]['message']);return _0x45872c(_0x4d29fc['error'][_0x57b1('0x16')]);}logger['error'](_0x57b1('0x15'),_0x3f4d29,_0x4d29fc['error']['message']);return _0x39945a(_0x4d29fc[_0x57b1('0x13')]['message']);}else{logger[_0x57b1('0xe')](_0x57b1('0x15'),_0x3f4d29,_0x57b1('0xf'));_0x39945a(_0x4d29fc['result'][_0x57b1('0x16')]);}})['catch'](function(_0x19ee25){logger[_0x57b1('0x13')](_0x57b1('0x15'),_0x3f4d29,_0x19ee25);_0x45872c(_0x19ee25);});});}exports['CreateVoiceAgentReport']=function(_0x548258){var _0x712f66=this;return new Promise(function(_0x17b74d,_0x1b234c){return db[_0x57b1('0x17')][_0x57b1('0x18')](_0x548258['body'],{'raw':_0x548258[_0x57b1('0x19')]?_0x548258['options'][_0x57b1('0x1a')]===undefined?!![]:![]:!![]})[_0x57b1('0xd')](function(_0x28d990){logger[_0x57b1('0xe')](_0x57b1('0x1b'),_0x548258);logger[_0x57b1('0x10')]('CreateVoiceAgentReport',_0x548258,JSON[_0x57b1('0x12')](_0x28d990));_0x17b74d(_0x28d990);})[_0x57b1('0x1c')](function(_0x5f13a8){logger[_0x57b1('0x13')](_0x57b1('0x1b'),_0x5f13a8[_0x57b1('0x16')],_0x548258);_0x1b234c(_0x712f66[_0x57b1('0x13')](0x1f4,_0x5f13a8[_0x57b1('0x16')]));});});};exports[_0x57b1('0x1d')]=function(_0x37cbec){var _0x59e66c=this;return new Promise(function(_0xdd8b4,_0x6dd94){return db[_0x57b1('0x17')][_0x57b1('0x1e')](_0x37cbec[_0x57b1('0x1f')],{'raw':_0x37cbec['options']?_0x37cbec[_0x57b1('0x19')][_0x57b1('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x37cbec[_0x57b1('0x19')]?_0x37cbec[_0x57b1('0x19')][_0x57b1('0x20')]||null:null,'attributes':_0x37cbec[_0x57b1('0x19')]?_0x37cbec['options'][_0x57b1('0x21')]||null:null,'limit':_0x37cbec[_0x57b1('0x19')]?_0x37cbec[_0x57b1('0x19')][_0x57b1('0x22')]||null:null})[_0x57b1('0xd')](function(_0x1cfe8b){logger[_0x57b1('0xe')](_0x57b1('0x1d'),_0x37cbec);logger[_0x57b1('0x10')](_0x57b1('0x1d'),_0x37cbec,JSON[_0x57b1('0x12')](_0x1cfe8b));_0xdd8b4(_0x1cfe8b);})[_0x57b1('0x1c')](function(_0x3ad7a7){logger[_0x57b1('0x13')](_0x57b1('0x1d'),_0x3ad7a7[_0x57b1('0x16')],_0x37cbec);_0x6dd94(_0x59e66c[_0x57b1('0x13')](0x1f4,_0x3ad7a7[_0x57b1('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 162a10c..1ebedbc 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 _0x0c02=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','isAuthenticated','index','/:id','show','post','delete','destroy','util','path','express','Router'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_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 +var _0x7da7=['Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','describe','/:id','post','create','update','delete','destroy','exports','multer','util','path'];(function(_0x1d9a5a,_0x53eb60){var _0x58b7bd=function(_0x141fd0){while(--_0x141fd0){_0x1d9a5a['push'](_0x1d9a5a['shift']());}};_0x58b7bd(++_0x53eb60);}(_0x7da7,0x10d));var _0x77da=function(_0x1fc4e2,_0x493c3b){_0x1fc4e2=_0x1fc4e2-0x0;var _0x2ba184=_0x7da7[_0x1fc4e2];return _0x2ba184;};'use strict';var multer=require(_0x77da('0x0'));var util=require(_0x77da('0x1'));var path=require(_0x77da('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x77da('0x3')]();var fs_extra=require(_0x77da('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x77da('0x5'));var config=require(_0x77da('0x6'));var controller=require('./voiceCallReport.controller');router[_0x77da('0x7')]('/',auth[_0x77da('0x8')](),controller['index']);router[_0x77da('0x7')]('/describe',auth[_0x77da('0x8')](),controller[_0x77da('0x9')]);router[_0x77da('0x7')](_0x77da('0xa'),auth[_0x77da('0x8')](),controller['show']);router[_0x77da('0xb')]('/',auth[_0x77da('0x8')](),controller[_0x77da('0xc')]);router['put'](_0x77da('0xa'),auth[_0x77da('0x8')](),controller[_0x77da('0xd')]);router[_0x77da('0xe')]('/:id',auth[_0x77da('0x8')](),controller[_0x77da('0xf')]);module[_0x77da('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 61102c8..f67af84 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 _0xe6e5=['internal','inbound-fax','outbound-fax','dialer','TEXT','DATE','INTEGER','sequelize','exports','STRING','ENUM','inbound'];(function(_0x1d7c83,_0x2d8f2d){var _0x283ef2=function(_0x68da53){while(--_0x68da53){_0x1d7c83['push'](_0x1d7c83['shift']());}};_0x283ef2(++_0x2d8f2d);}(_0xe6e5,0x1e7));var _0x5e6e=function(_0x5ddaac,_0x2697a8){_0x5ddaac=_0x5ddaac-0x0;var _0x2a9c58=_0xe6e5[_0x5ddaac];return _0x2a9c58;};'use strict';var Sequelize=require(_0x5e6e('0x0'));module[_0x5e6e('0x1')]={'uniqueid':{'type':Sequelize[_0x5e6e('0x2')]},'type':{'type':Sequelize[_0x5e6e('0x3')](_0x5e6e('0x4'),_0x5e6e('0x5'),'outbound',_0x5e6e('0x6'),_0x5e6e('0x7'),_0x5e6e('0x8'))},'tag':{'type':Sequelize[_0x5e6e('0x2')]},'accountcode':{'type':Sequelize[_0x5e6e('0x2')]},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize[_0x5e6e('0x2')]},'destinationcontext':{'type':Sequelize[_0x5e6e('0x2')]},'callerid':{'type':Sequelize[_0x5e6e('0x2')]},'channel':{'type':Sequelize[_0x5e6e('0x2')]},'destinationchannel':{'type':Sequelize[_0x5e6e('0x2')]},'lastapplication':{'type':Sequelize[_0x5e6e('0x2')]},'lastdata':{'type':Sequelize[_0x5e6e('0x9')]},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize[_0x5e6e('0xa')]},'answertime':{'type':Sequelize[_0x5e6e('0xa')]},'endtime':{'type':Sequelize[_0x5e6e('0xa')]},'duration':{'type':Sequelize[_0x5e6e('0xb')]},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0x5e6e('0xb')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x5e6e('0x2')]},'amaflags':{'type':Sequelize[_0x5e6e('0x2')]},'userfield':{'type':Sequelize[_0x5e6e('0x2')]},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x5e6e('0x2')]},'userThirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x5e6e('0x2')]},'prefix':{'type':Sequelize['STRING']},'routeid':{'type':Sequelize['INTEGER']},'sipcallid':{'type':Sequelize[_0x5e6e('0x2')]}}; \ No newline at end of file +var _0x1117=['DATE','INTEGER','sequelize','STRING','inbound','internal','outbound','inbound-fax','outbound-fax','dialer','TEXT'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x1117,0x18e));var _0x7111=function(_0x1dc539,_0x3658b8){_0x1dc539=_0x1dc539-0x0;var _0x1b7ffd=_0x1117[_0x1dc539];return _0x1b7ffd;};'use strict';var Sequelize=require(_0x7111('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x7111('0x1')]},'type':{'type':Sequelize['ENUM'](_0x7111('0x2'),_0x7111('0x3'),_0x7111('0x4'),_0x7111('0x5'),_0x7111('0x6'),_0x7111('0x7'))},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x7111('0x1')]},'source':{'type':Sequelize[_0x7111('0x1')]},'destination':{'type':Sequelize[_0x7111('0x1')]},'destinationcontext':{'type':Sequelize[_0x7111('0x1')]},'callerid':{'type':Sequelize[_0x7111('0x1')]},'channel':{'type':Sequelize[_0x7111('0x1')]},'destinationchannel':{'type':Sequelize['STRING']},'lastapplication':{'type':Sequelize[_0x7111('0x1')]},'lastdata':{'type':Sequelize[_0x7111('0x8')]},'starttime':{'type':Sequelize[_0x7111('0x9')]},'systemanswertime':{'type':Sequelize[_0x7111('0x9')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize['DATE']},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0x7111('0xa')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x7111('0x1')]},'userfield':{'type':Sequelize[_0x7111('0x1')]},'userDisposition':{'type':Sequelize[_0x7111('0x1')]},'userSecondDisposition':{'type':Sequelize[_0x7111('0x1')]},'userThirdDisposition':{'type':Sequelize[_0x7111('0x1')]},'note':{'type':Sequelize[_0x7111('0x1')]},'prefix':{'type':Sequelize['STRING']},'routeid':{'type':Sequelize[_0x7111('0xa')]},'sipcallid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 99591da..354806d 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 _0x0b0e=['bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','undefined','offset','limit','set','json','apply','reject','save','then','destroy','error','stack','name','index','map','VoiceCallReport','rawAttributes','fieldName','type','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','merge','where','VIRTUAL','options','count','includeAll','fullname','alias','User','findAll','rows','params','find','create','body','catch','describe','update','uniqueid','user','eml-format','zip-dir','request-promise','moment'];(function(_0xf0091f,_0x382a66){var _0x59ee21=function(_0x4cd74d){while(--_0x4cd74d){_0xf0091f['push'](_0xf0091f['shift']());}};_0x59ee21(++_0x382a66);}(_0x0b0e,0x187));var _0xe0b0=function(_0x32b542,_0x4512fa){_0x32b542=_0x32b542-0x0;var _0x554d54=_0x0b0e[_0x32b542];return _0x554d54;};'use strict';var emlformat=require(_0xe0b0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe0b0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe0b0('0x2'));var moment=require(_0xe0b0('0x3'));var BPromise=require(_0xe0b0('0x4'));var Mustache=require(_0xe0b0('0x5'));var util=require(_0xe0b0('0x6'));var path=require(_0xe0b0('0x7'));var sox=require(_0xe0b0('0x8'));var csv=require(_0xe0b0('0x9'));var ejs=require(_0xe0b0('0xa'));var fs=require('fs');var fs_extra=require(_0xe0b0('0xb'));var _=require(_0xe0b0('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe0b0('0xd'));var deskjs=require(_0xe0b0('0xe'));var toCsv=require(_0xe0b0('0x9'));var querystring=require(_0xe0b0('0xf'));var Papa=require('papaparse');var Redis=require(_0xe0b0('0x10'));var authService=require(_0xe0b0('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xe0b0('0x12'));var hardwareService=require(_0xe0b0('0x13'));var logger=require('../../config/logger')(_0xe0b0('0x14'));var utils=require(_0xe0b0('0x15'));var config=require(_0xe0b0('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xe0b0('0x17'))['db'];function respondWithStatusCode(_0x1c358a,_0x3cc19a){_0x3cc19a=_0x3cc19a||0xcc;return function(_0x45f914){if(_0x45f914){return _0x1c358a[_0xe0b0('0x18')](_0x3cc19a);}return _0x1c358a['status'](_0x3cc19a)[_0xe0b0('0x19')]();};}function respondWithResult(_0x154de6,_0x743318){_0x743318=_0x743318||0xc8;return function(_0x24babd){if(_0x24babd){return _0x154de6[_0xe0b0('0x1a')](_0x743318)['json'](_0x24babd);}};}function respondWithFilteredResult(_0x41a7e2,_0x5adb01){return function(_0x35cb40){if(_0x35cb40){var _0xadee6e=typeof _0x5adb01['offset']===_0xe0b0('0x1b')&&typeof _0x5adb01['limit']===_0xe0b0('0x1b');var _0x100204=_0x35cb40['count'];var _0x54a3eb=_0xadee6e?0x0:_0x5adb01[_0xe0b0('0x1c')];var _0x50a441=_0xadee6e?_0x35cb40['count']:_0x5adb01['offset']+_0x5adb01[_0xe0b0('0x1d')];var _0x50fa4a;if(_0x50a441>=_0x100204){_0x50a441=_0x100204;_0x50fa4a=0xc8;}else{_0x50fa4a=0xce;}_0x41a7e2['status'](_0x50fa4a);return _0x41a7e2[_0xe0b0('0x1e')]('Content-Range',_0x54a3eb+'-'+_0x50a441+'/'+_0x100204)[_0xe0b0('0x1f')](_0x35cb40);}return null;};}function patchUpdates(_0x5dba2f){return function(_0x2c84cc){try{jsonpatch[_0xe0b0('0x20')](_0x2c84cc,_0x5dba2f,!![]);}catch(_0x3e10b3){return BPromise[_0xe0b0('0x21')](_0x3e10b3);}return _0x2c84cc[_0xe0b0('0x22')]();};}function saveUpdates(_0x58b804,_0x4cae54){return function(_0x2fa820){if(_0x2fa820){return _0x2fa820['update'](_0x58b804)[_0xe0b0('0x23')](function(_0x31b5f8){return _0x31b5f8;});}return null;};}function removeEntity(_0x513e63,_0x170ad8){return function(_0x503883){if(_0x503883){return _0x503883[_0xe0b0('0x24')]()['then'](function(){_0x513e63[_0xe0b0('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e5c88,_0x4de537){return function(_0x4700cc){if(!_0x4700cc){_0x3e5c88['sendStatus'](0x194);}return _0x4700cc;};}function handleError(_0x3c221d,_0x5c5317){_0x5c5317=_0x5c5317||0x1f4;return function(_0x362aba){logger[_0xe0b0('0x25')](_0x362aba[_0xe0b0('0x26')]);if(_0x362aba[_0xe0b0('0x27')]){delete _0x362aba[_0xe0b0('0x27')];}_0x3c221d[_0xe0b0('0x1a')](_0x5c5317)['send'](_0x362aba);};}exports[_0xe0b0('0x28')]=function(_0x1b8aa8,_0x5b7a64){var _0x15e13b={},_0x419b1f={},_0x36d137={'count':0x0,'rows':[]};var _0x1d5759=_[_0xe0b0('0x29')](db[_0xe0b0('0x2a')][_0xe0b0('0x2b')],function(_0x4fb3b7){return{'name':_0x4fb3b7[_0xe0b0('0x2c')],'type':_0x4fb3b7[_0xe0b0('0x2d')]['key']};});_0x419b1f['model']=_[_0xe0b0('0x29')](_0x1d5759,_0xe0b0('0x27'));_0x419b1f[_0xe0b0('0x2e')]=_[_0xe0b0('0x2f')](_0x1b8aa8[_0xe0b0('0x2e')]);_0x419b1f['filters']=_[_0xe0b0('0x30')](_0x419b1f[_0xe0b0('0x31')],_0x419b1f[_0xe0b0('0x2e')]);_0x15e13b[_0xe0b0('0x32')]=_[_0xe0b0('0x30')](_0x419b1f['model'],qs[_0xe0b0('0x33')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x33')]));_0x15e13b[_0xe0b0('0x32')]=_0x15e13b[_0xe0b0('0x32')][_0xe0b0('0x34')]?_0x15e13b[_0xe0b0('0x32')]:_0x419b1f[_0xe0b0('0x31')];if(!_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x35')](_0xe0b0('0x36'))){_0x15e13b[_0xe0b0('0x1d')]=qs[_0xe0b0('0x1d')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x1d')]);_0x15e13b['offset']=qs[_0xe0b0('0x1c')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x1c')]);}_0x15e13b[_0xe0b0('0x37')]=qs[_0xe0b0('0x38')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x38')]);_0x15e13b['where']=qs['filters'](_['pick'](_0x1b8aa8['query'],_0x419b1f[_0xe0b0('0x39')]),_0x1d5759);if(_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x3a')]){_0x15e13b['where']=_[_0xe0b0('0x3b')](_0x15e13b[_0xe0b0('0x3c')],{'$or':_[_0xe0b0('0x29')](_0x1d5759,function(_0x297c64){if(_0x297c64['type']!==_0xe0b0('0x3d')){var _0xfbb61d={};_0xfbb61d[_0x297c64[_0xe0b0('0x27')]]={'$like':'%'+_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x3a')]+'%'};return _0xfbb61d;}})});}_0x15e13b=_[_0xe0b0('0x3b')]({},_0x15e13b,_0x1b8aa8[_0xe0b0('0x3e')]);var _0x115a69={'where':_0x15e13b[_0xe0b0('0x3c')]};return db['VoiceCallReport'][_0xe0b0('0x3f')](_0x115a69)['then'](function(_0x34178d){_0x36d137[_0xe0b0('0x3f')]=_0x34178d;if(_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x40')]){_0x15e13b['include']=[{'attributes':['id',_0xe0b0('0x27'),_0xe0b0('0x41'),_0xe0b0('0x42')],'model':db[_0xe0b0('0x43')],'as':_0xe0b0('0x43')}];}return db[_0xe0b0('0x2a')][_0xe0b0('0x44')](_0x15e13b);})[_0xe0b0('0x23')](function(_0x52ffe4){_0x36d137[_0xe0b0('0x45')]=_0x52ffe4;return _0x36d137;})[_0xe0b0('0x23')](respondWithFilteredResult(_0x5b7a64,_0x15e13b))['catch'](handleError(_0x5b7a64,null));};exports['show']=function(_0x327fb4,_0x247f8d){var _0x56e7df={'raw':!![],'where':{'id':_0x327fb4[_0xe0b0('0x46')]['id']}},_0x18a59d={};_0x18a59d[_0xe0b0('0x31')]=_[_0xe0b0('0x2f')](db[_0xe0b0('0x2a')]['rawAttributes']);_0x18a59d['query']=_['keys'](_0x327fb4[_0xe0b0('0x2e')]);_0x18a59d[_0xe0b0('0x39')]=_['intersection'](_0x18a59d[_0xe0b0('0x31')],_0x18a59d[_0xe0b0('0x2e')]);_0x56e7df[_0xe0b0('0x32')]=_[_0xe0b0('0x30')](_0x18a59d[_0xe0b0('0x31')],qs['fields'](_0x327fb4['query'][_0xe0b0('0x33')]));_0x56e7df[_0xe0b0('0x32')]=_0x56e7df[_0xe0b0('0x32')][_0xe0b0('0x34')]?_0x56e7df[_0xe0b0('0x32')]:_0x18a59d['model'];if(_0x327fb4[_0xe0b0('0x2e')][_0xe0b0('0x40')]){_0x56e7df['include']=[{'all':!![]}];}_0x56e7df=_['merge']({},_0x56e7df,_0x327fb4['options']);return db[_0xe0b0('0x2a')][_0xe0b0('0x47')](_0x56e7df)[_0xe0b0('0x23')](handleEntityNotFound(_0x247f8d,null))[_0xe0b0('0x23')](respondWithResult(_0x247f8d,null))['catch'](handleError(_0x247f8d,null));};exports[_0xe0b0('0x48')]=function(_0x87d8f3,_0x483f12){return db['VoiceCallReport'][_0xe0b0('0x48')](_0x87d8f3[_0xe0b0('0x49')],{})['then'](respondWithResult(_0x483f12,0xc9))[_0xe0b0('0x4a')](handleError(_0x483f12,null));};exports[_0xe0b0('0x24')]=function(_0x504284,_0x5cb2b6){return db[_0xe0b0('0x2a')]['find']({'where':{'id':_0x504284[_0xe0b0('0x46')]['id']}})[_0xe0b0('0x23')](handleEntityNotFound(_0x5cb2b6,null))[_0xe0b0('0x23')](removeEntity(_0x5cb2b6,null))[_0xe0b0('0x4a')](handleError(_0x5cb2b6,null));};exports[_0xe0b0('0x4b')]=function(_0xf9e694,_0x5f5486){return db['VoiceCallReport'][_0xe0b0('0x4b')]()['then'](respondWithResult(_0x5f5486,null))['catch'](handleError(_0x5f5486,null));};exports[_0xe0b0('0x4c')]=function(_0x222174,_0x54cf7b){if(_0x222174['body'][_0xe0b0('0x4d')]){delete _0x222174[_0xe0b0('0x49')][_0xe0b0('0x4d')];}return db[_0xe0b0('0x2a')][_0xe0b0('0x47')]({'where':{'uniqueid':_0x222174[_0xe0b0('0x46')]['id'],'UserId':{'$or':[null,_0x222174[_0xe0b0('0x4e')]['id']]}}})['then'](handleEntityNotFound(_0x54cf7b,null))[_0xe0b0('0x23')](saveUpdates(_0x222174['body'],null))[_0xe0b0('0x23')](respondWithResult(_0x54cf7b,null))['catch'](handleError(_0x54cf7b,null));}; \ No newline at end of file +var _0x5f2f=['stack','name','send','index','VoiceCallReport','rawAttributes','fieldName','type','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','merge','where','options','includeAll','include','fullname','alias','User','findAll','catch','params','keys','find','create','body','destroy','describe','update','uniqueid','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then'];(function(_0x263a2f,_0x1e81e3){var _0x8020e8=function(_0x39f91a){while(--_0x39f91a){_0x263a2f['push'](_0x263a2f['shift']());}};_0x8020e8(++_0x1e81e3);}(_0x5f2f,0x73));var _0xf5f2=function(_0x50e36b,_0x3bd1b2){_0x50e36b=_0x50e36b-0x0;var _0x27d367=_0x5f2f[_0x50e36b];return _0x27d367;};'use strict';var emlformat=require(_0xf5f2('0x0'));var rimraf=require(_0xf5f2('0x1'));var zipdir=require(_0xf5f2('0x2'));var jsonpatch=require(_0xf5f2('0x3'));var rp=require(_0xf5f2('0x4'));var moment=require(_0xf5f2('0x5'));var BPromise=require(_0xf5f2('0x6'));var Mustache=require(_0xf5f2('0x7'));var util=require('util');var path=require('path');var sox=require(_0xf5f2('0x8'));var csv=require(_0xf5f2('0x9'));var ejs=require(_0xf5f2('0xa'));var fs=require('fs');var fs_extra=require(_0xf5f2('0xb'));var _=require(_0xf5f2('0xc'));var squel=require(_0xf5f2('0xd'));var crypto=require('crypto');var jsforce=require(_0xf5f2('0xe'));var deskjs=require(_0xf5f2('0xf'));var toCsv=require(_0xf5f2('0x9'));var querystring=require('querystring');var Papa=require(_0xf5f2('0x10'));var Redis=require(_0xf5f2('0x11'));var authService=require(_0xf5f2('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf5f2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf5f2('0x14'));var utils=require(_0xf5f2('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf5f2('0x16'));var db=require(_0xf5f2('0x17'))['db'];function respondWithStatusCode(_0x331482,_0x3f2997){_0x3f2997=_0x3f2997||0xcc;return function(_0x59bb6c){if(_0x59bb6c){return _0x331482[_0xf5f2('0x18')](_0x3f2997);}return _0x331482['status'](_0x3f2997)[_0xf5f2('0x19')]();};}function respondWithResult(_0xea612c,_0x269909){_0x269909=_0x269909||0xc8;return function(_0x1c1a5c){if(_0x1c1a5c){return _0xea612c[_0xf5f2('0x1a')](_0x269909)['json'](_0x1c1a5c);}};}function respondWithFilteredResult(_0xafe430,_0x286197){return function(_0x17d656){if(_0x17d656){var _0x1b6dd2=typeof _0x286197[_0xf5f2('0x1b')]===_0xf5f2('0x1c')&&typeof _0x286197[_0xf5f2('0x1d')]===_0xf5f2('0x1c');var _0x11f702=_0x17d656[_0xf5f2('0x1e')];var _0x20fccd=_0x1b6dd2?0x0:_0x286197[_0xf5f2('0x1b')];var _0x4ff59b=_0x1b6dd2?_0x17d656[_0xf5f2('0x1e')]:_0x286197[_0xf5f2('0x1b')]+_0x286197[_0xf5f2('0x1d')];var _0x1bf655;if(_0x4ff59b>=_0x11f702){_0x4ff59b=_0x11f702;_0x1bf655=0xc8;}else{_0x1bf655=0xce;}_0xafe430['status'](_0x1bf655);return _0xafe430[_0xf5f2('0x1f')](_0xf5f2('0x20'),_0x20fccd+'-'+_0x4ff59b+'/'+_0x11f702)['json'](_0x17d656);}return null;};}function patchUpdates(_0x47acfc){return function(_0x2d2805){try{jsonpatch[_0xf5f2('0x21')](_0x2d2805,_0x47acfc,!![]);}catch(_0x4ae323){return BPromise[_0xf5f2('0x22')](_0x4ae323);}return _0x2d2805[_0xf5f2('0x23')]();};}function saveUpdates(_0x39e44a,_0x39c024){return function(_0x36f1cb){if(_0x36f1cb){return _0x36f1cb['update'](_0x39e44a)[_0xf5f2('0x24')](function(_0x4669a6){return _0x4669a6;});}return null;};}function removeEntity(_0x4e8bda,_0x2833fe){return function(_0x287ad5){if(_0x287ad5){return _0x287ad5['destroy']()['then'](function(){_0x4e8bda[_0xf5f2('0x1a')](0xcc)[_0xf5f2('0x19')]();});}};}function handleEntityNotFound(_0x13da6f,_0x1a5bb3){return function(_0xf6c58d){if(!_0xf6c58d){_0x13da6f[_0xf5f2('0x18')](0x194);}return _0xf6c58d;};}function handleError(_0x13a3be,_0x281ec8){_0x281ec8=_0x281ec8||0x1f4;return function(_0x294414){logger['error'](_0x294414[_0xf5f2('0x25')]);if(_0x294414[_0xf5f2('0x26')]){delete _0x294414[_0xf5f2('0x26')];}_0x13a3be[_0xf5f2('0x1a')](_0x281ec8)[_0xf5f2('0x27')](_0x294414);};}exports[_0xf5f2('0x28')]=function(_0x5b6672,_0x53cb96){var _0x22c826={},_0x14c829={},_0x11c771={'count':0x0,'rows':[]};var _0x5027ab=_['map'](db[_0xf5f2('0x29')][_0xf5f2('0x2a')],function(_0x17394a){return{'name':_0x17394a[_0xf5f2('0x2b')],'type':_0x17394a[_0xf5f2('0x2c')]['key']};});_0x14c829['model']=_[_0xf5f2('0x2d')](_0x5027ab,'name');_0x14c829[_0xf5f2('0x2e')]=_['keys'](_0x5b6672[_0xf5f2('0x2e')]);_0x14c829[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x14c829[_0xf5f2('0x31')],_0x14c829[_0xf5f2('0x2e')]);_0x22c826[_0xf5f2('0x32')]=_[_0xf5f2('0x30')](_0x14c829[_0xf5f2('0x31')],qs['fields'](_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x33')]));_0x22c826[_0xf5f2('0x32')]=_0x22c826[_0xf5f2('0x32')][_0xf5f2('0x34')]?_0x22c826[_0xf5f2('0x32')]:_0x14c829[_0xf5f2('0x31')];if(!_0x5b6672['query'][_0xf5f2('0x35')](_0xf5f2('0x36'))){_0x22c826['limit']=qs[_0xf5f2('0x1d')](_0x5b6672['query'][_0xf5f2('0x1d')]);_0x22c826[_0xf5f2('0x1b')]=qs[_0xf5f2('0x1b')](_0x5b6672[_0xf5f2('0x2e')]['offset']);}_0x22c826['order']=qs[_0xf5f2('0x37')](_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x37')]);_0x22c826['where']=qs[_0xf5f2('0x2f')](_['pick'](_0x5b6672[_0xf5f2('0x2e')],_0x14c829['filters']),_0x5027ab);if(_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x38')]){_0x22c826['where']=_[_0xf5f2('0x39')](_0x22c826[_0xf5f2('0x3a')],{'$or':_[_0xf5f2('0x2d')](_0x5027ab,function(_0x35f738){if(_0x35f738['type']!=='VIRTUAL'){var _0x3d328f={};_0x3d328f[_0x35f738[_0xf5f2('0x26')]]={'$like':'%'+_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x38')]+'%'};return _0x3d328f;}})});}_0x22c826=_[_0xf5f2('0x39')]({},_0x22c826,_0x5b6672[_0xf5f2('0x3b')]);var _0x2bc20e={'where':_0x22c826['where']};return db[_0xf5f2('0x29')][_0xf5f2('0x1e')](_0x2bc20e)['then'](function(_0xc6a1ae){_0x11c771[_0xf5f2('0x1e')]=_0xc6a1ae;if(_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x3c')]){_0x22c826[_0xf5f2('0x3d')]=[{'attributes':['id',_0xf5f2('0x26'),_0xf5f2('0x3e'),_0xf5f2('0x3f')],'model':db['User'],'as':_0xf5f2('0x40')}];}return db[_0xf5f2('0x29')][_0xf5f2('0x41')](_0x22c826);})['then'](function(_0x509dbc){_0x11c771['rows']=_0x509dbc;return _0x11c771;})[_0xf5f2('0x24')](respondWithFilteredResult(_0x53cb96,_0x22c826))[_0xf5f2('0x42')](handleError(_0x53cb96,null));};exports['show']=function(_0x106272,_0xeed03d){var _0x28e33f={'raw':!![],'where':{'id':_0x106272[_0xf5f2('0x43')]['id']}},_0x31f86c={};_0x31f86c[_0xf5f2('0x31')]=_[_0xf5f2('0x44')](db[_0xf5f2('0x29')][_0xf5f2('0x2a')]);_0x31f86c[_0xf5f2('0x2e')]=_[_0xf5f2('0x44')](_0x106272[_0xf5f2('0x2e')]);_0x31f86c[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x31f86c['model'],_0x31f86c[_0xf5f2('0x2e')]);_0x28e33f['attributes']=_[_0xf5f2('0x30')](_0x31f86c[_0xf5f2('0x31')],qs[_0xf5f2('0x33')](_0x106272[_0xf5f2('0x2e')][_0xf5f2('0x33')]));_0x28e33f[_0xf5f2('0x32')]=_0x28e33f['attributes'][_0xf5f2('0x34')]?_0x28e33f[_0xf5f2('0x32')]:_0x31f86c[_0xf5f2('0x31')];if(_0x106272[_0xf5f2('0x2e')][_0xf5f2('0x3c')]){_0x28e33f[_0xf5f2('0x3d')]=[{'all':!![]}];}_0x28e33f=_[_0xf5f2('0x39')]({},_0x28e33f,_0x106272[_0xf5f2('0x3b')]);return db['VoiceCallReport'][_0xf5f2('0x45')](_0x28e33f)[_0xf5f2('0x24')](handleEntityNotFound(_0xeed03d,null))[_0xf5f2('0x24')](respondWithResult(_0xeed03d,null))['catch'](handleError(_0xeed03d,null));};exports[_0xf5f2('0x46')]=function(_0xc91b64,_0x3179a9){return db['VoiceCallReport']['create'](_0xc91b64[_0xf5f2('0x47')],{})[_0xf5f2('0x24')](respondWithResult(_0x3179a9,0xc9))['catch'](handleError(_0x3179a9,null));};exports[_0xf5f2('0x48')]=function(_0x533cca,_0x740321){return db['VoiceCallReport'][_0xf5f2('0x45')]({'where':{'id':_0x533cca['params']['id']}})[_0xf5f2('0x24')](handleEntityNotFound(_0x740321,null))[_0xf5f2('0x24')](removeEntity(_0x740321,null))[_0xf5f2('0x42')](handleError(_0x740321,null));};exports[_0xf5f2('0x49')]=function(_0x4fa738,_0x3154c1){return db[_0xf5f2('0x29')]['describe']()['then'](respondWithResult(_0x3154c1,null))[_0xf5f2('0x42')](handleError(_0x3154c1,null));};exports[_0xf5f2('0x4a')]=function(_0x57782c,_0x22b645){if(_0x57782c[_0xf5f2('0x47')][_0xf5f2('0x4b')]){delete _0x57782c[_0xf5f2('0x47')]['uniqueid'];}return db['VoiceCallReport'][_0xf5f2('0x45')]({'where':{'uniqueid':_0x57782c[_0xf5f2('0x43')]['id'],'UserId':{'$or':[null,_0x57782c['user']['id']]}}})[_0xf5f2('0x24')](handleEntityNotFound(_0x22b645,null))[_0xf5f2('0x24')](saveUpdates(_0x57782c[_0xf5f2('0x47')],null))[_0xf5f2('0x24')](respondWithResult(_0x22b645,null))[_0xf5f2('0x42')](handleError(_0x22b645,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 2c167fc..a466830 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 _0x5308=['VoiceCallReport','report_call','uniqueid','util','api','moment','bluebird','request-promise','path','rimraf','exports'];(function(_0x41232b,_0x17850d){var _0x84762b=function(_0x11cbee){while(--_0x11cbee){_0x41232b['push'](_0x41232b['shift']());}};_0x84762b(++_0x17850d);}(_0x5308,0xd4));var _0x8530=function(_0x44dba1,_0x270ad5){_0x44dba1=_0x44dba1-0x0;var _0x2fbd3f=_0x5308[_0x44dba1];return _0x2fbd3f;};'use strict';var _=require('lodash');var util=require(_0x8530('0x0'));var logger=require('../../config/logger')(_0x8530('0x1'));var moment=require(_0x8530('0x2'));var BPromise=require(_0x8530('0x3'));var rp=require(_0x8530('0x4'));var fs=require('fs');var path=require(_0x8530('0x5'));var rimraf=require(_0x8530('0x6'));var config=require('../../config/environment');var attributes=require('./voiceCallReport.attributes');module[_0x8530('0x7')]=function(_0x47ad4e,_0x104628){return _0x47ad4e['define'](_0x8530('0x8'),attributes,{'tableName':_0x8530('0x9'),'paranoid':![],'indexes':[{'fields':[_0x8530('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2526=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceCallReport.attributes','exports','define','VoiceCallReport','uniqueid'];(function(_0x395bba,_0x470d8a){var _0x5b5478=function(_0x216a5d){while(--_0x216a5d){_0x395bba['push'](_0x395bba['shift']());}};_0x5b5478(++_0x470d8a);}(_0x2526,0x1dc));var _0x6252=function(_0x204c96,_0x8dbef7){_0x204c96=_0x204c96-0x0;var _0x10e94e=_0x2526[_0x204c96];return _0x10e94e;};'use strict';var _=require('lodash');var util=require(_0x6252('0x0'));var logger=require(_0x6252('0x1'))(_0x6252('0x2'));var moment=require(_0x6252('0x3'));var BPromise=require(_0x6252('0x4'));var rp=require(_0x6252('0x5'));var fs=require('fs');var path=require(_0x6252('0x6'));var rimraf=require(_0x6252('0x7'));var config=require(_0x6252('0x8'));var attributes=require(_0x6252('0x9'));module[_0x6252('0xa')]=function(_0x206c23,_0x2de036){return _0x206c23[_0x6252('0xb')](_0x6252('0xc'),attributes,{'tableName':'report_call','paranoid':![],'indexes':[{'fields':[_0x6252('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 2219cb8..2a773db 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 _0xa618=['body','stringify','UpdateVoiceCallReport','update','lodash','util','moment','../../config/utils','../../config/logger','jayson/promise','client','request','info','request\x20sent','debug','error','code','VoiceCallReport,\x20%s,\x20%s','message','GetVoiceCallReport','findAll','options','raw','where','limit','include','attributes','model','map','then','catch','CreateVoiceCallReport','VoiceCallReport','create'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa618,0x114));var _0x8a61=function(_0x2190ee,_0x546dff){_0x2190ee=_0x2190ee-0x0;var _0x3b0b09=_0xa618[_0x2190ee];return _0x3b0b09;};'use strict';var _=require(_0x8a61('0x0'));var util=require(_0x8a61('0x1'));var moment=require(_0x8a61('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8a61('0x3'));var logger=require(_0x8a61('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x8a61('0x5'));var client=jayson[_0x8a61('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b48c4,_0x26aeeb,_0x414347){return new BPromise(function(_0x37dfec,_0x292393){return client[_0x8a61('0x7')](_0x3b48c4,_0x414347)['then'](function(_0x26acd9){logger[_0x8a61('0x8')]('VoiceCallReport,\x20%s,\x20%s',_0x26aeeb,_0x8a61('0x9'));logger[_0x8a61('0xa')]('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0x26aeeb,_0x8a61('0x9'),JSON['stringify'](_0x26acd9));if(_0x26acd9[_0x8a61('0xb')]){if(_0x26acd9[_0x8a61('0xb')][_0x8a61('0xc')]===0x1f4){logger[_0x8a61('0xb')](_0x8a61('0xd'),_0x26aeeb,_0x26acd9[_0x8a61('0xb')][_0x8a61('0xe')]);return _0x292393(_0x26acd9['error']['message']);}logger[_0x8a61('0xb')](_0x8a61('0xd'),_0x26aeeb,_0x26acd9[_0x8a61('0xb')][_0x8a61('0xe')]);return _0x37dfec(_0x26acd9[_0x8a61('0xb')][_0x8a61('0xe')]);}else{logger[_0x8a61('0x8')]('VoiceCallReport,\x20%s,\x20%s',_0x26aeeb,_0x8a61('0x9'));_0x37dfec(_0x26acd9['result'][_0x8a61('0xe')]);}})['catch'](function(_0x545ed8){logger[_0x8a61('0xb')]('VoiceCallReport,\x20%s,\x20%s',_0x26aeeb,_0x545ed8);_0x292393(_0x545ed8);});});}exports[_0x8a61('0xf')]=function(_0x1dbc49){var _0xfdbfaa=this;return new Promise(function(_0x4df52b,_0x10c70f){return db['VoiceCallReport'][_0x8a61('0x10')]({'raw':_0x1dbc49[_0x8a61('0x11')]?_0x1dbc49['options'][_0x8a61('0x12')]===undefined?!![]:![]:!![],'where':_0x1dbc49[_0x8a61('0x11')]?_0x1dbc49['options'][_0x8a61('0x13')]||null:null,'attributes':_0x1dbc49[_0x8a61('0x11')]?_0x1dbc49[_0x8a61('0x11')]['attributes']||null:null,'limit':_0x1dbc49['options']?_0x1dbc49[_0x8a61('0x11')][_0x8a61('0x14')]||null:null,'include':_0x1dbc49[_0x8a61('0x11')]?_0x1dbc49[_0x8a61('0x11')][_0x8a61('0x15')]?_['map'](_0x1dbc49[_0x8a61('0x11')]['include'],function(_0x28ed6c){return{'model':db[_0x28ed6c['model']],'as':_0x28ed6c['as'],'attributes':_0x28ed6c[_0x8a61('0x16')],'include':_0x28ed6c['include']?_['map'](_0x28ed6c[_0x8a61('0x15')],function(_0x4c3000){return{'model':db[_0x4c3000[_0x8a61('0x17')]],'as':_0x4c3000['as'],'attributes':_0x4c3000[_0x8a61('0x16')],'include':_0x4c3000[_0x8a61('0x15')]?_[_0x8a61('0x18')](_0x4c3000['include'],function(_0xc0b101){return{'model':db[_0xc0b101[_0x8a61('0x17')]],'as':_0xc0b101['as'],'attributes':_0xc0b101[_0x8a61('0x16')]};}):[]};}):[]};}):[]:[]})[_0x8a61('0x19')](function(_0x55b03b){logger['info'](_0x8a61('0xf'),_0x1dbc49);logger[_0x8a61('0xa')]('GetVoiceCallReport',_0x1dbc49,JSON['stringify'](_0x55b03b));_0x4df52b(_0x55b03b);})[_0x8a61('0x1a')](function(_0x23635c){logger[_0x8a61('0xb')](_0x8a61('0xf'),_0x23635c[_0x8a61('0xe')],_0x1dbc49);_0x10c70f(_0xfdbfaa['error'](0x1f4,_0x23635c[_0x8a61('0xe')]));});});};exports[_0x8a61('0x1b')]=function(_0x3aeaba){var _0x4e7f2c=this;return new Promise(function(_0x129eaa,_0x59c10b){return db[_0x8a61('0x1c')][_0x8a61('0x1d')](_0x3aeaba[_0x8a61('0x1e')],{'raw':_0x3aeaba[_0x8a61('0x11')]?_0x3aeaba['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x37bc4d){logger[_0x8a61('0x8')]('CreateVoiceCallReport',_0x3aeaba);logger['debug'](_0x8a61('0x1b'),_0x3aeaba,JSON[_0x8a61('0x1f')](_0x37bc4d));_0x129eaa(_0x37bc4d);})[_0x8a61('0x1a')](function(_0x4621c9){logger['error'](_0x8a61('0x1b'),_0x4621c9[_0x8a61('0xe')],_0x3aeaba);_0x59c10b(_0x4e7f2c[_0x8a61('0xb')](0x1f4,_0x4621c9[_0x8a61('0xe')]));});});};exports[_0x8a61('0x20')]=function(_0x1e16af){var _0x55876a=this;return new Promise(function(_0xfaa564,_0x15e796){return db[_0x8a61('0x1c')][_0x8a61('0x21')](_0x1e16af[_0x8a61('0x1e')],{'raw':_0x1e16af[_0x8a61('0x11')]?_0x1e16af[_0x8a61('0x11')][_0x8a61('0x12')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1e16af[_0x8a61('0x11')]?_0x1e16af[_0x8a61('0x11')][_0x8a61('0x13')]||null:null,'attributes':_0x1e16af[_0x8a61('0x11')]?_0x1e16af[_0x8a61('0x11')][_0x8a61('0x16')]||null:null,'limit':_0x1e16af[_0x8a61('0x11')]?_0x1e16af[_0x8a61('0x11')][_0x8a61('0x14')]||null:null})[_0x8a61('0x19')](function(_0x4472e9){logger[_0x8a61('0x8')](_0x8a61('0x20'),_0x1e16af);logger[_0x8a61('0xa')]('UpdateVoiceCallReport',_0x1e16af,JSON[_0x8a61('0x1f')](_0x4472e9));_0xfaa564(_0x4472e9);})['catch'](function(_0x375aca){logger[_0x8a61('0xb')](_0x8a61('0x20'),_0x375aca['message'],_0x1e16af);_0x15e796(_0x55876a[_0x8a61('0xb')](0x1f4,_0x375aca[_0x8a61('0xe')]));});});}; \ No newline at end of file +var _0x7851=['error','message','info','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','where','attributes','include','map','model','CreateVoiceCallReport','create','body','raw','UpdateVoiceCallReport','update','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','request','then','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x31acd2,_0x3c0a9f){var _0xc8118=function(_0x446952){while(--_0x446952){_0x31acd2['push'](_0x31acd2['shift']());}};_0xc8118(++_0x3c0a9f);}(_0x7851,0x194));var _0x1785=function(_0x4a1077,_0x2106b5){_0x4a1077=_0x4a1077-0x0;var _0x380332=_0x7851[_0x4a1077];return _0x380332;};'use strict';var _=require('lodash');var util=require(_0x1785('0x0'));var moment=require(_0x1785('0x1'));var BPromise=require(_0x1785('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1785('0x3'));var db=require(_0x1785('0x4'))['db'];var utils=require(_0x1785('0x5'));var logger=require('../../config/logger')(_0x1785('0x6'));var config=require('../../config/environment');var jayson=require(_0x1785('0x7'));var client=jayson['client'][_0x1785('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4e9987,_0x1476e2,_0x4d9ed3){return new BPromise(function(_0x5f4e02,_0x459c89){return client[_0x1785('0x9')](_0x4e9987,_0x4d9ed3)[_0x1785('0xa')](function(_0x518e89){logger['info'](_0x1785('0xb'),_0x1476e2,_0x1785('0xc'));logger[_0x1785('0xd')](_0x1785('0xe'),_0x1476e2,'request\x20sent',JSON[_0x1785('0xf')](_0x518e89));if(_0x518e89[_0x1785('0x10')]){if(_0x518e89[_0x1785('0x10')]['code']===0x1f4){logger[_0x1785('0x10')](_0x1785('0xb'),_0x1476e2,_0x518e89['error'][_0x1785('0x11')]);return _0x459c89(_0x518e89[_0x1785('0x10')][_0x1785('0x11')]);}logger[_0x1785('0x10')](_0x1785('0xb'),_0x1476e2,_0x518e89[_0x1785('0x10')][_0x1785('0x11')]);return _0x5f4e02(_0x518e89[_0x1785('0x10')][_0x1785('0x11')]);}else{logger[_0x1785('0x12')](_0x1785('0xb'),_0x1476e2,_0x1785('0xc'));_0x5f4e02(_0x518e89['result'][_0x1785('0x11')]);}})[_0x1785('0x13')](function(_0x3015b5){logger[_0x1785('0x10')](_0x1785('0xb'),_0x1476e2,_0x3015b5);_0x459c89(_0x3015b5);});});}exports[_0x1785('0x14')]=function(_0x2462a5){var _0x442be4=this;return new Promise(function(_0x4f0359,_0x1b700f){return db[_0x1785('0x15')][_0x1785('0x16')]({'raw':_0x2462a5[_0x1785('0x17')]?_0x2462a5[_0x1785('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x2462a5[_0x1785('0x17')]?_0x2462a5[_0x1785('0x17')][_0x1785('0x18')]||null:null,'attributes':_0x2462a5[_0x1785('0x17')]?_0x2462a5[_0x1785('0x17')][_0x1785('0x19')]||null:null,'limit':_0x2462a5[_0x1785('0x17')]?_0x2462a5['options']['limit']||null:null,'include':_0x2462a5[_0x1785('0x17')]?_0x2462a5[_0x1785('0x17')][_0x1785('0x1a')]?_[_0x1785('0x1b')](_0x2462a5[_0x1785('0x17')][_0x1785('0x1a')],function(_0x4327d0){return{'model':db[_0x4327d0[_0x1785('0x1c')]],'as':_0x4327d0['as'],'attributes':_0x4327d0['attributes'],'include':_0x4327d0[_0x1785('0x1a')]?_[_0x1785('0x1b')](_0x4327d0['include'],function(_0x4f525f){return{'model':db[_0x4f525f['model']],'as':_0x4f525f['as'],'attributes':_0x4f525f[_0x1785('0x19')],'include':_0x4f525f[_0x1785('0x1a')]?_['map'](_0x4f525f[_0x1785('0x1a')],function(_0x56cd54){return{'model':db[_0x56cd54[_0x1785('0x1c')]],'as':_0x56cd54['as'],'attributes':_0x56cd54['attributes']};}):[]};}):[]};}):[]:[]})[_0x1785('0xa')](function(_0x22b6cf){logger[_0x1785('0x12')](_0x1785('0x14'),_0x2462a5);logger['debug']('GetVoiceCallReport',_0x2462a5,JSON[_0x1785('0xf')](_0x22b6cf));_0x4f0359(_0x22b6cf);})['catch'](function(_0x5d1646){logger['error'](_0x1785('0x14'),_0x5d1646[_0x1785('0x11')],_0x2462a5);_0x1b700f(_0x442be4[_0x1785('0x10')](0x1f4,_0x5d1646[_0x1785('0x11')]));});});};exports[_0x1785('0x1d')]=function(_0x121bb6){var _0x2dc499=this;return new Promise(function(_0x1df713,_0x59751e){return db[_0x1785('0x15')][_0x1785('0x1e')](_0x121bb6[_0x1785('0x1f')],{'raw':_0x121bb6['options']?_0x121bb6['options'][_0x1785('0x20')]===undefined?!![]:![]:!![]})[_0x1785('0xa')](function(_0x1f07fd){logger[_0x1785('0x12')](_0x1785('0x1d'),_0x121bb6);logger['debug'](_0x1785('0x1d'),_0x121bb6,JSON[_0x1785('0xf')](_0x1f07fd));_0x1df713(_0x1f07fd);})[_0x1785('0x13')](function(_0x132470){logger[_0x1785('0x10')](_0x1785('0x1d'),_0x132470[_0x1785('0x11')],_0x121bb6);_0x59751e(_0x2dc499[_0x1785('0x10')](0x1f4,_0x132470[_0x1785('0x11')]));});});};exports[_0x1785('0x21')]=function(_0x42627b){var _0x179042=this;return new Promise(function(_0x3f5427,_0x15e95e){return db[_0x1785('0x15')][_0x1785('0x22')](_0x42627b[_0x1785('0x1f')],{'raw':_0x42627b['options']?_0x42627b[_0x1785('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x42627b[_0x1785('0x17')]?_0x42627b['options'][_0x1785('0x18')]||null:null,'attributes':_0x42627b[_0x1785('0x17')]?_0x42627b[_0x1785('0x17')][_0x1785('0x19')]||null:null,'limit':_0x42627b[_0x1785('0x17')]?_0x42627b[_0x1785('0x17')]['limit']||null:null})[_0x1785('0xa')](function(_0x423adb){logger[_0x1785('0x12')](_0x1785('0x21'),_0x42627b);logger[_0x1785('0xd')]('UpdateVoiceCallReport',_0x42627b,JSON[_0x1785('0xf')](_0x423adb));_0x3f5427(_0x423adb);})[_0x1785('0x13')](function(_0x496d53){logger[_0x1785('0x10')]('UpdateVoiceCallReport',_0x496d53[_0x1785('0x11')],_0x42627b);_0x15e95e(_0x179042[_0x1785('0x10')](0x1f4,_0x496d53[_0x1785('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 7b25c7d..891d903 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 _0xe4ed=['./voiceChanSpy.controller','get','index','/:id','isAuthenticated','show','post','put','update','delete','destroy','path','express','Router','../../components/interaction/service','../../config/environment'];(function(_0x188aea,_0x2fe9ab){var _0x3bf8a8=function(_0x37cdba){while(--_0x37cdba){_0x188aea['push'](_0x188aea['shift']());}};_0x3bf8a8(++_0x2fe9ab);}(_0xe4ed,0x1cb));var _0xde4e=function(_0x40e932,_0x50344c){_0x40e932=_0x40e932-0x0;var _0x33823b=_0xe4ed[_0x40e932];return _0x33823b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xde4e('0x0'));var timeout=require('connect-timeout');var express=require(_0xde4e('0x1'));var router=express[_0xde4e('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xde4e('0x3'));var config=require(_0xde4e('0x4'));var controller=require(_0xde4e('0x5'));router[_0xde4e('0x6')]('/',auth['isAuthenticated'](),controller[_0xde4e('0x7')]);router['get'](_0xde4e('0x8'),auth[_0xde4e('0x9')](),controller[_0xde4e('0xa')]);router[_0xde4e('0xb')]('/',auth[_0xde4e('0x9')](),controller['create']);router[_0xde4e('0xc')]('/:id',auth[_0xde4e('0x9')](),controller[_0xde4e('0xd')]);router[_0xde4e('0xe')](_0xde4e('0x8'),auth[_0xde4e('0x9')](),controller[_0xde4e('0xf')]);module['exports']=router; \ No newline at end of file +var _0x1f10=['express','fs-extra','../../components/auth/service','../../config/environment','./voiceChanSpy.controller','get','index','/:id','isAuthenticated','show','create','put','delete','destroy','exports','util','path','connect-timeout'];(function(_0x202d24,_0x5e8641){var _0x2b3a8e=function(_0x4c7c4a){while(--_0x4c7c4a){_0x202d24['push'](_0x202d24['shift']());}};_0x2b3a8e(++_0x5e8641);}(_0x1f10,0x177));var _0x01f1=function(_0xb7f08,_0x523aa0){_0xb7f08=_0xb7f08-0x0;var _0x3474f5=_0x1f10[_0xb7f08];return _0x3474f5;};'use strict';var multer=require('multer');var util=require(_0x01f1('0x0'));var path=require(_0x01f1('0x1'));var timeout=require(_0x01f1('0x2'));var express=require(_0x01f1('0x3'));var router=express['Router']();var fs_extra=require(_0x01f1('0x4'));var auth=require(_0x01f1('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x01f1('0x6'));var controller=require(_0x01f1('0x7'));router[_0x01f1('0x8')]('/',auth['isAuthenticated'](),controller[_0x01f1('0x9')]);router[_0x01f1('0x8')](_0x01f1('0xa'),auth[_0x01f1('0xb')](),controller[_0x01f1('0xc')]);router['post']('/',auth[_0x01f1('0xb')](),controller[_0x01f1('0xd')]);router[_0x01f1('0xe')]('/:id',auth[_0x01f1('0xb')](),controller['update']);router[_0x01f1('0xf')](_0x01f1('0xa'),auth[_0x01f1('0xb')](),controller[_0x01f1('0x10')]);module[_0x01f1('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 347d18b..2fcfd60 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 _0x748e=['exports','STRING','name','setDataValue','options','join','getDataValue','split','BOOLEAN'];(function(_0x378720,_0xa711f1){var _0x47920a=function(_0xc5056){while(--_0xc5056){_0x378720['push'](_0x378720['shift']());}};_0x47920a(++_0xa711f1);}(_0x748e,0x14d));var _0xe748=function(_0x4dd71c,_0x23a24e){_0x4dd71c=_0x4dd71c-0x0;var _0x8e4e36=_0x748e[_0x4dd71c];return _0x8e4e36;};'use strict';var Sequelize=require('sequelize');module[_0xe748('0x0')]={'name':{'type':Sequelize[_0xe748('0x1')]},'prefix':{'type':Sequelize[_0xe748('0x1')],'unique':_0xe748('0x2'),'allowNull':![]},'options':{'type':Sequelize[_0xe748('0x1')],'set':function(_0x3375bc){this[_0xe748('0x3')](_0xe748('0x4'),_0x3375bc?_0x3375bc[_0xe748('0x5')](''):[]);},'get':function(){return this[_0xe748('0x6')](_0xe748('0x4'))?this[_0xe748('0x6')](_0xe748('0x4'))[_0xe748('0x7')](''):[];}},'auth':{'type':Sequelize[_0xe748('0x8')],'defaultValue':![]},'password':{'type':Sequelize[_0xe748('0x1')]},'record':{'type':Sequelize[_0xe748('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xe748('0x1')]}}; \ No newline at end of file +var _0x6321=['setDataValue','getDataValue','options','sequelize','exports','STRING'];(function(_0x131fa2,_0x2e48d2){var _0x28a429=function(_0x30439c){while(--_0x30439c){_0x131fa2['push'](_0x131fa2['shift']());}};_0x28a429(++_0x2e48d2);}(_0x6321,0x195));var _0x1632=function(_0x2a4d91,_0x3aa979){_0x2a4d91=_0x2a4d91-0x0;var _0x464758=_0x6321[_0x2a4d91];return _0x464758;};'use strict';var Sequelize=require(_0x1632('0x0'));module[_0x1632('0x1')]={'name':{'type':Sequelize[_0x1632('0x2')]},'prefix':{'type':Sequelize[_0x1632('0x2')],'unique':'name','allowNull':![]},'options':{'type':Sequelize[_0x1632('0x2')],'set':function(_0xe7e0a6){this[_0x1632('0x3')]('options',_0xe7e0a6?_0xe7e0a6['join'](''):[]);},'get':function(){return this['getDataValue']('options')?this[_0x1632('0x4')](_0x1632('0x5'))['split'](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 26c23f6..5bae031 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 _0xe9ad=['send','index','map','VoiceChanSpy','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','count','includeAll','rows','catch','show','params','length','include','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','autoAssociation','error','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','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','set','Content-Range','apply','save','update','then','destroy','get','ChanSpies','UserProfileResource','stack','name'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0xe9ad,0x82));var _0xde9a=function(_0x57fda8,_0x5e80a0){_0x57fda8=_0x57fda8-0x0;var _0x11c895=_0xe9ad[_0x57fda8];return _0x11c895;};'use strict';var emlformat=require(_0xde9a('0x0'));var rimraf=require(_0xde9a('0x1'));var zipdir=require(_0xde9a('0x2'));var jsonpatch=require(_0xde9a('0x3'));var rp=require(_0xde9a('0x4'));var moment=require(_0xde9a('0x5'));var BPromise=require(_0xde9a('0x6'));var Mustache=require('mustache');var util=require(_0xde9a('0x7'));var path=require(_0xde9a('0x8'));var sox=require(_0xde9a('0x9'));var csv=require(_0xde9a('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xde9a('0xb'));var _=require(_0xde9a('0xc'));var squel=require(_0xde9a('0xd'));var crypto=require('crypto');var jsforce=require(_0xde9a('0xe'));var deskjs=require(_0xde9a('0xf'));var toCsv=require(_0xde9a('0xa'));var querystring=require(_0xde9a('0x10'));var Papa=require(_0xde9a('0x11'));var Redis=require(_0xde9a('0x12'));var authService=require(_0xde9a('0x13'));var qs=require(_0xde9a('0x14'));var as=require(_0xde9a('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xde9a('0x16'))(_0xde9a('0x17'));var utils=require(_0xde9a('0x18'));var config=require(_0xde9a('0x19'));var licenseUtil=require(_0xde9a('0x1a'));var db=require(_0xde9a('0x1b'))['db'];function respondWithStatusCode(_0x1cb3bd,_0x3a9b1a){_0x3a9b1a=_0x3a9b1a||0xcc;return function(_0xd81956){if(_0xd81956){return _0x1cb3bd['sendStatus'](_0x3a9b1a);}return _0x1cb3bd[_0xde9a('0x1c')](_0x3a9b1a)[_0xde9a('0x1d')]();};}function respondWithResult(_0x2f2e11,_0x267d5b){_0x267d5b=_0x267d5b||0xc8;return function(_0x1c1873){if(_0x1c1873){return _0x2f2e11[_0xde9a('0x1c')](_0x267d5b)[_0xde9a('0x1e')](_0x1c1873);}};}function respondWithFilteredResult(_0x432d3c,_0x3f0e39){return function(_0x474713){if(_0x474713){var _0x50ffb8=typeof _0x3f0e39[_0xde9a('0x1f')]===_0xde9a('0x20')&&typeof _0x3f0e39[_0xde9a('0x21')]===_0xde9a('0x20');var _0x454156=_0x474713['count'];var _0x12ba7f=_0x50ffb8?0x0:_0x3f0e39[_0xde9a('0x1f')];var _0x3b89ef=_0x50ffb8?_0x474713['count']:_0x3f0e39[_0xde9a('0x1f')]+_0x3f0e39['limit'];var _0x8f481a;if(_0x3b89ef>=_0x454156){_0x3b89ef=_0x454156;_0x8f481a=0xc8;}else{_0x8f481a=0xce;}_0x432d3c['status'](_0x8f481a);return _0x432d3c[_0xde9a('0x22')](_0xde9a('0x23'),_0x12ba7f+'-'+_0x3b89ef+'/'+_0x454156)[_0xde9a('0x1e')](_0x474713);}return null;};}function patchUpdates(_0x4add81){return function(_0x43b1bb){try{jsonpatch[_0xde9a('0x24')](_0x43b1bb,_0x4add81,!![]);}catch(_0x4e4e02){return BPromise['reject'](_0x4e4e02);}return _0x43b1bb[_0xde9a('0x25')]();};}function saveUpdates(_0x416b36,_0x56550b){return function(_0x290d8d){if(_0x290d8d){return _0x290d8d[_0xde9a('0x26')](_0x416b36)[_0xde9a('0x27')](function(_0x402b06){return _0x402b06;});}return null;};}function removeEntity(_0xa48b6b,_0x284c96){return function(_0x544f9d){if(_0x544f9d){return _0x544f9d[_0xde9a('0x28')]()[_0xde9a('0x27')](function(){var _0x2fa60c=_0x544f9d[_0xde9a('0x29')]({'plain':!![]});var _0xfd4b9d=_0xde9a('0x2a');return db[_0xde9a('0x2b')][_0xde9a('0x28')]({'where':{'type':_0xfd4b9d,'resourceId':_0x2fa60c['id']}})[_0xde9a('0x27')](function(){return _0x544f9d;});})['then'](function(){_0xa48b6b['status'](0xcc)[_0xde9a('0x1d')]();});}};}function handleEntityNotFound(_0x42ba56,_0x748a16){return function(_0x3a9e95){if(!_0x3a9e95){_0x42ba56['sendStatus'](0x194);}return _0x3a9e95;};}function handleError(_0x4169bd,_0x271dbe){_0x271dbe=_0x271dbe||0x1f4;return function(_0x467ce2){logger['error'](_0x467ce2[_0xde9a('0x2c')]);if(_0x467ce2['name']){delete _0x467ce2[_0xde9a('0x2d')];}_0x4169bd['status'](_0x271dbe)[_0xde9a('0x2e')](_0x467ce2);};}exports[_0xde9a('0x2f')]=function(_0x3deac3,_0x422b05){var _0x22d78a={},_0x2f0f7a={},_0x366ccd={'count':0x0,'rows':[]};var _0x52b157=_[_0xde9a('0x30')](db[_0xde9a('0x31')][_0xde9a('0x32')],function(_0x26bdff){return{'name':_0x26bdff[_0xde9a('0x33')],'type':_0x26bdff[_0xde9a('0x34')][_0xde9a('0x35')]};});_0x2f0f7a[_0xde9a('0x36')]=_[_0xde9a('0x30')](_0x52b157,_0xde9a('0x2d'));_0x2f0f7a[_0xde9a('0x37')]=_[_0xde9a('0x38')](_0x3deac3[_0xde9a('0x37')]);_0x2f0f7a[_0xde9a('0x39')]=_['intersection'](_0x2f0f7a['model'],_0x2f0f7a[_0xde9a('0x37')]);_0x22d78a['attributes']=_[_0xde9a('0x3a')](_0x2f0f7a[_0xde9a('0x36')],qs['fields'](_0x3deac3[_0xde9a('0x37')][_0xde9a('0x3b')]));_0x22d78a[_0xde9a('0x3c')]=_0x22d78a['attributes']['length']?_0x22d78a[_0xde9a('0x3c')]:_0x2f0f7a[_0xde9a('0x36')];if(!_0x3deac3['query'][_0xde9a('0x3d')](_0xde9a('0x3e'))){_0x22d78a[_0xde9a('0x21')]=qs[_0xde9a('0x21')](_0x3deac3[_0xde9a('0x37')][_0xde9a('0x21')]);_0x22d78a[_0xde9a('0x1f')]=qs[_0xde9a('0x1f')](_0x3deac3[_0xde9a('0x37')][_0xde9a('0x1f')]);}_0x22d78a['order']=qs[_0xde9a('0x3f')](_0x3deac3[_0xde9a('0x37')][_0xde9a('0x3f')]);_0x22d78a[_0xde9a('0x40')]=qs['filters'](_[_0xde9a('0x41')](_0x3deac3[_0xde9a('0x37')],_0x2f0f7a[_0xde9a('0x39')]),_0x52b157);if(_0x3deac3[_0xde9a('0x37')][_0xde9a('0x42')]){_0x22d78a[_0xde9a('0x40')]=_['merge'](_0x22d78a[_0xde9a('0x40')],{'$or':_[_0xde9a('0x30')](_0x52b157,function(_0x492255){if(_0x492255[_0xde9a('0x34')]!==_0xde9a('0x43')){var _0x8c3f59={};_0x8c3f59[_0x492255[_0xde9a('0x2d')]]={'$like':'%'+_0x3deac3[_0xde9a('0x37')]['filter']+'%'};return _0x8c3f59;}})});}_0x22d78a=_[_0xde9a('0x44')]({},_0x22d78a,_0x3deac3[_0xde9a('0x45')]);var _0x2811b2={'where':_0x22d78a[_0xde9a('0x40')]};return db[_0xde9a('0x31')][_0xde9a('0x46')](_0x2811b2)[_0xde9a('0x27')](function(_0x2b87f0){_0x366ccd['count']=_0x2b87f0;if(_0x3deac3[_0xde9a('0x37')][_0xde9a('0x47')]){_0x22d78a['include']=[{'all':!![]}];}return db[_0xde9a('0x31')]['findAll'](_0x22d78a);})[_0xde9a('0x27')](function(_0x229181){_0x366ccd[_0xde9a('0x48')]=_0x229181;return _0x366ccd;})[_0xde9a('0x27')](respondWithFilteredResult(_0x422b05,_0x22d78a))[_0xde9a('0x49')](handleError(_0x422b05,null));};exports[_0xde9a('0x4a')]=function(_0x372665,_0x38fd2d){var _0x57fbf8={'raw':![],'where':{'id':_0x372665[_0xde9a('0x4b')]['id']}},_0x51fe53={};_0x51fe53[_0xde9a('0x36')]=_['keys'](db['VoiceChanSpy'][_0xde9a('0x32')]);_0x51fe53[_0xde9a('0x37')]=_[_0xde9a('0x38')](_0x372665[_0xde9a('0x37')]);_0x51fe53[_0xde9a('0x39')]=_['intersection'](_0x51fe53[_0xde9a('0x36')],_0x51fe53['query']);_0x57fbf8['attributes']=_[_0xde9a('0x3a')](_0x51fe53[_0xde9a('0x36')],qs['fields'](_0x372665[_0xde9a('0x37')][_0xde9a('0x3b')]));_0x57fbf8['attributes']=_0x57fbf8[_0xde9a('0x3c')][_0xde9a('0x4c')]?_0x57fbf8[_0xde9a('0x3c')]:_0x51fe53[_0xde9a('0x36')];if(_0x372665[_0xde9a('0x37')][_0xde9a('0x47')]){_0x57fbf8[_0xde9a('0x4d')]=[{'all':!![]}];}_0x57fbf8=_['merge']({},_0x57fbf8,_0x372665[_0xde9a('0x45')]);return db['VoiceChanSpy']['find'](_0x57fbf8)[_0xde9a('0x27')](handleEntityNotFound(_0x38fd2d,null))[_0xde9a('0x27')](respondWithResult(_0x38fd2d,null))[_0xde9a('0x49')](handleError(_0x38fd2d,null));};exports[_0xde9a('0x4e')]=function(_0x31de98,_0xe4c867){return db[_0xde9a('0x31')][_0xde9a('0x4e')](_0x31de98[_0xde9a('0x4f')],{})[_0xde9a('0x27')](function(_0x330e15){var _0x3e840d=_0x31de98['user'][_0xde9a('0x29')]({'plain':!![]});if(!_0x3e840d)throw new Error(_0xde9a('0x50'));if(_0x3e840d[_0xde9a('0x51')]===_0xde9a('0x52')){var _0xc6d00b=_0x330e15[_0xde9a('0x29')]({'plain':!![]});var _0x1a6058=_0xde9a('0x2a');return db[_0xde9a('0x53')][_0xde9a('0x54')]({'where':{'name':_0x1a6058,'userProfileId':_0x3e840d['userProfileId']},'raw':!![]})['then'](function(_0x20e214){if(_0x20e214&&_0x20e214[_0xde9a('0x55')]===0x0){return db[_0xde9a('0x2b')][_0xde9a('0x4e')]({'name':_0xc6d00b['name'],'resourceId':_0xc6d00b['id'],'type':_0x20e214[_0xde9a('0x2d')],'sectionId':_0x20e214['id']},{})[_0xde9a('0x27')](function(){return _0x330e15;});}else{return _0x330e15;}})[_0xde9a('0x49')](function(_0x4872f6){logger[_0xde9a('0x56')](_0xde9a('0x57'),_0x4872f6);throw _0x4872f6;});}return _0x330e15;})['then'](respondWithResult(_0xe4c867,0xc9))[_0xde9a('0x49')](handleError(_0xe4c867,null));};exports[_0xde9a('0x26')]=function(_0x317d8c,_0xc665a8){if(_0x317d8c[_0xde9a('0x4f')]['id']){delete _0x317d8c[_0xde9a('0x4f')]['id'];}return db['VoiceChanSpy']['find']({'where':{'id':_0x317d8c[_0xde9a('0x4b')]['id']}})[_0xde9a('0x27')](handleEntityNotFound(_0xc665a8,null))['then'](saveUpdates(_0x317d8c[_0xde9a('0x4f')],null))['then'](respondWithResult(_0xc665a8,null))[_0xde9a('0x49')](handleError(_0xc665a8,null));};exports['destroy']=function(_0x3dbf4a,_0x9cbbf1){return db['VoiceChanSpy']['find']({'where':{'id':_0x3dbf4a[_0xde9a('0x4b')]['id']}})[_0xde9a('0x27')](handleEntityNotFound(_0x9cbbf1,null))[_0xde9a('0x27')](removeEntity(_0x9cbbf1,null))[_0xde9a('0x49')](handleError(_0x9cbbf1,null));}; \ No newline at end of file +var _0xb790=['squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','json','reject','save','then','destroy','get','ChanSpies','UserProfileResource','end','error','name','send','map','VoiceChanSpy','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','show','params','include','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','moment','util','path','to-csv','ejs','fs-extra','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb790,0xe5));var _0x0b79=function(_0xfb65aa,_0x1651a6){_0xfb65aa=_0xfb65aa-0x0;var _0x2aee31=_0xb790[_0xfb65aa];return _0x2aee31;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0b79('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0b79('0x1'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x0b79('0x2'));var path=require(_0x0b79('0x3'));var sox=require('sox');var csv=require(_0x0b79('0x4'));var ejs=require(_0x0b79('0x5'));var fs=require('fs');var fs_extra=require(_0x0b79('0x6'));var _=require(_0x0b79('0x7'));var squel=require(_0x0b79('0x8'));var crypto=require(_0x0b79('0x9'));var jsforce=require(_0x0b79('0xa'));var deskjs=require(_0x0b79('0xb'));var toCsv=require(_0x0b79('0x4'));var querystring=require(_0x0b79('0xc'));var Papa=require(_0x0b79('0xd'));var Redis=require(_0x0b79('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0b79('0xf'));var hardwareService=require(_0x0b79('0x10'));var logger=require(_0x0b79('0x11'))(_0x0b79('0x12'));var utils=require(_0x0b79('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x0b79('0x14'));var db=require(_0x0b79('0x15'))['db'];function respondWithStatusCode(_0x545d4e,_0x44c94c){_0x44c94c=_0x44c94c||0xcc;return function(_0x1c0a61){if(_0x1c0a61){return _0x545d4e[_0x0b79('0x16')](_0x44c94c);}return _0x545d4e[_0x0b79('0x17')](_0x44c94c)['end']();};}function respondWithResult(_0x1a6251,_0x4681e4){_0x4681e4=_0x4681e4||0xc8;return function(_0x162522){if(_0x162522){return _0x1a6251[_0x0b79('0x17')](_0x4681e4)['json'](_0x162522);}};}function respondWithFilteredResult(_0x464c1a,_0x44f4f7){return function(_0x5bf09b){if(_0x5bf09b){var _0x1820fa=typeof _0x44f4f7[_0x0b79('0x18')]===_0x0b79('0x19')&&typeof _0x44f4f7[_0x0b79('0x1a')]===_0x0b79('0x19');var _0x37177d=_0x5bf09b[_0x0b79('0x1b')];var _0x316ebb=_0x1820fa?0x0:_0x44f4f7['offset'];var _0x49909d=_0x1820fa?_0x5bf09b['count']:_0x44f4f7[_0x0b79('0x18')]+_0x44f4f7[_0x0b79('0x1a')];var _0x23a663;if(_0x49909d>=_0x37177d){_0x49909d=_0x37177d;_0x23a663=0xc8;}else{_0x23a663=0xce;}_0x464c1a['status'](_0x23a663);return _0x464c1a[_0x0b79('0x1c')]('Content-Range',_0x316ebb+'-'+_0x49909d+'/'+_0x37177d)[_0x0b79('0x1d')](_0x5bf09b);}return null;};}function patchUpdates(_0x41d9da){return function(_0x8482ad){try{jsonpatch['apply'](_0x8482ad,_0x41d9da,!![]);}catch(_0x4483db){return BPromise[_0x0b79('0x1e')](_0x4483db);}return _0x8482ad[_0x0b79('0x1f')]();};}function saveUpdates(_0x50084c,_0xa836a8){return function(_0x58901a){if(_0x58901a){return _0x58901a['update'](_0x50084c)[_0x0b79('0x20')](function(_0x59cd0d){return _0x59cd0d;});}return null;};}function removeEntity(_0x80fbe9,_0x235a7f){return function(_0x3a04d3){if(_0x3a04d3){return _0x3a04d3[_0x0b79('0x21')]()['then'](function(){var _0x29166f=_0x3a04d3[_0x0b79('0x22')]({'plain':!![]});var _0x409db2=_0x0b79('0x23');return db[_0x0b79('0x24')][_0x0b79('0x21')]({'where':{'type':_0x409db2,'resourceId':_0x29166f['id']}})[_0x0b79('0x20')](function(){return _0x3a04d3;});})[_0x0b79('0x20')](function(){_0x80fbe9[_0x0b79('0x17')](0xcc)[_0x0b79('0x25')]();});}};}function handleEntityNotFound(_0x376bf3,_0x2961ff){return function(_0x1cf7f7){if(!_0x1cf7f7){_0x376bf3['sendStatus'](0x194);}return _0x1cf7f7;};}function handleError(_0x5c9a6e,_0x18c9d1){_0x18c9d1=_0x18c9d1||0x1f4;return function(_0x43291a){logger[_0x0b79('0x26')](_0x43291a['stack']);if(_0x43291a['name']){delete _0x43291a[_0x0b79('0x27')];}_0x5c9a6e['status'](_0x18c9d1)[_0x0b79('0x28')](_0x43291a);};}exports['index']=function(_0x1b72ec,_0x63c8f2){var _0x19971a={},_0x574513={},_0x45d438={'count':0x0,'rows':[]};var _0x4d74cc=_[_0x0b79('0x29')](db[_0x0b79('0x2a')][_0x0b79('0x2b')],function(_0x59f34f){return{'name':_0x59f34f['fieldName'],'type':_0x59f34f[_0x0b79('0x2c')][_0x0b79('0x2d')]};});_0x574513[_0x0b79('0x2e')]=_[_0x0b79('0x29')](_0x4d74cc,_0x0b79('0x27'));_0x574513[_0x0b79('0x2f')]=_[_0x0b79('0x30')](_0x1b72ec[_0x0b79('0x2f')]);_0x574513[_0x0b79('0x31')]=_[_0x0b79('0x32')](_0x574513[_0x0b79('0x2e')],_0x574513[_0x0b79('0x2f')]);_0x19971a[_0x0b79('0x33')]=_[_0x0b79('0x32')](_0x574513[_0x0b79('0x2e')],qs[_0x0b79('0x34')](_0x1b72ec['query']['fields']));_0x19971a[_0x0b79('0x33')]=_0x19971a[_0x0b79('0x33')][_0x0b79('0x35')]?_0x19971a[_0x0b79('0x33')]:_0x574513[_0x0b79('0x2e')];if(!_0x1b72ec[_0x0b79('0x2f')][_0x0b79('0x36')](_0x0b79('0x37'))){_0x19971a[_0x0b79('0x1a')]=qs['limit'](_0x1b72ec[_0x0b79('0x2f')][_0x0b79('0x1a')]);_0x19971a['offset']=qs[_0x0b79('0x18')](_0x1b72ec[_0x0b79('0x2f')][_0x0b79('0x18')]);}_0x19971a[_0x0b79('0x38')]=qs[_0x0b79('0x39')](_0x1b72ec[_0x0b79('0x2f')]['sort']);_0x19971a[_0x0b79('0x3a')]=qs[_0x0b79('0x31')](_[_0x0b79('0x3b')](_0x1b72ec[_0x0b79('0x2f')],_0x574513[_0x0b79('0x31')]),_0x4d74cc);if(_0x1b72ec['query'][_0x0b79('0x3c')]){_0x19971a['where']=_[_0x0b79('0x3d')](_0x19971a[_0x0b79('0x3a')],{'$or':_[_0x0b79('0x29')](_0x4d74cc,function(_0x59e0a6){if(_0x59e0a6['type']!=='VIRTUAL'){var _0x34db3e={};_0x34db3e[_0x59e0a6['name']]={'$like':'%'+_0x1b72ec[_0x0b79('0x2f')][_0x0b79('0x3c')]+'%'};return _0x34db3e;}})});}_0x19971a=_[_0x0b79('0x3d')]({},_0x19971a,_0x1b72ec[_0x0b79('0x3e')]);var _0x33509e={'where':_0x19971a[_0x0b79('0x3a')]};return db[_0x0b79('0x2a')]['count'](_0x33509e)[_0x0b79('0x20')](function(_0x38a258){_0x45d438[_0x0b79('0x1b')]=_0x38a258;if(_0x1b72ec[_0x0b79('0x2f')][_0x0b79('0x3f')]){_0x19971a['include']=[{'all':!![]}];}return db[_0x0b79('0x2a')][_0x0b79('0x40')](_0x19971a);})['then'](function(_0x1a8e38){_0x45d438[_0x0b79('0x41')]=_0x1a8e38;return _0x45d438;})['then'](respondWithFilteredResult(_0x63c8f2,_0x19971a))['catch'](handleError(_0x63c8f2,null));};exports[_0x0b79('0x42')]=function(_0x47c4ae,_0x3e94e7){var _0x280155={'raw':![],'where':{'id':_0x47c4ae[_0x0b79('0x43')]['id']}},_0x4b2e69={};_0x4b2e69[_0x0b79('0x2e')]=_[_0x0b79('0x30')](db['VoiceChanSpy'][_0x0b79('0x2b')]);_0x4b2e69[_0x0b79('0x2f')]=_[_0x0b79('0x30')](_0x47c4ae[_0x0b79('0x2f')]);_0x4b2e69[_0x0b79('0x31')]=_[_0x0b79('0x32')](_0x4b2e69[_0x0b79('0x2e')],_0x4b2e69[_0x0b79('0x2f')]);_0x280155[_0x0b79('0x33')]=_[_0x0b79('0x32')](_0x4b2e69[_0x0b79('0x2e')],qs['fields'](_0x47c4ae['query'][_0x0b79('0x34')]));_0x280155[_0x0b79('0x33')]=_0x280155[_0x0b79('0x33')][_0x0b79('0x35')]?_0x280155[_0x0b79('0x33')]:_0x4b2e69['model'];if(_0x47c4ae[_0x0b79('0x2f')]['includeAll']){_0x280155[_0x0b79('0x44')]=[{'all':!![]}];}_0x280155=_[_0x0b79('0x3d')]({},_0x280155,_0x47c4ae[_0x0b79('0x3e')]);return db[_0x0b79('0x2a')][_0x0b79('0x45')](_0x280155)[_0x0b79('0x20')](handleEntityNotFound(_0x3e94e7,null))[_0x0b79('0x20')](respondWithResult(_0x3e94e7,null))[_0x0b79('0x46')](handleError(_0x3e94e7,null));};exports[_0x0b79('0x47')]=function(_0x37b5df,_0x362aa4){return db[_0x0b79('0x2a')][_0x0b79('0x47')](_0x37b5df[_0x0b79('0x48')],{})[_0x0b79('0x20')](function(_0x2d585f){var _0x5153b2=_0x37b5df[_0x0b79('0x49')]['get']({'plain':!![]});if(!_0x5153b2)throw new Error(_0x0b79('0x4a'));if(_0x5153b2[_0x0b79('0x4b')]===_0x0b79('0x49')){var _0x5ab832=_0x2d585f[_0x0b79('0x22')]({'plain':!![]});var _0x1862c4=_0x0b79('0x23');return db[_0x0b79('0x4c')][_0x0b79('0x45')]({'where':{'name':_0x1862c4,'userProfileId':_0x5153b2[_0x0b79('0x4d')]},'raw':!![]})[_0x0b79('0x20')](function(_0xb46fd5){if(_0xb46fd5&&_0xb46fd5['autoAssociation']===0x0){return db[_0x0b79('0x24')][_0x0b79('0x47')]({'name':_0x5ab832[_0x0b79('0x27')],'resourceId':_0x5ab832['id'],'type':_0xb46fd5[_0x0b79('0x27')],'sectionId':_0xb46fd5['id']},{})[_0x0b79('0x20')](function(){return _0x2d585f;});}else{return _0x2d585f;}})[_0x0b79('0x46')](function(_0x2309be){logger[_0x0b79('0x26')](_0x0b79('0x4e'),_0x2309be);throw _0x2309be;});}return _0x2d585f;})['then'](respondWithResult(_0x362aa4,0xc9))[_0x0b79('0x46')](handleError(_0x362aa4,null));};exports['update']=function(_0x1616fa,_0xc5c195){if(_0x1616fa['body']['id']){delete _0x1616fa[_0x0b79('0x48')]['id'];}return db[_0x0b79('0x2a')][_0x0b79('0x45')]({'where':{'id':_0x1616fa[_0x0b79('0x43')]['id']}})[_0x0b79('0x20')](handleEntityNotFound(_0xc5c195,null))[_0x0b79('0x20')](saveUpdates(_0x1616fa['body'],null))['then'](respondWithResult(_0xc5c195,null))[_0x0b79('0x46')](handleError(_0xc5c195,null));};exports[_0x0b79('0x21')]=function(_0x264d6c,_0x27455c){return db[_0x0b79('0x2a')][_0x0b79('0x45')]({'where':{'id':_0x264d6c[_0x0b79('0x43')]['id']}})[_0x0b79('0x20')](handleEntityNotFound(_0x27455c,null))[_0x0b79('0x20')](removeEntity(_0x27455c,null))[_0x0b79('0x46')](handleError(_0x27455c,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 5a08532..a3a2bf8 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 _0xa774=['concat','internal','User','agent','then','catch','models','define','voice_chanspy','length','VoiceExtension','destroy','bluebird','./voiceChanSpy.attributes','context','format','%s%s','prefix','push','merge','Set','CDR(type)=%s','chanspy','record','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','Authenticate','ChanSpy','name','options','join','StopMixMonitor'];(function(_0x571c47,_0x438835){var _0x3b2953=function(_0x5802b9){while(--_0x5802b9){_0x571c47['push'](_0x571c47['shift']());}};_0x3b2953(++_0x438835);}(_0xa774,0x135));var _0x4a77=function(_0x19dd7a,_0x51de21){_0x19dd7a=_0x19dd7a-0x0;var _0x3feb6a=_0xa774[_0x19dd7a];return _0x3feb6a;};'use strict';var _=require('lodash');var util=require('util');var BPromise=require(_0x4a77('0x0'));var attributes=require(_0x4a77('0x1'));var getUserApplications=function(_0x40e994,_0x46aea5,_0x9c1afe){var _0x536ad0=0x1;var _0x29a212=[];var _0x5bd6fa={'context':_0x46aea5[_0x4a77('0x2')]||'from-sip','exten':util[_0x4a77('0x3')](_0x4a77('0x4'),_0x40e994[_0x4a77('0x5')],_0x9c1afe),'type':'system','isApp':![],'ChanSpyId':_0x40e994['id'],'UserId':_0x46aea5['id']};_0x29a212[_0x4a77('0x6')](_[_0x4a77('0x7')]({'app':_0x4a77('0x8'),'appdata':util['format'](_0x4a77('0x9'),_0x4a77('0xa')),'priority':_0x536ad0++},_0x5bd6fa));if(_0x40e994[_0x4a77('0xb')]){_0x29a212[_0x4a77('0x6')](_['merge']({'app':_0x4a77('0xc'),'appdata':util[_0x4a77('0x3')](_0x4a77('0xd'),_0x40e994[_0x4a77('0xe')]),'priority':_0x536ad0++},_0x5bd6fa));}if(_0x40e994['auth']){_0x29a212[_0x4a77('0x6')](_['merge']({'app':_0x4a77('0xf'),'appdata':_0x40e994['password'],'priority':_0x536ad0++},_0x5bd6fa));}_0x29a212[_0x4a77('0x6')](_[_0x4a77('0x7')]({'app':_0x4a77('0x10'),'appdata':util[_0x4a77('0x3')]('SIP/%s,%s',_0x46aea5[_0x4a77('0x11')],_0x40e994[_0x4a77('0x12')]?_0x40e994[_0x4a77('0x12')][_0x4a77('0x13')](''):''),'priority':_0x536ad0++},_0x5bd6fa));if(_0x40e994[_0x4a77('0xb')]){_0x29a212[_0x4a77('0x6')](_[_0x4a77('0x7')]({'app':_0x4a77('0x14'),'priority':_0x536ad0++},_0x5bd6fa));}return _0x29a212;};var getChanSpyApplications=function(_0x47eca8,_0x148614){var _0x3716f3=[];for(var _0xce03fe=0x0,_0x440c03=0x1;_0xce03fe<_0x148614['length'];_0xce03fe++,_0x440c03=0x1){_0x3716f3=_0x3716f3[_0x4a77('0x15')](getUserApplications(_0x47eca8,_0x148614[_0xce03fe],_0x148614[_0xce03fe][_0x4a77('0x16')]));if(_0x148614[_0xce03fe][_0x4a77('0x16')]!=_0x148614[_0xce03fe]['name']){_0x3716f3=_0x3716f3[_0x4a77('0x15')](getUserApplications(_0x47eca8,_0x148614[_0xce03fe],_0x148614[_0xce03fe][_0x4a77('0x11')]));}}return _0x3716f3;};var getChanSpyPromise=function(_0x5ca9cb,_0x428c0a){return new BPromise(function(_0x385769,_0x2dfd3f){return _0x5ca9cb[_0x4a77('0x17')]['findAll']({'attributes':['id',_0x4a77('0x11'),'internal'],'where':{'role':_0x4a77('0x18'),'chanspy':!![]},'raw':!![]})[_0x4a77('0x19')](function(_0x175654){if(_0x175654){return _0x385769(getChanSpyApplications(_0x428c0a,_0x175654));}return _0x385769([]);})[_0x4a77('0x1a')](function(_0x4b6aac){_0x2dfd3f(_0x4b6aac);});});};module['exports']=function(_0x4d7ec6,_0x536e95){var _0x580b0e=_0x4d7ec6[_0x4a77('0x1b')];return _0x4d7ec6[_0x4a77('0x1c')]('VoiceChanSpy',attributes,{'tableName':_0x4a77('0x1d'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x57ef99,_0xf814b8,_0x45301a){return getChanSpyPromise(_0x580b0e,_0x57ef99)[_0x4a77('0x19')](function(_0x21c390){if(_0x21c390&&_0x21c390[_0x4a77('0x1e')]){return _0x580b0e[_0x4a77('0x1f')]['bulkCreate'](_0x21c390);}})[_0x4a77('0x19')](function(){_0x45301a();})[_0x4a77('0x1a')](function(_0x51dcc2){_0x45301a(_0x51dcc2);});},'afterUpdate':function(_0x457dca,_0x257fc1,_0x2499ac){return _0x580b0e['VoiceExtension']['destroy']({'where':{'ChanSpyId':_0x457dca['id']}})[_0x4a77('0x19')](function(){return getChanSpyPromise(_0x580b0e,_0x457dca);})[_0x4a77('0x19')](function(_0x4cc483){if(_0x4cc483&&_0x4cc483[_0x4a77('0x1e')]){return _0x580b0e[_0x4a77('0x1f')]['bulkCreate'](_0x4cc483);}})[_0x4a77('0x19')](function(){_0x2499ac();})[_0x4a77('0x1a')](function(_0x429f23){_0x2499ac(_0x429f23);});},'afterDestroy':function(_0x750f04,_0x36fbc9,_0x4fe520){return _0x580b0e['VoiceExtension'][_0x4a77('0x20')]({'where':{'ChanSpyId':_0x750f04['id']}})['then'](function(){_0x4fe520();})['catch'](function(_0x2a0ff9){_0x4fe520(_0x2a0ff9);});}}});}; \ No newline at end of file +var _0xa36e=['push','Set','chanspy','record','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','merge','Authenticate','ChanSpy','SIP/%s,%s','name','options','join','StopMixMonitor','length','internal','concat','User','agent','then','exports','define','voice_chanspy','VoiceExtension','catch','destroy','bulkCreate','util','bluebird','from-sip','format','prefix','system'];(function(_0x50007c,_0x1cbf11){var _0x5c1ec7=function(_0x52d038){while(--_0x52d038){_0x50007c['push'](_0x50007c['shift']());}};_0x5c1ec7(++_0x1cbf11);}(_0xa36e,0x135));var _0xea36=function(_0x5cebe8,_0x51c31a){_0x5cebe8=_0x5cebe8-0x0;var _0x4214dc=_0xa36e[_0x5cebe8];return _0x4214dc;};'use strict';var _=require('lodash');var util=require(_0xea36('0x0'));var BPromise=require(_0xea36('0x1'));var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x494166,_0x1a1827,_0xcc0483){var _0x490b88=0x1;var _0x442088=[];var _0x1cca95={'context':_0x1a1827['context']||_0xea36('0x2'),'exten':util[_0xea36('0x3')]('%s%s',_0x494166[_0xea36('0x4')],_0xcc0483),'type':_0xea36('0x5'),'isApp':![],'ChanSpyId':_0x494166['id'],'UserId':_0x1a1827['id']};_0x442088[_0xea36('0x6')](_['merge']({'app':_0xea36('0x7'),'appdata':util[_0xea36('0x3')]('CDR(type)=%s',_0xea36('0x8')),'priority':_0x490b88++},_0x1cca95));if(_0x494166[_0xea36('0x9')]){_0x442088[_0xea36('0x6')](_['merge']({'app':_0xea36('0xa'),'appdata':util[_0xea36('0x3')](_0xea36('0xb'),_0x494166[_0xea36('0xc')]),'priority':_0x490b88++},_0x1cca95));}if(_0x494166[_0xea36('0xd')]){_0x442088[_0xea36('0x6')](_[_0xea36('0xe')]({'app':_0xea36('0xf'),'appdata':_0x494166['password'],'priority':_0x490b88++},_0x1cca95));}_0x442088['push'](_['merge']({'app':_0xea36('0x10'),'appdata':util[_0xea36('0x3')](_0xea36('0x11'),_0x1a1827[_0xea36('0x12')],_0x494166[_0xea36('0x13')]?_0x494166['options'][_0xea36('0x14')](''):''),'priority':_0x490b88++},_0x1cca95));if(_0x494166[_0xea36('0x9')]){_0x442088[_0xea36('0x6')](_[_0xea36('0xe')]({'app':_0xea36('0x15'),'priority':_0x490b88++},_0x1cca95));}return _0x442088;};var getChanSpyApplications=function(_0x5d807f,_0x2a0dc6){var _0xf81bac=[];for(var _0x19a993=0x0,_0x21e7b2=0x1;_0x19a993<_0x2a0dc6[_0xea36('0x16')];_0x19a993++,_0x21e7b2=0x1){_0xf81bac=_0xf81bac['concat'](getUserApplications(_0x5d807f,_0x2a0dc6[_0x19a993],_0x2a0dc6[_0x19a993][_0xea36('0x17')]));if(_0x2a0dc6[_0x19a993][_0xea36('0x17')]!=_0x2a0dc6[_0x19a993][_0xea36('0x12')]){_0xf81bac=_0xf81bac[_0xea36('0x18')](getUserApplications(_0x5d807f,_0x2a0dc6[_0x19a993],_0x2a0dc6[_0x19a993][_0xea36('0x12')]));}}return _0xf81bac;};var getChanSpyPromise=function(_0x216df0,_0x3ac728){return new BPromise(function(_0x3519c2,_0x231d18){return _0x216df0[_0xea36('0x19')]['findAll']({'attributes':['id',_0xea36('0x12'),_0xea36('0x17')],'where':{'role':_0xea36('0x1a'),'chanspy':!![]},'raw':!![]})[_0xea36('0x1b')](function(_0x2a4dac){if(_0x2a4dac){return _0x3519c2(getChanSpyApplications(_0x3ac728,_0x2a4dac));}return _0x3519c2([]);})['catch'](function(_0x4a2917){_0x231d18(_0x4a2917);});});};module[_0xea36('0x1c')]=function(_0x3cd586,_0x42eaf){var _0xa062ca=_0x3cd586['models'];return _0x3cd586[_0xea36('0x1d')]('VoiceChanSpy',attributes,{'tableName':_0xea36('0x1e'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x4fe9c5,_0x57df9b,_0x81d015){return getChanSpyPromise(_0xa062ca,_0x4fe9c5)[_0xea36('0x1b')](function(_0x107bb9){if(_0x107bb9&&_0x107bb9[_0xea36('0x16')]){return _0xa062ca[_0xea36('0x1f')]['bulkCreate'](_0x107bb9);}})['then'](function(){_0x81d015();})[_0xea36('0x20')](function(_0xfa3fcb){_0x81d015(_0xfa3fcb);});},'afterUpdate':function(_0x165ed9,_0x5d6cb2,_0x19a40e){return _0xa062ca[_0xea36('0x1f')][_0xea36('0x21')]({'where':{'ChanSpyId':_0x165ed9['id']}})['then'](function(){return getChanSpyPromise(_0xa062ca,_0x165ed9);})[_0xea36('0x1b')](function(_0x588906){if(_0x588906&&_0x588906[_0xea36('0x16')]){return _0xa062ca[_0xea36('0x1f')][_0xea36('0x22')](_0x588906);}})['then'](function(){_0x19a40e();})[_0xea36('0x20')](function(_0x35050e){_0x19a40e(_0x35050e);});},'afterDestroy':function(_0x3fc4db,_0x55f0e6,_0xfb0ae5){return _0xa062ca[_0xea36('0x1f')][_0xea36('0x21')]({'where':{'ChanSpyId':_0x3fc4db['id']}})[_0xea36('0x1b')](function(){_0xfb0ae5();})[_0xea36('0x20')](function(_0xe091b0){_0xfb0ae5(_0xe091b0);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index f9f3c29..821de32 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 _0xbdb7=['request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','info','VoiceChanSpy,\x20%s,\x20%s'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x4cfb78,_0x4c1da6){_0x4cfb78=_0x4cfb78-0x0;var _0xc1250e=_0xbdb7[_0x4cfb78];return _0xc1250e;};'use strict';var _=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var moment=require(_0x7bdb('0x2'));var BPromise=require(_0x7bdb('0x3'));var rs=require(_0x7bdb('0x4'));var fs=require('fs');var Redis=require(_0x7bdb('0x5'));var db=require(_0x7bdb('0x6'))['db'];var utils=require(_0x7bdb('0x7'));var logger=require(_0x7bdb('0x8'))('rpc');var config=require(_0x7bdb('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7bdb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1e23a3,_0x493bde,_0x513cba){return new BPromise(function(_0x468041,_0x11a877){return client['request'](_0x1e23a3,_0x513cba)['then'](function(_0xdc2ffc){logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));logger[_0x7bdb('0xe')](_0x7bdb('0xf'),_0x493bde,_0x7bdb('0xd'),JSON[_0x7bdb('0x10')](_0xdc2ffc));if(_0xdc2ffc['error']){if(_0xdc2ffc['error']['code']===0x1f4){logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error'][_0x7bdb('0x12')]);return _0x11a877(_0xdc2ffc['error']['message']);}logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error']['message']);return _0x468041(_0xdc2ffc['error'][_0x7bdb('0x12')]);}else{logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));_0x468041(_0xdc2ffc[_0x7bdb('0x13')][_0x7bdb('0x12')]);}})[_0x7bdb('0x14')](function(_0x1b2d9b){logger['error'](_0x7bdb('0xc'),_0x493bde,_0x1b2d9b);_0x11a877(_0x1b2d9b);});});} \ No newline at end of file +var _0x668b=['bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util'];(function(_0x4e57df,_0xf08bd8){var _0x45a376=function(_0x4a0644){while(--_0x4a0644){_0x4e57df['push'](_0x4e57df['shift']());}};_0x45a376(++_0xf08bd8);}(_0x668b,0x140));var _0xb668=function(_0x2cde0a,_0x1f9695){_0x2cde0a=_0x2cde0a-0x0;var _0x260610=_0x668b[_0x2cde0a];return _0x260610;};'use strict';var _=require(_0xb668('0x0'));var util=require(_0xb668('0x1'));var moment=require('moment');var BPromise=require(_0xb668('0x2'));var rs=require(_0xb668('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb668('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xb668('0x5'))(_0xb668('0x6'));var config=require(_0xb668('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xb668('0x8')][_0xb668('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3be92e,_0x2778e9,_0x20b749){return new BPromise(function(_0x3f01bc,_0x517fc5){return client[_0xb668('0xa')](_0x3be92e,_0x20b749)[_0xb668('0xb')](function(_0x128cf5){logger[_0xb668('0xc')](_0xb668('0xd'),_0x2778e9,_0xb668('0xe'));logger[_0xb668('0xf')](_0xb668('0x10'),_0x2778e9,'request\x20sent',JSON[_0xb668('0x11')](_0x128cf5));if(_0x128cf5[_0xb668('0x12')]){if(_0x128cf5[_0xb668('0x12')][_0xb668('0x13')]===0x1f4){logger[_0xb668('0x12')](_0xb668('0xd'),_0x2778e9,_0x128cf5[_0xb668('0x12')][_0xb668('0x14')]);return _0x517fc5(_0x128cf5[_0xb668('0x12')][_0xb668('0x14')]);}logger[_0xb668('0x12')](_0xb668('0xd'),_0x2778e9,_0x128cf5[_0xb668('0x12')][_0xb668('0x14')]);return _0x3f01bc(_0x128cf5[_0xb668('0x12')][_0xb668('0x14')]);}else{logger[_0xb668('0xc')](_0xb668('0xd'),_0x2778e9,_0xb668('0xe'));_0x3f01bc(_0x128cf5[_0xb668('0x15')][_0xb668('0x14')]);}})[_0xb668('0x16')](function(_0x4ab137){logger[_0xb668('0x12')]('VoiceChanSpy,\x20%s,\x20%s',_0x2778e9,_0x4ab137);_0x517fc5(_0x4ab137);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 6e18f5c..0856b48 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 _0x8fc2=['post','create','put','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./voiceContext.controller','get','index','/:id','isAuthenticated','show'];(function(_0x3c7f9c,_0x597bde){var _0x2b10ad=function(_0x501925){while(--_0x501925){_0x3c7f9c['push'](_0x3c7f9c['shift']());}};_0x2b10ad(++_0x597bde);}(_0x8fc2,0x1eb));var _0x28fc=function(_0x35729f,_0x9997ea){_0x35729f=_0x35729f-0x0;var _0x473550=_0x8fc2[_0x35729f];return _0x473550;};'use strict';var multer=require(_0x28fc('0x0'));var util=require(_0x28fc('0x1'));var path=require(_0x28fc('0x2'));var timeout=require(_0x28fc('0x3'));var express=require('express');var router=express[_0x28fc('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x28fc('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x28fc('0x6'));var controller=require(_0x28fc('0x7'));router[_0x28fc('0x8')]('/',auth['isAuthenticated'](),controller[_0x28fc('0x9')]);router[_0x28fc('0x8')](_0x28fc('0xa'),auth[_0x28fc('0xb')](),controller[_0x28fc('0xc')]);router[_0x28fc('0xd')]('/',auth[_0x28fc('0xb')](),controller[_0x28fc('0xe')]);router[_0x28fc('0xf')](_0x28fc('0xa'),auth[_0x28fc('0xb')](),controller['update']);router[_0x28fc('0x10')](_0x28fc('0xa'),auth[_0x28fc('0xb')](),controller['destroy']);module[_0x28fc('0x11')]=router; \ No newline at end of file +var _0x149b=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceContext.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','multer','util'];(function(_0x7d7443,_0x1585b9){var _0x1e33e2=function(_0x401bc5){while(--_0x401bc5){_0x7d7443['push'](_0x7d7443['shift']());}};_0x1e33e2(++_0x1585b9);}(_0x149b,0x1d9));var _0xb149=function(_0x29bee5,_0x44545f){_0x29bee5=_0x29bee5-0x0;var _0x4686d4=_0x149b[_0x29bee5];return _0x4686d4;};'use strict';var multer=require(_0xb149('0x0'));var util=require(_0xb149('0x1'));var path=require('path');var timeout=require(_0xb149('0x2'));var express=require(_0xb149('0x3'));var router=express[_0xb149('0x4')]();var fs_extra=require(_0xb149('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xb149('0x6'));var config=require(_0xb149('0x7'));var controller=require(_0xb149('0x8'));router[_0xb149('0x9')]('/',auth[_0xb149('0xa')](),controller[_0xb149('0xb')]);router[_0xb149('0x9')](_0xb149('0xc'),auth[_0xb149('0xa')](),controller[_0xb149('0xd')]);router[_0xb149('0xe')]('/',auth['isAuthenticated'](),controller[_0xb149('0xf')]);router[_0xb149('0x10')](_0xb149('0xc'),auth[_0xb149('0xa')](),controller['update']);router[_0xb149('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xb149('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index ea521a5..e090529 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 _0xb734=['STRING','name'];(function(_0x101ef8,_0x576b43){var _0x10b3fb=function(_0x3a0d57){while(--_0x3a0d57){_0x101ef8['push'](_0x101ef8['shift']());}};_0x10b3fb(++_0x576b43);}(_0xb734,0x130));var _0x4b73=function(_0x21e79a,_0x5a7990){_0x21e79a=_0x21e79a-0x0;var _0x506c02=_0xb734[_0x21e79a];return _0x506c02;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x4b73('0x0')],'unique':_0x4b73('0x1')},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file +var _0x41a5=['exports','STRING','name','BOOLEAN'];(function(_0x2dfffc,_0x3411af){var _0xf9d20d=function(_0x137b78){while(--_0x137b78){_0x2dfffc['push'](_0x2dfffc['shift']());}};_0xf9d20d(++_0x3411af);}(_0x41a5,0x1c4));var _0x541a=function(_0x1f9744,_0x54a947){_0x1f9744=_0x1f9744-0x0;var _0x5aba67=_0x41a5[_0x1f9744];return _0x5aba67;};'use strict';var Sequelize=require('sequelize');module[_0x541a('0x0')]={'name':{'type':Sequelize[_0x541a('0x1')],'unique':_0x541a('0x2')},'description':{'type':Sequelize[_0x541a('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x541a('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index 3767e21..3377cc7 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 _0xfd9a=['VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','catch','status','json','offset','undefined','limit','count','set','apply','reject','update','destroy','get','Contexts','UserProfileResource','end','sendStatus','name','index','VoiceContext','rawAttributes','fieldName','key','map','keys','query','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','type','options','include','findAll','show','params','intersection','includeAll','find','create','body','join','root','server/files/templates/context.ejs','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','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','VoiceContext,\x20%s,\x20%s'];(function(_0x32292b,_0x4e9525){var _0x1845b4=function(_0x348377){while(--_0x348377){_0x32292b['push'](_0x32292b['shift']());}};_0x1845b4(++_0x4e9525);}(_0xfd9a,0x115));var _0xafd9=function(_0x45cc01,_0x2e635a){_0x45cc01=_0x45cc01-0x0;var _0x349d47=_0xfd9a[_0x45cc01];return _0x349d47;};'use strict';var emlformat=require(_0xafd9('0x0'));var rimraf=require(_0xafd9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xafd9('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xafd9('0x3'));var Mustache=require(_0xafd9('0x4'));var util=require(_0xafd9('0x5'));var path=require(_0xafd9('0x6'));var sox=require(_0xafd9('0x7'));var csv=require(_0xafd9('0x8'));var ejs=require(_0xafd9('0x9'));var fs=require('fs');var fs_extra=require(_0xafd9('0xa'));var _=require('lodash');var squel=require(_0xafd9('0xb'));var crypto=require(_0xafd9('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xafd9('0xd'));var toCsv=require(_0xafd9('0x8'));var querystring=require('querystring');var Papa=require(_0xafd9('0xe'));var Redis=require(_0xafd9('0xf'));var authService=require(_0xafd9('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xafd9('0x11'));var hardwareService=require(_0xafd9('0x12'));var logger=require(_0xafd9('0x13'))(_0xafd9('0x14'));var utils=require(_0xafd9('0x15'));var config=require(_0xafd9('0x16'));var licenseUtil=require(_0xafd9('0x17'));var db=require(_0xafd9('0x18'))['db'];var jayson=require(_0xafd9('0x19'));var client=jayson[_0xafd9('0x1a')][_0xafd9('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x9d0240,_0x74c5c6,_0xb495f2,_0x39b8d2){return new BPromise(function(_0x293029,_0x44e2d3){var _0x46fe51=_0x39b8d2||client;return _0x46fe51[_0xafd9('0x1c')](_0x9d0240,_0xb495f2)[_0xafd9('0x1d')](function(_0x7c52ff){logger[_0xafd9('0x1e')](_0xafd9('0x1f'),_0x74c5c6,'request\x20sent');logger['debug'](_0xafd9('0x20'),_0x74c5c6,_0xafd9('0x21'),JSON[_0xafd9('0x22')](_0x7c52ff));if(_0x7c52ff['error']){if(_0x7c52ff['error'][_0xafd9('0x23')]===0x1f4){logger['error'](_0xafd9('0x1f'),_0x74c5c6,_0x7c52ff[_0xafd9('0x24')][_0xafd9('0x25')]);return _0x44e2d3(_0x7c52ff[_0xafd9('0x24')][_0xafd9('0x25')]);}logger['error'](_0xafd9('0x1f'),_0x74c5c6,_0x7c52ff[_0xafd9('0x24')][_0xafd9('0x25')]);return _0x293029(_0x7c52ff['error']['message']);}else{logger[_0xafd9('0x1e')]('VoiceContext,\x20%s,\x20%s',_0x74c5c6,'request\x20sent');_0x293029(_0x7c52ff['result'][_0xafd9('0x25')]);}})[_0xafd9('0x26')](function(_0x5ac1af){logger[_0xafd9('0x24')](_0xafd9('0x1f'),_0x74c5c6,_0x5ac1af);_0x44e2d3(_0x5ac1af);});});}function respondWithStatusCode(_0x5550f0,_0x15549d){_0x15549d=_0x15549d||0xcc;return function(_0x104e73){if(_0x104e73){return _0x5550f0['sendStatus'](_0x15549d);}return _0x5550f0[_0xafd9('0x27')](_0x15549d)['end']();};}function respondWithResult(_0x46d0d4,_0x46e8a0){_0x46e8a0=_0x46e8a0||0xc8;return function(_0x12a313){if(_0x12a313){return _0x46d0d4['status'](_0x46e8a0)[_0xafd9('0x28')](_0x12a313);}};}function respondWithFilteredResult(_0x3e8a59,_0x2af5a2){return function(_0x11cb0a){if(_0x11cb0a){var _0x90699=typeof _0x2af5a2[_0xafd9('0x29')]===_0xafd9('0x2a')&&typeof _0x2af5a2[_0xafd9('0x2b')]==='undefined';var _0x41dcbc=_0x11cb0a['count'];var _0x1a7981=_0x90699?0x0:_0x2af5a2[_0xafd9('0x29')];var _0x4821b6=_0x90699?_0x11cb0a[_0xafd9('0x2c')]:_0x2af5a2['offset']+_0x2af5a2[_0xafd9('0x2b')];var _0x36514c;if(_0x4821b6>=_0x41dcbc){_0x4821b6=_0x41dcbc;_0x36514c=0xc8;}else{_0x36514c=0xce;}_0x3e8a59[_0xafd9('0x27')](_0x36514c);return _0x3e8a59[_0xafd9('0x2d')]('Content-Range',_0x1a7981+'-'+_0x4821b6+'/'+_0x41dcbc)[_0xafd9('0x28')](_0x11cb0a);}return null;};}function patchUpdates(_0x5015dc){return function(_0x159a59){try{jsonpatch[_0xafd9('0x2e')](_0x159a59,_0x5015dc,!![]);}catch(_0x5d685a){return BPromise[_0xafd9('0x2f')](_0x5d685a);}return _0x159a59['save']();};}function saveUpdates(_0x3bdafd,_0x318299){return function(_0x39b65a){if(_0x39b65a){return _0x39b65a[_0xafd9('0x30')](_0x3bdafd)[_0xafd9('0x1d')](function(_0x2598da){return _0x2598da;});}return null;};}function removeEntity(_0x1fd0c3,_0x21c22e){return function(_0x2411f9){if(_0x2411f9){return _0x2411f9[_0xafd9('0x31')]()[_0xafd9('0x1d')](function(){var _0x3eecf8=_0x2411f9[_0xafd9('0x32')]({'plain':!![]});var _0x544378=_0xafd9('0x33');return db[_0xafd9('0x34')][_0xafd9('0x31')]({'where':{'type':_0x544378,'resourceId':_0x3eecf8['id']}})['then'](function(){return _0x2411f9;});})[_0xafd9('0x1d')](function(){_0x1fd0c3[_0xafd9('0x27')](0xcc)[_0xafd9('0x35')]();});}};}function handleEntityNotFound(_0x25c40a,_0x2fdd18){return function(_0x1632b2){if(!_0x1632b2){_0x25c40a[_0xafd9('0x36')](0x194);}return _0x1632b2;};}function handleError(_0x424605,_0x2e3196){_0x2e3196=_0x2e3196||0x1f4;return function(_0x453006){logger['error'](_0x453006['stack']);if(_0x453006[_0xafd9('0x37')]){delete _0x453006['name'];}_0x424605['status'](_0x2e3196)['send'](_0x453006);};}exports[_0xafd9('0x38')]=function(_0x34f0fb,_0x27d88b){var _0x392606={},_0x3066e5={},_0x4b6d14={'count':0x0,'rows':[]};var _0x154657=_['map'](db[_0xafd9('0x39')][_0xafd9('0x3a')],function(_0x470682){return{'name':_0x470682[_0xafd9('0x3b')],'type':_0x470682['type'][_0xafd9('0x3c')]};});_0x3066e5['model']=_[_0xafd9('0x3d')](_0x154657,_0xafd9('0x37'));_0x3066e5['query']=_[_0xafd9('0x3e')](_0x34f0fb[_0xafd9('0x3f')]);_0x3066e5['filters']=_['intersection'](_0x3066e5[_0xafd9('0x40')],_0x3066e5[_0xafd9('0x3f')]);_0x392606[_0xafd9('0x41')]=_['intersection'](_0x3066e5[_0xafd9('0x40')],qs[_0xafd9('0x42')](_0x34f0fb[_0xafd9('0x3f')][_0xafd9('0x42')]));_0x392606['attributes']=_0x392606['attributes']['length']?_0x392606[_0xafd9('0x41')]:_0x3066e5[_0xafd9('0x40')];if(!_0x34f0fb[_0xafd9('0x3f')][_0xafd9('0x43')](_0xafd9('0x44'))){_0x392606[_0xafd9('0x2b')]=qs[_0xafd9('0x2b')](_0x34f0fb[_0xafd9('0x3f')][_0xafd9('0x2b')]);_0x392606[_0xafd9('0x29')]=qs[_0xafd9('0x29')](_0x34f0fb[_0xafd9('0x3f')][_0xafd9('0x29')]);}_0x392606[_0xafd9('0x45')]=qs[_0xafd9('0x46')](_0x34f0fb[_0xafd9('0x3f')][_0xafd9('0x46')]);_0x392606[_0xafd9('0x47')]=qs[_0xafd9('0x48')](_[_0xafd9('0x49')](_0x34f0fb['query'],_0x3066e5['filters']),_0x154657);if(_0x34f0fb[_0xafd9('0x3f')]['filter']){_0x392606[_0xafd9('0x47')]=_[_0xafd9('0x4a')](_0x392606['where'],{'$or':_[_0xafd9('0x3d')](_0x154657,function(_0x897145){if(_0x897145[_0xafd9('0x4b')]!=='VIRTUAL'){var _0x538653={};_0x538653[_0x897145[_0xafd9('0x37')]]={'$like':'%'+_0x34f0fb[_0xafd9('0x3f')]['filter']+'%'};return _0x538653;}})});}_0x392606=_['merge']({},_0x392606,_0x34f0fb[_0xafd9('0x4c')]);var _0x4a4845={'where':_0x392606['where']};return db[_0xafd9('0x39')]['count'](_0x4a4845)[_0xafd9('0x1d')](function(_0x4f6759){_0x4b6d14[_0xafd9('0x2c')]=_0x4f6759;if(_0x34f0fb[_0xafd9('0x3f')]['includeAll']){_0x392606[_0xafd9('0x4d')]=[{'all':!![]}];}return db[_0xafd9('0x39')][_0xafd9('0x4e')](_0x392606);})[_0xafd9('0x1d')](function(_0x551756){_0x4b6d14['rows']=_0x551756;return _0x4b6d14;})['then'](respondWithFilteredResult(_0x27d88b,_0x392606))[_0xafd9('0x26')](handleError(_0x27d88b,null));};exports[_0xafd9('0x4f')]=function(_0x211c24,_0xf395be){var _0x503c97={'raw':![],'where':{'id':_0x211c24[_0xafd9('0x50')]['id']}},_0x580784={};_0x580784['model']=_['keys'](db[_0xafd9('0x39')][_0xafd9('0x3a')]);_0x580784[_0xafd9('0x3f')]=_[_0xafd9('0x3e')](_0x211c24[_0xafd9('0x3f')]);_0x580784[_0xafd9('0x48')]=_[_0xafd9('0x51')](_0x580784['model'],_0x580784[_0xafd9('0x3f')]);_0x503c97[_0xafd9('0x41')]=_[_0xafd9('0x51')](_0x580784['model'],qs[_0xafd9('0x42')](_0x211c24[_0xafd9('0x3f')]['fields']));_0x503c97['attributes']=_0x503c97[_0xafd9('0x41')]['length']?_0x503c97[_0xafd9('0x41')]:_0x580784[_0xafd9('0x40')];if(_0x211c24[_0xafd9('0x3f')][_0xafd9('0x52')]){_0x503c97[_0xafd9('0x4d')]=[{'all':!![]}];}_0x503c97=_[_0xafd9('0x4a')]({},_0x503c97,_0x211c24[_0xafd9('0x4c')]);return db['VoiceContext'][_0xafd9('0x53')](_0x503c97)[_0xafd9('0x1d')](handleEntityNotFound(_0xf395be,null))[_0xafd9('0x1d')](respondWithResult(_0xf395be,null))[_0xafd9('0x26')](handleError(_0xf395be,null));};exports[_0xafd9('0x54')]=function(_0x359205,_0x3ce382,_0x42254b){var _0x3d1900;return db[_0xafd9('0x39')][_0xafd9('0x54')](_0x359205[_0xafd9('0x55')],{'raw':!![]})[_0xafd9('0x1d')](function(_0x5853d4){_0x3d1900=_0x5853d4;return db[_0xafd9('0x39')][_0xafd9('0x4e')]({'raw':!![]});})['then'](function(_0x10ee37){var _0x18743f=fs['readFileSync'](path[_0xafd9('0x56')](config[_0xafd9('0x57')],_0xafd9('0x58')),_0xafd9('0x59'));var _0x42c35d=ejs[_0xafd9('0x5a')](_0x18743f,{'contexts':_0x10ee37||[]});fs[_0xafd9('0x5b')](_0xafd9('0x5c'),_0x42c35d);})[_0xafd9('0x1d')](function(){return respondWithRpcPromise(_0xafd9('0x5d'),_0xafd9('0x54'),{'module':_0xafd9('0x5e')});})[_0xafd9('0x1d')](function(){var _0x33341a=_0x359205[_0xafd9('0x5f')][_0xafd9('0x32')]({'plain':!![]});if(!_0x33341a)throw new Error(_0xafd9('0x60'));if(_0x33341a[_0xafd9('0x61')]===_0xafd9('0x5f')){var _0x1d579d=_0x3d1900['get']({'plain':!![]});return db[_0xafd9('0x62')][_0xafd9('0x53')]({'where':{'name':_0xafd9('0x33'),'userProfileId':_0x33341a[_0xafd9('0x63')]},'raw':!![]})['then'](function(_0x469c07){if(_0x469c07&&_0x469c07[_0xafd9('0x64')]===0x0){return db[_0xafd9('0x34')][_0xafd9('0x54')]({'name':_0x1d579d[_0xafd9('0x37')],'resourceId':_0x1d579d['id'],'type':_0x469c07[_0xafd9('0x37')],'sectionId':_0x469c07['id']},{})[_0xafd9('0x1d')](function(){return _0x3d1900;});}else{return _0x3d1900;}})[_0xafd9('0x26')](function(_0x45331a){logger['error'](_0xafd9('0x65'),_0x45331a);throw _0x45331a;});}return _0x3d1900;})[_0xafd9('0x1d')](respondWithResult(_0x3ce382,0xc9))[_0xafd9('0x26')](handleError(_0x3ce382,null));};exports[_0xafd9('0x30')]=function(_0x1d1d9b,_0x3a4d2c,_0x4e8f2f){var _0x160142;return db[_0xafd9('0x39')][_0xafd9('0x53')]({'where':{'id':_0x1d1d9b[_0xafd9('0x50')]['id']}})['then'](handleEntityNotFound(_0x3a4d2c,null))[_0xafd9('0x1d')](saveUpdates(_0x1d1d9b['body'],null))[_0xafd9('0x1d')](function(_0x439856){if(_0x439856){_0x160142=_0x439856;return db[_0xafd9('0x39')][_0xafd9('0x4e')]({'raw':!![]});}})['then'](function(_0x55aef0){var _0x463626=fs['readFileSync'](path[_0xafd9('0x56')](config[_0xafd9('0x57')],_0xafd9('0x58')),_0xafd9('0x59'));var _0x56f0b7=ejs[_0xafd9('0x5a')](_0x463626,{'contexts':_0x55aef0||[]});fs[_0xafd9('0x5b')](_0xafd9('0x5c'),_0x56f0b7);})[_0xafd9('0x1d')](function(){return respondWithRpcPromise(_0xafd9('0x5d'),'update',{'module':_0xafd9('0x5e')});})[_0xafd9('0x1d')](function(){return _0x160142;})['then'](respondWithResult(_0x3a4d2c,null))[_0xafd9('0x26')](handleError(_0x3a4d2c,null));};exports[_0xafd9('0x31')]=function(_0x54406e,_0x145271,_0xe1d497){var _0x2e34e3;return db[_0xafd9('0x39')][_0xafd9('0x53')]({'where':{'id':_0x54406e['params']['id']}})[_0xafd9('0x1d')](handleEntityNotFound(_0x145271,null))[_0xafd9('0x1d')](removeEntity(_0x145271,null))['then'](function(){return db[_0xafd9('0x39')][_0xafd9('0x4e')]({'raw':!![]});})[_0xafd9('0x1d')](function(_0x10d86f){var _0x435ae5=fs[_0xafd9('0x66')](path[_0xafd9('0x56')](config[_0xafd9('0x57')],_0xafd9('0x58')),_0xafd9('0x59'));var _0x130356=ejs['render'](_0x435ae5,{'contexts':_0x10d86f});fs[_0xafd9('0x5b')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x130356);return respondWithRpcPromise(_0xafd9('0x5d'),_0xafd9('0x31'),{'module':'chan_sip.so'});})['catch'](handleError(_0x145271,null));}; \ No newline at end of file +var _0xe552=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','error','code','VoiceContext,\x20%s,\x20%s','message','info','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','then','get','Contexts','UserProfileResource','end','name','send','index','map','VoiceContext','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','find','create','readFileSync','join','server/files/templates/context.ejs','utf8','render','writeFileSync','Reload','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','body','root','/etc/asterisk/extensions_xcally_contexts.conf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xe552,0x12e));var _0x2e55=function(_0x5bedfd,_0x422984){_0x5bedfd=_0x5bedfd-0x0;var _0x1a6a95=_0xe552[_0x5bedfd];return _0x1a6a95;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2e55('0x0'));var zipdir=require(_0x2e55('0x1'));var jsonpatch=require(_0x2e55('0x2'));var rp=require('request-promise');var moment=require(_0x2e55('0x3'));var BPromise=require(_0x2e55('0x4'));var Mustache=require(_0x2e55('0x5'));var util=require(_0x2e55('0x6'));var path=require(_0x2e55('0x7'));var sox=require(_0x2e55('0x8'));var csv=require(_0x2e55('0x9'));var ejs=require(_0x2e55('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2e55('0xb'));var squel=require(_0x2e55('0xc'));var crypto=require(_0x2e55('0xd'));var jsforce=require(_0x2e55('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x2e55('0x9'));var querystring=require(_0x2e55('0xf'));var Papa=require(_0x2e55('0x10'));var Redis=require(_0x2e55('0x11'));var authService=require(_0x2e55('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2e55('0x13'));var logger=require(_0x2e55('0x14'))(_0x2e55('0x15'));var utils=require(_0x2e55('0x16'));var config=require(_0x2e55('0x17'));var licenseUtil=require(_0x2e55('0x18'));var db=require(_0x2e55('0x19'))['db'];var jayson=require(_0x2e55('0x1a'));var client=jayson[_0x2e55('0x1b')][_0x2e55('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x1027b9,_0x31325,_0x179302,_0x5e1c04){return new BPromise(function(_0x2b4b08,_0xc0d1aa){var _0x3e0957=_0x5e1c04||client;return _0x3e0957[_0x2e55('0x1d')](_0x1027b9,_0x179302)['then'](function(_0x2d9565){logger['info']('VoiceContext,\x20%s,\x20%s',_0x31325,_0x2e55('0x1e'));logger[_0x2e55('0x1f')](_0x2e55('0x20'),_0x31325,_0x2e55('0x1e'),JSON['stringify'](_0x2d9565));if(_0x2d9565['error']){if(_0x2d9565[_0x2e55('0x21')][_0x2e55('0x22')]===0x1f4){logger[_0x2e55('0x21')](_0x2e55('0x23'),_0x31325,_0x2d9565[_0x2e55('0x21')][_0x2e55('0x24')]);return _0xc0d1aa(_0x2d9565[_0x2e55('0x21')][_0x2e55('0x24')]);}logger[_0x2e55('0x21')]('VoiceContext,\x20%s,\x20%s',_0x31325,_0x2d9565[_0x2e55('0x21')][_0x2e55('0x24')]);return _0x2b4b08(_0x2d9565[_0x2e55('0x21')][_0x2e55('0x24')]);}else{logger[_0x2e55('0x25')](_0x2e55('0x23'),_0x31325,'request\x20sent');_0x2b4b08(_0x2d9565[_0x2e55('0x26')][_0x2e55('0x24')]);}})[_0x2e55('0x27')](function(_0x4e6112){logger[_0x2e55('0x21')](_0x2e55('0x23'),_0x31325,_0x4e6112);_0xc0d1aa(_0x4e6112);});});}function respondWithStatusCode(_0x46d8f7,_0x520f4a){_0x520f4a=_0x520f4a||0xcc;return function(_0x5c2ce5){if(_0x5c2ce5){return _0x46d8f7[_0x2e55('0x28')](_0x520f4a);}return _0x46d8f7[_0x2e55('0x29')](_0x520f4a)['end']();};}function respondWithResult(_0x515440,_0x1ab052){_0x1ab052=_0x1ab052||0xc8;return function(_0x338877){if(_0x338877){return _0x515440[_0x2e55('0x29')](_0x1ab052)[_0x2e55('0x2a')](_0x338877);}};}function respondWithFilteredResult(_0x3b5097,_0x3a5730){return function(_0x1397cd){if(_0x1397cd){var _0x57be75=typeof _0x3a5730[_0x2e55('0x2b')]===_0x2e55('0x2c')&&typeof _0x3a5730[_0x2e55('0x2d')]===_0x2e55('0x2c');var _0x29022e=_0x1397cd['count'];var _0x254c7c=_0x57be75?0x0:_0x3a5730[_0x2e55('0x2b')];var _0x2458c0=_0x57be75?_0x1397cd[_0x2e55('0x2e')]:_0x3a5730[_0x2e55('0x2b')]+_0x3a5730[_0x2e55('0x2d')];var _0x528319;if(_0x2458c0>=_0x29022e){_0x2458c0=_0x29022e;_0x528319=0xc8;}else{_0x528319=0xce;}_0x3b5097['status'](_0x528319);return _0x3b5097[_0x2e55('0x2f')]('Content-Range',_0x254c7c+'-'+_0x2458c0+'/'+_0x29022e)[_0x2e55('0x2a')](_0x1397cd);}return null;};}function patchUpdates(_0x4f0b62){return function(_0x157164){try{jsonpatch[_0x2e55('0x30')](_0x157164,_0x4f0b62,!![]);}catch(_0x59aa41){return BPromise[_0x2e55('0x31')](_0x59aa41);}return _0x157164[_0x2e55('0x32')]();};}function saveUpdates(_0x5c58cc,_0x44286a){return function(_0x422f81){if(_0x422f81){return _0x422f81[_0x2e55('0x33')](_0x5c58cc)['then'](function(_0x3c7bec){return _0x3c7bec;});}return null;};}function removeEntity(_0x48b244,_0x16cdfc){return function(_0x1e1e2e){if(_0x1e1e2e){return _0x1e1e2e[_0x2e55('0x34')]()[_0x2e55('0x35')](function(){var _0x49d2a0=_0x1e1e2e[_0x2e55('0x36')]({'plain':!![]});var _0x37fc71=_0x2e55('0x37');return db[_0x2e55('0x38')][_0x2e55('0x34')]({'where':{'type':_0x37fc71,'resourceId':_0x49d2a0['id']}})[_0x2e55('0x35')](function(){return _0x1e1e2e;});})[_0x2e55('0x35')](function(){_0x48b244['status'](0xcc)[_0x2e55('0x39')]();});}};}function handleEntityNotFound(_0x14ea61,_0x5a8eb2){return function(_0x32a90d){if(!_0x32a90d){_0x14ea61[_0x2e55('0x28')](0x194);}return _0x32a90d;};}function handleError(_0x29dd2d,_0x20fbb8){_0x20fbb8=_0x20fbb8||0x1f4;return function(_0x5b33d0){logger[_0x2e55('0x21')](_0x5b33d0['stack']);if(_0x5b33d0[_0x2e55('0x3a')]){delete _0x5b33d0[_0x2e55('0x3a')];}_0x29dd2d[_0x2e55('0x29')](_0x20fbb8)[_0x2e55('0x3b')](_0x5b33d0);};}exports[_0x2e55('0x3c')]=function(_0x567ba2,_0x3b4102){var _0x266c5d={},_0x42af36={},_0x4b4d75={'count':0x0,'rows':[]};var _0x273c10=_[_0x2e55('0x3d')](db[_0x2e55('0x3e')][_0x2e55('0x3f')],function(_0x21118e){return{'name':_0x21118e[_0x2e55('0x40')],'type':_0x21118e[_0x2e55('0x41')]['key']};});_0x42af36[_0x2e55('0x42')]=_[_0x2e55('0x3d')](_0x273c10,'name');_0x42af36[_0x2e55('0x43')]=_[_0x2e55('0x44')](_0x567ba2[_0x2e55('0x43')]);_0x42af36['filters']=_[_0x2e55('0x45')](_0x42af36['model'],_0x42af36[_0x2e55('0x43')]);_0x266c5d[_0x2e55('0x46')]=_[_0x2e55('0x45')](_0x42af36[_0x2e55('0x42')],qs[_0x2e55('0x47')](_0x567ba2[_0x2e55('0x43')][_0x2e55('0x47')]));_0x266c5d[_0x2e55('0x46')]=_0x266c5d[_0x2e55('0x46')][_0x2e55('0x48')]?_0x266c5d['attributes']:_0x42af36[_0x2e55('0x42')];if(!_0x567ba2['query'][_0x2e55('0x49')](_0x2e55('0x4a'))){_0x266c5d[_0x2e55('0x2d')]=qs[_0x2e55('0x2d')](_0x567ba2[_0x2e55('0x43')]['limit']);_0x266c5d[_0x2e55('0x2b')]=qs[_0x2e55('0x2b')](_0x567ba2[_0x2e55('0x43')]['offset']);}_0x266c5d[_0x2e55('0x4b')]=qs[_0x2e55('0x4c')](_0x567ba2[_0x2e55('0x43')]['sort']);_0x266c5d['where']=qs[_0x2e55('0x4d')](_[_0x2e55('0x4e')](_0x567ba2[_0x2e55('0x43')],_0x42af36['filters']),_0x273c10);if(_0x567ba2[_0x2e55('0x43')][_0x2e55('0x4f')]){_0x266c5d[_0x2e55('0x50')]=_[_0x2e55('0x51')](_0x266c5d[_0x2e55('0x50')],{'$or':_[_0x2e55('0x3d')](_0x273c10,function(_0x2b635d){if(_0x2b635d[_0x2e55('0x41')]!==_0x2e55('0x52')){var _0x338be2={};_0x338be2[_0x2b635d[_0x2e55('0x3a')]]={'$like':'%'+_0x567ba2['query']['filter']+'%'};return _0x338be2;}})});}_0x266c5d=_['merge']({},_0x266c5d,_0x567ba2[_0x2e55('0x53')]);var _0x41cd81={'where':_0x266c5d[_0x2e55('0x50')]};return db[_0x2e55('0x3e')][_0x2e55('0x2e')](_0x41cd81)[_0x2e55('0x35')](function(_0x592718){_0x4b4d75[_0x2e55('0x2e')]=_0x592718;if(_0x567ba2[_0x2e55('0x43')][_0x2e55('0x54')]){_0x266c5d[_0x2e55('0x55')]=[{'all':!![]}];}return db['VoiceContext'][_0x2e55('0x56')](_0x266c5d);})[_0x2e55('0x35')](function(_0x2647fc){_0x4b4d75[_0x2e55('0x57')]=_0x2647fc;return _0x4b4d75;})[_0x2e55('0x35')](respondWithFilteredResult(_0x3b4102,_0x266c5d))[_0x2e55('0x27')](handleError(_0x3b4102,null));};exports[_0x2e55('0x58')]=function(_0x5b5d86,_0x25cf88){var _0x253743={'raw':![],'where':{'id':_0x5b5d86['params']['id']}},_0x1cb2f5={};_0x1cb2f5[_0x2e55('0x42')]=_[_0x2e55('0x44')](db[_0x2e55('0x3e')][_0x2e55('0x3f')]);_0x1cb2f5[_0x2e55('0x43')]=_[_0x2e55('0x44')](_0x5b5d86[_0x2e55('0x43')]);_0x1cb2f5[_0x2e55('0x4d')]=_[_0x2e55('0x45')](_0x1cb2f5[_0x2e55('0x42')],_0x1cb2f5[_0x2e55('0x43')]);_0x253743[_0x2e55('0x46')]=_[_0x2e55('0x45')](_0x1cb2f5[_0x2e55('0x42')],qs['fields'](_0x5b5d86[_0x2e55('0x43')]['fields']));_0x253743[_0x2e55('0x46')]=_0x253743[_0x2e55('0x46')][_0x2e55('0x48')]?_0x253743[_0x2e55('0x46')]:_0x1cb2f5[_0x2e55('0x42')];if(_0x5b5d86[_0x2e55('0x43')][_0x2e55('0x54')]){_0x253743[_0x2e55('0x55')]=[{'all':!![]}];}_0x253743=_[_0x2e55('0x51')]({},_0x253743,_0x5b5d86[_0x2e55('0x53')]);return db[_0x2e55('0x3e')][_0x2e55('0x59')](_0x253743)[_0x2e55('0x35')](handleEntityNotFound(_0x25cf88,null))['then'](respondWithResult(_0x25cf88,null))[_0x2e55('0x27')](handleError(_0x25cf88,null));};exports[_0x2e55('0x5a')]=function(_0x302282,_0x5c6959,_0x5cd216){var _0x45ee75;return db[_0x2e55('0x3e')][_0x2e55('0x5a')](_0x302282['body'],{'raw':!![]})[_0x2e55('0x35')](function(_0x546150){_0x45ee75=_0x546150;return db[_0x2e55('0x3e')]['findAll']({'raw':!![]});})[_0x2e55('0x35')](function(_0x3d0d92){var _0x242354=fs[_0x2e55('0x5b')](path[_0x2e55('0x5c')](config['root'],_0x2e55('0x5d')),_0x2e55('0x5e'));var _0x331de5=ejs[_0x2e55('0x5f')](_0x242354,{'contexts':_0x3d0d92||[]});fs[_0x2e55('0x60')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x331de5);})[_0x2e55('0x35')](function(){return respondWithRpcPromise(_0x2e55('0x61'),_0x2e55('0x5a'),{'module':_0x2e55('0x62')});})[_0x2e55('0x35')](function(){var _0x2de2d4=_0x302282[_0x2e55('0x63')]['get']({'plain':!![]});if(!_0x2de2d4)throw new Error(_0x2e55('0x64'));if(_0x2de2d4[_0x2e55('0x65')]===_0x2e55('0x63')){var _0x17064e=_0x45ee75['get']({'plain':!![]});return db[_0x2e55('0x66')][_0x2e55('0x59')]({'where':{'name':_0x2e55('0x37'),'userProfileId':_0x2de2d4['userProfileId']},'raw':!![]})[_0x2e55('0x35')](function(_0x2f50b2){if(_0x2f50b2&&_0x2f50b2['autoAssociation']===0x0){return db[_0x2e55('0x38')][_0x2e55('0x5a')]({'name':_0x17064e['name'],'resourceId':_0x17064e['id'],'type':_0x2f50b2['name'],'sectionId':_0x2f50b2['id']},{})['then'](function(){return _0x45ee75;});}else{return _0x45ee75;}})[_0x2e55('0x27')](function(_0x3c1ed2){logger['error'](_0x2e55('0x67'),_0x3c1ed2);throw _0x3c1ed2;});}return _0x45ee75;})[_0x2e55('0x35')](respondWithResult(_0x5c6959,0xc9))['catch'](handleError(_0x5c6959,null));};exports['update']=function(_0x9a9843,_0xafd4fa,_0x521383){var _0x37c255;return db['VoiceContext']['find']({'where':{'id':_0x9a9843[_0x2e55('0x68')]['id']}})[_0x2e55('0x35')](handleEntityNotFound(_0xafd4fa,null))[_0x2e55('0x35')](saveUpdates(_0x9a9843[_0x2e55('0x69')],null))[_0x2e55('0x35')](function(_0x2db0a8){if(_0x2db0a8){_0x37c255=_0x2db0a8;return db['VoiceContext'][_0x2e55('0x56')]({'raw':!![]});}})['then'](function(_0x2aa506){var _0x340cf2=fs['readFileSync'](path['join'](config[_0x2e55('0x6a')],_0x2e55('0x5d')),_0x2e55('0x5e'));var _0x5d9d96=ejs['render'](_0x340cf2,{'contexts':_0x2aa506||[]});fs[_0x2e55('0x60')](_0x2e55('0x6b'),_0x5d9d96);})['then'](function(){return respondWithRpcPromise(_0x2e55('0x61'),_0x2e55('0x33'),{'module':_0x2e55('0x62')});})[_0x2e55('0x35')](function(){return _0x37c255;})[_0x2e55('0x35')](respondWithResult(_0xafd4fa,null))[_0x2e55('0x27')](handleError(_0xafd4fa,null));};exports['destroy']=function(_0x47027d,_0xadb52a,_0x4d6e07){var _0x111f28;return db[_0x2e55('0x3e')]['find']({'where':{'id':_0x47027d[_0x2e55('0x68')]['id']}})[_0x2e55('0x35')](handleEntityNotFound(_0xadb52a,null))[_0x2e55('0x35')](removeEntity(_0xadb52a,null))['then'](function(){return db['VoiceContext'][_0x2e55('0x56')]({'raw':!![]});})['then'](function(_0x269822){var _0x1b0eba=fs[_0x2e55('0x5b')](path[_0x2e55('0x5c')](config[_0x2e55('0x6a')],_0x2e55('0x5d')),'utf8');var _0xa2ca34=ejs['render'](_0x1b0eba,{'contexts':_0x269822});fs[_0x2e55('0x60')]('/etc/asterisk/extensions_xcally_contexts.conf',_0xa2ca34);return respondWithRpcPromise(_0x2e55('0x61'),_0x2e55('0x34'),{'module':_0x2e55('0x62')});})['catch'](handleError(_0xadb52a,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index bfb7231..60b47d4 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 _0x4e27=['request-promise','path','rimraf','./voiceContext.attributes','exports','define','voice_contexts','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x269112,_0x2d8b36){var _0x1d45c7=function(_0x57ab36){while(--_0x57ab36){_0x269112['push'](_0x269112['shift']());}};_0x1d45c7(++_0x2d8b36);}(_0x4e27,0x180));var _0x74e2=function(_0x1a30ab,_0x4993f6){_0x1a30ab=_0x1a30ab-0x0;var _0x3bf765=_0x4e27[_0x1a30ab];return _0x3bf765;};'use strict';var _=require(_0x74e2('0x0'));var util=require(_0x74e2('0x1'));var logger=require(_0x74e2('0x2'))(_0x74e2('0x3'));var moment=require(_0x74e2('0x4'));var BPromise=require(_0x74e2('0x5'));var rp=require(_0x74e2('0x6'));var fs=require('fs');var path=require(_0x74e2('0x7'));var rimraf=require(_0x74e2('0x8'));var config=require('../../config/environment');var attributes=require(_0x74e2('0x9'));module[_0x74e2('0xa')]=function(_0x3dad79,_0x22879b){return _0x3dad79[_0x74e2('0xb')]('VoiceContext',attributes,{'tableName':_0x74e2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x386e=['bluebird','request-promise','path','rimraf','./voiceContext.attributes','define','VoiceContext','voice_contexts','lodash','util','../../config/logger','api','moment'];(function(_0x3dd23c,_0x18c32f){var _0x520bf8=function(_0x462f87){while(--_0x462f87){_0x3dd23c['push'](_0x3dd23c['shift']());}};_0x520bf8(++_0x18c32f);}(_0x386e,0x1dc));var _0xe386=function(_0x5038e3,_0x29855b){_0x5038e3=_0x5038e3-0x0;var _0x593c8d=_0x386e[_0x5038e3];return _0x593c8d;};'use strict';var _=require(_0xe386('0x0'));var util=require(_0xe386('0x1'));var logger=require(_0xe386('0x2'))(_0xe386('0x3'));var moment=require(_0xe386('0x4'));var BPromise=require(_0xe386('0x5'));var rp=require(_0xe386('0x6'));var fs=require('fs');var path=require(_0xe386('0x7'));var rimraf=require(_0xe386('0x8'));var config=require('../../config/environment');var attributes=require(_0xe386('0x9'));module['exports']=function(_0x16ae6c,_0x4b2d98){return _0x16ae6c[_0xe386('0xa')](_0xe386('0xb'),attributes,{'tableName':_0xe386('0xc'),'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 bb78e00..7c6b7af 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 _0x1ae4=['error','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','debug','request\x20sent'];(function(_0x53afe9,_0x2c9f40){var _0x396396=function(_0x1f574d){while(--_0x1f574d){_0x53afe9['push'](_0x53afe9['shift']());}};_0x396396(++_0x2c9f40);}(_0x1ae4,0x114));var _0x41ae=function(_0x296fd2,_0x32ed7c){_0x296fd2=_0x296fd2-0x0;var _0xf0ff15=_0x1ae4[_0x296fd2];return _0xf0ff15;};'use strict';var _=require(_0x41ae('0x0'));var util=require(_0x41ae('0x1'));var moment=require(_0x41ae('0x2'));var BPromise=require('bluebird');var rs=require(_0x41ae('0x3'));var fs=require('fs');var Redis=require(_0x41ae('0x4'));var db=require(_0x41ae('0x5'))['db'];var utils=require(_0x41ae('0x6'));var logger=require(_0x41ae('0x7'))(_0x41ae('0x8'));var config=require(_0x41ae('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x41ae('0xa')][_0x41ae('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x41ae40,_0x2973bc,_0x533a15){return new BPromise(function(_0x12a66c,_0x4ff3d6){return client[_0x41ae('0xc')](_0x41ae40,_0x533a15)[_0x41ae('0xd')](function(_0x5f1096){logger[_0x41ae('0xe')](_0x41ae('0xf'),_0x2973bc,'request\x20sent');logger[_0x41ae('0x10')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x2973bc,_0x41ae('0x11'),JSON['stringify'](_0x5f1096));if(_0x5f1096[_0x41ae('0x12')]){if(_0x5f1096[_0x41ae('0x12')]['code']===0x1f4){logger[_0x41ae('0x12')]('VoiceContext,\x20%s,\x20%s',_0x2973bc,_0x5f1096[_0x41ae('0x12')][_0x41ae('0x13')]);return _0x4ff3d6(_0x5f1096[_0x41ae('0x12')][_0x41ae('0x13')]);}logger[_0x41ae('0x12')]('VoiceContext,\x20%s,\x20%s',_0x2973bc,_0x5f1096[_0x41ae('0x12')][_0x41ae('0x13')]);return _0x12a66c(_0x5f1096[_0x41ae('0x12')]['message']);}else{logger['info']('VoiceContext,\x20%s,\x20%s',_0x2973bc,'request\x20sent');_0x12a66c(_0x5f1096['result'][_0x41ae('0x13')]);}})[_0x41ae('0x14')](function(_0xbb7986){logger[_0x41ae('0x12')](_0x41ae('0xf'),_0x2973bc,_0xbb7986);_0x4ff3d6(_0xbb7986);});});} \ No newline at end of file +var _0x1bd1=['message','catch','lodash','util','moment','randomstring','rpc','../../config/environment','jayson/promise','client','then','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x248121,_0x257888){var _0x8a7ae=function(_0x81a34f){while(--_0x81a34f){_0x248121['push'](_0x248121['shift']());}};_0x8a7ae(++_0x257888);}(_0x1bd1,0x123));var _0x11bd=function(_0x541352,_0x29e495){_0x541352=_0x541352-0x0;var _0x27c954=_0x1bd1[_0x541352];return _0x27c954;};'use strict';var _=require(_0x11bd('0x0'));var util=require(_0x11bd('0x1'));var moment=require(_0x11bd('0x2'));var BPromise=require('bluebird');var rs=require(_0x11bd('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x11bd('0x4'));var config=require(_0x11bd('0x5'));var jayson=require(_0x11bd('0x6'));var client=jayson[_0x11bd('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x336255,_0x1f813c,_0x359f21){return new BPromise(function(_0x3940cf,_0x361ecf){return client['request'](_0x336255,_0x359f21)[_0x11bd('0x8')](function(_0x553727){logger['info'](_0x11bd('0x9'),_0x1f813c,_0x11bd('0xa'));logger[_0x11bd('0xb')](_0x11bd('0xc'),_0x1f813c,_0x11bd('0xa'),JSON[_0x11bd('0xd')](_0x553727));if(_0x553727[_0x11bd('0xe')]){if(_0x553727[_0x11bd('0xe')]['code']===0x1f4){logger[_0x11bd('0xe')](_0x11bd('0x9'),_0x1f813c,_0x553727[_0x11bd('0xe')][_0x11bd('0xf')]);return _0x361ecf(_0x553727[_0x11bd('0xe')][_0x11bd('0xf')]);}logger[_0x11bd('0xe')]('VoiceContext,\x20%s,\x20%s',_0x1f813c,_0x553727['error'][_0x11bd('0xf')]);return _0x3940cf(_0x553727[_0x11bd('0xe')][_0x11bd('0xf')]);}else{logger['info'](_0x11bd('0x9'),_0x1f813c,'request\x20sent');_0x3940cf(_0x553727['result'][_0x11bd('0xf')]);}})[_0x11bd('0x10')](function(_0xab4cde){logger[_0x11bd('0xe')](_0x11bd('0x9'),_0x1f813c,_0xab4cde);_0x361ecf(_0xab4cde);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 21a4954..eded27e 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 _0x43df=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','update','destroy','exports','util','path','express','Router'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x43df,0x1c8));var _0xf43d=function(_0x59fd31,_0x2b86c2){_0x59fd31=_0x59fd31-0x0;var _0x6f1c16=_0x43df[_0x59fd31];return _0x6f1c16;};'use strict';var multer=require('multer');var util=require(_0xf43d('0x0'));var path=require(_0xf43d('0x1'));var timeout=require('connect-timeout');var express=require(_0xf43d('0x2'));var router=express[_0xf43d('0x3')]();var fs_extra=require(_0xf43d('0x4'));var auth=require(_0xf43d('0x5'));var interaction=require(_0xf43d('0x6'));var config=require(_0xf43d('0x7'));var controller=require(_0xf43d('0x8'));router[_0xf43d('0x9')]('/',auth[_0xf43d('0xa')](),controller[_0xf43d('0xb')]);router[_0xf43d('0x9')](_0xf43d('0xc'),auth['isAuthenticated'](),controller[_0xf43d('0xd')]);router['get'](_0xf43d('0xe'),auth[_0xf43d('0xa')](),controller[_0xf43d('0xf')]);router['post']('/',auth[_0xf43d('0xa')](),controller[_0xf43d('0x10')]);router['put']('/:id',auth[_0xf43d('0xa')](),controller[_0xf43d('0x11')]);router['delete']('/:id',auth[_0xf43d('0xa')](),controller[_0xf43d('0x12')]);module[_0xf43d('0x13')]=router; \ No newline at end of file +var _0xa063=['describe','/:id','show','post','update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./voiceDialReport.controller','isAuthenticated','index','get'];(function(_0xe0c564,_0x2ff569){var _0x32e0f6=function(_0x3fd0fc){while(--_0x3fd0fc){_0xe0c564['push'](_0xe0c564['shift']());}};_0x32e0f6(++_0x2ff569);}(_0xa063,0x1ee));var _0x3a06=function(_0x22f69e,_0x56edb1){_0x22f69e=_0x22f69e-0x0;var _0x11751d=_0xa063[_0x22f69e];return _0x11751d;};'use strict';var multer=require(_0x3a06('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x3a06('0x1'));var express=require(_0x3a06('0x2'));var router=express[_0x3a06('0x3')]();var fs_extra=require(_0x3a06('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3a06('0x5'));var config=require('../../config/environment');var controller=require(_0x3a06('0x6'));router['get']('/',auth[_0x3a06('0x7')](),controller[_0x3a06('0x8')]);router[_0x3a06('0x9')]('/describe',auth[_0x3a06('0x7')](),controller[_0x3a06('0xa')]);router['get'](_0x3a06('0xb'),auth[_0x3a06('0x7')](),controller[_0x3a06('0xc')]);router[_0x3a06('0xd')]('/',auth[_0x3a06('0x7')](),controller['create']);router['put'](_0x3a06('0xb'),auth[_0x3a06('0x7')](),controller[_0x3a06('0xe')]);router[_0x3a06('0xf')](_0x3a06('0xb'),auth['isAuthenticated'](),controller[_0x3a06('0x10')]);module[_0x3a06('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 1a4bb35..68ea899 100644 --- a/server/api/voiceDialReport/voiceDialReport.attributes.js +++ b/server/api/voiceDialReport/voiceDialReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8ef6=['INTEGER','DATE','sequelize','exports','STRING'];(function(_0x28b0a1,_0x99bd0a){var _0x21470c=function(_0x45bf01){while(--_0x45bf01){_0x28b0a1['push'](_0x28b0a1['shift']());}};_0x21470c(++_0x99bd0a);}(_0x8ef6,0xf2));var _0x68ef=function(_0x369ada,_0x5f4c91){_0x369ada=_0x369ada-0x0;var _0x2c580f=_0x8ef6[_0x369ada];return _0x2c580f;};'use strict';var Sequelize=require(_0x68ef('0x0'));module[_0x68ef('0x1')]={'privilege':{'type':Sequelize[_0x68ef('0x2')]},'channel':{'type':Sequelize[_0x68ef('0x2')]},'channelstate':{'type':Sequelize[_0x68ef('0x3')]},'channelstatedesc':{'type':Sequelize[_0x68ef('0x2')]},'calleridnum':{'type':Sequelize[_0x68ef('0x2')]},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x68ef('0x2')]},'connectedlinename':{'type':Sequelize[_0x68ef('0x2')]},'language':{'type':Sequelize[_0x68ef('0x2')]},'accountcode':{'type':Sequelize[_0x68ef('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x68ef('0x3')]},'uniqueid':{'type':Sequelize[_0x68ef('0x2')]},'linkedid':{'type':Sequelize[_0x68ef('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x68ef('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x68ef('0x2')]},'destcalleridnum':{'type':Sequelize[_0x68ef('0x2')]},'destcalleridname':{'type':Sequelize[_0x68ef('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x68ef('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x68ef('0x2')]},'destlanguage':{'type':Sequelize[_0x68ef('0x2')]},'destaccountcode':{'type':Sequelize[_0x68ef('0x2')]},'destcontext':{'type':Sequelize[_0x68ef('0x2')]},'destexten':{'type':Sequelize[_0x68ef('0x2')]},'destpriority':{'type':Sequelize[_0x68ef('0x3')]},'destuniqueid':{'type':Sequelize[_0x68ef('0x2')]},'destlinkedid':{'type':Sequelize['STRING']},'dialstring':{'type':Sequelize[_0x68ef('0x2')]},'dialstatus':{'type':Sequelize[_0x68ef('0x2')]},'starttime':{'type':Sequelize[_0x68ef('0x4')]},'answertime':{'type':Sequelize[_0x68ef('0x4')]},'endtime':{'type':Sequelize[_0x68ef('0x4')]},'lastevent':{'type':Sequelize[_0x68ef('0x2')],'comment':'called,connect,complete'},'routeId':{'type':Sequelize[_0x68ef('0x3')]},'duration':{'type':Sequelize[_0x68ef('0x3')]},'holdtime':{'type':Sequelize[_0x68ef('0x3')]},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xedd9=['DATE','called,connect,complete','exports','STRING','INTEGER'];(function(_0x9b3084,_0x22e8ad){var _0x17db21=function(_0x5d1f7f){while(--_0x5d1f7f){_0x9b3084['push'](_0x9b3084['shift']());}};_0x17db21(++_0x22e8ad);}(_0xedd9,0xfc));var _0x9edd=function(_0x110832,_0x1bbf87){_0x110832=_0x110832-0x0;var _0x37e939=_0xedd9[_0x110832];return _0x37e939;};'use strict';var Sequelize=require('sequelize');module[_0x9edd('0x0')]={'privilege':{'type':Sequelize[_0x9edd('0x1')]},'channel':{'type':Sequelize[_0x9edd('0x1')]},'channelstate':{'type':Sequelize[_0x9edd('0x2')]},'channelstatedesc':{'type':Sequelize[_0x9edd('0x1')]},'calleridnum':{'type':Sequelize[_0x9edd('0x1')]},'calleridname':{'type':Sequelize[_0x9edd('0x1')]},'connectedlinenum':{'type':Sequelize[_0x9edd('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x9edd('0x1')]},'accountcode':{'type':Sequelize[_0x9edd('0x1')]},'context':{'type':Sequelize[_0x9edd('0x1')]},'exten':{'type':Sequelize[_0x9edd('0x1')]},'priority':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x9edd('0x1')]},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x9edd('0x1')]},'destchannelstate':{'type':Sequelize[_0x9edd('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x9edd('0x1')]},'destcalleridnum':{'type':Sequelize[_0x9edd('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x9edd('0x1')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x9edd('0x1')]},'destaccountcode':{'type':Sequelize[_0x9edd('0x1')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x9edd('0x1')]},'destpriority':{'type':Sequelize[_0x9edd('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'destlinkedid':{'type':Sequelize[_0x9edd('0x1')]},'dialstring':{'type':Sequelize[_0x9edd('0x1')]},'dialstatus':{'type':Sequelize[_0x9edd('0x1')]},'starttime':{'type':Sequelize[_0x9edd('0x3')]},'answertime':{'type':Sequelize[_0x9edd('0x3')]},'endtime':{'type':Sequelize[_0x9edd('0x3')]},'lastevent':{'type':Sequelize[_0x9edd('0x1')],'comment':_0x9edd('0x4')},'routeId':{'type':Sequelize['INTEGER']},'duration':{'type':Sequelize[_0x9edd('0x2')]},'holdtime':{'type':Sequelize[_0x9edd('0x2')]},'billableseconds':{'type':Sequelize[_0x9edd('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index cd4cdc8..db1c09e 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 _0x489f=['key','model','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','pick','filter','where','VIRTUAL','merge','options','includeAll','include','VoiceDialReport','catch','show','params','keys','create','body','destroy','describe','eml-format','zip-dir','fast-json-patch','request-promise','mustache','path','sox','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','end','error','stack','name','send','index','map','rawAttributes','type'];(function(_0x46fdbb,_0x217295){var _0x219d7e=function(_0x1350b8){while(--_0x1350b8){_0x46fdbb['push'](_0x46fdbb['shift']());}};_0x219d7e(++_0x217295);}(_0x489f,0x65));var _0xf489=function(_0x39c1d2,_0x5c6879){_0x39c1d2=_0x39c1d2-0x0;var _0x5934b8=_0x489f[_0x39c1d2];return _0x5934b8;};'use strict';var emlformat=require(_0xf489('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf489('0x1'));var jsonpatch=require(_0xf489('0x2'));var rp=require(_0xf489('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf489('0x4'));var util=require('util');var path=require(_0xf489('0x5'));var sox=require(_0xf489('0x6'));var csv=require('to-csv');var ejs=require(_0xf489('0x7'));var fs=require('fs');var fs_extra=require(_0xf489('0x8'));var _=require(_0xf489('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xf489('0xa'));var deskjs=require(_0xf489('0xb'));var toCsv=require(_0xf489('0xc'));var querystring=require(_0xf489('0xd'));var Papa=require('papaparse');var Redis=require(_0xf489('0xe'));var authService=require(_0xf489('0xf'));var qs=require(_0xf489('0x10'));var as=require(_0xf489('0x11'));var hardwareService=require(_0xf489('0x12'));var logger=require(_0xf489('0x13'))(_0xf489('0x14'));var utils=require(_0xf489('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf489('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5cd8d2,_0x3ce411){_0x3ce411=_0x3ce411||0xcc;return function(_0x1785f9){if(_0x1785f9){return _0x5cd8d2[_0xf489('0x17')](_0x3ce411);}return _0x5cd8d2[_0xf489('0x18')](_0x3ce411)['end']();};}function respondWithResult(_0x5a1e61,_0x529bf0){_0x529bf0=_0x529bf0||0xc8;return function(_0x3c9747){if(_0x3c9747){return _0x5a1e61['status'](_0x529bf0)[_0xf489('0x19')](_0x3c9747);}};}function respondWithFilteredResult(_0x321158,_0x30d284){return function(_0x4422a8){if(_0x4422a8){var _0x3bc1c1=typeof _0x30d284['offset']===_0xf489('0x1a')&&typeof _0x30d284[_0xf489('0x1b')]===_0xf489('0x1a');var _0x41641c=_0x4422a8[_0xf489('0x1c')];var _0x15cb66=_0x3bc1c1?0x0:_0x30d284[_0xf489('0x1d')];var _0x3cbabf=_0x3bc1c1?_0x4422a8[_0xf489('0x1c')]:_0x30d284[_0xf489('0x1d')]+_0x30d284[_0xf489('0x1b')];var _0x5214e8;if(_0x3cbabf>=_0x41641c){_0x3cbabf=_0x41641c;_0x5214e8=0xc8;}else{_0x5214e8=0xce;}_0x321158['status'](_0x5214e8);return _0x321158[_0xf489('0x1e')](_0xf489('0x1f'),_0x15cb66+'-'+_0x3cbabf+'/'+_0x41641c)['json'](_0x4422a8);}return null;};}function patchUpdates(_0x3ac2d5){return function(_0xed4220){try{jsonpatch['apply'](_0xed4220,_0x3ac2d5,!![]);}catch(_0x4275ba){return BPromise[_0xf489('0x20')](_0x4275ba);}return _0xed4220[_0xf489('0x21')]();};}function saveUpdates(_0x2ed708,_0x3b58d3){return function(_0x10e8ed){if(_0x10e8ed){return _0x10e8ed[_0xf489('0x22')](_0x2ed708)[_0xf489('0x23')](function(_0x47a986){return _0x47a986;});}return null;};}function removeEntity(_0x1f7eed,_0x27d61b){return function(_0x2527e3){if(_0x2527e3){return _0x2527e3['destroy']()[_0xf489('0x23')](function(){_0x1f7eed['status'](0xcc)[_0xf489('0x24')]();});}};}function handleEntityNotFound(_0x2d3f0d,_0x5b3f89){return function(_0x144ad6){if(!_0x144ad6){_0x2d3f0d[_0xf489('0x17')](0x194);}return _0x144ad6;};}function handleError(_0x32b1e9,_0x3c4f6a){_0x3c4f6a=_0x3c4f6a||0x1f4;return function(_0x378efb){logger[_0xf489('0x25')](_0x378efb[_0xf489('0x26')]);if(_0x378efb[_0xf489('0x27')]){delete _0x378efb[_0xf489('0x27')];}_0x32b1e9[_0xf489('0x18')](_0x3c4f6a)[_0xf489('0x28')](_0x378efb);};}exports[_0xf489('0x29')]=function(_0x19f9dd,_0x3c9095){var _0x4c3970={},_0x5cd660={},_0x3b4d56={'count':0x0,'rows':[]};var _0x201bed=_[_0xf489('0x2a')](db['VoiceDialReport'][_0xf489('0x2b')],function(_0x797a83){return{'name':_0x797a83['fieldName'],'type':_0x797a83[_0xf489('0x2c')][_0xf489('0x2d')]};});_0x5cd660[_0xf489('0x2e')]=_[_0xf489('0x2a')](_0x201bed,_0xf489('0x27'));_0x5cd660[_0xf489('0x2f')]=_['keys'](_0x19f9dd[_0xf489('0x2f')]);_0x5cd660['filters']=_[_0xf489('0x30')](_0x5cd660['model'],_0x5cd660[_0xf489('0x2f')]);_0x4c3970[_0xf489('0x31')]=_[_0xf489('0x30')](_0x5cd660['model'],qs[_0xf489('0x32')](_0x19f9dd[_0xf489('0x2f')]['fields']));_0x4c3970[_0xf489('0x31')]=_0x4c3970[_0xf489('0x31')][_0xf489('0x33')]?_0x4c3970[_0xf489('0x31')]:_0x5cd660[_0xf489('0x2e')];if(!_0x19f9dd[_0xf489('0x2f')][_0xf489('0x34')]('nolimit')){_0x4c3970[_0xf489('0x1b')]=qs[_0xf489('0x1b')](_0x19f9dd[_0xf489('0x2f')][_0xf489('0x1b')]);_0x4c3970[_0xf489('0x1d')]=qs[_0xf489('0x1d')](_0x19f9dd[_0xf489('0x2f')][_0xf489('0x1d')]);}_0x4c3970[_0xf489('0x35')]=qs[_0xf489('0x36')](_0x19f9dd[_0xf489('0x2f')][_0xf489('0x36')]);_0x4c3970['where']=qs[_0xf489('0x37')](_[_0xf489('0x38')](_0x19f9dd['query'],_0x5cd660['filters']),_0x201bed);if(_0x19f9dd[_0xf489('0x2f')][_0xf489('0x39')]){_0x4c3970[_0xf489('0x3a')]=_['merge'](_0x4c3970[_0xf489('0x3a')],{'$or':_['map'](_0x201bed,function(_0x40fa0d){if(_0x40fa0d[_0xf489('0x2c')]!==_0xf489('0x3b')){var _0x553f08={};_0x553f08[_0x40fa0d[_0xf489('0x27')]]={'$like':'%'+_0x19f9dd[_0xf489('0x2f')]['filter']+'%'};return _0x553f08;}})});}_0x4c3970=_[_0xf489('0x3c')]({},_0x4c3970,_0x19f9dd[_0xf489('0x3d')]);var _0x4e4100={'where':_0x4c3970[_0xf489('0x3a')]};return db['VoiceDialReport'][_0xf489('0x1c')](_0x4e4100)[_0xf489('0x23')](function(_0x55e0cd){_0x3b4d56[_0xf489('0x1c')]=_0x55e0cd;if(_0x19f9dd[_0xf489('0x2f')][_0xf489('0x3e')]){_0x4c3970[_0xf489('0x3f')]=[{'all':!![]}];}return db[_0xf489('0x40')]['findAll'](_0x4c3970);})[_0xf489('0x23')](function(_0x186312){_0x3b4d56['rows']=_0x186312;return _0x3b4d56;})['then'](respondWithFilteredResult(_0x3c9095,_0x4c3970))[_0xf489('0x41')](handleError(_0x3c9095,null));};exports[_0xf489('0x42')]=function(_0x2b2474,_0x579fdd){var _0x2523ac={'raw':!![],'where':{'id':_0x2b2474[_0xf489('0x43')]['id']}},_0x566e3a={};_0x566e3a[_0xf489('0x2e')]=_[_0xf489('0x44')](db[_0xf489('0x40')][_0xf489('0x2b')]);_0x566e3a[_0xf489('0x2f')]=_[_0xf489('0x44')](_0x2b2474['query']);_0x566e3a['filters']=_[_0xf489('0x30')](_0x566e3a[_0xf489('0x2e')],_0x566e3a[_0xf489('0x2f')]);_0x2523ac[_0xf489('0x31')]=_[_0xf489('0x30')](_0x566e3a[_0xf489('0x2e')],qs[_0xf489('0x32')](_0x2b2474[_0xf489('0x2f')][_0xf489('0x32')]));_0x2523ac[_0xf489('0x31')]=_0x2523ac[_0xf489('0x31')]['length']?_0x2523ac[_0xf489('0x31')]:_0x566e3a[_0xf489('0x2e')];if(_0x2b2474['query'][_0xf489('0x3e')]){_0x2523ac[_0xf489('0x3f')]=[{'all':!![]}];}_0x2523ac=_[_0xf489('0x3c')]({},_0x2523ac,_0x2b2474['options']);return db[_0xf489('0x40')]['find'](_0x2523ac)[_0xf489('0x23')](handleEntityNotFound(_0x579fdd,null))[_0xf489('0x23')](respondWithResult(_0x579fdd,null))[_0xf489('0x41')](handleError(_0x579fdd,null));};exports[_0xf489('0x45')]=function(_0x42458f,_0x30247e){return db[_0xf489('0x40')][_0xf489('0x45')](_0x42458f['body'],{})[_0xf489('0x23')](respondWithResult(_0x30247e,0xc9))[_0xf489('0x41')](handleError(_0x30247e,null));};exports[_0xf489('0x22')]=function(_0x44f34b,_0x3b7969){if(_0x44f34b['body']['id']){delete _0x44f34b[_0xf489('0x46')]['id'];}return db[_0xf489('0x40')]['find']({'where':{'id':_0x44f34b[_0xf489('0x43')]['id']}})['then'](handleEntityNotFound(_0x3b7969,null))[_0xf489('0x23')](saveUpdates(_0x44f34b[_0xf489('0x46')],null))[_0xf489('0x23')](respondWithResult(_0x3b7969,null))[_0xf489('0x41')](handleError(_0x3b7969,null));};exports[_0xf489('0x47')]=function(_0x3a8cf0,_0x5c3be9){return db[_0xf489('0x40')]['find']({'where':{'id':_0x3a8cf0[_0xf489('0x43')]['id']}})[_0xf489('0x23')](handleEntityNotFound(_0x5c3be9,null))[_0xf489('0x23')](removeEntity(_0x5c3be9,null))[_0xf489('0x41')](handleError(_0x5c3be9,null));};exports[_0xf489('0x48')]=function(_0xc9484f,_0x27b738){return db[_0xf489('0x40')]['describe']()[_0xf489('0x23')](respondWithResult(_0x27b738,null))[_0xf489('0x41')](handleError(_0x27b738,null));}; \ No newline at end of file +var _0x949a=['fs-extra','lodash','squel','jsforce','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','count','set','Content-Range','json','apply','reject','save','update','then','stack','name','send','index','map','VoiceDialReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','findAll','rows','show','params','includeAll','include','find','catch','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','ejs'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x949a,0x11f));var _0xa949=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x949a[_0x122ef9];return _0x42fba0;};'use strict';var emlformat=require(_0xa949('0x0'));var rimraf=require(_0xa949('0x1'));var zipdir=require(_0xa949('0x2'));var jsonpatch=require(_0xa949('0x3'));var rp=require(_0xa949('0x4'));var moment=require(_0xa949('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xa949('0x6'));var util=require('util');var path=require(_0xa949('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa949('0x8'));var fs=require('fs');var fs_extra=require(_0xa949('0x9'));var _=require(_0xa949('0xa'));var squel=require(_0xa949('0xb'));var crypto=require('crypto');var jsforce=require(_0xa949('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa949('0xd'));var querystring=require(_0xa949('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa949('0xf'));var qs=require(_0xa949('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa949('0x11'));var logger=require(_0xa949('0x12'))('api');var utils=require(_0xa949('0x13'));var config=require(_0xa949('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xa949('0x15'))['db'];function respondWithStatusCode(_0x381da5,_0xabdc30){_0xabdc30=_0xabdc30||0xcc;return function(_0x5dca9d){if(_0x5dca9d){return _0x381da5[_0xa949('0x16')](_0xabdc30);}return _0x381da5[_0xa949('0x17')](_0xabdc30)[_0xa949('0x18')]();};}function respondWithResult(_0x4a8976,_0x25f3e5){_0x25f3e5=_0x25f3e5||0xc8;return function(_0xafc9ea){if(_0xafc9ea){return _0x4a8976[_0xa949('0x17')](_0x25f3e5)['json'](_0xafc9ea);}};}function respondWithFilteredResult(_0x28b457,_0x5e37f9){return function(_0x1ae76f){if(_0x1ae76f){var _0x2b202c=typeof _0x5e37f9[_0xa949('0x19')]==='undefined'&&typeof _0x5e37f9[_0xa949('0x1a')]==='undefined';var _0x31005f=_0x1ae76f['count'];var _0x330708=_0x2b202c?0x0:_0x5e37f9['offset'];var _0x4e2d09=_0x2b202c?_0x1ae76f[_0xa949('0x1b')]:_0x5e37f9[_0xa949('0x19')]+_0x5e37f9[_0xa949('0x1a')];var _0x399cbf;if(_0x4e2d09>=_0x31005f){_0x4e2d09=_0x31005f;_0x399cbf=0xc8;}else{_0x399cbf=0xce;}_0x28b457['status'](_0x399cbf);return _0x28b457[_0xa949('0x1c')](_0xa949('0x1d'),_0x330708+'-'+_0x4e2d09+'/'+_0x31005f)[_0xa949('0x1e')](_0x1ae76f);}return null;};}function patchUpdates(_0x13417d){return function(_0x794acb){try{jsonpatch[_0xa949('0x1f')](_0x794acb,_0x13417d,!![]);}catch(_0x536ba9){return BPromise[_0xa949('0x20')](_0x536ba9);}return _0x794acb[_0xa949('0x21')]();};}function saveUpdates(_0x11e587,_0x24c2b6){return function(_0x50b53b){if(_0x50b53b){return _0x50b53b[_0xa949('0x22')](_0x11e587)[_0xa949('0x23')](function(_0xe48129){return _0xe48129;});}return null;};}function removeEntity(_0x2cdbba,_0x28292a){return function(_0x47ac8e){if(_0x47ac8e){return _0x47ac8e['destroy']()[_0xa949('0x23')](function(){_0x2cdbba['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4bbb69,_0x44c4c7){return function(_0x4818de){if(!_0x4818de){_0x4bbb69[_0xa949('0x16')](0x194);}return _0x4818de;};}function handleError(_0x4d3a2d,_0x5d58af){_0x5d58af=_0x5d58af||0x1f4;return function(_0x359a47){logger['error'](_0x359a47[_0xa949('0x24')]);if(_0x359a47['name']){delete _0x359a47[_0xa949('0x25')];}_0x4d3a2d[_0xa949('0x17')](_0x5d58af)[_0xa949('0x26')](_0x359a47);};}exports[_0xa949('0x27')]=function(_0x4e4c01,_0x2a1fea){var _0x1a85c3={},_0x45bfd9={},_0x3f0932={'count':0x0,'rows':[]};var _0xe9ebd6=_[_0xa949('0x28')](db[_0xa949('0x29')][_0xa949('0x2a')],function(_0x19a5e0){return{'name':_0x19a5e0[_0xa949('0x2b')],'type':_0x19a5e0[_0xa949('0x2c')]['key']};});_0x45bfd9[_0xa949('0x2d')]=_['map'](_0xe9ebd6,_0xa949('0x25'));_0x45bfd9[_0xa949('0x2e')]=_[_0xa949('0x2f')](_0x4e4c01[_0xa949('0x2e')]);_0x45bfd9[_0xa949('0x30')]=_[_0xa949('0x31')](_0x45bfd9[_0xa949('0x2d')],_0x45bfd9['query']);_0x1a85c3['attributes']=_[_0xa949('0x31')](_0x45bfd9['model'],qs[_0xa949('0x32')](_0x4e4c01[_0xa949('0x2e')]['fields']));_0x1a85c3['attributes']=_0x1a85c3[_0xa949('0x33')][_0xa949('0x34')]?_0x1a85c3[_0xa949('0x33')]:_0x45bfd9['model'];if(!_0x4e4c01[_0xa949('0x2e')][_0xa949('0x35')](_0xa949('0x36'))){_0x1a85c3[_0xa949('0x1a')]=qs[_0xa949('0x1a')](_0x4e4c01['query'][_0xa949('0x1a')]);_0x1a85c3[_0xa949('0x19')]=qs['offset'](_0x4e4c01[_0xa949('0x2e')][_0xa949('0x19')]);}_0x1a85c3[_0xa949('0x37')]=qs['sort'](_0x4e4c01['query'][_0xa949('0x38')]);_0x1a85c3[_0xa949('0x39')]=qs[_0xa949('0x30')](_[_0xa949('0x3a')](_0x4e4c01[_0xa949('0x2e')],_0x45bfd9[_0xa949('0x30')]),_0xe9ebd6);if(_0x4e4c01[_0xa949('0x2e')][_0xa949('0x3b')]){_0x1a85c3[_0xa949('0x39')]=_[_0xa949('0x3c')](_0x1a85c3['where'],{'$or':_[_0xa949('0x28')](_0xe9ebd6,function(_0xe328d2){if(_0xe328d2[_0xa949('0x2c')]!==_0xa949('0x3d')){var _0x3ffe5f={};_0x3ffe5f[_0xe328d2[_0xa949('0x25')]]={'$like':'%'+_0x4e4c01[_0xa949('0x2e')]['filter']+'%'};return _0x3ffe5f;}})});}_0x1a85c3=_[_0xa949('0x3c')]({},_0x1a85c3,_0x4e4c01['options']);var _0xd596f8={'where':_0x1a85c3[_0xa949('0x39')]};return db[_0xa949('0x29')][_0xa949('0x1b')](_0xd596f8)[_0xa949('0x23')](function(_0x2a1bd6){_0x3f0932['count']=_0x2a1bd6;if(_0x4e4c01[_0xa949('0x2e')]['includeAll']){_0x1a85c3['include']=[{'all':!![]}];}return db[_0xa949('0x29')][_0xa949('0x3e')](_0x1a85c3);})[_0xa949('0x23')](function(_0x4277dd){_0x3f0932[_0xa949('0x3f')]=_0x4277dd;return _0x3f0932;})[_0xa949('0x23')](respondWithFilteredResult(_0x2a1fea,_0x1a85c3))['catch'](handleError(_0x2a1fea,null));};exports[_0xa949('0x40')]=function(_0x1716ac,_0x338e0b){var _0x7d0b09={'raw':!![],'where':{'id':_0x1716ac[_0xa949('0x41')]['id']}},_0x530382={};_0x530382['model']=_[_0xa949('0x2f')](db['VoiceDialReport'][_0xa949('0x2a')]);_0x530382[_0xa949('0x2e')]=_['keys'](_0x1716ac['query']);_0x530382[_0xa949('0x30')]=_['intersection'](_0x530382[_0xa949('0x2d')],_0x530382[_0xa949('0x2e')]);_0x7d0b09['attributes']=_['intersection'](_0x530382[_0xa949('0x2d')],qs[_0xa949('0x32')](_0x1716ac[_0xa949('0x2e')][_0xa949('0x32')]));_0x7d0b09['attributes']=_0x7d0b09[_0xa949('0x33')][_0xa949('0x34')]?_0x7d0b09['attributes']:_0x530382[_0xa949('0x2d')];if(_0x1716ac[_0xa949('0x2e')][_0xa949('0x42')]){_0x7d0b09[_0xa949('0x43')]=[{'all':!![]}];}_0x7d0b09=_['merge']({},_0x7d0b09,_0x1716ac['options']);return db[_0xa949('0x29')][_0xa949('0x44')](_0x7d0b09)[_0xa949('0x23')](handleEntityNotFound(_0x338e0b,null))[_0xa949('0x23')](respondWithResult(_0x338e0b,null))[_0xa949('0x45')](handleError(_0x338e0b,null));};exports[_0xa949('0x46')]=function(_0x2b4910,_0x236afb){return db[_0xa949('0x29')][_0xa949('0x46')](_0x2b4910[_0xa949('0x47')],{})[_0xa949('0x23')](respondWithResult(_0x236afb,0xc9))['catch'](handleError(_0x236afb,null));};exports[_0xa949('0x22')]=function(_0x515a28,_0x467b55){if(_0x515a28[_0xa949('0x47')]['id']){delete _0x515a28[_0xa949('0x47')]['id'];}return db[_0xa949('0x29')][_0xa949('0x44')]({'where':{'id':_0x515a28[_0xa949('0x41')]['id']}})[_0xa949('0x23')](handleEntityNotFound(_0x467b55,null))[_0xa949('0x23')](saveUpdates(_0x515a28[_0xa949('0x47')],null))[_0xa949('0x23')](respondWithResult(_0x467b55,null))[_0xa949('0x45')](handleError(_0x467b55,null));};exports[_0xa949('0x48')]=function(_0x217ef3,_0x3981dd){return db['VoiceDialReport'][_0xa949('0x44')]({'where':{'id':_0x217ef3[_0xa949('0x41')]['id']}})[_0xa949('0x23')](handleEntityNotFound(_0x3981dd,null))['then'](removeEntity(_0x3981dd,null))[_0xa949('0x45')](handleError(_0x3981dd,null));};exports[_0xa949('0x49')]=function(_0x518247,_0x607570){return db[_0xa949('0x29')][_0xa949('0x49')]()['then'](respondWithResult(_0x607570,null))[_0xa949('0x45')](handleError(_0x607570,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index da27830..587771c 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 _0x0160=['define','VoiceDialReport','report_dial','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceDialReport.attributes','exports'];(function(_0x37f181,_0x34c4ea){var _0x4149a9=function(_0x418e46){while(--_0x418e46){_0x37f181['push'](_0x37f181['shift']());}};_0x4149a9(++_0x34c4ea);}(_0x0160,0x16c));var _0x0016=function(_0x37ded3,_0x371ebb){_0x37ded3=_0x37ded3-0x0;var _0x51e49e=_0x0160[_0x37ded3];return _0x51e49e;};'use strict';var _=require('lodash');var util=require(_0x0016('0x0'));var logger=require(_0x0016('0x1'))(_0x0016('0x2'));var moment=require(_0x0016('0x3'));var BPromise=require(_0x0016('0x4'));var rp=require(_0x0016('0x5'));var fs=require('fs');var path=require(_0x0016('0x6'));var rimraf=require(_0x0016('0x7'));var config=require(_0x0016('0x8'));var attributes=require(_0x0016('0x9'));module[_0x0016('0xa')]=function(_0x20ffe3,_0x5e54a2){return _0x20ffe3[_0x0016('0xb')](_0x0016('0xc'),attributes,{'tableName':_0x0016('0xd'),'paranoid':![],'indexes':[{'fields':[_0x0016('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x24bf=['bluebird','request-promise','path','../../config/environment','VoiceDialReport','report_dial','uniqueid','lodash','util','../../config/logger','moment'];(function(_0x1ded35,_0x48b9b6){var _0x169b3d=function(_0xb6c8a3){while(--_0xb6c8a3){_0x1ded35['push'](_0x1ded35['shift']());}};_0x169b3d(++_0x48b9b6);}(_0x24bf,0xee));var _0xf24b=function(_0x18443a,_0x1fbf92){_0x18443a=_0x18443a-0x0;var _0x351570=_0x24bf[_0x18443a];return _0x351570;};'use strict';var _=require(_0xf24b('0x0'));var util=require(_0xf24b('0x1'));var logger=require(_0xf24b('0x2'))('api');var moment=require(_0xf24b('0x3'));var BPromise=require(_0xf24b('0x4'));var rp=require(_0xf24b('0x5'));var fs=require('fs');var path=require(_0xf24b('0x6'));var rimraf=require('rimraf');var config=require(_0xf24b('0x7'));var attributes=require('./voiceDialReport.attributes');module['exports']=function(_0x532bbe,_0x52a62e){return _0x532bbe['define'](_0xf24b('0x8'),attributes,{'tableName':_0xf24b('0x9'),'paranoid':![],'indexes':[{'fields':[_0xf24b('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 326fea3..001bf93 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 _0x482b=['error','message','result','catch','CreateVoiceDialReport','VoiceDialReport','body','options','raw','UpdateVoiceDialReport','update','where','attributes','debug','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x460f7d,_0x77abbd){var _0x5ac693=function(_0x202431){while(--_0x202431){_0x460f7d['push'](_0x460f7d['shift']());}};_0x5ac693(++_0x77abbd);}(_0x482b,0x163));var _0xb482=function(_0x5e6dda,_0x597bd4){_0x5e6dda=_0x5e6dda-0x0;var _0x56d46e=_0x482b[_0x5e6dda];return _0x56d46e;};'use strict';var _=require(_0xb482('0x0'));var util=require(_0xb482('0x1'));var moment=require(_0xb482('0x2'));var BPromise=require(_0xb482('0x3'));var rs=require(_0xb482('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb482('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb482('0x6'))('rpc');var config=require(_0xb482('0x7'));var jayson=require(_0xb482('0x8'));var client=jayson['client'][_0xb482('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2782fb,_0x125a84,_0x12b96f){return new BPromise(function(_0x15b94d,_0x56d63f){return client[_0xb482('0xa')](_0x2782fb,_0x12b96f)[_0xb482('0xb')](function(_0x1fa84e){logger[_0xb482('0xc')](_0xb482('0xd'),_0x125a84,_0xb482('0xe'));logger['debug'](_0xb482('0xf'),_0x125a84,'request\x20sent',JSON[_0xb482('0x10')](_0x1fa84e));if(_0x1fa84e[_0xb482('0x11')]){if(_0x1fa84e['error']['code']===0x1f4){logger['error'](_0xb482('0xd'),_0x125a84,_0x1fa84e['error'][_0xb482('0x12')]);return _0x56d63f(_0x1fa84e[_0xb482('0x11')][_0xb482('0x12')]);}logger[_0xb482('0x11')](_0xb482('0xd'),_0x125a84,_0x1fa84e[_0xb482('0x11')][_0xb482('0x12')]);return _0x15b94d(_0x1fa84e[_0xb482('0x11')][_0xb482('0x12')]);}else{logger[_0xb482('0xc')](_0xb482('0xd'),_0x125a84,'request\x20sent');_0x15b94d(_0x1fa84e[_0xb482('0x13')]['message']);}})[_0xb482('0x14')](function(_0x1219a1){logger[_0xb482('0x11')](_0xb482('0xd'),_0x125a84,_0x1219a1);_0x56d63f(_0x1219a1);});});}exports[_0xb482('0x15')]=function(_0x436fa2){var _0x135238=this;return new Promise(function(_0x299a3a,_0x2fc3be){return db[_0xb482('0x16')]['create'](_0x436fa2[_0xb482('0x17')],{'raw':_0x436fa2[_0xb482('0x18')]?_0x436fa2[_0xb482('0x18')][_0xb482('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x5c4a2e){logger[_0xb482('0xc')](_0xb482('0x15'),_0x436fa2);logger['debug'](_0xb482('0x15'),_0x436fa2,JSON['stringify'](_0x5c4a2e));_0x299a3a(_0x5c4a2e);})[_0xb482('0x14')](function(_0xe6a70d){logger[_0xb482('0x11')](_0xb482('0x15'),_0xe6a70d[_0xb482('0x12')],_0x436fa2);_0x2fc3be(_0x135238['error'](0x1f4,_0xe6a70d[_0xb482('0x12')]));});});};exports[_0xb482('0x1a')]=function(_0x458a45){var _0x20f1a0=this;return new Promise(function(_0x39ce33,_0x10dfbd){return db[_0xb482('0x16')][_0xb482('0x1b')](_0x458a45[_0xb482('0x17')],{'raw':_0x458a45['options']?_0x458a45[_0xb482('0x18')][_0xb482('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x458a45[_0xb482('0x18')]?_0x458a45[_0xb482('0x18')][_0xb482('0x1c')]||null:null,'attributes':_0x458a45[_0xb482('0x18')]?_0x458a45[_0xb482('0x18')][_0xb482('0x1d')]||null:null,'limit':_0x458a45[_0xb482('0x18')]?_0x458a45[_0xb482('0x18')]['limit']||null:null})[_0xb482('0xb')](function(_0x3b08d8){logger['info']('UpdateVoiceDialReport',_0x458a45);logger[_0xb482('0x1e')](_0xb482('0x1a'),_0x458a45,JSON['stringify'](_0x3b08d8));_0x39ce33(_0x3b08d8);})[_0xb482('0x14')](function(_0x1ec2fe){logger[_0xb482('0x11')](_0xb482('0x1a'),_0x1ec2fe['message'],_0x458a45);_0x10dfbd(_0x20f1a0['error'](0x1f4,_0x1ec2fe[_0xb482('0x12')]));});});}; \ No newline at end of file +var _0xec72=['debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','CreateVoiceDialReport','VoiceDialReport','create','options','raw','stringify','UpdateVoiceDialReport','update','body','where','attributes','limit','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','VoiceDialReport,\x20%s,\x20%s','request\x20sent'];(function(_0x45c8b6,_0xe439ea){var _0x40e17a=function(_0x3519d4){while(--_0x3519d4){_0x45c8b6['push'](_0x45c8b6['shift']());}};_0x40e17a(++_0xe439ea);}(_0xec72,0xb4));var _0x2ec7=function(_0x5628bd,_0x39597f){_0x5628bd=_0x5628bd-0x0;var _0x1ce47f=_0xec72[_0x5628bd];return _0x1ce47f;};'use strict';var _=require('lodash');var util=require(_0x2ec7('0x0'));var moment=require('moment');var BPromise=require(_0x2ec7('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2ec7('0x2'))['db'];var utils=require(_0x2ec7('0x3'));var logger=require(_0x2ec7('0x4'))(_0x2ec7('0x5'));var config=require(_0x2ec7('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x2ec7('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x45e720,_0x3976dd,_0xa7fbee){return new BPromise(function(_0x3cfc02,_0x2e1c7b){return client[_0x2ec7('0x8')](_0x45e720,_0xa7fbee)[_0x2ec7('0x9')](function(_0x271700){logger['info'](_0x2ec7('0xa'),_0x3976dd,_0x2ec7('0xb'));logger[_0x2ec7('0xc')](_0x2ec7('0xd'),_0x3976dd,_0x2ec7('0xb'),JSON['stringify'](_0x271700));if(_0x271700[_0x2ec7('0xe')]){if(_0x271700[_0x2ec7('0xe')][_0x2ec7('0xf')]===0x1f4){logger[_0x2ec7('0xe')]('VoiceDialReport,\x20%s,\x20%s',_0x3976dd,_0x271700['error'][_0x2ec7('0x10')]);return _0x2e1c7b(_0x271700[_0x2ec7('0xe')][_0x2ec7('0x10')]);}logger['error'](_0x2ec7('0xa'),_0x3976dd,_0x271700['error']['message']);return _0x3cfc02(_0x271700[_0x2ec7('0xe')][_0x2ec7('0x10')]);}else{logger[_0x2ec7('0x11')]('VoiceDialReport,\x20%s,\x20%s',_0x3976dd,'request\x20sent');_0x3cfc02(_0x271700[_0x2ec7('0x12')][_0x2ec7('0x10')]);}})[_0x2ec7('0x13')](function(_0x43a57c){logger[_0x2ec7('0xe')]('VoiceDialReport,\x20%s,\x20%s',_0x3976dd,_0x43a57c);_0x2e1c7b(_0x43a57c);});});}exports[_0x2ec7('0x14')]=function(_0x3a9b33){var _0x5caef9=this;return new Promise(function(_0x266cd2,_0x36860f){return db[_0x2ec7('0x15')][_0x2ec7('0x16')](_0x3a9b33['body'],{'raw':_0x3a9b33[_0x2ec7('0x17')]?_0x3a9b33[_0x2ec7('0x17')][_0x2ec7('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x408c07){logger['info'](_0x2ec7('0x14'),_0x3a9b33);logger['debug'](_0x2ec7('0x14'),_0x3a9b33,JSON[_0x2ec7('0x19')](_0x408c07));_0x266cd2(_0x408c07);})['catch'](function(_0xbb37ad){logger[_0x2ec7('0xe')](_0x2ec7('0x14'),_0xbb37ad[_0x2ec7('0x10')],_0x3a9b33);_0x36860f(_0x5caef9['error'](0x1f4,_0xbb37ad['message']));});});};exports[_0x2ec7('0x1a')]=function(_0x35321f){var _0x244654=this;return new Promise(function(_0x47a6e3,_0xdbbdef){return db[_0x2ec7('0x15')][_0x2ec7('0x1b')](_0x35321f[_0x2ec7('0x1c')],{'raw':_0x35321f[_0x2ec7('0x17')]?_0x35321f[_0x2ec7('0x17')][_0x2ec7('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x35321f[_0x2ec7('0x17')]?_0x35321f[_0x2ec7('0x17')][_0x2ec7('0x1d')]||null:null,'attributes':_0x35321f[_0x2ec7('0x17')]?_0x35321f[_0x2ec7('0x17')][_0x2ec7('0x1e')]||null:null,'limit':_0x35321f['options']?_0x35321f[_0x2ec7('0x17')][_0x2ec7('0x1f')]||null:null})[_0x2ec7('0x9')](function(_0x5192cb){logger[_0x2ec7('0x11')](_0x2ec7('0x1a'),_0x35321f);logger[_0x2ec7('0xc')](_0x2ec7('0x1a'),_0x35321f,JSON[_0x2ec7('0x19')](_0x5192cb));_0x47a6e3(_0x5192cb);})[_0x2ec7('0x13')](function(_0x2b6399){logger['error'](_0x2ec7('0x1a'),_0x2b6399[_0x2ec7('0x10')],_0x35321f);_0xdbbdef(_0x244654[_0x2ec7('0xe')](0x1f4,_0x2b6399[_0x2ec7('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index a997165..aae63bd 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 _0xc102=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','./voiceExtension.controller','get','index','/:id','isAuthenticated','show','post','create','/:id/applications','put','update','delete','exports','multer','util','path'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xc102,0xba));var _0x2c10=function(_0x13e7fc,_0x5df5ee){_0x13e7fc=_0x13e7fc-0x0;var _0x407fdf=_0xc102[_0x13e7fc];return _0x407fdf;};'use strict';var multer=require(_0x2c10('0x0'));var util=require(_0x2c10('0x1'));var path=require(_0x2c10('0x2'));var timeout=require(_0x2c10('0x3'));var express=require(_0x2c10('0x4'));var router=express[_0x2c10('0x5')]();var fs_extra=require(_0x2c10('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x2c10('0x7'));var config=require('../../config/environment');var controller=require(_0x2c10('0x8'));router[_0x2c10('0x9')]('/',auth['isAuthenticated'](),controller[_0x2c10('0xa')]);router[_0x2c10('0x9')](_0x2c10('0xb'),auth[_0x2c10('0xc')](),controller[_0x2c10('0xd')]);router[_0x2c10('0xe')]('/',auth['isAuthenticated'](),controller[_0x2c10('0xf')]);router[_0x2c10('0xe')](_0x2c10('0x10'),auth[_0x2c10('0xc')](),controller['addApplications']);router[_0x2c10('0x11')]('/:id',auth[_0x2c10('0xc')](),controller[_0x2c10('0x12')]);router[_0x2c10('0x13')](_0x2c10('0xb'),auth[_0x2c10('0xc')](),controller['destroy']);module[_0x2c10('0x14')]=router; \ No newline at end of file +var _0x95fc=['index','get','/:id','show','post','create','/:id/applications','addApplications','put','update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../config/environment','./voiceExtension.controller','isAuthenticated'];(function(_0x2d5cf4,_0x3eb179){var _0xa76a3b=function(_0xc8681d){while(--_0xc8681d){_0x2d5cf4['push'](_0x2d5cf4['shift']());}};_0xa76a3b(++_0x3eb179);}(_0x95fc,0x8a));var _0xc95f=function(_0x5935ff,_0x3014c3){_0x5935ff=_0x5935ff-0x0;var _0xdb9054=_0x95fc[_0x5935ff];return _0xdb9054;};'use strict';var multer=require(_0xc95f('0x0'));var util=require(_0xc95f('0x1'));var path=require(_0xc95f('0x2'));var timeout=require(_0xc95f('0x3'));var express=require('express');var router=express[_0xc95f('0x4')]();var fs_extra=require(_0xc95f('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc95f('0x6'));var controller=require(_0xc95f('0x7'));router['get']('/',auth[_0xc95f('0x8')](),controller[_0xc95f('0x9')]);router[_0xc95f('0xa')](_0xc95f('0xb'),auth[_0xc95f('0x8')](),controller[_0xc95f('0xc')]);router[_0xc95f('0xd')]('/',auth['isAuthenticated'](),controller[_0xc95f('0xe')]);router['post'](_0xc95f('0xf'),auth[_0xc95f('0x8')](),controller[_0xc95f('0x10')]);router[_0xc95f('0x11')](_0xc95f('0xb'),auth['isAuthenticated'](),controller[_0xc95f('0x12')]);router['delete'](_0xc95f('0xb'),auth[_0xc95f('0x8')](),controller[_0xc95f('0x13')]);module[_0xc95f('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 5b874bc..67fd211 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 _0x9edb=['INTEGER','BOOLEAN','wav','VIRTUAL','sequelize','exports','STRING','compositeIndex','NoOp','inbound','outbound','inbound-fax','outbound-fax','any'];(function(_0x804ab1,_0x3a981e){var _0x757879=function(_0x191b29){while(--_0x191b29){_0x804ab1['push'](_0x804ab1['shift']());}};_0x757879(++_0x3a981e);}(_0x9edb,0x154));var _0xb9ed=function(_0x4ef666,_0x1ecac8){_0x4ef666=_0x4ef666-0x0;var _0x1ffa9f=_0x9edb[_0x4ef666];return _0x1ffa9f;};'use strict';var Sequelize=require(_0xb9ed('0x0'));module[_0xb9ed('0x1')]={'context':{'type':Sequelize[_0xb9ed('0x2')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xb9ed('0x3')},'priority':{'type':Sequelize[_0xb9ed('0x2')],'allowNull':![],'defaultValue':'1','unique':_0xb9ed('0x3')},'tag':{'type':Sequelize[_0xb9ed('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0xb9ed('0x2')],'allowNull':![],'defaultValue':_0xb9ed('0x4')},'appdata':{'type':Sequelize[_0xb9ed('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM'](_0xb9ed('0x5'),_0xb9ed('0x6'),'internal',_0xb9ed('0x7'),_0xb9ed('0x8'),'system',_0xb9ed('0x9')),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'*,*,*,*'},'IntervalId':{'type':Sequelize[_0xb9ed('0xa')]},'isApp':{'type':Sequelize[_0xb9ed('0xb')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0xb9ed('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0xb9ed('0x2')],'allowNull':!![]},'record':{'type':Sequelize[_0xb9ed('0xb')],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':_0xb9ed('0xc')},'answer':{'type':Sequelize[_0xb9ed('0xb')],'defaultValue':!![]},'name':{'type':Sequelize[_0xb9ed('0xd')],'get':function(_0x2519f8){return this['getDataValue']('exten');}},'alias':{'type':Sequelize[_0xb9ed('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0xf34b=['outbound','internal','inbound-fax','outbound-fax','system','any','*,*,*,*','INTEGER','BOOLEAN','wav','VIRTUAL','getDataValue','exports','STRING','compositeIndex','NoOp','ENUM','inbound'];(function(_0x35a5ef,_0x3c11af){var _0x13b595=function(_0x4ca6ae){while(--_0x4ca6ae){_0x35a5ef['push'](_0x35a5ef['shift']());}};_0x13b595(++_0x3c11af);}(_0xf34b,0xc0));var _0xbf34=function(_0x568a25,_0x138e4b){_0x568a25=_0x568a25-0x0;var _0x40646e=_0xf34b[_0x568a25];return _0x40646e;};'use strict';var Sequelize=require('sequelize');module[_0xbf34('0x0')]={'context':{'type':Sequelize['STRING'],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0xbf34('0x1')],'allowNull':![],'unique':_0xbf34('0x2')},'priority':{'type':Sequelize[_0xbf34('0x1')],'allowNull':![],'defaultValue':'1','unique':_0xbf34('0x2')},'tag':{'type':Sequelize[_0xbf34('0x1')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0xbf34('0x1')],'allowNull':![],'defaultValue':_0xbf34('0x3')},'appdata':{'type':Sequelize[_0xbf34('0x1')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0xbf34('0x4')](_0xbf34('0x5'),_0xbf34('0x6'),_0xbf34('0x7'),_0xbf34('0x8'),_0xbf34('0x9'),_0xbf34('0xa'),_0xbf34('0xb')),'allowNull':![]},'description':{'type':Sequelize[_0xbf34('0x1')]},'interval':{'type':Sequelize[_0xbf34('0x1')],'allowNull':![],'defaultValue':_0xbf34('0xc')},'IntervalId':{'type':Sequelize[_0xbf34('0xd')]},'isApp':{'type':Sequelize[_0xbf34('0xe')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0xbf34('0x1')],'defaultValue':null},'callerID':{'type':Sequelize[_0xbf34('0x1')],'allowNull':!![]},'record':{'type':Sequelize[_0xbf34('0xe')],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize[_0xbf34('0x1')],'defaultValue':_0xbf34('0xf')},'answer':{'type':Sequelize[_0xbf34('0xe')],'defaultValue':!![]},'name':{'type':Sequelize[_0xbf34('0x10')],'get':function(_0xbb63ee){return this[_0xbf34('0x11')]('exten');}},'alias':{'type':Sequelize[_0xbf34('0x1')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index 1125604..e9827c8 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 _0x2ba3=['startsWith','exten','user','role','InboundRoutes','UserProfileSection','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','pick','context','description','recordingFormat','cutdigits','alias','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','VoiceExtensionId','isApp','findAndCountAll','cast(priority\x20as\x20unsigned)','stack','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','socket.io-emitter','./voiceExtension.socket','register','sendStatus','status','json','offset','undefined','count','limit','Content-Range','destroy','get','inbound','OutboundRoutes','outbound','InternalRoutes','internal','filter','map','value','includes','type','find','name','then','end','error','send','index','VoiceExtension','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','merge','VIRTUAL','includeAll','findAll','rows','catch','show','length','params','create','body'];(function(_0x5b9360,_0x1a8a2a){var _0x1180aa=function(_0x141c19){while(--_0x141c19){_0x5b9360['push'](_0x5b9360['shift']());}};_0x1180aa(++_0x1a8a2a);}(_0x2ba3,0x175));var _0x32ba=function(_0x4752f3,_0x1c46b4){_0x4752f3=_0x4752f3-0x0;var _0x142f78=_0x2ba3[_0x4752f3];return _0x142f78;};'use strict';var _=require(_0x32ba('0x0'));var Redis=require('ioredis');var qs=require(_0x32ba('0x1'));var logger=require(_0x32ba('0x2'))(_0x32ba('0x3'));var config=require(_0x32ba('0x4'));var db=require('../../mysqldb')['db'];config[_0x32ba('0x5')]=_[_0x32ba('0x6')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x32ba('0x7'))(new Redis(config[_0x32ba('0x5')]));require(_0x32ba('0x8'))[_0x32ba('0x9')](socket);function respondWithStatusCode(_0x15ae9e,_0x28559a){_0x28559a=_0x28559a||0xcc;return function(_0x26c1d7){if(_0x26c1d7){return _0x15ae9e[_0x32ba('0xa')](_0x28559a);}return _0x15ae9e[_0x32ba('0xb')](_0x28559a)['end']();};}function respondWithResult(_0x574da5,_0x255997){_0x255997=_0x255997||0xc8;return function(_0xca1c7f){if(_0xca1c7f){return _0x574da5[_0x32ba('0xb')](_0x255997)[_0x32ba('0xc')](_0xca1c7f);}};}function respondWithFilteredResult(_0x381073,_0x47420b){return function(_0x5df308){if(_0x5df308){var _0x45e4cb=typeof _0x47420b[_0x32ba('0xd')]==='undefined'&&typeof _0x47420b['limit']===_0x32ba('0xe');var _0x428f0b=_0x5df308[_0x32ba('0xf')];var _0x528b9d=_0x45e4cb?0x0:_0x47420b[_0x32ba('0xd')];var _0x34b5d9=_0x45e4cb?_0x5df308[_0x32ba('0xf')]:_0x47420b['offset']+_0x47420b[_0x32ba('0x10')];var _0x2d0dfe;if(_0x34b5d9>=_0x428f0b){_0x34b5d9=_0x428f0b;_0x2d0dfe=0xc8;}else{_0x2d0dfe=0xce;}_0x381073[_0x32ba('0xb')](_0x2d0dfe);return _0x381073['set'](_0x32ba('0x11'),_0x528b9d+'-'+_0x34b5d9+'/'+_0x428f0b)[_0x32ba('0xc')](_0x5df308);}return null;};}function removeEntity(_0x238e44){return function(_0x24682e){if(_0x24682e){return _0x24682e[_0x32ba('0x12')]()['then'](function(){var _0x2a8f35=_0x24682e[_0x32ba('0x13')]({'plain':!![]});var _0xe76571=[{'name':'InboundRoutes','value':_0x32ba('0x14'),'ignore':![]},{'name':_0x32ba('0x15'),'value':_0x32ba('0x16'),'ignore':![]},{'name':_0x32ba('0x17'),'value':_0x32ba('0x18'),'ignore':![]}];var _0x4db6e7=_(_0xe76571)[_0x32ba('0x19')]('ignore')[_0x32ba('0x1a')]('value')[_0x32ba('0x1b')]();if(_[_0x32ba('0x1c')](_0x4db6e7,_0x2a8f35[_0x32ba('0x1d')])){return;}var _0x10be9b=_[_0x32ba('0x1e')](_0xe76571,['value',_0x2a8f35['type']])[_0x32ba('0x1f')];return db['UserProfileResource'][_0x32ba('0x12')]({'where':{'type':_0x10be9b,'resourceId':_0x2a8f35['id']}})['then'](function(){return _0x24682e;});})[_0x32ba('0x20')](function(){_0x238e44[_0x32ba('0xb')](0xcc)[_0x32ba('0x21')]();});}};}function handleEntityNotFound(_0x1c21a0){return function(_0x5db05f){if(!_0x5db05f){_0x1c21a0['sendStatus'](0x194);}return _0x5db05f;};}function handleError(_0xb79c8a,_0xfed14){_0xfed14=_0xfed14||0x1f4;return function(_0x101111){logger[_0x32ba('0x22')](_0x101111['stack']);if(_0x101111[_0x32ba('0x1f')]){delete _0x101111[_0x32ba('0x1f')];}_0xb79c8a[_0x32ba('0xb')](_0xfed14)[_0x32ba('0x23')](_0x101111);};}exports[_0x32ba('0x24')]=function(_0x4b36b5,_0x2fd3fd){var _0x3e1bf8={},_0x1356bc={},_0x2a76fc={'count':0x0,'rows':[]};var _0x25ceb9=_['map'](db[_0x32ba('0x25')][_0x32ba('0x26')],function(_0x15324b){return{'name':_0x15324b['fieldName'],'type':_0x15324b[_0x32ba('0x1d')][_0x32ba('0x27')]};});_0x1356bc[_0x32ba('0x28')]=_[_0x32ba('0x1a')](_0x25ceb9,_0x32ba('0x1f'));_0x1356bc[_0x32ba('0x29')]=_[_0x32ba('0x2a')](_0x4b36b5[_0x32ba('0x29')]);_0x1356bc[_0x32ba('0x2b')]=_[_0x32ba('0x2c')](_0x1356bc['model'],_0x1356bc[_0x32ba('0x29')]);_0x3e1bf8[_0x32ba('0x2d')]=_[_0x32ba('0x2c')](_0x1356bc['model'],qs[_0x32ba('0x2e')](_0x4b36b5['query'][_0x32ba('0x2e')]));_0x3e1bf8[_0x32ba('0x2d')]=_0x3e1bf8[_0x32ba('0x2d')]['length']?_0x3e1bf8[_0x32ba('0x2d')]:_0x1356bc['model'];if(!_0x4b36b5[_0x32ba('0x29')]['hasOwnProperty'](_0x32ba('0x2f'))){_0x3e1bf8['limit']=qs[_0x32ba('0x10')](_0x4b36b5[_0x32ba('0x29')][_0x32ba('0x10')]);_0x3e1bf8[_0x32ba('0xd')]=qs[_0x32ba('0xd')](_0x4b36b5[_0x32ba('0x29')][_0x32ba('0xd')]);}_0x3e1bf8[_0x32ba('0x30')]=qs[_0x32ba('0x31')](_0x4b36b5[_0x32ba('0x29')][_0x32ba('0x31')]);_0x3e1bf8['where']=qs[_0x32ba('0x2b')](_['pick'](_0x4b36b5[_0x32ba('0x29')],_0x1356bc['filters']),_0x25ceb9);if(_0x4b36b5[_0x32ba('0x29')][_0x32ba('0x19')]){_0x3e1bf8[_0x32ba('0x32')]=_[_0x32ba('0x33')](_0x3e1bf8[_0x32ba('0x32')],{'$or':_['map'](_0x25ceb9,function(_0x4ea1ae){if(_0x4ea1ae[_0x32ba('0x1d')]!==_0x32ba('0x34')){var _0x42fcf5={};_0x42fcf5[_0x4ea1ae['name']]={'$like':'%'+_0x4b36b5['query']['filter']+'%'};return _0x42fcf5;}})});}_0x3e1bf8=_['merge']({},_0x3e1bf8,_0x4b36b5['options']);var _0x57bef4={'where':_0x3e1bf8['where']};return db[_0x32ba('0x25')][_0x32ba('0xf')](_0x57bef4)[_0x32ba('0x20')](function(_0x576682){_0x2a76fc[_0x32ba('0xf')]=_0x576682;if(_0x4b36b5['query'][_0x32ba('0x35')]){_0x3e1bf8['include']=[{'all':!![]}];}return db[_0x32ba('0x25')][_0x32ba('0x36')](_0x3e1bf8);})[_0x32ba('0x20')](function(_0x387e50){_0x2a76fc[_0x32ba('0x37')]=_0x387e50;return _0x2a76fc;})[_0x32ba('0x20')](respondWithFilteredResult(_0x2fd3fd,_0x3e1bf8))[_0x32ba('0x38')](handleError(_0x2fd3fd,null));};exports[_0x32ba('0x39')]=function(_0x35c12c,_0x44683a){var _0x3ab8e9={'raw':![],'where':{'id':_0x35c12c['params']['id']}},_0x3b9678={};_0x3b9678[_0x32ba('0x28')]=_[_0x32ba('0x2a')](db[_0x32ba('0x25')][_0x32ba('0x26')]);_0x3b9678[_0x32ba('0x29')]=_[_0x32ba('0x2a')](_0x35c12c[_0x32ba('0x29')]);_0x3b9678['filters']=_['intersection'](_0x3b9678[_0x32ba('0x28')],_0x3b9678[_0x32ba('0x29')]);_0x3ab8e9[_0x32ba('0x2d')]=_[_0x32ba('0x2c')](_0x3b9678[_0x32ba('0x28')],qs[_0x32ba('0x2e')](_0x35c12c[_0x32ba('0x29')][_0x32ba('0x2e')]));_0x3ab8e9[_0x32ba('0x2d')]=_0x3ab8e9[_0x32ba('0x2d')][_0x32ba('0x3a')]?_0x3ab8e9['attributes']:_0x3b9678['model'];if(_0x35c12c[_0x32ba('0x29')][_0x32ba('0x35')]){_0x3ab8e9['include']=[{'all':!![]}];}_0x3ab8e9=_['merge']({},_0x3ab8e9,_0x35c12c['options']);return db[_0x32ba('0x25')]['find'](_0x3ab8e9)['then'](handleEntityNotFound(_0x44683a,null))[_0x32ba('0x20')](respondWithResult(_0x44683a,null))[_0x32ba('0x38')](handleError(_0x44683a,null));};exports[_0x32ba('0x12')]=function(_0x15458c,_0x3d839c){return db[_0x32ba('0x25')][_0x32ba('0x1e')]({'where':{'id':_0x15458c[_0x32ba('0x3b')]['id']}})['then'](handleEntityNotFound(_0x3d839c,null))[_0x32ba('0x20')](removeEntity(_0x3d839c,null))['catch'](handleError(_0x3d839c,null));};exports[_0x32ba('0x3c')]=function(_0x3b7ca5,_0x5f11c2){if(_0x3b7ca5[_0x32ba('0x3d')]['type']===_0x32ba('0x16')&&!_[_0x32ba('0x3e')](_0x3b7ca5[_0x32ba('0x3d')][_0x32ba('0x3f')],'_')){_0x3b7ca5[_0x32ba('0x3d')][_0x32ba('0x3f')]='_'['concat'](_0x3b7ca5['body'][_0x32ba('0x3f')]);}return db[_0x32ba('0x25')][_0x32ba('0x3c')](_0x3b7ca5['body'],{'raw':![]})['then'](function(_0x4d1e1d){var _0x468120=_0x3b7ca5[_0x32ba('0x40')][_0x32ba('0x13')]({'plain':!![]});if(!_0x468120)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x468120[_0x32ba('0x41')]===_0x32ba('0x40')){var _0x5e7bbb=_0x4d1e1d[_0x32ba('0x13')]({'plain':!![]});var _0x5df954=[{'name':_0x32ba('0x42'),'value':_0x32ba('0x14')},{'name':'OutboundRoutes','value':'outbound'},{'name':'InternalRoutes','value':_0x32ba('0x18')}];var _0x27fa04=_[_0x32ba('0x1e')](_0x5df954,[_0x32ba('0x1b'),_0x5e7bbb[_0x32ba('0x1d')]])[_0x32ba('0x1f')];return db[_0x32ba('0x43')]['find']({'where':{'name':_0x27fa04,'userProfileId':_0x468120['userProfileId']},'raw':!![]})['then'](function(_0x4466a6){if(_0x4466a6&&_0x4466a6['autoAssociation']===0x0){return db[_0x32ba('0x44')]['create']({'name':_0x5e7bbb[_0x32ba('0x1f')],'resourceId':_0x5e7bbb['id'],'type':_0x4466a6['name'],'sectionId':_0x4466a6['id']},{})[_0x32ba('0x20')](function(){return _0x4d1e1d;});}else{return _0x4d1e1d;}})['catch'](function(_0x48912d){logger[_0x32ba('0x22')](_0x32ba('0x45'),_0x48912d);throw _0x48912d;});}return _0x4d1e1d;})[_0x32ba('0x20')](respondWithResult(_0x5f11c2,0xc9))[_0x32ba('0x38')](handleError(_0x5f11c2,null));};exports['update']=function(_0x4a2151,_0x596b10){if(_0x4a2151['body']['id']){delete _0x4a2151['body']['id'];}return db[_0x32ba('0x25')]['find']({'where':{'id':_0x4a2151[_0x32ba('0x3b')]['id']}})['then'](handleEntityNotFound(_0x596b10,null))['then'](function(_0x4cbd1c){if(_0x4cbd1c){return db[_0x32ba('0x25')][_0x32ba('0x46')](_[_0x32ba('0x47')](_0x4a2151[_0x32ba('0x3d')],[_0x32ba('0x3f'),_0x32ba('0x48'),_0x32ba('0x49'),_0x32ba('0x4a'),_0x32ba('0x4b'),'mandatoryDisposition',_0x32ba('0x4c')]),{'where':{'context':_0x4cbd1c[_0x32ba('0x48')],'exten':_0x4cbd1c[_0x32ba('0x3f')]},'individualHooks':!![]})[_0x32ba('0x20')](function(_0x4bbc84){return _0x4bbc84;});}return null;})[_0x32ba('0x20')](respondWithStatusCode(_0x596b10,null))[_0x32ba('0x38')](handleError(_0x596b10,null));};exports[_0x32ba('0x4d')]=function(_0x1cb4ea,_0x46d14d){var _0x49a102=_0x1cb4ea[_0x32ba('0x3b')]['id'];var _0x57ff98=_0x1cb4ea['body'];var _0x5ad426=0xc8;var _0xdedf08=null;return db[_0x32ba('0x4e')]['transaction']({'isolationLevel':db[_0x32ba('0x4e')][_0x32ba('0x4f')][_0x32ba('0x50')][_0x32ba('0x51')]},function(_0x53ac04){return db[_0x32ba('0x25')]['findOne']({'where':{'id':_0x49a102},'transaction':_0x53ac04})['then'](function(_0x51e006){if(_0x51e006){return db[_0x32ba('0x25')][_0x32ba('0x12')]({'where':{'VoiceExtensionId':_0x49a102},'transaction':_0x53ac04})['then'](function(){var _0x6ac1be=_[_0x32ba('0x1a')](_0x57ff98,function(_0x587fbd){_0x587fbd[_0x32ba('0x52')]=_0x49a102;_0x587fbd[_0x32ba('0x53')]=!![];return _0x587fbd;});return _0x51e006['createRouting'](_0x6ac1be);})[_0x32ba('0x20')](function(_0x101428){return db[_0x32ba('0x25')]['bulkCreate'](_0x101428,{'transaction':_0x53ac04});});}else{_0x5ad426=0x194;_0xdedf08=[];}});})['then'](function(){if(_0x5ad426!==0x194){return db[_0x32ba('0x25')][_0x32ba('0x54')]({'where':{'isApp':!![],'VoiceExtensionId':_0x49a102},'order':_0x32ba('0x55')})['then'](function(_0x42479d){_0xdedf08=_0x42479d;});}})[_0x32ba('0x38')](function(_0x26d4a9){_0x5ad426=0x1f4;logger[_0x32ba('0x22')](_0x26d4a9[_0x32ba('0x56')]);if(_0x26d4a9[_0x32ba('0x1f')]){delete _0x26d4a9[_0x32ba('0x1f')];}_0xdedf08=_0x26d4a9;})['finally'](function(){if(_0xdedf08===null){_0x46d14d[_0x32ba('0xa')](_0x5ad426);}else{if(_0x5ad426===0x1f4){_0x46d14d[_0x32ba('0xb')](_0x5ad426)[_0x32ba('0x23')](_0xdedf08);}else{_0x46d14d[_0x32ba('0xb')](_0x5ad426)[_0x32ba('0xc')](_0xdedf08);}}});}; \ No newline at end of file +var _0x58d4=['lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','./voiceExtension.socket','register','sendStatus','end','status','offset','limit','undefined','count','set','Content-Range','json','destroy','then','get','inbound','OutboundRoutes','outbound','InternalRoutes','internal','filter','map','value','type','find','name','UserProfileResource','error','stack','send','rawAttributes','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','options','VoiceExtension','include','findAll','params','includeAll','catch','body','startsWith','exten','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','InboundRoutes','UserProfileSection','userProfileId','autoAssociation','update','description','mandatoryDisposition','alias','context','Transaction','ISOLATION_LEVELS','READ_COMMITTED','VoiceExtensionId','isApp','createRouting','findAndCountAll','finally'];(function(_0x2ad4b3,_0x229270){var _0x2d4430=function(_0xfda9ea){while(--_0xfda9ea){_0x2ad4b3['push'](_0x2ad4b3['shift']());}};_0x2d4430(++_0x229270);}(_0x58d4,0x160));var _0x458d=function(_0x53f538,_0x59872b){_0x53f538=_0x53f538-0x0;var _0x75a29a=_0x58d4[_0x53f538];return _0x75a29a;};'use strict';var _=require(_0x458d('0x0'));var Redis=require(_0x458d('0x1'));var qs=require(_0x458d('0x2'));var logger=require(_0x458d('0x3'))(_0x458d('0x4'));var config=require(_0x458d('0x5'));var db=require(_0x458d('0x6'))['db'];config[_0x458d('0x7')]=_['defaults'](config[_0x458d('0x7')],{'host':_0x458d('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x458d('0x7')]));require(_0x458d('0x9'))[_0x458d('0xa')](socket);function respondWithStatusCode(_0xd3755f,_0x5985ff){_0x5985ff=_0x5985ff||0xcc;return function(_0x332439){if(_0x332439){return _0xd3755f[_0x458d('0xb')](_0x5985ff);}return _0xd3755f['status'](_0x5985ff)[_0x458d('0xc')]();};}function respondWithResult(_0x35e3b5,_0x26e3cc){_0x26e3cc=_0x26e3cc||0xc8;return function(_0x3e7588){if(_0x3e7588){return _0x35e3b5[_0x458d('0xd')](_0x26e3cc)['json'](_0x3e7588);}};}function respondWithFilteredResult(_0x389e4b,_0x5af81e){return function(_0x4e2fea){if(_0x4e2fea){var _0x1f7661=typeof _0x5af81e[_0x458d('0xe')]==='undefined'&&typeof _0x5af81e[_0x458d('0xf')]===_0x458d('0x10');var _0x2c791c=_0x4e2fea[_0x458d('0x11')];var _0x3307c6=_0x1f7661?0x0:_0x5af81e['offset'];var _0x443a5f=_0x1f7661?_0x4e2fea[_0x458d('0x11')]:_0x5af81e['offset']+_0x5af81e[_0x458d('0xf')];var _0x5d816e;if(_0x443a5f>=_0x2c791c){_0x443a5f=_0x2c791c;_0x5d816e=0xc8;}else{_0x5d816e=0xce;}_0x389e4b[_0x458d('0xd')](_0x5d816e);return _0x389e4b[_0x458d('0x12')](_0x458d('0x13'),_0x3307c6+'-'+_0x443a5f+'/'+_0x2c791c)[_0x458d('0x14')](_0x4e2fea);}return null;};}function removeEntity(_0x5334f9){return function(_0x1b6003){if(_0x1b6003){return _0x1b6003[_0x458d('0x15')]()[_0x458d('0x16')](function(){var _0x584001=_0x1b6003[_0x458d('0x17')]({'plain':!![]});var _0x2bd1c8=[{'name':'InboundRoutes','value':_0x458d('0x18'),'ignore':![]},{'name':_0x458d('0x19'),'value':_0x458d('0x1a'),'ignore':![]},{'name':_0x458d('0x1b'),'value':_0x458d('0x1c'),'ignore':![]}];var _0x303145=_(_0x2bd1c8)[_0x458d('0x1d')]('ignore')[_0x458d('0x1e')](_0x458d('0x1f'))['value']();if(_['includes'](_0x303145,_0x584001[_0x458d('0x20')])){return;}var _0x125545=_[_0x458d('0x21')](_0x2bd1c8,[_0x458d('0x1f'),_0x584001[_0x458d('0x20')]])[_0x458d('0x22')];return db[_0x458d('0x23')]['destroy']({'where':{'type':_0x125545,'resourceId':_0x584001['id']}})[_0x458d('0x16')](function(){return _0x1b6003;});})[_0x458d('0x16')](function(){_0x5334f9[_0x458d('0xd')](0xcc)[_0x458d('0xc')]();});}};}function handleEntityNotFound(_0x1dba78){return function(_0x20d8f1){if(!_0x20d8f1){_0x1dba78[_0x458d('0xb')](0x194);}return _0x20d8f1;};}function handleError(_0x4cbcc8,_0x165a07){_0x165a07=_0x165a07||0x1f4;return function(_0x4426dd){logger[_0x458d('0x24')](_0x4426dd[_0x458d('0x25')]);if(_0x4426dd[_0x458d('0x22')]){delete _0x4426dd[_0x458d('0x22')];}_0x4cbcc8[_0x458d('0xd')](_0x165a07)[_0x458d('0x26')](_0x4426dd);};}exports['index']=function(_0x17dd6b,_0x4e003a){var _0x1fb381={},_0x166599={},_0x3ca718={'count':0x0,'rows':[]};var _0x4f053f=_[_0x458d('0x1e')](db['VoiceExtension'][_0x458d('0x27')],function(_0x4bfc8f){return{'name':_0x4bfc8f['fieldName'],'type':_0x4bfc8f['type'][_0x458d('0x28')]};});_0x166599[_0x458d('0x29')]=_[_0x458d('0x1e')](_0x4f053f,_0x458d('0x22'));_0x166599[_0x458d('0x2a')]=_[_0x458d('0x2b')](_0x17dd6b['query']);_0x166599['filters']=_[_0x458d('0x2c')](_0x166599[_0x458d('0x29')],_0x166599[_0x458d('0x2a')]);_0x1fb381[_0x458d('0x2d')]=_[_0x458d('0x2c')](_0x166599[_0x458d('0x29')],qs[_0x458d('0x2e')](_0x17dd6b[_0x458d('0x2a')]['fields']));_0x1fb381['attributes']=_0x1fb381[_0x458d('0x2d')][_0x458d('0x2f')]?_0x1fb381['attributes']:_0x166599[_0x458d('0x29')];if(!_0x17dd6b['query'][_0x458d('0x30')](_0x458d('0x31'))){_0x1fb381['limit']=qs[_0x458d('0xf')](_0x17dd6b[_0x458d('0x2a')][_0x458d('0xf')]);_0x1fb381[_0x458d('0xe')]=qs[_0x458d('0xe')](_0x17dd6b[_0x458d('0x2a')]['offset']);}_0x1fb381[_0x458d('0x32')]=qs[_0x458d('0x33')](_0x17dd6b['query']['sort']);_0x1fb381[_0x458d('0x34')]=qs[_0x458d('0x35')](_[_0x458d('0x36')](_0x17dd6b[_0x458d('0x2a')],_0x166599[_0x458d('0x35')]),_0x4f053f);if(_0x17dd6b[_0x458d('0x2a')][_0x458d('0x1d')]){_0x1fb381[_0x458d('0x34')]=_[_0x458d('0x37')](_0x1fb381[_0x458d('0x34')],{'$or':_[_0x458d('0x1e')](_0x4f053f,function(_0x408c5e){if(_0x408c5e[_0x458d('0x20')]!==_0x458d('0x38')){var _0x2d6886={};_0x2d6886[_0x408c5e[_0x458d('0x22')]]={'$like':'%'+_0x17dd6b['query']['filter']+'%'};return _0x2d6886;}})});}_0x1fb381=_[_0x458d('0x37')]({},_0x1fb381,_0x17dd6b[_0x458d('0x39')]);var _0x20c50f={'where':_0x1fb381[_0x458d('0x34')]};return db[_0x458d('0x3a')][_0x458d('0x11')](_0x20c50f)[_0x458d('0x16')](function(_0x23f9a3){_0x3ca718[_0x458d('0x11')]=_0x23f9a3;if(_0x17dd6b[_0x458d('0x2a')]['includeAll']){_0x1fb381[_0x458d('0x3b')]=[{'all':!![]}];}return db[_0x458d('0x3a')][_0x458d('0x3c')](_0x1fb381);})[_0x458d('0x16')](function(_0x1eb2a8){_0x3ca718['rows']=_0x1eb2a8;return _0x3ca718;})[_0x458d('0x16')](respondWithFilteredResult(_0x4e003a,_0x1fb381))['catch'](handleError(_0x4e003a,null));};exports['show']=function(_0x9835b,_0x531b81){var _0x570dd4={'raw':![],'where':{'id':_0x9835b[_0x458d('0x3d')]['id']}},_0x19996a={};_0x19996a[_0x458d('0x29')]=_[_0x458d('0x2b')](db[_0x458d('0x3a')]['rawAttributes']);_0x19996a['query']=_[_0x458d('0x2b')](_0x9835b[_0x458d('0x2a')]);_0x19996a[_0x458d('0x35')]=_[_0x458d('0x2c')](_0x19996a[_0x458d('0x29')],_0x19996a[_0x458d('0x2a')]);_0x570dd4['attributes']=_[_0x458d('0x2c')](_0x19996a[_0x458d('0x29')],qs[_0x458d('0x2e')](_0x9835b['query'][_0x458d('0x2e')]));_0x570dd4[_0x458d('0x2d')]=_0x570dd4['attributes'][_0x458d('0x2f')]?_0x570dd4[_0x458d('0x2d')]:_0x19996a[_0x458d('0x29')];if(_0x9835b[_0x458d('0x2a')][_0x458d('0x3e')]){_0x570dd4[_0x458d('0x3b')]=[{'all':!![]}];}_0x570dd4=_['merge']({},_0x570dd4,_0x9835b['options']);return db[_0x458d('0x3a')]['find'](_0x570dd4)[_0x458d('0x16')](handleEntityNotFound(_0x531b81,null))['then'](respondWithResult(_0x531b81,null))[_0x458d('0x3f')](handleError(_0x531b81,null));};exports[_0x458d('0x15')]=function(_0x37f954,_0x249c64){return db[_0x458d('0x3a')]['find']({'where':{'id':_0x37f954[_0x458d('0x3d')]['id']}})[_0x458d('0x16')](handleEntityNotFound(_0x249c64,null))[_0x458d('0x16')](removeEntity(_0x249c64,null))['catch'](handleError(_0x249c64,null));};exports['create']=function(_0x53ef74,_0x170e4c){if(_0x53ef74[_0x458d('0x40')]['type']===_0x458d('0x1a')&&!_[_0x458d('0x41')](_0x53ef74[_0x458d('0x40')]['exten'],'_')){_0x53ef74[_0x458d('0x40')][_0x458d('0x42')]='_'['concat'](_0x53ef74[_0x458d('0x40')][_0x458d('0x42')]);}return db['VoiceExtension'][_0x458d('0x43')](_0x53ef74['body'],{'raw':![]})[_0x458d('0x16')](function(_0x20bf3c){var _0x10f8f3=_0x53ef74[_0x458d('0x44')][_0x458d('0x17')]({'plain':!![]});if(!_0x10f8f3)throw new Error(_0x458d('0x45'));if(_0x10f8f3[_0x458d('0x46')]==='user'){var _0x963117=_0x20bf3c[_0x458d('0x17')]({'plain':!![]});var _0xbf0776=[{'name':_0x458d('0x47'),'value':'inbound'},{'name':_0x458d('0x19'),'value':_0x458d('0x1a')},{'name':_0x458d('0x1b'),'value':_0x458d('0x1c')}];var _0x56fb17=_[_0x458d('0x21')](_0xbf0776,['value',_0x963117[_0x458d('0x20')]])[_0x458d('0x22')];return db[_0x458d('0x48')][_0x458d('0x21')]({'where':{'name':_0x56fb17,'userProfileId':_0x10f8f3[_0x458d('0x49')]},'raw':!![]})[_0x458d('0x16')](function(_0x39ee79){if(_0x39ee79&&_0x39ee79[_0x458d('0x4a')]===0x0){return db['UserProfileResource']['create']({'name':_0x963117[_0x458d('0x22')],'resourceId':_0x963117['id'],'type':_0x39ee79['name'],'sectionId':_0x39ee79['id']},{})[_0x458d('0x16')](function(){return _0x20bf3c;});}else{return _0x20bf3c;}})['catch'](function(_0xec479){logger[_0x458d('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xec479);throw _0xec479;});}return _0x20bf3c;})[_0x458d('0x16')](respondWithResult(_0x170e4c,0xc9))[_0x458d('0x3f')](handleError(_0x170e4c,null));};exports['update']=function(_0x53cc81,_0x2e283f){if(_0x53cc81['body']['id']){delete _0x53cc81['body']['id'];}return db['VoiceExtension'][_0x458d('0x21')]({'where':{'id':_0x53cc81[_0x458d('0x3d')]['id']}})[_0x458d('0x16')](handleEntityNotFound(_0x2e283f,null))[_0x458d('0x16')](function(_0x3a6a37){if(_0x3a6a37){return db[_0x458d('0x3a')][_0x458d('0x4b')](_[_0x458d('0x36')](_0x53cc81[_0x458d('0x40')],[_0x458d('0x42'),'context',_0x458d('0x4c'),'recordingFormat','cutdigits',_0x458d('0x4d'),_0x458d('0x4e')]),{'where':{'context':_0x3a6a37[_0x458d('0x4f')],'exten':_0x3a6a37[_0x458d('0x42')]},'individualHooks':!![]})[_0x458d('0x16')](function(_0x1745e9){return _0x1745e9;});}return null;})[_0x458d('0x16')](respondWithStatusCode(_0x2e283f,null))[_0x458d('0x3f')](handleError(_0x2e283f,null));};exports['addApplications']=function(_0x1f6013,_0x34e09c){var _0x5b2ac8=_0x1f6013[_0x458d('0x3d')]['id'];var _0x24de93=_0x1f6013[_0x458d('0x40')];var _0x3f4627=0xc8;var _0x506bf2=null;return db['sequelize']['transaction']({'isolationLevel':db['sequelize'][_0x458d('0x50')][_0x458d('0x51')][_0x458d('0x52')]},function(_0x1911f0){return db['VoiceExtension']['findOne']({'where':{'id':_0x5b2ac8},'transaction':_0x1911f0})[_0x458d('0x16')](function(_0xf37025){if(_0xf37025){return db[_0x458d('0x3a')]['destroy']({'where':{'VoiceExtensionId':_0x5b2ac8},'transaction':_0x1911f0})[_0x458d('0x16')](function(){var _0x205d9c=_[_0x458d('0x1e')](_0x24de93,function(_0x1b968b){_0x1b968b[_0x458d('0x53')]=_0x5b2ac8;_0x1b968b[_0x458d('0x54')]=!![];return _0x1b968b;});return _0xf37025[_0x458d('0x55')](_0x205d9c);})[_0x458d('0x16')](function(_0x520756){return db[_0x458d('0x3a')]['bulkCreate'](_0x520756,{'transaction':_0x1911f0});});}else{_0x3f4627=0x194;_0x506bf2=[];}});})['then'](function(){if(_0x3f4627!==0x194){return db['VoiceExtension'][_0x458d('0x56')]({'where':{'isApp':!![],'VoiceExtensionId':_0x5b2ac8},'order':'cast(priority\x20as\x20unsigned)'})[_0x458d('0x16')](function(_0x1be153){_0x506bf2=_0x1be153;});}})[_0x458d('0x3f')](function(_0x171578){_0x3f4627=0x1f4;logger['error'](_0x171578['stack']);if(_0x171578[_0x458d('0x22')]){delete _0x171578[_0x458d('0x22')];}_0x506bf2=_0x171578;})[_0x458d('0x57')](function(){if(_0x506bf2===null){_0x34e09c[_0x458d('0xb')](_0x3f4627);}else{if(_0x3f4627===0x1f4){_0x34e09c[_0x458d('0xd')](_0x3f4627)[_0x458d('0x26')](_0x506bf2);}else{_0x34e09c[_0x458d('0xd')](_0x3f4627)[_0x458d('0x14')](_0x506bf2);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 913b5e5..2be7d60 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 _0xebf9=['events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x46314f,_0x4332dd){var _0x5a1f0c=function(_0x2b8601){while(--_0x2b8601){_0x46314f['push'](_0x46314f['shift']());}};_0x5a1f0c(++_0x4332dd);}(_0xebf9,0x1f4));var _0x9ebf=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xebf9[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require(_0x9ebf('0x0'));var VoiceExtension=require(_0x9ebf('0x1'))['db']['VoiceExtension'];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x9ebf('0x2')](0x0);var events={'afterCreate':_0x9ebf('0x3'),'afterUpdate':_0x9ebf('0x4'),'afterDestroy':_0x9ebf('0x5')};function emitEvent(_0x1e7755){return function(_0x3533b3,_0x40c570,_0x2a8b77){VoiceExtensionEvents[_0x9ebf('0x6')](_0x1e7755+':'+_0x3533b3['id'],_0x3533b3);VoiceExtensionEvents[_0x9ebf('0x6')](_0x1e7755,_0x3533b3);_0x2a8b77(null);};}for(var e in events){if(events[_0x9ebf('0x7')](e)){var event=events[e];VoiceExtension[_0x9ebf('0x8')](e,emitEvent(event));}}module[_0x9ebf('0x9')]=VoiceExtensionEvents; \ No newline at end of file +var _0x02a3=['exports','events','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x1623cf,_0x438cb7){var _0x187323=function(_0x12a317){while(--_0x12a317){_0x1623cf['push'](_0x1623cf['shift']());}};_0x187323(++_0x438cb7);}(_0x02a3,0x8d));var _0x302a=function(_0x1deb03,_0xd05ad8){_0x1deb03=_0x1deb03-0x0;var _0x189fe7=_0x02a3[_0x1deb03];return _0x189fe7;};'use strict';var EventEmitter=require(_0x302a('0x0'));var VoiceExtension=require('../../mysqldb')['db']['VoiceExtension'];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x302a('0x1')](0x0);var events={'afterCreate':_0x302a('0x2'),'afterUpdate':_0x302a('0x3'),'afterDestroy':'remove'};function emitEvent(_0x4654f1){return function(_0x597a4b,_0x5949fc,_0x3746cf){VoiceExtensionEvents['emit'](_0x4654f1+':'+_0x597a4b['id'],_0x597a4b);VoiceExtensionEvents[_0x302a('0x4')](_0x4654f1,_0x597a4b);_0x3746cf(null);};}for(var e in events){if(events[_0x302a('0x5')](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module[_0x302a('0x6')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index c862d80..521e10b 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 _0x43e7=['type','inbound','push','Set','exten','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','No\x20alias\x20set','cutdigits','${EXTEN:','${EXTEN}','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','hasOwnProperty','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','timeout','options','url','split','length','name','param','phone','prefix','SIP','join','none','indexOf','replace','U(xcally-mixmonitor-context)','isEmpty','findAll','interval','IntervalId','then','*,*,*,*','intervals','map','toLowerCase','tag','CDR(tag)=','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','answer','queue','playback','XCALLY-MOTION-ANSWER=1','splice',',${EXTEN},','outboundDial','appdata','priority','last','catch','define','VoiceExtension','get','concat','lodash','exports','CDR(type)=','context','NoOp','alias','CDR(routeAlias)='];(function(_0x15456c,_0x420b80){var _0x51849c=function(_0x181c7e){while(--_0x181c7e){_0x15456c['push'](_0x15456c['shift']());}};_0x51849c(++_0x420b80);}(_0x43e7,0xda));var _0x743e=function(_0x5cb97e,_0x132a39){_0x5cb97e=_0x5cb97e-0x0;var _0x1714b4=_0x43e7[_0x5cb97e];return _0x1714b4;};'use strict';var _=require(_0x743e('0x0'));var attributes=require('./voiceExtension.attributes');module[_0x743e('0x1')]=function(_0x596e39){var _0x570e19=_0x596e39['models'];function _0x435e3a(_0x4b0e05){var _0x3043d1=0x2;var _0xab5e2a=[{'type':_0x4b0e05['type'],'app':'Set','appdata':_0x743e('0x2')+_0x4b0e05['type'],'context':_0x4b0e05[_0x743e('0x3')],'exten':_0x4b0e05['exten'],'priority':_0x3043d1++,'VoiceExtensionId':_0x4b0e05['id']},{'type':_0x4b0e05['type'],'app':_0x4b0e05['alias']?'Set':_0x743e('0x4'),'appdata':_0x4b0e05[_0x743e('0x5')]?_0x743e('0x6')+_0x4b0e05['alias']:'No\x20alias\x20set','context':_0x4b0e05[_0x743e('0x3')],'exten':_0x4b0e05['exten'],'priority':_0x3043d1++,'VoiceExtensionId':_0x4b0e05['id']}];if(_0x4b0e05[_0x743e('0x7')]===_0x743e('0x8')){_0xab5e2a[_0x743e('0x9')]({'type':'inbound','app':_0x743e('0xa'),'appdata':'CDR(routeid)='+_0x4b0e05['id'],'context':_0x4b0e05[_0x743e('0x3')],'exten':_0x4b0e05[_0x743e('0xb')],'priority':_0x3043d1++,'VoiceExtensionId':_0x4b0e05['id']});}_0xab5e2a[_0x743e('0x9')]({'type':_0x4b0e05['type'],'app':_0x743e('0xa'),'appdata':_0x743e('0xc'),'context':_0x4b0e05[_0x743e('0x3')],'exten':_0x4b0e05[_0x743e('0xb')],'priority':_0x3043d1++,'VoiceExtensionId':_0x4b0e05['id']},{'type':_0x4b0e05[_0x743e('0x7')],'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x4b0e05[_0x743e('0x3')],'exten':_0x4b0e05[_0x743e('0xb')],'priority':_0x3043d1++,'VoiceExtensionId':_0x4b0e05['id']},{'type':_0x4b0e05[_0x743e('0x7')],'app':_0x743e('0xa'),'appdata':_0x743e('0xd'),'context':_0x4b0e05[_0x743e('0x3')],'exten':_0x4b0e05[_0x743e('0xb')],'priority':_0x3043d1++,'VoiceExtensionId':_0x4b0e05['id']});return _0xab5e2a;}function _0x2a3c0e(_0x1dd702){var _0xe8174b=0x2;var _0x3799e8=[{'type':_0x743e('0xe'),'app':_0x743e('0xa'),'appdata':_0x743e('0xf'),'context':_0x1dd702[_0x743e('0x3')],'exten':_0x1dd702[_0x743e('0xb')],'priority':_0xe8174b++,'VoiceExtensionId':_0x1dd702['id']},{'type':_0x743e('0xe'),'app':_0x1dd702[_0x743e('0x5')]?_0x743e('0xa'):_0x743e('0x4'),'appdata':_0x1dd702[_0x743e('0x5')]?_0x743e('0x6')+_0x1dd702['alias']:_0x743e('0x10'),'context':_0x1dd702[_0x743e('0x3')],'exten':_0x1dd702[_0x743e('0xb')],'priority':_0xe8174b++,'VoiceExtensionId':_0x1dd702['id']},{'type':_0x743e('0xe'),'app':_0x743e('0xa'),'appdata':'CDR(destination)='+(_0x1dd702[_0x743e('0x11')]?_0x743e('0x12')+_0x1dd702[_0x743e('0x11')]+'}':_0x743e('0x13')),'context':_0x1dd702[_0x743e('0x3')],'exten':_0x1dd702[_0x743e('0xb')],'priority':_0xe8174b++,'VoiceExtensionId':_0x1dd702['id']},{'type':_0x743e('0xe'),'app':_0x743e('0xa'),'appdata':_0x743e('0x14')+_0x1dd702['id'],'context':_0x1dd702[_0x743e('0x3')],'exten':_0x1dd702[_0x743e('0xb')],'priority':_0xe8174b++,'VoiceExtensionId':_0x1dd702['id']},{'type':_0x743e('0xe'),'app':_0x743e('0x15'),'appdata':_0x743e('0x16')+(_0xe8174b+0x2)+'):Goto('+(_0xe8174b+0x1)+')','context':_0x1dd702[_0x743e('0x3')],'exten':_0x1dd702[_0x743e('0xb')],'priority':_0xe8174b++,'VoiceExtensionId':_0x1dd702['id']},{'type':_0x743e('0xe'),'app':_0x743e('0xa'),'appdata':_0x1dd702[_0x743e('0x11')]?_0x743e('0x17')+_0x1dd702['cutdigits']+'}':_0x743e('0x18'),'context':_0x1dd702['context'],'exten':_0x1dd702['exten'],'priority':_0xe8174b++,'VoiceExtensionId':_0x1dd702['id']},{'type':_0x743e('0xe'),'app':_0x743e('0xa'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x1dd702[_0x743e('0x3')],'exten':_0x1dd702[_0x743e('0xb')],'priority':_0xe8174b++,'VoiceExtensionId':_0x1dd702['id']},{'type':'outbound','app':_0x743e('0xa'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x1dd702[_0x743e('0x3')],'exten':_0x1dd702[_0x743e('0xb')],'priority':_0xe8174b++,'VoiceExtensionId':_0x1dd702['id']},{'type':'outbound','app':_0x743e('0xa'),'appdata':_0x743e('0xd'),'context':_0x1dd702[_0x743e('0x3')],'exten':_0x1dd702['exten'],'priority':_0xe8174b++,'VoiceExtensionId':_0x1dd702['id']},{'type':'outbound','app':_0x743e('0xa'),'appdata':'outboundrouteid='+_0x1dd702['id'],'context':_0x1dd702[_0x743e('0x3')],'exten':_0x1dd702['exten'],'priority':_0xe8174b++,'VoiceExtensionId':_0x1dd702['id']}];if(_0x1dd702[_0x743e('0x19')](_0x743e('0x1a'))&&_0x1dd702[_0x743e('0x1a')]!=='none'){_0x3799e8[_0x743e('0x9')]({'type':'outbound','app':'Set','appdata':_0x743e('0x1b'),'context':_0x1dd702[_0x743e('0x3')],'exten':_0x1dd702[_0x743e('0xb')],'priority':_0xe8174b++,'VoiceExtensionId':_0x1dd702['id']},{'type':'outbound','app':'Set','appdata':_0x743e('0x1c')+_0x1dd702[_0x743e('0x1a')]||_0x743e('0x1d'),'context':_0x1dd702[_0x743e('0x3')],'exten':_0x1dd702[_0x743e('0xb')],'priority':_0xe8174b++,'VoiceExtensionId':_0x1dd702['id']});}return _0x3799e8;}function _0x404bec(_0x172c35,_0x41fbb5){var _0x190f6f=[{'name':_0x743e('0x1e'),'param':0x0},{'name':_0x743e('0x1f'),'param':0x1},{'name':_0x743e('0x20'),'param':0x2},{'name':_0x743e('0x21'),'param':0x3}];var _0x3897eb={};var _0x2da72d=_0x41fbb5[_0x743e('0x22')](',');var _0x332f19=[];for(var _0x8d6745=0x0;_0x8d6745<_0x190f6f[_0x743e('0x23')];_0x8d6745++){switch(_0x190f6f[_0x8d6745][_0x743e('0x24')]){case _0x743e('0x1e'):_0x3897eb[_0x743e('0x1e')]=_0x2da72d[_0x190f6f[_0x8d6745][_0x743e('0x25')]][_0x743e('0x22')]('/')[0x1];_0x3897eb[_0x743e('0x26')]=_0x2da72d[_0x190f6f[_0x8d6745][_0x743e('0x25')]][_0x743e('0x22')]('/')[0x2];_0x3897eb['prefix']=_0x3897eb[_0x743e('0x26')]?_0x3897eb[_0x743e('0x26')][_0x743e('0x22')]('$')[0x0]:undefined;_0x3897eb[_0x743e('0x26')]=_0x172c35[_0x743e('0x11')]?(_0x3897eb[_0x743e('0x27')]||'')+'${EXTEN:'+_0x172c35[_0x743e('0x11')]+'}':(_0x3897eb['prefix']||'')+_0x743e('0x13');_0x332f19[_0x190f6f[_0x8d6745][_0x743e('0x25')]]=[_0x743e('0x28'),_0x3897eb[_0x743e('0x1e')],_0x3897eb[_0x743e('0x26')]][_0x743e('0x29')]('/');break;case _0x743e('0x20'):_0x3897eb[_0x743e('0x20')]=_0x2da72d[_0x190f6f[_0x8d6745][_0x743e('0x25')]];if(_0x172c35[_0x743e('0x1a')]!==_0x743e('0x2a')){if(_0x3897eb[_0x743e('0x20')][_0x743e('0x2b')]('U(xcally-mixmonitor-context)')<0x0){_0x3897eb['options']+='U(xcally-mixmonitor-context)';}}else{_0x3897eb[_0x743e('0x20')]=_0x3897eb[_0x743e('0x20')][_0x743e('0x2c')](_0x743e('0x2d'),'');}_0x332f19[_0x190f6f[_0x8d6745][_0x743e('0x25')]]=_0x3897eb['options'];break;default:_0x332f19[_0x190f6f[_0x8d6745][_0x743e('0x25')]]=_0x2da72d[_0x190f6f[_0x8d6745][_0x743e('0x25')]];}}return _0x332f19[_0x743e('0x29')](',');}function _0x491dfb(_0x170bad,_0x4606ec,_0x3ec16b){return new Promise(function(_0x1d1c3d,_0x18f17e){var _0x23111a=[];if(_[_0x743e('0x2e')](_0x4606ec))return _0x1d1c3d(_0x23111a);_0x570e19['Interval'][_0x743e('0x2f')]({'attributes':['id',_0x743e('0x30'),_0x743e('0x31')],'raw':!![]})[_0x743e('0x32')](function(_0x5ea163){for(var _0x2a50a4=0x0,_0x205bdf=0x0;_0x2a50a4<_0x4606ec[_0x743e('0x23')];_0x2a50a4++,_0x205bdf=0x0){var _0x1a0955=_0x4606ec[_0x2a50a4];var _0x3128bc=[];var _0x359c90=[];delete _0x1a0955['id'];if(_0x1a0955['interval']!==_0x743e('0x33')){_0x1a0955[_0x743e('0x34')]=[_0x1a0955[_0x743e('0x30')]];}else{_0x1a0955[_0x743e('0x34')]=_0x1a0955[_0x743e('0x31')]?_[_0x743e('0x35')](_['filter'](_0x5ea163,{'IntervalId':_0x1a0955[_0x743e('0x31')]}),_0x743e('0x30')):[];}_0x1a0955[_0x743e('0x3')]=_0x170bad['context'];_0x1a0955['exten']=_0x170bad[_0x743e('0xb')];if(_0x1a0955['type'])_0x1a0955['type']=_0x1a0955[_0x743e('0x7')][_0x743e('0x36')]();if(_0x170bad['type']===_0x743e('0xe')){if(_0x1a0955['hasOwnProperty'](_0x743e('0x37'))&&_0x1a0955[_0x743e('0x37')]&&_0x1a0955[_0x743e('0x37')]!=='--'){_0x3128bc['push']({'type':_0x1a0955['type'][_0x743e('0x36')](),'app':_0x743e('0xa'),'appdata':_0x743e('0x38')+_0x1a0955['tag'],'context':_0x170bad[_0x743e('0x3')],'exten':_0x170bad[_0x743e('0xb')],'priority':_0x1a0955[_0x743e('0x34')][_0x743e('0x23')]+_0x3ec16b+_0x205bdf++,'VoiceExtensionId':_0x170bad['id']});}_0x3128bc[_0x743e('0x9')]({'type':_0x1a0955[_0x743e('0x7')][_0x743e('0x36')](),'app':'ExecIf','appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):'+(_0x1a0955[_0x743e('0x39')]?_0x743e('0x3a')+_0x1a0955[_0x743e('0x39')]+')':_0x743e('0x3b')),'context':_0x170bad[_0x743e('0x3')],'exten':_0x170bad['exten'],'priority':_0x1a0955[_0x743e('0x34')]['length']+_0x3ec16b+_0x205bdf++,'VoiceExtensionId':_0x170bad['id']});}else{if(_0x1a0955[_0x743e('0x19')](_0x743e('0x3c'))){if([_0x743e('0x3d'),_0x743e('0x3e')]['includes'](_0x1a0955['app'][_0x743e('0x36')]())&&_0x1a0955['appType']!=='custom'){if(_0x1a0955[_0x743e('0x3c')]){_0x3128bc['push']({'type':_0x1a0955[_0x743e('0x7')][_0x743e('0x36')](),'app':_0x743e('0x15'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x170bad[_0x743e('0x3')],'exten':_0x170bad[_0x743e('0xb')],'priority':_0x1a0955['intervals'][_0x743e('0x23')]+_0x3ec16b+_0x205bdf++,'VoiceExtensionId':_0x170bad['id']});_0x3128bc[_0x743e('0x9')]({'type':_0x1a0955[_0x743e('0x7')][_0x743e('0x36')](),'app':_0x743e('0xa'),'appdata':_0x743e('0x3f'),'context':_0x170bad['context'],'exten':_0x170bad[_0x743e('0xb')],'priority':_0x1a0955[_0x743e('0x34')][_0x743e('0x23')]+_0x3ec16b+_0x205bdf++,'VoiceExtensionId':_0x170bad['id']});}else{_0x3128bc[_0x743e('0x9')]({'type':_0x1a0955[_0x743e('0x7')][_0x743e('0x36')](),'app':_0x743e('0x15'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x170bad[_0x743e('0x3')],'exten':_0x170bad['exten'],'priority':_0x1a0955[_0x743e('0x34')]['length']+_0x3ec16b+_0x205bdf++,'VoiceExtensionId':_0x170bad['id']});_0x3128bc[_0x743e('0x9')]({'type':_0x1a0955[_0x743e('0x7')][_0x743e('0x36')](),'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x170bad[_0x743e('0x3')],'exten':_0x170bad[_0x743e('0xb')],'priority':_0x1a0955[_0x743e('0x34')][_0x743e('0x23')]+_0x3ec16b+_0x205bdf++,'VoiceExtensionId':_0x170bad['id']});}}}}for(var _0x36f41b=0x0;_0x36f41b<_0x1a0955[_0x743e('0x34')][_0x743e('0x23')];_0x36f41b++){var _0x1f2769=_0x3ec16b+_0x1a0955[_0x743e('0x34')][_0x743e('0x23')];var _0x235a04=_0x36f41b===_0x1a0955[_0x743e('0x34')][_0x743e('0x23')]-0x1?_0x3ec16b+_0x3128bc['length']+_0x359c90[_0x743e('0x23')]+0x2:_0x3ec16b+_0x36f41b+0x1;_0x3128bc[_0x743e('0x40')](_0x36f41b,0x0,{'type':_0x170bad[_0x743e('0x7')],'app':'GotoIfTime','appdata':_0x1a0955[_0x743e('0x34')][_0x36f41b]+'?'+_0x170bad[_0x743e('0x3')]+_0x743e('0x41')+_0x1f2769+':'+_0x170bad[_0x743e('0x3')]+_0x743e('0x41')+_0x235a04,'exten':_0x170bad[_0x743e('0xb')],'context':_0x170bad[_0x743e('0x3')],'priority':_0x3ec16b+_0x36f41b,'VoiceExtensionId':_0x170bad['id']});}if(_0x1a0955['appType']===_0x743e('0x42'))_0x1a0955['appdata']=_0x404bec(_0x170bad,_0x1a0955[_0x743e('0x43')]);_0x1a0955[_0x743e('0x44')]=_0x3128bc[_0x743e('0x23')]?_[_0x743e('0x45')](_0x3128bc)['priority']+0x1:_0x3ec16b;_0x23111a=_['concat'](_0x23111a,_0x3128bc,[_0x1a0955],_0x359c90);_0x3ec16b=_[_0x743e('0x45')](_0x23111a)[_0x743e('0x44')]+0x1;}return _0x1d1c3d(_0x23111a);})[_0x743e('0x46')](function(_0x3938b6){_0x18f17e(_0x3938b6);});});}return _0x596e39[_0x743e('0x47')](_0x743e('0x48'),attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x5562d7){var _0xf5ab70=this[_0x743e('0x49')]({'plain':!![]});var _0x370b58=_0xf5ab70[_0x743e('0x7')]===_0x743e('0xe')?_0x2a3c0e(_0xf5ab70):_0x435e3a(_0xf5ab70);return _0x491dfb(_0xf5ab70,_0x5562d7,_[_0x743e('0x45')](_0x370b58)['priority']+0x1)[_0x743e('0x32')](function(_0x48b0a){var _0x456ea3=_[_0x743e('0x4a')](_0x370b58,_0x48b0a);_0x456ea3[_0x743e('0x9')]({'type':_0xf5ab70[_0x743e('0x7')],'app':'Hangup','exten':_0xf5ab70[_0x743e('0xb')],'context':_0xf5ab70['context'],'priority':_['last'](_0x456ea3)[_0x743e('0x44')]+0x1,'VoiceExtensionId':_0xf5ab70['id']});return _0x456ea3;});}}});}; \ No newline at end of file +var _0x50df=['_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','timeout','options','url','split','length','name','phone','prefix','join','param','indexOf','U(xcally-mixmonitor-context)','isEmpty','Interval','interval','then','*,*,*,*','intervals','filter','IntervalId','toLowerCase','tag','CDR(tag)=','Set(CALLERID(all)=','callerID','answer','playback','includes','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress',',${EXTEN},','outboundDial','appdata','priority','last','catch','VoiceExtension','voice_extensions','get','concat','Hangup','lodash','exports','models','Set','CDR(type)=','type','context','exten','NoOp','CDR(routeAlias)=','alias','inbound','push','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','hasOwnProperty','recordingFormat','none'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x50df,0x168));var _0xf50d=function(_0x58d91a,_0x1debe4){_0x58d91a=_0x58d91a-0x0;var _0x5a8116=_0x50df[_0x58d91a];return _0x5a8116;};'use strict';var _=require(_0xf50d('0x0'));var attributes=require('./voiceExtension.attributes');module[_0xf50d('0x1')]=function(_0x3741a8){var _0x3e5a05=_0x3741a8[_0xf50d('0x2')];function _0x126b98(_0x2246d8){var _0x237b8b=0x2;var _0x195f4d=[{'type':_0x2246d8['type'],'app':_0xf50d('0x3'),'appdata':_0xf50d('0x4')+_0x2246d8[_0xf50d('0x5')],'context':_0x2246d8[_0xf50d('0x6')],'exten':_0x2246d8[_0xf50d('0x7')],'priority':_0x237b8b++,'VoiceExtensionId':_0x2246d8['id']},{'type':_0x2246d8[_0xf50d('0x5')],'app':_0x2246d8['alias']?_0xf50d('0x3'):_0xf50d('0x8'),'appdata':_0x2246d8['alias']?_0xf50d('0x9')+_0x2246d8[_0xf50d('0xa')]:'No\x20alias\x20set','context':_0x2246d8[_0xf50d('0x6')],'exten':_0x2246d8[_0xf50d('0x7')],'priority':_0x237b8b++,'VoiceExtensionId':_0x2246d8['id']}];if(_0x2246d8[_0xf50d('0x5')]===_0xf50d('0xb')){_0x195f4d[_0xf50d('0xc')]({'type':_0xf50d('0xb'),'app':_0xf50d('0x3'),'appdata':_0xf50d('0xd')+_0x2246d8['id'],'context':_0x2246d8['context'],'exten':_0x2246d8[_0xf50d('0x7')],'priority':_0x237b8b++,'VoiceExtensionId':_0x2246d8['id']});}_0x195f4d['push']({'type':_0x2246d8['type'],'app':_0xf50d('0x3'),'appdata':_0xf50d('0xe'),'context':_0x2246d8['context'],'exten':_0x2246d8[_0xf50d('0x7')],'priority':_0x237b8b++,'VoiceExtensionId':_0x2246d8['id']},{'type':_0x2246d8[_0xf50d('0x5')],'app':_0xf50d('0x3'),'appdata':_0xf50d('0xf'),'context':_0x2246d8[_0xf50d('0x6')],'exten':_0x2246d8[_0xf50d('0x7')],'priority':_0x237b8b++,'VoiceExtensionId':_0x2246d8['id']},{'type':_0x2246d8[_0xf50d('0x5')],'app':_0xf50d('0x3'),'appdata':_0xf50d('0x10'),'context':_0x2246d8['context'],'exten':_0x2246d8[_0xf50d('0x7')],'priority':_0x237b8b++,'VoiceExtensionId':_0x2246d8['id']});return _0x195f4d;}function _0x32d18b(_0x40e362){var _0x244ff7=0x2;var _0x5aac7e=[{'type':_0xf50d('0x11'),'app':_0xf50d('0x3'),'appdata':'CDR(type)=outbound','context':_0x40e362[_0xf50d('0x6')],'exten':_0x40e362[_0xf50d('0x7')],'priority':_0x244ff7++,'VoiceExtensionId':_0x40e362['id']},{'type':'outbound','app':_0x40e362[_0xf50d('0xa')]?'Set':_0xf50d('0x8'),'appdata':_0x40e362['alias']?_0xf50d('0x9')+_0x40e362[_0xf50d('0xa')]:'No\x20alias\x20set','context':_0x40e362[_0xf50d('0x6')],'exten':_0x40e362[_0xf50d('0x7')],'priority':_0x244ff7++,'VoiceExtensionId':_0x40e362['id']},{'type':_0xf50d('0x11'),'app':'Set','appdata':_0xf50d('0x12')+(_0x40e362[_0xf50d('0x13')]?_0xf50d('0x14')+_0x40e362['cutdigits']+'}':_0xf50d('0x15')),'context':_0x40e362['context'],'exten':_0x40e362[_0xf50d('0x7')],'priority':_0x244ff7++,'VoiceExtensionId':_0x40e362['id']},{'type':_0xf50d('0x11'),'app':_0xf50d('0x3'),'appdata':_0xf50d('0xd')+_0x40e362['id'],'context':_0x40e362[_0xf50d('0x6')],'exten':_0x40e362[_0xf50d('0x7')],'priority':_0x244ff7++,'VoiceExtensionId':_0x40e362['id']},{'type':_0xf50d('0x11'),'app':_0xf50d('0x16'),'appdata':_0xf50d('0x17')+(_0x244ff7+0x2)+'):Goto('+(_0x244ff7+0x1)+')','context':_0x40e362[_0xf50d('0x6')],'exten':_0x40e362['exten'],'priority':_0x244ff7++,'VoiceExtensionId':_0x40e362['id']},{'type':_0xf50d('0x11'),'app':_0xf50d('0x3'),'appdata':_0x40e362[_0xf50d('0x13')]?_0xf50d('0x18')+_0x40e362['cutdigits']+'}':_0xf50d('0x19'),'context':_0x40e362[_0xf50d('0x6')],'exten':_0x40e362['exten'],'priority':_0x244ff7++,'VoiceExtensionId':_0x40e362['id']},{'type':_0xf50d('0x11'),'app':_0xf50d('0x3'),'appdata':_0xf50d('0xe'),'context':_0x40e362[_0xf50d('0x6')],'exten':_0x40e362[_0xf50d('0x7')],'priority':_0x244ff7++,'VoiceExtensionId':_0x40e362['id']},{'type':_0xf50d('0x11'),'app':_0xf50d('0x3'),'appdata':_0xf50d('0xf'),'context':_0x40e362['context'],'exten':_0x40e362['exten'],'priority':_0x244ff7++,'VoiceExtensionId':_0x40e362['id']},{'type':_0xf50d('0x11'),'app':_0xf50d('0x3'),'appdata':_0xf50d('0x10'),'context':_0x40e362[_0xf50d('0x6')],'exten':_0x40e362['exten'],'priority':_0x244ff7++,'VoiceExtensionId':_0x40e362['id']},{'type':'outbound','app':_0xf50d('0x3'),'appdata':_0xf50d('0x1a')+_0x40e362['id'],'context':_0x40e362['context'],'exten':_0x40e362[_0xf50d('0x7')],'priority':_0x244ff7++,'VoiceExtensionId':_0x40e362['id']}];if(_0x40e362[_0xf50d('0x1b')](_0xf50d('0x1c'))&&_0x40e362['recordingFormat']!==_0xf50d('0x1d')){_0x5aac7e[_0xf50d('0xc')]({'type':_0xf50d('0x11'),'app':'Set','appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x40e362['context'],'exten':_0x40e362[_0xf50d('0x7')],'priority':_0x244ff7++,'VoiceExtensionId':_0x40e362['id']},{'type':_0xf50d('0x11'),'app':_0xf50d('0x3'),'appdata':_0xf50d('0x1e')+_0x40e362[_0xf50d('0x1c')]||_0xf50d('0x1f'),'context':_0x40e362['context'],'exten':_0x40e362[_0xf50d('0x7')],'priority':_0x244ff7++,'VoiceExtensionId':_0x40e362['id']});}return _0x5aac7e;}function _0x116d3a(_0x20c919,_0x4b3ab0){var _0x34f21c=[{'name':_0xf50d('0x20'),'param':0x0},{'name':_0xf50d('0x21'),'param':0x1},{'name':_0xf50d('0x22'),'param':0x2},{'name':_0xf50d('0x23'),'param':0x3}];var _0x4e7b7f={};var _0x40f2d5=_0x4b3ab0[_0xf50d('0x24')](',');var _0x53161c=[];for(var _0x3ee7da=0x0;_0x3ee7da<_0x34f21c[_0xf50d('0x25')];_0x3ee7da++){switch(_0x34f21c[_0x3ee7da][_0xf50d('0x26')]){case _0xf50d('0x20'):_0x4e7b7f[_0xf50d('0x20')]=_0x40f2d5[_0x34f21c[_0x3ee7da]['param']][_0xf50d('0x24')]('/')[0x1];_0x4e7b7f[_0xf50d('0x27')]=_0x40f2d5[_0x34f21c[_0x3ee7da]['param']][_0xf50d('0x24')]('/')[0x2];_0x4e7b7f[_0xf50d('0x28')]=_0x4e7b7f[_0xf50d('0x27')]?_0x4e7b7f[_0xf50d('0x27')]['split']('$')[0x0]:undefined;_0x4e7b7f[_0xf50d('0x27')]=_0x20c919['cutdigits']?(_0x4e7b7f['prefix']||'')+_0xf50d('0x14')+_0x20c919['cutdigits']+'}':(_0x4e7b7f[_0xf50d('0x28')]||'')+_0xf50d('0x15');_0x53161c[_0x34f21c[_0x3ee7da]['param']]=['SIP',_0x4e7b7f[_0xf50d('0x20')],_0x4e7b7f['phone']][_0xf50d('0x29')]('/');break;case'options':_0x4e7b7f['options']=_0x40f2d5[_0x34f21c[_0x3ee7da][_0xf50d('0x2a')]];if(_0x20c919[_0xf50d('0x1c')]!==_0xf50d('0x1d')){if(_0x4e7b7f[_0xf50d('0x22')][_0xf50d('0x2b')](_0xf50d('0x2c'))<0x0){_0x4e7b7f['options']+='U(xcally-mixmonitor-context)';}}else{_0x4e7b7f[_0xf50d('0x22')]=_0x4e7b7f['options']['replace']('U(xcally-mixmonitor-context)','');}_0x53161c[_0x34f21c[_0x3ee7da][_0xf50d('0x2a')]]=_0x4e7b7f[_0xf50d('0x22')];break;default:_0x53161c[_0x34f21c[_0x3ee7da][_0xf50d('0x2a')]]=_0x40f2d5[_0x34f21c[_0x3ee7da][_0xf50d('0x2a')]];}}return _0x53161c[_0xf50d('0x29')](',');}function _0xbca06b(_0x116749,_0x619efa,_0x43f3a2){return new Promise(function(_0xbc5a5c,_0x4b036a){var _0x4c7dd8=[];if(_[_0xf50d('0x2d')](_0x619efa))return _0xbc5a5c(_0x4c7dd8);_0x3e5a05[_0xf50d('0x2e')]['findAll']({'attributes':['id',_0xf50d('0x2f'),'IntervalId'],'raw':!![]})[_0xf50d('0x30')](function(_0xca06e5){for(var _0x2ca30a=0x0,_0x557e09=0x0;_0x2ca30a<_0x619efa['length'];_0x2ca30a++,_0x557e09=0x0){var _0x54a700=_0x619efa[_0x2ca30a];var _0x32f354=[];var _0x1f4ccb=[];delete _0x54a700['id'];if(_0x54a700[_0xf50d('0x2f')]!==_0xf50d('0x31')){_0x54a700[_0xf50d('0x32')]=[_0x54a700['interval']];}else{_0x54a700[_0xf50d('0x32')]=_0x54a700['IntervalId']?_['map'](_[_0xf50d('0x33')](_0xca06e5,{'IntervalId':_0x54a700[_0xf50d('0x34')]}),_0xf50d('0x2f')):[];}_0x54a700[_0xf50d('0x6')]=_0x116749[_0xf50d('0x6')];_0x54a700[_0xf50d('0x7')]=_0x116749[_0xf50d('0x7')];if(_0x54a700[_0xf50d('0x5')])_0x54a700[_0xf50d('0x5')]=_0x54a700[_0xf50d('0x5')][_0xf50d('0x35')]();if(_0x116749['type']===_0xf50d('0x11')){if(_0x54a700[_0xf50d('0x1b')](_0xf50d('0x36'))&&_0x54a700['tag']&&_0x54a700[_0xf50d('0x36')]!=='--'){_0x32f354['push']({'type':_0x54a700[_0xf50d('0x5')][_0xf50d('0x35')](),'app':_0xf50d('0x3'),'appdata':_0xf50d('0x37')+_0x54a700[_0xf50d('0x36')],'context':_0x116749[_0xf50d('0x6')],'exten':_0x116749[_0xf50d('0x7')],'priority':_0x54a700[_0xf50d('0x32')][_0xf50d('0x25')]+_0x43f3a2+_0x557e09++,'VoiceExtensionId':_0x116749['id']});}_0x32f354[_0xf50d('0xc')]({'type':_0x54a700['type'][_0xf50d('0x35')](),'app':'ExecIf','appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):'+(_0x54a700['callerID']?_0xf50d('0x38')+_0x54a700[_0xf50d('0x39')]+')':'NoOp(No\x20number\x20available)'),'context':_0x116749[_0xf50d('0x6')],'exten':_0x116749[_0xf50d('0x7')],'priority':_0x54a700[_0xf50d('0x32')][_0xf50d('0x25')]+_0x43f3a2+_0x557e09++,'VoiceExtensionId':_0x116749['id']});}else{if(_0x54a700[_0xf50d('0x1b')](_0xf50d('0x3a'))){if(['queue',_0xf50d('0x3b')][_0xf50d('0x3c')](_0x54a700[_0xf50d('0x3d')][_0xf50d('0x35')]())&&_0x54a700[_0xf50d('0x3e')]!==_0xf50d('0x3f')){if(_0x54a700['answer']){_0x32f354[_0xf50d('0xc')]({'type':_0x54a700['type'][_0xf50d('0x35')](),'app':_0xf50d('0x16'),'appdata':_0xf50d('0x40'),'context':_0x116749['context'],'exten':_0x116749['exten'],'priority':_0x54a700['intervals'][_0xf50d('0x25')]+_0x43f3a2+_0x557e09++,'VoiceExtensionId':_0x116749['id']});_0x32f354[_0xf50d('0xc')]({'type':_0x54a700[_0xf50d('0x5')][_0xf50d('0x35')](),'app':_0xf50d('0x3'),'appdata':_0xf50d('0x41'),'context':_0x116749[_0xf50d('0x6')],'exten':_0x116749[_0xf50d('0x7')],'priority':_0x54a700[_0xf50d('0x32')]['length']+_0x43f3a2+_0x557e09++,'VoiceExtensionId':_0x116749['id']});}else{_0x32f354['push']({'type':_0x54a700['type'][_0xf50d('0x35')](),'app':_0xf50d('0x16'),'appdata':_0xf50d('0x42'),'context':_0x116749[_0xf50d('0x6')],'exten':_0x116749['exten'],'priority':_0x54a700[_0xf50d('0x32')]['length']+_0x43f3a2+_0x557e09++,'VoiceExtensionId':_0x116749['id']});_0x32f354[_0xf50d('0xc')]({'type':_0x54a700[_0xf50d('0x5')]['toLowerCase'](),'app':_0xf50d('0x3'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x116749[_0xf50d('0x6')],'exten':_0x116749[_0xf50d('0x7')],'priority':_0x54a700[_0xf50d('0x32')][_0xf50d('0x25')]+_0x43f3a2+_0x557e09++,'VoiceExtensionId':_0x116749['id']});}}}}for(var _0x4c30ff=0x0;_0x4c30ff<_0x54a700['intervals'][_0xf50d('0x25')];_0x4c30ff++){var _0x571898=_0x43f3a2+_0x54a700[_0xf50d('0x32')][_0xf50d('0x25')];var _0x4b17b8=_0x4c30ff===_0x54a700[_0xf50d('0x32')][_0xf50d('0x25')]-0x1?_0x43f3a2+_0x32f354[_0xf50d('0x25')]+_0x1f4ccb[_0xf50d('0x25')]+0x2:_0x43f3a2+_0x4c30ff+0x1;_0x32f354['splice'](_0x4c30ff,0x0,{'type':_0x116749['type'],'app':'GotoIfTime','appdata':_0x54a700[_0xf50d('0x32')][_0x4c30ff]+'?'+_0x116749[_0xf50d('0x6')]+_0xf50d('0x43')+_0x571898+':'+_0x116749[_0xf50d('0x6')]+',${EXTEN},'+_0x4b17b8,'exten':_0x116749[_0xf50d('0x7')],'context':_0x116749[_0xf50d('0x6')],'priority':_0x43f3a2+_0x4c30ff,'VoiceExtensionId':_0x116749['id']});}if(_0x54a700['appType']===_0xf50d('0x44'))_0x54a700[_0xf50d('0x45')]=_0x116d3a(_0x116749,_0x54a700[_0xf50d('0x45')]);_0x54a700[_0xf50d('0x46')]=_0x32f354['length']?_[_0xf50d('0x47')](_0x32f354)[_0xf50d('0x46')]+0x1:_0x43f3a2;_0x4c7dd8=_['concat'](_0x4c7dd8,_0x32f354,[_0x54a700],_0x1f4ccb);_0x43f3a2=_[_0xf50d('0x47')](_0x4c7dd8)[_0xf50d('0x46')]+0x1;}return _0xbc5a5c(_0x4c7dd8);})[_0xf50d('0x48')](function(_0x39f06f){_0x4b036a(_0x39f06f);});});}return _0x3741a8['define'](_0xf50d('0x49'),attributes,{'tableName':_0xf50d('0x4a'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x1b9bda){var _0x153f79=this[_0xf50d('0x4b')]({'plain':!![]});var _0x3bd102=_0x153f79[_0xf50d('0x5')]==='outbound'?_0x32d18b(_0x153f79):_0x126b98(_0x153f79);return _0xbca06b(_0x153f79,_0x1b9bda,_[_0xf50d('0x47')](_0x3bd102)['priority']+0x1)['then'](function(_0x52ddb4){var _0x35b912=_[_0xf50d('0x4c')](_0x3bd102,_0x52ddb4);_0x35b912[_0xf50d('0xc')]({'type':_0x153f79['type'],'app':_0xf50d('0x4d'),'exten':_0x153f79[_0xf50d('0x7')],'context':_0x153f79[_0xf50d('0x6')],'priority':_[_0xf50d('0x47')](_0x35b912)[_0xf50d('0x46')]+0x1,'VoiceExtensionId':_0x153f79['id']});return _0x35b912;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 24bb15c..0efe2d0 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 _0xb073=['../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','VoiceExtension,\x20%s,\x20%s','VoiceExtension,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','GetVoiceExtension','VoiceExtension','findAll','options','raw','attributes','limit','include','model','map','debug','catch','util','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x3e0fab,_0x285e29){var _0x36cde8=function(_0x124a10){while(--_0x124a10){_0x3e0fab['push'](_0x3e0fab['shift']());}};_0x36cde8(++_0x285e29);}(_0xb073,0x187));var _0x3b07=function(_0x43f2d7,_0x3b37cb){_0x43f2d7=_0x43f2d7-0x0;var _0xcd377e=_0xb073[_0x43f2d7];return _0xcd377e;};'use strict';var _=require('lodash');var util=require(_0x3b07('0x0'));var moment=require('moment');var BPromise=require(_0x3b07('0x1'));var rs=require(_0x3b07('0x2'));var fs=require('fs');var Redis=require(_0x3b07('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x3b07('0x4'));var logger=require(_0x3b07('0x5'))(_0x3b07('0x6'));var config=require('../../config/environment');var jayson=require(_0x3b07('0x7'));var client=jayson[_0x3b07('0x8')][_0x3b07('0x9')]({'port':0x232a});config[_0x3b07('0xa')]=_[_0x3b07('0xb')](config[_0x3b07('0xa')],{'host':_0x3b07('0xc'),'port':0x18eb});var socket=require(_0x3b07('0xd'))(new Redis(config['redis']));require('./voiceExtension.socket')[_0x3b07('0xe')](socket);function respondWithRpcPromise(_0x716b0b,_0x31cf54,_0xf22a0d){return new BPromise(function(_0x470160,_0x1ba4b9){return client[_0x3b07('0xf')](_0x716b0b,_0xf22a0d)[_0x3b07('0x10')](function(_0x1f4577){logger[_0x3b07('0x11')](_0x3b07('0x12'),_0x31cf54,'request\x20sent');logger['debug'](_0x3b07('0x13'),_0x31cf54,_0x3b07('0x14'),JSON[_0x3b07('0x15')](_0x1f4577));if(_0x1f4577['error']){if(_0x1f4577[_0x3b07('0x16')]['code']===0x1f4){logger[_0x3b07('0x16')](_0x3b07('0x12'),_0x31cf54,_0x1f4577[_0x3b07('0x16')][_0x3b07('0x17')]);return _0x1ba4b9(_0x1f4577[_0x3b07('0x16')][_0x3b07('0x17')]);}logger[_0x3b07('0x16')](_0x3b07('0x12'),_0x31cf54,_0x1f4577[_0x3b07('0x16')][_0x3b07('0x17')]);return _0x470160(_0x1f4577['error']['message']);}else{logger['info'](_0x3b07('0x12'),_0x31cf54,_0x3b07('0x14'));_0x470160(_0x1f4577['result']['message']);}})['catch'](function(_0x25bfa8){logger['error'](_0x3b07('0x12'),_0x31cf54,_0x25bfa8);_0x1ba4b9(_0x25bfa8);});});}exports[_0x3b07('0x18')]=function(_0x3b66ff){var _0x3efe1c=this;return new Promise(function(_0x46f659,_0x21bef9){return db[_0x3b07('0x19')][_0x3b07('0x1a')]({'raw':_0x3b66ff[_0x3b07('0x1b')]?_0x3b66ff[_0x3b07('0x1b')][_0x3b07('0x1c')]===undefined?!![]:![]:!![],'where':_0x3b66ff['options']?_0x3b66ff[_0x3b07('0x1b')]['where']||null:null,'attributes':_0x3b66ff[_0x3b07('0x1b')]?_0x3b66ff['options'][_0x3b07('0x1d')]||null:null,'limit':_0x3b66ff['options']?_0x3b66ff[_0x3b07('0x1b')][_0x3b07('0x1e')]||null:null,'include':_0x3b66ff[_0x3b07('0x1b')]?_0x3b66ff['options'][_0x3b07('0x1f')]?_['map'](_0x3b66ff[_0x3b07('0x1b')]['include'],function(_0xbb8016){return{'model':db[_0xbb8016[_0x3b07('0x20')]],'as':_0xbb8016['as'],'attributes':_0xbb8016[_0x3b07('0x1d')],'include':_0xbb8016[_0x3b07('0x1f')]?_[_0x3b07('0x21')](_0xbb8016[_0x3b07('0x1f')],function(_0x43d50f){return{'model':db[_0x43d50f['model']],'as':_0x43d50f['as'],'attributes':_0x43d50f[_0x3b07('0x1d')],'include':_0x43d50f[_0x3b07('0x1f')]?_[_0x3b07('0x21')](_0x43d50f[_0x3b07('0x1f')],function(_0x15c1a1){return{'model':db[_0x15c1a1[_0x3b07('0x20')]],'as':_0x15c1a1['as'],'attributes':_0x15c1a1['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4acc7d){logger['info'](_0x3b07('0x18'),_0x3b66ff);logger[_0x3b07('0x22')](_0x3b07('0x18'),_0x3b66ff,JSON[_0x3b07('0x15')](_0x4acc7d));_0x46f659(_0x4acc7d);})[_0x3b07('0x23')](function(_0x4491f2){logger['error']('GetVoiceExtension',_0x4491f2[_0x3b07('0x17')],_0x3b66ff);_0x21bef9(_0x3efe1c[_0x3b07('0x16')](0x1f4,_0x4491f2[_0x3b07('0x17')]));});});}; \ No newline at end of file +var _0x7ebb=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./voiceExtension.socket','register','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','message','GetVoiceExtension','VoiceExtension','findAll','options','raw','attributes','include','map','model','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x339e61,_0x544b19){var _0x36df2e=function(_0x595b31){while(--_0x595b31){_0x339e61['push'](_0x339e61['shift']());}};_0x36df2e(++_0x544b19);}(_0x7ebb,0x161));var _0xb7eb=function(_0x1d9163,_0x79567d){_0x1d9163=_0x1d9163-0x0;var _0xb42197=_0x7ebb[_0x1d9163];return _0xb42197;};'use strict';var _=require(_0xb7eb('0x0'));var util=require(_0xb7eb('0x1'));var moment=require(_0xb7eb('0x2'));var BPromise=require(_0xb7eb('0x3'));var rs=require(_0xb7eb('0x4'));var fs=require('fs');var Redis=require(_0xb7eb('0x5'));var db=require(_0xb7eb('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xb7eb('0x7'))(_0xb7eb('0x8'));var config=require(_0xb7eb('0x9'));var jayson=require(_0xb7eb('0xa'));var client=jayson[_0xb7eb('0xb')][_0xb7eb('0xc')]({'port':0x232a});config[_0xb7eb('0xd')]=_[_0xb7eb('0xe')](config[_0xb7eb('0xd')],{'host':_0xb7eb('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xb7eb('0x10'))[_0xb7eb('0x11')](socket);function respondWithRpcPromise(_0x24b00f,_0xa9e44,_0x47d0d4){return new BPromise(function(_0x2b0e89,_0x34d935){return client['request'](_0x24b00f,_0x47d0d4)[_0xb7eb('0x12')](function(_0x76ab82){logger[_0xb7eb('0x13')](_0xb7eb('0x14'),_0xa9e44,_0xb7eb('0x15'));logger[_0xb7eb('0x16')](_0xb7eb('0x17'),_0xa9e44,'request\x20sent',JSON[_0xb7eb('0x18')](_0x76ab82));if(_0x76ab82[_0xb7eb('0x19')]){if(_0x76ab82[_0xb7eb('0x19')]['code']===0x1f4){logger[_0xb7eb('0x19')](_0xb7eb('0x14'),_0xa9e44,_0x76ab82[_0xb7eb('0x19')][_0xb7eb('0x1a')]);return _0x34d935(_0x76ab82['error'][_0xb7eb('0x1a')]);}logger['error'](_0xb7eb('0x14'),_0xa9e44,_0x76ab82[_0xb7eb('0x19')][_0xb7eb('0x1a')]);return _0x2b0e89(_0x76ab82['error'][_0xb7eb('0x1a')]);}else{logger[_0xb7eb('0x13')](_0xb7eb('0x14'),_0xa9e44,_0xb7eb('0x15'));_0x2b0e89(_0x76ab82['result'][_0xb7eb('0x1a')]);}})['catch'](function(_0x22dc77){logger[_0xb7eb('0x19')]('VoiceExtension,\x20%s,\x20%s',_0xa9e44,_0x22dc77);_0x34d935(_0x22dc77);});});}exports[_0xb7eb('0x1b')]=function(_0x5ae156){var _0x2d785a=this;return new Promise(function(_0x17ac2c,_0x1b6036){return db[_0xb7eb('0x1c')][_0xb7eb('0x1d')]({'raw':_0x5ae156[_0xb7eb('0x1e')]?_0x5ae156[_0xb7eb('0x1e')][_0xb7eb('0x1f')]===undefined?!![]:![]:!![],'where':_0x5ae156[_0xb7eb('0x1e')]?_0x5ae156['options']['where']||null:null,'attributes':_0x5ae156[_0xb7eb('0x1e')]?_0x5ae156[_0xb7eb('0x1e')][_0xb7eb('0x20')]||null:null,'limit':_0x5ae156[_0xb7eb('0x1e')]?_0x5ae156[_0xb7eb('0x1e')]['limit']||null:null,'include':_0x5ae156[_0xb7eb('0x1e')]?_0x5ae156[_0xb7eb('0x1e')][_0xb7eb('0x21')]?_[_0xb7eb('0x22')](_0x5ae156['options'][_0xb7eb('0x21')],function(_0x48dabb){return{'model':db[_0x48dabb[_0xb7eb('0x23')]],'as':_0x48dabb['as'],'attributes':_0x48dabb[_0xb7eb('0x20')],'include':_0x48dabb[_0xb7eb('0x21')]?_['map'](_0x48dabb[_0xb7eb('0x21')],function(_0x45e14f){return{'model':db[_0x45e14f[_0xb7eb('0x23')]],'as':_0x45e14f['as'],'attributes':_0x45e14f[_0xb7eb('0x20')],'include':_0x45e14f[_0xb7eb('0x21')]?_[_0xb7eb('0x22')](_0x45e14f[_0xb7eb('0x21')],function(_0x23aee6){return{'model':db[_0x23aee6[_0xb7eb('0x23')]],'as':_0x23aee6['as'],'attributes':_0x23aee6[_0xb7eb('0x20')]};}):[]};}):[]};}):[]:[]})[_0xb7eb('0x12')](function(_0x3d75ed){logger[_0xb7eb('0x13')]('GetVoiceExtension',_0x5ae156);logger[_0xb7eb('0x16')]('GetVoiceExtension',_0x5ae156,JSON[_0xb7eb('0x18')](_0x3d75ed));_0x17ac2c(_0x3d75ed);})['catch'](function(_0x409045){logger[_0xb7eb('0x19')]('GetVoiceExtension',_0x409045[_0xb7eb('0x1a')],_0x5ae156);_0x1b6036(_0x2d785a[_0xb7eb('0x19')](0x1f4,_0x409045[_0xb7eb('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 8f09103..63ff113 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 _0x53ec=['length','voiceExtension:','./voiceExtension.events','save','remove','update','emit','removeListener'];(function(_0x4b4077,_0x236c6c){var _0x296908=function(_0x5b1b6f){while(--_0x5b1b6f){_0x4b4077['push'](_0x4b4077['shift']());}};_0x296908(++_0x236c6c);}(_0x53ec,0x192));var _0xc53e=function(_0x27d0d8,_0x2b657d){_0x27d0d8=_0x27d0d8-0x0;var _0x2b79d1=_0x53ec[_0x27d0d8];return _0x2b79d1;};'use strict';var VoiceExtensionEvents=require(_0xc53e('0x0'));var events=[_0xc53e('0x1'),_0xc53e('0x2'),_0xc53e('0x3')];function createListener(_0x1b04cc,_0xe45c6d){return function(_0x51c435){_0xe45c6d[_0xc53e('0x4')](_0x1b04cc,_0x51c435);};}function removeListener(_0x4e954a,_0x2b90f6){return function(){VoiceExtensionEvents[_0xc53e('0x5')](_0x4e954a,_0x2b90f6);};}exports['register']=function(_0x2f1414){for(var _0x4f989b=0x0,_0x41a9e8=events[_0xc53e('0x6')];_0x4f989b<_0x41a9e8;_0x4f989b++){var _0x5d3b28=events[_0x4f989b];var _0x1616ac=createListener(_0xc53e('0x7')+_0x5d3b28,_0x2f1414);VoiceExtensionEvents['on'](_0x5d3b28,_0x1616ac);}}; \ No newline at end of file +var _0x1cb9=['update','emit','removeListener','register','length','./voiceExtension.events','remove'];(function(_0x10004e,_0xd701e6){var _0x5af990=function(_0x4bab6a){while(--_0x4bab6a){_0x10004e['push'](_0x10004e['shift']());}};_0x5af990(++_0xd701e6);}(_0x1cb9,0x14e));var _0x91cb=function(_0x3e803a,_0x22bc16){_0x3e803a=_0x3e803a-0x0;var _0x2d30d3=_0x1cb9[_0x3e803a];return _0x2d30d3;};'use strict';var VoiceExtensionEvents=require(_0x91cb('0x0'));var events=['save',_0x91cb('0x1'),_0x91cb('0x2')];function createListener(_0x2b1894,_0x351bdb){return function(_0x57ea48){_0x351bdb[_0x91cb('0x3')](_0x2b1894,_0x57ea48);};}function removeListener(_0x2b7314,_0x5652cd){return function(){VoiceExtensionEvents[_0x91cb('0x4')](_0x2b7314,_0x5652cd);};}exports[_0x91cb('0x5')]=function(_0x186dc3){for(var _0x28543e=0x0,_0x3b9d98=events[_0x91cb('0x6')];_0x28543e<_0x3b9d98;_0x28543e++){var _0x4c1f56=events[_0x28543e];var _0x15c517=createListener('voiceExtension:'+_0x4c1f56,_0x186dc3);VoiceExtensionEvents['on'](_0x4c1f56,_0x15c517);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 1aecc8f..5eca2f1 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 _0x7ee1=['fs-extra','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','index','isAuthenticated','/:id/messages','create','/:id','update','delete','exports','multer','express','Router'];(function(_0x4358f5,_0x5b1ac6){var _0x4d8104=function(_0x1d4aee){while(--_0x1d4aee){_0x4358f5['push'](_0x4358f5['shift']());}};_0x4d8104(++_0x5b1ac6);}(_0x7ee1,0x8d));var _0x17ee=function(_0x13ac04,_0x1a9202){_0x13ac04=_0x13ac04-0x0;var _0x1fa418=_0x7ee1[_0x13ac04];return _0x1fa418;};'use strict';var multer=require(_0x17ee('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x17ee('0x1'));var router=express[_0x17ee('0x2')]();var fs_extra=require(_0x17ee('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x17ee('0x4'));var config=require(_0x17ee('0x5'));var controller=require(_0x17ee('0x6'));router[_0x17ee('0x7')]('/',auth['isAuthenticated'](),controller[_0x17ee('0x8')]);router[_0x17ee('0x7')]('/:id',auth[_0x17ee('0x9')](),controller['show']);router[_0x17ee('0x7')](_0x17ee('0xa'),auth[_0x17ee('0x9')](),controller['getMessages']);router['post']('/',auth['isAuthenticated'](),controller[_0x17ee('0xb')]);router['put'](_0x17ee('0xc'),auth[_0x17ee('0x9')](),controller[_0x17ee('0xd')]);router[_0x17ee('0xe')]('/:id',auth[_0x17ee('0x9')](),controller['destroy']);module[_0x17ee('0xf')]=router; \ No newline at end of file +var _0xc4aa=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','./voiceMail.controller','get','isAuthenticated','index','/:id','/:id/messages','getMessages','create','put','delete'];(function(_0x119ae1,_0x5f2c5e){var _0x59e966=function(_0x5abaf){while(--_0x5abaf){_0x119ae1['push'](_0x119ae1['shift']());}};_0x59e966(++_0x5f2c5e);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0xc4aa[_0x4f9b18];return _0x29f20c;};'use strict';var multer=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var path=require(_0xac4a('0x2'));var timeout=require(_0xac4a('0x3'));var express=require(_0xac4a('0x4'));var router=express[_0xac4a('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xac4a('0x6'));var controller=require(_0xac4a('0x7'));router[_0xac4a('0x8')]('/',auth[_0xac4a('0x9')](),controller[_0xac4a('0xa')]);router[_0xac4a('0x8')](_0xac4a('0xb'),auth[_0xac4a('0x9')](),controller['show']);router['get'](_0xac4a('0xc'),auth[_0xac4a('0x9')](),controller[_0xac4a('0xd')]);router['post']('/',auth[_0xac4a('0x9')](),controller[_0xac4a('0xe')]);router[_0xac4a('0xf')]('/:id',auth[_0xac4a('0x9')](),controller['update']);router[_0xac4a('0x10')]('/:id',auth[_0xac4a('0x9')](),controller[_0xac4a('0x11')]);module[_0xac4a('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 2357cbe..0c45b3d 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 _0x8bde=['setDataValue','email','string','trim','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20','mailbox','sequelize','exports','STRING','from-voicemail','contest_mailbox'];(function(_0x3907cf,_0x75e619){var _0x5928f8=function(_0x5d7e38){while(--_0x5d7e38){_0x3907cf['push'](_0x3907cf['shift']());}};_0x5928f8(++_0x75e619);}(_0x8bde,0xdf));var _0xe8bd=function(_0x40bffc,_0x3a45d7){_0x40bffc=_0x40bffc-0x0;var _0x3007e9=_0x8bde[_0x40bffc];return _0x3007e9;};'use strict';var Sequelize=require(_0xe8bd('0x0'));module[_0xe8bd('0x1')]={'customer_id':{'type':Sequelize[_0xe8bd('0x2')]},'context':{'type':Sequelize['STRING'],'defaultValue':_0xe8bd('0x3'),'unique':'contest_mailbox'},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'','allowNull':![],'unique':_0xe8bd('0x4')},'password':{'type':Sequelize[_0xe8bd('0x2')]},'fullname':{'type':Sequelize[_0xe8bd('0x2')]},'email':{'type':Sequelize[_0xe8bd('0x2')],'validate':{'isEmail':!![]},'set':function(_0x1ed305){this[_0xe8bd('0x5')](_0xe8bd('0x6'),typeof _0x1ed305===_0xe8bd('0x7')&&_0x1ed305[_0xe8bd('0x8')]()?_0x1ed305['trim']():null);}},'pager':{'type':Sequelize[_0xe8bd('0x2')]},'tz':{'type':Sequelize[_0xe8bd('0x2')],'defaultValue':'central'},'attach':{'type':Sequelize[_0xe8bd('0x9')](_0xe8bd('0xa'),'no'),'defaultValue':_0xe8bd('0xa'),'allowNull':![]},'saycid':{'type':Sequelize['ENUM'](_0xe8bd('0xa'),'no'),'defaultValue':_0xe8bd('0xa'),'allowNull':![]},'dialout':{'type':Sequelize[_0xe8bd('0x2')]},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize[_0xe8bd('0x9')](_0xe8bd('0xa'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xe8bd('0x9')](_0xe8bd('0xa'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xe8bd('0x9')](_0xe8bd('0xa'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xe8bd('0x9')](_0xe8bd('0xa'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xe8bd('0xb'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xe8bd('0x9')](_0xe8bd('0xa'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xe8bd('0x9')](_0xe8bd('0xa'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize['ENUM'](_0xe8bd('0xa'),'no'),'defaultValue':_0xe8bd('0xa'),'allowNull':![]},'forcename':{'type':Sequelize[_0xe8bd('0x9')](_0xe8bd('0xa'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xe8bd('0x9')](_0xe8bd('0xa'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xe8bd('0x9')](_0xe8bd('0xa'),'no'),'defaultValue':_0xe8bd('0xa'),'allowNull':![]},'stamp':{'type':_0xe8bd('0xc')},'emailsubject':{'type':Sequelize[_0xe8bd('0x2')]},'emailbody':{'type':Sequelize[_0xe8bd('0x2')]},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xe8bd('0xd')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xe8bd('0xe')],'get':function(){return this[_0xe8bd('0xf')](_0xe8bd('0x10'))+_0xe8bd('0x11')+this[_0xe8bd('0xf')](_0xe8bd('0x12'));}}}; \ No newline at end of file +var _0xb063=['setDataValue','email','string','trim','central','ENUM','yes','TINYINT(4)','\x20-\x20','mailbox','sequelize','STRING','contest_mailbox'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xb063,0x1eb));var _0x3b06=function(_0x116cde,_0x315b6e){_0x116cde=_0x116cde-0x0;var _0x2ada78=_0xb063[_0x116cde];return _0x2ada78;};'use strict';var Sequelize=require(_0x3b06('0x0'));module['exports']={'customer_id':{'type':Sequelize[_0x3b06('0x1')]},'context':{'type':Sequelize['STRING'],'defaultValue':'from-voicemail','unique':_0x3b06('0x2')},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'','allowNull':![],'unique':_0x3b06('0x2')},'password':{'type':Sequelize[_0x3b06('0x1')]},'fullname':{'type':Sequelize[_0x3b06('0x1')]},'email':{'type':Sequelize[_0x3b06('0x1')],'validate':{'isEmail':!![]},'set':function(_0x1e2c5e){this[_0x3b06('0x3')](_0x3b06('0x4'),typeof _0x1e2c5e===_0x3b06('0x5')&&_0x1e2c5e[_0x3b06('0x6')]()?_0x1e2c5e[_0x3b06('0x6')]():null);}},'pager':{'type':Sequelize['STRING']},'tz':{'type':Sequelize[_0x3b06('0x1')],'defaultValue':_0x3b06('0x7')},'attach':{'type':Sequelize[_0x3b06('0x8')](_0x3b06('0x9'),'no'),'defaultValue':_0x3b06('0x9'),'allowNull':![]},'saycid':{'type':Sequelize[_0x3b06('0x8')](_0x3b06('0x9'),'no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize[_0x3b06('0x1')]},'callback':{'type':Sequelize[_0x3b06('0x1')]},'review':{'type':Sequelize['ENUM'](_0x3b06('0x9'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x3b06('0x8')](_0x3b06('0x9'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM'](_0x3b06('0x9'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x3b06('0x8')](_0x3b06('0x9'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x3b06('0xa'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x3b06('0x8')](_0x3b06('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x3b06('0x8')](_0x3b06('0x9'),'no'),'defaultValue':'yes','allowNull':![]},'forcename':{'type':Sequelize['ENUM'](_0x3b06('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x3b06('0x8')](_0x3b06('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize['ENUM'](_0x3b06('0x9'),'no'),'defaultValue':_0x3b06('0x9'),'allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize[_0x3b06('0x1')]},'emailbody':{'type':Sequelize[_0x3b06('0x1')]},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue']('fullname')+_0x3b06('0xb')+this['getDataValue'](_0x3b06('0xc'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 67e5ecd..5bc05b6 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 _0x57f8=['index','map','VoiceMail','fieldName','key','model','query','filters','intersection','attributes','length','nolimit','order','sort','pick','filter','where','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','fields','find','create','body','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','VoiceMailMessage','hasOwnProperty','mailbox','findAndCountAll','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','destroy','then','get','Voicemails','UserProfileResource','error','name','send'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x57f8,0x198));var _0x857f=function(_0x26f081,_0x4277f3){_0x26f081=_0x26f081-0x0;var _0x4bf032=_0x57f8[_0x26f081];return _0x4bf032;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x857f('0x0'));var zipdir=require(_0x857f('0x1'));var jsonpatch=require(_0x857f('0x2'));var rp=require(_0x857f('0x3'));var moment=require(_0x857f('0x4'));var BPromise=require(_0x857f('0x5'));var Mustache=require(_0x857f('0x6'));var util=require(_0x857f('0x7'));var path=require(_0x857f('0x8'));var sox=require(_0x857f('0x9'));var csv=require(_0x857f('0xa'));var ejs=require(_0x857f('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x857f('0xc'));var squel=require(_0x857f('0xd'));var crypto=require(_0x857f('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x857f('0xf'));var toCsv=require(_0x857f('0xa'));var querystring=require(_0x857f('0x10'));var Papa=require('papaparse');var Redis=require(_0x857f('0x11'));var authService=require(_0x857f('0x12'));var qs=require(_0x857f('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x857f('0x14'));var logger=require(_0x857f('0x15'))(_0x857f('0x16'));var utils=require(_0x857f('0x17'));var config=require(_0x857f('0x18'));var licenseUtil=require(_0x857f('0x19'));var db=require(_0x857f('0x1a'))['db'];function respondWithStatusCode(_0x533631,_0x2e1eda){_0x2e1eda=_0x2e1eda||0xcc;return function(_0x2d5e26){if(_0x2d5e26){return _0x533631[_0x857f('0x1b')](_0x2e1eda);}return _0x533631[_0x857f('0x1c')](_0x2e1eda)[_0x857f('0x1d')]();};}function respondWithResult(_0x4a25ec,_0x4bc590){_0x4bc590=_0x4bc590||0xc8;return function(_0x3b09d9){if(_0x3b09d9){return _0x4a25ec['status'](_0x4bc590)[_0x857f('0x1e')](_0x3b09d9);}};}function respondWithFilteredResult(_0x4ac81f,_0x1d47bf){return function(_0x134a4f){if(_0x134a4f){var _0x5c3a69=typeof _0x1d47bf[_0x857f('0x1f')]===_0x857f('0x20')&&typeof _0x1d47bf[_0x857f('0x21')]===_0x857f('0x20');var _0x279e74=_0x134a4f[_0x857f('0x22')];var _0x1a9ef8=_0x5c3a69?0x0:_0x1d47bf[_0x857f('0x1f')];var _0x1014ca=_0x5c3a69?_0x134a4f[_0x857f('0x22')]:_0x1d47bf[_0x857f('0x1f')]+_0x1d47bf['limit'];var _0x1729d8;if(_0x1014ca>=_0x279e74){_0x1014ca=_0x279e74;_0x1729d8=0xc8;}else{_0x1729d8=0xce;}_0x4ac81f[_0x857f('0x1c')](_0x1729d8);return _0x4ac81f['set'](_0x857f('0x23'),_0x1a9ef8+'-'+_0x1014ca+'/'+_0x279e74)[_0x857f('0x1e')](_0x134a4f);}return null;};}function patchUpdates(_0x377587){return function(_0x484035){try{jsonpatch['apply'](_0x484035,_0x377587,!![]);}catch(_0x12ee77){return BPromise[_0x857f('0x24')](_0x12ee77);}return _0x484035[_0x857f('0x25')]();};}function saveUpdates(_0x4fa031,_0x118237){return function(_0x17a98e){if(_0x17a98e){return _0x17a98e[_0x857f('0x26')](_0x4fa031)['then'](function(_0x1961ea){return _0x1961ea;});}return null;};}function removeEntity(_0x14a8ce,_0x50bfb7){return function(_0x3bc543){if(_0x3bc543){return _0x3bc543[_0x857f('0x27')]()[_0x857f('0x28')](function(){var _0x44ff23=_0x3bc543[_0x857f('0x29')]({'plain':!![]});var _0x3b23a7=_0x857f('0x2a');return db[_0x857f('0x2b')][_0x857f('0x27')]({'where':{'type':_0x3b23a7,'resourceId':_0x44ff23['id']}})[_0x857f('0x28')](function(){return _0x3bc543;});})[_0x857f('0x28')](function(){_0x14a8ce[_0x857f('0x1c')](0xcc)[_0x857f('0x1d')]();});}};}function handleEntityNotFound(_0x46761e,_0x570905){return function(_0x17e415){if(!_0x17e415){_0x46761e[_0x857f('0x1b')](0x194);}return _0x17e415;};}function handleError(_0x23afb8,_0x2c5792){_0x2c5792=_0x2c5792||0x1f4;return function(_0x58c2de){logger[_0x857f('0x2c')](_0x58c2de['stack']);if(_0x58c2de[_0x857f('0x2d')]){delete _0x58c2de[_0x857f('0x2d')];}_0x23afb8[_0x857f('0x1c')](_0x2c5792)[_0x857f('0x2e')](_0x58c2de);};}exports[_0x857f('0x2f')]=function(_0x464e8f,_0x1c4fff){var _0xe79241={},_0x17e7b6={},_0x41f832={'count':0x0,'rows':[]};var _0x24adc2=_[_0x857f('0x30')](db[_0x857f('0x31')]['rawAttributes'],function(_0x3078cf){return{'name':_0x3078cf[_0x857f('0x32')],'type':_0x3078cf['type'][_0x857f('0x33')]};});_0x17e7b6[_0x857f('0x34')]=_['map'](_0x24adc2,_0x857f('0x2d'));_0x17e7b6[_0x857f('0x35')]=_['keys'](_0x464e8f[_0x857f('0x35')]);_0x17e7b6[_0x857f('0x36')]=_[_0x857f('0x37')](_0x17e7b6[_0x857f('0x34')],_0x17e7b6['query']);_0xe79241['attributes']=_[_0x857f('0x37')](_0x17e7b6[_0x857f('0x34')],qs['fields'](_0x464e8f[_0x857f('0x35')]['fields']));_0xe79241[_0x857f('0x38')]=_0xe79241[_0x857f('0x38')][_0x857f('0x39')]?_0xe79241[_0x857f('0x38')]:_0x17e7b6[_0x857f('0x34')];if(!_0x464e8f['query']['hasOwnProperty'](_0x857f('0x3a'))){_0xe79241['limit']=qs[_0x857f('0x21')](_0x464e8f[_0x857f('0x35')][_0x857f('0x21')]);_0xe79241['offset']=qs[_0x857f('0x1f')](_0x464e8f[_0x857f('0x35')][_0x857f('0x1f')]);}_0xe79241[_0x857f('0x3b')]=qs[_0x857f('0x3c')](_0x464e8f[_0x857f('0x35')][_0x857f('0x3c')]);_0xe79241['where']=qs[_0x857f('0x36')](_[_0x857f('0x3d')](_0x464e8f[_0x857f('0x35')],_0x17e7b6[_0x857f('0x36')]),_0x24adc2);if(_0x464e8f[_0x857f('0x35')][_0x857f('0x3e')]){_0xe79241[_0x857f('0x3f')]=_['merge'](_0xe79241[_0x857f('0x3f')],{'$or':_[_0x857f('0x30')](_0x24adc2,function(_0xcd5959){if(_0xcd5959[_0x857f('0x40')]!==_0x857f('0x41')){var _0x1c119f={};_0x1c119f[_0xcd5959['name']]={'$like':'%'+_0x464e8f[_0x857f('0x35')][_0x857f('0x3e')]+'%'};return _0x1c119f;}})});}_0xe79241=_[_0x857f('0x42')]({},_0xe79241,_0x464e8f[_0x857f('0x43')]);var _0x3938ee={'where':_0xe79241[_0x857f('0x3f')]};return db[_0x857f('0x31')][_0x857f('0x22')](_0x3938ee)['then'](function(_0x40fb37){_0x41f832[_0x857f('0x22')]=_0x40fb37;if(_0x464e8f[_0x857f('0x35')][_0x857f('0x44')]){_0xe79241[_0x857f('0x45')]=[{'all':!![]}];}return db[_0x857f('0x31')][_0x857f('0x46')](_0xe79241);})[_0x857f('0x28')](function(_0xb4d7c2){_0x41f832[_0x857f('0x47')]=_0xb4d7c2;return _0x41f832;})[_0x857f('0x28')](respondWithFilteredResult(_0x1c4fff,_0xe79241))[_0x857f('0x48')](handleError(_0x1c4fff,null));};exports[_0x857f('0x49')]=function(_0x376f71,_0x5d4c2a){var _0xe0e078={'raw':!![],'where':{'id':_0x376f71[_0x857f('0x4a')]['id']}},_0x5b2baa={};_0x5b2baa[_0x857f('0x34')]=_[_0x857f('0x4b')](db[_0x857f('0x31')][_0x857f('0x4c')]);_0x5b2baa[_0x857f('0x35')]=_[_0x857f('0x4b')](_0x376f71[_0x857f('0x35')]);_0x5b2baa[_0x857f('0x36')]=_[_0x857f('0x37')](_0x5b2baa[_0x857f('0x34')],_0x5b2baa['query']);_0xe0e078['attributes']=_[_0x857f('0x37')](_0x5b2baa['model'],qs[_0x857f('0x4d')](_0x376f71['query'][_0x857f('0x4d')]));_0xe0e078[_0x857f('0x38')]=_0xe0e078[_0x857f('0x38')][_0x857f('0x39')]?_0xe0e078[_0x857f('0x38')]:_0x5b2baa[_0x857f('0x34')];if(_0x376f71[_0x857f('0x35')][_0x857f('0x44')]){_0xe0e078['include']=[{'all':!![]}];}_0xe0e078=_[_0x857f('0x42')]({},_0xe0e078,_0x376f71[_0x857f('0x43')]);return db[_0x857f('0x31')][_0x857f('0x4e')](_0xe0e078)['then'](handleEntityNotFound(_0x5d4c2a,null))[_0x857f('0x28')](respondWithResult(_0x5d4c2a,null))[_0x857f('0x48')](handleError(_0x5d4c2a,null));};exports[_0x857f('0x4f')]=function(_0x736ef6,_0x67563){return db['VoiceMail'][_0x857f('0x4f')](_0x736ef6[_0x857f('0x50')],{})['then'](function(_0xfd1679){var _0x847879=_0x736ef6['user'][_0x857f('0x29')]({'plain':!![]});if(!_0x847879)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x847879[_0x857f('0x51')]===_0x857f('0x52')){var _0x446fe9=_0xfd1679[_0x857f('0x29')]({'plain':!![]});var _0x58bf27=_0x857f('0x2a');return db[_0x857f('0x53')][_0x857f('0x4e')]({'where':{'name':_0x58bf27,'userProfileId':_0x847879[_0x857f('0x54')]},'raw':!![]})[_0x857f('0x28')](function(_0x4f9d24){if(_0x4f9d24&&_0x4f9d24[_0x857f('0x55')]===0x0){return db[_0x857f('0x2b')][_0x857f('0x4f')]({'name':_0x446fe9[_0x857f('0x2d')],'resourceId':_0x446fe9['id'],'type':_0x4f9d24[_0x857f('0x2d')],'sectionId':_0x4f9d24['id']},{})[_0x857f('0x28')](function(){return _0xfd1679;});}else{return _0xfd1679;}})[_0x857f('0x48')](function(_0x59164a){logger[_0x857f('0x2c')](_0x857f('0x56'),_0x59164a);throw _0x59164a;});}return _0xfd1679;})[_0x857f('0x28')](respondWithResult(_0x67563,0xc9))[_0x857f('0x48')](handleError(_0x67563,null));};exports[_0x857f('0x26')]=function(_0x153e4e,_0x4bb5fc){if(_0x153e4e[_0x857f('0x50')]['id']){delete _0x153e4e[_0x857f('0x50')]['id'];}return db[_0x857f('0x31')][_0x857f('0x4e')]({'where':{'id':_0x153e4e[_0x857f('0x4a')]['id']}})[_0x857f('0x28')](handleEntityNotFound(_0x4bb5fc,null))[_0x857f('0x28')](saveUpdates(_0x153e4e[_0x857f('0x50')],null))['then'](respondWithResult(_0x4bb5fc,null))['catch'](handleError(_0x4bb5fc,null));};exports[_0x857f('0x27')]=function(_0x477653,_0x14b2ff){return db[_0x857f('0x31')][_0x857f('0x4e')]({'where':{'id':_0x477653[_0x857f('0x4a')]['id']}})['then'](handleEntityNotFound(_0x14b2ff,null))[_0x857f('0x28')](removeEntity(_0x14b2ff,null))[_0x857f('0x48')](handleError(_0x14b2ff,null));};exports['getMessages']=function(_0x280a95,_0x5e3759,_0x17f12c){return db[_0x857f('0x31')]['findOne']({'where':{'id':_0x280a95[_0x857f('0x4a')]['id']}})[_0x857f('0x28')](handleEntityNotFound(_0x5e3759,null))[_0x857f('0x28')](function(_0x464208){var _0x868071;var _0x1d096b={},_0x2fed09={};_0x2fed09[_0x857f('0x34')]=_['keys'](db[_0x857f('0x57')][_0x857f('0x4c')]);_0x2fed09[_0x857f('0x35')]=_[_0x857f('0x4b')](_0x280a95[_0x857f('0x35')]);_0x2fed09[_0x857f('0x36')]=_[_0x857f('0x37')](_0x2fed09[_0x857f('0x34')],_0x2fed09[_0x857f('0x35')]);_0x1d096b[_0x857f('0x38')]=_[_0x857f('0x37')](_0x2fed09['model'],qs[_0x857f('0x4d')](_0x280a95[_0x857f('0x35')][_0x857f('0x4d')]));_0x1d096b[_0x857f('0x38')]=_0x1d096b['attributes'][_0x857f('0x39')]?_0x1d096b['attributes']:_0x2fed09[_0x857f('0x34')];if(!_0x280a95[_0x857f('0x35')][_0x857f('0x58')](_0x857f('0x3a'))){_0x1d096b['limit']=qs['limit'](_0x280a95[_0x857f('0x35')][_0x857f('0x21')]);_0x1d096b[_0x857f('0x1f')]=qs['offset'](_0x280a95[_0x857f('0x35')]['offset']);}_0x1d096b[_0x857f('0x3b')]=qs[_0x857f('0x3c')](_0x280a95[_0x857f('0x35')]['sort']);_0x1d096b['where']=qs[_0x857f('0x36')](_[_0x857f('0x3d')](_0x280a95[_0x857f('0x35')],_0x2fed09[_0x857f('0x36')]));if(_0x280a95[_0x857f('0x35')][_0x857f('0x3e')]){_0x1d096b[_0x857f('0x3f')]=_[_0x857f('0x42')](_0x1d096b['where'],{'$or':_['map'](_0x1d096b[_0x857f('0x38')],function(_0xb60b6e){var _0x3f144e={};_0x3f144e[_0xb60b6e]={'$like':'%'+_0x280a95[_0x857f('0x35')][_0x857f('0x3e')]+'%'};return _0x3f144e;})});}_0x1d096b[_0x857f('0x3f')]=_['merge'](_0x1d096b[_0x857f('0x3f')],{'mailboxuser':_0x464208[_0x857f('0x59')]});_0x1d096b=_[_0x857f('0x42')]({},_0x1d096b,_0x280a95[_0x857f('0x43')]);return db[_0x857f('0x57')][_0x857f('0x5a')](_0x1d096b)[_0x857f('0x28')](respondWithFilteredResult(_0x5e3759,_0x1d096b));})[_0x857f('0x48')](handleError(_0x5e3759,null));}; \ No newline at end of file +var _0x4ded=['findAll','rows','catch','show','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','getMessages','findOne','VoiceMailMessage','order','sort','findAndCountAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','reject','save','update','then','destroy','get','Voicemails','UserProfileResource','error','name','index','map','VoiceMail','rawAttributes','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','where','pick','VIRTUAL','filter','merge','options','includeAll','include'];(function(_0x2d8a1f,_0x2c7346){var _0x43c620=function(_0x485e78){while(--_0x485e78){_0x2d8a1f['push'](_0x2d8a1f['shift']());}};_0x43c620(++_0x2c7346);}(_0x4ded,0x116));var _0xd4de=function(_0x3ce6db,_0x53e0ff){_0x3ce6db=_0x3ce6db-0x0;var _0x118a01=_0x4ded[_0x3ce6db];return _0x118a01;};'use strict';var emlformat=require(_0xd4de('0x0'));var rimraf=require(_0xd4de('0x1'));var zipdir=require(_0xd4de('0x2'));var jsonpatch=require(_0xd4de('0x3'));var rp=require(_0xd4de('0x4'));var moment=require(_0xd4de('0x5'));var BPromise=require(_0xd4de('0x6'));var Mustache=require(_0xd4de('0x7'));var util=require(_0xd4de('0x8'));var path=require(_0xd4de('0x9'));var sox=require(_0xd4de('0xa'));var csv=require(_0xd4de('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd4de('0xc'));var _=require(_0xd4de('0xd'));var squel=require(_0xd4de('0xe'));var crypto=require(_0xd4de('0xf'));var jsforce=require(_0xd4de('0x10'));var deskjs=require(_0xd4de('0x11'));var toCsv=require('to-csv');var querystring=require(_0xd4de('0x12'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd4de('0x13'));var as=require(_0xd4de('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xd4de('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xd4de('0x16'));var db=require(_0xd4de('0x17'))['db'];function respondWithStatusCode(_0x104dad,_0x2aa09d){_0x2aa09d=_0x2aa09d||0xcc;return function(_0x3ffc72){if(_0x3ffc72){return _0x104dad[_0xd4de('0x18')](_0x2aa09d);}return _0x104dad[_0xd4de('0x19')](_0x2aa09d)[_0xd4de('0x1a')]();};}function respondWithResult(_0x3e3735,_0x37cb9f){_0x37cb9f=_0x37cb9f||0xc8;return function(_0x691ba9){if(_0x691ba9){return _0x3e3735[_0xd4de('0x19')](_0x37cb9f)[_0xd4de('0x1b')](_0x691ba9);}};}function respondWithFilteredResult(_0xbb4f7e,_0x102e5b){return function(_0xa7c18b){if(_0xa7c18b){var _0x325fba=typeof _0x102e5b['offset']==='undefined'&&typeof _0x102e5b[_0xd4de('0x1c')]===_0xd4de('0x1d');var _0x17b377=_0xa7c18b[_0xd4de('0x1e')];var _0x5b1d1c=_0x325fba?0x0:_0x102e5b['offset'];var _0x1e91d5=_0x325fba?_0xa7c18b['count']:_0x102e5b[_0xd4de('0x1f')]+_0x102e5b[_0xd4de('0x1c')];var _0x50b9e3;if(_0x1e91d5>=_0x17b377){_0x1e91d5=_0x17b377;_0x50b9e3=0xc8;}else{_0x50b9e3=0xce;}_0xbb4f7e[_0xd4de('0x19')](_0x50b9e3);return _0xbb4f7e['set'](_0xd4de('0x20'),_0x5b1d1c+'-'+_0x1e91d5+'/'+_0x17b377)[_0xd4de('0x1b')](_0xa7c18b);}return null;};}function patchUpdates(_0x2bad14){return function(_0x8e8712){try{jsonpatch['apply'](_0x8e8712,_0x2bad14,!![]);}catch(_0x318658){return BPromise[_0xd4de('0x21')](_0x318658);}return _0x8e8712[_0xd4de('0x22')]();};}function saveUpdates(_0xdb3fc,_0x1c631a){return function(_0x2d092a){if(_0x2d092a){return _0x2d092a[_0xd4de('0x23')](_0xdb3fc)[_0xd4de('0x24')](function(_0x2f9de6){return _0x2f9de6;});}return null;};}function removeEntity(_0x413f68,_0x534b37){return function(_0xad333f){if(_0xad333f){return _0xad333f[_0xd4de('0x25')]()[_0xd4de('0x24')](function(){var _0x22970c=_0xad333f[_0xd4de('0x26')]({'plain':!![]});var _0x984904=_0xd4de('0x27');return db[_0xd4de('0x28')][_0xd4de('0x25')]({'where':{'type':_0x984904,'resourceId':_0x22970c['id']}})[_0xd4de('0x24')](function(){return _0xad333f;});})[_0xd4de('0x24')](function(){_0x413f68[_0xd4de('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe64e4e,_0x35e2fc){return function(_0x5005b0){if(!_0x5005b0){_0xe64e4e[_0xd4de('0x18')](0x194);}return _0x5005b0;};}function handleError(_0x59b3c5,_0x44b710){_0x44b710=_0x44b710||0x1f4;return function(_0x32e407){logger[_0xd4de('0x29')](_0x32e407['stack']);if(_0x32e407[_0xd4de('0x2a')]){delete _0x32e407[_0xd4de('0x2a')];}_0x59b3c5[_0xd4de('0x19')](_0x44b710)['send'](_0x32e407);};}exports[_0xd4de('0x2b')]=function(_0x1804c7,_0x55f9f9){var _0x5103b5={},_0x5706fe={},_0x3f6491={'count':0x0,'rows':[]};var _0x496795=_[_0xd4de('0x2c')](db[_0xd4de('0x2d')][_0xd4de('0x2e')],function(_0x2e08eb){return{'name':_0x2e08eb['fieldName'],'type':_0x2e08eb[_0xd4de('0x2f')][_0xd4de('0x30')]};});_0x5706fe['model']=_[_0xd4de('0x2c')](_0x496795,_0xd4de('0x2a'));_0x5706fe['query']=_['keys'](_0x1804c7[_0xd4de('0x31')]);_0x5706fe[_0xd4de('0x32')]=_[_0xd4de('0x33')](_0x5706fe[_0xd4de('0x34')],_0x5706fe['query']);_0x5103b5[_0xd4de('0x35')]=_[_0xd4de('0x33')](_0x5706fe['model'],qs[_0xd4de('0x36')](_0x1804c7[_0xd4de('0x31')][_0xd4de('0x36')]));_0x5103b5[_0xd4de('0x35')]=_0x5103b5[_0xd4de('0x35')][_0xd4de('0x37')]?_0x5103b5['attributes']:_0x5706fe['model'];if(!_0x1804c7[_0xd4de('0x31')][_0xd4de('0x38')](_0xd4de('0x39'))){_0x5103b5['limit']=qs[_0xd4de('0x1c')](_0x1804c7[_0xd4de('0x31')]['limit']);_0x5103b5[_0xd4de('0x1f')]=qs[_0xd4de('0x1f')](_0x1804c7[_0xd4de('0x31')][_0xd4de('0x1f')]);}_0x5103b5['order']=qs['sort'](_0x1804c7[_0xd4de('0x31')]['sort']);_0x5103b5[_0xd4de('0x3a')]=qs['filters'](_[_0xd4de('0x3b')](_0x1804c7[_0xd4de('0x31')],_0x5706fe[_0xd4de('0x32')]),_0x496795);if(_0x1804c7[_0xd4de('0x31')]['filter']){_0x5103b5[_0xd4de('0x3a')]=_['merge'](_0x5103b5[_0xd4de('0x3a')],{'$or':_[_0xd4de('0x2c')](_0x496795,function(_0x7f17b9){if(_0x7f17b9[_0xd4de('0x2f')]!==_0xd4de('0x3c')){var _0x13c256={};_0x13c256[_0x7f17b9[_0xd4de('0x2a')]]={'$like':'%'+_0x1804c7['query'][_0xd4de('0x3d')]+'%'};return _0x13c256;}})});}_0x5103b5=_[_0xd4de('0x3e')]({},_0x5103b5,_0x1804c7[_0xd4de('0x3f')]);var _0x2ec1fa={'where':_0x5103b5[_0xd4de('0x3a')]};return db['VoiceMail'][_0xd4de('0x1e')](_0x2ec1fa)[_0xd4de('0x24')](function(_0x2294e2){_0x3f6491['count']=_0x2294e2;if(_0x1804c7[_0xd4de('0x31')][_0xd4de('0x40')]){_0x5103b5[_0xd4de('0x41')]=[{'all':!![]}];}return db['VoiceMail'][_0xd4de('0x42')](_0x5103b5);})[_0xd4de('0x24')](function(_0x419c49){_0x3f6491[_0xd4de('0x43')]=_0x419c49;return _0x3f6491;})[_0xd4de('0x24')](respondWithFilteredResult(_0x55f9f9,_0x5103b5))[_0xd4de('0x44')](handleError(_0x55f9f9,null));};exports[_0xd4de('0x45')]=function(_0x5ecbbd,_0x43b542){var _0x164bde={'raw':!![],'where':{'id':_0x5ecbbd['params']['id']}},_0x58082a={};_0x58082a[_0xd4de('0x34')]=_[_0xd4de('0x46')](db[_0xd4de('0x2d')]['rawAttributes']);_0x58082a['query']=_[_0xd4de('0x46')](_0x5ecbbd[_0xd4de('0x31')]);_0x58082a['filters']=_[_0xd4de('0x33')](_0x58082a[_0xd4de('0x34')],_0x58082a[_0xd4de('0x31')]);_0x164bde[_0xd4de('0x35')]=_['intersection'](_0x58082a[_0xd4de('0x34')],qs[_0xd4de('0x36')](_0x5ecbbd[_0xd4de('0x31')][_0xd4de('0x36')]));_0x164bde[_0xd4de('0x35')]=_0x164bde[_0xd4de('0x35')]['length']?_0x164bde[_0xd4de('0x35')]:_0x58082a[_0xd4de('0x34')];if(_0x5ecbbd[_0xd4de('0x31')][_0xd4de('0x40')]){_0x164bde[_0xd4de('0x41')]=[{'all':!![]}];}_0x164bde=_[_0xd4de('0x3e')]({},_0x164bde,_0x5ecbbd[_0xd4de('0x3f')]);return db[_0xd4de('0x2d')][_0xd4de('0x47')](_0x164bde)[_0xd4de('0x24')](handleEntityNotFound(_0x43b542,null))['then'](respondWithResult(_0x43b542,null))[_0xd4de('0x44')](handleError(_0x43b542,null));};exports[_0xd4de('0x48')]=function(_0x178daf,_0x518bfe){return db[_0xd4de('0x2d')][_0xd4de('0x48')](_0x178daf[_0xd4de('0x49')],{})[_0xd4de('0x24')](function(_0x42e58e){var _0xa24bb7=_0x178daf[_0xd4de('0x4a')][_0xd4de('0x26')]({'plain':!![]});if(!_0xa24bb7)throw new Error(_0xd4de('0x4b'));if(_0xa24bb7[_0xd4de('0x4c')]==='user'){var _0x3e4c7f=_0x42e58e[_0xd4de('0x26')]({'plain':!![]});var _0x215f85=_0xd4de('0x27');return db[_0xd4de('0x4d')]['find']({'where':{'name':_0x215f85,'userProfileId':_0xa24bb7['userProfileId']},'raw':!![]})[_0xd4de('0x24')](function(_0x2deedb){if(_0x2deedb&&_0x2deedb['autoAssociation']===0x0){return db['UserProfileResource'][_0xd4de('0x48')]({'name':_0x3e4c7f[_0xd4de('0x2a')],'resourceId':_0x3e4c7f['id'],'type':_0x2deedb[_0xd4de('0x2a')],'sectionId':_0x2deedb['id']},{})[_0xd4de('0x24')](function(){return _0x42e58e;});}else{return _0x42e58e;}})[_0xd4de('0x44')](function(_0x15c8cd){logger[_0xd4de('0x29')](_0xd4de('0x4e'),_0x15c8cd);throw _0x15c8cd;});}return _0x42e58e;})[_0xd4de('0x24')](respondWithResult(_0x518bfe,0xc9))[_0xd4de('0x44')](handleError(_0x518bfe,null));};exports[_0xd4de('0x23')]=function(_0x2e1780,_0x56c13e){if(_0x2e1780[_0xd4de('0x49')]['id']){delete _0x2e1780[_0xd4de('0x49')]['id'];}return db[_0xd4de('0x2d')][_0xd4de('0x47')]({'where':{'id':_0x2e1780[_0xd4de('0x4f')]['id']}})[_0xd4de('0x24')](handleEntityNotFound(_0x56c13e,null))['then'](saveUpdates(_0x2e1780[_0xd4de('0x49')],null))['then'](respondWithResult(_0x56c13e,null))['catch'](handleError(_0x56c13e,null));};exports[_0xd4de('0x25')]=function(_0xd79781,_0x2d1e45){return db[_0xd4de('0x2d')]['find']({'where':{'id':_0xd79781[_0xd4de('0x4f')]['id']}})[_0xd4de('0x24')](handleEntityNotFound(_0x2d1e45,null))[_0xd4de('0x24')](removeEntity(_0x2d1e45,null))[_0xd4de('0x44')](handleError(_0x2d1e45,null));};exports[_0xd4de('0x50')]=function(_0x4bb7df,_0x5496f7,_0x4b55cc){return db[_0xd4de('0x2d')][_0xd4de('0x51')]({'where':{'id':_0x4bb7df[_0xd4de('0x4f')]['id']}})[_0xd4de('0x24')](handleEntityNotFound(_0x5496f7,null))['then'](function(_0x35ba6f){var _0x146eaa;var _0x2e0d76={},_0x17047a={};_0x17047a['model']=_[_0xd4de('0x46')](db[_0xd4de('0x52')][_0xd4de('0x2e')]);_0x17047a[_0xd4de('0x31')]=_['keys'](_0x4bb7df['query']);_0x17047a['filters']=_[_0xd4de('0x33')](_0x17047a[_0xd4de('0x34')],_0x17047a[_0xd4de('0x31')]);_0x2e0d76['attributes']=_[_0xd4de('0x33')](_0x17047a[_0xd4de('0x34')],qs[_0xd4de('0x36')](_0x4bb7df['query'][_0xd4de('0x36')]));_0x2e0d76['attributes']=_0x2e0d76[_0xd4de('0x35')][_0xd4de('0x37')]?_0x2e0d76[_0xd4de('0x35')]:_0x17047a[_0xd4de('0x34')];if(!_0x4bb7df[_0xd4de('0x31')][_0xd4de('0x38')](_0xd4de('0x39'))){_0x2e0d76[_0xd4de('0x1c')]=qs['limit'](_0x4bb7df[_0xd4de('0x31')]['limit']);_0x2e0d76[_0xd4de('0x1f')]=qs[_0xd4de('0x1f')](_0x4bb7df['query'][_0xd4de('0x1f')]);}_0x2e0d76[_0xd4de('0x53')]=qs[_0xd4de('0x54')](_0x4bb7df[_0xd4de('0x31')][_0xd4de('0x54')]);_0x2e0d76[_0xd4de('0x3a')]=qs[_0xd4de('0x32')](_[_0xd4de('0x3b')](_0x4bb7df[_0xd4de('0x31')],_0x17047a[_0xd4de('0x32')]));if(_0x4bb7df[_0xd4de('0x31')][_0xd4de('0x3d')]){_0x2e0d76[_0xd4de('0x3a')]=_['merge'](_0x2e0d76[_0xd4de('0x3a')],{'$or':_[_0xd4de('0x2c')](_0x2e0d76[_0xd4de('0x35')],function(_0x331f08){var _0x25628e={};_0x25628e[_0x331f08]={'$like':'%'+_0x4bb7df[_0xd4de('0x31')][_0xd4de('0x3d')]+'%'};return _0x25628e;})});}_0x2e0d76[_0xd4de('0x3a')]=_['merge'](_0x2e0d76[_0xd4de('0x3a')],{'mailboxuser':_0x35ba6f['mailbox']});_0x2e0d76=_['merge']({},_0x2e0d76,_0x4bb7df['options']);return db[_0xd4de('0x52')][_0xd4de('0x55')](_0x2e0d76)['then'](respondWithFilteredResult(_0x5496f7,_0x2e0d76));})['catch'](handleError(_0x5496f7,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 262648b..3625d43 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 _0x5af8=['../../config/environment','./voiceMail.attributes','define','VoiceMail','voice_voicemail','mailbox_context','mailbox','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x283081,_0x1d174a){var _0x37c1d2=function(_0x76d8ae){while(--_0x76d8ae){_0x283081['push'](_0x283081['shift']());}};_0x37c1d2(++_0x1d174a);}(_0x5af8,0x181));var _0x85af=function(_0x4ff886,_0x26067e){_0x4ff886=_0x4ff886-0x0;var _0x2eb543=_0x5af8[_0x4ff886];return _0x2eb543;};'use strict';var _=require(_0x85af('0x0'));var util=require(_0x85af('0x1'));var logger=require(_0x85af('0x2'))(_0x85af('0x3'));var moment=require(_0x85af('0x4'));var BPromise=require('bluebird');var rp=require(_0x85af('0x5'));var fs=require('fs');var path=require(_0x85af('0x6'));var rimraf=require('rimraf');var config=require(_0x85af('0x7'));var attributes=require(_0x85af('0x8'));module['exports']=function(_0x3a279d,_0x2f84b7){return _0x3a279d[_0x85af('0x9')](_0x85af('0xa'),attributes,{'tableName':_0x85af('0xb'),'paranoid':![],'indexes':[{'name':_0x85af('0xc'),'fields':[_0x85af('0xd'),'context']}],'timestamps':!![]});}; \ No newline at end of file +var _0x627b=['rimraf','../../config/environment','./voiceMail.attributes','exports','define','VoiceMail','voice_voicemail','mailbox_context','mailbox','context','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x2f8aaa,_0x186a48){var _0x7f8274=function(_0x40155b){while(--_0x40155b){_0x2f8aaa['push'](_0x2f8aaa['shift']());}};_0x7f8274(++_0x186a48);}(_0x627b,0x12b));var _0xb627=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x627b[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0xb627('0x0'));var util=require(_0xb627('0x1'));var logger=require(_0xb627('0x2'))(_0xb627('0x3'));var moment=require(_0xb627('0x4'));var BPromise=require(_0xb627('0x5'));var rp=require(_0xb627('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb627('0x7'));var config=require(_0xb627('0x8'));var attributes=require(_0xb627('0x9'));module[_0xb627('0xa')]=function(_0x344ca2,_0x149996){return _0x344ca2[_0xb627('0xb')](_0xb627('0xc'),attributes,{'tableName':_0xb627('0xd'),'paranoid':![],'indexes':[{'name':_0xb627('0xe'),'fields':[_0xb627('0xf'),_0xb627('0x10')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 18b2666..71df180 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 _0x0284=['error','VoiceMail,\x20%s,\x20%s','message','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','debug','VoiceMail,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x1c0e0a,_0x3df5cf){var _0x339c78=function(_0xbf3b80){while(--_0xbf3b80){_0x1c0e0a['push'](_0x1c0e0a['shift']());}};_0x339c78(++_0x3df5cf);}(_0x0284,0xab));var _0x4028=function(_0x59befa,_0x4af99b){_0x59befa=_0x59befa-0x0;var _0x1dd63d=_0x0284[_0x59befa];return _0x1dd63d;};'use strict';var _=require(_0x4028('0x0'));var util=require(_0x4028('0x1'));var moment=require(_0x4028('0x2'));var BPromise=require('bluebird');var rs=require(_0x4028('0x3'));var fs=require('fs');var Redis=require(_0x4028('0x4'));var db=require(_0x4028('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4028('0x6'))(_0x4028('0x7'));var config=require(_0x4028('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x4028('0x9')][_0x4028('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15083a,_0x3a31e9,_0x1bede8){return new BPromise(function(_0x28deb9,_0x123761){return client[_0x4028('0xb')](_0x15083a,_0x1bede8)[_0x4028('0xc')](function(_0x38a929){logger[_0x4028('0xd')]('VoiceMail,\x20%s,\x20%s',_0x3a31e9,'request\x20sent');logger[_0x4028('0xe')](_0x4028('0xf'),_0x3a31e9,_0x4028('0x10'),JSON[_0x4028('0x11')](_0x38a929));if(_0x38a929[_0x4028('0x12')]){if(_0x38a929['error']['code']===0x1f4){logger['error'](_0x4028('0x13'),_0x3a31e9,_0x38a929[_0x4028('0x12')]['message']);return _0x123761(_0x38a929[_0x4028('0x12')][_0x4028('0x14')]);}logger[_0x4028('0x12')](_0x4028('0x13'),_0x3a31e9,_0x38a929[_0x4028('0x12')]['message']);return _0x28deb9(_0x38a929[_0x4028('0x12')][_0x4028('0x14')]);}else{logger[_0x4028('0xd')](_0x4028('0x13'),_0x3a31e9,_0x4028('0x10'));_0x28deb9(_0x38a929['result'][_0x4028('0x14')]);}})['catch'](function(_0x487a23){logger[_0x4028('0x12')](_0x4028('0x13'),_0x3a31e9,_0x487a23);_0x123761(_0x487a23);});});} \ No newline at end of file +var _0xc4d0=['VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','VoiceMail,\x20%s,\x20%s','debug'];(function(_0x19dfd4,_0x16c30d){var _0x215b5c=function(_0x3d16b2){while(--_0x3d16b2){_0x19dfd4['push'](_0x19dfd4['shift']());}};_0x215b5c(++_0x16c30d);}(_0xc4d0,0x1d4));var _0x0c4d=function(_0x5338fe,_0x5e71d1){_0x5338fe=_0x5338fe-0x0;var _0xf0a1be=_0xc4d0[_0x5338fe];return _0xf0a1be;};'use strict';var _=require(_0x0c4d('0x0'));var util=require(_0x0c4d('0x1'));var moment=require(_0x0c4d('0x2'));var BPromise=require(_0x0c4d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0c4d('0x4'));var db=require(_0x0c4d('0x5'))['db'];var utils=require(_0x0c4d('0x6'));var logger=require('../../config/logger')(_0x0c4d('0x7'));var config=require(_0x0c4d('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0c4d('0x9')][_0x0c4d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3c5469,_0x17da0c,_0xbd8b18){return new BPromise(function(_0x28a0cc,_0x1e6c4a){return client[_0x0c4d('0xb')](_0x3c5469,_0xbd8b18)[_0x0c4d('0xc')](function(_0x1b8068){logger['info'](_0x0c4d('0xd'),_0x17da0c,'request\x20sent');logger[_0x0c4d('0xe')](_0x0c4d('0xf'),_0x17da0c,'request\x20sent',JSON[_0x0c4d('0x10')](_0x1b8068));if(_0x1b8068[_0x0c4d('0x11')]){if(_0x1b8068[_0x0c4d('0x11')][_0x0c4d('0x12')]===0x1f4){logger[_0x0c4d('0x11')](_0x0c4d('0xd'),_0x17da0c,_0x1b8068[_0x0c4d('0x11')][_0x0c4d('0x13')]);return _0x1e6c4a(_0x1b8068[_0x0c4d('0x11')][_0x0c4d('0x13')]);}logger[_0x0c4d('0x11')](_0x0c4d('0xd'),_0x17da0c,_0x1b8068[_0x0c4d('0x11')]['message']);return _0x28a0cc(_0x1b8068[_0x0c4d('0x11')]['message']);}else{logger[_0x0c4d('0x14')]('VoiceMail,\x20%s,\x20%s',_0x17da0c,_0x0c4d('0x15'));_0x28a0cc(_0x1b8068['result'][_0x0c4d('0x13')]);}})[_0x0c4d('0x16')](function(_0x43034a){logger['error'](_0x0c4d('0xd'),_0x17da0c,_0x43034a);_0x1e6c4a(_0x43034a);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index fc4ee8a..d0b29be 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 _0x29d4=['show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','/:id'];(function(_0x41882a,_0x57d4b6){var _0x224245=function(_0x558f92){while(--_0x558f92){_0x41882a['push'](_0x41882a['shift']());}};_0x224245(++_0x57d4b6);}(_0x29d4,0xce));var _0x429d=function(_0x2cf2e9,_0xd58ea1){_0x2cf2e9=_0x2cf2e9-0x0;var _0xd3670d=_0x29d4[_0x2cf2e9];return _0xd3670d;};'use strict';var multer=require('multer');var util=require(_0x429d('0x0'));var path=require(_0x429d('0x1'));var timeout=require(_0x429d('0x2'));var express=require(_0x429d('0x3'));var router=express[_0x429d('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x429d('0x5'));var controller=require(_0x429d('0x6'));router[_0x429d('0x7')]('/',auth[_0x429d('0x8')](),controller['index']);router['get'](_0x429d('0x9'),auth[_0x429d('0x8')](),controller[_0x429d('0xa')]);router[_0x429d('0x7')]('/:id/download',auth[_0x429d('0x8')](),controller['download']);router[_0x429d('0xb')]('/',auth[_0x429d('0x8')](),controller[_0x429d('0xc')]);router[_0x429d('0xd')]('/:id',auth[_0x429d('0x8')](),controller[_0x429d('0xe')]);router[_0x429d('0xf')](_0x429d('0x9'),auth[_0x429d('0x8')](),controller[_0x429d('0x10')]);module[_0x429d('0x11')]=router; \ No newline at end of file +var _0x4e60=['get','isAuthenticated','index','/:id','/:id/download','download','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceMailMessage.controller'];(function(_0x3c8cb5,_0x1ef7a9){var _0x37ecab=function(_0x4b7421){while(--_0x4b7421){_0x3c8cb5['push'](_0x3c8cb5['shift']());}};_0x37ecab(++_0x1ef7a9);}(_0x4e60,0x7a));var _0x04e6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4e60[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x04e6('0x0'));var util=require(_0x04e6('0x1'));var path=require(_0x04e6('0x2'));var timeout=require(_0x04e6('0x3'));var express=require(_0x04e6('0x4'));var router=express[_0x04e6('0x5')]();var fs_extra=require(_0x04e6('0x6'));var auth=require(_0x04e6('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x04e6('0x8'));var controller=require(_0x04e6('0x9'));router[_0x04e6('0xa')]('/',auth[_0x04e6('0xb')](),controller[_0x04e6('0xc')]);router[_0x04e6('0xa')](_0x04e6('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x04e6('0xa')](_0x04e6('0xe'),auth[_0x04e6('0xb')](),controller[_0x04e6('0xf')]);router[_0x04e6('0x10')]('/',auth[_0x04e6('0xb')](),controller[_0x04e6('0x11')]);router[_0x04e6('0x12')](_0x04e6('0xd'),auth['isAuthenticated'](),controller[_0x04e6('0x13')]);router[_0x04e6('0x14')](_0x04e6('0xd'),auth[_0x04e6('0xb')](),controller[_0x04e6('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 469843d..4c39c21 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 _0x457b=['long','TIMESTAMP','literal','VIRTUAL','INTEGER','STRING'];(function(_0x5eab06,_0x3d4afe){var _0x5aafb0=function(_0x7645f7){while(--_0x7645f7){_0x5eab06['push'](_0x5eab06['shift']());}};_0x5aafb0(++_0x3d4afe);}(_0x457b,0x1ef));var _0xb457=function(_0x48921a,_0x5d6dca){_0x48921a=_0x48921a-0x0;var _0x2efcdc=_0x457b[_0x48921a];return _0x2efcdc;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xb457('0x0')],'get':function(_0x1b1a67){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize[_0xb457('0x1')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize[_0xb457('0x2')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xb457('0x2')],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize[_0xb457('0x2')],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xb457('0x2')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xb457('0x2')],'defaultValue':''},'recording':{'type':Sequelize['BLOB'](_0xb457('0x3')),'defaultValue':null},'flag':{'type':Sequelize[_0xb457('0x2')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':_0xb457('0x4'),'defaultValue':Sequelize[_0xb457('0x5')]('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file +var _0x94e6=['INTEGER','STRING','long','TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','exports','VIRTUAL','getDataValue'];(function(_0x511238,_0x6c6087){var _0x42c15b=function(_0xa12ecf){while(--_0xa12ecf){_0x511238['push'](_0x511238['shift']());}};_0x42c15b(++_0x6c6087);}(_0x94e6,0x72));var _0x694e=function(_0x549476,_0x490fc9){_0x549476=_0x549476-0x0;var _0x3d0805=_0x94e6[_0x549476];return _0x3d0805;};'use strict';var Sequelize=require('sequelize');module[_0x694e('0x0')]={'name':{'type':Sequelize[_0x694e('0x1')],'get':function(_0x5b1d72){return this[_0x694e('0x2')]('id');}},'msgnum':{'type':Sequelize[_0x694e('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x694e('0x4')],'defaultValue':''},'callerid':{'type':Sequelize[_0x694e('0x4')],'defaultValue':''},'origtime':{'type':Sequelize[_0x694e('0x4')],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x694e('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x694e('0x4')],'defaultValue':''},'recording':{'type':Sequelize['BLOB'](_0x694e('0x5')),'defaultValue':null},'flag':{'type':Sequelize[_0x694e('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':_0x694e('0x6'),'defaultValue':Sequelize[_0x694e('0x7')](_0x694e('0x8'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index f559cf0..1615867 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 _0x1219=['bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','VoiceMailMessage','fieldName','key','model','differenceBy','map','query','keys','filters','attributes','intersection','fields','length','nolimit','sort','where','pick','merge','type','VIRTUAL','filter','options','include','catch','show','params','rawAttributes','includeAll','find','create','body','download','recording','msg_id','Sequelize','VoiceMailMessage\x20not\x20found','audio/wav','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x3c0159,_0x253316){var _0x599932=function(_0x3018b9){while(--_0x3018b9){_0x3c0159['push'](_0x3c0159['shift']());}};_0x599932(++_0x253316);}(_0x1219,0xac));var _0x9121=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1219[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x9121('0x0'));var rimraf=require(_0x9121('0x1'));var zipdir=require(_0x9121('0x2'));var jsonpatch=require(_0x9121('0x3'));var rp=require(_0x9121('0x4'));var moment=require(_0x9121('0x5'));var BPromise=require(_0x9121('0x6'));var Mustache=require(_0x9121('0x7'));var util=require(_0x9121('0x8'));var path=require(_0x9121('0x9'));var sox=require(_0x9121('0xa'));var csv=require('to-csv');var ejs=require(_0x9121('0xb'));var fs=require('fs');var fs_extra=require(_0x9121('0xc'));var _=require(_0x9121('0xd'));var squel=require(_0x9121('0xe'));var crypto=require(_0x9121('0xf'));var jsforce=require(_0x9121('0x10'));var deskjs=require(_0x9121('0x11'));var toCsv=require(_0x9121('0x12'));var querystring=require(_0x9121('0x13'));var Papa=require(_0x9121('0x14'));var Redis=require(_0x9121('0x15'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x9121('0x16'));var hardwareService=require(_0x9121('0x17'));var logger=require(_0x9121('0x18'))(_0x9121('0x19'));var utils=require(_0x9121('0x1a'));var config=require(_0x9121('0x1b'));var licenseUtil=require(_0x9121('0x1c'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x37d489,_0x3d82ec){_0x3d82ec=_0x3d82ec||0xcc;return function(_0x71b6f8){if(_0x71b6f8){return _0x37d489[_0x9121('0x1d')](_0x3d82ec);}return _0x37d489[_0x9121('0x1e')](_0x3d82ec)[_0x9121('0x1f')]();};}function respondWithResult(_0xb3e2da,_0x26e2ca){_0x26e2ca=_0x26e2ca||0xc8;return function(_0x15281b){if(_0x15281b){return _0xb3e2da[_0x9121('0x1e')](_0x26e2ca)[_0x9121('0x20')](_0x15281b);}};}function respondWithFilteredResult(_0x2e5f38,_0x4bc518){return function(_0x224d53){if(_0x224d53){var _0x1384f9=typeof _0x4bc518[_0x9121('0x21')]===_0x9121('0x22')&&typeof _0x4bc518['limit']===_0x9121('0x22');var _0x385016=_0x224d53[_0x9121('0x23')];var _0x4e1c6a=_0x1384f9?0x0:_0x4bc518['offset'];var _0x3af334=_0x1384f9?_0x224d53[_0x9121('0x23')]:_0x4bc518[_0x9121('0x21')]+_0x4bc518[_0x9121('0x24')];var _0x1d2d70;if(_0x3af334>=_0x385016){_0x3af334=_0x385016;_0x1d2d70=0xc8;}else{_0x1d2d70=0xce;}_0x2e5f38[_0x9121('0x1e')](_0x1d2d70);return _0x2e5f38[_0x9121('0x25')](_0x9121('0x26'),_0x4e1c6a+'-'+_0x3af334+'/'+_0x385016)[_0x9121('0x20')](_0x224d53);}return null;};}function patchUpdates(_0x33c328){return function(_0x4e3fd6){try{jsonpatch[_0x9121('0x27')](_0x4e3fd6,_0x33c328,!![]);}catch(_0x2b22c6){return BPromise[_0x9121('0x28')](_0x2b22c6);}return _0x4e3fd6[_0x9121('0x29')]();};}function saveUpdates(_0x460b4d,_0x4ec136){return function(_0x1aaffa){if(_0x1aaffa){return _0x1aaffa[_0x9121('0x2a')](_0x460b4d)[_0x9121('0x2b')](function(_0x4e25e0){return _0x4e25e0;});}return null;};}function removeEntity(_0x75dd26,_0x4821fa){return function(_0x29edc7){if(_0x29edc7){return _0x29edc7[_0x9121('0x2c')]()[_0x9121('0x2b')](function(){_0x75dd26[_0x9121('0x1e')](0xcc)[_0x9121('0x1f')]();});}};}function handleEntityNotFound(_0x3c66ac,_0x44004b){return function(_0xebac9a){if(!_0xebac9a){_0x3c66ac[_0x9121('0x1d')](0x194);}return _0xebac9a;};}function handleError(_0x1e9890,_0x134468){_0x134468=_0x134468||0x1f4;return function(_0x4ea2a0){logger[_0x9121('0x2d')](_0x4ea2a0['stack']);if(_0x4ea2a0[_0x9121('0x2e')]){delete _0x4ea2a0[_0x9121('0x2e')];}_0x1e9890[_0x9121('0x1e')](_0x134468)[_0x9121('0x2f')](_0x4ea2a0);};}exports[_0x9121('0x30')]=function(_0x26d17f,_0x45e745){var _0x2b6bd8={},_0x5755bb={},_0x1e6113={'count':0x0,'rows':[]};var _0x229a81=_['map'](db[_0x9121('0x31')]['rawAttributes'],function(_0x5ae52b){return{'name':_0x5ae52b[_0x9121('0x32')],'type':_0x5ae52b['type'][_0x9121('0x33')]};});_0x5755bb[_0x9121('0x34')]=_[_0x9121('0x35')](_[_0x9121('0x36')](_0x229a81,'name'),[_0x9121('0x2e')]);_0x5755bb[_0x9121('0x37')]=_[_0x9121('0x38')](_0x26d17f['query']);_0x5755bb[_0x9121('0x39')]=_['intersection'](_0x5755bb[_0x9121('0x34')],_0x5755bb[_0x9121('0x37')]);_0x2b6bd8[_0x9121('0x3a')]=_[_0x9121('0x3b')](_0x5755bb['model'],qs['fields'](_0x26d17f[_0x9121('0x37')][_0x9121('0x3c')]));_0x2b6bd8[_0x9121('0x3a')]=_0x2b6bd8['attributes'][_0x9121('0x3d')]?_0x2b6bd8[_0x9121('0x3a')]:_0x5755bb[_0x9121('0x34')];if(!_0x26d17f[_0x9121('0x37')]['hasOwnProperty'](_0x9121('0x3e'))){_0x2b6bd8['limit']=qs[_0x9121('0x24')](_0x26d17f[_0x9121('0x37')][_0x9121('0x24')]);_0x2b6bd8['offset']=qs['offset'](_0x26d17f[_0x9121('0x37')]['offset']);}_0x2b6bd8['order']=qs[_0x9121('0x3f')](_0x26d17f[_0x9121('0x37')][_0x9121('0x3f')]);_0x2b6bd8[_0x9121('0x40')]=qs[_0x9121('0x39')](_[_0x9121('0x41')](_0x26d17f[_0x9121('0x37')],_0x5755bb[_0x9121('0x39')]),_0x229a81);if(_0x26d17f[_0x9121('0x37')]['filter']){_0x2b6bd8[_0x9121('0x40')]=_[_0x9121('0x42')](_0x2b6bd8[_0x9121('0x40')],{'$or':_[_0x9121('0x36')](_0x229a81,function(_0x467c57){if(_0x467c57[_0x9121('0x43')]!==_0x9121('0x44')){var _0x44d09f={};_0x44d09f[_0x467c57[_0x9121('0x2e')]]={'$like':'%'+_0x26d17f[_0x9121('0x37')][_0x9121('0x45')]+'%'};return _0x44d09f;}})});}_0x2b6bd8=_['merge']({},_0x2b6bd8,_0x26d17f[_0x9121('0x46')]);var _0x59cd49={'where':_0x2b6bd8[_0x9121('0x40')]};return db[_0x9121('0x31')][_0x9121('0x23')](_0x59cd49)[_0x9121('0x2b')](function(_0x2993af){_0x1e6113['count']=_0x2993af;if(_0x26d17f[_0x9121('0x37')]['includeAll']){_0x2b6bd8[_0x9121('0x47')]=[{'all':!![]}];}return db[_0x9121('0x31')]['findAll'](_0x2b6bd8);})[_0x9121('0x2b')](function(_0x18f182){_0x1e6113['rows']=_0x18f182;return _0x1e6113;})['then'](respondWithFilteredResult(_0x45e745,_0x2b6bd8))[_0x9121('0x48')](handleError(_0x45e745,null));};exports[_0x9121('0x49')]=function(_0x23825c,_0x2eeacc){var _0x3cc8e6={'raw':!![],'where':{'id':_0x23825c[_0x9121('0x4a')]['id']}},_0x2f2587={};_0x2f2587[_0x9121('0x34')]=_[_0x9121('0x38')](db[_0x9121('0x31')][_0x9121('0x4b')]);_0x2f2587[_0x9121('0x37')]=_[_0x9121('0x38')](_0x23825c['query']);_0x2f2587[_0x9121('0x39')]=_['intersection'](_0x2f2587[_0x9121('0x34')],_0x2f2587[_0x9121('0x37')]);_0x3cc8e6[_0x9121('0x3a')]=_['intersection'](_0x2f2587[_0x9121('0x34')],qs['fields'](_0x23825c[_0x9121('0x37')][_0x9121('0x3c')]));_0x3cc8e6['attributes']=_0x3cc8e6[_0x9121('0x3a')]['length']?_0x3cc8e6[_0x9121('0x3a')]:_0x2f2587[_0x9121('0x34')];if(_0x23825c[_0x9121('0x37')][_0x9121('0x4c')]){_0x3cc8e6[_0x9121('0x47')]=[{'all':!![]}];}_0x3cc8e6=_[_0x9121('0x42')]({},_0x3cc8e6,_0x23825c[_0x9121('0x46')]);return db['VoiceMailMessage'][_0x9121('0x4d')](_0x3cc8e6)[_0x9121('0x2b')](handleEntityNotFound(_0x2eeacc,null))['then'](respondWithResult(_0x2eeacc,null))[_0x9121('0x48')](handleError(_0x2eeacc,null));};exports[_0x9121('0x4e')]=function(_0x566d37,_0x317915){return db['VoiceMailMessage'][_0x9121('0x4e')](_0x566d37[_0x9121('0x4f')],{})[_0x9121('0x2b')](respondWithResult(_0x317915,0xc9))[_0x9121('0x48')](handleError(_0x317915,null));};exports[_0x9121('0x2a')]=function(_0x326872,_0x1b20d0){if(_0x326872['body']['id']){delete _0x326872[_0x9121('0x4f')]['id'];}return db['VoiceMailMessage']['find']({'where':{'id':_0x326872[_0x9121('0x4a')]['id']}})[_0x9121('0x2b')](handleEntityNotFound(_0x1b20d0,null))[_0x9121('0x2b')](saveUpdates(_0x326872[_0x9121('0x4f')],null))['then'](respondWithResult(_0x1b20d0,null))[_0x9121('0x48')](handleError(_0x1b20d0,null));};exports[_0x9121('0x2c')]=function(_0x57a36c,_0xac5490){return db[_0x9121('0x31')][_0x9121('0x4d')]({'where':{'id':_0x57a36c[_0x9121('0x4a')]['id']}})['then'](handleEntityNotFound(_0xac5490,null))[_0x9121('0x2b')](removeEntity(_0xac5490,null))[_0x9121('0x48')](handleError(_0xac5490,null));};exports[_0x9121('0x50')]=function(_0x1ca96d,_0x380689,_0x447c4f){return db[_0x9121('0x31')][_0x9121('0x4d')]({'where':{'id':_0x1ca96d[_0x9121('0x4a')]['id']},'attributes':['id',_0x9121('0x51'),_0x9121('0x52')]})[_0x9121('0x2b')](handleEntityNotFound(_0x380689,null))[_0x9121('0x2b')](function(_0x33b9c7){if(_0x33b9c7){if(!_0x33b9c7[_0x9121('0x51')]){throw new db[(_0x9121('0x53'))]['ValidationError'](_0x9121('0x54'));}var _0x3ab61d={'Content-Type':_0x9121('0x55'),'Content-Disposition':'attachment'};if(_0x33b9c7[_0x9121('0x52')]){_0x3ab61d[_0x9121('0x56')]=_0x9121('0x57')+_0x33b9c7[_0x9121('0x52')]+_0x9121('0x58');}_0x380689[_0x9121('0x25')](_0x3ab61d);return _0x380689[_0x9121('0x2f')](new Buffer(_0x33b9c7['recording']));}})[_0x9121('0x48')](handleError(_0x380689,null));}; \ No newline at end of file +var _0xf8bf=['where','pick','VIRTUAL','filter','merge','options','includeAll','findAll','rows','show','params','find','create','body','catch','destroy','recording','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','fs-extra','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','end','sendStatus','error','name','send','index','map','VoiceMailMessage','rawAttributes','fieldName','type','key','model','differenceBy','keys','filters','intersection','fields','query','attributes','length','hasOwnProperty','nolimit','sort'];(function(_0x403056,_0x2fd4dd){var _0x107756=function(_0x451025){while(--_0x451025){_0x403056['push'](_0x403056['shift']());}};_0x107756(++_0x2fd4dd);}(_0xf8bf,0x15c));var _0xff8b=function(_0x11474d,_0x433035){_0x11474d=_0x11474d-0x0;var _0x413d23=_0xf8bf[_0x11474d];return _0x413d23;};'use strict';var emlformat=require(_0xff8b('0x0'));var rimraf=require(_0xff8b('0x1'));var zipdir=require(_0xff8b('0x2'));var jsonpatch=require(_0xff8b('0x3'));var rp=require(_0xff8b('0x4'));var moment=require('moment');var BPromise=require(_0xff8b('0x5'));var Mustache=require(_0xff8b('0x6'));var util=require('util');var path=require(_0xff8b('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xff8b('0x8'));var _=require('lodash');var squel=require(_0xff8b('0x9'));var crypto=require(_0xff8b('0xa'));var jsforce=require(_0xff8b('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xff8b('0xc'));var querystring=require(_0xff8b('0xd'));var Papa=require(_0xff8b('0xe'));var Redis=require('ioredis');var authService=require(_0xff8b('0xf'));var qs=require(_0xff8b('0x10'));var as=require(_0xff8b('0x11'));var hardwareService=require(_0xff8b('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xff8b('0x13'));var licenseUtil=require(_0xff8b('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1624eb,_0x1c8bc9){_0x1c8bc9=_0x1c8bc9||0xcc;return function(_0x1c9e67){if(_0x1c9e67){return _0x1624eb['sendStatus'](_0x1c8bc9);}return _0x1624eb[_0xff8b('0x15')](_0x1c8bc9)['end']();};}function respondWithResult(_0x26181e,_0x1b368f){_0x1b368f=_0x1b368f||0xc8;return function(_0x25d6ed){if(_0x25d6ed){return _0x26181e[_0xff8b('0x15')](_0x1b368f)[_0xff8b('0x16')](_0x25d6ed);}};}function respondWithFilteredResult(_0x360a74,_0xb73002){return function(_0x41094a){if(_0x41094a){var _0x3a2a08=typeof _0xb73002[_0xff8b('0x17')]===_0xff8b('0x18')&&typeof _0xb73002[_0xff8b('0x19')]===_0xff8b('0x18');var _0x3fc71b=_0x41094a[_0xff8b('0x1a')];var _0x2973da=_0x3a2a08?0x0:_0xb73002['offset'];var _0xb4ea0a=_0x3a2a08?_0x41094a[_0xff8b('0x1a')]:_0xb73002['offset']+_0xb73002[_0xff8b('0x19')];var _0x2a3934;if(_0xb4ea0a>=_0x3fc71b){_0xb4ea0a=_0x3fc71b;_0x2a3934=0xc8;}else{_0x2a3934=0xce;}_0x360a74[_0xff8b('0x15')](_0x2a3934);return _0x360a74[_0xff8b('0x1b')](_0xff8b('0x1c'),_0x2973da+'-'+_0xb4ea0a+'/'+_0x3fc71b)[_0xff8b('0x16')](_0x41094a);}return null;};}function patchUpdates(_0x55ee96){return function(_0x4fefed){try{jsonpatch[_0xff8b('0x1d')](_0x4fefed,_0x55ee96,!![]);}catch(_0x28d1e8){return BPromise['reject'](_0x28d1e8);}return _0x4fefed[_0xff8b('0x1e')]();};}function saveUpdates(_0xb7d7b7,_0x3595a2){return function(_0x36c41d){if(_0x36c41d){return _0x36c41d[_0xff8b('0x1f')](_0xb7d7b7)[_0xff8b('0x20')](function(_0x53e781){return _0x53e781;});}return null;};}function removeEntity(_0x321523,_0x2c9a72){return function(_0x3aef54){if(_0x3aef54){return _0x3aef54['destroy']()[_0xff8b('0x20')](function(){_0x321523[_0xff8b('0x15')](0xcc)[_0xff8b('0x21')]();});}};}function handleEntityNotFound(_0x430454,_0x206d02){return function(_0x33a65d){if(!_0x33a65d){_0x430454[_0xff8b('0x22')](0x194);}return _0x33a65d;};}function handleError(_0x44e74e,_0x3cf440){_0x3cf440=_0x3cf440||0x1f4;return function(_0x2b0299){logger[_0xff8b('0x23')](_0x2b0299['stack']);if(_0x2b0299[_0xff8b('0x24')]){delete _0x2b0299[_0xff8b('0x24')];}_0x44e74e[_0xff8b('0x15')](_0x3cf440)[_0xff8b('0x25')](_0x2b0299);};}exports[_0xff8b('0x26')]=function(_0x49d05e,_0x314954){var _0x14259e={},_0x27d13b={},_0x2981af={'count':0x0,'rows':[]};var _0x1ad0d8=_[_0xff8b('0x27')](db[_0xff8b('0x28')][_0xff8b('0x29')],function(_0x21f2a3){return{'name':_0x21f2a3[_0xff8b('0x2a')],'type':_0x21f2a3[_0xff8b('0x2b')][_0xff8b('0x2c')]};});_0x27d13b[_0xff8b('0x2d')]=_[_0xff8b('0x2e')](_[_0xff8b('0x27')](_0x1ad0d8,_0xff8b('0x24')),['name']);_0x27d13b['query']=_[_0xff8b('0x2f')](_0x49d05e['query']);_0x27d13b[_0xff8b('0x30')]=_['intersection'](_0x27d13b['model'],_0x27d13b['query']);_0x14259e['attributes']=_[_0xff8b('0x31')](_0x27d13b[_0xff8b('0x2d')],qs[_0xff8b('0x32')](_0x49d05e[_0xff8b('0x33')][_0xff8b('0x32')]));_0x14259e[_0xff8b('0x34')]=_0x14259e[_0xff8b('0x34')][_0xff8b('0x35')]?_0x14259e[_0xff8b('0x34')]:_0x27d13b['model'];if(!_0x49d05e[_0xff8b('0x33')][_0xff8b('0x36')](_0xff8b('0x37'))){_0x14259e[_0xff8b('0x19')]=qs[_0xff8b('0x19')](_0x49d05e[_0xff8b('0x33')]['limit']);_0x14259e[_0xff8b('0x17')]=qs[_0xff8b('0x17')](_0x49d05e[_0xff8b('0x33')][_0xff8b('0x17')]);}_0x14259e['order']=qs[_0xff8b('0x38')](_0x49d05e[_0xff8b('0x33')][_0xff8b('0x38')]);_0x14259e[_0xff8b('0x39')]=qs[_0xff8b('0x30')](_[_0xff8b('0x3a')](_0x49d05e[_0xff8b('0x33')],_0x27d13b[_0xff8b('0x30')]),_0x1ad0d8);if(_0x49d05e[_0xff8b('0x33')]['filter']){_0x14259e[_0xff8b('0x39')]=_['merge'](_0x14259e[_0xff8b('0x39')],{'$or':_[_0xff8b('0x27')](_0x1ad0d8,function(_0x3dfc60){if(_0x3dfc60['type']!==_0xff8b('0x3b')){var _0x35df76={};_0x35df76[_0x3dfc60[_0xff8b('0x24')]]={'$like':'%'+_0x49d05e[_0xff8b('0x33')][_0xff8b('0x3c')]+'%'};return _0x35df76;}})});}_0x14259e=_[_0xff8b('0x3d')]({},_0x14259e,_0x49d05e[_0xff8b('0x3e')]);var _0x2b76a7={'where':_0x14259e[_0xff8b('0x39')]};return db[_0xff8b('0x28')][_0xff8b('0x1a')](_0x2b76a7)[_0xff8b('0x20')](function(_0x26340d){_0x2981af[_0xff8b('0x1a')]=_0x26340d;if(_0x49d05e[_0xff8b('0x33')][_0xff8b('0x3f')]){_0x14259e['include']=[{'all':!![]}];}return db['VoiceMailMessage'][_0xff8b('0x40')](_0x14259e);})[_0xff8b('0x20')](function(_0x211947){_0x2981af[_0xff8b('0x41')]=_0x211947;return _0x2981af;})[_0xff8b('0x20')](respondWithFilteredResult(_0x314954,_0x14259e))['catch'](handleError(_0x314954,null));};exports[_0xff8b('0x42')]=function(_0x2a2c84,_0x1772b8){var _0x244184={'raw':!![],'where':{'id':_0x2a2c84[_0xff8b('0x43')]['id']}},_0x1166cc={};_0x1166cc[_0xff8b('0x2d')]=_[_0xff8b('0x2f')](db['VoiceMailMessage'][_0xff8b('0x29')]);_0x1166cc['query']=_[_0xff8b('0x2f')](_0x2a2c84[_0xff8b('0x33')]);_0x1166cc[_0xff8b('0x30')]=_[_0xff8b('0x31')](_0x1166cc[_0xff8b('0x2d')],_0x1166cc[_0xff8b('0x33')]);_0x244184[_0xff8b('0x34')]=_[_0xff8b('0x31')](_0x1166cc[_0xff8b('0x2d')],qs[_0xff8b('0x32')](_0x2a2c84['query']['fields']));_0x244184[_0xff8b('0x34')]=_0x244184[_0xff8b('0x34')][_0xff8b('0x35')]?_0x244184[_0xff8b('0x34')]:_0x1166cc['model'];if(_0x2a2c84[_0xff8b('0x33')]['includeAll']){_0x244184['include']=[{'all':!![]}];}_0x244184=_[_0xff8b('0x3d')]({},_0x244184,_0x2a2c84[_0xff8b('0x3e')]);return db[_0xff8b('0x28')][_0xff8b('0x44')](_0x244184)[_0xff8b('0x20')](handleEntityNotFound(_0x1772b8,null))[_0xff8b('0x20')](respondWithResult(_0x1772b8,null))['catch'](handleError(_0x1772b8,null));};exports[_0xff8b('0x45')]=function(_0x54386d,_0x34fe3d){return db[_0xff8b('0x28')][_0xff8b('0x45')](_0x54386d[_0xff8b('0x46')],{})[_0xff8b('0x20')](respondWithResult(_0x34fe3d,0xc9))[_0xff8b('0x47')](handleError(_0x34fe3d,null));};exports[_0xff8b('0x1f')]=function(_0x53c421,_0x1650b7){if(_0x53c421['body']['id']){delete _0x53c421[_0xff8b('0x46')]['id'];}return db[_0xff8b('0x28')][_0xff8b('0x44')]({'where':{'id':_0x53c421[_0xff8b('0x43')]['id']}})['then'](handleEntityNotFound(_0x1650b7,null))[_0xff8b('0x20')](saveUpdates(_0x53c421[_0xff8b('0x46')],null))[_0xff8b('0x20')](respondWithResult(_0x1650b7,null))[_0xff8b('0x47')](handleError(_0x1650b7,null));};exports[_0xff8b('0x48')]=function(_0x17f824,_0x576123){return db['VoiceMailMessage'][_0xff8b('0x44')]({'where':{'id':_0x17f824[_0xff8b('0x43')]['id']}})[_0xff8b('0x20')](handleEntityNotFound(_0x576123,null))[_0xff8b('0x20')](removeEntity(_0x576123,null))[_0xff8b('0x47')](handleError(_0x576123,null));};exports['download']=function(_0xca3b80,_0x3e31f5,_0x217750){return db['VoiceMailMessage'][_0xff8b('0x44')]({'where':{'id':_0xca3b80[_0xff8b('0x43')]['id']},'attributes':['id',_0xff8b('0x49'),_0xff8b('0x4a')]})[_0xff8b('0x20')](handleEntityNotFound(_0x3e31f5,null))[_0xff8b('0x20')](function(_0x302b22){if(_0x302b22){if(!_0x302b22[_0xff8b('0x49')]){throw new db[(_0xff8b('0x4b'))][(_0xff8b('0x4c'))](_0xff8b('0x4d'));}var _0x364ce8={'Content-Type':_0xff8b('0x4e'),'Content-Disposition':_0xff8b('0x4f')};if(_0x302b22['msg_id']){_0x364ce8[_0xff8b('0x50')]='attachment;\x20filename=\x22'+_0x302b22[_0xff8b('0x4a')]+'.wav\x22';}_0x3e31f5['set'](_0x364ce8);return _0x3e31f5['send'](new Buffer(_0x302b22[_0xff8b('0x49')]));}})[_0xff8b('0x47')](handleError(_0x3e31f5,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index b7a3a5f..5c4cbea 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 _0x7a9a=['path','../../config/environment','./voiceMailMessage.attributes','exports','voice_voicemail_messages','dir','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x202ece,_0x470a05){var _0x3c8270=function(_0x3889a3){while(--_0x3889a3){_0x202ece['push'](_0x202ece['shift']());}};_0x3c8270(++_0x470a05);}(_0x7a9a,0xae));var _0xa7a9=function(_0x55488e,_0x4764f1){_0x55488e=_0x55488e-0x0;var _0x3a6da0=_0x7a9a[_0x55488e];return _0x3a6da0;};'use strict';var _=require(_0xa7a9('0x0'));var util=require(_0xa7a9('0x1'));var logger=require(_0xa7a9('0x2'))(_0xa7a9('0x3'));var moment=require(_0xa7a9('0x4'));var BPromise=require('bluebird');var rp=require(_0xa7a9('0x5'));var fs=require('fs');var path=require(_0xa7a9('0x6'));var rimraf=require('rimraf');var config=require(_0xa7a9('0x7'));var attributes=require(_0xa7a9('0x8'));module[_0xa7a9('0x9')]=function(_0x287600,_0x245d82){return _0x287600['define']('VoiceMailMessage',attributes,{'tableName':_0xa7a9('0xa'),'paranoid':![],'indexes':[{'name':_0xa7a9('0xb'),'fields':[_0xa7a9('0xb')]}],'timestamps':![]});}; \ No newline at end of file +var _0x8eb3=['../../config/environment','./voiceMailMessage.attributes','exports','define','VoiceMailMessage','voice_voicemail_messages','dir','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x5ecadc,_0x1cf9f1){var _0x565037=function(_0x22908b){while(--_0x22908b){_0x5ecadc['push'](_0x5ecadc['shift']());}};_0x565037(++_0x1cf9f1);}(_0x8eb3,0x115));var _0x38eb=function(_0x33f9b7,_0x80c5d6){_0x33f9b7=_0x33f9b7-0x0;var _0x12ff6f=_0x8eb3[_0x33f9b7];return _0x12ff6f;};'use strict';var _=require('lodash');var util=require(_0x38eb('0x0'));var logger=require(_0x38eb('0x1'))(_0x38eb('0x2'));var moment=require(_0x38eb('0x3'));var BPromise=require(_0x38eb('0x4'));var rp=require(_0x38eb('0x5'));var fs=require('fs');var path=require(_0x38eb('0x6'));var rimraf=require(_0x38eb('0x7'));var config=require(_0x38eb('0x8'));var attributes=require(_0x38eb('0x9'));module[_0x38eb('0xa')]=function(_0x10d514,_0x138c12){return _0x10d514[_0x38eb('0xb')](_0x38eb('0xc'),attributes,{'tableName':_0x38eb('0xd'),'paranoid':![],'indexes':[{'name':_0x38eb('0xe'),'fields':[_0x38eb('0xe')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 1f63491..03ca63d 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 _0x3b07=['request','then','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','VoiceMailMessage,\x20%s,\x20%s,\x20%s','error','code','message','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x3b07,0x15c));var _0x73b0=function(_0xfc1d82,_0x1b4b13){_0xfc1d82=_0xfc1d82-0x0;var _0x527720=_0x3b07[_0xfc1d82];return _0x527720;};'use strict';var _=require(_0x73b0('0x0'));var util=require(_0x73b0('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x73b0('0x2'));var fs=require('fs');var Redis=require(_0x73b0('0x3'));var db=require(_0x73b0('0x4'))['db'];var utils=require(_0x73b0('0x5'));var logger=require(_0x73b0('0x6'))(_0x73b0('0x7'));var config=require(_0x73b0('0x8'));var jayson=require(_0x73b0('0x9'));var client=jayson[_0x73b0('0xa')][_0x73b0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x529f1c,_0x55852e,_0x5d3b27){return new BPromise(function(_0x33a1c1,_0x2f29c2){return client[_0x73b0('0xc')](_0x529f1c,_0x5d3b27)[_0x73b0('0xd')](function(_0x34cc50){logger['info'](_0x73b0('0xe'),_0x55852e,_0x73b0('0xf'));logger['debug'](_0x73b0('0x10'),_0x55852e,_0x73b0('0xf'),JSON['stringify'](_0x34cc50));if(_0x34cc50[_0x73b0('0x11')]){if(_0x34cc50[_0x73b0('0x11')][_0x73b0('0x12')]===0x1f4){logger['error'](_0x73b0('0xe'),_0x55852e,_0x34cc50[_0x73b0('0x11')]['message']);return _0x2f29c2(_0x34cc50['error']['message']);}logger[_0x73b0('0x11')](_0x73b0('0xe'),_0x55852e,_0x34cc50[_0x73b0('0x11')][_0x73b0('0x13')]);return _0x33a1c1(_0x34cc50[_0x73b0('0x11')][_0x73b0('0x13')]);}else{logger['info'](_0x73b0('0xe'),_0x55852e,'request\x20sent');_0x33a1c1(_0x34cc50['result'][_0x73b0('0x13')]);}})['catch'](function(_0x50d4f7){logger['error']('VoiceMailMessage,\x20%s,\x20%s',_0x55852e,_0x50d4f7);_0x2f29c2(_0x50d4f7);});});} \ No newline at end of file +var _0xb6f5=['request','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','moment','../../mysqldb','../../config/logger','rpc','jayson/promise','client'];(function(_0x28ad6c,_0x599a96){var _0x597de8=function(_0x445ba4){while(--_0x445ba4){_0x28ad6c['push'](_0x28ad6c['shift']());}};_0x597de8(++_0x599a96);}(_0xb6f5,0x170));var _0x5b6f=function(_0x2cd8a4,_0x51fb40){_0x2cd8a4=_0x2cd8a4-0x0;var _0x375630=_0xb6f5[_0x2cd8a4];return _0x375630;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x5b6f('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5b6f('0x1'))['db'];var utils=require('../../config/utils');var logger=require(_0x5b6f('0x2'))(_0x5b6f('0x3'));var config=require('../../config/environment');var jayson=require(_0x5b6f('0x4'));var client=jayson[_0x5b6f('0x5')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3f7cc9,_0x371863,_0x1f8505){return new BPromise(function(_0x2f79a7,_0x245b01){return client[_0x5b6f('0x6')](_0x3f7cc9,_0x1f8505)['then'](function(_0x34e2f6){logger[_0x5b6f('0x7')](_0x5b6f('0x8'),_0x371863,_0x5b6f('0x9'));logger[_0x5b6f('0xa')](_0x5b6f('0xb'),_0x371863,'request\x20sent',JSON[_0x5b6f('0xc')](_0x34e2f6));if(_0x34e2f6[_0x5b6f('0xd')]){if(_0x34e2f6[_0x5b6f('0xd')][_0x5b6f('0xe')]===0x1f4){logger[_0x5b6f('0xd')]('VoiceMailMessage,\x20%s,\x20%s',_0x371863,_0x34e2f6['error']['message']);return _0x245b01(_0x34e2f6[_0x5b6f('0xd')]['message']);}logger['error'](_0x5b6f('0x8'),_0x371863,_0x34e2f6['error'][_0x5b6f('0xf')]);return _0x2f79a7(_0x34e2f6[_0x5b6f('0xd')]['message']);}else{logger[_0x5b6f('0x7')](_0x5b6f('0x8'),_0x371863,_0x5b6f('0x9'));_0x2f79a7(_0x34e2f6['result']['message']);}})[_0x5b6f('0x10')](function(_0x383518){logger[_0x5b6f('0xd')]('VoiceMailMessage,\x20%s,\x20%s',_0x371863,_0x383518);_0x245b01(_0x383518);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index bfa197c..2121bcf 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 _0x0c2b=['../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','index','/:id','/:id/sounds','post','addSound','put','update','delete','destroy','/:id/sounds/:id2','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x557575,_0x33e4c6){var _0x4bba29=function(_0x44ed48){while(--_0x44ed48){_0x557575['push'](_0x557575['shift']());}};_0x4bba29(++_0x33e4c6);}(_0x0c2b,0x1f4));var _0xb0c2=function(_0x4a527e,_0x32d3db){_0x4a527e=_0x4a527e-0x0;var _0xe0cbc3=_0x0c2b[_0x4a527e];return _0xe0cbc3;};'use strict';var multer=require('multer');var util=require(_0xb0c2('0x0'));var path=require(_0xb0c2('0x1'));var timeout=require(_0xb0c2('0x2'));var express=require('express');var router=express[_0xb0c2('0x3')]();var fs_extra=require(_0xb0c2('0x4'));var auth=require(_0xb0c2('0x5'));var interaction=require(_0xb0c2('0x6'));var config=require(_0xb0c2('0x7'));var controller=require(_0xb0c2('0x8'));router[_0xb0c2('0x9')]('/',auth[_0xb0c2('0xa')](),controller[_0xb0c2('0xb')]);router[_0xb0c2('0x9')](_0xb0c2('0xc'),auth[_0xb0c2('0xa')](),controller['show']);router[_0xb0c2('0x9')](_0xb0c2('0xd'),auth[_0xb0c2('0xa')](),controller['getSounds']);router[_0xb0c2('0xe')]('/',auth[_0xb0c2('0xa')](),controller['create']);router[_0xb0c2('0xe')](_0xb0c2('0xd'),auth[_0xb0c2('0xa')](),controller[_0xb0c2('0xf')]);router[_0xb0c2('0x10')](_0xb0c2('0xc'),auth[_0xb0c2('0xa')](),controller[_0xb0c2('0x11')]);router[_0xb0c2('0x12')]('/:id',auth[_0xb0c2('0xa')](),controller[_0xb0c2('0x13')]);router[_0xb0c2('0x12')](_0xb0c2('0x14'),auth[_0xb0c2('0xa')](),controller['removeSound']);module[_0xb0c2('0x15')]=router; \ No newline at end of file +var _0x6ec6=['express','Router','fs-extra','../../components/interaction/service','./voiceMusicOnHold.controller','get','index','isAuthenticated','show','/:id/sounds','getSounds','create','post','addSound','put','/:id','delete','destroy','/:id/sounds/:id2','util','path','connect-timeout'];(function(_0x42aba3,_0x4ef48f){var _0x33b03c=function(_0x424739){while(--_0x424739){_0x42aba3['push'](_0x42aba3['shift']());}};_0x33b03c(++_0x4ef48f);}(_0x6ec6,0x15d));var _0x66ec=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0x6ec6[_0x21549c];return _0x426cbd;};'use strict';var multer=require('multer');var util=require(_0x66ec('0x0'));var path=require(_0x66ec('0x1'));var timeout=require(_0x66ec('0x2'));var express=require(_0x66ec('0x3'));var router=express[_0x66ec('0x4')]();var fs_extra=require(_0x66ec('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x66ec('0x6'));var config=require('../../config/environment');var controller=require(_0x66ec('0x7'));router[_0x66ec('0x8')]('/',auth['isAuthenticated'](),controller[_0x66ec('0x9')]);router['get']('/:id',auth[_0x66ec('0xa')](),controller[_0x66ec('0xb')]);router['get'](_0x66ec('0xc'),auth['isAuthenticated'](),controller[_0x66ec('0xd')]);router['post']('/',auth[_0x66ec('0xa')](),controller[_0x66ec('0xe')]);router[_0x66ec('0xf')](_0x66ec('0xc'),auth[_0x66ec('0xa')](),controller[_0x66ec('0x10')]);router[_0x66ec('0x11')](_0x66ec('0x12'),auth['isAuthenticated'](),controller['update']);router[_0x66ec('0x13')](_0x66ec('0x12'),auth['isAuthenticated'](),controller[_0x66ec('0x14')]);router[_0x66ec('0x13')](_0x66ec('0x15'),auth['isAuthenticated'](),controller['removeSound']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index a156420..9ba2118 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 _0xfd09=['ENUM','custom','mp3nb','quietmp3nb','quietmp3','alpha','TIMESTAMP','BOOLEAN','sequelize','exports','STRING'];(function(_0x4fa08c,_0x30cac4){var _0x7a920a=function(_0x213fd1){while(--_0x213fd1){_0x4fa08c['push'](_0x4fa08c['shift']());}};_0x7a920a(++_0x30cac4);}(_0xfd09,0x168));var _0x9fd0=function(_0x172948,_0x4262cc){_0x172948=_0x172948-0x0;var _0x4aeaa9=_0xfd09[_0x172948];return _0x4aeaa9;};'use strict';var Sequelize=require(_0x9fd0('0x0'));module[_0x9fd0('0x1')]={'name':{'type':Sequelize[_0x9fd0('0x2')],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize[_0x9fd0('0x3')](_0x9fd0('0x4'),'files',_0x9fd0('0x5'),_0x9fd0('0x6'),_0x9fd0('0x7'),'mp3'),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize[_0x9fd0('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0x9fd0('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0x9fd0('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0x9fd0('0x2')],'allowNull':!![],'defaultValue':_0x9fd0('0x8')},'format':{'type':Sequelize['STRING'],'allowNull':!![]},'stamp':{'type':_0x9fd0('0x9')},'defaultEntry':{'type':Sequelize[_0x9fd0('0xa')],'defaultValue':0x0}}; \ No newline at end of file +var _0x8fed=['files','mp3nb','quietmp3','mp3','alpha','TIMESTAMP','sequelize','exports','STRING','name','ENUM','custom'];(function(_0x14fc1d,_0x3621a6){var _0x138c45=function(_0x511551){while(--_0x511551){_0x14fc1d['push'](_0x14fc1d['shift']());}};_0x138c45(++_0x3621a6);}(_0x8fed,0x10e));var _0xd8fe=function(_0x267310,_0x1d619c){_0x267310=_0x267310-0x0;var _0x37d16f=_0x8fed[_0x267310];return _0x37d16f;};'use strict';var Sequelize=require(_0xd8fe('0x0'));module[_0xd8fe('0x1')]={'name':{'type':Sequelize[_0xd8fe('0x2')],'allowNull':![],'unique':_0xd8fe('0x3')},'mode':{'type':Sequelize[_0xd8fe('0x4')](_0xd8fe('0x5'),_0xd8fe('0x6'),_0xd8fe('0x7'),'quietmp3nb',_0xd8fe('0x8'),_0xd8fe('0x9')),'allowNull':!![],'defaultValue':_0xd8fe('0x6')},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize[_0xd8fe('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0xd8fe('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0xd8fe('0x2')],'allowNull':!![],'defaultValue':_0xd8fe('0xa')},'format':{'type':Sequelize[_0xd8fe('0x2')],'allowNull':!![]},'stamp':{'type':_0xd8fe('0xb')},'defaultEntry':{'type':Sequelize['BOOLEAN'],'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 560a2b4..fcafd86 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 _0x00a1=['order','sort','where','pick','filter','merge','VIRTUAL','options','VoiceMusicOnHold','includeAll','include','findAll','rows','catch','show','params','fields','find','body','sequelize','transaction','mode','files','directory','join','root','server/files/moh','mkdirSync','0777','user','role','UserProfileSection','MusicOnHolds','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','unlinkSync','rmdirSync','Sequelize','ValidationError','message','addSound','Sound','findOne','save_name','converted_format','server/files/sounds/converted','format','%s.%s','basename','symlinkSync','removeSound','id2','createdAt','hasOwnProperty','getSounds','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','error','name','send','map','rawAttributes','fieldName','type','model','keys','filters','intersection','query','attributes','length','nolimit'];(function(_0x46de08,_0x350a03){var _0x11dcff=function(_0x213b4d){while(--_0x213b4d){_0x46de08['push'](_0x46de08['shift']());}};_0x11dcff(++_0x350a03);}(_0x00a1,0x129));var _0x100a=function(_0x154a4a,_0x2524e3){_0x154a4a=_0x154a4a-0x0;var _0x2b036d=_0x00a1[_0x154a4a];return _0x2b036d;};'use strict';var emlformat=require(_0x100a('0x0'));var rimraf=require(_0x100a('0x1'));var zipdir=require(_0x100a('0x2'));var jsonpatch=require(_0x100a('0x3'));var rp=require(_0x100a('0x4'));var moment=require(_0x100a('0x5'));var BPromise=require(_0x100a('0x6'));var Mustache=require(_0x100a('0x7'));var util=require(_0x100a('0x8'));var path=require(_0x100a('0x9'));var sox=require(_0x100a('0xa'));var csv=require(_0x100a('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x100a('0xc'));var _=require(_0x100a('0xd'));var squel=require(_0x100a('0xe'));var crypto=require('crypto');var jsforce=require(_0x100a('0xf'));var deskjs=require(_0x100a('0x10'));var toCsv=require(_0x100a('0xb'));var querystring=require(_0x100a('0x11'));var Papa=require(_0x100a('0x12'));var Redis=require('ioredis');var authService=require(_0x100a('0x13'));var qs=require(_0x100a('0x14'));var as=require(_0x100a('0x15'));var hardwareService=require(_0x100a('0x16'));var logger=require(_0x100a('0x17'))(_0x100a('0x18'));var utils=require(_0x100a('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x100a('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x46308d,_0x5d792e){_0x5d792e=_0x5d792e||0xcc;return function(_0x4142b8){if(_0x4142b8){return _0x46308d[_0x100a('0x1b')](_0x5d792e);}return _0x46308d[_0x100a('0x1c')](_0x5d792e)[_0x100a('0x1d')]();};}function respondWithResult(_0x9e0931,_0x28844b){_0x28844b=_0x28844b||0xc8;return function(_0x1d31bc){if(_0x1d31bc){return _0x9e0931[_0x100a('0x1c')](_0x28844b)[_0x100a('0x1e')](_0x1d31bc);}};}function respondWithFilteredResult(_0x178f5d,_0x2e8db9){return function(_0xa8d48d){if(_0xa8d48d){var _0x3c7b31=typeof _0x2e8db9[_0x100a('0x1f')]===_0x100a('0x20')&&typeof _0x2e8db9['limit']===_0x100a('0x20');var _0x3dc5d9=_0xa8d48d[_0x100a('0x21')];var _0x49ec83=_0x3c7b31?0x0:_0x2e8db9['offset'];var _0x2e6ab1=_0x3c7b31?_0xa8d48d[_0x100a('0x21')]:_0x2e8db9[_0x100a('0x1f')]+_0x2e8db9[_0x100a('0x22')];var _0x469db9;if(_0x2e6ab1>=_0x3dc5d9){_0x2e6ab1=_0x3dc5d9;_0x469db9=0xc8;}else{_0x469db9=0xce;}_0x178f5d['status'](_0x469db9);return _0x178f5d[_0x100a('0x23')](_0x100a('0x24'),_0x49ec83+'-'+_0x2e6ab1+'/'+_0x3dc5d9)['json'](_0xa8d48d);}return null;};}function patchUpdates(_0x3f6508){return function(_0x48171e){try{jsonpatch[_0x100a('0x25')](_0x48171e,_0x3f6508,!![]);}catch(_0x3aaa44){return BPromise[_0x100a('0x26')](_0x3aaa44);}return _0x48171e[_0x100a('0x27')]();};}function saveUpdates(_0x2118a4,_0x2a0cbb){return function(_0x447564){if(_0x447564){return _0x447564[_0x100a('0x28')](_0x2118a4)[_0x100a('0x29')](function(_0x248c1e){return _0x248c1e;});}return null;};}function removeEntity(_0x559475,_0x2351c6){return function(_0x30af67){if(_0x30af67){return _0x30af67[_0x100a('0x2a')]()[_0x100a('0x29')](function(){var _0x45cefd=_0x30af67[_0x100a('0x2b')]({'plain':!![]});var _0x338ed2='MusicOnHolds';return db[_0x100a('0x2c')][_0x100a('0x2a')]({'where':{'type':_0x338ed2,'resourceId':_0x45cefd['id']}})['then'](function(){return _0x30af67;});})[_0x100a('0x29')](function(){_0x559475[_0x100a('0x1c')](0xcc)[_0x100a('0x1d')]();});}};}function handleEntityNotFound(_0x15eca5,_0x59d8f0){return function(_0x3ab9c6){if(!_0x3ab9c6){_0x15eca5[_0x100a('0x1b')](0x194);}return _0x3ab9c6;};}function handleError(_0x3472a0,_0x1d8a1c){_0x1d8a1c=_0x1d8a1c||0x1f4;return function(_0x5bc72c){logger[_0x100a('0x2d')](_0x5bc72c['stack']);if(_0x5bc72c['name']){delete _0x5bc72c[_0x100a('0x2e')];}_0x3472a0[_0x100a('0x1c')](_0x1d8a1c)[_0x100a('0x2f')](_0x5bc72c);};}exports['index']=function(_0x343b43,_0x598bbb){var _0x4b7cc5={},_0x581463={},_0x1d7fcc={'count':0x0,'rows':[]};var _0x538e40=_[_0x100a('0x30')](db['VoiceMusicOnHold'][_0x100a('0x31')],function(_0x276c1d){return{'name':_0x276c1d[_0x100a('0x32')],'type':_0x276c1d[_0x100a('0x33')]['key']};});_0x581463[_0x100a('0x34')]=_[_0x100a('0x30')](_0x538e40,'name');_0x581463['query']=_[_0x100a('0x35')](_0x343b43['query']);_0x581463[_0x100a('0x36')]=_[_0x100a('0x37')](_0x581463[_0x100a('0x34')],_0x581463[_0x100a('0x38')]);_0x4b7cc5[_0x100a('0x39')]=_[_0x100a('0x37')](_0x581463[_0x100a('0x34')],qs['fields'](_0x343b43[_0x100a('0x38')]['fields']));_0x4b7cc5[_0x100a('0x39')]=_0x4b7cc5[_0x100a('0x39')][_0x100a('0x3a')]?_0x4b7cc5[_0x100a('0x39')]:_0x581463[_0x100a('0x34')];if(!_0x343b43['query']['hasOwnProperty'](_0x100a('0x3b'))){_0x4b7cc5[_0x100a('0x22')]=qs[_0x100a('0x22')](_0x343b43[_0x100a('0x38')][_0x100a('0x22')]);_0x4b7cc5[_0x100a('0x1f')]=qs[_0x100a('0x1f')](_0x343b43[_0x100a('0x38')][_0x100a('0x1f')]);}_0x4b7cc5[_0x100a('0x3c')]=qs[_0x100a('0x3d')](_0x343b43['query'][_0x100a('0x3d')]);delete _0x343b43['query'][_0x100a('0x3d')];_0x4b7cc5[_0x100a('0x3e')]=qs[_0x100a('0x36')](_[_0x100a('0x3f')](_0x343b43[_0x100a('0x38')],_0x581463[_0x100a('0x36')]),_0x538e40);if(_0x343b43[_0x100a('0x38')][_0x100a('0x40')]){_0x4b7cc5[_0x100a('0x3e')]=_[_0x100a('0x41')](_0x4b7cc5['where'],{'$or':_[_0x100a('0x30')](_0x538e40,function(_0x34dc86){if(_0x34dc86[_0x100a('0x33')]!==_0x100a('0x42')){var _0x1d2008={};_0x1d2008[_0x34dc86['name']]={'$like':'%'+_0x343b43[_0x100a('0x38')]['filter']+'%'};return _0x1d2008;}})});}_0x4b7cc5=_[_0x100a('0x41')]({},_0x4b7cc5,_0x343b43[_0x100a('0x43')]);var _0x52de3a={'where':_0x4b7cc5[_0x100a('0x3e')]};return db[_0x100a('0x44')][_0x100a('0x21')](_0x52de3a)[_0x100a('0x29')](function(_0x158959){_0x1d7fcc[_0x100a('0x21')]=_0x158959;if(_0x343b43[_0x100a('0x38')][_0x100a('0x45')]){_0x4b7cc5[_0x100a('0x46')]=[{'all':!![]}];}return db[_0x100a('0x44')][_0x100a('0x47')](_0x4b7cc5);})['then'](function(_0x3944ab){_0x1d7fcc[_0x100a('0x48')]=_0x3944ab;return _0x1d7fcc;})[_0x100a('0x29')](respondWithFilteredResult(_0x598bbb,_0x4b7cc5))[_0x100a('0x49')](handleError(_0x598bbb,null));};exports[_0x100a('0x4a')]=function(_0x3510a6,_0x663171){var _0x2b4170={'raw':![],'where':{'id':_0x3510a6[_0x100a('0x4b')]['id']}},_0x2d4350={};_0x2d4350[_0x100a('0x34')]=_[_0x100a('0x35')](db[_0x100a('0x44')]['rawAttributes']);_0x2d4350[_0x100a('0x38')]=_['keys'](_0x3510a6[_0x100a('0x38')]);_0x2d4350[_0x100a('0x36')]=_[_0x100a('0x37')](_0x2d4350[_0x100a('0x34')],_0x2d4350[_0x100a('0x38')]);_0x2b4170[_0x100a('0x39')]=_[_0x100a('0x37')](_0x2d4350['model'],qs[_0x100a('0x4c')](_0x3510a6[_0x100a('0x38')][_0x100a('0x4c')]));_0x2b4170['attributes']=_0x2b4170[_0x100a('0x39')][_0x100a('0x3a')]?_0x2b4170['attributes']:_0x2d4350[_0x100a('0x34')];if(_0x3510a6[_0x100a('0x38')][_0x100a('0x45')]){_0x2b4170[_0x100a('0x46')]=[{'all':!![]}];}_0x2b4170=_[_0x100a('0x41')]({},_0x2b4170,_0x3510a6[_0x100a('0x43')]);return db['VoiceMusicOnHold'][_0x100a('0x4d')](_0x2b4170)[_0x100a('0x29')](handleEntityNotFound(_0x663171,null))['then'](respondWithResult(_0x663171,null))[_0x100a('0x49')](handleError(_0x663171,null));};exports[_0x100a('0x28')]=function(_0x28013a,_0x42a8a1){if(_0x28013a[_0x100a('0x4e')]['id']){delete _0x28013a[_0x100a('0x4e')]['id'];}return db[_0x100a('0x44')][_0x100a('0x4d')]({'where':{'id':_0x28013a[_0x100a('0x4b')]['id']}})[_0x100a('0x29')](handleEntityNotFound(_0x42a8a1,null))[_0x100a('0x29')](saveUpdates(_0x28013a[_0x100a('0x4e')],null))[_0x100a('0x29')](respondWithResult(_0x42a8a1,null))['catch'](handleError(_0x42a8a1,null));};exports['create']=function(_0x1c6788,_0x2fd025,_0x444d11){return db[_0x100a('0x4f')][_0x100a('0x50')](function(_0x20e530){if(_0x1c6788[_0x100a('0x4e')][_0x100a('0x51')]===_0x100a('0x52')){_0x1c6788['body'][_0x100a('0x53')]=path[_0x100a('0x54')](config[_0x100a('0x55')],_0x100a('0x56'),_0x1c6788[_0x100a('0x4e')]['name']);}return db[_0x100a('0x44')]['create'](_0x1c6788[_0x100a('0x4e')],{'transaction':_0x20e530})[_0x100a('0x29')](function(_0x445122){if(_0x1c6788[_0x100a('0x4e')][_0x100a('0x51')]===_0x100a('0x52')){fs[_0x100a('0x57')](_0x445122[_0x100a('0x53')],parseInt(_0x100a('0x58'),0x8));}var _0x4d0e56=_0x1c6788[_0x100a('0x59')][_0x100a('0x2b')]({'plain':!![]});if(!_0x4d0e56)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4d0e56[_0x100a('0x5a')]===_0x100a('0x59')){var _0xf58e8c=_0x445122[_0x100a('0x2b')]({'plain':!![]});return db[_0x100a('0x5b')][_0x100a('0x4d')]({'where':{'name':_0x100a('0x5c'),'userProfileId':_0x4d0e56[_0x100a('0x5d')]},'raw':!![]})[_0x100a('0x29')](function(_0x259d3b){if(_0x259d3b&&_0x259d3b[_0x100a('0x5e')]===0x0){return db[_0x100a('0x2c')][_0x100a('0x5f')]({'name':_0xf58e8c[_0x100a('0x2e')],'resourceId':_0xf58e8c['id'],'type':_0x259d3b[_0x100a('0x2e')],'sectionId':_0x259d3b['id']},{})[_0x100a('0x29')](function(){return _0x445122;});}else{return _0x445122;}})[_0x100a('0x49')](function(_0x17f950){logger[_0x100a('0x2d')](_0x100a('0x60'),_0x17f950);});}return _0x445122;});})[_0x100a('0x29')](respondWithResult(_0x2fd025,0xc9))[_0x100a('0x49')](handleError(_0x2fd025,null));};exports['destroy']=function(_0x16f44d,_0x42a26c,_0x536cca){var _0x1f9148;return db[_0x100a('0x44')][_0x100a('0x4d')]({'where':{'id':_0x16f44d[_0x100a('0x4b')]['id']}})[_0x100a('0x29')](function(_0x367e01){if(_0x367e01){return db[_0x100a('0x4f')][_0x100a('0x50')](function(_0x38936d){return _0x367e01[_0x100a('0x2a')]({'transaction':_0x38936d,'raw':!![]})[_0x100a('0x29')](function(_0x575879){if(_0x575879['directory']){fs[_0x100a('0x61')](_0x575879[_0x100a('0x53')])[_0x100a('0x62')](function(_0x9e8344){fs[_0x100a('0x63')](path['join'](_0x575879[_0x100a('0x53')],_0x9e8344));});fs[_0x100a('0x64')](_0x575879[_0x100a('0x53')]);}return _0x575879;});})[_0x100a('0x49')](function(_0x2f27a7){throw new db[(_0x100a('0x65'))][(_0x100a('0x66'))](_0x2f27a7[_0x100a('0x67')]);});}})[_0x100a('0x29')](handleEntityNotFound(_0x42a26c,null))[_0x100a('0x29')](removeEntity(_0x42a26c,null))[_0x100a('0x49')](handleError(_0x42a26c,null));};exports[_0x100a('0x68')]=function(_0x26c3d6,_0x73b108,_0x382f97){return db[_0x100a('0x4f')][_0x100a('0x50')](function(_0x4f6ba8){var _0x4d5da1;return db['VoiceMusicOnHold'][_0x100a('0x4d')]({'where':{'id':_0x26c3d6['params']['id']}})['then'](function(_0x2fbb79){if(_0x2fbb79){_0x4d5da1=_0x2fbb79;return _0x2fbb79[_0x100a('0x68')](_0x26c3d6[_0x100a('0x4e')]['id'],{'transaction':_0x4f6ba8});}})[_0x100a('0x29')](function(_0x124235){if(_0x124235){return db[_0x100a('0x69')][_0x100a('0x6a')]({'where':{'id':_0x26c3d6[_0x100a('0x4e')]['id']},'attributes':['id',_0x100a('0x2e'),_0x100a('0x6b'),_0x100a('0x6c'),'createdAt'],'raw':!![]});}})[_0x100a('0x29')](function(_0x3981ca){if(_0x3981ca){var _0x3b9dfd=path[_0x100a('0x54')](config[_0x100a('0x55')],_0x100a('0x6d'),util[_0x100a('0x6e')](_0x100a('0x6f'),path[_0x100a('0x70')](_0x3981ca[_0x100a('0x6b')],path['extname'](_0x3981ca[_0x100a('0x6b')])),_0x3981ca[_0x100a('0x6c')]));var _0x318fac=path[_0x100a('0x54')](config['root'],'server/files/moh',_0x4d5da1[_0x100a('0x2e')],util[_0x100a('0x6e')](_0x100a('0x6f'),_0x3981ca[_0x100a('0x2e')],_0x3981ca['converted_format']));fs[_0x100a('0x71')](_0x3b9dfd,_0x318fac);return _0x3981ca;}})[_0x100a('0x49')](function(_0x17050d){throw new db['Sequelize'][(_0x100a('0x66'))](_0x17050d['message']);});})[_0x100a('0x29')](handleEntityNotFound(_0x73b108,null))[_0x100a('0x29')](respondWithResult(_0x73b108,0xc9))[_0x100a('0x49')](handleError(_0x73b108,null));};exports[_0x100a('0x72')]=function(_0x215cf1,_0x48a948,_0x2dda50){return db[_0x100a('0x4f')][_0x100a('0x50')](function(_0xd92b8d){var _0x1d3aae;return db[_0x100a('0x44')]['findOne']({'where':{'id':_0x215cf1[_0x100a('0x4b')]['id']}})[_0x100a('0x29')](handleEntityNotFound(_0x48a948,null))[_0x100a('0x29')](function(_0x2152d4){if(_0x2152d4){_0x1d3aae=_0x2152d4;return _0x2152d4[_0x100a('0x72')](_0x215cf1[_0x100a('0x4b')][_0x100a('0x73')]);}})['then'](function(_0x12739b){if(_0x12739b){return db['Sound']['findOne']({'where':{'id':_0x215cf1['params']['id2']},'attributes':['id',_0x100a('0x2e'),'save_name',_0x100a('0x6c'),_0x100a('0x74')],'raw':!![]});}})['then'](function(_0x503805){if(_0x503805){fs[_0x100a('0x63')](path[_0x100a('0x54')](_0x1d3aae[_0x100a('0x53')],util[_0x100a('0x6e')](_0x100a('0x6f'),_0x503805[_0x100a('0x2e')],_0x503805['converted_format'])));return _0x503805;}})[_0x100a('0x49')](function(_0x346ae0){throw new db[(_0x100a('0x65'))]['ValidationError'](_0x346ae0[_0x100a('0x67')]);});})[_0x100a('0x29')](handleEntityNotFound(_0x48a948,null))[_0x100a('0x29')](respondWithStatusCode(_0x48a948,0xcc))[_0x100a('0x49')](handleError(_0x48a948,null));};exports['getSounds']=function(_0x3d78c1,_0x5ac0a2,_0x593eaf){var _0x110a8d={};var _0x4ee579={};var _0xedb4e4;var _0x391926;return db[_0x100a('0x44')]['findOne']({'where':{'id':_0x3d78c1[_0x100a('0x4b')]['id']}})[_0x100a('0x29')](handleEntityNotFound(_0x5ac0a2,null))[_0x100a('0x29')](function(_0x7052ec){if(_0x7052ec){_0xedb4e4=_0x7052ec;_0x4ee579[_0x100a('0x34')]=_[_0x100a('0x35')](db[_0x100a('0x69')][_0x100a('0x31')]);_0x4ee579['query']=_[_0x100a('0x35')](_0x3d78c1[_0x100a('0x38')]);_0x4ee579['filters']=_['intersection'](_0x4ee579[_0x100a('0x34')],_0x4ee579[_0x100a('0x38')]);_0x110a8d[_0x100a('0x39')]=_[_0x100a('0x37')](_0x4ee579['model'],qs['fields'](_0x3d78c1['query'][_0x100a('0x4c')]));_0x110a8d[_0x100a('0x39')]=_0x110a8d[_0x100a('0x39')]['length']?_0x110a8d[_0x100a('0x39')]:_0x4ee579[_0x100a('0x34')];_0x110a8d[_0x100a('0x3c')]=qs[_0x100a('0x3d')](_0x3d78c1['query'][_0x100a('0x3d')]);_0x110a8d[_0x100a('0x3e')]=qs[_0x100a('0x36')](_['pick'](_0x3d78c1[_0x100a('0x38')],_0x4ee579['filters']));if(_0x3d78c1[_0x100a('0x38')][_0x100a('0x40')]){_0x110a8d[_0x100a('0x3e')]=_[_0x100a('0x41')](_0x110a8d['where'],{'$or':_[_0x100a('0x30')](_0x110a8d[_0x100a('0x39')],function(_0x12be5c){var _0x5495a9={};_0x5495a9[_0x12be5c]={'$like':'%'+_0x3d78c1[_0x100a('0x38')][_0x100a('0x40')]+'%'};return _0x5495a9;})});}_0x110a8d=_[_0x100a('0x41')]({},_0x110a8d,_0x3d78c1[_0x100a('0x43')]);return _0xedb4e4['getSounds'](_0x110a8d);}})['then'](function(_0x5f2e16){if(_0x5f2e16){_0x391926=_0x5f2e16['length'];if(!_0x3d78c1['query'][_0x100a('0x75')](_0x100a('0x3b'))){_0x110a8d['limit']=qs[_0x100a('0x22')](_0x3d78c1[_0x100a('0x38')][_0x100a('0x22')]);_0x110a8d[_0x100a('0x1f')]=qs[_0x100a('0x1f')](_0x3d78c1['query'][_0x100a('0x1f')]);}return _0xedb4e4[_0x100a('0x76')](_0x110a8d);}})['then'](function(_0x3ba192){if(_0x3ba192){return _0x3ba192?{'count':_0x391926,'rows':_0x3ba192}:null;}})[_0x100a('0x29')](respondWithResult(_0x5ac0a2,null))['catch'](handleError(_0x5ac0a2,null));}; \ No newline at end of file +var _0x1080=['../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','VoiceMusicOnHold','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','update','body','params','create','sequelize','transaction','files','join','root','mode','mkdirSync','0777','role','user','find','MusicOnHolds','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','directory','readdirSync','forEach','rmdirSync','Sequelize','ValidationError','message','addSound','Sound','findOne','save_name','converted_format','createdAt','server/files/sounds/converted','%s.%s','format','removeSound','id2','unlinkSync','length','hasOwnProperty','getSounds','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x18a6eb,_0x46bff7){var _0x263ec7=function(_0x25a6c9){while(--_0x25a6c9){_0x18a6eb['push'](_0x18a6eb['shift']());}};_0x263ec7(++_0x46bff7);}(_0x1080,0xd4));var _0x0108=function(_0x53c45a,_0x48f57f){_0x53c45a=_0x53c45a-0x0;var _0xd564dd=_0x1080[_0x53c45a];return _0xd564dd;};'use strict';var emlformat=require(_0x0108('0x0'));var rimraf=require(_0x0108('0x1'));var zipdir=require(_0x0108('0x2'));var jsonpatch=require(_0x0108('0x3'));var rp=require(_0x0108('0x4'));var moment=require(_0x0108('0x5'));var BPromise=require(_0x0108('0x6'));var Mustache=require(_0x0108('0x7'));var util=require('util');var path=require(_0x0108('0x8'));var sox=require(_0x0108('0x9'));var csv=require(_0x0108('0xa'));var ejs=require(_0x0108('0xb'));var fs=require('fs');var fs_extra=require(_0x0108('0xc'));var _=require(_0x0108('0xd'));var squel=require(_0x0108('0xe'));var crypto=require(_0x0108('0xf'));var jsforce=require(_0x0108('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x0108('0xa'));var querystring=require(_0x0108('0x11'));var Papa=require(_0x0108('0x12'));var Redis=require(_0x0108('0x13'));var authService=require(_0x0108('0x14'));var qs=require(_0x0108('0x15'));var as=require(_0x0108('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x0108('0x17'));var utils=require(_0x0108('0x18'));var config=require(_0x0108('0x19'));var licenseUtil=require(_0x0108('0x1a'));var db=require(_0x0108('0x1b'))['db'];function respondWithStatusCode(_0x29aaa1,_0x3a1b02){_0x3a1b02=_0x3a1b02||0xcc;return function(_0x419bb8){if(_0x419bb8){return _0x29aaa1[_0x0108('0x1c')](_0x3a1b02);}return _0x29aaa1[_0x0108('0x1d')](_0x3a1b02)[_0x0108('0x1e')]();};}function respondWithResult(_0x23d36e,_0x289ced){_0x289ced=_0x289ced||0xc8;return function(_0x375aa5){if(_0x375aa5){return _0x23d36e['status'](_0x289ced)['json'](_0x375aa5);}};}function respondWithFilteredResult(_0xd052f8,_0xee39e9){return function(_0x3ce9eb){if(_0x3ce9eb){var _0x27acde=typeof _0xee39e9[_0x0108('0x1f')]===_0x0108('0x20')&&typeof _0xee39e9[_0x0108('0x21')]===_0x0108('0x20');var _0x795ce6=_0x3ce9eb[_0x0108('0x22')];var _0x4b9a96=_0x27acde?0x0:_0xee39e9[_0x0108('0x1f')];var _0xbd11b3=_0x27acde?_0x3ce9eb[_0x0108('0x22')]:_0xee39e9[_0x0108('0x1f')]+_0xee39e9[_0x0108('0x21')];var _0x22997d;if(_0xbd11b3>=_0x795ce6){_0xbd11b3=_0x795ce6;_0x22997d=0xc8;}else{_0x22997d=0xce;}_0xd052f8[_0x0108('0x1d')](_0x22997d);return _0xd052f8[_0x0108('0x23')]('Content-Range',_0x4b9a96+'-'+_0xbd11b3+'/'+_0x795ce6)[_0x0108('0x24')](_0x3ce9eb);}return null;};}function patchUpdates(_0x2dc6b4){return function(_0x4a9e61){try{jsonpatch[_0x0108('0x25')](_0x4a9e61,_0x2dc6b4,!![]);}catch(_0xd83438){return BPromise[_0x0108('0x26')](_0xd83438);}return _0x4a9e61['save']();};}function saveUpdates(_0x341a61,_0x2d16d7){return function(_0x54cf5b){if(_0x54cf5b){return _0x54cf5b['update'](_0x341a61)[_0x0108('0x27')](function(_0x3c8a37){return _0x3c8a37;});}return null;};}function removeEntity(_0x2dcaad,_0x580f27){return function(_0x3bcd76){if(_0x3bcd76){return _0x3bcd76[_0x0108('0x28')]()['then'](function(){var _0x250a62=_0x3bcd76[_0x0108('0x29')]({'plain':!![]});var _0x1cbe10='MusicOnHolds';return db[_0x0108('0x2a')][_0x0108('0x28')]({'where':{'type':_0x1cbe10,'resourceId':_0x250a62['id']}})[_0x0108('0x27')](function(){return _0x3bcd76;});})[_0x0108('0x27')](function(){_0x2dcaad[_0x0108('0x1d')](0xcc)[_0x0108('0x1e')]();});}};}function handleEntityNotFound(_0x1ff4c6,_0x11ad2c){return function(_0x5dc5ca){if(!_0x5dc5ca){_0x1ff4c6['sendStatus'](0x194);}return _0x5dc5ca;};}function handleError(_0x131ecb,_0x1a06ae){_0x1a06ae=_0x1a06ae||0x1f4;return function(_0x5240c8){logger[_0x0108('0x2b')](_0x5240c8[_0x0108('0x2c')]);if(_0x5240c8[_0x0108('0x2d')]){delete _0x5240c8[_0x0108('0x2d')];}_0x131ecb[_0x0108('0x1d')](_0x1a06ae)[_0x0108('0x2e')](_0x5240c8);};}exports[_0x0108('0x2f')]=function(_0x4c1f43,_0x8daa80){var _0x17871c={},_0x58a115={},_0x106d8a={'count':0x0,'rows':[]};var _0x50c765=_[_0x0108('0x30')](db[_0x0108('0x31')][_0x0108('0x32')],function(_0x201bea){return{'name':_0x201bea[_0x0108('0x33')],'type':_0x201bea[_0x0108('0x34')][_0x0108('0x35')]};});_0x58a115[_0x0108('0x36')]=_[_0x0108('0x30')](_0x50c765,_0x0108('0x2d'));_0x58a115[_0x0108('0x37')]=_[_0x0108('0x38')](_0x4c1f43[_0x0108('0x37')]);_0x58a115[_0x0108('0x39')]=_[_0x0108('0x3a')](_0x58a115[_0x0108('0x36')],_0x58a115[_0x0108('0x37')]);_0x17871c[_0x0108('0x3b')]=_['intersection'](_0x58a115[_0x0108('0x36')],qs[_0x0108('0x3c')](_0x4c1f43[_0x0108('0x37')][_0x0108('0x3c')]));_0x17871c[_0x0108('0x3b')]=_0x17871c[_0x0108('0x3b')]['length']?_0x17871c[_0x0108('0x3b')]:_0x58a115[_0x0108('0x36')];if(!_0x4c1f43[_0x0108('0x37')]['hasOwnProperty'](_0x0108('0x3d'))){_0x17871c[_0x0108('0x21')]=qs['limit'](_0x4c1f43[_0x0108('0x37')]['limit']);_0x17871c[_0x0108('0x1f')]=qs[_0x0108('0x1f')](_0x4c1f43[_0x0108('0x37')][_0x0108('0x1f')]);}_0x17871c[_0x0108('0x3e')]=qs[_0x0108('0x3f')](_0x4c1f43[_0x0108('0x37')][_0x0108('0x3f')]);delete _0x4c1f43[_0x0108('0x37')][_0x0108('0x3f')];_0x17871c[_0x0108('0x40')]=qs['filters'](_[_0x0108('0x41')](_0x4c1f43[_0x0108('0x37')],_0x58a115[_0x0108('0x39')]),_0x50c765);if(_0x4c1f43[_0x0108('0x37')][_0x0108('0x42')]){_0x17871c[_0x0108('0x40')]=_[_0x0108('0x43')](_0x17871c[_0x0108('0x40')],{'$or':_[_0x0108('0x30')](_0x50c765,function(_0x4c5d62){if(_0x4c5d62['type']!==_0x0108('0x44')){var _0x5d1aef={};_0x5d1aef[_0x4c5d62['name']]={'$like':'%'+_0x4c1f43[_0x0108('0x37')][_0x0108('0x42')]+'%'};return _0x5d1aef;}})});}_0x17871c=_[_0x0108('0x43')]({},_0x17871c,_0x4c1f43[_0x0108('0x45')]);var _0x4d9b9b={'where':_0x17871c[_0x0108('0x40')]};return db['VoiceMusicOnHold'][_0x0108('0x22')](_0x4d9b9b)[_0x0108('0x27')](function(_0x2d15fb){_0x106d8a['count']=_0x2d15fb;if(_0x4c1f43['query'][_0x0108('0x46')]){_0x17871c[_0x0108('0x47')]=[{'all':!![]}];}return db[_0x0108('0x31')][_0x0108('0x48')](_0x17871c);})[_0x0108('0x27')](function(_0x1c89f1){_0x106d8a[_0x0108('0x49')]=_0x1c89f1;return _0x106d8a;})[_0x0108('0x27')](respondWithFilteredResult(_0x8daa80,_0x17871c))[_0x0108('0x4a')](handleError(_0x8daa80,null));};exports[_0x0108('0x4b')]=function(_0x2e7292,_0x4dfa47){var _0x3ef2b4={'raw':![],'where':{'id':_0x2e7292['params']['id']}},_0x1ec58b={};_0x1ec58b[_0x0108('0x36')]=_[_0x0108('0x38')](db['VoiceMusicOnHold']['rawAttributes']);_0x1ec58b[_0x0108('0x37')]=_[_0x0108('0x38')](_0x2e7292[_0x0108('0x37')]);_0x1ec58b[_0x0108('0x39')]=_['intersection'](_0x1ec58b[_0x0108('0x36')],_0x1ec58b[_0x0108('0x37')]);_0x3ef2b4[_0x0108('0x3b')]=_['intersection'](_0x1ec58b[_0x0108('0x36')],qs[_0x0108('0x3c')](_0x2e7292['query'][_0x0108('0x3c')]));_0x3ef2b4['attributes']=_0x3ef2b4[_0x0108('0x3b')]['length']?_0x3ef2b4[_0x0108('0x3b')]:_0x1ec58b['model'];if(_0x2e7292['query'][_0x0108('0x46')]){_0x3ef2b4[_0x0108('0x47')]=[{'all':!![]}];}_0x3ef2b4=_[_0x0108('0x43')]({},_0x3ef2b4,_0x2e7292[_0x0108('0x45')]);return db[_0x0108('0x31')]['find'](_0x3ef2b4)[_0x0108('0x27')](handleEntityNotFound(_0x4dfa47,null))[_0x0108('0x27')](respondWithResult(_0x4dfa47,null))[_0x0108('0x4a')](handleError(_0x4dfa47,null));};exports[_0x0108('0x4c')]=function(_0x523426,_0x4143ff){if(_0x523426[_0x0108('0x4d')]['id']){delete _0x523426[_0x0108('0x4d')]['id'];}return db[_0x0108('0x31')]['find']({'where':{'id':_0x523426[_0x0108('0x4e')]['id']}})['then'](handleEntityNotFound(_0x4143ff,null))[_0x0108('0x27')](saveUpdates(_0x523426['body'],null))[_0x0108('0x27')](respondWithResult(_0x4143ff,null))[_0x0108('0x4a')](handleError(_0x4143ff,null));};exports[_0x0108('0x4f')]=function(_0x30d495,_0x55faa6,_0xf679b0){return db[_0x0108('0x50')][_0x0108('0x51')](function(_0x2d5161){if(_0x30d495[_0x0108('0x4d')]['mode']===_0x0108('0x52')){_0x30d495[_0x0108('0x4d')]['directory']=path[_0x0108('0x53')](config[_0x0108('0x54')],'server/files/moh',_0x30d495[_0x0108('0x4d')]['name']);}return db[_0x0108('0x31')][_0x0108('0x4f')](_0x30d495[_0x0108('0x4d')],{'transaction':_0x2d5161})['then'](function(_0x1d72d1){if(_0x30d495[_0x0108('0x4d')][_0x0108('0x55')]===_0x0108('0x52')){fs[_0x0108('0x56')](_0x1d72d1['directory'],parseInt(_0x0108('0x57'),0x8));}var _0x19ebb1=_0x30d495['user'][_0x0108('0x29')]({'plain':!![]});if(!_0x19ebb1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x19ebb1[_0x0108('0x58')]===_0x0108('0x59')){var _0x59ccb0=_0x1d72d1[_0x0108('0x29')]({'plain':!![]});return db['UserProfileSection'][_0x0108('0x5a')]({'where':{'name':_0x0108('0x5b'),'userProfileId':_0x19ebb1[_0x0108('0x5c')]},'raw':!![]})[_0x0108('0x27')](function(_0x44ed6b){if(_0x44ed6b&&_0x44ed6b[_0x0108('0x5d')]===0x0){return db['UserProfileResource'][_0x0108('0x4f')]({'name':_0x59ccb0[_0x0108('0x2d')],'resourceId':_0x59ccb0['id'],'type':_0x44ed6b['name'],'sectionId':_0x44ed6b['id']},{})[_0x0108('0x27')](function(){return _0x1d72d1;});}else{return _0x1d72d1;}})[_0x0108('0x4a')](function(_0x111eac){logger['error'](_0x0108('0x5e'),_0x111eac);});}return _0x1d72d1;});})['then'](respondWithResult(_0x55faa6,0xc9))['catch'](handleError(_0x55faa6,null));};exports['destroy']=function(_0x654003,_0x5dded7,_0x181b9d){var _0x5a628d;return db[_0x0108('0x31')][_0x0108('0x5a')]({'where':{'id':_0x654003['params']['id']}})['then'](function(_0x5b5dd7){if(_0x5b5dd7){return db[_0x0108('0x50')][_0x0108('0x51')](function(_0x14a4bd){return _0x5b5dd7['destroy']({'transaction':_0x14a4bd,'raw':!![]})[_0x0108('0x27')](function(_0xc5e1f1){if(_0xc5e1f1[_0x0108('0x5f')]){fs[_0x0108('0x60')](_0xc5e1f1['directory'])[_0x0108('0x61')](function(_0x25cc61){fs['unlinkSync'](path[_0x0108('0x53')](_0xc5e1f1[_0x0108('0x5f')],_0x25cc61));});fs[_0x0108('0x62')](_0xc5e1f1['directory']);}return _0xc5e1f1;});})['catch'](function(_0x27bec9){throw new db[(_0x0108('0x63'))][(_0x0108('0x64'))](_0x27bec9[_0x0108('0x65')]);});}})[_0x0108('0x27')](handleEntityNotFound(_0x5dded7,null))[_0x0108('0x27')](removeEntity(_0x5dded7,null))['catch'](handleError(_0x5dded7,null));};exports[_0x0108('0x66')]=function(_0x3dd526,_0x36703b,_0x475a47){return db['sequelize']['transaction'](function(_0x5a64cc){var _0x3c7b04;return db[_0x0108('0x31')][_0x0108('0x5a')]({'where':{'id':_0x3dd526['params']['id']}})['then'](function(_0x1ba363){if(_0x1ba363){_0x3c7b04=_0x1ba363;return _0x1ba363[_0x0108('0x66')](_0x3dd526[_0x0108('0x4d')]['id'],{'transaction':_0x5a64cc});}})[_0x0108('0x27')](function(_0x59d7d8){if(_0x59d7d8){return db[_0x0108('0x67')][_0x0108('0x68')]({'where':{'id':_0x3dd526[_0x0108('0x4d')]['id']},'attributes':['id','name',_0x0108('0x69'),_0x0108('0x6a'),_0x0108('0x6b')],'raw':!![]});}})[_0x0108('0x27')](function(_0x1140d7){if(_0x1140d7){var _0x303cdc=path[_0x0108('0x53')](config['root'],_0x0108('0x6c'),util['format'](_0x0108('0x6d'),path['basename'](_0x1140d7[_0x0108('0x69')],path['extname'](_0x1140d7['save_name'])),_0x1140d7['converted_format']));var _0x325c58=path[_0x0108('0x53')](config[_0x0108('0x54')],'server/files/moh',_0x3c7b04[_0x0108('0x2d')],util[_0x0108('0x6e')](_0x0108('0x6d'),_0x1140d7[_0x0108('0x2d')],_0x1140d7[_0x0108('0x6a')]));fs['symlinkSync'](_0x303cdc,_0x325c58);return _0x1140d7;}})['catch'](function(_0xa84e1f){throw new db['Sequelize'][(_0x0108('0x64'))](_0xa84e1f[_0x0108('0x65')]);});})['then'](handleEntityNotFound(_0x36703b,null))['then'](respondWithResult(_0x36703b,0xc9))[_0x0108('0x4a')](handleError(_0x36703b,null));};exports[_0x0108('0x6f')]=function(_0x302307,_0x4d99b5,_0x27106e){return db[_0x0108('0x50')][_0x0108('0x51')](function(_0x3bc1f6){var _0x39afc4;return db[_0x0108('0x31')][_0x0108('0x68')]({'where':{'id':_0x302307['params']['id']}})[_0x0108('0x27')](handleEntityNotFound(_0x4d99b5,null))['then'](function(_0x975172){if(_0x975172){_0x39afc4=_0x975172;return _0x975172['removeSound'](_0x302307['params'][_0x0108('0x70')]);}})[_0x0108('0x27')](function(_0x26f231){if(_0x26f231){return db[_0x0108('0x67')][_0x0108('0x68')]({'where':{'id':_0x302307[_0x0108('0x4e')][_0x0108('0x70')]},'attributes':['id',_0x0108('0x2d'),_0x0108('0x69'),'converted_format',_0x0108('0x6b')],'raw':!![]});}})[_0x0108('0x27')](function(_0x306905){if(_0x306905){fs[_0x0108('0x71')](path[_0x0108('0x53')](_0x39afc4[_0x0108('0x5f')],util[_0x0108('0x6e')](_0x0108('0x6d'),_0x306905[_0x0108('0x2d')],_0x306905[_0x0108('0x6a')])));return _0x306905;}})[_0x0108('0x4a')](function(_0x2b5db6){throw new db[(_0x0108('0x63'))][(_0x0108('0x64'))](_0x2b5db6[_0x0108('0x65')]);});})[_0x0108('0x27')](handleEntityNotFound(_0x4d99b5,null))['then'](respondWithStatusCode(_0x4d99b5,0xcc))['catch'](handleError(_0x4d99b5,null));};exports['getSounds']=function(_0x11b118,_0x24ea0e,_0x4fd784){var _0x5cd889={};var _0x365da2={};var _0x235ddc;var _0x318a36;return db['VoiceMusicOnHold'][_0x0108('0x68')]({'where':{'id':_0x11b118[_0x0108('0x4e')]['id']}})[_0x0108('0x27')](handleEntityNotFound(_0x24ea0e,null))[_0x0108('0x27')](function(_0x3b8d46){if(_0x3b8d46){_0x235ddc=_0x3b8d46;_0x365da2[_0x0108('0x36')]=_[_0x0108('0x38')](db[_0x0108('0x67')][_0x0108('0x32')]);_0x365da2[_0x0108('0x37')]=_['keys'](_0x11b118[_0x0108('0x37')]);_0x365da2['filters']=_[_0x0108('0x3a')](_0x365da2[_0x0108('0x36')],_0x365da2[_0x0108('0x37')]);_0x5cd889['attributes']=_[_0x0108('0x3a')](_0x365da2[_0x0108('0x36')],qs[_0x0108('0x3c')](_0x11b118[_0x0108('0x37')][_0x0108('0x3c')]));_0x5cd889['attributes']=_0x5cd889[_0x0108('0x3b')][_0x0108('0x72')]?_0x5cd889[_0x0108('0x3b')]:_0x365da2[_0x0108('0x36')];_0x5cd889[_0x0108('0x3e')]=qs[_0x0108('0x3f')](_0x11b118[_0x0108('0x37')][_0x0108('0x3f')]);_0x5cd889[_0x0108('0x40')]=qs[_0x0108('0x39')](_[_0x0108('0x41')](_0x11b118['query'],_0x365da2['filters']));if(_0x11b118['query']['filter']){_0x5cd889[_0x0108('0x40')]=_[_0x0108('0x43')](_0x5cd889[_0x0108('0x40')],{'$or':_['map'](_0x5cd889[_0x0108('0x3b')],function(_0xa5a5cb){var _0x18deef={};_0x18deef[_0xa5a5cb]={'$like':'%'+_0x11b118[_0x0108('0x37')][_0x0108('0x42')]+'%'};return _0x18deef;})});}_0x5cd889=_[_0x0108('0x43')]({},_0x5cd889,_0x11b118[_0x0108('0x45')]);return _0x235ddc['getSounds'](_0x5cd889);}})[_0x0108('0x27')](function(_0x872a93){if(_0x872a93){_0x318a36=_0x872a93[_0x0108('0x72')];if(!_0x11b118[_0x0108('0x37')][_0x0108('0x73')](_0x0108('0x3d'))){_0x5cd889[_0x0108('0x21')]=qs['limit'](_0x11b118[_0x0108('0x37')][_0x0108('0x21')]);_0x5cd889[_0x0108('0x1f')]=qs[_0x0108('0x1f')](_0x11b118[_0x0108('0x37')][_0x0108('0x1f')]);}return _0x235ddc[_0x0108('0x74')](_0x5cd889);}})['then'](function(_0x65a904){if(_0x65a904){return _0x65a904?{'count':_0x318a36,'rows':_0x65a904}:null;}})[_0x0108('0x27')](respondWithResult(_0x24ea0e,null))[_0x0108('0x4a')](handleError(_0x24ea0e,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 29a7ee3..891cb55 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 _0x458c=['path','rimraf','exports','define','VoiceMusicOnHold','voice_musiconhold','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x46743c,_0x848ab0){var _0x4ac8b5=function(_0x3fdba3){while(--_0x3fdba3){_0x46743c['push'](_0x46743c['shift']());}};_0x4ac8b5(++_0x848ab0);}(_0x458c,0xba));var _0xc458=function(_0x3f55de,_0x3ae98f){_0x3f55de=_0x3f55de-0x0;var _0x2698de=_0x458c[_0x3f55de];return _0x2698de;};'use strict';var _=require('lodash');var util=require(_0xc458('0x0'));var logger=require(_0xc458('0x1'))(_0xc458('0x2'));var moment=require(_0xc458('0x3'));var BPromise=require(_0xc458('0x4'));var rp=require(_0xc458('0x5'));var fs=require('fs');var path=require(_0xc458('0x6'));var rimraf=require(_0xc458('0x7'));var config=require('../../config/environment');var attributes=require('./voiceMusicOnHold.attributes');module[_0xc458('0x8')]=function(_0x553ed0,_0xddb600){return _0x553ed0[_0xc458('0x9')](_0xc458('0xa'),attributes,{'tableName':_0xc458('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1174=['exports','define','voice_musiconhold','../../config/logger','moment','request-promise','path','../../config/environment','./voiceMusicOnHold.attributes'];(function(_0x5562a2,_0x36a4cd){var _0x5e7036=function(_0x121fbd){while(--_0x121fbd){_0x5562a2['push'](_0x5562a2['shift']());}};_0x5e7036(++_0x36a4cd);}(_0x1174,0x135));var _0x4117=function(_0x259166,_0x138e75){_0x259166=_0x259166-0x0;var _0x4246ff=_0x1174[_0x259166];return _0x4246ff;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4117('0x0'))('api');var moment=require(_0x4117('0x1'));var BPromise=require('bluebird');var rp=require(_0x4117('0x2'));var fs=require('fs');var path=require(_0x4117('0x3'));var rimraf=require('rimraf');var config=require(_0x4117('0x4'));var attributes=require(_0x4117('0x5'));module[_0x4117('0x6')]=function(_0x3d0292,_0x5defa7){return _0x3d0292[_0x4117('0x7')]('VoiceMusicOnHold',attributes,{'tableName':_0x4117('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js index 778bf65..2ea3c0e 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 _0xe706=['http','request','then','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x4477f9,_0x474dfd){var _0x27933e=function(_0x50d291){while(--_0x50d291){_0x4477f9['push'](_0x4477f9['shift']());}};_0x27933e(++_0x474dfd);}(_0xe706,0xa3));var _0x6e70=function(_0x4848cd,_0x3d9895){_0x4848cd=_0x4848cd-0x0;var _0x261a1d=_0xe706[_0x4848cd];return _0x261a1d;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e70('0x3'));var fs=require('fs');var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var utils=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));var config=require(_0x6e70('0x9'));var jayson=require(_0x6e70('0xa'));var client=jayson[_0x6e70('0xb')][_0x6e70('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){return client[_0x6e70('0xd')](_0x36357b,_0x45a2d4)[_0x6e70('0xe')](function(_0x25e61c){logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,_0x6e70('0x11'));logger[_0x6e70('0x12')](_0x6e70('0x13'),_0x293ce7,_0x6e70('0x11'),JSON['stringify'](_0x25e61c));if(_0x25e61c['error']){if(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x15')]===0x1f4){logger[_0x6e70('0x14')](_0x6e70('0x10'),_0x293ce7,_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);return _0x3c4843(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);}logger['error']('VoiceMusicOnHold,\x20%s,\x20%s',_0x293ce7,_0x25e61c['error'][_0x6e70('0x16')]);return _0x188ed3(_0x25e61c['error']['message']);}else{logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,'request\x20sent');_0x188ed3(_0x25e61c[_0x6e70('0x17')]['message']);}})[_0x6e70('0x18')](function(_0x161f23){logger['error']('VoiceMusicOnHold,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});} \ No newline at end of file +var _0x34e8=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x1ef3a2,_0x224f92){var _0x315e74=function(_0x22d086){while(--_0x22d086){_0x1ef3a2['push'](_0x1ef3a2['shift']());}};_0x315e74(++_0x224f92);}(_0x34e8,0x12c));var _0x834e=function(_0x2999b2,_0x2f48d5){_0x2999b2=_0x2999b2-0x0;var _0x416dd7=_0x34e8[_0x2999b2];return _0x416dd7;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var moment=require(_0x834e('0x2'));var BPromise=require(_0x834e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x834e('0x4'));var db=require(_0x834e('0x5'))['db'];var utils=require(_0x834e('0x6'));var logger=require(_0x834e('0x7'))(_0x834e('0x8'));var config=require(_0x834e('0x9'));var jayson=require(_0x834e('0xa'));var client=jayson['client'][_0x834e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52056d,_0x3e16d2,_0x3cc2e3){return new BPromise(function(_0x3a3ef6,_0x2e69e2){return client[_0x834e('0xc')](_0x52056d,_0x3cc2e3)[_0x834e('0xd')](function(_0x363786){logger[_0x834e('0xe')](_0x834e('0xf'),_0x3e16d2,_0x834e('0x10'));logger[_0x834e('0x11')](_0x834e('0x12'),_0x3e16d2,_0x834e('0x10'),JSON[_0x834e('0x13')](_0x363786));if(_0x363786[_0x834e('0x14')]){if(_0x363786[_0x834e('0x14')][_0x834e('0x15')]===0x1f4){logger['error'](_0x834e('0xf'),_0x3e16d2,_0x363786[_0x834e('0x14')]['message']);return _0x2e69e2(_0x363786[_0x834e('0x14')][_0x834e('0x16')]);}logger[_0x834e('0x14')](_0x834e('0xf'),_0x3e16d2,_0x363786['error'][_0x834e('0x16')]);return _0x3a3ef6(_0x363786[_0x834e('0x14')]['message']);}else{logger[_0x834e('0xe')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x3e16d2,_0x834e('0x10'));_0x3a3ef6(_0x363786[_0x834e('0x17')]['message']);}})[_0x834e('0x18')](function(_0x22106e){logger[_0x834e('0x14')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x3e16d2,_0x22106e);_0x2e69e2(_0x22106e);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 88abfaa..98f783f 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 _0x20ad=['/:id/users','getAgents','/:id/teams','getTeams','create','post','addAgents','addTeams','put','update','delete','removeAgents','removeTeams','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','index','/describe','/:id','show'];(function(_0x2e04ef,_0x31a596){var _0x5722b0=function(_0x386fbd){while(--_0x386fbd){_0x2e04ef['push'](_0x2e04ef['shift']());}};_0x5722b0(++_0x31a596);}(_0x20ad,0x13a));var _0xd20a=function(_0x53cf8e,_0x3d290f){_0x53cf8e=_0x53cf8e-0x0;var _0x459197=_0x20ad[_0x53cf8e];return _0x459197;};'use strict';var multer=require(_0xd20a('0x0'));var util=require(_0xd20a('0x1'));var path=require(_0xd20a('0x2'));var timeout=require(_0xd20a('0x3'));var express=require('express');var router=express[_0xd20a('0x4')]();var fs_extra=require(_0xd20a('0x5'));var auth=require(_0xd20a('0x6'));var interaction=require(_0xd20a('0x7'));var config=require(_0xd20a('0x8'));var controller=require(_0xd20a('0x9'));router[_0xd20a('0xa')]('/',auth[_0xd20a('0xb')](),controller[_0xd20a('0xc')]);router['get'](_0xd20a('0xd'),auth[_0xd20a('0xb')](),controller['describe']);router[_0xd20a('0xa')](_0xd20a('0xe'),auth[_0xd20a('0xb')](),controller[_0xd20a('0xf')]);router[_0xd20a('0xa')](_0xd20a('0x10'),auth[_0xd20a('0xb')](),controller[_0xd20a('0x11')]);router['get'](_0xd20a('0x12'),auth['isAuthenticated'](),controller[_0xd20a('0x13')]);router['post']('/',auth[_0xd20a('0xb')](),controller[_0xd20a('0x14')]);router[_0xd20a('0x15')](_0xd20a('0x10'),auth[_0xd20a('0xb')](),controller[_0xd20a('0x16')]);router[_0xd20a('0x15')](_0xd20a('0x12'),auth['isAuthenticated'](),controller[_0xd20a('0x17')]);router[_0xd20a('0x18')](_0xd20a('0xe'),auth['isAuthenticated'](),controller[_0xd20a('0x19')]);router[_0xd20a('0x1a')](_0xd20a('0xe'),auth[_0xd20a('0xb')](),controller['destroy']);router[_0xd20a('0x1a')]('/:id/users',auth['isAuthenticated'](),controller[_0xd20a('0x1b')]);router[_0xd20a('0x1a')]('/:id/teams',auth['isAuthenticated'](),controller[_0xd20a('0x1c')]);module[_0xd20a('0x1d')]=router; \ No newline at end of file +var _0x495e=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','index','show','/:id/users','/:id/teams','post','addTeams','put','update','delete','/:id','removeAgents','removeTeams','exports','multer','connect-timeout'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x495e,0xfb));var _0xe495=function(_0x473ee7,_0x4dd754){_0x473ee7=_0x473ee7-0x0;var _0x30f0d4=_0x495e[_0x473ee7];return _0x30f0d4;};'use strict';var multer=require(_0xe495('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xe495('0x1'));var express=require(_0xe495('0x2'));var router=express[_0xe495('0x3')]();var fs_extra=require(_0xe495('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xe495('0x5'));var config=require(_0xe495('0x6'));var controller=require(_0xe495('0x7'));router[_0xe495('0x8')]('/',auth[_0xe495('0x9')](),controller[_0xe495('0xa')]);router[_0xe495('0x8')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0xe495('0x8')]('/:id',auth[_0xe495('0x9')](),controller[_0xe495('0xb')]);router[_0xe495('0x8')](_0xe495('0xc'),auth[_0xe495('0x9')](),controller['getAgents']);router[_0xe495('0x8')](_0xe495('0xd'),auth[_0xe495('0x9')](),controller['getTeams']);router[_0xe495('0xe')]('/',auth[_0xe495('0x9')](),controller['create']);router['post'](_0xe495('0xc'),auth[_0xe495('0x9')](),controller['addAgents']);router[_0xe495('0xe')](_0xe495('0xd'),auth[_0xe495('0x9')](),controller[_0xe495('0xf')]);router[_0xe495('0x10')]('/:id',auth[_0xe495('0x9')](),controller[_0xe495('0x11')]);router[_0xe495('0x12')](_0xe495('0x13'),auth[_0xe495('0x9')](),controller['destroy']);router['delete']('/:id/users',auth[_0xe495('0x9')](),controller[_0xe495('0x14')]);router[_0xe495('0x12')]('/:id/teams',auth[_0xe495('0x9')](),controller[_0xe495('0x15')]);module[_0xe495('0x16')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index f54d9a0..cc627b1 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 _0x9af6=['STRING','name','getDataValue','INTEGER','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9af6,0x142));var _0x69af=function(_0x2621ac,_0x4d8774){_0x2621ac=_0x2621ac-0x0;var _0x57bc8c=_0x9af6[_0x2621ac];return _0x57bc8c;};'use strict';var Sequelize=require(_0x69af('0x0'));module[_0x69af('0x1')]={'name':{'type':Sequelize[_0x69af('0x2')],'allowNull':![],'unique':_0x69af('0x3')},'prefix':{'type':Sequelize['VIRTUAL'],'get':function(_0x5caf24){return'system-'+this[_0x69af('0x4')](_0x69af('0x3'))+'-';}},'description':{'type':Sequelize[_0x69af('0x2')]},'callerIdAll':{'type':Sequelize[_0x69af('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0x69af('0x5')]}}; \ No newline at end of file +var _0x155e=['STRING','VIRTUAL','system-','getDataValue','name','INTEGER','sequelize'];(function(_0xa53e85,_0x41e734){var _0x573073=function(_0x3f0f83){while(--_0x3f0f83){_0xa53e85['push'](_0xa53e85['shift']());}};_0x573073(++_0x41e734);}(_0x155e,0x125));var _0xe155=function(_0x5e8c78,_0x55aace){_0x5e8c78=_0x5e8c78-0x0;var _0x118481=_0x155e[_0x5e8c78];return _0x118481;};'use strict';var Sequelize=require(_0xe155('0x0'));module['exports']={'name':{'type':Sequelize[_0xe155('0x1')],'allowNull':![],'unique':'name'},'prefix':{'type':Sequelize[_0xe155('0x2')],'get':function(_0x360239){return _0xe155('0x3')+this[_0xe155('0x4')](_0xe155('0x5'))+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize[_0xe155('0x1')]},'VoiceExtensionId':{'type':Sequelize[_0xe155('0x6')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 9d204c7..79b26c0 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 _0x1775=['bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','get','VoicePrefixes','UserProfileResource','then','error','stack','name','index','map','VoicePrefix','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','order','sort','where','pick','merge','VIRTUAL','filter','options','findAll','rows','catch','params','keys','includeAll','include','describe','create','sequelize','body','VoiceExtension','find','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','from-sip','exten','app','system','description','appdata','prefix','NoOp','VoicePrefixId','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','No\x20callerid\x20available','goto','context','${EXTEN:','charAt','transaction','findById','addAgents','ids','omit','emit','userVoicePrefix:save','removeAgents','userVoicePrefix:remove','User','getAgents','hasOwnProperty','nolimit','getTeams','Team','addTeams','Agents','online','voicePause','interface','upsert','UserVoicePrefix','findOrCreate','forEach','removeTeams','select','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','SELECT','every','TeamId','all','union','compact','value','isEmpty','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x26f099,_0x2d96a2){var _0x942b90=function(_0x1c2e99){while(--_0x1c2e99){_0x26f099['push'](_0x26f099['shift']());}};_0x942b90(++_0x2d96a2);}(_0x1775,0x1db));var _0x5177=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x1775[_0x19e35c];return _0x3e1fe8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5177('0x0'));var zipdir=require(_0x5177('0x1'));var jsonpatch=require(_0x5177('0x2'));var rp=require(_0x5177('0x3'));var moment=require(_0x5177('0x4'));var BPromise=require(_0x5177('0x5'));var Mustache=require(_0x5177('0x6'));var util=require(_0x5177('0x7'));var path=require(_0x5177('0x8'));var sox=require(_0x5177('0x9'));var csv=require(_0x5177('0xa'));var ejs=require(_0x5177('0xb'));var fs=require('fs');var fs_extra=require(_0x5177('0xc'));var _=require(_0x5177('0xd'));var squel=require(_0x5177('0xe'));var crypto=require(_0x5177('0xf'));var jsforce=require(_0x5177('0x10'));var deskjs=require(_0x5177('0x11'));var toCsv=require(_0x5177('0xa'));var querystring=require(_0x5177('0x12'));var Papa=require(_0x5177('0x13'));var Redis=require(_0x5177('0x14'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x5177('0x15'));var hardwareService=require(_0x5177('0x16'));var logger=require(_0x5177('0x17'))(_0x5177('0x18'));var utils=require(_0x5177('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x5177('0x1a'));var db=require(_0x5177('0x1b'))['db'];config[_0x5177('0x1c')]=_[_0x5177('0x1d')](config[_0x5177('0x1c')],{'host':_0x5177('0x1e'),'port':0x18eb});var socket=require(_0x5177('0x1f'))(new Redis(config[_0x5177('0x1c')]));require(_0x5177('0x20'))[_0x5177('0x21')](socket);function respondWithStatusCode(_0x41bef4,_0x2bf5bb){_0x2bf5bb=_0x2bf5bb||0xcc;return function(_0x29cd2c){if(_0x29cd2c){return _0x41bef4[_0x5177('0x22')](_0x2bf5bb);}return _0x41bef4[_0x5177('0x23')](_0x2bf5bb)[_0x5177('0x24')]();};}function respondWithResult(_0x2ab5e5,_0x7dba6f){_0x7dba6f=_0x7dba6f||0xc8;return function(_0xe6dcf6){if(_0xe6dcf6){return _0x2ab5e5['status'](_0x7dba6f)[_0x5177('0x25')](_0xe6dcf6);}};}function respondWithFilteredResult(_0x41e687,_0x3f5ab5){return function(_0x1b4102){if(_0x1b4102){var _0x5f5bd4=typeof _0x3f5ab5[_0x5177('0x26')]===_0x5177('0x27')&&typeof _0x3f5ab5[_0x5177('0x28')]==='undefined';var _0x86f5f8=_0x1b4102['count'];var _0xc2b2b5=_0x5f5bd4?0x0:_0x3f5ab5[_0x5177('0x26')];var _0x219744=_0x5f5bd4?_0x1b4102[_0x5177('0x29')]:_0x3f5ab5[_0x5177('0x26')]+_0x3f5ab5[_0x5177('0x28')];var _0x174c4f;if(_0x219744>=_0x86f5f8){_0x219744=_0x86f5f8;_0x174c4f=0xc8;}else{_0x174c4f=0xce;}_0x41e687[_0x5177('0x23')](_0x174c4f);return _0x41e687[_0x5177('0x2a')](_0x5177('0x2b'),_0xc2b2b5+'-'+_0x219744+'/'+_0x86f5f8)[_0x5177('0x25')](_0x1b4102);}return null;};}function patchUpdates(_0x3b0c37){return function(_0x5d9a9c){try{jsonpatch[_0x5177('0x2c')](_0x5d9a9c,_0x3b0c37,!![]);}catch(_0x556f96){return BPromise[_0x5177('0x2d')](_0x556f96);}return _0x5d9a9c[_0x5177('0x2e')]();};}function saveUpdates(_0x3b39b5,_0x2d51d0){return function(_0x4bc8e2){if(_0x4bc8e2){return _0x4bc8e2[_0x5177('0x2f')](_0x3b39b5)['then'](function(_0x564139){return _0x564139;});}return null;};}function removeEntity(_0x19a0c2,_0x15cb93){return function(_0x577bf7){if(_0x577bf7){return _0x577bf7[_0x5177('0x30')]()['then'](function(){var _0x231d35=_0x577bf7[_0x5177('0x31')]({'plain':!![]});var _0x58846c=_0x5177('0x32');return db[_0x5177('0x33')][_0x5177('0x30')]({'where':{'type':_0x58846c,'resourceId':_0x231d35['id']}})[_0x5177('0x34')](function(){return _0x577bf7;});})[_0x5177('0x34')](function(){_0x19a0c2[_0x5177('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0x498fcd,_0x45cf20){return function(_0x1c660e){if(!_0x1c660e){_0x498fcd[_0x5177('0x22')](0x194);}return _0x1c660e;};}function handleError(_0x174f7a,_0x2e1985){_0x2e1985=_0x2e1985||0x1f4;return function(_0x8134f9){logger[_0x5177('0x35')](_0x8134f9[_0x5177('0x36')]);if(_0x8134f9['name']){delete _0x8134f9[_0x5177('0x37')];}_0x174f7a[_0x5177('0x23')](_0x2e1985)['send'](_0x8134f9);};}exports[_0x5177('0x38')]=function(_0x5e4c48,_0x172b36){var _0x1a2c46={},_0x1ba51c={},_0x5e2e5a={'count':0x0,'rows':[]};var _0x4f70df=_[_0x5177('0x39')](db[_0x5177('0x3a')][_0x5177('0x3b')],function(_0x3735e9){return{'name':_0x3735e9[_0x5177('0x3c')],'type':_0x3735e9[_0x5177('0x3d')][_0x5177('0x3e')]};});_0x1ba51c[_0x5177('0x3f')]=_['map'](_0x4f70df,_0x5177('0x37'));_0x1ba51c[_0x5177('0x40')]=_['keys'](_0x5e4c48[_0x5177('0x40')]);_0x1ba51c[_0x5177('0x41')]=_[_0x5177('0x42')](_0x1ba51c[_0x5177('0x3f')],_0x1ba51c[_0x5177('0x40')]);_0x1a2c46[_0x5177('0x43')]=_['intersection'](_0x1ba51c[_0x5177('0x3f')],qs[_0x5177('0x44')](_0x5e4c48[_0x5177('0x40')][_0x5177('0x44')]));_0x1a2c46[_0x5177('0x43')]=_0x1a2c46[_0x5177('0x43')][_0x5177('0x45')]?_0x1a2c46['attributes']:_0x1ba51c[_0x5177('0x3f')];if(!_0x5e4c48[_0x5177('0x40')]['hasOwnProperty']('nolimit')){_0x1a2c46[_0x5177('0x28')]=qs[_0x5177('0x28')](_0x5e4c48[_0x5177('0x40')][_0x5177('0x28')]);_0x1a2c46[_0x5177('0x26')]=qs[_0x5177('0x26')](_0x5e4c48[_0x5177('0x40')][_0x5177('0x26')]);}_0x1a2c46[_0x5177('0x46')]=qs[_0x5177('0x47')](_0x5e4c48[_0x5177('0x40')][_0x5177('0x47')]);_0x1a2c46[_0x5177('0x48')]=qs['filters'](_[_0x5177('0x49')](_0x5e4c48[_0x5177('0x40')],_0x1ba51c['filters']),_0x4f70df);if(_0x5e4c48[_0x5177('0x40')]['filter']){_0x1a2c46[_0x5177('0x48')]=_[_0x5177('0x4a')](_0x1a2c46[_0x5177('0x48')],{'$or':_['map'](_0x4f70df,function(_0x56eba4){if(_0x56eba4[_0x5177('0x3d')]!==_0x5177('0x4b')){var _0x1a149b={};_0x1a149b[_0x56eba4[_0x5177('0x37')]]={'$like':'%'+_0x5e4c48[_0x5177('0x40')][_0x5177('0x4c')]+'%'};return _0x1a149b;}})});}_0x1a2c46=_[_0x5177('0x4a')]({},_0x1a2c46,_0x5e4c48[_0x5177('0x4d')]);var _0x4e287e={'where':_0x1a2c46[_0x5177('0x48')]};return db['VoicePrefix']['count'](_0x4e287e)[_0x5177('0x34')](function(_0x17dc98){_0x5e2e5a['count']=_0x17dc98;if(_0x5e4c48[_0x5177('0x40')]['includeAll']){_0x1a2c46['include']=[{'all':!![]}];}return db[_0x5177('0x3a')][_0x5177('0x4e')](_0x1a2c46);})[_0x5177('0x34')](function(_0x3776b8){_0x5e2e5a[_0x5177('0x4f')]=_0x3776b8;return _0x5e2e5a;})[_0x5177('0x34')](respondWithFilteredResult(_0x172b36,_0x1a2c46))[_0x5177('0x50')](handleError(_0x172b36,null));};exports['show']=function(_0x5396cc,_0x12b70){var _0x511dc0={'raw':![],'where':{'id':_0x5396cc[_0x5177('0x51')]['id']}},_0x23be2a={};_0x23be2a[_0x5177('0x3f')]=_[_0x5177('0x52')](db['VoicePrefix'][_0x5177('0x3b')]);_0x23be2a[_0x5177('0x40')]=_[_0x5177('0x52')](_0x5396cc[_0x5177('0x40')]);_0x23be2a[_0x5177('0x41')]=_[_0x5177('0x42')](_0x23be2a[_0x5177('0x3f')],_0x23be2a[_0x5177('0x40')]);_0x511dc0[_0x5177('0x43')]=_[_0x5177('0x42')](_0x23be2a[_0x5177('0x3f')],qs['fields'](_0x5396cc[_0x5177('0x40')]['fields']));_0x511dc0['attributes']=_0x511dc0['attributes'][_0x5177('0x45')]?_0x511dc0[_0x5177('0x43')]:_0x23be2a['model'];if(_0x5396cc[_0x5177('0x40')][_0x5177('0x53')]){_0x511dc0[_0x5177('0x54')]=[{'all':!![]}];}_0x511dc0=_['merge']({},_0x511dc0,_0x5396cc[_0x5177('0x4d')]);return db['VoicePrefix']['find'](_0x511dc0)['then'](handleEntityNotFound(_0x12b70,null))[_0x5177('0x34')](respondWithResult(_0x12b70,null))[_0x5177('0x50')](handleError(_0x12b70,null));};exports[_0x5177('0x30')]=function(_0x5a1f8b,_0x4e53e4){return db[_0x5177('0x3a')]['find']({'where':{'id':_0x5a1f8b[_0x5177('0x51')]['id']}})[_0x5177('0x34')](handleEntityNotFound(_0x4e53e4,null))[_0x5177('0x34')](removeEntity(_0x4e53e4,null))[_0x5177('0x50')](handleError(_0x4e53e4,null));};exports[_0x5177('0x55')]=function(_0xa0edd7,_0x26bac0){return db[_0x5177('0x3a')][_0x5177('0x55')]()[_0x5177('0x34')](respondWithResult(_0x26bac0,null))[_0x5177('0x50')](handleError(_0x26bac0,null));};exports[_0x5177('0x56')]=function(_0x422d6c,_0x4c2068){var _0x59376b;return db[_0x5177('0x57')]['transaction'](function(_0x649c6f){return db['VoicePrefix'][_0x5177('0x56')](_0x422d6c[_0x5177('0x58')],{'transaction':_0x649c6f})[_0x5177('0x34')](function(_0x55a0b6){_0x59376b=_0x55a0b6['get']({'plain':!![]});return db[_0x5177('0x59')][_0x5177('0x5a')]({'where':{'id':_0x59376b[_0x5177('0x5b')]},'raw':!![]})[_0x5177('0x34')](function(_0x4a4758){return createVoicePrefixExtensions(_0x59376b,_0x4a4758,_0x649c6f);});});})['then'](function(){var _0x3f0e89=_0x422d6c[_0x5177('0x5c')][_0x5177('0x31')]({'plain':!![]});if(!_0x3f0e89)throw new Error(_0x5177('0x5d'));if(_0x3f0e89['role']===_0x5177('0x5c')){var _0x143aff=_0x59376b;return db[_0x5177('0x5e')]['find']({'where':{'name':_0x5177('0x32'),'userProfileId':_0x3f0e89[_0x5177('0x5f')]},'raw':!![]})[_0x5177('0x34')](function(_0x49e3e3){if(_0x49e3e3&&_0x49e3e3[_0x5177('0x60')]===0x0){return db['UserProfileResource'][_0x5177('0x56')]({'name':_0x143aff[_0x5177('0x37')],'resourceId':_0x143aff['id'],'type':_0x49e3e3[_0x5177('0x37')],'sectionId':_0x49e3e3['id']},{})['then'](function(){return _0x59376b;});}else{return _0x59376b;}})[_0x5177('0x50')](function(_0x161e03){logger[_0x5177('0x35')](_0x5177('0x61'),_0x161e03);throw _0x161e03;});}return _0x59376b;})[_0x5177('0x34')](respondWithResult(_0x4c2068,null))[_0x5177('0x50')](handleError(_0x4c2068,null));};function Extension(_0x37380c,_0x267599,_0x5ceed2,_0x5d96ce){this['context']=_0x5177('0x62');this[_0x5177('0x63')]=_0x37380c;this[_0x5177('0x64')]=_0x5ceed2;this[_0x5177('0x3d')]=_0x5177('0x65');this[_0x5177('0x66')]='Voice\x20Prefix\x20Extension';this['priority']=_0x267599;this[_0x5177('0x67')]=_0x5d96ce;}function createVoicePrefixExtensions(_0x23eb6e,_0x1f294e,_0x336017){return new BPromise(function(_0x123d40,_0x1b1778){var _0x2d1745=new Extension(formatPrefixName(_0x23eb6e[_0x5177('0x68')]),0x1,_0x5177('0x69'),'Voice\x20Prefix');_0x2d1745[_0x5177('0x6a')]=_0x23eb6e['id'];return db[_0x5177('0x59')]['create'](_0x2d1745,{'transaction':_0x336017})[_0x5177('0x34')](function(_0x4481b6){var _0x4edebc=_0x4481b6[_0x5177('0x31')]({'plain':!![]});var _0x2f3344=_[_0x5177('0x39')](addVoicePrefixExtensions(_0x23eb6e,_0x1f294e),function(_0x4be4b2){_0x4be4b2[_0x5177('0x5b')]=_0x4edebc['id'];_0x4be4b2[_0x5177('0x6a')]=_0x23eb6e['id'];return _0x4be4b2;});return db['VoiceExtension']['bulkCreate'](_0x2f3344,{'transaction':_0x336017})[_0x5177('0x34')](function(_0x4f76d7){if(!_0x4f76d7){return _0x1b1778(_0x5177('0x6b'));}else{return _0x123d40(_0x4f76d7);}})['catch'](function(_0x2771fa){return _0x1b1778(_0x2771fa);});});;});};function addVoicePrefixExtensions(_0x16f17c,_0x5a8ada){var _0x2af938=[];var _0x3b090d=formatPrefixName(_0x16f17c[_0x5177('0x68')]);_0x2af938[_0x5177('0x6c')](new Extension(_0x3b090d,0x2,_0x5177('0x6d'),_0x5177('0x6e')+_0x16f17c[_0x5177('0x37')]));if(_0x16f17c['callerIdAll']){_0x2af938[_0x5177('0x6c')](new Extension(_0x3b090d,0x3,'Set','PREFIX-CALLERIDALL='+_0x16f17c[_0x5177('0x6f')]));}else{_0x2af938[_0x5177('0x6c')](new Extension(_0x3b090d,0x3,'NoOp',_0x5177('0x70')));}_0x2af938[_0x5177('0x6c')](new Extension(_0x3b090d,0x4,_0x5177('0x71'),_0x5a8ada[_0x5177('0x72')]+','+_0x5177('0x73')+(0x8+_0x16f17c[_0x5177('0x37')][_0x5177('0x45')])+'}'+','+0x1));return _0x2af938;}function formatPrefixName(_0x3b26f4){var _0x478d5e='_';for(var _0x54b28f=0x0;_0x54b28f<_0x3b26f4[_0x5177('0x45')];_0x54b28f++){if(_0x3b26f4[_0x5177('0x74')](_0x54b28f)=='-'){_0x478d5e+=_0x3b26f4[_0x5177('0x74')](_0x54b28f);}else{_0x478d5e+='['+_0x3b26f4[_0x5177('0x74')](_0x54b28f)+']';}}_0x478d5e+='.';return _0x478d5e;}exports[_0x5177('0x2f')]=function(_0x3dd58f,_0x4fc289,_0x3692b2){var _0x397b75=_0x3dd58f[_0x5177('0x58')];_0x397b75[_0x5177('0x68')]='system-'+_0x397b75[_0x5177('0x37')]+'-';return db[_0x5177('0x57')][_0x5177('0x75')](function(_0x22da9d){return db[_0x5177('0x3a')]['update'](_0x397b75,{'where':{'id':_0x397b75['id']},'transaction':_0x22da9d})[_0x5177('0x34')](function(){return db['VoiceExtension'][_0x5177('0x30')]({'where':{'VoicePrefixId':_0x397b75['id']},'transaction':_0x22da9d})[_0x5177('0x34')](function(){return db['VoiceExtension'][_0x5177('0x5a')]({'where':{'id':_0x397b75[_0x5177('0x5b')]},'raw':!![]})[_0x5177('0x34')](function(_0x44ed82){return createVoicePrefixExtensions(_0x397b75,_0x44ed82,_0x22da9d);});});});})['then'](function(){return db[_0x5177('0x3a')][_0x5177('0x76')](_0x397b75['id']);})[_0x5177('0x34')](respondWithResult(_0x4fc289,null))[_0x5177('0x50')](handleError(_0x4fc289,null));};exports['addAgents']=function(_0x16b85b,_0x17456b,_0x3502dd){return db['VoicePrefix']['find']({'where':{'id':_0x16b85b[_0x5177('0x51')]['id']}})[_0x5177('0x34')](handleEntityNotFound(_0x17456b,null))[_0x5177('0x34')](function(_0x170e25){if(_0x170e25){return _0x170e25[_0x5177('0x77')](_0x16b85b[_0x5177('0x58')][_0x5177('0x78')],_[_0x5177('0x79')](_0x16b85b[_0x5177('0x58')],['ids','id'])||{})['spread'](function(_0x597a84){for(var _0x290315=0x0;_0x290315<_0x16b85b['body'][_0x5177('0x78')][_0x5177('0x45')];_0x290315+=0x1){socket[_0x5177('0x7a')](_0x5177('0x7b'),{'UserId':Number(_0x16b85b[_0x5177('0x58')]['ids'][_0x290315]),'VoicePrefixId':Number(_0x16b85b[_0x5177('0x51')]['id'])});}return _0x597a84;});}})[_0x5177('0x34')](respondWithResult(_0x17456b,null))[_0x5177('0x50')](handleError(_0x17456b,null));};exports['removeAgents']=function(_0x3d845e,_0x484762,_0x3d95df){return db[_0x5177('0x3a')]['find']({'where':{'id':_0x3d845e[_0x5177('0x51')]['id']}})[_0x5177('0x34')](handleEntityNotFound(_0x484762,null))['then'](function(_0x5f0141){if(_0x5f0141){return _0x5f0141[_0x5177('0x7c')](_0x3d845e['query'][_0x5177('0x78')])[_0x5177('0x34')](function(){if(_['isArray'](_0x3d845e[_0x5177('0x40')][_0x5177('0x78')])){for(var _0xcbbb73=0x0;_0xcbbb73<_0x3d845e[_0x5177('0x40')][_0x5177('0x78')][_0x5177('0x45')];_0xcbbb73+=0x1){socket[_0x5177('0x7a')](_0x5177('0x7d'),{'UserId':Number(_0x3d845e['query'][_0x5177('0x78')][_0xcbbb73]),'VoicePrefixId':Number(_0x3d845e['params']['id'])});}}else{socket[_0x5177('0x7a')](_0x5177('0x7d'),{'UserId':Number(_0x3d845e[_0x5177('0x40')][_0x5177('0x78')]),'VoicePrefixId':Number(_0x3d845e['params']['id'])});}});}})[_0x5177('0x34')](respondWithStatusCode(_0x484762,null))[_0x5177('0x50')](handleError(_0x484762,null));};exports['getAgents']=function(_0x17efe1,_0x30c2dc,_0x523012){var _0x33e1a6={};var _0x5f57bc={};var _0x3f1aad;var _0x558e04;return db['VoicePrefix']['findOne']({'where':{'id':_0x17efe1[_0x5177('0x51')]['id']}})[_0x5177('0x34')](handleEntityNotFound(_0x30c2dc,null))[_0x5177('0x34')](function(_0x516d0b){if(_0x516d0b){_0x3f1aad=_0x516d0b;_0x5f57bc[_0x5177('0x3f')]=_[_0x5177('0x52')](db[_0x5177('0x7e')][_0x5177('0x3b')]);_0x5f57bc[_0x5177('0x40')]=_['keys'](_0x17efe1[_0x5177('0x40')]);_0x5f57bc[_0x5177('0x41')]=_['intersection'](_0x5f57bc[_0x5177('0x3f')],_0x5f57bc['query']);_0x33e1a6[_0x5177('0x43')]=_['intersection'](_0x5f57bc[_0x5177('0x3f')],qs[_0x5177('0x44')](_0x17efe1[_0x5177('0x40')][_0x5177('0x44')]));_0x33e1a6[_0x5177('0x43')]=_0x33e1a6[_0x5177('0x43')]['length']?_0x33e1a6['attributes']:_0x5f57bc[_0x5177('0x3f')];_0x33e1a6[_0x5177('0x46')]=qs[_0x5177('0x47')](_0x17efe1['query'][_0x5177('0x47')]);_0x33e1a6[_0x5177('0x48')]=qs['filters'](_[_0x5177('0x49')](_0x17efe1['query'],_0x5f57bc[_0x5177('0x41')]));if(_0x17efe1[_0x5177('0x40')][_0x5177('0x4c')]){_0x33e1a6['where']=_[_0x5177('0x4a')](_0x33e1a6['where'],{'$or':_[_0x5177('0x39')](_0x33e1a6[_0x5177('0x43')],function(_0x5a40f1){var _0x5a8146={};_0x5a8146[_0x5a40f1]={'$like':'%'+_0x17efe1['query'][_0x5177('0x4c')]+'%'};return _0x5a8146;})});}_0x33e1a6=_['merge']({},_0x33e1a6,_0x17efe1[_0x5177('0x4d')]);return _0x3f1aad[_0x5177('0x7f')](_0x33e1a6);}})[_0x5177('0x34')](function(_0x57adf4){if(_0x57adf4){_0x558e04=_0x57adf4['length'];if(!_0x17efe1['query'][_0x5177('0x80')](_0x5177('0x81'))){_0x33e1a6[_0x5177('0x28')]=qs['limit'](_0x17efe1[_0x5177('0x40')][_0x5177('0x28')]);_0x33e1a6['offset']=qs[_0x5177('0x26')](_0x17efe1['query'][_0x5177('0x26')]);}return _0x3f1aad['getAgents'](_0x33e1a6);}})['then'](function(_0x5910a8){if(_0x5910a8){return _0x5910a8?{'count':_0x558e04,'rows':_0x5910a8}:null;}})[_0x5177('0x34')](respondWithResult(_0x30c2dc,null))['catch'](handleError(_0x30c2dc,null));};exports[_0x5177('0x82')]=function(_0x450c61,_0x1d351b,_0x1372ad){var _0x3b4cab={};var _0x197377={};var _0x580d34;var _0x1e76cf;return db[_0x5177('0x3a')]['findOne']({'where':{'id':_0x450c61[_0x5177('0x51')]['id']}})[_0x5177('0x34')](handleEntityNotFound(_0x1d351b,null))[_0x5177('0x34')](function(_0x51f7ce){if(_0x51f7ce){_0x580d34=_0x51f7ce;_0x197377['model']=_['keys'](db[_0x5177('0x83')][_0x5177('0x3b')]);_0x197377[_0x5177('0x40')]=_[_0x5177('0x52')](_0x450c61[_0x5177('0x40')]);_0x197377[_0x5177('0x41')]=_[_0x5177('0x42')](_0x197377[_0x5177('0x3f')],_0x197377[_0x5177('0x40')]);_0x3b4cab[_0x5177('0x43')]=_[_0x5177('0x42')](_0x197377[_0x5177('0x3f')],qs['fields'](_0x450c61[_0x5177('0x40')]['fields']));_0x3b4cab[_0x5177('0x43')]=_0x3b4cab[_0x5177('0x43')][_0x5177('0x45')]?_0x3b4cab['attributes']:_0x197377[_0x5177('0x3f')];_0x3b4cab[_0x5177('0x46')]=qs[_0x5177('0x47')](_0x450c61[_0x5177('0x40')][_0x5177('0x47')]);_0x3b4cab[_0x5177('0x48')]=qs[_0x5177('0x41')](_[_0x5177('0x49')](_0x450c61['query'],_0x197377['filters']));if(_0x450c61[_0x5177('0x40')]['filter']){_0x3b4cab[_0x5177('0x48')]=_[_0x5177('0x4a')](_0x3b4cab['where'],{'$or':_[_0x5177('0x39')](_0x3b4cab[_0x5177('0x43')],function(_0x54efd0){var _0x3e8a29={};_0x3e8a29[_0x54efd0]={'$like':'%'+_0x450c61[_0x5177('0x40')][_0x5177('0x4c')]+'%'};return _0x3e8a29;})});}_0x3b4cab=_[_0x5177('0x4a')]({},_0x3b4cab,_0x450c61[_0x5177('0x4d')]);return _0x580d34[_0x5177('0x82')](_0x3b4cab);}})[_0x5177('0x34')](function(_0x7a67fb){if(_0x7a67fb){_0x1e76cf=_0x7a67fb[_0x5177('0x45')];if(!_0x450c61[_0x5177('0x40')][_0x5177('0x80')](_0x5177('0x81'))){_0x3b4cab[_0x5177('0x28')]=qs['limit'](_0x450c61[_0x5177('0x40')][_0x5177('0x28')]);_0x3b4cab[_0x5177('0x26')]=qs['offset'](_0x450c61[_0x5177('0x40')][_0x5177('0x26')]);}return _0x580d34['getTeams'](_0x3b4cab);}})[_0x5177('0x34')](function(_0x5cbc48){if(_0x5cbc48){return _0x5cbc48?{'count':_0x1e76cf,'rows':_0x5cbc48}:null;}})['then'](respondWithResult(_0x1d351b,null))[_0x5177('0x50')](handleError(_0x1d351b,null));};exports[_0x5177('0x84')]=function(_0xd8f8f3,_0x40ded0,_0x356874){var _0x219a7c=_0xd8f8f3['body'][_0x5177('0x78')];var _0xcb831c;return db['Team'][_0x5177('0x4e')]({'where':{'id':_0x219a7c},'attributes':['id'],'include':[{'model':db[_0x5177('0x7e')],'as':_0x5177('0x85'),'attributes':['id',_0x5177('0x37'),_0x5177('0x86'),_0x5177('0x87'),_0x5177('0x88')],'raw':!![]}]})[_0x5177('0x34')](function(_0x4e60b2){if(_0x4e60b2){_0xcb831c=_0x4e60b2;var _0x193dbf=_['flatMap'](_0x4e60b2,function(_0xecd419){var _0x4970b3=_0xecd419[_0x5177('0x31')]({'plain':!![]});return _0x4970b3[_0x5177('0x85')];});return db[_0x5177('0x3a')][_0x5177('0x5a')]({'where':{'id':_0xd8f8f3['params']['id']}})[_0x5177('0x34')](function(_0x1b7c52){return db[_0x5177('0x57')][_0x5177('0x75')](function(_0x4e8c0c){return _0x1b7c52['addTeams'](_0x219a7c,{'transaction':_0x4e8c0c})['then'](function(){return BPromise['each'](_0xcb831c,function(_0xaafc9f){return db['TeamVoicePrefix'][_0x5177('0x89')]({'TeamId':_0xaafc9f['id'],'VoicePrefixId':_0xd8f8f3['params']['id']},{'transaction':_0x4e8c0c});});})[_0x5177('0x34')](function(){return BPromise['each'](_0x193dbf,function(_0x384af7){return db[_0x5177('0x8a')][_0x5177('0x8b')]({'where':{'UserId':_0x384af7['id'],'VoicePrefixId':_0xd8f8f3[_0x5177('0x51')]['id']},'transaction':_0x4e8c0c});});})[_0x5177('0x34')](function(){_0x193dbf[_0x5177('0x8c')](function(_0x3a9c65){socket[_0x5177('0x7a')](_0x5177('0x7b'),{'UserId':_0x3a9c65['id'],'VoicePrefixId':_0x1b7c52['id']});});});});});}})[_0x5177('0x34')](respondWithStatusCode(_0x40ded0,null))['catch'](handleError(_0x40ded0,null));};exports[_0x5177('0x8d')]=function(_0x13fa90,_0x3475c3,_0x5ed46a){return db[_0x5177('0x83')][_0x5177('0x4e')]({'where':{'id':_0x13fa90[_0x5177('0x40')][_0x5177('0x78')]},'attributes':['id'],'include':[{'model':db[_0x5177('0x7e')],'as':_0x5177('0x85'),'attributes':['id'],'raw':!![]}]})[_0x5177('0x34')](handleEntityNotFound(_0x3475c3,null))[_0x5177('0x34')](function(_0xb8f7de){var _0x1bc4cb=_[_0x5177('0x39')](_0xb8f7de,'id');var _0x4d29b7=[];var _0x1f8c26=[];var _0x365b68=squel[_0x5177('0x8e')]();_0x365b68['field'](_0x5177('0x8f'))[_0x5177('0x90')]('team_has_voice_prefixes','tq')[_0x5177('0x91')](_0x5177('0x92'),'ut',_0x5177('0x93'))['where'](_0x5177('0x94'),_0x13fa90[_0x5177('0x51')]['id']);for(var _0x3b8c79=0x0;_0x3b8c79<_0xb8f7de[_0x5177('0x45')];_0x3b8c79+=0x1){let _0x2a16ed=_0xb8f7de[_0x3b8c79];for(var _0x5d1909=0x0;_0x5d1909<_0x2a16ed['Agents'][_0x5177('0x45')];_0x5d1909+=0x1){let _0x61ead2=_0x2a16ed['Agents'][_0x5d1909];var _0x2ffb25=_0x365b68[_0x5177('0x95')]();_0x2ffb25['where'](_0x5177('0x96'),_0x61ead2['id']);_0x1f8c26[_0x5177('0x6c')](db['sequelize']['query'](_0x2ffb25[_0x5177('0x97')](),{'type':db['sequelize']['QueryTypes'][_0x5177('0x98')]})[_0x5177('0x34')](function(_0x58170f){if(_0x58170f[_0x5177('0x45')]===0x1){return _0x61ead2['id'];}else{var _0xdc5504=_[_0x5177('0x99')](_[_0x5177('0x39')](_0x58170f,_0x5177('0x9a')),function(_0x2fa026){return _['includes'](_0x1bc4cb,_0x2fa026);});if(_0xdc5504){return _0x61ead2['id'];}}}));}}return BPromise[_0x5177('0x9b')](_0x1f8c26)['then'](function(_0x55e914){_0x4d29b7=_(_0x4d29b7)[_0x5177('0x9c')](_0x55e914)[_0x5177('0x9d')]()[_0x5177('0x9e')]();return db['VoicePrefix'][_0x5177('0x5a')]({'where':{'id':_0x13fa90[_0x5177('0x51')]['id']}})[_0x5177('0x34')](function(_0x3873ca){return db[_0x5177('0x57')][_0x5177('0x75')](function(_0x10698d){return _0x3873ca[_0x5177('0x8d')](_0x13fa90[_0x5177('0x40')][_0x5177('0x78')],{'transaction':_0x10698d})[_0x5177('0x34')](function(){if(!_[_0x5177('0x9f')](_0x4d29b7)){return _0x3873ca['removeAgents'](_0x4d29b7,{'transaction':_0x10698d});}})[_0x5177('0x34')](function(){_0x4d29b7[_0x5177('0x8c')](function(_0x38f0f4){socket[_0x5177('0x7a')]('userVoicePrefix:remove',{'UserId':_0x38f0f4,'VoicePrefixId':_0x3873ca['id']});});});});});});})['then'](respondWithStatusCode(_0x3475c3,null))['catch'](handleError(_0x3475c3,null));}; \ No newline at end of file +var _0x6a95=['defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','save','then','get','VoicePrefixes','UserProfileResource','destroy','error','stack','name','send','index','map','VoicePrefix','rawAttributes','fieldName','type','key','query','filters','attributes','intersection','model','fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','catch','show','params','keys','includeAll','find','describe','sequelize','create','body','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','from-sip','exten','app','system','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','push','Set','CDR(prefix)=','PREFIX-CALLERIDALL=','callerIdAll','goto','context','charAt','update','system-','transaction','findById','addAgents','ids','omit','spread','userVoicePrefix:save','removeAgents','isArray','emit','userVoicePrefix:remove','getAgents','findOne','hasOwnProperty','Team','getTeams','Agents','online','voicePause','flatMap','addTeams','each','upsert','UserVoicePrefix','findOrCreate','forEach','User','select','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','TeamId','includes','all','union','compact','value','removeTeams','isEmpty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','redis'];(function(_0x25ca74,_0x46fd14){var _0xd25c5a=function(_0x1f5fa5){while(--_0x1f5fa5){_0x25ca74['push'](_0x25ca74['shift']());}};_0xd25c5a(++_0x46fd14);}(_0x6a95,0x1db));var _0x56a9=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0x6a95[_0x12d033];return _0x3b4e80;};'use strict';var emlformat=require(_0x56a9('0x0'));var rimraf=require(_0x56a9('0x1'));var zipdir=require(_0x56a9('0x2'));var jsonpatch=require(_0x56a9('0x3'));var rp=require(_0x56a9('0x4'));var moment=require(_0x56a9('0x5'));var BPromise=require(_0x56a9('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x56a9('0x7'));var sox=require(_0x56a9('0x8'));var csv=require(_0x56a9('0x9'));var ejs=require(_0x56a9('0xa'));var fs=require('fs');var fs_extra=require(_0x56a9('0xb'));var _=require(_0x56a9('0xc'));var squel=require(_0x56a9('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x56a9('0xe'));var toCsv=require(_0x56a9('0x9'));var querystring=require('querystring');var Papa=require(_0x56a9('0xf'));var Redis=require(_0x56a9('0x10'));var authService=require(_0x56a9('0x11'));var qs=require(_0x56a9('0x12'));var as=require(_0x56a9('0x13'));var hardwareService=require(_0x56a9('0x14'));var logger=require(_0x56a9('0x15'))(_0x56a9('0x16'));var utils=require(_0x56a9('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x56a9('0x18'));var db=require('../../mysqldb')['db'];config[_0x56a9('0x19')]=_[_0x56a9('0x1a')](config[_0x56a9('0x19')],{'host':_0x56a9('0x1b'),'port':0x18eb});var socket=require(_0x56a9('0x1c'))(new Redis(config[_0x56a9('0x19')]));require(_0x56a9('0x1d'))[_0x56a9('0x1e')](socket);function respondWithStatusCode(_0x40b2cb,_0x561bec){_0x561bec=_0x561bec||0xcc;return function(_0x582a5b){if(_0x582a5b){return _0x40b2cb[_0x56a9('0x1f')](_0x561bec);}return _0x40b2cb[_0x56a9('0x20')](_0x561bec)[_0x56a9('0x21')]();};}function respondWithResult(_0x46f854,_0x5b2637){_0x5b2637=_0x5b2637||0xc8;return function(_0x414cb5){if(_0x414cb5){return _0x46f854['status'](_0x5b2637)['json'](_0x414cb5);}};}function respondWithFilteredResult(_0x4e292f,_0x312e58){return function(_0x576bdf){if(_0x576bdf){var _0x59c0ec=typeof _0x312e58[_0x56a9('0x22')]===_0x56a9('0x23')&&typeof _0x312e58[_0x56a9('0x24')]===_0x56a9('0x23');var _0xbfeb1a=_0x576bdf[_0x56a9('0x25')];var _0x335cc3=_0x59c0ec?0x0:_0x312e58[_0x56a9('0x22')];var _0x62f79f=_0x59c0ec?_0x576bdf['count']:_0x312e58['offset']+_0x312e58[_0x56a9('0x24')];var _0x16f9de;if(_0x62f79f>=_0xbfeb1a){_0x62f79f=_0xbfeb1a;_0x16f9de=0xc8;}else{_0x16f9de=0xce;}_0x4e292f[_0x56a9('0x20')](_0x16f9de);return _0x4e292f[_0x56a9('0x26')]('Content-Range',_0x335cc3+'-'+_0x62f79f+'/'+_0xbfeb1a)[_0x56a9('0x27')](_0x576bdf);}return null;};}function patchUpdates(_0x3355c4){return function(_0x4036e5){try{jsonpatch[_0x56a9('0x28')](_0x4036e5,_0x3355c4,!![]);}catch(_0x5a82e0){return BPromise[_0x56a9('0x29')](_0x5a82e0);}return _0x4036e5[_0x56a9('0x2a')]();};}function saveUpdates(_0x21ab38,_0xd029f7){return function(_0x497d31){if(_0x497d31){return _0x497d31['update'](_0x21ab38)[_0x56a9('0x2b')](function(_0x217bda){return _0x217bda;});}return null;};}function removeEntity(_0x35fe6d,_0x5e3052){return function(_0x1099ba){if(_0x1099ba){return _0x1099ba['destroy']()[_0x56a9('0x2b')](function(){var _0x8d41d6=_0x1099ba[_0x56a9('0x2c')]({'plain':!![]});var _0x20432a=_0x56a9('0x2d');return db[_0x56a9('0x2e')][_0x56a9('0x2f')]({'where':{'type':_0x20432a,'resourceId':_0x8d41d6['id']}})[_0x56a9('0x2b')](function(){return _0x1099ba;});})['then'](function(){_0x35fe6d[_0x56a9('0x20')](0xcc)[_0x56a9('0x21')]();});}};}function handleEntityNotFound(_0x5f23e1,_0x4441ce){return function(_0x4f9be1){if(!_0x4f9be1){_0x5f23e1['sendStatus'](0x194);}return _0x4f9be1;};}function handleError(_0x20d940,_0x4c1e3e){_0x4c1e3e=_0x4c1e3e||0x1f4;return function(_0x2f933a){logger[_0x56a9('0x30')](_0x2f933a[_0x56a9('0x31')]);if(_0x2f933a[_0x56a9('0x32')]){delete _0x2f933a['name'];}_0x20d940[_0x56a9('0x20')](_0x4c1e3e)[_0x56a9('0x33')](_0x2f933a);};}exports[_0x56a9('0x34')]=function(_0xeabd82,_0xbbb47d){var _0x1fa0a6={},_0x3a7a4e={},_0x2b5447={'count':0x0,'rows':[]};var _0x42c2da=_[_0x56a9('0x35')](db[_0x56a9('0x36')][_0x56a9('0x37')],function(_0x5738fe){return{'name':_0x5738fe[_0x56a9('0x38')],'type':_0x5738fe[_0x56a9('0x39')][_0x56a9('0x3a')]};});_0x3a7a4e['model']=_[_0x56a9('0x35')](_0x42c2da,'name');_0x3a7a4e['query']=_['keys'](_0xeabd82[_0x56a9('0x3b')]);_0x3a7a4e[_0x56a9('0x3c')]=_['intersection'](_0x3a7a4e['model'],_0x3a7a4e[_0x56a9('0x3b')]);_0x1fa0a6[_0x56a9('0x3d')]=_[_0x56a9('0x3e')](_0x3a7a4e[_0x56a9('0x3f')],qs[_0x56a9('0x40')](_0xeabd82[_0x56a9('0x3b')][_0x56a9('0x40')]));_0x1fa0a6[_0x56a9('0x3d')]=_0x1fa0a6[_0x56a9('0x3d')][_0x56a9('0x41')]?_0x1fa0a6['attributes']:_0x3a7a4e['model'];if(!_0xeabd82['query']['hasOwnProperty'](_0x56a9('0x42'))){_0x1fa0a6[_0x56a9('0x24')]=qs['limit'](_0xeabd82[_0x56a9('0x3b')][_0x56a9('0x24')]);_0x1fa0a6[_0x56a9('0x22')]=qs[_0x56a9('0x22')](_0xeabd82[_0x56a9('0x3b')][_0x56a9('0x22')]);}_0x1fa0a6[_0x56a9('0x43')]=qs['sort'](_0xeabd82[_0x56a9('0x3b')][_0x56a9('0x44')]);_0x1fa0a6['where']=qs['filters'](_[_0x56a9('0x45')](_0xeabd82[_0x56a9('0x3b')],_0x3a7a4e[_0x56a9('0x3c')]),_0x42c2da);if(_0xeabd82[_0x56a9('0x3b')][_0x56a9('0x46')]){_0x1fa0a6[_0x56a9('0x47')]=_[_0x56a9('0x48')](_0x1fa0a6[_0x56a9('0x47')],{'$or':_[_0x56a9('0x35')](_0x42c2da,function(_0x24a7e3){if(_0x24a7e3[_0x56a9('0x39')]!==_0x56a9('0x49')){var _0xf2347a={};_0xf2347a[_0x24a7e3[_0x56a9('0x32')]]={'$like':'%'+_0xeabd82[_0x56a9('0x3b')][_0x56a9('0x46')]+'%'};return _0xf2347a;}})});}_0x1fa0a6=_[_0x56a9('0x48')]({},_0x1fa0a6,_0xeabd82[_0x56a9('0x4a')]);var _0x5dad3f={'where':_0x1fa0a6[_0x56a9('0x47')]};return db[_0x56a9('0x36')][_0x56a9('0x25')](_0x5dad3f)['then'](function(_0x1f8b30){_0x2b5447['count']=_0x1f8b30;if(_0xeabd82[_0x56a9('0x3b')]['includeAll']){_0x1fa0a6[_0x56a9('0x4b')]=[{'all':!![]}];}return db[_0x56a9('0x36')][_0x56a9('0x4c')](_0x1fa0a6);})[_0x56a9('0x2b')](function(_0x5192d8){_0x2b5447['rows']=_0x5192d8;return _0x2b5447;})['then'](respondWithFilteredResult(_0xbbb47d,_0x1fa0a6))[_0x56a9('0x4d')](handleError(_0xbbb47d,null));};exports[_0x56a9('0x4e')]=function(_0x288eaa,_0x402a64){var _0x16db39={'raw':![],'where':{'id':_0x288eaa[_0x56a9('0x4f')]['id']}},_0x182990={};_0x182990[_0x56a9('0x3f')]=_[_0x56a9('0x50')](db[_0x56a9('0x36')][_0x56a9('0x37')]);_0x182990[_0x56a9('0x3b')]=_[_0x56a9('0x50')](_0x288eaa[_0x56a9('0x3b')]);_0x182990['filters']=_[_0x56a9('0x3e')](_0x182990[_0x56a9('0x3f')],_0x182990[_0x56a9('0x3b')]);_0x16db39['attributes']=_[_0x56a9('0x3e')](_0x182990[_0x56a9('0x3f')],qs['fields'](_0x288eaa[_0x56a9('0x3b')][_0x56a9('0x40')]));_0x16db39[_0x56a9('0x3d')]=_0x16db39[_0x56a9('0x3d')]['length']?_0x16db39[_0x56a9('0x3d')]:_0x182990[_0x56a9('0x3f')];if(_0x288eaa[_0x56a9('0x3b')][_0x56a9('0x51')]){_0x16db39[_0x56a9('0x4b')]=[{'all':!![]}];}_0x16db39=_[_0x56a9('0x48')]({},_0x16db39,_0x288eaa[_0x56a9('0x4a')]);return db[_0x56a9('0x36')][_0x56a9('0x52')](_0x16db39)[_0x56a9('0x2b')](handleEntityNotFound(_0x402a64,null))[_0x56a9('0x2b')](respondWithResult(_0x402a64,null))['catch'](handleError(_0x402a64,null));};exports['destroy']=function(_0x46aa63,_0x35fb7b){return db[_0x56a9('0x36')][_0x56a9('0x52')]({'where':{'id':_0x46aa63['params']['id']}})[_0x56a9('0x2b')](handleEntityNotFound(_0x35fb7b,null))[_0x56a9('0x2b')](removeEntity(_0x35fb7b,null))[_0x56a9('0x4d')](handleError(_0x35fb7b,null));};exports[_0x56a9('0x53')]=function(_0x52ba21,_0x221a01){return db[_0x56a9('0x36')]['describe']()[_0x56a9('0x2b')](respondWithResult(_0x221a01,null))[_0x56a9('0x4d')](handleError(_0x221a01,null));};exports['create']=function(_0x12179d,_0x338140){var _0x230b53;return db[_0x56a9('0x54')]['transaction'](function(_0x4938d6){return db[_0x56a9('0x36')][_0x56a9('0x55')](_0x12179d[_0x56a9('0x56')],{'transaction':_0x4938d6})[_0x56a9('0x2b')](function(_0x40e660){_0x230b53=_0x40e660[_0x56a9('0x2c')]({'plain':!![]});return db[_0x56a9('0x57')][_0x56a9('0x52')]({'where':{'id':_0x230b53[_0x56a9('0x58')]},'raw':!![]})[_0x56a9('0x2b')](function(_0x5f07f5){return createVoicePrefixExtensions(_0x230b53,_0x5f07f5,_0x4938d6);});});})[_0x56a9('0x2b')](function(){var _0x20ce89=_0x12179d[_0x56a9('0x59')][_0x56a9('0x2c')]({'plain':!![]});if(!_0x20ce89)throw new Error(_0x56a9('0x5a'));if(_0x20ce89[_0x56a9('0x5b')]===_0x56a9('0x59')){var _0x488577=_0x230b53;return db[_0x56a9('0x5c')][_0x56a9('0x52')]({'where':{'name':_0x56a9('0x2d'),'userProfileId':_0x20ce89[_0x56a9('0x5d')]},'raw':!![]})[_0x56a9('0x2b')](function(_0x25830d){if(_0x25830d&&_0x25830d[_0x56a9('0x5e')]===0x0){return db['UserProfileResource'][_0x56a9('0x55')]({'name':_0x488577['name'],'resourceId':_0x488577['id'],'type':_0x25830d['name'],'sectionId':_0x25830d['id']},{})[_0x56a9('0x2b')](function(){return _0x230b53;});}else{return _0x230b53;}})['catch'](function(_0x229c12){logger[_0x56a9('0x30')](_0x56a9('0x5f'),_0x229c12);throw _0x229c12;});}return _0x230b53;})[_0x56a9('0x2b')](respondWithResult(_0x338140,null))[_0x56a9('0x4d')](handleError(_0x338140,null));};function Extension(_0x3e6f16,_0x1628a5,_0xa3850f,_0x91bad6){this['context']=_0x56a9('0x60');this[_0x56a9('0x61')]=_0x3e6f16;this[_0x56a9('0x62')]=_0xa3850f;this[_0x56a9('0x39')]=_0x56a9('0x63');this[_0x56a9('0x64')]=_0x56a9('0x65');this[_0x56a9('0x66')]=_0x1628a5;this[_0x56a9('0x67')]=_0x91bad6;}function createVoicePrefixExtensions(_0x25c6d6,_0x5df43d,_0x359c9c){return new BPromise(function(_0x286939,_0x38e497){var _0x47e4f7=new Extension(formatPrefixName(_0x25c6d6[_0x56a9('0x68')]),0x1,_0x56a9('0x69'),_0x56a9('0x6a'));_0x47e4f7['VoicePrefixId']=_0x25c6d6['id'];return db['VoiceExtension'][_0x56a9('0x55')](_0x47e4f7,{'transaction':_0x359c9c})[_0x56a9('0x2b')](function(_0x302aa0){var _0x1d6497=_0x302aa0[_0x56a9('0x2c')]({'plain':!![]});var _0x5d126f=_[_0x56a9('0x35')](addVoicePrefixExtensions(_0x25c6d6,_0x5df43d),function(_0x52bc63){_0x52bc63[_0x56a9('0x58')]=_0x1d6497['id'];_0x52bc63[_0x56a9('0x6b')]=_0x25c6d6['id'];return _0x52bc63;});return db[_0x56a9('0x57')][_0x56a9('0x6c')](_0x5d126f,{'transaction':_0x359c9c})[_0x56a9('0x2b')](function(_0x5edf65){if(!_0x5edf65){return _0x38e497('Extensions\x20creation\x20failed');}else{return _0x286939(_0x5edf65);}})['catch'](function(_0x2de0da){return _0x38e497(_0x2de0da);});});;});};function addVoicePrefixExtensions(_0x2aa634,_0x41ca05){var _0x5bbbf3=[];var _0x2313c4=formatPrefixName(_0x2aa634['prefix']);_0x5bbbf3[_0x56a9('0x6d')](new Extension(_0x2313c4,0x2,_0x56a9('0x6e'),_0x56a9('0x6f')+_0x2aa634['name']));if(_0x2aa634['callerIdAll']){_0x5bbbf3[_0x56a9('0x6d')](new Extension(_0x2313c4,0x3,_0x56a9('0x6e'),_0x56a9('0x70')+_0x2aa634[_0x56a9('0x71')]));}else{_0x5bbbf3[_0x56a9('0x6d')](new Extension(_0x2313c4,0x3,_0x56a9('0x69'),'No\x20callerid\x20available'));}_0x5bbbf3[_0x56a9('0x6d')](new Extension(_0x2313c4,0x4,_0x56a9('0x72'),_0x41ca05[_0x56a9('0x73')]+','+'${EXTEN:'+(0x8+_0x2aa634['name']['length'])+'}'+','+0x1));return _0x5bbbf3;}function formatPrefixName(_0x57001c){var _0x4270ba='_';for(var _0x35b620=0x0;_0x35b620<_0x57001c['length'];_0x35b620++){if(_0x57001c[_0x56a9('0x74')](_0x35b620)=='-'){_0x4270ba+=_0x57001c[_0x56a9('0x74')](_0x35b620);}else{_0x4270ba+='['+_0x57001c[_0x56a9('0x74')](_0x35b620)+']';}}_0x4270ba+='.';return _0x4270ba;}exports[_0x56a9('0x75')]=function(_0x58108a,_0x26315b,_0x398a63){var _0x25b6b6=_0x58108a[_0x56a9('0x56')];_0x25b6b6[_0x56a9('0x68')]=_0x56a9('0x76')+_0x25b6b6[_0x56a9('0x32')]+'-';return db[_0x56a9('0x54')][_0x56a9('0x77')](function(_0x41437e){return db[_0x56a9('0x36')][_0x56a9('0x75')](_0x25b6b6,{'where':{'id':_0x25b6b6['id']},'transaction':_0x41437e})[_0x56a9('0x2b')](function(){return db[_0x56a9('0x57')][_0x56a9('0x2f')]({'where':{'VoicePrefixId':_0x25b6b6['id']},'transaction':_0x41437e})[_0x56a9('0x2b')](function(){return db['VoiceExtension'][_0x56a9('0x52')]({'where':{'id':_0x25b6b6['VoiceExtensionId']},'raw':!![]})[_0x56a9('0x2b')](function(_0x2ef783){return createVoicePrefixExtensions(_0x25b6b6,_0x2ef783,_0x41437e);});});});})[_0x56a9('0x2b')](function(){return db['VoicePrefix'][_0x56a9('0x78')](_0x25b6b6['id']);})['then'](respondWithResult(_0x26315b,null))['catch'](handleError(_0x26315b,null));};exports[_0x56a9('0x79')]=function(_0x1730ac,_0x17ff8e,_0x15b983){return db['VoicePrefix'][_0x56a9('0x52')]({'where':{'id':_0x1730ac[_0x56a9('0x4f')]['id']}})[_0x56a9('0x2b')](handleEntityNotFound(_0x17ff8e,null))[_0x56a9('0x2b')](function(_0x5b144f){if(_0x5b144f){return _0x5b144f['addAgents'](_0x1730ac['body'][_0x56a9('0x7a')],_[_0x56a9('0x7b')](_0x1730ac[_0x56a9('0x56')],[_0x56a9('0x7a'),'id'])||{})[_0x56a9('0x7c')](function(_0x23c0ee){for(var _0x106017=0x0;_0x106017<_0x1730ac[_0x56a9('0x56')]['ids']['length'];_0x106017+=0x1){socket['emit'](_0x56a9('0x7d'),{'UserId':Number(_0x1730ac['body']['ids'][_0x106017]),'VoicePrefixId':Number(_0x1730ac['params']['id'])});}return _0x23c0ee;});}})['then'](respondWithResult(_0x17ff8e,null))[_0x56a9('0x4d')](handleError(_0x17ff8e,null));};exports[_0x56a9('0x7e')]=function(_0x16a293,_0x32ba59,_0x5e35aa){return db[_0x56a9('0x36')][_0x56a9('0x52')]({'where':{'id':_0x16a293[_0x56a9('0x4f')]['id']}})[_0x56a9('0x2b')](handleEntityNotFound(_0x32ba59,null))[_0x56a9('0x2b')](function(_0x469bf6){if(_0x469bf6){return _0x469bf6[_0x56a9('0x7e')](_0x16a293[_0x56a9('0x3b')][_0x56a9('0x7a')])[_0x56a9('0x2b')](function(){if(_[_0x56a9('0x7f')](_0x16a293[_0x56a9('0x3b')][_0x56a9('0x7a')])){for(var _0x4d8ccc=0x0;_0x4d8ccc<_0x16a293['query']['ids']['length'];_0x4d8ccc+=0x1){socket[_0x56a9('0x80')](_0x56a9('0x81'),{'UserId':Number(_0x16a293['query'][_0x56a9('0x7a')][_0x4d8ccc]),'VoicePrefixId':Number(_0x16a293[_0x56a9('0x4f')]['id'])});}}else{socket[_0x56a9('0x80')](_0x56a9('0x81'),{'UserId':Number(_0x16a293[_0x56a9('0x3b')][_0x56a9('0x7a')]),'VoicePrefixId':Number(_0x16a293['params']['id'])});}});}})[_0x56a9('0x2b')](respondWithStatusCode(_0x32ba59,null))['catch'](handleError(_0x32ba59,null));};exports[_0x56a9('0x82')]=function(_0x296203,_0x6dd6e6,_0x598a82){var _0x19cfef={};var _0xe2f84={};var _0x35731a;var _0x256b26;return db[_0x56a9('0x36')][_0x56a9('0x83')]({'where':{'id':_0x296203['params']['id']}})[_0x56a9('0x2b')](handleEntityNotFound(_0x6dd6e6,null))[_0x56a9('0x2b')](function(_0x1f42a3){if(_0x1f42a3){_0x35731a=_0x1f42a3;_0xe2f84[_0x56a9('0x3f')]=_[_0x56a9('0x50')](db['User'][_0x56a9('0x37')]);_0xe2f84[_0x56a9('0x3b')]=_[_0x56a9('0x50')](_0x296203[_0x56a9('0x3b')]);_0xe2f84[_0x56a9('0x3c')]=_['intersection'](_0xe2f84[_0x56a9('0x3f')],_0xe2f84[_0x56a9('0x3b')]);_0x19cfef['attributes']=_[_0x56a9('0x3e')](_0xe2f84[_0x56a9('0x3f')],qs[_0x56a9('0x40')](_0x296203['query'][_0x56a9('0x40')]));_0x19cfef[_0x56a9('0x3d')]=_0x19cfef[_0x56a9('0x3d')][_0x56a9('0x41')]?_0x19cfef[_0x56a9('0x3d')]:_0xe2f84[_0x56a9('0x3f')];_0x19cfef[_0x56a9('0x43')]=qs[_0x56a9('0x44')](_0x296203[_0x56a9('0x3b')][_0x56a9('0x44')]);_0x19cfef['where']=qs[_0x56a9('0x3c')](_[_0x56a9('0x45')](_0x296203[_0x56a9('0x3b')],_0xe2f84[_0x56a9('0x3c')]));if(_0x296203[_0x56a9('0x3b')][_0x56a9('0x46')]){_0x19cfef[_0x56a9('0x47')]=_['merge'](_0x19cfef[_0x56a9('0x47')],{'$or':_['map'](_0x19cfef[_0x56a9('0x3d')],function(_0x324a98){var _0x1324ba={};_0x1324ba[_0x324a98]={'$like':'%'+_0x296203[_0x56a9('0x3b')][_0x56a9('0x46')]+'%'};return _0x1324ba;})});}_0x19cfef=_['merge']({},_0x19cfef,_0x296203[_0x56a9('0x4a')]);return _0x35731a['getAgents'](_0x19cfef);}})[_0x56a9('0x2b')](function(_0x131644){if(_0x131644){_0x256b26=_0x131644[_0x56a9('0x41')];if(!_0x296203[_0x56a9('0x3b')][_0x56a9('0x84')](_0x56a9('0x42'))){_0x19cfef[_0x56a9('0x24')]=qs[_0x56a9('0x24')](_0x296203[_0x56a9('0x3b')][_0x56a9('0x24')]);_0x19cfef['offset']=qs[_0x56a9('0x22')](_0x296203['query']['offset']);}return _0x35731a[_0x56a9('0x82')](_0x19cfef);}})[_0x56a9('0x2b')](function(_0x5a2080){if(_0x5a2080){return _0x5a2080?{'count':_0x256b26,'rows':_0x5a2080}:null;}})[_0x56a9('0x2b')](respondWithResult(_0x6dd6e6,null))[_0x56a9('0x4d')](handleError(_0x6dd6e6,null));};exports['getTeams']=function(_0x3c0b9a,_0x5eb05d,_0x2cf047){var _0x18fd5e={};var _0x5f5db6={};var _0xafa83b;var _0x4c3257;return db[_0x56a9('0x36')]['findOne']({'where':{'id':_0x3c0b9a[_0x56a9('0x4f')]['id']}})[_0x56a9('0x2b')](handleEntityNotFound(_0x5eb05d,null))[_0x56a9('0x2b')](function(_0x269369){if(_0x269369){_0xafa83b=_0x269369;_0x5f5db6[_0x56a9('0x3f')]=_['keys'](db[_0x56a9('0x85')][_0x56a9('0x37')]);_0x5f5db6[_0x56a9('0x3b')]=_[_0x56a9('0x50')](_0x3c0b9a[_0x56a9('0x3b')]);_0x5f5db6['filters']=_[_0x56a9('0x3e')](_0x5f5db6[_0x56a9('0x3f')],_0x5f5db6[_0x56a9('0x3b')]);_0x18fd5e['attributes']=_[_0x56a9('0x3e')](_0x5f5db6[_0x56a9('0x3f')],qs[_0x56a9('0x40')](_0x3c0b9a[_0x56a9('0x3b')]['fields']));_0x18fd5e['attributes']=_0x18fd5e[_0x56a9('0x3d')][_0x56a9('0x41')]?_0x18fd5e[_0x56a9('0x3d')]:_0x5f5db6[_0x56a9('0x3f')];_0x18fd5e[_0x56a9('0x43')]=qs[_0x56a9('0x44')](_0x3c0b9a[_0x56a9('0x3b')][_0x56a9('0x44')]);_0x18fd5e[_0x56a9('0x47')]=qs['filters'](_[_0x56a9('0x45')](_0x3c0b9a['query'],_0x5f5db6[_0x56a9('0x3c')]));if(_0x3c0b9a[_0x56a9('0x3b')][_0x56a9('0x46')]){_0x18fd5e[_0x56a9('0x47')]=_[_0x56a9('0x48')](_0x18fd5e['where'],{'$or':_[_0x56a9('0x35')](_0x18fd5e[_0x56a9('0x3d')],function(_0x21ffcf){var _0x2d02e7={};_0x2d02e7[_0x21ffcf]={'$like':'%'+_0x3c0b9a[_0x56a9('0x3b')][_0x56a9('0x46')]+'%'};return _0x2d02e7;})});}_0x18fd5e=_[_0x56a9('0x48')]({},_0x18fd5e,_0x3c0b9a['options']);return _0xafa83b[_0x56a9('0x86')](_0x18fd5e);}})[_0x56a9('0x2b')](function(_0x45e58d){if(_0x45e58d){_0x4c3257=_0x45e58d[_0x56a9('0x41')];if(!_0x3c0b9a[_0x56a9('0x3b')][_0x56a9('0x84')]('nolimit')){_0x18fd5e[_0x56a9('0x24')]=qs['limit'](_0x3c0b9a[_0x56a9('0x3b')][_0x56a9('0x24')]);_0x18fd5e[_0x56a9('0x22')]=qs['offset'](_0x3c0b9a[_0x56a9('0x3b')][_0x56a9('0x22')]);}return _0xafa83b[_0x56a9('0x86')](_0x18fd5e);}})[_0x56a9('0x2b')](function(_0x12e70a){if(_0x12e70a){return _0x12e70a?{'count':_0x4c3257,'rows':_0x12e70a}:null;}})[_0x56a9('0x2b')](respondWithResult(_0x5eb05d,null))[_0x56a9('0x4d')](handleError(_0x5eb05d,null));};exports['addTeams']=function(_0x4fee66,_0x444b4,_0x1a3459){var _0x5480b6=_0x4fee66[_0x56a9('0x56')][_0x56a9('0x7a')];var _0x14d54d;return db['Team'][_0x56a9('0x4c')]({'where':{'id':_0x5480b6},'attributes':['id'],'include':[{'model':db['User'],'as':_0x56a9('0x87'),'attributes':['id','name',_0x56a9('0x88'),_0x56a9('0x89'),'interface'],'raw':!![]}]})[_0x56a9('0x2b')](function(_0x41c07e){if(_0x41c07e){_0x14d54d=_0x41c07e;var _0x11a6ab=_[_0x56a9('0x8a')](_0x41c07e,function(_0x474ae4){var _0x3fe3e9=_0x474ae4['get']({'plain':!![]});return _0x3fe3e9[_0x56a9('0x87')];});return db[_0x56a9('0x36')][_0x56a9('0x52')]({'where':{'id':_0x4fee66['params']['id']}})[_0x56a9('0x2b')](function(_0x22f222){return db[_0x56a9('0x54')][_0x56a9('0x77')](function(_0x2adb73){return _0x22f222[_0x56a9('0x8b')](_0x5480b6,{'transaction':_0x2adb73})[_0x56a9('0x2b')](function(){return BPromise[_0x56a9('0x8c')](_0x14d54d,function(_0x4252c0){return db['TeamVoicePrefix'][_0x56a9('0x8d')]({'TeamId':_0x4252c0['id'],'VoicePrefixId':_0x4fee66['params']['id']},{'transaction':_0x2adb73});});})[_0x56a9('0x2b')](function(){return BPromise[_0x56a9('0x8c')](_0x11a6ab,function(_0x2ee1ee){return db[_0x56a9('0x8e')][_0x56a9('0x8f')]({'where':{'UserId':_0x2ee1ee['id'],'VoicePrefixId':_0x4fee66['params']['id']},'transaction':_0x2adb73});});})[_0x56a9('0x2b')](function(){_0x11a6ab[_0x56a9('0x90')](function(_0x4959e1){socket[_0x56a9('0x80')](_0x56a9('0x7d'),{'UserId':_0x4959e1['id'],'VoicePrefixId':_0x22f222['id']});});});});});}})[_0x56a9('0x2b')](respondWithStatusCode(_0x444b4,null))[_0x56a9('0x4d')](handleError(_0x444b4,null));};exports['removeTeams']=function(_0xf42b12,_0x487850,_0x3f6373){return db[_0x56a9('0x85')][_0x56a9('0x4c')]({'where':{'id':_0xf42b12[_0x56a9('0x3b')]['ids']},'attributes':['id'],'include':[{'model':db[_0x56a9('0x91')],'as':_0x56a9('0x87'),'attributes':['id'],'raw':!![]}]})[_0x56a9('0x2b')](handleEntityNotFound(_0x487850,null))['then'](function(_0x143875){var _0x289604=_[_0x56a9('0x35')](_0x143875,'id');var _0x47ad47=[];var _0x531d93=[];var _0x175da9=squel[_0x56a9('0x92')]();_0x175da9['field'](_0x56a9('0x93'))[_0x56a9('0x94')](_0x56a9('0x95'),'tq')['join'](_0x56a9('0x96'),'ut',_0x56a9('0x97'))[_0x56a9('0x47')](_0x56a9('0x98'),_0xf42b12[_0x56a9('0x4f')]['id']);for(var _0xff2bfb=0x0;_0xff2bfb<_0x143875[_0x56a9('0x41')];_0xff2bfb+=0x1){let _0x11c091=_0x143875[_0xff2bfb];for(var _0xcacd10=0x0;_0xcacd10<_0x11c091[_0x56a9('0x87')][_0x56a9('0x41')];_0xcacd10+=0x1){let _0x142d8d=_0x11c091[_0x56a9('0x87')][_0xcacd10];var _0x35b35a=_0x175da9[_0x56a9('0x99')]();_0x35b35a['where'](_0x56a9('0x9a'),_0x142d8d['id']);_0x531d93[_0x56a9('0x6d')](db['sequelize']['query'](_0x35b35a[_0x56a9('0x9b')](),{'type':db['sequelize'][_0x56a9('0x9c')][_0x56a9('0x9d')]})['then'](function(_0x40526a){if(_0x40526a['length']===0x1){return _0x142d8d['id'];}else{var _0x57e0ca=_[_0x56a9('0x9e')](_[_0x56a9('0x35')](_0x40526a,_0x56a9('0x9f')),function(_0x1ce55c){return _[_0x56a9('0xa0')](_0x289604,_0x1ce55c);});if(_0x57e0ca){return _0x142d8d['id'];}}}));}}return BPromise[_0x56a9('0xa1')](_0x531d93)[_0x56a9('0x2b')](function(_0x1e36c0){_0x47ad47=_(_0x47ad47)[_0x56a9('0xa2')](_0x1e36c0)[_0x56a9('0xa3')]()[_0x56a9('0xa4')]();return db[_0x56a9('0x36')][_0x56a9('0x52')]({'where':{'id':_0xf42b12[_0x56a9('0x4f')]['id']}})[_0x56a9('0x2b')](function(_0x5a2eb4){return db[_0x56a9('0x54')][_0x56a9('0x77')](function(_0x1fe677){return _0x5a2eb4[_0x56a9('0xa5')](_0xf42b12['query'][_0x56a9('0x7a')],{'transaction':_0x1fe677})[_0x56a9('0x2b')](function(){if(!_[_0x56a9('0xa6')](_0x47ad47)){return _0x5a2eb4[_0x56a9('0x7e')](_0x47ad47,{'transaction':_0x1fe677});}})[_0x56a9('0x2b')](function(){_0x47ad47['forEach'](function(_0x33660b){socket[_0x56a9('0x80')](_0x56a9('0x81'),{'UserId':_0x33660b,'VoicePrefixId':_0x5a2eb4['id']});});});});});});})[_0x56a9('0x2b')](respondWithStatusCode(_0x487850,null))[_0x56a9('0x4d')](handleError(_0x487850,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 4159817..6ff4cec 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 _0xad6b=['VoicePrefix','setMaxListeners','remove','emit','hasOwnProperty','hook','../../mysqldb'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xad6b,0x1b1));var _0xbad6=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0xad6b[_0x2dadb9];return _0x2f0097;};'use strict';var EventEmitter=require('events');var VoicePrefix=require(_0xbad6('0x0'))['db'][_0xbad6('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xbad6('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xbad6('0x3')};function emitEvent(_0xeec723){return function(_0x4f4090,_0x36da6e,_0x2a985b){VoicePrefixEvents[_0xbad6('0x4')](_0xeec723+':'+_0x4f4090['id'],_0x4f4090);VoicePrefixEvents[_0xbad6('0x4')](_0xeec723,_0x4f4090);_0x2a985b(null);};}for(var e in events){if(events[_0xbad6('0x5')](e)){var event=events[e];VoicePrefix[_0xbad6('0x6')](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file +var _0x1f38=['save','update','remove','emit','hook','exports','events','VoicePrefix','setMaxListeners'];(function(_0x2e58c7,_0x23d092){var _0x26eb00=function(_0x343124){while(--_0x343124){_0x2e58c7['push'](_0x2e58c7['shift']());}};_0x26eb00(++_0x23d092);}(_0x1f38,0x1da));var _0x81f3=function(_0x24431a,_0x52459a){_0x24431a=_0x24431a-0x0;var _0x454ec7=_0x1f38[_0x24431a];return _0x454ec7;};'use strict';var EventEmitter=require(_0x81f3('0x0'));var VoicePrefix=require('../../mysqldb')['db'][_0x81f3('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x81f3('0x2')](0x0);var events={'afterCreate':_0x81f3('0x3'),'afterUpdate':_0x81f3('0x4'),'afterDestroy':_0x81f3('0x5')};function emitEvent(_0x307968){return function(_0x172bd0,_0xd2467,_0x1ed534){VoicePrefixEvents[_0x81f3('0x6')](_0x307968+':'+_0x172bd0['id'],_0x172bd0);VoicePrefixEvents[_0x81f3('0x6')](_0x307968,_0x172bd0);_0x1ed534(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoicePrefix[_0x81f3('0x7')](e,emitEvent(event));}}module[_0x81f3('0x8')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 1997487..b945589 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 _0x62b0=['api','moment','request-promise','path','rimraf','../../config/environment','./voicePrefix.attributes','exports','define','VoicePrefix','lodash','util','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x62b0,0xa6));var _0x062b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x62b0[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x062b('0x0'));var util=require(_0x062b('0x1'));var logger=require(_0x062b('0x2'))(_0x062b('0x3'));var moment=require(_0x062b('0x4'));var BPromise=require('bluebird');var rp=require(_0x062b('0x5'));var fs=require('fs');var path=require(_0x062b('0x6'));var rimraf=require(_0x062b('0x7'));var config=require(_0x062b('0x8'));var attributes=require(_0x062b('0x9'));module[_0x062b('0xa')]=function(_0x3f8ae2,_0x4bdadb){return _0x3f8ae2[_0x062b('0xb')](_0x062b('0xc'),attributes,{'tableName':'voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5bd5=['./voicePrefix.attributes','exports','define','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment'];(function(_0x3ae61a,_0x43c852){var _0x3731e0=function(_0x169353){while(--_0x169353){_0x3ae61a['push'](_0x3ae61a['shift']());}};_0x3731e0(++_0x43c852);}(_0x5bd5,0xf3));var _0x55bd=function(_0x5465e6,_0x2a8809){_0x5465e6=_0x5465e6-0x0;var _0x10044e=_0x5bd5[_0x5465e6];return _0x10044e;};'use strict';var _=require('lodash');var util=require(_0x55bd('0x0'));var logger=require(_0x55bd('0x1'))(_0x55bd('0x2'));var moment=require('moment');var BPromise=require(_0x55bd('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x55bd('0x4'));var rimraf=require(_0x55bd('0x5'));var config=require(_0x55bd('0x6'));var attributes=require(_0x55bd('0x7'));module[_0x55bd('0x8')]=function(_0x18edff,_0x3646d2){return _0x18edff[_0x55bd('0x9')]('VoicePrefix',attributes,{'tableName':'voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.rpc.js b/server/api/voicePrefix/voicePrefix.rpc.js index 2e05991..9e63719 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 _0xe3da=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','util','moment'];(function(_0x50c492,_0x5c1e67){var _0x3505a8=function(_0x2f7937){while(--_0x2f7937){_0x50c492['push'](_0x50c492['shift']());}};_0x3505a8(++_0x5c1e67);}(_0xe3da,0x1cd));var _0xae3d=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xe3da[_0x57b54c];return _0x59cc19;};'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});config[_0xae3d('0xe')]=_[_0xae3d('0xf')](config['redis'],{'host':_0xae3d('0x10'),'port':0x18eb});var socket=require(_0xae3d('0x11'))(new Redis(config['redis']));require('./voicePrefix.socket')[_0xae3d('0x12')](socket);function respondWithRpcPromise(_0x157a3e,_0x420e28,_0x124833){return new BPromise(function(_0x2705b8,_0x15d6da){return client['request'](_0x157a3e,_0x124833)[_0xae3d('0x13')](function(_0x49fe58){logger[_0xae3d('0x14')](_0xae3d('0x15'),_0x420e28,_0xae3d('0x16'));logger[_0xae3d('0x17')]('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x420e28,_0xae3d('0x16'),JSON[_0xae3d('0x18')](_0x49fe58));if(_0x49fe58[_0xae3d('0x19')]){if(_0x49fe58[_0xae3d('0x19')][_0xae3d('0x1a')]===0x1f4){logger[_0xae3d('0x19')](_0xae3d('0x15'),_0x420e28,_0x49fe58['error'][_0xae3d('0x1b')]);return _0x15d6da(_0x49fe58[_0xae3d('0x19')][_0xae3d('0x1b')]);}logger[_0xae3d('0x19')](_0xae3d('0x15'),_0x420e28,_0x49fe58[_0xae3d('0x19')]['message']);return _0x2705b8(_0x49fe58[_0xae3d('0x19')][_0xae3d('0x1b')]);}else{logger[_0xae3d('0x14')]('VoicePrefix,\x20%s,\x20%s',_0x420e28,_0xae3d('0x16'));_0x2705b8(_0x49fe58[_0xae3d('0x1c')]['message']);}})['catch'](function(_0x8a37cc){logger[_0xae3d('0x19')](_0xae3d('0x15'),_0x420e28,_0x8a37cc);_0x15d6da(_0x8a37cc);});});} \ No newline at end of file +var _0xf562=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','request','then','info','request\x20sent','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','VoicePrefix,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x54d26a,_0x504173){var _0x44d7eb=function(_0x5afcdc){while(--_0x5afcdc){_0x54d26a['push'](_0x54d26a['shift']());}};_0x44d7eb(++_0x504173);}(_0xf562,0x100));var _0x2f56=function(_0xf40864,_0x1b76e3){_0xf40864=_0xf40864-0x0;var _0x33f47e=_0xf562[_0xf40864];return _0x33f47e;};'use strict';var _=require(_0x2f56('0x0'));var util=require(_0x2f56('0x1'));var moment=require(_0x2f56('0x2'));var BPromise=require(_0x2f56('0x3'));var rs=require(_0x2f56('0x4'));var fs=require('fs');var Redis=require(_0x2f56('0x5'));var db=require(_0x2f56('0x6'))['db'];var utils=require(_0x2f56('0x7'));var logger=require(_0x2f56('0x8'))('rpc');var config=require(_0x2f56('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x2f56('0xa')]['http']({'port':0x232a});config[_0x2f56('0xb')]=_[_0x2f56('0xc')](config[_0x2f56('0xb')],{'host':_0x2f56('0xd'),'port':0x18eb});var socket=require(_0x2f56('0xe'))(new Redis(config[_0x2f56('0xb')]));require(_0x2f56('0xf'))[_0x2f56('0x10')](socket);function respondWithRpcPromise(_0x926a86,_0x5eeaa7,_0x30a106){return new BPromise(function(_0x39572f,_0x52d3d2){return client[_0x2f56('0x11')](_0x926a86,_0x30a106)[_0x2f56('0x12')](function(_0x575f1e){logger[_0x2f56('0x13')]('VoicePrefix,\x20%s,\x20%s',_0x5eeaa7,_0x2f56('0x14'));logger['debug'](_0x2f56('0x15'),_0x5eeaa7,_0x2f56('0x14'),JSON[_0x2f56('0x16')](_0x575f1e));if(_0x575f1e[_0x2f56('0x17')]){if(_0x575f1e[_0x2f56('0x17')][_0x2f56('0x18')]===0x1f4){logger[_0x2f56('0x17')](_0x2f56('0x19'),_0x5eeaa7,_0x575f1e['error'][_0x2f56('0x1a')]);return _0x52d3d2(_0x575f1e[_0x2f56('0x17')][_0x2f56('0x1a')]);}logger[_0x2f56('0x17')](_0x2f56('0x19'),_0x5eeaa7,_0x575f1e['error'][_0x2f56('0x1a')]);return _0x39572f(_0x575f1e[_0x2f56('0x17')][_0x2f56('0x1a')]);}else{logger[_0x2f56('0x13')](_0x2f56('0x19'),_0x5eeaa7,'request\x20sent');_0x39572f(_0x575f1e[_0x2f56('0x1b')][_0x2f56('0x1a')]);}})[_0x2f56('0x1c')](function(_0x4651d9){logger[_0x2f56('0x17')]('VoicePrefix,\x20%s,\x20%s',_0x5eeaa7,_0x4651d9);_0x52d3d2(_0x4651d9);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 7de509c..9492a6e 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 _0x222f=['./voicePrefix.events','save','remove','update','emit','register'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x222f,0x1a4));var _0xf222=function(_0x3e21f4,_0x43d310){_0x3e21f4=_0x3e21f4-0x0;var _0x40fc49=_0x222f[_0x3e21f4];return _0x40fc49;};'use strict';var VoicePrefixEvents=require(_0xf222('0x0'));var events=[_0xf222('0x1'),_0xf222('0x2'),_0xf222('0x3')];function createListener(_0x4d09ec,_0x4b4237){return function(_0x195de1){_0x4b4237[_0xf222('0x4')](_0x4d09ec,_0x195de1);};}function removeListener(_0x307791,_0x7b187d){return function(){VoicePrefixEvents['removeListener'](_0x307791,_0x7b187d);};}exports[_0xf222('0x5')]=function(_0x54a758){for(var _0x112e6d=0x0,_0x26f129=events['length'];_0x112e6d<_0x26f129;_0x112e6d++){var _0xf5a105=events[_0x112e6d];var _0x302d7a=createListener('voicePrefix:'+_0xf5a105,_0x54a758);VoicePrefixEvents['on'](_0xf5a105,_0x302d7a);}}; \ No newline at end of file +var _0xdb76=['remove','update','emit','register','length','voicePrefix:','./voicePrefix.events','save'];(function(_0x20d07e,_0x5010dd){var _0x21bfc5=function(_0x58cb97){while(--_0x58cb97){_0x20d07e['push'](_0x20d07e['shift']());}};_0x21bfc5(++_0x5010dd);}(_0xdb76,0x1be));var _0x6db7=function(_0xa59ca7,_0x584906){_0xa59ca7=_0xa59ca7-0x0;var _0x5029c4=_0xdb76[_0xa59ca7];return _0x5029c4;};'use strict';var VoicePrefixEvents=require(_0x6db7('0x0'));var events=[_0x6db7('0x1'),_0x6db7('0x2'),_0x6db7('0x3')];function createListener(_0x27d5fd,_0x4fee62){return function(_0x448591){_0x4fee62[_0x6db7('0x4')](_0x27d5fd,_0x448591);};}function removeListener(_0x3e17d8,_0x40f6ce){return function(){VoicePrefixEvents['removeListener'](_0x3e17d8,_0x40f6ce);};}exports[_0x6db7('0x5')]=function(_0x7bba2d){for(var _0x8a8fe2=0x0,_0x417e71=events[_0x6db7('0x6')];_0x8a8fe2<_0x417e71;_0x8a8fe2++){var _0x58f6e4=events[_0x8a8fe2];var _0x1c7f92=createListener(_0x6db7('0x7')+_0x58f6e4,_0x7bba2d);VoicePrefixEvents['on'](_0x58f6e4,_0x1c7f92);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 13c2e97..4daf6d0 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(_0xb1b616,_0x3b9023){var _0x1259b0=function(_0xb2e638){while(--_0xb2e638){_0xb1b616['push'](_0xb1b616['shift']());}};_0x1259b0(++_0x3b9023);}(_0xb10b,0x12a));var _0xbb10=function(_0x177dc7,_0x13501c){_0x177dc7=_0x177dc7-0x0;var _0x19b7dc=_0xb10b[_0x177dc7];return _0x19b7dc;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0x9')](_0xbb10('0xf'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['getHopperFinals']);router[_0xbb10('0x9')]('/:id/hopper_black',auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);router[_0xbb10('0x9')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x13')]);router['get'](_0xbb10('0x14'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x15')]);router[_0xbb10('0x9')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x17')]);router[_0xbb10('0x9')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller['getLists']);router[_0xbb10('0x9')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0x1c')]);router[_0xbb10('0x1b')](_0xbb10('0x1d'),auth[_0xbb10('0xb')](),controller['clone']);router[_0xbb10('0x1b')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);router[_0xbb10('0x1b')](_0xbb10('0x14'),auth['isAuthenticated'](),controller[_0xbb10('0x1f')]);router[_0xbb10('0x1b')]('/:id/lists',auth['isAuthenticated'](),controller[_0xbb10('0x20')]);router[_0xbb10('0x1b')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x21')]);router[_0xbb10('0x22')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x24')]);router[_0xbb10('0x25')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth[_0xbb10('0xb')](),controller[_0xbb10('0x26')]);router[_0xbb10('0x25')]('/:id/users',auth[_0xbb10('0xb')](),controller[_0xbb10('0x27')]);router[_0xbb10('0x25')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x28')]);router[_0xbb10('0x25')]('/:id/blacklists',auth[_0xbb10('0xb')](),controller[_0xbb10('0x29')]);module[_0xbb10('0x2a')]=router; \ No newline at end of file +var _0xa9e0=['addAgents','/:id/blacklists','addBlackLists','update','delete','destroy','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','/:id','getHoppers','/:id/hopper_histories','isAuthenticated','getHopperHistories','/:id/hopper_black','getHopperBlacks','/:id/teams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','getLists','post','create','/:id/clone','clone','addTeams'];(function(_0x15a6a1,_0x4d795b){var _0x574bee=function(_0x38b7ba){while(--_0x38b7ba){_0x15a6a1['push'](_0x15a6a1['shift']());}};_0x574bee(++_0x4d795b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa9e0[_0x2bf141];return _0x48277b;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/hopper_finals',auth['isAuthenticated'](),controller['getHopperFinals']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getTeams']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x8')]('/:id/blacklists',auth[_0x0a9e('0xd')](),controller['getBlackLists']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/users',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller['addLists']);router[_0x0a9e('0x18')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x22')]);router['delete']('/:id/teams',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router[_0x0a9e('0x21')](_0x0a9e('0x12'),auth['isAuthenticated'](),controller[_0x0a9e('0x24')]);router['delete'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x21')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x26')]);module[_0x0a9e('0x27')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index 4f3801d..e29f826 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 _0xdc8d=['#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','#Machine\x20Retry\x20(min:1,\x20max:999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','name','inbound','outbound','default','STRING','ringall','leastrecent','fewestcalls','random','rrmemory','linear','wrandom','rrordered','strategy','getDataValue','type','dialMethod','booked','roundrobin','progressive','power','INTEGER','yes','ENUM','once','TEXT','setDataValue','periodic_announce','join','joinempty','split','leavewhenempty','BOOLEAN','wrapuptime','Active/Disactive\x20Campaign','preview','predictive','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)','#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)','always','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words'];(function(_0x1b6daf,_0x25c63e){var _0x216a87=function(_0x2f2881){while(--_0x2f2881){_0x1b6daf['push'](_0x1b6daf['shift']());}};_0x216a87(++_0x25c63e);}(_0xdc8d,0xa9));var _0xddc8=function(_0x38bdac,_0x50563d){_0x38bdac=_0x38bdac-0x0;var _0xea8198=_0xdc8d[_0x38bdac];return _0xea8198;};'use strict';var Sequelize=require(_0xddc8('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xddc8('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0xddc8('0x2'),_0xddc8('0x3')),'allowNull':![],'defaultValue':_0xddc8('0x2')},'musiconhold':{'type':Sequelize['STRING'],'defaultValue':_0xddc8('0x4')},'announce':{'type':Sequelize[_0xddc8('0x5')],'defaultValue':''},'strategy':{'type':Sequelize['ENUM']('rr',_0xddc8('0x6'),_0xddc8('0x7'),_0xddc8('0x8'),_0xddc8('0x9'),_0xddc8('0xa'),_0xddc8('0xb'),_0xddc8('0xc'),_0xddc8('0xd')),'allowNull':![],'defaultValue':_0xddc8('0x6'),'set':function(_0x5ed171){this['setDataValue'](_0xddc8('0xe'),_0x5ed171?_0x5ed171:'rrmemory');},'get':function(){var _0x394b7b=this[_0xddc8('0xf')](_0xddc8('0x10'));var _0x102acf=this[_0xddc8('0xf')](_0xddc8('0x11'));var _0x3785a5=this[_0xddc8('0xf')](_0xddc8('0xe'));if(_0x394b7b===_0xddc8('0x2')){return _0x3785a5;}if(_0x102acf===_0xddc8('0x12')&&_0x3785a5===_0xddc8('0xa')||_0x102acf==='booked'&&_0x3785a5===_0xddc8('0x13')){return _0x3785a5;}if(_0x102acf===_0xddc8('0x14')||_0x102acf==='predictive'||_0x102acf===_0xddc8('0x15')){return _0x3785a5;}return null;}},'servicelevel':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'context':{'type':Sequelize['STRING'],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0xddc8('0x16')](0xb)},'timeout':{'type':Sequelize[_0xddc8('0x16')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0xddc8('0x16')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0xddc8('0x5')]},'weight':{'type':Sequelize[_0xddc8('0x16')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0xddc8('0x16')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0xddc8('0x17')},'autopause':{'type':Sequelize[_0xddc8('0x18')](_0xddc8('0x17'),'no','all'),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0xddc8('0x16')](0xb)},'autopausebusy':{'type':Sequelize[_0xddc8('0x18')](_0xddc8('0x17'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0xddc8('0x16')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0xddc8('0x18')](_0xddc8('0x17'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0xddc8('0x18')]('yes','no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0xddc8('0x18')](_0xddc8('0x17'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize['ENUM'](_0xddc8('0x17'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0xddc8('0x5')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0xddc8('0x5')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0xddc8('0x16')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0xddc8('0x16')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize['ENUM'](_0xddc8('0x17'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0xddc8('0x18')]('yes','no'),'defaultValue':_0xddc8('0x17')},'announce_holdtime':{'type':Sequelize['ENUM'](_0xddc8('0x17'),'no',_0xddc8('0x19')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0xddc8('0x5')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0xddc8('0x18')](_0xddc8('0x17'),'no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize[_0xddc8('0x18')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0xddc8('0x5')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0xddc8('0x5')]},'queue_youarenext':{'type':Sequelize[_0xddc8('0x5')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0xddc8('0x5')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0xddc8('0x5')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0xddc8('0x5')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0xddc8('0x5')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0xddc8('0x5')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0xddc8('0x5')]},'queue_quantity1':{'type':Sequelize['STRING']},'queue_quantity2':{'type':Sequelize[_0xddc8('0x5')]},'queue_periodic_announce':{'type':Sequelize[_0xddc8('0x5')]},'queue_less_than':{'type':Sequelize[_0xddc8('0x5')]},'periodic_announce':{'type':Sequelize[_0xddc8('0x1a')],'set':function(_0x3e3d6e){this[_0xddc8('0x1b')](_0xddc8('0x1c'),_0x3e3d6e?_0x3e3d6e[_0xddc8('0x1d')](','):[]);},'get':function(){return this[_0xddc8('0xf')](_0xddc8('0x1c'))?this[_0xddc8('0xf')](_0xddc8('0x1c'))['split'](','):[];}},'joinempty':{'type':Sequelize[_0xddc8('0x5')],'defaultValue':_0xddc8('0x17'),'set':function(_0x233c89){this[_0xddc8('0x1b')]('joinempty',_0x233c89?_0x233c89[_0xddc8('0x1d')](','):undefined);},'get':function(){return this[_0xddc8('0xf')](_0xddc8('0x1e'))?this[_0xddc8('0xf')](_0xddc8('0x1e'))[_0xddc8('0x1f')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0xddc8('0x5')],'defaultValue':'no','set':function(_0x529ee5){this[_0xddc8('0x1b')](_0xddc8('0x20'),_0x529ee5?_0x529ee5['join'](','):undefined);},'get':function(){return this['getDataValue']('leavewhenempty')?this[_0xddc8('0xf')](_0xddc8('0x20'))[_0xddc8('0x1f')](','):undefined;}},'reportholdtime':{'type':Sequelize['ENUM'](_0xddc8('0x17'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM'](_0xddc8('0x17'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0xddc8('0x16')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0xddc8('0x18')](_0xddc8('0x17'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0xddc8('0x5')]},'description':{'type':Sequelize[_0xddc8('0x5')]},'acw':{'type':Sequelize[_0xddc8('0x21')],'defaultValue':0x0,'set':function(_0x260039){this[_0xddc8('0x1b')]('acw',_0x260039);if(_0x260039){if(this['getDataValue']('wrapuptime')<0x2){this[_0xddc8('0x1b')](_0xddc8('0x22'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0xddc8('0x16')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xddc8('0x23')},'dialMethod':{'type':Sequelize[_0xddc8('0x18')](_0xddc8('0x24'),'progressive',_0xddc8('0x15'),_0xddc8('0x25'),'booked'),'defaultValue':'progressive','comment':_0xddc8('0x26')},'dialLimitChannel':{'type':Sequelize[_0xddc8('0x16')](0x4)[_0xddc8('0x27')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xddc8('0x28')},'dialLimitQueue':{'type':Sequelize[_0xddc8('0x16')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xddc8('0x29')},'dialPowerLevel':{'type':Sequelize[_0xddc8('0x2a')](0x2)[_0xddc8('0x27')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0xddc8('0x2b')},'dialPredictiveOptimization':{'type':Sequelize[_0xddc8('0x18')](_0xddc8('0x2c'),_0xddc8('0x2d')),'defaultValue':_0xddc8('0x2d'),'comment':_0xddc8('0x2e')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0xddc8('0x2a')](0x2)[_0xddc8('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0xddc8('0x2f')},'dialPredictiveInterval':{'type':Sequelize['INTEGER'](0x3)[_0xddc8('0x27')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0xddc8('0x30')},'dialOriginateCallerIdName':{'type':Sequelize[_0xddc8('0x5')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xddc8('0x5')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0xddc8('0x27')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueOptions':{'type':Sequelize[_0xddc8('0x5')],'defaultValue':'tTxX','comment':'https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue'},'dialQueueTimeout':{'type':Sequelize[_0xddc8('0x16')](0x3)[_0xddc8('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueProject':{'type':Sequelize['STRING'],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialCongestionMaxRetry':{'type':Sequelize[_0xddc8('0x16')](0x3)[_0xddc8('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xddc8('0x31')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xddc8('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0xddc8('0x16')](0x3)[_0xddc8('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xddc8('0x32')},'dialBusyRetryFrequency':{'type':Sequelize[_0xddc8('0x16')](0x5)[_0xddc8('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xddc8('0x33')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xddc8('0x27')],'defaultValue':0x3,'comment':_0xddc8('0x34')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xddc8('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0xddc8('0x16')](0x3)[_0xddc8('0x27')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0xddc8('0x5')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':'07:00-22:00,*,*,*'},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0xddc8('0x18')](_0xddc8('0x35'),'never','onlyIfOpen'),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0xddc8('0x21')],'defaultValue':0x0,'comment':_0xddc8('0x36')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xddc8('0x37')},'dialAMDGreeting':{'type':Sequelize[_0xddc8('0x16')](0x9)[_0xddc8('0x27')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xddc8('0x38')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xddc8('0x16')](0x9)[_0xddc8('0x27')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xddc8('0x39')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xddc8('0x16')](0x9)[_0xddc8('0x27')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0xddc8('0x16')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0xddc8('0x27')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xddc8('0x16')](0x9)[_0xddc8('0x27')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xddc8('0x3a')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0xddc8('0x27')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xddc8('0x3b')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xddc8('0x16')](0x9)[_0xddc8('0x27')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xddc8('0x3c')},'dialRecallMeTimeout':{'type':Sequelize['INTEGER'](0x5)[_0xddc8('0x27')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0xddc8('0x3d')},'dialRecallInQueue':{'type':Sequelize[_0xddc8('0x21')],'defaultValue':0x0,'comment':_0xddc8('0x3e')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0xddc8('0x3f'),_0xddc8('0x40')),'defaultValue':'DESC'},'dialQueueProject2':{'type':Sequelize[_0xddc8('0x5')],'comment':_0xddc8('0x41')},'dialAgiAfterHangupClient':{'type':Sequelize[_0xddc8('0x21')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0xddc8('0x21')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xddc8('0x16')](0x3)[_0xddc8('0x27')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xddc8('0x42')},'dialCutDigit':{'type':Sequelize[_0xddc8('0x16')](0x3)[_0xddc8('0x27')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xddc8('0x43')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xddc8('0x16')](0x3)[_0xddc8('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xddc8('0x16')](0x5)[_0xddc8('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xddc8('0x44')},'dialDropMaxRetry':{'type':Sequelize[_0xddc8('0x16')](0x3)[_0xddc8('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xddc8('0x45')},'dialDropRetryFrequency':{'type':Sequelize[_0xddc8('0x16')](0x5)[_0xddc8('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0xddc8('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xddc8('0x46')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xddc8('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0xddc8('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xddc8('0x47')},'dialMachineRetryFrequency':{'type':Sequelize[_0xddc8('0x16')](0x5)[_0xddc8('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xddc8('0x16')](0x3)[_0xddc8('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xddc8('0x48')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xddc8('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xddc8('0x49')},'mandatoryDispositionPauseId':{'type':Sequelize[_0xddc8('0x16')],'allowNull':!![],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x15fcd7){if(!_0x15fcd7)this['setDataValue'](_0xddc8('0x4a'),null);this['setDataValue'](_0xddc8('0x4b'),_0x15fcd7);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0xddc8('0x16')](0x3)[_0xddc8('0x27')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0xddc8('0x21')],'defaultValue':!![]},'dialPreviewRecallmeReminder':{'type':Sequelize[_0xddc8('0x21')],'defaultValue':![]}}; \ No newline at end of file +var _0xf161=['name','inbound','outbound','STRING','default','ENUM','leastrecent','random','rrmemory','linear','setDataValue','strategy','getDataValue','type','dialMethod','booked','roundrobin','progressive','predictive','INTEGER','yes','all','once','periodic_announce','join','split','joinempty','leavewhenempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','Dial\x20Method.','Max\x209999\x20channels,\x200\x20means\x20unlimited.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','dropRate','Only\x20for\x20predictive\x20method.','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#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,*,*,*','never','onlyIfOpen','always','#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\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','ASC','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)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports'];(function(_0x253ceb,_0x2acbb6){var _0x5acfb9=function(_0x46fbc5){while(--_0x46fbc5){_0x253ceb['push'](_0x253ceb['shift']());}};_0x5acfb9(++_0x2acbb6);}(_0xf161,0xa2));var _0x1f16=function(_0x1b4b23,_0x5dd6d6){_0x1b4b23=_0x1b4b23-0x0;var _0x2a325b=_0xf161[_0x1b4b23];return _0x2a325b;};'use strict';var Sequelize=require(_0x1f16('0x0'));module[_0x1f16('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x1f16('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x1f16('0x3'),_0x1f16('0x4')),'allowNull':![],'defaultValue':'inbound'},'musiconhold':{'type':Sequelize[_0x1f16('0x5')],'defaultValue':_0x1f16('0x6')},'announce':{'type':Sequelize['STRING'],'defaultValue':''},'strategy':{'type':Sequelize[_0x1f16('0x7')]('rr','ringall',_0x1f16('0x8'),'fewestcalls',_0x1f16('0x9'),_0x1f16('0xa'),_0x1f16('0xb'),'wrandom','rrordered'),'allowNull':![],'defaultValue':'ringall','set':function(_0x4e82f5){this[_0x1f16('0xc')](_0x1f16('0xd'),_0x4e82f5?_0x4e82f5:'rrmemory');},'get':function(){var _0x512ef2=this[_0x1f16('0xe')](_0x1f16('0xf'));var _0x49b284=this[_0x1f16('0xe')](_0x1f16('0x10'));var _0x436620=this[_0x1f16('0xe')]('strategy');if(_0x512ef2===_0x1f16('0x3')){return _0x436620;}if(_0x49b284===_0x1f16('0x11')&&_0x436620===_0x1f16('0xa')||_0x49b284==='booked'&&_0x436620===_0x1f16('0x12')){return _0x436620;}if(_0x49b284===_0x1f16('0x13')||_0x49b284===_0x1f16('0x14')||_0x49b284==='power'){return _0x436620;}return null;}},'servicelevel':{'type':Sequelize[_0x1f16('0x15')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x1f16('0x5')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x1f16('0x15')](0xb)},'timeout':{'type':Sequelize[_0x1f16('0x15')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x1f16('0x15')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x1f16('0x5')]},'weight':{'type':Sequelize[_0x1f16('0x15')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x1f16('0x15')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x1f16('0x7')](_0x1f16('0x16'),'no'),'defaultValue':'yes'},'autopause':{'type':Sequelize['ENUM'](_0x1f16('0x16'),'no',_0x1f16('0x17')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize['INTEGER'](0xb)},'autopausebusy':{'type':Sequelize[_0x1f16('0x7')](_0x1f16('0x16'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x1f16('0x7')](_0x1f16('0x16'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x1f16('0x15')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x1f16('0x7')](_0x1f16('0x16'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x1f16('0x7')](_0x1f16('0x16'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM'](_0x1f16('0x16'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x1f16('0x7')](_0x1f16('0x16'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x1f16('0x5')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x1f16('0x5')],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x1f16('0x15')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x1f16('0x15')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x1f16('0x7')](_0x1f16('0x16'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x1f16('0x7')](_0x1f16('0x16'),'no'),'defaultValue':_0x1f16('0x16')},'announce_holdtime':{'type':Sequelize[_0x1f16('0x7')]('yes','no',_0x1f16('0x18')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x1f16('0x5')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize['ENUM'](_0x1f16('0x16'),'no')},'announce_position_limit':{'type':Sequelize[_0x1f16('0x15')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x1f16('0x7')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x1f16('0x5')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x1f16('0x5')]},'queue_youarenext':{'type':Sequelize[_0x1f16('0x5')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x1f16('0x5')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x1f16('0x5')],'defaultValue':null},'queue_holdtime':{'type':Sequelize['STRING'],'defaultValue':null},'queue_minute':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x1f16('0x5')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x1f16('0x5')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x1f16('0x5')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x1f16('0x5')]},'queue_quantity1':{'type':Sequelize[_0x1f16('0x5')]},'queue_quantity2':{'type':Sequelize[_0x1f16('0x5')]},'queue_periodic_announce':{'type':Sequelize['STRING']},'queue_less_than':{'type':Sequelize['STRING']},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0x535d0e){this[_0x1f16('0xc')](_0x1f16('0x19'),_0x535d0e?_0x535d0e[_0x1f16('0x1a')](','):[]);},'get':function(){return this[_0x1f16('0xe')](_0x1f16('0x19'))?this[_0x1f16('0xe')]('periodic_announce')[_0x1f16('0x1b')](','):[];}},'joinempty':{'type':Sequelize[_0x1f16('0x5')],'defaultValue':_0x1f16('0x16'),'set':function(_0x3d8c34){this[_0x1f16('0xc')](_0x1f16('0x1c'),_0x3d8c34?_0x3d8c34[_0x1f16('0x1a')](','):undefined);},'get':function(){return this[_0x1f16('0xe')](_0x1f16('0x1c'))?this[_0x1f16('0xe')](_0x1f16('0x1c'))[_0x1f16('0x1b')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x1f16('0x5')],'defaultValue':'no','set':function(_0x3f983f){this[_0x1f16('0xc')](_0x1f16('0x1d'),_0x3f983f?_0x3f983f[_0x1f16('0x1a')](','):undefined);},'get':function(){return this[_0x1f16('0xe')]('leavewhenempty')?this[_0x1f16('0xe')]('leavewhenempty')['split'](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x1f16('0x7')](_0x1f16('0x16'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x1f16('0x7')]('yes','no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x1f16('0x7')](_0x1f16('0x16'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x1f16('0x5')]},'acw':{'type':Sequelize[_0x1f16('0x1e')],'defaultValue':0x0,'set':function(_0xe9e658){this['setDataValue'](_0x1f16('0x1f'),_0xe9e658);if(_0xe9e658){if(this['getDataValue'](_0x1f16('0x20'))<0x2){this[_0x1f16('0xc')](_0x1f16('0x20'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x1f16('0x15')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x1f16('0x1e')],'defaultValue':0x0,'comment':_0x1f16('0x21')},'dialMethod':{'type':Sequelize[_0x1f16('0x7')]('preview',_0x1f16('0x13'),'power',_0x1f16('0x14'),'booked'),'defaultValue':_0x1f16('0x13'),'comment':_0x1f16('0x22')},'dialLimitChannel':{'type':Sequelize[_0x1f16('0x15')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x1f16('0x23')},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)[_0x1f16('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x1f16('0x25')},'dialPowerLevel':{'type':Sequelize[_0x1f16('0x26')](0x2)[_0x1f16('0x24')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x1f16('0x27')},'dialPredictiveOptimization':{'type':Sequelize['ENUM']('agentBusyFactor',_0x1f16('0x28')),'defaultValue':'dropRate','comment':_0x1f16('0x29')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x1f16('0x26')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':'Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)'},'dialPredictiveInterval':{'type':Sequelize[_0x1f16('0x15')](0x3)[_0x1f16('0x24')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x1f16('0x2a')},'dialOriginateCallerIdName':{'type':Sequelize[_0x1f16('0x5')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x1f16('0x5')]},'dialOriginateTimeout':{'type':Sequelize[_0x1f16('0x15')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1f16('0x2b')},'dialQueueOptions':{'type':Sequelize['STRING'],'defaultValue':_0x1f16('0x2c'),'comment':'https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue'},'dialQueueTimeout':{'type':Sequelize[_0x1f16('0x15')](0x3)[_0x1f16('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1f16('0x2d')},'dialQueueProject':{'type':Sequelize[_0x1f16('0x5')],'comment':_0x1f16('0x2e')},'dialCongestionMaxRetry':{'type':Sequelize[_0x1f16('0x15')](0x3)[_0x1f16('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1f16('0x2f')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x1f16('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1f16('0x30')},'dialBusyRetryFrequency':{'type':Sequelize[_0x1f16('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1f16('0x31')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x1f16('0x24')],'defaultValue':0x3,'comment':_0x1f16('0x32')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x1f16('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1f16('0x33')},'dialGlobalMaxRetry':{'type':Sequelize[_0x1f16('0x15')](0x3)[_0x1f16('0x24')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x1f16('0x34')},'dialTimezone':{'type':Sequelize[_0x1f16('0x5')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0x1f16('0x35')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x1f16('0x7')]('always',_0x1f16('0x36'),_0x1f16('0x37')),'defaultValue':_0x1f16('0x38')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x1f16('0x15')](0x9)[_0x1f16('0x24')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x1f16('0x39')},'dialAMDGreeting':{'type':Sequelize[_0x1f16('0x15')](0x9)[_0x1f16('0x24')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x1f16('0x15')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x1f16('0x3a')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0x1f16('0x24')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x1f16('0x3b')},'dialAMDMinWordLength':{'type':Sequelize[_0x1f16('0x15')](0x9)[_0x1f16('0x24')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x1f16('0x3c')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0x1f16('0x24')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x1f16('0x3d')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x1f16('0x15')](0x9)[_0x1f16('0x24')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x1f16('0x3e')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0x1f16('0x15')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x1f16('0x3f')},'dialRecallMeTimeout':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x1f16('0x40')},'dialRecallInQueue':{'type':Sequelize[_0x1f16('0x1e')],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize[_0x1f16('0x7')]('DESC',_0x1f16('0x41')),'defaultValue':_0x1f16('0x42')},'dialQueueProject2':{'type':Sequelize[_0x1f16('0x5')],'comment':_0x1f16('0x2e')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x1f16('0x1e')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x1f16('0x1e')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x1f16('0x15')](0x3)[_0x1f16('0x24')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x1f16('0x43')},'dialCutDigit':{'type':Sequelize[_0x1f16('0x15')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x1f16('0x44')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x1f16('0x15')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1f16('0x45')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x1f16('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1f16('0x46')},'dialDropMaxRetry':{'type':Sequelize[_0x1f16('0x15')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1f16('0x47')},'dialDropRetryFrequency':{'type':Sequelize[_0x1f16('0x15')](0x5)[_0x1f16('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1f16('0x48')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x1f16('0x15')](0x3)[_0x1f16('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1f16('0x49')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x1f16('0x15')](0x5)[_0x1f16('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1f16('0x4a')},'dialMachineMaxRetry':{'type':Sequelize[_0x1f16('0x15')](0x3)[_0x1f16('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1f16('0x4b')},'dialMachineRetryFrequency':{'type':Sequelize[_0x1f16('0x15')](0x5)[_0x1f16('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1f16('0x4c')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x1f16('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1f16('0x4d')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x1f16('0x15')](0x5)[_0x1f16('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1f16('0x4e')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x1f16('0x15')],'allowNull':!![],'comment':_0x1f16('0x4f')},'mandatoryDisposition':{'type':Sequelize[_0x1f16('0x1e')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x57f461){if(!_0x57f461)this[_0x1f16('0xc')](_0x1f16('0x50'),null);this['setDataValue'](_0x1f16('0x51'),_0x57f461);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x1f16('0x15')](0x3)[_0x1f16('0x24')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x1f16('0x24')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x1f16('0x1e')],'defaultValue':!![]},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x1f16('0x1e')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index fbd9b12..9d3d997 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 _0x327e=['CmHopper','getHopperHistories','CmHopperHistory','VoiceQueueId','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','teams','online','interface','Agents','forEach','penalty','sequelize','transaction','each','TeamVoiceQueue','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','voicePause','emit','userVoiceQueue:save','ids','User','select','field','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','union','compact','removeTeams','removeAgents','userVoiceQueue:remove','addAgents','spread','isEmpty','all','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','always','insert','into','fromQuery','phone','scheduledAt','ContactId','ListId','updatedAt','NOW()','CmListId','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','VoiceQueueId\x20=\x20?','COALESCE(phone,\x27\x27)','cm_hopper','onlyIfOpen','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./voiceQueue.socket','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','destroy','then','get','VoiceQueues','QueueCampaigns','outbound','filter','ignore','map','value','includes','type','find','name','UserProfileResource','end','error','stack','index','VoiceQueue','rawAttributes','fieldName','key','model','query','keys','attributes','intersection','fields','nolimit','order','sort','filters','pick','where','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','length','options','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','inbound','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','update','getHoppers','findOne','hasOwnProperty'];(function(_0x4f09c2,_0x476952){var _0x30be0d=function(_0x21fb05){while(--_0x21fb05){_0x4f09c2['push'](_0x4f09c2['shift']());}};_0x30be0d(++_0x476952);}(_0x327e,0x113));var _0xe327=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x327e[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0xe327('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe327('0x1'));var jsonpatch=require(_0xe327('0x2'));var rp=require(_0xe327('0x3'));var moment=require('moment');var BPromise=require(_0xe327('0x4'));var Mustache=require(_0xe327('0x5'));var util=require('util');var path=require(_0xe327('0x6'));var sox=require('sox');var csv=require(_0xe327('0x7'));var ejs=require(_0xe327('0x8'));var fs=require('fs');var fs_extra=require(_0xe327('0x9'));var _=require(_0xe327('0xa'));var squel=require('squel');var crypto=require(_0xe327('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xe327('0xc'));var toCsv=require(_0xe327('0x7'));var querystring=require('querystring');var Papa=require(_0xe327('0xd'));var Redis=require(_0xe327('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xe327('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe327('0x10'));var logger=require(_0xe327('0x11'))('api');var utils=require('../../config/utils');var config=require(_0xe327('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xe327('0x13'))['db'];config[_0xe327('0x14')]=_['defaults'](config['redis'],{'host':_0xe327('0x15'),'port':0x18eb});var socket=require(_0xe327('0x16'))(new Redis(config['redis']));require(_0xe327('0x17'))['register'](socket);function respondWithStatusCode(_0x3f4992,_0x345ec9){_0x345ec9=_0x345ec9||0xcc;return function(_0x56ad72){if(_0x56ad72){return _0x3f4992[_0xe327('0x18')](_0x345ec9);}return _0x3f4992[_0xe327('0x19')](_0x345ec9)['end']();};}function respondWithResult(_0x3493e9,_0x3861a7){_0x3861a7=_0x3861a7||0xc8;return function(_0x2ee09c){if(_0x2ee09c){return _0x3493e9[_0xe327('0x19')](_0x3861a7)[_0xe327('0x1a')](_0x2ee09c);}};}function respondWithFilteredResult(_0x4935aa,_0x5573df){return function(_0xab2812){if(_0xab2812){var _0x347ff6=typeof _0x5573df[_0xe327('0x1b')]==='undefined'&&typeof _0x5573df[_0xe327('0x1c')]===_0xe327('0x1d');var _0x5de3a2=_0xab2812[_0xe327('0x1e')];var _0x252e46=_0x347ff6?0x0:_0x5573df['offset'];var _0x2fbcdb=_0x347ff6?_0xab2812['count']:_0x5573df[_0xe327('0x1b')]+_0x5573df[_0xe327('0x1c')];var _0x1a7276;if(_0x2fbcdb>=_0x5de3a2){_0x2fbcdb=_0x5de3a2;_0x1a7276=0xc8;}else{_0x1a7276=0xce;}_0x4935aa['status'](_0x1a7276);return _0x4935aa[_0xe327('0x1f')](_0xe327('0x20'),_0x252e46+'-'+_0x2fbcdb+'/'+_0x5de3a2)[_0xe327('0x1a')](_0xab2812);}return null;};}function patchUpdates(_0x12e3a0){return function(_0x2b2cab){try{jsonpatch[_0xe327('0x21')](_0x2b2cab,_0x12e3a0,!![]);}catch(_0x1b3fb8){return BPromise[_0xe327('0x22')](_0x1b3fb8);}return _0x2b2cab[_0xe327('0x23')]();};}function saveUpdates(_0x42e7e7,_0x3da3b1){return function(_0x9472d3){if(_0x9472d3){return _0x9472d3['update'](_0x42e7e7)['then'](function(_0x488226){return _0x488226;});}return null;};}function removeEntity(_0x574dc4,_0x59db53){return function(_0x21f42f){if(_0x21f42f){return _0x21f42f[_0xe327('0x24')]()[_0xe327('0x25')](function(){var _0x1b1814=_0x21f42f[_0xe327('0x26')]({'plain':!![]});var _0x5b2b60=[{'name':_0xe327('0x27'),'value':'inbound','ignore':![]},{'name':_0xe327('0x28'),'value':_0xe327('0x29'),'ignore':![]}];var _0x40553c=_(_0x5b2b60)[_0xe327('0x2a')](_0xe327('0x2b'))[_0xe327('0x2c')](_0xe327('0x2d'))[_0xe327('0x2d')]();if(_[_0xe327('0x2e')](_0x40553c,_0x1b1814[_0xe327('0x2f')])){return;}var _0x1d9610=_[_0xe327('0x30')](_0x5b2b60,['value',_0x1b1814[_0xe327('0x2f')]])[_0xe327('0x31')];return db[_0xe327('0x32')][_0xe327('0x24')]({'where':{'type':_0x1d9610,'resourceId':_0x1b1814['id']}})['then'](function(){return _0x21f42f;});})['then'](function(){_0x574dc4[_0xe327('0x19')](0xcc)[_0xe327('0x33')]();});}};}function handleEntityNotFound(_0x3bbed5,_0x3a7326){return function(_0x148930){if(!_0x148930){_0x3bbed5[_0xe327('0x18')](0x194);}return _0x148930;};}function handleError(_0x3e43f8,_0x47c0bd){_0x47c0bd=_0x47c0bd||0x1f4;return function(_0x4c309b){logger[_0xe327('0x34')](_0x4c309b[_0xe327('0x35')]);if(_0x4c309b[_0xe327('0x31')]){delete _0x4c309b['name'];}_0x3e43f8['status'](_0x47c0bd)['send'](_0x4c309b);};}exports[_0xe327('0x36')]=function(_0x44e4bb,_0x432455){var _0x58115f={},_0x5191f9={},_0x2a7fe6={'count':0x0,'rows':[]};var _0x216e96=_['map'](db[_0xe327('0x37')][_0xe327('0x38')],function(_0x503b78){return{'name':_0x503b78[_0xe327('0x39')],'type':_0x503b78[_0xe327('0x2f')][_0xe327('0x3a')]};});_0x5191f9[_0xe327('0x3b')]=_[_0xe327('0x2c')](_0x216e96,_0xe327('0x31'));_0x5191f9[_0xe327('0x3c')]=_[_0xe327('0x3d')](_0x44e4bb[_0xe327('0x3c')]);_0x5191f9['filters']=_['intersection'](_0x5191f9[_0xe327('0x3b')],_0x5191f9[_0xe327('0x3c')]);_0x58115f[_0xe327('0x3e')]=_[_0xe327('0x3f')](_0x5191f9[_0xe327('0x3b')],qs[_0xe327('0x40')](_0x44e4bb[_0xe327('0x3c')][_0xe327('0x40')]));_0x58115f[_0xe327('0x3e')]=_0x58115f['attributes']['length']?_0x58115f[_0xe327('0x3e')]:_0x5191f9[_0xe327('0x3b')];if(!_0x44e4bb['query']['hasOwnProperty'](_0xe327('0x41'))){_0x58115f[_0xe327('0x1c')]=qs['limit'](_0x44e4bb[_0xe327('0x3c')][_0xe327('0x1c')]);_0x58115f['offset']=qs[_0xe327('0x1b')](_0x44e4bb[_0xe327('0x3c')][_0xe327('0x1b')]);}_0x58115f[_0xe327('0x42')]=qs[_0xe327('0x43')](_0x44e4bb['query']['sort']);_0x58115f['where']=qs[_0xe327('0x44')](_[_0xe327('0x45')](_0x44e4bb[_0xe327('0x3c')],_0x5191f9[_0xe327('0x44')]),_0x216e96);if(_0x44e4bb[_0xe327('0x3c')][_0xe327('0x2a')]){_0x58115f[_0xe327('0x46')]=_[_0xe327('0x47')](_0x58115f[_0xe327('0x46')],{'$or':_[_0xe327('0x2c')](_0x216e96,function(_0x13010e){if(_0x13010e[_0xe327('0x2f')]!==_0xe327('0x48')){var _0x4777ef={};_0x4777ef[_0x13010e[_0xe327('0x31')]]={'$like':'%'+_0x44e4bb[_0xe327('0x3c')]['filter']+'%'};return _0x4777ef;}})});}_0x58115f=_[_0xe327('0x47')]({},_0x58115f,_0x44e4bb['options']);var _0x3ca252={'where':_0x58115f['where']};return db[_0xe327('0x37')][_0xe327('0x1e')](_0x3ca252)[_0xe327('0x25')](function(_0x3ac672){_0x2a7fe6[_0xe327('0x1e')]=_0x3ac672;if(_0x44e4bb[_0xe327('0x3c')][_0xe327('0x49')]){_0x58115f[_0xe327('0x4a')]=[{'all':!![]}];}return db['VoiceQueue'][_0xe327('0x4b')](_0x58115f);})['then'](function(_0x9611c3){_0x2a7fe6[_0xe327('0x4c')]=_0x9611c3;return _0x2a7fe6;})[_0xe327('0x25')](respondWithFilteredResult(_0x432455,_0x58115f))['catch'](handleError(_0x432455,null));};exports[_0xe327('0x4d')]=function(_0x828d8b,_0x323d03){var _0x3eea1e={'raw':![],'where':{'id':_0x828d8b[_0xe327('0x4e')]['id']}},_0x712e32={};_0x712e32[_0xe327('0x3b')]=_[_0xe327('0x3d')](db[_0xe327('0x37')]['rawAttributes']);_0x712e32['query']=_[_0xe327('0x3d')](_0x828d8b['query']);_0x712e32['filters']=_[_0xe327('0x3f')](_0x712e32[_0xe327('0x3b')],_0x712e32[_0xe327('0x3c')]);_0x3eea1e[_0xe327('0x3e')]=_[_0xe327('0x3f')](_0x712e32[_0xe327('0x3b')],qs[_0xe327('0x40')](_0x828d8b[_0xe327('0x3c')]['fields']));_0x3eea1e[_0xe327('0x3e')]=_0x3eea1e[_0xe327('0x3e')][_0xe327('0x4f')]?_0x3eea1e[_0xe327('0x3e')]:_0x712e32[_0xe327('0x3b')];if(_0x828d8b[_0xe327('0x3c')][_0xe327('0x49')]){_0x3eea1e[_0xe327('0x4a')]=[{'all':!![]}];}_0x3eea1e=_[_0xe327('0x47')]({},_0x3eea1e,_0x828d8b[_0xe327('0x50')]);return db[_0xe327('0x37')]['find'](_0x3eea1e)[_0xe327('0x25')](handleEntityNotFound(_0x323d03,null))[_0xe327('0x25')](respondWithResult(_0x323d03,null))[_0xe327('0x51')](handleError(_0x323d03,null));};exports['create']=function(_0x58e09a,_0x4b40d7){return db[_0xe327('0x37')][_0xe327('0x52')](_0x58e09a[_0xe327('0x53')],{})[_0xe327('0x25')](function(_0x481fe7){var _0xa31b45=_0x58e09a['user']['get']({'plain':!![]});if(!_0xa31b45)throw new Error(_0xe327('0x54'));if(_0xa31b45[_0xe327('0x55')]===_0xe327('0x56')){var _0x598c2b=_0x481fe7[_0xe327('0x26')]({'plain':!![]});var _0x28f240=[{'name':_0xe327('0x27'),'value':_0xe327('0x57')},{'name':_0xe327('0x28'),'value':_0xe327('0x29')}];var _0x33cfb6=_[_0xe327('0x30')](_0x28f240,[_0xe327('0x2d'),_0x598c2b[_0xe327('0x2f')]])[_0xe327('0x31')];return db[_0xe327('0x58')]['find']({'where':{'name':_0x33cfb6,'userProfileId':_0xa31b45[_0xe327('0x59')]},'raw':!![]})[_0xe327('0x25')](function(_0x2ac7bb){if(_0x2ac7bb&&_0x2ac7bb[_0xe327('0x5a')]===0x0){return db['UserProfileResource']['create']({'name':_0x598c2b['name'],'resourceId':_0x598c2b['id'],'type':_0x2ac7bb[_0xe327('0x31')],'sectionId':_0x2ac7bb['id']},{})[_0xe327('0x25')](function(){return _0x481fe7;});}else{return _0x481fe7;}})[_0xe327('0x51')](function(_0x316185){logger[_0xe327('0x34')](_0xe327('0x5b'),_0x316185);throw _0x316185;});}return _0x481fe7;})['then'](respondWithResult(_0x4b40d7,0xc9))['catch'](handleError(_0x4b40d7,null));};exports[_0xe327('0x5c')]=function(_0x1b1eb4,_0x35e5b4){var _0x4d412f={'where':{'id':_0x1b1eb4['params']['id']}},_0x52648c={};_0x52648c[_0xe327('0x3b')]=_[_0xe327('0x3d')](db[_0xe327('0x37')]['rawAttributes']);_0x4d412f[_0xe327('0x3e')]=_[_0xe327('0x3f')](_0x52648c[_0xe327('0x3b')],qs[_0xe327('0x40')](_0x1b1eb4[_0xe327('0x3c')]['fields']));_0x4d412f[_0xe327('0x3e')]=_0x4d412f[_0xe327('0x3e')][_0xe327('0x4f')]?_0x4d412f[_0xe327('0x3e')]:_0x52648c['model'];if(_0x1b1eb4[_0xe327('0x3c')][_0xe327('0x49')]){_0x4d412f[_0xe327('0x4a')]=[{'all':!![]}];}_0x4d412f=_['merge']({},_0x4d412f,_0x1b1eb4['options']);return db['VoiceQueue'][_0xe327('0x30')](_0x4d412f)[_0xe327('0x25')](handleEntityNotFound(_0x35e5b4,null))['then'](function(_0x44d623){if(_0x44d623){var _0x37e7c7=_0x44d623[_0xe327('0x26')]({'plain':!![]});_0x37e7c7=qs[_0xe327('0x5d')](_0x37e7c7,['id',_0xe327('0x5e'),'updatedAt']);_0x1b1eb4[_0xe327('0x53')]=_[_0xe327('0x5d')](_0x1b1eb4[_0xe327('0x53')],['id','createdAt','updatedAt']);return db['VoiceQueue'][_0xe327('0x52')](_[_0xe327('0x47')](_0x37e7c7,_0x1b1eb4[_0xe327('0x53')]),{'include':_0x1b1eb4[_0xe327('0x3c')]['includeAll']?[{'all':!![]}]:undefined})[_0xe327('0x25')](function(_0x57b85f){var _0x56b660=_0x1b1eb4[_0xe327('0x56')]['get']({'plain':!![]});if(!_0x56b660)throw new Error(_0xe327('0x54'));if(_0x56b660['role']===_0xe327('0x56')){var _0x54ee88=_0x57b85f[_0xe327('0x26')]({'plain':!![]});var _0x1444c8=[{'name':'VoiceQueues','value':_0xe327('0x57')},{'name':_0xe327('0x28'),'value':'outbound'}];var _0x48afd7=_[_0xe327('0x30')](_0x1444c8,[_0xe327('0x2d'),_0x54ee88[_0xe327('0x2f')]])[_0xe327('0x31')];return db[_0xe327('0x58')][_0xe327('0x30')]({'where':{'name':_0x48afd7,'userProfileId':_0x56b660['userProfileId']},'raw':!![]})[_0xe327('0x25')](function(_0x179f52){if(_0x179f52&&_0x179f52['autoAssociation']===0x0){return db[_0xe327('0x32')][_0xe327('0x52')]({'name':_0x54ee88[_0xe327('0x31')],'resourceId':_0x54ee88['id'],'type':_0x179f52[_0xe327('0x31')],'sectionId':_0x179f52['id']},{})['then'](function(){return _0x57b85f;});}else{return _0x57b85f;}})[_0xe327('0x51')](function(_0x50dedd){logger['error'](_0xe327('0x5b'),_0x50dedd);throw _0x50dedd;});}return _0x57b85f;});}})[_0xe327('0x25')](respondWithResult(_0x35e5b4,0xc9))[_0xe327('0x51')](handleError(_0x35e5b4,null));};exports[_0xe327('0x5f')]=function(_0x3eaaa9,_0x40b806){if(_0x3eaaa9[_0xe327('0x53')]['id']){delete _0x3eaaa9[_0xe327('0x53')]['id'];}return db[_0xe327('0x37')][_0xe327('0x30')]({'where':{'id':_0x3eaaa9[_0xe327('0x4e')]['id']}})[_0xe327('0x25')](handleEntityNotFound(_0x40b806,null))[_0xe327('0x25')](saveUpdates(_0x3eaaa9[_0xe327('0x53')],null))[_0xe327('0x25')](respondWithResult(_0x40b806,null))['catch'](handleError(_0x40b806,null));};exports[_0xe327('0x24')]=function(_0x44f347,_0x2b16e6){return db[_0xe327('0x37')][_0xe327('0x30')]({'where':{'id':_0x44f347[_0xe327('0x4e')]['id']}})['then'](handleEntityNotFound(_0x2b16e6,null))['then'](removeEntity(_0x2b16e6,null))[_0xe327('0x51')](handleError(_0x2b16e6,null));};exports[_0xe327('0x60')]=function(_0x2fcef4,_0x55c446,_0x3dad20){var _0x435762={'raw':![],'where':{}};var _0x5dcb66={};var _0x41233f={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xe327('0x61')]({'where':{'id':_0x2fcef4['params']['id']}})['then'](handleEntityNotFound(_0x55c446,null))[_0xe327('0x25')](function(_0x5cc50b){if(_0x5cc50b){_0x5dcb66['model']=_[_0xe327('0x3d')](db['CmHopper'][_0xe327('0x38')]);_0x5dcb66[_0xe327('0x3c')]=_[_0xe327('0x3d')](_0x2fcef4[_0xe327('0x3c')]);_0x5dcb66[_0xe327('0x44')]=_['intersection'](_0x5dcb66[_0xe327('0x3b')],_0x5dcb66[_0xe327('0x3c')]);_0x435762[_0xe327('0x3e')]=_['intersection'](_0x5dcb66[_0xe327('0x3b')],qs[_0xe327('0x40')](_0x2fcef4[_0xe327('0x3c')][_0xe327('0x40')]));_0x435762[_0xe327('0x3e')]=_0x435762[_0xe327('0x3e')][_0xe327('0x4f')]?_0x435762[_0xe327('0x3e')]:_0x5dcb66['model'];if(!_0x2fcef4['query'][_0xe327('0x62')](_0xe327('0x41'))){_0x435762[_0xe327('0x1c')]=qs['limit'](_0x2fcef4[_0xe327('0x3c')][_0xe327('0x1c')]);_0x435762[_0xe327('0x1b')]=qs[_0xe327('0x1b')](_0x2fcef4[_0xe327('0x3c')]['offset']);}_0x435762['order']=qs['sort'](_0x2fcef4['query'][_0xe327('0x43')]);_0x435762['where']=qs[_0xe327('0x44')](_[_0xe327('0x45')](_0x2fcef4[_0xe327('0x3c')],_0x5dcb66[_0xe327('0x44')]));_0x435762[_0xe327('0x46')]['VoiceQueueId']=_0x5cc50b['id'];if(_0x2fcef4[_0xe327('0x3c')][_0xe327('0x2a')]){_0x435762[_0xe327('0x46')]=_[_0xe327('0x47')](_0x435762['where'],{'$or':_[_0xe327('0x2c')](_0x435762[_0xe327('0x3e')],function(_0x12d492){var _0x350c06={};_0x350c06[_0x12d492]={'$like':'%'+_0x2fcef4[_0xe327('0x3c')][_0xe327('0x2a')]+'%'};return _0x350c06;})});}_0x435762=_[_0xe327('0x47')]({},_0x435762,_0x2fcef4[_0xe327('0x50')]);return db[_0xe327('0x63')][_0xe327('0x1e')]({'where':_0x435762[_0xe327('0x46')]})[_0xe327('0x25')](function(_0x45e1e8){_0x41233f[_0xe327('0x1e')]=_0x45e1e8;if(_0x2fcef4[_0xe327('0x3c')][_0xe327('0x49')]){_0x435762['include']=[{'all':!![]}];}return db[_0xe327('0x63')][_0xe327('0x4b')](_0x435762);})[_0xe327('0x25')](function(_0x539043){_0x41233f['rows']=_0x539043;return _0x41233f;});}})[_0xe327('0x25')](respondWithFilteredResult(_0x55c446,_0x435762))['catch'](handleError(_0x55c446,null));};exports[_0xe327('0x64')]=function(_0x2b4444,_0x18f45c,_0x343df5){var _0x8e33e3={'raw':!![],'where':{}};var _0x69d340={};var _0x10014f={'count':0x0,'rows':[]};return db[_0xe327('0x37')][_0xe327('0x61')]({'where':{'id':_0x2b4444[_0xe327('0x4e')]['id']}})[_0xe327('0x25')](handleEntityNotFound(_0x18f45c,null))[_0xe327('0x25')](function(_0x390eff){if(_0x390eff){_0x69d340[_0xe327('0x3b')]=_['keys'](db[_0xe327('0x65')]['rawAttributes']);_0x69d340[_0xe327('0x3c')]=_['keys'](_0x2b4444['query']);_0x69d340[_0xe327('0x44')]=_[_0xe327('0x3f')](_0x69d340[_0xe327('0x3b')],_0x69d340[_0xe327('0x3c')]);_0x8e33e3[_0xe327('0x3e')]=_['intersection'](_0x69d340[_0xe327('0x3b')],qs[_0xe327('0x40')](_0x2b4444['query']['fields']));_0x8e33e3[_0xe327('0x3e')]=_0x8e33e3[_0xe327('0x3e')]['length']?_0x8e33e3[_0xe327('0x3e')]:_0x69d340['model'];if(!_0x2b4444[_0xe327('0x3c')]['hasOwnProperty']('nolimit')){_0x8e33e3[_0xe327('0x1c')]=qs[_0xe327('0x1c')](_0x2b4444[_0xe327('0x3c')][_0xe327('0x1c')]);_0x8e33e3[_0xe327('0x1b')]=qs[_0xe327('0x1b')](_0x2b4444['query'][_0xe327('0x1b')]);}_0x8e33e3[_0xe327('0x42')]=qs[_0xe327('0x43')](_0x2b4444[_0xe327('0x3c')][_0xe327('0x43')]);_0x8e33e3[_0xe327('0x46')]=qs[_0xe327('0x44')](_['pick'](_0x2b4444['query'],_0x69d340[_0xe327('0x44')]));_0x8e33e3['where'][_0xe327('0x66')]=_0x390eff['id'];if(_0x2b4444[_0xe327('0x3c')][_0xe327('0x2a')]){_0x8e33e3['where']=_['merge'](_0x8e33e3['where'],{'$or':_[_0xe327('0x2c')](_0x8e33e3[_0xe327('0x3e')],function(_0x33e967){var _0x253f4f={};_0x253f4f[_0x33e967]={'$like':'%'+_0x2b4444['query'][_0xe327('0x2a')]+'%'};return _0x253f4f;})});}_0x8e33e3=_[_0xe327('0x47')]({},_0x8e33e3,_0x2b4444['options']);return db['CmHopperHistory'][_0xe327('0x1e')]({'where':_0x8e33e3[_0xe327('0x46')]})[_0xe327('0x25')](function(_0x599a51){_0x10014f[_0xe327('0x1e')]=_0x599a51;if(_0x2b4444[_0xe327('0x3c')][_0xe327('0x49')]){_0x8e33e3[_0xe327('0x4a')]=[{'all':!![]}];}return db[_0xe327('0x65')][_0xe327('0x4b')](_0x8e33e3);})[_0xe327('0x25')](function(_0x3f365d){_0x10014f[_0xe327('0x4c')]=_0x3f365d;return _0x10014f;});}})['then'](respondWithFilteredResult(_0x18f45c,_0x8e33e3))[_0xe327('0x51')](handleError(_0x18f45c,null));};exports[_0xe327('0x67')]=function(_0x51889f,_0x57b89b,_0x38efea){var _0x334485={'raw':!![],'where':{}};var _0x45906e={};var _0x35772d={'count':0x0,'rows':[]};return db[_0xe327('0x37')]['findOne']({'where':{'id':_0x51889f[_0xe327('0x4e')]['id']}})[_0xe327('0x25')](handleEntityNotFound(_0x57b89b,null))['then'](function(_0x5ec02d){if(_0x5ec02d){_0x45906e[_0xe327('0x3b')]=_['keys'](db[_0xe327('0x68')][_0xe327('0x38')]);_0x45906e[_0xe327('0x3c')]=_[_0xe327('0x3d')](_0x51889f[_0xe327('0x3c')]);_0x45906e[_0xe327('0x44')]=_['intersection'](_0x45906e[_0xe327('0x3b')],_0x45906e[_0xe327('0x3c')]);_0x334485[_0xe327('0x3e')]=_[_0xe327('0x3f')](_0x45906e['model'],qs[_0xe327('0x40')](_0x51889f[_0xe327('0x3c')][_0xe327('0x40')]));_0x334485[_0xe327('0x3e')]=_0x334485[_0xe327('0x3e')][_0xe327('0x4f')]?_0x334485[_0xe327('0x3e')]:_0x45906e[_0xe327('0x3b')];if(!_0x51889f[_0xe327('0x3c')][_0xe327('0x62')](_0xe327('0x41'))){_0x334485[_0xe327('0x1c')]=qs[_0xe327('0x1c')](_0x51889f[_0xe327('0x3c')][_0xe327('0x1c')]);_0x334485['offset']=qs[_0xe327('0x1b')](_0x51889f['query'][_0xe327('0x1b')]);}_0x334485[_0xe327('0x42')]=qs['sort'](_0x51889f[_0xe327('0x3c')]['sort']);_0x334485[_0xe327('0x46')]=qs[_0xe327('0x44')](_[_0xe327('0x45')](_0x51889f[_0xe327('0x3c')],_0x45906e['filters']));_0x334485[_0xe327('0x46')][_0xe327('0x66')]=_0x5ec02d['id'];if(_0x51889f['query'][_0xe327('0x2a')]){_0x334485[_0xe327('0x46')]=_[_0xe327('0x47')](_0x334485[_0xe327('0x46')],{'$or':_[_0xe327('0x2c')](_0x334485[_0xe327('0x3e')],function(_0x15d27b){var _0x4e400d={};_0x4e400d[_0x15d27b]={'$like':'%'+_0x51889f['query']['filter']+'%'};return _0x4e400d;})});}_0x334485=_[_0xe327('0x47')]({},_0x334485,_0x51889f[_0xe327('0x50')]);return db[_0xe327('0x68')][_0xe327('0x1e')]({'where':_0x334485['where']})[_0xe327('0x25')](function(_0x4449da){_0x35772d[_0xe327('0x1e')]=_0x4449da;if(_0x51889f[_0xe327('0x3c')][_0xe327('0x49')]){_0x334485[_0xe327('0x4a')]=[{'all':!![]}];}return db[_0xe327('0x68')]['findAll'](_0x334485);})['then'](function(_0x234158){_0x35772d[_0xe327('0x4c')]=_0x234158;return _0x35772d;});}})[_0xe327('0x25')](respondWithFilteredResult(_0x57b89b,_0x334485))[_0xe327('0x51')](handleError(_0x57b89b,null));};exports[_0xe327('0x69')]=function(_0x3647fd,_0x8b0fe0,_0x234edf){var _0xe4bce9={'raw':!![],'where':{}};var _0x44e320={};var _0x1853cc={'count':0x0,'rows':[]};return db[_0xe327('0x37')][_0xe327('0x61')]({'where':{'id':_0x3647fd[_0xe327('0x4e')]['id']}})['then'](handleEntityNotFound(_0x8b0fe0,null))[_0xe327('0x25')](function(_0x3fb246){if(_0x3fb246){_0x44e320[_0xe327('0x3b')]=_['keys'](db[_0xe327('0x6a')]['rawAttributes']);_0x44e320[_0xe327('0x3c')]=_[_0xe327('0x3d')](_0x3647fd[_0xe327('0x3c')]);_0x44e320[_0xe327('0x44')]=_[_0xe327('0x3f')](_0x44e320[_0xe327('0x3b')],_0x44e320['query']);_0xe4bce9[_0xe327('0x3e')]=_[_0xe327('0x3f')](_0x44e320['model'],qs[_0xe327('0x40')](_0x3647fd[_0xe327('0x3c')]['fields']));_0xe4bce9[_0xe327('0x3e')]=_0xe4bce9['attributes'][_0xe327('0x4f')]?_0xe4bce9[_0xe327('0x3e')]:_0x44e320[_0xe327('0x3b')];if(!_0x3647fd[_0xe327('0x3c')][_0xe327('0x62')](_0xe327('0x41'))){_0xe4bce9[_0xe327('0x1c')]=qs[_0xe327('0x1c')](_0x3647fd[_0xe327('0x3c')][_0xe327('0x1c')]);_0xe4bce9[_0xe327('0x1b')]=qs[_0xe327('0x1b')](_0x3647fd['query'][_0xe327('0x1b')]);}_0xe4bce9[_0xe327('0x42')]=qs[_0xe327('0x43')](_0x3647fd['query'][_0xe327('0x43')]);_0xe4bce9[_0xe327('0x46')]=qs['filters'](_[_0xe327('0x45')](_0x3647fd[_0xe327('0x3c')],_0x44e320[_0xe327('0x44')]));_0xe4bce9['where'][_0xe327('0x66')]=_0x3fb246['id'];if(_0x3647fd[_0xe327('0x3c')][_0xe327('0x2a')]){_0xe4bce9[_0xe327('0x46')]=_['merge'](_0xe4bce9['where'],{'$or':_['map'](_0xe4bce9[_0xe327('0x3e')],function(_0x5737e4){var _0x3b6292={};_0x3b6292[_0x5737e4]={'$like':'%'+_0x3647fd['query'][_0xe327('0x2a')]+'%'};return _0x3b6292;})});}_0xe4bce9=_[_0xe327('0x47')]({},_0xe4bce9,_0x3647fd['options']);return db[_0xe327('0x6a')]['count']({'where':_0xe4bce9['where']})[_0xe327('0x25')](function(_0x39e08e){_0x1853cc[_0xe327('0x1e')]=_0x39e08e;if(_0x3647fd[_0xe327('0x3c')][_0xe327('0x49')]){_0xe4bce9[_0xe327('0x4a')]=[{'all':!![]}];}return db['CmHopperBlack']['findAll'](_0xe4bce9);})['then'](function(_0x1d0cdd){_0x1853cc[_0xe327('0x4c')]=_0x1d0cdd;return _0x1853cc;});}})[_0xe327('0x25')](respondWithFilteredResult(_0x8b0fe0,_0xe4bce9))['catch'](handleError(_0x8b0fe0,null));};exports[_0xe327('0x6b')]=function(_0x496433,_0x36b528,_0x2bc44a){var _0xd6758={};var _0x3c92cc={};var _0x2a3fec;var _0x2d43b1;return db[_0xe327('0x37')][_0xe327('0x61')]({'where':{'id':_0x496433['params']['id']}})[_0xe327('0x25')](handleEntityNotFound(_0x36b528,null))[_0xe327('0x25')](function(_0x5302e8){if(_0x5302e8){_0x2a3fec=_0x5302e8;_0x3c92cc[_0xe327('0x3b')]=_[_0xe327('0x3d')](db[_0xe327('0x6c')][_0xe327('0x38')]);_0x3c92cc[_0xe327('0x3c')]=_[_0xe327('0x3d')](_0x496433[_0xe327('0x3c')]);_0x3c92cc['filters']=_[_0xe327('0x3f')](_0x3c92cc['model'],_0x3c92cc[_0xe327('0x3c')]);_0xd6758['attributes']=_['intersection'](_0x3c92cc[_0xe327('0x3b')],qs['fields'](_0x496433[_0xe327('0x3c')]['fields']));_0xd6758[_0xe327('0x3e')]=_0xd6758['attributes'][_0xe327('0x4f')]?_0xd6758['attributes']:_0x3c92cc[_0xe327('0x3b')];_0xd6758[_0xe327('0x42')]=qs[_0xe327('0x43')](_0x496433[_0xe327('0x3c')][_0xe327('0x43')]);_0xd6758['where']=qs[_0xe327('0x44')](_[_0xe327('0x45')](_0x496433['query'],_0x3c92cc['filters']));if(_0x496433[_0xe327('0x3c')][_0xe327('0x2a')]){_0xd6758['where']=_[_0xe327('0x47')](_0xd6758[_0xe327('0x46')],{'$or':_[_0xe327('0x2c')](_0xd6758['attributes'],function(_0x47c331){var _0xb681ff={};_0xb681ff[_0x47c331]={'$like':'%'+_0x496433[_0xe327('0x3c')][_0xe327('0x2a')]+'%'};return _0xb681ff;})});}_0xd6758=_['merge']({},_0xd6758,_0x496433[_0xe327('0x50')]);return _0x2a3fec[_0xe327('0x6b')](_0xd6758);}})[_0xe327('0x25')](function(_0x48e000){if(_0x48e000){_0x2d43b1=_0x48e000[_0xe327('0x4f')];if(!_0x496433[_0xe327('0x3c')][_0xe327('0x62')](_0xe327('0x41'))){_0xd6758[_0xe327('0x1c')]=qs[_0xe327('0x1c')](_0x496433[_0xe327('0x3c')]['limit']);_0xd6758['offset']=qs[_0xe327('0x1b')](_0x496433[_0xe327('0x3c')]['offset']);}return _0x2a3fec['getTeams'](_0xd6758);}})[_0xe327('0x25')](function(_0x50fab1){if(_0x50fab1){return _0x50fab1?{'count':_0x2d43b1,'rows':_0x50fab1}:null;}})[_0xe327('0x25')](respondWithResult(_0x36b528,null))[_0xe327('0x51')](handleError(_0x36b528,null));};exports[_0xe327('0x6d')]=function(_0x1920bb,_0x181833,_0x3e8b0f){var _0x411941=_0x1920bb[_0xe327('0x53')][_0xe327('0x6e')];var _0x2b1fa3=_[_0xe327('0x2c')](_0x411941,'id');return db[_0xe327('0x6c')][_0xe327('0x4b')]({'where':{'id':_0x2b1fa3},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id','name',_0xe327('0x6f'),'voicePause',_0xe327('0x70')],'raw':!![]}]})['then'](function(_0x1bf5a2){if(_0x1bf5a2){var _0xb13756=_['flatMap'](_0x1bf5a2,function(_0x175c3a){var _0x2fee28=_0x175c3a[_0xe327('0x26')]({'plain':!![]});_0x2fee28[_0xe327('0x71')][_0xe327('0x72')](function(_0xb94552){_0xb94552[_0xe327('0x73')]=_[_0xe327('0x30')](_0x411941,{'id':_0x2fee28['id']})[_0xe327('0x73')];});return _0x2fee28[_0xe327('0x71')];});return db['VoiceQueue'][_0xe327('0x30')]({'where':{'id':_0x1920bb[_0xe327('0x4e')]['id']}})[_0xe327('0x25')](function(_0x394303){return db[_0xe327('0x74')][_0xe327('0x75')](function(_0x5265e6){return _0x394303[_0xe327('0x6d')](_0x2b1fa3,{'transaction':_0x5265e6})[_0xe327('0x25')](function(){return BPromise[_0xe327('0x76')](_0x411941,function(_0x7e67b9){return db[_0xe327('0x77')]['upsert']({'TeamId':_0x7e67b9['id'],'VoiceQueueId':_0x1920bb['params']['id'],'penalty':_0x7e67b9[_0xe327('0x73')]},{'transaction':_0x5265e6});});})[_0xe327('0x25')](function(){return BPromise['each'](_0xb13756,function(_0x499738){return db[_0xe327('0x78')][_0xe327('0x79')]({'where':{'UserId':_0x499738['id'],'VoiceQueueId':_0x1920bb[_0xe327('0x4e')]['id']},'defaults':{'penalty':_0x499738[_0xe327('0x73')]},'transaction':_0x5265e6});});})[_0xe327('0x25')](function(){return BPromise[_0xe327('0x76')](_[_0xe327('0x2a')](_0xb13756,{'online':!![]}),function(_0xad7f44){return db[_0xe327('0x7a')][_0xe327('0x7b')]({'membername':_0xad7f44[_0xe327('0x31')],'UserId':_0xad7f44['id'],'queue_name':_0x394303[_0xe327('0x31')],'VoiceQueueId':_0x394303['id'],'interface':_[_0xe327('0x7c')](_0xad7f44[_0xe327('0x70')])?util[_0xe327('0x7d')](_0xe327('0x7e'),_0xad7f44[_0xe327('0x31')]):_0xad7f44[_0xe327('0x70')],'paused':_0xad7f44[_0xe327('0x7f')]||![],'penalty':_0xad7f44['penalty']},{'transaction':_0x5265e6});});})['then'](function(){_0xb13756['forEach'](function(_0x3829c){socket[_0xe327('0x80')](_0xe327('0x81'),{'UserId':_0x3829c['id'],'VoiceQueueId':_0x394303['id']});});});});});}})[_0xe327('0x25')](respondWithStatusCode(_0x181833,null))[_0xe327('0x51')](handleError(_0x181833,null));};exports['removeTeams']=function(_0x42fae2,_0x3371f3,_0x835eeb){return db['Team'][_0xe327('0x4b')]({'where':{'id':_0x42fae2[_0xe327('0x3c')][_0xe327('0x82')]},'attributes':['id'],'include':[{'model':db[_0xe327('0x83')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xe327('0x25')](handleEntityNotFound(_0x3371f3,null))[_0xe327('0x25')](function(_0x404a57){var _0x101d1c=_['map'](_0x404a57,'id');var _0x463b90=[];var _0x5b2b35=[];var _0x2a38c1=squel[_0xe327('0x84')]();_0x2a38c1[_0xe327('0x85')](_0xe327('0x86'))[_0xe327('0x87')](_0xe327('0x88'),'tq')[_0xe327('0x89')](_0xe327('0x8a'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xe327('0x46')]('VoiceQueueId\x20=\x20?',_0x42fae2[_0xe327('0x4e')]['id']);for(var _0x34394b=0x0;_0x34394b<_0x404a57[_0xe327('0x4f')];_0x34394b+=0x1){let _0x231342=_0x404a57[_0x34394b];for(var _0x5310e6=0x0;_0x5310e6<_0x231342[_0xe327('0x71')][_0xe327('0x4f')];_0x5310e6+=0x1){let _0x281593=_0x231342['Agents'][_0x5310e6];var _0x2140f0=_0x2a38c1['clone']();_0x2140f0[_0xe327('0x46')](_0xe327('0x8b'),_0x281593['id']);_0x5b2b35[_0xe327('0x8c')](db[_0xe327('0x74')]['query'](_0x2140f0[_0xe327('0x8d')](),{'type':db[_0xe327('0x74')][_0xe327('0x8e')][_0xe327('0x8f')]})[_0xe327('0x25')](function(_0x39532b){if(_0x39532b[_0xe327('0x4f')]===0x1){return _0x281593['id'];}else{var _0x205aa7=_[_0xe327('0x90')](_[_0xe327('0x2c')](_0x39532b,'TeamId'),function(_0x238b9a){return _[_0xe327('0x2e')](_0x101d1c,_0x238b9a);});if(_0x205aa7){return _0x281593['id'];}}}));}}return BPromise['all'](_0x5b2b35)[_0xe327('0x25')](function(_0x8bec73){_0x463b90=_(_0x463b90)[_0xe327('0x91')](_0x8bec73)[_0xe327('0x92')]()['value']();return db[_0xe327('0x37')]['find']({'where':{'id':_0x42fae2[_0xe327('0x4e')]['id']}})['then'](function(_0x5b4b06){return db[_0xe327('0x74')][_0xe327('0x75')](function(_0x352cea){return _0x5b4b06[_0xe327('0x93')](_0x42fae2['query']['ids'],{'transaction':_0x352cea})[_0xe327('0x25')](function(){if(!_['isEmpty'](_0x463b90)){return _0x5b4b06[_0xe327('0x94')](_0x463b90,{'transaction':_0x352cea})[_0xe327('0x25')](function(){return db['UserVoiceQueueRt'][_0xe327('0x24')]({'where':{'VoiceQueueId':_0x42fae2['params']['id'],'UserId':_0x463b90},'transaction':_0x352cea});});}})[_0xe327('0x25')](function(){_0x463b90['forEach'](function(_0xd87bd4){socket[_0xe327('0x80')](_0xe327('0x95'),{'UserId':_0xd87bd4,'VoiceQueueId':_0x5b4b06['id']});});});});});});})[_0xe327('0x25')](respondWithStatusCode(_0x3371f3,null))[_0xe327('0x51')](handleError(_0x3371f3,null));};exports[_0xe327('0x96')]=function(_0x30efd4,_0xd44d6f,_0x4508f6){var _0x10465f,_0x3bc15c;return db[_0xe327('0x37')]['find']({'where':{'id':_0x30efd4['params']['id']}})[_0xe327('0x25')](handleEntityNotFound(_0xd44d6f,null))[_0xe327('0x25')](function(_0x569d5a){if(_0x569d5a){_0x3bc15c=_0x569d5a;return _0x569d5a[_0xe327('0x96')](_0x30efd4[_0xe327('0x53')]['ids'],_[_0xe327('0x5d')](_0x30efd4[_0xe327('0x53')],[_0xe327('0x82'),'id'])||{})[_0xe327('0x97')](function(_0x21a23e){for(var _0x3eb144=0x0;_0x3eb144<_0x30efd4[_0xe327('0x53')][_0xe327('0x82')][_0xe327('0x4f')];_0x3eb144+=0x1){socket[_0xe327('0x80')](_0xe327('0x81'),{'UserId':Number(_0x30efd4[_0xe327('0x53')][_0xe327('0x82')][_0x3eb144]),'VoiceQueueId':Number(_0x30efd4[_0xe327('0x4e')]['id'])});}return _0x21a23e;});}})['then'](function(_0x42e3c){_0x10465f=_0x42e3c||[];if(_0x3bc15c){return db[_0xe327('0x83')][_0xe327('0x4b')]({'where':{'id':_0x30efd4[_0xe327('0x53')][_0xe327('0x82')]},'attributes':['id','name','online',_0xe327('0x7f'),'interface'],'raw':!![]});}})[_0xe327('0x25')](function(_0x6d0f35){if(!_[_0xe327('0x98')](_0x6d0f35)){var _0xb18bd4=[];for(var _0xf49c1a=0x0;_0xf49c1a<_0x6d0f35[_0xe327('0x4f')];_0xf49c1a++){if(_0x6d0f35[_0xf49c1a][_0xe327('0x6f')]){_0xb18bd4[_0xe327('0x8c')](db[_0xe327('0x7a')][_0xe327('0x7b')]({'membername':_0x6d0f35[_0xf49c1a]['name'],'UserId':_0x6d0f35[_0xf49c1a]['id'],'queue_name':_0x3bc15c[_0xe327('0x31')],'VoiceQueueId':_0x3bc15c['id'],'interface':_[_0xe327('0x7c')](_0x6d0f35[_0xf49c1a][_0xe327('0x70')])?util['format'](_0xe327('0x7e'),_0x6d0f35[_0xf49c1a][_0xe327('0x31')]):_0x6d0f35[_0xf49c1a]['interface'],'paused':_0x6d0f35[_0xf49c1a][_0xe327('0x7f')]||![],'penalty':_0x30efd4['body'][_0xe327('0x73')]||0x0}));}}return BPromise[_0xe327('0x99')](_0xb18bd4);}})[_0xe327('0x25')](function(){return _0x10465f;})[_0xe327('0x25')](respondWithResult(_0xd44d6f,null))[_0xe327('0x51')](handleError(_0xd44d6f,null));};exports[_0xe327('0x94')]=function(_0x2d1219,_0x5d8d86,_0x55bdf8){return db[_0xe327('0x37')]['find']({'where':{'id':_0x2d1219[_0xe327('0x4e')]['id']}})[_0xe327('0x25')](handleEntityNotFound(_0x5d8d86,null))[_0xe327('0x25')](function(_0x12b64a){if(_0x12b64a){return _0x12b64a['removeAgents'](_0x2d1219[_0xe327('0x3c')][_0xe327('0x82')])['then'](function(){if(_['isArray'](_0x2d1219[_0xe327('0x3c')][_0xe327('0x82')])){for(var _0x219695=0x0;_0x219695<_0x2d1219['query'][_0xe327('0x82')][_0xe327('0x4f')];_0x219695+=0x1){socket[_0xe327('0x80')](_0xe327('0x95'),{'UserId':Number(_0x2d1219[_0xe327('0x3c')]['ids'][_0x219695]),'VoiceQueueId':Number(_0x2d1219[_0xe327('0x4e')]['id'])});}}else{socket['emit'](_0xe327('0x95'),{'UserId':Number(_0x2d1219[_0xe327('0x3c')][_0xe327('0x82')]),'VoiceQueueId':Number(_0x2d1219[_0xe327('0x4e')]['id'])});}});}})['then'](function(_0x50f598){return db[_0xe327('0x7a')][_0xe327('0x24')]({'where':{'VoiceQueueId':_0x2d1219[_0xe327('0x4e')]['id'],'UserId':_0x2d1219[_0xe327('0x3c')][_0xe327('0x82')]}})[_0xe327('0x25')](function(){return _0x50f598;});})[_0xe327('0x25')](respondWithStatusCode(_0x5d8d86,null))['catch'](handleError(_0x5d8d86,null));};exports[_0xe327('0x9a')]=function(_0x499a7c,_0xbe0d6d,_0x119cce){var _0x5cc021={};var _0x5281a9={};var _0xa21523;var _0x4420bc;return db[_0xe327('0x37')]['findOne']({'where':{'id':_0x499a7c['params']['id']}})[_0xe327('0x25')](handleEntityNotFound(_0xbe0d6d,null))[_0xe327('0x25')](function(_0xfe6445){if(_0xfe6445){_0xa21523=_0xfe6445;_0x5281a9[_0xe327('0x3b')]=_[_0xe327('0x3d')](db['User']['rawAttributes']);_0x5281a9[_0xe327('0x3c')]=_[_0xe327('0x3d')](_0x499a7c[_0xe327('0x3c')]);_0x5281a9[_0xe327('0x44')]=_[_0xe327('0x3f')](_0x5281a9[_0xe327('0x3b')],_0x5281a9['query']);_0x5cc021[_0xe327('0x3e')]=_[_0xe327('0x3f')](_0x5281a9['model'],qs[_0xe327('0x40')](_0x499a7c['query']['fields']));_0x5cc021['attributes']=_0x5cc021[_0xe327('0x3e')]['length']?_0x5cc021[_0xe327('0x3e')]:_0x5281a9[_0xe327('0x3b')];_0x5cc021[_0xe327('0x42')]=qs[_0xe327('0x43')](_0x499a7c[_0xe327('0x3c')][_0xe327('0x43')]);_0x5cc021['where']=qs[_0xe327('0x44')](_[_0xe327('0x45')](_0x499a7c[_0xe327('0x3c')],_0x5281a9[_0xe327('0x44')]));if(_0x499a7c[_0xe327('0x3c')]['filter']){_0x5cc021[_0xe327('0x46')]=_[_0xe327('0x47')](_0x5cc021[_0xe327('0x46')],{'$or':_[_0xe327('0x2c')](_0x5cc021[_0xe327('0x3e')],function(_0x23b986){var _0x547e0e={};_0x547e0e[_0x23b986]={'$like':'%'+_0x499a7c[_0xe327('0x3c')][_0xe327('0x2a')]+'%'};return _0x547e0e;})});}_0x5cc021=_[_0xe327('0x47')]({},_0x5cc021,_0x499a7c[_0xe327('0x50')]);return _0xa21523['getAgents'](_0x5cc021);}})[_0xe327('0x25')](function(_0x3c7c45){if(_0x3c7c45){_0x4420bc=_0x3c7c45[_0xe327('0x4f')];if(!_0x499a7c[_0xe327('0x3c')][_0xe327('0x62')](_0xe327('0x41'))){_0x5cc021[_0xe327('0x1c')]=qs['limit'](_0x499a7c[_0xe327('0x3c')][_0xe327('0x1c')]);_0x5cc021['offset']=qs[_0xe327('0x1b')](_0x499a7c['query'][_0xe327('0x1b')]);}return _0xa21523[_0xe327('0x9a')](_0x5cc021);}})[_0xe327('0x25')](function(_0x1d8740){if(_0x1d8740){return _0x1d8740?{'count':_0x4420bc,'rows':_0x1d8740}:null;}})['then'](respondWithResult(_0xbe0d6d,null))['catch'](handleError(_0xbe0d6d,null));};exports[_0xe327('0x9b')]=function(_0x1de0bf,_0x16573a,_0x457201){var _0x1fa85a={};var _0x57452c={};var _0x2a1915;var _0x39b13d;return db['VoiceQueue'][_0xe327('0x61')]({'where':{'id':_0x1de0bf[_0xe327('0x4e')]['id']}})['then'](handleEntityNotFound(_0x16573a,null))[_0xe327('0x25')](function(_0xed87f8){if(_0xed87f8){_0x2a1915=_0xed87f8;_0x57452c['model']=_[_0xe327('0x3d')](db[_0xe327('0x7a')][_0xe327('0x38')]);_0x57452c['query']=_[_0xe327('0x3d')](_0x1de0bf[_0xe327('0x3c')]);_0x57452c[_0xe327('0x44')]=_[_0xe327('0x3f')](_0x57452c[_0xe327('0x3b')],_0x57452c[_0xe327('0x3c')]);_0x1fa85a[_0xe327('0x3e')]=_[_0xe327('0x3f')](_0x57452c[_0xe327('0x3b')],qs[_0xe327('0x40')](_0x1de0bf[_0xe327('0x3c')][_0xe327('0x40')]));_0x1fa85a[_0xe327('0x3e')]=_0x1fa85a[_0xe327('0x3e')][_0xe327('0x4f')]?_0x1fa85a['attributes']:_0x57452c[_0xe327('0x3b')];_0x1fa85a[_0xe327('0x42')]=qs[_0xe327('0x43')](_0x1de0bf[_0xe327('0x3c')][_0xe327('0x43')]);_0x1fa85a['where']=qs[_0xe327('0x44')](_[_0xe327('0x45')](_0x1de0bf[_0xe327('0x3c')],_0x57452c[_0xe327('0x44')]));if(_0x1de0bf[_0xe327('0x3c')][_0xe327('0x2a')]){_0x1fa85a[_0xe327('0x46')]=_['merge'](_0x1fa85a[_0xe327('0x46')],{'$or':_['map'](_0x1fa85a['attributes'],function(_0xda285e){var _0x1e58b6={};_0x1e58b6[_0xda285e]={'$like':'%'+_0x1de0bf[_0xe327('0x3c')][_0xe327('0x2a')]+'%'};return _0x1e58b6;})});}_0x1fa85a=_[_0xe327('0x47')]({},_0x1fa85a,_0x1de0bf[_0xe327('0x50')]);return _0x2a1915[_0xe327('0x9b')](_0x1fa85a);}})[_0xe327('0x25')](function(_0x22396c){if(_0x22396c){_0x39b13d=_0x22396c[_0xe327('0x4f')];if(!_0x1de0bf[_0xe327('0x3c')][_0xe327('0x62')](_0xe327('0x41'))){_0x1fa85a[_0xe327('0x1c')]=qs[_0xe327('0x1c')](_0x1de0bf[_0xe327('0x3c')][_0xe327('0x1c')]);_0x1fa85a[_0xe327('0x1b')]=qs[_0xe327('0x1b')](_0x1de0bf['query'][_0xe327('0x1b')]);}return _0x2a1915[_0xe327('0x9b')](_0x1fa85a);}})[_0xe327('0x25')](function(_0x4383fd){return _0x4383fd?{'count':_0x39b13d,'rows':_0x4383fd}:null;})['then'](respondWithResult(_0x16573a,null))[_0xe327('0x51')](handleError(_0x16573a,null));};exports[_0xe327('0x9c')]=function(_0x51dd4d,_0x3fa518,_0x46b921){var _0x37b6ae={};var _0x1b2817={};var _0x7fbfe6;var _0x4d0b24;return db[_0xe327('0x37')][_0xe327('0x61')]({'where':{'id':_0x51dd4d['params']['id']}})[_0xe327('0x25')](handleEntityNotFound(_0x3fa518,null))['then'](function(_0x22f981){if(_0x22f981){_0x7fbfe6=_0x22f981;_0x1b2817[_0xe327('0x3b')]=_['keys'](db[_0xe327('0x9d')][_0xe327('0x38')]);_0x1b2817['query']=_[_0xe327('0x3d')](_0x51dd4d[_0xe327('0x3c')]);_0x1b2817[_0xe327('0x44')]=_['intersection'](_0x1b2817[_0xe327('0x3b')],_0x1b2817[_0xe327('0x3c')]);_0x37b6ae[_0xe327('0x3e')]=_[_0xe327('0x3f')](_0x1b2817[_0xe327('0x3b')],qs[_0xe327('0x40')](_0x51dd4d[_0xe327('0x3c')][_0xe327('0x40')]));_0x37b6ae[_0xe327('0x3e')]=_0x37b6ae[_0xe327('0x3e')]['length']?_0x37b6ae[_0xe327('0x3e')]:_0x1b2817[_0xe327('0x3b')];_0x37b6ae[_0xe327('0x42')]=qs[_0xe327('0x43')](_0x51dd4d['query']['sort']);_0x37b6ae[_0xe327('0x46')]=qs[_0xe327('0x44')](_[_0xe327('0x45')](_0x51dd4d[_0xe327('0x3c')],_0x1b2817['filters']));if(_0x51dd4d['query'][_0xe327('0x2a')]){_0x37b6ae[_0xe327('0x46')]=_['merge'](_0x37b6ae['where'],{'$or':_[_0xe327('0x2c')](_0x37b6ae[_0xe327('0x3e')],function(_0x204ee5){var _0x29b7bb={};_0x29b7bb[_0x204ee5]={'$like':'%'+_0x51dd4d[_0xe327('0x3c')]['filter']+'%'};return _0x29b7bb;})});}_0x37b6ae=_[_0xe327('0x47')]({},_0x37b6ae,_0x51dd4d[_0xe327('0x50')]);return _0x7fbfe6['getLists'](_0x37b6ae);}})[_0xe327('0x25')](function(_0x1a33b0){if(_0x1a33b0){_0x4d0b24=_0x1a33b0[_0xe327('0x4f')];if(!_0x51dd4d[_0xe327('0x3c')]['hasOwnProperty'](_0xe327('0x41'))){_0x37b6ae[_0xe327('0x1c')]=qs[_0xe327('0x1c')](_0x51dd4d[_0xe327('0x3c')]['limit']);_0x37b6ae[_0xe327('0x1b')]=qs[_0xe327('0x1b')](_0x51dd4d['query'][_0xe327('0x1b')]);}return _0x7fbfe6[_0xe327('0x9c')](_0x37b6ae);}})[_0xe327('0x25')](function(_0x389649){if(_0x389649){return _0x389649?{'count':_0x4d0b24,'rows':_0x389649}:null;}})[_0xe327('0x25')](respondWithResult(_0x3fa518,null))[_0xe327('0x51')](handleError(_0x3fa518,null));};exports[_0xe327('0x9e')]=function(_0x183f31,_0x1d7682,_0x1ca2ba){var _0x57c53b,_0x525110;return db['VoiceQueue'][_0xe327('0x30')]({'where':{'id':_0x183f31[_0xe327('0x4e')]['id']}})[_0xe327('0x25')](handleEntityNotFound(_0x1d7682,null))['then'](function(_0x20ecc2){if(_0x20ecc2){_0x525110=_0x20ecc2;return _0x20ecc2[_0xe327('0x9e')](_0x183f31[_0xe327('0x53')]['ids'],_[_0xe327('0x5d')](_0x183f31[_0xe327('0x53')],[_0xe327('0x82'),'id'])||{});}return null;})['spread'](function(_0x16193b){var _0x17ab4c;_0x57c53b=_0x16193b||[];var _0x3b1d23=[];if(_0x16193b){for(var _0x1c467b=0x0;_0x1c467b<_0x16193b[_0xe327('0x4f')];_0x1c467b+=0x1){var _0xce85c3=_0x16193b[_0x1c467b][_0xe327('0x26')]({'plain':!![]});_0x525110[_0xe327('0x9f')]=_0x183f31[_0xe327('0x53')][_0xe327('0x9f')]?_0x183f31['body'][_0xe327('0x9f')]:_0x525110[_0xe327('0x9f')];switch(_0x525110[_0xe327('0x9f')]){case _0xe327('0xa0'):_0x17ab4c=squel[_0xe327('0xa1')]()[_0xe327('0xa2')]('cm_hopper')[_0xe327('0xa3')]([_0xe327('0xa4'),_0xe327('0xa5'),_0xe327('0xa6'),_0xe327('0xa7'),_0xe327('0x66'),'createdAt',_0xe327('0xa8')],squel[_0xe327('0x84')]()[_0xe327('0x85')](_0xe327('0xa4'),_0xe327('0xa4'))['field'](_0xe327('0xa9'),_0xe327('0xa5'))['field']('id',_0xe327('0xa6'))[_0xe327('0x85')](_0xce85c3[_0xe327('0xaa')][_0xe327('0x8d')](),_0xe327('0xa7'))['field'](_0x183f31[_0xe327('0x4e')]['id'][_0xe327('0x8d')](),_0xe327('0x66'))[_0xe327('0x85')](_0xe327('0xa9'),_0xe327('0x5e'))[_0xe327('0x85')]('NOW()',_0xe327('0xa8'))['from'](_0xe327('0xab'))[_0xe327('0x46')](_0xe327('0xac'))['where'](_0xe327('0xad'),_0xce85c3[_0xe327('0xaa')]['toString']())[_0xe327('0x46')](_0xe327('0xae'))[_0xe327('0x46')](_0xe327('0xaf'),squel['select']()[_0xe327('0x85')](_0xe327('0xb0'))['from'](_0xe327('0xb1'))['where'](_0xe327('0xb2'),_0x183f31['params']['id'][_0xe327('0x8d')]()))[_0xe327('0x46')]('phone\x20NOT\x20IN\x20(?)',squel[_0xe327('0x84')]()['field'](_0xe327('0xb3'))[_0xe327('0x87')](_0xe327('0xb4'))[_0xe327('0x46')](_0xe327('0xb2'),_0x183f31[_0xe327('0x4e')]['id'][_0xe327('0x8d')]())))[_0xe327('0x8d')]();break;case _0xe327('0xb5'):_0x17ab4c=squel['insert']()[_0xe327('0xa2')]('cm_hopper')[_0xe327('0xa3')]([_0xe327('0xa4'),_0xe327('0xa5'),_0xe327('0xa6'),_0xe327('0xa7'),_0xe327('0x66'),_0xe327('0x5e'),_0xe327('0xa8')],squel[_0xe327('0x84')]()[_0xe327('0x85')](_0xe327('0xa4'),_0xe327('0xa4'))[_0xe327('0x85')](_0xe327('0xa9'),_0xe327('0xa5'))[_0xe327('0x85')]('id',_0xe327('0xa6'))['field'](_0xce85c3['CmListId'][_0xe327('0x8d')](),_0xe327('0xa7'))[_0xe327('0x85')](_0x183f31[_0xe327('0x4e')]['id'][_0xe327('0x8d')](),_0xe327('0x66'))[_0xe327('0x85')](_0xe327('0xa9'),'createdAt')[_0xe327('0x85')]('NOW()',_0xe327('0xa8'))[_0xe327('0x87')](_0xe327('0xab'))[_0xe327('0x46')](_0xe327('0xac'))['where'](_0xe327('0xad'),_0xce85c3['CmListId']['toString']())['where'](_0xe327('0xae'))['where'](_0xe327('0xaf'),squel[_0xe327('0x84')]()[_0xe327('0x85')]('COALESCE(phone,\x27\x27)')[_0xe327('0x87')](_0xe327('0xb4'))[_0xe327('0x46')](_0xe327('0xb2'),_0x183f31[_0xe327('0x4e')]['id'][_0xe327('0x8d')]())))['toString']();break;default:_0x17ab4c=squel[_0xe327('0xa1')]()[_0xe327('0xa2')](_0xe327('0xb4'))[_0xe327('0xa3')]([_0xe327('0xa4'),_0xe327('0xa5'),_0xe327('0xa6'),_0xe327('0xa7'),_0xe327('0x66'),_0xe327('0x5e'),'updatedAt'],squel[_0xe327('0x84')]()[_0xe327('0x85')]('phone',_0xe327('0xa4'))['field'](_0xe327('0xa9'),_0xe327('0xa5'))[_0xe327('0x85')]('id','ContactId')[_0xe327('0x85')](_0xce85c3[_0xe327('0xaa')][_0xe327('0x8d')](),'ListId')['field'](_0x183f31[_0xe327('0x4e')]['id'][_0xe327('0x8d')](),'VoiceQueueId')[_0xe327('0x85')]('NOW()',_0xe327('0x5e'))[_0xe327('0x85')](_0xe327('0xa9'),_0xe327('0xa8'))['from'](_0xe327('0xab'))['where']('deletedAt\x20IS\x20NULL')[_0xe327('0x46')]('ListId\x20=\x20?',_0xce85c3['CmListId'][_0xe327('0x8d')]())[_0xe327('0x46')](_0xe327('0xae')))[_0xe327('0x8d')]();}_0x3b1d23[_0xe327('0x8c')](db[_0xe327('0x74')]['query'](_0x17ab4c));}return BPromise[_0xe327('0x99')](_0x3b1d23);}})['then'](function(){return _0x57c53b;})[_0xe327('0x25')](respondWithResult(_0x1d7682,null))[_0xe327('0x51')](handleError(_0x1d7682,null));};exports['removeLists']=function(_0x366a69,_0x68138e,_0x3670ad){return db['VoiceQueue'][_0xe327('0x30')]({'where':{'id':_0x366a69[_0xe327('0x4e')]['id']}})[_0xe327('0x25')](handleEntityNotFound(_0x68138e,null))['then'](function(_0x212e81){if(_0x212e81){return _0x212e81[_0xe327('0xb6')](_0x366a69[_0xe327('0x3c')][_0xe327('0x82')]);}})[_0xe327('0x25')](function(_0xd2cb08){if(_0xd2cb08){return db[_0xe327('0x63')][_0xe327('0x24')]({'where':{'ListId':_0x366a69[_0xe327('0x3c')]['ids'],'VoiceQueueId':_0x366a69[_0xe327('0x4e')]['id']}})['then'](function(){return _0xd2cb08;});}})[_0xe327('0x25')](respondWithStatusCode(_0x68138e,null))[_0xe327('0x51')](handleError(_0x68138e,null));};exports[_0xe327('0xb7')]=function(_0xc0e9ef,_0x48006b,_0x4684c7){var _0x20e8e6={};var _0x5069cf={};var _0x33030d;var _0x5778b9;return db[_0xe327('0x37')]['findOne']({'where':{'id':_0xc0e9ef[_0xe327('0x4e')]['id']}})[_0xe327('0x25')](handleEntityNotFound(_0x48006b,null))[_0xe327('0x25')](function(_0x3a57cf){if(_0x3a57cf){_0x33030d=_0x3a57cf;_0x5069cf[_0xe327('0x3b')]=_[_0xe327('0x3d')](db[_0xe327('0x9d')][_0xe327('0x38')]);_0x5069cf[_0xe327('0x3c')]=_[_0xe327('0x3d')](_0xc0e9ef['query']);_0x5069cf[_0xe327('0x44')]=_[_0xe327('0x3f')](_0x5069cf[_0xe327('0x3b')],_0x5069cf['query']);_0x20e8e6[_0xe327('0x3e')]=_[_0xe327('0x3f')](_0x5069cf[_0xe327('0x3b')],qs[_0xe327('0x40')](_0xc0e9ef['query'][_0xe327('0x40')]));_0x20e8e6['attributes']=_0x20e8e6[_0xe327('0x3e')][_0xe327('0x4f')]?_0x20e8e6[_0xe327('0x3e')]:_0x5069cf['model'];_0x20e8e6[_0xe327('0x42')]=qs[_0xe327('0x43')](_0xc0e9ef[_0xe327('0x3c')][_0xe327('0x43')]);_0x20e8e6['where']=qs['filters'](_[_0xe327('0x45')](_0xc0e9ef[_0xe327('0x3c')],_0x5069cf[_0xe327('0x44')]));if(_0xc0e9ef[_0xe327('0x3c')]['filter']){_0x20e8e6['where']=_[_0xe327('0x47')](_0x20e8e6[_0xe327('0x46')],{'$or':_[_0xe327('0x2c')](_0x20e8e6['attributes'],function(_0x2e5e3d){var _0x34d836={};_0x34d836[_0x2e5e3d]={'$like':'%'+_0xc0e9ef['query'][_0xe327('0x2a')]+'%'};return _0x34d836;})});}_0x20e8e6=_['merge']({},_0x20e8e6,_0xc0e9ef[_0xe327('0x50')]);return _0x33030d['getBlackLists'](_0x20e8e6);}})[_0xe327('0x25')](function(_0x3b6607){if(_0x3b6607){_0x5778b9=_0x3b6607[_0xe327('0x4f')];if(!_0xc0e9ef[_0xe327('0x3c')][_0xe327('0x62')](_0xe327('0x41'))){_0x20e8e6[_0xe327('0x1c')]=qs[_0xe327('0x1c')](_0xc0e9ef[_0xe327('0x3c')][_0xe327('0x1c')]);_0x20e8e6[_0xe327('0x1b')]=qs[_0xe327('0x1b')](_0xc0e9ef[_0xe327('0x3c')]['offset']);}return _0x33030d['getBlackLists'](_0x20e8e6);}})[_0xe327('0x25')](function(_0x4ac573){if(_0x4ac573){return _0x4ac573?{'count':_0x5778b9,'rows':_0x4ac573}:null;}})['then'](respondWithResult(_0x48006b,null))[_0xe327('0x51')](handleError(_0x48006b,null));};exports[_0xe327('0xb8')]=function(_0x4e95d6,_0x1c7648,_0x30b468){var _0x371298,_0x545b58;return db[_0xe327('0x37')][_0xe327('0x30')]({'where':{'id':_0x4e95d6['params']['id']}})['then'](handleEntityNotFound(_0x1c7648,null))[_0xe327('0x25')](function(_0x476a24){if(_0x476a24){_0x545b58=_0x476a24;return _0x476a24[_0xe327('0xb8')](_0x4e95d6[_0xe327('0x53')][_0xe327('0x82')],_[_0xe327('0x5d')](_0x4e95d6[_0xe327('0x53')],['ids','id'])||{});}return null;})[_0xe327('0x97')](function(_0x339b26){var _0x50dcd5;_0x371298=_0x339b26||[];var _0x260aaf=[];if(_0x339b26){for(var _0x15da6a=0x0;_0x15da6a<_0x339b26[_0xe327('0x4f')];_0x15da6a+=0x1){var _0x2a9677=_0x339b26[_0x15da6a]['get']({'plain':!![]});_0x50dcd5=squel['insert']()[_0xe327('0xa2')](_0xe327('0xb9'))[_0xe327('0xa3')]([_0xe327('0xa4'),_0xe327('0xa6'),_0xe327('0xa7'),'VoiceQueueId',_0xe327('0x5e'),_0xe327('0xa8')],squel[_0xe327('0x84')]()[_0xe327('0x85')](_0xe327('0xa4'),_0xe327('0xa4'))[_0xe327('0x85')]('id',_0xe327('0xa6'))[_0xe327('0x85')](_0x2a9677[_0xe327('0xaa')][_0xe327('0x8d')](),'ListId')['field'](_0x4e95d6[_0xe327('0x4e')]['id'][_0xe327('0x8d')](),_0xe327('0x66'))['field'](_0xe327('0xa9'),_0xe327('0x5e'))[_0xe327('0x85')](_0xe327('0xa9'),_0xe327('0xa8'))[_0xe327('0x87')]('cm_contacts')[_0xe327('0x46')]('deletedAt\x20IS\x20NULL')[_0xe327('0x46')](_0xe327('0xad'),_0x2a9677[_0xe327('0xaa')]['toString']())['where'](_0xe327('0xae')))['toString']();_0x260aaf['push'](db['sequelize'][_0xe327('0x3c')](_0x50dcd5));}return BPromise[_0xe327('0x99')](_0x260aaf);}})[_0xe327('0x25')](function(){return _0x371298;})['then'](respondWithResult(_0x1c7648,null))[_0xe327('0x51')](handleError(_0x1c7648,null));};exports[_0xe327('0xba')]=function(_0x1b5c3c,_0x33ac6c,_0x2ff2bf){return db[_0xe327('0x37')][_0xe327('0x30')]({'where':{'id':_0x1b5c3c[_0xe327('0x4e')]['id']}})[_0xe327('0x25')](handleEntityNotFound(_0x33ac6c,null))[_0xe327('0x25')](function(_0x421ae2){if(_0x421ae2){return _0x421ae2[_0xe327('0xba')](_0x1b5c3c[_0xe327('0x3c')][_0xe327('0x82')]);}})[_0xe327('0x25')](function(_0x45efbe){if(_0x45efbe){return db[_0xe327('0x6a')][_0xe327('0x24')]({'where':{'ListId':_0x1b5c3c[_0xe327('0x3c')][_0xe327('0x82')],'VoiceQueueId':_0x1b5c3c[_0xe327('0x4e')]['id']}})[_0xe327('0x25')](function(){return _0x45efbe;});}})[_0xe327('0x25')](respondWithStatusCode(_0x33ac6c,null))[_0xe327('0x51')](handleError(_0x33ac6c,null));}; \ No newline at end of file +var _0xd846=['../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','destroy','get','VoiceQueues','inbound','QueueCampaigns','outbound','filter','map','value','includes','type','UserProfileResource','then','error','name','index','VoiceQueue','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','merge','VIRTUAL','options','includeAll','include','rows','show','rawAttributes','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','omit','createdAt','body','update','getHoppers','CmHopper','nolimit','order','VoiceQueueId','findAll','getHopperHistories','findOne','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','User','Agents','voicePause','interface','flatMap','forEach','penalty','transaction','TeamVoiceQueue','upsert','each','UserVoiceQueue','findOrCreate','emit','ids','select','field','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','sequelize','toString','QueryTypes','SELECT','all','compact','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','spread','userVoiceQueue:save','online','push','UserVoiceQueueRt','isNil','format','SIP/%s','isArray','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','always','into','fromQuery','phone','scheduledAt','ListId','updatedAt','NOW()','ContactId','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','CmListId','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','cm_hopper','onlyIfOpen','insert','phone\x20IS\x20NOT\x20NULL','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0xd846,0xa2));var _0x6d84=function(_0x441113,_0x1dd51d){_0x441113=_0x441113-0x0;var _0x57eb33=_0xd846[_0x441113];return _0x57eb33;};'use strict';var emlformat=require(_0x6d84('0x0'));var rimraf=require(_0x6d84('0x1'));var zipdir=require(_0x6d84('0x2'));var jsonpatch=require(_0x6d84('0x3'));var rp=require(_0x6d84('0x4'));var moment=require(_0x6d84('0x5'));var BPromise=require(_0x6d84('0x6'));var Mustache=require(_0x6d84('0x7'));var util=require(_0x6d84('0x8'));var path=require('path');var sox=require(_0x6d84('0x9'));var csv=require(_0x6d84('0xa'));var ejs=require(_0x6d84('0xb'));var fs=require('fs');var fs_extra=require(_0x6d84('0xc'));var _=require(_0x6d84('0xd'));var squel=require('squel');var crypto=require(_0x6d84('0xe'));var jsforce=require(_0x6d84('0xf'));var deskjs=require(_0x6d84('0x10'));var toCsv=require(_0x6d84('0xa'));var querystring=require('querystring');var Papa=require(_0x6d84('0x11'));var Redis=require(_0x6d84('0x12'));var authService=require(_0x6d84('0x13'));var qs=require(_0x6d84('0x14'));var as=require(_0x6d84('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6d84('0x16'));var utils=require('../../config/utils');var config=require(_0x6d84('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x6d84('0x18'))['db'];config[_0x6d84('0x19')]=_[_0x6d84('0x1a')](config['redis'],{'host':_0x6d84('0x1b'),'port':0x18eb});var socket=require(_0x6d84('0x1c'))(new Redis(config['redis']));require('./voiceQueue.socket')[_0x6d84('0x1d')](socket);function respondWithStatusCode(_0x15fdb6,_0x5aeda4){_0x5aeda4=_0x5aeda4||0xcc;return function(_0x27d237){if(_0x27d237){return _0x15fdb6[_0x6d84('0x1e')](_0x5aeda4);}return _0x15fdb6[_0x6d84('0x1f')](_0x5aeda4)[_0x6d84('0x20')]();};}function respondWithResult(_0x20c44d,_0x1e4b49){_0x1e4b49=_0x1e4b49||0xc8;return function(_0x55c091){if(_0x55c091){return _0x20c44d[_0x6d84('0x1f')](_0x1e4b49)[_0x6d84('0x21')](_0x55c091);}};}function respondWithFilteredResult(_0x1a9668,_0x4e3fa1){return function(_0x312ceb){if(_0x312ceb){var _0x49dfc7=typeof _0x4e3fa1[_0x6d84('0x22')]===_0x6d84('0x23')&&typeof _0x4e3fa1[_0x6d84('0x24')]===_0x6d84('0x23');var _0x13fcbd=_0x312ceb['count'];var _0x5de56e=_0x49dfc7?0x0:_0x4e3fa1[_0x6d84('0x22')];var _0x30f1d0=_0x49dfc7?_0x312ceb[_0x6d84('0x25')]:_0x4e3fa1[_0x6d84('0x22')]+_0x4e3fa1[_0x6d84('0x24')];var _0x18b624;if(_0x30f1d0>=_0x13fcbd){_0x30f1d0=_0x13fcbd;_0x18b624=0xc8;}else{_0x18b624=0xce;}_0x1a9668[_0x6d84('0x1f')](_0x18b624);return _0x1a9668['set'](_0x6d84('0x26'),_0x5de56e+'-'+_0x30f1d0+'/'+_0x13fcbd)[_0x6d84('0x21')](_0x312ceb);}return null;};}function patchUpdates(_0x53d206){return function(_0x5f318f){try{jsonpatch['apply'](_0x5f318f,_0x53d206,!![]);}catch(_0x5deece){return BPromise['reject'](_0x5deece);}return _0x5f318f['save']();};}function saveUpdates(_0x48791c,_0x39a52f){return function(_0x371cc3){if(_0x371cc3){return _0x371cc3['update'](_0x48791c)['then'](function(_0x1b7186){return _0x1b7186;});}return null;};}function removeEntity(_0x41ca04,_0x59b9af){return function(_0xa44684){if(_0xa44684){return _0xa44684[_0x6d84('0x27')]()['then'](function(){var _0x55fa31=_0xa44684[_0x6d84('0x28')]({'plain':!![]});var _0x4134d5=[{'name':_0x6d84('0x29'),'value':_0x6d84('0x2a'),'ignore':![]},{'name':_0x6d84('0x2b'),'value':_0x6d84('0x2c'),'ignore':![]}];var _0x5a2b75=_(_0x4134d5)[_0x6d84('0x2d')]('ignore')[_0x6d84('0x2e')](_0x6d84('0x2f'))[_0x6d84('0x2f')]();if(_[_0x6d84('0x30')](_0x5a2b75,_0x55fa31[_0x6d84('0x31')])){return;}var _0x2f335d=_['find'](_0x4134d5,['value',_0x55fa31[_0x6d84('0x31')]])['name'];return db[_0x6d84('0x32')][_0x6d84('0x27')]({'where':{'type':_0x2f335d,'resourceId':_0x55fa31['id']}})[_0x6d84('0x33')](function(){return _0xa44684;});})['then'](function(){_0x41ca04[_0x6d84('0x1f')](0xcc)[_0x6d84('0x20')]();});}};}function handleEntityNotFound(_0xaa2466,_0x4962dd){return function(_0x54c33e){if(!_0x54c33e){_0xaa2466[_0x6d84('0x1e')](0x194);}return _0x54c33e;};}function handleError(_0x3d4bc1,_0x1d1d2c){_0x1d1d2c=_0x1d1d2c||0x1f4;return function(_0x358443){logger[_0x6d84('0x34')](_0x358443['stack']);if(_0x358443[_0x6d84('0x35')]){delete _0x358443['name'];}_0x3d4bc1[_0x6d84('0x1f')](_0x1d1d2c)['send'](_0x358443);};}exports[_0x6d84('0x36')]=function(_0x420f46,_0x20ca2c){var _0xa33d1a={},_0x3dc206={},_0x11f7b2={'count':0x0,'rows':[]};var _0x2ea5a2=_[_0x6d84('0x2e')](db[_0x6d84('0x37')]['rawAttributes'],function(_0xadabf5){return{'name':_0xadabf5['fieldName'],'type':_0xadabf5[_0x6d84('0x31')][_0x6d84('0x38')]};});_0x3dc206[_0x6d84('0x39')]=_[_0x6d84('0x2e')](_0x2ea5a2,_0x6d84('0x35'));_0x3dc206[_0x6d84('0x3a')]=_[_0x6d84('0x3b')](_0x420f46[_0x6d84('0x3a')]);_0x3dc206[_0x6d84('0x3c')]=_[_0x6d84('0x3d')](_0x3dc206[_0x6d84('0x39')],_0x3dc206['query']);_0xa33d1a[_0x6d84('0x3e')]=_[_0x6d84('0x3d')](_0x3dc206[_0x6d84('0x39')],qs['fields'](_0x420f46[_0x6d84('0x3a')][_0x6d84('0x3f')]));_0xa33d1a[_0x6d84('0x3e')]=_0xa33d1a[_0x6d84('0x3e')][_0x6d84('0x40')]?_0xa33d1a[_0x6d84('0x3e')]:_0x3dc206['model'];if(!_0x420f46[_0x6d84('0x3a')][_0x6d84('0x41')]('nolimit')){_0xa33d1a[_0x6d84('0x24')]=qs[_0x6d84('0x24')](_0x420f46['query'][_0x6d84('0x24')]);_0xa33d1a[_0x6d84('0x22')]=qs[_0x6d84('0x22')](_0x420f46[_0x6d84('0x3a')]['offset']);}_0xa33d1a['order']=qs[_0x6d84('0x42')](_0x420f46['query'][_0x6d84('0x42')]);_0xa33d1a[_0x6d84('0x43')]=qs['filters'](_[_0x6d84('0x44')](_0x420f46[_0x6d84('0x3a')],_0x3dc206[_0x6d84('0x3c')]),_0x2ea5a2);if(_0x420f46[_0x6d84('0x3a')][_0x6d84('0x2d')]){_0xa33d1a[_0x6d84('0x43')]=_[_0x6d84('0x45')](_0xa33d1a['where'],{'$or':_[_0x6d84('0x2e')](_0x2ea5a2,function(_0x2104f3){if(_0x2104f3[_0x6d84('0x31')]!==_0x6d84('0x46')){var _0x50b104={};_0x50b104[_0x2104f3[_0x6d84('0x35')]]={'$like':'%'+_0x420f46[_0x6d84('0x3a')]['filter']+'%'};return _0x50b104;}})});}_0xa33d1a=_[_0x6d84('0x45')]({},_0xa33d1a,_0x420f46[_0x6d84('0x47')]);var _0x56ea98={'where':_0xa33d1a[_0x6d84('0x43')]};return db[_0x6d84('0x37')][_0x6d84('0x25')](_0x56ea98)['then'](function(_0x3faf85){_0x11f7b2['count']=_0x3faf85;if(_0x420f46[_0x6d84('0x3a')][_0x6d84('0x48')]){_0xa33d1a[_0x6d84('0x49')]=[{'all':!![]}];}return db[_0x6d84('0x37')]['findAll'](_0xa33d1a);})['then'](function(_0x17ebeb){_0x11f7b2[_0x6d84('0x4a')]=_0x17ebeb;return _0x11f7b2;})[_0x6d84('0x33')](respondWithFilteredResult(_0x20ca2c,_0xa33d1a))['catch'](handleError(_0x20ca2c,null));};exports[_0x6d84('0x4b')]=function(_0x3283dd,_0x26a57a){var _0x505599={'raw':![],'where':{'id':_0x3283dd['params']['id']}},_0x329faa={};_0x329faa['model']=_[_0x6d84('0x3b')](db['VoiceQueue'][_0x6d84('0x4c')]);_0x329faa[_0x6d84('0x3a')]=_[_0x6d84('0x3b')](_0x3283dd['query']);_0x329faa[_0x6d84('0x3c')]=_[_0x6d84('0x3d')](_0x329faa['model'],_0x329faa[_0x6d84('0x3a')]);_0x505599[_0x6d84('0x3e')]=_[_0x6d84('0x3d')](_0x329faa[_0x6d84('0x39')],qs['fields'](_0x3283dd['query'][_0x6d84('0x3f')]));_0x505599[_0x6d84('0x3e')]=_0x505599[_0x6d84('0x3e')][_0x6d84('0x40')]?_0x505599['attributes']:_0x329faa[_0x6d84('0x39')];if(_0x3283dd[_0x6d84('0x3a')]['includeAll']){_0x505599[_0x6d84('0x49')]=[{'all':!![]}];}_0x505599=_[_0x6d84('0x45')]({},_0x505599,_0x3283dd[_0x6d84('0x47')]);return db['VoiceQueue']['find'](_0x505599)[_0x6d84('0x33')](handleEntityNotFound(_0x26a57a,null))[_0x6d84('0x33')](respondWithResult(_0x26a57a,null))['catch'](handleError(_0x26a57a,null));};exports[_0x6d84('0x4d')]=function(_0x116198,_0xe502d0){return db[_0x6d84('0x37')]['create'](_0x116198['body'],{})[_0x6d84('0x33')](function(_0x233a11){var _0xe6fb04=_0x116198[_0x6d84('0x4e')]['get']({'plain':!![]});if(!_0xe6fb04)throw new Error(_0x6d84('0x4f'));if(_0xe6fb04[_0x6d84('0x50')]===_0x6d84('0x4e')){var _0x1b0d39=_0x233a11[_0x6d84('0x28')]({'plain':!![]});var _0x1690ab=[{'name':_0x6d84('0x29'),'value':'inbound'},{'name':_0x6d84('0x2b'),'value':_0x6d84('0x2c')}];var _0x465c2c=_['find'](_0x1690ab,[_0x6d84('0x2f'),_0x1b0d39[_0x6d84('0x31')]])['name'];return db[_0x6d84('0x51')][_0x6d84('0x52')]({'where':{'name':_0x465c2c,'userProfileId':_0xe6fb04[_0x6d84('0x53')]},'raw':!![]})['then'](function(_0x38e4c3){if(_0x38e4c3&&_0x38e4c3[_0x6d84('0x54')]===0x0){return db[_0x6d84('0x32')]['create']({'name':_0x1b0d39[_0x6d84('0x35')],'resourceId':_0x1b0d39['id'],'type':_0x38e4c3[_0x6d84('0x35')],'sectionId':_0x38e4c3['id']},{})[_0x6d84('0x33')](function(){return _0x233a11;});}else{return _0x233a11;}})[_0x6d84('0x55')](function(_0x22a510){logger[_0x6d84('0x34')](_0x6d84('0x56'),_0x22a510);throw _0x22a510;});}return _0x233a11;})[_0x6d84('0x33')](respondWithResult(_0xe502d0,0xc9))['catch'](handleError(_0xe502d0,null));};exports[_0x6d84('0x57')]=function(_0x457036,_0x185b37){var _0x52c75d={'where':{'id':_0x457036[_0x6d84('0x58')]['id']}},_0x4e1c2e={};_0x4e1c2e['model']=_[_0x6d84('0x3b')](db['VoiceQueue'][_0x6d84('0x4c')]);_0x52c75d[_0x6d84('0x3e')]=_[_0x6d84('0x3d')](_0x4e1c2e[_0x6d84('0x39')],qs[_0x6d84('0x3f')](_0x457036[_0x6d84('0x3a')][_0x6d84('0x3f')]));_0x52c75d[_0x6d84('0x3e')]=_0x52c75d[_0x6d84('0x3e')]['length']?_0x52c75d[_0x6d84('0x3e')]:_0x4e1c2e[_0x6d84('0x39')];if(_0x457036[_0x6d84('0x3a')][_0x6d84('0x48')]){_0x52c75d[_0x6d84('0x49')]=[{'all':!![]}];}_0x52c75d=_['merge']({},_0x52c75d,_0x457036[_0x6d84('0x47')]);return db[_0x6d84('0x37')][_0x6d84('0x52')](_0x52c75d)['then'](handleEntityNotFound(_0x185b37,null))[_0x6d84('0x33')](function(_0x522742){if(_0x522742){var _0x3ea9eb=_0x522742[_0x6d84('0x28')]({'plain':!![]});_0x3ea9eb=qs[_0x6d84('0x59')](_0x3ea9eb,['id',_0x6d84('0x5a'),'updatedAt']);_0x457036[_0x6d84('0x5b')]=_['omit'](_0x457036[_0x6d84('0x5b')],['id','createdAt','updatedAt']);return db[_0x6d84('0x37')][_0x6d84('0x4d')](_[_0x6d84('0x45')](_0x3ea9eb,_0x457036[_0x6d84('0x5b')]),{'include':_0x457036[_0x6d84('0x3a')][_0x6d84('0x48')]?[{'all':!![]}]:undefined})[_0x6d84('0x33')](function(_0x1074b8){var _0x33ddf9=_0x457036[_0x6d84('0x4e')]['get']({'plain':!![]});if(!_0x33ddf9)throw new Error(_0x6d84('0x4f'));if(_0x33ddf9[_0x6d84('0x50')]===_0x6d84('0x4e')){var _0x346a9a=_0x1074b8[_0x6d84('0x28')]({'plain':!![]});var _0x3d4cde=[{'name':_0x6d84('0x29'),'value':_0x6d84('0x2a')},{'name':_0x6d84('0x2b'),'value':_0x6d84('0x2c')}];var _0x3909ec=_[_0x6d84('0x52')](_0x3d4cde,[_0x6d84('0x2f'),_0x346a9a['type']])[_0x6d84('0x35')];return db[_0x6d84('0x51')][_0x6d84('0x52')]({'where':{'name':_0x3909ec,'userProfileId':_0x33ddf9['userProfileId']},'raw':!![]})[_0x6d84('0x33')](function(_0x112c1c){if(_0x112c1c&&_0x112c1c['autoAssociation']===0x0){return db['UserProfileResource'][_0x6d84('0x4d')]({'name':_0x346a9a[_0x6d84('0x35')],'resourceId':_0x346a9a['id'],'type':_0x112c1c[_0x6d84('0x35')],'sectionId':_0x112c1c['id']},{})['then'](function(){return _0x1074b8;});}else{return _0x1074b8;}})[_0x6d84('0x55')](function(_0x1e5ec9){logger['error'](_0x6d84('0x56'),_0x1e5ec9);throw _0x1e5ec9;});}return _0x1074b8;});}})[_0x6d84('0x33')](respondWithResult(_0x185b37,0xc9))[_0x6d84('0x55')](handleError(_0x185b37,null));};exports[_0x6d84('0x5c')]=function(_0x413e90,_0x2f4f14){if(_0x413e90[_0x6d84('0x5b')]['id']){delete _0x413e90[_0x6d84('0x5b')]['id'];}return db[_0x6d84('0x37')][_0x6d84('0x52')]({'where':{'id':_0x413e90[_0x6d84('0x58')]['id']}})['then'](handleEntityNotFound(_0x2f4f14,null))[_0x6d84('0x33')](saveUpdates(_0x413e90[_0x6d84('0x5b')],null))['then'](respondWithResult(_0x2f4f14,null))[_0x6d84('0x55')](handleError(_0x2f4f14,null));};exports[_0x6d84('0x27')]=function(_0x4e23f7,_0x5e6794){return db[_0x6d84('0x37')][_0x6d84('0x52')]({'where':{'id':_0x4e23f7[_0x6d84('0x58')]['id']}})[_0x6d84('0x33')](handleEntityNotFound(_0x5e6794,null))[_0x6d84('0x33')](removeEntity(_0x5e6794,null))[_0x6d84('0x55')](handleError(_0x5e6794,null));};exports[_0x6d84('0x5d')]=function(_0x4abe9a,_0x4ab07c,_0x437033){var _0x3f9b97={'raw':![],'where':{}};var _0x30667d={};var _0x80ba2b={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x4abe9a[_0x6d84('0x58')]['id']}})[_0x6d84('0x33')](handleEntityNotFound(_0x4ab07c,null))['then'](function(_0xa2f2e){if(_0xa2f2e){_0x30667d['model']=_[_0x6d84('0x3b')](db[_0x6d84('0x5e')]['rawAttributes']);_0x30667d[_0x6d84('0x3a')]=_[_0x6d84('0x3b')](_0x4abe9a[_0x6d84('0x3a')]);_0x30667d[_0x6d84('0x3c')]=_[_0x6d84('0x3d')](_0x30667d['model'],_0x30667d['query']);_0x3f9b97[_0x6d84('0x3e')]=_[_0x6d84('0x3d')](_0x30667d[_0x6d84('0x39')],qs['fields'](_0x4abe9a[_0x6d84('0x3a')]['fields']));_0x3f9b97['attributes']=_0x3f9b97[_0x6d84('0x3e')][_0x6d84('0x40')]?_0x3f9b97[_0x6d84('0x3e')]:_0x30667d['model'];if(!_0x4abe9a[_0x6d84('0x3a')][_0x6d84('0x41')](_0x6d84('0x5f'))){_0x3f9b97[_0x6d84('0x24')]=qs['limit'](_0x4abe9a[_0x6d84('0x3a')]['limit']);_0x3f9b97['offset']=qs[_0x6d84('0x22')](_0x4abe9a[_0x6d84('0x3a')][_0x6d84('0x22')]);}_0x3f9b97[_0x6d84('0x60')]=qs[_0x6d84('0x42')](_0x4abe9a[_0x6d84('0x3a')][_0x6d84('0x42')]);_0x3f9b97[_0x6d84('0x43')]=qs[_0x6d84('0x3c')](_[_0x6d84('0x44')](_0x4abe9a[_0x6d84('0x3a')],_0x30667d[_0x6d84('0x3c')]));_0x3f9b97['where'][_0x6d84('0x61')]=_0xa2f2e['id'];if(_0x4abe9a[_0x6d84('0x3a')][_0x6d84('0x2d')]){_0x3f9b97['where']=_['merge'](_0x3f9b97['where'],{'$or':_['map'](_0x3f9b97[_0x6d84('0x3e')],function(_0x3610b2){var _0x278e5d={};_0x278e5d[_0x3610b2]={'$like':'%'+_0x4abe9a[_0x6d84('0x3a')][_0x6d84('0x2d')]+'%'};return _0x278e5d;})});}_0x3f9b97=_[_0x6d84('0x45')]({},_0x3f9b97,_0x4abe9a[_0x6d84('0x47')]);return db[_0x6d84('0x5e')][_0x6d84('0x25')]({'where':_0x3f9b97[_0x6d84('0x43')]})[_0x6d84('0x33')](function(_0x28aaba){_0x80ba2b[_0x6d84('0x25')]=_0x28aaba;if(_0x4abe9a[_0x6d84('0x3a')][_0x6d84('0x48')]){_0x3f9b97[_0x6d84('0x49')]=[{'all':!![]}];}return db['CmHopper'][_0x6d84('0x62')](_0x3f9b97);})[_0x6d84('0x33')](function(_0x2f14a3){_0x80ba2b[_0x6d84('0x4a')]=_0x2f14a3;return _0x80ba2b;});}})[_0x6d84('0x33')](respondWithFilteredResult(_0x4ab07c,_0x3f9b97))[_0x6d84('0x55')](handleError(_0x4ab07c,null));};exports[_0x6d84('0x63')]=function(_0x536bad,_0x38ad95,_0x205d46){var _0x213213={'raw':!![],'where':{}};var _0x1b6c5d={};var _0x592b56={'count':0x0,'rows':[]};return db[_0x6d84('0x37')][_0x6d84('0x64')]({'where':{'id':_0x536bad['params']['id']}})[_0x6d84('0x33')](handleEntityNotFound(_0x38ad95,null))[_0x6d84('0x33')](function(_0x5be788){if(_0x5be788){_0x1b6c5d[_0x6d84('0x39')]=_[_0x6d84('0x3b')](db[_0x6d84('0x65')][_0x6d84('0x4c')]);_0x1b6c5d[_0x6d84('0x3a')]=_[_0x6d84('0x3b')](_0x536bad[_0x6d84('0x3a')]);_0x1b6c5d[_0x6d84('0x3c')]=_[_0x6d84('0x3d')](_0x1b6c5d[_0x6d84('0x39')],_0x1b6c5d[_0x6d84('0x3a')]);_0x213213['attributes']=_[_0x6d84('0x3d')](_0x1b6c5d[_0x6d84('0x39')],qs[_0x6d84('0x3f')](_0x536bad[_0x6d84('0x3a')][_0x6d84('0x3f')]));_0x213213['attributes']=_0x213213[_0x6d84('0x3e')][_0x6d84('0x40')]?_0x213213['attributes']:_0x1b6c5d['model'];if(!_0x536bad[_0x6d84('0x3a')]['hasOwnProperty'](_0x6d84('0x5f'))){_0x213213[_0x6d84('0x24')]=qs[_0x6d84('0x24')](_0x536bad[_0x6d84('0x3a')][_0x6d84('0x24')]);_0x213213[_0x6d84('0x22')]=qs[_0x6d84('0x22')](_0x536bad['query'][_0x6d84('0x22')]);}_0x213213[_0x6d84('0x60')]=qs[_0x6d84('0x42')](_0x536bad[_0x6d84('0x3a')][_0x6d84('0x42')]);_0x213213[_0x6d84('0x43')]=qs[_0x6d84('0x3c')](_[_0x6d84('0x44')](_0x536bad['query'],_0x1b6c5d['filters']));_0x213213[_0x6d84('0x43')][_0x6d84('0x61')]=_0x5be788['id'];if(_0x536bad[_0x6d84('0x3a')][_0x6d84('0x2d')]){_0x213213['where']=_[_0x6d84('0x45')](_0x213213[_0x6d84('0x43')],{'$or':_[_0x6d84('0x2e')](_0x213213[_0x6d84('0x3e')],function(_0x512e4e){var _0x162ab2={};_0x162ab2[_0x512e4e]={'$like':'%'+_0x536bad[_0x6d84('0x3a')][_0x6d84('0x2d')]+'%'};return _0x162ab2;})});}_0x213213=_[_0x6d84('0x45')]({},_0x213213,_0x536bad[_0x6d84('0x47')]);return db[_0x6d84('0x65')]['count']({'where':_0x213213[_0x6d84('0x43')]})[_0x6d84('0x33')](function(_0xf1c703){_0x592b56[_0x6d84('0x25')]=_0xf1c703;if(_0x536bad[_0x6d84('0x3a')][_0x6d84('0x48')]){_0x213213[_0x6d84('0x49')]=[{'all':!![]}];}return db[_0x6d84('0x65')][_0x6d84('0x62')](_0x213213);})[_0x6d84('0x33')](function(_0x55b00a){_0x592b56[_0x6d84('0x4a')]=_0x55b00a;return _0x592b56;});}})['then'](respondWithFilteredResult(_0x38ad95,_0x213213))[_0x6d84('0x55')](handleError(_0x38ad95,null));};exports[_0x6d84('0x66')]=function(_0x210b95,_0x288cc3,_0x4741ba){var _0x236128={'raw':!![],'where':{}};var _0x2387f2={};var _0x3d680f={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x6d84('0x64')]({'where':{'id':_0x210b95[_0x6d84('0x58')]['id']}})[_0x6d84('0x33')](handleEntityNotFound(_0x288cc3,null))[_0x6d84('0x33')](function(_0x35f968){if(_0x35f968){_0x2387f2[_0x6d84('0x39')]=_[_0x6d84('0x3b')](db['CmHopperFinal'][_0x6d84('0x4c')]);_0x2387f2['query']=_['keys'](_0x210b95[_0x6d84('0x3a')]);_0x2387f2['filters']=_[_0x6d84('0x3d')](_0x2387f2[_0x6d84('0x39')],_0x2387f2['query']);_0x236128[_0x6d84('0x3e')]=_[_0x6d84('0x3d')](_0x2387f2['model'],qs[_0x6d84('0x3f')](_0x210b95[_0x6d84('0x3a')]['fields']));_0x236128[_0x6d84('0x3e')]=_0x236128['attributes'][_0x6d84('0x40')]?_0x236128['attributes']:_0x2387f2['model'];if(!_0x210b95[_0x6d84('0x3a')][_0x6d84('0x41')]('nolimit')){_0x236128['limit']=qs[_0x6d84('0x24')](_0x210b95['query'][_0x6d84('0x24')]);_0x236128[_0x6d84('0x22')]=qs[_0x6d84('0x22')](_0x210b95['query'][_0x6d84('0x22')]);}_0x236128[_0x6d84('0x60')]=qs[_0x6d84('0x42')](_0x210b95[_0x6d84('0x3a')][_0x6d84('0x42')]);_0x236128[_0x6d84('0x43')]=qs['filters'](_[_0x6d84('0x44')](_0x210b95[_0x6d84('0x3a')],_0x2387f2['filters']));_0x236128['where']['VoiceQueueId']=_0x35f968['id'];if(_0x210b95[_0x6d84('0x3a')][_0x6d84('0x2d')]){_0x236128[_0x6d84('0x43')]=_['merge'](_0x236128['where'],{'$or':_[_0x6d84('0x2e')](_0x236128[_0x6d84('0x3e')],function(_0x5ac627){var _0x38238a={};_0x38238a[_0x5ac627]={'$like':'%'+_0x210b95[_0x6d84('0x3a')][_0x6d84('0x2d')]+'%'};return _0x38238a;})});}_0x236128=_[_0x6d84('0x45')]({},_0x236128,_0x210b95[_0x6d84('0x47')]);return db[_0x6d84('0x67')][_0x6d84('0x25')]({'where':_0x236128[_0x6d84('0x43')]})['then'](function(_0x34f4d){_0x3d680f[_0x6d84('0x25')]=_0x34f4d;if(_0x210b95[_0x6d84('0x3a')][_0x6d84('0x48')]){_0x236128['include']=[{'all':!![]}];}return db[_0x6d84('0x67')][_0x6d84('0x62')](_0x236128);})['then'](function(_0x2a8547){_0x3d680f[_0x6d84('0x4a')]=_0x2a8547;return _0x3d680f;});}})['then'](respondWithFilteredResult(_0x288cc3,_0x236128))[_0x6d84('0x55')](handleError(_0x288cc3,null));};exports[_0x6d84('0x68')]=function(_0x1ae9f3,_0x2549a5,_0x44ef05){var _0xc61e7b={'raw':!![],'where':{}};var _0x443565={};var _0x2260ba={'count':0x0,'rows':[]};return db[_0x6d84('0x37')][_0x6d84('0x64')]({'where':{'id':_0x1ae9f3[_0x6d84('0x58')]['id']}})[_0x6d84('0x33')](handleEntityNotFound(_0x2549a5,null))[_0x6d84('0x33')](function(_0x2768e1){if(_0x2768e1){_0x443565[_0x6d84('0x39')]=_[_0x6d84('0x3b')](db[_0x6d84('0x69')]['rawAttributes']);_0x443565['query']=_[_0x6d84('0x3b')](_0x1ae9f3[_0x6d84('0x3a')]);_0x443565[_0x6d84('0x3c')]=_[_0x6d84('0x3d')](_0x443565[_0x6d84('0x39')],_0x443565[_0x6d84('0x3a')]);_0xc61e7b[_0x6d84('0x3e')]=_[_0x6d84('0x3d')](_0x443565[_0x6d84('0x39')],qs[_0x6d84('0x3f')](_0x1ae9f3[_0x6d84('0x3a')][_0x6d84('0x3f')]));_0xc61e7b['attributes']=_0xc61e7b['attributes'][_0x6d84('0x40')]?_0xc61e7b[_0x6d84('0x3e')]:_0x443565[_0x6d84('0x39')];if(!_0x1ae9f3[_0x6d84('0x3a')][_0x6d84('0x41')](_0x6d84('0x5f'))){_0xc61e7b[_0x6d84('0x24')]=qs[_0x6d84('0x24')](_0x1ae9f3[_0x6d84('0x3a')]['limit']);_0xc61e7b[_0x6d84('0x22')]=qs['offset'](_0x1ae9f3[_0x6d84('0x3a')][_0x6d84('0x22')]);}_0xc61e7b[_0x6d84('0x60')]=qs[_0x6d84('0x42')](_0x1ae9f3[_0x6d84('0x3a')][_0x6d84('0x42')]);_0xc61e7b[_0x6d84('0x43')]=qs[_0x6d84('0x3c')](_[_0x6d84('0x44')](_0x1ae9f3[_0x6d84('0x3a')],_0x443565[_0x6d84('0x3c')]));_0xc61e7b[_0x6d84('0x43')][_0x6d84('0x61')]=_0x2768e1['id'];if(_0x1ae9f3[_0x6d84('0x3a')][_0x6d84('0x2d')]){_0xc61e7b[_0x6d84('0x43')]=_[_0x6d84('0x45')](_0xc61e7b[_0x6d84('0x43')],{'$or':_['map'](_0xc61e7b[_0x6d84('0x3e')],function(_0x5f2bc9){var _0x24c024={};_0x24c024[_0x5f2bc9]={'$like':'%'+_0x1ae9f3[_0x6d84('0x3a')][_0x6d84('0x2d')]+'%'};return _0x24c024;})});}_0xc61e7b=_[_0x6d84('0x45')]({},_0xc61e7b,_0x1ae9f3['options']);return db['CmHopperBlack']['count']({'where':_0xc61e7b[_0x6d84('0x43')]})[_0x6d84('0x33')](function(_0x197361){_0x2260ba['count']=_0x197361;if(_0x1ae9f3['query'][_0x6d84('0x48')]){_0xc61e7b[_0x6d84('0x49')]=[{'all':!![]}];}return db[_0x6d84('0x69')][_0x6d84('0x62')](_0xc61e7b);})['then'](function(_0x52e3d1){_0x2260ba[_0x6d84('0x4a')]=_0x52e3d1;return _0x2260ba;});}})[_0x6d84('0x33')](respondWithFilteredResult(_0x2549a5,_0xc61e7b))[_0x6d84('0x55')](handleError(_0x2549a5,null));};exports[_0x6d84('0x6a')]=function(_0x387af4,_0x1a1357,_0x5b21f6){var _0x2b19c4={};var _0x28adac={};var _0x2b3969;var _0x4c409d;return db[_0x6d84('0x37')]['findOne']({'where':{'id':_0x387af4['params']['id']}})[_0x6d84('0x33')](handleEntityNotFound(_0x1a1357,null))[_0x6d84('0x33')](function(_0x28a04c){if(_0x28a04c){_0x2b3969=_0x28a04c;_0x28adac[_0x6d84('0x39')]=_['keys'](db[_0x6d84('0x6b')][_0x6d84('0x4c')]);_0x28adac['query']=_[_0x6d84('0x3b')](_0x387af4[_0x6d84('0x3a')]);_0x28adac[_0x6d84('0x3c')]=_['intersection'](_0x28adac[_0x6d84('0x39')],_0x28adac['query']);_0x2b19c4[_0x6d84('0x3e')]=_['intersection'](_0x28adac[_0x6d84('0x39')],qs[_0x6d84('0x3f')](_0x387af4[_0x6d84('0x3a')][_0x6d84('0x3f')]));_0x2b19c4['attributes']=_0x2b19c4[_0x6d84('0x3e')][_0x6d84('0x40')]?_0x2b19c4[_0x6d84('0x3e')]:_0x28adac['model'];_0x2b19c4['order']=qs[_0x6d84('0x42')](_0x387af4['query'][_0x6d84('0x42')]);_0x2b19c4['where']=qs[_0x6d84('0x3c')](_[_0x6d84('0x44')](_0x387af4[_0x6d84('0x3a')],_0x28adac[_0x6d84('0x3c')]));if(_0x387af4[_0x6d84('0x3a')][_0x6d84('0x2d')]){_0x2b19c4[_0x6d84('0x43')]=_['merge'](_0x2b19c4[_0x6d84('0x43')],{'$or':_['map'](_0x2b19c4['attributes'],function(_0x13ee3e){var _0x207fd0={};_0x207fd0[_0x13ee3e]={'$like':'%'+_0x387af4[_0x6d84('0x3a')]['filter']+'%'};return _0x207fd0;})});}_0x2b19c4=_[_0x6d84('0x45')]({},_0x2b19c4,_0x387af4[_0x6d84('0x47')]);return _0x2b3969['getTeams'](_0x2b19c4);}})[_0x6d84('0x33')](function(_0xf4c8cf){if(_0xf4c8cf){_0x4c409d=_0xf4c8cf[_0x6d84('0x40')];if(!_0x387af4[_0x6d84('0x3a')][_0x6d84('0x41')](_0x6d84('0x5f'))){_0x2b19c4['limit']=qs[_0x6d84('0x24')](_0x387af4['query'][_0x6d84('0x24')]);_0x2b19c4[_0x6d84('0x22')]=qs[_0x6d84('0x22')](_0x387af4[_0x6d84('0x3a')][_0x6d84('0x22')]);}return _0x2b3969['getTeams'](_0x2b19c4);}})[_0x6d84('0x33')](function(_0xe6358a){if(_0xe6358a){return _0xe6358a?{'count':_0x4c409d,'rows':_0xe6358a}:null;}})[_0x6d84('0x33')](respondWithResult(_0x1a1357,null))[_0x6d84('0x55')](handleError(_0x1a1357,null));};exports[_0x6d84('0x6c')]=function(_0x2104cd,_0x885935,_0x5ecf39){var _0x3a795d=_0x2104cd[_0x6d84('0x5b')]['teams'];var _0x119f2c=_['map'](_0x3a795d,'id');return db['Team']['findAll']({'where':{'id':_0x119f2c},'attributes':['id'],'include':[{'model':db[_0x6d84('0x6d')],'as':_0x6d84('0x6e'),'attributes':['id',_0x6d84('0x35'),'online',_0x6d84('0x6f'),_0x6d84('0x70')],'raw':!![]}]})[_0x6d84('0x33')](function(_0xf6be15){if(_0xf6be15){var _0x56eff6=_[_0x6d84('0x71')](_0xf6be15,function(_0x4b6b63){var _0x44eb85=_0x4b6b63[_0x6d84('0x28')]({'plain':!![]});_0x44eb85['Agents'][_0x6d84('0x72')](function(_0x2afa0a){_0x2afa0a['penalty']=_[_0x6d84('0x52')](_0x3a795d,{'id':_0x44eb85['id']})[_0x6d84('0x73')];});return _0x44eb85[_0x6d84('0x6e')];});return db['VoiceQueue'][_0x6d84('0x52')]({'where':{'id':_0x2104cd[_0x6d84('0x58')]['id']}})[_0x6d84('0x33')](function(_0x36983e){return db['sequelize'][_0x6d84('0x74')](function(_0x120540){return _0x36983e['addTeams'](_0x119f2c,{'transaction':_0x120540})[_0x6d84('0x33')](function(){return BPromise['each'](_0x3a795d,function(_0x32c782){return db[_0x6d84('0x75')][_0x6d84('0x76')]({'TeamId':_0x32c782['id'],'VoiceQueueId':_0x2104cd['params']['id'],'penalty':_0x32c782[_0x6d84('0x73')]},{'transaction':_0x120540});});})[_0x6d84('0x33')](function(){return BPromise[_0x6d84('0x77')](_0x56eff6,function(_0x242896){return db[_0x6d84('0x78')][_0x6d84('0x79')]({'where':{'UserId':_0x242896['id'],'VoiceQueueId':_0x2104cd[_0x6d84('0x58')]['id']},'defaults':{'penalty':_0x242896[_0x6d84('0x73')]},'transaction':_0x120540});});})[_0x6d84('0x33')](function(){return BPromise[_0x6d84('0x77')](_[_0x6d84('0x2d')](_0x56eff6,{'online':!![]}),function(_0x1262f7){return db['UserVoiceQueueRt'][_0x6d84('0x76')]({'membername':_0x1262f7[_0x6d84('0x35')],'UserId':_0x1262f7['id'],'queue_name':_0x36983e[_0x6d84('0x35')],'VoiceQueueId':_0x36983e['id'],'interface':_['isNil'](_0x1262f7[_0x6d84('0x70')])?util['format']('SIP/%s',_0x1262f7[_0x6d84('0x35')]):_0x1262f7['interface'],'paused':_0x1262f7[_0x6d84('0x6f')]||![],'penalty':_0x1262f7[_0x6d84('0x73')]},{'transaction':_0x120540});});})[_0x6d84('0x33')](function(){_0x56eff6[_0x6d84('0x72')](function(_0xc86feb){socket[_0x6d84('0x7a')]('userVoiceQueue:save',{'UserId':_0xc86feb['id'],'VoiceQueueId':_0x36983e['id']});});});});});}})['then'](respondWithStatusCode(_0x885935,null))[_0x6d84('0x55')](handleError(_0x885935,null));};exports['removeTeams']=function(_0x56a875,_0x5be805,_0x34c262){return db[_0x6d84('0x6b')][_0x6d84('0x62')]({'where':{'id':_0x56a875[_0x6d84('0x3a')][_0x6d84('0x7b')]},'attributes':['id'],'include':[{'model':db[_0x6d84('0x6d')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x6d84('0x33')](handleEntityNotFound(_0x5be805,null))[_0x6d84('0x33')](function(_0x1a90b6){var _0x561022=_['map'](_0x1a90b6,'id');var _0x5d9410=[];var _0x372c8c=[];var _0x17b267=squel[_0x6d84('0x7c')]();_0x17b267[_0x6d84('0x7d')](_0x6d84('0x7e'))[_0x6d84('0x7f')](_0x6d84('0x80'),'tq')[_0x6d84('0x81')](_0x6d84('0x82'),'ut',_0x6d84('0x83'))[_0x6d84('0x43')](_0x6d84('0x84'),_0x56a875[_0x6d84('0x58')]['id']);for(var _0x158735=0x0;_0x158735<_0x1a90b6[_0x6d84('0x40')];_0x158735+=0x1){let _0x393abe=_0x1a90b6[_0x158735];for(var _0x29fb5a=0x0;_0x29fb5a<_0x393abe['Agents'][_0x6d84('0x40')];_0x29fb5a+=0x1){let _0xd54a2b=_0x393abe[_0x6d84('0x6e')][_0x29fb5a];var _0x350435=_0x17b267['clone']();_0x350435[_0x6d84('0x43')](_0x6d84('0x85'),_0xd54a2b['id']);_0x372c8c['push'](db[_0x6d84('0x86')]['query'](_0x350435[_0x6d84('0x87')](),{'type':db[_0x6d84('0x86')][_0x6d84('0x88')][_0x6d84('0x89')]})[_0x6d84('0x33')](function(_0x29775a){if(_0x29775a['length']===0x1){return _0xd54a2b['id'];}else{var _0x393be5=_['every'](_[_0x6d84('0x2e')](_0x29775a,'TeamId'),function(_0x5e24f5){return _[_0x6d84('0x30')](_0x561022,_0x5e24f5);});if(_0x393be5){return _0xd54a2b['id'];}}}));}}return BPromise[_0x6d84('0x8a')](_0x372c8c)['then'](function(_0x510ee6){_0x5d9410=_(_0x5d9410)['union'](_0x510ee6)[_0x6d84('0x8b')]()[_0x6d84('0x2f')]();return db[_0x6d84('0x37')][_0x6d84('0x52')]({'where':{'id':_0x56a875['params']['id']}})[_0x6d84('0x33')](function(_0x5e5837){return db[_0x6d84('0x86')][_0x6d84('0x74')](function(_0x5c64ec){return _0x5e5837['removeTeams'](_0x56a875[_0x6d84('0x3a')][_0x6d84('0x7b')],{'transaction':_0x5c64ec})[_0x6d84('0x33')](function(){if(!_[_0x6d84('0x8c')](_0x5d9410)){return _0x5e5837[_0x6d84('0x8d')](_0x5d9410,{'transaction':_0x5c64ec})[_0x6d84('0x33')](function(){return db['UserVoiceQueueRt'][_0x6d84('0x27')]({'where':{'VoiceQueueId':_0x56a875[_0x6d84('0x58')]['id'],'UserId':_0x5d9410},'transaction':_0x5c64ec});});}})[_0x6d84('0x33')](function(){_0x5d9410[_0x6d84('0x72')](function(_0x8e78c8){socket[_0x6d84('0x7a')](_0x6d84('0x8e'),{'UserId':_0x8e78c8,'VoiceQueueId':_0x5e5837['id']});});});});});});})[_0x6d84('0x33')](respondWithStatusCode(_0x5be805,null))['catch'](handleError(_0x5be805,null));};exports[_0x6d84('0x8f')]=function(_0x33c608,_0x3956e4,_0x3bdbfe){var _0x3ce9a,_0xbc545a;return db[_0x6d84('0x37')][_0x6d84('0x52')]({'where':{'id':_0x33c608[_0x6d84('0x58')]['id']}})[_0x6d84('0x33')](handleEntityNotFound(_0x3956e4,null))[_0x6d84('0x33')](function(_0x3e88ff){if(_0x3e88ff){_0xbc545a=_0x3e88ff;return _0x3e88ff[_0x6d84('0x8f')](_0x33c608[_0x6d84('0x5b')][_0x6d84('0x7b')],_['omit'](_0x33c608[_0x6d84('0x5b')],[_0x6d84('0x7b'),'id'])||{})[_0x6d84('0x90')](function(_0x542aec){for(var _0x1312a2=0x0;_0x1312a2<_0x33c608[_0x6d84('0x5b')][_0x6d84('0x7b')][_0x6d84('0x40')];_0x1312a2+=0x1){socket[_0x6d84('0x7a')](_0x6d84('0x91'),{'UserId':Number(_0x33c608[_0x6d84('0x5b')][_0x6d84('0x7b')][_0x1312a2]),'VoiceQueueId':Number(_0x33c608[_0x6d84('0x58')]['id'])});}return _0x542aec;});}})[_0x6d84('0x33')](function(_0x796a79){_0x3ce9a=_0x796a79||[];if(_0xbc545a){return db['User'][_0x6d84('0x62')]({'where':{'id':_0x33c608[_0x6d84('0x5b')][_0x6d84('0x7b')]},'attributes':['id',_0x6d84('0x35'),'online',_0x6d84('0x6f'),_0x6d84('0x70')],'raw':!![]});}})[_0x6d84('0x33')](function(_0x54cc13){if(!_['isEmpty'](_0x54cc13)){var _0x504423=[];for(var _0x405b10=0x0;_0x405b10<_0x54cc13[_0x6d84('0x40')];_0x405b10++){if(_0x54cc13[_0x405b10][_0x6d84('0x92')]){_0x504423[_0x6d84('0x93')](db[_0x6d84('0x94')]['upsert']({'membername':_0x54cc13[_0x405b10][_0x6d84('0x35')],'UserId':_0x54cc13[_0x405b10]['id'],'queue_name':_0xbc545a[_0x6d84('0x35')],'VoiceQueueId':_0xbc545a['id'],'interface':_[_0x6d84('0x95')](_0x54cc13[_0x405b10][_0x6d84('0x70')])?util[_0x6d84('0x96')](_0x6d84('0x97'),_0x54cc13[_0x405b10][_0x6d84('0x35')]):_0x54cc13[_0x405b10]['interface'],'paused':_0x54cc13[_0x405b10][_0x6d84('0x6f')]||![],'penalty':_0x33c608[_0x6d84('0x5b')][_0x6d84('0x73')]||0x0}));}}return BPromise[_0x6d84('0x8a')](_0x504423);}})[_0x6d84('0x33')](function(){return _0x3ce9a;})[_0x6d84('0x33')](respondWithResult(_0x3956e4,null))['catch'](handleError(_0x3956e4,null));};exports[_0x6d84('0x8d')]=function(_0x331777,_0x21de24,_0x2fc2a0){return db[_0x6d84('0x37')][_0x6d84('0x52')]({'where':{'id':_0x331777[_0x6d84('0x58')]['id']}})[_0x6d84('0x33')](handleEntityNotFound(_0x21de24,null))[_0x6d84('0x33')](function(_0x315013){if(_0x315013){return _0x315013[_0x6d84('0x8d')](_0x331777[_0x6d84('0x3a')][_0x6d84('0x7b')])[_0x6d84('0x33')](function(){if(_[_0x6d84('0x98')](_0x331777['query'][_0x6d84('0x7b')])){for(var _0x18c92b=0x0;_0x18c92b<_0x331777[_0x6d84('0x3a')]['ids'][_0x6d84('0x40')];_0x18c92b+=0x1){socket[_0x6d84('0x7a')](_0x6d84('0x8e'),{'UserId':Number(_0x331777[_0x6d84('0x3a')]['ids'][_0x18c92b]),'VoiceQueueId':Number(_0x331777[_0x6d84('0x58')]['id'])});}}else{socket[_0x6d84('0x7a')](_0x6d84('0x8e'),{'UserId':Number(_0x331777[_0x6d84('0x3a')][_0x6d84('0x7b')]),'VoiceQueueId':Number(_0x331777[_0x6d84('0x58')]['id'])});}});}})['then'](function(_0x3d0167){return db[_0x6d84('0x94')][_0x6d84('0x27')]({'where':{'VoiceQueueId':_0x331777[_0x6d84('0x58')]['id'],'UserId':_0x331777['query'][_0x6d84('0x7b')]}})[_0x6d84('0x33')](function(){return _0x3d0167;});})[_0x6d84('0x33')](respondWithStatusCode(_0x21de24,null))[_0x6d84('0x55')](handleError(_0x21de24,null));};exports[_0x6d84('0x99')]=function(_0xe0eaf,_0x271497,_0x201cf5){var _0x138e78={};var _0x3ccc27={};var _0x1ddd8b;var _0x1d284e;return db[_0x6d84('0x37')]['findOne']({'where':{'id':_0xe0eaf['params']['id']}})['then'](handleEntityNotFound(_0x271497,null))[_0x6d84('0x33')](function(_0x389d56){if(_0x389d56){_0x1ddd8b=_0x389d56;_0x3ccc27[_0x6d84('0x39')]=_[_0x6d84('0x3b')](db[_0x6d84('0x6d')][_0x6d84('0x4c')]);_0x3ccc27[_0x6d84('0x3a')]=_[_0x6d84('0x3b')](_0xe0eaf['query']);_0x3ccc27[_0x6d84('0x3c')]=_['intersection'](_0x3ccc27[_0x6d84('0x39')],_0x3ccc27[_0x6d84('0x3a')]);_0x138e78[_0x6d84('0x3e')]=_[_0x6d84('0x3d')](_0x3ccc27[_0x6d84('0x39')],qs[_0x6d84('0x3f')](_0xe0eaf[_0x6d84('0x3a')][_0x6d84('0x3f')]));_0x138e78[_0x6d84('0x3e')]=_0x138e78[_0x6d84('0x3e')]['length']?_0x138e78[_0x6d84('0x3e')]:_0x3ccc27[_0x6d84('0x39')];_0x138e78[_0x6d84('0x60')]=qs['sort'](_0xe0eaf['query'][_0x6d84('0x42')]);_0x138e78[_0x6d84('0x43')]=qs[_0x6d84('0x3c')](_[_0x6d84('0x44')](_0xe0eaf['query'],_0x3ccc27[_0x6d84('0x3c')]));if(_0xe0eaf['query']['filter']){_0x138e78[_0x6d84('0x43')]=_[_0x6d84('0x45')](_0x138e78[_0x6d84('0x43')],{'$or':_[_0x6d84('0x2e')](_0x138e78[_0x6d84('0x3e')],function(_0x58cc30){var _0x46f249={};_0x46f249[_0x58cc30]={'$like':'%'+_0xe0eaf[_0x6d84('0x3a')][_0x6d84('0x2d')]+'%'};return _0x46f249;})});}_0x138e78=_[_0x6d84('0x45')]({},_0x138e78,_0xe0eaf['options']);return _0x1ddd8b[_0x6d84('0x99')](_0x138e78);}})[_0x6d84('0x33')](function(_0x37f922){if(_0x37f922){_0x1d284e=_0x37f922[_0x6d84('0x40')];if(!_0xe0eaf[_0x6d84('0x3a')][_0x6d84('0x41')](_0x6d84('0x5f'))){_0x138e78[_0x6d84('0x24')]=qs[_0x6d84('0x24')](_0xe0eaf[_0x6d84('0x3a')][_0x6d84('0x24')]);_0x138e78[_0x6d84('0x22')]=qs['offset'](_0xe0eaf[_0x6d84('0x3a')][_0x6d84('0x22')]);}return _0x1ddd8b[_0x6d84('0x99')](_0x138e78);}})[_0x6d84('0x33')](function(_0x5bc365){if(_0x5bc365){return _0x5bc365?{'count':_0x1d284e,'rows':_0x5bc365}:null;}})[_0x6d84('0x33')](respondWithResult(_0x271497,null))['catch'](handleError(_0x271497,null));};exports['getMembers']=function(_0x45380d,_0x4852d6,_0x279b61){var _0x11c98e={};var _0xcbe1e6={};var _0xc00459;var _0x2ff575;return db[_0x6d84('0x37')][_0x6d84('0x64')]({'where':{'id':_0x45380d[_0x6d84('0x58')]['id']}})[_0x6d84('0x33')](handleEntityNotFound(_0x4852d6,null))[_0x6d84('0x33')](function(_0x5e5f5c){if(_0x5e5f5c){_0xc00459=_0x5e5f5c;_0xcbe1e6[_0x6d84('0x39')]=_[_0x6d84('0x3b')](db['UserVoiceQueueRt'][_0x6d84('0x4c')]);_0xcbe1e6['query']=_[_0x6d84('0x3b')](_0x45380d['query']);_0xcbe1e6[_0x6d84('0x3c')]=_['intersection'](_0xcbe1e6[_0x6d84('0x39')],_0xcbe1e6[_0x6d84('0x3a')]);_0x11c98e[_0x6d84('0x3e')]=_[_0x6d84('0x3d')](_0xcbe1e6[_0x6d84('0x39')],qs[_0x6d84('0x3f')](_0x45380d['query']['fields']));_0x11c98e[_0x6d84('0x3e')]=_0x11c98e['attributes'][_0x6d84('0x40')]?_0x11c98e[_0x6d84('0x3e')]:_0xcbe1e6[_0x6d84('0x39')];_0x11c98e['order']=qs[_0x6d84('0x42')](_0x45380d[_0x6d84('0x3a')][_0x6d84('0x42')]);_0x11c98e[_0x6d84('0x43')]=qs['filters'](_['pick'](_0x45380d[_0x6d84('0x3a')],_0xcbe1e6['filters']));if(_0x45380d['query'][_0x6d84('0x2d')]){_0x11c98e[_0x6d84('0x43')]=_['merge'](_0x11c98e['where'],{'$or':_[_0x6d84('0x2e')](_0x11c98e[_0x6d84('0x3e')],function(_0x1a6c47){var _0x134081={};_0x134081[_0x1a6c47]={'$like':'%'+_0x45380d[_0x6d84('0x3a')][_0x6d84('0x2d')]+'%'};return _0x134081;})});}_0x11c98e=_[_0x6d84('0x45')]({},_0x11c98e,_0x45380d['options']);return _0xc00459[_0x6d84('0x9a')](_0x11c98e);}})[_0x6d84('0x33')](function(_0x25fd18){if(_0x25fd18){_0x2ff575=_0x25fd18[_0x6d84('0x40')];if(!_0x45380d['query']['hasOwnProperty']('nolimit')){_0x11c98e['limit']=qs[_0x6d84('0x24')](_0x45380d[_0x6d84('0x3a')]['limit']);_0x11c98e['offset']=qs[_0x6d84('0x22')](_0x45380d[_0x6d84('0x3a')][_0x6d84('0x22')]);}return _0xc00459[_0x6d84('0x9a')](_0x11c98e);}})[_0x6d84('0x33')](function(_0x858cc1){return _0x858cc1?{'count':_0x2ff575,'rows':_0x858cc1}:null;})['then'](respondWithResult(_0x4852d6,null))[_0x6d84('0x55')](handleError(_0x4852d6,null));};exports[_0x6d84('0x9b')]=function(_0xad92cf,_0xab54ed,_0xf63334){var _0x4f31b3={};var _0x46bc14={};var _0x22ccd4;var _0x188b29;return db['VoiceQueue'][_0x6d84('0x64')]({'where':{'id':_0xad92cf['params']['id']}})[_0x6d84('0x33')](handleEntityNotFound(_0xab54ed,null))['then'](function(_0x1a4e18){if(_0x1a4e18){_0x22ccd4=_0x1a4e18;_0x46bc14[_0x6d84('0x39')]=_[_0x6d84('0x3b')](db[_0x6d84('0x9c')][_0x6d84('0x4c')]);_0x46bc14[_0x6d84('0x3a')]=_[_0x6d84('0x3b')](_0xad92cf[_0x6d84('0x3a')]);_0x46bc14[_0x6d84('0x3c')]=_['intersection'](_0x46bc14[_0x6d84('0x39')],_0x46bc14[_0x6d84('0x3a')]);_0x4f31b3['attributes']=_[_0x6d84('0x3d')](_0x46bc14[_0x6d84('0x39')],qs['fields'](_0xad92cf[_0x6d84('0x3a')][_0x6d84('0x3f')]));_0x4f31b3[_0x6d84('0x3e')]=_0x4f31b3[_0x6d84('0x3e')][_0x6d84('0x40')]?_0x4f31b3[_0x6d84('0x3e')]:_0x46bc14[_0x6d84('0x39')];_0x4f31b3[_0x6d84('0x60')]=qs[_0x6d84('0x42')](_0xad92cf[_0x6d84('0x3a')][_0x6d84('0x42')]);_0x4f31b3[_0x6d84('0x43')]=qs['filters'](_[_0x6d84('0x44')](_0xad92cf[_0x6d84('0x3a')],_0x46bc14[_0x6d84('0x3c')]));if(_0xad92cf[_0x6d84('0x3a')][_0x6d84('0x2d')]){_0x4f31b3[_0x6d84('0x43')]=_['merge'](_0x4f31b3[_0x6d84('0x43')],{'$or':_[_0x6d84('0x2e')](_0x4f31b3[_0x6d84('0x3e')],function(_0x14c6aa){var _0x1141f8={};_0x1141f8[_0x14c6aa]={'$like':'%'+_0xad92cf[_0x6d84('0x3a')][_0x6d84('0x2d')]+'%'};return _0x1141f8;})});}_0x4f31b3=_['merge']({},_0x4f31b3,_0xad92cf[_0x6d84('0x47')]);return _0x22ccd4[_0x6d84('0x9b')](_0x4f31b3);}})[_0x6d84('0x33')](function(_0x3c400d){if(_0x3c400d){_0x188b29=_0x3c400d[_0x6d84('0x40')];if(!_0xad92cf[_0x6d84('0x3a')]['hasOwnProperty'](_0x6d84('0x5f'))){_0x4f31b3[_0x6d84('0x24')]=qs[_0x6d84('0x24')](_0xad92cf[_0x6d84('0x3a')][_0x6d84('0x24')]);_0x4f31b3[_0x6d84('0x22')]=qs['offset'](_0xad92cf[_0x6d84('0x3a')][_0x6d84('0x22')]);}return _0x22ccd4[_0x6d84('0x9b')](_0x4f31b3);}})['then'](function(_0x1857b0){if(_0x1857b0){return _0x1857b0?{'count':_0x188b29,'rows':_0x1857b0}:null;}})[_0x6d84('0x33')](respondWithResult(_0xab54ed,null))['catch'](handleError(_0xab54ed,null));};exports['addLists']=function(_0x47cd4b,_0x4cca36,_0x417ba1){var _0x167f6c,_0x25f6d5;return db['VoiceQueue'][_0x6d84('0x52')]({'where':{'id':_0x47cd4b[_0x6d84('0x58')]['id']}})[_0x6d84('0x33')](handleEntityNotFound(_0x4cca36,null))[_0x6d84('0x33')](function(_0x4f69a2){if(_0x4f69a2){_0x25f6d5=_0x4f69a2;return _0x4f69a2[_0x6d84('0x9d')](_0x47cd4b[_0x6d84('0x5b')][_0x6d84('0x7b')],_['omit'](_0x47cd4b[_0x6d84('0x5b')],[_0x6d84('0x7b'),'id'])||{});}return null;})['spread'](function(_0x296c60){var _0x52e721;_0x167f6c=_0x296c60||[];var _0x660bf3=[];if(_0x296c60){for(var _0x84d592=0x0;_0x84d592<_0x296c60[_0x6d84('0x40')];_0x84d592+=0x1){var _0x2e233c=_0x296c60[_0x84d592][_0x6d84('0x28')]({'plain':!![]});_0x25f6d5[_0x6d84('0x9e')]=_0x47cd4b[_0x6d84('0x5b')]['dialCheckDuplicateType']?_0x47cd4b['body'][_0x6d84('0x9e')]:_0x25f6d5['dialCheckDuplicateType'];switch(_0x25f6d5[_0x6d84('0x9e')]){case _0x6d84('0x9f'):_0x52e721=squel['insert']()[_0x6d84('0xa0')]('cm_hopper')[_0x6d84('0xa1')]([_0x6d84('0xa2'),_0x6d84('0xa3'),'ContactId',_0x6d84('0xa4'),'VoiceQueueId',_0x6d84('0x5a'),_0x6d84('0xa5')],squel[_0x6d84('0x7c')]()[_0x6d84('0x7d')]('phone',_0x6d84('0xa2'))[_0x6d84('0x7d')](_0x6d84('0xa6'),_0x6d84('0xa3'))[_0x6d84('0x7d')]('id',_0x6d84('0xa7'))[_0x6d84('0x7d')](_0x2e233c['CmListId'][_0x6d84('0x87')](),_0x6d84('0xa4'))[_0x6d84('0x7d')](_0x47cd4b[_0x6d84('0x58')]['id'][_0x6d84('0x87')](),_0x6d84('0x61'))['field'](_0x6d84('0xa6'),_0x6d84('0x5a'))[_0x6d84('0x7d')]('NOW()',_0x6d84('0xa5'))[_0x6d84('0x7f')](_0x6d84('0xa8'))[_0x6d84('0x43')](_0x6d84('0xa9'))[_0x6d84('0x43')](_0x6d84('0xaa'),_0x2e233c[_0x6d84('0xab')][_0x6d84('0x87')]())[_0x6d84('0x43')]('phone\x20IS\x20NOT\x20NULL')[_0x6d84('0x43')](_0x6d84('0xac'),squel[_0x6d84('0x7c')]()[_0x6d84('0x7d')](_0x6d84('0xad'))[_0x6d84('0x7f')](_0x6d84('0xae'))[_0x6d84('0x43')](_0x6d84('0x84'),_0x47cd4b['params']['id'][_0x6d84('0x87')]()))['where'](_0x6d84('0xac'),squel['select']()[_0x6d84('0x7d')](_0x6d84('0xaf'))[_0x6d84('0x7f')](_0x6d84('0xb0'))['where'](_0x6d84('0x84'),_0x47cd4b[_0x6d84('0x58')]['id'][_0x6d84('0x87')]())))[_0x6d84('0x87')]();break;case _0x6d84('0xb1'):_0x52e721=squel[_0x6d84('0xb2')]()[_0x6d84('0xa0')]('cm_hopper')[_0x6d84('0xa1')](['phone',_0x6d84('0xa3'),_0x6d84('0xa7'),_0x6d84('0xa4'),_0x6d84('0x61'),'createdAt',_0x6d84('0xa5')],squel[_0x6d84('0x7c')]()[_0x6d84('0x7d')](_0x6d84('0xa2'),'phone')[_0x6d84('0x7d')](_0x6d84('0xa6'),_0x6d84('0xa3'))[_0x6d84('0x7d')]('id',_0x6d84('0xa7'))[_0x6d84('0x7d')](_0x2e233c[_0x6d84('0xab')][_0x6d84('0x87')](),_0x6d84('0xa4'))[_0x6d84('0x7d')](_0x47cd4b['params']['id'][_0x6d84('0x87')](),_0x6d84('0x61'))[_0x6d84('0x7d')](_0x6d84('0xa6'),_0x6d84('0x5a'))[_0x6d84('0x7d')](_0x6d84('0xa6'),_0x6d84('0xa5'))[_0x6d84('0x7f')]('cm_contacts')[_0x6d84('0x43')]('deletedAt\x20IS\x20NULL')[_0x6d84('0x43')](_0x6d84('0xaa'),_0x2e233c[_0x6d84('0xab')][_0x6d84('0x87')]())[_0x6d84('0x43')](_0x6d84('0xb3'))[_0x6d84('0x43')](_0x6d84('0xac'),squel[_0x6d84('0x7c')]()['field'](_0x6d84('0xaf'))[_0x6d84('0x7f')](_0x6d84('0xb0'))[_0x6d84('0x43')](_0x6d84('0x84'),_0x47cd4b['params']['id']['toString']())))[_0x6d84('0x87')]();break;default:_0x52e721=squel[_0x6d84('0xb2')]()[_0x6d84('0xa0')](_0x6d84('0xb0'))[_0x6d84('0xa1')]([_0x6d84('0xa2'),_0x6d84('0xa3'),_0x6d84('0xa7'),_0x6d84('0xa4'),_0x6d84('0x61'),_0x6d84('0x5a'),'updatedAt'],squel[_0x6d84('0x7c')]()[_0x6d84('0x7d')]('phone',_0x6d84('0xa2'))[_0x6d84('0x7d')](_0x6d84('0xa6'),_0x6d84('0xa3'))[_0x6d84('0x7d')]('id',_0x6d84('0xa7'))[_0x6d84('0x7d')](_0x2e233c['CmListId']['toString'](),'ListId')[_0x6d84('0x7d')](_0x47cd4b[_0x6d84('0x58')]['id'][_0x6d84('0x87')](),_0x6d84('0x61'))['field'](_0x6d84('0xa6'),_0x6d84('0x5a'))[_0x6d84('0x7d')](_0x6d84('0xa6'),_0x6d84('0xa5'))[_0x6d84('0x7f')](_0x6d84('0xa8'))['where'](_0x6d84('0xa9'))[_0x6d84('0x43')](_0x6d84('0xaa'),_0x2e233c[_0x6d84('0xab')]['toString']())[_0x6d84('0x43')](_0x6d84('0xb3')))['toString']();}_0x660bf3[_0x6d84('0x93')](db[_0x6d84('0x86')][_0x6d84('0x3a')](_0x52e721));}return BPromise[_0x6d84('0x8a')](_0x660bf3);}})[_0x6d84('0x33')](function(){return _0x167f6c;})[_0x6d84('0x33')](respondWithResult(_0x4cca36,null))[_0x6d84('0x55')](handleError(_0x4cca36,null));};exports[_0x6d84('0xb4')]=function(_0x315779,_0x2ac886,_0x4c0116){return db['VoiceQueue'][_0x6d84('0x52')]({'where':{'id':_0x315779[_0x6d84('0x58')]['id']}})[_0x6d84('0x33')](handleEntityNotFound(_0x2ac886,null))[_0x6d84('0x33')](function(_0x13826f){if(_0x13826f){return _0x13826f[_0x6d84('0xb4')](_0x315779[_0x6d84('0x3a')]['ids']);}})[_0x6d84('0x33')](function(_0x4cb763){if(_0x4cb763){return db[_0x6d84('0x5e')][_0x6d84('0x27')]({'where':{'ListId':_0x315779[_0x6d84('0x3a')][_0x6d84('0x7b')],'VoiceQueueId':_0x315779['params']['id']}})[_0x6d84('0x33')](function(){return _0x4cb763;});}})[_0x6d84('0x33')](respondWithStatusCode(_0x2ac886,null))[_0x6d84('0x55')](handleError(_0x2ac886,null));};exports['getBlackLists']=function(_0x24914a,_0x2b9fe9,_0x11424c){var _0x503ef1={};var _0xd33469={};var _0x204d07;var _0x1db7fe;return db[_0x6d84('0x37')][_0x6d84('0x64')]({'where':{'id':_0x24914a[_0x6d84('0x58')]['id']}})[_0x6d84('0x33')](handleEntityNotFound(_0x2b9fe9,null))[_0x6d84('0x33')](function(_0x5b5304){if(_0x5b5304){_0x204d07=_0x5b5304;_0xd33469[_0x6d84('0x39')]=_[_0x6d84('0x3b')](db[_0x6d84('0x9c')][_0x6d84('0x4c')]);_0xd33469['query']=_[_0x6d84('0x3b')](_0x24914a[_0x6d84('0x3a')]);_0xd33469[_0x6d84('0x3c')]=_[_0x6d84('0x3d')](_0xd33469['model'],_0xd33469[_0x6d84('0x3a')]);_0x503ef1[_0x6d84('0x3e')]=_[_0x6d84('0x3d')](_0xd33469[_0x6d84('0x39')],qs['fields'](_0x24914a['query'][_0x6d84('0x3f')]));_0x503ef1[_0x6d84('0x3e')]=_0x503ef1['attributes'][_0x6d84('0x40')]?_0x503ef1['attributes']:_0xd33469[_0x6d84('0x39')];_0x503ef1['order']=qs[_0x6d84('0x42')](_0x24914a['query']['sort']);_0x503ef1[_0x6d84('0x43')]=qs[_0x6d84('0x3c')](_['pick'](_0x24914a['query'],_0xd33469[_0x6d84('0x3c')]));if(_0x24914a[_0x6d84('0x3a')][_0x6d84('0x2d')]){_0x503ef1['where']=_[_0x6d84('0x45')](_0x503ef1[_0x6d84('0x43')],{'$or':_[_0x6d84('0x2e')](_0x503ef1['attributes'],function(_0x3d2dea){var _0x141e5a={};_0x141e5a[_0x3d2dea]={'$like':'%'+_0x24914a[_0x6d84('0x3a')][_0x6d84('0x2d')]+'%'};return _0x141e5a;})});}_0x503ef1=_['merge']({},_0x503ef1,_0x24914a[_0x6d84('0x47')]);return _0x204d07[_0x6d84('0xb5')](_0x503ef1);}})[_0x6d84('0x33')](function(_0x1c7ec5){if(_0x1c7ec5){_0x1db7fe=_0x1c7ec5[_0x6d84('0x40')];if(!_0x24914a[_0x6d84('0x3a')][_0x6d84('0x41')]('nolimit')){_0x503ef1[_0x6d84('0x24')]=qs[_0x6d84('0x24')](_0x24914a[_0x6d84('0x3a')][_0x6d84('0x24')]);_0x503ef1[_0x6d84('0x22')]=qs[_0x6d84('0x22')](_0x24914a[_0x6d84('0x3a')]['offset']);}return _0x204d07[_0x6d84('0xb5')](_0x503ef1);}})[_0x6d84('0x33')](function(_0x6d8ed0){if(_0x6d8ed0){return _0x6d8ed0?{'count':_0x1db7fe,'rows':_0x6d8ed0}:null;}})[_0x6d84('0x33')](respondWithResult(_0x2b9fe9,null))['catch'](handleError(_0x2b9fe9,null));};exports[_0x6d84('0xb6')]=function(_0x36b5cd,_0x4a56fd,_0x6ec72a){var _0x373e87,_0x2b0629;return db[_0x6d84('0x37')][_0x6d84('0x52')]({'where':{'id':_0x36b5cd[_0x6d84('0x58')]['id']}})['then'](handleEntityNotFound(_0x4a56fd,null))[_0x6d84('0x33')](function(_0x1d1b70){if(_0x1d1b70){_0x2b0629=_0x1d1b70;return _0x1d1b70[_0x6d84('0xb6')](_0x36b5cd['body'][_0x6d84('0x7b')],_[_0x6d84('0x59')](_0x36b5cd[_0x6d84('0x5b')],[_0x6d84('0x7b'),'id'])||{});}return null;})['spread'](function(_0x238116){var _0x5dd42e;_0x373e87=_0x238116||[];var _0x84f8d0=[];if(_0x238116){for(var _0x11cf69=0x0;_0x11cf69<_0x238116[_0x6d84('0x40')];_0x11cf69+=0x1){var _0x1c2598=_0x238116[_0x11cf69]['get']({'plain':!![]});_0x5dd42e=squel[_0x6d84('0xb2')]()[_0x6d84('0xa0')](_0x6d84('0xb7'))[_0x6d84('0xa1')]([_0x6d84('0xa2'),_0x6d84('0xa7'),'ListId','VoiceQueueId',_0x6d84('0x5a'),_0x6d84('0xa5')],squel[_0x6d84('0x7c')]()[_0x6d84('0x7d')](_0x6d84('0xa2'),_0x6d84('0xa2'))[_0x6d84('0x7d')]('id',_0x6d84('0xa7'))['field'](_0x1c2598[_0x6d84('0xab')][_0x6d84('0x87')](),'ListId')[_0x6d84('0x7d')](_0x36b5cd[_0x6d84('0x58')]['id'][_0x6d84('0x87')](),'VoiceQueueId')[_0x6d84('0x7d')](_0x6d84('0xa6'),_0x6d84('0x5a'))[_0x6d84('0x7d')](_0x6d84('0xa6'),_0x6d84('0xa5'))[_0x6d84('0x7f')]('cm_contacts')['where'](_0x6d84('0xa9'))[_0x6d84('0x43')]('ListId\x20=\x20?',_0x1c2598[_0x6d84('0xab')][_0x6d84('0x87')]())[_0x6d84('0x43')](_0x6d84('0xb3')))['toString']();_0x84f8d0[_0x6d84('0x93')](db['sequelize']['query'](_0x5dd42e));}return BPromise[_0x6d84('0x8a')](_0x84f8d0);}})['then'](function(){return _0x373e87;})[_0x6d84('0x33')](respondWithResult(_0x4a56fd,null))[_0x6d84('0x55')](handleError(_0x4a56fd,null));};exports[_0x6d84('0xb8')]=function(_0x4b8358,_0x897928,_0x254448){return db[_0x6d84('0x37')][_0x6d84('0x52')]({'where':{'id':_0x4b8358['params']['id']}})[_0x6d84('0x33')](handleEntityNotFound(_0x897928,null))[_0x6d84('0x33')](function(_0x1e2da9){if(_0x1e2da9){return _0x1e2da9['removeBlackLists'](_0x4b8358['query'][_0x6d84('0x7b')]);}})[_0x6d84('0x33')](function(_0xa4fc4a){if(_0xa4fc4a){return db[_0x6d84('0x69')][_0x6d84('0x27')]({'where':{'ListId':_0x4b8358[_0x6d84('0x3a')][_0x6d84('0x7b')],'VoiceQueueId':_0x4b8358[_0x6d84('0x58')]['id']}})[_0x6d84('0x33')](function(){return _0xa4fc4a;});}})[_0x6d84('0x33')](respondWithStatusCode(_0x897928,null))['catch'](handleError(_0x897928,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index b5857f8..3dd46f3 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 _0x85d1=['emit','hook','exports','events','../../mysqldb','VoiceQueue','setMaxListeners','update'];(function(_0x2feb81,_0x3ff7f2){var _0x5c416f=function(_0x34d9b2){while(--_0x34d9b2){_0x2feb81['push'](_0x2feb81['shift']());}};_0x5c416f(++_0x3ff7f2);}(_0x85d1,0x19b));var _0x185d=function(_0x93942f,_0xb48547){_0x93942f=_0x93942f-0x0;var _0x23fcd8=_0x85d1[_0x93942f];return _0x23fcd8;};'use strict';var EventEmitter=require(_0x185d('0x0'));var VoiceQueue=require(_0x185d('0x1'))['db'][_0x185d('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x185d('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x185d('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2af4ba){return function(_0x336521,_0x539fde,_0xac849e){VoiceQueueEvents[_0x185d('0x5')](_0x2af4ba+':'+_0x336521['id'],_0x336521);VoiceQueueEvents[_0x185d('0x5')](_0x2af4ba,_0x336521);_0xac849e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue[_0x185d('0x6')](e,emitEvent(event));}}module[_0x185d('0x7')]=VoiceQueueEvents; \ No newline at end of file +var _0x2e18=['remove','hasOwnProperty','hook','exports','VoiceQueue','setMaxListeners'];(function(_0x4fe6f1,_0x386a7a){var _0x338075=function(_0x36fd1d){while(--_0x36fd1d){_0x4fe6f1['push'](_0x4fe6f1['shift']());}};_0x338075(++_0x386a7a);}(_0x2e18,0x166));var _0x82e1=function(_0x36ed3c,_0x44a00a){_0x36ed3c=_0x36ed3c-0x0;var _0x52a2e0=_0x2e18[_0x36ed3c];return _0x52a2e0;};'use strict';var EventEmitter=require('events');var VoiceQueue=require('../../mysqldb')['db'][_0x82e1('0x0')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x82e1('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x82e1('0x2')};function emitEvent(_0x502dc0){return function(_0x132422,_0x3652f1,_0x265786){VoiceQueueEvents['emit'](_0x502dc0+':'+_0x132422['id'],_0x132422);VoiceQueueEvents['emit'](_0x502dc0,_0x132422);_0x265786(null);};}for(var e in events){if(events[_0x82e1('0x3')](e)){var event=events[e];VoiceQueue[_0x82e1('0x4')](e,emitEvent(event));}}module[_0x82e1('0x5')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index f246850..37a6a2b 100644 --- a/server/api/voiceQueue/voiceQueue.model.js +++ b/server/api/voiceQueue/voiceQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['exports','VoiceQueue','voice_queues','lodash','../../config/logger','api','moment','path','../../config/environment','./voiceQueue.attributes'];(function(_0x4c6f44,_0x413a03){var _0x5ee4b9=function(_0x61a78c){while(--_0x61a78c){_0x4c6f44['push'](_0x4c6f44['shift']());}};_0x5ee4b9(++_0x413a03);}(_0x3e74,0x175));var _0x43e7=function(_0x2ef7ed,_0x3f36f5){_0x2ef7ed=_0x2ef7ed-0x0;var _0x4e3c57=_0x3e74[_0x2ef7ed];return _0x4e3c57;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var logger=require(_0x43e7('0x1'))(_0x43e7('0x2'));var moment=require(_0x43e7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x43e7('0x4'));var rimraf=require('rimraf');var config=require(_0x43e7('0x5'));var attributes=require(_0x43e7('0x6'));module[_0x43e7('0x7')]=function(_0x1c503b,_0xc98b9c){return _0x1c503b['define'](_0x43e7('0x8'),attributes,{'tableName':_0x43e7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x70e0=['voice_queues','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','./voiceQueue.attributes'];(function(_0x7d4593,_0xd66d60){var _0x440c23=function(_0x2d83a4){while(--_0x2d83a4){_0x7d4593['push'](_0x7d4593['shift']());}};_0x440c23(++_0xd66d60);}(_0x70e0,0x17b));var _0x070e=function(_0x522e24,_0x1bd68b){_0x522e24=_0x522e24-0x0;var _0x18d370=_0x70e0[_0x522e24];return _0x18d370;};'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 d5f1766..bae4ad8 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 _0x12aa=['VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','VoiceQueue','findAll','options','attributes','include','map','model','info','GetVoiceQueue','ShowVoiceQueue','raw','lodash','util','moment','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./voiceQueue.socket','request','then'];(function(_0x55b9dc,_0x2c7227){var _0x15d404=function(_0x5e3a1e){while(--_0x5e3a1e){_0x55b9dc['push'](_0x55b9dc['shift']());}};_0x15d404(++_0x2c7227);}(_0x12aa,0x1db));var _0xa12a=function(_0x591758,_0x910e05){_0x591758=_0x591758-0x0;var _0x166bfb=_0x12aa[_0x591758];return _0x166bfb;};'use strict';var _=require(_0xa12a('0x0'));var util=require(_0xa12a('0x1'));var moment=require(_0xa12a('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa12a('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xa12a('0x4'));var logger=require('../../config/logger')(_0xa12a('0x5'));var config=require(_0xa12a('0x6'));var jayson=require(_0xa12a('0x7'));var client=jayson[_0xa12a('0x8')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0xa12a('0x9')],{'host':_0xa12a('0xa'),'port':0x18eb});var socket=require(_0xa12a('0xb'))(new Redis(config[_0xa12a('0x9')]));require(_0xa12a('0xc'))['register'](socket);function respondWithRpcPromise(_0x2724f5,_0x1e8b52,_0x3a5308){return new BPromise(function(_0x4a9cbc,_0x4ec95d){return client[_0xa12a('0xd')](_0x2724f5,_0x3a5308)[_0xa12a('0xe')](function(_0x1cd057){logger['info'](_0xa12a('0xf'),_0x1e8b52,_0xa12a('0x10'));logger[_0xa12a('0x11')]('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x1e8b52,_0xa12a('0x10'),JSON[_0xa12a('0x12')](_0x1cd057));if(_0x1cd057[_0xa12a('0x13')]){if(_0x1cd057['error'][_0xa12a('0x14')]===0x1f4){logger['error']('VoiceQueue,\x20%s,\x20%s',_0x1e8b52,_0x1cd057['error'][_0xa12a('0x15')]);return _0x4ec95d(_0x1cd057[_0xa12a('0x13')][_0xa12a('0x15')]);}logger['error'](_0xa12a('0xf'),_0x1e8b52,_0x1cd057[_0xa12a('0x13')][_0xa12a('0x15')]);return _0x4a9cbc(_0x1cd057['error']['message']);}else{logger['info'](_0xa12a('0xf'),_0x1e8b52,'request\x20sent');_0x4a9cbc(_0x1cd057[_0xa12a('0x16')]['message']);}})[_0xa12a('0x17')](function(_0x21ac27){logger['error']('VoiceQueue,\x20%s,\x20%s',_0x1e8b52,_0x21ac27);_0x4ec95d(_0x21ac27);});});}exports['GetVoiceQueue']=function(_0xcec68e){var _0x4cf030=this;return new Promise(function(_0x5d2382,_0x57e55b){return db[_0xa12a('0x18')][_0xa12a('0x19')]({'raw':_0xcec68e[_0xa12a('0x1a')]?_0xcec68e[_0xa12a('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0xcec68e[_0xa12a('0x1a')]?_0xcec68e[_0xa12a('0x1a')]['where']||null:null,'attributes':_0xcec68e[_0xa12a('0x1a')]?_0xcec68e['options'][_0xa12a('0x1b')]||null:null,'limit':_0xcec68e[_0xa12a('0x1a')]?_0xcec68e[_0xa12a('0x1a')]['limit']||null:null,'include':_0xcec68e[_0xa12a('0x1a')]?_0xcec68e['options'][_0xa12a('0x1c')]?_[_0xa12a('0x1d')](_0xcec68e[_0xa12a('0x1a')][_0xa12a('0x1c')],function(_0x524f29){return{'model':db[_0x524f29[_0xa12a('0x1e')]],'as':_0x524f29['as'],'attributes':_0x524f29[_0xa12a('0x1b')],'include':_0x524f29[_0xa12a('0x1c')]?_[_0xa12a('0x1d')](_0x524f29[_0xa12a('0x1c')],function(_0x3a33a7){return{'model':db[_0x3a33a7['model']],'as':_0x3a33a7['as'],'attributes':_0x3a33a7[_0xa12a('0x1b')],'include':_0x3a33a7[_0xa12a('0x1c')]?_['map'](_0x3a33a7[_0xa12a('0x1c')],function(_0x4b68c9){return{'model':db[_0x4b68c9[_0xa12a('0x1e')]],'as':_0x4b68c9['as'],'attributes':_0x4b68c9['attributes']};}):[]};}):[]};}):[]:[]})[_0xa12a('0xe')](function(_0x3826e3){logger[_0xa12a('0x1f')](_0xa12a('0x20'),_0xcec68e);logger[_0xa12a('0x11')](_0xa12a('0x20'),_0xcec68e,JSON[_0xa12a('0x12')](_0x3826e3));_0x5d2382(_0x3826e3);})[_0xa12a('0x17')](function(_0x4c817d){logger['error']('GetVoiceQueue',_0x4c817d[_0xa12a('0x15')],_0xcec68e);_0x57e55b(_0x4cf030['error'](0x1f4,_0x4c817d[_0xa12a('0x15')]));});});};exports[_0xa12a('0x21')]=function(_0x3d7a91){var _0x3fa74f=this;return new Promise(function(_0x5b2f3f,_0x2d6e66){return db[_0xa12a('0x18')]['find']({'raw':_0x3d7a91[_0xa12a('0x1a')]?_0x3d7a91[_0xa12a('0x1a')][_0xa12a('0x22')]===undefined?!![]:![]:!![],'where':_0x3d7a91[_0xa12a('0x1a')]?_0x3d7a91[_0xa12a('0x1a')]['where']||null:null,'attributes':_0x3d7a91[_0xa12a('0x1a')]?_0x3d7a91[_0xa12a('0x1a')]['attributes']||null:null,'include':_0x3d7a91['options']?_0x3d7a91['options']['include']?_[_0xa12a('0x1d')](_0x3d7a91[_0xa12a('0x1a')][_0xa12a('0x1c')],function(_0x327652){return{'model':db[_0x327652[_0xa12a('0x1e')]],'as':_0x327652['as'],'attributes':_0x327652[_0xa12a('0x1b')],'include':_0x327652[_0xa12a('0x1c')]?_[_0xa12a('0x1d')](_0x327652[_0xa12a('0x1c')],function(_0x58702a){return{'model':db[_0x58702a[_0xa12a('0x1e')]],'as':_0x58702a['as'],'attributes':_0x58702a[_0xa12a('0x1b')],'include':_0x58702a[_0xa12a('0x1c')]?_[_0xa12a('0x1d')](_0x58702a[_0xa12a('0x1c')],function(_0x459260){return{'model':db[_0x459260['model']],'as':_0x459260['as'],'attributes':_0x459260[_0xa12a('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x183392){logger[_0xa12a('0x1f')](_0xa12a('0x21'),_0x3d7a91);logger[_0xa12a('0x11')]('ShowVoiceQueue',_0x3d7a91,JSON[_0xa12a('0x12')](_0x183392));_0x5b2f3f(_0x183392);})[_0xa12a('0x17')](function(_0x225071){logger[_0xa12a('0x13')](_0xa12a('0x21'),_0x225071['message'],_0x3d7a91);_0x2d6e66(_0x3fa74f[_0xa12a('0x13')](0x1f4,_0x225071[_0xa12a('0x15')]));});});}; \ No newline at end of file +var _0x4372=['catch','VoiceQueue','findAll','options','raw','where','attributes','limit','include','map','model','then','GetVoiceQueue','find','ShowVoiceQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','request','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x22ecc4,_0x18d57a){var _0x33fc57=function(_0x4090ac){while(--_0x4090ac){_0x22ecc4['push'](_0x22ecc4['shift']());}};_0x33fc57(++_0x18d57a);}(_0x4372,0x1bc));var _0x2437=function(_0xce9195,_0x1963e1){_0xce9195=_0xce9195-0x0;var _0x530fe6=_0x4372[_0xce9195];return _0x530fe6;};'use strict';var _=require(_0x2437('0x0'));var util=require(_0x2437('0x1'));var moment=require(_0x2437('0x2'));var BPromise=require(_0x2437('0x3'));var rs=require(_0x2437('0x4'));var fs=require('fs');var Redis=require(_0x2437('0x5'));var db=require(_0x2437('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x2437('0x7'));var jayson=require(_0x2437('0x8'));var client=jayson['client'][_0x2437('0x9')]({'port':0x232a});config[_0x2437('0xa')]=_['defaults'](config[_0x2437('0xa')],{'host':_0x2437('0xb'),'port':0x18eb});var socket=require(_0x2437('0xc'))(new Redis(config[_0x2437('0xa')]));require('./voiceQueue.socket')['register'](socket);function respondWithRpcPromise(_0x508322,_0x33356f,_0x432c1e){return new BPromise(function(_0x3abbb7,_0x4147a1){return client[_0x2437('0xd')](_0x508322,_0x432c1e)['then'](function(_0x283a21){logger[_0x2437('0xe')](_0x2437('0xf'),_0x33356f,_0x2437('0x10'));logger[_0x2437('0x11')](_0x2437('0x12'),_0x33356f,_0x2437('0x10'),JSON[_0x2437('0x13')](_0x283a21));if(_0x283a21[_0x2437('0x14')]){if(_0x283a21[_0x2437('0x14')][_0x2437('0x15')]===0x1f4){logger[_0x2437('0x14')](_0x2437('0xf'),_0x33356f,_0x283a21['error']['message']);return _0x4147a1(_0x283a21[_0x2437('0x14')]['message']);}logger[_0x2437('0x14')](_0x2437('0xf'),_0x33356f,_0x283a21[_0x2437('0x14')][_0x2437('0x16')]);return _0x3abbb7(_0x283a21['error']['message']);}else{logger['info'](_0x2437('0xf'),_0x33356f,_0x2437('0x10'));_0x3abbb7(_0x283a21[_0x2437('0x17')]['message']);}})[_0x2437('0x18')](function(_0x20b808){logger['error'](_0x2437('0xf'),_0x33356f,_0x20b808);_0x4147a1(_0x20b808);});});}exports['GetVoiceQueue']=function(_0x2cfab3){var _0x12bca2=this;return new Promise(function(_0x4df0ba,_0x292acc){return db[_0x2437('0x19')][_0x2437('0x1a')]({'raw':_0x2cfab3[_0x2437('0x1b')]?_0x2cfab3[_0x2437('0x1b')][_0x2437('0x1c')]===undefined?!![]:![]:!![],'where':_0x2cfab3[_0x2437('0x1b')]?_0x2cfab3['options'][_0x2437('0x1d')]||null:null,'attributes':_0x2cfab3[_0x2437('0x1b')]?_0x2cfab3[_0x2437('0x1b')][_0x2437('0x1e')]||null:null,'limit':_0x2cfab3[_0x2437('0x1b')]?_0x2cfab3['options'][_0x2437('0x1f')]||null:null,'include':_0x2cfab3[_0x2437('0x1b')]?_0x2cfab3[_0x2437('0x1b')][_0x2437('0x20')]?_[_0x2437('0x21')](_0x2cfab3[_0x2437('0x1b')][_0x2437('0x20')],function(_0x54cb11){return{'model':db[_0x54cb11[_0x2437('0x22')]],'as':_0x54cb11['as'],'attributes':_0x54cb11['attributes'],'include':_0x54cb11[_0x2437('0x20')]?_['map'](_0x54cb11[_0x2437('0x20')],function(_0x10f081){return{'model':db[_0x10f081[_0x2437('0x22')]],'as':_0x10f081['as'],'attributes':_0x10f081[_0x2437('0x1e')],'include':_0x10f081[_0x2437('0x20')]?_[_0x2437('0x21')](_0x10f081[_0x2437('0x20')],function(_0x4f246d){return{'model':db[_0x4f246d[_0x2437('0x22')]],'as':_0x4f246d['as'],'attributes':_0x4f246d[_0x2437('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x2437('0x23')](function(_0xa64c6){logger[_0x2437('0xe')](_0x2437('0x24'),_0x2cfab3);logger[_0x2437('0x11')](_0x2437('0x24'),_0x2cfab3,JSON[_0x2437('0x13')](_0xa64c6));_0x4df0ba(_0xa64c6);})[_0x2437('0x18')](function(_0x51e74b){logger[_0x2437('0x14')](_0x2437('0x24'),_0x51e74b[_0x2437('0x16')],_0x2cfab3);_0x292acc(_0x12bca2[_0x2437('0x14')](0x1f4,_0x51e74b[_0x2437('0x16')]));});});};exports['ShowVoiceQueue']=function(_0x14c394){var _0x45109a=this;return new Promise(function(_0x5b253f,_0x3304af){return db[_0x2437('0x19')][_0x2437('0x25')]({'raw':_0x14c394['options']?_0x14c394['options'][_0x2437('0x1c')]===undefined?!![]:![]:!![],'where':_0x14c394[_0x2437('0x1b')]?_0x14c394[_0x2437('0x1b')][_0x2437('0x1d')]||null:null,'attributes':_0x14c394['options']?_0x14c394[_0x2437('0x1b')][_0x2437('0x1e')]||null:null,'include':_0x14c394[_0x2437('0x1b')]?_0x14c394['options'][_0x2437('0x20')]?_[_0x2437('0x21')](_0x14c394['options'][_0x2437('0x20')],function(_0x506ea4){return{'model':db[_0x506ea4[_0x2437('0x22')]],'as':_0x506ea4['as'],'attributes':_0x506ea4[_0x2437('0x1e')],'include':_0x506ea4[_0x2437('0x20')]?_[_0x2437('0x21')](_0x506ea4[_0x2437('0x20')],function(_0x1f4ac0){return{'model':db[_0x1f4ac0[_0x2437('0x22')]],'as':_0x1f4ac0['as'],'attributes':_0x1f4ac0[_0x2437('0x1e')],'include':_0x1f4ac0['include']?_[_0x2437('0x21')](_0x1f4ac0[_0x2437('0x20')],function(_0x44ca27){return{'model':db[_0x44ca27[_0x2437('0x22')]],'as':_0x44ca27['as'],'attributes':_0x44ca27['attributes']};}):[]};}):[]};}):[]:[]})[_0x2437('0x23')](function(_0x34157b){logger[_0x2437('0xe')](_0x2437('0x26'),_0x14c394);logger[_0x2437('0x11')](_0x2437('0x26'),_0x14c394,JSON[_0x2437('0x13')](_0x34157b));_0x5b253f(_0x34157b);})['catch'](function(_0x3839e1){logger[_0x2437('0x14')](_0x2437('0x26'),_0x3839e1[_0x2437('0x16')],_0x14c394);_0x3304af(_0x45109a[_0x2437('0x14')](0x1f4,_0x3839e1[_0x2437('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 99fce0f..3aef2f0 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 _0xf77f=['./voiceQueue.events','save','update','emit','removeListener','register','length','voiceQueue:'];(function(_0x3cddb7,_0x5a2426){var _0x495471=function(_0x1f176b){while(--_0x1f176b){_0x3cddb7['push'](_0x3cddb7['shift']());}};_0x495471(++_0x5a2426);}(_0xf77f,0x1c8));var _0xff77=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xf77f[_0x433a86];return _0x23000c;};'use strict';var VoiceQueueEvents=require(_0xff77('0x0'));var events=[_0xff77('0x1'),'remove',_0xff77('0x2')];function createListener(_0x308a6b,_0xdc06ff){return function(_0x3ab6af){_0xdc06ff[_0xff77('0x3')](_0x308a6b,_0x3ab6af);};}function removeListener(_0x505f9,_0x4d79c8){return function(){VoiceQueueEvents[_0xff77('0x4')](_0x505f9,_0x4d79c8);};}exports[_0xff77('0x5')]=function(_0x13cd78){for(var _0x793c84=0x0,_0x2facc2=events[_0xff77('0x6')];_0x793c84<_0x2facc2;_0x793c84++){var _0x311153=events[_0x793c84];var _0x56ca86=createListener(_0xff77('0x7')+_0x311153,_0x13cd78);VoiceQueueEvents['on'](_0x311153,_0x56ca86);}}; \ No newline at end of file +var _0x288a=['update','emit','removeListener','register','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x288a,0x1e9));var _0xa288=function(_0x2cf50d,_0x12d3c2){_0x2cf50d=_0x2cf50d-0x0;var _0x257c6e=_0x288a[_0x2cf50d];return _0x257c6e;};'use strict';var VoiceQueueEvents=require('./voiceQueue.events');var events=[_0xa288('0x0'),'remove',_0xa288('0x1')];function createListener(_0x468c4b,_0x4e77e4){return function(_0x5b0bcd){_0x4e77e4[_0xa288('0x2')](_0x468c4b,_0x5b0bcd);};}function removeListener(_0x30cf62,_0x174c59){return function(){VoiceQueueEvents[_0xa288('0x3')](_0x30cf62,_0x174c59);};}exports[_0xa288('0x4')]=function(_0x5dbf1c){for(var _0x27444d=0x0,_0x318064=events['length'];_0x27444d<_0x318064;_0x27444d++){var _0xa8dce9=events[_0x27444d];var _0x3dda86=createListener('voiceQueue:'+_0xa8dce9,_0x5dbf1c);VoiceQueueEvents['on'](_0xa8dce9,_0x3dda86);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 1cf7085..c404f57 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 _0xe80c=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','isAuthenticated','index','get','/describe','describe','/index','/:id','show','put','update','exports','multer','util','path'];(function(_0xb6e9e9,_0x19d56f){var _0x2d183a=function(_0x55204e){while(--_0x55204e){_0xb6e9e9['push'](_0xb6e9e9['shift']());}};_0x2d183a(++_0x19d56f);}(_0xe80c,0x10e));var _0xce80=function(_0x1bd2d7,_0x2572c5){_0x1bd2d7=_0x1bd2d7-0x0;var _0x58b751=_0xe80c[_0x1bd2d7];return _0x58b751;};'use strict';var multer=require(_0xce80('0x0'));var util=require(_0xce80('0x1'));var path=require(_0xce80('0x2'));var timeout=require(_0xce80('0x3'));var express=require(_0xce80('0x4'));var router=express['Router']();var fs_extra=require(_0xce80('0x5'));var auth=require(_0xce80('0x6'));var interaction=require(_0xce80('0x7'));var config=require(_0xce80('0x8'));var controller=require(_0xce80('0x9'));router['get']('/',auth[_0xce80('0xa')](),controller[_0xce80('0xb')]);router[_0xce80('0xc')](_0xce80('0xd'),auth[_0xce80('0xa')](),controller[_0xce80('0xe')]);router[_0xce80('0xc')](_0xce80('0xf'),auth[_0xce80('0xa')](),controller['getVoiceQueuesReport']);router[_0xce80('0xc')](_0xce80('0x10'),auth[_0xce80('0xa')](),controller[_0xce80('0x11')]);router['post']('/',auth[_0xce80('0xa')](),controller['create']);router[_0xce80('0x12')](_0xce80('0x10'),auth[_0xce80('0xa')](),controller[_0xce80('0x13')]);router['delete']('/:id',auth[_0xce80('0xa')](),controller['destroy']);module[_0xce80('0x14')]=router; \ No newline at end of file +var _0xfbc6=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','isAuthenticated','get','describe','/index','getVoiceQueuesReport','/:id','show','post','create','delete','destroy','multer','util','Router'];(function(_0x5e3701,_0x596265){var _0x345dcf=function(_0x5eb12a){while(--_0x5eb12a){_0x5e3701['push'](_0x5e3701['shift']());}};_0x345dcf(++_0x596265);}(_0xfbc6,0x1d8));var _0x6fbc=function(_0x429a21,_0x43b4e0){_0x429a21=_0x429a21-0x0;var _0x3a8c04=_0xfbc6[_0x429a21];return _0x3a8c04;};'use strict';var multer=require(_0x6fbc('0x0'));var util=require(_0x6fbc('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6fbc('0x2')]();var fs_extra=require(_0x6fbc('0x3'));var auth=require(_0x6fbc('0x4'));var interaction=require(_0x6fbc('0x5'));var config=require(_0x6fbc('0x6'));var controller=require(_0x6fbc('0x7'));router['get']('/',auth[_0x6fbc('0x8')](),controller['index']);router[_0x6fbc('0x9')]('/describe',auth[_0x6fbc('0x8')](),controller[_0x6fbc('0xa')]);router['get'](_0x6fbc('0xb'),auth['isAuthenticated'](),controller[_0x6fbc('0xc')]);router[_0x6fbc('0x9')](_0x6fbc('0xd'),auth['isAuthenticated'](),controller[_0x6fbc('0xe')]);router[_0x6fbc('0xf')]('/',auth[_0x6fbc('0x8')](),controller[_0x6fbc('0x10')]);router['put'](_0x6fbc('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x6fbc('0x11')](_0x6fbc('0xd'),auth[_0x6fbc('0x8')](),controller[_0x6fbc('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 1c96db2..89dd16e 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 _0x8565=['diff','setDataValue','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','moment','exports','STRING','DATE','getDataValue','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x59091a,_0x4766f8){var _0x26503e=function(_0x2051e){while(--_0x2051e){_0x59091a['push'](_0x59091a['shift']());}};_0x26503e(++_0x4766f8);}(_0x8565,0x1c0));var _0x5856=function(_0x38f559,_0xba9f1c){_0x38f559=_0x38f559-0x0;var _0xc1a535=_0x8565[_0x38f559];return _0xc1a535;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x5856('0x0'));module[_0x5856('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x5856('0x2')]},'calleridnum':{'type':Sequelize[_0x5856('0x2')]},'calleridname':{'type':Sequelize[_0x5856('0x2')]},'queue':{'type':Sequelize[_0x5856('0x2')]},'queuecallerjoinAt':{'type':Sequelize[_0x5856('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0x5856('0x3')],'set':function(_0x1be678){var _0x2ba400=moment(_0x1be678);var _0x4b16a2=moment(this[_0x5856('0x4')]('queuecallerjoinAt'))[_0x5856('0x5')](_0x5856('0x6'));var _0x597033=_0x2ba400[_0x5856('0x7')](_0x4b16a2,'seconds');this[_0x5856('0x8')]('queuecallerleaveAt',_0x1be678);this['setDataValue']('holdtime',_0x597033||null);}},'position':{'type':Sequelize[_0x5856('0x9')]},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize[_0x5856('0xa')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x5856('0x3')]},'queuecallercomplete':{'type':Sequelize[_0x5856('0xa')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x5856('0x3')]},'queuecallerexit':{'type':Sequelize[_0x5856('0xa')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x5856('0x3')]},'queuecallerexitreason':{'type':Sequelize['STRING'],'comment':_0x5856('0xb')},'originalposition':{'type':Sequelize[_0x5856('0x9')]},'channel':{'type':Sequelize[_0x5856('0x2')]},'connectedlinenum':{'type':Sequelize[_0x5856('0x2')]},'connectedlinename':{'type':Sequelize[_0x5856('0x2')]},'accountcode':{'type':Sequelize[_0x5856('0x2')]},'context':{'type':Sequelize[_0x5856('0x2')]},'exten':{'type':Sequelize[_0x5856('0x2')]},'priority':{'type':Sequelize[_0x5856('0x2')]},'holdtime':{'type':Sequelize[_0x5856('0x9')]},'mohtime':{'type':Sequelize[_0x5856('0x9')],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x5856('0x2')]},'transfer':{'type':Sequelize[_0x5856('0xa')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x5856('0x2')],'comment':_0x5856('0xc')},'transferexten':{'type':Sequelize[_0x5856('0x2')]},'transferuniqueid':{'type':Sequelize[_0x5856('0x2')]},'disposition':{'type':Sequelize[_0x5856('0x2')]},'secondDisposition':{'type':Sequelize[_0x5856('0x2')]},'thirdDisposition':{'type':Sequelize[_0x5856('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0x5856('0x9')],'defaultValue':0x0}}; \ No newline at end of file +var _0xcc07=['INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','sequelize','moment','exports','STRING','DATE','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','seconds','setDataValue','queuecallerleaveAt','holdtime'];(function(_0x349367,_0x1cede2){var _0x14179b=function(_0x38a191){while(--_0x38a191){_0x349367['push'](_0x349367['shift']());}};_0x14179b(++_0x1cede2);}(_0xcc07,0xb3));var _0x7cc0=function(_0x24679e,_0x22d9d7){_0x24679e=_0x24679e-0x0;var _0x291f21=_0xcc07[_0x24679e];return _0x291f21;};'use strict';var Sequelize=require(_0x7cc0('0x0'));var moment=require(_0x7cc0('0x1'));module[_0x7cc0('0x2')]={'type':{'type':Sequelize[_0x7cc0('0x3')]},'uniqueid':{'type':Sequelize[_0x7cc0('0x3')]},'calleridnum':{'type':Sequelize[_0x7cc0('0x3')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize[_0x7cc0('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0x7cc0('0x4')],'set':function(_0x3d5e9a){var _0x4f5de5=moment(_0x3d5e9a);var _0x4ca927=moment(this[_0x7cc0('0x5')](_0x7cc0('0x6')))[_0x7cc0('0x7')](_0x7cc0('0x8'));var _0x4e3398=_0x4f5de5['diff'](_0x4ca927,_0x7cc0('0x9'));this[_0x7cc0('0xa')](_0x7cc0('0xb'),_0x3d5e9a);this['setDataValue'](_0x7cc0('0xc'),_0x4e3398||null);}},'position':{'type':Sequelize[_0x7cc0('0xd')]},'count':{'type':Sequelize[_0x7cc0('0xd')]},'queuecallerabandon':{'type':Sequelize[_0x7cc0('0xe')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x7cc0('0x4')]},'queuecallercomplete':{'type':Sequelize[_0x7cc0('0xe')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x7cc0('0x4')]},'queuecallerexitreason':{'type':Sequelize['STRING'],'comment':_0x7cc0('0xf')},'originalposition':{'type':Sequelize[_0x7cc0('0xd')]},'channel':{'type':Sequelize[_0x7cc0('0x3')]},'connectedlinenum':{'type':Sequelize[_0x7cc0('0x3')]},'connectedlinename':{'type':Sequelize[_0x7cc0('0x3')]},'accountcode':{'type':Sequelize[_0x7cc0('0x3')]},'context':{'type':Sequelize[_0x7cc0('0x3')]},'exten':{'type':Sequelize[_0x7cc0('0x3')]},'priority':{'type':Sequelize[_0x7cc0('0x3')]},'holdtime':{'type':Sequelize[_0x7cc0('0xd')]},'mohtime':{'type':Sequelize[_0x7cc0('0xd')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x7cc0('0xe')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x7cc0('0xe')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x7cc0('0x3')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x7cc0('0x3')]},'transferuniqueid':{'type':Sequelize[_0x7cc0('0x3')]},'disposition':{'type':Sequelize[_0x7cc0('0x3')]},'secondDisposition':{'type':Sequelize[_0x7cc0('0x3')]},'thirdDisposition':{'type':Sequelize[_0x7cc0('0x3')]},'queuecallerenterreason':{'type':Sequelize[_0x7cc0('0xd')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index 97852fc..0086d06 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 _0x0439=['describe','pick','getVoiceQueuesReport','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','fs-extra','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','defaults','redis','localhost','socket.io-emitter','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','VoiceQueueReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','length','nolimit','order','sort','where','filter','merge','includeAll','include','findAll','rows','catch','show','params','keys','fields','options','create','body','find'];(function(_0xce66dc,_0xb4c0b){var _0x4dd12f=function(_0x35ea77){while(--_0x35ea77){_0xce66dc['push'](_0xce66dc['shift']());}};_0x4dd12f(++_0xb4c0b);}(_0x0439,0x18e));var _0x9043=function(_0x23ef1f,_0x127dd2){_0x23ef1f=_0x23ef1f-0x0;var _0x234192=_0x0439[_0x23ef1f];return _0x234192;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9043('0x0'));var zipdir=require(_0x9043('0x1'));var jsonpatch=require(_0x9043('0x2'));var rp=require(_0x9043('0x3'));var moment=require(_0x9043('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9043('0x5'));var util=require(_0x9043('0x6'));var path=require('path');var sox=require(_0x9043('0x7'));var csv=require(_0x9043('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9043('0x9'));var _=require('lodash');var squel=require(_0x9043('0xa'));var crypto=require(_0x9043('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x9043('0x8'));var querystring=require('querystring');var Papa=require(_0x9043('0xc'));var Redis=require(_0x9043('0xd'));var authService=require(_0x9043('0xe'));var qs=require(_0x9043('0xf'));var as=require(_0x9043('0x10'));var hardwareService=require(_0x9043('0x11'));var logger=require(_0x9043('0x12'))(_0x9043('0x13'));var utils=require(_0x9043('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0x9043('0x15')](config[_0x9043('0x16')],{'host':_0x9043('0x17'),'port':0x18eb});var socket=require(_0x9043('0x18'))(new Redis(config['redis']));require('./voiceQueueReport.socket')['register'](socket);function respondWithStatusCode(_0x190a49,_0x1a2d59){_0x1a2d59=_0x1a2d59||0xcc;return function(_0xea1162){if(_0xea1162){return _0x190a49[_0x9043('0x19')](_0x1a2d59);}return _0x190a49[_0x9043('0x1a')](_0x1a2d59)[_0x9043('0x1b')]();};}function respondWithResult(_0x3a6a3a,_0x537467){_0x537467=_0x537467||0xc8;return function(_0x4dc14a){if(_0x4dc14a){return _0x3a6a3a[_0x9043('0x1a')](_0x537467)[_0x9043('0x1c')](_0x4dc14a);}};}function respondWithFilteredResult(_0x396a6d,_0x78335e){return function(_0xa677ef){if(_0xa677ef){var _0x377284=typeof _0x78335e[_0x9043('0x1d')]===_0x9043('0x1e')&&typeof _0x78335e[_0x9043('0x1f')]===_0x9043('0x1e');var _0x29e135=_0xa677ef[_0x9043('0x20')];var _0x4a8890=_0x377284?0x0:_0x78335e[_0x9043('0x1d')];var _0x28fc01=_0x377284?_0xa677ef[_0x9043('0x20')]:_0x78335e[_0x9043('0x1d')]+_0x78335e[_0x9043('0x1f')];var _0x4de774;if(_0x28fc01>=_0x29e135){_0x28fc01=_0x29e135;_0x4de774=0xc8;}else{_0x4de774=0xce;}_0x396a6d[_0x9043('0x1a')](_0x4de774);return _0x396a6d[_0x9043('0x21')](_0x9043('0x22'),_0x4a8890+'-'+_0x28fc01+'/'+_0x29e135)['json'](_0xa677ef);}return null;};}function patchUpdates(_0x50c55e){return function(_0x5071da){try{jsonpatch['apply'](_0x5071da,_0x50c55e,!![]);}catch(_0x4b4922){return BPromise[_0x9043('0x23')](_0x4b4922);}return _0x5071da[_0x9043('0x24')]();};}function saveUpdates(_0x39f858,_0x4070ae){return function(_0x44893d){if(_0x44893d){return _0x44893d[_0x9043('0x25')](_0x39f858)[_0x9043('0x26')](function(_0x11b068){return _0x11b068;});}return null;};}function removeEntity(_0x3c470f,_0x3bf2c8){return function(_0x40d69b){if(_0x40d69b){return _0x40d69b[_0x9043('0x27')]()[_0x9043('0x26')](function(){_0x3c470f[_0x9043('0x1a')](0xcc)[_0x9043('0x1b')]();});}};}function handleEntityNotFound(_0x25a943,_0xa1cdf){return function(_0x4382a9){if(!_0x4382a9){_0x25a943['sendStatus'](0x194);}return _0x4382a9;};}function handleError(_0x37b20d,_0x30ec10){_0x30ec10=_0x30ec10||0x1f4;return function(_0x6ebe16){logger[_0x9043('0x28')](_0x6ebe16[_0x9043('0x29')]);if(_0x6ebe16['name']){delete _0x6ebe16[_0x9043('0x2a')];}_0x37b20d[_0x9043('0x1a')](_0x30ec10)[_0x9043('0x2b')](_0x6ebe16);};}exports[_0x9043('0x2c')]=function(_0x499002,_0x5bc7bb){var _0x7661c0={},_0x1b47f5={},_0x3da055={'count':0x0,'rows':[]};var _0x45ecc3=_[_0x9043('0x2d')](db[_0x9043('0x2e')][_0x9043('0x2f')],function(_0x10eb6a){return{'name':_0x10eb6a[_0x9043('0x30')],'type':_0x10eb6a[_0x9043('0x31')][_0x9043('0x32')]};});_0x1b47f5[_0x9043('0x33')]=_['map'](_0x45ecc3,'name');_0x1b47f5[_0x9043('0x34')]=_['keys'](_0x499002[_0x9043('0x34')]);_0x1b47f5[_0x9043('0x35')]=_[_0x9043('0x36')](_0x1b47f5[_0x9043('0x33')],_0x1b47f5['query']);_0x7661c0[_0x9043('0x37')]=_[_0x9043('0x36')](_0x1b47f5[_0x9043('0x33')],qs['fields'](_0x499002[_0x9043('0x34')]['fields']));_0x7661c0['attributes']=_0x7661c0['attributes'][_0x9043('0x38')]?_0x7661c0[_0x9043('0x37')]:_0x1b47f5['model'];if(!_0x499002[_0x9043('0x34')]['hasOwnProperty'](_0x9043('0x39'))){_0x7661c0[_0x9043('0x1f')]=qs['limit'](_0x499002[_0x9043('0x34')]['limit']);_0x7661c0[_0x9043('0x1d')]=qs['offset'](_0x499002[_0x9043('0x34')]['offset']);}_0x7661c0[_0x9043('0x3a')]=qs[_0x9043('0x3b')](_0x499002[_0x9043('0x34')][_0x9043('0x3b')]);_0x7661c0[_0x9043('0x3c')]=qs[_0x9043('0x35')](_['pick'](_0x499002[_0x9043('0x34')],_0x1b47f5[_0x9043('0x35')]),_0x45ecc3);if(_0x499002[_0x9043('0x34')][_0x9043('0x3d')]){_0x7661c0[_0x9043('0x3c')]=_[_0x9043('0x3e')](_0x7661c0[_0x9043('0x3c')],{'$or':_[_0x9043('0x2d')](_0x45ecc3,function(_0x599a73){if(_0x599a73['type']!=='VIRTUAL'){var _0x426747={};_0x426747[_0x599a73['name']]={'$like':'%'+_0x499002[_0x9043('0x34')][_0x9043('0x3d')]+'%'};return _0x426747;}})});}_0x7661c0=_[_0x9043('0x3e')]({},_0x7661c0,_0x499002['options']);var _0x51a538={'where':_0x7661c0[_0x9043('0x3c')]};return db['VoiceQueueReport'][_0x9043('0x20')](_0x51a538)[_0x9043('0x26')](function(_0xcb6187){_0x3da055[_0x9043('0x20')]=_0xcb6187;if(_0x499002['query'][_0x9043('0x3f')]){_0x7661c0[_0x9043('0x40')]=[{'all':!![]}];}return db[_0x9043('0x2e')][_0x9043('0x41')](_0x7661c0);})[_0x9043('0x26')](function(_0x236045){_0x3da055[_0x9043('0x42')]=_0x236045;return _0x3da055;})['then'](respondWithFilteredResult(_0x5bc7bb,_0x7661c0))[_0x9043('0x43')](handleError(_0x5bc7bb,null));};exports[_0x9043('0x44')]=function(_0x183fa6,_0x1cc5e4){var _0x295c0d={'raw':![],'where':{'id':_0x183fa6[_0x9043('0x45')]['id']}},_0x58b17f={};_0x58b17f['model']=_[_0x9043('0x46')](db[_0x9043('0x2e')]['rawAttributes']);_0x58b17f[_0x9043('0x34')]=_['keys'](_0x183fa6['query']);_0x58b17f[_0x9043('0x35')]=_['intersection'](_0x58b17f[_0x9043('0x33')],_0x58b17f[_0x9043('0x34')]);_0x295c0d[_0x9043('0x37')]=_[_0x9043('0x36')](_0x58b17f[_0x9043('0x33')],qs['fields'](_0x183fa6[_0x9043('0x34')][_0x9043('0x47')]));_0x295c0d[_0x9043('0x37')]=_0x295c0d[_0x9043('0x37')][_0x9043('0x38')]?_0x295c0d[_0x9043('0x37')]:_0x58b17f['model'];if(_0x183fa6['query'][_0x9043('0x3f')]){_0x295c0d[_0x9043('0x40')]=[{'all':!![]}];}_0x295c0d=_['merge']({},_0x295c0d,_0x183fa6[_0x9043('0x48')]);return db[_0x9043('0x2e')]['find'](_0x295c0d)[_0x9043('0x26')](handleEntityNotFound(_0x1cc5e4,null))[_0x9043('0x26')](respondWithResult(_0x1cc5e4,null))[_0x9043('0x43')](handleError(_0x1cc5e4,null));};exports[_0x9043('0x49')]=function(_0x1391a6,_0x307782){return db['VoiceQueueReport'][_0x9043('0x49')](_0x1391a6[_0x9043('0x4a')],{})[_0x9043('0x26')](respondWithResult(_0x307782,0xc9))[_0x9043('0x43')](handleError(_0x307782,null));};exports[_0x9043('0x25')]=function(_0x5ae2d1,_0x3bb551){if(_0x5ae2d1[_0x9043('0x4a')]['id']){delete _0x5ae2d1['body']['id'];}return db[_0x9043('0x2e')][_0x9043('0x4b')]({'where':{'id':_0x5ae2d1[_0x9043('0x45')]['id']}})[_0x9043('0x26')](handleEntityNotFound(_0x3bb551,null))[_0x9043('0x26')](saveUpdates(_0x5ae2d1['body'],null))['then'](respondWithResult(_0x3bb551,null))[_0x9043('0x43')](handleError(_0x3bb551,null));};exports[_0x9043('0x27')]=function(_0x1332a6,_0x50561d){return db[_0x9043('0x2e')]['find']({'where':{'id':_0x1332a6[_0x9043('0x45')]['id']}})[_0x9043('0x26')](handleEntityNotFound(_0x50561d,null))[_0x9043('0x26')](removeEntity(_0x50561d,null))['catch'](handleError(_0x50561d,null));};exports[_0x9043('0x4c')]=function(_0x4ff573,_0x53594e){return db[_0x9043('0x2e')][_0x9043('0x4c')]()[_0x9043('0x26')](respondWithResult(_0x53594e,null))[_0x9043('0x43')](handleError(_0x53594e,null));};exports['getVoiceQueuesReport']=function(_0x3c101b,_0x3b9596){var _0xef3f7c={},_0xaa7783={},_0x35081d={'count':0x0,'rows':[]};_0xaa7783[_0x9043('0x33')]=_[_0x9043('0x46')](db[_0x9043('0x2e')][_0x9043('0x2f')]);_0xaa7783[_0x9043('0x34')]=_[_0x9043('0x46')](_0x3c101b[_0x9043('0x34')]);_0xaa7783[_0x9043('0x35')]=_[_0x9043('0x36')](_0xaa7783['model'],_0xaa7783[_0x9043('0x34')]);_0xef3f7c[_0x9043('0x37')]=_[_0x9043('0x36')](_0xaa7783[_0x9043('0x33')],qs['fields'](_0x3c101b[_0x9043('0x34')][_0x9043('0x47')]));_0xef3f7c[_0x9043('0x37')]=_0xef3f7c['attributes'][_0x9043('0x38')]?_0xef3f7c[_0x9043('0x37')]:_0xaa7783[_0x9043('0x33')];if(!_0x3c101b[_0x9043('0x34')]['hasOwnProperty'](_0x9043('0x39'))){_0xef3f7c['limit']=qs[_0x9043('0x1f')](_0x3c101b[_0x9043('0x34')]['limit']);_0xef3f7c[_0x9043('0x1d')]=qs[_0x9043('0x1d')](_0x3c101b[_0x9043('0x34')][_0x9043('0x1d')]);}_0xef3f7c[_0x9043('0x3a')]=qs[_0x9043('0x3b')](_0x3c101b[_0x9043('0x34')][_0x9043('0x3b')]);_0xef3f7c[_0x9043('0x3c')]=qs[_0x9043('0x35')](_[_0x9043('0x4d')](_0x3c101b[_0x9043('0x34')],_0xaa7783[_0x9043('0x35')]));if(_0x3c101b['query'][_0x9043('0x3d')]){_0xef3f7c['where']=_[_0x9043('0x3e')](_0xef3f7c[_0x9043('0x3c')],{'$or':_[_0x9043('0x2d')](_0xef3f7c[_0x9043('0x37')],function(_0x593a32){var _0xb9c32c={};_0xb9c32c[_0x593a32]={'$like':'%'+_0x3c101b[_0x9043('0x34')][_0x9043('0x3d')]+'%'};return _0xb9c32c;})});}_0xef3f7c=_[_0x9043('0x3e')]({},_0xef3f7c,_0x3c101b[_0x9043('0x48')]);var _0x25e5b0={'where':_0xef3f7c[_0x9043('0x3c')]};return db[_0x9043('0x2e')][_0x9043('0x20')](_0x25e5b0)[_0x9043('0x26')](function(_0x23c339){_0x35081d[_0x9043('0x20')]=_0x23c339;if(_0x3c101b[_0x9043('0x34')][_0x9043('0x3f')]){_0xef3f7c[_0x9043('0x40')]=[{'all':!![]}];}return db[_0x9043('0x2e')][_0x9043('0x41')](_0xef3f7c);})[_0x9043('0x26')](function(_0x53a519){_0x35081d[_0x9043('0x42')]=_0x53a519;return _0x35081d;})[_0x9043('0x26')](respondWithFilteredResult(_0x3b9596,_0xef3f7c,_0x9043('0x4e')))[_0x9043('0x43')](handleError(_0x3b9596,null,_0x9043('0x4e')));}; \ No newline at end of file +var _0xcb1e=['jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','then','destroy','stack','name','send','index','map','VoiceQueueReport','fieldName','type','key','query','keys','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','rawAttributes','length','find','create','body','update','describe','getVoiceQueuesReport','rimraf','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','lodash','squel','crypto'];(function(_0x14ef49,_0x3aad01){var _0x330a97=function(_0x1018c2){while(--_0x1018c2){_0x14ef49['push'](_0x14ef49['shift']());}};_0x330a97(++_0x3aad01);}(_0xcb1e,0x93));var _0xecb1=function(_0x409deb,_0x2b731){_0x409deb=_0x409deb-0x0;var _0x15a4f7=_0xcb1e[_0x409deb];return _0x15a4f7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xecb1('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xecb1('0x1'));var rp=require(_0xecb1('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xecb1('0x3'));var util=require(_0xecb1('0x4'));var path=require(_0xecb1('0x5'));var sox=require(_0xecb1('0x6'));var csv=require(_0xecb1('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xecb1('0x8'));var squel=require(_0xecb1('0x9'));var crypto=require(_0xecb1('0xa'));var jsforce=require(_0xecb1('0xb'));var deskjs=require(_0xecb1('0xc'));var toCsv=require(_0xecb1('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xecb1('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xecb1('0xe'));var as=require(_0xecb1('0xf'));var hardwareService=require(_0xecb1('0x10'));var logger=require(_0xecb1('0x11'))(_0xecb1('0x12'));var utils=require(_0xecb1('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xecb1('0x14'));var db=require(_0xecb1('0x15'))['db'];config[_0xecb1('0x16')]=_[_0xecb1('0x17')](config[_0xecb1('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0xecb1('0x18'))(new Redis(config['redis']));require(_0xecb1('0x19'))[_0xecb1('0x1a')](socket);function respondWithStatusCode(_0x347d68,_0x3bb3c8){_0x3bb3c8=_0x3bb3c8||0xcc;return function(_0x3567a8){if(_0x3567a8){return _0x347d68[_0xecb1('0x1b')](_0x3bb3c8);}return _0x347d68[_0xecb1('0x1c')](_0x3bb3c8)[_0xecb1('0x1d')]();};}function respondWithResult(_0x1301ad,_0x11ee61){_0x11ee61=_0x11ee61||0xc8;return function(_0x282edb){if(_0x282edb){return _0x1301ad[_0xecb1('0x1c')](_0x11ee61)[_0xecb1('0x1e')](_0x282edb);}};}function respondWithFilteredResult(_0x3246fc,_0xca12a8){return function(_0x362699){if(_0x362699){var _0x4462cc=typeof _0xca12a8[_0xecb1('0x1f')]===_0xecb1('0x20')&&typeof _0xca12a8[_0xecb1('0x21')]==='undefined';var _0x2a2d5a=_0x362699[_0xecb1('0x22')];var _0x33e888=_0x4462cc?0x0:_0xca12a8[_0xecb1('0x1f')];var _0x3b3d1d=_0x4462cc?_0x362699['count']:_0xca12a8[_0xecb1('0x1f')]+_0xca12a8['limit'];var _0x6e4401;if(_0x3b3d1d>=_0x2a2d5a){_0x3b3d1d=_0x2a2d5a;_0x6e4401=0xc8;}else{_0x6e4401=0xce;}_0x3246fc[_0xecb1('0x1c')](_0x6e4401);return _0x3246fc['set']('Content-Range',_0x33e888+'-'+_0x3b3d1d+'/'+_0x2a2d5a)['json'](_0x362699);}return null;};}function patchUpdates(_0x1db29a){return function(_0x3e5d89){try{jsonpatch[_0xecb1('0x23')](_0x3e5d89,_0x1db29a,!![]);}catch(_0x2b0be4){return BPromise[_0xecb1('0x24')](_0x2b0be4);}return _0x3e5d89[_0xecb1('0x25')]();};}function saveUpdates(_0x3d4b12,_0xd93cba){return function(_0xd874fc){if(_0xd874fc){return _0xd874fc['update'](_0x3d4b12)[_0xecb1('0x26')](function(_0x31e064){return _0x31e064;});}return null;};}function removeEntity(_0x10b378,_0x20f494){return function(_0x3eefd5){if(_0x3eefd5){return _0x3eefd5[_0xecb1('0x27')]()[_0xecb1('0x26')](function(){_0x10b378[_0xecb1('0x1c')](0xcc)[_0xecb1('0x1d')]();});}};}function handleEntityNotFound(_0x11cf81,_0x578ecc){return function(_0x399865){if(!_0x399865){_0x11cf81[_0xecb1('0x1b')](0x194);}return _0x399865;};}function handleError(_0x3bd8dc,_0x11db8c){_0x11db8c=_0x11db8c||0x1f4;return function(_0x4a74ee){logger['error'](_0x4a74ee[_0xecb1('0x28')]);if(_0x4a74ee[_0xecb1('0x29')]){delete _0x4a74ee[_0xecb1('0x29')];}_0x3bd8dc[_0xecb1('0x1c')](_0x11db8c)[_0xecb1('0x2a')](_0x4a74ee);};}exports[_0xecb1('0x2b')]=function(_0x5ebd20,_0xe69886){var _0x408ff4={},_0x58e1e6={},_0x1a81ba={'count':0x0,'rows':[]};var _0xe6a6bb=_[_0xecb1('0x2c')](db[_0xecb1('0x2d')]['rawAttributes'],function(_0x341f90){return{'name':_0x341f90[_0xecb1('0x2e')],'type':_0x341f90[_0xecb1('0x2f')][_0xecb1('0x30')]};});_0x58e1e6['model']=_[_0xecb1('0x2c')](_0xe6a6bb,_0xecb1('0x29'));_0x58e1e6[_0xecb1('0x31')]=_[_0xecb1('0x32')](_0x5ebd20[_0xecb1('0x31')]);_0x58e1e6['filters']=_[_0xecb1('0x33')](_0x58e1e6['model'],_0x58e1e6[_0xecb1('0x31')]);_0x408ff4[_0xecb1('0x34')]=_[_0xecb1('0x33')](_0x58e1e6[_0xecb1('0x35')],qs['fields'](_0x5ebd20[_0xecb1('0x31')][_0xecb1('0x36')]));_0x408ff4[_0xecb1('0x34')]=_0x408ff4[_0xecb1('0x34')]['length']?_0x408ff4['attributes']:_0x58e1e6[_0xecb1('0x35')];if(!_0x5ebd20[_0xecb1('0x31')][_0xecb1('0x37')](_0xecb1('0x38'))){_0x408ff4[_0xecb1('0x21')]=qs[_0xecb1('0x21')](_0x5ebd20[_0xecb1('0x31')][_0xecb1('0x21')]);_0x408ff4[_0xecb1('0x1f')]=qs['offset'](_0x5ebd20['query']['offset']);}_0x408ff4[_0xecb1('0x39')]=qs['sort'](_0x5ebd20[_0xecb1('0x31')][_0xecb1('0x3a')]);_0x408ff4[_0xecb1('0x3b')]=qs[_0xecb1('0x3c')](_['pick'](_0x5ebd20[_0xecb1('0x31')],_0x58e1e6[_0xecb1('0x3c')]),_0xe6a6bb);if(_0x5ebd20[_0xecb1('0x31')][_0xecb1('0x3d')]){_0x408ff4[_0xecb1('0x3b')]=_[_0xecb1('0x3e')](_0x408ff4['where'],{'$or':_[_0xecb1('0x2c')](_0xe6a6bb,function(_0xe4ed94){if(_0xe4ed94[_0xecb1('0x2f')]!==_0xecb1('0x3f')){var _0x3e0a84={};_0x3e0a84[_0xe4ed94['name']]={'$like':'%'+_0x5ebd20['query'][_0xecb1('0x3d')]+'%'};return _0x3e0a84;}})});}_0x408ff4=_[_0xecb1('0x3e')]({},_0x408ff4,_0x5ebd20[_0xecb1('0x40')]);var _0x62872d={'where':_0x408ff4[_0xecb1('0x3b')]};return db[_0xecb1('0x2d')][_0xecb1('0x22')](_0x62872d)[_0xecb1('0x26')](function(_0x16cf3e){_0x1a81ba['count']=_0x16cf3e;if(_0x5ebd20['query'][_0xecb1('0x41')]){_0x408ff4[_0xecb1('0x42')]=[{'all':!![]}];}return db[_0xecb1('0x2d')][_0xecb1('0x43')](_0x408ff4);})['then'](function(_0x2624eb){_0x1a81ba['rows']=_0x2624eb;return _0x1a81ba;})['then'](respondWithFilteredResult(_0xe69886,_0x408ff4))[_0xecb1('0x44')](handleError(_0xe69886,null));};exports[_0xecb1('0x45')]=function(_0x2555cb,_0x5892d3){var _0x1c0fa2={'raw':![],'where':{'id':_0x2555cb[_0xecb1('0x46')]['id']}},_0x47528b={};_0x47528b[_0xecb1('0x35')]=_[_0xecb1('0x32')](db[_0xecb1('0x2d')][_0xecb1('0x47')]);_0x47528b[_0xecb1('0x31')]=_['keys'](_0x2555cb[_0xecb1('0x31')]);_0x47528b['filters']=_[_0xecb1('0x33')](_0x47528b['model'],_0x47528b[_0xecb1('0x31')]);_0x1c0fa2[_0xecb1('0x34')]=_[_0xecb1('0x33')](_0x47528b[_0xecb1('0x35')],qs[_0xecb1('0x36')](_0x2555cb[_0xecb1('0x31')][_0xecb1('0x36')]));_0x1c0fa2[_0xecb1('0x34')]=_0x1c0fa2['attributes'][_0xecb1('0x48')]?_0x1c0fa2[_0xecb1('0x34')]:_0x47528b[_0xecb1('0x35')];if(_0x2555cb[_0xecb1('0x31')][_0xecb1('0x41')]){_0x1c0fa2[_0xecb1('0x42')]=[{'all':!![]}];}_0x1c0fa2=_['merge']({},_0x1c0fa2,_0x2555cb['options']);return db[_0xecb1('0x2d')][_0xecb1('0x49')](_0x1c0fa2)['then'](handleEntityNotFound(_0x5892d3,null))[_0xecb1('0x26')](respondWithResult(_0x5892d3,null))[_0xecb1('0x44')](handleError(_0x5892d3,null));};exports[_0xecb1('0x4a')]=function(_0x1fe604,_0x1f5652){return db[_0xecb1('0x2d')][_0xecb1('0x4a')](_0x1fe604[_0xecb1('0x4b')],{})[_0xecb1('0x26')](respondWithResult(_0x1f5652,0xc9))[_0xecb1('0x44')](handleError(_0x1f5652,null));};exports[_0xecb1('0x4c')]=function(_0xda1cbb,_0x1e1c72){if(_0xda1cbb['body']['id']){delete _0xda1cbb[_0xecb1('0x4b')]['id'];}return db[_0xecb1('0x2d')]['find']({'where':{'id':_0xda1cbb['params']['id']}})[_0xecb1('0x26')](handleEntityNotFound(_0x1e1c72,null))[_0xecb1('0x26')](saveUpdates(_0xda1cbb[_0xecb1('0x4b')],null))['then'](respondWithResult(_0x1e1c72,null))[_0xecb1('0x44')](handleError(_0x1e1c72,null));};exports[_0xecb1('0x27')]=function(_0x555dcf,_0x2c7764){return db['VoiceQueueReport'][_0xecb1('0x49')]({'where':{'id':_0x555dcf[_0xecb1('0x46')]['id']}})['then'](handleEntityNotFound(_0x2c7764,null))[_0xecb1('0x26')](removeEntity(_0x2c7764,null))[_0xecb1('0x44')](handleError(_0x2c7764,null));};exports[_0xecb1('0x4d')]=function(_0x526a95,_0x2d303e){return db[_0xecb1('0x2d')][_0xecb1('0x4d')]()[_0xecb1('0x26')](respondWithResult(_0x2d303e,null))['catch'](handleError(_0x2d303e,null));};exports[_0xecb1('0x4e')]=function(_0x11856a,_0x1421c6){var _0x167709={},_0x5dafcc={},_0x42c521={'count':0x0,'rows':[]};_0x5dafcc[_0xecb1('0x35')]=_[_0xecb1('0x32')](db[_0xecb1('0x2d')]['rawAttributes']);_0x5dafcc[_0xecb1('0x31')]=_[_0xecb1('0x32')](_0x11856a[_0xecb1('0x31')]);_0x5dafcc[_0xecb1('0x3c')]=_[_0xecb1('0x33')](_0x5dafcc[_0xecb1('0x35')],_0x5dafcc[_0xecb1('0x31')]);_0x167709[_0xecb1('0x34')]=_[_0xecb1('0x33')](_0x5dafcc[_0xecb1('0x35')],qs[_0xecb1('0x36')](_0x11856a['query']['fields']));_0x167709[_0xecb1('0x34')]=_0x167709[_0xecb1('0x34')][_0xecb1('0x48')]?_0x167709[_0xecb1('0x34')]:_0x5dafcc[_0xecb1('0x35')];if(!_0x11856a[_0xecb1('0x31')]['hasOwnProperty'](_0xecb1('0x38'))){_0x167709[_0xecb1('0x21')]=qs[_0xecb1('0x21')](_0x11856a[_0xecb1('0x31')][_0xecb1('0x21')]);_0x167709[_0xecb1('0x1f')]=qs[_0xecb1('0x1f')](_0x11856a[_0xecb1('0x31')]['offset']);}_0x167709['order']=qs[_0xecb1('0x3a')](_0x11856a[_0xecb1('0x31')]['sort']);_0x167709[_0xecb1('0x3b')]=qs[_0xecb1('0x3c')](_['pick'](_0x11856a['query'],_0x5dafcc[_0xecb1('0x3c')]));if(_0x11856a[_0xecb1('0x31')][_0xecb1('0x3d')]){_0x167709[_0xecb1('0x3b')]=_['merge'](_0x167709['where'],{'$or':_[_0xecb1('0x2c')](_0x167709[_0xecb1('0x34')],function(_0x39ce7a){var _0x3e03b1={};_0x3e03b1[_0x39ce7a]={'$like':'%'+_0x11856a[_0xecb1('0x31')][_0xecb1('0x3d')]+'%'};return _0x3e03b1;})});}_0x167709=_[_0xecb1('0x3e')]({},_0x167709,_0x11856a['options']);var _0x56817a={'where':_0x167709['where']};return db[_0xecb1('0x2d')][_0xecb1('0x22')](_0x56817a)[_0xecb1('0x26')](function(_0x57c64f){_0x42c521[_0xecb1('0x22')]=_0x57c64f;if(_0x11856a[_0xecb1('0x31')][_0xecb1('0x41')]){_0x167709[_0xecb1('0x42')]=[{'all':!![]}];}return db[_0xecb1('0x2d')][_0xecb1('0x43')](_0x167709);})[_0xecb1('0x26')](function(_0x3cef2e){_0x42c521['rows']=_0x3cef2e;return _0x42c521;})['then'](respondWithFilteredResult(_0x1421c6,_0x167709,_0xecb1('0x4e')))[_0xecb1('0x44')](handleError(_0x1421c6,null,_0xecb1('0x4e')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index b882e15..b7223f0 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 _0xa859=['remove','emit','hasOwnProperty','hook','../../mysqldb','setMaxListeners','update'];(function(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0xa859,0x1af));var _0x9a85=function(_0x1ccb9e,_0x19b38f){_0x1ccb9e=_0x1ccb9e-0x0;var _0x1475c2=_0xa859[_0x1ccb9e];return _0x1475c2;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require(_0x9a85('0x0'))['db']['VoiceQueueReport'];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x9a85('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x9a85('0x2'),'afterDestroy':_0x9a85('0x3')};function emitEvent(_0x3c33ba){return function(_0x5cf4ca,_0x3a534b,_0x30c4dd){VoiceQueueReportEvents[_0x9a85('0x4')](_0x3c33ba+':'+_0x5cf4ca['id'],_0x5cf4ca);VoiceQueueReportEvents[_0x9a85('0x4')](_0x3c33ba,_0x5cf4ca);_0x30c4dd(null);};}for(var e in events){if(events[_0x9a85('0x5')](e)){var event=events[e];VoiceQueueReport[_0x9a85('0x6')](e,emitEvent(event));}}module['exports']=VoiceQueueReportEvents; \ No newline at end of file +var _0xee5f=['remove','emit','hasOwnProperty','events','VoiceQueueReport','setMaxListeners','update'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0xee5f,0x6c));var _0xfee5=function(_0x368b78,_0x359962){_0x368b78=_0x368b78-0x0;var _0x5df921=_0xee5f[_0x368b78];return _0x5df921;};'use strict';var EventEmitter=require(_0xfee5('0x0'));var VoiceQueueReport=require('../../mysqldb')['db'][_0xfee5('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xfee5('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xfee5('0x3'),'afterDestroy':_0xfee5('0x4')};function emitEvent(_0x4ad7c){return function(_0x1072bd,_0x2a00ba,_0x208f0d){VoiceQueueReportEvents[_0xfee5('0x5')](_0x4ad7c+':'+_0x1072bd['id'],_0x1072bd);VoiceQueueReportEvents[_0xfee5('0x5')](_0x4ad7c,_0x1072bd);_0x208f0d(null);};}for(var e in events){if(events[_0xfee5('0x6')](e)){var event=events[e];VoiceQueueReport['hook'](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 164cfe3..3c3fd15 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 _0xc885=['lodash','util','../../config/logger','moment','request-promise','rimraf','../../config/environment','./voiceQueueReport.attributes','exports','define','report_queue','uniqueid'];(function(_0x5f0f89,_0x1fc5cc){var _0x541945=function(_0x26ea1d){while(--_0x26ea1d){_0x5f0f89['push'](_0x5f0f89['shift']());}};_0x541945(++_0x1fc5cc);}(_0xc885,0xfc));var _0x5c88=function(_0x3a23d3,_0x4088d8){_0x3a23d3=_0x3a23d3-0x0;var _0x10803b=_0xc885[_0x3a23d3];return _0x10803b;};'use strict';var _=require(_0x5c88('0x0'));var util=require(_0x5c88('0x1'));var logger=require(_0x5c88('0x2'))('api');var moment=require(_0x5c88('0x3'));var BPromise=require('bluebird');var rp=require(_0x5c88('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5c88('0x5'));var config=require(_0x5c88('0x6'));var attributes=require(_0x5c88('0x7'));module[_0x5c88('0x8')]=function(_0x4a8666,_0x4f4aa3){return _0x4a8666[_0x5c88('0x9')]('VoiceQueueReport',attributes,{'tableName':_0x5c88('0xa'),'paranoid':![],'indexes':[{'fields':[_0x5c88('0xb')]},{'fields':['calleridnum']}],'timestamps':!![]});}; \ No newline at end of file +var _0xbe01=['bluebird','request-promise','path','rimraf','./voiceQueueReport.attributes','exports','define','uniqueid','lodash','util','api','moment'];(function(_0x35d0cf,_0x12207d){var _0x283d71=function(_0x21baaa){while(--_0x21baaa){_0x35d0cf['push'](_0x35d0cf['shift']());}};_0x283d71(++_0x12207d);}(_0xbe01,0x104));var _0x1be0=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0xbe01[_0x2b7764];return _0x848dcb;};'use strict';var _=require(_0x1be0('0x0'));var util=require(_0x1be0('0x1'));var logger=require('../../config/logger')(_0x1be0('0x2'));var moment=require(_0x1be0('0x3'));var BPromise=require(_0x1be0('0x4'));var rp=require(_0x1be0('0x5'));var fs=require('fs');var path=require(_0x1be0('0x6'));var rimraf=require(_0x1be0('0x7'));var config=require('../../config/environment');var attributes=require(_0x1be0('0x8'));module[_0x1be0('0x9')]=function(_0xaebe2f,_0xe2ee04){return _0xaebe2f[_0x1be0('0xa')]('VoiceQueueReport',attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':[_0x1be0('0xb')]},{'fields':['calleridnum']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index de6c0b9..9991f38 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 _0x8cde=['register','request','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','where','attributes','limit','include','map','model','then','CreateVoiceQueueReport','create','body','raw','UpdateVoiceQueueReport','update','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter'];(function(_0x3f2bf3,_0xb432f4){var _0x353e5e=function(_0x583d0d){while(--_0x583d0d){_0x3f2bf3['push'](_0x3f2bf3['shift']());}};_0x353e5e(++_0xb432f4);}(_0x8cde,0x1b3));var _0xe8cd=function(_0x235482,_0x14b833){_0x235482=_0x235482-0x0;var _0x5f5bea=_0x8cde[_0x235482];return _0x5f5bea;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe8cd('0x0'));var BPromise=require(_0xe8cd('0x1'));var rs=require(_0xe8cd('0x2'));var fs=require('fs');var Redis=require(_0xe8cd('0x3'));var db=require(_0xe8cd('0x4'))['db'];var utils=require(_0xe8cd('0x5'));var logger=require(_0xe8cd('0x6'))(_0xe8cd('0x7'));var config=require(_0xe8cd('0x8'));var jayson=require(_0xe8cd('0x9'));var client=jayson[_0xe8cd('0xa')][_0xe8cd('0xb')]({'port':0x232a});config[_0xe8cd('0xc')]=_['defaults'](config[_0xe8cd('0xc')],{'host':_0xe8cd('0xd'),'port':0x18eb});var socket=require(_0xe8cd('0xe'))(new Redis(config[_0xe8cd('0xc')]));require('./voiceQueueReport.socket')[_0xe8cd('0xf')](socket);function respondWithRpcPromise(_0x7ed909,_0x117494,_0x6d6659){return new BPromise(function(_0xff28af,_0xdc53c2){return client[_0xe8cd('0x10')](_0x7ed909,_0x6d6659)['then'](function(_0x1e999c){logger[_0xe8cd('0x11')](_0xe8cd('0x12'),_0x117494,_0xe8cd('0x13'));logger[_0xe8cd('0x14')](_0xe8cd('0x15'),_0x117494,_0xe8cd('0x13'),JSON[_0xe8cd('0x16')](_0x1e999c));if(_0x1e999c[_0xe8cd('0x17')]){if(_0x1e999c['error'][_0xe8cd('0x18')]===0x1f4){logger['error'](_0xe8cd('0x12'),_0x117494,_0x1e999c[_0xe8cd('0x17')][_0xe8cd('0x19')]);return _0xdc53c2(_0x1e999c['error'][_0xe8cd('0x19')]);}logger['error'](_0xe8cd('0x12'),_0x117494,_0x1e999c[_0xe8cd('0x17')]['message']);return _0xff28af(_0x1e999c[_0xe8cd('0x17')][_0xe8cd('0x19')]);}else{logger[_0xe8cd('0x11')](_0xe8cd('0x12'),_0x117494,_0xe8cd('0x13'));_0xff28af(_0x1e999c[_0xe8cd('0x1a')]['message']);}})[_0xe8cd('0x1b')](function(_0x5eb9c6){logger[_0xe8cd('0x17')](_0xe8cd('0x12'),_0x117494,_0x5eb9c6);_0xdc53c2(_0x5eb9c6);});});}exports[_0xe8cd('0x1c')]=function(_0x611e06){var _0x46123=this;return new Promise(function(_0x16ea1b,_0x2c9f06){return db[_0xe8cd('0x1d')][_0xe8cd('0x1e')]({'raw':_0x611e06[_0xe8cd('0x1f')]?_0x611e06[_0xe8cd('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x611e06[_0xe8cd('0x1f')]?_0x611e06[_0xe8cd('0x1f')][_0xe8cd('0x20')]||null:null,'attributes':_0x611e06[_0xe8cd('0x1f')]?_0x611e06[_0xe8cd('0x1f')][_0xe8cd('0x21')]||null:null,'limit':_0x611e06[_0xe8cd('0x1f')]?_0x611e06[_0xe8cd('0x1f')][_0xe8cd('0x22')]||null:null,'include':_0x611e06[_0xe8cd('0x1f')]?_0x611e06[_0xe8cd('0x1f')][_0xe8cd('0x23')]?_['map'](_0x611e06[_0xe8cd('0x1f')][_0xe8cd('0x23')],function(_0x180f18){return{'model':db[_0x180f18['model']],'as':_0x180f18['as'],'attributes':_0x180f18[_0xe8cd('0x21')],'include':_0x180f18[_0xe8cd('0x23')]?_[_0xe8cd('0x24')](_0x180f18['include'],function(_0x44932f){return{'model':db[_0x44932f[_0xe8cd('0x25')]],'as':_0x44932f['as'],'attributes':_0x44932f[_0xe8cd('0x21')],'include':_0x44932f[_0xe8cd('0x23')]?_[_0xe8cd('0x24')](_0x44932f['include'],function(_0x4ceebc){return{'model':db[_0x4ceebc['model']],'as':_0x4ceebc['as'],'attributes':_0x4ceebc[_0xe8cd('0x21')]};}):[]};}):[]};}):[]:[]})[_0xe8cd('0x26')](function(_0x5990b0){logger[_0xe8cd('0x11')](_0xe8cd('0x1c'),_0x611e06);logger['debug'](_0xe8cd('0x1c'),_0x611e06,JSON[_0xe8cd('0x16')](_0x5990b0));_0x16ea1b(_0x5990b0);})[_0xe8cd('0x1b')](function(_0x4f459b){logger[_0xe8cd('0x17')](_0xe8cd('0x1c'),_0x4f459b[_0xe8cd('0x19')],_0x611e06);_0x2c9f06(_0x46123[_0xe8cd('0x17')](0x1f4,_0x4f459b[_0xe8cd('0x19')]));});});};exports[_0xe8cd('0x27')]=function(_0x4c22d7){var _0x280caf=this;return new Promise(function(_0x1bb93e,_0x5c389b){return db['VoiceQueueReport'][_0xe8cd('0x28')](_0x4c22d7[_0xe8cd('0x29')],{'raw':_0x4c22d7['options']?_0x4c22d7['options'][_0xe8cd('0x2a')]===undefined?!![]:![]:!![]})[_0xe8cd('0x26')](function(_0x2d50b5){logger['info'](_0xe8cd('0x27'),_0x4c22d7);logger[_0xe8cd('0x14')](_0xe8cd('0x27'),_0x4c22d7,JSON[_0xe8cd('0x16')](_0x2d50b5));_0x1bb93e(_0x2d50b5);})[_0xe8cd('0x1b')](function(_0x4b8f7d){logger[_0xe8cd('0x17')]('CreateVoiceQueueReport',_0x4b8f7d[_0xe8cd('0x19')],_0x4c22d7);_0x5c389b(_0x280caf[_0xe8cd('0x17')](0x1f4,_0x4b8f7d[_0xe8cd('0x19')]));});});};exports[_0xe8cd('0x2b')]=function(_0x44a78e){var _0x38e669=this;return new Promise(function(_0x444366,_0x52ba24){return db[_0xe8cd('0x1d')][_0xe8cd('0x2c')](_0x44a78e[_0xe8cd('0x29')],{'raw':_0x44a78e['options']?_0x44a78e[_0xe8cd('0x1f')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x44a78e[_0xe8cd('0x1f')]?_0x44a78e[_0xe8cd('0x1f')][_0xe8cd('0x20')]||null:null,'attributes':_0x44a78e[_0xe8cd('0x1f')]?_0x44a78e[_0xe8cd('0x1f')][_0xe8cd('0x21')]||null:null,'limit':_0x44a78e[_0xe8cd('0x1f')]?_0x44a78e['options'][_0xe8cd('0x22')]||null:null})[_0xe8cd('0x26')](function(_0x27a481){logger[_0xe8cd('0x11')](_0xe8cd('0x2b'),_0x44a78e);logger['debug'](_0xe8cd('0x2b'),_0x44a78e,JSON[_0xe8cd('0x16')](_0x27a481));_0x444366(_0x27a481);})[_0xe8cd('0x1b')](function(_0x3d8f16){logger[_0xe8cd('0x17')](_0xe8cd('0x2b'),_0x3d8f16[_0xe8cd('0x19')],_0x44a78e);_0x52ba24(_0x38e669[_0xe8cd('0x17')](0x1f4,_0x3d8f16[_0xe8cd('0x19')]));});});}; \ No newline at end of file +var _0xdefd=['then','info','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','VoiceQueueReport,\x20%s,\x20%s','message','result','GetVoiceQueueReport','findAll','options','raw','attributes','limit','include','map','model','catch','CreateVoiceQueueReport','VoiceQueueReport','body','UpdateVoiceQueueReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','request'];(function(_0x3eb228,_0xb299e5){var _0x5ba782=function(_0x1be8a8){while(--_0x1be8a8){_0x3eb228['push'](_0x3eb228['shift']());}};_0x5ba782(++_0xb299e5);}(_0xdefd,0x160));var _0xddef=function(_0x4c9a0d,_0x56c2a5){_0x4c9a0d=_0x4c9a0d-0x0;var _0x427225=_0xdefd[_0x4c9a0d];return _0x427225;};'use strict';var _=require(_0xddef('0x0'));var util=require(_0xddef('0x1'));var moment=require(_0xddef('0x2'));var BPromise=require(_0xddef('0x3'));var rs=require(_0xddef('0x4'));var fs=require('fs');var Redis=require(_0xddef('0x5'));var db=require(_0xddef('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xddef('0x7'))(_0xddef('0x8'));var config=require(_0xddef('0x9'));var jayson=require(_0xddef('0xa'));var client=jayson[_0xddef('0xb')]['http']({'port':0x232a});config['redis']=_[_0xddef('0xc')](config[_0xddef('0xd')],{'host':_0xddef('0xe'),'port':0x18eb});var socket=require(_0xddef('0xf'))(new Redis(config[_0xddef('0xd')]));require('./voiceQueueReport.socket')['register'](socket);function respondWithRpcPromise(_0x1c73b5,_0x5a0282,_0x198c9c){return new BPromise(function(_0x30ae64,_0x420cb8){return client[_0xddef('0x10')](_0x1c73b5,_0x198c9c)[_0xddef('0x11')](function(_0x37a84f){logger[_0xddef('0x12')]('VoiceQueueReport,\x20%s,\x20%s',_0x5a0282,_0xddef('0x13'));logger[_0xddef('0x14')](_0xddef('0x15'),_0x5a0282,_0xddef('0x13'),JSON[_0xddef('0x16')](_0x37a84f));if(_0x37a84f[_0xddef('0x17')]){if(_0x37a84f[_0xddef('0x17')]['code']===0x1f4){logger[_0xddef('0x17')](_0xddef('0x18'),_0x5a0282,_0x37a84f[_0xddef('0x17')][_0xddef('0x19')]);return _0x420cb8(_0x37a84f[_0xddef('0x17')][_0xddef('0x19')]);}logger[_0xddef('0x17')](_0xddef('0x18'),_0x5a0282,_0x37a84f[_0xddef('0x17')]['message']);return _0x30ae64(_0x37a84f[_0xddef('0x17')]['message']);}else{logger['info']('VoiceQueueReport,\x20%s,\x20%s',_0x5a0282,_0xddef('0x13'));_0x30ae64(_0x37a84f[_0xddef('0x1a')][_0xddef('0x19')]);}})['catch'](function(_0x5bf7fc){logger[_0xddef('0x17')](_0xddef('0x18'),_0x5a0282,_0x5bf7fc);_0x420cb8(_0x5bf7fc);});});}exports[_0xddef('0x1b')]=function(_0x3c60aa){var _0x59398b=this;return new Promise(function(_0x14121c,_0x5dcdd0){return db['VoiceQueueReport'][_0xddef('0x1c')]({'raw':_0x3c60aa['options']?_0x3c60aa[_0xddef('0x1d')][_0xddef('0x1e')]===undefined?!![]:![]:!![],'where':_0x3c60aa[_0xddef('0x1d')]?_0x3c60aa[_0xddef('0x1d')]['where']||null:null,'attributes':_0x3c60aa[_0xddef('0x1d')]?_0x3c60aa[_0xddef('0x1d')][_0xddef('0x1f')]||null:null,'limit':_0x3c60aa['options']?_0x3c60aa[_0xddef('0x1d')][_0xddef('0x20')]||null:null,'include':_0x3c60aa[_0xddef('0x1d')]?_0x3c60aa[_0xddef('0x1d')][_0xddef('0x21')]?_['map'](_0x3c60aa[_0xddef('0x1d')][_0xddef('0x21')],function(_0x420f04){return{'model':db[_0x420f04['model']],'as':_0x420f04['as'],'attributes':_0x420f04['attributes'],'include':_0x420f04['include']?_[_0xddef('0x22')](_0x420f04['include'],function(_0x120365){return{'model':db[_0x120365[_0xddef('0x23')]],'as':_0x120365['as'],'attributes':_0x120365[_0xddef('0x1f')],'include':_0x120365[_0xddef('0x21')]?_[_0xddef('0x22')](_0x120365['include'],function(_0x15f86e){return{'model':db[_0x15f86e[_0xddef('0x23')]],'as':_0x15f86e['as'],'attributes':_0x15f86e[_0xddef('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xddef('0x11')](function(_0x448857){logger[_0xddef('0x12')](_0xddef('0x1b'),_0x3c60aa);logger[_0xddef('0x14')](_0xddef('0x1b'),_0x3c60aa,JSON[_0xddef('0x16')](_0x448857));_0x14121c(_0x448857);})[_0xddef('0x24')](function(_0x2e495c){logger[_0xddef('0x17')](_0xddef('0x1b'),_0x2e495c[_0xddef('0x19')],_0x3c60aa);_0x5dcdd0(_0x59398b[_0xddef('0x17')](0x1f4,_0x2e495c[_0xddef('0x19')]));});});};exports[_0xddef('0x25')]=function(_0xd021b4){var _0x1b0b32=this;return new Promise(function(_0x36cf56,_0x5bfb8d){return db[_0xddef('0x26')]['create'](_0xd021b4[_0xddef('0x27')],{'raw':_0xd021b4['options']?_0xd021b4['options'][_0xddef('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x5415d1){logger[_0xddef('0x12')](_0xddef('0x25'),_0xd021b4);logger[_0xddef('0x14')](_0xddef('0x25'),_0xd021b4,JSON[_0xddef('0x16')](_0x5415d1));_0x36cf56(_0x5415d1);})['catch'](function(_0x5548a9){logger[_0xddef('0x17')](_0xddef('0x25'),_0x5548a9['message'],_0xd021b4);_0x5bfb8d(_0x1b0b32['error'](0x1f4,_0x5548a9['message']));});});};exports[_0xddef('0x28')]=function(_0x19314e){var _0x3e02c2=this;return new Promise(function(_0x76a9c7,_0x118449){return db[_0xddef('0x26')]['update'](_0x19314e['body'],{'raw':_0x19314e['options']?_0x19314e['options'][_0xddef('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x19314e[_0xddef('0x1d')]?_0x19314e[_0xddef('0x1d')]['where']||null:null,'attributes':_0x19314e[_0xddef('0x1d')]?_0x19314e[_0xddef('0x1d')][_0xddef('0x1f')]||null:null,'limit':_0x19314e[_0xddef('0x1d')]?_0x19314e['options'][_0xddef('0x20')]||null:null})[_0xddef('0x11')](function(_0x58fc81){logger[_0xddef('0x12')](_0xddef('0x28'),_0x19314e);logger[_0xddef('0x14')](_0xddef('0x28'),_0x19314e,JSON[_0xddef('0x16')](_0x58fc81));_0x76a9c7(_0x58fc81);})[_0xddef('0x24')](function(_0x35bbed){logger['error'](_0xddef('0x28'),_0x35bbed['message'],_0x19314e);_0x118449(_0x3e02c2['error'](0x1f4,_0x35bbed[_0xddef('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 95909e3..d8a7e47 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 _0xb453=['./voiceQueueReport.events','save','update','emit','removeListener','register','length','voiceQueueReport:'];(function(_0x95942,_0x85da80){var _0x6d7f81=function(_0x510549){while(--_0x510549){_0x95942['push'](_0x95942['shift']());}};_0x6d7f81(++_0x85da80);}(_0xb453,0x1e8));var _0x3b45=function(_0x3c15f2,_0x2db099){_0x3c15f2=_0x3c15f2-0x0;var _0x20fec6=_0xb453[_0x3c15f2];return _0x20fec6;};'use strict';var VoiceQueueReportEvents=require(_0x3b45('0x0'));var events=[_0x3b45('0x1'),'remove',_0x3b45('0x2')];function createListener(_0x19c429,_0x48ecf8){return function(_0x4a6ac4){_0x48ecf8[_0x3b45('0x3')](_0x19c429,_0x4a6ac4);};}function removeListener(_0x471768,_0x10029d){return function(){VoiceQueueReportEvents[_0x3b45('0x4')](_0x471768,_0x10029d);};}exports[_0x3b45('0x5')]=function(_0x210775){for(var _0x2f4baa=0x0,_0x39c77c=events[_0x3b45('0x6')];_0x2f4baa<_0x39c77c;_0x2f4baa++){var _0x1b529a=events[_0x2f4baa];var _0x59da08=createListener(_0x3b45('0x7')+_0x1b529a,_0x210775);VoiceQueueReportEvents['on'](_0x1b529a,_0x59da08);}}; \ No newline at end of file +var _0x4b47=['removeListener','register','length','voiceQueueReport:','./voiceQueueReport.events','remove','update','emit'];(function(_0x17d8b8,_0x523198){var _0x1281f0=function(_0x2917ab){while(--_0x2917ab){_0x17d8b8['push'](_0x17d8b8['shift']());}};_0x1281f0(++_0x523198);}(_0x4b47,0x1b4));var _0x74b4=function(_0x479344,_0x5f471d){_0x479344=_0x479344-0x0;var _0x6f22a3=_0x4b47[_0x479344];return _0x6f22a3;};'use strict';var VoiceQueueReportEvents=require(_0x74b4('0x0'));var events=['save',_0x74b4('0x1'),_0x74b4('0x2')];function createListener(_0x4469a4,_0x1f5100){return function(_0x1f9dac){_0x1f5100[_0x74b4('0x3')](_0x4469a4,_0x1f9dac);};}function removeListener(_0x565f6b,_0x4ed4fe){return function(){VoiceQueueReportEvents[_0x74b4('0x4')](_0x565f6b,_0x4ed4fe);};}exports[_0x74b4('0x5')]=function(_0x4dc737){for(var _0x4cd397=0x0,_0x482278=events[_0x74b4('0x6')];_0x4cd397<_0x482278;_0x4cd397++){var _0x75ea22=events[_0x4cd397];var _0x1ebbb8=createListener(_0x74b4('0x7')+_0x75ea22,_0x4dc737);VoiceQueueReportEvents['on'](_0x75ea22,_0x1ebbb8);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index f67b15a..32918ae 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 _0x28c4=['get','/:id','show','post','create','put','update','delete','destroy','util','path','connect-timeout','express','../../components/auth/service','./voiceQueuesLog.controller','isAuthenticated'];(function(_0x43a67d,_0x18ac8f){var _0x3690e2=function(_0x525bfa){while(--_0x525bfa){_0x43a67d['push'](_0x43a67d['shift']());}};_0x3690e2(++_0x18ac8f);}(_0x28c4,0x99));var _0x428c=function(_0x279368,_0x41c002){_0x279368=_0x279368-0x0;var _0x40b6d0=_0x28c4[_0x279368];return _0x40b6d0;};'use strict';var multer=require('multer');var util=require(_0x428c('0x0'));var path=require(_0x428c('0x1'));var timeout=require(_0x428c('0x2'));var express=require(_0x428c('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x428c('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x428c('0x5'));router['get']('/',auth[_0x428c('0x6')](),controller['index']);router[_0x428c('0x7')](_0x428c('0x8'),auth[_0x428c('0x6')](),controller[_0x428c('0x9')]);router[_0x428c('0xa')]('/',auth[_0x428c('0x6')](),controller[_0x428c('0xb')]);router[_0x428c('0xc')](_0x428c('0x8'),auth['isAuthenticated'](),controller[_0x428c('0xd')]);router[_0x428c('0xe')](_0x428c('0x8'),auth[_0x428c('0x6')](),controller[_0x428c('0xf')]);module['exports']=router; \ No newline at end of file +var _0x158e=['./voiceQueuesLog.controller','isAuthenticated','get','/:id','show','create','put','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0x158e,0x1f0));var _0xe158=function(_0x537369,_0x1b113e){_0x537369=_0x537369-0x0;var _0x2be7c2=_0x158e[_0x537369];return _0x2be7c2;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe158('0x0'));var timeout=require(_0xe158('0x1'));var express=require(_0xe158('0x2'));var router=express[_0xe158('0x3')]();var fs_extra=require(_0xe158('0x4'));var auth=require(_0xe158('0x5'));var interaction=require(_0xe158('0x6'));var config=require(_0xe158('0x7'));var controller=require(_0xe158('0x8'));router['get']('/',auth[_0xe158('0x9')](),controller['index']);router[_0xe158('0xa')](_0xe158('0xb'),auth[_0xe158('0x9')](),controller[_0xe158('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0xe158('0xd')]);router[_0xe158('0xe')](_0xe158('0xb'),auth[_0xe158('0x9')](),controller['update']);router[_0xe158('0xf')](_0xe158('0xb'),auth[_0xe158('0x9')](),controller[_0xe158('0x10')]);module[_0xe158('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index cf1653d..32c3d3f 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 _0x0a14=['YYYY-MM-DD\x20HH:mm:ss','sequelize','moment','exports','STRING','DATE','format'];(function(_0x3fb655,_0x345c41){var _0x22212d=function(_0x4c04c1){while(--_0x4c04c1){_0x3fb655['push'](_0x3fb655['shift']());}};_0x22212d(++_0x345c41);}(_0x0a14,0x120));var _0x40a1=function(_0x56984a,_0x36cba3){_0x56984a=_0x56984a-0x0;var _0x9133ab=_0x0a14[_0x56984a];return _0x9133ab;};'use strict';var Sequelize=require(_0x40a1('0x0'));var moment=require(_0x40a1('0x1'));module[_0x40a1('0x2')]={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x40a1('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x40a1('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x40a1('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x40a1('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x40a1('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x40a1('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x40a1('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x40a1('0x4')],'allowNull':![],'defaultValue':moment()[_0x40a1('0x5')](_0x40a1('0x6'))}}; \ No newline at end of file +var _0x6fd9=['YYYY-MM-DD\x20HH:mm:ss','sequelize','moment','exports','STRING','DATE','format'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6fd9,0x190));var _0x96fd=function(_0x2db7e3,_0x541601){_0x2db7e3=_0x2db7e3-0x0;var _0x33b369=_0x6fd9[_0x2db7e3];return _0x33b369;};'use strict';var Sequelize=require(_0x96fd('0x0'));var moment=require(_0x96fd('0x1'));module[_0x96fd('0x2')]={'time':{'type':Sequelize[_0x96fd('0x3')]},'callid':{'type':Sequelize[_0x96fd('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x96fd('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x96fd('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x96fd('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x96fd('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x96fd('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x96fd('0x4')],'allowNull':![],'defaultValue':moment()[_0x96fd('0x5')](_0x96fd('0x6'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index e330367..49280a1 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 _0xf77c=['api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','destroy','then','end','error','stack','name','send','map','VoiceQueuesLog','fieldName','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','show','params','rawAttributes','length','find','catch','create','body','update','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger'];(function(_0x2967c1,_0x202a72){var _0x103397=function(_0x14b5cc){while(--_0x14b5cc){_0x2967c1['push'](_0x2967c1['shift']());}};_0x103397(++_0x202a72);}(_0xf77c,0x7f));var _0xcf77=function(_0x58bba8,_0x213d48){_0x58bba8=_0x58bba8-0x0;var _0x110a16=_0xf77c[_0x58bba8];return _0x110a16;};'use strict';var emlformat=require(_0xcf77('0x0'));var rimraf=require(_0xcf77('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xcf77('0x2'));var moment=require('moment');var BPromise=require(_0xcf77('0x3'));var Mustache=require(_0xcf77('0x4'));var util=require(_0xcf77('0x5'));var path=require(_0xcf77('0x6'));var sox=require(_0xcf77('0x7'));var csv=require(_0xcf77('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcf77('0x9'));var _=require(_0xcf77('0xa'));var squel=require(_0xcf77('0xb'));var crypto=require(_0xcf77('0xc'));var jsforce=require(_0xcf77('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xcf77('0x8'));var querystring=require('querystring');var Papa=require(_0xcf77('0xe'));var Redis=require('ioredis');var authService=require(_0xcf77('0xf'));var qs=require(_0xcf77('0x10'));var as=require(_0xcf77('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcf77('0x12'))(_0xcf77('0x13'));var utils=require(_0xcf77('0x14'));var config=require(_0xcf77('0x15'));var licenseUtil=require(_0xcf77('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x292e11,_0x1e08cb){_0x1e08cb=_0x1e08cb||0xcc;return function(_0x5b4545){if(_0x5b4545){return _0x292e11[_0xcf77('0x17')](_0x1e08cb);}return _0x292e11[_0xcf77('0x18')](_0x1e08cb)['end']();};}function respondWithResult(_0x513114,_0x117174){_0x117174=_0x117174||0xc8;return function(_0x31f4a8){if(_0x31f4a8){return _0x513114['status'](_0x117174)[_0xcf77('0x19')](_0x31f4a8);}};}function respondWithFilteredResult(_0x1e8d13,_0x47863c){return function(_0x333c60){if(_0x333c60){var _0x392101=typeof _0x47863c['offset']===_0xcf77('0x1a')&&typeof _0x47863c[_0xcf77('0x1b')]==='undefined';var _0x1470f6=_0x333c60[_0xcf77('0x1c')];var _0x339a84=_0x392101?0x0:_0x47863c['offset'];var _0x4a351e=_0x392101?_0x333c60[_0xcf77('0x1c')]:_0x47863c[_0xcf77('0x1d')]+_0x47863c[_0xcf77('0x1b')];var _0x9725e7;if(_0x4a351e>=_0x1470f6){_0x4a351e=_0x1470f6;_0x9725e7=0xc8;}else{_0x9725e7=0xce;}_0x1e8d13[_0xcf77('0x18')](_0x9725e7);return _0x1e8d13[_0xcf77('0x1e')](_0xcf77('0x1f'),_0x339a84+'-'+_0x4a351e+'/'+_0x1470f6)[_0xcf77('0x19')](_0x333c60);}return null;};}function patchUpdates(_0x2f63bd){return function(_0x256047){try{jsonpatch[_0xcf77('0x20')](_0x256047,_0x2f63bd,!![]);}catch(_0x48e3d0){return BPromise[_0xcf77('0x21')](_0x48e3d0);}return _0x256047['save']();};}function saveUpdates(_0xbbe2f5,_0x105036){return function(_0xcb97ff){if(_0xcb97ff){return _0xcb97ff['update'](_0xbbe2f5)['then'](function(_0x57f1af){return _0x57f1af;});}return null;};}function removeEntity(_0x3d4ed7,_0x460983){return function(_0x58ccbd){if(_0x58ccbd){return _0x58ccbd[_0xcf77('0x22')]()[_0xcf77('0x23')](function(){_0x3d4ed7['status'](0xcc)[_0xcf77('0x24')]();});}};}function handleEntityNotFound(_0x377938,_0x1bd5d9){return function(_0x26022c){if(!_0x26022c){_0x377938['sendStatus'](0x194);}return _0x26022c;};}function handleError(_0x13888b,_0x3bd393){_0x3bd393=_0x3bd393||0x1f4;return function(_0x5a01fd){logger[_0xcf77('0x25')](_0x5a01fd[_0xcf77('0x26')]);if(_0x5a01fd[_0xcf77('0x27')]){delete _0x5a01fd[_0xcf77('0x27')];}_0x13888b[_0xcf77('0x18')](_0x3bd393)[_0xcf77('0x28')](_0x5a01fd);};}exports['index']=function(_0x134795,_0x26cda0){var _0x3dd2fc={},_0x6cac64={},_0x19ce62={'count':0x0,'rows':[]};var _0x949e38=_[_0xcf77('0x29')](db[_0xcf77('0x2a')]['rawAttributes'],function(_0x3793f7){return{'name':_0x3793f7[_0xcf77('0x2b')],'type':_0x3793f7['type'][_0xcf77('0x2c')]};});_0x6cac64[_0xcf77('0x2d')]=_['map'](_0x949e38,_0xcf77('0x27'));_0x6cac64[_0xcf77('0x2e')]=_[_0xcf77('0x2f')](_0x134795['query']);_0x6cac64['filters']=_[_0xcf77('0x30')](_0x6cac64[_0xcf77('0x2d')],_0x6cac64[_0xcf77('0x2e')]);_0x3dd2fc[_0xcf77('0x31')]=_[_0xcf77('0x30')](_0x6cac64[_0xcf77('0x2d')],qs['fields'](_0x134795[_0xcf77('0x2e')][_0xcf77('0x32')]));_0x3dd2fc[_0xcf77('0x31')]=_0x3dd2fc[_0xcf77('0x31')]['length']?_0x3dd2fc[_0xcf77('0x31')]:_0x6cac64[_0xcf77('0x2d')];if(!_0x134795[_0xcf77('0x2e')][_0xcf77('0x33')](_0xcf77('0x34'))){_0x3dd2fc[_0xcf77('0x1b')]=qs[_0xcf77('0x1b')](_0x134795[_0xcf77('0x2e')][_0xcf77('0x1b')]);_0x3dd2fc[_0xcf77('0x1d')]=qs[_0xcf77('0x1d')](_0x134795[_0xcf77('0x2e')][_0xcf77('0x1d')]);}_0x3dd2fc[_0xcf77('0x35')]=qs[_0xcf77('0x36')](_0x134795[_0xcf77('0x2e')][_0xcf77('0x36')]);_0x3dd2fc[_0xcf77('0x37')]=qs[_0xcf77('0x38')](_[_0xcf77('0x39')](_0x134795[_0xcf77('0x2e')],_0x6cac64['filters']),_0x949e38);if(_0x134795[_0xcf77('0x2e')][_0xcf77('0x3a')]){_0x3dd2fc[_0xcf77('0x37')]=_[_0xcf77('0x3b')](_0x3dd2fc[_0xcf77('0x37')],{'$or':_[_0xcf77('0x29')](_0x949e38,function(_0x331f11){if(_0x331f11['type']!=='VIRTUAL'){var _0x5d97ad={};_0x5d97ad[_0x331f11['name']]={'$like':'%'+_0x134795[_0xcf77('0x2e')][_0xcf77('0x3a')]+'%'};return _0x5d97ad;}})});}_0x3dd2fc=_[_0xcf77('0x3b')]({},_0x3dd2fc,_0x134795[_0xcf77('0x3c')]);var _0x3880b3={'where':_0x3dd2fc[_0xcf77('0x37')]};return db[_0xcf77('0x2a')][_0xcf77('0x1c')](_0x3880b3)['then'](function(_0x4ccb3c){_0x19ce62[_0xcf77('0x1c')]=_0x4ccb3c;if(_0x134795[_0xcf77('0x2e')][_0xcf77('0x3d')]){_0x3dd2fc[_0xcf77('0x3e')]=[{'all':!![]}];}return db['VoiceQueuesLog'][_0xcf77('0x3f')](_0x3dd2fc);})[_0xcf77('0x23')](function(_0x1b3715){_0x19ce62['rows']=_0x1b3715;return _0x19ce62;})[_0xcf77('0x23')](respondWithFilteredResult(_0x26cda0,_0x3dd2fc))['catch'](handleError(_0x26cda0,null));};exports[_0xcf77('0x40')]=function(_0x1466ac,_0x2eca0d){var _0x741599={'raw':!![],'where':{'id':_0x1466ac[_0xcf77('0x41')]['id']}},_0x1343ff={};_0x1343ff[_0xcf77('0x2d')]=_[_0xcf77('0x2f')](db['VoiceQueuesLog'][_0xcf77('0x42')]);_0x1343ff[_0xcf77('0x2e')]=_['keys'](_0x1466ac[_0xcf77('0x2e')]);_0x1343ff[_0xcf77('0x38')]=_[_0xcf77('0x30')](_0x1343ff[_0xcf77('0x2d')],_0x1343ff[_0xcf77('0x2e')]);_0x741599[_0xcf77('0x31')]=_[_0xcf77('0x30')](_0x1343ff[_0xcf77('0x2d')],qs[_0xcf77('0x32')](_0x1466ac['query'][_0xcf77('0x32')]));_0x741599[_0xcf77('0x31')]=_0x741599[_0xcf77('0x31')][_0xcf77('0x43')]?_0x741599['attributes']:_0x1343ff[_0xcf77('0x2d')];if(_0x1466ac['query']['includeAll']){_0x741599[_0xcf77('0x3e')]=[{'all':!![]}];}_0x741599=_[_0xcf77('0x3b')]({},_0x741599,_0x1466ac[_0xcf77('0x3c')]);return db[_0xcf77('0x2a')][_0xcf77('0x44')](_0x741599)['then'](handleEntityNotFound(_0x2eca0d,null))[_0xcf77('0x23')](respondWithResult(_0x2eca0d,null))[_0xcf77('0x45')](handleError(_0x2eca0d,null));};exports['create']=function(_0x48d020,_0xbb59df){return db[_0xcf77('0x2a')][_0xcf77('0x46')](_0x48d020[_0xcf77('0x47')],{})[_0xcf77('0x23')](respondWithResult(_0xbb59df,0xc9))[_0xcf77('0x45')](handleError(_0xbb59df,null));};exports[_0xcf77('0x48')]=function(_0x322073,_0x278768){if(_0x322073['body']['id']){delete _0x322073[_0xcf77('0x47')]['id'];}return db[_0xcf77('0x2a')][_0xcf77('0x44')]({'where':{'id':_0x322073[_0xcf77('0x41')]['id']}})['then'](handleEntityNotFound(_0x278768,null))['then'](saveUpdates(_0x322073[_0xcf77('0x47')],null))['then'](respondWithResult(_0x278768,null))[_0xcf77('0x45')](handleError(_0x278768,null));};exports[_0xcf77('0x22')]=function(_0x5a451b,_0x3b7a01){return db[_0xcf77('0x2a')][_0xcf77('0x44')]({'where':{'id':_0x5a451b[_0xcf77('0x41')]['id']}})[_0xcf77('0x23')](handleEntityNotFound(_0x3b7a01,null))['then'](removeEntity(_0x3b7a01,null))[_0xcf77('0x45')](handleError(_0x3b7a01,null));}; \ No newline at end of file +var _0xc0b7=['offset','set','Content-Range','json','apply','update','then','error','stack','name','send','index','VoiceQueuesLog','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','type','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','params','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','end','status','undefined','limit','count'];(function(_0x59e862,_0x477bf2){var _0x1a25ee=function(_0xc61e64){while(--_0xc61e64){_0x59e862['push'](_0x59e862['shift']());}};_0x1a25ee(++_0x477bf2);}(_0xc0b7,0xc1));var _0x7c0b=function(_0x4782de,_0x5a6820){_0x4782de=_0x4782de-0x0;var _0x25f0c1=_0xc0b7[_0x4782de];return _0x25f0c1;};'use strict';var emlformat=require(_0x7c0b('0x0'));var rimraf=require(_0x7c0b('0x1'));var zipdir=require(_0x7c0b('0x2'));var jsonpatch=require(_0x7c0b('0x3'));var rp=require(_0x7c0b('0x4'));var moment=require(_0x7c0b('0x5'));var BPromise=require(_0x7c0b('0x6'));var Mustache=require('mustache');var util=require(_0x7c0b('0x7'));var path=require(_0x7c0b('0x8'));var sox=require(_0x7c0b('0x9'));var csv=require('to-csv');var ejs=require(_0x7c0b('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7c0b('0xb'));var squel=require(_0x7c0b('0xc'));var crypto=require(_0x7c0b('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x7c0b('0xe'));var toCsv=require(_0x7c0b('0xf'));var querystring=require(_0x7c0b('0x10'));var Papa=require(_0x7c0b('0x11'));var Redis=require('ioredis');var authService=require(_0x7c0b('0x12'));var qs=require(_0x7c0b('0x13'));var as=require(_0x7c0b('0x14'));var hardwareService=require(_0x7c0b('0x15'));var logger=require(_0x7c0b('0x16'))(_0x7c0b('0x17'));var utils=require('../../config/utils');var config=require(_0x7c0b('0x18'));var licenseUtil=require(_0x7c0b('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x6afb50,_0x1e6851){_0x1e6851=_0x1e6851||0xcc;return function(_0xa76970){if(_0xa76970){return _0x6afb50[_0x7c0b('0x1a')](_0x1e6851);}return _0x6afb50['status'](_0x1e6851)[_0x7c0b('0x1b')]();};}function respondWithResult(_0x1e0f0e,_0x6fc726){_0x6fc726=_0x6fc726||0xc8;return function(_0x3e62e9){if(_0x3e62e9){return _0x1e0f0e[_0x7c0b('0x1c')](_0x6fc726)['json'](_0x3e62e9);}};}function respondWithFilteredResult(_0x3d1dda,_0x403910){return function(_0x370e2d){if(_0x370e2d){var _0x389408=typeof _0x403910['offset']===_0x7c0b('0x1d')&&typeof _0x403910[_0x7c0b('0x1e')]==='undefined';var _0x4b09b9=_0x370e2d[_0x7c0b('0x1f')];var _0x171f5c=_0x389408?0x0:_0x403910[_0x7c0b('0x20')];var _0x5354cb=_0x389408?_0x370e2d['count']:_0x403910[_0x7c0b('0x20')]+_0x403910[_0x7c0b('0x1e')];var _0x43e1d4;if(_0x5354cb>=_0x4b09b9){_0x5354cb=_0x4b09b9;_0x43e1d4=0xc8;}else{_0x43e1d4=0xce;}_0x3d1dda[_0x7c0b('0x1c')](_0x43e1d4);return _0x3d1dda[_0x7c0b('0x21')](_0x7c0b('0x22'),_0x171f5c+'-'+_0x5354cb+'/'+_0x4b09b9)[_0x7c0b('0x23')](_0x370e2d);}return null;};}function patchUpdates(_0x220383){return function(_0x25c03a){try{jsonpatch[_0x7c0b('0x24')](_0x25c03a,_0x220383,!![]);}catch(_0x5455d0){return BPromise['reject'](_0x5455d0);}return _0x25c03a['save']();};}function saveUpdates(_0x24ff7d,_0x5c6408){return function(_0x3d9ce3){if(_0x3d9ce3){return _0x3d9ce3[_0x7c0b('0x25')](_0x24ff7d)[_0x7c0b('0x26')](function(_0x2beb94){return _0x2beb94;});}return null;};}function removeEntity(_0x13bda1,_0x32d129){return function(_0x11ee04){if(_0x11ee04){return _0x11ee04['destroy']()[_0x7c0b('0x26')](function(){_0x13bda1[_0x7c0b('0x1c')](0xcc)[_0x7c0b('0x1b')]();});}};}function handleEntityNotFound(_0x2181dd,_0x394172){return function(_0x2f5ea1){if(!_0x2f5ea1){_0x2181dd[_0x7c0b('0x1a')](0x194);}return _0x2f5ea1;};}function handleError(_0x406f0d,_0x1f3386){_0x1f3386=_0x1f3386||0x1f4;return function(_0x33a829){logger[_0x7c0b('0x27')](_0x33a829[_0x7c0b('0x28')]);if(_0x33a829[_0x7c0b('0x29')]){delete _0x33a829[_0x7c0b('0x29')];}_0x406f0d['status'](_0x1f3386)[_0x7c0b('0x2a')](_0x33a829);};}exports[_0x7c0b('0x2b')]=function(_0x212bda,_0x4f0392){var _0x32eb85={},_0x567def={},_0xe2c618={'count':0x0,'rows':[]};var _0x5af299=_['map'](db[_0x7c0b('0x2c')]['rawAttributes'],function(_0x31b8d2){return{'name':_0x31b8d2[_0x7c0b('0x2d')],'type':_0x31b8d2['type'][_0x7c0b('0x2e')]};});_0x567def[_0x7c0b('0x2f')]=_[_0x7c0b('0x30')](_0x5af299,_0x7c0b('0x29'));_0x567def[_0x7c0b('0x31')]=_[_0x7c0b('0x32')](_0x212bda['query']);_0x567def[_0x7c0b('0x33')]=_[_0x7c0b('0x34')](_0x567def[_0x7c0b('0x2f')],_0x567def[_0x7c0b('0x31')]);_0x32eb85['attributes']=_[_0x7c0b('0x34')](_0x567def[_0x7c0b('0x2f')],qs[_0x7c0b('0x35')](_0x212bda[_0x7c0b('0x31')][_0x7c0b('0x35')]));_0x32eb85['attributes']=_0x32eb85[_0x7c0b('0x36')][_0x7c0b('0x37')]?_0x32eb85[_0x7c0b('0x36')]:_0x567def[_0x7c0b('0x2f')];if(!_0x212bda[_0x7c0b('0x31')]['hasOwnProperty'](_0x7c0b('0x38'))){_0x32eb85[_0x7c0b('0x1e')]=qs[_0x7c0b('0x1e')](_0x212bda[_0x7c0b('0x31')][_0x7c0b('0x1e')]);_0x32eb85[_0x7c0b('0x20')]=qs[_0x7c0b('0x20')](_0x212bda['query']['offset']);}_0x32eb85[_0x7c0b('0x39')]=qs['sort'](_0x212bda['query'][_0x7c0b('0x3a')]);_0x32eb85[_0x7c0b('0x3b')]=qs[_0x7c0b('0x33')](_['pick'](_0x212bda['query'],_0x567def[_0x7c0b('0x33')]),_0x5af299);if(_0x212bda['query']['filter']){_0x32eb85[_0x7c0b('0x3b')]=_['merge'](_0x32eb85[_0x7c0b('0x3b')],{'$or':_[_0x7c0b('0x30')](_0x5af299,function(_0x2fdbf8){if(_0x2fdbf8[_0x7c0b('0x3c')]!==_0x7c0b('0x3d')){var _0x2d2770={};_0x2d2770[_0x2fdbf8['name']]={'$like':'%'+_0x212bda[_0x7c0b('0x31')][_0x7c0b('0x3e')]+'%'};return _0x2d2770;}})});}_0x32eb85=_[_0x7c0b('0x3f')]({},_0x32eb85,_0x212bda[_0x7c0b('0x40')]);var _0x3028f7={'where':_0x32eb85[_0x7c0b('0x3b')]};return db['VoiceQueuesLog'][_0x7c0b('0x1f')](_0x3028f7)[_0x7c0b('0x26')](function(_0xe26838){_0xe2c618[_0x7c0b('0x1f')]=_0xe26838;if(_0x212bda[_0x7c0b('0x31')][_0x7c0b('0x41')]){_0x32eb85[_0x7c0b('0x42')]=[{'all':!![]}];}return db[_0x7c0b('0x2c')][_0x7c0b('0x43')](_0x32eb85);})[_0x7c0b('0x26')](function(_0x584098){_0xe2c618[_0x7c0b('0x44')]=_0x584098;return _0xe2c618;})['then'](respondWithFilteredResult(_0x4f0392,_0x32eb85))[_0x7c0b('0x45')](handleError(_0x4f0392,null));};exports['show']=function(_0x25bc5a,_0x1a6018){var _0x5a162f={'raw':!![],'where':{'id':_0x25bc5a[_0x7c0b('0x46')]['id']}},_0x1a9af4={};_0x1a9af4[_0x7c0b('0x2f')]=_[_0x7c0b('0x32')](db[_0x7c0b('0x2c')]['rawAttributes']);_0x1a9af4['query']=_[_0x7c0b('0x32')](_0x25bc5a['query']);_0x1a9af4[_0x7c0b('0x33')]=_['intersection'](_0x1a9af4['model'],_0x1a9af4[_0x7c0b('0x31')]);_0x5a162f['attributes']=_['intersection'](_0x1a9af4[_0x7c0b('0x2f')],qs[_0x7c0b('0x35')](_0x25bc5a['query'][_0x7c0b('0x35')]));_0x5a162f[_0x7c0b('0x36')]=_0x5a162f[_0x7c0b('0x36')][_0x7c0b('0x37')]?_0x5a162f[_0x7c0b('0x36')]:_0x1a9af4['model'];if(_0x25bc5a[_0x7c0b('0x31')][_0x7c0b('0x41')]){_0x5a162f['include']=[{'all':!![]}];}_0x5a162f=_[_0x7c0b('0x3f')]({},_0x5a162f,_0x25bc5a[_0x7c0b('0x40')]);return db[_0x7c0b('0x2c')][_0x7c0b('0x47')](_0x5a162f)[_0x7c0b('0x26')](handleEntityNotFound(_0x1a6018,null))[_0x7c0b('0x26')](respondWithResult(_0x1a6018,null))[_0x7c0b('0x45')](handleError(_0x1a6018,null));};exports[_0x7c0b('0x48')]=function(_0x337776,_0x3d9d5d){return db[_0x7c0b('0x2c')][_0x7c0b('0x48')](_0x337776['body'],{})[_0x7c0b('0x26')](respondWithResult(_0x3d9d5d,0xc9))[_0x7c0b('0x45')](handleError(_0x3d9d5d,null));};exports[_0x7c0b('0x25')]=function(_0x55c24e,_0x32dbd9){if(_0x55c24e[_0x7c0b('0x49')]['id']){delete _0x55c24e[_0x7c0b('0x49')]['id'];}return db[_0x7c0b('0x2c')][_0x7c0b('0x47')]({'where':{'id':_0x55c24e[_0x7c0b('0x46')]['id']}})[_0x7c0b('0x26')](handleEntityNotFound(_0x32dbd9,null))[_0x7c0b('0x26')](saveUpdates(_0x55c24e[_0x7c0b('0x49')],null))[_0x7c0b('0x26')](respondWithResult(_0x32dbd9,null))[_0x7c0b('0x45')](handleError(_0x32dbd9,null));};exports[_0x7c0b('0x4a')]=function(_0x30bf75,_0x5da625){return db['VoiceQueuesLog'][_0x7c0b('0x47')]({'where':{'id':_0x30bf75[_0x7c0b('0x46')]['id']}})[_0x7c0b('0x26')](handleEntityNotFound(_0x5da625,null))[_0x7c0b('0x26')](removeEntity(_0x5da625,null))['catch'](handleError(_0x5da625,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 449a0b0..eb7233b 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 _0xf4e7=['exports','define','event_dtm','event','dtm','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./voiceQueuesLog.attributes'];(function(_0x266618,_0x18f637){var _0x54dbf5=function(_0x1f7985){while(--_0x1f7985){_0x266618['push'](_0x266618['shift']());}};_0x54dbf5(++_0x18f637);}(_0xf4e7,0x139));var _0x7f4e=function(_0x325fb0,_0x9c223d){_0x325fb0=_0x325fb0-0x0;var _0x92b926=_0xf4e7[_0x325fb0];return _0x92b926;};'use strict';var _=require(_0x7f4e('0x0'));var util=require(_0x7f4e('0x1'));var logger=require(_0x7f4e('0x2'))(_0x7f4e('0x3'));var moment=require(_0x7f4e('0x4'));var BPromise=require('bluebird');var rp=require(_0x7f4e('0x5'));var fs=require('fs');var path=require(_0x7f4e('0x6'));var rimraf=require(_0x7f4e('0x7'));var config=require('../../config/environment');var attributes=require(_0x7f4e('0x8'));module[_0x7f4e('0x9')]=function(_0x5d989d,_0x41666d){return _0x5d989d[_0x7f4e('0xa')]('VoiceQueuesLog',attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':_0x7f4e('0xb'),'fields':[_0x7f4e('0xc'),_0x7f4e('0xd')]}],'timestamps':![]});}; \ No newline at end of file +var _0x9179=['exports','define','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x2c2707,_0x4f96a7){var _0x1abc62=function(_0x1b33af){while(--_0x1b33af){_0x2c2707['push'](_0x2c2707['shift']());}};_0x1abc62(++_0x4f96a7);}(_0x9179,0x1d2));var _0x9917=function(_0x26aac3,_0x283931){_0x26aac3=_0x26aac3-0x0;var _0x1f6428=_0x9179[_0x26aac3];return _0x1f6428;};'use strict';var _=require(_0x9917('0x0'));var util=require(_0x9917('0x1'));var logger=require(_0x9917('0x2'))(_0x9917('0x3'));var moment=require('moment');var BPromise=require(_0x9917('0x4'));var rp=require(_0x9917('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./voiceQueuesLog.attributes');module[_0x9917('0x6')]=function(_0x1e908a,_0x4c3e15){return _0x1e908a[_0x9917('0x7')]('VoiceQueuesLog',attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':'event_dtm','fields':['event','dtm']}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 41f29a5..388b540 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 _0xc7ad=['error','code','message','catch','lodash','util','moment','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x101dce,_0x3b887c){var _0x5a92bb=function(_0x5bac04){while(--_0x5bac04){_0x101dce['push'](_0x101dce['shift']());}};_0x5a92bb(++_0x3b887c);}(_0xc7ad,0xca));var _0xdc7a=function(_0x2cda30,_0x468a36){_0x2cda30=_0x2cda30-0x0;var _0x5869d3=_0xc7ad[_0x2cda30];return _0x5869d3;};'use strict';var _=require(_0xdc7a('0x0'));var util=require(_0xdc7a('0x1'));var moment=require(_0xdc7a('0x2'));var BPromise=require('bluebird');var rs=require(_0xdc7a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xdc7a('0x4'));var logger=require('../../config/logger')(_0xdc7a('0x5'));var config=require(_0xdc7a('0x6'));var jayson=require(_0xdc7a('0x7'));var client=jayson[_0xdc7a('0x8')][_0xdc7a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1a3bff,_0x8116ca,_0x11158e){return new BPromise(function(_0xcd0a4f,_0x261d79){return client[_0xdc7a('0xa')](_0x1a3bff,_0x11158e)[_0xdc7a('0xb')](function(_0x4dd06f){logger[_0xdc7a('0xc')](_0xdc7a('0xd'),_0x8116ca,_0xdc7a('0xe'));logger[_0xdc7a('0xf')](_0xdc7a('0x10'),_0x8116ca,_0xdc7a('0xe'),JSON[_0xdc7a('0x11')](_0x4dd06f));if(_0x4dd06f[_0xdc7a('0x12')]){if(_0x4dd06f[_0xdc7a('0x12')][_0xdc7a('0x13')]===0x1f4){logger['error'](_0xdc7a('0xd'),_0x8116ca,_0x4dd06f['error'][_0xdc7a('0x14')]);return _0x261d79(_0x4dd06f[_0xdc7a('0x12')]['message']);}logger[_0xdc7a('0x12')](_0xdc7a('0xd'),_0x8116ca,_0x4dd06f[_0xdc7a('0x12')]['message']);return _0xcd0a4f(_0x4dd06f[_0xdc7a('0x12')][_0xdc7a('0x14')]);}else{logger[_0xdc7a('0xc')]('VoiceQueuesLog,\x20%s,\x20%s',_0x8116ca,_0xdc7a('0xe'));_0xcd0a4f(_0x4dd06f['result']['message']);}})[_0xdc7a('0x15')](function(_0x12c2ad){logger[_0xdc7a('0x12')]('VoiceQueuesLog,\x20%s,\x20%s',_0x8116ca,_0x12c2ad);_0x261d79(_0x12c2ad);});});} \ No newline at end of file +var _0xb544=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','request','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','moment'];(function(_0x20d546,_0x4a99b3){var _0x54aaf1=function(_0x49fe8b){while(--_0x49fe8b){_0x20d546['push'](_0x20d546['shift']());}};_0x54aaf1(++_0x4a99b3);}(_0xb544,0xd0));var _0x4b54=function(_0x4792c8,_0x5158a1){_0x4792c8=_0x4792c8-0x0;var _0x35edb1=_0xb544[_0x4792c8];return _0x35edb1;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4b54('0x0'));var BPromise=require(_0x4b54('0x1'));var rs=require(_0x4b54('0x2'));var fs=require('fs');var Redis=require(_0x4b54('0x3'));var db=require(_0x4b54('0x4'))['db'];var utils=require(_0x4b54('0x5'));var logger=require(_0x4b54('0x6'))(_0x4b54('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xc9f31c,_0x513b8f,_0x2bf592){return new BPromise(function(_0x512bff,_0x1a5800){return client[_0x4b54('0x8')](_0xc9f31c,_0x2bf592)['then'](function(_0x3c9100){logger[_0x4b54('0x9')](_0x4b54('0xa'),_0x513b8f,_0x4b54('0xb'));logger[_0x4b54('0xc')](_0x4b54('0xd'),_0x513b8f,_0x4b54('0xb'),JSON['stringify'](_0x3c9100));if(_0x3c9100[_0x4b54('0xe')]){if(_0x3c9100[_0x4b54('0xe')][_0x4b54('0xf')]===0x1f4){logger['error'](_0x4b54('0xa'),_0x513b8f,_0x3c9100[_0x4b54('0xe')]['message']);return _0x1a5800(_0x3c9100[_0x4b54('0xe')][_0x4b54('0x10')]);}logger['error'](_0x4b54('0xa'),_0x513b8f,_0x3c9100[_0x4b54('0xe')]['message']);return _0x512bff(_0x3c9100['error'][_0x4b54('0x10')]);}else{logger['info'](_0x4b54('0xa'),_0x513b8f,'request\x20sent');_0x512bff(_0x3c9100[_0x4b54('0x11')]['message']);}})[_0x4b54('0x12')](function(_0x4d8aa7){logger['error'](_0x4b54('0xa'),_0x513b8f,_0x4d8aa7);_0x1a5800(_0x4d8aa7);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 3a6a1a8..1fef5ff 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 _0x6d96=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/:id','show','/:id/download','download','/:id/downloads','/:id/transcribe','downloadTranscribe','post','runTranscribe','put','update','delete','destroy','exports','util','path','express'];(function(_0x245a43,_0x2bf0b8){var _0xe97427=function(_0x17e38a){while(--_0x17e38a){_0x245a43['push'](_0x245a43['shift']());}};_0xe97427(++_0x2bf0b8);}(_0x6d96,0x105));var _0x66d9=function(_0x48fc43,_0x38c553){_0x48fc43=_0x48fc43-0x0;var _0x37fb79=_0x6d96[_0x48fc43];return _0x37fb79;};'use strict';var multer=require('multer');var util=require(_0x66d9('0x0'));var path=require(_0x66d9('0x1'));var timeout=require('connect-timeout');var express=require(_0x66d9('0x2'));var router=express[_0x66d9('0x3')]();var fs_extra=require(_0x66d9('0x4'));var auth=require(_0x66d9('0x5'));var interaction=require(_0x66d9('0x6'));var config=require(_0x66d9('0x7'));var controller=require('./voiceRecording.controller');router['get']('/',auth[_0x66d9('0x8')](),controller['index']);router[_0x66d9('0x9')]('/describe',auth['isAuthenticated'](),controller['describe']);router['get'](_0x66d9('0xa'),auth['isAuthenticated'](),controller[_0x66d9('0xb')]);router[_0x66d9('0x9')](_0x66d9('0xc'),auth[_0x66d9('0x8')](),controller[_0x66d9('0xd')]);router[_0x66d9('0x9')](_0x66d9('0xe'),controller['downloads']);router[_0x66d9('0x9')](_0x66d9('0xf'),auth[_0x66d9('0x8')](),controller[_0x66d9('0x10')]);router[_0x66d9('0x11')]('/',auth[_0x66d9('0x8')](),controller['create']);router['post'](_0x66d9('0xf'),auth[_0x66d9('0x8')](),controller[_0x66d9('0x12')]);router[_0x66d9('0x13')](_0x66d9('0xa'),auth[_0x66d9('0x8')](),controller[_0x66d9('0x14')]);router[_0x66d9('0x15')](_0x66d9('0xa'),auth['isAuthenticated'](),controller[_0x66d9('0x16')]);module[_0x66d9('0x17')]=router; \ No newline at end of file +var _0xdeec=['delete','destroy','exports','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','/:id/downloads','downloadTranscribe','post','create','/:id/transcribe','runTranscribe','update'];(function(_0x4a2689,_0x314a16){var _0x463450=function(_0x5388b8){while(--_0x5388b8){_0x4a2689['push'](_0x4a2689['shift']());}};_0x463450(++_0x314a16);}(_0xdeec,0x145));var _0xcdee=function(_0x23a584,_0x5dcda3){_0x23a584=_0x23a584-0x0;var _0x1235bc=_0xdeec[_0x23a584];return _0x1235bc;};'use strict';var multer=require('multer');var util=require(_0xcdee('0x0'));var path=require(_0xcdee('0x1'));var timeout=require('connect-timeout');var express=require(_0xcdee('0x2'));var router=express[_0xcdee('0x3')]();var fs_extra=require(_0xcdee('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xcdee('0x5'));var config=require(_0xcdee('0x6'));var controller=require('./voiceRecording.controller');router[_0xcdee('0x7')]('/',auth[_0xcdee('0x8')](),controller[_0xcdee('0x9')]);router[_0xcdee('0x7')](_0xcdee('0xa'),auth['isAuthenticated'](),controller[_0xcdee('0xb')]);router[_0xcdee('0x7')](_0xcdee('0xc'),auth[_0xcdee('0x8')](),controller['show']);router['get']('/:id/download',auth[_0xcdee('0x8')](),controller['download']);router[_0xcdee('0x7')](_0xcdee('0xd'),controller['downloads']);router[_0xcdee('0x7')]('/:id/transcribe',auth[_0xcdee('0x8')](),controller[_0xcdee('0xe')]);router[_0xcdee('0xf')]('/',auth[_0xcdee('0x8')](),controller[_0xcdee('0x10')]);router['post'](_0xcdee('0x11'),auth[_0xcdee('0x8')](),controller[_0xcdee('0x12')]);router['put']('/:id',auth[_0xcdee('0x8')](),controller[_0xcdee('0x13')]);router[_0xcdee('0x14')](_0xcdee('0xc'),auth['isAuthenticated'](),controller[_0xcdee('0x15')]);module[_0xcdee('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 0948f69..2f2aeff 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(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0xa9e0,0x123));var _0x0a9e=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xa9e0[_0xc6be3a];return _0x56a310;};'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(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xa9e0[_0x34bf97];return _0x292719;};'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 0327572..4b3cb63 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 _0x20e7=['sendStatus','error','stack','name','send','index','VoiceRecording','rawAttributes','type','key','model','differenceBy','format','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','includeAll','findAll','rows','catch','show','params','fields','include','options','find','create','body','describe','download','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','secrets','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','downloads','sequelize','MD5','col','token','$and','push','decryptFile','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','listBuckets','createBucket','TranscribeService','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','readFileSync','[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','TranscriptionJobName','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribe','runSentiment','sentiment','sentimentAccountId','sentimentRegion','language','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','transcribeAccountId','Cloud\x20Provider\x20not\x20available','data1','transcribeRegion','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','data2','[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','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','aws-sdk','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','reject','then','destroy'];(function(_0xf2c769,_0x56f997){var _0x48caa4=function(_0x5e6d1b){while(--_0x5e6d1b){_0xf2c769['push'](_0xf2c769['shift']());}};_0x48caa4(++_0x56f997);}(_0x20e7,0x1b3));var _0x720e=function(_0x452657,_0x3f1398){_0x452657=_0x452657-0x0;var _0x2d2339=_0x20e7[_0x452657];return _0x2d2339;};'use strict';var emlformat=require(_0x720e('0x0'));var rimraf=require(_0x720e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x720e('0x2'));var rp=require(_0x720e('0x3'));var moment=require(_0x720e('0x4'));var BPromise=require(_0x720e('0x5'));var Mustache=require(_0x720e('0x6'));var util=require(_0x720e('0x7'));var path=require(_0x720e('0x8'));var sox=require('sox');var csv=require(_0x720e('0x9'));var ejs=require(_0x720e('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x720e('0xb'));var squel=require('squel');var crypto=require(_0x720e('0xc'));var jsforce=require(_0x720e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x720e('0x9'));var querystring=require(_0x720e('0xe'));var Papa=require(_0x720e('0xf'));var AWS=require(_0x720e('0x10'));var uuidv4=require('uuid/v4');var Redis=require(_0x720e('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x720e('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x720e('0x13'));var logger=require('../../config/logger')(_0x720e('0x14'));var utils=require(_0x720e('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x720e('0x16'));var db=require(_0x720e('0x17'))['db'];function respondWithStatusCode(_0x1f6a73,_0x451d4d){_0x451d4d=_0x451d4d||0xcc;return function(_0x17fd41){if(_0x17fd41){return _0x1f6a73['sendStatus'](_0x451d4d);}return _0x1f6a73[_0x720e('0x18')](_0x451d4d)[_0x720e('0x19')]();};}function respondWithResult(_0x5d2c4f,_0x5e3994){_0x5e3994=_0x5e3994||0xc8;return function(_0x28873f){if(_0x28873f){return _0x5d2c4f['status'](_0x5e3994)[_0x720e('0x1a')](_0x28873f);}};}function respondWithFilteredResult(_0x57c444,_0x3b0909){return function(_0x30e140){if(_0x30e140){var _0x2d6cad=typeof _0x3b0909[_0x720e('0x1b')]===_0x720e('0x1c')&&typeof _0x3b0909[_0x720e('0x1d')]===_0x720e('0x1c');var _0x27a52b=_0x30e140[_0x720e('0x1e')];var _0x15c02e=_0x2d6cad?0x0:_0x3b0909[_0x720e('0x1b')];var _0x590c9e=_0x2d6cad?_0x30e140['count']:_0x3b0909[_0x720e('0x1b')]+_0x3b0909[_0x720e('0x1d')];var _0x261fd2;if(_0x590c9e>=_0x27a52b){_0x590c9e=_0x27a52b;_0x261fd2=0xc8;}else{_0x261fd2=0xce;}_0x57c444['status'](_0x261fd2);return _0x57c444[_0x720e('0x1f')]('Content-Range',_0x15c02e+'-'+_0x590c9e+'/'+_0x27a52b)[_0x720e('0x1a')](_0x30e140);}return null;};}function patchUpdates(_0x1535d0){return function(_0x2742e6){try{jsonpatch[_0x720e('0x20')](_0x2742e6,_0x1535d0,!![]);}catch(_0x2c50eb){return BPromise[_0x720e('0x21')](_0x2c50eb);}return _0x2742e6['save']();};}function saveUpdates(_0x165a26,_0x59978e){return function(_0x119db9){if(_0x119db9){return _0x119db9['update'](_0x165a26)[_0x720e('0x22')](function(_0x883114){return _0x883114;});}return null;};}function removeEntity(_0x150697,_0x1ff4ac){return function(_0x35b7a0){if(_0x35b7a0){return _0x35b7a0[_0x720e('0x23')]()[_0x720e('0x22')](function(){_0x150697[_0x720e('0x18')](0xcc)[_0x720e('0x19')]();});}};}function handleEntityNotFound(_0x2a8592,_0x1f7815){return function(_0x17a453){if(!_0x17a453){_0x2a8592[_0x720e('0x24')](0x194);}return _0x17a453;};}function handleError(_0x30be3b,_0x6b0b6b){_0x6b0b6b=_0x6b0b6b||0x1f4;return function(_0x5d5ad8){logger[_0x720e('0x25')](_0x5d5ad8[_0x720e('0x26')]);if(_0x5d5ad8[_0x720e('0x27')]){delete _0x5d5ad8[_0x720e('0x27')];}_0x30be3b[_0x720e('0x18')](_0x6b0b6b)[_0x720e('0x28')](_0x5d5ad8);};}exports[_0x720e('0x29')]=function(_0x39c15f,_0x4c5edd){var _0x3d3678={},_0x512498={},_0x5dec0c={'count':0x0,'rows':[]};var _0x29c107=_['map'](db[_0x720e('0x2a')][_0x720e('0x2b')],function(_0x387869){return{'name':_0x387869['fieldName'],'type':_0x387869[_0x720e('0x2c')][_0x720e('0x2d')]};});_0x512498[_0x720e('0x2e')]=_[_0x720e('0x2f')](_['map'](_0x29c107,_0x720e('0x27')),[_0x720e('0x30')]);_0x512498[_0x720e('0x31')]=_[_0x720e('0x32')](_0x39c15f[_0x720e('0x31')]);_0x512498[_0x720e('0x33')]=_[_0x720e('0x34')](_0x512498[_0x720e('0x2e')],_0x512498[_0x720e('0x31')]);_0x3d3678[_0x720e('0x35')]=_[_0x720e('0x34')](_0x512498[_0x720e('0x2e')],qs['fields'](_0x39c15f[_0x720e('0x31')]['fields']));_0x3d3678[_0x720e('0x35')]=_0x3d3678[_0x720e('0x35')][_0x720e('0x36')]?_0x3d3678[_0x720e('0x35')]:_0x512498[_0x720e('0x2e')];if(!_0x39c15f['query'][_0x720e('0x37')](_0x720e('0x38'))){_0x3d3678[_0x720e('0x1d')]=qs[_0x720e('0x1d')](_0x39c15f[_0x720e('0x31')][_0x720e('0x1d')]);_0x3d3678[_0x720e('0x1b')]=qs[_0x720e('0x1b')](_0x39c15f[_0x720e('0x31')][_0x720e('0x1b')]);}_0x3d3678[_0x720e('0x39')]=qs[_0x720e('0x3a')](_0x39c15f['query'][_0x720e('0x3a')]);_0x3d3678['where']=qs[_0x720e('0x33')](_[_0x720e('0x3b')](_0x39c15f[_0x720e('0x31')],_0x512498[_0x720e('0x33')]),_0x29c107);if(_0x39c15f[_0x720e('0x31')][_0x720e('0x3c')]){_0x3d3678['where']=_[_0x720e('0x3d')](_0x3d3678[_0x720e('0x3e')],{'$or':_['map'](_0x29c107,function(_0x390bf9){if(_0x390bf9['type']!==_0x720e('0x3f')){var _0x26655c={};_0x26655c[_0x390bf9[_0x720e('0x27')]]={'$like':'%'+_0x39c15f['query'][_0x720e('0x3c')]+'%'};return _0x26655c;}})});}_0x3d3678=_[_0x720e('0x3d')]({},_0x3d3678,_0x39c15f['options']);var _0x5690f2={'where':_0x3d3678[_0x720e('0x3e')]};return db['VoiceRecording'][_0x720e('0x1e')](_0x5690f2)[_0x720e('0x22')](function(_0x3d25ce){_0x5dec0c[_0x720e('0x1e')]=_0x3d25ce;if(_0x39c15f[_0x720e('0x31')][_0x720e('0x40')]){_0x3d3678['include']=[{'all':!![]}];}return db[_0x720e('0x2a')][_0x720e('0x41')](_0x3d3678);})[_0x720e('0x22')](function(_0x31d595){_0x5dec0c[_0x720e('0x42')]=_0x31d595;return _0x5dec0c;})['then'](respondWithFilteredResult(_0x4c5edd,_0x3d3678))[_0x720e('0x43')](handleError(_0x4c5edd,null));};exports[_0x720e('0x44')]=function(_0x6d63da,_0x1314f9){var _0x3d6e5f={'raw':![],'where':{'id':_0x6d63da[_0x720e('0x45')]['id']}},_0xc7fadb={};_0xc7fadb['model']=_['keys'](db[_0x720e('0x2a')][_0x720e('0x2b')]);_0xc7fadb[_0x720e('0x31')]=_[_0x720e('0x32')](_0x6d63da[_0x720e('0x31')]);_0xc7fadb[_0x720e('0x33')]=_['intersection'](_0xc7fadb['model'],_0xc7fadb[_0x720e('0x31')]);_0x3d6e5f[_0x720e('0x35')]=_[_0x720e('0x34')](_0xc7fadb[_0x720e('0x2e')],qs[_0x720e('0x46')](_0x6d63da[_0x720e('0x31')][_0x720e('0x46')]));_0x3d6e5f[_0x720e('0x35')]=_0x3d6e5f[_0x720e('0x35')][_0x720e('0x36')]?_0x3d6e5f[_0x720e('0x35')]:_0xc7fadb[_0x720e('0x2e')];if(_0x6d63da[_0x720e('0x31')]['includeAll']){_0x3d6e5f[_0x720e('0x47')]=[{'all':!![]}];}_0x3d6e5f=_['merge']({},_0x3d6e5f,_0x6d63da[_0x720e('0x48')]);return db[_0x720e('0x2a')][_0x720e('0x49')](_0x3d6e5f)['then'](handleEntityNotFound(_0x1314f9,null))[_0x720e('0x22')](respondWithResult(_0x1314f9,null))[_0x720e('0x43')](handleError(_0x1314f9,null));};exports['create']=function(_0x22a1bb,_0x392019){return db['VoiceRecording'][_0x720e('0x4a')](_0x22a1bb[_0x720e('0x4b')],{})[_0x720e('0x22')](respondWithResult(_0x392019,0xc9))[_0x720e('0x43')](handleError(_0x392019,null));};exports['update']=function(_0x2423a0,_0x587034){if(_0x2423a0[_0x720e('0x4b')]['id']){delete _0x2423a0[_0x720e('0x4b')]['id'];}return db[_0x720e('0x2a')][_0x720e('0x49')]({'where':{'id':_0x2423a0['params']['id']}})[_0x720e('0x22')](handleEntityNotFound(_0x587034,null))[_0x720e('0x22')](saveUpdates(_0x2423a0['body'],null))['then'](respondWithResult(_0x587034,null))[_0x720e('0x43')](handleError(_0x587034,null));};exports[_0x720e('0x4c')]=function(_0x2f4478,_0x1c1440){return db[_0x720e('0x2a')]['describe']()[_0x720e('0x22')](respondWithResult(_0x1c1440,null))[_0x720e('0x43')](handleError(_0x1c1440,null));};exports[_0x720e('0x4d')]=function(_0x3d2bd5,_0xa8c60b,_0xba55d){var _0x57b56d=require(_0x720e('0x4e'));var _0x4eb6a7=![];var _0x26a7c1={};if(_0x3d2bd5['query'][_0x720e('0x2c')]&&_0x3d2bd5['query'][_0x720e('0x2c')]==='uniqueid'){_0x26a7c1[_0x720e('0x4f')]=_0x3d2bd5['params']['id'];}else{_0x26a7c1['id']=_0x3d2bd5[_0x720e('0x45')]['id'];}return db[_0x720e('0x2a')]['find']({'where':_0x26a7c1,'attributes':['id',_0x720e('0x50')],'raw':!![]})[_0x720e('0x22')](handleEntityNotFound(_0xa8c60b,null))['then'](function(_0x33ff24){if(_0x33ff24){var _0x946c32=_0x33ff24[_0x720e('0x50')];var _0x19378f=util[_0x720e('0x30')](_0x720e('0x51'),_0x946c32);if(fs[_0x720e('0x52')](_0x19378f)){_0x4eb6a7=!![];return _0x57b56d['decryptFile'](_0x19378f,_0x946c32,config[_0x720e('0x53')][_0x720e('0x54')])[_0x720e('0x22')](function(){return _0x33ff24;});}return _0x33ff24;}})[_0x720e('0x22')](function(_0x590b44){if(_0x590b44){var _0x1a5eb0=_0x590b44[_0x720e('0x50')];if(!fs[_0x720e('0x52')](_0x1a5eb0)){throw new db[(_0x720e('0x55'))][(_0x720e('0x56'))](_0x720e('0x57'));}if(_0x590b44['filename']){return _0xa8c60b[_0x720e('0x4d')](_0x1a5eb0,_0x590b44[_0x720e('0x58')]+path[_0x720e('0x59')](_0x1a5eb0),function(){if(_0x4eb6a7){fs[_0x720e('0x5a')](_0x1a5eb0);}});}else{return _0xa8c60b[_0x720e('0x4d')](_0x1a5eb0,function(_0x22eea4){if(_0x4eb6a7){fs[_0x720e('0x5a')](_0x1a5eb0);}});}}})['catch'](function(_0x48c911){if(_0x48c911[_0x720e('0x5b')]===_0x720e('0x57')){_0xa8c60b[_0x720e('0x18')](0x194)['send'](_0x720e('0x5c'));}else{return handleError(_0xa8c60b,null);}});};exports[_0x720e('0x5d')]=function(_0x19c0f5,_0x5d7399,_0x258ea4){var _0x338361=require(_0x720e('0x4e'));var _0x288637=![];var _0x388d23={'$and':[db['sequelize'][_0x720e('0x3e')](db[_0x720e('0x5e')]['fn'](_0x720e('0x5f'),db[_0x720e('0x5e')][_0x720e('0x60')]('uniqueid')),_0x19c0f5['query'][_0x720e('0x61')])]};if(_0x19c0f5[_0x720e('0x31')]['type']&&_0x19c0f5['query']['type']===_0x720e('0x4f')){_0x388d23[_0x720e('0x62')][_0x720e('0x63')]({'uniqueid':_0x19c0f5[_0x720e('0x45')]['id']});}else{_0x388d23[_0x720e('0x62')][_0x720e('0x63')]({'id':_0x19c0f5['params']['id']});}return db[_0x720e('0x2a')][_0x720e('0x49')]({'where':_0x388d23,'attributes':['id','value'],'raw':!![]})['then'](handleEntityNotFound(_0x5d7399,null))[_0x720e('0x22')](function(_0xfa1137){if(_0xfa1137){var _0x4b5fc3=util[_0x720e('0x30')](_0x720e('0x51'),_0xfa1137[_0x720e('0x50')]);if(fs['existsSync'](_0x4b5fc3)){_0x288637=!![];return _0x338361[_0x720e('0x64')](_0x4b5fc3,_0xfa1137['value'],config[_0x720e('0x53')][_0x720e('0x54')])[_0x720e('0x22')](function(){return _0xfa1137;});}return _0xfa1137;}})[_0x720e('0x22')](function(_0x35283b){if(_0x35283b){if(!fs[_0x720e('0x52')](_0x35283b[_0x720e('0x50')])){throw new db[(_0x720e('0x55'))][(_0x720e('0x56'))](_0x720e('0x57'));}if(_0x35283b[_0x720e('0x58')]){return _0x5d7399[_0x720e('0x4d')](_0x35283b['value'],_0x35283b[_0x720e('0x58')]+path[_0x720e('0x59')](_0x35283b[_0x720e('0x50')]),function(){if(_0x288637){fs[_0x720e('0x5a')](_0x35283b[_0x720e('0x50')]);}});}else{return _0x5d7399[_0x720e('0x4d')](_0x35283b[_0x720e('0x50')],function(_0x4f4da1){if(_0x288637){fs['unlink'](_0x35283b[_0x720e('0x50')]);}});}}})[_0x720e('0x43')](handleError(_0x5d7399,null));};exports['destroy']=function(_0x5552c9,_0x3d0617){return db['VoiceRecording']['find']({'where':{'id':_0x5552c9[_0x720e('0x45')]['id']}})[_0x720e('0x22')](function(_0x20b5fc){if(_[_0x720e('0x65')](_0x20b5fc)){throw new ReferenceError(_0x720e('0x66'));}return _0x20b5fc;})['then'](function(_0x207344){var _0x331cca=_0x207344[_0x720e('0x50')];logger[_0x720e('0x67')](_0x720e('0x68'),_0x331cca);if(!_[_0x720e('0x65')](_0x207344[_0x720e('0x50')])&&fs[_0x720e('0x52')](_0x331cca)){logger[_0x720e('0x67')](_0x720e('0x69')+_0x331cca+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x331cca);}_0x331cca=_0x331cca+'.cypher';if(!_[_0x720e('0x65')](_0x207344[_0x720e('0x50')])&&fs[_0x720e('0x52')](_0x331cca)){logger[_0x720e('0x67')](_0x720e('0x69')+_0x331cca+_0x720e('0x6a'));fs[_0x720e('0x6b')](_0x331cca);}return _0x207344;})[_0x720e('0x22')](function(_0x20dbca){if(!_0x20dbca)throw new InternalError();return _0x20dbca[_0x720e('0x23')]();})[_0x720e('0x22')](function(){_0x3d0617[_0x720e('0x18')](0xcc)['end']();})['catch'](handleError(_0x3d0617,null));};function getBucketslist(_0x5c8a0a,_0x3db524,_0x4c61ef){return new Promise(function(_0x1c2806,_0x1e318a){var _0x1eba24=new AWS['S3']({'accessKeyId':_0x3db524,'secretAccessKey':_0x5c8a0a,'region':_0x4c61ef});_0x1eba24[_0x720e('0x6c')]({},function(_0x4340b0,_0x403b58){if(_0x4340b0){return _0x1e318a(_0x4340b0);}else{return _0x1c2806(_0x403b58);}});});}function createBucket(_0x5ae06e,_0x3529f3,_0xec9da2,_0xc331c8){return new Promise(function(_0x2a2b26,_0x8851bb){var _0x283a33=new AWS['S3']({'accessKeyId':_0x3529f3,'secretAccessKey':_0x5ae06e,'region':_0xec9da2});_0x283a33[_0x720e('0x6d')]({'Bucket':_0xc331c8},function(_0x3d0fbf,_0x1ca4b4){if(_0x3d0fbf){return _0x8851bb(_0x3d0fbf);}else{return _0x2a2b26(_0x1ca4b4);}});});}function uploadFile(_0x5c04e9,_0x17d312,_0x1b0197,_0x1dd38f,_0x5aa438,_0x594ce8){return new Promise(function(_0x3fcf44,_0x4fc54e){var _0x201a3b=new AWS['S3']({'accessKeyId':_0x17d312,'secretAccessKey':_0x5c04e9,'region':_0x1b0197});_0x201a3b['upload']({'Bucket':_0x1dd38f,'Key':_0x5aa438,'Body':_0x594ce8},function(_0x4ad309,_0x5ccaf6){if(_0x4ad309){return _0x4fc54e(_0x4ad309);}else{return _0x3fcf44(_0x5ccaf6);}});});}function startTranscribe(_0x3c0807,_0x3203b7,_0x565878,_0x2d8e43,_0x2b165d,_0x897738){return new Promise(function(_0x410f57,_0x3f39f2){var _0x455b6b=new AWS[(_0x720e('0x6e'))]({'accessKeyId':_0x3203b7,'secretAccessKey':_0x3c0807,'region':_0x565878});_0x455b6b['startTranscriptionJob']({'TranscriptionJobName':_0x2d8e43,'LanguageCode':_0x2b165d,'Media':{'MediaFileUri':_0x897738}},function(_0xd19cc6,_0x2ea954){if(_0xd19cc6){return _0x3f39f2(_0xd19cc6);}else{return _0x410f57(_0x2ea954);}});});}function transcribe(_0x124d15,_0x29fa85,_0x34942e,_0x310075,_0x834890,_0x25e7b1,_0x569c62){return new Promise(function(_0x3bcc0c,_0x335ba0){var _0xffd99d={};logger[_0x720e('0x67')](util[_0x720e('0x30')](_0x720e('0x6f'),_0x124d15,_0x834890));return uploadFile(_0x29fa85,_0x34942e,_0x310075,_0x834890,path['basename'](_0x25e7b1),fs[_0x720e('0x70')](_0x25e7b1))[_0x720e('0x22')](function(_0x47f56c){logger['info'](util['format'](_0x720e('0x71'),_0x124d15,_0x834890,_0x47f56c[_0x720e('0x72')]));_0xffd99d[_0x720e('0x73')]=_0x47f56c[_0x720e('0x74')];_0xffd99d[_0x720e('0x75')]=_0x47f56c[_0x720e('0x72')];logger['info'](util[_0x720e('0x30')](_0x720e('0x76'),_0x124d15));return startTranscribe(_0x29fa85,_0x34942e,_0x310075,uuidv4(),_0x569c62,_0x47f56c['Location']);})['then'](function(_0xc87d91){logger['info'](util[_0x720e('0x30')](_0x720e('0x77'),_0x124d15,_0xc87d91[_0x720e('0x78')][_0x720e('0x79')]));_0xffd99d['transcribeName']=_0xc87d91['TranscriptionJob'][_0x720e('0x79')];_0xffd99d[_0x720e('0x7a')]=_0xc87d91['TranscriptionJob'][_0x720e('0x7b')];return _0x3bcc0c(_0xffd99d);})[_0x720e('0x43')](function(_0x29b4ae){return _0x335ba0(_0x29b4ae);});});}exports[_0x720e('0x7c')]=function(_0xe5ea66,_0x46e26a,_0x2d524d){var _0x5e3d47;var _0x4dec1b;var _0x2e4224;var _0xf5af52=require(_0x720e('0x4e'));return db[_0x720e('0x2a')][_0x720e('0x7d')]({'where':{'id':_0xe5ea66[_0x720e('0x45')]['id']}})[_0x720e('0x22')](function(_0x54594b){if(_0x54594b){var _0x5d75d7=util[_0x720e('0x30')]('%s.cypher',_0x54594b[_0x720e('0x50')]);if(fs['existsSync'](_0x5d75d7)){cypher=!![];return _0xf5af52['decryptFile'](_0x5d75d7,_0x54594b['value'],config['secrets'][_0x720e('0x54')])[_0x720e('0x22')](function(){return _0x54594b;});}return _0x54594b;}})[_0x720e('0x22')](function(_0x42e2de){if(!_0x42e2de){throw new db[(_0x720e('0x55'))]['ValidationError'](_0x720e('0x7e'));}_0x4dec1b=_0x42e2de;return db[_0x720e('0x7f')]['findOne']({'where':{'id':0x1}});})[_0x720e('0x22')](handleEntityNotFound(_0x46e26a,null))[_0x720e('0x22')](function(_0x397a94){if(_0x397a94){_0x5e3d47=_0x397a94;if(!_0x5e3d47[_0x720e('0x80')]||!_0x5e3d47['transcribeAccountId']||!_0x5e3d47['transcribeRegion']||!_0x5e3d47['language']||!_0x5e3d47[_0x720e('0x73')]){throw new db[(_0x720e('0x55'))]['ValidationError']('Transcribe\x20not\x20configured');}if(_0xe5ea66[_0x720e('0x4b')][_0x720e('0x81')]&&(!_0x5e3d47[_0x720e('0x82')]||!_0x5e3d47[_0x720e('0x83')]||!_0x5e3d47[_0x720e('0x84')]||!_0x5e3d47[_0x720e('0x85')]||!_0x5e3d47[_0x720e('0x73')])){throw new db[(_0x720e('0x55'))][(_0x720e('0x56'))](_0x720e('0x86'));}return db[_0x720e('0x87')]['findOne']({'where':{'id':_0x5e3d47[_0x720e('0x88')]}});}})['then'](function(_0x12df9d){if(!_0x12df9d){throw new db['Sequelize'][(_0x720e('0x56'))](_0x720e('0x89'));}if(!_0x12df9d[_0x720e('0x8a')]||!_0x12df9d['data2']){throw new db['Sequelize'][(_0x720e('0x56'))]('Cloud\x20Provider\x20not\x20configured');}_0x2e4224=_0x12df9d;return getBucketslist(_0x2e4224[_0x720e('0x8a')],_0x2e4224['data2'],_0x5e3d47[_0x720e('0x8b')]);})['then'](function(_0x1e5a5c){if(_0x1e5a5c&&_0x1e5a5c[_0x720e('0x8c')]){var _0x465c74=_[_0x720e('0x49')](_0x1e5a5c[_0x720e('0x8c')],function(_0x4de928){return _0x4de928[_0x720e('0x8d')]===_0x5e3d47[_0x720e('0x73')];});if(!_0x465c74){logger[_0x720e('0x67')](util['format'](_0x720e('0x8e'),_0xe5ea66[_0x720e('0x45')]['id'],_0x5e3d47['bucket']));return createBucket(_0x2e4224[_0x720e('0x8a')],_0x2e4224[_0x720e('0x8f')],_0x5e3d47[_0x720e('0x8b')],_0x5e3d47['bucket']);}logger[_0x720e('0x67')](util['format'](_0x720e('0x90'),_0xe5ea66[_0x720e('0x45')]['id'],_0x5e3d47[_0x720e('0x73')]));return;}})[_0x720e('0x22')](function(_0x482709){if(_0x4dec1b[_0x720e('0x7a')]===_0x720e('0x91')){return transcribe(_0xe5ea66[_0x720e('0x45')]['id'],_0x2e4224[_0x720e('0x8a')],_0x2e4224[_0x720e('0x8f')],_0x5e3d47[_0x720e('0x8b')],_0x5e3d47[_0x720e('0x73')],_0x4dec1b['value'],_0x5e3d47['language']);}else{logger[_0x720e('0x67')](util['format'](_0x720e('0x92'),_0xe5ea66[_0x720e('0x45')]['id']));return{'transcribeStatus':_0x720e('0x93')};}})[_0x720e('0x22')](function(_0x104b34){if(_0x104b34){_0x104b34[_0x720e('0x94')]=_0xe5ea66[_0x720e('0x4b')][_0x720e('0x81')];return _0x4dec1b[_0x720e('0x95')](_0x104b34);}})[_0x720e('0x22')](respondWithResult(_0x46e26a,null))[_0x720e('0x43')](handleError(_0x46e26a,null));};function writeFile(_0x23ccd5,_0x25037b){return new Promise(function(_0xf317c0,_0x163ec5){fs[_0x720e('0x96')](_0x25037b,_0x23ccd5,function(_0x219921,_0x16cc73){if(_0x219921){return _0x163ec5(_0x219921);}else{return _0xf317c0(_0x16cc73);}});});}exports[_0x720e('0x97')]=function(_0x47edc6,_0x558c23,_0x502424){return db['VoiceRecording'][_0x720e('0x7d')]({'where':{'id':_0x47edc6[_0x720e('0x45')]['id']}})[_0x720e('0x22')](handleEntityNotFound(_0x558c23))[_0x720e('0x22')](function(_0x4765f7){if(_0x4765f7&&_0x4765f7[_0x720e('0x98')]){var _0x428fbb=_0x4765f7[_0x720e('0x98')];var _0x1e9956=config[_0x720e('0x99')]+_0x720e('0x9a')+_0x4765f7['id']+_0x720e('0x9b');if(fs['existsSync'](_0x1e9956)){return _0x1e9956;}return writeFile(_0x428fbb,_0x1e9956)[_0x720e('0x22')](function(){return _0x1e9956;});}else{throw new db[(_0x720e('0x55'))][(_0x720e('0x56'))](_0x720e('0x9c'));}})['then'](function(_0x32309f){return _0x558c23[_0x720e('0x4d')](_0x32309f);})[_0x720e('0x43')](handleError(_0x558c23));}; \ No newline at end of file +var _0x2380=['/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','squel','jsforce','querystring','papaparse','uuid/v4','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','error','stack','name','send','index','map','VoiceRecording','rawAttributes','type','key','model','differenceBy','format','keys','query','filters','intersection','attributes','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','then','includeAll','include','findAll','rows','catch','show','params','fields','create','body','find','describe','../../components/encryptor','uniqueid','value','%s.cypher','decryptFile','secrets','recording','existsSync','ValidationError','VoiceRecording\x20not\x20found','extname','unlink','download','Not\x20found','sequelize','MD5','col','$and','push','Sequelize','filename','isNil','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','listBuckets','createBucket','upload','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','Location','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','transcribeName','TranscriptionJobName','runTranscribe','findOne','Setting','transcribeAccountId','transcribeRegion','bucket','Transcribe\x20not\x20configured','sentiment','language','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','transcribeStatus','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','runSentiment','updateAttributes','downloadTranscribe','fileText'];(function(_0x3e9a63,_0x438ae6){var _0x4883e4=function(_0x19183f){while(--_0x19183f){_0x3e9a63['push'](_0x3e9a63['shift']());}};_0x4883e4(++_0x438ae6);}(_0x2380,0x1bc));var _0x0238=function(_0x2f1762,_0xab43df){_0x2f1762=_0x2f1762-0x0;var _0x8ab21=_0x2380[_0x2f1762];return _0x8ab21;};'use strict';var emlformat=require(_0x0238('0x0'));var rimraf=require(_0x0238('0x1'));var zipdir=require(_0x0238('0x2'));var jsonpatch=require(_0x0238('0x3'));var rp=require(_0x0238('0x4'));var moment=require(_0x0238('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0238('0x6'));var util=require('util');var path=require(_0x0238('0x7'));var sox=require(_0x0238('0x8'));var csv=require(_0x0238('0x9'));var ejs=require(_0x0238('0xa'));var fs=require('fs');var fs_extra=require(_0x0238('0xb'));var _=require('lodash');var squel=require(_0x0238('0xc'));var crypto=require('crypto');var jsforce=require(_0x0238('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x0238('0xe'));var Papa=require(_0x0238('0xf'));var AWS=require('aws-sdk');var uuidv4=require(_0x0238('0x10'));var Redis=require(_0x0238('0x11'));var authService=require(_0x0238('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x0238('0x13'))(_0x0238('0x14'));var utils=require(_0x0238('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x0238('0x16'));var db=require(_0x0238('0x17'))['db'];function respondWithStatusCode(_0x22b70c,_0x197054){_0x197054=_0x197054||0xcc;return function(_0x1de3f0){if(_0x1de3f0){return _0x22b70c[_0x0238('0x18')](_0x197054);}return _0x22b70c['status'](_0x197054)[_0x0238('0x19')]();};}function respondWithResult(_0x3c1b8f,_0x49b711){_0x49b711=_0x49b711||0xc8;return function(_0x15dd6b){if(_0x15dd6b){return _0x3c1b8f[_0x0238('0x1a')](_0x49b711)[_0x0238('0x1b')](_0x15dd6b);}};}function respondWithFilteredResult(_0x13bf81,_0x4e48cb){return function(_0x12dcd3){if(_0x12dcd3){var _0xc11825=typeof _0x4e48cb[_0x0238('0x1c')]===_0x0238('0x1d')&&typeof _0x4e48cb[_0x0238('0x1e')]==='undefined';var _0x4467d5=_0x12dcd3[_0x0238('0x1f')];var _0x2d9fe4=_0xc11825?0x0:_0x4e48cb[_0x0238('0x1c')];var _0x398039=_0xc11825?_0x12dcd3[_0x0238('0x1f')]:_0x4e48cb['offset']+_0x4e48cb[_0x0238('0x1e')];var _0x10a1d9;if(_0x398039>=_0x4467d5){_0x398039=_0x4467d5;_0x10a1d9=0xc8;}else{_0x10a1d9=0xce;}_0x13bf81[_0x0238('0x1a')](_0x10a1d9);return _0x13bf81[_0x0238('0x20')](_0x0238('0x21'),_0x2d9fe4+'-'+_0x398039+'/'+_0x4467d5)[_0x0238('0x1b')](_0x12dcd3);}return null;};}function patchUpdates(_0x2b588d){return function(_0x1dcb08){try{jsonpatch[_0x0238('0x22')](_0x1dcb08,_0x2b588d,!![]);}catch(_0x43f7a4){return BPromise[_0x0238('0x23')](_0x43f7a4);}return _0x1dcb08[_0x0238('0x24')]();};}function saveUpdates(_0x3d27f6,_0x14bf03){return function(_0xf338de){if(_0xf338de){return _0xf338de[_0x0238('0x25')](_0x3d27f6)['then'](function(_0x2713f7){return _0x2713f7;});}return null;};}function removeEntity(_0x2d984a,_0x18704c){return function(_0x34bd74){if(_0x34bd74){return _0x34bd74[_0x0238('0x26')]()['then'](function(){_0x2d984a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x56fc9e,_0xd9b9fc){return function(_0x5ca7cb){if(!_0x5ca7cb){_0x56fc9e[_0x0238('0x18')](0x194);}return _0x5ca7cb;};}function handleError(_0x2a277e,_0xc77e89){_0xc77e89=_0xc77e89||0x1f4;return function(_0x535676){logger[_0x0238('0x27')](_0x535676[_0x0238('0x28')]);if(_0x535676['name']){delete _0x535676[_0x0238('0x29')];}_0x2a277e[_0x0238('0x1a')](_0xc77e89)[_0x0238('0x2a')](_0x535676);};}exports[_0x0238('0x2b')]=function(_0xc131f5,_0x2af9b4){var _0x3de828={},_0x45fb54={},_0x3f3d70={'count':0x0,'rows':[]};var _0x40a96f=_[_0x0238('0x2c')](db[_0x0238('0x2d')][_0x0238('0x2e')],function(_0x41db78){return{'name':_0x41db78['fieldName'],'type':_0x41db78[_0x0238('0x2f')][_0x0238('0x30')]};});_0x45fb54[_0x0238('0x31')]=_[_0x0238('0x32')](_[_0x0238('0x2c')](_0x40a96f,'name'),[_0x0238('0x33')]);_0x45fb54['query']=_[_0x0238('0x34')](_0xc131f5[_0x0238('0x35')]);_0x45fb54[_0x0238('0x36')]=_[_0x0238('0x37')](_0x45fb54['model'],_0x45fb54[_0x0238('0x35')]);_0x3de828[_0x0238('0x38')]=_[_0x0238('0x37')](_0x45fb54[_0x0238('0x31')],qs['fields'](_0xc131f5[_0x0238('0x35')]['fields']));_0x3de828[_0x0238('0x38')]=_0x3de828[_0x0238('0x38')][_0x0238('0x39')]?_0x3de828['attributes']:_0x45fb54[_0x0238('0x31')];if(!_0xc131f5[_0x0238('0x35')]['hasOwnProperty'](_0x0238('0x3a'))){_0x3de828[_0x0238('0x1e')]=qs[_0x0238('0x1e')](_0xc131f5[_0x0238('0x35')][_0x0238('0x1e')]);_0x3de828['offset']=qs['offset'](_0xc131f5[_0x0238('0x35')]['offset']);}_0x3de828[_0x0238('0x3b')]=qs[_0x0238('0x3c')](_0xc131f5[_0x0238('0x35')][_0x0238('0x3c')]);_0x3de828[_0x0238('0x3d')]=qs['filters'](_['pick'](_0xc131f5[_0x0238('0x35')],_0x45fb54[_0x0238('0x36')]),_0x40a96f);if(_0xc131f5[_0x0238('0x35')][_0x0238('0x3e')]){_0x3de828[_0x0238('0x3d')]=_[_0x0238('0x3f')](_0x3de828['where'],{'$or':_[_0x0238('0x2c')](_0x40a96f,function(_0x43f83c){if(_0x43f83c['type']!==_0x0238('0x40')){var _0x3ab11b={};_0x3ab11b[_0x43f83c[_0x0238('0x29')]]={'$like':'%'+_0xc131f5[_0x0238('0x35')][_0x0238('0x3e')]+'%'};return _0x3ab11b;}})});}_0x3de828=_['merge']({},_0x3de828,_0xc131f5[_0x0238('0x41')]);var _0x443104={'where':_0x3de828[_0x0238('0x3d')]};return db[_0x0238('0x2d')][_0x0238('0x1f')](_0x443104)[_0x0238('0x42')](function(_0x1e694e){_0x3f3d70[_0x0238('0x1f')]=_0x1e694e;if(_0xc131f5[_0x0238('0x35')][_0x0238('0x43')]){_0x3de828[_0x0238('0x44')]=[{'all':!![]}];}return db[_0x0238('0x2d')][_0x0238('0x45')](_0x3de828);})[_0x0238('0x42')](function(_0x304301){_0x3f3d70[_0x0238('0x46')]=_0x304301;return _0x3f3d70;})[_0x0238('0x42')](respondWithFilteredResult(_0x2af9b4,_0x3de828))[_0x0238('0x47')](handleError(_0x2af9b4,null));};exports[_0x0238('0x48')]=function(_0x454362,_0x154338){var _0x3c6e77={'raw':![],'where':{'id':_0x454362[_0x0238('0x49')]['id']}},_0x231bc2={};_0x231bc2['model']=_['keys'](db['VoiceRecording'][_0x0238('0x2e')]);_0x231bc2[_0x0238('0x35')]=_[_0x0238('0x34')](_0x454362[_0x0238('0x35')]);_0x231bc2['filters']=_[_0x0238('0x37')](_0x231bc2[_0x0238('0x31')],_0x231bc2[_0x0238('0x35')]);_0x3c6e77[_0x0238('0x38')]=_[_0x0238('0x37')](_0x231bc2[_0x0238('0x31')],qs['fields'](_0x454362['query'][_0x0238('0x4a')]));_0x3c6e77[_0x0238('0x38')]=_0x3c6e77[_0x0238('0x38')][_0x0238('0x39')]?_0x3c6e77['attributes']:_0x231bc2[_0x0238('0x31')];if(_0x454362[_0x0238('0x35')]['includeAll']){_0x3c6e77['include']=[{'all':!![]}];}_0x3c6e77=_['merge']({},_0x3c6e77,_0x454362[_0x0238('0x41')]);return db['VoiceRecording']['find'](_0x3c6e77)[_0x0238('0x42')](handleEntityNotFound(_0x154338,null))[_0x0238('0x42')](respondWithResult(_0x154338,null))['catch'](handleError(_0x154338,null));};exports[_0x0238('0x4b')]=function(_0x276c67,_0x1f2238){return db[_0x0238('0x2d')][_0x0238('0x4b')](_0x276c67[_0x0238('0x4c')],{})[_0x0238('0x42')](respondWithResult(_0x1f2238,0xc9))['catch'](handleError(_0x1f2238,null));};exports[_0x0238('0x25')]=function(_0x1612c3,_0x13402e){if(_0x1612c3['body']['id']){delete _0x1612c3[_0x0238('0x4c')]['id'];}return db[_0x0238('0x2d')][_0x0238('0x4d')]({'where':{'id':_0x1612c3[_0x0238('0x49')]['id']}})[_0x0238('0x42')](handleEntityNotFound(_0x13402e,null))[_0x0238('0x42')](saveUpdates(_0x1612c3[_0x0238('0x4c')],null))[_0x0238('0x42')](respondWithResult(_0x13402e,null))[_0x0238('0x47')](handleError(_0x13402e,null));};exports['describe']=function(_0x32621f,_0x6bb7d0){return db['VoiceRecording'][_0x0238('0x4e')]()[_0x0238('0x42')](respondWithResult(_0x6bb7d0,null))[_0x0238('0x47')](handleError(_0x6bb7d0,null));};exports['download']=function(_0x200bb6,_0x1a321c,_0x36607c){var _0x4e678c=require(_0x0238('0x4f'));var _0x28cf3b=![];var _0x53b4ce={};if(_0x200bb6[_0x0238('0x35')]['type']&&_0x200bb6['query'][_0x0238('0x2f')]===_0x0238('0x50')){_0x53b4ce[_0x0238('0x50')]=_0x200bb6[_0x0238('0x49')]['id'];}else{_0x53b4ce['id']=_0x200bb6[_0x0238('0x49')]['id'];}return db['VoiceRecording'][_0x0238('0x4d')]({'where':_0x53b4ce,'attributes':['id',_0x0238('0x51')],'raw':!![]})[_0x0238('0x42')](handleEntityNotFound(_0x1a321c,null))[_0x0238('0x42')](function(_0x555d1d){if(_0x555d1d){var _0x1e69eb=_0x555d1d[_0x0238('0x51')];var _0x415afb=util['format'](_0x0238('0x52'),_0x1e69eb);if(fs['existsSync'](_0x415afb)){_0x28cf3b=!![];return _0x4e678c[_0x0238('0x53')](_0x415afb,_0x1e69eb,config[_0x0238('0x54')][_0x0238('0x55')])['then'](function(){return _0x555d1d;});}return _0x555d1d;}})[_0x0238('0x42')](function(_0x375dc4){if(_0x375dc4){var _0x230574=_0x375dc4[_0x0238('0x51')];if(!fs[_0x0238('0x56')](_0x230574)){throw new db['Sequelize'][(_0x0238('0x57'))](_0x0238('0x58'));}if(_0x375dc4['filename']){return _0x1a321c['download'](_0x230574,_0x375dc4['filename']+path[_0x0238('0x59')](_0x230574),function(){if(_0x28cf3b){fs[_0x0238('0x5a')](_0x230574);}});}else{return _0x1a321c[_0x0238('0x5b')](_0x230574,function(_0x5ee4dd){if(_0x28cf3b){fs[_0x0238('0x5a')](_0x230574);}});}}})[_0x0238('0x47')](function(_0x3c8594){if(_0x3c8594['message']===_0x0238('0x58')){_0x1a321c[_0x0238('0x1a')](0x194)[_0x0238('0x2a')](_0x0238('0x5c'));}else{return handleError(_0x1a321c,null);}});};exports['downloads']=function(_0x482c29,_0xef1d61,_0x425b63){var _0x11b97c=require('../../components/encryptor');var _0x26e9d0=![];var _0x4e11ed={'$and':[db[_0x0238('0x5d')][_0x0238('0x3d')](db[_0x0238('0x5d')]['fn'](_0x0238('0x5e'),db[_0x0238('0x5d')][_0x0238('0x5f')]('uniqueid')),_0x482c29[_0x0238('0x35')]['token'])]};if(_0x482c29['query'][_0x0238('0x2f')]&&_0x482c29['query']['type']===_0x0238('0x50')){_0x4e11ed[_0x0238('0x60')]['push']({'uniqueid':_0x482c29['params']['id']});}else{_0x4e11ed['$and'][_0x0238('0x61')]({'id':_0x482c29[_0x0238('0x49')]['id']});}return db[_0x0238('0x2d')][_0x0238('0x4d')]({'where':_0x4e11ed,'attributes':['id',_0x0238('0x51')],'raw':!![]})[_0x0238('0x42')](handleEntityNotFound(_0xef1d61,null))['then'](function(_0x2a6f50){if(_0x2a6f50){var _0x5028e3=util[_0x0238('0x33')](_0x0238('0x52'),_0x2a6f50[_0x0238('0x51')]);if(fs['existsSync'](_0x5028e3)){_0x26e9d0=!![];return _0x11b97c['decryptFile'](_0x5028e3,_0x2a6f50[_0x0238('0x51')],config[_0x0238('0x54')][_0x0238('0x55')])[_0x0238('0x42')](function(){return _0x2a6f50;});}return _0x2a6f50;}})[_0x0238('0x42')](function(_0xe0aee6){if(_0xe0aee6){if(!fs[_0x0238('0x56')](_0xe0aee6[_0x0238('0x51')])){throw new db[(_0x0238('0x62'))][(_0x0238('0x57'))](_0x0238('0x58'));}if(_0xe0aee6[_0x0238('0x63')]){return _0xef1d61[_0x0238('0x5b')](_0xe0aee6[_0x0238('0x51')],_0xe0aee6['filename']+path[_0x0238('0x59')](_0xe0aee6[_0x0238('0x51')]),function(){if(_0x26e9d0){fs[_0x0238('0x5a')](_0xe0aee6[_0x0238('0x51')]);}});}else{return _0xef1d61[_0x0238('0x5b')](_0xe0aee6[_0x0238('0x51')],function(_0x1f517d){if(_0x26e9d0){fs[_0x0238('0x5a')](_0xe0aee6[_0x0238('0x51')]);}});}}})[_0x0238('0x47')](handleError(_0xef1d61,null));};exports[_0x0238('0x26')]=function(_0x1c0886,_0x1d8d42){return db[_0x0238('0x2d')][_0x0238('0x4d')]({'where':{'id':_0x1c0886[_0x0238('0x49')]['id']}})[_0x0238('0x42')](function(_0x59da2e){if(_[_0x0238('0x64')](_0x59da2e)){throw new ReferenceError(_0x0238('0x65'));}return _0x59da2e;})[_0x0238('0x42')](function(_0x553295){var _0x44fd2d=_0x553295[_0x0238('0x51')];logger['info'](_0x0238('0x66'),_0x44fd2d);if(!_[_0x0238('0x64')](_0x553295['value'])&&fs[_0x0238('0x56')](_0x44fd2d)){logger[_0x0238('0x67')](_0x0238('0x68')+_0x44fd2d+_0x0238('0x69'));fs[_0x0238('0x6a')](_0x44fd2d);}_0x44fd2d=_0x44fd2d+'.cypher';if(!_[_0x0238('0x64')](_0x553295[_0x0238('0x51')])&&fs['existsSync'](_0x44fd2d)){logger[_0x0238('0x67')]('File:\x20\x22'+_0x44fd2d+_0x0238('0x69'));fs[_0x0238('0x6a')](_0x44fd2d);}return _0x553295;})[_0x0238('0x42')](function(_0xb9491f){if(!_0xb9491f)throw new InternalError();return _0xb9491f[_0x0238('0x26')]();})['then'](function(){_0x1d8d42[_0x0238('0x1a')](0xcc)[_0x0238('0x19')]();})[_0x0238('0x47')](handleError(_0x1d8d42,null));};function getBucketslist(_0x50e12a,_0x294142,_0x22eafb){return new Promise(function(_0x447f55,_0x35a206){var _0x33919a=new AWS['S3']({'accessKeyId':_0x294142,'secretAccessKey':_0x50e12a,'region':_0x22eafb});_0x33919a[_0x0238('0x6b')]({},function(_0xab6eea,_0x232ba5){if(_0xab6eea){return _0x35a206(_0xab6eea);}else{return _0x447f55(_0x232ba5);}});});}function createBucket(_0x534b49,_0x6e040e,_0x38869c,_0x113daa){return new Promise(function(_0x520846,_0x23b25e){var _0x45cdb3=new AWS['S3']({'accessKeyId':_0x6e040e,'secretAccessKey':_0x534b49,'region':_0x38869c});_0x45cdb3[_0x0238('0x6c')]({'Bucket':_0x113daa},function(_0x336bb9,_0x51a94b){if(_0x336bb9){return _0x23b25e(_0x336bb9);}else{return _0x520846(_0x51a94b);}});});}function uploadFile(_0x4472cc,_0x392e14,_0x159b9d,_0x403c6e,_0x197ae3,_0x5de82f){return new Promise(function(_0x19f4cf,_0x4af128){var _0x44a16c=new AWS['S3']({'accessKeyId':_0x392e14,'secretAccessKey':_0x4472cc,'region':_0x159b9d});_0x44a16c[_0x0238('0x6d')]({'Bucket':_0x403c6e,'Key':_0x197ae3,'Body':_0x5de82f},function(_0x12f56b,_0x337fe9){if(_0x12f56b){return _0x4af128(_0x12f56b);}else{return _0x19f4cf(_0x337fe9);}});});}function startTranscribe(_0x427bc0,_0x3dcc57,_0x3de322,_0x222c6f,_0x1fb0cc,_0x279904){return new Promise(function(_0xf70fa8,_0x3d1d6d){var _0xc5b61d=new AWS['TranscribeService']({'accessKeyId':_0x3dcc57,'secretAccessKey':_0x427bc0,'region':_0x3de322});_0xc5b61d[_0x0238('0x6e')]({'TranscriptionJobName':_0x222c6f,'LanguageCode':_0x1fb0cc,'Media':{'MediaFileUri':_0x279904}},function(_0x3026f9,_0x6d0f49){if(_0x3026f9){return _0x3d1d6d(_0x3026f9);}else{return _0xf70fa8(_0x6d0f49);}});});}function transcribe(_0x2e5e71,_0x491bb7,_0x30a5a0,_0x5a8034,_0x4f06d6,_0x434227,_0x2350af){return new Promise(function(_0x5e4b77,_0x16ab1b){var _0x3c190b={};logger[_0x0238('0x67')](util[_0x0238('0x33')](_0x0238('0x6f'),_0x2e5e71,_0x4f06d6));return uploadFile(_0x491bb7,_0x30a5a0,_0x5a8034,_0x4f06d6,path[_0x0238('0x70')](_0x434227),fs[_0x0238('0x71')](_0x434227))[_0x0238('0x42')](function(_0x4259e0){logger[_0x0238('0x67')](util['format']('[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)',_0x2e5e71,_0x4f06d6,_0x4259e0[_0x0238('0x72')]));_0x3c190b['bucket']=_0x4259e0['Bucket'];_0x3c190b[_0x0238('0x73')]=_0x4259e0[_0x0238('0x72')];logger[_0x0238('0x67')](util['format'](_0x0238('0x74'),_0x2e5e71));return startTranscribe(_0x491bb7,_0x30a5a0,_0x5a8034,uuidv4(),_0x2350af,_0x4259e0[_0x0238('0x72')]);})[_0x0238('0x42')](function(_0x3b03ea){logger[_0x0238('0x67')](util['format'](_0x0238('0x75'),_0x2e5e71,_0x3b03ea[_0x0238('0x76')]['TranscriptionJobName']));_0x3c190b[_0x0238('0x77')]=_0x3b03ea[_0x0238('0x76')][_0x0238('0x78')];_0x3c190b['transcribeStatus']=_0x3b03ea[_0x0238('0x76')]['TranscriptionJobStatus'];return _0x5e4b77(_0x3c190b);})['catch'](function(_0x3bada5){return _0x16ab1b(_0x3bada5);});});}exports[_0x0238('0x79')]=function(_0x26caee,_0x401d7b,_0x5779c9){var _0xeae750;var _0x474392;var _0x17079c;var _0x29a6a4=require(_0x0238('0x4f'));return db[_0x0238('0x2d')][_0x0238('0x7a')]({'where':{'id':_0x26caee['params']['id']}})[_0x0238('0x42')](function(_0x570b16){if(_0x570b16){var _0x4efc67=util[_0x0238('0x33')]('%s.cypher',_0x570b16['value']);if(fs['existsSync'](_0x4efc67)){cypher=!![];return _0x29a6a4[_0x0238('0x53')](_0x4efc67,_0x570b16[_0x0238('0x51')],config[_0x0238('0x54')]['recording'])['then'](function(){return _0x570b16;});}return _0x570b16;}})[_0x0238('0x42')](function(_0x4cd892){if(!_0x4cd892){throw new db[(_0x0238('0x62'))][(_0x0238('0x57'))]('Voice\x20Recording\x20not\x20found');}_0x474392=_0x4cd892;return db[_0x0238('0x7b')]['findOne']({'where':{'id':0x1}});})[_0x0238('0x42')](handleEntityNotFound(_0x401d7b,null))[_0x0238('0x42')](function(_0x2ec34c){if(_0x2ec34c){_0xeae750=_0x2ec34c;if(!_0xeae750['transcribe']||!_0xeae750[_0x0238('0x7c')]||!_0xeae750[_0x0238('0x7d')]||!_0xeae750['language']||!_0xeae750[_0x0238('0x7e')]){throw new db[(_0x0238('0x62'))]['ValidationError'](_0x0238('0x7f'));}if(_0x26caee[_0x0238('0x4c')]['runSentiment']&&(!_0xeae750[_0x0238('0x80')]||!_0xeae750['sentimentAccountId']||!_0xeae750['sentimentRegion']||!_0xeae750[_0x0238('0x81')]||!_0xeae750[_0x0238('0x7e')])){throw new db[(_0x0238('0x62'))]['ValidationError']('Sentiment\x20Analysis\x20not\x20configured');}return db[_0x0238('0x82')][_0x0238('0x7a')]({'where':{'id':_0xeae750['transcribeAccountId']}});}})[_0x0238('0x42')](function(_0x3e196e){if(!_0x3e196e){throw new db[(_0x0238('0x62'))]['ValidationError'](_0x0238('0x83'));}if(!_0x3e196e[_0x0238('0x84')]||!_0x3e196e[_0x0238('0x85')]){throw new db[(_0x0238('0x62'))][(_0x0238('0x57'))](_0x0238('0x86'));}_0x17079c=_0x3e196e;return getBucketslist(_0x17079c[_0x0238('0x84')],_0x17079c['data2'],_0xeae750['transcribeRegion']);})[_0x0238('0x42')](function(_0x4c25fd){if(_0x4c25fd&&_0x4c25fd[_0x0238('0x87')]){var _0xba26f=_[_0x0238('0x4d')](_0x4c25fd[_0x0238('0x87')],function(_0x44843a){return _0x44843a[_0x0238('0x88')]===_0xeae750[_0x0238('0x7e')];});if(!_0xba26f){logger[_0x0238('0x67')](util[_0x0238('0x33')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x26caee['params']['id'],_0xeae750[_0x0238('0x7e')]));return createBucket(_0x17079c['data1'],_0x17079c[_0x0238('0x85')],_0xeae750[_0x0238('0x7d')],_0xeae750[_0x0238('0x7e')]);}logger['info'](util[_0x0238('0x33')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0x26caee['params']['id'],_0xeae750[_0x0238('0x7e')]));return;}})[_0x0238('0x42')](function(_0xbb4a03){if(_0x474392[_0x0238('0x89')]===_0x0238('0x8a')){return transcribe(_0x26caee['params']['id'],_0x17079c[_0x0238('0x84')],_0x17079c[_0x0238('0x85')],_0xeae750[_0x0238('0x7d')],_0xeae750['bucket'],_0x474392[_0x0238('0x51')],_0xeae750['language']);}else{logger[_0x0238('0x67')](util['format'](_0x0238('0x8b'),_0x26caee[_0x0238('0x49')]['id']));return{'transcribeStatus':'IN_PROGRESS'};}})[_0x0238('0x42')](function(_0xfd26fe){if(_0xfd26fe){_0xfd26fe['tempSentiment']=_0x26caee['body'][_0x0238('0x8c')];return _0x474392[_0x0238('0x8d')](_0xfd26fe);}})[_0x0238('0x42')](respondWithResult(_0x401d7b,null))[_0x0238('0x47')](handleError(_0x401d7b,null));};function writeFile(_0x11afc0,_0x1df35a){return new Promise(function(_0x2546f8,_0x56bc9c){fs['writeFile'](_0x1df35a,_0x11afc0,function(_0x262004,_0x2725f4){if(_0x262004){return _0x56bc9c(_0x262004);}else{return _0x2546f8(_0x2725f4);}});});}exports[_0x0238('0x8e')]=function(_0x23fe23,_0x5d282e,_0x1673ce){return db['VoiceRecording'][_0x0238('0x7a')]({'where':{'id':_0x23fe23[_0x0238('0x49')]['id']}})[_0x0238('0x42')](handleEntityNotFound(_0x5d282e))[_0x0238('0x42')](function(_0x48ab23){if(_0x48ab23&&_0x48ab23['fileText']){var _0x709181=_0x48ab23[_0x0238('0x8f')];var _0x476a60=config['root']+_0x0238('0x90')+_0x48ab23['id']+_0x0238('0x91');if(fs[_0x0238('0x56')](_0x476a60)){return _0x476a60;}return writeFile(_0x709181,_0x476a60)[_0x0238('0x42')](function(){return _0x476a60;});}else{throw new db[(_0x0238('0x62'))][(_0x0238('0x57'))](_0x0238('0x92'));}})[_0x0238('0x42')](function(_0x170fd8){return _0x5d282e['download'](_0x170fd8);})['catch'](handleError(_0x5d282e));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 006bc6a..675ecd0 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 _0xe75e=['util','../../config/logger','api','path','rimraf','./voiceRecording.attributes','exports','VoiceRecording','voice_recordings','uniqueid','lodash'];(function(_0x1bcbe4,_0x47436b){var _0x126942=function(_0x4ff80b){while(--_0x4ff80b){_0x1bcbe4['push'](_0x1bcbe4['shift']());}};_0x126942(++_0x47436b);}(_0xe75e,0x15f));var _0xee75=function(_0x1d80be,_0x3a60ff){_0x1d80be=_0x1d80be-0x0;var _0xf9a4f3=_0xe75e[_0x1d80be];return _0xf9a4f3;};'use strict';var _=require(_0xee75('0x0'));var util=require(_0xee75('0x1'));var logger=require(_0xee75('0x2'))(_0xee75('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xee75('0x4'));var rimraf=require(_0xee75('0x5'));var config=require('../../config/environment');var attributes=require(_0xee75('0x6'));module[_0xee75('0x7')]=function(_0xcf7f2d,_0x517f76){return _0xcf7f2d['define'](_0xee75('0x8'),attributes,{'tableName':_0xee75('0x9'),'paranoid':![],'indexes':[{'name':_0xee75('0xa'),'fields':[_0xee75('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x004d=['request-promise','rimraf','../../config/environment','./voiceRecording.attributes','define','uniqueid','lodash','../../config/logger','api','moment','bluebird'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x004d,0xc1));var _0xd004=function(_0xa95cb0,_0xb20ec4){_0xa95cb0=_0xa95cb0-0x0;var _0x39d4d6=_0x004d[_0xa95cb0];return _0x39d4d6;};'use strict';var _=require(_0xd004('0x0'));var util=require('util');var logger=require(_0xd004('0x1'))(_0xd004('0x2'));var moment=require(_0xd004('0x3'));var BPromise=require(_0xd004('0x4'));var rp=require(_0xd004('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd004('0x6'));var config=require(_0xd004('0x7'));var attributes=require(_0xd004('0x8'));module['exports']=function(_0x118460,_0x4354dc){return _0x118460[_0xd004('0x9')]('VoiceRecording',attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':_0xd004('0xa'),'fields':[_0xd004('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 76414a2..4a4b2cf 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 _0x4137=['attributes','catch','CreateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','then','VoiceRecording','existsSync','value','format','%s.cypher','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceRecording,\x20%s,\x20%s','message','UpdateVoiceRecording','update','body','options','where'];(function(_0xcb6d2b,_0x1a56ac){var _0x2c3687=function(_0x1b6ed0){while(--_0x1b6ed0){_0xcb6d2b['push'](_0xcb6d2b['shift']());}};_0x2c3687(++_0x1a56ac);}(_0x4137,0xf8));var _0x7413=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x4137[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0x7413('0x0'));var util=require(_0x7413('0x1'));var moment=require(_0x7413('0x2'));var BPromise=require(_0x7413('0x3'));var rs=require(_0x7413('0x4'));var fs=require('fs');var Redis=require(_0x7413('0x5'));var db=require(_0x7413('0x6'))['db'];var utils=require(_0x7413('0x7'));var logger=require(_0x7413('0x8'))(_0x7413('0x9'));var config=require(_0x7413('0xa'));var jayson=require(_0x7413('0xb'));var client=jayson['client'][_0x7413('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x188d89,_0x5b39ac,_0x15af0d){return new BPromise(function(_0x5f4cd0,_0x3236ec){return client[_0x7413('0xd')](_0x188d89,_0x15af0d)['then'](function(_0x422bf5){logger[_0x7413('0xe')]('VoiceRecording,\x20%s,\x20%s',_0x5b39ac,_0x7413('0xf'));logger[_0x7413('0x10')](_0x7413('0x11'),_0x5b39ac,_0x7413('0xf'),JSON[_0x7413('0x12')](_0x422bf5));if(_0x422bf5['error']){if(_0x422bf5[_0x7413('0x13')][_0x7413('0x14')]===0x1f4){logger['error'](_0x7413('0x15'),_0x5b39ac,_0x422bf5[_0x7413('0x13')][_0x7413('0x16')]);return _0x3236ec(_0x422bf5['error']['message']);}logger['error'](_0x7413('0x15'),_0x5b39ac,_0x422bf5[_0x7413('0x13')]['message']);return _0x5f4cd0(_0x422bf5[_0x7413('0x13')][_0x7413('0x16')]);}else{logger['info'](_0x7413('0x15'),_0x5b39ac,'request\x20sent');_0x5f4cd0(_0x422bf5['result'][_0x7413('0x16')]);}})['catch'](function(_0x195c72){logger['error'](_0x7413('0x15'),_0x5b39ac,_0x195c72);_0x3236ec(_0x195c72);});});}exports[_0x7413('0x17')]=function(_0x19157f){var _0x12a01e=this;return new Promise(function(_0x2a3417,_0x26dafe){return db['VoiceRecording'][_0x7413('0x18')](_0x19157f[_0x7413('0x19')],{'raw':_0x19157f[_0x7413('0x1a')]?_0x19157f[_0x7413('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x19157f[_0x7413('0x1a')]?_0x19157f[_0x7413('0x1a')][_0x7413('0x1b')]||null:null,'attributes':_0x19157f[_0x7413('0x1a')]?_0x19157f[_0x7413('0x1a')][_0x7413('0x1c')]||null:null,'limit':_0x19157f[_0x7413('0x1a')]?_0x19157f[_0x7413('0x1a')]['limit']||null:null})['then'](function(_0x138508){logger['info'](_0x7413('0x17'),_0x19157f);logger[_0x7413('0x10')](_0x7413('0x17'),_0x19157f,JSON[_0x7413('0x12')](_0x138508));_0x2a3417(_0x138508);})[_0x7413('0x1d')](function(_0x346ce8){logger[_0x7413('0x13')](_0x7413('0x17'),_0x346ce8[_0x7413('0x16')],_0x19157f);_0x26dafe(_0x12a01e['error'](0x1f4,_0x346ce8['message']));});});};exports[_0x7413('0x1e')]=function(_0x48c2dc){var _0x46c895=this;return new Promise(function(_0x71cbb4,_0x463b21){var _0x4c2e90=require(_0x7413('0x1f'));var _0x896552;return db[_0x7413('0x20')][_0x7413('0x21')]({'attributes':['id',_0x7413('0x22')],'where':{'id':0x1},'raw':!![]})[_0x7413('0x23')](function(_0x5eb4d9){_0x896552=_0x5eb4d9;return db[_0x7413('0x24')]['create'](_0x48c2dc[_0x7413('0x19')]);})[_0x7413('0x23')](function(_0xae2969){if(_0x896552[_0x7413('0x22')]&&fs[_0x7413('0x25')](_0xae2969[_0x7413('0x26')])){var _0x5bb3ea=util[_0x7413('0x27')](_0x7413('0x28'),_0xae2969[_0x7413('0x26')]);return _0x4c2e90[_0x7413('0x29')](_0xae2969[_0x7413('0x26')],_0x5bb3ea,config[_0x7413('0x2a')][_0x7413('0x2b')])['then'](function(){fs[_0x7413('0x2c')](_0xae2969[_0x7413('0x26')]);logger[_0x7413('0xe')](_0x7413('0x2d'));return _0xae2969;});}return _0xae2969;})[_0x7413('0x23')](function(_0x51d676){logger[_0x7413('0xe')]('CreateVoiceRecording',_0x48c2dc);logger[_0x7413('0x10')](_0x7413('0x1e'),_0x48c2dc,JSON[_0x7413('0x12')](_0x51d676));_0x71cbb4(_0x51d676);})['catch'](function(_0xe6b096){logger['error'](_0x7413('0x1e'),_0xe6b096[_0x7413('0x16')],_0x48c2dc);_0x463b21(_0x46c895['error'](0x1f4,_0xe6b096['message']));});});}; \ No newline at end of file +var _0x0424=['stringify','error','message','info','result','catch','UpdateVoiceRecording','VoiceRecording','body','options','raw','where','limit','CreateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','value','%s.cypher','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s'];(function(_0x3fcfb6,_0x515024){var _0x3b99a7=function(_0x10ddfd){while(--_0x10ddfd){_0x3fcfb6['push'](_0x3fcfb6['shift']());}};_0x3b99a7(++_0x515024);}(_0x0424,0x159));var _0x4042=function(_0x38576d,_0x527dc7){_0x38576d=_0x38576d-0x0;var _0x32534a=_0x0424[_0x38576d];return _0x32534a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4042('0x0'));var BPromise=require(_0x4042('0x1'));var rs=require(_0x4042('0x2'));var fs=require('fs');var Redis=require(_0x4042('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4042('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x4042('0x5'));var jayson=require(_0x4042('0x6'));var client=jayson[_0x4042('0x7')][_0x4042('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3abaf1,_0xa5310f,_0x10ec07){return new BPromise(function(_0x5d11bf,_0x509772){return client[_0x4042('0x9')](_0x3abaf1,_0x10ec07)[_0x4042('0xa')](function(_0x103e4a){logger['info'](_0x4042('0xb'),_0xa5310f,_0x4042('0xc'));logger[_0x4042('0xd')](_0x4042('0xe'),_0xa5310f,_0x4042('0xc'),JSON[_0x4042('0xf')](_0x103e4a));if(_0x103e4a[_0x4042('0x10')]){if(_0x103e4a[_0x4042('0x10')]['code']===0x1f4){logger[_0x4042('0x10')](_0x4042('0xb'),_0xa5310f,_0x103e4a['error'][_0x4042('0x11')]);return _0x509772(_0x103e4a[_0x4042('0x10')][_0x4042('0x11')]);}logger[_0x4042('0x10')](_0x4042('0xb'),_0xa5310f,_0x103e4a[_0x4042('0x10')][_0x4042('0x11')]);return _0x5d11bf(_0x103e4a['error'][_0x4042('0x11')]);}else{logger[_0x4042('0x12')]('VoiceRecording,\x20%s,\x20%s',_0xa5310f,_0x4042('0xc'));_0x5d11bf(_0x103e4a[_0x4042('0x13')][_0x4042('0x11')]);}})[_0x4042('0x14')](function(_0x31e765){logger[_0x4042('0x10')](_0x4042('0xb'),_0xa5310f,_0x31e765);_0x509772(_0x31e765);});});}exports[_0x4042('0x15')]=function(_0x466077){var _0x4b02d4=this;return new Promise(function(_0xe5c1ec,_0x4fe024){return db[_0x4042('0x16')]['update'](_0x466077[_0x4042('0x17')],{'raw':_0x466077[_0x4042('0x18')]?_0x466077[_0x4042('0x18')][_0x4042('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x466077['options']?_0x466077[_0x4042('0x18')][_0x4042('0x1a')]||null:null,'attributes':_0x466077[_0x4042('0x18')]?_0x466077[_0x4042('0x18')]['attributes']||null:null,'limit':_0x466077[_0x4042('0x18')]?_0x466077[_0x4042('0x18')][_0x4042('0x1b')]||null:null})[_0x4042('0xa')](function(_0x352631){logger['info'](_0x4042('0x15'),_0x466077);logger[_0x4042('0xd')]('UpdateVoiceRecording',_0x466077,JSON[_0x4042('0xf')](_0x352631));_0xe5c1ec(_0x352631);})['catch'](function(_0x271b82){logger[_0x4042('0x10')](_0x4042('0x15'),_0x271b82['message'],_0x466077);_0x4fe024(_0x4b02d4[_0x4042('0x10')](0x1f4,_0x271b82[_0x4042('0x11')]));});});};exports[_0x4042('0x1c')]=function(_0xbdadc8){var _0x1c4d9f=this;return new Promise(function(_0x52e575,_0x58c409){var _0x1d8d48=require(_0x4042('0x1d'));var _0x26542c;return db[_0x4042('0x1e')][_0x4042('0x1f')]({'attributes':['id',_0x4042('0x20')],'where':{'id':0x1},'raw':!![]})['then'](function(_0x33733b){_0x26542c=_0x33733b;return db[_0x4042('0x16')]['create'](_0xbdadc8[_0x4042('0x17')]);})[_0x4042('0xa')](function(_0xe924fe){if(_0x26542c['callRecordingEncryption']&&fs['existsSync'](_0xe924fe[_0x4042('0x21')])){var _0x43bd1c=util['format'](_0x4042('0x22'),_0xe924fe[_0x4042('0x21')]);return _0x1d8d48[_0x4042('0x23')](_0xe924fe[_0x4042('0x21')],_0x43bd1c,config[_0x4042('0x24')][_0x4042('0x25')])[_0x4042('0xa')](function(){fs[_0x4042('0x26')](_0xe924fe[_0x4042('0x21')]);logger['info'](_0x4042('0x27'));return _0xe924fe;});}return _0xe924fe;})[_0x4042('0xa')](function(_0x5320f8){logger[_0x4042('0x12')](_0x4042('0x1c'),_0xbdadc8);logger['debug'](_0x4042('0x1c'),_0xbdadc8,JSON[_0x4042('0xf')](_0x5320f8));_0x52e575(_0x5320f8);})[_0x4042('0x14')](function(_0xaa7c99){logger[_0x4042('0x10')](_0x4042('0x1c'),_0xaa7c99[_0x4042('0x11')],_0xbdadc8);_0x58c409(_0x1c4d9f[_0x4042('0x10')](0x1f4,_0xaa7c99[_0x4042('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index c4d19d9..6a53bee 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 _0xdfec=['destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceTransferReport.controller','get','index','/describe','isAuthenticated','/:id','show','post','update','delete'];(function(_0x19ee66,_0x13525e){var _0xad1546=function(_0x42779a){while(--_0x42779a){_0x19ee66['push'](_0x19ee66['shift']());}};_0xad1546(++_0x13525e);}(_0xdfec,0xd3));var _0xcdfe=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xdfec[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xcdfe('0x0'));var util=require('util');var path=require(_0xcdfe('0x1'));var timeout=require('connect-timeout');var express=require(_0xcdfe('0x2'));var router=express[_0xcdfe('0x3')]();var fs_extra=require(_0xcdfe('0x4'));var auth=require(_0xcdfe('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xcdfe('0x6'));var controller=require(_0xcdfe('0x7'));router[_0xcdfe('0x8')]('/',auth['isAuthenticated'](),controller[_0xcdfe('0x9')]);router[_0xcdfe('0x8')](_0xcdfe('0xa'),auth[_0xcdfe('0xb')](),controller['describe']);router[_0xcdfe('0x8')](_0xcdfe('0xc'),auth['isAuthenticated'](),controller[_0xcdfe('0xd')]);router[_0xcdfe('0xe')]('/',auth[_0xcdfe('0xb')](),controller['create']);router['put'](_0xcdfe('0xc'),auth['isAuthenticated'](),controller[_0xcdfe('0xf')]);router[_0xcdfe('0x10')](_0xcdfe('0xc'),auth[_0xcdfe('0xb')](),controller[_0xcdfe('0x11')]);module[_0xcdfe('0x12')]=router; \ No newline at end of file +var _0x4a10=['Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','index','/describe','describe','/:id','isAuthenticated','show','update','delete','destroy','exports','multer','path','connect-timeout','express'];(function(_0x1d26f8,_0x40fcc4){var _0x3064ea=function(_0x381d88){while(--_0x381d88){_0x1d26f8['push'](_0x1d26f8['shift']());}};_0x3064ea(++_0x40fcc4);}(_0x4a10,0x178));var _0x04a1=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x4a10[_0x3ab51d];return _0x29a04e;};'use strict';var multer=require(_0x04a1('0x0'));var util=require('util');var path=require(_0x04a1('0x1'));var timeout=require(_0x04a1('0x2'));var express=require(_0x04a1('0x3'));var router=express[_0x04a1('0x4')]();var fs_extra=require(_0x04a1('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x04a1('0x6'));var config=require(_0x04a1('0x7'));var controller=require(_0x04a1('0x8'));router[_0x04a1('0x9')]('/',auth['isAuthenticated'](),controller[_0x04a1('0xa')]);router[_0x04a1('0x9')](_0x04a1('0xb'),auth['isAuthenticated'](),controller[_0x04a1('0xc')]);router['get'](_0x04a1('0xd'),auth[_0x04a1('0xe')](),controller[_0x04a1('0xf')]);router['post']('/',auth[_0x04a1('0xe')](),controller['create']);router['put'](_0x04a1('0xd'),auth['isAuthenticated'](),controller[_0x04a1('0x10')]);router[_0x04a1('0x11')](_0x04a1('0xd'),auth['isAuthenticated'](),controller[_0x04a1('0x12')]);module[_0x04a1('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index bc8e858..1a32aee 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 _0x796e=['STRING','Yes','sequelize','moment','exports','ENUM','blind'];(function(_0x1ca6ce,_0x4b818){var _0x353a85=function(_0x28b67a){while(--_0x28b67a){_0x1ca6ce['push'](_0x1ca6ce['shift']());}};_0x353a85(++_0x4b818);}(_0x796e,0x144));var _0xe796=function(_0x58fd7,_0x2f9317){_0x58fd7=_0x58fd7-0x0;var _0x2e6f13=_0x796e[_0x58fd7];return _0x2e6f13;};'use strict';var Sequelize=require(_0xe796('0x0'));var moment=require(_0xe796('0x1'));module[_0xe796('0x2')]={'type':{'type':Sequelize[_0xe796('0x3')](_0xe796('0x4'),'attended')},'result':{'type':Sequelize[_0xe796('0x5')]},'transfererchannel':{'type':Sequelize[_0xe796('0x5')]},'transferercalleridnum':{'type':Sequelize[_0xe796('0x5')]},'transferercalleridname':{'type':Sequelize[_0xe796('0x5')]},'transfererconnectedlinenum':{'type':Sequelize[_0xe796('0x5')]},'transfererconnectedlinename':{'type':Sequelize['STRING']},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize[_0xe796('0x5')]},'transfererlinkedid':{'type':Sequelize[_0xe796('0x5')]},'transfereechannel':{'type':Sequelize['STRING']},'transfereecalleridnum':{'type':Sequelize[_0xe796('0x5')]},'transfereecalleridname':{'type':Sequelize[_0xe796('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize[_0xe796('0x5')]},'transfereeconnectedlinename':{'type':Sequelize[_0xe796('0x5')]},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize[_0xe796('0x5')]},'transfereeexten':{'type':Sequelize[_0xe796('0x5')]},'transfereelinkedid':{'type':Sequelize[_0xe796('0x5')]},'isexternal':{'type':Sequelize[_0xe796('0x3')](_0xe796('0x6'),'No')},'context':{'type':Sequelize[_0xe796('0x5')]},'extension':{'type':Sequelize[_0xe796('0x5')]}}; \ No newline at end of file +var _0x005e=['moment','exports','ENUM','attended','STRING','Yes','sequelize'];(function(_0x54cf6e,_0x4a3e33){var _0x256a34=function(_0x883879){while(--_0x883879){_0x54cf6e['push'](_0x54cf6e['shift']());}};_0x256a34(++_0x4a3e33);}(_0x005e,0x148));var _0xe005=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0x005e[_0x3511d3];return _0x5d6321;};'use strict';var Sequelize=require(_0xe005('0x0'));var moment=require(_0xe005('0x1'));module[_0xe005('0x2')]={'type':{'type':Sequelize[_0xe005('0x3')]('blind',_0xe005('0x4'))},'result':{'type':Sequelize[_0xe005('0x5')]},'transfererchannel':{'type':Sequelize[_0xe005('0x5')]},'transferercalleridnum':{'type':Sequelize[_0xe005('0x5')]},'transferercalleridname':{'type':Sequelize[_0xe005('0x5')]},'transfererconnectedlinenum':{'type':Sequelize[_0xe005('0x5')]},'transfererconnectedlinename':{'type':Sequelize[_0xe005('0x5')]},'transfereraccountcode':{'type':Sequelize[_0xe005('0x5')]},'transferercontext':{'type':Sequelize[_0xe005('0x5')]},'transfererexten':{'type':Sequelize[_0xe005('0x5')]},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize[_0xe005('0x5')]},'transfereecalleridnum':{'type':Sequelize[_0xe005('0x5')]},'transfereecalleridname':{'type':Sequelize[_0xe005('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize[_0xe005('0x5')]},'transfereeconnectedlinename':{'type':Sequelize[_0xe005('0x5')]},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize[_0xe005('0x5')]},'transfereeexten':{'type':Sequelize[_0xe005('0x5')]},'transfereelinkedid':{'type':Sequelize[_0xe005('0x5')]},'isexternal':{'type':Sequelize['ENUM'](_0xe005('0x6'),'No')},'context':{'type':Sequelize[_0xe005('0x5')]},'extension':{'type':Sequelize[_0xe005('0x5')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index cdff1d7..ca18117 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 _0x178a=['error','name','index','map','VoiceTransferReport','rawAttributes','fieldName','type','model','keys','query','filters','attributes','intersection','fields','nolimit','offset','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','length','find','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','undefined','limit','count','set','reject','save','then','destroy','sendStatus'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x178a,0xb8));var _0xa178=function(_0x1564de,_0x55766e){_0x1564de=_0x1564de-0x0;var _0xc11706=_0x178a[_0x1564de];return _0xc11706;};'use strict';var emlformat=require(_0xa178('0x0'));var rimraf=require(_0xa178('0x1'));var zipdir=require(_0xa178('0x2'));var jsonpatch=require(_0xa178('0x3'));var rp=require(_0xa178('0x4'));var moment=require(_0xa178('0x5'));var BPromise=require(_0xa178('0x6'));var Mustache=require(_0xa178('0x7'));var util=require(_0xa178('0x8'));var path=require(_0xa178('0x9'));var sox=require(_0xa178('0xa'));var csv=require('to-csv');var ejs=require(_0xa178('0xb'));var fs=require('fs');var fs_extra=require(_0xa178('0xc'));var _=require('lodash');var squel=require(_0xa178('0xd'));var crypto=require(_0xa178('0xe'));var jsforce=require(_0xa178('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xa178('0x10'));var querystring=require(_0xa178('0x11'));var Papa=require(_0xa178('0x12'));var Redis=require(_0xa178('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xa178('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa178('0x15'));var logger=require(_0xa178('0x16'))(_0xa178('0x17'));var utils=require('../../config/utils');var config=require(_0xa178('0x18'));var licenseUtil=require(_0xa178('0x19'));var db=require(_0xa178('0x1a'))['db'];function respondWithStatusCode(_0x33f834,_0x4703cd){_0x4703cd=_0x4703cd||0xcc;return function(_0x59bf4d){if(_0x59bf4d){return _0x33f834['sendStatus'](_0x4703cd);}return _0x33f834[_0xa178('0x1b')](_0x4703cd)[_0xa178('0x1c')]();};}function respondWithResult(_0x3e8cf5,_0x41ccaf){_0x41ccaf=_0x41ccaf||0xc8;return function(_0x144bbc){if(_0x144bbc){return _0x3e8cf5[_0xa178('0x1b')](_0x41ccaf)['json'](_0x144bbc);}};}function respondWithFilteredResult(_0x5e4bb8,_0x28c50e){return function(_0x53d8f3){if(_0x53d8f3){var _0x1ce2c6=typeof _0x28c50e['offset']===_0xa178('0x1d')&&typeof _0x28c50e[_0xa178('0x1e')]===_0xa178('0x1d');var _0x157d15=_0x53d8f3['count'];var _0x4f3c00=_0x1ce2c6?0x0:_0x28c50e['offset'];var _0x29beb0=_0x1ce2c6?_0x53d8f3[_0xa178('0x1f')]:_0x28c50e['offset']+_0x28c50e['limit'];var _0x552db1;if(_0x29beb0>=_0x157d15){_0x29beb0=_0x157d15;_0x552db1=0xc8;}else{_0x552db1=0xce;}_0x5e4bb8[_0xa178('0x1b')](_0x552db1);return _0x5e4bb8[_0xa178('0x20')]('Content-Range',_0x4f3c00+'-'+_0x29beb0+'/'+_0x157d15)['json'](_0x53d8f3);}return null;};}function patchUpdates(_0x369307){return function(_0x23cce9){try{jsonpatch['apply'](_0x23cce9,_0x369307,!![]);}catch(_0x12d3b1){return BPromise[_0xa178('0x21')](_0x12d3b1);}return _0x23cce9[_0xa178('0x22')]();};}function saveUpdates(_0x471b20,_0x5d735e){return function(_0x150e8e){if(_0x150e8e){return _0x150e8e['update'](_0x471b20)[_0xa178('0x23')](function(_0x3630ec){return _0x3630ec;});}return null;};}function removeEntity(_0x5e94cd,_0x2b5be0){return function(_0x556a8e){if(_0x556a8e){return _0x556a8e[_0xa178('0x24')]()[_0xa178('0x23')](function(){_0x5e94cd[_0xa178('0x1b')](0xcc)[_0xa178('0x1c')]();});}};}function handleEntityNotFound(_0x287ce6,_0x36f612){return function(_0x4c9df4){if(!_0x4c9df4){_0x287ce6[_0xa178('0x25')](0x194);}return _0x4c9df4;};}function handleError(_0x55ebdd,_0x44a430){_0x44a430=_0x44a430||0x1f4;return function(_0x5de5cc){logger[_0xa178('0x26')](_0x5de5cc['stack']);if(_0x5de5cc[_0xa178('0x27')]){delete _0x5de5cc['name'];}_0x55ebdd['status'](_0x44a430)['send'](_0x5de5cc);};}exports[_0xa178('0x28')]=function(_0x1fa53b,_0x2d4002){var _0x11a0ac={},_0x37a3d5={},_0x59b064={'count':0x0,'rows':[]};var _0x30a906=_[_0xa178('0x29')](db[_0xa178('0x2a')][_0xa178('0x2b')],function(_0x5c9ec4){return{'name':_0x5c9ec4[_0xa178('0x2c')],'type':_0x5c9ec4[_0xa178('0x2d')]['key']};});_0x37a3d5[_0xa178('0x2e')]=_['map'](_0x30a906,_0xa178('0x27'));_0x37a3d5['query']=_[_0xa178('0x2f')](_0x1fa53b[_0xa178('0x30')]);_0x37a3d5[_0xa178('0x31')]=_['intersection'](_0x37a3d5[_0xa178('0x2e')],_0x37a3d5[_0xa178('0x30')]);_0x11a0ac[_0xa178('0x32')]=_[_0xa178('0x33')](_0x37a3d5['model'],qs[_0xa178('0x34')](_0x1fa53b[_0xa178('0x30')][_0xa178('0x34')]));_0x11a0ac[_0xa178('0x32')]=_0x11a0ac[_0xa178('0x32')]['length']?_0x11a0ac['attributes']:_0x37a3d5[_0xa178('0x2e')];if(!_0x1fa53b[_0xa178('0x30')]['hasOwnProperty'](_0xa178('0x35'))){_0x11a0ac['limit']=qs['limit'](_0x1fa53b[_0xa178('0x30')][_0xa178('0x1e')]);_0x11a0ac[_0xa178('0x36')]=qs[_0xa178('0x36')](_0x1fa53b[_0xa178('0x30')][_0xa178('0x36')]);}_0x11a0ac['order']=qs[_0xa178('0x37')](_0x1fa53b[_0xa178('0x30')][_0xa178('0x37')]);_0x11a0ac[_0xa178('0x38')]=qs[_0xa178('0x31')](_[_0xa178('0x39')](_0x1fa53b[_0xa178('0x30')],_0x37a3d5[_0xa178('0x31')]),_0x30a906);if(_0x1fa53b[_0xa178('0x30')][_0xa178('0x3a')]){_0x11a0ac['where']=_[_0xa178('0x3b')](_0x11a0ac[_0xa178('0x38')],{'$or':_[_0xa178('0x29')](_0x30a906,function(_0x42b247){if(_0x42b247[_0xa178('0x2d')]!==_0xa178('0x3c')){var _0x183578={};_0x183578[_0x42b247['name']]={'$like':'%'+_0x1fa53b[_0xa178('0x30')]['filter']+'%'};return _0x183578;}})});}_0x11a0ac=_[_0xa178('0x3b')]({},_0x11a0ac,_0x1fa53b[_0xa178('0x3d')]);var _0x23b276={'where':_0x11a0ac[_0xa178('0x38')]};return db[_0xa178('0x2a')][_0xa178('0x1f')](_0x23b276)[_0xa178('0x23')](function(_0x3eb941){_0x59b064[_0xa178('0x1f')]=_0x3eb941;if(_0x1fa53b[_0xa178('0x30')][_0xa178('0x3e')]){_0x11a0ac[_0xa178('0x3f')]=[{'all':!![]}];}return db[_0xa178('0x2a')]['findAll'](_0x11a0ac);})[_0xa178('0x23')](function(_0x4c2437){_0x59b064[_0xa178('0x40')]=_0x4c2437;return _0x59b064;})['then'](respondWithFilteredResult(_0x2d4002,_0x11a0ac))[_0xa178('0x41')](handleError(_0x2d4002,null));};exports[_0xa178('0x42')]=function(_0x7ce1f,_0x51f89d){var _0x3a4a08={'raw':!![],'where':{'id':_0x7ce1f[_0xa178('0x43')]['id']}},_0x544ca6={};_0x544ca6[_0xa178('0x2e')]=_[_0xa178('0x2f')](db[_0xa178('0x2a')][_0xa178('0x2b')]);_0x544ca6[_0xa178('0x30')]=_[_0xa178('0x2f')](_0x7ce1f['query']);_0x544ca6[_0xa178('0x31')]=_[_0xa178('0x33')](_0x544ca6[_0xa178('0x2e')],_0x544ca6['query']);_0x3a4a08[_0xa178('0x32')]=_[_0xa178('0x33')](_0x544ca6[_0xa178('0x2e')],qs['fields'](_0x7ce1f[_0xa178('0x30')][_0xa178('0x34')]));_0x3a4a08[_0xa178('0x32')]=_0x3a4a08[_0xa178('0x32')][_0xa178('0x44')]?_0x3a4a08[_0xa178('0x32')]:_0x544ca6['model'];if(_0x7ce1f['query'][_0xa178('0x3e')]){_0x3a4a08['include']=[{'all':!![]}];}_0x3a4a08=_['merge']({},_0x3a4a08,_0x7ce1f[_0xa178('0x3d')]);return db[_0xa178('0x2a')][_0xa178('0x45')](_0x3a4a08)['then'](handleEntityNotFound(_0x51f89d,null))[_0xa178('0x23')](respondWithResult(_0x51f89d,null))[_0xa178('0x41')](handleError(_0x51f89d,null));};exports['create']=function(_0x16ae61,_0x1d3187){return db[_0xa178('0x2a')][_0xa178('0x46')](_0x16ae61[_0xa178('0x47')],{})['then'](respondWithResult(_0x1d3187,0xc9))[_0xa178('0x41')](handleError(_0x1d3187,null));};exports[_0xa178('0x48')]=function(_0x3f32ac,_0x1e2c96){if(_0x3f32ac['body']['id']){delete _0x3f32ac[_0xa178('0x47')]['id'];}return db['VoiceTransferReport'][_0xa178('0x45')]({'where':{'id':_0x3f32ac[_0xa178('0x43')]['id']}})[_0xa178('0x23')](handleEntityNotFound(_0x1e2c96,null))[_0xa178('0x23')](saveUpdates(_0x3f32ac[_0xa178('0x47')],null))[_0xa178('0x23')](respondWithResult(_0x1e2c96,null))[_0xa178('0x41')](handleError(_0x1e2c96,null));};exports[_0xa178('0x24')]=function(_0x53a2ed,_0x565b67){return db[_0xa178('0x2a')][_0xa178('0x45')]({'where':{'id':_0x53a2ed['params']['id']}})['then'](handleEntityNotFound(_0x565b67,null))[_0xa178('0x23')](removeEntity(_0x565b67,null))[_0xa178('0x41')](handleError(_0x565b67,null));};exports['describe']=function(_0xa1136e,_0x527bce){return db[_0xa178('0x2a')][_0xa178('0x49')]()['then'](respondWithResult(_0x527bce,null))[_0xa178('0x41')](handleError(_0x527bce,null));}; \ No newline at end of file +var _0x1160=['fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','includeAll','rows','show','keys','include','options','find','catch','body','update','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','then','destroy','stack','name','send','index','map','VoiceTransferReport','rawAttributes','fieldName','type','key','model','query','intersection','attributes'];(function(_0x1b1436,_0xa24c4b){var _0x1eb98c=function(_0x28a5e0){while(--_0x28a5e0){_0x1b1436['push'](_0x1b1436['shift']());}};_0x1eb98c(++_0xa24c4b);}(_0x1160,0x65));var _0x0116=function(_0x3c487b,_0x44c5e2){_0x3c487b=_0x3c487b-0x0;var _0x1d65f6=_0x1160[_0x3c487b];return _0x1d65f6;};'use strict';var emlformat=require(_0x0116('0x0'));var rimraf=require(_0x0116('0x1'));var zipdir=require(_0x0116('0x2'));var jsonpatch=require(_0x0116('0x3'));var rp=require('request-promise');var moment=require(_0x0116('0x4'));var BPromise=require(_0x0116('0x5'));var Mustache=require(_0x0116('0x6'));var util=require(_0x0116('0x7'));var path=require('path');var sox=require(_0x0116('0x8'));var csv=require('to-csv');var ejs=require(_0x0116('0x9'));var fs=require('fs');var fs_extra=require(_0x0116('0xa'));var _=require(_0x0116('0xb'));var squel=require(_0x0116('0xc'));var crypto=require('crypto');var jsforce=require(_0x0116('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x0116('0xe'));var Papa=require(_0x0116('0xf'));var Redis=require(_0x0116('0x10'));var authService=require(_0x0116('0x11'));var qs=require(_0x0116('0x12'));var as=require(_0x0116('0x13'));var hardwareService=require(_0x0116('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x0116('0x15'));var licenseUtil=require(_0x0116('0x16'));var db=require(_0x0116('0x17'))['db'];function respondWithStatusCode(_0x2b6fa0,_0x1da299){_0x1da299=_0x1da299||0xcc;return function(_0xb911ae){if(_0xb911ae){return _0x2b6fa0[_0x0116('0x18')](_0x1da299);}return _0x2b6fa0['status'](_0x1da299)[_0x0116('0x19')]();};}function respondWithResult(_0x3ee043,_0x43715e){_0x43715e=_0x43715e||0xc8;return function(_0x3506f0){if(_0x3506f0){return _0x3ee043['status'](_0x43715e)[_0x0116('0x1a')](_0x3506f0);}};}function respondWithFilteredResult(_0x5b1f15,_0x39449d){return function(_0x494a59){if(_0x494a59){var _0x3ae7f1=typeof _0x39449d[_0x0116('0x1b')]===_0x0116('0x1c')&&typeof _0x39449d[_0x0116('0x1d')]===_0x0116('0x1c');var _0x41b9c0=_0x494a59[_0x0116('0x1e')];var _0x50c0e6=_0x3ae7f1?0x0:_0x39449d[_0x0116('0x1b')];var _0xc7dc12=_0x3ae7f1?_0x494a59[_0x0116('0x1e')]:_0x39449d[_0x0116('0x1b')]+_0x39449d['limit'];var _0x142b71;if(_0xc7dc12>=_0x41b9c0){_0xc7dc12=_0x41b9c0;_0x142b71=0xc8;}else{_0x142b71=0xce;}_0x5b1f15[_0x0116('0x1f')](_0x142b71);return _0x5b1f15[_0x0116('0x20')](_0x0116('0x21'),_0x50c0e6+'-'+_0xc7dc12+'/'+_0x41b9c0)[_0x0116('0x1a')](_0x494a59);}return null;};}function patchUpdates(_0x55293c){return function(_0x6aec87){try{jsonpatch[_0x0116('0x22')](_0x6aec87,_0x55293c,!![]);}catch(_0x3d369e){return BPromise[_0x0116('0x23')](_0x3d369e);}return _0x6aec87[_0x0116('0x24')]();};}function saveUpdates(_0x31c104,_0x6d74ed){return function(_0x190d8e){if(_0x190d8e){return _0x190d8e['update'](_0x31c104)[_0x0116('0x25')](function(_0x18d611){return _0x18d611;});}return null;};}function removeEntity(_0x1fb911,_0x29c4fd){return function(_0x155adc){if(_0x155adc){return _0x155adc[_0x0116('0x26')]()[_0x0116('0x25')](function(){_0x1fb911[_0x0116('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x269e3d,_0xf28fd){return function(_0x7c118f){if(!_0x7c118f){_0x269e3d[_0x0116('0x18')](0x194);}return _0x7c118f;};}function handleError(_0x2b87e6,_0x4d92cf){_0x4d92cf=_0x4d92cf||0x1f4;return function(_0x1cb1a4){logger['error'](_0x1cb1a4[_0x0116('0x27')]);if(_0x1cb1a4[_0x0116('0x28')]){delete _0x1cb1a4['name'];}_0x2b87e6[_0x0116('0x1f')](_0x4d92cf)[_0x0116('0x29')](_0x1cb1a4);};}exports[_0x0116('0x2a')]=function(_0x33215e,_0x248dd8){var _0x263c3f={},_0x1afc8a={},_0x396414={'count':0x0,'rows':[]};var _0x1e26f4=_[_0x0116('0x2b')](db[_0x0116('0x2c')][_0x0116('0x2d')],function(_0x2b6a93){return{'name':_0x2b6a93[_0x0116('0x2e')],'type':_0x2b6a93[_0x0116('0x2f')][_0x0116('0x30')]};});_0x1afc8a[_0x0116('0x31')]=_[_0x0116('0x2b')](_0x1e26f4,'name');_0x1afc8a[_0x0116('0x32')]=_['keys'](_0x33215e['query']);_0x1afc8a['filters']=_[_0x0116('0x33')](_0x1afc8a[_0x0116('0x31')],_0x1afc8a['query']);_0x263c3f[_0x0116('0x34')]=_['intersection'](_0x1afc8a['model'],qs['fields'](_0x33215e[_0x0116('0x32')][_0x0116('0x35')]));_0x263c3f[_0x0116('0x34')]=_0x263c3f[_0x0116('0x34')][_0x0116('0x36')]?_0x263c3f[_0x0116('0x34')]:_0x1afc8a[_0x0116('0x31')];if(!_0x33215e[_0x0116('0x32')][_0x0116('0x37')](_0x0116('0x38'))){_0x263c3f[_0x0116('0x1d')]=qs[_0x0116('0x1d')](_0x33215e[_0x0116('0x32')][_0x0116('0x1d')]);_0x263c3f['offset']=qs[_0x0116('0x1b')](_0x33215e['query']['offset']);}_0x263c3f[_0x0116('0x39')]=qs[_0x0116('0x3a')](_0x33215e[_0x0116('0x32')]['sort']);_0x263c3f['where']=qs[_0x0116('0x3b')](_[_0x0116('0x3c')](_0x33215e[_0x0116('0x32')],_0x1afc8a['filters']),_0x1e26f4);if(_0x33215e['query'][_0x0116('0x3d')]){_0x263c3f[_0x0116('0x3e')]=_[_0x0116('0x3f')](_0x263c3f[_0x0116('0x3e')],{'$or':_[_0x0116('0x2b')](_0x1e26f4,function(_0xbcdf1d){if(_0xbcdf1d[_0x0116('0x2f')]!==_0x0116('0x40')){var _0x3cdc90={};_0x3cdc90[_0xbcdf1d[_0x0116('0x28')]]={'$like':'%'+_0x33215e[_0x0116('0x32')][_0x0116('0x3d')]+'%'};return _0x3cdc90;}})});}_0x263c3f=_[_0x0116('0x3f')]({},_0x263c3f,_0x33215e['options']);var _0xba6351={'where':_0x263c3f[_0x0116('0x3e')]};return db['VoiceTransferReport']['count'](_0xba6351)[_0x0116('0x25')](function(_0x13822d){_0x396414[_0x0116('0x1e')]=_0x13822d;if(_0x33215e[_0x0116('0x32')][_0x0116('0x41')]){_0x263c3f['include']=[{'all':!![]}];}return db['VoiceTransferReport']['findAll'](_0x263c3f);})[_0x0116('0x25')](function(_0x1449f4){_0x396414[_0x0116('0x42')]=_0x1449f4;return _0x396414;})['then'](respondWithFilteredResult(_0x248dd8,_0x263c3f))['catch'](handleError(_0x248dd8,null));};exports[_0x0116('0x43')]=function(_0x15a1fb,_0x1183d1){var _0x2f7570={'raw':!![],'where':{'id':_0x15a1fb['params']['id']}},_0x2d9055={};_0x2d9055['model']=_[_0x0116('0x44')](db['VoiceTransferReport']['rawAttributes']);_0x2d9055[_0x0116('0x32')]=_[_0x0116('0x44')](_0x15a1fb[_0x0116('0x32')]);_0x2d9055[_0x0116('0x3b')]=_[_0x0116('0x33')](_0x2d9055[_0x0116('0x31')],_0x2d9055[_0x0116('0x32')]);_0x2f7570[_0x0116('0x34')]=_['intersection'](_0x2d9055[_0x0116('0x31')],qs[_0x0116('0x35')](_0x15a1fb[_0x0116('0x32')][_0x0116('0x35')]));_0x2f7570[_0x0116('0x34')]=_0x2f7570[_0x0116('0x34')]['length']?_0x2f7570[_0x0116('0x34')]:_0x2d9055[_0x0116('0x31')];if(_0x15a1fb['query'][_0x0116('0x41')]){_0x2f7570[_0x0116('0x45')]=[{'all':!![]}];}_0x2f7570=_[_0x0116('0x3f')]({},_0x2f7570,_0x15a1fb[_0x0116('0x46')]);return db[_0x0116('0x2c')][_0x0116('0x47')](_0x2f7570)[_0x0116('0x25')](handleEntityNotFound(_0x1183d1,null))[_0x0116('0x25')](respondWithResult(_0x1183d1,null))[_0x0116('0x48')](handleError(_0x1183d1,null));};exports['create']=function(_0x39622b,_0x1d3c13){return db[_0x0116('0x2c')]['create'](_0x39622b[_0x0116('0x49')],{})['then'](respondWithResult(_0x1d3c13,0xc9))[_0x0116('0x48')](handleError(_0x1d3c13,null));};exports[_0x0116('0x4a')]=function(_0x294e7b,_0x2057f0){if(_0x294e7b[_0x0116('0x49')]['id']){delete _0x294e7b[_0x0116('0x49')]['id'];}return db[_0x0116('0x2c')][_0x0116('0x47')]({'where':{'id':_0x294e7b[_0x0116('0x4b')]['id']}})[_0x0116('0x25')](handleEntityNotFound(_0x2057f0,null))['then'](saveUpdates(_0x294e7b[_0x0116('0x49')],null))[_0x0116('0x25')](respondWithResult(_0x2057f0,null))[_0x0116('0x48')](handleError(_0x2057f0,null));};exports[_0x0116('0x26')]=function(_0x35f349,_0x36472d){return db[_0x0116('0x2c')][_0x0116('0x47')]({'where':{'id':_0x35f349[_0x0116('0x4b')]['id']}})['then'](handleEntityNotFound(_0x36472d,null))['then'](removeEntity(_0x36472d,null))['catch'](handleError(_0x36472d,null));};exports['describe']=function(_0x9d2f25,_0x8511b5){return db[_0x0116('0x2c')][_0x0116('0x4c')]()[_0x0116('0x25')](respondWithResult(_0x8511b5,null))['catch'](handleError(_0x8511b5,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 28951b8..135c8ee 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 _0x0571=['VoiceTransferReport','report_call_transfer','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./voiceTransferReport.attributes','exports','define'];(function(_0xb49b23,_0x5367f9){var _0x59cd96=function(_0x1ab2ce){while(--_0x1ab2ce){_0xb49b23['push'](_0xb49b23['shift']());}};_0x59cd96(++_0x5367f9);}(_0x0571,0x1a6));var _0x1057=function(_0x39872b,_0x343e6b){_0x39872b=_0x39872b-0x0;var _0x55fa18=_0x0571[_0x39872b];return _0x55fa18;};'use strict';var _=require('lodash');var util=require(_0x1057('0x0'));var logger=require(_0x1057('0x1'))(_0x1057('0x2'));var moment=require('moment');var BPromise=require(_0x1057('0x3'));var rp=require(_0x1057('0x4'));var fs=require('fs');var path=require(_0x1057('0x5'));var rimraf=require('rimraf');var config=require(_0x1057('0x6'));var attributes=require(_0x1057('0x7'));module[_0x1057('0x8')]=function(_0x5e5b7f,_0x5c581b){return _0x5e5b7f[_0x1057('0x9')](_0x1057('0xa'),attributes,{'tableName':_0x1057('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3cce=['../../config/logger','api','moment','path','rimraf','./voiceTransferReport.attributes','exports','define','report_call_transfer','lodash'];(function(_0x377e11,_0x4bd449){var _0x270348=function(_0x37cb56){while(--_0x37cb56){_0x377e11['push'](_0x377e11['shift']());}};_0x270348(++_0x4bd449);}(_0x3cce,0x117));var _0xe3cc=function(_0x103101,_0x2aa878){_0x103101=_0x103101-0x0;var _0x36371e=_0x3cce[_0x103101];return _0x36371e;};'use strict';var _=require(_0xe3cc('0x0'));var util=require('util');var logger=require(_0xe3cc('0x1'))(_0xe3cc('0x2'));var moment=require(_0xe3cc('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe3cc('0x4'));var rimraf=require(_0xe3cc('0x5'));var config=require('../../config/environment');var attributes=require(_0xe3cc('0x6'));module[_0xe3cc('0x7')]=function(_0xdb4f53,_0x1055f5){return _0xdb4f53[_0xe3cc('0x8')]('VoiceTransferReport',attributes,{'tableName':_0xe3cc('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.rpc.js b/server/api/voiceTransferReport/voiceTransferReport.rpc.js index c3ad43f..b00fc07 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 _0x17ce=['body','options','raw','CreateVoiceTransferReport','stringify','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','client','http','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','VoiceTransferReport','create'];(function(_0x2621d9,_0x5c4167){var _0x353051=function(_0x200704){while(--_0x200704){_0x2621d9['push'](_0x2621d9['shift']());}};_0x353051(++_0x5c4167);}(_0x17ce,0xff));var _0xe17c=function(_0x5d48ef,_0x1ee9e4){_0x5d48ef=_0x5d48ef-0x0;var _0x166702=_0x17ce[_0x5d48ef];return _0x166702;};'use strict';var _=require(_0xe17c('0x0'));var util=require(_0xe17c('0x1'));var moment=require(_0xe17c('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe17c('0x3'));var db=require(_0xe17c('0x4'))['db'];var utils=require(_0xe17c('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe17c('0x6')][_0xe17c('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x947d74,_0x31c95f,_0x76d5f0){return new BPromise(function(_0x1096e9,_0x5ba6c0){return client['request'](_0x947d74,_0x76d5f0)[_0xe17c('0x8')](function(_0x111668){logger[_0xe17c('0x9')](_0xe17c('0xa'),_0x31c95f,_0xe17c('0xb'));logger[_0xe17c('0xc')]('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x31c95f,_0xe17c('0xb'),JSON['stringify'](_0x111668));if(_0x111668['error']){if(_0x111668[_0xe17c('0xd')][_0xe17c('0xe')]===0x1f4){logger[_0xe17c('0xd')](_0xe17c('0xa'),_0x31c95f,_0x111668[_0xe17c('0xd')][_0xe17c('0xf')]);return _0x5ba6c0(_0x111668['error'][_0xe17c('0xf')]);}logger[_0xe17c('0xd')]('VoiceTransferReport,\x20%s,\x20%s',_0x31c95f,_0x111668[_0xe17c('0xd')][_0xe17c('0xf')]);return _0x1096e9(_0x111668[_0xe17c('0xd')][_0xe17c('0xf')]);}else{logger[_0xe17c('0x9')](_0xe17c('0xa'),_0x31c95f,_0xe17c('0xb'));_0x1096e9(_0x111668[_0xe17c('0x10')][_0xe17c('0xf')]);}})[_0xe17c('0x11')](function(_0x5ac1bf){logger[_0xe17c('0xd')]('VoiceTransferReport,\x20%s,\x20%s',_0x31c95f,_0x5ac1bf);_0x5ba6c0(_0x5ac1bf);});});}exports['CreateVoiceTransferReport']=function(_0x5cc40b){var _0x9bc4a9=this;return new Promise(function(_0x1b763a,_0x52101f){return db[_0xe17c('0x12')][_0xe17c('0x13')](_0x5cc40b[_0xe17c('0x14')],{'raw':_0x5cc40b['options']?_0x5cc40b[_0xe17c('0x15')][_0xe17c('0x16')]===undefined?!![]:![]:!![]})[_0xe17c('0x8')](function(_0x2dba73){logger[_0xe17c('0x9')](_0xe17c('0x17'),_0x5cc40b);logger[_0xe17c('0xc')]('CreateVoiceTransferReport',_0x5cc40b,JSON[_0xe17c('0x18')](_0x2dba73));_0x1b763a(_0x2dba73);})[_0xe17c('0x11')](function(_0x47fff8){logger['error'](_0xe17c('0x17'),_0x47fff8['message'],_0x5cc40b);_0x52101f(_0x9bc4a9[_0xe17c('0xd')](0x1f4,_0x47fff8['message']));});});}; \ No newline at end of file +var _0x829b=['message','info','result','catch','CreateVoiceTransferReport','VoiceTransferReport','create','options','debug','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','request\x20sent','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','VoiceTransferReport,\x20%s,\x20%s'];(function(_0x390733,_0x1e3d32){var _0x33beb9=function(_0x4491a3){while(--_0x4491a3){_0x390733['push'](_0x390733['shift']());}};_0x33beb9(++_0x1e3d32);}(_0x829b,0x159));var _0xb829=function(_0x51c819,_0xd812db){_0x51c819=_0x51c819-0x0;var _0x15c5d2=_0x829b[_0x51c819];return _0x15c5d2;};'use strict';var _=require('lodash');var util=require(_0xb829('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb829('0x1'));var db=require(_0xb829('0x2'))['db'];var utils=require(_0xb829('0x3'));var logger=require(_0xb829('0x4'))(_0xb829('0x5'));var config=require('../../config/environment');var jayson=require(_0xb829('0x6'));var client=jayson[_0xb829('0x7')][_0xb829('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x539a19,_0x57e83f,_0x44afb2){return new BPromise(function(_0x4e4da0,_0x4fe5ea){return client['request'](_0x539a19,_0x44afb2)[_0xb829('0x9')](function(_0x793983){logger['info']('VoiceTransferReport,\x20%s,\x20%s',_0x57e83f,_0xb829('0xa'));logger['debug'](_0xb829('0xb'),_0x57e83f,_0xb829('0xa'),JSON[_0xb829('0xc')](_0x793983));if(_0x793983[_0xb829('0xd')]){if(_0x793983[_0xb829('0xd')]['code']===0x1f4){logger[_0xb829('0xd')](_0xb829('0xe'),_0x57e83f,_0x793983[_0xb829('0xd')][_0xb829('0xf')]);return _0x4fe5ea(_0x793983[_0xb829('0xd')]['message']);}logger[_0xb829('0xd')](_0xb829('0xe'),_0x57e83f,_0x793983['error'][_0xb829('0xf')]);return _0x4e4da0(_0x793983['error']['message']);}else{logger[_0xb829('0x10')](_0xb829('0xe'),_0x57e83f,_0xb829('0xa'));_0x4e4da0(_0x793983[_0xb829('0x11')][_0xb829('0xf')]);}})[_0xb829('0x12')](function(_0x409f61){logger[_0xb829('0xd')](_0xb829('0xe'),_0x57e83f,_0x409f61);_0x4fe5ea(_0x409f61);});});}exports[_0xb829('0x13')]=function(_0x3cc992){var _0x1f38a4=this;return new Promise(function(_0xa419cd,_0x473a47){return db[_0xb829('0x14')][_0xb829('0x15')](_0x3cc992['body'],{'raw':_0x3cc992[_0xb829('0x16')]?_0x3cc992['options']['raw']===undefined?!![]:![]:!![]})[_0xb829('0x9')](function(_0x36095b){logger[_0xb829('0x10')]('CreateVoiceTransferReport',_0x3cc992);logger[_0xb829('0x17')]('CreateVoiceTransferReport',_0x3cc992,JSON['stringify'](_0x36095b));_0xa419cd(_0x36095b);})[_0xb829('0x12')](function(_0x1a9952){logger[_0xb829('0xd')]('CreateVoiceTransferReport',_0x1a9952['message'],_0x3cc992);_0x473a47(_0x1f38a4[_0xb829('0xd')](0x1f4,_0x1a9952[_0xb829('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 66b9fed..59c4996 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 _0x008c=['/transfer','transfer','express','Router','../../components/auth/service','./webbar.controller','post','isAuthenticated','isWebrtcLicence','originate','/hangup','hangup','answer','/calls','calls'];(function(_0x4604dd,_0x2c1504){var _0x30daf8=function(_0x1c6c3b){while(--_0x1c6c3b){_0x4604dd['push'](_0x4604dd['shift']());}};_0x30daf8(++_0x2c1504);}(_0x008c,0x188));var _0xc008=function(_0x41b29e,_0x34b288){_0x41b29e=_0x41b29e-0x0;var _0xacd517=_0x008c[_0x41b29e];return _0xacd517;};'use strict';var express=require(_0xc008('0x0'));var router=express[_0xc008('0x1')]();var auth=require(_0xc008('0x2'));var controller=require(_0xc008('0x3'));router[_0xc008('0x4')]('/originate',auth[_0xc008('0x5')](),auth[_0xc008('0x6')](),controller[_0xc008('0x7')]);router[_0xc008('0x4')](_0xc008('0x8'),auth[_0xc008('0x5')](),auth[_0xc008('0x6')](),controller[_0xc008('0x9')]);router[_0xc008('0x4')]('/answer',auth[_0xc008('0x5')](),auth['isWebrtcLicence'](),controller[_0xc008('0xa')]);router['post']('/hold',auth[_0xc008('0x5')](),auth[_0xc008('0x6')](),controller['hold']);router['post']('/unhold',auth[_0xc008('0x5')](),auth[_0xc008('0x6')](),controller['unhold']);router[_0xc008('0x4')](_0xc008('0xb'),auth[_0xc008('0x5')](),auth[_0xc008('0x6')](),controller[_0xc008('0xc')]);router[_0xc008('0x4')](_0xc008('0xd'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0xc008('0xe')]);module['exports']=router; \ No newline at end of file +var _0xf109=['/transfer','transfer','express','Router','../../components/auth/service','isAuthenticated','isWebrtcLicence','originate','post','/hangup','hangup','/answer','answer','/hold','/unhold','/calls','calls'];(function(_0x4337a2,_0x3f7a9d){var _0x408bf9=function(_0x40c996){while(--_0x40c996){_0x4337a2['push'](_0x4337a2['shift']());}};_0x408bf9(++_0x3f7a9d);}(_0xf109,0xce));var _0x9f10=function(_0x4fbfd9,_0x3ab91a){_0x4fbfd9=_0x4fbfd9-0x0;var _0x31dc94=_0xf109[_0x4fbfd9];return _0x31dc94;};'use strict';var express=require(_0x9f10('0x0'));var router=express[_0x9f10('0x1')]();var auth=require(_0x9f10('0x2'));var controller=require('./webbar.controller');router['post']('/originate',auth[_0x9f10('0x3')](),auth[_0x9f10('0x4')](),controller[_0x9f10('0x5')]);router[_0x9f10('0x6')](_0x9f10('0x7'),auth[_0x9f10('0x3')](),auth[_0x9f10('0x4')](),controller[_0x9f10('0x8')]);router[_0x9f10('0x6')](_0x9f10('0x9'),auth[_0x9f10('0x3')](),auth['isWebrtcLicence'](),controller[_0x9f10('0xa')]);router[_0x9f10('0x6')](_0x9f10('0xb'),auth[_0x9f10('0x3')](),auth[_0x9f10('0x4')](),controller['hold']);router[_0x9f10('0x6')](_0x9f10('0xc'),auth[_0x9f10('0x3')](),auth['isWebrtcLicence'](),controller['unhold']);router[_0x9f10('0x6')](_0x9f10('0xd'),auth[_0x9f10('0x3')](),auth['isWebrtcLicence'](),controller[_0x9f10('0xe')]);router[_0x9f10('0x6')](_0x9f10('0xf'),auth['isAuthenticated'](),auth[_0x9f10('0x4')](),controller[_0x9f10('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 22d3ec9..e76c9a1 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 _0xfe57=['VoiceChannels','all','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','transfer\x20executed!','path','lodash','util','bluebird','jayson/promise','client','http','../../config/logger','webbarapi','ioredis','redis','defaults','localhost','socket.io-emitter','validate','userId\x20is\x20required','string','number','transferNumber\x20is\x20required','info','emit','log','handleError:','error','stack','name','status','send','NotFound','request','then','code','message','catch','User','findOne','agent','filter','UserId','length','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','json','userId','callNumber','webbar:originate','originate\x20executed!','hangup','hangup\x20fired:','sessionId','entityFound:','format','user:%s','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','webbar:answer','answer\x20executed!','hold','hold\x20fired:','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','calls'];(function(_0x29581e,_0x223618){var _0x422e46=function(_0x231081){while(--_0x231081){_0x29581e['push'](_0x29581e['shift']());}};_0x422e46(++_0x223618);}(_0xfe57,0x195));var _0x7fe5=function(_0x30a31e,_0x31f766){_0x30a31e=_0x30a31e-0x0;var _0x170879=_0xfe57[_0x30a31e];return _0x170879;};'use strict';var path=require(_0x7fe5('0x0'));var fs=require('fs');var _=require(_0x7fe5('0x1'));var db=require('../../mysqldb')['db'];var config=require('../../config/environment');var util=require(_0x7fe5('0x2'));var BPromise=require(_0x7fe5('0x3'));var jayson=require(_0x7fe5('0x4'));var amiClient=jayson[_0x7fe5('0x5')][_0x7fe5('0x6')]({'port':0x232a});var logger=require(_0x7fe5('0x7'))(_0x7fe5('0x8'));var Redis=require(_0x7fe5('0x9'));config[_0x7fe5('0xa')]=_[_0x7fe5('0xb')](config[_0x7fe5('0xa')],{'host':_0x7fe5('0xc'),'port':0x18eb});var io=require(_0x7fe5('0xd'))(new Redis(config['redis']));var Schema=require(_0x7fe5('0xe'));var originateValidation=new Schema({'userId':{'type':'number','required':[!![],_0x7fe5('0xf')]},'callNumber':{'type':_0x7fe5('0x10'),'required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':'string'},'callbackUrl':{'type':_0x7fe5('0x10')}});var hangupValidation=new Schema({'userId':{'type':_0x7fe5('0x11'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x7fe5('0x10'),'required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x7fe5('0x10'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x7fe5('0x11'),'required':[!![],_0x7fe5('0xf')]},'sessionId':{'type':_0x7fe5('0x10'),'required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0x7fe5('0x10'),'required':[!![],_0x7fe5('0x12')]}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],_0x7fe5('0xf')]},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x7fe5('0x11'),'required':[!![],_0x7fe5('0xf')]},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':_0x7fe5('0x11'),'required':[!![],'userId\x20is\x20required']}});var conferenceValidation=new Schema({'userId':{'type':_0x7fe5('0x11'),'required':[!![],_0x7fe5('0xf')]}});function emit(_0xbdf0a4,_0x4989a,_0x3f699b){logger[_0x7fe5('0x13')](_0xbdf0a4,_0x4989a,JSON['stringify'](_0x3f699b));io['to'](_0xbdf0a4)[_0x7fe5('0x14')](_0x4989a,_0x3f699b);}function handleError(_0x3c7dd3){return function(_0x340d5e){console[_0x7fe5('0x15')](_0x7fe5('0x16'),_0x340d5e,_0x340d5e instanceof RangeError);logger[_0x7fe5('0x17')](_0x340d5e[_0x7fe5('0x18')]);if(_0x340d5e instanceof RangeError){if(_0x340d5e[_0x7fe5('0x19')]){delete _0x340d5e[_0x7fe5('0x19')];}_0x3c7dd3[_0x7fe5('0x1a')](0x194)['send'](_0x340d5e);}else{if(_0x340d5e['name']){delete _0x340d5e[_0x7fe5('0x19')];}_0x3c7dd3[_0x7fe5('0x1a')](0x1f4)[_0x7fe5('0x1b')](_0x340d5e);}};}function checkError(){return function(_0x327301){if(!_0x327301){throw new RangeError(_0x7fe5('0x1c'));}return _0x327301;};}function respondWithRpcPromise(_0x39c3ba,_0x24efbb){return new BPromise(function(_0xdd9df7,_0x1b271c){var _0x28a7fd=amiClient;return _0x28a7fd[_0x7fe5('0x1d')](_0x39c3ba,_0x24efbb)[_0x7fe5('0x1e')](function(_0x54ee98){if(_0x54ee98[_0x7fe5('0x17')]){if(_0x54ee98[_0x7fe5('0x17')][_0x7fe5('0x1f')]===0x1f4){return _0x1b271c(_0x54ee98['error'][_0x7fe5('0x20')]);}return _0xdd9df7(_0x54ee98['error'][_0x7fe5('0x20')]);}else{_0xdd9df7(_0x54ee98['result']);}})[_0x7fe5('0x21')](function(_0x190355){_0x1b271c(_0x190355);});});}function getAgent(_0x134876){return db[_0x7fe5('0x22')][_0x7fe5('0x23')]({'where':{'id':_0x134876,'role':_0x7fe5('0x24')}})['then'](checkError());}function getAgentCheckSession(_0x5f2d25,_0x417a56){return new BPromise(function(_0x450759,_0x27b66d){var _0x13c96b=respondWithRpcPromise('VoiceChannels');var _0x46f816=getAgent(_0x5f2d25);Promise['all']([_0x13c96b,_0x46f816])[_0x7fe5('0x1e')](function(_0x1420de){var _0x204bc8=_0x1420de[0x0];var _0x28a689=_0x1420de[0x1];var _0x1f8572=_[_0x7fe5('0x25')](_0x204bc8['rows'],function(_0xe521c6){return _0xe521c6[_0x7fe5('0x26')]==_0x28a689['id']&&_0xe521c6['sessionId']==_0x417a56;});if(_0x1f8572[_0x7fe5('0x27')]==0x1){_0x450759(_0x28a689);}else{_0x27b66d(new RangeError(_0x7fe5('0x28')+_0x417a56+_0x7fe5('0x29')));}});});}exports[_0x7fe5('0x2a')]=function(_0x465e46,_0x53ef16){logger['info'](_0x7fe5('0x2b'),_0x465e46[_0x7fe5('0x2c')]);var _0x3dbb62=originateValidation[_0x7fe5('0xe')](_0x465e46['body']);if(_0x3dbb62[_0x7fe5('0x27')]>0x0){return _0x53ef16[_0x7fe5('0x1a')](0x190)[_0x7fe5('0x2d')](_0x3dbb62);}var _0x4227b7=_0x465e46[_0x7fe5('0x2c')][_0x7fe5('0x2e')];var _0x4ecbba=_0x465e46[_0x7fe5('0x2c')][_0x7fe5('0x2f')];var _0x2c8225=_0x465e46[_0x7fe5('0x2c')]['callerId'];var _0x5617c2=_0x465e46[_0x7fe5('0x2c')]['callbackUrl'];return getAgent(_0x4227b7)[_0x7fe5('0x1e')](function(_0x513680){logger[_0x7fe5('0x13')]('entityFound:',_0x513680['name']);emit(util['format']('user:%s',_0x513680[_0x7fe5('0x19')]),_0x7fe5('0x30'),{'callNumber':_0x4ecbba,'callerId':_0x2c8225,'callbackUrl':_0x5617c2});return _0x53ef16['status'](0xc8)[_0x7fe5('0x2d')]({'error':![],'message':_0x7fe5('0x31')});})['catch'](handleError(_0x53ef16));};exports[_0x7fe5('0x32')]=function(_0x4a641d,_0x4aeed2){logger[_0x7fe5('0x13')](_0x7fe5('0x33'),_0x4a641d[_0x7fe5('0x2c')]);var _0x2ff773=hangupValidation[_0x7fe5('0xe')](_0x4a641d['body']);if(_0x2ff773[_0x7fe5('0x27')]>0x0){return _0x4aeed2[_0x7fe5('0x1a')](0x190)['json'](_0x2ff773);}var _0x1fa05a=_0x4a641d[_0x7fe5('0x2c')][_0x7fe5('0x2e')];var _0xf75042=_0x4a641d[_0x7fe5('0x2c')][_0x7fe5('0x34')];return getAgent(_0x1fa05a)[_0x7fe5('0x1e')](function(_0x50cfa5){logger['info'](_0x7fe5('0x35'),_0x50cfa5['name']);emit(util[_0x7fe5('0x36')](_0x7fe5('0x37'),_0x50cfa5['name']),_0x7fe5('0x38'),{'sessionId':_0xf75042});return _0x4aeed2[_0x7fe5('0x1a')](0xc8)[_0x7fe5('0x2d')]({'error':![],'message':_0x7fe5('0x39')});})[_0x7fe5('0x21')](handleError(_0x4aeed2));};exports[_0x7fe5('0x3a')]=function(_0x1cd6d3,_0x4ee6cc){logger['info'](_0x7fe5('0x3b'),_0x1cd6d3['body']);var _0xad0b05=answerValidation[_0x7fe5('0xe')](_0x1cd6d3[_0x7fe5('0x2c')]);if(_0xad0b05[_0x7fe5('0x27')]>0x0){return _0x4ee6cc['status'](0x190)[_0x7fe5('0x2d')](_0xad0b05);}var _0x5439bc=_0x1cd6d3['body'][_0x7fe5('0x2e')];var _0x585f27=_0x1cd6d3['body'][_0x7fe5('0x34')];return getAgent(_0x5439bc)[_0x7fe5('0x1e')](function(_0x46826f){logger[_0x7fe5('0x13')](_0x7fe5('0x35'),_0x46826f['name']);emit(util[_0x7fe5('0x36')](_0x7fe5('0x37'),_0x46826f['name']),_0x7fe5('0x3c'),{'sessionId':_0x585f27});return _0x4ee6cc[_0x7fe5('0x1a')](0xc8)[_0x7fe5('0x2d')]({'error':![],'message':_0x7fe5('0x3d')});})['catch'](handleError(_0x4ee6cc));};exports[_0x7fe5('0x3e')]=function(_0x13225e,_0x7355ac){logger['info'](_0x7fe5('0x3f'),_0x13225e[_0x7fe5('0x2c')]);var _0x3efc98=holdValidation['validate'](_0x13225e[_0x7fe5('0x2c')]);if(_0x3efc98[_0x7fe5('0x27')]>0x0){return _0x7355ac[_0x7fe5('0x1a')](0x190)['json'](_0x3efc98);}var _0x19c4a6=_0x13225e[_0x7fe5('0x2c')][_0x7fe5('0x2e')];var _0x4610b6=_0x13225e[_0x7fe5('0x2c')][_0x7fe5('0x34')];return getAgent(_0x19c4a6)[_0x7fe5('0x1e')](function(_0x447b57){logger[_0x7fe5('0x13')](_0x7fe5('0x35'),_0x447b57[_0x7fe5('0x19')]);emit(util['format']('user:%s',_0x447b57['name']),'webbar:hold',{'sessionId':_0x4610b6});return _0x7355ac[_0x7fe5('0x1a')](0xc8)['json']({'error':![],'message':_0x7fe5('0x40')});})[_0x7fe5('0x21')](handleError(_0x7355ac));};exports[_0x7fe5('0x41')]=function(_0x1d9ca8,_0x362f33){logger['info'](_0x7fe5('0x42'),_0x1d9ca8[_0x7fe5('0x2c')]);var _0x1bd234=unholdValidation[_0x7fe5('0xe')](_0x1d9ca8[_0x7fe5('0x2c')]);if(_0x1bd234[_0x7fe5('0x27')]>0x0){return _0x362f33[_0x7fe5('0x1a')](0x190)[_0x7fe5('0x2d')](_0x1bd234);}var _0x2df3b0=_0x1d9ca8[_0x7fe5('0x2c')]['userId'];var _0x1c16d4=_0x1d9ca8[_0x7fe5('0x2c')][_0x7fe5('0x34')];return getAgent(_0x2df3b0)[_0x7fe5('0x1e')](function(_0x18b041){logger[_0x7fe5('0x13')]('entityFound:',_0x18b041[_0x7fe5('0x19')]);emit(util[_0x7fe5('0x36')](_0x7fe5('0x37'),_0x18b041[_0x7fe5('0x19')]),_0x7fe5('0x43'),{'sessionId':_0x1c16d4});return _0x362f33[_0x7fe5('0x1a')](0xc8)[_0x7fe5('0x2d')]({'error':![],'message':'unhold\x20executed!'});})[_0x7fe5('0x21')](handleError(_0x362f33));};exports[_0x7fe5('0x44')]=function(_0x11d474,_0x637c0a){logger[_0x7fe5('0x13')]('calls\x20fired:',_0x637c0a[_0x7fe5('0x2c')]);var _0x34a430=callsValidation[_0x7fe5('0xe')](_0x11d474[_0x7fe5('0x2c')]);if(_0x34a430['length']>0x0){return _0x637c0a[_0x7fe5('0x1a')](0x190)[_0x7fe5('0x2d')](_0x34a430);}var _0x13b865=_0x11d474[_0x7fe5('0x2c')][_0x7fe5('0x2e')];var _0x25e583=respondWithRpcPromise(_0x7fe5('0x45'));var _0x26607a=getAgent(_0x13b865);return Promise[_0x7fe5('0x46')]([_0x25e583,_0x26607a])[_0x7fe5('0x1e')](function(_0xe5b5cf){var _0x59bd7c=_0xe5b5cf[0x0];var _0x44015c=_0xe5b5cf[0x1];var _0x1ce47c=_[_0x7fe5('0x25')](_0x59bd7c['rows'],function(_0x53e554){return _0x53e554[_0x7fe5('0x26')]==_0x44015c['id'];});return _0x637c0a['status'](0xc8)[_0x7fe5('0x2d')]({'count':_0x1ce47c[_0x7fe5('0x27')],'rows':_0x1ce47c});})['catch'](handleError(_0x637c0a));};exports[_0x7fe5('0x47')]=function(_0x47c811,_0x1fd083){logger[_0x7fe5('0x13')](_0x7fe5('0x48'),_0x47c811[_0x7fe5('0x2c')]);var _0x42d7b3=conferenceValidation[_0x7fe5('0xe')](_0x47c811['body']);if(_0x42d7b3['length']>0x0){return _0x1fd083[_0x7fe5('0x1a')](0x190)[_0x7fe5('0x2d')](_0x42d7b3);}var _0x42f66a=_0x47c811[_0x7fe5('0x2c')][_0x7fe5('0x2e')];return getAgent(_0x42f66a)['then'](function(_0x1eb46e){logger[_0x7fe5('0x13')](_0x7fe5('0x35'),_0x1eb46e[_0x7fe5('0x19')]);emit(util[_0x7fe5('0x36')]('user:%s',_0x1eb46e[_0x7fe5('0x19')]),_0x7fe5('0x49'));return _0x1fd083[_0x7fe5('0x1a')](0xc8)[_0x7fe5('0x2d')]({'error':![],'message':_0x7fe5('0x4a')});})[_0x7fe5('0x21')](handleError(_0x1fd083));};exports[_0x7fe5('0x4b')]=function(_0x512252,_0x343057){logger[_0x7fe5('0x13')](_0x7fe5('0x4c'),_0x512252[_0x7fe5('0x2c')]);var _0x87af50=transferValidation[_0x7fe5('0xe')](_0x512252[_0x7fe5('0x2c')]);if(_0x87af50['length']>0x0){return _0x343057['status'](0x190)[_0x7fe5('0x2d')](_0x87af50);}var _0x4c3ee6=_0x512252[_0x7fe5('0x2c')]['userId'];var _0x3bb81b=_0x512252[_0x7fe5('0x2c')][_0x7fe5('0x34')];var _0x31eb57=_0x512252[_0x7fe5('0x2c')][_0x7fe5('0x4d')];return getAgent(_0x4c3ee6)[_0x7fe5('0x1e')](function(_0x411c3c){logger['info'](_0x7fe5('0x35'),_0x411c3c['name']);emit(util[_0x7fe5('0x36')](_0x7fe5('0x37'),_0x411c3c[_0x7fe5('0x19')]),'webbar:transfer',{'sessionId':_0x3bb81b,'transferNumber':_0x31eb57});return _0x343057[_0x7fe5('0x1a')](0xc8)[_0x7fe5('0x2d')]({'error':![],'message':_0x7fe5('0x4e')});})[_0x7fe5('0x21')](handleError(_0x343057));}; \ No newline at end of file +var _0xfd28=['all','rows','UserId','sessionId','length','sessionId\x20','\x20not\x20found!','info','originate\x20fired:','body','json','callNumber','callbackUrl','entityFound:','format','webbar:originate','originate\x20executed!','hangup','user:%s','hangup\x20executed!','answer\x20fired:','userId','answer\x20executed!','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','calls','calls\x20fired:','VoiceChannels','filter','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','webbar:transfer','transfer\x20executed!','lodash','../../mysqldb','util','jayson/promise','client','http','webbarapi','ioredis','redis','defaults','validate','number','string','userId\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','stringify','emit','handleError:','error','stack','name','status','NotFound','then','code','message','result','catch','User','findOne','agent'];(function(_0x1c451c,_0x2bee10){var _0x274f2b=function(_0x4960d8){while(--_0x4960d8){_0x1c451c['push'](_0x1c451c['shift']());}};_0x274f2b(++_0x2bee10);}(_0xfd28,0x148));var _0x8fd2=function(_0x1bfe2b,_0x34856e){_0x1bfe2b=_0x1bfe2b-0x0;var _0x1477d4=_0xfd28[_0x1bfe2b];return _0x1477d4;};'use strict';var path=require('path');var fs=require('fs');var _=require(_0x8fd2('0x0'));var db=require(_0x8fd2('0x1'))['db'];var config=require('../../config/environment');var util=require(_0x8fd2('0x2'));var BPromise=require('bluebird');var jayson=require(_0x8fd2('0x3'));var amiClient=jayson[_0x8fd2('0x4')][_0x8fd2('0x5')]({'port':0x232a});var logger=require('../../config/logger')(_0x8fd2('0x6'));var Redis=require(_0x8fd2('0x7'));config[_0x8fd2('0x8')]=_[_0x8fd2('0x9')](config[_0x8fd2('0x8')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x8fd2('0x8')]));var Schema=require(_0x8fd2('0xa'));var originateValidation=new Schema({'userId':{'type':_0x8fd2('0xb'),'required':[!![],'userId\x20is\x20required']},'callNumber':{'type':_0x8fd2('0xc'),'required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':_0x8fd2('0xc')},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':_0x8fd2('0xb'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x8fd2('0xc'),'required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],_0x8fd2('0xd')]},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':_0x8fd2('0xb'),'required':[!![],_0x8fd2('0xd')]},'sessionId':{'type':_0x8fd2('0xc'),'required':[!![],_0x8fd2('0xe')]},'transferNumber':{'type':_0x8fd2('0xc'),'required':[!![],_0x8fd2('0xf')]}});var holdValidation=new Schema({'userId':{'type':_0x8fd2('0xb'),'required':[!![],_0x8fd2('0xd')]},'sessionId':{'type':_0x8fd2('0xc'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x8fd2('0xb'),'required':[!![],_0x8fd2('0xd')]},'sessionId':{'type':_0x8fd2('0xc'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x8fd2('0xb'),'required':[!![],_0x8fd2('0xd')]}});var conferenceValidation=new Schema({'userId':{'type':_0x8fd2('0xb'),'required':[!![],'userId\x20is\x20required']}});function emit(_0x20daca,_0x5ef478,_0x4f0b17){logger['info'](_0x20daca,_0x5ef478,JSON[_0x8fd2('0x10')](_0x4f0b17));io['to'](_0x20daca)[_0x8fd2('0x11')](_0x5ef478,_0x4f0b17);}function handleError(_0x1ced10){return function(_0x12e8a3){console['log'](_0x8fd2('0x12'),_0x12e8a3,_0x12e8a3 instanceof RangeError);logger[_0x8fd2('0x13')](_0x12e8a3[_0x8fd2('0x14')]);if(_0x12e8a3 instanceof RangeError){if(_0x12e8a3[_0x8fd2('0x15')]){delete _0x12e8a3[_0x8fd2('0x15')];}_0x1ced10['status'](0x194)['send'](_0x12e8a3);}else{if(_0x12e8a3[_0x8fd2('0x15')]){delete _0x12e8a3['name'];}_0x1ced10[_0x8fd2('0x16')](0x1f4)['send'](_0x12e8a3);}};}function checkError(){return function(_0x1631c6){if(!_0x1631c6){throw new RangeError(_0x8fd2('0x17'));}return _0x1631c6;};}function respondWithRpcPromise(_0x4f81dc,_0x122b60){return new BPromise(function(_0x4c2be8,_0xd3981f){var _0x44ee7a=amiClient;return _0x44ee7a['request'](_0x4f81dc,_0x122b60)[_0x8fd2('0x18')](function(_0x2a9c3c){if(_0x2a9c3c[_0x8fd2('0x13')]){if(_0x2a9c3c['error'][_0x8fd2('0x19')]===0x1f4){return _0xd3981f(_0x2a9c3c[_0x8fd2('0x13')][_0x8fd2('0x1a')]);}return _0x4c2be8(_0x2a9c3c[_0x8fd2('0x13')][_0x8fd2('0x1a')]);}else{_0x4c2be8(_0x2a9c3c[_0x8fd2('0x1b')]);}})[_0x8fd2('0x1c')](function(_0x398925){_0xd3981f(_0x398925);});});}function getAgent(_0x1456b4){return db[_0x8fd2('0x1d')][_0x8fd2('0x1e')]({'where':{'id':_0x1456b4,'role':_0x8fd2('0x1f')}})[_0x8fd2('0x18')](checkError());}function getAgentCheckSession(_0x512e5a,_0x4c6af7){return new BPromise(function(_0x345bc3,_0x1858a9){var _0x288bcd=respondWithRpcPromise('VoiceChannels');var _0x2f26ae=getAgent(_0x512e5a);Promise[_0x8fd2('0x20')]([_0x288bcd,_0x2f26ae])[_0x8fd2('0x18')](function(_0x960869){var _0x119439=_0x960869[0x0];var _0x4745bf=_0x960869[0x1];var _0x332ab0=_['filter'](_0x119439[_0x8fd2('0x21')],function(_0x13c9b9){return _0x13c9b9[_0x8fd2('0x22')]==_0x4745bf['id']&&_0x13c9b9[_0x8fd2('0x23')]==_0x4c6af7;});if(_0x332ab0[_0x8fd2('0x24')]==0x1){_0x345bc3(_0x4745bf);}else{_0x1858a9(new RangeError(_0x8fd2('0x25')+_0x4c6af7+_0x8fd2('0x26')));}});});}exports['originate']=function(_0x5b992a,_0x5144ba){logger[_0x8fd2('0x27')](_0x8fd2('0x28'),_0x5b992a[_0x8fd2('0x29')]);var _0xe4987b=originateValidation['validate'](_0x5b992a['body']);if(_0xe4987b[_0x8fd2('0x24')]>0x0){return _0x5144ba[_0x8fd2('0x16')](0x190)[_0x8fd2('0x2a')](_0xe4987b);}var _0x18fe4e=_0x5b992a[_0x8fd2('0x29')]['userId'];var _0x328964=_0x5b992a['body'][_0x8fd2('0x2b')];var _0x4ade8c=_0x5b992a[_0x8fd2('0x29')]['callerId'];var _0x134420=_0x5b992a[_0x8fd2('0x29')][_0x8fd2('0x2c')];return getAgent(_0x18fe4e)['then'](function(_0x339291){logger['info'](_0x8fd2('0x2d'),_0x339291[_0x8fd2('0x15')]);emit(util[_0x8fd2('0x2e')]('user:%s',_0x339291[_0x8fd2('0x15')]),_0x8fd2('0x2f'),{'callNumber':_0x328964,'callerId':_0x4ade8c,'callbackUrl':_0x134420});return _0x5144ba[_0x8fd2('0x16')](0xc8)['json']({'error':![],'message':_0x8fd2('0x30')});})[_0x8fd2('0x1c')](handleError(_0x5144ba));};exports[_0x8fd2('0x31')]=function(_0x4adfa2,_0x37a24b){logger[_0x8fd2('0x27')]('hangup\x20fired:',_0x4adfa2[_0x8fd2('0x29')]);var _0x130072=hangupValidation[_0x8fd2('0xa')](_0x4adfa2[_0x8fd2('0x29')]);if(_0x130072[_0x8fd2('0x24')]>0x0){return _0x37a24b[_0x8fd2('0x16')](0x190)[_0x8fd2('0x2a')](_0x130072);}var _0x5e6140=_0x4adfa2[_0x8fd2('0x29')]['userId'];var _0x566c9e=_0x4adfa2[_0x8fd2('0x29')][_0x8fd2('0x23')];return getAgent(_0x5e6140)[_0x8fd2('0x18')](function(_0x2edcfd){logger[_0x8fd2('0x27')](_0x8fd2('0x2d'),_0x2edcfd['name']);emit(util['format'](_0x8fd2('0x32'),_0x2edcfd['name']),'webbar:hangup',{'sessionId':_0x566c9e});return _0x37a24b[_0x8fd2('0x16')](0xc8)[_0x8fd2('0x2a')]({'error':![],'message':_0x8fd2('0x33')});})[_0x8fd2('0x1c')](handleError(_0x37a24b));};exports['answer']=function(_0x39cd8e,_0x1d5458){logger[_0x8fd2('0x27')](_0x8fd2('0x34'),_0x39cd8e[_0x8fd2('0x29')]);var _0x1de9aa=answerValidation[_0x8fd2('0xa')](_0x39cd8e['body']);if(_0x1de9aa[_0x8fd2('0x24')]>0x0){return _0x1d5458[_0x8fd2('0x16')](0x190)[_0x8fd2('0x2a')](_0x1de9aa);}var _0x70404e=_0x39cd8e[_0x8fd2('0x29')][_0x8fd2('0x35')];var _0x40a572=_0x39cd8e['body'][_0x8fd2('0x23')];return getAgent(_0x70404e)[_0x8fd2('0x18')](function(_0x2abd80){logger[_0x8fd2('0x27')](_0x8fd2('0x2d'),_0x2abd80[_0x8fd2('0x15')]);emit(util[_0x8fd2('0x2e')]('user:%s',_0x2abd80[_0x8fd2('0x15')]),'webbar:answer',{'sessionId':_0x40a572});return _0x1d5458[_0x8fd2('0x16')](0xc8)['json']({'error':![],'message':_0x8fd2('0x36')});})[_0x8fd2('0x1c')](handleError(_0x1d5458));};exports[_0x8fd2('0x37')]=function(_0x5c0632,_0x290467){logger[_0x8fd2('0x27')](_0x8fd2('0x38'),_0x5c0632['body']);var _0x3c65c4=holdValidation['validate'](_0x5c0632[_0x8fd2('0x29')]);if(_0x3c65c4[_0x8fd2('0x24')]>0x0){return _0x290467[_0x8fd2('0x16')](0x190)[_0x8fd2('0x2a')](_0x3c65c4);}var _0xc62e9e=_0x5c0632[_0x8fd2('0x29')][_0x8fd2('0x35')];var _0x34ffed=_0x5c0632[_0x8fd2('0x29')][_0x8fd2('0x23')];return getAgent(_0xc62e9e)[_0x8fd2('0x18')](function(_0x34f3a2){logger[_0x8fd2('0x27')](_0x8fd2('0x2d'),_0x34f3a2[_0x8fd2('0x15')]);emit(util[_0x8fd2('0x2e')](_0x8fd2('0x32'),_0x34f3a2[_0x8fd2('0x15')]),_0x8fd2('0x39'),{'sessionId':_0x34ffed});return _0x290467['status'](0xc8)['json']({'error':![],'message':_0x8fd2('0x3a')});})[_0x8fd2('0x1c')](handleError(_0x290467));};exports[_0x8fd2('0x3b')]=function(_0x5d79c3,_0x4d5b81){logger[_0x8fd2('0x27')]('unhold\x20fired:',_0x5d79c3[_0x8fd2('0x29')]);var _0x1295c4=unholdValidation[_0x8fd2('0xa')](_0x5d79c3['body']);if(_0x1295c4[_0x8fd2('0x24')]>0x0){return _0x4d5b81[_0x8fd2('0x16')](0x190)['json'](_0x1295c4);}var _0x331ada=_0x5d79c3[_0x8fd2('0x29')][_0x8fd2('0x35')];var _0x56050f=_0x5d79c3[_0x8fd2('0x29')][_0x8fd2('0x23')];return getAgent(_0x331ada)[_0x8fd2('0x18')](function(_0x2c5766){logger[_0x8fd2('0x27')](_0x8fd2('0x2d'),_0x2c5766['name']);emit(util['format'](_0x8fd2('0x32'),_0x2c5766[_0x8fd2('0x15')]),'webbar:unhold',{'sessionId':_0x56050f});return _0x4d5b81[_0x8fd2('0x16')](0xc8)['json']({'error':![],'message':'unhold\x20executed!'});})[_0x8fd2('0x1c')](handleError(_0x4d5b81));};exports[_0x8fd2('0x3c')]=function(_0x337354,_0x29a00e){logger[_0x8fd2('0x27')](_0x8fd2('0x3d'),_0x29a00e['body']);var _0x2f4759=callsValidation[_0x8fd2('0xa')](_0x337354[_0x8fd2('0x29')]);if(_0x2f4759[_0x8fd2('0x24')]>0x0){return _0x29a00e[_0x8fd2('0x16')](0x190)['json'](_0x2f4759);}var _0x5cf641=_0x337354['body']['userId'];var _0x57b8f6=respondWithRpcPromise(_0x8fd2('0x3e'));var _0x382154=getAgent(_0x5cf641);return Promise[_0x8fd2('0x20')]([_0x57b8f6,_0x382154])[_0x8fd2('0x18')](function(_0x21696c){var _0x25abdc=_0x21696c[0x0];var _0x460f31=_0x21696c[0x1];var _0x4a81ab=_[_0x8fd2('0x3f')](_0x25abdc['rows'],function(_0x351cfe){return _0x351cfe[_0x8fd2('0x22')]==_0x460f31['id'];});return _0x29a00e['status'](0xc8)['json']({'count':_0x4a81ab[_0x8fd2('0x24')],'rows':_0x4a81ab});})[_0x8fd2('0x1c')](handleError(_0x29a00e));};exports[_0x8fd2('0x40')]=function(_0x30a952,_0x37ddfa){logger['info'](_0x8fd2('0x41'),_0x30a952[_0x8fd2('0x29')]);var _0x1b46d6=conferenceValidation[_0x8fd2('0xa')](_0x30a952['body']);if(_0x1b46d6[_0x8fd2('0x24')]>0x0){return _0x37ddfa[_0x8fd2('0x16')](0x190)[_0x8fd2('0x2a')](_0x1b46d6);}var _0x23c608=_0x30a952['body']['userId'];return getAgent(_0x23c608)['then'](function(_0x2e5693){logger[_0x8fd2('0x27')](_0x8fd2('0x2d'),_0x2e5693[_0x8fd2('0x15')]);emit(util[_0x8fd2('0x2e')]('user:%s',_0x2e5693[_0x8fd2('0x15')]),_0x8fd2('0x42'));return _0x37ddfa['status'](0xc8)[_0x8fd2('0x2a')]({'error':![],'message':_0x8fd2('0x43')});})[_0x8fd2('0x1c')](handleError(_0x37ddfa));};exports[_0x8fd2('0x44')]=function(_0x305d83,_0x5547c7){logger[_0x8fd2('0x27')](_0x8fd2('0x45'),_0x305d83[_0x8fd2('0x29')]);var _0x4606f7=transferValidation[_0x8fd2('0xa')](_0x305d83[_0x8fd2('0x29')]);if(_0x4606f7[_0x8fd2('0x24')]>0x0){return _0x5547c7[_0x8fd2('0x16')](0x190)[_0x8fd2('0x2a')](_0x4606f7);}var _0x4680f0=_0x305d83[_0x8fd2('0x29')][_0x8fd2('0x35')];var _0x40ffd5=_0x305d83['body'][_0x8fd2('0x23')];var _0x237756=_0x305d83['body']['transferNumber'];return getAgent(_0x4680f0)['then'](function(_0x2bd1d0){logger[_0x8fd2('0x27')](_0x8fd2('0x2d'),_0x2bd1d0[_0x8fd2('0x15')]);emit(util[_0x8fd2('0x2e')](_0x8fd2('0x32'),_0x2bd1d0['name']),_0x8fd2('0x46'),{'sessionId':_0x40ffd5,'transferNumber':_0x237756});return _0x5547c7[_0x8fd2('0x16')](0xc8)['json']({'error':![],'message':_0x8fd2('0x47')});})['catch'](handleError(_0x5547c7));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 9e873c3..788a200 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 _0x2a07=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','getAgents','/:id/applications','getApplications','post','addDisposition','addAnswer','/:id/users','addAgents','addApplications','/:id/notify','notify','/:id/send','send','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout'];(function(_0x54aeb5,_0x1aa3c4){var _0xd30904=function(_0x5f4048){while(--_0x5f4048){_0x54aeb5['push'](_0x54aeb5['shift']());}};_0xd30904(++_0x1aa3c4);}(_0x2a07,0x74));var _0x72a0=function(_0x217cfd,_0x1e3094){_0x217cfd=_0x217cfd-0x0;var _0x1e887f=_0x2a07[_0x217cfd];return _0x1e887f;};'use strict';var multer=require(_0x72a0('0x0'));var util=require(_0x72a0('0x1'));var path=require(_0x72a0('0x2'));var timeout=require(_0x72a0('0x3'));var express=require(_0x72a0('0x4'));var router=express['Router']();var fs_extra=require(_0x72a0('0x5'));var auth=require(_0x72a0('0x6'));var interaction=require(_0x72a0('0x7'));var config=require(_0x72a0('0x8'));var controller=require(_0x72a0('0x9'));router[_0x72a0('0xa')]('/',auth[_0x72a0('0xb')](),controller[_0x72a0('0xc')]);router[_0x72a0('0xa')](_0x72a0('0xd'),auth[_0x72a0('0xb')](),controller[_0x72a0('0xe')]);router[_0x72a0('0xa')](_0x72a0('0xf'),auth[_0x72a0('0xb')](),controller[_0x72a0('0x10')]);router['get'](_0x72a0('0x11'),auth[_0x72a0('0xb')](),controller['getDispositions']);router[_0x72a0('0xa')](_0x72a0('0x12'),auth[_0x72a0('0xb')](),controller[_0x72a0('0x13')]);router[_0x72a0('0xa')]('/:id/users',auth[_0x72a0('0xb')](),controller[_0x72a0('0x14')]);router[_0x72a0('0xa')](_0x72a0('0x15'),auth[_0x72a0('0xb')](),controller[_0x72a0('0x16')]);router[_0x72a0('0x17')]('/',auth['isAuthenticated'](),controller['create']);router[_0x72a0('0x17')](_0x72a0('0x11'),auth[_0x72a0('0xb')](),controller[_0x72a0('0x18')]);router[_0x72a0('0x17')](_0x72a0('0x12'),auth['isAuthenticated'](),controller[_0x72a0('0x19')]);router[_0x72a0('0x17')](_0x72a0('0x1a'),auth[_0x72a0('0xb')](),controller[_0x72a0('0x1b')]);router['post'](_0x72a0('0x15'),auth[_0x72a0('0xb')](),controller[_0x72a0('0x1c')]);router['post'](_0x72a0('0x1d'),controller[_0x72a0('0x1e')]);router[_0x72a0('0x17')](_0x72a0('0x1f'),auth['isAuthenticated'](),controller[_0x72a0('0x20')]);router['put'](_0x72a0('0xf'),auth[_0x72a0('0xb')](),controller[_0x72a0('0x21')]);router['delete'](_0x72a0('0xf'),auth[_0x72a0('0xb')](),controller[_0x72a0('0x22')]);router[_0x72a0('0x23')]('/:id/dispositions',auth[_0x72a0('0xb')](),controller[_0x72a0('0x24')]);router[_0x72a0('0x23')](_0x72a0('0x12'),auth[_0x72a0('0xb')](),controller[_0x72a0('0x25')]);router['delete']('/:id/users',auth[_0x72a0('0xb')](),controller[_0x72a0('0x26')]);module[_0x72a0('0x27')]=router; \ No newline at end of file +var _0xe2fe=['removeAgents','exports','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','/:id/dispositions','getAgents','/:id/applications','getApplications','post','addDisposition','/:id/canned_answers','addAnswer','/:id/users','addAgents','addApplications','/:id/notify','notify','send','put','destroy','delete','removeDispositions','removeAnswers'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe2fe,0x86));var _0xee2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe2fe[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xee2f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xee2f('0x1'));var express=require('express');var router=express[_0xee2f('0x2')]();var fs_extra=require(_0xee2f('0x3'));var auth=require(_0xee2f('0x4'));var interaction=require(_0xee2f('0x5'));var config=require(_0xee2f('0x6'));var controller=require('./whatsappAccount.controller');router[_0xee2f('0x7')]('/',auth[_0xee2f('0x8')](),controller['index']);router[_0xee2f('0x7')](_0xee2f('0x9'),auth['isAuthenticated'](),controller[_0xee2f('0xa')]);router['get'](_0xee2f('0xb'),auth[_0xee2f('0x8')](),controller['show']);router[_0xee2f('0x7')](_0xee2f('0xc'),auth['isAuthenticated'](),controller['getDispositions']);router['get']('/:id/canned_answers',auth[_0xee2f('0x8')](),controller['getAnswers']);router['get']('/:id/users',auth[_0xee2f('0x8')](),controller[_0xee2f('0xd')]);router[_0xee2f('0x7')](_0xee2f('0xe'),auth[_0xee2f('0x8')](),controller[_0xee2f('0xf')]);router['post']('/',auth[_0xee2f('0x8')](),controller['create']);router[_0xee2f('0x10')](_0xee2f('0xc'),auth['isAuthenticated'](),controller[_0xee2f('0x11')]);router[_0xee2f('0x10')](_0xee2f('0x12'),auth[_0xee2f('0x8')](),controller[_0xee2f('0x13')]);router['post'](_0xee2f('0x14'),auth['isAuthenticated'](),controller[_0xee2f('0x15')]);router[_0xee2f('0x10')]('/:id/applications',auth['isAuthenticated'](),controller[_0xee2f('0x16')]);router['post'](_0xee2f('0x17'),controller[_0xee2f('0x18')]);router[_0xee2f('0x10')]('/:id/send',auth[_0xee2f('0x8')](),controller[_0xee2f('0x19')]);router[_0xee2f('0x1a')](_0xee2f('0xb'),auth[_0xee2f('0x8')](),controller['update']);router['delete'](_0xee2f('0xb'),auth[_0xee2f('0x8')](),controller[_0xee2f('0x1b')]);router[_0xee2f('0x1c')](_0xee2f('0xc'),auth[_0xee2f('0x8')](),controller[_0xee2f('0x1d')]);router['delete'](_0xee2f('0x12'),auth[_0xee2f('0x8')](),controller[_0xee2f('0x1e')]);router[_0xee2f('0x1c')](_0xee2f('0x14'),auth[_0xee2f('0x8')](),controller[_0xee2f('0x1f')]);module[_0xee2f('0x20')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 3446e63..887f9d1 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 _0x8416=['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','sequelize','STRING','name','ENUM','twilio','sinch','TEXT'];(function(_0xbb9dbf,_0x5dafa4){var _0x30223c=function(_0xaa9ca){while(--_0xaa9ca){_0xbb9dbf['push'](_0xbb9dbf['shift']());}};_0x30223c(++_0x5dafa4);}(_0x8416,0x124));var _0x6841=function(_0x55bd12,_0x3ccb52){_0x55bd12=_0x55bd12-0x0;var _0x1941dd=_0x8416[_0x55bd12];return _0x1941dd;};'use strict';var Sequelize=require(_0x6841('0x0'));var rs=require('randomstring');module['exports']={'name':{'type':Sequelize[_0x6841('0x1')],'unique':_0x6841('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0x6841('0x1')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0x6841('0x1')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0x6841('0x1')]},'type':{'type':Sequelize[_0x6841('0x3')](_0x6841('0x4'),_0x6841('0x5'))},'accountSid':{'type':Sequelize[_0x6841('0x1')]},'baseUrl':{'type':Sequelize[_0x6841('0x1')]},'authToken':{'type':Sequelize[_0x6841('0x1')]},'notificationTemplate':{'type':Sequelize[_0x6841('0x6')],'defaultValue':function(){return _0x6841('0x7');}},'notificationSound':{'type':Sequelize[_0x6841('0x8')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x6841('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x6841('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x6841('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x6841('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x6841('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x6841('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x6841('0xa')},'mandatoryDisposition':{'type':Sequelize[_0x6841('0x8')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x599806){if(!_0x599806){this[_0x6841('0xb')](_0x6841('0xc'),null);}this[_0x6841('0xb')]('mandatoryDisposition',_0x599806);}},'description':{'type':Sequelize[_0x6841('0x1')]}}; \ No newline at end of file +var _0xd2cc=['Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','sequelize','randomstring','exports','STRING','name','generate','ENUM','twilio','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER'];(function(_0x153b58,_0x57b209){var _0x133465=function(_0x185f89){while(--_0x185f89){_0x153b58['push'](_0x153b58['shift']());}};_0x133465(++_0x57b209);}(_0xd2cc,0x6c));var _0xcd2c=function(_0x4fe17c,_0x3de842){_0x4fe17c=_0x4fe17c-0x0;var _0x14f304=_0xd2cc[_0x4fe17c];return _0x14f304;};'use strict';var Sequelize=require(_0xcd2c('0x0'));var rs=require(_0xcd2c('0x1'));module[_0xcd2c('0x2')]={'name':{'type':Sequelize[_0xcd2c('0x3')],'unique':_0xcd2c('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0xcd2c('0x3')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0xcd2c('0x3')],'defaultValue':function(){return rs[_0xcd2c('0x5')]();}},'phone':{'type':Sequelize[_0xcd2c('0x3')]},'type':{'type':Sequelize[_0xcd2c('0x6')](_0xcd2c('0x7'),'sinch')},'accountSid':{'type':Sequelize[_0xcd2c('0x3')]},'baseUrl':{'type':Sequelize[_0xcd2c('0x3')]},'authToken':{'type':Sequelize[_0xcd2c('0x3')]},'notificationTemplate':{'type':Sequelize[_0xcd2c('0x8')],'defaultValue':function(){return _0xcd2c('0x9');}},'notificationSound':{'type':Sequelize[_0xcd2c('0xa')],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xcd2c('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xcd2c('0xa')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xcd2c('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xcd2c('0xa')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xcd2c('0xb')],'comment':_0xcd2c('0xc')},'mandatoryDisposition':{'type':Sequelize[_0xcd2c('0xa')],'defaultValue':![],'comment':_0xcd2c('0xd'),'set':function(_0x4c465f){if(!_0x4c465f){this[_0xcd2c('0xe')]('mandatoryDispositionPauseId',null);}this[_0xcd2c('0xe')]('mandatoryDisposition',_0x4c465f);}},'description':{'type':Sequelize[_0xcd2c('0x3')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index a41248f..331c2fb 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 _0xc10b=['getApplications','notify','whatsapp','Applications','account','sinch','statuses','state','read','WhatsappMessage','timestamp','message_id','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','updatedAt','difference','CompanyId','ListId','mobile','from','replace','whatsapp:','Body','messageId','MessageSid','notifications','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','defaults','contact','WhatsappInteraction','interaction','created','autoclose','applications','push','close','unmanaged','ContactId','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','*,*,*,*','startRouting','Start','receiveMessage','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','twilio','Content-Type','text/xml','\x0a','to\x20is\x20mandatory','List','out','Messages','dataValues','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','http','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','offset','undefined','count','limit','set','apply','reject','save','update','destroy','WhatsappAccounts','UserProfileResource','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','options','WhatsappAccount','includeAll','include','rows','show','params','Pause','keys','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','mandatoryDispositionPause','describe','addDisposition','Disposition','getDispositions','findOne','length','pick','WhatsappAccountId','removeDispositions','CannedAnswer','getAnswers','removeAnswers','addAgents','omit','ids','spread','emit','userWhatsappAccount:save','removeAgents','userWhatsappAccount:remove','getAgents','User','sequelize','transaction','Transaction','ISOLATION_LEVELS','WhatsappApplication','bulkCreate','findAndCountAll','priority','json'];(function(_0x3a1ea5,_0x349f01){var _0xfac9b2=function(_0xd5310c){while(--_0xd5310c){_0x3a1ea5['push'](_0x3a1ea5['shift']());}};_0xfac9b2(++_0x349f01);}(_0xc10b,0x103));var _0xbc10=function(_0x580647,_0x43d2c3){_0x580647=_0x580647-0x0;var _0x5f0792=_0xc10b[_0x580647];return _0x5f0792;};'use strict';var emlformat=require(_0xbc10('0x0'));var rimraf=require(_0xbc10('0x1'));var zipdir=require(_0xbc10('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbc10('0x3'));var moment=require(_0xbc10('0x4'));var BPromise=require(_0xbc10('0x5'));var Mustache=require(_0xbc10('0x6'));var util=require(_0xbc10('0x7'));var path=require(_0xbc10('0x8'));var sox=require(_0xbc10('0x9'));var csv=require(_0xbc10('0xa'));var ejs=require(_0xbc10('0xb'));var fs=require('fs');var fs_extra=require(_0xbc10('0xc'));var _=require('lodash');var squel=require(_0xbc10('0xd'));var crypto=require(_0xbc10('0xe'));var jsforce=require(_0xbc10('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xbc10('0xa'));var querystring=require(_0xbc10('0x10'));var Papa=require('papaparse');var Redis=require(_0xbc10('0x11'));var authService=require(_0xbc10('0x12'));var qs=require(_0xbc10('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xbc10('0x14'))('api');var utils=require(_0xbc10('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xbc10('0x16'));var db=require(_0xbc10('0x17'))['db'];config[_0xbc10('0x18')]=_['defaults'](config['redis'],{'host':_0xbc10('0x19'),'port':0x18eb});var socket=require(_0xbc10('0x1a'))(new Redis(config[_0xbc10('0x18')]));require(_0xbc10('0x1b'))[_0xbc10('0x1c')](socket);var jayson=require(_0xbc10('0x1d'));var client=jayson['client'][_0xbc10('0x1e')]({'port':0x232c});function respondWithRpcPromise(_0x343e04,_0x47beb4,_0x67489e,_0x3e7a44){return new BPromise(function(_0x2b3105,_0x4361bb){var _0x489243=_0x3e7a44||client;return _0x489243[_0xbc10('0x1f')](_0x343e04,_0x67489e)[_0xbc10('0x20')](function(_0x27ac80){logger[_0xbc10('0x21')](_0xbc10('0x22'),_0x47beb4,_0xbc10('0x23'));logger['debug'](_0xbc10('0x24'),_0x47beb4,_0xbc10('0x23'),JSON[_0xbc10('0x25')](_0x27ac80));if(_0x27ac80[_0xbc10('0x26')]){if(_0x27ac80[_0xbc10('0x26')]['code']===0x1f4){logger[_0xbc10('0x26')](_0xbc10('0x22'),_0x47beb4,_0x27ac80[_0xbc10('0x26')][_0xbc10('0x27')]);return _0x4361bb(_0x27ac80['error'][_0xbc10('0x27')]);}logger[_0xbc10('0x26')]('WhatsappAccount,\x20%s,\x20%s',_0x47beb4,_0x27ac80['error'][_0xbc10('0x27')]);return _0x2b3105(_0x27ac80[_0xbc10('0x26')][_0xbc10('0x27')]);}else{logger[_0xbc10('0x21')]('WhatsappAccount,\x20%s,\x20%s',_0x47beb4,_0xbc10('0x23'));_0x2b3105(_0x27ac80[_0xbc10('0x28')]['message']);}})[_0xbc10('0x29')](function(_0x358e5b){logger[_0xbc10('0x26')]('WhatsappAccount,\x20%s,\x20%s',_0x47beb4,_0x358e5b);_0x4361bb(_0x358e5b);});});}function respondWithStatusCode(_0x4c7b1c,_0x3d2169){_0x3d2169=_0x3d2169||0xcc;return function(_0x5ec416){if(_0x5ec416){return _0x4c7b1c[_0xbc10('0x2a')](_0x3d2169);}return _0x4c7b1c[_0xbc10('0x2b')](_0x3d2169)['end']();};}function respondWithResult(_0x81baae,_0x164cf3){_0x164cf3=_0x164cf3||0xc8;return function(_0x410f8a){if(_0x410f8a){return _0x81baae['status'](_0x164cf3)['json'](_0x410f8a);}};}function respondWithFilteredResult(_0x8dbe4f,_0x7f1c6){return function(_0x1fa190){if(_0x1fa190){var _0x3386a1=typeof _0x7f1c6[_0xbc10('0x2c')]===_0xbc10('0x2d')&&typeof _0x7f1c6['limit']===_0xbc10('0x2d');var _0x250ed6=_0x1fa190[_0xbc10('0x2e')];var _0xaabc92=_0x3386a1?0x0:_0x7f1c6[_0xbc10('0x2c')];var _0x135ca4=_0x3386a1?_0x1fa190[_0xbc10('0x2e')]:_0x7f1c6[_0xbc10('0x2c')]+_0x7f1c6[_0xbc10('0x2f')];var _0x11a3b3;if(_0x135ca4>=_0x250ed6){_0x135ca4=_0x250ed6;_0x11a3b3=0xc8;}else{_0x11a3b3=0xce;}_0x8dbe4f[_0xbc10('0x2b')](_0x11a3b3);return _0x8dbe4f[_0xbc10('0x30')]('Content-Range',_0xaabc92+'-'+_0x135ca4+'/'+_0x250ed6)['json'](_0x1fa190);}return null;};}function patchUpdates(_0x436f91){return function(_0x1a8f87){try{jsonpatch[_0xbc10('0x31')](_0x1a8f87,_0x436f91,!![]);}catch(_0x27fac9){return BPromise[_0xbc10('0x32')](_0x27fac9);}return _0x1a8f87[_0xbc10('0x33')]();};}function saveUpdates(_0x2d810f,_0x400aa1){return function(_0x4dd292){if(_0x4dd292){return _0x4dd292[_0xbc10('0x34')](_0x2d810f)[_0xbc10('0x20')](function(_0x257620){return _0x257620;});}return null;};}function removeEntity(_0x59025f,_0x558e38){return function(_0x515f53){if(_0x515f53){return _0x515f53[_0xbc10('0x35')]()[_0xbc10('0x20')](function(){var _0x1e3361=_0x515f53['get']({'plain':!![]});var _0x4ffdde=_0xbc10('0x36');return db[_0xbc10('0x37')][_0xbc10('0x35')]({'where':{'type':_0x4ffdde,'resourceId':_0x1e3361['id']}})[_0xbc10('0x20')](function(){return _0x515f53;});})[_0xbc10('0x20')](function(){_0x59025f[_0xbc10('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x264d39,_0x4f078f){return function(_0x219ca5){if(!_0x219ca5){_0x264d39[_0xbc10('0x2a')](0x194);}return _0x219ca5;};}function handleError(_0x262e0b,_0x5baf94){_0x5baf94=_0x5baf94||0x1f4;return function(_0x1bfc2c){logger[_0xbc10('0x26')](_0x1bfc2c[_0xbc10('0x38')]);if(_0x1bfc2c['name']){delete _0x1bfc2c[_0xbc10('0x39')];}_0x262e0b[_0xbc10('0x2b')](_0x5baf94)[_0xbc10('0x3a')](_0x1bfc2c);};}exports[_0xbc10('0x3b')]=function(_0x1fcaa2,_0x59dd1a){var _0x2d192e={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x42fd74={},_0x3420c1={'count':0x0,'rows':[]};var _0x723fa5=_[_0xbc10('0x3c')](db['WhatsappAccount'][_0xbc10('0x3d')],function(_0x4b5a7a){return{'name':_0x4b5a7a[_0xbc10('0x3e')],'type':_0x4b5a7a[_0xbc10('0x3f')][_0xbc10('0x40')]};});_0x42fd74[_0xbc10('0x41')]=_['map'](_0x723fa5,_0xbc10('0x39'));_0x42fd74['query']=_['keys'](_0x1fcaa2[_0xbc10('0x42')]);_0x42fd74['filters']=_['intersection'](_0x42fd74[_0xbc10('0x41')],_0x42fd74['query']);_0x2d192e[_0xbc10('0x43')]=_[_0xbc10('0x44')](_0x42fd74[_0xbc10('0x41')],qs[_0xbc10('0x45')](_0x1fcaa2[_0xbc10('0x42')]['fields']));_0x2d192e['attributes']=_0x2d192e[_0xbc10('0x43')]['length']?_0x2d192e[_0xbc10('0x43')]:_0x42fd74['model'];if(!_0x1fcaa2[_0xbc10('0x42')][_0xbc10('0x46')](_0xbc10('0x47'))){_0x2d192e[_0xbc10('0x2f')]=qs[_0xbc10('0x2f')](_0x1fcaa2['query'][_0xbc10('0x2f')]);_0x2d192e[_0xbc10('0x2c')]=qs[_0xbc10('0x2c')](_0x1fcaa2[_0xbc10('0x42')]['offset']);}_0x2d192e[_0xbc10('0x48')]=qs[_0xbc10('0x49')](_0x1fcaa2[_0xbc10('0x42')][_0xbc10('0x49')]);_0x2d192e[_0xbc10('0x4a')]=qs[_0xbc10('0x4b')](_['pick'](_0x1fcaa2[_0xbc10('0x42')],_0x42fd74['filters']),_0x723fa5);if(_0x1fcaa2[_0xbc10('0x42')][_0xbc10('0x4c')]){_0x2d192e[_0xbc10('0x4a')]=_['merge'](_0x2d192e['where'],{'$or':_[_0xbc10('0x3c')](_0x723fa5,function(_0x16d6ce){if(_0x16d6ce['type']!=='VIRTUAL'){var _0x461286={};_0x461286[_0x16d6ce[_0xbc10('0x39')]]={'$like':'%'+_0x1fcaa2[_0xbc10('0x42')]['filter']+'%'};return _0x461286;}})});}_0x2d192e=_[_0xbc10('0x4d')]({},_0x2d192e,_0x1fcaa2[_0xbc10('0x4e')]);var _0x7d3304={'where':_0x2d192e[_0xbc10('0x4a')]};return db[_0xbc10('0x4f')]['count'](_0x7d3304)['then'](function(_0x3bdfec){_0x3420c1[_0xbc10('0x2e')]=_0x3bdfec;if(_0x1fcaa2[_0xbc10('0x42')][_0xbc10('0x50')]){_0x2d192e[_0xbc10('0x51')]=[{'all':!![]}];}return db[_0xbc10('0x4f')]['findAll'](_0x2d192e);})['then'](function(_0x22d617){_0x3420c1[_0xbc10('0x52')]=_0x22d617;return _0x3420c1;})[_0xbc10('0x20')](respondWithFilteredResult(_0x59dd1a,_0x2d192e))[_0xbc10('0x29')](handleError(_0x59dd1a,null));};exports[_0xbc10('0x53')]=function(_0x3e4e49,_0x184a17){var _0x48fd81={'raw':![],'where':{'id':_0x3e4e49[_0xbc10('0x54')]['id']},'include':[{'model':db[_0xbc10('0x55')],'as':'mandatoryDispositionPause'}]},_0x4c6bc9={};_0x4c6bc9['model']=_[_0xbc10('0x56')](db['WhatsappAccount']['rawAttributes']);_0x4c6bc9[_0xbc10('0x42')]=_[_0xbc10('0x56')](_0x3e4e49[_0xbc10('0x42')]);_0x4c6bc9[_0xbc10('0x4b')]=_[_0xbc10('0x44')](_0x4c6bc9['model'],_0x4c6bc9['query']);_0x48fd81[_0xbc10('0x43')]=_[_0xbc10('0x44')](_0x4c6bc9[_0xbc10('0x41')],qs[_0xbc10('0x45')](_0x3e4e49[_0xbc10('0x42')][_0xbc10('0x45')]));_0x48fd81[_0xbc10('0x43')]=_0x48fd81[_0xbc10('0x43')]['length']?_0x48fd81['attributes']:_0x4c6bc9['model'];if(_0x3e4e49[_0xbc10('0x42')][_0xbc10('0x50')]){_0x48fd81[_0xbc10('0x51')]=[{'all':!![]}];}_0x48fd81=_[_0xbc10('0x4d')]({},_0x48fd81,_0x3e4e49['options']);return db[_0xbc10('0x4f')][_0xbc10('0x57')](_0x48fd81)['then'](handleEntityNotFound(_0x184a17,null))[_0xbc10('0x20')](respondWithResult(_0x184a17,null))[_0xbc10('0x29')](handleError(_0x184a17,null));};exports['create']=function(_0x2a8ab7,_0x2d33c5){return db[_0xbc10('0x4f')][_0xbc10('0x58')](_0x2a8ab7[_0xbc10('0x59')],{})[_0xbc10('0x20')](function(_0xcfb82a){var _0x13fd92=_0x2a8ab7[_0xbc10('0x5a')][_0xbc10('0x5b')]({'plain':!![]});if(!_0x13fd92)throw new Error(_0xbc10('0x5c'));if(_0x13fd92[_0xbc10('0x5d')]===_0xbc10('0x5a')){var _0x4b7f00=_0xcfb82a['get']({'plain':!![]});var _0x352465=_0xbc10('0x36');return db['UserProfileSection'][_0xbc10('0x57')]({'where':{'name':_0x352465,'userProfileId':_0x13fd92[_0xbc10('0x5e')]},'raw':!![]})[_0xbc10('0x20')](function(_0x2c9540){if(_0x2c9540&&_0x2c9540[_0xbc10('0x5f')]===0x0){return db[_0xbc10('0x37')][_0xbc10('0x58')]({'name':_0x4b7f00[_0xbc10('0x39')],'resourceId':_0x4b7f00['id'],'type':_0x2c9540[_0xbc10('0x39')],'sectionId':_0x2c9540['id']},{})[_0xbc10('0x20')](function(){return _0xcfb82a;});}else{return _0xcfb82a;}})[_0xbc10('0x29')](function(_0x117b9a){logger[_0xbc10('0x26')](_0xbc10('0x60'),_0x117b9a);throw _0x117b9a;});}return _0xcfb82a;})[_0xbc10('0x20')](respondWithResult(_0x2d33c5,0xc9))[_0xbc10('0x29')](handleError(_0x2d33c5,null));};exports[_0xbc10('0x34')]=function(_0x4209f0,_0x10b655){if(_0x4209f0[_0xbc10('0x59')]['id']){delete _0x4209f0[_0xbc10('0x59')]['id'];}return db[_0xbc10('0x4f')][_0xbc10('0x57')]({'where':{'id':_0x4209f0['params']['id']},'include':[{'model':db[_0xbc10('0x55')],'as':_0xbc10('0x61')}]})[_0xbc10('0x20')](handleEntityNotFound(_0x10b655,null))['then'](saveUpdates(_0x4209f0[_0xbc10('0x59')],null))[_0xbc10('0x20')](respondWithResult(_0x10b655,null))[_0xbc10('0x29')](handleError(_0x10b655,null));};exports[_0xbc10('0x35')]=function(_0x5029cb,_0x354deb){return db[_0xbc10('0x4f')]['find']({'where':{'id':_0x5029cb['params']['id']}})[_0xbc10('0x20')](handleEntityNotFound(_0x354deb,null))[_0xbc10('0x20')](removeEntity(_0x354deb,null))['catch'](handleError(_0x354deb,null));};exports[_0xbc10('0x62')]=function(_0x115d54,_0x4d208d){return db[_0xbc10('0x4f')][_0xbc10('0x62')]()['then'](respondWithResult(_0x4d208d,null))[_0xbc10('0x29')](handleError(_0x4d208d,null));};exports[_0xbc10('0x63')]=function(_0x25c6cb,_0x3a6521,_0x33c492){if(_0x25c6cb[_0xbc10('0x59')]['id']){delete _0x25c6cb['body']['id'];}return db[_0xbc10('0x4f')][_0xbc10('0x57')]({'where':{'id':_0x25c6cb[_0xbc10('0x54')]['id']}})[_0xbc10('0x20')](handleEntityNotFound(_0x3a6521,null))[_0xbc10('0x20')](function(_0x3abc39){if(_0x3abc39){_0x25c6cb['body']['WhatsappAccountId']=_0x3abc39['id'];return db[_0xbc10('0x64')]['create'](_0x25c6cb[_0xbc10('0x59')]);}})['then'](respondWithResult(_0x3a6521,null))[_0xbc10('0x29')](handleError(_0x3a6521,null));};exports[_0xbc10('0x65')]=function(_0x467fc1,_0x5487e2,_0x370670){var _0x268eab={'raw':![],'where':{}};var _0x3b244a={};var _0x536578={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0xbc10('0x66')]({'where':{'id':_0x467fc1[_0xbc10('0x54')]['id']}})['then'](handleEntityNotFound(_0x5487e2,null))['then'](function(_0x3a5c59){if(_0x3a5c59){_0x3b244a['model']=_['keys'](db[_0xbc10('0x64')][_0xbc10('0x3d')]);_0x3b244a[_0xbc10('0x42')]=_[_0xbc10('0x56')](_0x467fc1[_0xbc10('0x42')]);_0x3b244a['filters']=_[_0xbc10('0x44')](_0x3b244a[_0xbc10('0x41')],_0x3b244a[_0xbc10('0x42')]);_0x268eab[_0xbc10('0x43')]=_[_0xbc10('0x44')](_0x3b244a[_0xbc10('0x41')],qs[_0xbc10('0x45')](_0x467fc1[_0xbc10('0x42')][_0xbc10('0x45')]));_0x268eab[_0xbc10('0x43')]=_0x268eab[_0xbc10('0x43')][_0xbc10('0x67')]?_0x268eab['attributes']:_0x3b244a[_0xbc10('0x41')];if(!_0x467fc1[_0xbc10('0x42')]['hasOwnProperty']('nolimit')){_0x268eab['limit']=qs[_0xbc10('0x2f')](_0x467fc1[_0xbc10('0x42')]['limit']);_0x268eab[_0xbc10('0x2c')]=qs[_0xbc10('0x2c')](_0x467fc1['query'][_0xbc10('0x2c')]);}_0x268eab['order']=qs[_0xbc10('0x49')](_0x467fc1[_0xbc10('0x42')][_0xbc10('0x49')]);_0x268eab[_0xbc10('0x4a')]=qs[_0xbc10('0x4b')](_[_0xbc10('0x68')](_0x467fc1[_0xbc10('0x42')],_0x3b244a[_0xbc10('0x4b')]));_0x268eab[_0xbc10('0x4a')][_0xbc10('0x69')]=_0x3a5c59['id'];if(_0x467fc1[_0xbc10('0x42')][_0xbc10('0x4c')]){_0x268eab[_0xbc10('0x4a')]=_[_0xbc10('0x4d')](_0x268eab[_0xbc10('0x4a')],{'$or':_[_0xbc10('0x3c')](_0x268eab[_0xbc10('0x43')],function(_0x103c32){var _0x439292={};_0x439292[_0x103c32]={'$like':'%'+_0x467fc1[_0xbc10('0x42')][_0xbc10('0x4c')]+'%'};return _0x439292;})});}_0x268eab=_[_0xbc10('0x4d')]({},_0x268eab,_0x467fc1[_0xbc10('0x4e')]);return db[_0xbc10('0x64')]['count']({'where':_0x268eab[_0xbc10('0x4a')]})[_0xbc10('0x20')](function(_0x3f7b0e){_0x536578['count']=_0x3f7b0e;if(_0x467fc1['query'][_0xbc10('0x50')]){_0x268eab[_0xbc10('0x51')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x268eab);})[_0xbc10('0x20')](function(_0x39ce07){_0x536578['rows']=_0x39ce07;return _0x536578;});}})['then'](respondWithFilteredResult(_0x5487e2,_0x268eab))[_0xbc10('0x29')](handleError(_0x5487e2,null));};exports['removeDispositions']=function(_0x1dc0fd,_0xa647b9,_0x5aae90){return db[_0xbc10('0x4f')]['find']({'where':{'id':_0x1dc0fd[_0xbc10('0x54')]['id']}})['then'](handleEntityNotFound(_0xa647b9,null))[_0xbc10('0x20')](function(_0x218aec){if(_0x218aec){return _0x218aec[_0xbc10('0x6a')](_0x1dc0fd['query']['ids']);}})[_0xbc10('0x20')](respondWithStatusCode(_0xa647b9,null))['catch'](handleError(_0xa647b9,null));};exports['addAnswer']=function(_0xb9c923,_0x4f20b1,_0x719763){if(_0xb9c923[_0xbc10('0x59')]['id']){delete _0xb9c923['body']['id'];}return db[_0xbc10('0x4f')][_0xbc10('0x57')]({'where':{'id':_0xb9c923[_0xbc10('0x54')]['id']}})[_0xbc10('0x20')](handleEntityNotFound(_0x4f20b1,null))['then'](function(_0x789f4b){if(_0x789f4b){_0xb9c923['body'][_0xbc10('0x69')]=_0x789f4b['id'];return db[_0xbc10('0x6b')][_0xbc10('0x58')](_0xb9c923[_0xbc10('0x59')]);}})[_0xbc10('0x20')](respondWithResult(_0x4f20b1,null))[_0xbc10('0x29')](handleError(_0x4f20b1,null));};exports[_0xbc10('0x6c')]=function(_0x280669,_0x51ea13,_0x35cd8d){var _0x8dfe50={'raw':![],'where':{}};var _0xf269e1={};var _0x596d84={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0xbc10('0x66')]({'where':{'id':_0x280669[_0xbc10('0x54')]['id']}})[_0xbc10('0x20')](handleEntityNotFound(_0x51ea13,null))[_0xbc10('0x20')](function(_0x307111){if(_0x307111){_0xf269e1[_0xbc10('0x41')]=_[_0xbc10('0x56')](db[_0xbc10('0x6b')][_0xbc10('0x3d')]);_0xf269e1['query']=_[_0xbc10('0x56')](_0x280669[_0xbc10('0x42')]);_0xf269e1[_0xbc10('0x4b')]=_[_0xbc10('0x44')](_0xf269e1['model'],_0xf269e1['query']);_0x8dfe50[_0xbc10('0x43')]=_['intersection'](_0xf269e1[_0xbc10('0x41')],qs['fields'](_0x280669[_0xbc10('0x42')][_0xbc10('0x45')]));_0x8dfe50[_0xbc10('0x43')]=_0x8dfe50[_0xbc10('0x43')]['length']?_0x8dfe50['attributes']:_0xf269e1[_0xbc10('0x41')];if(!_0x280669[_0xbc10('0x42')][_0xbc10('0x46')]('nolimit')){_0x8dfe50[_0xbc10('0x2f')]=qs['limit'](_0x280669[_0xbc10('0x42')][_0xbc10('0x2f')]);_0x8dfe50['offset']=qs[_0xbc10('0x2c')](_0x280669[_0xbc10('0x42')][_0xbc10('0x2c')]);}_0x8dfe50[_0xbc10('0x48')]=qs[_0xbc10('0x49')](_0x280669[_0xbc10('0x42')][_0xbc10('0x49')]);_0x8dfe50[_0xbc10('0x4a')]=qs['filters'](_[_0xbc10('0x68')](_0x280669['query'],_0xf269e1[_0xbc10('0x4b')]));_0x8dfe50[_0xbc10('0x4a')][_0xbc10('0x69')]=_0x307111['id'];if(_0x280669[_0xbc10('0x42')][_0xbc10('0x4c')]){_0x8dfe50[_0xbc10('0x4a')]=_[_0xbc10('0x4d')](_0x8dfe50['where'],{'$or':_[_0xbc10('0x3c')](_0x8dfe50['attributes'],function(_0x2d34c3){var _0x25a800={};_0x25a800[_0x2d34c3]={'$like':'%'+_0x280669[_0xbc10('0x42')]['filter']+'%'};return _0x25a800;})});}_0x8dfe50=_[_0xbc10('0x4d')]({},_0x8dfe50,_0x280669[_0xbc10('0x4e')]);return db['CannedAnswer'][_0xbc10('0x2e')]({'where':_0x8dfe50[_0xbc10('0x4a')]})[_0xbc10('0x20')](function(_0x108fba){_0x596d84[_0xbc10('0x2e')]=_0x108fba;if(_0x280669[_0xbc10('0x42')][_0xbc10('0x50')]){_0x8dfe50[_0xbc10('0x51')]=[{'all':!![]}];}return db[_0xbc10('0x6b')]['findAll'](_0x8dfe50);})[_0xbc10('0x20')](function(_0x1eeb56){_0x596d84[_0xbc10('0x52')]=_0x1eeb56;return _0x596d84;});}})[_0xbc10('0x20')](respondWithFilteredResult(_0x51ea13,_0x8dfe50))[_0xbc10('0x29')](handleError(_0x51ea13,null));};exports['removeAnswers']=function(_0x2d320b,_0x2f3f21,_0x4c0752){return db[_0xbc10('0x4f')][_0xbc10('0x57')]({'where':{'id':_0x2d320b[_0xbc10('0x54')]['id']}})[_0xbc10('0x20')](handleEntityNotFound(_0x2f3f21,null))[_0xbc10('0x20')](function(_0x4227e4){if(_0x4227e4){return _0x4227e4[_0xbc10('0x6d')](_0x2d320b[_0xbc10('0x42')]['ids']);}})[_0xbc10('0x20')](respondWithStatusCode(_0x2f3f21,null))[_0xbc10('0x29')](handleError(_0x2f3f21,null));};exports[_0xbc10('0x6e')]=function(_0x3bbba0,_0x1b96a1,_0x4ad3a5){return db[_0xbc10('0x4f')][_0xbc10('0x57')]({'where':{'id':_0x3bbba0[_0xbc10('0x54')]['id']}})[_0xbc10('0x20')](handleEntityNotFound(_0x1b96a1,null))[_0xbc10('0x20')](function(_0x1fa80a){if(_0x1fa80a){return _0x1fa80a[_0xbc10('0x6e')](_0x3bbba0[_0xbc10('0x59')]['ids'],_[_0xbc10('0x6f')](_0x3bbba0[_0xbc10('0x59')],[_0xbc10('0x70'),'id'])||{})[_0xbc10('0x71')](function(_0x510ba1){for(var _0x2a4934=0x0;_0x2a4934<_0x3bbba0[_0xbc10('0x59')][_0xbc10('0x70')][_0xbc10('0x67')];_0x2a4934+=0x1){socket[_0xbc10('0x72')](_0xbc10('0x73'),{'UserId':Number(_0x3bbba0[_0xbc10('0x59')][_0xbc10('0x70')][_0x2a4934]),'WhatsappAccountId':Number(_0x3bbba0[_0xbc10('0x54')]['id'])});}return _0x510ba1;});}})[_0xbc10('0x20')](respondWithResult(_0x1b96a1,null))[_0xbc10('0x29')](handleError(_0x1b96a1,null));};exports[_0xbc10('0x74')]=function(_0x3009d8,_0x126e41,_0x26dcc4){return db[_0xbc10('0x4f')][_0xbc10('0x57')]({'where':{'id':_0x3009d8[_0xbc10('0x54')]['id']}})['then'](handleEntityNotFound(_0x126e41,null))[_0xbc10('0x20')](function(_0x4f0b12){if(_0x4f0b12){return _0x4f0b12[_0xbc10('0x74')](_0x3009d8[_0xbc10('0x42')][_0xbc10('0x70')])[_0xbc10('0x20')](function(){if(_['isArray'](_0x3009d8[_0xbc10('0x42')][_0xbc10('0x70')])){for(var _0x136117=0x0;_0x136117<_0x3009d8['query'][_0xbc10('0x70')][_0xbc10('0x67')];_0x136117+=0x1){socket['emit'](_0xbc10('0x75'),{'UserId':Number(_0x3009d8['query'][_0xbc10('0x70')][_0x136117]),'WhatsappAccountId':Number(_0x3009d8['params']['id'])});}}else{socket['emit']('userWhatsappAccount:remove',{'UserId':Number(_0x3009d8[_0xbc10('0x42')][_0xbc10('0x70')]),'WhatsappAccountId':Number(_0x3009d8[_0xbc10('0x54')]['id'])});}});}})[_0xbc10('0x20')](respondWithStatusCode(_0x126e41,null))[_0xbc10('0x29')](handleError(_0x126e41,null));};exports[_0xbc10('0x76')]=function(_0x3c4aec,_0x5c5d3a,_0x28efdb){var _0x7c3098={};var _0x4975c6={};var _0x2323e9;var _0xeda816;return db[_0xbc10('0x4f')][_0xbc10('0x66')]({'where':{'id':_0x3c4aec[_0xbc10('0x54')]['id']}})[_0xbc10('0x20')](handleEntityNotFound(_0x5c5d3a,null))[_0xbc10('0x20')](function(_0x15391b){if(_0x15391b){_0x2323e9=_0x15391b;_0x4975c6['model']=_['keys'](db[_0xbc10('0x77')]['rawAttributes']);_0x4975c6['query']=_['keys'](_0x3c4aec['query']);_0x4975c6['filters']=_[_0xbc10('0x44')](_0x4975c6[_0xbc10('0x41')],_0x4975c6[_0xbc10('0x42')]);_0x7c3098[_0xbc10('0x43')]=_['intersection'](_0x4975c6['model'],qs['fields'](_0x3c4aec['query'][_0xbc10('0x45')]));_0x7c3098[_0xbc10('0x43')]=_0x7c3098[_0xbc10('0x43')]['length']?_0x7c3098[_0xbc10('0x43')]:_0x4975c6[_0xbc10('0x41')];_0x7c3098['order']=qs[_0xbc10('0x49')](_0x3c4aec['query'][_0xbc10('0x49')]);_0x7c3098[_0xbc10('0x4a')]=qs[_0xbc10('0x4b')](_[_0xbc10('0x68')](_0x3c4aec['query'],_0x4975c6['filters']));if(_0x3c4aec[_0xbc10('0x42')]['filter']){_0x7c3098[_0xbc10('0x4a')]=_['merge'](_0x7c3098['where'],{'$or':_['map'](_0x7c3098[_0xbc10('0x43')],function(_0x5d1b3e){var _0x1d7182={};_0x1d7182[_0x5d1b3e]={'$like':'%'+_0x3c4aec[_0xbc10('0x42')]['filter']+'%'};return _0x1d7182;})});}_0x7c3098=_[_0xbc10('0x4d')]({},_0x7c3098,_0x3c4aec[_0xbc10('0x4e')]);return _0x2323e9['getAgents'](_0x7c3098);}})[_0xbc10('0x20')](function(_0x5d50be){if(_0x5d50be){_0xeda816=_0x5d50be[_0xbc10('0x67')];if(!_0x3c4aec[_0xbc10('0x42')][_0xbc10('0x46')](_0xbc10('0x47'))){_0x7c3098['limit']=qs['limit'](_0x3c4aec[_0xbc10('0x42')][_0xbc10('0x2f')]);_0x7c3098[_0xbc10('0x2c')]=qs[_0xbc10('0x2c')](_0x3c4aec[_0xbc10('0x42')][_0xbc10('0x2c')]);}return _0x2323e9[_0xbc10('0x76')](_0x7c3098);}})[_0xbc10('0x20')](function(_0x3e556d){if(_0x3e556d){return _0x3e556d?{'count':_0xeda816,'rows':_0x3e556d}:null;}})[_0xbc10('0x20')](respondWithResult(_0x5c5d3a,null))[_0xbc10('0x29')](handleError(_0x5c5d3a,null));};exports['addApplications']=function(_0x1da3d8,_0x143052){var _0x241f59=_0x1da3d8[_0xbc10('0x54')]['id'];var _0x19326d=_0x1da3d8[_0xbc10('0x59')];var _0x6bcc56=0xc8;var _0x2e4b5d=null;return db[_0xbc10('0x78')][_0xbc10('0x79')]({'isolationLevel':db['sequelize'][_0xbc10('0x7a')][_0xbc10('0x7b')]['READ_COMMITTED']},function(_0x5e3b34){return db[_0xbc10('0x4f')][_0xbc10('0x66')]({'where':{'id':_0x241f59},'transaction':_0x5e3b34})[_0xbc10('0x20')](function(_0x160162){if(_0x160162){return db[_0xbc10('0x7c')][_0xbc10('0x35')]({'where':{'WhatsappAccountId':_0x241f59},'transaction':_0x5e3b34})[_0xbc10('0x20')](function(){var _0x5c0f22=_[_0xbc10('0x3c')](_0x19326d,function(_0x27109e){_0x27109e['WhatsappAccountId']=_0x241f59;return _0x27109e;});return db[_0xbc10('0x7c')][_0xbc10('0x7d')](_0x5c0f22,{'transaction':_0x5e3b34});});}else{_0x6bcc56=0x194;_0x2e4b5d=[];}});})[_0xbc10('0x20')](function(){if(_0x6bcc56!==0x194){return db[_0xbc10('0x7c')][_0xbc10('0x7e')]({'where':{'WhatsappAccountId':_0x241f59},'order':_0xbc10('0x7f')})[_0xbc10('0x20')](function(_0x3623ca){_0x2e4b5d=_0x3623ca;});}})[_0xbc10('0x29')](function(_0x2db9bf){_0x6bcc56=0x1f4;logger[_0xbc10('0x26')](_0x2db9bf['stack']);if(_0x2db9bf[_0xbc10('0x39')]){delete _0x2db9bf[_0xbc10('0x39')];}_0x2e4b5d=_0x2db9bf;})['finally'](function(){if(_0x2e4b5d===null){_0x143052[_0xbc10('0x2a')](_0x6bcc56);}else{if(_0x6bcc56===0x1f4){_0x143052[_0xbc10('0x2b')](_0x6bcc56)[_0xbc10('0x3a')](_0x2e4b5d);}else{_0x143052['status'](_0x6bcc56)[_0xbc10('0x80')](_0x2e4b5d);}}});};exports['getApplications']=function(_0x4fe45c,_0x52a151,_0x4096f6){var _0x2012a0={};var _0x256fe8={};var _0x32b189;var _0x433ca1;return db[_0xbc10('0x4f')][_0xbc10('0x66')]({'where':{'id':_0x4fe45c['params']['id']}})[_0xbc10('0x20')](handleEntityNotFound(_0x52a151,null))['then'](function(_0x298fad){if(_0x298fad){_0x32b189=_0x298fad;_0x256fe8[_0xbc10('0x41')]=_[_0xbc10('0x56')](db[_0xbc10('0x7c')][_0xbc10('0x3d')]);_0x256fe8[_0xbc10('0x42')]=_[_0xbc10('0x56')](_0x4fe45c[_0xbc10('0x42')]);_0x256fe8[_0xbc10('0x4b')]=_[_0xbc10('0x44')](_0x256fe8[_0xbc10('0x41')],_0x256fe8[_0xbc10('0x42')]);_0x2012a0['attributes']=_[_0xbc10('0x44')](_0x256fe8[_0xbc10('0x41')],qs['fields'](_0x4fe45c[_0xbc10('0x42')][_0xbc10('0x45')]));_0x2012a0[_0xbc10('0x43')]=_0x2012a0['attributes'][_0xbc10('0x67')]?_0x2012a0[_0xbc10('0x43')]:_0x256fe8[_0xbc10('0x41')];_0x2012a0[_0xbc10('0x48')]=qs[_0xbc10('0x49')](_0x4fe45c['query'][_0xbc10('0x49')]);_0x2012a0[_0xbc10('0x4a')]=qs['filters'](_['pick'](_0x4fe45c[_0xbc10('0x42')],_0x256fe8[_0xbc10('0x4b')]));if(_0x4fe45c[_0xbc10('0x42')]['filter']){_0x2012a0[_0xbc10('0x4a')]=_[_0xbc10('0x4d')](_0x2012a0[_0xbc10('0x4a')],{'$or':_[_0xbc10('0x3c')](_0x2012a0[_0xbc10('0x43')],function(_0x3a66f9){var _0x3019c2={};_0x3019c2[_0x3a66f9]={'$like':'%'+_0x4fe45c['query'][_0xbc10('0x4c')]+'%'};return _0x3019c2;})});}_0x2012a0=_[_0xbc10('0x4d')]({},_0x2012a0,_0x4fe45c[_0xbc10('0x4e')]);return _0x32b189[_0xbc10('0x81')](_0x2012a0);}})[_0xbc10('0x20')](function(_0x308517){if(_0x308517){_0x433ca1=_0x308517[_0xbc10('0x67')];if(!_0x4fe45c[_0xbc10('0x42')]['hasOwnProperty'](_0xbc10('0x47'))){_0x2012a0['limit']=qs[_0xbc10('0x2f')](_0x4fe45c['query'][_0xbc10('0x2f')]);_0x2012a0[_0xbc10('0x2c')]=qs[_0xbc10('0x2c')](_0x4fe45c['query']['offset']);}return _0x32b189[_0xbc10('0x81')](_0x2012a0);}})['then'](function(_0x5ab3dc){if(_0x5ab3dc){return _0x5ab3dc?{'count':_0x433ca1,'rows':_0x5ab3dc}:null;}})[_0xbc10('0x20')](respondWithResult(_0x52a151,null))[_0xbc10('0x29')](handleError(_0x52a151,null));};exports[_0xbc10('0x82')]=function(_0x1ed651,_0x2f12dd,_0x376fca){var _0x4c7aa5={'channel':_0xbc10('0x83')};var _0x3a8813=[];var _0x12f747=[];var _0x4880c3={};return db[_0xbc10('0x4f')][_0xbc10('0x57')]({'where':{'id':_0x1ed651['params']['id']},'include':[{'model':db[_0xbc10('0x7c')],'as':_0xbc10('0x84')}]})[_0xbc10('0x20')](handleEntityNotFound(_0x2f12dd,null))[_0xbc10('0x20')](function(_0x3a752e){_0x4c7aa5[_0xbc10('0x85')]=_0x3a752e;if(_0x4c7aa5[_0xbc10('0x85')]&&_0x4c7aa5[_0xbc10('0x85')][_0xbc10('0x3f')]===_0xbc10('0x86')&&_0x1ed651[_0xbc10('0x59')]['statuses']){if(_0x1ed651['body'][_0xbc10('0x87')][_0xbc10('0x67')]===0x0)return;if(_0x1ed651[_0xbc10('0x59')][_0xbc10('0x87')][0x0][_0xbc10('0x88')]!==_0xbc10('0x89'))return;return db[_0xbc10('0x8a')]['update']({'read':!![],'readAt':_0x1ed651['body'][_0xbc10('0x87')][0x0][_0xbc10('0x8b')]},{'where':{'messageId':_0x1ed651['body'][_0xbc10('0x87')][0x0][_0xbc10('0x8c')]},'individualHooks':!![]})[_0xbc10('0x20')](function(_0x15b938){return _0x2f12dd[_0xbc10('0x2b')](0xc8)[_0xbc10('0x80')](_0x15b938);});}_0x4c7aa5['applications']=_['orderBy'](_0x3a752e[_0xbc10('0x84')],[_0xbc10('0x7f')],['asc']);if(_0x4c7aa5['account'][_0xbc10('0x84')]){delete _0x4c7aa5['account']['Applications'];}return db[_0xbc10('0x8d')][_0xbc10('0x62')]()[_0xbc10('0x20')](function(_0x452b4b){if(!_0x452b4b){throw new db[(_0xbc10('0x8e'))][(_0xbc10('0x8f'))](_0xbc10('0x90'));}_0x3a8813=_['difference'](_[_0xbc10('0x56')](_0x452b4b),['createdAt',_0xbc10('0x91')]);_0x12f747=_[_0xbc10('0x92')](_[_0xbc10('0x56')](_0x452b4b),['createdAt',_0xbc10('0x91'),_0xbc10('0x93'),_0xbc10('0x94')]);_0x4c7aa5['body']={'mapKey':_0xbc10('0x95')};if(_0x4c7aa5[_0xbc10('0x85')]&&_0x4c7aa5['account'][_0xbc10('0x3f')]==='twilio'){_0x4c7aa5[_0xbc10('0x59')][_0xbc10('0x96')]=_0x1ed651['body']['From'][_0xbc10('0x97')](_0xbc10('0x98'),'');_0x4c7aa5[_0xbc10('0x59')][_0xbc10('0x59')]=_0x1ed651[_0xbc10('0x59')][_0xbc10('0x99')];_0x4c7aa5['body'][_0xbc10('0x9a')]=_0x1ed651['body'][_0xbc10('0x9b')];}if(_0x4c7aa5[_0xbc10('0x85')]&&_0x4c7aa5[_0xbc10('0x85')][_0xbc10('0x3f')]===_0xbc10('0x86')){_0x4c7aa5['body'][_0xbc10('0x96')]=_0x1ed651['body'][_0xbc10('0x9c')][0x0]['from'];_0x4c7aa5['body'][_0xbc10('0x59')]=_0x1ed651['body'][_0xbc10('0x9c')][0x0]['message'][_0xbc10('0x59')];_0x4c7aa5[_0xbc10('0x59')][_0xbc10('0x9a')]=_0x1ed651[_0xbc10('0x59')]['notifications'][0x0]['message_id'];}if(_0x4c7aa5[_0xbc10('0x59')]['id']){delete _0x4c7aa5[_0xbc10('0x59')]['id'];}if(_[_0xbc10('0x9d')](_0x4c7aa5['body']['from'])){throw new db[(_0xbc10('0x8e'))][(_0xbc10('0x8f'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x4c7aa5['body'][_0xbc10('0x59')])||_0x4c7aa5['body'][_0xbc10('0x59')]===''){throw new db[(_0xbc10('0x8e'))][(_0xbc10('0x8f'))](_0xbc10('0x9e'));}if(_[_0xbc10('0x9d')](_0x4c7aa5[_0xbc10('0x59')][_0xbc10('0x9f')])){throw new db[(_0xbc10('0x8e'))][(_0xbc10('0x8f'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x12f747);}if(!_['includes'](_0x12f747,_0x4c7aa5['body'][_0xbc10('0x9f')])){throw new db['Sequelize'][(_0xbc10('0x8f'))](_0xbc10('0xa0')+_0x12f747);}_0x4880c3[_0x4c7aa5[_0xbc10('0x59')][_0xbc10('0x9f')]]=_0x4c7aa5[_0xbc10('0x59')]['from'];return db[_0xbc10('0xa1')][_0xbc10('0x57')]({'where':{'id':_0x4c7aa5[_0xbc10('0x85')][_0xbc10('0x94')]},'include':[{'model':db[_0xbc10('0x8d')],'as':_0xbc10('0xa2'),'where':_0x4880c3,'limit':0x1,'order':[[_0xbc10('0x91'),_0xbc10('0xa3')]]}]});})[_0xbc10('0x20')](handleEntityNotFound(_0x2f12dd,null))[_0xbc10('0x20')](function(_0x522f54){if(_0x522f54){_0x4c7aa5['list']=_[_0xbc10('0x6f')](_0x522f54,[_0xbc10('0xa2')]);if(_0x522f54[_0xbc10('0xa2')][_0xbc10('0x67')]){return _0x522f54[_0xbc10('0xa2')][0x0];}var _0x33d5b5=_[_0xbc10('0xa4')](_0x4c7aa5[_0xbc10('0x59')],{'firstName':_0x4c7aa5[_0xbc10('0x59')][_0xbc10('0x96')],'ListId':_0x522f54['id']});_0x33d5b5[_0x4c7aa5['body'][_0xbc10('0x9f')]]=_0x4c7aa5['body'][_0xbc10('0x96')];return db[_0xbc10('0x8d')]['create'](_0x33d5b5,{'fields':_0x3a8813,'raw':!![]});}})[_0xbc10('0x20')](handleEntityNotFound(_0x2f12dd,null))[_0xbc10('0x20')](function(_0x3e64f6){if(_0x3e64f6){_0x4c7aa5[_0xbc10('0xa5')]=_0x3e64f6;var _0x3c0fe9={'ContactId':_0x3e64f6['id'],'phone':_0x4c7aa5[_0xbc10('0x59')]['from'],'WhatsappAccountId':_0x1ed651['params']['id']};var _0x23949e={'ContactId':_0x3e64f6['id'],'WhatsappAccountId':_0x1ed651['params']['id'],'closed':![]};return db[_0xbc10('0xa6')][_0xbc10('0x57')]({'where':_0x23949e})[_0xbc10('0x20')](function(_0xb7b538){if(_0xb7b538){return[_0xb7b538,![]];}return db[_0xbc10('0xa6')][_0xbc10('0x58')](_0x3c0fe9)[_0xbc10('0x20')](function(_0x1ff3e3){return[_0x1ff3e3,!![]];});});}})[_0xbc10('0x71')](function(_0x246ded,_0x286419){_0x4c7aa5[_0xbc10('0xa7')]=_0x246ded[_0xbc10('0x5b')]({'plain':!![]});_0x4c7aa5['interaction'][_0xbc10('0xa8')]=![];if(_0x286419){if(_0x4c7aa5['account'][_0xbc10('0xa9')]){_0x4c7aa5[_0xbc10('0xaa')][_0xbc10('0xab')]({'id':0x0,'priority':_0x4c7aa5[_0xbc10('0xaa')][_0xbc10('0x67')]+0x1,'app':_0xbc10('0xac'),'appdata':_0xbc10('0xad'),'interval':'*,*,*,*'});}_0x4c7aa5[_0xbc10('0xa7')][_0xbc10('0xa8')]=!![];}return db[_0xbc10('0x8a')][_0xbc10('0x58')]({'phone':_0x4c7aa5[_0xbc10('0x59')][_0xbc10('0x96')],'messageId':_0x4c7aa5[_0xbc10('0x59')]['messageId'],'body':_0x4c7aa5['body'][_0xbc10('0x59')],'WhatsappAccountId':_0x1ed651['params']['id'],'WhatsappInteractionId':_0x246ded['id'],'direction':'in','ContactId':_0x246ded[_0xbc10('0xae')],'AttachmentId':_0x4c7aa5['body'][_0xbc10('0xaf')]});})[_0xbc10('0x20')](function(_0x2f161e){_0x4c7aa5[_0xbc10('0x27')]=_0x2f161e;if(_0x4c7aa5[_0xbc10('0xa7')][_0xbc10('0xb0')]){return db[_0xbc10('0x77')][_0xbc10('0x57')]({'attributes':['id',_0xbc10('0x39')],'where':{'id':_0x4c7aa5[_0xbc10('0xa7')][_0xbc10('0xb0')]}})['then'](function(_0x222d43){if(_0x222d43){_0x4c7aa5[_0xbc10('0xaa')][_0xbc10('0xb1')]({'id':0x0,'priority':0x0,'app':_0xbc10('0xb2'),'appdata':_0x222d43[_0xbc10('0x39')]+','+(_0x4c7aa5[_0xbc10('0x85')][_0xbc10('0xb3')]||0xa),'interval':_0xbc10('0xb4')});}return respondWithRpcPromise('Start',_0xbc10('0xb5'),_0x4c7aa5);});}return respondWithRpcPromise(_0xbc10('0xb6'),_0xbc10('0xb5'),_0x4c7aa5);})[_0xbc10('0x20')](function(_0x4854d2){if(_0x4854d2){var _0x3935a1=0xc8;var _0x46ec0e=_0xbc10('0xb7');logger[_0xbc10('0x21')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x46ec0e,_0x3935a1,'entity\x20found');logger['debug'](_0xbc10('0xb8'),_0x46ec0e,_0x3935a1,'entity\x20found',JSON[_0xbc10('0x25')](_0x4854d2));if(_0x4c7aa5['account'][_0xbc10('0x3f')]===_0xbc10('0xb9')){return _0x2f12dd[_0xbc10('0x2b')](_0x3935a1)[_0xbc10('0x30')](_0xbc10('0xba'),_0xbc10('0xbb'))[_0xbc10('0x3a')](_0xbc10('0xbc'));}else{return _0x2f12dd[_0xbc10('0x2b')](_0x3935a1)[_0xbc10('0x80')](_0x4854d2);}}});})[_0xbc10('0x29')](handleError(_0x2f12dd,null));};exports[_0xbc10('0x3a')]=function(_0x3092d2,_0xbd061,_0x3f72c6){var _0x253a20,_0xc4b3a4,_0x4aebae;if(_['isNil'](_0x3092d2[_0xbc10('0x59')][_0xbc10('0x59')])||_0x3092d2['body'][_0xbc10('0x59')]===''){throw new db[(_0xbc10('0x8e'))][(_0xbc10('0x8f'))](_0xbc10('0x9e'));}if(_['isNil'](_0x3092d2[_0xbc10('0x59')]['to'])){throw new db[(_0xbc10('0x8e'))]['ValidationError'](_0xbc10('0xbd'));}_0x253a20=_0x3092d2['body']['to'];return db['WhatsappAccount'][_0xbc10('0x57')]({'where':{'id':_0x3092d2['params']['id']},'include':[{'model':db[_0xbc10('0xa1')],'as':_0xbc10('0xbe'),'include':[{'model':db[_0xbc10('0x8d')],'as':_0xbc10('0xa2'),'where':{'mobile':_0x253a20},'limit':0x1,'order':[[_0xbc10('0x91'),_0xbc10('0xa3')]]}]}]})[_0xbc10('0x20')](handleEntityNotFound(_0xbd061,null))[_0xbc10('0x20')](function(_0x167f53){if(_0x167f53&&_0x167f53[_0xbc10('0xbe')]){_0xc4b3a4=_0x167f53[_0xbc10('0x5b')]({'plain':!![]});if(_0xc4b3a4['List']&&_0xc4b3a4[_0xbc10('0xbe')][_0xbc10('0xa2')]['length']){return _0xc4b3a4[_0xbc10('0xbe')][_0xbc10('0xa2')][0x0];}return db[_0xbc10('0x8d')][_0xbc10('0x58')](_['defaults'](_0x3092d2[_0xbc10('0x59')],{'firstName':_0x253a20,'mobile':_0x253a20,'phone':_0x253a20,'ListId':_0xc4b3a4[_0xbc10('0x94')]}));}})[_0xbc10('0x20')](handleEntityNotFound(_0xbd061,null))[_0xbc10('0x20')](function(_0x2051f3){if(_0x2051f3){_0x4aebae=_0x2051f3;return db[_0xbc10('0xa6')]['find']({'where':{'ContactId':_0x4aebae['id'],'closed':![],'WhatsappAccountId':_0xc4b3a4['id']}})[_0xbc10('0x20')](function(_0x409bb4){if(_0x409bb4){return[_0x409bb4,![]];}return db[_0xbc10('0xa6')][_0xbc10('0x58')]({'UserId':_0x3092d2[_0xbc10('0x5a')]['id'],'ContactId':_0x4aebae['id'],'WhatsappAccountId':_0xc4b3a4['id'],'phone':_0x253a20,'firstMsgDirection':_0xbc10('0xbf'),'Messages':[_[_0xbc10('0x4d')](_0x3092d2[_0xbc10('0x59')],{'read':![],'body':_0x3092d2['body']['body'],'phone':_0x253a20,'WhatsappAccountId':_0xc4b3a4['id'],'UserId':_0x3092d2[_0xbc10('0x5a')]['id'],'ContactId':_0x4aebae['id']})]},{'include':[{'model':db[_0xbc10('0x8a')],'as':_0xbc10('0xc0')}]})[_0xbc10('0x20')](function(_0x17a1e5){return[_0x17a1e5,!![]];});});}})[_0xbc10('0x71')](function(_0x11418a,_0x4a7b3c){if(_0x4a7b3c){return _0x11418a;}return db[_0xbc10('0x8a')]['create'](_['merge'](_0x3092d2[_0xbc10('0x59')],{'read':![],'body':_0x3092d2[_0xbc10('0x59')][_0xbc10('0x59')],'phone':_0x253a20,'WhatsappAccountId':_0xc4b3a4['id'],'WhatsappInteractionId':_0x11418a['id'],'UserId':_0x3092d2[_0xbc10('0x5a')]['id'],'ContactId':_0x4aebae['id']}))[_0xbc10('0x20')](function(_0x1d1e0d){_0x11418a[_0xbc10('0xc1')]['Messages']=[];_0x11418a['dataValues'][_0xbc10('0xc0')]['push'](_0x1d1e0d[_0xbc10('0xc1')]);return _0x11418a;});})[_0xbc10('0x20')](respondWithResult(_0xbd061,null))[_0xbc10('0x29')](handleError(_0xbd061,null));}; \ No newline at end of file +var _0xeea0=['debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','get','WhatsappAccounts','UserProfileResource','name','send','index','Pause','mandatoryDispositionPause','map','WhatsappAccount','fieldName','key','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','order','where','pick','filter','merge','type','VIRTUAL','options','include','rows','params','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','findOne','rawAttributes','nolimit','sort','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','length','addAgents','omit','spread','emit','removeAgents','userWhatsappAccount:remove','getAgents','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','findAndCountAll','stack','finally','getApplications','notify','whatsapp','account','sinch','statuses','state','read','timestamp','orderBy','priority','Applications','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','from','From','replace','whatsapp:','Body','messageId','MessageSid','notifications','message_id','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','ListId','Contacts','WhatsappInteraction','interaction','created','autoclose','push','applications','close','*,*,*,*','WhatsappMessage','ContactId','AttachmentId','UserId','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','info','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','twilio','Content-Type','text/xml','\x0a','to\x20is\x20mandatory','CmList','List','DESC','out','Messages','dataValues','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','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','http','request','then','WhatsappAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x2302f0,_0x1afef2){var _0x23db84=function(_0x6ad1be){while(--_0x6ad1be){_0x2302f0['push'](_0x2302f0['shift']());}};_0x23db84(++_0x1afef2);}(_0xeea0,0x16f));var _0x0eea=function(_0x53fc64,_0x55e067){_0x53fc64=_0x53fc64-0x0;var _0x21c1e7=_0xeea0[_0x53fc64];return _0x21c1e7;};'use strict';var emlformat=require(_0x0eea('0x0'));var rimraf=require(_0x0eea('0x1'));var zipdir=require(_0x0eea('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0eea('0x3'));var moment=require(_0x0eea('0x4'));var BPromise=require(_0x0eea('0x5'));var Mustache=require(_0x0eea('0x6'));var util=require(_0x0eea('0x7'));var path=require(_0x0eea('0x8'));var sox=require(_0x0eea('0x9'));var csv=require(_0x0eea('0xa'));var ejs=require(_0x0eea('0xb'));var fs=require('fs');var fs_extra=require(_0x0eea('0xc'));var _=require(_0x0eea('0xd'));var squel=require(_0x0eea('0xe'));var crypto=require(_0x0eea('0xf'));var jsforce=require(_0x0eea('0x10'));var deskjs=require(_0x0eea('0x11'));var toCsv=require(_0x0eea('0xa'));var querystring=require(_0x0eea('0x12'));var Papa=require('papaparse');var Redis=require(_0x0eea('0x13'));var authService=require(_0x0eea('0x14'));var qs=require(_0x0eea('0x15'));var as=require(_0x0eea('0x16'));var hardwareService=require(_0x0eea('0x17'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x0eea('0x18'));var licenseUtil=require(_0x0eea('0x19'));var db=require(_0x0eea('0x1a'))['db'];config['redis']=_[_0x0eea('0x1b')](config[_0x0eea('0x1c')],{'host':_0x0eea('0x1d'),'port':0x18eb});var socket=require(_0x0eea('0x1e'))(new Redis(config[_0x0eea('0x1c')]));require(_0x0eea('0x1f'))[_0x0eea('0x20')](socket);var jayson=require(_0x0eea('0x21'));var client=jayson['client'][_0x0eea('0x22')]({'port':0x232c});function respondWithRpcPromise(_0x10dd77,_0x225aeb,_0x4e2f60,_0x439e98){return new BPromise(function(_0x291aa1,_0x901d54){var _0x13e263=_0x439e98||client;return _0x13e263[_0x0eea('0x23')](_0x10dd77,_0x4e2f60)[_0x0eea('0x24')](function(_0x120b42){logger['info'](_0x0eea('0x25'),_0x225aeb,_0x0eea('0x26'));logger[_0x0eea('0x27')](_0x0eea('0x28'),_0x225aeb,'request\x20sent',JSON[_0x0eea('0x29')](_0x120b42));if(_0x120b42[_0x0eea('0x2a')]){if(_0x120b42[_0x0eea('0x2a')][_0x0eea('0x2b')]===0x1f4){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x225aeb,_0x120b42[_0x0eea('0x2a')]['message']);return _0x901d54(_0x120b42[_0x0eea('0x2a')][_0x0eea('0x2c')]);}logger[_0x0eea('0x2a')](_0x0eea('0x25'),_0x225aeb,_0x120b42['error']['message']);return _0x291aa1(_0x120b42[_0x0eea('0x2a')][_0x0eea('0x2c')]);}else{logger['info'](_0x0eea('0x25'),_0x225aeb,_0x0eea('0x26'));_0x291aa1(_0x120b42[_0x0eea('0x2d')]['message']);}})[_0x0eea('0x2e')](function(_0x55350c){logger[_0x0eea('0x2a')]('WhatsappAccount,\x20%s,\x20%s',_0x225aeb,_0x55350c);_0x901d54(_0x55350c);});});}function respondWithStatusCode(_0x1db7a8,_0x139c39){_0x139c39=_0x139c39||0xcc;return function(_0x5501ff){if(_0x5501ff){return _0x1db7a8[_0x0eea('0x2f')](_0x139c39);}return _0x1db7a8[_0x0eea('0x30')](_0x139c39)[_0x0eea('0x31')]();};}function respondWithResult(_0x47eb95,_0x1c19a7){_0x1c19a7=_0x1c19a7||0xc8;return function(_0x539317){if(_0x539317){return _0x47eb95[_0x0eea('0x30')](_0x1c19a7)[_0x0eea('0x32')](_0x539317);}};}function respondWithFilteredResult(_0x2dc032,_0x5ec7af){return function(_0x3c6df7){if(_0x3c6df7){var _0x4b7083=typeof _0x5ec7af[_0x0eea('0x33')]===_0x0eea('0x34')&&typeof _0x5ec7af[_0x0eea('0x35')]===_0x0eea('0x34');var _0x34beda=_0x3c6df7[_0x0eea('0x36')];var _0x531f32=_0x4b7083?0x0:_0x5ec7af[_0x0eea('0x33')];var _0x34272a=_0x4b7083?_0x3c6df7[_0x0eea('0x36')]:_0x5ec7af[_0x0eea('0x33')]+_0x5ec7af[_0x0eea('0x35')];var _0x12225d;if(_0x34272a>=_0x34beda){_0x34272a=_0x34beda;_0x12225d=0xc8;}else{_0x12225d=0xce;}_0x2dc032[_0x0eea('0x30')](_0x12225d);return _0x2dc032['set'](_0x0eea('0x37'),_0x531f32+'-'+_0x34272a+'/'+_0x34beda)['json'](_0x3c6df7);}return null;};}function patchUpdates(_0xd007b8){return function(_0x11a849){try{jsonpatch[_0x0eea('0x38')](_0x11a849,_0xd007b8,!![]);}catch(_0x35c27f){return BPromise[_0x0eea('0x39')](_0x35c27f);}return _0x11a849[_0x0eea('0x3a')]();};}function saveUpdates(_0x984dd5,_0x3a5353){return function(_0x185504){if(_0x185504){return _0x185504[_0x0eea('0x3b')](_0x984dd5)['then'](function(_0x5cdd1d){return _0x5cdd1d;});}return null;};}function removeEntity(_0x1fbf55,_0x47bc2c){return function(_0x21ca1b){if(_0x21ca1b){return _0x21ca1b[_0x0eea('0x3c')]()[_0x0eea('0x24')](function(){var _0x5a9f68=_0x21ca1b[_0x0eea('0x3d')]({'plain':!![]});var _0x51999e=_0x0eea('0x3e');return db[_0x0eea('0x3f')]['destroy']({'where':{'type':_0x51999e,'resourceId':_0x5a9f68['id']}})['then'](function(){return _0x21ca1b;});})[_0x0eea('0x24')](function(){_0x1fbf55[_0x0eea('0x30')](0xcc)[_0x0eea('0x31')]();});}};}function handleEntityNotFound(_0x4a7b82,_0x17d60a){return function(_0x36b88e){if(!_0x36b88e){_0x4a7b82[_0x0eea('0x2f')](0x194);}return _0x36b88e;};}function handleError(_0x481662,_0x38ffe6){_0x38ffe6=_0x38ffe6||0x1f4;return function(_0x3974a8){logger[_0x0eea('0x2a')](_0x3974a8['stack']);if(_0x3974a8[_0x0eea('0x40')]){delete _0x3974a8[_0x0eea('0x40')];}_0x481662[_0x0eea('0x30')](_0x38ffe6)[_0x0eea('0x41')](_0x3974a8);};}exports[_0x0eea('0x42')]=function(_0x3d89c3,_0x10c99f){var _0xce5784={'include':[{'model':db[_0x0eea('0x43')],'as':_0x0eea('0x44')}]},_0x1a4e59={},_0x5886cc={'count':0x0,'rows':[]};var _0xd5b3bf=_[_0x0eea('0x45')](db[_0x0eea('0x46')]['rawAttributes'],function(_0x2f7492){return{'name':_0x2f7492[_0x0eea('0x47')],'type':_0x2f7492['type'][_0x0eea('0x48')]};});_0x1a4e59['model']=_['map'](_0xd5b3bf,_0x0eea('0x40'));_0x1a4e59[_0x0eea('0x49')]=_[_0x0eea('0x4a')](_0x3d89c3['query']);_0x1a4e59[_0x0eea('0x4b')]=_[_0x0eea('0x4c')](_0x1a4e59[_0x0eea('0x4d')],_0x1a4e59[_0x0eea('0x49')]);_0xce5784['attributes']=_[_0x0eea('0x4c')](_0x1a4e59[_0x0eea('0x4d')],qs[_0x0eea('0x4e')](_0x3d89c3[_0x0eea('0x49')][_0x0eea('0x4e')]));_0xce5784['attributes']=_0xce5784['attributes']['length']?_0xce5784[_0x0eea('0x4f')]:_0x1a4e59[_0x0eea('0x4d')];if(!_0x3d89c3[_0x0eea('0x49')][_0x0eea('0x50')]('nolimit')){_0xce5784['limit']=qs[_0x0eea('0x35')](_0x3d89c3[_0x0eea('0x49')][_0x0eea('0x35')]);_0xce5784[_0x0eea('0x33')]=qs[_0x0eea('0x33')](_0x3d89c3[_0x0eea('0x49')][_0x0eea('0x33')]);}_0xce5784[_0x0eea('0x51')]=qs['sort'](_0x3d89c3[_0x0eea('0x49')]['sort']);_0xce5784[_0x0eea('0x52')]=qs[_0x0eea('0x4b')](_[_0x0eea('0x53')](_0x3d89c3['query'],_0x1a4e59[_0x0eea('0x4b')]),_0xd5b3bf);if(_0x3d89c3['query'][_0x0eea('0x54')]){_0xce5784[_0x0eea('0x52')]=_[_0x0eea('0x55')](_0xce5784[_0x0eea('0x52')],{'$or':_[_0x0eea('0x45')](_0xd5b3bf,function(_0x12fe28){if(_0x12fe28[_0x0eea('0x56')]!==_0x0eea('0x57')){var _0x595134={};_0x595134[_0x12fe28[_0x0eea('0x40')]]={'$like':'%'+_0x3d89c3[_0x0eea('0x49')][_0x0eea('0x54')]+'%'};return _0x595134;}})});}_0xce5784=_['merge']({},_0xce5784,_0x3d89c3[_0x0eea('0x58')]);var _0x2cae99={'where':_0xce5784[_0x0eea('0x52')]};return db[_0x0eea('0x46')]['count'](_0x2cae99)[_0x0eea('0x24')](function(_0x1d3d59){_0x5886cc[_0x0eea('0x36')]=_0x1d3d59;if(_0x3d89c3[_0x0eea('0x49')]['includeAll']){_0xce5784[_0x0eea('0x59')]=[{'all':!![]}];}return db[_0x0eea('0x46')]['findAll'](_0xce5784);})[_0x0eea('0x24')](function(_0x3ef5d4){_0x5886cc[_0x0eea('0x5a')]=_0x3ef5d4;return _0x5886cc;})[_0x0eea('0x24')](respondWithFilteredResult(_0x10c99f,_0xce5784))[_0x0eea('0x2e')](handleError(_0x10c99f,null));};exports['show']=function(_0x3c09cf,_0x135ce2){var _0x2a18c6={'raw':![],'where':{'id':_0x3c09cf[_0x0eea('0x5b')]['id']},'include':[{'model':db[_0x0eea('0x43')],'as':_0x0eea('0x44')}]},_0x49fa81={};_0x49fa81['model']=_[_0x0eea('0x4a')](db[_0x0eea('0x46')]['rawAttributes']);_0x49fa81['query']=_[_0x0eea('0x4a')](_0x3c09cf[_0x0eea('0x49')]);_0x49fa81[_0x0eea('0x4b')]=_[_0x0eea('0x4c')](_0x49fa81[_0x0eea('0x4d')],_0x49fa81[_0x0eea('0x49')]);_0x2a18c6[_0x0eea('0x4f')]=_[_0x0eea('0x4c')](_0x49fa81[_0x0eea('0x4d')],qs['fields'](_0x3c09cf['query'][_0x0eea('0x4e')]));_0x2a18c6[_0x0eea('0x4f')]=_0x2a18c6['attributes']['length']?_0x2a18c6[_0x0eea('0x4f')]:_0x49fa81[_0x0eea('0x4d')];if(_0x3c09cf['query'][_0x0eea('0x5c')]){_0x2a18c6[_0x0eea('0x59')]=[{'all':!![]}];}_0x2a18c6=_['merge']({},_0x2a18c6,_0x3c09cf[_0x0eea('0x58')]);return db[_0x0eea('0x46')][_0x0eea('0x5d')](_0x2a18c6)[_0x0eea('0x24')](handleEntityNotFound(_0x135ce2,null))['then'](respondWithResult(_0x135ce2,null))['catch'](handleError(_0x135ce2,null));};exports[_0x0eea('0x5e')]=function(_0x1966b8,_0x43b489){return db['WhatsappAccount'][_0x0eea('0x5e')](_0x1966b8[_0x0eea('0x5f')],{})['then'](function(_0x4c3323){var _0x334b62=_0x1966b8[_0x0eea('0x60')][_0x0eea('0x3d')]({'plain':!![]});if(!_0x334b62)throw new Error(_0x0eea('0x61'));if(_0x334b62[_0x0eea('0x62')]==='user'){var _0x44bd20=_0x4c3323[_0x0eea('0x3d')]({'plain':!![]});var _0x167fa2='WhatsappAccounts';return db[_0x0eea('0x63')][_0x0eea('0x5d')]({'where':{'name':_0x167fa2,'userProfileId':_0x334b62['userProfileId']},'raw':!![]})['then'](function(_0x521db4){if(_0x521db4&&_0x521db4[_0x0eea('0x64')]===0x0){return db[_0x0eea('0x3f')][_0x0eea('0x5e')]({'name':_0x44bd20[_0x0eea('0x40')],'resourceId':_0x44bd20['id'],'type':_0x521db4[_0x0eea('0x40')],'sectionId':_0x521db4['id']},{})['then'](function(){return _0x4c3323;});}else{return _0x4c3323;}})['catch'](function(_0x5421b7){logger['error'](_0x0eea('0x65'),_0x5421b7);throw _0x5421b7;});}return _0x4c3323;})['then'](respondWithResult(_0x43b489,0xc9))['catch'](handleError(_0x43b489,null));};exports[_0x0eea('0x3b')]=function(_0xf00e48,_0x5e479d){if(_0xf00e48[_0x0eea('0x5f')]['id']){delete _0xf00e48[_0x0eea('0x5f')]['id'];}return db['WhatsappAccount'][_0x0eea('0x5d')]({'where':{'id':_0xf00e48[_0x0eea('0x5b')]['id']},'include':[{'model':db[_0x0eea('0x43')],'as':_0x0eea('0x44')}]})[_0x0eea('0x24')](handleEntityNotFound(_0x5e479d,null))[_0x0eea('0x24')](saveUpdates(_0xf00e48[_0x0eea('0x5f')],null))[_0x0eea('0x24')](respondWithResult(_0x5e479d,null))[_0x0eea('0x2e')](handleError(_0x5e479d,null));};exports[_0x0eea('0x3c')]=function(_0xe2cb76,_0x5a484f){return db[_0x0eea('0x46')]['find']({'where':{'id':_0xe2cb76[_0x0eea('0x5b')]['id']}})[_0x0eea('0x24')](handleEntityNotFound(_0x5a484f,null))[_0x0eea('0x24')](removeEntity(_0x5a484f,null))[_0x0eea('0x2e')](handleError(_0x5a484f,null));};exports[_0x0eea('0x66')]=function(_0x188989,_0x2e8f55){return db[_0x0eea('0x46')][_0x0eea('0x66')]()[_0x0eea('0x24')](respondWithResult(_0x2e8f55,null))[_0x0eea('0x2e')](handleError(_0x2e8f55,null));};exports[_0x0eea('0x67')]=function(_0x1bbc5b,_0x528671,_0x190dc2){if(_0x1bbc5b['body']['id']){delete _0x1bbc5b[_0x0eea('0x5f')]['id'];}return db[_0x0eea('0x46')][_0x0eea('0x5d')]({'where':{'id':_0x1bbc5b['params']['id']}})[_0x0eea('0x24')](handleEntityNotFound(_0x528671,null))['then'](function(_0x5ad759){if(_0x5ad759){_0x1bbc5b[_0x0eea('0x5f')][_0x0eea('0x68')]=_0x5ad759['id'];return db[_0x0eea('0x69')][_0x0eea('0x5e')](_0x1bbc5b[_0x0eea('0x5f')]);}})[_0x0eea('0x24')](respondWithResult(_0x528671,null))[_0x0eea('0x2e')](handleError(_0x528671,null));};exports[_0x0eea('0x6a')]=function(_0x4b7af6,_0xc2dc6b,_0x350620){var _0x5e729f={'raw':![],'where':{}};var _0x49f264={};var _0x5e3111={'count':0x0,'rows':[]};return db[_0x0eea('0x46')][_0x0eea('0x6b')]({'where':{'id':_0x4b7af6['params']['id']}})[_0x0eea('0x24')](handleEntityNotFound(_0xc2dc6b,null))[_0x0eea('0x24')](function(_0x10c6bb){if(_0x10c6bb){_0x49f264[_0x0eea('0x4d')]=_[_0x0eea('0x4a')](db[_0x0eea('0x69')][_0x0eea('0x6c')]);_0x49f264[_0x0eea('0x49')]=_[_0x0eea('0x4a')](_0x4b7af6[_0x0eea('0x49')]);_0x49f264[_0x0eea('0x4b')]=_['intersection'](_0x49f264[_0x0eea('0x4d')],_0x49f264[_0x0eea('0x49')]);_0x5e729f[_0x0eea('0x4f')]=_[_0x0eea('0x4c')](_0x49f264[_0x0eea('0x4d')],qs[_0x0eea('0x4e')](_0x4b7af6[_0x0eea('0x49')][_0x0eea('0x4e')]));_0x5e729f[_0x0eea('0x4f')]=_0x5e729f[_0x0eea('0x4f')]['length']?_0x5e729f[_0x0eea('0x4f')]:_0x49f264[_0x0eea('0x4d')];if(!_0x4b7af6[_0x0eea('0x49')][_0x0eea('0x50')](_0x0eea('0x6d'))){_0x5e729f[_0x0eea('0x35')]=qs[_0x0eea('0x35')](_0x4b7af6[_0x0eea('0x49')][_0x0eea('0x35')]);_0x5e729f['offset']=qs[_0x0eea('0x33')](_0x4b7af6['query'][_0x0eea('0x33')]);}_0x5e729f[_0x0eea('0x51')]=qs[_0x0eea('0x6e')](_0x4b7af6[_0x0eea('0x49')][_0x0eea('0x6e')]);_0x5e729f[_0x0eea('0x52')]=qs[_0x0eea('0x4b')](_[_0x0eea('0x53')](_0x4b7af6[_0x0eea('0x49')],_0x49f264[_0x0eea('0x4b')]));_0x5e729f['where'][_0x0eea('0x68')]=_0x10c6bb['id'];if(_0x4b7af6['query'][_0x0eea('0x54')]){_0x5e729f['where']=_[_0x0eea('0x55')](_0x5e729f[_0x0eea('0x52')],{'$or':_[_0x0eea('0x45')](_0x5e729f['attributes'],function(_0x2b32e9){var _0xf0cd86={};_0xf0cd86[_0x2b32e9]={'$like':'%'+_0x4b7af6['query']['filter']+'%'};return _0xf0cd86;})});}_0x5e729f=_[_0x0eea('0x55')]({},_0x5e729f,_0x4b7af6[_0x0eea('0x58')]);return db[_0x0eea('0x69')][_0x0eea('0x36')]({'where':_0x5e729f['where']})['then'](function(_0xf05881){_0x5e3111[_0x0eea('0x36')]=_0xf05881;if(_0x4b7af6[_0x0eea('0x49')][_0x0eea('0x5c')]){_0x5e729f[_0x0eea('0x59')]=[{'all':!![]}];}return db['Disposition'][_0x0eea('0x6f')](_0x5e729f);})[_0x0eea('0x24')](function(_0x4fe518){_0x5e3111[_0x0eea('0x5a')]=_0x4fe518;return _0x5e3111;});}})[_0x0eea('0x24')](respondWithFilteredResult(_0xc2dc6b,_0x5e729f))[_0x0eea('0x2e')](handleError(_0xc2dc6b,null));};exports['removeDispositions']=function(_0x7a2451,_0x395f4c,_0x4dd524){return db[_0x0eea('0x46')][_0x0eea('0x5d')]({'where':{'id':_0x7a2451[_0x0eea('0x5b')]['id']}})[_0x0eea('0x24')](handleEntityNotFound(_0x395f4c,null))[_0x0eea('0x24')](function(_0x2bc920){if(_0x2bc920){return _0x2bc920[_0x0eea('0x70')](_0x7a2451[_0x0eea('0x49')][_0x0eea('0x71')]);}})[_0x0eea('0x24')](respondWithStatusCode(_0x395f4c,null))[_0x0eea('0x2e')](handleError(_0x395f4c,null));};exports[_0x0eea('0x72')]=function(_0x5db721,_0x588fe9,_0x504cff){if(_0x5db721[_0x0eea('0x5f')]['id']){delete _0x5db721['body']['id'];}return db['WhatsappAccount'][_0x0eea('0x5d')]({'where':{'id':_0x5db721[_0x0eea('0x5b')]['id']}})[_0x0eea('0x24')](handleEntityNotFound(_0x588fe9,null))[_0x0eea('0x24')](function(_0x58b081){if(_0x58b081){_0x5db721[_0x0eea('0x5f')][_0x0eea('0x68')]=_0x58b081['id'];return db[_0x0eea('0x73')][_0x0eea('0x5e')](_0x5db721['body']);}})['then'](respondWithResult(_0x588fe9,null))[_0x0eea('0x2e')](handleError(_0x588fe9,null));};exports[_0x0eea('0x74')]=function(_0x2fed22,_0x223152,_0x3e1dd0){var _0x444e93={'raw':![],'where':{}};var _0x524f22={};var _0x383d11={'count':0x0,'rows':[]};return db[_0x0eea('0x46')]['findOne']({'where':{'id':_0x2fed22[_0x0eea('0x5b')]['id']}})[_0x0eea('0x24')](handleEntityNotFound(_0x223152,null))[_0x0eea('0x24')](function(_0x2d928d){if(_0x2d928d){_0x524f22[_0x0eea('0x4d')]=_[_0x0eea('0x4a')](db['CannedAnswer']['rawAttributes']);_0x524f22[_0x0eea('0x49')]=_['keys'](_0x2fed22[_0x0eea('0x49')]);_0x524f22[_0x0eea('0x4b')]=_[_0x0eea('0x4c')](_0x524f22['model'],_0x524f22[_0x0eea('0x49')]);_0x444e93[_0x0eea('0x4f')]=_[_0x0eea('0x4c')](_0x524f22[_0x0eea('0x4d')],qs[_0x0eea('0x4e')](_0x2fed22[_0x0eea('0x49')]['fields']));_0x444e93['attributes']=_0x444e93[_0x0eea('0x4f')][_0x0eea('0x75')]?_0x444e93[_0x0eea('0x4f')]:_0x524f22[_0x0eea('0x4d')];if(!_0x2fed22['query'][_0x0eea('0x50')](_0x0eea('0x6d'))){_0x444e93[_0x0eea('0x35')]=qs['limit'](_0x2fed22['query']['limit']);_0x444e93[_0x0eea('0x33')]=qs[_0x0eea('0x33')](_0x2fed22[_0x0eea('0x49')][_0x0eea('0x33')]);}_0x444e93[_0x0eea('0x51')]=qs[_0x0eea('0x6e')](_0x2fed22[_0x0eea('0x49')][_0x0eea('0x6e')]);_0x444e93[_0x0eea('0x52')]=qs[_0x0eea('0x4b')](_[_0x0eea('0x53')](_0x2fed22[_0x0eea('0x49')],_0x524f22[_0x0eea('0x4b')]));_0x444e93[_0x0eea('0x52')][_0x0eea('0x68')]=_0x2d928d['id'];if(_0x2fed22[_0x0eea('0x49')][_0x0eea('0x54')]){_0x444e93[_0x0eea('0x52')]=_[_0x0eea('0x55')](_0x444e93[_0x0eea('0x52')],{'$or':_['map'](_0x444e93['attributes'],function(_0x53692d){var _0x243595={};_0x243595[_0x53692d]={'$like':'%'+_0x2fed22[_0x0eea('0x49')][_0x0eea('0x54')]+'%'};return _0x243595;})});}_0x444e93=_[_0x0eea('0x55')]({},_0x444e93,_0x2fed22['options']);return db[_0x0eea('0x73')][_0x0eea('0x36')]({'where':_0x444e93[_0x0eea('0x52')]})[_0x0eea('0x24')](function(_0x2d4826){_0x383d11[_0x0eea('0x36')]=_0x2d4826;if(_0x2fed22[_0x0eea('0x49')][_0x0eea('0x5c')]){_0x444e93['include']=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x444e93);})['then'](function(_0x2f7a0d){_0x383d11[_0x0eea('0x5a')]=_0x2f7a0d;return _0x383d11;});}})['then'](respondWithFilteredResult(_0x223152,_0x444e93))[_0x0eea('0x2e')](handleError(_0x223152,null));};exports['removeAnswers']=function(_0x3a3573,_0x12d6e0,_0x1290c5){return db['WhatsappAccount'][_0x0eea('0x5d')]({'where':{'id':_0x3a3573[_0x0eea('0x5b')]['id']}})[_0x0eea('0x24')](handleEntityNotFound(_0x12d6e0,null))[_0x0eea('0x24')](function(_0x410ccb){if(_0x410ccb){return _0x410ccb['removeAnswers'](_0x3a3573[_0x0eea('0x49')][_0x0eea('0x71')]);}})[_0x0eea('0x24')](respondWithStatusCode(_0x12d6e0,null))[_0x0eea('0x2e')](handleError(_0x12d6e0,null));};exports[_0x0eea('0x76')]=function(_0x5b778e,_0x1eb40d,_0x54e3b4){return db[_0x0eea('0x46')][_0x0eea('0x5d')]({'where':{'id':_0x5b778e['params']['id']}})['then'](handleEntityNotFound(_0x1eb40d,null))[_0x0eea('0x24')](function(_0x71e10c){if(_0x71e10c){return _0x71e10c[_0x0eea('0x76')](_0x5b778e[_0x0eea('0x5f')][_0x0eea('0x71')],_[_0x0eea('0x77')](_0x5b778e[_0x0eea('0x5f')],[_0x0eea('0x71'),'id'])||{})[_0x0eea('0x78')](function(_0x4fc207){for(var _0x437b03=0x0;_0x437b03<_0x5b778e[_0x0eea('0x5f')][_0x0eea('0x71')][_0x0eea('0x75')];_0x437b03+=0x1){socket[_0x0eea('0x79')]('userWhatsappAccount:save',{'UserId':Number(_0x5b778e[_0x0eea('0x5f')][_0x0eea('0x71')][_0x437b03]),'WhatsappAccountId':Number(_0x5b778e[_0x0eea('0x5b')]['id'])});}return _0x4fc207;});}})['then'](respondWithResult(_0x1eb40d,null))[_0x0eea('0x2e')](handleError(_0x1eb40d,null));};exports[_0x0eea('0x7a')]=function(_0x4fc1a0,_0x25c410,_0x3bacee){return db[_0x0eea('0x46')][_0x0eea('0x5d')]({'where':{'id':_0x4fc1a0[_0x0eea('0x5b')]['id']}})['then'](handleEntityNotFound(_0x25c410,null))[_0x0eea('0x24')](function(_0xe66e7){if(_0xe66e7){return _0xe66e7[_0x0eea('0x7a')](_0x4fc1a0[_0x0eea('0x49')][_0x0eea('0x71')])[_0x0eea('0x24')](function(){if(_['isArray'](_0x4fc1a0['query'][_0x0eea('0x71')])){for(var _0x271d86=0x0;_0x271d86<_0x4fc1a0['query'][_0x0eea('0x71')][_0x0eea('0x75')];_0x271d86+=0x1){socket['emit'](_0x0eea('0x7b'),{'UserId':Number(_0x4fc1a0[_0x0eea('0x49')]['ids'][_0x271d86]),'WhatsappAccountId':Number(_0x4fc1a0[_0x0eea('0x5b')]['id'])});}}else{socket[_0x0eea('0x79')]('userWhatsappAccount:remove',{'UserId':Number(_0x4fc1a0['query'][_0x0eea('0x71')]),'WhatsappAccountId':Number(_0x4fc1a0[_0x0eea('0x5b')]['id'])});}});}})[_0x0eea('0x24')](respondWithStatusCode(_0x25c410,null))[_0x0eea('0x2e')](handleError(_0x25c410,null));};exports[_0x0eea('0x7c')]=function(_0x146e72,_0x26bc2d,_0x4a943a){var _0x143b93={};var _0x2e9e05={};var _0x154a6d;var _0x18af18;return db[_0x0eea('0x46')]['findOne']({'where':{'id':_0x146e72[_0x0eea('0x5b')]['id']}})[_0x0eea('0x24')](handleEntityNotFound(_0x26bc2d,null))['then'](function(_0x37d0cb){if(_0x37d0cb){_0x154a6d=_0x37d0cb;_0x2e9e05[_0x0eea('0x4d')]=_[_0x0eea('0x4a')](db['User'][_0x0eea('0x6c')]);_0x2e9e05['query']=_[_0x0eea('0x4a')](_0x146e72[_0x0eea('0x49')]);_0x2e9e05[_0x0eea('0x4b')]=_[_0x0eea('0x4c')](_0x2e9e05[_0x0eea('0x4d')],_0x2e9e05[_0x0eea('0x49')]);_0x143b93['attributes']=_[_0x0eea('0x4c')](_0x2e9e05[_0x0eea('0x4d')],qs[_0x0eea('0x4e')](_0x146e72[_0x0eea('0x49')][_0x0eea('0x4e')]));_0x143b93[_0x0eea('0x4f')]=_0x143b93[_0x0eea('0x4f')]['length']?_0x143b93[_0x0eea('0x4f')]:_0x2e9e05[_0x0eea('0x4d')];_0x143b93[_0x0eea('0x51')]=qs[_0x0eea('0x6e')](_0x146e72[_0x0eea('0x49')][_0x0eea('0x6e')]);_0x143b93[_0x0eea('0x52')]=qs[_0x0eea('0x4b')](_[_0x0eea('0x53')](_0x146e72[_0x0eea('0x49')],_0x2e9e05[_0x0eea('0x4b')]));if(_0x146e72[_0x0eea('0x49')]['filter']){_0x143b93[_0x0eea('0x52')]=_[_0x0eea('0x55')](_0x143b93['where'],{'$or':_[_0x0eea('0x45')](_0x143b93[_0x0eea('0x4f')],function(_0x1bcc5f){var _0xc3d12a={};_0xc3d12a[_0x1bcc5f]={'$like':'%'+_0x146e72['query'][_0x0eea('0x54')]+'%'};return _0xc3d12a;})});}_0x143b93=_[_0x0eea('0x55')]({},_0x143b93,_0x146e72['options']);return _0x154a6d[_0x0eea('0x7c')](_0x143b93);}})[_0x0eea('0x24')](function(_0x1cacb){if(_0x1cacb){_0x18af18=_0x1cacb['length'];if(!_0x146e72['query'][_0x0eea('0x50')]('nolimit')){_0x143b93[_0x0eea('0x35')]=qs[_0x0eea('0x35')](_0x146e72[_0x0eea('0x49')][_0x0eea('0x35')]);_0x143b93[_0x0eea('0x33')]=qs[_0x0eea('0x33')](_0x146e72[_0x0eea('0x49')]['offset']);}return _0x154a6d['getAgents'](_0x143b93);}})[_0x0eea('0x24')](function(_0x4bd431){if(_0x4bd431){return _0x4bd431?{'count':_0x18af18,'rows':_0x4bd431}:null;}})[_0x0eea('0x24')](respondWithResult(_0x26bc2d,null))[_0x0eea('0x2e')](handleError(_0x26bc2d,null));};exports[_0x0eea('0x7d')]=function(_0x1df53a,_0xccd026){var _0x174bef=_0x1df53a['params']['id'];var _0x197279=_0x1df53a[_0x0eea('0x5f')];var _0x3c4832=0xc8;var _0x16cab8=null;return db[_0x0eea('0x7e')]['transaction']({'isolationLevel':db[_0x0eea('0x7e')][_0x0eea('0x7f')][_0x0eea('0x80')][_0x0eea('0x81')]},function(_0x227300){return db[_0x0eea('0x46')][_0x0eea('0x6b')]({'where':{'id':_0x174bef},'transaction':_0x227300})[_0x0eea('0x24')](function(_0x39ed4a){if(_0x39ed4a){return db[_0x0eea('0x82')][_0x0eea('0x3c')]({'where':{'WhatsappAccountId':_0x174bef},'transaction':_0x227300})['then'](function(){var _0x16bbe7=_[_0x0eea('0x45')](_0x197279,function(_0x2bb11c){_0x2bb11c[_0x0eea('0x68')]=_0x174bef;return _0x2bb11c;});return db[_0x0eea('0x82')][_0x0eea('0x83')](_0x16bbe7,{'transaction':_0x227300});});}else{_0x3c4832=0x194;_0x16cab8=[];}});})[_0x0eea('0x24')](function(){if(_0x3c4832!==0x194){return db['WhatsappApplication'][_0x0eea('0x84')]({'where':{'WhatsappAccountId':_0x174bef},'order':'priority'})[_0x0eea('0x24')](function(_0x5a6ed7){_0x16cab8=_0x5a6ed7;});}})[_0x0eea('0x2e')](function(_0xccd27c){_0x3c4832=0x1f4;logger['error'](_0xccd27c[_0x0eea('0x85')]);if(_0xccd27c[_0x0eea('0x40')]){delete _0xccd27c[_0x0eea('0x40')];}_0x16cab8=_0xccd27c;})[_0x0eea('0x86')](function(){if(_0x16cab8===null){_0xccd026[_0x0eea('0x2f')](_0x3c4832);}else{if(_0x3c4832===0x1f4){_0xccd026[_0x0eea('0x30')](_0x3c4832)['send'](_0x16cab8);}else{_0xccd026[_0x0eea('0x30')](_0x3c4832)[_0x0eea('0x32')](_0x16cab8);}}});};exports[_0x0eea('0x87')]=function(_0x24e2fd,_0x2b6216,_0x5df04a){var _0x595922={};var _0xe3768e={};var _0x3f0939;var _0x3d64b3;return db[_0x0eea('0x46')][_0x0eea('0x6b')]({'where':{'id':_0x24e2fd[_0x0eea('0x5b')]['id']}})['then'](handleEntityNotFound(_0x2b6216,null))[_0x0eea('0x24')](function(_0x353741){if(_0x353741){_0x3f0939=_0x353741;_0xe3768e[_0x0eea('0x4d')]=_[_0x0eea('0x4a')](db[_0x0eea('0x82')][_0x0eea('0x6c')]);_0xe3768e[_0x0eea('0x49')]=_[_0x0eea('0x4a')](_0x24e2fd[_0x0eea('0x49')]);_0xe3768e['filters']=_['intersection'](_0xe3768e[_0x0eea('0x4d')],_0xe3768e['query']);_0x595922[_0x0eea('0x4f')]=_['intersection'](_0xe3768e[_0x0eea('0x4d')],qs[_0x0eea('0x4e')](_0x24e2fd[_0x0eea('0x49')][_0x0eea('0x4e')]));_0x595922[_0x0eea('0x4f')]=_0x595922[_0x0eea('0x4f')][_0x0eea('0x75')]?_0x595922[_0x0eea('0x4f')]:_0xe3768e[_0x0eea('0x4d')];_0x595922[_0x0eea('0x51')]=qs[_0x0eea('0x6e')](_0x24e2fd['query'][_0x0eea('0x6e')]);_0x595922[_0x0eea('0x52')]=qs[_0x0eea('0x4b')](_[_0x0eea('0x53')](_0x24e2fd['query'],_0xe3768e['filters']));if(_0x24e2fd[_0x0eea('0x49')][_0x0eea('0x54')]){_0x595922[_0x0eea('0x52')]=_[_0x0eea('0x55')](_0x595922[_0x0eea('0x52')],{'$or':_[_0x0eea('0x45')](_0x595922[_0x0eea('0x4f')],function(_0x2c415d){var _0x450ba3={};_0x450ba3[_0x2c415d]={'$like':'%'+_0x24e2fd[_0x0eea('0x49')]['filter']+'%'};return _0x450ba3;})});}_0x595922=_['merge']({},_0x595922,_0x24e2fd[_0x0eea('0x58')]);return _0x3f0939[_0x0eea('0x87')](_0x595922);}})[_0x0eea('0x24')](function(_0x37ed12){if(_0x37ed12){_0x3d64b3=_0x37ed12['length'];if(!_0x24e2fd[_0x0eea('0x49')][_0x0eea('0x50')](_0x0eea('0x6d'))){_0x595922[_0x0eea('0x35')]=qs[_0x0eea('0x35')](_0x24e2fd[_0x0eea('0x49')][_0x0eea('0x35')]);_0x595922[_0x0eea('0x33')]=qs['offset'](_0x24e2fd['query'][_0x0eea('0x33')]);}return _0x3f0939['getApplications'](_0x595922);}})[_0x0eea('0x24')](function(_0x144d65){if(_0x144d65){return _0x144d65?{'count':_0x3d64b3,'rows':_0x144d65}:null;}})[_0x0eea('0x24')](respondWithResult(_0x2b6216,null))[_0x0eea('0x2e')](handleError(_0x2b6216,null));};exports[_0x0eea('0x88')]=function(_0x4487b2,_0x35019a,_0x342ba6){var _0x456dfa={'channel':_0x0eea('0x89')};var _0x21eceb=[];var _0x4a5269=[];var _0x655a5d={};return db['WhatsappAccount'][_0x0eea('0x5d')]({'where':{'id':_0x4487b2[_0x0eea('0x5b')]['id']},'include':[{'model':db[_0x0eea('0x82')],'as':'Applications'}]})[_0x0eea('0x24')](handleEntityNotFound(_0x35019a,null))['then'](function(_0x3cf08d){_0x456dfa['account']=_0x3cf08d;if(_0x456dfa[_0x0eea('0x8a')]&&_0x456dfa[_0x0eea('0x8a')][_0x0eea('0x56')]===_0x0eea('0x8b')&&_0x4487b2[_0x0eea('0x5f')][_0x0eea('0x8c')]){if(_0x4487b2[_0x0eea('0x5f')][_0x0eea('0x8c')]['length']===0x0)return;if(_0x4487b2[_0x0eea('0x5f')]['statuses'][0x0][_0x0eea('0x8d')]!==_0x0eea('0x8e'))return;return db['WhatsappMessage'][_0x0eea('0x3b')]({'read':!![],'readAt':_0x4487b2[_0x0eea('0x5f')]['statuses'][0x0][_0x0eea('0x8f')]},{'where':{'messageId':_0x4487b2[_0x0eea('0x5f')][_0x0eea('0x8c')][0x0]['message_id']},'individualHooks':!![]})[_0x0eea('0x24')](function(_0x5069ed){return _0x35019a[_0x0eea('0x30')](0xc8)[_0x0eea('0x32')](_0x5069ed);});}_0x456dfa['applications']=_[_0x0eea('0x90')](_0x3cf08d['Applications'],[_0x0eea('0x91')],['asc']);if(_0x456dfa[_0x0eea('0x8a')][_0x0eea('0x92')]){delete _0x456dfa['account']['Applications'];}return db[_0x0eea('0x93')][_0x0eea('0x66')]()[_0x0eea('0x24')](function(_0x422fac){if(!_0x422fac){throw new db[(_0x0eea('0x94'))][(_0x0eea('0x95'))](_0x0eea('0x96'));}_0x21eceb=_[_0x0eea('0x97')](_[_0x0eea('0x4a')](_0x422fac),[_0x0eea('0x98'),_0x0eea('0x99')]);_0x4a5269=_[_0x0eea('0x97')](_[_0x0eea('0x4a')](_0x422fac),['createdAt',_0x0eea('0x99'),'CompanyId','ListId']);_0x456dfa[_0x0eea('0x5f')]={'mapKey':'mobile'};if(_0x456dfa[_0x0eea('0x8a')]&&_0x456dfa['account'][_0x0eea('0x56')]==='twilio'){_0x456dfa['body'][_0x0eea('0x9a')]=_0x4487b2[_0x0eea('0x5f')][_0x0eea('0x9b')][_0x0eea('0x9c')](_0x0eea('0x9d'),'');_0x456dfa['body'][_0x0eea('0x5f')]=_0x4487b2[_0x0eea('0x5f')][_0x0eea('0x9e')];_0x456dfa['body'][_0x0eea('0x9f')]=_0x4487b2[_0x0eea('0x5f')][_0x0eea('0xa0')];}if(_0x456dfa[_0x0eea('0x8a')]&&_0x456dfa[_0x0eea('0x8a')][_0x0eea('0x56')]==='sinch'){_0x456dfa[_0x0eea('0x5f')][_0x0eea('0x9a')]=_0x4487b2['body'][_0x0eea('0xa1')][0x0][_0x0eea('0x9a')];_0x456dfa[_0x0eea('0x5f')][_0x0eea('0x5f')]=_0x4487b2[_0x0eea('0x5f')][_0x0eea('0xa1')][0x0][_0x0eea('0x2c')]['body'];_0x456dfa[_0x0eea('0x5f')][_0x0eea('0x9f')]=_0x4487b2['body'][_0x0eea('0xa1')][0x0][_0x0eea('0xa2')];}if(_0x456dfa['body']['id']){delete _0x456dfa['body']['id'];}if(_[_0x0eea('0xa3')](_0x456dfa['body'][_0x0eea('0x9a')])){throw new db[(_0x0eea('0x94'))][(_0x0eea('0x95'))](_0x0eea('0xa4'));}if(_[_0x0eea('0xa3')](_0x456dfa[_0x0eea('0x5f')][_0x0eea('0x5f')])||_0x456dfa[_0x0eea('0x5f')][_0x0eea('0x5f')]===''){throw new db[(_0x0eea('0x94'))][(_0x0eea('0x95'))](_0x0eea('0xa5'));}if(_[_0x0eea('0xa3')](_0x456dfa[_0x0eea('0x5f')][_0x0eea('0xa6')])){throw new db[(_0x0eea('0x94'))][(_0x0eea('0x95'))](_0x0eea('0xa7')+_0x4a5269);}if(!_[_0x0eea('0xa8')](_0x4a5269,_0x456dfa[_0x0eea('0x5f')]['mapKey'])){throw new db[(_0x0eea('0x94'))][(_0x0eea('0x95'))](_0x0eea('0xa9')+_0x4a5269);}_0x655a5d[_0x456dfa[_0x0eea('0x5f')][_0x0eea('0xa6')]]=_0x456dfa[_0x0eea('0x5f')][_0x0eea('0x9a')];return db['CmList']['find']({'where':{'id':_0x456dfa[_0x0eea('0x8a')][_0x0eea('0xaa')]},'include':[{'model':db[_0x0eea('0x93')],'as':_0x0eea('0xab'),'where':_0x655a5d,'limit':0x1,'order':[['updatedAt','DESC']]}]});})[_0x0eea('0x24')](handleEntityNotFound(_0x35019a,null))[_0x0eea('0x24')](function(_0x5e2214){if(_0x5e2214){_0x456dfa['list']=_[_0x0eea('0x77')](_0x5e2214,['Contacts']);if(_0x5e2214[_0x0eea('0xab')]['length']){return _0x5e2214['Contacts'][0x0];}var _0x591127=_[_0x0eea('0x1b')](_0x456dfa[_0x0eea('0x5f')],{'firstName':_0x456dfa[_0x0eea('0x5f')][_0x0eea('0x9a')],'ListId':_0x5e2214['id']});_0x591127[_0x456dfa[_0x0eea('0x5f')][_0x0eea('0xa6')]]=_0x456dfa[_0x0eea('0x5f')]['from'];return db[_0x0eea('0x93')]['create'](_0x591127,{'fields':_0x21eceb,'raw':!![]});}})[_0x0eea('0x24')](handleEntityNotFound(_0x35019a,null))[_0x0eea('0x24')](function(_0x2c470d){if(_0x2c470d){_0x456dfa['contact']=_0x2c470d;var _0x1978aa={'ContactId':_0x2c470d['id'],'phone':_0x456dfa[_0x0eea('0x5f')][_0x0eea('0x9a')],'WhatsappAccountId':_0x4487b2['params']['id']};var _0x281de9={'ContactId':_0x2c470d['id'],'WhatsappAccountId':_0x4487b2['params']['id'],'closed':![]};return db['WhatsappInteraction'][_0x0eea('0x5d')]({'where':_0x281de9})['then'](function(_0x3fff45){if(_0x3fff45){return[_0x3fff45,![]];}return db[_0x0eea('0xac')][_0x0eea('0x5e')](_0x1978aa)[_0x0eea('0x24')](function(_0xbf7a11){return[_0xbf7a11,!![]];});});}})[_0x0eea('0x78')](function(_0x5203cd,_0x563d20){_0x456dfa[_0x0eea('0xad')]=_0x5203cd['get']({'plain':!![]});_0x456dfa[_0x0eea('0xad')][_0x0eea('0xae')]=![];if(_0x563d20){if(_0x456dfa[_0x0eea('0x8a')][_0x0eea('0xaf')]){_0x456dfa['applications'][_0x0eea('0xb0')]({'id':0x0,'priority':_0x456dfa[_0x0eea('0xb1')][_0x0eea('0x75')]+0x1,'app':_0x0eea('0xb2'),'appdata':'unmanaged','interval':_0x0eea('0xb3')});}_0x456dfa[_0x0eea('0xad')][_0x0eea('0xae')]=!![];}return db[_0x0eea('0xb4')][_0x0eea('0x5e')]({'phone':_0x456dfa[_0x0eea('0x5f')][_0x0eea('0x9a')],'messageId':_0x456dfa[_0x0eea('0x5f')][_0x0eea('0x9f')],'body':_0x456dfa[_0x0eea('0x5f')]['body'],'WhatsappAccountId':_0x4487b2[_0x0eea('0x5b')]['id'],'WhatsappInteractionId':_0x5203cd['id'],'direction':'in','ContactId':_0x5203cd[_0x0eea('0xb5')],'AttachmentId':_0x456dfa[_0x0eea('0x5f')][_0x0eea('0xb6')]});})[_0x0eea('0x24')](function(_0x111844){_0x456dfa[_0x0eea('0x2c')]=_0x111844;if(_0x456dfa['interaction'][_0x0eea('0xb7')]){return db['User'][_0x0eea('0x5d')]({'attributes':['id','name'],'where':{'id':_0x456dfa['interaction'][_0x0eea('0xb7')]}})[_0x0eea('0x24')](function(_0x5f487a){if(_0x5f487a){_0x456dfa[_0x0eea('0xb1')]['unshift']({'id':0x0,'priority':0x0,'app':_0x0eea('0xb8'),'appdata':_0x5f487a[_0x0eea('0x40')]+','+(_0x456dfa[_0x0eea('0x8a')][_0x0eea('0xb9')]||0xa),'interval':_0x0eea('0xb3')});}return respondWithRpcPromise(_0x0eea('0xba'),_0x0eea('0xbb'),_0x456dfa);});}return respondWithRpcPromise(_0x0eea('0xba'),_0x0eea('0xbb'),_0x456dfa);})['then'](function(_0x228b1c){if(_0x228b1c){var _0x597a50=0xc8;var _0x5b9714=_0x0eea('0xbc');logger[_0x0eea('0xbd')](_0x0eea('0x28'),_0x5b9714,_0x597a50,_0x0eea('0xbe'));logger[_0x0eea('0x27')](_0x0eea('0xbf'),_0x5b9714,_0x597a50,_0x0eea('0xbe'),JSON[_0x0eea('0x29')](_0x228b1c));if(_0x456dfa['account'][_0x0eea('0x56')]===_0x0eea('0xc0')){return _0x35019a[_0x0eea('0x30')](_0x597a50)['set'](_0x0eea('0xc1'),_0x0eea('0xc2'))[_0x0eea('0x41')](_0x0eea('0xc3'));}else{return _0x35019a[_0x0eea('0x30')](_0x597a50)[_0x0eea('0x32')](_0x228b1c);}}});})['catch'](handleError(_0x35019a,null));};exports['send']=function(_0x4ad57d,_0x406b89,_0x427cf9){var _0x284b29,_0x171a40,_0x20b354;if(_['isNil'](_0x4ad57d[_0x0eea('0x5f')][_0x0eea('0x5f')])||_0x4ad57d['body']['body']===''){throw new db['Sequelize'][(_0x0eea('0x95'))](_0x0eea('0xa5'));}if(_[_0x0eea('0xa3')](_0x4ad57d['body']['to'])){throw new db[(_0x0eea('0x94'))]['ValidationError'](_0x0eea('0xc4'));}_0x284b29=_0x4ad57d[_0x0eea('0x5f')]['to'];return db[_0x0eea('0x46')][_0x0eea('0x5d')]({'where':{'id':_0x4ad57d[_0x0eea('0x5b')]['id']},'include':[{'model':db[_0x0eea('0xc5')],'as':_0x0eea('0xc6'),'include':[{'model':db['CmContact'],'as':_0x0eea('0xab'),'where':{'mobile':_0x284b29},'limit':0x1,'order':[[_0x0eea('0x99'),_0x0eea('0xc7')]]}]}]})['then'](handleEntityNotFound(_0x406b89,null))[_0x0eea('0x24')](function(_0x42e33c){if(_0x42e33c&&_0x42e33c[_0x0eea('0xc6')]){_0x171a40=_0x42e33c['get']({'plain':!![]});if(_0x171a40[_0x0eea('0xc6')]&&_0x171a40[_0x0eea('0xc6')][_0x0eea('0xab')][_0x0eea('0x75')]){return _0x171a40[_0x0eea('0xc6')][_0x0eea('0xab')][0x0];}return db[_0x0eea('0x93')][_0x0eea('0x5e')](_[_0x0eea('0x1b')](_0x4ad57d[_0x0eea('0x5f')],{'firstName':_0x284b29,'mobile':_0x284b29,'phone':_0x284b29,'ListId':_0x171a40[_0x0eea('0xaa')]}));}})[_0x0eea('0x24')](handleEntityNotFound(_0x406b89,null))[_0x0eea('0x24')](function(_0x471524){if(_0x471524){_0x20b354=_0x471524;return db[_0x0eea('0xac')][_0x0eea('0x5d')]({'where':{'ContactId':_0x20b354['id'],'closed':![],'WhatsappAccountId':_0x171a40['id']}})[_0x0eea('0x24')](function(_0x454fcd){if(_0x454fcd){return[_0x454fcd,![]];}return db['WhatsappInteraction'][_0x0eea('0x5e')]({'UserId':_0x4ad57d[_0x0eea('0x60')]['id'],'ContactId':_0x20b354['id'],'WhatsappAccountId':_0x171a40['id'],'phone':_0x284b29,'firstMsgDirection':_0x0eea('0xc8'),'Messages':[_['merge'](_0x4ad57d[_0x0eea('0x5f')],{'read':![],'body':_0x4ad57d[_0x0eea('0x5f')][_0x0eea('0x5f')],'phone':_0x284b29,'WhatsappAccountId':_0x171a40['id'],'UserId':_0x4ad57d[_0x0eea('0x60')]['id'],'ContactId':_0x20b354['id']})]},{'include':[{'model':db['WhatsappMessage'],'as':_0x0eea('0xc9')}]})[_0x0eea('0x24')](function(_0x3fbd79){return[_0x3fbd79,!![]];});});}})[_0x0eea('0x78')](function(_0x21ece0,_0x7bb50){if(_0x7bb50){return _0x21ece0;}return db[_0x0eea('0xb4')]['create'](_[_0x0eea('0x55')](_0x4ad57d['body'],{'read':![],'body':_0x4ad57d[_0x0eea('0x5f')][_0x0eea('0x5f')],'phone':_0x284b29,'WhatsappAccountId':_0x171a40['id'],'WhatsappInteractionId':_0x21ece0['id'],'UserId':_0x4ad57d[_0x0eea('0x60')]['id'],'ContactId':_0x20b354['id']}))[_0x0eea('0x24')](function(_0x3bcf48){_0x21ece0['dataValues']['Messages']=[];_0x21ece0[_0x0eea('0xca')]['Messages'][_0x0eea('0xb0')](_0x3bcf48[_0x0eea('0xca')]);return _0x21ece0;});})['then'](respondWithResult(_0x406b89,null))[_0x0eea('0x2e')](handleError(_0x406b89,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index b04c421..15faf9a 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 _0x1b70=['../../mysqldb','WhatsappAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x4c4042,_0x1ea485){var _0xbd10dc=function(_0x164b20){while(--_0x164b20){_0x4c4042['push'](_0x4c4042['shift']());}};_0xbd10dc(++_0x1ea485);}(_0x1b70,0xd2));var _0x01b7=function(_0x1304c6,_0x6bb485){_0x1304c6=_0x1304c6-0x0;var _0x2e6654=_0x1b70[_0x1304c6];return _0x2e6654;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require(_0x01b7('0x0'))['db'][_0x01b7('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x01b7('0x2')](0x0);var events={'afterCreate':_0x01b7('0x3'),'afterUpdate':_0x01b7('0x4'),'afterDestroy':_0x01b7('0x5')};function emitEvent(_0x250f92){return function(_0xee34c3,_0x347ff1,_0x87ea4e){WhatsappAccountEvents[_0x01b7('0x6')](_0x250f92+':'+_0xee34c3['id'],_0xee34c3);WhatsappAccountEvents[_0x01b7('0x6')](_0x250f92,_0xee34c3);_0x87ea4e(null);};}for(var e in events){if(events[_0x01b7('0x7')](e)){var event=events[e];WhatsappAccount[_0x01b7('0x8')](e,emitEvent(event));}}module[_0x01b7('0x9')]=WhatsappAccountEvents; \ No newline at end of file +var _0xc028=['../../mysqldb','setMaxListeners','save','emit','hasOwnProperty','exports','events'];(function(_0x3d2f1f,_0x4f51d1){var _0x3638fb=function(_0x33fecd){while(--_0x33fecd){_0x3d2f1f['push'](_0x3d2f1f['shift']());}};_0x3638fb(++_0x4f51d1);}(_0xc028,0xd1));var _0x8c02=function(_0x2bf5c5,_0x33e07e){_0x2bf5c5=_0x2bf5c5-0x0;var _0xa552cc=_0xc028[_0x2bf5c5];return _0xa552cc;};'use strict';var EventEmitter=require(_0x8c02('0x0'));var WhatsappAccount=require(_0x8c02('0x1'))['db']['WhatsappAccount'];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x8c02('0x2')](0x0);var events={'afterCreate':_0x8c02('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x2cb5b8){return function(_0xd0e287,_0x265a21,_0x2ba5e2){WhatsappAccountEvents[_0x8c02('0x4')](_0x2cb5b8+':'+_0xd0e287['id'],_0xd0e287);WhatsappAccountEvents[_0x8c02('0x4')](_0x2cb5b8,_0xd0e287);_0x2ba5e2(null);};}for(var e in events){if(events[_0x8c02('0x5')](e)){var event=events[e];WhatsappAccount['hook'](e,emitEvent(event));}}module[_0x8c02('0x6')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index 99571ec..227a86c 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 _0x7a87=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./whatsappAccount.attributes','exports','define','WhatsappAccount','whatsapp_accounts','lodash','util'];(function(_0xb3dc7c,_0x52be85){var _0x33f779=function(_0x2c90b4){while(--_0x2c90b4){_0xb3dc7c['push'](_0xb3dc7c['shift']());}};_0x33f779(++_0x52be85);}(_0x7a87,0xde));var _0x77a8=function(_0x38adeb,_0x2d854a){_0x38adeb=_0x38adeb-0x0;var _0xcd7258=_0x7a87[_0x38adeb];return _0xcd7258;};'use strict';var _=require(_0x77a8('0x0'));var util=require(_0x77a8('0x1'));var logger=require(_0x77a8('0x2'))(_0x77a8('0x3'));var moment=require(_0x77a8('0x4'));var BPromise=require('bluebird');var rp=require(_0x77a8('0x5'));var fs=require('fs');var path=require(_0x77a8('0x6'));var rimraf=require(_0x77a8('0x7'));var config=require(_0x77a8('0x8'));var attributes=require(_0x77a8('0x9'));module[_0x77a8('0xa')]=function(_0x109111,_0x5334d1){return _0x109111[_0x77a8('0xb')](_0x77a8('0xc'),attributes,{'tableName':_0x77a8('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa75c=['rimraf','../../config/environment','./whatsappAccount.attributes','WhatsappAccount','whatsapp_accounts','lodash','util','../../config/logger','request-promise','path'];(function(_0x314c95,_0x1c544e){var _0x36ce33=function(_0x1013d3){while(--_0x1013d3){_0x314c95['push'](_0x314c95['shift']());}};_0x36ce33(++_0x1c544e);}(_0xa75c,0x18b));var _0xca75=function(_0x285c85,_0x132c21){_0x285c85=_0x285c85-0x0;var _0x2f81cd=_0xa75c[_0x285c85];return _0x2f81cd;};'use strict';var _=require(_0xca75('0x0'));var util=require(_0xca75('0x1'));var logger=require(_0xca75('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xca75('0x3'));var fs=require('fs');var path=require(_0xca75('0x4'));var rimraf=require(_0xca75('0x5'));var config=require(_0xca75('0x6'));var attributes=require(_0xca75('0x7'));module['exports']=function(_0x53c111,_0x29a32d){return _0x53c111['define'](_0xca75('0x8'),attributes,{'tableName':_0xca75('0x9'),'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 2b678b7..3c4cc9f 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 _0xe211=['request\x20sent','stringify','error','code','message','result','catch','ShowWhatsappAccount','WhatsappAccount','find','options','where','attributes','include','map','model','debug','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','request','then','info','WhatsappAccount,\x20%s,\x20%s'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0xe211,0xfb));var _0x1e21=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe211[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x1e21('0x0'));var util=require(_0x1e21('0x1'));var moment=require('moment');var BPromise=require(_0x1e21('0x2'));var rs=require(_0x1e21('0x3'));var fs=require('fs');var Redis=require(_0x1e21('0x4'));var db=require(_0x1e21('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x1e21('0x6'))(_0x1e21('0x7'));var config=require(_0x1e21('0x8'));var jayson=require(_0x1e21('0x9'));var client=jayson[_0x1e21('0xa')][_0x1e21('0xb')]({'port':0x232a});config[_0x1e21('0xc')]=_[_0x1e21('0xd')](config[_0x1e21('0xc')],{'host':_0x1e21('0xe'),'port':0x18eb});var socket=require(_0x1e21('0xf'))(new Redis(config['redis']));require(_0x1e21('0x10'))[_0x1e21('0x11')](socket);function respondWithRpcPromise(_0x40165f,_0x2567b6,_0x1b3ce1){return new BPromise(function(_0x22cc3c,_0x21f346){return client[_0x1e21('0x12')](_0x40165f,_0x1b3ce1)[_0x1e21('0x13')](function(_0x5d9f83){logger[_0x1e21('0x14')](_0x1e21('0x15'),_0x2567b6,_0x1e21('0x16'));logger['debug']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x2567b6,'request\x20sent',JSON[_0x1e21('0x17')](_0x5d9f83));if(_0x5d9f83[_0x1e21('0x18')]){if(_0x5d9f83[_0x1e21('0x18')][_0x1e21('0x19')]===0x1f4){logger['error'](_0x1e21('0x15'),_0x2567b6,_0x5d9f83[_0x1e21('0x18')]['message']);return _0x21f346(_0x5d9f83[_0x1e21('0x18')][_0x1e21('0x1a')]);}logger[_0x1e21('0x18')](_0x1e21('0x15'),_0x2567b6,_0x5d9f83[_0x1e21('0x18')]['message']);return _0x22cc3c(_0x5d9f83[_0x1e21('0x18')]['message']);}else{logger[_0x1e21('0x14')](_0x1e21('0x15'),_0x2567b6,_0x1e21('0x16'));_0x22cc3c(_0x5d9f83[_0x1e21('0x1b')][_0x1e21('0x1a')]);}})[_0x1e21('0x1c')](function(_0x53b2cb){logger[_0x1e21('0x18')]('WhatsappAccount,\x20%s,\x20%s',_0x2567b6,_0x53b2cb);_0x21f346(_0x53b2cb);});});}exports[_0x1e21('0x1d')]=function(_0x5028a3){var _0x225d2a=this;return new Promise(function(_0xec3615,_0x19620d){return db[_0x1e21('0x1e')][_0x1e21('0x1f')]({'raw':_0x5028a3[_0x1e21('0x20')]?_0x5028a3['options']['raw']===undefined?!![]:![]:!![],'where':_0x5028a3[_0x1e21('0x20')]?_0x5028a3['options'][_0x1e21('0x21')]||null:null,'attributes':_0x5028a3[_0x1e21('0x20')]?_0x5028a3['options'][_0x1e21('0x22')]||null:null,'include':_0x5028a3['options']?_0x5028a3[_0x1e21('0x20')][_0x1e21('0x23')]?_[_0x1e21('0x24')](_0x5028a3[_0x1e21('0x20')][_0x1e21('0x23')],function(_0x13b714){return{'model':db[_0x13b714['model']],'as':_0x13b714['as'],'attributes':_0x13b714['attributes'],'include':_0x13b714['include']?_[_0x1e21('0x24')](_0x13b714['include'],function(_0x183081){return{'model':db[_0x183081[_0x1e21('0x25')]],'as':_0x183081['as'],'attributes':_0x183081[_0x1e21('0x22')],'include':_0x183081[_0x1e21('0x23')]?_['map'](_0x183081[_0x1e21('0x23')],function(_0x445f34){return{'model':db[_0x445f34[_0x1e21('0x25')]],'as':_0x445f34['as'],'attributes':_0x445f34[_0x1e21('0x22')]};}):[]};}):[]};}):[]:[]})[_0x1e21('0x13')](function(_0x568958){logger[_0x1e21('0x14')](_0x1e21('0x1d'),_0x5028a3);logger[_0x1e21('0x26')]('ShowWhatsappAccount',_0x5028a3,JSON[_0x1e21('0x17')](_0x568958));_0xec3615(_0x568958);})[_0x1e21('0x1c')](function(_0x30d224){logger[_0x1e21('0x18')]('ShowWhatsappAccount',_0x30d224[_0x1e21('0x1a')],_0x5028a3);_0x19620d(_0x225d2a['error'](0x1f4,_0x30d224[_0x1e21('0x1a')]));});});}; \ No newline at end of file +var _0x4f11=['include','map','model','ShowWhatsappAccount','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','find','options','raw','where','attributes'];(function(_0x2171a6,_0x37b2e5){var _0x14140c=function(_0x3d0e0b){while(--_0x3d0e0b){_0x2171a6['push'](_0x2171a6['shift']());}};_0x14140c(++_0x37b2e5);}(_0x4f11,0x107));var _0x14f1=function(_0x3a55cf,_0x9c2159){_0x3a55cf=_0x3a55cf-0x0;var _0x24cd37=_0x4f11[_0x3a55cf];return _0x24cd37;};'use strict';var _=require(_0x14f1('0x0'));var util=require(_0x14f1('0x1'));var moment=require(_0x14f1('0x2'));var BPromise=require(_0x14f1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x14f1('0x4'));var db=require(_0x14f1('0x5'))['db'];var utils=require(_0x14f1('0x6'));var logger=require('../../config/logger')(_0x14f1('0x7'));var config=require(_0x14f1('0x8'));var jayson=require(_0x14f1('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x14f1('0xa')]=_[_0x14f1('0xb')](config[_0x14f1('0xa')],{'host':_0x14f1('0xc'),'port':0x18eb});var socket=require(_0x14f1('0xd'))(new Redis(config[_0x14f1('0xa')]));require(_0x14f1('0xe'))[_0x14f1('0xf')](socket);function respondWithRpcPromise(_0x1f1332,_0x2b0481,_0x244be4){return new BPromise(function(_0x4efac9,_0x32bb32){return client[_0x14f1('0x10')](_0x1f1332,_0x244be4)[_0x14f1('0x11')](function(_0x32a9c8){logger[_0x14f1('0x12')](_0x14f1('0x13'),_0x2b0481,_0x14f1('0x14'));logger['debug'](_0x14f1('0x15'),_0x2b0481,'request\x20sent',JSON[_0x14f1('0x16')](_0x32a9c8));if(_0x32a9c8[_0x14f1('0x17')]){if(_0x32a9c8[_0x14f1('0x17')][_0x14f1('0x18')]===0x1f4){logger[_0x14f1('0x17')](_0x14f1('0x13'),_0x2b0481,_0x32a9c8[_0x14f1('0x17')]['message']);return _0x32bb32(_0x32a9c8[_0x14f1('0x17')]['message']);}logger['error'](_0x14f1('0x13'),_0x2b0481,_0x32a9c8['error']['message']);return _0x4efac9(_0x32a9c8['error'][_0x14f1('0x19')]);}else{logger[_0x14f1('0x12')]('WhatsappAccount,\x20%s,\x20%s',_0x2b0481,_0x14f1('0x14'));_0x4efac9(_0x32a9c8[_0x14f1('0x1a')]['message']);}})[_0x14f1('0x1b')](function(_0x107441){logger[_0x14f1('0x17')](_0x14f1('0x13'),_0x2b0481,_0x107441);_0x32bb32(_0x107441);});});}exports['ShowWhatsappAccount']=function(_0x216820){var _0x53e902=this;return new Promise(function(_0x1c787f,_0x530a43){return db['WhatsappAccount'][_0x14f1('0x1c')]({'raw':_0x216820[_0x14f1('0x1d')]?_0x216820[_0x14f1('0x1d')][_0x14f1('0x1e')]===undefined?!![]:![]:!![],'where':_0x216820[_0x14f1('0x1d')]?_0x216820['options'][_0x14f1('0x1f')]||null:null,'attributes':_0x216820['options']?_0x216820[_0x14f1('0x1d')][_0x14f1('0x20')]||null:null,'include':_0x216820[_0x14f1('0x1d')]?_0x216820[_0x14f1('0x1d')][_0x14f1('0x21')]?_[_0x14f1('0x22')](_0x216820[_0x14f1('0x1d')][_0x14f1('0x21')],function(_0x5a7538){return{'model':db[_0x5a7538[_0x14f1('0x23')]],'as':_0x5a7538['as'],'attributes':_0x5a7538['attributes'],'include':_0x5a7538[_0x14f1('0x21')]?_[_0x14f1('0x22')](_0x5a7538['include'],function(_0x1ea179){return{'model':db[_0x1ea179[_0x14f1('0x23')]],'as':_0x1ea179['as'],'attributes':_0x1ea179[_0x14f1('0x20')],'include':_0x1ea179[_0x14f1('0x21')]?_['map'](_0x1ea179[_0x14f1('0x21')],function(_0x1f48ce){return{'model':db[_0x1f48ce[_0x14f1('0x23')]],'as':_0x1f48ce['as'],'attributes':_0x1f48ce[_0x14f1('0x20')]};}):[]};}):[]};}):[]:[]})[_0x14f1('0x11')](function(_0x51513c){logger[_0x14f1('0x12')](_0x14f1('0x24'),_0x216820);logger['debug'](_0x14f1('0x24'),_0x216820,JSON[_0x14f1('0x16')](_0x51513c));_0x1c787f(_0x51513c);})[_0x14f1('0x1b')](function(_0x20c3ad){logger[_0x14f1('0x17')](_0x14f1('0x24'),_0x20c3ad['message'],_0x216820);_0x530a43(_0x53e902[_0x14f1('0x17')](0x1f4,_0x20c3ad[_0x14f1('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 824c2c2..a45fb41 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 _0x1003=['save','emit','removeListener','register','length','whatsappAccount:','./whatsappAccount.events'];(function(_0x4fcf5b,_0x19cdd3){var _0x24aca1=function(_0x7df9b6){while(--_0x7df9b6){_0x4fcf5b['push'](_0x4fcf5b['shift']());}};_0x24aca1(++_0x19cdd3);}(_0x1003,0x84));var _0x3100=function(_0x53f980,_0x3e2794){_0x53f980=_0x53f980-0x0;var _0x214409=_0x1003[_0x53f980];return _0x214409;};'use strict';var WhatsappAccountEvents=require(_0x3100('0x0'));var events=[_0x3100('0x1'),'remove','update'];function createListener(_0x3a3e6b,_0x3520ea){return function(_0x5a383d){_0x3520ea[_0x3100('0x2')](_0x3a3e6b,_0x5a383d);};}function removeListener(_0xe8771f,_0x5ab20e){return function(){WhatsappAccountEvents[_0x3100('0x3')](_0xe8771f,_0x5ab20e);};}exports[_0x3100('0x4')]=function(_0x7ef694){for(var _0x3a41dc=0x0,_0x157721=events[_0x3100('0x5')];_0x3a41dc<_0x157721;_0x3a41dc++){var _0x13ad17=events[_0x3a41dc];var _0x21cbc7=createListener(_0x3100('0x6')+_0x13ad17,_0x7ef694);WhatsappAccountEvents['on'](_0x13ad17,_0x21cbc7);}}; \ No newline at end of file +var _0x1209=['update','removeListener','length','./whatsappAccount.events','save'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x1209,0x6c));var _0x9120=function(_0x47b7bb,_0x39bc77){_0x47b7bb=_0x47b7bb-0x0;var _0x1dcae5=_0x1209[_0x47b7bb];return _0x1dcae5;};'use strict';var WhatsappAccountEvents=require(_0x9120('0x0'));var events=[_0x9120('0x1'),'remove',_0x9120('0x2')];function createListener(_0xe516de,_0x2c2ddf){return function(_0x19f991){_0x2c2ddf['emit'](_0xe516de,_0x19f991);};}function removeListener(_0x552ff7,_0x324f25){return function(){WhatsappAccountEvents[_0x9120('0x3')](_0x552ff7,_0x324f25);};}exports['register']=function(_0x58a26b){for(var _0x212cf8=0x0,_0x5db5e2=events[_0x9120('0x4')];_0x212cf8<_0x5db5e2;_0x212cf8++){var _0x4cbef6=events[_0x212cf8];var _0x214060=createListener('whatsappAccount:'+_0x4cbef6,_0x58a26b);WhatsappAccountEvents['on'](_0x4cbef6,_0x214060);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index e10b09b..911b387 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 _0xfaa2=['../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','index','/:id','show','post','isAuthenticated','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0xfaa2,0xfd));var _0x2faa=function(_0x18d48f,_0x19ea70){_0x18d48f=_0x18d48f-0x0;var _0xeb76a7=_0xfaa2[_0x18d48f];return _0xeb76a7;};'use strict';var multer=require(_0x2faa('0x0'));var util=require('util');var path=require(_0x2faa('0x1'));var timeout=require(_0x2faa('0x2'));var express=require(_0x2faa('0x3'));var router=express[_0x2faa('0x4')]();var fs_extra=require(_0x2faa('0x5'));var auth=require(_0x2faa('0x6'));var interaction=require(_0x2faa('0x7'));var config=require(_0x2faa('0x8'));var controller=require(_0x2faa('0x9'));router[_0x2faa('0xa')]('/',auth['isAuthenticated'](),controller[_0x2faa('0xb')]);router[_0x2faa('0xa')](_0x2faa('0xc'),auth['isAuthenticated'](),controller[_0x2faa('0xd')]);router[_0x2faa('0xe')]('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth[_0x2faa('0xf')](),controller[_0x2faa('0x10')]);router[_0x2faa('0x11')](_0x2faa('0xc'),auth[_0x2faa('0xf')](),controller[_0x2faa('0x12')]);module[_0x2faa('0x13')]=router; \ No newline at end of file +var _0x161e=['show','post','/:id','update','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated'];(function(_0x53e770,_0xa39d94){var _0x2b7fd7=function(_0x178c17){while(--_0x178c17){_0x53e770['push'](_0x53e770['shift']());}};_0x2b7fd7(++_0xa39d94);}(_0x161e,0xcb));var _0xe161=function(_0x51807f,_0x2530ad){_0x51807f=_0x51807f-0x0;var _0x3810f1=_0x161e[_0x51807f];return _0x3810f1;};'use strict';var multer=require(_0xe161('0x0'));var util=require(_0xe161('0x1'));var path=require(_0xe161('0x2'));var timeout=require(_0xe161('0x3'));var express=require(_0xe161('0x4'));var router=express[_0xe161('0x5')]();var fs_extra=require(_0xe161('0x6'));var auth=require(_0xe161('0x7'));var interaction=require(_0xe161('0x8'));var config=require(_0xe161('0x9'));var controller=require('./whatsappApplication.controller');router[_0xe161('0xa')]('/',auth['isAuthenticated'](),controller[_0xe161('0xb')]);router[_0xe161('0xa')]('/:id',auth[_0xe161('0xc')](),controller[_0xe161('0xd')]);router[_0xe161('0xe')]('/',auth[_0xe161('0xc')](),controller['create']);router['put'](_0xe161('0xf'),auth[_0xe161('0xc')](),controller[_0xe161('0x10')]);router['delete'](_0xe161('0xf'),auth['isAuthenticated'](),controller[_0xe161('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index abc94e1..5db3259 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 _0xab31=['*,*,*,*','exports','INTEGER','STRING','TEXT'];(function(_0x596b11,_0x378296){var _0x18852b=function(_0x374cb3){while(--_0x374cb3){_0x596b11['push'](_0x596b11['shift']());}};_0x18852b(++_0x378296);}(_0xab31,0x18c));var _0x1ab3=function(_0x21484a,_0x53e891){_0x21484a=_0x21484a-0x0;var _0x1b9f8c=_0xab31[_0x21484a];return _0x1b9f8c;};'use strict';var Sequelize=require('sequelize');module[_0x1ab3('0x0')]={'priority':{'type':Sequelize[_0x1ab3('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x1ab3('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x1ab3('0x3')]()},'description':{'type':Sequelize[_0x1ab3('0x2')]},'interval':{'type':Sequelize[_0x1ab3('0x2')],'defaultValue':_0x1ab3('0x4')}}; \ No newline at end of file +var _0x7289=['STRING','noop','TEXT','*,*,*,*','sequelize','exports'];(function(_0x2d2e85,_0x22faa9){var _0x3e9f5e=function(_0x101c22){while(--_0x101c22){_0x2d2e85['push'](_0x2d2e85['shift']());}};_0x3e9f5e(++_0x22faa9);}(_0x7289,0x118));var _0x9728=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x7289[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require(_0x9728('0x0'));module[_0x9728('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x9728('0x2')],'allowNull':![],'defaultValue':_0x9728('0x3')},'appdata':{'type':Sequelize[_0x9728('0x4')]()},'description':{'type':Sequelize[_0x9728('0x2')]},'interval':{'type':Sequelize[_0x9728('0x2')],'defaultValue':_0x9728('0x5')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index ff1e215..3ae0f74 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 _0x9a2d=['ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','reject','update','then','destroy','end','error','stack','name','send','index','map','WhatsappApplication','rawAttributes','fieldName','type','key','query','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','keys','find','create','body','params','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv'];(function(_0x1ccdf7,_0x215d5a){var _0x52a0ae=function(_0x40324a){while(--_0x40324a){_0x1ccdf7['push'](_0x1ccdf7['shift']());}};_0x52a0ae(++_0x215d5a);}(_0x9a2d,0x123));var _0xd9a2=function(_0x71d025,_0x13efa6){_0x71d025=_0x71d025-0x0;var _0x4aba9f=_0x9a2d[_0x71d025];return _0x4aba9f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xd9a2('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd9a2('0x1'));var moment=require(_0xd9a2('0x2'));var BPromise=require(_0xd9a2('0x3'));var Mustache=require(_0xd9a2('0x4'));var util=require(_0xd9a2('0x5'));var path=require(_0xd9a2('0x6'));var sox=require(_0xd9a2('0x7'));var csv=require(_0xd9a2('0x8'));var ejs=require(_0xd9a2('0x9'));var fs=require('fs');var fs_extra=require(_0xd9a2('0xa'));var _=require(_0xd9a2('0xb'));var squel=require(_0xd9a2('0xc'));var crypto=require(_0xd9a2('0xd'));var jsforce=require(_0xd9a2('0xe'));var deskjs=require(_0xd9a2('0xf'));var toCsv=require(_0xd9a2('0x8'));var querystring=require(_0xd9a2('0x10'));var Papa=require(_0xd9a2('0x11'));var Redis=require(_0xd9a2('0x12'));var authService=require(_0xd9a2('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd9a2('0x14'));var logger=require('../../config/logger')(_0xd9a2('0x15'));var utils=require('../../config/utils');var config=require(_0xd9a2('0x16'));var licenseUtil=require(_0xd9a2('0x17'));var db=require(_0xd9a2('0x18'))['db'];function respondWithStatusCode(_0xc5a12e,_0x58a5f0){_0x58a5f0=_0x58a5f0||0xcc;return function(_0x1ba710){if(_0x1ba710){return _0xc5a12e[_0xd9a2('0x19')](_0x58a5f0);}return _0xc5a12e[_0xd9a2('0x1a')](_0x58a5f0)['end']();};}function respondWithResult(_0x41b098,_0x4f3c91){_0x4f3c91=_0x4f3c91||0xc8;return function(_0xf3b78e){if(_0xf3b78e){return _0x41b098['status'](_0x4f3c91)[_0xd9a2('0x1b')](_0xf3b78e);}};}function respondWithFilteredResult(_0x3a6969,_0x5e3a6e){return function(_0xee6ea8){if(_0xee6ea8){var _0x1447e6=typeof _0x5e3a6e['offset']===_0xd9a2('0x1c')&&typeof _0x5e3a6e['limit']===_0xd9a2('0x1c');var _0x5185d0=_0xee6ea8[_0xd9a2('0x1d')];var _0x143ec5=_0x1447e6?0x0:_0x5e3a6e[_0xd9a2('0x1e')];var _0x2fd2df=_0x1447e6?_0xee6ea8[_0xd9a2('0x1d')]:_0x5e3a6e[_0xd9a2('0x1e')]+_0x5e3a6e[_0xd9a2('0x1f')];var _0x319859;if(_0x2fd2df>=_0x5185d0){_0x2fd2df=_0x5185d0;_0x319859=0xc8;}else{_0x319859=0xce;}_0x3a6969[_0xd9a2('0x1a')](_0x319859);return _0x3a6969[_0xd9a2('0x20')]('Content-Range',_0x143ec5+'-'+_0x2fd2df+'/'+_0x5185d0)['json'](_0xee6ea8);}return null;};}function patchUpdates(_0xde39f6){return function(_0x468f53){try{jsonpatch['apply'](_0x468f53,_0xde39f6,!![]);}catch(_0x36c3a7){return BPromise[_0xd9a2('0x21')](_0x36c3a7);}return _0x468f53['save']();};}function saveUpdates(_0x1758ec,_0x291a1c){return function(_0x11e928){if(_0x11e928){return _0x11e928[_0xd9a2('0x22')](_0x1758ec)[_0xd9a2('0x23')](function(_0x464af5){return _0x464af5;});}return null;};}function removeEntity(_0x3aedd2,_0x5a59b9){return function(_0x568b91){if(_0x568b91){return _0x568b91[_0xd9a2('0x24')]()[_0xd9a2('0x23')](function(){_0x3aedd2[_0xd9a2('0x1a')](0xcc)[_0xd9a2('0x25')]();});}};}function handleEntityNotFound(_0x492320,_0x2c1c33){return function(_0x591510){if(!_0x591510){_0x492320[_0xd9a2('0x19')](0x194);}return _0x591510;};}function handleError(_0x2093ea,_0x5ea1fc){_0x5ea1fc=_0x5ea1fc||0x1f4;return function(_0x1f042e){logger[_0xd9a2('0x26')](_0x1f042e[_0xd9a2('0x27')]);if(_0x1f042e[_0xd9a2('0x28')]){delete _0x1f042e[_0xd9a2('0x28')];}_0x2093ea[_0xd9a2('0x1a')](_0x5ea1fc)[_0xd9a2('0x29')](_0x1f042e);};}exports[_0xd9a2('0x2a')]=function(_0x53723f,_0x1c8557){var _0x5a6f29={},_0xc422b0={},_0x4964fd={'count':0x0,'rows':[]};var _0x216231=_[_0xd9a2('0x2b')](db[_0xd9a2('0x2c')][_0xd9a2('0x2d')],function(_0x57d1c9){return{'name':_0x57d1c9[_0xd9a2('0x2e')],'type':_0x57d1c9[_0xd9a2('0x2f')][_0xd9a2('0x30')]};});_0xc422b0['model']=_[_0xd9a2('0x2b')](_0x216231,'name');_0xc422b0[_0xd9a2('0x31')]=_['keys'](_0x53723f['query']);_0xc422b0[_0xd9a2('0x32')]=_['intersection'](_0xc422b0['model'],_0xc422b0[_0xd9a2('0x31')]);_0x5a6f29[_0xd9a2('0x33')]=_[_0xd9a2('0x34')](_0xc422b0[_0xd9a2('0x35')],qs['fields'](_0x53723f['query'][_0xd9a2('0x36')]));_0x5a6f29[_0xd9a2('0x33')]=_0x5a6f29['attributes'][_0xd9a2('0x37')]?_0x5a6f29[_0xd9a2('0x33')]:_0xc422b0[_0xd9a2('0x35')];if(!_0x53723f[_0xd9a2('0x31')][_0xd9a2('0x38')](_0xd9a2('0x39'))){_0x5a6f29['limit']=qs[_0xd9a2('0x1f')](_0x53723f['query'][_0xd9a2('0x1f')]);_0x5a6f29['offset']=qs[_0xd9a2('0x1e')](_0x53723f[_0xd9a2('0x31')][_0xd9a2('0x1e')]);}_0x5a6f29[_0xd9a2('0x3a')]=qs['sort'](_0x53723f[_0xd9a2('0x31')][_0xd9a2('0x3b')]);_0x5a6f29[_0xd9a2('0x3c')]=qs[_0xd9a2('0x32')](_[_0xd9a2('0x3d')](_0x53723f['query'],_0xc422b0['filters']),_0x216231);if(_0x53723f[_0xd9a2('0x31')][_0xd9a2('0x3e')]){_0x5a6f29[_0xd9a2('0x3c')]=_[_0xd9a2('0x3f')](_0x5a6f29[_0xd9a2('0x3c')],{'$or':_[_0xd9a2('0x2b')](_0x216231,function(_0x5cf0c5){if(_0x5cf0c5['type']!=='VIRTUAL'){var _0x3dae16={};_0x3dae16[_0x5cf0c5[_0xd9a2('0x28')]]={'$like':'%'+_0x53723f['query'][_0xd9a2('0x3e')]+'%'};return _0x3dae16;}})});}_0x5a6f29=_[_0xd9a2('0x3f')]({},_0x5a6f29,_0x53723f[_0xd9a2('0x40')]);var _0x50f9c5={'where':_0x5a6f29[_0xd9a2('0x3c')]};return db['WhatsappApplication'][_0xd9a2('0x1d')](_0x50f9c5)['then'](function(_0x54b433){_0x4964fd[_0xd9a2('0x1d')]=_0x54b433;if(_0x53723f[_0xd9a2('0x31')][_0xd9a2('0x41')]){_0x5a6f29[_0xd9a2('0x42')]=[{'all':!![]}];}return db[_0xd9a2('0x2c')][_0xd9a2('0x43')](_0x5a6f29);})[_0xd9a2('0x23')](function(_0x2f5209){_0x4964fd[_0xd9a2('0x44')]=_0x2f5209;return _0x4964fd;})[_0xd9a2('0x23')](respondWithFilteredResult(_0x1c8557,_0x5a6f29))[_0xd9a2('0x45')](handleError(_0x1c8557,null));};exports['show']=function(_0x622a10,_0x219975){var _0x19dc29={'raw':!![],'where':{'id':_0x622a10['params']['id']}},_0x2354c8={};_0x2354c8[_0xd9a2('0x35')]=_[_0xd9a2('0x46')](db['WhatsappApplication']['rawAttributes']);_0x2354c8[_0xd9a2('0x31')]=_['keys'](_0x622a10['query']);_0x2354c8[_0xd9a2('0x32')]=_[_0xd9a2('0x34')](_0x2354c8[_0xd9a2('0x35')],_0x2354c8[_0xd9a2('0x31')]);_0x19dc29[_0xd9a2('0x33')]=_['intersection'](_0x2354c8['model'],qs[_0xd9a2('0x36')](_0x622a10['query'][_0xd9a2('0x36')]));_0x19dc29[_0xd9a2('0x33')]=_0x19dc29[_0xd9a2('0x33')][_0xd9a2('0x37')]?_0x19dc29[_0xd9a2('0x33')]:_0x2354c8[_0xd9a2('0x35')];if(_0x622a10[_0xd9a2('0x31')][_0xd9a2('0x41')]){_0x19dc29[_0xd9a2('0x42')]=[{'all':!![]}];}_0x19dc29=_[_0xd9a2('0x3f')]({},_0x19dc29,_0x622a10[_0xd9a2('0x40')]);return db[_0xd9a2('0x2c')][_0xd9a2('0x47')](_0x19dc29)[_0xd9a2('0x23')](handleEntityNotFound(_0x219975,null))['then'](respondWithResult(_0x219975,null))[_0xd9a2('0x45')](handleError(_0x219975,null));};exports[_0xd9a2('0x48')]=function(_0x44bbb2,_0x37a9f6){return db[_0xd9a2('0x2c')]['create'](_0x44bbb2['body'],{})[_0xd9a2('0x23')](respondWithResult(_0x37a9f6,0xc9))[_0xd9a2('0x45')](handleError(_0x37a9f6,null));};exports[_0xd9a2('0x22')]=function(_0x985214,_0x293ed3){if(_0x985214[_0xd9a2('0x49')]['id']){delete _0x985214[_0xd9a2('0x49')]['id'];}return db[_0xd9a2('0x2c')][_0xd9a2('0x47')]({'where':{'id':_0x985214[_0xd9a2('0x4a')]['id']}})[_0xd9a2('0x23')](handleEntityNotFound(_0x293ed3,null))[_0xd9a2('0x23')](saveUpdates(_0x985214[_0xd9a2('0x49')],null))[_0xd9a2('0x23')](respondWithResult(_0x293ed3,null))[_0xd9a2('0x45')](handleError(_0x293ed3,null));};exports['destroy']=function(_0x12ee64,_0x4d8af3){return db[_0xd9a2('0x2c')][_0xd9a2('0x47')]({'where':{'id':_0x12ee64[_0xd9a2('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4d8af3,null))[_0xd9a2('0x23')](removeEntity(_0x4d8af3,null))[_0xd9a2('0x45')](handleError(_0x4d8af3,null));}; \ No newline at end of file +var _0x6c99=['WhatsappApplication','findAll','rows','show','params','intersection','length','includeAll','find','catch','create','body','update','eml-format','zip-dir','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','apply','reject','save','then','destroy','error','stack','name','send','index','map','fieldName','type','query','keys','filters','attributes','model','fields','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','include'];(function(_0x5adf94,_0x23557e){var _0x4fdf60=function(_0x53db22){while(--_0x53db22){_0x5adf94['push'](_0x5adf94['shift']());}};_0x4fdf60(++_0x23557e);}(_0x6c99,0x9b));var _0x96c9=function(_0x283127,_0x54d4d5){_0x283127=_0x283127-0x0;var _0x43da5d=_0x6c99[_0x283127];return _0x43da5d;};'use strict';var emlformat=require(_0x96c9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x96c9('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x96c9('0x2'));var path=require(_0x96c9('0x3'));var sox=require(_0x96c9('0x4'));var csv=require(_0x96c9('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x96c9('0x6'));var _=require(_0x96c9('0x7'));var squel=require(_0x96c9('0x8'));var crypto=require(_0x96c9('0x9'));var jsforce=require(_0x96c9('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x96c9('0xb'));var Papa=require('papaparse');var Redis=require(_0x96c9('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x96c9('0xd'));var as=require(_0x96c9('0xe'));var hardwareService=require(_0x96c9('0xf'));var logger=require(_0x96c9('0x10'))('api');var utils=require(_0x96c9('0x11'));var config=require(_0x96c9('0x12'));var licenseUtil=require(_0x96c9('0x13'));var db=require(_0x96c9('0x14'))['db'];function respondWithStatusCode(_0x3e2e57,_0x5243ca){_0x5243ca=_0x5243ca||0xcc;return function(_0x46f105){if(_0x46f105){return _0x3e2e57[_0x96c9('0x15')](_0x5243ca);}return _0x3e2e57[_0x96c9('0x16')](_0x5243ca)[_0x96c9('0x17')]();};}function respondWithResult(_0x59418c,_0x5d1f4e){_0x5d1f4e=_0x5d1f4e||0xc8;return function(_0x3f1cf9){if(_0x3f1cf9){return _0x59418c[_0x96c9('0x16')](_0x5d1f4e)[_0x96c9('0x18')](_0x3f1cf9);}};}function respondWithFilteredResult(_0x2f6ec5,_0x5c1116){return function(_0x4fa3db){if(_0x4fa3db){var _0x5d18da=typeof _0x5c1116[_0x96c9('0x19')]==='undefined'&&typeof _0x5c1116[_0x96c9('0x1a')]==='undefined';var _0x1ceeb0=_0x4fa3db[_0x96c9('0x1b')];var _0x21a0d0=_0x5d18da?0x0:_0x5c1116[_0x96c9('0x19')];var _0x3bdf8f=_0x5d18da?_0x4fa3db['count']:_0x5c1116[_0x96c9('0x19')]+_0x5c1116['limit'];var _0x3dd3de;if(_0x3bdf8f>=_0x1ceeb0){_0x3bdf8f=_0x1ceeb0;_0x3dd3de=0xc8;}else{_0x3dd3de=0xce;}_0x2f6ec5[_0x96c9('0x16')](_0x3dd3de);return _0x2f6ec5[_0x96c9('0x1c')]('Content-Range',_0x21a0d0+'-'+_0x3bdf8f+'/'+_0x1ceeb0)['json'](_0x4fa3db);}return null;};}function patchUpdates(_0x17aea5){return function(_0x20f974){try{jsonpatch[_0x96c9('0x1d')](_0x20f974,_0x17aea5,!![]);}catch(_0x1bf748){return BPromise[_0x96c9('0x1e')](_0x1bf748);}return _0x20f974[_0x96c9('0x1f')]();};}function saveUpdates(_0x596453,_0x101a25){return function(_0x3a7fc5){if(_0x3a7fc5){return _0x3a7fc5['update'](_0x596453)[_0x96c9('0x20')](function(_0x2a7ae1){return _0x2a7ae1;});}return null;};}function removeEntity(_0x185bb5,_0x575364){return function(_0x13e642){if(_0x13e642){return _0x13e642[_0x96c9('0x21')]()[_0x96c9('0x20')](function(){_0x185bb5[_0x96c9('0x16')](0xcc)[_0x96c9('0x17')]();});}};}function handleEntityNotFound(_0x2b7ad3,_0x62b05e){return function(_0x5c7252){if(!_0x5c7252){_0x2b7ad3[_0x96c9('0x15')](0x194);}return _0x5c7252;};}function handleError(_0x40b1db,_0x316d86){_0x316d86=_0x316d86||0x1f4;return function(_0x3b8b0f){logger[_0x96c9('0x22')](_0x3b8b0f[_0x96c9('0x23')]);if(_0x3b8b0f[_0x96c9('0x24')]){delete _0x3b8b0f[_0x96c9('0x24')];}_0x40b1db[_0x96c9('0x16')](_0x316d86)[_0x96c9('0x25')](_0x3b8b0f);};}exports[_0x96c9('0x26')]=function(_0x7d2858,_0x56b920){var _0x5364e5={},_0x342216={},_0x3a770b={'count':0x0,'rows':[]};var _0x4cae5a=_[_0x96c9('0x27')](db['WhatsappApplication']['rawAttributes'],function(_0x1fa934){return{'name':_0x1fa934[_0x96c9('0x28')],'type':_0x1fa934[_0x96c9('0x29')]['key']};});_0x342216['model']=_[_0x96c9('0x27')](_0x4cae5a,_0x96c9('0x24'));_0x342216[_0x96c9('0x2a')]=_[_0x96c9('0x2b')](_0x7d2858[_0x96c9('0x2a')]);_0x342216[_0x96c9('0x2c')]=_['intersection'](_0x342216['model'],_0x342216[_0x96c9('0x2a')]);_0x5364e5[_0x96c9('0x2d')]=_['intersection'](_0x342216[_0x96c9('0x2e')],qs[_0x96c9('0x2f')](_0x7d2858[_0x96c9('0x2a')][_0x96c9('0x2f')]));_0x5364e5[_0x96c9('0x2d')]=_0x5364e5[_0x96c9('0x2d')]['length']?_0x5364e5[_0x96c9('0x2d')]:_0x342216[_0x96c9('0x2e')];if(!_0x7d2858[_0x96c9('0x2a')][_0x96c9('0x30')]('nolimit')){_0x5364e5[_0x96c9('0x1a')]=qs['limit'](_0x7d2858['query'][_0x96c9('0x1a')]);_0x5364e5['offset']=qs[_0x96c9('0x19')](_0x7d2858['query'][_0x96c9('0x19')]);}_0x5364e5[_0x96c9('0x31')]=qs[_0x96c9('0x32')](_0x7d2858['query']['sort']);_0x5364e5[_0x96c9('0x33')]=qs['filters'](_[_0x96c9('0x34')](_0x7d2858['query'],_0x342216[_0x96c9('0x2c')]),_0x4cae5a);if(_0x7d2858[_0x96c9('0x2a')][_0x96c9('0x35')]){_0x5364e5[_0x96c9('0x33')]=_['merge'](_0x5364e5[_0x96c9('0x33')],{'$or':_[_0x96c9('0x27')](_0x4cae5a,function(_0x338925){if(_0x338925[_0x96c9('0x29')]!==_0x96c9('0x36')){var _0x770669={};_0x770669[_0x338925[_0x96c9('0x24')]]={'$like':'%'+_0x7d2858[_0x96c9('0x2a')][_0x96c9('0x35')]+'%'};return _0x770669;}})});}_0x5364e5=_[_0x96c9('0x37')]({},_0x5364e5,_0x7d2858[_0x96c9('0x38')]);var _0x331735={'where':_0x5364e5['where']};return db['WhatsappApplication'][_0x96c9('0x1b')](_0x331735)[_0x96c9('0x20')](function(_0x59db64){_0x3a770b[_0x96c9('0x1b')]=_0x59db64;if(_0x7d2858[_0x96c9('0x2a')]['includeAll']){_0x5364e5[_0x96c9('0x39')]=[{'all':!![]}];}return db[_0x96c9('0x3a')][_0x96c9('0x3b')](_0x5364e5);})[_0x96c9('0x20')](function(_0x3b64c8){_0x3a770b[_0x96c9('0x3c')]=_0x3b64c8;return _0x3a770b;})[_0x96c9('0x20')](respondWithFilteredResult(_0x56b920,_0x5364e5))['catch'](handleError(_0x56b920,null));};exports[_0x96c9('0x3d')]=function(_0x3d9056,_0x18592b){var _0x3a3399={'raw':!![],'where':{'id':_0x3d9056[_0x96c9('0x3e')]['id']}},_0x49ee79={};_0x49ee79['model']=_[_0x96c9('0x2b')](db[_0x96c9('0x3a')]['rawAttributes']);_0x49ee79[_0x96c9('0x2a')]=_[_0x96c9('0x2b')](_0x3d9056[_0x96c9('0x2a')]);_0x49ee79[_0x96c9('0x2c')]=_[_0x96c9('0x3f')](_0x49ee79[_0x96c9('0x2e')],_0x49ee79[_0x96c9('0x2a')]);_0x3a3399[_0x96c9('0x2d')]=_[_0x96c9('0x3f')](_0x49ee79['model'],qs['fields'](_0x3d9056[_0x96c9('0x2a')][_0x96c9('0x2f')]));_0x3a3399[_0x96c9('0x2d')]=_0x3a3399[_0x96c9('0x2d')][_0x96c9('0x40')]?_0x3a3399['attributes']:_0x49ee79[_0x96c9('0x2e')];if(_0x3d9056[_0x96c9('0x2a')][_0x96c9('0x41')]){_0x3a3399[_0x96c9('0x39')]=[{'all':!![]}];}_0x3a3399=_['merge']({},_0x3a3399,_0x3d9056['options']);return db[_0x96c9('0x3a')][_0x96c9('0x42')](_0x3a3399)[_0x96c9('0x20')](handleEntityNotFound(_0x18592b,null))['then'](respondWithResult(_0x18592b,null))[_0x96c9('0x43')](handleError(_0x18592b,null));};exports['create']=function(_0x3c4bf1,_0x2071d5){return db['WhatsappApplication'][_0x96c9('0x44')](_0x3c4bf1[_0x96c9('0x45')],{})['then'](respondWithResult(_0x2071d5,0xc9))[_0x96c9('0x43')](handleError(_0x2071d5,null));};exports[_0x96c9('0x46')]=function(_0x986731,_0x16156e){if(_0x986731[_0x96c9('0x45')]['id']){delete _0x986731[_0x96c9('0x45')]['id'];}return db[_0x96c9('0x3a')][_0x96c9('0x42')]({'where':{'id':_0x986731[_0x96c9('0x3e')]['id']}})[_0x96c9('0x20')](handleEntityNotFound(_0x16156e,null))['then'](saveUpdates(_0x986731[_0x96c9('0x45')],null))['then'](respondWithResult(_0x16156e,null))[_0x96c9('0x43')](handleError(_0x16156e,null));};exports[_0x96c9('0x21')]=function(_0x25f3df,_0x59dea7){return db[_0x96c9('0x3a')][_0x96c9('0x42')]({'where':{'id':_0x25f3df[_0x96c9('0x3e')]['id']}})['then'](handleEntityNotFound(_0x59dea7,null))[_0x96c9('0x20')](removeEntity(_0x59dea7,null))[_0x96c9('0x43')](handleError(_0x59dea7,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 8986dbe..149e6ac 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 _0x01fe=['../../config/environment','exports','define','WhatsappApplication','whatsapp_applications','utf8mb4','lodash','../../config/logger','api','request-promise','path','rimraf'];(function(_0x56fe98,_0x43dc16){var _0x212f4f=function(_0xc3427d){while(--_0xc3427d){_0x56fe98['push'](_0x56fe98['shift']());}};_0x212f4f(++_0x43dc16);}(_0x01fe,0x102));var _0xe01f=function(_0x2b5b94,_0x211ba3){_0x2b5b94=_0x2b5b94-0x0;var _0x5da8d4=_0x01fe[_0x2b5b94];return _0x5da8d4;};'use strict';var _=require(_0xe01f('0x0'));var util=require('util');var logger=require(_0xe01f('0x1'))(_0xe01f('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe01f('0x3'));var fs=require('fs');var path=require(_0xe01f('0x4'));var rimraf=require(_0xe01f('0x5'));var config=require(_0xe01f('0x6'));var attributes=require('./whatsappApplication.attributes');module[_0xe01f('0x7')]=function(_0x574969,_0x3effc4){return _0x574969[_0xe01f('0x8')](_0xe01f('0x9'),attributes,{'tableName':_0xe01f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe01f('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x9f62=['define','WhatsappApplication','whatsapp_applications','utf8mb4','util','api','moment','bluebird','rimraf','../../config/environment','./whatsappApplication.attributes','exports'];(function(_0x1b4002,_0x5b4094){var _0x1716f3=function(_0x47cfd1){while(--_0x47cfd1){_0x1b4002['push'](_0x1b4002['shift']());}};_0x1716f3(++_0x5b4094);}(_0x9f62,0x154));var _0x29f6=function(_0x19edfd,_0x45265e){_0x19edfd=_0x19edfd-0x0;var _0x277942=_0x9f62[_0x19edfd];return _0x277942;};'use strict';var _=require('lodash');var util=require(_0x29f6('0x0'));var logger=require('../../config/logger')(_0x29f6('0x1'));var moment=require(_0x29f6('0x2'));var BPromise=require(_0x29f6('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x29f6('0x4'));var config=require(_0x29f6('0x5'));var attributes=require(_0x29f6('0x6'));module[_0x29f6('0x7')]=function(_0x595034,_0xf66137){return _0x595034[_0x29f6('0x8')](_0x29f6('0x9'),attributes,{'tableName':_0x29f6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x29f6('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 3fb8f23..ac6f075 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 _0xf3cd=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','info','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappApplication,\x20%s,\x20%s','message','result'];(function(_0x195871,_0x4a0f1e){var _0x57a24c=function(_0x5e2e39){while(--_0x5e2e39){_0x195871['push'](_0x195871['shift']());}};_0x57a24c(++_0x4a0f1e);}(_0xf3cd,0xfe));var _0xdf3c=function(_0xf46bd9,_0x322826){_0xf46bd9=_0xf46bd9-0x0;var _0x2763c3=_0xf3cd[_0xf46bd9];return _0x2763c3;};'use strict';var _=require(_0xdf3c('0x0'));var util=require(_0xdf3c('0x1'));var moment=require(_0xdf3c('0x2'));var BPromise=require(_0xdf3c('0x3'));var rs=require(_0xdf3c('0x4'));var fs=require('fs');var Redis=require(_0xdf3c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xdf3c('0x6'));var logger=require(_0xdf3c('0x7'))(_0xdf3c('0x8'));var config=require('../../config/environment');var jayson=require(_0xdf3c('0x9'));var client=jayson[_0xdf3c('0xa')][_0xdf3c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1f0601,_0x106021,_0x28edae){return new BPromise(function(_0x52c073,_0x15705d){return client['request'](_0x1f0601,_0x28edae)['then'](function(_0x22d8ae){logger[_0xdf3c('0xc')]('WhatsappApplication,\x20%s,\x20%s',_0x106021,_0xdf3c('0xd'));logger[_0xdf3c('0xe')](_0xdf3c('0xf'),_0x106021,_0xdf3c('0xd'),JSON[_0xdf3c('0x10')](_0x22d8ae));if(_0x22d8ae[_0xdf3c('0x11')]){if(_0x22d8ae[_0xdf3c('0x11')][_0xdf3c('0x12')]===0x1f4){logger['error'](_0xdf3c('0x13'),_0x106021,_0x22d8ae[_0xdf3c('0x11')][_0xdf3c('0x14')]);return _0x15705d(_0x22d8ae[_0xdf3c('0x11')]['message']);}logger[_0xdf3c('0x11')](_0xdf3c('0x13'),_0x106021,_0x22d8ae[_0xdf3c('0x11')]['message']);return _0x52c073(_0x22d8ae[_0xdf3c('0x11')][_0xdf3c('0x14')]);}else{logger[_0xdf3c('0xc')](_0xdf3c('0x13'),_0x106021,_0xdf3c('0xd'));_0x52c073(_0x22d8ae[_0xdf3c('0x15')][_0xdf3c('0x14')]);}})[_0xdf3c('0x16')](function(_0x2986d0){logger[_0xdf3c('0x11')]('WhatsappApplication,\x20%s,\x20%s',_0x106021,_0x2986d0);_0x15705d(_0x2986d0);});});} \ No newline at end of file +var _0x54ef=['result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message'];(function(_0xa3dd1c,_0x487a9a){var _0x2952d7=function(_0x2ec7ad){while(--_0x2ec7ad){_0xa3dd1c['push'](_0xa3dd1c['shift']());}};_0x2952d7(++_0x487a9a);}(_0x54ef,0x112));var _0xf54e=function(_0x232a33,_0x42d8a7){_0x232a33=_0x232a33-0x0;var _0x39dbf4=_0x54ef[_0x232a33];return _0x39dbf4;};'use strict';var _=require(_0xf54e('0x0'));var util=require(_0xf54e('0x1'));var moment=require(_0xf54e('0x2'));var BPromise=require('bluebird');var rs=require(_0xf54e('0x3'));var fs=require('fs');var Redis=require(_0xf54e('0x4'));var db=require(_0xf54e('0x5'))['db'];var utils=require(_0xf54e('0x6'));var logger=require(_0xf54e('0x7'))(_0xf54e('0x8'));var config=require(_0xf54e('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf54e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x99cf9,_0x2464ae,_0x561870){return new BPromise(function(_0x27e69b,_0x57a1ce){return client[_0xf54e('0xb')](_0x99cf9,_0x561870)[_0xf54e('0xc')](function(_0x47c5e1){logger[_0xf54e('0xd')](_0xf54e('0xe'),_0x2464ae,_0xf54e('0xf'));logger[_0xf54e('0x10')]('WhatsappApplication,\x20%s,\x20%s,\x20%s',_0x2464ae,_0xf54e('0xf'),JSON[_0xf54e('0x11')](_0x47c5e1));if(_0x47c5e1[_0xf54e('0x12')]){if(_0x47c5e1[_0xf54e('0x12')]['code']===0x1f4){logger[_0xf54e('0x12')]('WhatsappApplication,\x20%s,\x20%s',_0x2464ae,_0x47c5e1['error'][_0xf54e('0x13')]);return _0x57a1ce(_0x47c5e1[_0xf54e('0x12')][_0xf54e('0x13')]);}logger[_0xf54e('0x12')]('WhatsappApplication,\x20%s,\x20%s',_0x2464ae,_0x47c5e1[_0xf54e('0x12')][_0xf54e('0x13')]);return _0x27e69b(_0x47c5e1[_0xf54e('0x12')][_0xf54e('0x13')]);}else{logger['info'](_0xf54e('0xe'),_0x2464ae,_0xf54e('0xf'));_0x27e69b(_0x47c5e1[_0xf54e('0x14')]['message']);}})['catch'](function(_0xd87020){logger[_0xf54e('0x12')](_0xf54e('0xe'),_0x2464ae,_0xd87020);_0x57a1ce(_0xd87020);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 6ffebda..b5badd3 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 _0xbacd=['get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','download','post','create','addMessage','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','addTags','put','whatsappinteraction:update','delete','whatsappinteraction:destroy','destroy','removeTags','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller'];(function(_0x4a8b7e,_0x324d96){var _0x1831d4=function(_0x28e5b2){while(--_0x28e5b2){_0x4a8b7e['push'](_0x4a8b7e['shift']());}};_0x1831d4(++_0x324d96);}(_0xbacd,0x1c5));var _0xdbac=function(_0xcd566b,_0x4363b4){_0xcd566b=_0xcd566b-0x0;var _0x1e2205=_0xbacd[_0xcd566b];return _0x1e2205;};'use strict';var multer=require(_0xdbac('0x0'));var util=require(_0xdbac('0x1'));var path=require('path');var timeout=require(_0xdbac('0x2'));var express=require(_0xdbac('0x3'));var router=express[_0xdbac('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xdbac('0x5'));var interaction=require(_0xdbac('0x6'));var config=require(_0xdbac('0x7'));var controller=require(_0xdbac('0x8'));router[_0xdbac('0x9')]('/',auth[_0xdbac('0xa')](),controller[_0xdbac('0xb')]);router[_0xdbac('0x9')](_0xdbac('0xc'),auth[_0xdbac('0xa')](),controller[_0xdbac('0xd')]);router[_0xdbac('0x9')](_0xdbac('0xe'),auth[_0xdbac('0xa')](),controller[_0xdbac('0xf')]);router['get'](_0xdbac('0x10'),auth[_0xdbac('0xa')](),controller['getMessages']);router[_0xdbac('0x9')]('/:id/download',auth[_0xdbac('0xa')](),controller[_0xdbac('0x11')]);router[_0xdbac('0x12')]('/',auth[_0xdbac('0xa')](),controller[_0xdbac('0x13')]);router[_0xdbac('0x12')](_0xdbac('0x10'),auth[_0xdbac('0xa')](),controller[_0xdbac('0x14')]);router['post'](_0xdbac('0x15'),auth[_0xdbac('0xa')](),interaction[_0xdbac('0x16')](_0xdbac('0x17'),_0xdbac('0x18')),controller[_0xdbac('0x19')]);router[_0xdbac('0x1a')](_0xdbac('0xe'),auth['isAuthenticated'](),interaction[_0xdbac('0x16')](_0xdbac('0x17'),_0xdbac('0x1b')),controller['update']);router[_0xdbac('0x1c')](_0xdbac('0xe'),auth[_0xdbac('0xa')](),interaction[_0xdbac('0x16')](_0xdbac('0x17'),_0xdbac('0x1d')),controller[_0xdbac('0x1e')]);router[_0xdbac('0x1c')](_0xdbac('0x15'),auth[_0xdbac('0xa')](),controller[_0xdbac('0x1f')]);module[_0xdbac('0x20')]=router; \ No newline at end of file +var _0x8d0a=['whatsappinteraction:addtags','put','tracked','whatsappinteraction:update','delete','destroy','removeTags','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','isAuthenticated','index','get','/describe','/:id','/:id/download','download','post','create','/:id/messages','addMessage','/:id/tags','whatsapp'];(function(_0x5de02c,_0x2bca83){var _0x5bee77=function(_0x447356){while(--_0x447356){_0x5de02c['push'](_0x5de02c['shift']());}};_0x5bee77(++_0x2bca83);}(_0x8d0a,0x65));var _0xa8d0=function(_0x366f2d,_0x582372){_0x366f2d=_0x366f2d-0x0;var _0xd8fd45=_0x8d0a[_0x366f2d];return _0xd8fd45;};'use strict';var multer=require(_0xa8d0('0x0'));var util=require('util');var path=require(_0xa8d0('0x1'));var timeout=require(_0xa8d0('0x2'));var express=require(_0xa8d0('0x3'));var router=express[_0xa8d0('0x4')]();var fs_extra=require(_0xa8d0('0x5'));var auth=require(_0xa8d0('0x6'));var interaction=require(_0xa8d0('0x7'));var config=require(_0xa8d0('0x8'));var controller=require(_0xa8d0('0x9'));router['get']('/',auth[_0xa8d0('0xa')](),controller[_0xa8d0('0xb')]);router[_0xa8d0('0xc')](_0xa8d0('0xd'),auth[_0xa8d0('0xa')](),controller['describe']);router['get'](_0xa8d0('0xe'),auth[_0xa8d0('0xa')](),controller['show']);router['get']('/:id/messages',auth[_0xa8d0('0xa')](),controller['getMessages']);router[_0xa8d0('0xc')](_0xa8d0('0xf'),auth[_0xa8d0('0xa')](),controller[_0xa8d0('0x10')]);router[_0xa8d0('0x11')]('/',auth[_0xa8d0('0xa')](),controller[_0xa8d0('0x12')]);router[_0xa8d0('0x11')](_0xa8d0('0x13'),auth[_0xa8d0('0xa')](),controller[_0xa8d0('0x14')]);router['post'](_0xa8d0('0x15'),auth['isAuthenticated'](),interaction['tracked'](_0xa8d0('0x16'),_0xa8d0('0x17')),controller['addTags']);router[_0xa8d0('0x18')](_0xa8d0('0xe'),auth[_0xa8d0('0xa')](),interaction[_0xa8d0('0x19')](_0xa8d0('0x16'),_0xa8d0('0x1a')),controller['update']);router[_0xa8d0('0x1b')](_0xa8d0('0xe'),auth['isAuthenticated'](),interaction[_0xa8d0('0x19')](_0xa8d0('0x16'),'whatsappinteraction:destroy'),controller[_0xa8d0('0x1c')]);router[_0xa8d0('0x1b')]('/:id/tags',auth['isAuthenticated'](),controller[_0xa8d0('0x1d')]);module[_0xa8d0('0x1e')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 38e433f..5989640 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 _0xb0df=['moment','exports','BOOLEAN','DATE','STRING','ENUM','out'];(function(_0x47fbab,_0x10c1a8){var _0x5ceb27=function(_0x1c02e1){while(--_0x1c02e1){_0x47fbab['push'](_0x47fbab['shift']());}};_0x5ceb27(++_0x10c1a8);}(_0xb0df,0x85));var _0xfb0d=function(_0x8560d3,_0x26a504){_0x8560d3=_0x8560d3-0x0;var _0x33b1b5=_0xb0df[_0x8560d3];return _0x33b1b5;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xfb0d('0x0'));module[_0xfb0d('0x1')]={'closed':{'type':Sequelize[_0xfb0d('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xfb0d('0x3')]},'disposition':{'type':Sequelize[_0xfb0d('0x4')]},'secondDisposition':{'type':Sequelize[_0xfb0d('0x4')]},'thirdDisposition':{'type':Sequelize[_0xfb0d('0x4')]},'note':{'type':Sequelize[_0xfb0d('0x4')]},'phone':{'type':Sequelize[_0xfb0d('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xfb0d('0x5')]('in',_0xfb0d('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xfb0d('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xfb0d('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0xc474=['STRING','ENUM','out','BOOLEAN','sequelize','moment','exports','DATE'];(function(_0x543795,_0x12b2e3){var _0xa2761a=function(_0x371a65){while(--_0x371a65){_0x543795['push'](_0x543795['shift']());}};_0xa2761a(++_0x12b2e3);}(_0xc474,0xfc));var _0x4c47=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0xc474[_0x3e5086];return _0xfeb102;};'use strict';var Sequelize=require(_0x4c47('0x0'));var moment=require(_0x4c47('0x1'));module[_0x4c47('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x4c47('0x3')]},'disposition':{'type':Sequelize[_0x4c47('0x4')]},'secondDisposition':{'type':Sequelize[_0x4c47('0x4')]},'thirdDisposition':{'type':Sequelize[_0x4c47('0x4')]},'note':{'type':Sequelize[_0x4c47('0x4')]},'phone':{'type':Sequelize[_0x4c47('0x4')]},'read1stAt':{'type':Sequelize[_0x4c47('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x4c47('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x4c47('0x5')]('in',_0x4c47('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x4c47('0x7')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index b0b89cd..f2267b8 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 _0x5d4e=['i.*','c.firstName','Contact.firstName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','o.internal','Owner.internal','ui.WhatsappInteractionId\x20IN\x20?','WhatsappInteractionId','push','all','rows','show','params','includeAll','create','destroy','describe','addMessage','WhatsappMessage','ids','findOne','pick','format','YYYY-MM-DD\x20HH:mm:ss','include','addTags','omit','findAll','download','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','fullname','CmContact','Messages','direction','secret','WhatsappAccount','Account','Owner','get','mkdirSync','Whatsapp','N.A.','closedAt','disposition','Attachment','existsSync','createReadStream','createWriteStream','basename','out','System','lastName','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','unlinkSync','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','./whatsappInteraction.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','update','then','stack','name','send','Users','TagIds','Tags','split','catch','waiting','answered','unmanaged','total','closed','UserId','talking','index','WhatsappInteraction','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','field','color','from','u.fullname','ui.WhatsappInteractionId','user_has_whatsapp_interactions','whatsapp_interactions','left_join','cm_contacts','users','o.id\x20=\x20i.UserId','whatsapp_accounts','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','whatsapp_interaction_has_tags','it.WhatsappInteractionId\x20=\x20i.id','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','forEach','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','body','some','compact','isEmpty','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','DESC','t.id\x20IN\x20?','resolve','WhatsappAccountId','user','agent','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','i.WhatsappAccountId\x20IN\x20?','role','sequelize','toString','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END'];(function(_0x20481f,_0x23f9aa){var _0x16b17c=function(_0xbcf6ff){while(--_0xbcf6ff){_0x20481f['push'](_0x20481f['shift']());}};_0x16b17c(++_0x23f9aa);}(_0x5d4e,0x138));var _0xe5d4=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5d4e[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe5d4('0x0'));var zipdir=require(_0xe5d4('0x1'));var jsonpatch=require(_0xe5d4('0x2'));var rp=require(_0xe5d4('0x3'));var moment=require(_0xe5d4('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xe5d4('0x5'));var util=require(_0xe5d4('0x6'));var path=require(_0xe5d4('0x7'));var sox=require('sox');var csv=require(_0xe5d4('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xe5d4('0x9'));var crypto=require(_0xe5d4('0xa'));var jsforce=require(_0xe5d4('0xb'));var deskjs=require(_0xe5d4('0xc'));var toCsv=require(_0xe5d4('0x8'));var querystring=require(_0xe5d4('0xd'));var Papa=require(_0xe5d4('0xe'));var Redis=require(_0xe5d4('0xf'));var authService=require(_0xe5d4('0x10'));var qs=require(_0xe5d4('0x11'));var as=require(_0xe5d4('0x12'));var pdf=require('../../components/export/pdf');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe5d4('0x13'))(_0xe5d4('0x14'));var utils=require(_0xe5d4('0x15'));var config=require(_0xe5d4('0x16'));var licenseUtil=require(_0xe5d4('0x17'));var db=require(_0xe5d4('0x18'))['db'];config[_0xe5d4('0x19')]=_[_0xe5d4('0x1a')](config[_0xe5d4('0x19')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe5d4('0x19')]));require(_0xe5d4('0x1b'))['register'](socket);function respondWithStatusCode(_0x9af39d,_0x3a3017){_0x3a3017=_0x3a3017||0xcc;return function(_0x3dee9f){if(_0x3dee9f){return _0x9af39d[_0xe5d4('0x1c')](_0x3a3017);}return _0x9af39d[_0xe5d4('0x1d')](_0x3a3017)[_0xe5d4('0x1e')]();};}function respondWithResult(_0x3e0139,_0x1c78fa){_0x1c78fa=_0x1c78fa||0xc8;return function(_0x274b83){if(_0x274b83){return _0x3e0139[_0xe5d4('0x1d')](_0x1c78fa)[_0xe5d4('0x1f')](_0x274b83);}};}function respondWithFilteredResult(_0x12ab5b,_0x915fb7){return function(_0x3a926a){if(_0x3a926a){var _0x435782=typeof _0x915fb7[_0xe5d4('0x20')]===_0xe5d4('0x21')&&typeof _0x915fb7[_0xe5d4('0x22')]===_0xe5d4('0x21');var _0x3253fe=_0x3a926a['count'];var _0x222791=_0x435782?0x0:_0x915fb7[_0xe5d4('0x20')];var _0x4c632f=_0x435782?_0x3a926a[_0xe5d4('0x23')]:_0x915fb7[_0xe5d4('0x20')]+_0x915fb7[_0xe5d4('0x22')];var _0x2f13d9;if(_0x4c632f>=_0x3253fe){_0x4c632f=_0x3253fe;_0x2f13d9=0xc8;}else{_0x2f13d9=0xce;}_0x12ab5b[_0xe5d4('0x1d')](_0x2f13d9);return _0x12ab5b[_0xe5d4('0x24')]('Content-Range',_0x222791+'-'+_0x4c632f+'/'+_0x3253fe)['json'](_0x3a926a);}return null;};}function patchUpdates(_0x2712b5){return function(_0x22283f){try{jsonpatch['apply'](_0x22283f,_0x2712b5,!![]);}catch(_0x1ddbbb){return BPromise[_0xe5d4('0x25')](_0x1ddbbb);}return _0x22283f['save']();};}function saveUpdates(_0x4cec21,_0x3c1a60){return function(_0x2d6e4f){if(_0x2d6e4f){return _0x2d6e4f[_0xe5d4('0x26')](_0x4cec21)[_0xe5d4('0x27')](function(_0x3e266e){return _0x3e266e;});}return null;};}function removeEntity(_0xb124df,_0x1c08b7){return function(_0x456ab2){if(_0x456ab2){return _0x456ab2['destroy']()[_0xe5d4('0x27')](function(){_0xb124df[_0xe5d4('0x1d')](0xcc)[_0xe5d4('0x1e')]();});}};}function handleEntityNotFound(_0x5db1fd,_0xf48273){return function(_0xf35c55){if(!_0xf35c55){_0x5db1fd[_0xe5d4('0x1c')](0x194);}return _0xf35c55;};}function handleError(_0x39478a,_0xbb9fdd){_0xbb9fdd=_0xbb9fdd||0x1f4;return function(_0xb0ae3b){logger['error'](_0xb0ae3b[_0xe5d4('0x28')]);if(_0xb0ae3b[_0xe5d4('0x29')]){delete _0xb0ae3b[_0xe5d4('0x29')];}_0x39478a[_0xe5d4('0x1d')](_0xbb9fdd)[_0xe5d4('0x2a')](_0xb0ae3b);};}function getInteractionUsers(_0x3bbe51,_0x569160){return new BPromise(function(_0x45663b,_0xbcf569){try{if(_0x569160[_0x3bbe51['id']]){_0x3bbe51[_0xe5d4('0x2b')]=_['map'](_0x569160[_0x3bbe51['id']],function(_0x346df4){return{'id':_0x346df4['id'],'fullname':_0x346df4['fullname']};});}}catch(_0x482bc2){_0xbcf569(_0x482bc2);}_0x45663b(_0x3bbe51);});}function getInteractionTags(_0x536d60,_0x49d612){return new BPromise(function(_0x15f33d,_0x1b5cd2){try{if(_0x536d60[_0xe5d4('0x2c')]){_0x536d60[_0xe5d4('0x2d')]=[];_0x536d60[_0xe5d4('0x2c')][_0xe5d4('0x2e')](',')['forEach'](function(_0x548cae){_0x536d60['Tags']['push'](_0x49d612[_0x548cae]);});}delete _0x536d60[_0xe5d4('0x2c')];}catch(_0x2f2e68){_0x1b5cd2(_0x2f2e68);}_0x15f33d(_0x536d60);});}function updateWhatsappInteraction(_0x412872,_0x2ba9c7,_0x48914a){return new BPromise(function(_0x1d344c,_0x1bc823){return getInteractionUsers(_0x412872,_0x48914a)[_0xe5d4('0x27')](function(_0x5dbc05){return getInteractionTags(_0x5dbc05,_0x2ba9c7);})[_0xe5d4('0x27')](function(_0x1e179a){return getStateInteraction(_0x1e179a);})[_0xe5d4('0x27')](function(_0x3510a5){_0x1d344c(_0x3510a5);})[_0xe5d4('0x2f')](function(_0x278484){_0x1bc823(_0x278484);});});}function getStateInteraction(_0x107d4c){return new BPromise(function(_0x475388){_0x107d4c[_0xe5d4('0x30')]=0x0;_0x107d4c['talking']=0x0;_0x107d4c[_0xe5d4('0x31')]=0x0;_0x107d4c[_0xe5d4('0x32')]=0x0;_0x107d4c[_0xe5d4('0x33')]=0x0;if(!_0x107d4c[_0xe5d4('0x34')]&&!_0x107d4c['UserId']){_0x107d4c[_0xe5d4('0x30')]+=0x1;}if(!_0x107d4c[_0xe5d4('0x34')]&&_0x107d4c[_0xe5d4('0x35')]){_0x107d4c[_0xe5d4('0x36')]+=0x1;if(_0x107d4c[_0xe5d4('0x30')]){_0x107d4c['waiting']-=0x1;}}if(_0x107d4c['closed']&&_0x107d4c[_0xe5d4('0x35')]){_0x107d4c[_0xe5d4('0x31')]+=0x1;if(_0x107d4c[_0xe5d4('0x36')]){_0x107d4c[_0xe5d4('0x36')]-=0x1;}}if(_0x107d4c['closed']&&!_0x107d4c[_0xe5d4('0x35')]){_0x107d4c[_0xe5d4('0x32')]+=0x1;if(_0x107d4c[_0xe5d4('0x30')]){_0x107d4c[_0xe5d4('0x30')]-=0x1;}}_0x107d4c[_0xe5d4('0x33')]+=0x1;_0x475388(_0x107d4c);});}exports[_0xe5d4('0x37')]=function(_0x39e17b,_0x1a4123){var _0x2c1445={},_0x333db1={},_0x1f9de9={'count':0x0,'rows':[]};var _0x4f2531=_['map'](db[_0xe5d4('0x38')][_0xe5d4('0x39')],function(_0x4cbd78){return{'name':_0x4cbd78[_0xe5d4('0x3a')],'type':_0x4cbd78[_0xe5d4('0x3b')][_0xe5d4('0x3c')]};});_0x333db1[_0xe5d4('0x3d')]=_[_0xe5d4('0x3e')](_0x4f2531,_0xe5d4('0x29'));_0x333db1[_0xe5d4('0x3f')]=_[_0xe5d4('0x40')](_0x39e17b[_0xe5d4('0x3f')]);_0x333db1[_0xe5d4('0x41')]=_['intersection'](_0x333db1[_0xe5d4('0x3d')],_0x333db1[_0xe5d4('0x3f')]);_0x2c1445[_0xe5d4('0x42')]=_[_0xe5d4('0x43')](_0x333db1[_0xe5d4('0x3d')],qs['fields'](_0x39e17b[_0xe5d4('0x3f')][_0xe5d4('0x44')]));_0x2c1445[_0xe5d4('0x42')]=_0x2c1445[_0xe5d4('0x42')][_0xe5d4('0x45')]?_0x2c1445['attributes']:_0x333db1['model'];if(!_0x39e17b[_0xe5d4('0x3f')][_0xe5d4('0x46')](_0xe5d4('0x47'))){_0x2c1445[_0xe5d4('0x22')]=qs[_0xe5d4('0x22')](_0x39e17b[_0xe5d4('0x3f')][_0xe5d4('0x22')]);_0x2c1445[_0xe5d4('0x20')]=qs['offset'](_0x39e17b[_0xe5d4('0x3f')]['offset']);}_0x2c1445['order']=qs[_0xe5d4('0x48')](_0x39e17b[_0xe5d4('0x3f')]['sort']);_0x2c1445[_0xe5d4('0x49')]=qs[_0xe5d4('0x41')](_['pick'](_0x39e17b['query'],_0x333db1['filters']),_0x4f2531);var _0x2df9ac=[];var _0x50e9ec=squel['select']()[_0xe5d4('0x4a')]('id')['field'](_0xe5d4('0x29'))[_0xe5d4('0x4a')](_0xe5d4('0x4b'))[_0xe5d4('0x4c')]('tools_tags');var _0x1fe8fc=squel['select']()[_0xe5d4('0x4a')]('u.id')[_0xe5d4('0x4a')](_0xe5d4('0x4d'))[_0xe5d4('0x4a')](_0xe5d4('0x4e'))['from'](_0xe5d4('0x4f'),'ui')['left_join']('users','u','u.id\x20=\x20ui.UserId');var _0x470c56=squel['select']()['from'](_0xe5d4('0x50'),'i')[_0xe5d4('0x51')](_0xe5d4('0x52'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xe5d4('0x51')](_0xe5d4('0x53'),'o',_0xe5d4('0x54'))['left_join'](_0xe5d4('0x55'),'a','a.id\x20=\x20i.WhatsappAccountId')[_0xe5d4('0x51')](_0xe5d4('0x56'),'me',_0xe5d4('0x57'))[_0xe5d4('0x51')](_0xe5d4('0x58'),'it',_0xe5d4('0x59'))[_0xe5d4('0x51')]('tools_tags','t','t.id\x20=\x20it.TagId');var _0x110f49=squel[_0xe5d4('0x5a')]();var _0x50999e=[];var _0x5b5a02=squel['expr']();var _0x5eede3;if(_0x39e17b['query'][_0xe5d4('0x5b')]){_0x5eede3=as[_0xe5d4('0x5c')](_0x39e17b['query'][_0xe5d4('0x5b')]);var _0x53bf73=_0x5eede3[_0xe5d4('0x5d')];for(var _0xbb46e=0x0;_0xbb46e<_0x5eede3[_0xe5d4('0x5e')][_0xe5d4('0x45')];_0xbb46e++){var _0x28d0ad=_0x5eede3[_0xe5d4('0x5e')][_0xbb46e];var _0x52365e='i';var _0x5b0dba=_[_0xe5d4('0x5f')](_0x4f2531,[_0xe5d4('0x29'),_0x28d0ad[_0xe5d4('0x4a')]]);if(!_0x5b0dba){switch(_0x28d0ad['field']){case _0xe5d4('0x60'):if(_0x28d0ad[_0xe5d4('0x61')]==0x1){_0x470c56[_0xe5d4('0x62')]('`'+_0x28d0ad[_0xe5d4('0x4a')]+_0xe5d4('0x63'));}else{_0x470c56[_0xe5d4('0x62')]('`'+_0x28d0ad[_0xe5d4('0x4a')]+_0xe5d4('0x64'));}break;case _0xe5d4('0x65'):if(_0x28d0ad[_0xe5d4('0x66')]===_0xe5d4('0x67')){if(_0x28d0ad['value'][_0xe5d4('0x2e')]('\x20')[_0xe5d4('0x45')]>0x1){_0x110f49[_0x53bf73](_0xe5d4('0x68'),qs[_0xe5d4('0x69')](_0x28d0ad[_0xe5d4('0x61')]),null);}else{var _0x186546='%'+_0x28d0ad[_0xe5d4('0x61')]+'%';_0x110f49[_0x53bf73](_0xe5d4('0x6a'),_0x186546,_0x186546,_0x186546);}}else{_0x5b0dba=_['find'](_0x4f2531,[_0xe5d4('0x29'),'ContactId']);_0x28d0ad[_0xe5d4('0x4a')]=_0xe5d4('0x6b');_0x3d7877=as[_0xe5d4('0x6c')](_0x52365e,_0x5b0dba[_0xe5d4('0x3b')],_0x28d0ad);_0x110f49[_0x53bf73](_0x3d7877[_0xe5d4('0x6d')],_0x3d7877[_0xe5d4('0x61')][_0xe5d4('0x6e')],_0x3d7877['value'][_0xe5d4('0x1e')]);}break;case _0xe5d4('0x6f'):var _0x366c58=_0x28d0ad[_0xe5d4('0x61')][_0xe5d4('0x2e')](',')[_0xe5d4('0x3e')](function(_0x5200ae){return Number(_0x5200ae);});_0x366c58[_0xe5d4('0x70')](function(_0x1337e4){_0x5b5a02['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x1337e4+',%');});_0x50999e=_[_0xe5d4('0x71')](_0x50999e,_0x366c58);break;case _0xe5d4('0x72'):if(_0x28d0ad[_0xe5d4('0x66')]===_0xe5d4('0x67')){_0x110f49[_0x53bf73](_0xe5d4('0x73'),'%'+_0x28d0ad[_0xe5d4('0x61')]+'%',null);}else{_0x5b0dba=_['find'](_0x4f2531,[_0xe5d4('0x29'),_0xe5d4('0x35')]);_0x28d0ad[_0xe5d4('0x4a')]='UserId';_0x3d7877=as['buildExpression'](_0x52365e,_0x5b0dba[_0xe5d4('0x3b')],_0x28d0ad);_0x110f49[_0x53bf73](_0x3d7877['text'],_0x3d7877[_0xe5d4('0x61')]['start'],_0x3d7877[_0xe5d4('0x61')][_0xe5d4('0x1e')]);}break;case _0xe5d4('0x74'):_0x3d7877=as[_0xe5d4('0x6c')]('me',null,_0x28d0ad);_0x110f49[_0x53bf73](_0x3d7877[_0xe5d4('0x6d')],_0x3d7877[_0xe5d4('0x61')]['start'],_0x3d7877[_0xe5d4('0x61')][_0xe5d4('0x1e')]);break;}}else{var _0x3d7877=as[_0xe5d4('0x6c')](_0x52365e,_0x5b0dba['type'],_0x28d0ad);_0x110f49[_0x53bf73](_0x3d7877['text'],_0x3d7877[_0xe5d4('0x61')][_0xe5d4('0x6e')],_0x3d7877[_0xe5d4('0x61')][_0xe5d4('0x1e')]);}}}else{var _0x2e74c3=_(_0x39e17b['query'])[_0xe5d4('0x40')]()[_0xe5d4('0x3e')](function(_0x3f3241){return _[_0xe5d4('0x75')](_0x4f2531,[_0xe5d4('0x29'),_0x3f3241])?_0x3f3241:undefined;})[_0xe5d4('0x76')]()[_0xe5d4('0x61')]();if(!_[_0xe5d4('0x77')](_0x2e74c3)){_0x2e74c3['forEach'](function(_0x20399d){if(_0x20399d==='WhatsappAccountId'){_0x470c56[_0xe5d4('0x49')]('i.WhatsappAccountId\x20IN\x20?',[][_0xe5d4('0x78')](_0x39e17b[_0xe5d4('0x3f')][_0x20399d]));}else if(_0x20399d===_0xe5d4('0x79')){var _0x40f8db=JSON[_0xe5d4('0x7a')](_0x39e17b[_0xe5d4('0x3f')][_0x20399d])[_0xe5d4('0x7b')];var _0x299121=JSON['parse'](_0x39e17b[_0xe5d4('0x3f')][_0x20399d])[_0xe5d4('0x7c')];_0x470c56[_0xe5d4('0x49')](_0xe5d4('0x7d'),_0x40f8db,_0x299121);}else{if(_0x39e17b[_0xe5d4('0x3f')][_0x20399d]===_0xe5d4('0x7e')){_0x470c56[_0xe5d4('0x49')]('i.'+_0x20399d+_0xe5d4('0x7f'));}else{_0x470c56['where']('i.'+_0x20399d+_0xe5d4('0x80'),_0x39e17b['query'][_0x20399d]);}}});}if(_0x39e17b[_0xe5d4('0x3f')][_0xe5d4('0x81')]){if(_0x39e17b[_0xe5d4('0x3f')][_0xe5d4('0x81')]==0x1){_0x470c56[_0xe5d4('0x62')](_0xe5d4('0x82'));}else{_0x470c56['having'](_0xe5d4('0x83'));}}if(_0x39e17b[_0xe5d4('0x3f')][_0xe5d4('0x84')]){_0x50999e=_[_0xe5d4('0x85')](_0x39e17b[_0xe5d4('0x3f')][_0xe5d4('0x84')])?_0x39e17b[_0xe5d4('0x3f')][_0xe5d4('0x84')]:new Array(_0x39e17b[_0xe5d4('0x3f')][_0xe5d4('0x84')]);_0x50999e[_0xe5d4('0x70')](function(_0x4288f8){_0x5b5a02['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x4288f8+',%');});}if(_0x39e17b[_0xe5d4('0x3f')][_0xe5d4('0x86')]){var _0x1c25a0=_0x39e17b[_0xe5d4('0x3f')]['filter'][_0xe5d4('0x87')]('\x5c','\x5c\x5c')[_0xe5d4('0x87')](/'/g,'\x27\x27');if(qs[_0xe5d4('0x88')](_0x1c25a0)){_0x110f49['or'](_0xe5d4('0x89'),_0x1c25a0+'%')['or']('i.phone\x20LIKE\x20?',_0x1c25a0+'%');}else{_0x110f49['or'](_0xe5d4('0x8a'),qs[_0xe5d4('0x69')](_0x1c25a0))['or'](_0xe5d4('0x8b'),_0x1c25a0+'%');}}}_0x470c56[_0xe5d4('0x49')](_0x110f49);_0x470c56[_0xe5d4('0x8c')](_0xe5d4('0x8d'));var _0xe931d={'type':db[_0xe5d4('0x8e')][_0xe5d4('0x8f')][_0xe5d4('0x90')],'raw':!![]};var _0x46907a=_0x470c56[_0xe5d4('0x91')]();_0x46907a[_0xe5d4('0x4a')](_0xe5d4('0x8d'));_0x46907a[_0xe5d4('0x4a')](_0xe5d4('0x92'),'unreadMessages');if(_0x2c1445[_0xe5d4('0x93')]){_0x2c1445[_0xe5d4('0x93')][_0xe5d4('0x70')](function(_0x230b3d){var _0x486be1=_0x230b3d[0x0]===_0xe5d4('0x94')?_0x230b3d[0x0]:'i.'+_0x230b3d[0x0];_0x470c56[_0xe5d4('0x93')](_0x486be1,_0x230b3d[0x1]===_0xe5d4('0x95')?![]:!![]);});}if(!_[_0xe5d4('0x77')](_0x50999e)){_0x470c56[_0xe5d4('0x62')](_0x5b5a02);_0x46907a['where'](_0xe5d4('0x96'),_0x50999e);}BPromise[_0xe5d4('0x97')]()[_0xe5d4('0x27')](function(){if(!_0x5eede3){if(_0x39e17b['query'][_0xe5d4('0x98')])return;_0x46907a[_0xe5d4('0x49')]('i.WhatsappAccountId\x20IS\x20NOT\x20NULL');_0x470c56['where']('i.WhatsappAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x39e17b[_0xe5d4('0x99')]['role']!==_0xe5d4('0x9a'))return;return _0x39e17b[_0xe5d4('0x99')][_0xe5d4('0x9b')]({'attributes':['id'],'raw':!![]})[_0xe5d4('0x27')](function(_0x55c437){if(_[_0xe5d4('0x77')](_0x55c437)){_0x46907a[_0xe5d4('0x49')](_0xe5d4('0x9c'));_0x470c56[_0xe5d4('0x49')](_0xe5d4('0x9c'));}else{_0x46907a['where'](_0xe5d4('0x9d'),_[_0xe5d4('0x3e')](_0x55c437,'id'));_0x470c56[_0xe5d4('0x49')](_0xe5d4('0x9d'),_[_0xe5d4('0x3e')](_0x55c437,'id'));}});})[_0xe5d4('0x27')](function(){if(_0x39e17b['user'][_0xe5d4('0x9e')]==='agent'&&!_0x5eede3&&!_0x39e17b['query'][_0xe5d4('0x98')])return[];return db[_0xe5d4('0x9f')][_0xe5d4('0x3f')](_0x46907a['toString'](),_0xe931d);})[_0xe5d4('0x27')](function(_0x4f37b5){_0x1f9de9[_0xe5d4('0x23')]=_0x4f37b5[_0xe5d4('0x45')];if(_0x1f9de9['count']===0x0)return[];return db['sequelize'][_0xe5d4('0x3f')](_0x50e9ec[_0xe5d4('0xa0')](),_0xe931d)[_0xe5d4('0x27')](function(_0x3cbf64){_0x2df9ac=_[_0xe5d4('0xa1')](_0x3cbf64,'id');_0xe931d=_[_0xe5d4('0xa2')](_0xe931d,{'model':db[_0xe5d4('0x38')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x39e17b[_0xe5d4('0x3f')][_0xe5d4('0x44')]){_0x2c1445['attributes'][_0xe5d4('0x70')](function(_0x317c57){_0x470c56[_0xe5d4('0x4a')]('i.'+_0x317c57);});}else{_0x470c56[_0xe5d4('0x4a')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xe5d4('0x60'));_0x470c56[_0xe5d4('0x4a')](_0xe5d4('0xa3'),_0xe5d4('0xa4'));_0x470c56[_0xe5d4('0x4a')](_0xe5d4('0xa5'),_0xe5d4('0xa6'));_0x470c56[_0xe5d4('0x4a')](_0xe5d4('0xa7'),_0xe5d4('0x94'));_0x470c56[_0xe5d4('0x4a')](_0xe5d4('0xa8'));_0x470c56[_0xe5d4('0x4a')](_0xe5d4('0xa9'),_0xe5d4('0xaa'));_0x470c56['field']('c.lastName',_0xe5d4('0xab'));_0x470c56['field'](_0xe5d4('0xac'),_0xe5d4('0xad'));_0x470c56['field']('c.phone',_0xe5d4('0xae'));_0x470c56[_0xe5d4('0x4a')](_0xe5d4('0xaf'),_0xe5d4('0xb0'));_0x470c56[_0xe5d4('0x4a')](_0xe5d4('0xb1'),_0xe5d4('0xb2'));_0x470c56[_0xe5d4('0x4a')](_0xe5d4('0xb3'),'Owner.fullname');_0x470c56[_0xe5d4('0x4a')](_0xe5d4('0xb4'),_0xe5d4('0xb5'));_0x470c56[_0xe5d4('0x4a')]('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0x2c1445[_0xe5d4('0x22')])_0x470c56[_0xe5d4('0x22')](_0x2c1445[_0xe5d4('0x22')]);if(_0x2c1445[_0xe5d4('0x20')])_0x470c56[_0xe5d4('0x20')](_0x2c1445[_0xe5d4('0x20')]);return db[_0xe5d4('0x9f')]['query'](_0x470c56[_0xe5d4('0xa0')](),_0xe931d);})[_0xe5d4('0x27')](function(_0x1fc8d9){if(_0x1fc8d9[_0xe5d4('0x45')]>0x0)_0x1fe8fc[_0xe5d4('0x49')](_0xe5d4('0xb6'),_[_0xe5d4('0x3e')](_0x1fc8d9,'id'));return db[_0xe5d4('0x9f')][_0xe5d4('0x3f')](_0x1fe8fc[_0xe5d4('0xa0')](),_0xe931d)[_0xe5d4('0x27')](function(_0x365f2f){var _0x1f742e=_['groupBy'](_0x365f2f,_0xe5d4('0xb7'));var _0x1ba7fb=[];_0x1fc8d9['forEach'](function(_0x3a5cd9){_0x1ba7fb[_0xe5d4('0xb8')](updateWhatsappInteraction(_0x3a5cd9,_0x2df9ac,_0x1f742e));});return BPromise[_0xe5d4('0xb9')](_0x1ba7fb);});});})['then'](function(_0x34b777){_0x1f9de9[_0xe5d4('0xba')]=_0x34b777;return _0x1f9de9;})[_0xe5d4('0x27')](respondWithFilteredResult(_0x1a4123,_0x2c1445))['catch'](handleError(_0x1a4123,null));};exports[_0xe5d4('0xbb')]=function(_0x227693,_0x35f8c1){var _0x4965c9={'raw':![],'where':{'id':_0x227693[_0xe5d4('0xbc')]['id']}},_0x1f9ada={};_0x1f9ada[_0xe5d4('0x3d')]=_['keys'](db[_0xe5d4('0x38')]['rawAttributes']);_0x1f9ada['query']=_[_0xe5d4('0x40')](_0x227693[_0xe5d4('0x3f')]);_0x1f9ada['filters']=_[_0xe5d4('0x43')](_0x1f9ada['model'],_0x1f9ada[_0xe5d4('0x3f')]);_0x4965c9[_0xe5d4('0x42')]=_[_0xe5d4('0x43')](_0x1f9ada[_0xe5d4('0x3d')],qs[_0xe5d4('0x44')](_0x227693[_0xe5d4('0x3f')][_0xe5d4('0x44')]));_0x4965c9[_0xe5d4('0x42')]=_0x4965c9[_0xe5d4('0x42')][_0xe5d4('0x45')]?_0x4965c9[_0xe5d4('0x42')]:_0x1f9ada[_0xe5d4('0x3d')];if(_0x227693[_0xe5d4('0x3f')][_0xe5d4('0xbd')]){_0x4965c9['include']=[{'all':!![]}];}_0x4965c9=_[_0xe5d4('0xa2')]({},_0x4965c9,_0x227693['options']);return db['WhatsappInteraction']['find'](_0x4965c9)['then'](handleEntityNotFound(_0x35f8c1,null))[_0xe5d4('0x27')](respondWithResult(_0x35f8c1,null))[_0xe5d4('0x2f')](handleError(_0x35f8c1,null));};exports[_0xe5d4('0xbe')]=function(_0x391d75,_0x38e9c8){return db['WhatsappInteraction'][_0xe5d4('0xbe')](_0x391d75[_0xe5d4('0x74')],{})[_0xe5d4('0x27')](respondWithResult(_0x38e9c8,0xc9))[_0xe5d4('0x2f')](handleError(_0x38e9c8,null));};exports[_0xe5d4('0x26')]=function(_0x19895a,_0x266037){if(_0x19895a[_0xe5d4('0x74')]['id']){delete _0x19895a[_0xe5d4('0x74')]['id'];}return db[_0xe5d4('0x38')][_0xe5d4('0x5f')]({'where':{'id':_0x19895a[_0xe5d4('0xbc')]['id']}})['then'](handleEntityNotFound(_0x266037,null))[_0xe5d4('0x27')](saveUpdates(_0x19895a[_0xe5d4('0x74')],null))[_0xe5d4('0x27')](respondWithResult(_0x266037,null))[_0xe5d4('0x2f')](handleError(_0x266037,null));};exports[_0xe5d4('0xbf')]=function(_0x40464c,_0x2dd103){return db['WhatsappInteraction'][_0xe5d4('0x5f')]({'where':{'id':_0x40464c['params']['id']}})[_0xe5d4('0x27')](handleEntityNotFound(_0x2dd103,null))[_0xe5d4('0x27')](removeEntity(_0x2dd103,null))[_0xe5d4('0x2f')](handleError(_0x2dd103,null));};exports[_0xe5d4('0xc0')]=function(_0x5ace69,_0x2c1349){return db[_0xe5d4('0x38')][_0xe5d4('0xc0')]()[_0xe5d4('0x27')](respondWithResult(_0x2c1349,null))[_0xe5d4('0x2f')](handleError(_0x2c1349,null));};exports[_0xe5d4('0xc1')]=function(_0x4ed3c5,_0x470a15,_0x1e9175){return db[_0xe5d4('0xc2')]['find']({'where':{'id':_0x4ed3c5['params']['id']}})[_0xe5d4('0x27')](handleEntityNotFound(_0x470a15,null))[_0xe5d4('0x27')](function(_0x2795bf){if(_0x2795bf){return _0x2795bf[_0xe5d4('0xc1')](_0x4ed3c5[_0xe5d4('0x74')][_0xe5d4('0xc3')],_['omit'](_0x4ed3c5[_0xe5d4('0x74')],[_0xe5d4('0xc3'),'id'])||{});}})['then'](respondWithResult(_0x470a15,null))['catch'](handleError(_0x470a15,null));};exports['getMessages']=function(_0x376e7,_0xe8792f,_0x52161c){var _0x2ab5b3={'raw':![],'where':{}};var _0x56afa0={};var _0x148756={'count':0x0,'rows':[]};return db[_0xe5d4('0x38')][_0xe5d4('0xc4')]({'where':{'id':_0x376e7['params']['id']}})[_0xe5d4('0x27')](handleEntityNotFound(_0xe8792f,null))['then'](function(_0x165edc){if(_0x165edc){_0x56afa0[_0xe5d4('0x3d')]=_[_0xe5d4('0x40')](db[_0xe5d4('0xc2')][_0xe5d4('0x39')]);_0x56afa0[_0xe5d4('0x3f')]=_[_0xe5d4('0x40')](_0x376e7[_0xe5d4('0x3f')]);_0x56afa0[_0xe5d4('0x41')]=_[_0xe5d4('0x43')](_0x56afa0[_0xe5d4('0x3d')],_0x56afa0[_0xe5d4('0x3f')]);_0x2ab5b3['attributes']=_[_0xe5d4('0x43')](_0x56afa0[_0xe5d4('0x3d')],qs[_0xe5d4('0x44')](_0x376e7[_0xe5d4('0x3f')][_0xe5d4('0x44')]));_0x2ab5b3[_0xe5d4('0x42')]=_0x2ab5b3[_0xe5d4('0x42')][_0xe5d4('0x45')]?_0x2ab5b3['attributes']:_0x56afa0[_0xe5d4('0x3d')];if(!_0x376e7[_0xe5d4('0x3f')][_0xe5d4('0x46')](_0xe5d4('0x47'))){_0x2ab5b3[_0xe5d4('0x22')]=qs[_0xe5d4('0x22')](_0x376e7[_0xe5d4('0x3f')][_0xe5d4('0x22')]);_0x2ab5b3['offset']=qs['offset'](_0x376e7[_0xe5d4('0x3f')][_0xe5d4('0x20')]);}_0x2ab5b3[_0xe5d4('0x93')]=qs[_0xe5d4('0x48')](_0x376e7[_0xe5d4('0x3f')][_0xe5d4('0x48')]);_0x2ab5b3[_0xe5d4('0x49')]=qs[_0xe5d4('0x41')](_[_0xe5d4('0xc5')](_0x376e7['query'],_0x56afa0[_0xe5d4('0x41')]));_0x2ab5b3[_0xe5d4('0x49')][_0xe5d4('0xb7')]=_0x165edc['id'];if(_0x376e7[_0xe5d4('0x3f')][_0xe5d4('0x86')]){_0x2ab5b3[_0xe5d4('0x49')]=_[_0xe5d4('0xa2')](_0x2ab5b3['where'],{'$or':_[_0xe5d4('0x3e')](_0x2ab5b3[_0xe5d4('0x42')],function(_0x17f160){var _0x179be3={};_0x179be3[_0x17f160]={'$like':'%'+_0x376e7['query'][_0xe5d4('0x86')]+'%'};return _0x179be3;})});}if(_0x376e7[_0xe5d4('0x3f')][_0xe5d4('0x7b')]){var _0x52964f=_0x376e7['query'][_0xe5d4('0x7b')][_0xe5d4('0x2e')](',');var _0xa22f5e={};_0xa22f5e[_0x52964f[0x0]]={'$gte':moment(_0x52964f[0x1])[_0xe5d4('0xc6')](_0xe5d4('0xc7'))};_0x2ab5b3[_0xe5d4('0x49')]=_['merge'](_0x2ab5b3['where'],_0xa22f5e);}_0x2ab5b3=_[_0xe5d4('0xa2')]({},_0x2ab5b3,_0x376e7['options']);return db['WhatsappMessage'][_0xe5d4('0x23')]({'where':_0x2ab5b3['where']})['then'](function(_0x3c484a){_0x148756['count']=_0x3c484a;if(_0x376e7['query'][_0xe5d4('0xbd')]){_0x2ab5b3[_0xe5d4('0xc8')]=[{'all':!![]}];}return db[_0xe5d4('0xc2')]['findAll'](_0x2ab5b3);})[_0xe5d4('0x27')](function(_0x56d325){_0x148756[_0xe5d4('0xba')]=_0x56d325;return _0x148756;});}})[_0xe5d4('0x27')](respondWithFilteredResult(_0xe8792f,_0x2ab5b3))[_0xe5d4('0x2f')](handleError(_0xe8792f,null));};exports[_0xe5d4('0xc9')]=function(_0x1e8b66,_0xa338da,_0xb8bbee){return db[_0xe5d4('0x38')][_0xe5d4('0x5f')]({'where':{'id':_0x1e8b66[_0xe5d4('0xbc')]['id']}})[_0xe5d4('0x27')](handleEntityNotFound(_0xa338da,null))['then'](function(_0x54a593){if(_0x54a593){return _0x54a593['setTags'](_0x1e8b66[_0xe5d4('0x74')][_0xe5d4('0xc3')],_[_0xe5d4('0xca')](_0x1e8b66['body'],[_0xe5d4('0xc3'),'id'])||{})['spread'](function(){return db[_0xe5d4('0x6f')][_0xe5d4('0xcb')]({'attributes':['id','name',_0xe5d4('0x4b')],'where':{'id':_0x1e8b66[_0xe5d4('0x74')]['ids']}});})[_0xe5d4('0x27')](function(_0x5e2ea0){socket['emit']('whatsappInteractionTags:save',{'id':Number(_0x1e8b66[_0xe5d4('0xbc')]['id']),'tags':_0x5e2ea0||[]});return{'id':Number(_0x1e8b66[_0xe5d4('0xbc')]['id']),'tags':_0x5e2ea0||[]};});}})[_0xe5d4('0x27')](respondWithResult(_0xa338da,null))[_0xe5d4('0x2f')](handleError(_0xa338da,null));};exports['removeTags']=function(_0xb6ceb7,_0x6f13d1,_0x53ebe5){return db[_0xe5d4('0x38')][_0xe5d4('0x5f')]({'where':{'id':_0xb6ceb7['params']['id']}})[_0xe5d4('0x27')](handleEntityNotFound(_0x6f13d1,null))['then'](function(_0x493757){if(_0x493757){return _0x493757['removeTags'](_0xb6ceb7['query'][_0xe5d4('0xc3')]);}})['then'](respondWithStatusCode(_0x6f13d1,null))[_0xe5d4('0x2f')](handleError(_0x6f13d1,null));};exports[_0xe5d4('0xcc')]=function(_0x37bc25,_0x418256){var _0x3c3b09=moment()['unix']()['toString']();var _0x51c93f=path[_0xe5d4('0xcd')](config[_0xe5d4('0xce')],_0xe5d4('0xcf'),_0xe5d4('0xd0'),_0xe5d4('0xd1'));var _0x1b43e2=path[_0xe5d4('0xcd')](config['root'],_0xe5d4('0xcf'),_0xe5d4('0xd0'),_0xe5d4('0xd2'));var _0x31c6d2=path[_0xe5d4('0xcd')](_0x51c93f,_0x3c3b09);var _0x1c4380=util[_0xe5d4('0xc6')](_0xe5d4('0xd3'),_0x37bc25[_0xe5d4('0xbc')]['id'],_0x3c3b09);var _0x383c12=path[_0xe5d4('0xcd')](_0x51c93f,_0x1c4380);var _0x215011=[];_0x215011[_0xe5d4('0xb8')]({'model':db[_0xe5d4('0x72')],'as':_0xe5d4('0x72'),'attributes':['id',_0xe5d4('0xd4')],'raw':!![]});_0x215011['push']({'model':db[_0xe5d4('0xd5')],'as':'Contact','attributes':['id','firstName','lastName'],'raw':!![]});if(_0x37bc25[_0xe5d4('0x3f')][_0xe5d4('0xd2')]){_0x215011['push']({'model':db['Attachment'],'as':'Attachment','raw':!![]});}var _0x57bc1a=[{'model':db['WhatsappMessage'],'as':_0xe5d4('0xd6'),'attributes':['id',_0xe5d4('0x74'),_0xe5d4('0x79'),_0xe5d4('0xd7'),_0xe5d4('0xd8'),_0xe5d4('0x81')],'include':_0x215011}];_0x57bc1a[_0xe5d4('0xb8')]({'model':db[_0xe5d4('0xd9')],'as':_0xe5d4('0xda'),'attributes':['id',_0xe5d4('0x29')]});_0x57bc1a[_0xe5d4('0xb8')]({'model':db[_0xe5d4('0x72')],'as':_0xe5d4('0xdb'),'attributes':['id',_0xe5d4('0xd4')]});return db[_0xe5d4('0x38')][_0xe5d4('0x5f')]({'where':{'id':_0x37bc25[_0xe5d4('0xbc')]['id']},'include':_0x57bc1a})['then'](handleEntityNotFound(_0x418256,null))['then'](function(_0x30c3fb){if(_0x30c3fb){var _0x54a804=_0x30c3fb[_0xe5d4('0xdc')]({'plain':!![]});fs[_0xe5d4('0xdd')](_0x31c6d2);var _0x5285a3={'channel':_0xe5d4('0xde'),'account':_0x54a804[_0xe5d4('0xda')]['name'],'agent':_0x54a804[_0xe5d4('0xdb')]?_0x54a804[_0xe5d4('0xdb')]['fullname']:_0xe5d4('0xdf'),'createdAt':moment(_0x54a804['createdAt'])[_0xe5d4('0xc6')](_0xe5d4('0xc7'))[_0xe5d4('0xa0')](),'closedAt':_0x54a804[_0xe5d4('0x34')]?moment(_0x54a804[_0xe5d4('0xe0')])[_0xe5d4('0xc6')]('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0x54a804[_0xe5d4('0xe1')],'messages':_(_0x54a804[_0xe5d4('0xd6')])[_0xe5d4('0x86')]({'secret':![]})[_0xe5d4('0x3e')](function(_0x156956){if(_0x156956[_0xe5d4('0xe2')]){var _0x5813f8=path[_0xe5d4('0xcd')](_0x1b43e2,_0x156956[_0xe5d4('0xe2')]['basename']);if(fs[_0xe5d4('0xe3')](_0x5813f8)){fs[_0xe5d4('0xe4')](_0x5813f8)['pipe'](fs[_0xe5d4('0xe5')](path['join'](_0x31c6d2,_0x156956[_0xe5d4('0xe2')][_0xe5d4('0xe6')])));}}return{'date':moment(_0x156956[_0xe5d4('0x79')])[_0xe5d4('0xc6')](_0xe5d4('0xc7'))['toString'](),'sender':_0x156956[_0xe5d4('0xd7')]===_0xe5d4('0xe7')?_0x156956['User']?_0x156956[_0xe5d4('0x72')][_0xe5d4('0xd4')]:_0xe5d4('0xe8'):_0x156956['Contact']['firstName']+(_0x156956[_0xe5d4('0x65')][_0xe5d4('0xe9')]?'\x20'+_0x156956['Contact'][_0xe5d4('0xe9')]:''),'body':_0x156956[_0xe5d4('0xe2')]?_0x156956[_0xe5d4('0xe2')][_0xe5d4('0xe6')]:_0x156956[_0xe5d4('0x74')],'direction':_0x156956[_0xe5d4('0xd7')]===_0xe5d4('0xe7')?'A':'C','secret':_0x156956[_0xe5d4('0xd8')],'read':_0x156956[_0xe5d4('0x81')],'attachment':_0x156956[_0xe5d4('0xe2')]};})[_0xe5d4('0x61')]()};return ejs[_0xe5d4('0xea')](path[_0xe5d4('0xcd')](config['root'],_0xe5d4('0xcf'),_0xe5d4('0xeb'),_0xe5d4('0xec')),{'interaction':_0x5285a3})['then'](function(_0x3ff451){var _0x43581d=path['join'](_0x31c6d2,_0xe5d4('0xed')+_0x54a804['id']+'-'+_0x3c3b09+_0xe5d4('0xee'));var _0xdd31d8={'path':_0x43581d,'channel':_0xe5d4('0xde'),'interactionId':_0x54a804['id']};return pdf['createPdfFromHTML'](_0x3ff451,_0xdd31d8);})['then'](function(){return new BPromise(function(_0x3c3686,_0x3f3f0a){zipdir(_0x31c6d2,{'saveTo':_0x383c12},function(_0x5544bb,_0x2f510c){if(_0x5544bb)return _0x3f3f0a(_0x5544bb);return _0x3c3686(_0x2f510c);});})['then'](function(){return new BPromise(function(_0x234476,_0x3f3cab){rimraf(_0x31c6d2,function(_0x48b244){if(_0x48b244)_0x3f3cab(_0x48b244);return _0x234476();});});})[_0xe5d4('0x27')](function(){return _0x418256['download'](_0x383c12,_0x1c4380,function(_0x534c11){if(_0x534c11){console['log']('err',_0x534c11);}else{fs[_0xe5d4('0xef')](_0x383c12);}});});});}else{return _0x418256[_0xe5d4('0x1c')](0xc8);}})[_0xe5d4('0x2f')](handleError(_0x418256,null));}; \ No newline at end of file +var _0x20de=['Contact.email','c.phone','c.mobile','c.fax','Contact.fax','o.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','groupBy','WhatsappInteractionId','rows','show','includeAll','include','catch','create','params','describe','addMessage','WhatsappMessage','ids','omit','getMessages','findOne','$gte','options','findAll','addTags','setTags','spread','removeTags','server','files','tmp','join','root','attachments','format','transcript-%d-%s.zip','push','CmContact','lastName','Attachment','Messages','WhatsappAccount','mkdirSync','Whatsapp','Owner','YYYY-MM-DD\x20HH:mm:ss','basename','createReadStream','pipe','createWriteStream','direction','out','firstName','secret','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','download','log','err','unlinkSync','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','status','end','json','offset','undefined','limit','count','apply','reject','save','update','then','destroy','sendStatus','send','Users','map','fullname','TagIds','split','Tags','waiting','unmanaged','total','UserId','closed','talking','index','WhatsappInteraction','rawAttributes','fieldName','type','key','model','name','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','select','field','color','from','u.fullname','ui.WhatsappInteractionId','user_has_whatsapp_interactions','left_join','users','u.id\x20=\x20ui.UserId','whatsapp_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','whatsapp_accounts','a.id\x20=\x20i.WhatsappAccountId','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','whatsapp_interaction_has_tags','it.WhatsappInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','start','Tag','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','text','body','some','compact','isEmpty','i.WhatsappAccountId\x20IN\x20?','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','i.phone\x20LIKE\x20?','group','Sequelize','QueryTypes','SELECT','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','DESC','t.id\x20IN\x20?','resolve','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','agent','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','role','sequelize','toString','keyBy','merge','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','Contact.firstName','c.email'];(function(_0x3b4c6b,_0x50e853){var _0x46466b=function(_0x2f8488){while(--_0x2f8488){_0x3b4c6b['push'](_0x3b4c6b['shift']());}};_0x46466b(++_0x50e853);}(_0x20de,0x134));var _0xe20d=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0x20de[_0xaa1b3e];return _0x454d7d;};'use strict';var emlformat=require(_0xe20d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe20d('0x1'));var jsonpatch=require(_0xe20d('0x2'));var rp=require(_0xe20d('0x3'));var moment=require(_0xe20d('0x4'));var BPromise=require(_0xe20d('0x5'));var Mustache=require(_0xe20d('0x6'));var util=require(_0xe20d('0x7'));var path=require(_0xe20d('0x8'));var sox=require(_0xe20d('0x9'));var csv=require(_0xe20d('0xa'));var ejs=require(_0xe20d('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe20d('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe20d('0xd'));var toCsv=require(_0xe20d('0xa'));var querystring=require(_0xe20d('0xe'));var Papa=require('papaparse');var Redis=require(_0xe20d('0xf'));var authService=require(_0xe20d('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xe20d('0x11'));var pdf=require(_0xe20d('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe20d('0x13'))(_0xe20d('0x14'));var utils=require(_0xe20d('0x15'));var config=require(_0xe20d('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xe20d('0x17')]=_[_0xe20d('0x18')](config[_0xe20d('0x17')],{'host':_0xe20d('0x19'),'port':0x18eb});var socket=require(_0xe20d('0x1a'))(new Redis(config[_0xe20d('0x17')]));require(_0xe20d('0x1b'))[_0xe20d('0x1c')](socket);function respondWithStatusCode(_0x211734,_0x56eeea){_0x56eeea=_0x56eeea||0xcc;return function(_0x2367f7){if(_0x2367f7){return _0x211734['sendStatus'](_0x56eeea);}return _0x211734[_0xe20d('0x1d')](_0x56eeea)[_0xe20d('0x1e')]();};}function respondWithResult(_0x29b500,_0x53f8c3){_0x53f8c3=_0x53f8c3||0xc8;return function(_0x1d6179){if(_0x1d6179){return _0x29b500['status'](_0x53f8c3)[_0xe20d('0x1f')](_0x1d6179);}};}function respondWithFilteredResult(_0x1f2058,_0x285916){return function(_0x4e8dd6){if(_0x4e8dd6){var _0x4353cb=typeof _0x285916[_0xe20d('0x20')]===_0xe20d('0x21')&&typeof _0x285916[_0xe20d('0x22')]==='undefined';var _0x10db76=_0x4e8dd6[_0xe20d('0x23')];var _0x25a17d=_0x4353cb?0x0:_0x285916[_0xe20d('0x20')];var _0x48577c=_0x4353cb?_0x4e8dd6[_0xe20d('0x23')]:_0x285916['offset']+_0x285916['limit'];var _0x1fae60;if(_0x48577c>=_0x10db76){_0x48577c=_0x10db76;_0x1fae60=0xc8;}else{_0x1fae60=0xce;}_0x1f2058[_0xe20d('0x1d')](_0x1fae60);return _0x1f2058['set']('Content-Range',_0x25a17d+'-'+_0x48577c+'/'+_0x10db76)[_0xe20d('0x1f')](_0x4e8dd6);}return null;};}function patchUpdates(_0x25734b){return function(_0x5ce547){try{jsonpatch[_0xe20d('0x24')](_0x5ce547,_0x25734b,!![]);}catch(_0x3fc8b0){return BPromise[_0xe20d('0x25')](_0x3fc8b0);}return _0x5ce547[_0xe20d('0x26')]();};}function saveUpdates(_0x382c1d,_0x5de788){return function(_0x1d88fd){if(_0x1d88fd){return _0x1d88fd[_0xe20d('0x27')](_0x382c1d)[_0xe20d('0x28')](function(_0x4504ee){return _0x4504ee;});}return null;};}function removeEntity(_0x21a53a,_0x51f395){return function(_0x5f1626){if(_0x5f1626){return _0x5f1626[_0xe20d('0x29')]()['then'](function(){_0x21a53a[_0xe20d('0x1d')](0xcc)[_0xe20d('0x1e')]();});}};}function handleEntityNotFound(_0x7391e1,_0x46fc0e){return function(_0x42b1b1){if(!_0x42b1b1){_0x7391e1[_0xe20d('0x2a')](0x194);}return _0x42b1b1;};}function handleError(_0x2c2136,_0x59d416){_0x59d416=_0x59d416||0x1f4;return function(_0x8b7386){logger['error'](_0x8b7386['stack']);if(_0x8b7386['name']){delete _0x8b7386['name'];}_0x2c2136['status'](_0x59d416)[_0xe20d('0x2b')](_0x8b7386);};}function getInteractionUsers(_0x1387dd,_0x41e140){return new BPromise(function(_0x4f2d27,_0x4f4369){try{if(_0x41e140[_0x1387dd['id']]){_0x1387dd[_0xe20d('0x2c')]=_[_0xe20d('0x2d')](_0x41e140[_0x1387dd['id']],function(_0xb91aa){return{'id':_0xb91aa['id'],'fullname':_0xb91aa[_0xe20d('0x2e')]};});}}catch(_0x3d80ff){_0x4f4369(_0x3d80ff);}_0x4f2d27(_0x1387dd);});}function getInteractionTags(_0x388957,_0x36b04b){return new BPromise(function(_0x3a1dcb,_0x494df3){try{if(_0x388957[_0xe20d('0x2f')]){_0x388957['Tags']=[];_0x388957['TagIds'][_0xe20d('0x30')](',')['forEach'](function(_0x1da98b){_0x388957[_0xe20d('0x31')]['push'](_0x36b04b[_0x1da98b]);});}delete _0x388957['TagIds'];}catch(_0x4787ad){_0x494df3(_0x4787ad);}_0x3a1dcb(_0x388957);});}function updateWhatsappInteraction(_0x2b1867,_0x163704,_0x378b8a){return new BPromise(function(_0x972553,_0x3448d4){return getInteractionUsers(_0x2b1867,_0x378b8a)[_0xe20d('0x28')](function(_0x4b5a10){return getInteractionTags(_0x4b5a10,_0x163704);})[_0xe20d('0x28')](function(_0x85e074){return getStateInteraction(_0x85e074);})[_0xe20d('0x28')](function(_0x32e22f){_0x972553(_0x32e22f);})['catch'](function(_0x1da5bf){_0x3448d4(_0x1da5bf);});});}function getStateInteraction(_0x19b190){return new BPromise(function(_0x30bfc7){_0x19b190[_0xe20d('0x32')]=0x0;_0x19b190['talking']=0x0;_0x19b190['answered']=0x0;_0x19b190[_0xe20d('0x33')]=0x0;_0x19b190[_0xe20d('0x34')]=0x0;if(!_0x19b190['closed']&&!_0x19b190[_0xe20d('0x35')]){_0x19b190[_0xe20d('0x32')]+=0x1;}if(!_0x19b190[_0xe20d('0x36')]&&_0x19b190[_0xe20d('0x35')]){_0x19b190[_0xe20d('0x37')]+=0x1;if(_0x19b190[_0xe20d('0x32')]){_0x19b190[_0xe20d('0x32')]-=0x1;}}if(_0x19b190[_0xe20d('0x36')]&&_0x19b190['UserId']){_0x19b190['answered']+=0x1;if(_0x19b190['talking']){_0x19b190[_0xe20d('0x37')]-=0x1;}}if(_0x19b190[_0xe20d('0x36')]&&!_0x19b190['UserId']){_0x19b190[_0xe20d('0x33')]+=0x1;if(_0x19b190[_0xe20d('0x32')]){_0x19b190['waiting']-=0x1;}}_0x19b190['total']+=0x1;_0x30bfc7(_0x19b190);});}exports[_0xe20d('0x38')]=function(_0x51415f,_0x2ffa5b){var _0x590f07={},_0x1d5e89={},_0x3b3a80={'count':0x0,'rows':[]};var _0x4d0716=_[_0xe20d('0x2d')](db[_0xe20d('0x39')][_0xe20d('0x3a')],function(_0x595f95){return{'name':_0x595f95[_0xe20d('0x3b')],'type':_0x595f95[_0xe20d('0x3c')][_0xe20d('0x3d')]};});_0x1d5e89[_0xe20d('0x3e')]=_[_0xe20d('0x2d')](_0x4d0716,_0xe20d('0x3f'));_0x1d5e89[_0xe20d('0x40')]=_[_0xe20d('0x41')](_0x51415f[_0xe20d('0x40')]);_0x1d5e89['filters']=_[_0xe20d('0x42')](_0x1d5e89['model'],_0x1d5e89[_0xe20d('0x40')]);_0x590f07[_0xe20d('0x43')]=_[_0xe20d('0x42')](_0x1d5e89[_0xe20d('0x3e')],qs[_0xe20d('0x44')](_0x51415f['query'][_0xe20d('0x44')]));_0x590f07[_0xe20d('0x43')]=_0x590f07[_0xe20d('0x43')][_0xe20d('0x45')]?_0x590f07[_0xe20d('0x43')]:_0x1d5e89[_0xe20d('0x3e')];if(!_0x51415f['query'][_0xe20d('0x46')](_0xe20d('0x47'))){_0x590f07[_0xe20d('0x22')]=qs[_0xe20d('0x22')](_0x51415f[_0xe20d('0x40')]['limit']);_0x590f07[_0xe20d('0x20')]=qs[_0xe20d('0x20')](_0x51415f[_0xe20d('0x40')]['offset']);}_0x590f07['order']=qs[_0xe20d('0x48')](_0x51415f[_0xe20d('0x40')][_0xe20d('0x48')]);_0x590f07[_0xe20d('0x49')]=qs[_0xe20d('0x4a')](_[_0xe20d('0x4b')](_0x51415f[_0xe20d('0x40')],_0x1d5e89[_0xe20d('0x4a')]),_0x4d0716);var _0x1f37c1=[];var _0x5dc2e1=squel[_0xe20d('0x4c')]()[_0xe20d('0x4d')]('id')[_0xe20d('0x4d')](_0xe20d('0x3f'))[_0xe20d('0x4d')](_0xe20d('0x4e'))[_0xe20d('0x4f')]('tools_tags');var _0x255efe=squel[_0xe20d('0x4c')]()[_0xe20d('0x4d')]('u.id')[_0xe20d('0x4d')](_0xe20d('0x50'))['field'](_0xe20d('0x51'))[_0xe20d('0x4f')](_0xe20d('0x52'),'ui')[_0xe20d('0x53')](_0xe20d('0x54'),'u',_0xe20d('0x55'));var _0x453cf1=squel[_0xe20d('0x4c')]()[_0xe20d('0x4f')](_0xe20d('0x56'),'i')['left_join'](_0xe20d('0x57'),'c',_0xe20d('0x58'))[_0xe20d('0x53')]('users','o',_0xe20d('0x59'))[_0xe20d('0x53')](_0xe20d('0x5a'),'a',_0xe20d('0x5b'))[_0xe20d('0x53')](_0xe20d('0x5c'),'me',_0xe20d('0x5d'))[_0xe20d('0x53')](_0xe20d('0x5e'),'it',_0xe20d('0x5f'))['left_join']('tools_tags','t',_0xe20d('0x60'));var _0x312b83=squel[_0xe20d('0x61')]();var _0x3967cd=[];var _0x31c347=squel['expr']();var _0x1b50ea;if(_0x51415f['query'][_0xe20d('0x62')]){_0x1b50ea=as[_0xe20d('0x63')](_0x51415f[_0xe20d('0x40')][_0xe20d('0x62')]);var _0xbce4ba=_0x1b50ea['sqlOperator'];for(var _0x353366=0x0;_0x353366<_0x1b50ea['conditions'][_0xe20d('0x45')];_0x353366++){var _0x27c6f1=_0x1b50ea['conditions'][_0x353366];var _0x232a30='i';var _0x16d55c=_[_0xe20d('0x64')](_0x4d0716,[_0xe20d('0x3f'),_0x27c6f1[_0xe20d('0x4d')]]);if(!_0x16d55c){switch(_0x27c6f1[_0xe20d('0x4d')]){case _0xe20d('0x65'):if(_0x27c6f1[_0xe20d('0x66')]==0x1){_0x453cf1[_0xe20d('0x67')]('`'+_0x27c6f1[_0xe20d('0x4d')]+_0xe20d('0x68'));}else{_0x453cf1[_0xe20d('0x67')]('`'+_0x27c6f1[_0xe20d('0x4d')]+_0xe20d('0x69'));}break;case _0xe20d('0x6a'):if(_0x27c6f1[_0xe20d('0x6b')]===_0xe20d('0x6c')){if(_0x27c6f1['value'][_0xe20d('0x30')]('\x20')['length']>0x1){_0x312b83[_0xbce4ba](_0xe20d('0x6d'),qs[_0xe20d('0x6e')](_0x27c6f1[_0xe20d('0x66')]),null);}else{var _0x34bf87='%'+_0x27c6f1[_0xe20d('0x66')]+'%';_0x312b83[_0xbce4ba](_0xe20d('0x6f'),_0x34bf87,_0x34bf87,_0x34bf87);}}else{_0x16d55c=_['find'](_0x4d0716,[_0xe20d('0x3f'),_0xe20d('0x70')]);_0x27c6f1[_0xe20d('0x4d')]='ContactId';_0x2c5d64=as[_0xe20d('0x71')](_0x232a30,_0x16d55c[_0xe20d('0x3c')],_0x27c6f1);_0x312b83[_0xbce4ba](_0x2c5d64['text'],_0x2c5d64[_0xe20d('0x66')][_0xe20d('0x72')],_0x2c5d64['value']['end']);}break;case _0xe20d('0x73'):var _0x1fbedd=_0x27c6f1[_0xe20d('0x66')]['split'](',')[_0xe20d('0x2d')](function(_0x374d3f){return Number(_0x374d3f);});_0x1fbedd[_0xe20d('0x74')](function(_0x3cb67b){_0x31c347['or'](_0xe20d('0x75'),'%,'+_0x3cb67b+',%');});_0x3967cd=_[_0xe20d('0x76')](_0x3967cd,_0x1fbedd);break;case _0xe20d('0x77'):if(_0x27c6f1[_0xe20d('0x6b')]===_0xe20d('0x6c')){_0x312b83[_0xbce4ba](_0xe20d('0x78'),'%'+_0x27c6f1[_0xe20d('0x66')]+'%',null);}else{_0x16d55c=_[_0xe20d('0x64')](_0x4d0716,[_0xe20d('0x3f'),'UserId']);_0x27c6f1[_0xe20d('0x4d')]=_0xe20d('0x35');_0x2c5d64=as[_0xe20d('0x71')](_0x232a30,_0x16d55c[_0xe20d('0x3c')],_0x27c6f1);_0x312b83[_0xbce4ba](_0x2c5d64[_0xe20d('0x79')],_0x2c5d64[_0xe20d('0x66')][_0xe20d('0x72')],_0x2c5d64['value']['end']);}break;case _0xe20d('0x7a'):_0x2c5d64=as[_0xe20d('0x71')]('me',null,_0x27c6f1);_0x312b83[_0xbce4ba](_0x2c5d64[_0xe20d('0x79')],_0x2c5d64[_0xe20d('0x66')][_0xe20d('0x72')],_0x2c5d64[_0xe20d('0x66')][_0xe20d('0x1e')]);break;}}else{var _0x2c5d64=as[_0xe20d('0x71')](_0x232a30,_0x16d55c['type'],_0x27c6f1);_0x312b83[_0xbce4ba](_0x2c5d64[_0xe20d('0x79')],_0x2c5d64[_0xe20d('0x66')][_0xe20d('0x72')],_0x2c5d64[_0xe20d('0x66')][_0xe20d('0x1e')]);}}}else{var _0x2734e8=_(_0x51415f[_0xe20d('0x40')])['keys']()[_0xe20d('0x2d')](function(_0x1ec44b){return _[_0xe20d('0x7b')](_0x4d0716,[_0xe20d('0x3f'),_0x1ec44b])?_0x1ec44b:undefined;})[_0xe20d('0x7c')]()[_0xe20d('0x66')]();if(!_[_0xe20d('0x7d')](_0x2734e8)){_0x2734e8[_0xe20d('0x74')](function(_0x12b5d0){if(_0x12b5d0==='WhatsappAccountId'){_0x453cf1['where'](_0xe20d('0x7e'),[][_0xe20d('0x7f')](_0x51415f[_0xe20d('0x40')][_0x12b5d0]));}else if(_0x12b5d0===_0xe20d('0x80')){var _0x5a7626=JSON[_0xe20d('0x81')](_0x51415f[_0xe20d('0x40')][_0x12b5d0])['$gte'];var _0x46af20=JSON[_0xe20d('0x81')](_0x51415f[_0xe20d('0x40')][_0x12b5d0])[_0xe20d('0x82')];_0x453cf1['where'](_0xe20d('0x83'),_0x5a7626,_0x46af20);}else{if(_0x51415f['query'][_0x12b5d0]===_0xe20d('0x84')){_0x453cf1[_0xe20d('0x49')]('i.'+_0x12b5d0+_0xe20d('0x85'));}else{_0x453cf1['where']('i.'+_0x12b5d0+_0xe20d('0x86'),_0x51415f[_0xe20d('0x40')][_0x12b5d0]);}}});}if(_0x51415f['query'][_0xe20d('0x87')]){if(_0x51415f[_0xe20d('0x40')][_0xe20d('0x87')]==0x1){_0x453cf1[_0xe20d('0x67')](_0xe20d('0x88'));}else{_0x453cf1['having'](_0xe20d('0x89'));}}if(_0x51415f[_0xe20d('0x40')][_0xe20d('0x8a')]){_0x3967cd=_[_0xe20d('0x8b')](_0x51415f[_0xe20d('0x40')][_0xe20d('0x8a')])?_0x51415f[_0xe20d('0x40')][_0xe20d('0x8a')]:new Array(_0x51415f[_0xe20d('0x40')]['tag']);_0x3967cd[_0xe20d('0x74')](function(_0xf9cd72){_0x31c347['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0xf9cd72+',%');});}if(_0x51415f[_0xe20d('0x40')][_0xe20d('0x8c')]){var _0x42cf37=_0x51415f[_0xe20d('0x40')][_0xe20d('0x8c')][_0xe20d('0x8d')]('\x5c','\x5c\x5c')[_0xe20d('0x8d')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x42cf37)){_0x312b83['or']('i.id\x20LIKE\x20?',_0x42cf37+'%')['or'](_0xe20d('0x8e'),_0x42cf37+'%');}else{_0x312b83['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xe20d('0x6e')](_0x42cf37))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x42cf37+'%');}}}_0x453cf1[_0xe20d('0x49')](_0x312b83);_0x453cf1[_0xe20d('0x8f')]('i.id');var _0x3b892f={'type':db[_0xe20d('0x90')][_0xe20d('0x91')][_0xe20d('0x92')],'raw':!![]};var _0x35c770=_0x453cf1[_0xe20d('0x93')]();_0x35c770[_0xe20d('0x4d')](_0xe20d('0x94'));_0x35c770[_0xe20d('0x4d')](_0xe20d('0x95'),_0xe20d('0x65'));if(_0x590f07[_0xe20d('0x96')]){_0x590f07['order']['forEach'](function(_0xd9437){var _0x17c6e2=_0xd9437[0x0]===_0xe20d('0x97')?_0xd9437[0x0]:'i.'+_0xd9437[0x0];_0x453cf1[_0xe20d('0x96')](_0x17c6e2,_0xd9437[0x1]===_0xe20d('0x98')?![]:!![]);});}if(!_[_0xe20d('0x7d')](_0x3967cd)){_0x453cf1[_0xe20d('0x67')](_0x31c347);_0x35c770[_0xe20d('0x49')](_0xe20d('0x99'),_0x3967cd);}BPromise[_0xe20d('0x9a')]()[_0xe20d('0x28')](function(){if(!_0x1b50ea){if(_0x51415f[_0xe20d('0x40')]['WhatsappAccountId'])return;_0x35c770[_0xe20d('0x49')](_0xe20d('0x9b'));_0x453cf1['where'](_0xe20d('0x9b'));return;}if(_0x51415f[_0xe20d('0x9c')]['role']!==_0xe20d('0x9d'))return;return _0x51415f[_0xe20d('0x9c')][_0xe20d('0x9e')]({'attributes':['id'],'raw':!![]})[_0xe20d('0x28')](function(_0x1d553a){if(_['isEmpty'](_0x1d553a)){_0x35c770[_0xe20d('0x49')](_0xe20d('0x9f'));_0x453cf1[_0xe20d('0x49')](_0xe20d('0x9f'));}else{_0x35c770[_0xe20d('0x49')]('i.WhatsappAccountId\x20IN\x20?',_[_0xe20d('0x2d')](_0x1d553a,'id'));_0x453cf1['where'](_0xe20d('0x7e'),_[_0xe20d('0x2d')](_0x1d553a,'id'));}});})['then'](function(){if(_0x51415f['user'][_0xe20d('0xa0')]===_0xe20d('0x9d')&&!_0x1b50ea&&!_0x51415f[_0xe20d('0x40')]['WhatsappAccountId'])return[];return db[_0xe20d('0xa1')]['query'](_0x35c770['toString'](),_0x3b892f);})[_0xe20d('0x28')](function(_0x1a5f5c){_0x3b3a80[_0xe20d('0x23')]=_0x1a5f5c[_0xe20d('0x45')];if(_0x3b3a80['count']===0x0)return[];return db[_0xe20d('0xa1')]['query'](_0x5dc2e1[_0xe20d('0xa2')](),_0x3b892f)[_0xe20d('0x28')](function(_0x11d033){_0x1f37c1=_[_0xe20d('0xa3')](_0x11d033,'id');_0x3b892f=_[_0xe20d('0xa4')](_0x3b892f,{'model':db[_0xe20d('0x39')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x51415f[_0xe20d('0x40')]['fields']){_0x590f07[_0xe20d('0x43')][_0xe20d('0x74')](function(_0x426659){_0x453cf1[_0xe20d('0x4d')]('i.'+_0x426659);});}else{_0x453cf1['field'](_0xe20d('0x95'),_0xe20d('0x65'));_0x453cf1['field'](_0xe20d('0xa5'),'Account.key');_0x453cf1['field'](_0xe20d('0xa6'),_0xe20d('0xa7'));_0x453cf1[_0xe20d('0x4d')](_0xe20d('0xa8'),_0xe20d('0x97'));_0x453cf1[_0xe20d('0x4d')](_0xe20d('0xa9'));_0x453cf1[_0xe20d('0x4d')]('c.firstName',_0xe20d('0xaa'));_0x453cf1[_0xe20d('0x4d')]('c.lastName','Contact.lastName');_0x453cf1[_0xe20d('0x4d')](_0xe20d('0xab'),_0xe20d('0xac'));_0x453cf1[_0xe20d('0x4d')](_0xe20d('0xad'),'Contact.phone');_0x453cf1[_0xe20d('0x4d')](_0xe20d('0xae'),'Contact.mobile');_0x453cf1[_0xe20d('0x4d')](_0xe20d('0xaf'),_0xe20d('0xb0'));_0x453cf1[_0xe20d('0x4d')](_0xe20d('0xb1'),'Owner.fullname');_0x453cf1[_0xe20d('0x4d')]('o.internal',_0xe20d('0xb2'));_0x453cf1[_0xe20d('0x4d')](_0xe20d('0xb3'),_0xe20d('0x2f'));}if(_0x590f07[_0xe20d('0x22')])_0x453cf1[_0xe20d('0x22')](_0x590f07[_0xe20d('0x22')]);if(_0x590f07[_0xe20d('0x20')])_0x453cf1[_0xe20d('0x20')](_0x590f07[_0xe20d('0x20')]);return db['sequelize'][_0xe20d('0x40')](_0x453cf1['toString'](),_0x3b892f);})[_0xe20d('0x28')](function(_0x1c38e3){if(_0x1c38e3[_0xe20d('0x45')]>0x0)_0x255efe[_0xe20d('0x49')](_0xe20d('0xb4'),_[_0xe20d('0x2d')](_0x1c38e3,'id'));return db[_0xe20d('0xa1')][_0xe20d('0x40')](_0x255efe[_0xe20d('0xa2')](),_0x3b892f)[_0xe20d('0x28')](function(_0x2376ce){var _0x455763=_[_0xe20d('0xb5')](_0x2376ce,_0xe20d('0xb6'));var _0x2ca3cb=[];_0x1c38e3[_0xe20d('0x74')](function(_0xdec72f){_0x2ca3cb['push'](updateWhatsappInteraction(_0xdec72f,_0x1f37c1,_0x455763));});return BPromise['all'](_0x2ca3cb);});});})[_0xe20d('0x28')](function(_0x300860){_0x3b3a80[_0xe20d('0xb7')]=_0x300860;return _0x3b3a80;})[_0xe20d('0x28')](respondWithFilteredResult(_0x2ffa5b,_0x590f07))['catch'](handleError(_0x2ffa5b,null));};exports[_0xe20d('0xb8')]=function(_0x3a7bc2,_0x9a3822){var _0x227ffb={'raw':![],'where':{'id':_0x3a7bc2['params']['id']}},_0x5bc3c4={};_0x5bc3c4['model']=_['keys'](db[_0xe20d('0x39')][_0xe20d('0x3a')]);_0x5bc3c4[_0xe20d('0x40')]=_[_0xe20d('0x41')](_0x3a7bc2[_0xe20d('0x40')]);_0x5bc3c4[_0xe20d('0x4a')]=_[_0xe20d('0x42')](_0x5bc3c4[_0xe20d('0x3e')],_0x5bc3c4['query']);_0x227ffb['attributes']=_[_0xe20d('0x42')](_0x5bc3c4['model'],qs['fields'](_0x3a7bc2[_0xe20d('0x40')][_0xe20d('0x44')]));_0x227ffb['attributes']=_0x227ffb['attributes'][_0xe20d('0x45')]?_0x227ffb[_0xe20d('0x43')]:_0x5bc3c4[_0xe20d('0x3e')];if(_0x3a7bc2['query'][_0xe20d('0xb9')]){_0x227ffb[_0xe20d('0xba')]=[{'all':!![]}];}_0x227ffb=_['merge']({},_0x227ffb,_0x3a7bc2['options']);return db[_0xe20d('0x39')][_0xe20d('0x64')](_0x227ffb)[_0xe20d('0x28')](handleEntityNotFound(_0x9a3822,null))[_0xe20d('0x28')](respondWithResult(_0x9a3822,null))[_0xe20d('0xbb')](handleError(_0x9a3822,null));};exports['create']=function(_0x591195,_0x1dcb8b){return db['WhatsappInteraction'][_0xe20d('0xbc')](_0x591195[_0xe20d('0x7a')],{})[_0xe20d('0x28')](respondWithResult(_0x1dcb8b,0xc9))[_0xe20d('0xbb')](handleError(_0x1dcb8b,null));};exports[_0xe20d('0x27')]=function(_0x48e30d,_0x2cbe0d){if(_0x48e30d[_0xe20d('0x7a')]['id']){delete _0x48e30d[_0xe20d('0x7a')]['id'];}return db['WhatsappInteraction'][_0xe20d('0x64')]({'where':{'id':_0x48e30d['params']['id']}})[_0xe20d('0x28')](handleEntityNotFound(_0x2cbe0d,null))[_0xe20d('0x28')](saveUpdates(_0x48e30d[_0xe20d('0x7a')],null))[_0xe20d('0x28')](respondWithResult(_0x2cbe0d,null))['catch'](handleError(_0x2cbe0d,null));};exports[_0xe20d('0x29')]=function(_0x135300,_0x2cc486){return db['WhatsappInteraction'][_0xe20d('0x64')]({'where':{'id':_0x135300[_0xe20d('0xbd')]['id']}})[_0xe20d('0x28')](handleEntityNotFound(_0x2cc486,null))[_0xe20d('0x28')](removeEntity(_0x2cc486,null))[_0xe20d('0xbb')](handleError(_0x2cc486,null));};exports[_0xe20d('0xbe')]=function(_0x1d6510,_0x10ddd1){return db[_0xe20d('0x39')][_0xe20d('0xbe')]()['then'](respondWithResult(_0x10ddd1,null))[_0xe20d('0xbb')](handleError(_0x10ddd1,null));};exports[_0xe20d('0xbf')]=function(_0x117cd6,_0x9d85e1,_0xfb6f04){return db[_0xe20d('0xc0')]['find']({'where':{'id':_0x117cd6[_0xe20d('0xbd')]['id']}})[_0xe20d('0x28')](handleEntityNotFound(_0x9d85e1,null))['then'](function(_0x357795){if(_0x357795){return _0x357795['addMessage'](_0x117cd6[_0xe20d('0x7a')][_0xe20d('0xc1')],_[_0xe20d('0xc2')](_0x117cd6[_0xe20d('0x7a')],[_0xe20d('0xc1'),'id'])||{});}})[_0xe20d('0x28')](respondWithResult(_0x9d85e1,null))[_0xe20d('0xbb')](handleError(_0x9d85e1,null));};exports[_0xe20d('0xc3')]=function(_0x5c06df,_0xc9efa6,_0x3889a7){var _0x2341d2={'raw':![],'where':{}};var _0x4f910e={};var _0x1f3fac={'count':0x0,'rows':[]};return db[_0xe20d('0x39')][_0xe20d('0xc4')]({'where':{'id':_0x5c06df[_0xe20d('0xbd')]['id']}})[_0xe20d('0x28')](handleEntityNotFound(_0xc9efa6,null))['then'](function(_0x3e7322){if(_0x3e7322){_0x4f910e[_0xe20d('0x3e')]=_[_0xe20d('0x41')](db[_0xe20d('0xc0')][_0xe20d('0x3a')]);_0x4f910e[_0xe20d('0x40')]=_[_0xe20d('0x41')](_0x5c06df[_0xe20d('0x40')]);_0x4f910e[_0xe20d('0x4a')]=_[_0xe20d('0x42')](_0x4f910e[_0xe20d('0x3e')],_0x4f910e['query']);_0x2341d2[_0xe20d('0x43')]=_[_0xe20d('0x42')](_0x4f910e[_0xe20d('0x3e')],qs[_0xe20d('0x44')](_0x5c06df[_0xe20d('0x40')][_0xe20d('0x44')]));_0x2341d2['attributes']=_0x2341d2[_0xe20d('0x43')]['length']?_0x2341d2[_0xe20d('0x43')]:_0x4f910e[_0xe20d('0x3e')];if(!_0x5c06df[_0xe20d('0x40')]['hasOwnProperty'](_0xe20d('0x47'))){_0x2341d2[_0xe20d('0x22')]=qs[_0xe20d('0x22')](_0x5c06df[_0xe20d('0x40')]['limit']);_0x2341d2[_0xe20d('0x20')]=qs[_0xe20d('0x20')](_0x5c06df[_0xe20d('0x40')][_0xe20d('0x20')]);}_0x2341d2[_0xe20d('0x96')]=qs[_0xe20d('0x48')](_0x5c06df['query'][_0xe20d('0x48')]);_0x2341d2[_0xe20d('0x49')]=qs['filters'](_['pick'](_0x5c06df[_0xe20d('0x40')],_0x4f910e[_0xe20d('0x4a')]));_0x2341d2[_0xe20d('0x49')][_0xe20d('0xb6')]=_0x3e7322['id'];if(_0x5c06df[_0xe20d('0x40')][_0xe20d('0x8c')]){_0x2341d2[_0xe20d('0x49')]=_[_0xe20d('0xa4')](_0x2341d2[_0xe20d('0x49')],{'$or':_[_0xe20d('0x2d')](_0x2341d2['attributes'],function(_0x50dad7){var _0x11bca3={};_0x11bca3[_0x50dad7]={'$like':'%'+_0x5c06df[_0xe20d('0x40')]['filter']+'%'};return _0x11bca3;})});}if(_0x5c06df['query'][_0xe20d('0xc5')]){var _0x395538=_0x5c06df[_0xe20d('0x40')][_0xe20d('0xc5')]['split'](',');var _0x1dc7c1={};_0x1dc7c1[_0x395538[0x0]]={'$gte':moment(_0x395538[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x2341d2[_0xe20d('0x49')]=_['merge'](_0x2341d2['where'],_0x1dc7c1);}_0x2341d2=_['merge']({},_0x2341d2,_0x5c06df[_0xe20d('0xc6')]);return db['WhatsappMessage'][_0xe20d('0x23')]({'where':_0x2341d2[_0xe20d('0x49')]})['then'](function(_0x290183){_0x1f3fac[_0xe20d('0x23')]=_0x290183;if(_0x5c06df[_0xe20d('0x40')][_0xe20d('0xb9')]){_0x2341d2[_0xe20d('0xba')]=[{'all':!![]}];}return db[_0xe20d('0xc0')][_0xe20d('0xc7')](_0x2341d2);})[_0xe20d('0x28')](function(_0x53c6f8){_0x1f3fac['rows']=_0x53c6f8;return _0x1f3fac;});}})['then'](respondWithFilteredResult(_0xc9efa6,_0x2341d2))['catch'](handleError(_0xc9efa6,null));};exports[_0xe20d('0xc8')]=function(_0x2b9948,_0x3b04aa,_0xc18e39){return db[_0xe20d('0x39')][_0xe20d('0x64')]({'where':{'id':_0x2b9948[_0xe20d('0xbd')]['id']}})[_0xe20d('0x28')](handleEntityNotFound(_0x3b04aa,null))['then'](function(_0x1a5536){if(_0x1a5536){return _0x1a5536[_0xe20d('0xc9')](_0x2b9948[_0xe20d('0x7a')][_0xe20d('0xc1')],_[_0xe20d('0xc2')](_0x2b9948[_0xe20d('0x7a')],[_0xe20d('0xc1'),'id'])||{})[_0xe20d('0xca')](function(){return db[_0xe20d('0x73')][_0xe20d('0xc7')]({'attributes':['id','name',_0xe20d('0x4e')],'where':{'id':_0x2b9948['body'][_0xe20d('0xc1')]}});})[_0xe20d('0x28')](function(_0x5c916f){socket['emit']('whatsappInteractionTags:save',{'id':Number(_0x2b9948[_0xe20d('0xbd')]['id']),'tags':_0x5c916f||[]});return{'id':Number(_0x2b9948[_0xe20d('0xbd')]['id']),'tags':_0x5c916f||[]};});}})[_0xe20d('0x28')](respondWithResult(_0x3b04aa,null))[_0xe20d('0xbb')](handleError(_0x3b04aa,null));};exports[_0xe20d('0xcb')]=function(_0x3b60da,_0x5b4176,_0x18dab1){return db['WhatsappInteraction']['find']({'where':{'id':_0x3b60da['params']['id']}})['then'](handleEntityNotFound(_0x5b4176,null))['then'](function(_0x3bc4da){if(_0x3bc4da){return _0x3bc4da[_0xe20d('0xcb')](_0x3b60da[_0xe20d('0x40')][_0xe20d('0xc1')]);}})[_0xe20d('0x28')](respondWithStatusCode(_0x5b4176,null))[_0xe20d('0xbb')](handleError(_0x5b4176,null));};exports['download']=function(_0xde5ed,_0x2cce9c){var _0x64ea4a=moment()['unix']()['toString']();var _0x1709ec=path['join'](config['root'],_0xe20d('0xcc'),_0xe20d('0xcd'),_0xe20d('0xce'));var _0x1dc641=path[_0xe20d('0xcf')](config[_0xe20d('0xd0')],'server','files',_0xe20d('0xd1'));var _0x408751=path['join'](_0x1709ec,_0x64ea4a);var _0x1f119e=util[_0xe20d('0xd2')](_0xe20d('0xd3'),_0xde5ed[_0xe20d('0xbd')]['id'],_0x64ea4a);var _0x2321f8=path[_0xe20d('0xcf')](_0x1709ec,_0x1f119e);var _0x29fd62=[];_0x29fd62[_0xe20d('0xd4')]({'model':db[_0xe20d('0x77')],'as':_0xe20d('0x77'),'attributes':['id','fullname'],'raw':!![]});_0x29fd62['push']({'model':db[_0xe20d('0xd5')],'as':'Contact','attributes':['id','firstName',_0xe20d('0xd6')],'raw':!![]});if(_0xde5ed['query']['attachments']){_0x29fd62[_0xe20d('0xd4')]({'model':db[_0xe20d('0xd7')],'as':_0xe20d('0xd7'),'raw':!![]});}var _0x4cabac=[{'model':db[_0xe20d('0xc0')],'as':_0xe20d('0xd8'),'attributes':['id',_0xe20d('0x7a'),'createdAt','direction','secret',_0xe20d('0x87')],'include':_0x29fd62}];_0x4cabac[_0xe20d('0xd4')]({'model':db[_0xe20d('0xd9')],'as':'Account','attributes':['id',_0xe20d('0x3f')]});_0x4cabac[_0xe20d('0xd4')]({'model':db[_0xe20d('0x77')],'as':'Owner','attributes':['id',_0xe20d('0x2e')]});return db[_0xe20d('0x39')][_0xe20d('0x64')]({'where':{'id':_0xde5ed[_0xe20d('0xbd')]['id']},'include':_0x4cabac})[_0xe20d('0x28')](handleEntityNotFound(_0x2cce9c,null))[_0xe20d('0x28')](function(_0x181c3e){if(_0x181c3e){var _0x295dee=_0x181c3e['get']({'plain':!![]});fs[_0xe20d('0xda')](_0x408751);var _0x2c6ca4={'channel':_0xe20d('0xdb'),'account':_0x295dee['Account'][_0xe20d('0x3f')],'agent':_0x295dee[_0xe20d('0xdc')]?_0x295dee[_0xe20d('0xdc')]['fullname']:'N.A.','createdAt':moment(_0x295dee[_0xe20d('0x80')])[_0xe20d('0xd2')]('YYYY-MM-DD\x20HH:mm:ss')[_0xe20d('0xa2')](),'closedAt':_0x295dee[_0xe20d('0x36')]?moment(_0x295dee['closedAt'])[_0xe20d('0xd2')](_0xe20d('0xdd'))[_0xe20d('0xa2')]():'','disposition':_0x295dee['disposition'],'messages':_(_0x295dee['Messages'])[_0xe20d('0x8c')]({'secret':![]})[_0xe20d('0x2d')](function(_0x2a7123){if(_0x2a7123[_0xe20d('0xd7')]){var _0xcdc37a=path[_0xe20d('0xcf')](_0x1dc641,_0x2a7123[_0xe20d('0xd7')][_0xe20d('0xde')]);if(fs['existsSync'](_0xcdc37a)){fs[_0xe20d('0xdf')](_0xcdc37a)[_0xe20d('0xe0')](fs[_0xe20d('0xe1')](path['join'](_0x408751,_0x2a7123[_0xe20d('0xd7')][_0xe20d('0xde')])));}}return{'date':moment(_0x2a7123[_0xe20d('0x80')])[_0xe20d('0xd2')](_0xe20d('0xdd'))[_0xe20d('0xa2')](),'sender':_0x2a7123[_0xe20d('0xe2')]===_0xe20d('0xe3')?_0x2a7123[_0xe20d('0x77')]?_0x2a7123[_0xe20d('0x77')][_0xe20d('0x2e')]:'System':_0x2a7123[_0xe20d('0x6a')][_0xe20d('0xe4')]+(_0x2a7123[_0xe20d('0x6a')][_0xe20d('0xd6')]?'\x20'+_0x2a7123[_0xe20d('0x6a')]['lastName']:''),'body':_0x2a7123[_0xe20d('0xd7')]?_0x2a7123[_0xe20d('0xd7')][_0xe20d('0xde')]:_0x2a7123[_0xe20d('0x7a')],'direction':_0x2a7123[_0xe20d('0xe2')]==='out'?'A':'C','secret':_0x2a7123[_0xe20d('0xe5')],'read':_0x2a7123[_0xe20d('0x87')],'attachment':_0x2a7123[_0xe20d('0xd7')]};})[_0xe20d('0x66')]()};return ejs[_0xe20d('0xe6')](path[_0xe20d('0xcf')](config['root'],_0xe20d('0xcc'),_0xe20d('0xe7'),_0xe20d('0xe8')),{'interaction':_0x2c6ca4})[_0xe20d('0x28')](function(_0x12c60e){var _0x113189=path['join'](_0x408751,_0xe20d('0xe9')+_0x295dee['id']+'-'+_0x64ea4a+_0xe20d('0xea'));var _0x554220={'path':_0x113189,'channel':_0xe20d('0xdb'),'interactionId':_0x295dee['id']};return pdf[_0xe20d('0xeb')](_0x12c60e,_0x554220);})[_0xe20d('0x28')](function(){return new BPromise(function(_0x654bd4,_0x30cf0b){zipdir(_0x408751,{'saveTo':_0x2321f8},function(_0x12ab5e,_0x5bf950){if(_0x12ab5e)return _0x30cf0b(_0x12ab5e);return _0x654bd4(_0x5bf950);});})['then'](function(){return new BPromise(function(_0x17e96f,_0x1a99a7){rimraf(_0x408751,function(_0x2a45fa){if(_0x2a45fa)_0x1a99a7(_0x2a45fa);return _0x17e96f();});});})[_0xe20d('0x28')](function(){return _0x2cce9c[_0xe20d('0xec')](_0x2321f8,_0x1f119e,function(_0x5eb941){if(_0x5eb941){console[_0xe20d('0xed')](_0xe20d('0xee'),_0x5eb941);}else{fs[_0xe20d('0xef')](_0x2321f8);}});});});}else{return _0x2cce9c['sendStatus'](0xc8);}})[_0xe20d('0xbb')](handleError(_0x2cce9c,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index e3d6bca..3c719a1 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 _0xd64b=['map','unreadMessages','emit','catch','hasOwnProperty','exports','events','WhatsappInteraction','WhatsappMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0xd64b,0xc1));var _0xbd64=function(_0x2c204a,_0x119aa9){_0x2c204a=_0x2c204a-0x0;var _0xf68ab1=_0xd64b[_0x2c204a];return _0xf68ab1;};'use strict';var EventEmitter=require(_0xbd64('0x0'));var WhatsappInteraction=require('../../mysqldb')['db'][_0xbd64('0x1')];var WhatsappMessage=require('../../mysqldb')['db'][_0xbd64('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xbd64('0x3')](0x0);var events={'afterCreate':_0xbd64('0x4'),'afterUpdate':_0xbd64('0x5'),'afterDestroy':_0xbd64('0x6')};function emitEvent(_0x5458d8){return function(_0x5446e4,_0x54f916,_0x51e87d){_0x5446e4[_0xbd64('0x7')]({'attributes':['id'],'raw':!![]})[_0xbd64('0x8')](function(_0x3e700e){_0x5446e4[_0xbd64('0x9')](_0xbd64('0xa'),_0x3e700e[_0xbd64('0xb')](function(_0x197a84){return{'id':_0x197a84['id']};}));return WhatsappMessage['findAll']({'where':{'WhatsappInteractionId':_0x5446e4['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x40919e){_0x5446e4[_0xbd64('0x9')](_0xbd64('0xc'),_0x40919e['length']);WhatsappInteractionEvents[_0xbd64('0xd')](_0x5458d8+':'+_0x5446e4['id'],_0x5446e4);WhatsappInteractionEvents[_0xbd64('0xd')](_0x5458d8,_0x5446e4);_0x51e87d(null);})[_0xbd64('0xe')](_0x51e87d(null));};}for(var e in events){if(events[_0xbd64('0xf')](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module[_0xbd64('0x10')]=WhatsappInteractionEvents; \ No newline at end of file +var _0xe3ed=['WhatsappMessage','setMaxListeners','save','update','then','Users','map','findAll','setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','exports','events','../../mysqldb','WhatsappInteraction'];(function(_0x34f991,_0x3db8b9){var _0x184b4b=function(_0x14e5af){while(--_0x14e5af){_0x34f991['push'](_0x34f991['shift']());}};_0x184b4b(++_0x3db8b9);}(_0xe3ed,0x8d));var _0xde3e=function(_0x6afd87,_0x3f7544){_0x6afd87=_0x6afd87-0x0;var _0x3e5ec7=_0xe3ed[_0x6afd87];return _0x3e5ec7;};'use strict';var EventEmitter=require(_0xde3e('0x0'));var WhatsappInteraction=require(_0xde3e('0x1'))['db'][_0xde3e('0x2')];var WhatsappMessage=require(_0xde3e('0x1'))['db'][_0xde3e('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xde3e('0x4')](0x0);var events={'afterCreate':_0xde3e('0x5'),'afterUpdate':_0xde3e('0x6'),'afterDestroy':'remove'};function emitEvent(_0xe768f5){return function(_0x3e214c,_0x5a1abf,_0x3405cc){_0x3e214c['getUsers']({'attributes':['id'],'raw':!![]})[_0xde3e('0x7')](function(_0x4c4ac6){_0x3e214c['setDataValue'](_0xde3e('0x8'),_0x4c4ac6[_0xde3e('0x9')](function(_0xceed52){return{'id':_0xceed52['id']};}));return WhatsappMessage[_0xde3e('0xa')]({'where':{'WhatsappInteractionId':_0x3e214c['id'],'direction':'in','read':![]},'raw':!![]});})[_0xde3e('0x7')](function(_0x4aec4d){_0x3e214c[_0xde3e('0xb')](_0xde3e('0xc'),_0x4aec4d[_0xde3e('0xd')]);WhatsappInteractionEvents[_0xde3e('0xe')](_0xe768f5+':'+_0x3e214c['id'],_0x3e214c);WhatsappInteractionEvents['emit'](_0xe768f5,_0x3e214c);_0x3405cc(null);})[_0xde3e('0xf')](_0x3405cc(null));};}for(var e in events){if(events[_0xde3e('0x10')](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module[_0xde3e('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 c481c4d..4a57397 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 _0xcac5=['closedAt','YYYY-MM-DD\x20HH:mm:ss','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./whatsappInteraction.attributes','define','whatsapp_interactions','changed','closed'];(function(_0x456660,_0x4e2958){var _0x3410d9=function(_0x2066b0){while(--_0x2066b0){_0x456660['push'](_0x456660['shift']());}};_0x3410d9(++_0x4e2958);}(_0xcac5,0xb8));var _0x5cac=function(_0x49f8fd,_0x27dac7){_0x49f8fd=_0x49f8fd-0x0;var _0xda175e=_0xcac5[_0x49f8fd];return _0xda175e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5cac('0x0'))(_0x5cac('0x1'));var moment=require(_0x5cac('0x2'));var BPromise=require(_0x5cac('0x3'));var rp=require(_0x5cac('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5cac('0x5'));var config=require(_0x5cac('0x6'));var attributes=require(_0x5cac('0x7'));module['exports']=function(_0x4b6775,_0x2d5400){return _0x4b6775[_0x5cac('0x8')]('WhatsappInteraction',attributes,{'tableName':_0x5cac('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x59860c,_0x549c43,_0x58af55){if(_0x59860c[_0x5cac('0xa')](_0x5cac('0xb'))){_0x59860c[_0x5cac('0xc')]=moment()['format'](_0x5cac('0xd'));}_0x58af55(null,_0x59860c);}}});}; \ No newline at end of file +var _0x6456=['WhatsappInteraction','whatsapp_interactions','changed','closed','closedAt','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappInteraction.attributes'];(function(_0x3b22e9,_0x354406){var _0x230314=function(_0x29ae96){while(--_0x29ae96){_0x3b22e9['push'](_0x3b22e9['shift']());}};_0x230314(++_0x354406);}(_0x6456,0xe6));var _0x6645=function(_0x11bbc3,_0x38e184){_0x11bbc3=_0x11bbc3-0x0;var _0x354da4=_0x6456[_0x11bbc3];return _0x354da4;};'use strict';var _=require(_0x6645('0x0'));var util=require(_0x6645('0x1'));var logger=require(_0x6645('0x2'))('api');var moment=require(_0x6645('0x3'));var BPromise=require(_0x6645('0x4'));var rp=require(_0x6645('0x5'));var fs=require('fs');var path=require(_0x6645('0x6'));var rimraf=require(_0x6645('0x7'));var config=require(_0x6645('0x8'));var attributes=require(_0x6645('0x9'));module['exports']=function(_0x442857,_0x49d1ae){return _0x442857['define'](_0x6645('0xa'),attributes,{'tableName':_0x6645('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x50e21e,_0x879f17,_0x43770d){if(_0x50e21e[_0x6645('0xc')](_0x6645('0xd'))){_0x50e21e[_0x6645('0xe')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x43770d(null,_0x50e21e);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index fa9971d..9831124 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 _0xab3a=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','register','then','info','WhatsappInteraction,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','options','where','attributes','limit','stringify','addTags','body','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x532272,_0x34dd2){var _0x5edcd6=function(_0x5d1951){while(--_0x5d1951){_0x532272['push'](_0x532272['shift']());}};_0x5edcd6(++_0x34dd2);}(_0xab3a,0x1d3));var _0xaab3=function(_0x5428f5,_0x363285){_0x5428f5=_0x5428f5-0x0;var _0xf745ce=_0xab3a[_0x5428f5];return _0xf745ce;};'use strict';var _=require(_0xaab3('0x0'));var util=require(_0xaab3('0x1'));var moment=require(_0xaab3('0x2'));var BPromise=require(_0xaab3('0x3'));var rs=require(_0xaab3('0x4'));var fs=require('fs');var Redis=require(_0xaab3('0x5'));var db=require(_0xaab3('0x6'))['db'];var utils=require(_0xaab3('0x7'));var logger=require(_0xaab3('0x8'))(_0xaab3('0x9'));var config=require(_0xaab3('0xa'));var jayson=require(_0xaab3('0xb'));var client=jayson[_0xaab3('0xc')]['http']({'port':0x232a});config['redis']=_[_0xaab3('0xd')](config[_0xaab3('0xe')],{'host':_0xaab3('0xf'),'port':0x18eb});var socket=require(_0xaab3('0x10'))(new Redis(config[_0xaab3('0xe')]));require(_0xaab3('0x11'))[_0xaab3('0x12')](socket);function respondWithRpcPromise(_0x2ee82a,_0x3595c0,_0x151330){return new BPromise(function(_0x404054,_0x54c60d){return client['request'](_0x2ee82a,_0x151330)[_0xaab3('0x13')](function(_0x45363f){logger[_0xaab3('0x14')](_0xaab3('0x15'),_0x3595c0,'request\x20sent');logger[_0xaab3('0x16')]('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x3595c0,_0xaab3('0x17'),JSON['stringify'](_0x45363f));if(_0x45363f[_0xaab3('0x18')]){if(_0x45363f[_0xaab3('0x18')][_0xaab3('0x19')]===0x1f4){logger['error'](_0xaab3('0x15'),_0x3595c0,_0x45363f[_0xaab3('0x18')]['message']);return _0x54c60d(_0x45363f[_0xaab3('0x18')][_0xaab3('0x1a')]);}logger[_0xaab3('0x18')]('WhatsappInteraction,\x20%s,\x20%s',_0x3595c0,_0x45363f['error']['message']);return _0x404054(_0x45363f['error'][_0xaab3('0x1a')]);}else{logger[_0xaab3('0x14')](_0xaab3('0x15'),_0x3595c0,'request\x20sent');_0x404054(_0x45363f[_0xaab3('0x1b')][_0xaab3('0x1a')]);}})[_0xaab3('0x1c')](function(_0x13048f){logger[_0xaab3('0x18')](_0xaab3('0x15'),_0x3595c0,_0x13048f);_0x54c60d(_0x13048f);});});}exports[_0xaab3('0x1d')]=function(_0x5a865b){var _0x1b72a5=this;return new Promise(function(_0x3bcc3b,_0x43a8d4){return db[_0xaab3('0x1e')][_0xaab3('0x1f')](_0x5a865b['body'],{'raw':_0x5a865b['options']?_0x5a865b['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5a865b['options']?_0x5a865b[_0xaab3('0x20')][_0xaab3('0x21')]||null:null,'attributes':_0x5a865b[_0xaab3('0x20')]?_0x5a865b[_0xaab3('0x20')][_0xaab3('0x22')]||null:null,'limit':_0x5a865b[_0xaab3('0x20')]?_0x5a865b[_0xaab3('0x20')][_0xaab3('0x23')]||null:null})[_0xaab3('0x13')](function(_0x46e004){logger[_0xaab3('0x14')](_0xaab3('0x1d'),_0x5a865b);logger[_0xaab3('0x16')]('UpdateWhatsappInteraction',_0x5a865b,JSON[_0xaab3('0x24')](_0x46e004));_0x3bcc3b(_0x46e004);})['catch'](function(_0x28eaff){logger[_0xaab3('0x18')]('UpdateWhatsappInteraction',_0x28eaff[_0xaab3('0x1a')],_0x5a865b);_0x43a8d4(_0x1b72a5[_0xaab3('0x18')](0x1f4,_0x28eaff[_0xaab3('0x1a')]));});});};exports['AddTagsToWhatsappInteraction']=function(_0x4f5eec){return new Promise(function(_0x2f9833,_0x205996){return db[_0xaab3('0x1e')]['find']({'where':_0x4f5eec[_0xaab3('0x20')]?_0x4f5eec[_0xaab3('0x20')][_0xaab3('0x21')]||null:null})[_0xaab3('0x13')](function(_0x35a13d){if(_0x35a13d){return _0x35a13d[_0xaab3('0x25')](_0x4f5eec[_0xaab3('0x26')][_0xaab3('0x27')],_[_0xaab3('0x28')](_0x4f5eec[_0xaab3('0x26')],[_0xaab3('0x27'),'id'])||{});}})[_0xaab3('0x29')](function(_0xc33cb4){logger[_0xaab3('0x14')]('AddTags',_0x4f5eec);logger[_0xaab3('0x16')](_0xaab3('0x2a'),_0x4f5eec,JSON[_0xaab3('0x24')](_0xc33cb4));_0x2f9833(_0xc33cb4);})[_0xaab3('0x1c')](function(_0xc7cead){logger[_0xaab3('0x18')]('AddTags',_0xc7cead[_0xaab3('0x1a')],_0x4f5eec);_0x205996(_this['error'](0x1f4,_0xc7cead['message']));});});}; \ No newline at end of file +var _0x6216=['then','info','request\x20sent','error','code','WhatsappInteraction,\x20%s,\x20%s','message','result','UpdateWhatsappInteraction','update','body','options','raw','where','limit','debug','catch','WhatsappInteraction','addTags','ids','omit','spread','AddTags','stringify','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','register'];(function(_0x2e7c1e,_0x4de797){var _0x5881a8=function(_0x2c7c05){while(--_0x2c7c05){_0x2e7c1e['push'](_0x2e7c1e['shift']());}};_0x5881a8(++_0x4de797);}(_0x6216,0x1b2));var _0x6621=function(_0x1829fd,_0x33b470){_0x1829fd=_0x1829fd-0x0;var _0x177d22=_0x6216[_0x1829fd];return _0x177d22;};'use strict';var _=require(_0x6621('0x0'));var util=require(_0x6621('0x1'));var moment=require(_0x6621('0x2'));var BPromise=require('bluebird');var rs=require(_0x6621('0x3'));var fs=require('fs');var Redis=require(_0x6621('0x4'));var db=require(_0x6621('0x5'))['db'];var utils=require(_0x6621('0x6'));var logger=require(_0x6621('0x7'))(_0x6621('0x8'));var config=require('../../config/environment');var jayson=require(_0x6621('0x9'));var client=jayson[_0x6621('0xa')]['http']({'port':0x232a});config['redis']=_[_0x6621('0xb')](config[_0x6621('0xc')],{'host':_0x6621('0xd'),'port':0x18eb});var socket=require(_0x6621('0xe'))(new Redis(config['redis']));require(_0x6621('0xf'))[_0x6621('0x10')](socket);function respondWithRpcPromise(_0x1088f7,_0x3d35f0,_0x454e67){return new BPromise(function(_0x4a674c,_0x1c44e1){return client['request'](_0x1088f7,_0x454e67)[_0x6621('0x11')](function(_0x32d0a4){logger[_0x6621('0x12')]('WhatsappInteraction,\x20%s,\x20%s',_0x3d35f0,_0x6621('0x13'));logger['debug']('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x3d35f0,_0x6621('0x13'),JSON['stringify'](_0x32d0a4));if(_0x32d0a4[_0x6621('0x14')]){if(_0x32d0a4[_0x6621('0x14')][_0x6621('0x15')]===0x1f4){logger[_0x6621('0x14')](_0x6621('0x16'),_0x3d35f0,_0x32d0a4['error'][_0x6621('0x17')]);return _0x1c44e1(_0x32d0a4[_0x6621('0x14')][_0x6621('0x17')]);}logger['error']('WhatsappInteraction,\x20%s,\x20%s',_0x3d35f0,_0x32d0a4[_0x6621('0x14')]['message']);return _0x4a674c(_0x32d0a4[_0x6621('0x14')][_0x6621('0x17')]);}else{logger[_0x6621('0x12')](_0x6621('0x16'),_0x3d35f0,'request\x20sent');_0x4a674c(_0x32d0a4[_0x6621('0x18')][_0x6621('0x17')]);}})['catch'](function(_0x5ddd1f){logger[_0x6621('0x14')]('WhatsappInteraction,\x20%s,\x20%s',_0x3d35f0,_0x5ddd1f);_0x1c44e1(_0x5ddd1f);});});}exports[_0x6621('0x19')]=function(_0x1444e8){var _0x1008c1=this;return new Promise(function(_0x25a06b,_0x4380e8){return db['WhatsappInteraction'][_0x6621('0x1a')](_0x1444e8[_0x6621('0x1b')],{'raw':_0x1444e8[_0x6621('0x1c')]?_0x1444e8[_0x6621('0x1c')][_0x6621('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1444e8[_0x6621('0x1c')]?_0x1444e8[_0x6621('0x1c')][_0x6621('0x1e')]||null:null,'attributes':_0x1444e8['options']?_0x1444e8['options']['attributes']||null:null,'limit':_0x1444e8[_0x6621('0x1c')]?_0x1444e8[_0x6621('0x1c')][_0x6621('0x1f')]||null:null})[_0x6621('0x11')](function(_0x2b9c2c){logger[_0x6621('0x12')](_0x6621('0x19'),_0x1444e8);logger[_0x6621('0x20')](_0x6621('0x19'),_0x1444e8,JSON['stringify'](_0x2b9c2c));_0x25a06b(_0x2b9c2c);})[_0x6621('0x21')](function(_0x5f23a9){logger[_0x6621('0x14')](_0x6621('0x19'),_0x5f23a9[_0x6621('0x17')],_0x1444e8);_0x4380e8(_0x1008c1[_0x6621('0x14')](0x1f4,_0x5f23a9['message']));});});};exports['AddTagsToWhatsappInteraction']=function(_0x148717){return new Promise(function(_0x481070,_0x49e65f){return db[_0x6621('0x22')]['find']({'where':_0x148717[_0x6621('0x1c')]?_0x148717[_0x6621('0x1c')][_0x6621('0x1e')]||null:null})[_0x6621('0x11')](function(_0x2be243){if(_0x2be243){return _0x2be243[_0x6621('0x23')](_0x148717[_0x6621('0x1b')][_0x6621('0x24')],_[_0x6621('0x25')](_0x148717[_0x6621('0x1b')],[_0x6621('0x24'),'id'])||{});}})[_0x6621('0x26')](function(_0x2f1c91){logger['info'](_0x6621('0x27'),_0x148717);logger[_0x6621('0x20')]('AddTags',_0x148717,JSON[_0x6621('0x28')](_0x2f1c91));_0x481070(_0x2f1c91);})[_0x6621('0x21')](function(_0x33ce00){logger['error'](_0x6621('0x27'),_0x33ce00['message'],_0x148717);_0x49e65f(_this[_0x6621('0x14')](0x1f4,_0x33ce00[_0x6621('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 4c30f7e..3d643f1 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 _0x4e8d=['save','update','register','length','whatsappInteraction:','./whatsappInteraction.events'];(function(_0x4caf03,_0x538d94){var _0x35770c=function(_0x140433){while(--_0x140433){_0x4caf03['push'](_0x4caf03['shift']());}};_0x35770c(++_0x538d94);}(_0x4e8d,0xc5));var _0xd4e8=function(_0x5815e5,_0x1e8953){_0x5815e5=_0x5815e5-0x0;var _0x2419a1=_0x4e8d[_0x5815e5];return _0x2419a1;};'use strict';var WhatsappInteractionEvents=require(_0xd4e8('0x0'));var events=[_0xd4e8('0x1'),'remove',_0xd4e8('0x2')];function createListener(_0x31bf74,_0x1441b3){return function(_0x100869){_0x1441b3['emit'](_0x31bf74,_0x100869);};}function removeListener(_0x1ce484,_0x4c5809){return function(){WhatsappInteractionEvents['removeListener'](_0x1ce484,_0x4c5809);};}exports[_0xd4e8('0x3')]=function(_0x2da97c){for(var _0x4c7dc7=0x0,_0x3fb1bd=events[_0xd4e8('0x4')];_0x4c7dc7<_0x3fb1bd;_0x4c7dc7++){var _0x2623d1=events[_0x4c7dc7];var _0xd15d0c=createListener(_0xd4e8('0x5')+_0x2623d1,_0x2da97c);WhatsappInteractionEvents['on'](_0x2623d1,_0xd15d0c);}}; \ No newline at end of file +var _0x2200=['remove','emit','register','length','whatsappInteraction:'];(function(_0x541384,_0x1a50e2){var _0x43811=function(_0x11069b){while(--_0x11069b){_0x541384['push'](_0x541384['shift']());}};_0x43811(++_0x1a50e2);}(_0x2200,0xaa));var _0x0220=function(_0x5a99db,_0x1cece5){_0x5a99db=_0x5a99db-0x0;var _0x3aad62=_0x2200[_0x5a99db];return _0x3aad62;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=['save',_0x0220('0x0'),'update'];function createListener(_0x28c9cd,_0xfb3aaf){return function(_0x556cdf){_0xfb3aaf[_0x0220('0x1')](_0x28c9cd,_0x556cdf);};}function removeListener(_0x281939,_0x478526){return function(){WhatsappInteractionEvents['removeListener'](_0x281939,_0x478526);};}exports[_0x0220('0x2')]=function(_0x3cd402){for(var _0x482986=0x0,_0x3404a4=events[_0x0220('0x3')];_0x482986<_0x3404a4;_0x482986++){var _0x47066c=events[_0x482986];var _0x11a1c4=createListener(_0x0220('0x4')+_0x47066c,_0x3cd402);WhatsappInteractionEvents['on'](_0x47066c,_0x11a1c4);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index c3b7e85..9577ed9 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 _0xad40=['create','/:id/status','put','/:id/accept','/:id/reject','reject','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','post','tracked','whatsapp','whatsappmessage:create'];(function(_0x4c6cf0,_0x826f70){var _0x108145=function(_0x299f69){while(--_0x299f69){_0x4c6cf0['push'](_0x4c6cf0['shift']());}};_0x108145(++_0x826f70);}(_0xad40,0x116));var _0x0ad4=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xad40[_0x2b10c6];return _0x3789d2;};'use strict';var multer=require(_0x0ad4('0x0'));var util=require(_0x0ad4('0x1'));var path=require('path');var timeout=require(_0x0ad4('0x2'));var express=require(_0x0ad4('0x3'));var router=express[_0x0ad4('0x4')]();var fs_extra=require(_0x0ad4('0x5'));var auth=require(_0x0ad4('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x0ad4('0x7'));var controller=require(_0x0ad4('0x8'));router[_0x0ad4('0x9')]('/',auth[_0x0ad4('0xa')](),controller[_0x0ad4('0xb')]);router[_0x0ad4('0x9')](_0x0ad4('0xc'),auth[_0x0ad4('0xa')](),controller[_0x0ad4('0xd')]);router[_0x0ad4('0x9')](_0x0ad4('0xe'),auth[_0x0ad4('0xa')](),controller['show']);router[_0x0ad4('0xf')]('/',auth[_0x0ad4('0xa')](),interaction[_0x0ad4('0x10')](_0x0ad4('0x11'),_0x0ad4('0x12')),controller[_0x0ad4('0x13')]);router[_0x0ad4('0xf')](_0x0ad4('0x14'),controller['status']);router[_0x0ad4('0x15')](_0x0ad4('0xe'),auth[_0x0ad4('0xa')](),controller['update']);router[_0x0ad4('0x15')](_0x0ad4('0x16'),auth[_0x0ad4('0xa')](),controller['accept']);router[_0x0ad4('0x15')](_0x0ad4('0x17'),auth[_0x0ad4('0xa')](),controller[_0x0ad4('0x18')]);router[_0x0ad4('0x19')]('/:id',auth[_0x0ad4('0xa')](),controller['destroy']);module[_0x0ad4('0x1a')]=router; \ No newline at end of file +var _0x359c=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','whatsapp','whatsappmessage:create','create','/:id/status','put','update','/:id/accept','/:id/reject','reject','delete','destroy','multer','util','path','connect-timeout','express','Router'];(function(_0x3b4463,_0x557e2d){var _0x1029d6=function(_0x272c51){while(--_0x272c51){_0x3b4463['push'](_0x3b4463['shift']());}};_0x1029d6(++_0x557e2d);}(_0x359c,0x14f));var _0xc359=function(_0x57ee76,_0x130268){_0x57ee76=_0x57ee76-0x0;var _0x376e0e=_0x359c[_0x57ee76];return _0x376e0e;};'use strict';var multer=require(_0xc359('0x0'));var util=require(_0xc359('0x1'));var path=require(_0xc359('0x2'));var timeout=require(_0xc359('0x3'));var express=require(_0xc359('0x4'));var router=express[_0xc359('0x5')]();var fs_extra=require(_0xc359('0x6'));var auth=require(_0xc359('0x7'));var interaction=require(_0xc359('0x8'));var config=require(_0xc359('0x9'));var controller=require(_0xc359('0xa'));router[_0xc359('0xb')]('/',auth[_0xc359('0xc')](),controller[_0xc359('0xd')]);router[_0xc359('0xb')](_0xc359('0xe'),auth[_0xc359('0xc')](),controller[_0xc359('0xf')]);router[_0xc359('0xb')](_0xc359('0x10'),auth[_0xc359('0xc')](),controller[_0xc359('0x11')]);router[_0xc359('0x12')]('/',auth[_0xc359('0xc')](),interaction[_0xc359('0x13')](_0xc359('0x14'),_0xc359('0x15')),controller[_0xc359('0x16')]);router['post'](_0xc359('0x17'),controller['status']);router[_0xc359('0x18')]('/:id',auth[_0xc359('0xc')](),controller[_0xc359('0x19')]);router[_0xc359('0x18')](_0xc359('0x1a'),auth['isAuthenticated'](),controller['accept']);router[_0xc359('0x18')](_0xc359('0x1b'),auth[_0xc359('0xc')](),controller[_0xc359('0x1c')]);router[_0xc359('0x1d')](_0xc359('0x10'),auth[_0xc359('0xc')](),controller[_0xc359('0x1e')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index d691cde..2110031 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 _0x9f13=['BOOLEAN','ENUM','out','STRING','DATE','sequelize','exports','TEXT','medium'];(function(_0x5d6e35,_0x4d1ac0){var _0x5d7ada=function(_0x2f7dd3){while(--_0x2f7dd3){_0x5d6e35['push'](_0x5d6e35['shift']());}};_0x5d7ada(++_0x4d1ac0);}(_0x9f13,0x1f4));var _0x39f1=function(_0x49a982,_0x129a07){_0x49a982=_0x49a982-0x0;var _0x2a0bc9=_0x9f13[_0x49a982];return _0x2a0bc9;};'use strict';var Sequelize=require(_0x39f1('0x0'));module[_0x39f1('0x1')]={'body':{'type':Sequelize[_0x39f1('0x2')](_0x39f1('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x39f1('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x39f1('0x5')]('in',_0x39f1('0x6')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x39f1('0x7')](0xbe)},'phone':{'type':Sequelize[_0x39f1('0x7')]},'readAt':{'type':Sequelize[_0x39f1('0x8')]},'secret':{'type':Sequelize[_0x39f1('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x39f1('0x7')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xf61a=['STRING','DATE','BOOLEAN','exports','TEXT','medium','out'];(function(_0x2967c1,_0x202a72){var _0x103397=function(_0x14b5cc){while(--_0x14b5cc){_0x2967c1['push'](_0x2967c1['shift']());}};_0x103397(++_0x202a72);}(_0xf61a,0xe3));var _0xaf61=function(_0x21e304,_0xd47568){_0x21e304=_0x21e304-0x0;var _0x1f449e=_0xf61a[_0x21e304];return _0x1f449e;};'use strict';var Sequelize=require('sequelize');module[_0xaf61('0x0')]={'body':{'type':Sequelize[_0xaf61('0x1')](_0xaf61('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xaf61('0x3')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0xaf61('0x4')](0xbe)},'phone':{'type':Sequelize[_0xaf61('0x4')]},'readAt':{'type':Sequelize[_0xaf61('0x5')]},'secret':{'type':Sequelize[_0xaf61('0x6')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xaf61('0x4')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index c7411b6..e97afb2 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 _0x1374=['AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','User','fullname','internal','interface','SIP/%s','channel','event','EventManager','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','contact','motionChannel','WhatsappAccountId','debug','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','moment','bluebird','mustache','util','path','ejs','lodash','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','socket.io-emitter','redis','./whatsappMessage.socket','register','jayson/promise','client','http','request','then','WhatsappMessage,\x20%s,\x20%s','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','json','offset','undefined','limit','count','status','reject','save','update','destroy','end','stack','send','index','map','WhatsappMessage','rawAttributes','type','key','name','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','VIRTUAL','merge','options','where','includeAll','include','findAll','catch','show','params','create','body','find','describe','whatsapp-interactions','accept','whatsapp','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','WhatsappInteraction','isNil','read1stAt','interaction','get','info','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null'];(function(_0x40d14d,_0xda4f2){var _0x24c0e3=function(_0x20bf57){while(--_0x20bf57){_0x40d14d['push'](_0x40d14d['shift']());}};_0x24c0e3(++_0xda4f2);}(_0x1374,0x1c0));var _0x4137=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0x1374[_0x263a74];return _0x2aa86c;};'use strict';var emlformat=require(_0x4137('0x0'));var rimraf=require(_0x4137('0x1'));var zipdir=require(_0x4137('0x2'));var jsonpatch=require(_0x4137('0x3'));var rp=require(_0x4137('0x4'));var moment=require(_0x4137('0x5'));var BPromise=require(_0x4137('0x6'));var Mustache=require(_0x4137('0x7'));var util=require(_0x4137('0x8'));var path=require(_0x4137('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4137('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4137('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4137('0xc'));var deskjs=require(_0x4137('0xd'));var toCsv=require(_0x4137('0xe'));var querystring=require(_0x4137('0xf'));var Papa=require('papaparse');var Redis=require(_0x4137('0x10'));var authService=require(_0x4137('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x4137('0x12'));var hardwareService=require(_0x4137('0x13'));var logger=require(_0x4137('0x14'))(_0x4137('0x15'));var utils=require(_0x4137('0x16'));var config=require(_0x4137('0x17'));var licenseUtil=require(_0x4137('0x18'));var db=require(_0x4137('0x19'))['db'];config['redis']=_[_0x4137('0x1a')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x4137('0x1b'))(new Redis(config[_0x4137('0x1c')]));require(_0x4137('0x1d'))[_0x4137('0x1e')](socket);var jayson=require(_0x4137('0x1f'));var client=jayson[_0x4137('0x20')][_0x4137('0x21')]({'port':0x232c});var client9002=jayson[_0x4137('0x20')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1a1c02,_0x25ad5e,_0x2efe88,_0x2b0489){return new BPromise(function(_0x19df98,_0x2d8831){var _0x3b7400=_0x2b0489||client;return _0x3b7400[_0x4137('0x22')](_0x1a1c02,_0x2efe88)[_0x4137('0x23')](function(_0x354749){logger['info'](_0x4137('0x24'),_0x25ad5e,_0x4137('0x25'));logger['debug'](_0x4137('0x26'),_0x25ad5e,_0x4137('0x25'),JSON[_0x4137('0x27')](_0x354749));if(_0x354749[_0x4137('0x28')]){if(_0x354749[_0x4137('0x28')][_0x4137('0x29')]===0x1f4){logger['error'](_0x4137('0x24'),_0x25ad5e,_0x354749[_0x4137('0x28')][_0x4137('0x2a')]);return _0x2d8831(_0x354749[_0x4137('0x28')][_0x4137('0x2a')]);}logger[_0x4137('0x28')](_0x4137('0x24'),_0x25ad5e,_0x354749['error'][_0x4137('0x2a')]);return _0x19df98(_0x354749[_0x4137('0x28')][_0x4137('0x2a')]);}else{logger['info'](_0x4137('0x24'),_0x25ad5e,'request\x20sent');_0x19df98(_0x354749[_0x4137('0x2b')]['message']);}})['catch'](function(_0x28c963){logger['error'](_0x4137('0x24'),_0x25ad5e,_0x28c963);_0x2d8831(_0x28c963);});});}function respondWithStatusCode(_0x53bcd0,_0x50559f){_0x50559f=_0x50559f||0xcc;return function(_0x1e7c4d){if(_0x1e7c4d){return _0x53bcd0[_0x4137('0x2c')](_0x50559f);}return _0x53bcd0['status'](_0x50559f)['end']();};}function respondWithResult(_0x4fa4b5,_0x364164){_0x364164=_0x364164||0xc8;return function(_0x2b38a2){if(_0x2b38a2){return _0x4fa4b5['status'](_0x364164)[_0x4137('0x2d')](_0x2b38a2);}};}function respondWithFilteredResult(_0x1512a7,_0x10c131){return function(_0x4abfbf){if(_0x4abfbf){var _0x275055=typeof _0x10c131[_0x4137('0x2e')]===_0x4137('0x2f')&&typeof _0x10c131[_0x4137('0x30')]==='undefined';var _0x54ef21=_0x4abfbf[_0x4137('0x31')];var _0x82b21c=_0x275055?0x0:_0x10c131[_0x4137('0x2e')];var _0x19fe68=_0x275055?_0x4abfbf[_0x4137('0x31')]:_0x10c131['offset']+_0x10c131['limit'];var _0x34ea71;if(_0x19fe68>=_0x54ef21){_0x19fe68=_0x54ef21;_0x34ea71=0xc8;}else{_0x34ea71=0xce;}_0x1512a7[_0x4137('0x32')](_0x34ea71);return _0x1512a7['set']('Content-Range',_0x82b21c+'-'+_0x19fe68+'/'+_0x54ef21)[_0x4137('0x2d')](_0x4abfbf);}return null;};}function patchUpdates(_0x1b75d9){return function(_0x28c976){try{jsonpatch['apply'](_0x28c976,_0x1b75d9,!![]);}catch(_0x174b26){return BPromise[_0x4137('0x33')](_0x174b26);}return _0x28c976[_0x4137('0x34')]();};}function saveUpdates(_0x46e618,_0x309f5f){return function(_0x1464b0){if(_0x1464b0){return _0x1464b0[_0x4137('0x35')](_0x46e618)[_0x4137('0x23')](function(_0x28c167){return _0x28c167;});}return null;};}function removeEntity(_0x4edbf6,_0x54573d){return function(_0x3113c1){if(_0x3113c1){return _0x3113c1[_0x4137('0x36')]()['then'](function(){_0x4edbf6[_0x4137('0x32')](0xcc)[_0x4137('0x37')]();});}};}function handleEntityNotFound(_0x20ee54,_0x4b8694){return function(_0x8f3f9c){if(!_0x8f3f9c){_0x20ee54[_0x4137('0x2c')](0x194);}return _0x8f3f9c;};}function handleError(_0x3e65e4,_0x422f0a){_0x422f0a=_0x422f0a||0x1f4;return function(_0x26ad82){logger[_0x4137('0x28')](_0x26ad82[_0x4137('0x38')]);if(_0x26ad82['name']){delete _0x26ad82['name'];}_0x3e65e4[_0x4137('0x32')](_0x422f0a)[_0x4137('0x39')](_0x26ad82);};}exports[_0x4137('0x3a')]=function(_0x4cce85,_0x328eaf){var _0x476fbe={},_0x3caf12={},_0xc76623={'count':0x0,'rows':[]};var _0x32c812=_[_0x4137('0x3b')](db[_0x4137('0x3c')][_0x4137('0x3d')],function(_0x2847d8){return{'name':_0x2847d8['fieldName'],'type':_0x2847d8[_0x4137('0x3e')][_0x4137('0x3f')]};});_0x3caf12['model']=_[_0x4137('0x3b')](_0x32c812,_0x4137('0x40'));_0x3caf12['query']=_[_0x4137('0x41')](_0x4cce85[_0x4137('0x42')]);_0x3caf12[_0x4137('0x43')]=_[_0x4137('0x44')](_0x3caf12[_0x4137('0x45')],_0x3caf12[_0x4137('0x42')]);_0x476fbe[_0x4137('0x46')]=_[_0x4137('0x44')](_0x3caf12['model'],qs[_0x4137('0x47')](_0x4cce85[_0x4137('0x42')][_0x4137('0x47')]));_0x476fbe['attributes']=_0x476fbe[_0x4137('0x46')][_0x4137('0x48')]?_0x476fbe['attributes']:_0x3caf12['model'];if(!_0x4cce85[_0x4137('0x42')][_0x4137('0x49')](_0x4137('0x4a'))){_0x476fbe[_0x4137('0x30')]=qs[_0x4137('0x30')](_0x4cce85[_0x4137('0x42')][_0x4137('0x30')]);_0x476fbe[_0x4137('0x2e')]=qs[_0x4137('0x2e')](_0x4cce85[_0x4137('0x42')][_0x4137('0x2e')]);}_0x476fbe[_0x4137('0x4b')]=qs[_0x4137('0x4c')](_0x4cce85[_0x4137('0x42')][_0x4137('0x4c')]);_0x476fbe['where']=qs[_0x4137('0x43')](_[_0x4137('0x4d')](_0x4cce85[_0x4137('0x42')],_0x3caf12[_0x4137('0x43')]),_0x32c812);if(_0x4cce85[_0x4137('0x42')][_0x4137('0x4e')]){_0x476fbe['where']=_['merge'](_0x476fbe['where'],{'$or':_['map'](_0x32c812,function(_0xdd3a9b){if(_0xdd3a9b['type']!==_0x4137('0x4f')){var _0x337f21={};_0x337f21[_0xdd3a9b[_0x4137('0x40')]]={'$like':'%'+_0x4cce85[_0x4137('0x42')][_0x4137('0x4e')]+'%'};return _0x337f21;}})});}_0x476fbe=_[_0x4137('0x50')]({},_0x476fbe,_0x4cce85[_0x4137('0x51')]);var _0xb4662f={'where':_0x476fbe[_0x4137('0x52')]};return db[_0x4137('0x3c')]['count'](_0xb4662f)[_0x4137('0x23')](function(_0x521a3d){_0xc76623[_0x4137('0x31')]=_0x521a3d;if(_0x4cce85[_0x4137('0x42')][_0x4137('0x53')]){_0x476fbe[_0x4137('0x54')]=[{'all':!![]}];}return db['WhatsappMessage'][_0x4137('0x55')](_0x476fbe);})[_0x4137('0x23')](function(_0xe2df3d){_0xc76623['rows']=_0xe2df3d;return _0xc76623;})['then'](respondWithFilteredResult(_0x328eaf,_0x476fbe))[_0x4137('0x56')](handleError(_0x328eaf,null));};exports[_0x4137('0x57')]=function(_0x3ea10d,_0x41d170){var _0x41d5a7={'raw':!![],'where':{'id':_0x3ea10d[_0x4137('0x58')]['id']}},_0x3a20e1={};_0x3a20e1['model']=_['keys'](db[_0x4137('0x3c')][_0x4137('0x3d')]);_0x3a20e1['query']=_['keys'](_0x3ea10d[_0x4137('0x42')]);_0x3a20e1[_0x4137('0x43')]=_[_0x4137('0x44')](_0x3a20e1[_0x4137('0x45')],_0x3a20e1[_0x4137('0x42')]);_0x41d5a7['attributes']=_['intersection'](_0x3a20e1['model'],qs['fields'](_0x3ea10d[_0x4137('0x42')][_0x4137('0x47')]));_0x41d5a7[_0x4137('0x46')]=_0x41d5a7[_0x4137('0x46')][_0x4137('0x48')]?_0x41d5a7['attributes']:_0x3a20e1[_0x4137('0x45')];if(_0x3ea10d[_0x4137('0x42')][_0x4137('0x53')]){_0x41d5a7[_0x4137('0x54')]=[{'all':!![]}];}_0x41d5a7=_[_0x4137('0x50')]({},_0x41d5a7,_0x3ea10d[_0x4137('0x51')]);return db[_0x4137('0x3c')]['find'](_0x41d5a7)['then'](handleEntityNotFound(_0x41d170,null))['then'](respondWithResult(_0x41d170,null))['catch'](handleError(_0x41d170,null));};exports[_0x4137('0x59')]=function(_0x1a182c,_0x24e988){return db[_0x4137('0x3c')]['create'](_0x1a182c[_0x4137('0x5a')],{})['then'](respondWithResult(_0x24e988,0xc9))[_0x4137('0x56')](handleError(_0x24e988,null));};exports['update']=function(_0xaa0868,_0x2fe975){if(_0xaa0868[_0x4137('0x5a')]['id']){delete _0xaa0868[_0x4137('0x5a')]['id'];}return db['WhatsappMessage'][_0x4137('0x5b')]({'where':{'id':_0xaa0868['params']['id']}})['then'](handleEntityNotFound(_0x2fe975,null))[_0x4137('0x23')](saveUpdates(_0xaa0868['body'],null))['then'](respondWithResult(_0x2fe975,null))[_0x4137('0x56')](handleError(_0x2fe975,null));};exports[_0x4137('0x36')]=function(_0xbef9e1,_0x4ef821){return db[_0x4137('0x3c')][_0x4137('0x5b')]({'where':{'id':_0xbef9e1[_0x4137('0x58')]['id']}})['then'](handleEntityNotFound(_0x4ef821,null))[_0x4137('0x23')](removeEntity(_0x4ef821,null))[_0x4137('0x56')](handleError(_0x4ef821,null));};exports[_0x4137('0x5c')]=function(_0x2d882a,_0x4163a2){return db['WhatsappMessage'][_0x4137('0x5c')]()[_0x4137('0x23')](respondWithResult(_0x4163a2,null))['catch'](handleError(_0x4163a2,null));};var interaction_log=require(_0x4137('0x14'))(_0x4137('0x5d'));exports[_0x4137('0x5e')]=function(_0x19ad2c,_0x4c1079,_0x14465d){var _0x313fcb={'agent':{},'channel':_0x4137('0x5f')};if(_0x19ad2c[_0x4137('0x5a')]['id']){delete _0x19ad2c[_0x4137('0x5a')]['id'];}_0x19ad2c[_0x4137('0x5a')][_0x4137('0x60')]=!![];_0x19ad2c[_0x4137('0x5a')][_0x4137('0x61')]=moment()[_0x4137('0x62')](_0x4137('0x63'));_0x19ad2c[_0x4137('0x5a')][_0x4137('0x64')]=_0x19ad2c[_0x4137('0x5a')][_0x4137('0x64')]||_0x19ad2c[_0x4137('0x65')]['id'];_0x313fcb[_0x4137('0x66')]['id']=_0x19ad2c[_0x4137('0x5a')]['UserId'];return db[_0x4137('0x3c')][_0x4137('0x5b')]({'where':{'id':_0x19ad2c[_0x4137('0x58')]['id'],'UserId':null}})[_0x4137('0x23')](handleEntityNotFound(_0x4c1079,null))[_0x4137('0x23')](saveUpdates(_0x19ad2c[_0x4137('0x5a')],null))[_0x4137('0x23')](function(_0x534596){if(_0x534596){_0x313fcb[_0x4137('0x2a')]=_0x534596['get']({'plain':!![]});return db[_0x4137('0x67')][_0x4137('0x5b')]({'where':{'id':_0x534596['WhatsappInteractionId']}});}return null;})[_0x4137('0x23')](handleEntityNotFound(_0x4c1079,null))['then'](function(_0x18e37a){if(_0x18e37a){return _0x18e37a[_0x4137('0x35')]({'UserId':_0x19ad2c[_0x4137('0x5a')][_0x4137('0x64')],'read1stAt':_[_0x4137('0x68')](_0x18e37a[_0x4137('0x69')])?moment()[_0x4137('0x62')](_0x4137('0x63')):undefined});}return null;})['then'](function(_0x3ad771){if(_0x3ad771){_0x313fcb[_0x4137('0x6a')]=_0x3ad771[_0x4137('0x6b')]({'plain':!![]});interaction_log[_0x4137('0x6c')](_0x4137('0x6d'),_0x19ad2c['user']['id'],_0x19ad2c['user']['name'],_0x19ad2c[_0x4137('0x65')][_0x4137('0x6e')],_0x313fcb[_0x4137('0x6a')]['id'],_0x19ad2c[_0x4137('0x5a')]?JSON[_0x4137('0x27')](_0x19ad2c['body']):_0x4137('0x6f'));return respondWithRpcPromise(_0x4137('0x70'),'acceptMessage',_0x313fcb);}return null;})['then'](function(_0x34038d){var _0x1f3ad2=_0x4137('0x71')+_0x34038d[_0x4137('0x2a')]['ContactId'];return db[_0x4137('0x72')]['query'](_0x1f3ad2,{'type':db[_0x4137('0x73')][_0x4137('0x74')][_0x4137('0x75')],'raw':!![]})[_0x4137('0x23')](function(_0x1363eb){return _0x1363eb;});})['then'](function(_0x23ffb4){if(_0x23ffb4){_0x313fcb[_0x4137('0x2a')]['contact']=_0x23ffb4[0x0];if(!_0x19ad2c[_0x4137('0x5a')][_0x4137('0x64')])return;return db[_0x4137('0x76')][_0x4137('0x5b')]({'where':{'id':_0x19ad2c[_0x4137('0x5a')][_0x4137('0x64')],'role':_0x4137('0x66')},'attributes':['id',_0x4137('0x40'),_0x4137('0x77'),'email',_0x4137('0x78')],'raw':!![]});}return null;})[_0x4137('0x23')](function(_0x2e16b5){if(!_0x2e16b5)return null;_0x313fcb[_0x4137('0x2a')]['agent']=_0x2e16b5;return _0x313fcb;})[_0x4137('0x23')](function(_0x5792c2){if(_0x5792c2){if(_0x19ad2c[_0x4137('0x5a')]['manual']){_0x313fcb[_0x4137('0x2a')][_0x4137('0x79')]=util[_0x4137('0x62')](_0x4137('0x7a'),_0x19ad2c[_0x4137('0x65')][_0x4137('0x40')]);_0x313fcb[_0x4137('0x2a')]['channel']=_0x313fcb[_0x4137('0x7b')];_0x313fcb[_0x4137('0x2a')]['motionChannel']=_0x313fcb[_0x4137('0x7b')];_0x313fcb[_0x4137('0x2a')][_0x4137('0x7c')]='accept';return respondWithRpcPromise(_0x4137('0x7d'),_0x4137('0x7d'),{'event':'acceptmessage','message':_0x313fcb[_0x4137('0x2a')]},client9002)[_0x4137('0x23')](function(){return _0x313fcb;});}return _0x313fcb;}return null;})[_0x4137('0x23')](respondWithResult(_0x4c1079,null))[_0x4137('0x56')](handleError(_0x4c1079,null));};var interaction_log=require(_0x4137('0x14'))(_0x4137('0x5d'));exports['reject']=function(_0x511e96,_0x4d34ab,_0x169268){var _0x83c80e={'agent':{},'channel':_0x4137('0x5f')};if(_0x511e96[_0x4137('0x5a')]['id']){delete _0x511e96[_0x4137('0x5a')]['id'];}_0x511e96[_0x4137('0x5a')]['UserId']=_0x511e96['body'][_0x4137('0x64')]||_0x511e96['user']['id'];_0x83c80e[_0x4137('0x66')]['id']=_0x511e96[_0x4137('0x5a')][_0x4137('0x64')];return db['WhatsappMessage']['find']({'where':{'id':_0x511e96['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x4d34ab,null))[_0x4137('0x23')](function(_0x18932a){if(_0x18932a){_0x83c80e['message']=_0x18932a[_0x4137('0x6b')]({'plain':!![]});return db[_0x4137('0x67')][_0x4137('0x5b')]({'where':{'id':_0x18932a['WhatsappInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x4d34ab,null))['then'](function(_0x52f6a8){if(_0x52f6a8){_0x83c80e[_0x4137('0x6a')]=_0x52f6a8['get']({'plain':!![]});interaction_log[_0x4137('0x6c')](_0x4137('0x7e'),_0x511e96[_0x4137('0x65')]['id'],_0x511e96[_0x4137('0x65')][_0x4137('0x40')],_0x511e96[_0x4137('0x65')][_0x4137('0x6e')],_0x83c80e['interaction']['id'],_0x511e96[_0x4137('0x5a')]?JSON[_0x4137('0x27')](_0x511e96[_0x4137('0x5a')]):'null');return respondWithRpcPromise('RejectMessage',_0x4137('0x7f'),_0x83c80e);}return null;})[_0x4137('0x23')](function(_0x407693){var _0x2344ba=_0x4137('0x71')+_0x407693[_0x4137('0x2a')]['ContactId'];return db[_0x4137('0x72')][_0x4137('0x42')](_0x2344ba,{'type':db[_0x4137('0x73')][_0x4137('0x74')][_0x4137('0x75')],'raw':!![]})['then'](function(_0x3027a2){return _0x3027a2;});})['then'](function(_0x1ab75a){if(_0x1ab75a){_0x83c80e[_0x4137('0x2a')][_0x4137('0x80')]=_0x1ab75a[0x0];if(!_0x511e96[_0x4137('0x5a')][_0x4137('0x64')])return;return db[_0x4137('0x76')][_0x4137('0x5b')]({'where':{'id':_0x511e96[_0x4137('0x5a')][_0x4137('0x64')],'role':_0x4137('0x66')},'attributes':['id',_0x4137('0x40'),_0x4137('0x77'),'email',_0x4137('0x78')],'raw':!![]});}return null;})[_0x4137('0x23')](function(_0x298e7d){if(!_0x298e7d)return null;_0x83c80e[_0x4137('0x2a')][_0x4137('0x66')]=_0x298e7d;return _0x83c80e;})['then'](function(_0x5f5b6e){if(_0x5f5b6e){_0x5f5b6e[_0x4137('0x2a')][_0x4137('0x79')]=util[_0x4137('0x62')]('SIP/%s',_0x511e96['user'][_0x4137('0x40')]);_0x5f5b6e[_0x4137('0x2a')][_0x4137('0x7b')]=_0x83c80e[_0x4137('0x7b')];_0x5f5b6e['message'][_0x4137('0x81')]=_0x83c80e[_0x4137('0x7b')];_0x5f5b6e[_0x4137('0x2a')][_0x4137('0x7c')]=_0x4137('0x33');respondWithRpcPromise(_0x4137('0x7d'),'EventManager',{'event':'rejectmessage','message':_0x5f5b6e[_0x4137('0x2a')]},client9002);return _0x83c80e;}return null;})[_0x4137('0x23')](respondWithResult(_0x4d34ab,null))['catch'](handleError(_0x4d34ab,null));};exports['status']=function(_0x246bcf,_0x1e6b35,_0xb37bc3){if(_0x246bcf['body']['id']){delete _0x246bcf[_0x4137('0x5a')]['id'];}var _0xa2f3fd;return db[_0x4137('0x3c')][_0x4137('0x5b')]({'where':{'id':_0x246bcf[_0x4137('0x58')]['id']}})[_0x4137('0x23')](handleEntityNotFound(_0x1e6b35,null))[_0x4137('0x23')](function(_0x1aaab4){if(_0x1aaab4){_0xa2f3fd=_0x1aaab4;return db['WhatsappAccount']['find']({'where':{'id':_0x1aaab4[_0x4137('0x82')]}});}})[_0x4137('0x23')](handleEntityNotFound(_0x1e6b35,null))[_0x4137('0x23')](function(_0x5e6417){if(_0x5e6417){logger[_0x4137('0x83')](_0x4137('0x84'),_0x4137('0x32'),_0x4137('0x85'),_0x5e6417['type'],util[_0x4137('0x86')](_0x246bcf[_0x4137('0x5a')],{'showHidden':![],'depth':null}));switch(_0x5e6417[_0x4137('0x3e')]){case _0x4137('0x87'):if(_0x246bcf[_0x4137('0x5a')]['MessageSid']&&_0x246bcf[_0x4137('0x5a')][_0x4137('0x88')]===_0xa2f3fd[_0x4137('0x89')]&&_0x246bcf[_0x4137('0x5a')]['MessageStatus']&&_0x246bcf[_0x4137('0x5a')][_0x4137('0x8a')]===_0x4137('0x60')){return _0xa2f3fd[_0x4137('0x35')]({'read':!![]});}else{logger[_0x4137('0x28')](_0x4137('0x8b'),_0x4137('0x32'),'twilio',util['inspect'](_0x246bcf[_0x4137('0x5a')],{'showHidden':![],'depth':null}));}break;}return _0xa2f3fd;}})[_0x4137('0x23')](respondWithResult(_0x1e6b35,null))[_0x4137('0x56')](handleError(_0x1e6b35,null));}; \ No newline at end of file +var _0xf1f1=['reject','save','update','destroy','stack','name','send','map','WhatsappMessage','fieldName','type','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','include','rows','catch','show','rawAttributes','find','create','body','params','describe','../../config/logger','whatsapp-interactions','whatsapp','read','UserId','user','get','WhatsappInteractionId','read1stAt','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','contact','fullname','internal','agent','manual','format','channel','motionChannel','event','accept','EventManager','acceptmessage','WhatsappInteraction','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','ContactId','User','email','interface','SIP/%s','rejectmessage','WhatsappAccount','received\x20delivery\x20report\x20from','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','inspect','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./whatsappMessage.socket','jayson/promise','client','http','request','then','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','sendStatus','status','end','json','offset','count','limit','set','Content-Range','apply'];(function(_0x5d8b26,_0x17d8e1){var _0x2315ed=function(_0x88bcb2){while(--_0x88bcb2){_0x5d8b26['push'](_0x5d8b26['shift']());}};_0x2315ed(++_0x17d8e1);}(_0xf1f1,0xe7));var _0x1f1f=function(_0x2ae98d,_0xa3ad86){_0x2ae98d=_0x2ae98d-0x0;var _0xa9b7f8=_0xf1f1[_0x2ae98d];return _0xa9b7f8;};'use strict';var emlformat=require(_0x1f1f('0x0'));var rimraf=require(_0x1f1f('0x1'));var zipdir=require(_0x1f1f('0x2'));var jsonpatch=require(_0x1f1f('0x3'));var rp=require('request-promise');var moment=require(_0x1f1f('0x4'));var BPromise=require(_0x1f1f('0x5'));var Mustache=require(_0x1f1f('0x6'));var util=require(_0x1f1f('0x7'));var path=require('path');var sox=require(_0x1f1f('0x8'));var csv=require(_0x1f1f('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1f1f('0xa'));var _=require(_0x1f1f('0xb'));var squel=require(_0x1f1f('0xc'));var crypto=require(_0x1f1f('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x1f1f('0xe'));var toCsv=require(_0x1f1f('0x9'));var querystring=require(_0x1f1f('0xf'));var Papa=require(_0x1f1f('0x10'));var Redis=require(_0x1f1f('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x1f1f('0x12'));var as=require(_0x1f1f('0x13'));var hardwareService=require(_0x1f1f('0x14'));var logger=require('../../config/logger')(_0x1f1f('0x15'));var utils=require(_0x1f1f('0x16'));var config=require(_0x1f1f('0x17'));var licenseUtil=require(_0x1f1f('0x18'));var db=require(_0x1f1f('0x19'))['db'];config[_0x1f1f('0x1a')]=_[_0x1f1f('0x1b')](config[_0x1f1f('0x1a')],{'host':_0x1f1f('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x1f1f('0x1d'))['register'](socket);var jayson=require(_0x1f1f('0x1e'));var client=jayson[_0x1f1f('0x1f')][_0x1f1f('0x20')]({'port':0x232c});var client9002=jayson['client'][_0x1f1f('0x20')]({'port':0x232a});function respondWithRpcPromise(_0xea484d,_0x57e2fe,_0x1cb8d1,_0x382365){return new BPromise(function(_0x522791,_0x3b995f){var _0x2f8e94=_0x382365||client;return _0x2f8e94[_0x1f1f('0x21')](_0xea484d,_0x1cb8d1)[_0x1f1f('0x22')](function(_0x45c245){logger['info'](_0x1f1f('0x23'),_0x57e2fe,_0x1f1f('0x24'));logger[_0x1f1f('0x25')](_0x1f1f('0x26'),_0x57e2fe,_0x1f1f('0x24'),JSON[_0x1f1f('0x27')](_0x45c245));if(_0x45c245[_0x1f1f('0x28')]){if(_0x45c245[_0x1f1f('0x28')][_0x1f1f('0x29')]===0x1f4){logger[_0x1f1f('0x28')](_0x1f1f('0x23'),_0x57e2fe,_0x45c245['error'][_0x1f1f('0x2a')]);return _0x3b995f(_0x45c245['error'][_0x1f1f('0x2a')]);}logger[_0x1f1f('0x28')](_0x1f1f('0x23'),_0x57e2fe,_0x45c245[_0x1f1f('0x28')][_0x1f1f('0x2a')]);return _0x522791(_0x45c245['error']['message']);}else{logger[_0x1f1f('0x2b')](_0x1f1f('0x23'),_0x57e2fe,_0x1f1f('0x24'));_0x522791(_0x45c245[_0x1f1f('0x2c')]['message']);}})['catch'](function(_0x2fc0e6){logger[_0x1f1f('0x28')](_0x1f1f('0x23'),_0x57e2fe,_0x2fc0e6);_0x3b995f(_0x2fc0e6);});});}function respondWithStatusCode(_0x285741,_0x14eba6){_0x14eba6=_0x14eba6||0xcc;return function(_0x4d06b8){if(_0x4d06b8){return _0x285741[_0x1f1f('0x2d')](_0x14eba6);}return _0x285741[_0x1f1f('0x2e')](_0x14eba6)[_0x1f1f('0x2f')]();};}function respondWithResult(_0x5d6b98,_0x3dcc8f){_0x3dcc8f=_0x3dcc8f||0xc8;return function(_0x594c78){if(_0x594c78){return _0x5d6b98['status'](_0x3dcc8f)[_0x1f1f('0x30')](_0x594c78);}};}function respondWithFilteredResult(_0x394f77,_0x1278da){return function(_0xe83efc){if(_0xe83efc){var _0x26aaa2=typeof _0x1278da[_0x1f1f('0x31')]==='undefined'&&typeof _0x1278da['limit']==='undefined';var _0x5d1346=_0xe83efc[_0x1f1f('0x32')];var _0x57bdc7=_0x26aaa2?0x0:_0x1278da[_0x1f1f('0x31')];var _0xc18bd5=_0x26aaa2?_0xe83efc[_0x1f1f('0x32')]:_0x1278da[_0x1f1f('0x31')]+_0x1278da[_0x1f1f('0x33')];var _0x57924e;if(_0xc18bd5>=_0x5d1346){_0xc18bd5=_0x5d1346;_0x57924e=0xc8;}else{_0x57924e=0xce;}_0x394f77[_0x1f1f('0x2e')](_0x57924e);return _0x394f77[_0x1f1f('0x34')](_0x1f1f('0x35'),_0x57bdc7+'-'+_0xc18bd5+'/'+_0x5d1346)['json'](_0xe83efc);}return null;};}function patchUpdates(_0x48ceb1){return function(_0x25c153){try{jsonpatch[_0x1f1f('0x36')](_0x25c153,_0x48ceb1,!![]);}catch(_0x2b3a03){return BPromise[_0x1f1f('0x37')](_0x2b3a03);}return _0x25c153[_0x1f1f('0x38')]();};}function saveUpdates(_0x2eebb2,_0xe2500e){return function(_0xa768){if(_0xa768){return _0xa768[_0x1f1f('0x39')](_0x2eebb2)[_0x1f1f('0x22')](function(_0x1c3766){return _0x1c3766;});}return null;};}function removeEntity(_0x9695c8,_0x574957){return function(_0x1c78de){if(_0x1c78de){return _0x1c78de[_0x1f1f('0x3a')]()['then'](function(){_0x9695c8['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x41c017,_0x21f44f){return function(_0x3a067d){if(!_0x3a067d){_0x41c017['sendStatus'](0x194);}return _0x3a067d;};}function handleError(_0x579dd1,_0x42bbf1){_0x42bbf1=_0x42bbf1||0x1f4;return function(_0x71477){logger[_0x1f1f('0x28')](_0x71477[_0x1f1f('0x3b')]);if(_0x71477['name']){delete _0x71477[_0x1f1f('0x3c')];}_0x579dd1[_0x1f1f('0x2e')](_0x42bbf1)[_0x1f1f('0x3d')](_0x71477);};}exports['index']=function(_0xe9277c,_0x9df526){var _0x1ecc0a={},_0x3870ce={},_0x2fc0e3={'count':0x0,'rows':[]};var _0x36b181=_[_0x1f1f('0x3e')](db[_0x1f1f('0x3f')]['rawAttributes'],function(_0x38b58c){return{'name':_0x38b58c[_0x1f1f('0x40')],'type':_0x38b58c[_0x1f1f('0x41')]['key']};});_0x3870ce['model']=_[_0x1f1f('0x3e')](_0x36b181,_0x1f1f('0x3c'));_0x3870ce[_0x1f1f('0x42')]=_[_0x1f1f('0x43')](_0xe9277c[_0x1f1f('0x42')]);_0x3870ce[_0x1f1f('0x44')]=_[_0x1f1f('0x45')](_0x3870ce['model'],_0x3870ce[_0x1f1f('0x42')]);_0x1ecc0a['attributes']=_[_0x1f1f('0x45')](_0x3870ce[_0x1f1f('0x46')],qs['fields'](_0xe9277c[_0x1f1f('0x42')][_0x1f1f('0x47')]));_0x1ecc0a[_0x1f1f('0x48')]=_0x1ecc0a[_0x1f1f('0x48')][_0x1f1f('0x49')]?_0x1ecc0a[_0x1f1f('0x48')]:_0x3870ce[_0x1f1f('0x46')];if(!_0xe9277c[_0x1f1f('0x42')][_0x1f1f('0x4a')](_0x1f1f('0x4b'))){_0x1ecc0a[_0x1f1f('0x33')]=qs['limit'](_0xe9277c[_0x1f1f('0x42')][_0x1f1f('0x33')]);_0x1ecc0a[_0x1f1f('0x31')]=qs[_0x1f1f('0x31')](_0xe9277c[_0x1f1f('0x42')]['offset']);}_0x1ecc0a[_0x1f1f('0x4c')]=qs[_0x1f1f('0x4d')](_0xe9277c[_0x1f1f('0x42')][_0x1f1f('0x4d')]);_0x1ecc0a['where']=qs['filters'](_[_0x1f1f('0x4e')](_0xe9277c[_0x1f1f('0x42')],_0x3870ce[_0x1f1f('0x44')]),_0x36b181);if(_0xe9277c[_0x1f1f('0x42')][_0x1f1f('0x4f')]){_0x1ecc0a['where']=_[_0x1f1f('0x50')](_0x1ecc0a[_0x1f1f('0x51')],{'$or':_[_0x1f1f('0x3e')](_0x36b181,function(_0x3175e8){if(_0x3175e8[_0x1f1f('0x41')]!==_0x1f1f('0x52')){var _0x1b80ad={};_0x1b80ad[_0x3175e8[_0x1f1f('0x3c')]]={'$like':'%'+_0xe9277c['query']['filter']+'%'};return _0x1b80ad;}})});}_0x1ecc0a=_['merge']({},_0x1ecc0a,_0xe9277c[_0x1f1f('0x53')]);var _0x3695b4={'where':_0x1ecc0a[_0x1f1f('0x51')]};return db[_0x1f1f('0x3f')][_0x1f1f('0x32')](_0x3695b4)['then'](function(_0x4b2288){_0x2fc0e3['count']=_0x4b2288;if(_0xe9277c[_0x1f1f('0x42')]['includeAll']){_0x1ecc0a[_0x1f1f('0x54')]=[{'all':!![]}];}return db['WhatsappMessage']['findAll'](_0x1ecc0a);})['then'](function(_0x467d55){_0x2fc0e3[_0x1f1f('0x55')]=_0x467d55;return _0x2fc0e3;})['then'](respondWithFilteredResult(_0x9df526,_0x1ecc0a))[_0x1f1f('0x56')](handleError(_0x9df526,null));};exports[_0x1f1f('0x57')]=function(_0x503944,_0x3f7b4f){var _0x4d7b45={'raw':!![],'where':{'id':_0x503944['params']['id']}},_0x1f18a9={};_0x1f18a9['model']=_['keys'](db[_0x1f1f('0x3f')][_0x1f1f('0x58')]);_0x1f18a9[_0x1f1f('0x42')]=_[_0x1f1f('0x43')](_0x503944[_0x1f1f('0x42')]);_0x1f18a9[_0x1f1f('0x44')]=_[_0x1f1f('0x45')](_0x1f18a9[_0x1f1f('0x46')],_0x1f18a9[_0x1f1f('0x42')]);_0x4d7b45[_0x1f1f('0x48')]=_['intersection'](_0x1f18a9['model'],qs[_0x1f1f('0x47')](_0x503944['query'][_0x1f1f('0x47')]));_0x4d7b45[_0x1f1f('0x48')]=_0x4d7b45[_0x1f1f('0x48')][_0x1f1f('0x49')]?_0x4d7b45['attributes']:_0x1f18a9['model'];if(_0x503944[_0x1f1f('0x42')]['includeAll']){_0x4d7b45['include']=[{'all':!![]}];}_0x4d7b45=_['merge']({},_0x4d7b45,_0x503944[_0x1f1f('0x53')]);return db[_0x1f1f('0x3f')][_0x1f1f('0x59')](_0x4d7b45)['then'](handleEntityNotFound(_0x3f7b4f,null))[_0x1f1f('0x22')](respondWithResult(_0x3f7b4f,null))[_0x1f1f('0x56')](handleError(_0x3f7b4f,null));};exports[_0x1f1f('0x5a')]=function(_0x41897b,_0x280592){return db[_0x1f1f('0x3f')][_0x1f1f('0x5a')](_0x41897b['body'],{})[_0x1f1f('0x22')](respondWithResult(_0x280592,0xc9))[_0x1f1f('0x56')](handleError(_0x280592,null));};exports[_0x1f1f('0x39')]=function(_0x121548,_0xc490c6){if(_0x121548['body']['id']){delete _0x121548[_0x1f1f('0x5b')]['id'];}return db[_0x1f1f('0x3f')][_0x1f1f('0x59')]({'where':{'id':_0x121548[_0x1f1f('0x5c')]['id']}})['then'](handleEntityNotFound(_0xc490c6,null))['then'](saveUpdates(_0x121548['body'],null))['then'](respondWithResult(_0xc490c6,null))['catch'](handleError(_0xc490c6,null));};exports['destroy']=function(_0x27b921,_0x43aee6){return db[_0x1f1f('0x3f')][_0x1f1f('0x59')]({'where':{'id':_0x27b921['params']['id']}})[_0x1f1f('0x22')](handleEntityNotFound(_0x43aee6,null))[_0x1f1f('0x22')](removeEntity(_0x43aee6,null))[_0x1f1f('0x56')](handleError(_0x43aee6,null));};exports[_0x1f1f('0x5d')]=function(_0x2dcb2b,_0x149563){return db[_0x1f1f('0x3f')][_0x1f1f('0x5d')]()[_0x1f1f('0x22')](respondWithResult(_0x149563,null))[_0x1f1f('0x56')](handleError(_0x149563,null));};var interaction_log=require(_0x1f1f('0x5e'))(_0x1f1f('0x5f'));exports['accept']=function(_0x4112e5,_0x12fe78,_0x18a628){var _0x20edb={'agent':{},'channel':_0x1f1f('0x60')};if(_0x4112e5[_0x1f1f('0x5b')]['id']){delete _0x4112e5[_0x1f1f('0x5b')]['id'];}_0x4112e5[_0x1f1f('0x5b')][_0x1f1f('0x61')]=!![];_0x4112e5['body']['readAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x4112e5[_0x1f1f('0x5b')][_0x1f1f('0x62')]=_0x4112e5[_0x1f1f('0x5b')][_0x1f1f('0x62')]||_0x4112e5[_0x1f1f('0x63')]['id'];_0x20edb['agent']['id']=_0x4112e5[_0x1f1f('0x5b')][_0x1f1f('0x62')];return db[_0x1f1f('0x3f')][_0x1f1f('0x59')]({'where':{'id':_0x4112e5[_0x1f1f('0x5c')]['id'],'UserId':null}})[_0x1f1f('0x22')](handleEntityNotFound(_0x12fe78,null))[_0x1f1f('0x22')](saveUpdates(_0x4112e5[_0x1f1f('0x5b')],null))[_0x1f1f('0x22')](function(_0x14ec3f){if(_0x14ec3f){_0x20edb['message']=_0x14ec3f[_0x1f1f('0x64')]({'plain':!![]});return db['WhatsappInteraction']['find']({'where':{'id':_0x14ec3f[_0x1f1f('0x65')]}});}return null;})[_0x1f1f('0x22')](handleEntityNotFound(_0x12fe78,null))[_0x1f1f('0x22')](function(_0x28d721){if(_0x28d721){return _0x28d721[_0x1f1f('0x39')]({'UserId':_0x4112e5['body']['UserId'],'read1stAt':_['isNil'](_0x28d721[_0x1f1f('0x66')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x1f1f('0x22')](function(_0x33d52d){if(_0x33d52d){_0x20edb[_0x1f1f('0x67')]=_0x33d52d[_0x1f1f('0x64')]({'plain':!![]});interaction_log[_0x1f1f('0x2b')](_0x1f1f('0x68'),_0x4112e5[_0x1f1f('0x63')]['id'],_0x4112e5[_0x1f1f('0x63')][_0x1f1f('0x3c')],_0x4112e5[_0x1f1f('0x63')][_0x1f1f('0x69')],_0x20edb[_0x1f1f('0x67')]['id'],_0x4112e5[_0x1f1f('0x5b')]?JSON[_0x1f1f('0x27')](_0x4112e5[_0x1f1f('0x5b')]):_0x1f1f('0x6a'));return respondWithRpcPromise(_0x1f1f('0x6b'),_0x1f1f('0x6c'),_0x20edb);}return null;})[_0x1f1f('0x22')](function(_0x277778){var _0x2a8f6c=_0x1f1f('0x6d')+_0x277778['message']['ContactId'];return db[_0x1f1f('0x6e')]['query'](_0x2a8f6c,{'type':db[_0x1f1f('0x6f')][_0x1f1f('0x70')]['SELECT'],'raw':!![]})[_0x1f1f('0x22')](function(_0x226a6c){return _0x226a6c;});})[_0x1f1f('0x22')](function(_0x2dee3e){if(_0x2dee3e){_0x20edb['message'][_0x1f1f('0x71')]=_0x2dee3e[0x0];if(!_0x4112e5[_0x1f1f('0x5b')][_0x1f1f('0x62')])return;return db['User'][_0x1f1f('0x59')]({'where':{'id':_0x4112e5['body'][_0x1f1f('0x62')],'role':'agent'},'attributes':['id',_0x1f1f('0x3c'),_0x1f1f('0x72'),'email',_0x1f1f('0x73')],'raw':!![]});}return null;})[_0x1f1f('0x22')](function(_0x4b9974){if(!_0x4b9974)return null;_0x20edb[_0x1f1f('0x2a')][_0x1f1f('0x74')]=_0x4b9974;return _0x20edb;})['then'](function(_0x2b2271){if(_0x2b2271){if(_0x4112e5[_0x1f1f('0x5b')][_0x1f1f('0x75')]){_0x20edb[_0x1f1f('0x2a')]['interface']=util[_0x1f1f('0x76')]('SIP/%s',_0x4112e5[_0x1f1f('0x63')][_0x1f1f('0x3c')]);_0x20edb[_0x1f1f('0x2a')]['channel']=_0x20edb[_0x1f1f('0x77')];_0x20edb[_0x1f1f('0x2a')][_0x1f1f('0x78')]=_0x20edb[_0x1f1f('0x77')];_0x20edb['message'][_0x1f1f('0x79')]=_0x1f1f('0x7a');return respondWithRpcPromise('EventManager',_0x1f1f('0x7b'),{'event':_0x1f1f('0x7c'),'message':_0x20edb[_0x1f1f('0x2a')]},client9002)[_0x1f1f('0x22')](function(){return _0x20edb;});}return _0x20edb;}return null;})[_0x1f1f('0x22')](respondWithResult(_0x12fe78,null))['catch'](handleError(_0x12fe78,null));};var interaction_log=require(_0x1f1f('0x5e'))(_0x1f1f('0x5f'));exports['reject']=function(_0x4e1c3d,_0x5bad41,_0x34d61a){var _0x5786be={'agent':{},'channel':_0x1f1f('0x60')};if(_0x4e1c3d[_0x1f1f('0x5b')]['id']){delete _0x4e1c3d[_0x1f1f('0x5b')]['id'];}_0x4e1c3d['body'][_0x1f1f('0x62')]=_0x4e1c3d[_0x1f1f('0x5b')][_0x1f1f('0x62')]||_0x4e1c3d['user']['id'];_0x5786be[_0x1f1f('0x74')]['id']=_0x4e1c3d['body'][_0x1f1f('0x62')];return db[_0x1f1f('0x3f')][_0x1f1f('0x59')]({'where':{'id':_0x4e1c3d[_0x1f1f('0x5c')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x5bad41,null))[_0x1f1f('0x22')](function(_0x1253ef){if(_0x1253ef){_0x5786be[_0x1f1f('0x2a')]=_0x1253ef[_0x1f1f('0x64')]({'plain':!![]});return db[_0x1f1f('0x7d')][_0x1f1f('0x59')]({'where':{'id':_0x1253ef[_0x1f1f('0x65')]}});}return null;})[_0x1f1f('0x22')](handleEntityNotFound(_0x5bad41,null))[_0x1f1f('0x22')](function(_0x4281cc){if(_0x4281cc){_0x5786be['interaction']=_0x4281cc[_0x1f1f('0x64')]({'plain':!![]});interaction_log[_0x1f1f('0x2b')](_0x1f1f('0x7e'),_0x4e1c3d[_0x1f1f('0x63')]['id'],_0x4e1c3d[_0x1f1f('0x63')][_0x1f1f('0x3c')],_0x4e1c3d[_0x1f1f('0x63')][_0x1f1f('0x69')],_0x5786be[_0x1f1f('0x67')]['id'],_0x4e1c3d[_0x1f1f('0x5b')]?JSON[_0x1f1f('0x27')](_0x4e1c3d[_0x1f1f('0x5b')]):'null');return respondWithRpcPromise(_0x1f1f('0x7f'),_0x1f1f('0x80'),_0x5786be);}return null;})[_0x1f1f('0x22')](function(_0x515cdd){var _0x1de295='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x515cdd['message'][_0x1f1f('0x81')];return db[_0x1f1f('0x6e')][_0x1f1f('0x42')](_0x1de295,{'type':db[_0x1f1f('0x6f')]['QueryTypes']['SELECT'],'raw':!![]})[_0x1f1f('0x22')](function(_0x595dca){return _0x595dca;});})[_0x1f1f('0x22')](function(_0x19288f){if(_0x19288f){_0x5786be['message'][_0x1f1f('0x71')]=_0x19288f[0x0];if(!_0x4e1c3d[_0x1f1f('0x5b')][_0x1f1f('0x62')])return;return db[_0x1f1f('0x82')][_0x1f1f('0x59')]({'where':{'id':_0x4e1c3d[_0x1f1f('0x5b')][_0x1f1f('0x62')],'role':_0x1f1f('0x74')},'attributes':['id','name',_0x1f1f('0x72'),_0x1f1f('0x83'),_0x1f1f('0x73')],'raw':!![]});}return null;})[_0x1f1f('0x22')](function(_0x1ae1e3){if(!_0x1ae1e3)return null;_0x5786be[_0x1f1f('0x2a')]['agent']=_0x1ae1e3;return _0x5786be;})['then'](function(_0x4888d0){if(_0x4888d0){_0x4888d0[_0x1f1f('0x2a')][_0x1f1f('0x84')]=util[_0x1f1f('0x76')](_0x1f1f('0x85'),_0x4e1c3d[_0x1f1f('0x63')][_0x1f1f('0x3c')]);_0x4888d0[_0x1f1f('0x2a')][_0x1f1f('0x77')]=_0x5786be[_0x1f1f('0x77')];_0x4888d0[_0x1f1f('0x2a')]['motionChannel']=_0x5786be['channel'];_0x4888d0[_0x1f1f('0x2a')]['event']=_0x1f1f('0x37');respondWithRpcPromise(_0x1f1f('0x7b'),_0x1f1f('0x7b'),{'event':_0x1f1f('0x86'),'message':_0x4888d0[_0x1f1f('0x2a')]},client9002);return _0x5786be;}return null;})['then'](respondWithResult(_0x5bad41,null))[_0x1f1f('0x56')](handleError(_0x5bad41,null));};exports[_0x1f1f('0x2e')]=function(_0x3a6b91,_0x32447c,_0x3a53df){if(_0x3a6b91['body']['id']){delete _0x3a6b91[_0x1f1f('0x5b')]['id'];}var _0x227af0;return db[_0x1f1f('0x3f')]['find']({'where':{'id':_0x3a6b91['params']['id']}})[_0x1f1f('0x22')](handleEntityNotFound(_0x32447c,null))[_0x1f1f('0x22')](function(_0x10b7e7){if(_0x10b7e7){_0x227af0=_0x10b7e7;return db[_0x1f1f('0x87')][_0x1f1f('0x59')]({'where':{'id':_0x10b7e7['WhatsappAccountId']}});}})['then'](handleEntityNotFound(_0x32447c,null))[_0x1f1f('0x22')](function(_0x593507){if(_0x593507){logger[_0x1f1f('0x25')]('WhatsppMessage,\x20%s,\x20%s,\x20%s',_0x1f1f('0x2e'),_0x1f1f('0x88'),_0x593507[_0x1f1f('0x41')],util['inspect'](_0x3a6b91['body'],{'showHidden':![],'depth':null}));switch(_0x593507[_0x1f1f('0x41')]){case _0x1f1f('0x89'):if(_0x3a6b91['body'][_0x1f1f('0x8a')]&&_0x3a6b91[_0x1f1f('0x5b')][_0x1f1f('0x8a')]===_0x227af0[_0x1f1f('0x8b')]&&_0x3a6b91[_0x1f1f('0x5b')][_0x1f1f('0x8c')]&&_0x3a6b91[_0x1f1f('0x5b')][_0x1f1f('0x8c')]===_0x1f1f('0x61')){return _0x227af0['update']({'read':!![]});}else{logger[_0x1f1f('0x28')](_0x1f1f('0x8d'),_0x1f1f('0x2e'),_0x1f1f('0x89'),util[_0x1f1f('0x8e')](_0x3a6b91[_0x1f1f('0x5b')],{'showHidden':![],'depth':null}));}break;}return _0x227af0;}})['then'](respondWithResult(_0x32447c,null))[_0x1f1f('0x56')](handleError(_0x32447c,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index ae54c9c..1bbb0d8 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 _0x8b29=['setMaxListeners','remove','emit','hasOwnProperty','hook','exports','events','WhatsappMessage'];(function(_0x1de6db,_0x1ee364){var _0x17f999=function(_0x4319ba){while(--_0x4319ba){_0x1de6db['push'](_0x1de6db['shift']());}};_0x17f999(++_0x1ee364);}(_0x8b29,0xbe));var _0x98b2=function(_0x4d5a65,_0x18b370){_0x4d5a65=_0x4d5a65-0x0;var _0x352d2d=_0x8b29[_0x4d5a65];return _0x352d2d;};'use strict';var EventEmitter=require(_0x98b2('0x0'));var WhatsappMessage=require('../../mysqldb')['db'][_0x98b2('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x98b2('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x98b2('0x3')};function emitEvent(_0x20afa9){return function(_0x5bf7df,_0x209616,_0x5da9ce){WhatsappMessageEvents[_0x98b2('0x4')](_0x20afa9+':'+_0x5bf7df['id'],_0x5bf7df);WhatsappMessageEvents[_0x98b2('0x4')](_0x20afa9,_0x5bf7df);_0x5da9ce(null);};}for(var e in events){if(events[_0x98b2('0x5')](e)){var event=events[e];WhatsappMessage[_0x98b2('0x6')](e,emitEvent(event));}}module[_0x98b2('0x7')]=WhatsappMessageEvents; \ No newline at end of file +var _0x0102=['setMaxListeners','save','emit','hasOwnProperty','exports','../../mysqldb','WhatsappMessage'];(function(_0xe01041,_0x5bd77a){var _0x566132=function(_0x5b148f){while(--_0x5b148f){_0xe01041['push'](_0xe01041['shift']());}};_0x566132(++_0x5bd77a);}(_0x0102,0x186));var _0x2010=function(_0x431000,_0x2c5637){_0x431000=_0x431000-0x0;var _0x62ad5d=_0x0102[_0x431000];return _0x62ad5d;};'use strict';var EventEmitter=require('events');var WhatsappMessage=require(_0x2010('0x0'))['db'][_0x2010('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x2010('0x2')](0x0);var events={'afterCreate':_0x2010('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x575b0a){return function(_0x4e30b3,_0x59082d,_0x22e49f){WhatsappMessageEvents[_0x2010('0x4')](_0x575b0a+':'+_0x4e30b3['id'],_0x4e30b3);WhatsappMessageEvents[_0x2010('0x4')](_0x575b0a,_0x4e30b3);_0x22e49f(null);};}for(var e in events){if(events[_0x2010('0x5')](e)){var event=events[e];WhatsappMessage['hook'](e,emitEvent(event));}}module[_0x2010('0x6')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 8536453..3c27772 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 _0x35cb=['utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','node-fetch','path','../../config/environment','./whatsappMessage.attributes','exports','define','WhatsappMessage','messageId','fti_whatsapp_messages','body','FULLTEXT','models','get','direction','out','secret','isNil','UserId','WhatsappInteraction','findOne','WhatsappInteractionId','then','update','createdAt','toLowerCase','catch','WhatsappAccountId','type','twilio','accountSid','authToken','phone','messages','create','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','error','sinch','baseUrl','/whatsapp/v1/','text','POST','Bearer\x20','application/json','statuses','message_id','err'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x35cb,0xb8));var _0xb35c=function(_0x5a818d,_0x2e6f5f){_0x5a818d=_0x5a818d-0x0;var _0x494b9a=_0x35cb[_0x5a818d];return _0x494b9a;};'use strict';var _=require(_0xb35c('0x0'));var util=require(_0xb35c('0x1'));var logger=require(_0xb35c('0x2'))(_0xb35c('0x3'));var moment=require(_0xb35c('0x4'));var BPromise=require(_0xb35c('0x5'));var rp=require(_0xb35c('0x6'));var fetch=require(_0xb35c('0x7'));var fs=require('fs');var path=require(_0xb35c('0x8'));var rimraf=require('rimraf');var config=require(_0xb35c('0x9'));var attributes=require(_0xb35c('0xa'));module[_0xb35c('0xb')]=function(_0x238d68,_0x25f1da){return _0x238d68[_0xb35c('0xc')](_0xb35c('0xd'),attributes,{'tableName':'whatsapp_messages','paranoid':![],'indexes':[{'name':_0xb35c('0xe'),'fields':[_0xb35c('0xe')]},{'name':_0xb35c('0xf'),'fields':[_0xb35c('0x10')],'type':_0xb35c('0x11')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5b9367,_0x3d1886,_0x180e8d){var _0x3d2045=_0x238d68[_0xb35c('0x12')];var _0x5fbcc9=_0x5b9367[_0xb35c('0x13')]({'plain':!![]});if(_0x5fbcc9[_0xb35c('0x14')]['toLowerCase']()==='in'||_0x5fbcc9['direction']['toLowerCase']()===_0xb35c('0x15')&&!_0x5fbcc9[_0xb35c('0x16')]&&!_[_0xb35c('0x17')](_0x5fbcc9[_0xb35c('0x18')])){_0x3d2045[_0xb35c('0x19')][_0xb35c('0x1a')]({'where':{'id':_0x5fbcc9[_0xb35c('0x1b')]}})[_0xb35c('0x1c')](function(_0x3af3f5){if(_0x3af3f5){_0x3af3f5[_0xb35c('0x1d')]({'lastMsgAt':_0x5fbcc9[_0xb35c('0x1e')],'lastMsgDirection':_0x5fbcc9[_0xb35c('0x14')][_0xb35c('0x1f')]()});}})[_0xb35c('0x20')](function(_0x6daa7d){console['error'](_0x6daa7d);});}if(_0x5fbcc9['direction']===_0xb35c('0x15')&&!_0x5fbcc9[_0xb35c('0x16')]){var _0x311778;_0x3d2045['WhatsappAccount']['find']({'where':{'id':_0x5fbcc9[_0xb35c('0x21')]},'raw':!![]})[_0xb35c('0x1c')](function(_0x58ba6e){_0x311778=_0x58ba6e;if(_0x311778&&_0x311778[_0xb35c('0x22')]){switch(_0x311778[_0xb35c('0x22')]){case _0xb35c('0x23'):var _0x5cd863=require(_0xb35c('0x23'));if(_0x311778[_0xb35c('0x24')]&&_0x311778[_0xb35c('0x25')]&&_0x311778[_0xb35c('0x26')]){var _0x52b4fc=new _0x5cd863(_0x311778[_0xb35c('0x24')],_0x311778[_0xb35c('0x25')]);_0x52b4fc[_0xb35c('0x27')][_0xb35c('0x28')]({'body':_0x5fbcc9[_0xb35c('0x10')],'to':_0xb35c('0x29')+_0x5fbcc9[_0xb35c('0x26')],'from':_0xb35c('0x29')+_0x311778['phone'],'statusCallback':_0x311778[_0xb35c('0x2a')]+_0xb35c('0x2b')+_0x5fbcc9['id']+_0xb35c('0x2c')+_0x311778['token']})[_0xb35c('0x1c')](function(_0x2b86a5){if(_0x2b86a5[_0xb35c('0x2d')]){return _0x5b9367[_0xb35c('0x1d')]({'messageId':_0x2b86a5[_0xb35c('0x2d')]});}})['catch'](function(_0x397254){logger['error'](_0xb35c('0x2e'),_0xb35c('0x2f'),_0xb35c('0x23'),util[_0xb35c('0x30')](_0x397254,{'showHidden':![],'depth':null}));});}else{logger[_0xb35c('0x31')](_0xb35c('0x2e'),_0xb35c('0x2f'),'twilio','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0xb35c('0x32'):var _0x92cce=_0x311778[_0xb35c('0x24')];var _0xf93a39=_0x311778[_0xb35c('0x25')];var _0x489635=_0x311778[_0xb35c('0x33')]+_0xb35c('0x34')+_0x92cce+'/messages/';var _0x477619={'to':[_0x5fbcc9[_0xb35c('0x26')]],'message':{'type':_0xb35c('0x35'),'text':_0x5fbcc9['body']}};var _0x410a1f={'method':_0xb35c('0x36'),'uri':_0x489635,'headers':{'Authorization':_0xb35c('0x37')+_0xf93a39,'Content-Type':_0xb35c('0x38')},'body':_0x477619,'json':!![]};rp(_0x410a1f)[_0xb35c('0x1c')](function(_0x4240bf){if(_0x4240bf[_0xb35c('0x39')][0x0][_0xb35c('0x3a')]){return _0x5b9367['update']({'messageId':_0x4240bf[_0xb35c('0x39')][0x0]['message_id']});}})['catch'](function(_0x2aefb0){logger[_0xb35c('0x3b')]('WhatsappMessage,\x20%s',_0x2aefb0);});break;}}})['finally'](function(){_0x180e8d();});}else{_0x180e8d();}}},'charset':_0xb35c('0x3c'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xfc60=['sinch','/whatsapp/v1/','/messages/','text','POST','Bearer\x20','message_id','statuses','err','finally','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','node-fetch','path','../../config/environment','./whatsappMessage.attributes','exports','WhatsappMessage','whatsapp_messages','messageId','body','FULLTEXT','models','get','toLowerCase','out','secret','isNil','UserId','WhatsappInteraction','findOne','then','update','createdAt','direction','catch','error','WhatsappAccount','find','type','twilio','phone','accountSid','messages','create','whatsapp:','/status?token=','token','sid','inspect','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate'];(function(_0x3e5ad0,_0x330d5f){var _0xc2e1a=function(_0x585434){while(--_0x585434){_0x3e5ad0['push'](_0x3e5ad0['shift']());}};_0xc2e1a(++_0x330d5f);}(_0xfc60,0xb3));var _0x0fc6=function(_0x1599ae,_0x50ac2b){_0x1599ae=_0x1599ae-0x0;var _0x5c97cc=_0xfc60[_0x1599ae];return _0x5c97cc;};'use strict';var _=require(_0x0fc6('0x0'));var util=require(_0x0fc6('0x1'));var logger=require('../../config/logger')(_0x0fc6('0x2'));var moment=require(_0x0fc6('0x3'));var BPromise=require(_0x0fc6('0x4'));var rp=require('request-promise');var fetch=require(_0x0fc6('0x5'));var fs=require('fs');var path=require(_0x0fc6('0x6'));var rimraf=require('rimraf');var config=require(_0x0fc6('0x7'));var attributes=require(_0x0fc6('0x8'));module[_0x0fc6('0x9')]=function(_0x295220,_0x4f3c0d){return _0x295220['define'](_0x0fc6('0xa'),attributes,{'tableName':_0x0fc6('0xb'),'paranoid':![],'indexes':[{'name':_0x0fc6('0xc'),'fields':[_0x0fc6('0xc')]},{'name':'fti_whatsapp_messages','fields':[_0x0fc6('0xd')],'type':_0x0fc6('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2dccf1,_0x53e321,_0x18696c){var _0xf63a99=_0x295220[_0x0fc6('0xf')];var _0x23f8d7=_0x2dccf1[_0x0fc6('0x10')]({'plain':!![]});if(_0x23f8d7['direction'][_0x0fc6('0x11')]()==='in'||_0x23f8d7['direction']['toLowerCase']()===_0x0fc6('0x12')&&!_0x23f8d7[_0x0fc6('0x13')]&&!_[_0x0fc6('0x14')](_0x23f8d7[_0x0fc6('0x15')])){_0xf63a99[_0x0fc6('0x16')][_0x0fc6('0x17')]({'where':{'id':_0x23f8d7['WhatsappInteractionId']}})[_0x0fc6('0x18')](function(_0x234e4e){if(_0x234e4e){_0x234e4e[_0x0fc6('0x19')]({'lastMsgAt':_0x23f8d7[_0x0fc6('0x1a')],'lastMsgDirection':_0x23f8d7[_0x0fc6('0x1b')]['toLowerCase']()});}})[_0x0fc6('0x1c')](function(_0x15e2fb){console[_0x0fc6('0x1d')](_0x15e2fb);});}if(_0x23f8d7['direction']===_0x0fc6('0x12')&&!_0x23f8d7['secret']){var _0x2bb8c6;_0xf63a99[_0x0fc6('0x1e')][_0x0fc6('0x1f')]({'where':{'id':_0x23f8d7['WhatsappAccountId']},'raw':!![]})[_0x0fc6('0x18')](function(_0x36f029){_0x2bb8c6=_0x36f029;if(_0x2bb8c6&&_0x2bb8c6[_0x0fc6('0x20')]){switch(_0x2bb8c6[_0x0fc6('0x20')]){case _0x0fc6('0x21'):var _0x295adf=require(_0x0fc6('0x21'));if(_0x2bb8c6['accountSid']&&_0x2bb8c6['authToken']&&_0x2bb8c6[_0x0fc6('0x22')]){var _0x45a059=new _0x295adf(_0x2bb8c6[_0x0fc6('0x23')],_0x2bb8c6['authToken']);_0x45a059[_0x0fc6('0x24')][_0x0fc6('0x25')]({'body':_0x23f8d7['body'],'to':_0x0fc6('0x26')+_0x23f8d7[_0x0fc6('0x22')],'from':_0x0fc6('0x26')+_0x2bb8c6[_0x0fc6('0x22')],'statusCallback':_0x2bb8c6['remote']+'/api/whatsapp/messages/'+_0x23f8d7['id']+_0x0fc6('0x27')+_0x2bb8c6[_0x0fc6('0x28')]})[_0x0fc6('0x18')](function(_0x591721){if(_0x591721['sid']){return _0x2dccf1[_0x0fc6('0x19')]({'messageId':_0x591721[_0x0fc6('0x29')]});}})[_0x0fc6('0x1c')](function(_0xbb8b47){logger[_0x0fc6('0x1d')]('WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x0fc6('0x21'),util[_0x0fc6('0x2a')](_0xbb8b47,{'showHidden':![],'depth':null}));});}else{logger[_0x0fc6('0x1d')](_0x0fc6('0x2b'),_0x0fc6('0x2c'),_0x0fc6('0x21'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0x0fc6('0x2d'):var _0x432b3d=_0x2bb8c6['accountSid'];var _0x47b698=_0x2bb8c6['authToken'];var _0x5c336f=_0x2bb8c6['baseUrl']+_0x0fc6('0x2e')+_0x432b3d+_0x0fc6('0x2f');var _0x3d2ce8={'to':[_0x23f8d7[_0x0fc6('0x22')]],'message':{'type':_0x0fc6('0x30'),'text':_0x23f8d7['body']}};var _0x1e79d8={'method':_0x0fc6('0x31'),'uri':_0x5c336f,'headers':{'Authorization':_0x0fc6('0x32')+_0x47b698,'Content-Type':'application/json'},'body':_0x3d2ce8,'json':!![]};rp(_0x1e79d8)[_0x0fc6('0x18')](function(_0x40522b){if(_0x40522b['statuses'][0x0][_0x0fc6('0x33')]){return _0x2dccf1['update']({'messageId':_0x40522b[_0x0fc6('0x34')][0x0][_0x0fc6('0x33')]});}})['catch'](function(_0x404c34){logger[_0x0fc6('0x35')]('WhatsappMessage,\x20%s',_0x404c34);});break;}}})[_0x0fc6('0x36')](function(){_0x18696c();});}else{_0x18696c();}}},'charset':'utf8mb4','collate':_0x0fc6('0x37')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index cb91cf6..503dba8 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 _0xf1d4=['redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','CreateWhatsappMessage','WhatsappMessage','create','body','options','raw','debug','catch','util','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x1e172a,_0x52102b){var _0x96338b=function(_0x307313){while(--_0x307313){_0x1e172a['push'](_0x1e172a['shift']());}};_0x96338b(++_0x52102b);}(_0xf1d4,0x16c));var _0x4f1d=function(_0x48ac89,_0x102d3b){_0x48ac89=_0x48ac89-0x0;var _0x336a03=_0xf1d4[_0x48ac89];return _0x336a03;};'use strict';var _=require('lodash');var util=require(_0x4f1d('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4f1d('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4f1d('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x4f1d('0x3'))(_0x4f1d('0x4'));var config=require('../../config/environment');var jayson=require(_0x4f1d('0x5'));var client=jayson[_0x4f1d('0x6')][_0x4f1d('0x7')]({'port':0x232a});config[_0x4f1d('0x8')]=_[_0x4f1d('0x9')](config[_0x4f1d('0x8')],{'host':_0x4f1d('0xa'),'port':0x18eb});var socket=require(_0x4f1d('0xb'))(new Redis(config['redis']));require(_0x4f1d('0xc'))[_0x4f1d('0xd')](socket);function respondWithRpcPromise(_0x499e85,_0x23da9b,_0x6e2b7d){return new BPromise(function(_0x118590,_0x128c71){return client[_0x4f1d('0xe')](_0x499e85,_0x6e2b7d)[_0x4f1d('0xf')](function(_0x5b7e1a){logger[_0x4f1d('0x10')](_0x4f1d('0x11'),_0x23da9b,_0x4f1d('0x12'));logger['debug'](_0x4f1d('0x13'),_0x23da9b,'request\x20sent',JSON[_0x4f1d('0x14')](_0x5b7e1a));if(_0x5b7e1a[_0x4f1d('0x15')]){if(_0x5b7e1a[_0x4f1d('0x15')]['code']===0x1f4){logger['error'](_0x4f1d('0x11'),_0x23da9b,_0x5b7e1a[_0x4f1d('0x15')][_0x4f1d('0x16')]);return _0x128c71(_0x5b7e1a[_0x4f1d('0x15')][_0x4f1d('0x16')]);}logger['error'](_0x4f1d('0x11'),_0x23da9b,_0x5b7e1a[_0x4f1d('0x15')][_0x4f1d('0x16')]);return _0x118590(_0x5b7e1a[_0x4f1d('0x15')][_0x4f1d('0x16')]);}else{logger[_0x4f1d('0x10')](_0x4f1d('0x11'),_0x23da9b,_0x4f1d('0x12'));_0x118590(_0x5b7e1a['result']['message']);}})['catch'](function(_0x3cd6fc){logger['error'](_0x4f1d('0x11'),_0x23da9b,_0x3cd6fc);_0x128c71(_0x3cd6fc);});});}exports[_0x4f1d('0x17')]=function(_0x47f581){var _0x58115f=this;return new Promise(function(_0x509b4a,_0x1251c4){return db[_0x4f1d('0x18')][_0x4f1d('0x19')](_0x47f581[_0x4f1d('0x1a')],{'raw':_0x47f581[_0x4f1d('0x1b')]?_0x47f581[_0x4f1d('0x1b')][_0x4f1d('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x483640){logger[_0x4f1d('0x10')](_0x4f1d('0x17'),_0x47f581);logger[_0x4f1d('0x1d')]('CreateWhatsappMessage',_0x47f581,JSON[_0x4f1d('0x14')](_0x483640));_0x509b4a(_0x483640);})[_0x4f1d('0x1e')](function(_0x2be719){logger[_0x4f1d('0x15')](_0x4f1d('0x17'),_0x2be719[_0x4f1d('0x16')],_0x47f581);_0x1251c4(_0x58115f['error'](0x1f4,_0x2be719['message']));});});}; \ No newline at end of file +var _0xf0ed=['WhatsappMessage,\x20%s,\x20%s','debug','stringify','error','code','message','result','catch','CreateWhatsappMessage','WhatsappMessage','create','body','options','raw','lodash','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./whatsappMessage.socket','register','request','then','info'];(function(_0x50fa1b,_0x5697a3){var _0x62e9cf=function(_0x577e86){while(--_0x577e86){_0x50fa1b['push'](_0x50fa1b['shift']());}};_0x62e9cf(++_0x5697a3);}(_0xf0ed,0xd9));var _0xdf0e=function(_0x16795f,_0x533662){_0x16795f=_0x16795f-0x0;var _0x328f13=_0xf0ed[_0x16795f];return _0x328f13;};'use strict';var _=require(_0xdf0e('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('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xdf0e('0x1'))(_0xdf0e('0x2'));var config=require(_0xdf0e('0x3'));var jayson=require(_0xdf0e('0x4'));var client=jayson[_0xdf0e('0x5')][_0xdf0e('0x6')]({'port':0x232a});config[_0xdf0e('0x7')]=_['defaults'](config[_0xdf0e('0x7')],{'host':_0xdf0e('0x8'),'port':0x18eb});var socket=require(_0xdf0e('0x9'))(new Redis(config[_0xdf0e('0x7')]));require(_0xdf0e('0xa'))[_0xdf0e('0xb')](socket);function respondWithRpcPromise(_0x4dc4a2,_0x5df4a0,_0x3785a9){return new BPromise(function(_0x8c250d,_0x5ba14f){return client[_0xdf0e('0xc')](_0x4dc4a2,_0x3785a9)[_0xdf0e('0xd')](function(_0x3a46a6){logger[_0xdf0e('0xe')](_0xdf0e('0xf'),_0x5df4a0,'request\x20sent');logger[_0xdf0e('0x10')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x5df4a0,'request\x20sent',JSON[_0xdf0e('0x11')](_0x3a46a6));if(_0x3a46a6[_0xdf0e('0x12')]){if(_0x3a46a6[_0xdf0e('0x12')][_0xdf0e('0x13')]===0x1f4){logger[_0xdf0e('0x12')](_0xdf0e('0xf'),_0x5df4a0,_0x3a46a6['error'][_0xdf0e('0x14')]);return _0x5ba14f(_0x3a46a6[_0xdf0e('0x12')]['message']);}logger[_0xdf0e('0x12')](_0xdf0e('0xf'),_0x5df4a0,_0x3a46a6['error'][_0xdf0e('0x14')]);return _0x8c250d(_0x3a46a6['error'][_0xdf0e('0x14')]);}else{logger[_0xdf0e('0xe')](_0xdf0e('0xf'),_0x5df4a0,'request\x20sent');_0x8c250d(_0x3a46a6[_0xdf0e('0x15')][_0xdf0e('0x14')]);}})[_0xdf0e('0x16')](function(_0x4263d3){logger[_0xdf0e('0x12')](_0xdf0e('0xf'),_0x5df4a0,_0x4263d3);_0x5ba14f(_0x4263d3);});});}exports[_0xdf0e('0x17')]=function(_0x475de4){var _0x3af81f=this;return new Promise(function(_0x3e7229,_0x55b812){return db[_0xdf0e('0x18')][_0xdf0e('0x19')](_0x475de4[_0xdf0e('0x1a')],{'raw':_0x475de4[_0xdf0e('0x1b')]?_0x475de4[_0xdf0e('0x1b')][_0xdf0e('0x1c')]===undefined?!![]:![]:!![]})[_0xdf0e('0xd')](function(_0x14fb7f){logger[_0xdf0e('0xe')](_0xdf0e('0x17'),_0x475de4);logger[_0xdf0e('0x10')](_0xdf0e('0x17'),_0x475de4,JSON['stringify'](_0x14fb7f));_0x3e7229(_0x14fb7f);})['catch'](function(_0x5231a7){logger[_0xdf0e('0x12')]('CreateWhatsappMessage',_0x5231a7[_0xdf0e('0x14')],_0x475de4);_0x55b812(_0x3af81f[_0xdf0e('0x12')](0x1f4,_0x5231a7[_0xdf0e('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index e807ff0..d2e4206 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 _0x0b7f=['length','whatsappMessage:','remove','removeListener','register'];(function(_0x4bdae6,_0x58bad7){var _0x4a8f49=function(_0x1cc1af){while(--_0x1cc1af){_0x4bdae6['push'](_0x4bdae6['shift']());}};_0x4a8f49(++_0x58bad7);}(_0x0b7f,0x93));var _0xf0b7=function(_0x14405d,_0x2b42a0){_0x14405d=_0x14405d-0x0;var _0x17b644=_0x0b7f[_0x14405d];return _0x17b644;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=['save',_0xf0b7('0x0'),'update'];function createListener(_0x5a23b2,_0x56ab5a){return function(_0x5b7d5d){_0x56ab5a['emit'](_0x5a23b2,_0x5b7d5d);};}function removeListener(_0xe16de,_0x237b87){return function(){WhatsappMessageEvents[_0xf0b7('0x1')](_0xe16de,_0x237b87);};}exports[_0xf0b7('0x2')]=function(_0x2de7b1){for(var _0x512d22=0x0,_0x10b33d=events[_0xf0b7('0x3')];_0x512d22<_0x10b33d;_0x512d22++){var _0x13ea55=events[_0x512d22];var _0x1c1d40=createListener(_0xf0b7('0x4')+_0x13ea55,_0x2de7b1);WhatsappMessageEvents['on'](_0x13ea55,_0x1c1d40);}}; \ No newline at end of file +var _0x1a00=['whatsappMessage:','./whatsappMessage.events','save','remove','emit','register','length'];(function(_0x165f08,_0x384ec6){var _0x204b1b=function(_0x500d0b){while(--_0x500d0b){_0x165f08['push'](_0x165f08['shift']());}};_0x204b1b(++_0x384ec6);}(_0x1a00,0x127));var _0x01a0=function(_0x9c4a09,_0x1d0849){_0x9c4a09=_0x9c4a09-0x0;var _0x5d0b42=_0x1a00[_0x9c4a09];return _0x5d0b42;};'use strict';var WhatsappMessageEvents=require(_0x01a0('0x0'));var events=[_0x01a0('0x1'),_0x01a0('0x2'),'update'];function createListener(_0x588929,_0x58a3b7){return function(_0x494d82){_0x58a3b7[_0x01a0('0x3')](_0x588929,_0x494d82);};}function removeListener(_0x53bdd8,_0x115c63){return function(){WhatsappMessageEvents['removeListener'](_0x53bdd8,_0x115c63);};}exports[_0x01a0('0x4')]=function(_0x2019fb){for(var _0x473dbd=0x0,_0x46e1b1=events[_0x01a0('0x5')];_0x473dbd<_0x46e1b1;_0x473dbd++){var _0x26311e=events[_0x473dbd];var _0x4b02de=createListener(_0x01a0('0x6')+_0x26311e,_0x2019fb);WhatsappMessageEvents['on'](_0x26311e,_0x4b02de);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index bd261eb..324ad16 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 _0x8835=['put','update','delete','removeTeams','removeAgents','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappQueue.controller','index','get','/describe','isAuthenticated','describe','/:id','show','/:id/members','/:id/users','getAgents','post','/:id/teams','addAgents'];(function(_0x4751d6,_0x2911a1){var _0x55e2c3=function(_0x420a54){while(--_0x420a54){_0x4751d6['push'](_0x4751d6['shift']());}};_0x55e2c3(++_0x2911a1);}(_0x8835,0x1f3));var _0x5883=function(_0x43c982,_0x55cebd){_0x43c982=_0x43c982-0x0;var _0x5b3ce3=_0x8835[_0x43c982];return _0x5b3ce3;};'use strict';var multer=require(_0x5883('0x0'));var util=require('util');var path=require(_0x5883('0x1'));var timeout=require('connect-timeout');var express=require(_0x5883('0x2'));var router=express[_0x5883('0x3')]();var fs_extra=require(_0x5883('0x4'));var auth=require(_0x5883('0x5'));var interaction=require(_0x5883('0x6'));var config=require('../../config/environment');var controller=require(_0x5883('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x5883('0x8')]);router[_0x5883('0x9')](_0x5883('0xa'),auth[_0x5883('0xb')](),controller[_0x5883('0xc')]);router[_0x5883('0x9')](_0x5883('0xd'),auth[_0x5883('0xb')](),controller[_0x5883('0xe')]);router[_0x5883('0x9')](_0x5883('0xf'),auth[_0x5883('0xb')](),controller['getMembers']);router['get']('/:id/teams',auth[_0x5883('0xb')](),controller['getTeams']);router[_0x5883('0x9')](_0x5883('0x10'),auth[_0x5883('0xb')](),controller[_0x5883('0x11')]);router[_0x5883('0x12')]('/',auth[_0x5883('0xb')](),controller['create']);router[_0x5883('0x12')](_0x5883('0x13'),auth[_0x5883('0xb')](),controller['addTeams']);router[_0x5883('0x12')](_0x5883('0x10'),auth[_0x5883('0xb')](),controller[_0x5883('0x14')]);router[_0x5883('0x15')](_0x5883('0xd'),auth[_0x5883('0xb')](),controller[_0x5883('0x16')]);router[_0x5883('0x17')](_0x5883('0xd'),auth[_0x5883('0xb')](),controller['destroy']);router[_0x5883('0x17')](_0x5883('0x13'),auth[_0x5883('0xb')](),controller[_0x5883('0x18')]);router[_0x5883('0x17')](_0x5883('0x10'),auth[_0x5883('0xb')](),controller[_0x5883('0x19')]);module['exports']=router; \ No newline at end of file +var _0xa88c=['util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappQueue.controller','get','isAuthenticated','/describe','show','/:id/members','getMembers','/:id/teams','getTeams','create','addTeams','post','/:id/users','addAgents','put','/:id','delete','destroy','removeTeams','removeAgents','multer'];(function(_0x1a9fff,_0x113a8c){var _0x26d472=function(_0x41cfdb){while(--_0x41cfdb){_0x1a9fff['push'](_0x1a9fff['shift']());}};_0x26d472(++_0x113a8c);}(_0xa88c,0xc3));var _0xca88=function(_0x35ebd7,_0x369331){_0x35ebd7=_0x35ebd7-0x0;var _0x4b98d7=_0xa88c[_0x35ebd7];return _0x4b98d7;};'use strict';var multer=require(_0xca88('0x0'));var util=require(_0xca88('0x1'));var path=require(_0xca88('0x2'));var timeout=require(_0xca88('0x3'));var express=require('express');var router=express[_0xca88('0x4')]();var fs_extra=require(_0xca88('0x5'));var auth=require(_0xca88('0x6'));var interaction=require(_0xca88('0x7'));var config=require('../../config/environment');var controller=require(_0xca88('0x8'));router[_0xca88('0x9')]('/',auth[_0xca88('0xa')](),controller['index']);router[_0xca88('0x9')](_0xca88('0xb'),auth[_0xca88('0xa')](),controller['describe']);router[_0xca88('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xca88('0xc')]);router[_0xca88('0x9')](_0xca88('0xd'),auth[_0xca88('0xa')](),controller[_0xca88('0xe')]);router[_0xca88('0x9')](_0xca88('0xf'),auth[_0xca88('0xa')](),controller[_0xca88('0x10')]);router[_0xca88('0x9')]('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router['post']('/',auth['isAuthenticated'](),controller[_0xca88('0x11')]);router['post'](_0xca88('0xf'),auth[_0xca88('0xa')](),controller[_0xca88('0x12')]);router[_0xca88('0x13')](_0xca88('0x14'),auth[_0xca88('0xa')](),controller[_0xca88('0x15')]);router[_0xca88('0x16')](_0xca88('0x17'),auth[_0xca88('0xa')](),controller['update']);router[_0xca88('0x18')](_0xca88('0x17'),auth[_0xca88('0xa')](),controller[_0xca88('0x19')]);router['delete'](_0xca88('0xf'),auth[_0xca88('0xa')](),controller[_0xca88('0x1a')]);router[_0xca88('0x18')](_0xca88('0x14'),auth['isAuthenticated'](),controller[_0xca88('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 02c874c..1f1405a 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 _0xac65=['STRING','INTEGER','ENUM','rrmemory','roundrobin','sequelize','exports'];(function(_0x15bc81,_0x4d4f77){var _0x59440e=function(_0x1b60f2){while(--_0x1b60f2){_0x15bc81['push'](_0x15bc81['shift']());}};_0x59440e(++_0x4d4f77);}(_0xac65,0x11d));var _0x5ac6=function(_0xb830a,_0x258ed8){_0xb830a=_0xb830a-0x0;var _0x47b2f3=_0xac65[_0xb830a];return _0x47b2f3;};'use strict';var Sequelize=require(_0x5ac6('0x0'));module[_0x5ac6('0x1')]={'name':{'type':Sequelize[_0x5ac6('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x5ac6('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x5ac6('0x4')](_0x5ac6('0x5'),'beepall',_0x5ac6('0x6'))},'description':{'type':Sequelize[_0x5ac6('0x2')]}}; \ No newline at end of file +var _0xf69b=['beepall','STRING','exports','name','ENUM','rrmemory'];(function(_0x35c514,_0x22bb8a){var _0x448f20=function(_0x54f93a){while(--_0x54f93a){_0x35c514['push'](_0x35c514['shift']());}};_0x448f20(++_0x22bb8a);}(_0xf69b,0xc8));var _0xbf69=function(_0x327624,_0x5ec10c){_0x327624=_0x327624-0x0;var _0x2cc875=_0xf69b[_0x327624];return _0x2cc875;};'use strict';var Sequelize=require('sequelize');module[_0xbf69('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0xbf69('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xbf69('0x2')](_0xbf69('0x3'),_0xbf69('0x4'),'roundrobin')},'description':{'type':Sequelize[_0xbf69('0x5')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 2fbb273..4c86c5c 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 _0x307e=['each','UserWhatsappQueue','findOrCreate','forEach','userWhatsappQueue:save','removeTeams','Team','select','field','join','WhatsappQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','SELECT','all','compact','addAgents','omit','spread','emit','removeAgents','isArray','userWhatsappQueue:remove','getAgents','rimraf','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','get','WhatsappQueues','sendStatus','error','stack','name','map','WhatsappQueue','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','pick','filter','where','merge','options','includeAll','rows','catch','show','params','rawAttributes','include','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','WhatsappQueueId','findAll','User','findAndCountAll','UserId','agent','whatsappPause','updatedAt','createdAt','format','SIP','getTeams','nolimit','addTeams','ids','voicePause','interface','flatMap','Agents','sequelize','transaction'];(function(_0x406633,_0x190f5d){var _0x318f51=function(_0x305e03){while(--_0x305e03){_0x406633['push'](_0x406633['shift']());}};_0x318f51(++_0x190f5d);}(_0x307e,0x1b1));var _0xe307=function(_0x324cda,_0x4b5f65){_0x324cda=_0x324cda-0x0;var _0x2dd7ce=_0x307e[_0x324cda];return _0x2dd7ce;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe307('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe307('0x1'));var moment=require(_0xe307('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xe307('0x3'));var path=require(_0xe307('0x4'));var sox=require(_0xe307('0x5'));var csv=require(_0xe307('0x6'));var ejs=require(_0xe307('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe307('0x8'));var squel=require(_0xe307('0x9'));var crypto=require('crypto');var jsforce=require(_0xe307('0xa'));var deskjs=require(_0xe307('0xb'));var toCsv=require(_0xe307('0x6'));var querystring=require(_0xe307('0xc'));var Papa=require(_0xe307('0xd'));var Redis=require(_0xe307('0xe'));var authService=require(_0xe307('0xf'));var qs=require(_0xe307('0x10'));var as=require(_0xe307('0x11'));var hardwareService=require(_0xe307('0x12'));var logger=require('../../config/logger')(_0xe307('0x13'));var utils=require(_0xe307('0x14'));var config=require(_0xe307('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xe307('0x16'))['db'];config[_0xe307('0x17')]=_[_0xe307('0x18')](config[_0xe307('0x17')],{'host':_0xe307('0x19'),'port':0x18eb});var socket=require(_0xe307('0x1a'))(new Redis(config[_0xe307('0x17')]));require(_0xe307('0x1b'))[_0xe307('0x1c')](socket);function respondWithStatusCode(_0x3f9134,_0x58319f){_0x58319f=_0x58319f||0xcc;return function(_0x754f6a){if(_0x754f6a){return _0x3f9134['sendStatus'](_0x58319f);}return _0x3f9134[_0xe307('0x1d')](_0x58319f)[_0xe307('0x1e')]();};}function respondWithResult(_0x39e8e4,_0x1d4842){_0x1d4842=_0x1d4842||0xc8;return function(_0x2d3e07){if(_0x2d3e07){return _0x39e8e4[_0xe307('0x1d')](_0x1d4842)[_0xe307('0x1f')](_0x2d3e07);}};}function respondWithFilteredResult(_0x347d69,_0x505f42){return function(_0x1185f1){if(_0x1185f1){var _0x2b08d2=typeof _0x505f42['offset']===_0xe307('0x20')&&typeof _0x505f42['limit']===_0xe307('0x20');var _0x1a2fe6=_0x1185f1[_0xe307('0x21')];var _0x4752fc=_0x2b08d2?0x0:_0x505f42[_0xe307('0x22')];var _0xf26c73=_0x2b08d2?_0x1185f1['count']:_0x505f42[_0xe307('0x22')]+_0x505f42[_0xe307('0x23')];var _0x37b006;if(_0xf26c73>=_0x1a2fe6){_0xf26c73=_0x1a2fe6;_0x37b006=0xc8;}else{_0x37b006=0xce;}_0x347d69['status'](_0x37b006);return _0x347d69[_0xe307('0x24')](_0xe307('0x25'),_0x4752fc+'-'+_0xf26c73+'/'+_0x1a2fe6)[_0xe307('0x1f')](_0x1185f1);}return null;};}function patchUpdates(_0x127563){return function(_0xe90b75){try{jsonpatch[_0xe307('0x26')](_0xe90b75,_0x127563,!![]);}catch(_0x4a71b1){return BPromise[_0xe307('0x27')](_0x4a71b1);}return _0xe90b75[_0xe307('0x28')]();};}function saveUpdates(_0x333890,_0x1fcc4d){return function(_0x25b6f1){if(_0x25b6f1){return _0x25b6f1[_0xe307('0x29')](_0x333890)['then'](function(_0x4f9d55){return _0x4f9d55;});}return null;};}function removeEntity(_0x21e055,_0x585264){return function(_0x43fb96){if(_0x43fb96){return _0x43fb96[_0xe307('0x2a')]()[_0xe307('0x2b')](function(){var _0x33bb27=_0x43fb96[_0xe307('0x2c')]({'plain':!![]});var _0x2a8c3e=_0xe307('0x2d');return db['UserProfileResource'][_0xe307('0x2a')]({'where':{'type':_0x2a8c3e,'resourceId':_0x33bb27['id']}})['then'](function(){return _0x43fb96;});})[_0xe307('0x2b')](function(){_0x21e055[_0xe307('0x1d')](0xcc)[_0xe307('0x1e')]();});}};}function handleEntityNotFound(_0xb6f042,_0xefa389){return function(_0x5cea9a){if(!_0x5cea9a){_0xb6f042[_0xe307('0x2e')](0x194);}return _0x5cea9a;};}function handleError(_0x1f6947,_0x34d071){_0x34d071=_0x34d071||0x1f4;return function(_0x467990){logger[_0xe307('0x2f')](_0x467990[_0xe307('0x30')]);if(_0x467990[_0xe307('0x31')]){delete _0x467990[_0xe307('0x31')];}_0x1f6947['status'](_0x34d071)['send'](_0x467990);};}exports['index']=function(_0x53d38f,_0x4f4d85){var _0x1fefab={},_0x417d63={},_0x5ea442={'count':0x0,'rows':[]};var _0x5e61f1=_[_0xe307('0x32')](db[_0xe307('0x33')]['rawAttributes'],function(_0x22004c){return{'name':_0x22004c[_0xe307('0x34')],'type':_0x22004c[_0xe307('0x35')][_0xe307('0x36')]};});_0x417d63[_0xe307('0x37')]=_[_0xe307('0x32')](_0x5e61f1,'name');_0x417d63[_0xe307('0x38')]=_[_0xe307('0x39')](_0x53d38f[_0xe307('0x38')]);_0x417d63['filters']=_[_0xe307('0x3a')](_0x417d63[_0xe307('0x37')],_0x417d63[_0xe307('0x38')]);_0x1fefab[_0xe307('0x3b')]=_[_0xe307('0x3a')](_0x417d63['model'],qs[_0xe307('0x3c')](_0x53d38f['query']['fields']));_0x1fefab[_0xe307('0x3b')]=_0x1fefab[_0xe307('0x3b')][_0xe307('0x3d')]?_0x1fefab['attributes']:_0x417d63[_0xe307('0x37')];if(!_0x53d38f[_0xe307('0x38')][_0xe307('0x3e')]('nolimit')){_0x1fefab[_0xe307('0x23')]=qs[_0xe307('0x23')](_0x53d38f[_0xe307('0x38')]['limit']);_0x1fefab[_0xe307('0x22')]=qs['offset'](_0x53d38f[_0xe307('0x38')][_0xe307('0x22')]);}_0x1fefab[_0xe307('0x3f')]=qs[_0xe307('0x40')](_0x53d38f[_0xe307('0x38')]['sort']);_0x1fefab['where']=qs[_0xe307('0x41')](_[_0xe307('0x42')](_0x53d38f['query'],_0x417d63[_0xe307('0x41')]),_0x5e61f1);if(_0x53d38f[_0xe307('0x38')][_0xe307('0x43')]){_0x1fefab[_0xe307('0x44')]=_['merge'](_0x1fefab['where'],{'$or':_['map'](_0x5e61f1,function(_0x389619){if(_0x389619[_0xe307('0x35')]!=='VIRTUAL'){var _0x231bdf={};_0x231bdf[_0x389619[_0xe307('0x31')]]={'$like':'%'+_0x53d38f[_0xe307('0x38')][_0xe307('0x43')]+'%'};return _0x231bdf;}})});}_0x1fefab=_[_0xe307('0x45')]({},_0x1fefab,_0x53d38f[_0xe307('0x46')]);var _0x399ca6={'where':_0x1fefab[_0xe307('0x44')]};return db[_0xe307('0x33')]['count'](_0x399ca6)[_0xe307('0x2b')](function(_0x5e3acc){_0x5ea442[_0xe307('0x21')]=_0x5e3acc;if(_0x53d38f['query'][_0xe307('0x47')]){_0x1fefab['include']=[{'all':!![]}];}return db['WhatsappQueue']['findAll'](_0x1fefab);})[_0xe307('0x2b')](function(_0x604f05){_0x5ea442[_0xe307('0x48')]=_0x604f05;return _0x5ea442;})[_0xe307('0x2b')](respondWithFilteredResult(_0x4f4d85,_0x1fefab))[_0xe307('0x49')](handleError(_0x4f4d85,null));};exports[_0xe307('0x4a')]=function(_0x165e61,_0x1ccd4b){var _0x278472={'raw':!![],'where':{'id':_0x165e61[_0xe307('0x4b')]['id']}},_0x15fdd6={};_0x15fdd6[_0xe307('0x37')]=_[_0xe307('0x39')](db[_0xe307('0x33')][_0xe307('0x4c')]);_0x15fdd6[_0xe307('0x38')]=_[_0xe307('0x39')](_0x165e61['query']);_0x15fdd6[_0xe307('0x41')]=_[_0xe307('0x3a')](_0x15fdd6['model'],_0x15fdd6[_0xe307('0x38')]);_0x278472[_0xe307('0x3b')]=_[_0xe307('0x3a')](_0x15fdd6['model'],qs['fields'](_0x165e61[_0xe307('0x38')]['fields']));_0x278472[_0xe307('0x3b')]=_0x278472[_0xe307('0x3b')][_0xe307('0x3d')]?_0x278472[_0xe307('0x3b')]:_0x15fdd6[_0xe307('0x37')];if(_0x165e61[_0xe307('0x38')]['includeAll']){_0x278472[_0xe307('0x4d')]=[{'all':!![]}];}_0x278472=_[_0xe307('0x45')]({},_0x278472,_0x165e61['options']);return db[_0xe307('0x33')][_0xe307('0x4e')](_0x278472)[_0xe307('0x2b')](handleEntityNotFound(_0x1ccd4b,null))['then'](respondWithResult(_0x1ccd4b,null))[_0xe307('0x49')](handleError(_0x1ccd4b,null));};exports[_0xe307('0x4f')]=function(_0x287097,_0x149408){return db['WhatsappQueue'][_0xe307('0x4f')](_0x287097['body'],{})[_0xe307('0x2b')](function(_0x1f30a4){var _0xeaa5c6=_0x287097['user']['get']({'plain':!![]});if(!_0xeaa5c6)throw new Error(_0xe307('0x50'));if(_0xeaa5c6['role']===_0xe307('0x51')){var _0x22c2af=_0x1f30a4[_0xe307('0x2c')]({'plain':!![]});var _0xac692f=_0xe307('0x2d');return db['UserProfileSection'][_0xe307('0x4e')]({'where':{'name':_0xac692f,'userProfileId':_0xeaa5c6[_0xe307('0x52')]},'raw':!![]})[_0xe307('0x2b')](function(_0x3276f9){if(_0x3276f9&&_0x3276f9[_0xe307('0x53')]===0x0){return db[_0xe307('0x54')][_0xe307('0x4f')]({'name':_0x22c2af[_0xe307('0x31')],'resourceId':_0x22c2af['id'],'type':_0x3276f9[_0xe307('0x31')],'sectionId':_0x3276f9['id']},{})[_0xe307('0x2b')](function(){return _0x1f30a4;});}else{return _0x1f30a4;}})[_0xe307('0x49')](function(_0x433b60){logger[_0xe307('0x2f')](_0xe307('0x55'),_0x433b60);throw _0x433b60;});}return _0x1f30a4;})[_0xe307('0x2b')](respondWithResult(_0x149408,0xc9))['catch'](handleError(_0x149408,null));};exports[_0xe307('0x29')]=function(_0x3bf431,_0x4cd617){if(_0x3bf431[_0xe307('0x56')]['id']){delete _0x3bf431[_0xe307('0x56')]['id'];}return db[_0xe307('0x33')][_0xe307('0x4e')]({'where':{'id':_0x3bf431[_0xe307('0x4b')]['id']}})[_0xe307('0x2b')](handleEntityNotFound(_0x4cd617,null))[_0xe307('0x2b')](saveUpdates(_0x3bf431[_0xe307('0x56')],null))[_0xe307('0x2b')](respondWithResult(_0x4cd617,null))[_0xe307('0x49')](handleError(_0x4cd617,null));};exports[_0xe307('0x2a')]=function(_0x4f8e04,_0x48941a){return db[_0xe307('0x33')]['find']({'where':{'id':_0x4f8e04[_0xe307('0x4b')]['id']}})[_0xe307('0x2b')](handleEntityNotFound(_0x48941a,null))[_0xe307('0x2b')](removeEntity(_0x48941a,null))[_0xe307('0x49')](handleError(_0x48941a,null));};exports[_0xe307('0x57')]=function(_0x1d6adc,_0x57e86b){return db[_0xe307('0x33')][_0xe307('0x57')]()[_0xe307('0x2b')](respondWithResult(_0x57e86b,null))[_0xe307('0x49')](handleError(_0x57e86b,null));};exports[_0xe307('0x58')]=function(_0x448fbd,_0x5dc0ba,_0x138975){var _0x31507b={'raw':!![],'where':{}},_0x2256ee={},_0x4687f4;return db[_0xe307('0x33')][_0xe307('0x59')]({'where':{'id':_0x448fbd[_0xe307('0x4b')]['id']}})[_0xe307('0x2b')](handleEntityNotFound(_0x5dc0ba,null))['then'](function(_0x4a77cd){if(_0x4a77cd){_0x4687f4=_0x4a77cd['get']({'plain':!![]});_0x2256ee[_0xe307('0x37')]=_[_0xe307('0x39')](db['UserWhatsappQueue'][_0xe307('0x4c')]);_0x2256ee['query']=_[_0xe307('0x39')](_0x448fbd[_0xe307('0x38')]);_0x2256ee[_0xe307('0x41')]=_[_0xe307('0x3a')](_0x2256ee[_0xe307('0x37')],_0x2256ee[_0xe307('0x38')]);_0x31507b[_0xe307('0x3b')]=_[_0xe307('0x3a')](_0x2256ee['model'],qs[_0xe307('0x3c')](_0x448fbd[_0xe307('0x38')]['fields']));_0x31507b[_0xe307('0x3b')]=_0x31507b[_0xe307('0x3b')][_0xe307('0x3d')]?_0x31507b[_0xe307('0x3b')]:_0x2256ee[_0xe307('0x37')];if(!_0x448fbd[_0xe307('0x38')][_0xe307('0x3e')]('nolimit')){_0x31507b['limit']=qs[_0xe307('0x23')](_0x448fbd[_0xe307('0x38')]['limit']);_0x31507b['offset']=qs[_0xe307('0x22')](_0x448fbd[_0xe307('0x38')][_0xe307('0x22')]);}_0x31507b[_0xe307('0x3f')]=qs[_0xe307('0x40')](_0x448fbd[_0xe307('0x38')][_0xe307('0x40')]);_0x31507b[_0xe307('0x44')]=qs[_0xe307('0x41')](_['pick'](_0x448fbd[_0xe307('0x38')],_0x2256ee['filters']));_0x31507b[_0xe307('0x44')][_0xe307('0x5a')]=_0x4a77cd['id'];if(_0x448fbd['query']['filter']){_0x31507b[_0xe307('0x44')]=_[_0xe307('0x45')](_0x31507b['where'],{'$or':_[_0xe307('0x32')](_0x31507b['attributes'],function(_0xc9e219){var _0x207961={};_0x207961[_0xc9e219]={'$like':'%'+_0x448fbd[_0xe307('0x38')][_0xe307('0x43')]+'%'};return _0x207961;})});}_0x31507b=_[_0xe307('0x45')]({},_0x31507b,_0x448fbd[_0xe307('0x46')]);return db['UserWhatsappQueue'][_0xe307('0x5b')](_0x31507b);}})[_0xe307('0x2b')](function(_0x43f5e1){if(_0x43f5e1){return db[_0xe307('0x5c')][_0xe307('0x5d')]({'where':{'id':_[_0xe307('0x32')](_0x43f5e1,_0xe307('0x5e')),'role':_0xe307('0x5f')},'attributes':['id',_0xe307('0x31'),_0xe307('0x60'),_0xe307('0x61'),_0xe307('0x62')]});}})[_0xe307('0x2b')](function(_0x5310ff){if(_0x5310ff){return{'count':_0x5310ff[_0xe307('0x21')],'rows':_[_0xe307('0x32')](_0x5310ff[_0xe307('0x48')],function(_0x4f0356){return{'membername':_0x4f0356['name'],'UserId':_0x4f0356['id'],'queue_name':_0x4687f4[_0xe307('0x31')],'WhatsappQueueId':_0x4687f4['id'],'interface':util[_0xe307('0x63')]('%s/%s',_0xe307('0x64'),_0x4f0356[_0xe307('0x31')]),'penalty':0x0,'paused':_0x4f0356[_0xe307('0x60')],'createdAt':_0x4f0356[_0xe307('0x62')],'updatedAt':_0x4f0356['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xe307('0x2b')](respondWithFilteredResult(_0x5dc0ba,_0x31507b))[_0xe307('0x49')](handleError(_0x5dc0ba,null));};exports[_0xe307('0x65')]=function(_0x373c82,_0x8639da,_0x45a59c){var _0x36dedf={};var _0x216765={};var _0x263843;var _0xdaa4d1;return db[_0xe307('0x33')][_0xe307('0x59')]({'where':{'id':_0x373c82[_0xe307('0x4b')]['id']}})[_0xe307('0x2b')](handleEntityNotFound(_0x8639da,null))[_0xe307('0x2b')](function(_0x88c6ba){if(_0x88c6ba){_0x263843=_0x88c6ba;_0x216765[_0xe307('0x37')]=_[_0xe307('0x39')](db['Team'][_0xe307('0x4c')]);_0x216765[_0xe307('0x38')]=_[_0xe307('0x39')](_0x373c82[_0xe307('0x38')]);_0x216765[_0xe307('0x41')]=_[_0xe307('0x3a')](_0x216765[_0xe307('0x37')],_0x216765[_0xe307('0x38')]);_0x36dedf['attributes']=_['intersection'](_0x216765[_0xe307('0x37')],qs[_0xe307('0x3c')](_0x373c82['query']['fields']));_0x36dedf[_0xe307('0x3b')]=_0x36dedf[_0xe307('0x3b')][_0xe307('0x3d')]?_0x36dedf[_0xe307('0x3b')]:_0x216765['model'];_0x36dedf[_0xe307('0x3f')]=qs[_0xe307('0x40')](_0x373c82[_0xe307('0x38')][_0xe307('0x40')]);_0x36dedf['where']=qs['filters'](_[_0xe307('0x42')](_0x373c82[_0xe307('0x38')],_0x216765[_0xe307('0x41')]));if(_0x373c82[_0xe307('0x38')]['filter']){_0x36dedf[_0xe307('0x44')]=_['merge'](_0x36dedf['where'],{'$or':_[_0xe307('0x32')](_0x36dedf[_0xe307('0x3b')],function(_0x52091f){var _0x30407c={};_0x30407c[_0x52091f]={'$like':'%'+_0x373c82[_0xe307('0x38')][_0xe307('0x43')]+'%'};return _0x30407c;})});}_0x36dedf=_[_0xe307('0x45')]({},_0x36dedf,_0x373c82['options']);return _0x263843[_0xe307('0x65')](_0x36dedf);}})['then'](function(_0x4c56dc){if(_0x4c56dc){_0xdaa4d1=_0x4c56dc[_0xe307('0x3d')];if(!_0x373c82[_0xe307('0x38')][_0xe307('0x3e')](_0xe307('0x66'))){_0x36dedf[_0xe307('0x23')]=qs[_0xe307('0x23')](_0x373c82[_0xe307('0x38')][_0xe307('0x23')]);_0x36dedf[_0xe307('0x22')]=qs[_0xe307('0x22')](_0x373c82['query'][_0xe307('0x22')]);}return _0x263843[_0xe307('0x65')](_0x36dedf);}})[_0xe307('0x2b')](function(_0x467737){if(_0x467737){return _0x467737?{'count':_0xdaa4d1,'rows':_0x467737}:null;}})[_0xe307('0x2b')](respondWithResult(_0x8639da,null))[_0xe307('0x49')](handleError(_0x8639da,null));};exports[_0xe307('0x67')]=function(_0x54e7fb,_0x364257,_0x313b0f){var _0x5a8256=_0x54e7fb[_0xe307('0x56')][_0xe307('0x68')];return db['Team'][_0xe307('0x5b')]({'where':{'id':_0x5a8256},'attributes':['id'],'include':[{'model':db[_0xe307('0x5c')],'as':'Agents','attributes':['id','name','online',_0xe307('0x69'),_0xe307('0x6a')],'raw':!![]}]})[_0xe307('0x2b')](function(_0x1eae8e){if(_0x1eae8e){var _0x5e1f76=_[_0xe307('0x6b')](_0x1eae8e,function(_0x2061d6){var _0x2e6c9b=_0x2061d6[_0xe307('0x2c')]({'plain':!![]});return _0x2e6c9b[_0xe307('0x6c')];});return db[_0xe307('0x33')][_0xe307('0x4e')]({'where':{'id':_0x54e7fb[_0xe307('0x4b')]['id']}})['then'](function(_0x54e7ce){return db[_0xe307('0x6d')][_0xe307('0x6e')](function(_0x2125b4){return _0x54e7ce[_0xe307('0x67')](_0x5a8256,{'transaction':_0x2125b4})[_0xe307('0x2b')](function(){return BPromise[_0xe307('0x6f')](_0x5e1f76,function(_0xb370fd){return db[_0xe307('0x70')][_0xe307('0x71')]({'where':{'UserId':_0xb370fd['id'],'WhatsappQueueId':_0x54e7fb['params']['id']},'transaction':_0x2125b4});});})[_0xe307('0x2b')](function(){_0x5e1f76[_0xe307('0x72')](function(_0x321c56){socket['emit'](_0xe307('0x73'),{'UserId':_0x321c56['id'],'WhatsappQueueId':_0x54e7ce['id']});});});});});}})[_0xe307('0x2b')](respondWithStatusCode(_0x364257,null))[_0xe307('0x49')](handleError(_0x364257,null));};exports[_0xe307('0x74')]=function(_0x4d7d25,_0x26eb83,_0x12a00f){return db[_0xe307('0x75')][_0xe307('0x5b')]({'where':{'id':_0x4d7d25['query'][_0xe307('0x68')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xe307('0x6c'),'attributes':['id'],'raw':!![]}]})[_0xe307('0x2b')](handleEntityNotFound(_0x26eb83,null))[_0xe307('0x2b')](function(_0x4a5307){var _0x3971d7=_[_0xe307('0x32')](_0x4a5307,'id');var _0x3d336b=[];var _0x382c03=[];var _0x3c3cdb=squel[_0xe307('0x76')]();_0x3c3cdb[_0xe307('0x77')]('tq.TeamId')['from']('team_has_whatsapp_queues','tq')[_0xe307('0x78')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0xe307('0x44')](_0xe307('0x79'),_0x4d7d25[_0xe307('0x4b')]['id']);for(var _0x349bb5=0x0;_0x349bb5<_0x4a5307[_0xe307('0x3d')];_0x349bb5+=0x1){let _0x35d1db=_0x4a5307[_0x349bb5];for(var _0x7d07ad=0x0;_0x7d07ad<_0x35d1db[_0xe307('0x6c')][_0xe307('0x3d')];_0x7d07ad+=0x1){let _0x6ccd0e=_0x35d1db[_0xe307('0x6c')][_0x7d07ad];var _0x57b444=_0x3c3cdb['clone']();_0x57b444[_0xe307('0x44')](_0xe307('0x7a'),_0x6ccd0e['id']);_0x382c03[_0xe307('0x7b')](db[_0xe307('0x6d')][_0xe307('0x38')](_0x57b444[_0xe307('0x7c')](),{'type':db[_0xe307('0x6d')]['QueryTypes'][_0xe307('0x7d')]})['then'](function(_0x42bb51){if(_0x42bb51[_0xe307('0x3d')]===0x1){return _0x6ccd0e['id'];}else{var _0x54bf3e=_['every'](_[_0xe307('0x32')](_0x42bb51,'TeamId'),function(_0x3f5684){return _['includes'](_0x3971d7,_0x3f5684);});if(_0x54bf3e){return _0x6ccd0e['id'];}}}));}}return BPromise[_0xe307('0x7e')](_0x382c03)['then'](function(_0x1f3b44){_0x3d336b=_(_0x3d336b)['union'](_0x1f3b44)[_0xe307('0x7f')]()['value']();return db[_0xe307('0x33')]['find']({'where':{'id':_0x4d7d25[_0xe307('0x4b')]['id']}})[_0xe307('0x2b')](function(_0x21adeb){return db[_0xe307('0x6d')][_0xe307('0x6e')](function(_0x14950a){return _0x21adeb[_0xe307('0x74')](_0x4d7d25[_0xe307('0x38')]['ids'],{'transaction':_0x14950a})[_0xe307('0x2b')](function(){if(!_['isEmpty'](_0x3d336b)){return _0x21adeb['removeAgents'](_0x3d336b,{'transaction':_0x14950a});}})[_0xe307('0x2b')](function(){_0x3d336b['forEach'](function(_0x298719){socket['emit']('userWhatsappQueue:remove',{'UserId':_0x298719,'WhatsappQueueId':_0x21adeb['id']});});});});});});})[_0xe307('0x2b')](respondWithStatusCode(_0x26eb83,null))[_0xe307('0x49')](handleError(_0x26eb83,null));};exports[_0xe307('0x80')]=function(_0x355cf3,_0x89618a,_0x4d0bce){return db['WhatsappQueue'][_0xe307('0x4e')]({'where':{'id':_0x355cf3[_0xe307('0x4b')]['id']}})['then'](handleEntityNotFound(_0x89618a,null))[_0xe307('0x2b')](function(_0x4bb75d){if(_0x4bb75d){return _0x4bb75d[_0xe307('0x80')](_0x355cf3[_0xe307('0x56')][_0xe307('0x68')],_[_0xe307('0x81')](_0x355cf3[_0xe307('0x56')],[_0xe307('0x68'),'id'])||{})[_0xe307('0x82')](function(_0x1925c5){for(var _0x2344e7=0x0;_0x2344e7<_0x355cf3[_0xe307('0x56')][_0xe307('0x68')][_0xe307('0x3d')];_0x2344e7+=0x1){socket[_0xe307('0x83')](_0xe307('0x73'),{'UserId':Number(_0x355cf3[_0xe307('0x56')][_0xe307('0x68')][_0x2344e7]),'WhatsappQueueId':Number(_0x355cf3[_0xe307('0x4b')]['id'])});}return _0x1925c5;});}})[_0xe307('0x2b')](respondWithResult(_0x89618a,null))[_0xe307('0x49')](handleError(_0x89618a,null));};exports[_0xe307('0x84')]=function(_0x352590,_0x2edf54,_0x57283e){return db[_0xe307('0x33')][_0xe307('0x4e')]({'where':{'id':_0x352590[_0xe307('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2edf54,null))[_0xe307('0x2b')](function(_0x3d3d75){if(_0x3d3d75){return _0x3d3d75[_0xe307('0x84')](_0x352590[_0xe307('0x38')][_0xe307('0x68')])[_0xe307('0x2b')](function(){if(_[_0xe307('0x85')](_0x352590[_0xe307('0x38')][_0xe307('0x68')])){for(var _0x589a39=0x0;_0x589a39<_0x352590[_0xe307('0x38')][_0xe307('0x68')][_0xe307('0x3d')];_0x589a39+=0x1){socket[_0xe307('0x83')](_0xe307('0x86'),{'UserId':Number(_0x352590[_0xe307('0x38')][_0xe307('0x68')][_0x589a39]),'WhatsappQueueId':Number(_0x352590[_0xe307('0x4b')]['id'])});}}else{socket['emit'](_0xe307('0x86'),{'UserId':Number(_0x352590[_0xe307('0x38')][_0xe307('0x68')]),'WhatsappQueueId':Number(_0x352590[_0xe307('0x4b')]['id'])});}});}})[_0xe307('0x2b')](respondWithStatusCode(_0x2edf54,null))[_0xe307('0x49')](handleError(_0x2edf54,null));};exports[_0xe307('0x87')]=function(_0xdcda69,_0x33cf7f,_0x3561ef){var _0x379c4e={};var _0x3593c7={};var _0xd03cf5;var _0x447511;return db[_0xe307('0x33')][_0xe307('0x59')]({'where':{'id':_0xdcda69[_0xe307('0x4b')]['id']}})[_0xe307('0x2b')](handleEntityNotFound(_0x33cf7f,null))['then'](function(_0x5885bc){if(_0x5885bc){_0xd03cf5=_0x5885bc;_0x3593c7[_0xe307('0x37')]=_[_0xe307('0x39')](db[_0xe307('0x5c')][_0xe307('0x4c')]);_0x3593c7['query']=_['keys'](_0xdcda69['query']);_0x3593c7['filters']=_['intersection'](_0x3593c7[_0xe307('0x37')],_0x3593c7['query']);_0x379c4e[_0xe307('0x3b')]=_[_0xe307('0x3a')](_0x3593c7[_0xe307('0x37')],qs[_0xe307('0x3c')](_0xdcda69[_0xe307('0x38')]['fields']));_0x379c4e[_0xe307('0x3b')]=_0x379c4e[_0xe307('0x3b')]['length']?_0x379c4e['attributes']:_0x3593c7['model'];_0x379c4e[_0xe307('0x3f')]=qs[_0xe307('0x40')](_0xdcda69['query'][_0xe307('0x40')]);_0x379c4e[_0xe307('0x44')]=qs[_0xe307('0x41')](_['pick'](_0xdcda69[_0xe307('0x38')],_0x3593c7[_0xe307('0x41')]));if(_0xdcda69['query'][_0xe307('0x43')]){_0x379c4e[_0xe307('0x44')]=_[_0xe307('0x45')](_0x379c4e[_0xe307('0x44')],{'$or':_[_0xe307('0x32')](_0x379c4e[_0xe307('0x3b')],function(_0x6947e9){var _0xd99e4d={};_0xd99e4d[_0x6947e9]={'$like':'%'+_0xdcda69[_0xe307('0x38')][_0xe307('0x43')]+'%'};return _0xd99e4d;})});}_0x379c4e=_[_0xe307('0x45')]({},_0x379c4e,_0xdcda69[_0xe307('0x46')]);return _0xd03cf5[_0xe307('0x87')](_0x379c4e);}})[_0xe307('0x2b')](function(_0x231522){if(_0x231522){_0x447511=_0x231522[_0xe307('0x3d')];if(!_0xdcda69[_0xe307('0x38')]['hasOwnProperty'](_0xe307('0x66'))){_0x379c4e[_0xe307('0x23')]=qs['limit'](_0xdcda69['query'][_0xe307('0x23')]);_0x379c4e['offset']=qs['offset'](_0xdcda69[_0xe307('0x38')][_0xe307('0x22')]);}return _0xd03cf5[_0xe307('0x87')](_0x379c4e);}})[_0xe307('0x2b')](function(_0xc170af){if(_0xc170af){return _0xc170af?{'count':_0x447511,'rows':_0xc170af}:null;}})[_0xe307('0x2b')](respondWithResult(_0x33cf7f,null))['catch'](handleError(_0x33cf7f,null));}; \ No newline at end of file +var _0x48f5=['socket.io-emitter','./whatsappQueue.socket','status','end','offset','limit','undefined','count','json','reject','save','then','get','WhatsappQueues','UserProfileResource','destroy','error','stack','name','send','WhatsappQueue','fieldName','type','key','model','map','query','keys','fields','attributes','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','rawAttributes','intersection','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','describe','findOne','UserWhatsappQueue','nolimit','WhatsappQueueId','User','findAndCountAll','UserId','agent','whatsappPause','updatedAt','createdAt','format','%s/%s','SIP','Team','getTeams','Agents','online','voicePause','interface','flatMap','sequelize','transaction','addTeams','each','findOrCreate','forEach','emit','userWhatsappQueue:save','removeTeams','tq.TeamId','from','team_has_whatsapp_queues','join','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','includes','all','union','value','ids','removeAgents','addAgents','omit','spread','isArray','userWhatsappQueue:remove','getAgents','rimraf','zip-dir','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/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost'];(function(_0x45b034,_0x3a57dd){var _0x509cb0=function(_0x3a89d5){while(--_0x3a89d5){_0x45b034['push'](_0x45b034['shift']());}};_0x509cb0(++_0x3a57dd);}(_0x48f5,0x18c));var _0x548f=function(_0x28b2bf,_0x1ea2f4){_0x28b2bf=_0x28b2bf-0x0;var _0x4fb103=_0x48f5[_0x28b2bf];return _0x4fb103;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x548f('0x0'));var zipdir=require(_0x548f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x548f('0x2'));var moment=require(_0x548f('0x3'));var BPromise=require(_0x548f('0x4'));var Mustache=require(_0x548f('0x5'));var util=require(_0x548f('0x6'));var path=require(_0x548f('0x7'));var sox=require(_0x548f('0x8'));var csv=require('to-csv');var ejs=require(_0x548f('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x548f('0xa'));var squel=require(_0x548f('0xb'));var crypto=require(_0x548f('0xc'));var jsforce=require(_0x548f('0xd'));var deskjs=require(_0x548f('0xe'));var toCsv=require(_0x548f('0xf'));var querystring=require(_0x548f('0x10'));var Papa=require(_0x548f('0x11'));var Redis=require(_0x548f('0x12'));var authService=require(_0x548f('0x13'));var qs=require(_0x548f('0x14'));var as=require(_0x548f('0x15'));var hardwareService=require(_0x548f('0x16'));var logger=require(_0x548f('0x17'))(_0x548f('0x18'));var utils=require(_0x548f('0x19'));var config=require(_0x548f('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x548f('0x1b')]=_[_0x548f('0x1c')](config[_0x548f('0x1b')],{'host':_0x548f('0x1d'),'port':0x18eb});var socket=require(_0x548f('0x1e'))(new Redis(config['redis']));require(_0x548f('0x1f'))['register'](socket);function respondWithStatusCode(_0x5bbc42,_0x3ed5eb){_0x3ed5eb=_0x3ed5eb||0xcc;return function(_0x4dbcd1){if(_0x4dbcd1){return _0x5bbc42['sendStatus'](_0x3ed5eb);}return _0x5bbc42[_0x548f('0x20')](_0x3ed5eb)[_0x548f('0x21')]();};}function respondWithResult(_0x49e203,_0x27b5a9){_0x27b5a9=_0x27b5a9||0xc8;return function(_0x28a50b){if(_0x28a50b){return _0x49e203[_0x548f('0x20')](_0x27b5a9)['json'](_0x28a50b);}};}function respondWithFilteredResult(_0x293d1b,_0x376add){return function(_0x3b04fa){if(_0x3b04fa){var _0x2cb5ad=typeof _0x376add[_0x548f('0x22')]==='undefined'&&typeof _0x376add[_0x548f('0x23')]===_0x548f('0x24');var _0x43c23d=_0x3b04fa['count'];var _0x10c2d0=_0x2cb5ad?0x0:_0x376add['offset'];var _0x4105df=_0x2cb5ad?_0x3b04fa[_0x548f('0x25')]:_0x376add[_0x548f('0x22')]+_0x376add[_0x548f('0x23')];var _0x20e703;if(_0x4105df>=_0x43c23d){_0x4105df=_0x43c23d;_0x20e703=0xc8;}else{_0x20e703=0xce;}_0x293d1b[_0x548f('0x20')](_0x20e703);return _0x293d1b['set']('Content-Range',_0x10c2d0+'-'+_0x4105df+'/'+_0x43c23d)[_0x548f('0x26')](_0x3b04fa);}return null;};}function patchUpdates(_0x1814a4){return function(_0x1af891){try{jsonpatch['apply'](_0x1af891,_0x1814a4,!![]);}catch(_0x51dd2f){return BPromise[_0x548f('0x27')](_0x51dd2f);}return _0x1af891[_0x548f('0x28')]();};}function saveUpdates(_0xa4a55c,_0x4f98a3){return function(_0xf5b29d){if(_0xf5b29d){return _0xf5b29d['update'](_0xa4a55c)[_0x548f('0x29')](function(_0x57e489){return _0x57e489;});}return null;};}function removeEntity(_0x1e8bc8,_0x354aae){return function(_0x253e3e){if(_0x253e3e){return _0x253e3e['destroy']()['then'](function(){var _0x50e4a4=_0x253e3e[_0x548f('0x2a')]({'plain':!![]});var _0xeb89ca=_0x548f('0x2b');return db[_0x548f('0x2c')][_0x548f('0x2d')]({'where':{'type':_0xeb89ca,'resourceId':_0x50e4a4['id']}})[_0x548f('0x29')](function(){return _0x253e3e;});})[_0x548f('0x29')](function(){_0x1e8bc8[_0x548f('0x20')](0xcc)[_0x548f('0x21')]();});}};}function handleEntityNotFound(_0x540a80,_0x2e2945){return function(_0x18ba1c){if(!_0x18ba1c){_0x540a80['sendStatus'](0x194);}return _0x18ba1c;};}function handleError(_0x30f446,_0x5f473e){_0x5f473e=_0x5f473e||0x1f4;return function(_0x3269af){logger[_0x548f('0x2e')](_0x3269af[_0x548f('0x2f')]);if(_0x3269af[_0x548f('0x30')]){delete _0x3269af['name'];}_0x30f446[_0x548f('0x20')](_0x5f473e)[_0x548f('0x31')](_0x3269af);};}exports['index']=function(_0xbbc579,_0x224a4c){var _0x5930eb={},_0x28121b={},_0x13e68a={'count':0x0,'rows':[]};var _0x5aa4e4=_['map'](db[_0x548f('0x32')]['rawAttributes'],function(_0x4ba9ba){return{'name':_0x4ba9ba[_0x548f('0x33')],'type':_0x4ba9ba[_0x548f('0x34')][_0x548f('0x35')]};});_0x28121b[_0x548f('0x36')]=_[_0x548f('0x37')](_0x5aa4e4,_0x548f('0x30'));_0x28121b[_0x548f('0x38')]=_[_0x548f('0x39')](_0xbbc579['query']);_0x28121b['filters']=_['intersection'](_0x28121b[_0x548f('0x36')],_0x28121b['query']);_0x5930eb['attributes']=_['intersection'](_0x28121b[_0x548f('0x36')],qs[_0x548f('0x3a')](_0xbbc579[_0x548f('0x38')][_0x548f('0x3a')]));_0x5930eb[_0x548f('0x3b')]=_0x5930eb['attributes']['length']?_0x5930eb[_0x548f('0x3b')]:_0x28121b[_0x548f('0x36')];if(!_0xbbc579[_0x548f('0x38')][_0x548f('0x3c')]('nolimit')){_0x5930eb[_0x548f('0x23')]=qs[_0x548f('0x23')](_0xbbc579[_0x548f('0x38')][_0x548f('0x23')]);_0x5930eb[_0x548f('0x22')]=qs[_0x548f('0x22')](_0xbbc579[_0x548f('0x38')][_0x548f('0x22')]);}_0x5930eb[_0x548f('0x3d')]=qs['sort'](_0xbbc579[_0x548f('0x38')][_0x548f('0x3e')]);_0x5930eb[_0x548f('0x3f')]=qs[_0x548f('0x40')](_[_0x548f('0x41')](_0xbbc579[_0x548f('0x38')],_0x28121b[_0x548f('0x40')]),_0x5aa4e4);if(_0xbbc579[_0x548f('0x38')][_0x548f('0x42')]){_0x5930eb[_0x548f('0x3f')]=_[_0x548f('0x43')](_0x5930eb[_0x548f('0x3f')],{'$or':_[_0x548f('0x37')](_0x5aa4e4,function(_0x1e46af){if(_0x1e46af[_0x548f('0x34')]!==_0x548f('0x44')){var _0x458818={};_0x458818[_0x1e46af['name']]={'$like':'%'+_0xbbc579['query'][_0x548f('0x42')]+'%'};return _0x458818;}})});}_0x5930eb=_[_0x548f('0x43')]({},_0x5930eb,_0xbbc579[_0x548f('0x45')]);var _0x1e452e={'where':_0x5930eb[_0x548f('0x3f')]};return db[_0x548f('0x32')][_0x548f('0x25')](_0x1e452e)[_0x548f('0x29')](function(_0x1724ba){_0x13e68a[_0x548f('0x25')]=_0x1724ba;if(_0xbbc579[_0x548f('0x38')][_0x548f('0x46')]){_0x5930eb[_0x548f('0x47')]=[{'all':!![]}];}return db[_0x548f('0x32')][_0x548f('0x48')](_0x5930eb);})[_0x548f('0x29')](function(_0x1dad42){_0x13e68a[_0x548f('0x49')]=_0x1dad42;return _0x13e68a;})[_0x548f('0x29')](respondWithFilteredResult(_0x224a4c,_0x5930eb))[_0x548f('0x4a')](handleError(_0x224a4c,null));};exports[_0x548f('0x4b')]=function(_0x13ad3b,_0x327805){var _0x2ef592={'raw':!![],'where':{'id':_0x13ad3b['params']['id']}},_0x5cf992={};_0x5cf992[_0x548f('0x36')]=_['keys'](db[_0x548f('0x32')][_0x548f('0x4c')]);_0x5cf992[_0x548f('0x38')]=_[_0x548f('0x39')](_0x13ad3b[_0x548f('0x38')]);_0x5cf992[_0x548f('0x40')]=_[_0x548f('0x4d')](_0x5cf992['model'],_0x5cf992[_0x548f('0x38')]);_0x2ef592[_0x548f('0x3b')]=_['intersection'](_0x5cf992[_0x548f('0x36')],qs[_0x548f('0x3a')](_0x13ad3b[_0x548f('0x38')][_0x548f('0x3a')]));_0x2ef592['attributes']=_0x2ef592[_0x548f('0x3b')][_0x548f('0x4e')]?_0x2ef592[_0x548f('0x3b')]:_0x5cf992[_0x548f('0x36')];if(_0x13ad3b[_0x548f('0x38')][_0x548f('0x46')]){_0x2ef592[_0x548f('0x47')]=[{'all':!![]}];}_0x2ef592=_[_0x548f('0x43')]({},_0x2ef592,_0x13ad3b['options']);return db['WhatsappQueue'][_0x548f('0x4f')](_0x2ef592)[_0x548f('0x29')](handleEntityNotFound(_0x327805,null))['then'](respondWithResult(_0x327805,null))[_0x548f('0x4a')](handleError(_0x327805,null));};exports[_0x548f('0x50')]=function(_0x27a283,_0x3bc41b){return db[_0x548f('0x32')][_0x548f('0x50')](_0x27a283[_0x548f('0x51')],{})[_0x548f('0x29')](function(_0x47a2e4){var _0x5ea091=_0x27a283[_0x548f('0x52')]['get']({'plain':!![]});if(!_0x5ea091)throw new Error(_0x548f('0x53'));if(_0x5ea091[_0x548f('0x54')]===_0x548f('0x52')){var _0x2a41a4=_0x47a2e4['get']({'plain':!![]});var _0x11b5e5=_0x548f('0x2b');return db['UserProfileSection']['find']({'where':{'name':_0x11b5e5,'userProfileId':_0x5ea091['userProfileId']},'raw':!![]})[_0x548f('0x29')](function(_0x1682db){if(_0x1682db&&_0x1682db['autoAssociation']===0x0){return db['UserProfileResource'][_0x548f('0x50')]({'name':_0x2a41a4['name'],'resourceId':_0x2a41a4['id'],'type':_0x1682db[_0x548f('0x30')],'sectionId':_0x1682db['id']},{})[_0x548f('0x29')](function(){return _0x47a2e4;});}else{return _0x47a2e4;}})['catch'](function(_0x4ab98d){logger[_0x548f('0x2e')](_0x548f('0x55'),_0x4ab98d);throw _0x4ab98d;});}return _0x47a2e4;})[_0x548f('0x29')](respondWithResult(_0x3bc41b,0xc9))[_0x548f('0x4a')](handleError(_0x3bc41b,null));};exports[_0x548f('0x56')]=function(_0x1c898a,_0x22e8cb){if(_0x1c898a[_0x548f('0x51')]['id']){delete _0x1c898a[_0x548f('0x51')]['id'];}return db[_0x548f('0x32')][_0x548f('0x4f')]({'where':{'id':_0x1c898a[_0x548f('0x57')]['id']}})['then'](handleEntityNotFound(_0x22e8cb,null))[_0x548f('0x29')](saveUpdates(_0x1c898a['body'],null))[_0x548f('0x29')](respondWithResult(_0x22e8cb,null))['catch'](handleError(_0x22e8cb,null));};exports[_0x548f('0x2d')]=function(_0x3c04a2,_0x494186){return db[_0x548f('0x32')][_0x548f('0x4f')]({'where':{'id':_0x3c04a2[_0x548f('0x57')]['id']}})[_0x548f('0x29')](handleEntityNotFound(_0x494186,null))[_0x548f('0x29')](removeEntity(_0x494186,null))[_0x548f('0x4a')](handleError(_0x494186,null));};exports[_0x548f('0x58')]=function(_0x373f56,_0x3e8b47){return db[_0x548f('0x32')][_0x548f('0x58')]()['then'](respondWithResult(_0x3e8b47,null))[_0x548f('0x4a')](handleError(_0x3e8b47,null));};exports['getMembers']=function(_0x515b49,_0x45c1fe,_0x4bf21f){var _0x12add9={'raw':!![],'where':{}},_0x545547={},_0x7d19b7;return db[_0x548f('0x32')][_0x548f('0x59')]({'where':{'id':_0x515b49[_0x548f('0x57')]['id']}})[_0x548f('0x29')](handleEntityNotFound(_0x45c1fe,null))[_0x548f('0x29')](function(_0x14dea9){if(_0x14dea9){_0x7d19b7=_0x14dea9['get']({'plain':!![]});_0x545547[_0x548f('0x36')]=_[_0x548f('0x39')](db[_0x548f('0x5a')][_0x548f('0x4c')]);_0x545547[_0x548f('0x38')]=_[_0x548f('0x39')](_0x515b49['query']);_0x545547[_0x548f('0x40')]=_[_0x548f('0x4d')](_0x545547[_0x548f('0x36')],_0x545547[_0x548f('0x38')]);_0x12add9[_0x548f('0x3b')]=_[_0x548f('0x4d')](_0x545547['model'],qs['fields'](_0x515b49['query']['fields']));_0x12add9[_0x548f('0x3b')]=_0x12add9['attributes'][_0x548f('0x4e')]?_0x12add9['attributes']:_0x545547[_0x548f('0x36')];if(!_0x515b49[_0x548f('0x38')][_0x548f('0x3c')](_0x548f('0x5b'))){_0x12add9[_0x548f('0x23')]=qs[_0x548f('0x23')](_0x515b49[_0x548f('0x38')]['limit']);_0x12add9[_0x548f('0x22')]=qs['offset'](_0x515b49[_0x548f('0x38')][_0x548f('0x22')]);}_0x12add9[_0x548f('0x3d')]=qs[_0x548f('0x3e')](_0x515b49['query'][_0x548f('0x3e')]);_0x12add9['where']=qs[_0x548f('0x40')](_['pick'](_0x515b49[_0x548f('0x38')],_0x545547[_0x548f('0x40')]));_0x12add9[_0x548f('0x3f')][_0x548f('0x5c')]=_0x14dea9['id'];if(_0x515b49[_0x548f('0x38')][_0x548f('0x42')]){_0x12add9[_0x548f('0x3f')]=_[_0x548f('0x43')](_0x12add9['where'],{'$or':_[_0x548f('0x37')](_0x12add9[_0x548f('0x3b')],function(_0x2f2c5){var _0x29ed72={};_0x29ed72[_0x2f2c5]={'$like':'%'+_0x515b49[_0x548f('0x38')][_0x548f('0x42')]+'%'};return _0x29ed72;})});}_0x12add9=_[_0x548f('0x43')]({},_0x12add9,_0x515b49[_0x548f('0x45')]);return db[_0x548f('0x5a')][_0x548f('0x48')](_0x12add9);}})['then'](function(_0x3d998c){if(_0x3d998c){return db[_0x548f('0x5d')][_0x548f('0x5e')]({'where':{'id':_['map'](_0x3d998c,_0x548f('0x5f')),'role':_0x548f('0x60')},'attributes':['id',_0x548f('0x30'),_0x548f('0x61'),_0x548f('0x62'),_0x548f('0x63')]});}})['then'](function(_0x64167b){if(_0x64167b){return{'count':_0x64167b[_0x548f('0x25')],'rows':_[_0x548f('0x37')](_0x64167b[_0x548f('0x49')],function(_0x2e1e11){return{'membername':_0x2e1e11['name'],'UserId':_0x2e1e11['id'],'queue_name':_0x7d19b7[_0x548f('0x30')],'WhatsappQueueId':_0x7d19b7['id'],'interface':util[_0x548f('0x64')](_0x548f('0x65'),_0x548f('0x66'),_0x2e1e11['name']),'penalty':0x0,'paused':_0x2e1e11[_0x548f('0x61')],'createdAt':_0x2e1e11[_0x548f('0x63')],'updatedAt':_0x2e1e11[_0x548f('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x45c1fe,_0x12add9))[_0x548f('0x4a')](handleError(_0x45c1fe,null));};exports['getTeams']=function(_0x1c7047,_0x495506,_0x278ada){var _0x38a05b={};var _0x51bbe0={};var _0x28d899;var _0x1bf8a1;return db['WhatsappQueue'][_0x548f('0x59')]({'where':{'id':_0x1c7047['params']['id']}})[_0x548f('0x29')](handleEntityNotFound(_0x495506,null))[_0x548f('0x29')](function(_0x5d7f2b){if(_0x5d7f2b){_0x28d899=_0x5d7f2b;_0x51bbe0[_0x548f('0x36')]=_['keys'](db[_0x548f('0x67')]['rawAttributes']);_0x51bbe0[_0x548f('0x38')]=_[_0x548f('0x39')](_0x1c7047[_0x548f('0x38')]);_0x51bbe0[_0x548f('0x40')]=_[_0x548f('0x4d')](_0x51bbe0[_0x548f('0x36')],_0x51bbe0[_0x548f('0x38')]);_0x38a05b['attributes']=_['intersection'](_0x51bbe0[_0x548f('0x36')],qs[_0x548f('0x3a')](_0x1c7047[_0x548f('0x38')]['fields']));_0x38a05b['attributes']=_0x38a05b['attributes'][_0x548f('0x4e')]?_0x38a05b[_0x548f('0x3b')]:_0x51bbe0[_0x548f('0x36')];_0x38a05b['order']=qs['sort'](_0x1c7047[_0x548f('0x38')][_0x548f('0x3e')]);_0x38a05b[_0x548f('0x3f')]=qs[_0x548f('0x40')](_[_0x548f('0x41')](_0x1c7047['query'],_0x51bbe0[_0x548f('0x40')]));if(_0x1c7047[_0x548f('0x38')][_0x548f('0x42')]){_0x38a05b['where']=_[_0x548f('0x43')](_0x38a05b['where'],{'$or':_[_0x548f('0x37')](_0x38a05b[_0x548f('0x3b')],function(_0x45c6ae){var _0x4e10c9={};_0x4e10c9[_0x45c6ae]={'$like':'%'+_0x1c7047[_0x548f('0x38')]['filter']+'%'};return _0x4e10c9;})});}_0x38a05b=_['merge']({},_0x38a05b,_0x1c7047[_0x548f('0x45')]);return _0x28d899[_0x548f('0x68')](_0x38a05b);}})[_0x548f('0x29')](function(_0x2b4445){if(_0x2b4445){_0x1bf8a1=_0x2b4445['length'];if(!_0x1c7047[_0x548f('0x38')][_0x548f('0x3c')](_0x548f('0x5b'))){_0x38a05b['limit']=qs['limit'](_0x1c7047['query'][_0x548f('0x23')]);_0x38a05b[_0x548f('0x22')]=qs[_0x548f('0x22')](_0x1c7047[_0x548f('0x38')][_0x548f('0x22')]);}return _0x28d899[_0x548f('0x68')](_0x38a05b);}})['then'](function(_0x27a25f){if(_0x27a25f){return _0x27a25f?{'count':_0x1bf8a1,'rows':_0x27a25f}:null;}})['then'](respondWithResult(_0x495506,null))[_0x548f('0x4a')](handleError(_0x495506,null));};exports['addTeams']=function(_0x1737f4,_0x4187a3,_0x3e18f3){var _0x44bc6c=_0x1737f4[_0x548f('0x51')]['ids'];return db[_0x548f('0x67')][_0x548f('0x48')]({'where':{'id':_0x44bc6c},'attributes':['id'],'include':[{'model':db[_0x548f('0x5d')],'as':_0x548f('0x69'),'attributes':['id',_0x548f('0x30'),_0x548f('0x6a'),_0x548f('0x6b'),_0x548f('0x6c')],'raw':!![]}]})[_0x548f('0x29')](function(_0x4f119e){if(_0x4f119e){var _0x507751=_[_0x548f('0x6d')](_0x4f119e,function(_0x296a45){var _0xed0fdb=_0x296a45['get']({'plain':!![]});return _0xed0fdb['Agents'];});return db[_0x548f('0x32')][_0x548f('0x4f')]({'where':{'id':_0x1737f4[_0x548f('0x57')]['id']}})['then'](function(_0x3d94ba){return db[_0x548f('0x6e')][_0x548f('0x6f')](function(_0x3cee92){return _0x3d94ba[_0x548f('0x70')](_0x44bc6c,{'transaction':_0x3cee92})['then'](function(){return BPromise[_0x548f('0x71')](_0x507751,function(_0xe77b20){return db['UserWhatsappQueue'][_0x548f('0x72')]({'where':{'UserId':_0xe77b20['id'],'WhatsappQueueId':_0x1737f4[_0x548f('0x57')]['id']},'transaction':_0x3cee92});});})[_0x548f('0x29')](function(){_0x507751[_0x548f('0x73')](function(_0x32fd27){socket[_0x548f('0x74')](_0x548f('0x75'),{'UserId':_0x32fd27['id'],'WhatsappQueueId':_0x3d94ba['id']});});});});});}})[_0x548f('0x29')](respondWithStatusCode(_0x4187a3,null))[_0x548f('0x4a')](handleError(_0x4187a3,null));};exports[_0x548f('0x76')]=function(_0x5a8b3c,_0x2cc3b0,_0x5dbe7d){return db[_0x548f('0x67')][_0x548f('0x48')]({'where':{'id':_0x5a8b3c['query']['ids']},'attributes':['id'],'include':[{'model':db[_0x548f('0x5d')],'as':_0x548f('0x69'),'attributes':['id'],'raw':!![]}]})[_0x548f('0x29')](handleEntityNotFound(_0x2cc3b0,null))['then'](function(_0x146fb6){var _0x573462=_[_0x548f('0x37')](_0x146fb6,'id');var _0x2d3271=[];var _0xf5f340=[];var _0x1e60b9=squel['select']();_0x1e60b9['field'](_0x548f('0x77'))[_0x548f('0x78')](_0x548f('0x79'),'tq')[_0x548f('0x7a')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0x548f('0x3f')](_0x548f('0x7b'),_0x5a8b3c[_0x548f('0x57')]['id']);for(var _0x426706=0x0;_0x426706<_0x146fb6['length'];_0x426706+=0x1){let _0x340b9d=_0x146fb6[_0x426706];for(var _0xc1c30e=0x0;_0xc1c30e<_0x340b9d[_0x548f('0x69')]['length'];_0xc1c30e+=0x1){let _0x800161=_0x340b9d[_0x548f('0x69')][_0xc1c30e];var _0x4dc707=_0x1e60b9[_0x548f('0x7c')]();_0x4dc707[_0x548f('0x3f')](_0x548f('0x7d'),_0x800161['id']);_0xf5f340['push'](db[_0x548f('0x6e')][_0x548f('0x38')](_0x4dc707[_0x548f('0x7e')](),{'type':db[_0x548f('0x6e')][_0x548f('0x7f')][_0x548f('0x80')]})[_0x548f('0x29')](function(_0x480c9c){if(_0x480c9c['length']===0x1){return _0x800161['id'];}else{var _0x3c1e82=_[_0x548f('0x81')](_[_0x548f('0x37')](_0x480c9c,'TeamId'),function(_0x4bdac2){return _[_0x548f('0x82')](_0x573462,_0x4bdac2);});if(_0x3c1e82){return _0x800161['id'];}}}));}}return BPromise[_0x548f('0x83')](_0xf5f340)[_0x548f('0x29')](function(_0x2f09df){_0x2d3271=_(_0x2d3271)[_0x548f('0x84')](_0x2f09df)['compact']()[_0x548f('0x85')]();return db['WhatsappQueue'][_0x548f('0x4f')]({'where':{'id':_0x5a8b3c[_0x548f('0x57')]['id']}})[_0x548f('0x29')](function(_0x44935e){return db[_0x548f('0x6e')][_0x548f('0x6f')](function(_0x532a36){return _0x44935e[_0x548f('0x76')](_0x5a8b3c[_0x548f('0x38')][_0x548f('0x86')],{'transaction':_0x532a36})[_0x548f('0x29')](function(){if(!_['isEmpty'](_0x2d3271)){return _0x44935e[_0x548f('0x87')](_0x2d3271,{'transaction':_0x532a36});}})[_0x548f('0x29')](function(){_0x2d3271[_0x548f('0x73')](function(_0x519497){socket[_0x548f('0x74')]('userWhatsappQueue:remove',{'UserId':_0x519497,'WhatsappQueueId':_0x44935e['id']});});});});});});})[_0x548f('0x29')](respondWithStatusCode(_0x2cc3b0,null))[_0x548f('0x4a')](handleError(_0x2cc3b0,null));};exports['addAgents']=function(_0x17c9ce,_0x45debb,_0x1269fc){return db[_0x548f('0x32')][_0x548f('0x4f')]({'where':{'id':_0x17c9ce[_0x548f('0x57')]['id']}})[_0x548f('0x29')](handleEntityNotFound(_0x45debb,null))['then'](function(_0x4bbc2a){if(_0x4bbc2a){return _0x4bbc2a[_0x548f('0x88')](_0x17c9ce[_0x548f('0x51')][_0x548f('0x86')],_[_0x548f('0x89')](_0x17c9ce['body'],['ids','id'])||{})[_0x548f('0x8a')](function(_0x1c1d32){for(var _0x1ca447=0x0;_0x1ca447<_0x17c9ce[_0x548f('0x51')][_0x548f('0x86')][_0x548f('0x4e')];_0x1ca447+=0x1){socket[_0x548f('0x74')]('userWhatsappQueue:save',{'UserId':Number(_0x17c9ce['body'][_0x548f('0x86')][_0x1ca447]),'WhatsappQueueId':Number(_0x17c9ce['params']['id'])});}return _0x1c1d32;});}})[_0x548f('0x29')](respondWithResult(_0x45debb,null))[_0x548f('0x4a')](handleError(_0x45debb,null));};exports[_0x548f('0x87')]=function(_0x2bdefb,_0x3453b0,_0x576035){return db['WhatsappQueue'][_0x548f('0x4f')]({'where':{'id':_0x2bdefb[_0x548f('0x57')]['id']}})[_0x548f('0x29')](handleEntityNotFound(_0x3453b0,null))[_0x548f('0x29')](function(_0xe70472){if(_0xe70472){return _0xe70472[_0x548f('0x87')](_0x2bdefb['query']['ids'])[_0x548f('0x29')](function(){if(_[_0x548f('0x8b')](_0x2bdefb['query'][_0x548f('0x86')])){for(var _0x1e907a=0x0;_0x1e907a<_0x2bdefb['query']['ids'][_0x548f('0x4e')];_0x1e907a+=0x1){socket[_0x548f('0x74')]('userWhatsappQueue:remove',{'UserId':Number(_0x2bdefb[_0x548f('0x38')][_0x548f('0x86')][_0x1e907a]),'WhatsappQueueId':Number(_0x2bdefb[_0x548f('0x57')]['id'])});}}else{socket[_0x548f('0x74')](_0x548f('0x8c'),{'UserId':Number(_0x2bdefb[_0x548f('0x38')][_0x548f('0x86')]),'WhatsappQueueId':Number(_0x2bdefb[_0x548f('0x57')]['id'])});}});}})[_0x548f('0x29')](respondWithStatusCode(_0x3453b0,null))[_0x548f('0x4a')](handleError(_0x3453b0,null));};exports[_0x548f('0x8d')]=function(_0x2aeaab,_0x527d34,_0x3e0044){var _0x3170d9={};var _0x3202c8={};var _0x2c6b8a;var _0x37ecad;return db[_0x548f('0x32')][_0x548f('0x59')]({'where':{'id':_0x2aeaab[_0x548f('0x57')]['id']}})[_0x548f('0x29')](handleEntityNotFound(_0x527d34,null))['then'](function(_0x45b194){if(_0x45b194){_0x2c6b8a=_0x45b194;_0x3202c8['model']=_[_0x548f('0x39')](db[_0x548f('0x5d')][_0x548f('0x4c')]);_0x3202c8[_0x548f('0x38')]=_[_0x548f('0x39')](_0x2aeaab[_0x548f('0x38')]);_0x3202c8[_0x548f('0x40')]=_[_0x548f('0x4d')](_0x3202c8[_0x548f('0x36')],_0x3202c8['query']);_0x3170d9[_0x548f('0x3b')]=_[_0x548f('0x4d')](_0x3202c8['model'],qs[_0x548f('0x3a')](_0x2aeaab[_0x548f('0x38')][_0x548f('0x3a')]));_0x3170d9[_0x548f('0x3b')]=_0x3170d9[_0x548f('0x3b')][_0x548f('0x4e')]?_0x3170d9[_0x548f('0x3b')]:_0x3202c8['model'];_0x3170d9[_0x548f('0x3d')]=qs[_0x548f('0x3e')](_0x2aeaab[_0x548f('0x38')][_0x548f('0x3e')]);_0x3170d9[_0x548f('0x3f')]=qs[_0x548f('0x40')](_[_0x548f('0x41')](_0x2aeaab[_0x548f('0x38')],_0x3202c8[_0x548f('0x40')]));if(_0x2aeaab[_0x548f('0x38')][_0x548f('0x42')]){_0x3170d9[_0x548f('0x3f')]=_[_0x548f('0x43')](_0x3170d9[_0x548f('0x3f')],{'$or':_['map'](_0x3170d9[_0x548f('0x3b')],function(_0x27f8d3){var _0x1b212e={};_0x1b212e[_0x27f8d3]={'$like':'%'+_0x2aeaab['query'][_0x548f('0x42')]+'%'};return _0x1b212e;})});}_0x3170d9=_[_0x548f('0x43')]({},_0x3170d9,_0x2aeaab[_0x548f('0x45')]);return _0x2c6b8a[_0x548f('0x8d')](_0x3170d9);}})['then'](function(_0x1073f7){if(_0x1073f7){_0x37ecad=_0x1073f7[_0x548f('0x4e')];if(!_0x2aeaab[_0x548f('0x38')][_0x548f('0x3c')](_0x548f('0x5b'))){_0x3170d9[_0x548f('0x23')]=qs[_0x548f('0x23')](_0x2aeaab[_0x548f('0x38')][_0x548f('0x23')]);_0x3170d9[_0x548f('0x22')]=qs[_0x548f('0x22')](_0x2aeaab['query'][_0x548f('0x22')]);}return _0x2c6b8a[_0x548f('0x8d')](_0x3170d9);}})[_0x548f('0x29')](function(_0xc9835e){if(_0xc9835e){return _0xc9835e?{'count':_0x37ecad,'rows':_0xc9835e}:null;}})[_0x548f('0x29')](respondWithResult(_0x527d34,null))['catch'](handleError(_0x527d34,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 42ca789..e446ff7 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 _0x6117=['../../mysqldb','WhatsappQueue','setMaxListeners','update','remove','emit','hasOwnProperty','exports'];(function(_0x49030c,_0x4f7165){var _0x5004bf=function(_0x33b7a5){while(--_0x33b7a5){_0x49030c['push'](_0x49030c['shift']());}};_0x5004bf(++_0x4f7165);}(_0x6117,0x190));var _0x7611=function(_0x6d77ec,_0x338e01){_0x6d77ec=_0x6d77ec-0x0;var _0x567ac6=_0x6117[_0x6d77ec];return _0x567ac6;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require(_0x7611('0x0'))['db'][_0x7611('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x7611('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7611('0x3'),'afterDestroy':_0x7611('0x4')};function emitEvent(_0x2be6c5){return function(_0x248dfd,_0x1effab,_0x3cfd7b){WhatsappQueueEvents[_0x7611('0x5')](_0x2be6c5+':'+_0x248dfd['id'],_0x248dfd);WhatsappQueueEvents[_0x7611('0x5')](_0x2be6c5,_0x248dfd);_0x3cfd7b(null);};}for(var e in events){if(events[_0x7611('0x6')](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module[_0x7611('0x7')]=WhatsappQueueEvents; \ No newline at end of file +var _0xe024=['emit','hook','exports','events','WhatsappQueue','setMaxListeners','save','update','remove'];(function(_0xea9508,_0x53e844){var _0x5d426e=function(_0x11ef98){while(--_0x11ef98){_0xea9508['push'](_0xea9508['shift']());}};_0x5d426e(++_0x53e844);}(_0xe024,0x78));var _0x4e02=function(_0x1fcaf1,_0x21c3c2){_0x1fcaf1=_0x1fcaf1-0x0;var _0x55f464=_0xe024[_0x1fcaf1];return _0x55f464;};'use strict';var EventEmitter=require(_0x4e02('0x0'));var WhatsappQueue=require('../../mysqldb')['db'][_0x4e02('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x4e02('0x2')](0x0);var events={'afterCreate':_0x4e02('0x3'),'afterUpdate':_0x4e02('0x4'),'afterDestroy':_0x4e02('0x5')};function emitEvent(_0x5992e1){return function(_0x14f694,_0x158f08,_0x3b34cb){WhatsappQueueEvents[_0x4e02('0x6')](_0x5992e1+':'+_0x14f694['id'],_0x14f694);WhatsappQueueEvents['emit'](_0x5992e1,_0x14f694);_0x3b34cb(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue[_0x4e02('0x7')](e,emitEvent(event));}}module[_0x4e02('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 72bfcce..6c496bc 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 _0xca31=['path','rimraf','exports','define','WhatsappQueue','whatsapp_queues','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xca31,0xae));var _0x1ca3=function(_0x168b64,_0x3bd2a8){_0x168b64=_0x168b64-0x0;var _0x298845=_0xca31[_0x168b64];return _0x298845;};'use strict';var _=require(_0x1ca3('0x0'));var util=require('util');var logger=require(_0x1ca3('0x1'))(_0x1ca3('0x2'));var moment=require(_0x1ca3('0x3'));var BPromise=require(_0x1ca3('0x4'));var rp=require(_0x1ca3('0x5'));var fs=require('fs');var path=require(_0x1ca3('0x6'));var rimraf=require(_0x1ca3('0x7'));var config=require('../../config/environment');var attributes=require('./whatsappQueue.attributes');module[_0x1ca3('0x8')]=function(_0x1f35b8,_0x120b2b){return _0x1f35b8[_0x1ca3('0x9')](_0x1ca3('0xa'),attributes,{'tableName':_0x1ca3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdd30=['../../config/environment','./whatsappQueue.attributes','exports','define','WhatsappQueue','util','../../config/logger','api','bluebird','request-promise','rimraf'];(function(_0x295314,_0x17b250){var _0x584b0c=function(_0x51cc84){while(--_0x51cc84){_0x295314['push'](_0x295314['shift']());}};_0x584b0c(++_0x17b250);}(_0xdd30,0x1b2));var _0x0dd3=function(_0x1a1dd7,_0x9e586a){_0x1a1dd7=_0x1a1dd7-0x0;var _0x5e5ac6=_0xdd30[_0x1a1dd7];return _0x5e5ac6;};'use strict';var _=require('lodash');var util=require(_0x0dd3('0x0'));var logger=require(_0x0dd3('0x1'))(_0x0dd3('0x2'));var moment=require('moment');var BPromise=require(_0x0dd3('0x3'));var rp=require(_0x0dd3('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0dd3('0x5'));var config=require(_0x0dd3('0x6'));var attributes=require(_0x0dd3('0x7'));module[_0x0dd3('0x8')]=function(_0x58b8c4,_0x43a95d){return _0x58b8c4[_0x0dd3('0x9')](_0x0dd3('0xa'),attributes,{'tableName':'whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.rpc.js b/server/api/whatsappQueue/whatsappQueue.rpc.js index f866492..a5738e8 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 _0xcd3b=['map','model','GetWhatsappQueue','stringify','ShowWhatsappQueue','find','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','redis','defaults','socket.io-emitter','./whatsappQueue.socket','register','request','then','info','WhatsappQueue,\x20%s,\x20%s','debug','request\x20sent','error','code','message','catch','findAll','options','raw','where','attributes','limit','include'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0xcd3b,0x1ce));var _0xbcd3=function(_0x4b68a0,_0x3c1f59){_0x4b68a0=_0x4b68a0-0x0;var _0x4c10d2=_0xcd3b[_0x4b68a0];return _0x4c10d2;};'use strict';var _=require(_0xbcd3('0x0'));var util=require(_0xbcd3('0x1'));var moment=require('moment');var BPromise=require(_0xbcd3('0x2'));var rs=require(_0xbcd3('0x3'));var fs=require('fs');var Redis=require(_0xbcd3('0x4'));var db=require(_0xbcd3('0x5'))['db'];var utils=require(_0xbcd3('0x6'));var logger=require(_0xbcd3('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xbcd3('0x8'));var client=jayson['client'][_0xbcd3('0x9')]({'port':0x232a});config[_0xbcd3('0xa')]=_[_0xbcd3('0xb')](config[_0xbcd3('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xbcd3('0xc'))(new Redis(config['redis']));require(_0xbcd3('0xd'))[_0xbcd3('0xe')](socket);function respondWithRpcPromise(_0x1d1d24,_0x5bf1bb,_0x4f29f7){return new BPromise(function(_0x1f165e,_0x3e9e98){return client[_0xbcd3('0xf')](_0x1d1d24,_0x4f29f7)[_0xbcd3('0x10')](function(_0x1e065c){logger[_0xbcd3('0x11')](_0xbcd3('0x12'),_0x5bf1bb,'request\x20sent');logger[_0xbcd3('0x13')]('WhatsappQueue,\x20%s,\x20%s,\x20%s',_0x5bf1bb,_0xbcd3('0x14'),JSON['stringify'](_0x1e065c));if(_0x1e065c[_0xbcd3('0x15')]){if(_0x1e065c[_0xbcd3('0x15')][_0xbcd3('0x16')]===0x1f4){logger[_0xbcd3('0x15')]('WhatsappQueue,\x20%s,\x20%s',_0x5bf1bb,_0x1e065c[_0xbcd3('0x15')][_0xbcd3('0x17')]);return _0x3e9e98(_0x1e065c['error'][_0xbcd3('0x17')]);}logger[_0xbcd3('0x15')](_0xbcd3('0x12'),_0x5bf1bb,_0x1e065c[_0xbcd3('0x15')]['message']);return _0x1f165e(_0x1e065c[_0xbcd3('0x15')][_0xbcd3('0x17')]);}else{logger['info'](_0xbcd3('0x12'),_0x5bf1bb,_0xbcd3('0x14'));_0x1f165e(_0x1e065c['result'][_0xbcd3('0x17')]);}})[_0xbcd3('0x18')](function(_0x4e7630){logger['error']('WhatsappQueue,\x20%s,\x20%s',_0x5bf1bb,_0x4e7630);_0x3e9e98(_0x4e7630);});});}exports['GetWhatsappQueue']=function(_0x4f002e){var _0x9582da=this;return new Promise(function(_0x5d6dad,_0x338678){return db['WhatsappQueue'][_0xbcd3('0x19')]({'raw':_0x4f002e[_0xbcd3('0x1a')]?_0x4f002e[_0xbcd3('0x1a')][_0xbcd3('0x1b')]===undefined?!![]:![]:!![],'where':_0x4f002e[_0xbcd3('0x1a')]?_0x4f002e[_0xbcd3('0x1a')][_0xbcd3('0x1c')]||null:null,'attributes':_0x4f002e[_0xbcd3('0x1a')]?_0x4f002e['options'][_0xbcd3('0x1d')]||null:null,'limit':_0x4f002e[_0xbcd3('0x1a')]?_0x4f002e[_0xbcd3('0x1a')][_0xbcd3('0x1e')]||null:null,'include':_0x4f002e[_0xbcd3('0x1a')]?_0x4f002e[_0xbcd3('0x1a')][_0xbcd3('0x1f')]?_[_0xbcd3('0x20')](_0x4f002e[_0xbcd3('0x1a')][_0xbcd3('0x1f')],function(_0x4694d6){return{'model':db[_0x4694d6[_0xbcd3('0x21')]],'as':_0x4694d6['as'],'attributes':_0x4694d6['attributes'],'include':_0x4694d6[_0xbcd3('0x1f')]?_[_0xbcd3('0x20')](_0x4694d6['include'],function(_0x5f214d){return{'model':db[_0x5f214d[_0xbcd3('0x21')]],'as':_0x5f214d['as'],'attributes':_0x5f214d[_0xbcd3('0x1d')],'include':_0x5f214d['include']?_[_0xbcd3('0x20')](_0x5f214d[_0xbcd3('0x1f')],function(_0x518864){return{'model':db[_0x518864[_0xbcd3('0x21')]],'as':_0x518864['as'],'attributes':_0x518864[_0xbcd3('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xbcd3('0x10')](function(_0x58e100){logger['info'](_0xbcd3('0x22'),_0x4f002e);logger[_0xbcd3('0x13')](_0xbcd3('0x22'),_0x4f002e,JSON[_0xbcd3('0x23')](_0x58e100));_0x5d6dad(_0x58e100);})['catch'](function(_0x2dc080){logger[_0xbcd3('0x15')](_0xbcd3('0x22'),_0x2dc080[_0xbcd3('0x17')],_0x4f002e);_0x338678(_0x9582da['error'](0x1f4,_0x2dc080[_0xbcd3('0x17')]));});});};exports[_0xbcd3('0x24')]=function(_0x3faf9d){var _0x1ecc9e=this;return new Promise(function(_0x48e7e,_0x322316){return db['WhatsappQueue'][_0xbcd3('0x25')]({'raw':_0x3faf9d['options']?_0x3faf9d[_0xbcd3('0x1a')][_0xbcd3('0x1b')]===undefined?!![]:![]:!![],'where':_0x3faf9d['options']?_0x3faf9d[_0xbcd3('0x1a')][_0xbcd3('0x1c')]||null:null,'attributes':_0x3faf9d[_0xbcd3('0x1a')]?_0x3faf9d[_0xbcd3('0x1a')]['attributes']||null:null,'include':_0x3faf9d[_0xbcd3('0x1a')]?_0x3faf9d['options'][_0xbcd3('0x1f')]?_[_0xbcd3('0x20')](_0x3faf9d[_0xbcd3('0x1a')]['include'],function(_0x5b9f1c){return{'model':db[_0x5b9f1c[_0xbcd3('0x21')]],'as':_0x5b9f1c['as'],'attributes':_0x5b9f1c['attributes'],'include':_0x5b9f1c[_0xbcd3('0x1f')]?_[_0xbcd3('0x20')](_0x5b9f1c[_0xbcd3('0x1f')],function(_0x1edc05){return{'model':db[_0x1edc05[_0xbcd3('0x21')]],'as':_0x1edc05['as'],'attributes':_0x1edc05[_0xbcd3('0x1d')],'include':_0x1edc05[_0xbcd3('0x1f')]?_[_0xbcd3('0x20')](_0x1edc05[_0xbcd3('0x1f')],function(_0x37a220){return{'model':db[_0x37a220[_0xbcd3('0x21')]],'as':_0x37a220['as'],'attributes':_0x37a220[_0xbcd3('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xbcd3('0x10')](function(_0x2165a0){logger['info'](_0xbcd3('0x24'),_0x3faf9d);logger['debug'](_0xbcd3('0x24'),_0x3faf9d,JSON[_0xbcd3('0x23')](_0x2165a0));_0x48e7e(_0x2165a0);})[_0xbcd3('0x18')](function(_0xd7cc56){logger['error'](_0xbcd3('0x24'),_0xd7cc56['message'],_0x3faf9d);_0x322316(_0x1ecc9e[_0xbcd3('0x15')](0x1f4,_0xd7cc56[_0xbcd3('0x17')]));});});}; \ No newline at end of file +var _0x13a0=['options','raw','where','limit','map','include','model','attributes','debug','catch','ShowWhatsappQueue','find','lodash','util','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./whatsappQueue.socket','register','request','then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetWhatsappQueue','WhatsappQueue','findAll'];(function(_0x31f6a6,_0x5d81cb){var _0x110769=function(_0x19828e){while(--_0x19828e){_0x31f6a6['push'](_0x31f6a6['shift']());}};_0x110769(++_0x5d81cb);}(_0x13a0,0x84));var _0x013a=function(_0x41e793,_0x166684){_0x41e793=_0x41e793-0x0;var _0x2885fa=_0x13a0[_0x41e793];return _0x2885fa;};'use strict';var _=require(_0x013a('0x0'));var util=require(_0x013a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x013a('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x013a('0x3'));var logger=require(_0x013a('0x4'))(_0x013a('0x5'));var config=require(_0x013a('0x6'));var jayson=require(_0x013a('0x7'));var client=jayson[_0x013a('0x8')][_0x013a('0x9')]({'port':0x232a});config[_0x013a('0xa')]=_[_0x013a('0xb')](config[_0x013a('0xa')],{'host':_0x013a('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x013a('0xa')]));require(_0x013a('0xd'))[_0x013a('0xe')](socket);function respondWithRpcPromise(_0x96e634,_0x6e4406,_0x3c19cf){return new BPromise(function(_0x5ac3ef,_0xcb3022){return client[_0x013a('0xf')](_0x96e634,_0x3c19cf)[_0x013a('0x10')](function(_0x3baedd){logger[_0x013a('0x11')](_0x013a('0x12'),_0x6e4406,_0x013a('0x13'));logger['debug'](_0x013a('0x14'),_0x6e4406,'request\x20sent',JSON[_0x013a('0x15')](_0x3baedd));if(_0x3baedd['error']){if(_0x3baedd['error']['code']===0x1f4){logger[_0x013a('0x16')]('WhatsappQueue,\x20%s,\x20%s',_0x6e4406,_0x3baedd[_0x013a('0x16')][_0x013a('0x17')]);return _0xcb3022(_0x3baedd[_0x013a('0x16')][_0x013a('0x17')]);}logger[_0x013a('0x16')](_0x013a('0x12'),_0x6e4406,_0x3baedd[_0x013a('0x16')]['message']);return _0x5ac3ef(_0x3baedd[_0x013a('0x16')][_0x013a('0x17')]);}else{logger[_0x013a('0x11')](_0x013a('0x12'),_0x6e4406,_0x013a('0x13'));_0x5ac3ef(_0x3baedd[_0x013a('0x18')][_0x013a('0x17')]);}})['catch'](function(_0x1fc6eb){logger['error'](_0x013a('0x12'),_0x6e4406,_0x1fc6eb);_0xcb3022(_0x1fc6eb);});});}exports[_0x013a('0x19')]=function(_0x49f80f){var _0x1b4d76=this;return new Promise(function(_0x12f2c2,_0x595b8d){return db[_0x013a('0x1a')][_0x013a('0x1b')]({'raw':_0x49f80f['options']?_0x49f80f[_0x013a('0x1c')][_0x013a('0x1d')]===undefined?!![]:![]:!![],'where':_0x49f80f[_0x013a('0x1c')]?_0x49f80f[_0x013a('0x1c')][_0x013a('0x1e')]||null:null,'attributes':_0x49f80f[_0x013a('0x1c')]?_0x49f80f[_0x013a('0x1c')]['attributes']||null:null,'limit':_0x49f80f[_0x013a('0x1c')]?_0x49f80f[_0x013a('0x1c')][_0x013a('0x1f')]||null:null,'include':_0x49f80f[_0x013a('0x1c')]?_0x49f80f['options']['include']?_[_0x013a('0x20')](_0x49f80f[_0x013a('0x1c')][_0x013a('0x21')],function(_0x496b18){return{'model':db[_0x496b18[_0x013a('0x22')]],'as':_0x496b18['as'],'attributes':_0x496b18[_0x013a('0x23')],'include':_0x496b18[_0x013a('0x21')]?_[_0x013a('0x20')](_0x496b18[_0x013a('0x21')],function(_0x19f47e){return{'model':db[_0x19f47e['model']],'as':_0x19f47e['as'],'attributes':_0x19f47e['attributes'],'include':_0x19f47e['include']?_[_0x013a('0x20')](_0x19f47e[_0x013a('0x21')],function(_0x5cc36c){return{'model':db[_0x5cc36c[_0x013a('0x22')]],'as':_0x5cc36c['as'],'attributes':_0x5cc36c[_0x013a('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4f90c8){logger[_0x013a('0x11')]('GetWhatsappQueue',_0x49f80f);logger[_0x013a('0x24')]('GetWhatsappQueue',_0x49f80f,JSON['stringify'](_0x4f90c8));_0x12f2c2(_0x4f90c8);})[_0x013a('0x25')](function(_0x5c3ff1){logger[_0x013a('0x16')](_0x013a('0x19'),_0x5c3ff1['message'],_0x49f80f);_0x595b8d(_0x1b4d76['error'](0x1f4,_0x5c3ff1[_0x013a('0x17')]));});});};exports[_0x013a('0x26')]=function(_0x43480f){var _0x4faf7a=this;return new Promise(function(_0x896602,_0x379539){return db[_0x013a('0x1a')][_0x013a('0x27')]({'raw':_0x43480f['options']?_0x43480f[_0x013a('0x1c')][_0x013a('0x1d')]===undefined?!![]:![]:!![],'where':_0x43480f[_0x013a('0x1c')]?_0x43480f['options'][_0x013a('0x1e')]||null:null,'attributes':_0x43480f[_0x013a('0x1c')]?_0x43480f['options']['attributes']||null:null,'include':_0x43480f[_0x013a('0x1c')]?_0x43480f[_0x013a('0x1c')][_0x013a('0x21')]?_[_0x013a('0x20')](_0x43480f[_0x013a('0x1c')][_0x013a('0x21')],function(_0x22d5f4){return{'model':db[_0x22d5f4[_0x013a('0x22')]],'as':_0x22d5f4['as'],'attributes':_0x22d5f4[_0x013a('0x23')],'include':_0x22d5f4[_0x013a('0x21')]?_[_0x013a('0x20')](_0x22d5f4[_0x013a('0x21')],function(_0x2d1c84){return{'model':db[_0x2d1c84[_0x013a('0x22')]],'as':_0x2d1c84['as'],'attributes':_0x2d1c84[_0x013a('0x23')],'include':_0x2d1c84[_0x013a('0x21')]?_[_0x013a('0x20')](_0x2d1c84[_0x013a('0x21')],function(_0x3bd35b){return{'model':db[_0x3bd35b[_0x013a('0x22')]],'as':_0x3bd35b['as'],'attributes':_0x3bd35b[_0x013a('0x23')]};}):[]};}):[]};}):[]:[]})[_0x013a('0x10')](function(_0x3085e4){logger[_0x013a('0x11')](_0x013a('0x26'),_0x43480f);logger[_0x013a('0x24')](_0x013a('0x26'),_0x43480f,JSON[_0x013a('0x15')](_0x3085e4));_0x896602(_0x3085e4);})[_0x013a('0x25')](function(_0x21ca20){logger['error']('ShowWhatsappQueue',_0x21ca20[_0x013a('0x17')],_0x43480f);_0x379539(_0x4faf7a[_0x013a('0x16')](0x1f4,_0x21ca20[_0x013a('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index a957906..08c01f1 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 _0x80b3=['./whatsappQueue.events','remove','emit','removeListener','length','whatsappQueue:'];(function(_0x13c542,_0x4a9af3){var _0x306405=function(_0x36aaef){while(--_0x36aaef){_0x13c542['push'](_0x13c542['shift']());}};_0x306405(++_0x4a9af3);}(_0x80b3,0xc6));var _0x380b=function(_0x4c2b45,_0x201455){_0x4c2b45=_0x4c2b45-0x0;var _0x2fa8aa=_0x80b3[_0x4c2b45];return _0x2fa8aa;};'use strict';var WhatsappQueueEvents=require(_0x380b('0x0'));var events=['save',_0x380b('0x1'),'update'];function createListener(_0x283e1c,_0x2c17bd){return function(_0x46a477){_0x2c17bd[_0x380b('0x2')](_0x283e1c,_0x46a477);};}function removeListener(_0x3520c4,_0x59bda1){return function(){WhatsappQueueEvents[_0x380b('0x3')](_0x3520c4,_0x59bda1);};}exports['register']=function(_0x42ca90){for(var _0x1f8924=0x0,_0x4fc391=events[_0x380b('0x4')];_0x1f8924<_0x4fc391;_0x1f8924++){var _0x22071d=events[_0x1f8924];var _0x40c27e=createListener(_0x380b('0x5')+_0x22071d,_0x42ca90);WhatsappQueueEvents['on'](_0x22071d,_0x40c27e);}}; \ No newline at end of file +var _0x27c7=['./whatsappQueue.events','save','remove','emit','removeListener','register','length'];(function(_0x34171e,_0x1250dd){var _0x3285fb=function(_0xb761b8){while(--_0xb761b8){_0x34171e['push'](_0x34171e['shift']());}};_0x3285fb(++_0x1250dd);}(_0x27c7,0x1ea));var _0x727c=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x27c7[_0x397e5f];return _0x5302b8;};'use strict';var WhatsappQueueEvents=require(_0x727c('0x0'));var events=[_0x727c('0x1'),_0x727c('0x2'),'update'];function createListener(_0x128bce,_0x4ae20e){return function(_0x22347b){_0x4ae20e[_0x727c('0x3')](_0x128bce,_0x22347b);};}function removeListener(_0x2b7bb3,_0xc50583){return function(){WhatsappQueueEvents[_0x727c('0x4')](_0x2b7bb3,_0xc50583);};}exports[_0x727c('0x5')]=function(_0x17719b){for(var _0x5cedef=0x0,_0x3e8932=events[_0x727c('0x6')];_0x5cedef<_0x3e8932;_0x5cedef++){var _0x3d0703=events[_0x5cedef];var _0x54a732=createListener('whatsappQueue:'+_0x3d0703,_0x17719b);WhatsappQueueEvents['on'](_0x3d0703,_0x54a732);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index d617c15..c873b99 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 _0x13e7=['../../components/auth/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','post','create','update','delete','multer','path','connect-timeout','Router'];(function(_0x5e31e2,_0x273090){var _0x294e2c=function(_0x20ab82){while(--_0x20ab82){_0x5e31e2['push'](_0x5e31e2['shift']());}};_0x294e2c(++_0x273090);}(_0x13e7,0x16c));var _0x713e=function(_0x457b64,_0x49a219){_0x457b64=_0x457b64-0x0;var _0x437111=_0x13e7[_0x457b64];return _0x437111;};'use strict';var multer=require(_0x713e('0x0'));var util=require('util');var path=require(_0x713e('0x1'));var timeout=require(_0x713e('0x2'));var express=require('express');var router=express[_0x713e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x713e('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x713e('0x5'));var controller=require('./whatsappQueueReport.controller');router[_0x713e('0x6')]('/',auth[_0x713e('0x7')](),controller[_0x713e('0x8')]);router[_0x713e('0x6')]('/describe',auth[_0x713e('0x7')](),controller[_0x713e('0x9')]);router[_0x713e('0x6')](_0x713e('0xa'),auth[_0x713e('0x7')](),controller[_0x713e('0xb')]);router[_0x713e('0xc')]('/',auth[_0x713e('0x7')](),controller[_0x713e('0xd')]);router['put'](_0x713e('0xa'),auth[_0x713e('0x7')](),controller[_0x713e('0xe')]);router[_0x713e('0xf')](_0x713e('0xa'),auth[_0x713e('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xcc1b=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','isAuthenticated','index','get','describe','/:id','show','put','delete','destroy'];(function(_0x761b6d,_0x7c7fa8){var _0x3a1639=function(_0x33b90a){while(--_0x33b90a){_0x761b6d['push'](_0x761b6d['shift']());}};_0x3a1639(++_0x7c7fa8);}(_0xcc1b,0xf0));var _0xbcc1=function(_0xbdb08a,_0x3977fa){_0xbdb08a=_0xbdb08a-0x0;var _0x30142e=_0xcc1b[_0xbdb08a];return _0x30142e;};'use strict';var multer=require(_0xbcc1('0x0'));var util=require(_0xbcc1('0x1'));var path=require(_0xbcc1('0x2'));var timeout=require(_0xbcc1('0x3'));var express=require(_0xbcc1('0x4'));var router=express[_0xbcc1('0x5')]();var fs_extra=require(_0xbcc1('0x6'));var auth=require(_0xbcc1('0x7'));var interaction=require(_0xbcc1('0x8'));var config=require(_0xbcc1('0x9'));var controller=require(_0xbcc1('0xa'));router['get']('/',auth[_0xbcc1('0xb')](),controller[_0xbcc1('0xc')]);router[_0xbcc1('0xd')]('/describe',auth[_0xbcc1('0xb')](),controller[_0xbcc1('0xe')]);router[_0xbcc1('0xd')](_0xbcc1('0xf'),auth[_0xbcc1('0xb')](),controller[_0xbcc1('0x10')]);router['post']('/',auth[_0xbcc1('0xb')](),controller['create']);router[_0xbcc1('0x11')](_0xbcc1('0xf'),auth[_0xbcc1('0xb')](),controller['update']);router[_0xbcc1('0x12')](_0xbcc1('0xf'),auth[_0xbcc1('0xb')](),controller[_0xbcc1('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 30ac10b..bd65af5 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['STRING','DATE','sequelize','exports'];(function(_0x16db4b,_0x269435){var _0x457b8a=function(_0x8584d7){while(--_0x8584d7){_0x16db4b['push'](_0x16db4b['shift']());}};_0x457b8a(++_0x269435);}(_0x7a54,0x106));var _0x47a5=function(_0xc0d032,_0x4f15c2){_0xc0d032=_0xc0d032-0x0;var _0x295da8=_0x7a54[_0xc0d032];return _0x295da8;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'uniqueid':{'type':Sequelize[_0x47a5('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x47a5('0x3')]},'leaveAt':{'type':Sequelize[_0x47a5('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x47a5('0x3')]},'reason':{'type':Sequelize[_0x47a5('0x2')]}}; \ No newline at end of file +var _0x7a54=['STRING','DATE','sequelize','exports'];(function(_0x1bf749,_0x34db3d){var _0x362449=function(_0x41a928){while(--_0x41a928){_0x1bf749['push'](_0x1bf749['shift']());}};_0x362449(++_0x34db3d);}(_0x7a54,0x106));var _0x47a5=function(_0x2ba072,_0x2226ab){_0x2ba072=_0x2ba072-0x0;var _0x52c495=_0x7a54[_0x2ba072];return _0x52c495;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'uniqueid':{'type':Sequelize[_0x47a5('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x47a5('0x3')]},'leaveAt':{'type':Sequelize[_0x47a5('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x47a5('0x3')]},'reason':{'type':Sequelize[_0x47a5('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index 9415ab6..8f04afc 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 _0x14a0=['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','undefined','limit','count','offset','set','apply','reject','save','update','destroy','then','stack','name','send','index','map','WhatsappQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0x14a0,0x8e));var _0x014a=function(_0x2419d2,_0x63d417){_0x2419d2=_0x2419d2-0x0;var _0x1ea483=_0x14a0[_0x2419d2];return _0x1ea483;};'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(){_0x26718b[_0x014a('0x15')](0xcc)[_0x014a('0x16')]();});}};}function handleEntityNotFound(_0x165a42,_0x4c2627){return function(_0x3b4b92){if(!_0x3b4b92){_0x165a42['sendStatus'](0x194);}return _0x3b4b92;};}function handleError(_0x39a432,_0x28701e){_0x28701e=_0x28701e||0x1f4;return function(_0x4f1c44){logger['error'](_0x4f1c44[_0x014a('0x23')]);if(_0x4f1c44[_0x014a('0x24')]){delete _0x4f1c44[_0x014a('0x24')];}_0x39a432['status'](_0x28701e)[_0x014a('0x25')](_0x4f1c44);};}exports[_0x014a('0x26')]=function(_0x598179,_0x31dc95){var _0x2560a6={},_0x496040={},_0x4f9c1c={'count':0x0,'rows':[]};var _0x397850=_[_0x014a('0x27')](db[_0x014a('0x28')][_0x014a('0x29')],function(_0x4ea00c){return{'name':_0x4ea00c[_0x014a('0x2a')],'type':_0x4ea00c[_0x014a('0x2b')][_0x014a('0x2c')]};});_0x496040[_0x014a('0x2d')]=_[_0x014a('0x27')](_0x397850,_0x014a('0x24'));_0x496040[_0x014a('0x2e')]=_[_0x014a('0x2f')](_0x598179[_0x014a('0x2e')]);_0x496040[_0x014a('0x30')]=_[_0x014a('0x31')](_0x496040['model'],_0x496040[_0x014a('0x2e')]);_0x2560a6[_0x014a('0x32')]=_[_0x014a('0x31')](_0x496040[_0x014a('0x2d')],qs[_0x014a('0x33')](_0x598179[_0x014a('0x2e')][_0x014a('0x33')]));_0x2560a6['attributes']=_0x2560a6[_0x014a('0x32')][_0x014a('0x34')]?_0x2560a6['attributes']:_0x496040[_0x014a('0x2d')];if(!_0x598179[_0x014a('0x2e')][_0x014a('0x35')](_0x014a('0x36'))){_0x2560a6[_0x014a('0x19')]=qs[_0x014a('0x19')](_0x598179[_0x014a('0x2e')][_0x014a('0x19')]);_0x2560a6['offset']=qs[_0x014a('0x1b')](_0x598179[_0x014a('0x2e')][_0x014a('0x1b')]);}_0x2560a6[_0x014a('0x37')]=qs['sort'](_0x598179[_0x014a('0x2e')][_0x014a('0x38')]);_0x2560a6[_0x014a('0x39')]=qs[_0x014a('0x30')](_[_0x014a('0x3a')](_0x598179[_0x014a('0x2e')],_0x496040[_0x014a('0x30')]),_0x397850);if(_0x598179[_0x014a('0x2e')][_0x014a('0x3b')]){_0x2560a6['where']=_[_0x014a('0x3c')](_0x2560a6['where'],{'$or':_[_0x014a('0x27')](_0x397850,function(_0xc11492){if(_0xc11492[_0x014a('0x2b')]!==_0x014a('0x3d')){var _0x43376c={};_0x43376c[_0xc11492['name']]={'$like':'%'+_0x598179[_0x014a('0x2e')][_0x014a('0x3b')]+'%'};return _0x43376c;}})});}_0x2560a6=_['merge']({},_0x2560a6,_0x598179[_0x014a('0x3e')]);var _0x2990df={'where':_0x2560a6[_0x014a('0x39')]};return db[_0x014a('0x28')][_0x014a('0x1a')](_0x2990df)[_0x014a('0x22')](function(_0x17b1b6){_0x4f9c1c[_0x014a('0x1a')]=_0x17b1b6;if(_0x598179[_0x014a('0x2e')]['includeAll']){_0x2560a6[_0x014a('0x3f')]=[{'all':!![]}];}return db[_0x014a('0x28')][_0x014a('0x40')](_0x2560a6);})[_0x014a('0x22')](function(_0x5f1a91){_0x4f9c1c[_0x014a('0x41')]=_0x5f1a91;return _0x4f9c1c;})[_0x014a('0x22')](respondWithFilteredResult(_0x31dc95,_0x2560a6))[_0x014a('0x42')](handleError(_0x31dc95,null));};exports[_0x014a('0x43')]=function(_0x1dc647,_0x430a56){var _0x5f2969={'raw':!![],'where':{'id':_0x1dc647[_0x014a('0x44')]['id']}},_0x361866={};_0x361866['model']=_[_0x014a('0x2f')](db[_0x014a('0x28')][_0x014a('0x29')]);_0x361866['query']=_[_0x014a('0x2f')](_0x1dc647['query']);_0x361866['filters']=_[_0x014a('0x31')](_0x361866[_0x014a('0x2d')],_0x361866['query']);_0x5f2969[_0x014a('0x32')]=_[_0x014a('0x31')](_0x361866[_0x014a('0x2d')],qs[_0x014a('0x33')](_0x1dc647[_0x014a('0x2e')][_0x014a('0x33')]));_0x5f2969['attributes']=_0x5f2969[_0x014a('0x32')][_0x014a('0x34')]?_0x5f2969[_0x014a('0x32')]:_0x361866['model'];if(_0x1dc647['query'][_0x014a('0x45')]){_0x5f2969['include']=[{'all':!![]}];}_0x5f2969=_['merge']({},_0x5f2969,_0x1dc647[_0x014a('0x3e')]);return db['WhatsappQueueReport'][_0x014a('0x46')](_0x5f2969)[_0x014a('0x22')](handleEntityNotFound(_0x430a56,null))[_0x014a('0x22')](respondWithResult(_0x430a56,null))['catch'](handleError(_0x430a56,null));};exports[_0x014a('0x47')]=function(_0x23be18,_0x12cd9b){return db[_0x014a('0x28')][_0x014a('0x47')](_0x23be18[_0x014a('0x48')],{})['then'](respondWithResult(_0x12cd9b,0xc9))[_0x014a('0x42')](handleError(_0x12cd9b,null));};exports[_0x014a('0x20')]=function(_0x5a861c,_0x1a4df9){if(_0x5a861c[_0x014a('0x48')]['id']){delete _0x5a861c[_0x014a('0x48')]['id'];}return db[_0x014a('0x28')][_0x014a('0x46')]({'where':{'id':_0x5a861c[_0x014a('0x44')]['id']}})[_0x014a('0x22')](handleEntityNotFound(_0x1a4df9,null))[_0x014a('0x22')](saveUpdates(_0x5a861c['body'],null))[_0x014a('0x22')](respondWithResult(_0x1a4df9,null))[_0x014a('0x42')](handleError(_0x1a4df9,null));};exports[_0x014a('0x21')]=function(_0x135e7e,_0x312c7a){return db['WhatsappQueueReport'][_0x014a('0x46')]({'where':{'id':_0x135e7e['params']['id']}})[_0x014a('0x22')](handleEntityNotFound(_0x312c7a,null))[_0x014a('0x22')](removeEntity(_0x312c7a,null))[_0x014a('0x42')](handleError(_0x312c7a,null));};exports[_0x014a('0x49')]=function(_0x3caa6e,_0x4f8547){return db['WhatsappQueueReport']['describe']()['then'](respondWithResult(_0x4f8547,null))[_0x014a('0x42')](handleError(_0x4f8547,null));}; \ No newline at end of file +var _0x1c9a=['eml-format','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','WhatsappQueueReport','rawAttributes','fieldName','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','params','find','create','body','describe'];(function(_0x386042,_0x1869f1){var _0x5e766c=function(_0x24091e){while(--_0x24091e){_0x386042['push'](_0x386042['shift']());}};_0x5e766c(++_0x1869f1);}(_0x1c9a,0x98));var _0xa1c9=function(_0x177dfe,_0x2ecc6d){_0x177dfe=_0x177dfe-0x0;var _0x85887f=_0x1c9a[_0x177dfe];return _0x85887f;};'use strict';var emlformat=require(_0xa1c9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa1c9('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa1c9('0x2'));var moment=require(_0xa1c9('0x3'));var BPromise=require(_0xa1c9('0x4'));var Mustache=require('mustache');var util=require(_0xa1c9('0x5'));var path=require(_0xa1c9('0x6'));var sox=require(_0xa1c9('0x7'));var csv=require(_0xa1c9('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa1c9('0x9'));var _=require('lodash');var squel=require(_0xa1c9('0xa'));var crypto=require(_0xa1c9('0xb'));var jsforce=require(_0xa1c9('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa1c9('0x8'));var querystring=require(_0xa1c9('0xd'));var Papa=require(_0xa1c9('0xe'));var Redis=require(_0xa1c9('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xa1c9('0x10'));var as=require(_0xa1c9('0x11'));var hardwareService=require(_0xa1c9('0x12'));var logger=require(_0xa1c9('0x13'))(_0xa1c9('0x14'));var utils=require(_0xa1c9('0x15'));var config=require(_0xa1c9('0x16'));var licenseUtil=require(_0xa1c9('0x17'));var db=require(_0xa1c9('0x18'))['db'];function respondWithStatusCode(_0x17ee28,_0x57e2a8){_0x57e2a8=_0x57e2a8||0xcc;return function(_0x341233){if(_0x341233){return _0x17ee28[_0xa1c9('0x19')](_0x57e2a8);}return _0x17ee28[_0xa1c9('0x1a')](_0x57e2a8)[_0xa1c9('0x1b')]();};}function respondWithResult(_0x13f4e9,_0x4c70dd){_0x4c70dd=_0x4c70dd||0xc8;return function(_0x335dda){if(_0x335dda){return _0x13f4e9[_0xa1c9('0x1a')](_0x4c70dd)[_0xa1c9('0x1c')](_0x335dda);}};}function respondWithFilteredResult(_0xd9bca1,_0x2d825c){return function(_0x1bbc94){if(_0x1bbc94){var _0x44ab5b=typeof _0x2d825c[_0xa1c9('0x1d')]===_0xa1c9('0x1e')&&typeof _0x2d825c[_0xa1c9('0x1f')]==='undefined';var _0x11ca10=_0x1bbc94[_0xa1c9('0x20')];var _0x224ae4=_0x44ab5b?0x0:_0x2d825c['offset'];var _0x2fb81e=_0x44ab5b?_0x1bbc94['count']:_0x2d825c[_0xa1c9('0x1d')]+_0x2d825c[_0xa1c9('0x1f')];var _0x204d54;if(_0x2fb81e>=_0x11ca10){_0x2fb81e=_0x11ca10;_0x204d54=0xc8;}else{_0x204d54=0xce;}_0xd9bca1['status'](_0x204d54);return _0xd9bca1[_0xa1c9('0x21')](_0xa1c9('0x22'),_0x224ae4+'-'+_0x2fb81e+'/'+_0x11ca10)[_0xa1c9('0x1c')](_0x1bbc94);}return null;};}function patchUpdates(_0x4edf37){return function(_0x41e6d2){try{jsonpatch[_0xa1c9('0x23')](_0x41e6d2,_0x4edf37,!![]);}catch(_0x4c6dbb){return BPromise[_0xa1c9('0x24')](_0x4c6dbb);}return _0x41e6d2[_0xa1c9('0x25')]();};}function saveUpdates(_0x9f201f,_0x4d05d0){return function(_0x29f1b1){if(_0x29f1b1){return _0x29f1b1[_0xa1c9('0x26')](_0x9f201f)[_0xa1c9('0x27')](function(_0x23a461){return _0x23a461;});}return null;};}function removeEntity(_0x24a5da,_0x4a0a0c){return function(_0x50b16b){if(_0x50b16b){return _0x50b16b[_0xa1c9('0x28')]()['then'](function(){_0x24a5da[_0xa1c9('0x1a')](0xcc)[_0xa1c9('0x1b')]();});}};}function handleEntityNotFound(_0x1c6f37,_0x3059eb){return function(_0x339ed1){if(!_0x339ed1){_0x1c6f37['sendStatus'](0x194);}return _0x339ed1;};}function handleError(_0x1925e7,_0x3ca2a8){_0x3ca2a8=_0x3ca2a8||0x1f4;return function(_0x20cbe1){logger['error'](_0x20cbe1[_0xa1c9('0x29')]);if(_0x20cbe1[_0xa1c9('0x2a')]){delete _0x20cbe1[_0xa1c9('0x2a')];}_0x1925e7['status'](_0x3ca2a8)[_0xa1c9('0x2b')](_0x20cbe1);};}exports[_0xa1c9('0x2c')]=function(_0x594137,_0x38936f){var _0x48ce34={},_0xdf6d0c={},_0x2404c3={'count':0x0,'rows':[]};var _0x88ba11=_[_0xa1c9('0x2d')](db[_0xa1c9('0x2e')][_0xa1c9('0x2f')],function(_0x42fcb2){return{'name':_0x42fcb2[_0xa1c9('0x30')],'type':_0x42fcb2['type']['key']};});_0xdf6d0c[_0xa1c9('0x31')]=_[_0xa1c9('0x2d')](_0x88ba11,_0xa1c9('0x2a'));_0xdf6d0c[_0xa1c9('0x32')]=_[_0xa1c9('0x33')](_0x594137['query']);_0xdf6d0c['filters']=_['intersection'](_0xdf6d0c[_0xa1c9('0x31')],_0xdf6d0c[_0xa1c9('0x32')]);_0x48ce34[_0xa1c9('0x34')]=_[_0xa1c9('0x35')](_0xdf6d0c[_0xa1c9('0x31')],qs[_0xa1c9('0x36')](_0x594137[_0xa1c9('0x32')]['fields']));_0x48ce34[_0xa1c9('0x34')]=_0x48ce34['attributes'][_0xa1c9('0x37')]?_0x48ce34['attributes']:_0xdf6d0c[_0xa1c9('0x31')];if(!_0x594137[_0xa1c9('0x32')][_0xa1c9('0x38')]('nolimit')){_0x48ce34[_0xa1c9('0x1f')]=qs[_0xa1c9('0x1f')](_0x594137[_0xa1c9('0x32')][_0xa1c9('0x1f')]);_0x48ce34['offset']=qs['offset'](_0x594137[_0xa1c9('0x32')][_0xa1c9('0x1d')]);}_0x48ce34[_0xa1c9('0x39')]=qs[_0xa1c9('0x3a')](_0x594137[_0xa1c9('0x32')][_0xa1c9('0x3a')]);_0x48ce34[_0xa1c9('0x3b')]=qs[_0xa1c9('0x3c')](_[_0xa1c9('0x3d')](_0x594137[_0xa1c9('0x32')],_0xdf6d0c['filters']),_0x88ba11);if(_0x594137[_0xa1c9('0x32')][_0xa1c9('0x3e')]){_0x48ce34[_0xa1c9('0x3b')]=_[_0xa1c9('0x3f')](_0x48ce34[_0xa1c9('0x3b')],{'$or':_[_0xa1c9('0x2d')](_0x88ba11,function(_0x5011a3){if(_0x5011a3[_0xa1c9('0x40')]!==_0xa1c9('0x41')){var _0x29d871={};_0x29d871[_0x5011a3['name']]={'$like':'%'+_0x594137[_0xa1c9('0x32')][_0xa1c9('0x3e')]+'%'};return _0x29d871;}})});}_0x48ce34=_['merge']({},_0x48ce34,_0x594137[_0xa1c9('0x42')]);var _0x25502f={'where':_0x48ce34['where']};return db['WhatsappQueueReport'][_0xa1c9('0x20')](_0x25502f)[_0xa1c9('0x27')](function(_0x34a6b8){_0x2404c3[_0xa1c9('0x20')]=_0x34a6b8;if(_0x594137[_0xa1c9('0x32')][_0xa1c9('0x43')]){_0x48ce34[_0xa1c9('0x44')]=[{'all':!![]}];}return db[_0xa1c9('0x2e')][_0xa1c9('0x45')](_0x48ce34);})[_0xa1c9('0x27')](function(_0x5ac71f){_0x2404c3['rows']=_0x5ac71f;return _0x2404c3;})[_0xa1c9('0x27')](respondWithFilteredResult(_0x38936f,_0x48ce34))[_0xa1c9('0x46')](handleError(_0x38936f,null));};exports['show']=function(_0x30ce3b,_0x102a33){var _0x43de42={'raw':!![],'where':{'id':_0x30ce3b[_0xa1c9('0x47')]['id']}},_0x36c846={};_0x36c846[_0xa1c9('0x31')]=_[_0xa1c9('0x33')](db[_0xa1c9('0x2e')][_0xa1c9('0x2f')]);_0x36c846[_0xa1c9('0x32')]=_[_0xa1c9('0x33')](_0x30ce3b['query']);_0x36c846[_0xa1c9('0x3c')]=_['intersection'](_0x36c846[_0xa1c9('0x31')],_0x36c846['query']);_0x43de42[_0xa1c9('0x34')]=_['intersection'](_0x36c846[_0xa1c9('0x31')],qs[_0xa1c9('0x36')](_0x30ce3b['query'][_0xa1c9('0x36')]));_0x43de42[_0xa1c9('0x34')]=_0x43de42['attributes'][_0xa1c9('0x37')]?_0x43de42[_0xa1c9('0x34')]:_0x36c846[_0xa1c9('0x31')];if(_0x30ce3b[_0xa1c9('0x32')][_0xa1c9('0x43')]){_0x43de42[_0xa1c9('0x44')]=[{'all':!![]}];}_0x43de42=_['merge']({},_0x43de42,_0x30ce3b[_0xa1c9('0x42')]);return db[_0xa1c9('0x2e')][_0xa1c9('0x48')](_0x43de42)[_0xa1c9('0x27')](handleEntityNotFound(_0x102a33,null))[_0xa1c9('0x27')](respondWithResult(_0x102a33,null))['catch'](handleError(_0x102a33,null));};exports['create']=function(_0x4cf00a,_0x15329c){return db[_0xa1c9('0x2e')][_0xa1c9('0x49')](_0x4cf00a['body'],{})[_0xa1c9('0x27')](respondWithResult(_0x15329c,0xc9))[_0xa1c9('0x46')](handleError(_0x15329c,null));};exports['update']=function(_0x43ee79,_0x4bdf5d){if(_0x43ee79['body']['id']){delete _0x43ee79[_0xa1c9('0x4a')]['id'];}return db[_0xa1c9('0x2e')][_0xa1c9('0x48')]({'where':{'id':_0x43ee79[_0xa1c9('0x47')]['id']}})[_0xa1c9('0x27')](handleEntityNotFound(_0x4bdf5d,null))[_0xa1c9('0x27')](saveUpdates(_0x43ee79[_0xa1c9('0x4a')],null))[_0xa1c9('0x27')](respondWithResult(_0x4bdf5d,null))[_0xa1c9('0x46')](handleError(_0x4bdf5d,null));};exports[_0xa1c9('0x28')]=function(_0x2b2065,_0x1bed85){return db[_0xa1c9('0x2e')][_0xa1c9('0x48')]({'where':{'id':_0x2b2065[_0xa1c9('0x47')]['id']}})[_0xa1c9('0x27')](handleEntityNotFound(_0x1bed85,null))[_0xa1c9('0x27')](removeEntity(_0x1bed85,null))[_0xa1c9('0x46')](handleError(_0x1bed85,null));};exports[_0xa1c9('0x4b')]=function(_0x4a968e,_0x55dc05){return db[_0xa1c9('0x2e')][_0xa1c9('0x4b')]()[_0xa1c9('0x27')](respondWithResult(_0x55dc05,null))[_0xa1c9('0x46')](handleError(_0x55dc05,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 720b99a..4e9719c 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 _0x4500=['report_whatsapp_queue','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','WhatsappQueueReport'];(function(_0x218fdc,_0x3b552b){var _0x54f74e=function(_0x515557){while(--_0x515557){_0x218fdc['push'](_0x218fdc['shift']());}};_0x54f74e(++_0x3b552b);}(_0x4500,0x16e));var _0x0450=function(_0xfcfc24,_0x48ca53){_0xfcfc24=_0xfcfc24-0x0;var _0x58f773=_0x4500[_0xfcfc24];return _0x58f773;};'use strict';var _=require(_0x0450('0x0'));var util=require(_0x0450('0x1'));var logger=require(_0x0450('0x2'))(_0x0450('0x3'));var moment=require(_0x0450('0x4'));var BPromise=require(_0x0450('0x5'));var rp=require(_0x0450('0x6'));var fs=require('fs');var path=require(_0x0450('0x7'));var rimraf=require('rimraf');var config=require(_0x0450('0x8'));var attributes=require('./whatsappQueueReport.attributes');module[_0x0450('0x9')]=function(_0x5df908,_0x31ef1a){return _0x5df908['define'](_0x0450('0xa'),attributes,{'tableName':_0x0450('0xb'),'paranoid':![],'indexes':[{'name':_0x0450('0xc'),'fields':[_0x0450('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2194=['util','api','moment','request-promise','path','rimraf','../../config/environment','./whatsappQueueReport.attributes','exports','define','report_whatsapp_queue','uniqueid'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x2194,0xe4));var _0x4219=function(_0x2f227c,_0x360c3a){_0x2f227c=_0x2f227c-0x0;var _0x5032bc=_0x2194[_0x2f227c];return _0x5032bc;};'use strict';var _=require('lodash');var util=require(_0x4219('0x0'));var logger=require('../../config/logger')(_0x4219('0x1'));var moment=require(_0x4219('0x2'));var BPromise=require('bluebird');var rp=require(_0x4219('0x3'));var fs=require('fs');var path=require(_0x4219('0x4'));var rimraf=require(_0x4219('0x5'));var config=require(_0x4219('0x6'));var attributes=require(_0x4219('0x7'));module[_0x4219('0x8')]=function(_0x2f182f,_0x12d086){return _0x2f182f[_0x4219('0x9')]('WhatsappQueueReport',attributes,{'tableName':_0x4219('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x4219('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index c527bad..8bf8906 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 _0x206a=['CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','raw','UpdateWhatsappQueueReport','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch'];(function(_0x2fddd1,_0x419545){var _0x5860f5=function(_0x5eca86){while(--_0x5eca86){_0x2fddd1['push'](_0x2fddd1['shift']());}};_0x5860f5(++_0x419545);}(_0x206a,0x96));var _0xa206=function(_0x1a9e9e,_0x4e02c0){_0x1a9e9e=_0x1a9e9e-0x0;var _0x461061=_0x206a[_0x1a9e9e];return _0x461061;};'use strict';var _=require(_0xa206('0x0'));var util=require(_0xa206('0x1'));var moment=require(_0xa206('0x2'));var BPromise=require(_0xa206('0x3'));var rs=require(_0xa206('0x4'));var fs=require('fs');var Redis=require(_0xa206('0x5'));var db=require(_0xa206('0x6'))['db'];var utils=require(_0xa206('0x7'));var logger=require(_0xa206('0x8'))(_0xa206('0x9'));var config=require('../../config/environment');var jayson=require(_0xa206('0xa'));var client=jayson['client'][_0xa206('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x54ca01,_0x24f48b,_0x139c45){return new BPromise(function(_0x581f5c,_0x4a9222){return client[_0xa206('0xc')](_0x54ca01,_0x139c45)[_0xa206('0xd')](function(_0x4df5dd){logger[_0xa206('0xe')](_0xa206('0xf'),_0x24f48b,_0xa206('0x10'));logger[_0xa206('0x11')](_0xa206('0x12'),_0x24f48b,_0xa206('0x10'),JSON[_0xa206('0x13')](_0x4df5dd));if(_0x4df5dd['error']){if(_0x4df5dd['error'][_0xa206('0x14')]===0x1f4){logger[_0xa206('0x15')](_0xa206('0xf'),_0x24f48b,_0x4df5dd[_0xa206('0x15')]['message']);return _0x4a9222(_0x4df5dd[_0xa206('0x15')][_0xa206('0x16')]);}logger[_0xa206('0x15')]('WhatsappQueueReport,\x20%s,\x20%s',_0x24f48b,_0x4df5dd[_0xa206('0x15')]['message']);return _0x581f5c(_0x4df5dd[_0xa206('0x15')][_0xa206('0x16')]);}else{logger[_0xa206('0xe')](_0xa206('0xf'),_0x24f48b,_0xa206('0x10'));_0x581f5c(_0x4df5dd[_0xa206('0x17')][_0xa206('0x16')]);}})[_0xa206('0x18')](function(_0x5b1e75){logger[_0xa206('0x15')]('WhatsappQueueReport,\x20%s,\x20%s',_0x24f48b,_0x5b1e75);_0x4a9222(_0x5b1e75);});});}exports[_0xa206('0x19')]=function(_0x97f33){var _0x1ed8a3=this;return new Promise(function(_0x5ab965,_0x385ee6){return db[_0xa206('0x1a')][_0xa206('0x1b')](_0x97f33[_0xa206('0x1c')],{'raw':_0x97f33[_0xa206('0x1d')]?_0x97f33[_0xa206('0x1d')][_0xa206('0x1e')]===undefined?!![]:![]:!![]})[_0xa206('0xd')](function(_0x27e47e){logger['info']('CreateWhatsappQueueReport',_0x97f33);logger[_0xa206('0x11')]('CreateWhatsappQueueReport',_0x97f33,JSON[_0xa206('0x13')](_0x27e47e));_0x5ab965(_0x27e47e);})['catch'](function(_0x189849){logger[_0xa206('0x15')](_0xa206('0x19'),_0x189849[_0xa206('0x16')],_0x97f33);_0x385ee6(_0x1ed8a3['error'](0x1f4,_0x189849[_0xa206('0x16')]));});});};exports[_0xa206('0x1f')]=function(_0x51066b){var _0x1f330d=this;return new Promise(function(_0x2f0207,_0x43c2cf){return db[_0xa206('0x1a')]['update'](_0x51066b[_0xa206('0x1c')],{'raw':_0x51066b[_0xa206('0x1d')]?_0x51066b['options'][_0xa206('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x51066b[_0xa206('0x1d')]?_0x51066b[_0xa206('0x1d')][_0xa206('0x20')]||null:null,'attributes':_0x51066b['options']?_0x51066b['options'][_0xa206('0x21')]||null:null,'limit':_0x51066b[_0xa206('0x1d')]?_0x51066b[_0xa206('0x1d')][_0xa206('0x22')]||null:null})['then'](function(_0x5bf043){logger[_0xa206('0xe')](_0xa206('0x1f'),_0x51066b);logger['debug'](_0xa206('0x1f'),_0x51066b,JSON[_0xa206('0x13')](_0x5bf043));_0x2f0207(_0x5bf043);})[_0xa206('0x18')](function(_0x14b6fd){logger[_0xa206('0x15')](_0xa206('0x1f'),_0x14b6fd[_0xa206('0x16')],_0x51066b);_0x43c2cf(_0x1f330d[_0xa206('0x15')](0x1f4,_0x14b6fd[_0xa206('0x16')]));});});}; \ No newline at end of file +var _0xb669=['CreateWhatsappQueueReport','catch','where','attributes','limit','UpdateWhatsappQueueReport','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','WhatsappQueueReport','create','body','options','raw'];(function(_0x4e9eb6,_0xfd09cb){var _0x1e69a0=function(_0x5a5953){while(--_0x5a5953){_0x4e9eb6['push'](_0x4e9eb6['shift']());}};_0x1e69a0(++_0xfd09cb);}(_0xb669,0x171));var _0x9b66=function(_0x30aa48,_0x5cf0c9){_0x30aa48=_0x30aa48-0x0;var _0x35fc1f=_0xb669[_0x30aa48];return _0x35fc1f;};'use strict';var _=require(_0x9b66('0x0'));var util=require(_0x9b66('0x1'));var moment=require(_0x9b66('0x2'));var BPromise=require('bluebird');var rs=require(_0x9b66('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9b66('0x4'))['db'];var utils=require(_0x9b66('0x5'));var logger=require(_0x9b66('0x6'))('rpc');var config=require(_0x9b66('0x7'));var jayson=require(_0x9b66('0x8'));var client=jayson[_0x9b66('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1df631,_0x4b5383,_0x211067){return new BPromise(function(_0x4ab1bf,_0x27bc06){return client[_0x9b66('0xa')](_0x1df631,_0x211067)[_0x9b66('0xb')](function(_0x2a2302){logger[_0x9b66('0xc')](_0x9b66('0xd'),_0x4b5383,_0x9b66('0xe'));logger[_0x9b66('0xf')](_0x9b66('0x10'),_0x4b5383,_0x9b66('0xe'),JSON[_0x9b66('0x11')](_0x2a2302));if(_0x2a2302[_0x9b66('0x12')]){if(_0x2a2302[_0x9b66('0x12')][_0x9b66('0x13')]===0x1f4){logger[_0x9b66('0x12')]('WhatsappQueueReport,\x20%s,\x20%s',_0x4b5383,_0x2a2302['error'][_0x9b66('0x14')]);return _0x27bc06(_0x2a2302[_0x9b66('0x12')]['message']);}logger[_0x9b66('0x12')](_0x9b66('0xd'),_0x4b5383,_0x2a2302[_0x9b66('0x12')][_0x9b66('0x14')]);return _0x4ab1bf(_0x2a2302[_0x9b66('0x12')][_0x9b66('0x14')]);}else{logger['info'](_0x9b66('0xd'),_0x4b5383,'request\x20sent');_0x4ab1bf(_0x2a2302[_0x9b66('0x15')][_0x9b66('0x14')]);}})['catch'](function(_0xa21e45){logger[_0x9b66('0x12')](_0x9b66('0xd'),_0x4b5383,_0xa21e45);_0x27bc06(_0xa21e45);});});}exports['CreateWhatsappQueueReport']=function(_0x4fddf5){var _0x331cee=this;return new Promise(function(_0x49fe58,_0x46bbc8){return db[_0x9b66('0x16')][_0x9b66('0x17')](_0x4fddf5[_0x9b66('0x18')],{'raw':_0x4fddf5[_0x9b66('0x19')]?_0x4fddf5['options'][_0x9b66('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x2dd51e){logger[_0x9b66('0xc')]('CreateWhatsappQueueReport',_0x4fddf5);logger[_0x9b66('0xf')](_0x9b66('0x1b'),_0x4fddf5,JSON[_0x9b66('0x11')](_0x2dd51e));_0x49fe58(_0x2dd51e);})[_0x9b66('0x1c')](function(_0x3f8bd0){logger['error'](_0x9b66('0x1b'),_0x3f8bd0[_0x9b66('0x14')],_0x4fddf5);_0x46bbc8(_0x331cee[_0x9b66('0x12')](0x1f4,_0x3f8bd0[_0x9b66('0x14')]));});});};exports['UpdateWhatsappQueueReport']=function(_0xb12316){var _0x2654b8=this;return new Promise(function(_0x140070,_0x577699){return db[_0x9b66('0x16')]['update'](_0xb12316[_0x9b66('0x18')],{'raw':_0xb12316[_0x9b66('0x19')]?_0xb12316[_0x9b66('0x19')][_0x9b66('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xb12316['options']?_0xb12316['options'][_0x9b66('0x1d')]||null:null,'attributes':_0xb12316[_0x9b66('0x19')]?_0xb12316[_0x9b66('0x19')][_0x9b66('0x1e')]||null:null,'limit':_0xb12316['options']?_0xb12316[_0x9b66('0x19')][_0x9b66('0x1f')]||null:null})['then'](function(_0x33ee63){logger[_0x9b66('0xc')]('UpdateWhatsappQueueReport',_0xb12316);logger[_0x9b66('0xf')](_0x9b66('0x20'),_0xb12316,JSON[_0x9b66('0x11')](_0x33ee63));_0x140070(_0x33ee63);})[_0x9b66('0x1c')](function(_0x38b5fa){logger[_0x9b66('0x12')](_0x9b66('0x20'),_0x38b5fa[_0x9b66('0x14')],_0xb12316);_0x577699(_0x2654b8[_0x9b66('0x12')](0x1f4,_0x38b5fa[_0x9b66('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 16f349f..406ba7c 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 _0x80e5=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','isAuthenticated','describe','/:id','post','create'];(function(_0x421eeb,_0x3d3e3e){var _0x2c7371=function(_0x174b74){while(--_0x174b74){_0x421eeb['push'](_0x421eeb['shift']());}};_0x2c7371(++_0x3d3e3e);}(_0x80e5,0xac));var _0x580e=function(_0x16771d,_0x224c60){_0x16771d=_0x16771d-0x0;var _0x386f11=_0x80e5[_0x16771d];return _0x386f11;};'use strict';var multer=require(_0x580e('0x0'));var util=require(_0x580e('0x1'));var path=require(_0x580e('0x2'));var timeout=require(_0x580e('0x3'));var express=require(_0x580e('0x4'));var router=express[_0x580e('0x5')]();var fs_extra=require(_0x580e('0x6'));var auth=require(_0x580e('0x7'));var interaction=require(_0x580e('0x8'));var config=require(_0x580e('0x9'));var controller=require('./whatsappTransferReport.controller');router[_0x580e('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x580e('0xa')](_0x580e('0xb'),auth[_0x580e('0xc')](),controller[_0x580e('0xd')]);router[_0x580e('0xa')](_0x580e('0xe'),auth[_0x580e('0xc')](),controller['show']);router[_0x580e('0xf')]('/',auth[_0x580e('0xc')](),controller[_0x580e('0x10')]);router['put']('/:id',auth[_0x580e('0xc')](),controller[_0x580e('0x11')]);router[_0x580e('0x12')](_0x580e('0xe'),auth[_0x580e('0xc')](),controller[_0x580e('0x13')]);module[_0x580e('0x14')]=router; \ No newline at end of file +var _0x446b=['util','path','express','Router','fs-extra','../../components/auth/service','./whatsappTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','update','delete','destroy','exports','multer'];(function(_0x156e05,_0x5a89da){var _0x545dbe=function(_0x4cbf02){while(--_0x4cbf02){_0x156e05['push'](_0x156e05['shift']());}};_0x545dbe(++_0x5a89da);}(_0x446b,0x1b8));var _0xb446=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x446b[_0x2b4411];return _0x8e41ef;};'use strict';var multer=require(_0xb446('0x0'));var util=require(_0xb446('0x1'));var path=require(_0xb446('0x2'));var timeout=require('connect-timeout');var express=require(_0xb446('0x3'));var router=express[_0xb446('0x4')]();var fs_extra=require(_0xb446('0x5'));var auth=require(_0xb446('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb446('0x7'));router[_0xb446('0x8')]('/',auth[_0xb446('0x9')](),controller[_0xb446('0xa')]);router[_0xb446('0x8')](_0xb446('0xb'),auth[_0xb446('0x9')](),controller[_0xb446('0xc')]);router[_0xb446('0x8')](_0xb446('0xd'),auth[_0xb446('0x9')](),controller[_0xb446('0xe')]);router[_0xb446('0xf')]('/',auth[_0xb446('0x9')](),controller['create']);router[_0xb446('0x10')](_0xb446('0xd'),auth[_0xb446('0x9')](),controller[_0xb446('0x11')]);router[_0xb446('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xb446('0x13')]);module[_0xb446('0x14')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index e42b73d..2823cac 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 _0x42f4=['STRING','ENUM','account','agent','queue','sequelize'];(function(_0x2508b4,_0x1b1e0f){var _0x181e86=function(_0x1a551e){while(--_0x1a551e){_0x2508b4['push'](_0x2508b4['shift']());}};_0x181e86(++_0x1b1e0f);}(_0x42f4,0x19d));var _0x442f=function(_0x219fa0,_0x18b239){_0x219fa0=_0x219fa0-0x0;var _0xc603fb=_0x42f4[_0x219fa0];return _0xc603fb;};'use strict';var Sequelize=require(_0x442f('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x442f('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x442f('0x2')](_0x442f('0x3'),_0x442f('0x4'),_0x442f('0x5')),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0x7292=['ENUM','account','agent','queue','sequelize','exports','STRING'];(function(_0x492535,_0x46524a){var _0x256620=function(_0x3015f8){while(--_0x3015f8){_0x492535['push'](_0x492535['shift']());}};_0x256620(++_0x46524a);}(_0x7292,0x107));var _0x2729=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x7292[_0x465028];return _0xb783d4;};'use strict';var Sequelize=require(_0x2729('0x0'));module[_0x2729('0x1')]={'uniqueid':{'type':Sequelize[_0x2729('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x2729('0x3')](_0x2729('0x4'),_0x2729('0x5'),_0x2729('0x6')),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index d7a75ba..19d03e3 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 _0xfd46=['intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','rows','catch','params','keys','includeAll','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','ejs','fs-extra','lodash','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','apply','reject','update','then','error','stack','name','index','map','WhatsappTransferReport','rawAttributes','fieldName','model','query'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0xfd46,0x176));var _0x6fd4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfd46[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x6fd4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6fd4('0x1'));var jsonpatch=require(_0x6fd4('0x2'));var rp=require(_0x6fd4('0x3'));var moment=require(_0x6fd4('0x4'));var BPromise=require(_0x6fd4('0x5'));var Mustache=require(_0x6fd4('0x6'));var util=require(_0x6fd4('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x6fd4('0x8'));var fs=require('fs');var fs_extra=require(_0x6fd4('0x9'));var _=require(_0x6fd4('0xa'));var squel=require('squel');var crypto=require(_0x6fd4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x6fd4('0xc'));var toCsv=require(_0x6fd4('0xd'));var querystring=require(_0x6fd4('0xe'));var Papa=require('papaparse');var Redis=require(_0x6fd4('0xf'));var authService=require(_0x6fd4('0x10'));var qs=require(_0x6fd4('0x11'));var as=require(_0x6fd4('0x12'));var hardwareService=require(_0x6fd4('0x13'));var logger=require('../../config/logger')(_0x6fd4('0x14'));var utils=require(_0x6fd4('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x6fd4('0x16'));var db=require(_0x6fd4('0x17'))['db'];function respondWithStatusCode(_0x1e59de,_0x1084ef){_0x1084ef=_0x1084ef||0xcc;return function(_0x9113bb){if(_0x9113bb){return _0x1e59de[_0x6fd4('0x18')](_0x1084ef);}return _0x1e59de[_0x6fd4('0x19')](_0x1084ef)[_0x6fd4('0x1a')]();};}function respondWithResult(_0x44af8e,_0x41c873){_0x41c873=_0x41c873||0xc8;return function(_0x118474){if(_0x118474){return _0x44af8e['status'](_0x41c873)['json'](_0x118474);}};}function respondWithFilteredResult(_0x296de7,_0x3d39ae){return function(_0x43c1ff){if(_0x43c1ff){var _0x29978d=typeof _0x3d39ae[_0x6fd4('0x1b')]===_0x6fd4('0x1c')&&typeof _0x3d39ae[_0x6fd4('0x1d')]===_0x6fd4('0x1c');var _0x3a8390=_0x43c1ff[_0x6fd4('0x1e')];var _0x4d77d3=_0x29978d?0x0:_0x3d39ae[_0x6fd4('0x1b')];var _0x2c956c=_0x29978d?_0x43c1ff['count']:_0x3d39ae['offset']+_0x3d39ae['limit'];var _0x9b9c82;if(_0x2c956c>=_0x3a8390){_0x2c956c=_0x3a8390;_0x9b9c82=0xc8;}else{_0x9b9c82=0xce;}_0x296de7[_0x6fd4('0x19')](_0x9b9c82);return _0x296de7[_0x6fd4('0x1f')]('Content-Range',_0x4d77d3+'-'+_0x2c956c+'/'+_0x3a8390)['json'](_0x43c1ff);}return null;};}function patchUpdates(_0x3d2afc){return function(_0x4b56c5){try{jsonpatch[_0x6fd4('0x20')](_0x4b56c5,_0x3d2afc,!![]);}catch(_0x5e8739){return BPromise[_0x6fd4('0x21')](_0x5e8739);}return _0x4b56c5['save']();};}function saveUpdates(_0x31596b,_0x202410){return function(_0x3fd37b){if(_0x3fd37b){return _0x3fd37b[_0x6fd4('0x22')](_0x31596b)[_0x6fd4('0x23')](function(_0x483dae){return _0x483dae;});}return null;};}function removeEntity(_0x4b3146,_0x7c9470){return function(_0x5b91f9){if(_0x5b91f9){return _0x5b91f9['destroy']()['then'](function(){_0x4b3146[_0x6fd4('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x41399c,_0x3a143f){return function(_0x4746b9){if(!_0x4746b9){_0x41399c[_0x6fd4('0x18')](0x194);}return _0x4746b9;};}function handleError(_0x2d5832,_0x2edfc1){_0x2edfc1=_0x2edfc1||0x1f4;return function(_0x60baa4){logger[_0x6fd4('0x24')](_0x60baa4[_0x6fd4('0x25')]);if(_0x60baa4[_0x6fd4('0x26')]){delete _0x60baa4[_0x6fd4('0x26')];}_0x2d5832[_0x6fd4('0x19')](_0x2edfc1)['send'](_0x60baa4);};}exports[_0x6fd4('0x27')]=function(_0x4b084d,_0x26fb48){var _0x26bd8e={},_0x4e8c0a={},_0xbdb101={'count':0x0,'rows':[]};var _0x24bc9a=_[_0x6fd4('0x28')](db[_0x6fd4('0x29')][_0x6fd4('0x2a')],function(_0x59e3a4){return{'name':_0x59e3a4[_0x6fd4('0x2b')],'type':_0x59e3a4['type']['key']};});_0x4e8c0a[_0x6fd4('0x2c')]=_[_0x6fd4('0x28')](_0x24bc9a,_0x6fd4('0x26'));_0x4e8c0a[_0x6fd4('0x2d')]=_['keys'](_0x4b084d[_0x6fd4('0x2d')]);_0x4e8c0a['filters']=_[_0x6fd4('0x2e')](_0x4e8c0a[_0x6fd4('0x2c')],_0x4e8c0a[_0x6fd4('0x2d')]);_0x26bd8e[_0x6fd4('0x2f')]=_[_0x6fd4('0x2e')](_0x4e8c0a[_0x6fd4('0x2c')],qs[_0x6fd4('0x30')](_0x4b084d[_0x6fd4('0x2d')][_0x6fd4('0x30')]));_0x26bd8e[_0x6fd4('0x2f')]=_0x26bd8e[_0x6fd4('0x2f')][_0x6fd4('0x31')]?_0x26bd8e[_0x6fd4('0x2f')]:_0x4e8c0a[_0x6fd4('0x2c')];if(!_0x4b084d[_0x6fd4('0x2d')][_0x6fd4('0x32')]('nolimit')){_0x26bd8e[_0x6fd4('0x1d')]=qs[_0x6fd4('0x1d')](_0x4b084d[_0x6fd4('0x2d')]['limit']);_0x26bd8e[_0x6fd4('0x1b')]=qs['offset'](_0x4b084d['query'][_0x6fd4('0x1b')]);}_0x26bd8e[_0x6fd4('0x33')]=qs[_0x6fd4('0x34')](_0x4b084d[_0x6fd4('0x2d')][_0x6fd4('0x34')]);_0x26bd8e[_0x6fd4('0x35')]=qs[_0x6fd4('0x36')](_[_0x6fd4('0x37')](_0x4b084d[_0x6fd4('0x2d')],_0x4e8c0a[_0x6fd4('0x36')]),_0x24bc9a);if(_0x4b084d['query'][_0x6fd4('0x38')]){_0x26bd8e[_0x6fd4('0x35')]=_[_0x6fd4('0x39')](_0x26bd8e[_0x6fd4('0x35')],{'$or':_[_0x6fd4('0x28')](_0x24bc9a,function(_0x258aaf){if(_0x258aaf['type']!==_0x6fd4('0x3a')){var _0x290d50={};_0x290d50[_0x258aaf['name']]={'$like':'%'+_0x4b084d[_0x6fd4('0x2d')]['filter']+'%'};return _0x290d50;}})});}_0x26bd8e=_[_0x6fd4('0x39')]({},_0x26bd8e,_0x4b084d[_0x6fd4('0x3b')]);var _0x5c9314={'where':_0x26bd8e[_0x6fd4('0x35')]};return db['WhatsappTransferReport'][_0x6fd4('0x1e')](_0x5c9314)[_0x6fd4('0x23')](function(_0x18d2b0){_0xbdb101[_0x6fd4('0x1e')]=_0x18d2b0;if(_0x4b084d['query']['includeAll']){_0x26bd8e[_0x6fd4('0x3c')]=[{'all':!![]}];}return db['WhatsappTransferReport']['findAll'](_0x26bd8e);})[_0x6fd4('0x23')](function(_0x358ade){_0xbdb101[_0x6fd4('0x3d')]=_0x358ade;return _0xbdb101;})[_0x6fd4('0x23')](respondWithFilteredResult(_0x26fb48,_0x26bd8e))[_0x6fd4('0x3e')](handleError(_0x26fb48,null));};exports['show']=function(_0x33d570,_0x169d41){var _0xdccba8={'raw':!![],'where':{'id':_0x33d570[_0x6fd4('0x3f')]['id']}},_0x34ed9e={};_0x34ed9e[_0x6fd4('0x2c')]=_[_0x6fd4('0x40')](db[_0x6fd4('0x29')]['rawAttributes']);_0x34ed9e['query']=_['keys'](_0x33d570['query']);_0x34ed9e[_0x6fd4('0x36')]=_['intersection'](_0x34ed9e['model'],_0x34ed9e[_0x6fd4('0x2d')]);_0xdccba8[_0x6fd4('0x2f')]=_[_0x6fd4('0x2e')](_0x34ed9e[_0x6fd4('0x2c')],qs[_0x6fd4('0x30')](_0x33d570[_0x6fd4('0x2d')]['fields']));_0xdccba8[_0x6fd4('0x2f')]=_0xdccba8['attributes'][_0x6fd4('0x31')]?_0xdccba8['attributes']:_0x34ed9e[_0x6fd4('0x2c')];if(_0x33d570['query'][_0x6fd4('0x41')]){_0xdccba8[_0x6fd4('0x3c')]=[{'all':!![]}];}_0xdccba8=_[_0x6fd4('0x39')]({},_0xdccba8,_0x33d570[_0x6fd4('0x3b')]);return db[_0x6fd4('0x29')][_0x6fd4('0x42')](_0xdccba8)[_0x6fd4('0x23')](handleEntityNotFound(_0x169d41,null))[_0x6fd4('0x23')](respondWithResult(_0x169d41,null))['catch'](handleError(_0x169d41,null));};exports[_0x6fd4('0x43')]=function(_0x2e85e4,_0x433f7b){return db['WhatsappTransferReport']['create'](_0x2e85e4[_0x6fd4('0x44')],{})['then'](respondWithResult(_0x433f7b,0xc9))[_0x6fd4('0x3e')](handleError(_0x433f7b,null));};exports['update']=function(_0x55172c,_0x4bed16){if(_0x55172c[_0x6fd4('0x44')]['id']){delete _0x55172c[_0x6fd4('0x44')]['id'];}return db['WhatsappTransferReport'][_0x6fd4('0x42')]({'where':{'id':_0x55172c[_0x6fd4('0x3f')]['id']}})[_0x6fd4('0x23')](handleEntityNotFound(_0x4bed16,null))[_0x6fd4('0x23')](saveUpdates(_0x55172c[_0x6fd4('0x44')],null))[_0x6fd4('0x23')](respondWithResult(_0x4bed16,null))['catch'](handleError(_0x4bed16,null));};exports['destroy']=function(_0xbdbb78,_0x28d3c5){return db[_0x6fd4('0x29')][_0x6fd4('0x42')]({'where':{'id':_0xbdbb78[_0x6fd4('0x3f')]['id']}})[_0x6fd4('0x23')](handleEntityNotFound(_0x28d3c5,null))[_0x6fd4('0x23')](removeEntity(_0x28d3c5,null))[_0x6fd4('0x3e')](handleError(_0x28d3c5,null));};exports[_0x6fd4('0x45')]=function(_0x34848c,_0x33753c){return db[_0x6fd4('0x29')]['describe']()[_0x6fd4('0x23')](respondWithResult(_0x33753c,null))['catch'](handleError(_0x33753c,null));}; \ No newline at end of file +var _0x9cab=['name','query','keys','filters','intersection','attributes','model','fields','length','nolimit','order','sort','where','filter','type','VIRTUAL','merge','options','WhatsappTransferReport','include','findAll','rows','catch','show','includeAll','create','update','body','find','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','destroy','error','stack','send','index','map','rawAttributes','fieldName','key'];(function(_0x431c26,_0x4b8f47){var _0x3092fd=function(_0x4dca59){while(--_0x4dca59){_0x431c26['push'](_0x431c26['shift']());}};_0x3092fd(++_0x4b8f47);}(_0x9cab,0x1e7));var _0xb9ca=function(_0x1f3e1f,_0x41bae1){_0x1f3e1f=_0x1f3e1f-0x0;var _0x5f51e8=_0x9cab[_0x1f3e1f];return _0x5f51e8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb9ca('0x0'));var zipdir=require(_0xb9ca('0x1'));var jsonpatch=require(_0xb9ca('0x2'));var rp=require(_0xb9ca('0x3'));var moment=require(_0xb9ca('0x4'));var BPromise=require(_0xb9ca('0x5'));var Mustache=require('mustache');var util=require(_0xb9ca('0x6'));var path=require(_0xb9ca('0x7'));var sox=require('sox');var csv=require(_0xb9ca('0x8'));var ejs=require(_0xb9ca('0x9'));var fs=require('fs');var fs_extra=require(_0xb9ca('0xa'));var _=require(_0xb9ca('0xb'));var squel=require(_0xb9ca('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xb9ca('0xd'));var toCsv=require(_0xb9ca('0x8'));var querystring=require(_0xb9ca('0xe'));var Papa=require(_0xb9ca('0xf'));var Redis=require('ioredis');var authService=require(_0xb9ca('0x10'));var qs=require(_0xb9ca('0x11'));var as=require(_0xb9ca('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb9ca('0x13'))(_0xb9ca('0x14'));var utils=require('../../config/utils');var config=require(_0xb9ca('0x15'));var licenseUtil=require(_0xb9ca('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xd11dc9,_0x5125bc){_0x5125bc=_0x5125bc||0xcc;return function(_0x17bb09){if(_0x17bb09){return _0xd11dc9[_0xb9ca('0x17')](_0x5125bc);}return _0xd11dc9['status'](_0x5125bc)[_0xb9ca('0x18')]();};}function respondWithResult(_0x4619af,_0x1e7c82){_0x1e7c82=_0x1e7c82||0xc8;return function(_0x3e0156){if(_0x3e0156){return _0x4619af[_0xb9ca('0x19')](_0x1e7c82)[_0xb9ca('0x1a')](_0x3e0156);}};}function respondWithFilteredResult(_0x3dd1c8,_0x13b178){return function(_0x556f62){if(_0x556f62){var _0x51f7e0=typeof _0x13b178[_0xb9ca('0x1b')]===_0xb9ca('0x1c')&&typeof _0x13b178[_0xb9ca('0x1d')]===_0xb9ca('0x1c');var _0xf4e7ac=_0x556f62[_0xb9ca('0x1e')];var _0x4f45e5=_0x51f7e0?0x0:_0x13b178['offset'];var _0x502ee2=_0x51f7e0?_0x556f62[_0xb9ca('0x1e')]:_0x13b178[_0xb9ca('0x1b')]+_0x13b178[_0xb9ca('0x1d')];var _0x499a73;if(_0x502ee2>=_0xf4e7ac){_0x502ee2=_0xf4e7ac;_0x499a73=0xc8;}else{_0x499a73=0xce;}_0x3dd1c8[_0xb9ca('0x19')](_0x499a73);return _0x3dd1c8[_0xb9ca('0x1f')](_0xb9ca('0x20'),_0x4f45e5+'-'+_0x502ee2+'/'+_0xf4e7ac)[_0xb9ca('0x1a')](_0x556f62);}return null;};}function patchUpdates(_0x209ac5){return function(_0x5135e7){try{jsonpatch['apply'](_0x5135e7,_0x209ac5,!![]);}catch(_0x1c6349){return BPromise[_0xb9ca('0x21')](_0x1c6349);}return _0x5135e7[_0xb9ca('0x22')]();};}function saveUpdates(_0x4ae27a,_0x5156f3){return function(_0x1e9427){if(_0x1e9427){return _0x1e9427['update'](_0x4ae27a)[_0xb9ca('0x23')](function(_0x139d40){return _0x139d40;});}return null;};}function removeEntity(_0x414afe,_0x2f8fce){return function(_0x40779e){if(_0x40779e){return _0x40779e[_0xb9ca('0x24')]()[_0xb9ca('0x23')](function(){_0x414afe[_0xb9ca('0x19')](0xcc)[_0xb9ca('0x18')]();});}};}function handleEntityNotFound(_0xdfc6eb,_0x43db30){return function(_0x5991b4){if(!_0x5991b4){_0xdfc6eb[_0xb9ca('0x17')](0x194);}return _0x5991b4;};}function handleError(_0x26ed4b,_0x42e81a){_0x42e81a=_0x42e81a||0x1f4;return function(_0x3e69b0){logger[_0xb9ca('0x25')](_0x3e69b0[_0xb9ca('0x26')]);if(_0x3e69b0['name']){delete _0x3e69b0['name'];}_0x26ed4b[_0xb9ca('0x19')](_0x42e81a)[_0xb9ca('0x27')](_0x3e69b0);};}exports[_0xb9ca('0x28')]=function(_0x3f2474,_0x5a983e){var _0x2bf5bd={},_0x39c916={},_0x14aeb8={'count':0x0,'rows':[]};var _0x5e1e28=_[_0xb9ca('0x29')](db['WhatsappTransferReport'][_0xb9ca('0x2a')],function(_0x25a5cd){return{'name':_0x25a5cd[_0xb9ca('0x2b')],'type':_0x25a5cd['type'][_0xb9ca('0x2c')]};});_0x39c916['model']=_[_0xb9ca('0x29')](_0x5e1e28,_0xb9ca('0x2d'));_0x39c916[_0xb9ca('0x2e')]=_[_0xb9ca('0x2f')](_0x3f2474[_0xb9ca('0x2e')]);_0x39c916[_0xb9ca('0x30')]=_[_0xb9ca('0x31')](_0x39c916['model'],_0x39c916[_0xb9ca('0x2e')]);_0x2bf5bd[_0xb9ca('0x32')]=_['intersection'](_0x39c916[_0xb9ca('0x33')],qs[_0xb9ca('0x34')](_0x3f2474[_0xb9ca('0x2e')][_0xb9ca('0x34')]));_0x2bf5bd[_0xb9ca('0x32')]=_0x2bf5bd['attributes'][_0xb9ca('0x35')]?_0x2bf5bd[_0xb9ca('0x32')]:_0x39c916['model'];if(!_0x3f2474[_0xb9ca('0x2e')]['hasOwnProperty'](_0xb9ca('0x36'))){_0x2bf5bd['limit']=qs[_0xb9ca('0x1d')](_0x3f2474[_0xb9ca('0x2e')][_0xb9ca('0x1d')]);_0x2bf5bd[_0xb9ca('0x1b')]=qs[_0xb9ca('0x1b')](_0x3f2474[_0xb9ca('0x2e')][_0xb9ca('0x1b')]);}_0x2bf5bd[_0xb9ca('0x37')]=qs['sort'](_0x3f2474[_0xb9ca('0x2e')][_0xb9ca('0x38')]);_0x2bf5bd[_0xb9ca('0x39')]=qs[_0xb9ca('0x30')](_['pick'](_0x3f2474[_0xb9ca('0x2e')],_0x39c916[_0xb9ca('0x30')]),_0x5e1e28);if(_0x3f2474[_0xb9ca('0x2e')][_0xb9ca('0x3a')]){_0x2bf5bd[_0xb9ca('0x39')]=_['merge'](_0x2bf5bd[_0xb9ca('0x39')],{'$or':_[_0xb9ca('0x29')](_0x5e1e28,function(_0xdcde75){if(_0xdcde75[_0xb9ca('0x3b')]!==_0xb9ca('0x3c')){var _0x35c059={};_0x35c059[_0xdcde75[_0xb9ca('0x2d')]]={'$like':'%'+_0x3f2474[_0xb9ca('0x2e')][_0xb9ca('0x3a')]+'%'};return _0x35c059;}})});}_0x2bf5bd=_[_0xb9ca('0x3d')]({},_0x2bf5bd,_0x3f2474[_0xb9ca('0x3e')]);var _0xb3d549={'where':_0x2bf5bd['where']};return db[_0xb9ca('0x3f')][_0xb9ca('0x1e')](_0xb3d549)['then'](function(_0x3e1986){_0x14aeb8['count']=_0x3e1986;if(_0x3f2474[_0xb9ca('0x2e')]['includeAll']){_0x2bf5bd[_0xb9ca('0x40')]=[{'all':!![]}];}return db[_0xb9ca('0x3f')][_0xb9ca('0x41')](_0x2bf5bd);})['then'](function(_0x30acaf){_0x14aeb8[_0xb9ca('0x42')]=_0x30acaf;return _0x14aeb8;})[_0xb9ca('0x23')](respondWithFilteredResult(_0x5a983e,_0x2bf5bd))[_0xb9ca('0x43')](handleError(_0x5a983e,null));};exports[_0xb9ca('0x44')]=function(_0x42281a,_0x174605){var _0x57a85e={'raw':!![],'where':{'id':_0x42281a['params']['id']}},_0x2c9d1f={};_0x2c9d1f[_0xb9ca('0x33')]=_[_0xb9ca('0x2f')](db[_0xb9ca('0x3f')][_0xb9ca('0x2a')]);_0x2c9d1f['query']=_[_0xb9ca('0x2f')](_0x42281a[_0xb9ca('0x2e')]);_0x2c9d1f[_0xb9ca('0x30')]=_['intersection'](_0x2c9d1f[_0xb9ca('0x33')],_0x2c9d1f[_0xb9ca('0x2e')]);_0x57a85e['attributes']=_[_0xb9ca('0x31')](_0x2c9d1f[_0xb9ca('0x33')],qs[_0xb9ca('0x34')](_0x42281a[_0xb9ca('0x2e')]['fields']));_0x57a85e[_0xb9ca('0x32')]=_0x57a85e[_0xb9ca('0x32')][_0xb9ca('0x35')]?_0x57a85e[_0xb9ca('0x32')]:_0x2c9d1f[_0xb9ca('0x33')];if(_0x42281a['query'][_0xb9ca('0x45')]){_0x57a85e[_0xb9ca('0x40')]=[{'all':!![]}];}_0x57a85e=_[_0xb9ca('0x3d')]({},_0x57a85e,_0x42281a[_0xb9ca('0x3e')]);return db[_0xb9ca('0x3f')]['find'](_0x57a85e)[_0xb9ca('0x23')](handleEntityNotFound(_0x174605,null))[_0xb9ca('0x23')](respondWithResult(_0x174605,null))[_0xb9ca('0x43')](handleError(_0x174605,null));};exports[_0xb9ca('0x46')]=function(_0x7607f7,_0x1fba3a){return db[_0xb9ca('0x3f')]['create'](_0x7607f7['body'],{})[_0xb9ca('0x23')](respondWithResult(_0x1fba3a,0xc9))[_0xb9ca('0x43')](handleError(_0x1fba3a,null));};exports[_0xb9ca('0x47')]=function(_0x10de42,_0x3f1283){if(_0x10de42[_0xb9ca('0x48')]['id']){delete _0x10de42[_0xb9ca('0x48')]['id'];}return db[_0xb9ca('0x3f')][_0xb9ca('0x49')]({'where':{'id':_0x10de42[_0xb9ca('0x4a')]['id']}})[_0xb9ca('0x23')](handleEntityNotFound(_0x3f1283,null))[_0xb9ca('0x23')](saveUpdates(_0x10de42[_0xb9ca('0x48')],null))[_0xb9ca('0x23')](respondWithResult(_0x3f1283,null))[_0xb9ca('0x43')](handleError(_0x3f1283,null));};exports[_0xb9ca('0x24')]=function(_0x211fc8,_0x5a7f32){return db['WhatsappTransferReport'][_0xb9ca('0x49')]({'where':{'id':_0x211fc8['params']['id']}})[_0xb9ca('0x23')](handleEntityNotFound(_0x5a7f32,null))[_0xb9ca('0x23')](removeEntity(_0x5a7f32,null))[_0xb9ca('0x43')](handleError(_0x5a7f32,null));};exports['describe']=function(_0x5e44b1,_0x2c76ed){return db[_0xb9ca('0x3f')][_0xb9ca('0x4b')]()[_0xb9ca('0x23')](respondWithResult(_0x2c76ed,null))[_0xb9ca('0x43')](handleError(_0x2c76ed,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 332143e..3e32aad 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 _0x108b=['define','report_whatsapp_transfer','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./whatsappTransferReport.attributes'];(function(_0x7d324f,_0x33cd55){var _0x4c54db=function(_0xf6a52c){while(--_0xf6a52c){_0x7d324f['push'](_0x7d324f['shift']());}};_0x4c54db(++_0x33cd55);}(_0x108b,0xb2));var _0xb108=function(_0x5b5cde,_0x1f7c5f){_0x5b5cde=_0x5b5cde-0x0;var _0x364ad2=_0x108b[_0x5b5cde];return _0x364ad2;};'use strict';var _=require(_0xb108('0x0'));var util=require(_0xb108('0x1'));var logger=require('../../config/logger')(_0xb108('0x2'));var moment=require(_0xb108('0x3'));var BPromise=require(_0xb108('0x4'));var rp=require(_0xb108('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb108('0x6'));var config=require(_0xb108('0x7'));var attributes=require(_0xb108('0x8'));module['exports']=function(_0x16d645,_0x4f9d9b){return _0x16d645[_0xb108('0x9')]('WhatsappTransferReport',attributes,{'tableName':_0xb108('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xe566=['bluebird','request-promise','path','rimraf','../../config/environment','./whatsappTransferReport.attributes','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','../../config/logger','api'];(function(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_0xe566,0xf4));var _0x6e56=function(_0x48f5a6,_0x35da91){_0x48f5a6=_0x48f5a6-0x0;var _0x4924c0=_0xe566[_0x48f5a6];return _0x4924c0;};'use strict';var _=require(_0x6e56('0x0'));var util=require('util');var logger=require(_0x6e56('0x1'))(_0x6e56('0x2'));var moment=require('moment');var BPromise=require(_0x6e56('0x3'));var rp=require(_0x6e56('0x4'));var fs=require('fs');var path=require(_0x6e56('0x5'));var rimraf=require(_0x6e56('0x6'));var config=require(_0x6e56('0x7'));var attributes=require(_0x6e56('0x8'));module['exports']=function(_0x13c2b,_0x48f8d0){return _0x13c2b[_0x6e56('0x9')](_0x6e56('0xa'),attributes,{'tableName':_0x6e56('0xb'),'paranoid':![],'indexes':[{'name':_0x6e56('0xc'),'fields':[_0x6e56('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 898f0c6..fed7146 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 _0x301a=['info','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','WhatsappTransferReport,\x20%s,\x20%s','message','lodash','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x229b0a,_0x2f0fb6){var _0x51796b=function(_0x465665){while(--_0x465665){_0x229b0a['push'](_0x229b0a['shift']());}};_0x51796b(++_0x2f0fb6);}(_0x301a,0xf1));var _0xa301=function(_0x29e8fb,_0x169e3c){_0x29e8fb=_0x29e8fb-0x0;var _0x21c0df=_0x301a[_0x29e8fb];return _0x21c0df;};'use strict';var _=require(_0xa301('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa301('0x1'));var fs=require('fs');var Redis=require(_0xa301('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xa301('0x3'));var logger=require(_0xa301('0x4'))(_0xa301('0x5'));var config=require(_0xa301('0x6'));var jayson=require(_0xa301('0x7'));var client=jayson[_0xa301('0x8')][_0xa301('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x151995,_0x513977,_0x29c68c){return new BPromise(function(_0x331189,_0x1051b8){return client[_0xa301('0xa')](_0x151995,_0x29c68c)['then'](function(_0xadc720){logger[_0xa301('0xb')]('WhatsappTransferReport,\x20%s,\x20%s',_0x513977,'request\x20sent');logger['debug'](_0xa301('0xc'),_0x513977,_0xa301('0xd'),JSON['stringify'](_0xadc720));if(_0xadc720[_0xa301('0xe')]){if(_0xadc720['error'][_0xa301('0xf')]===0x1f4){logger[_0xa301('0xe')](_0xa301('0x10'),_0x513977,_0xadc720[_0xa301('0xe')]['message']);return _0x1051b8(_0xadc720[_0xa301('0xe')]['message']);}logger[_0xa301('0xe')](_0xa301('0x10'),_0x513977,_0xadc720[_0xa301('0xe')]['message']);return _0x331189(_0xadc720[_0xa301('0xe')]['message']);}else{logger['info']('WhatsappTransferReport,\x20%s,\x20%s',_0x513977,_0xa301('0xd'));_0x331189(_0xadc720['result'][_0xa301('0x11')]);}})['catch'](function(_0x81e527){logger[_0xa301('0xe')](_0xa301('0x10'),_0x513977,_0x81e527);_0x1051b8(_0x81e527);});});} \ No newline at end of file +var _0x84ef=['../../config/logger','rpc','../../config/environment','jayson/promise','request','info','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','error','message','WhatsappTransferReport,\x20%s,\x20%s','result','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x320acf,_0x35d0d8){var _0x53a9dc=function(_0x5c240a){while(--_0x5c240a){_0x320acf['push'](_0x320acf['shift']());}};_0x53a9dc(++_0x35d0d8);}(_0x84ef,0x1d5));var _0xf84e=function(_0x3b5606,_0x1ad54b){_0x3b5606=_0x3b5606-0x0;var _0x228cc3=_0x84ef[_0x3b5606];return _0x228cc3;};'use strict';var _=require('lodash');var util=require(_0xf84e('0x0'));var moment=require(_0xf84e('0x1'));var BPromise=require(_0xf84e('0x2'));var rs=require(_0xf84e('0x3'));var fs=require('fs');var Redis=require(_0xf84e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf84e('0x5'));var logger=require(_0xf84e('0x6'))(_0xf84e('0x7'));var config=require(_0xf84e('0x8'));var jayson=require(_0xf84e('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x12d495,_0x128a7c,_0x21fa60){return new BPromise(function(_0x57819f,_0x21bd01){return client[_0xf84e('0xa')](_0x12d495,_0x21fa60)['then'](function(_0xcb1392){logger[_0xf84e('0xb')]('WhatsappTransferReport,\x20%s,\x20%s',_0x128a7c,_0xf84e('0xc'));logger[_0xf84e('0xd')](_0xf84e('0xe'),_0x128a7c,_0xf84e('0xc'),JSON['stringify'](_0xcb1392));if(_0xcb1392['error']){if(_0xcb1392[_0xf84e('0xf')]['code']===0x1f4){logger[_0xf84e('0xf')]('WhatsappTransferReport,\x20%s,\x20%s',_0x128a7c,_0xcb1392['error'][_0xf84e('0x10')]);return _0x21bd01(_0xcb1392[_0xf84e('0xf')][_0xf84e('0x10')]);}logger[_0xf84e('0xf')]('WhatsappTransferReport,\x20%s,\x20%s',_0x128a7c,_0xcb1392['error']['message']);return _0x57819f(_0xcb1392[_0xf84e('0xf')][_0xf84e('0x10')]);}else{logger[_0xf84e('0xb')](_0xf84e('0x11'),_0x128a7c,_0xf84e('0xc'));_0x57819f(_0xcb1392[_0xf84e('0x12')][_0xf84e('0x10')]);}})['catch'](function(_0x2b9246){logger['error'](_0xf84e('0x11'),_0x128a7c,_0x2b9246);_0x21bd01(_0x2b9246);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 0ee5b6d..bbe8d12 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3937=['./config/seedDB','./config/license','./config/environment','app','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','./config/schedule/cloud-provider','sequelize','sync','then','default','start','info','length','\x20processes\x20failed\x20at\x20startup:\x20','map','pm2_env','Online\x20apps:','filter','online','name','join','Offline\x20apps:','status','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','exit','lodash'];(function(_0x2b3dfe,_0x2e9db2){var _0xe18ef1=function(_0x109e43){while(--_0x109e43){_0x2b3dfe['push'](_0x2b3dfe['shift']());}};_0xe18ef1(++_0x2e9db2);}(_0x3937,0xbf));var _0x7393=function(_0x4f33c3,_0x5562d3){_0x4f33c3=_0x4f33c3-0x0;var _0x3d46ac=_0x3937[_0x4f33c3];return _0x3d46ac;};'use strict';var _=require(_0x7393('0x0'));var db=require('./mysqldb')['db'];var seedDb=require(_0x7393('0x1'));var checkLicense=require(_0x7393('0x2'));var rpc=require('./rpc');var config=require(_0x7393('0x3'));var logger=require('./config/logger')(_0x7393('0x4'));var pm2=require('./config/pm2');var pm2Config=require(_0x7393('0x5'));var schedule=require(_0x7393('0x6'));var chat=require(_0x7393('0x7'));var whatsapp=require(_0x7393('0x8'));var transcribe=require(_0x7393('0x9'));var provider=require(_0x7393('0xa'));function main(){return db[_0x7393('0xb')][_0x7393('0xc')]()[_0x7393('0xd')](function(){if(config['seedDB']){return seedDb['default']();}})[_0x7393('0xd')](function(){return checkLicense[_0x7393('0xe')]();})[_0x7393('0xd')](function(){return rpc['listen']();})[_0x7393('0xd')](function(_0x5f0dd5){logger['info'](_0x5f0dd5);return chat['start']();})['then'](function(){return whatsapp[_0x7393('0xf')]();})[_0x7393('0xd')](function(){return schedule[_0x7393('0xf')]();})['then'](function(){return transcribe[_0x7393('0xf')]();})[_0x7393('0xd')](function(){return provider[_0x7393('0xf')]();})[_0x7393('0xd')](function(_0xe86cf4){logger[_0x7393('0x10')](_0xe86cf4);return pm2[_0x7393('0xf')](pm2Config);})[_0x7393('0xd')](function(_0x11030d){var _0x4e521c=_0x11030d['filter'](function(_0x414c37){return typeof _0x414c37['exitCode']==='number'&&_0x414c37['exitCode']>=0x0;});if(_0x4e521c[_0x7393('0x11')]>0x0){throw new Error(_0x4e521c['length']+_0x7393('0x12')+_[_0x7393('0x13')](_0x4e521c,function(_0x5b8b03){return'\x22'+_0x5b8b03[_0x7393('0x14')]['name']+'\x22';}));}logger['info'](_0x7393('0x15'),_[_0x7393('0x13')](_[_0x7393('0x16')](_0x11030d,{'status':_0x7393('0x17')}),_0x7393('0x18'))[_0x7393('0x19')]());logger[_0x7393('0x10')](_0x7393('0x1a'),_['map'](_['filter'](_0x11030d,function(_0x30eae3){return _0x30eae3[_0x7393('0x1b')]!==_0x7393('0x17');}),_0x7393('0x18'))[_0x7393('0x19')]()||'None');console['log']('App\x20Ready!');})[_0x7393('0x1c')](function(_0x5b5ca9){console['log'](_0x7393('0x1d'),_0x5b5ca9);logger[_0x7393('0x1e')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x5b5ca9);process[_0x7393('0x1f')](0x1);});}main(); \ No newline at end of file +var _0x5fc3=['then','seedDB','default','start','info','exitCode','number','length','\x20processes\x20failed\x20at\x20startup:\x20','pm2_env','Online\x20apps:','map','online','name','join','Offline\x20apps:','filter','status','None','log','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','exit','lodash','./mysqldb','./config/license','./rpc','./config/environment','./config/logger','app','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/cloud-provider','sync'];(function(_0x580cf8,_0x26751e){var _0xcc9a9e=function(_0x5a67ad){while(--_0x5a67ad){_0x580cf8['push'](_0x580cf8['shift']());}};_0xcc9a9e(++_0x26751e);}(_0x5fc3,0xa8));var _0x35fc=function(_0x2aa0e7,_0x4e5145){_0x2aa0e7=_0x2aa0e7-0x0;var _0x1472c0=_0x5fc3[_0x2aa0e7];return _0x1472c0;};'use strict';var _=require(_0x35fc('0x0'));var db=require(_0x35fc('0x1'))['db'];var seedDb=require('./config/seedDB');var checkLicense=require(_0x35fc('0x2'));var rpc=require(_0x35fc('0x3'));var config=require(_0x35fc('0x4'));var logger=require(_0x35fc('0x5'))(_0x35fc('0x6'));var pm2=require('./config/pm2');var pm2Config=require(_0x35fc('0x7'));var schedule=require(_0x35fc('0x8'));var chat=require(_0x35fc('0x9'));var whatsapp=require('./config/schedule/whatsapp');var transcribe=require('./config/schedule/transcribe');var provider=require(_0x35fc('0xa'));function main(){return db['sequelize'][_0x35fc('0xb')]()[_0x35fc('0xc')](function(){if(config[_0x35fc('0xd')]){return seedDb[_0x35fc('0xe')]();}})[_0x35fc('0xc')](function(){return checkLicense[_0x35fc('0xe')]();})[_0x35fc('0xc')](function(){return rpc['listen']();})[_0x35fc('0xc')](function(_0x2a1084){logger['info'](_0x2a1084);return chat[_0x35fc('0xf')]();})[_0x35fc('0xc')](function(){return whatsapp['start']();})[_0x35fc('0xc')](function(){return schedule[_0x35fc('0xf')]();})['then'](function(){return transcribe['start']();})[_0x35fc('0xc')](function(){return provider['start']();})[_0x35fc('0xc')](function(_0x22055e){logger[_0x35fc('0x10')](_0x22055e);return pm2[_0x35fc('0xf')](pm2Config);})[_0x35fc('0xc')](function(_0x5cfe94){var _0x59507a=_0x5cfe94['filter'](function(_0x558364){return typeof _0x558364[_0x35fc('0x11')]===_0x35fc('0x12')&&_0x558364[_0x35fc('0x11')]>=0x0;});if(_0x59507a[_0x35fc('0x13')]>0x0){throw new Error(_0x59507a[_0x35fc('0x13')]+_0x35fc('0x14')+_['map'](_0x59507a,function(_0x26ba54){return'\x22'+_0x26ba54[_0x35fc('0x15')]['name']+'\x22';}));}logger[_0x35fc('0x10')](_0x35fc('0x16'),_[_0x35fc('0x17')](_['filter'](_0x5cfe94,{'status':_0x35fc('0x18')}),_0x35fc('0x19'))[_0x35fc('0x1a')]());logger['info'](_0x35fc('0x1b'),_[_0x35fc('0x17')](_[_0x35fc('0x1c')](_0x5cfe94,function(_0x251a1f){return _0x251a1f[_0x35fc('0x1d')]!==_0x35fc('0x18');}),_0x35fc('0x19'))[_0x35fc('0x1a')]()||_0x35fc('0x1e'));console[_0x35fc('0x1f')]('App\x20Ready!');})[_0x35fc('0x20')](function(_0xd5399f){console[_0x35fc('0x1f')](_0x35fc('0x21'),_0xd5399f);logger[_0x35fc('0x22')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0xd5399f);process[_0x35fc('0x23')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index e31a0d4..da108e6 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 _0xe145=['Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','Sequelize','length','splice','encryptString','join','promisify','sign','secret','payload','verify','randomBytes','toString','now','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','express-jwt','composable-middleware','basic-auth','bluebird','util','moment','secrets','session','fullname','name','internal','email','userpic','permissions','md5secret','chatPause','mailPause','faxPause','openchannelPause','pauseType','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','phoneBarAutoAnswerDelay','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','hotdesk','settingsEnabled','wssPort','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','isChatInteractionAuthorized','user','findOne','closed','then','status','disposition','unmanaged','json','Unmanaged.','Forbidden.','catch','isAuthenticated','use','headers','authorization','startsWith','User','find','pass','Bearer','Unknown\x20authorization\x20format','query','getUuid','apikey','Setting','allowedLoginAttempts','blockDuration','isEqual','apiKeyNonce','nonce','Invalid\x20API\x20access\x20key','blocked','blockedAt','add','minutes','User\x20not\x20found.','canUpdate','getLicense','update','Forbidden','isWebrtcLicence','webrtc','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','redirect','/dashboards/general','send','retrieveApiKey','isNil','apiKeyIat','generateApiKey','regenerateApiKey'];(function(_0x25301d,_0x5f33b3){var _0x543c37=function(_0x192172){while(--_0x192172){_0x25301d['push'](_0x25301d['shift']());}};_0x543c37(++_0x5f33b3);}(_0xe145,0x10b));var _0x5e14=function(_0x11e7d8,_0x125e63){_0x11e7d8=_0x11e7d8-0x0;var _0x1eddfa=_0xe145[_0x11e7d8];return _0x1eddfa;};'use strict';var db=require(_0x5e14('0x0'))['db'];var config=require(_0x5e14('0x1'));var hardwareConf=require(_0x5e14('0x2'));var licenseUtil=require(_0x5e14('0x3'));var encryptor=require('../encryptor');var _=require('lodash');var jwt=require('jsonwebtoken');var expressJwt=require(_0x5e14('0x4'));var compose=require(_0x5e14('0x5'));var basicAuth=require(_0x5e14('0x6'));var crypto=require('crypto');var BPromise=require(_0x5e14('0x7'));var util=require(_0x5e14('0x8'));var moment=require(_0x5e14('0x9'));var validateJwt=expressJwt({'secret':config[_0x5e14('0xa')][_0x5e14('0xb')]});var userAttributes=['id','role',_0x5e14('0xc'),_0x5e14('0xd'),_0x5e14('0xe'),_0x5e14('0xf'),_0x5e14('0x10'),_0x5e14('0x11'),_0x5e14('0x12'),'voicePause',_0x5e14('0x13'),_0x5e14('0x14'),_0x5e14('0x15'),'smsPause',_0x5e14('0x16'),_0x5e14('0x17'),'showWebBar',_0x5e14('0x18'),_0x5e14('0x19'),_0x5e14('0x1a'),_0x5e14('0x1b'),_0x5e14('0x1c'),'alias','phoneBarAutoAnswer',_0x5e14('0x1d'),'phoneBarDnd','phoneBarEnableRecording',_0x5e14('0x1e'),_0x5e14('0x1f'),_0x5e14('0x20'),_0x5e14('0x21'),_0x5e14('0x22'),'phoneBarRemoteControlPort',_0x5e14('0x23'),'interface','userProfileId','privacyEnabled',_0x5e14('0x24'),_0x5e14('0x25'),'downloadVoiceRecordings',_0x5e14('0x26'),_0x5e14('0x27'),_0x5e14('0x28'),_0x5e14('0x29')];exports[_0x5e14('0x2a')]=function(){return this['isAuthenticated'](!![])['use'](function(_0x3fe5c7,_0x40196c,_0x233246){if(_0x3fe5c7[_0x5e14('0x2b')]){_0x233246();}else{return db['ChatInteraction'][_0x5e14('0x2c')]({'where':{'id':_0x3fe5c7['params']['id']},'attributes':['id',_0x5e14('0x2d'),'disposition'],'raw':!![]})[_0x5e14('0x2e')](function(_0x2cc737){if(_0x2cc737&&_0x2cc737[_0x5e14('0x2d')]){return _0x40196c[_0x5e14('0x2f')](_0x2cc737[_0x5e14('0x30')]===_0x5e14('0x31')?0x195:0x193)[_0x5e14('0x32')]({'message':_0x2cc737['disposition']==='unmanaged'?_0x5e14('0x33'):_0x5e14('0x34')});}else{_0x233246();}})[_0x5e14('0x35')](function(_0x3e391d){_0x233246(_0x3e391d);});}});};exports[_0x5e14('0x36')]=function isAuthenticated(_0x2de0d3){return compose()[_0x5e14('0x37')](function(_0x4cc8cf,_0x35354c,_0x573398){var _0x1fcabe;if(_0x4cc8cf[_0x5e14('0x38')][_0x5e14('0x39')]){if(_[_0x5e14('0x3a')](_0x4cc8cf['headers']['authorization'],'Basic')){var _0x18b20f=basicAuth(_0x4cc8cf);db[_0x5e14('0x3b')][_0x5e14('0x3c')]({'where':{'name':_0x18b20f[_0x5e14('0xd')]}})[_0x5e14('0x2e')](function(_0x44ad59){if(!_0x44ad59||!_0x44ad59['authenticate'](_0x18b20f[_0x5e14('0x3d')])){return _0x35354c[_0x5e14('0x2f')](0x191)[_0x5e14('0x32')]({'message':'Wrong\x20credentials.'});}_0x4cc8cf[_0x5e14('0x2b')]={'id':_0x44ad59['id']};_0x573398();})[_0x5e14('0x35')](function(_0x298d55){_0x573398(_0x298d55);});}else if(_[_0x5e14('0x3a')](_0x4cc8cf[_0x5e14('0x38')][_0x5e14('0x39')],_0x5e14('0x3e'))){validateJwt(_0x4cc8cf,_0x35354c,_0x573398);}else{if(_0x2de0d3){_0x573398();}else{return _0x35354c[_0x5e14('0x2f')](0x193)[_0x5e14('0x32')]({'message':_0x5e14('0x3f')});}}}else if(_0x4cc8cf[_0x5e14('0x40')]['apikey']){try{var _0x1f6626={'audience':hardwareConf[_0x5e14('0x41')](),'issuer':hardwareConf[_0x5e14('0x41')]()};verifyJwt(_0x4cc8cf['query'][_0x5e14('0x42')],_0x1f6626)[_0x5e14('0x2e')](function(_0x4891c4){return db[_0x5e14('0x3b')][_0x5e14('0x3c')]({'where':{'id':_0x4891c4['sub']}})[_0x5e14('0x2e')](function(_0xbe3f42){_0x1fcabe=_0xbe3f42;return db[_0x5e14('0x43')]['findOne']({'where':{'id':0x1},'attributes':[_0x5e14('0x44'),_0x5e14('0x45')],'raw':!![]});})['then'](function(_0x5a4db1){if(!_0x1fcabe||!_[_0x5e14('0x46')](_0x1fcabe[_0x5e14('0x47')],_0x4891c4[_0x5e14('0x48')])){return _0x35354c[_0x5e14('0x2f')](0x191)['json']({'message':'API\x20access\x20key\x20is\x20not\x20valid\x20anymore'});}if(_0x1fcabe['disabled']){return _0x35354c[_0x5e14('0x2f')](0x191)[_0x5e14('0x32')]({'message':_0x5e14('0x49')});}if(_0x1fcabe[_0x5e14('0x4a')]){if(_0x5a4db1[_0x5e14('0x45')]>0x0){if(moment(_0x1fcabe[_0x5e14('0x4b')])[_0x5e14('0x4c')](_0x5a4db1[_0x5e14('0x45')],_0x5e14('0x4d'))>moment()){return _0x35354c[_0x5e14('0x2f')](0x191)[_0x5e14('0x32')]({'message':_0x5e14('0x49')});}}else{return _0x35354c[_0x5e14('0x2f')](0x191)[_0x5e14('0x32')]({'message':_0x5e14('0x49')});}}_0x4cc8cf['user']={'id':_0x1fcabe['id']};_0x573398();});})[_0x5e14('0x35')](function(){return _0x35354c[_0x5e14('0x2f')](0x191)[_0x5e14('0x32')]({'message':_0x5e14('0x49')});});}catch(_0xef3f5f){_0x573398(_0xef3f5f);}}else if(_0x2de0d3){_0x573398();}else{return _0x35354c[_0x5e14('0x2f')](0x193)['json']({'message':_0x5e14('0x3f')});}})['use'](function(_0x4b5eb6,_0x204f44,_0xe6146e){if(_0x4b5eb6[_0x5e14('0x2b')]){db['User']['find']({'where':{'id':_0x4b5eb6[_0x5e14('0x2b')]['id']},'attributes':userAttributes})[_0x5e14('0x2e')](function(_0x27ce1b){if(!_0x27ce1b){return _0x204f44[_0x5e14('0x2f')](0x194)[_0x5e14('0x32')]({'message':_0x5e14('0x4e')});}_0x4b5eb6[_0x5e14('0x2b')]=_0x27ce1b;_0xe6146e();})[_0x5e14('0x35')](function(_0x490784){_0xe6146e(_0x490784);});}else if(_0x2de0d3){_0xe6146e();}else{return _0x204f44[_0x5e14('0x2f')](0x194)['json']({'message':'User\x20object\x20not\x20found.'});}});};exports[_0x5e14('0x4f')]=function canUpdate(){return compose()[_0x5e14('0x37')](function(_0x3f233f,_0x56cb96,_0x31b58c){return licenseUtil[_0x5e14('0x50')]()[_0x5e14('0x2e')](function(_0x2ab29c){if(_0x2ab29c[_0x5e14('0x51')]){_0x31b58c();}else{return _0x56cb96['status'](0x193)[_0x5e14('0x32')]({'message':_0x5e14('0x52')});}})[_0x5e14('0x35')](function(_0xb04e50){_0x31b58c(_0xb04e50);});});};exports[_0x5e14('0x53')]=function isWebrtcLicence(){return compose()[_0x5e14('0x37')](function(_0x36bc1f,_0x4550f6,_0x2c17d9){return licenseUtil[_0x5e14('0x50')]()[_0x5e14('0x2e')](function(_0x5f1082){if(_0x5f1082[_0x5e14('0x54')]){_0x2c17d9();}else{return _0x4550f6['status'](0x193)['json']({'message':_0x5e14('0x52')});}})[_0x5e14('0x35')](function(_0x41f9ac){_0x2c17d9(_0x41f9ac);});});};exports[_0x5e14('0x55')]=function(_0x41f438,_0x24e67,_0x4c9ee5){_0x41f438[_0x5e14('0x55')]=!![];return _0x4c9ee5();};exports[_0x5e14('0x56')]=function signToken(_0x3408a2){return signJwt(_0x3408a2);};exports[_0x5e14('0x57')]=function(_0x52bb13,_0x43de74){if(!_0x52bb13[_0x5e14('0x2b')]){return _0x43de74[_0x5e14('0x2f')](0x194)['json']({'message':_0x5e14('0x58')});}var _0x4ff08e={'payload':{'id':_0x52bb13[_0x5e14('0x2b')]['id'],'role':_0x52bb13[_0x5e14('0x2b')]['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x4ff08e)[_0x5e14('0x2e')](function(_0x4acd4e){_0x43de74[_0x5e14('0x59')](_0x5e14('0x5a'),_0x4acd4e);_0x43de74[_0x5e14('0x5b')](_0x5e14('0x5c'));})[_0x5e14('0x35')](function(_0x23ac32){return _0x43de74[_0x5e14('0x2f')](0x1f4)[_0x5e14('0x5d')](_0x23ac32);});};exports[_0x5e14('0x5e')]=function(_0x1662a1){if(_[_0x5e14('0x5f')](_0x1662a1['apiKeyNonce'])||_[_0x5e14('0x5f')](_0x1662a1[_0x5e14('0x60')])){return null;}else{return createJwt(_0x1662a1);}};exports[_0x5e14('0x61')]=function(_0x492f78){_0x492f78['apiKeyNonce']=generateNonce();_0x492f78['apiKeyIat']=generateIssuedAt();return createJwt(_0x492f78);};exports[_0x5e14('0x62')]=function(_0x4a322b,_0xd3c835){var _0x375d3b=_0x4a322b[_0x5e14('0x40')][_0x5e14('0x42')];if(_0x375d3b){var _0x5b9b7f={'nonce':_0xd3c835[_0x5e14('0x47')],'iat':_0xd3c835['apiKeyIat'],'audience':hardwareConf[_0x5e14('0x41')](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x375d3b,_0x5b9b7f)[_0x5e14('0x2e')](function(){return generateApiKey(_0xd3c835);});}else{throw{'message':_0x5e14('0x63')};}};exports['validatePasswordPattern']=function(_0x1f5466){var _0x288388=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x288388['test'](_0x1f5466))throw new db['Sequelize'][(_0x5e14('0x64'))](_0x5e14('0x65'));return;};exports['validatePasswordHistory']=function(_0x241f43,_0x9e3647,_0x1e8d20){var _0x3a6716=encryptor[_0x5e14('0x66')](_0x9e3647)[_0x5e14('0x67')](',');for(var _0x151402=0x0;_0x151402<_0x1e8d20;_0x151402++){if(!_0x3a6716[_0x151402])break;if(_0x241f43[_0x5e14('0x68')]()===_0x3a6716[_0x151402]['toLowerCase']()){var _0x4b5d53=util[_0x5e14('0x69')](_0x5e14('0x6a'),_0x1e8d20);if(_0x1e8d20===0x1){_0x4b5d53=_0x5e14('0x6b');}throw new db[(_0x5e14('0x6c'))]['ValidationError'](_0x4b5d53);}}return;};exports['updatePasswordsHistory']=function(_0xaa6136,_0x5d5134){var _0x29874a=_0x5d5134?encryptor['decryptString'](_0x5d5134)[_0x5e14('0x67')](','):[];if(_0x29874a[_0x5e14('0x6d')]===0x5){_0x29874a[_0x5e14('0x6e')](-0x1,0x1);}_0x29874a['unshift'](_0xaa6136);return encryptor[_0x5e14('0x6f')](_0x29874a[_0x5e14('0x70')](','));};function signJwt(_0x2aed42){var _0x3886cb=BPromise[_0x5e14('0x71')](jwt[_0x5e14('0x72')],{'context':jwt});var _0x411c1d=_0x2aed42[_0x5e14('0x73')]||config[_0x5e14('0xa')][_0x5e14('0xb')];return new BPromise(function(_0x5b064b,_0x1e14f4){_0x3886cb(_0x2aed42[_0x5e14('0x74')],_0x411c1d,_0x2aed42['options'])[_0x5e14('0x2e')](function(_0x1b2e92){_0x5b064b(_0x1b2e92);})[_0x5e14('0x35')](function(_0x43ea1a){_0x1e14f4(_0x43ea1a);});});}function verifyJwt(_0x2f5afc,_0x2ec24a,_0x427eac){var _0x3e9f9b=BPromise[_0x5e14('0x71')](jwt[_0x5e14('0x75')],{'context':jwt});var _0x4db4fb=_0x427eac||config[_0x5e14('0xa')][_0x5e14('0xb')];return new BPromise(function(_0x23e8c2,_0x1e1bbc){_0x3e9f9b(_0x2f5afc,_0x4db4fb,_0x2ec24a)[_0x5e14('0x2e')](function(_0x2b6237){_0x23e8c2(_0x2b6237);})[_0x5e14('0x35')](function(_0x1c931f){_0x1e1bbc(_0x1c931f);});});}function generateNonce(){return crypto[_0x5e14('0x76')](0x10)[_0x5e14('0x77')]('hex');}function generateIssuedAt(){return Math['floor'](Date[_0x5e14('0x78')]()/0x3e8)[_0x5e14('0x77')]();}function createJwt(_0x1c0e80){var _0x5242fc={'payload':{'iat':_0x1c0e80[_0x5e14('0x60')],'nonce':_0x1c0e80[_0x5e14('0x47')]},'options':{'algorithm':_0x5e14('0x79'),'subject':_0x1c0e80['id'][_0x5e14('0x77')](),'issuer':hardwareConf[_0x5e14('0x41')](),'audience':hardwareConf['getUuid']()}};return signJwt(_0x5242fc)['then'](function(_0x1c3ff3){return{'iat':_0x1c0e80[_0x5e14('0x60')],'nonce':_0x1c0e80[_0x5e14('0x47')],'token':_0x1c3ff3};});} \ No newline at end of file +var _0xda79=['now','toString','HS512','../../mysqldb','../../config/environment','../../config/license/util','lodash','jsonwebtoken','express-jwt','basic-auth','crypto','bluebird','util','moment','secrets','session','name','email','userpic','permissions','md5secret','voicePause','chatPause','faxPause','smsPause','openchannelPause','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','settingsEnabled','wssPort','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','isChatInteractionAuthorized','isAuthenticated','use','user','findOne','params','closed','disposition','then','status','unmanaged','headers','authorization','startsWith','User','find','authenticate','json','Wrong\x20credentials.','catch','Bearer','Unknown\x20authorization\x20format','query','apikey','getUuid','sub','Setting','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','blockDuration','blockedAt','add','minutes','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','update','Forbidden','webrtc','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','role','motion.token','redirect','/dashboards/general','retrieveApiKey','isNil','apiKeyNonce','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','Sequelize','ValidationError','validatePasswordHistory','decryptString','split','toLowerCase','format','updatePasswordsHistory','length','splice','unshift','promisify','sign','payload','options','verify','randomBytes','floor'];(function(_0x1a2918,_0x57d781){var _0x35b0de=function(_0x304c44){while(--_0x304c44){_0x1a2918['push'](_0x1a2918['shift']());}};_0x35b0de(++_0x57d781);}(_0xda79,0x82));var _0x9da7=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xda79[_0x2dafbe];return _0x58a45a;};'use strict';var db=require(_0x9da7('0x0'))['db'];var config=require(_0x9da7('0x1'));var hardwareConf=require('../../config/license/hardware');var licenseUtil=require(_0x9da7('0x2'));var encryptor=require('../encryptor');var _=require(_0x9da7('0x3'));var jwt=require(_0x9da7('0x4'));var expressJwt=require(_0x9da7('0x5'));var compose=require('composable-middleware');var basicAuth=require(_0x9da7('0x6'));var crypto=require(_0x9da7('0x7'));var BPromise=require(_0x9da7('0x8'));var util=require(_0x9da7('0x9'));var moment=require(_0x9da7('0xa'));var validateJwt=expressJwt({'secret':config[_0x9da7('0xb')][_0x9da7('0xc')]});var userAttributes=['id','role','fullname',_0x9da7('0xd'),'internal',_0x9da7('0xe'),_0x9da7('0xf'),_0x9da7('0x10'),_0x9da7('0x11'),_0x9da7('0x12'),_0x9da7('0x13'),'mailPause',_0x9da7('0x14'),_0x9da7('0x15'),_0x9da7('0x16'),'pauseType',_0x9da7('0x17'),_0x9da7('0x18'),_0x9da7('0x19'),_0x9da7('0x1a'),_0x9da7('0x1b'),_0x9da7('0x1c'),_0x9da7('0x1d'),_0x9da7('0x1e'),'phoneBarAutoAnswerDelay',_0x9da7('0x1f'),_0x9da7('0x20'),_0x9da7('0x21'),'phoneBarEnableSettings',_0x9da7('0x22'),_0x9da7('0x23'),_0x9da7('0x24'),_0x9da7('0x25'),_0x9da7('0x26'),_0x9da7('0x27'),_0x9da7('0x28'),'privacyEnabled',_0x9da7('0x29'),_0x9da7('0x2a'),'downloadVoiceRecordings',_0x9da7('0x2b'),_0x9da7('0x2c'),_0x9da7('0x2d'),_0x9da7('0x2e')];exports[_0x9da7('0x2f')]=function(){return this[_0x9da7('0x30')](!![])[_0x9da7('0x31')](function(_0x4a9c9c,_0x5d752a,_0x1839d8){if(_0x4a9c9c[_0x9da7('0x32')]){_0x1839d8();}else{return db['ChatInteraction'][_0x9da7('0x33')]({'where':{'id':_0x4a9c9c[_0x9da7('0x34')]['id']},'attributes':['id',_0x9da7('0x35'),_0x9da7('0x36')],'raw':!![]})[_0x9da7('0x37')](function(_0x49cb0a){if(_0x49cb0a&&_0x49cb0a[_0x9da7('0x35')]){return _0x5d752a[_0x9da7('0x38')](_0x49cb0a[_0x9da7('0x36')]==='unmanaged'?0x195:0x193)['json']({'message':_0x49cb0a['disposition']===_0x9da7('0x39')?'Unmanaged.':'Forbidden.'});}else{_0x1839d8();}})['catch'](function(_0x1110a9){_0x1839d8(_0x1110a9);});}});};exports[_0x9da7('0x30')]=function isAuthenticated(_0x309b1f){return compose()[_0x9da7('0x31')](function(_0x2c77cc,_0x386573,_0x4cea2f){var _0x252373;if(_0x2c77cc[_0x9da7('0x3a')][_0x9da7('0x3b')]){if(_[_0x9da7('0x3c')](_0x2c77cc['headers'][_0x9da7('0x3b')],'Basic')){var _0x33d3f8=basicAuth(_0x2c77cc);db[_0x9da7('0x3d')][_0x9da7('0x3e')]({'where':{'name':_0x33d3f8[_0x9da7('0xd')]}})[_0x9da7('0x37')](function(_0x2c52cc){if(!_0x2c52cc||!_0x2c52cc[_0x9da7('0x3f')](_0x33d3f8['pass'])){return _0x386573[_0x9da7('0x38')](0x191)[_0x9da7('0x40')]({'message':_0x9da7('0x41')});}_0x2c77cc['user']={'id':_0x2c52cc['id']};_0x4cea2f();})[_0x9da7('0x42')](function(_0x10a052){_0x4cea2f(_0x10a052);});}else if(_[_0x9da7('0x3c')](_0x2c77cc[_0x9da7('0x3a')][_0x9da7('0x3b')],_0x9da7('0x43'))){validateJwt(_0x2c77cc,_0x386573,_0x4cea2f);}else{if(_0x309b1f){_0x4cea2f();}else{return _0x386573[_0x9da7('0x38')](0x193)['json']({'message':_0x9da7('0x44')});}}}else if(_0x2c77cc[_0x9da7('0x45')][_0x9da7('0x46')]){try{var _0x2a3020={'audience':hardwareConf[_0x9da7('0x47')](),'issuer':hardwareConf[_0x9da7('0x47')]()};verifyJwt(_0x2c77cc[_0x9da7('0x45')][_0x9da7('0x46')],_0x2a3020)[_0x9da7('0x37')](function(_0x192848){return db[_0x9da7('0x3d')][_0x9da7('0x3e')]({'where':{'id':_0x192848[_0x9da7('0x48')]}})[_0x9da7('0x37')](function(_0x1f2c11){_0x252373=_0x1f2c11;return db[_0x9da7('0x49')]['findOne']({'where':{'id':0x1},'attributes':['allowedLoginAttempts','blockDuration'],'raw':!![]});})['then'](function(_0x3bf1a2){if(!_0x252373||!_['isEqual'](_0x252373['apiKeyNonce'],_0x192848['nonce'])){return _0x386573[_0x9da7('0x38')](0x191)[_0x9da7('0x40')]({'message':_0x9da7('0x4a')});}if(_0x252373[_0x9da7('0x4b')]){return _0x386573[_0x9da7('0x38')](0x191)[_0x9da7('0x40')]({'message':_0x9da7('0x4c')});}if(_0x252373[_0x9da7('0x4d')]){if(_0x3bf1a2[_0x9da7('0x4e')]>0x0){if(moment(_0x252373[_0x9da7('0x4f')])[_0x9da7('0x50')](_0x3bf1a2['blockDuration'],_0x9da7('0x51'))>moment()){return _0x386573[_0x9da7('0x38')](0x191)[_0x9da7('0x40')]({'message':_0x9da7('0x4c')});}}else{return _0x386573['status'](0x191)[_0x9da7('0x40')]({'message':_0x9da7('0x4c')});}}_0x2c77cc[_0x9da7('0x32')]={'id':_0x252373['id']};_0x4cea2f();});})[_0x9da7('0x42')](function(){return _0x386573[_0x9da7('0x38')](0x191)['json']({'message':_0x9da7('0x4c')});});}catch(_0x33b491){_0x4cea2f(_0x33b491);}}else if(_0x309b1f){_0x4cea2f();}else{return _0x386573['status'](0x193)[_0x9da7('0x40')]({'message':'Unknown\x20authorization\x20format'});}})[_0x9da7('0x31')](function(_0x39e590,_0x224550,_0x3248b1){if(_0x39e590[_0x9da7('0x32')]){db['User'][_0x9da7('0x3e')]({'where':{'id':_0x39e590[_0x9da7('0x32')]['id']},'attributes':userAttributes})[_0x9da7('0x37')](function(_0x3266ef){if(!_0x3266ef){return _0x224550[_0x9da7('0x38')](0x194)[_0x9da7('0x40')]({'message':_0x9da7('0x52')});}_0x39e590[_0x9da7('0x32')]=_0x3266ef;_0x3248b1();})[_0x9da7('0x42')](function(_0x5176fc){_0x3248b1(_0x5176fc);});}else if(_0x309b1f){_0x3248b1();}else{return _0x224550[_0x9da7('0x38')](0x194)[_0x9da7('0x40')]({'message':_0x9da7('0x53')});}});};exports[_0x9da7('0x54')]=function canUpdate(){return compose()[_0x9da7('0x31')](function(_0x41bed6,_0xadbb03,_0x49e83c){return licenseUtil[_0x9da7('0x55')]()[_0x9da7('0x37')](function(_0x1610d8){if(_0x1610d8[_0x9da7('0x56')]){_0x49e83c();}else{return _0xadbb03[_0x9da7('0x38')](0x193)['json']({'message':_0x9da7('0x57')});}})[_0x9da7('0x42')](function(_0x4b4369){_0x49e83c(_0x4b4369);});});};exports['isWebrtcLicence']=function isWebrtcLicence(){return compose()[_0x9da7('0x31')](function(_0x4d4aac,_0xc0c8d4,_0xac9f0b){return licenseUtil[_0x9da7('0x55')]()[_0x9da7('0x37')](function(_0xbe441e){if(_0xbe441e[_0x9da7('0x58')]){_0xac9f0b();}else{return _0xc0c8d4[_0x9da7('0x38')](0x193)[_0x9da7('0x40')]({'message':'Forbidden'});}})[_0x9da7('0x42')](function(_0x3d70c5){_0xac9f0b(_0x3d70c5);});});};exports[_0x9da7('0x59')]=function(_0x168c99,_0x2bba56,_0x2e631e){_0x168c99[_0x9da7('0x59')]=!![];return _0x2e631e();};exports[_0x9da7('0x5a')]=function signToken(_0x2868f9){return signJwt(_0x2868f9);};exports[_0x9da7('0x5b')]=function(_0x12cae5,_0x3f82d4){if(!_0x12cae5['user']){return _0x3f82d4[_0x9da7('0x38')](0x194)[_0x9da7('0x40')]({'message':_0x9da7('0x5c')});}var _0x3055a2={'payload':{'id':_0x12cae5[_0x9da7('0x32')]['id'],'role':_0x12cae5[_0x9da7('0x32')][_0x9da7('0x5d')]},'options':{'expiresIn':0x15180}};return signJwt(_0x3055a2)['then'](function(_0x476894){_0x3f82d4['cookie'](_0x9da7('0x5e'),_0x476894);_0x3f82d4[_0x9da7('0x5f')](_0x9da7('0x60'));})[_0x9da7('0x42')](function(_0x2a2749){return _0x3f82d4['status'](0x1f4)['send'](_0x2a2749);});};exports[_0x9da7('0x61')]=function(_0x5e0d20){if(_[_0x9da7('0x62')](_0x5e0d20[_0x9da7('0x63')])||_['isNil'](_0x5e0d20[_0x9da7('0x64')])){return null;}else{return createJwt(_0x5e0d20);}};exports[_0x9da7('0x65')]=function(_0x1fb650){_0x1fb650[_0x9da7('0x63')]=generateNonce();_0x1fb650['apiKeyIat']=generateIssuedAt();return createJwt(_0x1fb650);};exports[_0x9da7('0x66')]=function(_0x2a4b5c,_0x5f403c){var _0x59fb9c=_0x2a4b5c['query'][_0x9da7('0x46')];if(_0x59fb9c){var _0x536c46={'nonce':_0x5f403c[_0x9da7('0x63')],'iat':_0x5f403c[_0x9da7('0x64')],'audience':hardwareConf[_0x9da7('0x47')](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x59fb9c,_0x536c46)[_0x9da7('0x37')](function(){return generateApiKey(_0x5f403c);});}else{throw{'message':_0x9da7('0x67')};}};exports[_0x9da7('0x68')]=function(_0x5bd4b8){var _0x4aebbd=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x4aebbd[_0x9da7('0x69')](_0x5bd4b8))throw new db[(_0x9da7('0x6a'))][(_0x9da7('0x6b'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');return;};exports[_0x9da7('0x6c')]=function(_0x1eb147,_0x376ab0,_0x2301df){var _0x17eb85=encryptor[_0x9da7('0x6d')](_0x376ab0)[_0x9da7('0x6e')](',');for(var _0x1bae47=0x0;_0x1bae47<_0x2301df;_0x1bae47++){if(!_0x17eb85[_0x1bae47])break;if(_0x1eb147[_0x9da7('0x6f')]()===_0x17eb85[_0x1bae47]['toLowerCase']()){var _0x343f5b=util[_0x9da7('0x70')]('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0x2301df);if(_0x2301df===0x1){_0x343f5b='The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.';}throw new db['Sequelize'][(_0x9da7('0x6b'))](_0x343f5b);}}return;};exports[_0x9da7('0x71')]=function(_0x50341a,_0x63ddeb){var _0x250332=_0x63ddeb?encryptor['decryptString'](_0x63ddeb)[_0x9da7('0x6e')](','):[];if(_0x250332[_0x9da7('0x72')]===0x5){_0x250332[_0x9da7('0x73')](-0x1,0x1);}_0x250332[_0x9da7('0x74')](_0x50341a);return encryptor['encryptString'](_0x250332['join'](','));};function signJwt(_0x4efdda){var _0x4d1522=BPromise[_0x9da7('0x75')](jwt[_0x9da7('0x76')],{'context':jwt});var _0x53cc03=_0x4efdda['secret']||config['secrets'][_0x9da7('0xc')];return new BPromise(function(_0x1e5688,_0x407427){_0x4d1522(_0x4efdda[_0x9da7('0x77')],_0x53cc03,_0x4efdda[_0x9da7('0x78')])[_0x9da7('0x37')](function(_0x4b6166){_0x1e5688(_0x4b6166);})['catch'](function(_0x5aba67){_0x407427(_0x5aba67);});});}function verifyJwt(_0x301668,_0x1a14f6,_0x4fdbb3){var _0x313dbc=BPromise[_0x9da7('0x75')](jwt[_0x9da7('0x79')],{'context':jwt});var _0x2b606f=_0x4fdbb3||config['secrets'][_0x9da7('0xc')];return new BPromise(function(_0x2d6b45,_0x15f3b3){_0x313dbc(_0x301668,_0x2b606f,_0x1a14f6)[_0x9da7('0x37')](function(_0x5874d2){_0x2d6b45(_0x5874d2);})[_0x9da7('0x42')](function(_0x1f14b9){_0x15f3b3(_0x1f14b9);});});}function generateNonce(){return crypto[_0x9da7('0x7a')](0x10)['toString']('hex');}function generateIssuedAt(){return Math[_0x9da7('0x7b')](Date[_0x9da7('0x7c')]()/0x3e8)[_0x9da7('0x7d')]();}function createJwt(_0x10a51c){var _0x474605={'payload':{'iat':_0x10a51c[_0x9da7('0x64')],'nonce':_0x10a51c['apiKeyNonce']},'options':{'algorithm':_0x9da7('0x7e'),'subject':_0x10a51c['id'][_0x9da7('0x7d')](),'issuer':hardwareConf[_0x9da7('0x47')](),'audience':hardwareConf[_0x9da7('0x47')]()}};return signJwt(_0x474605)[_0x9da7('0x37')](function(_0x47ef8b){return{'iat':_0x10a51c[_0x9da7('0x64')],'nonce':_0x10a51c[_0x9da7('0x63')],'token':_0x47ef8b};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index 703e0c9..b76446b 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 _0xa381=['test','getCiphers','filter','indexOf','hasOwnProperty','encryptFile','createWriteStream','data','update','binary','end','close','unlink','decryptFile','createReadStream','createDecipher','write','encryptString','secret','createCipher','utf8','base64','final','decryptString','crypto','lodash','../../config/environment','../../config/logger','app','secrets','session','aes192','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa381,0xf6));var _0x1a38=function(_0x3f55a9,_0x4f946c){_0x3f55a9=_0x3f55a9-0x0;var _0x14b097=_0xa381[_0x3f55a9];return _0x14b097;};'use strict';var crypto=require(_0x1a38('0x0'));var fs=require('fs');var BPromise=require('bluebird');var _=require(_0x1a38('0x1'));var config=require(_0x1a38('0x2'));var logger=require(_0x1a38('0x3'))(_0x1a38('0x4'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x1a38('0x5')][_0x1a38('0x6')],'algorithm':'aes-256-ctr'};const fileOptions={'algorithm':_0x1a38('0x7')};if(config['encrypt']&&config[_0x1a38('0x8')][_0x1a38('0x9')]){var isSupported=isAlgorithmSupported(config[_0x1a38('0x8')][_0x1a38('0x9')]);if(isSupported){fileOptions[_0x1a38('0x9')]=config[_0x1a38('0x8')][_0x1a38('0x9')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x1a38('0xa')](',\x20');logger[_0x1a38('0xb')](config[_0x1a38('0x8')][_0x1a38('0x9')],_0x1a38('0xc'),supportedAlgorithms);}}function isASupportedCipher(_0x4fe81c){return AES_SUPPORTED_RX[_0x1a38('0xd')](_0x4fe81c);}function getSupportedCiphers(){return crypto[_0x1a38('0xe')]()[_0x1a38('0xf')](isASupportedCipher);}function isAlgorithmSupported(_0x3d144f){return getSupportedCiphers()[_0x1a38('0x10')](_0x3d144f)>-0x1;}function combineOptions(_0xdc5068){var _0x1f6df8={};for(var _0x2e4c2b in fileOptions){if(fileOptions['hasOwnProperty'](_0x2e4c2b)){_0x1f6df8[_0x2e4c2b]=fileOptions[_0x2e4c2b];}}if(_0xdc5068){for(var _0x7fc03 in _0xdc5068){if(_0xdc5068[_0x1a38('0x11')](_0x7fc03)){_0x1f6df8[_0x7fc03]=_0xdc5068[_0x7fc03];}}}return _0x1f6df8;}exports[_0x1a38('0x12')]=function(_0x54b6b7,_0x35d986,_0x1ef716,_0x523337){return new BPromise(function(_0x3ae749,_0x149f29){_0x523337=combineOptions(_0x523337);var _0x595247=new Buffer(_0x1ef716);var _0xe710d8=fs['createReadStream'](_0x54b6b7);var _0x1a7c4f=fs[_0x1a38('0x13')](_0x35d986);var _0x5b7d59=crypto['createCipher'](_0x523337[_0x1a38('0x9')],_0x595247);_0xe710d8['on'](_0x1a38('0x14'),function(_0x2b12d9){var _0x293f9a=new Buffer(_0x5b7d59[_0x1a38('0x15')](_0x2b12d9),_0x1a38('0x16'));_0x1a7c4f['write'](_0x293f9a);});_0xe710d8['on']('end',function(){try{var _0x48560d=new Buffer(_0x5b7d59['final'](_0x1a38('0x16')),_0x1a38('0x16'));_0x1a7c4f['write'](_0x48560d);_0x1a7c4f[_0x1a38('0x17')]();_0x1a7c4f['on'](_0x1a38('0x18'),function(){return _0x3ae749(_0x35d986);});}catch(_0x4cf0a7){fs[_0x1a38('0x19')](_0x35d986);return _0x149f29(_0x4cf0a7);}});});};exports[_0x1a38('0x1a')]=function(_0x1ac7c9,_0x1313b5,_0x74dda8,_0xc93c68){return new BPromise(function(_0x3fe886,_0x8348c9){_0xc93c68=combineOptions(_0xc93c68);var _0x146a4b=new Buffer(_0x74dda8);var _0x5847fb=fs[_0x1a38('0x1b')](_0x1ac7c9);var _0x2b394f=fs[_0x1a38('0x13')](_0x1313b5);var _0x162cef=crypto[_0x1a38('0x1c')](_0xc93c68[_0x1a38('0x9')],_0x146a4b);_0x5847fb['on'](_0x1a38('0x14'),function(_0x527419){var _0xdec893=new Buffer(_0x162cef[_0x1a38('0x15')](_0x527419),'binary');_0x2b394f['write'](_0xdec893);});_0x5847fb['on'](_0x1a38('0x17'),function(){try{var _0x5e5709=new Buffer(_0x162cef['final'](_0x1a38('0x16')),'binary');_0x2b394f[_0x1a38('0x1d')](_0x5e5709);_0x2b394f[_0x1a38('0x17')]();_0x2b394f['on'](_0x1a38('0x18'),function(){return _0x3fe886(_0x1313b5);});}catch(_0x3b9554){fs[_0x1a38('0x19')](_0x1313b5);return _0x8348c9(_0x3b9554);}});});};exports[_0x1a38('0x1e')]=function(_0x4d92d7,_0x275580,_0x223443){var _0x4d2424=_0x223443||stringOptions[_0x1a38('0x9')];var _0x3aa2a3=_0x275580||stringOptions[_0x1a38('0x1f')];var _0x3d92b1=crypto[_0x1a38('0x20')](_0x4d2424,_0x3aa2a3);var _0x3fbbbe=_0x3d92b1[_0x1a38('0x15')](_0x4d92d7,_0x1a38('0x21'),_0x1a38('0x22'));_0x3fbbbe+=_0x3d92b1[_0x1a38('0x23')](_0x1a38('0x22'));return _0x3fbbbe;};exports[_0x1a38('0x24')]=function(_0x10e6cb,_0x5ed5fc,_0x44e7aa){var _0x5a0e5d=_0x44e7aa||stringOptions[_0x1a38('0x9')];var _0x4ff13f=_0x5ed5fc||stringOptions[_0x1a38('0x1f')];var _0x51ed7e=crypto['createDecipher'](_0x5a0e5d,_0x4ff13f);var _0x59a9ce=_0x51ed7e[_0x1a38('0x15')](_0x10e6cb,_0x1a38('0x22'),'utf8');_0x59a9ce+=_0x51ed7e[_0x1a38('0x23')]('utf8');return _0x59a9ce;}; \ No newline at end of file +var _0xec3b=['algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','indexOf','hasOwnProperty','createCipher','data','binary','end','write','close','unlink','decryptFile','createReadStream','createWriteStream','createDecipher','update','final','encryptString','utf8','base64','decryptString','secret','crypto','lodash','../../config/environment','../../config/logger','secrets','session','aes-256-ctr','aes192','encrypt'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0xec3b,0x10f));var _0xbec3=function(_0x478d2f,_0x5c98a1){_0x478d2f=_0x478d2f-0x0;var _0x44844e=_0xec3b[_0x478d2f];return _0x44844e;};'use strict';var crypto=require(_0xbec3('0x0'));var fs=require('fs');var BPromise=require('bluebird');var _=require(_0xbec3('0x1'));var config=require(_0xbec3('0x2'));var logger=require(_0xbec3('0x3'))('app');const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0xbec3('0x4')][_0xbec3('0x5')],'algorithm':_0xbec3('0x6')};const fileOptions={'algorithm':_0xbec3('0x7')};if(config[_0xbec3('0x8')]&&config[_0xbec3('0x8')][_0xbec3('0x9')]){var isSupported=isAlgorithmSupported(config[_0xbec3('0x8')][_0xbec3('0x9')]);if(isSupported){fileOptions[_0xbec3('0x9')]=config[_0xbec3('0x8')][_0xbec3('0x9')];}else{var supportedAlgorithms=getSupportedCiphers()[_0xbec3('0xa')](',\x20');logger[_0xbec3('0xb')](config['encrypt'][_0xbec3('0x9')],_0xbec3('0xc'),supportedAlgorithms);}}function isASupportedCipher(_0x5221c4){return AES_SUPPORTED_RX[_0xbec3('0xd')](_0x5221c4);}function getSupportedCiphers(){return crypto[_0xbec3('0xe')]()['filter'](isASupportedCipher);}function isAlgorithmSupported(_0xbd032a){return getSupportedCiphers()[_0xbec3('0xf')](_0xbd032a)>-0x1;}function combineOptions(_0x55560d){var _0x52dbbd={};for(var _0x3e6ff9 in fileOptions){if(fileOptions[_0xbec3('0x10')](_0x3e6ff9)){_0x52dbbd[_0x3e6ff9]=fileOptions[_0x3e6ff9];}}if(_0x55560d){for(var _0x212a08 in _0x55560d){if(_0x55560d[_0xbec3('0x10')](_0x212a08)){_0x52dbbd[_0x212a08]=_0x55560d[_0x212a08];}}}return _0x52dbbd;}exports['encryptFile']=function(_0x33ac52,_0x3120c1,_0x4806b2,_0x531943){return new BPromise(function(_0x2da27d,_0x3faf96){_0x531943=combineOptions(_0x531943);var _0x138290=new Buffer(_0x4806b2);var _0x3b2abe=fs['createReadStream'](_0x33ac52);var _0x187a07=fs['createWriteStream'](_0x3120c1);var _0x336731=crypto[_0xbec3('0x11')](_0x531943[_0xbec3('0x9')],_0x138290);_0x3b2abe['on'](_0xbec3('0x12'),function(_0x38650b){var _0x4de375=new Buffer(_0x336731['update'](_0x38650b),_0xbec3('0x13'));_0x187a07['write'](_0x4de375);});_0x3b2abe['on'](_0xbec3('0x14'),function(){try{var _0xde9517=new Buffer(_0x336731['final'](_0xbec3('0x13')),_0xbec3('0x13'));_0x187a07[_0xbec3('0x15')](_0xde9517);_0x187a07[_0xbec3('0x14')]();_0x187a07['on'](_0xbec3('0x16'),function(){return _0x2da27d(_0x3120c1);});}catch(_0x46c2b8){fs[_0xbec3('0x17')](_0x3120c1);return _0x3faf96(_0x46c2b8);}});});};exports[_0xbec3('0x18')]=function(_0x49909c,_0x1aa71b,_0x43b95b,_0x287184){return new BPromise(function(_0x4aa54e,_0x56b311){_0x287184=combineOptions(_0x287184);var _0x293475=new Buffer(_0x43b95b);var _0x4decf8=fs[_0xbec3('0x19')](_0x49909c);var _0x1352ed=fs[_0xbec3('0x1a')](_0x1aa71b);var _0x3f83c7=crypto[_0xbec3('0x1b')](_0x287184[_0xbec3('0x9')],_0x293475);_0x4decf8['on']('data',function(_0x4e94ba){var _0x317d36=new Buffer(_0x3f83c7[_0xbec3('0x1c')](_0x4e94ba),_0xbec3('0x13'));_0x1352ed['write'](_0x317d36);});_0x4decf8['on'](_0xbec3('0x14'),function(){try{var _0x219895=new Buffer(_0x3f83c7[_0xbec3('0x1d')]('binary'),_0xbec3('0x13'));_0x1352ed['write'](_0x219895);_0x1352ed[_0xbec3('0x14')]();_0x1352ed['on']('close',function(){return _0x4aa54e(_0x1aa71b);});}catch(_0x5e54b0){fs[_0xbec3('0x17')](_0x1aa71b);return _0x56b311(_0x5e54b0);}});});};exports[_0xbec3('0x1e')]=function(_0x503e4b,_0x2aee08,_0x4681b6){var _0x5da653=_0x4681b6||stringOptions[_0xbec3('0x9')];var _0x295d3d=_0x2aee08||stringOptions['secret'];var _0x2f0866=crypto[_0xbec3('0x11')](_0x5da653,_0x295d3d);var _0x1c1101=_0x2f0866[_0xbec3('0x1c')](_0x503e4b,_0xbec3('0x1f'),_0xbec3('0x20'));_0x1c1101+=_0x2f0866[_0xbec3('0x1d')]('base64');return _0x1c1101;};exports[_0xbec3('0x21')]=function(_0x5a3166,_0x500a30,_0x58b15c){var _0x9a169=_0x58b15c||stringOptions[_0xbec3('0x9')];var _0x128b6f=_0x500a30||stringOptions[_0xbec3('0x22')];var _0x1e902a=crypto['createDecipher'](_0x9a169,_0x128b6f);var _0x1cb7bf=_0x1e902a['update'](_0x5a3166,_0xbec3('0x20'),_0xbec3('0x1f'));_0x1cb7bf+=_0x1e902a[_0xbec3('0x1d')](_0xbec3('0x1f'));return _0x1cb7bf;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 676cff0..97ec3d6 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 _0x0f2e=['path','lodash','to-csv','zip-dir','rimraf','../../mysqldb','dbH','analytics','argv','savename','update','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','find','split','splitSizeCsv','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','num','Empty','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','dirname','basename','existsSync','mkdirSync','each','join','%s%d.%s','csv','writeFileSync','%s.%s','zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','util'];(function(_0x3451a4,_0x2ea691){var _0x1e6591=function(_0x3b2bfd){while(--_0x3b2bfd){_0x3451a4['push'](_0x3451a4['shift']());}};_0x1e6591(++_0x2ea691);}(_0x0f2e,0x18f));var _0xe0f2=function(_0xf61c79,_0x43c6fa){_0xf61c79=_0xf61c79-0x0;var _0x127d26=_0x0f2e[_0xf61c79];return _0x127d26;};'use strict';var util=require(_0xe0f2('0x0'));var path=require(_0xe0f2('0x1'));var _=require(_0xe0f2('0x2'));var csv=require(_0xe0f2('0x3'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require(_0xe0f2('0x4'));var rimraf=require(_0xe0f2('0x5'));var db=require(_0xe0f2('0x6'))['db'];var dbH=require(_0xe0f2('0x6'))[_0xe0f2('0x7')];var logger=require('../../config/logger')(_0xe0f2('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0xe0f2('0x9')][0x2]);var QUERY=process[_0xe0f2('0x9')][0x3];var PATH=process[_0xe0f2('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x3f177c,_0x5c2abf){var _0x368343={'status':_0x3f177c};var _0x1778c6={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x5c2abf){_0x368343[_0xe0f2('0xa')]=_0x5c2abf;}return db['AnalyticExtractedReport'][_0xe0f2('0xb')](_0x368343,_0x1778c6);}function main(){var _0x8c652e=0x1388;var _0x42fcd2;logger['info'](util[_0xe0f2('0xc')](_0xe0f2('0xd'),EXTRACTED_REPORT_ID,_0xe0f2('0xe')));return db['Setting'][_0xe0f2('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xe0f2('0x10'),_0xe0f2('0x11')]})[_0xe0f2('0x12')](function(_0x661f05){if(_0x661f05){_0x42fcd2=_0x661f05;_0x8c652e=_0x42fcd2[_0xe0f2('0x11')]||0x1388;}})[_0xe0f2('0x12')](function(){return dbH[_0xe0f2('0x13')][_0xe0f2('0x14')](util['format'](_0xe0f2('0x15'),QUERY),{'type':dbH[_0xe0f2('0x13')]['QueryTypes']['SELECT']});})[_0xe0f2('0x12')](function(_0xa7da6c){if(!_0xa7da6c[0x0][_0xe0f2('0x16')]){return analyticExtractedReport(_0xe0f2('0x17'));}var _0x263794=[];var _0x4ba50f=0x0;if(_0x42fcd2[_0xe0f2('0x10')]){if(_0xa7da6c&&_0xa7da6c['length']){var _0x4d059d=_['range'](_0xa7da6c[0x0][_0xe0f2('0x16')]/_0x8c652e);var _0x245141=Number[_0xe0f2('0x18')](_0xa7da6c[0x0][_0xe0f2('0x16')]/_0x8c652e)?_0xa7da6c[0x0][_0xe0f2('0x16')]%_0x8c652e:0x0;_0x4d059d[_0xe0f2('0x19')](function(_0x1679e9){if(_0x1679e9>0x0){_0x4ba50f+=_0x8c652e;}_0x263794[_0xe0f2('0x1a')](dbH[_0xe0f2('0x13')]['query'](util[_0xe0f2('0xc')](_0xe0f2('0x1b'),QUERY,_0x8c652e,_0x4ba50f),{'type':dbH[_0xe0f2('0x13')][_0xe0f2('0x1c')][_0xe0f2('0x1d')]}));});if(_0x245141>0x0){_0x4ba50f+=_0x8c652e;_0x263794[_0xe0f2('0x1a')](dbH[_0xe0f2('0x13')][_0xe0f2('0x14')](util[_0xe0f2('0xc')](_0xe0f2('0x1b'),QUERY,_0x245141,_0x4ba50f),{'type':dbH[_0xe0f2('0x13')][_0xe0f2('0x1c')][_0xe0f2('0x1d')]}));}}}else{_0x263794[_0xe0f2('0x1a')](dbH[_0xe0f2('0x13')][_0xe0f2('0x14')](QUERY,{'type':dbH[_0xe0f2('0x13')][_0xe0f2('0x1c')][_0xe0f2('0x1d')]}));}var _0x3b34af=path[_0xe0f2('0x1e')](PATH);var _0x1bfacc=path[_0xe0f2('0x1f')](PATH,'.csv');var _0x1b94ca=_0x42fcd2[_0xe0f2('0x10')]&&_0x263794['length']>0x1;var _0x533afe=[];if(!fs[_0xe0f2('0x20')](path['join'](_0x3b34af,_0x1bfacc))&&_0x1b94ca){fs[_0xe0f2('0x21')](path['join'](_0x3b34af,_0x1bfacc));}return BPromise[_0xe0f2('0x22')](_0x263794,function(_0x57adc9){_0x533afe[_0xe0f2('0x1a')](_0x57adc9);})['then'](function(){for(var _0x2f4980=0x0;_0x2f4980<_0x533afe['length'];_0x2f4980+=0x1){var _0x30f5c2;var _0x1b0bc7=_0x533afe[_0x2f4980];if(_0x1b94ca){_0x30f5c2=path[_0xe0f2('0x23')](_0x3b34af,_0x1bfacc,util[_0xe0f2('0xc')](_0xe0f2('0x24'),_0x1bfacc,_0x2f4980,_0xe0f2('0x25')));}else{_0x30f5c2=path[_0xe0f2('0x23')](_0x3b34af,util['format']('%s.%s',_0x1bfacc,'csv'));}fs[_0xe0f2('0x26')](_0x30f5c2,csv(_0x1b0bc7));}})['then'](function(){if(_0x1b94ca){return new Promise(function(_0xff0df2){zipdir(path['join'](_0x3b34af,_0x1bfacc),{'saveTo':path[_0xe0f2('0x23')](_0x3b34af,util[_0xe0f2('0xc')](_0xe0f2('0x27'),_0x1bfacc,_0xe0f2('0x28')))},function(_0x39dd34,_0x747783){rimraf(path['join'](_0x3b34af,_0x1bfacc),function(){});_0xff0df2(_0xe0f2('0x29'));});});}})[_0xe0f2('0x12')](function(){logger[_0xe0f2('0x2a')](util[_0xe0f2('0xc')](_0xe0f2('0x2b'),EXTRACTED_REPORT_ID,_0xe0f2('0xe')));return analyticExtractedReport('Completed',_0x1b94ca?util[_0xe0f2('0xc')]('%s.%s',_0x1bfacc,_0x1b94ca?_0xe0f2('0x28'):_0xe0f2('0x25')):null);});})[_0xe0f2('0x2c')](function(_0x4be77b){logger[_0xe0f2('0x2a')](util['format'](_0xe0f2('0x2d'),EXTRACTED_REPORT_ID,_0xe0f2('0xe')),util[_0xe0f2('0x2e')](_0x4be77b,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xe0f2('0x2f'));})[_0xe0f2('0x30')](function(){process[_0xe0f2('0x31')](EXIT_CODE);});}main(); \ No newline at end of file +var _0xac8f=['format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','length','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','basename','.csv','existsSync','join','mkdirSync','each','%s%d.%s','%s.%s','csv','writeFileSync','zip','zip\x20finished','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','exit','path','lodash','to-csv','bluebird','zip-dir','rimraf','../../mysqldb','../../config/logger','argv','AnalyticExtractedReport','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','find','split','splitSizeCsv','then','sequelize','query'];(function(_0x316d7f,_0x275e14){var _0x30c945=function(_0x38043e){while(--_0x38043e){_0x316d7f['push'](_0x316d7f['shift']());}};_0x30c945(++_0x275e14);}(_0xac8f,0xdd));var _0xfac8=function(_0x502953,_0x28de83){_0x502953=_0x502953-0x0;var _0x2fa32d=_0xac8f[_0x502953];return _0x2fa32d;};'use strict';var util=require('util');var path=require(_0xfac8('0x0'));var _=require(_0xfac8('0x1'));var csv=require(_0xfac8('0x2'));var fs=require('fs');var BPromise=require(_0xfac8('0x3'));var zipdir=require(_0xfac8('0x4'));var rimraf=require(_0xfac8('0x5'));var db=require(_0xfac8('0x6'))['db'];var dbH=require(_0xfac8('0x6'))['dbH'];var logger=require(_0xfac8('0x7'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xfac8('0x8')][0x2]);var QUERY=process[_0xfac8('0x8')][0x3];var PATH=process[_0xfac8('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x24691f,_0x436c83){var _0xe86a77={'status':_0x24691f};var _0x1d1de0={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x436c83){_0xe86a77['savename']=_0x436c83;}return db[_0xfac8('0x9')]['update'](_0xe86a77,_0x1d1de0);}function main(){var _0xc0418c=0x1388;var _0x530386;logger[_0xfac8('0xa')](util['format'](_0xfac8('0xb'),EXTRACTED_REPORT_ID,_0xfac8('0xc')));return db['Setting'][_0xfac8('0xd')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xfac8('0xe'),_0xfac8('0xf')]})[_0xfac8('0x10')](function(_0x3dfbe8){if(_0x3dfbe8){_0x530386=_0x3dfbe8;_0xc0418c=_0x530386[_0xfac8('0xf')]||0x1388;}})[_0xfac8('0x10')](function(){return dbH[_0xfac8('0x11')][_0xfac8('0x12')](util[_0xfac8('0x13')](_0xfac8('0x14'),QUERY),{'type':dbH[_0xfac8('0x11')][_0xfac8('0x15')][_0xfac8('0x16')]});})[_0xfac8('0x10')](function(_0x58825b){if(!_0x58825b[0x0][_0xfac8('0x17')]){return analyticExtractedReport(_0xfac8('0x18'));}var _0xf64265=[];var _0x297895=0x0;if(_0x530386[_0xfac8('0xe')]){if(_0x58825b&&_0x58825b[_0xfac8('0x19')]){var _0x278bcd=_['range'](_0x58825b[0x0]['num']/_0xc0418c);var _0xa72616=Number[_0xfac8('0x1a')](_0x58825b[0x0][_0xfac8('0x17')]/_0xc0418c)?_0x58825b[0x0][_0xfac8('0x17')]%_0xc0418c:0x0;_0x278bcd[_0xfac8('0x1b')](function(_0x3bbbb1){if(_0x3bbbb1>0x0){_0x297895+=_0xc0418c;}_0xf64265[_0xfac8('0x1c')](dbH[_0xfac8('0x11')]['query'](util[_0xfac8('0x13')](_0xfac8('0x1d'),QUERY,_0xc0418c,_0x297895),{'type':dbH[_0xfac8('0x11')][_0xfac8('0x15')][_0xfac8('0x16')]}));});if(_0xa72616>0x0){_0x297895+=_0xc0418c;_0xf64265['push'](dbH[_0xfac8('0x11')][_0xfac8('0x12')](util[_0xfac8('0x13')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0xa72616,_0x297895),{'type':dbH['sequelize'][_0xfac8('0x15')][_0xfac8('0x16')]}));}}}else{_0xf64265[_0xfac8('0x1c')](dbH[_0xfac8('0x11')][_0xfac8('0x12')](QUERY,{'type':dbH[_0xfac8('0x11')][_0xfac8('0x15')][_0xfac8('0x16')]}));}var _0x1ca738=path['dirname'](PATH);var _0x406fe0=path[_0xfac8('0x1e')](PATH,_0xfac8('0x1f'));var _0x12a000=_0x530386[_0xfac8('0xe')]&&_0xf64265[_0xfac8('0x19')]>0x1;var _0x946546=[];if(!fs[_0xfac8('0x20')](path[_0xfac8('0x21')](_0x1ca738,_0x406fe0))&&_0x12a000){fs[_0xfac8('0x22')](path[_0xfac8('0x21')](_0x1ca738,_0x406fe0));}return BPromise[_0xfac8('0x23')](_0xf64265,function(_0x1127c9){_0x946546[_0xfac8('0x1c')](_0x1127c9);})[_0xfac8('0x10')](function(){for(var _0x10ff6e=0x0;_0x10ff6e<_0x946546['length'];_0x10ff6e+=0x1){var _0xc39186;var _0x2ea56e=_0x946546[_0x10ff6e];if(_0x12a000){_0xc39186=path['join'](_0x1ca738,_0x406fe0,util[_0xfac8('0x13')](_0xfac8('0x24'),_0x406fe0,_0x10ff6e,'csv'));}else{_0xc39186=path[_0xfac8('0x21')](_0x1ca738,util[_0xfac8('0x13')](_0xfac8('0x25'),_0x406fe0,_0xfac8('0x26')));}fs[_0xfac8('0x27')](_0xc39186,csv(_0x2ea56e));}})[_0xfac8('0x10')](function(){if(_0x12a000){return new Promise(function(_0x1531bd){zipdir(path[_0xfac8('0x21')](_0x1ca738,_0x406fe0),{'saveTo':path[_0xfac8('0x21')](_0x1ca738,util[_0xfac8('0x13')](_0xfac8('0x25'),_0x406fe0,_0xfac8('0x28')))},function(_0x258fb3,_0x3cfe16){rimraf(path[_0xfac8('0x21')](_0x1ca738,_0x406fe0),function(){});_0x1531bd(_0xfac8('0x29'));});});}})[_0xfac8('0x10')](function(){logger[_0xfac8('0xa')](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0xfac8('0xc')));return analyticExtractedReport(_0xfac8('0x2a'),_0x12a000?util[_0xfac8('0x13')](_0xfac8('0x25'),_0x406fe0,_0x12a000?_0xfac8('0x28'):'csv'):null);});})[_0xfac8('0x2b')](function(_0x27ac83){logger[_0xfac8('0xa')](util[_0xfac8('0x13')](_0xfac8('0x2c'),EXTRACTED_REPORT_ID,_0xfac8('0xc')),util[_0xfac8('0x2d')](_0x27ac83,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xfac8('0x2e'));})['finally'](function(){process[_0xfac8('0x2f')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 28883b1..2c22a81 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 _0xffda=['inspect','exit','/fonts/arial-regular.ttf','/fonts/arial-italic.ttf','channel','interactionId','center','Interaction\x20Transcript','pipe','createWriteStream','finish','end','createPdfFromHTML','lodash','path','moment','html-to-pdfmake','pdfmake/src/printer','zip-dir','jsdom','JSDOM','window','../../mysqldb','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','map','tableHeader','pick','toString','value','fill','length','auto','body','push','concat','chunk','keys','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','startDate','header','pageBreak','before','landscape','\x20/\x20','footer','Arial','black','right','num','Empty','Setting','find','split','splitSizePdf','then','range','isInteger','sequelize','query','QueryTypes','SELECT','dirname','.pdf','join','each','flatten','createPdfKitDocument','%s%d.%s','%s.%s','pdf','all','zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','AnalyticExtractedReport','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format'];(function(_0xa3e0f7,_0x1b06db){var _0x4ce604=function(_0x29df1e){while(--_0x29df1e){_0xa3e0f7['push'](_0xa3e0f7['shift']());}};_0x4ce604(++_0x1b06db);}(_0xffda,0x112));var _0xaffd=function(_0x576738,_0x5959b6){_0x576738=_0x576738-0x0;var _0x6db255=_0xffda[_0x576738];return _0x6db255;};'use strict';var _=require(_0xaffd('0x0'));var fs=require('fs');var util=require('util');var path=require(_0xaffd('0x1'));var moment=require(_0xaffd('0x2'));var htmlToPdfmake=require(_0xaffd('0x3'));var PdfPrinter=require(_0xaffd('0x4'));var zipdir=require(_0xaffd('0x5'));var rimraf=require('rimraf');var JSDOM=require(_0xaffd('0x6'))[_0xaffd('0x7')];var window=new JSDOM('')[_0xaffd('0x8')];var BPromise=require('bluebird');var db=require(_0xaffd('0x9'))['db'];var dbH=require(_0xaffd('0x9'))['dbH'];var logger=require('../../config/logger')(_0xaffd('0xa'));var EXTRACTED_REPORT_ID=Number(process[_0xaffd('0xb')][0x2]);var QUERY=process[_0xaffd('0xb')][0x3];var PATH=process[_0xaffd('0xb')][0x4];var NAME=process[_0xaffd('0xb')][0x5];var FORMAT=_0xaffd('0xc');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x59f786,_0x5767d3){var _0x268d46={'status':_0x59f786};var _0x2ee2a1={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x5767d3){_0x268d46[_0xaffd('0xd')]=_0x5767d3;}return db['AnalyticExtractedReport']['update'](_0x268d46,_0x2ee2a1);}function getHeaders(_0x5143a4){return _[_0xaffd('0xe')](_0x5143a4,function(_0x5564dd){return{'text':_0x5564dd,'style':_0xaffd('0xf')};});}function getRows(_0x11f31d,_0xccd7d1){return _['map'](_0xccd7d1,function(_0x4ad3a6){return _(_0x4ad3a6)[_0xaffd('0x10')](_0x11f31d)[_0xaffd('0xe')](function(_0x40eb4b){return _0x40eb4b?_[_0xaffd('0x11')](_0x40eb4b):'';})[_0xaffd('0x12')]();});}function createTable(_0x5df5e6,_0x11d171){var _0xfd06ca={'widths':_[_0xaffd('0x13')](Array(_0x5df5e6[_0xaffd('0x14')]),0x91),'heights':function(_0x208046){return _0x208046===0x0?_0xaffd('0x15'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x437f91=getHeaders(_0x5df5e6);_0xfd06ca[_0xaffd('0x16')][_0xaffd('0x17')](_0x437f91);var _0x3ac0de=getRows(_0x5df5e6,_0x11d171);_0xfd06ca[_0xaffd('0x16')]=_0xfd06ca[_0xaffd('0x16')][_0xaffd('0x18')](_0x3ac0de);return _0xfd06ca;}function createTables(_0xa35b38){var _0x185bf9=[];var _0x1dc83a=_[_0xaffd('0x19')](Object[_0xaffd('0x1a')](_0xa35b38[0x0]),0x5);_0x1dc83a[_0xaffd('0x1b')](function(_0x5f92e){_0x185bf9['push'](createTable(_0x5f92e,_0xa35b38));});return _0x185bf9;}function getPDFDocDefinition(_0x37b84a){var _0x37e4bf=util[_0xaffd('0x1c')](_0xaffd('0x1d'),NAME,EXTRACTED_REPORT['name'],moment(EXTRACTED_REPORT[_0xaffd('0x1e')])['format'](FORMAT),moment(EXTRACTED_REPORT['endDate'])[_0xaffd('0x1c')](FORMAT));var _0x27f2ba=[];for(var _0x138ac0=0x0;_0x138ac0<_0x37b84a[_0xaffd('0x14')];_0x138ac0++){var _0x16d22e=[];if(_0x138ac0===0x0){_0x16d22e[_0xaffd('0x17')]({'text':_0x37e4bf,'style':_0xaffd('0x1f')});}var _0x3bece8={'table':_0x37b84a[_0x138ac0]};if(_0x138ac0>0x0){_0x3bece8[_0xaffd('0x20')]=_0xaffd('0x21');_0x3bece8['margin']=[0x0,0x46,0x0,0x0];}_0x16d22e[_0xaffd('0x17')](_0x3bece8);_0x27f2ba[_0xaffd('0x17')](_0x16d22e);}return{'pageSize':'A4','pageOrientation':_0xaffd('0x22'),'content':_0x27f2ba,'footer':function(_0x43f402,_0x7b0143){return{'text':_0x43f402[_0xaffd('0x11')]()+_0xaffd('0x23')+_0x7b0143,'style':_0xaffd('0x24')};},'defaultStyle':{'font':_0xaffd('0x25')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xaffd('0x26')},'footer':{'alignment':_0xaffd('0x27'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0xace934){var _0x48b8dd=0x1388;var _0x34e232;if(!_0xace934[0x0][_0xaffd('0x28')]){return analyticExtractedReport(_0xaffd('0x29'));}return db[_0xaffd('0x2a')][_0xaffd('0x2b')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xaffd('0x2c'),_0xaffd('0x2d')]})['then'](function(_0x2c8cec){if(_0x2c8cec){_0x34e232=_0x2c8cec;_0x48b8dd=_0x34e232['splitSizePdf']||0x3e8;}})[_0xaffd('0x2e')](function(){var _0x331e11=[];var _0x3c84a8=0x0;if(_0x34e232[_0xaffd('0x2c')]){if(_0xace934&&_0xace934[_0xaffd('0x14')]){var _0x43a8d7=_[_0xaffd('0x2f')](_0xace934[0x0][_0xaffd('0x28')]/_0x48b8dd);var _0x11c8df=Number[_0xaffd('0x30')](_0xace934[0x0]['num']/_0x48b8dd)?_0xace934[0x0][_0xaffd('0x28')]%_0x48b8dd:0x0;_0x43a8d7[_0xaffd('0x1b')](function(_0x41fca9){if(_0x41fca9>0x0){_0x3c84a8+=_0x48b8dd;}_0x331e11[_0xaffd('0x17')](dbH[_0xaffd('0x31')][_0xaffd('0x32')](util[_0xaffd('0x1c')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x48b8dd,_0x3c84a8),{'type':dbH['sequelize'][_0xaffd('0x33')]['SELECT']}));});if(_0x11c8df>0x0){_0x3c84a8+=_0x48b8dd;_0x331e11['push'](dbH[_0xaffd('0x31')]['query'](util[_0xaffd('0x1c')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x11c8df,_0x3c84a8),{'type':dbH[_0xaffd('0x31')][_0xaffd('0x33')]['SELECT']}));}}}else{_0x331e11['push'](dbH[_0xaffd('0x31')]['query'](QUERY,{'type':dbH['sequelize'][_0xaffd('0x33')][_0xaffd('0x34')]}));}var _0x572bc6=path[_0xaffd('0x35')](PATH);var _0x2067a6=path['basename'](PATH,_0xaffd('0x36'));var _0x3d0f1b=_0x34e232['split']&&_0x331e11[_0xaffd('0x14')]>0x1;var _0x59a264=[];if(!fs['existsSync'](path[_0xaffd('0x37')](_0x572bc6,_0x2067a6))&&_0x3d0f1b){fs['mkdirSync'](path['join'](_0x572bc6,_0x2067a6));}return BPromise[_0xaffd('0x38')](_0x331e11,function(_0x3b03a4){_0x59a264[_0xaffd('0x17')](_0x3b03a4);})[_0xaffd('0x2e')](function(){var _0x8ed7d5=[];for(var _0x3a3fbc=0x0;_0x3a3fbc<_0x59a264[_0xaffd('0x14')];_0x3a3fbc+=0x1){var _0x3b887e=_0x59a264[_0x3a3fbc];var _0x54e0d5=createTables(_[_0xaffd('0x39')](_0x3b887e));var _0x59f467;var _0x1201f9=getPDFDocDefinition(_0x54e0d5);var _0xb8d9e7=getPDFPrinter();var _0x2391c2=_0xb8d9e7[_0xaffd('0x3a')](_0x1201f9);if(_0x3d0f1b){_0x59f467=path[_0xaffd('0x37')](_0x572bc6,_0x2067a6,util[_0xaffd('0x1c')](_0xaffd('0x3b'),_0x2067a6,_0x3a3fbc,'pdf'));}else{_0x59f467=path['join'](_0x572bc6,util[_0xaffd('0x1c')](_0xaffd('0x3c'),_0x2067a6,_0xaffd('0x3d')));}_0x8ed7d5[_0xaffd('0x17')](writePDFDocument(_0x2391c2,_0x59f467));}return Promise[_0xaffd('0x3e')](_0x8ed7d5);})[_0xaffd('0x2e')](function(){if(_0x3d0f1b){return new Promise(function(_0x5ae639){zipdir(path[_0xaffd('0x37')](_0x572bc6,_0x2067a6),{'saveTo':path[_0xaffd('0x37')](_0x572bc6,util[_0xaffd('0x1c')]('%s.%s',_0x2067a6,_0xaffd('0x3f')))},function(){rimraf(path['join'](_0x572bc6,_0x2067a6),function(){});_0x5ae639(_0xaffd('0x40'));});});}})[_0xaffd('0x2e')](function(){if(!_0x3d0f1b)return;rimraf(path[_0xaffd('0x37')](_0x572bc6,_0x2067a6),function(){});})[_0xaffd('0x2e')](function(){logger[_0xaffd('0x41')](util[_0xaffd('0x1c')](_0xaffd('0x42'),EXTRACTED_REPORT_ID,_0xaffd('0x43')));return analyticExtractedReport(_0xaffd('0x44'),_0x3d0f1b?util[_0xaffd('0x1c')](_0xaffd('0x3c'),_0x2067a6,_0x3d0f1b?_0xaffd('0x3f'):_0xaffd('0x3d')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0xaffd('0x41')](util['format'](_0xaffd('0x45'),EXTRACTED_REPORT_ID,_0xaffd('0x43')));return db[_0xaffd('0x46')]['findOne']({'where':{'id':EXTRACTED_REPORT_ID}})[_0xaffd('0x2e')](function(_0x581fa6){EXTRACTED_REPORT=_0x581fa6;return dbH[_0xaffd('0x31')][_0xaffd('0x32')](util[_0xaffd('0x1c')](_0xaffd('0x47'),QUERY),{'type':dbH[_0xaffd('0x31')][_0xaffd('0x33')]['SELECT']});})['then'](extractReport)[_0xaffd('0x48')](function(_0x1d3233){logger['info'](util['format'](_0xaffd('0x49'),EXTRACTED_REPORT_ID,'PDF'),util[_0xaffd('0x4a')](_0x1d3233,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})['finally'](function(){process[_0xaffd('0x4b')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x564575=new PdfPrinter({'Arial':{'normal':__dirname+_0xaffd('0x4c'),'bold':__dirname+'/fonts/arial-bold.ttf','italics':__dirname+_0xaffd('0x4d'),'bolditalics':__dirname+'/fonts/arial-bold-italic.ttf'}});return _0x564575;}function getPDFDocDefinitionFromHTML(_0x4d141c,_0x2cbe6c){var _0x262723=util[_0xaffd('0x1c')]('%s\x20#%d',_0x2cbe6c[_0xaffd('0x4e')],_0x2cbe6c[_0xaffd('0x4f')]);var _0xdcbd92=moment()[_0xaffd('0x1c')]('YYYY-MM-DD')[_0xaffd('0x11')]();var _0xb98b54=htmlToPdfmake(_0x4d141c,{'window':window,'tableAutoSize':!![]});return{'content':[_0xb98b54],'defaultStyle':{'font':_0xaffd('0x25')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0xaffd('0x50'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0xaffd('0x50'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0xaffd('0x50')}},'header':function(){return[{'text':_0xaffd('0x51'),'style':_0xaffd('0x1f')}];},'footer':function(_0x222d5a,_0x16cf4c){return[{'text':util[_0xaffd('0x1c')]('\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s',_0x262723,_0x222d5a,_0x16cf4c,_0xdcbd92),'style':_0xaffd('0x24')}];}};}function writePDFDocument(_0x418d7c,_0x467df0){return new Promise(function(_0x35d751,_0x224d11){var _0x368271=_0x418d7c[_0xaffd('0x52')](fs[_0xaffd('0x53')](_0x467df0));_0x368271['on'](_0xaffd('0x54'),function(){_0x35d751(_0xaffd('0x54'));});_0x368271['on']('error',function(_0x472b3d){_0x224d11(_0x472b3d);});_0x418d7c[_0xaffd('0x55')]();});}exports[_0xaffd('0x56')]=function(_0x1677ea,_0xb229f9){var _0x2e9349=getPDFPrinter();var _0x1ef40d=getPDFDocDefinitionFromHTML(_0x1677ea,_0xb229f9);var _0x5326a9=_0x2e9349[_0xaffd('0x3a')](_0x1ef40d);return writePDFDocument(_0x5326a9,_0xb229f9['path'])[_0xaffd('0x48')](function(_0x3299f4){throw _0x3299f4;});}; \ No newline at end of file +var _0xc84e=['sequelize','SELECT','QueryTypes','dirname','basename','.pdf','existsSync','join','each','flatten','createPdfKitDocument','%s%d.%s','pdf','%s.%s','all','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','zip','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','/fonts/arial-italic.ttf','/fonts/arial-bold-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','end','createPdfFromHTML','lodash','path','html-to-pdfmake','pdfmake/src/printer','rimraf','JSDOM','window','bluebird','../../mysqldb','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','AnalyticExtractedReport','update','map','tableHeader','toString','value','fill','length','auto','body','concat','chunk','keys','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','endDate','push','header','pageBreak','before','margin','landscape','\x20/\x20','Arial','black','right','num','Empty','Setting','find','split','splitSizePdf','then','query'];(function(_0x5f60b3,_0x3895e0){var _0x4c7b1a=function(_0x43dd2c){while(--_0x43dd2c){_0x5f60b3['push'](_0x5f60b3['shift']());}};_0x4c7b1a(++_0x3895e0);}(_0xc84e,0xdc));var _0xec84=function(_0xdea6e1,_0x44325d){_0xdea6e1=_0xdea6e1-0x0;var _0x4a4076=_0xc84e[_0xdea6e1];return _0x4a4076;};'use strict';var _=require(_0xec84('0x0'));var fs=require('fs');var util=require('util');var path=require(_0xec84('0x1'));var moment=require('moment');var htmlToPdfmake=require(_0xec84('0x2'));var PdfPrinter=require(_0xec84('0x3'));var zipdir=require('zip-dir');var rimraf=require(_0xec84('0x4'));var JSDOM=require('jsdom')[_0xec84('0x5')];var window=new JSDOM('')[_0xec84('0x6')];var BPromise=require(_0xec84('0x7'));var db=require(_0xec84('0x8'))['db'];var dbH=require(_0xec84('0x8'))['dbH'];var logger=require(_0xec84('0x9'))(_0xec84('0xa'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0xec84('0xb')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0xec84('0xb')][0x5];var FORMAT=_0xec84('0xc');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x18e59c,_0x59c575){var _0x58c05e={'status':_0x18e59c};var _0x164703={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x59c575){_0x58c05e['savename']=_0x59c575;}return db[_0xec84('0xd')][_0xec84('0xe')](_0x58c05e,_0x164703);}function getHeaders(_0x1562fd){return _[_0xec84('0xf')](_0x1562fd,function(_0x364d42){return{'text':_0x364d42,'style':_0xec84('0x10')};});}function getRows(_0x167cda,_0xb2debf){return _[_0xec84('0xf')](_0xb2debf,function(_0x2a6421){return _(_0x2a6421)['pick'](_0x167cda)[_0xec84('0xf')](function(_0x2d3782){return _0x2d3782?_[_0xec84('0x11')](_0x2d3782):'';})[_0xec84('0x12')]();});}function createTable(_0x38c2b1,_0x74ed38){var _0x2bae9b={'widths':_[_0xec84('0x13')](Array(_0x38c2b1[_0xec84('0x14')]),0x91),'heights':function(_0x4a88a1){return _0x4a88a1===0x0?_0xec84('0x15'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x1c7eca=getHeaders(_0x38c2b1);_0x2bae9b[_0xec84('0x16')]['push'](_0x1c7eca);var _0x4fdc24=getRows(_0x38c2b1,_0x74ed38);_0x2bae9b[_0xec84('0x16')]=_0x2bae9b[_0xec84('0x16')][_0xec84('0x17')](_0x4fdc24);return _0x2bae9b;}function createTables(_0x539c26){var _0xbb8384=[];var _0x15ce77=_[_0xec84('0x18')](Object[_0xec84('0x19')](_0x539c26[0x0]),0x5);_0x15ce77[_0xec84('0x1a')](function(_0x162b70){_0xbb8384['push'](createTable(_0x162b70,_0x539c26));});return _0xbb8384;}function getPDFDocDefinition(_0x10bc41){var _0x339e5e=util[_0xec84('0x1b')](_0xec84('0x1c'),NAME,EXTRACTED_REPORT[_0xec84('0x1d')],moment(EXTRACTED_REPORT[_0xec84('0x1e')])['format'](FORMAT),moment(EXTRACTED_REPORT[_0xec84('0x1f')])[_0xec84('0x1b')](FORMAT));var _0x4f1709=[];for(var _0xe1d7ac=0x0;_0xe1d7ac<_0x10bc41[_0xec84('0x14')];_0xe1d7ac++){var _0x1cbef5=[];if(_0xe1d7ac===0x0){_0x1cbef5[_0xec84('0x20')]({'text':_0x339e5e,'style':_0xec84('0x21')});}var _0x4246ef={'table':_0x10bc41[_0xe1d7ac]};if(_0xe1d7ac>0x0){_0x4246ef[_0xec84('0x22')]=_0xec84('0x23');_0x4246ef[_0xec84('0x24')]=[0x0,0x46,0x0,0x0];}_0x1cbef5[_0xec84('0x20')](_0x4246ef);_0x4f1709[_0xec84('0x20')](_0x1cbef5);}return{'pageSize':'A4','pageOrientation':_0xec84('0x25'),'content':_0x4f1709,'footer':function(_0x4c3f87,_0x52741b){return{'text':_0x4c3f87['toString']()+_0xec84('0x26')+_0x52741b,'style':'footer'};},'defaultStyle':{'font':_0xec84('0x27')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xec84('0x28')},'footer':{'alignment':_0xec84('0x29'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x353fa8){var _0x1b70ba=0x1388;var _0x3d635c;if(!_0x353fa8[0x0][_0xec84('0x2a')]){return analyticExtractedReport(_0xec84('0x2b'));}return db[_0xec84('0x2c')][_0xec84('0x2d')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xec84('0x2e'),_0xec84('0x2f')]})[_0xec84('0x30')](function(_0x5eaab1){if(_0x5eaab1){_0x3d635c=_0x5eaab1;_0x1b70ba=_0x3d635c[_0xec84('0x2f')]||0x3e8;}})[_0xec84('0x30')](function(){var _0x2b881=[];var _0x5f439b=0x0;if(_0x3d635c[_0xec84('0x2e')]){if(_0x353fa8&&_0x353fa8[_0xec84('0x14')]){var _0x184dae=_['range'](_0x353fa8[0x0][_0xec84('0x2a')]/_0x1b70ba);var _0x8f2153=Number['isInteger'](_0x353fa8[0x0]['num']/_0x1b70ba)?_0x353fa8[0x0][_0xec84('0x2a')]%_0x1b70ba:0x0;_0x184dae[_0xec84('0x1a')](function(_0x11a869){if(_0x11a869>0x0){_0x5f439b+=_0x1b70ba;}_0x2b881[_0xec84('0x20')](dbH['sequelize'][_0xec84('0x31')](util[_0xec84('0x1b')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x1b70ba,_0x5f439b),{'type':dbH[_0xec84('0x32')]['QueryTypes'][_0xec84('0x33')]}));});if(_0x8f2153>0x0){_0x5f439b+=_0x1b70ba;_0x2b881[_0xec84('0x20')](dbH[_0xec84('0x32')]['query'](util[_0xec84('0x1b')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x8f2153,_0x5f439b),{'type':dbH[_0xec84('0x32')][_0xec84('0x34')][_0xec84('0x33')]}));}}}else{_0x2b881[_0xec84('0x20')](dbH[_0xec84('0x32')][_0xec84('0x31')](QUERY,{'type':dbH[_0xec84('0x32')][_0xec84('0x34')][_0xec84('0x33')]}));}var _0x4fed86=path[_0xec84('0x35')](PATH);var _0x314d30=path[_0xec84('0x36')](PATH,_0xec84('0x37'));var _0x40b003=_0x3d635c[_0xec84('0x2e')]&&_0x2b881[_0xec84('0x14')]>0x1;var _0x16bd23=[];if(!fs[_0xec84('0x38')](path[_0xec84('0x39')](_0x4fed86,_0x314d30))&&_0x40b003){fs['mkdirSync'](path[_0xec84('0x39')](_0x4fed86,_0x314d30));}return BPromise[_0xec84('0x3a')](_0x2b881,function(_0x82f827){_0x16bd23[_0xec84('0x20')](_0x82f827);})[_0xec84('0x30')](function(){var _0x4a4cbe=[];for(var _0x50b143=0x0;_0x50b143<_0x16bd23[_0xec84('0x14')];_0x50b143+=0x1){var _0x1f2631=_0x16bd23[_0x50b143];var _0x31d0bb=createTables(_[_0xec84('0x3b')](_0x1f2631));var _0x261305;var _0x13443f=getPDFDocDefinition(_0x31d0bb);var _0x3d2e14=getPDFPrinter();var _0x184943=_0x3d2e14[_0xec84('0x3c')](_0x13443f);if(_0x40b003){_0x261305=path[_0xec84('0x39')](_0x4fed86,_0x314d30,util[_0xec84('0x1b')](_0xec84('0x3d'),_0x314d30,_0x50b143,_0xec84('0x3e')));}else{_0x261305=path['join'](_0x4fed86,util[_0xec84('0x1b')](_0xec84('0x3f'),_0x314d30,_0xec84('0x3e')));}_0x4a4cbe[_0xec84('0x20')](writePDFDocument(_0x184943,_0x261305));}return Promise[_0xec84('0x40')](_0x4a4cbe);})['then'](function(){if(_0x40b003){return new Promise(function(_0x4937c3){zipdir(path[_0xec84('0x39')](_0x4fed86,_0x314d30),{'saveTo':path[_0xec84('0x39')](_0x4fed86,util['format']('%s.%s',_0x314d30,'zip'))},function(){rimraf(path['join'](_0x4fed86,_0x314d30),function(){});_0x4937c3('zip\x20finished');});});}})[_0xec84('0x30')](function(){if(!_0x40b003)return;rimraf(path[_0xec84('0x39')](_0x4fed86,_0x314d30),function(){});})[_0xec84('0x30')](function(){logger[_0xec84('0x41')](util[_0xec84('0x1b')](_0xec84('0x42'),EXTRACTED_REPORT_ID,'PDF'));return analyticExtractedReport(_0xec84('0x43'),_0x40b003?util[_0xec84('0x1b')](_0xec84('0x3f'),_0x314d30,_0x40b003?_0xec84('0x44'):_0xec84('0x3e')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0xec84('0x41')](util[_0xec84('0x1b')](_0xec84('0x45'),EXTRACTED_REPORT_ID,_0xec84('0x46')));return db[_0xec84('0xd')]['findOne']({'where':{'id':EXTRACTED_REPORT_ID}})[_0xec84('0x30')](function(_0x40cdc0){EXTRACTED_REPORT=_0x40cdc0;return dbH['sequelize']['query'](util['format'](_0xec84('0x47'),QUERY),{'type':dbH[_0xec84('0x32')][_0xec84('0x34')][_0xec84('0x33')]});})[_0xec84('0x30')](extractReport)[_0xec84('0x48')](function(_0x3d28d4){logger[_0xec84('0x41')](util[_0xec84('0x1b')](_0xec84('0x49'),EXTRACTED_REPORT_ID,_0xec84('0x46')),util[_0xec84('0x4a')](_0x3d28d4,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xec84('0x4b'));})['finally'](function(){process['exit'](EXIT_CODE);});}main();function getPDFPrinter(){var _0x1b986a=new PdfPrinter({'Arial':{'normal':__dirname+'/fonts/arial-regular.ttf','bold':__dirname+'/fonts/arial-bold.ttf','italics':__dirname+_0xec84('0x4c'),'bolditalics':__dirname+_0xec84('0x4d')}});return _0x1b986a;}function getPDFDocDefinitionFromHTML(_0x468d6d,_0x555f8c){var _0x5e87c3=util[_0xec84('0x1b')]('%s\x20#%d',_0x555f8c[_0xec84('0x4e')],_0x555f8c[_0xec84('0x4f')]);var _0x1c0d5f=moment()[_0xec84('0x1b')](_0xec84('0x50'))['toString']();var _0x5af11b=htmlToPdfmake(_0x468d6d,{'window':window,'tableAutoSize':!![]});return{'content':[_0x5af11b],'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':'center','margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0xec84('0x51'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0xec84('0x51')}},'header':function(){return[{'text':_0xec84('0x52'),'style':_0xec84('0x21')}];},'footer':function(_0x49e7dc,_0x41d54c){return[{'text':util['format'](_0xec84('0x53'),_0x5e87c3,_0x49e7dc,_0x41d54c,_0x1c0d5f),'style':_0xec84('0x54')}];}};}function writePDFDocument(_0x411b42,_0x2bf89d){return new Promise(function(_0x1a313c,_0x3c1d20){var _0x55702a=_0x411b42[_0xec84('0x55')](fs[_0xec84('0x56')](_0x2bf89d));_0x55702a['on'](_0xec84('0x57'),function(){_0x1a313c('finish');});_0x55702a['on']('error',function(_0x3afa51){_0x3c1d20(_0x3afa51);});_0x411b42[_0xec84('0x58')]();});}exports[_0xec84('0x59')]=function(_0x4b1089,_0x52c264){var _0x402e34=getPDFPrinter();var _0x4fe206=getPDFDocDefinitionFromHTML(_0x4b1089,_0x52c264);var _0x455db7=_0x402e34[_0xec84('0x3c')](_0x4fe206);return writePDFDocument(_0x455db7,_0x52c264[_0xec84('0x1')])[_0xec84('0x48')](function(_0x542794){throw _0x542794;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index fdc40b6..5f6e21e 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 _0x9c0b=['catch','finally','util','lodash','json2xls','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','AnalyticExtractedReport','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','find','split','splitSizeXlsx','then','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','SELECT','num','Empty','length','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','dirname','basename','.xlsx','mkdirSync','join','each','%s%d.%s','xlsx','%s.%s','zip\x20finished','zip'];(function(_0xa50534,_0x29615a){var _0x4a563c=function(_0x351599){while(--_0x351599){_0xa50534['push'](_0xa50534['shift']());}};_0x4a563c(++_0x29615a);}(_0x9c0b,0xb2));var _0xb9c0=function(_0x5575cd,_0x73ab7a){_0x5575cd=_0x5575cd-0x0;var _0x4979a0=_0x9c0b[_0x5575cd];return _0x4979a0;};'use strict';var util=require(_0xb9c0('0x0'));var path=require('path');var _=require(_0xb9c0('0x1'));var fs=require('fs');var json2xls=require(_0xb9c0('0x2'));var BPromise=require('bluebird');var zipdir=require(_0xb9c0('0x3'));var rimraf=require(_0xb9c0('0x4'));var db=require(_0xb9c0('0x5'))['db'];var dbH=require(_0xb9c0('0x5'))[_0xb9c0('0x6')];var logger=require(_0xb9c0('0x7'))(_0xb9c0('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0xb9c0('0x9')][0x2]);var QUERY=process['argv'][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x2f9c4f,_0x5c3525){var _0x133c2e={'status':_0x2f9c4f};var _0x15c714={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x5c3525){_0x133c2e['savename']=_0x5c3525;}return db[_0xb9c0('0xa')]['update'](_0x133c2e,_0x15c714);}function main(){var _0x165ad2=0x1388;var _0x142271;logger[_0xb9c0('0xb')](util[_0xb9c0('0xc')](_0xb9c0('0xd'),EXTRACTED_REPORT_ID,_0xb9c0('0xe')));return db['Setting'][_0xb9c0('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xb9c0('0x10'),_0xb9c0('0x11')]})['then'](function(_0xd7a016){if(_0xd7a016){_0x142271=_0xd7a016;_0x165ad2=_0x142271[_0xb9c0('0x11')]||0x1388;}})[_0xb9c0('0x12')](function(){return dbH['sequelize'][_0xb9c0('0x13')](util[_0xb9c0('0xc')](_0xb9c0('0x14'),QUERY),{'type':dbH[_0xb9c0('0x15')]['QueryTypes'][_0xb9c0('0x16')]});})['then'](function(_0x707074){if(!_0x707074[0x0][_0xb9c0('0x17')]){return analyticExtractedReport(_0xb9c0('0x18'));}var _0x27c287=[];var _0x346b87=0x0;if(_0x142271[_0xb9c0('0x10')]){if(_0x707074&&_0x707074[_0xb9c0('0x19')]){var _0x1b18de=_['range'](_0x707074[0x0]['num']/_0x165ad2);var _0x2b56ea=Number[_0xb9c0('0x1a')](_0x707074[0x0][_0xb9c0('0x17')]/_0x165ad2)?_0x707074[0x0][_0xb9c0('0x17')]%_0x165ad2:0x0;_0x1b18de[_0xb9c0('0x1b')](function(_0x2f354e){if(_0x2f354e>0x0){_0x346b87+=_0x165ad2;}_0x27c287[_0xb9c0('0x1c')](dbH[_0xb9c0('0x15')][_0xb9c0('0x13')](util[_0xb9c0('0xc')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x165ad2,_0x346b87),{'type':dbH[_0xb9c0('0x15')]['QueryTypes'][_0xb9c0('0x16')]}));});if(_0x2b56ea>0x0){_0x346b87+=_0x165ad2;_0x27c287['push'](dbH[_0xb9c0('0x15')]['query'](util['format'](_0xb9c0('0x1d'),QUERY,_0x2b56ea,_0x346b87),{'type':dbH[_0xb9c0('0x15')][_0xb9c0('0x1e')][_0xb9c0('0x16')]}));}}}else{_0x27c287[_0xb9c0('0x1c')](dbH[_0xb9c0('0x15')]['query'](QUERY,{'type':dbH[_0xb9c0('0x15')]['QueryTypes'][_0xb9c0('0x16')]}));}var _0xedeeb7=path[_0xb9c0('0x1f')](PATH);var _0xff7f4c=path[_0xb9c0('0x20')](PATH,_0xb9c0('0x21'));var _0xa68e28=_0x142271[_0xb9c0('0x10')]&&_0x27c287[_0xb9c0('0x19')]>0x1;var _0x18bfb7=[];if(!fs['existsSync'](path['join'](_0xedeeb7,_0xff7f4c))&&_0xa68e28){fs[_0xb9c0('0x22')](path[_0xb9c0('0x23')](_0xedeeb7,_0xff7f4c));}return BPromise[_0xb9c0('0x24')](_0x27c287,function(_0xbf5b35){_0x18bfb7['push'](_0xbf5b35);})['then'](function(){for(var _0x2be3b3=0x0;_0x2be3b3<_0x18bfb7[_0xb9c0('0x19')];_0x2be3b3+=0x1){var _0x143673;var _0x549e4b=_0x18bfb7[_0x2be3b3];if(_0xa68e28){_0x143673=path['join'](_0xedeeb7,_0xff7f4c,util[_0xb9c0('0xc')](_0xb9c0('0x25'),_0xff7f4c,_0x2be3b3,_0xb9c0('0x26')));}else{_0x143673=path['join'](_0xedeeb7,util[_0xb9c0('0xc')]('%s.%s',_0xff7f4c,_0xb9c0('0x26')));}fs['writeFileSync'](_0x143673,json2xls(_0x549e4b),'binary');}})[_0xb9c0('0x12')](function(){if(_0xa68e28){return new Promise(function(_0x511bf7){zipdir(path[_0xb9c0('0x23')](_0xedeeb7,_0xff7f4c),{'saveTo':path['join'](_0xedeeb7,util[_0xb9c0('0xc')](_0xb9c0('0x27'),_0xff7f4c,'zip'))},function(_0x4a782d,_0x4a00b9){rimraf(path['join'](_0xedeeb7,_0xff7f4c),function(){});_0x511bf7(_0xb9c0('0x28'));});});}})['then'](function(){logger['info'](util[_0xb9c0('0xc')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0xb9c0('0xe')));return analyticExtractedReport('Completed',_0xa68e28?util[_0xb9c0('0xc')](_0xb9c0('0x27'),_0xff7f4c,_0xa68e28?_0xb9c0('0x29'):'xlsx'):null);});})[_0xb9c0('0x2a')](function(_0x4a02a0){logger[_0xb9c0('0xb')](util[_0xb9c0('0xc')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xb9c0('0xe')),util['inspect'](_0x4a02a0,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0xb9c0('0x2b')](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file +var _0x0924=['finally','exit','util','path','lodash','json2xls','bluebird','zip-dir','../../mysqldb','dbH','analytics','argv','savename','AnalyticExtractedReport','update','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','split','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','num','Empty','range','isInteger','forEach','push','format','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','dirname','basename','.xlsx','existsSync','join','mkdirSync','each','length','%s%d.%s','xlsx','%s.%s','writeFileSync','binary','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed'];(function(_0x22e68b,_0xa7a5ed){var _0xf177e4=function(_0x2641ad){while(--_0x2641ad){_0x22e68b['push'](_0x22e68b['shift']());}};_0xf177e4(++_0xa7a5ed);}(_0x0924,0x110));var _0x4092=function(_0x3a115e,_0x3dac39){_0x3a115e=_0x3a115e-0x0;var _0x1b7e61=_0x0924[_0x3a115e];return _0x1b7e61;};'use strict';var util=require(_0x4092('0x0'));var path=require(_0x4092('0x1'));var _=require(_0x4092('0x2'));var fs=require('fs');var json2xls=require(_0x4092('0x3'));var BPromise=require(_0x4092('0x4'));var zipdir=require(_0x4092('0x5'));var rimraf=require('rimraf');var db=require(_0x4092('0x6'))['db'];var dbH=require('../../mysqldb')[_0x4092('0x7')];var logger=require('../../config/logger')(_0x4092('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0x4092('0x9')][0x2]);var QUERY=process[_0x4092('0x9')][0x3];var PATH=process[_0x4092('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x5b49df,_0x1b8ad5){var _0x5756e2={'status':_0x5b49df};var _0x4497d6={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1b8ad5){_0x5756e2[_0x4092('0xa')]=_0x1b8ad5;}return db[_0x4092('0xb')][_0x4092('0xc')](_0x5756e2,_0x4497d6);}function main(){var _0x2b2a4e=0x1388;var _0x36b8ec;logger['info'](util['format'](_0x4092('0xd'),EXTRACTED_REPORT_ID,_0x4092('0xe')));return db[_0x4092('0xf')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x4092('0x10'),'splitSizeXlsx']})[_0x4092('0x11')](function(_0x305a41){if(_0x305a41){_0x36b8ec=_0x305a41;_0x2b2a4e=_0x36b8ec['splitSizeXlsx']||0x1388;}})['then'](function(){return dbH[_0x4092('0x12')][_0x4092('0x13')](util['format'](_0x4092('0x14'),QUERY),{'type':dbH[_0x4092('0x12')][_0x4092('0x15')]['SELECT']});})[_0x4092('0x11')](function(_0x3ca1ed){if(!_0x3ca1ed[0x0][_0x4092('0x16')]){return analyticExtractedReport(_0x4092('0x17'));}var _0x12b4b1=[];var _0x22d8a6=0x0;if(_0x36b8ec[_0x4092('0x10')]){if(_0x3ca1ed&&_0x3ca1ed['length']){var _0x1a6c4d=_[_0x4092('0x18')](_0x3ca1ed[0x0][_0x4092('0x16')]/_0x2b2a4e);var _0x5531e9=Number[_0x4092('0x19')](_0x3ca1ed[0x0]['num']/_0x2b2a4e)?_0x3ca1ed[0x0][_0x4092('0x16')]%_0x2b2a4e:0x0;_0x1a6c4d[_0x4092('0x1a')](function(_0x52fa30){if(_0x52fa30>0x0){_0x22d8a6+=_0x2b2a4e;}_0x12b4b1[_0x4092('0x1b')](dbH['sequelize']['query'](util[_0x4092('0x1c')](_0x4092('0x1d'),QUERY,_0x2b2a4e,_0x22d8a6),{'type':dbH[_0x4092('0x12')]['QueryTypes'][_0x4092('0x1e')]}));});if(_0x5531e9>0x0){_0x22d8a6+=_0x2b2a4e;_0x12b4b1['push'](dbH[_0x4092('0x12')][_0x4092('0x13')](util[_0x4092('0x1c')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x5531e9,_0x22d8a6),{'type':dbH['sequelize'][_0x4092('0x15')][_0x4092('0x1e')]}));}}}else{_0x12b4b1[_0x4092('0x1b')](dbH['sequelize'][_0x4092('0x13')](QUERY,{'type':dbH['sequelize']['QueryTypes'][_0x4092('0x1e')]}));}var _0x38e1c6=path[_0x4092('0x1f')](PATH);var _0x557b3f=path[_0x4092('0x20')](PATH,_0x4092('0x21'));var _0x5db8eb=_0x36b8ec['split']&&_0x12b4b1['length']>0x1;var _0x34ebcc=[];if(!fs[_0x4092('0x22')](path[_0x4092('0x23')](_0x38e1c6,_0x557b3f))&&_0x5db8eb){fs[_0x4092('0x24')](path[_0x4092('0x23')](_0x38e1c6,_0x557b3f));}return BPromise[_0x4092('0x25')](_0x12b4b1,function(_0x4efabf){_0x34ebcc[_0x4092('0x1b')](_0x4efabf);})[_0x4092('0x11')](function(){for(var _0xa3d239=0x0;_0xa3d239<_0x34ebcc[_0x4092('0x26')];_0xa3d239+=0x1){var _0x4e7a53;var _0x39fa06=_0x34ebcc[_0xa3d239];if(_0x5db8eb){_0x4e7a53=path[_0x4092('0x23')](_0x38e1c6,_0x557b3f,util['format'](_0x4092('0x27'),_0x557b3f,_0xa3d239,_0x4092('0x28')));}else{_0x4e7a53=path['join'](_0x38e1c6,util[_0x4092('0x1c')](_0x4092('0x29'),_0x557b3f,_0x4092('0x28')));}fs[_0x4092('0x2a')](_0x4e7a53,json2xls(_0x39fa06),_0x4092('0x2b'));}})['then'](function(){if(_0x5db8eb){return new Promise(function(_0x5b01aa){zipdir(path[_0x4092('0x23')](_0x38e1c6,_0x557b3f),{'saveTo':path[_0x4092('0x23')](_0x38e1c6,util[_0x4092('0x1c')](_0x4092('0x29'),_0x557b3f,_0x4092('0x2c')))},function(_0x93be56,_0x40d9f){rimraf(path['join'](_0x38e1c6,_0x557b3f),function(){});_0x5b01aa(_0x4092('0x2d'));});});}})[_0x4092('0x11')](function(){logger['info'](util[_0x4092('0x1c')](_0x4092('0x2e'),EXTRACTED_REPORT_ID,'XLSX'));return analyticExtractedReport(_0x4092('0x2f'),_0x5db8eb?util['format'](_0x4092('0x29'),_0x557b3f,_0x5db8eb?'zip':_0x4092('0x28')):null);});})[_0x4092('0x30')](function(_0x1ae54d){logger['info'](util[_0x4092('0x1c')](_0x4092('0x31'),EXTRACTED_REPORT_ID,_0x4092('0xe')),util[_0x4092('0x32')](_0x1ae54d,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x4092('0x33'));})[_0x4092('0x34')](function(){process[_0x4092('0x35')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index bca5121..859344c 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 _0x7ba1=['util','Interval','findAll','then','intervals','VoiceExtension','IntervalId','models','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','exten','queue','playback','hasOwnProperty','priority','extensions','extension','find','push','type','Set','format','CDR(type)=%s','VoiceExtensionId','context','outbound','cutdigits','${EXTEN:','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','createdAt','*,*,*,*','interval','map','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','toLowerCase','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','transaction','destroy','bulkCreate','sortBy','catch','error','rewrite'];(function(_0x542a40,_0x1ae834){var _0x2a9e5b=function(_0x530b5f){while(--_0x530b5f){_0x542a40['push'](_0x542a40['shift']());}};_0x2a9e5b(++_0x1ae834);}(_0x7ba1,0x128));var _0x17ba=function(_0x871d66,_0x2dec18){_0x871d66=_0x871d66-0x0;var _0x1d2d7c=_0x7ba1[_0x871d66];return _0x1d2d7c;};'use strict';var _=require('lodash');var util=require(_0x17ba('0x0'));function rewrite(_0x2a6cc6,_0x1155dc){var _0x384520=this;return _0x2a6cc6['models'][_0x17ba('0x1')][_0x17ba('0x2')]({'raw':!![]})[_0x17ba('0x3')](function(_0x4efcc1){_0x384520[_0x17ba('0x4')]=_0x4efcc1;return _0x2a6cc6['models'][_0x17ba('0x5')][_0x17ba('0x2')]({'where':{'IntervalId':_0x1155dc[_0x17ba('0x6')]},'raw':!![]});})[_0x17ba('0x3')](function(_0xd3c6c6){return _0x2a6cc6[_0x17ba('0x7')][_0x17ba('0x5')][_0x17ba('0x2')]({'where':{'exten':{'$in':_['uniq'](_['map'](_0xd3c6c6,'exten'))}},'order':[{'raw':_0x17ba('0x8')}],'raw':!![]});})['then'](function(_0x39607f){var _0x2ac790=_[_0x17ba('0x9')](_0x39607f,{'priority':'1'});var _0x2e3fac=_[_0x17ba('0x9')](_0x39607f,{'isApp':0x1});var _0x2bef1d=_[_0x17ba('0xa')](_0x2e3fac,_0x17ba('0xb'));var _0x317498=[_0x17ba('0xc'),_0x17ba('0xd')];var _0x1e8349=[];var _0x3594bc=[];for(var _0x1f5baf in _0x2bef1d){if(_0x2bef1d[_0x17ba('0xe')](_0x1f5baf)){_0x384520[_0x17ba('0xf')]=0x2;_0x384520[_0x17ba('0x10')]=[];_0x384520[_0x17ba('0x11')]=_[_0x17ba('0x12')](_0x2ac790,{'exten':_0x2bef1d[_0x1f5baf][0x0][_0x17ba('0xb')]});_0x384520[_0x17ba('0x10')][_0x17ba('0x13')]({'type':_0x2bef1d[_0x1f5baf][0x0][_0x17ba('0x14')],'app':_0x17ba('0x15'),'appdata':util[_0x17ba('0x16')](_0x17ba('0x17'),_0x2bef1d[_0x1f5baf][0x0][_0x17ba('0x14')]),'context':_0x2bef1d[_0x1f5baf][0x0]['context'],'exten':_0x2bef1d[_0x1f5baf][0x0][_0x17ba('0xb')],'priority':_0x384520['priority']++,'VoiceExtensionId':_0x2bef1d[_0x1f5baf][0x0][_0x17ba('0x18')]});if(_0x2bef1d[_0x1f5baf][0x0][_0x17ba('0x14')]==='inbound'){_0x384520[_0x17ba('0x10')][_0x17ba('0x13')]({'type':_0x2bef1d[_0x1f5baf][0x0][_0x17ba('0x14')],'app':_0x17ba('0x15'),'appdata':'CDR(routeid)='+_0x2bef1d[_0x1f5baf][0x0][_0x17ba('0x18')],'context':_0x2bef1d[_0x1f5baf][0x0][_0x17ba('0x19')],'exten':_0x2bef1d[_0x1f5baf][0x0][_0x17ba('0xb')],'priority':_0x384520[_0x17ba('0xf')]++,'VoiceExtensionId':_0x2bef1d[_0x1f5baf][0x0][_0x17ba('0x18')]});}else if(_0x2bef1d[_0x1f5baf][0x0]['type']===_0x17ba('0x1a')){if(_0x384520[_0x17ba('0x11')]){_0x384520[_0x17ba('0x10')]['push']({'type':_0x2bef1d[_0x1f5baf][0x0][_0x17ba('0x14')],'app':_0x17ba('0x15'),'appdata':'CDR(destination)='+(_0x384520[_0x17ba('0x11')][_0x17ba('0x1b')]?_0x17ba('0x1c')+_0x384520[_0x17ba('0x11')][_0x17ba('0x1b')]+'}':'${EXTEN}'),'context':_0x2bef1d[_0x1f5baf][0x0][_0x17ba('0x19')],'exten':_0x2bef1d[_0x1f5baf][0x0]['exten'],'priority':_0x384520['priority']++,'VoiceExtensionId':_0x2bef1d[_0x1f5baf][0x0]['VoiceExtensionId']});}_0x384520['extensions'][_0x17ba('0x13')]({'type':_0x2bef1d[_0x1f5baf][0x0][_0x17ba('0x14')],'app':_0x17ba('0x15'),'appdata':_0x17ba('0x1d')+_0x2bef1d[_0x1f5baf][0x0][_0x17ba('0x18')],'context':_0x2bef1d[_0x1f5baf][0x0][_0x17ba('0x19')],'exten':_0x2bef1d[_0x1f5baf][0x0][_0x17ba('0xb')],'priority':_0x384520[_0x17ba('0xf')]++,'VoiceExtensionId':_0x2bef1d[_0x1f5baf][0x0]['VoiceExtensionId']});var _0x35a811=_0x384520[_0x17ba('0xf')]++;_0x384520[_0x17ba('0x10')][_0x17ba('0x13')]({'type':_0x2bef1d[_0x1f5baf][0x0][_0x17ba('0x14')],'app':_0x17ba('0x1e'),'appdata':_0x17ba('0x1f')+(_0x35a811+0x2)+_0x17ba('0x20')+(_0x35a811+0x1)+')','context':_0x2bef1d[_0x1f5baf][0x0][_0x17ba('0x19')],'exten':_0x2bef1d[_0x1f5baf][0x0]['exten'],'priority':_0x35a811,'VoiceExtensionId':_0x2bef1d[_0x1f5baf][0x0][_0x17ba('0x18')]});if(_0x384520['extension']){_0x384520[_0x17ba('0x10')][_0x17ba('0x13')]({'type':_0x2bef1d[_0x1f5baf][0x0][_0x17ba('0x14')],'app':_0x17ba('0x15'),'appdata':_0x384520['extension'][_0x17ba('0x1b')]?_0x17ba('0x21')+_0x384520[_0x17ba('0x11')][_0x17ba('0x1b')]+'}':_0x17ba('0x22'),'context':_0x2bef1d[_0x1f5baf][0x0][_0x17ba('0x19')],'exten':_0x2bef1d[_0x1f5baf][0x0][_0x17ba('0xb')],'priority':_0x384520['priority']++,'VoiceExtensionId':_0x2bef1d[_0x1f5baf][0x0][_0x17ba('0x18')]});}_0x384520[_0x17ba('0x10')][_0x17ba('0x13')]({'type':_0x2bef1d[_0x1f5baf][0x0]['type'],'app':'Set','appdata':_0x17ba('0x23')+_0x2bef1d[_0x1f5baf][0x0]['VoiceExtensionId'],'context':_0x2bef1d[_0x1f5baf][0x0]['context'],'exten':_0x2bef1d[_0x1f5baf][0x0]['exten'],'priority':_0x384520[_0x17ba('0xf')]++,'VoiceExtensionId':_0x2bef1d[_0x1f5baf][0x0]['VoiceExtensionId']});if(_0x384520[_0x17ba('0x11')]&&_0x384520['extension'][_0x17ba('0xe')](_0x17ba('0x24'))&&_0x384520['extension'][_0x17ba('0x24')]!==_0x17ba('0x25')){_0x384520[_0x17ba('0x10')][_0x17ba('0x13')]({'type':_0x2bef1d[_0x1f5baf][0x0][_0x17ba('0x14')],'app':'Set','appdata':_0x17ba('0x26'),'context':_0x2bef1d[_0x1f5baf][0x0]['context'],'exten':_0x2bef1d[_0x1f5baf][0x0][_0x17ba('0xb')],'priority':_0x384520[_0x17ba('0xf')]++,'VoiceExtensionId':_0x2bef1d[_0x1f5baf][0x0][_0x17ba('0x18')]});_0x384520[_0x17ba('0x10')][_0x17ba('0x13')]({'type':_0x2bef1d[_0x1f5baf][0x0]['type'],'app':_0x17ba('0x15'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x384520[_0x17ba('0x11')][_0x17ba('0x24')]||_0x17ba('0x27'),'context':_0x2bef1d[_0x1f5baf][0x0][_0x17ba('0x19')],'exten':_0x2bef1d[_0x1f5baf][0x0][_0x17ba('0xb')],'priority':_0x384520[_0x17ba('0xf')]++,'VoiceExtensionId':_0x2bef1d[_0x1f5baf][0x0]['VoiceExtensionId']});}}_0x384520[_0x17ba('0x10')][_0x17ba('0x13')]({'type':_0x2bef1d[_0x1f5baf][0x0]['type'],'app':_0x17ba('0x15'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x2bef1d[_0x1f5baf][0x0][_0x17ba('0x19')],'exten':_0x2bef1d[_0x1f5baf][0x0][_0x17ba('0xb')],'priority':_0x384520[_0x17ba('0xf')]++,'VoiceExtensionId':_0x2bef1d[_0x1f5baf][0x0][_0x17ba('0x18')]});_0x384520['extensions'][_0x17ba('0x13')]({'type':_0x2bef1d[_0x1f5baf][0x0][_0x17ba('0x14')],'app':_0x17ba('0x15'),'appdata':_0x17ba('0x28'),'context':_0x2bef1d[_0x1f5baf][0x0][_0x17ba('0x19')],'exten':_0x2bef1d[_0x1f5baf][0x0][_0x17ba('0xb')],'priority':_0x384520[_0x17ba('0xf')]++,'VoiceExtensionId':_0x2bef1d[_0x1f5baf][0x0][_0x17ba('0x18')]});_0x384520['extensions'][_0x17ba('0x13')]({'type':_0x2bef1d[_0x1f5baf][0x0][_0x17ba('0x14')],'app':'Set','appdata':_0x17ba('0x29'),'context':_0x2bef1d[_0x1f5baf][0x0][_0x17ba('0x19')],'exten':_0x2bef1d[_0x1f5baf][0x0][_0x17ba('0xb')],'priority':_0x384520[_0x17ba('0xf')]++,'VoiceExtensionId':_0x2bef1d[_0x1f5baf][0x0][_0x17ba('0x18')]});for(var _0x10e9b0=0x0,_0x4097a4=0x0;_0x10e9b0<_0x2bef1d[_0x1f5baf][_0x17ba('0x2a')];_0x10e9b0+=0x1,_0x4097a4=0x0){var _0x1ea8b4=_0x2bef1d[_0x1f5baf][_0x10e9b0];if(_0x1ea8b4['type']){_0x1ea8b4[_0x17ba('0x14')]=_0x1ea8b4[_0x17ba('0x14')]['toLowerCase']();}var _0x1e6dcb=[];var _0x49a4aa=[];delete _0x1ea8b4['id'];delete _0x1ea8b4[_0x17ba('0x2b')];delete _0x1ea8b4['updatedAt'];var _0x1d9cab=_0x1ea8b4['interval']!==_0x17ba('0x2c')?[_0x1ea8b4[_0x17ba('0x2d')]]:_0x1ea8b4[_0x17ba('0x6')]?_[_0x17ba('0x2e')](_['filter'](_0x384520[_0x17ba('0x4')],{'IntervalId':_0x1ea8b4[_0x17ba('0x6')]}),'interval'):[];if(_0x1ea8b4[_0x17ba('0xe')](_0x17ba('0x2f'))){if(_0x1ea8b4[_0x17ba('0x2f')]&&_0x1ea8b4[_0x17ba('0x2f')]!=='--'){_0x1e6dcb[_0x17ba('0x13')]({'type':_0x1ea8b4[_0x17ba('0x14')],'app':_0x17ba('0x15'),'appdata':_0x17ba('0x30')+_0x1ea8b4[_0x17ba('0x2f')],'context':_0x1ea8b4[_0x17ba('0x19')],'exten':_0x1ea8b4['exten'],'priority':_0x1d9cab[_0x17ba('0x2a')]+_0x384520['priority']+_0x4097a4++,'VoiceExtensionId':_0x1ea8b4[_0x17ba('0x18')]});}}if(_0x1ea8b4[_0x17ba('0x14')]===_0x17ba('0x1a')&&_0x1ea8b4[_0x17ba('0xe')]('callerID')){if(_0x1ea8b4[_0x17ba('0x31')]){_0x1e6dcb['push']({'type':_0x1ea8b4['type'],'app':'ExecIf','appdata':_0x17ba('0x32')+_0x1ea8b4[_0x17ba('0x31')]+')','context':_0x1ea8b4[_0x17ba('0x19')],'exten':_0x1ea8b4[_0x17ba('0xb')],'priority':_0x1d9cab[_0x17ba('0x2a')]+_0x384520[_0x17ba('0xf')]+_0x4097a4++,'VoiceExtensionId':_0x1ea8b4[_0x17ba('0x18')]});}else{_0x1e6dcb[_0x17ba('0x13')]({'type':_0x1ea8b4['type'],'app':_0x17ba('0x1e'),'appdata':_0x17ba('0x33'),'context':_0x1ea8b4[_0x17ba('0x19')],'exten':_0x1ea8b4['exten'],'priority':_0x1d9cab['length']+_0x384520[_0x17ba('0xf')]+_0x4097a4++,'VoiceExtensionId':_0x1ea8b4[_0x17ba('0x18')]});}}if(_0x1ea8b4['hasOwnProperty'](_0x17ba('0x34'))){if(_0x317498[_0x17ba('0x35')](_0x1ea8b4[_0x17ba('0x36')][_0x17ba('0x37')]())>=0x0&&_0x1ea8b4[_0x17ba('0x38')]!==_0x17ba('0x39')){if(_0x1ea8b4[_0x17ba('0x34')]){_0x1e6dcb[_0x17ba('0x13')]({'type':_0x1ea8b4[_0x17ba('0x14')],'app':'ExecIf','appdata':_0x17ba('0x3a'),'context':_0x1ea8b4[_0x17ba('0x19')],'exten':_0x1ea8b4[_0x17ba('0xb')],'priority':_0x1d9cab[_0x17ba('0x2a')]+_0x384520[_0x17ba('0xf')]+_0x4097a4++,'VoiceExtensionId':_0x1ea8b4['VoiceExtensionId']});_0x1e6dcb[_0x17ba('0x13')]({'type':_0x1ea8b4[_0x17ba('0x14')],'app':_0x17ba('0x15'),'appdata':_0x17ba('0x3b'),'context':_0x1ea8b4[_0x17ba('0x19')],'exten':_0x1ea8b4[_0x17ba('0xb')],'priority':_0x1d9cab[_0x17ba('0x2a')]+_0x384520['priority']+_0x4097a4++,'VoiceExtensionId':_0x1ea8b4[_0x17ba('0x18')]});}else{_0x1e6dcb[_0x17ba('0x13')]({'type':_0x1ea8b4[_0x17ba('0x14')],'app':_0x17ba('0x1e'),'appdata':_0x17ba('0x3c'),'context':_0x1ea8b4[_0x17ba('0x19')],'exten':_0x1ea8b4['exten'],'priority':_0x1d9cab['length']+_0x384520['priority']+_0x4097a4++,'VoiceExtensionId':_0x1ea8b4['VoiceExtensionId']});_0x1e6dcb[_0x17ba('0x13')]({'type':_0x1ea8b4[_0x17ba('0x14')],'app':'Set','appdata':_0x17ba('0x3d'),'context':_0x1ea8b4[_0x17ba('0x19')],'exten':_0x1ea8b4[_0x17ba('0xb')],'priority':_0x1d9cab['length']+_0x384520[_0x17ba('0xf')]+_0x4097a4++,'VoiceExtensionId':_0x1ea8b4[_0x17ba('0x18')]});}}}for(var _0x260440=0x0;_0x260440<_0x1d9cab[_0x17ba('0x2a')];_0x260440+=0x1){var _0x3d485e=_0x384520[_0x17ba('0xf')]+_0x1d9cab[_0x17ba('0x2a')];var _0x3d49e3=_0x260440===_0x1d9cab[_0x17ba('0x2a')]-0x1?_0x384520['priority']+_0x1e6dcb['length']+_0x49a4aa[_0x17ba('0x2a')]+0x2:_0x384520['priority']+_0x260440+0x1;_0x1e6dcb[_0x17ba('0x3e')](_0x260440,0x0,{'type':_0x1ea8b4[_0x17ba('0x14')],'app':_0x17ba('0x3f'),'appdata':_0x1d9cab[_0x260440]+'?'+_0x1ea8b4['context']+_0x17ba('0x40')+_0x3d485e+':'+_0x1ea8b4['context']+_0x17ba('0x40')+_0x3d49e3,'exten':_0x1ea8b4['exten'],'context':_0x1ea8b4[_0x17ba('0x19')],'priority':_0x384520[_0x17ba('0xf')]+_0x260440,'VoiceExtensionId':_0x2bef1d[_0x1f5baf][0x0][_0x17ba('0x18')]});}_0x1ea8b4[_0x17ba('0xf')]=_0x1e6dcb[_0x17ba('0x2a')]?_[_0x17ba('0x41')](_0x1e6dcb)[_0x17ba('0xf')]+0x1:_0x384520[_0x17ba('0xf')];_0x384520[_0x17ba('0xf')]=(_0x49a4aa[_0x17ba('0x2a')]?_['last'](_0x49a4aa)[_0x17ba('0xf')]:_0x1ea8b4['priority'])+0x1;_0x384520[_0x17ba('0x10')]=_[_0x17ba('0x42')](_0x384520['extensions'],_0x1e6dcb,[_0x1ea8b4],_0x49a4aa);}_0x384520[_0x17ba('0x10')][_0x17ba('0x13')]({'type':_0x2bef1d[_0x1f5baf][0x0]['type'],'app':'Hangup','exten':_0x2bef1d[_0x1f5baf][0x0][_0x17ba('0xb')],'context':_0x2bef1d[_0x1f5baf][0x0][_0x17ba('0x19')],'priority':_0x384520[_0x17ba('0xf')],'VoiceExtensionId':_0x2bef1d[_0x1f5baf][0x0]['VoiceExtensionId']});_0x1e8349[_0x17ba('0x13')](_0x2bef1d[_0x1f5baf][0x0][_0x17ba('0x18')]);_0x3594bc=_[_0x17ba('0x42')](_0x3594bc,_0x384520[_0x17ba('0x10')]);}}return _0x2a6cc6[_0x17ba('0x43')](function(_0x23da1f){return _0x2a6cc6[_0x17ba('0x7')][_0x17ba('0x5')][_0x17ba('0x44')]({'where':{'VoiceExtensionId':{'$in':_0x1e8349}},'transaction':_0x23da1f})[_0x17ba('0x3')](function(_0xeb6af6){return _0x2a6cc6[_0x17ba('0x7')][_0x17ba('0x5')][_0x17ba('0x45')](_[_0x17ba('0x46')](_0x3594bc,_0x17ba('0xf')),{'transaction':_0x23da1f});});});})[_0x17ba('0x47')](function(_0x3dd4c8){console[_0x17ba('0x48')](_0x3dd4c8);});}exports[_0x17ba('0x49')]=rewrite; \ No newline at end of file +var _0x3859=['MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','updatedAt','*,*,*,*','interval','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','destroy','error','rewrite','lodash','util','models','findAll','then','intervals','IntervalId','VoiceExtension','uniq','map','exten','filter','groupBy','queue','playback','hasOwnProperty','extensions','extension','push','type','Set','format','context','priority','inbound','CDR(routeid)=','VoiceExtensionId','outbound','cutdigits','${EXTEN:','${EXTEN}','ExecIf','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','recordingFormat','none','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0'];(function(_0xc05552,_0x48f6e7){var _0x8cb3f3=function(_0x427947){while(--_0x427947){_0xc05552['push'](_0xc05552['shift']());}};_0x8cb3f3(++_0x48f6e7);}(_0x3859,0x1df));var _0x9385=function(_0x1cf987,_0x51a548){_0x1cf987=_0x1cf987-0x0;var _0x87ab90=_0x3859[_0x1cf987];return _0x87ab90;};'use strict';var _=require(_0x9385('0x0'));var util=require(_0x9385('0x1'));function rewrite(_0x2ce2ef,_0x1557bf){var _0x15d565=this;return _0x2ce2ef[_0x9385('0x2')]['Interval'][_0x9385('0x3')]({'raw':!![]})[_0x9385('0x4')](function(_0x1bbee4){_0x15d565[_0x9385('0x5')]=_0x1bbee4;return _0x2ce2ef[_0x9385('0x2')]['VoiceExtension']['findAll']({'where':{'IntervalId':_0x1557bf[_0x9385('0x6')]},'raw':!![]});})['then'](function(_0x3906aa){return _0x2ce2ef[_0x9385('0x2')][_0x9385('0x7')][_0x9385('0x3')]({'where':{'exten':{'$in':_[_0x9385('0x8')](_[_0x9385('0x9')](_0x3906aa,_0x9385('0xa')))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})[_0x9385('0x4')](function(_0x22e9f1){var _0x31da48=_[_0x9385('0xb')](_0x22e9f1,{'priority':'1'});var _0xbad44a=_[_0x9385('0xb')](_0x22e9f1,{'isApp':0x1});var _0x2846c9=_[_0x9385('0xc')](_0xbad44a,_0x9385('0xa'));var _0x57b4fa=[_0x9385('0xd'),_0x9385('0xe')];var _0x1fc13f=[];var _0x5df824=[];for(var _0x2b671f in _0x2846c9){if(_0x2846c9[_0x9385('0xf')](_0x2b671f)){_0x15d565['priority']=0x2;_0x15d565[_0x9385('0x10')]=[];_0x15d565[_0x9385('0x11')]=_['find'](_0x31da48,{'exten':_0x2846c9[_0x2b671f][0x0][_0x9385('0xa')]});_0x15d565[_0x9385('0x10')][_0x9385('0x12')]({'type':_0x2846c9[_0x2b671f][0x0][_0x9385('0x13')],'app':_0x9385('0x14'),'appdata':util[_0x9385('0x15')]('CDR(type)=%s',_0x2846c9[_0x2b671f][0x0][_0x9385('0x13')]),'context':_0x2846c9[_0x2b671f][0x0][_0x9385('0x16')],'exten':_0x2846c9[_0x2b671f][0x0][_0x9385('0xa')],'priority':_0x15d565[_0x9385('0x17')]++,'VoiceExtensionId':_0x2846c9[_0x2b671f][0x0]['VoiceExtensionId']});if(_0x2846c9[_0x2b671f][0x0][_0x9385('0x13')]===_0x9385('0x18')){_0x15d565[_0x9385('0x10')][_0x9385('0x12')]({'type':_0x2846c9[_0x2b671f][0x0][_0x9385('0x13')],'app':'Set','appdata':_0x9385('0x19')+_0x2846c9[_0x2b671f][0x0][_0x9385('0x1a')],'context':_0x2846c9[_0x2b671f][0x0][_0x9385('0x16')],'exten':_0x2846c9[_0x2b671f][0x0][_0x9385('0xa')],'priority':_0x15d565[_0x9385('0x17')]++,'VoiceExtensionId':_0x2846c9[_0x2b671f][0x0][_0x9385('0x1a')]});}else if(_0x2846c9[_0x2b671f][0x0]['type']===_0x9385('0x1b')){if(_0x15d565[_0x9385('0x11')]){_0x15d565[_0x9385('0x10')]['push']({'type':_0x2846c9[_0x2b671f][0x0][_0x9385('0x13')],'app':_0x9385('0x14'),'appdata':'CDR(destination)='+(_0x15d565[_0x9385('0x11')][_0x9385('0x1c')]?_0x9385('0x1d')+_0x15d565[_0x9385('0x11')][_0x9385('0x1c')]+'}':_0x9385('0x1e')),'context':_0x2846c9[_0x2b671f][0x0][_0x9385('0x16')],'exten':_0x2846c9[_0x2b671f][0x0]['exten'],'priority':_0x15d565[_0x9385('0x17')]++,'VoiceExtensionId':_0x2846c9[_0x2b671f][0x0][_0x9385('0x1a')]});}_0x15d565[_0x9385('0x10')][_0x9385('0x12')]({'type':_0x2846c9[_0x2b671f][0x0]['type'],'app':_0x9385('0x14'),'appdata':'CDR(routeid)='+_0x2846c9[_0x2b671f][0x0][_0x9385('0x1a')],'context':_0x2846c9[_0x2b671f][0x0][_0x9385('0x16')],'exten':_0x2846c9[_0x2b671f][0x0][_0x9385('0xa')],'priority':_0x15d565[_0x9385('0x17')]++,'VoiceExtensionId':_0x2846c9[_0x2b671f][0x0][_0x9385('0x1a')]});var _0x3e9e78=_0x15d565[_0x9385('0x17')]++;_0x15d565[_0x9385('0x10')][_0x9385('0x12')]({'type':_0x2846c9[_0x2b671f][0x0][_0x9385('0x13')],'app':_0x9385('0x1f'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x3e9e78+0x2)+_0x9385('0x20')+(_0x3e9e78+0x1)+')','context':_0x2846c9[_0x2b671f][0x0][_0x9385('0x16')],'exten':_0x2846c9[_0x2b671f][0x0]['exten'],'priority':_0x3e9e78,'VoiceExtensionId':_0x2846c9[_0x2b671f][0x0][_0x9385('0x1a')]});if(_0x15d565[_0x9385('0x11')]){_0x15d565[_0x9385('0x10')][_0x9385('0x12')]({'type':_0x2846c9[_0x2b671f][0x0]['type'],'app':_0x9385('0x14'),'appdata':_0x15d565[_0x9385('0x11')][_0x9385('0x1c')]?_0x9385('0x21')+_0x15d565[_0x9385('0x11')]['cutdigits']+'}':_0x9385('0x22'),'context':_0x2846c9[_0x2b671f][0x0][_0x9385('0x16')],'exten':_0x2846c9[_0x2b671f][0x0][_0x9385('0xa')],'priority':_0x15d565['priority']++,'VoiceExtensionId':_0x2846c9[_0x2b671f][0x0]['VoiceExtensionId']});}_0x15d565[_0x9385('0x10')]['push']({'type':_0x2846c9[_0x2b671f][0x0]['type'],'app':_0x9385('0x14'),'appdata':'outboundrouteid='+_0x2846c9[_0x2b671f][0x0][_0x9385('0x1a')],'context':_0x2846c9[_0x2b671f][0x0][_0x9385('0x16')],'exten':_0x2846c9[_0x2b671f][0x0][_0x9385('0xa')],'priority':_0x15d565[_0x9385('0x17')]++,'VoiceExtensionId':_0x2846c9[_0x2b671f][0x0][_0x9385('0x1a')]});if(_0x15d565[_0x9385('0x11')]&&_0x15d565[_0x9385('0x11')]['hasOwnProperty'](_0x9385('0x23'))&&_0x15d565[_0x9385('0x11')][_0x9385('0x23')]!==_0x9385('0x24')){_0x15d565[_0x9385('0x10')]['push']({'type':_0x2846c9[_0x2b671f][0x0][_0x9385('0x13')],'app':_0x9385('0x14'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x2846c9[_0x2b671f][0x0][_0x9385('0x16')],'exten':_0x2846c9[_0x2b671f][0x0][_0x9385('0xa')],'priority':_0x15d565[_0x9385('0x17')]++,'VoiceExtensionId':_0x2846c9[_0x2b671f][0x0][_0x9385('0x1a')]});_0x15d565[_0x9385('0x10')]['push']({'type':_0x2846c9[_0x2b671f][0x0]['type'],'app':'Set','appdata':_0x9385('0x25')+_0x15d565[_0x9385('0x11')]['recordingFormat']||_0x9385('0x26'),'context':_0x2846c9[_0x2b671f][0x0][_0x9385('0x16')],'exten':_0x2846c9[_0x2b671f][0x0][_0x9385('0xa')],'priority':_0x15d565[_0x9385('0x17')]++,'VoiceExtensionId':_0x2846c9[_0x2b671f][0x0][_0x9385('0x1a')]});}}_0x15d565[_0x9385('0x10')][_0x9385('0x12')]({'type':_0x2846c9[_0x2b671f][0x0]['type'],'app':_0x9385('0x14'),'appdata':_0x9385('0x27'),'context':_0x2846c9[_0x2b671f][0x0][_0x9385('0x16')],'exten':_0x2846c9[_0x2b671f][0x0][_0x9385('0xa')],'priority':_0x15d565[_0x9385('0x17')]++,'VoiceExtensionId':_0x2846c9[_0x2b671f][0x0][_0x9385('0x1a')]});_0x15d565[_0x9385('0x10')][_0x9385('0x12')]({'type':_0x2846c9[_0x2b671f][0x0][_0x9385('0x13')],'app':_0x9385('0x14'),'appdata':_0x9385('0x28'),'context':_0x2846c9[_0x2b671f][0x0][_0x9385('0x16')],'exten':_0x2846c9[_0x2b671f][0x0][_0x9385('0xa')],'priority':_0x15d565['priority']++,'VoiceExtensionId':_0x2846c9[_0x2b671f][0x0][_0x9385('0x1a')]});_0x15d565['extensions'][_0x9385('0x12')]({'type':_0x2846c9[_0x2b671f][0x0][_0x9385('0x13')],'app':_0x9385('0x14'),'appdata':_0x9385('0x29'),'context':_0x2846c9[_0x2b671f][0x0][_0x9385('0x16')],'exten':_0x2846c9[_0x2b671f][0x0][_0x9385('0xa')],'priority':_0x15d565[_0x9385('0x17')]++,'VoiceExtensionId':_0x2846c9[_0x2b671f][0x0]['VoiceExtensionId']});for(var _0x595af4=0x0,_0x5f5b34=0x0;_0x595af4<_0x2846c9[_0x2b671f][_0x9385('0x2a')];_0x595af4+=0x1,_0x5f5b34=0x0){var _0x55c4d1=_0x2846c9[_0x2b671f][_0x595af4];if(_0x55c4d1['type']){_0x55c4d1[_0x9385('0x13')]=_0x55c4d1['type'][_0x9385('0x2b')]();}var _0x57efd7=[];var _0x1112ee=[];delete _0x55c4d1['id'];delete _0x55c4d1[_0x9385('0x2c')];delete _0x55c4d1[_0x9385('0x2d')];var _0x46b821=_0x55c4d1['interval']!==_0x9385('0x2e')?[_0x55c4d1[_0x9385('0x2f')]]:_0x55c4d1[_0x9385('0x6')]?_[_0x9385('0x9')](_['filter'](_0x15d565[_0x9385('0x5')],{'IntervalId':_0x55c4d1[_0x9385('0x6')]}),_0x9385('0x2f')):[];if(_0x55c4d1[_0x9385('0xf')](_0x9385('0x30'))){if(_0x55c4d1[_0x9385('0x30')]&&_0x55c4d1[_0x9385('0x30')]!=='--'){_0x57efd7[_0x9385('0x12')]({'type':_0x55c4d1[_0x9385('0x13')],'app':_0x9385('0x14'),'appdata':_0x9385('0x31')+_0x55c4d1[_0x9385('0x30')],'context':_0x55c4d1['context'],'exten':_0x55c4d1[_0x9385('0xa')],'priority':_0x46b821[_0x9385('0x2a')]+_0x15d565[_0x9385('0x17')]+_0x5f5b34++,'VoiceExtensionId':_0x55c4d1[_0x9385('0x1a')]});}}if(_0x55c4d1['type']===_0x9385('0x1b')&&_0x55c4d1['hasOwnProperty']('callerID')){if(_0x55c4d1['callerID']){_0x57efd7[_0x9385('0x12')]({'type':_0x55c4d1['type'],'app':_0x9385('0x1f'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x55c4d1[_0x9385('0x32')]+')','context':_0x55c4d1[_0x9385('0x16')],'exten':_0x55c4d1[_0x9385('0xa')],'priority':_0x46b821[_0x9385('0x2a')]+_0x15d565[_0x9385('0x17')]+_0x5f5b34++,'VoiceExtensionId':_0x55c4d1['VoiceExtensionId']});}else{_0x57efd7['push']({'type':_0x55c4d1[_0x9385('0x13')],'app':'ExecIf','appdata':_0x9385('0x33'),'context':_0x55c4d1['context'],'exten':_0x55c4d1[_0x9385('0xa')],'priority':_0x46b821[_0x9385('0x2a')]+_0x15d565['priority']+_0x5f5b34++,'VoiceExtensionId':_0x55c4d1[_0x9385('0x1a')]});}}if(_0x55c4d1[_0x9385('0xf')]('answer')){if(_0x57b4fa['indexOf'](_0x55c4d1['app']['toLowerCase']())>=0x0&&_0x55c4d1[_0x9385('0x34')]!==_0x9385('0x35')){if(_0x55c4d1['answer']){_0x57efd7['push']({'type':_0x55c4d1['type'],'app':'ExecIf','appdata':_0x9385('0x36'),'context':_0x55c4d1[_0x9385('0x16')],'exten':_0x55c4d1['exten'],'priority':_0x46b821[_0x9385('0x2a')]+_0x15d565[_0x9385('0x17')]+_0x5f5b34++,'VoiceExtensionId':_0x55c4d1[_0x9385('0x1a')]});_0x57efd7[_0x9385('0x12')]({'type':_0x55c4d1['type'],'app':_0x9385('0x14'),'appdata':_0x9385('0x37'),'context':_0x55c4d1[_0x9385('0x16')],'exten':_0x55c4d1[_0x9385('0xa')],'priority':_0x46b821['length']+_0x15d565['priority']+_0x5f5b34++,'VoiceExtensionId':_0x55c4d1[_0x9385('0x1a')]});}else{_0x57efd7[_0x9385('0x12')]({'type':_0x55c4d1[_0x9385('0x13')],'app':_0x9385('0x1f'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x55c4d1[_0x9385('0x16')],'exten':_0x55c4d1[_0x9385('0xa')],'priority':_0x46b821['length']+_0x15d565['priority']+_0x5f5b34++,'VoiceExtensionId':_0x55c4d1[_0x9385('0x1a')]});_0x57efd7[_0x9385('0x12')]({'type':_0x55c4d1[_0x9385('0x13')],'app':_0x9385('0x14'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x55c4d1[_0x9385('0x16')],'exten':_0x55c4d1['exten'],'priority':_0x46b821[_0x9385('0x2a')]+_0x15d565[_0x9385('0x17')]+_0x5f5b34++,'VoiceExtensionId':_0x55c4d1['VoiceExtensionId']});}}}for(var _0x131203=0x0;_0x131203<_0x46b821['length'];_0x131203+=0x1){var _0x36bf9e=_0x15d565[_0x9385('0x17')]+_0x46b821[_0x9385('0x2a')];var _0x3203ec=_0x131203===_0x46b821[_0x9385('0x2a')]-0x1?_0x15d565[_0x9385('0x17')]+_0x57efd7[_0x9385('0x2a')]+_0x1112ee['length']+0x2:_0x15d565[_0x9385('0x17')]+_0x131203+0x1;_0x57efd7[_0x9385('0x38')](_0x131203,0x0,{'type':_0x55c4d1[_0x9385('0x13')],'app':_0x9385('0x39'),'appdata':_0x46b821[_0x131203]+'?'+_0x55c4d1[_0x9385('0x16')]+_0x9385('0x3a')+_0x36bf9e+':'+_0x55c4d1[_0x9385('0x16')]+',${EXTEN},'+_0x3203ec,'exten':_0x55c4d1[_0x9385('0xa')],'context':_0x55c4d1[_0x9385('0x16')],'priority':_0x15d565[_0x9385('0x17')]+_0x131203,'VoiceExtensionId':_0x2846c9[_0x2b671f][0x0][_0x9385('0x1a')]});}_0x55c4d1[_0x9385('0x17')]=_0x57efd7['length']?_[_0x9385('0x3b')](_0x57efd7)[_0x9385('0x17')]+0x1:_0x15d565['priority'];_0x15d565[_0x9385('0x17')]=(_0x1112ee[_0x9385('0x2a')]?_['last'](_0x1112ee)['priority']:_0x55c4d1[_0x9385('0x17')])+0x1;_0x15d565[_0x9385('0x10')]=_[_0x9385('0x3c')](_0x15d565[_0x9385('0x10')],_0x57efd7,[_0x55c4d1],_0x1112ee);}_0x15d565['extensions']['push']({'type':_0x2846c9[_0x2b671f][0x0][_0x9385('0x13')],'app':_0x9385('0x3d'),'exten':_0x2846c9[_0x2b671f][0x0]['exten'],'context':_0x2846c9[_0x2b671f][0x0][_0x9385('0x16')],'priority':_0x15d565[_0x9385('0x17')],'VoiceExtensionId':_0x2846c9[_0x2b671f][0x0]['VoiceExtensionId']});_0x1fc13f[_0x9385('0x12')](_0x2846c9[_0x2b671f][0x0][_0x9385('0x1a')]);_0x5df824=_[_0x9385('0x3c')](_0x5df824,_0x15d565['extensions']);}}return _0x2ce2ef['transaction'](function(_0x11720d){return _0x2ce2ef['models'][_0x9385('0x7')][_0x9385('0x3e')]({'where':{'VoiceExtensionId':{'$in':_0x1fc13f}},'transaction':_0x11720d})[_0x9385('0x4')](function(_0x4cc242){return _0x2ce2ef[_0x9385('0x2')]['VoiceExtension']['bulkCreate'](_['sortBy'](_0x5df824,_0x9385('0x17')),{'transaction':_0x11720d});});});})['catch'](function(_0x16519b){console[_0x9385('0x3f')](_0x16519b);});}exports[_0x9385('0x40')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 3183ab6..c3e495a 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 _0x1e6a=['../../../api/cmContact/cmContact.socket','argv','undefined','Missing\x20filepath\x20parameter!','null','Missing\x20binding\x20parameters!','split','Missing\x20ListId\x20parameter!','contact','index','test','isNil','error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','find','duplicate','Duplicate\x20Contact','CmContact','create','keys','then','pick','catch','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','checkHopper','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','createdAt','updatedAt','select','field','phone','NOW()','toString','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','from','\x20=\x20?','id\x20IN\x20?','str','calleridnum','cm_hopper_final','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','get','always','push','query','VoiceQueueId','sequelize','all','BlackLists','Campaign','CampaignId','onlyIfOpen','generalCheckHopper','Error\x20processing\x20rows\x20block:','emit','contact:csv_','resolve','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','CSV\x20import\x20process\x20stopped!','createReadStream','pause','info','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','lodash','squel','papaparse','../../../mysqldb','../../../config/environment','../../../config/logger','api','redis','localhost','socket.io-emitter'];(function(_0x3d3cd1,_0x370aba){var _0x4ffc6b=function(_0x357eca){while(--_0x357eca){_0x3d3cd1['push'](_0x3d3cd1['shift']());}};_0x4ffc6b(++_0x370aba);}(_0x1e6a,0x1b6));var _0xa1e6=function(_0x5e022c,_0x41b2c0){_0x5e022c=_0x5e022c-0x0;var _0xf577f5=_0x1e6a[_0x5e022c];return _0xf577f5;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require(_0xa1e6('0x0'));var fs=require('fs');var squel=require(_0xa1e6('0x1'));var Papa=require(_0xa1e6('0x2'));var Redis=require('ioredis');var db=require(_0xa1e6('0x3'))['db'];var config=require(_0xa1e6('0x4'));var logger=require(_0xa1e6('0x5'))(_0xa1e6('0x6'));config[_0xa1e6('0x7')]=_['defaults'](config[_0xa1e6('0x7')],{'host':_0xa1e6('0x8'),'port':0x18eb});var socket=require(_0xa1e6('0x9'))(new Redis(config['redis']));require(_0xa1e6('0xa'))['register'](socket);try{if(!process['argv'][0x2]||process[_0xa1e6('0xb')][0x2]===_0xa1e6('0xc')||process[_0xa1e6('0xb')][0x2]==='null'){throw new Error(_0xa1e6('0xd'));}var FILEPATH=process['argv'][0x2];if(!process[_0xa1e6('0xb')][0x3]||process[_0xa1e6('0xb')][0x3]===_0xa1e6('0xc')||process['argv'][0x3]===_0xa1e6('0xe')||!process[_0xa1e6('0xb')][0x4]||process[_0xa1e6('0xb')][0x4]===_0xa1e6('0xc')||process[_0xa1e6('0xb')][0x4]===_0xa1e6('0xe')){throw new Error(_0xa1e6('0xf'));}var FIELDS=_['zipObject'](process['argv'][0x3][_0xa1e6('0x10')](','),process[_0xa1e6('0xb')][0x4][_0xa1e6('0x10')](','));if(!process['argv'][0x5]||process[_0xa1e6('0xb')][0x5]==='undefined'||process[_0xa1e6('0xb')][0x5]===_0xa1e6('0xe')){throw new Error(_0xa1e6('0x11'));}var LISTID=process[_0xa1e6('0xb')][0x5];var COMPANYID=process[_0xa1e6('0xb')][0x6]&&process['argv'][0x6]!==_0xa1e6('0xc')&&process[_0xa1e6('0xb')][0x6]!==_0xa1e6('0xe')?process[_0xa1e6('0xb')][0x6]:null;var DUPLICATES=process[_0xa1e6('0xb')][0x7]&&process['argv'][0x7]!==_0xa1e6('0xc')&&process[_0xa1e6('0xb')][0x7]!==_0xa1e6('0xe')?process[_0xa1e6('0xb')][0x7]:null;if(!process['argv'][0x8]||process[_0xa1e6('0xb')][0x8]==='undefined'||process[_0xa1e6('0xb')][0x8]===_0xa1e6('0xe')){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0xa1e6('0xb')][0x8];}catch(_0x5c0ae0){logger['error'](_0x5c0ae0);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(_0x4e1054,_0x87af09,_0x3507c7,_0x575dc0){var _0x15082e={'message':_0x87af09};_0x15082e[_0x4e1054]=!![];if(_0x3507c7){_0x15082e[_0xa1e6('0x12')]=_0x3507c7;}if(_0x575dc0){_0x15082e[_0xa1e6('0x13')]=_0x575dc0;}return _0x15082e;}function isEmail(_0x274f98){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))*$/[_0xa1e6('0x14')](_0x274f98);}function checkRow(_0x10bd37,_0x37ae87,_0xd60d3b){return new BPromise(function(_0x30f3ca,_0x1475b0){if(_[_0xa1e6('0x15')](_0x10bd37)){return _0x1475b0(handleCheckRowError(_0xa1e6('0x16'),_0xa1e6('0x17'),null,_0xd60d3b));}if(_0x10bd37[_0xa1e6('0x18')]&&_0x10bd37['errors'][_0xa1e6('0x19')]){var _0x2a4da0=_[_0xa1e6('0x1a')](_0x10bd37[_0xa1e6('0x18')],_0xa1e6('0x1b'))['join'](';');return _0x1475b0(handleCheckRowError(_0xa1e6('0x16'),_0x2a4da0,null,_0xd60d3b));}var _0x4e5ffb={};for(var _0x420d98 in FIELDS){if(FIELDS[_0xa1e6('0x1c')](_0x420d98)&&FIELDS[_0x420d98]){_0x4e5ffb[_0x420d98]=_0x10bd37['data'][0x0][FIELDS[_0x420d98]]||_0x10bd37[_0xa1e6('0x1d')][0x0]['\ufeff'+FIELDS[_0x420d98]];}}if(!_0x4e5ffb[_0xa1e6('0x1e')]){return _0x1475b0(handleCheckRowError(_0xa1e6('0x16'),_0xa1e6('0x1f'),null,_0xd60d3b));}if(!_0x4e5ffb['phone']){return _0x1475b0(handleCheckRowError(_0xa1e6('0x16'),_0xa1e6('0x20'),null,_0xd60d3b));}if(_0x4e5ffb[_0xa1e6('0x21')]){var _0x2060ac=moment(_0x4e5ffb['birthDate'],_0xa1e6('0x22'));if(!_0x2060ac[_0xa1e6('0x23')]()){return _0x1475b0(handleCheckRowError('error',_0xa1e6('0x24'),null,_0xd60d3b));}}if(_0x4e5ffb[_0xa1e6('0x25')]){if(!isEmail(_0x4e5ffb[_0xa1e6('0x25')])){return _0x1475b0(handleCheckRowError(_0xa1e6('0x16'),_0xa1e6('0x26'),null,_0xd60d3b));}}_0x4e5ffb[_0xa1e6('0x27')]=LISTID;_0x4e5ffb[_0xa1e6('0x28')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0xa1e6('0x19')]&&_0x37ae87){var _0x524b12={};for(var _0x121b13=0x0,_0x5aa78e=DUPLICATES[_0xa1e6('0x19')];_0x121b13<_0x5aa78e;_0x121b13+=0x1){_0x524b12[DUPLICATES[_0x121b13]]=_0x4e5ffb[DUPLICATES[_0x121b13]];}var _0x14589d=_[_0xa1e6('0x29')](_0x37ae87,_0x524b12);if(_0x14589d){return _0x1475b0(handleCheckRowError(_0xa1e6('0x2a'),_0xa1e6('0x2b'),_0x14589d,_0xd60d3b));}}return db[_0xa1e6('0x2c')][_0xa1e6('0x2d')](_0x4e5ffb,{'raw':!![],'hooks':![],'fields':_[_0xa1e6('0x2e')](_0x4e5ffb)})[_0xa1e6('0x2f')](function(_0x3ed32f){if(DUPLICATES&&DUPLICATES[_0xa1e6('0x19')]&&_0x37ae87){_0x37ae87['push'](_[_0xa1e6('0x30')](_0x4e5ffb,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x3ed32f['id'];return _0x30f3ca();})[_0xa1e6('0x31')](function(_0x51a555){return _0x1475b0(handleCheckRowError(_0xa1e6('0x16'),_0xa1e6('0x32')+(_0x51a555['message']||JSON[_0xa1e6('0x33')](_0x51a555)),null,_0xd60d3b));});});}function checkHopper(){function _0x1f305b(){return function(_0x27e16e){logger['error'](_0xa1e6('0x34'),_0xa1e6('0x35'),util['inspect'](_0x27e16e,{'showHidden':![],'depth':null}));};}var _0x2821f6=function(_0x3ec4eb,_0x12e08c){var _0x476eac=squel[_0xa1e6('0x36')]()[_0xa1e6('0x37')](_0xa1e6('0x38'))[_0xa1e6('0x39')](['phone',_0xa1e6('0x3a'),_0xa1e6('0x3b'),'ListId',_0x12e08c,_0xa1e6('0x3c'),_0xa1e6('0x3d')],squel[_0xa1e6('0x3e')]()[_0xa1e6('0x3f')](_0xa1e6('0x40'),_0xa1e6('0x40'))[_0xa1e6('0x3f')](_0xa1e6('0x41'),_0xa1e6('0x3a'))[_0xa1e6('0x3f')]('id',_0xa1e6('0x3b'))[_0xa1e6('0x3f')](LISTID[_0xa1e6('0x42')](),_0xa1e6('0x27'))[_0xa1e6('0x3f')](_0x3ec4eb['id'][_0xa1e6('0x42')](),_0x12e08c)[_0xa1e6('0x3f')](_0xa1e6('0x41'),_0xa1e6('0x3c'))[_0xa1e6('0x3f')](_0xa1e6('0x41'),_0xa1e6('0x3d'))['from'](_0xa1e6('0x43'))[_0xa1e6('0x44')](_0xa1e6('0x45'))['where'](_0xa1e6('0x46'),LISTID[_0xa1e6('0x42')]())['where'](_0xa1e6('0x47'))[_0xa1e6('0x44')](_0xa1e6('0x48'),squel[_0xa1e6('0x3e')]()[_0xa1e6('0x3f')](_0xa1e6('0x40'))[_0xa1e6('0x49')](_0xa1e6('0x38'))['where'](_0x12e08c+_0xa1e6('0x4a'),_0x3ec4eb['id']['toString']())))[_0xa1e6('0x42')]();return _0x476eac;};var _0x37e1f6=function(_0x4e9995,_0x5f1ed3){var _0x564763=squel[_0xa1e6('0x36')]()[_0xa1e6('0x37')](_0xa1e6('0x38'))['fromQuery']([_0xa1e6('0x40'),'scheduledAt',_0xa1e6('0x3b'),_0xa1e6('0x27'),_0x5f1ed3,_0xa1e6('0x3c'),_0xa1e6('0x3d')],squel['select']()[_0xa1e6('0x3f')]('phone',_0xa1e6('0x40'))[_0xa1e6('0x3f')](_0xa1e6('0x41'),'scheduledAt')[_0xa1e6('0x3f')]('id',_0xa1e6('0x3b'))[_0xa1e6('0x3f')](LISTID['toString'](),'ListId')[_0xa1e6('0x3f')](_0x4e9995['id'][_0xa1e6('0x42')](),_0x5f1ed3)[_0xa1e6('0x3f')](_0xa1e6('0x41'),_0xa1e6('0x3c'))[_0xa1e6('0x3f')](_0xa1e6('0x41'),_0xa1e6('0x3d'))[_0xa1e6('0x49')](_0xa1e6('0x43'))['where'](_0xa1e6('0x45'))[_0xa1e6('0x44')](_0xa1e6('0x46'),LISTID['toString']())[_0xa1e6('0x44')](_0xa1e6('0x4b'),squel[_0xa1e6('0x4c')](hopperContacts))[_0xa1e6('0x44')]('phone\x20IS\x20NOT\x20NULL')[_0xa1e6('0x44')](_0xa1e6('0x48'),squel[_0xa1e6('0x3e')]()[_0xa1e6('0x3f')](_0xa1e6('0x4d'))[_0xa1e6('0x49')](_0xa1e6('0x4e'))['where'](_0x5f1ed3+_0xa1e6('0x4a'),_0x4e9995['id'][_0xa1e6('0x42')]()))[_0xa1e6('0x44')](_0xa1e6('0x48'),squel[_0xa1e6('0x3e')]()[_0xa1e6('0x3f')](_0xa1e6('0x40'))[_0xa1e6('0x49')](_0xa1e6('0x38'))[_0xa1e6('0x44')](_0x5f1ed3+_0xa1e6('0x4a'),_0x4e9995['id'][_0xa1e6('0x42')]())))[_0xa1e6('0x42')]();return _0x564763;};function _0x3bc961(_0x2d7d3c,_0x2318e9){var _0x32f7c5=squel[_0xa1e6('0x36')]()[_0xa1e6('0x37')]('cm_hopper')[_0xa1e6('0x39')]([_0xa1e6('0x40'),_0xa1e6('0x3a'),_0xa1e6('0x3b'),_0xa1e6('0x27'),_0x2318e9,_0xa1e6('0x3c'),_0xa1e6('0x3d')],squel['select']()[_0xa1e6('0x3f')](_0xa1e6('0x40'),_0xa1e6('0x40'))['field'](_0xa1e6('0x41'),'scheduledAt')[_0xa1e6('0x3f')]('id','ContactId')['field'](LISTID['toString'](),_0xa1e6('0x27'))['field'](_0x2d7d3c['id'][_0xa1e6('0x42')](),_0x2318e9)[_0xa1e6('0x3f')](_0xa1e6('0x41'),_0xa1e6('0x3c'))['field'](_0xa1e6('0x41'),_0xa1e6('0x3d'))['from'](_0xa1e6('0x43'))[_0xa1e6('0x44')]('deletedAt\x20IS\x20NULL')[_0xa1e6('0x44')](_0xa1e6('0x46'),LISTID[_0xa1e6('0x42')]())['where'](_0xa1e6('0x4b'),squel['str'](hopperContacts))[_0xa1e6('0x44')]('phone\x20IS\x20NOT\x20NULL'))[_0xa1e6('0x42')]();return _0x32f7c5;}function _0x303398(_0x3c3c2f,_0x2a4560){var _0x1d6514=squel[_0xa1e6('0x36')]()[_0xa1e6('0x37')](_0xa1e6('0x4f'))['fromQuery']([_0xa1e6('0x40'),_0xa1e6('0x3b'),_0xa1e6('0x27'),_0x2a4560,_0xa1e6('0x3c'),_0xa1e6('0x3d')],squel['select']()[_0xa1e6('0x3f')](_0xa1e6('0x40'),'phone')['field']('id',_0xa1e6('0x3b'))['field'](LISTID['toString'](),'ListId')['field'](_0x3c3c2f['id'][_0xa1e6('0x42')](),_0x2a4560)[_0xa1e6('0x3f')](_0xa1e6('0x41'),_0xa1e6('0x3c'))['field'](_0xa1e6('0x41'),'updatedAt')[_0xa1e6('0x49')]('cm_contacts')[_0xa1e6('0x44')](_0xa1e6('0x45'))[_0xa1e6('0x44')](_0xa1e6('0x46'),LISTID['toString']())['where']('id\x20IN\x20?',squel['str'](hopperContacts))[_0xa1e6('0x44')](_0xa1e6('0x47')))[_0xa1e6('0x42')]();return _0x1d6514;}return db[_0xa1e6('0x50')][_0xa1e6('0x51')]({'where':{'type':_0xa1e6('0x52')},'attributes':['id',_0xa1e6('0x53')],'include':[{'model':db[_0xa1e6('0x54')],'as':_0xa1e6('0x55'),'where':{'id':LISTID}}]})['then'](function(_0x550fe7){var _0x2aa182=[];if(_0x550fe7){var _0x16d195;for(var _0x2c9a8d=0x0,_0x546fbf;_0x2c9a8d<_0x550fe7[_0xa1e6('0x19')];_0x2c9a8d+=0x1){_0x546fbf=_0x550fe7[_0x2c9a8d][_0xa1e6('0x56')]({'plain':!![]});switch(_0x546fbf[_0xa1e6('0x53')]){case _0xa1e6('0x57'):_0x2aa182[_0xa1e6('0x58')](db['sequelize'][_0xa1e6('0x59')](_0x37e1f6(_0x546fbf,_0xa1e6('0x5a')))[_0xa1e6('0x2f')](function(){})[_0xa1e6('0x31')](_0x1f305b()));break;case'onlyIfOpen':_0x2aa182[_0xa1e6('0x58')](db['sequelize'][_0xa1e6('0x59')](_0x2821f6(_0x546fbf,_0xa1e6('0x5a')))['then'](function(){})[_0xa1e6('0x31')](_0x1f305b()));break;default:_0x2aa182[_0xa1e6('0x58')](db[_0xa1e6('0x5b')][_0xa1e6('0x59')](_0x3bc961(_0x546fbf,_0xa1e6('0x5a')))[_0xa1e6('0x2f')](function(){})[_0xa1e6('0x31')](_0x1f305b()));}}}return _0x2aa182;})[_0xa1e6('0x5c')]()[_0xa1e6('0x2f')](function(){return db[_0xa1e6('0x50')]['findAll']({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':db[_0xa1e6('0x54')],'as':_0xa1e6('0x5d'),'where':{'id':LISTID}}]})[_0xa1e6('0x2f')](function(_0x48f718){var _0x3a2041=[];if(_0x48f718){var _0x2ac25b;for(var _0x4ae065=0x0,_0x220009;_0x4ae065<_0x48f718[_0xa1e6('0x19')];_0x4ae065+=0x1){_0x220009=_0x48f718[_0x4ae065][_0xa1e6('0x56')]({'plain':!![]});_0x3a2041[_0xa1e6('0x58')](db['sequelize'][_0xa1e6('0x59')](_0x303398(_0x220009,'VoiceQueueId'))[_0xa1e6('0x2f')](function(){})[_0xa1e6('0x31')](_0x1f305b()));}}return _0x3a2041;})[_0xa1e6('0x5c')]();})[_0xa1e6('0x2f')](function(){return db[_0xa1e6('0x5e')]['findAll']({'attributes':['id',_0xa1e6('0x53')],'include':[{'model':db['CmList'],'as':_0xa1e6('0x55'),'where':{'id':LISTID}}]})[_0xa1e6('0x2f')](function(_0x5ac34f){var _0x52eb9a=[];if(_0x5ac34f){for(var _0x2d0289=0x0,_0x37bd87;_0x2d0289<_0x5ac34f[_0xa1e6('0x19')];_0x2d0289+=0x1){_0x37bd87=_0x5ac34f[_0x2d0289][_0xa1e6('0x56')]({'plain':!![]});switch(_0x37bd87[_0xa1e6('0x53')]){case _0xa1e6('0x57'):_0x52eb9a[_0xa1e6('0x58')](db[_0xa1e6('0x5b')][_0xa1e6('0x59')](_0x37e1f6(_0x37bd87,_0xa1e6('0x5f')))['then'](function(){})[_0xa1e6('0x31')](_0x1f305b()));break;case _0xa1e6('0x60'):_0x52eb9a['push'](db[_0xa1e6('0x5b')][_0xa1e6('0x59')](_0x2821f6(_0x37bd87,_0xa1e6('0x5f')))[_0xa1e6('0x2f')](function(){})['catch'](_0x1f305b()));break;default:_0x52eb9a['push'](db[_0xa1e6('0x5b')]['query'](_0x3bc961(_0x37bd87,'CampaignId'))[_0xa1e6('0x2f')](function(){})['catch'](_0x1f305b()));}}}return _0x52eb9a;})[_0xa1e6('0x5c')]();})['then'](function(){return db['Campaign'][_0xa1e6('0x51')]({'attributes':['id'],'include':[{'model':db[_0xa1e6('0x54')],'as':'BlackLists','where':{'id':LISTID}}]})[_0xa1e6('0x2f')](function(_0x4104a8){var _0x203c70=[];if(_0x4104a8){for(var _0x208ea9=0x0,_0xbca4f;_0x208ea9<_0x4104a8['length'];_0x208ea9+=0x1){_0xbca4f=_0x4104a8[_0x208ea9][_0xa1e6('0x56')]({'plain':!![]});_0x203c70[_0xa1e6('0x58')](db[_0xa1e6('0x5b')][_0xa1e6('0x59')](_0x303398(_0xbca4f,_0xa1e6('0x5f')))['then'](function(){})['catch'](_0x1f305b()));}}return _0x203c70;})[_0xa1e6('0x5c')]();})[_0xa1e6('0x31')](function(_0x39ff87){logger[_0xa1e6('0x16')]('cmContact,\x20%s,\x20%s',_0xa1e6('0x61'),_0x39ff87[_0xa1e6('0x1b')]);});}var processPromises=function(_0x59cea2){return BPromise[_0xa1e6('0x5c')](promises)[_0xa1e6('0x2f')](function(_0x22abd4){})[_0xa1e6('0x31')](function(_0x231b02){logger[_0xa1e6('0x16')](_0xa1e6('0x62'),JSON['stringify'](_0x231b02));})['finally'](function(){socket[_0xa1e6('0x63')](_0xa1e6('0x64')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x59cea2){return _0x59cea2['resume']();}});};var endCsv=function(){return BPromise[_0xa1e6('0x65')]()[_0xa1e6('0x2f')](function(){if(hopperContacts){return checkHopper();}})[_0xa1e6('0x2f')](function(){socket[_0xa1e6('0x63')]('contact:csv_'+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs['unlinkSync'](FILEPATH);}catch(_0x2a90e5){logger[_0xa1e6('0x16')](_0xa1e6('0x66'),JSON['stringify'](_0x2a90e5));}finally{process[_0xa1e6('0x67')](0x0);}});};process['on'](_0xa1e6('0x68'),function(){logger['info'](_0xa1e6('0x69'));endCsv();});function main(){return BPromise['resolve']()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0xa1e6('0x10')](',');return db[_0xa1e6('0x2c')][_0xa1e6('0x51')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0xa1e6('0x2f')](function(_0x55653f){var _0x52166e=fs[_0xa1e6('0x6a')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x52166e,{'header':!![],'skipEmptyLines':!![],'step':function(_0x5c612a,_0x48894a){total+=0x1;var _0x1b1e90=total;promises[_0xa1e6('0x58')](checkRow(_0x5c612a,_0x55653f,_0x1b1e90)[_0xa1e6('0x2f')](function(){success+=0x1;})['catch'](function(_0x38bc99){if(_0x38bc99[_0xa1e6('0x16')]){errors+=0x1;delete _0x38bc99[_0xa1e6('0x16')];}else if(_0x38bc99['duplicate']){duplicates+=0x1;delete _0x38bc99[_0xa1e6('0x2a')];}rows[_0xa1e6('0x58')](_0x38bc99);}));if(total%0xc8===0x0){_0x48894a[_0xa1e6('0x6b')]();return processPromises(_0x48894a);}},'complete':function(){return processPromises()[_0xa1e6('0x2f')](function(){logger[_0xa1e6('0x6c')](_0xa1e6('0x6d'));endCsv();});},'error':function(_0x5323b9,_0x5abd41){logger[_0xa1e6('0x6c')](_0xa1e6('0x6e'),JSON['stringify'](_0x5323b9));endCsv();}});})[_0xa1e6('0x31')](function(_0x4d6623){logger[_0xa1e6('0x16')](_0xa1e6('0x6f'),JSON[_0xa1e6('0x33')](_0x4d6623));});}main(); \ No newline at end of file +var _0x27e6=['redis','defaults','localhost','register','argv','null','undefined','Missing\x20binding\x20parameters!','split','Missing\x20socket_timestamp\x20parameter!','contact','index','test','isNil','error','errors','map','join','data','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','length','find','duplicate','CmContact','create','keys','pick','catch','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','checkHopper','inspect','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','updatedAt','select','field','NOW()','toString','createdAt','from','cm_contacts','where','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','\x20=\x20?','str','calleridnum','cm_hopper_final','phone\x20NOT\x20IN\x20(?)','id\x20IN\x20?','cm_hopper_black','ListId\x20=\x20?','VoiceQueue','findAll','outbound','dialCheckDuplicateType','then','get','always','push','sequelize','query','onlyIfOpen','VoiceQueueId','all','CmList','BlackLists','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','message','Error\x20processing\x20rows\x20block:','contact:csv_','resume','resolve','emit','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','createReadStream','parse','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','bluebird','lodash','papaparse','ioredis','../../../config/environment','../../../config/logger','api'];(function(_0x204c03,_0x24a4c1){var _0x327802=function(_0x12f77f){while(--_0x12f77f){_0x204c03['push'](_0x204c03['shift']());}};_0x327802(++_0x24a4c1);}(_0x27e6,0x13d));var _0x627e=function(_0x4ae930,_0x3a0ad5){_0x4ae930=_0x4ae930-0x0;var _0x311d08=_0x27e6[_0x4ae930];return _0x311d08;};'use strict';var BPromise=require(_0x627e('0x0'));var util=require('util');var _=require(_0x627e('0x1'));var fs=require('fs');var squel=require('squel');var Papa=require(_0x627e('0x2'));var Redis=require(_0x627e('0x3'));var db=require('../../../mysqldb')['db'];var config=require(_0x627e('0x4'));var logger=require(_0x627e('0x5'))(_0x627e('0x6'));config[_0x627e('0x7')]=_[_0x627e('0x8')](config[_0x627e('0x7')],{'host':_0x627e('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x627e('0x7')]));require('../../../api/cmContact/cmContact.socket')[_0x627e('0xa')](socket);try{if(!process[_0x627e('0xb')][0x2]||process['argv'][0x2]==='undefined'||process[_0x627e('0xb')][0x2]===_0x627e('0xc')){throw new Error('Missing\x20filepath\x20parameter!');}var FILEPATH=process[_0x627e('0xb')][0x2];if(!process[_0x627e('0xb')][0x3]||process[_0x627e('0xb')][0x3]===_0x627e('0xd')||process[_0x627e('0xb')][0x3]===_0x627e('0xc')||!process[_0x627e('0xb')][0x4]||process['argv'][0x4]===_0x627e('0xd')||process['argv'][0x4]===_0x627e('0xc')){throw new Error(_0x627e('0xe'));}var FIELDS=_['zipObject'](process[_0x627e('0xb')][0x3][_0x627e('0xf')](','),process[_0x627e('0xb')][0x4][_0x627e('0xf')](','));if(!process[_0x627e('0xb')][0x5]||process[_0x627e('0xb')][0x5]===_0x627e('0xd')||process['argv'][0x5]===_0x627e('0xc')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process[_0x627e('0xb')][0x5];var COMPANYID=process['argv'][0x6]&&process[_0x627e('0xb')][0x6]!=='undefined'&&process['argv'][0x6]!==_0x627e('0xc')?process[_0x627e('0xb')][0x6]:null;var DUPLICATES=process[_0x627e('0xb')][0x7]&&process[_0x627e('0xb')][0x7]!==_0x627e('0xd')&&process[_0x627e('0xb')][0x7]!==_0x627e('0xc')?process['argv'][0x7]:null;if(!process[_0x627e('0xb')][0x8]||process['argv'][0x8]===_0x627e('0xd')||process[_0x627e('0xb')][0x8]==='null'){throw new Error(_0x627e('0x10'));}var SOCKET_TIMESTAMP=process[_0x627e('0xb')][0x8];}catch(_0xba06f0){logger['error'](_0xba06f0);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(_0x3e65e1,_0x1f9d1b,_0x1713d1,_0x479e23){var _0x410ebf={'message':_0x1f9d1b};_0x410ebf[_0x3e65e1]=!![];if(_0x1713d1){_0x410ebf[_0x627e('0x11')]=_0x1713d1;}if(_0x479e23){_0x410ebf[_0x627e('0x12')]=_0x479e23;}return _0x410ebf;}function isEmail(_0x16d7d4){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))*$/[_0x627e('0x13')](_0x16d7d4);}function checkRow(_0x31262d,_0x355642,_0x33d34c){return new BPromise(function(_0xaf2e99,_0xa5e7b0){if(_[_0x627e('0x14')](_0x31262d)){return _0xa5e7b0(handleCheckRowError(_0x627e('0x15'),'The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x33d34c));}if(_0x31262d[_0x627e('0x16')]&&_0x31262d[_0x627e('0x16')]['length']){var _0x217182=_[_0x627e('0x17')](_0x31262d['errors'],'message')[_0x627e('0x18')](';');return _0xa5e7b0(handleCheckRowError(_0x627e('0x15'),_0x217182,null,_0x33d34c));}var _0x3c3f45={};for(var _0xd281e7 in FIELDS){if(FIELDS['hasOwnProperty'](_0xd281e7)&&FIELDS[_0xd281e7]){_0x3c3f45[_0xd281e7]=_0x31262d[_0x627e('0x19')][0x0][FIELDS[_0xd281e7]]||_0x31262d[_0x627e('0x19')][0x0]['\ufeff'+FIELDS[_0xd281e7]];}}if(!_0x3c3f45['firstName']){return _0xa5e7b0(handleCheckRowError(_0x627e('0x15'),'firstName\x20not\x20specified!',null,_0x33d34c));}if(!_0x3c3f45[_0x627e('0x1a')]){return _0xa5e7b0(handleCheckRowError(_0x627e('0x15'),_0x627e('0x1b'),null,_0x33d34c));}if(_0x3c3f45['birthDate']){var _0x114924=moment(_0x3c3f45[_0x627e('0x1c')],_0x627e('0x1d'));if(!_0x114924[_0x627e('0x1e')]()){return _0xa5e7b0(handleCheckRowError('error',_0x627e('0x1f'),null,_0x33d34c));}}if(_0x3c3f45['email']){if(!isEmail(_0x3c3f45[_0x627e('0x20')])){return _0xa5e7b0(handleCheckRowError(_0x627e('0x15'),_0x627e('0x21'),null,_0x33d34c));}}_0x3c3f45['ListId']=LISTID;_0x3c3f45['CompanyId']=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x355642){var _0x1a848d={};for(var _0x132f9d=0x0,_0x33314e=DUPLICATES[_0x627e('0x22')];_0x132f9d<_0x33314e;_0x132f9d+=0x1){_0x1a848d[DUPLICATES[_0x132f9d]]=_0x3c3f45[DUPLICATES[_0x132f9d]];}var _0x599cab=_[_0x627e('0x23')](_0x355642,_0x1a848d);if(_0x599cab){return _0xa5e7b0(handleCheckRowError(_0x627e('0x24'),'Duplicate\x20Contact',_0x599cab,_0x33d34c));}}return db[_0x627e('0x25')][_0x627e('0x26')](_0x3c3f45,{'raw':!![],'hooks':![],'fields':_[_0x627e('0x27')](_0x3c3f45)})['then'](function(_0x229a2d){if(DUPLICATES&&DUPLICATES[_0x627e('0x22')]&&_0x355642){_0x355642['push'](_[_0x627e('0x28')](_0x3c3f45,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x229a2d['id'];return _0xaf2e99();})[_0x627e('0x29')](function(_0xe1970b){return _0xa5e7b0(handleCheckRowError(_0x627e('0x15'),_0x627e('0x2a')+(_0xe1970b['message']||JSON[_0x627e('0x2b')](_0xe1970b)),null,_0x33d34c));});});}function checkHopper(){function _0x5ce687(){return function(_0x3ea281){logger[_0x627e('0x15')](_0x627e('0x2c'),_0x627e('0x2d'),util[_0x627e('0x2e')](_0x3ea281,{'showHidden':![],'depth':null}));};}var _0x103314=function(_0x55032e,_0xab92bb){var _0x33e507=squel[_0x627e('0x2f')]()[_0x627e('0x30')](_0x627e('0x31'))[_0x627e('0x32')]([_0x627e('0x1a'),_0x627e('0x33'),_0x627e('0x34'),_0x627e('0x35'),_0xab92bb,'createdAt',_0x627e('0x36')],squel[_0x627e('0x37')]()['field'](_0x627e('0x1a'),'phone')[_0x627e('0x38')](_0x627e('0x39'),_0x627e('0x33'))['field']('id',_0x627e('0x34'))['field'](LISTID[_0x627e('0x3a')](),'ListId')[_0x627e('0x38')](_0x55032e['id']['toString'](),_0xab92bb)[_0x627e('0x38')]('NOW()',_0x627e('0x3b'))[_0x627e('0x38')](_0x627e('0x39'),_0x627e('0x36'))[_0x627e('0x3c')](_0x627e('0x3d'))[_0x627e('0x3e')](_0x627e('0x3f'))[_0x627e('0x3e')]('ListId\x20=\x20?',LISTID['toString']())[_0x627e('0x3e')](_0x627e('0x40'))[_0x627e('0x3e')]('phone\x20NOT\x20IN\x20(?)',squel[_0x627e('0x37')]()['field']('phone')[_0x627e('0x3c')]('cm_hopper')[_0x627e('0x3e')](_0xab92bb+_0x627e('0x41'),_0x55032e['id'][_0x627e('0x3a')]())))['toString']();return _0x33e507;};var _0x7f1741=function(_0x9b647e,_0x26cdd6){var _0x407152=squel[_0x627e('0x2f')]()[_0x627e('0x30')](_0x627e('0x31'))[_0x627e('0x32')]([_0x627e('0x1a'),'scheduledAt',_0x627e('0x34'),'ListId',_0x26cdd6,'createdAt',_0x627e('0x36')],squel[_0x627e('0x37')]()[_0x627e('0x38')](_0x627e('0x1a'),_0x627e('0x1a'))[_0x627e('0x38')](_0x627e('0x39'),_0x627e('0x33'))[_0x627e('0x38')]('id','ContactId')[_0x627e('0x38')](LISTID[_0x627e('0x3a')](),_0x627e('0x35'))[_0x627e('0x38')](_0x9b647e['id']['toString'](),_0x26cdd6)[_0x627e('0x38')](_0x627e('0x39'),_0x627e('0x3b'))[_0x627e('0x38')]('NOW()',_0x627e('0x36'))['from'](_0x627e('0x3d'))[_0x627e('0x3e')]('deletedAt\x20IS\x20NULL')[_0x627e('0x3e')]('ListId\x20=\x20?',LISTID[_0x627e('0x3a')]())[_0x627e('0x3e')]('id\x20IN\x20?',squel[_0x627e('0x42')](hopperContacts))[_0x627e('0x3e')](_0x627e('0x40'))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x627e('0x37')]()[_0x627e('0x38')](_0x627e('0x43'))['from'](_0x627e('0x44'))[_0x627e('0x3e')](_0x26cdd6+'\x20=\x20?',_0x9b647e['id'][_0x627e('0x3a')]()))['where'](_0x627e('0x45'),squel[_0x627e('0x37')]()[_0x627e('0x38')](_0x627e('0x1a'))[_0x627e('0x3c')]('cm_hopper')['where'](_0x26cdd6+_0x627e('0x41'),_0x9b647e['id']['toString']())))['toString']();return _0x407152;};function _0x5d3ed5(_0x4950a8,_0x335c58){var _0x436acc=squel[_0x627e('0x2f')]()[_0x627e('0x30')](_0x627e('0x31'))[_0x627e('0x32')](['phone',_0x627e('0x33'),_0x627e('0x34'),'ListId',_0x335c58,'createdAt',_0x627e('0x36')],squel[_0x627e('0x37')]()['field'](_0x627e('0x1a'),_0x627e('0x1a'))[_0x627e('0x38')](_0x627e('0x39'),'scheduledAt')[_0x627e('0x38')]('id','ContactId')['field'](LISTID[_0x627e('0x3a')](),_0x627e('0x35'))[_0x627e('0x38')](_0x4950a8['id'][_0x627e('0x3a')](),_0x335c58)[_0x627e('0x38')](_0x627e('0x39'),_0x627e('0x3b'))[_0x627e('0x38')](_0x627e('0x39'),_0x627e('0x36'))[_0x627e('0x3c')](_0x627e('0x3d'))['where'](_0x627e('0x3f'))['where']('ListId\x20=\x20?',LISTID[_0x627e('0x3a')]())[_0x627e('0x3e')](_0x627e('0x46'),squel['str'](hopperContacts))[_0x627e('0x3e')](_0x627e('0x40')))['toString']();return _0x436acc;}function _0x15563f(_0xdea60d,_0x369955){var _0x37ce37=squel[_0x627e('0x2f')]()[_0x627e('0x30')](_0x627e('0x47'))[_0x627e('0x32')]([_0x627e('0x1a'),'ContactId',_0x627e('0x35'),_0x369955,_0x627e('0x3b'),_0x627e('0x36')],squel[_0x627e('0x37')]()[_0x627e('0x38')](_0x627e('0x1a'),_0x627e('0x1a'))[_0x627e('0x38')]('id',_0x627e('0x34'))[_0x627e('0x38')](LISTID[_0x627e('0x3a')](),'ListId')[_0x627e('0x38')](_0xdea60d['id'][_0x627e('0x3a')](),_0x369955)['field'](_0x627e('0x39'),_0x627e('0x3b'))[_0x627e('0x38')](_0x627e('0x39'),_0x627e('0x36'))[_0x627e('0x3c')](_0x627e('0x3d'))[_0x627e('0x3e')](_0x627e('0x3f'))[_0x627e('0x3e')](_0x627e('0x48'),LISTID[_0x627e('0x3a')]())[_0x627e('0x3e')](_0x627e('0x46'),squel[_0x627e('0x42')](hopperContacts))[_0x627e('0x3e')]('phone\x20IS\x20NOT\x20NULL'))[_0x627e('0x3a')]();return _0x37ce37;}return db[_0x627e('0x49')][_0x627e('0x4a')]({'where':{'type':_0x627e('0x4b')},'attributes':['id',_0x627e('0x4c')],'include':[{'model':db['CmList'],'as':'Lists','where':{'id':LISTID}}]})[_0x627e('0x4d')](function(_0x54bb5c){var _0x42f70c=[];if(_0x54bb5c){var _0x6850de;for(var _0x4d5b15=0x0,_0x971745;_0x4d5b15<_0x54bb5c[_0x627e('0x22')];_0x4d5b15+=0x1){_0x971745=_0x54bb5c[_0x4d5b15][_0x627e('0x4e')]({'plain':!![]});switch(_0x971745[_0x627e('0x4c')]){case _0x627e('0x4f'):_0x42f70c[_0x627e('0x50')](db[_0x627e('0x51')][_0x627e('0x52')](_0x7f1741(_0x971745,'VoiceQueueId'))[_0x627e('0x4d')](function(){})[_0x627e('0x29')](_0x5ce687()));break;case _0x627e('0x53'):_0x42f70c[_0x627e('0x50')](db[_0x627e('0x51')][_0x627e('0x52')](_0x103314(_0x971745,_0x627e('0x54')))[_0x627e('0x4d')](function(){})['catch'](_0x5ce687()));break;default:_0x42f70c[_0x627e('0x50')](db[_0x627e('0x51')][_0x627e('0x52')](_0x5d3ed5(_0x971745,_0x627e('0x54')))[_0x627e('0x4d')](function(){})[_0x627e('0x29')](_0x5ce687()));}}}return _0x42f70c;})[_0x627e('0x55')]()[_0x627e('0x4d')](function(){return db[_0x627e('0x49')][_0x627e('0x4a')]({'where':{'type':_0x627e('0x4b')},'attributes':['id'],'include':[{'model':db[_0x627e('0x56')],'as':'BlackLists','where':{'id':LISTID}}]})[_0x627e('0x4d')](function(_0x564c38){var _0x4cc314=[];if(_0x564c38){var _0x1fb76b;for(var _0x261530=0x0,_0x59d30d;_0x261530<_0x564c38['length'];_0x261530+=0x1){_0x59d30d=_0x564c38[_0x261530][_0x627e('0x4e')]({'plain':!![]});_0x4cc314[_0x627e('0x50')](db['sequelize'][_0x627e('0x52')](_0x15563f(_0x59d30d,_0x627e('0x54')))[_0x627e('0x4d')](function(){})[_0x627e('0x29')](_0x5ce687()));}}return _0x4cc314;})[_0x627e('0x55')]();})[_0x627e('0x4d')](function(){return db['Campaign'][_0x627e('0x4a')]({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x627e('0x56')],'as':'Lists','where':{'id':LISTID}}]})[_0x627e('0x4d')](function(_0x5db6fe){var _0x24cca7=[];if(_0x5db6fe){for(var _0xe17841=0x0,_0x419dbd;_0xe17841<_0x5db6fe[_0x627e('0x22')];_0xe17841+=0x1){_0x419dbd=_0x5db6fe[_0xe17841][_0x627e('0x4e')]({'plain':!![]});switch(_0x419dbd['dialCheckDuplicateType']){case _0x627e('0x4f'):_0x24cca7['push'](db['sequelize']['query'](_0x7f1741(_0x419dbd,'CampaignId'))[_0x627e('0x4d')](function(){})['catch'](_0x5ce687()));break;case _0x627e('0x53'):_0x24cca7[_0x627e('0x50')](db[_0x627e('0x51')][_0x627e('0x52')](_0x103314(_0x419dbd,'CampaignId'))['then'](function(){})[_0x627e('0x29')](_0x5ce687()));break;default:_0x24cca7[_0x627e('0x50')](db['sequelize'][_0x627e('0x52')](_0x5d3ed5(_0x419dbd,'CampaignId'))['then'](function(){})[_0x627e('0x29')](_0x5ce687()));}}}return _0x24cca7;})['all']();})[_0x627e('0x4d')](function(){return db['Campaign'][_0x627e('0x4a')]({'attributes':['id'],'include':[{'model':db[_0x627e('0x56')],'as':_0x627e('0x57'),'where':{'id':LISTID}}]})[_0x627e('0x4d')](function(_0x57bab){var _0x504116=[];if(_0x57bab){for(var _0x27c287=0x0,_0xc6881b;_0x27c287<_0x57bab[_0x627e('0x22')];_0x27c287+=0x1){_0xc6881b=_0x57bab[_0x27c287][_0x627e('0x4e')]({'plain':!![]});_0x504116['push'](db[_0x627e('0x51')]['query'](_0x15563f(_0xc6881b,_0x627e('0x58')))[_0x627e('0x4d')](function(){})[_0x627e('0x29')](_0x5ce687()));}}return _0x504116;})[_0x627e('0x55')]();})['catch'](function(_0x29cdff){logger[_0x627e('0x15')](_0x627e('0x59'),_0x627e('0x5a'),_0x29cdff[_0x627e('0x5b')]);});}var processPromises=function(_0x30d446){return BPromise['all'](promises)[_0x627e('0x4d')](function(_0x4c2b7a){})[_0x627e('0x29')](function(_0x4948e4){logger[_0x627e('0x15')](_0x627e('0x5c'),JSON[_0x627e('0x2b')](_0x4948e4));})['finally'](function(){socket['emit'](_0x627e('0x5d')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x30d446){return _0x30d446[_0x627e('0x5e')]();}});};var endCsv=function(){return BPromise[_0x627e('0x5f')]()[_0x627e('0x4d')](function(){if(hopperContacts){return checkHopper();}})[_0x627e('0x4d')](function(){socket[_0x627e('0x60')](_0x627e('0x5d')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x627e('0x61')](FILEPATH);}catch(_0x2fff67){logger[_0x627e('0x15')](_0x627e('0x62'),JSON[_0x627e('0x2b')](_0x2fff67));}finally{process[_0x627e('0x63')](0x0);}});};process['on'](_0x627e('0x64'),function(){logger[_0x627e('0x65')](_0x627e('0x66'));endCsv();});function main(){return BPromise[_0x627e('0x5f')]()[_0x627e('0x4d')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x627e('0xf')](',');return db[_0x627e('0x25')][_0x627e('0x4a')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x627e('0x4d')](function(_0x122b0){var _0x28ea7d=fs[_0x627e('0x67')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x627e('0x68')](_0x28ea7d,{'header':!![],'skipEmptyLines':!![],'step':function(_0x557e25,_0x4579f2){total+=0x1;var _0x4d0d09=total;promises['push'](checkRow(_0x557e25,_0x122b0,_0x4d0d09)[_0x627e('0x4d')](function(){success+=0x1;})['catch'](function(_0x1ff4a3){if(_0x1ff4a3['error']){errors+=0x1;delete _0x1ff4a3['error'];}else if(_0x1ff4a3[_0x627e('0x24')]){duplicates+=0x1;delete _0x1ff4a3[_0x627e('0x24')];}rows['push'](_0x1ff4a3);}));if(total%0xc8===0x0){_0x4579f2[_0x627e('0x69')]();return processPromises(_0x4579f2);}},'complete':function(){return processPromises()[_0x627e('0x4d')](function(){logger[_0x627e('0x65')](_0x627e('0x6a'));endCsv();});},'error':function(_0x4af9cc,_0x4a3ae3){logger[_0x627e('0x65')](_0x627e('0x6b'),JSON[_0x627e('0x2b')](_0x4af9cc));endCsv();}});})[_0x627e('0x29')](function(_0x54b57b){logger[_0x627e('0x15')]('Error\x20executing\x20contact\x20csv\x20import:',JSON[_0x627e('0x2b')](_0x54b57b));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 5bf49aa..aa7f595 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 _0x070e=['abort','SystemError','step','duplicates','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','campaigns_','voice_queues_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','format',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','voice_queues','VoiceQueueId','voice_queues_has_cm_blacklists','CampaignId','campaigns_has_cm_blacklists','each','finish','affectedRows','unlink','complete','argv','arguments\x20\x20\x20','existsSync','file\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','map','No\x20agent\x20available','uncaughtException','path','lodash','papaparse','util','bluebird','moment','squel','ioredis','../../../config/environment','../../../config/logger','import','redis','defaults','localhost','socket.io-emitter','YYYY-MM-DD\x20HH:mm:ss','test','select','field','phone','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.createdAt','cm_contacts.updatedAt','into','fromQuery','scheduledat','ListId','createdAt','priority','recallme','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','cm_hopper','\x22always\x22','\x22onlyIfOpen\x22','toString','insert','cm_hopper_black','ContactId','updatedAt','fields','from','cm_contacts.createdAt\x20=\x20?','ListId\x20=\x20?','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','cm_contacts.ListId','cm_contacts.priority','UserId','.CmListId','\x20=\x20?','concat','CompanyId',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','info','error','message','exit','errors','push','code','sequelize','spread','catch','campaigns.id','campaigns.dialTimezone','campaigns','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','length','all','then','voice_queues_has_cm_lists','voice_queues_has_cm_lists.CmListId=','query','timezones','isNil','utcOffset','offset','dialTimezone','stringify','start','binding','socket_timestamp','root','server/files/tmp','includes','keys','header','parse','data','rows','hasOwnProperty','trim','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','email','dateOfBirth','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','\x20not\x20specified','appendFileSync','emit','contact:import:'];(function(_0x3f535e,_0x5d0e9e){var _0x44ba5a=function(_0x2b1efa){while(--_0x2b1efa){_0x3f535e['push'](_0x3f535e['shift']());}};_0x44ba5a(++_0x5d0e9e);}(_0x070e,0x147));var _0xe070=function(_0x2e0001,_0x5b9571){_0x2e0001=_0x2e0001-0x0;var _0x448985=_0x070e[_0x2e0001];return _0x448985;};'use strict';var fs=require('fs');var path=require(_0xe070('0x0'));var _=require(_0xe070('0x1'));var Papa=require(_0xe070('0x2'));var util=require(_0xe070('0x3'));var BPromise=require(_0xe070('0x4'));var moment=require(_0xe070('0x5'));var squel=require(_0xe070('0x6'));var Redis=require(_0xe070('0x7'));var db=require('../../../mysqldb')['db'];var config=require(_0xe070('0x8'));var shared=require('../../../config/environment/shared');var logger=require(_0xe070('0x9'))(_0xe070('0xa'));config[_0xe070('0xb')]=_[_0xe070('0xc')](config[_0xe070('0xb')],{'host':_0xe070('0xd'),'port':0x18eb});var socket=require(_0xe070('0xe'))(new Redis(config[_0xe070('0xb')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()['format'](_0xe070('0xf'));function isEmail(_0x15f0b4){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))*$/[_0xe070('0x10')](_0x15f0b4);}function selectNotIn(_0x5005e4,_0x54fc55,_0x2c8391,_0x285d35,_0x5e28ba){return squel[_0xe070('0x11')]()[_0xe070('0x12')](_0xe070('0x13'))['from'](_0x285d35)[_0xe070('0x14')](_0x54fc55,null,_0x54fc55+_0xe070('0x15')+_0x285d35+'.'+_0x2c8391)[_0xe070('0x16')](_0x285d35+'.'+_0x2c8391+_0xe070('0x17')+_0x5005e4+'.'+_0x2c8391)[_0xe070('0x16')](_0x54fc55+_0xe070('0x18')+_0x5e28ba[_0xe070('0x14')]()+')');}function insertCmHopper(_0x3c5868,_0x5ba628,_0x169916,_0x4e5d54,_0x45d2d8){var _0x2079ce=[_0xe070('0x19'),_0xe070('0x1a'),_0xe070('0x1b'),'cm_contacts.ListId',_0x5ba628+'.'+_0x4e5d54,_0xe070('0x1c'),_0xe070('0x1d'),'cm_contacts.priority','cm_contacts.UserId','\x22'+_0x45d2d8+'\x22'];return squel['insert']()[_0xe070('0x1e')]('cm_hopper')[_0xe070('0x1f')]([_0xe070('0x13'),_0xe070('0x20'),'ContactId',_0xe070('0x21'),_0x4e5d54,_0xe070('0x22'),'updatedAt',_0xe070('0x23'),'UserId',_0xe070('0x24')],squel[_0xe070('0x11')]()['fields'](_0x2079ce)['from'](_0x5ba628)[_0xe070('0x14')](_0xe070('0x25'),null,_0xe070('0x26')+_0x5ba628+'.CmListId')[_0xe070('0x14')](_0x169916,null,_0x169916+'.id\x20=\x20'+_0x5ba628+'.'+_0x4e5d54)['where'](_0x5ba628+_0xe070('0x27'),_0x3c5868)[_0xe070('0x16')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0xe070('0x16')](_0xe070('0x28'),selectNotIn(_0x5ba628,_0x169916,_0x4e5d54,_0xe070('0x29'),[_0xe070('0x2a'),_0xe070('0x2b')]))[_0xe070('0x16')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x5ba628,_0x169916,_0x4e5d54,_0xe070('0x29'),['\x22always\x22'])))[_0xe070('0x2c')]();}function insertCmHopperBlack(_0x2ae115,_0x109823,_0x571ba8,_0x52fd93){var _0x5e2727=[_0xe070('0x19'),_0xe070('0x1b'),'cm_contacts.ListId',_0x109823+'.'+_0x52fd93,_0xe070('0x1c'),_0xe070('0x1d')];return squel[_0xe070('0x2d')]()[_0xe070('0x1e')](_0xe070('0x2e'))[_0xe070('0x1f')](['phone',_0xe070('0x2f'),_0xe070('0x21'),_0x52fd93,_0xe070('0x22'),_0xe070('0x30')],squel[_0xe070('0x11')]()[_0xe070('0x31')](_0x5e2727)[_0xe070('0x32')](_0x109823)[_0xe070('0x14')](_0xe070('0x25'),null,'cm_contacts.ListId\x20=\x20'+_0x109823+'.CmListId')[_0xe070('0x14')](_0x571ba8,null,_0x571ba8+_0xe070('0x15')+_0x109823+'.'+_0x52fd93)[_0xe070('0x16')](_0x109823+_0xe070('0x27'),_0x2ae115)[_0xe070('0x16')](_0xe070('0x33'),NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0xe070('0x11')]()['field']('phone')[_0xe070('0x32')](_0xe070('0x2e'))[_0xe070('0x16')](_0xe070('0x34'),_0x2ae115)['where'](_0x52fd93+'\x20=\x20?',_0x109823+'.'+_0x52fd93)))['toString']();}function insertTzCmHopper(_0x4e91fe,_0x1ae5c5,_0x4e75e0,_0x12cad4,_0x4746cb,_0x3fe2c5){var _0x275e43=[_0xe070('0x19'),_0xe070('0x35')+_0x3fe2c5+_0xe070('0x36'),_0xe070('0x1b'),_0xe070('0x37'),_0x1ae5c5+'.'+_0x12cad4,_0xe070('0x1c'),_0xe070('0x1d'),_0xe070('0x38'),'cm_contacts.UserId','\x22'+_0x4746cb+'\x22'];var _0x5e3b9b=squel[_0xe070('0x2d')]()['into'](_0xe070('0x29'))[_0xe070('0x1f')]([_0xe070('0x13'),_0xe070('0x20'),'ContactId',_0xe070('0x21'),_0x12cad4,_0xe070('0x22'),_0xe070('0x30'),'priority',_0xe070('0x39'),_0xe070('0x24')],squel['select']()[_0xe070('0x31')](_0x275e43)[_0xe070('0x32')](_0x1ae5c5)['join']('cm_contacts',null,_0xe070('0x26')+_0x1ae5c5+_0xe070('0x3a'))[_0xe070('0x14')](_0x4e75e0,null,_0x4e75e0+_0xe070('0x15')+_0x1ae5c5+'.'+_0x12cad4)[_0xe070('0x14')](_0x3fe2c5,null,_0x3fe2c5+_0xe070('0x15')+_0x1ae5c5+'.'+_0x12cad4)[_0xe070('0x16')](_0x1ae5c5+_0xe070('0x27'),_0x4e91fe)[_0xe070('0x16')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0xe070('0x16')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x1ae5c5,_0x4e75e0,_0x12cad4,'cm_hopper',['\x22always\x22','\x22onlyIfOpen\x22']))['where'](_0xe070('0x28'),selectNotIn(_0x1ae5c5,_0x4e75e0,_0x12cad4,_0xe070('0x29'),[_0xe070('0x2a')])))[_0xe070('0x2c')]();return _0x5e3b9b;}function insertTzCmHopperBlack(_0x49e5ac,_0x560ec6,_0x102a31,_0x2910f7){var _0x4427bb=['cm_contacts.phone',_0xe070('0x1b'),_0xe070('0x37'),_0x560ec6+'.'+_0x2910f7,_0xe070('0x1c'),_0xe070('0x1d')];return squel[_0xe070('0x2d')]()[_0xe070('0x1e')](_0xe070('0x2e'))[_0xe070('0x1f')]([_0xe070('0x13'),_0xe070('0x2f'),_0xe070('0x21'),_0x2910f7,_0xe070('0x22'),_0xe070('0x30')],squel[_0xe070('0x11')]()[_0xe070('0x31')](_0x4427bb)[_0xe070('0x32')](_0x560ec6)['join']('cm_contacts',null,_0xe070('0x26')+_0x560ec6+_0xe070('0x3a'))[_0xe070('0x14')](_0x102a31,null,_0x102a31+'.id\x20=\x20'+_0x560ec6+'.'+_0x2910f7)['where'](_0x560ec6+_0xe070('0x27'),_0x49e5ac)[_0xe070('0x16')]('cm_contacts.createdAt\x20=\x20?',NOW)['where'](_0xe070('0x28'),squel[_0xe070('0x11')]()[_0xe070('0x12')](_0xe070('0x13'))[_0xe070('0x32')](_0xe070('0x2e'))['where']('ListId\x20=\x20?',_0x49e5ac)[_0xe070('0x16')](_0x2910f7+_0xe070('0x3b'),_0x560ec6+'.'+_0x2910f7)))[_0xe070('0x2c')]();}function insertCmContact(_0x3cff1f,_0x3754b0,_0x18391f,_0xd43fc3){var _0x489903=_[_0xe070('0x3c')](_['keys'](_0xd43fc3),['ListId',_0xe070('0x3d'),_0xe070('0x22'),'updatedAt']);return squel[_0xe070('0x2d')]()['into'](_0xe070('0x25'))[_0xe070('0x1f')](_0x489903,squel['select']()[_0xe070('0x31')](_0x489903)[_0xe070('0x32')](_0x3754b0)[_0xe070('0x16')]('('+_0x18391f[_0xe070('0x14')](',')+_0xe070('0x3e'),squel[_0xe070('0x11')]()['fields'](_0x18391f)[_0xe070('0x32')]('cm_contacts')[_0xe070('0x16')]('ListId\x20=\x20?',_0x3cff1f)[_0xe070('0x16')](_0xe070('0x3f')))[_0xe070('0x16')]('id\x20IN\x20?',squel['select']()[_0xe070('0x12')]('MIN(id)','min_id')['from'](_0x3754b0)['group'](_0x18391f[_0xe070('0x14')](','))))[_0xe070('0x2c')]();}function handleStop(){logger[_0xe070('0x40')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x13d164){logger[_0xe070('0x41')](_0x13d164[_0xe070('0x42')]);process[_0xe070('0x43')](0x1);}function handleError(_0x34555f,_0x4e2e99){stats[_0xe070('0x44')][_0xe070('0x45')]({'name':_0x4e2e99[_0xe070('0x46')],'message':_0x4e2e99[_0xe070('0x42')],'row':_0x34555f});}function handleQuery(_0x211b09){logger[_0xe070('0x40')](_0x211b09);return db[_0xe070('0x47')]['query'](_0x211b09)[_0xe070('0x48')](function(_0x2e4c63){results['push'](_0x2e4c63);})[_0xe070('0x49')](function(_0x1241ac){logger[_0xe070('0x41')](_0x1241ac[_0xe070('0x42')]);});}function updateTzCampaigns(_0x3c758a){return new Promise(function(_0x338a23,_0xa4e7c6){var _0x10479c=squel[_0xe070('0x11')]()[_0xe070('0x31')]([_0xe070('0x4a'),_0xe070('0x4b')])['from'](_0xe070('0x4c'))[_0xe070('0x14')](_0xe070('0x4d'),null,_0xe070('0x4e'))[_0xe070('0x16')]('campaigns_has_cm_lists.CmListId='+_0x3c758a);db[_0xe070('0x47')]['query'](_0x10479c[_0xe070('0x2c')]())[_0xe070('0x48')](function(_0x2cce93){var _0x23f901=[];for(var _0x40845b=0x0;_0x40845b<_0x2cce93[_0xe070('0x4f')];_0x40845b++){_0x23f901[_0xe070('0x45')](getTimezoneData(_0x2cce93[_0x40845b],tmp_campaigns));}BPromise[_0xe070('0x50')](_0x23f901)[_0xe070('0x51')](function(){_0x338a23({'val':0x1});});})['catch'](function(_0x4157cd){logger['error'](_0x4157cd['message']);_0x338a23({'val':0x0});});});}function updateTzVoiceQueues(_0x3dcbd5){return new Promise(function(_0x5a0a8e,_0x1154e4){var _0x16fd6d=squel[_0xe070('0x11')]()['fields'](['voice_queues.id','voice_queues.dialTimezone'])['from']('voice_queues')[_0xe070('0x14')](_0xe070('0x52'),null,'voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId')['where'](_0xe070('0x53')+_0x3dcbd5);db[_0xe070('0x47')][_0xe070('0x54')](_0x16fd6d['toString']())[_0xe070('0x48')](function(_0x2d5340){var _0x518757=[];for(var _0x2be20c=0x0;_0x2be20c<_0x2d5340['length'];_0x2be20c++){_0x518757[_0xe070('0x45')](getTimezoneData(_0x2d5340[_0x2be20c],tmp_voice_queues));}BPromise[_0xe070('0x50')](_0x518757)[_0xe070('0x51')](function(){_0x5a0a8e({'val':0x1});});})[_0xe070('0x49')](function(_0x5776f1){logger[_0xe070('0x41')](_0x5776f1[_0xe070('0x42')]);_0x5a0a8e({'val':0x0});});});}function getTimezoneData(_0x36eeb9,_0x3f4096){return new Promise(function(_0x1c6186,_0x185957){var _0x4c3055=shared[_0xe070('0x55')];var _0x53f327=_0x4c3055[_0x36eeb9['dialTimezone']];if(_[_0xe070('0x56')](_0x53f327)){_0x1c6186({'ret':0x1});}else{var _0x4d4fa6=_0x53f327[_0xe070('0x57')];var _0x1176e3=squel[_0xe070('0x2d')]()[_0xe070('0x1e')](_0x3f4096)['set']('id',_0x36eeb9['id'])['set'](_0xe070('0x58'),_0x4d4fa6)['set']('dialTimezone',_0x36eeb9[_0xe070('0x59')])[_0xe070('0x2c')]();return db['sequelize'][_0xe070('0x54')](_0x1176e3)[_0xe070('0x48')](function(_0x5990a9){_0x1c6186({'ret':0x1});})[_0xe070('0x49')](function(_0x4b5fe8){logger[_0xe070('0x41')](_0x4b5fe8['message']);_0x185957({'ret':0x1});});}});}function handleTZQuery(_0x5a4171){logger[_0xe070('0x40')](_0x5a4171);return db['sequelize'][_0xe070('0x54')](_0x5a4171)[_0xe070('0x48')](function(_0x3c7d3e){})[_0xe070('0x49')](function(_0x190aae){logger[_0xe070('0x41')](_0x190aae[_0xe070('0x42')]);});}function main(_0x102e0b,_0x8f8848,_0x33e2c2,_0x35828e){logger['info']('main',_0x102e0b,JSON[_0xe070('0x5a')](_0x8f8848));process['send'](_0xe070('0x5b'));var _0x551b66=_0x8f8848[_0xe070('0x5c')];var _0xdb13e1=_0x8f8848[_0xe070('0x5d')];var _0x2e408f=path[_0xe070('0x14')](config[_0xe070('0x5e')],_0xe070('0x5f'),_0xdb13e1+'.csv');hasTZ=_['keys'](_0x551b66)[_0xe070('0x60')]('dialTimezone');var _0x514808=_[_0xe070('0x61')](_0x551b66)[_0xe070('0x14')]();logger[_0xe070('0x40')](_0xe070('0x62'),_0x514808);if(hasTZ)_0x514808+=',utcOffset';fs['writeFileSync'](_0x2e408f,_0x514808+'\x0a');Papa[_0xe070('0x63')](fs['createReadStream'](_0x102e0b),{'header':!![],'skipEmptyLines':!![],'step':function(_0x5521c5,_0x501e04){try{for(var _0x3cafed=0x0,_0xd0cf3=[];_0x3cafed<_0x5521c5[_0xe070('0x64')][_0xe070('0x4f')];_0x3cafed++){stats[_0xe070('0x65')]+=0x1;if(_0x5521c5[_0xe070('0x44')][_0x3cafed]){handleError(_0x5521c5[_0xe070('0x64')][_0x3cafed],_0x5521c5[_0xe070('0x44')][_0x3cafed]);}else{var _0x321137=[];for(var _0xfaca51 in _0x551b66){if(_0x551b66[_0xe070('0x66')](_0xfaca51)){if(_0x5521c5[_0xe070('0x64')][_0x3cafed][_0x551b66[_0xfaca51]]){var _0x8be0ff=_[_0xe070('0x67')](_0x5521c5['data'][_0x3cafed][_0x551b66[_0xfaca51]]['replace'](/"/g,'\x27'));switch(_0xfaca51){case _0xe070('0x20'):var _0x5bdf64=moment(_0x8be0ff,_0xe070('0xf'),!![]);if(_0x5bdf64[_0xe070('0x68')]()){_0xd0cf3[_0xe070('0x45')]('\x22'+_0x8be0ff+'\x22');}else{_0x321137[_0xe070('0x45')](_0xe070('0x69'));}break;case _0xe070('0x23'):var _0xcee3c4=parseInt(_0x8be0ff);_0x8be0ff=_[_0xe070('0x6a')](_0xcee3c4)||_0xcee3c4<0x0||_0xcee3c4>0x4?_0x35828e?0x3:0x2:_0xcee3c4;_0xd0cf3['push']('\x22'+_0x8be0ff+'\x22');break;case'UserId':var _0x266476=parseInt(_0x8be0ff);if(_['isNumber'](_0x266476)&&_['includes'](_0x33e2c2,_0x266476)){_0xd0cf3[_0xe070('0x45')]('\x22'+_0x266476+'\x22');}else{_0x321137[_0xe070('0x45')]('agent\x20not\x20exists');}break;case _0xe070('0x6b'):if(isEmail(_0x8be0ff)){_0xd0cf3[_0xe070('0x45')]('\x22'+_0x8be0ff+'\x22');}else{_0x321137[_0xe070('0x45')]('email\x20wrong\x20format');}break;case _0xe070('0x6c'):var _0x39f938=moment(_0x8be0ff,'YYYY-MM-DD',!![]);if(_0x39f938[_0xe070('0x68')]()){_0xd0cf3[_0xe070('0x45')]('\x22'+_0x8be0ff+'\x22');}else{_0x321137[_0xe070('0x45')](_0xe070('0x6d'));}break;case _0xe070('0x59'):var _0x459536=shared[_0xe070('0x55')];var _0x1d0c38=_0x459536[_0x8be0ff];if(!_['isNil'](_0x1d0c38)){var _0x1a467c=_0x1d0c38[_0xe070('0x57')];_0xd0cf3[_0xe070('0x45')]('\x22'+_0x8be0ff+'\x22');_0xd0cf3[_0xe070('0x45')]('\x22'+_0x1a467c+'\x22');}break;default:_0xd0cf3['push']('\x22'+_0x8be0ff+'\x22');}}else{switch(_0xfaca51){case'firstName':case _0xe070('0x13'):_0x321137['push'](_0xfaca51+_0xe070('0x6e'));break;default:_0xd0cf3[_0xe070('0x45')]('\x22\x22');}}}}if(_0x321137['length']){handleError(_0x5521c5[_0xe070('0x64')][_0x3cafed],{'code':'SystemRow','message':_0x321137[_0xe070('0x14')]()});}else{fs[_0xe070('0x6f')](_0x2e408f,_0xd0cf3[_0xe070('0x14')]()+'\x0a');}_0xd0cf3=[];}if(!(stats['rows']%0xc8)){socket[_0xe070('0x70')](_0xe070('0x71')+_0xdb13e1,stats);stats[_0xe070('0x44')]=[];}}if(stopped){logger['info']('Abort\x20parser');_0x501e04[_0xe070('0x72')]();}}catch(_0x452f56){handleError(_0x5521c5[_0xe070('0x64')][_0x3cafed],{'code':_0xe070('0x73'),'message':_0x452f56[_0xe070('0x42')]});logger[_0xe070('0x41')](_0xe070('0x74'),_0x452f56[_0xe070('0x42')]);}},'complete':function(){try{var _0x23fd51=[];var _0x34fe68=[];var _0x46fee1='cm_contacts';if(_0x8f8848['duplicates']&&_0x8f8848[_0xe070('0x75')][_0xe070('0x4f')]){_0x46fee1='cm_contacts_'+_0xdb13e1;_0x23fd51[_0xe070('0x45')](_0xe070('0x76')+_0x46fee1+_0xe070('0x77'));}tmp_campaigns=_0xe070('0x78')+_0xdb13e1;tmp_voice_queues=_0xe070('0x79')+_0xdb13e1;_0x34fe68[_0xe070('0x45')](_0xe070('0x76')+tmp_campaigns+_0xe070('0x7a'));_0x34fe68['push'](_0xe070('0x76')+tmp_voice_queues+_0xe070('0x7a'));BPromise['each'](_0x34fe68,handleTZQuery)[_0xe070('0x51')](function(_0x4862c7){updateTzCampaigns(_0x8f8848[_0xe070('0x21')])[_0xe070('0x51')](function(_0x26979c){updateTzVoiceQueues(_0x8f8848['ListId'])['then'](function(_0xb9ebd0){var _0x2abc1b=util[_0xe070('0x7b')]('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',_0x2e408f,_0x46fee1,_0x514808,_0x8f8848[_0xe070('0x21')],_0x8f8848[_0xe070('0x3d')]||null,NOW,NOW);if(_[_0xe070('0x56')](_0x551b66[_0xe070('0x20')])){_0x2abc1b+=_0xe070('0x7c');}_0x23fd51[_0xe070('0x45')](_0x2abc1b);if(_0x8f8848[_0xe070('0x75')]&&_0x8f8848[_0xe070('0x75')][_0xe070('0x4f')]){_0x23fd51[_0xe070('0x45')](insertCmContact(_0x8f8848[_0xe070('0x21')],_0x46fee1,_0x8f8848[_0xe070('0x75')],_0x551b66));_0x23fd51[_0xe070('0x45')](_0xe070('0x7d')+_0x46fee1+';');}if(hasTZ){_0x23fd51[_0xe070('0x45')](insertTzCmHopper(_0x8f8848[_0xe070('0x21')],'voice_queues_has_cm_lists',_0xe070('0x7e'),_0xe070('0x7f'),_0x35828e,tmp_voice_queues));_0x23fd51[_0xe070('0x45')](insertTzCmHopperBlack(_0x8f8848[_0xe070('0x21')],_0xe070('0x80'),'voice_queues',_0xe070('0x7f')));_0x23fd51[_0xe070('0x45')](insertTzCmHopper(_0x8f8848[_0xe070('0x21')],_0xe070('0x4d'),'campaigns',_0xe070('0x81'),_0x35828e,tmp_campaigns));_0x23fd51[_0xe070('0x45')](insertTzCmHopperBlack(_0x8f8848[_0xe070('0x21')],_0xe070('0x82'),_0xe070('0x4c'),'CampaignId'));}else{_0x23fd51[_0xe070('0x45')](insertCmHopper(_0x8f8848[_0xe070('0x21')],_0xe070('0x52'),_0xe070('0x7e'),'VoiceQueueId',_0x35828e));_0x23fd51[_0xe070('0x45')](insertCmHopperBlack(_0x8f8848['ListId'],_0xe070('0x80'),_0xe070('0x7e'),_0xe070('0x7f')));_0x23fd51[_0xe070('0x45')](insertCmHopper(_0x8f8848[_0xe070('0x21')],'campaigns_has_cm_lists',_0xe070('0x4c'),'CampaignId',_0x35828e));_0x23fd51['push'](insertCmHopperBlack(_0x8f8848[_0xe070('0x21')],_0xe070('0x82'),_0xe070('0x4c'),_0xe070('0x81')));}_0x23fd51[_0xe070('0x45')](_0xe070('0x7d')+tmp_campaigns+';');_0x23fd51['push'](_0xe070('0x7d')+tmp_voice_queues+';');BPromise[_0xe070('0x83')](_0x23fd51,handleQuery)[_0xe070('0x51')](function(_0x2eb0ef){stats[_0xe070('0x84')]=!![];stats[_0xe070('0x85')]=_0x8f8848['duplicates']&&_0x8f8848[_0xe070('0x75')][_0xe070('0x4f')]?results[0x2][_0xe070('0x85')]:results[0x0]['affectedRows'];socket[_0xe070('0x70')](_0xe070('0x71')+_0xdb13e1,stats);fs['unlink'](_0x102e0b);fs[_0xe070('0x86')](_0x2e408f);process['exit'](0x0);})['catch'](function(_0x563345){logger[_0xe070('0x41')](_0x563345[_0xe070('0x42')]);process[_0xe070('0x43')](0x1);});});});});}catch(_0x394234){logger[_0xe070('0x41')](_0xe070('0x87'),_0x394234[_0xe070('0x42')]);process[_0xe070('0x43')](0x1);}},'error':function(_0x529955,_0x1e1cec,_0x1ab429,_0x2e0256){throw new Error(_0x2e0256);}});}function validate(){if(process[_0xe070('0x88')]&&process['argv']['length']<0x4){throw new Error(_0xe070('0x89'));}var _0x3770b5=path[_0xe070('0x14')](config[_0xe070('0x5e')],'server/files/tmp',process[_0xe070('0x88')][0x2]);if(!fs[_0xe070('0x8a')](_0x3770b5)){throw new Error(_0xe070('0x8b'));}var _0x2e20da={};try{_0x2e20da=JSON[_0xe070('0x63')](process[_0xe070('0x88')][0x3]);if(!_0x2e20da[_0xe070('0x5c')]){throw new Error('binding\x20doesn\x27t\x20exists');}if(!_0x2e20da[_0xe070('0x5c')][_0xe070('0x13')]){throw new Error(_0xe070('0x8c'));}if(!_0x2e20da[_0xe070('0x5c')][_0xe070('0x8d')]){throw new Error(_0xe070('0x8e'));}var _0x4f61cd=0x0;if(_0x2e20da[_0xe070('0x5c')][_0xe070('0x39')]){_0x4f61cd=0x1;}if(!_0x2e20da[_0xe070('0x21')]){throw new Error(_0xe070('0x8f'));}}catch(_0x245e4d){throw new Error('body\x20id\x20mandatory');}var _0x14391c=[];try{_0x14391c=_[_0xe070('0x90')](JSON[_0xe070('0x63')](process[_0xe070('0x88')][0x4]),'id');}catch(_0x346beb){logger[_0xe070('0x40')](_0xe070('0x91'));}main(_0x3770b5,_0x2e20da,_0x14391c,_0x4f61cd);}validate();process['on']('SIGINT',handleStop);process['on'](_0xe070('0x92'),handleUncaughtException); \ No newline at end of file +var _0xc6c2=['import','redis','defaults','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','select','field','phone','from','join','.id\x20=\x20','\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','fromQuery','scheduledat','ContactId','ListId','createdAt','priority','UserId','recallme','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','cm_hopper','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.ListId','updatedAt','cm_hopper_black','ListId\x20=\x20?','\x20=\x20?','toString','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','MIN(id)','min_id','group','info','error','message','errors','push','code','query','spread','catch','campaigns.id','campaigns.dialTimezone','campaigns','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','sequelize','length','voice_queues.id','voice_queues.dialTimezone','voice_queues','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','all','timezones','dialTimezone','isNil','utcOffset','set','offset','main','stringify','send','binding','root','server/files/tmp','.csv','includes','header',',utcOffset','writeFileSync','parse','createReadStream','data','rows','hasOwnProperty','trim','replace','isValid','isNaN','isNumber','agent\x20not\x20exists','email','YYYY-MM-DD','firstName','\x20not\x20specified','SystemRow','appendFileSync','emit','Abort\x20parser','SystemError','step','duplicates','cm_contacts_','\x20LIKE\x20cm_contacts;','campaigns_','voice_queues_','CREATE\x20TABLE\x20','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','then',',\x20scheduledAt\x20=\x20NOW()','voice_queues_has_cm_lists','VoiceQueueId','voice_queues_has_cm_blacklists','CampaignId','campaigns_has_cm_blacklists','campaigns_has_cm_lists','DROP\x20TABLE\x20','each','finish','affectedRows','contact:import:','unlink','exit','argv','arguments\x20\x20\x20','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','No\x20agent\x20available','SIGINT','path','lodash','papaparse','util','bluebird','moment','ioredis','../../../mysqldb'];(function(_0x31b10e,_0x268282){var _0x3e53fc=function(_0x4d88d9){while(--_0x4d88d9){_0x31b10e['push'](_0x31b10e['shift']());}};_0x3e53fc(++_0x268282);}(_0xc6c2,0x93));var _0x2c6c=function(_0x1147ab,_0x10e72b){_0x1147ab=_0x1147ab-0x0;var _0x55cb5a=_0xc6c2[_0x1147ab];return _0x55cb5a;};'use strict';var fs=require('fs');var path=require(_0x2c6c('0x0'));var _=require(_0x2c6c('0x1'));var Papa=require(_0x2c6c('0x2'));var util=require(_0x2c6c('0x3'));var BPromise=require(_0x2c6c('0x4'));var moment=require(_0x2c6c('0x5'));var squel=require('squel');var Redis=require(_0x2c6c('0x6'));var db=require(_0x2c6c('0x7'))['db'];var config=require('../../../config/environment');var shared=require('../../../config/environment/shared');var logger=require('../../../config/logger')(_0x2c6c('0x8'));config[_0x2c6c('0x9')]=_[_0x2c6c('0xa')](config['redis'],{'host':_0x2c6c('0xb'),'port':0x18eb});var socket=require(_0x2c6c('0xc'))(new Redis(config[_0x2c6c('0x9')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x2c6c('0xd')](_0x2c6c('0xe'));function isEmail(_0x3e24d9){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))*$/[_0x2c6c('0xf')](_0x3e24d9);}function selectNotIn(_0x1bfd97,_0x5875eb,_0x454363,_0x411e5b,_0x1bd7f6){return squel[_0x2c6c('0x10')]()[_0x2c6c('0x11')](_0x2c6c('0x12'))[_0x2c6c('0x13')](_0x411e5b)[_0x2c6c('0x14')](_0x5875eb,null,_0x5875eb+_0x2c6c('0x15')+_0x411e5b+'.'+_0x454363)['where'](_0x411e5b+'.'+_0x454363+_0x2c6c('0x16')+_0x1bfd97+'.'+_0x454363)[_0x2c6c('0x17')](_0x5875eb+_0x2c6c('0x18')+_0x1bd7f6[_0x2c6c('0x14')]()+')');}function insertCmHopper(_0x7dbc8a,_0x1372c6,_0x5705b2,_0x2be0e6,_0x58930c){var _0x4a74fd=[_0x2c6c('0x19'),_0x2c6c('0x1a'),_0x2c6c('0x1b'),'cm_contacts.ListId',_0x1372c6+'.'+_0x2be0e6,_0x2c6c('0x1c'),_0x2c6c('0x1d'),_0x2c6c('0x1e'),_0x2c6c('0x1f'),'\x22'+_0x58930c+'\x22'];return squel[_0x2c6c('0x20')]()[_0x2c6c('0x21')]('cm_hopper')[_0x2c6c('0x22')]([_0x2c6c('0x12'),_0x2c6c('0x23'),_0x2c6c('0x24'),_0x2c6c('0x25'),_0x2be0e6,_0x2c6c('0x26'),'updatedAt',_0x2c6c('0x27'),_0x2c6c('0x28'),_0x2c6c('0x29')],squel['select']()[_0x2c6c('0x2a')](_0x4a74fd)[_0x2c6c('0x13')](_0x1372c6)[_0x2c6c('0x14')](_0x2c6c('0x2b'),null,_0x2c6c('0x2c')+_0x1372c6+_0x2c6c('0x2d'))[_0x2c6c('0x14')](_0x5705b2,null,_0x5705b2+_0x2c6c('0x15')+_0x1372c6+'.'+_0x2be0e6)[_0x2c6c('0x17')](_0x1372c6+_0x2c6c('0x2e'),_0x7dbc8a)['where'](_0x2c6c('0x2f'),NOW)[_0x2c6c('0x17')](_0x2c6c('0x30'),selectNotIn(_0x1372c6,_0x5705b2,_0x2be0e6,_0x2c6c('0x31'),[_0x2c6c('0x32'),_0x2c6c('0x33')]))['where'](_0x2c6c('0x30'),selectNotIn(_0x1372c6,_0x5705b2,_0x2be0e6,_0x2c6c('0x31'),['\x22always\x22'])))['toString']();}function insertCmHopperBlack(_0x2aa04a,_0x46206e,_0x1b0b90,_0xd9ffaa){var _0x3fe8a6=[_0x2c6c('0x19'),_0x2c6c('0x1b'),_0x2c6c('0x34'),_0x46206e+'.'+_0xd9ffaa,_0x2c6c('0x1c'),_0x2c6c('0x1d')];return squel['insert']()['into']('cm_hopper_black')[_0x2c6c('0x22')]([_0x2c6c('0x12'),_0x2c6c('0x24'),'ListId',_0xd9ffaa,_0x2c6c('0x26'),_0x2c6c('0x35')],squel[_0x2c6c('0x10')]()['fields'](_0x3fe8a6)[_0x2c6c('0x13')](_0x46206e)[_0x2c6c('0x14')](_0x2c6c('0x2b'),null,_0x2c6c('0x2c')+_0x46206e+_0x2c6c('0x2d'))['join'](_0x1b0b90,null,_0x1b0b90+_0x2c6c('0x15')+_0x46206e+'.'+_0xd9ffaa)[_0x2c6c('0x17')](_0x46206e+_0x2c6c('0x2e'),_0x2aa04a)['where'](_0x2c6c('0x2f'),NOW)[_0x2c6c('0x17')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x2c6c('0x10')]()['field'](_0x2c6c('0x12'))[_0x2c6c('0x13')](_0x2c6c('0x36'))[_0x2c6c('0x17')](_0x2c6c('0x37'),_0x2aa04a)['where'](_0xd9ffaa+_0x2c6c('0x38'),_0x46206e+'.'+_0xd9ffaa)))[_0x2c6c('0x39')]();}function insertTzCmHopper(_0x43121f,_0x2fecee,_0x545ac9,_0x4c0d39,_0x13f1e4,_0x546f50){var _0x3b6422=[_0x2c6c('0x19'),_0x2c6c('0x3a')+_0x546f50+_0x2c6c('0x3b'),_0x2c6c('0x1b'),_0x2c6c('0x34'),_0x2fecee+'.'+_0x4c0d39,_0x2c6c('0x1c'),'cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','\x22'+_0x13f1e4+'\x22'];var _0x4f6302=squel[_0x2c6c('0x20')]()[_0x2c6c('0x21')](_0x2c6c('0x31'))[_0x2c6c('0x22')]([_0x2c6c('0x12'),'scheduledat','ContactId',_0x2c6c('0x25'),_0x4c0d39,_0x2c6c('0x26'),_0x2c6c('0x35'),_0x2c6c('0x27'),_0x2c6c('0x28'),_0x2c6c('0x29')],squel[_0x2c6c('0x10')]()[_0x2c6c('0x2a')](_0x3b6422)[_0x2c6c('0x13')](_0x2fecee)['join'](_0x2c6c('0x2b'),null,'cm_contacts.ListId\x20=\x20'+_0x2fecee+_0x2c6c('0x2d'))[_0x2c6c('0x14')](_0x545ac9,null,_0x545ac9+_0x2c6c('0x15')+_0x2fecee+'.'+_0x4c0d39)['join'](_0x546f50,null,_0x546f50+_0x2c6c('0x15')+_0x2fecee+'.'+_0x4c0d39)[_0x2c6c('0x17')](_0x2fecee+_0x2c6c('0x2e'),_0x43121f)[_0x2c6c('0x17')](_0x2c6c('0x2f'),NOW)[_0x2c6c('0x17')](_0x2c6c('0x30'),selectNotIn(_0x2fecee,_0x545ac9,_0x4c0d39,_0x2c6c('0x31'),[_0x2c6c('0x32'),_0x2c6c('0x33')]))[_0x2c6c('0x17')](_0x2c6c('0x30'),selectNotIn(_0x2fecee,_0x545ac9,_0x4c0d39,_0x2c6c('0x31'),[_0x2c6c('0x32')])))['toString']();return _0x4f6302;}function insertTzCmHopperBlack(_0x4b4d28,_0x5bb87a,_0x2cafd5,_0x2b76c9){var _0x5cffd0=[_0x2c6c('0x19'),_0x2c6c('0x1b'),_0x2c6c('0x34'),_0x5bb87a+'.'+_0x2b76c9,_0x2c6c('0x1c'),_0x2c6c('0x1d')];return squel[_0x2c6c('0x20')]()[_0x2c6c('0x21')](_0x2c6c('0x36'))[_0x2c6c('0x22')]([_0x2c6c('0x12'),_0x2c6c('0x24'),_0x2c6c('0x25'),_0x2b76c9,_0x2c6c('0x26'),'updatedAt'],squel[_0x2c6c('0x10')]()['fields'](_0x5cffd0)['from'](_0x5bb87a)['join']('cm_contacts',null,_0x2c6c('0x2c')+_0x5bb87a+'.CmListId')[_0x2c6c('0x14')](_0x2cafd5,null,_0x2cafd5+_0x2c6c('0x15')+_0x5bb87a+'.'+_0x2b76c9)['where'](_0x5bb87a+'.CmListId\x20=\x20?',_0x4b4d28)['where'](_0x2c6c('0x2f'),NOW)['where'](_0x2c6c('0x30'),squel[_0x2c6c('0x10')]()['field']('phone')[_0x2c6c('0x13')](_0x2c6c('0x36'))[_0x2c6c('0x17')](_0x2c6c('0x37'),_0x4b4d28)[_0x2c6c('0x17')](_0x2b76c9+_0x2c6c('0x38'),_0x5bb87a+'.'+_0x2b76c9)))[_0x2c6c('0x39')]();}function insertCmContact(_0x4adbff,_0x3b3da0,_0x44a07b,_0x4c8625){var _0x2efbf1=_[_0x2c6c('0x3c')](_[_0x2c6c('0x3d')](_0x4c8625),[_0x2c6c('0x25'),_0x2c6c('0x3e'),_0x2c6c('0x26'),_0x2c6c('0x35')]);return squel[_0x2c6c('0x20')]()['into'](_0x2c6c('0x2b'))['fromQuery'](_0x2efbf1,squel[_0x2c6c('0x10')]()[_0x2c6c('0x2a')](_0x2efbf1)[_0x2c6c('0x13')](_0x3b3da0)[_0x2c6c('0x17')]('('+_0x44a07b[_0x2c6c('0x14')](',')+_0x2c6c('0x3f'),squel['select']()[_0x2c6c('0x2a')](_0x44a07b)['from']('cm_contacts')[_0x2c6c('0x17')](_0x2c6c('0x37'),_0x4adbff)[_0x2c6c('0x17')](_0x2c6c('0x40')))['where']('id\x20IN\x20?',squel[_0x2c6c('0x10')]()[_0x2c6c('0x11')](_0x2c6c('0x41'),_0x2c6c('0x42'))[_0x2c6c('0x13')](_0x3b3da0)[_0x2c6c('0x43')](_0x44a07b[_0x2c6c('0x14')](','))))[_0x2c6c('0x39')]();}function handleStop(){logger[_0x2c6c('0x44')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x6822d9){logger[_0x2c6c('0x45')](_0x6822d9[_0x2c6c('0x46')]);process['exit'](0x1);}function handleError(_0x28acbc,_0x44da39){stats[_0x2c6c('0x47')][_0x2c6c('0x48')]({'name':_0x44da39[_0x2c6c('0x49')],'message':_0x44da39[_0x2c6c('0x46')],'row':_0x28acbc});}function handleQuery(_0x3e88bd){logger[_0x2c6c('0x44')](_0x3e88bd);return db['sequelize'][_0x2c6c('0x4a')](_0x3e88bd)[_0x2c6c('0x4b')](function(_0x505236){results[_0x2c6c('0x48')](_0x505236);})[_0x2c6c('0x4c')](function(_0x4e4475){logger[_0x2c6c('0x45')](_0x4e4475[_0x2c6c('0x46')]);});}function updateTzCampaigns(_0x48ca89){return new Promise(function(_0x2fc286,_0x256361){var _0x371d61=squel[_0x2c6c('0x10')]()[_0x2c6c('0x2a')]([_0x2c6c('0x4d'),_0x2c6c('0x4e')])[_0x2c6c('0x13')](_0x2c6c('0x4f'))[_0x2c6c('0x14')]('campaigns_has_cm_lists',null,_0x2c6c('0x50'))[_0x2c6c('0x17')](_0x2c6c('0x51')+_0x48ca89);db[_0x2c6c('0x52')][_0x2c6c('0x4a')](_0x371d61[_0x2c6c('0x39')]())['spread'](function(_0x49bf9c){var _0x2f3116=[];for(var _0x5408c2=0x0;_0x5408c2<_0x49bf9c[_0x2c6c('0x53')];_0x5408c2++){_0x2f3116['push'](getTimezoneData(_0x49bf9c[_0x5408c2],tmp_campaigns));}BPromise['all'](_0x2f3116)['then'](function(){_0x2fc286({'val':0x1});});})[_0x2c6c('0x4c')](function(_0x31c577){logger[_0x2c6c('0x45')](_0x31c577['message']);_0x2fc286({'val':0x0});});});}function updateTzVoiceQueues(_0x1375de){return new Promise(function(_0x321f21,_0x5f171f){var _0x5e93d3=squel[_0x2c6c('0x10')]()['fields']([_0x2c6c('0x54'),_0x2c6c('0x55')])['from'](_0x2c6c('0x56'))[_0x2c6c('0x14')]('voice_queues_has_cm_lists',null,_0x2c6c('0x57'))[_0x2c6c('0x17')]('voice_queues_has_cm_lists.CmListId='+_0x1375de);db[_0x2c6c('0x52')][_0x2c6c('0x4a')](_0x5e93d3[_0x2c6c('0x39')]())[_0x2c6c('0x4b')](function(_0x2924b9){var _0x53c08c=[];for(var _0x312bad=0x0;_0x312bad<_0x2924b9['length'];_0x312bad++){_0x53c08c[_0x2c6c('0x48')](getTimezoneData(_0x2924b9[_0x312bad],tmp_voice_queues));}BPromise[_0x2c6c('0x58')](_0x53c08c)['then'](function(){_0x321f21({'val':0x1});});})[_0x2c6c('0x4c')](function(_0x5233d2){logger[_0x2c6c('0x45')](_0x5233d2[_0x2c6c('0x46')]);_0x321f21({'val':0x0});});});}function getTimezoneData(_0x145801,_0x2a356c){return new Promise(function(_0x3b9c26,_0x2c4aea){var _0x46718c=shared[_0x2c6c('0x59')];var _0x1f24b2=_0x46718c[_0x145801[_0x2c6c('0x5a')]];if(_[_0x2c6c('0x5b')](_0x1f24b2)){_0x3b9c26({'ret':0x1});}else{var _0x46b496=_0x1f24b2[_0x2c6c('0x5c')];var _0x27c2d5=squel[_0x2c6c('0x20')]()['into'](_0x2a356c)[_0x2c6c('0x5d')]('id',_0x145801['id'])['set'](_0x2c6c('0x5e'),_0x46b496)[_0x2c6c('0x5d')]('dialTimezone',_0x145801[_0x2c6c('0x5a')])[_0x2c6c('0x39')]();return db[_0x2c6c('0x52')][_0x2c6c('0x4a')](_0x27c2d5)['spread'](function(_0x3983ae){_0x3b9c26({'ret':0x1});})['catch'](function(_0x1e068d){logger[_0x2c6c('0x45')](_0x1e068d[_0x2c6c('0x46')]);_0x2c4aea({'ret':0x1});});}});}function handleTZQuery(_0x1134cc){logger[_0x2c6c('0x44')](_0x1134cc);return db[_0x2c6c('0x52')]['query'](_0x1134cc)[_0x2c6c('0x4b')](function(_0x23aaf0){})[_0x2c6c('0x4c')](function(_0x6ece22){logger[_0x2c6c('0x45')](_0x6ece22['message']);});}function main(_0xb16510,_0x1f26ff,_0x2a2bb4,_0x5aae72){logger[_0x2c6c('0x44')](_0x2c6c('0x5f'),_0xb16510,JSON[_0x2c6c('0x60')](_0x1f26ff));process[_0x2c6c('0x61')]('start');var _0x664758=_0x1f26ff[_0x2c6c('0x62')];var _0x18b07=_0x1f26ff['socket_timestamp'];var _0x3b9db5=path[_0x2c6c('0x14')](config[_0x2c6c('0x63')],_0x2c6c('0x64'),_0x18b07+_0x2c6c('0x65'));hasTZ=_[_0x2c6c('0x3d')](_0x664758)[_0x2c6c('0x66')](_0x2c6c('0x5a'));var _0x5df22c=_[_0x2c6c('0x3d')](_0x664758)[_0x2c6c('0x14')]();logger[_0x2c6c('0x44')](_0x2c6c('0x67'),_0x5df22c);if(hasTZ)_0x5df22c+=_0x2c6c('0x68');fs[_0x2c6c('0x69')](_0x3b9db5,_0x5df22c+'\x0a');Papa[_0x2c6c('0x6a')](fs[_0x2c6c('0x6b')](_0xb16510),{'header':!![],'skipEmptyLines':!![],'step':function(_0xe48218,_0x5a2ca6){try{for(var _0x519104=0x0,_0x34ac3a=[];_0x519104<_0xe48218[_0x2c6c('0x6c')][_0x2c6c('0x53')];_0x519104++){stats[_0x2c6c('0x6d')]+=0x1;if(_0xe48218[_0x2c6c('0x47')][_0x519104]){handleError(_0xe48218[_0x2c6c('0x6c')][_0x519104],_0xe48218[_0x2c6c('0x47')][_0x519104]);}else{var _0x114ca1=[];for(var _0x5ae7b3 in _0x664758){if(_0x664758[_0x2c6c('0x6e')](_0x5ae7b3)){if(_0xe48218[_0x2c6c('0x6c')][_0x519104][_0x664758[_0x5ae7b3]]){var _0x12acd1=_[_0x2c6c('0x6f')](_0xe48218[_0x2c6c('0x6c')][_0x519104][_0x664758[_0x5ae7b3]][_0x2c6c('0x70')](/"/g,'\x27'));switch(_0x5ae7b3){case _0x2c6c('0x23'):var _0x1823b1=moment(_0x12acd1,_0x2c6c('0xe'),!![]);if(_0x1823b1[_0x2c6c('0x71')]()){_0x34ac3a[_0x2c6c('0x48')]('\x22'+_0x12acd1+'\x22');}else{_0x114ca1[_0x2c6c('0x48')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0x2c6c('0x27'):var _0x5816af=parseInt(_0x12acd1);_0x12acd1=_[_0x2c6c('0x72')](_0x5816af)||_0x5816af<0x0||_0x5816af>0x4?_0x5aae72?0x3:0x2:_0x5816af;_0x34ac3a[_0x2c6c('0x48')]('\x22'+_0x12acd1+'\x22');break;case _0x2c6c('0x28'):var _0x4badd8=parseInt(_0x12acd1);if(_[_0x2c6c('0x73')](_0x4badd8)&&_['includes'](_0x2a2bb4,_0x4badd8)){_0x34ac3a[_0x2c6c('0x48')]('\x22'+_0x4badd8+'\x22');}else{_0x114ca1[_0x2c6c('0x48')](_0x2c6c('0x74'));}break;case _0x2c6c('0x75'):if(isEmail(_0x12acd1)){_0x34ac3a[_0x2c6c('0x48')]('\x22'+_0x12acd1+'\x22');}else{_0x114ca1[_0x2c6c('0x48')]('email\x20wrong\x20format');}break;case'dateOfBirth':var _0x55f3d3=moment(_0x12acd1,_0x2c6c('0x76'),!![]);if(_0x55f3d3[_0x2c6c('0x71')]()){_0x34ac3a['push']('\x22'+_0x12acd1+'\x22');}else{_0x114ca1['push']('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;case _0x2c6c('0x5a'):var _0x30b6f3=shared[_0x2c6c('0x59')];var _0x1c12ba=_0x30b6f3[_0x12acd1];if(!_[_0x2c6c('0x5b')](_0x1c12ba)){var _0x5e24d0=_0x1c12ba['utcOffset'];_0x34ac3a[_0x2c6c('0x48')]('\x22'+_0x12acd1+'\x22');_0x34ac3a[_0x2c6c('0x48')]('\x22'+_0x5e24d0+'\x22');}break;default:_0x34ac3a[_0x2c6c('0x48')]('\x22'+_0x12acd1+'\x22');}}else{switch(_0x5ae7b3){case _0x2c6c('0x77'):case'phone':_0x114ca1[_0x2c6c('0x48')](_0x5ae7b3+_0x2c6c('0x78'));break;default:_0x34ac3a[_0x2c6c('0x48')]('\x22\x22');}}}}if(_0x114ca1[_0x2c6c('0x53')]){handleError(_0xe48218[_0x2c6c('0x6c')][_0x519104],{'code':_0x2c6c('0x79'),'message':_0x114ca1['join']()});}else{fs[_0x2c6c('0x7a')](_0x3b9db5,_0x34ac3a[_0x2c6c('0x14')]()+'\x0a');}_0x34ac3a=[];}if(!(stats[_0x2c6c('0x6d')]%0xc8)){socket[_0x2c6c('0x7b')]('contact:import:'+_0x18b07,stats);stats[_0x2c6c('0x47')]=[];}}if(stopped){logger['info'](_0x2c6c('0x7c'));_0x5a2ca6['abort']();}}catch(_0xd4a153){handleError(_0xe48218['data'][_0x519104],{'code':_0x2c6c('0x7d'),'message':_0xd4a153[_0x2c6c('0x46')]});logger[_0x2c6c('0x45')](_0x2c6c('0x7e'),_0xd4a153[_0x2c6c('0x46')]);}},'complete':function(){try{var _0x40f150=[];var _0x52f5b8=[];var _0x397fb7='cm_contacts';if(_0x1f26ff[_0x2c6c('0x7f')]&&_0x1f26ff[_0x2c6c('0x7f')]['length']){_0x397fb7=_0x2c6c('0x80')+_0x18b07;_0x40f150[_0x2c6c('0x48')]('CREATE\x20TABLE\x20'+_0x397fb7+_0x2c6c('0x81'));}tmp_campaigns=_0x2c6c('0x82')+_0x18b07;tmp_voice_queues=_0x2c6c('0x83')+_0x18b07;_0x52f5b8[_0x2c6c('0x48')](_0x2c6c('0x84')+tmp_campaigns+_0x2c6c('0x85'));_0x52f5b8[_0x2c6c('0x48')](_0x2c6c('0x84')+tmp_voice_queues+_0x2c6c('0x85'));BPromise['each'](_0x52f5b8,handleTZQuery)[_0x2c6c('0x86')](function(_0x2d250a){updateTzCampaigns(_0x1f26ff[_0x2c6c('0x25')])[_0x2c6c('0x86')](function(_0x2f4deb){updateTzVoiceQueues(_0x1f26ff[_0x2c6c('0x25')])[_0x2c6c('0x86')](function(_0x1269f3){var _0xdb69a6=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',_0x3b9db5,_0x397fb7,_0x5df22c,_0x1f26ff['ListId'],_0x1f26ff['CompanyId']||null,NOW,NOW);if(_[_0x2c6c('0x5b')](_0x664758[_0x2c6c('0x23')])){_0xdb69a6+=_0x2c6c('0x87');}_0x40f150[_0x2c6c('0x48')](_0xdb69a6);if(_0x1f26ff[_0x2c6c('0x7f')]&&_0x1f26ff[_0x2c6c('0x7f')][_0x2c6c('0x53')]){_0x40f150['push'](insertCmContact(_0x1f26ff[_0x2c6c('0x25')],_0x397fb7,_0x1f26ff[_0x2c6c('0x7f')],_0x664758));_0x40f150[_0x2c6c('0x48')]('DROP\x20TABLE\x20'+_0x397fb7+';');}if(hasTZ){_0x40f150[_0x2c6c('0x48')](insertTzCmHopper(_0x1f26ff[_0x2c6c('0x25')],_0x2c6c('0x88'),_0x2c6c('0x56'),_0x2c6c('0x89'),_0x5aae72,tmp_voice_queues));_0x40f150[_0x2c6c('0x48')](insertTzCmHopperBlack(_0x1f26ff['ListId'],_0x2c6c('0x8a'),'voice_queues',_0x2c6c('0x89')));_0x40f150['push'](insertTzCmHopper(_0x1f26ff[_0x2c6c('0x25')],'campaigns_has_cm_lists',_0x2c6c('0x4f'),_0x2c6c('0x8b'),_0x5aae72,tmp_campaigns));_0x40f150[_0x2c6c('0x48')](insertTzCmHopperBlack(_0x1f26ff[_0x2c6c('0x25')],_0x2c6c('0x8c'),_0x2c6c('0x4f'),_0x2c6c('0x8b')));}else{_0x40f150[_0x2c6c('0x48')](insertCmHopper(_0x1f26ff[_0x2c6c('0x25')],_0x2c6c('0x88'),_0x2c6c('0x56'),_0x2c6c('0x89'),_0x5aae72));_0x40f150['push'](insertCmHopperBlack(_0x1f26ff[_0x2c6c('0x25')],_0x2c6c('0x8a'),_0x2c6c('0x56'),_0x2c6c('0x89')));_0x40f150[_0x2c6c('0x48')](insertCmHopper(_0x1f26ff['ListId'],_0x2c6c('0x8d'),_0x2c6c('0x4f'),_0x2c6c('0x8b'),_0x5aae72));_0x40f150[_0x2c6c('0x48')](insertCmHopperBlack(_0x1f26ff[_0x2c6c('0x25')],_0x2c6c('0x8c'),_0x2c6c('0x4f'),'CampaignId'));}_0x40f150[_0x2c6c('0x48')](_0x2c6c('0x8e')+tmp_campaigns+';');_0x40f150['push'](_0x2c6c('0x8e')+tmp_voice_queues+';');BPromise[_0x2c6c('0x8f')](_0x40f150,handleQuery)[_0x2c6c('0x86')](function(_0xaf4999){stats[_0x2c6c('0x90')]=!![];stats[_0x2c6c('0x91')]=_0x1f26ff[_0x2c6c('0x7f')]&&_0x1f26ff[_0x2c6c('0x7f')][_0x2c6c('0x53')]?results[0x2][_0x2c6c('0x91')]:results[0x0]['affectedRows'];socket[_0x2c6c('0x7b')](_0x2c6c('0x92')+_0x18b07,stats);fs[_0x2c6c('0x93')](_0xb16510);fs[_0x2c6c('0x93')](_0x3b9db5);process[_0x2c6c('0x94')](0x0);})['catch'](function(_0x597a60){logger[_0x2c6c('0x45')](_0x597a60['message']);process[_0x2c6c('0x94')](0x1);});});});});}catch(_0x57f4d4){logger[_0x2c6c('0x45')]('complete',_0x57f4d4[_0x2c6c('0x46')]);process['exit'](0x1);}},'error':function(_0x4ff60b,_0x5b3d0b,_0x39aa52,_0x325c89){throw new Error(_0x325c89);}});}function validate(){if(process[_0x2c6c('0x95')]&&process[_0x2c6c('0x95')][_0x2c6c('0x53')]<0x4){throw new Error(_0x2c6c('0x96'));}var _0x1db124=path[_0x2c6c('0x14')](config[_0x2c6c('0x63')],_0x2c6c('0x64'),process[_0x2c6c('0x95')][0x2]);if(!fs['existsSync'](_0x1db124)){throw new Error('file\x20doesn\x27t\x20exists');}var _0x36820b={};try{_0x36820b=JSON['parse'](process['argv'][0x3]);if(!_0x36820b[_0x2c6c('0x62')]){throw new Error(_0x2c6c('0x97'));}if(!_0x36820b['binding'][_0x2c6c('0x12')]){throw new Error(_0x2c6c('0x98'));}if(!_0x36820b[_0x2c6c('0x62')][_0x2c6c('0x77')]){throw new Error('firstName\x20is\x20mandatory');}var _0x134b7e=0x0;if(_0x36820b['binding'][_0x2c6c('0x28')]){_0x134b7e=0x1;}if(!_0x36820b[_0x2c6c('0x25')]){throw new Error('ListId\x20is\x20mandatory');}}catch(_0x5b6651){throw new Error('body\x20id\x20mandatory');}var _0x15bb12=[];try{_0x15bb12=_['map'](JSON[_0x2c6c('0x6a')](process['argv'][0x4]),'id');}catch(_0x58b606){logger[_0x2c6c('0x44')](_0x2c6c('0x99'));}main(_0x1db124,_0x36820b,_0x15bb12,_0x134b7e);}validate();process['on'](_0x2c6c('0x9a'),handleStop);process['on']('uncaughtException',handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index 9161148..f42662b 100644 --- a/server/components/integrations/configuration.js +++ b/server/components/integrations/configuration.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7fcf=['Date','***\x20Agent\x20Info\x20***','Agent\x20Name','destcalleridname','Agent\x20Number','***\x20Time\x20Info\x20***','Agent\x20Ring','Agent\x20Connect','agentconnectAt','Agent\x20Complete','agentcompleteAt','Hold\x20Time','Talk\x20Time','Called\x20Number','membername','starttime','Answer\x20Time','Complete\x20Time','endtime','duration','Billable\x20Time','billableseconds','getSubjects','string','[xCALLY\x20Ticket]','voice','inbound','push','queue','variable','calleridnum','outbound','destcalleridnum','getDescriptions','toLowerCase','***\x20Call\x20Info\x20***','Caller\x20Number','keyValue','Caller\x20Name','Call\x20To','destexten','UniqueId','uniqueid'];(function(_0x46d531,_0x24c3ac){var _0x2c4485=function(_0x5f10fb){while(--_0x5f10fb){_0x46d531['push'](_0x46d531['shift']());}};_0x2c4485(++_0x24c3ac);}(_0x7fcf,0x1c4));var _0xf7fc=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x7fcf[_0x5b644e];return _0x49c6bf;};'use strict';exports[_0xf7fc('0x0')]=function(_0x45d802,_0x11173e){var _0x4276f0=[{'type':_0xf7fc('0x1'),'content':_0xf7fc('0x2'),'variableName':null}];switch(_0x45d802['toLowerCase']()){case _0xf7fc('0x3'):switch(_0x11173e['toLowerCase']()){case _0xf7fc('0x4'):_0x4276f0[_0xf7fc('0x5')]({'type':'variable','content':'','variableName':_0xf7fc('0x6')});_0x4276f0[_0xf7fc('0x5')]({'type':_0xf7fc('0x7'),'content':'','variableName':_0xf7fc('0x8')});break;case _0xf7fc('0x9'):_0x4276f0[_0xf7fc('0x5')]({'type':_0xf7fc('0x1'),'content':'Outbound\x20Call','variableName':null});_0x4276f0[_0xf7fc('0x5')]({'type':_0xf7fc('0x7'),'content':'','variableName':_0xf7fc('0xa')});break;}}return _0x4276f0;};exports[_0xf7fc('0xb')]=function(_0x2135e8,_0x18fb2b){var _0x406bba=[];switch(_0x2135e8['toLowerCase']()){case _0xf7fc('0x3'):switch(_0x18fb2b[_0xf7fc('0xc')]()){case _0xf7fc('0x4'):_0x406bba=[{'type':_0xf7fc('0x1'),'content':_0xf7fc('0xd'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0xf7fc('0xe'),'keyType':_0xf7fc('0x7'),'variableName':'calleridnum'},{'type':_0xf7fc('0xf'),'content':'','key':_0xf7fc('0x10'),'keyType':_0xf7fc('0x7'),'variableName':'calleridname'},{'type':'keyValue','content':'','key':_0xf7fc('0x11'),'keyType':_0xf7fc('0x7'),'variableName':_0xf7fc('0x12')},{'type':_0xf7fc('0xf'),'content':'','key':'Queue','keyType':_0xf7fc('0x7'),'variableName':'queue'},{'type':'keyValue','content':'','key':_0xf7fc('0x13'),'keyType':_0xf7fc('0x7'),'variableName':_0xf7fc('0x14')},{'type':_0xf7fc('0xf'),'content':'','key':_0xf7fc('0x15'),'keyType':_0xf7fc('0x7'),'variableName':'agentcalledAt'},{'type':'string','content':_0xf7fc('0x16'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0xf7fc('0x17'),'keyType':_0xf7fc('0x7'),'variableName':_0xf7fc('0x18')},{'type':_0xf7fc('0xf'),'content':'','key':_0xf7fc('0x19'),'keyType':_0xf7fc('0x7'),'variableName':_0xf7fc('0xa')},{'type':_0xf7fc('0x1'),'content':_0xf7fc('0x1a'),'key':null,'keyType':null,'variableName':null},{'type':_0xf7fc('0xf'),'content':'','key':_0xf7fc('0x1b'),'keyType':_0xf7fc('0x7'),'variableName':'agentcalledAt'},{'type':_0xf7fc('0xf'),'content':'','key':_0xf7fc('0x1c'),'keyType':_0xf7fc('0x7'),'variableName':_0xf7fc('0x1d')},{'type':_0xf7fc('0xf'),'content':'','key':_0xf7fc('0x1e'),'keyType':'variable','variableName':_0xf7fc('0x1f')},{'type':_0xf7fc('0xf'),'content':'','key':_0xf7fc('0x20'),'keyType':_0xf7fc('0x7'),'variableName':'holdtime'},{'type':'keyValue','content':'','key':_0xf7fc('0x21'),'keyType':'variable','variableName':'talktime'}];break;case _0xf7fc('0x9'):_0x406bba=[{'type':'string','content':_0xf7fc('0xd'),'variableName':null},{'type':_0xf7fc('0xf'),'content':'','key':_0xf7fc('0x22'),'keyType':_0xf7fc('0x7'),'keyContent':'','variableName':_0xf7fc('0xa')},{'type':'keyValue','content':'','key':'Member\x20Name','keyType':_0xf7fc('0x7'),'keyContent':'','variableName':_0xf7fc('0x23')},{'type':_0xf7fc('0xf'),'content':'','key':_0xf7fc('0x13'),'keyType':_0xf7fc('0x7'),'keyContent':'','variableName':_0xf7fc('0x14')},{'type':_0xf7fc('0xf'),'content':'','key':'Date','keyType':_0xf7fc('0x7'),'keyContent':'','variableName':_0xf7fc('0x24')},{'type':_0xf7fc('0x1'),'content':_0xf7fc('0x1a')},{'type':_0xf7fc('0xf'),'content':'','key':_0xf7fc('0x25'),'keyType':_0xf7fc('0x7'),'keyContent':'','variableName':'answertime'},{'type':_0xf7fc('0xf'),'content':'','key':_0xf7fc('0x26'),'keyType':'variable','keyContent':'','variableName':_0xf7fc('0x27')},{'type':_0xf7fc('0xf'),'content':'','key':'Duration','keyType':_0xf7fc('0x7'),'keyContent':'','variableName':_0xf7fc('0x28')},{'type':_0xf7fc('0xf'),'content':'','key':_0xf7fc('0x29'),'keyType':_0xf7fc('0x7'),'keyContent':'','variableName':_0xf7fc('0x2a')}];break;}}return _0x406bba;}; \ No newline at end of file +var _0x4a9f=['answertime','duration','Billable\x20Time','getSubjects','string','[xCALLY\x20Ticket]','voice','inbound','variable','push','outbound','destcalleridnum','toLowerCase','***\x20Call\x20Info\x20***','keyValue','Caller\x20Number','calleridnum','calleridname','destexten','Queue','queue','UniqueId','uniqueid','Date','agentcalledAt','Agent\x20Name','destcalleridname','Agent\x20Number','***\x20Time\x20Info\x20***','Agent\x20Complete','agentcompleteAt','Hold\x20Time','holdtime','Talk\x20Time','talktime','Called\x20Number','Member\x20Name','membername','starttime'];(function(_0x198910,_0x1b5e73){var _0x3332f2=function(_0x5685b4){while(--_0x5685b4){_0x198910['push'](_0x198910['shift']());}};_0x3332f2(++_0x1b5e73);}(_0x4a9f,0x9f));var _0xf4a9=function(_0x1f6d51,_0x19033b){_0x1f6d51=_0x1f6d51-0x0;var _0x26bf63=_0x4a9f[_0x1f6d51];return _0x26bf63;};'use strict';exports[_0xf4a9('0x0')]=function(_0x9f775b,_0x158971){var _0x50432a=[{'type':_0xf4a9('0x1'),'content':_0xf4a9('0x2'),'variableName':null}];switch(_0x9f775b['toLowerCase']()){case _0xf4a9('0x3'):switch(_0x158971['toLowerCase']()){case _0xf4a9('0x4'):_0x50432a['push']({'type':_0xf4a9('0x5'),'content':'','variableName':'queue'});_0x50432a[_0xf4a9('0x6')]({'type':_0xf4a9('0x5'),'content':'','variableName':'calleridnum'});break;case _0xf4a9('0x7'):_0x50432a[_0xf4a9('0x6')]({'type':_0xf4a9('0x1'),'content':'Outbound\x20Call','variableName':null});_0x50432a[_0xf4a9('0x6')]({'type':_0xf4a9('0x5'),'content':'','variableName':_0xf4a9('0x8')});break;}}return _0x50432a;};exports['getDescriptions']=function(_0x1dc419,_0x4e0123){var _0x15f8bf=[];switch(_0x1dc419[_0xf4a9('0x9')]()){case _0xf4a9('0x3'):switch(_0x4e0123['toLowerCase']()){case'inbound':_0x15f8bf=[{'type':_0xf4a9('0x1'),'content':_0xf4a9('0xa'),'key':null,'keyType':null,'variableName':null},{'type':_0xf4a9('0xb'),'content':'','key':_0xf4a9('0xc'),'keyType':'variable','variableName':_0xf4a9('0xd')},{'type':_0xf4a9('0xb'),'content':'','key':'Caller\x20Name','keyType':_0xf4a9('0x5'),'variableName':_0xf4a9('0xe')},{'type':_0xf4a9('0xb'),'content':'','key':'Call\x20To','keyType':_0xf4a9('0x5'),'variableName':_0xf4a9('0xf')},{'type':_0xf4a9('0xb'),'content':'','key':_0xf4a9('0x10'),'keyType':_0xf4a9('0x5'),'variableName':_0xf4a9('0x11')},{'type':_0xf4a9('0xb'),'content':'','key':_0xf4a9('0x12'),'keyType':_0xf4a9('0x5'),'variableName':_0xf4a9('0x13')},{'type':_0xf4a9('0xb'),'content':'','key':_0xf4a9('0x14'),'keyType':_0xf4a9('0x5'),'variableName':_0xf4a9('0x15')},{'type':_0xf4a9('0x1'),'content':'***\x20Agent\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0xf4a9('0xb'),'content':'','key':_0xf4a9('0x16'),'keyType':_0xf4a9('0x5'),'variableName':_0xf4a9('0x17')},{'type':_0xf4a9('0xb'),'content':'','key':_0xf4a9('0x18'),'keyType':'variable','variableName':'destcalleridnum'},{'type':'string','content':_0xf4a9('0x19'),'key':null,'keyType':null,'variableName':null},{'type':_0xf4a9('0xb'),'content':'','key':'Agent\x20Ring','keyType':_0xf4a9('0x5'),'variableName':_0xf4a9('0x15')},{'type':'keyValue','content':'','key':'Agent\x20Connect','keyType':_0xf4a9('0x5'),'variableName':'agentconnectAt'},{'type':'keyValue','content':'','key':_0xf4a9('0x1a'),'keyType':_0xf4a9('0x5'),'variableName':_0xf4a9('0x1b')},{'type':'keyValue','content':'','key':_0xf4a9('0x1c'),'keyType':_0xf4a9('0x5'),'variableName':_0xf4a9('0x1d')},{'type':_0xf4a9('0xb'),'content':'','key':_0xf4a9('0x1e'),'keyType':_0xf4a9('0x5'),'variableName':_0xf4a9('0x1f')}];break;case _0xf4a9('0x7'):_0x15f8bf=[{'type':_0xf4a9('0x1'),'content':_0xf4a9('0xa'),'variableName':null},{'type':_0xf4a9('0xb'),'content':'','key':_0xf4a9('0x20'),'keyType':_0xf4a9('0x5'),'keyContent':'','variableName':_0xf4a9('0x8')},{'type':_0xf4a9('0xb'),'content':'','key':_0xf4a9('0x21'),'keyType':_0xf4a9('0x5'),'keyContent':'','variableName':_0xf4a9('0x22')},{'type':_0xf4a9('0xb'),'content':'','key':'UniqueId','keyType':_0xf4a9('0x5'),'keyContent':'','variableName':'uniqueid'},{'type':_0xf4a9('0xb'),'content':'','key':_0xf4a9('0x14'),'keyType':_0xf4a9('0x5'),'keyContent':'','variableName':_0xf4a9('0x23')},{'type':_0xf4a9('0x1'),'content':_0xf4a9('0x19')},{'type':_0xf4a9('0xb'),'content':'','key':'Answer\x20Time','keyType':'variable','keyContent':'','variableName':_0xf4a9('0x24')},{'type':_0xf4a9('0xb'),'content':'','key':'Complete\x20Time','keyType':'variable','keyContent':'','variableName':'endtime'},{'type':_0xf4a9('0xb'),'content':'','key':'Duration','keyType':_0xf4a9('0x5'),'keyContent':'','variableName':_0xf4a9('0x25')},{'type':_0xf4a9('0xb'),'content':'','key':_0xf4a9('0x26'),'keyType':_0xf4a9('0x5'),'keyContent':'','variableName':'billableseconds'}];break;}}return _0x15f8bf;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index 0935efa..1df1d00 100644 --- a/server/components/interaction/service.js +++ b/server/components/interaction/service.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6470=['then','update','info','catch','error','tracked','user','query','omit','body','html','phone','fax','mobile','lodash','../../config/logger','openchannel-interactions','fax-interactions','sms-interactions','chat-interactions','whatsapp-interactions','upperFirst','InteractionId','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','null','Interaction','findOne'];(function(_0x3a9da5,_0x2d940c){var _0x13e52d=function(_0x57b925){while(--_0x57b925){_0x3a9da5['push'](_0x3a9da5['shift']());}};_0x13e52d(++_0x2d940c);}(_0x6470,0x16a));var _0x0647=function(_0x2f2221,_0x5de764){_0x2f2221=_0x2f2221-0x0;var _0x214484=_0x6470[_0x2f2221];return _0x214484;};'use strict';var _=require(_0x0647('0x0'));var db=require('../../mysqldb')['db'];var loggers={'openchannel':require(_0x0647('0x1'))(_0x0647('0x2')),'mail':require('../../config/logger')('mail-interactions'),'fax':require(_0x0647('0x1'))(_0x0647('0x3')),'sms':require(_0x0647('0x1'))(_0x0647('0x4')),'chat':require(_0x0647('0x1'))(_0x0647('0x5')),'whatsapp':require(_0x0647('0x1'))(_0x0647('0x6'))};function getInteractionId(_0x41ac47,_0x445fbc,_0x11b98e){if(_0x41ac47&&_0x41ac47[_[_0x0647('0x7')](_0x11b98e)+_0x0647('0x8')]){return _0x41ac47[_['upperFirst'](_0x11b98e)+_0x0647('0x8')];}else if(_0x41ac47&&_0x41ac47['id']){return _0x41ac47['id'];}else if(_0x445fbc&&_0x445fbc['id']){return _0x445fbc['id'];}else{return'unknown';}}function log(_0x253aea,_0x1389ae,_0x2a52f9,_0x217629,_0x401dbf,_0x46abad){loggers[_0x401dbf['toLowerCase']()][_0x253aea](_0x0647('0x9'),_0x46abad[_0x0647('0xa')](),_0x1389ae?_0x1389ae['id']:null,_0x1389ae?_0x1389ae[_0x0647('0xb')]:null,_0x1389ae?_0x1389ae['role']:null,getInteractionId(_0x2a52f9,_0x217629,_0x401dbf),_0x2a52f9?JSON['stringify'](_0x2a52f9):_0x0647('0xc'));}function updateUser(_0x9bb7bf,_0x250879,_0xbfdffa,_0x25e80e,_0x3c4e32){db[_[_0x0647('0x7')](_0x25e80e)+_0x0647('0xd')][_0x0647('0xe')]({'where':{'id':getInteractionId(_0x250879,_0xbfdffa,_0x25e80e)}})[_0x0647('0xf')](function(_0x521ae0){if(_0x521ae0){return _0x521ae0[_0x0647('0x10')]({'UserId':_0x9bb7bf?_0x9bb7bf['id']:null});}})[_0x0647('0xf')](function(_0x292bc6){if(_0x292bc6){log(_0x0647('0x11'),_0x9bb7bf,_0x250879,_0xbfdffa,_0x25e80e,_0x3c4e32);}})[_0x0647('0x12')](function(){log(_0x0647('0x13'),_0x9bb7bf,_0x250879,_0xbfdffa,_0x25e80e,_0x3c4e32);});}exports[_0x0647('0x14')]=function(_0x34d46e,_0x5808d4){return function(_0x5d9227,_0x58a54b,_0x2830a5){var _0x3933b1=_0x5d9227[_0x0647('0x15')];var _0x230a1b={};var _0x2c7c36=_0x5d9227[_0x0647('0x16')];if(_0x230a1b){_0x230a1b=_['clone'](_0x5d9227['body']);_0x230a1b=_[_0x0647('0x17')](_0x230a1b,[_0x0647('0x18'),_0x0647('0x19'),_0x0647('0x1a'),_0x0647('0x1b'),_0x0647('0x1c')]);}updateUser(_0x3933b1,_0x230a1b,_0x2c7c36,_0x34d46e,_0x5808d4);_0x2830a5(null);};}; \ No newline at end of file +var _0x8a19=['omit','body','html','phone','fax','mobile','lodash','../../mysqldb','../../config/logger','openchannel-interactions','chat-interactions','InteractionId','upperFirst','unknown','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','stringify','null','Interaction','update','error','tracked','user','clone'];(function(_0x1fddc0,_0x3c2ac6){var _0x40dee0=function(_0x70813){while(--_0x70813){_0x1fddc0['push'](_0x1fddc0['shift']());}};_0x40dee0(++_0x3c2ac6);}(_0x8a19,0x1b6));var _0x98a1=function(_0x3e49f9,_0x38ebb2){_0x3e49f9=_0x3e49f9-0x0;var _0x47c64c=_0x8a19[_0x3e49f9];return _0x47c64c;};'use strict';var _=require(_0x98a1('0x0'));var db=require(_0x98a1('0x1'))['db'];var loggers={'openchannel':require(_0x98a1('0x2'))(_0x98a1('0x3')),'mail':require(_0x98a1('0x2'))('mail-interactions'),'fax':require(_0x98a1('0x2'))('fax-interactions'),'sms':require(_0x98a1('0x2'))('sms-interactions'),'chat':require(_0x98a1('0x2'))(_0x98a1('0x4')),'whatsapp':require('../../config/logger')('whatsapp-interactions')};function getInteractionId(_0x188466,_0x444e69,_0x40bd72){if(_0x188466&&_0x188466[_['upperFirst'](_0x40bd72)+_0x98a1('0x5')]){return _0x188466[_[_0x98a1('0x6')](_0x40bd72)+'InteractionId'];}else if(_0x188466&&_0x188466['id']){return _0x188466['id'];}else if(_0x444e69&&_0x444e69['id']){return _0x444e69['id'];}else{return _0x98a1('0x7');}}function log(_0x1b2412,_0x4fd6bb,_0x4f86b6,_0x3cf140,_0x3845b7,_0x537d4a){loggers[_0x3845b7[_0x98a1('0x8')]()][_0x1b2412](_0x98a1('0x9'),_0x537d4a[_0x98a1('0xa')](),_0x4fd6bb?_0x4fd6bb['id']:null,_0x4fd6bb?_0x4fd6bb[_0x98a1('0xb')]:null,_0x4fd6bb?_0x4fd6bb[_0x98a1('0xc')]:null,getInteractionId(_0x4f86b6,_0x3cf140,_0x3845b7),_0x4f86b6?JSON[_0x98a1('0xd')](_0x4f86b6):_0x98a1('0xe'));}function updateUser(_0x5459e3,_0x2c1747,_0x3ea022,_0x54d378,_0x34f973){db[_['upperFirst'](_0x54d378)+_0x98a1('0xf')]['findOne']({'where':{'id':getInteractionId(_0x2c1747,_0x3ea022,_0x54d378)}})['then'](function(_0xa698ec){if(_0xa698ec){return _0xa698ec[_0x98a1('0x10')]({'UserId':_0x5459e3?_0x5459e3['id']:null});}})['then'](function(_0x3def61){if(_0x3def61){log('info',_0x5459e3,_0x2c1747,_0x3ea022,_0x54d378,_0x34f973);}})['catch'](function(){log(_0x98a1('0x11'),_0x5459e3,_0x2c1747,_0x3ea022,_0x54d378,_0x34f973);});}exports[_0x98a1('0x12')]=function(_0xa3cb1c,_0x29e4ce){return function(_0x45fda9,_0x48ffa6,_0x4ff40c){var _0xcec9e7=_0x45fda9[_0x98a1('0x13')];var _0x457a3f={};var _0x236169=_0x45fda9['query'];if(_0x457a3f){_0x457a3f=_[_0x98a1('0x14')](_0x45fda9['body']);_0x457a3f=_[_0x98a1('0x15')](_0x457a3f,[_0x98a1('0x16'),_0x98a1('0x17'),_0x98a1('0x18'),_0x98a1('0x19'),_0x98a1('0x1a')]);}updateUser(_0xcec9e7,_0x457a3f,_0x236169,_0xa3cb1c,_0x29e4ce);_0x4ff40c(null);};}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index 92101ca..9c6196a 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 _0x3515=['split','createDecipher','format','%s:%s:%s','update','base64','utf8','final','parse','hasOwnProperty','use','findOne','then','count','status','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','admin','user','isUserLimit','../../mysqldb','../../config/environment','data1','license'];(function(_0x429013,_0x4f9322){var _0x663606=function(_0x10bbf2){while(--_0x10bbf2){_0x429013['push'](_0x429013['shift']());}};_0x663606(++_0x4f9322);}(_0x3515,0x100));var _0x5351=function(_0x11ff0f,_0x2e8e59){_0x11ff0f=_0x11ff0f-0x0;var _0x31d8e7=_0x3515[_0x11ff0f];return _0x31d8e7;};'use strict';var crypto=require('crypto');var util=require('util');var compose=require('composable-middleware');var db=require(_0x5351('0x0'))['db'];var config=require(_0x5351('0x1'));function getValueFromLicense(_0x3a1129,_0x2b66ae){if(_0x3a1129&&_0x2b66ae){if(_0x2b66ae[_0x5351('0x2')]&&_0x2b66ae[_0x5351('0x3')]){var _0x48fc1e=_0x2b66ae['data1'];var _0x3e7c5a=_0x2b66ae[_0x5351('0x3')];var _0x5c5545=_0x48fc1e[_0x5351('0x4')]('-')[0x4];var _0x3e9198=_0x48fc1e[_0x5351('0x4')]('-')[0x0];var _0x2c37bb=crypto[_0x5351('0x5')]('aes-256-ctr',util[_0x5351('0x6')](_0x5351('0x7'),_0x5c5545,_0x48fc1e,_0x3e9198));var _0x4ea3b7=_0x2c37bb[_0x5351('0x8')](_0x3e7c5a,_0x5351('0x9'),_0x5351('0xa'));_0x4ea3b7+=_0x2c37bb[_0x5351('0xb')](_0x5351('0xa'));var _0x31b7bb=JSON[_0x5351('0xc')](_0x4ea3b7);return _0x31b7bb[_0x5351('0xd')](_0x3a1129)?_0x31b7bb[_0x3a1129]:null;}}return null;}function isLimit(_0x43f7fc,_0x19d432,_0x4d7c66,_0xbfec67){var _0x386f76=_0x19d432;return compose()[_0x5351('0xe')](function(_0x5842e8,_0x57076,_0x105123){return db['License'][_0x5351('0xf')]({'where':{'id':0x1},'raw':!![]})['then'](function(_0x49a61f){var _0x34a6c5=getValueFromLicense(_0x43f7fc,_0x49a61f);return _0x34a6c5?_0x34a6c5:_0x386f76;})[_0x5351('0x10')](function(_0x2f2fef){_0x386f76=_0x2f2fef;return _0x4d7c66[_0x5351('0x11')](_0xbfec67);})[_0x5351('0x10')](function(_0x2cb641){if(_0x2cb641>=_0x386f76){return _0x57076[_0x5351('0x12')](0x193)['json']({'message':util[_0x5351('0x6')](_0x5351('0x13'),_0x43f7fc)});}_0x105123();})[_0x5351('0x14')](function(_0x52ec3b){_0x105123(_0x52ec3b);});});}function isUserLimit(){return isLimit(_0x5351('0x15'),0x1,db[_0x5351('0x16')],{'where':{'$or':[{'role':_0x5351('0x17')},{'role':_0x5351('0x18')}]}});}exports[_0x5351('0x19')]=isUserLimit; \ No newline at end of file +var _0xffeb=['License','then','count','json','format','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','admin','isUserLimit','crypto','util','composable-middleware','../../mysqldb','../../config/environment','license','data1','split','%s:%s:%s','update','utf8','final','hasOwnProperty','use'];(function(_0x525ef9,_0x12b1c2){var _0x5561fb=function(_0xa8ed46){while(--_0xa8ed46){_0x525ef9['push'](_0x525ef9['shift']());}};_0x5561fb(++_0x12b1c2);}(_0xffeb,0x12a));var _0xbffe=function(_0x241b5a,_0x5ac06c){_0x241b5a=_0x241b5a-0x0;var _0x49fff8=_0xffeb[_0x241b5a];return _0x49fff8;};'use strict';var crypto=require(_0xbffe('0x0'));var util=require(_0xbffe('0x1'));var compose=require(_0xbffe('0x2'));var db=require(_0xbffe('0x3'))['db'];var config=require(_0xbffe('0x4'));function getValueFromLicense(_0x5ceaa7,_0x4fd979){if(_0x5ceaa7&&_0x4fd979){if(_0x4fd979['data1']&&_0x4fd979[_0xbffe('0x5')]){var _0x35183b=_0x4fd979[_0xbffe('0x6')];var _0x35bbcf=_0x4fd979[_0xbffe('0x5')];var _0x1d227c=_0x35183b[_0xbffe('0x7')]('-')[0x4];var _0x39c2b7=_0x35183b[_0xbffe('0x7')]('-')[0x0];var _0x59951d=crypto['createDecipher']('aes-256-ctr',util['format'](_0xbffe('0x8'),_0x1d227c,_0x35183b,_0x39c2b7));var _0xca7e7b=_0x59951d[_0xbffe('0x9')](_0x35bbcf,'base64',_0xbffe('0xa'));_0xca7e7b+=_0x59951d[_0xbffe('0xb')]('utf8');var _0x1e5cb4=JSON['parse'](_0xca7e7b);return _0x1e5cb4[_0xbffe('0xc')](_0x5ceaa7)?_0x1e5cb4[_0x5ceaa7]:null;}}return null;}function isLimit(_0x3f1bb4,_0x18e97e,_0x3c2b18,_0x22932e){var _0x4a435e=_0x18e97e;return compose()[_0xbffe('0xd')](function(_0x543160,_0x1bb976,_0x4ab063){return db[_0xbffe('0xe')]['findOne']({'where':{'id':0x1},'raw':!![]})['then'](function(_0x58a89f){var _0x574e16=getValueFromLicense(_0x3f1bb4,_0x58a89f);return _0x574e16?_0x574e16:_0x4a435e;})[_0xbffe('0xf')](function(_0x31b030){_0x4a435e=_0x31b030;return _0x3c2b18[_0xbffe('0x10')](_0x22932e);})[_0xbffe('0xf')](function(_0x1f2e33){if(_0x1f2e33>=_0x4a435e){return _0x1bb976['status'](0x193)[_0xbffe('0x11')]({'message':util[_0xbffe('0x12')](_0xbffe('0x13'),_0x3f1bb4)});}_0x4ab063();})[_0xbffe('0x14')](function(_0x401f9f){_0x4ab063(_0x401f9f);});});}function isUserLimit(){return isLimit(_0xbffe('0x15'),0x1,db['User'],{'where':{'$or':[{'role':_0xbffe('0x16')},{'role':'user'}]}});}exports[_0xbffe('0x17')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index f31f583..728fe70 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 _0x30b4=['days','YYYY-MM-DD','castTo','text','field','\x20AS\x20','$ne','$notIn','\x20IS\x20NULL)','$in','IN\x20?','=\x20?','<>\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','>\x20?','$lte','<=\x20?','$gte','>=\x20?','start','$between','pop','utcOffset','format','hours','minutes','lodash','moment','sqlOperator','startsWith','and','replace','[$and]','split','length','slice','shift','match','forEach','indexOf','map','conditions','push','DATE','operator','$eq','value','includes','$gt','add'];(function(_0x493fbb,_0x220663){var _0x522868=function(_0x41e3aa){while(--_0x41e3aa){_0x493fbb['push'](_0x493fbb['shift']());}};_0x522868(++_0x220663);}(_0x30b4,0x8a));var _0x430b=function(_0x1b0597,_0xeffacc){_0x1b0597=_0x1b0597-0x0;var _0x2b6a2a=_0x30b4[_0x1b0597];return _0x2b6a2a;};'use strict';var _=require(_0x430b('0x0'));var moment=require(_0x430b('0x1'));exports['parseSearch']=function(_0x254d0f){var _0xb17abf={'conditions':[]};_0xb17abf[_0x430b('0x2')]=_[_0x430b('0x3')](_0x254d0f,'[$or]')?'or':_0x430b('0x4');var _0x4a9641=_0x254d0f[_0x430b('0x5')](_0x430b('0x6'),'')[_0x430b('0x5')]('[$or]','')[_0x430b('0x7')]('||');for(var _0x2cbdf5=0x0;_0x2cbdf5<_0x4a9641[_0x430b('0x8')];_0x2cbdf5++){var _0x47bdea=_0x4a9641[_0x2cbdf5][_0x430b('0x7')](':=');var _0x58faa8=_0x47bdea[0x0];var _0x23b8b4=_0x47bdea[_0x430b('0x9')](0x1);_0x23b8b4['forEach'](function(_0x354712){var _0x5585af=_0x354712[_0x430b('0x7')]('[')[_0x430b('0xa')]();var _0x46cbcf=_0x354712[_0x430b('0xb')](/\[(.*?)\]/g);_0x46cbcf[_0x430b('0xc')](function(_0x2cda91){var _0x35db80=_0x2cda91['split']('[')['filter'](function(_0x1b11db){return _0x1b11db[_0x430b('0xd')](']')>-0x1;})[_0x430b('0xe')](function(_0x4e3b9c){return _0x4e3b9c['split'](']')[0x0];})[0x0];_0xb17abf[_0x430b('0xf')][_0x430b('0x10')]({'field':_0x58faa8,'operator':_0x5585af,'value':_0x35db80});});});}return _0xb17abf;};exports['buildExpression']=function(_0x12a063,_0x133e9b,_0x1f581b){var _0x285f0c={};if(_0x133e9b===_0x430b('0x11')){if(_0x1f581b[_0x430b('0x12')]===_0x430b('0x13')){_0x1f581b[_0x430b('0x12')]='$between';_0x1f581b[_0x430b('0x14')]+=','+_0x1f581b[_0x430b('0x14')];}else if(_[_0x430b('0x15')]([_0x430b('0x16'),'$lte'],_0x1f581b[_0x430b('0x12')])){_0x1f581b[_0x430b('0x14')]=moment(_0x1f581b['value'])[_0x430b('0x17')](0x1,_0x430b('0x18'))['format'](_0x430b('0x19'));}}if(_0x1f581b['castTo']){_0x133e9b=_0x1f581b[_0x430b('0x1a')];_0x285f0c[_0x430b('0x1b')]='CAST('+_0x12a063+'.'+_0x1f581b[_0x430b('0x1c')]+_0x430b('0x1d')+_0x1f581b['castTo']+')\x20'+parseOperator(_0x1f581b[_0x430b('0x12')]);}else{_0x285f0c['text']=_0x12a063+'.'+_0x1f581b[_0x430b('0x1c')]+'\x20'+parseOperator(_0x1f581b['operator']);}if(_[_0x430b('0x15')]([_0x430b('0x1e'),_0x430b('0x1f')],_0x1f581b['operator']))_0x285f0c[_0x430b('0x1b')]='('+_0x285f0c[_0x430b('0x1b')]+'\x20OR\x20'+_0x12a063+'.'+_0x1f581b[_0x430b('0x1c')]+_0x430b('0x20');_0x285f0c['value']=parseValue(_0x133e9b,_0x1f581b[_0x430b('0x12')],_0x1f581b[_0x430b('0x14')]);return _0x285f0c;};function parseOperator(_0x1a4e42){var _0x598da8;switch(_0x1a4e42){case _0x430b('0x21'):_0x598da8=_0x430b('0x22');break;case _0x430b('0x1f'):_0x598da8='NOT\x20IN\x20?';break;case _0x430b('0x13'):_0x598da8=_0x430b('0x23');break;case _0x430b('0x1e'):_0x598da8=_0x430b('0x24');break;case _0x430b('0x25'):case _0x430b('0x26'):case _0x430b('0x27'):_0x598da8=_0x430b('0x28');break;case _0x430b('0x29'):_0x598da8='<\x20?';break;case _0x430b('0x16'):_0x598da8=_0x430b('0x2a');break;case _0x430b('0x2b'):_0x598da8=_0x430b('0x2c');break;case _0x430b('0x2d'):_0x598da8=_0x430b('0x2e');break;case'$between':_0x598da8='BETWEEN\x20?\x20AND\x20?';break;}return _0x598da8;}function parseValue(_0x56a686,_0x5756bd,_0x42b26a){var _0x9589bc={'start':undefined,'end':undefined};switch(_0x5756bd){case _0x430b('0x21'):case _0x430b('0x1f'):_0x9589bc['start']=_0x42b26a[_0x430b('0x7')](',');break;case _0x430b('0x25'):_0x9589bc[_0x430b('0x2f')]='%'+_0x42b26a+'%';break;case _0x430b('0x26'):_0x9589bc[_0x430b('0x2f')]=_0x42b26a+'%';break;case'$endsWith':_0x9589bc['start']='%'+_0x42b26a;break;case _0x430b('0x30'):var _0x1782d=_0x42b26a[_0x430b('0x7')](',');var _0x42b26a=_0x1782d[_0x430b('0xa')]();var _0x2cbe1c=_0x1782d[_0x430b('0x31')]();if(_0x56a686==='DATE'){_0x42b26a=moment(_0x42b26a)[_0x430b('0x32')](0x0,!![])[_0x430b('0x33')]();_0x2cbe1c=moment(_0x2cbe1c)[_0x430b('0x32')](0x0,!![])[_0x430b('0x17')](0x17,_0x430b('0x34'))['add'](0x3b,_0x430b('0x35'))[_0x430b('0x17')](0x3b,'seconds')[_0x430b('0x33')]();}_0x9589bc={'start':_0x42b26a,'end':_0x2cbe1c};break;default:_0x9589bc[_0x430b('0x2f')]=_0x42b26a;break;}return _0x9589bc;} \ No newline at end of file +var _0x882c=['DATE','operator','$between','value','includes','$lte','add','days','format','YYYY-MM-DD','castTo','field','\x20AS\x20','$ne','$notIn','text','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','$eq','<>\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','$gt','>\x20?','<=\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','shift','utcOffset','hours','minutes','seconds','lodash','parseSearch','[$or]','and','replace','split','slice','forEach','match','filter','indexOf','map','conditions','buildExpression'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x882c,0x130));var _0xc882=function(_0x3acee8,_0x5f3924){_0x3acee8=_0x3acee8-0x0;var _0x5046cc=_0x882c[_0x3acee8];return _0x5046cc;};'use strict';var _=require(_0xc882('0x0'));var moment=require('moment');exports[_0xc882('0x1')]=function(_0x1707e1){var _0x25a62f={'conditions':[]};_0x25a62f['sqlOperator']=_['startsWith'](_0x1707e1,_0xc882('0x2'))?'or':_0xc882('0x3');var _0x3dc527=_0x1707e1[_0xc882('0x4')]('[$and]','')[_0xc882('0x4')](_0xc882('0x2'),'')[_0xc882('0x5')]('||');for(var _0x578d77=0x0;_0x578d77<_0x3dc527['length'];_0x578d77++){var _0x564a06=_0x3dc527[_0x578d77][_0xc882('0x5')](':=');var _0x3f9227=_0x564a06[0x0];var _0x2a2bd4=_0x564a06[_0xc882('0x6')](0x1);_0x2a2bd4[_0xc882('0x7')](function(_0x5805e8){var _0x141474=_0x5805e8[_0xc882('0x5')]('[')['shift']();var _0x3e30d0=_0x5805e8[_0xc882('0x8')](/\[(.*?)\]/g);_0x3e30d0['forEach'](function(_0x213427){var _0x51e072=_0x213427['split']('[')[_0xc882('0x9')](function(_0x36b989){return _0x36b989[_0xc882('0xa')](']')>-0x1;})[_0xc882('0xb')](function(_0x3644f1){return _0x3644f1[_0xc882('0x5')](']')[0x0];})[0x0];_0x25a62f[_0xc882('0xc')]['push']({'field':_0x3f9227,'operator':_0x141474,'value':_0x51e072});});});}return _0x25a62f;};exports[_0xc882('0xd')]=function(_0x252bae,_0x10cf67,_0x4263db){var _0x16e41f={};if(_0x10cf67===_0xc882('0xe')){if(_0x4263db[_0xc882('0xf')]==='$eq'){_0x4263db[_0xc882('0xf')]=_0xc882('0x10');_0x4263db['value']+=','+_0x4263db[_0xc882('0x11')];}else if(_[_0xc882('0x12')](['$gt',_0xc882('0x13')],_0x4263db[_0xc882('0xf')])){_0x4263db['value']=moment(_0x4263db[_0xc882('0x11')])[_0xc882('0x14')](0x1,_0xc882('0x15'))[_0xc882('0x16')](_0xc882('0x17'));}}if(_0x4263db[_0xc882('0x18')]){_0x10cf67=_0x4263db[_0xc882('0x18')];_0x16e41f['text']='CAST('+_0x252bae+'.'+_0x4263db[_0xc882('0x19')]+_0xc882('0x1a')+_0x4263db[_0xc882('0x18')]+')\x20'+parseOperator(_0x4263db[_0xc882('0xf')]);}else{_0x16e41f['text']=_0x252bae+'.'+_0x4263db[_0xc882('0x19')]+'\x20'+parseOperator(_0x4263db[_0xc882('0xf')]);}if(_['includes']([_0xc882('0x1b'),_0xc882('0x1c')],_0x4263db[_0xc882('0xf')]))_0x16e41f[_0xc882('0x1d')]='('+_0x16e41f[_0xc882('0x1d')]+_0xc882('0x1e')+_0x252bae+'.'+_0x4263db[_0xc882('0x19')]+_0xc882('0x1f');_0x16e41f[_0xc882('0x11')]=parseValue(_0x10cf67,_0x4263db[_0xc882('0xf')],_0x4263db['value']);return _0x16e41f;};function parseOperator(_0x5e5297){var _0x4d9a31;switch(_0x5e5297){case _0xc882('0x20'):_0x4d9a31=_0xc882('0x21');break;case _0xc882('0x1c'):_0x4d9a31='NOT\x20IN\x20?';break;case _0xc882('0x22'):_0x4d9a31='=\x20?';break;case _0xc882('0x1b'):_0x4d9a31=_0xc882('0x23');break;case _0xc882('0x24'):case _0xc882('0x25'):case _0xc882('0x26'):_0x4d9a31=_0xc882('0x27');break;case _0xc882('0x28'):_0x4d9a31='<\x20?';break;case _0xc882('0x29'):_0x4d9a31=_0xc882('0x2a');break;case _0xc882('0x13'):_0x4d9a31=_0xc882('0x2b');break;case _0xc882('0x2c'):_0x4d9a31=_0xc882('0x2d');break;case'$between':_0x4d9a31=_0xc882('0x2e');break;}return _0x4d9a31;}function parseValue(_0x4e0acb,_0x555d4a,_0x23ccc2){var _0x320ae4={'start':undefined,'end':undefined};switch(_0x555d4a){case _0xc882('0x20'):case _0xc882('0x1c'):_0x320ae4[_0xc882('0x2f')]=_0x23ccc2[_0xc882('0x5')](',');break;case'$substring':_0x320ae4[_0xc882('0x2f')]='%'+_0x23ccc2+'%';break;case _0xc882('0x25'):_0x320ae4['start']=_0x23ccc2+'%';break;case _0xc882('0x26'):_0x320ae4[_0xc882('0x2f')]='%'+_0x23ccc2;break;case'$between':var _0x177275=_0x23ccc2['split'](',');var _0x23ccc2=_0x177275[_0xc882('0x30')]();var _0x59eb14=_0x177275['pop']();if(_0x4e0acb===_0xc882('0xe')){_0x23ccc2=moment(_0x23ccc2)['utcOffset'](0x0,!![])[_0xc882('0x16')]();_0x59eb14=moment(_0x59eb14)[_0xc882('0x31')](0x0,!![])['add'](0x17,_0xc882('0x32'))['add'](0x3b,_0xc882('0x33'))['add'](0x3b,_0xc882('0x34'))[_0xc882('0x16')]();}_0x320ae4={'start':_0x23ccc2,'end':_0x59eb14};break;default:_0x320ae4[_0xc882('0x2f')]=_0x23ccc2;break;}return _0x320ae4;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 65840d2..d91131a 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 _0x7bae=['omit','isObject','isString','length','unset','match','^[+]?[0-9]*$','getFullTextValue','replace','getOptions','query','$id','model','name','filters','intersection','attributes','hasOwnProperty','nolimit','order','where','pick','filter','object','columns','merge','type','VIRTUAL','lower','options','moment','keys','includes','parse','fields','split','isEmpty','forOwn','find','DATE','$gte','format','YYYY-MM-DD','$lte','subtract','isArray','limit','offset','sort','map','indexOf','priority','col','unsigned','substr','DESC','cast'];(function(_0x46f9fc,_0x30b951){var _0x4eca28=function(_0x3d70e9){while(--_0x3d70e9){_0x46f9fc['push'](_0x46f9fc['shift']());}};_0x4eca28(++_0x30b951);}(_0x7bae,0x13b));var _0xe7ba=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0x7bae[_0x5f09c5];return _0x426ad9;};'use strict';var _=require('lodash');var sequelize=require('sequelize');var moment=require(_0xe7ba('0x0'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x1e05c4){var _0x503803=['ne'];try{var _0x3963c7=JSON['parse'](_0x1e05c4);var _0x120efa=Object[_0xe7ba('0x1')](_0x3963c7)[0x0];return _0x503803[_0xe7ba('0x2')](_0x120efa);}catch(_0x2276df){return![];}}function getOperatorValue(_0x398a6a){var _0xfd3a22=JSON[_0xe7ba('0x3')](_0x398a6a);var _0x3c5e59=Object[_0xe7ba('0x1')](_0xfd3a22)[0x0];var _0x34fb18=_0xfd3a22[_0x3c5e59];return{['$'+_0x3c5e59]:_0x34fb18};}exports[_0xe7ba('0x4')]=function(_0x27b1d5){var _0x41c39d=null;if(_0x27b1d5){_0x41c39d=_0x27b1d5[_0xe7ba('0x5')](',');}return _0x41c39d;};exports['filters']=function(_0x3df8bf,_0xe57e33){var _0x375ebb={};if(!_[_0xe7ba('0x6')](_0x3df8bf)){_[_0xe7ba('0x7')](_0x3df8bf,function(_0x1672f0,_0x99a86f){try{if(_0xe57e33){var _0x448bcc=_[_0xe7ba('0x8')](_0xe57e33,{'name':_0x99a86f})||{};if(hasSequelizeOperator(_0x1672f0)){_0x375ebb[_0x99a86f]=getOperatorValue(_0x1672f0);}else if(_0x448bcc['type']===_0xe7ba('0x9')&&_['isPlainObject'](_0x1672f0)){var _0x602b1=JSON[_0xe7ba('0x3')](_0x1672f0);var _0x390596={'$gte':moment(moment(_0x602b1[_0xe7ba('0xa')])[_0xe7ba('0xb')](_0xe7ba('0xc')))['utc']()['format'](),'$lte':moment(moment(_0x602b1[_0xe7ba('0xd')])[_0xe7ba('0xb')](_0xe7ba('0xc')))['utc']()[_0xe7ba('0xe')](0x1,'s')['format']()};_0x375ebb[_0x99a86f]=_0x390596;}else if(_0x448bcc['name']==='uniqueid'){_0x375ebb[_0x99a86f]=_0x1672f0;}else{_0x375ebb[_0x99a86f]=_[_0xe7ba('0xf')](_0x1672f0)?_0x1672f0:JSON['parse'](_0x1672f0);}}else{_0x375ebb[_0x99a86f]=_[_0xe7ba('0xf')](_0x1672f0)?_0x1672f0:JSON['parse'](_0x1672f0);}}catch(_0x4e3021){_0x375ebb[_0x99a86f]=_0x1672f0['split'](',');}});}return _0x375ebb;};exports[_0xe7ba('0x10')]=function(_0x30086c){_0x30086c=parseInt(_0x30086c,0xa);if(!_0x30086c||_0x30086c<0x0){_0x30086c=LIMIT_VALUE;}return _0x30086c;};exports[_0xe7ba('0x11')]=function(_0x3c06c3){_0x3c06c3=parseInt(_0x3c06c3,0xa);if(!_0x3c06c3||_0x3c06c3<0x0){_0x3c06c3=0x0;}return _0x3c06c3;};exports[_0xe7ba('0x12')]=function(_0x58550c){var _0x149c62,_0x20c653=null;if(_0x58550c){_0x149c62=_0x58550c[_0xe7ba('0x5')](',');_0x20c653=_[_0xe7ba('0x13')](_0x149c62,function(_0x4aaf35){if(_0x4aaf35[_0xe7ba('0x14')]('-')===0x0){return[_0x4aaf35===_0xe7ba('0x15')?sequelize['cast'](sequelize[_0xe7ba('0x16')](_0xe7ba('0x15')),_0xe7ba('0x17')):_0x4aaf35[_0xe7ba('0x18')](0x1),_0xe7ba('0x19')];}else{return[_0x4aaf35===_0xe7ba('0x15')?sequelize[_0xe7ba('0x1a')](sequelize[_0xe7ba('0x16')](_0xe7ba('0x15')),_0xe7ba('0x17')):_0x4aaf35,'ASC'];}});}return _0x20c653;};exports['omit']=function(_0x4dcc7b,_0x4cd124){if(_[_0xe7ba('0x6')](_0x4dcc7b)){return _0x4dcc7b;}if(_['isArray'](_0x4dcc7b)){for(var _0x4ecc0d=0x0;_0x4ecc0d<_0x4dcc7b['length'];_0x4ecc0d+=0x1){_0x4dcc7b[_0x4ecc0d]=this[_0xe7ba('0x1b')](_0x4dcc7b[_0x4ecc0d],_0x4cd124);}return _0x4dcc7b;}if(!_[_0xe7ba('0x1c')](_0x4dcc7b)){return _0x4dcc7b;}if(_[_0xe7ba('0x1d')](_0x4cd124)){_0x4cd124=[_0x4cd124];}if(!_[_0xe7ba('0xf')](_0x4cd124)){return _0x4dcc7b;}for(var _0x3435c6=0x0;_0x3435c6<_0x4cd124[_0xe7ba('0x1e')];_0x3435c6+=0x1){_[_0xe7ba('0x1f')](_0x4dcc7b,_0x4cd124[_0x3435c6]);}for(var _0x3a59d6 in _0x4dcc7b){if(_0x4dcc7b['hasOwnProperty'](_0x3a59d6)){_0x4dcc7b[_0x3a59d6]=this[_0xe7ba('0x1b')](_0x4dcc7b[_0x3a59d6],_0x4cd124);}}return _0x4dcc7b;};exports['isNumeric']=function(_0x102925){return _0x102925[_0xe7ba('0x20')](RegExp(_0xe7ba('0x21')))?!![]:![];};exports['isEmail']=function(_0x587c7d){return _0x587c7d[_0xe7ba('0x20')](/^\S+@\S+$/)?!![]:![];};exports[_0xe7ba('0x22')]=function(_0x8d5020){var _0x20b6cd=[];_0x8d5020[_0xe7ba('0x5')](/[ ,]+/)['forEach'](function(_0x37911d){_0x37911d=_0x37911d[_0xe7ba('0x23')](/([^:]")"+/g,'$1');_0x37911d='+'+_0x37911d+'*';var _0x5b5ff3=/[ `!@#$%^&*()_\-?~]/;if(_0x37911d[_0xe7ba('0x20')](_0x5b5ff3))_0x37911d='\x22'+_0x37911d+'\x22';_0x20b6cd['push'](_0x37911d);});return _0x20b6cd['join']('\x20');};exports[_0xe7ba('0x24')]=function(_0x134f21,_0x1be947,_0x52f90e){var _0x3b14b4={},_0x4ccdc7={};if(_0x1be947[_0xe7ba('0x25')][_0xe7ba('0x26')]){_0x1be947[_0xe7ba('0x25')]['id']=_0x1be947[_0xe7ba('0x25')][_0xe7ba('0x26')];delete _0x1be947['query'][_0xe7ba('0x26')];}_0x3b14b4[_0xe7ba('0x27')]=_['map'](_0x134f21,_0xe7ba('0x28'));_0x3b14b4[_0xe7ba('0x25')]=_[_0xe7ba('0x1')](_0x1be947['query']);_0x3b14b4[_0xe7ba('0x29')]=_[_0xe7ba('0x2a')](_0x3b14b4['model'],_0x3b14b4[_0xe7ba('0x25')]);_0x4ccdc7[_0xe7ba('0x2b')]=_[_0xe7ba('0x2a')](_0x3b14b4['model'],this[_0xe7ba('0x4')](_0x1be947[_0xe7ba('0x25')]['fields']));_0x4ccdc7[_0xe7ba('0x2b')]=_0x4ccdc7[_0xe7ba('0x2b')][_0xe7ba('0x1e')]?_0x4ccdc7['attributes']:_0x3b14b4['model'];if(!_0x1be947[_0xe7ba('0x25')][_0xe7ba('0x2c')](_0xe7ba('0x2d'))){_0x4ccdc7[_0xe7ba('0x10')]=this[_0xe7ba('0x10')](_0x1be947['query'][_0xe7ba('0x10')]);_0x4ccdc7[_0xe7ba('0x11')]=this[_0xe7ba('0x11')](_0x1be947[_0xe7ba('0x25')]['offset']);}_0x4ccdc7[_0xe7ba('0x2e')]=this[_0xe7ba('0x12')](_0x1be947[_0xe7ba('0x25')][_0xe7ba('0x12')]);_0x4ccdc7[_0xe7ba('0x2f')]=this[_0xe7ba('0x29')](_[_0xe7ba('0x30')](_0x1be947['query'],_0x3b14b4[_0xe7ba('0x29')]),_0x134f21);if(_0x1be947[_0xe7ba('0x25')][_0xe7ba('0x31')]){var _0x401b0a=_0x134f21;var _0xf61205=_0x1be947[_0xe7ba('0x25')][_0xe7ba('0x31')];if(typeof _0xf61205===_0xe7ba('0x32')){_0x401b0a=_[_0xe7ba('0x31')](_0x134f21,function(_0x50792c){return _[_0xe7ba('0x2')](_0xf61205[_0xe7ba('0x33')],_0x50792c['name']);});_0xf61205=_0xf61205['value'];}_0x4ccdc7[_0xe7ba('0x2f')]=_[_0xe7ba('0x34')](_0x4ccdc7[_0xe7ba('0x2f')],{'$or':_['map'](_0x401b0a,function(_0x249e1d){if(_0x249e1d[_0xe7ba('0x35')]!==_0xe7ba('0x36')){if(_0x52f90e){return sequelize[_0xe7ba('0x2f')](sequelize['fn'](_0xe7ba('0x37'),sequelize['col'](_0x249e1d[_0xe7ba('0x28')])),{'$like':sequelize['fn']('lower','%'+_0x1be947[_0xe7ba('0x25')][_0xe7ba('0x31')]+'%')});}else{var _0xe0f1c3={};_0xe0f1c3[_0x249e1d[_0xe7ba('0x28')]]={'$like':'%'+_0x1be947[_0xe7ba('0x25')][_0xe7ba('0x31')]+'%'};return _0xe0f1c3;}}})});}_0x4ccdc7=_[_0xe7ba('0x34')]({},_0x4ccdc7,_0x1be947[_0xe7ba('0x38')]);return _0x4ccdc7;}; \ No newline at end of file +var _0x5334=['value','merge','lower','options','lodash','sequelize','moment','parse','keys','includes','fields','split','filters','isEmpty','forOwn','find','DATE','isPlainObject','$gte','format','YYYY-MM-DD','utc','$lte','subtract','name','uniqueid','isArray','sort','map','indexOf','priority','cast','col','unsigned','substr','DESC','omit','length','isObject','isString','hasOwnProperty','isNumeric','match','^[+]?[0-9]*$','isEmail','getFullTextValue','forEach','replace','push','getOptions','query','$id','model','intersection','attributes','nolimit','limit','offset','order','where','pick','filter','object','columns'];(function(_0x2ad8fa,_0x43bbd0){var _0x51e2d5=function(_0x3504fc){while(--_0x3504fc){_0x2ad8fa['push'](_0x2ad8fa['shift']());}};_0x51e2d5(++_0x43bbd0);}(_0x5334,0x84));var _0x4533=function(_0x5944f3,_0x36a7fb){_0x5944f3=_0x5944f3-0x0;var _0x2a3bd4=_0x5334[_0x5944f3];return _0x2a3bd4;};'use strict';var _=require(_0x4533('0x0'));var sequelize=require(_0x4533('0x1'));var moment=require(_0x4533('0x2'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x35fb80){var _0x39af56=['ne'];try{var _0x52b768=JSON[_0x4533('0x3')](_0x35fb80);var _0x5176b5=Object[_0x4533('0x4')](_0x52b768)[0x0];return _0x39af56[_0x4533('0x5')](_0x5176b5);}catch(_0x5cbca4){return![];}}function getOperatorValue(_0x4a576a){var _0x51b4ce=JSON[_0x4533('0x3')](_0x4a576a);var _0x4dea06=Object['keys'](_0x51b4ce)[0x0];var _0x487906=_0x51b4ce[_0x4dea06];return{['$'+_0x4dea06]:_0x487906};}exports[_0x4533('0x6')]=function(_0x42f94b){var _0x300877=null;if(_0x42f94b){_0x300877=_0x42f94b[_0x4533('0x7')](',');}return _0x300877;};exports[_0x4533('0x8')]=function(_0x21b22f,_0xd417){var _0x4fdbda={};if(!_[_0x4533('0x9')](_0x21b22f)){_[_0x4533('0xa')](_0x21b22f,function(_0x1b52ee,_0x12131a){try{if(_0xd417){var _0x5465bf=_[_0x4533('0xb')](_0xd417,{'name':_0x12131a})||{};if(hasSequelizeOperator(_0x1b52ee)){_0x4fdbda[_0x12131a]=getOperatorValue(_0x1b52ee);}else if(_0x5465bf['type']===_0x4533('0xc')&&_[_0x4533('0xd')](_0x1b52ee)){var _0x45ba67=JSON[_0x4533('0x3')](_0x1b52ee);var _0x57ff74={'$gte':moment(moment(_0x45ba67[_0x4533('0xe')])[_0x4533('0xf')](_0x4533('0x10')))[_0x4533('0x11')]()['format'](),'$lte':moment(moment(_0x45ba67[_0x4533('0x12')])['format']('YYYY-MM-DD'))[_0x4533('0x11')]()[_0x4533('0x13')](0x1,'s')['format']()};_0x4fdbda[_0x12131a]=_0x57ff74;}else if(_0x5465bf[_0x4533('0x14')]===_0x4533('0x15')){_0x4fdbda[_0x12131a]=_0x1b52ee;}else{_0x4fdbda[_0x12131a]=_[_0x4533('0x16')](_0x1b52ee)?_0x1b52ee:JSON['parse'](_0x1b52ee);}}else{_0x4fdbda[_0x12131a]=_[_0x4533('0x16')](_0x1b52ee)?_0x1b52ee:JSON['parse'](_0x1b52ee);}}catch(_0x3ddb36){_0x4fdbda[_0x12131a]=_0x1b52ee[_0x4533('0x7')](',');}});}return _0x4fdbda;};exports['limit']=function(_0xd10c6a){_0xd10c6a=parseInt(_0xd10c6a,0xa);if(!_0xd10c6a||_0xd10c6a<0x0){_0xd10c6a=LIMIT_VALUE;}return _0xd10c6a;};exports['offset']=function(_0x5c2c9c){_0x5c2c9c=parseInt(_0x5c2c9c,0xa);if(!_0x5c2c9c||_0x5c2c9c<0x0){_0x5c2c9c=0x0;}return _0x5c2c9c;};exports[_0x4533('0x17')]=function(_0x9740a6){var _0x49fb91,_0x53fe43=null;if(_0x9740a6){_0x49fb91=_0x9740a6[_0x4533('0x7')](',');_0x53fe43=_[_0x4533('0x18')](_0x49fb91,function(_0x3467ba){if(_0x3467ba[_0x4533('0x19')]('-')===0x0){return[_0x3467ba===_0x4533('0x1a')?sequelize[_0x4533('0x1b')](sequelize[_0x4533('0x1c')]('priority'),_0x4533('0x1d')):_0x3467ba[_0x4533('0x1e')](0x1),_0x4533('0x1f')];}else{return[_0x3467ba==='priority'?sequelize['cast'](sequelize[_0x4533('0x1c')](_0x4533('0x1a')),'unsigned'):_0x3467ba,'ASC'];}});}return _0x53fe43;};exports[_0x4533('0x20')]=function(_0x1fa8be,_0xfd9409){if(_['isEmpty'](_0x1fa8be)){return _0x1fa8be;}if(_[_0x4533('0x16')](_0x1fa8be)){for(var _0x39b261=0x0;_0x39b261<_0x1fa8be[_0x4533('0x21')];_0x39b261+=0x1){_0x1fa8be[_0x39b261]=this[_0x4533('0x20')](_0x1fa8be[_0x39b261],_0xfd9409);}return _0x1fa8be;}if(!_[_0x4533('0x22')](_0x1fa8be)){return _0x1fa8be;}if(_[_0x4533('0x23')](_0xfd9409)){_0xfd9409=[_0xfd9409];}if(!_[_0x4533('0x16')](_0xfd9409)){return _0x1fa8be;}for(var _0x27b653=0x0;_0x27b653<_0xfd9409[_0x4533('0x21')];_0x27b653+=0x1){_['unset'](_0x1fa8be,_0xfd9409[_0x27b653]);}for(var _0x5c1e24 in _0x1fa8be){if(_0x1fa8be[_0x4533('0x24')](_0x5c1e24)){_0x1fa8be[_0x5c1e24]=this['omit'](_0x1fa8be[_0x5c1e24],_0xfd9409);}}return _0x1fa8be;};exports[_0x4533('0x25')]=function(_0x4e2b80){return _0x4e2b80[_0x4533('0x26')](RegExp(_0x4533('0x27')))?!![]:![];};exports[_0x4533('0x28')]=function(_0x4300c1){return _0x4300c1[_0x4533('0x26')](/^\S+@\S+$/)?!![]:![];};exports[_0x4533('0x29')]=function(_0xe584a2){var _0xa58dd1=[];_0xe584a2[_0x4533('0x7')](/[ ,]+/)[_0x4533('0x2a')](function(_0x728791){_0x728791=_0x728791[_0x4533('0x2b')](/([^:]")"+/g,'$1');_0x728791='+'+_0x728791+'*';var _0x7fc887=/[ `!@#$%^&*()_\-?~]/;if(_0x728791['match'](_0x7fc887))_0x728791='\x22'+_0x728791+'\x22';_0xa58dd1[_0x4533('0x2c')](_0x728791);});return _0xa58dd1['join']('\x20');};exports[_0x4533('0x2d')]=function(_0x3f7720,_0xb7f0b1,_0x3b89f0){var _0x24acf5={},_0x6d58aa={};if(_0xb7f0b1[_0x4533('0x2e')][_0x4533('0x2f')]){_0xb7f0b1[_0x4533('0x2e')]['id']=_0xb7f0b1[_0x4533('0x2e')][_0x4533('0x2f')];delete _0xb7f0b1[_0x4533('0x2e')]['$id'];}_0x24acf5[_0x4533('0x30')]=_[_0x4533('0x18')](_0x3f7720,_0x4533('0x14'));_0x24acf5[_0x4533('0x2e')]=_[_0x4533('0x4')](_0xb7f0b1['query']);_0x24acf5[_0x4533('0x8')]=_[_0x4533('0x31')](_0x24acf5[_0x4533('0x30')],_0x24acf5[_0x4533('0x2e')]);_0x6d58aa[_0x4533('0x32')]=_[_0x4533('0x31')](_0x24acf5['model'],this[_0x4533('0x6')](_0xb7f0b1[_0x4533('0x2e')]['fields']));_0x6d58aa[_0x4533('0x32')]=_0x6d58aa[_0x4533('0x32')][_0x4533('0x21')]?_0x6d58aa[_0x4533('0x32')]:_0x24acf5[_0x4533('0x30')];if(!_0xb7f0b1[_0x4533('0x2e')][_0x4533('0x24')](_0x4533('0x33'))){_0x6d58aa[_0x4533('0x34')]=this[_0x4533('0x34')](_0xb7f0b1['query'][_0x4533('0x34')]);_0x6d58aa[_0x4533('0x35')]=this[_0x4533('0x35')](_0xb7f0b1[_0x4533('0x2e')][_0x4533('0x35')]);}_0x6d58aa[_0x4533('0x36')]=this[_0x4533('0x17')](_0xb7f0b1[_0x4533('0x2e')][_0x4533('0x17')]);_0x6d58aa[_0x4533('0x37')]=this[_0x4533('0x8')](_[_0x4533('0x38')](_0xb7f0b1['query'],_0x24acf5['filters']),_0x3f7720);if(_0xb7f0b1[_0x4533('0x2e')]['filter']){var _0x4260e6=_0x3f7720;var _0x97aa9e=_0xb7f0b1[_0x4533('0x2e')][_0x4533('0x39')];if(typeof _0x97aa9e===_0x4533('0x3a')){_0x4260e6=_[_0x4533('0x39')](_0x3f7720,function(_0x2df795){return _[_0x4533('0x5')](_0x97aa9e[_0x4533('0x3b')],_0x2df795[_0x4533('0x14')]);});_0x97aa9e=_0x97aa9e[_0x4533('0x3c')];}_0x6d58aa[_0x4533('0x37')]=_[_0x4533('0x3d')](_0x6d58aa['where'],{'$or':_[_0x4533('0x18')](_0x4260e6,function(_0x556dd9){if(_0x556dd9['type']!=='VIRTUAL'){if(_0x3b89f0){return sequelize['where'](sequelize['fn'](_0x4533('0x3e'),sequelize[_0x4533('0x1c')](_0x556dd9[_0x4533('0x14')])),{'$like':sequelize['fn'](_0x4533('0x3e'),'%'+_0xb7f0b1['query'][_0x4533('0x39')]+'%')});}else{var _0x369284={};_0x369284[_0x556dd9[_0x4533('0x14')]]={'$like':'%'+_0xb7f0b1[_0x4533('0x2e')][_0x4533('0x39')]+'%'};return _0x369284;}}})});}_0x6d58aa=_[_0x4533('0x3d')]({},_0x6d58aa,_0xb7f0b1[_0x4533('0x3f')]);return _0x6d58aa;}; \ No newline at end of file diff --git a/server/config/environment/development.js b/server/config/environment/development.js index 0e0283b..d5e896a 100644 --- a/server/config/environment/development.js +++ b/server/config/environment/development.js @@ -11,9 +11,9 @@ module.exports = { sequelize: { database: 'motion2', username: 'xcall', - password: 'Zh3r)S~{2sNfLS@59mq>K>LLGZA{w*./', + password: 'xC@LL1234', options: { - host: '192.168.1.102', + host: '127.0.0.1', port: 3306, dialect: 'mysql', dialectOptions: { @@ -30,9 +30,9 @@ module.exports = { sequelizeHistory: { database: 'motion2', username: 'xcall', - password: 'Zh3r)S~{2sNfLS@59mq>K>LLGZA{w*./', + password: 'xC@LL1234', options: { - host: '192.168.1.102', + host: '127.0.0.1', port: 3306, dialect: 'mysql', dialectOptions: { @@ -47,9 +47,9 @@ module.exports = { } }, asterisk: { - ip: '192.168.1.102', + ip: '127.0.0.1', port: '5038', - username: 'xcalldev', + username: 'xcall', password: 'xcall1234' }, redis: { @@ -86,6 +86,5 @@ module.exports = { baseDN: process.env.AD_BASEDN || '', url: process.env.AD_URL, domain: process.env.AD_DOMAIN - }, - licenseToken: 'bb4dd06b-6faf-5595-0a6c-27cbc9946862' + } }; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 431bbf9..afd28d1 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['get','production','set','appPath','public','join','root','client','use','toISOString','split','static','views','/server/views','engine','html','ejs','urlencoded','50mb','json','initialize','express','method-override','cookie-parser','passport','./environment','default'];(function(_0xfca0bf,_0x8ac9f9){var _0xc72568=function(_0x4b4a90){while(--_0x4b4a90){_0xfca0bf['push'](_0xfca0bf['shift']());}};_0xc72568(++_0x8ac9f9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xa9e0[_0x3e112d];return _0x531c31;};'use strict';var express=require(_0x0a9e('0x0'));var methodOverride=require(_0x0a9e('0x1'));var cookieParser=require(_0x0a9e('0x2'));var errorHandler=require('errorhandler');var path=require('path');var passport=require(_0x0a9e('0x3'));var cors=require('cors');var config=require(_0x0a9e('0x4'));exports[_0x0a9e('0x5')]=function(_0x2ab90b){var _0x991246=_0x2ab90b[_0x0a9e('0x6')]('env');if(_0x991246===_0x0a9e('0x7')){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path['join'](config['root'],_0x0a9e('0xa')));}if(_0x991246==='development'||_0x991246==='test'){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path[_0x0a9e('0xb')](config[_0x0a9e('0xc')],_0x0a9e('0xd')));_0x2ab90b[_0x0a9e('0xe')](errorHandler());}_0x2ab90b['set']('json\x20replacer',function(_0x527cdd,_0x4cfe67){if(this[_0x527cdd]instanceof Date){_0x4cfe67=this[_0x527cdd][_0x0a9e('0xf')]()[_0x0a9e('0x10')]('.')[0x0]+'Z';}return _0x4cfe67;});_0x2ab90b[_0x0a9e('0xe')](express[_0x0a9e('0x11')](_0x2ab90b[_0x0a9e('0x6')](_0x0a9e('0x9'))));_0x2ab90b['set'](_0x0a9e('0x12'),config[_0x0a9e('0xc')]+_0x0a9e('0x13'));_0x2ab90b[_0x0a9e('0x14')](_0x0a9e('0x15'),require(_0x0a9e('0x16'))['renderFile']);_0x2ab90b[_0x0a9e('0x8')]('view\x20engine',_0x0a9e('0x15'));_0x2ab90b['use'](express[_0x0a9e('0x17')]({'limit':_0x0a9e('0x18'),'extended':!![]}));_0x2ab90b['use'](express[_0x0a9e('0x19')]({'limit':'50mb'}));_0x2ab90b[_0x0a9e('0xe')](cors());_0x2ab90b[_0x0a9e('0xe')](methodOverride());_0x2ab90b[_0x0a9e('0xe')](cookieParser());_0x2ab90b[_0x0a9e('0xe')](passport[_0x0a9e('0x1a')]());}; \ No newline at end of file +var _0x9957=['root','public','test','join','client','use','json\x20replacer','toISOString','split','static','/server/views','engine','html','ejs','renderFile','view\x20engine','urlencoded','json','50mb','express','method-override','cookie-parser','errorhandler','passport','cors','./environment','default','get','env','production','set','appPath'];(function(_0x39e02f,_0x2f4a3c){var _0x9cf183=function(_0x5bdd82){while(--_0x5bdd82){_0x39e02f['push'](_0x39e02f['shift']());}};_0x9cf183(++_0x2f4a3c);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'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 fde8b7f..1e92135 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 _0x5cd1=['hex','substring','bimedia-machine-uuid','child_process','execSync','networkInterfaces','keys','length','family','internal','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','orderBy','map','createHash','update','digest','getUuid','platform','licenseToken','test','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','macAddress','ipAddress','md5'];(function(_0x527306,_0x444b80){var _0x4085e9=function(_0x3c5b19){while(--_0x3c5b19){_0x527306['push'](_0x527306['shift']());}};_0x4085e9(++_0x444b80);}(_0x5cd1,0x12b));var _0x15cd=function(_0x2fda81,_0x5de06c){_0x2fda81=_0x2fda81-0x0;var _0x5f38d9=_0x5cd1[_0x2fda81];return _0x5f38d9;};'use strict';var _=require('lodash');var os=require('os');var crypto=require('crypto');var machine=require(_0x15cd('0x0'));var exec=require(_0x15cd('0x1'))[_0x15cd('0x2')];var config=require('../environment');function getInterfaces(){var _0x8ec60=[];var _0x293ed4=os[_0x15cd('0x3')]();var _0x2b0b28=_['orderBy'](_[_0x15cd('0x4')](_0x293ed4));for(var _0x355985=0x0;_0x355985<_0x2b0b28[_0x15cd('0x5')];_0x355985++){var _0xe945c=_0x293ed4[_0x2b0b28[_0x355985]]['filter'](function(_0xd85f12){return _0xd85f12[_0x15cd('0x6')]==='IPv4'&&_0xd85f12[_0x15cd('0x7')]===![];});_0x8ec60=_0x8ec60[_0x15cd('0x8')](_0xe945c);}return _0x8ec60;}function getFirstInterface(){var _0x29ec6b=_[_0x15cd('0x9')](getInterfaces());return{'macAddress':_0x29ec6b&&_0x29ec6b['mac']?_0x29ec6b[_0x15cd('0xa')]:_0x15cd('0xb'),'ipAddress':_0x29ec6b&&_0x29ec6b[_0x15cd('0xc')]?_0x29ec6b[_0x15cd('0xc')]:_0x15cd('0xd')};}exports[_0x15cd('0xe')]=getFirstInterface;function getCPUhash(){var _0x23d5ea=_[_0x15cd('0xf')](os['cpus']()[_0x15cd('0x10')](function(_0x39ec9f){return _0x39ec9f['model'];}))['join'](':');return crypto[_0x15cd('0x11')]('md5')[_0x15cd('0x12')](_0x23d5ea)[_0x15cd('0x13')]('hex');}exports[_0x15cd('0x14')]=function(){var _0x445c84=os[_0x15cd('0x15')]();var _0x595d49=/[0-9a-f-]{36}/;if(config[_0x15cd('0x16')]&&_0x595d49[_0x15cd('0x17')](config['licenseToken'])){return config[_0x15cd('0x16')];}else if(_0x445c84==='win32'){return exec(_0x15cd('0x18'),{'encoding':_0x15cd('0x19')})[_0x15cd('0x1a')]('\x0d\x0a','');}else{var _0x59c235=getFirstInterface();var _0x44a7e3=getCPUhash();var _0xde561c=_0x44a7e3+'|'+os[_0x15cd('0x1b')]()+'|'+_0x59c235[_0x15cd('0x1c')]+'|'+_0x59c235[_0x15cd('0x1d')];var _0x4dfc97=crypto['createHash'](_0x15cd('0x1e'))[_0x15cd('0x12')](_0xde561c)['digest'](_0x15cd('0x1f'));return _0x4dfc97[_0x15cd('0x20')](0x0,0x8)+'-'+_0x4dfc97[_0x15cd('0x20')](0x8,0xc)+'-'+_0x4dfc97[_0x15cd('0x20')](0xc,0x10)+'-'+_0x4dfc97[_0x15cd('0x20')](0x10,0x14)+'-'+_0x4dfc97[_0x15cd('0x20')](0x14);}}; \ No newline at end of file +var _0x2985=['family','IPv4','mac','00:00:00:00:00:00','address','getFirstInterface','cpus','model','createHash','md5','digest','hex','platform','licenseToken','win32','dmidecode\x20--string\x20system-uuid','replace','hostname','macAddress','ipAddress','update','substring','lodash','child_process','../environment','networkInterfaces','orderBy','keys','filter'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x2985,0x18f));var _0x5298=function(_0xac4196,_0x3f58aa){_0xac4196=_0xac4196-0x0;var _0x97704a=_0x2985[_0xac4196];return _0x97704a;};'use strict';var _=require(_0x5298('0x0'));var os=require('os');var crypto=require('crypto');var machine=require('bimedia-machine-uuid');var exec=require(_0x5298('0x1'))['execSync'];var config=require(_0x5298('0x2'));function getInterfaces(){var _0x22190a=[];var _0xffd36f=os[_0x5298('0x3')]();var _0x1310e8=_[_0x5298('0x4')](_[_0x5298('0x5')](_0xffd36f));for(var _0x46e25c=0x0;_0x46e25c<_0x1310e8['length'];_0x46e25c++){var _0x43d39a=_0xffd36f[_0x1310e8[_0x46e25c]][_0x5298('0x6')](function(_0x14eb04){return _0x14eb04[_0x5298('0x7')]===_0x5298('0x8')&&_0x14eb04['internal']===![];});_0x22190a=_0x22190a['concat'](_0x43d39a);}return _0x22190a;}function getFirstInterface(){var _0x2d7226=_['head'](getInterfaces());return{'macAddress':_0x2d7226&&_0x2d7226[_0x5298('0x9')]?_0x2d7226[_0x5298('0x9')]:_0x5298('0xa'),'ipAddress':_0x2d7226&&_0x2d7226['address']?_0x2d7226[_0x5298('0xb')]:'127.0.0.1'};}exports[_0x5298('0xc')]=getFirstInterface;function getCPUhash(){var _0xcdadf2=_[_0x5298('0x4')](os[_0x5298('0xd')]()['map'](function(_0x786985){return _0x786985[_0x5298('0xe')];}))['join'](':');return crypto[_0x5298('0xf')](_0x5298('0x10'))['update'](_0xcdadf2)[_0x5298('0x11')](_0x5298('0x12'));}exports['getUuid']=function(){var _0x1e7603=os[_0x5298('0x13')]();var _0x2feac4=/[0-9a-f-]{36}/;if(config[_0x5298('0x14')]&&_0x2feac4['test'](config[_0x5298('0x14')])){return config[_0x5298('0x14')];}else if(_0x1e7603===_0x5298('0x15')){return exec(_0x5298('0x16'),{'encoding':'utf8'})[_0x5298('0x17')]('\x0d\x0a','');}else{var _0x5d9b54=getFirstInterface();var _0x2b8cee=getCPUhash();var _0x443e6e=_0x2b8cee+'|'+os[_0x5298('0x18')]()+'|'+_0x5d9b54[_0x5298('0x19')]+'|'+_0x5d9b54[_0x5298('0x1a')];var _0x12ccfd=crypto[_0x5298('0xf')](_0x5298('0x10'))[_0x5298('0x1b')](_0x443e6e)['digest'](_0x5298('0x12'));return _0x12ccfd[_0x5298('0x1c')](0x0,0x8)+'-'+_0x12ccfd['substring'](0x8,0xc)+'-'+_0x12ccfd[_0x5298('0x1c')](0xc,0x10)+'-'+_0x12ccfd[_0x5298('0x1c')](0x10,0x14)+'-'+_0x12ccfd[_0x5298('0x1c')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index f08bf80..2eeb62f 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 _0x5e43=['encryptString','YYYY-MM-DD\x20HH:mm','diff','decryptString','DEMO\x20START\x20AT\x20%s','error','message','finally','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','util','request-promise','bluebird','pkginfo','version','../../components/encryptor','./hardware','../logger','%s/api/servers/%s/check?version=%s','format','exports','GET','then','catch','get','data1','active','license','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','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'];(function(_0xfc0021,_0x336a32){var _0x5f392c=function(_0x45a830){while(--_0x45a830){_0xfc0021['push'](_0xfc0021['shift']());}};_0x5f392c(++_0x336a32);}(_0x5e43,0x85));var _0x35e4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5e43[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x35e4('0x0'));var moment=require('moment');var rp=require(_0x35e4('0x1'));var BPromise=require(_0x35e4('0x2'));var pkginfo=require(_0x35e4('0x3'))(module,_0x35e4('0x4'));var db=require('../../mysqldb')['db'];var encryptor=require(_0x35e4('0x5'));var hardware=require(_0x35e4('0x6'));var logger=require(_0x35e4('0x7'))('license');var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x43393e){return new BPromise(function(_0x11ee7a,_0x3f1789){var _0x52074d=util['format'](_0x35e4('0x8'),HOST,_0x43393e,module['exports'][_0x35e4('0x4')]);if(oldToken){_0x52074d=util[_0x35e4('0x9')]('%s/api/servers/%s/check?version=%s&oldtoken=%s',HOST,_0x43393e,module[_0x35e4('0xa')][_0x35e4('0x4')],oldToken);}var _0x308765={'uri':_0x52074d,'method':_0x35e4('0xb'),'timeout':0xea60,'json':!![]};return rp(_0x308765)[_0x35e4('0xc')](function(_0x28c1b6){_0x11ee7a(_0x28c1b6);})[_0x35e4('0xd')](function(_0x6dc3a){_0x3f1789(_0x6dc3a);});});}function manageLicense(_0x15fe7e,_0x4dbaf9){var _0x552b45=_0x4dbaf9[_0x35e4('0xe')]({'plain':!![]});if(!isOldTokenSent&&_0x552b45['data1']!==_0x15fe7e&&!_0x552b45['data2']){oldToken=_0x552b45[_0x35e4('0xf')];}httpRequest(_0x15fe7e)[_0x35e4('0xc')](function(_0x5cdec3){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x5cdec3[_0x35e4('0x10')]){isOldTokenSent=![];if(!_0x552b45[_0x35e4('0x11')]&&_0x552b45[_0x35e4('0x11')]!=_0x5cdec3[_0x35e4('0x11')]||_0x552b45[_0x35e4('0x11')]&&_0x552b45[_0x35e4('0x12')]){logger[_0x35e4('0x13')](_0x35e4('0x14'));}if(_0x552b45['license']&&!_0x552b45[_0x35e4('0x12')]&&_0x552b45[_0x35e4('0x11')]!=_0x5cdec3[_0x35e4('0x11')]){logger['info']('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0x552b45[_0x35e4('0x11')]&&!_0x552b45['data2']&&_0x552b45[_0x35e4('0x11')]==_0x5cdec3[_0x35e4('0x11')]){return _0x4dbaf9;}return _0x4dbaf9[_0x35e4('0x15')]({'data1':_0x15fe7e,'data2':null,'license':_0x5cdec3[_0x35e4('0x11')]});}else{if(_0x5cdec3['license']||_0x552b45[_0x35e4('0x11')]){if(!_0x552b45[_0x35e4('0x12')]){if(_0x552b45[_0x35e4('0xf')]==_0x15fe7e){GRAY_PERIOD_REASON=_0x35e4('0x16');logger[_0x35e4('0x13')](_0x35e4('0x17'));}else{GRAY_PERIOD_REASON='Changed';logger[_0x35e4('0x13')](_0x35e4('0x18'),_0x552b45[_0x35e4('0xf')],_0x15fe7e);}logger[_0x35e4('0x13')](_0x35e4('0x19'),GRAY_PERIOD_REASON[_0x35e4('0x1a')](),moment()[_0x35e4('0x9')]('YYYY-MM-DD\x20HH:mm'));return _0x4dbaf9[_0x35e4('0x15')]({'data2':encryptor[_0x35e4('0x1b')](moment()[_0x35e4('0x9')](_0x35e4('0x1c')))});}else{if(moment()[_0x35e4('0x1d')](encryptor[_0x35e4('0x1e')](_0x552b45[_0x35e4('0x12')]),'days')>DAYS){logger[_0x35e4('0x13')](_0x35e4('0x1f'),moment()['format']('YYYY-MM-DD\x20HH:mm'));isOldTokenSent=![];return _0x4dbaf9[_0x35e4('0x15')]({'data1':_0x15fe7e,'data2':null,'license':null});}}}else{if(_0x552b45[_0x35e4('0xf')]!=_0x15fe7e){logger[_0x35e4('0x13')](_0x35e4('0x18'),_0x552b45[_0x35e4('0xf')],_0x15fe7e);return _0x4dbaf9['update']({'data1':_0x15fe7e,'data2':null,'license':null});}}}return _0x4dbaf9;})[_0x35e4('0xc')](function(_0x4771ec){_0x4dbaf9=_0x4771ec;})[_0x35e4('0xd')](function(_0x44d231){logger[_0x35e4('0x20')](_0x44d231[_0x35e4('0x21')]);})[_0x35e4('0x22')](function(){setTimeout(function(){manageLicense(hardware[_0x35e4('0x23')](),_0x4dbaf9);},TIME);});}function defaultLicense(){var _0x12836d=hardware[_0x35e4('0x23')]();if(_0x12836d){return db[_0x35e4('0x24')][_0x35e4('0x25')]({'where':{'id':0x1},'defaults':{'data1':_0x12836d}})[_0x35e4('0x26')](function(_0x12c57c,_0x21f56e){logger[_0x35e4('0x13')](_0x35e4('0x27'),_0x12836d);manageLicense(_0x12836d,_0x12c57c);})[_0x35e4('0xd')](function(_0x11392d){logger[_0x35e4('0x20')](_0x11392d[_0x35e4('0x21')]);});}}exports['default']=defaultLicense; \ No newline at end of file +var _0xc4a8=['exports','then','get','data1','data2','active','license','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','error','message','finally','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','default','util','request-promise','bluebird','pkginfo','version','../../components/encryptor','./hardware','../logger','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s&oldtoken=%s'];(function(_0x183b97,_0x2d297c){var _0x629cf7=function(_0x4ffd24){while(--_0x4ffd24){_0x183b97['push'](_0x183b97['shift']());}};_0x629cf7(++_0x2d297c);}(_0xc4a8,0x1ce));var _0x8c4a=function(_0x5432dd,_0x1374f8){_0x5432dd=_0x5432dd-0x0;var _0xf85a2e=_0xc4a8[_0x5432dd];return _0xf85a2e;};'use strict';var util=require(_0x8c4a('0x0'));var moment=require('moment');var rp=require(_0x8c4a('0x1'));var BPromise=require(_0x8c4a('0x2'));var pkginfo=require(_0x8c4a('0x3'))(module,_0x8c4a('0x4'));var db=require('../../mysqldb')['db'];var encryptor=require(_0x8c4a('0x5'));var hardware=require(_0x8c4a('0x6'));var logger=require(_0x8c4a('0x7'))('license');var HOST=_0x8c4a('0x8');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x24eeff){return new BPromise(function(_0x476a64,_0x5c2860){var _0x559871=util[_0x8c4a('0x9')]('%s/api/servers/%s/check?version=%s',HOST,_0x24eeff,module['exports'][_0x8c4a('0x4')]);if(oldToken){_0x559871=util[_0x8c4a('0x9')](_0x8c4a('0xa'),HOST,_0x24eeff,module[_0x8c4a('0xb')][_0x8c4a('0x4')],oldToken);}var _0x3f2448={'uri':_0x559871,'method':'GET','timeout':0xea60,'json':!![]};return rp(_0x3f2448)[_0x8c4a('0xc')](function(_0x40a0da){_0x476a64(_0x40a0da);})['catch'](function(_0x5432d7){_0x5c2860(_0x5432d7);});});}function manageLicense(_0xdf8dd,_0x4a6723){var _0x4900dc=_0x4a6723[_0x8c4a('0xd')]({'plain':!![]});if(!isOldTokenSent&&_0x4900dc[_0x8c4a('0xe')]!==_0xdf8dd&&!_0x4900dc[_0x8c4a('0xf')]){oldToken=_0x4900dc[_0x8c4a('0xe')];}httpRequest(_0xdf8dd)['then'](function(_0x1c20d4){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x1c20d4[_0x8c4a('0x10')]){isOldTokenSent=![];if(!_0x4900dc[_0x8c4a('0x11')]&&_0x4900dc[_0x8c4a('0x11')]!=_0x1c20d4[_0x8c4a('0x11')]||_0x4900dc[_0x8c4a('0x11')]&&_0x4900dc[_0x8c4a('0xf')]){logger[_0x8c4a('0x12')](_0x8c4a('0x13'));}if(_0x4900dc[_0x8c4a('0x11')]&&!_0x4900dc[_0x8c4a('0xf')]&&_0x4900dc[_0x8c4a('0x11')]!=_0x1c20d4[_0x8c4a('0x11')]){logger[_0x8c4a('0x12')](_0x8c4a('0x14'));}if(_0x4900dc['license']&&!_0x4900dc[_0x8c4a('0xf')]&&_0x4900dc['license']==_0x1c20d4['license']){return _0x4a6723;}return _0x4a6723[_0x8c4a('0x15')]({'data1':_0xdf8dd,'data2':null,'license':_0x1c20d4[_0x8c4a('0x11')]});}else{if(_0x1c20d4['license']||_0x4900dc[_0x8c4a('0x11')]){if(!_0x4900dc[_0x8c4a('0xf')]){if(_0x4900dc[_0x8c4a('0xe')]==_0xdf8dd){GRAY_PERIOD_REASON=_0x8c4a('0x16');logger['info'](_0x8c4a('0x17'));}else{GRAY_PERIOD_REASON=_0x8c4a('0x18');logger['info'](_0x8c4a('0x19'),_0x4900dc['data1'],_0xdf8dd);}logger[_0x8c4a('0x12')](_0x8c4a('0x1a'),GRAY_PERIOD_REASON[_0x8c4a('0x1b')](),moment()[_0x8c4a('0x9')](_0x8c4a('0x1c')));return _0x4a6723[_0x8c4a('0x15')]({'data2':encryptor[_0x8c4a('0x1d')](moment()['format'](_0x8c4a('0x1c')))});}else{if(moment()[_0x8c4a('0x1e')](encryptor[_0x8c4a('0x1f')](_0x4900dc[_0x8c4a('0xf')]),_0x8c4a('0x20'))>DAYS){logger[_0x8c4a('0x12')](_0x8c4a('0x21'),moment()[_0x8c4a('0x9')](_0x8c4a('0x1c')));isOldTokenSent=![];return _0x4a6723[_0x8c4a('0x15')]({'data1':_0xdf8dd,'data2':null,'license':null});}}}else{if(_0x4900dc[_0x8c4a('0xe')]!=_0xdf8dd){logger[_0x8c4a('0x12')](_0x8c4a('0x19'),_0x4900dc[_0x8c4a('0xe')],_0xdf8dd);return _0x4a6723[_0x8c4a('0x15')]({'data1':_0xdf8dd,'data2':null,'license':null});}}}return _0x4a6723;})[_0x8c4a('0xc')](function(_0xac6202){_0x4a6723=_0xac6202;})['catch'](function(_0x1b3286){logger[_0x8c4a('0x22')](_0x1b3286[_0x8c4a('0x23')]);})[_0x8c4a('0x24')](function(){setTimeout(function(){manageLicense(hardware[_0x8c4a('0x25')](),_0x4a6723);},TIME);});}function defaultLicense(){var _0x2129d6=hardware[_0x8c4a('0x25')]();if(_0x2129d6){return db[_0x8c4a('0x26')][_0x8c4a('0x27')]({'where':{'id':0x1},'defaults':{'data1':_0x2129d6}})[_0x8c4a('0x28')](function(_0x2e7e00,_0x558aa2){logger[_0x8c4a('0x12')](_0x8c4a('0x29'),_0x2129d6);manageLicense(_0x2129d6,_0x2e7e00);})['catch'](function(_0x3810f1){logger[_0x8c4a('0x22')](_0x3810f1[_0x8c4a('0x23')]);});}}exports[_0x8c4a('0x2a')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 8304f74..3d299e9 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 _0xbe2b=['license','isEmpty','License\x20key\x20value\x20not\x20found','split','decryptString','format','%s:%s:%s','parse','demo','machineUuid','add','grayReason','changed','message','User','findAll','role','sequelize','col','count','user','forEach','countBy','admin','telephone','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','moment','bluebird','../../components/encryptor','../../mysqldb','Demo\x20license','getUuid','2027-01-01T00:00:00.000Z','Breaking\x20license','License','find','defaults','then','catch','uuid','data1'];(function(_0x25e989,_0x210742){var _0xc32712=function(_0x5f09f7){while(--_0x5f09f7){_0x25e989['push'](_0x25e989['shift']());}};_0xc32712(++_0x210742);}(_0xbe2b,0x184));var _0xbbe2=function(_0x4e479d,_0x2a4c10){_0x4e479d=_0x4e479d-0x0;var _0x5d66a6=_0xbe2b[_0x4e479d];return _0x5d66a6;};'use strict';var util=require(_0xbbe2('0x0'));var _=require(_0xbbe2('0x1'));var moment=require(_0xbbe2('0x2'));var BPromise=require(_0xbbe2('0x3'));var hardware=require('./hardware');var encryptor=require(_0xbbe2('0x4'));var db=require(_0xbbe2('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xbbe2('0x6'),'machineUuid':hardware[_0xbbe2('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xbbe2('0x8'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xbbe2('0x9'),'machineUuid':hardware[_0xbbe2('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x2636f4){return new BPromise(function(_0xe7fa84,_0xdd1680){return db[_0xbbe2('0xa')][_0xbbe2('0xb')](_[_0xbbe2('0xc')](_0x2636f4,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0xaaf242){return checkLicense(_0xaaf242,null);})[_0xbbe2('0xd')](function(_0x2deb73){_0xe7fa84(_0x2deb73);return;})[_0xbbe2('0xe')](function(_0x29e6f1){_0xdd1680(_0x29e6f1);});});}function checkLicense(_0x58ab5c,_0x1d0bcc){if(!_0x58ab5c){demoLicense[_0xbbe2('0xf')]=_0x58ab5c[_0xbbe2('0x10')];return demoLicense;}try{var _0x2a026a=_0x1d0bcc||_0x58ab5c[_0xbbe2('0x11')];if(_[_0xbbe2('0x12')](_0x2a026a)){throw new Error(_0xbbe2('0x13'));}var _0x5c01ce=_0x58ab5c['data1'];var _0x170b8a=_0x58ab5c['data2'];var _0x385d46=_0x5c01ce[_0xbbe2('0x14')]('-')[0x4];var _0x24e126=_0x5c01ce['split']('-')[0x0];var _0x217c7e=encryptor[_0xbbe2('0x15')](_0x2a026a,util[_0xbbe2('0x16')](_0xbbe2('0x17'),_0x385d46,_0x5c01ce,_0x24e126));var _0x5ca910=JSON[_0xbbe2('0x18')](_0x217c7e);_0x5ca910[_0xbbe2('0x19')]=![];_0x5ca910[_0xbbe2('0xf')]=_0x5c01ce;_0x5ca910[_0xbbe2('0x1a')]=hardware['getUuid']();if(_0x170b8a){var _0x3c936e=encryptor[_0xbbe2('0x15')](_0x170b8a);_0x5ca910['gray']=_0x3c936e;_0x5ca910['deadline']=moment(_0x3c936e)[_0xbbe2('0x1b')](0x7,'days')[_0xbbe2('0x16')]();_0x5ca910[_0xbbe2('0x1c')]=_0x5ca910[_0xbbe2('0xf')]!=_0x5ca910[_0xbbe2('0x1a')]?_0xbbe2('0x1d'):'disabled';}return _0x5ca910;}catch(_0x16579f){breakingLicense[_0xbbe2('0xf')]=_0x58ab5c[_0xbbe2('0x10')];breakingLicense[_0xbbe2('0x1e')]=_0x16579f[_0xbbe2('0x1e')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x15e79e,_0x32c1cd){getLicense()[_0xbbe2('0xd')](function(_0x20a628){return db[_0xbbe2('0x1f')][_0xbbe2('0x20')]({'attributes':[_0xbbe2('0x21'),[db[_0xbbe2('0x22')]['fn']('COUNT',db['sequelize'][_0xbbe2('0x23')]('role')),_0xbbe2('0x24')]],'group':'role','where':{'role':{'$or':['admin',_0xbbe2('0x25'),'telephone']}},'raw':!![]})['then'](function(_0x172859){var _0x247004={'user':_0x20a628['users']||0x0,'telephone':_0x20a628['telephones']||0x0};_0x172859[_0xbbe2('0x26')](function(_0x4291f6){var _0x13ea39=_0x4291f6[_0xbbe2('0x21')]==='admin'?'user':_0x4291f6['role'];_0x247004[_0x13ea39]-=_0x4291f6['count'];if(_0x247004[_0x13ea39]<0x0)_0x247004[_0x13ea39]=0x0;});_0x15e79e(_0x247004);return;});})[_0xbbe2('0xe')](function(_0xac82cf){_0x32c1cd(_0xac82cf);});});}function checkUserLimits(_0x2dc885){return new BPromise(function(_0x5761e9,_0x2294de){getLimits()[_0xbbe2('0xd')](function(_0x6648af){var _0x299424=_['pick'](_[_0xbbe2('0x27')](_0x2dc885,_0xbbe2('0x21')),[_0xbbe2('0x28'),_0xbbe2('0x25'),'telephone']);var _0x17e5b0=(_0x299424[_0xbbe2('0x28')]||0x0)+(_0x299424[_0xbbe2('0x25')]||0x0);var _0x3a2f8c=_0x299424[_0xbbe2('0x29')]||0x0;if(_0x17e5b0>_0x6648af[_0xbbe2('0x25')])return _0x2294de(_0xbbe2('0x2a'));if(_0x3a2f8c>_0x6648af[_0xbbe2('0x29')])return _0x2294de(_0xbbe2('0x2b'));return _0x5761e9();})[_0xbbe2('0xe')](function(_0x581000){_0x2294de(_0x581000);});});}module[_0xbbe2('0x2c')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0xefa7=['getUuid','License','find','then','uuid','isEmpty','split','decryptString','parse','days','format','grayReason','machineUuid','changed','data1','message','findAll','sequelize','COUNT','col','role','count','admin','user','telephones','forEach','catch','telephone','License\x20limit\x20reached\x20for\x20users','exports','lodash','moment','bluebird','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license'];(function(_0x101d5b,_0x40cfd){var _0x382a50=function(_0x2fd131){while(--_0x2fd131){_0x101d5b['push'](_0x101d5b['shift']());}};_0x382a50(++_0x40cfd);}(_0xefa7,0x190));var _0x7efa=function(_0x5e19b4,_0x1c24d5){_0x5e19b4=_0x5e19b4-0x0;var _0x10c429=_0xefa7[_0x5e19b4];return _0x10c429;};'use strict';var util=require('util');var _=require(_0x7efa('0x0'));var moment=require(_0x7efa('0x1'));var BPromise=require(_0x7efa('0x2'));var hardware=require('./hardware');var encryptor=require(_0x7efa('0x3'));var db=require(_0x7efa('0x4'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x7efa('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x7efa('0x6'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x7efa('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Breaking\x20license','machineUuid':hardware[_0x7efa('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x103001){return new BPromise(function(_0x3310ec,_0x508c39){return db[_0x7efa('0x8')][_0x7efa('0x9')](_['defaults'](_0x103001,{'raw':!![],'where':{'id':0x1}}))[_0x7efa('0xa')](function(_0x522874){return checkLicense(_0x522874,null);})['then'](function(_0x3ca5e9){_0x3310ec(_0x3ca5e9);return;})['catch'](function(_0x43cac0){_0x508c39(_0x43cac0);});});}function checkLicense(_0xbb9cb0,_0x137918){if(!_0xbb9cb0){demoLicense[_0x7efa('0xb')]=_0xbb9cb0['data1'];return demoLicense;}try{var _0x40f8c4=_0x137918||_0xbb9cb0['license'];if(_[_0x7efa('0xc')](_0x40f8c4)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x23d8d8=_0xbb9cb0['data1'];var _0x515a1e=_0xbb9cb0['data2'];var _0x24afb=_0x23d8d8['split']('-')[0x4];var _0x32991c=_0x23d8d8[_0x7efa('0xd')]('-')[0x0];var _0x36ff36=encryptor[_0x7efa('0xe')](_0x40f8c4,util['format']('%s:%s:%s',_0x24afb,_0x23d8d8,_0x32991c));var _0x15a26f=JSON[_0x7efa('0xf')](_0x36ff36);_0x15a26f['demo']=![];_0x15a26f['uuid']=_0x23d8d8;_0x15a26f['machineUuid']=hardware[_0x7efa('0x7')]();if(_0x515a1e){var _0x545be0=encryptor[_0x7efa('0xe')](_0x515a1e);_0x15a26f['gray']=_0x545be0;_0x15a26f['deadline']=moment(_0x545be0)['add'](0x7,_0x7efa('0x10'))[_0x7efa('0x11')]();_0x15a26f[_0x7efa('0x12')]=_0x15a26f[_0x7efa('0xb')]!=_0x15a26f[_0x7efa('0x13')]?_0x7efa('0x14'):'disabled';}return _0x15a26f;}catch(_0x2b9c34){breakingLicense[_0x7efa('0xb')]=_0xbb9cb0[_0x7efa('0x15')];breakingLicense[_0x7efa('0x16')]=_0x2b9c34['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x5406d,_0x6abd55){getLicense()[_0x7efa('0xa')](function(_0x349f4f){return db['User'][_0x7efa('0x17')]({'attributes':['role',[db[_0x7efa('0x18')]['fn'](_0x7efa('0x19'),db[_0x7efa('0x18')][_0x7efa('0x1a')](_0x7efa('0x1b'))),_0x7efa('0x1c')]],'group':_0x7efa('0x1b'),'where':{'role':{'$or':[_0x7efa('0x1d'),_0x7efa('0x1e'),'telephone']}},'raw':!![]})[_0x7efa('0xa')](function(_0x4119d4){var _0x463a5d={'user':_0x349f4f['users']||0x0,'telephone':_0x349f4f[_0x7efa('0x1f')]||0x0};_0x4119d4[_0x7efa('0x20')](function(_0x3770e0){var _0x115bc9=_0x3770e0[_0x7efa('0x1b')]===_0x7efa('0x1d')?_0x7efa('0x1e'):_0x3770e0[_0x7efa('0x1b')];_0x463a5d[_0x115bc9]-=_0x3770e0[_0x7efa('0x1c')];if(_0x463a5d[_0x115bc9]<0x0)_0x463a5d[_0x115bc9]=0x0;});_0x5406d(_0x463a5d);return;});})[_0x7efa('0x21')](function(_0x475188){_0x6abd55(_0x475188);});});}function checkUserLimits(_0x3c428c){return new BPromise(function(_0x11ebd2,_0x12825c){getLimits()[_0x7efa('0xa')](function(_0x3729c1){var _0x469418=_['pick'](_['countBy'](_0x3c428c,_0x7efa('0x1b')),[_0x7efa('0x1d'),_0x7efa('0x1e'),_0x7efa('0x22')]);var _0xe94f06=(_0x469418[_0x7efa('0x1d')]||0x0)+(_0x469418[_0x7efa('0x1e')]||0x0);var _0x27f916=_0x469418['telephone']||0x0;if(_0xe94f06>_0x3729c1[_0x7efa('0x1e')])return _0x12825c(_0x7efa('0x23'));if(_0x27f916>_0x3729c1['telephone'])return _0x12825c('License\x20limit\x20reached\x20for\x20telephones');return _0x11ebd2();})['catch'](function(_0x3a0ecb){_0x12825c(_0x3a0ecb);});});}module[_0x7efa('0x24')]={'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 2a11b9d..f9d8612 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 _0x0120=['secret','exports','http://localhost:9000','myappanuglar-secret','app-id'];(function(_0x4fba7f,_0x25aae3){var _0x22bdaa=function(_0x4ecd64){while(--_0x4ecd64){_0x4fba7f['push'](_0x4fba7f['shift']());}};_0x22bdaa(++_0x25aae3);}(_0x0120,0x6f));var _0x0012=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x0120[_0x501510];return _0x1e6ee5;};'use strict';module[_0x0012('0x0')]={'DOMAIN':_0x0012('0x1'),'SESSION_SECRET':_0x0012('0x2'),'GOOGLE_ID':_0x0012('0x3'),'GOOGLE_SECRET':_0x0012('0x4'),'DEBUG':''}; \ No newline at end of file +var _0xe820=['exports','myappanuglar-secret'];(function(_0xc0a38f,_0x25b848){var _0x37e040=function(_0x40411e){while(--_0x40411e){_0xc0a38f['push'](_0xc0a38f['shift']());}};_0x37e040(++_0x25b848);}(_0xe820,0xd2));var _0x0e82=function(_0x12d345,_0x52091c){_0x12d345=_0x12d345-0x0;var _0x43b1f5=_0xe820[_0x12d345];return _0x43b1f5;};'use strict';module[_0x0e82('0x0')]={'DOMAIN':'http://localhost:9000','SESSION_SECRET':_0x0e82('0x1'),'GOOGLE_ID':'app-id','GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 6d7872b..c71728a 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa500=['exports','../utils/loggers'];(function(_0xdbe2de,_0x3bdc5a){var _0x2facd7=function(_0x50df58){while(--_0x50df58){_0xdbe2de['push'](_0xdbe2de['shift']());}};_0x2facd7(++_0x3bdc5a);}(_0xa500,0x12d));var _0x0a50=function(_0x2aebf2,_0x421d99){_0x2aebf2=_0x2aebf2-0x0;var _0x33cda6=_0xa500[_0x2aebf2];return _0x33cda6;};'use strict';var fileLogger=require(_0x0a50('0x0'))['fileLogger'];module[_0x0a50('0x1')]=fileLogger; \ No newline at end of file +var _0xc574=['exports','../utils/loggers'];(function(_0x762506,_0xa36cf3){var _0x21c5eb=function(_0xb43dbc){while(--_0xb43dbc){_0x762506['push'](_0x762506['shift']());}};_0x21c5eb(++_0xa36cf3);}(_0xc574,0x1e1));var _0x4c57=function(_0x3e798c,_0x1ed765){_0x3e798c=_0x3e798c-0x0;var _0x4892c1=_0xc574[_0x3e798c];return _0x4892c1;};'use strict';var fileLogger=require(_0x4c57('0x0'))['fileLogger'];module[_0x4c57('0x1')]=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 98af8e5..b5ab53b 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 _0xc0b9=['routing','../../services/routing/index.js','xdr','../../services/xdr/index.js','exports','path','join','../../services/express/index.js','ami','agi','email','../../services/email/index.js'];(function(_0x3759d2,_0x19472f){var _0x327c0b=function(_0x373643){while(--_0x373643){_0x3759d2['push'](_0x3759d2['shift']());}};_0x327c0b(++_0x19472f);}(_0xc0b9,0x19d));var _0x9c0b=function(_0x44c62d,_0x41626f){_0x44c62d=_0x44c62d-0x0;var _0x19d4bb=_0xc0b9[_0x44c62d];return _0x19d4bb;};'use strict';var path=require(_0x9c0b('0x0'));var os=require('os');var config={'apps':[{'name':'express','script':path[_0x9c0b('0x1')](__dirname,_0x9c0b('0x2'))},{'name':_0x9c0b('0x3'),'script':path[_0x9c0b('0x1')](__dirname,'../../services/ami/index.js')},{'name':_0x9c0b('0x4'),'script':path['join'](__dirname,'../../services/agi/index.js')},{'name':_0x9c0b('0x5'),'script':path[_0x9c0b('0x1')](__dirname,_0x9c0b('0x6'))},{'name':_0x9c0b('0x7'),'script':path[_0x9c0b('0x1')](__dirname,_0x9c0b('0x8'))},{'name':_0x9c0b('0x9'),'script':path['join'](__dirname,_0x9c0b('0xa'))}]};module[_0x9c0b('0xb')]=config; \ No newline at end of file +var _0x443c=['xdr','path','express','join','../../services/ami/index.js','agi','email','../../services/email/index.js','routing','../../services/routing/index.js'];(function(_0x1d2193,_0x1e8790){var _0x3be200=function(_0x318177){while(--_0x318177){_0x1d2193['push'](_0x1d2193['shift']());}};_0x3be200(++_0x1e8790);}(_0x443c,0xe7));var _0xc443=function(_0x23ca3a,_0xe44c43){_0x23ca3a=_0x23ca3a-0x0;var _0x5c1aab=_0x443c[_0x23ca3a];return _0x5c1aab;};'use strict';var path=require(_0xc443('0x0'));var os=require('os');var config={'apps':[{'name':_0xc443('0x1'),'script':path['join'](__dirname,'../../services/express/index.js')},{'name':'ami','script':path[_0xc443('0x2')](__dirname,_0xc443('0x3'))},{'name':_0xc443('0x4'),'script':path[_0xc443('0x2')](__dirname,'../../services/agi/index.js')},{'name':_0xc443('0x5'),'script':path[_0xc443('0x2')](__dirname,_0xc443('0x6'))},{'name':_0xc443('0x7'),'script':path[_0xc443('0x2')](__dirname,_0xc443('0x8'))},{'name':_0xc443('0x9'),'script':path[_0xc443('0x2')](__dirname,'../../services/xdr/index.js')}]};module['exports']=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 637343a..98e42a9 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 _0x19f2=['start','then','disconnect','stop','restart','list','describe','delete','dump','saved','pm2','bluebird','./config','connect'];(function(_0x431dc7,_0x235714){var _0xea9a71=function(_0xf6971){while(--_0xf6971){_0x431dc7['push'](_0x431dc7['shift']());}};_0xea9a71(++_0x235714);}(_0x19f2,0x7a));var _0x219f=function(_0x79b53e,_0x108f8d){_0x79b53e=_0x79b53e-0x0;var _0x2d4d6c=_0x19f2[_0x79b53e];return _0x2d4d6c;};'use strict';var pm2=require(_0x219f('0x0'));var BPromise=require(_0x219f('0x1'));var config=require(_0x219f('0x2'));function connect(){return new BPromise(function(_0x568330,_0xde2d1a){return pm2[_0x219f('0x3')](function(_0xe08dc0){if(_0xe08dc0){return _0xde2d1a(_0xe08dc0);}return _0x568330('connected');});});};exports[_0x219f('0x4')]=function(_0x85542d){return connect()[_0x219f('0x5')](function(){return new BPromise(function(_0x5083f4,_0x40170c){return pm2[_0x219f('0x4')](_0x85542d,function(_0x1538ac,_0x383bb8){if(_0x1538ac){return _0x40170c(_0x1538ac);}pm2[_0x219f('0x6')]();return _0x5083f4(_0x383bb8);});});});};exports[_0x219f('0x7')]=function(_0x32fd59){return connect()[_0x219f('0x5')](function(){return new BPromise(function(_0x32d221,_0x107598){return pm2[_0x219f('0x7')](_0x32fd59,function(_0x18bccf,_0xd879d4){if(_0x18bccf){return _0x107598(_0x18bccf);}pm2[_0x219f('0x6')]();return _0x32d221(_0xd879d4);});});});};exports['restart']=function(_0x22f733){return connect()[_0x219f('0x5')](function(){return new BPromise(function(_0x3dc044,_0x143b4f){return pm2[_0x219f('0x8')](_0x22f733,function(_0x42d32d,_0x180c30){if(_0x42d32d){return _0x143b4f(_0x42d32d);}pm2['disconnect']();return _0x3dc044(_0x180c30);});});});};exports[_0x219f('0x9')]=function(){return connect()[_0x219f('0x5')](function(){return new BPromise(function(_0x53d809,_0x181d92){return pm2[_0x219f('0x9')](function(_0x2e6136,_0xabd777){if(_0x2e6136){return _0x181d92(_0x2e6136);}pm2[_0x219f('0x6')]();return _0x53d809(_0xabd777);});});});};exports[_0x219f('0xa')]=function(_0x4f71b1){return connect()[_0x219f('0x5')](function(){return new BPromise(function(_0x3eff75,_0x26bf3d){return pm2[_0x219f('0xa')](_0x4f71b1,function(_0x55791,_0x1d2343){if(_0x55791){return _0x26bf3d(_0x55791);}pm2[_0x219f('0x6')]();return _0x3eff75(_0x1d2343);});});});};exports[_0x219f('0xb')]=function(_0x702e07){return connect()['then'](function(){return new BPromise(function(_0x4fc1a3,_0x3a1e0f){return pm2['delete'](_0x702e07,function(_0x57769d,_0x2a8435){if(_0x57769d){return _0x3a1e0f(_0x57769d);}pm2[_0x219f('0x6')]();return _0x4fc1a3(_0x2a8435);});});});};exports[_0x219f('0xc')]=function(){return connect()['then'](function(){return new BPromise(function(_0x1ef0c4,_0x1ed4a9){return pm2[_0x219f('0xc')](function(_0x33c9e0){if(_0x33c9e0){return _0x1ed4a9(_0x33c9e0);}return _0x1ef0c4(_0x219f('0xd'));});});});}; \ No newline at end of file +var _0xa24e=['delete','dump','saved','bluebird','./config','connect','connected','start','disconnect','then','stop','restart','list','describe'];(function(_0x4d6205,_0x22086a){var _0x35693a=function(_0x490624){while(--_0x490624){_0x4d6205['push'](_0x4d6205['shift']());}};_0x35693a(++_0x22086a);}(_0xa24e,0x1c3));var _0xea24=function(_0x57ec62,_0x477fec){_0x57ec62=_0x57ec62-0x0;var _0x2bd069=_0xa24e[_0x57ec62];return _0x2bd069;};'use strict';var pm2=require('pm2');var BPromise=require(_0xea24('0x0'));var config=require(_0xea24('0x1'));function connect(){return new BPromise(function(_0x50214a,_0x4b079f){return pm2[_0xea24('0x2')](function(_0x1a406e){if(_0x1a406e){return _0x4b079f(_0x1a406e);}return _0x50214a(_0xea24('0x3'));});});};exports[_0xea24('0x4')]=function(_0x4e688d){return connect()['then'](function(){return new BPromise(function(_0x4d915d,_0x5a93f9){return pm2[_0xea24('0x4')](_0x4e688d,function(_0x532bb4,_0x1e1e87){if(_0x532bb4){return _0x5a93f9(_0x532bb4);}pm2[_0xea24('0x5')]();return _0x4d915d(_0x1e1e87);});});});};exports['stop']=function(_0x5f34f2){return connect()[_0xea24('0x6')](function(){return new BPromise(function(_0x28cdf6,_0x41faff){return pm2[_0xea24('0x7')](_0x5f34f2,function(_0x3874e3,_0x5db616){if(_0x3874e3){return _0x41faff(_0x3874e3);}pm2[_0xea24('0x5')]();return _0x28cdf6(_0x5db616);});});});};exports[_0xea24('0x8')]=function(_0x36b732){return connect()['then'](function(){return new BPromise(function(_0x5bc8f9,_0x46002f){return pm2[_0xea24('0x8')](_0x36b732,function(_0x165a39,_0x4dd483){if(_0x165a39){return _0x46002f(_0x165a39);}pm2['disconnect']();return _0x5bc8f9(_0x4dd483);});});});};exports['list']=function(){return connect()[_0xea24('0x6')](function(){return new BPromise(function(_0x3acf89,_0x491eb6){return pm2[_0xea24('0x9')](function(_0x353d99,_0x201d68){if(_0x353d99){return _0x491eb6(_0x353d99);}pm2[_0xea24('0x5')]();return _0x3acf89(_0x201d68);});});});};exports['describe']=function(_0xcfac86){return connect()[_0xea24('0x6')](function(){return new BPromise(function(_0x54d289,_0x2018ef){return pm2[_0xea24('0xa')](_0xcfac86,function(_0x1bb408,_0x326b14){if(_0x1bb408){return _0x2018ef(_0x1bb408);}pm2[_0xea24('0x5')]();return _0x54d289(_0x326b14);});});});};exports[_0xea24('0xb')]=function(_0x583969){return connect()['then'](function(){return new BPromise(function(_0x27061b,_0x89549a){return pm2[_0xea24('0xb')](_0x583969,function(_0x13f56f,_0x4cd42d){if(_0x13f56f){return _0x89549a(_0x13f56f);}pm2[_0xea24('0x5')]();return _0x27061b(_0x4cd42d);});});});};exports[_0xea24('0xc')]=function(){return connect()[_0xea24('0x6')](function(){return new BPromise(function(_0x49a33e,_0x52cd17){return pm2[_0xea24('0xc')](function(_0x2c980f){if(_0x2c980f){return _0x52cd17(_0x2c980f);}return _0x49a33e(_0xea24('0xd'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 05e9fbf..0110bb6 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 _0xf605=['start','lodash','ioredis','util','../../config/environment','../../mysqldb','../logger','redis','defaults','localhost','chatTimeout','ChatInteraction','findAll','lastMsgAt','subtract','minutes','then','map','info','join','update','timeout','format','YYYY-MM-DD\x20HH:mm:ss','length','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect'];(function(_0x540d65,_0x489f77){var _0x7dbd5a=function(_0x4a916d){while(--_0x4a916d){_0x540d65['push'](_0x540d65['shift']());}};_0x7dbd5a(++_0x489f77);}(_0xf605,0x9c));var _0x5f60=function(_0xf6b8e7,_0xaea5cd){_0xf6b8e7=_0xf6b8e7-0x0;var _0x5b7563=_0xf605[_0xf6b8e7];return _0x5b7563;};'use strict';var _=require(_0x5f60('0x0'));var moment=require('moment');var Redis=require(_0x5f60('0x1'));var util=require(_0x5f60('0x2'));var config=require(_0x5f60('0x3'));var db=require(_0x5f60('0x4'))['db'];var logger=require(_0x5f60('0x5'))('schedule');config[_0x5f60('0x6')]=_[_0x5f60('0x7')](config[_0x5f60('0x6')],{'host':_0x5f60('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x5f60('0x6')]));function closeInteractions(){var _0x23f4c2=0x0;var _0x18974d=[];return db['Setting']['find']({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})['then'](function(_0x57d854){_0x23f4c2=_0x57d854[_0x5f60('0x9')];if(_0x23f4c2){return db[_0x5f60('0xa')][_0x5f60('0xb')]({'raw':!![],'attributes':['id',_0x5f60('0xc')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x5f60('0xd')](_0x57d854[_0x5f60('0x9')],_0x5f60('0xe'))}}});}else{return[];}})[_0x5f60('0xf')](function(_0x1c7a39){if(_0x1c7a39&&_0x1c7a39['length']){_0x18974d=_[_0x5f60('0x10')](_0x1c7a39||[],'id');logger[_0x5f60('0x11')]('[CHAT]\x20Interactions\x20to\x20close:',_0x18974d[_0x5f60('0x12')]());return db['ChatInteraction'][_0x5f60('0x13')]({'closeReason':'system','disposition':_0x5f60('0x14'),'closed':!![],'closedAt':moment()[_0x5f60('0x15')](_0x5f60('0x16'))},{'where':{'id':_0x18974d}});}})[_0x5f60('0xf')](function(){if(_0x18974d&&_0x18974d[_0x5f60('0x17')]){logger[_0x5f60('0x11')](_0x5f60('0x18'),_0x18974d['join']());for(var _0x13a76d=0x0;_0x13a76d<_0x18974d[_0x5f60('0x17')];_0x13a76d++){io['emit'](_0x5f60('0x19'),{'id':_0x18974d[_0x13a76d],'closed':!![]});}}})[_0x5f60('0x1a')](function(_0x2e9e9d){logger[_0x5f60('0x1b')](_0x5f60('0x1c'),_0x2e9e9d?util[_0x5f60('0x1d')](_0x2e9e9d,{'showHidden':![],'depth':null}):'');});}exports[_0x5f60('0x1e')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x1b32=['length','map','[CHAT]\x20Interactions\x20to\x20close:','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','info','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','join','emit','catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','moment','ioredis','util','../../config/environment','../logger','schedule','redis','localhost','socket.io-emitter','Setting','find','chatTimeout','findAll','lastMsgAt','minutes','then'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0x1b32,0x90));var _0x21b3=function(_0x7e2eb0,_0x17cd58){_0x7e2eb0=_0x7e2eb0-0x0;var _0xd92de4=_0x1b32[_0x7e2eb0];return _0xd92de4;};'use strict';var _=require('lodash');var moment=require(_0x21b3('0x0'));var Redis=require(_0x21b3('0x1'));var util=require(_0x21b3('0x2'));var config=require(_0x21b3('0x3'));var db=require('../../mysqldb')['db'];var logger=require(_0x21b3('0x4'))(_0x21b3('0x5'));config[_0x21b3('0x6')]=_['defaults'](config[_0x21b3('0x6')],{'host':_0x21b3('0x7'),'port':0x18eb});var io=require(_0x21b3('0x8'))(new Redis(config['redis']));function closeInteractions(){var _0x459bdd=0x0;var _0x3a7843=[];return db[_0x21b3('0x9')][_0x21b3('0xa')]({'raw':!![],'attributes':['id',_0x21b3('0xb')],'where':{'id':0x1}})['then'](function(_0xe0be31){_0x459bdd=_0xe0be31[_0x21b3('0xb')];if(_0x459bdd){return db['ChatInteraction'][_0x21b3('0xc')]({'raw':!![],'attributes':['id',_0x21b3('0xd')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0xe0be31[_0x21b3('0xb')],_0x21b3('0xe'))}}});}else{return[];}})[_0x21b3('0xf')](function(_0x3a5f55){if(_0x3a5f55&&_0x3a5f55[_0x21b3('0x10')]){_0x3a7843=_[_0x21b3('0x11')](_0x3a5f55||[],'id');logger['info'](_0x21b3('0x12'),_0x3a7843['join']());return db['ChatInteraction'][_0x21b3('0x13')]({'closeReason':_0x21b3('0x14'),'disposition':_0x21b3('0x15'),'closed':!![],'closedAt':moment()[_0x21b3('0x16')](_0x21b3('0x17'))},{'where':{'id':_0x3a7843}});}})[_0x21b3('0xf')](function(){if(_0x3a7843&&_0x3a7843[_0x21b3('0x10')]){logger[_0x21b3('0x18')](_0x21b3('0x19'),_0x3a7843[_0x21b3('0x1a')]());for(var _0x53f3ee=0x0;_0x53f3ee<_0x3a7843[_0x21b3('0x10')];_0x53f3ee++){io[_0x21b3('0x1b')]('chatInteraction:update',{'id':_0x3a7843[_0x53f3ee],'closed':!![]});}}})[_0x21b3('0x1c')](function(_0x3b0e88){logger[_0x21b3('0x1d')](_0x21b3('0x1e'),_0x3b0e88?util[_0x21b3('0x1f')](_0x3b0e88,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/schedule/cloud-provider.js b/server/config/schedule/cloud-provider.js index e11b2eb..8925b23 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 _0xf9e5=['exports'];(function(_0x5ac1e5,_0x4b5012){var _0x1bccc6=function(_0x102562){while(--_0x102562){_0x5ac1e5['push'](_0x5ac1e5['shift']());}};_0x1bccc6(++_0x4b5012);}(_0xf9e5,0x1d3));var _0x5f9e=function(_0xdb4941,_0x5ddc54){_0xdb4941=_0xdb4941-0x0;var _0x2b3770=_0xf9e5[_0xdb4941];return _0x2b3770;};'use strict';function start(){var _0x4f5d05=require('../../api/cloudProvider/cloudProvider.oauth.js');return _0x4f5d05['startAllRefreshIntervals']();}module[_0x5f9e('0x0')]={'intervals':{},'start':start}; \ No newline at end of file +var _0x3a8b=['../../api/cloudProvider/cloudProvider.oauth.js','startAllRefreshIntervals','exports'];(function(_0x397c8d,_0xf0a1a4){var _0x1c5b0a=function(_0x4585d8){while(--_0x4585d8){_0x397c8d['push'](_0x397c8d['shift']());}};_0x1c5b0a(++_0xf0a1a4);}(_0x3a8b,0xa2));var _0xb3a8=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0x3a8b[_0x2dadb9];return _0x2f0097;};'use strict';function start(){var _0x3e272f=require(_0xb3a8('0x0'));return _0x3e272f[_0xb3a8('0x1')]();}module[_0xb3a8('0x2')]={'intervals':{},'start':start}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index 47e41ff..43c3d55 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 _0xe20e=['data','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','CustomReportId','exec\x20custom\x20report\x20id:%s','runReport','no\x20report\x20id','Schedule','findAll','MailServerOut','CloudProvider','keys','jobs','map','toString','difference','intersection','length','exists','stop','toRun','index','my\x20id','run\x20job','active','isBetween','startAt','endAt','add','start','add\x20cron','deleteJob','cron','update','update\x20cron','stop\x20cron','run','path','moment','cron-job-manager','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','getSmtpOptions','\x22%s\x22\x20<%s>','name','Smtp','user','format','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','join','../../files/reports','savename','%s.%s','basename','extname','zip','existsSync','Sent','message','attachments','text','stringify','status','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','request','SendMail','then','error','email\x20sent','catch','error\x20mail'];(function(_0x3d32c5,_0x8a7bcb){var _0x5b3d3f=function(_0x27221f){while(--_0x27221f){_0x3d32c5['push'](_0x3d32c5['shift']());}};_0x5b3d3f(++_0x8a7bcb);}(_0xe20e,0x1ed));var _0xee20=function(_0x45bfbc,_0x1ff15e){_0x45bfbc=_0x45bfbc-0x0;var _0x407018=_0xe20e[_0x45bfbc];return _0x407018;};'use strict';var fs=require('fs');var util=require('util');var path=require(_0xee20('0x0'));var _=require('lodash');var moment=require(_0xee20('0x1'));var CronJobManager=require(_0xee20('0x2'));var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0xee20('0x3'))(_0xee20('0x4'));var db=require(_0xee20('0x5'))['db'];var analyticCustomReportController=require(_0xee20('0x6'));var analyticDefaultReportController=require(_0xee20('0x7'));var client=jayson[_0xee20('0x8')][_0xee20('0x9')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x544d4b,_0x2924fe){return function(){logger[_0xee20('0xa')](_0xee20('0xb'),_0x544d4b[_0xee20('0xc')]);var _0x4717ba=!![];var _0x35eae8=_0x544d4b[_0xee20('0xd')][_0xee20('0xe')]();var _0x557dc5={'account':_0x35eae8,'message':{'from':util['format'](_0xee20('0xf'),_0x544d4b[_0xee20('0xd')][_0xee20('0x10')],_0x544d4b[_0xee20('0xd')][_0xee20('0xc')]||_0x544d4b[_0xee20('0xd')][_0xee20('0x11')][_0xee20('0x12')]),'to':_0x544d4b['email'],'cc':_0x544d4b['cc'],'bcc':_0x544d4b['bcc'],'subject':util[_0xee20('0x13')](_0xee20('0x14'),_0x2924fe[_0xee20('0x10')],_0x544d4b[_0xee20('0x15')],_0x544d4b[_0xee20('0x16')])}};var _0x3e5478=path[_0xee20('0x17')](__dirname,_0xee20('0x18'));var _0x37f294=_0x2924fe[_0xee20('0x19')];var _0xa6587e=util[_0xee20('0x13')](_0xee20('0x1a'),path[_0xee20('0x1b')](_0x2924fe['savename'],path[_0xee20('0x1c')](_0x2924fe[_0xee20('0x19')])),_0xee20('0x1d'));var _0x1d6341=path[_0xee20('0x17')](_0x3e5478,_0x37f294);var _0x1cf61b=path[_0xee20('0x17')](_0x3e5478,_0xa6587e);if(fs[_0xee20('0x1e')](_0x1d6341)){_0x2924fe['status']=_0xee20('0x1f');_0x557dc5[_0xee20('0x20')][_0xee20('0x21')]=[{'filename':_0x37f294,'path':_0x1d6341}];_0x557dc5[_0xee20('0x20')][_0xee20('0x22')]=util[_0xee20('0x13')]('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON[_0xee20('0x23')](_0x2924fe,null,0x2));}else if(fs[_0xee20('0x1e')](_0x1cf61b)){_0x2924fe[_0xee20('0x24')]=_0xee20('0x1f');_0x557dc5[_0xee20('0x20')]['attachments']=[{'filename':_0xa6587e,'path':_0x1cf61b}];}else{_0x557dc5[_0xee20('0x20')]['text']=_0xee20('0x25');if(!_0x544d4b[_0xee20('0x26')]){_0x4717ba=![];logger[_0xee20('0xa')](_0xee20('0x27'));}}if(_0x4717ba){return client[_0xee20('0x28')](_0xee20('0x29'),_0x557dc5)[_0xee20('0x2a')](function(_0x3024d3){if(_0x3024d3[_0xee20('0x2b')]){return logger[_0xee20('0x2b')]('error\x20mail',JSON[_0xee20('0x23')](_0x3024d3));}return logger[_0xee20('0xa')](_0xee20('0x2c'));})[_0xee20('0x2d')](function(_0x3ee843){return logger['error'](_0xee20('0x2e'),JSON[_0xee20('0x23')](_0x3ee843));});}};}function handleError(){return function(_0x4ec5f6){return logger[_0xee20('0x2b')](JSON[_0xee20('0x23')](_0x4ec5f6));};}function handleResult(_0x367180){return function(_0x2fb27e){logger['info'](_0xee20('0x2f'),JSON[_0xee20('0x23')](_0x2fb27e));if(_0x367180[_0xee20('0xd')]&&_0x367180[_0xee20('0xd')]['Smtp']&&!_[_0xee20('0x30')](_0x367180[_0xee20('0xc')])){setTimeout(handleSendEmail(_0x367180,_0x2fb27e),0x3c*0x3e8);}};}function handleJob(_0x36922d){return function(){try{if(_[_0xee20('0x30')](_0x36922d[_0xee20('0x15')])){return logger['info'](_0xee20('0x31'));}if(_[_0xee20('0x30')](_0x36922d[_0xee20('0x16')])){return logger[_0xee20('0xa')](_0xee20('0x32'));}var _0xec92d0={'startDate':moment()[_0xee20('0x33')](_0x36922d[_0xee20('0x15')],_0x36922d['subtractUnit'])['format'](_0xee20('0x34')),'endDate':moment()['format'](_0xee20('0x34')),'type':_0xee20('0x35'),'output':_0x36922d[_0xee20('0x36')],'name':_0x36922d['name']};if(!_['isNil'](_0x36922d[_0xee20('0x37')])){logger[_0xee20('0xa')]('exec\x20defaul\x20report\x20id:%s',_0x36922d[_0xee20('0x37')]);return analyticDefaultReportController['runReport']({'id':_0x36922d[_0xee20('0x37')]},_0xec92d0)[_0xee20('0x2a')](handleResult(_0x36922d))['catch'](handleError());}if(!_[_0xee20('0x30')](_0x36922d[_0xee20('0x38')])){logger['info'](_0xee20('0x39'),_0x36922d[_0xee20('0x38')]);return analyticCustomReportController[_0xee20('0x3a')]({'id':_0x36922d[_0xee20('0x38')]},_0xec92d0)[_0xee20('0x2a')](handleResult(_0x36922d))[_0xee20('0x2d')](handleError());}}catch(_0x1ef802){logger[_0xee20('0x2b')](JSON[_0xee20('0x23')](_0x1ef802));}return logger['info'](_0xee20('0x3b'));};}function getJobs(_0x2039cc){var _0x5a406a={};if(_0x2039cc){_0x5a406a['id']=_0x2039cc;}return db[_0xee20('0x3c')][_0xee20('0x3d')]({'where':_0x5a406a,'include':[{'model':db[_0xee20('0xd')],'attributes':['id','name',_0xee20('0xc')],'include':[{'model':db[_0xee20('0x3e')],'as':'Smtp','include':[{'model':db[_0xee20('0x3f')],'as':_0xee20('0x3f')}]}]}]})[_0xee20('0x2a')](function(_0x392500){var _0x3795d6=_[_0xee20('0x40')](manager[_0xee20('0x41')]);var _0x4ea684=_[_0xee20('0x42')](_0x392500,function(_0x4de5c5){return _0x4de5c5['id'][_0xee20('0x43')]();});var _0x1d018f=_['keyBy'](_0x392500,function(_0x44607e){return _0x44607e['id']['toString']();});var _0x371c48=_0x2039cc?_0x4ea684:_[_0xee20('0x44')](_0x4ea684,_0x3795d6);var _0x17670d=_[_0xee20('0x45')](_0x4ea684,_0x3795d6);var _0x3cc195=_[_0xee20('0x44')](_0x3795d6,_0x4ea684);var _0x5e2754;var _0x2a2fb2;for(_0x5e2754=0x0;_0x5e2754<_0x3cc195[_0xee20('0x46')]&&!_0x2039cc;_0x5e2754+=0x1){_0x2a2fb2=_0x3cc195[_0x5e2754][_0xee20('0x43')]();if(manager[_0xee20('0x47')](_0x2a2fb2)){manager[_0xee20('0x48')](_0x2a2fb2);manager['deleteJob'](_0x2a2fb2);logger[_0xee20('0xa')]('delete\x20cron',_0x2a2fb2);}}logger[_0xee20('0xa')](_0xee20('0x49'),JSON[_0xee20('0x23')](_0x371c48));for(_0x5e2754=0x0;_0x5e2754<_0x371c48[_0xee20('0x46')];_0x5e2754+=0x1){_0x2a2fb2=_0x371c48[_0x5e2754][_0xee20('0x43')]();logger['info'](_0xee20('0x4a'),_0x2a2fb2);if(_0x2039cc){logger[_0xee20('0xa')](_0xee20('0x4b'),_0x2039cc);logger[_0xee20('0xa')](JSON[_0xee20('0x23')](_0x1d018f[_0x2a2fb2]));BPromise['resolve']()[_0xee20('0x2a')](handleJob(_0x1d018f[_0x2a2fb2]));logger[_0xee20('0xa')](_0xee20('0x4c'),_0x1d018f[_0x2a2fb2][_0xee20('0x10')],_0x1d018f[_0x2a2fb2]['cron']);}else if(_0x1d018f[_0x2a2fb2]['cron']&&_0x1d018f[_0x2a2fb2][_0xee20('0x4d')]&&moment()[_0xee20('0x4e')](_0x1d018f[_0x2a2fb2][_0xee20('0x4f')],_0x1d018f[_0x2a2fb2][_0xee20('0x50')])){manager[_0xee20('0x51')](_0x2a2fb2,_0x1d018f[_0x2a2fb2]['cron'],handleJob(_0x1d018f[_0x2a2fb2]));manager[_0xee20('0x52')](_0x2a2fb2);logger['info'](_0xee20('0x53'),_0x1d018f[_0x2a2fb2]['name'],_0x1d018f[_0x2a2fb2]['cron']);}else if(manager[_0xee20('0x47')](_0x2a2fb2)){manager[_0xee20('0x48')](_0x2a2fb2);manager[_0xee20('0x54')](_0x2a2fb2);logger[_0xee20('0xa')]('stop\x20cron',_0x1d018f[_0x2a2fb2][_0xee20('0x10')],_0x1d018f[_0x2a2fb2][_0xee20('0x55')]);}}for(_0x5e2754=0x0,_0x2a2fb2;_0x5e2754<_0x17670d[_0xee20('0x46')]&&!_0x2039cc;_0x5e2754+=0x1){_0x2a2fb2=_0x17670d[_0x5e2754][_0xee20('0x43')]();if(manager[_0xee20('0x47')](_0x2a2fb2)){if(_0x1d018f[_0x2a2fb2][_0xee20('0x55')]&&_0x1d018f[_0x2a2fb2][_0xee20('0x4d')]&&moment()['isBetween'](_0x1d018f[_0x2a2fb2][_0xee20('0x4f')],_0x1d018f[_0x2a2fb2][_0xee20('0x50')])){manager[_0xee20('0x56')](_0x2a2fb2,_0x1d018f[_0x2a2fb2][_0xee20('0x55')],handleJob(_0x1d018f[_0x2a2fb2]));logger[_0xee20('0xa')](_0xee20('0x57'),_0x1d018f[_0x2a2fb2][_0xee20('0x10')],_0x1d018f[_0x2a2fb2][_0xee20('0x55')]);}else{manager[_0xee20('0x48')](_0x2a2fb2);manager[_0xee20('0x54')](_0x2a2fb2);logger[_0xee20('0xa')](_0xee20('0x58'),_0x1d018f[_0x2a2fb2]['name'],_0x1d018f[_0x2a2fb2][_0xee20('0x55')]);}}}})[_0xee20('0x2d')](function(_0x4e781d){logger[_0xee20('0x2b')](JSON['stringify'](_0x4e781d));});}exports[_0xee20('0x59')]=function(_0x3fdeeb){return getJobs(_0x3fdeeb);};exports[_0xee20('0x52')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x6800=['index','run\x20job','active','startAt','endAt','add','start','add\x20cron','cron','stop','stop\x20cron','isBetween','update','update\x20cron','run','util','path','cron-job-manager','jayson/promise','bluebird','../logger','schedule','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','info','Try\x20to\x20send\x20a\x20mail\x20to','MailAccount','getSmtpOptions','\x22%s\x22\x20<%s>','name','Smtp','user','format','subtractNumber','subtractUnit','../../files/reports','savename','%s.%s','zip','join','existsSync','status','Sent','attachments','message','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','request','SendMail','then','error','error\x20mail','catch','data','email','isNil','subtractNumber\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','exec\x20custom\x20report\x20id:%s','CustomReportId','no\x20report\x20id','CloudProvider','keys','jobs','map','toString','keyBy','difference','intersection','length','exists','deleteJob','delete\x20cron','toRun'];(function(_0x14996e,_0x108636){var _0x2f0151=function(_0x20dd91){while(--_0x20dd91){_0x14996e['push'](_0x14996e['shift']());}};_0x2f0151(++_0x108636);}(_0x6800,0x15f));var _0x0680=function(_0x587b10,_0x3c6c79){_0x587b10=_0x587b10-0x0;var _0x32c539=_0x6800[_0x587b10];return _0x32c539;};'use strict';var fs=require('fs');var util=require(_0x0680('0x0'));var path=require(_0x0680('0x1'));var _=require('lodash');var moment=require('moment');var CronJobManager=require(_0x0680('0x2'));var jayson=require(_0x0680('0x3'));var BPromise=require(_0x0680('0x4'));var logger=require(_0x0680('0x5'))(_0x0680('0x6'));var db=require('../../mysqldb')['db'];var analyticCustomReportController=require(_0x0680('0x7'));var analyticDefaultReportController=require(_0x0680('0x8'));var client=jayson[_0x0680('0x9')]['http']({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x4ebb1c,_0x18798a){return function(){logger[_0x0680('0xa')](_0x0680('0xb'),_0x4ebb1c['email']);var _0x45fe91=!![];var _0x5a6049=_0x4ebb1c[_0x0680('0xc')][_0x0680('0xd')]();var _0x5e95d7={'account':_0x5a6049,'message':{'from':util['format'](_0x0680('0xe'),_0x4ebb1c[_0x0680('0xc')][_0x0680('0xf')],_0x4ebb1c['MailAccount']['email']||_0x4ebb1c['MailAccount'][_0x0680('0x10')][_0x0680('0x11')]),'to':_0x4ebb1c['email'],'cc':_0x4ebb1c['cc'],'bcc':_0x4ebb1c['bcc'],'subject':util[_0x0680('0x12')]('Report\x20%s\x20last\x20%s\x20%s',_0x18798a['name'],_0x4ebb1c[_0x0680('0x13')],_0x4ebb1c[_0x0680('0x14')])}};var _0x1baad0=path['join'](__dirname,_0x0680('0x15'));var _0x2d8418=_0x18798a[_0x0680('0x16')];var _0x25acc2=util['format'](_0x0680('0x17'),path['basename'](_0x18798a[_0x0680('0x16')],path['extname'](_0x18798a[_0x0680('0x16')])),_0x0680('0x18'));var _0x2b4953=path[_0x0680('0x19')](_0x1baad0,_0x2d8418);var _0x543361=path[_0x0680('0x19')](_0x1baad0,_0x25acc2);if(fs[_0x0680('0x1a')](_0x2b4953)){_0x18798a[_0x0680('0x1b')]=_0x0680('0x1c');_0x5e95d7['message'][_0x0680('0x1d')]=[{'filename':_0x2d8418,'path':_0x2b4953}];_0x5e95d7[_0x0680('0x1e')][_0x0680('0x1f')]=util[_0x0680('0x12')](_0x0680('0x20'),JSON[_0x0680('0x21')](_0x18798a,null,0x2));}else if(fs[_0x0680('0x1a')](_0x543361)){_0x18798a['status']=_0x0680('0x1c');_0x5e95d7['message'][_0x0680('0x1d')]=[{'filename':_0x25acc2,'path':_0x543361}];}else{_0x5e95d7[_0x0680('0x1e')]['text']=_0x0680('0x22');if(!_0x4ebb1c[_0x0680('0x23')]){_0x45fe91=![];logger['info'](_0x0680('0x24'));}}if(_0x45fe91){return client[_0x0680('0x25')](_0x0680('0x26'),_0x5e95d7)[_0x0680('0x27')](function(_0x1b9541){if(_0x1b9541[_0x0680('0x28')]){return logger[_0x0680('0x28')](_0x0680('0x29'),JSON['stringify'](_0x1b9541));}return logger['info']('email\x20sent');})[_0x0680('0x2a')](function(_0x1dfe60){return logger['error'](_0x0680('0x29'),JSON[_0x0680('0x21')](_0x1dfe60));});}};}function handleError(){return function(_0x5d7fd9){return logger[_0x0680('0x28')](JSON[_0x0680('0x21')](_0x5d7fd9));};}function handleResult(_0x3057e8){return function(_0xfe8313){logger[_0x0680('0xa')](_0x0680('0x2b'),JSON[_0x0680('0x21')](_0xfe8313));if(_0x3057e8[_0x0680('0xc')]&&_0x3057e8['MailAccount'][_0x0680('0x10')]&&!_['isNil'](_0x3057e8[_0x0680('0x2c')])){setTimeout(handleSendEmail(_0x3057e8,_0xfe8313),0x3c*0x3e8);}};}function handleJob(_0x1dbf50){return function(){try{if(_[_0x0680('0x2d')](_0x1dbf50[_0x0680('0x13')])){return logger[_0x0680('0xa')](_0x0680('0x2e'));}if(_[_0x0680('0x2d')](_0x1dbf50[_0x0680('0x14')])){return logger['info']('subtractUnit\x20null\x20or\x20undefined');}var _0x516a6d={'startDate':moment()['subtract'](_0x1dbf50[_0x0680('0x13')],_0x1dbf50['subtractUnit'])[_0x0680('0x12')](_0x0680('0x2f')),'endDate':moment()['format'](_0x0680('0x2f')),'type':_0x0680('0x30'),'output':_0x1dbf50[_0x0680('0x31')],'name':_0x1dbf50[_0x0680('0xf')]};if(!_[_0x0680('0x2d')](_0x1dbf50[_0x0680('0x32')])){logger[_0x0680('0xa')](_0x0680('0x33'),_0x1dbf50[_0x0680('0x32')]);return analyticDefaultReportController[_0x0680('0x34')]({'id':_0x1dbf50[_0x0680('0x32')]},_0x516a6d)[_0x0680('0x27')](handleResult(_0x1dbf50))[_0x0680('0x2a')](handleError());}if(!_[_0x0680('0x2d')](_0x1dbf50['CustomReportId'])){logger[_0x0680('0xa')](_0x0680('0x35'),_0x1dbf50[_0x0680('0x36')]);return analyticCustomReportController[_0x0680('0x34')]({'id':_0x1dbf50['CustomReportId']},_0x516a6d)['then'](handleResult(_0x1dbf50))[_0x0680('0x2a')](handleError());}}catch(_0x4aecd1){logger[_0x0680('0x28')](JSON['stringify'](_0x4aecd1));}return logger[_0x0680('0xa')](_0x0680('0x37'));};}function getJobs(_0xc733c8){var _0x539a71={};if(_0xc733c8){_0x539a71['id']=_0xc733c8;}return db['Schedule']['findAll']({'where':_0x539a71,'include':[{'model':db[_0x0680('0xc')],'attributes':['id',_0x0680('0xf'),_0x0680('0x2c')],'include':[{'model':db['MailServerOut'],'as':_0x0680('0x10'),'include':[{'model':db[_0x0680('0x38')],'as':_0x0680('0x38')}]}]}]})['then'](function(_0x4f7e4d){var _0x3c1091=_[_0x0680('0x39')](manager[_0x0680('0x3a')]);var _0x576146=_[_0x0680('0x3b')](_0x4f7e4d,function(_0x4e3ee4){return _0x4e3ee4['id'][_0x0680('0x3c')]();});var _0x3379bd=_[_0x0680('0x3d')](_0x4f7e4d,function(_0x536b5e){return _0x536b5e['id'][_0x0680('0x3c')]();});var _0x35e34b=_0xc733c8?_0x576146:_[_0x0680('0x3e')](_0x576146,_0x3c1091);var _0x937f9c=_[_0x0680('0x3f')](_0x576146,_0x3c1091);var _0x3695fa=_[_0x0680('0x3e')](_0x3c1091,_0x576146);var _0x5a9d41;var _0x22630b;for(_0x5a9d41=0x0;_0x5a9d41<_0x3695fa[_0x0680('0x40')]&&!_0xc733c8;_0x5a9d41+=0x1){_0x22630b=_0x3695fa[_0x5a9d41][_0x0680('0x3c')]();if(manager[_0x0680('0x41')](_0x22630b)){manager['stop'](_0x22630b);manager[_0x0680('0x42')](_0x22630b);logger[_0x0680('0xa')](_0x0680('0x43'),_0x22630b);}}logger[_0x0680('0xa')](_0x0680('0x44'),JSON[_0x0680('0x21')](_0x35e34b));for(_0x5a9d41=0x0;_0x5a9d41<_0x35e34b['length'];_0x5a9d41+=0x1){_0x22630b=_0x35e34b[_0x5a9d41][_0x0680('0x3c')]();logger[_0x0680('0xa')](_0x0680('0x45'),_0x22630b);if(_0xc733c8){logger[_0x0680('0xa')]('my\x20id',_0xc733c8);logger[_0x0680('0xa')](JSON[_0x0680('0x21')](_0x3379bd[_0x22630b]));BPromise['resolve']()[_0x0680('0x27')](handleJob(_0x3379bd[_0x22630b]));logger[_0x0680('0xa')](_0x0680('0x46'),_0x3379bd[_0x22630b][_0x0680('0xf')],_0x3379bd[_0x22630b]['cron']);}else if(_0x3379bd[_0x22630b]['cron']&&_0x3379bd[_0x22630b][_0x0680('0x47')]&&moment()['isBetween'](_0x3379bd[_0x22630b][_0x0680('0x48')],_0x3379bd[_0x22630b][_0x0680('0x49')])){manager[_0x0680('0x4a')](_0x22630b,_0x3379bd[_0x22630b]['cron'],handleJob(_0x3379bd[_0x22630b]));manager[_0x0680('0x4b')](_0x22630b);logger[_0x0680('0xa')](_0x0680('0x4c'),_0x3379bd[_0x22630b][_0x0680('0xf')],_0x3379bd[_0x22630b][_0x0680('0x4d')]);}else if(manager[_0x0680('0x41')](_0x22630b)){manager[_0x0680('0x4e')](_0x22630b);manager[_0x0680('0x42')](_0x22630b);logger[_0x0680('0xa')](_0x0680('0x4f'),_0x3379bd[_0x22630b][_0x0680('0xf')],_0x3379bd[_0x22630b][_0x0680('0x4d')]);}}for(_0x5a9d41=0x0,_0x22630b;_0x5a9d41<_0x937f9c[_0x0680('0x40')]&&!_0xc733c8;_0x5a9d41+=0x1){_0x22630b=_0x937f9c[_0x5a9d41]['toString']();if(manager[_0x0680('0x41')](_0x22630b)){if(_0x3379bd[_0x22630b]['cron']&&_0x3379bd[_0x22630b][_0x0680('0x47')]&&moment()[_0x0680('0x50')](_0x3379bd[_0x22630b][_0x0680('0x48')],_0x3379bd[_0x22630b][_0x0680('0x49')])){manager[_0x0680('0x51')](_0x22630b,_0x3379bd[_0x22630b][_0x0680('0x4d')],handleJob(_0x3379bd[_0x22630b]));logger['info'](_0x0680('0x52'),_0x3379bd[_0x22630b][_0x0680('0xf')],_0x3379bd[_0x22630b]['cron']);}else{manager[_0x0680('0x4e')](_0x22630b);manager['deleteJob'](_0x22630b);logger[_0x0680('0xa')](_0x0680('0x4f'),_0x3379bd[_0x22630b][_0x0680('0xf')],_0x3379bd[_0x22630b][_0x0680('0x4d')]);}}}})['catch'](function(_0x1b62e5){logger['error'](JSON[_0x0680('0x21')](_0x1b62e5));});}exports[_0x0680('0x53')]=function(_0x1604db){return getJobs(_0x1604db);};exports[_0x0680('0x4b')]=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 f4fa50a..b776033 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 _0xb4e2=['resolve','Sentiment','Mixed','catch','name','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','findAll','No\x20transcribe\x20job\x20to\x20check','Setting','bucket','CloudProvider','transcribeAccountId','forEach','push','all','error','start','lodash','util','transcribe','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','transcribeRegion','then','TranscriptionJobStatus','fileText','TranscriptionJob','COMPLETED','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','Transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','Sequelize','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','findOne','Cloud\x20Provider\x20not\x20available','data2','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','sentimentRegion','language','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','SentimentScore','Positive','Negative','Neutral','FAILED','FailureReason'];(function(_0x3e32b1,_0x487a75){var _0x419327=function(_0x6ad6a3){while(--_0x6ad6a3){_0x3e32b1['push'](_0x3e32b1['shift']());}};_0x419327(++_0x487a75);}(_0xb4e2,0x1aa));var _0x2b4e=function(_0x3b6d37,_0x131aaa){_0x3b6d37=_0x3b6d37-0x0;var _0x1bdb29=_0xb4e2[_0x3b6d37];return _0x1bdb29;};var _=require(_0x2b4e('0x0'));var AWS=require('aws-sdk');var rp=require('request-promise');var util=require(_0x2b4e('0x1'));var BPromise=require('bluebird');var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')(_0x2b4e('0x2'));function getTranscriptionJob(_0x681c21,_0x14fbca,_0x1131c0,_0xf07f95){return new Promise(function(_0x1a77ed,_0x10f028){var _0x4a84a9=new AWS[(_0x2b4e('0x3'))]({'accessKeyId':_0x14fbca,'secretAccessKey':_0x681c21,'region':_0x1131c0});_0x4a84a9[_0x2b4e('0x4')]({'TranscriptionJobName':_0xf07f95},function(_0x36f83e,_0x36a811){if(_0x36f83e){return _0x10f028(_0x36f83e);}else{return _0x1a77ed(_0x36a811);}});});}function sentiment(_0x32795f,_0x2208ce,_0x3fd14e,_0x14bb06,_0xfaa7ec){return new Promise(function(_0x3015e6,_0x16b4ae){var _0xa05d7e=new AWS[(_0x2b4e('0x5'))]({'accessKeyId':_0x2208ce,'secretAccessKey':_0x32795f,'region':_0x3fd14e});_0xa05d7e[_0x2b4e('0x6')]({'Text':_0x14bb06,'LanguageCode':_0xfaa7ec['substring'](0x0,0x2)},function(_0xcbeaff,_0x1315aa){if(_0xcbeaff){return _0x16b4ae(_0xcbeaff);}else{return _0x3015e6(_0x1315aa);}});});}function checkTranscribeJob(_0x1cf80d,_0xca0a0e,_0x595fcc){var _0x8531ed;return new BPromise(function(_0x579559,_0x41d2a1){logger[_0x2b4e('0x7')](util[_0x2b4e('0x8')](_0x2b4e('0x9'),_0x1cf80d['id'],_0x1cf80d[_0x2b4e('0xa')]));return getTranscriptionJob(_0x595fcc[_0x2b4e('0xb')],_0x595fcc['data2'],_0xca0a0e[_0x2b4e('0xc')],_0x1cf80d[_0x2b4e('0xa')])[_0x2b4e('0xd')](function(_0x4d329f){logger[_0x2b4e('0x7')](util[_0x2b4e('0x8')]('[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s',_0x1cf80d['id'],_0x1cf80d[_0x2b4e('0xa')],_0x4d329f['TranscriptionJob'][_0x2b4e('0xe')]));if(!_0x1cf80d[_0x2b4e('0xf')]){switch(_0x4d329f[_0x2b4e('0x10')][_0x2b4e('0xe')]){case _0x2b4e('0x11'):var _0x36d927={'transcribeStatus':_0x4d329f[_0x2b4e('0x10')][_0x2b4e('0xe')],'fileUri':_0x4d329f[_0x2b4e('0x10')]['Transcript'][_0x2b4e('0x12')]};logger['info'](util[_0x2b4e('0x8')](_0x2b4e('0x13'),_0x1cf80d['id']));return rp({'uri':_0x4d329f[_0x2b4e('0x10')][_0x2b4e('0x14')]['TranscriptFileUri'],'json':!![]})[_0x2b4e('0xd')](function(_0xdb887f){logger[_0x2b4e('0x7')](util['format'](_0x2b4e('0x15'),_0x1cf80d['id']));if(_0xdb887f&&_0xdb887f[_0x2b4e('0x16')]&&_0xdb887f['results'][_0x2b4e('0x17')]&&_0xdb887f['results'][_0x2b4e('0x17')][_0x2b4e('0x18')]){_0x36d927['fileText']='';for(var _0x5e37f7=0x0;_0x5e37f7<_0xdb887f[_0x2b4e('0x16')][_0x2b4e('0x17')][_0x2b4e('0x18')];_0x5e37f7++){_0x36d927['fileText']+=_0xdb887f[_0x2b4e('0x16')][_0x2b4e('0x17')][_0x5e37f7][_0x2b4e('0x19')]+'';}}return _0x1cf80d[_0x2b4e('0x1a')](_0x36d927);})[_0x2b4e('0xd')](function(){logger[_0x2b4e('0x7')](util[_0x2b4e('0x8')](_0x2b4e('0x1b'),_0x1cf80d['id']));if(!_0x1cf80d[_0x2b4e('0x1c')]){throw new db['Sequelize'][(_0x2b4e('0x1d'))](_0x2b4e('0x1e'));}if(!_0xca0a0e[_0x2b4e('0x1f')]||!_0xca0a0e[_0x2b4e('0x20')]||!_0xca0a0e['sentimentRegion']||!_0xca0a0e['language']||!_0xca0a0e['bucket']){throw new db[(_0x2b4e('0x21'))][(_0x2b4e('0x1d'))](_0x2b4e('0x22'));}if(!_0x36d927['fileText']){throw new Error(_0x2b4e('0x23'));}if(_0xca0a0e[_0x2b4e('0x20')]===_0x595fcc['id']){return _0x595fcc;}else{return db['CloudProvider'][_0x2b4e('0x24')]({'where':{'id':_settings[_0x2b4e('0x20')]}});}})[_0x2b4e('0xd')](function(_0x19618a){if(!_0x19618a){throw new db[(_0x2b4e('0x21'))][(_0x2b4e('0x1d'))](_0x2b4e('0x25'));}if(!_0x19618a['data1']||!_0x19618a[_0x2b4e('0x26')]){throw new db[(_0x2b4e('0x21'))][(_0x2b4e('0x1d'))](_0x2b4e('0x27'));}_0x8531ed=_0x19618a;logger[_0x2b4e('0x7')](util['format'](_0x2b4e('0x28'),_0x1cf80d['id']));return sentiment(_0x8531ed[_0x2b4e('0xb')],_0x8531ed[_0x2b4e('0x26')],_0xca0a0e[_0x2b4e('0x29')],_0x36d927['fileText'],_0xca0a0e[_0x2b4e('0x2a')]);})[_0x2b4e('0xd')](function(_0x58b099){logger['info'](util[_0x2b4e('0x8')](_0x2b4e('0x2b'),_0x1cf80d['id']));return _0x1cf80d[_0x2b4e('0x1a')]({'sentiment':_0x58b099['Sentiment'],'sPositive':_0x58b099[_0x2b4e('0x2c')][_0x2b4e('0x2d')],'sNegative':_0x58b099[_0x2b4e('0x2c')][_0x2b4e('0x2e')],'sMixed':_0x58b099['SentimentScore']['Mixed'],'sNeutral':_0x58b099[_0x2b4e('0x2c')][_0x2b4e('0x2f')]});})[_0x2b4e('0xd')](function(){logger[_0x2b4e('0x7')](util[_0x2b4e('0x8')](_0x2b4e('0x1b'),_0x1cf80d['id']));_0x579559();});case _0x2b4e('0x30'):return _0x1cf80d['update']({'transcribeStatus':'FAILED','failureReason':_0x4d329f['TranscriptionJob'][_0x2b4e('0x31')]})[_0x2b4e('0xd')](function(){logger[_0x2b4e('0x7')](util[_0x2b4e('0x8')](_0x2b4e('0x1b'),_0x1cf80d['id']));_0x579559();});default:logger[_0x2b4e('0x7')](util['format']('[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed',_0x1cf80d['id']));break;}}else{return BPromise[_0x2b4e('0x32')]()['then'](function(){if(!_0x1cf80d[_0x2b4e('0x1c')]){throw new db[(_0x2b4e('0x21'))][(_0x2b4e('0x1d'))](_0x2b4e('0x1e'));}if(!_0xca0a0e[_0x2b4e('0x1f')]||!_0xca0a0e['sentimentAccountId']||!_0xca0a0e[_0x2b4e('0x29')]||!_0xca0a0e[_0x2b4e('0x2a')]||!_0xca0a0e['bucket']){throw new db[(_0x2b4e('0x21'))][(_0x2b4e('0x1d'))](_0x2b4e('0x22'));}if(!_0x1cf80d[_0x2b4e('0xf')]){throw new Error(_0x2b4e('0x23'));}if(_0xca0a0e[_0x2b4e('0x20')]===_0x595fcc['id']){return _0x595fcc;}else{return db['CloudProvider'][_0x2b4e('0x24')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0x2b4e('0xd')](function(_0x5706f2){if(!_0x5706f2){throw new db[(_0x2b4e('0x21'))]['ValidationError'](_0x2b4e('0x25'));}if(!_0x5706f2[_0x2b4e('0xb')]||!_0x5706f2[_0x2b4e('0x26')]){throw new db['Sequelize'][(_0x2b4e('0x1d'))]('Cloud\x20Provider\x20not\x20configured');}_0x8531ed=_0x5706f2;logger[_0x2b4e('0x7')](util['format']('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x1cf80d['id']));return sentiment(_0x8531ed[_0x2b4e('0xb')],_0x8531ed[_0x2b4e('0x26')],_0xca0a0e['sentimentRegion'],_0x1cf80d['fileText'],_0xca0a0e[_0x2b4e('0x2a')]);})[_0x2b4e('0xd')](function(_0x211e58){logger[_0x2b4e('0x7')](util[_0x2b4e('0x8')](_0x2b4e('0x2b'),_0x1cf80d['id']));return _0x1cf80d[_0x2b4e('0x1a')]({'sentiment':_0x211e58[_0x2b4e('0x33')],'sPositive':_0x211e58[_0x2b4e('0x2c')][_0x2b4e('0x2d')],'sNegative':_0x211e58[_0x2b4e('0x2c')][_0x2b4e('0x2e')],'sMixed':_0x211e58[_0x2b4e('0x2c')][_0x2b4e('0x34')],'sNeutral':_0x211e58['SentimentScore']['Neutral'],'transcribeStatus':_0x2b4e('0x11')});})[_0x2b4e('0xd')](function(){logger[_0x2b4e('0x7')](util[_0x2b4e('0x8')](_0x2b4e('0x1b'),_0x1cf80d['id']));_0x579559();});}})[_0x2b4e('0x35')](function(_0x4ffe08){if(_0x4ffe08){if(!_0x4ffe08[_0x2b4e('0x36')]||_0x4ffe08[_0x2b4e('0x36')]!=='SequelizeValidationError'){logger['error'](util[_0x2b4e('0x8')](_0x2b4e('0x37'),_0x1cf80d['id']),util[_0x2b4e('0x38')](_0x4ffe08,{'showHidden':![],'depth':null}));}}_0x579559();});});}function checkTranscribe(){var _0x51bbce;var _0x7c795d;var _0x25aa50;return db['VoiceRecording'][_0x2b4e('0x39')]({'where':{'transcribeStatus':'IN_PROGRESS'}})['then'](function(_0xd9167f){if(!_0xd9167f||!_0xd9167f[_0x2b4e('0x18')]){throw new db['Sequelize'][(_0x2b4e('0x1d'))](_0x2b4e('0x3a'));}_0x51bbce=_0xd9167f;return db[_0x2b4e('0x3b')][_0x2b4e('0x24')]({'where':{'id':0x1}});})[_0x2b4e('0xd')](function(_0x49adea){if(!_0x49adea){throw new db[(_0x2b4e('0x21'))][(_0x2b4e('0x1d'))]('Settings\x20not\x20available');}_0x7c795d=_0x49adea;if(!_0x7c795d[_0x2b4e('0x2')]||!_0x7c795d['transcribeAccountId']||!_0x7c795d[_0x2b4e('0xc')]||!_0x7c795d[_0x2b4e('0x2a')]||!_0x7c795d[_0x2b4e('0x3c')]){throw new db[(_0x2b4e('0x21'))]['ValidationError']('Transcribe\x20not\x20configured');}return db[_0x2b4e('0x3d')][_0x2b4e('0x24')]({'where':{'id':_0x7c795d[_0x2b4e('0x3e')]}});})[_0x2b4e('0xd')](function(_0x58c995){if(!_0x58c995){throw new db[(_0x2b4e('0x21'))][(_0x2b4e('0x1d'))](_0x2b4e('0x25'));}if(!_0x58c995[_0x2b4e('0xb')]||!_0x58c995[_0x2b4e('0x26')]){throw new db[(_0x2b4e('0x21'))][(_0x2b4e('0x1d'))](_0x2b4e('0x27'));}_0x25aa50=_0x58c995;var _0x5ba01c=[];_0x51bbce[_0x2b4e('0x3f')](function(_0x10bdf2){_0x5ba01c[_0x2b4e('0x40')](checkTranscribeJob(_0x10bdf2,_0x7c795d,_0x25aa50));});return BPromise[_0x2b4e('0x41')](_0x5ba01c);})['catch'](function(_0xed21f2){if(_0xed21f2){if(!_0xed21f2['name']||_0xed21f2[_0x2b4e('0x36')]!=='SequelizeValidationError'){logger[_0x2b4e('0x42')](util[_0x2b4e('0x38')](_0xed21f2,{'showHidden':![],'depth':null}));}}});}exports[_0x2b4e('0x43')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x8a5c=['VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','transcribeAccountId','Transcribe\x20not\x20configured','forEach','all','start','lodash','aws-sdk','request-promise','util','bluebird','../../mysqldb','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','substring','info','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','transcribeRegion','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJobStatus','fileText','TranscriptionJob','COMPLETED','Transcript','format','[RECORDING:%d]\x20Get\x20transcript','TranscriptFileUri','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','update','then','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sentiment\x20Analysis\x20not\x20requested','sentimentRegion','language','bucket','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','sentimentAccountId','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','FAILED','FailureReason','resolve','sentiment','Positive','Mixed','Neutral','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect'];(function(_0xf07b75,_0xe27080){var _0x291ae9=function(_0x363b2a){while(--_0x363b2a){_0xf07b75['push'](_0xf07b75['shift']());}};_0x291ae9(++_0xe27080);}(_0x8a5c,0x136));var _0xc8a5=function(_0x2bfae6,_0x335d23){_0x2bfae6=_0x2bfae6-0x0;var _0x19209a=_0x8a5c[_0x2bfae6];return _0x19209a;};var _=require(_0xc8a5('0x0'));var AWS=require(_0xc8a5('0x1'));var rp=require(_0xc8a5('0x2'));var util=require(_0xc8a5('0x3'));var BPromise=require(_0xc8a5('0x4'));var db=require(_0xc8a5('0x5'))['db'];var logger=require(_0xc8a5('0x6'))(_0xc8a5('0x7'));function getTranscriptionJob(_0x84a3f4,_0x4dd6e0,_0x2b253c,_0x66b54){return new Promise(function(_0x5b6cc2,_0x1b4ed4){var _0xcee97e=new AWS[(_0xc8a5('0x8'))]({'accessKeyId':_0x4dd6e0,'secretAccessKey':_0x84a3f4,'region':_0x2b253c});_0xcee97e[_0xc8a5('0x9')]({'TranscriptionJobName':_0x66b54},function(_0x4d25e4,_0x3ecf08){if(_0x4d25e4){return _0x1b4ed4(_0x4d25e4);}else{return _0x5b6cc2(_0x3ecf08);}});});}function sentiment(_0x28529d,_0xbdcd79,_0x2c1fe9,_0x814714,_0x3b2ba3){return new Promise(function(_0x136146,_0x16fd9a){var _0xea6d98=new AWS['Comprehend']({'accessKeyId':_0xbdcd79,'secretAccessKey':_0x28529d,'region':_0x2c1fe9});_0xea6d98['detectSentiment']({'Text':_0x814714,'LanguageCode':_0x3b2ba3[_0xc8a5('0xa')](0x0,0x2)},function(_0x4a772e,_0xaa6fa2){if(_0x4a772e){return _0x16fd9a(_0x4a772e);}else{return _0x136146(_0xaa6fa2);}});});}function checkTranscribeJob(_0x38a605,_0x1295a9,_0x2c6402){var _0x3e1b4f;return new BPromise(function(_0x5c9d13,_0x16cffa){logger[_0xc8a5('0xb')](util['format'](_0xc8a5('0xc'),_0x38a605['id'],_0x38a605[_0xc8a5('0xd')]));return getTranscriptionJob(_0x2c6402[_0xc8a5('0xe')],_0x2c6402[_0xc8a5('0xf')],_0x1295a9[_0xc8a5('0x10')],_0x38a605[_0xc8a5('0xd')])['then'](function(_0xbc4806){logger[_0xc8a5('0xb')](util['format'](_0xc8a5('0x11'),_0x38a605['id'],_0x38a605[_0xc8a5('0xd')],_0xbc4806['TranscriptionJob'][_0xc8a5('0x12')]));if(!_0x38a605[_0xc8a5('0x13')]){switch(_0xbc4806[_0xc8a5('0x14')][_0xc8a5('0x12')]){case _0xc8a5('0x15'):var _0x4b0aa0={'transcribeStatus':_0xbc4806[_0xc8a5('0x14')]['TranscriptionJobStatus'],'fileUri':_0xbc4806[_0xc8a5('0x14')][_0xc8a5('0x16')]['TranscriptFileUri']};logger['info'](util[_0xc8a5('0x17')](_0xc8a5('0x18'),_0x38a605['id']));return rp({'uri':_0xbc4806[_0xc8a5('0x14')][_0xc8a5('0x16')][_0xc8a5('0x19')],'json':!![]})['then'](function(_0x4fec79){logger[_0xc8a5('0xb')](util[_0xc8a5('0x17')](_0xc8a5('0x1a'),_0x38a605['id']));if(_0x4fec79&&_0x4fec79[_0xc8a5('0x1b')]&&_0x4fec79[_0xc8a5('0x1b')][_0xc8a5('0x1c')]&&_0x4fec79['results'][_0xc8a5('0x1c')][_0xc8a5('0x1d')]){_0x4b0aa0[_0xc8a5('0x13')]='';for(var _0x1e522c=0x0;_0x1e522c<_0x4fec79[_0xc8a5('0x1b')][_0xc8a5('0x1c')][_0xc8a5('0x1d')];_0x1e522c++){_0x4b0aa0[_0xc8a5('0x13')]+=_0x4fec79[_0xc8a5('0x1b')]['transcripts'][_0x1e522c][_0xc8a5('0x1e')]+'';}}return _0x38a605[_0xc8a5('0x1f')](_0x4b0aa0);})[_0xc8a5('0x20')](function(){logger[_0xc8a5('0xb')](util[_0xc8a5('0x17')](_0xc8a5('0x21'),_0x38a605['id']));if(!_0x38a605[_0xc8a5('0x22')]){throw new db['Sequelize']['ValidationError'](_0xc8a5('0x23'));}if(!_0x1295a9['sentiment']||!_0x1295a9['sentimentAccountId']||!_0x1295a9[_0xc8a5('0x24')]||!_0x1295a9[_0xc8a5('0x25')]||!_0x1295a9[_0xc8a5('0x26')]){throw new db[(_0xc8a5('0x27'))][(_0xc8a5('0x28'))](_0xc8a5('0x29'));}if(!_0x4b0aa0['fileText']){throw new Error(_0xc8a5('0x2a'));}if(_0x1295a9[_0xc8a5('0x2b')]===_0x2c6402['id']){return _0x2c6402;}else{return db[_0xc8a5('0x2c')][_0xc8a5('0x2d')]({'where':{'id':_settings[_0xc8a5('0x2b')]}});}})[_0xc8a5('0x20')](function(_0x4b47dc){if(!_0x4b47dc){throw new db[(_0xc8a5('0x27'))][(_0xc8a5('0x28'))](_0xc8a5('0x2e'));}if(!_0x4b47dc[_0xc8a5('0xe')]||!_0x4b47dc['data2']){throw new db['Sequelize'][(_0xc8a5('0x28'))](_0xc8a5('0x2f'));}_0x3e1b4f=_0x4b47dc;logger[_0xc8a5('0xb')](util[_0xc8a5('0x17')](_0xc8a5('0x30'),_0x38a605['id']));return sentiment(_0x3e1b4f['data1'],_0x3e1b4f[_0xc8a5('0xf')],_0x1295a9['sentimentRegion'],_0x4b0aa0[_0xc8a5('0x13')],_0x1295a9[_0xc8a5('0x25')]);})[_0xc8a5('0x20')](function(_0x5a2941){logger[_0xc8a5('0xb')](util[_0xc8a5('0x17')](_0xc8a5('0x31'),_0x38a605['id']));return _0x38a605['update']({'sentiment':_0x5a2941[_0xc8a5('0x32')],'sPositive':_0x5a2941[_0xc8a5('0x33')]['Positive'],'sNegative':_0x5a2941[_0xc8a5('0x33')]['Negative'],'sMixed':_0x5a2941['SentimentScore']['Mixed'],'sNeutral':_0x5a2941['SentimentScore']['Neutral']});})[_0xc8a5('0x20')](function(){logger['info'](util[_0xc8a5('0x17')](_0xc8a5('0x21'),_0x38a605['id']));_0x5c9d13();});case _0xc8a5('0x34'):return _0x38a605[_0xc8a5('0x1f')]({'transcribeStatus':_0xc8a5('0x34'),'failureReason':_0xbc4806[_0xc8a5('0x14')][_0xc8a5('0x35')]})['then'](function(){logger[_0xc8a5('0xb')](util[_0xc8a5('0x17')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x38a605['id']));_0x5c9d13();});default:logger[_0xc8a5('0xb')](util['format']('[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed',_0x38a605['id']));break;}}else{return BPromise[_0xc8a5('0x36')]()[_0xc8a5('0x20')](function(){if(!_0x38a605[_0xc8a5('0x22')]){throw new db['Sequelize']['ValidationError'](_0xc8a5('0x23'));}if(!_0x1295a9[_0xc8a5('0x37')]||!_0x1295a9[_0xc8a5('0x2b')]||!_0x1295a9[_0xc8a5('0x24')]||!_0x1295a9['language']||!_0x1295a9[_0xc8a5('0x26')]){throw new db[(_0xc8a5('0x27'))][(_0xc8a5('0x28'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x38a605['fileText']){throw new Error(_0xc8a5('0x2a'));}if(_0x1295a9[_0xc8a5('0x2b')]===_0x2c6402['id']){return _0x2c6402;}else{return db[_0xc8a5('0x2c')][_0xc8a5('0x2d')]({'where':{'id':_settings[_0xc8a5('0x2b')]}});}})['then'](function(_0x2f512f){if(!_0x2f512f){throw new db['Sequelize']['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0x2f512f[_0xc8a5('0xe')]||!_0x2f512f[_0xc8a5('0xf')]){throw new db[(_0xc8a5('0x27'))][(_0xc8a5('0x28'))](_0xc8a5('0x2f'));}_0x3e1b4f=_0x2f512f;logger[_0xc8a5('0xb')](util[_0xc8a5('0x17')](_0xc8a5('0x30'),_0x38a605['id']));return sentiment(_0x3e1b4f[_0xc8a5('0xe')],_0x3e1b4f[_0xc8a5('0xf')],_0x1295a9[_0xc8a5('0x24')],_0x38a605[_0xc8a5('0x13')],_0x1295a9[_0xc8a5('0x25')]);})[_0xc8a5('0x20')](function(_0x5bc633){logger[_0xc8a5('0xb')](util[_0xc8a5('0x17')](_0xc8a5('0x31'),_0x38a605['id']));return _0x38a605[_0xc8a5('0x1f')]({'sentiment':_0x5bc633[_0xc8a5('0x32')],'sPositive':_0x5bc633[_0xc8a5('0x33')][_0xc8a5('0x38')],'sNegative':_0x5bc633[_0xc8a5('0x33')]['Negative'],'sMixed':_0x5bc633['SentimentScore'][_0xc8a5('0x39')],'sNeutral':_0x5bc633[_0xc8a5('0x33')][_0xc8a5('0x3a')],'transcribeStatus':'COMPLETED'});})[_0xc8a5('0x20')](function(){logger[_0xc8a5('0xb')](util['format'](_0xc8a5('0x21'),_0x38a605['id']));_0x5c9d13();});}})[_0xc8a5('0x3b')](function(_0x3e112f){if(_0x3e112f){if(!_0x3e112f[_0xc8a5('0x3c')]||_0x3e112f['name']!==_0xc8a5('0x3d')){logger[_0xc8a5('0x3e')](util[_0xc8a5('0x17')](_0xc8a5('0x3f'),_0x38a605['id']),util[_0xc8a5('0x40')](_0x3e112f,{'showHidden':![],'depth':null}));}}_0x5c9d13();});});}function checkTranscribe(){var _0x45dddf;var _0x5d2435;var _0x1b44df;return db[_0xc8a5('0x41')][_0xc8a5('0x42')]({'where':{'transcribeStatus':_0xc8a5('0x43')}})[_0xc8a5('0x20')](function(_0x1de54a){if(!_0x1de54a||!_0x1de54a[_0xc8a5('0x1d')]){throw new db[(_0xc8a5('0x27'))][(_0xc8a5('0x28'))](_0xc8a5('0x44'));}_0x45dddf=_0x1de54a;return db[_0xc8a5('0x45')][_0xc8a5('0x2d')]({'where':{'id':0x1}});})[_0xc8a5('0x20')](function(_0x568ce2){if(!_0x568ce2){throw new db[(_0xc8a5('0x27'))]['ValidationError']('Settings\x20not\x20available');}_0x5d2435=_0x568ce2;if(!_0x5d2435['transcribe']||!_0x5d2435[_0xc8a5('0x46')]||!_0x5d2435['transcribeRegion']||!_0x5d2435[_0xc8a5('0x25')]||!_0x5d2435[_0xc8a5('0x26')]){throw new db[(_0xc8a5('0x27'))][(_0xc8a5('0x28'))](_0xc8a5('0x47'));}return db[_0xc8a5('0x2c')][_0xc8a5('0x2d')]({'where':{'id':_0x5d2435[_0xc8a5('0x46')]}});})[_0xc8a5('0x20')](function(_0x4f9b24){if(!_0x4f9b24){throw new db[(_0xc8a5('0x27'))][(_0xc8a5('0x28'))](_0xc8a5('0x2e'));}if(!_0x4f9b24[_0xc8a5('0xe')]||!_0x4f9b24[_0xc8a5('0xf')]){throw new db['Sequelize'][(_0xc8a5('0x28'))](_0xc8a5('0x2f'));}_0x1b44df=_0x4f9b24;var _0x21f299=[];_0x45dddf[_0xc8a5('0x48')](function(_0x50218c){_0x21f299['push'](checkTranscribeJob(_0x50218c,_0x5d2435,_0x1b44df));});return BPromise[_0xc8a5('0x49')](_0x21f299);})['catch'](function(_0x43e530){if(_0x43e530){if(!_0x43e530[_0xc8a5('0x3c')]||_0x43e530['name']!==_0xc8a5('0x3d')){logger['error'](util[_0xc8a5('0x40')](_0x43e530,{'showHidden':![],'depth':null}));}}});}exports[_0xc8a5('0x4a')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file diff --git a/server/config/schedule/whatsapp.js b/server/config/schedule/whatsapp.js index f5f6845..0ee71f1 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 _0xb96d=['util','../../config/environment','../../mysqldb','schedule','redis','localhost','socket.io-emitter','WhatsappInteraction','lastMsgAt','subtract','hours','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','system','timeout','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','length','emit','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment'];(function(_0x22f2ed,_0x39f10b){var _0x1963eb=function(_0x51da9f){while(--_0x51da9f){_0x22f2ed['push'](_0x22f2ed['shift']());}};_0x1963eb(++_0x39f10b);}(_0xb96d,0x94));var _0xdb96=function(_0x58965a,_0x2e71db){_0x58965a=_0x58965a-0x0;var _0x254efc=_0xb96d[_0x58965a];return _0x254efc;};'use strict';var _=require(_0xdb96('0x0'));var moment=require(_0xdb96('0x1'));var Redis=require('ioredis');var util=require(_0xdb96('0x2'));var config=require(_0xdb96('0x3'));var db=require(_0xdb96('0x4'))['db'];var logger=require('../logger')(_0xdb96('0x5'));config[_0xdb96('0x6')]=_['defaults'](config[_0xdb96('0x6')],{'host':_0xdb96('0x7'),'port':0x18eb});var io=require(_0xdb96('0x8'))(new Redis(config[_0xdb96('0x6')]));function closeInteractions(){var _0x6d19f5=[];return db[_0xdb96('0x9')]['findAll']({'raw':!![],'attributes':['id',_0xdb96('0xa')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0xdb96('0xb')](0x18,_0xdb96('0xc'))}}})['then'](function(_0x21dce4){if(_0x21dce4&&_0x21dce4['length']){_0x6d19f5=_[_0xdb96('0xd')](_0x21dce4||[],'id');logger[_0xdb96('0xe')](_0xdb96('0xf'),_0x6d19f5[_0xdb96('0x10')]());return db[_0xdb96('0x9')][_0xdb96('0x11')]({'closeReason':_0xdb96('0x12'),'disposition':_0xdb96('0x13'),'closed':!![],'closedAt':moment()['format'](_0xdb96('0x14'))},{'where':{'id':_0x6d19f5}});}})['then'](function(){if(_0x6d19f5&&_0x6d19f5['length']){logger['info'](_0xdb96('0x15'),_0x6d19f5[_0xdb96('0x10')]());for(var _0x1880c9=0x0;_0x1880c9<_0x6d19f5[_0xdb96('0x16')];_0x1880c9++){io[_0xdb96('0x17')](_0xdb96('0x18'),{'id':_0x6d19f5[_0x1880c9],'closed':!![]});}}})[_0xdb96('0x19')](function(_0x6c5209){logger[_0xdb96('0x1a')](_0xdb96('0x1b'),_0x6c5209?util[_0xdb96('0x1c')](_0x6c5209,{'showHidden':![],'depth':null}):'');});}exports[_0xdb96('0x1d')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x0085=['emit','whatsappInteraction:update','catch','inspect','start','lodash','moment','util','../../config/environment','schedule','redis','localhost','socket.io-emitter','lastMsgAt','subtract','map','info','join','WhatsappInteraction','system','timeout','format','then','length'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0085,0x185));var _0x5008=function(_0x22d300,_0x396d11){_0x22d300=_0x22d300-0x0;var _0x44ac70=_0x0085[_0x22d300];return _0x44ac70;};'use strict';var _=require(_0x5008('0x0'));var moment=require(_0x5008('0x1'));var Redis=require('ioredis');var util=require(_0x5008('0x2'));var config=require(_0x5008('0x3'));var db=require('../../mysqldb')['db'];var logger=require('../logger')(_0x5008('0x4'));config[_0x5008('0x5')]=_['defaults'](config[_0x5008('0x5')],{'host':_0x5008('0x6'),'port':0x18eb});var io=require(_0x5008('0x7'))(new Redis(config[_0x5008('0x5')]));function closeInteractions(){var _0x398eb0=[];return db['WhatsappInteraction']['findAll']({'raw':!![],'attributes':['id',_0x5008('0x8')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x5008('0x9')](0x18,'hours')}}})['then'](function(_0x1a8b4d){if(_0x1a8b4d&&_0x1a8b4d['length']){_0x398eb0=_[_0x5008('0xa')](_0x1a8b4d||[],'id');logger[_0x5008('0xb')]('[WHATSAPP]\x20Interactions\x20to\x20close:',_0x398eb0[_0x5008('0xc')]());return db[_0x5008('0xd')]['update']({'closeReason':_0x5008('0xe'),'disposition':_0x5008('0xf'),'closed':!![],'closedAt':moment()[_0x5008('0x10')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x398eb0}});}})[_0x5008('0x11')](function(){if(_0x398eb0&&_0x398eb0[_0x5008('0x12')]){logger['info']('[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:',_0x398eb0['join']());for(var _0x4c77a7=0x0;_0x4c77a7<_0x398eb0[_0x5008('0x12')];_0x4c77a7++){io[_0x5008('0x13')](_0x5008('0x14'),{'id':_0x398eb0[_0x4c77a7],'closed':!![]});}}})[_0x5008('0x15')](function(_0x1f957a){logger['error']('[WHATSAPP]\x20Error\x20closing\x20interactions',_0x1f957a?util[_0x5008('0x16')](_0x1f957a,{'showHidden':![],'depth':null}):'');});}exports[_0x5008('0x17')]=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 ba2fca2..0902c24 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x97e6=['CmHopper','destroy','hopper1','contacts2','hopper2','catch','util','../mysqldb','push','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','now','CmContact','then','bulkCreate','log','finished\x20populating','contacts1'];(function(_0x2b16a3,_0x412bfa){var _0x308951=function(_0x2af897){while(--_0x2af897){_0x2b16a3['push'](_0x2b16a3['shift']());}};_0x308951(++_0x412bfa);}(_0x97e6,0x132));var _0x697e=function(_0x467e9e,_0x4a6888){_0x467e9e=_0x467e9e-0x0;var _0x10376a=_0x97e6[_0x467e9e];return _0x10376a;};'use strict';var util=require(_0x697e('0x0'));var db=require(_0x697e('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x697e('0x2')]({'id':i,'firstName':_0x697e('0x3')+i,'lastName':_0x697e('0x4')+i,'phone':0xf879fb460+i,'email':_0x697e('0x5')+i+_0x697e('0x6')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x697e('0x7')](),'updatedAt':Date[_0x697e('0x7')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0x697e('0x3')+i,'lastName':_0x697e('0x4')+i,'phone':0xf879fb460+i,'email':_0x697e('0x5')+i+_0x697e('0x6')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x697e('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x697e('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x697e('0x7')](),'updatedAt':Date[_0x697e('0x7')]()});}db[_0x697e('0x8')]['destroy']({'where':{}})[_0x697e('0x9')](function(){return db[_0x697e('0x8')][_0x697e('0xa')](contacts);})['then'](function(){console[_0x697e('0xb')](_0x697e('0xc'),_0x697e('0xd'));return db[_0x697e('0xe')][_0x697e('0xf')]({'where':{}});})[_0x697e('0x9')](function(){return db[_0x697e('0xe')][_0x697e('0xa')](hopper);})[_0x697e('0x9')](function(){console['log'](_0x697e('0xc'),_0x697e('0x10'));return db['CmContact'][_0x697e('0xa')](contacts2);})['then'](function(){console[_0x697e('0xb')]('finished\x20populating',_0x697e('0x11'));return db[_0x697e('0xe')][_0x697e('0xa')](hopper2);})['then'](function(){console[_0x697e('0xb')]('finished\x20populating',_0x697e('0x12'));})[_0x697e('0x13')](function(_0x1c9572){console[_0x697e('0xb')](_0x1c9572);}); \ No newline at end of file +var _0xa7f2=['bulkCreate','log','finished\x20populating','contacts1','CmHopper','destroy','hopper1','contacts2','../mysqldb','Innocenzo','Biondo','innocenzo.biondo','push','now','@xcally.com','CmContact','then'];(function(_0x50ac69,_0x3ad86a){var _0x369a98=function(_0x3e4b77){while(--_0x3e4b77){_0x50ac69['push'](_0x50ac69['shift']());}};_0x369a98(++_0x3ad86a);}(_0xa7f2,0xc3));var _0x2a7f=function(_0x5f0225,_0x52631a){_0x5f0225=_0x5f0225-0x0;var _0x2cef4b=_0xa7f2[_0x5f0225];return _0x2cef4b;};'use strict';var util=require('util');var db=require(_0x2a7f('0x0'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':_0x2a7f('0x1')+i,'lastName':_0x2a7f('0x2')+i,'phone':0xf879fb460+i,'email':_0x2a7f('0x3')+i+'@xcally.com'});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x2a7f('0x4')]({'id':i,'active':![],'scheduledat':Date[_0x2a7f('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x2a7f('0x5')](),'updatedAt':Date[_0x2a7f('0x5')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x2a7f('0x4')]({'id':i,'firstName':_0x2a7f('0x1')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0x2a7f('0x3')+i+_0x2a7f('0x6')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x2a7f('0x4')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x2a7f('0x5')](),'updatedAt':Date[_0x2a7f('0x5')]()});}db[_0x2a7f('0x7')]['destroy']({'where':{}})[_0x2a7f('0x8')](function(){return db['CmContact'][_0x2a7f('0x9')](contacts);})['then'](function(){console[_0x2a7f('0xa')](_0x2a7f('0xb'),_0x2a7f('0xc'));return db[_0x2a7f('0xd')][_0x2a7f('0xe')]({'where':{}});})[_0x2a7f('0x8')](function(){return db[_0x2a7f('0xd')]['bulkCreate'](hopper);})[_0x2a7f('0x8')](function(){console['log']('finished\x20populating',_0x2a7f('0xf'));return db[_0x2a7f('0x7')][_0x2a7f('0x9')](contacts2);})[_0x2a7f('0x8')](function(){console[_0x2a7f('0xa')](_0x2a7f('0xb'),_0x2a7f('0x10'));return db[_0x2a7f('0xd')][_0x2a7f('0x9')](hopper2);})[_0x2a7f('0x8')](function(){console[_0x2a7f('0xa')](_0x2a7f('0xb'),'hopper2');})['catch'](function(_0x1725f0){console[_0x2a7f('0xa')](_0x1725f0);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 326e1c1..12710b6 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0625=['password','friend','udp','wss','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','bulkCreate','log','add\x20user','catch','util','../mysqldb','push','format','%s%s','agent','%s%s@xcally.com'];(function(_0x47819a,_0x3074b2){var _0x505b69=function(_0x21285b){while(--_0x21285b){_0x47819a['push'](_0x47819a['shift']());}};_0x505b69(++_0x3074b2);}(_0x0625,0x1dc));var _0x5062=function(_0x17a26b,_0x42df5b){_0x17a26b=_0x17a26b-0x0;var _0x28bce3=_0x0625[_0x17a26b];return _0x28bce3;};'use strict';var util=require(_0x5062('0x0'));var db=require(_0x5062('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x5062('0x2')]({'name':util[_0x5062('0x3')](_0x5062('0x4'),_0x5062('0x5'),i),'fullname':util[_0x5062('0x3')]('%s%s',_0x5062('0x5'),i),'email':util[_0x5062('0x3')](_0x5062('0x6'),_0x5062('0x5'),i),'role':_0x5062('0x5'),'password':_0x5062('0x7'),'internal':0xfa0+i,'type':_0x5062('0x8'),'transport':[_0x5062('0x9'),'ws',_0x5062('0xa')],'disallow':[_0x5062('0xb')],'allow':[_0x5062('0xc')],'defaultuser':util['format'](_0x5062('0x4'),_0x5062('0x5'),i),'encryption':_0x5062('0xd'),'avpf':_0x5062('0xd'),'force_avp':_0x5062('0xd'),'icesupport':_0x5062('0xd'),'dtlsenable':_0x5062('0xd'),'dtlsverify':'no','dtlscertfile':_0x5062('0xe'),'dtlsprivatekey':_0x5062('0xf'),'dtlssetup':_0x5062('0x10'),'callerid':util[_0x5062('0x3')]('\x22%s\x22\x20<%s>',util[_0x5062('0x3')](_0x5062('0x4'),_0x5062('0x5'),i),0xfa0+i)});}db['User'][_0x5062('0x11')](users)['then'](function(){console[_0x5062('0x12')](_0x5062('0x13'));})[_0x5062('0x14')](function(_0x3b60b3){console[_0x5062('0x12')](_0x3b60b3);}); \ No newline at end of file +var _0x5ca7=['log','add\x20user','catch','util','../mysqldb','push','format','%s%s','agent','%s%s@xcally.com','password','friend','udp','wss','all','ulaw','yes','/etc/pki/tls/private/motion.key','\x22%s\x22\x20<%s>','User','then'];(function(_0x118616,_0x476beb){var _0x26302d=function(_0x4b3ae2){while(--_0x4b3ae2){_0x118616['push'](_0x118616['shift']());}};_0x26302d(++_0x476beb);}(_0x5ca7,0x1e6));var _0x75ca=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0x5ca7[_0xc6be3a];return _0x56a310;};'use strict';var util=require(_0x75ca('0x0'));var db=require(_0x75ca('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x75ca('0x2')]({'name':util[_0x75ca('0x3')](_0x75ca('0x4'),_0x75ca('0x5'),i),'fullname':util['format'](_0x75ca('0x4'),_0x75ca('0x5'),i),'email':util[_0x75ca('0x3')](_0x75ca('0x6'),_0x75ca('0x5'),i),'role':_0x75ca('0x5'),'password':_0x75ca('0x7'),'internal':0xfa0+i,'type':_0x75ca('0x8'),'transport':[_0x75ca('0x9'),'ws',_0x75ca('0xa')],'disallow':[_0x75ca('0xb')],'allow':[_0x75ca('0xc')],'defaultuser':util[_0x75ca('0x3')](_0x75ca('0x4'),_0x75ca('0x5'),i),'encryption':_0x75ca('0xd'),'avpf':'yes','force_avp':'yes','icesupport':'yes','dtlsenable':_0x75ca('0xd'),'dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':_0x75ca('0xe'),'dtlssetup':'actpass','callerid':util[_0x75ca('0x3')](_0x75ca('0xf'),util[_0x75ca('0x3')]('%s%s','agent',i),0xfa0+i)});}db[_0x75ca('0x10')]['bulkCreate'](users)[_0x75ca('0x11')](function(){console[_0x75ca('0x12')](_0x75ca('0x13'));})[_0x75ca('0x14')](function(_0x331bf9){console['log'](_0x331bf9);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 627a8b0..46773f8 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdbc6=['join','default','connection','setMaxListeners','address','request','remoteAddress','remotePort','connectedAt','SocketIO\x20','nsp','disconnect','bluebird','./environment','name','Agents','User','role','telephone','agent','type','ivr','findOne','then','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','WhatsappQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId','map','where','format','%s:queue:%s','length','user:%s','handshake','query','find','userProfileId','ChatInteraction','ChatInteractions','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','admin','voice:inbound','voice:outbound','hasOwnProperty','include','VoiceQueue','push','ChatQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','user','MailQueues','Campaign','getVoiceQueues','getChatQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','voice','chat','sms','mail','openchannel','telephone:%s','leave','emit','user_has_chat_interactions:remove','removeMailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log'];(function(_0x528442,_0x3f7aed){var _0x4c42cd=function(_0x304a36){while(--_0x304a36){_0x528442['push'](_0x528442['shift']());}};_0x4c42cd(++_0x3f7aed);}(_0xdbc6,0x13b));var _0x6dbc=function(_0x1bfcc0,_0x21572c){_0x1bfcc0=_0x1bfcc0-0x0;var _0x3f5d76=_0xdbc6[_0x1bfcc0];return _0x3f5d76;};'use strict';var _=require('lodash');var util=require('util');var BPromise=require(_0x6dbc('0x0'));var db=require('../mysqldb')['db'];var config=require(_0x6dbc('0x1'));var queryQueues={'attributes':['id',_0x6dbc('0x2')],'include':[{'as':_0x6dbc('0x3'),'model':db[_0x6dbc('0x4')],'attributes':['id',_0x6dbc('0x2'),_0x6dbc('0x5')],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x6dbc('0x2')],'where':{'role':_0x6dbc('0x6')}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id',_0x6dbc('0x2')],'where':{'role':_0x6dbc('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x6dbc('0x2'),_0x6dbc('0x8')],'where':{'type':_0x6dbc('0x9')}};function getAssociatedResources(_0x5ea822,_0x3494e2,_0x3c57b4){return db['UserProfileSection'][_0x6dbc('0xa')]({'where':{'name':_0x5ea822,'userProfileId':_0x3494e2},'raw':!![]})[_0x6dbc('0xb')](function(_0x5bbb3c){if(_0x5bbb3c){if(_0x5bbb3c[_0x6dbc('0xc')]){switch(_0x5ea822){case _0x6dbc('0xd'):case _0x6dbc('0xe'):case _0x6dbc('0xf'):case _0x6dbc('0x10'):case'MailQueues':case'OpenchannelQueues':case _0x6dbc('0x11'):return db[_0x3c57b4][_0x6dbc('0x12')](queryQueues);case _0x6dbc('0x13'):return db[_0x3c57b4][_0x6dbc('0x12')](queryTelephones);case _0x6dbc('0x14'):return db[_0x3c57b4][_0x6dbc('0x12')](queryTrunks);case _0x6dbc('0x15'):return db[_0x3c57b4][_0x6dbc('0x12')](queryCampaigns);}}else{return db[_0x6dbc('0x16')]['findAll']({'attributes':[_0x6dbc('0x17')],'where':{'sectionId':_0x5bbb3c['id']},'raw':!![]})[_0x6dbc('0xb')](function(_0x12a257){if(_0x12a257){var _0x418e71={'where':{'id':_[_0x6dbc('0x18')](_0x12a257,_0x6dbc('0x17'))},'raw':!![]};switch(_0x3c57b4){case _0x6dbc('0x4'):_0x418e71[_0x6dbc('0x19')]['role']='telephone';break;case'Campaign':_0x418e71[_0x6dbc('0x19')][_0x6dbc('0x8')]=_0x6dbc('0x9');break;}return db[_0x3c57b4][_0x6dbc('0x12')](_0x418e71);}else{return[];}});}}else{return[];}})[_0x6dbc('0xb')](function(_0x581381){return _0x581381;});}function joinOrLeaveQueues(_0x44435c,_0x12311d,_0xb270df,_0x294803){_0x44435c[_0x12311d](util[_0x6dbc('0x1a')](_0x6dbc('0x1b'),_0xb270df,_0x294803[_0x6dbc('0x2')]));if(_0x294803[_0x6dbc('0x3')]){for(var _0x9edc7a=0x0;_0x9edc7a<_0x294803[_0x6dbc('0x3')][_0x6dbc('0x1c')];_0x9edc7a+=0x1){_0x44435c[_0x12311d](util['format'](_0x6dbc('0x1d'),_0x294803[_0x6dbc('0x3')][_0x9edc7a][_0x6dbc('0x2')]));}}}function joinOrLeave(_0x52b772,_0x1b8e84,_0x47d55b){var _0x3e98b2;if(_0x52b772[_0x6dbc('0x1e')][_0x6dbc('0x1f')]['id']){db['User'][_0x6dbc('0x20')]({'attributes':['id',_0x6dbc('0x2'),_0x6dbc('0x5'),_0x6dbc('0x21')],'where':{'id':_0x52b772[_0x6dbc('0x1e')][_0x6dbc('0x1f')]['id']},'include':[{'model':db[_0x6dbc('0x22')],'as':_0x6dbc('0x23'),'attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':_0x6dbc('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0x6dbc('0x25')],'as':_0x6dbc('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0x6dbc('0x27')],'as':_0x6dbc('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0x6dbc('0x29')],'as':_0x6dbc('0x2a'),'attributes':['id'],'raw':!![]},{'model':db[_0x6dbc('0x2b')],'as':_0x6dbc('0x2c'),'attributes':['id'],'raw':!![]}]})['then'](function(_0x23ea7d){if(_0x23ea7d){_0x3e98b2=_0x23ea7d;_0x52b772[_0x1b8e84](util[_0x6dbc('0x1a')](_0x6dbc('0x1d'),_0x23ea7d[_0x6dbc('0x2')]));var _0x564920=[];switch(_0x23ea7d['role']){case _0x6dbc('0x2d'):_0x52b772[_0x1b8e84](_0x6dbc('0x2e'));_0x52b772[_0x1b8e84](_0x6dbc('0x2f'));if(queryQueues[_0x6dbc('0x30')](_0x6dbc('0x31'))){delete queryQueues[_0x6dbc('0x31')];}_0x564920['push'](db[_0x6dbc('0x32')][_0x6dbc('0x12')](queryQueues));_0x564920[_0x6dbc('0x33')](db[_0x6dbc('0x34')][_0x6dbc('0x12')](queryQueues));_0x564920[_0x6dbc('0x33')](db[_0x6dbc('0x35')][_0x6dbc('0x12')](queryQueues));_0x564920[_0x6dbc('0x33')](db[_0x6dbc('0x36')][_0x6dbc('0x12')](queryQueues));_0x564920[_0x6dbc('0x33')](db[_0x6dbc('0x37')][_0x6dbc('0x12')](queryQueues));_0x564920[_0x6dbc('0x33')](db[_0x6dbc('0x38')][_0x6dbc('0x12')](queryQueues));_0x564920[_0x6dbc('0x33')](db[_0x6dbc('0x39')][_0x6dbc('0x12')](queryQueues));_0x564920[_0x6dbc('0x33')](db[_0x6dbc('0x4')][_0x6dbc('0x12')](queryTelephones));_0x564920[_0x6dbc('0x33')](db[_0x6dbc('0x3a')][_0x6dbc('0x12')](queryTrunks));_0x564920['push'](db['Campaign'][_0x6dbc('0x12')](queryCampaigns));_0x564920[_0x6dbc('0x33')](db[_0x6dbc('0x4')]['findAll'](queryAgents));break;case _0x6dbc('0x3b'):_0x52b772[_0x1b8e84]('voice:inbound');_0x52b772[_0x1b8e84]('voice:outbound');_0x564920[_0x6dbc('0x33')](getAssociatedResources(_0x6dbc('0xd'),_0x23ea7d['userProfileId'],_0x6dbc('0x32')));_0x564920[_0x6dbc('0x33')](getAssociatedResources(_0x6dbc('0xe'),_0x23ea7d[_0x6dbc('0x21')],_0x6dbc('0x34')));_0x564920['push'](getAssociatedResources(_0x6dbc('0xf'),_0x23ea7d['userProfileId'],_0x6dbc('0x35')));_0x564920[_0x6dbc('0x33')](getAssociatedResources('SmsQueues',_0x23ea7d[_0x6dbc('0x21')],_0x6dbc('0x36')));_0x564920[_0x6dbc('0x33')](getAssociatedResources(_0x6dbc('0x3c'),_0x23ea7d[_0x6dbc('0x21')],'MailQueue'));_0x564920[_0x6dbc('0x33')](getAssociatedResources('OpenchannelQueues',_0x23ea7d['userProfileId'],'OpenchannelQueue'));_0x564920[_0x6dbc('0x33')](getAssociatedResources(_0x6dbc('0x11'),_0x23ea7d[_0x6dbc('0x21')],_0x6dbc('0x39')));_0x564920[_0x6dbc('0x33')](getAssociatedResources(_0x6dbc('0x13'),_0x23ea7d[_0x6dbc('0x21')],_0x6dbc('0x4')));_0x564920[_0x6dbc('0x33')](getAssociatedResources(_0x6dbc('0x14'),_0x23ea7d['userProfileId'],_0x6dbc('0x3a')));_0x564920[_0x6dbc('0x33')](getAssociatedResources('IvrCampaigns',_0x23ea7d[_0x6dbc('0x21')],_0x6dbc('0x3d')));_0x564920[_0x6dbc('0x33')](db[_0x6dbc('0x4')][_0x6dbc('0x12')](queryAgents));break;case'agent':_0x52b772[_0x1b8e84](_0x6dbc('0x2e'));_0x52b772[_0x1b8e84](_0x6dbc('0x2f'));_0x564920[_0x6dbc('0x33')](_0x23ea7d[_0x6dbc('0x3e')]({'attributes':['id',_0x6dbc('0x2')]}));_0x564920[_0x6dbc('0x33')](_0x23ea7d[_0x6dbc('0x3f')]({'attributes':['id','name']}));_0x564920[_0x6dbc('0x33')](_0x23ea7d['getFaxQueues']({'attributes':['id',_0x6dbc('0x2')]}));_0x564920[_0x6dbc('0x33')](_0x23ea7d[_0x6dbc('0x40')]({'attributes':['id',_0x6dbc('0x2')]}));_0x564920[_0x6dbc('0x33')](_0x23ea7d[_0x6dbc('0x41')]({'attributes':['id',_0x6dbc('0x2')]}));_0x564920[_0x6dbc('0x33')](_0x23ea7d[_0x6dbc('0x42')]({'attributes':['id','name']}));_0x564920[_0x6dbc('0x33')](_0x23ea7d[_0x6dbc('0x43')]({'attributes':['id',_0x6dbc('0x2')]}));break;}return BPromise[_0x6dbc('0x44')](_0x564920);}})['then'](function(_0x561570){if(_0x561570&&_0x561570[_0x6dbc('0x1c')]){for(var _0x4fc9b9=0x0;_0x4fc9b9<_0x561570[_0x6dbc('0x1c')];_0x4fc9b9+=0x1){for(var _0x426059=0x0;_0x426059<_0x561570[_0x4fc9b9][_0x6dbc('0x1c')];_0x426059+=0x1){switch(_0x4fc9b9){case 0x0:joinOrLeaveQueues(_0x52b772,_0x1b8e84,_0x6dbc('0x45'),_0x561570[_0x4fc9b9][_0x426059]);break;case 0x1:joinOrLeaveQueues(_0x52b772,_0x1b8e84,_0x6dbc('0x46'),_0x561570[_0x4fc9b9][_0x426059]);break;case 0x2:joinOrLeaveQueues(_0x52b772,_0x1b8e84,'fax',_0x561570[_0x4fc9b9][_0x426059]);break;case 0x3:joinOrLeaveQueues(_0x52b772,_0x1b8e84,_0x6dbc('0x47'),_0x561570[_0x4fc9b9][_0x426059]);break;case 0x4:joinOrLeaveQueues(_0x52b772,_0x1b8e84,_0x6dbc('0x48'),_0x561570[_0x4fc9b9][_0x426059]);break;case 0x5:joinOrLeaveQueues(_0x52b772,_0x1b8e84,_0x6dbc('0x49'),_0x561570[_0x4fc9b9][_0x426059]);break;case 0x6:joinOrLeaveQueues(_0x52b772,_0x1b8e84,'whatsapp',_0x561570[_0x4fc9b9][_0x426059]);break;case 0x7:if(_0x3e98b2[_0x6dbc('0x5')]!==_0x6dbc('0x7'))_0x52b772[_0x1b8e84](util['format'](_0x6dbc('0x4a'),_0x561570[_0x4fc9b9][_0x426059][_0x6dbc('0x2')]));break;case 0x8:if(_0x3e98b2[_0x6dbc('0x5')]!=='agent')_0x52b772[_0x1b8e84](util['format']('trunk:%s',_0x561570[_0x4fc9b9][_0x426059]['name']));break;case 0x9:if(_0x3e98b2[_0x6dbc('0x5')]!==_0x6dbc('0x7'))_0x52b772[_0x1b8e84](util[_0x6dbc('0x1a')]('campaign:%s:%s',_0x561570[_0x4fc9b9][_0x426059][_0x6dbc('0x8')],_0x561570[_0x4fc9b9][_0x426059][_0x6dbc('0x2')]));break;case 0xa:_0x52b772[_0x1b8e84](util[_0x6dbc('0x1a')]('user:%s',_0x561570[_0x4fc9b9][_0x426059]['name']));break;}}}}})[_0x6dbc('0xb')](function(){if(_0x1b8e84===_0x6dbc('0x4b')){var _0x38c85b=_[_0x6dbc('0x18')](_0x3e98b2[_0x6dbc('0x23')],'id');return _0x3e98b2['removeChatInteractions'](_0x38c85b)[_0x6dbc('0xb')](function(){for(var _0x431c48=0x0;_0x431c48<_0x38c85b['length'];_0x431c48+=0x1){_0x47d55b[_0x6dbc('0x4c')](_0x6dbc('0x4d'),{'ChatInteractionId':Number(_0x38c85b[_0x431c48]),'UserId':Number(_0x3e98b2['id'])});}});}})['then'](function(){if(_0x1b8e84===_0x6dbc('0x4b')){var _0x3045a1=_['map'](_0x3e98b2[_0x6dbc('0x24')],'id');return _0x3e98b2[_0x6dbc('0x4e')](_0x3045a1)[_0x6dbc('0xb')](function(){for(var _0x2907e5=0x0;_0x2907e5<_0x3045a1[_0x6dbc('0x1c')];_0x2907e5+=0x1){_0x47d55b['emit'](_0x6dbc('0x4f'),{'MailInteractionId':Number(_0x3045a1[_0x2907e5]),'UserId':Number(_0x3e98b2['id'])});}});}})['then'](function(){if(_0x1b8e84===_0x6dbc('0x4b')){var _0x1e55de=_[_0x6dbc('0x18')](_0x3e98b2[_0x6dbc('0x26')],'id');return _0x3e98b2[_0x6dbc('0x50')](_0x1e55de)[_0x6dbc('0xb')](function(){for(var _0x673597=0x0;_0x673597<_0x1e55de['length'];_0x673597+=0x1){_0x47d55b[_0x6dbc('0x4c')](_0x6dbc('0x51'),{'FaxInteractionId':Number(_0x1e55de[_0x673597]),'UserId':Number(_0x3e98b2['id'])});}});}})[_0x6dbc('0xb')](function(){if(_0x1b8e84===_0x6dbc('0x4b')){var _0x45dcbf=_[_0x6dbc('0x18')](_0x3e98b2[_0x6dbc('0x28')],'id');return _0x3e98b2['removeSmsInteractions'](_0x45dcbf)[_0x6dbc('0xb')](function(){for(var _0x2cce4c=0x0;_0x2cce4c<_0x45dcbf['length'];_0x2cce4c+=0x1){_0x47d55b['emit'](_0x6dbc('0x52'),{'SmsInteractionId':Number(_0x45dcbf[_0x2cce4c]),'UserId':Number(_0x3e98b2['id'])});}});}})['then'](function(){if(_0x1b8e84===_0x6dbc('0x4b')){var _0x13e1b7=_['map'](_0x3e98b2[_0x6dbc('0x2a')],'id');return _0x3e98b2[_0x6dbc('0x53')](_0x13e1b7)[_0x6dbc('0xb')](function(){for(var _0x4b71a0=0x0;_0x4b71a0<_0x13e1b7[_0x6dbc('0x1c')];_0x4b71a0+=0x1){_0x47d55b[_0x6dbc('0x4c')](_0x6dbc('0x54'),{'OpenchannelInteractionId':Number(_0x13e1b7[_0x4b71a0]),'UserId':Number(_0x3e98b2['id'])});}});}})[_0x6dbc('0xb')](function(){if(_0x1b8e84==='leave'){var _0x280562=_['map'](_0x3e98b2[_0x6dbc('0x2c')],'id');return _0x3e98b2[_0x6dbc('0x55')](_0x280562)[_0x6dbc('0xb')](function(){for(var _0x33d972=0x0;_0x33d972<_0x280562[_0x6dbc('0x1c')];_0x33d972+=0x1){_0x47d55b[_0x6dbc('0x4c')](_0x6dbc('0x56'),{'WhatsappInteractionId':Number(_0x280562[_0x33d972]),'UserId':Number(_0x3e98b2['id'])});}});}})[_0x6dbc('0x57')](function(_0x2856a1){_0x52b772[_0x6dbc('0x58')](_0x2856a1);});}}function onDisconnect(_0x4a3fde,_0x3bb839){joinOrLeave(_0x4a3fde,_0x6dbc('0x4b'),_0x3bb839);}function onConnect(_0x15b7fb){joinOrLeave(_0x15b7fb,_0x6dbc('0x59'));}exports[_0x6dbc('0x5a')]=function(_0x1e5f6f){_0x1e5f6f['on'](_0x6dbc('0x5b'),function(_0x206582){_0x206582[_0x6dbc('0x5c')](0x0);_0x206582[_0x6dbc('0x5d')]=_0x206582[_0x6dbc('0x5e')][_0x6dbc('0x5b')][_0x6dbc('0x5f')]+':'+_0x206582['request'][_0x6dbc('0x5b')][_0x6dbc('0x60')];_0x206582[_0x6dbc('0x61')]=new Date();_0x206582['log']=function(_0xc60021){console[_0x6dbc('0x58')](_0x6dbc('0x62')+_0x206582[_0x6dbc('0x63')][_0x6dbc('0x2')]+'['+_0x206582[_0x6dbc('0x5d')]+']',_0xc60021);};_0x206582['on'](_0x6dbc('0x64'),function(){onDisconnect(_0x206582,_0x1e5f6f);_0x206582['log']('DISCONNECTED');});onConnect(_0x206582);_0x206582[_0x6dbc('0x58')]('CONNECTED');});}; \ No newline at end of file +var _0xdfb1=['userProfileId','MailQueue','Trunks','Trunk','getVoiceQueues','getFaxQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','voice','chat','sms','mail','whatsapp','agent','trunk:%s','campaign:%s:%s','leave','ChatInteractions','removeChatInteractions','user_has_chat_interactions:remove','MailInteractions','removeMailInteractions','emit','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','WhatsappInteractions','removeWhatsappInteractions','catch','log','default','connection','setMaxListeners','address','request','remotePort','connectedAt','SocketIO\x20','nsp','CONNECTED','lodash','util','bluebird','../mysqldb','name','Agents','User','telephone','type','ivr','UserProfileSection','findOne','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','Telephones','findAll','IvrCampaigns','resourceId','then','map','where','role','format','length','user:%s','handshake','query','find','ChatInteraction','FaxInteraction','FaxInteractions','SmsInteractions','OpenchannelInteractions','WhatsappInteraction','admin','voice:inbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','OpenchannelQueue','WhatsappQueue','Campaign','user','voice:outbound'];(function(_0x118626,_0x40a41d){var _0x287b1c=function(_0x45d9fd){while(--_0x45d9fd){_0x118626['push'](_0x118626['shift']());}};_0x287b1c(++_0x40a41d);}(_0xdfb1,0x8c));var _0x1dfb=function(_0x40cf01,_0x467ab3){_0x40cf01=_0x40cf01-0x0;var _0x2f4eb1=_0xdfb1[_0x40cf01];return _0x2f4eb1;};'use strict';var _=require(_0x1dfb('0x0'));var util=require(_0x1dfb('0x1'));var BPromise=require(_0x1dfb('0x2'));var db=require(_0x1dfb('0x3'))['db'];var config=require('./environment');var queryQueues={'attributes':['id',_0x1dfb('0x4')],'include':[{'as':_0x1dfb('0x5'),'model':db[_0x1dfb('0x6')],'attributes':['id',_0x1dfb('0x4'),'role'],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':_0x1dfb('0x7')}};var queryTrunks={'raw':!![],'attributes':['id',_0x1dfb('0x4')]};var queryAgents={'raw':!![],'attributes':['id',_0x1dfb('0x4')],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id',_0x1dfb('0x4'),_0x1dfb('0x8')],'where':{'type':_0x1dfb('0x9')}};function getAssociatedResources(_0x190198,_0x5a14dd,_0x24d8b9){return db[_0x1dfb('0xa')][_0x1dfb('0xb')]({'where':{'name':_0x190198,'userProfileId':_0x5a14dd},'raw':!![]})['then'](function(_0xd747ac){if(_0xd747ac){if(_0xd747ac[_0x1dfb('0xc')]){switch(_0x190198){case _0x1dfb('0xd'):case _0x1dfb('0xe'):case _0x1dfb('0xf'):case _0x1dfb('0x10'):case _0x1dfb('0x11'):case _0x1dfb('0x12'):case _0x1dfb('0x13'):return db[_0x24d8b9]['findAll'](queryQueues);case _0x1dfb('0x14'):return db[_0x24d8b9][_0x1dfb('0x15')](queryTelephones);case'Trunks':return db[_0x24d8b9][_0x1dfb('0x15')](queryTrunks);case _0x1dfb('0x16'):return db[_0x24d8b9][_0x1dfb('0x15')](queryCampaigns);}}else{return db['UserProfileResource'][_0x1dfb('0x15')]({'attributes':[_0x1dfb('0x17')],'where':{'sectionId':_0xd747ac['id']},'raw':!![]})[_0x1dfb('0x18')](function(_0x5ccfcc){if(_0x5ccfcc){var _0xdaf261={'where':{'id':_[_0x1dfb('0x19')](_0x5ccfcc,_0x1dfb('0x17'))},'raw':!![]};switch(_0x24d8b9){case'User':_0xdaf261[_0x1dfb('0x1a')][_0x1dfb('0x1b')]=_0x1dfb('0x7');break;case'Campaign':_0xdaf261['where'][_0x1dfb('0x8')]=_0x1dfb('0x9');break;}return db[_0x24d8b9][_0x1dfb('0x15')](_0xdaf261);}else{return[];}});}}else{return[];}})[_0x1dfb('0x18')](function(_0x50f2ec){return _0x50f2ec;});}function joinOrLeaveQueues(_0x2305e2,_0x33f6e5,_0x2842e7,_0x358465){_0x2305e2[_0x33f6e5](util[_0x1dfb('0x1c')]('%s:queue:%s',_0x2842e7,_0x358465[_0x1dfb('0x4')]));if(_0x358465['Agents']){for(var _0x54cd15=0x0;_0x54cd15<_0x358465['Agents'][_0x1dfb('0x1d')];_0x54cd15+=0x1){_0x2305e2[_0x33f6e5](util[_0x1dfb('0x1c')](_0x1dfb('0x1e'),_0x358465['Agents'][_0x54cd15]['name']));}}}function joinOrLeave(_0x5de3c9,_0x2c9a0c,_0x1ceaab){var _0x1cf4cd;if(_0x5de3c9[_0x1dfb('0x1f')][_0x1dfb('0x20')]['id']){db[_0x1dfb('0x6')][_0x1dfb('0x21')]({'attributes':['id',_0x1dfb('0x4'),_0x1dfb('0x1b'),'userProfileId'],'where':{'id':_0x5de3c9['handshake'][_0x1dfb('0x20')]['id']},'include':[{'model':db[_0x1dfb('0x22')],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x1dfb('0x23')],'as':_0x1dfb('0x24'),'attributes':['id'],'raw':!![]},{'model':db['SmsInteraction'],'as':_0x1dfb('0x25'),'attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':_0x1dfb('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0x1dfb('0x27')],'as':'WhatsappInteractions','attributes':['id'],'raw':!![]}]})[_0x1dfb('0x18')](function(_0x417f71){if(_0x417f71){_0x1cf4cd=_0x417f71;_0x5de3c9[_0x2c9a0c](util[_0x1dfb('0x1c')]('user:%s',_0x417f71[_0x1dfb('0x4')]));var _0x82339a=[];switch(_0x417f71[_0x1dfb('0x1b')]){case _0x1dfb('0x28'):_0x5de3c9[_0x2c9a0c](_0x1dfb('0x29'));_0x5de3c9[_0x2c9a0c]('voice:outbound');if(queryQueues[_0x1dfb('0x2a')](_0x1dfb('0x2b'))){delete queryQueues['include'];}_0x82339a[_0x1dfb('0x2c')](db[_0x1dfb('0x2d')]['findAll'](queryQueues));_0x82339a[_0x1dfb('0x2c')](db[_0x1dfb('0x2e')][_0x1dfb('0x15')](queryQueues));_0x82339a[_0x1dfb('0x2c')](db[_0x1dfb('0x2f')][_0x1dfb('0x15')](queryQueues));_0x82339a[_0x1dfb('0x2c')](db[_0x1dfb('0x30')][_0x1dfb('0x15')](queryQueues));_0x82339a[_0x1dfb('0x2c')](db['MailQueue'][_0x1dfb('0x15')](queryQueues));_0x82339a[_0x1dfb('0x2c')](db[_0x1dfb('0x31')]['findAll'](queryQueues));_0x82339a[_0x1dfb('0x2c')](db[_0x1dfb('0x32')][_0x1dfb('0x15')](queryQueues));_0x82339a['push'](db['User'][_0x1dfb('0x15')](queryTelephones));_0x82339a[_0x1dfb('0x2c')](db['Trunk'][_0x1dfb('0x15')](queryTrunks));_0x82339a[_0x1dfb('0x2c')](db[_0x1dfb('0x33')]['findAll'](queryCampaigns));_0x82339a[_0x1dfb('0x2c')](db[_0x1dfb('0x6')][_0x1dfb('0x15')](queryAgents));break;case _0x1dfb('0x34'):_0x5de3c9[_0x2c9a0c]('voice:inbound');_0x5de3c9[_0x2c9a0c](_0x1dfb('0x35'));_0x82339a[_0x1dfb('0x2c')](getAssociatedResources('VoiceQueues',_0x417f71['userProfileId'],_0x1dfb('0x2d')));_0x82339a['push'](getAssociatedResources(_0x1dfb('0xe'),_0x417f71['userProfileId'],'ChatQueue'));_0x82339a[_0x1dfb('0x2c')](getAssociatedResources(_0x1dfb('0xf'),_0x417f71[_0x1dfb('0x36')],_0x1dfb('0x2f')));_0x82339a[_0x1dfb('0x2c')](getAssociatedResources('SmsQueues',_0x417f71[_0x1dfb('0x36')],_0x1dfb('0x30')));_0x82339a[_0x1dfb('0x2c')](getAssociatedResources(_0x1dfb('0x11'),_0x417f71[_0x1dfb('0x36')],_0x1dfb('0x37')));_0x82339a['push'](getAssociatedResources('OpenchannelQueues',_0x417f71[_0x1dfb('0x36')],_0x1dfb('0x31')));_0x82339a[_0x1dfb('0x2c')](getAssociatedResources('WhatsappQueues',_0x417f71['userProfileId'],_0x1dfb('0x32')));_0x82339a[_0x1dfb('0x2c')](getAssociatedResources('Telephones',_0x417f71[_0x1dfb('0x36')],_0x1dfb('0x6')));_0x82339a[_0x1dfb('0x2c')](getAssociatedResources(_0x1dfb('0x38'),_0x417f71[_0x1dfb('0x36')],_0x1dfb('0x39')));_0x82339a[_0x1dfb('0x2c')](getAssociatedResources(_0x1dfb('0x16'),_0x417f71[_0x1dfb('0x36')],_0x1dfb('0x33')));_0x82339a[_0x1dfb('0x2c')](db[_0x1dfb('0x6')]['findAll'](queryAgents));break;case'agent':_0x5de3c9[_0x2c9a0c](_0x1dfb('0x29'));_0x5de3c9[_0x2c9a0c]('voice:outbound');_0x82339a[_0x1dfb('0x2c')](_0x417f71[_0x1dfb('0x3a')]({'attributes':['id','name']}));_0x82339a[_0x1dfb('0x2c')](_0x417f71['getChatQueues']({'attributes':['id','name']}));_0x82339a['push'](_0x417f71[_0x1dfb('0x3b')]({'attributes':['id',_0x1dfb('0x4')]}));_0x82339a[_0x1dfb('0x2c')](_0x417f71['getSmsQueues']({'attributes':['id','name']}));_0x82339a['push'](_0x417f71[_0x1dfb('0x3c')]({'attributes':['id',_0x1dfb('0x4')]}));_0x82339a[_0x1dfb('0x2c')](_0x417f71[_0x1dfb('0x3d')]({'attributes':['id',_0x1dfb('0x4')]}));_0x82339a[_0x1dfb('0x2c')](_0x417f71[_0x1dfb('0x3e')]({'attributes':['id','name']}));break;}return BPromise['all'](_0x82339a);}})[_0x1dfb('0x18')](function(_0x26710a){if(_0x26710a&&_0x26710a[_0x1dfb('0x1d')]){for(var _0x56de99=0x0;_0x56de99<_0x26710a[_0x1dfb('0x1d')];_0x56de99+=0x1){for(var _0x2ff784=0x0;_0x2ff784<_0x26710a[_0x56de99][_0x1dfb('0x1d')];_0x2ff784+=0x1){switch(_0x56de99){case 0x0:joinOrLeaveQueues(_0x5de3c9,_0x2c9a0c,_0x1dfb('0x3f'),_0x26710a[_0x56de99][_0x2ff784]);break;case 0x1:joinOrLeaveQueues(_0x5de3c9,_0x2c9a0c,_0x1dfb('0x40'),_0x26710a[_0x56de99][_0x2ff784]);break;case 0x2:joinOrLeaveQueues(_0x5de3c9,_0x2c9a0c,'fax',_0x26710a[_0x56de99][_0x2ff784]);break;case 0x3:joinOrLeaveQueues(_0x5de3c9,_0x2c9a0c,_0x1dfb('0x41'),_0x26710a[_0x56de99][_0x2ff784]);break;case 0x4:joinOrLeaveQueues(_0x5de3c9,_0x2c9a0c,_0x1dfb('0x42'),_0x26710a[_0x56de99][_0x2ff784]);break;case 0x5:joinOrLeaveQueues(_0x5de3c9,_0x2c9a0c,'openchannel',_0x26710a[_0x56de99][_0x2ff784]);break;case 0x6:joinOrLeaveQueues(_0x5de3c9,_0x2c9a0c,_0x1dfb('0x43'),_0x26710a[_0x56de99][_0x2ff784]);break;case 0x7:if(_0x1cf4cd[_0x1dfb('0x1b')]!=='agent')_0x5de3c9[_0x2c9a0c](util['format']('telephone:%s',_0x26710a[_0x56de99][_0x2ff784][_0x1dfb('0x4')]));break;case 0x8:if(_0x1cf4cd[_0x1dfb('0x1b')]!==_0x1dfb('0x44'))_0x5de3c9[_0x2c9a0c](util[_0x1dfb('0x1c')](_0x1dfb('0x45'),_0x26710a[_0x56de99][_0x2ff784][_0x1dfb('0x4')]));break;case 0x9:if(_0x1cf4cd[_0x1dfb('0x1b')]!=='agent')_0x5de3c9[_0x2c9a0c](util[_0x1dfb('0x1c')](_0x1dfb('0x46'),_0x26710a[_0x56de99][_0x2ff784][_0x1dfb('0x8')],_0x26710a[_0x56de99][_0x2ff784]['name']));break;case 0xa:_0x5de3c9[_0x2c9a0c](util[_0x1dfb('0x1c')](_0x1dfb('0x1e'),_0x26710a[_0x56de99][_0x2ff784]['name']));break;}}}}})[_0x1dfb('0x18')](function(){if(_0x2c9a0c===_0x1dfb('0x47')){var _0x3de05f=_[_0x1dfb('0x19')](_0x1cf4cd[_0x1dfb('0x48')],'id');return _0x1cf4cd[_0x1dfb('0x49')](_0x3de05f)[_0x1dfb('0x18')](function(){for(var _0x325ef8=0x0;_0x325ef8<_0x3de05f[_0x1dfb('0x1d')];_0x325ef8+=0x1){_0x1ceaab['emit'](_0x1dfb('0x4a'),{'ChatInteractionId':Number(_0x3de05f[_0x325ef8]),'UserId':Number(_0x1cf4cd['id'])});}});}})[_0x1dfb('0x18')](function(){if(_0x2c9a0c===_0x1dfb('0x47')){var _0x556de4=_[_0x1dfb('0x19')](_0x1cf4cd[_0x1dfb('0x4b')],'id');return _0x1cf4cd[_0x1dfb('0x4c')](_0x556de4)[_0x1dfb('0x18')](function(){for(var _0x25e455=0x0;_0x25e455<_0x556de4['length'];_0x25e455+=0x1){_0x1ceaab[_0x1dfb('0x4d')]('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x556de4[_0x25e455]),'UserId':Number(_0x1cf4cd['id'])});}});}})['then'](function(){if(_0x2c9a0c==='leave'){var _0x51ee9c=_[_0x1dfb('0x19')](_0x1cf4cd[_0x1dfb('0x24')],'id');return _0x1cf4cd[_0x1dfb('0x4e')](_0x51ee9c)[_0x1dfb('0x18')](function(){for(var _0x1ee0cf=0x0;_0x1ee0cf<_0x51ee9c[_0x1dfb('0x1d')];_0x1ee0cf+=0x1){_0x1ceaab[_0x1dfb('0x4d')](_0x1dfb('0x4f'),{'FaxInteractionId':Number(_0x51ee9c[_0x1ee0cf]),'UserId':Number(_0x1cf4cd['id'])});}});}})[_0x1dfb('0x18')](function(){if(_0x2c9a0c===_0x1dfb('0x47')){var _0x41cb03=_['map'](_0x1cf4cd[_0x1dfb('0x25')],'id');return _0x1cf4cd[_0x1dfb('0x50')](_0x41cb03)['then'](function(){for(var _0x3c7e8d=0x0;_0x3c7e8d<_0x41cb03[_0x1dfb('0x1d')];_0x3c7e8d+=0x1){_0x1ceaab[_0x1dfb('0x4d')](_0x1dfb('0x51'),{'SmsInteractionId':Number(_0x41cb03[_0x3c7e8d]),'UserId':Number(_0x1cf4cd['id'])});}});}})[_0x1dfb('0x18')](function(){if(_0x2c9a0c===_0x1dfb('0x47')){var _0x54d8fe=_['map'](_0x1cf4cd[_0x1dfb('0x26')],'id');return _0x1cf4cd[_0x1dfb('0x52')](_0x54d8fe)['then'](function(){for(var _0x530ba9=0x0;_0x530ba9<_0x54d8fe['length'];_0x530ba9+=0x1){_0x1ceaab[_0x1dfb('0x4d')]('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x54d8fe[_0x530ba9]),'UserId':Number(_0x1cf4cd['id'])});}});}})[_0x1dfb('0x18')](function(){if(_0x2c9a0c===_0x1dfb('0x47')){var _0xef7a1=_[_0x1dfb('0x19')](_0x1cf4cd[_0x1dfb('0x53')],'id');return _0x1cf4cd[_0x1dfb('0x54')](_0xef7a1)[_0x1dfb('0x18')](function(){for(var _0xfdf97c=0x0;_0xfdf97c<_0xef7a1['length'];_0xfdf97c+=0x1){_0x1ceaab[_0x1dfb('0x4d')]('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0xef7a1[_0xfdf97c]),'UserId':Number(_0x1cf4cd['id'])});}});}})[_0x1dfb('0x55')](function(_0x123e5e){_0x5de3c9[_0x1dfb('0x56')](_0x123e5e);});}}function onDisconnect(_0x47c899,_0x545f5b){joinOrLeave(_0x47c899,_0x1dfb('0x47'),_0x545f5b);}function onConnect(_0xabb993){joinOrLeave(_0xabb993,'join');}exports[_0x1dfb('0x57')]=function(_0x19795d){_0x19795d['on'](_0x1dfb('0x58'),function(_0x8eaf81){_0x8eaf81[_0x1dfb('0x59')](0x0);_0x8eaf81[_0x1dfb('0x5a')]=_0x8eaf81[_0x1dfb('0x5b')][_0x1dfb('0x58')]['remoteAddress']+':'+_0x8eaf81[_0x1dfb('0x5b')][_0x1dfb('0x58')][_0x1dfb('0x5c')];_0x8eaf81[_0x1dfb('0x5d')]=new Date();_0x8eaf81['log']=function(_0x17c15a){console[_0x1dfb('0x56')](_0x1dfb('0x5e')+_0x8eaf81[_0x1dfb('0x5f')][_0x1dfb('0x4')]+'['+_0x8eaf81[_0x1dfb('0x5a')]+']',_0x17c15a);};_0x8eaf81['on']('disconnect',function(){onDisconnect(_0x8eaf81,_0x19795d);_0x8eaf81[_0x1dfb('0x56')]('DISCONNECTED');});onConnect(_0x8eaf81);_0x8eaf81[_0x1dfb('0x56')](_0x1dfb('0x60'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 7be3b88..fe7e03a 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 _0xb73a=['closed','substatus','sequelize','User','find','fullname','email','internal','default','length','hasOwnProperty','model','hook','toLowerCase','condition','util','../../mysqldb','jayson/promise','../logger','triggers','http','Chat','afterCreate','newinteraction','ChatInteraction','afterUpdate','closedinteraction','newmessage','Sms','SmsInteraction','SmsMessage','WhatsappInteraction','Whatsapp','WhatsappMessage','Fax','FaxInteraction','FaxMessage','Mail','MailInteraction','MailMessage','Openchannel','OpenchannelInteraction','request','then','EventManager','error','code','Trigger,\x20%s','channel','motionChannel','event','direction','resolve','ContactId','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','Sequelize','QueryTypes','SELECT','contact','UserId','undefined','interface','format','SIP/%s','name','incomingmessage','outgoingmessage','AfterCreateMessage','offlineMessage','get','opened','query','catch','AfterCreate','changed'];(function(_0x1a5a7e,_0x4dde24){var _0x5b79f4=function(_0x13f74a){while(--_0x13f74a){_0x1a5a7e['push'](_0x1a5a7e['shift']());}};_0x5b79f4(++_0x4dde24);}(_0xb73a,0x13b));var _0xab73=function(_0x34ccc9,_0x2c3b78){_0x34ccc9=_0x34ccc9-0x0;var _0x578733=_0xb73a[_0x34ccc9];return _0x578733;};'use strict';var util=require(_0xab73('0x0'));var db=require(_0xab73('0x1'))['db'];var jayson=require(_0xab73('0x2'));var logger=require(_0xab73('0x3'))(_0xab73('0x4'));var client=jayson['client'][_0xab73('0x5')]({'port':0x232a});var triggers=[{'channel':_0xab73('0x6'),'model':'ChatInteraction','event':_0xab73('0x7'),'condition':_0xab73('0x8'),'callback':afterCreate},{'channel':'Chat','model':_0xab73('0x9'),'event':_0xab73('0xa'),'condition':_0xab73('0xb'),'callback':afterUpdate},{'channel':_0xab73('0x6'),'model':'ChatMessage','event':_0xab73('0x7'),'condition':_0xab73('0xc'),'callback':afterCreateMessage},{'channel':_0xab73('0x6'),'model':'ChatOfflineMessage','event':'afterCreate','condition':_0xab73('0xc'),'callback':afterCreateOfflineMessage},{'channel':_0xab73('0xd'),'model':_0xab73('0xe'),'event':'afterCreate','condition':'newinteraction','callback':afterCreate},{'channel':_0xab73('0xd'),'model':_0xab73('0xe'),'event':_0xab73('0xa'),'condition':_0xab73('0xb'),'callback':afterUpdate},{'channel':'Sms','model':_0xab73('0xf'),'event':_0xab73('0x7'),'condition':_0xab73('0xc'),'callback':afterCreateMessage},{'channel':'Whatsapp','model':_0xab73('0x10'),'event':'afterCreate','condition':_0xab73('0x8'),'callback':afterCreate},{'channel':_0xab73('0x11'),'model':_0xab73('0x10'),'event':_0xab73('0xa'),'condition':_0xab73('0xb'),'callback':afterUpdate},{'channel':'Whatsapp','model':_0xab73('0x12'),'event':'afterCreate','condition':_0xab73('0xc'),'callback':afterCreateMessage},{'channel':_0xab73('0x13'),'model':_0xab73('0x14'),'event':_0xab73('0x7'),'condition':_0xab73('0x8'),'callback':afterCreate},{'channel':_0xab73('0x13'),'model':_0xab73('0x14'),'event':_0xab73('0xa'),'condition':_0xab73('0xb'),'callback':afterUpdate},{'channel':_0xab73('0x13'),'model':_0xab73('0x15'),'event':'afterCreate','condition':'newmessage','callback':afterCreateMessage},{'channel':_0xab73('0x16'),'model':_0xab73('0x17'),'event':_0xab73('0x7'),'condition':_0xab73('0x8'),'callback':afterCreate},{'channel':_0xab73('0x16'),'model':_0xab73('0x17'),'event':_0xab73('0xa'),'condition':_0xab73('0xb'),'callback':afterUpdate},{'channel':'Mail','model':_0xab73('0x18'),'event':_0xab73('0x7'),'condition':_0xab73('0xc'),'callback':afterCreateMessage},{'channel':_0xab73('0x19'),'model':_0xab73('0x1a'),'event':_0xab73('0x7'),'condition':_0xab73('0x8'),'callback':afterCreate},{'channel':'Openchannel','model':_0xab73('0x1a'),'event':_0xab73('0xa'),'condition':_0xab73('0xb'),'callback':afterUpdate},{'channel':_0xab73('0x19'),'model':'OpenchannelMessage','event':'afterCreate','condition':_0xab73('0xc'),'callback':afterCreateMessage}];function request(_0x3b30fd){return client[_0xab73('0x1b')]('EventManager',_0x3b30fd)[_0xab73('0x1c')](function(_0x4b6898){logger['info']('Trigger,\x20%s',_0xab73('0x1d'),_0x4b6898);if(_0x4b6898[_0xab73('0x1e')]){if(_0x4b6898[_0xab73('0x1e')][_0xab73('0x1f')]===0x1f4){logger[_0xab73('0x1e')](_0xab73('0x20'),_0xab73('0x1d'),_0x4b6898[_0xab73('0x1e')]);}}})['catch'](function(_0x16bfef){logger[_0xab73('0x1e')]('Trigger,\x20%s',_0xab73('0x1d'),_0x16bfef);});}function afterCreateMessage(_0x50b088){return function(_0x587d1f){_0x587d1f=_0x587d1f['get']({'plain':!![]});_0x587d1f[_0xab73('0x21')]=_0x50b088;_0x587d1f[_0xab73('0x22')]=_0x50b088;_0x587d1f[_0xab73('0x23')]=_0x587d1f[_0xab73('0x24')];Promise[_0xab73('0x25')]()['then'](function(){if(typeof _0x587d1f[_0xab73('0x26')]==='undefined')return null;var _0x5be15e=_0xab73('0x27')+_0x587d1f[_0xab73('0x26')];return db['sequelize']['query'](_0x5be15e,{'type':db[_0xab73('0x28')][_0xab73('0x29')][_0xab73('0x2a')],'raw':!![]});})[_0xab73('0x1c')](function(_0x5a76d2){if(_0x5a76d2){_0x587d1f[_0xab73('0x2b')]=_0x5a76d2[0x0];}if(typeof _0x587d1f[_0xab73('0x2c')]===_0xab73('0x2d'))return;return getAgent(_0x587d1f[_0xab73('0x2c')]);})[_0xab73('0x1c')](function(_0x20af21){if(_0x20af21){_0x587d1f[_0xab73('0x2e')]=util[_0xab73('0x2f')](_0xab73('0x30'),_0x20af21[_0xab73('0x31')]);_0x587d1f['agent']=_0x20af21;_0x587d1f[_0xab73('0x21')]=_0x50b088;return request({'event':_0xab73('0x32'),'message':_0x587d1f});}else{return request({'event':_0xab73('0x33'),'message':_0x587d1f});}})['catch'](function(_0x4c327c){logger[_0xab73('0x1e')](_0xab73('0x20'),_0xab73('0x34'),_0x4c327c);});};}function afterCreateOfflineMessage(_0x520f21){return function(_0x404c96){_0x404c96=_0x404c96['get']({'plain':!![]});_0x404c96[_0xab73('0x21')]=_0x520f21;_0x404c96[_0xab73('0x22')]=_0x520f21;_0x404c96['event']=_0xab73('0x35');return request({'event':_0x404c96['event'],'message':_0x404c96});};}function afterCreate(_0x11097c,_0x8acfc6){return function(_0x4184c1){_0x4184c1=_0x4184c1[_0xab73('0x36')]({'plain':!![]});_0x4184c1[_0xab73('0x21')]=_0x11097c;_0x4184c1[_0xab73('0x22')]=_0x11097c;_0x4184c1['event']=_0xab73('0x37');Promise[_0xab73('0x25')]()[_0xab73('0x1c')](function(){var _0x2542db='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4184c1[_0xab73('0x26')];return db['sequelize'][_0xab73('0x38')](_0x2542db,{'type':db[_0xab73('0x28')][_0xab73('0x29')][_0xab73('0x2a')],'raw':!![]});})[_0xab73('0x1c')](function(_0x287726){if(_0x287726){_0x4184c1['contact']=_0x287726[0x0];}if(typeof _0x4184c1[_0xab73('0x2c')]==='undefined')return;return getAgent(_0x4184c1[_0xab73('0x2c')]);})[_0xab73('0x1c')](function(_0x31ea7d){if(_0x31ea7d){_0x4184c1[_0xab73('0x2e')]=util[_0xab73('0x2f')](_0xab73('0x30'),_0x31ea7d[_0xab73('0x31')]);_0x4184c1['agent']=_0x31ea7d;}return request({'event':_0x8acfc6,'message':_0x4184c1});})[_0xab73('0x39')](function(_0x54c393){logger[_0xab73('0x1e')](_0xab73('0x20'),_0xab73('0x3a'),_0x54c393);});};}function afterUpdate(_0x36fde2){return function(_0x5d31dc){var _0x28ccd2=_0x5d31dc[_0xab73('0x3b')](_0xab73('0x3c'))&&_0x5d31dc['closed'];var _0x393a7a=_0x5d31dc[_0xab73('0x3b')]('substatus');if(_0x28ccd2||_0x393a7a){var _0x1b698f=_0x28ccd2?_0xab73('0xb'):'substatus';var _0x2779b4=_0x5d31dc[_0xab73('0x36')]({'plain':!![]});_0x2779b4[_0xab73('0x21')]=_0x36fde2;_0x2779b4[_0xab73('0x22')]=_0x36fde2;_0x2779b4[_0xab73('0x23')]=_0x28ccd2?_0xab73('0x3c'):_0xab73('0x3d');var _0x4ec037=_0xab73('0x27')+_0x2779b4[_0xab73('0x26')];return db[_0xab73('0x3e')][_0xab73('0x38')](_0x4ec037,{'type':db[_0xab73('0x28')][_0xab73('0x29')][_0xab73('0x2a')],'raw':!![]})[_0xab73('0x1c')](function(_0x1043c9){if(_0x1043c9){_0x2779b4[_0xab73('0x2b')]=_0x1043c9[0x0];}if(typeof _0x2779b4[_0xab73('0x2c')]===_0xab73('0x2d'))return;return getAgent(_0x2779b4[_0xab73('0x2c')]);})[_0xab73('0x1c')](function(_0x344aaf){if(_0x344aaf){_0x2779b4[_0xab73('0x2e')]=util[_0xab73('0x2f')](_0xab73('0x30'),_0x344aaf['name']);_0x2779b4['agent']=_0x344aaf;}return request({'event':_0x1b698f,'message':_0x2779b4});})[_0xab73('0x39')](function(_0x48721d){logger['error']('Trigger,\x20%s','AfterUpdate',_0x48721d);});}};}function getAgent(_0x834432){return db[_0xab73('0x3f')][_0xab73('0x40')]({'where':{'id':_0x834432},'attributes':['id',_0xab73('0x31'),_0xab73('0x41'),_0xab73('0x42'),_0xab73('0x43')],'raw':!![]})[_0xab73('0x1c')](function(_0x5f3492){return _0x5f3492;});}exports[_0xab73('0x44')]=function(){for(var _0x56681a=0x0;_0x56681a=_0x2e7197[_0x28cd('0x12')]){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x430fc5(_0x112cd9);})[_0x28cd('0x13')](function(_0x106b5d){_0x567ae7(_0x106b5d);});});}; \ No newline at end of file +var _0xf1db=['../mysqldb','voice','mail','chat','fax','sms','openchannel','getChannels','isValidChannel','toLowerCase','clearBlockUser','blockedAt','updateAttributes','getLicense','role','agent','User','count','then','agents','catch','bluebird'];(function(_0x4d6298,_0x502f6b){var _0x57ccf0=function(_0x3cef94){while(--_0x3cef94){_0x4d6298['push'](_0x4d6298['shift']());}};_0x57ccf0(++_0x502f6b);}(_0xf1db,0x6d));var _0xbf1d=function(_0x55045f,_0x4717e6){_0x55045f=_0x55045f-0x0;var _0x1805fc=_0xf1db[_0x55045f];return _0x1805fc;};'use strict';var _=require('lodash');var BPromise=require(_0xbf1d('0x0'));var db=require(_0xbf1d('0x1'))['db'];var util=require('./license/util');var channels=[_0xbf1d('0x2'),_0xbf1d('0x3'),_0xbf1d('0x4'),_0xbf1d('0x5'),_0xbf1d('0x6'),'whatsapp',_0xbf1d('0x7')];exports[_0xbf1d('0x8')]=function(){return channels;};exports[_0xbf1d('0x9')]=function(_0x2c83a7){_0x2c83a7=_0x2c83a7[_0xbf1d('0xa')]();return _['includes'](channels,_0x2c83a7);};exports[_0xbf1d('0xb')]=function(_0x5d1f1f,_0x24f1ce,_0x5624be,_0x265018){var _0x506f2e={'loginAttempts':_0x24f1ce,'blocked':_0x5624be};if(!_['isUndefined'](_0x265018)){_0x506f2e[_0xbf1d('0xc')]=_0x265018;}return _0x5d1f1f[_0xbf1d('0xd')](_0x506f2e);};exports[_0xbf1d('0xe')]=function(_0x2cb393){return new BPromise(function(_0x203147,_0x408681){var _0x42ee27=0x0;if(_0x2cb393[_0xbf1d('0xf')]!==_0xbf1d('0x10')){_0x203147(_0x2cb393);}db[_0xbf1d('0x11')][_0xbf1d('0x12')]({'where':{'role':_0xbf1d('0x10'),'online':!![],'id':{'$ne':_0x2cb393['id']}}})[_0xbf1d('0x13')](function(_0x4d95da){_0x42ee27=_0x4d95da;return util['getLicense']();})[_0xbf1d('0x13')](function(_0x47faf1){if(_0x47faf1&&_0x47faf1[_0xbf1d('0x14')]&&_0x42ee27>=_0x47faf1[_0xbf1d('0x14')]){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x203147(_0x2cb393);})[_0xbf1d('0x15')](function(_0x32eab4){_0x408681(_0x32eab4);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 6e9043e..3f384a2 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x35f6=['404','status','render','json'];(function(_0x2a7959,_0x5aaf1e){var _0x358727=function(_0x3464ae){while(--_0x3464ae){_0x2a7959['push'](_0x2a7959['shift']());}};_0x358727(++_0x5aaf1e);}(_0x35f6,0x11c));var _0x635f=function(_0x322d4c,_0x22edb7){_0x322d4c=_0x322d4c-0x0;var _0x39126a=_0x35f6[_0x322d4c];return _0x39126a;};'use strict';module['exports'][0x194]=function pageNotFound(_0x1c62a8,_0x4aef61){var _0xdc1584=_0x635f('0x0');var _0x194344=0x194;var _0x754f30={'status':_0x194344};_0x4aef61[_0x635f('0x1')](_0x754f30['status']);_0x4aef61[_0x635f('0x2')](_0xdc1584,{},function(_0x31b69c,_0x53c7bd){if(_0x31b69c){return _0x4aef61['status'](_0x754f30[_0x635f('0x1')])[_0x635f('0x3')](_0x754f30);}_0x4aef61['send'](_0x53c7bd);});}; \ No newline at end of file +var _0x13fd=['send','exports','404','status','render','json'];(function(_0x28d1cd,_0x192371){var _0xdcb892=function(_0x145f6e){while(--_0x145f6e){_0x28d1cd['push'](_0x28d1cd['shift']());}};_0xdcb892(++_0x192371);}(_0x13fd,0x1d5));var _0xd13f=function(_0x13fa48,_0x3e97f3){_0x13fa48=_0x13fa48-0x0;var _0xd380a7=_0x13fd[_0x13fa48];return _0xd380a7;};'use strict';module[_0xd13f('0x0')][0x194]=function pageNotFound(_0x497453,_0x2f7089){var _0x92b9a6=_0xd13f('0x1');var _0x24339a=0x194;var _0xa0c1ca={'status':_0x24339a};_0x2f7089['status'](_0xa0c1ca[_0xd13f('0x2')]);_0x2f7089[_0xd13f('0x3')](_0x92b9a6,{},function(_0x3b549d,_0x160b71){if(_0x3b549d){return _0x2f7089['status'](_0xa0c1ca['status'])[_0xd13f('0x4')](_0xa0c1ca);}_0x2f7089[_0xd13f('0x5')](_0x160b71);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index f5e7bed..6939938 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc08a=['Integration','../api/integration/integration.model','IntegrationReport','../api/analyticCustomReport/analyticCustomReport.model','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','AnalyticMetric','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','DeskAccount','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Network','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/squareReport/squareReport.model','SquareDetailsReport','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','../api/squareRecording/squareRecording.model','../api/squareMessage/squareMessage.model','../api/team/team.model','License','../api/license/license.model','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','UserProfileResource','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappInteraction','../api/whatsappMessage/whatsappMessage.model','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','CloudProvider','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','../api/userVoicePrefix/userVoicePrefix.model','UserSetting','User','cascade','UserId','hasMany','Recordings','VoiceQueuesRt','VoiceExtension','Extensions','HopperFinals','CmHopperHistory','HopperHistory','ChatInteractions','SmsInteractions','FaxInteractions','MailInteractions','WhatsappInteractions','SenderId','belongsTo','userProfileId','belongsToMany','Groups','chat_group_has_users','CmContact','Contacts','cm_user_has_lists','Team','user_has_teams','user_has_mail_interactions','user_has_chat_interactions','user_has_fax_interactions','user_has_sms_interactions','OpenchannelInteractions','user_has_openchannel_interactions','VoiceQueues','VoicePrefixes','UserVoicePrefix','MailQueues','ChatQueues','FaxQueues','SmsQueue','UserSmsQueue','OpenchannelQueues','WhatsappQueues','ChatWebsites','FaxAccounts','user_has_fax_accounts','MailAccount','user_has_mail_accounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','SquareProjects','SpiedAgents','ChanSpyId','Applications','Members','VoiceQueueId','Hoppers','HopperHistories','HopperBlacks','JscriptySessions','Trunk','TrunkId','TrunkBackup','TrunkBackupId','Interval','IntervalId','mandatoryDispositionPause','mandatoryDispositionPauseId','Lists','voice_queues_has_cm_lists','Agents','Teams','BlackLists','voice_queues_has_cm_blacklists','ScreenRecording','mailboxuser','mailbox','QueueCalls','AgentReports','Contact','ContactId','CloudProviderId','MailServerOut','MailAccountId','restrict','hasOne','Dispositions','Answers','MailMessage','Messages','Interactions','List','ListId','Template','TemplateId','team_has_mail_queues','MailInteractionId','Account','Owner','Tags','ThroughTags','Interaction','ChatOfflineMessage','ChatOfflineMessageId','Items','FaxAccountId','TagId','FaxInteractionId','fax_interaction_has_tags','Users','AttachmentId','team_has_fax_queues','SmsAccountId','sms_interaction_has_tags','SmsInteractionId','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','user_has_openchannel_accounts','OpenchannelQueueId','openchannel_interaction_has_tags','OpenchannelInteractionId','team_has_openchannel_queues','ChatWebsiteId','ChatProactiveAction','ProactiveActions','user_has_chat_websites','Agent','Queue','ChatQueueId','ChatInteractionId','chat_interaction_has_tags','Attachments','team_has_chat_queues','ChatInternalMessage','Website','CompanyId','CmHopper','CmCompany','Company','cm_user_has_contacts','cm_contact_has_tags','Campaign','CampaignId','All','OneAll','AutomationAllId','Automation','Any','OneAny','AutomationAnyId','Intervals','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','CustomReportId','Mohs','moh_has_sounds','mail_interaction_has_tags','whatsapp_interaction_has_tags','AllCondition','TriggerAllId','AnyCondition','TriggerId','AnalyticCustomReport','Fields','MetricId','SalesforceAccount','Configurations','AccountId','Subjects','SubjectId','Descriptions','FieldId','Subject','Description','Field','VariableId','SugarcrmAccount','DescriptionId','int_desk_configuration_has_tags','ZohoField','int_zendesk_configuration_has_tags','FreshdeskField','int_freshdesk_configuration_has_tags','VtigerAccount','ServicenowConfiguration','Dynamics365Configuration','FreshsalesConfiguration','FromId','SessionId','ProjectId','user_has_square_projects','SmsQueues','team_has_whatsapp_queues','TeamVoicePrefix','SquareProjectId','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromAccount','FromAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','FromChatWebsiteId','FromUserId','ToUserId','ToAgent','ToChatWebsiteId','FaxTransferReport','ToFaxQueueId','ToFaxAccountId','ToOpenchannelQueueId','ToSmsQueueId','ToSmsAccountId','CustomFields','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappApplication','WhatsappInteractionId','WhatsappMessage','WhatsappQueueReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','user','Imap','Smtp','exports','../config/environment','sequelize','lodash','jstz','determine','defaultsDeep','motion2','mysql','name','utf8','utf8_general_ci','sequelizeHistory','xcall','utf8mb4','database','password','options','import','../api/user/user.model','VoiceChanSpy','VoiceContext','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','MailServerIn','../api/mailServerIn/mailServerIn.model','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','../api/chatProactiveAction/chatProactiveAction.model','../api/cmContact/cmContact.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','Action','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/template/template.model','Trigger','Variable'];(function(_0x1644f2,_0x2884e8){var _0x1fcb31=function(_0x41773c){while(--_0x41773c){_0x1644f2['push'](_0x1644f2['shift']());}};_0x1fcb31(++_0x2884e8);}(_0xc08a,0x15f));var _0xac08=function(_0x5c0dc2,_0x4022ef){_0x5c0dc2=_0x5c0dc2-0x0;var _0x4ea1bf=_0xc08a[_0x5c0dc2];return _0x4ea1bf;};'use strict';var config=require(_0xac08('0x0'));var Sequelize=require(_0xac08('0x1'));var _=require(_0xac08('0x2'));var jstz=require(_0xac08('0x3'));var timezone=jstz[_0xac08('0x4')]();config['sequelize']=_[_0xac08('0x5')](config['sequelize'],{'database':_0xac08('0x6'),'username':'xcall','password':'xC@LL1234','options':{'host':'127.0.0.1','port':0xcea,'dialect':_0xac08('0x7'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0xac08('0x8')](),'define':{'charset':_0xac08('0x9'),'collate':_0xac08('0xa')}}});config[_0xac08('0xb')]=_[_0xac08('0x5')](config[_0xac08('0xb')],{'database':_0xac08('0x6'),'username':_0xac08('0xc'),'password':'xC@LL1234','options':{'host':'127.0.0.1','port':0xcea,'dialect':_0xac08('0x7'),'dialectOptions':{'charset':_0xac08('0xd')},'logging':![],'timezone':timezone[_0xac08('0x8')](),'define':{'charset':_0xac08('0x9'),'collate':_0xac08('0xa')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xac08('0x1')][_0xac08('0xe')],config['sequelize']['username'],config[_0xac08('0x1')][_0xac08('0xf')],config[_0xac08('0x1')][_0xac08('0x10')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xac08('0xb')]['database'],config[_0xac08('0xb')]['username'],config[_0xac08('0xb')][_0xac08('0xf')],config['sequelizeHistory']['options'])};db['User']=db['sequelize'][_0xac08('0x11')](_0xac08('0x12'));db[_0xac08('0x13')]=db[_0xac08('0x1')][_0xac08('0x11')]('../api/voiceChanSpy/voiceChanSpy.model');db[_0xac08('0x14')]=db[_0xac08('0x1')][_0xac08('0x11')]('../api/voiceContext/voiceContext.model');db['VoiceExtension']=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0x15'));db[_0xac08('0x16')]=db[_0xac08('0x1')][_0xac08('0x11')]('../api/voiceMusicOnHold/voiceMusicOnHold.model');db[_0xac08('0x17')]=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0x18'));db[_0xac08('0x19')]=db[_0xac08('0x1')]['import'](_0xac08('0x1a'));db['ScreenRecording']=db[_0xac08('0x1')]['import']('../api/screenRecording/screenRecording.model');db[_0xac08('0x1b')]=db[_0xac08('0x1')]['import'](_0xac08('0x1c'));db[_0xac08('0x1d')]=db[_0xac08('0x1')][_0xac08('0x11')]('../api/voiceMailMessage/voiceMailMessage.model');db[_0xac08('0x1e')]=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0x1f'));db[_0xac08('0x20')]=db['sequelize'][_0xac08('0x11')]('../api/voiceDialReport/voiceDialReport.model');db[_0xac08('0x21')]=db['sequelize'][_0xac08('0x11')](_0xac08('0x22'));db[_0xac08('0x23')]=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0x24'));db[_0xac08('0x25')]=db['sequelize']['import']('../api/memberReport/memberReport.model');db['Trunk']=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0x26'));db[_0xac08('0x27')]=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0x28'));db[_0xac08('0x29')]=db[_0xac08('0x1')]['import'](_0xac08('0x2a'));db[_0xac08('0x2b')]=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0x2c'));db[_0xac08('0x2d')]=db['sequelize'][_0xac08('0x11')]('../api/userChatQueue/userChatQueue.model');db[_0xac08('0x2e')]=db[_0xac08('0x1')]['import'](_0xac08('0x2f'));db[_0xac08('0x30')]=db[_0xac08('0x1')][_0xac08('0x11')]('../api/userFaxQueue/userFaxQueue.model');db['UserSmsQueue']=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0x31'));db[_0xac08('0x32')]=db[_0xac08('0x1')]['import'](_0xac08('0x33'));db[_0xac08('0x34')]=db['sequelize'][_0xac08('0x11')]('../api/userWhatsappQueue/userWhatsappQueue.model');db[_0xac08('0x35')]=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0x36'));db['MailServerOut']=db[_0xac08('0x1')]['import']('../api/mailServerOut/mailServerOut.model');db['MailAccount']=db['sequelize'][_0xac08('0x11')](_0xac08('0x37'));db[_0xac08('0x38')]=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0x39'));db[_0xac08('0x3a')]=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0x3b'));db[_0xac08('0x3c')]=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0x3d'));db['MailMessage']=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0x3e'));db[_0xac08('0x3f')]=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0x40'));db[_0xac08('0x41')]=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0x42'));db[_0xac08('0x43')]=db['sequelize']['import'](_0xac08('0x44'));db[_0xac08('0x45')]=db[_0xac08('0x1')][_0xac08('0x11')]('../api/dashboardItem/dashboardItem.model');db[_0xac08('0x46')]=db['sequelize']['import'](_0xac08('0x47'));db[_0xac08('0x48')]=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0x49'));db[_0xac08('0x4a')]=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0x4b'));db[_0xac08('0x4c')]=db[_0xac08('0x1')]['import'](_0xac08('0x4d'));db[_0xac08('0x4e')]=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0x4f'));db[_0xac08('0x50')]=db['sequelize'][_0xac08('0x11')]('../api/faxQueueReport/faxQueueReport.model');db[_0xac08('0x51')]=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0x52'));db[_0xac08('0x53')]=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0x54'));db[_0xac08('0x55')]=db['sequelize'][_0xac08('0x11')](_0xac08('0x56'));db[_0xac08('0x57')]=db[_0xac08('0x1')]['import'](_0xac08('0x58'));db['SmsQueue']=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0x59'));db[_0xac08('0x5a')]=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0x5b'));db[_0xac08('0x5c')]=db[_0xac08('0x1')]['import']('../api/openchannelApplication/openchannelApplication.model');db[_0xac08('0x5d')]=db[_0xac08('0x1')]['import'](_0xac08('0x5e'));db[_0xac08('0x5f')]=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0x60'));db[_0xac08('0x61')]=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0x62'));db[_0xac08('0x63')]=db['sequelize'][_0xac08('0x11')]('../api/chatWebsite/chatWebsite.model');db[_0xac08('0x64')]=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0x65'));db[_0xac08('0x66')]=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0x67'));db[_0xac08('0x68')]=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0x69'));db[_0xac08('0x6a')]=db[_0xac08('0x1')][_0xac08('0x11')]('../api/chatMessage/chatMessage.model');db['ChatOfflineMessage']=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0x6b'));db[_0xac08('0x6c')]=db['sequelize'][_0xac08('0x11')](_0xac08('0x6d'));db[_0xac08('0x6e')]=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0x6f'));db['ChatProactiveAction']=db[_0xac08('0x1')]['import'](_0xac08('0x70'));db['CmCompany']=db[_0xac08('0x1')][_0xac08('0x11')]('../api/cmCompany/cmCompany.model');db['CmContact']=db[_0xac08('0x1')]['import'](_0xac08('0x71'));db['CmHopper']=db[_0xac08('0x1')]['import']('../api/cmHopper/cmHopper.model');db[_0xac08('0x72')]=db[_0xac08('0x1')]['import'](_0xac08('0x73'));db[_0xac08('0x74')]=db['sequelize'][_0xac08('0x11')](_0xac08('0x75'));db['CmHopperHistory']=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0x76'));db[_0xac08('0x77')]=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0x78'));db[_0xac08('0x79')]=db['sequelize']['import']('../api/cmCustomField/cmCustomField.model');db[_0xac08('0x7a')]=db[_0xac08('0x1')][_0xac08('0x11')]('../api/action/action.model');db['Automation']=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0x7b'));db[_0xac08('0x7c')]=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0x7d'));db[_0xac08('0x7e')]=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0x7f'));db[_0xac08('0x80')]=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0x81'));db['Interval']=db[_0xac08('0x1')][_0xac08('0x11')]('../api/interval/interval.model');db[_0xac08('0x82')]=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0x83'));db[_0xac08('0x84')]=db[_0xac08('0x1')]['import'](_0xac08('0x85'));db[_0xac08('0x86')]=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0x87'));db[_0xac08('0x88')]=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0x89'));db[_0xac08('0x8a')]=db[_0xac08('0x1')]['import'](_0xac08('0x8b'));db[_0xac08('0x8c')]=db[_0xac08('0x1')]['import']('../api/tag/tag.model');db['Template']=db[_0xac08('0x1')]['import'](_0xac08('0x8d'));db[_0xac08('0x8e')]=db[_0xac08('0x1')]['import']('../api/trigger/trigger.model');db[_0xac08('0x8f')]=db[_0xac08('0x1')][_0xac08('0x11')]('../api/variable/variable.model');db[_0xac08('0x90')]=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0x91'));db[_0xac08('0x92')]=db[_0xac08('0x1')][_0xac08('0x11')]('../api/integrationReport/integrationReport.model');db['AnalyticCustomReport']=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0x93'));db['AnalyticDefaultReport']=db['sequelize'][_0xac08('0x11')](_0xac08('0x94'));db[_0xac08('0x95')]=db[_0xac08('0x1')][_0xac08('0x11')]('../api/analyticExtractedReport/analyticExtractedReport.model');db[_0xac08('0x96')]=db[_0xac08('0x1')]['import']('../api/analyticMetric/analyticMetric.model');db[_0xac08('0x97')]=db[_0xac08('0x1')]['import'](_0xac08('0x98'));db['AnalyticTreeReport']=db[_0xac08('0x1')][_0xac08('0x11')]('../api/analyticTreeReport/analyticTreeReport.model');db['SalesforceAccount']=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0x99'));db[_0xac08('0x9a')]=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0x9b'));db[_0xac08('0x9c')]=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0x9d'));db['SugarcrmAccount']=db['sequelize'][_0xac08('0x11')](_0xac08('0x9e'));db[_0xac08('0x9f')]=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0xa0'));db[_0xac08('0xa1')]=db[_0xac08('0x1')][_0xac08('0x11')]('../api/intSugarcrmField/intSugarcrmField.model');db[_0xac08('0xa2')]=db['sequelize'][_0xac08('0x11')]('../api/intDeskAccount/intDeskAccount.model');db[_0xac08('0xa3')]=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0xa4'));db[_0xac08('0xa5')]=db['sequelize'][_0xac08('0x11')]('../api/intDeskField/intDeskField.model');db[_0xac08('0xa6')]=db['sequelize'][_0xac08('0x11')](_0xac08('0xa7'));db[_0xac08('0xa8')]=db['sequelize'][_0xac08('0x11')]('../api/intZohoConfiguration/intZohoConfiguration.model');db['ZohoField']=db['sequelize'][_0xac08('0x11')]('../api/intZohoField/intZohoField.model');db[_0xac08('0xa9')]=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0xaa'));db[_0xac08('0xab')]=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0xac'));db[_0xac08('0xad')]=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0xae'));db[_0xac08('0xaf')]=db[_0xac08('0x1')]['import'](_0xac08('0xb0'));db[_0xac08('0xb1')]=db['sequelize'][_0xac08('0x11')](_0xac08('0xb2'));db['FreshdeskField']=db['sequelize'][_0xac08('0x11')]('../api/intFreshdeskField/intFreshdeskField.model');db['VtigerAccount']=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0xb3'));db[_0xac08('0xb4')]=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0xb5'));db[_0xac08('0xb6')]=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0xb7'));db[_0xac08('0xb8')]=db[_0xac08('0x1')]['import'](_0xac08('0xb9'));db['ServicenowConfiguration']=db[_0xac08('0x1')][_0xac08('0x11')]('../api/intServicenowConfiguration/intServicenowConfiguration.model');db[_0xac08('0xba')]=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0xbb'));db[_0xac08('0xbc')]=db['sequelize'][_0xac08('0x11')](_0xac08('0xbd'));db['Dynamics365Configuration']=db['sequelize'][_0xac08('0x11')](_0xac08('0xbe'));db[_0xac08('0xbf')]=db['sequelize'][_0xac08('0x11')](_0xac08('0xc0'));db[_0xac08('0xc1')]=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0xc2'));db['FreshsalesConfiguration']=db[_0xac08('0x1')][_0xac08('0x11')]('../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model');db[_0xac08('0xc3')]=db[_0xac08('0x1')]['import'](_0xac08('0xc4'));db[_0xac08('0x90')]=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0x91'));db[_0xac08('0xc5')]=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0xc6'));db[_0xac08('0xc7')]=db[_0xac08('0x1')]['import'](_0xac08('0xc8'));db['ChatInternalMessage']=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0xc9'));db[_0xac08('0xca')]=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0xcb'));db[_0xac08('0xcc')]=db[_0xac08('0x1')]['import'](_0xac08('0xcd'));db[_0xac08('0xce')]=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0xcf'));db[_0xac08('0xd0')]=db[_0xac08('0x1')][_0xac08('0x11')]('../api/smsQueueReport/smsQueueReport.model');db['SquareReport']=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0xd1'));db[_0xac08('0xd2')]=db['sequelize']['import']('../api/squareReportDetail/squareReportDetail.model');db[_0xac08('0xd3')]=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0xd4'));db[_0xac08('0xd5')]=db[_0xac08('0x1')]['import'](_0xac08('0xd6'));db[_0xac08('0xd7')]=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0xd8'));db[_0xac08('0xd9')]=db[_0xac08('0x1')]['import'](_0xac08('0xda'));db['SquareRecording']=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0xdb'));db['SquareMessage']=db['sequelize'][_0xac08('0x11')](_0xac08('0xdc'));db['Team']=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0xdd'));db[_0xac08('0xde')]=db[_0xac08('0x1')]['import'](_0xac08('0xdf'));db['Campaign']=db[_0xac08('0x1')][_0xac08('0x11')]('../api/campaign/campaign.model');db[_0xac08('0xe0')]=db[_0xac08('0x1')]['import'](_0xac08('0xe1'));db[_0xac08('0xe2')]=db[_0xac08('0x1')]['import'](_0xac08('0xe3'));db[_0xac08('0xe4')]=db[_0xac08('0x1')]['import'](_0xac08('0xe5'));db['MailTransferReport']=db[_0xac08('0x1')][_0xac08('0x11')]('../api/mailTransferReport/mailTransferReport.model');db[_0xac08('0xe6')]=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0xe7'));db['FaxTransferReport']=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0xe8'));db[_0xac08('0xe9')]=db[_0xac08('0x1')]['import'](_0xac08('0xea'));db[_0xac08('0xeb')]=db['sequelize'][_0xac08('0x11')]('../api/smsTransferReport/smsTransferReport.model');db[_0xac08('0xec')]=db[_0xac08('0x1')]['import'](_0xac08('0xed'));db[_0xac08('0xee')]=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0xef'));db[_0xac08('0xf0')]=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0xf1'));db[_0xac08('0xf2')]=db['sequelize'][_0xac08('0x11')]('../api/userProfileSection/userProfileSection.model');db[_0xac08('0xf3')]=db['sequelize'][_0xac08('0x11')]('../api/userProfileResource/userProfileResource.model');db[_0xac08('0xf4')]=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0xf5'));db[_0xac08('0xf6')]=db['sequelize'][_0xac08('0x11')](_0xac08('0xf7'));db['WhatsappApplication']=db['sequelize'][_0xac08('0x11')]('../api/whatsappApplication/whatsappApplication.model');db[_0xac08('0xf8')]=db['sequelize'][_0xac08('0x11')]('../api/whatsappInteraction/whatsappInteraction.model');db['WhatsappMessage']=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0xf9'));db['WhatsappQueueReport']=db[_0xac08('0x1')]['import'](_0xac08('0xfa'));db[_0xac08('0xfb')]=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0xfc'));db[_0xac08('0xfd')]=db[_0xac08('0x1')][_0xac08('0x11')]('../api/whatsappQueue/whatsappQueue.model');db[_0xac08('0xfe')]=db[_0xac08('0x1')][_0xac08('0x11')]('../api/cloudProvider/cloudProvider.model');db[_0xac08('0xff')]=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0x100'));db['TeamVoicePrefix']=db[_0xac08('0x1')][_0xac08('0x11')]('../api/teamVoicePrefix/teamVoicePrefix.model');db['UserVoicePrefix']=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0x101'));db[_0xac08('0x102')]=db[_0xac08('0x1')][_0xac08('0x11')]('../api/user-setting/user-setting.model');db[_0xac08('0x103')]['hasOne'](db[_0xac08('0x1b')],{'as':_0xac08('0x1b'),'onDelete':_0xac08('0x104'),'foreignKey':'UserId'});db[_0xac08('0x103')]['hasOne'](db[_0xac08('0x102')],{'as':'userSetting','onDelete':_0xac08('0x104'),'foreignKey':_0xac08('0x105')});db[_0xac08('0x103')][_0xac08('0x106')](db[_0xac08('0x19')],{'as':_0xac08('0x107'),'foreignKey':_0xac08('0x105')});db[_0xac08('0x103')][_0xac08('0x106')](db[_0xac08('0x29')],{'as':_0xac08('0x108'),'foreignKey':_0xac08('0x105')});db[_0xac08('0x103')][_0xac08('0x106')](db[_0xac08('0x109')],{'as':_0xac08('0x10a'),'onDelete':_0xac08('0x104'),'hooks':!![]});db['User']['hasMany'](db[_0xac08('0x74')],{'as':_0xac08('0x10b'),'foreignKey':'UserId'});db['User']['hasMany'](db[_0xac08('0x10c')],{'as':_0xac08('0x10d'),'foreignKey':_0xac08('0x105')});db[_0xac08('0x103')]['hasMany'](db[_0xac08('0x77')],{'as':_0xac08('0x77'),'foreignKey':_0xac08('0x105')});db[_0xac08('0x103')][_0xac08('0x106')](db['OpenchannelInteraction'],{'as':'OpenchannelInteractions','foreignKey':_0xac08('0x105')});db[_0xac08('0x103')][_0xac08('0x106')](db[_0xac08('0x68')],{'as':_0xac08('0x10e'),'foreignKey':_0xac08('0x105')});db[_0xac08('0x103')][_0xac08('0x106')](db[_0xac08('0x55')],{'as':_0xac08('0x10f'),'foreignKey':_0xac08('0x105')});db[_0xac08('0x103')]['hasMany'](db['FaxInteraction'],{'as':_0xac08('0x110'),'foreignKey':_0xac08('0x105')});db[_0xac08('0x103')]['hasMany'](db['MailInteraction'],{'as':_0xac08('0x111'),'foreignKey':_0xac08('0x105')});db[_0xac08('0x103')][_0xac08('0x106')](db[_0xac08('0xf8')],{'as':_0xac08('0x112'),'foreignKey':_0xac08('0x105')});db[_0xac08('0x103')][_0xac08('0x106')](db[_0xac08('0xf4')],{'as':'UserNotifications','foreignKey':_0xac08('0x113')});db[_0xac08('0x103')][_0xac08('0x114')](db[_0xac08('0xf0')],{'as':_0xac08('0xf0'),'foreignKey':_0xac08('0x115')});db[_0xac08('0x103')][_0xac08('0x116')](db[_0xac08('0x6e')],{'as':_0xac08('0x117'),'through':_0xac08('0x118')});db[_0xac08('0x103')][_0xac08('0x116')](db[_0xac08('0x119')],{'as':_0xac08('0x11a'),'through':'cm_user_has_contacts'});db[_0xac08('0x103')][_0xac08('0x116')](db['CmList'],{'as':'Lists','through':_0xac08('0x11b')});db[_0xac08('0x103')][_0xac08('0x116')](db[_0xac08('0x11c')],{'through':_0xac08('0x11d')});db[_0xac08('0x103')][_0xac08('0x116')](db[_0xac08('0x3c')],{'as':_0xac08('0x111'),'through':_0xac08('0x11e')});db[_0xac08('0x103')]['belongsToMany'](db[_0xac08('0x68')],{'as':'ChatInteractions','through':_0xac08('0x11f')});db[_0xac08('0x103')][_0xac08('0x116')](db[_0xac08('0x4a')],{'as':_0xac08('0x110'),'through':_0xac08('0x120')});db[_0xac08('0x103')][_0xac08('0x116')](db[_0xac08('0x55')],{'as':'SmsInteractions','through':_0xac08('0x121')});db[_0xac08('0x103')][_0xac08('0x116')](db[_0xac08('0x5d')],{'as':_0xac08('0x122'),'through':_0xac08('0x123')});db[_0xac08('0x103')]['belongsToMany'](db['WhatsappInteraction'],{'as':'WhatsappInteractions','through':'user_has_whatsapp_interactions'});db['User']['belongsToMany'](db[_0xac08('0x17')],{'as':_0xac08('0x124'),'through':'UserVoiceQueue','required':![]});db['User']['belongsToMany'](db[_0xac08('0xee')],{'as':_0xac08('0x125'),'through':_0xac08('0x126'),'required':![]});db['User'][_0xac08('0x116')](db['MailQueue'],{'as':_0xac08('0x127'),'through':_0xac08('0x2e'),'required':![]});db['User']['belongsToMany'](db['ChatQueue'],{'as':_0xac08('0x128'),'through':_0xac08('0x2d'),'required':![],'hooks':!![]});db[_0xac08('0x103')]['belongsToMany'](db[_0xac08('0x4e')],{'as':_0xac08('0x129'),'through':_0xac08('0x30'),'required':![]});db['User'][_0xac08('0x116')](db[_0xac08('0x12a')],{'as':'SmsQueues','through':_0xac08('0x12b'),'required':![]});db[_0xac08('0x103')]['belongsToMany'](db[_0xac08('0x61')],{'as':_0xac08('0x12c'),'through':'UserOpenchannelQueue','required':![]});db[_0xac08('0x103')][_0xac08('0x116')](db[_0xac08('0xfd')],{'as':_0xac08('0x12d'),'through':_0xac08('0x34'),'required':![]});db[_0xac08('0x103')]['belongsToMany'](db[_0xac08('0xec')],{'through':'cm_user_has_lists'});db[_0xac08('0x103')][_0xac08('0x116')](db['ChatWebsite'],{'as':_0xac08('0x12e'),'through':'user_has_chat_websites'});db[_0xac08('0x103')][_0xac08('0x116')](db['FaxAccount'],{'as':_0xac08('0x12f'),'through':_0xac08('0x130')});db[_0xac08('0x103')][_0xac08('0x116')](db[_0xac08('0x131')],{'as':'MailAccounts','through':_0xac08('0x132')});db[_0xac08('0x103')][_0xac08('0x116')](db['OpenchannelAccount'],{'as':'OpenchannelAccounts','through':'user_has_openchannel_accounts'});db[_0xac08('0x103')][_0xac08('0x116')](db[_0xac08('0x51')],{'as':'SmsAccounts','through':_0xac08('0x133')});db[_0xac08('0x103')][_0xac08('0x116')](db['WhatsappAccount'],{'as':_0xac08('0x134'),'through':_0xac08('0x135')});db['User'][_0xac08('0x116')](db[_0xac08('0xd9')],{'as':_0xac08('0x136'),'through':'user_has_square_projects'});db[_0xac08('0x13')]['hasMany'](db[_0xac08('0x109')],{'as':_0xac08('0x137'),'onDelete':_0xac08('0x104'),'foreignKey':_0xac08('0x138')});db[_0xac08('0x14')][_0xac08('0x106')](db['VoiceExtension'],{'onDelete':_0xac08('0x104')});db[_0xac08('0x109')][_0xac08('0x106')](db[_0xac08('0x109')],{'as':_0xac08('0x139'),'onDelete':_0xac08('0x104')});db[_0xac08('0x16')][_0xac08('0x116')](db[_0xac08('0x8a')],{'as':'Sounds','through':'moh_has_sounds'});db[_0xac08('0x17')][_0xac08('0x106')](db[_0xac08('0x29')],{'as':_0xac08('0x13a'),'foreignKey':_0xac08('0x13b')});db[_0xac08('0x17')][_0xac08('0x106')](db['CmHopper'],{'as':_0xac08('0x13c'),'foreignKey':_0xac08('0x13b')});db[_0xac08('0x17')][_0xac08('0x106')](db[_0xac08('0x74')],{'as':_0xac08('0x10b'),'foreignKey':_0xac08('0x13b')});db[_0xac08('0x17')][_0xac08('0x106')](db['CmHopperHistory'],{'as':_0xac08('0x13d'),'foreignKey':_0xac08('0x13b')});db[_0xac08('0x17')][_0xac08('0x106')](db[_0xac08('0x77')],{'as':_0xac08('0x77'),'foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0xac08('0x106')](db['CmHopperBlack'],{'as':_0xac08('0x13e'),'foreignKey':_0xac08('0x13b')});db[_0xac08('0x17')][_0xac08('0x106')](db[_0xac08('0xce')],{'as':_0xac08('0x13f'),'foreignKey':_0xac08('0x13b')});db['VoiceQueue'][_0xac08('0x114')](db[_0xac08('0x140')],{'as':'Trunk','foreignKey':_0xac08('0x141')});db['VoiceQueue'][_0xac08('0x114')](db[_0xac08('0x140')],{'as':_0xac08('0x142'),'foreignKey':_0xac08('0x143')});db[_0xac08('0x17')][_0xac08('0x114')](db[_0xac08('0x144')],{'as':_0xac08('0x144'),'foreignKey':_0xac08('0x145')});db['VoiceQueue'][_0xac08('0x114')](db['Pause'],{'as':_0xac08('0x146'),'foreignKey':_0xac08('0x147')});db[_0xac08('0x17')][_0xac08('0x116')](db[_0xac08('0xec')],{'as':_0xac08('0x148'),'through':_0xac08('0x149')});db[_0xac08('0x17')][_0xac08('0x116')](db[_0xac08('0x103')],{'as':_0xac08('0x14a'),'through':_0xac08('0x2b')});db[_0xac08('0x17')][_0xac08('0x116')](db['Team'],{'as':_0xac08('0x14b'),'through':_0xac08('0xff')});db[_0xac08('0x17')][_0xac08('0x116')](db[_0xac08('0xec')],{'as':_0xac08('0x14c'),'through':_0xac08('0x14d')});db[_0xac08('0x19')][_0xac08('0x114')](db[_0xac08('0x103')],{'as':_0xac08('0x103'),'foreignKey':_0xac08('0x105')});db[_0xac08('0x14e')]['belongsTo'](db[_0xac08('0x103')],{'as':_0xac08('0x103'),'foreignKey':'UserId'});db['VoiceMail'][_0xac08('0x106')](db[_0xac08('0x1d')],{'as':'Messages','onDelete':_0xac08('0x104'),'foreignKey':_0xac08('0x14f'),'sourceKey':_0xac08('0x150')});db['VoiceMailMessage'][_0xac08('0x114')](db[_0xac08('0x1b')],{'foreignKey':_0xac08('0x14f'),'targetKey':'mailbox'});db[_0xac08('0x1e')]['hasMany'](db[_0xac08('0x23')],{'as':_0xac08('0x151'),'foreignKey':'uniqueid','constraints':![]});db[_0xac08('0x1e')][_0xac08('0x106')](db['VoiceAgentReport'],{'as':_0xac08('0x152'),'foreignKey':'uniqueid','constraints':![]});db[_0xac08('0x1e')][_0xac08('0x114')](db[_0xac08('0x103')],{'as':_0xac08('0x103'),'foreignKey':_0xac08('0x105')});db[_0xac08('0x1e')]['belongsTo'](db[_0xac08('0x119')],{'as':_0xac08('0x153'),'foreignKey':_0xac08('0x154')});db['MailServerIn']['belongsTo'](db[_0xac08('0x131')],{'as':'MailAccount','foreignKey':'MailAccountId'});db[_0xac08('0x35')][_0xac08('0x114')](db[_0xac08('0xfe')],{'as':_0xac08('0xfe'),'foreignKey':_0xac08('0x155'),'onDelete':'restrict'});db[_0xac08('0x156')][_0xac08('0x114')](db[_0xac08('0x131')],{'as':'MailAccount','foreignKey':_0xac08('0x157')});db[_0xac08('0x156')]['belongsTo'](db[_0xac08('0xfe')],{'as':_0xac08('0xfe'),'foreignKey':_0xac08('0x155'),'onDelete':_0xac08('0x158')});db['MailAccount'][_0xac08('0x159')](db[_0xac08('0x35')],{'as':'Imap','onDelete':_0xac08('0x104')});db[_0xac08('0x131')][_0xac08('0x159')](db[_0xac08('0x156')],{'as':'Smtp','onDelete':_0xac08('0x104')});db[_0xac08('0x131')][_0xac08('0x106')](db[_0xac08('0x7e')],{'as':_0xac08('0x15a'),'foreignKey':'MailAccountId','onDelete':_0xac08('0x104')});db[_0xac08('0x131')][_0xac08('0x106')](db[_0xac08('0x7c')],{'as':_0xac08('0x15b'),'foreignKey':'MailAccountId'});db['MailAccount']['hasMany'](db[_0xac08('0x15c')],{'as':_0xac08('0x15d'),'foreignKey':'MailAccountId'});db['MailAccount'][_0xac08('0x106')](db[_0xac08('0x3c')],{'as':_0xac08('0x15e')});db[_0xac08('0x131')][_0xac08('0x106')](db[_0xac08('0x3f')],{'as':'Applications'});db[_0xac08('0x131')][_0xac08('0x114')](db[_0xac08('0xec')],{'as':_0xac08('0x15f'),'foreignKey':_0xac08('0x160')});db[_0xac08('0x131')]['belongsTo'](db[_0xac08('0x161')],{'as':_0xac08('0x161'),'foreignKey':_0xac08('0x162')});db[_0xac08('0x131')][_0xac08('0x114')](db[_0xac08('0x82')],{'as':_0xac08('0x146'),'foreignKey':_0xac08('0x147')});db[_0xac08('0x131')][_0xac08('0x116')](db[_0xac08('0x103')],{'as':'Agents','through':_0xac08('0x132')});db[_0xac08('0x38')][_0xac08('0x116')](db[_0xac08('0x103')],{'as':_0xac08('0x14a'),'through':_0xac08('0x2e')});db[_0xac08('0x38')][_0xac08('0x116')](db[_0xac08('0x11c')],{'through':_0xac08('0x163'),'as':_0xac08('0x14b')});db[_0xac08('0x3c')]['hasMany'](db[_0xac08('0x15c')],{'as':'Messages','onDelete':_0xac08('0x104'),'foreignKey':_0xac08('0x164')});db['MailInteraction']['belongsTo'](db['MailAccount'],{'as':_0xac08('0x165'),'foreignKey':_0xac08('0x157')});db[_0xac08('0x3c')]['belongsTo'](db[_0xac08('0x119')],{'as':_0xac08('0x153'),'foreignKey':_0xac08('0x154')});db['MailInteraction'][_0xac08('0x114')](db['User'],{'as':_0xac08('0x166'),'foreignKey':_0xac08('0x105')});db['MailInteraction'][_0xac08('0x116')](db[_0xac08('0x8c')],{'through':'mail_interaction_has_tags','as':_0xac08('0x167')});db['MailInteraction'][_0xac08('0x116')](db['Tag'],{'through':'mail_interaction_has_tags','as':_0xac08('0x168')});db[_0xac08('0x3c')][_0xac08('0x116')](db['User'],{'as':'Users','through':_0xac08('0x11e'),'foreignKey':_0xac08('0x164')});db[_0xac08('0x15c')][_0xac08('0x106')](db['Attachment'],{'as':'Attachments','onDelete':'cascade'});db[_0xac08('0x15c')][_0xac08('0x114')](db[_0xac08('0x103')],{'as':_0xac08('0x103')});db['MailMessage'][_0xac08('0x114')](db[_0xac08('0x119')],{'onDelete':_0xac08('0x104'),'as':_0xac08('0x153')});db['MailMessage'][_0xac08('0x114')](db[_0xac08('0x3c')],{'as':_0xac08('0x169'),'foreignKey':_0xac08('0x164')});db[_0xac08('0x15c')][_0xac08('0x114')](db['MailAccount'],{'as':'Account','foreignKey':'MailAccountId'});db[_0xac08('0x15c')][_0xac08('0x114')](db[_0xac08('0x63')],{'as':'ChatWebsite','foreignKey':'ChatWebsiteId'});db[_0xac08('0x15c')][_0xac08('0x114')](db[_0xac08('0x16a')],{'as':_0xac08('0x16a'),'foreignKey':_0xac08('0x16b')});db[_0xac08('0x3f')][_0xac08('0x114')](db[_0xac08('0x103')],{'onDelete':_0xac08('0x158')});db[_0xac08('0x3f')][_0xac08('0x114')](db[_0xac08('0x38')],{'onDelete':_0xac08('0x158')});db[_0xac08('0x3f')][_0xac08('0x114')](db[_0xac08('0x131')],{'onDelete':'restrict'});db[_0xac08('0x3f')][_0xac08('0x114')](db['Interval'],{'onDelete':_0xac08('0x158'),'foreignKey':_0xac08('0x145')});db['MailApplication'][_0xac08('0x114')](db[_0xac08('0x8c')],{'onDelete':_0xac08('0x158'),'foreignKey':'TagId'});db[_0xac08('0x41')]['belongsTo'](db[_0xac08('0x131')],{});db[_0xac08('0x41')]['belongsTo'](db[_0xac08('0xec')],{'as':_0xac08('0x15f'),'foreignKey':'ListId'});db[_0xac08('0x41')][_0xac08('0x114')](db[_0xac08('0x119')],{'as':_0xac08('0x153'),'foreignKey':_0xac08('0x154')});db[_0xac08('0x41')][_0xac08('0x114')](db[_0xac08('0x3c')],{});db[_0xac08('0x41')][_0xac08('0x114')](db[_0xac08('0x15c')],{});db[_0xac08('0x41')][_0xac08('0x114')](db[_0xac08('0x103')],{});db[_0xac08('0x41')][_0xac08('0x114')](db[_0xac08('0x38')],{});db[_0xac08('0x43')][_0xac08('0x106')](db[_0xac08('0x45')],{'as':_0xac08('0x16c'),'onDelete':_0xac08('0x104')});db[_0xac08('0x46')][_0xac08('0x106')](db[_0xac08('0x7e')],{'as':_0xac08('0x15a'),'foreignKey':_0xac08('0x16d'),'onDelete':'cascade'});db['FaxAccount']['hasMany'](db[_0xac08('0x7c')],{'as':_0xac08('0x15b'),'foreignKey':_0xac08('0x16d')});db[_0xac08('0x46')]['hasMany'](db[_0xac08('0x4a')],{'as':_0xac08('0x15e')});db[_0xac08('0x46')][_0xac08('0x106')](db['FaxApplication'],{'as':'Applications'});db[_0xac08('0x46')][_0xac08('0x106')](db['VoiceExtension'],{'as':'Exntensions','onDelete':_0xac08('0x104')});db[_0xac08('0x46')]['hasMany'](db[_0xac08('0x4c')],{'as':_0xac08('0x15d')});db['FaxAccount'][_0xac08('0x114')](db[_0xac08('0x140')],{'as':_0xac08('0x140')});db[_0xac08('0x46')][_0xac08('0x114')](db[_0xac08('0xec')],{'as':'List','foreignKey':_0xac08('0x160')});db['FaxAccount'][_0xac08('0x114')](db[_0xac08('0x82')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0xac08('0x46')][_0xac08('0x116')](db[_0xac08('0x103')],{'as':_0xac08('0x14a'),'through':'user_has_fax_accounts'});db[_0xac08('0x48')]['belongsTo'](db[_0xac08('0x103')],{'onDelete':_0xac08('0x158')});db[_0xac08('0x48')][_0xac08('0x114')](db[_0xac08('0x4e')],{'onDelete':_0xac08('0x158')});db['FaxApplication'][_0xac08('0x114')](db[_0xac08('0x46')],{'onDelete':_0xac08('0x158')});db[_0xac08('0x48')][_0xac08('0x114')](db[_0xac08('0x8c')],{'onDelete':_0xac08('0x158'),'foreignKey':_0xac08('0x16e')});db['FaxInteraction'][_0xac08('0x106')](db[_0xac08('0x4c')],{'as':_0xac08('0x15d'),'onDelete':_0xac08('0x104'),'foreignKey':_0xac08('0x16f')});db['FaxInteraction'][_0xac08('0x114')](db[_0xac08('0x46')],{'as':'Account','foreignKey':_0xac08('0x16d')});db['FaxInteraction'][_0xac08('0x114')](db[_0xac08('0x119')],{'as':_0xac08('0x153'),'foreignKey':_0xac08('0x154')});db[_0xac08('0x4a')][_0xac08('0x114')](db['User'],{'as':_0xac08('0x166'),'foreignKey':_0xac08('0x105')});db[_0xac08('0x4a')][_0xac08('0x116')](db[_0xac08('0x8c')],{'through':_0xac08('0x170'),'as':_0xac08('0x167')});db[_0xac08('0x4a')][_0xac08('0x116')](db[_0xac08('0x8c')],{'through':_0xac08('0x170'),'as':_0xac08('0x168')});db[_0xac08('0x4a')][_0xac08('0x116')](db[_0xac08('0x103')],{'as':_0xac08('0x171'),'through':_0xac08('0x120'),'foreignKey':'FaxInteractionId'});db[_0xac08('0x4c')][_0xac08('0x114')](db['User'],{'onDelete':_0xac08('0x104'),'as':_0xac08('0x103')});db[_0xac08('0x4c')][_0xac08('0x114')](db[_0xac08('0x4a')],{'as':_0xac08('0x169'),'foreignKey':_0xac08('0x16f')});db[_0xac08('0x4c')][_0xac08('0x114')](db[_0xac08('0x119')],{'onDelete':_0xac08('0x104'),'as':_0xac08('0x153')});db[_0xac08('0x4c')][_0xac08('0x114')](db['Attachment'],{'as':_0xac08('0xe2'),'foreignKey':_0xac08('0x172')});db[_0xac08('0x4c')][_0xac08('0x114')](db['FaxAccount'],{'as':_0xac08('0x165'),'foreignKey':_0xac08('0x16d')});db['FaxQueue'][_0xac08('0x116')](db[_0xac08('0x103')],{'as':'Agents','through':_0xac08('0x30')});db[_0xac08('0x4e')]['belongsToMany'](db[_0xac08('0x11c')],{'through':_0xac08('0x173'),'as':_0xac08('0x14b')});db['FaxQueueReport'][_0xac08('0x114')](db[_0xac08('0x46')],{});db[_0xac08('0x50')][_0xac08('0x114')](db[_0xac08('0xec')],{'as':_0xac08('0x15f'),'foreignKey':_0xac08('0x160')});db['FaxQueueReport'][_0xac08('0x114')](db[_0xac08('0x119')],{'as':_0xac08('0x153'),'foreignKey':'ContactId'});db[_0xac08('0x50')][_0xac08('0x114')](db[_0xac08('0x4a')],{});db[_0xac08('0x50')][_0xac08('0x114')](db['FaxMessage'],{});db[_0xac08('0x50')][_0xac08('0x114')](db['User'],{});db[_0xac08('0x50')][_0xac08('0x114')](db[_0xac08('0x4e')],{});db[_0xac08('0x51')][_0xac08('0x106')](db[_0xac08('0x7e')],{'as':_0xac08('0x15a'),'foreignKey':'SmsAccountId','onDelete':_0xac08('0x104')});db['SmsAccount']['hasMany'](db['CannedAnswer'],{'as':'Answers','foreignKey':_0xac08('0x174')});db['SmsAccount'][_0xac08('0x106')](db[_0xac08('0x57')],{'as':'Messages','foreignKey':'SmsAccountId'});db[_0xac08('0x51')][_0xac08('0x106')](db['SmsInteraction'],{'as':_0xac08('0x15e')});db[_0xac08('0x51')][_0xac08('0x106')](db['SmsApplication'],{'as':_0xac08('0x139')});db[_0xac08('0x51')][_0xac08('0x114')](db[_0xac08('0xec')],{'as':_0xac08('0x15f'),'foreignKey':_0xac08('0x160')});db['SmsAccount'][_0xac08('0x114')](db[_0xac08('0x82')],{'as':_0xac08('0x146'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xac08('0x51')][_0xac08('0x116')](db['User'],{'as':_0xac08('0x14a'),'through':_0xac08('0x133')});db[_0xac08('0x53')][_0xac08('0x114')](db[_0xac08('0x103')],{'onDelete':_0xac08('0x158')});db[_0xac08('0x53')][_0xac08('0x114')](db['SmsQueue'],{'onDelete':'restrict'});db[_0xac08('0x53')][_0xac08('0x114')](db[_0xac08('0x51')],{'onDelete':'restrict'});db[_0xac08('0x53')][_0xac08('0x114')](db['Interval'],{'onDelete':_0xac08('0x158'),'foreignKey':_0xac08('0x145')});db[_0xac08('0x53')]['belongsTo'](db[_0xac08('0x8c')],{'onDelete':_0xac08('0x158'),'foreignKey':'TagId'});db[_0xac08('0x55')][_0xac08('0x106')](db[_0xac08('0x57')],{'as':_0xac08('0x15d'),'onDelete':_0xac08('0x104'),'foreignKey':'SmsInteractionId'});db['SmsInteraction'][_0xac08('0x114')](db['SmsAccount'],{'as':'Account','foreignKey':'SmsAccountId'});db[_0xac08('0x55')][_0xac08('0x114')](db[_0xac08('0x119')],{'as':_0xac08('0x153'),'foreignKey':_0xac08('0x154')});db[_0xac08('0x55')][_0xac08('0x114')](db[_0xac08('0x103')],{'as':_0xac08('0x166'),'foreignKey':_0xac08('0x105')});db[_0xac08('0x55')][_0xac08('0x116')](db[_0xac08('0x8c')],{'through':_0xac08('0x175'),'as':_0xac08('0x167')});db[_0xac08('0x55')][_0xac08('0x116')](db['Tag'],{'through':_0xac08('0x175'),'as':_0xac08('0x168')});db[_0xac08('0x55')][_0xac08('0x116')](db[_0xac08('0x103')],{'as':_0xac08('0x171'),'through':_0xac08('0x121'),'foreignKey':'SmsInteractionId'});db[_0xac08('0x57')][_0xac08('0x114')](db['User'],{'as':_0xac08('0x103')});db['SmsMessage'][_0xac08('0x114')](db[_0xac08('0x119')],{'onDelete':_0xac08('0x104'),'as':_0xac08('0x153')});db[_0xac08('0x57')][_0xac08('0x114')](db[_0xac08('0x55')],{'onDelete':_0xac08('0x104'),'as':_0xac08('0x169'),'foreignKey':_0xac08('0x176')});db[_0xac08('0x57')]['belongsTo'](db[_0xac08('0x51')],{'as':_0xac08('0x165'),'foreignKey':'SmsAccountId'});db[_0xac08('0x12a')]['belongsToMany'](db[_0xac08('0x103')],{'as':_0xac08('0x14a'),'through':'UserSmsQueue','foreignKey':_0xac08('0x177')});db[_0xac08('0x12a')]['belongsToMany'](db['Team'],{'through':_0xac08('0x178'),'as':'Teams'});db['OpenchannelAccount'][_0xac08('0x106')](db[_0xac08('0x7e')],{'as':_0xac08('0x15a'),'foreignKey':_0xac08('0x179'),'onDelete':_0xac08('0x104')});db[_0xac08('0x5a')][_0xac08('0x106')](db[_0xac08('0x7c')],{'as':_0xac08('0x15b'),'foreignKey':'OpenchannelAccountId'});db[_0xac08('0x5a')][_0xac08('0x106')](db[_0xac08('0x5d')],{'as':_0xac08('0x15e'),'foreignKey':_0xac08('0x179')});db['OpenchannelAccount'][_0xac08('0x106')](db['OpenchannelMessage'],{'as':'Messages','foreignKey':_0xac08('0x179')});db[_0xac08('0x5a')][_0xac08('0x106')](db[_0xac08('0x5c')],{'as':_0xac08('0x139'),'foreignKey':_0xac08('0x179')});db[_0xac08('0x5a')][_0xac08('0x114')](db[_0xac08('0xec')],{'as':_0xac08('0x15f'),'foreignKey':_0xac08('0x160')});db['OpenchannelAccount'][_0xac08('0x114')](db[_0xac08('0x82')],{'as':_0xac08('0x146'),'foreignKey':_0xac08('0x147')});db[_0xac08('0x5a')][_0xac08('0x116')](db[_0xac08('0x103')],{'as':_0xac08('0x14a'),'through':_0xac08('0x17a')});db[_0xac08('0x5c')][_0xac08('0x114')](db[_0xac08('0x103')],{'onDelete':_0xac08('0x158')});db[_0xac08('0x5c')][_0xac08('0x114')](db[_0xac08('0x61')],{'onDelete':_0xac08('0x158'),'foreignKey':_0xac08('0x17b')});db[_0xac08('0x5c')]['belongsTo'](db[_0xac08('0x5a')],{'onDelete':_0xac08('0x158'),'foreignKey':_0xac08('0x179')});db['OpenchannelApplication'][_0xac08('0x114')](db[_0xac08('0x144')],{'onDelete':_0xac08('0x158'),'foreignKey':_0xac08('0x145')});db[_0xac08('0x5c')][_0xac08('0x114')](db['Tag'],{'onDelete':_0xac08('0x158'),'foreignKey':_0xac08('0x16e')});db['OpenchannelInteraction'][_0xac08('0x106')](db[_0xac08('0x5f')],{'as':_0xac08('0x15d'),'onDelete':_0xac08('0x104'),'foreignKey':'OpenchannelInteractionId'});db[_0xac08('0x5d')][_0xac08('0x114')](db[_0xac08('0x5a')],{'as':_0xac08('0x165'),'foreignKey':_0xac08('0x179')});db['OpenchannelInteraction'][_0xac08('0x114')](db[_0xac08('0x119')],{'as':_0xac08('0x153'),'foreignKey':_0xac08('0x154')});db[_0xac08('0x5d')]['belongsTo'](db[_0xac08('0x103')],{'as':'Owner','foreignKey':_0xac08('0x105')});db['OpenchannelInteraction'][_0xac08('0x116')](db[_0xac08('0x8c')],{'through':_0xac08('0x17c'),'as':_0xac08('0x167')});db[_0xac08('0x5d')][_0xac08('0x116')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0xac08('0x168')});db[_0xac08('0x5d')]['belongsToMany'](db[_0xac08('0x103')],{'as':_0xac08('0x171'),'through':'user_has_openchannel_interactions','foreignKey':_0xac08('0x17d')});db[_0xac08('0x5f')]['belongsTo'](db[_0xac08('0x103')],{'onDelete':_0xac08('0x104'),'as':_0xac08('0x103')});db[_0xac08('0x5f')][_0xac08('0x114')](db[_0xac08('0x119')],{'onDelete':'cascade','as':_0xac08('0x153')});db[_0xac08('0x5f')][_0xac08('0x114')](db[_0xac08('0x5d')],{'onDelete':_0xac08('0x104'),'as':'Interaction','foreignKey':_0xac08('0x17d')});db['OpenchannelMessage'][_0xac08('0x114')](db[_0xac08('0xe2')],{'as':_0xac08('0xe2'),'foreignKey':'AttachmentId'});db[_0xac08('0x5f')][_0xac08('0x114')](db[_0xac08('0x5a')],{'as':_0xac08('0x165'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelQueue']['belongsToMany'](db[_0xac08('0x103')],{'as':'Agents','through':_0xac08('0x32'),'foreignKey':_0xac08('0x17b')});db[_0xac08('0x61')][_0xac08('0x116')](db[_0xac08('0x11c')],{'through':_0xac08('0x17e'),'as':'Teams'});db['ChatWebsite']['hasMany'](db[_0xac08('0x7e')],{'as':'Dispositions','foreignKey':_0xac08('0x17f'),'onDelete':'cascade'});db[_0xac08('0x63')][_0xac08('0x106')](db['CannedAnswer'],{'as':_0xac08('0x15b'),'foreignKey':_0xac08('0x17f')});db['ChatWebsite'][_0xac08('0x106')](db[_0xac08('0x180')],{'as':_0xac08('0x181')});db['ChatWebsite']['hasMany'](db['ChatInteraction'],{'as':_0xac08('0x15e')});db['ChatWebsite'][_0xac08('0x106')](db[_0xac08('0x66')],{'as':_0xac08('0x139')});db[_0xac08('0x63')][_0xac08('0x106')](db[_0xac08('0x6a')],{'as':_0xac08('0x15d')});db['ChatWebsite'][_0xac08('0x114')](db[_0xac08('0xec')],{'as':_0xac08('0x15f'),'foreignKey':'ListId'});db[_0xac08('0x63')][_0xac08('0x114')](db[_0xac08('0x144')],{'as':_0xac08('0x144'),'foreignKey':_0xac08('0x145')});db[_0xac08('0x63')][_0xac08('0x114')](db[_0xac08('0x131')],{'as':'MailAccount','foreignKey':_0xac08('0x157')});db[_0xac08('0x63')]['belongsTo'](db['Pause'],{'as':_0xac08('0x146'),'foreignKey':_0xac08('0x147')});db[_0xac08('0x63')][_0xac08('0x116')](db[_0xac08('0x103')],{'as':_0xac08('0x14a'),'through':_0xac08('0x182')});db[_0xac08('0x64')][_0xac08('0x114')](db[_0xac08('0x5a')],{});db['OpenchannelQueueReport'][_0xac08('0x114')](db[_0xac08('0xec')],{'as':'List','foreignKey':_0xac08('0x160')});db[_0xac08('0x64')][_0xac08('0x114')](db['CmContact'],{'as':_0xac08('0x153'),'foreignKey':_0xac08('0x154')});db[_0xac08('0x64')][_0xac08('0x114')](db[_0xac08('0x5d')],{});db[_0xac08('0x64')]['belongsTo'](db[_0xac08('0x5f')],{});db[_0xac08('0x64')][_0xac08('0x114')](db['User'],{});db[_0xac08('0x64')][_0xac08('0x114')](db[_0xac08('0x61')],{});db['ChatApplication'][_0xac08('0x114')](db[_0xac08('0x103')],{'as':_0xac08('0x183'),'foreignKey':_0xac08('0x105'),'onDelete':_0xac08('0x158')});db[_0xac08('0x66')][_0xac08('0x114')](db[_0xac08('0x6c')],{'as':_0xac08('0x184'),'foreignKey':_0xac08('0x185'),'onDelete':_0xac08('0x158')});db['ChatApplication'][_0xac08('0x114')](db[_0xac08('0x63')],{'as':'Website','foreignKey':_0xac08('0x17f'),'onDelete':_0xac08('0x158')});db['ChatApplication'][_0xac08('0x114')](db['Tag'],{'onDelete':'restrict','foreignKey':_0xac08('0x16e')});db[_0xac08('0x68')][_0xac08('0x106')](db['ChatMessage'],{'as':_0xac08('0x15d'),'onDelete':_0xac08('0x104'),'foreignKey':_0xac08('0x186')});db['ChatInteraction'][_0xac08('0x114')](db['ChatWebsite'],{'as':'Account','foreignKey':_0xac08('0x17f')});db[_0xac08('0x68')][_0xac08('0x114')](db['CmContact'],{'as':'Contact','foreignKey':_0xac08('0x154')});db[_0xac08('0x68')]['belongsTo'](db[_0xac08('0x103')],{'as':_0xac08('0x166'),'foreignKey':_0xac08('0x105')});db[_0xac08('0x68')]['belongsToMany'](db['Tag'],{'through':_0xac08('0x187'),'as':'Tags'});db[_0xac08('0x68')][_0xac08('0x116')](db[_0xac08('0x8c')],{'through':_0xac08('0x187'),'as':_0xac08('0x168')});db[_0xac08('0x68')][_0xac08('0x116')](db[_0xac08('0x103')],{'as':_0xac08('0x171'),'through':_0xac08('0x11f'),'foreignKey':'ChatInteractionId'});db[_0xac08('0x6a')][_0xac08('0x114')](db['User'],{'onDelete':_0xac08('0x104'),'as':'User'});db[_0xac08('0x6a')][_0xac08('0x114')](db[_0xac08('0x119')],{'onDelete':_0xac08('0x104'),'as':'Contact','foreignKey':_0xac08('0x154')});db[_0xac08('0x6a')][_0xac08('0x114')](db['ChatInteraction'],{'onDelete':_0xac08('0x104'),'as':_0xac08('0x169'),'foreignKey':_0xac08('0x186')});db[_0xac08('0x6a')][_0xac08('0x114')](db[_0xac08('0xe2')],{'as':_0xac08('0xe2'),'foreignKey':_0xac08('0x172')});db[_0xac08('0x6a')][_0xac08('0x114')](db[_0xac08('0x63')],{'as':'Account','foreignKey':'ChatWebsiteId'});db['ChatOfflineMessage'][_0xac08('0x106')](db[_0xac08('0xe2')],{'as':_0xac08('0x188'),'foreignKey':_0xac08('0x16b'),'onDelete':_0xac08('0x104'),'hooks':!![]});db['ChatOfflineMessage'][_0xac08('0x114')](db[_0xac08('0x119')],{'onDelete':_0xac08('0x104'),'as':_0xac08('0x153'),'foreignKey':_0xac08('0x154')});db['ChatOfflineMessage'][_0xac08('0x114')](db[_0xac08('0x63')],{'as':_0xac08('0x165'),'foreignKey':_0xac08('0x17f')});db[_0xac08('0x6c')][_0xac08('0x116')](db[_0xac08('0x103')],{'as':'Agents','through':_0xac08('0x2d'),'hooks':!![]});db[_0xac08('0x6c')][_0xac08('0x116')](db[_0xac08('0x11c')],{'through':_0xac08('0x189'),'as':'Teams'});db['ChatGroup'][_0xac08('0x106')](db[_0xac08('0x18a')],{'as':_0xac08('0x15d'),'foreignKey':'ChatGroupId','onDelete':_0xac08('0x104')});db[_0xac08('0x6e')][_0xac08('0x116')](db[_0xac08('0x103')],{'as':_0xac08('0x13a'),'through':_0xac08('0x118')});db[_0xac08('0x180')]['belongsTo'](db[_0xac08('0x63')],{'as':_0xac08('0x18b'),'foreignKey':'ChatWebsiteId'});db['CmCompany'][_0xac08('0x106')](db[_0xac08('0x119')],{'as':'Contacts','foreignKey':_0xac08('0x18c')});db['CmContact'][_0xac08('0x106')](db[_0xac08('0x18d')],{'as':_0xac08('0x13c'),'foreignKey':_0xac08('0x154')});db['CmContact'][_0xac08('0x106')](db[_0xac08('0x74')],{'as':_0xac08('0x10b'),'foreignKey':_0xac08('0x154')});db[_0xac08('0x119')][_0xac08('0x106')](db[_0xac08('0x10c')],{'as':_0xac08('0x13d'),'foreignKey':_0xac08('0x154')});db[_0xac08('0x119')]['hasMany'](db['ReportAgentPreview'],{'as':_0xac08('0x77'),'foreignKey':_0xac08('0x154')});db[_0xac08('0x119')]['hasMany'](db[_0xac08('0xce')],{'as':_0xac08('0x13f'),'foreignKey':_0xac08('0x154')});db[_0xac08('0x119')][_0xac08('0x106')](db[_0xac08('0x5d')],{'as':'OpenchannelInteractions','foreignKey':_0xac08('0x154'),'onDelete':_0xac08('0x158')});db[_0xac08('0x119')][_0xac08('0x106')](db[_0xac08('0x68')],{'as':_0xac08('0x10e'),'foreignKey':_0xac08('0x154'),'onDelete':_0xac08('0x158')});db[_0xac08('0x119')][_0xac08('0x106')](db[_0xac08('0x55')],{'as':'SmsInteractions','foreignKey':_0xac08('0x154'),'onDelete':_0xac08('0x158')});db[_0xac08('0x119')][_0xac08('0x106')](db[_0xac08('0x4a')],{'as':'FaxInteractions','foreignKey':'ContactId','onDelete':_0xac08('0x158')});db[_0xac08('0x119')][_0xac08('0x106')](db['MailInteraction'],{'as':'MailInteractions','foreignKey':'ContactId','onDelete':_0xac08('0x158')});db[_0xac08('0x119')][_0xac08('0x114')](db[_0xac08('0x18e')],{'as':_0xac08('0x18f'),'foreignKey':_0xac08('0x18c')});db[_0xac08('0x119')][_0xac08('0x114')](db[_0xac08('0xec')],{'as':_0xac08('0x15f'),'foreignKey':_0xac08('0x160'),'onDelete':_0xac08('0x104')});db['CmContact'][_0xac08('0x116')](db['User'],{'as':_0xac08('0x171'),'through':_0xac08('0x190')});db[_0xac08('0x119')][_0xac08('0x116')](db[_0xac08('0x8c')],{'as':_0xac08('0x167'),'through':'cm_contact_has_tags'});db['CmContact'][_0xac08('0x116')](db[_0xac08('0x8c')],{'through':_0xac08('0x191'),'as':_0xac08('0x168')});db[_0xac08('0x18d')][_0xac08('0x114')](db[_0xac08('0x119')],{'as':_0xac08('0x153'),'foreignKey':_0xac08('0x154'),'onDelete':_0xac08('0x104')});db['CmHopper']['belongsTo'](db['CmList'],{'as':_0xac08('0x15f'),'foreignKey':'ListId','onDelete':_0xac08('0x104')});db[_0xac08('0x18d')]['belongsTo'](db[_0xac08('0x103')],{'as':_0xac08('0x183'),'foreignKey':'UserId'});db[_0xac08('0x18d')][_0xac08('0x114')](db[_0xac08('0x17')],{'as':_0xac08('0x184'),'foreignKey':'VoiceQueueId','onDelete':'cascade'});db[_0xac08('0x18d')][_0xac08('0x114')](db[_0xac08('0x192')],{'as':_0xac08('0x192'),'foreignKey':_0xac08('0x193'),'onDelete':_0xac08('0x104')});db[_0xac08('0x18d')][_0xac08('0x114')](db[_0xac08('0x103')],{'as':_0xac08('0x166'),'foreignKey':'OwnerId'});db['CmHopperBlack'][_0xac08('0x114')](db['CmContact'],{'as':_0xac08('0x153'),'foreignKey':'ContactId','onDelete':_0xac08('0x104')});db[_0xac08('0x72')][_0xac08('0x114')](db[_0xac08('0xec')],{'as':_0xac08('0x15f'),'foreignKey':_0xac08('0x160'),'onDelete':_0xac08('0x104')});db['CmHopperBlack'][_0xac08('0x114')](db[_0xac08('0x17')],{'as':'Queue','foreignKey':_0xac08('0x13b'),'onDelete':'cascade'});db[_0xac08('0x72')][_0xac08('0x114')](db[_0xac08('0x192')],{'as':'Campaign','foreignKey':'CampaignId','onDelete':_0xac08('0x104')});db['Automation'][_0xac08('0x106')](db[_0xac08('0x80')],{'as':{'plural':_0xac08('0x194'),'singular':_0xac08('0x195')},'foreignKey':_0xac08('0x196'),'onDelete':_0xac08('0x104'),'hooks':!![]});db[_0xac08('0x197')][_0xac08('0x106')](db[_0xac08('0x80')],{'as':{'plural':_0xac08('0x198'),'singular':_0xac08('0x199')},'foreignKey':_0xac08('0x19a'),'onDelete':_0xac08('0x104'),'hooks':!![]});db[_0xac08('0x197')][_0xac08('0x106')](db[_0xac08('0x7a')],{'as':'Actions','foreignKey':'AutomationId','onDelete':_0xac08('0x104'),'hooks':!![]});db['Disposition'][_0xac08('0x106')](db[_0xac08('0x7e')],{'as':_0xac08('0x15a'),'foreignKey':'ParentId','onDelete':'cascade'});db[_0xac08('0x144')][_0xac08('0x106')](db['Interval'],{'as':_0xac08('0x19b'),'foreignKey':_0xac08('0x145'),'onDelete':_0xac08('0x104'),'hooks':!![],'required':![]});db[_0xac08('0x144')]['hasMany'](db[_0xac08('0x109')],{'as':_0xac08('0x10a'),'foreignKey':'IntervalId','onDelete':_0xac08('0x158')});db[_0xac08('0x144')][_0xac08('0x106')](db[_0xac08('0x3f')],{'as':'MailApplications','foreignKey':_0xac08('0x145')});db[_0xac08('0x144')][_0xac08('0x106')](db['ChatApplication'],{'as':_0xac08('0x19c'),'foreignKey':'IntervalId'});db[_0xac08('0x144')][_0xac08('0x106')](db['FaxApplication'],{'as':_0xac08('0x19d'),'foreignKey':_0xac08('0x145')});db['Interval']['hasMany'](db['SmsApplication'],{'as':_0xac08('0x19e'),'foreignKey':_0xac08('0x145')});db['Schedule'][_0xac08('0x114')](db[_0xac08('0x131')],{});db[_0xac08('0x88')][_0xac08('0x114')](db['AnalyticDefaultReport'],{'foreignKey':_0xac08('0x19f')});db[_0xac08('0x88')][_0xac08('0x114')](db['AnalyticCustomReport'],{'foreignKey':_0xac08('0x1a0')});db[_0xac08('0x8a')][_0xac08('0x116')](db['VoiceMusicOnHold'],{'as':_0xac08('0x1a1'),'through':_0xac08('0x1a2'),'onDelete':_0xac08('0x158')});db[_0xac08('0x8c')]['belongsToMany'](db[_0xac08('0x119')],{'through':'cm_contact_has_tags'});db['Tag'][_0xac08('0x116')](db[_0xac08('0x68')],{'through':_0xac08('0x187')});db[_0xac08('0x8c')]['belongsToMany'](db['MailInteraction'],{'through':_0xac08('0x1a3')});db[_0xac08('0x8c')]['belongsToMany'](db[_0xac08('0x55')],{'through':'sms_interaction_has_tags'});db[_0xac08('0x8c')][_0xac08('0x116')](db['FaxInteraction'],{'through':'fax_interaction_has_tags'});db[_0xac08('0x8c')][_0xac08('0x116')](db['OpenchannelInteraction'],{'through':_0xac08('0x17c')});db[_0xac08('0x8c')][_0xac08('0x116')](db['WhatsappInteraction'],{'through':_0xac08('0x1a4')});db[_0xac08('0x8e')][_0xac08('0x106')](db['Condition'],{'as':{'plural':'AllConditions','singular':_0xac08('0x1a5')},'foreignKey':_0xac08('0x1a6'),'onDelete':_0xac08('0x104'),'hooks':!![]});db['Trigger'][_0xac08('0x106')](db[_0xac08('0x80')],{'as':{'plural':'AnyConditions','singular':_0xac08('0x1a7')},'foreignKey':'TriggerAnyId','onDelete':'cascade','hooks':!![]});db[_0xac08('0x8e')][_0xac08('0x106')](db[_0xac08('0x7a')],{'as':'Actions','foreignKey':_0xac08('0x1a8'),'onDelete':_0xac08('0x104'),'hooks':!![]});db[_0xac08('0x1a9')][_0xac08('0x106')](db[_0xac08('0x97')],{'as':_0xac08('0x1aa'),'onDelete':_0xac08('0x104'),'foreignKey':'CustomReportId','hooks':!![]});db['AnalyticDefaultReport'][_0xac08('0x106')](db['AnalyticFieldReport'],{'as':_0xac08('0x1aa'),'onDelete':_0xac08('0x104'),'foreignKey':_0xac08('0x19f')});db[_0xac08('0x96')]['hasMany'](db[_0xac08('0x97')],{'as':_0xac08('0x1aa'),'onDelete':_0xac08('0x104'),'foreignKey':_0xac08('0x1ab')});db[_0xac08('0x97')]['belongsTo'](db['AnalyticMetric'],{'foreignKey':_0xac08('0x1ab')});db[_0xac08('0x1ac')]['hasMany'](db[_0xac08('0x9a')],{'as':_0xac08('0x1ad'),'onDelete':'cascade','foreignKey':_0xac08('0x1ae')});db[_0xac08('0x9a')]['hasMany'](db[_0xac08('0x9c')],{'as':_0xac08('0x1af'),'onDelete':_0xac08('0x104'),'foreignKey':_0xac08('0x1b0')});db[_0xac08('0x9a')]['hasMany'](db[_0xac08('0x9c')],{'as':_0xac08('0x1b1'),'onDelete':_0xac08('0x104'),'foreignKey':'DescriptionId'});db[_0xac08('0x9a')]['hasMany'](db[_0xac08('0x9c')],{'as':_0xac08('0x1aa'),'onDelete':_0xac08('0x104'),'foreignKey':_0xac08('0x1b2')});db['SalesforceConfiguration']['belongsTo'](db[_0xac08('0x1ac')],{'as':'Account','foreignKey':_0xac08('0x1ae')});db[_0xac08('0x9c')][_0xac08('0x106')](db[_0xac08('0x9c')],{'as':_0xac08('0x1b3'),'foreignKey':_0xac08('0x1b0')});db['SalesforceField'][_0xac08('0x106')](db['SalesforceField'],{'as':_0xac08('0x1b4'),'foreignKey':'DescriptionId'});db[_0xac08('0x9c')][_0xac08('0x106')](db['SalesforceField'],{'as':_0xac08('0x1b5'),'foreignKey':_0xac08('0x1b2')});db[_0xac08('0x9c')][_0xac08('0x114')](db['Variable'],{'as':'Variable','foreignKey':_0xac08('0x1b6')});db[_0xac08('0x1b7')]['hasMany'](db[_0xac08('0x9f')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0xac08('0x1ae')});db[_0xac08('0x9f')][_0xac08('0x106')](db[_0xac08('0xa1')],{'as':_0xac08('0x1af'),'onDelete':_0xac08('0x104'),'foreignKey':_0xac08('0x1b0')});db[_0xac08('0x9f')][_0xac08('0x106')](db[_0xac08('0xa1')],{'as':_0xac08('0x1b1'),'onDelete':_0xac08('0x104'),'foreignKey':_0xac08('0x1b8')});db['SugarcrmConfiguration'][_0xac08('0x106')](db[_0xac08('0xa1')],{'as':_0xac08('0x1aa'),'onDelete':_0xac08('0x104'),'foreignKey':_0xac08('0x1b2')});db[_0xac08('0x9f')][_0xac08('0x114')](db['SugarcrmAccount'],{'as':_0xac08('0x165'),'foreignKey':_0xac08('0x1ae')});db[_0xac08('0xa1')][_0xac08('0x106')](db['SugarcrmField'],{'as':'Subject','foreignKey':_0xac08('0x1b0')});db[_0xac08('0xa1')][_0xac08('0x106')](db[_0xac08('0xa1')],{'as':_0xac08('0x1b4'),'foreignKey':'DescriptionId'});db[_0xac08('0xa1')]['hasMany'](db['SugarcrmField'],{'as':'Field','foreignKey':'FieldId'});db[_0xac08('0xa1')]['belongsTo'](db[_0xac08('0x8f')],{'as':'Variable','foreignKey':_0xac08('0x1b6')});db[_0xac08('0xa2')][_0xac08('0x106')](db[_0xac08('0xa3')],{'as':_0xac08('0x1ad'),'onDelete':'cascade','foreignKey':'AccountId'});db['DeskConfiguration'][_0xac08('0x106')](db[_0xac08('0xa5')],{'as':_0xac08('0x1af'),'onDelete':_0xac08('0x104'),'foreignKey':_0xac08('0x1b0')});db['DeskConfiguration'][_0xac08('0x106')](db[_0xac08('0xa5')],{'as':_0xac08('0x1b1'),'onDelete':_0xac08('0x104'),'foreignKey':_0xac08('0x1b8')});db[_0xac08('0xa3')][_0xac08('0x106')](db[_0xac08('0xa5')],{'as':'Fields','onDelete':_0xac08('0x104'),'foreignKey':_0xac08('0x1b2')});db['DeskConfiguration'][_0xac08('0x114')](db['DeskAccount'],{'as':_0xac08('0x165'),'foreignKey':_0xac08('0x1ae')});db[_0xac08('0xa3')][_0xac08('0x116')](db['Tag'],{'through':_0xac08('0x1b9')});db[_0xac08('0xa5')][_0xac08('0x106')](db['DeskField'],{'as':_0xac08('0x1b3'),'foreignKey':_0xac08('0x1b0')});db['DeskField'][_0xac08('0x106')](db['DeskField'],{'as':'Description','foreignKey':_0xac08('0x1b8')});db[_0xac08('0xa5')][_0xac08('0x106')](db[_0xac08('0xa5')],{'as':'Field','foreignKey':_0xac08('0x1b2')});db['DeskField'][_0xac08('0x114')](db[_0xac08('0x8f')],{'as':_0xac08('0x8f'),'foreignKey':_0xac08('0x1b6')});db[_0xac08('0xa6')][_0xac08('0x106')](db[_0xac08('0xa8')],{'as':_0xac08('0x1ad'),'onDelete':_0xac08('0x104'),'foreignKey':'AccountId'});db[_0xac08('0xa8')][_0xac08('0x106')](db[_0xac08('0x1ba')],{'as':_0xac08('0x1af'),'onDelete':_0xac08('0x104'),'foreignKey':'SubjectId'});db[_0xac08('0xa8')][_0xac08('0x106')](db['ZohoField'],{'as':'Descriptions','onDelete':_0xac08('0x104'),'foreignKey':_0xac08('0x1b8')});db[_0xac08('0xa8')][_0xac08('0x106')](db[_0xac08('0x1ba')],{'as':_0xac08('0x1aa'),'onDelete':_0xac08('0x104'),'foreignKey':_0xac08('0x1b2')});db[_0xac08('0xa8')][_0xac08('0x114')](db[_0xac08('0xa6')],{'as':'Account','foreignKey':_0xac08('0x1ae')});db[_0xac08('0x1ba')][_0xac08('0x106')](db[_0xac08('0x1ba')],{'as':_0xac08('0x1b3'),'foreignKey':_0xac08('0x1b0')});db[_0xac08('0x1ba')]['hasMany'](db[_0xac08('0x1ba')],{'as':'Description','foreignKey':'DescriptionId'});db['ZohoField'][_0xac08('0x106')](db[_0xac08('0x1ba')],{'as':'Field','foreignKey':_0xac08('0x1b2')});db[_0xac08('0x1ba')][_0xac08('0x114')](db[_0xac08('0x8f')],{'as':'Variable','foreignKey':'VariableId'});db[_0xac08('0xa9')][_0xac08('0x106')](db[_0xac08('0xab')],{'as':_0xac08('0x1ad'),'onDelete':_0xac08('0x104'),'foreignKey':_0xac08('0x1ae')});db['ZendeskConfiguration']['hasMany'](db[_0xac08('0xad')],{'as':_0xac08('0x1af'),'foreignKey':_0xac08('0x1b0')});db['ZendeskConfiguration']['hasMany'](db['ZendeskField'],{'as':_0xac08('0x1b1'),'foreignKey':_0xac08('0x1b8')});db['ZendeskConfiguration'][_0xac08('0x106')](db[_0xac08('0xad')],{'as':_0xac08('0x1aa'),'foreignKey':_0xac08('0x1b2')});db[_0xac08('0xab')][_0xac08('0x114')](db[_0xac08('0xa9')],{'as':_0xac08('0x165'),'foreignKey':_0xac08('0x1ae')});db['ZendeskConfiguration'][_0xac08('0x116')](db[_0xac08('0x8c')],{'through':_0xac08('0x1bb')});db[_0xac08('0xad')][_0xac08('0x106')](db[_0xac08('0xad')],{'as':_0xac08('0x1b3'),'foreignKey':_0xac08('0x1b0')});db[_0xac08('0xad')]['hasMany'](db[_0xac08('0xad')],{'as':_0xac08('0x1b4'),'foreignKey':_0xac08('0x1b8')});db[_0xac08('0xad')][_0xac08('0x106')](db[_0xac08('0xad')],{'as':_0xac08('0x1b5'),'foreignKey':_0xac08('0x1b2')});db['ZendeskField'][_0xac08('0x114')](db[_0xac08('0x8f')],{'as':_0xac08('0x8f'),'foreignKey':_0xac08('0x1b6')});db[_0xac08('0xaf')]['hasMany'](db[_0xac08('0xb1')],{'as':'Configurations','onDelete':'cascade','foreignKey':'AccountId'});db[_0xac08('0xb1')]['hasMany'](db['FreshdeskField'],{'as':_0xac08('0x1af'),'onDelete':_0xac08('0x104'),'foreignKey':_0xac08('0x1b0')});db[_0xac08('0xb1')][_0xac08('0x106')](db[_0xac08('0x1bc')],{'as':_0xac08('0x1b1'),'onDelete':'cascade','foreignKey':_0xac08('0x1b8')});db['FreshdeskConfiguration'][_0xac08('0x106')](db['FreshdeskField'],{'as':_0xac08('0x1aa'),'onDelete':_0xac08('0x104'),'foreignKey':_0xac08('0x1b2')});db[_0xac08('0xb1')][_0xac08('0x114')](db[_0xac08('0xaf')],{'as':'Account','foreignKey':_0xac08('0x1ae')});db[_0xac08('0xb1')]['belongsToMany'](db[_0xac08('0x8c')],{'through':_0xac08('0x1bd')});db[_0xac08('0x1bc')][_0xac08('0x106')](db[_0xac08('0x1bc')],{'as':_0xac08('0x1b3'),'foreignKey':_0xac08('0x1b0')});db[_0xac08('0x1bc')]['hasMany'](db[_0xac08('0x1bc')],{'as':_0xac08('0x1b4'),'foreignKey':_0xac08('0x1b8')});db[_0xac08('0x1bc')]['hasMany'](db['FreshdeskField'],{'as':_0xac08('0x1b5'),'foreignKey':'FieldId'});db['FreshdeskField'][_0xac08('0x114')](db[_0xac08('0x8f')],{'as':_0xac08('0x8f'),'foreignKey':_0xac08('0x1b6')});db[_0xac08('0x1be')][_0xac08('0x106')](db['VtigerConfiguration'],{'as':'Configurations','onDelete':_0xac08('0x104'),'foreignKey':'AccountId'});db[_0xac08('0xb4')][_0xac08('0x106')](db[_0xac08('0xb6')],{'as':'Subjects','foreignKey':_0xac08('0x1b0')});db[_0xac08('0xb4')]['hasMany'](db[_0xac08('0xb6')],{'as':_0xac08('0x1b1'),'foreignKey':'DescriptionId'});db[_0xac08('0xb4')][_0xac08('0x106')](db[_0xac08('0xb6')],{'as':_0xac08('0x1aa'),'foreignKey':_0xac08('0x1b2')});db['VtigerConfiguration'][_0xac08('0x114')](db[_0xac08('0x1be')],{'as':'Account','foreignKey':_0xac08('0x1ae')});db['VtigerField']['hasMany'](db['VtigerField'],{'as':'Subject','foreignKey':_0xac08('0x1b0')});db[_0xac08('0xb6')][_0xac08('0x106')](db[_0xac08('0xb6')],{'as':_0xac08('0x1b4'),'foreignKey':_0xac08('0x1b8')});db[_0xac08('0xb6')][_0xac08('0x106')](db[_0xac08('0xb6')],{'as':'Field','foreignKey':'FieldId'});db[_0xac08('0xb6')]['belongsTo'](db[_0xac08('0x8f')],{'as':_0xac08('0x8f'),'foreignKey':_0xac08('0x1b6')});db[_0xac08('0xb8')]['hasMany'](db[_0xac08('0x1bf')],{'as':'Configurations','onDelete':'cascade','foreignKey':'AccountId'});db[_0xac08('0x1bf')][_0xac08('0x106')](db[_0xac08('0xba')],{'as':_0xac08('0x1af'),'foreignKey':_0xac08('0x1b0')});db['ServicenowConfiguration']['hasMany'](db['ServicenowField'],{'as':_0xac08('0x1b1'),'foreignKey':_0xac08('0x1b8')});db[_0xac08('0x1bf')][_0xac08('0x106')](db['ServicenowField'],{'as':'Fields','foreignKey':_0xac08('0x1b2')});db[_0xac08('0x1bf')][_0xac08('0x114')](db[_0xac08('0xb8')],{'as':_0xac08('0x165'),'foreignKey':_0xac08('0x1ae')});db[_0xac08('0xba')][_0xac08('0x106')](db[_0xac08('0xba')],{'as':'Subject','foreignKey':_0xac08('0x1b0')});db[_0xac08('0xba')][_0xac08('0x106')](db[_0xac08('0xba')],{'as':_0xac08('0x1b4'),'foreignKey':_0xac08('0x1b8')});db['ServicenowField'][_0xac08('0x106')](db[_0xac08('0xba')],{'as':_0xac08('0x1b5'),'foreignKey':'FieldId'});db[_0xac08('0xba')]['belongsTo'](db[_0xac08('0x8f')],{'as':_0xac08('0x8f'),'foreignKey':_0xac08('0x1b6')});db['Dynamics365Account'][_0xac08('0x106')](db[_0xac08('0x1c0')],{'as':_0xac08('0x1ad'),'onDelete':'cascade','foreignKey':_0xac08('0x1ae')});db[_0xac08('0xbc')][_0xac08('0x114')](db['CloudProvider'],{'as':_0xac08('0xfe'),'foreignKey':'CloudProviderId'});db[_0xac08('0x1c0')][_0xac08('0x106')](db[_0xac08('0xbf')],{'as':_0xac08('0x1af'),'onDelete':_0xac08('0x104'),'foreignKey':_0xac08('0x1b0')});db['Dynamics365Configuration'][_0xac08('0x106')](db[_0xac08('0xbf')],{'as':'Descriptions','onDelete':_0xac08('0x104'),'foreignKey':_0xac08('0x1b8')});db[_0xac08('0x1c0')]['hasMany'](db[_0xac08('0xbf')],{'as':_0xac08('0x1aa'),'onDelete':'cascade','foreignKey':_0xac08('0x1b2')});db[_0xac08('0x1c0')][_0xac08('0x114')](db['Dynamics365Account'],{'as':_0xac08('0x165'),'foreignKey':_0xac08('0x1ae')});db[_0xac08('0xbf')][_0xac08('0x106')](db['Dynamics365Field'],{'as':_0xac08('0x1b3'),'foreignKey':_0xac08('0x1b0')});db[_0xac08('0xbf')][_0xac08('0x106')](db['Dynamics365Field'],{'as':_0xac08('0x1b4'),'foreignKey':_0xac08('0x1b8')});db[_0xac08('0xbf')][_0xac08('0x106')](db['Dynamics365Field'],{'as':_0xac08('0x1b5'),'foreignKey':_0xac08('0x1b2')});db[_0xac08('0xbf')]['belongsTo'](db[_0xac08('0x8f')],{'as':_0xac08('0x8f'),'foreignKey':_0xac08('0x1b6')});db[_0xac08('0xc1')][_0xac08('0x106')](db['FreshsalesConfiguration'],{'as':_0xac08('0x1ad'),'onDelete':'cascade','foreignKey':'AccountId'});db['FreshsalesConfiguration'][_0xac08('0x106')](db[_0xac08('0xc3')],{'as':_0xac08('0x1af'),'foreignKey':_0xac08('0x1b0')});db[_0xac08('0x1c1')]['hasMany'](db[_0xac08('0xc3')],{'as':_0xac08('0x1b1'),'foreignKey':_0xac08('0x1b8')});db[_0xac08('0x1c1')][_0xac08('0x106')](db[_0xac08('0xc3')],{'as':_0xac08('0x1aa'),'foreignKey':_0xac08('0x1b2')});db[_0xac08('0x1c1')]['belongsTo'](db[_0xac08('0xc1')],{'as':_0xac08('0x165'),'foreignKey':_0xac08('0x1ae')});db[_0xac08('0xc3')][_0xac08('0x106')](db['FreshsalesField'],{'as':_0xac08('0x1b3'),'foreignKey':_0xac08('0x1b0')});db[_0xac08('0xc3')][_0xac08('0x106')](db[_0xac08('0xc3')],{'as':_0xac08('0x1b4'),'foreignKey':_0xac08('0x1b8')});db[_0xac08('0xc3')][_0xac08('0x106')](db[_0xac08('0xc3')],{'as':_0xac08('0x1b5'),'foreignKey':_0xac08('0x1b2')});db['FreshsalesField']['belongsTo'](db[_0xac08('0x8f')],{'as':_0xac08('0x8f'),'foreignKey':'VariableId'});db['ChatQueueReport'][_0xac08('0x114')](db[_0xac08('0x63')],{});db['ChatQueueReport']['belongsTo'](db[_0xac08('0xec')],{'as':'List','foreignKey':'ListId'});db[_0xac08('0xc7')][_0xac08('0x114')](db[_0xac08('0x119')],{'as':_0xac08('0x153'),'foreignKey':'ContactId'});db[_0xac08('0xc7')][_0xac08('0x114')](db[_0xac08('0x68')],{});db[_0xac08('0xc7')][_0xac08('0x114')](db['ChatMessage'],{});db[_0xac08('0xc7')][_0xac08('0x114')](db['User'],{});db[_0xac08('0xc7')][_0xac08('0x114')](db[_0xac08('0x6c')],{});db[_0xac08('0x18a')][_0xac08('0x114')](db[_0xac08('0x103')],{'onDelete':'cascade','foreignKey':_0xac08('0x1c2')});db['ChatInternalMessage']['belongsTo'](db[_0xac08('0x103')],{'onDelete':_0xac08('0x104'),'foreignKey':'ToId'});db[_0xac08('0xce')][_0xac08('0x106')](db['JscriptyQuestionReport'],{'foreignKey':_0xac08('0x1c3'),'onDelete':_0xac08('0x104')});db[_0xac08('0xce')]['hasMany'](db[_0xac08('0xca')],{'foreignKey':'SessionId','onDelete':'cascade'});db[_0xac08('0xd0')][_0xac08('0x114')](db[_0xac08('0x51')],{});db[_0xac08('0xd0')][_0xac08('0x114')](db['CmList'],{'as':_0xac08('0x15f'),'foreignKey':'ListId'});db[_0xac08('0xd0')][_0xac08('0x114')](db[_0xac08('0x119')],{'as':_0xac08('0x153'),'foreignKey':_0xac08('0x154')});db[_0xac08('0xd0')]['belongsTo'](db[_0xac08('0x55')],{});db[_0xac08('0xd0')]['belongsTo'](db[_0xac08('0x57')],{});db[_0xac08('0xd0')]['belongsTo'](db[_0xac08('0x103')],{});db[_0xac08('0xd0')]['belongsTo'](db['SmsQueue'],{});db[_0xac08('0xd3')][_0xac08('0x106')](db[_0xac08('0xce')],{'foreignKey':_0xac08('0x1c4')});db[_0xac08('0xd3')][_0xac08('0x106')](db[_0xac08('0xcc')],{'foreignKey':_0xac08('0x1c4')});db[_0xac08('0xd3')]['hasMany'](db[_0xac08('0xca')],{'foreignKey':_0xac08('0x1c4')});db[_0xac08('0xd9')]['belongsToMany'](db[_0xac08('0x103')],{'as':_0xac08('0x171'),'through':_0xac08('0x1c5')});db[_0xac08('0x11c')][_0xac08('0x116')](db['User'],{'as':_0xac08('0x14a'),'through':_0xac08('0x11d')});db[_0xac08('0x11c')][_0xac08('0x116')](db[_0xac08('0x17')],{'through':_0xac08('0xff'),'as':_0xac08('0x124')});db['Team'][_0xac08('0x116')](db[_0xac08('0x38')],{'through':_0xac08('0x163'),'as':_0xac08('0x127')});db[_0xac08('0x11c')][_0xac08('0x116')](db[_0xac08('0x6c')],{'through':_0xac08('0x189'),'as':_0xac08('0x128')});db[_0xac08('0x11c')][_0xac08('0x116')](db[_0xac08('0x4e')],{'through':_0xac08('0x173'),'as':'FaxQueues'});db['Team'][_0xac08('0x116')](db['SmsQueue'],{'through':_0xac08('0x178'),'as':_0xac08('0x1c6')});db[_0xac08('0x11c')][_0xac08('0x116')](db[_0xac08('0x61')],{'through':_0xac08('0x17e'),'as':_0xac08('0x12c')});db[_0xac08('0x11c')][_0xac08('0x116')](db[_0xac08('0xfd')],{'through':_0xac08('0x1c7'),'as':_0xac08('0x12d')});db[_0xac08('0x11c')]['belongsToMany'](db[_0xac08('0xee')],{'through':_0xac08('0x1c8'),'as':'VoicePrefixes'});db[_0xac08('0x192')]['hasMany'](db[_0xac08('0x18d')],{'as':_0xac08('0x13c'),'foreignKey':_0xac08('0x193')});db['Campaign'][_0xac08('0x106')](db[_0xac08('0x74')],{'as':_0xac08('0x10b'),'foreignKey':'CampaignId'});db['Campaign']['hasMany'](db['CmHopperHistory'],{'as':_0xac08('0x13d'),'foreignKey':_0xac08('0x193')});db[_0xac08('0x192')][_0xac08('0x106')](db[_0xac08('0x72')],{'as':_0xac08('0x13e'),'foreignKey':'CampaignId'});db[_0xac08('0x192')]['belongsTo'](db[_0xac08('0x140')],{'as':_0xac08('0x140'),'foreignKey':_0xac08('0x141')});db[_0xac08('0x192')][_0xac08('0x114')](db[_0xac08('0x140')],{'as':'TrunkBackup','foreignKey':_0xac08('0x143')});db[_0xac08('0x192')][_0xac08('0x114')](db[_0xac08('0x144')],{'as':_0xac08('0x144'),'foreignKey':'IntervalId'});db[_0xac08('0x192')]['belongsTo'](db['SquareProject'],{'as':'SquareProject','foreignKey':_0xac08('0x1c9')});db[_0xac08('0x192')][_0xac08('0x116')](db['CmList'],{'as':_0xac08('0x148'),'through':'campaigns_has_cm_lists'});db[_0xac08('0x192')]['belongsToMany'](db[_0xac08('0xec')],{'as':'BlackLists','through':_0xac08('0x1ca')});db[_0xac08('0xe2')][_0xac08('0x114')](db[_0xac08('0x16a')],{'as':_0xac08('0x16a'),'foreignKey':_0xac08('0x16b')});db[_0xac08('0x1cb')][_0xac08('0x114')](db[_0xac08('0x15c')],{});db[_0xac08('0x1cb')][_0xac08('0x114')](db['MailInteraction'],{});db[_0xac08('0x1cb')][_0xac08('0x114')](db[_0xac08('0x131')],{'foreignKey':_0xac08('0x1cc'),'as':_0xac08('0x1cd')});db[_0xac08('0x1cb')]['belongsTo'](db[_0xac08('0x103')],{'foreignKey':'FromUserId','as':_0xac08('0x1ce')});db[_0xac08('0x1cb')][_0xac08('0x114')](db[_0xac08('0x103')],{'foreignKey':'ToUserId','as':'ToAgent'});db[_0xac08('0x1cb')]['belongsTo'](db[_0xac08('0x38')],{'foreignKey':_0xac08('0x1cf'),'as':_0xac08('0x1d0')});db[_0xac08('0x1cb')][_0xac08('0x114')](db['MailAccount'],{'foreignKey':_0xac08('0x1d1'),'as':_0xac08('0x1d2')});db['ChatTransferReport']['belongsTo'](db[_0xac08('0x6a')],{});db[_0xac08('0xe6')][_0xac08('0x114')](db['ChatInteraction'],{});db[_0xac08('0xe6')][_0xac08('0x114')](db['ChatWebsite'],{'foreignKey':_0xac08('0x1d3'),'as':'FromAccount'});db[_0xac08('0xe6')][_0xac08('0x114')](db[_0xac08('0x103')],{'foreignKey':_0xac08('0x1d4'),'as':_0xac08('0x1ce')});db[_0xac08('0xe6')][_0xac08('0x114')](db['User'],{'foreignKey':_0xac08('0x1d5'),'as':_0xac08('0x1d6')});db['ChatTransferReport'][_0xac08('0x114')](db[_0xac08('0x6c')],{'foreignKey':'ToChatQueueId','as':'ToQueue'});db[_0xac08('0xe6')][_0xac08('0x114')](db['ChatWebsite'],{'foreignKey':_0xac08('0x1d7'),'as':_0xac08('0x1d2')});db[_0xac08('0x1d8')][_0xac08('0x114')](db[_0xac08('0x4c')],{});db[_0xac08('0x1d8')][_0xac08('0x114')](db[_0xac08('0x4a')],{});db[_0xac08('0x1d8')][_0xac08('0x114')](db[_0xac08('0x46')],{'foreignKey':'FromFaxAccountId','as':_0xac08('0x1cd')});db[_0xac08('0x1d8')]['belongsTo'](db[_0xac08('0x103')],{'foreignKey':_0xac08('0x1d4'),'as':_0xac08('0x1ce')});db[_0xac08('0x1d8')][_0xac08('0x114')](db['User'],{'foreignKey':_0xac08('0x1d5'),'as':'ToAgent'});db[_0xac08('0x1d8')][_0xac08('0x114')](db[_0xac08('0x4e')],{'foreignKey':_0xac08('0x1d9'),'as':'ToQueue'});db[_0xac08('0x1d8')][_0xac08('0x114')](db[_0xac08('0x46')],{'foreignKey':_0xac08('0x1da'),'as':_0xac08('0x1d2')});db[_0xac08('0xe9')][_0xac08('0x114')](db[_0xac08('0x5f')],{});db['OpenchannelTransferReport'][_0xac08('0x114')](db[_0xac08('0x5d')],{});db[_0xac08('0xe9')][_0xac08('0x114')](db[_0xac08('0x5a')],{'foreignKey':'FromOpenchannelAccountId','as':_0xac08('0x1cd')});db[_0xac08('0xe9')]['belongsTo'](db[_0xac08('0x103')],{'foreignKey':_0xac08('0x1d4'),'as':_0xac08('0x1ce')});db[_0xac08('0xe9')][_0xac08('0x114')](db['User'],{'foreignKey':'ToUserId','as':_0xac08('0x1d6')});db[_0xac08('0xe9')][_0xac08('0x114')](db[_0xac08('0x61')],{'foreignKey':_0xac08('0x1db'),'as':_0xac08('0x1d0')});db[_0xac08('0xe9')][_0xac08('0x114')](db[_0xac08('0x5a')],{'foreignKey':'ToOpenchannelAccountId','as':_0xac08('0x1d2')});db[_0xac08('0xeb')][_0xac08('0x114')](db[_0xac08('0x57')],{});db[_0xac08('0xeb')][_0xac08('0x114')](db[_0xac08('0x55')],{});db[_0xac08('0xeb')][_0xac08('0x114')](db[_0xac08('0x51')],{'foreignKey':'FromSmsAccountId','as':_0xac08('0x1cd')});db[_0xac08('0xeb')][_0xac08('0x114')](db[_0xac08('0x103')],{'foreignKey':_0xac08('0x1d4'),'as':'FromAgent'});db['SmsTransferReport'][_0xac08('0x114')](db[_0xac08('0x103')],{'foreignKey':_0xac08('0x1d5'),'as':_0xac08('0x1d6')});db[_0xac08('0xeb')][_0xac08('0x114')](db['SmsQueue'],{'foreignKey':_0xac08('0x1dc'),'as':_0xac08('0x1d0')});db[_0xac08('0xeb')][_0xac08('0x114')](db[_0xac08('0x51')],{'foreignKey':_0xac08('0x1dd'),'as':_0xac08('0x1d2')});db[_0xac08('0xec')][_0xac08('0x106')](db[_0xac08('0x7e')],{'as':'Dispositions','foreignKey':_0xac08('0x160'),'onDelete':_0xac08('0x104')});db[_0xac08('0xec')][_0xac08('0x106')](db[_0xac08('0x79')],{'as':_0xac08('0x1de'),'foreignKey':_0xac08('0x160')});db[_0xac08('0xec')][_0xac08('0x106')](db[_0xac08('0x119')],{'as':_0xac08('0x11a'),'onDelete':'cascade','foreignKey':'ListId'});db[_0xac08('0xec')][_0xac08('0x106')](db[_0xac08('0x74')],{'as':_0xac08('0x10b'),'foreignKey':'ListId'});db[_0xac08('0xec')]['hasMany'](db[_0xac08('0x10c')],{'as':_0xac08('0x10d'),'foreignKey':_0xac08('0x160')});db[_0xac08('0xec')][_0xac08('0x106')](db[_0xac08('0x77')],{'as':_0xac08('0x77'),'foreignKey':_0xac08('0x160')});db[_0xac08('0xec')]['belongsToMany'](db[_0xac08('0x17')],{'as':'Queues','through':_0xac08('0x149')});db['CmList'][_0xac08('0x116')](db['User'],{'as':'Agents','through':_0xac08('0x11b')});db[_0xac08('0xee')]['hasMany'](db['VoiceExtension'],{'as':_0xac08('0x10a'),'onDelete':_0xac08('0x104')});db[_0xac08('0xee')]['belongsToMany'](db[_0xac08('0x103')],{'as':_0xac08('0x14a'),'through':_0xac08('0x126')});db[_0xac08('0xee')][_0xac08('0x116')](db[_0xac08('0x11c')],{'through':_0xac08('0x1c8'),'as':'Teams'});db[_0xac08('0xf0')]['hasMany'](db[_0xac08('0x103')],{'as':_0xac08('0x171'),'foreignKey':_0xac08('0x115')});db[_0xac08('0xf0')][_0xac08('0x106')](db[_0xac08('0xf2')],{'as':_0xac08('0x1df'),'foreignKey':_0xac08('0x115'),'onDelete':_0xac08('0x104')});db['UserProfileSection'][_0xac08('0x106')](db[_0xac08('0xf3')],{'as':_0xac08('0x1e0'),'foreignKey':_0xac08('0x1e1'),'onDelete':'cascade'});db[_0xac08('0xf6')][_0xac08('0x106')](db[_0xac08('0x7e')],{'as':_0xac08('0x15a'),'foreignKey':_0xac08('0x1e2'),'onDelete':_0xac08('0x104')});db[_0xac08('0xf6')][_0xac08('0x106')](db[_0xac08('0x7c')],{'as':_0xac08('0x15b'),'foreignKey':'WhatsappAccountId'});db[_0xac08('0xf6')][_0xac08('0x106')](db['WhatsappMessage'],{'as':'Messages','foreignKey':_0xac08('0x1e2')});db['WhatsappAccount'][_0xac08('0x106')](db[_0xac08('0xf8')],{'as':'Interactions'});db['WhatsappAccount']['hasMany'](db[_0xac08('0x1e3')],{'as':'Applications'});db[_0xac08('0xf6')][_0xac08('0x114')](db['CmList'],{'as':_0xac08('0x15f'),'foreignKey':_0xac08('0x160')});db[_0xac08('0xf6')]['belongsTo'](db[_0xac08('0x82')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db['WhatsappAccount']['belongsToMany'](db[_0xac08('0x103')],{'as':_0xac08('0x14a'),'through':_0xac08('0x135')});db[_0xac08('0x1e3')]['belongsTo'](db[_0xac08('0x103')],{'onDelete':_0xac08('0x158')});db[_0xac08('0x1e3')][_0xac08('0x114')](db[_0xac08('0xfd')],{'onDelete':_0xac08('0x158')});db['WhatsappApplication']['belongsTo'](db[_0xac08('0xf6')],{'onDelete':'restrict'});db[_0xac08('0x1e3')][_0xac08('0x114')](db['Interval'],{'onDelete':_0xac08('0x158'),'foreignKey':_0xac08('0x145')});db['WhatsappApplication']['belongsTo'](db[_0xac08('0x8c')],{'onDelete':_0xac08('0x158'),'foreignKey':'TagId'});db[_0xac08('0xf8')][_0xac08('0x106')](db['WhatsappMessage'],{'as':'Messages','onDelete':_0xac08('0x104'),'foreignKey':'WhatsappInteractionId'});db[_0xac08('0xf8')]['belongsTo'](db[_0xac08('0xf6')],{'as':_0xac08('0x165'),'foreignKey':_0xac08('0x1e2')});db[_0xac08('0xf8')][_0xac08('0x114')](db[_0xac08('0x119')],{'as':'Contact','foreignKey':'ContactId'});db[_0xac08('0xf8')][_0xac08('0x114')](db[_0xac08('0x103')],{'as':'Owner','foreignKey':_0xac08('0x105')});db[_0xac08('0xf8')][_0xac08('0x116')](db[_0xac08('0x8c')],{'through':_0xac08('0x1a4'),'as':_0xac08('0x167')});db[_0xac08('0xf8')][_0xac08('0x116')](db[_0xac08('0x8c')],{'through':_0xac08('0x1a4'),'as':_0xac08('0x168')});db['WhatsappInteraction'][_0xac08('0x116')](db[_0xac08('0x103')],{'as':'Users','through':'user_has_whatsapp_interactions','foreignKey':_0xac08('0x1e4')});db[_0xac08('0x1e5')]['belongsTo'](db[_0xac08('0x103')],{'as':_0xac08('0x103')});db[_0xac08('0x1e5')][_0xac08('0x114')](db[_0xac08('0x119')],{'onDelete':_0xac08('0x104'),'as':'Contact'});db['WhatsappMessage'][_0xac08('0x114')](db[_0xac08('0xf8')],{'onDelete':'cascade','as':'Interaction','foreignKey':_0xac08('0x1e4')});db[_0xac08('0x1e5')][_0xac08('0x114')](db['WhatsappAccount'],{'as':_0xac08('0x165'),'foreignKey':_0xac08('0x1e2')});db[_0xac08('0x1e6')][_0xac08('0x114')](db['WhatsappAccount'],{});db['WhatsappQueueReport'][_0xac08('0x114')](db[_0xac08('0xec')],{'as':'List','foreignKey':_0xac08('0x160')});db[_0xac08('0x1e6')][_0xac08('0x114')](db[_0xac08('0x119')],{'as':_0xac08('0x153'),'foreignKey':_0xac08('0x154')});db['WhatsappQueueReport']['belongsTo'](db['WhatsappInteraction'],{});db['WhatsappQueueReport']['belongsTo'](db[_0xac08('0xfd')],{});db[_0xac08('0x1e6')][_0xac08('0x114')](db[_0xac08('0x1e5')],{});db[_0xac08('0x1e6')][_0xac08('0x114')](db['User'],{});db[_0xac08('0xfb')]['belongsTo'](db[_0xac08('0x1e5')],{});db[_0xac08('0xfb')][_0xac08('0x114')](db[_0xac08('0xf8')],{});db[_0xac08('0xfb')][_0xac08('0x114')](db['WhatsappAccount'],{'foreignKey':_0xac08('0x1e7'),'as':_0xac08('0x1cd')});db[_0xac08('0xfb')][_0xac08('0x114')](db[_0xac08('0xf6')],{'foreignKey':_0xac08('0x1e8'),'as':'ToAccount'});db[_0xac08('0xfb')][_0xac08('0x114')](db['WhatsappQueue'],{'foreignKey':_0xac08('0x1e9'),'as':_0xac08('0x1d0')});db[_0xac08('0xfb')][_0xac08('0x114')](db[_0xac08('0x103')],{'foreignKey':_0xac08('0x1d4'),'as':_0xac08('0x1ce')});db['WhatsappTransferReport'][_0xac08('0x114')](db[_0xac08('0x103')],{'foreignKey':_0xac08('0x1d5'),'as':'ToAgent'});db[_0xac08('0xfd')]['belongsToMany'](db[_0xac08('0x103')],{'as':_0xac08('0x14a'),'through':_0xac08('0x34'),'foreignKey':_0xac08('0x1ea')});db[_0xac08('0xfd')][_0xac08('0x116')](db[_0xac08('0x11c')],{'through':_0xac08('0x1c7'),'as':'Teams'});db['UserSetting'][_0xac08('0x114')](db['User'],{'as':_0xac08('0x1eb'),'foreignKey':'UserId','onDelete':_0xac08('0x104'),'hooks':!![]});db[_0xac08('0xfe')][_0xac08('0x159')](db[_0xac08('0xbc')],{'as':_0xac08('0xbc'),'onDelete':_0xac08('0x158')});db[_0xac08('0xfe')]['hasOne'](db[_0xac08('0x35')],{'as':_0xac08('0x1ec'),'onDelete':_0xac08('0x158')});db[_0xac08('0xfe')][_0xac08('0x159')](db[_0xac08('0x156')],{'as':_0xac08('0x1ed'),'onDelete':_0xac08('0x158')});module[_0xac08('0x1ee')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0x18ca=['Owner','fax_interaction_has_tags','FaxInteractionId','AttachmentId','FaxQueueReport','SmsAccountId','SmsMessage','SmsInteractionId','sms_interaction_has_tags','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','openchannel_interaction_has_tags','OpenchannelInteractionId','team_has_openchannel_queues','Answers','ChatProactiveAction','ProactiveActions','ChatMessage','Agent','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','Tags','ChatOfflineMessageId','ChatGroupId','CmCompany','CompanyId','cm_contact_has_tags','CampaignId','Condition','All','OneAll','AutomationAllId','OneAny','AutomationAnyId','Action','Actions','AutomationId','ParentId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','CustomReportId','Mohs','moh_has_sounds','AllConditions','TriggerAllId','AnyConditions','TriggerAnyId','Fields','MetricId','Configurations','Subjects','SubjectId','Descriptions','DescriptionId','FieldId','Subject','Description','VariableId','SugarcrmAccount','AccountId','int_desk_configuration_has_tags','ZohoAccount','Field','int_zendesk_configuration_has_tags','int_freshdesk_configuration_has_tags','VtigerField','ServicenowField','Dynamics365Account','FreshsalesConfiguration','ChatQueueReport','FromId','ToId','JscriptyQuestionReport','SessionId','JscriptyProject','ProjectId','team_has_chat_queues','team_has_fax_queues','team_has_whatsapp_queues','VoicePrefixes','TrunkBackup','SquareProjectId','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromAgent','ToMailQueueId','ToAccount','FromAccount','ToUserId','ToAgent','ToChatQueueId','ToQueue','ToChatWebsiteId','FromUserId','ToFaxQueueId','FromOpenchannelAccountId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','CmCustomField','CustomFields','Queues','UserProfileSections','UserProfileResource','Resources','WhatsappAccount','WhatsappAccountId','WhatsappInteractionId','whatsapp_interaction_has_tags','FromWhatsappAccountId','ToWhatsappAccountId','WhatsappQueueId','user','exports','../config/environment','sequelize','lodash','jstz','determine','defaultsDeep','motion2','xC@LL1234','127.0.0.1','mysql','utf8mb4','name','utf8','sequelizeHistory','xcall','utf8_general_ci','username','options','database','password','User','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','VoiceDialReport','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','../api/voiceTransferReport/voiceTransferReport.model','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','UserChatQueue','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','MailApplication','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','ChatGroup','../api/chatGroup/chatGroup.model','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','../api/cmHopper/cmHopper.model','CmHopperBlack','CmHopperFinal','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','../api/action/action.model','Automation','../api/automation/automation.model','../api/cannedAnswer/cannedAnswer.model','../api/disposition/disposition.model','../api/condition/condition.model','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/tag/tag.model','Template','Trigger','../api/trigger/trigger.model','Variable','../api/variable/variable.model','Integration','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','../api/intVtigerField/intVtigerField.model','ServicenowAccount','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','../api/intServicenowField/intServicenowField.model','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','Network','../api/network/network.model','ChatInternalMessage','JscriptyAnswerReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','SmsQueueReport','SquareReport','../api/squareReportDetail/squareReportDetail.model','../api/jscriptyProject/jscriptyProject.model','../api/setting/setting.model','SquareOdbc','SquareProject','../api/squareProject/squareProject.model','../api/squareRecording/squareRecording.model','SquareMessage','../api/team/team.model','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','Attachment','../api/attachment/attachment.model','Plugin','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/cmList/cmList.model','VoicePrefix','UserProfile','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserNotification','../api/userNotification/userNotification.model','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','UserSetting','hasOne','UserId','cascade','hasMany','UserVoiceQueueRt','VoiceExtension','Extensions','HopperFinals','CmHopperHistory','HopperHistory','ChatInteractions','SmsInteractions','FaxInteractions','MailInteractions','WhatsappInteractions','UserNotifications','belongsTo','userProfileId','belongsToMany','Groups','chat_group_has_users','Contacts','cm_user_has_contacts','CmList','Lists','cm_user_has_lists','Team','user_has_teams','user_has_mail_interactions','user_has_chat_interactions','user_has_fax_interactions','user_has_sms_interactions','OpenchannelInteraction','OpenchannelInteractions','user_has_whatsapp_interactions','MailQueues','ChatQueues','FaxQueue','FaxQueues','SmsQueues','OpenchannelQueues','WhatsappQueues','user_has_chat_websites','FaxAccount','FaxAccounts','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','user_has_openchannel_accounts','SmsAccounts','WhatsappAccounts','user_has_whatsapp_accounts','user_has_square_projects','SpiedAgents','ChanSpyId','Applications','Sounds','Members','VoiceQueueId','CmHopper','Hoppers','HopperHistories','HopperBlacks','JscriptySessionReport','TrunkId','TrunkBackupId','Interval','IntervalId','voice_queues_has_cm_lists','BlackLists','voice_queues_has_cm_blacklists','mailboxuser','mailbox','VoiceQueueReport','QueueCalls','uniqueid','AgentReports','Contact','ContactId','MailServerIn','MailAccountId','CloudProvider','CloudProviderId','restrict','Imap','Smtp','Disposition','Dispositions','CannedAnswer','Interactions','List','ListId','mandatoryDispositionPauseId','Agents','team_has_mail_queues','Teams','MailInteractionId','mail_interaction_has_tags','Tag','ThroughTags','Users','Attachments','Interaction','Account','ChatWebsiteId','TagId','Items','FaxAccountId','Exntensions','Messages','mandatoryDispositionPause'];(function(_0x41b0a8,_0x1b05cc){var _0x3a83d4=function(_0x3d1011){while(--_0x3d1011){_0x41b0a8['push'](_0x41b0a8['shift']());}};_0x3a83d4(++_0x1b05cc);}(_0x18ca,0x7c));var _0xa18c=function(_0x5500b1,_0x471843){_0x5500b1=_0x5500b1-0x0;var _0x165094=_0x18ca[_0x5500b1];return _0x165094;};'use strict';var config=require(_0xa18c('0x0'));var Sequelize=require(_0xa18c('0x1'));var _=require(_0xa18c('0x2'));var jstz=require(_0xa18c('0x3'));var timezone=jstz[_0xa18c('0x4')]();config[_0xa18c('0x1')]=_[_0xa18c('0x5')](config[_0xa18c('0x1')],{'database':_0xa18c('0x6'),'username':'xcall','password':_0xa18c('0x7'),'options':{'host':_0xa18c('0x8'),'port':0xcea,'dialect':_0xa18c('0x9'),'dialectOptions':{'charset':_0xa18c('0xa')},'logging':![],'timezone':timezone[_0xa18c('0xb')](),'define':{'charset':_0xa18c('0xc'),'collate':'utf8_general_ci'}}});config[_0xa18c('0xd')]=_[_0xa18c('0x5')](config['sequelizeHistory'],{'database':_0xa18c('0x6'),'username':_0xa18c('0xe'),'password':_0xa18c('0x7'),'options':{'host':_0xa18c('0x8'),'port':0xcea,'dialect':_0xa18c('0x9'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0xa18c('0xc'),'collate':_0xa18c('0xf')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xa18c('0x1')]['database'],config[_0xa18c('0x1')][_0xa18c('0x10')],config[_0xa18c('0x1')]['password'],config[_0xa18c('0x1')][_0xa18c('0x11')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xa18c('0xd')][_0xa18c('0x12')],config['sequelizeHistory'][_0xa18c('0x10')],config[_0xa18c('0xd')][_0xa18c('0x13')],config[_0xa18c('0xd')][_0xa18c('0x11')])};db[_0xa18c('0x14')]=db[_0xa18c('0x1')][_0xa18c('0x15')](_0xa18c('0x16'));db[_0xa18c('0x17')]=db[_0xa18c('0x1')][_0xa18c('0x15')](_0xa18c('0x18'));db[_0xa18c('0x19')]=db[_0xa18c('0x1')]['import'](_0xa18c('0x1a'));db['VoiceExtension']=db[_0xa18c('0x1')][_0xa18c('0x15')](_0xa18c('0x1b'));db[_0xa18c('0x1c')]=db[_0xa18c('0x1')]['import'](_0xa18c('0x1d'));db[_0xa18c('0x1e')]=db['sequelize'][_0xa18c('0x15')](_0xa18c('0x1f'));db[_0xa18c('0x20')]=db['sequelize']['import'](_0xa18c('0x21'));db[_0xa18c('0x22')]=db[_0xa18c('0x1')][_0xa18c('0x15')](_0xa18c('0x23'));db[_0xa18c('0x24')]=db['sequelize'][_0xa18c('0x15')]('../api/voiceMail/voiceMail.model');db[_0xa18c('0x25')]=db[_0xa18c('0x1')][_0xa18c('0x15')](_0xa18c('0x26'));db[_0xa18c('0x27')]=db[_0xa18c('0x1')][_0xa18c('0x15')]('../api/voiceCallReport/voiceCallReport.model');db[_0xa18c('0x28')]=db[_0xa18c('0x1')][_0xa18c('0x15')]('../api/voiceDialReport/voiceDialReport.model');db[_0xa18c('0x29')]=db[_0xa18c('0x1')][_0xa18c('0x15')](_0xa18c('0x2a'));db['VoiceQueueReport']=db[_0xa18c('0x1')][_0xa18c('0x15')](_0xa18c('0x2b'));db[_0xa18c('0x2c')]=db[_0xa18c('0x1')][_0xa18c('0x15')](_0xa18c('0x2d'));db[_0xa18c('0x2e')]=db[_0xa18c('0x1')][_0xa18c('0x15')](_0xa18c('0x2f'));db['VoiceTransferReport']=db[_0xa18c('0x1')][_0xa18c('0x15')](_0xa18c('0x30'));db['UserVoiceQueueRt']=db[_0xa18c('0x1')]['import'](_0xa18c('0x31'));db[_0xa18c('0x32')]=db['sequelize']['import']('../api/userVoiceQueue/userVoiceQueue.model');db[_0xa18c('0x33')]=db[_0xa18c('0x1')]['import']('../api/userChatQueue/userChatQueue.model');db[_0xa18c('0x34')]=db[_0xa18c('0x1')][_0xa18c('0x15')](_0xa18c('0x35'));db[_0xa18c('0x36')]=db['sequelize'][_0xa18c('0x15')]('../api/userFaxQueue/userFaxQueue.model');db[_0xa18c('0x37')]=db[_0xa18c('0x1')][_0xa18c('0x15')](_0xa18c('0x38'));db[_0xa18c('0x39')]=db[_0xa18c('0x1')][_0xa18c('0x15')](_0xa18c('0x3a'));db[_0xa18c('0x3b')]=db[_0xa18c('0x1')]['import'](_0xa18c('0x3c'));db['MailServerIn']=db['sequelize'][_0xa18c('0x15')](_0xa18c('0x3d'));db[_0xa18c('0x3e')]=db[_0xa18c('0x1')][_0xa18c('0x15')](_0xa18c('0x3f'));db[_0xa18c('0x40')]=db[_0xa18c('0x1')][_0xa18c('0x15')](_0xa18c('0x41'));db[_0xa18c('0x42')]=db[_0xa18c('0x1')][_0xa18c('0x15')](_0xa18c('0x43'));db['MailSubstatus']=db[_0xa18c('0x1')][_0xa18c('0x15')](_0xa18c('0x44'));db[_0xa18c('0x45')]=db[_0xa18c('0x1')][_0xa18c('0x15')](_0xa18c('0x46'));db[_0xa18c('0x47')]=db[_0xa18c('0x1')][_0xa18c('0x15')]('../api/mailMessage/mailMessage.model');db[_0xa18c('0x48')]=db[_0xa18c('0x1')]['import']('../api/mailApplication/mailApplication.model');db[_0xa18c('0x49')]=db['sequelize']['import'](_0xa18c('0x4a'));db[_0xa18c('0x4b')]=db[_0xa18c('0x1')]['import'](_0xa18c('0x4c'));db[_0xa18c('0x4d')]=db[_0xa18c('0x1')][_0xa18c('0x15')](_0xa18c('0x4e'));db['FaxAccount']=db[_0xa18c('0x1')]['import'](_0xa18c('0x4f'));db[_0xa18c('0x50')]=db[_0xa18c('0x1')]['import'](_0xa18c('0x51'));db[_0xa18c('0x52')]=db[_0xa18c('0x1')][_0xa18c('0x15')](_0xa18c('0x53'));db[_0xa18c('0x54')]=db[_0xa18c('0x1')]['import']('../api/faxMessage/faxMessage.model');db['FaxQueue']=db['sequelize'][_0xa18c('0x15')]('../api/faxQueue/faxQueue.model');db['FaxQueueReport']=db[_0xa18c('0x1')][_0xa18c('0x15')](_0xa18c('0x55'));db[_0xa18c('0x56')]=db[_0xa18c('0x1')][_0xa18c('0x15')](_0xa18c('0x57'));db[_0xa18c('0x58')]=db[_0xa18c('0x1')]['import'](_0xa18c('0x59'));db[_0xa18c('0x5a')]=db['sequelize'][_0xa18c('0x15')](_0xa18c('0x5b'));db['SmsMessage']=db[_0xa18c('0x1')][_0xa18c('0x15')](_0xa18c('0x5c'));db[_0xa18c('0x5d')]=db[_0xa18c('0x1')]['import'](_0xa18c('0x5e'));db[_0xa18c('0x5f')]=db[_0xa18c('0x1')][_0xa18c('0x15')](_0xa18c('0x60'));db[_0xa18c('0x61')]=db[_0xa18c('0x1')][_0xa18c('0x15')](_0xa18c('0x62'));db['OpenchannelInteraction']=db['sequelize'][_0xa18c('0x15')](_0xa18c('0x63'));db[_0xa18c('0x64')]=db['sequelize'][_0xa18c('0x15')](_0xa18c('0x65'));db[_0xa18c('0x66')]=db[_0xa18c('0x1')][_0xa18c('0x15')]('../api/openchannelQueue/openchannelQueue.model');db[_0xa18c('0x67')]=db['sequelize'][_0xa18c('0x15')](_0xa18c('0x68'));db[_0xa18c('0x69')]=db[_0xa18c('0x1')][_0xa18c('0x15')](_0xa18c('0x6a'));db[_0xa18c('0x6b')]=db[_0xa18c('0x1')][_0xa18c('0x15')](_0xa18c('0x6c'));db[_0xa18c('0x6d')]=db[_0xa18c('0x1')]['import']('../api/chatInteraction/chatInteraction.model');db['ChatMessage']=db[_0xa18c('0x1')][_0xa18c('0x15')](_0xa18c('0x6e'));db[_0xa18c('0x6f')]=db[_0xa18c('0x1')][_0xa18c('0x15')](_0xa18c('0x70'));db[_0xa18c('0x71')]=db['sequelize'][_0xa18c('0x15')]('../api/chatQueue/chatQueue.model');db[_0xa18c('0x72')]=db[_0xa18c('0x1')][_0xa18c('0x15')](_0xa18c('0x73'));db['ChatProactiveAction']=db[_0xa18c('0x1')][_0xa18c('0x15')](_0xa18c('0x74'));db['CmCompany']=db['sequelize'][_0xa18c('0x15')](_0xa18c('0x75'));db[_0xa18c('0x76')]=db[_0xa18c('0x1')][_0xa18c('0x15')](_0xa18c('0x77'));db['CmHopper']=db[_0xa18c('0x1')]['import'](_0xa18c('0x78'));db[_0xa18c('0x79')]=db[_0xa18c('0x1')][_0xa18c('0x15')]('../api/cmHopperBlack/cmHopperBlack.model');db[_0xa18c('0x7a')]=db[_0xa18c('0x1')][_0xa18c('0x15')]('../api/cmHopperFinal/cmHopperFinal.model');db['CmHopperHistory']=db[_0xa18c('0x1')][_0xa18c('0x15')](_0xa18c('0x7b'));db[_0xa18c('0x7c')]=db[_0xa18c('0x1')][_0xa18c('0x15')](_0xa18c('0x7d'));db['CmCustomField']=db['sequelize'][_0xa18c('0x15')]('../api/cmCustomField/cmCustomField.model');db['Action']=db[_0xa18c('0x1')][_0xa18c('0x15')](_0xa18c('0x7e'));db[_0xa18c('0x7f')]=db[_0xa18c('0x1')]['import'](_0xa18c('0x80'));db['CannedAnswer']=db[_0xa18c('0x1')][_0xa18c('0x15')](_0xa18c('0x81'));db['Disposition']=db[_0xa18c('0x1')][_0xa18c('0x15')](_0xa18c('0x82'));db['Condition']=db[_0xa18c('0x1')]['import'](_0xa18c('0x83'));db['Interval']=db[_0xa18c('0x1')]['import'](_0xa18c('0x84'));db[_0xa18c('0x85')]=db['sequelize'][_0xa18c('0x15')](_0xa18c('0x86'));db[_0xa18c('0x87')]=db['sequelize'][_0xa18c('0x15')](_0xa18c('0x88'));db[_0xa18c('0x89')]=db['sequelize'][_0xa18c('0x15')](_0xa18c('0x8a'));db[_0xa18c('0x8b')]=db[_0xa18c('0x1')][_0xa18c('0x15')](_0xa18c('0x8c'));db[_0xa18c('0x8d')]=db[_0xa18c('0x1')]['import']('../api/sound/sound.model');db['Tag']=db[_0xa18c('0x1')][_0xa18c('0x15')](_0xa18c('0x8e'));db[_0xa18c('0x8f')]=db[_0xa18c('0x1')][_0xa18c('0x15')]('../api/template/template.model');db[_0xa18c('0x90')]=db['sequelize'][_0xa18c('0x15')](_0xa18c('0x91'));db[_0xa18c('0x92')]=db[_0xa18c('0x1')][_0xa18c('0x15')](_0xa18c('0x93'));db[_0xa18c('0x94')]=db[_0xa18c('0x1')][_0xa18c('0x15')]('../api/integration/integration.model');db[_0xa18c('0x95')]=db[_0xa18c('0x1')][_0xa18c('0x15')](_0xa18c('0x96'));db[_0xa18c('0x97')]=db[_0xa18c('0x1')][_0xa18c('0x15')](_0xa18c('0x98'));db[_0xa18c('0x99')]=db[_0xa18c('0x1')][_0xa18c('0x15')](_0xa18c('0x9a'));db['AnalyticExtractedReport']=db['sequelize']['import']('../api/analyticExtractedReport/analyticExtractedReport.model');db[_0xa18c('0x9b')]=db[_0xa18c('0x1')][_0xa18c('0x15')](_0xa18c('0x9c'));db[_0xa18c('0x9d')]=db['sequelize']['import'](_0xa18c('0x9e'));db['AnalyticTreeReport']=db['sequelize'][_0xa18c('0x15')](_0xa18c('0x9f'));db[_0xa18c('0xa0')]=db['sequelize'][_0xa18c('0x15')]('../api/intSalesforceAccount/intSalesforceAccount.model');db[_0xa18c('0xa1')]=db[_0xa18c('0x1')]['import'](_0xa18c('0xa2'));db[_0xa18c('0xa3')]=db['sequelize'][_0xa18c('0x15')](_0xa18c('0xa4'));db['SugarcrmAccount']=db[_0xa18c('0x1')]['import'](_0xa18c('0xa5'));db[_0xa18c('0xa6')]=db[_0xa18c('0x1')][_0xa18c('0x15')](_0xa18c('0xa7'));db[_0xa18c('0xa8')]=db[_0xa18c('0x1')][_0xa18c('0x15')](_0xa18c('0xa9'));db[_0xa18c('0xaa')]=db['sequelize'][_0xa18c('0x15')](_0xa18c('0xab'));db[_0xa18c('0xac')]=db[_0xa18c('0x1')]['import'](_0xa18c('0xad'));db[_0xa18c('0xae')]=db['sequelize'][_0xa18c('0x15')](_0xa18c('0xaf'));db['ZohoAccount']=db[_0xa18c('0x1')][_0xa18c('0x15')](_0xa18c('0xb0'));db[_0xa18c('0xb1')]=db[_0xa18c('0x1')][_0xa18c('0x15')](_0xa18c('0xb2'));db[_0xa18c('0xb3')]=db[_0xa18c('0x1')][_0xa18c('0x15')](_0xa18c('0xb4'));db[_0xa18c('0xb5')]=db['sequelize']['import'](_0xa18c('0xb6'));db[_0xa18c('0xb7')]=db['sequelize'][_0xa18c('0x15')](_0xa18c('0xb8'));db[_0xa18c('0xb9')]=db[_0xa18c('0x1')]['import'](_0xa18c('0xba'));db[_0xa18c('0xbb')]=db[_0xa18c('0x1')][_0xa18c('0x15')](_0xa18c('0xbc'));db[_0xa18c('0xbd')]=db['sequelize']['import'](_0xa18c('0xbe'));db[_0xa18c('0xbf')]=db[_0xa18c('0x1')][_0xa18c('0x15')](_0xa18c('0xc0'));db['VtigerAccount']=db[_0xa18c('0x1')][_0xa18c('0x15')](_0xa18c('0xc1'));db[_0xa18c('0xc2')]=db[_0xa18c('0x1')]['import'](_0xa18c('0xc3'));db['VtigerField']=db['sequelize'][_0xa18c('0x15')](_0xa18c('0xc4'));db[_0xa18c('0xc5')]=db['sequelize'][_0xa18c('0x15')]('../api/intServicenowAccount/intServicenowAccount.model');db[_0xa18c('0xc6')]=db['sequelize'][_0xa18c('0x15')](_0xa18c('0xc7'));db['ServicenowField']=db['sequelize'][_0xa18c('0x15')](_0xa18c('0xc8'));db['Dynamics365Account']=db['sequelize'][_0xa18c('0x15')](_0xa18c('0xc9'));db[_0xa18c('0xca')]=db[_0xa18c('0x1')][_0xa18c('0x15')](_0xa18c('0xcb'));db[_0xa18c('0xcc')]=db[_0xa18c('0x1')][_0xa18c('0x15')](_0xa18c('0xcd'));db[_0xa18c('0xce')]=db['sequelize'][_0xa18c('0x15')](_0xa18c('0xcf'));db['FreshsalesConfiguration']=db[_0xa18c('0x1')][_0xa18c('0x15')](_0xa18c('0xd0'));db[_0xa18c('0xd1')]=db[_0xa18c('0x1')][_0xa18c('0x15')]('../api/intFreshsalesField/intFreshsalesField.model');db[_0xa18c('0x94')]=db['sequelize']['import']('../api/integration/integration.model');db[_0xa18c('0xd2')]=db['sequelize'][_0xa18c('0x15')](_0xa18c('0xd3'));db['ChatQueueReport']=db['sequelize'][_0xa18c('0x15')]('../api/chatQueueReport/chatQueueReport.model');db[_0xa18c('0xd4')]=db[_0xa18c('0x1')][_0xa18c('0x15')]('../api/chatInternalMessage/chatInternalMessage.model');db[_0xa18c('0xd5')]=db['sequelize']['import']('../api/jscriptyAnswerReport/jscriptyAnswerReport.model');db['JscriptyQuestionReport']=db['sequelize'][_0xa18c('0x15')](_0xa18c('0xd6'));db['JscriptySessionReport']=db[_0xa18c('0x1')]['import']('../api/jscriptySessionReport/jscriptySessionReport.model');db[_0xa18c('0xd7')]=db['sequelize'][_0xa18c('0x15')]('../api/smsQueueReport/smsQueueReport.model');db[_0xa18c('0xd8')]=db[_0xa18c('0x1')][_0xa18c('0x15')]('../api/squareReport/squareReport.model');db['SquareDetailsReport']=db[_0xa18c('0x1')][_0xa18c('0x15')](_0xa18c('0xd9'));db['JscriptyProject']=db[_0xa18c('0x1')][_0xa18c('0x15')](_0xa18c('0xda'));db['Setting']=db['sequelize']['import'](_0xa18c('0xdb'));db[_0xa18c('0xdc')]=db[_0xa18c('0x1')][_0xa18c('0x15')]('../api/squareOdbc/squareOdbc.model');db[_0xa18c('0xdd')]=db[_0xa18c('0x1')][_0xa18c('0x15')](_0xa18c('0xde'));db['SquareRecording']=db[_0xa18c('0x1')]['import'](_0xa18c('0xdf'));db[_0xa18c('0xe0')]=db['sequelize'][_0xa18c('0x15')]('../api/squareMessage/squareMessage.model');db['Team']=db[_0xa18c('0x1')][_0xa18c('0x15')](_0xa18c('0xe1'));db[_0xa18c('0xe2')]=db['sequelize'][_0xa18c('0x15')](_0xa18c('0xe3'));db[_0xa18c('0xe4')]=db[_0xa18c('0x1')][_0xa18c('0x15')](_0xa18c('0xe5'));db[_0xa18c('0xe6')]=db['sequelize'][_0xa18c('0x15')]('../api/migration/migration.model');db[_0xa18c('0xe7')]=db[_0xa18c('0x1')][_0xa18c('0x15')](_0xa18c('0xe8'));db[_0xa18c('0xe9')]=db[_0xa18c('0x1')][_0xa18c('0x15')]('../api/plugin/plugin.model');db['MailTransferReport']=db[_0xa18c('0x1')]['import']('../api/mailTransferReport/mailTransferReport.model');db[_0xa18c('0xea')]=db[_0xa18c('0x1')]['import'](_0xa18c('0xeb'));db[_0xa18c('0xec')]=db['sequelize'][_0xa18c('0x15')](_0xa18c('0xed'));db[_0xa18c('0xee')]=db[_0xa18c('0x1')][_0xa18c('0x15')](_0xa18c('0xef'));db[_0xa18c('0xf0')]=db['sequelize'][_0xa18c('0x15')]('../api/smsTransferReport/smsTransferReport.model');db['CmList']=db['sequelize'][_0xa18c('0x15')](_0xa18c('0xf1'));db[_0xa18c('0xf2')]=db['sequelize'][_0xa18c('0x15')]('../api/voicePrefix/voicePrefix.model');db[_0xa18c('0xf3')]=db['sequelize']['import']('../api/userProfile/userProfile.model');db[_0xa18c('0xf4')]=db[_0xa18c('0x1')][_0xa18c('0x15')](_0xa18c('0xf5'));db['UserProfileResource']=db[_0xa18c('0x1')][_0xa18c('0x15')]('../api/userProfileResource/userProfileResource.model');db[_0xa18c('0xf6')]=db[_0xa18c('0x1')][_0xa18c('0x15')](_0xa18c('0xf7'));db['WhatsappAccount']=db['sequelize'][_0xa18c('0x15')](_0xa18c('0xf8'));db[_0xa18c('0xf9')]=db[_0xa18c('0x1')]['import'](_0xa18c('0xfa'));db[_0xa18c('0xfb')]=db['sequelize'][_0xa18c('0x15')](_0xa18c('0xfc'));db[_0xa18c('0xfd')]=db[_0xa18c('0x1')]['import'](_0xa18c('0xfe'));db[_0xa18c('0xff')]=db['sequelize'][_0xa18c('0x15')](_0xa18c('0x100'));db[_0xa18c('0x101')]=db[_0xa18c('0x1')][_0xa18c('0x15')]('../api/whatsappTransferReport/whatsappTransferReport.model');db[_0xa18c('0x102')]=db[_0xa18c('0x1')]['import'](_0xa18c('0x103'));db['CloudProvider']=db[_0xa18c('0x1')][_0xa18c('0x15')](_0xa18c('0x104'));db[_0xa18c('0x105')]=db['sequelize'][_0xa18c('0x15')]('../api/teamVoiceQueue/teamVoiceQueue.model');db[_0xa18c('0x106')]=db[_0xa18c('0x1')][_0xa18c('0x15')](_0xa18c('0x107'));db[_0xa18c('0x108')]=db[_0xa18c('0x1')][_0xa18c('0x15')](_0xa18c('0x109'));db[_0xa18c('0x10a')]=db[_0xa18c('0x1')]['import']('../api/user-setting/user-setting.model');db[_0xa18c('0x14')][_0xa18c('0x10b')](db[_0xa18c('0x24')],{'as':'VoiceMail','onDelete':'cascade','foreignKey':_0xa18c('0x10c')});db['User']['hasOne'](db[_0xa18c('0x10a')],{'as':'userSetting','onDelete':_0xa18c('0x10d'),'foreignKey':_0xa18c('0x10c')});db[_0xa18c('0x14')][_0xa18c('0x10e')](db['VoiceRecording'],{'as':'Recordings','foreignKey':'UserId'});db['User']['hasMany'](db[_0xa18c('0x10f')],{'as':'VoiceQueuesRt','foreignKey':_0xa18c('0x10c')});db[_0xa18c('0x14')][_0xa18c('0x10e')](db[_0xa18c('0x110')],{'as':_0xa18c('0x111'),'onDelete':'cascade','hooks':!![]});db[_0xa18c('0x14')][_0xa18c('0x10e')](db['CmHopperFinal'],{'as':_0xa18c('0x112'),'foreignKey':_0xa18c('0x10c')});db[_0xa18c('0x14')][_0xa18c('0x10e')](db[_0xa18c('0x113')],{'as':_0xa18c('0x114'),'foreignKey':_0xa18c('0x10c')});db['User'][_0xa18c('0x10e')](db[_0xa18c('0x7c')],{'as':'ReportAgentPreview','foreignKey':_0xa18c('0x10c')});db[_0xa18c('0x14')][_0xa18c('0x10e')](db['OpenchannelInteraction'],{'as':'OpenchannelInteractions','foreignKey':_0xa18c('0x10c')});db[_0xa18c('0x14')][_0xa18c('0x10e')](db[_0xa18c('0x6d')],{'as':_0xa18c('0x115'),'foreignKey':'UserId'});db[_0xa18c('0x14')]['hasMany'](db[_0xa18c('0x5a')],{'as':_0xa18c('0x116'),'foreignKey':'UserId'});db[_0xa18c('0x14')][_0xa18c('0x10e')](db[_0xa18c('0x52')],{'as':_0xa18c('0x117'),'foreignKey':_0xa18c('0x10c')});db['User']['hasMany'](db['MailInteraction'],{'as':_0xa18c('0x118'),'foreignKey':_0xa18c('0x10c')});db[_0xa18c('0x14')][_0xa18c('0x10e')](db[_0xa18c('0xfb')],{'as':_0xa18c('0x119'),'foreignKey':'UserId'});db[_0xa18c('0x14')][_0xa18c('0x10e')](db[_0xa18c('0xf6')],{'as':_0xa18c('0x11a'),'foreignKey':'SenderId'});db[_0xa18c('0x14')][_0xa18c('0x11b')](db[_0xa18c('0xf3')],{'as':'UserProfile','foreignKey':_0xa18c('0x11c')});db['User'][_0xa18c('0x11d')](db[_0xa18c('0x72')],{'as':_0xa18c('0x11e'),'through':_0xa18c('0x11f')});db[_0xa18c('0x14')][_0xa18c('0x11d')](db[_0xa18c('0x76')],{'as':_0xa18c('0x120'),'through':_0xa18c('0x121')});db['User'][_0xa18c('0x11d')](db[_0xa18c('0x122')],{'as':_0xa18c('0x123'),'through':_0xa18c('0x124')});db[_0xa18c('0x14')][_0xa18c('0x11d')](db[_0xa18c('0x125')],{'through':_0xa18c('0x126')});db[_0xa18c('0x14')][_0xa18c('0x11d')](db[_0xa18c('0x45')],{'as':_0xa18c('0x118'),'through':_0xa18c('0x127')});db[_0xa18c('0x14')][_0xa18c('0x11d')](db[_0xa18c('0x6d')],{'as':_0xa18c('0x115'),'through':_0xa18c('0x128')});db['User'][_0xa18c('0x11d')](db['FaxInteraction'],{'as':'FaxInteractions','through':_0xa18c('0x129')});db['User'][_0xa18c('0x11d')](db[_0xa18c('0x5a')],{'as':'SmsInteractions','through':_0xa18c('0x12a')});db[_0xa18c('0x14')]['belongsToMany'](db[_0xa18c('0x12b')],{'as':_0xa18c('0x12c'),'through':'user_has_openchannel_interactions'});db[_0xa18c('0x14')]['belongsToMany'](db[_0xa18c('0xfb')],{'as':_0xa18c('0x119'),'through':_0xa18c('0x12d')});db['User'][_0xa18c('0x11d')](db[_0xa18c('0x1e')],{'as':'VoiceQueues','through':_0xa18c('0x32'),'required':![]});db[_0xa18c('0x14')][_0xa18c('0x11d')](db[_0xa18c('0xf2')],{'as':'VoicePrefixes','through':_0xa18c('0x108'),'required':![]});db['User']['belongsToMany'](db[_0xa18c('0x42')],{'as':_0xa18c('0x12e'),'through':_0xa18c('0x34'),'required':![]});db[_0xa18c('0x14')][_0xa18c('0x11d')](db[_0xa18c('0x71')],{'as':_0xa18c('0x12f'),'through':_0xa18c('0x33'),'required':![],'hooks':!![]});db[_0xa18c('0x14')]['belongsToMany'](db[_0xa18c('0x130')],{'as':_0xa18c('0x131'),'through':'UserFaxQueue','required':![]});db[_0xa18c('0x14')][_0xa18c('0x11d')](db[_0xa18c('0x5d')],{'as':_0xa18c('0x132'),'through':'UserSmsQueue','required':![]});db[_0xa18c('0x14')][_0xa18c('0x11d')](db[_0xa18c('0x66')],{'as':_0xa18c('0x133'),'through':_0xa18c('0x39'),'required':![]});db[_0xa18c('0x14')][_0xa18c('0x11d')](db['WhatsappQueue'],{'as':_0xa18c('0x134'),'through':_0xa18c('0x3b'),'required':![]});db[_0xa18c('0x14')][_0xa18c('0x11d')](db[_0xa18c('0x122')],{'through':'cm_user_has_lists'});db[_0xa18c('0x14')][_0xa18c('0x11d')](db['ChatWebsite'],{'as':'ChatWebsites','through':_0xa18c('0x135')});db[_0xa18c('0x14')][_0xa18c('0x11d')](db[_0xa18c('0x136')],{'as':_0xa18c('0x137'),'through':_0xa18c('0x138')});db[_0xa18c('0x14')][_0xa18c('0x11d')](db['MailAccount'],{'as':_0xa18c('0x139'),'through':_0xa18c('0x13a')});db[_0xa18c('0x14')][_0xa18c('0x11d')](db['OpenchannelAccount'],{'as':'OpenchannelAccounts','through':_0xa18c('0x13b')});db[_0xa18c('0x14')][_0xa18c('0x11d')](db[_0xa18c('0x56')],{'as':_0xa18c('0x13c'),'through':'user_has_sms_accounts'});db[_0xa18c('0x14')]['belongsToMany'](db['WhatsappAccount'],{'as':_0xa18c('0x13d'),'through':_0xa18c('0x13e')});db[_0xa18c('0x14')][_0xa18c('0x11d')](db[_0xa18c('0xdd')],{'as':'SquareProjects','through':_0xa18c('0x13f')});db[_0xa18c('0x17')]['hasMany'](db[_0xa18c('0x110')],{'as':_0xa18c('0x140'),'onDelete':_0xa18c('0x10d'),'foreignKey':_0xa18c('0x141')});db[_0xa18c('0x19')][_0xa18c('0x10e')](db[_0xa18c('0x110')],{'onDelete':'cascade'});db[_0xa18c('0x110')][_0xa18c('0x10e')](db[_0xa18c('0x110')],{'as':_0xa18c('0x142'),'onDelete':_0xa18c('0x10d')});db[_0xa18c('0x1c')]['belongsToMany'](db[_0xa18c('0x8d')],{'as':_0xa18c('0x143'),'through':'moh_has_sounds'});db[_0xa18c('0x1e')][_0xa18c('0x10e')](db[_0xa18c('0x10f')],{'as':_0xa18c('0x144'),'foreignKey':_0xa18c('0x145')});db[_0xa18c('0x1e')][_0xa18c('0x10e')](db[_0xa18c('0x146')],{'as':_0xa18c('0x147'),'foreignKey':_0xa18c('0x145')});db[_0xa18c('0x1e')][_0xa18c('0x10e')](db['CmHopperFinal'],{'as':_0xa18c('0x112'),'foreignKey':_0xa18c('0x145')});db[_0xa18c('0x1e')][_0xa18c('0x10e')](db[_0xa18c('0x113')],{'as':_0xa18c('0x148'),'foreignKey':_0xa18c('0x145')});db[_0xa18c('0x1e')]['hasMany'](db[_0xa18c('0x7c')],{'as':_0xa18c('0x7c'),'foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0xa18c('0x10e')](db[_0xa18c('0x79')],{'as':_0xa18c('0x149'),'foreignKey':'VoiceQueueId'});db[_0xa18c('0x1e')]['hasMany'](db[_0xa18c('0x14a')],{'as':'JscriptySessions','foreignKey':'VoiceQueueId'});db['VoiceQueue']['belongsTo'](db[_0xa18c('0x2e')],{'as':_0xa18c('0x2e'),'foreignKey':_0xa18c('0x14b')});db['VoiceQueue'][_0xa18c('0x11b')](db[_0xa18c('0x2e')],{'as':'TrunkBackup','foreignKey':_0xa18c('0x14c')});db[_0xa18c('0x1e')][_0xa18c('0x11b')](db['Interval'],{'as':_0xa18c('0x14d'),'foreignKey':_0xa18c('0x14e')});db['VoiceQueue'][_0xa18c('0x11b')](db[_0xa18c('0x85')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0xa18c('0x1e')][_0xa18c('0x11d')](db[_0xa18c('0x122')],{'as':_0xa18c('0x123'),'through':_0xa18c('0x14f')});db[_0xa18c('0x1e')][_0xa18c('0x11d')](db[_0xa18c('0x14')],{'as':'Agents','through':_0xa18c('0x32')});db[_0xa18c('0x1e')][_0xa18c('0x11d')](db[_0xa18c('0x125')],{'as':'Teams','through':'TeamVoiceQueue'});db[_0xa18c('0x1e')][_0xa18c('0x11d')](db[_0xa18c('0x122')],{'as':_0xa18c('0x150'),'through':_0xa18c('0x151')});db[_0xa18c('0x20')][_0xa18c('0x11b')](db['User'],{'as':_0xa18c('0x14'),'foreignKey':_0xa18c('0x10c')});db['ScreenRecording'][_0xa18c('0x11b')](db['User'],{'as':_0xa18c('0x14'),'foreignKey':'UserId'});db[_0xa18c('0x24')][_0xa18c('0x10e')](db['VoiceMailMessage'],{'as':'Messages','onDelete':'cascade','foreignKey':_0xa18c('0x152'),'sourceKey':'mailbox'});db[_0xa18c('0x25')][_0xa18c('0x11b')](db['VoiceMail'],{'foreignKey':'mailboxuser','targetKey':_0xa18c('0x153')});db[_0xa18c('0x27')][_0xa18c('0x10e')](db[_0xa18c('0x154')],{'as':_0xa18c('0x155'),'foreignKey':_0xa18c('0x156'),'constraints':![]});db[_0xa18c('0x27')][_0xa18c('0x10e')](db['VoiceAgentReport'],{'as':_0xa18c('0x157'),'foreignKey':'uniqueid','constraints':![]});db['VoiceCallReport'][_0xa18c('0x11b')](db[_0xa18c('0x14')],{'as':_0xa18c('0x14'),'foreignKey':_0xa18c('0x10c')});db[_0xa18c('0x27')][_0xa18c('0x11b')](db['CmContact'],{'as':_0xa18c('0x158'),'foreignKey':_0xa18c('0x159')});db[_0xa18c('0x15a')][_0xa18c('0x11b')](db[_0xa18c('0x40')],{'as':_0xa18c('0x40'),'foreignKey':_0xa18c('0x15b')});db['MailServerIn'][_0xa18c('0x11b')](db[_0xa18c('0x15c')],{'as':'CloudProvider','foreignKey':_0xa18c('0x15d'),'onDelete':_0xa18c('0x15e')});db[_0xa18c('0x3e')]['belongsTo'](db[_0xa18c('0x40')],{'as':_0xa18c('0x40'),'foreignKey':_0xa18c('0x15b')});db[_0xa18c('0x3e')][_0xa18c('0x11b')](db['CloudProvider'],{'as':'CloudProvider','foreignKey':_0xa18c('0x15d'),'onDelete':_0xa18c('0x15e')});db[_0xa18c('0x40')]['hasOne'](db[_0xa18c('0x15a')],{'as':_0xa18c('0x15f'),'onDelete':_0xa18c('0x10d')});db[_0xa18c('0x40')][_0xa18c('0x10b')](db[_0xa18c('0x3e')],{'as':_0xa18c('0x160'),'onDelete':'cascade'});db[_0xa18c('0x40')]['hasMany'](db[_0xa18c('0x161')],{'as':_0xa18c('0x162'),'foreignKey':_0xa18c('0x15b'),'onDelete':_0xa18c('0x10d')});db[_0xa18c('0x40')][_0xa18c('0x10e')](db[_0xa18c('0x163')],{'as':'Answers','foreignKey':_0xa18c('0x15b')});db[_0xa18c('0x40')][_0xa18c('0x10e')](db[_0xa18c('0x47')],{'as':'Messages','foreignKey':'MailAccountId'});db[_0xa18c('0x40')]['hasMany'](db[_0xa18c('0x45')],{'as':_0xa18c('0x164')});db[_0xa18c('0x40')][_0xa18c('0x10e')](db['MailApplication'],{'as':_0xa18c('0x142')});db['MailAccount']['belongsTo'](db['CmList'],{'as':_0xa18c('0x165'),'foreignKey':_0xa18c('0x166')});db[_0xa18c('0x40')][_0xa18c('0x11b')](db[_0xa18c('0x8f')],{'as':'Template','foreignKey':'TemplateId'});db[_0xa18c('0x40')][_0xa18c('0x11b')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0xa18c('0x167')});db[_0xa18c('0x40')][_0xa18c('0x11d')](db[_0xa18c('0x14')],{'as':'Agents','through':_0xa18c('0x13a')});db[_0xa18c('0x42')]['belongsToMany'](db['User'],{'as':_0xa18c('0x168'),'through':_0xa18c('0x34')});db[_0xa18c('0x42')][_0xa18c('0x11d')](db[_0xa18c('0x125')],{'through':_0xa18c('0x169'),'as':_0xa18c('0x16a')});db[_0xa18c('0x45')]['hasMany'](db[_0xa18c('0x47')],{'as':'Messages','onDelete':'cascade','foreignKey':_0xa18c('0x16b')});db[_0xa18c('0x45')]['belongsTo'](db[_0xa18c('0x40')],{'as':'Account','foreignKey':_0xa18c('0x15b')});db[_0xa18c('0x45')][_0xa18c('0x11b')](db[_0xa18c('0x76')],{'as':'Contact','foreignKey':_0xa18c('0x159')});db['MailInteraction']['belongsTo'](db['User'],{'as':'Owner','foreignKey':_0xa18c('0x10c')});db[_0xa18c('0x45')][_0xa18c('0x11d')](db['Tag'],{'through':_0xa18c('0x16c'),'as':'Tags'});db[_0xa18c('0x45')][_0xa18c('0x11d')](db[_0xa18c('0x16d')],{'through':'mail_interaction_has_tags','as':_0xa18c('0x16e')});db[_0xa18c('0x45')][_0xa18c('0x11d')](db[_0xa18c('0x14')],{'as':_0xa18c('0x16f'),'through':_0xa18c('0x127'),'foreignKey':'MailInteractionId'});db[_0xa18c('0x47')][_0xa18c('0x10e')](db[_0xa18c('0xe7')],{'as':_0xa18c('0x170'),'onDelete':_0xa18c('0x10d')});db[_0xa18c('0x47')][_0xa18c('0x11b')](db[_0xa18c('0x14')],{'as':_0xa18c('0x14')});db[_0xa18c('0x47')][_0xa18c('0x11b')](db['CmContact'],{'onDelete':_0xa18c('0x10d'),'as':_0xa18c('0x158')});db['MailMessage'][_0xa18c('0x11b')](db[_0xa18c('0x45')],{'as':_0xa18c('0x171'),'foreignKey':'MailInteractionId'});db['MailMessage'][_0xa18c('0x11b')](db[_0xa18c('0x40')],{'as':_0xa18c('0x172'),'foreignKey':_0xa18c('0x15b')});db[_0xa18c('0x47')][_0xa18c('0x11b')](db[_0xa18c('0x67')],{'as':'ChatWebsite','foreignKey':_0xa18c('0x173')});db['MailMessage'][_0xa18c('0x11b')](db[_0xa18c('0x6f')],{'as':_0xa18c('0x6f'),'foreignKey':'ChatOfflineMessageId'});db[_0xa18c('0x48')][_0xa18c('0x11b')](db[_0xa18c('0x14')],{'onDelete':_0xa18c('0x15e')});db[_0xa18c('0x48')]['belongsTo'](db[_0xa18c('0x42')],{'onDelete':_0xa18c('0x15e')});db[_0xa18c('0x48')][_0xa18c('0x11b')](db['MailAccount'],{'onDelete':_0xa18c('0x15e')});db['MailApplication'][_0xa18c('0x11b')](db[_0xa18c('0x14d')],{'onDelete':'restrict','foreignKey':_0xa18c('0x14e')});db[_0xa18c('0x48')][_0xa18c('0x11b')](db[_0xa18c('0x16d')],{'onDelete':'restrict','foreignKey':_0xa18c('0x174')});db[_0xa18c('0x49')]['belongsTo'](db[_0xa18c('0x40')],{});db[_0xa18c('0x49')][_0xa18c('0x11b')](db['CmList'],{'as':_0xa18c('0x165'),'foreignKey':_0xa18c('0x166')});db[_0xa18c('0x49')][_0xa18c('0x11b')](db[_0xa18c('0x76')],{'as':_0xa18c('0x158'),'foreignKey':'ContactId'});db[_0xa18c('0x49')][_0xa18c('0x11b')](db[_0xa18c('0x45')],{});db[_0xa18c('0x49')][_0xa18c('0x11b')](db[_0xa18c('0x47')],{});db[_0xa18c('0x49')]['belongsTo'](db['User'],{});db[_0xa18c('0x49')]['belongsTo'](db['MailQueue'],{});db[_0xa18c('0x4b')][_0xa18c('0x10e')](db[_0xa18c('0x4d')],{'as':_0xa18c('0x175'),'onDelete':'cascade'});db['FaxAccount'][_0xa18c('0x10e')](db[_0xa18c('0x161')],{'as':_0xa18c('0x162'),'foreignKey':_0xa18c('0x176'),'onDelete':'cascade'});db[_0xa18c('0x136')][_0xa18c('0x10e')](db[_0xa18c('0x163')],{'as':'Answers','foreignKey':_0xa18c('0x176')});db[_0xa18c('0x136')][_0xa18c('0x10e')](db[_0xa18c('0x52')],{'as':_0xa18c('0x164')});db[_0xa18c('0x136')]['hasMany'](db['FaxApplication'],{'as':_0xa18c('0x142')});db[_0xa18c('0x136')][_0xa18c('0x10e')](db[_0xa18c('0x110')],{'as':_0xa18c('0x177'),'onDelete':'cascade'});db[_0xa18c('0x136')][_0xa18c('0x10e')](db[_0xa18c('0x54')],{'as':_0xa18c('0x178')});db[_0xa18c('0x136')]['belongsTo'](db['Trunk'],{'as':_0xa18c('0x2e')});db[_0xa18c('0x136')][_0xa18c('0x11b')](db[_0xa18c('0x122')],{'as':_0xa18c('0x165'),'foreignKey':_0xa18c('0x166')});db[_0xa18c('0x136')]['belongsTo'](db[_0xa18c('0x85')],{'as':_0xa18c('0x179'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xa18c('0x136')][_0xa18c('0x11d')](db['User'],{'as':_0xa18c('0x168'),'through':_0xa18c('0x138')});db[_0xa18c('0x50')][_0xa18c('0x11b')](db['User'],{'onDelete':'restrict'});db[_0xa18c('0x50')][_0xa18c('0x11b')](db['FaxQueue'],{'onDelete':'restrict'});db[_0xa18c('0x50')][_0xa18c('0x11b')](db['FaxAccount'],{'onDelete':_0xa18c('0x15e')});db['FaxApplication'][_0xa18c('0x11b')](db[_0xa18c('0x16d')],{'onDelete':_0xa18c('0x15e'),'foreignKey':'TagId'});db[_0xa18c('0x52')][_0xa18c('0x10e')](db[_0xa18c('0x54')],{'as':_0xa18c('0x178'),'onDelete':_0xa18c('0x10d'),'foreignKey':'FaxInteractionId'});db[_0xa18c('0x52')][_0xa18c('0x11b')](db[_0xa18c('0x136')],{'as':_0xa18c('0x172'),'foreignKey':'FaxAccountId'});db[_0xa18c('0x52')][_0xa18c('0x11b')](db[_0xa18c('0x76')],{'as':'Contact','foreignKey':_0xa18c('0x159')});db[_0xa18c('0x52')][_0xa18c('0x11b')](db['User'],{'as':_0xa18c('0x17a'),'foreignKey':'UserId'});db[_0xa18c('0x52')][_0xa18c('0x11d')](db['Tag'],{'through':'fax_interaction_has_tags','as':'Tags'});db[_0xa18c('0x52')][_0xa18c('0x11d')](db['Tag'],{'through':_0xa18c('0x17b'),'as':_0xa18c('0x16e')});db[_0xa18c('0x52')][_0xa18c('0x11d')](db[_0xa18c('0x14')],{'as':_0xa18c('0x16f'),'through':'user_has_fax_interactions','foreignKey':_0xa18c('0x17c')});db['FaxMessage']['belongsTo'](db[_0xa18c('0x14')],{'onDelete':_0xa18c('0x10d'),'as':_0xa18c('0x14')});db[_0xa18c('0x54')][_0xa18c('0x11b')](db['FaxInteraction'],{'as':_0xa18c('0x171'),'foreignKey':'FaxInteractionId'});db[_0xa18c('0x54')][_0xa18c('0x11b')](db[_0xa18c('0x76')],{'onDelete':_0xa18c('0x10d'),'as':_0xa18c('0x158')});db[_0xa18c('0x54')]['belongsTo'](db[_0xa18c('0xe7')],{'as':_0xa18c('0xe7'),'foreignKey':_0xa18c('0x17d')});db[_0xa18c('0x54')][_0xa18c('0x11b')](db[_0xa18c('0x136')],{'as':_0xa18c('0x172'),'foreignKey':_0xa18c('0x176')});db[_0xa18c('0x130')][_0xa18c('0x11d')](db[_0xa18c('0x14')],{'as':_0xa18c('0x168'),'through':_0xa18c('0x36')});db['FaxQueue'][_0xa18c('0x11d')](db[_0xa18c('0x125')],{'through':'team_has_fax_queues','as':'Teams'});db[_0xa18c('0x17e')][_0xa18c('0x11b')](db[_0xa18c('0x136')],{});db['FaxQueueReport']['belongsTo'](db[_0xa18c('0x122')],{'as':_0xa18c('0x165'),'foreignKey':'ListId'});db[_0xa18c('0x17e')][_0xa18c('0x11b')](db[_0xa18c('0x76')],{'as':_0xa18c('0x158'),'foreignKey':_0xa18c('0x159')});db[_0xa18c('0x17e')][_0xa18c('0x11b')](db['FaxInteraction'],{});db['FaxQueueReport']['belongsTo'](db[_0xa18c('0x54')],{});db[_0xa18c('0x17e')][_0xa18c('0x11b')](db[_0xa18c('0x14')],{});db[_0xa18c('0x17e')]['belongsTo'](db[_0xa18c('0x130')],{});db['SmsAccount']['hasMany'](db['Disposition'],{'as':_0xa18c('0x162'),'foreignKey':_0xa18c('0x17f'),'onDelete':'cascade'});db[_0xa18c('0x56')][_0xa18c('0x10e')](db['CannedAnswer'],{'as':'Answers','foreignKey':'SmsAccountId'});db[_0xa18c('0x56')][_0xa18c('0x10e')](db[_0xa18c('0x180')],{'as':_0xa18c('0x178'),'foreignKey':_0xa18c('0x17f')});db[_0xa18c('0x56')][_0xa18c('0x10e')](db[_0xa18c('0x5a')],{'as':'Interactions'});db[_0xa18c('0x56')][_0xa18c('0x10e')](db[_0xa18c('0x58')],{'as':_0xa18c('0x142')});db[_0xa18c('0x56')][_0xa18c('0x11b')](db[_0xa18c('0x122')],{'as':_0xa18c('0x165'),'foreignKey':_0xa18c('0x166')});db[_0xa18c('0x56')][_0xa18c('0x11b')](db[_0xa18c('0x85')],{'as':_0xa18c('0x179'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xa18c('0x56')][_0xa18c('0x11d')](db['User'],{'as':_0xa18c('0x168'),'through':'user_has_sms_accounts'});db[_0xa18c('0x58')][_0xa18c('0x11b')](db[_0xa18c('0x14')],{'onDelete':_0xa18c('0x15e')});db[_0xa18c('0x58')][_0xa18c('0x11b')](db[_0xa18c('0x5d')],{'onDelete':_0xa18c('0x15e')});db[_0xa18c('0x58')][_0xa18c('0x11b')](db[_0xa18c('0x56')],{'onDelete':_0xa18c('0x15e')});db[_0xa18c('0x58')][_0xa18c('0x11b')](db[_0xa18c('0x14d')],{'onDelete':'restrict','foreignKey':_0xa18c('0x14e')});db[_0xa18c('0x58')][_0xa18c('0x11b')](db[_0xa18c('0x16d')],{'onDelete':'restrict','foreignKey':'TagId'});db['SmsInteraction'][_0xa18c('0x10e')](db[_0xa18c('0x180')],{'as':'Messages','onDelete':'cascade','foreignKey':_0xa18c('0x181')});db['SmsInteraction'][_0xa18c('0x11b')](db[_0xa18c('0x56')],{'as':_0xa18c('0x172'),'foreignKey':_0xa18c('0x17f')});db[_0xa18c('0x5a')][_0xa18c('0x11b')](db[_0xa18c('0x76')],{'as':_0xa18c('0x158'),'foreignKey':_0xa18c('0x159')});db['SmsInteraction']['belongsTo'](db[_0xa18c('0x14')],{'as':_0xa18c('0x17a'),'foreignKey':_0xa18c('0x10c')});db['SmsInteraction']['belongsToMany'](db[_0xa18c('0x16d')],{'through':_0xa18c('0x182'),'as':'Tags'});db[_0xa18c('0x5a')][_0xa18c('0x11d')](db[_0xa18c('0x16d')],{'through':_0xa18c('0x182'),'as':_0xa18c('0x16e')});db[_0xa18c('0x5a')][_0xa18c('0x11d')](db[_0xa18c('0x14')],{'as':_0xa18c('0x16f'),'through':_0xa18c('0x12a'),'foreignKey':_0xa18c('0x181')});db[_0xa18c('0x180')][_0xa18c('0x11b')](db[_0xa18c('0x14')],{'as':_0xa18c('0x14')});db['SmsMessage'][_0xa18c('0x11b')](db[_0xa18c('0x76')],{'onDelete':'cascade','as':_0xa18c('0x158')});db[_0xa18c('0x180')][_0xa18c('0x11b')](db[_0xa18c('0x5a')],{'onDelete':_0xa18c('0x10d'),'as':'Interaction','foreignKey':_0xa18c('0x181')});db['SmsMessage'][_0xa18c('0x11b')](db[_0xa18c('0x56')],{'as':_0xa18c('0x172'),'foreignKey':_0xa18c('0x17f')});db[_0xa18c('0x5d')][_0xa18c('0x11d')](db[_0xa18c('0x14')],{'as':_0xa18c('0x168'),'through':_0xa18c('0x37'),'foreignKey':'SmsQueueId'});db['SmsQueue'][_0xa18c('0x11d')](db[_0xa18c('0x125')],{'through':_0xa18c('0x183'),'as':'Teams'});db[_0xa18c('0x5f')][_0xa18c('0x10e')](db[_0xa18c('0x161')],{'as':_0xa18c('0x162'),'foreignKey':_0xa18c('0x184'),'onDelete':_0xa18c('0x10d')});db[_0xa18c('0x5f')][_0xa18c('0x10e')](db[_0xa18c('0x163')],{'as':'Answers','foreignKey':_0xa18c('0x184')});db[_0xa18c('0x5f')][_0xa18c('0x10e')](db[_0xa18c('0x12b')],{'as':_0xa18c('0x164'),'foreignKey':_0xa18c('0x184')});db[_0xa18c('0x5f')][_0xa18c('0x10e')](db[_0xa18c('0x64')],{'as':_0xa18c('0x178'),'foreignKey':_0xa18c('0x184')});db[_0xa18c('0x5f')][_0xa18c('0x10e')](db[_0xa18c('0x61')],{'as':_0xa18c('0x142'),'foreignKey':_0xa18c('0x184')});db[_0xa18c('0x5f')]['belongsTo'](db[_0xa18c('0x122')],{'as':'List','foreignKey':_0xa18c('0x166')});db[_0xa18c('0x5f')][_0xa18c('0x11b')](db[_0xa18c('0x85')],{'as':_0xa18c('0x179'),'foreignKey':_0xa18c('0x167')});db[_0xa18c('0x5f')][_0xa18c('0x11d')](db[_0xa18c('0x14')],{'as':'Agents','through':_0xa18c('0x13b')});db[_0xa18c('0x61')][_0xa18c('0x11b')](db[_0xa18c('0x14')],{'onDelete':_0xa18c('0x15e')});db[_0xa18c('0x61')][_0xa18c('0x11b')](db[_0xa18c('0x66')],{'onDelete':_0xa18c('0x15e'),'foreignKey':_0xa18c('0x185')});db['OpenchannelApplication'][_0xa18c('0x11b')](db[_0xa18c('0x5f')],{'onDelete':_0xa18c('0x15e'),'foreignKey':_0xa18c('0x184')});db['OpenchannelApplication'][_0xa18c('0x11b')](db[_0xa18c('0x14d')],{'onDelete':_0xa18c('0x15e'),'foreignKey':_0xa18c('0x14e')});db[_0xa18c('0x61')][_0xa18c('0x11b')](db[_0xa18c('0x16d')],{'onDelete':'restrict','foreignKey':_0xa18c('0x174')});db[_0xa18c('0x12b')][_0xa18c('0x10e')](db['OpenchannelMessage'],{'as':'Messages','onDelete':_0xa18c('0x10d'),'foreignKey':'OpenchannelInteractionId'});db[_0xa18c('0x12b')][_0xa18c('0x11b')](db['OpenchannelAccount'],{'as':_0xa18c('0x172'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelInteraction'][_0xa18c('0x11b')](db[_0xa18c('0x76')],{'as':_0xa18c('0x158'),'foreignKey':'ContactId'});db[_0xa18c('0x12b')][_0xa18c('0x11b')](db['User'],{'as':_0xa18c('0x17a'),'foreignKey':_0xa18c('0x10c')});db[_0xa18c('0x12b')][_0xa18c('0x11d')](db[_0xa18c('0x16d')],{'through':_0xa18c('0x186'),'as':'Tags'});db['OpenchannelInteraction']['belongsToMany'](db['Tag'],{'through':_0xa18c('0x186'),'as':_0xa18c('0x16e')});db['OpenchannelInteraction'][_0xa18c('0x11d')](db[_0xa18c('0x14')],{'as':'Users','through':'user_has_openchannel_interactions','foreignKey':_0xa18c('0x187')});db[_0xa18c('0x64')][_0xa18c('0x11b')](db[_0xa18c('0x14')],{'onDelete':_0xa18c('0x10d'),'as':_0xa18c('0x14')});db[_0xa18c('0x64')][_0xa18c('0x11b')](db[_0xa18c('0x76')],{'onDelete':_0xa18c('0x10d'),'as':_0xa18c('0x158')});db[_0xa18c('0x64')][_0xa18c('0x11b')](db[_0xa18c('0x12b')],{'onDelete':_0xa18c('0x10d'),'as':_0xa18c('0x171'),'foreignKey':_0xa18c('0x187')});db[_0xa18c('0x64')][_0xa18c('0x11b')](db[_0xa18c('0xe7')],{'as':_0xa18c('0xe7'),'foreignKey':_0xa18c('0x17d')});db[_0xa18c('0x64')][_0xa18c('0x11b')](db[_0xa18c('0x5f')],{'as':'Account','foreignKey':_0xa18c('0x184')});db[_0xa18c('0x66')][_0xa18c('0x11d')](db['User'],{'as':'Agents','through':_0xa18c('0x39'),'foreignKey':_0xa18c('0x185')});db[_0xa18c('0x66')][_0xa18c('0x11d')](db[_0xa18c('0x125')],{'through':_0xa18c('0x188'),'as':_0xa18c('0x16a')});db[_0xa18c('0x67')][_0xa18c('0x10e')](db['Disposition'],{'as':_0xa18c('0x162'),'foreignKey':_0xa18c('0x173'),'onDelete':'cascade'});db[_0xa18c('0x67')][_0xa18c('0x10e')](db[_0xa18c('0x163')],{'as':_0xa18c('0x189'),'foreignKey':'ChatWebsiteId'});db[_0xa18c('0x67')][_0xa18c('0x10e')](db[_0xa18c('0x18a')],{'as':_0xa18c('0x18b')});db[_0xa18c('0x67')]['hasMany'](db[_0xa18c('0x6d')],{'as':_0xa18c('0x164')});db[_0xa18c('0x67')]['hasMany'](db[_0xa18c('0x6b')],{'as':_0xa18c('0x142')});db[_0xa18c('0x67')][_0xa18c('0x10e')](db[_0xa18c('0x18c')],{'as':_0xa18c('0x178')});db[_0xa18c('0x67')][_0xa18c('0x11b')](db['CmList'],{'as':_0xa18c('0x165'),'foreignKey':_0xa18c('0x166')});db[_0xa18c('0x67')][_0xa18c('0x11b')](db[_0xa18c('0x14d')],{'as':_0xa18c('0x14d'),'foreignKey':_0xa18c('0x14e')});db[_0xa18c('0x67')][_0xa18c('0x11b')](db['MailAccount'],{'as':_0xa18c('0x40'),'foreignKey':'MailAccountId'});db[_0xa18c('0x67')]['belongsTo'](db[_0xa18c('0x85')],{'as':'mandatoryDispositionPause','foreignKey':_0xa18c('0x167')});db[_0xa18c('0x67')][_0xa18c('0x11d')](db[_0xa18c('0x14')],{'as':_0xa18c('0x168'),'through':_0xa18c('0x135')});db['OpenchannelQueueReport'][_0xa18c('0x11b')](db[_0xa18c('0x5f')],{});db[_0xa18c('0x69')][_0xa18c('0x11b')](db['CmList'],{'as':'List','foreignKey':_0xa18c('0x166')});db[_0xa18c('0x69')][_0xa18c('0x11b')](db[_0xa18c('0x76')],{'as':_0xa18c('0x158'),'foreignKey':_0xa18c('0x159')});db[_0xa18c('0x69')]['belongsTo'](db[_0xa18c('0x12b')],{});db[_0xa18c('0x69')][_0xa18c('0x11b')](db[_0xa18c('0x64')],{});db[_0xa18c('0x69')]['belongsTo'](db['User'],{});db[_0xa18c('0x69')][_0xa18c('0x11b')](db[_0xa18c('0x66')],{});db[_0xa18c('0x6b')][_0xa18c('0x11b')](db['User'],{'as':_0xa18c('0x18d'),'foreignKey':_0xa18c('0x10c'),'onDelete':'restrict'});db[_0xa18c('0x6b')]['belongsTo'](db[_0xa18c('0x71')],{'as':_0xa18c('0x18e'),'foreignKey':_0xa18c('0x18f'),'onDelete':_0xa18c('0x15e')});db[_0xa18c('0x6b')]['belongsTo'](db[_0xa18c('0x67')],{'as':_0xa18c('0x190'),'foreignKey':'ChatWebsiteId','onDelete':'restrict'});db['ChatApplication'][_0xa18c('0x11b')](db[_0xa18c('0x16d')],{'onDelete':_0xa18c('0x15e'),'foreignKey':_0xa18c('0x174')});db['ChatInteraction'][_0xa18c('0x10e')](db['ChatMessage'],{'as':_0xa18c('0x178'),'onDelete':_0xa18c('0x10d'),'foreignKey':_0xa18c('0x191')});db[_0xa18c('0x6d')][_0xa18c('0x11b')](db[_0xa18c('0x67')],{'as':'Account','foreignKey':'ChatWebsiteId'});db['ChatInteraction'][_0xa18c('0x11b')](db[_0xa18c('0x76')],{'as':_0xa18c('0x158'),'foreignKey':_0xa18c('0x159')});db['ChatInteraction']['belongsTo'](db[_0xa18c('0x14')],{'as':_0xa18c('0x17a'),'foreignKey':_0xa18c('0x10c')});db['ChatInteraction']['belongsToMany'](db[_0xa18c('0x16d')],{'through':_0xa18c('0x192'),'as':_0xa18c('0x193')});db['ChatInteraction'][_0xa18c('0x11d')](db['Tag'],{'through':_0xa18c('0x192'),'as':_0xa18c('0x16e')});db[_0xa18c('0x6d')][_0xa18c('0x11d')](db['User'],{'as':_0xa18c('0x16f'),'through':_0xa18c('0x128'),'foreignKey':'ChatInteractionId'});db[_0xa18c('0x18c')][_0xa18c('0x11b')](db[_0xa18c('0x14')],{'onDelete':_0xa18c('0x10d'),'as':_0xa18c('0x14')});db[_0xa18c('0x18c')]['belongsTo'](db['CmContact'],{'onDelete':_0xa18c('0x10d'),'as':_0xa18c('0x158'),'foreignKey':_0xa18c('0x159')});db[_0xa18c('0x18c')][_0xa18c('0x11b')](db[_0xa18c('0x6d')],{'onDelete':'cascade','as':_0xa18c('0x171'),'foreignKey':'ChatInteractionId'});db[_0xa18c('0x18c')]['belongsTo'](db['Attachment'],{'as':_0xa18c('0xe7'),'foreignKey':_0xa18c('0x17d')});db[_0xa18c('0x18c')][_0xa18c('0x11b')](db[_0xa18c('0x67')],{'as':_0xa18c('0x172'),'foreignKey':_0xa18c('0x173')});db[_0xa18c('0x6f')][_0xa18c('0x10e')](db['Attachment'],{'as':'Attachments','foreignKey':_0xa18c('0x194'),'onDelete':_0xa18c('0x10d'),'hooks':!![]});db[_0xa18c('0x6f')][_0xa18c('0x11b')](db['CmContact'],{'onDelete':_0xa18c('0x10d'),'as':_0xa18c('0x158'),'foreignKey':'ContactId'});db[_0xa18c('0x6f')][_0xa18c('0x11b')](db['ChatWebsite'],{'as':_0xa18c('0x172'),'foreignKey':_0xa18c('0x173')});db[_0xa18c('0x71')]['belongsToMany'](db[_0xa18c('0x14')],{'as':'Agents','through':_0xa18c('0x33'),'hooks':!![]});db['ChatQueue'][_0xa18c('0x11d')](db[_0xa18c('0x125')],{'through':'team_has_chat_queues','as':_0xa18c('0x16a')});db['ChatGroup']['hasMany'](db[_0xa18c('0xd4')],{'as':_0xa18c('0x178'),'foreignKey':_0xa18c('0x195'),'onDelete':_0xa18c('0x10d')});db[_0xa18c('0x72')][_0xa18c('0x11d')](db[_0xa18c('0x14')],{'as':'Members','through':_0xa18c('0x11f')});db[_0xa18c('0x18a')][_0xa18c('0x11b')](db[_0xa18c('0x67')],{'as':_0xa18c('0x190'),'foreignKey':_0xa18c('0x173')});db[_0xa18c('0x196')][_0xa18c('0x10e')](db[_0xa18c('0x76')],{'as':_0xa18c('0x120'),'foreignKey':'CompanyId'});db[_0xa18c('0x76')][_0xa18c('0x10e')](db[_0xa18c('0x146')],{'as':_0xa18c('0x147'),'foreignKey':_0xa18c('0x159')});db[_0xa18c('0x76')][_0xa18c('0x10e')](db[_0xa18c('0x7a')],{'as':_0xa18c('0x112'),'foreignKey':'ContactId'});db[_0xa18c('0x76')][_0xa18c('0x10e')](db['CmHopperHistory'],{'as':'HopperHistories','foreignKey':_0xa18c('0x159')});db['CmContact']['hasMany'](db['ReportAgentPreview'],{'as':_0xa18c('0x7c'),'foreignKey':'ContactId'});db['CmContact'][_0xa18c('0x10e')](db[_0xa18c('0x14a')],{'as':'JscriptySessions','foreignKey':_0xa18c('0x159')});db[_0xa18c('0x76')][_0xa18c('0x10e')](db[_0xa18c('0x12b')],{'as':_0xa18c('0x12c'),'foreignKey':_0xa18c('0x159'),'onDelete':_0xa18c('0x15e')});db[_0xa18c('0x76')][_0xa18c('0x10e')](db[_0xa18c('0x6d')],{'as':'ChatInteractions','foreignKey':'ContactId','onDelete':_0xa18c('0x15e')});db[_0xa18c('0x76')][_0xa18c('0x10e')](db[_0xa18c('0x5a')],{'as':_0xa18c('0x116'),'foreignKey':_0xa18c('0x159'),'onDelete':'restrict'});db['CmContact'][_0xa18c('0x10e')](db[_0xa18c('0x52')],{'as':_0xa18c('0x117'),'foreignKey':'ContactId','onDelete':_0xa18c('0x15e')});db[_0xa18c('0x76')][_0xa18c('0x10e')](db['MailInteraction'],{'as':'MailInteractions','foreignKey':'ContactId','onDelete':'restrict'});db[_0xa18c('0x76')][_0xa18c('0x11b')](db[_0xa18c('0x196')],{'as':'Company','foreignKey':_0xa18c('0x197')});db[_0xa18c('0x76')][_0xa18c('0x11b')](db['CmList'],{'as':_0xa18c('0x165'),'foreignKey':'ListId','onDelete':_0xa18c('0x10d')});db['CmContact']['belongsToMany'](db[_0xa18c('0x14')],{'as':_0xa18c('0x16f'),'through':_0xa18c('0x121')});db[_0xa18c('0x76')][_0xa18c('0x11d')](db[_0xa18c('0x16d')],{'as':'Tags','through':_0xa18c('0x198')});db[_0xa18c('0x76')][_0xa18c('0x11d')](db[_0xa18c('0x16d')],{'through':_0xa18c('0x198'),'as':_0xa18c('0x16e')});db[_0xa18c('0x146')][_0xa18c('0x11b')](db[_0xa18c('0x76')],{'as':_0xa18c('0x158'),'foreignKey':_0xa18c('0x159'),'onDelete':_0xa18c('0x10d')});db[_0xa18c('0x146')][_0xa18c('0x11b')](db[_0xa18c('0x122')],{'as':_0xa18c('0x165'),'foreignKey':_0xa18c('0x166'),'onDelete':_0xa18c('0x10d')});db[_0xa18c('0x146')][_0xa18c('0x11b')](db[_0xa18c('0x14')],{'as':'Agent','foreignKey':_0xa18c('0x10c')});db['CmHopper'][_0xa18c('0x11b')](db['VoiceQueue'],{'as':'Queue','foreignKey':_0xa18c('0x145'),'onDelete':_0xa18c('0x10d')});db[_0xa18c('0x146')][_0xa18c('0x11b')](db['Campaign'],{'as':_0xa18c('0xe4'),'foreignKey':'CampaignId','onDelete':_0xa18c('0x10d')});db[_0xa18c('0x146')][_0xa18c('0x11b')](db['User'],{'as':_0xa18c('0x17a'),'foreignKey':'OwnerId'});db[_0xa18c('0x79')][_0xa18c('0x11b')](db[_0xa18c('0x76')],{'as':_0xa18c('0x158'),'foreignKey':_0xa18c('0x159'),'onDelete':_0xa18c('0x10d')});db['CmHopperBlack'][_0xa18c('0x11b')](db[_0xa18c('0x122')],{'as':_0xa18c('0x165'),'foreignKey':_0xa18c('0x166'),'onDelete':_0xa18c('0x10d')});db['CmHopperBlack'][_0xa18c('0x11b')](db['VoiceQueue'],{'as':'Queue','foreignKey':_0xa18c('0x145'),'onDelete':_0xa18c('0x10d')});db[_0xa18c('0x79')][_0xa18c('0x11b')](db[_0xa18c('0xe4')],{'as':_0xa18c('0xe4'),'foreignKey':_0xa18c('0x199'),'onDelete':_0xa18c('0x10d')});db['Automation']['hasMany'](db[_0xa18c('0x19a')],{'as':{'plural':_0xa18c('0x19b'),'singular':_0xa18c('0x19c')},'foreignKey':_0xa18c('0x19d'),'onDelete':_0xa18c('0x10d'),'hooks':!![]});db['Automation'][_0xa18c('0x10e')](db[_0xa18c('0x19a')],{'as':{'plural':'Any','singular':_0xa18c('0x19e')},'foreignKey':_0xa18c('0x19f'),'onDelete':_0xa18c('0x10d'),'hooks':!![]});db[_0xa18c('0x7f')][_0xa18c('0x10e')](db[_0xa18c('0x1a0')],{'as':_0xa18c('0x1a1'),'foreignKey':_0xa18c('0x1a2'),'onDelete':_0xa18c('0x10d'),'hooks':!![]});db[_0xa18c('0x161')]['hasMany'](db[_0xa18c('0x161')],{'as':_0xa18c('0x162'),'foreignKey':_0xa18c('0x1a3'),'onDelete':'cascade'});db[_0xa18c('0x14d')][_0xa18c('0x10e')](db[_0xa18c('0x14d')],{'as':_0xa18c('0x1a4'),'foreignKey':_0xa18c('0x14e'),'onDelete':'cascade','hooks':!![],'required':![]});db[_0xa18c('0x14d')][_0xa18c('0x10e')](db[_0xa18c('0x110')],{'as':_0xa18c('0x111'),'foreignKey':_0xa18c('0x14e'),'onDelete':_0xa18c('0x15e')});db[_0xa18c('0x14d')]['hasMany'](db['MailApplication'],{'as':_0xa18c('0x1a5'),'foreignKey':_0xa18c('0x14e')});db[_0xa18c('0x14d')]['hasMany'](db[_0xa18c('0x6b')],{'as':_0xa18c('0x1a6'),'foreignKey':_0xa18c('0x14e')});db[_0xa18c('0x14d')][_0xa18c('0x10e')](db[_0xa18c('0x50')],{'as':_0xa18c('0x1a7'),'foreignKey':_0xa18c('0x14e')});db[_0xa18c('0x14d')][_0xa18c('0x10e')](db[_0xa18c('0x58')],{'as':_0xa18c('0x1a8'),'foreignKey':_0xa18c('0x14e')});db[_0xa18c('0x8b')][_0xa18c('0x11b')](db[_0xa18c('0x40')],{});db[_0xa18c('0x8b')][_0xa18c('0x11b')](db[_0xa18c('0x99')],{'foreignKey':_0xa18c('0x1a9')});db[_0xa18c('0x8b')]['belongsTo'](db['AnalyticCustomReport'],{'foreignKey':_0xa18c('0x1aa')});db[_0xa18c('0x8d')][_0xa18c('0x11d')](db[_0xa18c('0x1c')],{'as':_0xa18c('0x1ab'),'through':_0xa18c('0x1ac'),'onDelete':'restrict'});db[_0xa18c('0x16d')][_0xa18c('0x11d')](db[_0xa18c('0x76')],{'through':_0xa18c('0x198')});db[_0xa18c('0x16d')]['belongsToMany'](db[_0xa18c('0x6d')],{'through':_0xa18c('0x192')});db['Tag'][_0xa18c('0x11d')](db[_0xa18c('0x45')],{'through':'mail_interaction_has_tags'});db[_0xa18c('0x16d')]['belongsToMany'](db[_0xa18c('0x5a')],{'through':_0xa18c('0x182')});db[_0xa18c('0x16d')][_0xa18c('0x11d')](db[_0xa18c('0x52')],{'through':_0xa18c('0x17b')});db['Tag']['belongsToMany'](db['OpenchannelInteraction'],{'through':_0xa18c('0x186')});db[_0xa18c('0x16d')][_0xa18c('0x11d')](db['WhatsappInteraction'],{'through':'whatsapp_interaction_has_tags'});db[_0xa18c('0x90')]['hasMany'](db[_0xa18c('0x19a')],{'as':{'plural':_0xa18c('0x1ad'),'singular':'AllCondition'},'foreignKey':_0xa18c('0x1ae'),'onDelete':_0xa18c('0x10d'),'hooks':!![]});db[_0xa18c('0x90')][_0xa18c('0x10e')](db[_0xa18c('0x19a')],{'as':{'plural':_0xa18c('0x1af'),'singular':'AnyCondition'},'foreignKey':_0xa18c('0x1b0'),'onDelete':_0xa18c('0x10d'),'hooks':!![]});db[_0xa18c('0x90')]['hasMany'](db['Action'],{'as':'Actions','foreignKey':'TriggerId','onDelete':_0xa18c('0x10d'),'hooks':!![]});db[_0xa18c('0x97')][_0xa18c('0x10e')](db[_0xa18c('0x9d')],{'as':_0xa18c('0x1b1'),'onDelete':'cascade','foreignKey':_0xa18c('0x1aa'),'hooks':!![]});db['AnalyticDefaultReport'][_0xa18c('0x10e')](db[_0xa18c('0x9d')],{'as':_0xa18c('0x1b1'),'onDelete':_0xa18c('0x10d'),'foreignKey':_0xa18c('0x1a9')});db[_0xa18c('0x9b')]['hasMany'](db[_0xa18c('0x9d')],{'as':_0xa18c('0x1b1'),'onDelete':'cascade','foreignKey':_0xa18c('0x1b2')});db[_0xa18c('0x9d')][_0xa18c('0x11b')](db[_0xa18c('0x9b')],{'foreignKey':_0xa18c('0x1b2')});db[_0xa18c('0xa0')][_0xa18c('0x10e')](db['SalesforceConfiguration'],{'as':_0xa18c('0x1b3'),'onDelete':_0xa18c('0x10d'),'foreignKey':'AccountId'});db[_0xa18c('0xa1')][_0xa18c('0x10e')](db['SalesforceField'],{'as':_0xa18c('0x1b4'),'onDelete':'cascade','foreignKey':_0xa18c('0x1b5')});db[_0xa18c('0xa1')][_0xa18c('0x10e')](db[_0xa18c('0xa3')],{'as':_0xa18c('0x1b6'),'onDelete':'cascade','foreignKey':_0xa18c('0x1b7')});db[_0xa18c('0xa1')][_0xa18c('0x10e')](db[_0xa18c('0xa3')],{'as':_0xa18c('0x1b1'),'onDelete':_0xa18c('0x10d'),'foreignKey':_0xa18c('0x1b8')});db[_0xa18c('0xa1')][_0xa18c('0x11b')](db[_0xa18c('0xa0')],{'as':_0xa18c('0x172'),'foreignKey':'AccountId'});db['SalesforceField']['hasMany'](db[_0xa18c('0xa3')],{'as':_0xa18c('0x1b9'),'foreignKey':_0xa18c('0x1b5')});db[_0xa18c('0xa3')][_0xa18c('0x10e')](db[_0xa18c('0xa3')],{'as':_0xa18c('0x1ba'),'foreignKey':_0xa18c('0x1b7')});db[_0xa18c('0xa3')][_0xa18c('0x10e')](db[_0xa18c('0xa3')],{'as':'Field','foreignKey':_0xa18c('0x1b8')});db[_0xa18c('0xa3')][_0xa18c('0x11b')](db[_0xa18c('0x92')],{'as':_0xa18c('0x92'),'foreignKey':_0xa18c('0x1bb')});db[_0xa18c('0x1bc')][_0xa18c('0x10e')](db[_0xa18c('0xa6')],{'as':_0xa18c('0x1b3'),'onDelete':_0xa18c('0x10d'),'foreignKey':_0xa18c('0x1bd')});db['SugarcrmConfiguration'][_0xa18c('0x10e')](db[_0xa18c('0xa8')],{'as':'Subjects','onDelete':'cascade','foreignKey':_0xa18c('0x1b5')});db[_0xa18c('0xa6')][_0xa18c('0x10e')](db[_0xa18c('0xa8')],{'as':_0xa18c('0x1b6'),'onDelete':_0xa18c('0x10d'),'foreignKey':_0xa18c('0x1b7')});db['SugarcrmConfiguration']['hasMany'](db[_0xa18c('0xa8')],{'as':'Fields','onDelete':'cascade','foreignKey':_0xa18c('0x1b8')});db[_0xa18c('0xa6')]['belongsTo'](db['SugarcrmAccount'],{'as':_0xa18c('0x172'),'foreignKey':_0xa18c('0x1bd')});db['SugarcrmField'][_0xa18c('0x10e')](db[_0xa18c('0xa8')],{'as':_0xa18c('0x1b9'),'foreignKey':_0xa18c('0x1b5')});db[_0xa18c('0xa8')][_0xa18c('0x10e')](db[_0xa18c('0xa8')],{'as':_0xa18c('0x1ba'),'foreignKey':_0xa18c('0x1b7')});db['SugarcrmField']['hasMany'](db[_0xa18c('0xa8')],{'as':'Field','foreignKey':_0xa18c('0x1b8')});db['SugarcrmField'][_0xa18c('0x11b')](db['Variable'],{'as':'Variable','foreignKey':_0xa18c('0x1bb')});db[_0xa18c('0xaa')][_0xa18c('0x10e')](db[_0xa18c('0xac')],{'as':_0xa18c('0x1b3'),'onDelete':_0xa18c('0x10d'),'foreignKey':'AccountId'});db['DeskConfiguration'][_0xa18c('0x10e')](db[_0xa18c('0xae')],{'as':'Subjects','onDelete':_0xa18c('0x10d'),'foreignKey':_0xa18c('0x1b5')});db[_0xa18c('0xac')][_0xa18c('0x10e')](db[_0xa18c('0xae')],{'as':_0xa18c('0x1b6'),'onDelete':_0xa18c('0x10d'),'foreignKey':_0xa18c('0x1b7')});db['DeskConfiguration'][_0xa18c('0x10e')](db[_0xa18c('0xae')],{'as':_0xa18c('0x1b1'),'onDelete':_0xa18c('0x10d'),'foreignKey':_0xa18c('0x1b8')});db[_0xa18c('0xac')]['belongsTo'](db['DeskAccount'],{'as':_0xa18c('0x172'),'foreignKey':_0xa18c('0x1bd')});db[_0xa18c('0xac')][_0xa18c('0x11d')](db[_0xa18c('0x16d')],{'through':_0xa18c('0x1be')});db[_0xa18c('0xae')][_0xa18c('0x10e')](db[_0xa18c('0xae')],{'as':_0xa18c('0x1b9'),'foreignKey':_0xa18c('0x1b5')});db[_0xa18c('0xae')]['hasMany'](db[_0xa18c('0xae')],{'as':_0xa18c('0x1ba'),'foreignKey':_0xa18c('0x1b7')});db[_0xa18c('0xae')][_0xa18c('0x10e')](db['DeskField'],{'as':'Field','foreignKey':_0xa18c('0x1b8')});db[_0xa18c('0xae')][_0xa18c('0x11b')](db[_0xa18c('0x92')],{'as':_0xa18c('0x92'),'foreignKey':_0xa18c('0x1bb')});db['ZohoAccount'][_0xa18c('0x10e')](db[_0xa18c('0xb1')],{'as':_0xa18c('0x1b3'),'onDelete':'cascade','foreignKey':'AccountId'});db['ZohoConfiguration']['hasMany'](db[_0xa18c('0xb3')],{'as':_0xa18c('0x1b4'),'onDelete':_0xa18c('0x10d'),'foreignKey':_0xa18c('0x1b5')});db[_0xa18c('0xb1')][_0xa18c('0x10e')](db[_0xa18c('0xb3')],{'as':_0xa18c('0x1b6'),'onDelete':'cascade','foreignKey':'DescriptionId'});db['ZohoConfiguration'][_0xa18c('0x10e')](db['ZohoField'],{'as':_0xa18c('0x1b1'),'onDelete':'cascade','foreignKey':_0xa18c('0x1b8')});db[_0xa18c('0xb1')][_0xa18c('0x11b')](db[_0xa18c('0x1bf')],{'as':'Account','foreignKey':_0xa18c('0x1bd')});db[_0xa18c('0xb3')]['hasMany'](db['ZohoField'],{'as':_0xa18c('0x1b9'),'foreignKey':_0xa18c('0x1b5')});db['ZohoField']['hasMany'](db[_0xa18c('0xb3')],{'as':_0xa18c('0x1ba'),'foreignKey':'DescriptionId'});db[_0xa18c('0xb3')]['hasMany'](db[_0xa18c('0xb3')],{'as':_0xa18c('0x1c0'),'foreignKey':_0xa18c('0x1b8')});db[_0xa18c('0xb3')][_0xa18c('0x11b')](db[_0xa18c('0x92')],{'as':_0xa18c('0x92'),'foreignKey':_0xa18c('0x1bb')});db[_0xa18c('0xb5')]['hasMany'](db[_0xa18c('0xb7')],{'as':_0xa18c('0x1b3'),'onDelete':_0xa18c('0x10d'),'foreignKey':'AccountId'});db['ZendeskConfiguration'][_0xa18c('0x10e')](db['ZendeskField'],{'as':_0xa18c('0x1b4'),'foreignKey':_0xa18c('0x1b5')});db['ZendeskConfiguration'][_0xa18c('0x10e')](db[_0xa18c('0xb9')],{'as':_0xa18c('0x1b6'),'foreignKey':_0xa18c('0x1b7')});db[_0xa18c('0xb7')][_0xa18c('0x10e')](db['ZendeskField'],{'as':'Fields','foreignKey':_0xa18c('0x1b8')});db[_0xa18c('0xb7')][_0xa18c('0x11b')](db[_0xa18c('0xb5')],{'as':'Account','foreignKey':_0xa18c('0x1bd')});db[_0xa18c('0xb7')]['belongsToMany'](db['Tag'],{'through':_0xa18c('0x1c1')});db['ZendeskField'][_0xa18c('0x10e')](db[_0xa18c('0xb9')],{'as':'Subject','foreignKey':_0xa18c('0x1b5')});db[_0xa18c('0xb9')][_0xa18c('0x10e')](db[_0xa18c('0xb9')],{'as':_0xa18c('0x1ba'),'foreignKey':_0xa18c('0x1b7')});db[_0xa18c('0xb9')]['hasMany'](db[_0xa18c('0xb9')],{'as':_0xa18c('0x1c0'),'foreignKey':_0xa18c('0x1b8')});db[_0xa18c('0xb9')][_0xa18c('0x11b')](db[_0xa18c('0x92')],{'as':_0xa18c('0x92'),'foreignKey':'VariableId'});db['FreshdeskAccount'][_0xa18c('0x10e')](db[_0xa18c('0xbd')],{'as':_0xa18c('0x1b3'),'onDelete':_0xa18c('0x10d'),'foreignKey':_0xa18c('0x1bd')});db['FreshdeskConfiguration'][_0xa18c('0x10e')](db[_0xa18c('0xbf')],{'as':_0xa18c('0x1b4'),'onDelete':'cascade','foreignKey':_0xa18c('0x1b5')});db[_0xa18c('0xbd')][_0xa18c('0x10e')](db[_0xa18c('0xbf')],{'as':_0xa18c('0x1b6'),'onDelete':_0xa18c('0x10d'),'foreignKey':_0xa18c('0x1b7')});db[_0xa18c('0xbd')]['hasMany'](db['FreshdeskField'],{'as':'Fields','onDelete':_0xa18c('0x10d'),'foreignKey':_0xa18c('0x1b8')});db[_0xa18c('0xbd')][_0xa18c('0x11b')](db[_0xa18c('0xbb')],{'as':_0xa18c('0x172'),'foreignKey':_0xa18c('0x1bd')});db['FreshdeskConfiguration'][_0xa18c('0x11d')](db[_0xa18c('0x16d')],{'through':_0xa18c('0x1c2')});db[_0xa18c('0xbf')][_0xa18c('0x10e')](db[_0xa18c('0xbf')],{'as':_0xa18c('0x1b9'),'foreignKey':_0xa18c('0x1b5')});db['FreshdeskField'][_0xa18c('0x10e')](db['FreshdeskField'],{'as':_0xa18c('0x1ba'),'foreignKey':_0xa18c('0x1b7')});db['FreshdeskField'][_0xa18c('0x10e')](db['FreshdeskField'],{'as':_0xa18c('0x1c0'),'foreignKey':_0xa18c('0x1b8')});db[_0xa18c('0xbf')][_0xa18c('0x11b')](db['Variable'],{'as':_0xa18c('0x92'),'foreignKey':_0xa18c('0x1bb')});db['VtigerAccount']['hasMany'](db[_0xa18c('0xc2')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0xa18c('0x1bd')});db[_0xa18c('0xc2')]['hasMany'](db[_0xa18c('0x1c3')],{'as':'Subjects','foreignKey':_0xa18c('0x1b5')});db[_0xa18c('0xc2')][_0xa18c('0x10e')](db['VtigerField'],{'as':_0xa18c('0x1b6'),'foreignKey':_0xa18c('0x1b7')});db[_0xa18c('0xc2')][_0xa18c('0x10e')](db[_0xa18c('0x1c3')],{'as':'Fields','foreignKey':_0xa18c('0x1b8')});db[_0xa18c('0xc2')][_0xa18c('0x11b')](db['VtigerAccount'],{'as':_0xa18c('0x172'),'foreignKey':'AccountId'});db[_0xa18c('0x1c3')][_0xa18c('0x10e')](db[_0xa18c('0x1c3')],{'as':_0xa18c('0x1b9'),'foreignKey':_0xa18c('0x1b5')});db[_0xa18c('0x1c3')]['hasMany'](db[_0xa18c('0x1c3')],{'as':_0xa18c('0x1ba'),'foreignKey':_0xa18c('0x1b7')});db[_0xa18c('0x1c3')][_0xa18c('0x10e')](db['VtigerField'],{'as':_0xa18c('0x1c0'),'foreignKey':'FieldId'});db[_0xa18c('0x1c3')][_0xa18c('0x11b')](db[_0xa18c('0x92')],{'as':_0xa18c('0x92'),'foreignKey':'VariableId'});db[_0xa18c('0xc5')]['hasMany'](db[_0xa18c('0xc6')],{'as':'Configurations','onDelete':_0xa18c('0x10d'),'foreignKey':_0xa18c('0x1bd')});db[_0xa18c('0xc6')][_0xa18c('0x10e')](db[_0xa18c('0x1c4')],{'as':_0xa18c('0x1b4'),'foreignKey':'SubjectId'});db[_0xa18c('0xc6')][_0xa18c('0x10e')](db[_0xa18c('0x1c4')],{'as':_0xa18c('0x1b6'),'foreignKey':_0xa18c('0x1b7')});db[_0xa18c('0xc6')][_0xa18c('0x10e')](db[_0xa18c('0x1c4')],{'as':_0xa18c('0x1b1'),'foreignKey':_0xa18c('0x1b8')});db[_0xa18c('0xc6')][_0xa18c('0x11b')](db['ServicenowAccount'],{'as':'Account','foreignKey':_0xa18c('0x1bd')});db[_0xa18c('0x1c4')][_0xa18c('0x10e')](db['ServicenowField'],{'as':_0xa18c('0x1b9'),'foreignKey':'SubjectId'});db[_0xa18c('0x1c4')][_0xa18c('0x10e')](db['ServicenowField'],{'as':_0xa18c('0x1ba'),'foreignKey':'DescriptionId'});db[_0xa18c('0x1c4')][_0xa18c('0x10e')](db['ServicenowField'],{'as':_0xa18c('0x1c0'),'foreignKey':_0xa18c('0x1b8')});db[_0xa18c('0x1c4')][_0xa18c('0x11b')](db[_0xa18c('0x92')],{'as':'Variable','foreignKey':_0xa18c('0x1bb')});db[_0xa18c('0x1c5')][_0xa18c('0x10e')](db[_0xa18c('0xca')],{'as':'Configurations','onDelete':_0xa18c('0x10d'),'foreignKey':_0xa18c('0x1bd')});db[_0xa18c('0x1c5')][_0xa18c('0x11b')](db[_0xa18c('0x15c')],{'as':_0xa18c('0x15c'),'foreignKey':_0xa18c('0x15d')});db[_0xa18c('0xca')][_0xa18c('0x10e')](db[_0xa18c('0xcc')],{'as':_0xa18c('0x1b4'),'onDelete':'cascade','foreignKey':_0xa18c('0x1b5')});db['Dynamics365Configuration'][_0xa18c('0x10e')](db[_0xa18c('0xcc')],{'as':_0xa18c('0x1b6'),'onDelete':_0xa18c('0x10d'),'foreignKey':'DescriptionId'});db[_0xa18c('0xca')]['hasMany'](db['Dynamics365Field'],{'as':_0xa18c('0x1b1'),'onDelete':_0xa18c('0x10d'),'foreignKey':_0xa18c('0x1b8')});db[_0xa18c('0xca')][_0xa18c('0x11b')](db[_0xa18c('0x1c5')],{'as':_0xa18c('0x172'),'foreignKey':_0xa18c('0x1bd')});db['Dynamics365Field'][_0xa18c('0x10e')](db[_0xa18c('0xcc')],{'as':_0xa18c('0x1b9'),'foreignKey':'SubjectId'});db[_0xa18c('0xcc')][_0xa18c('0x10e')](db[_0xa18c('0xcc')],{'as':_0xa18c('0x1ba'),'foreignKey':_0xa18c('0x1b7')});db['Dynamics365Field']['hasMany'](db['Dynamics365Field'],{'as':_0xa18c('0x1c0'),'foreignKey':_0xa18c('0x1b8')});db[_0xa18c('0xcc')][_0xa18c('0x11b')](db[_0xa18c('0x92')],{'as':_0xa18c('0x92'),'foreignKey':_0xa18c('0x1bb')});db['FreshsalesAccount'][_0xa18c('0x10e')](db[_0xa18c('0x1c6')],{'as':_0xa18c('0x1b3'),'onDelete':'cascade','foreignKey':_0xa18c('0x1bd')});db[_0xa18c('0x1c6')][_0xa18c('0x10e')](db[_0xa18c('0xd1')],{'as':_0xa18c('0x1b4'),'foreignKey':_0xa18c('0x1b5')});db[_0xa18c('0x1c6')][_0xa18c('0x10e')](db[_0xa18c('0xd1')],{'as':_0xa18c('0x1b6'),'foreignKey':_0xa18c('0x1b7')});db[_0xa18c('0x1c6')][_0xa18c('0x10e')](db['FreshsalesField'],{'as':_0xa18c('0x1b1'),'foreignKey':'FieldId'});db[_0xa18c('0x1c6')][_0xa18c('0x11b')](db['FreshsalesAccount'],{'as':_0xa18c('0x172'),'foreignKey':'AccountId'});db['FreshsalesField'][_0xa18c('0x10e')](db['FreshsalesField'],{'as':_0xa18c('0x1b9'),'foreignKey':_0xa18c('0x1b5')});db[_0xa18c('0xd1')][_0xa18c('0x10e')](db[_0xa18c('0xd1')],{'as':_0xa18c('0x1ba'),'foreignKey':_0xa18c('0x1b7')});db[_0xa18c('0xd1')][_0xa18c('0x10e')](db[_0xa18c('0xd1')],{'as':_0xa18c('0x1c0'),'foreignKey':_0xa18c('0x1b8')});db['FreshsalesField'][_0xa18c('0x11b')](db[_0xa18c('0x92')],{'as':_0xa18c('0x92'),'foreignKey':'VariableId'});db[_0xa18c('0x1c7')][_0xa18c('0x11b')](db[_0xa18c('0x67')],{});db[_0xa18c('0x1c7')][_0xa18c('0x11b')](db[_0xa18c('0x122')],{'as':'List','foreignKey':_0xa18c('0x166')});db['ChatQueueReport'][_0xa18c('0x11b')](db[_0xa18c('0x76')],{'as':'Contact','foreignKey':_0xa18c('0x159')});db[_0xa18c('0x1c7')][_0xa18c('0x11b')](db[_0xa18c('0x6d')],{});db[_0xa18c('0x1c7')][_0xa18c('0x11b')](db[_0xa18c('0x18c')],{});db[_0xa18c('0x1c7')][_0xa18c('0x11b')](db[_0xa18c('0x14')],{});db['ChatQueueReport'][_0xa18c('0x11b')](db['ChatQueue'],{});db[_0xa18c('0xd4')]['belongsTo'](db[_0xa18c('0x14')],{'onDelete':'cascade','foreignKey':_0xa18c('0x1c8')});db[_0xa18c('0xd4')]['belongsTo'](db[_0xa18c('0x14')],{'onDelete':_0xa18c('0x10d'),'foreignKey':_0xa18c('0x1c9')});db[_0xa18c('0x14a')][_0xa18c('0x10e')](db[_0xa18c('0x1ca')],{'foreignKey':_0xa18c('0x1cb'),'onDelete':'cascade'});db['JscriptySessionReport']['hasMany'](db[_0xa18c('0xd5')],{'foreignKey':_0xa18c('0x1cb'),'onDelete':'cascade'});db['SmsQueueReport'][_0xa18c('0x11b')](db['SmsAccount'],{});db['SmsQueueReport']['belongsTo'](db['CmList'],{'as':_0xa18c('0x165'),'foreignKey':_0xa18c('0x166')});db[_0xa18c('0xd7')][_0xa18c('0x11b')](db['CmContact'],{'as':'Contact','foreignKey':_0xa18c('0x159')});db[_0xa18c('0xd7')][_0xa18c('0x11b')](db[_0xa18c('0x5a')],{});db[_0xa18c('0xd7')][_0xa18c('0x11b')](db['SmsMessage'],{});db[_0xa18c('0xd7')][_0xa18c('0x11b')](db[_0xa18c('0x14')],{});db[_0xa18c('0xd7')][_0xa18c('0x11b')](db[_0xa18c('0x5d')],{});db[_0xa18c('0x1cc')][_0xa18c('0x10e')](db[_0xa18c('0x14a')],{'foreignKey':'ProjectId'});db['JscriptyProject'][_0xa18c('0x10e')](db['JscriptyQuestionReport'],{'foreignKey':_0xa18c('0x1cd')});db[_0xa18c('0x1cc')][_0xa18c('0x10e')](db[_0xa18c('0xd5')],{'foreignKey':_0xa18c('0x1cd')});db[_0xa18c('0xdd')]['belongsToMany'](db['User'],{'as':_0xa18c('0x16f'),'through':_0xa18c('0x13f')});db[_0xa18c('0x125')][_0xa18c('0x11d')](db['User'],{'as':'Agents','through':_0xa18c('0x126')});db[_0xa18c('0x125')][_0xa18c('0x11d')](db['VoiceQueue'],{'through':_0xa18c('0x105'),'as':'VoiceQueues'});db['Team'][_0xa18c('0x11d')](db[_0xa18c('0x42')],{'through':'team_has_mail_queues','as':_0xa18c('0x12e')});db[_0xa18c('0x125')]['belongsToMany'](db[_0xa18c('0x71')],{'through':_0xa18c('0x1ce'),'as':'ChatQueues'});db['Team'][_0xa18c('0x11d')](db[_0xa18c('0x130')],{'through':_0xa18c('0x1cf'),'as':_0xa18c('0x131')});db['Team'][_0xa18c('0x11d')](db[_0xa18c('0x5d')],{'through':_0xa18c('0x183'),'as':_0xa18c('0x132')});db[_0xa18c('0x125')]['belongsToMany'](db[_0xa18c('0x66')],{'through':_0xa18c('0x188'),'as':_0xa18c('0x133')});db[_0xa18c('0x125')][_0xa18c('0x11d')](db[_0xa18c('0x102')],{'through':_0xa18c('0x1d0'),'as':_0xa18c('0x134')});db[_0xa18c('0x125')][_0xa18c('0x11d')](db[_0xa18c('0xf2')],{'through':_0xa18c('0x106'),'as':_0xa18c('0x1d1')});db[_0xa18c('0xe4')][_0xa18c('0x10e')](db[_0xa18c('0x146')],{'as':_0xa18c('0x147'),'foreignKey':_0xa18c('0x199')});db['Campaign'][_0xa18c('0x10e')](db[_0xa18c('0x7a')],{'as':'HopperFinals','foreignKey':_0xa18c('0x199')});db[_0xa18c('0xe4')][_0xa18c('0x10e')](db[_0xa18c('0x113')],{'as':_0xa18c('0x148'),'foreignKey':_0xa18c('0x199')});db[_0xa18c('0xe4')][_0xa18c('0x10e')](db['CmHopperBlack'],{'as':_0xa18c('0x149'),'foreignKey':'CampaignId'});db[_0xa18c('0xe4')][_0xa18c('0x11b')](db[_0xa18c('0x2e')],{'as':'Trunk','foreignKey':_0xa18c('0x14b')});db[_0xa18c('0xe4')][_0xa18c('0x11b')](db[_0xa18c('0x2e')],{'as':_0xa18c('0x1d2'),'foreignKey':_0xa18c('0x14c')});db[_0xa18c('0xe4')]['belongsTo'](db[_0xa18c('0x14d')],{'as':_0xa18c('0x14d'),'foreignKey':'IntervalId'});db[_0xa18c('0xe4')][_0xa18c('0x11b')](db[_0xa18c('0xdd')],{'as':_0xa18c('0xdd'),'foreignKey':_0xa18c('0x1d3')});db[_0xa18c('0xe4')][_0xa18c('0x11d')](db[_0xa18c('0x122')],{'as':_0xa18c('0x123'),'through':'campaigns_has_cm_lists'});db[_0xa18c('0xe4')][_0xa18c('0x11d')](db[_0xa18c('0x122')],{'as':_0xa18c('0x150'),'through':_0xa18c('0x1d4')});db[_0xa18c('0xe7')][_0xa18c('0x11b')](db['ChatOfflineMessage'],{'as':'ChatOfflineMessage','foreignKey':_0xa18c('0x194')});db['MailTransferReport'][_0xa18c('0x11b')](db[_0xa18c('0x47')],{});db['MailTransferReport'][_0xa18c('0x11b')](db[_0xa18c('0x45')],{});db[_0xa18c('0x1d5')][_0xa18c('0x11b')](db[_0xa18c('0x40')],{'foreignKey':_0xa18c('0x1d6'),'as':'FromAccount'});db[_0xa18c('0x1d5')][_0xa18c('0x11b')](db['User'],{'foreignKey':'FromUserId','as':_0xa18c('0x1d7')});db[_0xa18c('0x1d5')]['belongsTo'](db[_0xa18c('0x14')],{'foreignKey':'ToUserId','as':'ToAgent'});db['MailTransferReport'][_0xa18c('0x11b')](db[_0xa18c('0x42')],{'foreignKey':_0xa18c('0x1d8'),'as':'ToQueue'});db[_0xa18c('0x1d5')][_0xa18c('0x11b')](db[_0xa18c('0x40')],{'foreignKey':'ToMailAccountId','as':_0xa18c('0x1d9')});db['ChatTransferReport'][_0xa18c('0x11b')](db[_0xa18c('0x18c')],{});db['ChatTransferReport']['belongsTo'](db[_0xa18c('0x6d')],{});db[_0xa18c('0xea')]['belongsTo'](db[_0xa18c('0x67')],{'foreignKey':'FromChatWebsiteId','as':_0xa18c('0x1da')});db[_0xa18c('0xea')][_0xa18c('0x11b')](db[_0xa18c('0x14')],{'foreignKey':'FromUserId','as':'FromAgent'});db[_0xa18c('0xea')]['belongsTo'](db[_0xa18c('0x14')],{'foreignKey':_0xa18c('0x1db'),'as':_0xa18c('0x1dc')});db[_0xa18c('0xea')][_0xa18c('0x11b')](db[_0xa18c('0x71')],{'foreignKey':_0xa18c('0x1dd'),'as':_0xa18c('0x1de')});db[_0xa18c('0xea')][_0xa18c('0x11b')](db[_0xa18c('0x67')],{'foreignKey':_0xa18c('0x1df'),'as':_0xa18c('0x1d9')});db[_0xa18c('0xec')]['belongsTo'](db[_0xa18c('0x54')],{});db['FaxTransferReport'][_0xa18c('0x11b')](db[_0xa18c('0x52')],{});db[_0xa18c('0xec')][_0xa18c('0x11b')](db[_0xa18c('0x136')],{'foreignKey':'FromFaxAccountId','as':_0xa18c('0x1da')});db[_0xa18c('0xec')][_0xa18c('0x11b')](db['User'],{'foreignKey':_0xa18c('0x1e0'),'as':_0xa18c('0x1d7')});db['FaxTransferReport'][_0xa18c('0x11b')](db[_0xa18c('0x14')],{'foreignKey':'ToUserId','as':_0xa18c('0x1dc')});db[_0xa18c('0xec')][_0xa18c('0x11b')](db[_0xa18c('0x130')],{'foreignKey':_0xa18c('0x1e1'),'as':'ToQueue'});db[_0xa18c('0xec')][_0xa18c('0x11b')](db['FaxAccount'],{'foreignKey':'ToFaxAccountId','as':'ToAccount'});db['OpenchannelTransferReport'][_0xa18c('0x11b')](db[_0xa18c('0x64')],{});db[_0xa18c('0xee')][_0xa18c('0x11b')](db[_0xa18c('0x12b')],{});db[_0xa18c('0xee')][_0xa18c('0x11b')](db[_0xa18c('0x5f')],{'foreignKey':_0xa18c('0x1e2'),'as':'FromAccount'});db['OpenchannelTransferReport'][_0xa18c('0x11b')](db[_0xa18c('0x14')],{'foreignKey':_0xa18c('0x1e0'),'as':_0xa18c('0x1d7')});db[_0xa18c('0xee')][_0xa18c('0x11b')](db['User'],{'foreignKey':_0xa18c('0x1db'),'as':_0xa18c('0x1dc')});db[_0xa18c('0xee')][_0xa18c('0x11b')](db[_0xa18c('0x66')],{'foreignKey':'ToOpenchannelQueueId','as':_0xa18c('0x1de')});db[_0xa18c('0xee')][_0xa18c('0x11b')](db[_0xa18c('0x5f')],{'foreignKey':_0xa18c('0x1e3'),'as':_0xa18c('0x1d9')});db[_0xa18c('0xf0')]['belongsTo'](db['SmsMessage'],{});db[_0xa18c('0xf0')][_0xa18c('0x11b')](db[_0xa18c('0x5a')],{});db[_0xa18c('0xf0')][_0xa18c('0x11b')](db[_0xa18c('0x56')],{'foreignKey':_0xa18c('0x1e4'),'as':_0xa18c('0x1da')});db['SmsTransferReport'][_0xa18c('0x11b')](db[_0xa18c('0x14')],{'foreignKey':_0xa18c('0x1e0'),'as':'FromAgent'});db[_0xa18c('0xf0')][_0xa18c('0x11b')](db[_0xa18c('0x14')],{'foreignKey':_0xa18c('0x1db'),'as':_0xa18c('0x1dc')});db[_0xa18c('0xf0')][_0xa18c('0x11b')](db[_0xa18c('0x5d')],{'foreignKey':_0xa18c('0x1e5'),'as':_0xa18c('0x1de')});db[_0xa18c('0xf0')]['belongsTo'](db['SmsAccount'],{'foreignKey':_0xa18c('0x1e6'),'as':_0xa18c('0x1d9')});db['CmList']['hasMany'](db['Disposition'],{'as':_0xa18c('0x162'),'foreignKey':_0xa18c('0x166'),'onDelete':_0xa18c('0x10d')});db[_0xa18c('0x122')][_0xa18c('0x10e')](db[_0xa18c('0x1e7')],{'as':_0xa18c('0x1e8'),'foreignKey':_0xa18c('0x166')});db['CmList']['hasMany'](db[_0xa18c('0x76')],{'as':_0xa18c('0x120'),'onDelete':'cascade','foreignKey':_0xa18c('0x166')});db['CmList'][_0xa18c('0x10e')](db[_0xa18c('0x7a')],{'as':_0xa18c('0x112'),'foreignKey':_0xa18c('0x166')});db['CmList']['hasMany'](db['CmHopperHistory'],{'as':_0xa18c('0x114'),'foreignKey':_0xa18c('0x166')});db[_0xa18c('0x122')]['hasMany'](db['ReportAgentPreview'],{'as':'ReportAgentPreview','foreignKey':_0xa18c('0x166')});db[_0xa18c('0x122')]['belongsToMany'](db[_0xa18c('0x1e')],{'as':_0xa18c('0x1e9'),'through':_0xa18c('0x14f')});db[_0xa18c('0x122')]['belongsToMany'](db[_0xa18c('0x14')],{'as':_0xa18c('0x168'),'through':_0xa18c('0x124')});db[_0xa18c('0xf2')][_0xa18c('0x10e')](db['VoiceExtension'],{'as':_0xa18c('0x111'),'onDelete':'cascade'});db[_0xa18c('0xf2')][_0xa18c('0x11d')](db[_0xa18c('0x14')],{'as':_0xa18c('0x168'),'through':'UserVoicePrefix'});db['VoicePrefix'][_0xa18c('0x11d')](db['Team'],{'through':_0xa18c('0x106'),'as':_0xa18c('0x16a')});db[_0xa18c('0xf3')][_0xa18c('0x10e')](db[_0xa18c('0x14')],{'as':'Users','foreignKey':_0xa18c('0x11c')});db[_0xa18c('0xf3')][_0xa18c('0x10e')](db[_0xa18c('0xf4')],{'as':_0xa18c('0x1ea'),'foreignKey':_0xa18c('0x11c'),'onDelete':_0xa18c('0x10d')});db[_0xa18c('0xf4')][_0xa18c('0x10e')](db[_0xa18c('0x1eb')],{'as':_0xa18c('0x1ec'),'foreignKey':'sectionId','onDelete':_0xa18c('0x10d')});db[_0xa18c('0x1ed')]['hasMany'](db[_0xa18c('0x161')],{'as':'Dispositions','foreignKey':'WhatsappAccountId','onDelete':_0xa18c('0x10d')});db[_0xa18c('0x1ed')][_0xa18c('0x10e')](db[_0xa18c('0x163')],{'as':_0xa18c('0x189'),'foreignKey':'WhatsappAccountId'});db[_0xa18c('0x1ed')]['hasMany'](db[_0xa18c('0xfd')],{'as':_0xa18c('0x178'),'foreignKey':_0xa18c('0x1ee')});db[_0xa18c('0x1ed')][_0xa18c('0x10e')](db[_0xa18c('0xfb')],{'as':'Interactions'});db['WhatsappAccount'][_0xa18c('0x10e')](db[_0xa18c('0xf9')],{'as':_0xa18c('0x142')});db['WhatsappAccount']['belongsTo'](db[_0xa18c('0x122')],{'as':_0xa18c('0x165'),'foreignKey':_0xa18c('0x166')});db[_0xa18c('0x1ed')][_0xa18c('0x11b')](db['Pause'],{'as':_0xa18c('0x179'),'foreignKey':_0xa18c('0x167')});db[_0xa18c('0x1ed')][_0xa18c('0x11d')](db[_0xa18c('0x14')],{'as':'Agents','through':'user_has_whatsapp_accounts'});db[_0xa18c('0xf9')][_0xa18c('0x11b')](db['User'],{'onDelete':'restrict'});db[_0xa18c('0xf9')]['belongsTo'](db[_0xa18c('0x102')],{'onDelete':_0xa18c('0x15e')});db[_0xa18c('0xf9')]['belongsTo'](db[_0xa18c('0x1ed')],{'onDelete':_0xa18c('0x15e')});db[_0xa18c('0xf9')]['belongsTo'](db['Interval'],{'onDelete':_0xa18c('0x15e'),'foreignKey':_0xa18c('0x14e')});db[_0xa18c('0xf9')][_0xa18c('0x11b')](db['Tag'],{'onDelete':_0xa18c('0x15e'),'foreignKey':_0xa18c('0x174')});db['WhatsappInteraction'][_0xa18c('0x10e')](db['WhatsappMessage'],{'as':_0xa18c('0x178'),'onDelete':_0xa18c('0x10d'),'foreignKey':_0xa18c('0x1ef')});db['WhatsappInteraction'][_0xa18c('0x11b')](db[_0xa18c('0x1ed')],{'as':_0xa18c('0x172'),'foreignKey':_0xa18c('0x1ee')});db[_0xa18c('0xfb')][_0xa18c('0x11b')](db[_0xa18c('0x76')],{'as':_0xa18c('0x158'),'foreignKey':_0xa18c('0x159')});db[_0xa18c('0xfb')][_0xa18c('0x11b')](db[_0xa18c('0x14')],{'as':_0xa18c('0x17a'),'foreignKey':_0xa18c('0x10c')});db[_0xa18c('0xfb')]['belongsToMany'](db['Tag'],{'through':_0xa18c('0x1f0'),'as':'Tags'});db['WhatsappInteraction'][_0xa18c('0x11d')](db['Tag'],{'through':_0xa18c('0x1f0'),'as':_0xa18c('0x16e')});db[_0xa18c('0xfb')][_0xa18c('0x11d')](db[_0xa18c('0x14')],{'as':'Users','through':'user_has_whatsapp_interactions','foreignKey':_0xa18c('0x1ef')});db[_0xa18c('0xfd')]['belongsTo'](db[_0xa18c('0x14')],{'as':'User'});db[_0xa18c('0xfd')][_0xa18c('0x11b')](db[_0xa18c('0x76')],{'onDelete':_0xa18c('0x10d'),'as':_0xa18c('0x158')});db[_0xa18c('0xfd')][_0xa18c('0x11b')](db[_0xa18c('0xfb')],{'onDelete':'cascade','as':_0xa18c('0x171'),'foreignKey':'WhatsappInteractionId'});db['WhatsappMessage'][_0xa18c('0x11b')](db[_0xa18c('0x1ed')],{'as':_0xa18c('0x172'),'foreignKey':'WhatsappAccountId'});db['WhatsappQueueReport'][_0xa18c('0x11b')](db[_0xa18c('0x1ed')],{});db[_0xa18c('0xff')][_0xa18c('0x11b')](db[_0xa18c('0x122')],{'as':_0xa18c('0x165'),'foreignKey':'ListId'});db[_0xa18c('0xff')][_0xa18c('0x11b')](db['CmContact'],{'as':'Contact','foreignKey':_0xa18c('0x159')});db['WhatsappQueueReport'][_0xa18c('0x11b')](db['WhatsappInteraction'],{});db[_0xa18c('0xff')][_0xa18c('0x11b')](db['WhatsappQueue'],{});db['WhatsappQueueReport']['belongsTo'](db[_0xa18c('0xfd')],{});db[_0xa18c('0xff')][_0xa18c('0x11b')](db['User'],{});db['WhatsappTransferReport'][_0xa18c('0x11b')](db['WhatsappMessage'],{});db[_0xa18c('0x101')][_0xa18c('0x11b')](db[_0xa18c('0xfb')],{});db[_0xa18c('0x101')][_0xa18c('0x11b')](db[_0xa18c('0x1ed')],{'foreignKey':_0xa18c('0x1f1'),'as':_0xa18c('0x1da')});db[_0xa18c('0x101')][_0xa18c('0x11b')](db[_0xa18c('0x1ed')],{'foreignKey':_0xa18c('0x1f2'),'as':_0xa18c('0x1d9')});db['WhatsappTransferReport'][_0xa18c('0x11b')](db['WhatsappQueue'],{'foreignKey':'ToQueueId','as':'ToQueue'});db[_0xa18c('0x101')][_0xa18c('0x11b')](db['User'],{'foreignKey':_0xa18c('0x1e0'),'as':_0xa18c('0x1d7')});db[_0xa18c('0x101')]['belongsTo'](db[_0xa18c('0x14')],{'foreignKey':_0xa18c('0x1db'),'as':_0xa18c('0x1dc')});db[_0xa18c('0x102')]['belongsToMany'](db[_0xa18c('0x14')],{'as':_0xa18c('0x168'),'through':_0xa18c('0x3b'),'foreignKey':_0xa18c('0x1f3')});db[_0xa18c('0x102')][_0xa18c('0x11d')](db[_0xa18c('0x125')],{'through':_0xa18c('0x1d0'),'as':_0xa18c('0x16a')});db[_0xa18c('0x10a')][_0xa18c('0x11b')](db[_0xa18c('0x14')],{'as':_0xa18c('0x1f4'),'foreignKey':_0xa18c('0x10c'),'onDelete':_0xa18c('0x10d'),'hooks':!![]});db[_0xa18c('0x15c')][_0xa18c('0x10b')](db[_0xa18c('0x1c5')],{'as':_0xa18c('0x1c5'),'onDelete':_0xa18c('0x15e')});db['CloudProvider'][_0xa18c('0x10b')](db['MailServerIn'],{'as':_0xa18c('0x15f'),'onDelete':'restrict'});db[_0xa18c('0x15c')]['hasOne'](db['MailServerOut'],{'as':_0xa18c('0x160'),'onDelete':_0xa18c('0x15e')});module[_0xa18c('0x1f5')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index ff42c5a..8cfd34c 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6f47=['/api/openchannel/messages','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','./api/cmCustomField','/api/automations','./api/automation','/api/canned_answers','/api/dispositions','./api/disposition','/api/conditions','./api/condition','/api/intervals','./api/interval','/api/cdr','./api/cdr','/api/voiceQueuesLog','/api/schedules','/api/sounds','/api/tags','./api/tag','/api/templates','/api/triggers','./api/trigger','/api/variables','./api/variable','./api/integration','/api/integrations/reports','./api/integrationReport','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','./api/analyticExtractedReport','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmField','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/configurations','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','/api/integrations/freshdesk/fields','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','/api/integrations/dynamics365/fields','./api/intDynamics365Field','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','/api/square/reports','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','/api/square/messages','./api/squareMessage','./api/team','/api/license','/api/campaigns','./api/campaign','/api/migrations','./api/attachment','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/realtime','./api/user-setting','/api/auth/local','./api/authLocal','/api/auth/google','./api/authActiveDirectory','/api/rpc','./api/rpc','./api/version','/api/system','./api/system','/api/pm2','./api/pm2','/api/logs','static','join','root','/apidoc','/www','/demo','/snippet','snippet','3.0.0','route','/:url(api|auth|components|app|bower_components|assets)/*','get','resolve','/index.html','express','./errors','./utils/client-side-logger','./api/client-side-logs','then','use','/api/users','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','./api/voiceMusicOnHold','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/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/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','/api/mail/reports/queue','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','./api/faxApplication','/api/fax/messages','./api/faxMessage','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','/api/openchannel/interactions','./api/openchannelInteraction'];(function(_0x494ff5,_0x5014e6){var _0x4118f7=function(_0x1c7583){while(--_0x1c7583){_0x494ff5['push'](_0x494ff5['shift']());}};_0x4118f7(++_0x5014e6);}(_0x6f47,0xc7));var _0x76f4=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0x6f47[_0xf50820];return _0x2a9b10;};'use strict';var path=require('path');var express=require(_0x76f4('0x0'));var errors=require(_0x76f4('0x1'));var config=require('./config/environment');var setupLoggers=require(_0x76f4('0x2'))['setupLoggers'];var clientSideLogs=require(_0x76f4('0x3'));exports['default']=function(_0xe214ad){return setupLoggers(_0xe214ad)[_0x76f4('0x4')](function(){_0xe214ad[_0x76f4('0x5')](_0x76f4('0x6'),require('./api/user'));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x7'),require(_0x76f4('0x8')));_0xe214ad['use'](_0x76f4('0x9'),require(_0x76f4('0xa')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xb'),require(_0x76f4('0xc')));_0xe214ad['use']('/api/voice/mohs',require(_0x76f4('0xd')));_0xe214ad[_0x76f4('0x5')]('/api/voice/queues',require('./api/voiceQueue'));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xe'),require(_0x76f4('0xf')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x10'),require(_0x76f4('0x11')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x12'),require(_0x76f4('0x13')));_0xe214ad['use'](_0x76f4('0x14'),require(_0x76f4('0x15')));_0xe214ad['use']('/api/voice/calls/reports',require('./api/voiceCallReport'));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x16'),require(_0x76f4('0x17')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x18'),require(_0x76f4('0x19')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x1a'),require(_0x76f4('0x1b')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x1c'),require(_0x76f4('0x1d')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x1e'),require(_0x76f4('0x1f')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x20'),require(_0x76f4('0x21')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x22'),require(_0x76f4('0x23')));_0xe214ad[_0x76f4('0x5')]('/api/mail/accounts',require(_0x76f4('0x24')));_0xe214ad['use'](_0x76f4('0x25'),require(_0x76f4('0x26')));_0xe214ad[_0x76f4('0x5')]('/api/mail/substatuses',require('./api/mailSubstatus'));_0xe214ad['use'](_0x76f4('0x27'),require(_0x76f4('0x28')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x29'),require(_0x76f4('0x2a')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x2b'),require('./api/mailApplication'));_0xe214ad['use'](_0x76f4('0x2c'),require('./api/mailQueueReport'));_0xe214ad[_0x76f4('0x5')]('/api/dashboards',require('./api/dashboard'));_0xe214ad['use'](_0x76f4('0x2d'),require(_0x76f4('0x2e')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x2f'),require(_0x76f4('0x30')));_0xe214ad[_0x76f4('0x5')]('/api/fax/applications',require(_0x76f4('0x31')));_0xe214ad['use']('/api/fax/interactions',require('./api/faxInteraction'));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x32'),require(_0x76f4('0x33')));_0xe214ad[_0x76f4('0x5')]('/api/fax/queues',require(_0x76f4('0x34')));_0xe214ad['use'](_0x76f4('0x35'),require(_0x76f4('0x36')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x37'),require(_0x76f4('0x38')));_0xe214ad['use']('/api/sms/applications',require(_0x76f4('0x39')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x3a'),require(_0x76f4('0x3b')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x3c'),require(_0x76f4('0x3d')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x3e'),require(_0x76f4('0x3f')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x40'),require('./api/openchannelAccount'));_0xe214ad['use']('/api/openchannel/applications',require('./api/openchannelApplication'));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x41'),require(_0x76f4('0x42')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x43'),require('./api/openchannelMessage'));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x44'),require(_0x76f4('0x45')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x46'),require(_0x76f4('0x47')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x48'),require(_0x76f4('0x49')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x4a'),require(_0x76f4('0x4b')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x4c'),require(_0x76f4('0x4d')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x4e'),require(_0x76f4('0x4f')));_0xe214ad['use'](_0x76f4('0x50'),require(_0x76f4('0x51')));_0xe214ad[_0x76f4('0x5')]('/api/chat/queues',require('./api/chatQueue'));_0xe214ad[_0x76f4('0x5')]('/api/chat/groups',require(_0x76f4('0x52')));_0xe214ad['use'](_0x76f4('0x53'),require(_0x76f4('0x54')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x55'),require(_0x76f4('0x56')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x57'),require(_0x76f4('0x58')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x59'),require('./api/cmHopper'));_0xe214ad['use'](_0x76f4('0x5a'),require(_0x76f4('0x5b')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x5c'),require(_0x76f4('0x5d')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x5e'),require(_0x76f4('0x5f')));_0xe214ad[_0x76f4('0x5')]('/api/cm/custom_fields',require(_0x76f4('0x60')));_0xe214ad[_0x76f4('0x5')]('/api/actions',require('./api/action'));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x61'),require(_0x76f4('0x62')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x63'),require('./api/cannedAnswer'));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x64'),require(_0x76f4('0x65')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x66'),require(_0x76f4('0x67')));_0xe214ad['use'](_0x76f4('0x68'),require(_0x76f4('0x69')));_0xe214ad[_0x76f4('0x5')]('/api/pauses',require('./api/pause'));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x6a'),require(_0x76f4('0x6b')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x6c'),require('./api/voiceQueuesLog'));_0xe214ad['use'](_0x76f4('0x6d'),require('./api/schedule'));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x6e'),require('./api/sound'));_0xe214ad['use'](_0x76f4('0x6f'),require(_0x76f4('0x70')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x71'),require('./api/template'));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x72'),require(_0x76f4('0x73')));_0xe214ad['use'](_0x76f4('0x74'),require(_0x76f4('0x75')));_0xe214ad['use']('/api/integrations',require(_0x76f4('0x76')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x77'),require(_0x76f4('0x78')));_0xe214ad[_0x76f4('0x5')]('/api/analytics/custom_reports',require(_0x76f4('0x79')));_0xe214ad['use'](_0x76f4('0x7a'),require(_0x76f4('0x7b')));_0xe214ad[_0x76f4('0x5')]('/api/analytics/extracted_reports',require(_0x76f4('0x7c')));_0xe214ad[_0x76f4('0x5')]('/api/analytics/metrics',require(_0x76f4('0x7d')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x7e'),require(_0x76f4('0x7f')));_0xe214ad[_0x76f4('0x5')]('/api/analytics/tree_reports',require(_0x76f4('0x80')));_0xe214ad['use'](_0x76f4('0x81'),require(_0x76f4('0x82')));_0xe214ad[_0x76f4('0x5')]('/api/integrations/salesforce/configurations',require(_0x76f4('0x83')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x84'),require(_0x76f4('0x85')));_0xe214ad['use'](_0x76f4('0x86'),require(_0x76f4('0x87')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x88'),require('./api/intSugarcrmConfiguration'));_0xe214ad[_0x76f4('0x5')]('/api/integrations/sugarcrm/fields',require(_0x76f4('0x89')));_0xe214ad[_0x76f4('0x5')]('/api/integrations/desk/accounts',require('./api/intDeskAccount'));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x8a'),require(_0x76f4('0x8b')));_0xe214ad['use'](_0x76f4('0x8c'),require(_0x76f4('0x8d')));_0xe214ad[_0x76f4('0x5')]('/api/integrations/zoho/accounts',require('./api/intZohoAccount'));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x8e'),require('./api/intZohoConfiguration'));_0xe214ad['use'](_0x76f4('0x8f'),require(_0x76f4('0x90')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x91'),require(_0x76f4('0x92')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x93'),require(_0x76f4('0x94')));_0xe214ad[_0x76f4('0x5')]('/api/integrations/zendesk/fields',require('./api/intZendeskField'));_0xe214ad['use'](_0x76f4('0x95'),require(_0x76f4('0x96')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x97'),require('./api/intFreshdeskConfiguration'));_0xe214ad['use'](_0x76f4('0x98'),require('./api/intFreshdeskField'));_0xe214ad[_0x76f4('0x5')]('/api/integrations/vtiger/accounts',require(_0x76f4('0x99')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x9a'),require(_0x76f4('0x9b')));_0xe214ad['use'](_0x76f4('0x9c'),require(_0x76f4('0x9d')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x9e'),require(_0x76f4('0x9f')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xa0'),require('./api/intServicenowConfiguration'));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xa1'),require(_0x76f4('0xa2')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xa3'),require(_0x76f4('0xa4')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xa5'),require('./api/intDynamics365Configuration'));_0xe214ad['use'](_0x76f4('0xa6'),require(_0x76f4('0xa7')));_0xe214ad[_0x76f4('0x5')]('/api/integrations/freshsales/accounts',require(_0x76f4('0xa8')));_0xe214ad['use'](_0x76f4('0xa9'),require(_0x76f4('0xaa')));_0xe214ad['use'](_0x76f4('0xab'),require(_0x76f4('0xac')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xad'),require(_0x76f4('0xae')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xaf'),require(_0x76f4('0xb0')));_0xe214ad[_0x76f4('0x5')]('/api/chat/internal/messages',require(_0x76f4('0xb1')));_0xe214ad['use'](_0x76f4('0xb2'),require(_0x76f4('0xb3')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xb4'),require(_0x76f4('0xb5')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xb6'),require(_0x76f4('0xb7')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xb8'),require('./api/smsQueueReport'));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xb9'),require('./api/squareReport'));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xba'),require(_0x76f4('0xbb')));_0xe214ad['use'](_0x76f4('0xbc'),require(_0x76f4('0xbd')));_0xe214ad[_0x76f4('0x5')]('/api/settings',require(_0x76f4('0xbe')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xbf'),require(_0x76f4('0xc0')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xc1'),require(_0x76f4('0xc2')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xc3'),require('./api/squareRecording'));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xc4'),require(_0x76f4('0xc5')));_0xe214ad[_0x76f4('0x5')]('/api/teams',require(_0x76f4('0xc6')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xc7'),require('./api/license'));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xc8'),require(_0x76f4('0xc9')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xca'),require('./api/migration'));_0xe214ad[_0x76f4('0x5')]('/api/attachments',require(_0x76f4('0xcb')));_0xe214ad[_0x76f4('0x5')]('/api/plugins',require('./api/plugin'));_0xe214ad['use'](_0x76f4('0xcc'),require(_0x76f4('0xcd')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xce'),require(_0x76f4('0xcf')));_0xe214ad[_0x76f4('0x5')]('/api/fax/reports/transfer',require(_0x76f4('0xd0')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xd1'),require(_0x76f4('0xd2')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xd3'),require(_0x76f4('0xd4')));_0xe214ad[_0x76f4('0x5')]('/api/cm/lists',require(_0x76f4('0xd5')));_0xe214ad['use'](_0x76f4('0xd6'),require(_0x76f4('0xd7')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xd8'),require(_0x76f4('0xd9')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xda'),require(_0x76f4('0xdb')));_0xe214ad['use'](_0x76f4('0xdc'),require('./api/userProfileResource'));_0xe214ad['use']('/api/userNotifications',require(_0x76f4('0xdd')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xde'),require(_0x76f4('0xdf')));_0xe214ad['use'](_0x76f4('0xe0'),require(_0x76f4('0xe1')));_0xe214ad[_0x76f4('0x5')]('/api/whatsapp/interactions',require(_0x76f4('0xe2')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xe3'),require(_0x76f4('0xe4')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xe5'),require(_0x76f4('0xe6')));_0xe214ad['use'](_0x76f4('0xe7'),require(_0x76f4('0xe8')));_0xe214ad['use'](_0x76f4('0xe9'),require(_0x76f4('0xea')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xeb'),require(_0x76f4('0xec')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xed'),require(_0x76f4('0xee')));_0xe214ad[_0x76f4('0x5')]('/api/user-settings',require(_0x76f4('0xef')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xf0'),require(_0x76f4('0xf1')));_0xe214ad['use'](_0x76f4('0xf2'),require('./api/authGoogle'));_0xe214ad[_0x76f4('0x5')]('/api/auth/activedirectory',require(_0x76f4('0xf3')));_0xe214ad[_0x76f4('0x5')]('/api/jira',require('./api/jira'));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xf4'),require(_0x76f4('0xf5')));_0xe214ad['use']('/api/version',require(_0x76f4('0xf6')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xf7'),require(_0x76f4('0xf8')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xf9'),require(_0x76f4('0xfa')));_0xe214ad[_0x76f4('0x5')]('/api/webbar',require('./api/webbar'));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xfb'),clientSideLogs);_0xe214ad[_0x76f4('0x5')]('/apidoc',express[_0x76f4('0xfc')](path[_0x76f4('0xfd')](config[_0x76f4('0xfe')],_0x76f4('0xff'))));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x100'),express[_0x76f4('0xfc')](path['join'](config[_0x76f4('0xfe')],_0x76f4('0x100'))));_0xe214ad[_0x76f4('0x5')]('/demo',express[_0x76f4('0xfc')](path[_0x76f4('0xfd')](config[_0x76f4('0xfe')],_0x76f4('0x101'))));_0xe214ad['use'](_0x76f4('0x102'),express['static'](path[_0x76f4('0xfd')](config['root'],_0x76f4('0x103'),_0x76f4('0x104'))));_0xe214ad[_0x76f4('0x5')]('/plugins',express[_0x76f4('0xfc')](path[_0x76f4('0xfd')](config[_0x76f4('0xfe')],'/server/files/plugins')));_0xe214ad[_0x76f4('0x105')](_0x76f4('0x106'))['get'](errors[0x194]);_0xe214ad['route']('/*')[_0x76f4('0x107')](function(_0x39afa3,_0x515cfe){_0x515cfe['sendFile'](path[_0x76f4('0x108')](_0xe214ad[_0x76f4('0x107')]('appPath')+_0x76f4('0x109')));});return _0xe214ad;});}; \ No newline at end of file +var _0xdbf5=['/api/integrations/desk/configurations','./api/intDeskConfiguration','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','/api/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/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','./api/squareReport','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareMessage','/api/teams','/api/license','./api/license','./api/campaign','/api/migrations','./api/migration','/api/attachments','/api/plugins','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','./api/whatsappQueue','/api/realtime','./api/realtime','/api/user-settings','./api/user-setting','./api/authLocal','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','/api/jira','./api/jira','/api/rpc','/api/version','./api/version','./api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/apidoc','static','join','/www','root','snippet','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','resolve','appPath','/index.html','express','./utils/client-side-logger','setupLoggers','./api/client-side-logs','default','then','use','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/calls/reports','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/members/reports','./api/memberReport','/api/trunks','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/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/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/queues','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','/api/openchannel/queues','./api/openchannelQueue','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','./api/chatMessage','/api/chat/offline_messages','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','./api/cmHopperBlack','./api/cmHopperFinal','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','./api/disposition','/api/conditions','./api/condition','/api/intervals','/api/pauses','./api/pause','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','/api/tags','/api/templates','/api/triggers','/api/integrations','./api/integration','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts'];(function(_0x108be7,_0x4d563c){var _0x3a1836=function(_0x46c61f){while(--_0x46c61f){_0x108be7['push'](_0x108be7['shift']());}};_0x3a1836(++_0x4d563c);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x4b00d7,_0x54eeea){_0x4b00d7=_0x4b00d7-0x0;var _0x326b02=_0xdbf5[_0x4b00d7];return _0x326b02;};'use strict';var path=require('path');var express=require(_0x5dbf('0x0'));var errors=require('./errors');var config=require('./config/environment');var setupLoggers=require(_0x5dbf('0x1'))[_0x5dbf('0x2')];var clientSideLogs=require(_0x5dbf('0x3'));exports[_0x5dbf('0x4')]=function(_0x38b629){return setupLoggers(_0x38b629)[_0x5dbf('0x5')](function(){_0x38b629[_0x5dbf('0x6')](_0x5dbf('0x7'),require(_0x5dbf('0x8')));_0x38b629[_0x5dbf('0x6')](_0x5dbf('0x9'),require(_0x5dbf('0xa')));_0x38b629[_0x5dbf('0x6')]('/api/voice/contexts',require(_0x5dbf('0xb')));_0x38b629['use'](_0x5dbf('0xc'),require(_0x5dbf('0xd')));_0x38b629[_0x5dbf('0x6')](_0x5dbf('0xe'),require('./api/voiceMusicOnHold'));_0x38b629[_0x5dbf('0x6')]('/api/voice/queues',require('./api/voiceQueue'));_0x38b629[_0x5dbf('0x6')]('/api/voice/recordings',require('./api/voiceRecording'));_0x38b629[_0x5dbf('0x6')]('/api/screen/recordings',require(_0x5dbf('0xf')));_0x38b629[_0x5dbf('0x6')](_0x5dbf('0x10'),require(_0x5dbf('0x11')));_0x38b629[_0x5dbf('0x6')]('/api/voice/mails/messages',require('./api/voiceMailMessage'));_0x38b629[_0x5dbf('0x6')](_0x5dbf('0x12'),require('./api/voiceCallReport'));_0x38b629[_0x5dbf('0x6')](_0x5dbf('0x13'),require(_0x5dbf('0x14')));_0x38b629[_0x5dbf('0x6')](_0x5dbf('0x15'),require(_0x5dbf('0x16')));_0x38b629[_0x5dbf('0x6')]('/api/voice/queues/reports',require('./api/voiceQueueReport'));_0x38b629[_0x5dbf('0x6')](_0x5dbf('0x17'),require(_0x5dbf('0x18')));_0x38b629[_0x5dbf('0x6')](_0x5dbf('0x19'),require('./api/trunk'));_0x38b629[_0x5dbf('0x6')]('/api/voice/transfers/reports',require('./api/voiceTransferReport'));_0x38b629['use'](_0x5dbf('0x1a'),require(_0x5dbf('0x1b')));_0x38b629[_0x5dbf('0x6')](_0x5dbf('0x1c'),require(_0x5dbf('0x1d')));_0x38b629['use'](_0x5dbf('0x1e'),require('./api/mailQueue'));_0x38b629[_0x5dbf('0x6')](_0x5dbf('0x1f'),require(_0x5dbf('0x20')));_0x38b629[_0x5dbf('0x6')](_0x5dbf('0x21'),require(_0x5dbf('0x22')));_0x38b629['use'](_0x5dbf('0x23'),require(_0x5dbf('0x24')));_0x38b629[_0x5dbf('0x6')](_0x5dbf('0x25'),require(_0x5dbf('0x26')));_0x38b629[_0x5dbf('0x6')](_0x5dbf('0x27'),require(_0x5dbf('0x28')));_0x38b629[_0x5dbf('0x6')](_0x5dbf('0x29'),require(_0x5dbf('0x2a')));_0x38b629[_0x5dbf('0x6')](_0x5dbf('0x2b'),require(_0x5dbf('0x2c')));_0x38b629[_0x5dbf('0x6')](_0x5dbf('0x2d'),require(_0x5dbf('0x2e')));_0x38b629[_0x5dbf('0x6')](_0x5dbf('0x2f'),require(_0x5dbf('0x30')));_0x38b629[_0x5dbf('0x6')](_0x5dbf('0x31'),require(_0x5dbf('0x32')));_0x38b629['use'](_0x5dbf('0x33'),require(_0x5dbf('0x34')));_0x38b629[_0x5dbf('0x6')](_0x5dbf('0x35'),require(_0x5dbf('0x36')));_0x38b629[_0x5dbf('0x6')](_0x5dbf('0x37'),require(_0x5dbf('0x38')));_0x38b629[_0x5dbf('0x6')](_0x5dbf('0x39'),require(_0x5dbf('0x3a')));_0x38b629['use']('/api/sms/applications',require(_0x5dbf('0x3b')));_0x38b629[_0x5dbf('0x6')](_0x5dbf('0x3c'),require(_0x5dbf('0x3d')));_0x38b629[_0x5dbf('0x6')]('/api/sms/messages',require('./api/smsMessage'));_0x38b629[_0x5dbf('0x6')](_0x5dbf('0x3e'),require('./api/smsQueue'));_0x38b629[_0x5dbf('0x6')](_0x5dbf('0x3f'),require(_0x5dbf('0x40')));_0x38b629[_0x5dbf('0x6')](_0x5dbf('0x41'),require('./api/openchannelApplication'));_0x38b629[_0x5dbf('0x6')](_0x5dbf('0x42'),require(_0x5dbf('0x43')));_0x38b629[_0x5dbf('0x6')](_0x5dbf('0x44'),require('./api/openchannelMessage'));_0x38b629[_0x5dbf('0x6')](_0x5dbf('0x45'),require(_0x5dbf('0x46')));_0x38b629[_0x5dbf('0x6')]('/api/chat/websites',require(_0x5dbf('0x47')));_0x38b629[_0x5dbf('0x6')](_0x5dbf('0x48'),require(_0x5dbf('0x49')));_0x38b629[_0x5dbf('0x6')](_0x5dbf('0x4a'),require(_0x5dbf('0x4b')));_0x38b629[_0x5dbf('0x6')](_0x5dbf('0x4c'),require(_0x5dbf('0x4d')));_0x38b629[_0x5dbf('0x6')]('/api/chat/messages',require(_0x5dbf('0x4e')));_0x38b629[_0x5dbf('0x6')](_0x5dbf('0x4f'),require('./api/chatOfflineMessage'));_0x38b629[_0x5dbf('0x6')](_0x5dbf('0x50'),require(_0x5dbf('0x51')));_0x38b629['use'](_0x5dbf('0x52'),require(_0x5dbf('0x53')));_0x38b629[_0x5dbf('0x6')]('/api/chat/proactive_actions',require(_0x5dbf('0x54')));_0x38b629[_0x5dbf('0x6')](_0x5dbf('0x55'),require(_0x5dbf('0x56')));_0x38b629[_0x5dbf('0x6')](_0x5dbf('0x57'),require(_0x5dbf('0x58')));_0x38b629[_0x5dbf('0x6')]('/api/cm/hopper',require('./api/cmHopper'));_0x38b629['use']('/api/cm/hopper_black',require(_0x5dbf('0x59')));_0x38b629[_0x5dbf('0x6')]('/api/cm/hopper_final',require(_0x5dbf('0x5a')));_0x38b629[_0x5dbf('0x6')]('/api/cm/hopper_history',require(_0x5dbf('0x5b')));_0x38b629[_0x5dbf('0x6')](_0x5dbf('0x5c'),require(_0x5dbf('0x5d')));_0x38b629[_0x5dbf('0x6')](_0x5dbf('0x5e'),require(_0x5dbf('0x5f')));_0x38b629[_0x5dbf('0x6')](_0x5dbf('0x60'),require(_0x5dbf('0x61')));_0x38b629['use'](_0x5dbf('0x62'),require(_0x5dbf('0x63')));_0x38b629[_0x5dbf('0x6')]('/api/dispositions',require(_0x5dbf('0x64')));_0x38b629[_0x5dbf('0x6')](_0x5dbf('0x65'),require(_0x5dbf('0x66')));_0x38b629['use'](_0x5dbf('0x67'),require('./api/interval'));_0x38b629[_0x5dbf('0x6')](_0x5dbf('0x68'),require(_0x5dbf('0x69')));_0x38b629[_0x5dbf('0x6')]('/api/cdr',require('./api/cdr'));_0x38b629[_0x5dbf('0x6')](_0x5dbf('0x6a'),require(_0x5dbf('0x6b')));_0x38b629['use'](_0x5dbf('0x6c'),require('./api/schedule'));_0x38b629['use']('/api/sounds',require('./api/sound'));_0x38b629[_0x5dbf('0x6')](_0x5dbf('0x6d'),require('./api/tag'));_0x38b629[_0x5dbf('0x6')](_0x5dbf('0x6e'),require('./api/template'));_0x38b629[_0x5dbf('0x6')](_0x5dbf('0x6f'),require('./api/trigger'));_0x38b629[_0x5dbf('0x6')]('/api/variables',require('./api/variable'));_0x38b629[_0x5dbf('0x6')](_0x5dbf('0x70'),require(_0x5dbf('0x71')));_0x38b629['use']('/api/integrations/reports',require(_0x5dbf('0x72')));_0x38b629[_0x5dbf('0x6')](_0x5dbf('0x73'),require(_0x5dbf('0x74')));_0x38b629[_0x5dbf('0x6')](_0x5dbf('0x75'),require(_0x5dbf('0x76')));_0x38b629[_0x5dbf('0x6')]('/api/analytics/extracted_reports',require(_0x5dbf('0x77')));_0x38b629[_0x5dbf('0x6')](_0x5dbf('0x78'),require(_0x5dbf('0x79')));_0x38b629[_0x5dbf('0x6')](_0x5dbf('0x7a'),require(_0x5dbf('0x7b')));_0x38b629['use'](_0x5dbf('0x7c'),require('./api/analyticTreeReport'));_0x38b629[_0x5dbf('0x6')](_0x5dbf('0x7d'),require(_0x5dbf('0x7e')));_0x38b629[_0x5dbf('0x6')](_0x5dbf('0x7f'),require(_0x5dbf('0x80')));_0x38b629[_0x5dbf('0x6')]('/api/integrations/salesforce/fields',require('./api/intSalesforceField'));_0x38b629['use'](_0x5dbf('0x81'),require(_0x5dbf('0x82')));_0x38b629[_0x5dbf('0x6')]('/api/integrations/sugarcrm/configurations',require('./api/intSugarcrmConfiguration'));_0x38b629[_0x5dbf('0x6')](_0x5dbf('0x83'),require(_0x5dbf('0x84')));_0x38b629['use'](_0x5dbf('0x85'),require('./api/intDeskAccount'));_0x38b629[_0x5dbf('0x6')](_0x5dbf('0x86'),require(_0x5dbf('0x87')));_0x38b629['use']('/api/integrations/desk/fields',require(_0x5dbf('0x88')));_0x38b629[_0x5dbf('0x6')](_0x5dbf('0x89'),require(_0x5dbf('0x8a')));_0x38b629['use'](_0x5dbf('0x8b'),require(_0x5dbf('0x8c')));_0x38b629['use']('/api/integrations/zoho/fields',require(_0x5dbf('0x8d')));_0x38b629[_0x5dbf('0x6')](_0x5dbf('0x8e'),require(_0x5dbf('0x8f')));_0x38b629[_0x5dbf('0x6')](_0x5dbf('0x90'),require('./api/intZendeskConfiguration'));_0x38b629[_0x5dbf('0x6')]('/api/integrations/zendesk/fields',require('./api/intZendeskField'));_0x38b629['use'](_0x5dbf('0x91'),require('./api/intFreshdeskAccount'));_0x38b629[_0x5dbf('0x6')](_0x5dbf('0x92'),require(_0x5dbf('0x93')));_0x38b629[_0x5dbf('0x6')](_0x5dbf('0x94'),require(_0x5dbf('0x95')));_0x38b629[_0x5dbf('0x6')](_0x5dbf('0x96'),require(_0x5dbf('0x97')));_0x38b629[_0x5dbf('0x6')](_0x5dbf('0x98'),require(_0x5dbf('0x99')));_0x38b629[_0x5dbf('0x6')](_0x5dbf('0x9a'),require(_0x5dbf('0x9b')));_0x38b629['use'](_0x5dbf('0x9c'),require('./api/intServicenowAccount'));_0x38b629[_0x5dbf('0x6')](_0x5dbf('0x9d'),require(_0x5dbf('0x9e')));_0x38b629[_0x5dbf('0x6')]('/api/integrations/servicenow/fields',require(_0x5dbf('0x9f')));_0x38b629[_0x5dbf('0x6')](_0x5dbf('0xa0'),require(_0x5dbf('0xa1')));_0x38b629[_0x5dbf('0x6')](_0x5dbf('0xa2'),require('./api/intDynamics365Configuration'));_0x38b629[_0x5dbf('0x6')](_0x5dbf('0xa3'),require(_0x5dbf('0xa4')));_0x38b629[_0x5dbf('0x6')](_0x5dbf('0xa5'),require(_0x5dbf('0xa6')));_0x38b629[_0x5dbf('0x6')](_0x5dbf('0xa7'),require(_0x5dbf('0xa8')));_0x38b629[_0x5dbf('0x6')](_0x5dbf('0xa9'),require(_0x5dbf('0xaa')));_0x38b629['use']('/api/networks',require(_0x5dbf('0xab')));_0x38b629[_0x5dbf('0x6')](_0x5dbf('0xac'),require(_0x5dbf('0xad')));_0x38b629[_0x5dbf('0x6')](_0x5dbf('0xae'),require(_0x5dbf('0xaf')));_0x38b629[_0x5dbf('0x6')](_0x5dbf('0xb0'),require('./api/jscriptyAnswerReport'));_0x38b629['use']('/api/jscripty/questions/reports',require('./api/jscriptyQuestionReport'));_0x38b629[_0x5dbf('0x6')](_0x5dbf('0xb1'),require(_0x5dbf('0xb2')));_0x38b629[_0x5dbf('0x6')](_0x5dbf('0xb3'),require(_0x5dbf('0xb4')));_0x38b629['use']('/api/square/reports',require(_0x5dbf('0xb5')));_0x38b629[_0x5dbf('0x6')]('/api/square/details/reports',require(_0x5dbf('0xb6')));_0x38b629[_0x5dbf('0x6')](_0x5dbf('0xb7'),require(_0x5dbf('0xb8')));_0x38b629['use'](_0x5dbf('0xb9'),require(_0x5dbf('0xba')));_0x38b629[_0x5dbf('0x6')](_0x5dbf('0xbb'),require(_0x5dbf('0xbc')));_0x38b629['use'](_0x5dbf('0xbd'),require(_0x5dbf('0xbe')));_0x38b629[_0x5dbf('0x6')](_0x5dbf('0xbf'),require('./api/squareRecording'));_0x38b629[_0x5dbf('0x6')]('/api/square/messages',require(_0x5dbf('0xc0')));_0x38b629[_0x5dbf('0x6')](_0x5dbf('0xc1'),require('./api/team'));_0x38b629[_0x5dbf('0x6')](_0x5dbf('0xc2'),require(_0x5dbf('0xc3')));_0x38b629[_0x5dbf('0x6')]('/api/campaigns',require(_0x5dbf('0xc4')));_0x38b629[_0x5dbf('0x6')](_0x5dbf('0xc5'),require(_0x5dbf('0xc6')));_0x38b629[_0x5dbf('0x6')](_0x5dbf('0xc7'),require('./api/attachment'));_0x38b629[_0x5dbf('0x6')](_0x5dbf('0xc8'),require('./api/plugin'));_0x38b629[_0x5dbf('0x6')](_0x5dbf('0xc9'),require(_0x5dbf('0xca')));_0x38b629[_0x5dbf('0x6')](_0x5dbf('0xcb'),require(_0x5dbf('0xcc')));_0x38b629[_0x5dbf('0x6')](_0x5dbf('0xcd'),require(_0x5dbf('0xce')));_0x38b629[_0x5dbf('0x6')](_0x5dbf('0xcf'),require(_0x5dbf('0xd0')));_0x38b629[_0x5dbf('0x6')](_0x5dbf('0xd1'),require(_0x5dbf('0xd2')));_0x38b629[_0x5dbf('0x6')]('/api/cm/lists',require(_0x5dbf('0xd3')));_0x38b629[_0x5dbf('0x6')](_0x5dbf('0xd4'),require(_0x5dbf('0xd5')));_0x38b629['use'](_0x5dbf('0xd6'),require(_0x5dbf('0xd7')));_0x38b629[_0x5dbf('0x6')](_0x5dbf('0xd8'),require(_0x5dbf('0xd9')));_0x38b629['use'](_0x5dbf('0xda'),require(_0x5dbf('0xdb')));_0x38b629['use']('/api/userNotifications',require(_0x5dbf('0xdc')));_0x38b629[_0x5dbf('0x6')](_0x5dbf('0xdd'),require(_0x5dbf('0xde')));_0x38b629[_0x5dbf('0x6')](_0x5dbf('0xdf'),require(_0x5dbf('0xe0')));_0x38b629['use'](_0x5dbf('0xe1'),require(_0x5dbf('0xe2')));_0x38b629[_0x5dbf('0x6')](_0x5dbf('0xe3'),require(_0x5dbf('0xe4')));_0x38b629[_0x5dbf('0x6')]('/api/whatsapp/reports/queue',require(_0x5dbf('0xe5')));_0x38b629[_0x5dbf('0x6')](_0x5dbf('0xe6'),require(_0x5dbf('0xe7')));_0x38b629[_0x5dbf('0x6')]('/api/whatsapp/queues',require(_0x5dbf('0xe8')));_0x38b629['use']('/api/cloudProviders',require('./api/cloudProvider'));_0x38b629['use'](_0x5dbf('0xe9'),require(_0x5dbf('0xea')));_0x38b629[_0x5dbf('0x6')](_0x5dbf('0xeb'),require(_0x5dbf('0xec')));_0x38b629['use']('/api/auth/local',require(_0x5dbf('0xed')));_0x38b629['use'](_0x5dbf('0xee'),require(_0x5dbf('0xef')));_0x38b629['use'](_0x5dbf('0xf0'),require('./api/authActiveDirectory'));_0x38b629[_0x5dbf('0x6')](_0x5dbf('0xf1'),require(_0x5dbf('0xf2')));_0x38b629[_0x5dbf('0x6')](_0x5dbf('0xf3'),require('./api/rpc'));_0x38b629[_0x5dbf('0x6')](_0x5dbf('0xf4'),require(_0x5dbf('0xf5')));_0x38b629[_0x5dbf('0x6')]('/api/system',require(_0x5dbf('0xf6')));_0x38b629[_0x5dbf('0x6')](_0x5dbf('0xf7'),require(_0x5dbf('0xf8')));_0x38b629[_0x5dbf('0x6')](_0x5dbf('0xf9'),require(_0x5dbf('0xfa')));_0x38b629[_0x5dbf('0x6')]('/api/logs',clientSideLogs);_0x38b629['use'](_0x5dbf('0xfb'),express[_0x5dbf('0xfc')](path[_0x5dbf('0xfd')](config['root'],'/apidoc')));_0x38b629['use'](_0x5dbf('0xfe'),express[_0x5dbf('0xfc')](path[_0x5dbf('0xfd')](config[_0x5dbf('0xff')],_0x5dbf('0xfe'))));_0x38b629[_0x5dbf('0x6')]('/demo',express[_0x5dbf('0xfc')](path[_0x5dbf('0xfd')](config['root'],'/demo')));_0x38b629[_0x5dbf('0x6')]('/snippet',express['static'](path[_0x5dbf('0xfd')](config[_0x5dbf('0xff')],_0x5dbf('0x100'),'3.0.0')));_0x38b629[_0x5dbf('0x6')](_0x5dbf('0x101'),express['static'](path[_0x5dbf('0xfd')](config[_0x5dbf('0xff')],_0x5dbf('0x102'))));_0x38b629[_0x5dbf('0x103')](_0x5dbf('0x104'))[_0x5dbf('0x105')](errors[0x194]);_0x38b629[_0x5dbf('0x103')]('/*')[_0x5dbf('0x105')](function(_0x551b29,_0x50c701){_0x50c701['sendFile'](path[_0x5dbf('0x106')](_0x38b629[_0x5dbf('0x105')](_0x5dbf('0x107'))+_0x5dbf('0x108')));});return _0x38b629;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index a4abe4f..686430f 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xba92=['../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/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/template/template.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareRecording/squareRecording.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','http','rpc','port','localhost','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','lodash','listen','merge','../api/user/user.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailMessage/mailMessage.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc'];(function(_0x2481f9,_0x786f4d){var _0x58ed9f=function(_0x13b675){while(--_0x13b675){_0x2481f9['push'](_0x2481f9['shift']());}};_0x58ed9f(++_0x786f4d);}(_0xba92,0x105));var _0x2ba9=function(_0x485c04,_0x459615){_0x485c04=_0x485c04-0x0;var _0xa516ae=_0xba92[_0x485c04];return _0xa516ae;};'use strict';var jayson=require('jayson/promise');var _=require(_0x2ba9('0x0'));var config=require('../config/environment');exports[_0x2ba9('0x1')]=function(){return new Promise(function(_0x2bd971,_0x37d471){var _0x1d83ee={};_0x1d83ee=_[_0x2ba9('0x2')](_0x1d83ee,require(_0x2ba9('0x3')));_0x1d83ee=_[_0x2ba9('0x2')](_0x1d83ee,require('../api/voiceExtension/voiceExtension.rpc'));_0x1d83ee=_[_0x2ba9('0x2')](_0x1d83ee,require(_0x2ba9('0x4')));_0x1d83ee=_[_0x2ba9('0x2')](_0x1d83ee,require(_0x2ba9('0x5')));_0x1d83ee=_['merge'](_0x1d83ee,require('../api/voiceCallReport/voiceCallReport.rpc'));_0x1d83ee=_[_0x2ba9('0x2')](_0x1d83ee,require(_0x2ba9('0x6')));_0x1d83ee=_[_0x2ba9('0x2')](_0x1d83ee,require(_0x2ba9('0x7')));_0x1d83ee=_['merge'](_0x1d83ee,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0x1d83ee=_[_0x2ba9('0x2')](_0x1d83ee,require(_0x2ba9('0x8')));_0x1d83ee=_[_0x2ba9('0x2')](_0x1d83ee,require(_0x2ba9('0x9')));_0x1d83ee=_[_0x2ba9('0x2')](_0x1d83ee,require(_0x2ba9('0xa')));_0x1d83ee=_[_0x2ba9('0x2')](_0x1d83ee,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x1d83ee=_[_0x2ba9('0x2')](_0x1d83ee,require(_0x2ba9('0xb')));_0x1d83ee=_[_0x2ba9('0x2')](_0x1d83ee,require(_0x2ba9('0xc')));_0x1d83ee=_[_0x2ba9('0x2')](_0x1d83ee,require(_0x2ba9('0xd')));_0x1d83ee=_[_0x2ba9('0x2')](_0x1d83ee,require('../api/mailInteraction/mailInteraction.rpc'));_0x1d83ee=_[_0x2ba9('0x2')](_0x1d83ee,require(_0x2ba9('0xe')));_0x1d83ee=_['merge'](_0x1d83ee,require('../api/mailApplication/mailApplication.rpc'));_0x1d83ee=_['merge'](_0x1d83ee,require(_0x2ba9('0xf')));_0x1d83ee=_[_0x2ba9('0x2')](_0x1d83ee,require(_0x2ba9('0x10')));_0x1d83ee=_['merge'](_0x1d83ee,require(_0x2ba9('0x11')));_0x1d83ee=_[_0x2ba9('0x2')](_0x1d83ee,require(_0x2ba9('0x12')));_0x1d83ee=_['merge'](_0x1d83ee,require('../api/faxMessage/faxMessage.rpc'));_0x1d83ee=_[_0x2ba9('0x2')](_0x1d83ee,require(_0x2ba9('0x13')));_0x1d83ee=_[_0x2ba9('0x2')](_0x1d83ee,require(_0x2ba9('0x14')));_0x1d83ee=_[_0x2ba9('0x2')](_0x1d83ee,require(_0x2ba9('0x15')));_0x1d83ee=_['merge'](_0x1d83ee,require(_0x2ba9('0x16')));_0x1d83ee=_[_0x2ba9('0x2')](_0x1d83ee,require(_0x2ba9('0x17')));_0x1d83ee=_[_0x2ba9('0x2')](_0x1d83ee,require('../api/smsQueue/smsQueue.rpc'));_0x1d83ee=_[_0x2ba9('0x2')](_0x1d83ee,require(_0x2ba9('0x18')));_0x1d83ee=_[_0x2ba9('0x2')](_0x1d83ee,require('../api/openchannelInteraction/openchannelInteraction.rpc'));_0x1d83ee=_[_0x2ba9('0x2')](_0x1d83ee,require(_0x2ba9('0x19')));_0x1d83ee=_[_0x2ba9('0x2')](_0x1d83ee,require('../api/openchannelQueue/openchannelQueue.rpc'));_0x1d83ee=_[_0x2ba9('0x2')](_0x1d83ee,require(_0x2ba9('0x1a')));_0x1d83ee=_[_0x2ba9('0x2')](_0x1d83ee,require('../api/chatInteraction/chatInteraction.rpc'));_0x1d83ee=_[_0x2ba9('0x2')](_0x1d83ee,require(_0x2ba9('0x1b')));_0x1d83ee=_[_0x2ba9('0x2')](_0x1d83ee,require(_0x2ba9('0x1c')));_0x1d83ee=_['merge'](_0x1d83ee,require(_0x2ba9('0x1d')));_0x1d83ee=_[_0x2ba9('0x2')](_0x1d83ee,require('../api/cmHopper/cmHopper.rpc'));_0x1d83ee=_[_0x2ba9('0x2')](_0x1d83ee,require(_0x2ba9('0x1e')));_0x1d83ee=_[_0x2ba9('0x2')](_0x1d83ee,require(_0x2ba9('0x1f')));_0x1d83ee=_[_0x2ba9('0x2')](_0x1d83ee,require('../api/cmHopperHistory/cmHopperHistory.rpc'));_0x1d83ee=_['merge'](_0x1d83ee,require(_0x2ba9('0x20')));_0x1d83ee=_[_0x2ba9('0x2')](_0x1d83ee,require(_0x2ba9('0x21')));_0x1d83ee=_['merge'](_0x1d83ee,require(_0x2ba9('0x22')));_0x1d83ee=_[_0x2ba9('0x2')](_0x1d83ee,require(_0x2ba9('0x23')));_0x1d83ee=_[_0x2ba9('0x2')](_0x1d83ee,require(_0x2ba9('0x24')));_0x1d83ee=_[_0x2ba9('0x2')](_0x1d83ee,require('../api/trigger/trigger.rpc'));_0x1d83ee=_[_0x2ba9('0x2')](_0x1d83ee,require(_0x2ba9('0x25')));_0x1d83ee=_['merge'](_0x1d83ee,require(_0x2ba9('0x26')));_0x1d83ee=_[_0x2ba9('0x2')](_0x1d83ee,require(_0x2ba9('0x27')));_0x1d83ee=_['merge'](_0x1d83ee,require(_0x2ba9('0x28')));_0x1d83ee=_[_0x2ba9('0x2')](_0x1d83ee,require('../api/intZohoAccount/intZohoAccount.rpc'));_0x1d83ee=_[_0x2ba9('0x2')](_0x1d83ee,require(_0x2ba9('0x29')));_0x1d83ee=_[_0x2ba9('0x2')](_0x1d83ee,require(_0x2ba9('0x2a')));_0x1d83ee=_[_0x2ba9('0x2')](_0x1d83ee,require(_0x2ba9('0x2b')));_0x1d83ee=_[_0x2ba9('0x2')](_0x1d83ee,require(_0x2ba9('0x2c')));_0x1d83ee=_[_0x2ba9('0x2')](_0x1d83ee,require(_0x2ba9('0x2d')));_0x1d83ee=_[_0x2ba9('0x2')](_0x1d83ee,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x1d83ee=_['merge'](_0x1d83ee,require(_0x2ba9('0x2e')));_0x1d83ee=_[_0x2ba9('0x2')](_0x1d83ee,require(_0x2ba9('0x2f')));_0x1d83ee=_[_0x2ba9('0x2')](_0x1d83ee,require(_0x2ba9('0x30')));_0x1d83ee=_[_0x2ba9('0x2')](_0x1d83ee,require(_0x2ba9('0x31')));_0x1d83ee=_[_0x2ba9('0x2')](_0x1d83ee,require('../api/setting/setting.rpc'));_0x1d83ee=_[_0x2ba9('0x2')](_0x1d83ee,require(_0x2ba9('0x32')));_0x1d83ee=_['merge'](_0x1d83ee,require('../api/squareProject/squareProject.rpc'));_0x1d83ee=_['merge'](_0x1d83ee,require(_0x2ba9('0x33')));_0x1d83ee=_[_0x2ba9('0x2')](_0x1d83ee,require('../api/squareMessage/squareMessage.rpc'));_0x1d83ee=_['merge'](_0x1d83ee,require(_0x2ba9('0x34')));_0x1d83ee=_[_0x2ba9('0x2')](_0x1d83ee,require(_0x2ba9('0x35')));_0x1d83ee=_[_0x2ba9('0x2')](_0x1d83ee,require(_0x2ba9('0x36')));_0x1d83ee=_[_0x2ba9('0x2')](_0x1d83ee,require(_0x2ba9('0x37')));_0x1d83ee=_['merge'](_0x1d83ee,require(_0x2ba9('0x38')));_0x1d83ee=_[_0x2ba9('0x2')](_0x1d83ee,require(_0x2ba9('0x39')));_0x1d83ee=_['merge'](_0x1d83ee,require(_0x2ba9('0x3a')));_0x1d83ee=_['merge'](_0x1d83ee,require(_0x2ba9('0x3b')));var _0x28bf52=jayson['server'](_0x1d83ee)[_0x2ba9('0x3c')]();var _0xad71ab=config[_0x2ba9('0x3d')][_0x2ba9('0x3e')]||config[_0x2ba9('0x3e')]+0x1;var _0x3a00b7=config[_0x2ba9('0x3d')]['ip']||_0x2ba9('0x3f');_0x28bf52['on'](_0x2ba9('0x40'),function(_0x199502){return _0x37d471(_0x199502);});_0x28bf52['listen'](_0xad71ab,_0x3a00b7,function(){console[_0x2ba9('0x41')](_0x2ba9('0x42'),_0x3a00b7,_0xad71ab);require(_0x2ba9('0x43'))[_0x2ba9('0x44')]();return _0x2bd971(_0x2ba9('0x45')+_0x3a00b7+':'+_0xad71ab);});});}; \ No newline at end of file +var _0xfd33=['../api/voiceDialReport/voiceDialReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/faxAccount/faxAccount.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/smsAccount/smsAccount.rpc','../api/smsMessage/smsMessage.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/reportAgentPreview/reportAgentPreview.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/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','rpc','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','RPC\x20listening\x20on\x20','jayson/promise','lodash','merge','../api/user/user.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc'];(function(_0x22ad4d,_0x373f4e){var _0xe03222=function(_0x42bb9e){while(--_0x42bb9e){_0x22ad4d['push'](_0x22ad4d['shift']());}};_0xe03222(++_0x373f4e);}(_0xfd33,0x185));var _0x3fd3=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0xfd33[_0x1b349a];return _0x5d1f7c;};'use strict';var jayson=require(_0x3fd3('0x0'));var _=require(_0x3fd3('0x1'));var config=require('../config/environment');exports['listen']=function(){return new Promise(function(_0x2498f5,_0xfc5ff5){var _0xf957c1={};_0xf957c1=_[_0x3fd3('0x2')](_0xf957c1,require(_0x3fd3('0x3')));_0xf957c1=_[_0x3fd3('0x2')](_0xf957c1,require('../api/voiceExtension/voiceExtension.rpc'));_0xf957c1=_['merge'](_0xf957c1,require(_0x3fd3('0x4')));_0xf957c1=_['merge'](_0xf957c1,require(_0x3fd3('0x5')));_0xf957c1=_[_0x3fd3('0x2')](_0xf957c1,require(_0x3fd3('0x6')));_0xf957c1=_[_0x3fd3('0x2')](_0xf957c1,require(_0x3fd3('0x7')));_0xf957c1=_[_0x3fd3('0x2')](_0xf957c1,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0xf957c1=_[_0x3fd3('0x2')](_0xf957c1,require(_0x3fd3('0x8')));_0xf957c1=_[_0x3fd3('0x2')](_0xf957c1,require(_0x3fd3('0x9')));_0xf957c1=_[_0x3fd3('0x2')](_0xf957c1,require('../api/trunk/trunk.rpc'));_0xf957c1=_[_0x3fd3('0x2')](_0xf957c1,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0xf957c1=_[_0x3fd3('0x2')](_0xf957c1,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0xf957c1=_[_0x3fd3('0x2')](_0xf957c1,require(_0x3fd3('0xa')));_0xf957c1=_[_0x3fd3('0x2')](_0xf957c1,require(_0x3fd3('0xb')));_0xf957c1=_['merge'](_0xf957c1,require(_0x3fd3('0xc')));_0xf957c1=_[_0x3fd3('0x2')](_0xf957c1,require('../api/mailInteraction/mailInteraction.rpc'));_0xf957c1=_['merge'](_0xf957c1,require('../api/mailMessage/mailMessage.rpc'));_0xf957c1=_['merge'](_0xf957c1,require('../api/mailApplication/mailApplication.rpc'));_0xf957c1=_[_0x3fd3('0x2')](_0xf957c1,require('../api/mailQueueReport/mailQueueReport.rpc'));_0xf957c1=_[_0x3fd3('0x2')](_0xf957c1,require(_0x3fd3('0xd')));_0xf957c1=_[_0x3fd3('0x2')](_0xf957c1,require('../api/faxApplication/faxApplication.rpc'));_0xf957c1=_[_0x3fd3('0x2')](_0xf957c1,require(_0x3fd3('0xe')));_0xf957c1=_['merge'](_0xf957c1,require(_0x3fd3('0xf')));_0xf957c1=_[_0x3fd3('0x2')](_0xf957c1,require('../api/faxQueue/faxQueue.rpc'));_0xf957c1=_[_0x3fd3('0x2')](_0xf957c1,require('../api/faxQueueReport/faxQueueReport.rpc'));_0xf957c1=_['merge'](_0xf957c1,require(_0x3fd3('0x10')));_0xf957c1=_[_0x3fd3('0x2')](_0xf957c1,require('../api/smsInteraction/smsInteraction.rpc'));_0xf957c1=_[_0x3fd3('0x2')](_0xf957c1,require(_0x3fd3('0x11')));_0xf957c1=_[_0x3fd3('0x2')](_0xf957c1,require('../api/smsQueue/smsQueue.rpc'));_0xf957c1=_[_0x3fd3('0x2')](_0xf957c1,require(_0x3fd3('0x12')));_0xf957c1=_[_0x3fd3('0x2')](_0xf957c1,require(_0x3fd3('0x13')));_0xf957c1=_['merge'](_0xf957c1,require(_0x3fd3('0x14')));_0xf957c1=_[_0x3fd3('0x2')](_0xf957c1,require('../api/openchannelQueue/openchannelQueue.rpc'));_0xf957c1=_[_0x3fd3('0x2')](_0xf957c1,require(_0x3fd3('0x15')));_0xf957c1=_[_0x3fd3('0x2')](_0xf957c1,require(_0x3fd3('0x16')));_0xf957c1=_[_0x3fd3('0x2')](_0xf957c1,require(_0x3fd3('0x17')));_0xf957c1=_[_0x3fd3('0x2')](_0xf957c1,require(_0x3fd3('0x18')));_0xf957c1=_[_0x3fd3('0x2')](_0xf957c1,require(_0x3fd3('0x19')));_0xf957c1=_[_0x3fd3('0x2')](_0xf957c1,require(_0x3fd3('0x1a')));_0xf957c1=_['merge'](_0xf957c1,require('../api/cmHopperBlack/cmHopperBlack.rpc'));_0xf957c1=_['merge'](_0xf957c1,require(_0x3fd3('0x1b')));_0xf957c1=_[_0x3fd3('0x2')](_0xf957c1,require('../api/cmHopperHistory/cmHopperHistory.rpc'));_0xf957c1=_[_0x3fd3('0x2')](_0xf957c1,require(_0x3fd3('0x1c')));_0xf957c1=_['merge'](_0xf957c1,require(_0x3fd3('0x1d')));_0xf957c1=_[_0x3fd3('0x2')](_0xf957c1,require(_0x3fd3('0x1e')));_0xf957c1=_[_0x3fd3('0x2')](_0xf957c1,require(_0x3fd3('0x1f')));_0xf957c1=_[_0x3fd3('0x2')](_0xf957c1,require(_0x3fd3('0x20')));_0xf957c1=_['merge'](_0xf957c1,require(_0x3fd3('0x21')));_0xf957c1=_[_0x3fd3('0x2')](_0xf957c1,require(_0x3fd3('0x22')));_0xf957c1=_['merge'](_0xf957c1,require(_0x3fd3('0x23')));_0xf957c1=_[_0x3fd3('0x2')](_0xf957c1,require(_0x3fd3('0x24')));_0xf957c1=_[_0x3fd3('0x2')](_0xf957c1,require(_0x3fd3('0x25')));_0xf957c1=_[_0x3fd3('0x2')](_0xf957c1,require(_0x3fd3('0x26')));_0xf957c1=_['merge'](_0xf957c1,require(_0x3fd3('0x27')));_0xf957c1=_[_0x3fd3('0x2')](_0xf957c1,require(_0x3fd3('0x28')));_0xf957c1=_[_0x3fd3('0x2')](_0xf957c1,require(_0x3fd3('0x29')));_0xf957c1=_[_0x3fd3('0x2')](_0xf957c1,require(_0x3fd3('0x2a')));_0xf957c1=_['merge'](_0xf957c1,require(_0x3fd3('0x2b')));_0xf957c1=_[_0x3fd3('0x2')](_0xf957c1,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0xf957c1=_[_0x3fd3('0x2')](_0xf957c1,require(_0x3fd3('0x2c')));_0xf957c1=_['merge'](_0xf957c1,require(_0x3fd3('0x2d')));_0xf957c1=_[_0x3fd3('0x2')](_0xf957c1,require(_0x3fd3('0x2e')));_0xf957c1=_['merge'](_0xf957c1,require('../api/squareReportDetail/squareReportDetail.rpc'));_0xf957c1=_[_0x3fd3('0x2')](_0xf957c1,require(_0x3fd3('0x2f')));_0xf957c1=_['merge'](_0xf957c1,require(_0x3fd3('0x30')));_0xf957c1=_['merge'](_0xf957c1,require(_0x3fd3('0x31')));_0xf957c1=_[_0x3fd3('0x2')](_0xf957c1,require('../api/squareRecording/squareRecording.rpc'));_0xf957c1=_[_0x3fd3('0x2')](_0xf957c1,require(_0x3fd3('0x32')));_0xf957c1=_['merge'](_0xf957c1,require(_0x3fd3('0x33')));_0xf957c1=_[_0x3fd3('0x2')](_0xf957c1,require(_0x3fd3('0x34')));_0xf957c1=_['merge'](_0xf957c1,require(_0x3fd3('0x35')));_0xf957c1=_[_0x3fd3('0x2')](_0xf957c1,require(_0x3fd3('0x36')));_0xf957c1=_[_0x3fd3('0x2')](_0xf957c1,require(_0x3fd3('0x37')));_0xf957c1=_[_0x3fd3('0x2')](_0xf957c1,require(_0x3fd3('0x38')));_0xf957c1=_[_0x3fd3('0x2')](_0xf957c1,require(_0x3fd3('0x39')));_0xf957c1=_['merge'](_0xf957c1,require(_0x3fd3('0x3a')));var _0x1e7169=jayson[_0x3fd3('0x3b')](_0xf957c1)['http']();var _0x462ba6=config[_0x3fd3('0x3c')]['port']||config['port']+0x1;var _0x524e29=config['rpc']['ip']||'localhost';_0x1e7169['on'](_0x3fd3('0x3d'),function(_0x4a4e72){return _0xfc5ff5(_0x4a4e72);});_0x1e7169['listen'](_0x462ba6,_0x524e29,function(){console[_0x3fd3('0x3e')](_0x3fd3('0x3f'),_0x524e29,_0x462ba6);require(_0x3fd3('0x40'))['default']();return _0x2498f5(_0x3fd3('0x41')+_0x524e29+':'+_0x462ba6);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 85011c8..6b4c902 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 _0x980e=['setTimeout','setEncoding','utf8','headers','ready','line','hangup','emit','substring','520-Invalid','no\x20code','replace','result=','indexOf','substr','length','error','code','close','E_AGI_SOCKET_CLOSE','timeout','pipe','command','write','destroy','prototype','sync','sendRequest','ANSWER','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','join','format','EXEC\x20%s\x20%s','setContext','SET\x20CONTEXT\x20%s','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','isNumber','SET\x20VARIABLE\x20%s\x20\x22%s\x22','toString','SAY\x20NUMBER\x20%s\x20%s','sayDigits','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','EventEmitter','./error','call'];(function(_0x4dcf1d,_0x491ea1){var _0x773104=function(_0x4f45c9){while(--_0x4f45c9){_0x4dcf1d['push'](_0x4dcf1d['shift']());}};_0x773104(++_0x491ea1);}(_0x980e,0x1a6));var _0xe980=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x980e[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0xe980('0x0'));var _=require('lodash');var EventEmitter=require('events')[_0xe980('0x1')];var AGIReply=require('./reply');var AGIError=require(_0xe980('0x2'));function AGIChannel(_0x53cd36){var _0x2e82ea=this,_0x274b04=new AGIReply(),_0x599c53=![],_0x4eb599={};EventEmitter[_0xe980('0x3')](_0x2e82ea);_0x53cd36['setEncoding']('utf8');_0x53cd36[_0xe980('0x4')](0x8*0x3c*0x3c*0x3e8);_0x274b04[_0xe980('0x5')](_0xe980('0x6'));_0x274b04['on'](_0xe980('0x7'),function(_0x2d76d0){for(var _0x44995d in _0x2d76d0){_0x2e82ea[_0x44995d]=_0x2d76d0[_0x44995d];}_0x2e82ea['emit'](_0xe980('0x8'));});_0x274b04['on'](_0xe980('0x9'),function(_0x323b26){if(_0x323b26['toLowerCase']()==_0xe980('0xa')){_0x2e82ea[_0xe980('0xb')](_0xe980('0xa'));return;}if(_0x323b26[_0xe980('0xc')](0x0,0xb)==_0xe980('0xd')){_0x599c53=!![];}if(_0x599c53){_0x4eb599['rx']+=_0x323b26+'\x0a';if(_0x323b26['search']('520\x20End\x20of\x20proper')!=-0x1){_0x599c53=![];}}else{_0x4eb599['rx']=_0x323b26;}if(_0x599c53){return;}if(typeof _0x4eb599['cb']=='function'){var _0x23c9cc=_0x4eb599['rx']['substring'](0x0,0x3),_0x234b1b=null,_0x58c367=null;_0x23c9cc=parseInt(_0x23c9cc);if(isNaN(_0x23c9cc)){_0x4eb599['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0xe980('0xe')});return;}if(_0x23c9cc!=0xc8){_0x4eb599['cb'](null,{'code':_0x23c9cc,'result':-0x1,'extra':'KO'});return;}_0x234b1b=_0x4eb599['rx'][_0xe980('0xc')](0x4)[_0xe980('0xf')](_0xe980('0x10'),'');if(_0x234b1b[_0xe980('0x11')]('\x20')!=-0x1){_0x234b1b=_0x234b1b[_0xe980('0x12')](0x0,_0x234b1b[_0xe980('0x11')]('\x20'));}if(_['startsWith'](_0x234b1b,'-1')){_0x234b1b=parseInt(_0x234b1b);}_0x58c367=_0x4eb599['rx']['split']('\x20');if(_0x58c367['length']==0x3){_0x58c367=_0x58c367[0x2][_0xe980('0xc')](0x1,_0x58c367[0x2][_0xe980('0x13')]-0x1);}else if(_0x58c367[_0xe980('0x13')]>0x3){var _0x406418=/\((.+)\)/;var _0x29593c=_0x4eb599['rx']['match'](_0x406418);if(_0x29593c){_0x58c367=_0x29593c[0x1];}else{_0x58c367=null;}}else{_0x58c367=null;}_0x4eb599['cb'](null,{'code':_0x23c9cc,'result':_0x234b1b,'extra':_0x58c367});}});_0x53cd36['on'](_0xe980('0x14'),function(_0x1c6354){_0x2e82ea[_0xe980('0xb')]('error',new AGIError('E_AGI_SOCKET_ERROR',_0x1c6354[_0xe980('0x15')]));});_0x53cd36['on'](_0xe980('0x16'),function(){_0x2e82ea[_0xe980('0xb')](_0xe980('0x16'),new AGIError(_0xe980('0x17')));});_0x53cd36['on'](_0xe980('0x18'),function(){_0x2e82ea[_0xe980('0xb')](_0xe980('0x18'),new AGIError('E_AGI_SOCKET_TIMEOUT'));_0x53cd36['destroy']();});_0x53cd36[_0xe980('0x19')](_0x274b04);this[_0xe980('0x1a')]=function(_0x1bd7ea,_0x4f929f){var _0x1bd7ea=_0x1bd7ea||'',_0x4f929f=typeof _0x4f929f=='function'?_0x4f929f:new Function();_0x4eb599={'tx':_0x1bd7ea,'rx':'','cb':_0x4f929f};_0x53cd36[_0xe980('0x1b')](_0x1bd7ea+'\x0a');},this[_0xe980('0x16')]=function(){_0x53cd36[_0xe980('0x1c')]();};}util['inherits'](AGIChannel,EventEmitter);AGIChannel[_0xe980('0x1d')]['sendRequest']=function(_0x2a87e3){return this[_0xe980('0x1a')][_0xe980('0x1e')](this,_0x2a87e3);};AGIChannel[_0xe980('0x1d')]['answer']=function(){return this[_0xe980('0x1f')](_0xe980('0x20'));};AGIChannel[_0xe980('0x1d')]['getData']=function(_0x54e755,_0x1628bd,_0x138a75){_0x54e755=_0x54e755===undefined?'beep':_0x54e755;_0x1628bd=_0x1628bd===undefined?'5':_0x1628bd;_0x138a75=_0x138a75===undefined?'1':_0x138a75;return this[_0xe980('0x1f')](util['format'](_0xe980('0x21'),_0x54e755,_0x1628bd*0x3e8,_0x138a75));};AGIChannel[_0xe980('0x1d')][_0xe980('0x22')]=function(_0x3ef831){_0x3ef831=_0x3ef831||_0xe980('0x23');return this[_0xe980('0x1f')](util['format'](_0xe980('0x24'),_0x3ef831));};AGIChannel['prototype'][_0xe980('0x25')]=function(_0x24a29e,_0x421ef9){if(_[_0xe980('0x26')](_0x421ef9)){return this[_0xe980('0x1f')](util['format']('EXEC\x20%s\x20%s',_0x24a29e,_0x421ef9[_0xe980('0x27')](',')));}return this[_0xe980('0x1f')](util[_0xe980('0x28')](_0xe980('0x29'),_0x24a29e,_0x421ef9));};AGIChannel[_0xe980('0x1d')][_0xe980('0x2a')]=function(_0x3d2fb1){return this[_0xe980('0x1f')](util[_0xe980('0x28')](_0xe980('0x2b'),_0x3d2fb1));};AGIChannel[_0xe980('0x1d')]['setExtension']=function(_0x4a8bbe){return this[_0xe980('0x1f')](util[_0xe980('0x28')](_0xe980('0x2c'),_0x4a8bbe));};AGIChannel['prototype'][_0xe980('0x2d')]=function(_0x4b9586){return this[_0xe980('0x1f')](util[_0xe980('0x28')](_0xe980('0x2e'),_0x4b9586));};AGIChannel[_0xe980('0x1d')][_0xe980('0xa')]=function(){return this[_0xe980('0x1f')](_0xe980('0x2f'));};AGIChannel[_0xe980('0x1d')]['setVariable']=function(_0x5a4d44,_0x2d3ef7){var _0x2625cf=_['isBoolean'](_0x2d3ef7)||_[_0xe980('0x30')](_0x2d3ef7)?_0x2d3ef7['toString']():_0x2d3ef7;return this[_0xe980('0x1f')](util[_0xe980('0x28')](_0xe980('0x31'),_0x5a4d44,_0x2625cf?_0x2625cf[_0xe980('0x32')]()[_0xe980('0xf')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0xe980('0x1d')]['sayNumber']=function(_0x11fb5b,_0x1f16c7){return this[_0xe980('0x1f')](util[_0xe980('0x28')](_0xe980('0x33'),_0x11fb5b,_0x1f16c7));};AGIChannel['prototype'][_0xe980('0x34')]=function(_0x1f35ed,_0x1faffe){return this['sendRequest'](util[_0xe980('0x28')]('SAY\x20DIGITS\x20%s\x20%s',_0x1f35ed,_0x1faffe));};AGIChannel[_0xe980('0x1d')][_0xe980('0x35')]=function(_0x577d17,_0x5f0958){return this[_0xe980('0x1f')](util[_0xe980('0x28')](_0xe980('0x36'),_0x577d17,_0x5f0958));};AGIChannel[_0xe980('0x1d')][_0xe980('0x37')]=function(_0x1368d6,_0x5c5d5a,_0x30b359){_0x5c5d5a=_0x5c5d5a||this[_0xe980('0x38')];_0x30b359=_0x30b359||0x1;this[_0xe980('0x2a')](_0x1368d6);this['setExtension'](_0x5c5d5a);this[_0xe980('0x2d')](_0x30b359);return this[_0xe980('0x22')](util[_0xe980('0x28')]('GOTO\x20%s\x20%s\x20%s',_0x1368d6,_0x5c5d5a,_0x30b359));};AGIChannel[_0xe980('0x1d')][_0xe980('0x39')]=function(_0x528161){return this[_0xe980('0x1f')](util[_0xe980('0x28')](_0xe980('0x3a'),_0x528161));};AGIChannel[_0xe980('0x1d')][_0xe980('0x3b')]=function(_0x2e0f32,_0x556937,_0x124d0c,_0x1c6853,_0x1e04c2,_0x1619c5){_0x556937=_0x556937||'wav';_0x124d0c=_0x124d0c||'';_0x1c6853=_0x1c6853===undefined?-0x1:_0x1c6853==='-1'?-0x1:_0x1c6853*0x3e8;_0x1e04c2=_0x1e04c2===undefined?'':'s='+_0x1e04c2;_0x1619c5=_0x1619c5?_0xe980('0x3c'):'';return this[_0xe980('0x1f')](util[_0xe980('0x28')](_0xe980('0x3d'),_0x2e0f32,_0x556937,_0x124d0c,_0x1c6853,_0x1619c5,_0x1e04c2));};AGIChannel[_0xe980('0x1d')][_0xe980('0x3e')]=function(_0x572095,_0x30855d){_0x30855d=_0x30855d||'';return this[_0xe980('0x1f')](util[_0xe980('0x28')](_0xe980('0x3f'),_0x572095,_0x30855d));};AGIChannel[_0xe980('0x1d')][_0xe980('0x40')]=function(_0x45a918){return this[_0xe980('0x25')](_0xe980('0x41'),_0x45a918);};AGIChannel[_0xe980('0x1d')][_0xe980('0x42')]=function(_0x39dd69){return this[_0xe980('0x25')](_0xe980('0x43'),_0x39dd69);};AGIChannel['prototype']['error']=function(_0x8b1e4,_0x40b9da){this[_0xe980('0x22')](util['format'](_0xe980('0x44'),_0x8b1e4['id'],_0x8b1e4[_0xe980('0x45')],_0x40b9da));return{'code':0x1f4,'result':'-1','extra':''};};module[_0xe980('0x46')]=AGIChannel; \ No newline at end of file +var _0x49e5=['sync','prototype','ANSWER','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','NO\x20MESSAGE','exec','isArray','EXEC\x20%s\x20%s','join','setContext','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','SAY\x20NUMBER\x20%s\x20%s','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','noop','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','AGI','wait','WAIT','label','util','lodash','events','EventEmitter','./reply','setEncoding','utf8','headers','ready','line','toLowerCase','hangup','emit','substring','search','520\x20End\x20of\x20proper','function','replace','result=','indexOf','substr','startsWith','split','length','match','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','write','inherits','sendRequest'];(function(_0x52a8c3,_0x36048e){var _0x2bad08=function(_0x346610){while(--_0x346610){_0x52a8c3['push'](_0x52a8c3['shift']());}};_0x2bad08(++_0x36048e);}(_0x49e5,0x71));var _0x549e=function(_0x34729c,_0x2b2c09){_0x34729c=_0x34729c-0x0;var _0x34814d=_0x49e5[_0x34729c];return _0x34814d;};'use strict';var util=require(_0x549e('0x0'));var _=require(_0x549e('0x1'));var EventEmitter=require(_0x549e('0x2'))[_0x549e('0x3')];var AGIReply=require(_0x549e('0x4'));var AGIError=require('./error');function AGIChannel(_0x34b3fb){var _0x1d067b=this,_0x27468e=new AGIReply(),_0x3fb4a3=![],_0x26f864={};EventEmitter['call'](_0x1d067b);_0x34b3fb[_0x549e('0x5')]('utf8');_0x34b3fb['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x27468e[_0x549e('0x5')](_0x549e('0x6'));_0x27468e['on'](_0x549e('0x7'),function(_0x5e3c38){for(var _0x555864 in _0x5e3c38){_0x1d067b[_0x555864]=_0x5e3c38[_0x555864];}_0x1d067b['emit'](_0x549e('0x8'));});_0x27468e['on'](_0x549e('0x9'),function(_0x254556){if(_0x254556[_0x549e('0xa')]()==_0x549e('0xb')){_0x1d067b[_0x549e('0xc')]('hangup');return;}if(_0x254556[_0x549e('0xd')](0x0,0xb)=='520-Invalid'){_0x3fb4a3=!![];}if(_0x3fb4a3){_0x26f864['rx']+=_0x254556+'\x0a';if(_0x254556[_0x549e('0xe')](_0x549e('0xf'))!=-0x1){_0x3fb4a3=![];}}else{_0x26f864['rx']=_0x254556;}if(_0x3fb4a3){return;}if(typeof _0x26f864['cb']==_0x549e('0x10')){var _0x4c2f34=_0x26f864['rx'][_0x549e('0xd')](0x0,0x3),_0x3168da=null,_0x46e8f9=null;_0x4c2f34=parseInt(_0x4c2f34);if(isNaN(_0x4c2f34)){_0x26f864['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0x4c2f34!=0xc8){_0x26f864['cb'](null,{'code':_0x4c2f34,'result':-0x1,'extra':'KO'});return;}_0x3168da=_0x26f864['rx'][_0x549e('0xd')](0x4)[_0x549e('0x11')](_0x549e('0x12'),'');if(_0x3168da[_0x549e('0x13')]('\x20')!=-0x1){_0x3168da=_0x3168da[_0x549e('0x14')](0x0,_0x3168da[_0x549e('0x13')]('\x20'));}if(_[_0x549e('0x15')](_0x3168da,'-1')){_0x3168da=parseInt(_0x3168da);}_0x46e8f9=_0x26f864['rx'][_0x549e('0x16')]('\x20');if(_0x46e8f9[_0x549e('0x17')]==0x3){_0x46e8f9=_0x46e8f9[0x2][_0x549e('0xd')](0x1,_0x46e8f9[0x2][_0x549e('0x17')]-0x1);}else if(_0x46e8f9[_0x549e('0x17')]>0x3){var _0x402c51=/\((.+)\)/;var _0x1c5877=_0x26f864['rx'][_0x549e('0x18')](_0x402c51);if(_0x1c5877){_0x46e8f9=_0x1c5877[0x1];}else{_0x46e8f9=null;}}else{_0x46e8f9=null;}_0x26f864['cb'](null,{'code':_0x4c2f34,'result':_0x3168da,'extra':_0x46e8f9});}});_0x34b3fb['on']('error',function(_0x294cb3){_0x1d067b[_0x549e('0xc')]('error',new AGIError(_0x549e('0x19'),_0x294cb3[_0x549e('0x1a')]));});_0x34b3fb['on'](_0x549e('0x1b'),function(){_0x1d067b[_0x549e('0xc')](_0x549e('0x1b'),new AGIError(_0x549e('0x1c')));});_0x34b3fb['on'](_0x549e('0x1d'),function(){_0x1d067b[_0x549e('0xc')](_0x549e('0x1d'),new AGIError(_0x549e('0x1e')));_0x34b3fb[_0x549e('0x1f')]();});_0x34b3fb[_0x549e('0x20')](_0x27468e);this[_0x549e('0x21')]=function(_0x58106b,_0x4cf942){var _0x58106b=_0x58106b||'',_0x4cf942=typeof _0x4cf942==_0x549e('0x10')?_0x4cf942:new Function();_0x26f864={'tx':_0x58106b,'rx':'','cb':_0x4cf942};_0x34b3fb[_0x549e('0x22')](_0x58106b+'\x0a');},this['close']=function(){_0x34b3fb['destroy']();};}util[_0x549e('0x23')](AGIChannel,EventEmitter);AGIChannel['prototype'][_0x549e('0x24')]=function(_0x3f06e2){return this[_0x549e('0x21')][_0x549e('0x25')](this,_0x3f06e2);};AGIChannel[_0x549e('0x26')]['answer']=function(){return this['sendRequest'](_0x549e('0x27'));};AGIChannel[_0x549e('0x26')][_0x549e('0x28')]=function(_0x425f53,_0x57f5cd,_0x4d54a3){_0x425f53=_0x425f53===undefined?_0x549e('0x29'):_0x425f53;_0x57f5cd=_0x57f5cd===undefined?'5':_0x57f5cd;_0x4d54a3=_0x4d54a3===undefined?'1':_0x4d54a3;return this[_0x549e('0x24')](util[_0x549e('0x2a')](_0x549e('0x2b'),_0x425f53,_0x57f5cd*0x3e8,_0x4d54a3));};AGIChannel[_0x549e('0x26')]['noop']=function(_0x15cc9f){_0x15cc9f=_0x15cc9f||_0x549e('0x2c');return this[_0x549e('0x24')](util['format']('VERBOSE\x20\x22%s\x22',_0x15cc9f));};AGIChannel[_0x549e('0x26')][_0x549e('0x2d')]=function(_0x187f22,_0x312836){if(_[_0x549e('0x2e')](_0x312836)){return this[_0x549e('0x24')](util[_0x549e('0x2a')](_0x549e('0x2f'),_0x187f22,_0x312836[_0x549e('0x30')](',')));}return this[_0x549e('0x24')](util['format'](_0x549e('0x2f'),_0x187f22,_0x312836));};AGIChannel[_0x549e('0x26')][_0x549e('0x31')]=function(_0x163a6b){return this[_0x549e('0x24')](util[_0x549e('0x2a')]('SET\x20CONTEXT\x20%s',_0x163a6b));};AGIChannel[_0x549e('0x26')]['setExtension']=function(_0x53ee95){return this[_0x549e('0x24')](util[_0x549e('0x2a')](_0x549e('0x32'),_0x53ee95));};AGIChannel['prototype'][_0x549e('0x33')]=function(_0x6435d7){return this[_0x549e('0x24')](util[_0x549e('0x2a')](_0x549e('0x34'),_0x6435d7));};AGIChannel['prototype'][_0x549e('0xb')]=function(){return this[_0x549e('0x24')](_0x549e('0x35'));};AGIChannel[_0x549e('0x26')]['setVariable']=function(_0x26de43,_0x141391){var _0x51b9ff=_[_0x549e('0x36')](_0x141391)||_[_0x549e('0x37')](_0x141391)?_0x141391[_0x549e('0x38')]():_0x141391;return this[_0x549e('0x24')](util[_0x549e('0x2a')](_0x549e('0x39'),_0x26de43,_0x51b9ff?_0x51b9ff[_0x549e('0x38')]()[_0x549e('0x11')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype'][_0x549e('0x3a')]=function(_0x19bfb9,_0x1de081){return this['sendRequest'](util[_0x549e('0x2a')](_0x549e('0x3b'),_0x19bfb9,_0x1de081));};AGIChannel[_0x549e('0x26')]['sayDigits']=function(_0x3b2037,_0x5c20c6){return this[_0x549e('0x24')](util[_0x549e('0x2a')](_0x549e('0x3c'),_0x3b2037,_0x5c20c6));};AGIChannel[_0x549e('0x26')][_0x549e('0x3d')]=function(_0xa4be34,_0x557c95){return this[_0x549e('0x24')](util[_0x549e('0x2a')]('SAY\x20PHONETIC\x20\x22%s\x22\x20%s',_0xa4be34,_0x557c95));};AGIChannel[_0x549e('0x26')]['continueAt']=function(_0x137cc1,_0x5ac7a0,_0x3301f8){_0x5ac7a0=_0x5ac7a0||this['extension'];_0x3301f8=_0x3301f8||0x1;this['setContext'](_0x137cc1);this['setExtension'](_0x5ac7a0);this[_0x549e('0x33')](_0x3301f8);return this[_0x549e('0x3e')](util['format'](_0x549e('0x3f'),_0x137cc1,_0x5ac7a0,_0x3301f8));};AGIChannel[_0x549e('0x26')][_0x549e('0x40')]=function(_0x49ddb0){return this['sendRequest'](util[_0x549e('0x2a')](_0x549e('0x41'),_0x49ddb0));};AGIChannel[_0x549e('0x26')][_0x549e('0x42')]=function(_0x229377,_0x55bd5e,_0x3ca28c,_0x56f7e5,_0x24a044,_0x21b5b3){_0x55bd5e=_0x55bd5e||_0x549e('0x43');_0x3ca28c=_0x3ca28c||'';_0x56f7e5=_0x56f7e5===undefined?-0x1:_0x56f7e5==='-1'?-0x1:_0x56f7e5*0x3e8;_0x24a044=_0x24a044===undefined?'':'s='+_0x24a044;_0x21b5b3=_0x21b5b3?_0x549e('0x44'):'';return this['sendRequest'](util[_0x549e('0x2a')]('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0x229377,_0x55bd5e,_0x3ca28c,_0x56f7e5,_0x21b5b3,_0x24a044));};AGIChannel[_0x549e('0x26')][_0x549e('0x45')]=function(_0x26c512,_0x446e14){_0x446e14=_0x446e14||'';return this[_0x549e('0x24')](util[_0x549e('0x2a')](_0x549e('0x46'),_0x26c512,_0x446e14));};AGIChannel[_0x549e('0x26')]['agi']=function(_0x9b64ef){return this[_0x549e('0x2d')](_0x549e('0x47'),_0x9b64ef);};AGIChannel[_0x549e('0x26')][_0x549e('0x48')]=function(_0x330dc0){return this[_0x549e('0x2d')](_0x549e('0x49'),_0x330dc0);};AGIChannel[_0x549e('0x26')]['error']=function(_0x29a873,_0x293ef8){this[_0x549e('0x3e')](util[_0x549e('0x2a')]('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x29a873['id'],_0x29a873[_0x549e('0x4a')],_0x293ef8));return{'code':0x1f4,'result':'-1','extra':''};};module['exports']=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index a2035db..59142b5 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 _0x98b8=['Undefined\x20error.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20closed.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','message','name','exports','util'];(function(_0x354164,_0x4c30de){var _0x5db9a8=function(_0x319b08){while(--_0x319b08){_0x354164['push'](_0x354164['shift']());}};_0x5db9a8(++_0x4c30de);}(_0x98b8,0xe0));var _0x898b=function(_0x350e9b,_0x42df13){_0x350e9b=_0x350e9b-0x0;var _0x4131d1=_0x98b8[_0x350e9b];return _0x4131d1;};'use strict';var util=require(_0x898b('0x0'));var error={'E_AGI_UNDEFINED':_0x898b('0x1'),'E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':_0x898b('0x2'),'E_AGI_SERVER_CLOSE':_0x898b('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0x898b('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0x898b('0x5'),'E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':_0x898b('0x6'),'E_AGI_SOCKET_TIMEOUT':'Socket\x20timeout.','E_AGI_COMMAND_EMPTY':_0x898b('0x7'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x898b('0x8'),'E_AGI_IVR_ENTRY':_0x898b('0x9')};function AGIError(_0x2456de){var _0x2456de=_0x2456de||null,_0xfa49d1=_0xfa49d1||[],_0x4a500f=0x1,_0x5de2c2='';if(!error[_0x2456de]){_0x2456de=_0x898b('0xa');}_0xfa49d1['push'](error[_0x2456de]);while(arguments[_0x4a500f]){_0xfa49d1[_0x898b('0xb')](arguments[_0x4a500f]);_0x4a500f++;}_0x5de2c2=util['format']['apply'](util,_0xfa49d1);this[_0x898b('0xc')]=_0x5de2c2;this[_0x898b('0xd')]=_0x2456de;}module[_0x898b('0xe')]=AGIError; \ No newline at end of file +var _0x3da4=['format','apply','message','exports','util','Undefined\x20error.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20closed.','Socket\x20timeout.','Missing\x20\x27ivr.entry\x27\x20menu.','push'];(function(_0x2341ed,_0x472515){var _0x283cd3=function(_0x1afcec){while(--_0x1afcec){_0x2341ed['push'](_0x2341ed['shift']());}};_0x283cd3(++_0x472515);}(_0x3da4,0x162));var _0x43da=function(_0x35eda6,_0x1c838b){_0x35eda6=_0x35eda6-0x0;var _0x45dde3=_0x3da4[_0x35eda6];return _0x45dde3;};'use strict';var util=require(_0x43da('0x0'));var error={'E_AGI_UNDEFINED':_0x43da('0x1'),'E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':_0x43da('0x2'),'E_AGI_SERVER_CLOSE':_0x43da('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0x43da('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0x43da('0x5'),'E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':_0x43da('0x6'),'E_AGI_SOCKET_TIMEOUT':_0x43da('0x7'),'E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':_0x43da('0x8')};function AGIError(_0x412847){var _0x412847=_0x412847||null,_0x1a0de0=_0x1a0de0||[],_0xcb715=0x1,_0x130372='';if(!error[_0x412847]){_0x412847='E_AGI_UNDEFINED';}_0x1a0de0[_0x43da('0x9')](error[_0x412847]);while(arguments[_0xcb715]){_0x1a0de0['push'](arguments[_0xcb715]);_0xcb715++;}_0x130372=util[_0x43da('0xa')][_0x43da('0xb')](util,_0x1a0de0);this[_0x43da('0xc')]=_0x130372;this['name']=_0x412847;}module[_0x43da('0xd')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index 662ee22..d2a206a 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 _0x6ecb=['info','no\x20vertex\x20found','stop\x20traverse','length','condition','split','agicommand','vswitch','target','default','invalid','default\x20on\x20switch\x20not\x20found','includes','max\x20retry\x20reach','condition\x20not\x20found','lodash','../../../config/logger','agi','menu','getdigits','getsecretdigits','numberOfEdges','addVertex','vertices','edges','prototype','addEdge','push','size','relations','getVertex','traverseBFS'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6ecb,0x14f));var _0xb6ec=function(_0xafe7,_0x14bc7b){_0xafe7=_0xafe7-0x0;var _0x392838=_0x6ecb[_0xafe7];return _0x392838;};'use strict';var _=require(_0xb6ec('0x0'));var logger=require(_0xb6ec('0x1'))(_0xb6ec('0x2'));var verticesWithRetry=[_0xb6ec('0x3'),_0xb6ec('0x4'),_0xb6ec('0x5')];var Graph=function(){this['vertices']={};this['edges']={};this[_0xb6ec('0x6')]=0x0;};Graph['prototype'][_0xb6ec('0x7')]=function(_0x33fdf9){this[_0xb6ec('0x8')][_0x33fdf9['id']]=_0x33fdf9;this[_0xb6ec('0x9')][_0x33fdf9['id']]=[];};Graph[_0xb6ec('0xa')][_0xb6ec('0xb')]=function(_0x1d3fb6,_0x1210fc,_0x5c0d12){this[_0xb6ec('0x9')][_0x1d3fb6][_0xb6ec('0xc')]({'target':_0x1210fc,'condition':_0x5c0d12});this[_0xb6ec('0x6')]+=0x1;};Graph[_0xb6ec('0xa')][_0xb6ec('0xd')]=function(){return _[_0xb6ec('0xd')](this[_0xb6ec('0x8')]);};Graph[_0xb6ec('0xa')][_0xb6ec('0xe')]=function(){return this[_0xb6ec('0x6')];};Graph['prototype'][_0xb6ec('0xf')]=function(_0x512877){return this[_0xb6ec('0x8')][_0x512877];};Graph[_0xb6ec('0xa')][_0xb6ec('0x10')]=function(_0x240f7d,_0xb32cdb){if(!this[_0xb6ec('0x8')][_0x240f7d]){return logger[_0xb6ec('0x11')](_0xb6ec('0x12'));}var _0x1a2f33=_0xb32cdb(this['vertices'][_0x240f7d]);if(!_0x1a2f33){return logger[_0xb6ec('0x11')](_0xb6ec('0x13'));}if(this['edges'][_0x240f7d][_0xb6ec('0x14')]===0x0){return logger[_0xb6ec('0x11')]('no\x20edge/s\x20available');}for(var _0x2e6e09=0x0,_0x385e84=[],_0x39bf22=![];_0x2e6e09\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','start','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','result','isUndefined','toString','agicommand\x20not\x20found','finally','clear','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','Project\x20%s\x20not\x20published','Project\x20%s\x20not\x20found','getLicense','callysquare','[LICENSE]\x20CHANNELS:\x20UNLIMITED','./server','listening','connection','xml2json','lodash','syncho','moment','../../config/environment','agi','../../config/license/util','./rpc','./mailRpc','./graph','./vertices','stack','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','message','name','error','[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','callerid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','toJson','mxGraphModel','root','agicommand','hasOwnProperty','retry','maxRetry','addVertex','omit','mxCell','isArray','length','source','target','addEdge','value','getSquareProject'];(function(_0x2317c1,_0x557cc6){var _0x4e0155=function(_0xd03b1b){while(--_0xd03b1b){_0x2317c1['push'](_0x2317c1['shift']());}};_0x4e0155(++_0x557cc6);}(_0xb932,0x18b));var _0x2b93=function(_0x3afb5e,_0x95f97b){_0x3afb5e=_0x3afb5e-0x0;var _0x4bdb9e=_0xb932[_0x3afb5e];return _0x4bdb9e;};'use strict';var parser=require(_0x2b93('0x0'));var _=require(_0x2b93('0x1'));var syncho=require(_0x2b93('0x2'));var util=require('util');var moment=require(_0x2b93('0x3'));var config=require(_0x2b93('0x4'));var logger=require('../../config/logger')(_0x2b93('0x5'));var utilLicense=require(_0x2b93('0x6'));var rpc=require(_0x2b93('0x7'));var mailRpc=require(_0x2b93('0x8'));var Graph=require(_0x2b93('0x9'));var Vertices=require(_0x2b93('0xa'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x2b93('0x5')]=_['defaults'](config[_0x2b93('0x5')],{'ip':'127.0.0.1','port':0x11dd});function connectionHandler(_0x244596){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0x244596);agiHandler(_0x244596);}catch(_0x151edf){logger['error'](_0x151edf[_0x2b93('0xb')]);}});});}function listeningHandler(){console['log']('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config['agi'][_0x2b93('0xc')]);logger[_0x2b93('0xd')](util[_0x2b93('0xe')](_0x2b93('0xf'),config[_0x2b93('0x5')]['ip'],config[_0x2b93('0x5')]['port']));}function errorHandler(_0x112ded){if(_0x112ded&&_0x112ded['name']&&_0x112ded[_0x2b93('0x10')]){logger['error'](util[_0x2b93('0xe')]('[%s]\x20%s',_0x112ded[_0x2b93('0x11')],_0x112ded[_0x2b93('0x10')]));}else{logger[_0x2b93('0x12')](util[_0x2b93('0xe')](_0x2b93('0x13'),_0x112ded[_0x2b93('0xb')]));}}function closeHandler(){logger[_0x2b93('0xd')](util[_0x2b93('0xe')](_0x2b93('0x14'),this['arg_1'],this['calleridname'],this['callerid'],this[_0x2b93('0x15')],this[_0x2b93('0x16')]));try{createSquareReport(this);}catch(_0x460186){logger[_0x2b93('0x12')](_0x460186[_0x2b93('0xb')]);}}function timeoutHandler(){logger[_0x2b93('0xd')](util[_0x2b93('0xe')](_0x2b93('0x17'),this[_0x2b93('0x18')],this['calleridname'],this[_0x2b93('0x19')],this[_0x2b93('0x15')],this[_0x2b93('0x16')]));}function hangupHandler(){logger[_0x2b93('0xd')](util[_0x2b93('0xe')](_0x2b93('0x1a'),this[_0x2b93('0x18')],this[_0x2b93('0x1b')],this[_0x2b93('0x19')],this[_0x2b93('0x15')],this[_0x2b93('0x16')]));this['evtHangup']=!![];}function getRoot(_0x30dcd1){return parser[_0x2b93('0x1c')](_0x30dcd1,{'object':!![]})[_0x2b93('0x1d')][_0x2b93('0x1e')];}function addVertex(_0x249d91,_0x581edb,_0x2940a7){_0x581edb[_0x2b93('0x1f')]=_0x2940a7;if(_0x581edb[_0x2b93('0x20')](_0x2b93('0x21'))){_0x581edb[_0x2b93('0x22')]=parseInt(_0x581edb[_0x2b93('0x21')],0xa);}_0x249d91[_0x2b93('0x23')](_[_0x2b93('0x24')](_0x581edb,_0x2b93('0x25')));}function initGraph(_0x3c7e26,_0x582c0a){var _0x280046=new Graph();for(var _0x56bf45 in _0x3c7e26){if(_0x3c7e26[_0x2b93('0x20')](_0x56bf45)){if(_[_0x2b93('0x26')](_0x3c7e26[_0x56bf45])){for(var _0xb649ea=0x0;_0xb649ea<_0x3c7e26[_0x56bf45][_0x2b93('0x27')];_0xb649ea+=0x1){addVertex(_0x280046,_0x3c7e26[_0x56bf45][_0xb649ea],_0x56bf45);}}else{addVertex(_0x280046,_0x3c7e26[_0x56bf45],_0x56bf45);}}}for(var _0x158e8a=0x0;_0x158e8a<_0x582c0a[_0x2b93('0x27')];_0x158e8a+=0x1){if(_0x582c0a[_0x158e8a][_0x2b93('0x28')]&&_0x582c0a[_0x158e8a][_0x2b93('0x29')]){_0x280046[_0x2b93('0x2a')](_0x582c0a[_0x158e8a][_0x2b93('0x28')],_0x582c0a[_0x158e8a][_0x2b93('0x29')],_0x582c0a[_0x158e8a][_0x2b93('0x2b')]);}}return _0x280046;}function getSquareProject(_0x4f9755,_0x1b7910){rpc[_0x2b93('0x2c')](_0x4f9755)[_0x2b93('0x2d')](function(_0x32d17a){_0x1b7910(null,_0x32d17a);})[_0x2b93('0x2e')](function(_0x24ff49){_0x1b7910(null,_0x24ff49);});}function createSquareReport(_0x1e6b33,_0x43b2d4){rpc[_0x2b93('0x2f')](_0x1e6b33)['then'](function(_0x4c668b){if(_0x43b2d4){_0x43b2d4(null,_0x4c668b);}})[_0x2b93('0x2e')](function(_0x24beff){if(_0x43b2d4){_0x43b2d4(null,_0x24beff);}});}function setChannelVariables(_0x2e09be){for(var _0x130550 in _0x2e09be){if(_0x2e09be['hasOwnProperty'](_0x130550)){if(_0x130550[_0x2b93('0x30')](_0x2b93('0x31'))===0x0){_0x2e09be[_0x130550['substring'](0x4)]=_0x2e09be[_0x130550];delete _0x2e09be[_0x130550];}}}}function getLogFromObject(_0x348c7){return util[_0x2b93('0x32')](_0x348c7,{'showHidden':![],'depth':null});}function agiHandler(_0x3619a1){var _0x4769c4,_0x44e16b,_0x3d0dae,_0x46648b,_0x25309e;logger['debug']('variables',JSON[_0x2b93('0x33')](_0x3619a1,null,0x2));logger[_0x2b93('0xd')](util[_0x2b93('0xe')]('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x3619a1[_0x2b93('0x18')],_0x3619a1['calleridname'],_0x3619a1[_0x2b93('0x19')],_0x3619a1['dnid'],_0x3619a1[_0x2b93('0x16')]));_0x3619a1['on'](_0x2b93('0x12'),errorHandler);_0x3619a1['on'](_0x2b93('0x34'),closeHandler);_0x3619a1['on'](_0x2b93('0x35'),timeoutHandler);_0x3619a1[_0x2b93('0x36')]=![];_0x3619a1['on'](_0x2b93('0x37'),hangupHandler);var _0x319e31=getSquareProject['sync'](null,_0x3619a1[_0x2b93('0x18')]);if(_0x319e31){if(_0x319e31[_0x2b93('0x38')]){_0x4769c4=getRoot(_0x319e31[_0x2b93('0x38')]);if(_0x4769c4&&_0x4769c4['start']){logger[_0x2b93('0x39')]('root',JSON[_0x2b93('0x33')](_0x4769c4,null,0x2));_0x3619a1[_0x2b93('0x3a')]=moment()[_0x2b93('0xe')](_0x2b93('0x3b'));_0x44e16b=initGraph(_[_0x2b93('0x24')](_0x4769c4,_0x2b93('0x25')),_0x4769c4[_0x2b93('0x25')]);_0x3d0dae=new Vertices(_0x3619a1,rpc,mailRpc);logger[_0x2b93('0xd')](util[_0x2b93('0xe')](_0x2b93('0x3c'),_0x3619a1[_0x2b93('0x18')],_0x3619a1['calleridname'],_0x3619a1[_0x2b93('0x19')],_0x3619a1[_0x2b93('0x15')],_0x3619a1[_0x2b93('0x16')]));_0x44e16b[_0x2b93('0x3d')](_0x4769c4[_0x2b93('0x3e')]['id'],function(_0x1fc0fc){try{_0x1fc0fc=_0x3d0dae['clear'](_0x1fc0fc);logger[_0x2b93('0x39')](_0x2b93('0x3f'),JSON[_0x2b93('0x33')](_0x1fc0fc,null,0x2));if(_0x1fc0fc[_0x2b93('0x1f')]===_0x2b93('0x40')){logger[_0x2b93('0xd')](_0x2b93('0x41'));_0x3619a1[_0x2b93('0x42')]=_0x1fc0fc[_0x2b93('0x42')]||_0x3619a1['context'];_0x3619a1['extension']=_0x1fc0fc[_0x2b93('0x43')];_0x3619a1['priority']=_0x1fc0fc[_0x2b93('0x44')]?_0x1fc0fc[_0x2b93('0x44')]-0x1:0x1;return null;}else if(_0x1fc0fc&&_0x3d0dae[_0x1fc0fc[_0x2b93('0x1f')]]){_0x25309e=_0x3d0dae[_0x1fc0fc[_0x2b93('0x1f')]](_0x1fc0fc);logger[_0x2b93('0xd')](_0x2b93('0x45'),JSON[_0x2b93('0x33')](_0x25309e,null,0x2));if(_0x25309e&&_0x25309e[_0x2b93('0x46')]===AGI_CODE_SUCCESS&&_0x25309e[_0x2b93('0x47')]!==AGI_RESULT_ERROR&&!_0x3619a1[_0x2b93('0x36')]){logger[_0x2b93('0x39')](_0x2b93('0x45'),getLogFromObject(_0x25309e));return _[_0x2b93('0x48')](_0x25309e[_0x2b93('0x47')])?null:_0x25309e[_0x2b93('0x47')][_0x2b93('0x49')]();}else{logger[_0x2b93('0x12')]('response',getLogFromObject(_0x25309e));return null;}}else{logger[_0x2b93('0x12')](_0x2b93('0x4a'));return null;}}catch(_0xa67920){logger[_0x2b93('0x12')](_0xa67920[_0x2b93('0xb')]);return null;}});if(_0x4769c4['finally']){logger['info'](util['format']('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x3619a1[_0x2b93('0x18')],_0x3619a1[_0x2b93('0x1b')],_0x3619a1[_0x2b93('0x19')],_0x3619a1[_0x2b93('0x15')],_0x3619a1['uniqueid']));_0x44e16b[_0x2b93('0x3d')](_0x4769c4[_0x2b93('0x4b')]['id'],function(_0xbbe8a2){try{_0xbbe8a2=_0x3d0dae[_0x2b93('0x4c')](_0xbbe8a2);logger['debug']('vertex',JSON[_0x2b93('0x33')](_0xbbe8a2,null,0x2));if(_0xbbe8a2&&_0x3d0dae[_0xbbe8a2[_0x2b93('0x1f')]]){_0x25309e=_0x3d0dae[_0xbbe8a2[_0x2b93('0x1f')]](_0xbbe8a2);if(_0x25309e){logger[_0x2b93('0x39')](_0x2b93('0x45'),getLogFromObject(_0x25309e));return _[_0x2b93('0x48')](_0x25309e[_0x2b93('0x47')])?null:_0x25309e[_0x2b93('0x47')][_0x2b93('0x49')]();}else{logger['error'](_0x2b93('0x45'),getLogFromObject(_0x25309e));return null;}}else{logger[_0x2b93('0x12')](_0x2b93('0x4a'));return null;}}catch(_0x3b8e17){logger[_0x2b93('0x12')](_0x3b8e17[_0x2b93('0xb')]);return null;}});}logger[_0x2b93('0xd')](util[_0x2b93('0xe')](_0x2b93('0x4d'),_0x3619a1[_0x2b93('0x18')],_0x3619a1[_0x2b93('0x1b')],_0x3619a1[_0x2b93('0x19')],_0x3619a1[_0x2b93('0x15')],_0x3619a1[_0x2b93('0x16')]));logger[_0x2b93('0xd')](util[_0x2b93('0xe')](_0x2b93('0x4e'),_0x3619a1[_0x2b93('0x42')],_0x3619a1[_0x2b93('0x43')],parseInt(_0x3619a1['priority'],0xa)+0x1));_0x3619a1[_0x2b93('0x4f')](_0x3619a1[_0x2b93('0x42')],_0x3619a1[_0x2b93('0x43')],parseInt(_0x3619a1[_0x2b93('0x44')],0xa)+0x1);_0x3619a1[_0x2b93('0x34')]();}}else{logger[_0x2b93('0x12')](util[_0x2b93('0xe')](_0x2b93('0x50'),_0x3619a1[_0x2b93('0x18')]));_0x3619a1['continueAt'](_0x3619a1[_0x2b93('0x42')],_0x3619a1[_0x2b93('0x43')],parseInt(_0x3619a1[_0x2b93('0x44')],0xa)+0x1);_0x3619a1['close']();}}else{logger[_0x2b93('0x12')](util[_0x2b93('0xe')](_0x2b93('0x51'),_0x3619a1['arg_1']));_0x3619a1[_0x2b93('0x4f')](_0x3619a1[_0x2b93('0x42')],_0x3619a1[_0x2b93('0x43')],parseInt(_0x3619a1[_0x2b93('0x44')],0xa)+0x1);_0x3619a1[_0x2b93('0x34')]();}}function main(){var _0x37df4e;return utilLicense[_0x2b93('0x52')]()['then'](function(_0x1b7b63){if(_0x1b7b63){if(_0x1b7b63['voice']){if(_0x1b7b63[_0x2b93('0x53')]&&_0x1b7b63[_0x2b93('0x53')]>0x0){logger['info'](util[_0x2b93('0xe')]('[LICENSE]\x20CHANNELS:\x20%s',_0x1b7b63['callysquare']));_0x37df4e=_0x1b7b63[_0x2b93('0x53')];}else{logger['info'](_0x2b93('0x54'));}}else{logger['info']('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x37df4e=-0x1;}}})[_0x2b93('0x2e')](function(_0x4d416a){logger['error']('[LICENSE]',_0x4d416a[_0x2b93('0xb')]);})[_0x2b93('0x4b')](function(){var _0x182d04=require(_0x2b93('0x55'))(config[_0x2b93('0x5')][_0x2b93('0xc')],config[_0x2b93('0x5')]['ip'],_0x37df4e);_0x182d04['on'](_0x2b93('0x12'),errorHandler);_0x182d04['on'](_0x2b93('0x56'),listeningHandler);_0x182d04['on'](_0x2b93('0x57'),connectionHandler);_0x182d04['on']('close',closeHandler);});}main(); \ No newline at end of file +var _0x4694=['context','extension','priority','code','result','response','isUndefined','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','toString','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','close','Project\x20%s\x20not\x20published','Project\x20%s\x20not\x20found','voice','callysquare','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','listening','connection','xml2json','syncho','util','../../config/environment','../../config/logger','../../config/license/util','./rpc','./graph','./vertices','defaults','agi','127.0.0.1','nextTick','error','stack','log','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','message','[%s]\x20%s','[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','dnid','evtHangup','toJson','mxGraphModel','root','agicommand','hasOwnProperty','retry','addVertex','omit','mxCell','length','source','target','addEdge','value','getSquareProject','then','catch','indexOf','agi_','inspect','debug','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid','timeout','hangup','sync','production','start','joinAt','YYYY-MM-DD\x20HH:mm:ss','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','clear','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS'];(function(_0x4e1e58,_0x599e1d){var _0x80d3c6=function(_0x485f16){while(--_0x485f16){_0x4e1e58['push'](_0x4e1e58['shift']());}};_0x80d3c6(++_0x599e1d);}(_0x4694,0x183));var _0x4469=function(_0x35a274,_0x98b399){_0x35a274=_0x35a274-0x0;var _0x40d905=_0x4694[_0x35a274];return _0x40d905;};'use strict';var parser=require(_0x4469('0x0'));var _=require('lodash');var syncho=require(_0x4469('0x1'));var util=require(_0x4469('0x2'));var moment=require('moment');var config=require(_0x4469('0x3'));var logger=require(_0x4469('0x4'))('agi');var utilLicense=require(_0x4469('0x5'));var rpc=require(_0x4469('0x6'));var mailRpc=require('./mailRpc');var Graph=require(_0x4469('0x7'));var Vertices=require(_0x4469('0x8'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config['agi']=_[_0x4469('0x9')](config[_0x4469('0xa')],{'ip':_0x4469('0xb'),'port':0x11dd});function connectionHandler(_0x4b45d3){process[_0x4469('0xc')](function(){syncho(function(){try{setChannelVariables(_0x4b45d3);agiHandler(_0x4b45d3);}catch(_0x38fde3){logger[_0x4469('0xd')](_0x38fde3[_0x4469('0xe')]);}});});}function listeningHandler(){console[_0x4469('0xf')]('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config['agi'][_0x4469('0x10')]);logger[_0x4469('0x11')](util[_0x4469('0x12')](_0x4469('0x13'),config[_0x4469('0xa')]['ip'],config[_0x4469('0xa')][_0x4469('0x10')]));}function errorHandler(_0x2cd8a4){if(_0x2cd8a4&&_0x2cd8a4['name']&&_0x2cd8a4[_0x4469('0x14')]){logger['error'](util[_0x4469('0x12')](_0x4469('0x15'),_0x2cd8a4['name'],_0x2cd8a4[_0x4469('0x14')]));}else{logger[_0x4469('0xd')](util[_0x4469('0x12')](_0x4469('0x16'),_0x2cd8a4['stack']));}}function closeHandler(){logger[_0x4469('0x11')](util['format'](_0x4469('0x17'),this['arg_1'],this[_0x4469('0x18')],this['callerid'],this['dnid'],this[_0x4469('0x19')]));try{createSquareReport(this);}catch(_0x2f8d5b){logger['error'](_0x2f8d5b[_0x4469('0xe')]);}}function timeoutHandler(){logger[_0x4469('0x11')](util[_0x4469('0x12')](_0x4469('0x1a'),this[_0x4469('0x1b')],this[_0x4469('0x18')],this['callerid'],this[_0x4469('0x1c')],this['uniqueid']));}function hangupHandler(){logger[_0x4469('0x11')](util[_0x4469('0x12')]('[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x4469('0x1b')],this[_0x4469('0x18')],this['callerid'],this[_0x4469('0x1c')],this[_0x4469('0x19')]));this[_0x4469('0x1d')]=!![];}function getRoot(_0x562d3c){return parser[_0x4469('0x1e')](_0x562d3c,{'object':!![]})[_0x4469('0x1f')][_0x4469('0x20')];}function addVertex(_0x518143,_0x5b6288,_0x476e88){_0x5b6288[_0x4469('0x21')]=_0x476e88;if(_0x5b6288[_0x4469('0x22')]('retry')){_0x5b6288['maxRetry']=parseInt(_0x5b6288[_0x4469('0x23')],0xa);}_0x518143[_0x4469('0x24')](_[_0x4469('0x25')](_0x5b6288,_0x4469('0x26')));}function initGraph(_0x183a61,_0x5d8e3d){var _0x7c08cd=new Graph();for(var _0x48f60b in _0x183a61){if(_0x183a61[_0x4469('0x22')](_0x48f60b)){if(_['isArray'](_0x183a61[_0x48f60b])){for(var _0x91ecbc=0x0;_0x91ecbc<_0x183a61[_0x48f60b][_0x4469('0x27')];_0x91ecbc+=0x1){addVertex(_0x7c08cd,_0x183a61[_0x48f60b][_0x91ecbc],_0x48f60b);}}else{addVertex(_0x7c08cd,_0x183a61[_0x48f60b],_0x48f60b);}}}for(var _0x554e06=0x0;_0x554e06<_0x5d8e3d[_0x4469('0x27')];_0x554e06+=0x1){if(_0x5d8e3d[_0x554e06][_0x4469('0x28')]&&_0x5d8e3d[_0x554e06][_0x4469('0x29')]){_0x7c08cd[_0x4469('0x2a')](_0x5d8e3d[_0x554e06]['source'],_0x5d8e3d[_0x554e06][_0x4469('0x29')],_0x5d8e3d[_0x554e06][_0x4469('0x2b')]);}}return _0x7c08cd;}function getSquareProject(_0x2f6c6c,_0x2ff608){rpc[_0x4469('0x2c')](_0x2f6c6c)[_0x4469('0x2d')](function(_0x209a91){_0x2ff608(null,_0x209a91);})[_0x4469('0x2e')](function(_0x4a7e76){_0x2ff608(null,_0x4a7e76);});}function createSquareReport(_0x381d12,_0x5f2e01){rpc['createSquareReport'](_0x381d12)['then'](function(_0x1e858a){if(_0x5f2e01){_0x5f2e01(null,_0x1e858a);}})[_0x4469('0x2e')](function(_0x3dd1f3){if(_0x5f2e01){_0x5f2e01(null,_0x3dd1f3);}});}function setChannelVariables(_0x28c233){for(var _0x164a1c in _0x28c233){if(_0x28c233[_0x4469('0x22')](_0x164a1c)){if(_0x164a1c[_0x4469('0x2f')](_0x4469('0x30'))===0x0){_0x28c233[_0x164a1c['substring'](0x4)]=_0x28c233[_0x164a1c];delete _0x28c233[_0x164a1c];}}}}function getLogFromObject(_0x3b0f5f){return util[_0x4469('0x31')](_0x3b0f5f,{'showHidden':![],'depth':null});}function agiHandler(_0x2f88d9){var _0x51a856,_0x5dacb8,_0xa480a5,_0xfc6055,_0x502086;logger[_0x4469('0x32')](_0x4469('0x33'),JSON[_0x4469('0x34')](_0x2f88d9,null,0x2));logger['info'](util[_0x4469('0x12')](_0x4469('0x35'),_0x2f88d9[_0x4469('0x1b')],_0x2f88d9[_0x4469('0x18')],_0x2f88d9[_0x4469('0x36')],_0x2f88d9[_0x4469('0x1c')],_0x2f88d9[_0x4469('0x19')]));_0x2f88d9['on'](_0x4469('0xd'),errorHandler);_0x2f88d9['on']('close',closeHandler);_0x2f88d9['on'](_0x4469('0x37'),timeoutHandler);_0x2f88d9[_0x4469('0x1d')]=![];_0x2f88d9['on'](_0x4469('0x38'),hangupHandler);var _0x2f34fd=getSquareProject[_0x4469('0x39')](null,_0x2f88d9[_0x4469('0x1b')]);if(_0x2f34fd){if(_0x2f34fd[_0x4469('0x3a')]){_0x51a856=getRoot(_0x2f34fd[_0x4469('0x3a')]);if(_0x51a856&&_0x51a856[_0x4469('0x3b')]){logger[_0x4469('0x32')](_0x4469('0x20'),JSON['stringify'](_0x51a856,null,0x2));_0x2f88d9[_0x4469('0x3c')]=moment()['format'](_0x4469('0x3d'));_0x5dacb8=initGraph(_[_0x4469('0x25')](_0x51a856,_0x4469('0x26')),_0x51a856[_0x4469('0x26')]);_0xa480a5=new Vertices(_0x2f88d9,rpc,mailRpc);logger[_0x4469('0x11')](util['format'](_0x4469('0x3e'),_0x2f88d9['arg_1'],_0x2f88d9['calleridname'],_0x2f88d9[_0x4469('0x36')],_0x2f88d9[_0x4469('0x1c')],_0x2f88d9[_0x4469('0x19')]));_0x5dacb8[_0x4469('0x3f')](_0x51a856[_0x4469('0x3b')]['id'],function(_0xdee266){try{_0xdee266=_0xa480a5[_0x4469('0x40')](_0xdee266);logger[_0x4469('0x32')](_0x4469('0x41'),JSON['stringify'](_0xdee266,null,0x2));if(_0xdee266[_0x4469('0x21')]===_0x4469('0x42')){logger['info'](_0x4469('0x43'));_0x2f88d9[_0x4469('0x44')]=_0xdee266[_0x4469('0x44')]||_0x2f88d9[_0x4469('0x44')];_0x2f88d9[_0x4469('0x45')]=_0xdee266[_0x4469('0x45')];_0x2f88d9[_0x4469('0x46')]=_0xdee266[_0x4469('0x46')]?_0xdee266['priority']-0x1:0x1;return null;}else if(_0xdee266&&_0xa480a5[_0xdee266['agicommand']]){_0x502086=_0xa480a5[_0xdee266[_0x4469('0x21')]](_0xdee266);logger[_0x4469('0x11')]('response',JSON['stringify'](_0x502086,null,0x2));if(_0x502086&&_0x502086[_0x4469('0x47')]===AGI_CODE_SUCCESS&&_0x502086[_0x4469('0x48')]!==AGI_RESULT_ERROR&&!_0x2f88d9[_0x4469('0x1d')]){logger[_0x4469('0x32')](_0x4469('0x49'),getLogFromObject(_0x502086));return _[_0x4469('0x4a')](_0x502086[_0x4469('0x48')])?null:_0x502086[_0x4469('0x48')]['toString']();}else{logger[_0x4469('0xd')]('response',getLogFromObject(_0x502086));return null;}}else{logger['error'](_0x4469('0x4b'));return null;}}catch(_0x278c9d){logger[_0x4469('0xd')](_0x278c9d[_0x4469('0xe')]);return null;}});if(_0x51a856[_0x4469('0x4c')]){logger[_0x4469('0x11')](util[_0x4469('0x12')](_0x4469('0x4d'),_0x2f88d9[_0x4469('0x1b')],_0x2f88d9[_0x4469('0x18')],_0x2f88d9[_0x4469('0x36')],_0x2f88d9[_0x4469('0x1c')],_0x2f88d9[_0x4469('0x19')]));_0x5dacb8['traverseBFS'](_0x51a856[_0x4469('0x4c')]['id'],function(_0x1dad1d){try{_0x1dad1d=_0xa480a5[_0x4469('0x40')](_0x1dad1d);logger[_0x4469('0x32')]('vertex',JSON['stringify'](_0x1dad1d,null,0x2));if(_0x1dad1d&&_0xa480a5[_0x1dad1d[_0x4469('0x21')]]){_0x502086=_0xa480a5[_0x1dad1d[_0x4469('0x21')]](_0x1dad1d);if(_0x502086){logger['debug'](_0x4469('0x49'),getLogFromObject(_0x502086));return _['isUndefined'](_0x502086[_0x4469('0x48')])?null:_0x502086[_0x4469('0x48')][_0x4469('0x4e')]();}else{logger[_0x4469('0xd')](_0x4469('0x49'),getLogFromObject(_0x502086));return null;}}else{logger[_0x4469('0xd')]('agicommand\x20not\x20found');return null;}}catch(_0xc0affa){logger[_0x4469('0xd')](_0xc0affa['stack']);return null;}});}logger[_0x4469('0x11')](util[_0x4469('0x12')]('[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x2f88d9[_0x4469('0x1b')],_0x2f88d9[_0x4469('0x18')],_0x2f88d9[_0x4469('0x36')],_0x2f88d9['dnid'],_0x2f88d9[_0x4469('0x19')]));logger[_0x4469('0x11')](util[_0x4469('0x12')](_0x4469('0x4f'),_0x2f88d9[_0x4469('0x44')],_0x2f88d9[_0x4469('0x45')],parseInt(_0x2f88d9['priority'],0xa)+0x1));_0x2f88d9[_0x4469('0x50')](_0x2f88d9[_0x4469('0x44')],_0x2f88d9['extension'],parseInt(_0x2f88d9[_0x4469('0x46')],0xa)+0x1);_0x2f88d9[_0x4469('0x51')]();}}else{logger['error'](util[_0x4469('0x12')](_0x4469('0x52'),_0x2f88d9[_0x4469('0x1b')]));_0x2f88d9['continueAt'](_0x2f88d9[_0x4469('0x44')],_0x2f88d9['extension'],parseInt(_0x2f88d9[_0x4469('0x46')],0xa)+0x1);_0x2f88d9[_0x4469('0x51')]();}}else{logger[_0x4469('0xd')](util[_0x4469('0x12')](_0x4469('0x53'),_0x2f88d9['arg_1']));_0x2f88d9[_0x4469('0x50')](_0x2f88d9[_0x4469('0x44')],_0x2f88d9[_0x4469('0x45')],parseInt(_0x2f88d9[_0x4469('0x46')],0xa)+0x1);_0x2f88d9[_0x4469('0x51')]();}}function main(){var _0xc50d60;return utilLicense['getLicense']()[_0x4469('0x2d')](function(_0x166c41){if(_0x166c41){if(_0x166c41[_0x4469('0x54')]){if(_0x166c41[_0x4469('0x55')]&&_0x166c41[_0x4469('0x55')]>0x0){logger[_0x4469('0x11')](util[_0x4469('0x12')]('[LICENSE]\x20CHANNELS:\x20%s',_0x166c41[_0x4469('0x55')]));_0xc50d60=_0x166c41['callysquare'];}else{logger[_0x4469('0x11')](_0x4469('0x56'));}}else{logger[_0x4469('0x11')](_0x4469('0x57'));_0xc50d60=-0x1;}}})[_0x4469('0x2e')](function(_0x569617){logger['error'](_0x4469('0x58'),_0x569617[_0x4469('0xe')]);})[_0x4469('0x4c')](function(){var _0x2d79a3=require('./server')(config[_0x4469('0xa')]['port'],config['agi']['ip'],_0xc50d60);_0x2d79a3['on']('error',errorHandler);_0x2d79a3['on'](_0x4469('0x59'),listeningHandler);_0x2d79a3['on'](_0x4469('0x5a'),connectionHandler);_0x2d79a3['on'](_0x4469('0x51'),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 6bdec48..5ab5305 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 _0x901f=['bluebird','jayson/promise','client','http','request','error','message','result','catch','sendMailMessage','SendMail'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x901f,0xa5));var _0xf901=function(_0x21ec92,_0x2e036c){_0x21ec92=_0x21ec92-0x0;var _0x53a537=_0x901f[_0x21ec92];return _0x53a537;};'use strict';var BPromise=require(_0xf901('0x0'));var jayson=require(_0xf901('0x1'));var client=jayson[_0xf901('0x2')][_0xf901('0x3')]({'port':0x232b});function request(_0x5d71d4,_0x228e4a){return new BPromise(function(_0x3b3fee,_0x2fa657){return client[_0xf901('0x4')](_0x5d71d4,_0x228e4a)['then'](function(_0x38ffb1){if(_0x38ffb1['error']){return _0x2fa657(_0x38ffb1[_0xf901('0x5')][_0xf901('0x6')]);}else{return _0x3b3fee(_0x38ffb1[_0xf901('0x7')]);}})[_0xf901('0x8')](function(_0x117336){return _0x2fa657(_0x117336);});});}exports[_0xf901('0x9')]=function(_0x3055c9,_0x1584a1){return request(_0xf901('0xa'),{'account':_0x3055c9,'message':_0x1584a1});}; \ No newline at end of file +var _0x6c7e=['error','message','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','then'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6c7e,0x16d));var _0xe6c7=function(_0x3167b1,_0x5ad266){_0x3167b1=_0x3167b1-0x0;var _0x362152=_0x6c7e[_0x3167b1];return _0x362152;};'use strict';var BPromise=require(_0xe6c7('0x0'));var jayson=require(_0xe6c7('0x1'));var client=jayson[_0xe6c7('0x2')][_0xe6c7('0x3')]({'port':0x232b});function request(_0x289af9,_0x2651cd){return new BPromise(function(_0x297b1d,_0x3e2abf){return client['request'](_0x289af9,_0x2651cd)[_0xe6c7('0x4')](function(_0x2f4e3c){if(_0x2f4e3c[_0xe6c7('0x5')]){return _0x3e2abf(_0x2f4e3c[_0xe6c7('0x5')][_0xe6c7('0x6')]);}else{return _0x297b1d(_0x2f4e3c['result']);}})[_0xe6c7('0x7')](function(_0x4c4584){return _0x3e2abf(_0x4c4584);});});}exports[_0xe6c7('0x8')]=function(_0x39c8d3,_0x4665aa){return request(_0xe6c7('0x9'),{'account':_0x39c8d3,'message':_0x4665aa});}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index b72a728..fc6f2ae 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 _0x67b4=['substring','length','split','slice','trim','emit','line','util','Transform','call','_localBuffer','_inBody','inherits','prototype','toString','indexOf'];(function(_0x181f30,_0x59e7e0){var _0x175754=function(_0x5f0751){while(--_0x5f0751){_0x181f30['push'](_0x181f30['shift']());}};_0x175754(++_0x59e7e0);}(_0x67b4,0x1d7));var _0x467b=function(_0x1b2ff7,_0x12a034){_0x1b2ff7=_0x1b2ff7-0x0;var _0x31656a=_0x67b4[_0x1b2ff7];return _0x31656a;};'use strict';var util=require(_0x467b('0x0'));var Transform=require('stream')[_0x467b('0x1')];function AGIReply(_0x59b3f7){Transform[_0x467b('0x2')](this,_0x59b3f7);this[_0x467b('0x3')]='';this[_0x467b('0x4')]=![];}util[_0x467b('0x5')](AGIReply,Transform);AGIReply[_0x467b('0x6')]['_transform']=function(_0xea308b,_0x64a8ab,_0x3c4515){var _0x4bfe4b='\x0a',_0x178580=['\x0a\x0a','\x0d\x0a\x0d\x0a'],_0xfe0f28=-0x1,_0x13e6f7=-0x1,_0x230fff='',_0x20556f=0x0,_0x3e3484='',_0x1f662d='';this[_0x467b('0x3')]+=_0xea308b[_0x467b('0x7')]();_0x3e3484=this[_0x467b('0x3')];if(!this['_inBody']){_0x20556f=0x0;while(_0x178580[_0x20556f]){while((_0x13e6f7=_0x3e3484[_0x467b('0x8')](_0x178580[_0x20556f]))!=-0x1){_0x230fff=_0x178580[_0x20556f];_0x1f662d=_0x3e3484[_0x467b('0x9')](0x0,_0x13e6f7);_0x3e3484=_0x3e3484[_0x467b('0x9')](_0x13e6f7+_0x230fff[_0x467b('0xa')]);var _0x2d1115=_0x1f662d[_0x467b('0xb')](_0x4bfe4b),_0x56f32f=0x0,_0x38dd02={},_0x4b9a99='',_0x443600='',_0x509115=-0x1;while(_0x2d1115[_0x56f32f]){_0x509115=_0x2d1115[_0x56f32f][_0x467b('0x8')](':');if(_0x509115!=-0x1){_0x4b9a99=_0x2d1115[_0x56f32f][_0x467b('0xc')](0x0,_0x509115)[_0x467b('0xd')]();_0x443600=_0x2d1115[_0x56f32f][_0x467b('0xc')](_0x509115+0x1)[_0x467b('0xd')]();if(_0x4b9a99[_0x467b('0xa')]>0x0){_0x38dd02[_0x4b9a99]=_0x443600;}}else{}_0x56f32f++;}this[_0x467b('0xe')]('headers',_0x38dd02);this[_0x467b('0x4')]=!![];}_0x20556f++;}this[_0x467b('0x3')]=_0x3e3484;}else{while((_0xfe0f28=_0x3e3484[_0x467b('0x8')](_0x4bfe4b))!=-0x1){_0x1f662d=_0x3e3484[_0x467b('0x9')](0x0,_0xfe0f28);this[_0x467b('0xe')](_0x467b('0xf'),_0x1f662d);_0x3e3484=_0x3e3484[_0x467b('0x9')](_0xfe0f28+_0x4bfe4b[_0x467b('0xa')]);}this[_0x467b('0x3')]=_0x3e3484;}_0x3c4515();};module['exports']=AGIReply; \ No newline at end of file +var _0xb2d8=['\x0d\x0a\x0d\x0a','toString','substring','length','split','indexOf','slice','trim','emit','headers','line','exports','Transform','call','_localBuffer','_inBody','inherits','prototype','_transform'];(function(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0xb2d8,0x188));var _0x8b2d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb2d8[_0x3dd15e];return _0x231fd0;};'use strict';var util=require('util');var Transform=require('stream')[_0x8b2d('0x0')];function AGIReply(_0x3cb097){Transform[_0x8b2d('0x1')](this,_0x3cb097);this[_0x8b2d('0x2')]='';this[_0x8b2d('0x3')]=![];}util[_0x8b2d('0x4')](AGIReply,Transform);AGIReply[_0x8b2d('0x5')][_0x8b2d('0x6')]=function(_0x3c7c67,_0x2dc4a5,_0xa2176f){var _0x3878e1='\x0a',_0x1261fe=['\x0a\x0a',_0x8b2d('0x7')],_0x50ac88=-0x1,_0x3d32bd=-0x1,_0x4002fa='',_0x199a96=0x0,_0x43a1fe='',_0x4d3f2a='';this[_0x8b2d('0x2')]+=_0x3c7c67[_0x8b2d('0x8')]();_0x43a1fe=this[_0x8b2d('0x2')];if(!this[_0x8b2d('0x3')]){_0x199a96=0x0;while(_0x1261fe[_0x199a96]){while((_0x3d32bd=_0x43a1fe['indexOf'](_0x1261fe[_0x199a96]))!=-0x1){_0x4002fa=_0x1261fe[_0x199a96];_0x4d3f2a=_0x43a1fe[_0x8b2d('0x9')](0x0,_0x3d32bd);_0x43a1fe=_0x43a1fe[_0x8b2d('0x9')](_0x3d32bd+_0x4002fa[_0x8b2d('0xa')]);var _0xc1040f=_0x4d3f2a[_0x8b2d('0xb')](_0x3878e1),_0x14371e=0x0,_0x35fedc={},_0x373055='',_0x2eebc2='',_0x35e021=-0x1;while(_0xc1040f[_0x14371e]){_0x35e021=_0xc1040f[_0x14371e][_0x8b2d('0xc')](':');if(_0x35e021!=-0x1){_0x373055=_0xc1040f[_0x14371e][_0x8b2d('0xd')](0x0,_0x35e021)[_0x8b2d('0xe')]();_0x2eebc2=_0xc1040f[_0x14371e][_0x8b2d('0xd')](_0x35e021+0x1)[_0x8b2d('0xe')]();if(_0x373055[_0x8b2d('0xa')]>0x0){_0x35fedc[_0x373055]=_0x2eebc2;}}else{}_0x14371e++;}this[_0x8b2d('0xf')](_0x8b2d('0x10'),_0x35fedc);this['_inBody']=!![];}_0x199a96++;}this[_0x8b2d('0x2')]=_0x43a1fe;}else{while((_0x50ac88=_0x43a1fe[_0x8b2d('0xc')](_0x3878e1))!=-0x1){_0x4d3f2a=_0x43a1fe[_0x8b2d('0x9')](0x0,_0x50ac88);this[_0x8b2d('0xf')](_0x8b2d('0x11'),_0x4d3f2a);_0x43a1fe=_0x43a1fe[_0x8b2d('0x9')](_0x50ac88+_0x3878e1[_0x8b2d('0xa')]);}this[_0x8b2d('0x2')]=_0x43a1fe;}_0xa2176f();};module[_0x8b2d('0x12')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index db110e9..b541181 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 _0x1963=['ShowInterval','Interval','Intervals','getSmsAccountById','ShowSmsAccount','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','createCmContact','ShowCmHopper','ListId','getPauseById','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','LogoutUser','bluebird','moment','lodash','util','client','http','request','then','error','message','result','getSquareProject','ShowSquareProject','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','CloudProvider','name','getSquareProjectById','getVoiceQueueById','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','ShowUser','getContactByPhone','GetContactByPhone','phone','ShowTrunk','ShowSound','save_name','getIntervalById'];(function(_0x5bcc71,_0x36b7f1){var _0x2c58ee=function(_0x1083ae){while(--_0x1083ae){_0x5bcc71['push'](_0x5bcc71['shift']());}};_0x2c58ee(++_0x36b7f1);}(_0x1963,0x151));var _0x3196=function(_0x4bc626,_0x54c76e){_0x4bc626=_0x4bc626-0x0;var _0x548316=_0x1963[_0x4bc626];return _0x548316;};'use strict';var BPromise=require(_0x3196('0x0'));var moment=require(_0x3196('0x1'));var _=require(_0x3196('0x2'));var util=require(_0x3196('0x3'));var jayson=require('jayson/promise');var client=jayson[_0x3196('0x4')][_0x3196('0x5')]({'port':0x2329});function request(_0x453ac1,_0x51269f){return new BPromise(function(_0x43d6f2,_0x51fe34){return client[_0x3196('0x6')](_0x453ac1,_0x51269f)[_0x3196('0x7')](function(_0x3268ca){if(_0x3268ca[_0x3196('0x8')]){return _0x51fe34(_0x3268ca[_0x3196('0x8')][_0x3196('0x9')]);}else{return _0x43d6f2(_0x3268ca[_0x3196('0xa')]);}})['catch'](function(_0x2f90d7){return _0x51fe34(_0x2f90d7);});});}exports['getSquareProjects']=function(){return request('GetSquareProjects',{'options':{'raw':![],'attributes':['id','name','production']}});};exports[_0x3196('0xb')]=function(_0x5ba329){return request(_0x3196('0xc'),{'options':{'raw':![],'where':{'name':_0x5ba329},'attributes':['production']}});};exports[_0x3196('0xd')]=function(_0x65873){return request(_0x3196('0xe'),{'options':{'raw':![],'where':{'id':_0x65873},'include':[{'model':_0x3196('0xf'),'as':_0x3196('0x10'),'include':[{'model':_0x3196('0x11'),'as':_0x3196('0x11')}]}],'attributes':['id',_0x3196('0x12'),'email'],'smtp':!![]}});};exports[_0x3196('0x13')]=function(_0x51049a){return request(_0x3196('0xc'),{'options':{'where':{'id':_0x51049a},'attributes':['name']}});};exports[_0x3196('0x14')]=function(_0x5bb109){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x5bb109},'attributes':[_0x3196('0x12')]}});};exports[_0x3196('0x15')]=function(_0x2e11c7){return request(_0x3196('0x16'),{'options':{'where':{'id':_0x2e11c7},'attributes':[_0x3196('0x12')]}});};exports[_0x3196('0x17')]=function(_0x9fb5d7){return request(_0x3196('0x18'),{'options':{'where':{'id':_0x9fb5d7},'attributes':[_0x3196('0x19')]}});};exports[_0x3196('0x1a')]=function(_0xd22243){return request(_0x3196('0x1b'),{'options':{'where':{'id':_0xd22243},'attributes':[_0x3196('0x12')]}});};exports[_0x3196('0x1c')]=function(_0x2d6142){return request(_0x3196('0x1d'),{'options':{'where':{'phone':_0x2d6142[_0x3196('0x1e')]},'attributes':['id']}});};exports['getTrunkById']=function(_0x43b86e){return request(_0x3196('0x1f'),{'options':{'where':{'id':_0x43b86e},'attributes':[_0x3196('0x12')]}});};exports['getSoundById']=function(_0x3cddf6){return request(_0x3196('0x20'),{'options':{'where':{'id':_0x3cddf6},'attributes':[_0x3196('0x21')]}});};exports[_0x3196('0x22')]=function(_0x5b4029){return request(_0x3196('0x23'),{'options':{'raw':![],'where':{'id':_0x5b4029},'include':[{'model':_0x3196('0x24'),'as':_0x3196('0x25')}]}});};exports[_0x3196('0x26')]=function(_0x2a9a25){return request(_0x3196('0x27'),{'options':{'where':{'id':_0x2a9a25},'attributes':['id',_0x3196('0x12')]}});};exports['createSmsMessage']=function(_0x47d643){return request(_0x3196('0x28'),{'body':_0x47d643});};exports[_0x3196('0x29')]=function(_0x38251d){return request(_0x3196('0x2a'),{'body':_0x38251d});};exports['createSquareReport']=function(_0x17f95a){return request('CreateSquareReport',{'body':_[_0x3196('0x2b')](_0x17f95a,{'project_name':_0x17f95a[_0x3196('0x2c')],'prev_project_name':_0x17f95a[_0x3196('0x2d')]||'','is_subproject':_0x17f95a[_0x3196('0x2d')]?!![]:![],'leaveAt':moment()[_0x3196('0x2e')](_0x3196('0x2f'))})});};exports[_0x3196('0x30')]=function(_0xcb4465){return request(_0x3196('0x31'),{'body':_0xcb4465});};exports[_0x3196('0x32')]=function(_0x320b59){return request('CreateSquareMessage',{'body':_0x320b59});};exports[_0x3196('0x33')]=function(_0x55181f){return request(_0x3196('0x34'),{'options':{'raw':![],'where':{'phone':_0x55181f[_0x3196('0x1e')],'ListId':_0x55181f[_0x3196('0x35')]}}})['then'](function(_0x14693c){if(_0x14693c){return _0x14693c;}return request('CreateCmContact',{'body':_0x55181f});});};exports[_0x3196('0x36')]=function(_0x2c0b93){return request('ShowPause',{'options':{'where':{'id':_0x2c0b93},'attributes':[_0x3196('0x12')]}});};exports[_0x3196('0x37')]=function(_0x1a439f,_0x6a01dc){return request(_0x3196('0x38'),{'body':{'interface':_0x6a01dc},'options':{'where':_0x1a439f}});};exports[_0x3196('0x39')]=function(_0x13d5b7,_0x1402ad,_0x27adbc){return request(_0x3196('0x3a'),{'body':{'type':_0x1402ad,'uniqueid':_0x27adbc},'options':{'where':_0x13d5b7}});};exports[_0x3196('0x3b')]=function(_0x23adaf){return request(_0x3196('0x3c'),{'body':{},'options':{'where':_0x23adaf}});};exports['agentLogout']=function(_0x12ddc3){return request(_0x3196('0x3d'),{'body':{},'options':{'where':_0x12ddc3}});}; \ No newline at end of file +var _0x6de2=['getSquareOdbcById','ShowSquareOdbc','dsn','ShowUser','getContactByPhone','GetContactByPhone','phone','getTrunkById','ShowTrunk','getSoundById','save_name','ShowInterval','Interval','Intervals','getSmsAccountById','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','ListId','then','ShowPause','agentLogin','LoginUser','PauseUser','UnpauseUser','agentLogout','LogoutUser','bluebird','moment','lodash','util','jayson/promise','http','request','error','message','result','catch','getSquareProjects','name','production','getSquareProject','ShowSquareProject','ShowMailAccount','CloudProvider','email','getSquareProjectById','getVoiceQueueById','ShowVariable'];(function(_0x36c356,_0x56c2a1){var _0x9e38dd=function(_0x35527f){while(--_0x35527f){_0x36c356['push'](_0x36c356['shift']());}};_0x9e38dd(++_0x56c2a1);}(_0x6de2,0x64));var _0x26de=function(_0x3c0e49,_0x1b10b6){_0x3c0e49=_0x3c0e49-0x0;var _0x40392d=_0x6de2[_0x3c0e49];return _0x40392d;};'use strict';var BPromise=require(_0x26de('0x0'));var moment=require(_0x26de('0x1'));var _=require(_0x26de('0x2'));var util=require(_0x26de('0x3'));var jayson=require(_0x26de('0x4'));var client=jayson['client'][_0x26de('0x5')]({'port':0x2329});function request(_0x23a500,_0x5191e9){return new BPromise(function(_0x1e441b,_0x25d65e){return client[_0x26de('0x6')](_0x23a500,_0x5191e9)['then'](function(_0x3fe081){if(_0x3fe081[_0x26de('0x7')]){return _0x25d65e(_0x3fe081[_0x26de('0x7')][_0x26de('0x8')]);}else{return _0x1e441b(_0x3fe081[_0x26de('0x9')]);}})[_0x26de('0xa')](function(_0x4bac2b){return _0x25d65e(_0x4bac2b);});});}exports[_0x26de('0xb')]=function(){return request('GetSquareProjects',{'options':{'raw':![],'attributes':['id',_0x26de('0xc'),_0x26de('0xd')]}});};exports[_0x26de('0xe')]=function(_0x43a839){return request(_0x26de('0xf'),{'options':{'raw':![],'where':{'name':_0x43a839},'attributes':[_0x26de('0xd')]}});};exports['getMailAccountById']=function(_0x262969){return request(_0x26de('0x10'),{'options':{'raw':![],'where':{'id':_0x262969},'include':[{'model':'MailServerOut','as':'Smtp','include':[{'model':'CloudProvider','as':_0x26de('0x11')}]}],'attributes':['id',_0x26de('0xc'),_0x26de('0x12')],'smtp':!![]}});};exports[_0x26de('0x13')]=function(_0x558c0c){return request(_0x26de('0xf'),{'options':{'where':{'id':_0x558c0c},'attributes':[_0x26de('0xc')]}});};exports[_0x26de('0x14')]=function(_0x2e0ff2){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x2e0ff2},'attributes':['name']}});};exports['getVariableById']=function(_0x2ef44b){return request(_0x26de('0x15'),{'options':{'where':{'id':_0x2ef44b},'attributes':['name']}});};exports[_0x26de('0x16')]=function(_0x388142){return request(_0x26de('0x17'),{'options':{'where':{'id':_0x388142},'attributes':[_0x26de('0x18')]}});};exports['getUserById']=function(_0x4b699c){return request(_0x26de('0x19'),{'options':{'where':{'id':_0x4b699c},'attributes':['name']}});};exports[_0x26de('0x1a')]=function(_0xa76878){return request(_0x26de('0x1b'),{'options':{'where':{'phone':_0xa76878[_0x26de('0x1c')]},'attributes':['id']}});};exports[_0x26de('0x1d')]=function(_0x419d54){return request(_0x26de('0x1e'),{'options':{'where':{'id':_0x419d54},'attributes':[_0x26de('0xc')]}});};exports[_0x26de('0x1f')]=function(_0x332784){return request('ShowSound',{'options':{'where':{'id':_0x332784},'attributes':[_0x26de('0x20')]}});};exports['getIntervalById']=function(_0x3fd593){return request(_0x26de('0x21'),{'options':{'raw':![],'where':{'id':_0x3fd593},'include':[{'model':_0x26de('0x22'),'as':_0x26de('0x23')}]}});};exports[_0x26de('0x24')]=function(_0x2af0ac){return request('ShowSmsAccount',{'options':{'where':{'id':_0x2af0ac},'attributes':['id','name']}});};exports['createSmsMessage']=function(_0x35ad87){return request(_0x26de('0x25'),{'body':_0x35ad87});};exports[_0x26de('0x26')]=function(_0x9b03a8){return request(_0x26de('0x27'),{'body':_0x9b03a8});};exports[_0x26de('0x28')]=function(_0x3578e1){return request(_0x26de('0x29'),{'body':_[_0x26de('0x2a')](_0x3578e1,{'project_name':_0x3578e1['arg_1'],'prev_project_name':_0x3578e1[_0x26de('0x2b')]||'','is_subproject':_0x3578e1[_0x26de('0x2b')]?!![]:![],'leaveAt':moment()[_0x26de('0x2c')](_0x26de('0x2d'))})});};exports[_0x26de('0x2e')]=function(_0x211fad){return request(_0x26de('0x2f'),{'body':_0x211fad});};exports[_0x26de('0x30')]=function(_0x29d38e){return request(_0x26de('0x31'),{'body':_0x29d38e});};exports[_0x26de('0x32')]=function(_0x5adab3){return request(_0x26de('0x33'),{'options':{'raw':![],'where':{'phone':_0x5adab3[_0x26de('0x1c')],'ListId':_0x5adab3[_0x26de('0x34')]}}})[_0x26de('0x35')](function(_0x374653){if(_0x374653){return _0x374653;}return request('CreateCmContact',{'body':_0x5adab3});});};exports['getPauseById']=function(_0x133289){return request(_0x26de('0x36'),{'options':{'where':{'id':_0x133289},'attributes':['name']}});};exports[_0x26de('0x37')]=function(_0x1e717a,_0x106574){return request(_0x26de('0x38'),{'body':{'interface':_0x106574},'options':{'where':_0x1e717a}});};exports['agentPause']=function(_0x14bf11,_0x48739d,_0x13d078){return request(_0x26de('0x39'),{'body':{'type':_0x48739d,'uniqueid':_0x13d078},'options':{'where':_0x14bf11}});};exports['agentUnpause']=function(_0x168361){return request(_0x26de('0x3a'),{'body':{},'options':{'where':_0x168361}});};exports[_0x26de('0x3b')]=function(_0x4d8ce5){return request(_0x26de('0x3c'),{'body':{},'options':{'where':_0x4d8ce5}});}; \ 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 29d488a..9f1c601 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 _0x3d4b=['./lex','./polly'];(function(_0x256dbf,_0x59cedb){var _0x10f25e=function(_0x10a66c){while(--_0x10a66c){_0x256dbf['push'](_0x256dbf['shift']());}};_0x10f25e(++_0x59cedb);}(_0x3d4b,0xf3));var _0xb3d4=function(_0x283129,_0x4854e8){_0x283129=_0x283129-0x0;var _0x3b60f0=_0x3d4b[_0x283129];return _0x3b60f0;};var polly=require(_0xb3d4('0x0'));var lex=require(_0xb3d4('0x1'));module['exports']={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x1d7e=['exports','./lex'];(function(_0x5035b2,_0x58531d){var _0x250a07=function(_0x36de88){while(--_0x36de88){_0x5035b2['push'](_0x5035b2['shift']());}};_0x250a07(++_0x58531d);}(_0x1d7e,0x7d));var _0xe1d7=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0x1d7e[_0x491a7f];return _0x3d8f44;};var polly=require('./polly');var lex=require(_0xe1d7('0x0'));module[_0xe1d7('0x1')]={'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 13ddb8a..ab0098c 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 _0x41bb=['exports','./lib/api'];(function(_0x1b2018,_0x10ee5a){var _0x3087d5=function(_0x461781){while(--_0x461781){_0x1b2018['push'](_0x1b2018['shift']());}};_0x3087d5(++_0x10ee5a);}(_0x41bb,0xc5));var _0xb41b=function(_0x187644,_0x115c74){_0x187644=_0x187644-0x0;var _0x110f61=_0x41bb[_0x187644];return _0x110f61;};'use strict';var lex=require(_0xb41b('0x0'));module[_0xb41b('0x1')]=function(_0x4ef2f1,_0x428431,_0x4d5578,_0x30ea75,_0x1c9d36,_0x148333){return lex(_0x4ef2f1,_0x428431,_0x4d5578,_0x30ea75,_0x1c9d36,_0x148333);}; \ No newline at end of file +var _0x9354=['exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x9354,0x96));var _0x4935=function(_0x2fbd0e,_0x3460a9){_0x2fbd0e=_0x2fbd0e-0x0;var _0x481c9f=_0x9354[_0x2fbd0e];return _0x481c9f;};'use strict';var lex=require('./lib/api');module[_0x4935('0x0')]=function(_0xc3c1f3,_0x4896da,_0x263dd5,_0x2a4993,_0x29d1eb,_0x280bbc){return lex(_0xc3c1f3,_0x4896da,_0x263dd5,_0x2a4993,_0x29d1eb,_0x280bbc);}; \ 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 abce86c..63128ec 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(_0x43875f,_0x2c2921){var _0x189586=function(_0x3d298b){while(--_0x3d298b){_0x43875f['push'](_0x43875f['shift']());}};_0x189586(++_0x2c2921);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa9e0[_0x2dafbe];return _0x58a45a;};'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(_0x1d9f1a,_0x7202){var _0x1ba3e9=function(_0xb0cd76){while(--_0xb0cd76){_0x1d9f1a['push'](_0x1d9f1a['shift']());}};_0x1ba3e9(++_0x7202);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xa9e0[_0x37c22c];return _0x119d79;};'use strict';var BPromise=require(_0x0a9e('0x0'));var AWS=require(_0x0a9e('0x1'));function lexResult(_0x29929c,_0x5dd881){return new BPromise(function(_0x550fbc,_0x18d5c9){_0x29929c['postText'](_0x5dd881,function(_0x333808,_0x432180){if(_0x333808){_0x18d5c9(_0x333808);}if(_0x432180[_0x0a9e('0x2')]){for(const _0x991246 in _0x432180[_0x0a9e('0x2')]){if(_0x432180['slots'][_0x0a9e('0x3')](_0x991246)){var _0x441e3a=_0x432180[_0x0a9e('0x2')][_0x991246];_0x432180['slot_'+_0x991246]=_0x441e3a;}}}_0x550fbc(_0x432180);});});}module['exports']=function(_0xe42b77,_0x56465b,_0x52cace,_0x39753a,_0xf81284,_0x307b3e){var _0x3ab53f=new AWS[(_0x0a9e('0x4'))]({'accessKeyId':_0x56465b,'secretAccessKey':_0x52cace,'region':_0x39753a});var _0xbd1168={'botAlias':'$LATEST','botName':_0x307b3e,'inputText':_0xf81284,'userId':_0xe42b77};return lexResult(_0x3ab53f,_0xbd1168);}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/polly/index.js b/server/services/agi/scripts/aws/polly/index.js index e53e6ba..1548837 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 _0x6b61=['./lib/api','exports'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x6b61,0x184));var _0x16b6=function(_0x480bc8,_0x1fac40){_0x480bc8=_0x480bc8-0x0;var _0x28c245=_0x6b61[_0x480bc8];return _0x28c245;};'use strict';var polly=require(_0x16b6('0x0'));module[_0x16b6('0x1')]=function(_0x262cc2,_0x240f16,_0x59b3a0,_0xc86894,_0x52ba5f,_0x2914f7,_0x1dff04){return polly(_0x262cc2,_0x240f16,_0x59b3a0,_0xc86894,_0x52ba5f,_0x2914f7,_0x1dff04);}; \ No newline at end of file +var _0x8633=['exports'];(function(_0x1283d4,_0x36b6f1){var _0x433643=function(_0x4c9fbe){while(--_0x4c9fbe){_0x1283d4['push'](_0x1283d4['shift']());}};_0x433643(++_0x36b6f1);}(_0x8633,0x1d3));var _0x3863=function(_0x94dec5,_0x2f29f9){_0x94dec5=_0x94dec5-0x0;var _0x1c19d8=_0x8633[_0x94dec5];return _0x1c19d8;};'use strict';var polly=require('./lib/api');module[_0x3863('0x0')]=function(_0x4e37f5,_0x4e93a3,_0x5e4328,_0x5f3942,_0x1b843c,_0x5141da,_0x34de88){return polly(_0x4e37f5,_0x4e93a3,_0x5e4328,_0x5f3942,_0x1b843c,_0x5141da,_0x34de88);}; \ 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 44ee131..e18d04d 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 _0xdeb2=['aws-sdk','synthesizeSpeech','AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','mp3','path','randomstring'];(function(_0x400b6c,_0x4a6139){var _0x4c4e3e=function(_0x191233){while(--_0x191233){_0x400b6c['push'](_0x400b6c['shift']());}};_0x4c4e3e(++_0x4a6139);}(_0xdeb2,0xbb));var _0x2deb=function(_0x3fc287,_0x5c3f36){_0x3fc287=_0x3fc287-0x0;var _0x33af9f=_0xdeb2[_0x3fc287];return _0x33af9f;};'use strict';var fs=require('fs');var path=require(_0x2deb('0x0'));var BPromise=require('bluebird');var rs=require(_0x2deb('0x1'));var AWS=require(_0x2deb('0x2'));function pollyResult(_0x2198cc,_0x3e9df1,_0xf4ed4){return new BPromise(function(_0x1a0c6e,_0x331746){_0x2198cc[_0x2deb('0x3')](_0x3e9df1,function(_0x1995c9,_0x282524){if(_0x1995c9){_0x331746(_0x1995c9);}else if(_0x282524){if(_0x282524[_0x2deb('0x4')]instanceof Buffer){fs['writeFile'](_0xf4ed4,_0x282524[_0x2deb('0x4')],function(_0x29cb29){if(_0x29cb29){_0x331746(_0x29cb29);}else{_0x1a0c6e();}});}else{_0x331746(new Error(_0x2deb('0x5')));}}else{_0x331746(new Error(_0x2deb('0x6')));}});});}module[_0x2deb('0x7')]=function(_0x528b53,_0x4fdb98,_0x13b0b1,_0x95a409,_0x4edbe7,_0x1e2dd0,_0x3d6a96){var _0x16fea1=new AWS['Polly']({'accessKeyId':_0x528b53,'secretAccessKey':_0x4fdb98,'region':_0x13b0b1});var _0x26551e={'Text':_0x4edbe7,'TextType':_0x1e2dd0||'text','OutputFormat':_0x2deb('0x8'),'VoiceId':_0x95a409};return pollyResult(_0x16fea1,_0x26551e,_0x3d6a96);}; \ No newline at end of file +var _0x081e=['randomstring','aws-sdk','AudioStream','writeFile','No\x20data\x20response\x20from\x20aws\x20Polly!','text','mp3','path','bluebird'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0x081e,0xe8));var _0xe081=function(_0x34f499,_0xd8ff6e){_0x34f499=_0x34f499-0x0;var _0x2be65b=_0x081e[_0x34f499];return _0x2be65b;};'use strict';var fs=require('fs');var path=require(_0xe081('0x0'));var BPromise=require(_0xe081('0x1'));var rs=require(_0xe081('0x2'));var AWS=require(_0xe081('0x3'));function pollyResult(_0x16247c,_0x139b9f,_0x1f31da){return new BPromise(function(_0x5af58d,_0x31dd69){_0x16247c['synthesizeSpeech'](_0x139b9f,function(_0x265a88,_0x56d485){if(_0x265a88){_0x31dd69(_0x265a88);}else if(_0x56d485){if(_0x56d485[_0xe081('0x4')]instanceof Buffer){fs[_0xe081('0x5')](_0x1f31da,_0x56d485[_0xe081('0x4')],function(_0x5608f8){if(_0x5608f8){_0x31dd69(_0x5608f8);}else{_0x5af58d();}});}else{_0x31dd69(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x31dd69(new Error(_0xe081('0x6')));}});});}module['exports']=function(_0x597e08,_0x545f5b,_0xeebd53,_0x1fb11f,_0x1f48c3,_0x22f042,_0x54f953){var _0x1a4bb0=new AWS['Polly']({'accessKeyId':_0x597e08,'secretAccessKey':_0x545f5b,'region':_0xeebd53});var _0x2a7d36={'Text':_0x1f48c3,'TextType':_0x22f042||_0xe081('0x7'),'OutputFormat':_0xe081('0x8'),'VoiceId':_0x1fb11f};return pollyResult(_0x1a4bb0,_0x2a7d36,_0x54f953);}; \ 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 6e7e753..2b42086 100644 --- a/server/services/agi/scripts/google/asr/index.js +++ b/server/services/agi/scripts/google/asr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb146=['./lib/api','exports'];(function(_0x4f6add,_0x5f2f22){var _0x4c0c9a=function(_0x4dba42){while(--_0x4dba42){_0x4f6add['push'](_0x4f6add['shift']());}};_0x4c0c9a(++_0x5f2f22);}(_0xb146,0x68));var _0x6b14=function(_0x3fe47f,_0x1a2b5b){_0x3fe47f=_0x3fe47f-0x0;var _0x55d8d9=_0xb146[_0x3fe47f];return _0x55d8d9;};'use strict';var asr=require(_0x6b14('0x0'));module[_0x6b14('0x1')]=function(_0x439559,_0x2fa621,_0x4076dc,_0x194c0e){return asr(_0x439559,_0x2fa621,_0x4076dc);}; \ No newline at end of file +var _0xb02c=['./lib/api'];(function(_0xf0088a,_0x4b9052){var _0x3ed444=function(_0x3ca9fd){while(--_0x3ca9fd){_0xf0088a['push'](_0xf0088a['shift']());}};_0x3ed444(++_0x4b9052);}(_0xb02c,0x177));var _0xcb02=function(_0x48ad81,_0x24e245){_0x48ad81=_0x48ad81-0x0;var _0x29a7fb=_0xb02c[_0x48ad81];return _0x29a7fb;};'use strict';var asr=require(_0xcb02('0x0'));module['exports']=function(_0x1367ae,_0x4af71b,_0x3c48cb,_0x40efab){return asr(_0x1367ae,_0x4af71b,_0x3c48cb);}; \ 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 48a0dfc..6c600f3 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 _0xa7b4=['string','filepath\x20should\x20be\x20a\x20string','length','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','POST','LINEAR16','bluebird','https://speech.googleapis.com'];(function(_0x28a328,_0xf14a69){var _0x4b29bd=function(_0x42fe08){while(--_0x42fe08){_0x28a328['push'](_0x28a328['shift']());}};_0x4b29bd(++_0xf14a69);}(_0xa7b4,0x8d));var _0x4a7b=function(_0x44ec14,_0x8a1bb6){_0x44ec14=_0x44ec14-0x0;var _0x2ffa38=_0xa7b4[_0x44ec14];return _0x2ffa38;};'use strict';var url=require('url');var BPromise=require(_0x4a7b('0x0'));var fs=require('fs');var host=_0x4a7b('0x1');module['exports']=function(_0xb93675,_0x30092d,_0x56f161){return new BPromise(function(_0x5de6a2,_0x4cadbf){var _0x8c0229;if(typeof _0xb93675!==_0x4a7b('0x2')||_0xb93675['length']===0x0){return _0x4cadbf(_0x4a7b('0x3'));}if(typeof _0x30092d!==_0x4a7b('0x2')||_0x30092d[_0x4a7b('0x4')]===0x0){return _0x4cadbf(_0x4a7b('0x5'));}if(typeof _0x56f161!==_0x4a7b('0x6')&&(typeof _0x56f161!==_0x4a7b('0x2')||_0x56f161[_0x4a7b('0x4')]===0x0)){return _0x4cadbf(_0x4a7b('0x7'));}try{_0x8c0229=fs[_0x4a7b('0x8')](_0xb93675)[_0x4a7b('0x9')](_0x4a7b('0xa'));}catch(_0x3eb79b){return _0x4cadbf(_0x3eb79b);}return _0x5de6a2({'method':_0x4a7b('0xb'),'uri':host+'/v1/speech:recognize?key='+_0x30092d,'body':{'config':{'encoding':_0x4a7b('0xc'),'sampleRateHertz':'8000','languageCode':_0x56f161},'audio':{'content':_0x8c0229}},'json':!![]});});}; \ No newline at end of file +var _0x7a2c=['undefined','string','lang\x20should\x20be\x20a\x20string','toString','base64','/v1/speech:recognize?key=','8000','url','https://speech.googleapis.com','exports','length','filepath\x20should\x20be\x20a\x20string'];(function(_0x3b4911,_0x2453e4){var _0x5cd088=function(_0x282c19){while(--_0x282c19){_0x3b4911['push'](_0x3b4911['shift']());}};_0x5cd088(++_0x2453e4);}(_0x7a2c,0x17b));var _0xc7a2=function(_0x5604e1,_0xf66a7d){_0x5604e1=_0x5604e1-0x0;var _0xc3f173=_0x7a2c[_0x5604e1];return _0xc3f173;};'use strict';var url=require(_0xc7a2('0x0'));var BPromise=require('bluebird');var fs=require('fs');var host=_0xc7a2('0x1');module[_0xc7a2('0x2')]=function(_0x409ec5,_0x26fb61,_0x44d702){return new BPromise(function(_0x2abba8,_0x3f2b0d){var _0x34cd60;if(typeof _0x409ec5!=='string'||_0x409ec5[_0xc7a2('0x3')]===0x0){return _0x3f2b0d(_0xc7a2('0x4'));}if(typeof _0x26fb61!=='string'||_0x26fb61['length']===0x0){return _0x3f2b0d('key\x20should\x20be\x20a\x20string');}if(typeof _0x44d702!==_0xc7a2('0x5')&&(typeof _0x44d702!==_0xc7a2('0x6')||_0x44d702[_0xc7a2('0x3')]===0x0)){return _0x3f2b0d(_0xc7a2('0x7'));}try{_0x34cd60=fs['readFileSync'](_0x409ec5)[_0xc7a2('0x8')](_0xc7a2('0x9'));}catch(_0x2cb74c){return _0x3f2b0d(_0x2cb74c);}return _0x2abba8({'method':'POST','uri':host+_0xc7a2('0xa')+_0x26fb61,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':_0xc7a2('0xb'),'languageCode':_0x44d702},'audio':{'content':_0x34cd60}},'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 6085323..9e61a15 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 _0x1ee3=['exports','./asr'];(function(_0x350302,_0x1cbdf4){var _0x34ae40=function(_0x11aaf6){while(--_0x11aaf6){_0x350302['push'](_0x350302['shift']());}};_0x34ae40(++_0x1cbdf4);}(_0x1ee3,0x163));var _0x31ee=function(_0x24e855,_0x201bfb){_0x24e855=_0x24e855-0x0;var _0x2864fb=_0x1ee3[_0x24e855];return _0x2864fb;};var asr=require(_0x31ee('0x0'));module[_0x31ee('0x1')]={'asr':asr}; \ No newline at end of file +var _0x5090=['exports'];(function(_0x4753f6,_0x29ce35){var _0x37028e=function(_0x48b715){while(--_0x48b715){_0x4753f6['push'](_0x4753f6['shift']());}};_0x37028e(++_0x29ce35);}(_0x5090,0x1eb));var _0x0509=function(_0x32038b,_0x32f4f7){_0x32038b=_0x32038b-0x0;var _0x1ecfe3=_0x5090[_0x32038b];return _0x1ecfe3;};var asr=require('./asr');module[_0x0509('0x0')]={'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 05ad7fe..28638ec 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 _0xc269=['length','lang\x20\x22','goggleTTS\x20path','googleASR','asr','uri','results','alternatives','transcript','map','confidence','join','googleASR\x20transcription','catch','[%s]\x20%s:%s','name','message','result','source','action','actionIncomplete','fulfillment','status','code','metadata','endConversation','googleDialogflowV2','replace','SessionsClient','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','fulfillmentText','intent','isFallback','languageCode','queryText','responseId','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','freeform=3','sestekNDA','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','dirName','apiai-promise','bluebird','dialogflow','http','md5','path','request-promise','randomstring','sox','google-tts-api','parse','./aws','./google','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','WHAT_EVER','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','finish','info','finish\x20download\x20file','close','unlink','download\x20error','end','host','statusMessage','data','transcode','resolve','generate','.wav','writeFileSync','then','chmodSync','777','split','readFileSync','toString','base64','googleCloudTTS','ssml','voice','MP3','tmp','.mp3','from','audioContent','writeFile','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','f.req=','stringify','null','generic','slice','parse\x20response\x20failed:\x0a'];(function(_0xf37a7a,_0x548198){var _0x11fe85=function(_0x529d3e){while(--_0x529d3e){_0xf37a7a['push'](_0xf37a7a['shift']());}};_0x11fe85(++_0x548198);}(_0xc269,0x14d));var _0x9c26=function(_0x302dd7,_0xb921e1){_0x302dd7=_0x302dd7-0x0;var _0x1c13cd=_0xc269[_0x302dd7];return _0x1c13cd;};'use strict';var apiai=require(_0x9c26('0x0'));var BPromise=require(_0x9c26('0x1'));var dialogflow=require(_0x9c26('0x2'));var fs=require('fs');var http=require(_0x9c26('0x3'));var https=require('https');var md5=require(_0x9c26('0x4'));var path=require(_0x9c26('0x5'));var querystring=require('querystring');var rp=require(_0x9c26('0x6'));var rs=require(_0x9c26('0x7'));var sox=require(_0x9c26('0x8'));var tts=require(_0x9c26('0x9'));var urlParse=require('url')[_0x9c26('0xa')];var util=require('util');var aws=require(_0x9c26('0xb'));var google=require(_0x9c26('0xc'));var sestek=require('./sestek');var tilde=require(_0x9c26('0xd'));var logger=require(_0x9c26('0xe'))(_0x9c26('0xf'));var ISPEECH_API=_0x9c26('0x10');function downloadFile(_0x23cc65,_0x28be38){return new BPromise(function(_0x5d1f7f,_0x4acc1c){var _0x5733ad=urlParse(_0x23cc65);var _0x579775=_0x5733ad[_0x9c26('0x11')]===_0x9c26('0x12')?https:http;var _0x338dec={'host':_0x5733ad['host'],'path':_0x5733ad[_0x9c26('0x5')],'headers':{'user-agent':_0x9c26('0x13')}};_0x579775['get'](_0x338dec,function(_0x1d8233){if(_0x1d8233[_0x9c26('0x14')]!==0xc8){logger[_0x9c26('0x15')](_0x9c26('0x16')+_0x23cc65+'\x20failed,\x20status\x20code\x20=\x20'+_0x1d8233[_0x9c26('0x14')]+'\x20('+_0x1d8233['statusMessage']+')');_0x4acc1c(new Error(_0x9c26('0x16')+_0x23cc65+_0x9c26('0x17')+_0x1d8233[_0x9c26('0x14')]+'\x20('+_0x1d8233['statusMessage']+')'));return;}var _0x4d8c12=fs['createWriteStream'](_0x28be38);_0x4d8c12['on'](_0x9c26('0x18'),function(){logger[_0x9c26('0x19')](_0x9c26('0x1a'));_0x4d8c12[_0x9c26('0x1b')](_0x5d1f7f);});_0x4d8c12['on']('error',function(_0x3c37b7){fs[_0x9c26('0x1c')](_0x28be38);logger[_0x9c26('0x15')](_0x9c26('0x1d'),_0x3c37b7);_0x4acc1c(_0x3c37b7);});_0x1d8233['pipe'](_0x4d8c12);})['on']('error',function(_0x1f59f4){logger[_0x9c26('0x15')](_0x1f59f4);_0x4acc1c(_0x1f59f4);})[_0x9c26('0x1e')]();});}function uploadFile(_0x122c16){return new BPromise(function(_0x391c3e,_0x50a0c4){var _0x426c0f=urlParse(_0x122c16);var _0x2589e7=_0x426c0f[_0x9c26('0x11')]===_0x9c26('0x12')?https:http;var _0x11f1c7={'host':_0x426c0f[_0x9c26('0x1f')],'path':_0x426c0f[_0x9c26('0x5')],'headers':{'user-agent':_0x9c26('0x13')}};_0x2589e7['get'](_0x11f1c7,function(_0x44172e){if(_0x44172e[_0x9c26('0x14')]!==0xc8){_0x50a0c4(new Error(_0x9c26('0x16')+_0x122c16+'\x20failed,\x20status\x20code\x20=\x20'+_0x44172e[_0x9c26('0x14')]+'\x20('+_0x44172e[_0x9c26('0x20')]+')'));return;}var _0x34545b='';_0x44172e['on'](_0x9c26('0x21'),function(_0x51616c){_0x34545b+=_0x51616c;});_0x44172e['on'](_0x9c26('0x1e'),function(){_0x391c3e(_0x34545b);});})['on'](_0x9c26('0x15'),function(_0x4be90d){_0x50a0c4(_0x4be90d);})['end']();});}function convertFile(_0x5b6695,_0x12a078){return new BPromise(function(_0x2cf863,_0x493de7){var _0x54d5a2=sox[_0x9c26('0x22')](_0x5b6695,_0x12a078,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x54d5a2['on'](_0x9c26('0x15'),function(_0x50f737){logger[_0x9c26('0x15')]('error\x20convert',_0x50f737);_0x493de7(_0x50f737);});_0x54d5a2['on'](_0x9c26('0x1e'),function(){logger[_0x9c26('0x19')]('finish\x20to\x20convert');_0x2cf863();});_0x54d5a2['start']();});}function base64Decode(_0x473bc4,_0xbecc7c){var _0x305d45=path[_0x9c26('0x23')](__dirname,'tmp',rs[_0x9c26('0x24')](0x4)+_0x9c26('0x25'));fs[_0x9c26('0x26')](_0x305d45,_0x473bc4,'base64');return convertFile(_0x305d45,_0xbecc7c)[_0x9c26('0x27')](function(){try{fs['unlink'](_0x305d45);fs[_0x9c26('0x28')](_0xbecc7c,_0x9c26('0x29'));}catch(_0x560813){logger[_0x9c26('0x15')](_0x560813);}return _0xbecc7c[_0x9c26('0x2a')]('.')[0x0];});}function base64Encode(_0x45668d){var _0x5d0ad2=fs[_0x9c26('0x2b')](_0x45668d);return new Buffer(_0x5d0ad2)[_0x9c26('0x2c')](_0x9c26('0x2d'));}exports[_0x9c26('0x2e')]=function(_0x4486d5,_0x244bfb,_0x1a3a20,_0x3a33bd,_0x9368cf,_0x2a6707){var _0x5e39b5,_0x28bdee;var _0x49ea6e='https://texttospeech.googleapis.com/v1/';var _0x153a40='?key='+_0x4486d5;var _0x419172={};if(_0x244bfb===_0x9c26('0x2f')){_0x419172['input']={'ssml':_0x1a3a20};}else{_0x419172['input']={'text':_0x1a3a20};};_0x419172[_0x9c26('0x30')]={'languageCode':_0x3a33bd,'ssmlGender':_0x9368cf};_0x419172['audioConfig']={'audioEncoding':_0x9c26('0x31'),'sampleRateHertz':0x1f40};var _0x26ede9={'url':_0x49ea6e+'text:synthesize'+_0x153a40,'method':'POST','json':!![],'body':_0x419172};return rp(_0x26ede9)[_0x9c26('0x27')](function(_0x53c291){return new BPromise(function(_0x263be6,_0x43550b){_0x5e39b5=path[_0x9c26('0x23')](__dirname,_0x9c26('0x32'),rs[_0x9c26('0x24')](0x4)+_0x9c26('0x33'));var _0x2fdb94=Buffer[_0x9c26('0x34')](_0x53c291[_0x9c26('0x35')],_0x9c26('0x2d'));return fs[_0x9c26('0x36')](_0x5e39b5,_0x2fdb94,function(_0x42991e){_0x43550b(_0x42991e);},function(_0x33cde6){fs[_0x9c26('0x28')](_0x5e39b5,_0x9c26('0x29'));_0x263be6(_0x33cde6);});});})[_0x9c26('0x27')](function(_0x26a0f6){_0x28bdee=path['resolve'](__dirname,_0x9c26('0x32'),rs[_0x9c26('0x24')](0x4)+_0x9c26('0x25'));return convertFile(_0x5e39b5,_0x28bdee);})[_0x9c26('0x27')](function(){try{fs[_0x9c26('0x1c')](_0x5e39b5);fs[_0x9c26('0x28')](_0x28bdee,'777');}catch(_0xa24d60){logger['error'](_0xa24d60);}logger[_0x9c26('0x19')](_0x9c26('0x37'),_0x28bdee[_0x9c26('0x2a')]('.')[0x0]);return _0x28bdee['split']('.')[0x0];});};exports[_0x9c26('0x38')]=function(_0x5c17f6,_0x49bfb5){var _0x142770=_0x9c26('0x39');var _0x4a8c57,_0x4a202a;var _0x1e3f67;var _0x3b8038={'encoding':_0x9c26('0x3a'),'method':'POST','timeout':0x2710,'url':_0x142770,'headers':{'Content-Type':_0x9c26('0x3b')},'body':_0x9c26('0x3c')+encodeURIComponent(JSON[_0x9c26('0x3d')]([[['jQ1olc',JSON['stringify']([_0x5c17f6,_0x49bfb5||'en',![],_0x9c26('0x3e')]),null,_0x9c26('0x3f')]]]))};return rp(_0x3b8038)[_0x9c26('0x27')](function(_0xb36f25){try{_0x1e3f67=eval(_0xb36f25[_0x9c26('0x40')](0x5))[0x0][0x2];}catch(_0x2c79c8){throw new Error(_0x9c26('0x41')+_0xb36f25['data']);}if(!_0x1e3f67){if(_0x5c17f6[_0x9c26('0x42')]>0xc8){throw new Error('text\x20length\x20limit\x20reached');}else{throw new Error(_0x9c26('0x43')+_0x49bfb5+'\x22\x20might\x20not\x20exist');}}try{_0x1e3f67=eval(_0x1e3f67)[0x0];}catch(_0x522014){throw new Error('parse\x20response\x20failed:\x0a'+res[_0x9c26('0x21')]);}const _0x56a415=_0x1e3f67;_0x4a8c57=path[_0x9c26('0x23')](__dirname,_0x9c26('0x32'),rs[_0x9c26('0x24')](0x4)+_0x9c26('0x33'));fs[_0x9c26('0x26')](_0x4a8c57,_0x1e3f67,{'encoding':'base64'});_0x4a202a=path[_0x9c26('0x23')](__dirname,_0x9c26('0x32'),rs[_0x9c26('0x24')](0x4)+_0x9c26('0x25'));return convertFile(_0x4a8c57,_0x4a202a);})[_0x9c26('0x27')](function(){try{fs['unlink'](_0x4a8c57);fs[_0x9c26('0x28')](_0x4a202a,_0x9c26('0x29'));}catch(_0x28e31f){logger[_0x9c26('0x15')](_0x28e31f);}logger[_0x9c26('0x19')](_0x9c26('0x44'),_0x4a202a['split']('.')[0x0]);return _0x4a202a[_0x9c26('0x2a')]('.')[0x0];});};exports[_0x9c26('0x45')]=function(_0x47fef8,_0x4ffae8,_0x318519){return google[_0x9c26('0x46')](_0x47fef8,_0x4ffae8,_0x318519)['then'](function(_0x373fe5){logger[_0x9c26('0x19')](_0x373fe5[_0x9c26('0x47')]);return rp(_0x373fe5);})[_0x9c26('0x27')](function(_0x167847){var _0x41f69a='';var _0x4384d1=0x0;try{fs[_0x9c26('0x1c')](_0x47fef8);}catch(_0x10afd0){logger[_0x9c26('0x15')](_0x10afd0);}if(_0x167847&&_0x167847['results']){_0x41f69a=_0x167847[_0x9c26('0x48')]['map'](function(_0x2d1975){return _0x2d1975&&_0x2d1975[_0x9c26('0x49')][0x0]&&_0x2d1975[_0x9c26('0x49')][0x0][_0x9c26('0x4a')]?_0x2d1975[_0x9c26('0x49')][0x0][_0x9c26('0x4a')]:'';})['join']('\x0a');_0x4384d1=_0x167847[_0x9c26('0x48')][_0x9c26('0x4b')](function(_0x3dbca1){return _0x3dbca1&&_0x3dbca1[_0x9c26('0x49')][0x0]&&_0x3dbca1[_0x9c26('0x49')][0x0]['confidence']?_0x3dbca1[_0x9c26('0x49')][0x0][_0x9c26('0x4c')]:0x0;})[_0x9c26('0x4d')]('\x0a');}logger['info'](_0x9c26('0x4e'),_0x41f69a);logger[_0x9c26('0x19')]('googleASR\x20confidence',_0x4384d1);return{'transcript':_0x41f69a,'confidence':_0x4384d1};})[_0x9c26('0x4f')](function(_0x31eb83){logger['error'](_0x9c26('0x50'),_0x31eb83[_0x9c26('0x14')],_0x31eb83[_0x9c26('0x51')],_0x31eb83[_0x9c26('0x52')]);});};exports['googleDialogflow']=function(_0x2e2b30,_0x5ad1b2,_0x3a406d,_0x1770c6){var _0x105908=apiai(_0x5ad1b2,{'language':_0x1770c6||'en'});return _0x105908['textRequest'](_0x3a406d,{'sessionId':md5(_0x2e2b30)})['then'](function(_0x18dfca){logger[_0x9c26('0x19')](JSON['stringify'](_0x18dfca));return{'source':_0x18dfca[_0x9c26('0x53')][_0x9c26('0x54')],'resolvedQuery':_0x18dfca[_0x9c26('0x53')]['resolvedQuery'],'action':_0x18dfca[_0x9c26('0x53')][_0x9c26('0x55')],'actionIncomplete':_0x18dfca[_0x9c26('0x53')][_0x9c26('0x56')],'speech':_0x18dfca[_0x9c26('0x53')][_0x9c26('0x57')]['speech'],'score':_0x18dfca[_0x9c26('0x53')]['score'],'statusCode':_0x18dfca[_0x9c26('0x58')][_0x9c26('0x59')],'endConversation':_0x18dfca[_0x9c26('0x53')][_0x9c26('0x5a')][_0x9c26('0x5b')]||![],'isFallbackIntent':_0x18dfca[_0x9c26('0x53')][_0x9c26('0x5a')]['isFallbackIntent']};});};exports[_0x9c26('0x5c')]=function(_0x474504,_0x4918f4,_0x19b179,_0x3fe23a,_0x176304,_0x42bec1){var _0x2fbce3=_0x3fe23a[_0x9c26('0x5d')](/\\n/g,'\x0a');var _0x520dc7={'credentials':{'private_key':_0x2fbce3,'client_email':_0x19b179}};var _0x2ad13e=new dialogflow[(_0x9c26('0x5e'))](_0x520dc7);var _0x2058e9=_0x2ad13e[_0x9c26('0x5f')](_0x4918f4,md5(_0x474504));var _0x155c7d={'session':_0x2058e9,'queryInput':{'text':{'text':_0x176304,'languageCode':_0x42bec1}}};return _0x2ad13e[_0x9c26('0x60')](_0x155c7d)[_0x9c26('0x27')](function(_0x3d2581){if(_0x3d2581&&_0x3d2581[_0x9c26('0x42')]){logger[_0x9c26('0x19')](_0x9c26('0x61'),JSON[_0x9c26('0x3d')](_0x3d2581));var _0x1e1083=_0x3d2581[0x0];if(_0x1e1083){var _0x343b24={'action':_0x1e1083[_0x9c26('0x62')][_0x9c26('0x55')],'allRequiredParamsPresent':_0x1e1083[_0x9c26('0x62')][_0x9c26('0x63')],'endConversation':_0x1e1083[_0x9c26('0x62')][_0x9c26('0x64')]&&_0x1e1083[_0x9c26('0x62')][_0x9c26('0x64')][_0x9c26('0x65')]?_0x1e1083[_0x9c26('0x62')][_0x9c26('0x64')][_0x9c26('0x65')][_0x9c26('0x66')]['boolValue']:![],'fulfillmentText':_0x1e1083[_0x9c26('0x62')][_0x9c26('0x67')],'intentName':_0x1e1083['queryResult'][_0x9c26('0x68')][_0x9c26('0x51')],'intentDisplayName':_0x1e1083[_0x9c26('0x62')][_0x9c26('0x68')]['displayName'],'isFallbackIntent':_0x1e1083[_0x9c26('0x62')][_0x9c26('0x68')][_0x9c26('0x69')],'languageCode':_0x1e1083[_0x9c26('0x62')][_0x9c26('0x6a')],'queryText':_0x1e1083['queryResult'][_0x9c26('0x6b')],'responseId':_0x1e1083[_0x9c26('0x6c')],'score':_0x1e1083['queryResult'][_0x9c26('0x6d')],'speech':_0x1e1083[_0x9c26('0x62')][_0x9c26('0x67')],'providerResponse':JSON[_0x9c26('0x3d')](_0x3d2581)};return _0x343b24;}}});};exports[_0x9c26('0x6e')]=function(_0x193167,_0x454d4d,_0x3f9703,_0x359d8d){return tilde[_0x9c26('0x46')](_0x193167,_0x454d4d,_0x3f9703,_0x359d8d)[_0x9c26('0x27')](function(_0x4fe211){try{fs['unlink'](_0x193167);}catch(_0x39854a){logger[_0x9c26('0x15')](_0x39854a);}logger[_0x9c26('0x19')](_0x9c26('0x6f'),_0x4fe211[_0x9c26('0x4a')]);logger[_0x9c26('0x19')](_0x9c26('0x70'),_0x4fe211[_0x9c26('0x4c')]);return _0x4fe211;});};exports[_0x9c26('0x71')]=function(_0x2bd5ab,_0x413363,_0x168ac3,_0xd05bfe,_0x12e4b6,_0x26f4aa){var _0x28a24e=path[_0x9c26('0x23')](__dirname,_0x9c26('0x32'),rs['generate'](0x4)+_0x9c26('0x33'));var _0x2b7f8b;return aws[_0x9c26('0x72')](_0x2bd5ab,_0x413363,_0x168ac3,_0xd05bfe,_0x12e4b6,_0x26f4aa,_0x28a24e)['then'](function(){_0x2b7f8b=path['resolve'](__dirname,'tmp',rs[_0x9c26('0x24')](0x4)+_0x9c26('0x25'));return convertFile(_0x28a24e,_0x2b7f8b);})[_0x9c26('0x27')](function(){try{fs['unlink'](_0x28a24e);fs['chmodSync'](_0x2b7f8b,_0x9c26('0x29'));}catch(_0x261057){logger[_0x9c26('0x15')](_0x261057);}return _0x2b7f8b['split']('.')[0x0];});};exports[_0x9c26('0x73')]=function(_0x2004f5,_0x56b71b,_0x67b303,_0xb3e0e2,_0x5cbe6d,_0x89f577){return aws[_0x9c26('0x74')](_0x2004f5,_0x56b71b,_0x67b303,_0xb3e0e2,_0x5cbe6d,_0x89f577)[_0x9c26('0x27')](function(_0x576a3c){logger[_0x9c26('0x19')](JSON[_0x9c26('0x3d')](_0x576a3c));return _0x576a3c;});};exports[_0x9c26('0x75')]=function(_0x2aeb41,_0x383c7a,_0x1ce5e6,_0x111ecf){var _0x577e77=util[_0x9c26('0x76')](_0x9c26('0x77'),ISPEECH_API,_0x2aeb41,encodeURIComponent(_0x383c7a),_0x1ce5e6,_0x111ecf);var _0x18b9ef=path['resolve'](__dirname,'tmp',rs['generate'](0x4)+_0x9c26('0x33'));var _0x48b445;return downloadFile(_0x577e77,_0x18b9ef)['then'](function(){_0x48b445=path['resolve'](__dirname,'tmp',rs[_0x9c26('0x24')](0x4)+_0x9c26('0x25'));return convertFile(_0x18b9ef,_0x48b445);})[_0x9c26('0x27')](function(){try{fs['unlink'](_0x18b9ef);fs[_0x9c26('0x28')](_0x48b445,_0x9c26('0x29'));}catch(_0xc18e8){logger[_0x9c26('0x15')](_0xc18e8);}return _0x48b445[_0x9c26('0x2a')]('.')[0x0];});};exports[_0x9c26('0x78')]=function(_0xa141ee,_0x5cfeb7,_0x4f45a2,_0x39a684){var _0x994703=util[_0x9c26('0x76')](_0x9c26('0x79'),ISPEECH_API,_0x5cfeb7,_0x4f45a2,base64Encode(_0xa141ee),_0x39a684?util['format']('model=%s',encodeURIComponent(_0x39a684)):_0x9c26('0x7a'));return uploadFile(_0x994703)[_0x9c26('0x27')](function(_0x3239d9){return querystring[_0x9c26('0xa')](_0x3239d9);});};exports[_0x9c26('0x7b')]=function(_0x3364a2,_0x3a3d4c){return sestek[_0x9c26('0x7c')](_0x3364a2,_0x3a3d4c)[_0x9c26('0x27')](function(_0x5e532f){logger[_0x9c26('0x19')](JSON['stringify'](_0x5e532f));var _0x5138c4={'speech':_0x5e532f[_0x9c26('0x7d')],'action':_0x5e532f[_0x9c26('0x7e')]?_0x5e532f[_0x9c26('0x7e')][_0x9c26('0x7f')]:undefined,'actiondata':_0x5e532f[_0x9c26('0x7e')]?_0x5e532f[_0x9c26('0x7e')][_0x9c26('0x80')]:undefined};if(_0x5e532f[_0x9c26('0x7e')]&&_0x5e532f[_0x9c26('0x7e')][_0x9c26('0x81')]){return base64Decode(_0x5e532f[_0x9c26('0x7e')][_0x9c26('0x81')][_0x9c26('0x82')],path[_0x9c26('0x23')](__dirname,_0x9c26('0x32'),rs[_0x9c26('0x24')](0x4)+_0x9c26('0x25')))['then'](function(_0x102911){_0x5138c4[_0x9c26('0x83')]=_0x102911;return _0x5138c4;});}return _0x5138c4;});};exports[_0x9c26('0x84')]=function(){return __dirname;}; \ No newline at end of file +var _0xbdc4=['action','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','intent','name','isFallback','languageCode','queryText','responseId','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20confidence','awsPolly','lex','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','sestekNDA','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','apiai-promise','bluebird','dialogflow','https','md5','path','querystring','request-promise','randomstring','sox','google-tts-api','url','parse','util','./aws','./sestek','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','host','get','statusCode','error','\x20failed,\x20status\x20code\x20=\x20','request\x20to\x20','createWriteStream','info','close','unlink','download\x20error','pipe','end','https:','WHAT_EVER','statusMessage','data','transcode','wav','error\x20convert','finish\x20to\x20convert','start','resolve','tmp','generate','.wav','writeFileSync','base64','then','chmodSync','777','split','readFileSync','toString','?key=','ssml','input','audioConfig','MP3','POST','.mp3','writeFile','googleCloudTTS\x20path','googleTTS','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','null','generic','slice','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','lang\x20\x22','goggleTTS\x20path','googleASR','asr','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','message','googleDialogflow','textRequest','result','source','fulfillment','speech','status','code','metadata','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','detectIntent','queryResult'];(function(_0x43b487,_0x21893a){var _0x2f707a=function(_0x477ee0){while(--_0x477ee0){_0x43b487['push'](_0x43b487['shift']());}};_0x2f707a(++_0x21893a);}(_0xbdc4,0x12f));var _0x4bdc=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0xbdc4[_0x5f1391];return _0x50ebe3;};'use strict';var apiai=require(_0x4bdc('0x0'));var BPromise=require(_0x4bdc('0x1'));var dialogflow=require(_0x4bdc('0x2'));var fs=require('fs');var http=require('http');var https=require(_0x4bdc('0x3'));var md5=require(_0x4bdc('0x4'));var path=require(_0x4bdc('0x5'));var querystring=require(_0x4bdc('0x6'));var rp=require(_0x4bdc('0x7'));var rs=require(_0x4bdc('0x8'));var sox=require(_0x4bdc('0x9'));var tts=require(_0x4bdc('0xa'));var urlParse=require(_0x4bdc('0xb'))[_0x4bdc('0xc')];var util=require(_0x4bdc('0xd'));var aws=require(_0x4bdc('0xe'));var google=require('./google');var sestek=require(_0x4bdc('0xf'));var tilde=require(_0x4bdc('0x10'));var logger=require(_0x4bdc('0x11'))(_0x4bdc('0x12'));var ISPEECH_API=_0x4bdc('0x13');function downloadFile(_0x2b8ed1,_0x23c075){return new BPromise(function(_0x324a06,_0x55d58b){var _0x1e5a33=urlParse(_0x2b8ed1);var _0x5adca3=_0x1e5a33[_0x4bdc('0x14')]==='https:'?https:http;var _0x33966e={'host':_0x1e5a33[_0x4bdc('0x15')],'path':_0x1e5a33[_0x4bdc('0x5')],'headers':{'user-agent':'WHAT_EVER'}};_0x5adca3[_0x4bdc('0x16')](_0x33966e,function(_0x36739a){if(_0x36739a[_0x4bdc('0x17')]!==0xc8){logger[_0x4bdc('0x18')]('request\x20to\x20'+_0x2b8ed1+_0x4bdc('0x19')+_0x36739a[_0x4bdc('0x17')]+'\x20('+_0x36739a['statusMessage']+')');_0x55d58b(new Error(_0x4bdc('0x1a')+_0x2b8ed1+_0x4bdc('0x19')+_0x36739a[_0x4bdc('0x17')]+'\x20('+_0x36739a['statusMessage']+')'));return;}var _0x3f8925=fs[_0x4bdc('0x1b')](_0x23c075);_0x3f8925['on']('finish',function(){logger[_0x4bdc('0x1c')]('finish\x20download\x20file');_0x3f8925[_0x4bdc('0x1d')](_0x324a06);});_0x3f8925['on'](_0x4bdc('0x18'),function(_0x461ed5){fs[_0x4bdc('0x1e')](_0x23c075);logger['error'](_0x4bdc('0x1f'),_0x461ed5);_0x55d58b(_0x461ed5);});_0x36739a[_0x4bdc('0x20')](_0x3f8925);})['on'](_0x4bdc('0x18'),function(_0x5de071){logger[_0x4bdc('0x18')](_0x5de071);_0x55d58b(_0x5de071);})[_0x4bdc('0x21')]();});}function uploadFile(_0x3ec346){return new BPromise(function(_0x3f1dfb,_0x3ed48c){var _0x421636=urlParse(_0x3ec346);var _0x93c4bd=_0x421636[_0x4bdc('0x14')]===_0x4bdc('0x22')?https:http;var _0x8f6e15={'host':_0x421636['host'],'path':_0x421636[_0x4bdc('0x5')],'headers':{'user-agent':_0x4bdc('0x23')}};_0x93c4bd[_0x4bdc('0x16')](_0x8f6e15,function(_0x1996e0){if(_0x1996e0[_0x4bdc('0x17')]!==0xc8){_0x3ed48c(new Error(_0x4bdc('0x1a')+_0x3ec346+'\x20failed,\x20status\x20code\x20=\x20'+_0x1996e0[_0x4bdc('0x17')]+'\x20('+_0x1996e0[_0x4bdc('0x24')]+')'));return;}var _0x218140='';_0x1996e0['on'](_0x4bdc('0x25'),function(_0x551c41){_0x218140+=_0x551c41;});_0x1996e0['on'](_0x4bdc('0x21'),function(){_0x3f1dfb(_0x218140);});})['on'](_0x4bdc('0x18'),function(_0x84f163){_0x3ed48c(_0x84f163);})[_0x4bdc('0x21')]();});}function convertFile(_0x50e515,_0x2ebb2e){return new BPromise(function(_0x44ddc4,_0x23a7ec){var _0x20f9a5=sox[_0x4bdc('0x26')](_0x50e515,_0x2ebb2e,{'sampleRate':0x1f40,'format':_0x4bdc('0x27'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x20f9a5['on'](_0x4bdc('0x18'),function(_0x3014a7){logger['error'](_0x4bdc('0x28'),_0x3014a7);_0x23a7ec(_0x3014a7);});_0x20f9a5['on']('end',function(){logger[_0x4bdc('0x1c')](_0x4bdc('0x29'));_0x44ddc4();});_0x20f9a5[_0x4bdc('0x2a')]();});}function base64Decode(_0x5e0323,_0x10869c){var _0x31e8f5=path[_0x4bdc('0x2b')](__dirname,_0x4bdc('0x2c'),rs[_0x4bdc('0x2d')](0x4)+_0x4bdc('0x2e'));fs[_0x4bdc('0x2f')](_0x31e8f5,_0x5e0323,_0x4bdc('0x30'));return convertFile(_0x31e8f5,_0x10869c)[_0x4bdc('0x31')](function(){try{fs[_0x4bdc('0x1e')](_0x31e8f5);fs[_0x4bdc('0x32')](_0x10869c,_0x4bdc('0x33'));}catch(_0x146994){logger['error'](_0x146994);}return _0x10869c[_0x4bdc('0x34')]('.')[0x0];});}function base64Encode(_0x58ec54){var _0x1bfb19=fs[_0x4bdc('0x35')](_0x58ec54);return new Buffer(_0x1bfb19)[_0x4bdc('0x36')](_0x4bdc('0x30'));}exports['googleCloudTTS']=function(_0x498247,_0x4fa02b,_0x5df97f,_0x186b8f,_0xac46a,_0x54a4de){var _0x177d4d,_0x392310;var _0x26c3fd='https://texttospeech.googleapis.com/v1/';var _0x452a4b=_0x4bdc('0x37')+_0x498247;var _0x4ddedb={};if(_0x4fa02b===_0x4bdc('0x38')){_0x4ddedb[_0x4bdc('0x39')]={'ssml':_0x5df97f};}else{_0x4ddedb[_0x4bdc('0x39')]={'text':_0x5df97f};};_0x4ddedb['voice']={'languageCode':_0x186b8f,'ssmlGender':_0xac46a};_0x4ddedb[_0x4bdc('0x3a')]={'audioEncoding':_0x4bdc('0x3b'),'sampleRateHertz':0x1f40};var _0x40d16b={'url':_0x26c3fd+'text:synthesize'+_0x452a4b,'method':_0x4bdc('0x3c'),'json':!![],'body':_0x4ddedb};return rp(_0x40d16b)[_0x4bdc('0x31')](function(_0x3cd1b9){return new BPromise(function(_0x40964e,_0x2e2c06){_0x177d4d=path[_0x4bdc('0x2b')](__dirname,_0x4bdc('0x2c'),rs[_0x4bdc('0x2d')](0x4)+_0x4bdc('0x3d'));var _0x360e92=Buffer['from'](_0x3cd1b9['audioContent'],_0x4bdc('0x30'));return fs[_0x4bdc('0x3e')](_0x177d4d,_0x360e92,function(_0x58fe02){_0x2e2c06(_0x58fe02);},function(_0xf4a600){fs['chmodSync'](_0x177d4d,'777');_0x40964e(_0xf4a600);});});})['then'](function(_0x2a509b){_0x392310=path[_0x4bdc('0x2b')](__dirname,_0x4bdc('0x2c'),rs[_0x4bdc('0x2d')](0x4)+_0x4bdc('0x2e'));return convertFile(_0x177d4d,_0x392310);})[_0x4bdc('0x31')](function(){try{fs[_0x4bdc('0x1e')](_0x177d4d);fs[_0x4bdc('0x32')](_0x392310,_0x4bdc('0x33'));}catch(_0x15c98c){logger[_0x4bdc('0x18')](_0x15c98c);}logger[_0x4bdc('0x1c')](_0x4bdc('0x3f'),_0x392310[_0x4bdc('0x34')]('.')[0x0]);return _0x392310['split']('.')[0x0];});};exports[_0x4bdc('0x40')]=function(_0x5ee89f,_0x1e0010){var _0xf43b4e='https://translate.google.com/_/TranslateWebserverUi/data/batchexecute';var _0x5831e5,_0x13f25b;var _0x3fe19e;var _0x2a2526={'encoding':'utf8','method':_0x4bdc('0x3c'),'timeout':0x2710,'url':_0xf43b4e,'headers':{'Content-Type':_0x4bdc('0x41')},'body':_0x4bdc('0x42')+encodeURIComponent(JSON[_0x4bdc('0x43')]([[[_0x4bdc('0x44'),JSON[_0x4bdc('0x43')]([_0x5ee89f,_0x1e0010||'en',![],_0x4bdc('0x45')]),null,_0x4bdc('0x46')]]]))};return rp(_0x2a2526)[_0x4bdc('0x31')](function(_0x61e1af){try{_0x3fe19e=eval(_0x61e1af[_0x4bdc('0x47')](0x5))[0x0][0x2];}catch(_0x1fb6bb){throw new Error(_0x4bdc('0x48')+_0x61e1af[_0x4bdc('0x25')]);}if(!_0x3fe19e){if(_0x5ee89f[_0x4bdc('0x49')]>0xc8){throw new Error(_0x4bdc('0x4a'));}else{throw new Error(_0x4bdc('0x4b')+_0x1e0010+'\x22\x20might\x20not\x20exist');}}try{_0x3fe19e=eval(_0x3fe19e)[0x0];}catch(_0x36988f){throw new Error(_0x4bdc('0x48')+res[_0x4bdc('0x25')]);}const _0x5dcd0e=_0x3fe19e;_0x5831e5=path[_0x4bdc('0x2b')](__dirname,_0x4bdc('0x2c'),rs[_0x4bdc('0x2d')](0x4)+_0x4bdc('0x3d'));fs[_0x4bdc('0x2f')](_0x5831e5,_0x3fe19e,{'encoding':'base64'});_0x13f25b=path[_0x4bdc('0x2b')](__dirname,_0x4bdc('0x2c'),rs[_0x4bdc('0x2d')](0x4)+_0x4bdc('0x2e'));return convertFile(_0x5831e5,_0x13f25b);})[_0x4bdc('0x31')](function(){try{fs[_0x4bdc('0x1e')](_0x5831e5);fs[_0x4bdc('0x32')](_0x13f25b,_0x4bdc('0x33'));}catch(_0x29775c){logger[_0x4bdc('0x18')](_0x29775c);}logger[_0x4bdc('0x1c')](_0x4bdc('0x4c'),_0x13f25b[_0x4bdc('0x34')]('.')[0x0]);return _0x13f25b['split']('.')[0x0];});};exports[_0x4bdc('0x4d')]=function(_0x1450cd,_0x3523bc,_0x174399){return google[_0x4bdc('0x4e')](_0x1450cd,_0x3523bc,_0x174399)[_0x4bdc('0x31')](function(_0xe380f6){logger[_0x4bdc('0x1c')](_0xe380f6[_0x4bdc('0x4f')]);return rp(_0xe380f6);})['then'](function(_0x279e8b){var _0x488987='';var _0x3eeeae=0x0;try{fs['unlink'](_0x1450cd);}catch(_0x7ce313){logger[_0x4bdc('0x18')](_0x7ce313);}if(_0x279e8b&&_0x279e8b[_0x4bdc('0x50')]){_0x488987=_0x279e8b[_0x4bdc('0x50')][_0x4bdc('0x51')](function(_0x3e5400){return _0x3e5400&&_0x3e5400['alternatives'][0x0]&&_0x3e5400[_0x4bdc('0x52')][0x0]['transcript']?_0x3e5400[_0x4bdc('0x52')][0x0][_0x4bdc('0x53')]:'';})[_0x4bdc('0x54')]('\x0a');_0x3eeeae=_0x279e8b[_0x4bdc('0x50')][_0x4bdc('0x51')](function(_0x197ddd){return _0x197ddd&&_0x197ddd[_0x4bdc('0x52')][0x0]&&_0x197ddd[_0x4bdc('0x52')][0x0][_0x4bdc('0x55')]?_0x197ddd[_0x4bdc('0x52')][0x0][_0x4bdc('0x55')]:0x0;})[_0x4bdc('0x54')]('\x0a');}logger['info'](_0x4bdc('0x56'),_0x488987);logger['info'](_0x4bdc('0x57'),_0x3eeeae);return{'transcript':_0x488987,'confidence':_0x3eeeae};})[_0x4bdc('0x58')](function(_0x102176){logger['error']('[%s]\x20%s:%s',_0x102176[_0x4bdc('0x17')],_0x102176['name'],_0x102176[_0x4bdc('0x59')]);});};exports[_0x4bdc('0x5a')]=function(_0x2351fd,_0x567ab1,_0x3b6e71,_0x114acd){var _0x1819df=apiai(_0x567ab1,{'language':_0x114acd||'en'});return _0x1819df[_0x4bdc('0x5b')](_0x3b6e71,{'sessionId':md5(_0x2351fd)})[_0x4bdc('0x31')](function(_0x56d3fd){logger['info'](JSON['stringify'](_0x56d3fd));return{'source':_0x56d3fd[_0x4bdc('0x5c')][_0x4bdc('0x5d')],'resolvedQuery':_0x56d3fd[_0x4bdc('0x5c')]['resolvedQuery'],'action':_0x56d3fd[_0x4bdc('0x5c')]['action'],'actionIncomplete':_0x56d3fd[_0x4bdc('0x5c')]['actionIncomplete'],'speech':_0x56d3fd['result'][_0x4bdc('0x5e')][_0x4bdc('0x5f')],'score':_0x56d3fd[_0x4bdc('0x5c')]['score'],'statusCode':_0x56d3fd[_0x4bdc('0x60')][_0x4bdc('0x61')],'endConversation':_0x56d3fd[_0x4bdc('0x5c')][_0x4bdc('0x62')]['endConversation']||![],'isFallbackIntent':_0x56d3fd[_0x4bdc('0x5c')][_0x4bdc('0x62')][_0x4bdc('0x63')]};});};exports[_0x4bdc('0x64')]=function(_0x36fd36,_0xcc3461,_0xd40220,_0xaacf82,_0x32af37,_0x2abf64){var _0x38726a=_0xaacf82[_0x4bdc('0x65')](/\\n/g,'\x0a');var _0x2d9336={'credentials':{'private_key':_0x38726a,'client_email':_0xd40220}};var _0x595423=new dialogflow[(_0x4bdc('0x66'))](_0x2d9336);var _0x36650c=_0x595423['sessionPath'](_0xcc3461,md5(_0x36fd36));var _0x586b02={'session':_0x36650c,'queryInput':{'text':{'text':_0x32af37,'languageCode':_0x2abf64}}};return _0x595423[_0x4bdc('0x67')](_0x586b02)[_0x4bdc('0x31')](function(_0x3e36d4){if(_0x3e36d4&&_0x3e36d4[_0x4bdc('0x49')]){logger[_0x4bdc('0x1c')]('Dialogflow\x20V2\x20response:',JSON[_0x4bdc('0x43')](_0x3e36d4));var _0x3635f8=_0x3e36d4[0x0];if(_0x3635f8){var _0x25d7d8={'action':_0x3635f8[_0x4bdc('0x68')][_0x4bdc('0x69')],'allRequiredParamsPresent':_0x3635f8['queryResult'][_0x4bdc('0x6a')],'endConversation':_0x3635f8['queryResult'][_0x4bdc('0x6b')]&&_0x3635f8[_0x4bdc('0x68')][_0x4bdc('0x6b')][_0x4bdc('0x6c')]?_0x3635f8[_0x4bdc('0x68')][_0x4bdc('0x6b')][_0x4bdc('0x6c')][_0x4bdc('0x6d')][_0x4bdc('0x6e')]:![],'fulfillmentText':_0x3635f8[_0x4bdc('0x68')]['fulfillmentText'],'intentName':_0x3635f8[_0x4bdc('0x68')][_0x4bdc('0x6f')][_0x4bdc('0x70')],'intentDisplayName':_0x3635f8['queryResult'][_0x4bdc('0x6f')]['displayName'],'isFallbackIntent':_0x3635f8['queryResult']['intent'][_0x4bdc('0x71')],'languageCode':_0x3635f8[_0x4bdc('0x68')][_0x4bdc('0x72')],'queryText':_0x3635f8['queryResult'][_0x4bdc('0x73')],'responseId':_0x3635f8[_0x4bdc('0x74')],'score':_0x3635f8[_0x4bdc('0x68')][_0x4bdc('0x75')],'speech':_0x3635f8[_0x4bdc('0x68')]['fulfillmentText'],'providerResponse':JSON[_0x4bdc('0x43')](_0x3e36d4)};return _0x25d7d8;}}});};exports[_0x4bdc('0x76')]=function(_0x27d821,_0x468953,_0x57caf6,_0x56eb5d){return tilde[_0x4bdc('0x4e')](_0x27d821,_0x468953,_0x57caf6,_0x56eb5d)[_0x4bdc('0x31')](function(_0x33e6c5){try{fs[_0x4bdc('0x1e')](_0x27d821);}catch(_0x4a56d9){logger[_0x4bdc('0x18')](_0x4a56d9);}logger[_0x4bdc('0x1c')]('Tilde\x20ASR\x20transcription',_0x33e6c5[_0x4bdc('0x53')]);logger[_0x4bdc('0x1c')](_0x4bdc('0x77'),_0x33e6c5[_0x4bdc('0x55')]);return _0x33e6c5;});};exports[_0x4bdc('0x78')]=function(_0x20e3e1,_0x37f123,_0x55220f,_0x5c662d,_0x4245d9,_0x292473){var _0x326569=path[_0x4bdc('0x2b')](__dirname,_0x4bdc('0x2c'),rs[_0x4bdc('0x2d')](0x4)+'.mp3');var _0x45b44a;return aws['polly'](_0x20e3e1,_0x37f123,_0x55220f,_0x5c662d,_0x4245d9,_0x292473,_0x326569)[_0x4bdc('0x31')](function(){_0x45b44a=path[_0x4bdc('0x2b')](__dirname,_0x4bdc('0x2c'),rs[_0x4bdc('0x2d')](0x4)+_0x4bdc('0x2e'));return convertFile(_0x326569,_0x45b44a);})[_0x4bdc('0x31')](function(){try{fs['unlink'](_0x326569);fs[_0x4bdc('0x32')](_0x45b44a,_0x4bdc('0x33'));}catch(_0x58d1bb){logger['error'](_0x58d1bb);}return _0x45b44a['split']('.')[0x0];});};exports['awsLex']=function(_0x35a54e,_0x67ef6c,_0x2ec367,_0x32b774,_0x3a9e1a,_0x335d02){return aws[_0x4bdc('0x79')](_0x35a54e,_0x67ef6c,_0x2ec367,_0x32b774,_0x3a9e1a,_0x335d02)[_0x4bdc('0x31')](function(_0x53ce19){logger[_0x4bdc('0x1c')](JSON[_0x4bdc('0x43')](_0x53ce19));return _0x53ce19;});};exports['ispeechTTS']=function(_0x54c51c,_0x5d1a6c,_0x2f2dec,_0x4be3f2){var _0x55cf6c=util[_0x4bdc('0x7a')](_0x4bdc('0x7b'),ISPEECH_API,_0x54c51c,encodeURIComponent(_0x5d1a6c),_0x2f2dec,_0x4be3f2);var _0x38c7db=path[_0x4bdc('0x2b')](__dirname,'tmp',rs[_0x4bdc('0x2d')](0x4)+_0x4bdc('0x3d'));var _0x28478e;return downloadFile(_0x55cf6c,_0x38c7db)['then'](function(){_0x28478e=path[_0x4bdc('0x2b')](__dirname,'tmp',rs['generate'](0x4)+'.wav');return convertFile(_0x38c7db,_0x28478e);})[_0x4bdc('0x31')](function(){try{fs['unlink'](_0x38c7db);fs[_0x4bdc('0x32')](_0x28478e,_0x4bdc('0x33'));}catch(_0x327500){logger[_0x4bdc('0x18')](_0x327500);}return _0x28478e[_0x4bdc('0x34')]('.')[0x0];});};exports[_0x4bdc('0x7c')]=function(_0x307544,_0x54ad86,_0x3f7a75,_0x8ed59a){var _0x46cf99=util['format'](_0x4bdc('0x7d'),ISPEECH_API,_0x54ad86,_0x3f7a75,base64Encode(_0x307544),_0x8ed59a?util[_0x4bdc('0x7a')](_0x4bdc('0x7e'),encodeURIComponent(_0x8ed59a)):_0x4bdc('0x7f'));return uploadFile(_0x46cf99)['then'](function(_0x29b54d){return querystring[_0x4bdc('0xc')](_0x29b54d);});};exports[_0x4bdc('0x80')]=function(_0x5a3aea,_0x5633aa){return sestek[_0x4bdc('0x81')](_0x5a3aea,_0x5633aa)[_0x4bdc('0x31')](function(_0x412a72){logger[_0x4bdc('0x1c')](JSON['stringify'](_0x412a72));var _0x270850={'speech':_0x412a72[_0x4bdc('0x82')],'action':_0x412a72[_0x4bdc('0x83')]?_0x412a72[_0x4bdc('0x83')][_0x4bdc('0x84')]:undefined,'actiondata':_0x412a72[_0x4bdc('0x83')]?_0x412a72[_0x4bdc('0x83')][_0x4bdc('0x85')]:undefined};if(_0x412a72[_0x4bdc('0x83')]&&_0x412a72['channelData'][_0x4bdc('0x86')]){return base64Decode(_0x412a72[_0x4bdc('0x83')]['AudioFromTts'][_0x4bdc('0x87')],path[_0x4bdc('0x2b')](__dirname,_0x4bdc('0x2c'),rs[_0x4bdc('0x2d')](0x4)+_0x4bdc('0x2e')))[_0x4bdc('0x31')](function(_0x465a3c){_0x270850['audiofile']=_0x465a3c;return _0x270850;});}return _0x270850;});};exports['dirName']=function(){return __dirname;}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/index.js b/server/services/agi/scripts/sestek/index.js index d868879..8f34e03 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 _0x5bd0=['./nda'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5bd0,0x12c));var _0x05bd=function(_0x41d902,_0x29d0b){_0x41d902=_0x41d902-0x0;var _0x360fb1=_0x5bd0[_0x41d902];return _0x360fb1;};var nda=require(_0x05bd('0x0'));module['exports']={'nda':nda}; \ No newline at end of file +var nda=require('./nda');module['exports']={'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 c534062..baef7fc 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 _0x50c1=['message','Nda','uniqueid','callerid','dnid','Bearer\x20','access_token','project','body','channelData','ProjectName','ndagenerate_audio','custom_action','CustomAction','custom_action_data','CustomActionData','info','stringify','request-promise','../../../../../config/logger','exports','POST','resolve','ndauth_url','password','username','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type'];(function(_0x6a5849,_0x5e2ae5){var _0x20f5fc=function(_0x486bda){while(--_0x486bda){_0x6a5849['push'](_0x6a5849['shift']());}};_0x20f5fc(++_0x5e2ae5);}(_0x50c1,0x1b6));var _0x150c=function(_0x37f603,_0x26bc33){_0x37f603=_0x37f603-0x0;var _0x6b1864=_0x50c1[_0x37f603];return _0x6b1864;};'use strict';var rp=require(_0x150c('0x0'));var url=require('url');var logger=require(_0x150c('0x1'))('agi');module[_0x150c('0x2')]=function(_0x786960,_0x4fdcdf){var _0x11216a={'method':_0x150c('0x3'),'uri':url[_0x150c('0x4')](_0x4fdcdf[_0x150c('0x5')],'/token'),'form':{'grant_type':_0x150c('0x6'),'username':_0x4fdcdf[_0x150c('0x7')],'password':_0x4fdcdf['password']},'json':!![]};return rp(_0x11216a)[_0x150c('0x8')](function(_0x19abd2){var _0x316817={'method':_0x150c('0x3'),'uri':url['resolve'](_0x4fdcdf[_0x150c('0x9')],_0x150c('0xa')),'body':{'type':_0x4fdcdf[_0x150c('0xb')]||_0x150c('0xc'),'channelId':_0x150c('0xd'),'conversation':{'id':_0x786960[_0x150c('0xe')]},'from':{'id':_0x786960[_0x150c('0xf')],'name':_0x786960['calleridname']},'recipient':{'id':_0x786960[_0x150c('0x10')],'name':_0x786960['extension']},'text':_0x4fdcdf['text'],'channelData':{}},'headers':{'Authorization':_0x150c('0x11')+_0x19abd2[_0x150c('0x12')]},'json':!![]};if(_0x4fdcdf[_0x150c('0x13')]){_0x316817[_0x150c('0x14')][_0x150c('0x15')][_0x150c('0x16')]=_0x4fdcdf[_0x150c('0x13')];}if(_0x4fdcdf[_0x150c('0x17')]=='1'){_0x316817[_0x150c('0x14')]['channelData']['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x4fdcdf[_0x150c('0x18')]){_0x316817[_0x150c('0x14')][_0x150c('0x15')][_0x150c('0x19')]=_0x4fdcdf[_0x150c('0x18')];if(_0x4fdcdf[_0x150c('0x1a')]){_0x316817['body'][_0x150c('0x15')][_0x150c('0x1b')]=_0x4fdcdf['custom_action_data'];}}logger[_0x150c('0x1c')](JSON[_0x150c('0x1d')](_0x316817));return rp(_0x316817);});}; \ No newline at end of file +var _0x1ba2=['audio/wav','CustomAction','custom_action','custom_action_data','channelData','stringify','request-promise','../../../../../config/logger','exports','POST','ndauth_url','/token','username','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','message','Nda','uniqueid','callerid','calleridname','dnid','extension','text','Bearer\x20','access_token','project','body','ndagenerate_audio'];(function(_0x546457,_0x3b0977){var _0x18a542=function(_0x12c3f0){while(--_0x12c3f0){_0x546457['push'](_0x546457['shift']());}};_0x18a542(++_0x3b0977);}(_0x1ba2,0xb4));var _0x21ba=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1ba2[_0x3dd15e];return _0x231fd0;};'use strict';var rp=require(_0x21ba('0x0'));var url=require('url');var logger=require(_0x21ba('0x1'))('agi');module[_0x21ba('0x2')]=function(_0x349a68,_0x46eb26){var _0xface0a={'method':_0x21ba('0x3'),'uri':url['resolve'](_0x46eb26[_0x21ba('0x4')],_0x21ba('0x5')),'form':{'grant_type':'password','username':_0x46eb26[_0x21ba('0x6')],'password':_0x46eb26['password']},'json':!![]};return rp(_0xface0a)[_0x21ba('0x7')](function(_0x23c3b7){var _0x5c50aa={'method':_0x21ba('0x3'),'uri':url['resolve'](_0x46eb26[_0x21ba('0x8')],_0x21ba('0x9')),'body':{'type':_0x46eb26['ndaactivity_type']||_0x21ba('0xa'),'channelId':_0x21ba('0xb'),'conversation':{'id':_0x349a68[_0x21ba('0xc')]},'from':{'id':_0x349a68[_0x21ba('0xd')],'name':_0x349a68[_0x21ba('0xe')]},'recipient':{'id':_0x349a68[_0x21ba('0xf')],'name':_0x349a68[_0x21ba('0x10')]},'text':_0x46eb26[_0x21ba('0x11')],'channelData':{}},'headers':{'Authorization':_0x21ba('0x12')+_0x23c3b7[_0x21ba('0x13')]},'json':!![]};if(_0x46eb26[_0x21ba('0x14')]){_0x5c50aa[_0x21ba('0x15')]['channelData']['ProjectName']=_0x46eb26[_0x21ba('0x14')];}if(_0x46eb26[_0x21ba('0x16')]=='1'){_0x5c50aa[_0x21ba('0x15')]['channelData']['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x21ba('0x17')};}if(_0x46eb26['custom_action']){_0x5c50aa[_0x21ba('0x15')]['channelData'][_0x21ba('0x18')]=_0x46eb26[_0x21ba('0x19')];if(_0x46eb26[_0x21ba('0x1a')]){_0x5c50aa[_0x21ba('0x15')][_0x21ba('0x1b')]['CustomActionData']=_0x46eb26[_0x21ba('0x1a')];}}logger['info'](JSON[_0x21ba('0x1c')](_0x5c50aa));return rp(_0x5c50aa);});}; \ 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 dd50059..8184af1 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 _0xe95b=['exports'];(function(_0x1e9424,_0x191cba){var _0x1bd96c=function(_0x5e952d){while(--_0x5e952d){_0x1e9424['push'](_0x1e9424['shift']());}};_0x1bd96c(++_0x191cba);}(_0xe95b,0xcf));var _0xbe95=function(_0x551837,_0x5804de){_0x551837=_0x551837-0x0;var _0x3b0485=_0xe95b[_0x551837];return _0x3b0485;};'use strict';var asr=require('./lib/api');module[_0xbe95('0x0')]=function(_0x1ae2a1,_0x5e95c2,_0x5822a9,_0x3ddb27){return asr(_0x1ae2a1,_0x5e95c2,_0x5822a9,_0x3ddb27);}; \ No newline at end of file +var _0x73d0=['./lib/api'];(function(_0x41c88c,_0x381f8d){var _0x2c97ea=function(_0x35fd44){while(--_0x35fd44){_0x41c88c['push'](_0x41c88c['shift']());}};_0x2c97ea(++_0x381f8d);}(_0x73d0,0xf5));var _0x073d=function(_0x2f6412,_0x542c2d){_0x2f6412=_0x2f6412-0x0;var _0x47ce04=_0x73d0[_0x2f6412];return _0x47ce04;};'use strict';var asr=require(_0x073d('0x0'));module['exports']=function(_0x496cd0,_0x28a97a,_0x3be7f3,_0x2485d1){return asr(_0x496cd0,_0x28a97a,_0x3be7f3,_0x2485d1);}; \ 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 b7a8a79..39fa42c 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 _0x48b8=['Error\x20Tilde\x20ASR\x20socket','isObject','open','message','lodash','moment','crypto','../../../../../../config/logger','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','digest','hex','send','createReadStream','data','close','Tilde\x20ASR\x20send\x20error','stringify','terminate','parse','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Authentication\x20failed.','error','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket'];(function(_0x4b704d,_0x565de7){var _0x4d199c=function(_0x274433){while(--_0x274433){_0x4b704d['push'](_0x4b704d['shift']());}};_0x4d199c(++_0x565de7);}(_0x48b8,0x1f2));var _0x848b=function(_0x127e10,_0x590f9c){_0x127e10=_0x127e10-0x0;var _0x846cec=_0x48b8[_0x127e10];return _0x846cec;};'use strict';var BPromise=require('bluebird');var _=require(_0x848b('0x0'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x848b('0x1'));var crypto=require(_0x848b('0x2'));var logger=require(_0x848b('0x3'))('agi');module[_0x848b('0x4')]=function(_0x541f0f,_0x1b8cac,_0x10066f,_0x55b905){return new BPromise(function(_0x44633e,_0x52c5b5){logger[_0x848b('0x5')](_0x848b('0x6'),_0x55b905||_0x848b('0x7'));var _0x5ada34=new WebSocket(_0x55b905||_0x848b('0x7'),{'perMessageDeflate':![]});var _0x1f73f4='';var _0x15539b='0';var _0x4fcd49='1';var _0x532a84=_0x848b('0x8');function _0x213b0f(_0x55bfa4){var _0x160ca7=crypto[_0x848b('0x9')](_0x848b('0xa'));_0x160ca7['update'](_0x55bfa4);return _0x160ca7[_0x848b('0xb')](_0x848b('0xc'));}function _0x17c7a6(){try{logger[_0x848b('0x5')]('Open\x20Tilde\x20ASR\x20socket');var _0x3c5547=moment()['unix']();var _0x5cb6b5=_0x213b0f(_0x3c5547+_0x1b8cac+_0x10066f);_0x5ada34[_0x848b('0xd')](JSON['stringify']({'appID':_0x1b8cac,'timestamp':_0x3c5547,'appKey':_0x5cb6b5}));var _0x27120b=fs[_0x848b('0xe')](_0x541f0f);_0x27120b['on'](_0x848b('0xf'),function(_0x1f2ee8){_0x5ada34[_0x848b('0xd')](_0x1f2ee8);});_0x27120b['on'](_0x848b('0x10'),function(){_0x5ada34['send']('EOS');});}catch(_0x486f8f){logger['error'](_0x848b('0x11'),JSON[_0x848b('0x12')](_0x486f8f));_0x5ada34[_0x848b('0x13')]();}}function _0x3a6634(_0x472cd0){try{if(_0x472cd0){var _0x3e0bae=JSON[_0x848b('0x14')](_0x472cd0);switch(_0x3e0bae[_0x848b('0x15')]){case 0x0:if(_0x3e0bae[_0x848b('0x16')]){if(_0x3e0bae[_0x848b('0x16')][_0x848b('0x17')]){logger[_0x848b('0x5')](_0x848b('0x18'),JSON[_0x848b('0x12')](_0x3e0bae[_0x848b('0x16')][_0x848b('0x19')]));_0x1f73f4=_0x3e0bae[_0x848b('0x16')][_0x848b('0x19')][0x0][_0x848b('0x1a')];_0x15539b=_0x3e0bae['result']['hypotheses'][0x0][_0x848b('0x1b')];_0x4fcd49='0';_0x532a84=_0x848b('0x1c');_0x5ada34['terminate']();}}break;case 0x1:logger[_0x848b('0x5')](_0x848b('0x8'));_0x4fcd49='1';_0x532a84=_0x848b('0x8');break;case 0x2:logger[_0x848b('0x5')](_0x848b('0x1d'));_0x4fcd49='2';_0x532a84=_0x848b('0x1d');break;case 0x9:logger[_0x848b('0x5')]('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x4fcd49='9';_0x532a84='Not\x20available.\x20Max\x20load\x20limit\x20reached.';break;case 0xa:logger['info'](_0x848b('0x1e'));_0x4fcd49='10';_0x532a84=_0x848b('0x1e');break;case 0xb:logger[_0x848b('0x5')]('All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.');_0x4fcd49='11';_0x532a84='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x99ee97){logger[_0x848b('0x1f')](_0x848b('0x20'),JSON[_0x848b('0x12')](_0x99ee97));_0x5ada34['terminate']();}}function _0x10502f(){logger['info'](_0x848b('0x21'));_0x44633e({'transcript':_0x1f73f4,'confidence':_0x15539b,'status':_0x4fcd49,'status_message':_0x532a84});}function _0x4efecf(_0x52c732){logger[_0x848b('0x1f')](_0x848b('0x22'));if(!_['isNil'](_0x52c732)){logger['error'](_[_0x848b('0x23')](_0x52c732)?JSON[_0x848b('0x12')](_0x52c732):_0x52c732);}}_0x5ada34['on'](_0x848b('0x24'),_0x17c7a6);_0x5ada34['on'](_0x848b('0x25'),_0x3a6634);_0x5ada34['on'](_0x848b('0x10'),_0x10502f);_0x5ada34['on'](_0x848b('0x1f'),_0x4efecf);});}; \ No newline at end of file +var _0xa074=['result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','Success.','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','error','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open','message','bluebird','lodash','crypto','../../../../../../config/logger','agi','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','sha1','update','hex','unix','send','data','close','Tilde\x20ASR\x20send\x20error','stringify','terminate','parse'];(function(_0x316b79,_0x18b97c){var _0x491acb=function(_0x52746f){while(--_0x52746f){_0x316b79['push'](_0x316b79['shift']());}};_0x491acb(++_0x18b97c);}(_0xa074,0x1e8));var _0x4a07=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0xa074[_0x53ccf2];return _0x5a2964;};'use strict';var BPromise=require(_0x4a07('0x0'));var _=require(_0x4a07('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require(_0x4a07('0x2'));var logger=require(_0x4a07('0x3'))(_0x4a07('0x4'));module['exports']=function(_0x188c9a,_0x1fd728,_0x4d641d,_0x48d489){return new BPromise(function(_0x41c4a6,_0x1b78f5){logger[_0x4a07('0x5')](_0x4a07('0x6'),_0x48d489||_0x4a07('0x7'));var _0x40765f=new WebSocket(_0x48d489||_0x4a07('0x7'),{'perMessageDeflate':![]});var _0x23e2a5='';var _0x383abd='0';var _0x31a6f8='1';var _0x215cd2='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';function _0x266e46(_0x168b87){var _0x227962=crypto['createHash'](_0x4a07('0x8'));_0x227962[_0x4a07('0x9')](_0x168b87);return _0x227962['digest'](_0x4a07('0xa'));}function _0x2fc824(){try{logger[_0x4a07('0x5')]('Open\x20Tilde\x20ASR\x20socket');var _0x34899a=moment()[_0x4a07('0xb')]();var _0x4c4093=_0x266e46(_0x34899a+_0x1fd728+_0x4d641d);_0x40765f[_0x4a07('0xc')](JSON['stringify']({'appID':_0x1fd728,'timestamp':_0x34899a,'appKey':_0x4c4093}));var _0x69f501=fs['createReadStream'](_0x188c9a);_0x69f501['on'](_0x4a07('0xd'),function(_0x2a9a8e){_0x40765f[_0x4a07('0xc')](_0x2a9a8e);});_0x69f501['on'](_0x4a07('0xe'),function(){_0x40765f[_0x4a07('0xc')]('EOS');});}catch(_0x5f4ddc){logger['error'](_0x4a07('0xf'),JSON[_0x4a07('0x10')](_0x5f4ddc));_0x40765f[_0x4a07('0x11')]();}}function _0x5a3b85(_0x1ba5db){try{if(_0x1ba5db){var _0x128ed8=JSON[_0x4a07('0x12')](_0x1ba5db);switch(_0x128ed8['status']){case 0x0:if(_0x128ed8['result']){if(_0x128ed8[_0x4a07('0x13')][_0x4a07('0x14')]){logger[_0x4a07('0x5')](_0x4a07('0x15'),JSON[_0x4a07('0x10')](_0x128ed8[_0x4a07('0x13')][_0x4a07('0x16')]));_0x23e2a5=_0x128ed8[_0x4a07('0x13')]['hypotheses'][0x0][_0x4a07('0x17')];_0x383abd=_0x128ed8[_0x4a07('0x13')]['hypotheses'][0x0][_0x4a07('0x18')];_0x31a6f8='0';_0x215cd2=_0x4a07('0x19');_0x40765f[_0x4a07('0x11')]();}}break;case 0x1:logger[_0x4a07('0x5')](_0x4a07('0x1a'));_0x31a6f8='1';_0x215cd2=_0x4a07('0x1a');break;case 0x2:logger[_0x4a07('0x5')](_0x4a07('0x1b'));_0x31a6f8='2';_0x215cd2='Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.';break;case 0x9:logger[_0x4a07('0x5')](_0x4a07('0x1c'));_0x31a6f8='9';_0x215cd2='Not\x20available.\x20Max\x20load\x20limit\x20reached.';break;case 0xa:logger[_0x4a07('0x5')](_0x4a07('0x1d'));_0x31a6f8='10';_0x215cd2=_0x4a07('0x1d');break;case 0xb:logger[_0x4a07('0x5')](_0x4a07('0x1e'));_0x31a6f8='11';_0x215cd2=_0x4a07('0x1e');}}}catch(_0x1ad1f7){logger[_0x4a07('0x1f')](_0x4a07('0x20'),JSON[_0x4a07('0x10')](_0x1ad1f7));_0x40765f[_0x4a07('0x11')]();}}function _0x85f399(){logger[_0x4a07('0x5')](_0x4a07('0x21'));_0x41c4a6({'transcript':_0x23e2a5,'confidence':_0x383abd,'status':_0x31a6f8,'status_message':_0x215cd2});}function _0x3ba1a5(_0x3717c4){logger[_0x4a07('0x1f')](_0x4a07('0x22'));if(!_[_0x4a07('0x23')](_0x3717c4)){logger[_0x4a07('0x1f')](_[_0x4a07('0x24')](_0x3717c4)?JSON['stringify'](_0x3717c4):_0x3717c4);}}_0x40765f['on'](_0x4a07('0x25'),_0x2fc824);_0x40765f['on'](_0x4a07('0x26'),_0x5a3b85);_0x40765f['on'](_0x4a07('0xe'),_0x85f399);_0x40765f['on'](_0x4a07('0x1f'),_0x3ba1a5);});}; \ 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 2e3ceea..1554b35 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 _0x0384=['./asr'];(function(_0xb4f240,_0x15f734){var _0x30682a=function(_0x349112){while(--_0x349112){_0xb4f240['push'](_0xb4f240['shift']());}};_0x30682a(++_0x15f734);}(_0x0384,0x158));var _0x4038=function(_0xa1e1e1,_0x2f3463){_0xa1e1e1=_0xa1e1e1-0x0;var _0x3d83a5=_0x0384[_0xa1e1e1];return _0x3d83a5;};var asr=require(_0x4038('0x0'));module['exports']={'asr':asr}; \ No newline at end of file +var _0x35c3=['./asr','exports'];(function(_0x39bf66,_0x412e6a){var _0x16ac5e=function(_0x2e249a){while(--_0x2e249a){_0x39bf66['push'](_0x39bf66['shift']());}};_0x16ac5e(++_0x412e6a);}(_0x35c3,0x1d2));var _0x335c=function(_0x4e9f9f,_0x1f5c62){_0x4e9f9f=_0x4e9f9f-0x0;var _0x5ada14=_0x35c3[_0x4e9f9f];return _0x5ada14;};var asr=require(_0x335c('0x0'));module[_0x335c('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index cae321f..b2dd188 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 _0x7ed2=['net','events','EventEmitter','./error','127.0.0.1','call','E_AGI_ARGUMENT_PORT','listening','emit','getConnections','error','E_AGI_SERVER_ERROR','destroy','ready','code','close','E_AGI_SERVER_CLOSE','inherits','exports'];(function(_0x353abb,_0x194c80){var _0x43c9c5=function(_0x456b74){while(--_0x456b74){_0x353abb['push'](_0x353abb['shift']());}};_0x43c9c5(++_0x194c80);}(_0x7ed2,0x156));var _0x27ed=function(_0x5be62f,_0x3d6279){_0x5be62f=_0x5be62f-0x0;var _0x1e0356=_0x7ed2[_0x5be62f];return _0x1e0356;};'use strict';var util=require('util');var net=require(_0x27ed('0x0'));var EventEmitter=require(_0x27ed('0x1'))[_0x27ed('0x2')];var AGIError=require(_0x27ed('0x3'));var AGIChannel=require('./channel');var AGIServer=function(_0x539fcb,_0x2c7ff5,_0x3822e1){var _0xbe809e=this,_0x539fcb=_0x539fcb||0x11dd,_0x2c7ff5=_0x2c7ff5||_0x27ed('0x4'),_0x2d84b7=null,_0x278695=0x0;EventEmitter[_0x27ed('0x5')](_0xbe809e);function _0x30e474(){if(!_0x539fcb){_0xbe809e['emit']('error',new AGIError(_0x27ed('0x6')));return![];}_0x2d84b7=net['createServer']();_0x2d84b7['listen'](_0x539fcb,_0x2c7ff5);_0x2d84b7['on'](_0x27ed('0x7'),function(){_0xbe809e[_0x27ed('0x8')](_0x27ed('0x7'));});_0x2d84b7['on']('connection',function(_0x30f7a3){_0x2d84b7[_0x27ed('0x9')](function(_0x51a890,_0x20805d){if(_0x51a890){_0xbe809e[_0x27ed('0x8')](_0x27ed('0xa'),new AGIError(_0x27ed('0xb'),_0x51a890));}else if(_0x3822e1&&_0x3822e1<0x0){_0xbe809e[_0x27ed('0x8')](_0x27ed('0xa'),new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x30f7a3['destroy']();}else if(_0x3822e1&&_0x3822e1>0x0&&_0x3822e1<_0x20805d){_0x278695+=0x1;_0xbe809e[_0x27ed('0x8')](_0x27ed('0xa'),new AGIError('E_AGI_SERVER_MAXCONNECTION',_0x278695));_0x30f7a3[_0x27ed('0xc')]();}else{var _0x319175=new AGIChannel(_0x30f7a3);_0x319175['on'](_0x27ed('0xd'),function(){_0xbe809e[_0x27ed('0x8')]('connection',_0x319175);});}});});_0x2d84b7['on'](_0x27ed('0xa'),function(_0x3622a3){_0xbe809e['emit'](_0x27ed('0xa'),new AGIError(_0x27ed('0xb'),_0x3622a3[_0x27ed('0xe')]));});_0x2d84b7['on'](_0x27ed('0xf'),function(){_0xbe809e[_0x27ed('0x8')](_0x27ed('0xf'),new AGIError(_0x27ed('0x10')));});}process['nextTick'](function(){_0x30e474();});};util[_0x27ed('0x11')](AGIServer,EventEmitter);module[_0x27ed('0x12')]=function(_0x4b8904,_0x48f9d0,_0x352cca){return new AGIServer(_0x4b8904,_0x48f9d0,_0x352cca);}; \ No newline at end of file +var _0x589f=['nextTick','inherits','exports','net','events','EventEmitter','./error','./channel','127.0.0.1','call','emit','error','listening','connection','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','code','close','E_AGI_SERVER_CLOSE'];(function(_0x5c23c8,_0x566e24){var _0x2ebbee=function(_0x1fbb73){while(--_0x1fbb73){_0x5c23c8['push'](_0x5c23c8['shift']());}};_0x2ebbee(++_0x566e24);}(_0x589f,0x1a7));var _0xf589=function(_0x4b354f,_0x350965){_0x4b354f=_0x4b354f-0x0;var _0xe3f93c=_0x589f[_0x4b354f];return _0xe3f93c;};'use strict';var util=require('util');var net=require(_0xf589('0x0'));var EventEmitter=require(_0xf589('0x1'))[_0xf589('0x2')];var AGIError=require(_0xf589('0x3'));var AGIChannel=require(_0xf589('0x4'));var AGIServer=function(_0x26e2c2,_0x31925e,_0x1373a4){var _0x51aed5=this,_0x26e2c2=_0x26e2c2||0x11dd,_0x31925e=_0x31925e||_0xf589('0x5'),_0x51f026=null,_0x5bd22e=0x0;EventEmitter[_0xf589('0x6')](_0x51aed5);function _0x36b6c1(){if(!_0x26e2c2){_0x51aed5[_0xf589('0x7')](_0xf589('0x8'),new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x51f026=net['createServer']();_0x51f026['listen'](_0x26e2c2,_0x31925e);_0x51f026['on'](_0xf589('0x9'),function(){_0x51aed5[_0xf589('0x7')](_0xf589('0x9'));});_0x51f026['on'](_0xf589('0xa'),function(_0x48788f){_0x51f026['getConnections'](function(_0x1a8c9f,_0x409b38){if(_0x1a8c9f){_0x51aed5['emit'](_0xf589('0x8'),new AGIError(_0xf589('0xb'),_0x1a8c9f));}else if(_0x1373a4&&_0x1373a4<0x0){_0x51aed5['emit'](_0xf589('0x8'),new AGIError(_0xf589('0xc')));_0x48788f[_0xf589('0xd')]();}else if(_0x1373a4&&_0x1373a4>0x0&&_0x1373a4<_0x409b38){_0x5bd22e+=0x1;_0x51aed5[_0xf589('0x7')](_0xf589('0x8'),new AGIError(_0xf589('0xe'),_0x5bd22e));_0x48788f[_0xf589('0xd')]();}else{var _0x2edcdc=new AGIChannel(_0x48788f);_0x2edcdc['on']('ready',function(){_0x51aed5[_0xf589('0x7')](_0xf589('0xa'),_0x2edcdc);});}});});_0x51f026['on']('error',function(_0x24b4d2){_0x51aed5[_0xf589('0x7')](_0xf589('0x8'),new AGIError(_0xf589('0xb'),_0x24b4d2[_0xf589('0xf')]));});_0x51f026['on'](_0xf589('0x10'),function(){_0x51aed5[_0xf589('0x7')](_0xf589('0x10'),new AGIError(_0xf589('0x11')));});}process[_0xf589('0x12')](function(){_0x36b6c1();});};util[_0xf589('0x13')](AGIServer,EventEmitter);module[_0xf589('0x14')]=function(_0x1bca38,_0x2de2f6,_0xfae1d1){return new AGIServer(_0x1bca38,_0x2de2f6,_0xfae1d1);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 5c54f5e..b0db858 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 _0x74fd=['no\x20appsecret\x20configured','tilde\x20%s\x20file\x20created','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','false','gotoiftime','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','true','hangup','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','%s/recordings/%s','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','findBy','no\x20find\x20by\x20configured','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','Enter\x20in\x20LOGOUT\x20(%s)\x20block','FIND\x20AGENT\x20%s\x20BY\x20%s','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','digit','output','getPause','pause_id','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','indexOf','QUEUE','gosub','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','escape_digits','restapi','no\x20url\x20configured','Response:','inspect','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','variable\x20%s\x20set','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','getMailAccount','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','user','bcc','template_id','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','Answer','Skipped\x20Answer','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','getSquareProject','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','agi://%s/square,\x22%s\x22,\x22%s\x22','host','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','Enter\x20in\x20SWITCH\x20(%s)\x20block','exports','util','shelljs','odbc','randomstring','moment','mustache','request-promise','../../config/logger','agi','../../config/environment','/var/opt/motion2/server/files','rawHeaders','menu','getdigits','getsecretdigits','rpc','getVariable','getVariableById','then','name','catch','prototype','getVoiceQueue','getSquareProjectById','dsn','getUser','getTrunk','getTrunkById','getSoundById','getSoundPath','save_name','getMailAccountById','sendMailMessage','getIntervalById','IntervalId','map','format','%s/sounds/converted/%s','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','createSmsMessage','createSquareDetailsReport','uniqueid','agicommand','channel','arg_1','callerid','createSquareRecording','calleridname','context','extension','priority','dnid','createSquareMessage','createCmContact','isNil','callback_','random','isEmpty','lastName','phone','scheduledAt','Callback\x20scheduled\x20at\x20','toString','getPauseById','agentPause','agentUnpause','agent','agentLogout','agentLogin','internal','LOCAL','shellCommand','exec','trim','replace','googleCloudTTS','apiKey','text','languageCode','en-US','ssmlGender','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','url','method','number','timeout','POST','PUT','toUpperCase','body','rawBody','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','parse','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusMessage','statusCode','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','dialogflow_language','googleDialogflowV2','client_email','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','key','ispeech_asr_language','isConfigured','awsPolly','aws_access_key_id','aws_polly_voice','aws_text_type','awsLex','aws_lex_region','aws_bot_name','googleASR','tildeASR','appid','appsecret','uri','clear','includes','clone','hasOwnProperty','isString','replaceObjectAllVariables','isPlainObject','recursiveNodeIndex','isArray','length','replaceAllVariables','saveRestApiResult','%s.%s','setVariable','split','replaceAll','extra','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','retry','mrcpsynth','label','noop','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','add','minutes','callback_priority','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','list_id','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','no\x20text\x20configured','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_TRANSCRIPT','RECOG_INSTANCE()','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','getSquareOdbc','no\x20odbc\x20database\x20found','no\x20query\x20configured','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','keys','forEach','%s[%s][%s]','%s_ROWS_COUNT','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','DIAL','SIP/%s','opts','Executed\x20command\x20%s','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','out','dialogflow','speech','Dialogflow\x20is\x20unreachable','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','bot','Trying\x20DialogflowV2:\x20%s','providerResponse','dialogflowV2','DialogflowV2\x20Result\x20%s','sesteknda','ndauth_url','no\x20ndauth\x20url\x20configured','username','password','no\x20password\x20configured','ndassistant_url','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','.wav','SestekNDA\x20Result\x20%s','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','trunk_name','SIP/%s/%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','getSound','no\x20file\x20audio\x20found','getData','response','maxdigit','test','mindigit','hiddendigitsnum','first','substr','generate','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','aws_secret_access_key','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','unlink','aws\x20Polly\x20is\x20unreachable','awslex','no\x20valid\x20credentials\x20configured','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','beep','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured'];(function(_0x181d2d,_0x480cc8){var _0x4a0cfc=function(_0x5e96b1){while(--_0x5e96b1){_0x181d2d['push'](_0x181d2d['shift']());}};_0x4a0cfc(++_0x480cc8);}(_0x74fd,0x8f));var _0xd74f=function(_0x4d07cc,_0x587613){_0x4d07cc=_0x4d07cc-0x0;var _0x42de3b=_0x74fd[_0x4d07cc];return _0x42de3b;};'use strict';var fs=require('fs');var util=require(_0xd74f('0x0'));var _=require('lodash');var sh=require(_0xd74f('0x1'));var odbc=require(_0xd74f('0x2'))();var rs=require(_0xd74f('0x3'));var moment=require(_0xd74f('0x4'));var Mustache=require(_0xd74f('0x5'));var rp=require(_0xd74f('0x6'));var logger=require(_0xd74f('0x7'))(_0xd74f('0x8'));var config=require(_0xd74f('0x9'));var shared=require('../../config/environment/shared');var scripts=require('./scripts');var FILES_PATH=_0xd74f('0xa');var recursiveMapAttributes=[_0xd74f('0xb'),'rawBody'];var verticesWithRetry=[_0xd74f('0xc'),_0xd74f('0xd'),_0xd74f('0xe')];var AGIVertices=function(_0x1e063a,_0x20b73a,_0x514d18){this['channel']=_0x1e063a;this[_0xd74f('0xf')]=_0x20b73a;this['mailRpc']=_0x514d18;};AGIVertices['prototype'][_0xd74f('0x10')]=function(_0x1feb0a,_0x226c0f){this[_0xd74f('0xf')][_0xd74f('0x11')](_0x1feb0a)[_0xd74f('0x12')](function(_0x102176){_0x226c0f(null,_0x102176?_0x102176[_0xd74f('0x13')]:![]);})[_0xd74f('0x14')](function(_0x59998d){_0x226c0f(_0x59998d);});};AGIVertices[_0xd74f('0x15')][_0xd74f('0x16')]=function(_0x25ffbd,_0x1a0d70){this[_0xd74f('0xf')]['getVoiceQueueById'](_0x25ffbd)[_0xd74f('0x12')](function(_0x4297cd){_0x1a0d70(null,_0x4297cd?_0x4297cd[_0xd74f('0x13')]:![]);})['catch'](function(_0x267d4d){_0x1a0d70(_0x267d4d);});};AGIVertices[_0xd74f('0x15')]['getSquareProject']=function(_0x29993c,_0x229f49){this[_0xd74f('0xf')][_0xd74f('0x17')](_0x29993c)[_0xd74f('0x12')](function(_0x8ce3f2){_0x229f49(null,_0x8ce3f2?_0x8ce3f2[_0xd74f('0x13')]:![]);})['catch'](function(_0x3760a6){_0x229f49(_0x3760a6);});};AGIVertices[_0xd74f('0x15')]['getSquareOdbc']=function(_0x893907,_0x7b6d3f){this[_0xd74f('0xf')]['getSquareOdbcById'](_0x893907)['then'](function(_0x586a75){_0x7b6d3f(null,_0x586a75?_0x586a75[_0xd74f('0x18')]:![]);})['catch'](function(_0x5c0d80){_0x7b6d3f(_0x5c0d80);});};AGIVertices[_0xd74f('0x15')][_0xd74f('0x19')]=function(_0x51dcfc,_0x1ec24b){this[_0xd74f('0xf')]['getUserById'](_0x51dcfc)['then'](function(_0x313285){_0x1ec24b(null,_0x313285?_0x313285[_0xd74f('0x13')]:![]);})[_0xd74f('0x14')](function(_0x14bb84){_0x1ec24b(_0x14bb84);});};AGIVertices[_0xd74f('0x15')][_0xd74f('0x1a')]=function(_0x51b4e9,_0x296c38){this[_0xd74f('0xf')][_0xd74f('0x1b')](_0x51b4e9)[_0xd74f('0x12')](function(_0xf44159){_0x296c38(null,_0xf44159?_0xf44159[_0xd74f('0x13')]:![]);})[_0xd74f('0x14')](function(_0xd5dca0){_0x296c38(_0xd5dca0);});};AGIVertices['prototype']['getSound']=function(_0x5ed0e6,_0xaed840){var _0xf7ec7e=this;this[_0xd74f('0xf')][_0xd74f('0x1c')](_0x5ed0e6)[_0xd74f('0x12')](function(_0x256878){_0xaed840(null,_0x256878?_0xf7ec7e[_0xd74f('0x1d')](_0x256878[_0xd74f('0x1e')]):![]);})[_0xd74f('0x14')](function(_0x43a86e){_0xaed840(_0x43a86e);});};AGIVertices[_0xd74f('0x15')]['getMailAccount']=function(_0x1ebda5,_0x457448){this[_0xd74f('0xf')][_0xd74f('0x1f')](_0x1ebda5)[_0xd74f('0x12')](function(_0x551efb){_0x457448(null,_0x551efb?_0x551efb:![]);})[_0xd74f('0x14')](function(_0x247134){_0x457448(_0x247134);});};AGIVertices[_0xd74f('0x15')][_0xd74f('0x20')]=function(_0x306c1f,_0x34b074,_0x16ef8c){this['mailRpc'][_0xd74f('0x20')](_0x306c1f,_0x34b074)[_0xd74f('0x12')](function(){_0x16ef8c(null);})[_0xd74f('0x14')](function(_0x2d1f50){_0x16ef8c(_0x2d1f50);});};AGIVertices['prototype']['getIntervals']=function(_0x8ff293,_0x3006bf){this[_0xd74f('0xf')][_0xd74f('0x21')](_0x8ff293)[_0xd74f('0x12')](function(_0x48c893){if(_0x48c893){if(_0x48c893[_0xd74f('0x22')]){_0x3006bf(null,[_0x48c893['interval']]);}else{_0x3006bf(null,_[_0xd74f('0x23')](_0x48c893['Intervals'],'interval'));}}else{_0x3006bf(null,![]);}})[_0xd74f('0x14')](function(_0x62b037){_0x3006bf(_0x62b037);});};AGIVertices[_0xd74f('0x15')]['getSoundPath']=function(_0x24fab1){return util[_0xd74f('0x24')](_0xd74f('0x25'),FILES_PATH,_0x24fab1);};AGIVertices[_0xd74f('0x15')][_0xd74f('0x26')]=function(_0x222f25,_0x34259e,_0xbe17a6){odbc[_0xd74f('0x27')](_0x222f25,function(_0x3aa915){if(_0x3aa915){logger[_0xd74f('0x28')](_0xd74f('0x29'),_0x3aa915);_0xbe17a6(_0x3aa915);}else{logger[_0xd74f('0x2a')](_0xd74f('0x2b'));odbc[_0xd74f('0x2c')](_0x34259e,function(_0x38310e,_0x5f0485){if(_0x38310e){logger[_0xd74f('0x2a')](_0xd74f('0x2d'),_0x34259e);_0xbe17a6(_0x38310e);}else{logger[_0xd74f('0x2a')](_0xd74f('0x2e'),_0x34259e);odbc[_0xd74f('0x2f')](function(_0x12db3f){if(_0x12db3f){logger[_0xd74f('0x28')](_0xd74f('0x30'),_0x12db3f);}_0xbe17a6(null,_0x5f0485);});}});}});};AGIVertices[_0xd74f('0x15')][_0xd74f('0x31')]=function(_0x1002f3,_0x3a8379){this[_0xd74f('0xf')]['getSmsAccountById'](_0x1002f3)[_0xd74f('0x12')](function(_0x44c96b){_0x3a8379(null,_0x44c96b?_0x44c96b:![]);})[_0xd74f('0x14')](function(_0x4b9a4f){_0x3a8379(_0x4b9a4f);});};AGIVertices[_0xd74f('0x15')][_0xd74f('0x32')]=function(_0x321329,_0xa5be08){this[_0xd74f('0xf')][_0xd74f('0x32')](_0x321329)[_0xd74f('0x12')](function(_0x1584f9){_0xa5be08(null,_0x1584f9);})['catch'](function(_0x50d541){_0xa5be08(_0x50d541);});};AGIVertices['prototype'][_0xd74f('0x33')]=function(_0x1031c9,_0x3c33ae,_0x5ee073){this['rpc']['createSquareDetailsReport']({'uniqueid':this['channel'][_0xd74f('0x34')],'node':_0x1031c9['label'],'application':_0x1031c9[_0xd74f('0x35')],'data':_0x3c33ae||null,'project_name':this[_0xd74f('0x36')][_0xd74f('0x37')],'callerid':this['channel'][_0xd74f('0x38')]})['then'](function(_0x13bde6){if(_0x5ee073){_0x5ee073(null,_0x13bde6);}})[_0xd74f('0x14')](function(_0x8e27cc){if(_0x5ee073){_0x5ee073(_0x8e27cc);}});};AGIVertices[_0xd74f('0x15')]['createSquareRecording']=function(_0x2382a5,_0x4f668c,_0x57c593,_0x5b60da){this[_0xd74f('0xf')][_0xd74f('0x39')]({'uniqueid':this[_0xd74f('0x36')][_0xd74f('0x34')],'callerid':this[_0xd74f('0x36')]['callerid'],'calleridname':this[_0xd74f('0x36')][_0xd74f('0x3a')],'context':this[_0xd74f('0x36')][_0xd74f('0x3b')],'extension':this['channel'][_0xd74f('0x3c')],'priority':this[_0xd74f('0x36')][_0xd74f('0x3d')],'accountcode':this['channel']['accountcode'],'dnid':this[_0xd74f('0x36')][_0xd74f('0x3e')],'projectName':this[_0xd74f('0x36')]['arg_1'],'saveName':_0x4f668c,'filename':_0x2382a5['file']||_0x4f668c,'savePath':_0x57c593})['then'](function(_0x158ee2){_0x5b60da(null,_0x158ee2);})[_0xd74f('0x14')](function(_0x576f98){_0x5b60da(_0x576f98);});};AGIVertices[_0xd74f('0x15')][_0xd74f('0x3f')]=function(_0x3137bb,_0x1d2250,_0xd0169,_0x497772,_0x429550){this[_0xd74f('0xf')]['createSquareMessage']({'uniqueid':this[_0xd74f('0x36')][_0xd74f('0x34')],'body':_0x3137bb,'direction':_0x1d2250,'providerName':_0xd0169,'providerResponse':_0x497772})[_0xd74f('0x12')](function(_0x20d416){if(_0x429550){_0x429550(null,_0x20d416);}})[_0xd74f('0x14')](function(_0x41b4c0){if(_0x429550){_0x429550(_0x41b4c0);}});};AGIVertices[_0xd74f('0x15')][_0xd74f('0x40')]=function(_0x4ef2aa,_0x2b037d){this[_0xd74f('0xf')]['createCmContact']({'firstName':_['isEmpty'](_0x4ef2aa['name'])||_[_0xd74f('0x41')](_0x4ef2aa[_0xd74f('0x13')])?_0xd74f('0x42')+Math[_0xd74f('0x43')]():_0x4ef2aa[_0xd74f('0x13')],'lastName':_[_0xd74f('0x44')](_0x4ef2aa[_0xd74f('0x45')])||_[_0xd74f('0x41')](_0x4ef2aa[_0xd74f('0x45')])?null:_0x4ef2aa[_0xd74f('0x45')],'phone':_0x4ef2aa[_0xd74f('0x46')],'ListId':_0x4ef2aa['list_id'],'scheduledat':_0x4ef2aa[_0xd74f('0x47')],'callbackUniqueid':this[_0xd74f('0x36')][_0xd74f('0x34')],'tags':'callback','description':_0xd74f('0x48')+_0x4ef2aa[_0xd74f('0x47')][_0xd74f('0x49')](),'priority':_0x4ef2aa['callback_priority']})[_0xd74f('0x12')](function(_0x19d921){_0x2b037d(null,_0x19d921);})[_0xd74f('0x14')](function(_0x5c1e4d){_0x2b037d(_0x5c1e4d);});};AGIVertices['prototype']['getPause']=function(_0x1ea449,_0x3568f5){this[_0xd74f('0xf')][_0xd74f('0x4a')](_0x1ea449)[_0xd74f('0x12')](function(_0x344350){_0x3568f5(null,_0x344350?_0x344350[_0xd74f('0x13')]:![]);})['catch'](function(_0x4bffe7){_0x3568f5(_0x4bffe7);});};AGIVertices[_0xd74f('0x15')][_0xd74f('0x4b')]=function(_0x985ec1,_0x375780,_0x54d803){var _0xd32392={'role':'agent'};_0xd32392[_0x985ec1]=this[_0xd74f('0x36')][_0xd74f('0x38')];this['rpc']['agentPause'](_0xd32392,_0x375780,this[_0xd74f('0x36')]['uniqueid'])['then'](function(_0x1bb8e1){_0x54d803(null,_['isNil'](_0x1bb8e1)?![]:!![]);})['catch'](function(_0x150c72){logger[_0xd74f('0x28')](_0x150c72);_0x54d803(null,![]);});};AGIVertices[_0xd74f('0x15')][_0xd74f('0x4c')]=function(_0x48d644,_0xb7037c){var _0xf78729={'role':'agent'};_0xf78729[_0x48d644]=this[_0xd74f('0x36')]['callerid'];this['rpc']['agentUnpause'](_0xf78729)[_0xd74f('0x12')](function(_0xcc4bca){_0xb7037c(null,_[_0xd74f('0x41')](_0xcc4bca)?![]:!![]);})['catch'](function(_0x94407){logger[_0xd74f('0x28')](_0x94407);_0xb7037c(null,![]);});};AGIVertices[_0xd74f('0x15')]['agentLogout']=function(_0x307935,_0x34f218){var _0x185432={'role':_0xd74f('0x4d')};_0x185432[_0x307935]=this[_0xd74f('0x36')][_0xd74f('0x38')];this[_0xd74f('0xf')][_0xd74f('0x4e')](_0x185432)[_0xd74f('0x12')](function(_0x1aed9a){_0x34f218(null,_[_0xd74f('0x41')](_0x1aed9a)?![]:!![]);})[_0xd74f('0x14')](function(_0x80adc0){logger['error'](_0x80adc0);_0x34f218(null,![]);});};AGIVertices[_0xd74f('0x15')][_0xd74f('0x4f')]=function(_0xdc600e,_0x3824eb){var _0x58d88d={'role':_0xd74f('0x4d')};_0x58d88d[_0xdc600e]=this[_0xd74f('0x36')][_0xd74f('0x38')];var _0xfb8ee1=_0xdc600e!=_0xd74f('0x50')?util[_0xd74f('0x24')]('%s/%s@from-sip/n',_0xd74f('0x51'),this[_0xd74f('0x36')][_0xd74f('0x38')]):undefined;this[_0xd74f('0xf')]['agentLogin'](_0x58d88d,_0xfb8ee1)['then'](function(_0x30ff50){_0x3824eb(null,_[_0xd74f('0x41')](_0x30ff50)?![]:!![]);})[_0xd74f('0x14')](function(_0x2283ee){logger[_0xd74f('0x28')](_0x2283ee);_0x3824eb(null,![]);});};AGIVertices['prototype'][_0xd74f('0x52')]=function(_0x529e27,_0x4b0e24){sh[_0xd74f('0x53')](_[_0xd74f('0x54')](_0x529e27),function(_0x45801a,_0x73c568){var _0x1cc8fd=_0x73c568[_0xd74f('0x55')](/(\r\n|\n|\r)/gm,'');_0x4b0e24(null,_0x1cc8fd);});};AGIVertices[_0xd74f('0x15')][_0xd74f('0x56')]=function(_0x4966d3,_0x21c52f){scripts['googleCloudTTS'](_0x4966d3[_0xd74f('0x57')],_0x4966d3['google_cloud_tts_text_type']||_0xd74f('0x58'),_0x4966d3['text'],_0x4966d3[_0xd74f('0x59')]||_0xd74f('0x5a'),_0x4966d3[_0xd74f('0x5b')]||'MALE',_0x4966d3[_0xd74f('0x5c')]||_0xd74f('0x5d'))[_0xd74f('0x12')](function(_0x4c90ed){_0x21c52f(null,_0x4c90ed);})[_0xd74f('0x14')](function(_0x123d84){_0x21c52f(_0x123d84);});};AGIVertices[_0xd74f('0x15')][_0xd74f('0x5e')]=function(_0x382f21,_0x3c2127){scripts[_0xd74f('0x5e')](_0x382f21[_0xd74f('0x58')],_0x382f21[_0xd74f('0x5f')]||'en',0x1)[_0xd74f('0x12')](function(_0x3e89c1){_0x3c2127(null,_0x3e89c1);})['catch'](function(_0xb18465){_0x3c2127(_0xb18465);});};AGIVertices['prototype'][_0xd74f('0x60')]=function(_0xfbd699,_0x13169d){var _0x55354c={'uri':_0xfbd699[_0xd74f('0x61')],'method':_0xfbd699[_0xd74f('0x62')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0xfbd699['timeout'])===_0xd74f('0x63')&&parseInt(_0xfbd699[_0xd74f('0x64')])>=0x1?parseInt(_0xfbd699['timeout'])*0x3e8:0x5*0x3e8};if(_['includes']([_0xd74f('0x65'),_0xd74f('0x66')],_0x55354c['method'][_0xd74f('0x67')]())){try{_0x55354c[_0xd74f('0x68')]=_0xfbd699[_0xd74f('0x69')]?JSON['parse'](_0xfbd699[_0xd74f('0x69')]):{};}catch(_0x49293f){logger[_0xd74f('0x28')](_0xd74f('0x6a'),_0x49293f);}}try{_0x55354c[_0xd74f('0x6b')]=_0xfbd699[_0xd74f('0xb')]?JSON[_0xd74f('0x6c')](_0xfbd699[_0xd74f('0xb')]):{};}catch(_0x443430){logger['error'](_0xd74f('0x6d'),_0x443430);}if(_0xfbd699[_0xd74f('0x6e')]){try{var _0x52308b=require(_0xfbd699['computedVariables'])[_0xd74f('0x6f')](this,_0x55354c);_0x55354c['uri']=Mustache[_0xd74f('0x70')](_0xfbd699[_0xd74f('0x61')],_0x52308b,{},['$$','$$']);if(_0x55354c[_0xd74f('0x6b')]){_0x55354c[_0xd74f('0x6b')]=JSON[_0xd74f('0x6c')](Mustache['render'](JSON[_0xd74f('0x71')](_0x55354c['headers']),_0x52308b,{},['$$','$$']));}if(_0x55354c[_0xd74f('0x68')]){_0x55354c[_0xd74f('0x68')]=JSON[_0xd74f('0x6c')](Mustache[_0xd74f('0x70')](JSON[_0xd74f('0x71')](_0x55354c[_0xd74f('0x68')]),_0x52308b,{},['$$','$$']));}}catch(_0x3d85f3){logger[_0xd74f('0x28')](_0xd74f('0x72'),_0x3d85f3);}}rp(_0x55354c)[_0xd74f('0x12')](function(_0x1eac19){var _0x31736a={'statusCode':_0x1eac19['statusCode']||0xc8,'statusMessage':_0x1eac19[_0xd74f('0x73')]||'OK','headers':_0x1eac19[_0xd74f('0x6b')]||{},'body':_0x1eac19['body']||{}};_0x13169d(null,_0x31736a);})[_0xd74f('0x14')](function(_0x108119){var _0x22e516={'statusCode':_0x108119[_0xd74f('0x74')]||0x1f4,'statusMessage':_0x108119[_0xd74f('0x75')]||_0xd74f('0x76'),'headers':_0x108119[_0xd74f('0x77')]['headers']||{},'body':_0x108119['options']['body']||{}};_0x13169d(null,_0x22e516);});};AGIVertices[_0xd74f('0x15')]['googleDialogflow']=function(_0x1746e6,_0x5a73b7){scripts[_0xd74f('0x78')](this[_0xd74f('0x36')]['uniqueid'],_0x1746e6['key'],_0x1746e6[_0xd74f('0x58')],_0x1746e6[_0xd74f('0x79')]||'en')[_0xd74f('0x12')](function(_0x590d4e){_0x5a73b7(null,_0x590d4e);})[_0xd74f('0x14')](function(_0x5ade29){_0x5a73b7(_0x5ade29);});};AGIVertices[_0xd74f('0x15')][_0xd74f('0x7a')]=function(_0x14192a,_0x3264ba){scripts[_0xd74f('0x7a')](this[_0xd74f('0x36')][_0xd74f('0x34')],_0x14192a['dialogflowV2_project_id'],_0x14192a[_0xd74f('0x7b')],_0x14192a['private_key'],_0x14192a['text'],_0x14192a[_0xd74f('0x7c')]||'en')[_0xd74f('0x12')](function(_0x3a9967){_0x3264ba(null,_0x3a9967);})[_0xd74f('0x14')](function(_0x338258){_0x3264ba(_0x338258);});};AGIVertices['prototype'][_0xd74f('0x7d')]=function(_0x3c0f82,_0x1883e4){scripts[_0xd74f('0x7d')](this[_0xd74f('0x36')],_0x3c0f82)[_0xd74f('0x12')](function(_0x4749d8){_0x1883e4(null,_0x4749d8);})[_0xd74f('0x14')](function(_0x7d1a25){_0x1883e4(_0x7d1a25);});};AGIVertices[_0xd74f('0x15')][_0xd74f('0x7e')]=function(_0x3de693,_0x3f7677){scripts['ispeechTTS'](_0x3de693['key'],_0x3de693[_0xd74f('0x58')],_0x3de693[_0xd74f('0x7f')]||_0xd74f('0x5a'),_0x3de693[_0xd74f('0x80')])['then'](function(_0x32722d){_0x3f7677(null,_0x32722d);})[_0xd74f('0x14')](function(_0x69228a){_0x3f7677(_0x69228a);});};AGIVertices[_0xd74f('0x15')][_0xd74f('0x81')]=function(_0x470bc5,_0x5ef440,_0x505e34){scripts[_0xd74f('0x81')](_0x5ef440,_0x470bc5[_0xd74f('0x82')],_0x470bc5[_0xd74f('0x83')]||_0xd74f('0x5a'),this[_0xd74f('0x84')](_0x470bc5['model'])?_0x470bc5['model']:undefined)['then'](function(_0x52ebca){_0x505e34(null,_0x52ebca);})[_0xd74f('0x14')](function(_0x39644d){_0x505e34(_0x39644d);});};AGIVertices[_0xd74f('0x15')][_0xd74f('0x85')]=function(_0x4ff52c,_0x5e4e78){scripts['awsPolly'](_0x4ff52c[_0xd74f('0x86')],_0x4ff52c['aws_secret_access_key'],_0x4ff52c['aws_polly_region'],_0x4ff52c[_0xd74f('0x87')]||'Amy',_0x4ff52c[_0xd74f('0x58')],_0x4ff52c[_0xd74f('0x88')]||_0xd74f('0x58'))['then'](function(_0x50c480){_0x5e4e78(null,_0x50c480);})['catch'](function(_0x1ff37b){_0x5e4e78(_0x1ff37b);});};AGIVertices['prototype'][_0xd74f('0x89')]=function(_0x5c4ca8,_0x2ad16e){scripts[_0xd74f('0x89')](this[_0xd74f('0x36')]['uniqueid'],_0x5c4ca8[_0xd74f('0x86')],_0x5c4ca8['aws_secret_access_key'],_0x5c4ca8[_0xd74f('0x8a')],_0x5c4ca8[_0xd74f('0x58')],_0x5c4ca8[_0xd74f('0x8b')])[_0xd74f('0x12')](function(_0x23036e){_0x2ad16e(null,_0x23036e);})[_0xd74f('0x14')](function(_0x3931a2){_0x2ad16e(_0x3931a2);});};AGIVertices[_0xd74f('0x15')][_0xd74f('0x8c')]=function(_0x43c6ce,_0xe957e1,_0x1cd7c9){scripts[_0xd74f('0x8c')](_0xe957e1,_0x43c6ce['key'],_0x43c6ce['google_asr_language']||_0xd74f('0x5a'))[_0xd74f('0x12')](function(_0x1c7c79){_0x1cd7c9(null,_0x1c7c79);})['catch'](function(_0x1a7c54){_0x1cd7c9(_0x1a7c54);});};AGIVertices['prototype'][_0xd74f('0x8d')]=function(_0x12c656,_0xe8335,_0x3723c1){scripts[_0xd74f('0x8d')](_0xe8335,_0x12c656[_0xd74f('0x8e')],_0x12c656[_0xd74f('0x8f')],_0x12c656[_0xd74f('0x90')])[_0xd74f('0x12')](function(_0x284fd3){_0x3723c1(null,_0x284fd3);})[_0xd74f('0x14')](function(_0x42ca92){_0x3723c1(_0x42ca92);});};AGIVertices[_0xd74f('0x15')][_0xd74f('0x91')]=function(_0x505b40){var _0x3b7bef=_[_0xd74f('0x92')](verticesWithRetry,_0x505b40[_0xd74f('0x35')])?_0x505b40:_[_0xd74f('0x93')](_0x505b40);for(var _0x301da9 in _0x3b7bef){if(_0x3b7bef[_0xd74f('0x94')](_0x301da9)){if(_0x3b7bef[_0x301da9]&&_[_0xd74f('0x95')](_0x3b7bef[_0x301da9])){if(_[_0xd74f('0x92')](recursiveMapAttributes,_0x301da9)){_0x3b7bef[_0x301da9]=this[_0xd74f('0x96')](_0x3b7bef[_0x301da9]);}else{_0x3b7bef[_0x301da9]=this['replaceAllVariables'](_0x3b7bef[_0x301da9]);}}}}return _0x3b7bef;};AGIVertices[_0xd74f('0x15')]['recursiveNodeIndex']=function(_0x254d05){for(var _0x374239 in _0x254d05){if(_0x254d05[_0xd74f('0x94')](_0x374239)){if(_[_0xd74f('0x97')](_0x254d05[_0x374239])){this[_0xd74f('0x98')](_0x254d05[_0x374239]);}else if(_[_0xd74f('0x99')](_0x254d05[_0x374239])){for(var _0x51cb65=0x0;_0x51cb65<_0x254d05[_0x374239][_0xd74f('0x9a')];_0x51cb65++){this[_0xd74f('0x98')](_0x254d05[_0x374239][_0x51cb65]);}}else if(_[_0xd74f('0x95')](_0x254d05[_0x374239])){_0x254d05[_0x374239]=this[_0xd74f('0x9b')](_0x254d05[_0x374239]);}}}};AGIVertices[_0xd74f('0x15')][_0xd74f('0x9c')]=function(_0x2a9d2c,_0x2b77fa){for(var _0x211334 in _0x2a9d2c){if(_0x2a9d2c[_0xd74f('0x94')](_0x211334)){if(_['isPlainObject'](_0x2a9d2c[_0x211334])){if(!_['isEmpty'](_0x2a9d2c[_0x211334])){this[_0xd74f('0x9c')](_0x2a9d2c[_0x211334],util['format'](_0xd74f('0x9d'),_0x2b77fa,_0x211334));}}else if(_[_0xd74f('0x99')](_0x2a9d2c[_0x211334])){for(var _0x28e9ed=0x0;_0x28e9ed<_0x2a9d2c[_0x211334]['length'];_0x28e9ed++){this[_0xd74f('0x9c')](_0x2a9d2c[_0x211334][_0x28e9ed],util[_0xd74f('0x24')]('%s.%s',_0x2b77fa,_0x211334+'['+_0x28e9ed+']'));}}else{if(!_[_0xd74f('0x41')](_0x2a9d2c[_0x211334])){this[_0xd74f('0x36')][_0xd74f('0x9e')](util['format'](_0xd74f('0x9d'),_0x2b77fa,_0x211334),_0x2a9d2c[_0x211334]);}}}}};AGIVertices[_0xd74f('0x15')]['replaceObjectAllVariables']=function(_0xaa2ce4){try{var _0x25c53e=JSON[_0xd74f('0x6c')](_0xaa2ce4);this[_0xd74f('0x98')](_0x25c53e);return JSON[_0xd74f('0x71')](_0x25c53e);}catch(_0x2972cc){return this['replaceAllVariables'](_0xaa2ce4);}};AGIVertices['prototype']['replaceAllVariables']=function(_0x33b3f1){var _0x342378=_0x33b3f1[_0xd74f('0x9f')]('{');for(var _0xe33221=0x1;_0xe33221<_0x342378[_0xd74f('0x9a')];_0xe33221+=0x1){var _0x207820=_0x342378[_0xe33221][_0xd74f('0x9f')]('}');if(_0x207820[_0xd74f('0x9a')]>0x1){_0x33b3f1=_0x33b3f1[_0xd74f('0xa0')]('{'+_0x207820[0x0]+'}',this[_0xd74f('0x36')]['getVariable'](_0x207820[0x0])[_0xd74f('0xa1')]||_0x207820[0x0]);}}if(_0x342378[_0xd74f('0x9a')]===0x1){return _0x33b3f1[_0xd74f('0x49')]();}return this[_0xd74f('0x9b')](_0x33b3f1);};AGIVertices['prototype'][_0xd74f('0xa2')]=function(_0x2448d6,_0x5459ce){var _0x3c97b8=this[_0xd74f('0x36')][_0xd74f('0x10')](_0x2448d6);if(_0x3c97b8[_0xd74f('0xa3')]===-0x1){return _0x3c97b8;}logger['info'](util[_0xd74f('0x24')](_0xd74f('0xa4'),_0x5459ce,_0x3c97b8['extra']));return this[_0xd74f('0x36')][_0xd74f('0x9e')](_0x5459ce,_0x3c97b8[_0xd74f('0xa1')]);};AGIVertices[_0xd74f('0x15')][_0xd74f('0x84')]=function(_0x43773b){return _0x43773b&&_0x43773b!=='0'&&_0x43773b!=='-1'&&_0x43773b!=='';};AGIVertices[_0xd74f('0x15')][_0xd74f('0xa5')]=function(_0xd5f892){this[_0xd74f('0x33')]['sync'](this,_0xd5f892,'-');_0xd5f892[_0xd74f('0xa6')]=_0xd5f892[_0xd74f('0xa5')];return{'code':0xc8,'result':'-'};};AGIVertices['prototype'][_0xd74f('0xa7')]=function(_0x502054){logger[_0xd74f('0x2a')](util['format']('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0x502054[_0xd74f('0xa8')]));if(!this[_0xd74f('0x84')](_0x502054[_0xd74f('0x58')])){return this[_0xd74f('0x36')][_0xd74f('0xa9')]('no\x20text\x20configured');}var _0xd8854d='\x22'+_0x502054[_0xd74f('0x58')]+'\x22';if(this[_0xd74f('0x84')](_0x502054['options'])){_0xd8854d+=','+_0x502054[_0xd74f('0x77')];}var _0x28561a=this[_0xd74f('0x36')]['exec'](_0xd74f('0xaa'),_0xd8854d);if(_0x28561a[_0xd74f('0xa3')]===-0x1){return _0x28561a;}return this['channel'][_0xd74f('0xa9')](util[_0xd74f('0x24')](_0xd74f('0xab'),_0xd8854d));};AGIVertices['prototype']['mrcprecog']=function(_0x5bb82a){logger[_0xd74f('0x2a')](util[_0xd74f('0x24')](_0xd74f('0xac'),_0x5bb82a['label']));if(!this[_0xd74f('0x84')](_0x5bb82a[_0xd74f('0xad')])){return this[_0xd74f('0x36')][_0xd74f('0xa9')](_0xd74f('0xae'));}var _0x27cbfa=_0x5bb82a[_0xd74f('0xad')];if(this[_0xd74f('0x84')](_0x5bb82a[_0xd74f('0x77')])){_0x27cbfa+=','+_0x5bb82a[_0xd74f('0x77')];}var _0x4b224f=this['channel'][_0xd74f('0x53')](_0xd74f('0xaf'),_0x27cbfa);if(_0x4b224f['result']===-0x1){return _0x4b224f;}var _0x3249f3=this['getAndSetVariable'](_0xd74f('0xb0'),_0xd74f('0xb1'));if(_0x3249f3['result']===-0x1){return _0x3249f3;}var _0x2d4f19=this['getAndSetVariable'](_0xd74f('0xb2'),_0xd74f('0xb3'));if(_0x2d4f19[_0xd74f('0xa3')]===-0x1){return _0x2d4f19;}var _0x5c865f=this['getAndSetVariable']('RECOG_INSTANCE()','MRCP_RECOG_INSTANCE');if(_0x5c865f[_0xd74f('0xa3')]===-0x1){return _0x5c865f;}return this['channel']['noop'](util['format'](_0xd74f('0xb4'),_0x27cbfa));};AGIVertices['prototype'][_0xd74f('0x8')]=function(_0x4bffde){logger[_0xd74f('0x2a')](util[_0xd74f('0x24')](_0xd74f('0xb5'),_0x4bffde[_0xd74f('0xa8')]));return this['channel'][_0xd74f('0x8')]([_0x4bffde[_0xd74f('0xb6')],_0x4bffde[_0xd74f('0xb7')]]);};AGIVertices[_0xd74f('0x15')][_0xd74f('0xb8')]=function(_0x258d11){logger[_0xd74f('0x2a')](util['format'](_0xd74f('0xb9'),_0x258d11[_0xd74f('0xa8')]));if(this[_0xd74f('0x84')](_0x258d11[_0xd74f('0x64')])){logger['info'](util[_0xd74f('0x24')](_0xd74f('0xba'),_0x258d11[_0xd74f('0x64')]));var _0x1a3e52=this[_0xd74f('0x36')]['wait'](_0x258d11[_0xd74f('0x64')]);if(_0x1a3e52['result']===-0x1){return _0x1a3e52;}}return this[_0xd74f('0x36')][_0xd74f('0xb8')]();};AGIVertices[_0xd74f('0x15')]['callback']=function(_0x5c948e){logger[_0xd74f('0x2a')](util['format'](_0xd74f('0xbb'),_0x5c948e[_0xd74f('0xa8')]));if(!this[_0xd74f('0x84')](_0x5c948e['list_id'])){return this['channel'][_0xd74f('0x28')](_0x5c948e,_0xd74f('0xbc'));}_0x5c948e[_0xd74f('0x47')]=moment();if(this[_0xd74f('0x84')](_0x5c948e[_0xd74f('0xbd')])){_0x5c948e['scheduledAt']=moment()[_0xd74f('0xbe')](_0x5c948e['delay'],_0xd74f('0xbf'));}if(!this['isConfigured'](_0x5c948e[_0xd74f('0xc0')])){_0x5c948e['callback_priority']=0x2;}this['createCmContact']['sync'](this,_0x5c948e);return this[_0xd74f('0x36')][_0xd74f('0xa9')](util[_0xd74f('0x24')](_0xd74f('0xc1'),_0x5c948e[_0xd74f('0x46')],_0x5c948e[_0xd74f('0xc2')],_0x5c948e[_0xd74f('0x47')]));};AGIVertices[_0xd74f('0x15')][_0xd74f('0xc3')]=function(_0xa66722){logger[_0xd74f('0x2a')](util[_0xd74f('0x24')](_0xd74f('0xc4'),_0xa66722[_0xd74f('0xa8')]));var _0x12bc6f=this[_0xd74f('0x36')][_0xd74f('0x53')](_0xa66722[_0xd74f('0xc5')],_0xa66722[_0xd74f('0x77')]);if(_0x12bc6f[_0xd74f('0xa3')]===-0x1){return _0x12bc6f;}return this[_0xd74f('0x36')][_0xd74f('0xa9')](util['format'](_0xd74f('0xc6'),_0xa66722[_0xd74f('0xc5')],_0xa66722[_0xd74f('0x77')]));};AGIVertices[_0xd74f('0x15')][_0xd74f('0xc7')]=function(_0x1eae9c){logger[_0xd74f('0x2a')](util[_0xd74f('0x24')](_0xd74f('0xc8'),_0x1eae9c[_0xd74f('0xa8')]));if(!this[_0xd74f('0x84')](_0x1eae9c[_0xd74f('0x58')])){return this[_0xd74f('0x36')][_0xd74f('0xa9')]('no\x20text\x20configured');}var _0x2e3043='\x22'+_0x1eae9c['text']+'\x22';if(this[_0xd74f('0x84')](_0x1eae9c[_0xd74f('0x77')])){_0x2e3043+=','+_0x1eae9c[_0xd74f('0x77')];}var _0x1a022e=this[_0xd74f('0x36')]['exec']('MRCPSynth',_0x2e3043);if(_0x1a022e[_0xd74f('0xa3')]===-0x1){return _0x1a022e;}return this[_0xd74f('0x36')][_0xd74f('0xa9')](util[_0xd74f('0x24')]('Executed\x20command\x20MRCPSynth\x20%s',_0x2e3043));};AGIVertices['prototype']['sestektts']=function(_0x27bc1b){logger[_0xd74f('0x2a')](util[_0xd74f('0x24')](_0xd74f('0xc9'),_0x27bc1b[_0xd74f('0xa8')]));if(!this[_0xd74f('0x84')](_0x27bc1b['text'])){return this[_0xd74f('0x36')][_0xd74f('0xa9')](_0xd74f('0xca'));}var _0x2cdedb='\x22'+_0x27bc1b['text']+'\x22';if(this[_0xd74f('0x84')](_0x27bc1b['options'])){_0x2cdedb+=','+_0x27bc1b[_0xd74f('0x77')];}var _0x563758=this[_0xd74f('0x36')]['exec']('MRCPSynth',_0x2cdedb);if(_0x563758[_0xd74f('0xa3')]===-0x1){return _0x563758;}return this['channel'][_0xd74f('0xa9')](util[_0xd74f('0x24')](_0xd74f('0xab'),_0x2cdedb));};AGIVertices[_0xd74f('0x15')][_0xd74f('0xcb')]=function(_0x4e5873){logger['info'](util[_0xd74f('0x24')](_0xd74f('0xcc'),_0x4e5873[_0xd74f('0xa8')]));if(!this[_0xd74f('0x84')](_0x4e5873['grammar'])){return this[_0xd74f('0x36')][_0xd74f('0xa9')]('no\x20grammar\x20configured');}var _0x197b88=_0x4e5873[_0xd74f('0xad')];if(this[_0xd74f('0x84')](_0x4e5873['options'])){_0x197b88+=','+_0x4e5873[_0xd74f('0x77')];}var _0x363a30=this[_0xd74f('0x36')][_0xd74f('0x53')](_0xd74f('0xaf'),_0x197b88);if(_0x363a30[_0xd74f('0xa3')]===-0x1){return _0x363a30;}var _0x5391e1=this[_0xd74f('0xa2')](_0xd74f('0xb0'),'LUMENVOX_ASR_CONFIDENCE');if(_0x5391e1[_0xd74f('0xa3')]===-0x1){return _0x5391e1;}var _0x12a430=this[_0xd74f('0xa2')]('RECOG_INPUT()',_0xd74f('0xcd'));if(_0x12a430['result']===-0x1){return _0x12a430;}var _0x415f64=this[_0xd74f('0xa2')](_0xd74f('0xce'),'LUMENVOX_ASR_INSTANCE');if(_0x415f64[_0xd74f('0xa3')]===-0x1){return _0x415f64;}return this[_0xd74f('0x36')][_0xd74f('0xa9')](util[_0xd74f('0x24')](_0xd74f('0xb4'),_0x197b88));};AGIVertices[_0xd74f('0x15')][_0xd74f('0xcf')]=function(_0xaad050){logger[_0xd74f('0x2a')](util['format'](_0xd74f('0xd0'),_0xaad050[_0xd74f('0xa8')]));if(!this[_0xd74f('0x84')](_0xaad050[_0xd74f('0xad')])){return this[_0xd74f('0x36')][_0xd74f('0xa9')](_0xd74f('0xae'));}var _0x38e767=_0xaad050['grammar'];if(this[_0xd74f('0x84')](_0xaad050[_0xd74f('0x77')])){_0x38e767+=','+_0xaad050[_0xd74f('0x77')];}var _0x3db428=this[_0xd74f('0x36')][_0xd74f('0x53')]('MRCPRecog',_0x38e767);if(_0x3db428[_0xd74f('0xa3')]===-0x1){return _0x3db428;}var _0x239643=this[_0xd74f('0xa2')]('RECOG_CONFIDENCE()',_0xd74f('0xd1'));if(_0x239643[_0xd74f('0xa3')]===-0x1){return _0x239643;}var _0x5e5537=this[_0xd74f('0xa2')]('RECOG_INPUT()',_0xd74f('0xd2'));if(_0x5e5537['result']===-0x1){return _0x5e5537;}var _0x28a159=this[_0xd74f('0xa2')](_0xd74f('0xce'),_0xd74f('0xd3'));if(_0x28a159[_0xd74f('0xa3')]===-0x1){return _0x28a159;}return this[_0xd74f('0x36')][_0xd74f('0xa9')](util[_0xd74f('0x24')](_0xd74f('0xb4'),_0x38e767));};AGIVertices[_0xd74f('0x15')][_0xd74f('0xd4')]=function(_0x1aac17){logger[_0xd74f('0x2a')](util[_0xd74f('0x24')](_0xd74f('0xd5'),_0x1aac17[_0xd74f('0xa8')]));if(!this[_0xd74f('0x84')](_0x1aac17[_0xd74f('0xd6')])){return this[_0xd74f('0x36')][_0xd74f('0x28')](_0x1aac17,_0xd74f('0xd7'));}var _0x2ee6b7=this[_0xd74f('0xd8')][_0xd74f('0x6f')](this,_0x1aac17['odbc_id']);if(!_0x2ee6b7){return this[_0xd74f('0x36')]['error'](_0x1aac17,_0xd74f('0xd9'));}if(!this[_0xd74f('0x84')](_0x1aac17['query'])){return this[_0xd74f('0x36')][_0xd74f('0x28')](_0x1aac17,_0xd74f('0xda'));}var _0x1eeccd=_0x1aac17[_0xd74f('0x2c')][_0xd74f('0x55')](/(\r\n|\n|\r)/gm,'\x20');this[_0xd74f('0x36')][_0xd74f('0xa9')](util['format']('query:\x20%s',_0x1eeccd));var _0x41e53c=this[_0xd74f('0x26')][_0xd74f('0x6f')](this,_0x2ee6b7,_0x1eeccd);this['createSquareDetailsReport'][_0xd74f('0x6f')](this,_0x1aac17,_0x1eeccd);if(!this[_0xd74f('0x84')](_0x1aac17[_0xd74f('0xdb')])){return this[_0xd74f('0x36')][_0xd74f('0xa9')](_0xd74f('0xdc'));}var _0x34018f=this[_0xd74f('0x10')]['sync'](this,_0x1aac17[_0xd74f('0xdb')]);if(!_0x34018f){return this['channel'][_0xd74f('0x28')](_0x1aac17,_0xd74f('0xdd'));}var _0x34979d=this;_0x41e53c['forEach'](function(_0x4e4277,_0x151326){Object[_0xd74f('0xde')](_0x4e4277)[_0xd74f('0xdf')](function(_0x2330f5){_0x34979d[_0xd74f('0x36')][_0xd74f('0x9e')](util['format'](_0xd74f('0xe0'),_0x34018f,_0x151326,_0x2330f5),_0x4e4277[_0x2330f5]);});});this[_0xd74f('0x36')][_0xd74f('0x9e')](util[_0xd74f('0x24')](_0xd74f('0xe1'),_0x34018f),_0x41e53c[_0xd74f('0x9a')]);return this[_0xd74f('0x36')][_0xd74f('0xa9')](util[_0xd74f('0x24')]('variable\x20%s\x20set',_0x34018f));};AGIVertices[_0xd74f('0x15')]['dial']=function(_0x5d9443){logger[_0xd74f('0xe2')](util[_0xd74f('0x24')](_0xd74f('0xe3'),_0x5d9443[_0xd74f('0xa8')]));if(!this[_0xd74f('0x84')](_0x5d9443[_0xd74f('0xe4')])){return this['channel'][_0xd74f('0x28')](_0x5d9443,_0xd74f('0xe5'));}var _0x3dcd0f=this[_0xd74f('0x19')][_0xd74f('0x6f')](this,_0x5d9443[_0xd74f('0xe4')]);if(!_0x3dcd0f){return this[_0xd74f('0x36')][_0xd74f('0x28')](_0x5d9443,_0xd74f('0xe6'));}var _0x190895=this[_0xd74f('0x36')]['exec'](_0xd74f('0xe7'),[util[_0xd74f('0x24')](_0xd74f('0xe8'),_0x3dcd0f),_0x5d9443['timeout'],_0x5d9443[_0xd74f('0xe9')],_0x5d9443[_0xd74f('0x61')]]);if(_0x190895[_0xd74f('0xa3')]===-0x1){return _0x190895;}return this[_0xd74f('0x36')]['noop'](util[_0xd74f('0x24')](_0xd74f('0xea'),_0xd74f('0xe7')));};AGIVertices[_0xd74f('0x15')]['dialogflow']=function(_0x3f4611){logger[_0xd74f('0x2a')](util[_0xd74f('0x24')](_0xd74f('0xeb'),_0x3f4611[_0xd74f('0xa8')]));if(!this[_0xd74f('0x84')](_0x3f4611[_0xd74f('0x82')])){return this[_0xd74f('0x36')][_0xd74f('0xa9')](_0xd74f('0xec'));}if(!this[_0xd74f('0x84')](_0x3f4611[_0xd74f('0x58')])){return this[_0xd74f('0x36')][_0xd74f('0xa9')]('no\x20text\x20configured');}this['channel']['bot']=!![];this[_0xd74f('0x33')](_0x3f4611);this[_0xd74f('0x3f')](_0x3f4611[_0xd74f('0x58')],'in','','');this[_0xd74f('0x36')][_0xd74f('0xa9')](util['format'](_0xd74f('0xed'),_0x3f4611['text']));var _0x56cdb8=this['googleDialogflow'][_0xd74f('0x6f')](this,_0x3f4611);if(_0x56cdb8){for(var _0x45be24 in _0x56cdb8){if(_0x56cdb8['hasOwnProperty'](_0x45be24)){this[_0xd74f('0x36')][_0xd74f('0x9e')](util[_0xd74f('0x24')](_0xd74f('0xee'),_0x45be24[_0xd74f('0x67')]()),_0x56cdb8[_0x45be24]);}}this['createSquareMessage'](_0x56cdb8['speech'],_0xd74f('0xef'),_0xd74f('0xf0'),'');return this['channel'][_0xd74f('0xa9')](util['format']('Dialogflow\x20Result\x20%s',_0x56cdb8[_0xd74f('0xf1')]));}return this[_0xd74f('0x36')]['error'](_0x3f4611,_0xd74f('0xf2'));};AGIVertices['prototype']['dialogflowV2']=function(_0xa453aa){logger[_0xd74f('0x2a')](util[_0xd74f('0x24')](_0xd74f('0xf3'),_0xa453aa[_0xd74f('0xa8')]));if(!this[_0xd74f('0x84')](_0xa453aa['dialogflowV2_project_id'])){return this[_0xd74f('0x36')]['noop'](_0xd74f('0xf4'));}if(!this[_0xd74f('0x84')](_0xa453aa['client_email'])){return this['channel']['noop']('no\x20client_email\x20configured');}if(!this[_0xd74f('0x84')](_0xa453aa['private_key'])){return this[_0xd74f('0x36')][_0xd74f('0xa9')](_0xd74f('0xf5'));}if(!this['isConfigured'](_0xa453aa['dialogflowV2_language'])){return this[_0xd74f('0x36')][_0xd74f('0xa9')](_0xd74f('0xf6'));}if(!this[_0xd74f('0x84')](_0xa453aa[_0xd74f('0x58')])){return this[_0xd74f('0x36')]['noop']('no\x20text\x20configured');}this[_0xd74f('0x36')][_0xd74f('0xf7')]=!![];this[_0xd74f('0x33')](_0xa453aa);this['createSquareMessage'](_0xa453aa[_0xd74f('0x58')],'in','','');this[_0xd74f('0x36')][_0xd74f('0xa9')](util[_0xd74f('0x24')](_0xd74f('0xf8'),_0xa453aa[_0xd74f('0x58')]));var _0x4517a8=this['googleDialogflowV2'][_0xd74f('0x6f')](this,_0xa453aa);if(_0x4517a8){for(var _0x54479f in _0x4517a8){if(_0x4517a8[_0xd74f('0x94')](_0x54479f)){if(_0x54479f!==_0xd74f('0xf9')){this[_0xd74f('0x36')][_0xd74f('0x9e')](util[_0xd74f('0x24')](_0xd74f('0xee'),_0x54479f[_0xd74f('0x67')]()),_0x4517a8[_0x54479f]);}}}this[_0xd74f('0x3f')](_0x4517a8[_0xd74f('0xf1')],_0xd74f('0xef'),_0xd74f('0xfa'),_0x4517a8['providerResponse']);return this[_0xd74f('0x36')][_0xd74f('0xa9')](util['format'](_0xd74f('0xfb'),_0x4517a8['speech']));}return this[_0xd74f('0x36')][_0xd74f('0x28')](_0xa453aa,'DialogflowV2\x20is\x20unreachable');};AGIVertices[_0xd74f('0x15')][_0xd74f('0xfc')]=function(_0x409ac7){logger[_0xd74f('0x2a')](util[_0xd74f('0x24')]('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0x409ac7[_0xd74f('0xa8')]));if(!this[_0xd74f('0x84')](_0x409ac7[_0xd74f('0xfd')])){return this[_0xd74f('0x36')][_0xd74f('0xa9')](_0xd74f('0xfe'));}if(!this[_0xd74f('0x84')](_0x409ac7[_0xd74f('0xff')])){return this[_0xd74f('0x36')]['noop']('no\x20username\x20configured');}if(!this[_0xd74f('0x84')](_0x409ac7[_0xd74f('0x100')])){return this[_0xd74f('0x36')][_0xd74f('0xa9')](_0xd74f('0x101'));}if(!this[_0xd74f('0x84')](_0x409ac7[_0xd74f('0x102')])){return this[_0xd74f('0x36')][_0xd74f('0xa9')](_0xd74f('0xca'));}this[_0xd74f('0x36')][_0xd74f('0xf7')]=!![];this['createSquareDetailsReport'](_0x409ac7);this[_0xd74f('0x3f')](_0x409ac7[_0xd74f('0x58')],'in','','');this[_0xd74f('0x36')][_0xd74f('0xa9')](util[_0xd74f('0x24')]('Trying\x20SestekNDA:\x20%s',_0x409ac7[_0xd74f('0x58')]));var _0x2b0c3a=this[_0xd74f('0x7d')][_0xd74f('0x6f')](this,_0x409ac7);if(_0x2b0c3a){for(var _0x25c4da in _0x2b0c3a){if(_0x2b0c3a['hasOwnProperty'](_0x25c4da)){this[_0xd74f('0x36')][_0xd74f('0x9e')](util[_0xd74f('0x24')](_0xd74f('0x103'),_0x25c4da[_0xd74f('0x67')]()),_0x2b0c3a[_0x25c4da]);}}this[_0xd74f('0x3f')](_0x2b0c3a[_0xd74f('0xf1')],_0xd74f('0xef'),'sesteknda','');if(_0x2b0c3a[_0xd74f('0x104')]){this['channel'][_0xd74f('0xa9')](util[_0xd74f('0x24')](_0xd74f('0x105'),_0x2b0c3a[_0xd74f('0x104')]));var _0x5846a1=this['channel'][_0xd74f('0x106')](_0x2b0c3a[_0xd74f('0x104')]);try{fs['unlink'](_0x2b0c3a[_0xd74f('0x104')]+_0xd74f('0x107'));}catch(_0x5c3c03){logger[_0xd74f('0x28')](_0x5c3c03);}return _0x5846a1;}else{return this[_0xd74f('0x36')][_0xd74f('0xa9')](util[_0xd74f('0x24')](_0xd74f('0x108'),_0x2b0c3a['speech']));}}return this[_0xd74f('0x36')][_0xd74f('0x28')](_0x409ac7,'SestekNDA\x20is\x20unreachable');};AGIVertices[_0xd74f('0x15')][_0xd74f('0x109')]=function(_0x4342be){logger[_0xd74f('0x2a')](util[_0xd74f('0x24')](_0xd74f('0x10a'),_0x4342be[_0xd74f('0xa8')]));return this['channel']['noop']('end');};AGIVertices['prototype'][_0xd74f('0x10b')]=function(_0x6bed4b){logger[_0xd74f('0x2a')](util[_0xd74f('0x24')](_0xd74f('0x10c'),_0x6bed4b[_0xd74f('0xa8')]));var _0x49b61f='';if(_0x6bed4b[_0xd74f('0x10d')]){if(!this[_0xd74f('0x84')](_0x6bed4b[_0xd74f('0x10d')])){return this['channel'][_0xd74f('0x28')](_0x6bed4b,_0xd74f('0x10e'));}else{var _0x52f78d=parseInt(_0x6bed4b[_0xd74f('0x10d')],0xa);if(isNaN(_0x52f78d)){_0x49b61f=_0x6bed4b[_0xd74f('0x10d')];}else{_0x49b61f=this[_0xd74f('0x1a')][_0xd74f('0x6f')](this,_0x6bed4b[_0xd74f('0x10d')]);if(!_0x49b61f){return this['channel'][_0xd74f('0x28')](_0x6bed4b,'no\x20trunk\x20found');}}}}else if(_0x6bed4b[_0xd74f('0x10f')]){_0x49b61f=_0x6bed4b['trunk_name'];}else{return this[_0xd74f('0x36')]['error'](_0x6bed4b,_0xd74f('0x10e'));}var _0x5234ce=this['channel'][_0xd74f('0x53')](_0xd74f('0xe7'),[util[_0xd74f('0x24')](_0xd74f('0x110'),_0x49b61f,_0x6bed4b[_0xd74f('0x46')]),_0x6bed4b[_0xd74f('0x64')],_0x6bed4b[_0xd74f('0xe9')],_0x6bed4b[_0xd74f('0x61')]]);if(_0x5234ce[_0xd74f('0xa3')]===-0x1){return _0x5234ce;}return this[_0xd74f('0x36')]['noop'](util[_0xd74f('0x24')](_0xd74f('0xea'),_0xd74f('0xe7')));};AGIVertices[_0xd74f('0x15')][_0xd74f('0x111')]=function(_0x303dfc){logger['info'](util[_0xd74f('0x24')](_0xd74f('0x112'),_0x303dfc[_0xd74f('0xa8')]));return this['channel'][_0xd74f('0xa9')](_0xd74f('0x111'));};AGIVertices[_0xd74f('0x15')][_0xd74f('0xd')]=function(_0x522b0d){logger[_0xd74f('0x2a')](util[_0xd74f('0x24')](_0xd74f('0x113'),_0x522b0d[_0xd74f('0xa8')]));if(_0x522b0d['retry']===0x0){return this[_0xd74f('0xa5')](_0x522b0d);}_0x522b0d[_0xd74f('0xa6')]-=0x1;if(!this[_0xd74f('0x84')](_0x522b0d[_0xd74f('0x114')])){return this[_0xd74f('0x36')][_0xd74f('0x28')](_0x522b0d,_0xd74f('0x115'));}var _0x48828d=this[_0xd74f('0x116')][_0xd74f('0x6f')](this,_0x522b0d[_0xd74f('0x114')]);if(!_0x48828d){return this['channel'][_0xd74f('0x28')](_0x522b0d,_0xd74f('0x117'));}if(!this[_0xd74f('0x84')](_0x522b0d[_0xd74f('0xdb')])){return this[_0xd74f('0x36')]['error'](_0xd74f('0xdc'));}var _0x3df19c=this[_0xd74f('0x36')][_0xd74f('0x118')](_0x48828d,_0x522b0d[_0xd74f('0x119')],_0x522b0d[_0xd74f('0x11a')]);var _0x4b8ab4=_0x3df19c[_0xd74f('0xa3')]?_0x3df19c[_0xd74f('0xa3')][_0xd74f('0x49')]():'';logger[_0xd74f('0x2a')](_0xd74f('0x11b'),JSON[_0xd74f('0x71')](_0x3df19c));if(_0x3df19c['result']===-0x1){this[_0xd74f('0x33')]['sync'](this,_0x522b0d,_0x4b8ab4);return _0x3df19c;}else if(_0x3df19c['extra']==='timeout'){_0x3df19c[_0xd74f('0xa3')]=_0x4b8ab4['length']>=parseInt(_0x522b0d['mindigit'])?'x':'i';}else{_0x3df19c[_0xd74f('0xa3')]=_0x4b8ab4[_0xd74f('0x9a')]>=parseInt(_0x522b0d[_0xd74f('0x11c')])&&_0x4b8ab4[_0xd74f('0x9a')]<=parseInt(_0x522b0d['maxdigit'])?'x':'i';}var _0x12335f=this[_0xd74f('0x10')][_0xd74f('0x6f')](this,_0x522b0d[_0xd74f('0xdb')]);if(!_0x12335f){return this[_0xd74f('0x36')]['error'](_0x522b0d,_0xd74f('0xdd'));}this[_0xd74f('0x36')][_0xd74f('0x9e')](_0x12335f,_0x4b8ab4);if(this[_0xd74f('0x84')](_0x522b0d['hiddendigitsnum'])){var _0x49fe06=parseInt(_0x522b0d[_0xd74f('0x11d')],0xa);var _0x56307a=rs['generate']({'charset':'*','length':_0x49fe06});var _0x467248=_0x4b8ab4[_0xd74f('0x9a')];if(_0x467248>0x0){if(_0x467248>_0x49fe06){this[_0xd74f('0x33')][_0xd74f('0x6f')](this,_0x522b0d,_0x522b0d['hiddendigitspos']===_0xd74f('0x11e')?_0x56307a+_0x4b8ab4['substr'](_0x49fe06):_0x4b8ab4[_0xd74f('0x11f')](0x0,_0x467248-_0x49fe06)+_0x56307a);}else{this['createSquareDetailsReport'][_0xd74f('0x6f')](this,_0x522b0d,rs[_0xd74f('0x120')]({'charset':'*','length':_0x467248}));}}else{this[_0xd74f('0x33')][_0xd74f('0x6f')](this,_0x522b0d,'');}}else{this['createSquareDetailsReport'][_0xd74f('0x6f')](this,_0x522b0d,_0x4b8ab4);}return _0x3df19c;};AGIVertices[_0xd74f('0x15')][_0xd74f('0xe')]=function(_0x26e8d6){logger[_0xd74f('0x2a')](util[_0xd74f('0x24')](_0xd74f('0x121'),_0x26e8d6['label']));return this[_0xd74f('0xd')](_0x26e8d6);};AGIVertices[_0xd74f('0x15')][_0xd74f('0x122')]=function(_0x2d168f){logger['info'](util[_0xd74f('0x24')]('Enter\x20in\x20GOAL\x20(%s)\x20block',_0x2d168f['label']));this['createSquareDetailsReport'][_0xd74f('0x6f')](this,_0x2d168f,_0x2d168f[_0xd74f('0x123')]);return this['channel'][_0xd74f('0xa9')](util[_0xd74f('0x24')](_0xd74f('0x124'),_0x2d168f[_0xd74f('0x123')]));};AGIVertices[_0xd74f('0x15')][_0xd74f('0x125')]=function(_0x46ddb3){logger[_0xd74f('0x2a')](util[_0xd74f('0x24')](_0xd74f('0x126'),_0x46ddb3[_0xd74f('0xa8')]));if(!this[_0xd74f('0x84')](_0x46ddb3[_0xd74f('0x86')])||!this['isConfigured'](_0x46ddb3[_0xd74f('0x127')])){return this['channel'][_0xd74f('0xa9')]('no\x20valid\x20credentials\x20configured');}if(!this['isConfigured'](_0x46ddb3['text'])){return this[_0xd74f('0x36')][_0xd74f('0xa9')](_0xd74f('0xca'));}this[_0xd74f('0x36')][_0xd74f('0xa9')](util[_0xd74f('0x24')](_0xd74f('0x128'),_0x46ddb3['text']));var _0x2e66c9=this[_0xd74f('0x85')]['sync'](this,_0x46ddb3);if(_0x2e66c9){this[_0xd74f('0x36')][_0xd74f('0xa9')](util[_0xd74f('0x24')](_0xd74f('0x129'),_0x2e66c9));var _0x288661=this[_0xd74f('0x36')]['streamFile'](_0x2e66c9);try{fs[_0xd74f('0x12a')](_0x2e66c9+_0xd74f('0x107'));}catch(_0x1e364d){logger[_0xd74f('0x28')](_0x1e364d);}return _0x288661;}return this[_0xd74f('0x36')][_0xd74f('0x28')](_0x46ddb3,_0xd74f('0x12b'));};AGIVertices[_0xd74f('0x15')][_0xd74f('0x12c')]=function(_0x3d987f){logger[_0xd74f('0x2a')](util['format']('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x3d987f['label']));if(!this['isConfigured'](_0x3d987f[_0xd74f('0x86')])||!this[_0xd74f('0x84')](_0x3d987f[_0xd74f('0x127')])){return this[_0xd74f('0x36')][_0xd74f('0xa9')](_0xd74f('0x12d'));}if(!this[_0xd74f('0x84')](_0x3d987f[_0xd74f('0x8b')])){return this[_0xd74f('0x36')][_0xd74f('0xa9')](_0xd74f('0x12e'));}if(!this[_0xd74f('0x84')](_0x3d987f[_0xd74f('0x58')])){return this[_0xd74f('0x36')][_0xd74f('0xa9')](_0xd74f('0xca'));}this[_0xd74f('0x36')]['bot']=!![];this[_0xd74f('0x33')](_0x3d987f);this['createSquareMessage'](_0x3d987f[_0xd74f('0x58')],'in','','');this[_0xd74f('0x36')]['noop'](util[_0xd74f('0x24')](_0xd74f('0x12f'),_0x3d987f[_0xd74f('0x58')]));var _0x49eb66=this[_0xd74f('0x89')]['sync'](this,_0x3d987f);if(_0x49eb66){for(var _0x5269b0 in _0x49eb66){if(_0x49eb66[_0xd74f('0x94')](_0x5269b0)&&_['isString'](_0x49eb66[_0x5269b0])){this[_0xd74f('0x36')][_0xd74f('0x9e')](util[_0xd74f('0x24')](_0xd74f('0x130'),_0x5269b0['toUpperCase']()),_0x49eb66[_0x5269b0]);}}if(_[_0xd74f('0x41')](_0x49eb66[_0xd74f('0x75')])){return this[_0xd74f('0x36')][_0xd74f('0xa9')](_0xd74f('0x131'));}else{this[_0xd74f('0x3f')](_0x49eb66[_0xd74f('0x75')],_0xd74f('0xef'),_0xd74f('0x132'),'');return this[_0xd74f('0x36')][_0xd74f('0xa9')](util['format'](_0xd74f('0x133'),_0x49eb66[_0xd74f('0x75')]));}}return this['channel']['error'](_0x3d987f,_0xd74f('0x134'));};AGIVertices[_0xd74f('0x15')][_0xd74f('0x135')]=function(_0x1661bb){logger['info'](util['format'](_0xd74f('0x136'),_0x1661bb[_0xd74f('0xa8')],_0x1661bb[_0xd74f('0x64')]));if(!this[_0xd74f('0x84')](_0x1661bb[_0xd74f('0x82')])){return this['channel'][_0xd74f('0xa9')](_0xd74f('0xec'));}var _0x2e1111=_0xd74f('0x137');var _0xf568ad=util['format']('%s/recordings/%s',FILES_PATH,rs[_0xd74f('0x120')](0x4));var _0x364d77=util[_0xd74f('0x24')](_0xd74f('0x9d'),_0xf568ad,_0x2e1111);var _0x280411=!![];if(_0x1661bb[_0xd74f('0x138')]===_0xd74f('0x139')){_0x280411=![];}var _0x18496f=this['channel'][_0xd74f('0x13a')](_0xf568ad,_0x2e1111,_0x1661bb[_0xd74f('0x13b')],_0x1661bb[_0xd74f('0x64')],undefined,_0x280411);if(_0x18496f[_0xd74f('0xa3')]!==-0x1){this[_0xd74f('0x36')][_0xd74f('0xa9')](util[_0xd74f('0x24')](_0xd74f('0x13c'),_0x364d77));var _0x4eae3b=this['googleASR']['sync'](this,_0x1661bb,_0x364d77);if(_0x4eae3b){for(var _0x3e340b in _0x4eae3b){if(_0x4eae3b['hasOwnProperty'](_0x3e340b)){this[_0xd74f('0x36')]['setVariable'](util['format'](_0xd74f('0x13d'),_0x3e340b[_0xd74f('0x67')]()),_0x4eae3b[_0x3e340b]);}}return this[_0xd74f('0x36')][_0xd74f('0xa9')](util[_0xd74f('0x24')]('GoogleASR\x20Result\x20%s',JSON[_0xd74f('0x71')](_0x4eae3b)));}}return _0x18496f;};AGIVertices[_0xd74f('0x15')][_0xd74f('0x13e')]=function(_0x2a7b16){logger[_0xd74f('0x2a')](util['format'](_0xd74f('0x13f'),_0x2a7b16[_0xd74f('0xa8')]));if(!this[_0xd74f('0x84')](_0x2a7b16[_0xd74f('0x8e')])){return this['channel'][_0xd74f('0xa9')](_0xd74f('0x140'));}if(!this[_0xd74f('0x84')](_0x2a7b16['appsecret'])){return this[_0xd74f('0x36')][_0xd74f('0xa9')](_0xd74f('0x141'));}var _0x4b7fc6=_0xd74f('0x137');var _0xbee560=util[_0xd74f('0x24')]('%s/recordings/%s',FILES_PATH,rs['generate'](0x4));var _0x7bd60b=util[_0xd74f('0x24')](_0xd74f('0x9d'),_0xbee560,_0x4b7fc6);var _0x1c9fdc=!![];if(_0x2a7b16[_0xd74f('0x138')]===_0xd74f('0x139')){_0x1c9fdc=![];}var _0x5a92a8=this[_0xd74f('0x36')][_0xd74f('0x13a')](_0xbee560,_0x4b7fc6,_0x2a7b16['intKey'],_0x2a7b16[_0xd74f('0x64')],undefined,_0x1c9fdc);if(_0x5a92a8['result']!==-0x1){this[_0xd74f('0x36')][_0xd74f('0xa9')](util['format'](_0xd74f('0x142'),_0x7bd60b));var _0x282607=this[_0xd74f('0x8d')][_0xd74f('0x6f')](this,_0x2a7b16,_0x7bd60b);if(_0x282607){for(var _0x44f80d in _0x282607){if(_0x282607[_0xd74f('0x94')](_0x44f80d)){this[_0xd74f('0x36')]['setVariable'](util[_0xd74f('0x24')]('TILDE_ASR_%s',_0x44f80d[_0xd74f('0x67')]()),_0x282607[_0x44f80d]);}}return this[_0xd74f('0x36')][_0xd74f('0xa9')](util[_0xd74f('0x24')](_0xd74f('0x143'),JSON['stringify'](_0x282607)));}}return _0x5a92a8;};AGIVertices[_0xd74f('0x15')][_0xd74f('0x144')]=function(_0x4371f3){logger['info'](util[_0xd74f('0x24')](_0xd74f('0x145'),_0x4371f3['label']));return this[_0xd74f('0x36')][_0xd74f('0x146')](_0x4371f3[_0xd74f('0x3b')],_0x4371f3['extension'],_0x4371f3[_0xd74f('0x3d')]);};AGIVertices[_0xd74f('0x15')][_0xd74f('0x147')]=function(_0x219456){logger['info'](util['format'](_0xd74f('0x148'),_0x219456[_0xd74f('0xa8')]));if(!this[_0xd74f('0x84')](_0x219456[_0xd74f('0x149')])){return this[_0xd74f('0x36')][_0xd74f('0x28')](_0x219456,_0xd74f('0x14a'));}try{var _0x2c8a7b=eval(_0x219456[_0xd74f('0x149')])?'true':'false';this['channel'][_0xd74f('0xa9')](util[_0xd74f('0x24')]('EVAL\x20CONDITION\x20%s\x20%s',_0x219456[_0xd74f('0x149')],_0x2c8a7b));return{'code':0xc8,'result':_0x2c8a7b};}catch(_0x263110){return{'code':0xc8,'result':_0xd74f('0x14b')};}};AGIVertices[_0xd74f('0x15')][_0xd74f('0x14c')]=function(_0x1cfc3a){logger[_0xd74f('0x2a')](util[_0xd74f('0x24')]('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x1cfc3a[_0xd74f('0xa8')]));if(!this['isConfigured'](_0x1cfc3a[_0xd74f('0x14d')])){return this[_0xd74f('0x36')][_0xd74f('0x28')](_0x1cfc3a,_0xd74f('0x14e'));}var _0x3cbb4f=this['getIntervals'][_0xd74f('0x6f')](this,_0x1cfc3a[_0xd74f('0x14d')]);if(!_0x3cbb4f){return this[_0xd74f('0x36')][_0xd74f('0x28')](_0x1cfc3a,_0xd74f('0x14f'));}for(var _0x15c0db=0x0;_0x15c0db<_0x3cbb4f['length'];_0x15c0db+=0x1){var _0x23669c=this['channel'][_0xd74f('0x10')](util[_0xd74f('0x24')](_0xd74f('0x150'),_0x3cbb4f[_0x15c0db]));if(_0x23669c[_0xd74f('0xa3')]===-0x1){return _0x23669c;}logger[_0xd74f('0x2a')](util[_0xd74f('0x24')](_0xd74f('0x151'),_0x3cbb4f[_0x15c0db],_0x23669c[_0xd74f('0xa1')]));if(_0x23669c[_0xd74f('0xa1')]===_0xd74f('0x152')){logger['info'](util[_0xd74f('0x24')](_0xd74f('0x151'),_0x3cbb4f[_0x15c0db],_0xd74f('0x152')));this[_0xd74f('0x36')][_0xd74f('0xa9')](util[_0xd74f('0x24')](_0xd74f('0x151'),_0x3cbb4f[_0x15c0db],_0xd74f('0x152')));return{'code':0xc8,'result':_0xd74f('0x152')};}else{logger[_0xd74f('0x2a')](util[_0xd74f('0x24')]('IFTIME\x20%s\x20%s',_0x3cbb4f[_0x15c0db],_0xd74f('0x14b')));this[_0xd74f('0x36')][_0xd74f('0xa9')](util[_0xd74f('0x24')](_0xd74f('0x151'),_0x3cbb4f[_0x15c0db],'false'));}}return{'code':0xc8,'result':_0xd74f('0x14b')};};AGIVertices[_0xd74f('0x15')][_0xd74f('0x153')]=function(_0x1b7d7f){logger[_0xd74f('0x2a')](util['format']('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x1b7d7f['label']));return this[_0xd74f('0x36')]['hangup']();};AGIVertices[_0xd74f('0x15')][_0xd74f('0x154')]=function(_0x42b149){logger[_0xd74f('0x2a')](util['format'](_0xd74f('0x155'),_0x42b149['label']));if(!this[_0xd74f('0x84')](_0x42b149[_0xd74f('0x82')])){return this[_0xd74f('0x36')][_0xd74f('0xa9')](_0xd74f('0xec'));}var _0x1f88fe=_0xd74f('0x137');var _0x519e18=util[_0xd74f('0x24')](_0xd74f('0x156'),FILES_PATH,rs['generate'](0x4));var _0x3b4f28=util[_0xd74f('0x24')](_0xd74f('0x9d'),_0x519e18,_0x1f88fe);var _0x263c2a=!![];if(_0x42b149[_0xd74f('0x138')]===_0xd74f('0x139')){_0x263c2a=![];}var _0x1f8fc2=this['channel'][_0xd74f('0x13a')](_0x519e18,_0x1f88fe,_0x42b149[_0xd74f('0x13b')],_0x42b149['timeout'],undefined,_0x263c2a);if(_0x1f8fc2[_0xd74f('0xa3')]!==-0x1){this[_0xd74f('0x36')][_0xd74f('0xa9')](util[_0xd74f('0x24')](_0xd74f('0x157'),_0x3b4f28));var _0x2cd95c=this[_0xd74f('0x81')]['sync'](this,_0x42b149,_0x3b4f28);if(_0x2cd95c){for(var _0x119c45 in _0x2cd95c){if(_0x2cd95c[_0xd74f('0x94')](_0x119c45)){this['channel']['setVariable'](util[_0xd74f('0x24')](_0xd74f('0x158'),_0x119c45[_0xd74f('0x67')]()),_0x2cd95c[_0x119c45]);}}return this['channel'][_0xd74f('0xa9')](util[_0xd74f('0x24')]('IspeechASR\x20Result\x20%s',JSON[_0xd74f('0x71')](_0x2cd95c)));}}return _0x1f8fc2;};AGIVertices[_0xd74f('0x15')][_0xd74f('0x159')]=function(_0x96ce6c){logger[_0xd74f('0x2a')](util['format'](_0xd74f('0x15a'),_0x96ce6c['label']));if(!this[_0xd74f('0x84')](_0x96ce6c[_0xd74f('0x82')])){return this['channel'][_0xd74f('0xa9')](_0xd74f('0xec'));}if(!this[_0xd74f('0x84')](_0x96ce6c['text'])){return this[_0xd74f('0x36')]['noop'](_0xd74f('0xca'));}this['channel'][_0xd74f('0xa9')](util[_0xd74f('0x24')](_0xd74f('0x15b'),_0x96ce6c['text']));var _0x317d9f=this[_0xd74f('0x7e')][_0xd74f('0x6f')](this,_0x96ce6c);if(_0x317d9f){this[_0xd74f('0x36')]['noop'](util[_0xd74f('0x24')](_0xd74f('0x157'),_0x317d9f));var _0x2ea836=this[_0xd74f('0x36')][_0xd74f('0x106')](_0x317d9f,_0x96ce6c[_0xd74f('0x13b')]);try{fs[_0xd74f('0x12a')](_0x317d9f+_0xd74f('0x107'));}catch(_0xb2e749){logger[_0xd74f('0x28')](_0xb2e749);}return _0x2ea836;}return this['channel'][_0xd74f('0x28')](_0x96ce6c,_0xd74f('0x15c'));};AGIVertices[_0xd74f('0x15')][_0xd74f('0x15d')]=function(_0x2baf49){logger[_0xd74f('0x2a')](util[_0xd74f('0x24')]('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0x2baf49['label']));if(!this[_0xd74f('0x84')](_0x2baf49[_0xd74f('0x15e')])){return this[_0xd74f('0x36')]['error'](_0x2baf49,_0xd74f('0x15f'));}logger[_0xd74f('0x2a')](util[_0xd74f('0x24')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xd74f('0x36')][_0xd74f('0x38')],_0x2baf49['findBy']));var _0x18ea0a=this[_0xd74f('0x4f')]['sync'](this,_0x2baf49[_0xd74f('0x15e')]);if(_0x18ea0a){logger[_0xd74f('0x2a')](util[_0xd74f('0x24')](_0xd74f('0x160'),this['channel']['callerid'],_0x2baf49[_0xd74f('0x15e')]));this[_0xd74f('0x36')][_0xd74f('0xa9')](util['format'](_0xd74f('0x160'),this[_0xd74f('0x36')][_0xd74f('0x38')],_0x2baf49['findBy']));return{'code':0xc8,'result':_0xd74f('0x161')};}else{logger[_0xd74f('0x2a')](util[_0xd74f('0x24')](_0xd74f('0x162'),this[_0xd74f('0x36')][_0xd74f('0x38')],_0x2baf49[_0xd74f('0x15e')]));this[_0xd74f('0x36')]['noop'](util[_0xd74f('0x24')](_0xd74f('0x162'),this[_0xd74f('0x36')][_0xd74f('0x38')],_0x2baf49[_0xd74f('0x15e')]));return{'code':0xc8,'result':_0xd74f('0x163')};}};AGIVertices[_0xd74f('0x15')]['logout']=function(_0x53754d){logger[_0xd74f('0x2a')](util['format'](_0xd74f('0x164'),_0x53754d['label']));if(!this[_0xd74f('0x84')](_0x53754d['findBy'])){return this[_0xd74f('0x36')][_0xd74f('0x28')](_0x53754d,_0xd74f('0x15f'));}logger['info'](util[_0xd74f('0x24')](_0xd74f('0x165'),this[_0xd74f('0x36')][_0xd74f('0x38')],_0x53754d['findBy']));var _0x4cb4d0=this[_0xd74f('0x4e')][_0xd74f('0x6f')](this,_0x53754d[_0xd74f('0x15e')]);if(_0x4cb4d0){logger[_0xd74f('0x2a')](util[_0xd74f('0x24')](_0xd74f('0x160'),this[_0xd74f('0x36')]['callerid'],_0x53754d[_0xd74f('0x15e')]));this['channel'][_0xd74f('0xa9')](util[_0xd74f('0x24')](_0xd74f('0x160'),this[_0xd74f('0x36')][_0xd74f('0x38')],_0x53754d[_0xd74f('0x15e')]));return{'code':0xc8,'result':_0xd74f('0x161')};}else{logger[_0xd74f('0x2a')](util[_0xd74f('0x24')](_0xd74f('0x162'),this['channel']['callerid'],_0x53754d['findBy']));this[_0xd74f('0x36')]['noop'](util[_0xd74f('0x24')](_0xd74f('0x162'),this[_0xd74f('0x36')][_0xd74f('0x38')],_0x53754d[_0xd74f('0x15e')]));return{'code':0xc8,'result':_0xd74f('0x163')};}};AGIVertices[_0xd74f('0x15')]['math']=function(_0x21bcc3){logger[_0xd74f('0x2a')](util[_0xd74f('0x24')](_0xd74f('0x166'),_0x21bcc3[_0xd74f('0xa8')]));if(!this[_0xd74f('0x84')](_0x21bcc3[_0xd74f('0x167')])){return this['channel']['error'](_0x21bcc3,_0xd74f('0x168'));}this[_0xd74f('0x36')][_0xd74f('0xa9')](util['format'](_0xd74f('0x169'),_0x21bcc3[_0xd74f('0x167')]));var _0x482330=eval(_0x21bcc3[_0xd74f('0x167')]);if(!this['isConfigured'](_0x21bcc3['variable_id'])){return this[_0xd74f('0x36')][_0xd74f('0xa9')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x44f2f1=this[_0xd74f('0x10')]['sync'](this,_0x21bcc3[_0xd74f('0xdb')]);if(!_0x44f2f1){return this[_0xd74f('0x36')]['error'](_0x21bcc3,_0xd74f('0xdd'));}if(_[_0xd74f('0x99')](_0x482330)){var _0xceb05d=this;_0x482330[_0xd74f('0xdf')](function(_0x42f933,_0x3e808d){_0xceb05d['channel'][_0xd74f('0x9e')](util[_0xd74f('0x24')](_0xd74f('0x16a'),_0x44f2f1,_0x3e808d),_0x42f933);});return this[_0xd74f('0x36')]['noop'](util[_0xd74f('0x24')](_0xd74f('0x16b'),_0x44f2f1));}else{return this[_0xd74f('0x36')]['setVariable'](_0x44f2f1,_0x482330);}};AGIVertices[_0xd74f('0x15')]['menu']=function(_0x3b7f6d){logger['info'](util[_0xd74f('0x24')](_0xd74f('0x16c'),_0x3b7f6d[_0xd74f('0xa8')]));if(_0x3b7f6d[_0xd74f('0xa6')]===0x0){return this['maxRetry'](_0x3b7f6d);}_0x3b7f6d['retry']-=0x1;if(!this['isConfigured'](_0x3b7f6d[_0xd74f('0x114')])){return this[_0xd74f('0x36')]['error'](_0x3b7f6d,_0xd74f('0x115'));}var _0x5e5ac6=this['getSound'][_0xd74f('0x6f')](this,_0x3b7f6d['file_id']);if(!_0x5e5ac6){return this[_0xd74f('0x36')][_0xd74f('0x28')](_0x3b7f6d,'no\x20file\x20audio\x20found');}var _0x43c2f0=this['channel'][_0xd74f('0x118')](_0x5e5ac6,_0x3b7f6d[_0xd74f('0x119')],_0x3b7f6d[_0xd74f('0x16d')]);var _0x1b15bb=_0x43c2f0['result'];if(_0x43c2f0['result']===-0x1){this[_0xd74f('0x33')]['sync'](this,_0x3b7f6d,'-1');return _0x43c2f0;}else if(_0x43c2f0[_0xd74f('0xa1')]===_0xd74f('0x64')){_0x43c2f0[_0xd74f('0xa3')]=_0x43c2f0[_0xd74f('0xa3')][_0xd74f('0x9a')]>0x0?_0x43c2f0[_0xd74f('0xa3')]:'t';}else if(_[_0xd74f('0x44')](_0x43c2f0[_0xd74f('0xa3')])){_0x43c2f0[_0xd74f('0xa3')]='#';_0x1b15bb='#';}if(!this['isConfigured'](_0x3b7f6d[_0xd74f('0xdb')])){this['channel'][_0xd74f('0xa9')](_0xd74f('0xdc'));}else{var _0x53eaca=this[_0xd74f('0x10')][_0xd74f('0x6f')](this,_0x3b7f6d[_0xd74f('0xdb')]);if(!_0x53eaca){return this['channel'][_0xd74f('0x28')](_0x3b7f6d,_0xd74f('0xdd'));}this['channel'][_0xd74f('0x9e')](_0x53eaca,_0x1b15bb);}this[_0xd74f('0x33')]['sync'](this,_0x3b7f6d,_0x1b15bb);return _0x43c2f0;};AGIVertices[_0xd74f('0x15')]['noop']=function(_0x3f14f4){logger[_0xd74f('0x2a')](util['format']('Enter\x20in\x20NOOP\x20(%s)\x20block',_0x3f14f4[_0xd74f('0xa8')]));return this['channel'][_0xd74f('0xa9')](_0x3f14f4[_0xd74f('0x16e')]||_0x3f14f4[_0xd74f('0xa8')]);};AGIVertices[_0xd74f('0x15')]['pause']=function(_0x5106ca){logger[_0xd74f('0x2a')](util[_0xd74f('0x24')]('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0x5106ca['label']));if(!this[_0xd74f('0x84')](_0x5106ca[_0xd74f('0x15e')])){return this[_0xd74f('0x36')]['error'](_0x5106ca,_0xd74f('0x15f'));}logger['info'](util[_0xd74f('0x24')](_0xd74f('0x165'),this[_0xd74f('0x36')][_0xd74f('0x38')],_0x5106ca['findBy']));var _0x42f0cc=this[_0xd74f('0x16f')]['sync'](this,_0x5106ca[_0xd74f('0x170')]);var _0x166464=this[_0xd74f('0x4b')]['sync'](this,_0x5106ca[_0xd74f('0x15e')],_0x42f0cc);if(_0x166464){logger['info'](util[_0xd74f('0x24')](_0xd74f('0x160'),this[_0xd74f('0x36')][_0xd74f('0x38')],_0x5106ca['findBy']));this[_0xd74f('0x36')]['noop'](util[_0xd74f('0x24')](_0xd74f('0x160'),this[_0xd74f('0x36')][_0xd74f('0x38')],_0x5106ca['findBy']));return{'code':0xc8,'result':_0xd74f('0x161')};}else{logger[_0xd74f('0x2a')](util[_0xd74f('0x24')](_0xd74f('0x162'),this['channel'][_0xd74f('0x38')],_0x5106ca['findBy']));this[_0xd74f('0x36')][_0xd74f('0xa9')](util['format'](_0xd74f('0x160'),this[_0xd74f('0x36')][_0xd74f('0x38')],_0x5106ca[_0xd74f('0x15e')]));return{'code':0xc8,'result':_0xd74f('0x163')};}};AGIVertices[_0xd74f('0x15')]['playback']=function(_0x58ed9d){logger[_0xd74f('0x2a')](util[_0xd74f('0x24')](_0xd74f('0x171'),_0x58ed9d[_0xd74f('0xa8')]));if(!this[_0xd74f('0x84')](_0x58ed9d['file_id'])){return this[_0xd74f('0x36')][_0xd74f('0x28')](_0x58ed9d,_0xd74f('0x115'));}var _0x4c5501=this[_0xd74f('0x116')][_0xd74f('0x6f')](this,_0x58ed9d[_0xd74f('0x114')]);if(!_0x4c5501){return this[_0xd74f('0x36')][_0xd74f('0x28')](_0x58ed9d,_0xd74f('0x117'));}var _0x4292b0=this[_0xd74f('0x36')][_0xd74f('0x53')](_0xd74f('0x172'),[_0x4c5501,_0x58ed9d['opts']]);if(_0x4292b0[_0xd74f('0xa3')]===-0x1){return _0x4292b0;}return this[_0xd74f('0x36')]['noop'](util['format'](_0xd74f('0xc6'),_0xd74f('0x172'),_0x4c5501));};AGIVertices['prototype'][_0xd74f('0x173')]=function(_0x544758){logger[_0xd74f('0x2a')](util[_0xd74f('0x24')](_0xd74f('0x174'),_0x544758[_0xd74f('0xa8')]));if(!this[_0xd74f('0x84')](_0x544758[_0xd74f('0x175')])){return this[_0xd74f('0x36')][_0xd74f('0x28')](_0x544758,_0xd74f('0x176'));}var _0x2ac5c8='';var _0x401ff9=parseInt(_0x544758['queue_id'],0xa);if(isNaN(_0x401ff9)){_0x2ac5c8=_0x544758[_0xd74f('0x175')];}else{_0x2ac5c8=this['getVoiceQueue'][_0xd74f('0x6f')](this,_0x544758[_0xd74f('0x175')]);if(!_0x2ac5c8){return this['channel'][_0xd74f('0x28')](_0x544758,'no\x20queue\x20found');}}var _0x42e5e7='';if(this[_0xd74f('0x84')](_0x544758['file_id'])){var _0x573438=this[_0xd74f('0x116')]['sync'](this,_0x544758[_0xd74f('0x114')]);if(_0x573438){_0x42e5e7=_0x573438;}}this['createSquareDetailsReport'][_0xd74f('0x6f')](this,_0x544758,_0x2ac5c8);if(_0x544758[_0xd74f('0xe9')]['indexOf']('x')<0x0){_0x544758['opts']+='x';}if(_0x544758[_0xd74f('0xe9')][_0xd74f('0x177')]('X')<0x0){_0x544758[_0xd74f('0xe9')]+='X';}this[_0xd74f('0x36')]['setVariable']('XMCS-QUEUE',_0x2ac5c8?_0x2ac5c8['toLowerCase']():'');var _0x4cec28=this[_0xd74f('0x36')][_0xd74f('0x53')](_0xd74f('0x178'),[_0x2ac5c8,_0x544758[_0xd74f('0xe9')],_0x544758[_0xd74f('0x61')],_0x42e5e7,_0x544758[_0xd74f('0x64')],_0x544758[_0xd74f('0x8')],_0x544758['macro'],_0x544758[_0xd74f('0x179')],'',_0x544758[_0xd74f('0x17a')]]);if(_0x4cec28[_0xd74f('0xa3')]===-0x1){return _0x4cec28;}return this['channel'][_0xd74f('0xa9')](util['format'](_0xd74f('0xc6'),_0xd74f('0x178'),_0x2ac5c8));};AGIVertices[_0xd74f('0x15')][_0xd74f('0x17b')]=function(_0x1a69c2){logger[_0xd74f('0x2a')](util[_0xd74f('0x24')](_0xd74f('0x17c'),_0x1a69c2[_0xd74f('0xa8')]));var _0x35f522=_0x1a69c2[_0xd74f('0x17d')]||'wav';var _0x505655=util[_0xd74f('0x24')](_0xd74f('0x17e'),this[_0xd74f('0x36')][_0xd74f('0x34')],rs[_0xd74f('0x120')](0x5));var _0x16ba98=util['format'](_0xd74f('0x17f'),FILES_PATH,_0x505655,_0x35f522);var _0x43a04f=util[_0xd74f('0x24')](_0xd74f('0x156'),FILES_PATH,_0x505655);this[_0xd74f('0x39')][_0xd74f('0x6f')](this,_0x1a69c2,_0x505655,_0x16ba98);this[_0xd74f('0x36')][_0xd74f('0x9e')]('RECORDING_SAVENAME',_0x505655);logger[_0xd74f('0x2a')]('Recording\x20%s\x20%s\x20%s\x20%s',_0x43a04f,_0x35f522,_0x1a69c2[_0xd74f('0x180')],_0x1a69c2['timeout']);return this['channel']['recordFile'](_0x43a04f,_0x35f522,_0x1a69c2[_0xd74f('0x180')],_0x1a69c2[_0xd74f('0x64')],undefined,!![]);};AGIVertices[_0xd74f('0x15')][_0xd74f('0x181')]=function(_0x5659){logger[_0xd74f('0x2a')](util['format']('Enter\x20in\x20RESTAPI\x20(%s)\x20block',_0x5659['label']));if(!this[_0xd74f('0x84')](_0x5659[_0xd74f('0x61')])){return this[_0xd74f('0x36')]['noop'](_0xd74f('0x182'));}var _0x2388e8=this[_0xd74f('0x60')][_0xd74f('0x6f')](this,_0x5659);logger[_0xd74f('0x2a')](util[_0xd74f('0x24')](_0xd74f('0x183'),util[_0xd74f('0x184')](_0x2388e8,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x5659[_0xd74f('0xdb')])){return this[_0xd74f('0x36')][_0xd74f('0xa9')]('no\x20variable\x20selected\x20for\x20the\x20response');}var _0x46692d=this[_0xd74f('0x10')][_0xd74f('0x6f')](this,_0x5659[_0xd74f('0xdb')]);if(!_0x46692d){return this['channel'][_0xd74f('0x28')](_0x5659,_0xd74f('0xdd'));}this[_0xd74f('0x36')]['setVariable'](util['format'](_0xd74f('0x185'),_0x46692d),_0x2388e8[_0xd74f('0x74')]?_0x2388e8[_0xd74f('0x74')]:_0xd74f('0x186'));this[_0xd74f('0x36')][_0xd74f('0x9e')](util[_0xd74f('0x24')](_0xd74f('0x187'),_0x46692d),_0x2388e8[_0xd74f('0x73')]?_0x2388e8[_0xd74f('0x73')]:'OK');if(_0x2388e8[_0xd74f('0x68')]){try{this[_0xd74f('0x9c')](_0x2388e8[_0xd74f('0x68')],_0x46692d);}catch(_0x483c4f){logger[_0xd74f('0x28')](util['format']('Unable\x20to\x20set\x20result\x20in\x20variable\x20%s',_0x46692d));}}return this['channel']['noop'](util[_0xd74f('0x24')](_0xd74f('0x188'),_0x46692d));};AGIVertices[_0xd74f('0x15')][_0xd74f('0x189')]=function(_0x3a2384){logger['info'](util[_0xd74f('0x24')](_0xd74f('0x18a'),_0x3a2384[_0xd74f('0xa8')]));return this['channel']['sayDigits'](_0x3a2384[_0xd74f('0x18b')][_0xd74f('0x55')](/\s+/g,''),_0x3a2384['escape_digits']);};AGIVertices[_0xd74f('0x15')][_0xd74f('0x18c')]=function(_0x4e5a89){logger['info'](util[_0xd74f('0x24')](_0xd74f('0x18d'),_0x4e5a89[_0xd74f('0xa8')]));return this['channel'][_0xd74f('0x18e')](_0x4e5a89['number'][_0xd74f('0x55')](/\s+/g,''),_0x4e5a89['escape_digits']);};AGIVertices[_0xd74f('0x15')]['sayphonetic']=function(_0x19ad36){logger[_0xd74f('0x2a')](util[_0xd74f('0x24')](_0xd74f('0x18f'),_0x19ad36[_0xd74f('0xa8')]));return this[_0xd74f('0x36')][_0xd74f('0x190')](_0x19ad36[_0xd74f('0x58')],_0x19ad36[_0xd74f('0x180')]);};AGIVertices[_0xd74f('0x15')][_0xd74f('0x191')]=function(_0x2dd5f4){logger['info'](util[_0xd74f('0x24')](_0xd74f('0x192'),_0x2dd5f4['label']));if(!this[_0xd74f('0x84')](_0x2dd5f4[_0xd74f('0x193')])){return this[_0xd74f('0x36')]['noop'](_0xd74f('0x194'));}var _0x1190ad=this[_0xd74f('0x195')][_0xd74f('0x6f')](this,_0x2dd5f4[_0xd74f('0x193')]);if(!_0x1190ad||!_0x1190ad[_0xd74f('0x196')]){return this[_0xd74f('0x36')]['error'](_0x2dd5f4,_0xd74f('0x197'));}var _0x938780={'from':util[_0xd74f('0x24')](_0xd74f('0x198'),_0x1190ad[_0xd74f('0x13')],_0x1190ad[_0xd74f('0x199')]||_0x1190ad[_0xd74f('0x196')][_0xd74f('0x19a')]),'to':_0x2dd5f4['to']||'','cc':_0x2dd5f4['cc']||'','bcc':_0x2dd5f4[_0xd74f('0x19b')]||'','subject':_0x2dd5f4['subject'],'html':_0x2dd5f4['text'],'text':_0x2dd5f4[_0xd74f('0x58')]};if(this['isConfigured'](_0x2dd5f4[_0xd74f('0x19c')])){}logger['debug']('sendMail\x20message',JSON[_0xd74f('0x71')](_0x938780));this[_0xd74f('0x33')][_0xd74f('0x6f')](this,_0x2dd5f4,_0x2dd5f4[_0xd74f('0x193')]);this['channel'][_0xd74f('0xa9')](util[_0xd74f('0x24')](_0xd74f('0x19d'),_0x1190ad['name']));this[_0xd74f('0x20')][_0xd74f('0x6f')](this,_0x1190ad[_0xd74f('0x19e')],_0x938780);return this[_0xd74f('0x36')]['noop'](_0xd74f('0x19f'));};AGIVertices['prototype'][_0xd74f('0x1a0')]=function(_0x5151bd){logger[_0xd74f('0x2a')](util[_0xd74f('0x24')](_0xd74f('0x1a1'),_0x5151bd[_0xd74f('0xa8')]));return this[_0xd74f('0x36')][_0xd74f('0xa9')](_0xd74f('0x1a2'));};AGIVertices[_0xd74f('0x15')][_0xd74f('0x1a3')]=function(_0x3557f1){logger['info'](util[_0xd74f('0x24')](_0xd74f('0x1a4'),_0x3557f1[_0xd74f('0xa8')]));if(!this[_0xd74f('0x84')](_0x3557f1[_0xd74f('0x1a5')])){return this[_0xd74f('0x36')]['noop'](_0xd74f('0x1a6'));}var _0x918f73=this[_0xd74f('0x31')]['sync'](this,_0x3557f1[_0xd74f('0x1a5')]);if(!_0x918f73){return this[_0xd74f('0x36')]['error'](_0x3557f1,_0xd74f('0x1a7'));}var _0x13f0b8={'body':_0x3557f1[_0xd74f('0x1a8')],'phone':_0x3557f1['to']||'','SmsAccountId':_0x918f73['id']};logger[_0xd74f('0xe2')](_0xd74f('0x1a9'),JSON[_0xd74f('0x71')](_0x13f0b8));this['createSquareDetailsReport']['sync'](this,_0x3557f1,_0x3557f1[_0xd74f('0x1a5')]);this['channel'][_0xd74f('0xa9')](util[_0xd74f('0x24')](_0xd74f('0x1aa'),_0x918f73[_0xd74f('0x13')]));this[_0xd74f('0x32')][_0xd74f('0x6f')](this,_0x13f0b8);return this[_0xd74f('0x36')][_0xd74f('0xa9')](_0xd74f('0x1ab'));};AGIVertices[_0xd74f('0x15')][_0xd74f('0x1ac')]=function(_0x281aa2){logger['info'](util['format']('Enter\x20in\x20SET\x20(%s)\x20block',_0x281aa2[_0xd74f('0xa8')]));if(!this['isConfigured'](_0x281aa2[_0xd74f('0xdb')])){return this[_0xd74f('0x36')][_0xd74f('0x28')](_0x281aa2,_0xd74f('0x1ad'));}var _0xcc4453=this['getVariable']['sync'](this,_0x281aa2[_0xd74f('0xdb')]);if(!_0xcc4453){return this['channel'][_0xd74f('0x28')](_0x281aa2,_0xd74f('0xdd'));}return this[_0xd74f('0x36')][_0xd74f('0x9e')](_0xcc4453,_0x281aa2[_0xd74f('0x1ae')]);};AGIVertices[_0xd74f('0x15')][_0xd74f('0x1af')]=function(_0x603fb7){logger[_0xd74f('0x2a')](util['format'](_0xd74f('0x1b0'),_0x603fb7['label']));this[_0xd74f('0x36')][_0xd74f('0xa9')](_0xd74f('0x1b1'));if(_0x603fb7['answer']==='yes'){this['channel']['noop'](_0xd74f('0x1b2'));return this['channel'][_0xd74f('0xb8')]();}return this[_0xd74f('0x36')][_0xd74f('0xa9')](_0xd74f('0x1b3'));};AGIVertices['prototype']['subproject']=function(_0x4d7cf0){logger[_0xd74f('0x2a')](util[_0xd74f('0x24')](_0xd74f('0x1b4'),_0x4d7cf0[_0xd74f('0xa8')]));if(!this['isConfigured'](_0x4d7cf0[_0xd74f('0x1b5')])){return this[_0xd74f('0x36')][_0xd74f('0x28')](_0x4d7cf0,_0xd74f('0x1b6'));}var _0x5616d6=this[_0xd74f('0x1b7')][_0xd74f('0x6f')](this,_0x4d7cf0['project_id']);if(!this[_0xd74f('0x84')](_0x5616d6)){return this['channel'][_0xd74f('0x28')](_0x4d7cf0,util[_0xd74f('0x24')](_0xd74f('0x1b8'),_0x4d7cf0[_0xd74f('0x1b5')]));}if(_0x5616d6===this[_0xd74f('0x36')][_0xd74f('0x37')]){return this[_0xd74f('0x36')][_0xd74f('0x28')](_0x4d7cf0,_0xd74f('0x1b9'));}this['createSquareDetailsReport']['sync'](this,_0x4d7cf0,_0x5616d6);var _0x269d64=this[_0xd74f('0x36')][_0xd74f('0x53')]('AGI',util[_0xd74f('0x24')](_0xd74f('0x1ba'),config[_0xd74f('0x8')][_0xd74f('0x1bb')]||'127.0.0.1',_0x5616d6,this[_0xd74f('0x36')][_0xd74f('0x37')]));if(_0x269d64['result']===-0x1){return _0x269d64;}return this[_0xd74f('0x36')][_0xd74f('0xa9')](util['format']('Executed\x20command\x20%s\x20%s','AGI',_0x5616d6));};AGIVertices[_0xd74f('0x15')][_0xd74f('0x1bc')]=function(_0x2adf2f){logger[_0xd74f('0x2a')](util[_0xd74f('0x24')](_0xd74f('0x1bd'),_0x2adf2f[_0xd74f('0xa8')]));var _0x6b3d43=this[_0xd74f('0x52')]['sync'](this,_0x2adf2f['command']);this[_0xd74f('0x33')][_0xd74f('0x6f')](this,_0x2adf2f,_0x2adf2f[_0xd74f('0xb6')]);if(this[_0xd74f('0x84')](_0x2adf2f[_0xd74f('0xdb')])){var _0x3d8f99=this[_0xd74f('0x10')][_0xd74f('0x6f')](this,_0x2adf2f[_0xd74f('0xdb')]);if(_0x3d8f99){this[_0xd74f('0x36')]['setVariable'](_0x3d8f99,_0x6b3d43);return this[_0xd74f('0x36')][_0xd74f('0xa9')](util[_0xd74f('0x24')](_0xd74f('0x1be'),_0x2adf2f[_0xd74f('0xb6')],_0x3d8f99));}}return this[_0xd74f('0x36')][_0xd74f('0xa9')](util['format'](_0xd74f('0x1bf'),_0x2adf2f[_0xd74f('0xb6')]));};AGIVertices[_0xd74f('0x15')]['google_cloud_tts']=function(_0x8650f5){logger[_0xd74f('0x2a')](util[_0xd74f('0x24')](_0xd74f('0x1c0'),_0x8650f5[_0xd74f('0xa8')]));_0x8650f5[_0xd74f('0x58')]=_0x8650f5[_0xd74f('0x58')][_0xd74f('0x55')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xd74f('0x84')](_0x8650f5['apiKey'])){return this['channel'][_0xd74f('0xa9')](_0xd74f('0x1c1'));}if(!this[_0xd74f('0x84')](_0x8650f5[_0xd74f('0x58')])){return this['channel'][_0xd74f('0xa9')](_0xd74f('0xca'));}this[_0xd74f('0x36')][_0xd74f('0xa9')](util[_0xd74f('0x24')](_0xd74f('0x1c2'),_0x8650f5[_0xd74f('0x58')]));var _0x13fb7b=this[_0xd74f('0x56')][_0xd74f('0x6f')](this,_0x8650f5);if(_0x13fb7b){this[_0xd74f('0x36')]['noop'](util[_0xd74f('0x24')](_0xd74f('0x1c3'),_0x13fb7b));var _0x2f3152=this[_0xd74f('0x36')][_0xd74f('0x106')](_0x13fb7b);try{fs[_0xd74f('0x12a')](_0x13fb7b+_0xd74f('0x107'));}catch(_0x5904f9){logger['error'](_0x5904f9);}return _0x2f3152;}return this[_0xd74f('0x36')][_0xd74f('0x28')](_0x8650f5,'Google\x20Cloud\x20TTS\x20is\x20unreachable');};AGIVertices[_0xd74f('0x15')][_0xd74f('0x1c4')]=function(_0x1244ea){logger[_0xd74f('0x2a')](util[_0xd74f('0x24')](_0xd74f('0x1c5'),_0x1244ea[_0xd74f('0xa8')]));_0x1244ea['text']=_0x1244ea[_0xd74f('0x58')][_0xd74f('0x55')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xd74f('0x84')](_0x1244ea[_0xd74f('0x58')])){return this['channel']['noop']('no\x20text\x20configured');}this[_0xd74f('0x36')][_0xd74f('0xa9')](util[_0xd74f('0x24')]('Trying\x20Google\x20TTS\x20%s',_0x1244ea[_0xd74f('0x58')]));var _0x5ed6d0=this[_0xd74f('0x5e')]['sync'](this,_0x1244ea);if(_0x5ed6d0){this['channel'][_0xd74f('0xa9')](util[_0xd74f('0x24')](_0xd74f('0x1c6'),_0x5ed6d0));var _0x42ddd9=this[_0xd74f('0x36')][_0xd74f('0x106')](_0x5ed6d0);try{fs[_0xd74f('0x12a')](_0x5ed6d0+_0xd74f('0x107'));}catch(_0x2c1543){logger[_0xd74f('0x28')](_0x2c1543);}return _0x42ddd9;}return this[_0xd74f('0x36')][_0xd74f('0x28')](_0x1244ea,_0xd74f('0x1c7'));};AGIVertices[_0xd74f('0x15')][_0xd74f('0x1c8')]=function(_0x44ed88){logger['info'](util[_0xd74f('0x24')](_0xd74f('0x1c9'),_0x44ed88['label']));if(!this[_0xd74f('0x84')](_0x44ed88[_0xd74f('0x15e')])){return this[_0xd74f('0x36')][_0xd74f('0x28')](_0x44ed88,_0xd74f('0x15f'));}logger[_0xd74f('0x2a')](util[_0xd74f('0x24')](_0xd74f('0x165'),this[_0xd74f('0x36')]['callerid'],_0x44ed88[_0xd74f('0x15e')]));var _0x4ff2b2=this[_0xd74f('0x4c')][_0xd74f('0x6f')](this,_0x44ed88[_0xd74f('0x15e')]);if(_0x4ff2b2){logger[_0xd74f('0x2a')](util['format'](_0xd74f('0x160'),this[_0xd74f('0x36')][_0xd74f('0x38')],_0x44ed88[_0xd74f('0x15e')]));this['channel'][_0xd74f('0xa9')](util[_0xd74f('0x24')](_0xd74f('0x160'),this[_0xd74f('0x36')][_0xd74f('0x38')],_0x44ed88[_0xd74f('0x15e')]));return{'code':0xc8,'result':'success'};}else{logger[_0xd74f('0x2a')](util[_0xd74f('0x24')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xd74f('0x36')][_0xd74f('0x38')],_0x44ed88['findBy']));this[_0xd74f('0x36')][_0xd74f('0xa9')](util['format'](_0xd74f('0x162'),this['channel'][_0xd74f('0x38')],_0x44ed88[_0xd74f('0x15e')]));return{'code':0xc8,'result':_0xd74f('0x163')};}};AGIVertices[_0xd74f('0x15')][_0xd74f('0x1ca')]=function(_0x13c8cf){logger[_0xd74f('0x2a')](util['format'](_0xd74f('0x1cb'),_0x13c8cf[_0xd74f('0xa8')]));var _0x17b1f8=this[_0xd74f('0x36')][_0xd74f('0x53')](_0xd74f('0x1cc'),[_0x13c8cf['mailbox'],_0x13c8cf[_0xd74f('0x77')]]);if(_0x17b1f8[_0xd74f('0xa3')]===-0x1){return _0x17b1f8;}return this[_0xd74f('0x36')]['noop'](util['format'](_0xd74f('0xc6'),_0xd74f('0x1cc'),_0x13c8cf[_0xd74f('0x1cd')]));};AGIVertices['prototype']['vswitch']=function(_0x47a9e9){logger[_0xd74f('0x2a')](util[_0xd74f('0x24')](_0xd74f('0x1ce'),_0x47a9e9[_0xd74f('0xa8')]));if(!this[_0xd74f('0x84')](_0x47a9e9[_0xd74f('0xdb')])){return this['channel'][_0xd74f('0x28')](_0x47a9e9,'no\x20variable\x20selected');}var _0x100383=this[_0xd74f('0x10')][_0xd74f('0x6f')](this,_0x47a9e9['variable_id']);if(!_0x100383){return this[_0xd74f('0x36')][_0xd74f('0x28')](_0x47a9e9,_0xd74f('0xdd'));}var _0x5ed1ac=this['channel']['getVariable'](_0x100383);return{'code':0xc8,'result':_0x5ed1ac[_0xd74f('0xa1')]?_0x5ed1ac[_0xd74f('0xa1')]:'-'};};String[_0xd74f('0x15')][_0xd74f('0xa0')]=function(_0x3a6434,_0x19bd1b){return this['split'](_0x3a6434)['join'](_0x19bd1b);};module[_0xd74f('0x1cf')]=AGIVertices; \ No newline at end of file +var _0x67da=['map','Intervals','%s/sounds/converted/%s','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Query\x20executed\x20correctly\x20%s','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','agicommand','arg_1','callerid','createSquareRecording','calleridname','extension','priority','file','createSquareMessage','createCmContact','isEmpty','isNil','random','lastName','phone','list_id','scheduledAt','callback','toString','callback_priority','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','format','%s/%s@from-sip/n','LOCAL','shellCommand','exec','replace','googleCloudTTS','apiKey','text','en-US','ssmlGender','MALE','MP3','google_tts_language','url','method','number','timeout','includes','POST','PUT','toUpperCase','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','rawHeaders','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_secret_access_key','aws_polly_region','aws_polly_voice','aws_text_type','awsLex','aws_access_key_id','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','uri','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isArray','length','isPlainObject','%s.%s','setVariable','split','replaceAll','extra','result','maxRetry','retry','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','label','grammar','MRCPRecog','getAndSetVariable','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INSTANCE()','Executed\x20command\x20MRCPRecog\x20%s','command','wait','answer','Enter\x20in\x20CALLBACK\x20(%s)\x20block','add','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','sestektts','no\x20grammar\x20configured','RECOG_INPUT()','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','no\x20query\x20configured','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','keys','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','no\x20user\x20selected','sip_id','SIP/%s','opts','DIAL','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','DIALOGFLOW_%s','speech','out','Dialogflow\x20Result\x20%s','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20private_key\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','dialogflowV2','DialogflowV2\x20is\x20unreachable','sesteknda','no\x20ndauth\x20url\x20configured','username','password','ndassistant_url','bot','Trying\x20SestekNDA:\x20%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20found','trunk_name','no\x20trunk\x20selected','SIP/%s/%s','Executed\x20command\x20%s','finally','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','getSound','no\x20file\x20audio\x20found','getData','maxdigit','test','mindigit','hiddendigitsnum','first','substr','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','unlink','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','Trying\x20Amazon\x20Lex:\x20%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','message','Amazon\x20Lex\x20is\x20unreachable','googleasr','no\x20key\x20configured','wav','%s/recordings/%s','generate','beep','NOBEEP','google\x20%s\x20file\x20created','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','appsecret','no\x20appsecret\x20configured','intKey','TILDE_ASR_%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','context','gotoif','no\x20condition\x20configured','condition','true','false','EVAL\x20CONDITION\x20%s\x20%s','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME\x20%s\x20%s','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','recordFile','ispeech\x20%s\x20file\x20created','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','streamFile','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','FIND\x20AGENT\x20%s\x20BY\x20%s','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','forEach','variable\x20%s[key]\x20set','response','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','position','Enter\x20in\x20RECORD\x20(%s)\x20block','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','restAPI','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','saveRestApiResult','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','saynumber','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','user','bcc','subject','template_id','sendMail\x20message','account_id','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','Enter\x20in\x20SENDFAX\x20(%s)\x20block','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','getSmsAccount','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','START\x20CALLY\x20SQUARE','yes','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','getSquareProject','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','host','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Google\x20Cloud\x20TTS\x20is\x20unreachable','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','googleTTS','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','VOICEMAIL','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','lodash','shelljs','odbc','randomstring','moment','mustache','request-promise','../../config/logger','agi','../../config/environment','/var/opt/motion2/server/files','rawBody','menu','getdigits','getsecretdigits','channel','rpc','mailRpc','getVariable','then','getVoiceQueue','getVoiceQueueById','name','catch','prototype','getSquareOdbc','getSquareOdbcById','dsn','getUser','getTrunk','getTrunkById','getSoundById','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval'];(function(_0x4709c0,_0x3396c7){var _0x13348b=function(_0x426235){while(--_0x426235){_0x4709c0['push'](_0x4709c0['shift']());}};_0x13348b(++_0x3396c7);}(_0x67da,0x192));var _0xa67d=function(_0x310ad7,_0x1f8c6c){_0x310ad7=_0x310ad7-0x0;var _0x41a2c6=_0x67da[_0x310ad7];return _0x41a2c6;};'use strict';var fs=require('fs');var util=require('util');var _=require(_0xa67d('0x0'));var sh=require(_0xa67d('0x1'));var odbc=require(_0xa67d('0x2'))();var rs=require(_0xa67d('0x3'));var moment=require(_0xa67d('0x4'));var Mustache=require(_0xa67d('0x5'));var rp=require(_0xa67d('0x6'));var logger=require(_0xa67d('0x7'))(_0xa67d('0x8'));var config=require(_0xa67d('0x9'));var shared=require('../../config/environment/shared');var scripts=require('./scripts');var FILES_PATH=_0xa67d('0xa');var recursiveMapAttributes=['rawHeaders',_0xa67d('0xb')];var verticesWithRetry=[_0xa67d('0xc'),_0xa67d('0xd'),_0xa67d('0xe')];var AGIVertices=function(_0x23cbc5,_0x285e16,_0x330a9f){this[_0xa67d('0xf')]=_0x23cbc5;this[_0xa67d('0x10')]=_0x285e16;this[_0xa67d('0x11')]=_0x330a9f;};AGIVertices['prototype'][_0xa67d('0x12')]=function(_0x3edd8d,_0x386665){this[_0xa67d('0x10')]['getVariableById'](_0x3edd8d)[_0xa67d('0x13')](function(_0x431f21){_0x386665(null,_0x431f21?_0x431f21['name']:![]);})['catch'](function(_0x304ee2){_0x386665(_0x304ee2);});};AGIVertices['prototype'][_0xa67d('0x14')]=function(_0x5c4cc3,_0x5d757b){this[_0xa67d('0x10')][_0xa67d('0x15')](_0x5c4cc3)['then'](function(_0x3f24cd){_0x5d757b(null,_0x3f24cd?_0x3f24cd[_0xa67d('0x16')]:![]);})[_0xa67d('0x17')](function(_0x288e5f){_0x5d757b(_0x288e5f);});};AGIVertices['prototype']['getSquareProject']=function(_0x4f443b,_0x4fa50f){this[_0xa67d('0x10')]['getSquareProjectById'](_0x4f443b)[_0xa67d('0x13')](function(_0xf8422c){_0x4fa50f(null,_0xf8422c?_0xf8422c[_0xa67d('0x16')]:![]);})[_0xa67d('0x17')](function(_0x273788){_0x4fa50f(_0x273788);});};AGIVertices[_0xa67d('0x18')][_0xa67d('0x19')]=function(_0x5538a5,_0x2c769a){this[_0xa67d('0x10')][_0xa67d('0x1a')](_0x5538a5)[_0xa67d('0x13')](function(_0x28f38b){_0x2c769a(null,_0x28f38b?_0x28f38b[_0xa67d('0x1b')]:![]);})['catch'](function(_0x3f1898){_0x2c769a(_0x3f1898);});};AGIVertices[_0xa67d('0x18')][_0xa67d('0x1c')]=function(_0xed6c3e,_0x48f240){this[_0xa67d('0x10')]['getUserById'](_0xed6c3e)[_0xa67d('0x13')](function(_0x415141){_0x48f240(null,_0x415141?_0x415141[_0xa67d('0x16')]:![]);})[_0xa67d('0x17')](function(_0x559009){_0x48f240(_0x559009);});};AGIVertices[_0xa67d('0x18')][_0xa67d('0x1d')]=function(_0x5ed92a,_0x321003){this[_0xa67d('0x10')][_0xa67d('0x1e')](_0x5ed92a)[_0xa67d('0x13')](function(_0x18ea95){_0x321003(null,_0x18ea95?_0x18ea95[_0xa67d('0x16')]:![]);})['catch'](function(_0x435e56){_0x321003(_0x435e56);});};AGIVertices[_0xa67d('0x18')]['getSound']=function(_0x2ac61a,_0x83b547){var _0x12d324=this;this[_0xa67d('0x10')][_0xa67d('0x1f')](_0x2ac61a)[_0xa67d('0x13')](function(_0x42c858){_0x83b547(null,_0x42c858?_0x12d324[_0xa67d('0x20')](_0x42c858[_0xa67d('0x21')]):![]);})[_0xa67d('0x17')](function(_0x2d0ce5){_0x83b547(_0x2d0ce5);});};AGIVertices[_0xa67d('0x18')][_0xa67d('0x22')]=function(_0x393269,_0x5e4f04){this[_0xa67d('0x10')][_0xa67d('0x23')](_0x393269)[_0xa67d('0x13')](function(_0x2703f5){_0x5e4f04(null,_0x2703f5?_0x2703f5:![]);})[_0xa67d('0x17')](function(_0x531343){_0x5e4f04(_0x531343);});};AGIVertices[_0xa67d('0x18')][_0xa67d('0x24')]=function(_0x3f57ed,_0x318090,_0x39faa1){this[_0xa67d('0x11')][_0xa67d('0x24')](_0x3f57ed,_0x318090)[_0xa67d('0x13')](function(){_0x39faa1(null);})[_0xa67d('0x17')](function(_0x2aa9c3){_0x39faa1(_0x2aa9c3);});};AGIVertices['prototype'][_0xa67d('0x25')]=function(_0x5ee31e,_0x26d827){this[_0xa67d('0x10')][_0xa67d('0x26')](_0x5ee31e)['then'](function(_0x22e032){if(_0x22e032){if(_0x22e032[_0xa67d('0x27')]){_0x26d827(null,[_0x22e032[_0xa67d('0x28')]]);}else{_0x26d827(null,_[_0xa67d('0x29')](_0x22e032[_0xa67d('0x2a')],_0xa67d('0x28')));}}else{_0x26d827(null,![]);}})['catch'](function(_0x20f178){_0x26d827(_0x20f178);});};AGIVertices[_0xa67d('0x18')]['getSoundPath']=function(_0x48f968){return util['format'](_0xa67d('0x2b'),FILES_PATH,_0x48f968);};AGIVertices['prototype'][_0xa67d('0x2c')]=function(_0x219652,_0x323f66,_0x37ad23){odbc[_0xa67d('0x2d')](_0x219652,function(_0x44310e){if(_0x44310e){logger[_0xa67d('0x2e')](_0xa67d('0x2f'),_0x44310e);_0x37ad23(_0x44310e);}else{logger[_0xa67d('0x30')](_0xa67d('0x31'));odbc[_0xa67d('0x32')](_0x323f66,function(_0x392447,_0x1427f1){if(_0x392447){logger['info']('Error\x20executing\x20query\x20%s',_0x323f66);_0x37ad23(_0x392447);}else{logger['info'](_0xa67d('0x33'),_0x323f66);odbc['close'](function(_0x1c6fee){if(_0x1c6fee){logger[_0xa67d('0x2e')](_0xa67d('0x34'),_0x1c6fee);}_0x37ad23(null,_0x1427f1);});}});}});};AGIVertices[_0xa67d('0x18')]['getSmsAccount']=function(_0xffa987,_0x46669f){this[_0xa67d('0x10')][_0xa67d('0x35')](_0xffa987)[_0xa67d('0x13')](function(_0x2d1457){_0x46669f(null,_0x2d1457?_0x2d1457:![]);})[_0xa67d('0x17')](function(_0x5b51dc){_0x46669f(_0x5b51dc);});};AGIVertices['prototype'][_0xa67d('0x36')]=function(_0x46ed8b,_0x32b70c){this[_0xa67d('0x10')][_0xa67d('0x36')](_0x46ed8b)[_0xa67d('0x13')](function(_0x57a27d){_0x32b70c(null,_0x57a27d);})[_0xa67d('0x17')](function(_0x4e3bf7){_0x32b70c(_0x4e3bf7);});};AGIVertices[_0xa67d('0x18')][_0xa67d('0x37')]=function(_0x2f698c,_0x5c88fb,_0x372085){this[_0xa67d('0x10')]['createSquareDetailsReport']({'uniqueid':this['channel'][_0xa67d('0x38')],'node':_0x2f698c['label'],'application':_0x2f698c[_0xa67d('0x39')],'data':_0x5c88fb||null,'project_name':this[_0xa67d('0xf')][_0xa67d('0x3a')],'callerid':this['channel'][_0xa67d('0x3b')]})['then'](function(_0x214c7a){if(_0x372085){_0x372085(null,_0x214c7a);}})[_0xa67d('0x17')](function(_0x572ff0){if(_0x372085){_0x372085(_0x572ff0);}});};AGIVertices[_0xa67d('0x18')][_0xa67d('0x3c')]=function(_0x43687e,_0x2f4fb2,_0x2a4b13,_0x213645){this[_0xa67d('0x10')][_0xa67d('0x3c')]({'uniqueid':this['channel'][_0xa67d('0x38')],'callerid':this[_0xa67d('0xf')][_0xa67d('0x3b')],'calleridname':this[_0xa67d('0xf')][_0xa67d('0x3d')],'context':this['channel']['context'],'extension':this[_0xa67d('0xf')][_0xa67d('0x3e')],'priority':this[_0xa67d('0xf')][_0xa67d('0x3f')],'accountcode':this[_0xa67d('0xf')]['accountcode'],'dnid':this[_0xa67d('0xf')]['dnid'],'projectName':this[_0xa67d('0xf')][_0xa67d('0x3a')],'saveName':_0x2f4fb2,'filename':_0x43687e[_0xa67d('0x40')]||_0x2f4fb2,'savePath':_0x2a4b13})[_0xa67d('0x13')](function(_0x21e38d){_0x213645(null,_0x21e38d);})['catch'](function(_0x38b76e){_0x213645(_0x38b76e);});};AGIVertices[_0xa67d('0x18')][_0xa67d('0x41')]=function(_0x5833c2,_0x256251,_0x3d544a,_0x4e455b,_0x43bedb){this[_0xa67d('0x10')]['createSquareMessage']({'uniqueid':this['channel'][_0xa67d('0x38')],'body':_0x5833c2,'direction':_0x256251,'providerName':_0x3d544a,'providerResponse':_0x4e455b})[_0xa67d('0x13')](function(_0x905bfe){if(_0x43bedb){_0x43bedb(null,_0x905bfe);}})[_0xa67d('0x17')](function(_0xffce3f){if(_0x43bedb){_0x43bedb(_0xffce3f);}});};AGIVertices[_0xa67d('0x18')][_0xa67d('0x42')]=function(_0x3eb819,_0x242a01){this['rpc'][_0xa67d('0x42')]({'firstName':_[_0xa67d('0x43')](_0x3eb819['name'])||_[_0xa67d('0x44')](_0x3eb819[_0xa67d('0x16')])?'callback_'+Math[_0xa67d('0x45')]():_0x3eb819['name'],'lastName':_[_0xa67d('0x43')](_0x3eb819[_0xa67d('0x46')])||_[_0xa67d('0x44')](_0x3eb819[_0xa67d('0x46')])?null:_0x3eb819[_0xa67d('0x46')],'phone':_0x3eb819[_0xa67d('0x47')],'ListId':_0x3eb819[_0xa67d('0x48')],'scheduledat':_0x3eb819[_0xa67d('0x49')],'callbackUniqueid':this[_0xa67d('0xf')][_0xa67d('0x38')],'tags':_0xa67d('0x4a'),'description':'Callback\x20scheduled\x20at\x20'+_0x3eb819[_0xa67d('0x49')][_0xa67d('0x4b')](),'priority':_0x3eb819[_0xa67d('0x4c')]})[_0xa67d('0x13')](function(_0x539307){_0x242a01(null,_0x539307);})[_0xa67d('0x17')](function(_0x260e92){_0x242a01(_0x260e92);});};AGIVertices[_0xa67d('0x18')][_0xa67d('0x4d')]=function(_0x34e35f,_0x1639fe){this[_0xa67d('0x10')][_0xa67d('0x4e')](_0x34e35f)['then'](function(_0x569521){_0x1639fe(null,_0x569521?_0x569521['name']:![]);})[_0xa67d('0x17')](function(_0x5d4b5c){_0x1639fe(_0x5d4b5c);});};AGIVertices[_0xa67d('0x18')][_0xa67d('0x4f')]=function(_0x295a3c,_0x5e9e68,_0x4278f0){var _0x472b28={'role':_0xa67d('0x50')};_0x472b28[_0x295a3c]=this[_0xa67d('0xf')]['callerid'];this['rpc'][_0xa67d('0x4f')](_0x472b28,_0x5e9e68,this[_0xa67d('0xf')][_0xa67d('0x38')])[_0xa67d('0x13')](function(_0x32200d){_0x4278f0(null,_[_0xa67d('0x44')](_0x32200d)?![]:!![]);})[_0xa67d('0x17')](function(_0x5af704){logger[_0xa67d('0x2e')](_0x5af704);_0x4278f0(null,![]);});};AGIVertices[_0xa67d('0x18')]['agentUnpause']=function(_0x1a8574,_0x3d6d59){var _0x467c46={'role':'agent'};_0x467c46[_0x1a8574]=this[_0xa67d('0xf')][_0xa67d('0x3b')];this['rpc'][_0xa67d('0x51')](_0x467c46)[_0xa67d('0x13')](function(_0xb96936){_0x3d6d59(null,_['isNil'](_0xb96936)?![]:!![]);})[_0xa67d('0x17')](function(_0x17a89e){logger[_0xa67d('0x2e')](_0x17a89e);_0x3d6d59(null,![]);});};AGIVertices['prototype'][_0xa67d('0x52')]=function(_0x4ed172,_0x3e368f){var _0x4a2e2f={'role':_0xa67d('0x50')};_0x4a2e2f[_0x4ed172]=this[_0xa67d('0xf')][_0xa67d('0x3b')];this[_0xa67d('0x10')][_0xa67d('0x52')](_0x4a2e2f)['then'](function(_0x175028){_0x3e368f(null,_['isNil'](_0x175028)?![]:!![]);})[_0xa67d('0x17')](function(_0x24fa84){logger[_0xa67d('0x2e')](_0x24fa84);_0x3e368f(null,![]);});};AGIVertices['prototype'][_0xa67d('0x53')]=function(_0xaaf8cf,_0x192e62){var _0x3856ef={'role':_0xa67d('0x50')};_0x3856ef[_0xaaf8cf]=this[_0xa67d('0xf')][_0xa67d('0x3b')];var _0x50dfac=_0xaaf8cf!=_0xa67d('0x54')?util[_0xa67d('0x55')](_0xa67d('0x56'),_0xa67d('0x57'),this[_0xa67d('0xf')][_0xa67d('0x3b')]):undefined;this[_0xa67d('0x10')][_0xa67d('0x53')](_0x3856ef,_0x50dfac)[_0xa67d('0x13')](function(_0x59dd9e){_0x192e62(null,_[_0xa67d('0x44')](_0x59dd9e)?![]:!![]);})[_0xa67d('0x17')](function(_0x2a21c5){logger['error'](_0x2a21c5);_0x192e62(null,![]);});};AGIVertices[_0xa67d('0x18')][_0xa67d('0x58')]=function(_0x41ca15,_0x3c44fd){sh[_0xa67d('0x59')](_['trim'](_0x41ca15),function(_0x544929,_0x275bd6){var _0x2f80b4=_0x275bd6[_0xa67d('0x5a')](/(\r\n|\n|\r)/gm,'');_0x3c44fd(null,_0x2f80b4);});};AGIVertices[_0xa67d('0x18')][_0xa67d('0x5b')]=function(_0x189dd6,_0x28441d){scripts['googleCloudTTS'](_0x189dd6[_0xa67d('0x5c')],_0x189dd6['google_cloud_tts_text_type']||_0xa67d('0x5d'),_0x189dd6[_0xa67d('0x5d')],_0x189dd6['languageCode']||_0xa67d('0x5e'),_0x189dd6[_0xa67d('0x5f')]||_0xa67d('0x60'),_0x189dd6['audioEncoding']||_0xa67d('0x61'))[_0xa67d('0x13')](function(_0x3a7c2e){_0x28441d(null,_0x3a7c2e);})[_0xa67d('0x17')](function(_0x1032c2){_0x28441d(_0x1032c2);});};AGIVertices[_0xa67d('0x18')]['googleTTS']=function(_0x3cc975,_0x4cb621){scripts['googleTTS'](_0x3cc975[_0xa67d('0x5d')],_0x3cc975[_0xa67d('0x62')]||'en',0x1)['then'](function(_0x2997b4){_0x4cb621(null,_0x2997b4);})['catch'](function(_0x356ae5){_0x4cb621(_0x356ae5);});};AGIVertices[_0xa67d('0x18')]['restAPI']=function(_0xbe51dc,_0x16e9ff){var _0x19d8f7={'uri':_0xbe51dc[_0xa67d('0x63')],'method':_0xbe51dc[_0xa67d('0x64')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0xbe51dc['timeout'])===_0xa67d('0x65')&&parseInt(_0xbe51dc[_0xa67d('0x66')])>=0x1?parseInt(_0xbe51dc['timeout'])*0x3e8:0x5*0x3e8};if(_[_0xa67d('0x67')]([_0xa67d('0x68'),_0xa67d('0x69')],_0x19d8f7[_0xa67d('0x64')][_0xa67d('0x6a')]())){try{_0x19d8f7[_0xa67d('0x6b')]=_0xbe51dc[_0xa67d('0xb')]?JSON[_0xa67d('0x6c')](_0xbe51dc[_0xa67d('0xb')]):{};}catch(_0x144a49){logger[_0xa67d('0x2e')](_0xa67d('0x6d'),_0x144a49);}}try{_0x19d8f7[_0xa67d('0x6e')]=_0xbe51dc[_0xa67d('0x6f')]?JSON[_0xa67d('0x6c')](_0xbe51dc[_0xa67d('0x6f')]):{};}catch(_0x572877){logger[_0xa67d('0x2e')](_0xa67d('0x70'),_0x572877);}if(_0xbe51dc[_0xa67d('0x71')]){try{var _0x3adf5f=require(_0xbe51dc[_0xa67d('0x71')])[_0xa67d('0x72')](this,_0x19d8f7);_0x19d8f7['uri']=Mustache[_0xa67d('0x73')](_0xbe51dc['url'],_0x3adf5f,{},['$$','$$']);if(_0x19d8f7[_0xa67d('0x6e')]){_0x19d8f7[_0xa67d('0x6e')]=JSON['parse'](Mustache[_0xa67d('0x73')](JSON[_0xa67d('0x74')](_0x19d8f7['headers']),_0x3adf5f,{},['$$','$$']));}if(_0x19d8f7[_0xa67d('0x6b')]){_0x19d8f7[_0xa67d('0x6b')]=JSON[_0xa67d('0x6c')](Mustache[_0xa67d('0x73')](JSON[_0xa67d('0x74')](_0x19d8f7[_0xa67d('0x6b')]),_0x3adf5f,{},['$$','$$']));}}catch(_0x386ec5){logger[_0xa67d('0x2e')](_0xa67d('0x75'),_0x386ec5);}}rp(_0x19d8f7)['then'](function(_0x17e18f){var _0x48b888={'statusCode':_0x17e18f[_0xa67d('0x76')]||0xc8,'statusMessage':_0x17e18f[_0xa67d('0x77')]||'OK','headers':_0x17e18f[_0xa67d('0x6e')]||{},'body':_0x17e18f[_0xa67d('0x6b')]||{}};_0x16e9ff(null,_0x48b888);})[_0xa67d('0x17')](function(_0x1a01b1){var _0x4a6a81={'statusCode':_0x1a01b1[_0xa67d('0x76')]||0x1f4,'statusMessage':_0x1a01b1['message']||'500\x20-\x20Internal\x20Server\x20Error','headers':_0x1a01b1[_0xa67d('0x78')]['headers']||{},'body':_0x1a01b1[_0xa67d('0x78')][_0xa67d('0x6b')]||{}};_0x16e9ff(null,_0x4a6a81);});};AGIVertices[_0xa67d('0x18')]['googleDialogflow']=function(_0x26ecf9,_0x43e41b){scripts[_0xa67d('0x79')](this[_0xa67d('0xf')][_0xa67d('0x38')],_0x26ecf9[_0xa67d('0x7a')],_0x26ecf9[_0xa67d('0x5d')],_0x26ecf9[_0xa67d('0x7b')]||'en')[_0xa67d('0x13')](function(_0x135227){_0x43e41b(null,_0x135227);})[_0xa67d('0x17')](function(_0x41464c){_0x43e41b(_0x41464c);});};AGIVertices[_0xa67d('0x18')][_0xa67d('0x7c')]=function(_0x3db95b,_0x3de989){scripts['googleDialogflowV2'](this[_0xa67d('0xf')]['uniqueid'],_0x3db95b[_0xa67d('0x7d')],_0x3db95b[_0xa67d('0x7e')],_0x3db95b[_0xa67d('0x7f')],_0x3db95b[_0xa67d('0x5d')],_0x3db95b[_0xa67d('0x80')]||'en')['then'](function(_0x4ad826){_0x3de989(null,_0x4ad826);})[_0xa67d('0x17')](function(_0x325183){_0x3de989(_0x325183);});};AGIVertices[_0xa67d('0x18')][_0xa67d('0x81')]=function(_0x5d16c2,_0x1f79ca){scripts['sestekNDA'](this['channel'],_0x5d16c2)['then'](function(_0x21581a){_0x1f79ca(null,_0x21581a);})[_0xa67d('0x17')](function(_0x20ca67){_0x1f79ca(_0x20ca67);});};AGIVertices[_0xa67d('0x18')][_0xa67d('0x82')]=function(_0x26358f,_0x521c89){scripts[_0xa67d('0x82')](_0x26358f[_0xa67d('0x7a')],_0x26358f[_0xa67d('0x5d')],_0x26358f['ispeech_tts_language']||'en-US',_0x26358f[_0xa67d('0x83')])['then'](function(_0x5be0ed){_0x521c89(null,_0x5be0ed);})['catch'](function(_0x174b7a){_0x521c89(_0x174b7a);});};AGIVertices[_0xa67d('0x18')][_0xa67d('0x84')]=function(_0x348061,_0x1c5301,_0x2669c0){scripts['ispeechASR'](_0x1c5301,_0x348061[_0xa67d('0x7a')],_0x348061[_0xa67d('0x85')]||_0xa67d('0x5e'),this[_0xa67d('0x86')](_0x348061[_0xa67d('0x87')])?_0x348061['model']:undefined)[_0xa67d('0x13')](function(_0x2a36cd){_0x2669c0(null,_0x2a36cd);})[_0xa67d('0x17')](function(_0x40c9d3){_0x2669c0(_0x40c9d3);});};AGIVertices[_0xa67d('0x18')][_0xa67d('0x88')]=function(_0x376a29,_0x32facb){scripts[_0xa67d('0x88')](_0x376a29['aws_access_key_id'],_0x376a29[_0xa67d('0x89')],_0x376a29[_0xa67d('0x8a')],_0x376a29[_0xa67d('0x8b')]||'Amy',_0x376a29[_0xa67d('0x5d')],_0x376a29[_0xa67d('0x8c')]||_0xa67d('0x5d'))[_0xa67d('0x13')](function(_0x190084){_0x32facb(null,_0x190084);})[_0xa67d('0x17')](function(_0x54a775){_0x32facb(_0x54a775);});};AGIVertices[_0xa67d('0x18')][_0xa67d('0x8d')]=function(_0x51dbf5,_0x2911dc){scripts[_0xa67d('0x8d')](this[_0xa67d('0xf')][_0xa67d('0x38')],_0x51dbf5[_0xa67d('0x8e')],_0x51dbf5['aws_secret_access_key'],_0x51dbf5[_0xa67d('0x8f')],_0x51dbf5['text'],_0x51dbf5[_0xa67d('0x90')])['then'](function(_0x256e0e){_0x2911dc(null,_0x256e0e);})[_0xa67d('0x17')](function(_0x1d8a39){_0x2911dc(_0x1d8a39);});};AGIVertices[_0xa67d('0x18')][_0xa67d('0x91')]=function(_0x9633ba,_0x514e5a,_0x2d0a39){scripts[_0xa67d('0x91')](_0x514e5a,_0x9633ba['key'],_0x9633ba[_0xa67d('0x92')]||_0xa67d('0x5e'))['then'](function(_0x4107fe){_0x2d0a39(null,_0x4107fe);})[_0xa67d('0x17')](function(_0x1f2a42){_0x2d0a39(_0x1f2a42);});};AGIVertices[_0xa67d('0x18')][_0xa67d('0x93')]=function(_0x2ae823,_0xb54c2f,_0x4761c0){scripts['tildeASR'](_0xb54c2f,_0x2ae823[_0xa67d('0x94')],_0x2ae823['appsecret'],_0x2ae823[_0xa67d('0x95')])['then'](function(_0x4cda74){_0x4761c0(null,_0x4cda74);})[_0xa67d('0x17')](function(_0x14d65a){_0x4761c0(_0x14d65a);});};AGIVertices['prototype']['clear']=function(_0x32acda){var _0x5781ae=_[_0xa67d('0x67')](verticesWithRetry,_0x32acda[_0xa67d('0x39')])?_0x32acda:_[_0xa67d('0x96')](_0x32acda);for(var _0x1c9908 in _0x5781ae){if(_0x5781ae[_0xa67d('0x97')](_0x1c9908)){if(_0x5781ae[_0x1c9908]&&_[_0xa67d('0x98')](_0x5781ae[_0x1c9908])){if(_[_0xa67d('0x67')](recursiveMapAttributes,_0x1c9908)){_0x5781ae[_0x1c9908]=this[_0xa67d('0x99')](_0x5781ae[_0x1c9908]);}else{_0x5781ae[_0x1c9908]=this[_0xa67d('0x9a')](_0x5781ae[_0x1c9908]);}}}}return _0x5781ae;};AGIVertices[_0xa67d('0x18')][_0xa67d('0x9b')]=function(_0x128622){for(var _0xdc3296 in _0x128622){if(_0x128622[_0xa67d('0x97')](_0xdc3296)){if(_['isPlainObject'](_0x128622[_0xdc3296])){this[_0xa67d('0x9b')](_0x128622[_0xdc3296]);}else if(_[_0xa67d('0x9c')](_0x128622[_0xdc3296])){for(var _0x4e0c0e=0x0;_0x4e0c0e<_0x128622[_0xdc3296][_0xa67d('0x9d')];_0x4e0c0e++){this[_0xa67d('0x9b')](_0x128622[_0xdc3296][_0x4e0c0e]);}}else if(_[_0xa67d('0x98')](_0x128622[_0xdc3296])){_0x128622[_0xdc3296]=this[_0xa67d('0x9a')](_0x128622[_0xdc3296]);}}}};AGIVertices['prototype']['saveRestApiResult']=function(_0x360fd8,_0x330826){for(var _0x31792b in _0x360fd8){if(_0x360fd8[_0xa67d('0x97')](_0x31792b)){if(_[_0xa67d('0x9e')](_0x360fd8[_0x31792b])){if(!_[_0xa67d('0x43')](_0x360fd8[_0x31792b])){this['saveRestApiResult'](_0x360fd8[_0x31792b],util[_0xa67d('0x55')](_0xa67d('0x9f'),_0x330826,_0x31792b));}}else if(_['isArray'](_0x360fd8[_0x31792b])){for(var _0x148e42=0x0;_0x148e42<_0x360fd8[_0x31792b][_0xa67d('0x9d')];_0x148e42++){this['saveRestApiResult'](_0x360fd8[_0x31792b][_0x148e42],util['format'](_0xa67d('0x9f'),_0x330826,_0x31792b+'['+_0x148e42+']'));}}else{if(!_[_0xa67d('0x44')](_0x360fd8[_0x31792b])){this['channel'][_0xa67d('0xa0')](util[_0xa67d('0x55')](_0xa67d('0x9f'),_0x330826,_0x31792b),_0x360fd8[_0x31792b]);}}}}};AGIVertices[_0xa67d('0x18')][_0xa67d('0x99')]=function(_0x17334d){try{var _0x3c64ec=JSON[_0xa67d('0x6c')](_0x17334d);this[_0xa67d('0x9b')](_0x3c64ec);return JSON['stringify'](_0x3c64ec);}catch(_0x2340d){return this['replaceAllVariables'](_0x17334d);}};AGIVertices[_0xa67d('0x18')]['replaceAllVariables']=function(_0x4f0a06){var _0x5a80c8=_0x4f0a06[_0xa67d('0xa1')]('{');for(var _0x3fcc23=0x1;_0x3fcc23<_0x5a80c8[_0xa67d('0x9d')];_0x3fcc23+=0x1){var _0x4638d9=_0x5a80c8[_0x3fcc23]['split']('}');if(_0x4638d9['length']>0x1){_0x4f0a06=_0x4f0a06[_0xa67d('0xa2')]('{'+_0x4638d9[0x0]+'}',this['channel'][_0xa67d('0x12')](_0x4638d9[0x0])[_0xa67d('0xa3')]||_0x4638d9[0x0]);}}if(_0x5a80c8[_0xa67d('0x9d')]===0x1){return _0x4f0a06['toString']();}return this[_0xa67d('0x9a')](_0x4f0a06);};AGIVertices[_0xa67d('0x18')]['getAndSetVariable']=function(_0x24ada4,_0x452974){var _0x2a25d8=this[_0xa67d('0xf')][_0xa67d('0x12')](_0x24ada4);if(_0x2a25d8[_0xa67d('0xa4')]===-0x1){return _0x2a25d8;}logger[_0xa67d('0x30')](util[_0xa67d('0x55')]('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x452974,_0x2a25d8[_0xa67d('0xa3')]));return this[_0xa67d('0xf')]['setVariable'](_0x452974,_0x2a25d8['extra']);};AGIVertices[_0xa67d('0x18')]['isConfigured']=function(_0x3c6885){return _0x3c6885&&_0x3c6885!=='0'&&_0x3c6885!=='-1'&&_0x3c6885!=='';};AGIVertices[_0xa67d('0x18')][_0xa67d('0xa5')]=function(_0x21c36a){this[_0xa67d('0x37')][_0xa67d('0x72')](this,_0x21c36a,'-');_0x21c36a[_0xa67d('0xa6')]=_0x21c36a['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices[_0xa67d('0x18')]['mrcpsynth']=function(_0x2aae23){logger[_0xa67d('0x30')](util[_0xa67d('0x55')](_0xa67d('0xa7'),_0x2aae23['label']));if(!this['isConfigured'](_0x2aae23[_0xa67d('0x5d')])){return this[_0xa67d('0xf')][_0xa67d('0xa8')](_0xa67d('0xa9'));}var _0x3aeb16='\x22'+_0x2aae23[_0xa67d('0x5d')]+'\x22';if(this[_0xa67d('0x86')](_0x2aae23[_0xa67d('0x78')])){_0x3aeb16+=','+_0x2aae23[_0xa67d('0x78')];}var _0xc2dd13=this['channel'][_0xa67d('0x59')](_0xa67d('0xaa'),_0x3aeb16);if(_0xc2dd13['result']===-0x1){return _0xc2dd13;}return this['channel'][_0xa67d('0xa8')](util[_0xa67d('0x55')](_0xa67d('0xab'),_0x3aeb16));};AGIVertices[_0xa67d('0x18')][_0xa67d('0xac')]=function(_0x41cd5b){logger[_0xa67d('0x30')](util[_0xa67d('0x55')](_0xa67d('0xad'),_0x41cd5b[_0xa67d('0xae')]));if(!this[_0xa67d('0x86')](_0x41cd5b[_0xa67d('0xaf')])){return this[_0xa67d('0xf')][_0xa67d('0xa8')]('no\x20grammar\x20configured');}var _0x4d58ec=_0x41cd5b[_0xa67d('0xaf')];if(this[_0xa67d('0x86')](_0x41cd5b[_0xa67d('0x78')])){_0x4d58ec+=','+_0x41cd5b['options'];}var _0x2d297e=this['channel'][_0xa67d('0x59')](_0xa67d('0xb0'),_0x4d58ec);if(_0x2d297e[_0xa67d('0xa4')]===-0x1){return _0x2d297e;}var _0x348b13=this[_0xa67d('0xb1')](_0xa67d('0xb2'),_0xa67d('0xb3'));if(_0x348b13[_0xa67d('0xa4')]===-0x1){return _0x348b13;}var _0x2527c7=this[_0xa67d('0xb1')]('RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT');if(_0x2527c7[_0xa67d('0xa4')]===-0x1){return _0x2527c7;}var _0x18f3f3=this[_0xa67d('0xb1')](_0xa67d('0xb4'),'MRCP_RECOG_INSTANCE');if(_0x18f3f3[_0xa67d('0xa4')]===-0x1){return _0x18f3f3;}return this[_0xa67d('0xf')]['noop'](util[_0xa67d('0x55')](_0xa67d('0xb5'),_0x4d58ec));};AGIVertices[_0xa67d('0x18')][_0xa67d('0x8')]=function(_0x3cca2a){logger['info'](util[_0xa67d('0x55')]('Enter\x20in\x20AGI\x20(%s)\x20block',_0x3cca2a[_0xa67d('0xae')]));return this[_0xa67d('0xf')][_0xa67d('0x8')]([_0x3cca2a[_0xa67d('0xb6')],_0x3cca2a['args']]);};AGIVertices[_0xa67d('0x18')]['answer']=function(_0x392109){logger[_0xa67d('0x30')](util[_0xa67d('0x55')]('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x392109[_0xa67d('0xae')]));if(this[_0xa67d('0x86')](_0x392109[_0xa67d('0x66')])){logger[_0xa67d('0x30')](util[_0xa67d('0x55')]('Wait\x20%s\x20seconds\x20before\x20answer',_0x392109['timeout']));var _0xdeccac=this['channel'][_0xa67d('0xb7')](_0x392109[_0xa67d('0x66')]);if(_0xdeccac[_0xa67d('0xa4')]===-0x1){return _0xdeccac;}}return this[_0xa67d('0xf')][_0xa67d('0xb8')]();};AGIVertices[_0xa67d('0x18')][_0xa67d('0x4a')]=function(_0x146e13){logger[_0xa67d('0x30')](util[_0xa67d('0x55')](_0xa67d('0xb9'),_0x146e13[_0xa67d('0xae')]));if(!this['isConfigured'](_0x146e13['list_id'])){return this[_0xa67d('0xf')]['error'](_0x146e13,'no\x20list\x20selected');}_0x146e13[_0xa67d('0x49')]=moment();if(this[_0xa67d('0x86')](_0x146e13['delay'])){_0x146e13['scheduledAt']=moment()[_0xa67d('0xba')](_0x146e13['delay'],'minutes');}if(!this[_0xa67d('0x86')](_0x146e13[_0xa67d('0x4c')])){_0x146e13[_0xa67d('0x4c')]=0x2;}this[_0xa67d('0x42')][_0xa67d('0x72')](this,_0x146e13);return this[_0xa67d('0xf')][_0xa67d('0xa8')](util[_0xa67d('0x55')]('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0x146e13[_0xa67d('0x47')],_0x146e13[_0xa67d('0x48')],_0x146e13[_0xa67d('0x49')]));};AGIVertices[_0xa67d('0x18')][_0xa67d('0xbb')]=function(_0x2a970c){logger[_0xa67d('0x30')](util[_0xa67d('0x55')](_0xa67d('0xbc'),_0x2a970c[_0xa67d('0xae')]));var _0x29c181=this['channel'][_0xa67d('0x59')](_0x2a970c[_0xa67d('0xbd')],_0x2a970c[_0xa67d('0x78')]);if(_0x29c181[_0xa67d('0xa4')]===-0x1){return _0x29c181;}return this['channel'][_0xa67d('0xa8')](util[_0xa67d('0x55')](_0xa67d('0xbe'),_0x2a970c[_0xa67d('0xbd')],_0x2a970c[_0xa67d('0x78')]));};AGIVertices['prototype']['lumenvoxtts']=function(_0x2c63f3){logger[_0xa67d('0x30')](util[_0xa67d('0x55')]('Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block',_0x2c63f3[_0xa67d('0xae')]));if(!this[_0xa67d('0x86')](_0x2c63f3[_0xa67d('0x5d')])){return this['channel']['noop'](_0xa67d('0xa9'));}var _0x53d53e='\x22'+_0x2c63f3[_0xa67d('0x5d')]+'\x22';if(this[_0xa67d('0x86')](_0x2c63f3[_0xa67d('0x78')])){_0x53d53e+=','+_0x2c63f3[_0xa67d('0x78')];}var _0x21a8d4=this[_0xa67d('0xf')][_0xa67d('0x59')](_0xa67d('0xaa'),_0x53d53e);if(_0x21a8d4['result']===-0x1){return _0x21a8d4;}return this[_0xa67d('0xf')][_0xa67d('0xa8')](util[_0xa67d('0x55')](_0xa67d('0xab'),_0x53d53e));};AGIVertices[_0xa67d('0x18')][_0xa67d('0xbf')]=function(_0x4ad0cd){logger[_0xa67d('0x30')](util[_0xa67d('0x55')]('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0x4ad0cd[_0xa67d('0xae')]));if(!this[_0xa67d('0x86')](_0x4ad0cd[_0xa67d('0x5d')])){return this[_0xa67d('0xf')]['noop'](_0xa67d('0xa9'));}var _0xe03c01='\x22'+_0x4ad0cd['text']+'\x22';if(this[_0xa67d('0x86')](_0x4ad0cd[_0xa67d('0x78')])){_0xe03c01+=','+_0x4ad0cd[_0xa67d('0x78')];}var _0x274673=this['channel'][_0xa67d('0x59')](_0xa67d('0xaa'),_0xe03c01);if(_0x274673['result']===-0x1){return _0x274673;}return this['channel'][_0xa67d('0xa8')](util[_0xa67d('0x55')]('Executed\x20command\x20MRCPSynth\x20%s',_0xe03c01));};AGIVertices[_0xa67d('0x18')]['lumenvoxasr']=function(_0x35b06d){logger[_0xa67d('0x30')](util['format']('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0x35b06d[_0xa67d('0xae')]));if(!this[_0xa67d('0x86')](_0x35b06d['grammar'])){return this[_0xa67d('0xf')][_0xa67d('0xa8')](_0xa67d('0xc0'));}var _0xc4e703=_0x35b06d[_0xa67d('0xaf')];if(this[_0xa67d('0x86')](_0x35b06d[_0xa67d('0x78')])){_0xc4e703+=','+_0x35b06d[_0xa67d('0x78')];}var _0x5e56a5=this[_0xa67d('0xf')][_0xa67d('0x59')](_0xa67d('0xb0'),_0xc4e703);if(_0x5e56a5[_0xa67d('0xa4')]===-0x1){return _0x5e56a5;}var _0x31830c=this[_0xa67d('0xb1')](_0xa67d('0xb2'),'LUMENVOX_ASR_CONFIDENCE');if(_0x31830c[_0xa67d('0xa4')]===-0x1){return _0x31830c;}var _0x48b13e=this[_0xa67d('0xb1')](_0xa67d('0xc1'),_0xa67d('0xc2'));if(_0x48b13e[_0xa67d('0xa4')]===-0x1){return _0x48b13e;}var _0x386b6e=this[_0xa67d('0xb1')](_0xa67d('0xb4'),_0xa67d('0xc3'));if(_0x386b6e[_0xa67d('0xa4')]===-0x1){return _0x386b6e;}return this[_0xa67d('0xf')][_0xa67d('0xa8')](util['format'](_0xa67d('0xb5'),_0xc4e703));};AGIVertices[_0xa67d('0x18')]['sestekasr']=function(_0x1f4e0f){logger[_0xa67d('0x30')](util[_0xa67d('0x55')](_0xa67d('0xc4'),_0x1f4e0f[_0xa67d('0xae')]));if(!this[_0xa67d('0x86')](_0x1f4e0f[_0xa67d('0xaf')])){return this[_0xa67d('0xf')]['noop'](_0xa67d('0xc0'));}var _0x40c3a4=_0x1f4e0f[_0xa67d('0xaf')];if(this[_0xa67d('0x86')](_0x1f4e0f['options'])){_0x40c3a4+=','+_0x1f4e0f[_0xa67d('0x78')];}var _0x7f01e6=this[_0xa67d('0xf')][_0xa67d('0x59')]('MRCPRecog',_0x40c3a4);if(_0x7f01e6[_0xa67d('0xa4')]===-0x1){return _0x7f01e6;}var _0x22c799=this[_0xa67d('0xb1')](_0xa67d('0xb2'),_0xa67d('0xc5'));if(_0x22c799['result']===-0x1){return _0x22c799;}var _0x5c4f2c=this['getAndSetVariable'](_0xa67d('0xc1'),_0xa67d('0xc6'));if(_0x5c4f2c[_0xa67d('0xa4')]===-0x1){return _0x5c4f2c;}var _0x1339df=this['getAndSetVariable'](_0xa67d('0xb4'),_0xa67d('0xc7'));if(_0x1339df[_0xa67d('0xa4')]===-0x1){return _0x1339df;}return this[_0xa67d('0xf')][_0xa67d('0xa8')](util['format'](_0xa67d('0xb5'),_0x40c3a4));};AGIVertices['prototype'][_0xa67d('0xc8')]=function(_0x2af58b){logger['info'](util[_0xa67d('0x55')](_0xa67d('0xc9'),_0x2af58b[_0xa67d('0xae')]));if(!this[_0xa67d('0x86')](_0x2af58b[_0xa67d('0xca')])){return this[_0xa67d('0xf')][_0xa67d('0x2e')](_0x2af58b,_0xa67d('0xcb'));}var _0x1beeac=this[_0xa67d('0x19')][_0xa67d('0x72')](this,_0x2af58b[_0xa67d('0xca')]);if(!_0x1beeac){return this[_0xa67d('0xf')][_0xa67d('0x2e')](_0x2af58b,'no\x20odbc\x20database\x20found');}if(!this[_0xa67d('0x86')](_0x2af58b[_0xa67d('0x32')])){return this['channel'][_0xa67d('0x2e')](_0x2af58b,_0xa67d('0xcc'));}var _0x5a36b6=_0x2af58b[_0xa67d('0x32')][_0xa67d('0x5a')](/(\r\n|\n|\r)/gm,'\x20');this[_0xa67d('0xf')][_0xa67d('0xa8')](util[_0xa67d('0x55')](_0xa67d('0xcd'),_0x5a36b6));var _0x3bfab1=this[_0xa67d('0x2c')][_0xa67d('0x72')](this,_0x1beeac,_0x5a36b6);this[_0xa67d('0x37')][_0xa67d('0x72')](this,_0x2af58b,_0x5a36b6);if(!this[_0xa67d('0x86')](_0x2af58b[_0xa67d('0xce')])){return this[_0xa67d('0xf')][_0xa67d('0xa8')](_0xa67d('0xcf'));}var _0x57e43c=this[_0xa67d('0x12')][_0xa67d('0x72')](this,_0x2af58b[_0xa67d('0xce')]);if(!_0x57e43c){return this[_0xa67d('0xf')][_0xa67d('0x2e')](_0x2af58b,_0xa67d('0xd0'));}var _0x3975bd=this;_0x3bfab1['forEach'](function(_0x46ba20,_0x54500a){Object[_0xa67d('0xd1')](_0x46ba20)['forEach'](function(_0x26b304){_0x3975bd[_0xa67d('0xf')][_0xa67d('0xa0')](util['format'](_0xa67d('0xd2'),_0x57e43c,_0x54500a,_0x26b304),_0x46ba20[_0x26b304]);});});this[_0xa67d('0xf')][_0xa67d('0xa0')](util[_0xa67d('0x55')](_0xa67d('0xd3'),_0x57e43c),_0x3bfab1[_0xa67d('0x9d')]);return this[_0xa67d('0xf')][_0xa67d('0xa8')](util[_0xa67d('0x55')](_0xa67d('0xd4'),_0x57e43c));};AGIVertices['prototype'][_0xa67d('0xd5')]=function(_0x147196){logger[_0xa67d('0xd6')](util[_0xa67d('0x55')](_0xa67d('0xd7'),_0x147196[_0xa67d('0xae')]));if(!this['isConfigured'](_0x147196['sip_id'])){return this[_0xa67d('0xf')]['error'](_0x147196,_0xa67d('0xd8'));}var _0x2899cb=this['getUser'][_0xa67d('0x72')](this,_0x147196[_0xa67d('0xd9')]);if(!_0x2899cb){return this['channel'][_0xa67d('0x2e')](_0x147196,'no\x20user\x20found');}var _0xd7958b=this[_0xa67d('0xf')]['exec']('DIAL',[util[_0xa67d('0x55')](_0xa67d('0xda'),_0x2899cb),_0x147196['timeout'],_0x147196[_0xa67d('0xdb')],_0x147196['url']]);if(_0xd7958b[_0xa67d('0xa4')]===-0x1){return _0xd7958b;}return this[_0xa67d('0xf')][_0xa67d('0xa8')](util[_0xa67d('0x55')]('Executed\x20command\x20%s',_0xa67d('0xdc')));};AGIVertices['prototype'][_0xa67d('0xdd')]=function(_0x8ad00e){logger[_0xa67d('0x30')](util[_0xa67d('0x55')](_0xa67d('0xde'),_0x8ad00e[_0xa67d('0xae')]));if(!this[_0xa67d('0x86')](_0x8ad00e[_0xa67d('0x7a')])){return this['channel'][_0xa67d('0xa8')]('no\x20key\x20configured');}if(!this['isConfigured'](_0x8ad00e[_0xa67d('0x5d')])){return this[_0xa67d('0xf')]['noop'](_0xa67d('0xa9'));}this[_0xa67d('0xf')]['bot']=!![];this['createSquareDetailsReport'](_0x8ad00e);this[_0xa67d('0x41')](_0x8ad00e[_0xa67d('0x5d')],'in','','');this[_0xa67d('0xf')][_0xa67d('0xa8')](util[_0xa67d('0x55')]('Trying\x20Dialogflow:\x20%s',_0x8ad00e[_0xa67d('0x5d')]));var _0x52c266=this['googleDialogflow'][_0xa67d('0x72')](this,_0x8ad00e);if(_0x52c266){for(var _0x55dc94 in _0x52c266){if(_0x52c266[_0xa67d('0x97')](_0x55dc94)){this[_0xa67d('0xf')][_0xa67d('0xa0')](util['format'](_0xa67d('0xdf'),_0x55dc94[_0xa67d('0x6a')]()),_0x52c266[_0x55dc94]);}}this[_0xa67d('0x41')](_0x52c266[_0xa67d('0xe0')],_0xa67d('0xe1'),_0xa67d('0xdd'),'');return this['channel'][_0xa67d('0xa8')](util[_0xa67d('0x55')](_0xa67d('0xe2'),_0x52c266[_0xa67d('0xe0')]));}return this[_0xa67d('0xf')][_0xa67d('0x2e')](_0x8ad00e,'Dialogflow\x20is\x20unreachable');};AGIVertices[_0xa67d('0x18')]['dialogflowV2']=function(_0x23df5a){logger['info'](util['format'](_0xa67d('0xe3'),_0x23df5a[_0xa67d('0xae')]));if(!this[_0xa67d('0x86')](_0x23df5a[_0xa67d('0x7d')])){return this[_0xa67d('0xf')]['noop'](_0xa67d('0xe4'));}if(!this[_0xa67d('0x86')](_0x23df5a['client_email'])){return this[_0xa67d('0xf')]['noop'](_0xa67d('0xe5'));}if(!this[_0xa67d('0x86')](_0x23df5a[_0xa67d('0x7f')])){return this[_0xa67d('0xf')][_0xa67d('0xa8')](_0xa67d('0xe6'));}if(!this[_0xa67d('0x86')](_0x23df5a['dialogflowV2_language'])){return this[_0xa67d('0xf')][_0xa67d('0xa8')]('no\x20anguage\x20configured');}if(!this['isConfigured'](_0x23df5a['text'])){return this[_0xa67d('0xf')]['noop'](_0xa67d('0xa9'));}this[_0xa67d('0xf')]['bot']=!![];this[_0xa67d('0x37')](_0x23df5a);this[_0xa67d('0x41')](_0x23df5a['text'],'in','','');this[_0xa67d('0xf')][_0xa67d('0xa8')](util[_0xa67d('0x55')](_0xa67d('0xe7'),_0x23df5a[_0xa67d('0x5d')]));var _0x501572=this[_0xa67d('0x7c')][_0xa67d('0x72')](this,_0x23df5a);if(_0x501572){for(var _0x362ad8 in _0x501572){if(_0x501572[_0xa67d('0x97')](_0x362ad8)){if(_0x362ad8!==_0xa67d('0xe8')){this[_0xa67d('0xf')][_0xa67d('0xa0')](util['format']('DIALOGFLOW_%s',_0x362ad8['toUpperCase']()),_0x501572[_0x362ad8]);}}}this[_0xa67d('0x41')](_0x501572['speech'],'out',_0xa67d('0xe9'),_0x501572[_0xa67d('0xe8')]);return this[_0xa67d('0xf')][_0xa67d('0xa8')](util[_0xa67d('0x55')]('DialogflowV2\x20Result\x20%s',_0x501572[_0xa67d('0xe0')]));}return this[_0xa67d('0xf')][_0xa67d('0x2e')](_0x23df5a,_0xa67d('0xea'));};AGIVertices[_0xa67d('0x18')][_0xa67d('0xeb')]=function(_0xda8e9d){logger[_0xa67d('0x30')](util['format']('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0xda8e9d[_0xa67d('0xae')]));if(!this['isConfigured'](_0xda8e9d['ndauth_url'])){return this[_0xa67d('0xf')][_0xa67d('0xa8')](_0xa67d('0xec'));}if(!this[_0xa67d('0x86')](_0xda8e9d[_0xa67d('0xed')])){return this['channel'][_0xa67d('0xa8')]('no\x20username\x20configured');}if(!this[_0xa67d('0x86')](_0xda8e9d[_0xa67d('0xee')])){return this[_0xa67d('0xf')]['noop']('no\x20password\x20configured');}if(!this[_0xa67d('0x86')](_0xda8e9d[_0xa67d('0xef')])){return this['channel']['noop'](_0xa67d('0xa9'));}this[_0xa67d('0xf')][_0xa67d('0xf0')]=!![];this[_0xa67d('0x37')](_0xda8e9d);this[_0xa67d('0x41')](_0xda8e9d[_0xa67d('0x5d')],'in','','');this['channel'][_0xa67d('0xa8')](util[_0xa67d('0x55')](_0xa67d('0xf1'),_0xda8e9d[_0xa67d('0x5d')]));var _0x1a240a=this[_0xa67d('0x81')][_0xa67d('0x72')](this,_0xda8e9d);if(_0x1a240a){for(var _0x43ef9d in _0x1a240a){if(_0x1a240a[_0xa67d('0x97')](_0x43ef9d)){this[_0xa67d('0xf')]['setVariable'](util[_0xa67d('0x55')]('SESTEK_NDA_%s',_0x43ef9d[_0xa67d('0x6a')]()),_0x1a240a[_0x43ef9d]);}}this['createSquareMessage'](_0x1a240a[_0xa67d('0xe0')],_0xa67d('0xe1'),'sesteknda','');if(_0x1a240a[_0xa67d('0xf2')]){this[_0xa67d('0xf')][_0xa67d('0xa8')](util[_0xa67d('0x55')](_0xa67d('0xf3'),_0x1a240a[_0xa67d('0xf2')]));var _0x138d9e=this['channel']['streamFile'](_0x1a240a[_0xa67d('0xf2')]);try{fs['unlink'](_0x1a240a['audiofile']+_0xa67d('0xf4'));}catch(_0x1a4777){logger[_0xa67d('0x2e')](_0x1a4777);}return _0x138d9e;}else{return this['channel'][_0xa67d('0xa8')](util[_0xa67d('0x55')](_0xa67d('0xf5'),_0x1a240a[_0xa67d('0xe0')]));}}return this[_0xa67d('0xf')][_0xa67d('0x2e')](_0xda8e9d,_0xa67d('0xf6'));};AGIVertices[_0xa67d('0x18')]['end']=function(_0x38fa89){logger[_0xa67d('0x30')](util[_0xa67d('0x55')](_0xa67d('0xf7'),_0x38fa89[_0xa67d('0xae')]));return this[_0xa67d('0xf')]['noop']('end');};AGIVertices[_0xa67d('0x18')][_0xa67d('0xf8')]=function(_0x5539dc){logger[_0xa67d('0x30')](util[_0xa67d('0x55')](_0xa67d('0xf9'),_0x5539dc['label']));var _0x263b33='';if(_0x5539dc[_0xa67d('0xfa')]){if(!this[_0xa67d('0x86')](_0x5539dc[_0xa67d('0xfa')])){return this[_0xa67d('0xf')][_0xa67d('0x2e')](_0x5539dc,'no\x20trunk\x20selected');}else{var _0x2cbc3a=parseInt(_0x5539dc['trunk_id'],0xa);if(isNaN(_0x2cbc3a)){_0x263b33=_0x5539dc['trunk_id'];}else{_0x263b33=this[_0xa67d('0x1d')][_0xa67d('0x72')](this,_0x5539dc['trunk_id']);if(!_0x263b33){return this[_0xa67d('0xf')][_0xa67d('0x2e')](_0x5539dc,_0xa67d('0xfb'));}}}}else if(_0x5539dc[_0xa67d('0xfc')]){_0x263b33=_0x5539dc['trunk_name'];}else{return this[_0xa67d('0xf')][_0xa67d('0x2e')](_0x5539dc,_0xa67d('0xfd'));}var _0x5b416f=this[_0xa67d('0xf')]['exec'](_0xa67d('0xdc'),[util[_0xa67d('0x55')](_0xa67d('0xfe'),_0x263b33,_0x5539dc[_0xa67d('0x47')]),_0x5539dc[_0xa67d('0x66')],_0x5539dc[_0xa67d('0xdb')],_0x5539dc[_0xa67d('0x63')]]);if(_0x5b416f[_0xa67d('0xa4')]===-0x1){return _0x5b416f;}return this[_0xa67d('0xf')][_0xa67d('0xa8')](util[_0xa67d('0x55')](_0xa67d('0xff'),_0xa67d('0xdc')));};AGIVertices[_0xa67d('0x18')][_0xa67d('0x100')]=function(_0x1748d4){logger['info'](util['format']('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x1748d4[_0xa67d('0xae')]));return this[_0xa67d('0xf')][_0xa67d('0xa8')](_0xa67d('0x100'));};AGIVertices[_0xa67d('0x18')]['getdigits']=function(_0x33718c){logger[_0xa67d('0x30')](util['format'](_0xa67d('0x101'),_0x33718c[_0xa67d('0xae')]));if(_0x33718c[_0xa67d('0xa6')]===0x0){return this[_0xa67d('0xa5')](_0x33718c);}_0x33718c[_0xa67d('0xa6')]-=0x1;if(!this[_0xa67d('0x86')](_0x33718c[_0xa67d('0x102')])){return this['channel']['error'](_0x33718c,_0xa67d('0x103'));}var _0x53dcb3=this[_0xa67d('0x104')][_0xa67d('0x72')](this,_0x33718c[_0xa67d('0x102')]);if(!_0x53dcb3){return this[_0xa67d('0xf')][_0xa67d('0x2e')](_0x33718c,_0xa67d('0x105'));}if(!this[_0xa67d('0x86')](_0x33718c[_0xa67d('0xce')])){return this[_0xa67d('0xf')][_0xa67d('0x2e')](_0xa67d('0xcf'));}var _0x36ed18=this[_0xa67d('0xf')][_0xa67d('0x106')](_0x53dcb3,_0x33718c['response'],_0x33718c[_0xa67d('0x107')]);var _0x165d8d=_0x36ed18[_0xa67d('0xa4')]?_0x36ed18[_0xa67d('0xa4')][_0xa67d('0x4b')]():'';logger[_0xa67d('0x30')](_0xa67d('0x108'),JSON[_0xa67d('0x74')](_0x36ed18));if(_0x36ed18['result']===-0x1){this[_0xa67d('0x37')][_0xa67d('0x72')](this,_0x33718c,_0x165d8d);return _0x36ed18;}else if(_0x36ed18['extra']==='timeout'){_0x36ed18[_0xa67d('0xa4')]=_0x165d8d[_0xa67d('0x9d')]>=parseInt(_0x33718c[_0xa67d('0x109')])?'x':'i';}else{_0x36ed18['result']=_0x165d8d['length']>=parseInt(_0x33718c['mindigit'])&&_0x165d8d[_0xa67d('0x9d')]<=parseInt(_0x33718c[_0xa67d('0x107')])?'x':'i';}var _0x510987=this['getVariable'][_0xa67d('0x72')](this,_0x33718c[_0xa67d('0xce')]);if(!_0x510987){return this['channel'][_0xa67d('0x2e')](_0x33718c,_0xa67d('0xd0'));}this[_0xa67d('0xf')]['setVariable'](_0x510987,_0x165d8d);if(this['isConfigured'](_0x33718c[_0xa67d('0x10a')])){var _0x3be0ea=parseInt(_0x33718c[_0xa67d('0x10a')],0xa);var _0x17e4b=rs['generate']({'charset':'*','length':_0x3be0ea});var _0x1e03d1=_0x165d8d[_0xa67d('0x9d')];if(_0x1e03d1>0x0){if(_0x1e03d1>_0x3be0ea){this[_0xa67d('0x37')][_0xa67d('0x72')](this,_0x33718c,_0x33718c['hiddendigitspos']===_0xa67d('0x10b')?_0x17e4b+_0x165d8d[_0xa67d('0x10c')](_0x3be0ea):_0x165d8d[_0xa67d('0x10c')](0x0,_0x1e03d1-_0x3be0ea)+_0x17e4b);}else{this['createSquareDetailsReport'][_0xa67d('0x72')](this,_0x33718c,rs['generate']({'charset':'*','length':_0x1e03d1}));}}else{this[_0xa67d('0x37')][_0xa67d('0x72')](this,_0x33718c,'');}}else{this['createSquareDetailsReport']['sync'](this,_0x33718c,_0x165d8d);}return _0x36ed18;};AGIVertices['prototype'][_0xa67d('0xe')]=function(_0x5d0372){logger[_0xa67d('0x30')](util[_0xa67d('0x55')]('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x5d0372[_0xa67d('0xae')]));return this[_0xa67d('0xd')](_0x5d0372);};AGIVertices[_0xa67d('0x18')][_0xa67d('0x10d')]=function(_0x225215){logger[_0xa67d('0x30')](util[_0xa67d('0x55')](_0xa67d('0x10e'),_0x225215[_0xa67d('0xae')]));this[_0xa67d('0x37')][_0xa67d('0x72')](this,_0x225215,_0x225215[_0xa67d('0x10f')]);return this['channel'][_0xa67d('0xa8')](util[_0xa67d('0x55')](_0xa67d('0x110'),_0x225215[_0xa67d('0x10f')]));};AGIVertices[_0xa67d('0x18')][_0xa67d('0x111')]=function(_0x42c7c0){logger[_0xa67d('0x30')](util[_0xa67d('0x55')](_0xa67d('0x112'),_0x42c7c0['label']));if(!this[_0xa67d('0x86')](_0x42c7c0['aws_access_key_id'])||!this['isConfigured'](_0x42c7c0[_0xa67d('0x89')])){return this[_0xa67d('0xf')][_0xa67d('0xa8')](_0xa67d('0x113'));}if(!this[_0xa67d('0x86')](_0x42c7c0[_0xa67d('0x5d')])){return this[_0xa67d('0xf')]['noop'](_0xa67d('0xa9'));}this[_0xa67d('0xf')][_0xa67d('0xa8')](util['format']('Trying\x20aws\x20Polly\x20%s',_0x42c7c0[_0xa67d('0x5d')]));var _0x2c7142=this[_0xa67d('0x88')]['sync'](this,_0x42c7c0);if(_0x2c7142){this['channel'][_0xa67d('0xa8')](util[_0xa67d('0x55')]('aws\x20Polly\x20%s\x20file\x20created',_0x2c7142));var _0x337cf7=this[_0xa67d('0xf')]['streamFile'](_0x2c7142);try{fs[_0xa67d('0x114')](_0x2c7142+'.wav');}catch(_0x13988c){logger[_0xa67d('0x2e')](_0x13988c);}return _0x337cf7;}return this[_0xa67d('0xf')][_0xa67d('0x2e')](_0x42c7c0,_0xa67d('0x115'));};AGIVertices[_0xa67d('0x18')][_0xa67d('0x116')]=function(_0x500f0b){logger[_0xa67d('0x30')](util[_0xa67d('0x55')](_0xa67d('0x117'),_0x500f0b[_0xa67d('0xae')]));if(!this[_0xa67d('0x86')](_0x500f0b[_0xa67d('0x8e')])||!this[_0xa67d('0x86')](_0x500f0b[_0xa67d('0x89')])){return this['channel'][_0xa67d('0xa8')](_0xa67d('0x113'));}if(!this['isConfigured'](_0x500f0b[_0xa67d('0x90')])){return this[_0xa67d('0xf')][_0xa67d('0xa8')]('no\x20bot\x20name\x20configured');}if(!this['isConfigured'](_0x500f0b[_0xa67d('0x5d')])){return this[_0xa67d('0xf')][_0xa67d('0xa8')](_0xa67d('0xa9'));}this[_0xa67d('0xf')]['bot']=!![];this[_0xa67d('0x37')](_0x500f0b);this[_0xa67d('0x41')](_0x500f0b['text'],'in','','');this[_0xa67d('0xf')][_0xa67d('0xa8')](util[_0xa67d('0x55')](_0xa67d('0x118'),_0x500f0b[_0xa67d('0x5d')]));var _0x16812e=this['awsLex'][_0xa67d('0x72')](this,_0x500f0b);if(_0x16812e){for(var _0x29c37d in _0x16812e){if(_0x16812e['hasOwnProperty'](_0x29c37d)&&_[_0xa67d('0x98')](_0x16812e[_0x29c37d])){this[_0xa67d('0xf')][_0xa67d('0xa0')](util[_0xa67d('0x55')]('AWS_LEX_%s',_0x29c37d[_0xa67d('0x6a')]()),_0x16812e[_0x29c37d]);}}if(_['isNil'](_0x16812e['message'])){return this[_0xa67d('0xf')][_0xa67d('0xa8')](_0xa67d('0x119'));}else{this[_0xa67d('0x41')](_0x16812e['message'],'out',_0xa67d('0x11a'),'');return this[_0xa67d('0xf')][_0xa67d('0xa8')](util['format'](_0xa67d('0x11b'),_0x16812e[_0xa67d('0x11c')]));}}return this[_0xa67d('0xf')][_0xa67d('0x2e')](_0x500f0b,_0xa67d('0x11d'));};AGIVertices[_0xa67d('0x18')][_0xa67d('0x11e')]=function(_0x41172c){logger[_0xa67d('0x30')](util[_0xa67d('0x55')]('Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s',_0x41172c[_0xa67d('0xae')],_0x41172c[_0xa67d('0x66')]));if(!this[_0xa67d('0x86')](_0x41172c[_0xa67d('0x7a')])){return this['channel'][_0xa67d('0xa8')](_0xa67d('0x11f'));}var _0x6820=_0xa67d('0x120');var _0x1d2d55=util['format'](_0xa67d('0x121'),FILES_PATH,rs[_0xa67d('0x122')](0x4));var _0x4b8e2a=util[_0xa67d('0x55')](_0xa67d('0x9f'),_0x1d2d55,_0x6820);var _0x40575c=!![];if(_0x41172c[_0xa67d('0x123')]===_0xa67d('0x124')){_0x40575c=![];}var _0x2cf23a=this[_0xa67d('0xf')]['recordFile'](_0x1d2d55,_0x6820,_0x41172c['intKey'],_0x41172c[_0xa67d('0x66')],undefined,_0x40575c);if(_0x2cf23a[_0xa67d('0xa4')]!==-0x1){this['channel'][_0xa67d('0xa8')](util[_0xa67d('0x55')](_0xa67d('0x125'),_0x4b8e2a));var _0x3dbfda=this[_0xa67d('0x91')][_0xa67d('0x72')](this,_0x41172c,_0x4b8e2a);if(_0x3dbfda){for(var _0x3ce8a1 in _0x3dbfda){if(_0x3dbfda[_0xa67d('0x97')](_0x3ce8a1)){this[_0xa67d('0xf')][_0xa67d('0xa0')](util[_0xa67d('0x55')]('GOOGLE_ASR_%s',_0x3ce8a1[_0xa67d('0x6a')]()),_0x3dbfda[_0x3ce8a1]);}}return this[_0xa67d('0xf')][_0xa67d('0xa8')](util[_0xa67d('0x55')]('GoogleASR\x20Result\x20%s',JSON['stringify'](_0x3dbfda)));}}return _0x2cf23a;};AGIVertices[_0xa67d('0x18')][_0xa67d('0x126')]=function(_0x19da4b){logger['info'](util['format'](_0xa67d('0x127'),_0x19da4b['label']));if(!this[_0xa67d('0x86')](_0x19da4b['appid'])){return this[_0xa67d('0xf')][_0xa67d('0xa8')]('no\x20appid\x20configured');}if(!this[_0xa67d('0x86')](_0x19da4b[_0xa67d('0x128')])){return this[_0xa67d('0xf')][_0xa67d('0xa8')](_0xa67d('0x129'));}var _0x1b631c=_0xa67d('0x120');var _0x2f1a1a=util[_0xa67d('0x55')]('%s/recordings/%s',FILES_PATH,rs[_0xa67d('0x122')](0x4));var _0x3d0300=util[_0xa67d('0x55')](_0xa67d('0x9f'),_0x2f1a1a,_0x1b631c);var _0x443c35=!![];if(_0x19da4b[_0xa67d('0x123')]===_0xa67d('0x124')){_0x443c35=![];}var _0x5076f0=this[_0xa67d('0xf')]['recordFile'](_0x2f1a1a,_0x1b631c,_0x19da4b[_0xa67d('0x12a')],_0x19da4b[_0xa67d('0x66')],undefined,_0x443c35);if(_0x5076f0['result']!==-0x1){this['channel'][_0xa67d('0xa8')](util[_0xa67d('0x55')]('tilde\x20%s\x20file\x20created',_0x3d0300));var _0x403e32=this['tildeASR']['sync'](this,_0x19da4b,_0x3d0300);if(_0x403e32){for(var _0x4e4a3a in _0x403e32){if(_0x403e32[_0xa67d('0x97')](_0x4e4a3a)){this[_0xa67d('0xf')][_0xa67d('0xa0')](util['format'](_0xa67d('0x12b'),_0x4e4a3a[_0xa67d('0x6a')]()),_0x403e32[_0x4e4a3a]);}}return this['channel'][_0xa67d('0xa8')](util['format']('TildeASR\x20Result\x20%s',JSON[_0xa67d('0x74')](_0x403e32)));}}return _0x5076f0;};AGIVertices[_0xa67d('0x18')][_0xa67d('0x12c')]=function(_0x4e3e46){logger[_0xa67d('0x30')](util[_0xa67d('0x55')](_0xa67d('0x12d'),_0x4e3e46[_0xa67d('0xae')]));return this[_0xa67d('0xf')]['continueAt'](_0x4e3e46[_0xa67d('0x12e')],_0x4e3e46['extension'],_0x4e3e46['priority']);};AGIVertices[_0xa67d('0x18')][_0xa67d('0x12f')]=function(_0x3ae555){logger[_0xa67d('0x30')](util[_0xa67d('0x55')]('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0x3ae555[_0xa67d('0xae')]));if(!this[_0xa67d('0x86')](_0x3ae555['condition'])){return this['channel']['error'](_0x3ae555,_0xa67d('0x130'));}try{var _0x3011d1=eval(_0x3ae555[_0xa67d('0x131')])?_0xa67d('0x132'):_0xa67d('0x133');this['channel']['noop'](util['format'](_0xa67d('0x134'),_0x3ae555[_0xa67d('0x131')],_0x3011d1));return{'code':0xc8,'result':_0x3011d1};}catch(_0x44ebea){return{'code':0xc8,'result':_0xa67d('0x133')};}};AGIVertices[_0xa67d('0x18')]['gotoiftime']=function(_0x4f26cd){logger[_0xa67d('0x30')](util['format'](_0xa67d('0x135'),_0x4f26cd[_0xa67d('0xae')]));if(!this[_0xa67d('0x86')](_0x4f26cd[_0xa67d('0x136')])){return this[_0xa67d('0xf')]['error'](_0x4f26cd,_0xa67d('0x137'));}var _0x46c467=this[_0xa67d('0x25')]['sync'](this,_0x4f26cd[_0xa67d('0x136')]);if(!_0x46c467){return this[_0xa67d('0xf')]['error'](_0x4f26cd,_0xa67d('0x138'));}for(var _0x204e15=0x0;_0x204e15<_0x46c467[_0xa67d('0x9d')];_0x204e15+=0x1){var _0x50d5f8=this[_0xa67d('0xf')][_0xa67d('0x12')](util[_0xa67d('0x55')]('IFTIME(%s?true:false)',_0x46c467[_0x204e15]));if(_0x50d5f8[_0xa67d('0xa4')]===-0x1){return _0x50d5f8;}logger[_0xa67d('0x30')](util[_0xa67d('0x55')](_0xa67d('0x139'),_0x46c467[_0x204e15],_0x50d5f8[_0xa67d('0xa3')]));if(_0x50d5f8[_0xa67d('0xa3')]===_0xa67d('0x132')){logger[_0xa67d('0x30')](util[_0xa67d('0x55')](_0xa67d('0x139'),_0x46c467[_0x204e15],_0xa67d('0x132')));this[_0xa67d('0xf')][_0xa67d('0xa8')](util['format'](_0xa67d('0x139'),_0x46c467[_0x204e15],_0xa67d('0x132')));return{'code':0xc8,'result':'true'};}else{logger[_0xa67d('0x30')](util[_0xa67d('0x55')]('IFTIME\x20%s\x20%s',_0x46c467[_0x204e15],_0xa67d('0x133')));this[_0xa67d('0xf')][_0xa67d('0xa8')](util[_0xa67d('0x55')]('IFTIME\x20%s\x20%s',_0x46c467[_0x204e15],_0xa67d('0x133')));}}return{'code':0xc8,'result':_0xa67d('0x133')};};AGIVertices['prototype']['hangup']=function(_0x43e92b){logger['info'](util['format'](_0xa67d('0x13a'),_0x43e92b[_0xa67d('0xae')]));return this['channel']['hangup']();};AGIVertices['prototype'][_0xa67d('0x13b')]=function(_0x62b5c1){logger[_0xa67d('0x30')](util[_0xa67d('0x55')](_0xa67d('0x13c'),_0x62b5c1[_0xa67d('0xae')]));if(!this[_0xa67d('0x86')](_0x62b5c1[_0xa67d('0x7a')])){return this[_0xa67d('0xf')]['noop'](_0xa67d('0x11f'));}var _0x5bf004=_0xa67d('0x120');var _0x5ea2fd=util[_0xa67d('0x55')](_0xa67d('0x121'),FILES_PATH,rs[_0xa67d('0x122')](0x4));var _0x4ee367=util['format'](_0xa67d('0x9f'),_0x5ea2fd,_0x5bf004);var _0x2e3b51=!![];if(_0x62b5c1['beep']===_0xa67d('0x124')){_0x2e3b51=![];}var _0xde8c6e=this[_0xa67d('0xf')][_0xa67d('0x13d')](_0x5ea2fd,_0x5bf004,_0x62b5c1[_0xa67d('0x12a')],_0x62b5c1[_0xa67d('0x66')],undefined,_0x2e3b51);if(_0xde8c6e['result']!==-0x1){this[_0xa67d('0xf')]['noop'](util[_0xa67d('0x55')](_0xa67d('0x13e'),_0x4ee367));var _0x1da847=this[_0xa67d('0x84')][_0xa67d('0x72')](this,_0x62b5c1,_0x4ee367);if(_0x1da847){for(var _0x4c33a6 in _0x1da847){if(_0x1da847[_0xa67d('0x97')](_0x4c33a6)){this[_0xa67d('0xf')][_0xa67d('0xa0')](util[_0xa67d('0x55')]('ISPEECH_ASR_%s',_0x4c33a6['toUpperCase']()),_0x1da847[_0x4c33a6]);}}return this[_0xa67d('0xf')][_0xa67d('0xa8')](util['format']('IspeechASR\x20Result\x20%s',JSON['stringify'](_0x1da847)));}}return _0xde8c6e;};AGIVertices['prototype'][_0xa67d('0x13f')]=function(_0x587a6a){logger['info'](util['format'](_0xa67d('0x140'),_0x587a6a['label']));if(!this[_0xa67d('0x86')](_0x587a6a[_0xa67d('0x7a')])){return this[_0xa67d('0xf')][_0xa67d('0xa8')]('no\x20key\x20configured');}if(!this[_0xa67d('0x86')](_0x587a6a[_0xa67d('0x5d')])){return this[_0xa67d('0xf')][_0xa67d('0xa8')](_0xa67d('0xa9'));}this[_0xa67d('0xf')]['noop'](util['format'](_0xa67d('0x141'),_0x587a6a[_0xa67d('0x5d')]));var _0x4439cb=this[_0xa67d('0x82')][_0xa67d('0x72')](this,_0x587a6a);if(_0x4439cb){this[_0xa67d('0xf')][_0xa67d('0xa8')](util[_0xa67d('0x55')](_0xa67d('0x13e'),_0x4439cb));var _0x2eedf8=this[_0xa67d('0xf')][_0xa67d('0x142')](_0x4439cb,_0x587a6a[_0xa67d('0x12a')]);try{fs[_0xa67d('0x114')](_0x4439cb+_0xa67d('0xf4'));}catch(_0x3db40f){logger[_0xa67d('0x2e')](_0x3db40f);}return _0x2eedf8;}return this[_0xa67d('0xf')]['error'](_0x587a6a,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices[_0xa67d('0x18')][_0xa67d('0x143')]=function(_0x5b9ba4){logger[_0xa67d('0x30')](util['format'](_0xa67d('0x144'),_0x5b9ba4[_0xa67d('0xae')]));if(!this[_0xa67d('0x86')](_0x5b9ba4[_0xa67d('0x145')])){return this[_0xa67d('0xf')][_0xa67d('0x2e')](_0x5b9ba4,'no\x20find\x20by\x20configured');}logger['info'](util[_0xa67d('0x55')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xa67d('0xf')][_0xa67d('0x3b')],_0x5b9ba4[_0xa67d('0x145')]));var _0x1013e8=this[_0xa67d('0x53')][_0xa67d('0x72')](this,_0x5b9ba4['findBy']);if(_0x1013e8){logger[_0xa67d('0x30')](util[_0xa67d('0x55')](_0xa67d('0x146'),this[_0xa67d('0xf')][_0xa67d('0x3b')],_0x5b9ba4[_0xa67d('0x145')]));this[_0xa67d('0xf')][_0xa67d('0xa8')](util[_0xa67d('0x55')](_0xa67d('0x146'),this[_0xa67d('0xf')]['callerid'],_0x5b9ba4[_0xa67d('0x145')]));return{'code':0xc8,'result':_0xa67d('0x147')};}else{logger['info'](util[_0xa67d('0x55')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xa67d('0xf')][_0xa67d('0x3b')],_0x5b9ba4[_0xa67d('0x145')]));this['channel']['noop'](util['format'](_0xa67d('0x148'),this[_0xa67d('0xf')][_0xa67d('0x3b')],_0x5b9ba4['findBy']));return{'code':0xc8,'result':_0xa67d('0x149')};}};AGIVertices['prototype']['logout']=function(_0x561aaa){logger[_0xa67d('0x30')](util[_0xa67d('0x55')]('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0x561aaa[_0xa67d('0xae')]));if(!this[_0xa67d('0x86')](_0x561aaa[_0xa67d('0x145')])){return this['channel'][_0xa67d('0x2e')](_0x561aaa,'no\x20find\x20by\x20configured');}logger[_0xa67d('0x30')](util[_0xa67d('0x55')](_0xa67d('0x14a'),this[_0xa67d('0xf')][_0xa67d('0x3b')],_0x561aaa[_0xa67d('0x145')]));var _0xfcdffc=this[_0xa67d('0x52')]['sync'](this,_0x561aaa[_0xa67d('0x145')]);if(_0xfcdffc){logger[_0xa67d('0x30')](util[_0xa67d('0x55')](_0xa67d('0x146'),this['channel']['callerid'],_0x561aaa[_0xa67d('0x145')]));this['channel'][_0xa67d('0xa8')](util[_0xa67d('0x55')](_0xa67d('0x146'),this[_0xa67d('0xf')][_0xa67d('0x3b')],_0x561aaa[_0xa67d('0x145')]));return{'code':0xc8,'result':_0xa67d('0x147')};}else{logger[_0xa67d('0x30')](util[_0xa67d('0x55')](_0xa67d('0x148'),this[_0xa67d('0xf')][_0xa67d('0x3b')],_0x561aaa[_0xa67d('0x145')]));this[_0xa67d('0xf')]['noop'](util[_0xa67d('0x55')](_0xa67d('0x148'),this[_0xa67d('0xf')][_0xa67d('0x3b')],_0x561aaa[_0xa67d('0x145')]));return{'code':0xc8,'result':_0xa67d('0x149')};}};AGIVertices[_0xa67d('0x18')][_0xa67d('0x14b')]=function(_0x147974){logger[_0xa67d('0x30')](util[_0xa67d('0x55')](_0xa67d('0x14c'),_0x147974[_0xa67d('0xae')]));if(!this[_0xa67d('0x86')](_0x147974[_0xa67d('0x14d')])){return this[_0xa67d('0xf')]['error'](_0x147974,_0xa67d('0x14e'));}this['channel']['noop'](util[_0xa67d('0x55')]('math\x20%s',_0x147974[_0xa67d('0x14d')]));var _0x5e7e10=eval(_0x147974[_0xa67d('0x14d')]);if(!this[_0xa67d('0x86')](_0x147974[_0xa67d('0xce')])){return this['channel'][_0xa67d('0xa8')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x4c67a0=this[_0xa67d('0x12')][_0xa67d('0x72')](this,_0x147974[_0xa67d('0xce')]);if(!_0x4c67a0){return this[_0xa67d('0xf')][_0xa67d('0x2e')](_0x147974,_0xa67d('0xd0'));}if(_[_0xa67d('0x9c')](_0x5e7e10)){var _0x3a9bd2=this;_0x5e7e10[_0xa67d('0x14f')](function(_0x40456e,_0x4e9b27){_0x3a9bd2['channel'][_0xa67d('0xa0')](util['format']('%s[%s]',_0x4c67a0,_0x4e9b27),_0x40456e);});return this[_0xa67d('0xf')][_0xa67d('0xa8')](util[_0xa67d('0x55')](_0xa67d('0x150'),_0x4c67a0));}else{return this[_0xa67d('0xf')][_0xa67d('0xa0')](_0x4c67a0,_0x5e7e10);}};AGIVertices[_0xa67d('0x18')][_0xa67d('0xc')]=function(_0x5d64a8){logger[_0xa67d('0x30')](util[_0xa67d('0x55')]('Enter\x20in\x20MENU\x20(%s)\x20block',_0x5d64a8[_0xa67d('0xae')]));if(_0x5d64a8['retry']===0x0){return this['maxRetry'](_0x5d64a8);}_0x5d64a8[_0xa67d('0xa6')]-=0x1;if(!this[_0xa67d('0x86')](_0x5d64a8[_0xa67d('0x102')])){return this[_0xa67d('0xf')]['error'](_0x5d64a8,_0xa67d('0x103'));}var _0x22074b=this['getSound'][_0xa67d('0x72')](this,_0x5d64a8['file_id']);if(!_0x22074b){return this['channel']['error'](_0x5d64a8,_0xa67d('0x105'));}var _0x166c01=this[_0xa67d('0xf')]['getData'](_0x22074b,_0x5d64a8[_0xa67d('0x151')],_0x5d64a8['digit']);var _0x3ae2af=_0x166c01[_0xa67d('0xa4')];if(_0x166c01[_0xa67d('0xa4')]===-0x1){this[_0xa67d('0x37')]['sync'](this,_0x5d64a8,'-1');return _0x166c01;}else if(_0x166c01[_0xa67d('0xa3')]===_0xa67d('0x66')){_0x166c01[_0xa67d('0xa4')]=_0x166c01[_0xa67d('0xa4')][_0xa67d('0x9d')]>0x0?_0x166c01[_0xa67d('0xa4')]:'t';}else if(_[_0xa67d('0x43')](_0x166c01[_0xa67d('0xa4')])){_0x166c01[_0xa67d('0xa4')]='#';_0x3ae2af='#';}if(!this[_0xa67d('0x86')](_0x5d64a8[_0xa67d('0xce')])){this[_0xa67d('0xf')][_0xa67d('0xa8')]('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x130f9a=this[_0xa67d('0x12')][_0xa67d('0x72')](this,_0x5d64a8[_0xa67d('0xce')]);if(!_0x130f9a){return this[_0xa67d('0xf')][_0xa67d('0x2e')](_0x5d64a8,_0xa67d('0xd0'));}this[_0xa67d('0xf')]['setVariable'](_0x130f9a,_0x3ae2af);}this[_0xa67d('0x37')][_0xa67d('0x72')](this,_0x5d64a8,_0x3ae2af);return _0x166c01;};AGIVertices[_0xa67d('0x18')][_0xa67d('0xa8')]=function(_0x48e85e){logger[_0xa67d('0x30')](util[_0xa67d('0x55')](_0xa67d('0x152'),_0x48e85e[_0xa67d('0xae')]));return this[_0xa67d('0xf')][_0xa67d('0xa8')](_0x48e85e[_0xa67d('0x153')]||_0x48e85e[_0xa67d('0xae')]);};AGIVertices['prototype'][_0xa67d('0x154')]=function(_0x186de5){logger[_0xa67d('0x30')](util[_0xa67d('0x55')](_0xa67d('0x155'),_0x186de5[_0xa67d('0xae')]));if(!this['isConfigured'](_0x186de5['findBy'])){return this[_0xa67d('0xf')]['error'](_0x186de5,'no\x20find\x20by\x20configured');}logger[_0xa67d('0x30')](util[_0xa67d('0x55')](_0xa67d('0x14a'),this[_0xa67d('0xf')]['callerid'],_0x186de5[_0xa67d('0x145')]));var _0x48ad65=this[_0xa67d('0x4d')][_0xa67d('0x72')](this,_0x186de5[_0xa67d('0x156')]);var _0x1435c7=this[_0xa67d('0x4f')][_0xa67d('0x72')](this,_0x186de5[_0xa67d('0x145')],_0x48ad65);if(_0x1435c7){logger[_0xa67d('0x30')](util[_0xa67d('0x55')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xa67d('0xf')][_0xa67d('0x3b')],_0x186de5[_0xa67d('0x145')]));this['channel'][_0xa67d('0xa8')](util[_0xa67d('0x55')](_0xa67d('0x146'),this[_0xa67d('0xf')]['callerid'],_0x186de5[_0xa67d('0x145')]));return{'code':0xc8,'result':'success'};}else{logger[_0xa67d('0x30')](util[_0xa67d('0x55')](_0xa67d('0x148'),this[_0xa67d('0xf')][_0xa67d('0x3b')],_0x186de5[_0xa67d('0x145')]));this['channel'][_0xa67d('0xa8')](util[_0xa67d('0x55')](_0xa67d('0x146'),this[_0xa67d('0xf')][_0xa67d('0x3b')],_0x186de5[_0xa67d('0x145')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0xa67d('0x18')][_0xa67d('0x157')]=function(_0x30316b){logger['info'](util[_0xa67d('0x55')]('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0x30316b[_0xa67d('0xae')]));if(!this['isConfigured'](_0x30316b[_0xa67d('0x102')])){return this[_0xa67d('0xf')][_0xa67d('0x2e')](_0x30316b,_0xa67d('0x103'));}var _0x310d58=this[_0xa67d('0x104')][_0xa67d('0x72')](this,_0x30316b[_0xa67d('0x102')]);if(!_0x310d58){return this['channel'][_0xa67d('0x2e')](_0x30316b,_0xa67d('0x105'));}var _0x113879=this[_0xa67d('0xf')][_0xa67d('0x59')](_0xa67d('0x158'),[_0x310d58,_0x30316b[_0xa67d('0xdb')]]);if(_0x113879[_0xa67d('0xa4')]===-0x1){return _0x113879;}return this[_0xa67d('0xf')][_0xa67d('0xa8')](util[_0xa67d('0x55')](_0xa67d('0xbe'),_0xa67d('0x158'),_0x310d58));};AGIVertices[_0xa67d('0x18')][_0xa67d('0x159')]=function(_0x41216a){logger[_0xa67d('0x30')](util['format'](_0xa67d('0x15a'),_0x41216a[_0xa67d('0xae')]));if(!this[_0xa67d('0x86')](_0x41216a['queue_id'])){return this[_0xa67d('0xf')][_0xa67d('0x2e')](_0x41216a,'no\x20queue\x20selected');}var _0x231423='';var _0x1e7e14=parseInt(_0x41216a['queue_id'],0xa);if(isNaN(_0x1e7e14)){_0x231423=_0x41216a[_0xa67d('0x15b')];}else{_0x231423=this[_0xa67d('0x14')][_0xa67d('0x72')](this,_0x41216a[_0xa67d('0x15b')]);if(!_0x231423){return this[_0xa67d('0xf')][_0xa67d('0x2e')](_0x41216a,_0xa67d('0x15c'));}}var _0x40a0f7='';if(this['isConfigured'](_0x41216a[_0xa67d('0x102')])){var _0x4cc7a6=this[_0xa67d('0x104')][_0xa67d('0x72')](this,_0x41216a[_0xa67d('0x102')]);if(_0x4cc7a6){_0x40a0f7=_0x4cc7a6;}}this[_0xa67d('0x37')]['sync'](this,_0x41216a,_0x231423);if(_0x41216a['opts'][_0xa67d('0x15d')]('x')<0x0){_0x41216a[_0xa67d('0xdb')]+='x';}if(_0x41216a['opts']['indexOf']('X')<0x0){_0x41216a[_0xa67d('0xdb')]+='X';}this['channel'][_0xa67d('0xa0')](_0xa67d('0x15e'),_0x231423?_0x231423[_0xa67d('0x15f')]():'');var _0x34bef5=this['channel'][_0xa67d('0x59')](_0xa67d('0x160'),[_0x231423,_0x41216a[_0xa67d('0xdb')],_0x41216a[_0xa67d('0x63')],_0x40a0f7,_0x41216a[_0xa67d('0x66')],_0x41216a[_0xa67d('0x8')],_0x41216a[_0xa67d('0x161')],_0x41216a[_0xa67d('0x162')],'',_0x41216a[_0xa67d('0x163')]]);if(_0x34bef5['result']===-0x1){return _0x34bef5;}return this[_0xa67d('0xf')]['noop'](util[_0xa67d('0x55')](_0xa67d('0xbe'),_0xa67d('0x160'),_0x231423));};AGIVertices['prototype']['record']=function(_0xdec7b9){logger[_0xa67d('0x30')](util['format'](_0xa67d('0x164'),_0xdec7b9[_0xa67d('0xae')]));var _0xe8cc85=_0xdec7b9['recordingFormat']||_0xa67d('0x120');var _0x163849=util[_0xa67d('0x55')](_0xa67d('0x165'),this[_0xa67d('0xf')][_0xa67d('0x38')],rs[_0xa67d('0x122')](0x5));var _0x1902bf=util['format'](_0xa67d('0x166'),FILES_PATH,_0x163849,_0xe8cc85);var _0x550a25=util[_0xa67d('0x55')](_0xa67d('0x121'),FILES_PATH,_0x163849);this['createSquareRecording'][_0xa67d('0x72')](this,_0xdec7b9,_0x163849,_0x1902bf);this[_0xa67d('0xf')][_0xa67d('0xa0')](_0xa67d('0x167'),_0x163849);logger[_0xa67d('0x30')](_0xa67d('0x168'),_0x550a25,_0xe8cc85,_0xdec7b9[_0xa67d('0x169')],_0xdec7b9[_0xa67d('0x66')]);return this['channel'][_0xa67d('0x13d')](_0x550a25,_0xe8cc85,_0xdec7b9[_0xa67d('0x169')],_0xdec7b9[_0xa67d('0x66')],undefined,!![]);};AGIVertices[_0xa67d('0x18')][_0xa67d('0x16a')]=function(_0x38ac8c){logger['info'](util[_0xa67d('0x55')](_0xa67d('0x16b'),_0x38ac8c[_0xa67d('0xae')]));if(!this['isConfigured'](_0x38ac8c[_0xa67d('0x63')])){return this[_0xa67d('0xf')][_0xa67d('0xa8')](_0xa67d('0x16c'));}var _0x551ffb=this[_0xa67d('0x16d')][_0xa67d('0x72')](this,_0x38ac8c);logger[_0xa67d('0x30')](util['format'](_0xa67d('0x16e'),util[_0xa67d('0x16f')](_0x551ffb,{'showHidden':![],'depth':null})));if(!this[_0xa67d('0x86')](_0x38ac8c[_0xa67d('0xce')])){return this[_0xa67d('0xf')][_0xa67d('0xa8')](_0xa67d('0x170'));}var _0x208aa2=this['getVariable'][_0xa67d('0x72')](this,_0x38ac8c['variable_id']);if(!_0x208aa2){return this[_0xa67d('0xf')][_0xa67d('0x2e')](_0x38ac8c,'no\x20variable\x20found');}this[_0xa67d('0xf')]['setVariable'](util[_0xa67d('0x55')](_0xa67d('0x171'),_0x208aa2),_0x551ffb[_0xa67d('0x76')]?_0x551ffb[_0xa67d('0x76')]:'200');this[_0xa67d('0xf')][_0xa67d('0xa0')](util[_0xa67d('0x55')]('%s_STATUS_MESSAGE',_0x208aa2),_0x551ffb['statusMessage']?_0x551ffb[_0xa67d('0x77')]:'OK');if(_0x551ffb[_0xa67d('0x6b')]){try{this[_0xa67d('0x172')](_0x551ffb['body'],_0x208aa2);}catch(_0x3a99db){logger['error'](util[_0xa67d('0x55')]('Unable\x20to\x20set\x20result\x20in\x20variable\x20%s',_0x208aa2));}}return this[_0xa67d('0xf')][_0xa67d('0xa8')](util[_0xa67d('0x55')](_0xa67d('0xd4'),_0x208aa2));};AGIVertices[_0xa67d('0x18')][_0xa67d('0x173')]=function(_0x56ad54){logger['info'](util[_0xa67d('0x55')](_0xa67d('0x174'),_0x56ad54[_0xa67d('0xae')]));return this[_0xa67d('0xf')]['sayDigits'](_0x56ad54['digits'][_0xa67d('0x5a')](/\s+/g,''),_0x56ad54[_0xa67d('0x169')]);};AGIVertices[_0xa67d('0x18')][_0xa67d('0x175')]=function(_0x4aa48f){logger['info'](util['format']('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0x4aa48f[_0xa67d('0xae')]));return this['channel'][_0xa67d('0x176')](_0x4aa48f[_0xa67d('0x65')][_0xa67d('0x5a')](/\s+/g,''),_0x4aa48f[_0xa67d('0x169')]);};AGIVertices[_0xa67d('0x18')][_0xa67d('0x177')]=function(_0x2d6bb5){logger[_0xa67d('0x30')](util[_0xa67d('0x55')](_0xa67d('0x178'),_0x2d6bb5[_0xa67d('0xae')]));return this[_0xa67d('0xf')][_0xa67d('0x179')](_0x2d6bb5[_0xa67d('0x5d')],_0x2d6bb5[_0xa67d('0x169')]);};AGIVertices[_0xa67d('0x18')][_0xa67d('0x17a')]=function(_0x152115){logger[_0xa67d('0x30')](util[_0xa67d('0x55')](_0xa67d('0x17b'),_0x152115['label']));if(!this['isConfigured'](_0x152115['account_id'])){return this['channel'][_0xa67d('0xa8')](_0xa67d('0x17c'));}var _0x8909b5=this[_0xa67d('0x22')][_0xa67d('0x72')](this,_0x152115['account_id']);if(!_0x8909b5||!_0x8909b5[_0xa67d('0x17d')]){return this[_0xa67d('0xf')][_0xa67d('0x2e')](_0x152115,_0xa67d('0x17e'));}var _0x3038e1={'from':util['format'](_0xa67d('0x17f'),_0x8909b5['name'],_0x8909b5[_0xa67d('0x180')]||_0x8909b5[_0xa67d('0x17d')][_0xa67d('0x181')]),'to':_0x152115['to']||'','cc':_0x152115['cc']||'','bcc':_0x152115[_0xa67d('0x182')]||'','subject':_0x152115[_0xa67d('0x183')],'html':_0x152115[_0xa67d('0x5d')],'text':_0x152115[_0xa67d('0x5d')]};if(this[_0xa67d('0x86')](_0x152115[_0xa67d('0x184')])){}logger['debug'](_0xa67d('0x185'),JSON[_0xa67d('0x74')](_0x3038e1));this[_0xa67d('0x37')][_0xa67d('0x72')](this,_0x152115,_0x152115[_0xa67d('0x186')]);this['channel'][_0xa67d('0xa8')](util[_0xa67d('0x55')](_0xa67d('0x187'),_0x8909b5[_0xa67d('0x16')]));this[_0xa67d('0x24')][_0xa67d('0x72')](this,_0x8909b5[_0xa67d('0x188')],_0x3038e1);return this[_0xa67d('0xf')][_0xa67d('0xa8')]('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0xa67d('0x18')]['sendFax']=function(_0x23fc96){logger[_0xa67d('0x30')](util[_0xa67d('0x55')](_0xa67d('0x189'),_0x23fc96[_0xa67d('0xae')]));return this[_0xa67d('0xf')]['noop']('SENDFAX\x20block\x20not\x20implemented');};AGIVertices[_0xa67d('0x18')][_0xa67d('0x18a')]=function(_0x10e651){logger['info'](util[_0xa67d('0x55')](_0xa67d('0x18b'),_0x10e651[_0xa67d('0xae')]));if(!this['isConfigured'](_0x10e651[_0xa67d('0x18c')])){return this['channel'][_0xa67d('0xa8')](_0xa67d('0x18d'));}var _0x21ba72=this[_0xa67d('0x18e')][_0xa67d('0x72')](this,_0x10e651[_0xa67d('0x18c')]);if(!_0x21ba72){return this['channel'][_0xa67d('0x2e')](_0x10e651,_0xa67d('0x18f'));}var _0x5c8789={'body':_0x10e651[_0xa67d('0x190')],'phone':_0x10e651['to']||'','SmsAccountId':_0x21ba72['id']};logger['debug'](_0xa67d('0x191'),JSON['stringify'](_0x5c8789));this[_0xa67d('0x37')][_0xa67d('0x72')](this,_0x10e651,_0x10e651['sms_account_id']);this['channel'][_0xa67d('0xa8')](util[_0xa67d('0x55')](_0xa67d('0x192'),_0x21ba72['name']));this['createSmsMessage'][_0xa67d('0x72')](this,_0x5c8789);return this[_0xa67d('0xf')]['noop'](_0xa67d('0x193'));};AGIVertices[_0xa67d('0x18')][_0xa67d('0x194')]=function(_0xb9b514){logger[_0xa67d('0x30')](util[_0xa67d('0x55')](_0xa67d('0x195'),_0xb9b514['label']));if(!this['isConfigured'](_0xb9b514[_0xa67d('0xce')])){return this[_0xa67d('0xf')][_0xa67d('0x2e')](_0xb9b514,_0xa67d('0x196'));}var _0x4f03d9=this[_0xa67d('0x12')][_0xa67d('0x72')](this,_0xb9b514[_0xa67d('0xce')]);if(!_0x4f03d9){return this[_0xa67d('0xf')][_0xa67d('0x2e')](_0xb9b514,_0xa67d('0xd0'));}return this['channel'][_0xa67d('0xa0')](_0x4f03d9,_0xb9b514[_0xa67d('0x197')]);};AGIVertices[_0xa67d('0x18')][_0xa67d('0x198')]=function(_0x235cb1){logger[_0xa67d('0x30')](util[_0xa67d('0x55')]('Enter\x20in\x20START\x20(%s)\x20block',_0x235cb1['label']));this['channel']['noop'](_0xa67d('0x199'));if(_0x235cb1[_0xa67d('0xb8')]===_0xa67d('0x19a')){this[_0xa67d('0xf')][_0xa67d('0xa8')]('Answer');return this[_0xa67d('0xf')][_0xa67d('0xb8')]();}return this['channel']['noop'](_0xa67d('0x19b'));};AGIVertices[_0xa67d('0x18')][_0xa67d('0x19c')]=function(_0x5d4e94){logger[_0xa67d('0x30')](util[_0xa67d('0x55')](_0xa67d('0x19d'),_0x5d4e94[_0xa67d('0xae')]));if(!this[_0xa67d('0x86')](_0x5d4e94[_0xa67d('0x19e')])){return this['channel'][_0xa67d('0x2e')](_0x5d4e94,'no\x20subproject\x20selected');}var _0x31a9c0=this[_0xa67d('0x19f')][_0xa67d('0x72')](this,_0x5d4e94['project_id']);if(!this[_0xa67d('0x86')](_0x31a9c0)){return this[_0xa67d('0xf')][_0xa67d('0x2e')](_0x5d4e94,util['format'](_0xa67d('0x1a0'),_0x5d4e94['project_id']));}if(_0x31a9c0===this[_0xa67d('0xf')][_0xa67d('0x3a')]){return this[_0xa67d('0xf')][_0xa67d('0x2e')](_0x5d4e94,_0xa67d('0x1a1'));}this[_0xa67d('0x37')]['sync'](this,_0x5d4e94,_0x31a9c0);var _0x2bbbd2=this[_0xa67d('0xf')][_0xa67d('0x59')](_0xa67d('0x1a2'),util['format'](_0xa67d('0x1a3'),config[_0xa67d('0x8')][_0xa67d('0x1a4')]||_0xa67d('0x1a5'),_0x31a9c0,this[_0xa67d('0xf')]['arg_1']));if(_0x2bbbd2[_0xa67d('0xa4')]===-0x1){return _0x2bbbd2;}return this['channel']['noop'](util[_0xa67d('0x55')]('Executed\x20command\x20%s\x20%s','AGI',_0x31a9c0));};AGIVertices['prototype'][_0xa67d('0x1a6')]=function(_0x5d6984){logger[_0xa67d('0x30')](util[_0xa67d('0x55')](_0xa67d('0x1a7'),_0x5d6984['label']));var _0x5698a8=this[_0xa67d('0x58')][_0xa67d('0x72')](this,_0x5d6984[_0xa67d('0xb6')]);this[_0xa67d('0x37')]['sync'](this,_0x5d6984,_0x5d6984[_0xa67d('0xb6')]);if(this[_0xa67d('0x86')](_0x5d6984[_0xa67d('0xce')])){var _0x45dd11=this[_0xa67d('0x12')][_0xa67d('0x72')](this,_0x5d6984[_0xa67d('0xce')]);if(_0x45dd11){this[_0xa67d('0xf')][_0xa67d('0xa0')](_0x45dd11,_0x5698a8);return this[_0xa67d('0xf')][_0xa67d('0xa8')](util['format'](_0xa67d('0x1a8'),_0x5d6984[_0xa67d('0xb6')],_0x45dd11));}}return this[_0xa67d('0xf')]['noop'](util[_0xa67d('0x55')](_0xa67d('0x1a9'),_0x5d6984['command']));};AGIVertices[_0xa67d('0x18')][_0xa67d('0x1aa')]=function(_0x4fb85f){logger[_0xa67d('0x30')](util[_0xa67d('0x55')](_0xa67d('0x1ab'),_0x4fb85f[_0xa67d('0xae')]));_0x4fb85f[_0xa67d('0x5d')]=_0x4fb85f[_0xa67d('0x5d')][_0xa67d('0x5a')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xa67d('0x86')](_0x4fb85f[_0xa67d('0x5c')])){return this[_0xa67d('0xf')][_0xa67d('0xa8')](_0xa67d('0x1ac'));}if(!this[_0xa67d('0x86')](_0x4fb85f[_0xa67d('0x5d')])){return this[_0xa67d('0xf')][_0xa67d('0xa8')](_0xa67d('0xa9'));}this[_0xa67d('0xf')][_0xa67d('0xa8')](util[_0xa67d('0x55')]('Trying\x20Google\x20Cloud\x20TTS\x20%s',_0x4fb85f[_0xa67d('0x5d')]));var _0x2b0c3c=this['googleCloudTTS'][_0xa67d('0x72')](this,_0x4fb85f);if(_0x2b0c3c){this[_0xa67d('0xf')]['noop'](util[_0xa67d('0x55')]('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x2b0c3c));var _0x38c919=this['channel']['streamFile'](_0x2b0c3c);try{fs['unlink'](_0x2b0c3c+_0xa67d('0xf4'));}catch(_0x1fc06a){logger[_0xa67d('0x2e')](_0x1fc06a);}return _0x38c919;}return this[_0xa67d('0xf')][_0xa67d('0x2e')](_0x4fb85f,_0xa67d('0x1ad'));};AGIVertices['prototype']['tts']=function(_0x55a82e){logger[_0xa67d('0x30')](util[_0xa67d('0x55')](_0xa67d('0x1ae'),_0x55a82e[_0xa67d('0xae')]));_0x55a82e['text']=_0x55a82e[_0xa67d('0x5d')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xa67d('0x86')](_0x55a82e[_0xa67d('0x5d')])){return this[_0xa67d('0xf')][_0xa67d('0xa8')](_0xa67d('0xa9'));}this[_0xa67d('0xf')]['noop'](util['format'](_0xa67d('0x1af'),_0x55a82e[_0xa67d('0x5d')]));var _0x52374b=this[_0xa67d('0x1b0')]['sync'](this,_0x55a82e);if(_0x52374b){this[_0xa67d('0xf')][_0xa67d('0xa8')](util['format'](_0xa67d('0x1b1'),_0x52374b));var _0x22a1ab=this[_0xa67d('0xf')][_0xa67d('0x142')](_0x52374b);try{fs[_0xa67d('0x114')](_0x52374b+'.wav');}catch(_0x4bdc33){logger['error'](_0x4bdc33);}return _0x22a1ab;}return this[_0xa67d('0xf')][_0xa67d('0x2e')](_0x55a82e,_0xa67d('0x1b2'));};AGIVertices['prototype'][_0xa67d('0x1b3')]=function(_0x35ee19){logger[_0xa67d('0x30')](util[_0xa67d('0x55')](_0xa67d('0x1b4'),_0x35ee19['label']));if(!this['isConfigured'](_0x35ee19[_0xa67d('0x145')])){return this['channel'][_0xa67d('0x2e')](_0x35ee19,'no\x20find\x20by\x20configured');}logger['info'](util[_0xa67d('0x55')](_0xa67d('0x14a'),this[_0xa67d('0xf')][_0xa67d('0x3b')],_0x35ee19['findBy']));var _0x26daad=this[_0xa67d('0x51')]['sync'](this,_0x35ee19['findBy']);if(_0x26daad){logger[_0xa67d('0x30')](util[_0xa67d('0x55')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xa67d('0xf')][_0xa67d('0x3b')],_0x35ee19[_0xa67d('0x145')]));this[_0xa67d('0xf')]['noop'](util[_0xa67d('0x55')](_0xa67d('0x146'),this[_0xa67d('0xf')][_0xa67d('0x3b')],_0x35ee19[_0xa67d('0x145')]));return{'code':0xc8,'result':'success'};}else{logger[_0xa67d('0x30')](util[_0xa67d('0x55')](_0xa67d('0x148'),this[_0xa67d('0xf')][_0xa67d('0x3b')],_0x35ee19[_0xa67d('0x145')]));this[_0xa67d('0xf')][_0xa67d('0xa8')](util[_0xa67d('0x55')](_0xa67d('0x148'),this[_0xa67d('0xf')][_0xa67d('0x3b')],_0x35ee19[_0xa67d('0x145')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0xa67d('0x18')][_0xa67d('0x1b5')]=function(_0x465026){logger['info'](util['format']('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0x465026['label']));var _0x3df284=this['channel'][_0xa67d('0x59')](_0xa67d('0x1b6'),[_0x465026['mailbox'],_0x465026[_0xa67d('0x78')]]);if(_0x3df284['result']===-0x1){return _0x3df284;}return this[_0xa67d('0xf')]['noop'](util[_0xa67d('0x55')]('Executed\x20command\x20%s\x20%s','VOICEMAIL',_0x465026['mailbox']));};AGIVertices[_0xa67d('0x18')][_0xa67d('0x1b7')]=function(_0x13e2d6){logger[_0xa67d('0x30')](util[_0xa67d('0x55')](_0xa67d('0x1b8'),_0x13e2d6['label']));if(!this[_0xa67d('0x86')](_0x13e2d6[_0xa67d('0xce')])){return this[_0xa67d('0xf')][_0xa67d('0x2e')](_0x13e2d6,_0xa67d('0x196'));}var _0x4c8241=this[_0xa67d('0x12')][_0xa67d('0x72')](this,_0x13e2d6[_0xa67d('0xce')]);if(!_0x4c8241){return this['channel'][_0xa67d('0x2e')](_0x13e2d6,_0xa67d('0xd0'));}var _0xec49ad=this[_0xa67d('0xf')][_0xa67d('0x12')](_0x4c8241);return{'code':0xc8,'result':_0xec49ad[_0xa67d('0xa3')]?_0xec49ad['extra']:'-'};};String['prototype'][_0xa67d('0xa2')]=function(_0x34e25d,_0x54352c){return this[_0xa67d('0xa1')](_0x34e25d)[_0xa67d('0x1b9')](_0x54352c);};module[_0xa67d('0x1ba')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 56fbeaf..b70ef64 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 _0x27db=['[ACW][START]\x20%s','message','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','stringify','[ACW][STOP]\x20%s','interface','[ACW][syncAgentConnect]\x20%s','syncAgentConnectPreview','[%s][HANGUP:UNIQUEID]','startAcw','linkedid','isUndefined','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','all','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','lodash','moment','../ami','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','bind','syncHangupRequest','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','syncAttendedTransfer','blindtransfer','milliseconds','diff','prototype','queue','mandatoryDisposition','mandatoryDispositionPause','name','then','voicePause','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','info','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','stopAcw','acwTimeout','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','updateAcw','timer','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','finally'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x27db,0x71));var _0xb27d=function(_0x44b6f8,_0x302591){_0x44b6f8=_0x44b6f8-0x0;var _0x32b459=_0x27db[_0x44b6f8];return _0x32b459;};'use strict';var util=require(_0xb27d('0x0'));var _=require(_0xb27d('0x1'));var moment=require(_0xb27d('0x2'));var ami=require(_0xb27d('0x3'));var logger=require(_0xb27d('0x4'))(_0xb27d('0x5'));var RpcUser=require(_0xb27d('0x6'));var RpcVoiceAgentReport=require(_0xb27d('0x7'));function Acw(_0x47c43e){this[_0xb27d('0x8')]=_0x47c43e['voiceQueues'];this[_0xb27d('0x9')]=_0x47c43e['agents'];this[_0xb27d('0xa')]=_0x47c43e[_0xb27d('0xa')];this[_0xb27d('0xb')]={};ami['on']('agentconnect',this['syncAgentConnect'][_0xb27d('0xc')](this));ami['on']('hanguprequest',this[_0xb27d('0xd')]['bind'](this));ami['on']('hangup',this[_0xb27d('0xe')][_0xb27d('0xc')](this));ami['on'](_0xb27d('0xf'),this[_0xb27d('0x10')]['bind'](this));ami['on']('attendedtransfer',this[_0xb27d('0x11')]['bind'](this));ami['on'](_0xb27d('0x12'),this['syncBlindTransfer']['bind'](this));ami['on']('custom:agentConnectPreview',this['syncAgentConnectPreview'][_0xb27d('0xc')](this));}function getDiff(_0x53936e){var _0x1577bb=moment()[_0xb27d('0x13')](0x0);var _0x518ad3=moment(_0x53936e)['milliseconds'](0x0);return _0x1577bb[_0xb27d('0x14')](_0x518ad3,'seconds');}Acw[_0xb27d('0x15')]['startAcw']=function(_0x2a57af){try{var _0x285768=this;var _0x6a5ba2=this['channels'][_0x2a57af]['interface'];var _0x1b8675=this[_0xb27d('0xb')][_0x2a57af][_0xb27d('0x16')];var _0x29bc3a=this['voiceQueues'][_0x1b8675];var _0x5e251c=![];var _0x99f26f='ACW';if(_0x29bc3a[_0xb27d('0x17')]){if(_0x29bc3a[_0xb27d('0x18')][_0xb27d('0x19')]){_0x5e251c=!![];_0x99f26f=_0x29bc3a['mandatoryDispositionPause'][_0xb27d('0x19')];}}ami['Action']({'action':'QueuePause','interface':_0x6a5ba2,'paused':!![],'reason':_0x99f26f})[_0xb27d('0x1a')](function(_0x1b02e9){if(_0x285768[_0xb27d('0x9')][_0x6a5ba2]){return RpcUser['getAgent'](_0x285768[_0xb27d('0x9')][_0x6a5ba2]['id'])['then'](function(_0x2dda78){if(_0x2dda78&&!_0x2dda78[_0xb27d('0x1b')]){logger['info'](_0xb27d('0x1c'),_0x2a57af,_0x6a5ba2,_0x1b8675);var _0x563ba9=_0x285768[_0xb27d('0xb')][_0x2a57af][_0xb27d('0x1d')]&&_0x285768[_0xb27d('0xb')][_0x2a57af][_0xb27d('0x1e')]?_0x285768['channels'][_0x2a57af][_0xb27d('0x1e')]:_0x2a57af;return RpcUser[_0xb27d('0x1f')](_0x285768[_0xb27d('0x9')][_0x6a5ba2],_0x99f26f,_0x563ba9)[_0xb27d('0x1a')](function(_0x1e2162){if(!_0x5e251c){_0x285768[_0xb27d('0xa')][_0x6a5ba2]={};logger[_0xb27d('0x20')](_0xb27d('0x21'),_0x2a57af,_0x285768[_0xb27d('0x8')][_0x1b8675]['acwTimeout'],_0x6a5ba2,_0x1b8675);_0x285768[_0xb27d('0xa')][_0x6a5ba2]['timer']=setTimeout(_0x285768[_0xb27d('0x22')][_0xb27d('0xc')](_0x285768,_0x6a5ba2),_0x285768[_0xb27d('0x8')][_0x1b8675][_0xb27d('0x23')]*0x3e8);_0x285768[_0xb27d('0xa')][_0x6a5ba2][_0xb27d('0x24')]=moment()[_0xb27d('0x25')](_0xb27d('0x26'));_0x285768[_0xb27d('0xa')][_0x6a5ba2][_0xb27d('0x27')]=_0x2a57af;_0x285768[_0xb27d('0xa')][_0x6a5ba2][_0xb27d('0x16')]=_0x1b8675;_0x285768[_0xb27d('0xa')][_0x6a5ba2][_0xb27d('0x28')]=function(){var _0x1b25e8=getDiff(_0x285768['timers'][_0x6a5ba2]['lastPauseAt']);clearTimeout(_0x285768[_0xb27d('0xa')][_0x6a5ba2]['timer']);_0x285768['timers'][_0x6a5ba2][_0xb27d('0x29')]=![];RpcVoiceAgentReport['update']({'acwtime':_0x1b25e8},_0x285768[_0xb27d('0xa')][_0x6a5ba2]['uniqueid'],_0x6a5ba2)['then'](function(_0x4d9668){logger[_0xb27d('0x20')](_0xb27d('0x2a'),_0x2a57af,_0x1b25e8,_0x4d9668);})[_0xb27d('0x2b')](function(_0x1c1a28){logger[_0xb27d('0x2c')](_0xb27d('0x2d'),_0x2a57af,_0x1c1a28);});delete _0x285768[_0xb27d('0xa')][_0x6a5ba2];};}});}else{logger[_0xb27d('0x20')]('[%s][INPAUSE][AGENT:%s][QUEUE:%s]',_0x2a57af,_0x6a5ba2,_0x1b8675);}});}})[_0xb27d('0x2b')](function(_0x5b3ac3){logger[_0xb27d('0x2c')](_0xb27d('0x21'),_0x2a57af,_0x285768[_0xb27d('0x8')][_0x1b8675][_0xb27d('0x23')],_0x6a5ba2,_0x1b8675);})[_0xb27d('0x2e')](function(){delete _0x285768['channels'][_0x2a57af];});}catch(_0x1f1779){logger[_0xb27d('0x2c')](_0xb27d('0x2f'),_0x1f1779[_0xb27d('0x30')]);}};Acw[_0xb27d('0x15')][_0xb27d('0x22')]=function(_0x3254d0){try{var _0x4a99c7=this;if(_0x4a99c7[_0xb27d('0xa')][_0x3254d0]){_0x4a99c7[_0xb27d('0xa')][_0x3254d0][_0xb27d('0x29')]=![];var _0x51228c=_0x4a99c7['timers'][_0x3254d0][_0xb27d('0x27')];var _0x2daea9=_0x4a99c7['timers'][_0x3254d0]['queue'];var _0x1c8de3=_0x4a99c7[_0xb27d('0x8')][_0x2daea9][_0xb27d('0x23')];logger[_0xb27d('0x20')](_0xb27d('0x31'),_0x51228c,_0x3254d0);RpcUser[_0xb27d('0x32')](this[_0xb27d('0x9')][_0x3254d0]);RpcVoiceAgentReport['update']({'acwtime':_0x1c8de3,'agentacw':!![]},_0x51228c,_0x3254d0)[_0xb27d('0x1a')](function(_0x5a0c6d){logger[_0xb27d('0x20')](_0xb27d('0x2a'),_0x51228c,_0x1c8de3,_0x5a0c6d);})['catch'](function(_0x52afbb){logger[_0xb27d('0x2c')](_0xb27d('0x2d'),_0x51228c,_0x52afbb);});}else{logger['error']('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0x3254d0);if(_0x4a99c7['timers']){logger[_0xb27d('0x20')]('[ACW][TIMERS]',JSON[_0xb27d('0x33')](_0x4a99c7[_0xb27d('0xa')]));}}}catch(_0x244c43){logger[_0xb27d('0x2c')](_0xb27d('0x34'),_0x244c43[_0xb27d('0x30')]);}};Acw['prototype']['syncAgentConnect']=function(_0x59929f){try{if(this['voiceQueues'][_0x59929f[_0xb27d('0x16')]]&&(this['voiceQueues'][_0x59929f[_0xb27d('0x16')]][_0xb27d('0x5')]||this['voiceQueues'][_0x59929f[_0xb27d('0x16')]][_0xb27d('0x17')])){if(this['agents'][_0x59929f['interface']]){this[_0xb27d('0xb')][_0x59929f['uniqueid']]={'queue':_0x59929f['queue'],'interface':_0x59929f[_0xb27d('0x35')],'destlinkedid':_0x59929f[_0xb27d('0x1e')]};}}}catch(_0x3b65b3){logger[_0xb27d('0x2c')](_0xb27d('0x36'),_0x3b65b3[_0xb27d('0x30')]);}};Acw[_0xb27d('0x15')][_0xb27d('0x37')]=function(_0x2fbe51){try{if(this[_0xb27d('0x8')][_0x2fbe51[_0xb27d('0x16')]]&&(this[_0xb27d('0x8')][_0x2fbe51['queue']][_0xb27d('0x5')]||this[_0xb27d('0x8')][_0x2fbe51[_0xb27d('0x16')]][_0xb27d('0x17')])){if(this[_0xb27d('0x9')][_0x2fbe51[_0xb27d('0x35')]]){this['channels'][_0x2fbe51[_0xb27d('0x27')]]={'queue':_0x2fbe51[_0xb27d('0x16')],'interface':_0x2fbe51[_0xb27d('0x35')]};}}}catch(_0x3674e5){logger[_0xb27d('0x2c')]('[ACW][syncAgentConnectPreview]\x20%s',_0x3674e5[_0xb27d('0x30')]);}};Acw[_0xb27d('0x15')][_0xb27d('0xd')]=function(_0x1eff8c){try{if(this['channels'][_0x1eff8c[_0xb27d('0x27')]]&&_['isUndefined'](this[_0xb27d('0xb')][_0x1eff8c['uniqueid']]['attended'])){logger[_0xb27d('0x20')](_0xb27d('0x38'),_0x1eff8c['uniqueid']);this[_0xb27d('0x39')](_0x1eff8c[_0xb27d('0x27')]);}else if(this[_0xb27d('0xb')][_0x1eff8c[_0xb27d('0x3a')]]&&_[_0xb27d('0x3b')](this['channels'][_0x1eff8c[_0xb27d('0x3a')]][_0xb27d('0x1d')])){logger[_0xb27d('0x20')](_0xb27d('0x3c'),_0x1eff8c[_0xb27d('0x3a')]);this['startAcw'](_0x1eff8c[_0xb27d('0x3a')]);}}catch(_0xef6bf9){logger[_0xb27d('0x2c')](_0xb27d('0x3d'),_0xef6bf9[_0xb27d('0x30')]);}};Acw[_0xb27d('0x15')][_0xb27d('0xe')]=function(_0x15e31a){try{if(this[_0xb27d('0xb')][_0x15e31a['uniqueid']]&&this[_0xb27d('0xb')][_0x15e31a[_0xb27d('0x27')]][_0xb27d('0x1d')]){logger['info'](_0xb27d('0x3e'),_0x15e31a[_0xb27d('0x27')]);this[_0xb27d('0x39')](_0x15e31a['uniqueid']);}else if(this[_0xb27d('0xb')][_0x15e31a[_0xb27d('0x3a')]]&&this[_0xb27d('0xb')][_0x15e31a[_0xb27d('0x3a')]][_0xb27d('0x1d')]){logger[_0xb27d('0x20')](_0xb27d('0x3f'),_0x15e31a[_0xb27d('0x3a')]);this[_0xb27d('0x39')](_0x15e31a[_0xb27d('0x3a')]);}}catch(_0xeefbd0){logger['error'](_0xb27d('0x40'),_0xeefbd0[_0xb27d('0x30')]);}};Acw[_0xb27d('0x15')][_0xb27d('0x11')]=function(_0x200ffd){try{if(!_[_0xb27d('0x41')](this[_0xb27d('0xb')][_0x200ffd[_0xb27d('0x42')]])){this[_0xb27d('0x39')](_0x200ffd[_0xb27d('0x42')]);if(this[_0xb27d('0xb')][_0x200ffd[_0xb27d('0x43')]]){this['channels'][_0x200ffd[_0xb27d('0x43')]][_0xb27d('0x1d')]=!![];this[_0xb27d('0xb')][_0x200ffd[_0xb27d('0x44')]]=this[_0xb27d('0xb')][_0x200ffd[_0xb27d('0x43')]];delete this['channels'][_0x200ffd[_0xb27d('0x43')]];}}else if(!_[_0xb27d('0x41')](this[_0xb27d('0xb')][_0x200ffd['transfertargetuniqueid']])){this[_0xb27d('0x39')](_0x200ffd[_0xb27d('0x44')]);if(this[_0xb27d('0xb')][_0x200ffd['origtransfereruniqueid']]){this[_0xb27d('0xb')][_0x200ffd['origtransfereruniqueid']][_0xb27d('0x1d')]=!![];this['channels'][_0x200ffd[_0xb27d('0x42')]]=this[_0xb27d('0xb')][_0x200ffd[_0xb27d('0x45')]];delete this[_0xb27d('0xb')][_0x200ffd[_0xb27d('0x45')]];}}}catch(_0x2938e3){logger[_0xb27d('0x2c')](_0xb27d('0x46'),_0x2938e3[_0xb27d('0x30')]);}};Acw[_0xb27d('0x15')]['syncBlindTransfer']=function(_0x512aff){try{if(this[_0xb27d('0xb')][_0x512aff[_0xb27d('0x47')]]){logger['info']('[%s][BLINDTRANSFER:UNIQUEID]',JSON[_0xb27d('0x33')](_0x512aff[_0xb27d('0x47')]));this[_0xb27d('0x39')](_0x512aff[_0xb27d('0x47')]);}else if(this['channels'][_0x512aff[_0xb27d('0x48')]]){logger[_0xb27d('0x20')](_0xb27d('0x49'),JSON['stringify'](_0x512aff[_0xb27d('0x48')]));this['startAcw'](_0x512aff[_0xb27d('0x48')]);}}catch(_0x2e4d27){logger[_0xb27d('0x2c')](_0xb27d('0x4a'),_0x2e4d27[_0xb27d('0x30')]);}};Acw['prototype'][_0xb27d('0x10')]=function(_0x4847ee){try{if(this[_0xb27d('0x8')][_0x4847ee[_0xb27d('0x16')]]&&this['voiceQueues'][_0x4847ee[_0xb27d('0x16')]][_0xb27d('0x4b')]===_0xb27d('0x4c')){if(this[_0xb27d('0x9')][_0x4847ee[_0xb27d('0x35')]]){logger[_0xb27d('0x20')]('[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]',_0x4847ee[_0xb27d('0x27')],_0x4847ee[_0xb27d('0x35')],_0x4847ee['queue']);return RpcUser[_0xb27d('0x1f')](this[_0xb27d('0x9')][_0x4847ee[_0xb27d('0x35')]],_0xb27d('0x4d'),_0x4847ee[_0xb27d('0x27')]);}}}catch(_0x5bb89b){logger[_0xb27d('0x2c')](_0xb27d('0x4e'),_0x5bb89b[_0xb27d('0x30')]);}};module[_0xb27d('0x4f')]=Acw; \ No newline at end of file +var _0x34d7=['seconds','prototype','interface','queue','mandatoryDispositionPause','name','Action','QueuePause','getAgent','then','voicePause','[%s][START][AGENT:%s][QUEUE:%s]','destlinkedid','savePause','info','acwTimeout','timer','stopAcw','lastPauseAt','format','uniqueid','updateAcw','update','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','finally','[ACW][START]\x20%s','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','message','acw','[ACW][syncAgentConnect]\x20%s','mandatoryDisposition','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','attended','[%s][HANGUP:UNIQUEID]','startAcw','linkedid','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[ACW][syncHangup]\x20%s','syncAttendedTransfer','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','syncAgentRingNoAnswer','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','lodash','moment','../ami','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','syncHangup','agentringnoanswer','attendedtransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff'];(function(_0x3a355d,_0x26de2a){var _0x37aa3b=function(_0x42c21a){while(--_0x42c21a){_0x3a355d['push'](_0x3a355d['shift']());}};_0x37aa3b(++_0x26de2a);}(_0x34d7,0xf5));var _0x734d=function(_0x3a6ecf,_0x28a2aa){_0x3a6ecf=_0x3a6ecf-0x0;var _0x5e4b25=_0x34d7[_0x3a6ecf];return _0x5e4b25;};'use strict';var util=require(_0x734d('0x0'));var _=require(_0x734d('0x1'));var moment=require(_0x734d('0x2'));var ami=require(_0x734d('0x3'));var logger=require('../../../config/logger')('acw');var RpcUser=require(_0x734d('0x4'));var RpcVoiceAgentReport=require(_0x734d('0x5'));function Acw(_0x49145b){this[_0x734d('0x6')]=_0x49145b[_0x734d('0x6')];this[_0x734d('0x7')]=_0x49145b[_0x734d('0x7')];this[_0x734d('0x8')]=_0x49145b['timers'];this[_0x734d('0x9')]={};ami['on'](_0x734d('0xa'),this[_0x734d('0xb')][_0x734d('0xc')](this));ami['on'](_0x734d('0xd'),this[_0x734d('0xe')]['bind'](this));ami['on'](_0x734d('0xf'),this[_0x734d('0x10')][_0x734d('0xc')](this));ami['on'](_0x734d('0x11'),this['syncAgentRingNoAnswer'][_0x734d('0xc')](this));ami['on'](_0x734d('0x12'),this['syncAttendedTransfer'][_0x734d('0xc')](this));ami['on'](_0x734d('0x13'),this[_0x734d('0x14')]['bind'](this));ami['on'](_0x734d('0x15'),this[_0x734d('0x16')][_0x734d('0xc')](this));}function getDiff(_0x5cce5c){var _0x29fa49=moment()['milliseconds'](0x0);var _0x4c4160=moment(_0x5cce5c)[_0x734d('0x17')](0x0);return _0x29fa49[_0x734d('0x18')](_0x4c4160,_0x734d('0x19'));}Acw[_0x734d('0x1a')]['startAcw']=function(_0x1d71a0){try{var _0x413767=this;var _0xa62df0=this['channels'][_0x1d71a0][_0x734d('0x1b')];var _0x38024e=this['channels'][_0x1d71a0][_0x734d('0x1c')];var _0x2d4005=this[_0x734d('0x6')][_0x38024e];var _0x39a350=![];var _0x5a0111='ACW';if(_0x2d4005['mandatoryDisposition']){if(_0x2d4005[_0x734d('0x1d')][_0x734d('0x1e')]){_0x39a350=!![];_0x5a0111=_0x2d4005[_0x734d('0x1d')][_0x734d('0x1e')];}}ami[_0x734d('0x1f')]({'action':_0x734d('0x20'),'interface':_0xa62df0,'paused':!![],'reason':_0x5a0111})['then'](function(_0x5bd611){if(_0x413767['agents'][_0xa62df0]){return RpcUser[_0x734d('0x21')](_0x413767[_0x734d('0x7')][_0xa62df0]['id'])[_0x734d('0x22')](function(_0x3039c7){if(_0x3039c7&&!_0x3039c7[_0x734d('0x23')]){logger['info'](_0x734d('0x24'),_0x1d71a0,_0xa62df0,_0x38024e);var _0x1923a9=_0x413767[_0x734d('0x9')][_0x1d71a0]['attended']&&_0x413767['channels'][_0x1d71a0][_0x734d('0x25')]?_0x413767['channels'][_0x1d71a0]['destlinkedid']:_0x1d71a0;return RpcUser[_0x734d('0x26')](_0x413767[_0x734d('0x7')][_0xa62df0],_0x5a0111,_0x1923a9)['then'](function(_0x2bf4f1){if(!_0x39a350){_0x413767[_0x734d('0x8')][_0xa62df0]={};logger[_0x734d('0x27')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x1d71a0,_0x413767[_0x734d('0x6')][_0x38024e][_0x734d('0x28')],_0xa62df0,_0x38024e);_0x413767['timers'][_0xa62df0][_0x734d('0x29')]=setTimeout(_0x413767[_0x734d('0x2a')][_0x734d('0xc')](_0x413767,_0xa62df0),_0x413767[_0x734d('0x6')][_0x38024e][_0x734d('0x28')]*0x3e8);_0x413767['timers'][_0xa62df0][_0x734d('0x2b')]=moment()[_0x734d('0x2c')]('YYYY-MM-DD\x20HH:mm:ss');_0x413767['timers'][_0xa62df0][_0x734d('0x2d')]=_0x1d71a0;_0x413767[_0x734d('0x8')][_0xa62df0][_0x734d('0x1c')]=_0x38024e;_0x413767['timers'][_0xa62df0][_0x734d('0x2e')]=function(){var _0x1bd293=getDiff(_0x413767['timers'][_0xa62df0][_0x734d('0x2b')]);clearTimeout(_0x413767[_0x734d('0x8')][_0xa62df0][_0x734d('0x29')]);_0x413767[_0x734d('0x8')][_0xa62df0][_0x734d('0x29')]=![];RpcVoiceAgentReport[_0x734d('0x2f')]({'acwtime':_0x1bd293},_0x413767['timers'][_0xa62df0]['uniqueid'],_0xa62df0)[_0x734d('0x22')](function(_0x3de806){logger[_0x734d('0x27')](_0x734d('0x30'),_0x1d71a0,_0x1bd293,_0x3de806);})[_0x734d('0x31')](function(_0x329784){logger[_0x734d('0x32')](_0x734d('0x33'),_0x1d71a0,_0x329784);});delete _0x413767[_0x734d('0x8')][_0xa62df0];};}});}else{logger['info']('[%s][INPAUSE][AGENT:%s][QUEUE:%s]',_0x1d71a0,_0xa62df0,_0x38024e);}});}})[_0x734d('0x31')](function(_0x38625e){logger['error'](_0x734d('0x34'),_0x1d71a0,_0x413767['voiceQueues'][_0x38024e][_0x734d('0x28')],_0xa62df0,_0x38024e);})[_0x734d('0x35')](function(){delete _0x413767['channels'][_0x1d71a0];});}catch(_0x5d175b){logger['error'](_0x734d('0x36'),_0x5d175b['message']);}};Acw[_0x734d('0x1a')][_0x734d('0x2a')]=function(_0x4e0509){try{var _0xdf270e=this;if(_0xdf270e[_0x734d('0x8')][_0x4e0509]){_0xdf270e[_0x734d('0x8')][_0x4e0509]['timer']=![];var _0x47fa6a=_0xdf270e[_0x734d('0x8')][_0x4e0509][_0x734d('0x2d')];var _0x5dff02=_0xdf270e['timers'][_0x4e0509][_0x734d('0x1c')];var _0x2f843b=_0xdf270e[_0x734d('0x6')][_0x5dff02][_0x734d('0x28')];logger[_0x734d('0x27')](_0x734d('0x37'),_0x47fa6a,_0x4e0509);RpcUser[_0x734d('0x38')](this[_0x734d('0x7')][_0x4e0509]);RpcVoiceAgentReport['update']({'acwtime':_0x2f843b,'agentacw':!![]},_0x47fa6a,_0x4e0509)['then'](function(_0x19d43b){logger[_0x734d('0x27')]('[%s][UPDATE][ACWTIME:%s]',_0x47fa6a,_0x2f843b,_0x19d43b);})[_0x734d('0x31')](function(_0x2baebc){logger[_0x734d('0x32')]('[%s][UPDATE][ERRORS:%s]',_0x47fa6a,_0x2baebc);});}else{logger[_0x734d('0x32')](_0x734d('0x39'),_0x4e0509);if(_0xdf270e['timers']){logger[_0x734d('0x27')](_0x734d('0x3a'),JSON[_0x734d('0x3b')](_0xdf270e[_0x734d('0x8')]));}}}catch(_0x24e8ce){logger[_0x734d('0x32')]('[ACW][STOP]\x20%s',_0x24e8ce[_0x734d('0x3c')]);}};Acw[_0x734d('0x1a')][_0x734d('0xb')]=function(_0x500c58){try{if(this['voiceQueues'][_0x500c58[_0x734d('0x1c')]]&&(this[_0x734d('0x6')][_0x500c58[_0x734d('0x1c')]][_0x734d('0x3d')]||this[_0x734d('0x6')][_0x500c58['queue']]['mandatoryDisposition'])){if(this['agents'][_0x500c58['interface']]){this[_0x734d('0x9')][_0x500c58['uniqueid']]={'queue':_0x500c58[_0x734d('0x1c')],'interface':_0x500c58[_0x734d('0x1b')],'destlinkedid':_0x500c58['destlinkedid']};}}}catch(_0x42f098){logger[_0x734d('0x32')](_0x734d('0x3e'),_0x42f098['message']);}};Acw['prototype']['syncAgentConnectPreview']=function(_0x2f87b6){try{if(this['voiceQueues'][_0x2f87b6[_0x734d('0x1c')]]&&(this[_0x734d('0x6')][_0x2f87b6[_0x734d('0x1c')]][_0x734d('0x3d')]||this['voiceQueues'][_0x2f87b6['queue']][_0x734d('0x3f')])){if(this[_0x734d('0x7')][_0x2f87b6[_0x734d('0x1b')]]){this[_0x734d('0x9')][_0x2f87b6[_0x734d('0x2d')]]={'queue':_0x2f87b6[_0x734d('0x1c')],'interface':_0x2f87b6[_0x734d('0x1b')]};}}}catch(_0x194765){logger[_0x734d('0x32')](_0x734d('0x40'),_0x194765[_0x734d('0x3c')]);}};Acw[_0x734d('0x1a')][_0x734d('0xe')]=function(_0x576be5){try{if(this[_0x734d('0x9')][_0x576be5[_0x734d('0x2d')]]&&_[_0x734d('0x41')](this[_0x734d('0x9')][_0x576be5[_0x734d('0x2d')]][_0x734d('0x42')])){logger[_0x734d('0x27')](_0x734d('0x43'),_0x576be5[_0x734d('0x2d')]);this[_0x734d('0x44')](_0x576be5[_0x734d('0x2d')]);}else if(this[_0x734d('0x9')][_0x576be5[_0x734d('0x45')]]&&_[_0x734d('0x41')](this['channels'][_0x576be5['linkedid']]['attended'])){logger[_0x734d('0x27')]('[%s][HANGUP:LINKEDID]',_0x576be5['linkedid']);this[_0x734d('0x44')](_0x576be5[_0x734d('0x45')]);}}catch(_0x3dc2ed){logger[_0x734d('0x32')](_0x734d('0x46'),_0x3dc2ed['message']);}};Acw['prototype']['syncHangup']=function(_0x3cfee4){try{if(this[_0x734d('0x9')][_0x3cfee4[_0x734d('0x2d')]]&&this[_0x734d('0x9')][_0x3cfee4[_0x734d('0x2d')]][_0x734d('0x42')]){logger[_0x734d('0x27')](_0x734d('0x47'),_0x3cfee4['uniqueid']);this['startAcw'](_0x3cfee4[_0x734d('0x2d')]);}else if(this['channels'][_0x3cfee4[_0x734d('0x45')]]&&this['channels'][_0x3cfee4[_0x734d('0x45')]]['attended']){logger[_0x734d('0x27')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x3cfee4[_0x734d('0x45')]);this[_0x734d('0x44')](_0x3cfee4[_0x734d('0x45')]);}}catch(_0x47cc35){logger[_0x734d('0x32')](_0x734d('0x48'),_0x47cc35[_0x734d('0x3c')]);}};Acw[_0x734d('0x1a')][_0x734d('0x49')]=function(_0x12965c){try{if(!_[_0x734d('0x4a')](this['channels'][_0x12965c[_0x734d('0x4b')]])){this[_0x734d('0x44')](_0x12965c['transfereeuniqueid']);if(this['channels'][_0x12965c['secondtransfereruniqueid']]){this[_0x734d('0x9')][_0x12965c[_0x734d('0x4c')]][_0x734d('0x42')]=!![];this[_0x734d('0x9')][_0x12965c[_0x734d('0x4d')]]=this[_0x734d('0x9')][_0x12965c[_0x734d('0x4c')]];delete this['channels'][_0x12965c[_0x734d('0x4c')]];}}else if(!_[_0x734d('0x4a')](this['channels'][_0x12965c['transfertargetuniqueid']])){this[_0x734d('0x44')](_0x12965c[_0x734d('0x4d')]);if(this[_0x734d('0x9')][_0x12965c[_0x734d('0x4e')]]){this['channels'][_0x12965c[_0x734d('0x4e')]][_0x734d('0x42')]=!![];this[_0x734d('0x9')][_0x12965c[_0x734d('0x4b')]]=this[_0x734d('0x9')][_0x12965c[_0x734d('0x4e')]];delete this['channels'][_0x12965c[_0x734d('0x4e')]];}}}catch(_0xba8f49){logger['error'](_0x734d('0x4f'),_0xba8f49[_0x734d('0x3c')]);}};Acw[_0x734d('0x1a')][_0x734d('0x14')]=function(_0x8885b7){try{if(this[_0x734d('0x9')][_0x8885b7[_0x734d('0x50')]]){logger[_0x734d('0x27')]('[%s][BLINDTRANSFER:UNIQUEID]',JSON['stringify'](_0x8885b7[_0x734d('0x50')]));this[_0x734d('0x44')](_0x8885b7[_0x734d('0x50')]);}else if(this['channels'][_0x8885b7[_0x734d('0x51')]]){logger[_0x734d('0x27')](_0x734d('0x52'),JSON[_0x734d('0x3b')](_0x8885b7[_0x734d('0x51')]));this[_0x734d('0x44')](_0x8885b7['transfererlinkedid']);}}catch(_0x2644a1){logger[_0x734d('0x32')]('[ACW][syncBlindTransfer]\x20%s',_0x2644a1['message']);}};Acw[_0x734d('0x1a')][_0x734d('0x53')]=function(_0x342d2b){try{if(this['voiceQueues'][_0x342d2b[_0x734d('0x1c')]]&&this[_0x734d('0x6')][_0x342d2b[_0x734d('0x1c')]][_0x734d('0x54')]===_0x734d('0x55')){if(this[_0x734d('0x7')][_0x342d2b[_0x734d('0x1b')]]){logger[_0x734d('0x27')](_0x734d('0x56'),_0x342d2b[_0x734d('0x2d')],_0x342d2b[_0x734d('0x1b')],_0x342d2b[_0x734d('0x1c')]);return RpcUser['savePause'](this[_0x734d('0x7')][_0x342d2b[_0x734d('0x1b')]],_0x734d('0x57'),_0x342d2b[_0x734d('0x2d')]);}}}catch(_0x4b8e18){logger[_0x734d('0x32')](_0x734d('0x58'),_0x4b8e18[_0x734d('0x3c')]);}};module[_0x734d('0x59')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index a6c1373..28051bf 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 _0x2032=['exports','bluebird','moment','util','../../config/logger','ami','asterisk','port','username','password','keepConnected','Action','promisify','action','format','error','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','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','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionSipShowRegistry','actionDeviceStateList','catch','inspect'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x2032,0xd9));var _0x2203=function(_0x3bf5e8,_0x2850ab){_0x3bf5e8=_0x3bf5e8-0x0;var _0x216e86=_0x2032[_0x3bf5e8];return _0x216e86;};'use strict';var Manager=require('asterisk-manager');var BPromise=require(_0x2203('0x0'));var moment=require(_0x2203('0x1'));var util=require(_0x2203('0x2'));var _=require('lodash');var logger=require(_0x2203('0x3'))(_0x2203('0x4'));var config=require('../../config/environment');var ami=new Manager(config[_0x2203('0x5')][_0x2203('0x6')],config[_0x2203('0x5')]['ip'],config[_0x2203('0x5')][_0x2203('0x7')],config[_0x2203('0x5')][_0x2203('0x8')],!![]);ami[_0x2203('0x9')]();ami[_0x2203('0xa')]=BPromise[_0x2203('0xb')](ami[_0x2203('0xc')]);function error(_0x5ecf9e){logger['error'](util[_0x2203('0xd')]('Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s',config[_0x2203('0x5')][_0x2203('0x7')],config[_0x2203('0x5')]['ip'],config['asterisk'][_0x2203('0x6')],util['inspect'](_0x5ecf9e,![],null)));}function close(){logger[_0x2203('0xe')](util['format'](_0x2203('0xf'),config[_0x2203('0x5')]['username'],config['asterisk']['ip'],config['asterisk']['port']));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0x2203('0xa')]({'action':'sipshowregistry'});};};ami['actionDeviceStateList']=function(){return function(){return ami[_0x2203('0xa')]({'action':_0x2203('0x10')});};};ami[_0x2203('0x11')]=function(){return function(){return ami[_0x2203('0xa')]({'action':_0x2203('0x12')});};};ami[_0x2203('0x13')]=function(){return function(){return ami[_0x2203('0xa')]({'action':_0x2203('0x14')});};};ami[_0x2203('0x15')]=function(){return function(){return ami[_0x2203('0xa')]({'action':'coreshowchannels'});};};function connect(_0x280eda){logger[_0x2203('0x16')](util['format'](_0x2203('0x17'),config[_0x2203('0x5')]['username'],config[_0x2203('0x5')]['ip'],config['asterisk'][_0x2203('0x6')]));ami[_0x2203('0x18')](_0x2203('0xe'),error);ami[_0x2203('0x18')](_0x2203('0x19'),close);}ami['on'](_0x2203('0x1a'),connect);ami['on']('shutdown',function(_0x13d3f7){logger['info'](util['format'](_0x2203('0x1b'),config['asterisk'][_0x2203('0x7')],config[_0x2203('0x5')]['ip'],config['asterisk'][_0x2203('0x6')],util['inspect'](_0x13d3f7,![],null)));});ami['on']('fullybooted',function(_0x226374){logger[_0x2203('0x16')](util[_0x2203('0xd')](_0x2203('0x1c'),config[_0x2203('0x5')][_0x2203('0x7')],config[_0x2203('0x5')]['ip'],config[_0x2203('0x5')]['port']));return BPromise[_0x2203('0x1d')]()[_0x2203('0x1e')](ami[_0x2203('0x1f')]())['then'](ami[_0x2203('0x20')]())[_0x2203('0x1e')](ami['actionSipPeerStatus']())[_0x2203('0x1e')](ami[_0x2203('0x13')]())[_0x2203('0x1e')](ami[_0x2203('0x15')]())[_0x2203('0x21')](function(_0x1df508){logger[_0x2203('0xe')]('[ami.js][fullybooted]',util[_0x2203('0x22')](_0x1df508,{'showHidden':![],'depth':null}));});});ami[_0x2203('0x18')](_0x2203('0xe'),error);ami[_0x2203('0x18')]('close',close);module[_0x2203('0x23')]=ami; \ No newline at end of file +var _0x0713=['Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','format','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','then','catch','[ami.js][fullybooted]','exports','moment','util','lodash','../../config/logger','ami','asterisk','port','username','password','keepConnected','Action','promisify','action','error'];(function(_0x16ab58,_0x591ef3){var _0x33f05f=function(_0x42f89e){while(--_0x42f89e){_0x16ab58['push'](_0x16ab58['shift']());}};_0x33f05f(++_0x591ef3);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Manager=require('asterisk-manager');var BPromise=require('bluebird');var moment=require(_0x3071('0x0'));var util=require(_0x3071('0x1'));var _=require(_0x3071('0x2'));var logger=require(_0x3071('0x3'))(_0x3071('0x4'));var config=require('../../config/environment');var ami=new Manager(config[_0x3071('0x5')][_0x3071('0x6')],config[_0x3071('0x5')]['ip'],config[_0x3071('0x5')][_0x3071('0x7')],config[_0x3071('0x5')][_0x3071('0x8')],!![]);ami[_0x3071('0x9')]();ami[_0x3071('0xa')]=BPromise[_0x3071('0xb')](ami[_0x3071('0xc')]);function error(_0x2fce7a){logger[_0x3071('0xd')](util['format'](_0x3071('0xe'),config[_0x3071('0x5')][_0x3071('0x7')],config[_0x3071('0x5')]['ip'],config[_0x3071('0x5')]['port'],util[_0x3071('0xf')](_0x2fce7a,![],null)));}function close(){logger[_0x3071('0xd')](util[_0x3071('0x10')](_0x3071('0x11'),config[_0x3071('0x5')]['username'],config['asterisk']['ip'],config[_0x3071('0x5')]['port']));}ami[_0x3071('0x12')]=function(){return function(){return ami[_0x3071('0xa')]({'action':'sipshowregistry'});};};ami[_0x3071('0x13')]=function(){return function(){return ami['Action']({'action':_0x3071('0x14')});};};ami[_0x3071('0x15')]=function(){return function(){return ami[_0x3071('0xa')]({'action':_0x3071('0x16')});};};ami[_0x3071('0x17')]=function(){return function(){return ami[_0x3071('0xa')]({'action':_0x3071('0x18')});};};ami[_0x3071('0x19')]=function(){return function(){return ami[_0x3071('0xa')]({'action':_0x3071('0x1a')});};};function connect(_0x5f3c22){logger[_0x3071('0x1b')](util[_0x3071('0x10')](_0x3071('0x1c'),config[_0x3071('0x5')][_0x3071('0x7')],config[_0x3071('0x5')]['ip'],config[_0x3071('0x5')][_0x3071('0x6')]));ami['once'](_0x3071('0xd'),error);ami[_0x3071('0x1d')](_0x3071('0x1e'),close);}ami['on']('connect',connect);ami['on'](_0x3071('0x1f'),function(_0x5cd80d){logger[_0x3071('0x1b')](util[_0x3071('0x10')](_0x3071('0x20'),config[_0x3071('0x5')][_0x3071('0x7')],config[_0x3071('0x5')]['ip'],config[_0x3071('0x5')][_0x3071('0x6')],util['inspect'](_0x5cd80d,![],null)));});ami['on']('fullybooted',function(_0x2ce48a){logger[_0x3071('0x1b')](util[_0x3071('0x10')](_0x3071('0x21'),config[_0x3071('0x5')][_0x3071('0x7')],config[_0x3071('0x5')]['ip'],config[_0x3071('0x5')][_0x3071('0x6')]));return BPromise['resolve']()[_0x3071('0x22')](ami[_0x3071('0x12')]())[_0x3071('0x22')](ami['actionDeviceStateList']())[_0x3071('0x22')](ami[_0x3071('0x15')]())[_0x3071('0x22')](ami[_0x3071('0x17')]())[_0x3071('0x22')](ami[_0x3071('0x19')]())[_0x3071('0x23')](function(_0x3921a1){logger[_0x3071('0xd')](_0x3071('0x24'),util[_0x3071('0xf')](_0x3921a1,{'showHidden':![],'depth':null}));});});ami['once']('error',error);ami[_0x3071('0x1d')](_0x3071('0x1e'),close);module[_0x3071('0x25')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index bf23ac8..8b4e140 100644 --- a/server/services/ami/client.js +++ b/server/services/ami/client.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9bde=['message','result','catch','exports','bluebird','ami','http','Request','request','debug','rpc','memberReport','error'];(function(_0x1ca4cc,_0x402c23){var _0x108010=function(_0x4c5082){while(--_0x4c5082){_0x1ca4cc['push'](_0x1ca4cc['shift']());}};_0x108010(++_0x402c23);}(_0x9bde,0xe1));var _0xe9bd=function(_0x460266,_0x1ece9f){_0x460266=_0x460266-0x0;var _0x368bf1=_0x9bde[_0x460266];return _0x368bf1;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xe9bd('0x0'));var logger=require('../../config/logger')(_0xe9bd('0x1'));var client=jayson['client'][_0xe9bd('0x2')]({'port':0x2329});client[_0xe9bd('0x3')]=function(_0x131f6a,_0x1c1b34){return new BPromise(function(_0x10822d,_0x1a4d14){return client[_0xe9bd('0x4')](_0x131f6a,_0x1c1b34)['then'](function(_0x4763e9){logger[_0xe9bd('0x5')](_0xe9bd('0x6'),_0xe9bd('0x7'),_0x131f6a,_0x1c1b34,_0x4763e9);if(_0x4763e9[_0xe9bd('0x8')]){logger[_0xe9bd('0x8')](_0xe9bd('0x6'),_0xe9bd('0x7'),_0x131f6a,_0x4763e9[_0xe9bd('0x8')][_0xe9bd('0x9')],_0x1c1b34);return _0x1a4d14(_0x4763e9['error']['message']);}else{return _0x10822d(_0x4763e9[_0xe9bd('0xa')]);}})[_0xe9bd('0xb')](function(_0x2601ac){logger['error'](_0xe9bd('0x6'),_0xe9bd('0x7'),_0x131f6a,_0x2601ac,_0x1c1b34);return _0x1a4d14(_0x2601ac);});});};module[_0xe9bd('0xc')]=client; \ No newline at end of file +var _0x9bde=['message','result','catch','exports','bluebird','ami','http','Request','request','debug','rpc','memberReport','error'];(function(_0x217a6f,_0x3ecd8b){var _0x5553f3=function(_0x24b9c0){while(--_0x24b9c0){_0x217a6f['push'](_0x217a6f['shift']());}};_0x5553f3(++_0x3ecd8b);}(_0x9bde,0xe1));var _0xe9bd=function(_0x54e8af,_0xae90bf){_0x54e8af=_0x54e8af-0x0;var _0x50255e=_0x9bde[_0x54e8af];return _0x50255e;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xe9bd('0x0'));var logger=require('../../config/logger')(_0xe9bd('0x1'));var client=jayson['client'][_0xe9bd('0x2')]({'port':0x2329});client[_0xe9bd('0x3')]=function(_0x131f6a,_0x1c1b34){return new BPromise(function(_0x10822d,_0x1a4d14){return client[_0xe9bd('0x4')](_0x131f6a,_0x1c1b34)['then'](function(_0x4763e9){logger[_0xe9bd('0x5')](_0xe9bd('0x6'),_0xe9bd('0x7'),_0x131f6a,_0x1c1b34,_0x4763e9);if(_0x4763e9[_0xe9bd('0x8')]){logger[_0xe9bd('0x8')](_0xe9bd('0x6'),_0xe9bd('0x7'),_0x131f6a,_0x4763e9[_0xe9bd('0x8')][_0xe9bd('0x9')],_0x1c1b34);return _0x1a4d14(_0x4763e9['error']['message']);}else{return _0x10822d(_0x4763e9[_0xe9bd('0xa')]);}})[_0xe9bd('0xb')](function(_0x2601ac){logger['error'](_0xe9bd('0x6'),_0xe9bd('0x7'),_0x131f6a,_0x2601ac,_0x1c1b34);return _0x1a4d14(_0x2601ac);});});};module[_0xe9bd('0xc')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index 1b9b210..023162a 100644 --- a/server/services/ami/dialer/action.js +++ b/server/services/ami/dialer/action.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6531=['UserId','VoiceQueueId','CampaignId','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','number','substring','getQueue','queue','exports','lodash','moment','string','isNil','voiceQueue','uniqueid','name','Contact','phone','lastName','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId'];(function(_0x288110,_0x583475){var _0x1fa4f2=function(_0x351177){while(--_0x351177){_0x288110['push'](_0x288110['shift']());}};_0x1fa4f2(++_0x583475);}(_0x6531,0x95));var _0x1653=function(_0x2f082a,_0x3f95e7){_0x2f082a=_0x2f082a-0x0;var _0x52d97d=_0x6531[_0x2f082a];return _0x52d97d;};'use strict';var util=require('util');var _=require(_0x1653('0x0'));var moment=require(_0x1653('0x1'));function checkNameSurname(_0x5d2335,_0x3db230,_0x31a3c1){var _0x56751b='';if(!_['isNil'](_0x3db230)&&_0x1653('0x2')===typeof _0x3db230){_0x56751b+=_0x3db230;}if(!_[_0x1653('0x3')](_0x31a3c1)&&'string'===typeof _0x31a3c1){_0x56751b+='\x20'+_0x31a3c1;}if(_0x56751b!==''){return _0x56751b;}return _0x5d2335;}function Action(_0xa0856b,_0x407c0e,_0x73680a){this[_0x1653('0x4')]=_0xa0856b;this[_0x1653('0x5')]=_0x73680a||undefined;this[_0x1653('0x6')]=checkNameSurname(_0x407c0e[_0x1653('0x7')][_0x1653('0x8')],_0x407c0e[_0x1653('0x7')]['firstName'],_0x407c0e[_0x1653('0x7')][_0x1653('0x9')]);this['number']=_0x407c0e['Contact']['phone'];this['queue']=_0xa0856b[_0x1653('0x6')];this[_0x1653('0xa')]=_0x407c0e[_0x1653('0xa')]||![];this[_0x1653('0xb')]=_0xa0856b[_0x1653('0xb')];this[_0x1653('0xc')]=_0xa0856b[_0x1653('0xc')]||0x3;this[_0x1653('0xd')]=_0x407c0e[_0x1653('0xd')];this[_0x1653('0xe')]=_0x407c0e[_0x1653('0xe')];this[_0x1653('0xf')]=_0x407c0e['countcongestionretry'];this[_0x1653('0x10')]=_0x407c0e[_0x1653('0x10')];this['countnosuchnumberretry']=_0x407c0e[_0x1653('0x11')];this[_0x1653('0x12')]=_0x407c0e[_0x1653('0x12')];this[_0x1653('0x13')]=_0x407c0e[_0x1653('0x13')];this[_0x1653('0x14')]=_0x407c0e[_0x1653('0x14')];this[_0x1653('0x15')]=_0x407c0e[_0x1653('0x15')];this[_0x1653('0x16')]=_0x407c0e[_0x1653('0x16')];this['ListId']=_0x407c0e['ListId'];this[_0x1653('0x17')]=_0x407c0e['UserId'];this['VoiceQueueId']=_0x407c0e[_0x1653('0x18')];this[_0x1653('0x19')]=_0x407c0e[_0x1653('0x19')];this['idHopper']=_0x407c0e['id'];this['ContactFirstName']=_0x407c0e[_0x1653('0x7')]['firstName']||'';this['starttime']=moment()[_0x1653('0x1a')](_0x1653('0x1b'));this[_0x1653('0x1c')]=_0x407c0e[_0x1653('0x1c')];this[_0x1653('0x1d')]=_0x407c0e[_0x1653('0x1d')];this[_0x1653('0x1e')]=_0x407c0e[_0x1653('0x1e')];this['recallme']=_0x407c0e[_0x1653('0x1f')];this[_0x1653('0x20')]='';this[_0x1653('0x21')]='';}Action[_0x1653('0x22')][_0x1653('0x23')]=function(){return util[_0x1653('0x1a')](_0x1653('0x24'),this[_0x1653('0x6')],this[_0x1653('0x4')][_0x1653('0x25')]>0x0?this[_0x1653('0x26')][_0x1653('0x27')](this[_0x1653('0x4')]['dialCutDigit']):this[_0x1653('0x26')]);};Action[_0x1653('0x22')][_0x1653('0x28')]=function(){return this[_0x1653('0x29')];};module[_0x1653('0x2a')]=Action; \ No newline at end of file +var _0xbc07=['countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','substring','exports','lodash','moment','isNil','string','voiceQueue','uniqueid','name','phone','firstName','Contact','number','queue','active','type','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry'];(function(_0x27766b,_0x155221){var _0x3de10e=function(_0xebc741){while(--_0xebc741){_0x27766b['push'](_0x27766b['shift']());}};_0x3de10e(++_0x155221);}(_0xbc07,0x66));var _0x7bc0=function(_0x238e5c,_0x3755d){_0x238e5c=_0x238e5c-0x0;var _0x20ba1b=_0xbc07[_0x238e5c];return _0x20ba1b;};'use strict';var util=require('util');var _=require(_0x7bc0('0x0'));var moment=require(_0x7bc0('0x1'));function checkNameSurname(_0x3cdbce,_0x469dc9,_0x1bbae6){var _0x693460='';if(!_[_0x7bc0('0x2')](_0x469dc9)&&_0x7bc0('0x3')===typeof _0x469dc9){_0x693460+=_0x469dc9;}if(!_[_0x7bc0('0x2')](_0x1bbae6)&&_0x7bc0('0x3')===typeof _0x1bbae6){_0x693460+='\x20'+_0x1bbae6;}if(_0x693460!==''){return _0x693460;}return _0x3cdbce;}function Action(_0x3f0b95,_0x3402fb,_0x56675f){this[_0x7bc0('0x4')]=_0x3f0b95;this[_0x7bc0('0x5')]=_0x56675f||undefined;this[_0x7bc0('0x6')]=checkNameSurname(_0x3402fb['Contact'][_0x7bc0('0x7')],_0x3402fb['Contact'][_0x7bc0('0x8')],_0x3402fb[_0x7bc0('0x9')]['lastName']);this[_0x7bc0('0xa')]=_0x3402fb[_0x7bc0('0x9')][_0x7bc0('0x7')];this[_0x7bc0('0xb')]=_0x3f0b95[_0x7bc0('0x6')];this[_0x7bc0('0xc')]=_0x3402fb[_0x7bc0('0xc')]||![];this[_0x7bc0('0xd')]=_0x3f0b95[_0x7bc0('0xd')];this['dialQueueTimeout']=_0x3f0b95['dialQueueTimeout']||0x3;this[_0x7bc0('0xe')]=_0x3402fb[_0x7bc0('0xe')];this[_0x7bc0('0xf')]=_0x3402fb[_0x7bc0('0xf')];this[_0x7bc0('0x10')]=_0x3402fb[_0x7bc0('0x10')];this['countnoanswerretry']=_0x3402fb[_0x7bc0('0x11')];this[_0x7bc0('0x12')]=_0x3402fb[_0x7bc0('0x12')];this[_0x7bc0('0x13')]=_0x3402fb['countdropretry'];this['countabandonedretry']=_0x3402fb[_0x7bc0('0x14')];this[_0x7bc0('0x15')]=_0x3402fb[_0x7bc0('0x15')];this[_0x7bc0('0x16')]=_0x3402fb[_0x7bc0('0x16')];this['ContactId']=_0x3402fb[_0x7bc0('0x17')];this[_0x7bc0('0x18')]=_0x3402fb[_0x7bc0('0x18')];this[_0x7bc0('0x19')]=_0x3402fb[_0x7bc0('0x19')];this[_0x7bc0('0x1a')]=_0x3402fb[_0x7bc0('0x1a')];this[_0x7bc0('0x1b')]=_0x3402fb['CampaignId'];this['idHopper']=_0x3402fb['id'];this['ContactFirstName']=_0x3402fb['Contact'][_0x7bc0('0x8')]||'';this[_0x7bc0('0x1c')]=moment()[_0x7bc0('0x1d')](_0x7bc0('0x1e'));this['callback']=_0x3402fb['callback'];this[_0x7bc0('0x1f')]=_0x3402fb[_0x7bc0('0x1f')];this[_0x7bc0('0x20')]=_0x3402fb[_0x7bc0('0x20')];this[_0x7bc0('0x21')]=_0x3402fb['recallme'];this[_0x7bc0('0x22')]='';this[_0x7bc0('0x23')]='';}Action['prototype'][_0x7bc0('0x24')]=function(){return util[_0x7bc0('0x1d')](_0x7bc0('0x25'),this[_0x7bc0('0x6')],this[_0x7bc0('0x4')][_0x7bc0('0x26')]>0x0?this['number'][_0x7bc0('0x27')](this[_0x7bc0('0x4')][_0x7bc0('0x26')]):this['number']);};Action['prototype']['getQueue']=function(){return this[_0x7bc0('0xb')];};module[_0x7bc0('0x28')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index ab4686e..a5d966f 100644 --- a/server/services/ami/dialer/agentComplete.js +++ b/server/services/ami/dialer/agentComplete.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x84da=['UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','milliseconds','diff','seconds','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','holdtime','answertime','talktime','queue','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId'];(function(_0x4947d7,_0x270f05){var _0x4b6e94=function(_0x469ae4){while(--_0x469ae4){_0x4947d7['push'](_0x4947d7['shift']());}};_0x4b6e94(++_0x270f05);}(_0x84da,0x186));var _0xa84d=function(_0x38c990,_0x395321){_0x38c990=_0x38c990-0x0;var _0x5a85e6=_0x84da[_0x38c990];return _0x5a85e6;};'use strict';var util=require('util');var _=require(_0xa84d('0x0'));var moment=require('moment');function getSeconds(_0xf3fe36,_0x24352d){var _0x287fc1=moment(_0xf3fe36)[_0xa84d('0x1')](0x0);var _0x277b62=moment(_0x24352d)[_0xa84d('0x1')](0x0);return _0x287fc1[_0xa84d('0x2')](_0x277b62,_0xa84d('0x3'));}function AgentComplete(_0x1ea278,_0x2872ae){this[_0xa84d('0x4')]=0x4;this[_0xa84d('0x5')]=_0xa84d('0x6');this[_0xa84d('0x7')]=_0x1ea278[_0xa84d('0x7')];this[_0xa84d('0x8')]=_0x1ea278[_0xa84d('0x8')];this[_0xa84d('0x9')]=_0x1ea278['type']===_0xa84d('0xa')?'queue':_0x1ea278[_0xa84d('0x8')];this[_0xa84d('0xb')]=_0x1ea278['countbusyretry'];this['countcongestionretry']=_0x1ea278[_0xa84d('0xc')];this[_0xa84d('0xd')]=_0x1ea278['countnoanswerretry'];this[_0xa84d('0xe')]=_0x1ea278[_0xa84d('0xb')]+_0x1ea278['countcongestionretry']+_0x1ea278[_0xa84d('0xd')]+_0x1ea278[_0xa84d('0xf')]+_0x1ea278[_0xa84d('0x10')]+_0x1ea278[_0xa84d('0x11')]+_0x1ea278['countmachineretry']+_0x1ea278[_0xa84d('0x12')];this[_0xa84d('0xf')]=_0x1ea278['countnosuchnumberretry'];this[_0xa84d('0x10')]=_0x1ea278[_0xa84d('0x10')];this[_0xa84d('0x11')]=_0x1ea278[_0xa84d('0x11')];this[_0xa84d('0x13')]=_0x1ea278['countmachineretry'];this[_0xa84d('0x12')]=_0x1ea278[_0xa84d('0x12')];this[_0xa84d('0x14')]=_0x2872ae[_0xa84d('0x14')];this[_0xa84d('0x15')]=_0x1ea278[_0xa84d('0x16')];this[_0xa84d('0x17')]=_0x1ea278[_0xa84d('0x18')];this[_0xa84d('0x19')]=_0x1ea278[_0xa84d('0x19')];this[_0xa84d('0x1a')]=_0x1ea278['responsetime'];this['answertime']=_0x1ea278['answertime'];this[_0xa84d('0x1b')]=moment()[_0xa84d('0x1c')](_0xa84d('0x1d'));this['ringtime']=getSeconds(_0x1ea278['responsetime'],_0x1ea278['starttime']);this[_0xa84d('0x1e')]=getSeconds(_0x1ea278[_0xa84d('0x1f')],_0x1ea278[_0xa84d('0x1a')]);this[_0xa84d('0x20')]=getSeconds(this[_0xa84d('0x1b')],_0x1ea278[_0xa84d('0x1f')]);this[_0xa84d('0x21')]=_0x2872ae[_0xa84d('0x21')];this[_0xa84d('0x22')]=_0x2872ae['membername'];this['reason']=_0x2872ae[_0xa84d('0x23')];this[_0xa84d('0x24')]=_0x1ea278['callback'];this[_0xa84d('0x25')]=_0x1ea278[_0xa84d('0x25')];this[_0xa84d('0x26')]=_0x1ea278[_0xa84d('0x26')];this[_0xa84d('0x27')]=_0x1ea278['recallme'];this[_0xa84d('0x28')]=_0x1ea278[_0xa84d('0x28')];this[_0xa84d('0x29')]=_0x1ea278[_0xa84d('0x29')];this[_0xa84d('0x2a')]=_0x1ea278[_0xa84d('0x2a')];this['VoiceQueueId']=_0x1ea278[_0xa84d('0x2b')];this[_0xa84d('0x2c')]=_0x1ea278['CampaignId'];this['originatecalleridnum']=_0x1ea278[_0xa84d('0x2d')]||'';this[_0xa84d('0x2e')]=_0x1ea278[_0xa84d('0x2e')]||'';}module[_0xa84d('0x2f')]=AgentComplete; \ No newline at end of file +var _0xcc6f=['UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','moment','milliseconds','seconds','state','Answer','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','starttime','holdtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId'];(function(_0x2ee186,_0x50c353){var _0x4bd832=function(_0x4130e6){while(--_0x4130e6){_0x2ee186['push'](_0x2ee186['shift']());}};_0x4bd832(++_0x50c353);}(_0xcc6f,0x1ad));var _0xfcc6=function(_0x82129b,_0x484ae9){_0x82129b=_0x82129b-0x0;var _0x2ae5dc=_0xcc6f[_0x82129b];return _0x2ae5dc;};'use strict';var util=require(_0xfcc6('0x0'));var _=require('lodash');var moment=require(_0xfcc6('0x1'));function getSeconds(_0x2a7428,_0x4cf17f){var _0x1b1495=moment(_0x2a7428)['milliseconds'](0x0);var _0x3ccadd=moment(_0x4cf17f)[_0xfcc6('0x2')](0x0);return _0x1b1495['diff'](_0x3ccadd,_0xfcc6('0x3'));}function AgentComplete(_0x48cc7f,_0x34da2a){this[_0xfcc6('0x4')]=0x4;this['statedesc']=_0xfcc6('0x5');this['scheduledat']=_0x48cc7f[_0xfcc6('0x6')];this[_0xfcc6('0x7')]=_0x48cc7f[_0xfcc6('0x7')];this[_0xfcc6('0x8')]=_0x48cc7f[_0xfcc6('0x7')]==='outbound'?_0xfcc6('0x9'):_0x48cc7f['type'];this[_0xfcc6('0xa')]=_0x48cc7f['countbusyretry'];this[_0xfcc6('0xb')]=_0x48cc7f[_0xfcc6('0xb')];this['countnoanswerretry']=_0x48cc7f[_0xfcc6('0xc')];this[_0xfcc6('0xd')]=_0x48cc7f[_0xfcc6('0xa')]+_0x48cc7f['countcongestionretry']+_0x48cc7f[_0xfcc6('0xc')]+_0x48cc7f[_0xfcc6('0xe')]+_0x48cc7f[_0xfcc6('0xf')]+_0x48cc7f[_0xfcc6('0x10')]+_0x48cc7f[_0xfcc6('0x11')]+_0x48cc7f[_0xfcc6('0x12')];this[_0xfcc6('0xe')]=_0x48cc7f['countnosuchnumberretry'];this[_0xfcc6('0xf')]=_0x48cc7f[_0xfcc6('0xf')];this[_0xfcc6('0x10')]=_0x48cc7f[_0xfcc6('0x10')];this[_0xfcc6('0x11')]=_0x48cc7f[_0xfcc6('0x11')];this[_0xfcc6('0x12')]=_0x48cc7f[_0xfcc6('0x12')];this['uniqueid']=_0x34da2a[_0xfcc6('0x13')];this[_0xfcc6('0x14')]=_0x48cc7f[_0xfcc6('0x15')];this[_0xfcc6('0x16')]=_0x48cc7f[_0xfcc6('0x17')];this['starttime']=_0x48cc7f['starttime'];this[_0xfcc6('0x18')]=_0x48cc7f[_0xfcc6('0x18')];this[_0xfcc6('0x19')]=_0x48cc7f[_0xfcc6('0x19')];this[_0xfcc6('0x1a')]=moment()[_0xfcc6('0x1b')](_0xfcc6('0x1c'));this[_0xfcc6('0x1d')]=getSeconds(_0x48cc7f['responsetime'],_0x48cc7f[_0xfcc6('0x1e')]);this[_0xfcc6('0x1f')]=getSeconds(_0x48cc7f[_0xfcc6('0x19')],_0x48cc7f[_0xfcc6('0x18')]);this[_0xfcc6('0x20')]=getSeconds(this[_0xfcc6('0x1a')],_0x48cc7f['answertime']);this['queue']=_0x34da2a[_0xfcc6('0x9')];this[_0xfcc6('0x21')]=_0x34da2a[_0xfcc6('0x21')];this[_0xfcc6('0x22')]=_0x34da2a['reason'];this[_0xfcc6('0x23')]=_0x48cc7f['callback'];this['callbackuniqueid']=_0x48cc7f[_0xfcc6('0x24')];this[_0xfcc6('0x25')]=_0x48cc7f[_0xfcc6('0x25')];this['recallme']=_0x48cc7f[_0xfcc6('0x26')];this['ContactId']=_0x48cc7f[_0xfcc6('0x27')];this[_0xfcc6('0x28')]=_0x48cc7f[_0xfcc6('0x28')];this[_0xfcc6('0x29')]=_0x48cc7f[_0xfcc6('0x29')];this[_0xfcc6('0x2a')]=_0x48cc7f['VoiceQueueId'];this[_0xfcc6('0x2b')]=_0x48cc7f[_0xfcc6('0x2b')];this[_0xfcc6('0x2c')]=_0x48cc7f[_0xfcc6('0x2c')]||'';this[_0xfcc6('0x2d')]=_0x48cc7f[_0xfcc6('0x2d')]||'';}module[_0xfcc6('0x2e')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index aa423ee..1b1c43d 100644 --- a/server/services/ami/dialer/final.js +++ b/server/services/ami/dialer/final.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7118=['talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countdropretry','calleridname','calleridnum','starttime','endtime','responsetime','ringtime','holdtime'];(function(_0x19cfac,_0x3745dc){var _0x25d2a5=function(_0x2bad78){while(--_0x2bad78){_0x19cfac['push'](_0x19cfac['shift']());}};_0x25d2a5(++_0x3745dc);}(_0x7118,0x159));var _0x8711=function(_0x5785d6,_0x38ebc7){_0x5785d6=_0x5785d6-0x0;var _0x45ccbd=_0x7118[_0x5785d6];return _0x45ccbd;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x8711('0x0'));function getSeconds(_0xf50b2e,_0x5c64d4){var _0x1758c5=moment(_0xf50b2e)[_0x8711('0x1')](0x0);var _0x348e88=moment(_0x5c64d4)[_0x8711('0x1')](0x0);return _0x1758c5[_0x8711('0x2')](_0x348e88,_0x8711('0x3'));}function Final(_0x206b82){this['uniqueid']=_0x206b82[_0x8711('0x4')];this[_0x8711('0x5')]=_0x206b82[_0x8711('0x5')];this[_0x8711('0x6')]=_0x206b82[_0x8711('0x6')];this[_0x8711('0x7')]=_0x206b82[_0x8711('0x6')]===_0x8711('0x8')?_0x8711('0x9'):_0x206b82[_0x8711('0x6')];this[_0x8711('0xa')]=_0x206b82['countbusyretry'];this['countcongestionretry']=_0x206b82[_0x8711('0xb')];this[_0x8711('0xc')]=_0x206b82[_0x8711('0xc')];this['countglobal']=_0x206b82['countbusyretry']+_0x206b82[_0x8711('0xb')]+_0x206b82[_0x8711('0xc')]+_0x206b82['countnosuchnumberretry']+_0x206b82['countdropretry']+_0x206b82[_0x8711('0xd')]+_0x206b82[_0x8711('0xe')]+_0x206b82[_0x8711('0xf')];this[_0x8711('0x10')]=_0x206b82[_0x8711('0x10')];this[_0x8711('0x11')]=_0x206b82[_0x8711('0x11')];this['countabandonedretry']=_0x206b82[_0x8711('0xd')];this[_0x8711('0xe')]=_0x206b82[_0x8711('0xe')];this[_0x8711('0xf')]=_0x206b82[_0x8711('0xf')];this[_0x8711('0x9')]=_0x206b82['queue'];this[_0x8711('0x12')]=_0x206b82[_0x8711('0x12')];this[_0x8711('0x13')]=_0x206b82[_0x8711('0x13')];this[_0x8711('0x14')]=_0x206b82['starttime'];this['responsetime']=_0x206b82['responsetime'];this[_0x8711('0x15')]=_0x206b82[_0x8711('0x16')];this[_0x8711('0x17')]=_0x206b82['ringtime']||0x0;this['holdtime']=_0x206b82[_0x8711('0x18')]||0x0;this[_0x8711('0x19')]=_0x206b82[_0x8711('0x19')]||0x0;this[_0x8711('0x1a')]=_0x206b82[_0x8711('0x1a')];this[_0x8711('0x1b')]=_0x206b82[_0x8711('0x1b')];this[_0x8711('0x1c')]=_0x206b82[_0x8711('0x1c')];this[_0x8711('0x1d')]=_0x206b82['recallme'];this[_0x8711('0x1e')]=_0x206b82[_0x8711('0x1e')];this[_0x8711('0x1f')]=_0x206b82[_0x8711('0x1f')];this['UserId']=_0x206b82[_0x8711('0x20')];this[_0x8711('0x21')]=_0x206b82[_0x8711('0x21')];this['CampaignId']=_0x206b82[_0x8711('0x22')];this[_0x8711('0x23')]=_0x206b82[_0x8711('0x23')]||'';this[_0x8711('0x24')]=_0x206b82[_0x8711('0x24')]||'';}module['exports']=Final; \ No newline at end of file +var _0xe015=['countnosuchnumberretry','calleridname','calleridnum','responsetime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','uniqueid','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry'];(function(_0x7c599a,_0x3c106e){var _0x1b0c6e=function(_0x2123be){while(--_0x2123be){_0x7c599a['push'](_0x7c599a['shift']());}};_0x1b0c6e(++_0x3c106e);}(_0xe015,0x13b));var _0x5e01=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xe015[_0x502c7d];return _0x30b7ed;};'use strict';var util=require(_0x5e01('0x0'));var _=require(_0x5e01('0x1'));var moment=require(_0x5e01('0x2'));function getSeconds(_0x5811ae,_0x51f689){var _0x46ed0d=moment(_0x5811ae)['milliseconds'](0x0);var _0x2136cf=moment(_0x51f689)[_0x5e01('0x3')](0x0);return _0x46ed0d[_0x5e01('0x4')](_0x2136cf,_0x5e01('0x5'));}function Final(_0x4ac3f1){this[_0x5e01('0x6')]=_0x4ac3f1[_0x5e01('0x6')];this['scheduledat']=_0x4ac3f1['scheduledat'];this[_0x5e01('0x7')]=_0x4ac3f1[_0x5e01('0x7')];this[_0x5e01('0x8')]=_0x4ac3f1[_0x5e01('0x7')]===_0x5e01('0x9')?_0x5e01('0xa'):_0x4ac3f1['type'];this[_0x5e01('0xb')]=_0x4ac3f1['countbusyretry'];this[_0x5e01('0xc')]=_0x4ac3f1['countcongestionretry'];this[_0x5e01('0xd')]=_0x4ac3f1[_0x5e01('0xd')];this['countglobal']=_0x4ac3f1[_0x5e01('0xb')]+_0x4ac3f1[_0x5e01('0xc')]+_0x4ac3f1['countnoanswerretry']+_0x4ac3f1['countnosuchnumberretry']+_0x4ac3f1[_0x5e01('0xe')]+_0x4ac3f1[_0x5e01('0xf')]+_0x4ac3f1[_0x5e01('0x10')]+_0x4ac3f1[_0x5e01('0x11')];this[_0x5e01('0x12')]=_0x4ac3f1[_0x5e01('0x12')];this['countdropretry']=_0x4ac3f1[_0x5e01('0xe')];this['countabandonedretry']=_0x4ac3f1['countabandonedretry'];this[_0x5e01('0x10')]=_0x4ac3f1[_0x5e01('0x10')];this['countagentrejectretry']=_0x4ac3f1[_0x5e01('0x11')];this['queue']=_0x4ac3f1[_0x5e01('0xa')];this['calleridname']=_0x4ac3f1[_0x5e01('0x13')];this['calleridnum']=_0x4ac3f1[_0x5e01('0x14')];this['starttime']=_0x4ac3f1['starttime'];this[_0x5e01('0x15')]=_0x4ac3f1[_0x5e01('0x15')];this['endtime']=_0x4ac3f1[_0x5e01('0x15')];this[_0x5e01('0x16')]=_0x4ac3f1[_0x5e01('0x16')]||0x0;this[_0x5e01('0x17')]=_0x4ac3f1[_0x5e01('0x17')]||0x0;this[_0x5e01('0x18')]=_0x4ac3f1[_0x5e01('0x18')]||0x0;this[_0x5e01('0x19')]=_0x4ac3f1['callback'];this[_0x5e01('0x1a')]=_0x4ac3f1[_0x5e01('0x1a')];this['callbackat']=_0x4ac3f1[_0x5e01('0x1b')];this[_0x5e01('0x1c')]=_0x4ac3f1[_0x5e01('0x1c')];this[_0x5e01('0x1d')]=_0x4ac3f1[_0x5e01('0x1d')];this[_0x5e01('0x1e')]=_0x4ac3f1['ListId'];this[_0x5e01('0x1f')]=_0x4ac3f1[_0x5e01('0x1f')];this[_0x5e01('0x20')]=_0x4ac3f1[_0x5e01('0x20')];this['CampaignId']=_0x4ac3f1[_0x5e01('0x21')];this[_0x5e01('0x22')]=_0x4ac3f1[_0x5e01('0x22')]||'';this['originatecalleridname']=_0x4ac3f1[_0x5e01('0x23')]||'';}module[_0x5e01('0x24')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index fa9a412..b7baed6 100644 --- a/server/services/ami/dialer/hangup.js +++ b/server/services/ami/dialer/hangup.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6377=['countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','name','calleridnum','number','starttime','responsetime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','IVR','cause-txt','callback','callbackuniqueid','callbackat','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','util','lodash','moment','milliseconds','diff','seconds','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry'];(function(_0x695dbc,_0x2d30ef){var _0x344fe6=function(_0x159d60){while(--_0x159d60){_0x695dbc['push'](_0x695dbc['shift']());}};_0x344fe6(++_0x2d30ef);}(_0x6377,0x1a9));var _0x7637=function(_0x3641d5,_0x11626c){_0x3641d5=_0x3641d5-0x0;var _0x762e42=_0x6377[_0x3641d5];return _0x762e42;};'use strict';var util=require(_0x7637('0x0'));var _=require(_0x7637('0x1'));var moment=require(_0x7637('0x2'));function getSeconds(_0x1afdf3,_0x17c691){var _0x3820a1=moment(_0x1afdf3)[_0x7637('0x3')](0x0);var _0x36c711=moment(_0x17c691)['milliseconds'](0x0);return _0x3820a1[_0x7637('0x4')](_0x36c711,_0x7637('0x5'));}function Hangup(_0x59bbe,_0x3441cf){this[_0x7637('0x6')]=0x4;this[_0x7637('0x7')]=_0x7637('0x8');this[_0x7637('0x9')]=_0x59bbe['scheduledat'];this[_0x7637('0xa')]=_0x59bbe[_0x7637('0xa')];this[_0x7637('0xb')]=_0x59bbe[_0x7637('0xa')]===_0x7637('0xc')?_0x7637('0xd'):_0x59bbe[_0x7637('0xa')];this[_0x7637('0xe')]=_0x59bbe[_0x7637('0xe')];this['countcongestionretry']=_0x59bbe[_0x7637('0xf')];this[_0x7637('0x10')]=_0x59bbe[_0x7637('0x10')];this[_0x7637('0x11')]=_0x59bbe[_0x7637('0xe')]+_0x59bbe['countcongestionretry']+_0x59bbe[_0x7637('0x10')]+_0x59bbe[_0x7637('0x12')]+_0x59bbe[_0x7637('0x13')]+_0x59bbe[_0x7637('0x14')]+_0x59bbe[_0x7637('0x15')]+_0x59bbe[_0x7637('0x16')];this[_0x7637('0x12')]=_0x59bbe[_0x7637('0x12')];this[_0x7637('0x13')]=_0x59bbe[_0x7637('0x13')];this[_0x7637('0x14')]=_0x59bbe[_0x7637('0x14')];this[_0x7637('0x15')]=_0x59bbe[_0x7637('0x15')];this[_0x7637('0x16')]=_0x59bbe[_0x7637('0x16')];this['uniqueid']=_0x3441cf['uniqueid'];this['calleridname']=_0x59bbe[_0x7637('0x17')];this[_0x7637('0x18')]=_0x59bbe[_0x7637('0x19')];this[_0x7637('0x1a')]=_0x59bbe['starttime'];this[_0x7637('0x1b')]=_0x59bbe[_0x7637('0x1b')];this['endtime']=moment()[_0x7637('0x1c')](_0x7637('0x1d'));this[_0x7637('0x1e')]=getSeconds(_0x59bbe[_0x7637('0x1b')],_0x59bbe['starttime']);this[_0x7637('0x1f')]=0x0;this[_0x7637('0x20')]=getSeconds(this['endtime'],_0x59bbe[_0x7637('0x1b')]);this['queue']=_0x59bbe[_0x7637('0xd')];this['membername']=_0x7637('0x21');this['reason']=_0x3441cf[_0x7637('0x22')];this[_0x7637('0x23')]=_0x59bbe[_0x7637('0x23')];this[_0x7637('0x24')]=_0x59bbe[_0x7637('0x24')];this[_0x7637('0x25')]=_0x59bbe[_0x7637('0x25')];this['recallme']=_0x59bbe['recallme'];this[_0x7637('0x26')]=_0x59bbe[_0x7637('0x26')];this[_0x7637('0x27')]=_0x59bbe[_0x7637('0x27')];this[_0x7637('0x28')]=_0x59bbe[_0x7637('0x28')];this[_0x7637('0x29')]=_0x59bbe[_0x7637('0x29')];this[_0x7637('0x2a')]=_0x59bbe[_0x7637('0x2a')];}module[_0x7637('0x2b')]=Hangup; \ No newline at end of file +var _0xb11f=['util','lodash','milliseconds','diff','seconds','state','statedesc','Answer','scheduledat','type','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','queue','membername','IVR','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','CampaignId','exports'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0xb11f,0x195));var _0xfb11=function(_0x3af22d,_0x5ac369){_0x3af22d=_0x3af22d-0x0;var _0x4a595b=_0xb11f[_0x3af22d];return _0x4a595b;};'use strict';var util=require(_0xfb11('0x0'));var _=require(_0xfb11('0x1'));var moment=require('moment');function getSeconds(_0x2e48a1,_0x58a93a){var _0x4a66a8=moment(_0x2e48a1)['milliseconds'](0x0);var _0x5233ab=moment(_0x58a93a)[_0xfb11('0x2')](0x0);return _0x4a66a8[_0xfb11('0x3')](_0x5233ab,_0xfb11('0x4'));}function Hangup(_0x9aa2ee,_0x53ac6b){this[_0xfb11('0x5')]=0x4;this[_0xfb11('0x6')]=_0xfb11('0x7');this[_0xfb11('0x8')]=_0x9aa2ee['scheduledat'];this[_0xfb11('0x9')]=_0x9aa2ee[_0xfb11('0x9')];this['campaigntype']=_0x9aa2ee[_0xfb11('0x9')]==='outbound'?'queue':_0x9aa2ee[_0xfb11('0x9')];this[_0xfb11('0xa')]=_0x9aa2ee['countbusyretry'];this[_0xfb11('0xb')]=_0x9aa2ee['countcongestionretry'];this[_0xfb11('0xc')]=_0x9aa2ee[_0xfb11('0xc')];this[_0xfb11('0xd')]=_0x9aa2ee['countbusyretry']+_0x9aa2ee[_0xfb11('0xb')]+_0x9aa2ee[_0xfb11('0xc')]+_0x9aa2ee[_0xfb11('0xe')]+_0x9aa2ee[_0xfb11('0xf')]+_0x9aa2ee[_0xfb11('0x10')]+_0x9aa2ee[_0xfb11('0x11')]+_0x9aa2ee[_0xfb11('0x12')];this['countnosuchnumberretry']=_0x9aa2ee['countnosuchnumberretry'];this[_0xfb11('0xf')]=_0x9aa2ee[_0xfb11('0xf')];this[_0xfb11('0x10')]=_0x9aa2ee[_0xfb11('0x10')];this[_0xfb11('0x11')]=_0x9aa2ee['countmachineretry'];this[_0xfb11('0x12')]=_0x9aa2ee[_0xfb11('0x12')];this['uniqueid']=_0x53ac6b[_0xfb11('0x13')];this[_0xfb11('0x14')]=_0x9aa2ee[_0xfb11('0x15')];this[_0xfb11('0x16')]=_0x9aa2ee[_0xfb11('0x17')];this[_0xfb11('0x18')]=_0x9aa2ee[_0xfb11('0x18')];this[_0xfb11('0x19')]=_0x9aa2ee[_0xfb11('0x19')];this[_0xfb11('0x1a')]=moment()[_0xfb11('0x1b')](_0xfb11('0x1c'));this[_0xfb11('0x1d')]=getSeconds(_0x9aa2ee['responsetime'],_0x9aa2ee[_0xfb11('0x18')]);this[_0xfb11('0x1e')]=0x0;this[_0xfb11('0x1f')]=getSeconds(this[_0xfb11('0x1a')],_0x9aa2ee['responsetime']);this[_0xfb11('0x20')]=_0x9aa2ee[_0xfb11('0x20')];this[_0xfb11('0x21')]=_0xfb11('0x22');this['reason']=_0x53ac6b[_0xfb11('0x23')];this[_0xfb11('0x24')]=_0x9aa2ee['callback'];this[_0xfb11('0x25')]=_0x9aa2ee['callbackuniqueid'];this[_0xfb11('0x26')]=_0x9aa2ee[_0xfb11('0x26')];this['recallme']=_0x9aa2ee[_0xfb11('0x27')];this[_0xfb11('0x28')]=_0x9aa2ee['ContactId'];this['ListId']=_0x9aa2ee[_0xfb11('0x29')];this[_0xfb11('0x2a')]=_0x9aa2ee[_0xfb11('0x2a')];this['VoiceQueueId']=_0x9aa2ee['VoiceQueueId'];this[_0xfb11('0x2b')]=_0x9aa2ee[_0xfb11('0x2b')];}module[_0xfb11('0x2c')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index cc15340..a206bd2 100644 --- a/server/services/ami/dialer/history.js +++ b/server/services/ami/dialer/history.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7f61=['lodash','moment','milliseconds','diff','uniqueid','scheduledat','type','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','number','starttime','responsetime','endtime','ringtime','holdtime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname'];(function(_0xddd177,_0x560dd6){var _0x443799=function(_0x37f143){while(--_0x37f143){_0xddd177['push'](_0xddd177['shift']());}};_0x443799(++_0x560dd6);}(_0x7f61,0xee));var _0x17f6=function(_0xb87f93,_0x4f5286){_0xb87f93=_0xb87f93-0x0;var _0x569d2d=_0x7f61[_0xb87f93];return _0x569d2d;};'use strict';var util=require('util');var _=require(_0x17f6('0x0'));var moment=require(_0x17f6('0x1'));function getSeconds(_0x2a879d,_0x414dca){var _0x25beee=moment(_0x2a879d)[_0x17f6('0x2')](0x0);var _0x4e73d7=moment(_0x414dca)[_0x17f6('0x2')](0x0);return _0x25beee[_0x17f6('0x3')](_0x4e73d7,'seconds');}function History(_0x555e46){this[_0x17f6('0x4')]=_0x555e46[_0x17f6('0x4')];this[_0x17f6('0x5')]=_0x555e46[_0x17f6('0x5')]||undefined;this[_0x17f6('0x6')]=_0x555e46[_0x17f6('0x6')];this['campaigntype']=_0x555e46['type']==='outbound'?_0x17f6('0x7'):_0x555e46[_0x17f6('0x6')];this[_0x17f6('0x8')]=_0x555e46[_0x17f6('0x8')];this['countcongestionretry']=_0x555e46[_0x17f6('0x9')];this[_0x17f6('0xa')]=_0x555e46[_0x17f6('0xa')];this[_0x17f6('0xb')]=_0x555e46[_0x17f6('0x8')]+_0x555e46['countcongestionretry']+_0x555e46[_0x17f6('0xa')]+_0x555e46[_0x17f6('0xc')]+_0x555e46[_0x17f6('0xd')]+_0x555e46[_0x17f6('0xe')]+_0x555e46[_0x17f6('0xf')]+_0x555e46[_0x17f6('0x10')];this[_0x17f6('0xc')]=_0x555e46[_0x17f6('0xc')];this[_0x17f6('0xd')]=_0x555e46['countdropretry'];this[_0x17f6('0xe')]=_0x555e46[_0x17f6('0xe')];this[_0x17f6('0xf')]=_0x555e46[_0x17f6('0xf')];this[_0x17f6('0x10')]=_0x555e46[_0x17f6('0x10')];this[_0x17f6('0x7')]=_0x555e46['queue'];this['calleridname']=_0x555e46['name'];this['calleridnum']=_0x555e46[_0x17f6('0x11')];this['starttime']=_0x555e46[_0x17f6('0x12')];this[_0x17f6('0x13')]=_0x555e46[_0x17f6('0x13')];this[_0x17f6('0x14')]=_0x555e46[_0x17f6('0x13')];this[_0x17f6('0x15')]=getSeconds(_0x555e46[_0x17f6('0x13')],_0x555e46[_0x17f6('0x12')]);this[_0x17f6('0x16')]=0x0;this['talktime']=0x0;this[_0x17f6('0x17')]=_0x555e46[_0x17f6('0x17')];this[_0x17f6('0x18')]=_0x555e46['callbackuniqueid'];this[_0x17f6('0x19')]=_0x555e46['callbackat'];this[_0x17f6('0x1a')]=_0x555e46['recallme'];this[_0x17f6('0x1b')]=_0x555e46[_0x17f6('0x1b')];this[_0x17f6('0x1c')]=_0x555e46[_0x17f6('0x1c')];this[_0x17f6('0x1d')]=_0x555e46[_0x17f6('0x1d')];this[_0x17f6('0x1e')]=_0x555e46[_0x17f6('0x1e')];this[_0x17f6('0x1f')]=_0x555e46[_0x17f6('0x1f')];this['originatecalleridnum']=_0x555e46[_0x17f6('0x20')]||'';this[_0x17f6('0x21')]=_0x555e46['originatecalleridname']||'';}module['exports']=History; \ No newline at end of file +var _0x361e=['countmachineretry','countdropretry','countagentrejectretry','queue','calleridname','calleridnum','number','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry'];(function(_0x2d7c3d,_0x4804a1){var _0xd0cb72=function(_0x102225){while(--_0x102225){_0x2d7c3d['push'](_0x2d7c3d['shift']());}};_0xd0cb72(++_0x4804a1);}(_0x361e,0x6b));var _0xe361=function(_0x33566a,_0x1e741d){_0x33566a=_0x33566a-0x0;var _0x347a51=_0x361e[_0x33566a];return _0x347a51;};'use strict';var util=require(_0xe361('0x0'));var _=require(_0xe361('0x1'));var moment=require(_0xe361('0x2'));function getSeconds(_0x282ced,_0x43fad6){var _0x5f575d=moment(_0x282ced)[_0xe361('0x3')](0x0);var _0x4f5bc8=moment(_0x43fad6)[_0xe361('0x3')](0x0);return _0x5f575d[_0xe361('0x4')](_0x4f5bc8,_0xe361('0x5'));}function History(_0x503f3e){this[_0xe361('0x6')]=_0x503f3e[_0xe361('0x6')];this[_0xe361('0x7')]=_0x503f3e[_0xe361('0x7')]||undefined;this[_0xe361('0x8')]=_0x503f3e[_0xe361('0x8')];this[_0xe361('0x9')]=_0x503f3e['type']===_0xe361('0xa')?'queue':_0x503f3e[_0xe361('0x8')];this[_0xe361('0xb')]=_0x503f3e['countbusyretry'];this[_0xe361('0xc')]=_0x503f3e[_0xe361('0xc')];this[_0xe361('0xd')]=_0x503f3e[_0xe361('0xd')];this['countglobal']=_0x503f3e['countbusyretry']+_0x503f3e[_0xe361('0xc')]+_0x503f3e[_0xe361('0xd')]+_0x503f3e[_0xe361('0xe')]+_0x503f3e['countdropretry']+_0x503f3e[_0xe361('0xf')]+_0x503f3e[_0xe361('0x10')]+_0x503f3e['countagentrejectretry'];this['countnosuchnumberretry']=_0x503f3e[_0xe361('0xe')];this['countdropretry']=_0x503f3e[_0xe361('0x11')];this[_0xe361('0xf')]=_0x503f3e[_0xe361('0xf')];this[_0xe361('0x10')]=_0x503f3e[_0xe361('0x10')];this[_0xe361('0x12')]=_0x503f3e[_0xe361('0x12')];this[_0xe361('0x13')]=_0x503f3e[_0xe361('0x13')];this[_0xe361('0x14')]=_0x503f3e['name'];this[_0xe361('0x15')]=_0x503f3e[_0xe361('0x16')];this['starttime']=_0x503f3e[_0xe361('0x17')];this['responsetime']=_0x503f3e[_0xe361('0x18')];this[_0xe361('0x19')]=_0x503f3e['responsetime'];this[_0xe361('0x1a')]=getSeconds(_0x503f3e[_0xe361('0x18')],_0x503f3e[_0xe361('0x17')]);this[_0xe361('0x1b')]=0x0;this[_0xe361('0x1c')]=0x0;this[_0xe361('0x1d')]=_0x503f3e[_0xe361('0x1d')];this[_0xe361('0x1e')]=_0x503f3e[_0xe361('0x1e')];this['callbackat']=_0x503f3e[_0xe361('0x1f')];this[_0xe361('0x20')]=_0x503f3e[_0xe361('0x20')];this[_0xe361('0x21')]=_0x503f3e[_0xe361('0x21')];this[_0xe361('0x22')]=_0x503f3e[_0xe361('0x22')];this[_0xe361('0x23')]=_0x503f3e[_0xe361('0x23')];this['VoiceQueueId']=_0x503f3e[_0xe361('0x24')];this[_0xe361('0x25')]=_0x503f3e['CampaignId'];this[_0xe361('0x26')]=_0x503f3e[_0xe361('0x26')]||'';this[_0xe361('0x27')]=_0x503f3e[_0xe361('0x27')]||'';}module[_0xe361('0x28')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 285030a..d6cb1a9 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 _0x7f42=['[syncQueueSummary]\x20Campaign\x20Queue:\x20','IS_DISACTIVED','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','statedesc','endtime','starttime','clearZombieChannels','[actions]','isNil','Action','No\x20such\x20channel','queue','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','countReScheduled','catch','[countReScheduled]\x20','checkIsBlackList','resolve','[checkIsBlackList]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','unlockContact','[unlockContact]\x20','getContactDialer','temp','[getContactDialer]\x20','getContactDialerIvr','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','updateOriginated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','notFound','merge','pick','ContactId','ListId','UserId','VoiceQueueId','[emptyContact][createHistory]','SIP/%s','status','reachable','unmonitored','saveInDb','uniqueid','variable','amdstatus','xcally-motion-dialer','ivr','dialAMDActive','value','HangupInAMD','emit','custom:amd','buildObj','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','state','Machine','membername','AMD','countmachineretry','countglobal','amd','[syncAgentComplete][createHistory][0]','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','add','dialMachineRetryFrequency','YYYY-MM-DD\x20HH:mm:ss','CampaignId','[rescheduleContact][Machine]','HANGUP','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','countdropretry','minutes','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','moveContactManagedDialer','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','cause-txt','Unknow','syncAgentComplete','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','[syncAgentComplete]','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','dialQueueTimeout','outboundDropCallsDayTimeout','Drop','dropreason','TIMEOUT','dialDropMaxRetry','dialDropRetryFrequency','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','CALLEREXIT','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','Abandoned','[syncAgentComplete][createHistory][11]','channel','actionid','locked','paused','stateinterface','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','run','idHopper','[Catch][Preview][syncQueueStatusComplete]','finally','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][RR][finaly]','[booked][unlock]','[unlock2][syncQueueStatusComplete]','[unlock3][syncQueueStatusComplete]','resetActiveCalls','syncCampaigns','checkIsTrunkReachable','isTrunkReachable','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','checkIfTimeIntervals','Failure','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','timezones','TIMEZONE_UNKNOW','isArray','push','iftime\x20%s,%s','interval','content','true','command','indexOf','all','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','handlePower','power','dialPowerLevel','method\x20not\x20recognized','checkPreviewRecallReminder','user:%s','launchHandleIvr','handleIvr','syncQueueSummary','dialGlobalInterval','dialTimezone','[syncQueueSummary]','dialPreviewRecallmeReminder','[syncCampaigns]','\x5cw{0,','pow','replace','random','match','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','phone','Contact','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','ACTIVE','XMD-AMDINITIALSILENCE','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','XMD-AMDTOTALANALYSISTIME','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','tags','%s%s','XMD-','toUpper','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','TrunkBackup','originatecalleridname','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','SIP/%s/%s%s','trim','dialCutDigit','substring','from-sip','[originateError]:\x20%s','OriginateError','originate\x20action\x20Error','getQueue','isSuccess','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','countbusyretry','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','[rescheduleContact][Drop]','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','reason','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','NoAnswer','custom:agentnoanswer','noanswer','[syncAgentComplete][createHistory][3]','dialNoAnswerMaxRetry','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','dialBusyMaxRetry','reason\x205\x20busy','custom:agentcongestion','congestion','reason\x208\x20congestion','outboundAbandonedCallsDay','dialAbandonedMaxRetry','reason\x2011\x20abandoned','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','dialAgentRejectMaxRetry','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','Success','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalMaxThreshold','predictiveIntervalAvailable','predictiveIntervalMinThreshold','floor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','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\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','busyFactor','Unknown\x20Predictive','check\x20failure','outboundQueuePauses','[CatchErlangB]','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','Agent','voicePause','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','dialOrderByScheduledAt','RUNNING','ivrTotalCallsDays','emptyContact','[actionOriginate]\x20','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','Contact.phone','tryOriginatePredictive','[handlePredictive][limitChannel]','not_inuse','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','interval\x20=\x20','Amax\x20=\x20','Interval:\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]','Umin\x20=\x20','exports','util','uuid','moment','md5','ioredis','../preview/util/util','../../../config/environment/','dialer','../../../config/logger','booked','predictive','redis','localhost','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/setting','./final','./agentComplete','./queueCallerAbandon','./hangup','env','127.0.0.1','rrmemory','roundrobin','prototype','enqueue','tail','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','optionPredictive','startPredictive','queueBooked','queueBookedRR','agentconnect','syncAgentConnect','bind','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','hangup','syncHangup','newexten','varset','syncVarSet','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','then','previewRecallmeReminderInterval','isUndefined','name','\x20AGENTS\x20NOT\x20LOGGED','message','NOT_ACTIVE','Interval','INTERVAL_IS_NULL','Intervals','\x20INTERVAL_IS_NULL','Error','stringify','milliseconds','diff','seconds','type','outbound','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','Trunk','active','callerid','format','voice:queue:%s','voice_queue:save','isEmpty','-----\x20Stats\x20Predictive\x20---','info','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','---------------------------','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','startProgressive','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','stack','inspect','length','undefined','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','talking'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x7f42,0x183));var _0x27f4=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x7f42[_0x4e676e];return _0x336a3c;};'use strict';var util=require(_0x27f4('0x0'));var _=require('lodash');var BPromise=require('bluebird');var uuid=require(_0x27f4('0x1'));var moment=require(_0x27f4('0x2'));var rr=require('rr');var md5=require(_0x27f4('0x3'));var Redis=require(_0x27f4('0x4'));var ut=require(_0x27f4('0x5'));var config=require(_0x27f4('0x6'));var logger=require('../../../config/logger')(_0x27f4('0x7'));var loggerBooked=require(_0x27f4('0x8'))(_0x27f4('0x9'));var loggerPredictive=require(_0x27f4('0x8'))(_0x27f4('0xa'));var loggerPredictiveCalls=require(_0x27f4('0x8'))('predictiveCalls');var loggerSyncQueueSummary=require(_0x27f4('0x8'))('syncQueueSummary');var ami=require('../ami');config[_0x27f4('0xb')]=_['defaults'](config['redis'],{'host':_0x27f4('0xc'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x27f4('0xb')]));var cmHopper=require('../rpc/cmHopper');var cmHopperHistory=require(_0x27f4('0xd'));var cmHopperBlack=require(_0x27f4('0xe'));var voiceQueueRt=require(_0x27f4('0xf'));var RpcSetting=require(_0x27f4('0x10'));var Action=require('./action');var History=require('./history');var Final=require(_0x27f4('0x11'));var AgentComplete=require(_0x27f4('0x12'));var QueueCallerAbandon=require(_0x27f4('0x13'));var Hangup=require(_0x27f4('0x14'));var ipAgi=process[_0x27f4('0x15')]['XCALLY_IP_AGI']||_0x27f4('0x16');var strategy={'rrmemory':_0x27f4('0x17'),'roundrobin':_0x27f4('0x18')};var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x27f4('0x19')][_0x27f4('0x1a')]=function(_0x2c91db){this[_0x27f4('0x1b')]=this[_0x27f4('0x1b')]?this['tail']['finally'](_0x2c91db):_0x2c91db();};function Dialer(_0x4297d7,_0x155230){this[_0x27f4('0x1c')]=new Sequence();this[_0x27f4('0x1d')]=_0x155230;this[_0x27f4('0x1e')]=_0x4297d7[_0x27f4('0x1e')];this[_0x27f4('0x1f')]=_0x4297d7[_0x27f4('0x1f')];this['agents']=_0x4297d7[_0x27f4('0x20')];this['trunks']=_0x4297d7[_0x27f4('0x21')];this[_0x27f4('0x22')]=config['maxNumberOriginate']||0x2;this[_0x27f4('0x23')]={};this[_0x27f4('0x24')]={};this[_0x27f4('0x25')]={};this[_0x27f4('0x26')]={};this[_0x27f4('0x27')]={};this[_0x27f4('0x28')]={};this['startProgressive']={};this['ivrOriginated']={};this[_0x27f4('0x29')]={};this[_0x27f4('0x2a')]={};ami['on'](_0x27f4('0x2b'),this[_0x27f4('0x2c')][_0x27f4('0x2d')](this));ami['on']('queuecallerabandon',this[_0x27f4('0x2e')][_0x27f4('0x2d')](this));ami['on'](_0x27f4('0x2f'),this[_0x27f4('0x30')][_0x27f4('0x2d')](this));ami['on'](_0x27f4('0x31'),this['syncAgentComplete'][_0x27f4('0x2d')](this));ami['on']('custom:queuesummary',this['syncQueueSummary'][_0x27f4('0x2d')](this));ami['on'](_0x27f4('0x32'),this[_0x27f4('0x33')][_0x27f4('0x2d')](this));ami['on'](_0x27f4('0x34'),this['syncNewExten'][_0x27f4('0x2d')](this));ami['on'](_0x27f4('0x35'),this[_0x27f4('0x36')][_0x27f4('0x2d')](this));ami['on']('queuemember',this[_0x27f4('0x37')][_0x27f4('0x2d')](this));ami['on'](_0x27f4('0x38'),this[_0x27f4('0x39')][_0x27f4('0x2d')](this));this[_0x27f4('0x3a')]();this[_0x27f4('0x3b')]();RpcSetting['getSettings']()[_0x27f4('0x3c')](function(_0x26e36d){previewRecallmeReminderInterval=_0x26e36d[_0x27f4('0x3d')];});}function isNotNull(_0x52610e){return _0x52610e!==null&&!_[_0x27f4('0x3e')](_0x52610e);}function checkIsLoggedIn(_0x23aa3d,_0x26bd77){return function(){if(_0x26bd77<=0x0){_0x23aa3d['message']='AGENTS_NOT_LOGGED';throw _0x23aa3d[_0x27f4('0x3f')]+_0x27f4('0x40');}};}function isActive(_0x1129bc){return _0x1129bc;}function checkIsActive(_0x2ae2ea,_0x1b3eb3){return function(){if(!isActive(_0x1b3eb3)){_0x2ae2ea[_0x27f4('0x41')]=_0x27f4('0x42');throw _0x2ae2ea[_0x27f4('0x3f')]+'\x20NOT\x20Active';}};}function checkInterval(_0x2ecc6f){return function(){if(!isNotNull(_0x2ecc6f[_0x27f4('0x43')])){_0x2ecc6f[_0x27f4('0x41')]=_0x27f4('0x44');throw _0x2ecc6f[_0x27f4('0x3f')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0x2ecc6f[_0x27f4('0x43')][_0x27f4('0x45')])){_0x2ecc6f['message']=_0x27f4('0x44');throw _0x2ecc6f[_0x27f4('0x3f')]+_0x27f4('0x46');}if(!isNotNull(_['isEmpty'](_0x2ecc6f[_0x27f4('0x43')]['Intervals']))){_0x2ecc6f[_0x27f4('0x41')]=_0x27f4('0x44');throw _0x2ecc6f['name']+_0x27f4('0x46');}};}function msgResponse(_0x4b4281,_0x42fbe5,_0x185e81){return{'action':_0x4b4281,'response':_0x42fbe5,'message':_0x185e81,'stack':_0x185e81};}function myreject(_0x3ad02c){return function(_0x4b94d6){return _0x3ad02c(msgResponse('[ifTime][Action]',_0x27f4('0x47'),JSON[_0x27f4('0x48')](_0x4b94d6)));};}function getSeconds(_0x3bf210,_0x5de96f){var _0x3163d1=moment(_0x3bf210)[_0x27f4('0x49')](0x0);var _0xfad77c=moment(_0x5de96f)[_0x27f4('0x49')](0x0);return _0x3163d1[_0x27f4('0x4a')](_0xfad77c,_0x27f4('0x4b'));}function emit(_0x1aa16f,_0x572e5a,_0x2aba9c){io['to'](_0x1aa16f)['emit'](_0x572e5a,_0x2aba9c);}function emitVoiceQueueSummary(_0x328403){if(_0x328403[_0x27f4('0x4c')]===_0x27f4('0x4d')){var _0x378d9b={'id':_0x328403['id'],'name':_0x328403[_0x27f4('0x3f')],'strategy':_0x328403[_0x27f4('0x4e')],'answered':_0x328403[_0x27f4('0x4f')],'available':_0x328403[_0x27f4('0x50')],'loggedIn':_0x328403[_0x27f4('0x51')],'pTalking':_0x328403[_0x27f4('0x52')],'sumBillable':_0x328403[_0x27f4('0x53')],'sumDuration':_0x328403[_0x27f4('0x54')],'sumHoldTime':_0x328403['sumHoldTime']||0x0,'talking':_0x328403['talking'],'total':_0x328403['total'],'type':_0x328403['type'],'unmanaged':_0x328403[_0x27f4('0x55')],'abandoned':_0x328403[_0x27f4('0x56')],'waiting':_0x328403[_0x27f4('0x57')],'loggedInDb':_0x328403[_0x27f4('0x58')],'dialActive':_0x328403[_0x27f4('0x59')],'dialMethod':_0x328403[_0x27f4('0x5a')],'dialOriginateCallerIdName':_0x328403['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x328403['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x328403[_0x27f4('0x5b')],'dialPrefix':_0x328403[_0x27f4('0x5c')],'outboundAnswerAgiCallsDay':_0x328403[_0x27f4('0x5d')],'outboundAnswerCallsDay':_0x328403[_0x27f4('0x5e')],'outboundBlacklistCallsDay':_0x328403[_0x27f4('0x5f')],'outboundBusyCallsDay':_0x328403[_0x27f4('0x60')],'outboundCongestionCallsDay':_0x328403[_0x27f4('0x61')],'outboundDropCallsDayACS':_0x328403[_0x27f4('0x62')],'outboundDropCallsDayCallersExit':_0x328403[_0x27f4('0x63')],'outboundDropCallsDayTimeout':_0x328403['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x328403[_0x27f4('0x64')],'outboundNoSuchCallsDay':_0x328403[_0x27f4('0x65')],'outboundOriginateFailureCallsDay':_0x328403[_0x27f4('0x66')],'outboundReCallsDay':_0x328403[_0x27f4('0x67')],'outboundRejectCallsDay':_0x328403[_0x27f4('0x68')],'outboundUnknownCallsDay':_0x328403[_0x27f4('0x69')],'predictiveIntervalAnsweredCalls':_0x328403['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x328403['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x328403['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x328403['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x328403[_0x27f4('0x6a')],'predictiveIntervalErlangCalls':_0x328403[_0x27f4('0x6b')],'predictiveIntervalErlangCallsDroppedCalls':_0x328403[_0x27f4('0x6c')],'predictiveIntervalHitRate':_0x328403[_0x27f4('0x6d')],'predictiveIntervalMultiplicativeFactor':_0x328403[_0x27f4('0x6e')],'predictiveIntervalPauses':_0x328403[_0x27f4('0x6f')],'predictiveIntervalAvailable':_0x328403['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x328403[_0x27f4('0x70')],'message':_0x328403[_0x27f4('0x41')],'originated':_0x328403[_0x27f4('0x71')],'erlangCalls':_0x328403[_0x27f4('0x72')],'erlangCallToSecond':_0x328403[_0x27f4('0x73')],'erlangAbandonmentRate':_0x328403[_0x27f4('0x74')],'erlangBusyFactor':_0x328403[_0x27f4('0x75')],'startPredictive':_0x328403[_0x27f4('0x28')],'startProgressive':_0x328403['startProgressive']};if(_0x328403[_0x27f4('0x76')]){_0x378d9b[_0x27f4('0x76')]={'id':_0x328403[_0x27f4('0x76')]['id'],'name':_0x328403[_0x27f4('0x76')]['name'],'active':_0x328403[_0x27f4('0x76')][_0x27f4('0x77')],'callerid':_0x328403[_0x27f4('0x76')][_0x27f4('0x78')]};}if(_0x328403[_0x27f4('0x43')]){_0x378d9b[_0x27f4('0x43')]={'id':_0x328403[_0x27f4('0x43')]['id'],'name':_0x328403[_0x27f4('0x43')][_0x27f4('0x3f')]};}var _0x1bdf2a=md5(JSON['stringify'](_0x378d9b));if(_0x328403[_0x27f4('0x3')]!==_0x1bdf2a){_0x328403[_0x27f4('0x3')]=_0x1bdf2a;emit(util[_0x27f4('0x79')](_0x27f4('0x7a'),_0x378d9b['name']),_0x27f4('0x7b'),_0x378d9b);}}}function emitCampaignSummary(_0x363f50){if(_0x363f50[_0x27f4('0x4c')]==='ivr'){emit(util[_0x27f4('0x79')]('campaign:ivr:%s',_0x363f50[_0x27f4('0x3f')]),'campaign:save',_0x363f50);}}function checkGetDataPredictive(_0x1e9100){if(isNotNull(_0x1e9100)&&!_[_0x27f4('0x7c')](_0x1e9100)){loggerPredictive['info'](_0x27f4('0x7d'));loggerPredictive[_0x27f4('0x7e')](_0x27f4('0x7f'),_0x1e9100['predictiveIntervalTotalCalls']);loggerPredictive['info'](_0x27f4('0x80'),_0x1e9100[_0x27f4('0x81')]);loggerPredictive[_0x27f4('0x7e')](_0x27f4('0x82'),_0x1e9100[_0x27f4('0x6a')]);loggerPredictive[_0x27f4('0x7e')](_0x27f4('0x83'),_0x1e9100[_0x27f4('0x84')]);loggerPredictive[_0x27f4('0x7e')]('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1e9100[_0x27f4('0x85')]);loggerPredictive[_0x27f4('0x7e')](_0x27f4('0x86'),_0x1e9100[_0x27f4('0x87')]);loggerPredictive['info'](_0x27f4('0x88'));if(_0x1e9100[_0x27f4('0x70')]>0x0){if(!_[_0x27f4('0x3e')](_0x1e9100[_0x27f4('0x87')])&&_0x1e9100[_0x27f4('0x87')]>0x0){return!![];}loggerPredictive['info']('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');if(!_[_0x27f4('0x3e')](_0x1e9100[_0x27f4('0x85')])&&_0x1e9100['predictiveIntervalAvgHoldtime']>0x0){return!![];}loggerPredictive['info'](_0x27f4('0x89'));}else{loggerPredictive[_0x27f4('0x7e')]('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive['info'](_0x27f4('0x8a'));}return![];}function mergeDataErlangB(_0x3cfe8c){return function(_0x2e3b7b){loggerPredictive['info'](_0x27f4('0x8b'));loggerPredictive[_0x27f4('0x7e')](_0x27f4('0x8c'),_0x2e3b7b[_0x27f4('0x72')]);loggerPredictive[_0x27f4('0x7e')](_0x27f4('0x8d'),_0x2e3b7b[_0x27f4('0x73')]);loggerPredictive[_0x27f4('0x7e')](_0x27f4('0x8e'),_0x2e3b7b[_0x27f4('0x74')]);loggerPredictive['info']('Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2e3b7b[_0x27f4('0x75')]);loggerPredictive[_0x27f4('0x7e')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2e3b7b[_0x27f4('0x74')]);loggerPredictive[_0x27f4('0x7e')]('---------------------------');_['merge'](_0x3cfe8c,_0x2e3b7b);};}function getDiff(_0x558650){var _0x2ffe70=moment()[_0x27f4('0x49')](0x0);var _0x2714b1=moment(_0x558650)[_0x27f4('0x49')](0x0);return _0x2ffe70['diff'](_0x2714b1,_0x27f4('0x4b'));}function ifInterval(_0x258295,_0x40926){if(_['isUndefined'](_0x40926)){return![];}return getDiff(_0x40926)<_0x258295*0x3c;}function freeVariablesPredictive(_0x1aba69){if(isNotNull(_0x1aba69)){if(!_['isUndefined'](_0x1aba69[_0x27f4('0x8f')])){_0x1aba69['startProgressive']=undefined;loggerPredictive[_0x27f4('0x7e')](_0x1aba69['name'],_0x27f4('0x90'));}if(!_[_0x27f4('0x3e')](_0x1aba69[_0x27f4('0x28')])){_0x1aba69[_0x27f4('0x28')]=undefined;loggerPredictive[_0x27f4('0x7e')](_0x1aba69[_0x27f4('0x3f')],_0x27f4('0x91'));}if(!_[_0x27f4('0x3e')](_0x1aba69[_0x27f4('0x92')])){clearInterval(_0x1aba69['handlePredictive']);_0x1aba69['handlePredictive']=undefined;loggerPredictive[_0x27f4('0x7e')](_0x1aba69['name'],_0x27f4('0x93'));}}}function erlangb(_0x3ca820,_0x5f5392){if(_0x5f5392===0x0){return 0x0;}var _0x122781=0x1;for(var _0x34ab47=0x1;_0x34ab47<=_0x5f5392;_0x34ab47+=0x1){_0x122781=0x1+_0x122781*_0x34ab47/_0x3ca820;}return 0x1/_0x122781;}function isVoiceQueueOutbound(_0x10f877){return _0x10f877===_0x27f4('0x4d');}function isNotPreview(_0x2ea1b7){return _0x2ea1b7!==_0x27f4('0x1d');}function isCampaignIvr(_0x36f51e){return _0x36f51e==='ivr';}function getCallerId(_0x4e3ef1,_0x4c3424,_0xb8cdfb){if(!_[_0x27f4('0x3e')](_0xb8cdfb)&&typeof _0xb8cdfb===_0x27f4('0x94')&&!_[_0x27f4('0x7c')](_0xb8cdfb)){if(!_[_0x27f4('0x3e')](_0x4c3424)&&typeof _0x4c3424===_0x27f4('0x94')&&!_[_0x27f4('0x7c')](_0x4c3424)){return util[_0x27f4('0x79')](_0x27f4('0x95'),_0x4c3424,_0xb8cdfb);}return util[_0x27f4('0x79')](_0x27f4('0x95'),_0xb8cdfb,_0xb8cdfb);}if(!_['isUndefined'](_0x4e3ef1)&&typeof _0x4e3ef1===_0x27f4('0x94')&&!_[_0x27f4('0x7c')](_0x4e3ef1)){return _0x4e3ef1;}return _0x27f4('0x96');}function loggerCatchQueueSummary(_0x2f41cc,_0x470a8f){return function(_0x432643){freeVariablesPredictive(_0x470a8f);emitVoiceQueueSummary(_0x470a8f);emitCampaignSummary(_0x470a8f);loggerSyncQueueSummary[_0x27f4('0x97')](_0x2f41cc,util['inspect'](_0x432643,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x4ceb0d,_0x5e7e6b){return function(_0x296d85){loggerPredictive[_0x27f4('0x97')](_0x5e7e6b[_0x27f4('0x3f')],_0x4ceb0d);loggerPredictive[_0x27f4('0x97')](_0x296d85[_0x27f4('0x98')]);freeVariablesPredictive(_0x5e7e6b);};}function loggerCatch(_0x1f9d29){return function(_0x1b255f){logger['error'](_0x1f9d29,util[_0x27f4('0x99')](_0x1b255f,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x4fa482){return _0x4fa482&&!_[_0x27f4('0x3e')](_0x4fa482)&&_0x4fa482[_0x27f4('0x9a')]>0x0;}function decremetOriginate(_0x5da2e1){if(!_[_0x27f4('0x3e')](_0x5da2e1)&&_0x5da2e1!==null){if(typeof _0x5da2e1[_0x27f4('0x71')]!==_0x27f4('0x9b')){if(_0x5da2e1['originated']>0x0){_0x5da2e1['originated']-=0x1;}else{logger[_0x27f4('0x97')]('[decremetOriginate]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0x27f4('0x97')](_0x27f4('0x9c'));}}function checkContactLowerLimitOriginate(_0x5dcbf1,_0x111c29,_0x4dd7db){if(_0x111c29>_0x4dd7db){for(var _0x4cf734=0x0;_0x4cf734<_0x111c29-_0x4dd7db;_0x4cf734+=0x1){decremetOriginate(_0x5dcbf1);}}}function loggerGetContactDialer(_0x147b88,_0x19666b,_0x972bd1){return function(_0x16103c){checkContactLowerLimitOriginate(_0x19666b,_0x972bd1,0x0);logger[_0x27f4('0x97')](_0x147b88,util['inspect'](_0x16103c,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x159ea4){return function(_0x32e54c){if(isNotNull(_0x32e54c)&&isNotNull(_0x32e54c[0x0])){if(_0x32e54c[0x0][_0x27f4('0x9d')]>0x0){_0x159ea4['message']=_0x27f4('0x9e');logger[_0x27f4('0x7e')](_0x27f4('0x9f')+_0x159ea4[_0x27f4('0x3f')],_0x32e54c[0x0][_0x27f4('0x9d')],'contacts');}else{_0x159ea4[_0x27f4('0x41')]=_0x27f4('0xa0');logger[_0x27f4('0x7e')](_0x27f4('0xa1')+_0x159ea4['name']);}}};}function notSendMessagesQueue(_0x45a161){if(_0x45a161[_0x27f4('0xa2')]){freeVariablesPredictive(_0x45a161);if(_0x45a161['originated']===0x0&&_0x45a161[_0x27f4('0xa3')]===0x0&&_0x45a161[_0x27f4('0x57')]===0x0&&(_0x45a161[_0x27f4('0x52')]||0x0)===0x0){_0x45a161['sendMessageOneNotActive']=![];_0x45a161['available']=0x0;_0x45a161['message']='NOT_ACTIVE';loggerSyncQueueSummary[_0x27f4('0x97')](_0x27f4('0xa4'),_0x45a161['name'],'is\x20not\x20active');}else{_0x45a161[_0x27f4('0x41')]=_0x27f4('0xa5');loggerSyncQueueSummary[_0x27f4('0x97')]('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x45a161[_0x27f4('0x3f')],_0x27f4('0xa6'));}emitVoiceQueueSummary(_0x45a161);}}function notSendMessagesCampaign(_0x5cbd8e){if(_0x5cbd8e[_0x27f4('0xa2')]){if(_0x5cbd8e[_0x27f4('0x71')]===0x0){_0x5cbd8e[_0x27f4('0xa2')]=![];_0x5cbd8e[_0x27f4('0x41')]=_0x27f4('0x42');loggerSyncQueueSummary['error'](_0x27f4('0xa7'),_0x5cbd8e[_0x27f4('0x3f')],_0x27f4('0xa8'));}else{_0x5cbd8e[_0x27f4('0x41')]=_0x27f4('0xa5');loggerSyncQueueSummary['error'](_0x27f4('0xa7'),_0x5cbd8e[_0x27f4('0x3f')],'is\x20disactive');}emitCampaignSummary(_0x5cbd8e);}}function createObjHistory(_0x10c5a8,_0x2a6316,_0x2b4d60,_0x3deda4,_0x3c1b1e){_0x10c5a8[_0x27f4('0x41')]=_0x2b4d60;var _0x3a33e2=new Action(_0x10c5a8,_0x2a6316);var _0x5369cf=new History(_0x3a33e2);_0x5369cf['state']=_0x3deda4;_0x5369cf[_0x27f4('0xa9')]=_0x3c1b1e;_0x5369cf[_0x27f4('0xaa')]=_0x3a33e2[_0x27f4('0xab')];return _0x5369cf;}Dialer[_0x27f4('0x19')]['loopClearZombieChannels']=function(){var _0x4c3c8c=this;setInterval(function(){_0x4c3c8c[_0x27f4('0xac')](_0x4c3c8c[_0x27f4('0x26')],'[uniqueid]');_0x4c3c8c[_0x27f4('0xac')](_0x4c3c8c['actions'],_0x27f4('0xad'));},0x32c8);};Dialer['prototype'][_0x27f4('0xac')]=function(_0x237a19,_0x526ccb){var _0x5ab874=this;for(var _0x1e489c in _0x237a19){if(typeof _0x237a19[_0x1e489c]!=='undefined'){this[_0x27f4('0x1c')][_0x27f4('0x1a')](function(){if(!_[_0x27f4('0xae')](_0x237a19[_0x1e489c])){return ami[_0x27f4('0xaf')]({'action':'status','channel':_0x237a19[_0x1e489c]['channel']})['catch'](function(_0x5587df){if(_0x5587df[_0x27f4('0x41')]===_0x27f4('0xb0')){setTimeout(function(){if(_0x237a19[_0x1e489c]&&_0x237a19[_0x1e489c][_0x27f4('0x4c')]!=='ivr'){_0x5ab874['updateOriginated'](_0x5ab874[_0x27f4('0x1e')][_0x237a19[_0x1e489c][_0x27f4('0xb1')]]);logger[_0x27f4('0x97')](_0x27f4('0xb2'),_0x526ccb,_0x1e489c,_0x237a19[_0x1e489c][_0x27f4('0xb1')]);delete _0x237a19[_0x1e489c];}if(_0x237a19[_0x1e489c]&&_0x237a19[_0x1e489c][_0x27f4('0x4c')]==='ivr'){_0x5ab874['updateOriginated'](_0x5ab874[_0x27f4('0x1f')][_0x237a19[_0x1e489c][_0x27f4('0xb1')]]);logger['error'](_0x27f4('0xb3'),_0x526ccb,_0x1e489c,_0x237a19[_0x1e489c][_0x27f4('0xb1')]);delete _0x237a19[_0x1e489c];}},0x2328);}});}});}}};Dialer[_0x27f4('0x19')][_0x27f4('0xb4')]=function(_0x5e10be){return BPromise['resolve']()['then'](cmHopper[_0x27f4('0xb4')](_0x5e10be))[_0x27f4('0xb5')](loggerCatch(_0x27f4('0xb6')));};Dialer['prototype'][_0x27f4('0xb7')]=function(_0x4e86da){return BPromise[_0x27f4('0xb8')]()[_0x27f4('0x3c')](cmHopperBlack[_0x27f4('0xb7')](_0x4e86da))['catch'](loggerCatch(_0x27f4('0xb9')));};Dialer['prototype'][_0x27f4('0xba')]=function(_0x248838){return BPromise['resolve']()[_0x27f4('0x3c')](cmHopperBlack[_0x27f4('0xba')](_0x248838))[_0x27f4('0xb5')](loggerCatch(_0x27f4('0xbb')));};Dialer[_0x27f4('0x19')][_0x27f4('0xbc')]=function(_0x2713e6){return BPromise[_0x27f4('0xb8')]()[_0x27f4('0x3c')](cmHopperHistory[_0x27f4('0xbd')](_0x2713e6))[_0x27f4('0xb5')](loggerCatch(_0x27f4('0xbe')));};Dialer[_0x27f4('0x19')][_0x27f4('0xbf')]=function(_0x47b619){return BPromise['resolve']()[_0x27f4('0x3c')](cmHopper['rescheduleContact'](_0x47b619))['catch'](loggerCatch('[rescheduleContact]\x20'));};Dialer[_0x27f4('0x19')][_0x27f4('0xc0')]=function(_0x576e15,_0xc06cf1,_0x224b5a){return BPromise[_0x27f4('0xb8')]()[_0x27f4('0x3c')](cmHopper[_0x27f4('0xc0')](_0x576e15,_0xc06cf1,_0x224b5a))['catch'](loggerCatch(_0x27f4('0xc1')));};Dialer[_0x27f4('0x19')]['getContactDialer']=function(_0x32e29b,_0x207d17,_0x166853,_0x445105,_0x178a8c){return BPromise[_0x27f4('0xb8')]()[_0x27f4('0x3c')](cmHopper[_0x27f4('0xc2')](_0x32e29b,_0x207d17,_0x166853,_0x445105))['catch'](function(_0x31b642){_0x178a8c['temp']-=_0x166853;_0x178a8c['temp']=_0x178a8c[_0x27f4('0xc3')]>0x0?_0x178a8c[_0x27f4('0xc3')]:0x0;loggerCatch(_0x27f4('0xc4'))(_0x31b642);});};Dialer['prototype'][_0x27f4('0xc5')]=function(_0x636d2c,_0x4bc0e0,_0x5de8b9,_0x270b35){return BPromise[_0x27f4('0xb8')]()[_0x27f4('0x3c')](cmHopper['getContactDialerIvr'](_0x636d2c,_0x4bc0e0,_0x5de8b9))[_0x27f4('0xb5')](function(_0x499943){_0x270b35[_0x27f4('0xc3')]-=_0x4bc0e0;_0x270b35[_0x27f4('0xc3')]=_0x270b35[_0x27f4('0xc3')]>0x0?_0x270b35[_0x27f4('0xc3')]:0x0;loggerCatch(_0x27f4('0xc6'))(_0x499943);});};Dialer[_0x27f4('0x19')][_0x27f4('0xc7')]=function(_0x3bfedd){return BPromise[_0x27f4('0xb8')]()[_0x27f4('0x3c')](voiceQueueRt[_0x27f4('0xc7')](_0x3bfedd))[_0x27f4('0xb5')](loggerCatch(_0x27f4('0xc8')));};Dialer[_0x27f4('0x19')]['moveContactManagedDialer']=function(_0x478ef6){return BPromise[_0x27f4('0xb8')]()['then'](cmHopper['moveContactManagedDialer'](_0x478ef6))[_0x27f4('0xb5')](loggerCatch(_0x27f4('0xc9')));};Dialer['prototype'][_0x27f4('0xca')]=function(_0x7f8d2a){return BPromise[_0x27f4('0xb8')]()[_0x27f4('0x3c')](cmHopperHistory[_0x27f4('0xca')](_0x7f8d2a))[_0x27f4('0xb5')](loggerCatch(_0x27f4('0xcb')));};Dialer['prototype'][_0x27f4('0xcc')]=function(_0x2b6a90){if(!_[_0x27f4('0x3e')](_0x2b6a90)&&_0x2b6a90!==null){if(typeof _0x2b6a90[_0x27f4('0x71')]!==_0x27f4('0x9b')){if(_0x2b6a90[_0x27f4('0x71')]>0x0){_0x2b6a90[_0x27f4('0x71')]-=0x1;}else{logger[_0x27f4('0x97')](_0x27f4('0xcd'));}}}else{logger[_0x27f4('0x97')](_0x27f4('0xce'));}};Dialer[_0x27f4('0x19')][_0x27f4('0xcf')]=function(_0x239f11,_0x4bceb6){var _0x1f1b68=this;return function(_0x3d79b8){_0x1f1b68[_0x27f4('0xcc')](_0x4bceb6);logger['error'](_0x239f11,util[_0x27f4('0x99')](_0x3d79b8,{'showHidden':![],'depth':null}));};};Dialer[_0x27f4('0x19')]['emptyContact']=function(_0x2b8166,_0x3358df,_0x343ef2){var _0x58167d={'state':0x19,'statedesc':_0x27f4('0xd0')};this['updateOriginated'](_0x3358df);this['saveInDb'](_[_0x27f4('0xd1')](_0x58167d,_[_0x27f4('0xd2')](_0x343ef2,[_0x27f4('0xd3'),_0x27f4('0xd4'),_0x27f4('0xd5'),_0x27f4('0xd6'),'CampaignId'])),_0x27f4('0xd7'),'[emptyContact]');logger[_0x27f4('0x97')](_0x2b8166);};Dialer[_0x27f4('0x19')]['isSuccess']=function(_0x4e3917){return _0x4e3917==='Success';};Dialer[_0x27f4('0x19')]['isTrunkReachable']=function(_0x3df6c5){return!_[_0x27f4('0x3e')](_0x3df6c5)&&_0x3df6c5&&!_['isUndefined'](_0x3df6c5[_0x27f4('0x3f')])&&!_[_0x27f4('0x3e')](_0x3df6c5['active'])&&_0x3df6c5[_0x27f4('0x77')]&&(this[_0x27f4('0x21')][util[_0x27f4('0x79')](_0x27f4('0xd8'),_0x3df6c5[_0x27f4('0x3f')])][_0x27f4('0xd9')]===_0x27f4('0xda')||this[_0x27f4('0x21')][util[_0x27f4('0x79')](_0x27f4('0xd8'),_0x3df6c5[_0x27f4('0x3f')])][_0x27f4('0xd9')]===_0x27f4('0xdb'));};Dialer['prototype'][_0x27f4('0xdc')]=function(_0x706603,_0x35255f,_0x5ac1f2){this[_0x27f4('0xca')](_0x706603)[_0x27f4('0xb5')](loggerCatch(_0x35255f));this['moveContactManagedDialer'](_0x706603)['catch'](loggerCatch(_0x5ac1f2));};Dialer[_0x27f4('0x19')]['syncVarSet']=function(_0x1c478a){var _0x192f27=this[_0x27f4('0x26')][_0x1c478a[_0x27f4('0xdd')]];var _0x5e6ba5;if(!_[_0x27f4('0xae')](_0x1c478a)&&!_[_0x27f4('0xae')](_0x1c478a[_0x27f4('0xde')])&&!_[_0x27f4('0xae')](_0x1c478a[_0x27f4('0xde')][_0x27f4('0xdf')])&&_0x1c478a['exten']===_0x27f4('0xe0')&&_0x192f27){if(_0x192f27[_0x27f4('0x4c')]!==_0x27f4('0xe1')&&this[_0x27f4('0x1e')][_0x192f27[_0x27f4('0xb1')]][_0x27f4('0xe2')]&&_0x1c478a[_0x27f4('0xe3')]==='HANGUP'){delete this[_0x27f4('0x26')][_0x1c478a[_0x27f4('0xdd')]];this[_0x27f4('0xcc')](this[_0x27f4('0x1e')][_0x192f27['queue']]);this[_0x27f4('0x1e')][_0x192f27[_0x27f4('0xb1')]][_0x27f4('0x5e')]+=0x1;this[_0x27f4('0x1e')][_0x192f27[_0x27f4('0xb1')]][_0x27f4('0x5d')]+=0x1;_0x5e6ba5=new Hangup(_0x192f27,_0x1c478a);_0x5e6ba5['state']=0x12;_0x5e6ba5[_0x27f4('0xa9')]=_0x27f4('0xe4');_0x5e6ba5['membername']='AMD';ami[_0x27f4('0xe5')](_0x27f4('0xe6'),ut[_0x27f4('0xe7')](_0x5e6ba5,'amd'));this[_0x27f4('0xdc')](_0x5e6ba5,_0x27f4('0xe8'),_0x27f4('0xe9'));}if(_0x192f27[_0x27f4('0x4c')]!==_0x27f4('0xe1')&&this[_0x27f4('0x1e')][_0x192f27['queue']][_0x27f4('0xe2')]&&_0x1c478a[_0x27f4('0xe3')]===_0x27f4('0xea')){var _0x353076=this;return new BPromise(function(_0x1b7573,_0x4e8291){delete _0x353076[_0x27f4('0x26')][_0x1c478a['uniqueid']];_0x353076[_0x27f4('0xcc')](_0x353076[_0x27f4('0x1e')][_0x192f27[_0x27f4('0xb1')]]);_0x353076[_0x27f4('0x1e')][_0x192f27[_0x27f4('0xb1')]][_0x27f4('0x5e')]+=0x1;_0x353076[_0x27f4('0x1e')][_0x192f27[_0x27f4('0xb1')]][_0x27f4('0x5d')]+=0x1;var _0x496ede=_0x353076[_0x27f4('0x1e')][_0x192f27['queue']];var _0x3245bc=new Hangup(_0x192f27,_0x1c478a);_0x3245bc[_0x27f4('0xeb')]=0x13;_0x3245bc[_0x27f4('0xa9')]=_0x27f4('0xec');_0x3245bc[_0x27f4('0xed')]=_0x27f4('0xee');_0x3245bc[_0x27f4('0xef')]+=0x1;_0x3245bc[_0x27f4('0xf0')]+=0x1;_0x3245bc[_0x27f4('0xf1')]=!![];ami['emit'](_0x27f4('0xe6'),ut[_0x27f4('0xe7')](_0x3245bc,'amd'));_0x353076[_0x27f4('0xca')](_0x3245bc)[_0x27f4('0xb5')](loggerCatch(_0x27f4('0xf2')));if(_0x3245bc['countbusyretry']+_0x3245bc[_0x27f4('0xf3')]+_0x3245bc[_0x27f4('0xf4')]+_0x3245bc[_0x27f4('0xf5')]+_0x3245bc['countdropretry']+_0x3245bc[_0x27f4('0xf6')]+_0x3245bc[_0x27f4('0xef')]+_0x3245bc[_0x27f4('0xf7')]>=_0x496ede[_0x27f4('0xf8')]){_0x353076[_0x27f4('0xf9')](_0x3245bc,_0x1b7573,_0x4e8291,'reason19\x20machine....');}else{if(_0x3245bc[_0x27f4('0xef')]>=_0x496ede[_0x27f4('0xfa')]){_0x353076[_0x27f4('0xfb')](_0x3245bc,_0x1b7573,_0x4e8291,_0x27f4('0xfc'));}else{_0x353076[_0x27f4('0xbf')]({'active':![],'countmachineretry':_0x3245bc['countmachineretry'],'scheduledat':moment()[_0x27f4('0xfd')](_0x496ede[_0x27f4('0xfe')],'minutes')[_0x27f4('0x79')](_0x27f4('0xff')),'ContactId':_0x3245bc['ContactId'],'ListId':_0x3245bc[_0x27f4('0xd4')],'VoiceQueueId':_0x3245bc[_0x27f4('0xd6')]||undefined,'CampaignId':_0x3245bc[_0x27f4('0x100')]||undefined})[_0x27f4('0xb5')](loggerCatch(_0x27f4('0x101')));_0x1b7573({'reschedule':0x1});}}});}if(_0x192f27[_0x27f4('0x4c')]===_0x27f4('0xe1')&&this['campaigns'][_0x192f27[_0x27f4('0xb1')]][_0x27f4('0xe2')]&&_0x1c478a[_0x27f4('0xe3')]===_0x27f4('0x102')){delete this['uniqueId'][_0x1c478a[_0x27f4('0xdd')]];this[_0x27f4('0xcc')](this['campaigns'][_0x192f27['queue']]);_0x5e6ba5=new Hangup(_0x192f27,_0x1c478a);_0x5e6ba5['state']=0x12;_0x5e6ba5[_0x27f4('0xa9')]=_0x27f4('0xe4');_0x5e6ba5[_0x27f4('0xed')]='AMD';ami[_0x27f4('0xe5')](_0x27f4('0xe6'),ut[_0x27f4('0xe7')](_0x5e6ba5,_0x27f4('0xf1')));this[_0x27f4('0xdc')](_0x5e6ba5,_0x27f4('0x103'),_0x27f4('0x104'));}if(_0x192f27[_0x27f4('0x4c')]===_0x27f4('0xe1')&&this[_0x27f4('0x1f')][_0x192f27[_0x27f4('0xb1')]]['dialAMDActive']&&_0x1c478a[_0x27f4('0xe3')]==='MACHINE'){var _0x353076=this;return new BPromise(function(_0x1fbabd,_0xb104cb){delete _0x353076['uniqueId'][_0x1c478a[_0x27f4('0xdd')]];_0x353076[_0x27f4('0xcc')](_0x353076[_0x27f4('0x1f')][_0x192f27[_0x27f4('0xb1')]]);_0x353076[_0x27f4('0x1f')][_0x192f27['queue']][_0x27f4('0x5e')]+=0x1;_0x353076[_0x27f4('0x1f')][_0x192f27[_0x27f4('0xb1')]][_0x27f4('0x5d')]+=0x1;var _0x3b7f98=_0x353076[_0x27f4('0x1f')][_0x192f27['queue']];var _0x2cab6c=new Hangup(_0x192f27,_0x1c478a);_0x2cab6c[_0x27f4('0xeb')]=0x13;_0x2cab6c[_0x27f4('0xa9')]=_0x27f4('0xec');_0x2cab6c[_0x27f4('0xed')]=_0x27f4('0xee');_0x2cab6c[_0x27f4('0xef')]+=0x1;_0x2cab6c[_0x27f4('0xf0')]+=0x1;_0x2cab6c[_0x27f4('0xf1')]=!![];ami[_0x27f4('0xe5')](_0x27f4('0xe6'),ut['buildObj'](_0x2cab6c,_0x27f4('0xf1')));_0x353076[_0x27f4('0xca')](_0x2cab6c)[_0x27f4('0xb5')](loggerCatch(_0x27f4('0xf2')));if(_0x2cab6c['countbusyretry']+_0x2cab6c[_0x27f4('0xf3')]+_0x2cab6c[_0x27f4('0xf4')]+_0x2cab6c[_0x27f4('0xf5')]+_0x2cab6c[_0x27f4('0x105')]+_0x2cab6c[_0x27f4('0xf6')]+_0x2cab6c[_0x27f4('0xef')]+_0x2cab6c['countagentrejectretry']>=_0x3b7f98[_0x27f4('0xf8')]){_0x353076[_0x27f4('0xf9')](_0x2cab6c,_0x1fbabd,_0xb104cb,'reason19\x20machine....');}else{if(_0x2cab6c[_0x27f4('0xef')]>=_0x3b7f98[_0x27f4('0xfa')]){_0x353076['createStateFinal'](_0x2cab6c,_0x1fbabd,_0xb104cb,_0x27f4('0xfc'));}else{_0x353076[_0x27f4('0xbf')]({'active':![],'countmachineretry':_0x2cab6c['countmachineretry'],'scheduledat':moment()[_0x27f4('0xfd')](_0x3b7f98[_0x27f4('0xfe')],_0x27f4('0x106'))['format'](_0x27f4('0xff')),'ContactId':_0x2cab6c[_0x27f4('0xd3')],'ListId':_0x2cab6c[_0x27f4('0xd4')],'VoiceQueueId':_0x2cab6c['VoiceQueueId']||undefined,'CampaignId':_0x2cab6c['CampaignId']||undefined})['catch'](loggerCatch(_0x27f4('0x101')));_0x1fbabd({'reschedule':0x1});}}});}}};Dialer['prototype'][_0x27f4('0x33')]=function(_0x9e1962){var _0x8b01e6=this[_0x27f4('0x26')][_0x9e1962[_0x27f4('0xdd')]];var _0xafdfd6=this;var _0x3a7c08;if(_0x8b01e6&&_0x8b01e6[_0x27f4('0x4c')]===_0x27f4('0xe1')){delete this['uniqueId'][_0x9e1962[_0x27f4('0xdd')]];this[_0x27f4('0xcc')](this[_0x27f4('0x1f')][_0x8b01e6[_0x27f4('0xb1')]]);this[_0x27f4('0x1f')][_0x8b01e6[_0x27f4('0xb1')]][_0x27f4('0x107')]+=0x1;_0x3a7c08=new Hangup(_0x8b01e6,_0x9e1962);this['createHistory'](_0x3a7c08)[_0x27f4('0xb5')](loggerCatch(_0x27f4('0x108')));this[_0x27f4('0x109')](_0x3a7c08)[_0x27f4('0xb5')](loggerCatch(_0x27f4('0x10a')));}if(_0x8b01e6&&_0x8b01e6['type']!==_0x27f4('0xe1')&&isNotNull(this[_0x27f4('0x1e')][_0x8b01e6[_0x27f4('0xb1')]][_0x27f4('0x10b')])){delete this[_0x27f4('0x26')][_0x9e1962[_0x27f4('0xdd')]];this[_0x27f4('0xcc')](this[_0x27f4('0x1e')][_0x8b01e6[_0x27f4('0xb1')]]);this[_0x27f4('0x1e')][_0x8b01e6[_0x27f4('0xb1')]][_0x27f4('0x5e')]+=0x1;this[_0x27f4('0x1e')][_0x8b01e6[_0x27f4('0xb1')]][_0x27f4('0x5d')]+=0x1;_0x3a7c08=new Hangup(_0x8b01e6,_0x9e1962);_0x3a7c08[_0x27f4('0xeb')]=0x10;_0x3a7c08[_0x27f4('0xa9')]=_0x27f4('0x10c');_0x3a7c08[_0x27f4('0xed')]=_0x27f4('0x10d');this['createHistory'](_0x3a7c08)[_0x27f4('0xb5')](loggerCatch(_0x27f4('0x108')));this[_0x27f4('0x109')](_0x3a7c08)[_0x27f4('0xb5')](loggerCatch(_0x27f4('0x10a')));}if(_0x8b01e6&&_0x8b01e6[_0x27f4('0x4c')]!=='ivr'&&!isNotNull(this[_0x27f4('0x1e')][_0x8b01e6[_0x27f4('0xb1')]][_0x27f4('0x10b')])){delete this[_0x27f4('0x26')][_0x9e1962['uniqueid']];this[_0x27f4('0xcc')](this['voiceQueues'][_0x8b01e6[_0x27f4('0xb1')]]);this[_0x27f4('0x1e')][_0x8b01e6[_0x27f4('0xb1')]][_0x27f4('0x69')]+=0x1;_0x3a7c08=new Hangup(_0x8b01e6,_0x9e1962);_0x3a7c08['state']=0xc;_0x3a7c08[_0x27f4('0xa9')]=_0x9e1962[_0x27f4('0x10e')];_0x3a7c08[_0x27f4('0xed')]=_0x27f4('0x10f');this[_0x27f4('0xca')](_0x3a7c08)['catch'](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x27f4('0x109')](_0x3a7c08)['catch'](loggerCatch(_0x27f4('0x10a')));}};Dialer['prototype'][_0x27f4('0x110')]=function(_0x2d961a){var _0xf5fdca=this[_0x27f4('0x26')][_0x2d961a['uniqueid']];var _0x5dea3f=this;if(this['voiceQueues'][_0x2d961a[_0x27f4('0xb1')]]){if(_0xf5fdca&&_0xf5fdca[_0x27f4('0x4c')]!=='ivr'){delete this[_0x27f4('0x26')][_0x2d961a[_0x27f4('0xdd')]];this[_0x27f4('0x1e')][_0x2d961a[_0x27f4('0xb1')]]['outboundAnswerCallsDay']+=0x1;var _0x13b4a9=new AgentComplete(_0xf5fdca,_0x2d961a);if(_0x2d961a['reason']===_0x27f4('0x111')){_0x13b4a9[_0x27f4('0x112')]=this[_0x27f4('0x1e')][_0x2d961a[_0x27f4('0xb1')]][_0x27f4('0x113')]&&this[_0x27f4('0x1e')][_0x2d961a[_0x27f4('0xb1')]][_0x27f4('0x114')]?moment()[_0x27f4('0x79')](_0x27f4('0xff')):undefined;}this['createHistory'](_0x13b4a9)[_0x27f4('0xb5')](loggerCatch(_0x27f4('0x115')));this[_0x27f4('0x109')](_0x13b4a9)[_0x27f4('0xb5')](loggerCatch(_0x27f4('0x116')));}}};Dialer[_0x27f4('0x19')]['syncAgentConnect']=function(_0x1ba0e2){if(this['voiceQueues'][_0x1ba0e2['queue']]){if(this[_0x27f4('0x26')][_0x1ba0e2['uniqueid']]&&this[_0x27f4('0x26')][_0x1ba0e2[_0x27f4('0xdd')]][_0x27f4('0x4c')]!==_0x27f4('0xe1')){this[_0x27f4('0xcc')](this['voiceQueues'][_0x1ba0e2[_0x27f4('0xb1')]]);this[_0x27f4('0x26')][_0x1ba0e2[_0x27f4('0xdd')]]['answertime']=moment()[_0x27f4('0x79')](_0x27f4('0xff'));}}};Dialer[_0x27f4('0x19')][_0x27f4('0x117')]=function(_0x30dbe0){this[_0x27f4('0xca')](_0x30dbe0)[_0x27f4('0xb5')](loggerCatch(_0x27f4('0x115')));this[_0x27f4('0x109')](_0x30dbe0)[_0x27f4('0xb5')](loggerCatch(_0x27f4('0x118')));};Dialer[_0x27f4('0x19')][_0x27f4('0x2e')]=function(_0x562817){var _0x127aa7=this[_0x27f4('0x26')][_0x562817[_0x27f4('0xdd')]];var _0xde42b9=this;if(this[_0x27f4('0x1e')][_0x562817[_0x27f4('0xb1')]]){if(_0x127aa7&&_0x127aa7[_0x27f4('0x4c')]!==_0x27f4('0xe1')){delete this[_0x27f4('0x26')][_0x562817[_0x27f4('0xdd')]];this[_0x27f4('0xcc')](this[_0x27f4('0x1e')][_0x562817[_0x27f4('0xb1')]]);_0x127aa7[_0x27f4('0x119')]=moment()[_0x27f4('0x79')](_0x27f4('0xff'));var _0x34946b=new QueueCallerAbandon(_0x127aa7,_0x562817);if(getSeconds(_0x127aa7[_0x27f4('0x119')],_0x127aa7[_0x27f4('0x11a')])>=_0x127aa7[_0x27f4('0x11b')]){this[_0x27f4('0x1e')][_0x562817[_0x27f4('0xb1')]][_0x27f4('0x6a')]+=0x1;this[_0x27f4('0x1e')][_0x562817[_0x27f4('0xb1')]][_0x27f4('0x11c')]+=0x1;this['voiceQueues'][_0x562817[_0x27f4('0xb1')]][_0x27f4('0x6c')]+=0x1;_0x34946b[_0x27f4('0xeb')]=0xa;_0x34946b[_0x27f4('0xa9')]=_0x27f4('0x11d');_0x34946b[_0x27f4('0x11e')]=_0x27f4('0x11f');_0x34946b[_0x27f4('0x112')]=this[_0x27f4('0x1e')][_0x562817[_0x27f4('0xb1')]][_0x27f4('0x113')]?moment()['format'](_0x27f4('0xff')):undefined;_0x34946b[_0x27f4('0x105')]+=0x1;_0x34946b['countglobal']+=0x1;if(_0x34946b[_0x27f4('0x105')]>=this[_0x27f4('0x1e')][_0x562817[_0x27f4('0xb1')]][_0x27f4('0x120')]){this[_0x27f4('0x117')](_0x34946b);}else{this[_0x27f4('0xbf')]({'active':![],'countdropretry':_0x34946b[_0x27f4('0x105')],'scheduledat':moment()[_0x27f4('0xfd')](this['voiceQueues'][_0x562817[_0x27f4('0xb1')]][_0x27f4('0x121')],_0x27f4('0x106'))[_0x27f4('0x79')](_0x27f4('0xff')),'ContactId':_0x127aa7['ContactId'],'ListId':_0x127aa7[_0x27f4('0xd4')],'VoiceQueueId':_0x127aa7[_0x27f4('0xd6')]||undefined,'CampaignId':_0x127aa7[_0x27f4('0x100')]||undefined})[_0x27f4('0xb5')](loggerCatch('[rescheduleContact][Drop]'));var _0x42d20f=new History(_0x34946b);_0x42d20f[_0x27f4('0xeb')]=0xa;_0x42d20f[_0x27f4('0xa9')]=_0x27f4('0x11d');_0x42d20f[_0x27f4('0xab')]=moment()[_0x27f4('0x79')](_0x27f4('0xff'));_0x42d20f['endtime']=_0x42d20f['starttime'];_0x42d20f[_0x27f4('0x122')]=_0x34946b[_0x27f4('0x122')];_0x42d20f[_0x27f4('0x123')]=_0x34946b[_0x27f4('0x123')];this[_0x27f4('0xca')](_0x42d20f)[_0x27f4('0xb5')](loggerCatch(_0x27f4('0x124')));}}else{this[_0x27f4('0x1e')][_0x562817['queue']]['predictiveIntervalDroppedCallsCallersExit']+=0x1;this[_0x27f4('0x1e')][_0x562817[_0x27f4('0xb1')]]['outboundDropCallsDayCallersExit']+=0x1;_0x34946b['state']=0xb;_0x34946b['statedesc']='Abandoned';_0x34946b[_0x27f4('0x11e')]=_0x27f4('0x125');_0x34946b[_0x27f4('0xf6')]+=0x1;_0x34946b[_0x27f4('0xf0')]+=0x1;if(_0x34946b[_0x27f4('0xf6')]>=this['voiceQueues'][_0x562817[_0x27f4('0xb1')]]['dialAbandonedMaxRetry']){this[_0x27f4('0x117')](_0x34946b);}else{this['rescheduleContact']({'active':![],'countabandonedretry':_0x34946b[_0x27f4('0xf6')],'scheduledat':moment()[_0x27f4('0xfd')](this[_0x27f4('0x1e')][_0x562817['queue']][_0x27f4('0x126')],_0x27f4('0x106'))[_0x27f4('0x79')](_0x27f4('0xff')),'ContactId':_0x127aa7[_0x27f4('0xd3')],'ListId':_0x127aa7[_0x27f4('0xd4')],'VoiceQueueId':_0x127aa7[_0x27f4('0xd6')]||undefined,'CampaignId':_0x127aa7[_0x27f4('0x100')]||undefined})['catch'](loggerCatch(_0x27f4('0x127')));var _0x42d20f=new History(_0x34946b);_0x42d20f['state']=0xb;_0x42d20f[_0x27f4('0xa9')]=_0x27f4('0x128');_0x42d20f[_0x27f4('0xab')]=moment()[_0x27f4('0x79')](_0x27f4('0xff'));_0x42d20f[_0x27f4('0xaa')]=_0x42d20f[_0x27f4('0xab')];_0x42d20f['calleridname']=_0x34946b[_0x27f4('0x122')];_0x42d20f[_0x27f4('0x123')]=_0x34946b[_0x27f4('0x123')];this[_0x27f4('0xca')](_0x42d20f)[_0x27f4('0xb5')](loggerCatch(_0x27f4('0x129')));}}}}};Dialer[_0x27f4('0x19')]['syncNewExten']=function(_0xcaf1e8){if(this['actions'][_0xcaf1e8[_0x27f4('0xdd')]]){this[_0x27f4('0x24')][_0xcaf1e8[_0x27f4('0xdd')]][_0x27f4('0x12a')]=_0xcaf1e8['channel'];}if(this[_0x27f4('0x26')][_0xcaf1e8[_0x27f4('0xdd')]]){this[_0x27f4('0x26')][_0xcaf1e8[_0x27f4('0xdd')]][_0x27f4('0x12a')]=_0xcaf1e8[_0x27f4('0x12a')];}};Dialer[_0x27f4('0x19')]['syncQueueMember']=function(_0x55e038){if(strategy[this[_0x27f4('0x1e')][this[_0x27f4('0x24')][_0x55e038[_0x27f4('0x12b')]][_0x27f4('0xb1')]][_0x27f4('0x4e')]]===_0x27f4('0x18')){if(this[_0x27f4('0x24')][_0x55e038[_0x27f4('0x12b')]]&&_[_0x27f4('0xae')](this[_0x27f4('0x24')][_0x55e038[_0x27f4('0x12b')]][_0x27f4('0x12c')])&&_0x55e038[_0x27f4('0xd9')]==='1'&&_0x55e038[_0x27f4('0x12d')]==='0'){if(this[_0x27f4('0x20')][_0x55e038[_0x27f4('0x12e')]]){if(!this[_0x27f4('0x20')][_0x55e038['stateinterface']]['locked']){this['agents'][_0x55e038[_0x27f4('0x12e')]][_0x27f4('0x12c')]=!![];this['actions'][_0x55e038[_0x27f4('0x12b')]][_0x27f4('0x12c')]=!![];this[_0x27f4('0x24')][_0x55e038[_0x27f4('0x12b')]][_0x27f4('0x12e')]=_0x55e038[_0x27f4('0x12e')];}}}}else if((strategy[this[_0x27f4('0x1e')][this['actions'][_0x55e038['actionid']][_0x27f4('0xb1')]][_0x27f4('0x4e')]]||'rrmemory')===_0x27f4('0x17')){if(this[_0x27f4('0x24')][_0x55e038[_0x27f4('0x12b')]]){if(this[_0x27f4('0x20')][_0x55e038[_0x27f4('0x12e')]]){this[_0x27f4('0x24')][_0x55e038[_0x27f4('0x12b')]][_0x27f4('0x12e')]=_0x55e038[_0x27f4('0x12e')];if(_[_0x27f4('0xae')](this['queueBooked'][this[_0x27f4('0x24')][_0x55e038[_0x27f4('0x12b')]][_0x27f4('0xb1')]])){this['queueBooked'][this[_0x27f4('0x24')][_0x55e038[_0x27f4('0x12b')]][_0x27f4('0xb1')]]=[];}this['queueBooked'][this['actions'][_0x55e038[_0x27f4('0x12b')]][_0x27f4('0xb1')]]['push'](_[_0x27f4('0xd1')](_[_0x27f4('0xd2')](this[_0x27f4('0x24')][_0x55e038[_0x27f4('0x12b')]],['idHopper',_0x27f4('0x12e')]),{'status':_0x55e038['status'],'paused':_0x55e038[_0x27f4('0x12d')]}));}}}};function unlockQueueStatus(_0x5d3275,_0x401012){setTimeout(function(){if(_[_0x27f4('0x3e')](_0x5d3275[_0x27f4('0x12f')])){loggerBooked['error'](_0x27f4('0x130'),_0x401012);}_0x5d3275['queueStatusComplete']=!![];loggerBooked[_0x27f4('0x7e')](_0x27f4('0x131'),_0x401012,JSON[_0x27f4('0x48')](_['pick'](_0x5d3275,[_0x27f4('0x3f'),_0x27f4('0x12f')])));},0x1f3);}Dialer[_0x27f4('0x19')][_0x27f4('0x39')]=function(_0x1c72b2){var _0x425088=this;var _0x42be48=_0x425088['voiceQueues'][_0x425088[_0x27f4('0x24')][_0x1c72b2[_0x27f4('0x12b')]][_0x27f4('0xb1')]];if(strategy[this[_0x27f4('0x1e')][this[_0x27f4('0x24')][_0x1c72b2[_0x27f4('0x12b')]][_0x27f4('0xb1')]][_0x27f4('0x4e')]]===_0x27f4('0x18')){if(this[_0x27f4('0x24')][_0x1c72b2[_0x27f4('0x12b')]]&&this[_0x27f4('0x24')][_0x1c72b2[_0x27f4('0x12b')]]['stateinterface']){this[_0x27f4('0x1d')][_0x27f4('0x132')](this[_0x27f4('0x24')][_0x1c72b2['actionid']][_0x27f4('0x133')],this[_0x27f4('0x24')][_0x1c72b2[_0x27f4('0x12b')]][_0x27f4('0x12e')])[_0x27f4('0xb5')](function(_0x57025d){logger[_0x27f4('0x97')](_0x27f4('0x134'),util[_0x27f4('0x99')](_0x57025d,{'showHidden':![],'depth':null}));})[_0x27f4('0x135')](function(){_0x425088[_0x27f4('0xcc')](_0x425088[_0x27f4('0x1e')][_0x425088['actions'][_0x1c72b2['actionid']][_0x27f4('0xb1')]]);_0x425088[_0x27f4('0x20')][_0x425088[_0x27f4('0x24')][_0x1c72b2['actionid']][_0x27f4('0x12e')]][_0x27f4('0x12c')]=![];delete _0x425088[_0x27f4('0x24')][_0x1c72b2['actionid']];unlockQueueStatus(_0x42be48);});}else{this[_0x27f4('0xcc')](this[_0x27f4('0x1e')][this[_0x27f4('0x24')][_0x1c72b2['actionid']][_0x27f4('0xb1')]]);this[_0x27f4('0xbf')]({'active':![],'ContactId':this[_0x27f4('0x24')][_0x1c72b2[_0x27f4('0x12b')]][_0x27f4('0xd3')],'ListId':this[_0x27f4('0x24')][_0x1c72b2['actionid']][_0x27f4('0xd4')],'VoiceQueueId':this[_0x27f4('0x24')][_0x1c72b2[_0x27f4('0x12b')]][_0x27f4('0xd6')]||undefined,'CampaignId':this[_0x27f4('0x24')][_0x1c72b2['actionid']][_0x27f4('0x100')]||undefined})[_0x27f4('0xb5')](loggerCatch(_0x27f4('0x136')));delete this[_0x27f4('0x24')][_0x1c72b2[_0x27f4('0x12b')]];unlockQueueStatus(_0x42be48);}}else if((strategy[this[_0x27f4('0x1e')][this[_0x27f4('0x24')][_0x1c72b2[_0x27f4('0x12b')]][_0x27f4('0xb1')]]['strategy']]||'rrmemory')===_0x27f4('0x17')){var _0x410c0e;if(this[_0x27f4('0x24')][_0x1c72b2[_0x27f4('0x12b')]]&&!_[_0x27f4('0x7c')](this[_0x27f4('0x29')][this[_0x27f4('0x24')][_0x1c72b2[_0x27f4('0x12b')]][_0x27f4('0xb1')]])){if(this[_0x27f4('0x2a')][_0x425088[_0x27f4('0x24')][_0x1c72b2[_0x27f4('0x12b')]][_0x27f4('0xb1')]]){this[_0x27f4('0x2a')][_0x425088[_0x27f4('0x24')][_0x1c72b2[_0x27f4('0x12b')]][_0x27f4('0xb1')]]=this[_0x27f4('0x2a')][this['actions'][_0x1c72b2['actionid']][_0x27f4('0xb1')]]?this['queueBookedRR'][this[_0x27f4('0x24')][_0x1c72b2[_0x27f4('0x12b')]]['queue']]:this[_0x27f4('0x29')][this[_0x27f4('0x24')][_0x1c72b2[_0x27f4('0x12b')]][_0x27f4('0xb1')]]?this[_0x27f4('0x29')][this['actions'][_0x1c72b2[_0x27f4('0x12b')]][_0x27f4('0xb1')]]['_rr']||0x0:0x0;}this['queueBooked'][this[_0x27f4('0x24')][_0x1c72b2[_0x27f4('0x12b')]][_0x27f4('0xb1')]][_0x27f4('0x137')]=this[_0x27f4('0x2a')][this[_0x27f4('0x24')][_0x1c72b2[_0x27f4('0x12b')]][_0x27f4('0xb1')]];for(var _0x2c57ee=0x0;_0x2c57ee=0x0;})[_0x27f4('0xb5')](myreject(_0x142ae8)));}}else{_0x5a7d50[_0x27f4('0x14f')](ami[_0x27f4('0xaf')]({'action':_0x27f4('0x154'),'command':util[_0x27f4('0x79')](_0x27f4('0x150'),_0x15f3e1,!_[_0x27f4('0x3e')](config[_0x27f4('0x14c')][_0x459d30])?_0x459d30:'')})[_0x27f4('0x3c')](function(_0x20bbad){return _0x20bbad[_0x27f4('0x152')][_0x27f4('0x155')](_0x27f4('0x153'))>=0x0;})[_0x27f4('0xb5')](myreject(_0x142ae8)));}BPromise[_0x27f4('0x156')](_0x5a7d50)['then'](function(_0x6237c5){var _0x2c68ec=_['some'](_0x6237c5);if(_0x2c68ec){return _0x38192c(_0x2c68ec);}else{_0x17abde[_0x27f4('0x41')]=_0x115225?_0x27f4('0x157'):_0x27f4('0x158');return _0x142ae8(msgResponse(_0x27f4('0x159'),'Failure','Global:\x20'+_0x115225+'\x20'+_0x523e2a+_0x27f4('0x15a')+util[_0x27f4('0x99')](_0x15f3e1,{'showHidden':![],'depth':null})+_0x27f4('0x15b')+_0x459d30));}})[_0x27f4('0xb5')](function(_0x31d9fa){return _0x142ae8(msgResponse(_0x27f4('0x147'),_0x27f4('0x149'),JSON[_0x27f4('0x48')](_0x31d9fa)));});});};Dialer[_0x27f4('0x19')][_0x27f4('0x15c')]=function(_0x5e5cfd){var _0x300b71=this;return function(){switch(_0x5e5cfd[_0x27f4('0x5a')]){case'progressive':freeVariablesPredictive(_0x5e5cfd);_0x300b71[_0x27f4('0x15d')](_0x5e5cfd,0x1);break;case _0x27f4('0x15e'):freeVariablesPredictive(_0x5e5cfd);_0x300b71[_0x27f4('0x15d')](_0x5e5cfd,_0x5e5cfd[_0x27f4('0x15f')]);break;case _0x27f4('0xa'):_0x300b71[_0x27f4('0xa')](_0x5e5cfd);break;case'booked':freeVariablesPredictive(_0x5e5cfd);_0x300b71[_0x27f4('0x15d')](_0x5e5cfd,0x1);break;default:freeVariablesPredictive(_0x5e5cfd);logger[_0x27f4('0x97')]('Queue',_0x5e5cfd[_0x27f4('0x3f')],_0x27f4('0x160'));}};};Dialer[_0x27f4('0x19')][_0x27f4('0x161')]=function(_0x3adebe){return BPromise[_0x27f4('0xb8')]()['then'](cmHopper['handlePreviewRecallNotifications'](_0x3adebe['id'],previewRecallmeReminderInterval))['then'](function(_0x22ee59){for(var _0xea59b1=0x0;_0xea59b1<_0x22ee59['length'];_0xea59b1++){var _0x473346=_0x22ee59[_0xea59b1]['Agent'][_0x27f4('0x3f')];if(_0x473346)io['to'](util['format'](_0x27f4('0x162'),_0x473346))[_0x27f4('0xe5')]('user:dialPreviewRecallReminder',{'hopper':_0x22ee59[_0xea59b1]});}})[_0x27f4('0xb5')](function(_0x43f0c6){});};Dialer['prototype'][_0x27f4('0x163')]=function(_0x46213b){var _0x5e1115=this;return function(){_0x5e1115[_0x27f4('0x164')](_0x46213b);};};Dialer['prototype'][_0x27f4('0x165')]=function(_0x15d1d9){var _0x111d5e=this;if(isNotPreview(_0x15d1d9[_0x27f4('0x5a')])){if(isVoiceQueueOutbound(_0x15d1d9[_0x27f4('0x4c')])&&isActive(_0x15d1d9[_0x27f4('0x59')])){_0x15d1d9[_0x27f4('0xa2')]=!![];BPromise['resolve']()['then'](checkIsLoggedIn(_0x15d1d9,_0x15d1d9['loggedIn']))['then'](checkIsActive(_0x15d1d9,_0x15d1d9[_0x27f4('0x59')]))[_0x27f4('0x3c')](checkInterval(_0x15d1d9))['then'](_0x111d5e[_0x27f4('0x142')](_0x15d1d9))['then'](_0x111d5e[_0x27f4('0x146')](_0x15d1d9[_0x27f4('0x166')],_0x15d1d9[_0x27f4('0x167')],_0x15d1d9[_0x27f4('0x3f')],_0x15d1d9))[_0x27f4('0x3c')](_0x111d5e[_0x27f4('0x148')](_0x15d1d9['Interval'],_0x15d1d9[_0x27f4('0x167')],_0x15d1d9[_0x27f4('0x3f')],_0x15d1d9))['then'](_0x111d5e[_0x27f4('0x15c')](_0x15d1d9))[_0x27f4('0xb5')](loggerCatchQueueSummary(_0x27f4('0x168'),_0x15d1d9));}else{notSendMessagesQueue(_0x15d1d9);}}else{freeVariablesPredictive(_0x15d1d9);if(_0x15d1d9[_0x27f4('0x169')]){_0x111d5e[_0x27f4('0x161')](_0x15d1d9);}}};Dialer[_0x27f4('0x19')]['syncCampaigns']=function(){var _0x132b3e=this;var _0x362e7b;for(var _0x95dd3a in this[_0x27f4('0x1f')]){if(typeof this[_0x27f4('0x1f')][_0x95dd3a]!==_0x27f4('0x9b')){_0x362e7b=this['campaigns'][_0x95dd3a];if(isCampaignIvr(_0x362e7b[_0x27f4('0x4c')])&&isActive(_0x362e7b['active'])){_0x362e7b[_0x27f4('0xa2')]=!![];BPromise[_0x27f4('0xb8')]()[_0x27f4('0x3c')](checkIsActive(_0x362e7b,_0x362e7b['active']))[_0x27f4('0x3c')](checkInterval(_0x362e7b))['then'](_0x132b3e['checkIsTrunkReachable'](_0x362e7b))[_0x27f4('0x3c')](_0x132b3e['checkIfTime'](_0x362e7b[_0x27f4('0x166')],_0x362e7b['dialTimezone'],_0x362e7b[_0x27f4('0x3f')],_0x362e7b))[_0x27f4('0x3c')](_0x132b3e['checkIfTimeIntervals'](_0x362e7b['Interval'],_0x362e7b['dialTimezone'],_0x362e7b['name'],_0x362e7b))['then'](_0x132b3e['launchHandleIvr'](_0x362e7b))['catch'](loggerCatchQueueSummary(_0x27f4('0x16a'),_0x362e7b));}else{notSendMessagesCampaign(_0x362e7b);}}}};function getCallerIdRandom(_0x4ed9fc,_0x284399){var _0x3a5690;var _0x1a8b6e;var _0x409357;if(_0x284399<=0x0){_0x284399=0x1;}_0x3a5690=new RegExp(_0x27f4('0x16b')+_0x284399+'}$');_0x1a8b6e=Math[_0x27f4('0x16c')](0xa,_0x284399-0x1);_0x409357=Math[_0x27f4('0x16c')](0xa,_0x284399)-0x1;return util[_0x27f4('0x79')]('%s',_[_0x27f4('0x16d')](_0x4ed9fc,_0x3a5690,_[_0x27f4('0x16e')](_0x1a8b6e,_0x409357)));}function extractCalleridName(_0x14819a){var _0x2b3dd9=_0x14819a[_0x27f4('0x16f')](/"(.*?)"/);return _0x2b3dd9?_0x2b3dd9[0x1]:_0x14819a;}function extractCalleridNumber(_0x4d5a69){var _0xa37a03=_0x4d5a69[_0x27f4('0x16f')](/<(.*?)>/);return _0xa37a03?_0xa37a03[0x1]:_0x4d5a69;}Dialer[_0x27f4('0x19')][_0x27f4('0x170')]=function(_0x373dac,_0x7ad8fb){var _0x339bfd=this;var _0x22e937=uuid['v4']();this[_0x27f4('0x24')][_0x22e937]=new Action(_0x373dac,_0x7ad8fb,_0x22e937);return new BPromise(function(_0x17c01f,_0x65b1b1){if(_[_0x27f4('0x3e')](_0x373dac)&&typeof _0x373dac!==_0x27f4('0x171')){return _0x65b1b1(msgResponse(_0x27f4('0x172'),'Failure',_0x27f4('0x173')));}if(_[_0x27f4('0x3e')](_0x7ad8fb['Contact'][_0x27f4('0x174')])||_0x7ad8fb[_0x27f4('0x175')]['phone']===null){return _0x65b1b1(msgResponse(_0x27f4('0x172'),_0x27f4('0x149'),'contact\x20is\x20undefine'));}var _0x93cf48={'XMD-CALLERID':_0x339bfd[_0x27f4('0x24')][_0x22e937][_0x27f4('0x176')](),'XMD-AGI':_0x373dac['dialQueueProject']?util[_0x27f4('0x79')](_0x27f4('0x177'),ipAgi,_0x373dac[_0x27f4('0x10b')]):_0x27f4('0x178'),'XMD-AGIAFTER':_0x373dac[_0x27f4('0x113')]?util[_0x27f4('0x79')](_0x27f4('0x177'),ipAgi,_0x373dac[_0x27f4('0x113')]):_0x27f4('0x178'),'XMD-QUEUE':_0x373dac[_0x27f4('0x4c')]===_0x27f4('0x4d')?util[_0x27f4('0x79')](_0x27f4('0x179'),_0x373dac[_0x27f4('0x3f')],_0x373dac[_0x27f4('0x17a')]||'',_0x373dac[_0x27f4('0x114')]?'c':'',_0x373dac[_0x27f4('0x11b')]||0x3):_0x27f4('0x178'),'XMD-CONTACTID':_0x7ad8fb['ContactId'],'XMD-CDRTYPE':_0x27f4('0x7'),'CALLERID(all)':_0x339bfd[_0x27f4('0x24')][_0x22e937][_0x27f4('0x176')](),'XMD-AMD':_0x373dac[_0x27f4('0xe2')]?_0x27f4('0x17b'):_0x27f4('0x178'),'XMD-DESTINATION':_0x27f4('0xe0')};if(_0x373dac['dialAMDActive']){_0x93cf48[_0x27f4('0x17c')]=_0x373dac['dialAMDInitialSilence']||0x9c4;_0x93cf48[_0x27f4('0x17d')]=_0x373dac[_0x27f4('0x17e')]||0x5dc;_0x93cf48[_0x27f4('0x17f')]=_0x373dac['dialAMDAfterGreetingSilence']||0x320;_0x93cf48[_0x27f4('0x180')]=_0x373dac['dialAMDTotalAnalysisTime']||0x1388;_0x93cf48[_0x27f4('0x181')]=_0x373dac[_0x27f4('0x182')]||0x64;_0x93cf48['XMD-AMDBETWEENWORDSSILENCE']=_0x373dac['dialAMDBetweenWordsSilence']||0x32;_0x93cf48[_0x27f4('0x183')]=_0x373dac[_0x27f4('0x184')]||0x3;_0x93cf48[_0x27f4('0x185')]=_0x373dac[_0x27f4('0x186')]||0x100;_0x93cf48[_0x27f4('0x187')]=_0x373dac[_0x27f4('0x188')]||0x1388;}if(_0x373dac['type']===_0x27f4('0x4d')){_0x93cf48[_0x27f4('0x189')]=_0x7ad8fb['VoiceQueueId'];}else{_0x93cf48['XMD-CAMPAIGNID']=_0x7ad8fb[_0x27f4('0x100')];}for(var _0x2676f2 in _0x7ad8fb['Contact']){if(typeof _0x7ad8fb[_0x27f4('0x175')][_0x2676f2]!=='undefined'){if(isNotNull(_0x7ad8fb[_0x27f4('0x175')][_0x2676f2])&&_0x2676f2!=='id'&&_0x2676f2!==_0x27f4('0x18a')&&_0x2676f2!=='createdAt'&&_0x2676f2!=='updatedAt'){_0x93cf48[util[_0x27f4('0x79')](_0x27f4('0x18b'),_0x27f4('0x18c'),_[_0x27f4('0x18d')](_0x2676f2))]=_0x7ad8fb[_0x27f4('0x175')][_0x2676f2];}}}var _0x3c7562=_0x339bfd[_0x27f4('0x143')](_0x373dac[_0x27f4('0x76')])?getCallerId(_0x373dac[_0x27f4('0x76')][_0x27f4('0x78')],_0x373dac[_0x27f4('0x18e')],_0x373dac[_0x27f4('0x18f')]>0x0?getCallerIdRandom(_0x373dac['dialOriginateCallerIdNumber'],_0x373dac['dialRandomLastDigitCallerIdNumber']):_0x373dac[_0x27f4('0x190')]):getCallerId(_[_0x27f4('0xae')](_0x373dac[_0x27f4('0x191')])?_0x373dac[_0x27f4('0x76')][_0x27f4('0x78')]:_0x373dac[_0x27f4('0x191')][_0x27f4('0x78')],_0x373dac[_0x27f4('0x18e')],_0x373dac[_0x27f4('0x18f')]>0x0?getCallerIdRandom(_0x373dac[_0x27f4('0x190')],_0x373dac[_0x27f4('0x18f')]):_0x373dac[_0x27f4('0x190')]);if(_0x3c7562){_0x93cf48['XMD-ORIGINATECALLERIDNAME']=_0x339bfd[_0x27f4('0x24')][_0x22e937][_0x27f4('0x192')]=extractCalleridName(_0x3c7562);_0x93cf48[_0x27f4('0x193')]=_0x339bfd['actions'][_0x22e937][_0x27f4('0x194')]=extractCalleridNumber(_0x3c7562);}return ami['Action']({'actionid':_0x22e937,'action':'originate','channel':_0x339bfd[_0x27f4('0x143')](_0x373dac[_0x27f4('0x76')])?util[_0x27f4('0x79')](_0x27f4('0x195'),_0x373dac[_0x27f4('0x76')]['name'],isNotNull(_0x373dac[_0x27f4('0x5c')])?_0x373dac[_0x27f4('0x5c')][_0x27f4('0x196')]()||'':'',_0x373dac[_0x27f4('0x197')]>0x0?_0x7ad8fb[_0x27f4('0x175')][_0x27f4('0x174')][_0x27f4('0x198')](_0x373dac[_0x27f4('0x197')]):_0x7ad8fb[_0x27f4('0x175')][_0x27f4('0x174')]):util['format'](_0x27f4('0x195'),_[_0x27f4('0xae')](_0x373dac[_0x27f4('0x191')])?_0x373dac[_0x27f4('0x76')]['name']:_0x373dac[_0x27f4('0x191')][_0x27f4('0x3f')],isNotNull(_0x373dac[_0x27f4('0x5c')])?_0x373dac[_0x27f4('0x5c')]['trim']()||'':'',_0x373dac[_0x27f4('0x197')]>0x0?_0x7ad8fb['Contact'][_0x27f4('0x174')]['substring'](_0x373dac[_0x27f4('0x197')]):_0x7ad8fb[_0x27f4('0x175')][_0x27f4('0x174')]),'callerid':_0x3c7562,'Exten':_0x27f4('0xe0'),'Context':_0x27f4('0x199'),'Priority':'1','variable':_0x93cf48,'timeout':(_0x373dac[_0x27f4('0x5b')]||0x1e)*0x3e8,'async':!![],'channelid':_0x22e937})[_0x27f4('0x3c')](function(_0x507df7){return _0x17c01f(_0x507df7);})['catch'](function(_0xfa131f){_0x373dac[_0x27f4('0x66')]+=0x1;var _0xc8af82=new History(_0x339bfd[_0x27f4('0x24')][_0x22e937]);logger[_0x27f4('0x97')](util[_0x27f4('0x79')](_0x27f4('0x19a'),JSON[_0x27f4('0x48')](_0xfa131f)));_0xc8af82[_0x27f4('0xeb')]=0xe;_0xc8af82[_0x27f4('0xa9')]=_0x27f4('0x19b');_0xc8af82[_0x27f4('0xab')]=moment()[_0x27f4('0x79')](_0x27f4('0xff'));_0xc8af82[_0x27f4('0xaa')]=_0xc8af82[_0x27f4('0xab')];_0x339bfd['createHistory'](_0xc8af82)[_0x27f4('0xb5')](loggerCatch('[originate][error]'));_0x339bfd[_0x27f4('0x109')](_0xc8af82)[_0x27f4('0xb5')](loggerCatch('[originate][error]'))[_0x27f4('0x135')](function(){delete _0x339bfd[_0x27f4('0x24')][_0x22e937];return _0x65b1b1(msgResponse(_0x27f4('0x172'),_0x27f4('0x47'),_0x27f4('0x19c')));});});});};Dialer[_0x27f4('0x19')]['syncOriginateResponse']=function(_0x552b92){var _0x221315=this[_0x27f4('0x24')][_0x552b92[_0x27f4('0x12b')]];if(_0x221315){delete this[_0x27f4('0x24')][_0x552b92[_0x27f4('0x12b')]];_0x221315[_0x27f4('0x11a')]=moment()[_0x27f4('0x79')](_0x27f4('0xff'));var _0x21d5ba=_0x221315[_0x27f4('0x4c')]===_0x27f4('0xe1')?this[_0x27f4('0x1f')][_0x221315[_0x27f4('0xb1')]]:this[_0x27f4('0x1e')][_0x221315[_0x27f4('0x19d')]()];if(!this[_0x27f4('0x19e')](_0x552b92['response'])){this['updateOriginated'](_0x21d5ba);return this[_0x27f4('0x19f')](_0x221315,_0x21d5ba,_0x552b92)['catch'](loggerCatch(_0x27f4('0x1a0')));}this[_0x27f4('0x26')][_0x552b92[_0x27f4('0xdd')]]=_0x221315;}};Dialer['prototype'][_0x27f4('0x1a1')]=function(_0x78b172,_0x134c89,_0x22188b){var _0x1d7d70=new History(_0x134c89);if(_0x1d7d70['countbusyretry']+_0x1d7d70['countcongestionretry']+_0x1d7d70[_0x27f4('0xf4')]+_0x1d7d70[_0x27f4('0xf5')]+_0x1d7d70[_0x27f4('0x105')]+_0x1d7d70['countabandonedretry']+_0x1d7d70[_0x27f4('0xef')]+_0x1d7d70[_0x27f4('0xf7')]>=_0x22188b['dialGlobalMaxRetry']-0x1){return!![];}switch(_0x78b172){case 0x3:if(_0x1d7d70[_0x27f4('0xf4')]>=_0x22188b['dialNoAnswerMaxRetry']-0x1){return!![];}this[_0x27f4('0xbf')]({'active':![],'countnoanswerretry':_0x1d7d70[_0x27f4('0xf4')]+=0x1,'scheduledat':moment()[_0x27f4('0xfd')](_0x22188b[_0x27f4('0x1a2')],_0x27f4('0x106'))['format'](_0x27f4('0xff')),'ContactId':_0x1d7d70[_0x27f4('0xd3')],'ListId':_0x1d7d70[_0x27f4('0xd4')],'VoiceQueueId':_0x1d7d70[_0x27f4('0xd6')]||undefined,'CampaignId':_0x1d7d70[_0x27f4('0x100')]||undefined})[_0x27f4('0xb5')](loggerCatch(_0x27f4('0x1a3')));break;case 0x5:if(_0x1d7d70[_0x27f4('0x1a4')]>=_0x22188b['dialBusyMaxRetry']-0x1){return!![];}this['rescheduleContact']({'active':![],'countbusyretry':_0x1d7d70[_0x27f4('0x1a4')]+=0x1,'scheduledat':moment()[_0x27f4('0xfd')](_0x22188b['dialBusyRetryFrequency'],_0x27f4('0x106'))['format'](_0x27f4('0xff')),'ContactId':_0x1d7d70[_0x27f4('0xd3')],'ListId':_0x1d7d70[_0x27f4('0xd4')],'VoiceQueueId':_0x1d7d70[_0x27f4('0xd6')]||undefined,'CampaignId':_0x1d7d70['CampaignId']||undefined})[_0x27f4('0xb5')](loggerCatch(_0x27f4('0x1a5')));break;case 0x8:if(_0x1d7d70[_0x27f4('0xf3')]>=_0x22188b[_0x27f4('0x1a6')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countcongestionretry':_0x1d7d70[_0x27f4('0xf3')]+=0x1,'scheduledat':moment()[_0x27f4('0xfd')](_0x22188b[_0x27f4('0x1a7')],_0x27f4('0x106'))['format'](_0x27f4('0xff')),'ContactId':_0x1d7d70[_0x27f4('0xd3')],'ListId':_0x1d7d70[_0x27f4('0xd4')],'VoiceQueueId':_0x1d7d70[_0x27f4('0xd6')]||undefined,'CampaignId':_0x1d7d70[_0x27f4('0x100')]||undefined})[_0x27f4('0xb5')](loggerCatch(_0x27f4('0x1a8')));break;case 0x0:if(_0x1d7d70[_0x27f4('0xf5')]>=_0x22188b[_0x27f4('0x1a9')]-0x1){return!![];}else{this[_0x27f4('0xbf')]({'active':![],'countnosuchnumberretry':_0x1d7d70['countnosuchnumberretry']+=0x1,'scheduledat':moment()['add'](_0x22188b[_0x27f4('0x1aa')],_0x27f4('0x106'))[_0x27f4('0x79')](_0x27f4('0xff')),'ContactId':_0x1d7d70[_0x27f4('0xd3')],'ListId':_0x1d7d70[_0x27f4('0xd4')],'VoiceQueueId':_0x1d7d70[_0x27f4('0xd6')]||undefined,'CampaignId':_0x1d7d70[_0x27f4('0x100')]||undefined})[_0x27f4('0xb5')](loggerCatch(_0x27f4('0x1ab')));}break;case 0xa:if(_0x1d7d70[_0x27f4('0x105')]>=_0x22188b[_0x27f4('0x120')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countdropretry':_0x1d7d70[_0x27f4('0x105')]+=0x1,'scheduledat':moment()[_0x27f4('0xfd')](_0x22188b['dialDropRetryFrequency'],_0x27f4('0x106'))[_0x27f4('0x79')](_0x27f4('0xff')),'ContactId':_0x1d7d70[_0x27f4('0xd3')],'ListId':_0x1d7d70[_0x27f4('0xd4')],'VoiceQueueId':_0x1d7d70[_0x27f4('0xd6')]||undefined,'CampaignId':_0x1d7d70[_0x27f4('0x100')]||undefined})[_0x27f4('0xb5')](loggerCatch(_0x27f4('0x1ac')));break;case 0xb:if(_0x1d7d70[_0x27f4('0xf6')]>=_0x22188b['dialAbandonedMaxRetry']-0x1){return!![];}this[_0x27f4('0xbf')]({'active':![],'countabandonedretry':_0x1d7d70[_0x27f4('0xf6')]+=0x1,'scheduledat':moment()[_0x27f4('0xfd')](_0x22188b[_0x27f4('0x126')],'minutes')['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1d7d70[_0x27f4('0xd3')],'ListId':_0x1d7d70[_0x27f4('0xd4')],'VoiceQueueId':_0x1d7d70['VoiceQueueId']||undefined,'CampaignId':_0x1d7d70[_0x27f4('0x100')]||undefined})[_0x27f4('0xb5')](loggerCatch(_0x27f4('0x127')));break;case 0x13:if(_0x1d7d70['countmachineretry']>=_0x22188b[_0x27f4('0xfa')]-0x1){return!![];}this[_0x27f4('0xbf')]({'active':![],'countmachineretry':_0x1d7d70['countmachineretry']+=0x1,'scheduledat':moment()[_0x27f4('0xfd')](_0x22188b['dialMachineRetryFrequency'],'minutes')['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1d7d70[_0x27f4('0xd3')],'ListId':_0x1d7d70[_0x27f4('0xd4')],'VoiceQueueId':_0x1d7d70['VoiceQueueId']||undefined,'CampaignId':_0x1d7d70[_0x27f4('0x100')]||undefined})[_0x27f4('0xb5')](loggerCatch(_0x27f4('0x101')));break;case 0x14:if(_0x1d7d70[_0x27f4('0xf7')]>=_0x22188b['dialAgentRejectMaxRetry']-0x1){return!![];}this[_0x27f4('0xbf')]({'active':![],'countagentrejectretry':_0x1d7d70['countagentrejectretry']+=0x1,'scheduledat':moment()[_0x27f4('0xfd')](_0x22188b[_0x27f4('0x1ad')],_0x27f4('0x106'))['format'](_0x27f4('0xff')),'ContactId':_0x1d7d70[_0x27f4('0xd3')],'ListId':_0x1d7d70[_0x27f4('0xd4')],'VoiceQueueId':_0x1d7d70[_0x27f4('0xd6')]||undefined,'CampaignId':_0x1d7d70['CampaignId']||undefined})[_0x27f4('0xb5')](loggerCatch(_0x27f4('0x1ae')));break;default:return!![];}};Dialer[_0x27f4('0x19')][_0x27f4('0x19f')]=function(_0x5df133,_0x545fb9,_0x54736d){var _0x540c02=this;var _0x5b267a=new History(_0x5df133);return new BPromise(function(_0x11f3ef,_0x2a392c){if(_['isUndefined'](_0x545fb9)&&typeof _0x545fb9!==_0x27f4('0x171')){return _0x2a392c(msgResponse(_0x27f4('0x1af'),_0x27f4('0x149'),_0x27f4('0x1b0')));}if(_[_0x27f4('0x3e')](_0x54736d)&&typeof _0x54736d!==_0x27f4('0x171')){return _0x2a392c(msgResponse(_0x27f4('0x1af'),_0x27f4('0x149'),_0x27f4('0x1b1')));}switch(_0x54736d[_0x27f4('0x1b2')]){case'0':_0x545fb9['outboundNoSuchCallsDay']+=0x1;_0x5b267a[_0x27f4('0xeb')]=0x0;_0x5b267a[_0x27f4('0xa9')]=_0x27f4('0x1b3');_0x5b267a[_0x27f4('0xf5')]+=0x1;_0x5b267a[_0x27f4('0xf0')]+=0x1;ami['emit'](_0x27f4('0x1b4'),ut[_0x27f4('0xe7')](_0x5df133,_0x27f4('0x1b5')));_0x540c02[_0x27f4('0xca')](_0x5b267a)[_0x27f4('0xb5')](loggerCatch(_0x27f4('0xf2')));if(_0x540c02[_0x27f4('0x1a1')](0x0,_0x5df133,_0x545fb9)){if(_0x5b267a['countnosuchnumberretry']>=_0x545fb9[_0x27f4('0x1a9')]){_0x540c02[_0x27f4('0xfb')](_0x5b267a,_0x11f3ef,_0x2a392c,'reason\x200\x20no\x20such\x20number....');}else{_0x540c02[_0x27f4('0xf9')](_0x5b267a,_0x11f3ef,_0x2a392c,_0x27f4('0x1b6'));}}break;case'3':_0x545fb9['outboundNoAnswerCallsDay']+=0x1;_0x5b267a[_0x27f4('0xeb')]=0x3;_0x5b267a[_0x27f4('0xa9')]=_0x27f4('0x1b7');_0x5b267a[_0x27f4('0xf4')]+=0x1;_0x5b267a[_0x27f4('0xf0')]+=0x1;ami[_0x27f4('0xe5')](_0x27f4('0x1b8'),ut[_0x27f4('0xe7')](_0x5df133,_0x27f4('0x1b9')));_0x540c02[_0x27f4('0xca')](_0x5b267a)['catch'](loggerCatch(_0x27f4('0x1ba')));if(_0x540c02[_0x27f4('0x1a1')](0x3,_0x5df133,_0x545fb9)){if(_0x5b267a['countnoanswerretry']>=_0x545fb9[_0x27f4('0x1bb')]){_0x540c02[_0x27f4('0xfb')](_0x5b267a,_0x11f3ef,_0x2a392c,_0x27f4('0x1bc'));}else{_0x540c02['stateGlobal'](_0x5b267a,_0x11f3ef,_0x2a392c,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0x545fb9[_0x27f4('0x60')]+=0x1;_0x5b267a[_0x27f4('0xeb')]=0x5;_0x5b267a['statedesc']=_0x27f4('0x1bd');_0x5b267a['countbusyretry']+=0x1;_0x5b267a[_0x27f4('0xf0')]+=0x1;ami[_0x27f4('0xe5')](_0x27f4('0x1be'),ut[_0x27f4('0xe7')](_0x5df133,_0x27f4('0x1bf')));_0x540c02[_0x27f4('0xca')](_0x5b267a)[_0x27f4('0xb5')](loggerCatch(_0x27f4('0x1c0')));if(_0x540c02[_0x27f4('0x1a1')](0x5,_0x5df133,_0x545fb9)){if(_0x5b267a[_0x27f4('0x1a4')]>=_0x545fb9[_0x27f4('0x1c1')]){_0x540c02['createStateFinal'](_0x5b267a,_0x11f3ef,_0x2a392c,_0x27f4('0x1c2'));}else{_0x540c02[_0x27f4('0xf9')](_0x5b267a,_0x11f3ef,_0x2a392c,_0x27f4('0x1c2'));}}break;case'8':_0x545fb9[_0x27f4('0x61')]+=0x1;_0x5b267a['state']=0x8;_0x5b267a[_0x27f4('0xa9')]='Congestion';_0x5b267a[_0x27f4('0xf3')]+=0x1;_0x5b267a[_0x27f4('0xf0')]+=0x1;ami[_0x27f4('0xe5')](_0x27f4('0x1c3'),ut[_0x27f4('0xe7')](_0x5df133,_0x27f4('0x1c4')));_0x540c02[_0x27f4('0xca')](_0x5b267a)[_0x27f4('0xb5')](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0x540c02[_0x27f4('0x1a1')](0x8,_0x5df133,_0x545fb9)){if(_0x5b267a[_0x27f4('0xf3')]>=_0x545fb9['dialCongestionMaxRetry']){_0x540c02[_0x27f4('0xfb')](_0x5b267a,_0x11f3ef,_0x2a392c,_0x27f4('0x1c5'));}else{_0x540c02['stateGlobal'](_0x5b267a,_0x11f3ef,_0x2a392c,'reason\x208\x20congestion');}}break;case'11':_0x545fb9[_0x27f4('0x1c6')]+=0x1;_0x5b267a[_0x27f4('0xeb')]=0xb;_0x5b267a[_0x27f4('0xa9')]=_0x27f4('0x128');_0x5b267a[_0x27f4('0xf6')]+=0x1;_0x5b267a[_0x27f4('0xf0')]+=0x1;_0x540c02[_0x27f4('0xca')](_0x5b267a)[_0x27f4('0xb5')](loggerCatch(_0x27f4('0x129')));if(_0x540c02[_0x27f4('0x1a1')](0xb,_0x5df133,_0x545fb9)){if(_0x5b267a[_0x27f4('0xf6')]>=_0x545fb9[_0x27f4('0x1c7')]){_0x540c02[_0x27f4('0xfb')](_0x5b267a,_0x11f3ef,_0x2a392c,_0x27f4('0x1c8'));}else{_0x540c02[_0x27f4('0xf9')](_0x5b267a,_0x11f3ef,_0x2a392c,_0x27f4('0x1c8'));}}break;case'20':_0x545fb9[_0x27f4('0x68')]+=0x1;_0x5b267a[_0x27f4('0xeb')]=0x14;_0x5b267a['statedesc']=_0x27f4('0x1c9');_0x5b267a['countagentrejectretry']+=0x1;_0x5b267a[_0x27f4('0xf0')]+=0x1;ami[_0x27f4('0xe5')](_0x27f4('0x1ca'),ut[_0x27f4('0xe7')](_0x5df133,_0x27f4('0x1cb')));_0x540c02[_0x27f4('0xca')](_0x5b267a)[_0x27f4('0xb5')](loggerCatch(_0x27f4('0x1cc')));if(_0x540c02['checkRetriveMax'](0x14,_0x5df133,_0x545fb9)){if(_0x5b267a[_0x27f4('0xf7')]>=_0x545fb9[_0x27f4('0x1cd')]){_0x540c02['createStateFinal'](_0x5b267a,_0x11f3ef,_0x2a392c,_0x27f4('0x1ce'));}else{_0x540c02[_0x27f4('0xf9')](_0x5b267a,_0x11f3ef,_0x2a392c,_0x27f4('0x1ce'));}}break;default:_0x545fb9['outboundUnknownCallsDay']+=0x1;_0x5b267a[_0x27f4('0xeb')]=0xc;_0x5b267a[_0x27f4('0xa9')]=_0x54736d[_0x27f4('0x1b2')];_0x540c02[_0x27f4('0xca')](_0x5b267a)['catch'](loggerCatch(_0x27f4('0x1cf')));if(_0x540c02['checkRetriveMax'](_0x54736d[_0x27f4('0x1b2')],_0x5df133,_0x545fb9)){if(_0x5b267a[_0x27f4('0x1a4')]+_0x5b267a[_0x27f4('0xf3')]+_0x5b267a[_0x27f4('0xf4')]+_0x5b267a[_0x27f4('0xf5')]+_0x5b267a['countdropretry']+_0x5b267a[_0x27f4('0xf6')]+_0x5b267a[_0x27f4('0xef')]+_0x5b267a[_0x27f4('0xf7')]>=_0x545fb9['dialGlobalMaxRetry']){_0x540c02[_0x27f4('0xf9')](_0x5b267a,_0x11f3ef,_0x2a392c,_0x54736d[_0x27f4('0x1b2')]);}else{_0x540c02['createStateFinal'](_0x5b267a,_0x11f3ef,_0x2a392c,_0x54736d['reason']);}}}});};Dialer['prototype']['stateGlobal']=function(_0x4623e0,_0x1caa97,_0x51851b,_0x3889bd){var _0x37fa7f=new Final(_0x4623e0);_0x37fa7f[_0x27f4('0xeb')]=0xf;_0x37fa7f[_0x27f4('0xa9')]=_0x27f4('0x1d0');this[_0x27f4('0xfb')](_0x37fa7f,_0x1caa97,_0x51851b,_0x3889bd);};Dialer[_0x27f4('0x19')]['createStateFinal']=function(_0xce4fc4,_0x141340,_0x4f7a81,_0x560153){this[_0x27f4('0x109')](_0xce4fc4)[_0x27f4('0x3c')](function(){return _0x141340(msgResponse('[callProgressDetecting]',_0x27f4('0x1d1'),_0x560153));})[_0x27f4('0xb5')](function(){return _0x4f7a81(msgResponse(_0x27f4('0x1d2'),_0x27f4('0x149'),_0x27f4('0x1d3')));});};Dialer[_0x27f4('0x19')][_0x27f4('0xa')]=function(_0x296257){var _0x219c60=_0x296257[_0x27f4('0x1d4')]/0x64;var _0x21ac2e=_0x296257[_0x27f4('0x11c')]/(_0x296257[_0x27f4('0x11c')]+_0x296257[_0x27f4('0x5e')]);var _0x6ff61=Math[_0x27f4('0x1d5')](_0x296257['predictiveIntervalAvailable']*(_0x296257[_0x27f4('0x1d6')]/0x64));var _0x287984=Math[_0x27f4('0x1d5')](_0x296257[_0x27f4('0x1d7')]*(_0x296257[_0x27f4('0x1d8')]/0x64));var _0x45310d=_0x296257[_0x27f4('0x50')]+_0x296257[_0x27f4('0xa3')];var _0x35e23e=Math[_0x27f4('0x1d9')](_0x296257[_0x27f4('0x72')]*_0x296257['erlangAbandonmentRate']*_0x296257[_0x27f4('0x6d')]*_0x296257[_0x27f4('0x6e')]);if(_[_0x27f4('0x3e')](_0x296257[_0x27f4('0x8f')])){if(!_['isUndefined'](_0x296257['startPredictive'])){_0x296257[_0x27f4('0x28')]=undefined;loggerPredictive[_0x27f4('0x97')](_0x27f4('0x1da'),_0x27f4('0x1db'));}if(!_[_0x27f4('0x3e')](_0x296257[_0x27f4('0x92')])){loggerPredictive['error'](_0x27f4('0x1da'),'check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x296257['handlePredictive']);_0x296257[_0x27f4('0x92')]=undefined;}_0x296257[_0x27f4('0x8f')]=moment()[_0x27f4('0x79')](_0x27f4('0xff'));loggerPredictive[_0x27f4('0x7e')](_0x296257['name'],'collection\x20data\x20in\x20progressive\x20at',_0x296257[_0x27f4('0x8f')]);this[_0x27f4('0x15d')](_0x296257,0x1);}else if(ifInterval(_0x296257[_0x27f4('0x1dc')],_0x296257[_0x27f4('0x8f')])){this['handlePower'](_0x296257,0x1);loggerPredictiveCalls[_0x27f4('0x7e')](_0x27f4('0x1dd'),_0x296257[_0x27f4('0x8f')],_0x296257[_0x27f4('0x3f')]);_0x296257['erlangCalls']=0x0;_0x296257[_0x27f4('0x6c')]=0x0;}else if(_0x219c60<_0x21ac2e&&_0x296257[_0x27f4('0x1de')]===_0x27f4('0x1df')){freeVariablesPredictive(_0x296257);loggerPredictive[_0x27f4('0x7e')](_0x27f4('0x1e0'),_0x27f4('0x1e1'),_0x21ac2e,_0x27f4('0x8f'),_0x296257[_0x27f4('0x3f')]);}else if(_0x35e23e<_0x296257[_0x27f4('0x6c')]&&_0x296257['dialPredictiveOptimization']===_0x27f4('0x1df')){freeVariablesPredictive(_0x296257);loggerPredictive['info'](_0x27f4('0x1e2'),'Max\x20Drop\x20',_0x35e23e,_0x27f4('0x1e3'),_0x296257[_0x27f4('0x6c')],_0x27f4('0x8f'),_0x296257[_0x27f4('0x3f')]);}else if(!ifInterval(_0x296257['dialPredictiveInterval'],_0x296257[_0x27f4('0x8f')])&&_[_0x27f4('0x3e')](_0x296257[_0x27f4('0x28')])&&!_[_0x27f4('0x3e')](_0x296257[_0x27f4('0x8f')])){_0x296257['startPredictive']=moment()[_0x27f4('0x79')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x27f4('0x7e')](_0x296257['name'],_0x27f4('0x1e4'),_0x296257[_0x27f4('0x28')]);this[_0x27f4('0xbc')](_0x296257['dialPredictiveInterval'])[_0x27f4('0x3c')](this[_0x27f4('0x1e5')](_0x296257))['then'](mergeDataErlangB(_0x296257))[_0x27f4('0x3c')](this[_0x27f4('0x1e6')](_0x296257))[_0x27f4('0xb5')](loggerCatchPredictive(_0x27f4('0x1e7'),_0x296257));}else if(!ifInterval(_0x296257['dialPredictiveInterval'],_0x296257['startPredictive'])){_0x296257[_0x27f4('0x6c')]=0x0;_0x296257['startPredictive']=moment()[_0x27f4('0x79')](_0x27f4('0xff'));loggerPredictive[_0x27f4('0x7e')](_0x296257[_0x27f4('0x3f')],_0x27f4('0x1e8'),_0x296257[_0x27f4('0x28')]);clearInterval(_0x296257[_0x27f4('0x92')]);_0x296257[_0x27f4('0x92')]=undefined;this[_0x27f4('0xbc')](_0x296257[_0x27f4('0x1dc')])[_0x27f4('0x3c')](this[_0x27f4('0x1e5')](_0x296257))[_0x27f4('0x3c')](mergeDataErlangB(_0x296257))[_0x27f4('0x3c')](this[_0x27f4('0x1e6')](_0x296257))[_0x27f4('0xb5')](loggerCatchPredictive('Predictive\x20for\x20every\x20interval',_0x296257));}else if(_0x296257[_0x27f4('0x1d7')]&&_0x45310d<_0x296257['predictiveIntervalAvailable']-_0x287984){freeVariablesPredictive(_0x296257);loggerPredictive[_0x27f4('0x7e')](_0x296257[_0x27f4('0x3f')],_0x27f4('0x1e9'),_0x45310d,_0x27f4('0x1ea'),_0x296257['predictiveIntervalAvailable'],'-',_0x287984,'=',_0x296257[_0x27f4('0x1d7')]-_0x287984,')');}else if(_0x296257['predictiveIntervalAvailable']&&_0x45310d>_0x296257[_0x27f4('0x1d7')]+_0x6ff61){freeVariablesPredictive(_0x296257);loggerPredictive[_0x27f4('0x7e')](_0x296257[_0x27f4('0x3f')],_0x27f4('0x1e9'),_0x45310d,_0x27f4('0x1eb'),_0x296257['predictiveIntervalAvailable'],'+',_0x6ff61,'=',_0x296257[_0x27f4('0x1d7')]+_0x6ff61,')');}};Dialer[_0x27f4('0x19')][_0x27f4('0x1e5')]=function(_0x25f0cf){var _0x71ce60=this;return function(_0x587261){return new BPromise(function(_0x2e720f,_0x4f2580){_[_0x27f4('0xd1')](_0x25f0cf,_0x587261[0x0]);if(checkGetDataPredictive(_0x587261[0x0])){var _0x4afe1b=_0x25f0cf[_0x27f4('0x1d7')]=_0x25f0cf['talking']+_0x25f0cf['available'];var _0x311dc4=_0x25f0cf[_0x27f4('0x1dc')]*0x3c;var _0x3ca925=_0x587261[0x0]['predictiveIntervalAvgTalktime']+_0x587261[0x0][_0x27f4('0x85')];var _0x599fd4=(_0x587261[0x0][_0x27f4('0x81')]+_0x587261[0x0][_0x27f4('0x6a')]+_0x587261[0x0][_0x27f4('0x84')])/_0x587261[0x0][_0x27f4('0x70')];_0x25f0cf[_0x27f4('0x6d')]=_0x599fd4>0x0?_0x599fd4:0x1;switch(_0x25f0cf[_0x27f4('0x1de')]){case _0x27f4('0x1df'):var _0x4cc012=_0x25f0cf[_0x27f4('0x1d4')]/0x64;return _0x71ce60[_0x27f4('0x1ec')](_0x4afe1b,_0x311dc4,_0x3ca925,_0x599fd4,_0x4cc012)[_0x27f4('0x3c')](function(_0x2be20f){return _0x2e720f(_0x2be20f);});case _0x27f4('0x1ed'):var _0x4306ea=_0x25f0cf[_0x27f4('0x1d4')]/0x64;return _0x71ce60[_0x27f4('0x1ee')](_0x4afe1b,_0x311dc4,_0x3ca925,_0x599fd4,_0x4306ea)[_0x27f4('0x3c')](function(_0x7ee716){return _0x2e720f(_0x7ee716);});default:return _0x4f2580(msgResponse('[getDataPredictive]',_0x27f4('0x149'),_0x27f4('0x1ef')));}}else{return _0x4f2580(msgResponse('[getDataPredictive]',_0x27f4('0x149'),_0x27f4('0x1f0')));}});};};Dialer['prototype']['getDataPredictiveOld']=function(_0x751453){var _0x36de27=this;return function(_0x1a25bf){return new BPromise(function(_0x1e1d5c,_0x45ef35){_[_0x27f4('0xd1')](_0x751453,_0x1a25bf[0x0]);if(checkGetDataPredictive(_0x1a25bf[0x0])){loggerPredictive['info'](JSON[_0x27f4('0x48')](_0x1a25bf[0x0]));if(_0x751453[_0x27f4('0x1de')]==='dropRate'){return _0x36de27[_0x27f4('0xc7')](_0x751453['id'])[_0x27f4('0x3c')](function(_0xf0655f){var _0x269222=_0x751453[_0x27f4('0x51')]-_0xf0655f[0x0][_0x27f4('0x1f1')];var _0x2e460d=_0x751453['dialPredictiveInterval']*0x3c;var _0x207bb0=_0x1a25bf[0x0][_0x27f4('0x87')]+_0x1a25bf[0x0]['predictiveIntervalAvgHoldtime'];var _0x1ec2fc=(_0x1a25bf[0x0][_0x27f4('0x81')]+_0x1a25bf[0x0][_0x27f4('0x6a')]+_0x1a25bf[0x0][_0x27f4('0x84')])/_0x1a25bf[0x0][_0x27f4('0x70')];var _0x9687af=_0x751453[_0x27f4('0x1d4')]/0x64;_0x751453[_0x27f4('0x6f')]=_0xf0655f[0x0][_0x27f4('0x1f1')]||0x0;_0x751453[_0x27f4('0x6d')]=_0x1ec2fc>0x0?_0x1ec2fc:0x1;return _0x36de27[_0x27f4('0x1ec')](_0x269222,_0x2e460d,_0x207bb0,_0x1ec2fc,_0x9687af);})[_0x27f4('0x3c')](function(_0x31960a){return _0x1e1d5c(_0x31960a);})[_0x27f4('0xb5')](function(_0xf721d6){return _0x45ef35(msgResponse(_0x27f4('0x1f2'),_0x27f4('0x149'),JSON[_0x27f4('0x48')](_0xf721d6)));});}if(_0x751453[_0x27f4('0x1de')]===_0x27f4('0x1ed')){return _0x36de27[_0x27f4('0xc7')](_0x751453['id'])[_0x27f4('0x3c')](function(_0x382058){var _0x2abb29=_0x751453['loggedIn']-_0x382058[0x0][_0x27f4('0x1f1')];var _0x189bb9=_0x751453[_0x27f4('0x1dc')]*0x3c;var _0x46b70b=_0x1a25bf[0x0][_0x27f4('0x87')]+_0x1a25bf[0x0]['predictiveIntervalAvgHoldtime'];var _0x325b19=(_0x1a25bf[0x0][_0x27f4('0x81')]+_0x1a25bf[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x1a25bf[0x0][_0x27f4('0x84')])/_0x1a25bf[0x0]['predictiveIntervalTotalCalls'];var _0x134ec1=_0x751453[_0x27f4('0x1d4')]/0x64;_0x751453[_0x27f4('0x6f')]=_0x382058[0x0][_0x27f4('0x1f1')]||0x0;_0x751453[_0x27f4('0x6d')]=_0x325b19>0x0?_0x325b19:0x1;return _0x36de27['busyFactor'](_0x2abb29,_0x189bb9,_0x46b70b,_0x325b19,_0x134ec1);})[_0x27f4('0x3c')](function(_0x499c7a){return _0x1e1d5c(_0x499c7a);})[_0x27f4('0xb5')](function(_0x10ef38){return _0x45ef35(msgResponse(_0x27f4('0x1f2'),_0x27f4('0x149'),JSON[_0x27f4('0x48')](_0x10ef38)));});}}else{return _0x45ef35(msgResponse('[getDataPredictive]','Failure',_0x27f4('0x1f0')));}});};};Dialer[_0x27f4('0x19')]['startMethodPredictive']=function(_0x1c611d){var _0x5c06ef=this;return function(){var _0x458c2c=0x0;var _0x2ead30=Math[_0x27f4('0x1d9')](_0x1c611d['erlangCallToSecond']*0x3e8);if(_0x2ead30>0x0){_0x2ead30=_0x2ead30<0x64?0x64:_0x2ead30;loggerPredictive['info'](_0x1c611d[_0x27f4('0x3f')],_0x27f4('0x1f3'),_0x2ead30,_0x27f4('0x49'));_0x1c611d['handlePredictive']=setInterval(function(){_0x5c06ef[_0x27f4('0x92')](_0x1c611d);loggerPredictiveCalls[_0x27f4('0x7e')](_0x27f4('0x1f4'),_0x458c2c+=0x1);},_0x2ead30);}else{loggerPredictive['info'](_0x1c611d[_0x27f4('0x3f')],_0x27f4('0x1f5'));}};};Dialer[_0x27f4('0x19')][_0x27f4('0x1f6')]=function(_0x2cc4b3,_0x5421ad){var _0x141f6b=this;return function(_0x3c9081){if(_[_0x27f4('0x7c')](_0x3c9081)){if(_[_0x27f4('0xae')](_0x5421ad[_0x27f4('0xd5')])||!_0x5421ad['recallme']){if(_0x2cc4b3[_0x27f4('0x5a')]==='booked'){_0x2cc4b3[_0x27f4('0x12f')]=_[_0x27f4('0x3e')](_0x2cc4b3[_0x27f4('0x12f')])?!![]:_0x2cc4b3['queueStatusComplete'];var _0x329fd0=uuid['v4']();_0x141f6b[_0x27f4('0x24')][_0x329fd0]=new Action(_0x2cc4b3,_0x5421ad,_0x329fd0);loggerBooked[_0x27f4('0x7e')](_0x27f4('0x1f7'),_0x329fd0,_0x27f4('0x1f8'),JSON[_0x27f4('0x48')](_0x2cc4b3[_0x27f4('0x12f')]),_0x27f4('0x1f9'),_0x2cc4b3[_0x27f4('0x3f')]);if(_0x2cc4b3[_0x27f4('0x12f')]){_0x2cc4b3[_0x27f4('0x12f')]=![];_0x141f6b['queueBooked'][_0x141f6b[_0x27f4('0x24')][_0x329fd0][_0x27f4('0xb1')]]=[];ami['Action']({'actionid':_0x329fd0,'action':_0x27f4('0x1fa'),'queue':_0x2cc4b3[_0x27f4('0x3f')]})[_0x27f4('0xb5')](function(){_0x141f6b[_0x27f4('0xcc')](_0x2cc4b3);_0x141f6b[_0x27f4('0xbf')]({'active':![],'ContactId':_0x141f6b[_0x27f4('0x24')][_0x329fd0]['ContactId'],'ListId':_0x141f6b[_0x27f4('0x24')][_0x329fd0][_0x27f4('0xd4')],'VoiceQueueId':_0x141f6b[_0x27f4('0x24')][_0x329fd0][_0x27f4('0xd6')]||undefined,'CampaignId':_0x141f6b[_0x27f4('0x24')][_0x329fd0][_0x27f4('0x100')]||undefined})[_0x27f4('0xb5')](loggerCatch(_0x27f4('0x1fb')));delete _0x141f6b[_0x27f4('0x24')][_0x329fd0];});}else{loggerBooked['info'](_0x27f4('0x1fc'),JSON[_0x27f4('0x48')](_0x2cc4b3[_0x27f4('0x12f')]),_0x27f4('0x1f9'),_0x2cc4b3['name']);_0x141f6b['updateOriginated'](_0x2cc4b3);_0x141f6b['rescheduleContact']({'active':![],'ContactId':_0x141f6b['actions'][_0x329fd0][_0x27f4('0xd3')],'ListId':_0x141f6b[_0x27f4('0x24')][_0x329fd0][_0x27f4('0xd4')],'VoiceQueueId':_0x141f6b[_0x27f4('0x24')][_0x329fd0]['VoiceQueueId']||undefined,'CampaignId':_0x141f6b[_0x27f4('0x24')][_0x329fd0]['CampaignId']||undefined})[_0x27f4('0xb5')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x141f6b[_0x27f4('0x24')][_0x329fd0];}}else{return _0x141f6b[_0x27f4('0x170')](_0x2cc4b3,_0x5421ad);}}else{if(getDiff(_0x5421ad[_0x27f4('0x1fd')])<_0x2cc4b3[_0x27f4('0x1fe')]*0x3c){if(_0x5421ad[_0x27f4('0x1ff')]&&!_0x5421ad[_0x27f4('0x1ff')][_0x27f4('0x200')]){_0x141f6b[_0x27f4('0x1d')][_0x27f4('0x132')](_0x5421ad['id'])[_0x27f4('0x135')](function(){_0x141f6b['updateOriginated'](_0x2cc4b3);});}else{_0x141f6b['unlockContact']({'active':![]},_0x5421ad['id'],0x1)['finally'](function(){_0x141f6b['updateOriginated'](_0x2cc4b3);});}}else{_0x2cc4b3[_0x27f4('0x67')]+=0x1;_0x141f6b[_0x27f4('0xcc')](_0x2cc4b3);if(_0x2cc4b3[_0x27f4('0x201')]){_0x141f6b['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x5421ad[_0x27f4('0xd3')],'ListId':_0x5421ad['ListId'],'VoiceQueueId':_0x5421ad['VoiceQueueId']||undefined,'CampaignId':_0x5421ad[_0x27f4('0x100')]||undefined})[_0x27f4('0xb5')](loggerCatch(_0x27f4('0x202')));_0x141f6b[_0x27f4('0xca')](createObjHistory(_0x2cc4b3,_0x5421ad,'RECALLINQUEUE',0x17,_0x27f4('0x203')))[_0x27f4('0xb5')](loggerCatch(_0x27f4('0x204')));}else{_0x141f6b['saveInDb'](createObjHistory(_0x2cc4b3,_0x5421ad,'RECALLFAILEDTIMEOUT',0x16,_0x27f4('0x205')),_0x27f4('0x206'),_0x27f4('0x207'));}}}}else{_0x2cc4b3['outboundBlacklistCallsDay']+=0x1;_0x141f6b[_0x27f4('0xdc')](createObjHistory(_0x2cc4b3,_0x5421ad,_0x27f4('0x208'),0xd,_0x27f4('0x209')),_0x27f4('0x20a'),_0x27f4('0x20b'));throw'inBlackList';}};};Dialer['prototype']['handleIvr']=function(_0x4efce5){var _0x4c1f51=this;var _0x4b3159=_0x4efce5['limitCalls']-_0x4efce5['originated']-_0x4efce5[_0x27f4('0xc3')];emitCampaignSummary(_0x4efce5);if(_0x4b3159>0x0){if(_0x4b3159>this['maxNumberOriginate']){_0x4b3159=this[_0x27f4('0x22')];}_0x4efce5[_0x27f4('0xc3')]+=_0x4b3159;this[_0x27f4('0xc5')](_0x4efce5['id'],_0x4b3159,_0x4efce5[_0x27f4('0x20c')],_0x4efce5)['then'](function(_0x253f33){_0x4efce5[_0x27f4('0xc3')]-=_0x4b3159;_0x4efce5['temp']=_0x4efce5[_0x27f4('0xc3')]>0x0?_0x4efce5[_0x27f4('0xc3')]:0x0;if(!checkContactEmpty(_0x253f33)){_0x4efce5['message']=_0x27f4('0xa0');logger[_0x27f4('0x7e')]('[getContactCampaign2][Empty]'+_0x4efce5[_0x27f4('0x3f')]);}else{_0x4efce5[_0x27f4('0x71')]+=_0x253f33[_0x27f4('0x9a')];_0x4efce5[_0x27f4('0x41')]=_0x27f4('0x20d');for(var _0x5ab57d=0x0;_0x5ab57d<_0x253f33[_0x27f4('0x9a')];_0x5ab57d+=0x1){_0x4efce5[_0x27f4('0x20e')]+=0x1;if(_[_0x27f4('0xae')](_0x253f33[_0x5ab57d])||_[_0x27f4('0xae')](_0x253f33[_0x5ab57d][_0x27f4('0x175')])||_['isNil'](_0x253f33[_0x5ab57d][_0x27f4('0x175')][_0x27f4('0x174')])){_0x4c1f51[_0x27f4('0x20f')](_0x27f4('0x210'),_0x4efce5,_0x253f33[_0x5ab57d]);}else{_0x4c1f51['checkIsBlackListIvr'](_[_0x27f4('0xd2')](_0x253f33[_0x5ab57d],['CampaignId','Contact.phone']))[_0x27f4('0x3c')](_0x4c1f51[_0x27f4('0x1f6')](_0x4efce5,_0x253f33[_0x5ab57d]))['catch'](_0x4c1f51[_0x27f4('0xcf')](_0x27f4('0x211'),_0x4efce5));}}}})['catch'](loggerGetContactDialer(_0x27f4('0x212'),_0x4efce5,_0x4b3159));}};Dialer['prototype']['handlePower']=function(_0x1be544,_0x151bcb){var _0x30e904=this;var _0x232a61=[];var _0x4c8d0f=_0x151bcb>=0x1?_0x151bcb:0x1;if(_0x1be544[_0x27f4('0x5a')]===_0x27f4('0x9')){_0x4c8d0f=0x1;}var _0xa816d8=Math[_0x27f4('0x1d9')](_0x1be544[_0x27f4('0x50')]*_0x4c8d0f)-_0x1be544[_0x27f4('0x71')]-_0x1be544[_0x27f4('0xc3')];emitVoiceQueueSummary(_0x1be544);if(_0x1be544[_0x27f4('0x213')]>0x0){var _0x437950=_0x1be544[_0x27f4('0x213')]-_0x1be544[_0x27f4('0x71')]-_0x1be544['talking']-_0x1be544[_0x27f4('0xc3')]-_0x1be544['pTalking'];if(_0xa816d8>_0x437950){_0xa816d8=_0x437950;}}if(_0xa816d8>0x0){if(_0x1be544[_0x27f4('0x5a')]==='booked'){_0xa816d8=0x1;}if(_0xa816d8>this[_0x27f4('0x22')]){_0xa816d8=this[_0x27f4('0x22')];}_0x1be544[_0x27f4('0xc3')]+=_0xa816d8;for(var _0x40a275 in this[_0x27f4('0x20')]){if(typeof this[_0x27f4('0x20')][_0x40a275]!=='undefined'){if(this[_0x27f4('0x20')][_0x40a275][_0x27f4('0xeb')]==='not_inuse'&&this[_0x27f4('0x20')][_0x40a275]['status']===_0x27f4('0xda')){_0x232a61[_0x27f4('0x14f')](this[_0x27f4('0x20')][_0x40a275]['id']);}}}this[_0x27f4('0xc2')](_0x1be544['id'],_0x232a61,_0xa816d8,_0x1be544[_0x27f4('0x20c')],_0x1be544)[_0x27f4('0x3c')](function(_0x52521){_0x1be544[_0x27f4('0xc3')]-=_0xa816d8;_0x1be544['temp']=_0x1be544[_0x27f4('0xc3')]>0x0?_0x1be544[_0x27f4('0xc3')]:0x0;if(!checkContactEmpty(_0x52521)){_0x30e904[_0x27f4('0xb4')](_0x1be544)[_0x27f4('0x3c')](sendMessageReschedule(_0x1be544))['catch'](loggerCatch('[countReScheduled]\x20'));}else{_0x1be544[_0x27f4('0x71')]+=_0x52521[_0x27f4('0x9a')];_0x1be544[_0x27f4('0x41')]=_0x1be544[_0x27f4('0x5a')]==='booked'?'ACTIVE':_0x27f4('0x20d');for(var _0x22b803=0x0;_0x22b803<_0x52521[_0x27f4('0x9a')];_0x22b803+=0x1){if(_[_0x27f4('0xae')](_0x52521[_0x22b803])||_[_0x27f4('0xae')](_0x52521[_0x22b803][_0x27f4('0x175')])||_[_0x27f4('0xae')](_0x52521[_0x22b803]['Contact']['phone'])){_0x30e904[_0x27f4('0x20f')](_0x27f4('0x210'),_0x1be544,_0x52521[_0x22b803]);}else{_0x30e904['checkIsBlackList'](_[_0x27f4('0xd2')](_0x52521[_0x22b803],[_0x27f4('0xd6'),_0x27f4('0x214')]))['then'](_0x30e904[_0x27f4('0x1f6')](_0x1be544,_0x52521[_0x22b803]))[_0x27f4('0xb5')](_0x30e904[_0x27f4('0xcf')](_0x27f4('0x210'),_0x1be544));}}}})[_0x27f4('0xb5')](loggerGetContactDialer('[getContactDialer2]',_0x1be544,_0xa816d8));}};Dialer[_0x27f4('0x19')]['handlePredictive']=function(_0x5b60be){if(_0x5b60be[_0x27f4('0x213')]>0x0){var _0x103420=_0x5b60be[_0x27f4('0x213')]-_0x5b60be[_0x27f4('0x71')]-_0x5b60be[_0x27f4('0xa3')];if(_0x103420>0x0){this[_0x27f4('0x215')](_0x5b60be);}else{loggerPredictiveCalls[_0x27f4('0x7e')](_0x27f4('0x216'));}}else{this[_0x27f4('0x215')](_0x5b60be);}};Dialer[_0x27f4('0x19')][_0x27f4('0x215')]=function(_0x128624){var _0x1f9575=this;var _0x4a1673=[];_0x128624[_0x27f4('0x71')]+=0x1;for(var _0x33bb60 in this[_0x27f4('0x20')]){if(typeof this[_0x27f4('0x20')][_0x33bb60]!==_0x27f4('0x9b')){if(this[_0x27f4('0x20')][_0x33bb60]['state']===_0x27f4('0x217')&&this[_0x27f4('0x20')][_0x33bb60][_0x27f4('0xd9')]===_0x27f4('0xda')){_0x4a1673[_0x27f4('0x14f')](this[_0x27f4('0x20')][_0x33bb60]['id']);}}}this['getContactDialer'](_0x128624['id'],_0x4a1673,0x1,_0x128624[_0x27f4('0x20c')],_0x128624)[_0x27f4('0x3c')](function(_0x12b306){if(!checkContactEmpty(_0x12b306)){checkContactLowerLimitOriginate(_0x128624,0x1,0x0);_0x1f9575['countReScheduled'](_0x128624)[_0x27f4('0x3c')](sendMessageReschedule(_0x128624))[_0x27f4('0xb5')](loggerCatch(_0x27f4('0xb6')));}else{_0x128624['message']=_0x27f4('0x20d');if(_['isNil'](_0x12b306[0x0])||_[_0x27f4('0xae')](_0x12b306[0x0][_0x27f4('0x175')])||_[_0x27f4('0xae')](_0x12b306[0x0][_0x27f4('0x175')][_0x27f4('0x174')])){_0x1f9575[_0x27f4('0x20f')](_0x27f4('0x210'),_0x128624,_0x12b306[0x0]);}else{_0x1f9575[_0x27f4('0xb7')](_[_0x27f4('0xd2')](_0x12b306[0x0],['VoiceQueueId',_0x27f4('0x214')]))[_0x27f4('0x3c')](_0x1f9575[_0x27f4('0x1f6')](_0x128624,_0x12b306[0x0]))[_0x27f4('0xb5')](_0x1f9575[_0x27f4('0xcf')](_0x27f4('0x218'),_0x128624));}}})[_0x27f4('0xb5')](loggerGetContactDialer(_0x27f4('0x219'),_0x128624,0x1));emitVoiceQueueSummary(_0x128624);};Dialer[_0x27f4('0x19')][_0x27f4('0x1ec')]=function(_0x27e93c,_0x138a2a,_0x5b45ec,_0x49df92,_0x51c7b4,_0x22324a){loggerPredictive[_0x27f4('0x7e')]('--------\x20Drop\x20Rate\x20--------');loggerPredictive[_0x27f4('0x7e')]('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',_0x27e93c);loggerPredictive['info']('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x138a2a);loggerPredictive[_0x27f4('0x7e')](_0x27f4('0x21a'),_0x5b45ec);loggerPredictive[_0x27f4('0x7e')](_0x27f4('0x21b'),_0x49df92);loggerPredictive['info'](_0x27f4('0x21c'),_0x51c7b4);loggerPredictive[_0x27f4('0x7e')]('---------------------------');return new BPromise(function(_0x4b4bfe,_0x56bc5a){if(_0x27e93c<=0x0||isNaN(_0x27e93c)){return _0x56bc5a(msgResponse(_0x27f4('0x21d'),_0x27f4('0x47'),_0x27f4('0x21e')+_0x27e93c));}if(_0x5b45ec<=0x0||isNaN(_0x5b45ec)){return _0x56bc5a(msgResponse('[abandonmentRate]',_0x27f4('0x47'),_0x27f4('0x21f')+_0x5b45ec));}if(_0x49df92<=0x0||isNaN(_0x49df92)){return _0x56bc5a(msgResponse(_0x27f4('0x21d'),_0x27f4('0x47'),'p\x20=\x20'+_0x49df92));}if(_0x138a2a<=0x0||isNaN(_0x138a2a)){return _0x56bc5a(msgResponse(_0x27f4('0x21d'),_0x27f4('0x47'),_0x27f4('0x220')+_0x138a2a));}if(_0x51c7b4<=0x0||isNaN(_0x51c7b4)){return _0x56bc5a(msgResponse(_0x27f4('0x21d'),'Error',_0x27f4('0x221')+_0x51c7b4));}_0x22324a=_0x22324a||0x0;var _0x412bee=0x1/_0x5b45ec;var _0x1f4108=0x0;var _0x14e393=0x0;var _0x21c7b0=0x0;var _0x31da47=0x0;for(var _0x219536=0x0;_0x21c7b0<_0x51c7b4;_0x219536+=0x1){_0x14e393=_0x219536/_0x138a2a;_0x1f4108=(_0x49df92*_0x14e393+_0x22324a)/_0x412bee;_0x21c7b0=erlangb(_0x1f4108,_0x27e93c);_0x31da47=_0x1f4108/_0x27e93c*(0x1-erlangb(_0x1f4108,_0x27e93c));}return _0x4b4bfe({'erlangCalls':_0x219536,'erlangCallToSecond':_0x138a2a/_0x219536,'erlangAbandonmentRate':_0x21c7b0,'erlangBusyFactor':_0x31da47});});};Dialer[_0x27f4('0x19')][_0x27f4('0x1ee')]=function(_0x3a3d72,_0x481b33,_0x2ceccb,_0xae0b48,_0x24920c,_0x2d2c19){loggerPredictive['info']('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive[_0x27f4('0x7e')]('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',_0x3a3d72);loggerPredictive[_0x27f4('0x7e')](_0x27f4('0x222'),_0x481b33);loggerPredictive[_0x27f4('0x7e')](_0x27f4('0x21a'),_0x2ceccb);loggerPredictive[_0x27f4('0x7e')](_0x27f4('0x21b'),_0xae0b48);loggerPredictive[_0x27f4('0x7e')](_0x27f4('0x223'),_0x24920c);loggerPredictive[_0x27f4('0x7e')](_0x27f4('0x88'));return new BPromise(function(_0xc2d49f,_0x27b049){if(_0x3a3d72<=0x0||isNaN(_0x3a3d72)){return _0x27b049(msgResponse(_0x27f4('0x224'),_0x27f4('0x47'),_0x27f4('0x21e')+_0x3a3d72));}if(_0x2ceccb<=0x0||isNaN(_0x2ceccb)){return _0x27b049(msgResponse(_0x27f4('0x224'),'Error','Ts\x20=\x20'+_0x2ceccb));}if(_0xae0b48<=0x0||isNaN(_0xae0b48)){return _0x27b049(msgResponse('[busyFactor]','Error','p\x20=\x20'+_0xae0b48));}if(_0x481b33<=0x0||isNaN(_0x481b33)){return _0x27b049(msgResponse(_0x27f4('0x224'),_0x27f4('0x47'),_0x27f4('0x220')+_0x481b33));}if(_0x24920c<=0x0||isNaN(_0x24920c)){return _0x27b049(msgResponse(_0x27f4('0x224'),'Error',_0x27f4('0x225')+_0x24920c));}_0x2d2c19=_0x2d2c19||0x0;var _0xa5f737=0x1/_0x2ceccb;var _0x21e1c9=0x0;var _0x306907=0x0;var _0x20859b=0x0;var _0x2f6f50=0x0;for(var _0x55a21b=0x0;_0x2f6f50<_0x24920c;_0x55a21b+=0x1){_0x306907=_0x55a21b/_0x481b33;_0x21e1c9=(_0xae0b48*_0x306907+_0x2d2c19)/_0xa5f737;_0x20859b=erlangb(_0x21e1c9,_0x3a3d72);_0x2f6f50=_0x21e1c9/_0x3a3d72*(0x1-erlangb(_0x21e1c9,_0x3a3d72));}return _0xc2d49f({'erlangCalls':_0x55a21b,'erlangCallToSecond':_0x481b33/_0x55a21b,'erlangAbandonmentRate':_0x20859b,'erlangBusyFactor':_0x2f6f50});});};module[_0x27f4('0x226')]=Dialer; \ No newline at end of file +var _0x8f42=['strategy','answered','available','loggedIn','sumBillable','sumDuration','sumHoldTime','talking','total','type','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangAbandonmentRate','Trunk','active','stringify','md5','format','voice:queue:%s','voice_queue:save','ivr','campaign:ivr:%s','info','-----\x20Stats\x20Predictive\x20---','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','isUndefined','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','merge','startProgressive','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','\x22%s\x22\x20<%s>','error','stack','length','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','inspect','contactsRescheduled','RESCHEDULED_CONTACTS','sendMessageOneNotActive','pTalking','is\x20not\x20active','IS_DISACTIVED','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','statedesc','prototype','clearZombieChannels','[uniqueid]','isNil','Action','status','channel','catch','No\x20such\x20channel','updateOriginated','[Dialer][checkChannel]','queue','countReScheduled','resolve','checkIsBlackList','[checkIsBlackList]\x20','[checkIsBlackListIvr]\x20','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','unlockContact','temp','[getContactDialer]\x20','getContactDialerIvr','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','saveInDb','ContactId','ListId','UserId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','[emptyContact]','isSuccess','Success','reachable','SIP/%s','unmonitored','variable','dialAMDActive','value','HANGUP','uniqueid','HangupInAMD','membername','AMD','custom:amd','buildObj','amd','[syncHangupInAMD]','Machine','[syncAgentComplete][createHistory][0]','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','add','dialMachineRetryFrequency','minutes','YYYY-MM-DD\x20HH:mm:ss','[rescheduleContact][Machine]','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','MACHINE','countglobal','countbusyretry','countdropretry','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','AnswerAGI','cause-txt','Unknow','reason','agent','agiafterat','[syncAgentComplete][createHistory]','[syncAgentComplete]','syncAgentConnect','answertime','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','dialQueueTimeout','outboundDropCallsDayTimeout','Drop','dropreason','TIMEOUT','dialQueueProject2','dialDropMaxRetry','dialDropRetryFrequency','[rescheduleContact][Drop]','starttime','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','CALLEREXIT','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','[syncAgentComplete][createHistory][11]','syncNewExten','actions','actionid','roundrobin','paused','locked','stateinterface','rrmemory','push','pick','queueStatusComplete','[booked][unlockQueueStatus]','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','idHopper','run','[booked][RR][finaly]','[booked][unlock]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','syncCampaigns','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','Failure','\x20Intervals\x20is\x20empty\x20','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','isArray','command','iftime\x20%s,%s','interval','timezones','content','indexOf','true','all','some','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','handlePower','dialPowerLevel','Queue','method\x20not\x20recognized','checkPreviewRecallReminder','handlePreviewRecallNotifications','user:%s','user:dialPreviewRecallReminder','handleIvr','checkIsTrunkReachable','dialGlobalInterval','dialTimezone','checkIfTimeIntervals','checkDialMethod','dialPreviewRecallmeReminder','launchHandleIvr','\x5cw{0,','pow','replace','random','actionOriginate','object','voiceQueue\x20is\x20undefine','Contact','phone','originate','contact\x20is\x20undefine','\x22agi://%s/square,%s\x22','dialQueueProject','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialAgiAfterHangupAgent','dialer','ACTIVE','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','createdAt','updatedAt','%s%s','toUpper','callerid','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','SIP/%s/%s%s','trim','substring','dialCutDigit','xcally-motion-dialer','dialOriginateTimeout','[originateError]:\x20%s','OriginateError','[originate][error]','getQueue','response','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','[rescheduleContact][NoSuchNumber]','[rescheduleContact][Abandoned]','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','entity\x20is\x20undefine','[callProgressDetecting]','evt\x20is\x20undefine','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','custom:agentnoanswer','noanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','reason\x205\x20busy','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','Abandoned','reason\x2011\x20abandoned','AgentReject','custom:agentreject','[syncAgentComplete][createHistory][20]','dialAgentRejectMaxRetry','reason\x2020\x20agentreject','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','startMethodPredictive','getDataPredictive','Predictive\x20for\x20every\x20interval',')\x20are\x20less\x20than\x20threshold\x20(','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','outboundQueuePauses','[CatchErlangB]','floor','one\x20call\x20every:','[handlePredictive]','checkContactBlack','recallme','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','Agent','voicePause','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','dialOrderByScheduledAt','AVAILABLE_CONTACTS_FINISHED','[getContactCampaign2][Empty]','RUNNING','[actionOriginate]\x20','Contact.phone','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','getContactDialer','[countReScheduled]\x20','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','not_inuse','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','abandonmentRate','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\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','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','m\x20=\x20','exports','util','lodash','uuid','moment','ioredis','../preview/util/util','../../../config/logger','booked','predictive','predictiveCalls','syncQueueSummary','defaults','redis','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/voiceQueueRt','../rpc/setting','./action','./history','./agentComplete','./queueCallerAbandon','./hangup','env','XCALLY_IP_AGI','127.0.0.1','enqueue','tail','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','contactsId','uniqueId','startPredictive','queueBooked','queueBookedRR','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','bind','agentcomplete','syncAgentComplete','custom:queuesummary','syncHangup','newexten','varset','syncVarSet','queuemember','syncQueueMember','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','getSettings','then','previewRecallmeReminderInterval','message','AGENTS_NOT_LOGGED','name','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','\x20NOT\x20Active','Interval','\x20INTERVAL_IS_NULL','Intervals','INTERVAL_IS_NULL','isEmpty','[ifTime][Action]','Error','milliseconds','diff','seconds','emit'];(function(_0x38a660,_0x3a6593){var _0x5a601c=function(_0x2190a8){while(--_0x2190a8){_0x38a660['push'](_0x38a660['shift']());}};_0x5a601c(++_0x3a6593);}(_0x8f42,0x1da));var _0x28f4=function(_0x16de66,_0x390ee8){_0x16de66=_0x16de66-0x0;var _0x23f33f=_0x8f42[_0x16de66];return _0x23f33f;};'use strict';var util=require(_0x28f4('0x0'));var _=require(_0x28f4('0x1'));var BPromise=require('bluebird');var uuid=require(_0x28f4('0x2'));var moment=require(_0x28f4('0x3'));var rr=require('rr');var md5=require('md5');var Redis=require(_0x28f4('0x4'));var ut=require(_0x28f4('0x5'));var config=require('../../../config/environment/');var logger=require(_0x28f4('0x6'))('dialer');var loggerBooked=require('../../../config/logger')(_0x28f4('0x7'));var loggerPredictive=require('../../../config/logger')(_0x28f4('0x8'));var loggerPredictiveCalls=require(_0x28f4('0x6'))(_0x28f4('0x9'));var loggerSyncQueueSummary=require(_0x28f4('0x6'))(_0x28f4('0xa'));var ami=require('../ami');config['redis']=_[_0x28f4('0xb')](config[_0x28f4('0xc')],{'host':_0x28f4('0xd'),'port':0x18eb});var io=require(_0x28f4('0xe'))(new Redis(config['redis']));var cmHopper=require(_0x28f4('0xf'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require(_0x28f4('0x10'));var RpcSetting=require(_0x28f4('0x11'));var Action=require(_0x28f4('0x12'));var History=require(_0x28f4('0x13'));var Final=require('./final');var AgentComplete=require(_0x28f4('0x14'));var QueueCallerAbandon=require(_0x28f4('0x15'));var Hangup=require(_0x28f4('0x16'));var ipAgi=process[_0x28f4('0x17')][_0x28f4('0x18')]||_0x28f4('0x19');var strategy={'rrmemory':'rrmemory','roundrobin':'roundrobin'};var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence['prototype'][_0x28f4('0x1a')]=function(_0x465e9e){this[_0x28f4('0x1b')]=this[_0x28f4('0x1b')]?this[_0x28f4('0x1b')]['finally'](_0x465e9e):_0x465e9e();};function Dialer(_0x4434cb,_0xc5d182){this[_0x28f4('0x1c')]=new Sequence();this[_0x28f4('0x1d')]=_0xc5d182;this['voiceQueues']=_0x4434cb[_0x28f4('0x1e')];this[_0x28f4('0x1f')]=_0x4434cb[_0x28f4('0x1f')];this[_0x28f4('0x20')]=_0x4434cb[_0x28f4('0x20')];this[_0x28f4('0x21')]=_0x4434cb[_0x28f4('0x21')];this[_0x28f4('0x22')]=config[_0x28f4('0x22')]||0x2;this[_0x28f4('0x23')]={};this['actions']={};this[_0x28f4('0x24')]={};this[_0x28f4('0x25')]={};this['optionPredictive']={};this[_0x28f4('0x26')]={};this['startProgressive']={};this['ivrOriginated']={};this[_0x28f4('0x27')]={};this[_0x28f4('0x28')]={};ami['on']('agentconnect',this['syncAgentConnect']['bind'](this));ami['on'](_0x28f4('0x29'),this[_0x28f4('0x2a')]['bind'](this));ami['on'](_0x28f4('0x2b'),this[_0x28f4('0x2c')][_0x28f4('0x2d')](this));ami['on'](_0x28f4('0x2e'),this[_0x28f4('0x2f')][_0x28f4('0x2d')](this));ami['on'](_0x28f4('0x30'),this[_0x28f4('0xa')][_0x28f4('0x2d')](this));ami['on']('hangup',this[_0x28f4('0x31')]['bind'](this));ami['on'](_0x28f4('0x32'),this['syncNewExten'][_0x28f4('0x2d')](this));ami['on'](_0x28f4('0x33'),this[_0x28f4('0x34')][_0x28f4('0x2d')](this));ami['on'](_0x28f4('0x35'),this[_0x28f4('0x36')][_0x28f4('0x2d')](this));ami['on']('queuestatuscomplete',this[_0x28f4('0x37')][_0x28f4('0x2d')](this));this[_0x28f4('0x38')]();this[_0x28f4('0x39')]();RpcSetting[_0x28f4('0x3a')]()[_0x28f4('0x3b')](function(_0x1bfd15){previewRecallmeReminderInterval=_0x1bfd15[_0x28f4('0x3c')];});}function isNotNull(_0x4062e7){return _0x4062e7!==null&&!_['isUndefined'](_0x4062e7);}function checkIsLoggedIn(_0x3714f4,_0x231869){return function(){if(_0x231869<=0x0){_0x3714f4[_0x28f4('0x3d')]=_0x28f4('0x3e');throw _0x3714f4[_0x28f4('0x3f')]+_0x28f4('0x40');}};}function isActive(_0x2b9c2c){return _0x2b9c2c;}function checkIsActive(_0x38c30e,_0x313c07){return function(){if(!isActive(_0x313c07)){_0x38c30e[_0x28f4('0x3d')]=_0x28f4('0x41');throw _0x38c30e['name']+_0x28f4('0x42');}};}function checkInterval(_0x3a7bd1){return function(){if(!isNotNull(_0x3a7bd1[_0x28f4('0x43')])){_0x3a7bd1[_0x28f4('0x3d')]='INTERVAL_IS_NULL';throw _0x3a7bd1['name']+_0x28f4('0x44');}if(!isNotNull(_0x3a7bd1[_0x28f4('0x43')][_0x28f4('0x45')])){_0x3a7bd1['message']=_0x28f4('0x46');throw _0x3a7bd1[_0x28f4('0x3f')]+_0x28f4('0x44');}if(!isNotNull(_[_0x28f4('0x47')](_0x3a7bd1[_0x28f4('0x43')]['Intervals']))){_0x3a7bd1['message']=_0x28f4('0x46');throw _0x3a7bd1[_0x28f4('0x3f')]+_0x28f4('0x44');}};}function msgResponse(_0x4ea14f,_0x59b613,_0x2b725e){return{'action':_0x4ea14f,'response':_0x59b613,'message':_0x2b725e,'stack':_0x2b725e};}function myreject(_0x3cd869){return function(_0x2c8027){return _0x3cd869(msgResponse(_0x28f4('0x48'),_0x28f4('0x49'),JSON['stringify'](_0x2c8027)));};}function getSeconds(_0x3b048b,_0x23e33e){var _0x5d56a7=moment(_0x3b048b)[_0x28f4('0x4a')](0x0);var _0x5699a0=moment(_0x23e33e)[_0x28f4('0x4a')](0x0);return _0x5d56a7[_0x28f4('0x4b')](_0x5699a0,_0x28f4('0x4c'));}function emit(_0x5052e9,_0x3f6bbe,_0x11cced){io['to'](_0x5052e9)[_0x28f4('0x4d')](_0x3f6bbe,_0x11cced);}function emitVoiceQueueSummary(_0x3bf645){if(_0x3bf645['type']==='outbound'){var _0x1f23e4={'id':_0x3bf645['id'],'name':_0x3bf645[_0x28f4('0x3f')],'strategy':_0x3bf645[_0x28f4('0x4e')],'answered':_0x3bf645[_0x28f4('0x4f')],'available':_0x3bf645[_0x28f4('0x50')],'loggedIn':_0x3bf645[_0x28f4('0x51')],'pTalking':_0x3bf645['pTalking'],'sumBillable':_0x3bf645[_0x28f4('0x52')],'sumDuration':_0x3bf645[_0x28f4('0x53')],'sumHoldTime':_0x3bf645[_0x28f4('0x54')]||0x0,'talking':_0x3bf645[_0x28f4('0x55')],'total':_0x3bf645[_0x28f4('0x56')],'type':_0x3bf645[_0x28f4('0x57')],'unmanaged':_0x3bf645[_0x28f4('0x58')],'abandoned':_0x3bf645[_0x28f4('0x59')],'waiting':_0x3bf645[_0x28f4('0x5a')],'loggedInDb':_0x3bf645[_0x28f4('0x5b')],'dialActive':_0x3bf645[_0x28f4('0x5c')],'dialMethod':_0x3bf645[_0x28f4('0x5d')],'dialOriginateCallerIdName':_0x3bf645['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x3bf645['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x3bf645['dialOriginateTimeout'],'dialPrefix':_0x3bf645[_0x28f4('0x5e')],'outboundAnswerAgiCallsDay':_0x3bf645[_0x28f4('0x5f')],'outboundAnswerCallsDay':_0x3bf645[_0x28f4('0x60')],'outboundBlacklistCallsDay':_0x3bf645['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x3bf645[_0x28f4('0x61')],'outboundCongestionCallsDay':_0x3bf645[_0x28f4('0x62')],'outboundDropCallsDayACS':_0x3bf645[_0x28f4('0x63')],'outboundDropCallsDayCallersExit':_0x3bf645[_0x28f4('0x64')],'outboundDropCallsDayTimeout':_0x3bf645['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x3bf645['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x3bf645[_0x28f4('0x65')],'outboundOriginateFailureCallsDay':_0x3bf645[_0x28f4('0x66')],'outboundReCallsDay':_0x3bf645[_0x28f4('0x67')],'outboundRejectCallsDay':_0x3bf645[_0x28f4('0x68')],'outboundUnknownCallsDay':_0x3bf645['outboundUnknownCallsDay'],'predictiveIntervalAnsweredCalls':_0x3bf645[_0x28f4('0x69')],'predictiveIntervalAvgHoldtime':_0x3bf645[_0x28f4('0x6a')],'predictiveIntervalAvgTalktime':_0x3bf645[_0x28f4('0x6b')],'predictiveIntervalDroppedCallsCallersExit':_0x3bf645[_0x28f4('0x6c')],'predictiveIntervalDroppedCallsTimeout':_0x3bf645[_0x28f4('0x6d')],'predictiveIntervalErlangCalls':_0x3bf645[_0x28f4('0x6e')],'predictiveIntervalErlangCallsDroppedCalls':_0x3bf645[_0x28f4('0x6f')],'predictiveIntervalHitRate':_0x3bf645[_0x28f4('0x70')],'predictiveIntervalMultiplicativeFactor':_0x3bf645[_0x28f4('0x71')],'predictiveIntervalPauses':_0x3bf645[_0x28f4('0x72')],'predictiveIntervalAvailable':_0x3bf645[_0x28f4('0x73')],'predictiveIntervalTotalCalls':_0x3bf645[_0x28f4('0x74')],'message':_0x3bf645[_0x28f4('0x3d')],'originated':_0x3bf645[_0x28f4('0x75')],'erlangCalls':_0x3bf645[_0x28f4('0x76')],'erlangCallToSecond':_0x3bf645['erlangCallToSecond'],'erlangAbandonmentRate':_0x3bf645[_0x28f4('0x77')],'erlangBusyFactor':_0x3bf645['erlangBusyFactor'],'startPredictive':_0x3bf645[_0x28f4('0x26')],'startProgressive':_0x3bf645['startProgressive']};if(_0x3bf645['Trunk']){_0x1f23e4[_0x28f4('0x78')]={'id':_0x3bf645[_0x28f4('0x78')]['id'],'name':_0x3bf645[_0x28f4('0x78')][_0x28f4('0x3f')],'active':_0x3bf645['Trunk'][_0x28f4('0x79')],'callerid':_0x3bf645[_0x28f4('0x78')]['callerid']};}if(_0x3bf645[_0x28f4('0x43')]){_0x1f23e4[_0x28f4('0x43')]={'id':_0x3bf645[_0x28f4('0x43')]['id'],'name':_0x3bf645[_0x28f4('0x43')][_0x28f4('0x3f')]};}var _0x3681c0=md5(JSON[_0x28f4('0x7a')](_0x1f23e4));if(_0x3bf645[_0x28f4('0x7b')]!==_0x3681c0){_0x3bf645['md5']=_0x3681c0;emit(util[_0x28f4('0x7c')](_0x28f4('0x7d'),_0x1f23e4['name']),_0x28f4('0x7e'),_0x1f23e4);}}}function emitCampaignSummary(_0x29bd71){if(_0x29bd71[_0x28f4('0x57')]===_0x28f4('0x7f')){emit(util[_0x28f4('0x7c')](_0x28f4('0x80'),_0x29bd71['name']),'campaign:save',_0x29bd71);}}function checkGetDataPredictive(_0xfb0a27){if(isNotNull(_0xfb0a27)&&!_[_0x28f4('0x47')](_0xfb0a27)){loggerPredictive[_0x28f4('0x81')](_0x28f4('0x82'));loggerPredictive['info']('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xfb0a27[_0x28f4('0x74')]);loggerPredictive['info'](_0x28f4('0x83'),_0xfb0a27[_0x28f4('0x69')]);loggerPredictive[_0x28f4('0x81')](_0x28f4('0x84'),_0xfb0a27[_0x28f4('0x6d')]);loggerPredictive[_0x28f4('0x81')](_0x28f4('0x85'),_0xfb0a27['predictiveIntervalDroppedCallsCallersExit']);loggerPredictive[_0x28f4('0x81')]('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xfb0a27[_0x28f4('0x6a')]);loggerPredictive[_0x28f4('0x81')]('AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xfb0a27[_0x28f4('0x6b')]);loggerPredictive['info']('---------------------------');if(_0xfb0a27['predictiveIntervalTotalCalls']>0x0){if(!_[_0x28f4('0x86')](_0xfb0a27[_0x28f4('0x6b')])&&_0xfb0a27[_0x28f4('0x6b')]>0x0){return!![];}loggerPredictive['info'](_0x28f4('0x87'));if(!_[_0x28f4('0x86')](_0xfb0a27[_0x28f4('0x6a')])&&_0xfb0a27[_0x28f4('0x6a')]>0x0){return!![];}loggerPredictive[_0x28f4('0x81')](_0x28f4('0x88'));}else{loggerPredictive[_0x28f4('0x81')](_0x28f4('0x89'));}}else{loggerPredictive['info'](_0x28f4('0x8a'));}return![];}function mergeDataErlangB(_0x3c05a1){return function(_0x3e6b5f){loggerPredictive['info'](_0x28f4('0x8b'));loggerPredictive[_0x28f4('0x81')](_0x28f4('0x8c'),_0x3e6b5f['erlangCalls']);loggerPredictive[_0x28f4('0x81')](_0x28f4('0x8d'),_0x3e6b5f[_0x28f4('0x8e')]);loggerPredictive[_0x28f4('0x81')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3e6b5f[_0x28f4('0x77')]);loggerPredictive[_0x28f4('0x81')](_0x28f4('0x8f'),_0x3e6b5f[_0x28f4('0x90')]);loggerPredictive[_0x28f4('0x81')](_0x28f4('0x91'),_0x3e6b5f[_0x28f4('0x77')]);loggerPredictive[_0x28f4('0x81')](_0x28f4('0x92'));_[_0x28f4('0x93')](_0x3c05a1,_0x3e6b5f);};}function getDiff(_0xf1bda1){var _0x4f11a8=moment()[_0x28f4('0x4a')](0x0);var _0x1a27b5=moment(_0xf1bda1)[_0x28f4('0x4a')](0x0);return _0x4f11a8[_0x28f4('0x4b')](_0x1a27b5,_0x28f4('0x4c'));}function ifInterval(_0x452585,_0x30b9b0){if(_[_0x28f4('0x86')](_0x30b9b0)){return![];}return getDiff(_0x30b9b0)<_0x452585*0x3c;}function freeVariablesPredictive(_0x329bcf){if(isNotNull(_0x329bcf)){if(!_[_0x28f4('0x86')](_0x329bcf[_0x28f4('0x94')])){_0x329bcf[_0x28f4('0x94')]=undefined;loggerPredictive[_0x28f4('0x81')](_0x329bcf[_0x28f4('0x3f')],_0x28f4('0x95'));}if(!_[_0x28f4('0x86')](_0x329bcf[_0x28f4('0x26')])){_0x329bcf[_0x28f4('0x26')]=undefined;loggerPredictive['info'](_0x329bcf['name'],_0x28f4('0x96'));}if(!_[_0x28f4('0x86')](_0x329bcf[_0x28f4('0x97')])){clearInterval(_0x329bcf['handlePredictive']);_0x329bcf[_0x28f4('0x97')]=undefined;loggerPredictive[_0x28f4('0x81')](_0x329bcf[_0x28f4('0x3f')],_0x28f4('0x98'));}}}function erlangb(_0x4e3dd3,_0x1e4385){if(_0x1e4385===0x0){return 0x0;}var _0x7f759e=0x1;for(var _0x550b61=0x1;_0x550b61<=_0x1e4385;_0x550b61+=0x1){_0x7f759e=0x1+_0x7f759e*_0x550b61/_0x4e3dd3;}return 0x1/_0x7f759e;}function isVoiceQueueOutbound(_0x3a110d){return _0x3a110d==='outbound';}function isNotPreview(_0x4e48f5){return _0x4e48f5!==_0x28f4('0x1d');}function isCampaignIvr(_0x3ece44){return _0x3ece44===_0x28f4('0x7f');}function getCallerId(_0x42fabe,_0x349900,_0x42761a){if(!_[_0x28f4('0x86')](_0x42761a)&&typeof _0x42761a===_0x28f4('0x99')&&!_[_0x28f4('0x47')](_0x42761a)){if(!_[_0x28f4('0x86')](_0x349900)&&typeof _0x349900===_0x28f4('0x99')&&!_[_0x28f4('0x47')](_0x349900)){return util[_0x28f4('0x7c')](_0x28f4('0x9a'),_0x349900,_0x42761a);}return util['format']('\x22%s\x22\x20<%s>',_0x42761a,_0x42761a);}if(!_[_0x28f4('0x86')](_0x42fabe)&&typeof _0x42fabe===_0x28f4('0x99')&&!_[_0x28f4('0x47')](_0x42fabe)){return _0x42fabe;}return'\x22\x22\x20<>';}function loggerCatchQueueSummary(_0x2211e6,_0x4a98a9){return function(_0x3fbab4){freeVariablesPredictive(_0x4a98a9);emitVoiceQueueSummary(_0x4a98a9);emitCampaignSummary(_0x4a98a9);loggerSyncQueueSummary['error'](_0x2211e6,util['inspect'](_0x3fbab4,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x59662e,_0x4cfd38){return function(_0x1b5530){loggerPredictive[_0x28f4('0x9b')](_0x4cfd38[_0x28f4('0x3f')],_0x59662e);loggerPredictive[_0x28f4('0x9b')](_0x1b5530[_0x28f4('0x9c')]);freeVariablesPredictive(_0x4cfd38);};}function loggerCatch(_0x1ed3c2){return function(_0x4f2dd3){logger[_0x28f4('0x9b')](_0x1ed3c2,util['inspect'](_0x4f2dd3,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x112793){return _0x112793&&!_[_0x28f4('0x86')](_0x112793)&&_0x112793[_0x28f4('0x9d')]>0x0;}function decremetOriginate(_0x154fad){if(!_[_0x28f4('0x86')](_0x154fad)&&_0x154fad!==null){if(typeof _0x154fad['originated']!==_0x28f4('0x9e')){if(_0x154fad[_0x28f4('0x75')]>0x0){_0x154fad[_0x28f4('0x75')]-=0x1;}else{logger['error'](_0x28f4('0x9f'));}}}else{logger[_0x28f4('0x9b')](_0x28f4('0xa0'));}}function checkContactLowerLimitOriginate(_0x2381dc,_0x4f83c2,_0x213bf1){if(_0x4f83c2>_0x213bf1){for(var _0x3b339c=0x0;_0x3b339c<_0x4f83c2-_0x213bf1;_0x3b339c+=0x1){decremetOriginate(_0x2381dc);}}}function loggerGetContactDialer(_0x1262f0,_0x52ce73,_0xd4908a){return function(_0x1aad69){checkContactLowerLimitOriginate(_0x52ce73,_0xd4908a,0x0);logger[_0x28f4('0x9b')](_0x1262f0,util[_0x28f4('0xa1')](_0x1aad69,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x37a36a){return function(_0x2aed43){if(isNotNull(_0x2aed43)&&isNotNull(_0x2aed43[0x0])){if(_0x2aed43[0x0][_0x28f4('0xa2')]>0x0){_0x37a36a['message']=_0x28f4('0xa3');logger[_0x28f4('0x81')]('[getContactDialer2][ReScheduled]'+_0x37a36a[_0x28f4('0x3f')],_0x2aed43[0x0][_0x28f4('0xa2')],'contacts');}else{_0x37a36a[_0x28f4('0x3d')]='AVAILABLE_CONTACTS_FINISHED';logger[_0x28f4('0x81')]('[getContactDialer2][Empty]'+_0x37a36a['name']);}}};}function notSendMessagesQueue(_0x5c191c){if(_0x5c191c[_0x28f4('0xa4')]){freeVariablesPredictive(_0x5c191c);if(_0x5c191c[_0x28f4('0x75')]===0x0&&_0x5c191c[_0x28f4('0x55')]===0x0&&_0x5c191c['waiting']===0x0&&(_0x5c191c[_0x28f4('0xa5')]||0x0)===0x0){_0x5c191c[_0x28f4('0xa4')]=![];_0x5c191c['available']=0x0;_0x5c191c[_0x28f4('0x3d')]=_0x28f4('0x41');loggerSyncQueueSummary[_0x28f4('0x9b')]('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x5c191c[_0x28f4('0x3f')],_0x28f4('0xa6'));}else{_0x5c191c[_0x28f4('0x3d')]=_0x28f4('0xa7');loggerSyncQueueSummary[_0x28f4('0x9b')](_0x28f4('0xa8'),_0x5c191c[_0x28f4('0x3f')],_0x28f4('0xa9'));}emitVoiceQueueSummary(_0x5c191c);}}function notSendMessagesCampaign(_0xf8c58f){if(_0xf8c58f['sendMessageOneNotActive']){if(_0xf8c58f[_0x28f4('0x75')]===0x0){_0xf8c58f[_0x28f4('0xa4')]=![];_0xf8c58f['message']=_0x28f4('0x41');loggerSyncQueueSummary[_0x28f4('0x9b')](_0x28f4('0xaa'),_0xf8c58f[_0x28f4('0x3f')],'is\x20not\x20active');}else{_0xf8c58f['message']=_0x28f4('0xa7');loggerSyncQueueSummary[_0x28f4('0x9b')](_0x28f4('0xaa'),_0xf8c58f['name'],'is\x20disactive');}emitCampaignSummary(_0xf8c58f);}}function createObjHistory(_0x4c5616,_0x581a0f,_0x57d1c8,_0x2beeb5,_0xd07b){_0x4c5616['message']=_0x57d1c8;var _0x59bd8a=new Action(_0x4c5616,_0x581a0f);var _0x2706a0=new History(_0x59bd8a);_0x2706a0[_0x28f4('0xab')]=_0x2beeb5;_0x2706a0[_0x28f4('0xac')]=_0xd07b;_0x2706a0['endtime']=_0x59bd8a['starttime'];return _0x2706a0;}Dialer[_0x28f4('0xad')][_0x28f4('0x39')]=function(){var _0x32e73d=this;setInterval(function(){_0x32e73d[_0x28f4('0xae')](_0x32e73d[_0x28f4('0x25')],_0x28f4('0xaf'));_0x32e73d[_0x28f4('0xae')](_0x32e73d['actions'],'[actions]');},0x32c8);};Dialer[_0x28f4('0xad')][_0x28f4('0xae')]=function(_0x41532a,_0xef8bd7){var _0x3289c9=this;for(var _0x256e89 in _0x41532a){if(typeof _0x41532a[_0x256e89]!==_0x28f4('0x9e')){this['sequence']['enqueue'](function(){if(!_[_0x28f4('0xb0')](_0x41532a[_0x256e89])){return ami[_0x28f4('0xb1')]({'action':_0x28f4('0xb2'),'channel':_0x41532a[_0x256e89][_0x28f4('0xb3')]})[_0x28f4('0xb4')](function(_0x16c3b0){if(_0x16c3b0[_0x28f4('0x3d')]===_0x28f4('0xb5')){setTimeout(function(){if(_0x41532a[_0x256e89]&&_0x41532a[_0x256e89][_0x28f4('0x57')]!==_0x28f4('0x7f')){_0x3289c9[_0x28f4('0xb6')](_0x3289c9[_0x28f4('0x1e')][_0x41532a[_0x256e89]['queue']]);logger[_0x28f4('0x9b')](_0x28f4('0xb7'),_0xef8bd7,_0x256e89,_0x41532a[_0x256e89][_0x28f4('0xb8')]);delete _0x41532a[_0x256e89];}if(_0x41532a[_0x256e89]&&_0x41532a[_0x256e89]['type']===_0x28f4('0x7f')){_0x3289c9[_0x28f4('0xb6')](_0x3289c9[_0x28f4('0x1f')][_0x41532a[_0x256e89]['queue']]);logger[_0x28f4('0x9b')]('[Dialer][checkChannel][ivr]',_0xef8bd7,_0x256e89,_0x41532a[_0x256e89][_0x28f4('0xb8')]);delete _0x41532a[_0x256e89];}},0x2328);}});}});}}};Dialer[_0x28f4('0xad')][_0x28f4('0xb9')]=function(_0x474a77){return BPromise[_0x28f4('0xba')]()[_0x28f4('0x3b')](cmHopper[_0x28f4('0xb9')](_0x474a77))[_0x28f4('0xb4')](loggerCatch('[countReScheduled]\x20'));};Dialer['prototype'][_0x28f4('0xbb')]=function(_0x51919b){return BPromise[_0x28f4('0xba')]()[_0x28f4('0x3b')](cmHopperBlack[_0x28f4('0xbb')](_0x51919b))[_0x28f4('0xb4')](loggerCatch(_0x28f4('0xbc')));};Dialer[_0x28f4('0xad')]['checkIsBlackListIvr']=function(_0x1903ac){return BPromise['resolve']()[_0x28f4('0x3b')](cmHopperBlack['checkIsBlackListIvr'](_0x1903ac))[_0x28f4('0xb4')](loggerCatch(_0x28f4('0xbd')));};Dialer[_0x28f4('0xad')][_0x28f4('0xbe')]=function(_0x594a79){return BPromise[_0x28f4('0xba')]()[_0x28f4('0x3b')](cmHopperHistory[_0x28f4('0xbf')](_0x594a79))[_0x28f4('0xb4')](loggerCatch(_0x28f4('0xc0')));};Dialer['prototype'][_0x28f4('0xc1')]=function(_0x36f932){return BPromise[_0x28f4('0xba')]()['then'](cmHopper[_0x28f4('0xc1')](_0x36f932))[_0x28f4('0xb4')](loggerCatch('[rescheduleContact]\x20'));};Dialer[_0x28f4('0xad')][_0x28f4('0xc2')]=function(_0x31dc9b,_0x5c61a1,_0x2e965d){return BPromise[_0x28f4('0xba')]()['then'](cmHopper[_0x28f4('0xc2')](_0x31dc9b,_0x5c61a1,_0x2e965d))[_0x28f4('0xb4')](loggerCatch('[unlockContact]\x20'));};Dialer[_0x28f4('0xad')]['getContactDialer']=function(_0x5a8f4f,_0x4b2a00,_0x1f4656,_0x28ea87,_0x3dfa8c){return BPromise[_0x28f4('0xba')]()['then'](cmHopper['getContactDialer'](_0x5a8f4f,_0x4b2a00,_0x1f4656,_0x28ea87))['catch'](function(_0x36aedc){_0x3dfa8c['temp']-=_0x1f4656;_0x3dfa8c[_0x28f4('0xc3')]=_0x3dfa8c[_0x28f4('0xc3')]>0x0?_0x3dfa8c['temp']:0x0;loggerCatch(_0x28f4('0xc4'))(_0x36aedc);});};Dialer[_0x28f4('0xad')][_0x28f4('0xc5')]=function(_0x1e06bc,_0x341749,_0x5ee27a,_0x390a71){return BPromise[_0x28f4('0xba')]()[_0x28f4('0x3b')](cmHopper[_0x28f4('0xc5')](_0x1e06bc,_0x341749,_0x5ee27a))[_0x28f4('0xb4')](function(_0x28c961){_0x390a71['temp']-=_0x341749;_0x390a71['temp']=_0x390a71[_0x28f4('0xc3')]>0x0?_0x390a71['temp']:0x0;loggerCatch(_0x28f4('0xc6'))(_0x28c961);});};Dialer[_0x28f4('0xad')][_0x28f4('0xc7')]=function(_0x56e0a9){return BPromise[_0x28f4('0xba')]()[_0x28f4('0x3b')](voiceQueueRt[_0x28f4('0xc7')](_0x56e0a9))[_0x28f4('0xb4')](loggerCatch(_0x28f4('0xc8')));};Dialer['prototype'][_0x28f4('0xc9')]=function(_0x326826){return BPromise[_0x28f4('0xba')]()[_0x28f4('0x3b')](cmHopper[_0x28f4('0xc9')](_0x326826))[_0x28f4('0xb4')](loggerCatch(_0x28f4('0xca')));};Dialer['prototype'][_0x28f4('0xcb')]=function(_0x72a7bf){return BPromise['resolve']()['then'](cmHopperHistory[_0x28f4('0xcb')](_0x72a7bf))['catch'](loggerCatch(_0x28f4('0xcc')));};Dialer[_0x28f4('0xad')]['updateOriginated']=function(_0x89452f){if(!_[_0x28f4('0x86')](_0x89452f)&&_0x89452f!==null){if(typeof _0x89452f[_0x28f4('0x75')]!==_0x28f4('0x9e')){if(_0x89452f[_0x28f4('0x75')]>0x0){_0x89452f[_0x28f4('0x75')]-=0x1;}else{logger[_0x28f4('0x9b')](_0x28f4('0xcd'));}}}else{logger[_0x28f4('0x9b')](_0x28f4('0xce'));}};Dialer[_0x28f4('0xad')][_0x28f4('0xcf')]=function(_0x33c74c,_0x1e5563){var _0x16707d=this;return function(_0x5cffcf){_0x16707d['updateOriginated'](_0x1e5563);logger[_0x28f4('0x9b')](_0x33c74c,util[_0x28f4('0xa1')](_0x5cffcf,{'showHidden':![],'depth':null}));};};Dialer[_0x28f4('0xad')][_0x28f4('0xd0')]=function(_0x3cf6f4,_0x4916f7,_0x43c0b3){var _0x1466fd={'state':0x19,'statedesc':'notFound'};this[_0x28f4('0xb6')](_0x4916f7);this[_0x28f4('0xd1')](_[_0x28f4('0x93')](_0x1466fd,_['pick'](_0x43c0b3,[_0x28f4('0xd2'),_0x28f4('0xd3'),_0x28f4('0xd4'),_0x28f4('0xd5'),_0x28f4('0xd6')])),_0x28f4('0xd7'),_0x28f4('0xd8'));logger[_0x28f4('0x9b')](_0x3cf6f4);};Dialer[_0x28f4('0xad')][_0x28f4('0xd9')]=function(_0x5e1db6){return _0x5e1db6===_0x28f4('0xda');};Dialer[_0x28f4('0xad')]['isTrunkReachable']=function(_0x3c9e57){return!_['isUndefined'](_0x3c9e57)&&_0x3c9e57&&!_[_0x28f4('0x86')](_0x3c9e57['name'])&&!_[_0x28f4('0x86')](_0x3c9e57[_0x28f4('0x79')])&&_0x3c9e57[_0x28f4('0x79')]&&(this[_0x28f4('0x21')][util['format']('SIP/%s',_0x3c9e57[_0x28f4('0x3f')])][_0x28f4('0xb2')]===_0x28f4('0xdb')||this[_0x28f4('0x21')][util[_0x28f4('0x7c')](_0x28f4('0xdc'),_0x3c9e57[_0x28f4('0x3f')])][_0x28f4('0xb2')]===_0x28f4('0xdd'));};Dialer[_0x28f4('0xad')]['saveInDb']=function(_0x4306ef,_0x23d8b1,_0x18bc58){this[_0x28f4('0xcb')](_0x4306ef)[_0x28f4('0xb4')](loggerCatch(_0x23d8b1));this[_0x28f4('0xc9')](_0x4306ef)[_0x28f4('0xb4')](loggerCatch(_0x18bc58));};Dialer[_0x28f4('0xad')][_0x28f4('0x34')]=function(_0x3490d1){var _0x30060e=this[_0x28f4('0x25')][_0x3490d1['uniqueid']];var _0x8fdfd5;if(!_['isNil'](_0x3490d1)&&!_[_0x28f4('0xb0')](_0x3490d1[_0x28f4('0xde')])&&!_[_0x28f4('0xb0')](_0x3490d1[_0x28f4('0xde')]['amdstatus'])&&_0x3490d1['exten']==='xcally-motion-dialer'&&_0x30060e){if(_0x30060e[_0x28f4('0x57')]!==_0x28f4('0x7f')&&this[_0x28f4('0x1e')][_0x30060e[_0x28f4('0xb8')]][_0x28f4('0xdf')]&&_0x3490d1[_0x28f4('0xe0')]===_0x28f4('0xe1')){delete this[_0x28f4('0x25')][_0x3490d1[_0x28f4('0xe2')]];this[_0x28f4('0xb6')](this[_0x28f4('0x1e')][_0x30060e[_0x28f4('0xb8')]]);this[_0x28f4('0x1e')][_0x30060e[_0x28f4('0xb8')]][_0x28f4('0x60')]+=0x1;this['voiceQueues'][_0x30060e['queue']]['outboundAnswerAgiCallsDay']+=0x1;_0x8fdfd5=new Hangup(_0x30060e,_0x3490d1);_0x8fdfd5[_0x28f4('0xab')]=0x12;_0x8fdfd5[_0x28f4('0xac')]=_0x28f4('0xe3');_0x8fdfd5[_0x28f4('0xe4')]=_0x28f4('0xe5');ami[_0x28f4('0x4d')](_0x28f4('0xe6'),ut[_0x28f4('0xe7')](_0x8fdfd5,_0x28f4('0xe8')));this['saveInDb'](_0x8fdfd5,'[syncHangupInAMD][createHistory]',_0x28f4('0xe9'));}if(_0x30060e['type']!==_0x28f4('0x7f')&&this[_0x28f4('0x1e')][_0x30060e[_0x28f4('0xb8')]][_0x28f4('0xdf')]&&_0x3490d1[_0x28f4('0xe0')]==='MACHINE'){var _0x9bdc9c=this;return new BPromise(function(_0x39e92d,_0x4f9011){delete _0x9bdc9c['uniqueId'][_0x3490d1[_0x28f4('0xe2')]];_0x9bdc9c[_0x28f4('0xb6')](_0x9bdc9c[_0x28f4('0x1e')][_0x30060e[_0x28f4('0xb8')]]);_0x9bdc9c[_0x28f4('0x1e')][_0x30060e[_0x28f4('0xb8')]]['outboundAnswerCallsDay']+=0x1;_0x9bdc9c[_0x28f4('0x1e')][_0x30060e[_0x28f4('0xb8')]][_0x28f4('0x5f')]+=0x1;var _0x281606=_0x9bdc9c[_0x28f4('0x1e')][_0x30060e[_0x28f4('0xb8')]];var _0x42b609=new Hangup(_0x30060e,_0x3490d1);_0x42b609[_0x28f4('0xab')]=0x13;_0x42b609['statedesc']=_0x28f4('0xea');_0x42b609[_0x28f4('0xe4')]=_0x28f4('0xe5');_0x42b609['countmachineretry']+=0x1;_0x42b609['countglobal']+=0x1;_0x42b609[_0x28f4('0xe8')]=!![];ami[_0x28f4('0x4d')](_0x28f4('0xe6'),ut[_0x28f4('0xe7')](_0x42b609,_0x28f4('0xe8')));_0x9bdc9c[_0x28f4('0xcb')](_0x42b609)[_0x28f4('0xb4')](loggerCatch(_0x28f4('0xeb')));if(_0x42b609['countbusyretry']+_0x42b609[_0x28f4('0xec')]+_0x42b609[_0x28f4('0xed')]+_0x42b609[_0x28f4('0xee')]+_0x42b609['countdropretry']+_0x42b609[_0x28f4('0xef')]+_0x42b609[_0x28f4('0xf0')]+_0x42b609[_0x28f4('0xf1')]>=_0x281606[_0x28f4('0xf2')]){_0x9bdc9c[_0x28f4('0xf3')](_0x42b609,_0x39e92d,_0x4f9011,_0x28f4('0xf4'));}else{if(_0x42b609[_0x28f4('0xf0')]>=_0x281606[_0x28f4('0xf5')]){_0x9bdc9c[_0x28f4('0xf6')](_0x42b609,_0x39e92d,_0x4f9011,_0x28f4('0xf7'));}else{_0x9bdc9c[_0x28f4('0xc1')]({'active':![],'countmachineretry':_0x42b609[_0x28f4('0xf0')],'scheduledat':moment()[_0x28f4('0xf8')](_0x281606[_0x28f4('0xf9')],_0x28f4('0xfa'))['format'](_0x28f4('0xfb')),'ContactId':_0x42b609['ContactId'],'ListId':_0x42b609[_0x28f4('0xd3')],'VoiceQueueId':_0x42b609['VoiceQueueId']||undefined,'CampaignId':_0x42b609[_0x28f4('0xd6')]||undefined})['catch'](loggerCatch(_0x28f4('0xfc')));_0x39e92d({'reschedule':0x1});}}});}if(_0x30060e[_0x28f4('0x57')]===_0x28f4('0x7f')&&this[_0x28f4('0x1f')][_0x30060e['queue']][_0x28f4('0xdf')]&&_0x3490d1[_0x28f4('0xe0')]===_0x28f4('0xe1')){delete this[_0x28f4('0x25')][_0x3490d1[_0x28f4('0xe2')]];this[_0x28f4('0xb6')](this[_0x28f4('0x1f')][_0x30060e[_0x28f4('0xb8')]]);_0x8fdfd5=new Hangup(_0x30060e,_0x3490d1);_0x8fdfd5[_0x28f4('0xab')]=0x12;_0x8fdfd5[_0x28f4('0xac')]='HangupInAMD';_0x8fdfd5[_0x28f4('0xe4')]=_0x28f4('0xe5');ami['emit'](_0x28f4('0xe6'),ut[_0x28f4('0xe7')](_0x8fdfd5,_0x28f4('0xe8')));this['saveInDb'](_0x8fdfd5,_0x28f4('0xfd'),_0x28f4('0xfe'));}if(_0x30060e[_0x28f4('0x57')]===_0x28f4('0x7f')&&this[_0x28f4('0x1f')][_0x30060e[_0x28f4('0xb8')]][_0x28f4('0xdf')]&&_0x3490d1['value']===_0x28f4('0xff')){var _0x9bdc9c=this;return new BPromise(function(_0x34a42e,_0x6cc0fa){delete _0x9bdc9c[_0x28f4('0x25')][_0x3490d1[_0x28f4('0xe2')]];_0x9bdc9c[_0x28f4('0xb6')](_0x9bdc9c[_0x28f4('0x1f')][_0x30060e['queue']]);_0x9bdc9c['campaigns'][_0x30060e[_0x28f4('0xb8')]][_0x28f4('0x60')]+=0x1;_0x9bdc9c[_0x28f4('0x1f')][_0x30060e['queue']][_0x28f4('0x5f')]+=0x1;var _0x35b23a=_0x9bdc9c['campaigns'][_0x30060e[_0x28f4('0xb8')]];var _0x14994d=new Hangup(_0x30060e,_0x3490d1);_0x14994d[_0x28f4('0xab')]=0x13;_0x14994d['statedesc']=_0x28f4('0xea');_0x14994d['membername']=_0x28f4('0xe5');_0x14994d[_0x28f4('0xf0')]+=0x1;_0x14994d[_0x28f4('0x100')]+=0x1;_0x14994d[_0x28f4('0xe8')]=!![];ami['emit'](_0x28f4('0xe6'),ut[_0x28f4('0xe7')](_0x14994d,_0x28f4('0xe8')));_0x9bdc9c[_0x28f4('0xcb')](_0x14994d)[_0x28f4('0xb4')](loggerCatch(_0x28f4('0xeb')));if(_0x14994d[_0x28f4('0x101')]+_0x14994d[_0x28f4('0xec')]+_0x14994d['countnoanswerretry']+_0x14994d[_0x28f4('0xee')]+_0x14994d[_0x28f4('0x102')]+_0x14994d['countabandonedretry']+_0x14994d['countmachineretry']+_0x14994d[_0x28f4('0xf1')]>=_0x35b23a[_0x28f4('0xf2')]){_0x9bdc9c['stateGlobal'](_0x14994d,_0x34a42e,_0x6cc0fa,_0x28f4('0xf4'));}else{if(_0x14994d[_0x28f4('0xf0')]>=_0x35b23a[_0x28f4('0xf5')]){_0x9bdc9c[_0x28f4('0xf6')](_0x14994d,_0x34a42e,_0x6cc0fa,_0x28f4('0xf7'));}else{_0x9bdc9c[_0x28f4('0xc1')]({'active':![],'countmachineretry':_0x14994d['countmachineretry'],'scheduledat':moment()['add'](_0x35b23a[_0x28f4('0xf9')],_0x28f4('0xfa'))['format'](_0x28f4('0xfb')),'ContactId':_0x14994d[_0x28f4('0xd2')],'ListId':_0x14994d[_0x28f4('0xd3')],'VoiceQueueId':_0x14994d[_0x28f4('0xd5')]||undefined,'CampaignId':_0x14994d[_0x28f4('0xd6')]||undefined})[_0x28f4('0xb4')](loggerCatch(_0x28f4('0xfc')));_0x34a42e({'reschedule':0x1});}}});}}};Dialer[_0x28f4('0xad')][_0x28f4('0x31')]=function(_0x1165fe){var _0x1dc385=this['uniqueId'][_0x1165fe['uniqueid']];var _0x16281f=this;var _0x2e87f2;if(_0x1dc385&&_0x1dc385[_0x28f4('0x57')]===_0x28f4('0x7f')){delete this[_0x28f4('0x25')][_0x1165fe[_0x28f4('0xe2')]];this['updateOriginated'](this['campaigns'][_0x1dc385['queue']]);this[_0x28f4('0x1f')][_0x1dc385[_0x28f4('0xb8')]][_0x28f4('0x103')]+=0x1;_0x2e87f2=new Hangup(_0x1dc385,_0x1165fe);this[_0x28f4('0xcb')](_0x2e87f2)['catch'](loggerCatch(_0x28f4('0x104')));this[_0x28f4('0xc9')](_0x2e87f2)['catch'](loggerCatch(_0x28f4('0x105')));}if(_0x1dc385&&_0x1dc385['type']!=='ivr'&&isNotNull(this['voiceQueues'][_0x1dc385[_0x28f4('0xb8')]]['dialQueueProject'])){delete this[_0x28f4('0x25')][_0x1165fe[_0x28f4('0xe2')]];this['updateOriginated'](this[_0x28f4('0x1e')][_0x1dc385[_0x28f4('0xb8')]]);this[_0x28f4('0x1e')][_0x1dc385['queue']][_0x28f4('0x60')]+=0x1;this['voiceQueues'][_0x1dc385[_0x28f4('0xb8')]][_0x28f4('0x5f')]+=0x1;_0x2e87f2=new Hangup(_0x1dc385,_0x1165fe);_0x2e87f2[_0x28f4('0xab')]=0x10;_0x2e87f2['statedesc']=_0x28f4('0x106');_0x2e87f2[_0x28f4('0xe4')]='AGI';this['createHistory'](_0x2e87f2)[_0x28f4('0xb4')](loggerCatch(_0x28f4('0x104')));this[_0x28f4('0xc9')](_0x2e87f2)['catch'](loggerCatch(_0x28f4('0x105')));}if(_0x1dc385&&_0x1dc385[_0x28f4('0x57')]!==_0x28f4('0x7f')&&!isNotNull(this[_0x28f4('0x1e')][_0x1dc385[_0x28f4('0xb8')]]['dialQueueProject'])){delete this[_0x28f4('0x25')][_0x1165fe[_0x28f4('0xe2')]];this[_0x28f4('0xb6')](this[_0x28f4('0x1e')][_0x1dc385[_0x28f4('0xb8')]]);this[_0x28f4('0x1e')][_0x1dc385[_0x28f4('0xb8')]]['outboundUnknownCallsDay']+=0x1;_0x2e87f2=new Hangup(_0x1dc385,_0x1165fe);_0x2e87f2[_0x28f4('0xab')]=0xc;_0x2e87f2[_0x28f4('0xac')]=_0x1165fe[_0x28f4('0x107')];_0x2e87f2[_0x28f4('0xe4')]=_0x28f4('0x108');this['createHistory'](_0x2e87f2)[_0x28f4('0xb4')](loggerCatch(_0x28f4('0x104')));this['moveContactManagedDialer'](_0x2e87f2)[_0x28f4('0xb4')](loggerCatch('[syncHangupIvr]'));}};Dialer[_0x28f4('0xad')]['syncAgentComplete']=function(_0x32a84c){var _0x3a251c=this[_0x28f4('0x25')][_0x32a84c[_0x28f4('0xe2')]];var _0x263be9=this;if(this[_0x28f4('0x1e')][_0x32a84c['queue']]){if(_0x3a251c&&_0x3a251c[_0x28f4('0x57')]!=='ivr'){delete this[_0x28f4('0x25')][_0x32a84c[_0x28f4('0xe2')]];this[_0x28f4('0x1e')][_0x32a84c[_0x28f4('0xb8')]]['outboundAnswerCallsDay']+=0x1;var _0x2b8e0e=new AgentComplete(_0x3a251c,_0x32a84c);if(_0x32a84c[_0x28f4('0x109')]===_0x28f4('0x10a')){_0x2b8e0e[_0x28f4('0x10b')]=this['voiceQueues'][_0x32a84c[_0x28f4('0xb8')]]['dialQueueProject2']&&this[_0x28f4('0x1e')][_0x32a84c[_0x28f4('0xb8')]]['dialAgiAfterHangupAgent']?moment()[_0x28f4('0x7c')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;}this['createHistory'](_0x2b8e0e)[_0x28f4('0xb4')](loggerCatch(_0x28f4('0x10c')));this[_0x28f4('0xc9')](_0x2b8e0e)[_0x28f4('0xb4')](loggerCatch(_0x28f4('0x10d')));}}};Dialer[_0x28f4('0xad')][_0x28f4('0x10e')]=function(_0x175bd7){if(this[_0x28f4('0x1e')][_0x175bd7[_0x28f4('0xb8')]]){if(this[_0x28f4('0x25')][_0x175bd7[_0x28f4('0xe2')]]&&this['uniqueId'][_0x175bd7[_0x28f4('0xe2')]][_0x28f4('0x57')]!==_0x28f4('0x7f')){this[_0x28f4('0xb6')](this[_0x28f4('0x1e')][_0x175bd7[_0x28f4('0xb8')]]);this[_0x28f4('0x25')][_0x175bd7[_0x28f4('0xe2')]][_0x28f4('0x10f')]=moment()[_0x28f4('0x7c')](_0x28f4('0xfb'));}}};Dialer[_0x28f4('0xad')][_0x28f4('0x110')]=function(_0x28e88b){this['createHistory'](_0x28e88b)['catch'](loggerCatch(_0x28f4('0x10c')));this['moveContactManagedDialer'](_0x28e88b)[_0x28f4('0xb4')](loggerCatch(_0x28f4('0x111')));};Dialer[_0x28f4('0xad')][_0x28f4('0x2a')]=function(_0x525508){var _0x48c583=this['uniqueId'][_0x525508[_0x28f4('0xe2')]];var _0x5e6bf8=this;if(this[_0x28f4('0x1e')][_0x525508[_0x28f4('0xb8')]]){if(_0x48c583&&_0x48c583['type']!==_0x28f4('0x7f')){delete this[_0x28f4('0x25')][_0x525508['uniqueid']];this[_0x28f4('0xb6')](this[_0x28f4('0x1e')][_0x525508[_0x28f4('0xb8')]]);_0x48c583['droptime']=moment()[_0x28f4('0x7c')](_0x28f4('0xfb'));var _0x2fbf5a=new QueueCallerAbandon(_0x48c583,_0x525508);if(getSeconds(_0x48c583[_0x28f4('0x112')],_0x48c583[_0x28f4('0x113')])>=_0x48c583[_0x28f4('0x114')]){this[_0x28f4('0x1e')][_0x525508[_0x28f4('0xb8')]][_0x28f4('0x6d')]+=0x1;this[_0x28f4('0x1e')][_0x525508['queue']][_0x28f4('0x115')]+=0x1;this[_0x28f4('0x1e')][_0x525508['queue']][_0x28f4('0x6f')]+=0x1;_0x2fbf5a['state']=0xa;_0x2fbf5a[_0x28f4('0xac')]=_0x28f4('0x116');_0x2fbf5a[_0x28f4('0x117')]=_0x28f4('0x118');_0x2fbf5a[_0x28f4('0x10b')]=this['voiceQueues'][_0x525508['queue']][_0x28f4('0x119')]?moment()[_0x28f4('0x7c')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0x2fbf5a['countdropretry']+=0x1;_0x2fbf5a['countglobal']+=0x1;if(_0x2fbf5a[_0x28f4('0x102')]>=this[_0x28f4('0x1e')][_0x525508['queue']][_0x28f4('0x11a')]){this[_0x28f4('0x110')](_0x2fbf5a);}else{this[_0x28f4('0xc1')]({'active':![],'countdropretry':_0x2fbf5a['countdropretry'],'scheduledat':moment()[_0x28f4('0xf8')](this['voiceQueues'][_0x525508['queue']][_0x28f4('0x11b')],'minutes')[_0x28f4('0x7c')](_0x28f4('0xfb')),'ContactId':_0x48c583['ContactId'],'ListId':_0x48c583[_0x28f4('0xd3')],'VoiceQueueId':_0x48c583[_0x28f4('0xd5')]||undefined,'CampaignId':_0x48c583[_0x28f4('0xd6')]||undefined})[_0x28f4('0xb4')](loggerCatch(_0x28f4('0x11c')));var _0x40cf5a=new History(_0x2fbf5a);_0x40cf5a[_0x28f4('0xab')]=0xa;_0x40cf5a[_0x28f4('0xac')]='Drop';_0x40cf5a[_0x28f4('0x11d')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x40cf5a['endtime']=_0x40cf5a['starttime'];_0x40cf5a[_0x28f4('0x11e')]=_0x2fbf5a[_0x28f4('0x11e')];_0x40cf5a[_0x28f4('0x11f')]=_0x2fbf5a[_0x28f4('0x11f')];this[_0x28f4('0xcb')](_0x40cf5a)[_0x28f4('0xb4')](loggerCatch(_0x28f4('0x120')));}}else{this['voiceQueues'][_0x525508[_0x28f4('0xb8')]][_0x28f4('0x6c')]+=0x1;this[_0x28f4('0x1e')][_0x525508[_0x28f4('0xb8')]][_0x28f4('0x64')]+=0x1;_0x2fbf5a['state']=0xb;_0x2fbf5a['statedesc']='Abandoned';_0x2fbf5a['dropreason']=_0x28f4('0x121');_0x2fbf5a[_0x28f4('0xef')]+=0x1;_0x2fbf5a['countglobal']+=0x1;if(_0x2fbf5a[_0x28f4('0xef')]>=this[_0x28f4('0x1e')][_0x525508[_0x28f4('0xb8')]][_0x28f4('0x122')]){this[_0x28f4('0x110')](_0x2fbf5a);}else{this[_0x28f4('0xc1')]({'active':![],'countabandonedretry':_0x2fbf5a['countabandonedretry'],'scheduledat':moment()['add'](this[_0x28f4('0x1e')][_0x525508[_0x28f4('0xb8')]][_0x28f4('0x123')],'minutes')['format'](_0x28f4('0xfb')),'ContactId':_0x48c583[_0x28f4('0xd2')],'ListId':_0x48c583['ListId'],'VoiceQueueId':_0x48c583[_0x28f4('0xd5')]||undefined,'CampaignId':_0x48c583[_0x28f4('0xd6')]||undefined})[_0x28f4('0xb4')](loggerCatch('[rescheduleContact][Abandoned]'));var _0x40cf5a=new History(_0x2fbf5a);_0x40cf5a[_0x28f4('0xab')]=0xb;_0x40cf5a[_0x28f4('0xac')]='Abandoned';_0x40cf5a['starttime']=moment()[_0x28f4('0x7c')](_0x28f4('0xfb'));_0x40cf5a['endtime']=_0x40cf5a[_0x28f4('0x11d')];_0x40cf5a['calleridname']=_0x2fbf5a[_0x28f4('0x11e')];_0x40cf5a[_0x28f4('0x11f')]=_0x2fbf5a[_0x28f4('0x11f')];this['createHistory'](_0x40cf5a)['catch'](loggerCatch(_0x28f4('0x124')));}}}}};Dialer[_0x28f4('0xad')][_0x28f4('0x125')]=function(_0x36522a){if(this['actions'][_0x36522a[_0x28f4('0xe2')]]){this[_0x28f4('0x126')][_0x36522a[_0x28f4('0xe2')]][_0x28f4('0xb3')]=_0x36522a['channel'];}if(this[_0x28f4('0x25')][_0x36522a[_0x28f4('0xe2')]]){this['uniqueId'][_0x36522a[_0x28f4('0xe2')]]['channel']=_0x36522a[_0x28f4('0xb3')];}};Dialer[_0x28f4('0xad')][_0x28f4('0x36')]=function(_0x51e0dd){if(strategy[this[_0x28f4('0x1e')][this[_0x28f4('0x126')][_0x51e0dd[_0x28f4('0x127')]]['queue']][_0x28f4('0x4e')]]===_0x28f4('0x128')){if(this[_0x28f4('0x126')][_0x51e0dd[_0x28f4('0x127')]]&&_[_0x28f4('0xb0')](this['actions'][_0x51e0dd[_0x28f4('0x127')]]['locked'])&&_0x51e0dd[_0x28f4('0xb2')]==='1'&&_0x51e0dd[_0x28f4('0x129')]==='0'){if(this['agents'][_0x51e0dd['stateinterface']]){if(!this[_0x28f4('0x20')][_0x51e0dd['stateinterface']][_0x28f4('0x12a')]){this[_0x28f4('0x20')][_0x51e0dd[_0x28f4('0x12b')]]['locked']=!![];this['actions'][_0x51e0dd[_0x28f4('0x127')]][_0x28f4('0x12a')]=!![];this[_0x28f4('0x126')][_0x51e0dd[_0x28f4('0x127')]][_0x28f4('0x12b')]=_0x51e0dd[_0x28f4('0x12b')];}}}}else if((strategy[this['voiceQueues'][this[_0x28f4('0x126')][_0x51e0dd[_0x28f4('0x127')]][_0x28f4('0xb8')]][_0x28f4('0x4e')]]||_0x28f4('0x12c'))===_0x28f4('0x12c')){if(this['actions'][_0x51e0dd[_0x28f4('0x127')]]){if(this['agents'][_0x51e0dd[_0x28f4('0x12b')]]){this[_0x28f4('0x126')][_0x51e0dd['actionid']][_0x28f4('0x12b')]=_0x51e0dd[_0x28f4('0x12b')];if(_[_0x28f4('0xb0')](this[_0x28f4('0x27')][this[_0x28f4('0x126')][_0x51e0dd[_0x28f4('0x127')]][_0x28f4('0xb8')]])){this[_0x28f4('0x27')][this[_0x28f4('0x126')][_0x51e0dd[_0x28f4('0x127')]][_0x28f4('0xb8')]]=[];}this[_0x28f4('0x27')][this['actions'][_0x51e0dd[_0x28f4('0x127')]]['queue']][_0x28f4('0x12d')](_[_0x28f4('0x93')](_[_0x28f4('0x12e')](this[_0x28f4('0x126')][_0x51e0dd[_0x28f4('0x127')]],['idHopper',_0x28f4('0x12b')]),{'status':_0x51e0dd['status'],'paused':_0x51e0dd[_0x28f4('0x129')]}));}}}};function unlockQueueStatus(_0x13acc3,_0x12c922){setTimeout(function(){if(_[_0x28f4('0x86')](_0x13acc3[_0x28f4('0x12f')])){loggerBooked['error']('[unlockQueueStatus][undefined]',_0x12c922);}_0x13acc3[_0x28f4('0x12f')]=!![];loggerBooked[_0x28f4('0x81')](_0x28f4('0x130'),_0x12c922,JSON[_0x28f4('0x7a')](_['pick'](_0x13acc3,[_0x28f4('0x3f'),_0x28f4('0x12f')])));},0x1f3);}Dialer['prototype'][_0x28f4('0x37')]=function(_0x28b9d6){var _0x36838c=this;var _0x9abe31=_0x36838c[_0x28f4('0x1e')][_0x36838c[_0x28f4('0x126')][_0x28b9d6[_0x28f4('0x127')]]['queue']];if(strategy[this[_0x28f4('0x1e')][this[_0x28f4('0x126')][_0x28b9d6[_0x28f4('0x127')]][_0x28f4('0xb8')]][_0x28f4('0x4e')]]===_0x28f4('0x128')){if(this[_0x28f4('0x126')][_0x28b9d6[_0x28f4('0x127')]]&&this[_0x28f4('0x126')][_0x28b9d6[_0x28f4('0x127')]][_0x28f4('0x12b')]){this['preview']['run'](this[_0x28f4('0x126')][_0x28b9d6[_0x28f4('0x127')]]['idHopper'],this[_0x28f4('0x126')][_0x28b9d6[_0x28f4('0x127')]]['stateinterface'])[_0x28f4('0xb4')](function(_0x2217ac){logger['error'](_0x28f4('0x131'),util[_0x28f4('0xa1')](_0x2217ac,{'showHidden':![],'depth':null}));})['finally'](function(){_0x36838c[_0x28f4('0xb6')](_0x36838c[_0x28f4('0x1e')][_0x36838c['actions'][_0x28b9d6[_0x28f4('0x127')]]['queue']]);_0x36838c[_0x28f4('0x20')][_0x36838c['actions'][_0x28b9d6['actionid']][_0x28f4('0x12b')]][_0x28f4('0x12a')]=![];delete _0x36838c['actions'][_0x28b9d6[_0x28f4('0x127')]];unlockQueueStatus(_0x9abe31);});}else{this[_0x28f4('0xb6')](this[_0x28f4('0x1e')][this[_0x28f4('0x126')][_0x28b9d6[_0x28f4('0x127')]]['queue']]);this[_0x28f4('0xc1')]({'active':![],'ContactId':this[_0x28f4('0x126')][_0x28b9d6[_0x28f4('0x127')]]['ContactId'],'ListId':this[_0x28f4('0x126')][_0x28b9d6[_0x28f4('0x127')]]['ListId'],'VoiceQueueId':this[_0x28f4('0x126')][_0x28b9d6[_0x28f4('0x127')]]['VoiceQueueId']||undefined,'CampaignId':this['actions'][_0x28b9d6[_0x28f4('0x127')]][_0x28f4('0xd6')]||undefined})['catch'](loggerCatch(_0x28f4('0x132')));delete this['actions'][_0x28b9d6[_0x28f4('0x127')]];unlockQueueStatus(_0x9abe31);}}else if((strategy[this[_0x28f4('0x1e')][this[_0x28f4('0x126')][_0x28b9d6[_0x28f4('0x127')]][_0x28f4('0xb8')]]['strategy']]||_0x28f4('0x12c'))===_0x28f4('0x12c')){var _0x57ed12;if(this[_0x28f4('0x126')][_0x28b9d6['actionid']]&&!_[_0x28f4('0x47')](this[_0x28f4('0x27')][this[_0x28f4('0x126')][_0x28b9d6[_0x28f4('0x127')]]['queue']])){if(this[_0x28f4('0x28')][_0x36838c[_0x28f4('0x126')][_0x28b9d6['actionid']][_0x28f4('0xb8')]]){this[_0x28f4('0x28')][_0x36838c[_0x28f4('0x126')][_0x28b9d6[_0x28f4('0x127')]][_0x28f4('0xb8')]]=this['queueBookedRR'][this[_0x28f4('0x126')][_0x28b9d6[_0x28f4('0x127')]]['queue']]?this[_0x28f4('0x28')][this['actions'][_0x28b9d6['actionid']]['queue']]:this[_0x28f4('0x27')][this['actions'][_0x28b9d6['actionid']]['queue']]?this[_0x28f4('0x27')][this['actions'][_0x28b9d6['actionid']][_0x28f4('0xb8')]][_0x28f4('0x133')]||0x0:0x0;}this[_0x28f4('0x27')][this['actions'][_0x28b9d6[_0x28f4('0x127')]][_0x28f4('0xb8')]][_0x28f4('0x133')]=this[_0x28f4('0x28')][this['actions'][_0x28b9d6[_0x28f4('0x127')]][_0x28f4('0xb8')]];for(var _0x93ede4=0x0;_0x93ede4=0x0;})['catch'](myreject(_0x44f8f6)));}}else{_0x4546fd[_0x28f4('0x12d')](ami['Action']({'action':'command','command':util['format'](_0x28f4('0x14c'),_0x37462b,!_[_0x28f4('0x86')](config[_0x28f4('0x14e')][_0x4ba8db])?_0x4ba8db:'')})['then'](function(_0x2047d6){return _0x2047d6[_0x28f4('0x14f')][_0x28f4('0x150')](_0x28f4('0x151'))>=0x0;})['catch'](myreject(_0x44f8f6)));}BPromise[_0x28f4('0x152')](_0x4546fd)[_0x28f4('0x3b')](function(_0x4a0af4){var _0x55bb05=_[_0x28f4('0x153')](_0x4a0af4);if(_0x55bb05){return _0x2c3900(_0x55bb05);}else{_0xd940f5[_0x28f4('0x3d')]=_0x244909?_0x28f4('0x154'):_0x28f4('0x155');return _0x44f8f6(msgResponse(_0x28f4('0x156'),_0x28f4('0x146'),_0x28f4('0x157')+_0x244909+'\x20'+_0x786eb4+'\x20Interval\x20is\x20overtime:\x20'+util['inspect'](_0x37462b,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x4ba8db));}})[_0x28f4('0xb4')](function(_0x24ea7e){return _0x44f8f6(msgResponse('ifTime',_0x28f4('0x146'),JSON[_0x28f4('0x7a')](_0x24ea7e)));});});};Dialer[_0x28f4('0xad')]['checkDialMethod']=function(_0x15ae21){var _0x4ac844=this;return function(){switch(_0x15ae21['dialMethod']){case'progressive':freeVariablesPredictive(_0x15ae21);_0x4ac844[_0x28f4('0x158')](_0x15ae21,0x1);break;case'power':freeVariablesPredictive(_0x15ae21);_0x4ac844[_0x28f4('0x158')](_0x15ae21,_0x15ae21[_0x28f4('0x159')]);break;case'predictive':_0x4ac844['predictive'](_0x15ae21);break;case _0x28f4('0x7'):freeVariablesPredictive(_0x15ae21);_0x4ac844['handlePower'](_0x15ae21,0x1);break;default:freeVariablesPredictive(_0x15ae21);logger[_0x28f4('0x9b')](_0x28f4('0x15a'),_0x15ae21[_0x28f4('0x3f')],_0x28f4('0x15b'));}};};Dialer[_0x28f4('0xad')][_0x28f4('0x15c')]=function(_0x24ca36){return BPromise[_0x28f4('0xba')]()[_0x28f4('0x3b')](cmHopper[_0x28f4('0x15d')](_0x24ca36['id'],previewRecallmeReminderInterval))[_0x28f4('0x3b')](function(_0x36067c){for(var _0x1d9e83=0x0;_0x1d9e83<_0x36067c[_0x28f4('0x9d')];_0x1d9e83++){var _0x4b8c6f=_0x36067c[_0x1d9e83]['Agent'][_0x28f4('0x3f')];if(_0x4b8c6f)io['to'](util[_0x28f4('0x7c')](_0x28f4('0x15e'),_0x4b8c6f))[_0x28f4('0x4d')](_0x28f4('0x15f'),{'hopper':_0x36067c[_0x1d9e83]});}})[_0x28f4('0xb4')](function(_0x82e4ba){});};Dialer[_0x28f4('0xad')]['launchHandleIvr']=function(_0x241523){var _0x17fb68=this;return function(){_0x17fb68[_0x28f4('0x160')](_0x241523);};};Dialer[_0x28f4('0xad')][_0x28f4('0xa')]=function(_0x3a8a46){var _0x4b6acb=this;if(isNotPreview(_0x3a8a46['dialMethod'])){if(isVoiceQueueOutbound(_0x3a8a46[_0x28f4('0x57')])&&isActive(_0x3a8a46[_0x28f4('0x5c')])){_0x3a8a46[_0x28f4('0xa4')]=!![];BPromise[_0x28f4('0xba')]()['then'](checkIsLoggedIn(_0x3a8a46,_0x3a8a46[_0x28f4('0x51')]))['then'](checkIsActive(_0x3a8a46,_0x3a8a46[_0x28f4('0x5c')]))[_0x28f4('0x3b')](checkInterval(_0x3a8a46))[_0x28f4('0x3b')](_0x4b6acb[_0x28f4('0x161')](_0x3a8a46))[_0x28f4('0x3b')](_0x4b6acb[_0x28f4('0x144')](_0x3a8a46[_0x28f4('0x162')],_0x3a8a46[_0x28f4('0x163')],_0x3a8a46[_0x28f4('0x3f')],_0x3a8a46))['then'](_0x4b6acb[_0x28f4('0x164')](_0x3a8a46['Interval'],_0x3a8a46[_0x28f4('0x163')],_0x3a8a46[_0x28f4('0x3f')],_0x3a8a46))[_0x28f4('0x3b')](_0x4b6acb[_0x28f4('0x165')](_0x3a8a46))['catch'](loggerCatchQueueSummary('[syncQueueSummary]',_0x3a8a46));}else{notSendMessagesQueue(_0x3a8a46);}}else{freeVariablesPredictive(_0x3a8a46);if(_0x3a8a46[_0x28f4('0x166')]){_0x4b6acb[_0x28f4('0x15c')](_0x3a8a46);}}};Dialer[_0x28f4('0xad')]['syncCampaigns']=function(){var _0x4cc2b1=this;var _0x2494ac;for(var _0x3508aa in this[_0x28f4('0x1f')]){if(typeof this['campaigns'][_0x3508aa]!==_0x28f4('0x9e')){_0x2494ac=this[_0x28f4('0x1f')][_0x3508aa];if(isCampaignIvr(_0x2494ac[_0x28f4('0x57')])&&isActive(_0x2494ac['active'])){_0x2494ac[_0x28f4('0xa4')]=!![];BPromise[_0x28f4('0xba')]()['then'](checkIsActive(_0x2494ac,_0x2494ac[_0x28f4('0x79')]))['then'](checkInterval(_0x2494ac))[_0x28f4('0x3b')](_0x4cc2b1[_0x28f4('0x161')](_0x2494ac))['then'](_0x4cc2b1[_0x28f4('0x144')](_0x2494ac[_0x28f4('0x162')],_0x2494ac[_0x28f4('0x163')],_0x2494ac[_0x28f4('0x3f')],_0x2494ac))['then'](_0x4cc2b1[_0x28f4('0x164')](_0x2494ac[_0x28f4('0x43')],_0x2494ac[_0x28f4('0x163')],_0x2494ac['name'],_0x2494ac))[_0x28f4('0x3b')](_0x4cc2b1[_0x28f4('0x167')](_0x2494ac))['catch'](loggerCatchQueueSummary('[syncCampaigns]',_0x2494ac));}else{notSendMessagesCampaign(_0x2494ac);}}}};function getCallerIdRandom(_0x468e8c,_0x29650a){var _0x547cbd;var _0x1ed374;var _0x35542e;if(_0x29650a<=0x0){_0x29650a=0x1;}_0x547cbd=new RegExp(_0x28f4('0x168')+_0x29650a+'}$');_0x1ed374=Math['pow'](0xa,_0x29650a-0x1);_0x35542e=Math[_0x28f4('0x169')](0xa,_0x29650a)-0x1;return util[_0x28f4('0x7c')]('%s',_[_0x28f4('0x16a')](_0x468e8c,_0x547cbd,_[_0x28f4('0x16b')](_0x1ed374,_0x35542e)));}function extractCalleridName(_0x1cbfe4){var _0x53f31e=_0x1cbfe4['match'](/"(.*?)"/);return _0x53f31e?_0x53f31e[0x1]:_0x1cbfe4;}function extractCalleridNumber(_0x4f1a31){var _0x26c2ca=_0x4f1a31['match'](/<(.*?)>/);return _0x26c2ca?_0x26c2ca[0x1]:_0x4f1a31;}Dialer[_0x28f4('0xad')][_0x28f4('0x16c')]=function(_0x417271,_0x18a3ed){var _0x3aff74=this;var _0x15ab52=uuid['v4']();this[_0x28f4('0x126')][_0x15ab52]=new Action(_0x417271,_0x18a3ed,_0x15ab52);return new BPromise(function(_0x26d841,_0x363b02){if(_[_0x28f4('0x86')](_0x417271)&&typeof _0x417271!==_0x28f4('0x16d')){return _0x363b02(msgResponse('originate','Failure',_0x28f4('0x16e')));}if(_[_0x28f4('0x86')](_0x18a3ed[_0x28f4('0x16f')][_0x28f4('0x170')])||_0x18a3ed[_0x28f4('0x16f')][_0x28f4('0x170')]===null){return _0x363b02(msgResponse(_0x28f4('0x171'),'Failure',_0x28f4('0x172')));}var _0x5ceaf2={'XMD-CALLERID':_0x3aff74['actions'][_0x15ab52]['getCaller'](),'XMD-AGI':_0x417271['dialQueueProject']?util[_0x28f4('0x7c')](_0x28f4('0x173'),ipAgi,_0x417271[_0x28f4('0x174')]):_0x28f4('0x175'),'XMD-AGIAFTER':_0x417271[_0x28f4('0x119')]?util['format'](_0x28f4('0x173'),ipAgi,_0x417271[_0x28f4('0x119')]):_0x28f4('0x175'),'XMD-QUEUE':_0x417271[_0x28f4('0x57')]==='outbound'?util['format'](_0x28f4('0x176'),_0x417271[_0x28f4('0x3f')],_0x417271[_0x28f4('0x177')]||'',_0x417271[_0x28f4('0x178')]?'c':'',_0x417271[_0x28f4('0x114')]||0x3):_0x28f4('0x175'),'XMD-CONTACTID':_0x18a3ed['ContactId'],'XMD-CDRTYPE':_0x28f4('0x179'),'CALLERID(all)':_0x3aff74[_0x28f4('0x126')][_0x15ab52]['getCaller'](),'XMD-AMD':_0x417271[_0x28f4('0xdf')]?_0x28f4('0x17a'):'NONE','XMD-DESTINATION':'xcally-motion-dialer'};if(_0x417271['dialAMDActive']){_0x5ceaf2['XMD-AMDINITIALSILENCE']=_0x417271['dialAMDInitialSilence']||0x9c4;_0x5ceaf2['XMD-AMDGREETING']=_0x417271[_0x28f4('0x17b')]||0x5dc;_0x5ceaf2[_0x28f4('0x17c')]=_0x417271[_0x28f4('0x17d')]||0x320;_0x5ceaf2[_0x28f4('0x17e')]=_0x417271[_0x28f4('0x17f')]||0x1388;_0x5ceaf2['XMD-AMDMINWORDLENGTH']=_0x417271[_0x28f4('0x180')]||0x64;_0x5ceaf2[_0x28f4('0x181')]=_0x417271['dialAMDBetweenWordsSilence']||0x32;_0x5ceaf2[_0x28f4('0x182')]=_0x417271[_0x28f4('0x183')]||0x3;_0x5ceaf2[_0x28f4('0x184')]=_0x417271[_0x28f4('0x185')]||0x100;_0x5ceaf2[_0x28f4('0x186')]=_0x417271[_0x28f4('0x187')]||0x1388;}if(_0x417271[_0x28f4('0x57')]==='outbound'){_0x5ceaf2['XMD-VOICEQUEUEID']=_0x18a3ed[_0x28f4('0xd5')];}else{_0x5ceaf2['XMD-CAMPAIGNID']=_0x18a3ed[_0x28f4('0xd6')];}for(var _0x58d386 in _0x18a3ed[_0x28f4('0x16f')]){if(typeof _0x18a3ed[_0x28f4('0x16f')][_0x58d386]!==_0x28f4('0x9e')){if(isNotNull(_0x18a3ed[_0x28f4('0x16f')][_0x58d386])&&_0x58d386!=='id'&&_0x58d386!=='tags'&&_0x58d386!==_0x28f4('0x188')&&_0x58d386!==_0x28f4('0x189')){_0x5ceaf2[util[_0x28f4('0x7c')](_0x28f4('0x18a'),'XMD-',_[_0x28f4('0x18b')](_0x58d386))]=_0x18a3ed[_0x28f4('0x16f')][_0x58d386];}}}var _0x4d7fa1=_0x3aff74['isTrunkReachable'](_0x417271['Trunk'])?getCallerId(_0x417271[_0x28f4('0x78')][_0x28f4('0x18c')],_0x417271[_0x28f4('0x18d')],_0x417271['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x417271[_0x28f4('0x18e')],_0x417271['dialRandomLastDigitCallerIdNumber']):_0x417271[_0x28f4('0x18e')]):getCallerId(_['isNil'](_0x417271[_0x28f4('0x141')])?_0x417271[_0x28f4('0x78')]['callerid']:_0x417271[_0x28f4('0x141')][_0x28f4('0x18c')],_0x417271[_0x28f4('0x18d')],_0x417271[_0x28f4('0x18f')]>0x0?getCallerIdRandom(_0x417271['dialOriginateCallerIdNumber'],_0x417271['dialRandomLastDigitCallerIdNumber']):_0x417271[_0x28f4('0x18e')]);if(_0x4d7fa1){_0x5ceaf2[_0x28f4('0x190')]=_0x3aff74[_0x28f4('0x126')][_0x15ab52][_0x28f4('0x191')]=extractCalleridName(_0x4d7fa1);_0x5ceaf2[_0x28f4('0x192')]=_0x3aff74[_0x28f4('0x126')][_0x15ab52]['originatecalleridnum']=extractCalleridNumber(_0x4d7fa1);}return ami[_0x28f4('0xb1')]({'actionid':_0x15ab52,'action':_0x28f4('0x171'),'channel':_0x3aff74[_0x28f4('0x140')](_0x417271[_0x28f4('0x78')])?util[_0x28f4('0x7c')](_0x28f4('0x193'),_0x417271['Trunk'][_0x28f4('0x3f')],isNotNull(_0x417271[_0x28f4('0x5e')])?_0x417271['dialPrefix'][_0x28f4('0x194')]()||'':'',_0x417271['dialCutDigit']>0x0?_0x18a3ed[_0x28f4('0x16f')][_0x28f4('0x170')][_0x28f4('0x195')](_0x417271['dialCutDigit']):_0x18a3ed[_0x28f4('0x16f')][_0x28f4('0x170')]):util[_0x28f4('0x7c')](_0x28f4('0x193'),_[_0x28f4('0xb0')](_0x417271[_0x28f4('0x141')])?_0x417271[_0x28f4('0x78')]['name']:_0x417271['TrunkBackup'][_0x28f4('0x3f')],isNotNull(_0x417271[_0x28f4('0x5e')])?_0x417271[_0x28f4('0x5e')][_0x28f4('0x194')]()||'':'',_0x417271[_0x28f4('0x196')]>0x0?_0x18a3ed[_0x28f4('0x16f')][_0x28f4('0x170')][_0x28f4('0x195')](_0x417271[_0x28f4('0x196')]):_0x18a3ed[_0x28f4('0x16f')]['phone']),'callerid':_0x4d7fa1,'Exten':_0x28f4('0x197'),'Context':'from-sip','Priority':'1','variable':_0x5ceaf2,'timeout':(_0x417271[_0x28f4('0x198')]||0x1e)*0x3e8,'async':!![],'channelid':_0x15ab52})['then'](function(_0x44aa6e){return _0x26d841(_0x44aa6e);})[_0x28f4('0xb4')](function(_0x5baeb1){_0x417271[_0x28f4('0x66')]+=0x1;var _0xa9a056=new History(_0x3aff74['actions'][_0x15ab52]);logger[_0x28f4('0x9b')](util[_0x28f4('0x7c')](_0x28f4('0x199'),JSON[_0x28f4('0x7a')](_0x5baeb1)));_0xa9a056[_0x28f4('0xab')]=0xe;_0xa9a056[_0x28f4('0xac')]=_0x28f4('0x19a');_0xa9a056[_0x28f4('0x11d')]=moment()[_0x28f4('0x7c')](_0x28f4('0xfb'));_0xa9a056['endtime']=_0xa9a056[_0x28f4('0x11d')];_0x3aff74[_0x28f4('0xcb')](_0xa9a056)[_0x28f4('0xb4')](loggerCatch('[originate][error]'));_0x3aff74[_0x28f4('0xc9')](_0xa9a056)[_0x28f4('0xb4')](loggerCatch(_0x28f4('0x19b')))['finally'](function(){delete _0x3aff74[_0x28f4('0x126')][_0x15ab52];return _0x363b02(msgResponse(_0x28f4('0x171'),_0x28f4('0x49'),'originate\x20action\x20Error'));});});});};Dialer[_0x28f4('0xad')][_0x28f4('0x2c')]=function(_0x50586e){var _0x466863=this[_0x28f4('0x126')][_0x50586e[_0x28f4('0x127')]];if(_0x466863){delete this[_0x28f4('0x126')][_0x50586e[_0x28f4('0x127')]];_0x466863[_0x28f4('0x113')]=moment()[_0x28f4('0x7c')](_0x28f4('0xfb'));var _0x42b787=_0x466863[_0x28f4('0x57')]===_0x28f4('0x7f')?this[_0x28f4('0x1f')][_0x466863[_0x28f4('0xb8')]]:this[_0x28f4('0x1e')][_0x466863[_0x28f4('0x19c')]()];if(!this[_0x28f4('0xd9')](_0x50586e[_0x28f4('0x19d')])){this['updateOriginated'](_0x42b787);return this[_0x28f4('0x19e')](_0x466863,_0x42b787,_0x50586e)[_0x28f4('0xb4')](loggerCatch(_0x28f4('0x19f')));}this[_0x28f4('0x25')][_0x50586e[_0x28f4('0xe2')]]=_0x466863;}};Dialer[_0x28f4('0xad')][_0x28f4('0x1a0')]=function(_0x416ad9,_0x81891c,_0x5a0175){var _0x4e01d6=new History(_0x81891c);if(_0x4e01d6[_0x28f4('0x101')]+_0x4e01d6[_0x28f4('0xec')]+_0x4e01d6[_0x28f4('0xed')]+_0x4e01d6[_0x28f4('0xee')]+_0x4e01d6[_0x28f4('0x102')]+_0x4e01d6[_0x28f4('0xef')]+_0x4e01d6[_0x28f4('0xf0')]+_0x4e01d6['countagentrejectretry']>=_0x5a0175[_0x28f4('0xf2')]-0x1){return!![];}switch(_0x416ad9){case 0x3:if(_0x4e01d6[_0x28f4('0xed')]>=_0x5a0175[_0x28f4('0x1a1')]-0x1){return!![];}this[_0x28f4('0xc1')]({'active':![],'countnoanswerretry':_0x4e01d6[_0x28f4('0xed')]+=0x1,'scheduledat':moment()['add'](_0x5a0175[_0x28f4('0x1a2')],_0x28f4('0xfa'))['format'](_0x28f4('0xfb')),'ContactId':_0x4e01d6['ContactId'],'ListId':_0x4e01d6[_0x28f4('0xd3')],'VoiceQueueId':_0x4e01d6[_0x28f4('0xd5')]||undefined,'CampaignId':_0x4e01d6['CampaignId']||undefined})[_0x28f4('0xb4')](loggerCatch(_0x28f4('0x1a3')));break;case 0x5:if(_0x4e01d6['countbusyretry']>=_0x5a0175[_0x28f4('0x1a4')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countbusyretry':_0x4e01d6[_0x28f4('0x101')]+=0x1,'scheduledat':moment()[_0x28f4('0xf8')](_0x5a0175[_0x28f4('0x1a5')],'minutes')[_0x28f4('0x7c')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4e01d6[_0x28f4('0xd2')],'ListId':_0x4e01d6[_0x28f4('0xd3')],'VoiceQueueId':_0x4e01d6[_0x28f4('0xd5')]||undefined,'CampaignId':_0x4e01d6[_0x28f4('0xd6')]||undefined})[_0x28f4('0xb4')](loggerCatch(_0x28f4('0x1a6')));break;case 0x8:if(_0x4e01d6[_0x28f4('0xec')]>=_0x5a0175[_0x28f4('0x1a7')]-0x1){return!![];}this[_0x28f4('0xc1')]({'active':![],'countcongestionretry':_0x4e01d6['countcongestionretry']+=0x1,'scheduledat':moment()['add'](_0x5a0175[_0x28f4('0x1a8')],_0x28f4('0xfa'))[_0x28f4('0x7c')](_0x28f4('0xfb')),'ContactId':_0x4e01d6[_0x28f4('0xd2')],'ListId':_0x4e01d6[_0x28f4('0xd3')],'VoiceQueueId':_0x4e01d6[_0x28f4('0xd5')]||undefined,'CampaignId':_0x4e01d6[_0x28f4('0xd6')]||undefined})[_0x28f4('0xb4')](loggerCatch(_0x28f4('0x1a9')));break;case 0x0:if(_0x4e01d6['countnosuchnumberretry']>=_0x5a0175[_0x28f4('0x1aa')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countnosuchnumberretry':_0x4e01d6[_0x28f4('0xee')]+=0x1,'scheduledat':moment()[_0x28f4('0xf8')](_0x5a0175['dialNoSuchNumberRetryFrequency'],'minutes')['format'](_0x28f4('0xfb')),'ContactId':_0x4e01d6[_0x28f4('0xd2')],'ListId':_0x4e01d6[_0x28f4('0xd3')],'VoiceQueueId':_0x4e01d6['VoiceQueueId']||undefined,'CampaignId':_0x4e01d6[_0x28f4('0xd6')]||undefined})[_0x28f4('0xb4')](loggerCatch(_0x28f4('0x1ab')));}break;case 0xa:if(_0x4e01d6[_0x28f4('0x102')]>=_0x5a0175[_0x28f4('0x11a')]-0x1){return!![];}this[_0x28f4('0xc1')]({'active':![],'countdropretry':_0x4e01d6[_0x28f4('0x102')]+=0x1,'scheduledat':moment()[_0x28f4('0xf8')](_0x5a0175[_0x28f4('0x11b')],_0x28f4('0xfa'))[_0x28f4('0x7c')](_0x28f4('0xfb')),'ContactId':_0x4e01d6['ContactId'],'ListId':_0x4e01d6[_0x28f4('0xd3')],'VoiceQueueId':_0x4e01d6[_0x28f4('0xd5')]||undefined,'CampaignId':_0x4e01d6['CampaignId']||undefined})[_0x28f4('0xb4')](loggerCatch(_0x28f4('0x11c')));break;case 0xb:if(_0x4e01d6[_0x28f4('0xef')]>=_0x5a0175['dialAbandonedMaxRetry']-0x1){return!![];}this[_0x28f4('0xc1')]({'active':![],'countabandonedretry':_0x4e01d6[_0x28f4('0xef')]+=0x1,'scheduledat':moment()[_0x28f4('0xf8')](_0x5a0175[_0x28f4('0x123')],_0x28f4('0xfa'))[_0x28f4('0x7c')](_0x28f4('0xfb')),'ContactId':_0x4e01d6['ContactId'],'ListId':_0x4e01d6[_0x28f4('0xd3')],'VoiceQueueId':_0x4e01d6[_0x28f4('0xd5')]||undefined,'CampaignId':_0x4e01d6[_0x28f4('0xd6')]||undefined})[_0x28f4('0xb4')](loggerCatch(_0x28f4('0x1ac')));break;case 0x13:if(_0x4e01d6[_0x28f4('0xf0')]>=_0x5a0175[_0x28f4('0xf5')]-0x1){return!![];}this[_0x28f4('0xc1')]({'active':![],'countmachineretry':_0x4e01d6[_0x28f4('0xf0')]+=0x1,'scheduledat':moment()[_0x28f4('0xf8')](_0x5a0175[_0x28f4('0xf9')],_0x28f4('0xfa'))[_0x28f4('0x7c')](_0x28f4('0xfb')),'ContactId':_0x4e01d6[_0x28f4('0xd2')],'ListId':_0x4e01d6['ListId'],'VoiceQueueId':_0x4e01d6[_0x28f4('0xd5')]||undefined,'CampaignId':_0x4e01d6[_0x28f4('0xd6')]||undefined})[_0x28f4('0xb4')](loggerCatch(_0x28f4('0xfc')));break;case 0x14:if(_0x4e01d6[_0x28f4('0xf1')]>=_0x5a0175['dialAgentRejectMaxRetry']-0x1){return!![];}this['rescheduleContact']({'active':![],'countagentrejectretry':_0x4e01d6['countagentrejectretry']+=0x1,'scheduledat':moment()[_0x28f4('0xf8')](_0x5a0175[_0x28f4('0x1ad')],'minutes')[_0x28f4('0x7c')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4e01d6[_0x28f4('0xd2')],'ListId':_0x4e01d6[_0x28f4('0xd3')],'VoiceQueueId':_0x4e01d6[_0x28f4('0xd5')]||undefined,'CampaignId':_0x4e01d6['CampaignId']||undefined})[_0x28f4('0xb4')](loggerCatch(_0x28f4('0x1ae')));break;default:return!![];}};Dialer[_0x28f4('0xad')]['callProgressDetecting']=function(_0xb8894a,_0x5cc814,_0x428b0c){var _0x48bf50=this;var _0x57d106=new History(_0xb8894a);return new BPromise(function(_0xe6699e,_0x193357){if(_[_0x28f4('0x86')](_0x5cc814)&&typeof _0x5cc814!==_0x28f4('0x16d')){return _0x193357(msgResponse('[callProgressDetecting]','Failure',_0x28f4('0x1af')));}if(_['isUndefined'](_0x428b0c)&&typeof _0x428b0c!==_0x28f4('0x16d')){return _0x193357(msgResponse(_0x28f4('0x1b0'),_0x28f4('0x146'),_0x28f4('0x1b1')));}switch(_0x428b0c[_0x28f4('0x109')]){case'0':_0x5cc814[_0x28f4('0x65')]+=0x1;_0x57d106[_0x28f4('0xab')]=0x0;_0x57d106[_0x28f4('0xac')]=_0x28f4('0x1b2');_0x57d106[_0x28f4('0xee')]+=0x1;_0x57d106[_0x28f4('0x100')]+=0x1;ami['emit'](_0x28f4('0x1b3'),ut['buildObj'](_0xb8894a,_0x28f4('0x1b4')));_0x48bf50['createHistory'](_0x57d106)[_0x28f4('0xb4')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x48bf50[_0x28f4('0x1a0')](0x0,_0xb8894a,_0x5cc814)){if(_0x57d106[_0x28f4('0xee')]>=_0x5cc814['dialNoSuchNumberMaxRetry']){_0x48bf50[_0x28f4('0xf6')](_0x57d106,_0xe6699e,_0x193357,_0x28f4('0x1b5'));}else{_0x48bf50[_0x28f4('0xf3')](_0x57d106,_0xe6699e,_0x193357,_0x28f4('0x1b5'));}}break;case'3':_0x5cc814[_0x28f4('0x1b6')]+=0x1;_0x57d106[_0x28f4('0xab')]=0x3;_0x57d106[_0x28f4('0xac')]=_0x28f4('0x1b7');_0x57d106[_0x28f4('0xed')]+=0x1;_0x57d106[_0x28f4('0x100')]+=0x1;ami[_0x28f4('0x4d')](_0x28f4('0x1b8'),ut[_0x28f4('0xe7')](_0xb8894a,_0x28f4('0x1b9')));_0x48bf50[_0x28f4('0xcb')](_0x57d106)['catch'](loggerCatch(_0x28f4('0x1ba')));if(_0x48bf50[_0x28f4('0x1a0')](0x3,_0xb8894a,_0x5cc814)){if(_0x57d106[_0x28f4('0xed')]>=_0x5cc814[_0x28f4('0x1a1')]){_0x48bf50[_0x28f4('0xf6')](_0x57d106,_0xe6699e,_0x193357,_0x28f4('0x1bb'));}else{_0x48bf50['stateGlobal'](_0x57d106,_0xe6699e,_0x193357,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0x5cc814[_0x28f4('0x61')]+=0x1;_0x57d106[_0x28f4('0xab')]=0x5;_0x57d106[_0x28f4('0xac')]=_0x28f4('0x1bc');_0x57d106[_0x28f4('0x101')]+=0x1;_0x57d106['countglobal']+=0x1;ami[_0x28f4('0x4d')](_0x28f4('0x1bd'),ut[_0x28f4('0xe7')](_0xb8894a,'busy'));_0x48bf50[_0x28f4('0xcb')](_0x57d106)['catch'](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0x48bf50[_0x28f4('0x1a0')](0x5,_0xb8894a,_0x5cc814)){if(_0x57d106[_0x28f4('0x101')]>=_0x5cc814[_0x28f4('0x1a4')]){_0x48bf50['createStateFinal'](_0x57d106,_0xe6699e,_0x193357,_0x28f4('0x1be'));}else{_0x48bf50[_0x28f4('0xf3')](_0x57d106,_0xe6699e,_0x193357,_0x28f4('0x1be'));}}break;case'8':_0x5cc814[_0x28f4('0x62')]+=0x1;_0x57d106[_0x28f4('0xab')]=0x8;_0x57d106['statedesc']=_0x28f4('0x1bf');_0x57d106[_0x28f4('0xec')]+=0x1;_0x57d106[_0x28f4('0x100')]+=0x1;ami[_0x28f4('0x4d')](_0x28f4('0x1c0'),ut['buildObj'](_0xb8894a,_0x28f4('0x1c1')));_0x48bf50[_0x28f4('0xcb')](_0x57d106)['catch'](loggerCatch(_0x28f4('0x1c2')));if(_0x48bf50[_0x28f4('0x1a0')](0x8,_0xb8894a,_0x5cc814)){if(_0x57d106[_0x28f4('0xec')]>=_0x5cc814[_0x28f4('0x1a7')]){_0x48bf50[_0x28f4('0xf6')](_0x57d106,_0xe6699e,_0x193357,'reason\x208\x20congestion');}else{_0x48bf50['stateGlobal'](_0x57d106,_0xe6699e,_0x193357,_0x28f4('0x1c3'));}}break;case'11':_0x5cc814[_0x28f4('0x1c4')]+=0x1;_0x57d106[_0x28f4('0xab')]=0xb;_0x57d106[_0x28f4('0xac')]=_0x28f4('0x1c5');_0x57d106['countabandonedretry']+=0x1;_0x57d106[_0x28f4('0x100')]+=0x1;_0x48bf50['createHistory'](_0x57d106)[_0x28f4('0xb4')](loggerCatch(_0x28f4('0x124')));if(_0x48bf50[_0x28f4('0x1a0')](0xb,_0xb8894a,_0x5cc814)){if(_0x57d106[_0x28f4('0xef')]>=_0x5cc814[_0x28f4('0x122')]){_0x48bf50['createStateFinal'](_0x57d106,_0xe6699e,_0x193357,_0x28f4('0x1c6'));}else{_0x48bf50[_0x28f4('0xf3')](_0x57d106,_0xe6699e,_0x193357,'reason\x2011\x20abandoned');}}break;case'20':_0x5cc814[_0x28f4('0x68')]+=0x1;_0x57d106[_0x28f4('0xab')]=0x14;_0x57d106[_0x28f4('0xac')]=_0x28f4('0x1c7');_0x57d106[_0x28f4('0xf1')]+=0x1;_0x57d106['countglobal']+=0x1;ami['emit'](_0x28f4('0x1c8'),ut[_0x28f4('0xe7')](_0xb8894a,'agentreject'));_0x48bf50[_0x28f4('0xcb')](_0x57d106)[_0x28f4('0xb4')](loggerCatch(_0x28f4('0x1c9')));if(_0x48bf50['checkRetriveMax'](0x14,_0xb8894a,_0x5cc814)){if(_0x57d106['countagentrejectretry']>=_0x5cc814[_0x28f4('0x1ca')]){_0x48bf50[_0x28f4('0xf6')](_0x57d106,_0xe6699e,_0x193357,_0x28f4('0x1cb'));}else{_0x48bf50[_0x28f4('0xf3')](_0x57d106,_0xe6699e,_0x193357,_0x28f4('0x1cb'));}}break;default:_0x5cc814['outboundUnknownCallsDay']+=0x1;_0x57d106['state']=0xc;_0x57d106[_0x28f4('0xac')]=_0x428b0c[_0x28f4('0x109')];_0x48bf50[_0x28f4('0xcb')](_0x57d106)[_0x28f4('0xb4')](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x48bf50[_0x28f4('0x1a0')](_0x428b0c[_0x28f4('0x109')],_0xb8894a,_0x5cc814)){if(_0x57d106[_0x28f4('0x101')]+_0x57d106['countcongestionretry']+_0x57d106[_0x28f4('0xed')]+_0x57d106[_0x28f4('0xee')]+_0x57d106[_0x28f4('0x102')]+_0x57d106[_0x28f4('0xef')]+_0x57d106['countmachineretry']+_0x57d106[_0x28f4('0xf1')]>=_0x5cc814[_0x28f4('0xf2')]){_0x48bf50[_0x28f4('0xf3')](_0x57d106,_0xe6699e,_0x193357,_0x428b0c[_0x28f4('0x109')]);}else{_0x48bf50[_0x28f4('0xf6')](_0x57d106,_0xe6699e,_0x193357,_0x428b0c[_0x28f4('0x109')]);}}}});};Dialer[_0x28f4('0xad')][_0x28f4('0xf3')]=function(_0x297a6a,_0x5c7d9f,_0x30914c,_0x45e305){var _0x390830=new Final(_0x297a6a);_0x390830[_0x28f4('0xab')]=0xf;_0x390830[_0x28f4('0xac')]=_0x28f4('0x1cc');this[_0x28f4('0xf6')](_0x390830,_0x5c7d9f,_0x30914c,_0x45e305);};Dialer[_0x28f4('0xad')][_0x28f4('0xf6')]=function(_0x4a2bfb,_0x117c7f,_0x19741f,_0x28b67d){this[_0x28f4('0xc9')](_0x4a2bfb)[_0x28f4('0x3b')](function(){return _0x117c7f(msgResponse('[callProgressDetecting]',_0x28f4('0xda'),_0x28b67d));})['catch'](function(){return _0x19741f(msgResponse(_0x28f4('0x1cd'),_0x28f4('0x146'),_0x28f4('0x1ce')));});};Dialer[_0x28f4('0xad')][_0x28f4('0x8')]=function(_0x374a1e){var _0x141a37=_0x374a1e[_0x28f4('0x1cf')]/0x64;var _0x2a1369=_0x374a1e[_0x28f4('0x115')]/(_0x374a1e['outboundDropCallsDayTimeout']+_0x374a1e['outboundAnswerCallsDay']);var _0x512d46=Math[_0x28f4('0x1d0')](_0x374a1e[_0x28f4('0x73')]*(_0x374a1e[_0x28f4('0x1d1')]/0x64));var _0x145672=Math[_0x28f4('0x1d0')](_0x374a1e[_0x28f4('0x73')]*(_0x374a1e[_0x28f4('0x1d2')]/0x64));var _0x1216c4=_0x374a1e[_0x28f4('0x50')]+_0x374a1e[_0x28f4('0x55')];var _0x84bfa7=Math['floor'](_0x374a1e['erlangCalls']*_0x374a1e[_0x28f4('0x77')]*_0x374a1e[_0x28f4('0x70')]*_0x374a1e[_0x28f4('0x71')]);if(_[_0x28f4('0x86')](_0x374a1e['startProgressive'])){if(!_['isUndefined'](_0x374a1e['startPredictive'])){_0x374a1e[_0x28f4('0x26')]=undefined;loggerPredictive[_0x28f4('0x9b')](_0x28f4('0x1d3'),'check\x20predictive\x20is\x20not\x20undefine');}if(!_[_0x28f4('0x86')](_0x374a1e['handlePredictive'])){loggerPredictive[_0x28f4('0x9b')](_0x28f4('0x1d3'),_0x28f4('0x1d4'));clearInterval(_0x374a1e[_0x28f4('0x97')]);_0x374a1e[_0x28f4('0x97')]=undefined;}_0x374a1e[_0x28f4('0x94')]=moment()[_0x28f4('0x7c')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive['info'](_0x374a1e[_0x28f4('0x3f')],_0x28f4('0x1d5'),_0x374a1e[_0x28f4('0x94')]);this[_0x28f4('0x158')](_0x374a1e,0x1);}else if(ifInterval(_0x374a1e[_0x28f4('0x1d6')],_0x374a1e['startProgressive'])){this['handlePower'](_0x374a1e,0x1);loggerPredictiveCalls['info']('[startMethodPredictive][StartProgressive][Loop]',_0x374a1e[_0x28f4('0x94')],_0x374a1e[_0x28f4('0x3f')]);_0x374a1e[_0x28f4('0x76')]=0x0;_0x374a1e[_0x28f4('0x6f')]=0x0;}else if(_0x141a37<_0x2a1369&&_0x374a1e[_0x28f4('0x1d7')]==='dropRate'){freeVariablesPredictive(_0x374a1e);loggerPredictive[_0x28f4('0x81')](_0x28f4('0x1d8'),_0x28f4('0x1d9'),_0x2a1369,'startProgressive',_0x374a1e['name']);}else if(_0x84bfa7<_0x374a1e[_0x28f4('0x6f')]&&_0x374a1e[_0x28f4('0x1d7')]===_0x28f4('0x1da')){freeVariablesPredictive(_0x374a1e);loggerPredictive[_0x28f4('0x81')](_0x28f4('0x1db'),_0x28f4('0x1dc'),_0x84bfa7,_0x28f4('0x1dd'),_0x374a1e[_0x28f4('0x6f')],_0x28f4('0x94'),_0x374a1e['name']);}else if(!ifInterval(_0x374a1e[_0x28f4('0x1d6')],_0x374a1e['startProgressive'])&&_[_0x28f4('0x86')](_0x374a1e[_0x28f4('0x26')])&&!_[_0x28f4('0x86')](_0x374a1e['startProgressive'])){_0x374a1e[_0x28f4('0x26')]=moment()[_0x28f4('0x7c')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x28f4('0x81')](_0x374a1e[_0x28f4('0x3f')],_0x28f4('0x1de'),_0x374a1e[_0x28f4('0x26')]);this[_0x28f4('0xbe')](_0x374a1e[_0x28f4('0x1d6')])[_0x28f4('0x3b')](this['getDataPredictive'](_0x374a1e))['then'](mergeDataErlangB(_0x374a1e))[_0x28f4('0x3b')](this[_0x28f4('0x1df')](_0x374a1e))[_0x28f4('0xb4')](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0x374a1e));}else if(!ifInterval(_0x374a1e[_0x28f4('0x1d6')],_0x374a1e[_0x28f4('0x26')])){_0x374a1e['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x374a1e[_0x28f4('0x26')]=moment()[_0x28f4('0x7c')](_0x28f4('0xfb'));loggerPredictive[_0x28f4('0x81')](_0x374a1e[_0x28f4('0x3f')],'recalculate\x20predictive\x20at',_0x374a1e[_0x28f4('0x26')]);clearInterval(_0x374a1e[_0x28f4('0x97')]);_0x374a1e['handlePredictive']=undefined;this[_0x28f4('0xbe')](_0x374a1e['dialPredictiveInterval'])['then'](this[_0x28f4('0x1e0')](_0x374a1e))[_0x28f4('0x3b')](mergeDataErlangB(_0x374a1e))[_0x28f4('0x3b')](this['startMethodPredictive'](_0x374a1e))[_0x28f4('0xb4')](loggerCatchPredictive(_0x28f4('0x1e1'),_0x374a1e));}else if(_0x374a1e['predictiveIntervalAvailable']&&_0x1216c4<_0x374a1e[_0x28f4('0x73')]-_0x145672){freeVariablesPredictive(_0x374a1e);loggerPredictive[_0x28f4('0x81')](_0x374a1e[_0x28f4('0x3f')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x1216c4,_0x28f4('0x1e2'),_0x374a1e[_0x28f4('0x73')],'-',_0x145672,'=',_0x374a1e[_0x28f4('0x73')]-_0x145672,')');}else if(_0x374a1e[_0x28f4('0x73')]&&_0x1216c4>_0x374a1e['predictiveIntervalAvailable']+_0x512d46){freeVariablesPredictive(_0x374a1e);loggerPredictive[_0x28f4('0x81')](_0x374a1e[_0x28f4('0x3f')],_0x28f4('0x1e3'),_0x1216c4,')\x20are\x20more\x20than\x20threshold\x20(',_0x374a1e[_0x28f4('0x73')],'+',_0x512d46,'=',_0x374a1e[_0x28f4('0x73')]+_0x512d46,')');}};Dialer[_0x28f4('0xad')][_0x28f4('0x1e0')]=function(_0x4b2a3e){var _0x261d3d=this;return function(_0x37b36e){return new BPromise(function(_0x3cfcc1,_0x550c47){_['merge'](_0x4b2a3e,_0x37b36e[0x0]);if(checkGetDataPredictive(_0x37b36e[0x0])){var _0xd8517d=_0x4b2a3e[_0x28f4('0x73')]=_0x4b2a3e['talking']+_0x4b2a3e[_0x28f4('0x50')];var _0x3eae9f=_0x4b2a3e[_0x28f4('0x1d6')]*0x3c;var _0x8aace2=_0x37b36e[0x0][_0x28f4('0x6b')]+_0x37b36e[0x0][_0x28f4('0x6a')];var _0x53ef5b=(_0x37b36e[0x0][_0x28f4('0x69')]+_0x37b36e[0x0][_0x28f4('0x6d')]+_0x37b36e[0x0][_0x28f4('0x6c')])/_0x37b36e[0x0][_0x28f4('0x74')];_0x4b2a3e['predictiveIntervalHitRate']=_0x53ef5b>0x0?_0x53ef5b:0x1;switch(_0x4b2a3e[_0x28f4('0x1d7')]){case _0x28f4('0x1da'):var _0x1612c4=_0x4b2a3e['dialPredictiveOptimizationPercentage']/0x64;return _0x261d3d['abandonmentRate'](_0xd8517d,_0x3eae9f,_0x8aace2,_0x53ef5b,_0x1612c4)['then'](function(_0x5dd57b){return _0x3cfcc1(_0x5dd57b);});case _0x28f4('0x1e4'):var _0x5f4213=_0x4b2a3e[_0x28f4('0x1cf')]/0x64;return _0x261d3d[_0x28f4('0x1e5')](_0xd8517d,_0x3eae9f,_0x8aace2,_0x53ef5b,_0x5f4213)[_0x28f4('0x3b')](function(_0x55830e){return _0x3cfcc1(_0x55830e);});default:return _0x550c47(msgResponse(_0x28f4('0x1e6'),'Failure',_0x28f4('0x1e7')));}}else{return _0x550c47(msgResponse(_0x28f4('0x1e6'),'Failure',_0x28f4('0x1e8')));}});};};Dialer['prototype'][_0x28f4('0x1e9')]=function(_0x5b5e49){var _0x23784a=this;return function(_0x16103a){return new BPromise(function(_0xe236b4,_0x571924){_[_0x28f4('0x93')](_0x5b5e49,_0x16103a[0x0]);if(checkGetDataPredictive(_0x16103a[0x0])){loggerPredictive[_0x28f4('0x81')](JSON[_0x28f4('0x7a')](_0x16103a[0x0]));if(_0x5b5e49[_0x28f4('0x1d7')]===_0x28f4('0x1da')){return _0x23784a[_0x28f4('0xc7')](_0x5b5e49['id'])[_0x28f4('0x3b')](function(_0x362a8f){var _0x36d541=_0x5b5e49[_0x28f4('0x51')]-_0x362a8f[0x0]['outboundQueuePauses'];var _0x3241cf=_0x5b5e49['dialPredictiveInterval']*0x3c;var _0x5238f2=_0x16103a[0x0]['predictiveIntervalAvgTalktime']+_0x16103a[0x0][_0x28f4('0x6a')];var _0x55e051=(_0x16103a[0x0][_0x28f4('0x69')]+_0x16103a[0x0][_0x28f4('0x6d')]+_0x16103a[0x0][_0x28f4('0x6c')])/_0x16103a[0x0][_0x28f4('0x74')];var _0x567eb3=_0x5b5e49['dialPredictiveOptimizationPercentage']/0x64;_0x5b5e49[_0x28f4('0x72')]=_0x362a8f[0x0]['outboundQueuePauses']||0x0;_0x5b5e49[_0x28f4('0x70')]=_0x55e051>0x0?_0x55e051:0x1;return _0x23784a['abandonmentRate'](_0x36d541,_0x3241cf,_0x5238f2,_0x55e051,_0x567eb3);})[_0x28f4('0x3b')](function(_0x1cf071){return _0xe236b4(_0x1cf071);})[_0x28f4('0xb4')](function(_0x1f477a){return _0x571924(msgResponse('[CatchErlangB]','Failure',JSON[_0x28f4('0x7a')](_0x1f477a)));});}if(_0x5b5e49[_0x28f4('0x1d7')]===_0x28f4('0x1e4')){return _0x23784a['getVoiceQueueRtPauses'](_0x5b5e49['id'])[_0x28f4('0x3b')](function(_0x24f109){var _0x29cc61=_0x5b5e49[_0x28f4('0x51')]-_0x24f109[0x0][_0x28f4('0x1ea')];var _0x2f5df2=_0x5b5e49[_0x28f4('0x1d6')]*0x3c;var _0x40d052=_0x16103a[0x0][_0x28f4('0x6b')]+_0x16103a[0x0][_0x28f4('0x6a')];var _0xd72c5a=(_0x16103a[0x0]['predictiveIntervalAnsweredCalls']+_0x16103a[0x0][_0x28f4('0x6d')]+_0x16103a[0x0][_0x28f4('0x6c')])/_0x16103a[0x0][_0x28f4('0x74')];var _0x3493fc=_0x5b5e49[_0x28f4('0x1cf')]/0x64;_0x5b5e49[_0x28f4('0x72')]=_0x24f109[0x0]['outboundQueuePauses']||0x0;_0x5b5e49['predictiveIntervalHitRate']=_0xd72c5a>0x0?_0xd72c5a:0x1;return _0x23784a['busyFactor'](_0x29cc61,_0x2f5df2,_0x40d052,_0xd72c5a,_0x3493fc);})[_0x28f4('0x3b')](function(_0x55d8ca){return _0xe236b4(_0x55d8ca);})['catch'](function(_0x160874){return _0x571924(msgResponse(_0x28f4('0x1eb'),'Failure',JSON[_0x28f4('0x7a')](_0x160874)));});}}else{return _0x571924(msgResponse(_0x28f4('0x1e6'),_0x28f4('0x146'),_0x28f4('0x1e8')));}});};};Dialer[_0x28f4('0xad')]['startMethodPredictive']=function(_0x3b5ef3){var _0x1adf97=this;return function(){var _0x537f28=0x0;var _0x33623f=Math[_0x28f4('0x1ec')](_0x3b5ef3[_0x28f4('0x8e')]*0x3e8);if(_0x33623f>0x0){_0x33623f=_0x33623f<0x64?0x64:_0x33623f;loggerPredictive[_0x28f4('0x81')](_0x3b5ef3[_0x28f4('0x3f')],_0x28f4('0x1ed'),_0x33623f,_0x28f4('0x4a'));_0x3b5ef3[_0x28f4('0x97')]=setInterval(function(){_0x1adf97[_0x28f4('0x97')](_0x3b5ef3);loggerPredictiveCalls[_0x28f4('0x81')](_0x28f4('0x1ee'),_0x537f28+=0x1);},_0x33623f);}else{loggerPredictive['info'](_0x3b5ef3[_0x28f4('0x3f')],'fail\x20to\x20scheduled\x20calls');}};};Dialer[_0x28f4('0xad')][_0x28f4('0x1ef')]=function(_0x21c834,_0x593ed0){var _0x3260a0=this;return function(_0x55f705){if(_['isEmpty'](_0x55f705)){if(_[_0x28f4('0xb0')](_0x593ed0[_0x28f4('0xd4')])||!_0x593ed0[_0x28f4('0x1f0')]){if(_0x21c834[_0x28f4('0x5d')]===_0x28f4('0x7')){_0x21c834['queueStatusComplete']=_[_0x28f4('0x86')](_0x21c834['queueStatusComplete'])?!![]:_0x21c834[_0x28f4('0x12f')];var _0x558ea7=uuid['v4']();_0x3260a0[_0x28f4('0x126')][_0x558ea7]=new Action(_0x21c834,_0x593ed0,_0x558ea7);loggerBooked[_0x28f4('0x81')]('[booked][checkContactBlack]',_0x558ea7,'queueStatusComplete:\x20',JSON[_0x28f4('0x7a')](_0x21c834[_0x28f4('0x12f')]),_0x28f4('0x1f1'),_0x21c834[_0x28f4('0x3f')]);if(_0x21c834[_0x28f4('0x12f')]){_0x21c834[_0x28f4('0x12f')]=![];_0x3260a0[_0x28f4('0x27')][_0x3260a0['actions'][_0x558ea7][_0x28f4('0xb8')]]=[];ami[_0x28f4('0xb1')]({'actionid':_0x558ea7,'action':_0x28f4('0x1f2'),'queue':_0x21c834[_0x28f4('0x3f')]})['catch'](function(){_0x3260a0[_0x28f4('0xb6')](_0x21c834);_0x3260a0[_0x28f4('0xc1')]({'active':![],'ContactId':_0x3260a0[_0x28f4('0x126')][_0x558ea7]['ContactId'],'ListId':_0x3260a0[_0x28f4('0x126')][_0x558ea7]['ListId'],'VoiceQueueId':_0x3260a0[_0x28f4('0x126')][_0x558ea7][_0x28f4('0xd5')]||undefined,'CampaignId':_0x3260a0['actions'][_0x558ea7]['CampaignId']||undefined})[_0x28f4('0xb4')](loggerCatch(_0x28f4('0x1f3')));delete _0x3260a0[_0x28f4('0x126')][_0x558ea7];});}else{loggerBooked['info'](_0x28f4('0x1f4'),JSON[_0x28f4('0x7a')](_0x21c834[_0x28f4('0x12f')]),_0x28f4('0x1f1'),_0x21c834['name']);_0x3260a0[_0x28f4('0xb6')](_0x21c834);_0x3260a0['rescheduleContact']({'active':![],'ContactId':_0x3260a0[_0x28f4('0x126')][_0x558ea7][_0x28f4('0xd2')],'ListId':_0x3260a0[_0x28f4('0x126')][_0x558ea7][_0x28f4('0xd3')],'VoiceQueueId':_0x3260a0['actions'][_0x558ea7][_0x28f4('0xd5')]||undefined,'CampaignId':_0x3260a0[_0x28f4('0x126')][_0x558ea7]['CampaignId']||undefined})['catch'](loggerCatch(_0x28f4('0x1f3')));delete _0x3260a0[_0x28f4('0x126')][_0x558ea7];}}else{return _0x3260a0[_0x28f4('0x16c')](_0x21c834,_0x593ed0);}}else{if(getDiff(_0x593ed0[_0x28f4('0x1f5')])<_0x21c834[_0x28f4('0x1f6')]*0x3c){if(_0x593ed0[_0x28f4('0x1f7')]&&!_0x593ed0[_0x28f4('0x1f7')][_0x28f4('0x1f8')]){_0x3260a0[_0x28f4('0x1d')][_0x28f4('0x139')](_0x593ed0['id'])['finally'](function(){_0x3260a0[_0x28f4('0xb6')](_0x21c834);});}else{_0x3260a0[_0x28f4('0xc2')]({'active':![]},_0x593ed0['id'],0x1)['finally'](function(){_0x3260a0[_0x28f4('0xb6')](_0x21c834);});}}else{_0x21c834[_0x28f4('0x67')]+=0x1;_0x3260a0[_0x28f4('0xb6')](_0x21c834);if(_0x21c834['dialRecallInQueue']){_0x3260a0['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x593ed0['ContactId'],'ListId':_0x593ed0['ListId'],'VoiceQueueId':_0x593ed0[_0x28f4('0xd5')]||undefined,'CampaignId':_0x593ed0[_0x28f4('0xd6')]||undefined})[_0x28f4('0xb4')](loggerCatch(_0x28f4('0x1f9')));_0x3260a0[_0x28f4('0xcb')](createObjHistory(_0x21c834,_0x593ed0,_0x28f4('0x1fa'),0x17,_0x28f4('0x1fb')))[_0x28f4('0xb4')](loggerCatch(_0x28f4('0x1fc')));}else{_0x3260a0['saveInDb'](createObjHistory(_0x21c834,_0x593ed0,_0x28f4('0x1fd'),0x16,_0x28f4('0x1fe')),_0x28f4('0x1ff'),_0x28f4('0x200'));}}}}else{_0x21c834['outboundBlacklistCallsDay']+=0x1;_0x3260a0['saveInDb'](createObjHistory(_0x21c834,_0x593ed0,'BLACKLIST',0xd,_0x28f4('0x201')),_0x28f4('0x202'),_0x28f4('0x203'));throw _0x28f4('0x204');}};};Dialer['prototype'][_0x28f4('0x160')]=function(_0x51eccb){var _0x525e0f=this;var _0x5404c6=_0x51eccb[_0x28f4('0x205')]-_0x51eccb['originated']-_0x51eccb[_0x28f4('0xc3')];emitCampaignSummary(_0x51eccb);if(_0x5404c6>0x0){if(_0x5404c6>this['maxNumberOriginate']){_0x5404c6=this[_0x28f4('0x22')];}_0x51eccb['temp']+=_0x5404c6;this['getContactDialerIvr'](_0x51eccb['id'],_0x5404c6,_0x51eccb[_0x28f4('0x206')],_0x51eccb)['then'](function(_0x39b403){_0x51eccb[_0x28f4('0xc3')]-=_0x5404c6;_0x51eccb[_0x28f4('0xc3')]=_0x51eccb['temp']>0x0?_0x51eccb[_0x28f4('0xc3')]:0x0;if(!checkContactEmpty(_0x39b403)){_0x51eccb['message']=_0x28f4('0x207');logger[_0x28f4('0x81')](_0x28f4('0x208')+_0x51eccb[_0x28f4('0x3f')]);}else{_0x51eccb[_0x28f4('0x75')]+=_0x39b403[_0x28f4('0x9d')];_0x51eccb['message']=_0x28f4('0x209');for(var _0x23437d=0x0;_0x23437d<_0x39b403[_0x28f4('0x9d')];_0x23437d+=0x1){_0x51eccb['ivrTotalCallsDays']+=0x1;if(_[_0x28f4('0xb0')](_0x39b403[_0x23437d])||_[_0x28f4('0xb0')](_0x39b403[_0x23437d][_0x28f4('0x16f')])||_[_0x28f4('0xb0')](_0x39b403[_0x23437d][_0x28f4('0x16f')]['phone'])){_0x525e0f[_0x28f4('0xd0')](_0x28f4('0x20a'),_0x51eccb,_0x39b403[_0x23437d]);}else{_0x525e0f['checkIsBlackListIvr'](_[_0x28f4('0x12e')](_0x39b403[_0x23437d],['CampaignId',_0x28f4('0x20b')]))[_0x28f4('0x3b')](_0x525e0f['checkContactBlack'](_0x51eccb,_0x39b403[_0x23437d]))[_0x28f4('0xb4')](_0x525e0f[_0x28f4('0xcf')](_0x28f4('0x20c'),_0x51eccb));}}}})['catch'](loggerGetContactDialer(_0x28f4('0x20d'),_0x51eccb,_0x5404c6));}};Dialer[_0x28f4('0xad')][_0x28f4('0x158')]=function(_0x2dd682,_0x4984d1){var _0x66be22=this;var _0x3e80ba=[];var _0x46ef1b=_0x4984d1>=0x1?_0x4984d1:0x1;if(_0x2dd682['dialMethod']===_0x28f4('0x7')){_0x46ef1b=0x1;}var _0x4d1cc3=Math[_0x28f4('0x1ec')](_0x2dd682[_0x28f4('0x50')]*_0x46ef1b)-_0x2dd682['originated']-_0x2dd682[_0x28f4('0xc3')];emitVoiceQueueSummary(_0x2dd682);if(_0x2dd682[_0x28f4('0x20e')]>0x0){var _0x1b9a2e=_0x2dd682[_0x28f4('0x20e')]-_0x2dd682['originated']-_0x2dd682['talking']-_0x2dd682['temp']-_0x2dd682['pTalking'];if(_0x4d1cc3>_0x1b9a2e){_0x4d1cc3=_0x1b9a2e;}}if(_0x4d1cc3>0x0){if(_0x2dd682[_0x28f4('0x5d')]==='booked'){_0x4d1cc3=0x1;}if(_0x4d1cc3>this[_0x28f4('0x22')]){_0x4d1cc3=this[_0x28f4('0x22')];}_0x2dd682['temp']+=_0x4d1cc3;for(var _0x2ea1d9 in this['agents']){if(typeof this['agents'][_0x2ea1d9]!=='undefined'){if(this[_0x28f4('0x20')][_0x2ea1d9][_0x28f4('0xab')]==='not_inuse'&&this[_0x28f4('0x20')][_0x2ea1d9][_0x28f4('0xb2')]===_0x28f4('0xdb')){_0x3e80ba[_0x28f4('0x12d')](this[_0x28f4('0x20')][_0x2ea1d9]['id']);}}}this[_0x28f4('0x20f')](_0x2dd682['id'],_0x3e80ba,_0x4d1cc3,_0x2dd682[_0x28f4('0x206')],_0x2dd682)[_0x28f4('0x3b')](function(_0x69e2e1){_0x2dd682[_0x28f4('0xc3')]-=_0x4d1cc3;_0x2dd682['temp']=_0x2dd682[_0x28f4('0xc3')]>0x0?_0x2dd682[_0x28f4('0xc3')]:0x0;if(!checkContactEmpty(_0x69e2e1)){_0x66be22[_0x28f4('0xb9')](_0x2dd682)['then'](sendMessageReschedule(_0x2dd682))[_0x28f4('0xb4')](loggerCatch(_0x28f4('0x210')));}else{_0x2dd682[_0x28f4('0x75')]+=_0x69e2e1[_0x28f4('0x9d')];_0x2dd682['message']=_0x2dd682[_0x28f4('0x5d')]===_0x28f4('0x7')?_0x28f4('0x17a'):_0x28f4('0x209');for(var _0x22d3f1=0x0;_0x22d3f1<_0x69e2e1[_0x28f4('0x9d')];_0x22d3f1+=0x1){if(_[_0x28f4('0xb0')](_0x69e2e1[_0x22d3f1])||_['isNil'](_0x69e2e1[_0x22d3f1][_0x28f4('0x16f')])||_[_0x28f4('0xb0')](_0x69e2e1[_0x22d3f1][_0x28f4('0x16f')][_0x28f4('0x170')])){_0x66be22[_0x28f4('0xd0')](_0x28f4('0x20a'),_0x2dd682,_0x69e2e1[_0x22d3f1]);}else{_0x66be22[_0x28f4('0xbb')](_[_0x28f4('0x12e')](_0x69e2e1[_0x22d3f1],[_0x28f4('0xd5'),'Contact.phone']))[_0x28f4('0x3b')](_0x66be22['checkContactBlack'](_0x2dd682,_0x69e2e1[_0x22d3f1]))[_0x28f4('0xb4')](_0x66be22[_0x28f4('0xcf')](_0x28f4('0x20a'),_0x2dd682));}}}})[_0x28f4('0xb4')](loggerGetContactDialer(_0x28f4('0x211'),_0x2dd682,_0x4d1cc3));}};Dialer['prototype']['handlePredictive']=function(_0x436dca){if(_0x436dca[_0x28f4('0x20e')]>0x0){var _0x5c5fe8=_0x436dca[_0x28f4('0x20e')]-_0x436dca['originated']-_0x436dca['talking'];if(_0x5c5fe8>0x0){this[_0x28f4('0x212')](_0x436dca);}else{loggerPredictiveCalls[_0x28f4('0x81')](_0x28f4('0x213'));}}else{this[_0x28f4('0x212')](_0x436dca);}};Dialer[_0x28f4('0xad')][_0x28f4('0x212')]=function(_0xa68efd){var _0x13ed40=this;var _0x1ffe32=[];_0xa68efd[_0x28f4('0x75')]+=0x1;for(var _0x24642a in this[_0x28f4('0x20')]){if(typeof this[_0x28f4('0x20')][_0x24642a]!==_0x28f4('0x9e')){if(this[_0x28f4('0x20')][_0x24642a][_0x28f4('0xab')]===_0x28f4('0x214')&&this[_0x28f4('0x20')][_0x24642a][_0x28f4('0xb2')]===_0x28f4('0xdb')){_0x1ffe32['push'](this[_0x28f4('0x20')][_0x24642a]['id']);}}}this[_0x28f4('0x20f')](_0xa68efd['id'],_0x1ffe32,0x1,_0xa68efd[_0x28f4('0x206')],_0xa68efd)[_0x28f4('0x3b')](function(_0x1191f8){if(!checkContactEmpty(_0x1191f8)){checkContactLowerLimitOriginate(_0xa68efd,0x1,0x0);_0x13ed40[_0x28f4('0xb9')](_0xa68efd)[_0x28f4('0x3b')](sendMessageReschedule(_0xa68efd))['catch'](loggerCatch(_0x28f4('0x210')));}else{_0xa68efd[_0x28f4('0x3d')]='RUNNING';if(_['isNil'](_0x1191f8[0x0])||_[_0x28f4('0xb0')](_0x1191f8[0x0][_0x28f4('0x16f')])||_[_0x28f4('0xb0')](_0x1191f8[0x0][_0x28f4('0x16f')][_0x28f4('0x170')])){_0x13ed40['emptyContact'](_0x28f4('0x20a'),_0xa68efd,_0x1191f8[0x0]);}else{_0x13ed40[_0x28f4('0xbb')](_[_0x28f4('0x12e')](_0x1191f8[0x0],[_0x28f4('0xd5'),_0x28f4('0x20b')]))[_0x28f4('0x3b')](_0x13ed40[_0x28f4('0x1ef')](_0xa68efd,_0x1191f8[0x0]))['catch'](_0x13ed40[_0x28f4('0xcf')](_0x28f4('0x215'),_0xa68efd));}}})[_0x28f4('0xb4')](loggerGetContactDialer(_0x28f4('0x216'),_0xa68efd,0x1));emitVoiceQueueSummary(_0xa68efd);};Dialer['prototype'][_0x28f4('0x217')]=function(_0x176cec,_0x3fd9db,_0x473b4f,_0x499a66,_0x5d4463,_0x464886){loggerPredictive[_0x28f4('0x81')](_0x28f4('0x218'));loggerPredictive[_0x28f4('0x81')](_0x28f4('0x219'),_0x176cec);loggerPredictive[_0x28f4('0x81')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3fd9db);loggerPredictive[_0x28f4('0x81')]('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',_0x473b4f);loggerPredictive[_0x28f4('0x81')](_0x28f4('0x21a'),_0x499a66);loggerPredictive[_0x28f4('0x81')](_0x28f4('0x21b'),_0x5d4463);loggerPredictive[_0x28f4('0x81')](_0x28f4('0x92'));return new BPromise(function(_0x26ff7a,_0x231fda){if(_0x176cec<=0x0||isNaN(_0x176cec)){return _0x231fda(msgResponse(_0x28f4('0x21c'),_0x28f4('0x49'),'m\x20=\x20'+_0x176cec));}if(_0x473b4f<=0x0||isNaN(_0x473b4f)){return _0x231fda(msgResponse('[abandonmentRate]',_0x28f4('0x49'),_0x28f4('0x21d')+_0x473b4f));}if(_0x499a66<=0x0||isNaN(_0x499a66)){return _0x231fda(msgResponse('[abandonmentRate]',_0x28f4('0x49'),_0x28f4('0x21e')+_0x499a66));}if(_0x3fd9db<=0x0||isNaN(_0x3fd9db)){return _0x231fda(msgResponse(_0x28f4('0x21c'),'Error',_0x28f4('0x21f')+_0x3fd9db));}if(_0x5d4463<=0x0||isNaN(_0x5d4463)){return _0x231fda(msgResponse('[abandonmentRate]',_0x28f4('0x49'),_0x28f4('0x220')+_0x5d4463));}_0x464886=_0x464886||0x0;var _0x3583de=0x1/_0x473b4f;var _0x9cb638=0x0;var _0x43295d=0x0;var _0x3ff5f5=0x0;var _0x3f4a60=0x0;for(var _0x3f93e8=0x0;_0x3ff5f5<_0x5d4463;_0x3f93e8+=0x1){_0x43295d=_0x3f93e8/_0x3fd9db;_0x9cb638=(_0x499a66*_0x43295d+_0x464886)/_0x3583de;_0x3ff5f5=erlangb(_0x9cb638,_0x176cec);_0x3f4a60=_0x9cb638/_0x176cec*(0x1-erlangb(_0x9cb638,_0x176cec));}return _0x26ff7a({'erlangCalls':_0x3f93e8,'erlangCallToSecond':_0x3fd9db/_0x3f93e8,'erlangAbandonmentRate':_0x3ff5f5,'erlangBusyFactor':_0x3f4a60});});};Dialer[_0x28f4('0xad')][_0x28f4('0x1e5')]=function(_0x19f97b,_0x57c496,_0x6e0bba,_0x46319b,_0x38665e,_0x18244a){loggerPredictive[_0x28f4('0x81')](_0x28f4('0x221'));loggerPredictive[_0x28f4('0x81')](_0x28f4('0x219'),_0x19f97b);loggerPredictive[_0x28f4('0x81')](_0x28f4('0x222'),_0x57c496);loggerPredictive[_0x28f4('0x81')](_0x28f4('0x223'),_0x6e0bba);loggerPredictive[_0x28f4('0x81')](_0x28f4('0x21a'),_0x46319b);loggerPredictive[_0x28f4('0x81')](_0x28f4('0x224'),_0x38665e);loggerPredictive[_0x28f4('0x81')](_0x28f4('0x92'));return new BPromise(function(_0x4d5c56,_0x4822ae){if(_0x19f97b<=0x0||isNaN(_0x19f97b)){return _0x4822ae(msgResponse(_0x28f4('0x225'),_0x28f4('0x49'),_0x28f4('0x226')+_0x19f97b));}if(_0x6e0bba<=0x0||isNaN(_0x6e0bba)){return _0x4822ae(msgResponse('[busyFactor]',_0x28f4('0x49'),'Ts\x20=\x20'+_0x6e0bba));}if(_0x46319b<=0x0||isNaN(_0x46319b)){return _0x4822ae(msgResponse(_0x28f4('0x225'),'Error',_0x28f4('0x21e')+_0x46319b));}if(_0x57c496<=0x0||isNaN(_0x57c496)){return _0x4822ae(msgResponse(_0x28f4('0x225'),'Error',_0x28f4('0x21f')+_0x57c496));}if(_0x38665e<=0x0||isNaN(_0x38665e)){return _0x4822ae(msgResponse(_0x28f4('0x225'),_0x28f4('0x49'),'Umin\x20=\x20'+_0x38665e));}_0x18244a=_0x18244a||0x0;var _0x2077c6=0x1/_0x6e0bba;var _0x20b5aa=0x0;var _0x132786=0x0;var _0x526294=0x0;var _0x54c0f4=0x0;for(var _0x47fc1e=0x0;_0x54c0f4<_0x38665e;_0x47fc1e+=0x1){_0x132786=_0x47fc1e/_0x57c496;_0x20b5aa=(_0x46319b*_0x132786+_0x18244a)/_0x2077c6;_0x526294=erlangb(_0x20b5aa,_0x19f97b);_0x54c0f4=_0x20b5aa/_0x19f97b*(0x1-erlangb(_0x20b5aa,_0x19f97b));}return _0x4d5c56({'erlangCalls':_0x47fc1e,'erlangCallToSecond':_0x57c496/_0x47fc1e,'erlangAbandonmentRate':_0x526294,'erlangBusyFactor':_0x54c0f4});});};module[_0x28f4('0x227')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index 79692e5..e4d921d 100644 --- a/server/services/ami/dialer/queueCallerAbandon.js +++ b/server/services/ami/dialer/queueCallerAbandon.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd59d=['ListId','UserId','VoiceQueueId','CampaignId','originatecalleridname','exports','util','moment','milliseconds','diff','seconds','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','number','starttime','responsetime','droptime','endtime','ringtime','holdtime','talktime','membername','connectedlinename','reason','callbackuniqueid','callbackat','recallme','ContactId'];(function(_0x56a347,_0x54d322){var _0x2745f7=function(_0xc7abe5){while(--_0xc7abe5){_0x56a347['push'](_0x56a347['shift']());}};_0x2745f7(++_0x54d322);}(_0xd59d,0x81));var _0xdd59=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xd59d[_0x387777];return _0x3f84c0;};'use strict';var util=require(_0xdd59('0x0'));var _=require('lodash');var moment=require(_0xdd59('0x1'));function getSeconds(_0x2a7273,_0x296927){var _0x279f7f=moment(_0x2a7273)[_0xdd59('0x2')](0x0);var _0x25ee97=moment(_0x296927)['milliseconds'](0x0);return _0x279f7f[_0xdd59('0x3')](_0x25ee97,_0xdd59('0x4'));}function QueueCallerAbandon(_0x4ae985,_0x2a50c9){this[_0xdd59('0x5')]=_0x4ae985[_0xdd59('0x5')];this[_0xdd59('0x6')]=_0x4ae985[_0xdd59('0x6')];this[_0xdd59('0x7')]=_0x4ae985[_0xdd59('0x6')]===_0xdd59('0x8')?_0xdd59('0x9'):_0x4ae985['type'];this[_0xdd59('0xa')]=_0x4ae985[_0xdd59('0xa')];this[_0xdd59('0xb')]=_0x4ae985[_0xdd59('0xb')];this[_0xdd59('0xc')]=_0x4ae985[_0xdd59('0xc')];this[_0xdd59('0xd')]=_0x4ae985[_0xdd59('0xa')]+_0x4ae985[_0xdd59('0xb')]+_0x4ae985[_0xdd59('0xc')]+_0x4ae985[_0xdd59('0xe')]+_0x4ae985['countdropretry']+_0x4ae985[_0xdd59('0xf')]+_0x4ae985['countmachineretry']+_0x4ae985['countagentrejectretry'];this[_0xdd59('0xe')]=_0x4ae985[_0xdd59('0xe')];this['countdropretry']=_0x4ae985['countdropretry'];this[_0xdd59('0xf')]=_0x4ae985['countabandonedretry'];this[_0xdd59('0x10')]=_0x4ae985['countmachineretry'];this[_0xdd59('0x11')]=_0x4ae985[_0xdd59('0x11')];this[_0xdd59('0x12')]=_0x2a50c9['uniqueid'];this[_0xdd59('0x13')]=_0x4ae985['name'];this['calleridnum']=_0x4ae985[_0xdd59('0x14')];this[_0xdd59('0x15')]=_0x4ae985[_0xdd59('0x15')];this[_0xdd59('0x16')]=_0x4ae985[_0xdd59('0x16')];this[_0xdd59('0x17')]=_0x4ae985[_0xdd59('0x17')];this[_0xdd59('0x18')]=this[_0xdd59('0x17')];this[_0xdd59('0x19')]=getSeconds(_0x4ae985['responsetime'],_0x4ae985[_0xdd59('0x15')]);this[_0xdd59('0x1a')]=getSeconds(this[_0xdd59('0x17')],_0x4ae985['responsetime']);this[_0xdd59('0x1b')]=0x0;this['queue']=_0x2a50c9['queue'];this[_0xdd59('0x1c')]=_0x2a50c9[_0xdd59('0x1d')];this[_0xdd59('0x1e')]=_0x2a50c9['reason'];this['callback']=_0x4ae985['callback'];this[_0xdd59('0x1f')]=_0x4ae985[_0xdd59('0x1f')];this['callbackat']=_0x4ae985[_0xdd59('0x20')];this[_0xdd59('0x21')]=_0x4ae985['recallme'];this['ContactId']=_0x4ae985[_0xdd59('0x22')];this['ListId']=_0x4ae985[_0xdd59('0x23')];this[_0xdd59('0x24')]=_0x4ae985[_0xdd59('0x24')];this[_0xdd59('0x25')]=_0x4ae985[_0xdd59('0x25')];this[_0xdd59('0x26')]=_0x4ae985[_0xdd59('0x26')];this['originatecalleridnum']=_0x4ae985['originatecalleridnum']||'';this[_0xdd59('0x27')]=_0x4ae985[_0xdd59('0x27')]||'';}module[_0xdd59('0x28')]=QueueCallerAbandon; \ No newline at end of file +var _0xae0f=['recallme','ContactId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','moment','milliseconds','diff','scheduledat','campaigntype','type','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','name','calleridnum','number','starttime','droptime','ringtime','responsetime','holdtime','talktime','membername','reason','callbackuniqueid','callbackat'];(function(_0x443449,_0x41247c){var _0xe93337=function(_0x299891){while(--_0x299891){_0x443449['push'](_0x443449['shift']());}};_0xe93337(++_0x41247c);}(_0xae0f,0x1d0));var _0xfae0=function(_0x5a83d,_0x2d22fc){_0x5a83d=_0x5a83d-0x0;var _0x1858d6=_0xae0f[_0x5a83d];return _0x1858d6;};'use strict';var util=require('util');var _=require(_0xfae0('0x0'));var moment=require(_0xfae0('0x1'));function getSeconds(_0x33757e,_0x463cf1){var _0x52c68d=moment(_0x33757e)[_0xfae0('0x2')](0x0);var _0x24110c=moment(_0x463cf1)[_0xfae0('0x2')](0x0);return _0x52c68d[_0xfae0('0x3')](_0x24110c,'seconds');}function QueueCallerAbandon(_0x391362,_0x576ffc){this['scheduledat']=_0x391362[_0xfae0('0x4')];this['type']=_0x391362['type'];this[_0xfae0('0x5')]=_0x391362[_0xfae0('0x6')]==='outbound'?_0xfae0('0x7'):_0x391362[_0xfae0('0x6')];this['countbusyretry']=_0x391362[_0xfae0('0x8')];this[_0xfae0('0x9')]=_0x391362[_0xfae0('0x9')];this[_0xfae0('0xa')]=_0x391362['countnoanswerretry'];this[_0xfae0('0xb')]=_0x391362[_0xfae0('0x8')]+_0x391362[_0xfae0('0x9')]+_0x391362[_0xfae0('0xa')]+_0x391362[_0xfae0('0xc')]+_0x391362[_0xfae0('0xd')]+_0x391362[_0xfae0('0xe')]+_0x391362[_0xfae0('0xf')]+_0x391362[_0xfae0('0x10')];this[_0xfae0('0xc')]=_0x391362[_0xfae0('0xc')];this['countdropretry']=_0x391362[_0xfae0('0xd')];this['countabandonedretry']=_0x391362[_0xfae0('0xe')];this[_0xfae0('0xf')]=_0x391362['countmachineretry'];this[_0xfae0('0x10')]=_0x391362[_0xfae0('0x10')];this['uniqueid']=_0x576ffc['uniqueid'];this['calleridname']=_0x391362[_0xfae0('0x11')];this[_0xfae0('0x12')]=_0x391362[_0xfae0('0x13')];this['starttime']=_0x391362[_0xfae0('0x14')];this['responsetime']=_0x391362['responsetime'];this['droptime']=_0x391362['droptime'];this['endtime']=this[_0xfae0('0x15')];this[_0xfae0('0x16')]=getSeconds(_0x391362[_0xfae0('0x17')],_0x391362[_0xfae0('0x14')]);this[_0xfae0('0x18')]=getSeconds(this[_0xfae0('0x15')],_0x391362['responsetime']);this[_0xfae0('0x19')]=0x0;this['queue']=_0x576ffc[_0xfae0('0x7')];this[_0xfae0('0x1a')]=_0x576ffc['connectedlinename'];this[_0xfae0('0x1b')]=_0x576ffc[_0xfae0('0x1b')];this['callback']=_0x391362['callback'];this[_0xfae0('0x1c')]=_0x391362[_0xfae0('0x1c')];this[_0xfae0('0x1d')]=_0x391362[_0xfae0('0x1d')];this[_0xfae0('0x1e')]=_0x391362[_0xfae0('0x1e')];this[_0xfae0('0x1f')]=_0x391362[_0xfae0('0x1f')];this['ListId']=_0x391362['ListId'];this[_0xfae0('0x20')]=_0x391362[_0xfae0('0x20')];this['VoiceQueueId']=_0x391362[_0xfae0('0x21')];this['CampaignId']=_0x391362[_0xfae0('0x22')];this[_0xfae0('0x23')]=_0x391362[_0xfae0('0x23')]||'';this[_0xfae0('0x24')]=_0x391362[_0xfae0('0x24')]||'';}module[_0xfae0('0x25')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 512c923..af8fa4c 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(_0x2a23c5,_0x59f5c6){var _0x4b6cb3=function(_0x30ac16){while(--_0x30ac16){_0x2a23c5['push'](_0x2a23c5['shift']());}};_0x4b6cb3(++_0x59f5c6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xa9e0[_0x387777];return _0x3f84c0;};'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(_0x567b1f,_0x55f5a6){var _0x4a904f=function(_0x4a54fb){while(--_0x4a54fb){_0x567b1f['push'](_0x567b1f['shift']());}};_0x4a904f(++_0x55f5a6);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa9e0[_0xbca1b1];return _0x4e1686;};'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 09bfd61..3f9c725 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 _0x4cf8=['isNil','active','SIP/%s','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','util','lodash','bluebird','uuid','moment','path','tiff2pdf','./util/gs','../../../config/logger','fax','../ami','./rpcDb','./action','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','bind','varset','newstate','syncNewState','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','originateresponse','syncOriginateResponse','prototype','context','from-voip-provider','hasOwnProperty','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','value','channelstate','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','parse','notify','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','merge','pick','reason','update','AttachmentId','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate2]','updateStatus','then','[Fax][Message][Updated]','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','[Fax][execOriginate][success]','Fax\x20received','Fax\x20failed','checkTrunk','FaxAccountId','Trunk','format','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','.pdf','isTrunkReachable'];(function(_0x19da4d,_0x260981){var _0xc71c77=function(_0x4edb82){while(--_0x4edb82){_0x19da4d['push'](_0x19da4d['shift']());}};_0xc71c77(++_0x260981);}(_0x4cf8,0x1e1));var _0x84cf=function(_0x2d3c60,_0x4df458){_0x2d3c60=_0x2d3c60-0x0;var _0x560041=_0x4cf8[_0x2d3c60];return _0x560041;};'use strict';var util=require(_0x84cf('0x0'));var _=require(_0x84cf('0x1'));var BPromise=require(_0x84cf('0x2'));var uuid=require(_0x84cf('0x3'));var moment=require(_0x84cf('0x4'));var path=require(_0x84cf('0x5'));var tiff2pdf=require(_0x84cf('0x6'));var gs=require(_0x84cf('0x7'));var logger=require(_0x84cf('0x8'))(_0x84cf('0x9'));var ami=require(_0x84cf('0xa'));var rpcDb=require(_0x84cf('0xb'));var Channel=require('./channel');var ut=require('./util/util');var Action=require(_0x84cf('0xc'));var faxAccount=require('../rpc/faxAccount');var attachment=require(_0x84cf('0xd'));var faxMessage=require(_0x84cf('0xe'));function Fax(_0x51b84c){this[_0x84cf('0xf')]={};this[_0x84cf('0x10')]=_0x51b84c['faxAccounts'];this[_0x84cf('0x11')]=_0x51b84c[_0x84cf('0x11')];this[_0x84cf('0x12')]={};ami['on'](_0x84cf('0x13'),this['syncNewchannel'][_0x84cf('0x14')](this));ami['on'](_0x84cf('0x15'),this['syncVarSet']['bind'](this));ami['on'](_0x84cf('0x16'),this[_0x84cf('0x17')][_0x84cf('0x14')](this));ami['on'](_0x84cf('0x18'),this[_0x84cf('0x19')][_0x84cf('0x14')](this));ami['on'](_0x84cf('0x1a'),this[_0x84cf('0x1b')][_0x84cf('0x14')](this));ami['on'](_0x84cf('0x1c'),this[_0x84cf('0x1d')][_0x84cf('0x14')](this));ami['on'](_0x84cf('0x1e'),this[_0x84cf('0x1f')][_0x84cf('0x14')](this));ami['on'](_0x84cf('0x20'),this[_0x84cf('0x21')][_0x84cf('0x14')](this));}Fax[_0x84cf('0x22')]['syncNewchannel']=function(_0x441590){if(_0x441590[_0x84cf('0x23')]===_0x84cf('0x24')){for(var _0x1abe2d in this[_0x84cf('0x10')]){if(this[_0x84cf('0x10')][_0x84cf('0x25')](_0x1abe2d)){if(_0x441590['exten']===this['faxAccounts'][_0x1abe2d][_0x84cf('0x26')]){this[_0x84cf('0xf')][_0x441590[_0x84cf('0x27')]]={};this[_0x84cf('0xf')][_0x441590[_0x84cf('0x27')]]['channel']=_0x441590[_0x84cf('0x28')];this[_0x84cf('0xf')][_0x441590[_0x84cf('0x27')]]['id']=this[_0x84cf('0x10')][_0x1abe2d]['id'];this[_0x84cf('0xf')][_0x441590['uniqueid']][_0x84cf('0x29')]=this[_0x84cf('0x10')][_0x1abe2d][_0x84cf('0x29')];logger[_0x84cf('0x2a')](_0x441590[_0x84cf('0x27')],_0x84cf('0x2b'));}}}}if(this[_0x84cf('0x12')][_0x441590['uniqueid']]){this[_0x84cf('0xf')][_0x441590[_0x84cf('0x27')]]={};this[_0x84cf('0xf')][_0x441590[_0x84cf('0x27')]][_0x84cf('0x28')]=_0x441590[_0x84cf('0x28')];logger[_0x84cf('0x2a')](_0x441590[_0x84cf('0x27')],_0x84cf('0x2b'));}};Fax[_0x84cf('0x22')]['syncVarSet']=function(_0x83f20b){if(this[_0x84cf('0xf')][_0x83f20b[_0x84cf('0x27')]]){for(var _0x41a5db in _0x83f20b['variable']){if(_0x83f20b[_0x84cf('0x2c')]['hasOwnProperty'](_0x41a5db)){this[_0x84cf('0xf')][_0x83f20b[_0x84cf('0x27')]][_0x41a5db]=_0x83f20b[_0x84cf('0x2d')];}}}};Fax[_0x84cf('0x22')][_0x84cf('0x17')]=function(_0x20de4b){if(this[_0x84cf('0xf')][_0x20de4b[_0x84cf('0x27')]]){this[_0x84cf('0xf')][_0x20de4b[_0x84cf('0x27')]][_0x84cf('0x2e')]=_0x20de4b[_0x84cf('0x2e')];this[_0x84cf('0xf')][_0x20de4b[_0x84cf('0x27')]]['channelstatedesc']=_0x20de4b['channelstatedesc'];}};Fax[_0x84cf('0x22')][_0x84cf('0x19')]=function(_0x16ebaa){if(this[_0x84cf('0xf')][_0x16ebaa[_0x84cf('0x27')]]){for(var _0x1453cf in _0x16ebaa[_0x84cf('0x2c')]){if(_0x16ebaa[_0x84cf('0x2c')]['hasOwnProperty'](_0x1453cf)){this[_0x84cf('0xf')][_0x16ebaa[_0x84cf('0x27')]][_0x1453cf]=_0x16ebaa['value'];}}}};Fax[_0x84cf('0x22')]['syncFaxStatus']=function(_0x4624e3){if(this[_0x84cf('0xf')][_0x4624e3[_0x84cf('0x27')]]){this[_0x84cf('0xf')][_0x4624e3[_0x84cf('0x27')]]['operation']=_0x4624e3[_0x84cf('0x2f')];this['channels'][_0x4624e3['uniqueid']][_0x84cf('0x30')]=_0x4624e3[_0x84cf('0x30')];this['channels'][_0x4624e3[_0x84cf('0x27')]][_0x84cf('0x26')]=_0x4624e3[_0x84cf('0x26')];this[_0x84cf('0xf')][_0x4624e3[_0x84cf('0x27')]][_0x84cf('0x31')]=_0x4624e3['filename'];logger[_0x84cf('0x2a')](_0x4624e3[_0x84cf('0x27')],_0x84cf('0x32'));}};Fax[_0x84cf('0x22')][_0x84cf('0x1d')]=function(_0x2a8992){var _0x5129b0=this;if(this[_0x84cf('0xf')][_0x2a8992['uniqueid']]){var _0x1434e2=this[_0x84cf('0xf')][_0x2a8992[_0x84cf('0x27')]]['id'];this[_0x84cf('0xf')][_0x2a8992[_0x84cf('0x27')]][_0x84cf('0x33')]=_0x2a8992[_0x84cf('0x33')];this[_0x84cf('0xf')][_0x2a8992[_0x84cf('0x27')]]['pagestransferred']=_0x2a8992[_0x84cf('0x34')];this['channels'][_0x2a8992[_0x84cf('0x27')]][_0x84cf('0x26')]=_0x2a8992['localstationid'];this[_0x84cf('0xf')][_0x2a8992['uniqueid']][_0x84cf('0x35')]=_0x2a8992['resolution'];this[_0x84cf('0xf')][_0x2a8992['uniqueid']][_0x84cf('0x36')]=_0x2a8992[_0x84cf('0x36')];this['channels'][_0x2a8992[_0x84cf('0x27')]][_0x84cf('0x31')]=_0x2a8992[_0x84cf('0x31')];this['channels'][_0x2a8992[_0x84cf('0x27')]]['calleridnum']=_0x2a8992[_0x84cf('0x37')];if(this['channels'][_0x2a8992['uniqueid']]['pagestransferred']>0x0){tiff2pdf(_0x2a8992[_0x84cf('0x31')],_0x84cf('0x38'),function(_0x49cb4f){logger[_0x84cf('0x2a')](_0x2a8992['uniqueid'],_0x84cf('0x39'),_0x49cb4f[_0x84cf('0x3a')]);attachment['create']({'name':path[_0x84cf('0x3b')](_0x2a8992['filename'])[_0x84cf('0x29')],'basename':path['parse'](_0x2a8992['filename'])['name']+'.pdf','type':'application/pdf'})['then'](function(_0x59b81c){faxAccount[_0x84cf('0x3c')](_0x1434e2,{'from':_0x2a8992[_0x84cf('0x37')],'mapKey':_0x84cf('0x9'),'body':path[_0x84cf('0x3b')](_0x2a8992['filename'])[_0x84cf('0x29')]+'.pdf','AttachmentId':_0x59b81c['id']})[_0x84cf('0x3d')](function(_0x3c89da){logger[_0x84cf('0x3e')](_0x2a8992[_0x84cf('0x27')],_0x84cf('0x3f'),JSON[_0x84cf('0x40')](_0x3c89da));});})['catch'](function(_0x2f7da6){logger[_0x84cf('0x3e')](_0x2a8992['uniqueid'],_0x84cf('0x41'),JSON[_0x84cf('0x40')](_0x2f7da6));});});}logger[_0x84cf('0x2a')](_0x2a8992['uniqueid'],'\x20receiveFax\x20');}};Fax['prototype'][_0x84cf('0x21')]=function(_0x104421){if(this[_0x84cf('0x12')][_0x104421[_0x84cf('0x27')]]){_[_0x84cf('0x42')](this[_0x84cf('0xf')][_0x104421['uniqueid']],_[_0x84cf('0x43')](_0x104421,['response',_0x84cf('0x44')]));}};function updateStatus(_0x499225){if(_0x499225['AttachmentId']){faxMessage[_0x84cf('0x45')](_0x499225[_0x84cf('0x46')],{'failMessage':_0x84cf('0x47')})['then'](function(_0x52740c){ut[_0x84cf('0x48')](_0x84cf('0x49'),_0x52740c);})[_0x84cf('0x3d')](function(_0x15f783){ut[_0x84cf('0x48')]('[Fax][Message][Error][NoUpdate1]',_0x15f783);});}else{ut[_0x84cf('0x48')](_0x84cf('0x4a'));}}Fax['prototype'][_0x84cf('0x4b')]=function(_0x5baea8,_0x4fd496,_0x147194){var _0x319322=this;var _0x5c651c={};if(_0x4fd496){_0x5c651c={'read':_0x4fd496};}else{_0x5c651c={'failMessage':_0x147194};}if(this['actions'][_0x5baea8][_0x84cf('0x46')]){faxMessage[_0x84cf('0x45')](this[_0x84cf('0x12')][_0x5baea8][_0x84cf('0x46')],_0x5c651c)[_0x84cf('0x4c')](function(_0x3edaec){ut[_0x84cf('0x48')](_0x84cf('0x4d'),_0x3edaec);})['catch'](function(_0x1bc15c){ut[_0x84cf('0x48')]('[Fax][Message][NoUpdate1]',_0x1bc15c);})['finally'](function(){delete _0x319322[_0x84cf('0xf')][_0x5baea8];delete _0x319322[_0x84cf('0x12')][_0x5baea8];});}else{ut[_0x84cf('0x48')](_0x84cf('0x4e'));delete this[_0x84cf('0xf')][_0x5baea8];delete this[_0x84cf('0x12')][_0x5baea8];}};Fax[_0x84cf('0x22')]['syncHangup']=function(_0x652356){var _0x4aa8b2=this;if(this[_0x84cf('0xf')][_0x652356['uniqueid']]){if(this[_0x84cf('0x12')][_0x652356[_0x84cf('0x27')]]){this['channels'][_0x652356[_0x84cf('0x27')]]['id']=this[_0x84cf('0x12')][_0x652356['uniqueid']]['id'];this[_0x84cf('0xf')][_0x652356['uniqueid']]['name']=this['actions'][_0x652356['uniqueid']][_0x84cf('0x29')];}logger[_0x84cf('0x2a')](_0x652356[_0x84cf('0x27')],this[_0x84cf('0x12')][_0x652356['uniqueid']]?_0x84cf('0x4f'):_0x84cf('0x50'),JSON['stringify'](this[_0x84cf('0xf')][_0x652356[_0x84cf('0x27')]]));if(this[_0x84cf('0x12')][_0x652356[_0x84cf('0x27')]]){if(this[_0x84cf('0xf')][_0x652356[_0x84cf('0x27')]][_0x84cf('0x51')]>0x0&&this[_0x84cf('0xf')][_0x652356['uniqueid']][_0x84cf('0x1a')]==='SUCCESS'){this[_0x84cf('0x4b')](_0x652356[_0x84cf('0x27')],!![]);}else{this[_0x84cf('0x4b')](_0x652356[_0x84cf('0x27')],![],this[_0x84cf('0xf')][_0x652356['uniqueid']][_0x84cf('0x52')]?_0x84cf('0x53')+this[_0x84cf('0xf')][_0x652356['uniqueid']][_0x84cf('0x52')]:_0x84cf('0x54'));}}}};Fax['prototype'][_0x84cf('0x55')]=function(_0x482958){var _0x26f8d4=this;return new BPromise(function(_0x30aa60,_0x57f1f2){_0x26f8d4[_0x84cf('0x56')](_0x482958,_0x26f8d4[_0x84cf('0x10')][_0x482958['FaxAccountId']])[_0x84cf('0x4c')](function(_0x2ff1bb){ut[_0x84cf('0x48')](_0x84cf('0x57'),_0x2ff1bb);_0x30aa60(ut['message'](_0x84cf('0x58')));})[_0x84cf('0x3d')](function(_0x4b52c8){ut['logger']('[Fax][execOriginate][failure]',_0x4b52c8);updateStatus(_0x482958);_0x57f1f2(ut[_0x84cf('0x3a')](_0x84cf('0x59')));});});};Fax[_0x84cf('0x22')]['checkAfterSend']=function(_0x5a8e61){var _0x30aecd=this;return new BPromise(function(_0x3040ee,_0xa17c6c){var _0x2ef504=_0x30aecd[_0x84cf('0x5a')](_0x30aecd[_0x84cf('0x10')][_0x5a8e61[_0x84cf('0x5b')]][_0x84cf('0x5c')],_0x5a8e61);if(_0x2ef504['isValid']){_0x3040ee(ut[_0x84cf('0x3a')]('Trunk\x20Reachable'));}else{_0xa17c6c(ut[_0x84cf('0x3a')](_0x2ef504[_0x84cf('0x3a')]));}});};function originate(_0x5ebea2,_0x5b154a,_0x282c17){return new BPromise(function(_0x31e622,_0x373a25){if(_0x282c17){var _0x1c6e56=util[_0x84cf('0x5d')]('gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit',path[_0x84cf('0x3b')](_0x5ebea2[_0x84cf('0x5')])[_0x84cf('0x29')],_0x5ebea2[_0x84cf('0x5')]);gs['execute'](_0x1c6e56)[_0x84cf('0x4c')](function(){_0x5ebea2['path']=util['format'](_0x84cf('0x5e'),path[_0x84cf('0x3b')](_0x5ebea2[_0x84cf('0x5')])[_0x84cf('0x5f')],path['parse'](_0x5ebea2['path'])['name']);_0x5b154a[_0x84cf('0x60')]=_0x5ebea2['path'];ut[_0x84cf('0x48')](_0x84cf('0x61'),'');ami[_0x84cf('0x62')](ut[_0x84cf('0x63')](_0x5ebea2,_0x5b154a))['then'](function(_0x1fa573){_0x31e622(_0x1fa573);})[_0x84cf('0x3d')](function(_0x4e1141){_0x373a25(_0x4e1141);});})[_0x84cf('0x3d')](function(_0x491897){_0x373a25(_0x491897);});}else{ami['Action'](ut[_0x84cf('0x63')](_0x5ebea2,_0x5b154a))[_0x84cf('0x4c')](function(_0x5e3bd3){_0x31e622(_0x5e3bd3);})['catch'](function(_0x122f08){_0x373a25(_0x122f08);});}});}Fax['prototype']['execOriginate']=function(_0x55d0e8,_0x394d5d){var _0x444bb8=this;return new BPromise(function(_0x3674f3,_0x58300f){var _0x49e6f6=uuid['v4']();var _0x2994b2=ut[_0x84cf('0x64')](_0x55d0e8,_0x394d5d);_0x444bb8[_0x84cf('0x12')][_0x49e6f6]=new Action(_0x49e6f6,_0x394d5d,_0x55d0e8);var _0x4686e2=_0x444bb8['actions'][_0x49e6f6];if(path['parse'](_0x55d0e8['path'])[_0x84cf('0x65')]===_0x84cf('0x66')){originate(_0x4686e2,_0x2994b2,!![])[_0x84cf('0x4c')](function(_0x4fc2f2){_0x3674f3(_0x4fc2f2);})[_0x84cf('0x3d')](function(_0x29d062){_0x58300f(_0x29d062);});}else{originate(_0x4686e2,_0x2994b2,![])[_0x84cf('0x4c')](function(_0x9447b6){_0x3674f3(_0x9447b6);})[_0x84cf('0x3d')](function(_0x4c0461){_0x58300f(_0x4c0461);});}});};Fax[_0x84cf('0x22')][_0x84cf('0x67')]=function(_0xc32a6f){return!_['isNil'](_0xc32a6f)&&!_[_0x84cf('0x68')](_0xc32a6f[_0x84cf('0x29')])&&!_['isNil'](_0xc32a6f[_0x84cf('0x69')])&&_0xc32a6f[_0x84cf('0x69')]&&!_[_0x84cf('0x68')](this[_0x84cf('0x11')][util['format']('SIP/%s',_0xc32a6f[_0x84cf('0x29')])])&&!_[_0x84cf('0x68')](this['trunks'][util['format'](_0x84cf('0x6a'),_0xc32a6f[_0x84cf('0x29')])][_0x84cf('0x30')])&&(this[_0x84cf('0x11')][util[_0x84cf('0x5d')](_0x84cf('0x6a'),_0xc32a6f[_0x84cf('0x29')])][_0x84cf('0x30')]==='reachable'||this[_0x84cf('0x11')][util[_0x84cf('0x5d')](_0x84cf('0x6a'),_0xc32a6f[_0x84cf('0x29')])][_0x84cf('0x30')]===_0x84cf('0x6b'));};Fax['prototype'][_0x84cf('0x5a')]=function(_0x5af1e1,_0x105875){if(!this[_0x84cf('0x67')](_0x5af1e1)){ut[_0x84cf('0x48')](_0x84cf('0x6c'),_[_0x84cf('0x68')](_0x5af1e1)?'':_0x5af1e1['name']+_0x84cf('0x6d'));return{'isValid':![],'message':_0x84cf('0x6e')};}if(_[_0x84cf('0x68')](_0x105875[_0x84cf('0x9')])){ut[_0x84cf('0x48')](_0x84cf('0x6f'),JSON[_0x84cf('0x40')](_0x105875));return{'isValid':![],'message':_0x84cf('0x70')};}if(_[_0x84cf('0x68')](_0x105875[_0x84cf('0x5')])){ut[_0x84cf('0x48')](_0x84cf('0x71'),JSON[_0x84cf('0x40')](_0x105875));return{'isValid':![],'message':_0x84cf('0x72')};}return{'isValid':!![],'message':_0x84cf('0x73')};};module[_0x84cf('0x74')]=Fax; \ No newline at end of file +var _0xd8b0=['\x20result\x20conversion\x20file\x20','message','create','application/pdf','notify','calleridnum','.pdf','catch','\x20notify\x20','stringify','error','\x20receiveFax\x20','merge','pick','AttachmentId','update','then','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate2]','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','updateStatus','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','Trunk\x20Reachable','format','parse','execute','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','variablesAction','Action','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','util','lodash','path','tiff2pdf','./util/gs','../../../config/logger','fax','./channel','./util/util','./action','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','varset','bind','newstate','syncNewState','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','originateresponse','syncOriginateResponse','prototype','context','from-voip-provider','hasOwnProperty','exten','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','syncVarSet','variable','channelstate','channelstatedesc','value','operation','status','filename','remotestationid','pagestransferred','resolution','transferrate','/var/opt/motion2/server/files/attachments/'];(function(_0x4ad997,_0x64b4d3){var _0x1fb10c=function(_0x16922d){while(--_0x16922d){_0x4ad997['push'](_0x4ad997['shift']());}};_0x1fb10c(++_0x64b4d3);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var util=require(_0x0d8b('0x0'));var _=require(_0x0d8b('0x1'));var BPromise=require('bluebird');var uuid=require('uuid');var moment=require('moment');var path=require(_0x0d8b('0x2'));var tiff2pdf=require(_0x0d8b('0x3'));var gs=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));var ami=require('../ami');var rpcDb=require('./rpcDb');var Channel=require(_0x0d8b('0x7'));var ut=require(_0x0d8b('0x8'));var Action=require(_0x0d8b('0x9'));var faxAccount=require('../rpc/faxAccount');var attachment=require(_0x0d8b('0xa'));var faxMessage=require(_0x0d8b('0xb'));function Fax(_0x58e4e2){this[_0x0d8b('0xc')]={};this[_0x0d8b('0xd')]=_0x58e4e2[_0x0d8b('0xd')];this[_0x0d8b('0xe')]=_0x58e4e2[_0x0d8b('0xe')];this[_0x0d8b('0xf')]={};ami['on'](_0x0d8b('0x10'),this[_0x0d8b('0x11')]['bind'](this));ami['on'](_0x0d8b('0x12'),this['syncVarSet'][_0x0d8b('0x13')](this));ami['on'](_0x0d8b('0x14'),this[_0x0d8b('0x15')][_0x0d8b('0x13')](this));ami['on'](_0x0d8b('0x16'),this[_0x0d8b('0x17')][_0x0d8b('0x13')](this));ami['on'](_0x0d8b('0x18'),this[_0x0d8b('0x19')][_0x0d8b('0x13')](this));ami['on'](_0x0d8b('0x1a'),this[_0x0d8b('0x1b')][_0x0d8b('0x13')](this));ami['on'](_0x0d8b('0x1c'),this['syncHangup'][_0x0d8b('0x13')](this));ami['on'](_0x0d8b('0x1d'),this[_0x0d8b('0x1e')][_0x0d8b('0x13')](this));}Fax[_0x0d8b('0x1f')]['syncNewchannel']=function(_0x106a01){if(_0x106a01[_0x0d8b('0x20')]===_0x0d8b('0x21')){for(var _0x5fecbd in this[_0x0d8b('0xd')]){if(this[_0x0d8b('0xd')][_0x0d8b('0x22')](_0x5fecbd)){if(_0x106a01[_0x0d8b('0x23')]===this['faxAccounts'][_0x5fecbd][_0x0d8b('0x24')]){this[_0x0d8b('0xc')][_0x106a01[_0x0d8b('0x25')]]={};this[_0x0d8b('0xc')][_0x106a01[_0x0d8b('0x25')]][_0x0d8b('0x26')]=_0x106a01[_0x0d8b('0x26')];this[_0x0d8b('0xc')][_0x106a01['uniqueid']]['id']=this['faxAccounts'][_0x5fecbd]['id'];this[_0x0d8b('0xc')][_0x106a01['uniqueid']]['name']=this['faxAccounts'][_0x5fecbd][_0x0d8b('0x27')];logger[_0x0d8b('0x28')](_0x106a01[_0x0d8b('0x25')],_0x0d8b('0x29'));}}}}if(this[_0x0d8b('0xf')][_0x106a01[_0x0d8b('0x25')]]){this[_0x0d8b('0xc')][_0x106a01[_0x0d8b('0x25')]]={};this[_0x0d8b('0xc')][_0x106a01['uniqueid']][_0x0d8b('0x26')]=_0x106a01[_0x0d8b('0x26')];logger['info'](_0x106a01[_0x0d8b('0x25')],'\x20syncNewchannel\x20');}};Fax[_0x0d8b('0x1f')][_0x0d8b('0x2a')]=function(_0xa2af02){if(this['channels'][_0xa2af02['uniqueid']]){for(var _0x28f639 in _0xa2af02[_0x0d8b('0x2b')]){if(_0xa2af02['variable'][_0x0d8b('0x22')](_0x28f639)){this['channels'][_0xa2af02[_0x0d8b('0x25')]][_0x28f639]=_0xa2af02['value'];}}}};Fax[_0x0d8b('0x1f')]['syncNewState']=function(_0x2ab00d){if(this['channels'][_0x2ab00d[_0x0d8b('0x25')]]){this['channels'][_0x2ab00d[_0x0d8b('0x25')]][_0x0d8b('0x2c')]=_0x2ab00d[_0x0d8b('0x2c')];this['channels'][_0x2ab00d['uniqueid']]['channelstatedesc']=_0x2ab00d[_0x0d8b('0x2d')];}};Fax['prototype'][_0x0d8b('0x17')]=function(_0x54f6f3){if(this['channels'][_0x54f6f3[_0x0d8b('0x25')]]){for(var _0x1b6920 in _0x54f6f3[_0x0d8b('0x2b')]){if(_0x54f6f3[_0x0d8b('0x2b')][_0x0d8b('0x22')](_0x1b6920)){this[_0x0d8b('0xc')][_0x54f6f3[_0x0d8b('0x25')]][_0x1b6920]=_0x54f6f3[_0x0d8b('0x2e')];}}}};Fax['prototype'][_0x0d8b('0x19')]=function(_0x3ef48d){if(this['channels'][_0x3ef48d[_0x0d8b('0x25')]]){this[_0x0d8b('0xc')][_0x3ef48d[_0x0d8b('0x25')]]['operation']=_0x3ef48d[_0x0d8b('0x2f')];this[_0x0d8b('0xc')][_0x3ef48d[_0x0d8b('0x25')]][_0x0d8b('0x30')]=_0x3ef48d[_0x0d8b('0x30')];this['channels'][_0x3ef48d[_0x0d8b('0x25')]][_0x0d8b('0x24')]=_0x3ef48d['localstationid'];this[_0x0d8b('0xc')][_0x3ef48d[_0x0d8b('0x25')]][_0x0d8b('0x31')]=_0x3ef48d[_0x0d8b('0x31')];logger[_0x0d8b('0x28')](_0x3ef48d['uniqueid'],'\x20syncFaxStatus\x20');}};Fax[_0x0d8b('0x1f')]['syncReceiveFax']=function(_0x531c55){var _0xc179bd=this;if(this[_0x0d8b('0xc')][_0x531c55[_0x0d8b('0x25')]]){var _0x1388b1=this[_0x0d8b('0xc')][_0x531c55[_0x0d8b('0x25')]]['id'];this['channels'][_0x531c55[_0x0d8b('0x25')]][_0x0d8b('0x32')]=_0x531c55[_0x0d8b('0x32')];this[_0x0d8b('0xc')][_0x531c55[_0x0d8b('0x25')]][_0x0d8b('0x33')]=_0x531c55[_0x0d8b('0x33')];this['channels'][_0x531c55[_0x0d8b('0x25')]][_0x0d8b('0x24')]=_0x531c55[_0x0d8b('0x24')];this[_0x0d8b('0xc')][_0x531c55['uniqueid']][_0x0d8b('0x34')]=_0x531c55['resolution'];this[_0x0d8b('0xc')][_0x531c55[_0x0d8b('0x25')]][_0x0d8b('0x35')]=_0x531c55[_0x0d8b('0x35')];this[_0x0d8b('0xc')][_0x531c55[_0x0d8b('0x25')]][_0x0d8b('0x31')]=_0x531c55[_0x0d8b('0x31')];this[_0x0d8b('0xc')][_0x531c55[_0x0d8b('0x25')]]['calleridnum']=_0x531c55['calleridnum'];if(this['channels'][_0x531c55['uniqueid']]['pagestransferred']>0x0){tiff2pdf(_0x531c55[_0x0d8b('0x31')],_0x0d8b('0x36'),function(_0x1e2433){logger['info'](_0x531c55['uniqueid'],_0x0d8b('0x37'),_0x1e2433[_0x0d8b('0x38')]);attachment[_0x0d8b('0x39')]({'name':path['parse'](_0x531c55[_0x0d8b('0x31')])[_0x0d8b('0x27')],'basename':path['parse'](_0x531c55['filename'])[_0x0d8b('0x27')]+'.pdf','type':_0x0d8b('0x3a')})['then'](function(_0x53f643){faxAccount[_0x0d8b('0x3b')](_0x1388b1,{'from':_0x531c55[_0x0d8b('0x3c')],'mapKey':'fax','body':path['parse'](_0x531c55['filename'])['name']+_0x0d8b('0x3d'),'AttachmentId':_0x53f643['id']})[_0x0d8b('0x3e')](function(_0xd9d4c3){logger['error'](_0x531c55[_0x0d8b('0x25')],_0x0d8b('0x3f'),JSON[_0x0d8b('0x40')](_0xd9d4c3));});})[_0x0d8b('0x3e')](function(_0x423ecd){logger[_0x0d8b('0x41')](_0x531c55[_0x0d8b('0x25')],_0x0d8b('0x42'),JSON[_0x0d8b('0x40')](_0x423ecd));});});}logger[_0x0d8b('0x28')](_0x531c55[_0x0d8b('0x25')],_0x0d8b('0x42'));}};Fax[_0x0d8b('0x1f')][_0x0d8b('0x1e')]=function(_0x570af8){if(this[_0x0d8b('0xf')][_0x570af8[_0x0d8b('0x25')]]){_[_0x0d8b('0x43')](this[_0x0d8b('0xc')][_0x570af8['uniqueid']],_[_0x0d8b('0x44')](_0x570af8,['response','reason']));}};function updateStatus(_0x39a31d){if(_0x39a31d[_0x0d8b('0x45')]){faxMessage[_0x0d8b('0x46')](_0x39a31d[_0x0d8b('0x45')],{'failMessage':'SENDING\x20FAILED\x20'})[_0x0d8b('0x47')](function(_0x1106d6){ut[_0x0d8b('0x48')](_0x0d8b('0x49'),_0x1106d6);})[_0x0d8b('0x3e')](function(_0x4cd85a){ut['logger']('[Fax][Message][Error][NoUpdate1]',_0x4cd85a);});}else{ut['logger'](_0x0d8b('0x4a'));}}Fax[_0x0d8b('0x1f')]['updateStatus']=function(_0x4950a8,_0x44c5c1,_0x3d3cb6){var _0x5c5bd7=this;var _0x5ef6c3={};if(_0x44c5c1){_0x5ef6c3={'read':_0x44c5c1};}else{_0x5ef6c3={'failMessage':_0x3d3cb6};}if(this[_0x0d8b('0xf')][_0x4950a8][_0x0d8b('0x45')]){faxMessage[_0x0d8b('0x46')](this[_0x0d8b('0xf')][_0x4950a8][_0x0d8b('0x45')],_0x5ef6c3)['then'](function(_0x2de903){ut[_0x0d8b('0x48')]('[Fax][Message][Updated]',_0x2de903);})['catch'](function(_0xf6a773){ut[_0x0d8b('0x48')]('[Fax][Message][NoUpdate1]',_0xf6a773);})['finally'](function(){delete _0x5c5bd7[_0x0d8b('0xc')][_0x4950a8];delete _0x5c5bd7[_0x0d8b('0xf')][_0x4950a8];});}else{ut[_0x0d8b('0x48')](_0x0d8b('0x4b'));delete this['channels'][_0x4950a8];delete this[_0x0d8b('0xf')][_0x4950a8];}};Fax['prototype']['syncHangup']=function(_0x38c24e){var _0x44043b=this;if(this['channels'][_0x38c24e['uniqueid']]){if(this[_0x0d8b('0xf')][_0x38c24e[_0x0d8b('0x25')]]){this[_0x0d8b('0xc')][_0x38c24e[_0x0d8b('0x25')]]['id']=this[_0x0d8b('0xf')][_0x38c24e[_0x0d8b('0x25')]]['id'];this[_0x0d8b('0xc')][_0x38c24e[_0x0d8b('0x25')]]['name']=this[_0x0d8b('0xf')][_0x38c24e[_0x0d8b('0x25')]][_0x0d8b('0x27')];}logger[_0x0d8b('0x28')](_0x38c24e[_0x0d8b('0x25')],this[_0x0d8b('0xf')][_0x38c24e[_0x0d8b('0x25')]]?_0x0d8b('0x4c'):_0x0d8b('0x4d'),JSON['stringify'](this[_0x0d8b('0xc')][_0x38c24e[_0x0d8b('0x25')]]));if(this[_0x0d8b('0xf')][_0x38c24e[_0x0d8b('0x25')]]){if(this[_0x0d8b('0xc')][_0x38c24e['uniqueid']][_0x0d8b('0x4e')]>0x0&&this[_0x0d8b('0xc')][_0x38c24e[_0x0d8b('0x25')]][_0x0d8b('0x18')]===_0x0d8b('0x4f')){this['updateStatus'](_0x38c24e['uniqueid'],!![]);}else{this[_0x0d8b('0x50')](_0x38c24e[_0x0d8b('0x25')],![],this[_0x0d8b('0xc')][_0x38c24e[_0x0d8b('0x25')]]['faxstatusstring']?_0x0d8b('0x51')+this[_0x0d8b('0xc')][_0x38c24e[_0x0d8b('0x25')]]['faxstatusstring']:_0x0d8b('0x52'));}}}};Fax['prototype'][_0x0d8b('0x53')]=function(_0x3ed63e){var _0x1efce6=this;return new BPromise(function(_0x26ccf0,_0x2b6eb6){_0x1efce6[_0x0d8b('0x54')](_0x3ed63e,_0x1efce6['faxAccounts'][_0x3ed63e[_0x0d8b('0x55')]])['then'](function(_0x71e8d8){ut[_0x0d8b('0x48')](_0x0d8b('0x56'),_0x71e8d8);_0x26ccf0(ut[_0x0d8b('0x38')]('Fax\x20received'));})[_0x0d8b('0x3e')](function(_0x34d01f){ut[_0x0d8b('0x48')](_0x0d8b('0x57'),_0x34d01f);updateStatus(_0x3ed63e);_0x2b6eb6(ut[_0x0d8b('0x38')](_0x0d8b('0x58')));});});};Fax[_0x0d8b('0x1f')][_0x0d8b('0x59')]=function(_0x2ce282){var _0x34affb=this;return new BPromise(function(_0x57e39a,_0x4ee1e8){var _0x6388ae=_0x34affb[_0x0d8b('0x5a')](_0x34affb['faxAccounts'][_0x2ce282[_0x0d8b('0x55')]]['Trunk'],_0x2ce282);if(_0x6388ae['isValid']){_0x57e39a(ut[_0x0d8b('0x38')](_0x0d8b('0x5b')));}else{_0x4ee1e8(ut['message'](_0x6388ae['message']));}});};function originate(_0x1900e3,_0x1c007b,_0x70e4b2){return new BPromise(function(_0x435090,_0x2ab72b){if(_0x70e4b2){var _0x156859=util[_0x0d8b('0x5c')]('gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit',path[_0x0d8b('0x5d')](_0x1900e3['path'])[_0x0d8b('0x27')],_0x1900e3[_0x0d8b('0x2')]);gs[_0x0d8b('0x5e')](_0x156859)[_0x0d8b('0x47')](function(){_0x1900e3['path']=util[_0x0d8b('0x5c')]('%s/%s.tif',path[_0x0d8b('0x5d')](_0x1900e3[_0x0d8b('0x2')])[_0x0d8b('0x5f')],path[_0x0d8b('0x5d')](_0x1900e3[_0x0d8b('0x2')])[_0x0d8b('0x27')]);_0x1c007b[_0x0d8b('0x60')]=_0x1900e3[_0x0d8b('0x2')];ut[_0x0d8b('0x48')](_0x0d8b('0x61'),'');ami['Action'](ut[_0x0d8b('0x62')](_0x1900e3,_0x1c007b))['then'](function(_0x3e4121){_0x435090(_0x3e4121);})[_0x0d8b('0x3e')](function(_0x52c458){_0x2ab72b(_0x52c458);});})[_0x0d8b('0x3e')](function(_0x56e03c){_0x2ab72b(_0x56e03c);});}else{ami[_0x0d8b('0x63')](ut[_0x0d8b('0x62')](_0x1900e3,_0x1c007b))[_0x0d8b('0x47')](function(_0x259ac9){_0x435090(_0x259ac9);})[_0x0d8b('0x3e')](function(_0x299f98){_0x2ab72b(_0x299f98);});}});}Fax[_0x0d8b('0x1f')][_0x0d8b('0x54')]=function(_0x4bde46,_0x10eca6){var _0x8ca59e=this;return new BPromise(function(_0x5b2916,_0x191a5a){var _0x105df9=uuid['v4']();var _0x303d6=ut[_0x0d8b('0x64')](_0x4bde46,_0x10eca6);_0x8ca59e[_0x0d8b('0xf')][_0x105df9]=new Action(_0x105df9,_0x10eca6,_0x4bde46);var _0x9e44b4=_0x8ca59e[_0x0d8b('0xf')][_0x105df9];if(path[_0x0d8b('0x5d')](_0x4bde46[_0x0d8b('0x2')])[_0x0d8b('0x65')]===_0x0d8b('0x3d')){originate(_0x9e44b4,_0x303d6,!![])[_0x0d8b('0x47')](function(_0x50c0ff){_0x5b2916(_0x50c0ff);})[_0x0d8b('0x3e')](function(_0x93fc55){_0x191a5a(_0x93fc55);});}else{originate(_0x9e44b4,_0x303d6,![])[_0x0d8b('0x47')](function(_0x58525c){_0x5b2916(_0x58525c);})['catch'](function(_0xebca83){_0x191a5a(_0xebca83);});}});};Fax[_0x0d8b('0x1f')][_0x0d8b('0x66')]=function(_0x5b76af){return!_['isNil'](_0x5b76af)&&!_[_0x0d8b('0x67')](_0x5b76af[_0x0d8b('0x27')])&&!_[_0x0d8b('0x67')](_0x5b76af[_0x0d8b('0x68')])&&_0x5b76af[_0x0d8b('0x68')]&&!_[_0x0d8b('0x67')](this[_0x0d8b('0xe')][util[_0x0d8b('0x5c')](_0x0d8b('0x69'),_0x5b76af[_0x0d8b('0x27')])])&&!_[_0x0d8b('0x67')](this[_0x0d8b('0xe')][util[_0x0d8b('0x5c')]('SIP/%s',_0x5b76af[_0x0d8b('0x27')])][_0x0d8b('0x30')])&&(this['trunks'][util['format'](_0x0d8b('0x69'),_0x5b76af[_0x0d8b('0x27')])][_0x0d8b('0x30')]===_0x0d8b('0x6a')||this[_0x0d8b('0xe')][util[_0x0d8b('0x5c')]('SIP/%s',_0x5b76af['name'])]['status']===_0x0d8b('0x6b'));};Fax[_0x0d8b('0x1f')][_0x0d8b('0x5a')]=function(_0x28f9b7,_0x3f1eee){if(!this[_0x0d8b('0x66')](_0x28f9b7)){ut['logger'](_0x0d8b('0x6c'),_[_0x0d8b('0x67')](_0x28f9b7)?'':_0x28f9b7['name']+_0x0d8b('0x6d'));return{'isValid':![],'message':'Trunk\x20not\x20working'};}if(_[_0x0d8b('0x67')](_0x3f1eee[_0x0d8b('0x6')])){ut[_0x0d8b('0x48')](_0x0d8b('0x6e'),JSON[_0x0d8b('0x40')](_0x3f1eee));return{'isValid':![],'message':_0x0d8b('0x6f')};}if(_[_0x0d8b('0x67')](_0x3f1eee[_0x0d8b('0x2')])){ut[_0x0d8b('0x48')](_0x0d8b('0x70'),JSON[_0x0d8b('0x40')](_0x3f1eee));return{'isValid':![],'message':_0x0d8b('0x71')};}return{'isValid':!![],'message':'Is\x20Valid'};};module['exports']=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 7086100..3f218bb 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 _0xe8df=['inspect','notify','resolve','then','catch','bluebird','../../../config/logger','preview','lodash','../rpc/faxAccount','error'];(function(_0x112d20,_0x4bd3b6){var _0x48c4ce=function(_0x4715da){while(--_0x4715da){_0x112d20['push'](_0x112d20['shift']());}};_0x48c4ce(++_0x4bd3b6);}(_0xe8df,0x94));var _0xfe8d=function(_0x1aa2c2,_0x4f51ee){_0x1aa2c2=_0x1aa2c2-0x0;var _0x3cf3d5=_0xe8df[_0x1aa2c2];return _0x3cf3d5;};'use strict';var util=require('util');var BPromise=require(_0xfe8d('0x0'));var logger=require(_0xfe8d('0x1'))(_0xfe8d('0x2'));var _=require(_0xfe8d('0x3'));var faxAccount=require(_0xfe8d('0x4'));function loggerCatch(_0x3bbfc9){return function(_0x4bcfb1){logger[_0xfe8d('0x5')](_0x3bbfc9,util[_0xfe8d('0x6')](_0x4bcfb1,{'showHidden':![],'depth':null}));};}exports[_0xfe8d('0x7')]=function(_0x2a20da,_0x2dbcc){return BPromise[_0xfe8d('0x8')]()[_0xfe8d('0x9')](faxAccount[_0xfe8d('0x7')](_0x2a20da,_0x2dbcc))[_0xfe8d('0xa')](loggerCatch('[Notify]\x20'));}; \ No newline at end of file +var _0x556c=['inspect','notify','resolve','then','[Notify]\x20','util','bluebird','../../../config/logger','preview','lodash','../rpc/faxAccount','error'];(function(_0x3367b7,_0x1e0234){var _0x52bb97=function(_0x2155f2){while(--_0x2155f2){_0x3367b7['push'](_0x3367b7['shift']());}};_0x52bb97(++_0x1e0234);}(_0x556c,0xa1));var _0xc556=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x556c[_0x20a584];return _0x4b41a8;};'use strict';var util=require(_0xc556('0x0'));var BPromise=require(_0xc556('0x1'));var logger=require(_0xc556('0x2'))(_0xc556('0x3'));var _=require(_0xc556('0x4'));var faxAccount=require(_0xc556('0x5'));function loggerCatch(_0x9d4950){return function(_0x3d0d11){logger[_0xc556('0x6')](_0x9d4950,util[_0xc556('0x7')](_0x3d0d11,{'showHidden':![],'depth':null}));};}exports[_0xc556('0x8')]=function(_0x384e6f,_0x10061b){return BPromise[_0xc556('0x9')]()[_0xc556('0xa')](faxAccount[_0xc556('0x8')](_0x384e6f,_0x10061b))['catch'](loggerCatch(_0xc556('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 c798254..dd0a4f2 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 _0x206c=['fax','bluebird','child_process','execute','info','Exec\x20gs','\x20Error\x20:','inspect','util','../../../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x206c,0x166));var _0xc206=function(_0x104ada,_0xc16fff){_0x104ada=_0x104ada-0x0;var _0x70ab44=_0x206c[_0x104ada];return _0x70ab44;};'use strict';var util=require(_0xc206('0x0'));var logger=require(_0xc206('0x1'))(_0xc206('0x2'));var BPromise=require(_0xc206('0x3'));var exec=require(_0xc206('0x4'))['exec'];exports[_0xc206('0x5')]=function(_0x9f4c6f){return new BPromise(function(_0x557a1b,_0x2a85ad){exec(_0x9f4c6f,function(_0x3dabb8,_0x1aa796,_0x477c36){logger[_0xc206('0x6')]('Exec\x20gs',_0x1aa796);if(_0x3dabb8){logger['info'](_0xc206('0x7'),_0xc206('0x8'),util[_0xc206('0x9')](_0x3dabb8,{'showHidden':![],'depth':null}),_0x1aa796,_0x477c36);_0x2a85ad(_0x3dabb8);}_0x557a1b(_0x1aa796);});});}; \ No newline at end of file +var _0xcf01=['bluebird','child_process','exec','execute','Exec\x20gs','info','\x20Error\x20:','inspect','util','fax'];(function(_0x1db863,_0x14dd91){var _0x4910ce=function(_0xe7ff99){while(--_0xe7ff99){_0x1db863['push'](_0x1db863['shift']());}};_0x4910ce(++_0x14dd91);}(_0xcf01,0x15c));var _0x1cf0=function(_0x51bb38,_0x4e57a0){_0x51bb38=_0x51bb38-0x0;var _0x51c09b=_0xcf01[_0x51bb38];return _0x51c09b;};'use strict';var util=require(_0x1cf0('0x0'));var logger=require('../../../../config/logger')(_0x1cf0('0x1'));var BPromise=require(_0x1cf0('0x2'));var exec=require(_0x1cf0('0x3'))[_0x1cf0('0x4')];exports[_0x1cf0('0x5')]=function(_0x7173bb){return new BPromise(function(_0xb7b773,_0x75d5ab){exec(_0x7173bb,function(_0x1e447f,_0x322154,_0x1781ea){logger['info'](_0x1cf0('0x6'),_0x322154);if(_0x1e447f){logger[_0x1cf0('0x7')]('Exec\x20gs',_0x1cf0('0x8'),util[_0x1cf0('0x9')](_0x1e447f,{'showHidden':![],'depth':null}),_0x322154,_0x1781ea);_0x75d5ab(_0x1e447f);}_0xb7b773(_0x322154);});});}; \ 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 51a6156..0a6eca5 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 _0x5f66=['format','\x22%s\x22','modem','faxdetect','t38timeout','localstationid','path','uniqueid','originate','channel','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','util','moment','../../../../config/logger','message','info','inspect','headerinfo'];(function(_0x3d4768,_0x3bbb11){var _0x1f895c=function(_0x532e95){while(--_0x532e95){_0x3d4768['push'](_0x3d4768['shift']());}};_0x1f895c(++_0x3bbb11);}(_0x5f66,0x139));var _0x65f6=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0x5f66[_0x122096];return _0x3d1966;};'use strict';var util=require(_0x65f6('0x0'));var _=require('lodash');var moment=require(_0x65f6('0x1'));var logger=require(_0x65f6('0x2'))('fax');exports[_0x65f6('0x3')]=function(_0x20eef5){return{'message':_0x20eef5};};exports['logger']=function(_0x24b506,_0x5cf7a4){logger[_0x65f6('0x4')](_0x24b506,util[_0x65f6('0x5')](_0x5cf7a4,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x31dabb,_0x500aff){var _0x479ccb={'XMF-ECM':_0x500aff['ecm'],'XMF-HEADERINFO':_0x500aff[_0x65f6('0x6')],'XMF-MINRATE':_0x500aff['minrate'],'XMF-MAXRATE':_0x500aff['maxrate'],'XMF-MODEM':util[_0x65f6('0x7')](_0x65f6('0x8'),_0x500aff[_0x65f6('0x9')]),'XMF-GATEWAY':_0x500aff['gateway'],'XMF-FAXDETECT':_0x500aff[_0x65f6('0xa')],'XMF-T38TIMEOUT':_0x500aff[_0x65f6('0xb')],'XMF-LOCALSTATIONID':_0x500aff[_0x65f6('0xc')],'XMF-PATH':_0x31dabb[_0x65f6('0xd')]};return _0x479ccb;};exports['variablesAction']=function(_0xc8c571,_0x1b94f1){return{'actionid':_0xc8c571[_0x65f6('0xe')],'action':_0x65f6('0xf'),'channel':_0xc8c571[_0x65f6('0x10')],'Exten':_0x65f6('0x11'),'Context':_0x65f6('0x12'),'Priority':'1','callerid':util[_0x65f6('0x7')](_0x65f6('0x13'),_0xc8c571[_0x65f6('0x6')]?_0xc8c571['headerinfo']:'',_0xc8c571[_0x65f6('0xc')]),'variable':_0x1b94f1,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0xc8c571[_0x65f6('0xe')]};}; \ No newline at end of file +var _0xf4f3=['headerinfo','moment','../../../../config/logger','fax','message','logger','info','inspect','addVariables','ecm','minrate','format','\x22%s\x22','gateway','faxdetect','t38timeout','localstationid','path','variablesAction','uniqueid','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>'];(function(_0x1634fd,_0x53b8d3){var _0x304512=function(_0xa0c4e0){while(--_0xa0c4e0){_0x1634fd['push'](_0x1634fd['shift']());}};_0x304512(++_0x53b8d3);}(_0xf4f3,0x171));var _0x3f4f=function(_0x520bcc,_0x58fece){_0x520bcc=_0x520bcc-0x0;var _0x4ac8e0=_0xf4f3[_0x520bcc];return _0x4ac8e0;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x3f4f('0x0'));var logger=require(_0x3f4f('0x1'))(_0x3f4f('0x2'));exports[_0x3f4f('0x3')]=function(_0x38df68){return{'message':_0x38df68};};exports[_0x3f4f('0x4')]=function(_0x162a6f,_0x1a5e8f){logger[_0x3f4f('0x5')](_0x162a6f,util[_0x3f4f('0x6')](_0x1a5e8f,{'showHidden':![],'depth':null}));};exports[_0x3f4f('0x7')]=function(_0x33fafe,_0x75918){var _0x24146a={'XMF-ECM':_0x75918[_0x3f4f('0x8')],'XMF-HEADERINFO':_0x75918['headerinfo'],'XMF-MINRATE':_0x75918[_0x3f4f('0x9')],'XMF-MAXRATE':_0x75918['maxrate'],'XMF-MODEM':util[_0x3f4f('0xa')](_0x3f4f('0xb'),_0x75918['modem']),'XMF-GATEWAY':_0x75918[_0x3f4f('0xc')],'XMF-FAXDETECT':_0x75918[_0x3f4f('0xd')],'XMF-T38TIMEOUT':_0x75918[_0x3f4f('0xe')],'XMF-LOCALSTATIONID':_0x75918[_0x3f4f('0xf')],'XMF-PATH':_0x33fafe[_0x3f4f('0x10')]};return _0x24146a;};exports[_0x3f4f('0x11')]=function(_0x3133b0,_0x5cd28a){return{'actionid':_0x3133b0[_0x3f4f('0x12')],'action':'originate','channel':_0x3133b0['channel'],'Exten':_0x3f4f('0x13'),'Context':_0x3f4f('0x14'),'Priority':'1','callerid':util[_0x3f4f('0xa')](_0x3f4f('0x15'),_0x3133b0[_0x3f4f('0x16')]?_0x3133b0[_0x3f4f('0x16')]:'',_0x3133b0[_0x3f4f('0xf')]),'variable':_0x5cd28a,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x3133b0[_0x3f4f('0x12')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 5a9c82f..fe4ee5c 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 _0xcbf1=['./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','../../config/logger','ami','get','hour','resolve','then','getTelephones','initTelephones','getTrunks','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','initFreshdeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','getCampaigns','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','inspect','sync','error','[index.js][main]','bluebird','./server','./realtime','./report','./acw','./trigger','./preview','./rpc/user','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcbf1,0xc1));var _0x1cbf=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xcbf1[_0x397e5f];return _0x5302b8;};'use strict';var BPromise=require(_0x1cbf('0x0'));var util=require('util');var moment=require('moment');var server=require(_0x1cbf('0x1'));var Realtime=require(_0x1cbf('0x2'));var Report=require(_0x1cbf('0x3'));var Acw=require(_0x1cbf('0x4'));var Trigger=require(_0x1cbf('0x5'));var Dialer=require('./dialer');var Preview=require(_0x1cbf('0x6'));var Fax=require('./fax');var user=require(_0x1cbf('0x7'));var voiceQueue=require('./rpc/voiceQueue');var voiceQueueReport=require(_0x1cbf('0x8'));var voiceCallReport=require(_0x1cbf('0x9'));var trunk=require(_0x1cbf('0xa'));var trigger=require('./rpc/trigger');var template=require(_0x1cbf('0xb'));var cmHopperHistory=require(_0x1cbf('0xc'));var campaign=require(_0x1cbf('0xd'));var voiceExtension=require(_0x1cbf('0xe'));var faxAccount=require(_0x1cbf('0xf'));var zendesk=require(_0x1cbf('0x10'));var salesforce=require(_0x1cbf('0x11'));var sugarcrm=require(_0x1cbf('0x12'));var freshdesk=require(_0x1cbf('0x13'));var desk=require(_0x1cbf('0x14'));var zoho=require(_0x1cbf('0x15'));var vtiger=require(_0x1cbf('0x16'));var freshsales=require('./rpc/integrations/freshsales');var servicenow=require(_0x1cbf('0x17'));var dynamics365=require(_0x1cbf('0x18'));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(_0x1cbf('0x19'))(_0x1cbf('0x1a'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x1cbf('0x1b')](_0x1cbf('0x1c'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x1cbf('0x1b')](_0x1cbf('0x1c'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x1cbf('0x1d')]()[_0x1cbf('0x1e')](user['getAgents']())[_0x1cbf('0x1e')](realtime['initAgents']())[_0x1cbf('0x1e')](user[_0x1cbf('0x1f')]())['then'](realtime[_0x1cbf('0x20')]())[_0x1cbf('0x1e')](trunk[_0x1cbf('0x21')]())[_0x1cbf('0x1e')](realtime['initTrunks']())[_0x1cbf('0x1e')](voiceQueue['getVoiceQueues']())[_0x1cbf('0x1e')](realtime['initVoiceQueues']())[_0x1cbf('0x1e')](trigger[_0x1cbf('0x22')]())[_0x1cbf('0x1e')](realtime[_0x1cbf('0x23')]())[_0x1cbf('0x1e')](template[_0x1cbf('0x24')]())[_0x1cbf('0x1e')](realtime[_0x1cbf('0x25')]())['then'](zendesk[_0x1cbf('0x26')]())[_0x1cbf('0x1e')](realtime[_0x1cbf('0x27')]())[_0x1cbf('0x1e')](salesforce[_0x1cbf('0x28')]())['then'](realtime[_0x1cbf('0x29')]())['then'](sugarcrm[_0x1cbf('0x2a')]())[_0x1cbf('0x1e')](realtime[_0x1cbf('0x2b')]())[_0x1cbf('0x1e')](freshdesk['getFreshdeskAccounts']())[_0x1cbf('0x1e')](realtime[_0x1cbf('0x2c')]())[_0x1cbf('0x1e')](desk['getDeskAccounts']())['then'](realtime[_0x1cbf('0x2d')]())[_0x1cbf('0x1e')](zoho[_0x1cbf('0x2e')]())[_0x1cbf('0x1e')](realtime[_0x1cbf('0x2f')]())[_0x1cbf('0x1e')](vtiger[_0x1cbf('0x30')]())['then'](realtime[_0x1cbf('0x31')]())[_0x1cbf('0x1e')](freshsales[_0x1cbf('0x32')]())[_0x1cbf('0x1e')](realtime[_0x1cbf('0x33')]())[_0x1cbf('0x1e')](servicenow[_0x1cbf('0x34')]())['then'](realtime[_0x1cbf('0x35')]())[_0x1cbf('0x1e')](dynamics365[_0x1cbf('0x36')]())[_0x1cbf('0x1e')](realtime['initDynamics365Accounts']())[_0x1cbf('0x1e')](campaign[_0x1cbf('0x37')]())['then'](realtime['initCampaigns']())[_0x1cbf('0x1e')](voiceExtension['getVoiceExtensions']())['then'](realtime[_0x1cbf('0x38')]())['then'](faxAccount[_0x1cbf('0x39')]())['then'](realtime[_0x1cbf('0x3a')]())[_0x1cbf('0x1e')](function(){return realtime;});}function initParams(){return BPromise[_0x1cbf('0x1d')]()[_0x1cbf('0x1e')](voiceQueueReport[_0x1cbf('0x3b')]())[_0x1cbf('0x1e')](realtime['initVoiceQueueReports']())['then'](cmHopperHistory[_0x1cbf('0x3c')]())[_0x1cbf('0x1e')](realtime[_0x1cbf('0x3d')]())[_0x1cbf('0x1e')](cmHopperHistory[_0x1cbf('0x3e')]())[_0x1cbf('0x1e')](realtime[_0x1cbf('0x3f')]())[_0x1cbf('0x1e')](voiceCallReport[_0x1cbf('0x40')]())[_0x1cbf('0x1e')](realtime[_0x1cbf('0x41')]())[_0x1cbf('0x42')](function(_0x3f6fd3){logger['error']('[index.js][initParams]',util[_0x1cbf('0x43')](_0x3f6fd3,{'showHidden':![],'depth':null}));});}function main(){return server['listen'](realtime,preview,fax)[_0x1cbf('0x1e')](function(_0x2eb982){return initRealtime();})[_0x1cbf('0x1e')](function(){return initParams();})[_0x1cbf('0x1e')](function(){report[_0x1cbf('0x44')]();setInterval(initRealtime,0x1388);})['catch'](function(_0x242925){logger[_0x1cbf('0x45')](_0x1cbf('0x46'),util[_0x1cbf('0x43')](_0x242925,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0x8422=['initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','initCampaigns','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','initCampaignHopperHistory','getVoiceCallReports','error','[index.js][initParams]','inspect','listen','sync','[index.js][main]','bluebird','util','moment','./server','./realtime','./report','./trigger','./dialer','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','../../config/logger','ami','get','hour','getAgents','then','getTelephones','initTelephones','getTrunks','initTrunks','getVoiceQueues','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSugarcrmAccounts','initSugarcrmAccounts','initFreshdeskAccounts','initDeskAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts'];(function(_0x413f05,_0x17d257){var _0xf54f79=function(_0x1ce14d){while(--_0x1ce14d){_0x413f05['push'](_0x413f05['shift']());}};_0xf54f79(++_0x17d257);}(_0x8422,0x1b7));var _0x2842=function(_0x42c6f1,_0x338d7b){_0x42c6f1=_0x42c6f1-0x0;var _0x3c7398=_0x8422[_0x42c6f1];return _0x3c7398;};'use strict';var BPromise=require(_0x2842('0x0'));var util=require(_0x2842('0x1'));var moment=require(_0x2842('0x2'));var server=require(_0x2842('0x3'));var Realtime=require(_0x2842('0x4'));var Report=require(_0x2842('0x5'));var Acw=require('./acw');var Trigger=require(_0x2842('0x6'));var Dialer=require(_0x2842('0x7'));var Preview=require('./preview');var Fax=require(_0x2842('0x8'));var user=require(_0x2842('0x9'));var voiceQueue=require(_0x2842('0xa'));var voiceQueueReport=require(_0x2842('0xb'));var voiceCallReport=require(_0x2842('0xc'));var trunk=require(_0x2842('0xd'));var trigger=require(_0x2842('0xe'));var template=require('./rpc/template');var cmHopperHistory=require(_0x2842('0xf'));var campaign=require(_0x2842('0x10'));var voiceExtension=require(_0x2842('0x11'));var faxAccount=require(_0x2842('0x12'));var zendesk=require(_0x2842('0x13'));var salesforce=require(_0x2842('0x14'));var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require(_0x2842('0x15'));var desk=require(_0x2842('0x16'));var zoho=require(_0x2842('0x17'));var vtiger=require('./rpc/integrations/vtiger');var freshsales=require('./rpc/integrations/freshsales');var servicenow=require(_0x2842('0x18'));var dynamics365=require(_0x2842('0x19'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0x2842('0x1a'))(_0x2842('0x1b'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x2842('0x1c')](_0x2842('0x1d'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get'](_0x2842('0x1d'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise['resolve']()['then'](user[_0x2842('0x1e')]())[_0x2842('0x1f')](realtime['initAgents']())['then'](user[_0x2842('0x20')]())[_0x2842('0x1f')](realtime[_0x2842('0x21')]())[_0x2842('0x1f')](trunk[_0x2842('0x22')]())[_0x2842('0x1f')](realtime[_0x2842('0x23')]())['then'](voiceQueue[_0x2842('0x24')]())[_0x2842('0x1f')](realtime['initVoiceQueues']())[_0x2842('0x1f')](trigger['getTriggers']())['then'](realtime[_0x2842('0x25')]())['then'](template[_0x2842('0x26')]())['then'](realtime[_0x2842('0x27')]())['then'](zendesk[_0x2842('0x28')]())[_0x2842('0x1f')](realtime[_0x2842('0x29')]())[_0x2842('0x1f')](salesforce['getSalesforceAccounts']())[_0x2842('0x1f')](realtime['initSalesforceAccounts']())[_0x2842('0x1f')](sugarcrm[_0x2842('0x2a')]())[_0x2842('0x1f')](realtime[_0x2842('0x2b')]())[_0x2842('0x1f')](freshdesk['getFreshdeskAccounts']())[_0x2842('0x1f')](realtime[_0x2842('0x2c')]())['then'](desk['getDeskAccounts']())[_0x2842('0x1f')](realtime[_0x2842('0x2d')]())[_0x2842('0x1f')](zoho['getZohoAccounts']())['then'](realtime['initZohoAccounts']())[_0x2842('0x1f')](vtiger[_0x2842('0x2e')]())['then'](realtime[_0x2842('0x2f')]())['then'](freshsales[_0x2842('0x30')]())[_0x2842('0x1f')](realtime[_0x2842('0x31')]())['then'](servicenow[_0x2842('0x32')]())[_0x2842('0x1f')](realtime[_0x2842('0x33')]())[_0x2842('0x1f')](dynamics365[_0x2842('0x34')]())[_0x2842('0x1f')](realtime[_0x2842('0x35')]())['then'](campaign['getCampaigns']())['then'](realtime[_0x2842('0x36')]())[_0x2842('0x1f')](voiceExtension['getVoiceExtensions']())[_0x2842('0x1f')](realtime[_0x2842('0x37')]())[_0x2842('0x1f')](faxAccount[_0x2842('0x38')]())[_0x2842('0x1f')](realtime[_0x2842('0x39')]())[_0x2842('0x1f')](function(){return realtime;});}function initParams(){return BPromise['resolve']()[_0x2842('0x1f')](voiceQueueReport[_0x2842('0x3a')]())['then'](realtime[_0x2842('0x3b')]())[_0x2842('0x1f')](cmHopperHistory[_0x2842('0x3c')]())[_0x2842('0x1f')](realtime[_0x2842('0x3d')]())[_0x2842('0x1f')](cmHopperHistory['getCampaignHopperHistory']())['then'](realtime[_0x2842('0x3e')]())[_0x2842('0x1f')](voiceCallReport[_0x2842('0x3f')]())['then'](realtime['initVoiceCallReports']())['catch'](function(_0x2c2ba1){logger[_0x2842('0x40')](_0x2842('0x41'),util[_0x2842('0x42')](_0x2c2ba1,{'showHidden':![],'depth':null}));});}function main(){return server[_0x2842('0x43')](realtime,preview,fax)[_0x2842('0x1f')](function(_0x3f6ca0){return initRealtime();})['then'](function(){return initParams();})[_0x2842('0x1f')](function(){report[_0x2842('0x44')]();setInterval(initRealtime,0x1388);})['catch'](function(_0x15238f){logger[_0x2842('0x40')](_0x2842('0x45'),util['inspect'](_0x15238f,{'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 2b47884..c59fa70 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 _0xcb91=['name','email','accountcode','fullname','unknown','stateTime','status','address','mobile','interface','online','voiceStatus','voiceStatusQueue','onhold','local','updateStatusRealtime','state','idle','inuse','talking','statePause','voiceStatusTime','toNumber','voiceStatusCallerIdNumber','stringify','format','emit','user:presence','exports','moment','md5','ioredis','../../../config/environment','defaults','redis','socket.io-emitter'];(function(_0x2a539f,_0x4671ef){var _0x5005cd=function(_0x515ecc){while(--_0x515ecc){_0x2a539f['push'](_0x2a539f['shift']());}};_0x5005cd(++_0x4671ef);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x469a3c,_0x5ebc10){_0x469a3c=_0x469a3c-0x0;var _0x968f4=_0xcb91[_0x469a3c];return _0x968f4;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var md5=require(_0x1cb9('0x1'));var Redis=require(_0x1cb9('0x2'));var config=require(_0x1cb9('0x3'));config['redis']=_[_0x1cb9('0x4')](config[_0x1cb9('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x1cb9('0x6'))(new Redis(config[_0x1cb9('0x5')]));function Agent(_0x53ffbd){this['id']=_0x53ffbd['id']||0x0;this[_0x1cb9('0x7')]=_0x53ffbd[_0x1cb9('0x7')]||'';this['email']=_0x53ffbd[_0x1cb9('0x8')]||'';this[_0x1cb9('0x9')]=_0x53ffbd['accountcode']||'';this[_0x1cb9('0xa')]=_0x53ffbd['fullname']||'';this['state']=_0x1cb9('0xb');this[_0x1cb9('0xc')]=0x0;this[_0x1cb9('0xd')]=_0x1cb9('0xb');this[_0x1cb9('0xe')]='';this['phone']='';this[_0x1cb9('0xf')]='';this[_0x1cb9('0x10')]='';this[_0x1cb9('0x11')]=_0x53ffbd[_0x1cb9('0x11')]||![];this[_0x1cb9('0x12')]='unknown';this['voiceStatusTime']=0x0;this['voiceStatusCallerIdNumber']='';this[_0x1cb9('0x13')]='';this[_0x1cb9('0x14')]=![];this[_0x1cb9('0x15')]=![];this[_0x1cb9('0x1')]='';}Agent['prototype'][_0x1cb9('0x16')]=function(_0x6ef389){var _0x1b3cd7;if(_0x6ef389&&_0x6ef389[_0x1cb9('0x17')]){_0x1b3cd7=_0x6ef389[_0x1cb9('0x17')]['toLowerCase']();switch(_0x1b3cd7){case'not_inuse':_0x1b3cd7=_0x1cb9('0x18');break;case _0x1cb9('0x19'):_0x1b3cd7=_0x1cb9('0x1a');break;}}if(_0x1b3cd7&&this[_0x1cb9('0x12')]!==_0x1b3cd7||_0x6ef389[_0x1cb9('0x1b')]){this[_0x1cb9('0x1c')]=_[_0x1cb9('0x1d')](moment()['format']('x'));}if(_0x1b3cd7){this['voiceStatus']=_0x1b3cd7;}var _0x1b2fa6={'id':this['id'],'name':this[_0x1cb9('0x7')],'email':this[_0x1cb9('0x8')],'accountcode':this[_0x1cb9('0x9')],'fullname':this[_0x1cb9('0xa')],'state':this[_0x1cb9('0x17')],'stateTime':this[_0x1cb9('0xc')],'status':this['status'],'address':this['address'],'online':this[_0x1cb9('0x11')],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this[_0x1cb9('0x1c')],'voiceStatusCallerIdNumber':this[_0x1cb9('0x1e')],'voiceStatusQueue':this['voiceStatusQueue'],'interface':this['interface'],'onhold':this[_0x1cb9('0x14')]};var _0x325637=md5(JSON[_0x1cb9('0x1f')](_0x1b2fa6));if(this[_0x1cb9('0x1')]!==_0x325637){this[_0x1cb9('0x1')]=_0x325637;io['to'](util[_0x1cb9('0x20')]('user:%s',_0x1b2fa6['name']))[_0x1cb9('0x21')]('user:save',_0x1b2fa6);io[_0x1cb9('0x21')](_0x1cb9('0x22'),_0x1b2fa6);}};module[_0x1cb9('0x23')]=Agent; \ No newline at end of file +var _0xe706=['address','phone','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','updateStatusRealtime','not_inuse','inuse','talking','format','interface','stringify','md5','user:%s','emit','user:presence','lodash','util','moment','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','email','accountcode','fullname','state','unknown','stateTime','status'];(function(_0x43171f,_0x43b445){var _0x1dcd07=function(_0x71e817){while(--_0x71e817){_0x43171f['push'](_0x43171f['shift']());}};_0x1dcd07(++_0x43b445);}(_0xe706,0xa3));var _0x6e70=function(_0x4cf2bb,_0xc26020){_0x4cf2bb=_0x4cf2bb-0x0;var _0x44e779=_0xe706[_0x4cf2bb];return _0x44e779;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var md5=require('md5');var Redis=require(_0x6e70('0x3'));var config=require(_0x6e70('0x4'));config[_0x6e70('0x5')]=_[_0x6e70('0x6')](config[_0x6e70('0x5')],{'host':_0x6e70('0x7'),'port':0x18eb});var io=require(_0x6e70('0x8'))(new Redis(config[_0x6e70('0x5')]));function Agent(_0x1b0389){this['id']=_0x1b0389['id']||0x0;this[_0x6e70('0x9')]=_0x1b0389[_0x6e70('0x9')]||'';this[_0x6e70('0xa')]=_0x1b0389[_0x6e70('0xa')]||'';this[_0x6e70('0xb')]=_0x1b0389[_0x6e70('0xb')]||'';this[_0x6e70('0xc')]=_0x1b0389[_0x6e70('0xc')]||'';this[_0x6e70('0xd')]=_0x6e70('0xe');this[_0x6e70('0xf')]=0x0;this[_0x6e70('0x10')]=_0x6e70('0xe');this[_0x6e70('0x11')]='';this[_0x6e70('0x12')]='';this['mobile']='';this['interface']='';this[_0x6e70('0x13')]=_0x1b0389[_0x6e70('0x13')]||![];this[_0x6e70('0x14')]=_0x6e70('0xe');this[_0x6e70('0x15')]=0x0;this[_0x6e70('0x16')]='';this[_0x6e70('0x17')]='';this[_0x6e70('0x18')]=![];this['local']=![];this['md5']='';}Agent['prototype'][_0x6e70('0x19')]=function(_0x5a37a6){var _0x53aed0;if(_0x5a37a6&&_0x5a37a6[_0x6e70('0xd')]){_0x53aed0=_0x5a37a6[_0x6e70('0xd')]['toLowerCase']();switch(_0x53aed0){case _0x6e70('0x1a'):_0x53aed0='idle';break;case _0x6e70('0x1b'):_0x53aed0=_0x6e70('0x1c');break;}}if(_0x53aed0&&this['voiceStatus']!==_0x53aed0||_0x5a37a6['statePause']){this[_0x6e70('0x15')]=_['toNumber'](moment()[_0x6e70('0x1d')]('x'));}if(_0x53aed0){this[_0x6e70('0x14')]=_0x53aed0;}var _0x53acdc={'id':this['id'],'name':this['name'],'email':this[_0x6e70('0xa')],'accountcode':this[_0x6e70('0xb')],'fullname':this[_0x6e70('0xc')],'state':this[_0x6e70('0xd')],'stateTime':this[_0x6e70('0xf')],'status':this[_0x6e70('0x10')],'address':this[_0x6e70('0x11')],'online':this[_0x6e70('0x13')],'voiceStatus':this[_0x6e70('0x14')],'voiceStatusTime':this[_0x6e70('0x15')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this[_0x6e70('0x17')],'interface':this[_0x6e70('0x1e')],'onhold':this[_0x6e70('0x18')]};var _0x502b2d=md5(JSON[_0x6e70('0x1f')](_0x53acdc));if(this[_0x6e70('0x20')]!==_0x502b2d){this[_0x6e70('0x20')]=_0x502b2d;io['to'](util['format'](_0x6e70('0x21'),_0x53acdc['name']))['emit']('user:save',_0x53acdc);io[_0x6e70('0x22')](_0x6e70('0x23'),_0x53acdc);}};module['exports']=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 4a09b04..a59e710 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 _0x2937=['dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','name','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','type','campaign','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x2937,0x1dc));var _0x7293=function(_0x3ddcf6,_0x373cc3){_0x3ddcf6=_0x3ddcf6-0x0;var _0x444036=_0x2937[_0x3ddcf6];return _0x444036;};'use strict';function Campaign(_0x30c653){this['id']=_0x30c653['id']||0x0;this['name']=_0x30c653['name']||'';this['type']=_0x30c653[_0x7293('0x0')]||_0x7293('0x1');this[_0x7293('0x2')]=0x0;this[_0x7293('0x3')]=0x0;this[_0x7293('0x4')]=0x0;this[_0x7293('0x5')]=0x0;this[_0x7293('0x6')]='';this[_0x7293('0x7')]=!![];this['active']=_0x30c653['active'];this[_0x7293('0x8')]=_0x30c653[_0x7293('0x8')];this[_0x7293('0x9')]=_0x30c653[_0x7293('0x9')]||null;this[_0x7293('0xa')]=_0x30c653[_0x7293('0xa')]?_0x30c653[_0x7293('0xa')]:null;this[_0x7293('0xb')]=_0x30c653['dialOriginateCallerIdName'];this['dialOriginateCallerIdNumber']=_0x30c653[_0x7293('0xc')];this['dialOriginateTimeout']=_0x30c653[_0x7293('0xd')]||0x1e;this[_0x7293('0xe')]=_0x30c653[_0x7293('0xe')];this[_0x7293('0xf')]=_0x30c653[_0x7293('0xf')];this[_0x7293('0x10')]=_0x30c653[_0x7293('0x10')];this[_0x7293('0x11')]=_0x30c653[_0x7293('0x11')];this[_0x7293('0x12')]=_0x30c653[_0x7293('0x12')];this[_0x7293('0x13')]=_0x30c653[_0x7293('0x13')];this[_0x7293('0x14')]=_0x30c653['dialGlobalMaxRetry'];this[_0x7293('0x15')]=_0x30c653[_0x7293('0x15')]||0x3;this[_0x7293('0x16')]=_0x30c653[_0x7293('0x16')]||0x96;this[_0x7293('0x17')]=_0x30c653[_0x7293('0x17')]||0x3;this[_0x7293('0x18')]=_0x30c653['dialDropRetryFrequency']||0x96;this[_0x7293('0x19')]=_0x30c653[_0x7293('0x19')]||0x3;this[_0x7293('0x1a')]=_0x30c653['dialAbandonedRetryFrequency']||0x96;this[_0x7293('0x1b')]=_0x30c653['dialMachineMaxRetry']||0x3;this[_0x7293('0x1c')]=_0x30c653[_0x7293('0x1c')]||0x96;this[_0x7293('0x1d')]=_0x30c653['dialAgentRejectMaxRetry']||0x3;this[_0x7293('0x1e')]=_0x30c653['dialAgentRejectRetryFrequency']||0x96;this[_0x7293('0x1f')]=_0x30c653[_0x7293('0x1f')]||'DESC';this[_0x7293('0x20')]=_0x30c653['dialPrefix']||undefined;this[_0x7293('0x21')]=_0x30c653[_0x7293('0x21')]||undefined;this[_0x7293('0x22')]=_0x30c653[_0x7293('0x22')]||undefined;this[_0x7293('0x23')]=_0x30c653[_0x7293('0x23')]?_0x30c653[_0x7293('0x23')]:undefined;this['Trunk']=_0x30c653[_0x7293('0x24')]?_0x30c653[_0x7293('0x24')]:undefined;this[_0x7293('0x25')]=_0x30c653[_0x7293('0x25')]?_0x30c653[_0x7293('0x25')]:undefined;this[_0x7293('0x26')]=_0x30c653[_0x7293('0x26')]?_0x30c653[_0x7293('0x26')]:undefined;this['dialQueueProject']=_0x30c653['SquareProject']?_0x30c653[_0x7293('0x26')][_0x7293('0x27')]:undefined;this[_0x7293('0x28')]=_0x30c653[_0x7293('0x28')]||![];this[_0x7293('0x29')]=_0x30c653[_0x7293('0x29')];this[_0x7293('0x2a')]=_0x30c653[_0x7293('0x2a')];this[_0x7293('0x2b')]=_0x30c653[_0x7293('0x2b')];this['dialAMDTotalAnalysisTime']=_0x30c653['dialAMDTotalAnalysisTime'];this[_0x7293('0x2c')]=_0x30c653[_0x7293('0x2c')];this['dialAMDBetweenWordsSilence']=_0x30c653[_0x7293('0x2d')];this[_0x7293('0x2e')]=_0x30c653['dialAMDMaximumNumberOfWords'];this[_0x7293('0x2f')]=_0x30c653[_0x7293('0x2f')];this['dialAMDMaximumWordLength']=_0x30c653[_0x7293('0x30')];}module[_0x7293('0x31')]=Campaign; \ No newline at end of file +var _0x5f30=['exports','name','type','campaign','temp','ivrAnswerCallsDay','ivrTotalCallsDays','sendMessageOneNotActive','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength'];(function(_0x8e1b5a,_0x19b8f8){var _0x352b12=function(_0x489960){while(--_0x489960){_0x8e1b5a['push'](_0x8e1b5a['shift']());}};_0x352b12(++_0x19b8f8);}(_0x5f30,0x91));var _0x05f3=function(_0x5275ac,_0x3b98f6){_0x5275ac=_0x5275ac-0x0;var _0x470b30=_0x5f30[_0x5275ac];return _0x470b30;};'use strict';function Campaign(_0x3b3539){this['id']=_0x3b3539['id']||0x0;this[_0x05f3('0x0')]=_0x3b3539[_0x05f3('0x0')]||'';this[_0x05f3('0x1')]=_0x3b3539[_0x05f3('0x1')]||_0x05f3('0x2');this['originated']=0x0;this[_0x05f3('0x3')]=0x0;this[_0x05f3('0x4')]=0x0;this[_0x05f3('0x5')]=0x0;this['message']='';this[_0x05f3('0x6')]=!![];this['active']=_0x3b3539['active'];this[_0x05f3('0x7')]=_0x3b3539[_0x05f3('0x7')];this[_0x05f3('0x8')]=_0x3b3539[_0x05f3('0x8')]||null;this['dialGlobalInterval']=_0x3b3539[_0x05f3('0x9')]?_0x3b3539[_0x05f3('0x9')]:null;this[_0x05f3('0xa')]=_0x3b3539['dialOriginateCallerIdName'];this[_0x05f3('0xb')]=_0x3b3539[_0x05f3('0xb')];this[_0x05f3('0xc')]=_0x3b3539[_0x05f3('0xc')]||0x1e;this[_0x05f3('0xd')]=_0x3b3539[_0x05f3('0xd')];this[_0x05f3('0xe')]=_0x3b3539[_0x05f3('0xe')];this[_0x05f3('0xf')]=_0x3b3539[_0x05f3('0xf')];this[_0x05f3('0x10')]=_0x3b3539['dialBusyRetryFrequency'];this[_0x05f3('0x11')]=_0x3b3539[_0x05f3('0x11')];this['dialNoAnswerRetryFrequency']=_0x3b3539[_0x05f3('0x12')];this[_0x05f3('0x13')]=_0x3b3539['dialGlobalMaxRetry'];this['dialNoSuchNumberMaxRetry']=_0x3b3539[_0x05f3('0x14')]||0x3;this[_0x05f3('0x15')]=_0x3b3539['dialNoSuchNumberRetryFrequency']||0x96;this['dialDropMaxRetry']=_0x3b3539[_0x05f3('0x16')]||0x3;this[_0x05f3('0x17')]=_0x3b3539[_0x05f3('0x17')]||0x96;this['dialAbandonedMaxRetry']=_0x3b3539[_0x05f3('0x18')]||0x3;this['dialAbandonedRetryFrequency']=_0x3b3539[_0x05f3('0x19')]||0x96;this[_0x05f3('0x1a')]=_0x3b3539['dialMachineMaxRetry']||0x3;this[_0x05f3('0x1b')]=_0x3b3539[_0x05f3('0x1b')]||0x96;this[_0x05f3('0x1c')]=_0x3b3539[_0x05f3('0x1c')]||0x3;this['dialAgentRejectRetryFrequency']=_0x3b3539['dialAgentRejectRetryFrequency']||0x96;this[_0x05f3('0x1d')]=_0x3b3539['dialOrderByScheduledAt']||_0x05f3('0x1e');this[_0x05f3('0x1f')]=_0x3b3539[_0x05f3('0x1f')]||undefined;this[_0x05f3('0x20')]=_0x3b3539[_0x05f3('0x20')]||undefined;this['dialCutDigit']=_0x3b3539[_0x05f3('0x21')]||undefined;this[_0x05f3('0x22')]=_0x3b3539[_0x05f3('0x22')]?_0x3b3539['TrunkBackup']:undefined;this[_0x05f3('0x23')]=_0x3b3539[_0x05f3('0x23')]?_0x3b3539[_0x05f3('0x23')]:undefined;this[_0x05f3('0x24')]=_0x3b3539[_0x05f3('0x24')]?_0x3b3539[_0x05f3('0x24')]:undefined;this[_0x05f3('0x25')]=_0x3b3539['SquareProject']?_0x3b3539[_0x05f3('0x25')]:undefined;this[_0x05f3('0x26')]=_0x3b3539[_0x05f3('0x25')]?_0x3b3539[_0x05f3('0x25')][_0x05f3('0x0')]:undefined;this[_0x05f3('0x27')]=_0x3b3539[_0x05f3('0x27')]||![];this['dialAMDInitialSilence']=_0x3b3539['dialAMDInitialSilence'];this[_0x05f3('0x28')]=_0x3b3539[_0x05f3('0x28')];this['dialAMDAfterGreetingSilence']=_0x3b3539['dialAMDAfterGreetingSilence'];this[_0x05f3('0x29')]=_0x3b3539['dialAMDTotalAnalysisTime'];this[_0x05f3('0x2a')]=_0x3b3539[_0x05f3('0x2a')];this[_0x05f3('0x2b')]=_0x3b3539[_0x05f3('0x2b')];this[_0x05f3('0x2c')]=_0x3b3539[_0x05f3('0x2c')];this[_0x05f3('0x2d')]=_0x3b3539[_0x05f3('0x2d')];this[_0x05f3('0x2e')]=_0x3b3539[_0x05f3('0x2e')];}module[_0x05f3('0x2f')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index cb3cf01..2342cd7 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 _0x49db=['monitorFilename','queue','monitors','transfercalleridnum','transferconnectedlinenum','transferType','mohtime','exports','starttime','channel','destinationchannel','calleridnum','calleridname','connectedlinename','accountcode','context','linkedid','answertime','endtime','unmanaged','lastapplication','lastdata','duration','billableseconds','holdtime','type','monitor'];(function(_0x431159,_0x1823d3){var _0x79f3e4=function(_0x4c22e3){while(--_0x4c22e3){_0x431159['push'](_0x431159['shift']());}};_0x79f3e4(++_0x1823d3);}(_0x49db,0xc5));var _0xb49d=function(_0x3e5a1e,_0x240f76){_0x3e5a1e=_0x3e5a1e-0x0;var _0x4db801=_0x49db[_0x3e5a1e];return _0x4db801;};'use strict';function Channel(){this[_0xb49d('0x0')]=null;this[_0xb49d('0x1')]='';this[_0xb49d('0x2')]='';this[_0xb49d('0x3')]=0x0;this[_0xb49d('0x4')]='';this['connectedlinenum']=undefined;this[_0xb49d('0x5')]=undefined;this[_0xb49d('0x6')]=0x0;this[_0xb49d('0x7')]='';this['uniqueid']=0x0;this[_0xb49d('0x8')]=0x0;this['exten']=0x0;this['answered']=![];this[_0xb49d('0x9')]=null;this[_0xb49d('0xa')]=null;this[_0xb49d('0xb')]=![];this['abandoned']=![];this[_0xb49d('0xc')]='';this[_0xb49d('0xd')]='';this[_0xb49d('0xe')]=0x0;this[_0xb49d('0xf')]=0x0;this[_0xb49d('0x10')]=0x0;this[_0xb49d('0x11')]=null;this['tag']=null;this['disposition']=null;this[_0xb49d('0x12')]=![];this[_0xb49d('0x13')]=null;this[_0xb49d('0x14')]=null;this[_0xb49d('0x15')]=[];this[_0xb49d('0x16')]=undefined;this[_0xb49d('0x17')]=undefined;this[_0xb49d('0x18')]=undefined;this[_0xb49d('0x19')]=0x0;}module[_0xb49d('0x1a')]=Channel; \ No newline at end of file +var _0xf79e=['destinationchannel','calleridnum','connectedlinenum','connectedlinename','uniqueid','linkedid','exten','answered','answertime','endtime','abandoned','lastdata','duration','holdtime','type','tag','disposition','monitor','monitorFilename','queue','monitors','transferconnectedlinenum','transferType','mohtime','exports','channel'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xf79e,0x185));var _0xef79=function(_0x4736b3,_0x2c1bc6){_0x4736b3=_0x4736b3-0x0;var _0x21945b=_0xf79e[_0x4736b3];return _0x21945b;};'use strict';function Channel(){this['starttime']=null;this[_0xef79('0x0')]='';this[_0xef79('0x1')]='';this[_0xef79('0x2')]=0x0;this['calleridname']='';this[_0xef79('0x3')]=undefined;this[_0xef79('0x4')]=undefined;this['accountcode']=0x0;this['context']='';this[_0xef79('0x5')]=0x0;this[_0xef79('0x6')]=0x0;this[_0xef79('0x7')]=0x0;this[_0xef79('0x8')]=![];this[_0xef79('0x9')]=null;this[_0xef79('0xa')]=null;this['unmanaged']=![];this[_0xef79('0xb')]=![];this['lastapplication']='';this[_0xef79('0xc')]='';this[_0xef79('0xd')]=0x0;this['billableseconds']=0x0;this[_0xef79('0xe')]=0x0;this[_0xef79('0xf')]=null;this[_0xef79('0x10')]=null;this[_0xef79('0x11')]=null;this[_0xef79('0x12')]=![];this[_0xef79('0x13')]=null;this[_0xef79('0x14')]=null;this[_0xef79('0x15')]=[];this['transfercalleridnum']=undefined;this[_0xef79('0x16')]=undefined;this[_0xef79('0x17')]=undefined;this[_0xef79('0x18')]=0x0;}module[_0xef79('0x19')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 88f358f..35c0aa7 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 _0x4552=['password','consumerKey','token','tokenSecret','type','exports','name','username','remoteUri','authType'];(function(_0x19d354,_0x84da5c){var _0x535977=function(_0x5a8a71){while(--_0x5a8a71){_0x19d354['push'](_0x19d354['shift']());}};_0x535977(++_0x84da5c);}(_0x4552,0xa6));var _0x2455=function(_0x3a0ae9,_0x4e574a){_0x3a0ae9=_0x3a0ae9-0x0;var _0x161d04=_0x4552[_0x3a0ae9];return _0x161d04;};'use strict';function DeskAccount(_0x355a49){this['id']=_0x355a49['id']||0x0;this[_0x2455('0x0')]=_0x355a49[_0x2455('0x0')]||'';this[_0x2455('0x1')]=_0x355a49[_0x2455('0x1')]||'';this[_0x2455('0x2')]=_0x355a49[_0x2455('0x2')]||'';this[_0x2455('0x3')]=_0x355a49[_0x2455('0x3')]||'';this[_0x2455('0x4')]=_0x355a49[_0x2455('0x4')]||'';this[_0x2455('0x5')]=_0x355a49[_0x2455('0x5')]||'';this['consumerSecret']=_0x355a49['consumerSecret']||'';this[_0x2455('0x6')]=_0x355a49[_0x2455('0x6')]||'';this['tokenSecret']=_0x355a49[_0x2455('0x7')]||'';this['type']=_0x355a49[_0x2455('0x8')]||'';this['serverUrl']=_0x355a49['serverUrl']||'';this['Configurations']=_0x355a49['Configurations']||{};}module[_0x2455('0x9')]=DeskAccount; \ No newline at end of file +var _0x667d=['tokenSecret','type','serverUrl','Configurations','name','username','remoteUri','authType','password','consumerKey','consumerSecret'];(function(_0x24c56e,_0x3eae6f){var _0x5282f9=function(_0x4484c4){while(--_0x4484c4){_0x24c56e['push'](_0x24c56e['shift']());}};_0x5282f9(++_0x3eae6f);}(_0x667d,0x1f3));var _0xd667=function(_0x2a3955,_0x33938a){_0x2a3955=_0x2a3955-0x0;var _0x5d985c=_0x667d[_0x2a3955];return _0x5d985c;};'use strict';function DeskAccount(_0x456d5d){this['id']=_0x456d5d['id']||0x0;this[_0xd667('0x0')]=_0x456d5d[_0xd667('0x0')]||'';this[_0xd667('0x1')]=_0x456d5d[_0xd667('0x1')]||'';this[_0xd667('0x2')]=_0x456d5d[_0xd667('0x2')]||'';this[_0xd667('0x3')]=_0x456d5d[_0xd667('0x3')]||'';this[_0xd667('0x4')]=_0x456d5d[_0xd667('0x4')]||'';this[_0xd667('0x5')]=_0x456d5d['consumerKey']||'';this[_0xd667('0x6')]=_0x456d5d[_0xd667('0x6')]||'';this['token']=_0x456d5d['token']||'';this['tokenSecret']=_0x456d5d[_0xd667('0x7')]||'';this['type']=_0x456d5d[_0xd667('0x8')]||'';this[_0xd667('0x9')]=_0x456d5d[_0xd667('0x9')]||'';this[_0xd667('0xa')]=_0x456d5d['Configurations']||{};}module['exports']=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index ba86625..c863be3 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 _0x6881=['modernAuthentication','Configurations','CloudProvider','exports','name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl'];(function(_0x3e61d2,_0x197e2a){var _0x46c776=function(_0x15096f){while(--_0x15096f){_0x3e61d2['push'](_0x3e61d2['shift']());}};_0x46c776(++_0x197e2a);}(_0x6881,0x148));var _0x1688=function(_0x843670,_0x23ec99){_0x843670=_0x843670-0x0;var _0x498266=_0x6881[_0x843670];return _0x498266;};'use strict';function Dynamics365Account(_0x5723e5){this['id']=_0x5723e5['id']||0x0;this['name']=_0x5723e5[_0x1688('0x0')]||'';this[_0x1688('0x1')]=_0x5723e5[_0x1688('0x1')]||'';this['password']=_0x5723e5[_0x1688('0x2')]||'';this[_0x1688('0x3')]=_0x5723e5['remoteUri']||'';this[_0x1688('0x4')]=_0x5723e5[_0x1688('0x4')]||'';this[_0x1688('0x5')]=_0x5723e5[_0x1688('0x5')]||'';this[_0x1688('0x6')]=_0x5723e5[_0x1688('0x6')]||{};this[_0x1688('0x7')]=_0x5723e5[_0x1688('0x7')]||'';this[_0x1688('0x8')]=_0x5723e5[_0x1688('0x8')]||![];this[_0x1688('0x9')]=_0x5723e5[_0x1688('0x9')]||{};this[_0x1688('0xa')]=_0x5723e5[_0x1688('0xa')]||{};}module[_0x1688('0xb')]=Dynamics365Account; \ No newline at end of file +var _0xaebb=['exports','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider'];(function(_0x543084,_0x4337f5){var _0x306a57=function(_0x2769ed){while(--_0x2769ed){_0x543084['push'](_0x543084['shift']());}};_0x306a57(++_0x4337f5);}(_0xaebb,0xfe));var _0xbaeb=function(_0xffa65c,_0x3aa2f3){_0xffa65c=_0xffa65c-0x0;var _0x2157ad=_0xaebb[_0xffa65c];return _0x2157ad;};'use strict';function Dynamics365Account(_0xcece3){this['id']=_0xcece3['id']||0x0;this['name']=_0xcece3['name']||'';this[_0xbaeb('0x0')]=_0xcece3[_0xbaeb('0x0')]||'';this[_0xbaeb('0x1')]=_0xcece3[_0xbaeb('0x1')]||'';this[_0xbaeb('0x2')]=_0xcece3[_0xbaeb('0x2')]||'';this[_0xbaeb('0x3')]=_0xcece3[_0xbaeb('0x3')]||'';this[_0xbaeb('0x4')]=_0xcece3[_0xbaeb('0x4')]||'';this[_0xbaeb('0x5')]=_0xcece3[_0xbaeb('0x5')]||{};this[_0xbaeb('0x6')]=_0xcece3[_0xbaeb('0x6')]||'';this[_0xbaeb('0x7')]=_0xcece3[_0xbaeb('0x7')]||![];this[_0xbaeb('0x8')]=_0xcece3[_0xbaeb('0x8')]||{};this[_0xbaeb('0x9')]=_0xcece3[_0xbaeb('0x9')]||{};}module[_0xbaeb('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 e7f4a82..82ee8bb 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 _0x57ea=['faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway'];(function(_0x1a1f3a,_0x1547a7){var _0xf8b031=function(_0x236ffb){while(--_0x236ffb){_0x1a1f3a['push'](_0x1a1f3a['shift']());}};_0xf8b031(++_0x1547a7);}(_0x57ea,0xc2));var _0xa57e=function(_0x582965,_0x58da5a){_0x582965=_0x582965-0x0;var _0x361185=_0x57ea[_0x582965];return _0x361185;};'use strict';function FaxAccount(_0x1e3d74){this['id']=_0x1e3d74['id']||0x0;this[_0xa57e('0x0')]=_0x1e3d74[_0xa57e('0x0')]||'';this[_0xa57e('0x1')]=_0x1e3d74[_0xa57e('0x1')];this[_0xa57e('0x2')]=_0x1e3d74['ecm'];this[_0xa57e('0x3')]=_0x1e3d74[_0xa57e('0x3')];this[_0xa57e('0x4')]=_0x1e3d74['localstationid'];this[_0xa57e('0x5')]=_0x1e3d74['minrate']||0x960;this[_0xa57e('0x6')]=_0x1e3d74['maxrate']||0x3840;this['modem']=_0x1e3d74[_0xa57e('0x7')]||_0xa57e('0x8');this['gateway']=_0x1e3d74[_0xa57e('0x9')]||'no';this['faxdetect']=_0x1e3d74[_0xa57e('0xa')]||'no';this[_0xa57e('0xb')]=_0x1e3d74[_0xa57e('0xb')]||0x1388;this[_0xa57e('0xc')]=_0x1e3d74[_0xa57e('0xc')]||_0xa57e('0xd');this['Trunk']=_0x1e3d74[_0xa57e('0xe')]?_0x1e3d74[_0xa57e('0xe')]:undefined;this[_0xa57e('0xf')]=_0x1e3d74[_0xa57e('0xf')];this[_0xa57e('0x10')]=_0x1e3d74[_0xa57e('0x10')];}module['exports']=FaxAccount; \ No newline at end of file +var _0xd65a=['t38timeout','tech','Trunk','ListId','key','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect'];(function(_0x38bce7,_0x366405){var _0x4f8b4e=function(_0x565158){while(--_0x565158){_0x38bce7['push'](_0x38bce7['shift']());}};_0x4f8b4e(++_0x366405);}(_0xd65a,0x16d));var _0xad65=function(_0x46d4f6,_0x1247b2){_0x46d4f6=_0x46d4f6-0x0;var _0x1900b5=_0xd65a[_0x46d4f6];return _0x1900b5;};'use strict';function FaxAccount(_0x2a149a){this['id']=_0x2a149a['id']||0x0;this['name']=_0x2a149a['name']||'';this[_0xad65('0x0')]=_0x2a149a[_0xad65('0x0')];this[_0xad65('0x1')]=_0x2a149a['ecm'];this[_0xad65('0x2')]=_0x2a149a[_0xad65('0x2')];this[_0xad65('0x3')]=_0x2a149a[_0xad65('0x3')];this['minrate']=_0x2a149a[_0xad65('0x4')]||0x960;this['maxrate']=_0x2a149a[_0xad65('0x5')]||0x3840;this[_0xad65('0x6')]=_0x2a149a[_0xad65('0x6')]||_0xad65('0x7');this[_0xad65('0x8')]=_0x2a149a[_0xad65('0x8')]||'no';this[_0xad65('0x9')]=_0x2a149a[_0xad65('0x9')]||'no';this[_0xad65('0xa')]=_0x2a149a[_0xad65('0xa')]||0x1388;this[_0xad65('0xb')]=_0x2a149a[_0xad65('0xb')]||'SIP';this[_0xad65('0xc')]=_0x2a149a[_0xad65('0xc')]?_0x2a149a['Trunk']:undefined;this[_0xad65('0xd')]=_0x2a149a[_0xad65('0xd')];this[_0xad65('0xe')]=_0x2a149a[_0xad65('0xe')];}module['exports']=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index f96a7d9..fd162e5 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 _0x21bb=['remoteUri','serverUrl','Configurations','exports','name','username','token'];(function(_0x2f1762,_0xab43df){var _0x8ab21=function(_0xf6c1f5){while(--_0xf6c1f5){_0x2f1762['push'](_0x2f1762['shift']());}};_0x8ab21(++_0xab43df);}(_0x21bb,0x1d2));var _0xb21b=function(_0x4923c5,_0x51c208){_0x4923c5=_0x4923c5-0x0;var _0xac9f8f=_0x21bb[_0x4923c5];return _0xac9f8f;};'use strict';function FreshdeskAccount(_0x2d3c9a){this['id']=_0x2d3c9a['id']||0x0;this[_0xb21b('0x0')]=_0x2d3c9a[_0xb21b('0x0')]||'';this[_0xb21b('0x1')]=_0x2d3c9a['username']||'';this['apiKey']=_0x2d3c9a[_0xb21b('0x2')]||'';this['remoteUri']=_0x2d3c9a[_0xb21b('0x3')]||'';this[_0xb21b('0x4')]=_0x2d3c9a[_0xb21b('0x4')]||'';this[_0xb21b('0x5')]=_0x2d3c9a[_0xb21b('0x5')]||{};}module[_0xb21b('0x6')]=FreshdeskAccount; \ No newline at end of file +var _0xa17d=['token','remoteUri','serverUrl','Configurations','exports','name','username','apiKey'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0xa17d,0x1d5));var _0xda17=function(_0x591e16,_0x5aefc1){_0x591e16=_0x591e16-0x0;var _0x543b35=_0xa17d[_0x591e16];return _0x543b35;};'use strict';function FreshdeskAccount(_0x5320de){this['id']=_0x5320de['id']||0x0;this[_0xda17('0x0')]=_0x5320de[_0xda17('0x0')]||'';this[_0xda17('0x1')]=_0x5320de[_0xda17('0x1')]||'';this[_0xda17('0x2')]=_0x5320de[_0xda17('0x3')]||'';this[_0xda17('0x4')]=_0x5320de[_0xda17('0x4')]||'';this['serverUrl']=_0x5320de[_0xda17('0x5')]||'';this[_0xda17('0x6')]=_0x5320de[_0xda17('0x6')]||{};}module[_0xda17('0x7')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 82360fb..6b9b2ad 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 _0xe5d5=['username','token','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x4f4d98,_0x37c563){var _0x464073=function(_0x30879d){while(--_0x30879d){_0x4f4d98['push'](_0x4f4d98['shift']());}};_0x464073(++_0x37c563);}(_0xe5d5,0x156));var _0x5e5d=function(_0x142263,_0x5a194a){_0x142263=_0x142263-0x0;var _0x130d05=_0xe5d5[_0x142263];return _0x130d05;};'use strict';function FreshsalesAccount(_0x10e72b){this['id']=_0x10e72b['id']||0x0;this['name']=_0x10e72b[_0x5e5d('0x0')]||'';this['username']=_0x10e72b[_0x5e5d('0x1')]||'';this['apiKey']=_0x10e72b[_0x5e5d('0x2')]||'';this['remoteUri']=_0x10e72b[_0x5e5d('0x3')]||'';this[_0x5e5d('0x4')]=_0x10e72b[_0x5e5d('0x4')]||'';this[_0x5e5d('0x5')]=_0x10e72b[_0x5e5d('0x5')]||{};}module[_0x5e5d('0x6')]=FreshsalesAccount; \ No newline at end of file +var _0x04f9=['serverUrl','Configurations','exports','name','username','apiKey','token','remoteUri'];(function(_0x48c2ae,_0x4cea90){var _0x8f7531=function(_0x126458){while(--_0x126458){_0x48c2ae['push'](_0x48c2ae['shift']());}};_0x8f7531(++_0x4cea90);}(_0x04f9,0xb3));var _0x904f=function(_0x4b56aa,_0x2d859a){_0x4b56aa=_0x4b56aa-0x0;var _0x3d5d90=_0x04f9[_0x4b56aa];return _0x3d5d90;};'use strict';function FreshsalesAccount(_0x340170){this['id']=_0x340170['id']||0x0;this[_0x904f('0x0')]=_0x340170[_0x904f('0x0')]||'';this[_0x904f('0x1')]=_0x340170['username']||'';this[_0x904f('0x2')]=_0x340170[_0x904f('0x3')]||'';this[_0x904f('0x4')]=_0x340170[_0x904f('0x4')]||'';this[_0x904f('0x5')]=_0x340170[_0x904f('0x5')]||'';this['Configurations']=_0x340170[_0x904f('0x6')]||{};}module[_0x904f('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 c2ddfb9..dfffb88 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 _0xeee2=['position','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','channel','connectedlinenum','accountcode','context','exten','holdtime','assigned','lastAssignedTo','motionChannel','mohtime','variables','exports','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt'];(function(_0x10a6ee,_0x15678d){var _0x4e7cac=function(_0x56ce03){while(--_0x56ce03){_0x10a6ee['push'](_0x10a6ee['shift']());}};_0x4e7cac(++_0x15678d);}(_0xeee2,0x95));var _0x2eee=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xeee2[_0x321bb2];return _0x9c12ed;};'use strict';function QueueReport(){this[_0x2eee('0x0')]='inbound';this[_0x2eee('0x1')]='';this[_0x2eee('0x2')]='';this[_0x2eee('0x3')]='';this[_0x2eee('0x4')]='';this[_0x2eee('0x5')]=null;this[_0x2eee('0x6')]=null;this[_0x2eee('0x7')]=0x1;this['count']=0x1;this[_0x2eee('0x8')]=![];this[_0x2eee('0x9')]=null;this[_0x2eee('0xa')]=![];this[_0x2eee('0xb')]=null;this[_0x2eee('0xc')]=![];this[_0x2eee('0xd')]=null;this['originalposition']=0x1;this[_0x2eee('0xe')]='';this[_0x2eee('0xf')]='';this['connectedlinename']='';this[_0x2eee('0x10')]='';this[_0x2eee('0x11')]='';this[_0x2eee('0x12')]='';this['priority']='';this[_0x2eee('0x13')]=0x0;this[_0x2eee('0x14')]=![];this[_0x2eee('0x15')]='';this[_0x2eee('0x16')]='voice';this[_0x2eee('0x17')]=0x0;this[_0x2eee('0x18')]={};}module[_0x2eee('0x19')]=QueueReport; \ No newline at end of file +var _0x408d=['exten','priority','lastAssignedTo','motionChannel','voice','mohtime','variables','exports','inbound','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexitAt','originalposition','channel','connectedlinename','accountcode','context'];(function(_0x4aa4e6,_0x278c45){var _0x322588=function(_0x19279d){while(--_0x19279d){_0x4aa4e6['push'](_0x4aa4e6['shift']());}};_0x322588(++_0x278c45);}(_0x408d,0x8f));var _0xd408=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x408d[_0x3dd15e];return _0x231fd0;};'use strict';function QueueReport(){this['type']=_0xd408('0x0');this[_0xd408('0x1')]='';this[_0xd408('0x2')]='';this[_0xd408('0x3')]='';this[_0xd408('0x4')]='';this[_0xd408('0x5')]=null;this[_0xd408('0x6')]=null;this[_0xd408('0x7')]=0x1;this[_0xd408('0x8')]=0x1;this[_0xd408('0x9')]=![];this[_0xd408('0xa')]=null;this[_0xd408('0xb')]=![];this[_0xd408('0xc')]=null;this['queuecallerexit']=![];this[_0xd408('0xd')]=null;this[_0xd408('0xe')]=0x1;this[_0xd408('0xf')]='';this['connectedlinenum']='';this[_0xd408('0x10')]='';this[_0xd408('0x11')]='';this[_0xd408('0x12')]='';this[_0xd408('0x13')]='';this[_0xd408('0x14')]='';this['holdtime']=0x0;this['assigned']=![];this[_0xd408('0x15')]='';this[_0xd408('0x16')]=_0xd408('0x17');this[_0xd408('0x18')]=0x0;this[_0xd408('0x19')]={};}module[_0xd408('0x1a')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index e0f10b1..bac1f04 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 _0x19a3=['type','integrationTab','serverUrl','Configurations','exports','name','username','remoteUri','password','clientId','clientSecret','securityToken'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x19a3,0x1d9));var _0x319a=function(_0x4f2314,_0x651c42){_0x4f2314=_0x4f2314-0x0;var _0x176cdf=_0x19a3[_0x4f2314];return _0x176cdf;};'use strict';function SalesforceAccount(_0x57b41a){this['id']=_0x57b41a['id']||0x0;this['name']=_0x57b41a[_0x319a('0x0')]||'';this[_0x319a('0x1')]=_0x57b41a[_0x319a('0x1')]||'';this[_0x319a('0x2')]=_0x57b41a[_0x319a('0x2')]||'';this[_0x319a('0x3')]=_0x57b41a[_0x319a('0x3')]||'';this[_0x319a('0x4')]=_0x57b41a[_0x319a('0x4')]||'';this[_0x319a('0x5')]=_0x57b41a[_0x319a('0x5')]||'';this['securityToken']=_0x57b41a[_0x319a('0x6')]||'';this['type']=_0x57b41a[_0x319a('0x7')]||_0x319a('0x8');this[_0x319a('0x9')]=_0x57b41a[_0x319a('0x9')]||'';this[_0x319a('0xa')]=_0x57b41a[_0x319a('0xa')]||{};}module[_0x319a('0xb')]=SalesforceAccount; \ No newline at end of file +var _0xe51c=['remoteUri','password','clientId','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','exports','name','username'];(function(_0x5386c3,_0x4471a2){var _0x2cfc1f=function(_0x2c091d){while(--_0x2c091d){_0x5386c3['push'](_0x5386c3['shift']());}};_0x2cfc1f(++_0x4471a2);}(_0xe51c,0xfa));var _0xce51=function(_0x1d760b,_0x47f9fe){_0x1d760b=_0x1d760b-0x0;var _0x18fb17=_0xe51c[_0x1d760b];return _0x18fb17;};'use strict';function SalesforceAccount(_0x4a61bb){this['id']=_0x4a61bb['id']||0x0;this[_0xce51('0x0')]=_0x4a61bb[_0xce51('0x0')]||'';this[_0xce51('0x1')]=_0x4a61bb[_0xce51('0x1')]||'';this[_0xce51('0x2')]=_0x4a61bb[_0xce51('0x2')]||'';this[_0xce51('0x3')]=_0x4a61bb[_0xce51('0x3')]||'';this[_0xce51('0x4')]=_0x4a61bb[_0xce51('0x4')]||'';this[_0xce51('0x5')]=_0x4a61bb['clientSecret']||'';this[_0xce51('0x6')]=_0x4a61bb[_0xce51('0x6')]||'';this[_0xce51('0x7')]=_0x4a61bb[_0xce51('0x7')]||_0xce51('0x8');this[_0xce51('0x9')]=_0x4a61bb[_0xce51('0x9')]||'';this[_0xce51('0xa')]=_0x4a61bb[_0xce51('0xa')]||{};}module[_0xce51('0xb')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index 0449a00..36a0517 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 _0xe0e2=['Configurations','name','username','password','remoteUri','serverUrl'];(function(_0x41f281,_0xa93b94){var _0x5bf85d=function(_0x514f5e){while(--_0x514f5e){_0x41f281['push'](_0x41f281['shift']());}};_0x5bf85d(++_0xa93b94);}(_0xe0e2,0x151));var _0x2e0e=function(_0x4f3ee5,_0x38db22){_0x4f3ee5=_0x4f3ee5-0x0;var _0x5280c7=_0xe0e2[_0x4f3ee5];return _0x5280c7;};'use strict';function ServicenowAccount(_0x31333e){this['id']=_0x31333e['id']||0x0;this[_0x2e0e('0x0')]=_0x31333e[_0x2e0e('0x0')]||'';this[_0x2e0e('0x1')]=_0x31333e[_0x2e0e('0x1')]||'';this[_0x2e0e('0x2')]=_0x31333e[_0x2e0e('0x2')]||'';this[_0x2e0e('0x3')]=_0x31333e[_0x2e0e('0x3')]||'';this['serverUrl']=_0x31333e[_0x2e0e('0x4')]||'';this[_0x2e0e('0x5')]=_0x31333e[_0x2e0e('0x5')]||{};}module['exports']=ServicenowAccount; \ No newline at end of file +var _0xb581=['password','remoteUri','serverUrl','Configurations','name','username'];(function(_0x7d62cb,_0x7622c){var _0x3a6266=function(_0x1cc5fa){while(--_0x1cc5fa){_0x7d62cb['push'](_0x7d62cb['shift']());}};_0x3a6266(++_0x7622c);}(_0xb581,0x190));var _0x1b58=function(_0x130878,_0x18aba6){_0x130878=_0x130878-0x0;var _0x130d77=_0xb581[_0x130878];return _0x130d77;};'use strict';function ServicenowAccount(_0x766773){this['id']=_0x766773['id']||0x0;this[_0x1b58('0x0')]=_0x766773[_0x1b58('0x0')]||'';this[_0x1b58('0x1')]=_0x766773['username']||'';this['password']=_0x766773[_0x1b58('0x2')]||'';this['remoteUri']=_0x766773[_0x1b58('0x3')]||'';this['serverUrl']=_0x766773[_0x1b58('0x4')]||'';this[_0x1b58('0x5')]=_0x766773[_0x1b58('0x5')]||{};}module['exports']=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index 5c779c6..bf2ea50 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 _0x6846=['Configurations','exports','name','username','remoteUri','serverUrl'];(function(_0x2384d8,_0x1f12d7){var _0x13502b=function(_0x9219c9){while(--_0x9219c9){_0x2384d8['push'](_0x2384d8['shift']());}};_0x13502b(++_0x1f12d7);}(_0x6846,0x18e));var _0x6684=function(_0xe70ed5,_0x404aab){_0xe70ed5=_0xe70ed5-0x0;var _0x515cd9=_0x6846[_0xe70ed5];return _0x515cd9;};'use strict';function SugarcrmAccount(_0xa297cc){this['id']=_0xa297cc['id']||0x0;this['name']=_0xa297cc[_0x6684('0x0')]||'';this['username']=_0xa297cc[_0x6684('0x1')]||'';this['password']=_0xa297cc['password']||'';this[_0x6684('0x2')]=_0xa297cc['remoteUri']||'';this[_0x6684('0x3')]=_0xa297cc[_0x6684('0x3')]||'';this[_0x6684('0x4')]=_0xa297cc[_0x6684('0x4')]||{};}module[_0x6684('0x5')]=SugarcrmAccount; \ No newline at end of file +var _0x714a=['username','password','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x10ee24,_0x5cd239){var _0x45e695=function(_0x51f58d){while(--_0x51f58d){_0x10ee24['push'](_0x10ee24['shift']());}};_0x45e695(++_0x5cd239);}(_0x714a,0xd8));var _0xa714=function(_0x291307,_0x412521){_0x291307=_0x291307-0x0;var _0xade0c2=_0x714a[_0x291307];return _0xade0c2;};'use strict';function SugarcrmAccount(_0x220d57){this['id']=_0x220d57['id']||0x0;this[_0xa714('0x0')]=_0x220d57['name']||'';this[_0xa714('0x1')]=_0x220d57[_0xa714('0x1')]||'';this[_0xa714('0x2')]=_0x220d57['password']||'';this[_0xa714('0x3')]=_0x220d57['remoteUri']||'';this[_0xa714('0x4')]=_0x220d57[_0xa714('0x4')]||'';this[_0xa714('0x5')]=_0x220d57[_0xa714('0x5')]||{};}module[_0xa714('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 ed69dc1..ae96e0e 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 _0x0d99=['name','accountcode','state','stateTime','status','exports'];(function(_0x229e8f,_0x57f05d){var _0x45e4cd=function(_0x1920ae){while(--_0x1920ae){_0x229e8f['push'](_0x229e8f['shift']());}};_0x45e4cd(++_0x57f05d);}(_0x0d99,0x1d4));var _0x90d9=function(_0x182a1b,_0xfba0d4){_0x182a1b=_0x182a1b-0x0;var _0x497be4=_0x0d99[_0x182a1b];return _0x497be4;};'use strict';function Telephone(_0x4f677b){this['id']=_0x4f677b['id']||0x0;this[_0x90d9('0x0')]=_0x4f677b[_0x90d9('0x0')]||'';this[_0x90d9('0x1')]=_0x4f677b[_0x90d9('0x1')]||'';this[_0x90d9('0x2')]='unknown';this[_0x90d9('0x3')]=0x0;this[_0x90d9('0x4')]='unknown';this['address']='';}module[_0x90d9('0x5')]=Telephone; \ No newline at end of file +var _0xb574=['unknown','stateTime','status','address','name','accountcode'];(function(_0x138c7c,_0x7f6e06){var _0x15b136=function(_0x11536d){while(--_0x11536d){_0x138c7c['push'](_0x138c7c['shift']());}};_0x15b136(++_0x7f6e06);}(_0xb574,0x106));var _0x4b57=function(_0x30540c,_0x36f982){_0x30540c=_0x30540c-0x0;var _0x5405cd=_0xb574[_0x30540c];return _0x5405cd;};'use strict';function Telephone(_0x4ee35e){this['id']=_0x4ee35e['id']||0x0;this[_0x4b57('0x0')]=_0x4ee35e['name']||'';this[_0x4b57('0x1')]=_0x4ee35e[_0x4b57('0x1')]||'';this['state']=_0x4b57('0x2');this[_0x4b57('0x3')]=0x0;this[_0x4b57('0x4')]=_0x4b57('0x2');this[_0x4b57('0x5')]='';}module['exports']=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index 2389fc3..9263acc 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(_0x57a4db,_0x5e4585){var _0x4c3113=function(_0x2c8a11){while(--_0x2c8a11){_0x57a4db['push'](_0x57a4db['shift']());}};_0x4c3113(++_0x5e4585);}(_0xb10b,0x12a));var _0xbb10=function(_0x296144,_0x26bbbf){_0x296144=_0x296144-0x0;var _0x5329b1=_0xb10b[_0x296144];return _0x5329b1;};'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(_0x4c0c5a,_0x6b8be9){var _0x34f92d=function(_0x9be522){while(--_0x9be522){_0x4c0c5a['push'](_0x4c0c5a['shift']());}};_0x34f92d(++_0x6b8be9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa9e0[_0x139a3c];return _0x2b375b;};'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 e4e8e1f..938e818 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(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0b0e,0x187));var _0xe0b0=function(_0x474d97,_0x5909ce){_0x474d97=_0x474d97-0x0;var _0x1edf25=_0x0b0e[_0x474d97];return _0x1edf25;};'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 _0x9ffd=['Actions','exports','name','channel','voice','status','AllConditions','AnyConditions'];(function(_0x468e5d,_0x4c60cc){var _0x4635d1=function(_0x44f9dd){while(--_0x44f9dd){_0x468e5d['push'](_0x468e5d['shift']());}};_0x4635d1(++_0x4c60cc);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x4e4f21,_0x26e09d){_0x4e4f21=_0x4e4f21-0x0;var _0x4b0843=_0x9ffd[_0x4e4f21];return _0x4b0843;};'use strict';function Trigger(_0x4c26a1){this['id']=_0x4c26a1['id']||0x0;this[_0xd9ff('0x0')]=_0x4c26a1[_0xd9ff('0x0')]||'';this['channel']=_0x4c26a1[_0xd9ff('0x1')]||_0xd9ff('0x2');this[_0xd9ff('0x3')]=_0x4c26a1[_0xd9ff('0x3')]||![];this['AllConditions']=_0x4c26a1[_0xd9ff('0x4')]||[];this[_0xd9ff('0x5')]=_0x4c26a1['AnyConditions']||[];this[_0xd9ff('0x6')]=_0x4c26a1[_0xd9ff('0x6')]||[];}module[_0xd9ff('0x7')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 03ffb7f..610a50c 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 _0x91c1=['stateTime','status','unknown','registry','indexOf','split','port','domain','domainport','stateRegistry','registrationtime','address','defaultuser','exports','active','name','state'];(function(_0x18ae0e,_0x4b7d34){var _0xd96cff=function(_0x5903a9){while(--_0x5903a9){_0x18ae0e['push'](_0x18ae0e['shift']());}};_0xd96cff(++_0x4b7d34);}(_0x91c1,0xb8));var _0x191c=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x91c1[_0x1ac595];return _0x455fff;};'use strict';function Trunk(_0x8616c8){this['id']=_0x8616c8['id']||0x0;this['active']=_0x8616c8[_0x191c('0x0')]||![];this[_0x191c('0x1')]=_0x8616c8[_0x191c('0x1')]||'';this[_0x191c('0x2')]='unknown';this[_0x191c('0x3')]=0x0;this[_0x191c('0x4')]=_0x191c('0x5');this['registry']=_0x8616c8['registry']&&_0x8616c8[_0x191c('0x6')][_0x191c('0x7')](':')?_0x8616c8['registry'][_0x191c('0x8')](':')[0x0]:'';this['host']='';this[_0x191c('0x9')]='';this[_0x191c('0xa')]='';this[_0x191c('0xb')]='';this['refresh']='';this[_0x191c('0xc')]=_0x191c('0x5');this[_0x191c('0xd')]='';this[_0x191c('0xe')]='';this[_0x191c('0xf')]=_0x8616c8[_0x191c('0xf')]||'';}module[_0x191c('0x10')]=Trunk; \ No newline at end of file +var _0x31d4=['host','port','domain','domainport','refresh','registrationtime','active','name','unknown','status','registry','indexOf','split'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x31d4,0x1cd));var _0x431d=function(_0x503679,_0x1d99bf){_0x503679=_0x503679-0x0;var _0x2c6c2b=_0x31d4[_0x503679];return _0x2c6c2b;};'use strict';function Trunk(_0x52e970){this['id']=_0x52e970['id']||0x0;this[_0x431d('0x0')]=_0x52e970[_0x431d('0x0')]||![];this[_0x431d('0x1')]=_0x52e970[_0x431d('0x1')]||'';this['state']=_0x431d('0x2');this['stateTime']=0x0;this[_0x431d('0x3')]='unknown';this[_0x431d('0x4')]=_0x52e970[_0x431d('0x4')]&&_0x52e970[_0x431d('0x4')][_0x431d('0x5')](':')?_0x52e970[_0x431d('0x4')][_0x431d('0x6')](':')[0x0]:'';this[_0x431d('0x7')]='';this[_0x431d('0x8')]='';this[_0x431d('0x9')]='';this[_0x431d('0xa')]='';this[_0x431d('0xb')]='';this['stateRegistry']=_0x431d('0x2');this[_0x431d('0xc')]='';this['address']='';this['defaultuser']=_0x52e970['defaultuser']||'';}module['exports']=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 9e9673d..fa4d4e6 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 _0x7b80=['recordingFormat','mandatoryDisposition','exports','exten'];(function(_0x5b4e11,_0xa21c04){var _0x2d82c2=function(_0x2bd86e){while(--_0x2bd86e){_0x5b4e11['push'](_0x5b4e11['shift']());}};_0x2d82c2(++_0xa21c04);}(_0x7b80,0x143));var _0x07b8=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x7b80[_0x3ab51d];return _0x29a04e;};'use strict';function voiceExtension(_0x1aebbf){this['id']=_0x1aebbf['id']||0x0;this[_0x07b8('0x0')]=_0x1aebbf[_0x07b8('0x0')]||'';this[_0x07b8('0x1')]=_0x1aebbf['recordingFormat']||'none';this[_0x07b8('0x2')]=_0x1aebbf[_0x07b8('0x2')]||![];}module[_0x07b8('0x3')]=voiceExtension; \ No newline at end of file +var _0x57a8=['exten','recordingFormat','none','mandatoryDisposition','exports'];(function(_0x131bb1,_0x5c91cc){var _0x4b006b=function(_0x236496){while(--_0x236496){_0x131bb1['push'](_0x131bb1['shift']());}};_0x4b006b(++_0x5c91cc);}(_0x57a8,0x11d));var _0x857a=function(_0x498334,_0x27b6fe){_0x498334=_0x498334-0x0;var _0x13bb70=_0x57a8[_0x498334];return _0x13bb70;};'use strict';function voiceExtension(_0x122818){this['id']=_0x122818['id']||0x0;this[_0x857a('0x0')]=_0x122818['exten']||'';this[_0x857a('0x1')]=_0x122818[_0x857a('0x1')]||_0x857a('0x2');this[_0x857a('0x3')]=_0x122818[_0x857a('0x3')]||![];}module[_0x857a('0x4')]=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index 3f25ee5..9d2bead 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 _0xf9f5=['dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayACS','outboundAbandonedDay','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','dialRecallMeTimeout','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','mandatoryDisposition','mandatoryDispositionPause','exports','not_inuse','inuse','busy','invalid','unavailable','ringing','wav','wav49','gsm','rrmemory','name','monitor_format','type','inbound','waiting','talking','total','answered','sumDuration','sumBillable','unmanaged','abandoned','available','acw','acwTimeout','autopause','sendMessageOneNotActive','message','originated','temp','dialGlobalInterval','dialActive'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0xf9f5,0x1c8));var _0x5f9f=function(_0x139822,_0x386cbb){_0x139822=_0x139822-0x0;var _0x1b57c7=_0xf9f5[_0x139822];return _0x1b57c7;};'use strict';var statusDesc=['unknown',_0x5f9f('0x0'),_0x5f9f('0x1'),_0x5f9f('0x2'),_0x5f9f('0x3'),_0x5f9f('0x4'),_0x5f9f('0x5'),'ringinuse','onhold'];var monitorFormat={'wav':_0x5f9f('0x6'),'wav49':_0x5f9f('0x7'),'gsm':_0x5f9f('0x8')};var strategy={'rrmemory':_0x5f9f('0x9'),'roundrobin':'roundrobin'};function VoiceQueue(_0x3d1c7c){this['id']=_0x3d1c7c['id']||0x0;this['name']=_0x3d1c7c[_0x5f9f('0xa')]||'';this[_0x5f9f('0xb')]=_0x3d1c7c[_0x5f9f('0xb')]||'';this[_0x5f9f('0xc')]=_0x3d1c7c['type']||_0x5f9f('0xd');this[_0x5f9f('0xe')]=0x0;this[_0x5f9f('0xf')]=0x0;this[_0x5f9f('0x10')]=0x0;this[_0x5f9f('0x11')]=0x0;this[_0x5f9f('0x12')]=0x0;this['sumHoldTime']=0x0;this[_0x5f9f('0x13')]=0x0;this[_0x5f9f('0x14')]=0x0;this[_0x5f9f('0x15')]=0x0;this['loggedIn']=0x0;this[_0x5f9f('0x16')]=0x0;this['acw']=_0x3d1c7c[_0x5f9f('0x17')]||![];this[_0x5f9f('0x18')]=_0x3d1c7c[_0x5f9f('0x18')]||0xa;this[_0x5f9f('0x19')]=_0x3d1c7c[_0x5f9f('0x19')]||'no';this[_0x5f9f('0x1a')]=!![];this[_0x5f9f('0x1b')]='';this[_0x5f9f('0x1c')]=0x0;this[_0x5f9f('0x1d')]=0x0;this['dialTimezone']=_0x3d1c7c['dialTimezone']||null;this[_0x5f9f('0x1e')]=_0x3d1c7c[_0x5f9f('0x1e')]?_0x3d1c7c[_0x5f9f('0x1e')]:null;this[_0x5f9f('0x1f')]=_0x3d1c7c['dialActive'];this[_0x5f9f('0x20')]=_0x3d1c7c[_0x5f9f('0x20')]||_0x5f9f('0x21');this[_0x5f9f('0x22')]=_0x3d1c7c['dialLimitChannel']||0x0;this['dialLimitQueue']=_0x3d1c7c[_0x5f9f('0x23')]||0x0;this['dialPowerLevel']=_0x3d1c7c[_0x5f9f('0x24')]||0x1;this[_0x5f9f('0x25')]=_0x3d1c7c[_0x5f9f('0x25')]||_0x5f9f('0x26');this[_0x5f9f('0x27')]=_0x3d1c7c[_0x5f9f('0x27')]||0.03;this['dialPredictiveInterval']=_0x3d1c7c['dialPredictiveInterval']||0x258;this[_0x5f9f('0x28')]=_0x3d1c7c[_0x5f9f('0x28')]||_0x5f9f('0x29');this[_0x5f9f('0x2a')]=_0x3d1c7c[_0x5f9f('0x2a')]||_0x5f9f('0x29');this[_0x5f9f('0x2b')]=_0x3d1c7c[_0x5f9f('0x2b')]||0x1e;this['dialQueueOptions']=_0x3d1c7c[_0x5f9f('0x2c')]||_0x5f9f('0x2d');this[_0x5f9f('0x2e')]=_0x3d1c7c[_0x5f9f('0x2e')]||0x3;this['dialQueueProject']=_0x3d1c7c[_0x5f9f('0x2f')]||undefined;this[_0x5f9f('0x30')]=_0x3d1c7c[_0x5f9f('0x30')]||0x3;this[_0x5f9f('0x31')]=_0x3d1c7c[_0x5f9f('0x31')]||0x96;this[_0x5f9f('0x32')]=_0x3d1c7c[_0x5f9f('0x32')]||0x3;this[_0x5f9f('0x33')]=_0x3d1c7c[_0x5f9f('0x33')]||0x96;this[_0x5f9f('0x34')]=_0x3d1c7c[_0x5f9f('0x34')]||0x3;this[_0x5f9f('0x35')]=_0x3d1c7c[_0x5f9f('0x35')]||0x96;this['dialNoSuchNumberMaxRetry']=_0x3d1c7c[_0x5f9f('0x36')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x3d1c7c[_0x5f9f('0x37')]||0x96;this[_0x5f9f('0x38')]=_0x3d1c7c[_0x5f9f('0x38')]||0x3;this['dialDropRetryFrequency']=_0x3d1c7c[_0x5f9f('0x39')]||0x96;this[_0x5f9f('0x3a')]=_0x3d1c7c[_0x5f9f('0x3a')]||0x3;this['dialAbandonedRetryFrequency']=_0x3d1c7c['dialAbandonedRetryFrequency']||0x96;this['dialMachineMaxRetry']=_0x3d1c7c[_0x5f9f('0x3b')]||0x3;this[_0x5f9f('0x3c')]=_0x3d1c7c[_0x5f9f('0x3c')]||0x96;this['dialAgentRejectMaxRetry']=_0x3d1c7c[_0x5f9f('0x3d')]||0x3;this['dialAgentRejectRetryFrequency']=_0x3d1c7c[_0x5f9f('0x3e')]||0x96;this[_0x5f9f('0x3f')]=_0x3d1c7c['dialGlobalMaxRetry']||0x4;this[_0x5f9f('0x40')]=_0x3d1c7c['Trunk']?_0x3d1c7c[_0x5f9f('0x40')]:undefined;this['TrunkBackup']=_0x3d1c7c[_0x5f9f('0x41')]?_0x3d1c7c[_0x5f9f('0x41')]:undefined;this['dialPrefix']=_0x3d1c7c[_0x5f9f('0x42')]||undefined;this[_0x5f9f('0x43')]=_0x3d1c7c[_0x5f9f('0x43')]?_0x3d1c7c[_0x5f9f('0x43')]:undefined;this['dialOrderByScheduledAt']=_0x3d1c7c[_0x5f9f('0x44')]||_0x5f9f('0x45');this['dialRandomLastDigitCallerIdNumber']=_0x3d1c7c[_0x5f9f('0x46')]||undefined;this[_0x5f9f('0x47')]=_0x3d1c7c['dialCutDigit']||undefined;this[_0x5f9f('0x48')]=strategy[_0x3d1c7c[_0x5f9f('0x48')]]||_0x5f9f('0x9');this[_0x5f9f('0x49')]=!![];this[_0x5f9f('0x4a')]=_0x3d1c7c['dialAMDActive']||![];this[_0x5f9f('0x4b')]=_0x3d1c7c[_0x5f9f('0x4b')];this[_0x5f9f('0x4c')]=_0x3d1c7c['dialAMDGreeting'];this[_0x5f9f('0x4d')]=_0x3d1c7c['dialAMDAfterGreetingSilence'];this[_0x5f9f('0x4e')]=_0x3d1c7c[_0x5f9f('0x4e')];this[_0x5f9f('0x4f')]=_0x3d1c7c[_0x5f9f('0x4f')];this['dialAMDBetweenWordsSilence']=_0x3d1c7c[_0x5f9f('0x50')];this[_0x5f9f('0x51')]=_0x3d1c7c[_0x5f9f('0x51')];this[_0x5f9f('0x52')]=_0x3d1c7c[_0x5f9f('0x52')];this[_0x5f9f('0x53')]=_0x3d1c7c[_0x5f9f('0x53')];this[_0x5f9f('0x54')]=0x0;this['pTalking']=0x0;this[_0x5f9f('0x55')]=_0x3d1c7c['timeout'];this[_0x5f9f('0x56')]=0x0;this[_0x5f9f('0x57')]=0x0;this[_0x5f9f('0x58')]=0x0;this[_0x5f9f('0x59')]=0x0;this[_0x5f9f('0x5a')]=0x0;this[_0x5f9f('0x5b')]=0x0;this[_0x5f9f('0x5c')]=0x0;this[_0x5f9f('0x5d')]=0x0;this[_0x5f9f('0x5e')]=0x0;this['outboundDropCallsDayCallersExit']=0x0;this['outboundDropCallsDayTimeout']=0x0;this[_0x5f9f('0x5f')]=0x0;this['outboundReCallsDay']=0x0;this[_0x5f9f('0x60')]=0x0;this['startProgressive']=undefined;this['startPredictive']=undefined;this[_0x5f9f('0x61')]=undefined;this[_0x5f9f('0x62')]=1.05;this[_0x5f9f('0x63')]=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this[_0x5f9f('0x64')]=0x0;this[_0x5f9f('0x65')]=0x0;this[_0x5f9f('0x66')]=0x0;this[_0x5f9f('0x67')]=0x0;this[_0x5f9f('0x68')]=0x0;this[_0x5f9f('0x69')]=0x0;this[_0x5f9f('0x6a')]=_0x3d1c7c[_0x5f9f('0x6b')]||0x14;this[_0x5f9f('0x6c')]=_0x3d1c7c[_0x5f9f('0x6b')]||0xa;this['predictiveIntervalErlangCalls']=0x0;this[_0x5f9f('0x6d')]=0x0;this[_0x5f9f('0x6e')]=0x1;this[_0x5f9f('0x6f')]=0x0;this[_0x5f9f('0x70')]=0x0;this[_0x5f9f('0x71')]=0x0;this['erlangBusyFactor']=0x0;this[_0x5f9f('0x72')]=_0x3d1c7c[_0x5f9f('0x72')]||0x1e;this['dialRecallInQueue']=_0x3d1c7c['dialRecallInQueue']||![];this[_0x5f9f('0x73')]=!!_0x3d1c7c[_0x5f9f('0x73')]||![];this['dialPreviewRecallmeReminder']=!!_0x3d1c7c[_0x5f9f('0x74')]||![];this[_0x5f9f('0x75')]=_0x3d1c7c[_0x5f9f('0x75')]||undefined;this[_0x5f9f('0x76')]=_0x3d1c7c[_0x5f9f('0x76')]||![];this['dialAgiAfterHangupAgent']=_0x3d1c7c['dialAgiAfterHangupAgent']||![];this[_0x5f9f('0xb')]=monitorFormat[_0x3d1c7c[_0x5f9f('0xb')]]?monitorFormat[_0x3d1c7c[_0x5f9f('0xb')]]:undefined;this['mandatoryDisposition']=_0x3d1c7c[_0x5f9f('0x77')]||![];this[_0x5f9f('0x78')]=_0x3d1c7c[_0x5f9f('0x78')]?_0x3d1c7c[_0x5f9f('0x78')]:undefined;}module[_0x5f9f('0x79')]=VoiceQueue; \ No newline at end of file +var _0x9fd0=['ringing','wav','wav49','gsm','rrmemory','roundrobin','name','monitor_format','type','inbound','talking','total','sumDuration','sumHoldTime','unmanaged','abandoned','available','acwTimeout','autopause','sendMessageOneNotActive','message','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','anonymous','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','unknown','not_inuse','inuse','busy','invalid','unavailable'];(function(_0x389c94,_0x2a93d9){var _0x1455cb=function(_0x5903d6){while(--_0x5903d6){_0x389c94['push'](_0x389c94['shift']());}};_0x1455cb(++_0x2a93d9);}(_0x9fd0,0xe8));var _0x09fd=function(_0x3c4ace,_0xd4a56a){_0x3c4ace=_0x3c4ace-0x0;var _0x35c083=_0x9fd0[_0x3c4ace];return _0x35c083;};'use strict';var statusDesc=[_0x09fd('0x0'),_0x09fd('0x1'),_0x09fd('0x2'),_0x09fd('0x3'),_0x09fd('0x4'),_0x09fd('0x5'),_0x09fd('0x6'),'ringinuse','onhold'];var monitorFormat={'wav':_0x09fd('0x7'),'wav49':_0x09fd('0x8'),'gsm':_0x09fd('0x9')};var strategy={'rrmemory':_0x09fd('0xa'),'roundrobin':_0x09fd('0xb')};function VoiceQueue(_0x40686a){this['id']=_0x40686a['id']||0x0;this[_0x09fd('0xc')]=_0x40686a[_0x09fd('0xc')]||'';this[_0x09fd('0xd')]=_0x40686a[_0x09fd('0xd')]||'';this[_0x09fd('0xe')]=_0x40686a[_0x09fd('0xe')]||_0x09fd('0xf');this['waiting']=0x0;this[_0x09fd('0x10')]=0x0;this[_0x09fd('0x11')]=0x0;this['answered']=0x0;this[_0x09fd('0x12')]=0x0;this[_0x09fd('0x13')]=0x0;this['sumBillable']=0x0;this[_0x09fd('0x14')]=0x0;this[_0x09fd('0x15')]=0x0;this['loggedIn']=0x0;this[_0x09fd('0x16')]=0x0;this['acw']=_0x40686a['acw']||![];this[_0x09fd('0x17')]=_0x40686a[_0x09fd('0x17')]||0xa;this[_0x09fd('0x18')]=_0x40686a['autopause']||'no';this[_0x09fd('0x19')]=!![];this[_0x09fd('0x1a')]='';this['originated']=0x0;this[_0x09fd('0x1b')]=0x0;this['dialTimezone']=_0x40686a[_0x09fd('0x1c')]||null;this[_0x09fd('0x1d')]=_0x40686a[_0x09fd('0x1d')]?_0x40686a[_0x09fd('0x1d')]:null;this[_0x09fd('0x1e')]=_0x40686a[_0x09fd('0x1e')];this[_0x09fd('0x1f')]=_0x40686a[_0x09fd('0x1f')]||_0x09fd('0x20');this[_0x09fd('0x21')]=_0x40686a[_0x09fd('0x21')]||0x0;this[_0x09fd('0x22')]=_0x40686a[_0x09fd('0x22')]||0x0;this[_0x09fd('0x23')]=_0x40686a[_0x09fd('0x23')]||0x1;this[_0x09fd('0x24')]=_0x40686a['dialPredictiveOptimization']||_0x09fd('0x25');this[_0x09fd('0x26')]=_0x40686a[_0x09fd('0x26')]||0.03;this[_0x09fd('0x27')]=_0x40686a[_0x09fd('0x27')]||0x258;this[_0x09fd('0x28')]=_0x40686a['dialOriginateCallerIdName']||'anonymous';this[_0x09fd('0x29')]=_0x40686a[_0x09fd('0x29')]||_0x09fd('0x2a');this[_0x09fd('0x2b')]=_0x40686a[_0x09fd('0x2b')]||0x1e;this[_0x09fd('0x2c')]=_0x40686a[_0x09fd('0x2c')]||'tTxX';this['dialQueueTimeout']=_0x40686a[_0x09fd('0x2d')]||0x3;this['dialQueueProject']=_0x40686a[_0x09fd('0x2e')]||undefined;this[_0x09fd('0x2f')]=_0x40686a[_0x09fd('0x2f')]||0x3;this[_0x09fd('0x30')]=_0x40686a['dialCongestionRetryFrequency']||0x96;this['dialBusyMaxRetry']=_0x40686a[_0x09fd('0x31')]||0x3;this['dialBusyRetryFrequency']=_0x40686a[_0x09fd('0x32')]||0x96;this[_0x09fd('0x33')]=_0x40686a['dialNoAnswerMaxRetry']||0x3;this[_0x09fd('0x34')]=_0x40686a['dialNoAnswerRetryFrequency']||0x96;this[_0x09fd('0x35')]=_0x40686a['dialNoSuchNumberMaxRetry']||0x3;this['dialNoSuchNumberRetryFrequency']=_0x40686a[_0x09fd('0x36')]||0x96;this[_0x09fd('0x37')]=_0x40686a['dialDropMaxRetry']||0x3;this[_0x09fd('0x38')]=_0x40686a['dialDropRetryFrequency']||0x96;this['dialAbandonedMaxRetry']=_0x40686a[_0x09fd('0x39')]||0x3;this[_0x09fd('0x3a')]=_0x40686a[_0x09fd('0x3a')]||0x96;this[_0x09fd('0x3b')]=_0x40686a['dialMachineMaxRetry']||0x3;this['dialMachineRetryFrequency']=_0x40686a['dialMachineRetryFrequency']||0x96;this[_0x09fd('0x3c')]=_0x40686a['dialAgentRejectMaxRetry']||0x3;this[_0x09fd('0x3d')]=_0x40686a[_0x09fd('0x3d')]||0x96;this[_0x09fd('0x3e')]=_0x40686a[_0x09fd('0x3e')]||0x4;this[_0x09fd('0x3f')]=_0x40686a[_0x09fd('0x3f')]?_0x40686a[_0x09fd('0x3f')]:undefined;this[_0x09fd('0x40')]=_0x40686a['TrunkBackup']?_0x40686a[_0x09fd('0x40')]:undefined;this[_0x09fd('0x41')]=_0x40686a[_0x09fd('0x41')]||undefined;this[_0x09fd('0x42')]=_0x40686a[_0x09fd('0x42')]?_0x40686a[_0x09fd('0x42')]:undefined;this[_0x09fd('0x43')]=_0x40686a['dialOrderByScheduledAt']||'DESC';this[_0x09fd('0x44')]=_0x40686a[_0x09fd('0x44')]||undefined;this[_0x09fd('0x45')]=_0x40686a[_0x09fd('0x45')]||undefined;this[_0x09fd('0x46')]=strategy[_0x40686a['strategy']]||_0x09fd('0xa');this['queueStatusComplete']=!![];this[_0x09fd('0x47')]=_0x40686a['dialAMDActive']||![];this[_0x09fd('0x48')]=_0x40686a[_0x09fd('0x48')];this[_0x09fd('0x49')]=_0x40686a[_0x09fd('0x49')];this[_0x09fd('0x4a')]=_0x40686a[_0x09fd('0x4a')];this['dialAMDTotalAnalysisTime']=_0x40686a[_0x09fd('0x4b')];this[_0x09fd('0x4c')]=_0x40686a[_0x09fd('0x4c')];this['dialAMDBetweenWordsSilence']=_0x40686a[_0x09fd('0x4d')];this[_0x09fd('0x4e')]=_0x40686a[_0x09fd('0x4e')];this[_0x09fd('0x4f')]=_0x40686a['dialAMDSilenceThreshold'];this[_0x09fd('0x50')]=_0x40686a[_0x09fd('0x50')];this['outboundRejectCallsDay']=0x0;this['pTalking']=0x0;this['timeout']=_0x40686a['timeout'];this[_0x09fd('0x51')]=0x0;this[_0x09fd('0x52')]=0x0;this[_0x09fd('0x53')]=0x0;this[_0x09fd('0x54')]=0x0;this[_0x09fd('0x55')]=0x0;this['outboundNoSuchCallsDay']=0x0;this[_0x09fd('0x56')]=0x0;this['outboundBlacklistCallsDay']=0x0;this[_0x09fd('0x57')]=0x0;this['outboundDropCallsDayCallersExit']=0x0;this[_0x09fd('0x58')]=0x0;this[_0x09fd('0x59')]=0x0;this[_0x09fd('0x5a')]=0x0;this[_0x09fd('0x5b')]=0x0;this[_0x09fd('0x5c')]=undefined;this[_0x09fd('0x5d')]=undefined;this[_0x09fd('0x5e')]=undefined;this['predictiveIntervalMultiplicativeFactor']=1.05;this[_0x09fd('0x5f')]=0x0;this[_0x09fd('0x60')]=0x0;this[_0x09fd('0x61')]=0x0;this[_0x09fd('0x62')]=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this['predictiveIntervalAvgTalktime']=0x0;this[_0x09fd('0x63')]=0x0;this[_0x09fd('0x64')]=0x0;this[_0x09fd('0x65')]=_0x40686a['dialPredictiveIntervalMaxThreshold']||0x14;this[_0x09fd('0x66')]=_0x40686a[_0x09fd('0x67')]||0xa;this['predictiveIntervalErlangCalls']=0x0;this[_0x09fd('0x68')]=0x0;this[_0x09fd('0x69')]=0x1;this[_0x09fd('0x6a')]=0x0;this[_0x09fd('0x6b')]=0x0;this[_0x09fd('0x6c')]=0x0;this[_0x09fd('0x6d')]=0x0;this[_0x09fd('0x6e')]=_0x40686a[_0x09fd('0x6e')]||0x1e;this[_0x09fd('0x6f')]=_0x40686a[_0x09fd('0x6f')]||![];this['dialPreviewAutoRecallMe']=!!_0x40686a[_0x09fd('0x70')]||![];this['dialPreviewRecallmeReminder']=!!_0x40686a[_0x09fd('0x71')]||![];this[_0x09fd('0x72')]=_0x40686a['dialQueueProject2']||undefined;this[_0x09fd('0x73')]=_0x40686a[_0x09fd('0x73')]||![];this[_0x09fd('0x74')]=_0x40686a['dialAgiAfterHangupAgent']||![];this[_0x09fd('0xd')]=monitorFormat[_0x40686a['monitor_format']]?monitorFormat[_0x40686a[_0x09fd('0xd')]]:undefined;this['mandatoryDisposition']=_0x40686a[_0x09fd('0x75')]||![];this[_0x09fd('0x76')]=_0x40686a[_0x09fd('0x76')]?_0x40686a[_0x09fd('0x76')]:undefined;}module['exports']=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index f72cf70..cbba983 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 _0xa555=['name','username','accessKey','remoteUri','serverUrl','Configurations','exports'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xa555,0x181));var _0x5a55=function(_0x238671,_0x34aea0){_0x238671=_0x238671-0x0;var _0x474844=_0xa555[_0x238671];return _0x474844;};'use strict';function VtigerAccount(_0x3a1fbe){this['id']=_0x3a1fbe['id']||0x0;this[_0x5a55('0x0')]=_0x3a1fbe['name']||'';this['username']=_0x3a1fbe[_0x5a55('0x1')]||'';this[_0x5a55('0x2')]=_0x3a1fbe['accessKey']||'';this[_0x5a55('0x3')]=_0x3a1fbe[_0x5a55('0x3')]||'';this[_0x5a55('0x4')]=_0x3a1fbe[_0x5a55('0x4')]||'';this['Configurations']=_0x3a1fbe[_0x5a55('0x5')]||{};}module[_0x5a55('0x6')]=VtigerAccount; \ No newline at end of file +var _0xa94f=['accessKey','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x579cc2,_0x1bf82f){var _0x2b1b2e=function(_0x47d8e6){while(--_0x47d8e6){_0x579cc2['push'](_0x579cc2['shift']());}};_0x2b1b2e(++_0x1bf82f);}(_0xa94f,0xad));var _0xfa94=function(_0x3bdcbb,_0x420a2c){_0x3bdcbb=_0x3bdcbb-0x0;var _0x2c90fc=_0xa94f[_0x3bdcbb];return _0x2c90fc;};'use strict';function VtigerAccount(_0x491250){this['id']=_0x491250['id']||0x0;this['name']=_0x491250[_0xfa94('0x0')]||'';this[_0xfa94('0x1')]=_0x491250[_0xfa94('0x1')]||'';this[_0xfa94('0x2')]=_0x491250[_0xfa94('0x2')]||'';this[_0xfa94('0x3')]=_0x491250[_0xfa94('0x3')]||'';this[_0xfa94('0x4')]=_0x491250['serverUrl']||'';this[_0xfa94('0x5')]=_0x491250['Configurations']||{};}module[_0xfa94('0x6')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index 04414ae..42506ef 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 _0xff8d=['serverUrl','Configurations','exports','name','username','password','token','remoteUri','authType','type','integrationTab'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xff8d,0x71));var _0xdff8=function(_0x20b6df,_0x55508b){_0x20b6df=_0x20b6df-0x0;var _0x29828d=_0xff8d[_0x20b6df];return _0x29828d;};'use strict';function ZendeskAccount(_0x2004b0){this['id']=_0x2004b0['id']||0x0;this[_0xdff8('0x0')]=_0x2004b0[_0xdff8('0x0')]||'';this[_0xdff8('0x1')]=_0x2004b0[_0xdff8('0x1')]||'';this[_0xdff8('0x2')]=_0x2004b0[_0xdff8('0x2')]||'';this[_0xdff8('0x3')]=_0x2004b0[_0xdff8('0x3')]||'';this[_0xdff8('0x4')]=_0x2004b0[_0xdff8('0x4')]||'';this[_0xdff8('0x5')]=_0x2004b0[_0xdff8('0x5')]||'';this[_0xdff8('0x6')]=_0x2004b0['type']||_0xdff8('0x7');this['serverUrl']=_0x2004b0[_0xdff8('0x8')]||'';this[_0xdff8('0x9')]=_0x2004b0[_0xdff8('0x9')]||{};}module[_0xdff8('0xa')]=ZendeskAccount; \ No newline at end of file +var _0xb9bf=['name','username','password','token','remoteUri','type','serverUrl','Configurations','exports'];(function(_0x45b933,_0x3c67a9){var _0x417f9a=function(_0x524c08){while(--_0x524c08){_0x45b933['push'](_0x45b933['shift']());}};_0x417f9a(++_0x3c67a9);}(_0xb9bf,0x15f));var _0xfb9b=function(_0xef8146,_0x459c34){_0xef8146=_0xef8146-0x0;var _0x5a6cb0=_0xb9bf[_0xef8146];return _0x5a6cb0;};'use strict';function ZendeskAccount(_0x55e4b8){this['id']=_0x55e4b8['id']||0x0;this[_0xfb9b('0x0')]=_0x55e4b8[_0xfb9b('0x0')]||'';this[_0xfb9b('0x1')]=_0x55e4b8[_0xfb9b('0x1')]||'';this['password']=_0x55e4b8[_0xfb9b('0x2')]||'';this['token']=_0x55e4b8[_0xfb9b('0x3')]||'';this[_0xfb9b('0x4')]=_0x55e4b8[_0xfb9b('0x4')]||'';this['authType']=_0x55e4b8['authType']||'';this[_0xfb9b('0x5')]=_0x55e4b8['type']||'integrationTab';this[_0xfb9b('0x6')]=_0x55e4b8[_0xfb9b('0x6')]||'';this['Configurations']=_0x55e4b8[_0xfb9b('0x7')]||{};}module[_0xfb9b('0x8')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index c12f150..bed2b35 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 _0x2a97=['code','refreshToken','Configurations','exports','name','description','host','zone','clientId','clientSecret','serverUrl'];(function(_0x25ef7a,_0x10187a){var _0xd4c6f8=function(_0x48f72a){while(--_0x48f72a){_0x25ef7a['push'](_0x25ef7a['shift']());}};_0xd4c6f8(++_0x10187a);}(_0x2a97,0xca));var _0x72a9=function(_0x345b5b,_0x3d4f27){_0x345b5b=_0x345b5b-0x0;var _0x5d688a=_0x2a97[_0x345b5b];return _0x5d688a;};'use strict';function ZohoAccount(_0x1c7389){this['id']=_0x1c7389['id']||0x0;this[_0x72a9('0x0')]=_0x1c7389[_0x72a9('0x0')]||'';this[_0x72a9('0x1')]=_0x1c7389[_0x72a9('0x1')]||'';this[_0x72a9('0x2')]=_0x1c7389[_0x72a9('0x2')]||'';this[_0x72a9('0x3')]=_0x1c7389[_0x72a9('0x3')]||'';this[_0x72a9('0x4')]=_0x1c7389[_0x72a9('0x4')]||'';this['clientSecret']=_0x1c7389[_0x72a9('0x5')]||'';this['serverUrl']=_0x1c7389[_0x72a9('0x6')]||'';this[_0x72a9('0x7')]=_0x1c7389[_0x72a9('0x7')]||'';this[_0x72a9('0x8')]=_0x1c7389[_0x72a9('0x8')]||'';this[_0x72a9('0x9')]=_0x1c7389[_0x72a9('0x9')]||{};}module[_0x72a9('0xa')]=ZohoAccount; \ No newline at end of file +var _0xc6df=['name','description','host','zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations','exports'];(function(_0x1a2ee2,_0x47ee6b){var _0x1a9355=function(_0x5809ed){while(--_0x5809ed){_0x1a2ee2['push'](_0x1a2ee2['shift']());}};_0x1a9355(++_0x47ee6b);}(_0xc6df,0xa5));var _0xfc6d=function(_0x4c53b8,_0x442f32){_0x4c53b8=_0x4c53b8-0x0;var _0x4cb8f4=_0xc6df[_0x4c53b8];return _0x4cb8f4;};'use strict';function ZohoAccount(_0x2e2bb6){this['id']=_0x2e2bb6['id']||0x0;this[_0xfc6d('0x0')]=_0x2e2bb6['name']||'';this[_0xfc6d('0x1')]=_0x2e2bb6[_0xfc6d('0x1')]||'';this['host']=_0x2e2bb6[_0xfc6d('0x2')]||'';this[_0xfc6d('0x3')]=_0x2e2bb6['zone']||'';this[_0xfc6d('0x4')]=_0x2e2bb6[_0xfc6d('0x4')]||'';this[_0xfc6d('0x5')]=_0x2e2bb6[_0xfc6d('0x5')]||'';this[_0xfc6d('0x6')]=_0x2e2bb6[_0xfc6d('0x6')]||'';this[_0xfc6d('0x7')]=_0x2e2bb6[_0xfc6d('0x7')]||'';this[_0xfc6d('0x8')]=_0x2e2bb6['refreshToken']||'';this['Configurations']=_0x2e2bb6[_0xfc6d('0x9')]||{};}module[_0xfc6d('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 16133bc..51ad10d 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 _0x5e00=['recallme','ContactId','ListId','UserId','VoiceQueueId','prototype','\x22%s\x22\x20<%s>','exports','lodash','isNil','string','uniqueid','idContact','queue','name','type','campaigntype','dialAnswer','Agent','channelAgent','membername','format','SIP/%s','calleridname','Contact','firstName','active','calleridnum','phone','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countdropretry','callback','callbackuniqueid','callbackat'];(function(_0x3ead90,_0x28fe97){var _0xa464f0=function(_0x4d91f3){while(--_0x4d91f3){_0x3ead90['push'](_0x3ead90['shift']());}};_0xa464f0(++_0x28fe97);}(_0x5e00,0x158));var _0x05e0=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x5e00[_0x57b54c];return _0x59cc19;};'use strict';var util=require('util');var _=require(_0x05e0('0x0'));var moment=require('moment');function checkNameSurname(_0x3dca79,_0x567bce,_0x34606f){var _0x187dfe='';if(!_[_0x05e0('0x1')](_0x567bce)&&_0x05e0('0x2')===typeof _0x567bce){_0x187dfe+=_0x567bce;}if(!_[_0x05e0('0x1')](_0x34606f)&&_0x05e0('0x2')===typeof _0x34606f){_0x187dfe+='\x20'+_0x34606f;}if(_0x187dfe!==''){return _0x187dfe;}return _0x3dca79;}function Action(_0x4dcb95,_0x9f3149,_0x32d3af,_0x364032,_0x2da86c){this[_0x05e0('0x3')]=_0x32d3af||undefined;this[_0x05e0('0x4')]=_0x4dcb95['id'];this[_0x05e0('0x5')]=_0x9f3149[_0x05e0('0x6')];this['type']=_0x9f3149[_0x05e0('0x7')];this[_0x05e0('0x8')]=_0x05e0('0x5');this[_0x05e0('0x9')]=![];this['membername']=_[_0x05e0('0x1')](_0x4dcb95[_0x05e0('0xa')])?undefined:_0x4dcb95[_0x05e0('0xa')][_0x05e0('0x6')];this[_0x05e0('0xb')]=this[_0x05e0('0xc')]?util[_0x05e0('0xd')](_0x05e0('0xe'),this['membername']):_0x364032||undefined;this[_0x05e0('0xf')]=checkNameSurname(_0x4dcb95[_0x05e0('0x10')]['phone'],_0x4dcb95['Contact'][_0x05e0('0x11')],_0x4dcb95[_0x05e0('0x10')]['lastName']);this[_0x05e0('0x12')]=_0x4dcb95[_0x05e0('0x12')]||![];this[_0x05e0('0x13')]=_0x4dcb95[_0x05e0('0x10')][_0x05e0('0x14')];this[_0x05e0('0x15')]=_0x4dcb95[_0x05e0('0x15')];this[_0x05e0('0x16')]=_0x4dcb95[_0x05e0('0x16')]||0x0;this[_0x05e0('0x17')]=_0x4dcb95['countcongestionretry']||0x0;this[_0x05e0('0x18')]=_0x4dcb95[_0x05e0('0x18')]||0x0;this[_0x05e0('0x19')]=(_0x4dcb95['countbusyretry']||0x0)+(_0x4dcb95['countcongestionretry']||0x0)+(_0x4dcb95[_0x05e0('0x18')]||0x0)+(_0x4dcb95['countnosuchnumberretry']||0x0)+(_0x4dcb95['countdropretry']||0x0)+(_0x4dcb95[_0x05e0('0x1a')]||0x0)+(_0x4dcb95[_0x05e0('0x1b')]||0x0)+(_0x4dcb95[_0x05e0('0x1c')]||0x0);this[_0x05e0('0x1d')]=_0x4dcb95[_0x05e0('0x1d')]||0x0;this['countdropretry']=_0x4dcb95[_0x05e0('0x1e')]||0x0;this['countabandonedretry']=_0x4dcb95['countabandonedretry']||0x0;this[_0x05e0('0x1b')]=_0x4dcb95[_0x05e0('0x1b')]||0x0;this[_0x05e0('0x1c')]=_0x4dcb95[_0x05e0('0x1c')]||0x0;this[_0x05e0('0x1f')]=_0x4dcb95['callback'];this[_0x05e0('0x20')]=_0x4dcb95['callbackuniqueid'];this[_0x05e0('0x21')]=_0x4dcb95[_0x05e0('0x21')];this[_0x05e0('0x22')]=_0x4dcb95[_0x05e0('0x22')];this['ContactId']=_0x4dcb95[_0x05e0('0x23')];this['ListId']=_0x4dcb95[_0x05e0('0x24')];this['UserId']=_[_0x05e0('0x1')](_0x4dcb95[_0x05e0('0xa')])?_0x4dcb95[_0x05e0('0x25')]:_0x4dcb95[_0x05e0('0xa')]['id'];this['VoiceQueueId']=_0x4dcb95[_0x05e0('0x26')];this['originatecalleridnum']='';this['originatecalleridname']='';}Action[_0x05e0('0x27')]['getCaller']=function(){return util[_0x05e0('0xd')](_0x05e0('0x28'),this[_0x05e0('0xf')],this['number']);};module[_0x05e0('0x29')]=Action; \ No newline at end of file +var _0x0dfc=['calleridnum','countbusyretry','countnoanswerretry','countcongestionretry','countdropretry','countmachineretry','countabandonedretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','prototype','\x22%s\x22\x20<%s>','number','util','lodash','moment','isNil','string','idContact','queue','name','type','campaigntype','dialAnswer','membername','Agent','channelAgent','format','SIP/%s','calleridname','Contact','phone','firstName','lastName','active'];(function(_0x3d7de8,_0x2a2ec4){var _0x5e9a0c=function(_0x5b0499){while(--_0x5b0499){_0x3d7de8['push'](_0x3d7de8['shift']());}};_0x5e9a0c(++_0x2a2ec4);}(_0x0dfc,0xe0));var _0xc0df=function(_0xb089c8,_0x19bb4a){_0xb089c8=_0xb089c8-0x0;var _0x481ac2=_0x0dfc[_0xb089c8];return _0x481ac2;};'use strict';var util=require(_0xc0df('0x0'));var _=require(_0xc0df('0x1'));var moment=require(_0xc0df('0x2'));function checkNameSurname(_0x17f0c3,_0x33417f,_0x59d2b0){var _0x5445a0='';if(!_[_0xc0df('0x3')](_0x33417f)&&_0xc0df('0x4')===typeof _0x33417f){_0x5445a0+=_0x33417f;}if(!_[_0xc0df('0x3')](_0x59d2b0)&&_0xc0df('0x4')===typeof _0x59d2b0){_0x5445a0+='\x20'+_0x59d2b0;}if(_0x5445a0!==''){return _0x5445a0;}return _0x17f0c3;}function Action(_0x5cca77,_0x57b697,_0x278fff,_0x4d7016,_0x115b22){this['uniqueid']=_0x278fff||undefined;this[_0xc0df('0x5')]=_0x5cca77['id'];this[_0xc0df('0x6')]=_0x57b697[_0xc0df('0x7')];this['type']=_0x57b697[_0xc0df('0x8')];this[_0xc0df('0x9')]='queue';this[_0xc0df('0xa')]=![];this[_0xc0df('0xb')]=_['isNil'](_0x5cca77[_0xc0df('0xc')])?undefined:_0x5cca77['Agent'][_0xc0df('0x7')];this[_0xc0df('0xd')]=this['membername']?util[_0xc0df('0xe')](_0xc0df('0xf'),this[_0xc0df('0xb')]):_0x4d7016||undefined;this[_0xc0df('0x10')]=checkNameSurname(_0x5cca77[_0xc0df('0x11')][_0xc0df('0x12')],_0x5cca77['Contact'][_0xc0df('0x13')],_0x5cca77['Contact'][_0xc0df('0x14')]);this[_0xc0df('0x15')]=_0x5cca77[_0xc0df('0x15')]||![];this[_0xc0df('0x16')]=_0x5cca77[_0xc0df('0x11')][_0xc0df('0x12')];this['scheduledat']=_0x5cca77['scheduledat'];this['countbusyretry']=_0x5cca77[_0xc0df('0x17')]||0x0;this['countcongestionretry']=_0x5cca77['countcongestionretry']||0x0;this[_0xc0df('0x18')]=_0x5cca77[_0xc0df('0x18')]||0x0;this['countglobal']=(_0x5cca77[_0xc0df('0x17')]||0x0)+(_0x5cca77[_0xc0df('0x19')]||0x0)+(_0x5cca77['countnoanswerretry']||0x0)+(_0x5cca77['countnosuchnumberretry']||0x0)+(_0x5cca77[_0xc0df('0x1a')]||0x0)+(_0x5cca77['countabandonedretry']||0x0)+(_0x5cca77[_0xc0df('0x1b')]||0x0)+(_0x5cca77['countagentrejectretry']||0x0);this['countnosuchnumberretry']=_0x5cca77['countnosuchnumberretry']||0x0;this[_0xc0df('0x1a')]=_0x5cca77['countdropretry']||0x0;this[_0xc0df('0x1c')]=_0x5cca77['countabandonedretry']||0x0;this[_0xc0df('0x1b')]=_0x5cca77[_0xc0df('0x1b')]||0x0;this[_0xc0df('0x1d')]=_0x5cca77[_0xc0df('0x1d')]||0x0;this[_0xc0df('0x1e')]=_0x5cca77[_0xc0df('0x1e')];this['callbackuniqueid']=_0x5cca77[_0xc0df('0x1f')];this[_0xc0df('0x20')]=_0x5cca77[_0xc0df('0x20')];this['recallme']=_0x5cca77[_0xc0df('0x21')];this['ContactId']=_0x5cca77[_0xc0df('0x22')];this[_0xc0df('0x23')]=_0x5cca77[_0xc0df('0x23')];this['UserId']=_[_0xc0df('0x3')](_0x5cca77[_0xc0df('0xc')])?_0x5cca77[_0xc0df('0x24')]:_0x5cca77[_0xc0df('0xc')]['id'];this['VoiceQueueId']=_0x5cca77[_0xc0df('0x25')];this['originatecalleridnum']='';this['originatecalleridname']='';}Action[_0xc0df('0x26')]['getCaller']=function(){return util['format'](_0xc0df('0x27'),this['calleridname'],this[_0xc0df('0x28')]);};module['exports']=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 9d084ff..ee85569 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 _0xb66c=['originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','Action','variablesAction','[originated][increment]','OriginateError','actionid','logLookAgent','clone','isFailure','unlockContact','custom:agentringnoanswer','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','destuniqueid','syncHangupRequest','addVariable','variables','filterKey','keys','variable','error','[syncVarSet][Preview]','transfertargetlinkedid','exports','util','bluebird','moment','md5','ioredis','../../../config/logger','preview','actionPreview','./action','./util/util','redis','defaults','socket.io-emitter','prototype','enqueue','tail','finally','campaignsPreview','voiceQueues','trunks','agents','clockClearZombieChannels','originateresponse','bind','syncHangup','hanguprequest','dialend','syncDialEnd','newexten','varset','syncVarSet','attendedtransfer','blindtransfer','syncBlindTransfer','outbound','name','strategy','answered','available','loggedIn','sumBillable','talking','total','type','abandoned','waiting','loggedInDb','dialActive','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayTimeout','outboundReCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','stringify','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','format','sendMessageOneNotActive','pTalking','paused','message','NOT_ACTIVE','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','IS_DISACTIVED','logger','\x20is\x20disactive','syncCampaigns','hasOwnProperty','booked','clearZombieChannels','dialMethod','setMessage','dialPreviewAutoRecallMe','recallMe','clearZombieChannel','sequence','actions','[clearZombieChannels][talking]','Queue','queue','originated:\x20','pTalking:\x20','contactId','UserId','ListId','status','channel','catch','No\x20such\x20channel','updateOriginated','dialAnswer','decrementTalkink','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','size','getContactRecallMe','then','length','getDiff','Agent','voicePause','logger2','[RecallMe]','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','[getContactRecallMe]','IsNotLoggedIn','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','countglobal','totalGlobal','NoSuchNumber','emit','custom:agentnosuchnumber','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','cloneAction','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','countnosuchnumberretry','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt','dialNoSuchNumberRetryFrequency','unlockAgent','activeContact','linkedid','ANSWER','responsetime','uniqueid','\x20Queue','custom:agentconnect','buildObj','connect','acw','buildAcw','custom:agentcomplete','complete','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','[syncHangup][talking][decrement]','BUSY','countbusyretry','Busy','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','Global','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','dialBusyRetryFrequency','NOANSWER','countnoanswerretry','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','CONGESTION','Congestion','custom:agentcongestion','congestion','countcongestionretry','[callProgressDetectingCustomer][logCongestion]','CANCEL','outboundRejectCallsDay','countagentrejectretry','custom:agentreject','[syncHangupRequest][logAgentReject]','AgentReject','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','ABANDONED','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countmachineretry','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','cause-txt','[callProgressDetectingCustomer][machine]','[default]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','isUndefined','object','createAgentHistory','NoAnswer','[callProgressDetectingAgent][logNoAnswer]','logAgent','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','reason','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','isNil','Contact','phone','VoiceQueueId','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','idContact','custom:agentcalled','[Preview][execCall][failure]','Call\x20failed','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','SIP/%s','run','pick','unlock','disableContact','execRun','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','Contact.phone','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','[Preview][validateContact][Empty\x20Campaign]','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','trim','dialCutDigit','substring','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','getCallerId','extractCalleridName'];(function(_0x50f164,_0x48b7f3){var _0x40f7f9=function(_0x4ffe88){while(--_0x4ffe88){_0x50f164['push'](_0x50f164['shift']());}};_0x40f7f9(++_0x48b7f3);}(_0xb66c,0x175));var _0xcb66=function(_0x4ad0a1,_0x357865){_0x4ad0a1=_0x4ad0a1-0x0;var _0x441a45=_0xb66c[_0x4ad0a1];return _0x441a45;};'use strict';var util=require(_0xcb66('0x0'));var _=require('lodash');var BPromise=require(_0xcb66('0x1'));var uuid=require('uuid');var moment=require(_0xcb66('0x2'));var md5=require(_0xcb66('0x3'));var Redis=require(_0xcb66('0x4'));var config=require('../../../config/environment');var logger=require(_0xcb66('0x5'))(_0xcb66('0x6'));var loggerAction=require(_0xcb66('0x5'))(_0xcb66('0x7'));var ami=require('../ami');var rpcDb=require('./rpcDb');var Action=require(_0xcb66('0x8'));var ut=require(_0xcb66('0x9'));config[_0xcb66('0xa')]=_[_0xcb66('0xb')](config[_0xcb66('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0xcb66('0xc'))(new Redis(config[_0xcb66('0xa')]));var Sequence=function(){};Sequence[_0xcb66('0xd')][_0xcb66('0xe')]=function(_0x3c4ce1){this['tail']=this[_0xcb66('0xf')]?this[_0xcb66('0xf')][_0xcb66('0x10')](_0x3c4ce1):_0x3c4ce1();};function Preview(_0x38c2e6){this['sequence']=new Sequence();this[_0xcb66('0x11')]=_0x38c2e6[_0xcb66('0x12')];this[_0xcb66('0x13')]=_0x38c2e6[_0xcb66('0x13')];this['actions']={};this[_0xcb66('0x14')]=_0x38c2e6[_0xcb66('0x14')];this[_0xcb66('0x15')]=0x0;ami['on'](_0xcb66('0x16'),this['syncOriginateResponse'][_0xcb66('0x17')](this));ami['on']('hangup',this[_0xcb66('0x18')]['bind'](this));ami['on'](_0xcb66('0x19'),this['syncHangupRequest']['bind'](this));ami['on'](_0xcb66('0x1a'),this[_0xcb66('0x1b')][_0xcb66('0x17')](this));ami['on'](_0xcb66('0x1c'),this['syncNewExten'][_0xcb66('0x17')](this));ami['on'](_0xcb66('0x1d'),this[_0xcb66('0x1e')]['bind'](this));ami['on'](_0xcb66('0x1f'),this['syncAttendedTransfer'][_0xcb66('0x17')](this));ami['on'](_0xcb66('0x20'),this[_0xcb66('0x21')][_0xcb66('0x17')](this));this['loopCampaigns'](this['campaignsPreview']);}function emit(_0x4d9690,_0xb39b87,_0x4b13d4){io['to'](_0x4d9690)['emit'](_0xb39b87,_0x4b13d4);}function emitCampaignPreview(_0x419540){if(_0x419540['type']===_0xcb66('0x22')){var _0x12e2bc={'id':_0x419540['id'],'name':_0x419540[_0xcb66('0x23')],'strategy':_0x419540[_0xcb66('0x24')],'answered':_0x419540[_0xcb66('0x25')],'available':_0x419540[_0xcb66('0x26')],'loggedIn':_0x419540[_0xcb66('0x27')],'pTalking':_0x419540['pTalking'],'sumBillable':_0x419540[_0xcb66('0x28')],'sumDuration':_0x419540['sumDuration'],'sumHoldTime':_0x419540['sumHoldTime']||0x0,'talking':_0x419540[_0xcb66('0x29')],'total':_0x419540[_0xcb66('0x2a')],'type':_0x419540[_0xcb66('0x2b')],'unmanaged':_0x419540['unmanaged'],'abandoned':_0x419540[_0xcb66('0x2c')],'waiting':_0x419540[_0xcb66('0x2d')],'loggedInDb':_0x419540[_0xcb66('0x2e')],'dialActive':_0x419540[_0xcb66('0x2f')],'dialMethod':_0x419540['dialMethod'],'dialOriginateCallerIdName':_0x419540[_0xcb66('0x30')],'dialOriginateCallerIdNumber':_0x419540[_0xcb66('0x31')],'dialOriginateTimeout':_0x419540[_0xcb66('0x32')],'dialPrefix':_0x419540[_0xcb66('0x33')],'outboundAnswerAgiCallsDay':_0x419540[_0xcb66('0x34')],'outboundAnswerCallsDay':_0x419540[_0xcb66('0x35')],'outboundBlacklistCallsDay':_0x419540[_0xcb66('0x36')],'outboundBusyCallsDay':_0x419540[_0xcb66('0x37')],'outboundCongestionCallsDay':_0x419540[_0xcb66('0x38')],'outboundDropCallsDayACS':_0x419540[_0xcb66('0x39')],'outboundDropCallsDayCallersExit':_0x419540['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x419540[_0xcb66('0x3a')],'outboundNoAnswerCallsDay':_0x419540['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x419540['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x419540['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x419540[_0xcb66('0x3b')],'outboundRejectCallsDay':_0x419540['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x419540[_0xcb66('0x3c')],'outboundAbandonedCallsDay':_0x419540[_0xcb66('0x3d')],'predictiveIntervalAnsweredCalls':_0x419540[_0xcb66('0x3e')],'predictiveIntervalAvgHoldtime':_0x419540['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x419540[_0xcb66('0x3f')],'predictiveIntervalDroppedCallsCallersExit':_0x419540[_0xcb66('0x40')],'predictiveIntervalDroppedCallsTimeout':_0x419540[_0xcb66('0x41')],'predictiveIntervalErlangCalls':_0x419540[_0xcb66('0x42')],'predictiveIntervalErlangCallsDroppedCalls':_0x419540[_0xcb66('0x43')],'predictiveIntervalHitRate':_0x419540[_0xcb66('0x44')],'predictiveIntervalMultiplicativeFactor':_0x419540[_0xcb66('0x45')],'predictiveIntervalPauses':_0x419540[_0xcb66('0x46')],'predictiveIntervalAvailable':_0x419540[_0xcb66('0x47')],'predictiveIntervalTotalCalls':_0x419540[_0xcb66('0x48')],'message':_0x419540['message'],'originated':_0x419540[_0xcb66('0x49')],'erlangCalls':_0x419540[_0xcb66('0x4a')],'erlangCallToSecond':_0x419540[_0xcb66('0x4b')],'erlangAbandonmentRate':_0x419540[_0xcb66('0x4c')],'erlangBusyFactor':_0x419540[_0xcb66('0x4d')],'startPredictive':_0x419540[_0xcb66('0x4e')],'startProgressive':_0x419540[_0xcb66('0x4f')]};if(_0x419540['Trunk']){_0x12e2bc[_0xcb66('0x50')]={'id':_0x419540[_0xcb66('0x50')]['id'],'name':_0x419540[_0xcb66('0x50')][_0xcb66('0x23')],'active':_0x419540['Trunk'][_0xcb66('0x51')],'callerid':_0x419540[_0xcb66('0x50')][_0xcb66('0x52')]};}if(_0x419540[_0xcb66('0x53')]){_0x12e2bc[_0xcb66('0x53')]={'id':_0x419540[_0xcb66('0x53')]['id'],'name':_0x419540[_0xcb66('0x53')][_0xcb66('0x23')]};}var _0x3ae1cc=md5(JSON[_0xcb66('0x54')](_0x12e2bc));if(_0x419540[_0xcb66('0x3')]!==_0x3ae1cc){_0x419540[_0xcb66('0x3')]=_0x3ae1cc;emit(util['format']('voice:queue:%s',_0x12e2bc['name']),_0xcb66('0x55'),_0x12e2bc);}}}function emitVoiceQueueChannelRemove(_0x4182f9){logger[_0xcb66('0x56')](_0xcb66('0x57'),JSON[_0xcb66('0x54')](_0x4182f9));emit(util[_0xcb66('0x58')]('voice:queue:%s',_0x4182f9[_0xcb66('0x23')]),'voice_queue_channel:remove',_0x4182f9);io['emit']('voice_queue_presence:remove',_0x4182f9);}function notSendMessagesQueue(_0x411105){if(_0x411105[_0xcb66('0x59')]){if(_0x411105[_0xcb66('0x49')]===0x0&&_0x411105[_0xcb66('0x5a')]===0x0){_0x411105[_0xcb66('0x59')]=![];_0x411105[_0xcb66('0x26')]=0x0;_0x411105[_0xcb66('0x5b')]=0x0;_0x411105[_0xcb66('0x5c')]=_0xcb66('0x5d');ut['logger'](_0xcb66('0x5e'),_0x411105[_0xcb66('0x23')]+_0xcb66('0x5f'));}else{_0x411105['message']=_0xcb66('0x60');ut[_0xcb66('0x61')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x411105['name']+_0xcb66('0x62'));}emitCampaignPreview(_0x411105);}}Preview['prototype']['loopCampaigns']=function(){var _0x453ff2=this;setInterval(function(){_0x453ff2[_0xcb66('0x63')]();},0x7cf);};Preview[_0xcb66('0xd')][_0xcb66('0x63')]=function(){var _0x99229=this[_0xcb66('0x11')];this[_0xcb66('0x15')]+=0x1;for(var _0xff5ce5 in _0x99229){if(_0x99229[_0xcb66('0x64')](_0xff5ce5)&&(_0x99229[_0xff5ce5]['dialMethod']==='preview'||_0x99229[_0xff5ce5]['dialMethod']===_0xcb66('0x65'))&&_0x99229[_0xff5ce5]['type']===_0xcb66('0x22')){if(this['clockClearZombieChannels']>0x7){this[_0xcb66('0x15')]=0x0;this[_0xcb66('0x66')]();}}if(_0x99229[_0xcb66('0x64')](_0xff5ce5)&&_0x99229[_0xff5ce5][_0xcb66('0x67')]===_0xcb66('0x6')&&_0x99229[_0xff5ce5][_0xcb66('0x2b')]==='outbound'){if(_0x99229[_0xff5ce5]['dialActive']){this[_0xcb66('0x68')](_0x99229[_0xff5ce5]);if(_0x99229[_0xff5ce5][_0xcb66('0x69')])this[_0xcb66('0x6a')](_0x99229[_0xff5ce5]);}else{notSendMessagesQueue(_0x99229[_0xff5ce5]);}}}};Preview[_0xcb66('0xd')][_0xcb66('0x6b')]=function(_0x1c149b){var _0x1465df=this;this[_0xcb66('0x6c')][_0xcb66('0xe')](function(){if(!_['isNil'](_0x1465df[_0xcb66('0x6d')][_0x1c149b])){loggerAction[_0xcb66('0x56')](_0xcb66('0x6e'),_0x1c149b,_0xcb66('0x6f'),_0x1465df['actions'][_0x1c149b][_0xcb66('0x70')],_0xcb66('0x71'),JSON[_0xcb66('0x54')](_0x1465df['campaignsPreview'][_0x1465df[_0xcb66('0x6d')][_0x1c149b][_0xcb66('0x70')]][_0xcb66('0x49')]),_0xcb66('0x72'),JSON['stringify'](_0x1465df[_0xcb66('0x11')][_0x1465df[_0xcb66('0x6d')][_0x1c149b][_0xcb66('0x70')]]['pTalking']),JSON['stringify'](_0x1465df[_0xcb66('0x6d')][_0x1c149b]['dialAnswer']),JSON[_0xcb66('0x54')](_['pick'](_0x1465df[_0xcb66('0x6d')][_0x1c149b],[_0xcb66('0x73'),_0xcb66('0x74'),'VoiceQueueId',_0xcb66('0x75')])));return ami['Action']({'action':_0xcb66('0x76'),'channel':_0x1465df[_0xcb66('0x6d')][_0x1c149b][_0xcb66('0x77')]})[_0xcb66('0x78')](function(_0x184265){if(_0x184265['message']===_0xcb66('0x79')){setTimeout(function(){if(_0x1465df['actions'][_0x1c149b]){ut[_0xcb66('0x7a')](_0x1465df[_0xcb66('0x11')][_0x1465df[_0xcb66('0x6d')][_0x1c149b]['queue']],'[clearZombieChannel]');if(_0x1465df['actions'][_0x1c149b][_0xcb66('0x7b')]===!![]){ut[_0xcb66('0x7c')](_0x1465df[_0xcb66('0x11')][_0x1465df[_0xcb66('0x6d')][_0x1c149b][_0xcb66('0x70')]],_0xcb66('0x7d'));ut[_0xcb66('0x7e')](_0xcb66('0x7f')+_0x1c149b,_0x1465df[_0xcb66('0x6d')][_0x1c149b][_0xcb66('0x70')]);}ut['loggerError'](_0xcb66('0x80')+_0x1c149b,_0x1465df[_0xcb66('0x6d')][_0x1c149b][_0xcb66('0x70')]);delete _0x1465df[_0xcb66('0x6d')][_0x1c149b];}},0x2328);}});}});};Preview['prototype']['clearZombieChannels']=function(){var _0x3b2e05=this;loggerAction[_0xcb66('0x56')](_0xcb66('0x81'),_[_0xcb66('0x82')](this[_0xcb66('0x6d')]));for(var _0x34b42f in this['actions']){if(_0x3b2e05[_0xcb66('0x6d')][_0xcb66('0x64')](_0x34b42f)){_0x3b2e05[_0xcb66('0x6b')](_0x34b42f);}}};Preview[_0xcb66('0xd')]['recallMe']=function(_0x454493){var _0x481c39=this;rpcDb[_0xcb66('0x83')](_0x454493['id'],ut['agentReadyId'](this[_0xcb66('0x14')]))[_0xcb66('0x84')](function(_0x146a06){if(!_['isNil'](_0x146a06)){for(var _0x54e6c2=0x0;_0x54e6c2<_0x146a06[_0xcb66('0x85')];_0x54e6c2+=0x1){if(ut[_0xcb66('0x86')](_0x146a06[_0x54e6c2]['scheduledat'])<_0x454493['dialRecallMeTimeout']*0x3c){if(_0x146a06[_0x54e6c2][_0xcb66('0x87')]&&!_0x146a06[_0x54e6c2]['Agent'][_0xcb66('0x88')]){_0x481c39['run'](_0x146a06[_0x54e6c2]['id'])[_0xcb66('0x84')](ut[_0xcb66('0x89')](_0xcb66('0x8a')))['catch'](ut[_0xcb66('0x89')](_0xcb66('0x8a')));}else{rpcDb['disableContact'](_0x146a06[_0x54e6c2]['id']);}}else{var _0x244003=new Action(_0x146a06[_0x54e6c2],_0x454493);_0x244003[_0xcb66('0x8b')]=moment()[_0xcb66('0x58')](_0xcb66('0x8c'));_0x454493[_0xcb66('0x3b')]+=0x1;ut[_0xcb66('0x8d')](_0x244003,0x17,'RecallInQueue');if(_0x454493[_0xcb66('0x8e')]){rpcDb[_0xcb66('0x8f')](ut[_0xcb66('0x90')](_0x146a06[_0x54e6c2]));rpcDb[_0xcb66('0x91')](_0x244003,_0xcb66('0x92'));}else{ut[_0xcb66('0x8d')](_0x244003,0x16,_0xcb66('0x93'));rpcDb[_0xcb66('0x91')](_0x244003,_0xcb66('0x94'));rpcDb['createCustomerFinal'](_0x244003,_0xcb66('0x94'));}}}}})[_0xcb66('0x78')](ut[_0xcb66('0x89')](_0xcb66('0x95')));};Preview[_0xcb66('0xd')][_0xcb66('0x68')]=function(_0x52e27d){_0x52e27d[_0xcb66('0x59')]=!![];if(ut[_0xcb66('0x96')](_0x52e27d['loggedIn'])){_0x52e27d[_0xcb66('0x5c')]=_0xcb66('0x97');}else if(!ut[_0xcb66('0x98')](_0x52e27d[_0xcb66('0x2f')])){_0x52e27d['message']=_0xcb66('0x5d');}else if(!this[_0xcb66('0x99')](_0x52e27d[_0xcb66('0x50')])){if(!this[_0xcb66('0x99')](_0x52e27d[_0xcb66('0x9a')])){_0x52e27d[_0xcb66('0x5c')]=_0xcb66('0x9b');}else{_0x52e27d[_0xcb66('0x5c')]=_0xcb66('0x9c');}}else{_0x52e27d[_0xcb66('0x5c')]='ACTIVE';}emitCampaignPreview(_0x52e27d);};Preview[_0xcb66('0xd')][_0xcb66('0x9d')]=function(_0x311a98,_0x2b8aca,_0x4f0462){var _0x3c4776=this;var _0x26c43c=this[_0xcb66('0x6d')][_0x2b8aca];var _0x1c0533=this[_0xcb66('0x11')][_0x26c43c[_0xcb66('0x70')]];var _0x185363;if(_0x1c0533){switch(_0x4f0462){case'1':_0x1c0533['outboundNoSuchCallsDay']+=0x1;_0x26c43c['countnosuchnumberretry']+=0x1;_0x26c43c[_0xcb66('0x9e')]=ut[_0xcb66('0x9f')](_0x26c43c);ut[_0xcb66('0x8d')](_0x26c43c,0x0,_0xcb66('0xa0'));ami[_0xcb66('0xa1')](_0xcb66('0xa2'),ut['buildObj'](_0x26c43c,_0xcb66('0xa3')));rpcDb[_0xcb66('0x91')](_0x26c43c,_0xcb66('0xa4'));if(ut[_0xcb66('0x9f')](_0x26c43c)>=_0x1c0533[_0xcb66('0xa5')]){_0x185363=ut[_0xcb66('0xa6')](_0x26c43c,0xf,'Global');rpcDb[_0xcb66('0xa7')](_0x185363,_0xcb66('0xa8'));}else{if(_0x26c43c[_0xcb66('0xa9')]>=_0x1c0533[_0xcb66('0xaa')]){rpcDb[_0xcb66('0xa7')](_0x26c43c,_0xcb66('0xa8'));}else{rpcDb[_0xcb66('0xab')](ut[_0xcb66('0xac')](_0x26c43c,_0xcb66('0xa9'),_0x1c0533[_0xcb66('0xad')]),_0x26c43c[_0xcb66('0xae')],_0x26c43c[_0xcb66('0xaf')]);}}delete this[_0xcb66('0x6d')][_0x311a98[_0xcb66('0xb0')]];break;case _0xcb66('0xb1'):var _0x39e86a=moment()[_0xcb66('0x58')](_0xcb66('0x8c'));_0x26c43c[_0xcb66('0xb2')]=_0x39e86a;_0x26c43c['answertime']=_0x39e86a;_0x26c43c[_0xcb66('0x7b')]=!![];_0x1c0533['pTalking']+=0x1;logger[_0xcb66('0x56')]('[syncHangup][talking][increment]',_0x26c43c[_0xcb66('0xb3')],_0xcb66('0xb4'),_0x1c0533[_0xcb66('0x23')],_0xcb66('0x72'),_0x1c0533[_0xcb66('0x5a')]);ami[_0xcb66('0xa1')](_0xcb66('0xb5'),ut[_0xcb66('0xb6')](_0x26c43c,_0xcb66('0xb7'),this[_0xcb66('0x11')][_0x26c43c[_0xcb66('0x70')]]));if(_0x1c0533[_0xcb66('0xb8')]){ami[_0xcb66('0xa1')]('custom:agentConnectPreview',ut[_0xcb66('0xb9')](_0x26c43c));}break;case'16':ami[_0xcb66('0xa1')](_0xcb66('0xba'),ut['buildObj'](_0x26c43c,_0xcb66('0xbb'),this[_0xcb66('0x11')][_0x26c43c[_0xcb66('0x70')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x26c43c,_0xcb66('0xbb')));_0x1c0533[_0xcb66('0x35')]+=0x1;_0x1c0533[_0xcb66('0x2a')]+=0x1;_0x1c0533[_0xcb66('0x25')]+=0x1;ut[_0xcb66('0x7c')](_0x1c0533,_0xcb66('0xbc'));_0x26c43c['countglobal']=ut[_0xcb66('0x9f')](_0x26c43c);ut['logCustomer'](_0x26c43c,0x4,_0xcb66('0xbd'));rpcDb['createCustomerHistory'](_0x26c43c,_0xcb66('0xbe'));rpcDb['createCustomerFinal'](_0x26c43c,_0xcb66('0xbf'));rpcDb[_0xcb66('0xc0')](_0x26c43c);_0x1c0533[_0xcb66('0xc1')]+=_0x26c43c['talktime'];_0x1c0533[_0xcb66('0x28')]+=_0x26c43c['talktime'];logger[_0xcb66('0x56')](_0xcb66('0xc2'),_0x26c43c[_0xcb66('0xb3')],_0xcb66('0xb4'),_0x1c0533[_0xcb66('0x23')],'pTalking:\x20',_0x1c0533[_0xcb66('0x5a')]);delete this[_0xcb66('0x6d')][_0x311a98[_0xcb66('0xb0')]];break;case _0xcb66('0xc3'):_0x1c0533['outboundBusyCallsDay']+=0x1;_0x26c43c[_0xcb66('0xc4')]+=0x1;_0x26c43c[_0xcb66('0x9e')]=ut['totalGlobal'](_0x26c43c);ut[_0xcb66('0x8d')](_0x26c43c,0x5,_0xcb66('0xc5'));ami[_0xcb66('0xa1')](_0xcb66('0xc6'),ut['buildObj'](_0x26c43c,_0xcb66('0xc7')));rpcDb[_0xcb66('0x91')](_0x26c43c,_0xcb66('0xc8'));if(ut[_0xcb66('0x9f')](_0x26c43c)>=_0x1c0533[_0xcb66('0xa5')]){_0x185363=ut['cloneAction'](_0x26c43c,0xf,_0xcb66('0xc9'));rpcDb[_0xcb66('0xa7')](_0x185363,_0xcb66('0xca'));}else{if(_0x26c43c[_0xcb66('0xc4')]>=_0x1c0533[_0xcb66('0xcb')]){rpcDb[_0xcb66('0xa7')](_0x26c43c,_0xcb66('0xc8'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x26c43c,'countbusyretry',_0x1c0533[_0xcb66('0xcc')]),_0x26c43c[_0xcb66('0xae')],_0x26c43c['activeContact']);}}break;case _0xcb66('0xcd'):_0x1c0533['outboundNoAnswerCallsDay']+=0x1;_0x26c43c[_0xcb66('0xce')]+=0x1;_0x26c43c[_0xcb66('0x9e')]=ut[_0xcb66('0x9f')](_0x26c43c);ut[_0xcb66('0x8d')](_0x26c43c,0x3,'NoAnswer');ami[_0xcb66('0xa1')](_0xcb66('0xcf'),ut[_0xcb66('0xb6')](_0x26c43c,_0xcb66('0xd0')));rpcDb[_0xcb66('0x91')](_0x26c43c,'[callProgressDetectingCustomer][logNoAnswer]');if(ut['totalGlobal'](_0x26c43c)>=_0x1c0533[_0xcb66('0xa5')]){_0x185363=ut['cloneAction'](_0x26c43c,0xf,_0xcb66('0xc9'));rpcDb[_0xcb66('0xa7')](_0x185363,_0xcb66('0xd1'));}else{if(_0x26c43c[_0xcb66('0xce')]>=_0x1c0533[_0xcb66('0xd2')]){rpcDb[_0xcb66('0xa7')](_0x26c43c,'[callProgressDetectingCustomer][logNoAnswer]');}else{rpcDb[_0xcb66('0xab')](ut['scheduledAt'](_0x26c43c,_0xcb66('0xce'),_0x1c0533[_0xcb66('0xd3')]),_0x26c43c[_0xcb66('0xae')],_0x26c43c[_0xcb66('0xaf')]);}}break;case _0xcb66('0xd4'):_0x1c0533[_0xcb66('0x38')]+=0x1;_0x26c43c['countcongestionretry']+=0x1;_0x26c43c[_0xcb66('0x9e')]=ut[_0xcb66('0x9f')](_0x26c43c);ut[_0xcb66('0x8d')](_0x26c43c,0x8,_0xcb66('0xd5'));ami[_0xcb66('0xa1')](_0xcb66('0xd6'),ut[_0xcb66('0xb6')](_0x26c43c,_0xcb66('0xd7')));rpcDb['createCustomerHistory'](_0x26c43c,'[callProgressDetectingCustomer][logCongestion]');if(ut[_0xcb66('0x9f')](_0x26c43c)>=_0x1c0533[_0xcb66('0xa5')]){_0x185363=ut['cloneAction'](_0x26c43c,0xf,_0xcb66('0xc9'));rpcDb[_0xcb66('0xa7')](_0x185363,'[callProgressDetectingCustomer][logCongestionGlobal]');}else{if(_0x26c43c[_0xcb66('0xd8')]>=_0x1c0533['dialCongestionMaxRetry']){rpcDb[_0xcb66('0xa7')](_0x26c43c,_0xcb66('0xd9'));}else{rpcDb[_0xcb66('0xab')](ut[_0xcb66('0xac')](_0x26c43c,_0xcb66('0xd8'),_0x1c0533['dialBusyRetryFrequency']),_0x26c43c['unlockAgent'],_0x26c43c[_0xcb66('0xaf')]);}}break;case _0xcb66('0xda'):_0x1c0533[_0xcb66('0xdb')]+=0x1;_0x26c43c[_0xcb66('0xdc')]+=0x1;_0x26c43c[_0xcb66('0x9e')]=ut['totalGlobal'](_0x26c43c);ut[_0xcb66('0x8d')](_0x26c43c,0x14,'AgentReject');ami['emit'](_0xcb66('0xdd'),ut['buildObj'](_0x26c43c,'agentreject'));rpcDb[_0xcb66('0x91')](_0x26c43c,_0xcb66('0xde'));if(ut['totalGlobal'](_0x26c43c)>=_0x1c0533[_0xcb66('0xa5')]){_0x185363=ut[_0xcb66('0xa6')](_0x26c43c,0x14,_0xcb66('0xdf'));rpcDb[_0xcb66('0xa7')](_0x185363,_0xcb66('0xe0'));}else{if(_0x26c43c[_0xcb66('0xdc')]>=_0x1c0533[_0xcb66('0xe1')]){rpcDb[_0xcb66('0xa7')](_0x26c43c,_0xcb66('0xe0'));}else{rpcDb[_0xcb66('0xab')](ut[_0xcb66('0xac')](_0x26c43c,'countagentrejectretry',_0x1c0533['dialAgentRejectRetryFrequency']),_0x26c43c[_0xcb66('0xae')],_0x26c43c[_0xcb66('0xaf')]);}}break;case _0xcb66('0xe2'):_0x1c0533[_0xcb66('0x3d')]+=0x1;_0x26c43c[_0xcb66('0xe3')]+=0x1;_0x26c43c[_0xcb66('0x9e')]=ut[_0xcb66('0x9f')](_0x26c43c);ut['logCustomer'](_0x26c43c,0xb,_0xcb66('0xe4'));rpcDb['createCustomerHistory'](_0x26c43c,'[callProgressDetectingCustomer][logAbandoned]');if(ut['totalGlobal'](_0x26c43c)>=_0x1c0533[_0xcb66('0xa5')]){_0x185363=ut[_0xcb66('0xa6')](_0x26c43c,0xf,_0xcb66('0xc9'));rpcDb['createCustomerFinal'](_0x185363,_0xcb66('0xe5'));}else{if(_0x26c43c['countabandonedetry']>=_0x1c0533['dialAbandonedMaxRety']){rpcDb[_0xcb66('0xa7')](_0x26c43c,_0xcb66('0xe5'));}else{rpcDb[_0xcb66('0xab')](ut[_0xcb66('0xac')](_0x26c43c,_0xcb66('0xe3'),_0x1c0533['dialAbandonedRetryFrequency']),_0x26c43c[_0xcb66('0xae')],_0x26c43c[_0xcb66('0xaf')]);}}break;case'18':_0x1c0533[_0xcb66('0x3c')]+=0x1;_0x26c43c[_0xcb66('0xe6')]+=0x1;_0x26c43c[_0xcb66('0x9e')]=ut[_0xcb66('0x9f')](_0x26c43c);ut[_0xcb66('0x8d')](_0x26c43c,0x12,_0x311a98['cause-txt']||_0x311a98[_0xcb66('0xe7')]);ami[_0xcb66('0xa1')](_0xcb66('0xe8'),ut['buildObj'](_0x26c43c,_0xcb66('0xe9')));rpcDb[_0xcb66('0x91')](_0x26c43c,'[callProgressDetectingCustomer][hangupInAMD]');if(ut[_0xcb66('0x9f')](_0x26c43c)>=_0x1c0533[_0xcb66('0xa5')]){_0x185363=ut[_0xcb66('0xa6')](_0x26c43c,0xf,'Global');rpcDb[_0xcb66('0xa7')](_0x185363,_0xcb66('0xea'));}else{rpcDb[_0xcb66('0xa7')](_0x26c43c,_0xcb66('0xea'));}delete this[_0xcb66('0x6d')][_0x311a98['linkedid']];break;case'19':_0x1c0533[_0xcb66('0x3c')]+=0x1;_0x26c43c[_0xcb66('0x9e')]=ut[_0xcb66('0x9f')](_0x26c43c);ut[_0xcb66('0x8d')](_0x26c43c,0x13,_0x311a98[_0xcb66('0xeb')]||_0x311a98[_0xcb66('0xe7')]);ami['emit']('custom:amd',ut[_0xcb66('0xb6')](_0x26c43c,_0xcb66('0xe9')));rpcDb[_0xcb66('0x91')](_0x26c43c,_0xcb66('0xec'));if(ut[_0xcb66('0x9f')](_0x26c43c)>=_0x1c0533[_0xcb66('0xa5')]){_0x185363=ut['cloneAction'](_0x26c43c,0xf,_0xcb66('0xc9'));rpcDb[_0xcb66('0xa7')](_0x185363,_0xcb66('0xec'));}else{rpcDb[_0xcb66('0xa7')](_0x26c43c,_0xcb66('0xec'));}delete this[_0xcb66('0x6d')][_0x311a98[_0xcb66('0xb0')]];break;default:if(_0x26c43c['dialAnswer']){ut[_0xcb66('0x7c')](_0x1c0533,_0xcb66('0xed'));ut[_0xcb66('0x7e')]('[Dialer][decrementTalkink][no\x20Hangup][Preview]'+_0x1c0533[_0xcb66('0x23')],_0x311a98);}_0x1c0533[_0xcb66('0x3c')]+=0x1;_0x26c43c['countglobal']=ut['totalGlobal'](_0x26c43c);ut[_0xcb66('0x8d')](_0x26c43c,0xc,_0x311a98[_0xcb66('0xeb')]||_0x311a98[_0xcb66('0xe7')]);rpcDb['createCustomerHistory'](_0x26c43c,'[callProgressDetectingCustomer][logUnknown]');if(ut[_0xcb66('0x9f')](_0x26c43c)>=_0x1c0533['dialGlobalMaxRetry']){_0x185363=ut['cloneAction'](_0x26c43c,0xf,_0xcb66('0xc9'));rpcDb['createCustomerFinal'](_0x185363,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0xcb66('0xa7')](_0x26c43c,_0xcb66('0xee'));}delete this[_0xcb66('0x6d')][_0x311a98[_0xcb66('0xb0')]];}if(!(_0x26c43c[_0xcb66('0x7b')]&&_0x4f0462==='16')){ut[_0xcb66('0x7a')](_0x1c0533,_0xcb66('0xef'));logger[_0xcb66('0x56')]('[originated][decrement][callProgressDetectingCustomer]',_0x26c43c[_0xcb66('0xb3')],_0xcb66('0xb4'),_0x1c0533[_0xcb66('0x23')],_0xcb66('0x71'),_0x1c0533[_0xcb66('0x49')]);}if(_0x4f0462!==_0xcb66('0xb1')){delete this[_0xcb66('0x6d')][_0x311a98[_0xcb66('0xb0')]];delete this[_0xcb66('0x6d')][_0x311a98[_0xcb66('0xf0')]];}}};Preview[_0xcb66('0xd')][_0xcb66('0xf1')]=function(_0x5ac4ee,_0x2d9cdd,_0x78a272){if(_[_0xcb66('0xf2')](_0x2d9cdd)&&_0xcb66('0xf3')!==typeof _0x2d9cdd){return;}if(_[_0xcb66('0xf2')](_0x78a272)&&_0xcb66('0xf3')!==typeof _0x78a272){return;}switch(_0x78a272['reason']){case'0':ut['logAgent'](_0x5ac4ee,0x0,'NoSuchNumber');rpcDb[_0xcb66('0xf4')](_0x5ac4ee,'[callProgressDetectingAgent][logNoSuch]');break;case'3':ut['logAgent'](_0x5ac4ee,0x3,_0xcb66('0xf5'));rpcDb[_0xcb66('0xf4')](_0x5ac4ee,_0xcb66('0xf6'));break;case'5':ut[_0xcb66('0xf7')](_0x5ac4ee,0x5,_0xcb66('0xc5'));rpcDb[_0xcb66('0xf4')](_0x5ac4ee,_0xcb66('0xf8'));break;case'8':ut[_0xcb66('0xf7')](_0x5ac4ee,0x8,'Congestion');rpcDb[_0xcb66('0xf4')](_0x5ac4ee,_0xcb66('0xf9'));break;case'22':ut[_0xcb66('0xf7')](_0x5ac4ee,0x16,_0xcb66('0xfa'));rpcDb[_0xcb66('0xf4')](_0x5ac4ee,_0xcb66('0xfb'));break;default:ut[_0xcb66('0xf7')](_0x5ac4ee,0xc,_0x78a272[_0xcb66('0xfc')]);rpcDb['createAgentHistory'](_0x5ac4ee,_0xcb66('0xf9'));}ut[_0xcb66('0x7a')](_0x2d9cdd,_0xcb66('0xfd'));logger[_0xcb66('0x56')](_0xcb66('0xfe'),_0x5ac4ee[_0xcb66('0xb3')],_0xcb66('0xb4'),_0x2d9cdd[_0xcb66('0x23')],_0xcb66('0x71'),_0x2d9cdd['originated']);delete this[_0xcb66('0x6d')][_0x5ac4ee[_0xcb66('0xb3')]];};Preview['prototype'][_0xcb66('0xff')]=function(_0x42b292,_0x1954f7,_0x40ab09,_0x225a8a,_0x6770b4){var _0x329344=this;return new BPromise(function(_0x578cf7,_0x17263c){if(_['isNil'](_0x1954f7)||_['isNil'](_0x1954f7['Contact'])||_[_0xcb66('0x100')](_0x1954f7[_0xcb66('0x101')][_0xcb66('0x102')])||_[_0xcb66('0x100')](_0x1954f7[_0xcb66('0x103')])){_0x17263c(ut[_0xcb66('0x5c')](_0xcb66('0x104'),_0x225a8a,_0x6770b4));return;}var _0x53e8f5=uuid['v4']();var _0x25b646=_0x329344[_0xcb66('0x11')][_0x1954f7[_0xcb66('0x6f')][_0xcb66('0x23')]];var _0x55120d=_0x40ab09?_0x329344[_0xcb66('0x14')][_0x40ab09]['id']:undefined;_0x329344['actions'][_0x53e8f5]=new Action(_0x1954f7,_0x25b646,_0x53e8f5,_0x40ab09,_0x55120d);var _0x5e4f31=_0x329344[_0xcb66('0x6d')][_0x53e8f5];_0x5e4f31[_0xcb66('0xae')]=_0x225a8a;_0x5e4f31['activeContact']=_0x6770b4;_0x5e4f31[_0xcb66('0x105')]=_0x40ab09;if(_[_0xcb66('0x106')](_0x42b292)){_0x329344[_0xcb66('0x107')](_0x5e4f31,_0x25b646,_0x1954f7,_0x40ab09)[_0xcb66('0x84')](function(_0x512f4e){logger[_0xcb66('0x56')](_0xcb66('0x108'),_0xcb66('0x109')+_0x5e4f31[_0xcb66('0x70')]+'\x20IdHopper:\x20'+_0x5e4f31[_0xcb66('0x10a')],JSON['stringify'](_0x512f4e));ami[_0xcb66('0xa1')](_0xcb66('0x10b'),ut['buildObj'](_0x5e4f31,'called',_0x329344['campaignsPreview'][_0x5e4f31[_0xcb66('0x70')]]));_0x578cf7(ut[_0xcb66('0x5c')]('Calling'));})[_0xcb66('0x78')](function(_0x2b8f94){ut['logger'](_0xcb66('0x10c'),_0x2b8f94);_0x17263c(ut[_0xcb66('0x5c')](_0xcb66('0x10d'),_0x225a8a,_0x6770b4));});}else{_0x25b646[_0xcb66('0x36')]+=0x1;ut[_0xcb66('0x10e')](_0x5e4f31);rpcDb[_0xcb66('0x10f')](_0x5e4f31,_0xcb66('0x110'));delete _0x329344[_0xcb66('0x6d')][_0x53e8f5];_0x17263c(ut['message'](_0xcb66('0x111'),_0x225a8a,_0x6770b4));}});};Preview[_0xcb66('0xd')][_0xcb66('0x99')]=function(_0x22ed1d){return!_[_0xcb66('0x100')](_0x22ed1d)&&!_[_0xcb66('0x100')](_0x22ed1d[_0xcb66('0x23')])&&!_['isNil'](_0x22ed1d[_0xcb66('0x51')])&&_0x22ed1d[_0xcb66('0x51')]&&!_[_0xcb66('0x100')](this[_0xcb66('0x13')][util['format']('SIP/%s',_0x22ed1d[_0xcb66('0x23')])])&&!_[_0xcb66('0x100')](this[_0xcb66('0x13')][util[_0xcb66('0x58')](_0xcb66('0x112'),_0x22ed1d[_0xcb66('0x23')])][_0xcb66('0x76')])&&(this[_0xcb66('0x13')][util[_0xcb66('0x58')](_0xcb66('0x112'),_0x22ed1d[_0xcb66('0x23')])][_0xcb66('0x76')]==='reachable'||this['trunks'][util['format'](_0xcb66('0x112'),_0x22ed1d[_0xcb66('0x23')])][_0xcb66('0x76')]==='unmonitored');};Preview[_0xcb66('0xd')][_0xcb66('0x113')]=function(_0x253ef9,_0x96f837){var _0x5686b5=this;return new BPromise(function(_0x5e82a8,_0x1d15ef){_0x5686b5['execRun'](_0x253ef9,_0x96f837)[_0xcb66('0x84')](function(_0x35f822){_0x5e82a8(_[_0xcb66('0x114')](_0x35f822,[_0xcb66('0x5c')]));})[_0xcb66('0x78')](function(_0x2a3e95){if(_0x2a3e95[_0xcb66('0x115')]){rpcDb['unlockContact'](_0x253ef9);}if(_0x2a3e95[_0xcb66('0x51')]){rpcDb[_0xcb66('0x116')](_0x253ef9);}_0x1d15ef(_[_0xcb66('0x114')](_0x2a3e95,[_0xcb66('0x5c')]));});});};Preview['prototype'][_0xcb66('0x117')]=function(_0x5084d7,_0x623fa){var _0x1a9cd1=this;return new BPromise(function(_0x141290,_0x4a0094){var _0x28a8ee,_0x290002;rpcDb[_0xcb66('0x118')](_0x5084d7)[_0xcb66('0x84')](function(_0x39a248){if(!_['isNil'](_0x39a248[0x0])){_0x290002=_0x39a248[0x0][_0xcb66('0x119')]?![]:!![];_0x28a8ee=_0x39a248[0x0][_0xcb66('0x119')]?!![]:![];_0x28a8ee=_0x623fa?!![]:_0x28a8ee;}var _0xa76581=_0x1a9cd1[_0xcb66('0x11a')](_0x39a248);if(_0xa76581[_0xcb66('0x11b')]){rpcDb[_0xcb66('0x11c')](_['pick'](_0x39a248[0x0],[_0xcb66('0x103'),_0xcb66('0x11d')]))['then'](function(_0x1c12d6){_0x1a9cd1[_0xcb66('0xff')](_0x1c12d6,_0x39a248[0x0],_0x623fa,_0x290002,_0x28a8ee)[_0xcb66('0x84')](function(_0x4a1995){_0x141290(_0x4a1995);})['catch'](function(_0x7a6acf){_0x4a0094(_0x7a6acf);});})[_0xcb66('0x78')](function(_0x4a7491){ut[_0xcb66('0x61')](_0xcb66('0x11e'),_0x4a7491);_0x4a0094(ut['message'](_0xcb66('0x11f'),_0x290002,_0x28a8ee));});}else{_0x4a0094(ut[_0xcb66('0x5c')](_0xa76581['message'],_0x290002,_0x28a8ee));}})[_0xcb66('0x78')](function(_0x2babe3){ut['logger'](_0xcb66('0x120'),_0x2babe3);_0x4a0094(ut['message'](_0xcb66('0x11f'),![],!![]));});});};Preview[_0xcb66('0xd')][_0xcb66('0x11a')]=function(_0x46eb02){if(_['isNil'](_0x46eb02)||_[_0xcb66('0x106')](_0x46eb02)||!_['isNil'](_0x46eb02[0x0][_0xcb66('0x87')])&&_[_0xcb66('0x100')](_0x46eb02[0x0]['Agent'][_0xcb66('0x23')])){ut[_0xcb66('0x61')](_0xcb66('0x121'),_0x46eb02);return{'isValid':![],'message':'Empty\x20Contact'};}var _0x29efd9=this[_0xcb66('0x11')][_0x46eb02[0x0]['Queue'][_0xcb66('0x23')]];_0x29efd9[_0xcb66('0x5c')]=_0xcb66('0x9c');if(_['isNil'](_0x29efd9)){ut[_0xcb66('0x61')](_0xcb66('0x122'),_0x29efd9);return{'isValid':![],'message':'Empty\x20Campaign'};}if(!this[_0xcb66('0x99')](_0x29efd9[_0xcb66('0x50')])){ut[_0xcb66('0x61')](_0xcb66('0x123'),_0xcb66('0x124')+_0x29efd9[_0xcb66('0x23')]+_0xcb66('0x125'));if(!this[_0xcb66('0x99')](_0x29efd9[_0xcb66('0x9a')])){ut[_0xcb66('0x61')](_0xcb66('0x123'),_0x29efd9[_0xcb66('0x23')]+_0xcb66('0x126'));return{'isValid':![],'message':'Trunk\x20not\x20work'};}}if(!ut[_0xcb66('0x98')](_0x29efd9[_0xcb66('0x2f')])){ut[_0xcb66('0x61')]('[Preview][validateContact][Campaign\x20Active]',_0x29efd9[_0xcb66('0x23')]+'\x20Not\x20Active');return{'isValid':![],'message':_0xcb66('0x124')+_0x29efd9[_0xcb66('0x23')]+_0xcb66('0x127')};}return{'isValid':!![],'message':_0xcb66('0x128')};};Preview[_0xcb66('0xd')][_0xcb66('0x107')]=function(_0x1357f7,_0x6d601,_0x1dea5a,_0x2c4960){var _0x5d738b=this;return new BPromise(function(_0x472797,_0x4f447d){var _0x51807d=_0x1357f7[_0xcb66('0xb3')];var _0x46bccf=_0x5d738b[_0xcb66('0x99')](_0x6d601[_0xcb66('0x50')])?util[_0xcb66('0x58')](_0xcb66('0x129'),_0x6d601[_0xcb66('0x50')]['name'],_[_0xcb66('0x100')](_0x6d601[_0xcb66('0x33')])?'':_0x6d601[_0xcb66('0x33')][_0xcb66('0x12a')]()||'',_0x6d601[_0xcb66('0x12b')]>0x0?_0x1dea5a[_0xcb66('0x101')][_0xcb66('0x102')][_0xcb66('0x12c')](_0x6d601['dialCutDigit']):_0x1dea5a[_0xcb66('0x101')][_0xcb66('0x102')]):util[_0xcb66('0x58')](_0xcb66('0x129'),_['isNil'](_0x6d601[_0xcb66('0x9a')])?_0x6d601['Trunk'][_0xcb66('0x23')]:_0x6d601[_0xcb66('0x9a')]['name'],_[_0xcb66('0x100')](_0x6d601[_0xcb66('0x33')])?'':_0x6d601[_0xcb66('0x33')][_0xcb66('0x12a')]()||'',_0x6d601[_0xcb66('0x12b')]>0x0?_0x1dea5a[_0xcb66('0x101')][_0xcb66('0x102')][_0xcb66('0x12c')](_0x6d601[_0xcb66('0x12b')]):_0x1dea5a[_0xcb66('0x101')][_0xcb66('0x102')]);var _0x5cc688=_0x5d738b[_0xcb66('0x99')](_0x6d601[_0xcb66('0x50')])?ut['getCallerId'](_0x6d601[_0xcb66('0x50')][_0xcb66('0x52')],_0x6d601[_0xcb66('0x30')],_0x6d601[_0xcb66('0x12d')]>0x0?ut[_0xcb66('0x12e')](_0x6d601[_0xcb66('0x31')],_0x6d601['dialRandomLastDigitCallerIdNumber']):_0x6d601['dialOriginateCallerIdNumber']):ut[_0xcb66('0x12f')](_[_0xcb66('0x100')](_0x6d601[_0xcb66('0x9a')])?_0x6d601[_0xcb66('0x50')][_0xcb66('0x52')]:_0x6d601[_0xcb66('0x9a')][_0xcb66('0x52')],_0x6d601[_0xcb66('0x30')],_0x6d601[_0xcb66('0x12d')]>0x0?ut[_0xcb66('0x12e')](_0x6d601[_0xcb66('0x31')],_0x6d601[_0xcb66('0x12d')]):_0x6d601[_0xcb66('0x31')]);if(_0x5cc688){_0x1357f7['originatecalleridname']=ut[_0xcb66('0x130')](_0x5cc688);_0x1357f7[_0xcb66('0x131')]=ut[_0xcb66('0x132')](_0x5cc688);}var _0x20efe7=ut[_0xcb66('0x133')](_0x6d601,_0x1dea5a,_0x46bccf,_0x5cc688,_0x51807d,_0x1357f7);_[_0xcb66('0x134')](_0x1357f7,ut[_0xcb66('0x135')](_0x20efe7));_0x1357f7[_0xcb66('0x8b')]=moment()[_0xcb66('0x58')]('YYYY-MM-DD\x20HH:mm:ss');ami[_0xcb66('0x136')](ut[_0xcb66('0x137')](_0x1357f7,_0x6d601,_0x20efe7,_0x1357f7[_0xcb66('0xaf')],_0x2c4960))[_0xcb66('0x84')](function(_0xec4512){_0x6d601['originated']+=0x1;logger[_0xcb66('0x56')](_0xcb66('0x138'),_0x51807d,_0xcb66('0xb4'),_0x6d601['name'],_0xcb66('0x71'),_0x6d601[_0xcb66('0x49')]);_0x472797(_0xec4512);})['catch'](function(_0x3951bd){ut['logAgent'](_0x1357f7,0xe,_0xcb66('0x139'));rpcDb[_0xcb66('0xf4')](_0x1357f7,'[originateFailure][logOriginateFailure]');_0x4f447d(_0x3951bd);});});};Preview[_0xcb66('0xd')]['syncNewExten']=function(_0x223c9b){if(this[_0xcb66('0x6d')][_0x223c9b[_0xcb66('0xb0')]]){this[_0xcb66('0x6d')][_0x223c9b[_0xcb66('0xb0')]][_0xcb66('0x77')]=_0x223c9b[_0xcb66('0x77')];}};Preview['prototype']['syncOriginateResponse']=function(_0x449bb6){var _0x51d3d0=this;var _0x57a338=this[_0xcb66('0x6d')][_0x449bb6[_0xcb66('0x13a')]];if(_0x57a338){if(_0x57a338[_0xcb66('0x105')]&&this[_0xcb66('0x14')][_0x57a338['lookAgent']]){ut[_0xcb66('0x13b')](_0x57a338,this[_0xcb66('0x14')][_0x57a338[_0xcb66('0x105')]][_0xcb66('0x23')],this['agents'][_0x57a338[_0xcb66('0x105')]]['id']);}var _0x2eb5ad=_[_0xcb66('0x13c')](_0x57a338);_0x2eb5ad['responsetime']=moment()[_0xcb66('0x58')](_0xcb66('0x8c'));var _0x13f127=_0x51d3d0[_0xcb66('0x11')][_0x57a338[_0xcb66('0x70')]];if(ut[_0xcb66('0x13d')](_0x449bb6['response'])){if(_0x57a338[_0xcb66('0xae')]){rpcDb[_0xcb66('0x13e')](_0x57a338[_0xcb66('0x10a')]);}if(_0x57a338[_0xcb66('0xaf')]){rpcDb[_0xcb66('0x116')](_0x57a338[_0xcb66('0x10a')]);}ami[_0xcb66('0xa1')](_0xcb66('0x13f'),ut['buildObj'](_0x57a338,'rejected',this[_0xcb66('0x11')][_0x57a338[_0xcb66('0x70')]]));this['callProgressDetectingAgent'](_0x2eb5ad,_0x13f127,_0x449bb6);}else{_0x57a338[_0xcb66('0x8b')]=moment()[_0xcb66('0x58')](_0xcb66('0x8c'));ut['logAgent'](_0x2eb5ad,0x4,'Answer');rpcDb[_0xcb66('0xf4')](_0x2eb5ad,_0xcb66('0x140'));}}};Preview[_0xcb66('0xd')][_0xcb66('0x18')]=function(_0x5917a5){var _0x48d3c4=this;var _0x56c6a8=this[_0xcb66('0x6d')][_0x5917a5[_0xcb66('0xb0')]];var _0x179b50;if(_0x56c6a8){_0x179b50=this[_0xcb66('0x11')][_0x56c6a8[_0xcb66('0x70')]];logger[_0xcb66('0x56')](_0xcb66('0x141'),_0x5917a5[_0xcb66('0xb0')],'\x20Queue',_0x179b50[_0xcb66('0x23')],_0xcb66('0x72'),_0x179b50['pTalking']);}if(this[_0xcb66('0x6d')][_0x5917a5['linkedid']]&&_0x5917a5[_0xcb66('0xb0')]!==_0x5917a5[_0xcb66('0xb3')]){if(_0x5917a5[_0xcb66('0x142')]==='16'&&this[_0xcb66('0x6d')][_0x5917a5[_0xcb66('0xb0')]]['dialAnswer']){this[_0xcb66('0x9d')](_0x5917a5,_0x5917a5[_0xcb66('0xb0')],_0x5917a5[_0xcb66('0x142')]);}else if(this[_0xcb66('0x6d')][_0x5917a5['linkedid']][_0xcb66('0x7b')]){logger[_0xcb66('0x56')](_0xcb66('0x143'),_0x5917a5[_0xcb66('0xb0')],_0x5917a5['cause'],_0xcb66('0xb4'),_0x179b50[_0xcb66('0x23')],_0xcb66('0x72'),_0x179b50[_0xcb66('0x5a')]);this[_0xcb66('0x9d')](_0x5917a5,_0x5917a5[_0xcb66('0xb0')],_0x5917a5['cause']);}}else if(_0x56c6a8&&_[_0xcb66('0x100')](_0x56c6a8['statedesc'])&&_0x179b50[_0xcb66('0x144')]&&_0x5917a5[_0xcb66('0xb0')]===_0x5917a5[_0xcb66('0xb3')]&&_[_0xcb66('0x100')](_0x5917a5[_0xcb66('0xfc')])&&_0x5917a5[_0xcb66('0x142')]==='16'&&_0x5917a5[_0xcb66('0x145')]==='6'&&_[_0xcb66('0xf2')](_0x56c6a8[_0xcb66('0x146')])){if(_0x56c6a8[_0xcb66('0xae')]){rpcDb[_0xcb66('0x13e')](_0x56c6a8[_0xcb66('0x10a')]);}if(_0x56c6a8[_0xcb66('0xaf')]){rpcDb[_0xcb66('0x116')](_0x56c6a8[_0xcb66('0x10a')]);}_0x5917a5['reason']='22';this['callProgressDetectingAgent'](_0x56c6a8,_0x179b50,_0x5917a5);}else if(_0x56c6a8&&_0x56c6a8['transfer']){if(_0x5917a5[_0xcb66('0x142')]==='16'&&this['actions'][_0x5917a5[_0xcb66('0xb0')]][_0xcb66('0x7b')]){logger[_0xcb66('0x56')](_0xcb66('0x147'),_0x5917a5[_0xcb66('0xb0')],_0x5917a5[_0xcb66('0x142')],'\x20Queue',_0x179b50[_0xcb66('0x23')],_0xcb66('0x72'),_0x179b50['pTalking']);this[_0xcb66('0x9d')](_0x5917a5,_0x5917a5['linkedid'],_0x5917a5['cause']);}else if(this['actions'][_0x5917a5[_0xcb66('0xb0')]][_0xcb66('0x7b')]){logger[_0xcb66('0x56')](_0xcb66('0x143'),_0x5917a5[_0xcb66('0xb0')],_0x5917a5['cause'],_0xcb66('0xb4'),_0x179b50[_0xcb66('0x23')],_0xcb66('0x72'),_0x179b50['pTalking']);this[_0xcb66('0x9d')](_0x5917a5,_0x5917a5[_0xcb66('0xb0')],_0x5917a5[_0xcb66('0x142')]);}}};Preview['prototype'][_0xcb66('0x1b')]=function(_0x132c72){if(this[_0xcb66('0x6d')][_0x132c72[_0xcb66('0xf0')]]&&_0x132c72[_0xcb66('0xf0')]!==_0x132c72[_0xcb66('0x148')]){this[_0xcb66('0x9d')](_0x132c72,_0x132c72[_0xcb66('0xf0')],_0x132c72['dialstatus']);}};Preview[_0xcb66('0xd')][_0xcb66('0x149')]=function(_0x471dde){if(this[_0xcb66('0x6d')][_0x471dde[_0xcb66('0xb0')]]&&_0x471dde[_0xcb66('0xb0')]!==_0x471dde['uniqueid']&&!this[_0xcb66('0x6d')][_0x471dde['linkedid']]['dialAnswer']){if(_0x471dde[_0xcb66('0x142')]==='1'){this[_0xcb66('0x9d')](_0x471dde,_0x471dde[_0xcb66('0xb0')],_0x471dde[_0xcb66('0x142')]);}}};Preview[_0xcb66('0xd')][_0xcb66('0x14a')]=function(_0x107e83,_0x2d9129,_0x50bcb0){if(this[_0xcb66('0x6d')][_0x107e83]){if(_[_0xcb66('0x100')](this[_0xcb66('0x6d')][_0x107e83][_0xcb66('0x14b')])){this[_0xcb66('0x6d')][_0x107e83][_0xcb66('0x14b')]={};}this[_0xcb66('0x6d')][_0x107e83]['variables'][_0x2d9129]=_0x50bcb0;}};Preview[_0xcb66('0xd')][_0xcb66('0x1e')]=function(_0x53585f){try{if(!_[_0xcb66('0x100')](_0x53585f)){if(ut[_0xcb66('0x14c')](_[_0xcb66('0x14d')](_0x53585f[_0xcb66('0x14e')])[0x0])){this['addVariable'](_0x53585f[_0xcb66('0xb3')],_['keys'](_0x53585f[_0xcb66('0x14e')])[0x0],_0x53585f['value']);}}}catch(_0x54e810){logger[_0xcb66('0x14f')](_0xcb66('0x150'),util['inspect'](_0x54e810,{'showHidden':![],'depth':null}));}};Preview[_0xcb66('0xd')]['syncAttendedTransfer']=function(_0x40d0da){if(_0x40d0da){if(this[_0xcb66('0x6d')][_0x40d0da['transfertargetlinkedid']]){this[_0xcb66('0x6d')][_0x40d0da[_0xcb66('0x151')]]['transfer']=!![];}}};Preview[_0xcb66('0xd')][_0xcb66('0x21')]=function(_0xd77e47){if(_0xd77e47){if(this[_0xcb66('0x6d')][_0xd77e47['transfererlinkedid']]){this[_0xcb66('0x6d')][_0xd77e47['transfererlinkedid']][_0xcb66('0x146')]=!![];}}};module[_0xcb66('0x152')]=Preview; \ No newline at end of file +var _0x885a=['Trunk\x20not\x20work','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','trim','dialCutDigit','substring','callerid','getCallerIdRandom','dialRandomLastDigitCallerIdNumber','getCallerId','extractCalleridName','originatecalleridnum','extractCalleridNumber','merge','toLowerVariables','variablesAction','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','lookAgent','logLookAgent','response','idContact','custom:agentringnoanswer','callProgressDetectingAgent','[syncHangup][talking]','[syncHangup][talking][cause]','cause','statedesc','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','destlinkedid','destuniqueid','addVariable','variables','filterKey','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','lodash','bluebird','uuid','moment','ioredis','../../../config/environment','../../../config/logger','preview','actionPreview','./rpcDb','./action','./util/util','defaults','redis','localhost','prototype','enqueue','tail','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','syncHangup','syncHangupRequest','syncDialEnd','syncNewExten','varset','syncVarSet','syncAttendedTransfer','blindtransfer','syncBlindTransfer','emit','type','strategy','answered','loggedIn','pTalking','sumBillable','sumHoldTime','talking','abandoned','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundAbandonedCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvailable','message','originated','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','startPredictive','Trunk','name','active','Interval','stringify','md5','format','voice_queue:save','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice:queue:%s','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','available','paused','NOT_ACTIVE','logger','\x20is\x20not\x20active','IS_DISACTIVED','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20disactive','syncCampaigns','hasOwnProperty','booked','outbound','clearZombieChannels','setMessage','recallMe','clearZombieChannel','isNil','info','Queue','queue','pTalking:\x20','contactId','UserId','VoiceQueueId','ListId','Action','status','channel','catch','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','dialAnswer','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','size','getContactRecallMe','agentReadyId','then','length','getDiff','dialRecallMeTimeout','Agent','voicePause','run','logger2','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','RecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryRecallClose]','[getContactRecallMe]','IsNotLoggedIn','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','countglobal','totalGlobal','custom:agentnosuchnumber','buildObj','nosuchnumber','dialGlobalMaxRetry','cloneAction','[callProgressDetectingCustomer][logNoSuchGlobal]','countnosuchnumberretry','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt','unlockAgent','activeContact','linkedid','ANSWER','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','connect','custom:agentConnectPreview','buildAcw','complete','outboundAnswerCallsDay','total','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','createCustomerFinal','sumDuration','talktime','outboundBusyCallsDay','countbusyretry','Busy','busy','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyRetryFrequency','NOANSWER','NoAnswer','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','countnoanswerretry','CONGESTION','countcongestionretry','custom:agentcongestion','[callProgressDetectingCustomer][logCongestion]','Global','dialCongestionMaxRetry','CANCEL','countagentrejectretry','AgentReject','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','ABANDONED','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','outboundUnknownCallsDay','countmachineretry','cause-txt','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','originated:\x20','isUndefined','object','reason','logAgent','NoSuchNumber','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','Congestion','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[originated][decrement][callProgressDetectingAgent]','checkInBlack','Contact','phone','Contact\x20is\x20undefined','isEmpty','execCall','Queue:\x20','\x20IdHopper:\x20','called','Calling','[Preview][execCall][failure]','Call\x20failed','outboundBlacklistCallsDay','Contact\x20in\x20black\x20List','SIP/%s','unmonitored','execRun','pick','unlock','unlockContact','getContactPreview','recallme','validateContact','isValid','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x885a,0x180));var _0xa885=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x885a[_0x21a9d9];return _0x46adce;};'use strict';var util=require('util');var _=require(_0xa885('0x0'));var BPromise=require(_0xa885('0x1'));var uuid=require(_0xa885('0x2'));var moment=require(_0xa885('0x3'));var md5=require('md5');var Redis=require(_0xa885('0x4'));var config=require(_0xa885('0x5'));var logger=require(_0xa885('0x6'))(_0xa885('0x7'));var loggerAction=require(_0xa885('0x6'))(_0xa885('0x8'));var ami=require('../ami');var rpcDb=require(_0xa885('0x9'));var Action=require(_0xa885('0xa'));var ut=require(_0xa885('0xb'));config['redis']=_[_0xa885('0xc')](config[_0xa885('0xd')],{'host':_0xa885('0xe'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xa885('0xd')]));var Sequence=function(){};Sequence[_0xa885('0xf')][_0xa885('0x10')]=function(_0x745710){this[_0xa885('0x11')]=this[_0xa885('0x11')]?this[_0xa885('0x11')]['finally'](_0x745710):_0x745710();};function Preview(_0x8a82f5){this[_0xa885('0x12')]=new Sequence();this[_0xa885('0x13')]=_0x8a82f5[_0xa885('0x14')];this[_0xa885('0x15')]=_0x8a82f5[_0xa885('0x15')];this[_0xa885('0x16')]={};this['agents']=_0x8a82f5[_0xa885('0x17')];this[_0xa885('0x18')]=0x0;ami['on'](_0xa885('0x19'),this[_0xa885('0x1a')][_0xa885('0x1b')](this));ami['on']('hangup',this[_0xa885('0x1c')][_0xa885('0x1b')](this));ami['on']('hanguprequest',this[_0xa885('0x1d')][_0xa885('0x1b')](this));ami['on']('dialend',this[_0xa885('0x1e')][_0xa885('0x1b')](this));ami['on']('newexten',this[_0xa885('0x1f')]['bind'](this));ami['on'](_0xa885('0x20'),this[_0xa885('0x21')][_0xa885('0x1b')](this));ami['on']('attendedtransfer',this[_0xa885('0x22')]['bind'](this));ami['on'](_0xa885('0x23'),this[_0xa885('0x24')][_0xa885('0x1b')](this));this['loopCampaigns'](this[_0xa885('0x13')]);}function emit(_0x32b8df,_0x1530b6,_0x4de770){io['to'](_0x32b8df)[_0xa885('0x25')](_0x1530b6,_0x4de770);}function emitCampaignPreview(_0x465611){if(_0x465611[_0xa885('0x26')]==='outbound'){var _0x303830={'id':_0x465611['id'],'name':_0x465611['name'],'strategy':_0x465611[_0xa885('0x27')],'answered':_0x465611[_0xa885('0x28')],'available':_0x465611['available'],'loggedIn':_0x465611[_0xa885('0x29')],'pTalking':_0x465611[_0xa885('0x2a')],'sumBillable':_0x465611[_0xa885('0x2b')],'sumDuration':_0x465611['sumDuration'],'sumHoldTime':_0x465611[_0xa885('0x2c')]||0x0,'talking':_0x465611[_0xa885('0x2d')],'total':_0x465611['total'],'type':_0x465611[_0xa885('0x26')],'unmanaged':_0x465611['unmanaged'],'abandoned':_0x465611[_0xa885('0x2e')],'waiting':_0x465611['waiting'],'loggedInDb':_0x465611[_0xa885('0x2f')],'dialActive':_0x465611[_0xa885('0x30')],'dialMethod':_0x465611[_0xa885('0x31')],'dialOriginateCallerIdName':_0x465611[_0xa885('0x32')],'dialOriginateCallerIdNumber':_0x465611[_0xa885('0x33')],'dialOriginateTimeout':_0x465611[_0xa885('0x34')],'dialPrefix':_0x465611[_0xa885('0x35')],'outboundAnswerAgiCallsDay':_0x465611[_0xa885('0x36')],'outboundAnswerCallsDay':_0x465611['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x465611['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x465611['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x465611['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x465611[_0xa885('0x37')],'outboundDropCallsDayCallersExit':_0x465611[_0xa885('0x38')],'outboundDropCallsDayTimeout':_0x465611[_0xa885('0x39')],'outboundNoAnswerCallsDay':_0x465611[_0xa885('0x3a')],'outboundNoSuchCallsDay':_0x465611[_0xa885('0x3b')],'outboundOriginateFailureCallsDay':_0x465611[_0xa885('0x3c')],'outboundReCallsDay':_0x465611['outboundReCallsDay'],'outboundRejectCallsDay':_0x465611[_0xa885('0x3d')],'outboundUnknownCallsDay':_0x465611['outboundUnknownCallsDay'],'outboundAbandonedCallsDay':_0x465611[_0xa885('0x3e')],'predictiveIntervalAnsweredCalls':_0x465611['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x465611[_0xa885('0x3f')],'predictiveIntervalAvgTalktime':_0x465611['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x465611[_0xa885('0x40')],'predictiveIntervalDroppedCallsTimeout':_0x465611[_0xa885('0x41')],'predictiveIntervalErlangCalls':_0x465611[_0xa885('0x42')],'predictiveIntervalErlangCallsDroppedCalls':_0x465611['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x465611[_0xa885('0x43')],'predictiveIntervalMultiplicativeFactor':_0x465611[_0xa885('0x44')],'predictiveIntervalPauses':_0x465611['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x465611[_0xa885('0x45')],'predictiveIntervalTotalCalls':_0x465611['predictiveIntervalTotalCalls'],'message':_0x465611[_0xa885('0x46')],'originated':_0x465611[_0xa885('0x47')],'erlangCalls':_0x465611[_0xa885('0x48')],'erlangCallToSecond':_0x465611['erlangCallToSecond'],'erlangAbandonmentRate':_0x465611[_0xa885('0x49')],'erlangBusyFactor':_0x465611[_0xa885('0x4a')],'startPredictive':_0x465611[_0xa885('0x4b')],'startProgressive':_0x465611['startProgressive']};if(_0x465611[_0xa885('0x4c')]){_0x303830[_0xa885('0x4c')]={'id':_0x465611[_0xa885('0x4c')]['id'],'name':_0x465611[_0xa885('0x4c')][_0xa885('0x4d')],'active':_0x465611[_0xa885('0x4c')][_0xa885('0x4e')],'callerid':_0x465611[_0xa885('0x4c')]['callerid']};}if(_0x465611['Interval']){_0x303830[_0xa885('0x4f')]={'id':_0x465611[_0xa885('0x4f')]['id'],'name':_0x465611[_0xa885('0x4f')][_0xa885('0x4d')]};}var _0x405bac=md5(JSON[_0xa885('0x50')](_0x303830));if(_0x465611[_0xa885('0x51')]!==_0x405bac){_0x465611[_0xa885('0x51')]=_0x405bac;emit(util[_0xa885('0x52')]('voice:queue:%s',_0x303830['name']),_0xa885('0x53'),_0x303830);}}}function emitVoiceQueueChannelRemove(_0x576c78){logger['info'](_0xa885('0x54'),JSON['stringify'](_0x576c78));emit(util[_0xa885('0x52')](_0xa885('0x55'),_0x576c78[_0xa885('0x4d')]),_0xa885('0x56'),_0x576c78);io[_0xa885('0x25')](_0xa885('0x57'),_0x576c78);}function notSendMessagesQueue(_0x113298){if(_0x113298[_0xa885('0x58')]){if(_0x113298[_0xa885('0x47')]===0x0&&_0x113298[_0xa885('0x2a')]===0x0){_0x113298['sendMessageOneNotActive']=![];_0x113298[_0xa885('0x59')]=0x0;_0x113298[_0xa885('0x5a')]=0x0;_0x113298[_0xa885('0x46')]=_0xa885('0x5b');ut[_0xa885('0x5c')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x113298['name']+_0xa885('0x5d'));}else{_0x113298[_0xa885('0x46')]=_0xa885('0x5e');ut[_0xa885('0x5c')](_0xa885('0x5f'),_0x113298['name']+_0xa885('0x60'));}emitCampaignPreview(_0x113298);}}Preview[_0xa885('0xf')]['loopCampaigns']=function(){var _0x491478=this;setInterval(function(){_0x491478[_0xa885('0x61')]();},0x7cf);};Preview[_0xa885('0xf')]['syncCampaigns']=function(){var _0x561bf0=this[_0xa885('0x13')];this[_0xa885('0x18')]+=0x1;for(var _0x2a3a3f in _0x561bf0){if(_0x561bf0[_0xa885('0x62')](_0x2a3a3f)&&(_0x561bf0[_0x2a3a3f][_0xa885('0x31')]===_0xa885('0x7')||_0x561bf0[_0x2a3a3f][_0xa885('0x31')]===_0xa885('0x63'))&&_0x561bf0[_0x2a3a3f][_0xa885('0x26')]===_0xa885('0x64')){if(this[_0xa885('0x18')]>0x7){this['clockClearZombieChannels']=0x0;this[_0xa885('0x65')]();}}if(_0x561bf0[_0xa885('0x62')](_0x2a3a3f)&&_0x561bf0[_0x2a3a3f][_0xa885('0x31')]==='preview'&&_0x561bf0[_0x2a3a3f][_0xa885('0x26')]===_0xa885('0x64')){if(_0x561bf0[_0x2a3a3f][_0xa885('0x30')]){this[_0xa885('0x66')](_0x561bf0[_0x2a3a3f]);if(_0x561bf0[_0x2a3a3f]['dialPreviewAutoRecallMe'])this[_0xa885('0x67')](_0x561bf0[_0x2a3a3f]);}else{notSendMessagesQueue(_0x561bf0[_0x2a3a3f]);}}}};Preview['prototype'][_0xa885('0x68')]=function(_0x245fe9){var _0x4aa113=this;this[_0xa885('0x12')][_0xa885('0x10')](function(){if(!_[_0xa885('0x69')](_0x4aa113[_0xa885('0x16')][_0x245fe9])){loggerAction[_0xa885('0x6a')]('[clearZombieChannels][talking]',_0x245fe9,_0xa885('0x6b'),_0x4aa113[_0xa885('0x16')][_0x245fe9][_0xa885('0x6c')],'originated:\x20',JSON['stringify'](_0x4aa113['campaignsPreview'][_0x4aa113[_0xa885('0x16')][_0x245fe9][_0xa885('0x6c')]][_0xa885('0x47')]),_0xa885('0x6d'),JSON[_0xa885('0x50')](_0x4aa113[_0xa885('0x13')][_0x4aa113[_0xa885('0x16')][_0x245fe9][_0xa885('0x6c')]][_0xa885('0x2a')]),JSON[_0xa885('0x50')](_0x4aa113[_0xa885('0x16')][_0x245fe9]['dialAnswer']),JSON['stringify'](_['pick'](_0x4aa113[_0xa885('0x16')][_0x245fe9],[_0xa885('0x6e'),_0xa885('0x6f'),_0xa885('0x70'),_0xa885('0x71')])));return ami[_0xa885('0x72')]({'action':_0xa885('0x73'),'channel':_0x4aa113['actions'][_0x245fe9][_0xa885('0x74')]})[_0xa885('0x75')](function(_0x45806c){if(_0x45806c[_0xa885('0x46')]===_0xa885('0x76')){setTimeout(function(){if(_0x4aa113[_0xa885('0x16')][_0x245fe9]){ut[_0xa885('0x77')](_0x4aa113['campaignsPreview'][_0x4aa113[_0xa885('0x16')][_0x245fe9][_0xa885('0x6c')]],_0xa885('0x78'));if(_0x4aa113['actions'][_0x245fe9][_0xa885('0x79')]===!![]){ut[_0xa885('0x7a')](_0x4aa113[_0xa885('0x13')][_0x4aa113[_0xa885('0x16')][_0x245fe9][_0xa885('0x6c')]],_0xa885('0x78'));ut[_0xa885('0x7b')](_0xa885('0x7c')+_0x245fe9,_0x4aa113['actions'][_0x245fe9][_0xa885('0x6c')]);}ut[_0xa885('0x7b')](_0xa885('0x7d')+_0x245fe9,_0x4aa113['actions'][_0x245fe9][_0xa885('0x6c')]);delete _0x4aa113[_0xa885('0x16')][_0x245fe9];}},0x2328);}});}});};Preview[_0xa885('0xf')][_0xa885('0x65')]=function(){var _0x2eb4d6=this;loggerAction[_0xa885('0x6a')]('[action]',_[_0xa885('0x7e')](this[_0xa885('0x16')]));for(var _0x27d0b3 in this['actions']){if(_0x2eb4d6[_0xa885('0x16')][_0xa885('0x62')](_0x27d0b3)){_0x2eb4d6[_0xa885('0x68')](_0x27d0b3);}}};Preview[_0xa885('0xf')][_0xa885('0x67')]=function(_0x2ee5eb){var _0x16f162=this;rpcDb[_0xa885('0x7f')](_0x2ee5eb['id'],ut[_0xa885('0x80')](this['agents']))[_0xa885('0x81')](function(_0x333502){if(!_['isNil'](_0x333502)){for(var _0x4dc788=0x0;_0x4dc788<_0x333502[_0xa885('0x82')];_0x4dc788+=0x1){if(ut[_0xa885('0x83')](_0x333502[_0x4dc788]['scheduledat'])<_0x2ee5eb[_0xa885('0x84')]*0x3c){if(_0x333502[_0x4dc788][_0xa885('0x85')]&&!_0x333502[_0x4dc788][_0xa885('0x85')][_0xa885('0x86')]){_0x16f162[_0xa885('0x87')](_0x333502[_0x4dc788]['id'])[_0xa885('0x81')](ut[_0xa885('0x88')]('[RecallMe]'))[_0xa885('0x75')](ut[_0xa885('0x88')]('[RecallMe]'));}else{rpcDb[_0xa885('0x89')](_0x333502[_0x4dc788]['id']);}}else{var _0x48ded4=new Action(_0x333502[_0x4dc788],_0x2ee5eb);_0x48ded4[_0xa885('0x8a')]=moment()['format'](_0xa885('0x8b'));_0x2ee5eb[_0xa885('0x8c')]+=0x1;ut[_0xa885('0x8d')](_0x48ded4,0x17,_0xa885('0x8e'));if(_0x2ee5eb['dialRecallInQueue']){rpcDb[_0xa885('0x8f')](ut[_0xa885('0x90')](_0x333502[_0x4dc788]));rpcDb[_0xa885('0x91')](_0x48ded4,'[HistoryDialRecallInQueue][historyCatch]');}else{ut[_0xa885('0x8d')](_0x48ded4,0x16,'RecallFailedTimeout');rpcDb[_0xa885('0x91')](_0x48ded4,_0xa885('0x92'));rpcDb['createCustomerFinal'](_0x48ded4,_0xa885('0x92'));}}}}})['catch'](ut[_0xa885('0x88')](_0xa885('0x93')));};Preview['prototype'][_0xa885('0x66')]=function(_0x569d63){_0x569d63[_0xa885('0x58')]=!![];if(ut[_0xa885('0x94')](_0x569d63['loggedIn'])){_0x569d63['message']=_0xa885('0x95');}else if(!ut[_0xa885('0x96')](_0x569d63['dialActive'])){_0x569d63['message']=_0xa885('0x5b');}else if(!this[_0xa885('0x97')](_0x569d63[_0xa885('0x4c')])){if(!this[_0xa885('0x97')](_0x569d63[_0xa885('0x98')])){_0x569d63[_0xa885('0x46')]=_0xa885('0x99');}else{_0x569d63[_0xa885('0x46')]=_0xa885('0x9a');}}else{_0x569d63[_0xa885('0x46')]=_0xa885('0x9a');}emitCampaignPreview(_0x569d63);};Preview['prototype'][_0xa885('0x9b')]=function(_0x32e7ff,_0x3babfe,_0x3a0794){var _0x1da286=this;var _0x5cc2cf=this[_0xa885('0x16')][_0x3babfe];var _0x59ae23=this['campaignsPreview'][_0x5cc2cf[_0xa885('0x6c')]];var _0x3ce170;if(_0x59ae23){switch(_0x3a0794){case'1':_0x59ae23['outboundNoSuchCallsDay']+=0x1;_0x5cc2cf['countnosuchnumberretry']+=0x1;_0x5cc2cf[_0xa885('0x9c')]=ut[_0xa885('0x9d')](_0x5cc2cf);ut[_0xa885('0x8d')](_0x5cc2cf,0x0,'NoSuchNumber');ami['emit'](_0xa885('0x9e'),ut[_0xa885('0x9f')](_0x5cc2cf,_0xa885('0xa0')));rpcDb[_0xa885('0x91')](_0x5cc2cf,'[callProgressDetectingCustomer][logNoSuch]');if(ut[_0xa885('0x9d')](_0x5cc2cf)>=_0x59ae23[_0xa885('0xa1')]){_0x3ce170=ut[_0xa885('0xa2')](_0x5cc2cf,0xf,'Global');rpcDb['createCustomerFinal'](_0x3ce170,_0xa885('0xa3'));}else{if(_0x5cc2cf[_0xa885('0xa4')]>=_0x59ae23[_0xa885('0xa5')]){rpcDb['createCustomerFinal'](_0x5cc2cf,_0xa885('0xa3'));}else{rpcDb[_0xa885('0xa6')](ut[_0xa885('0xa7')](_0x5cc2cf,_0xa885('0xa4'),_0x59ae23['dialNoSuchNumberRetryFrequency']),_0x5cc2cf[_0xa885('0xa8')],_0x5cc2cf[_0xa885('0xa9')]);}}delete this['actions'][_0x32e7ff[_0xa885('0xaa')]];break;case _0xa885('0xab'):var _0x5a7bde=moment()[_0xa885('0x52')]('YYYY-MM-DD\x20HH:mm:ss');_0x5cc2cf[_0xa885('0xac')]=_0x5a7bde;_0x5cc2cf[_0xa885('0xad')]=_0x5a7bde;_0x5cc2cf[_0xa885('0x79')]=!![];_0x59ae23[_0xa885('0x2a')]+=0x1;logger[_0xa885('0x6a')](_0xa885('0xae'),_0x5cc2cf[_0xa885('0xaf')],_0xa885('0xb0'),_0x59ae23['name'],'pTalking:\x20',_0x59ae23[_0xa885('0x2a')]);ami[_0xa885('0x25')]('custom:agentconnect',ut[_0xa885('0x9f')](_0x5cc2cf,_0xa885('0xb1'),this['campaignsPreview'][_0x5cc2cf[_0xa885('0x6c')]]));if(_0x59ae23['acw']){ami[_0xa885('0x25')](_0xa885('0xb2'),ut[_0xa885('0xb3')](_0x5cc2cf));}break;case'16':ami[_0xa885('0x25')]('custom:agentcomplete',ut['buildObj'](_0x5cc2cf,_0xa885('0xb4'),this[_0xa885('0x13')][_0x5cc2cf[_0xa885('0x6c')]]));emitVoiceQueueChannelRemove(ut[_0xa885('0x9f')](_0x5cc2cf,_0xa885('0xb4')));_0x59ae23[_0xa885('0xb5')]+=0x1;_0x59ae23[_0xa885('0xb6')]+=0x1;_0x59ae23[_0xa885('0x28')]+=0x1;ut['decrementTalkink'](_0x59ae23,_0xa885('0xb7'));_0x5cc2cf['countglobal']=ut[_0xa885('0x9d')](_0x5cc2cf);ut[_0xa885('0x8d')](_0x5cc2cf,0x4,_0xa885('0xb8'));rpcDb['createCustomerHistory'](_0x5cc2cf,_0xa885('0xb9'));rpcDb[_0xa885('0xba')](_0x5cc2cf,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb['crateCustomerReportQueue'](_0x5cc2cf);_0x59ae23[_0xa885('0xbb')]+=_0x5cc2cf[_0xa885('0xbc')];_0x59ae23[_0xa885('0x2b')]+=_0x5cc2cf[_0xa885('0xbc')];logger[_0xa885('0x6a')]('[syncHangup][talking][decrement]',_0x5cc2cf['uniqueid'],_0xa885('0xb0'),_0x59ae23[_0xa885('0x4d')],_0xa885('0x6d'),_0x59ae23[_0xa885('0x2a')]);delete this['actions'][_0x32e7ff['linkedid']];break;case'BUSY':_0x59ae23[_0xa885('0xbd')]+=0x1;_0x5cc2cf[_0xa885('0xbe')]+=0x1;_0x5cc2cf[_0xa885('0x9c')]=ut[_0xa885('0x9d')](_0x5cc2cf);ut[_0xa885('0x8d')](_0x5cc2cf,0x5,_0xa885('0xbf'));ami[_0xa885('0x25')]('custom:agentbusy',ut['buildObj'](_0x5cc2cf,_0xa885('0xc0')));rpcDb['createCustomerHistory'](_0x5cc2cf,_0xa885('0xc1'));if(ut[_0xa885('0x9d')](_0x5cc2cf)>=_0x59ae23[_0xa885('0xa1')]){_0x3ce170=ut[_0xa885('0xa2')](_0x5cc2cf,0xf,'Global');rpcDb[_0xa885('0xba')](_0x3ce170,_0xa885('0xc2'));}else{if(_0x5cc2cf[_0xa885('0xbe')]>=_0x59ae23['dialBusyMaxRetry']){rpcDb[_0xa885('0xba')](_0x5cc2cf,_0xa885('0xc1'));}else{rpcDb[_0xa885('0xa6')](ut['scheduledAt'](_0x5cc2cf,_0xa885('0xbe'),_0x59ae23[_0xa885('0xc3')]),_0x5cc2cf[_0xa885('0xa8')],_0x5cc2cf[_0xa885('0xa9')]);}}break;case _0xa885('0xc4'):_0x59ae23[_0xa885('0x3a')]+=0x1;_0x5cc2cf['countnoanswerretry']+=0x1;_0x5cc2cf[_0xa885('0x9c')]=ut[_0xa885('0x9d')](_0x5cc2cf);ut[_0xa885('0x8d')](_0x5cc2cf,0x3,_0xa885('0xc5'));ami['emit'](_0xa885('0xc6'),ut[_0xa885('0x9f')](_0x5cc2cf,_0xa885('0xc7')));rpcDb[_0xa885('0x91')](_0x5cc2cf,_0xa885('0xc8'));if(ut[_0xa885('0x9d')](_0x5cc2cf)>=_0x59ae23[_0xa885('0xa1')]){_0x3ce170=ut[_0xa885('0xa2')](_0x5cc2cf,0xf,'Global');rpcDb[_0xa885('0xba')](_0x3ce170,_0xa885('0xc9'));}else{if(_0x5cc2cf['countnoanswerretry']>=_0x59ae23[_0xa885('0xca')]){rpcDb['createCustomerFinal'](_0x5cc2cf,_0xa885('0xc8'));}else{rpcDb[_0xa885('0xa6')](ut['scheduledAt'](_0x5cc2cf,_0xa885('0xcb'),_0x59ae23['dialNoAnswerRetryFrequency']),_0x5cc2cf[_0xa885('0xa8')],_0x5cc2cf['activeContact']);}}break;case _0xa885('0xcc'):_0x59ae23['outboundCongestionCallsDay']+=0x1;_0x5cc2cf[_0xa885('0xcd')]+=0x1;_0x5cc2cf[_0xa885('0x9c')]=ut[_0xa885('0x9d')](_0x5cc2cf);ut[_0xa885('0x8d')](_0x5cc2cf,0x8,'Congestion');ami[_0xa885('0x25')](_0xa885('0xce'),ut[_0xa885('0x9f')](_0x5cc2cf,'congestion'));rpcDb[_0xa885('0x91')](_0x5cc2cf,_0xa885('0xcf'));if(ut[_0xa885('0x9d')](_0x5cc2cf)>=_0x59ae23['dialGlobalMaxRetry']){_0x3ce170=ut[_0xa885('0xa2')](_0x5cc2cf,0xf,_0xa885('0xd0'));rpcDb['createCustomerFinal'](_0x3ce170,'[callProgressDetectingCustomer][logCongestionGlobal]');}else{if(_0x5cc2cf[_0xa885('0xcd')]>=_0x59ae23[_0xa885('0xd1')]){rpcDb[_0xa885('0xba')](_0x5cc2cf,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb[_0xa885('0xa6')](ut[_0xa885('0xa7')](_0x5cc2cf,_0xa885('0xcd'),_0x59ae23[_0xa885('0xc3')]),_0x5cc2cf[_0xa885('0xa8')],_0x5cc2cf[_0xa885('0xa9')]);}}break;case _0xa885('0xd2'):_0x59ae23[_0xa885('0x3d')]+=0x1;_0x5cc2cf[_0xa885('0xd3')]+=0x1;_0x5cc2cf[_0xa885('0x9c')]=ut['totalGlobal'](_0x5cc2cf);ut['logCustomer'](_0x5cc2cf,0x14,_0xa885('0xd4'));ami['emit'](_0xa885('0xd5'),ut[_0xa885('0x9f')](_0x5cc2cf,_0xa885('0xd6')));rpcDb['createCustomerHistory'](_0x5cc2cf,_0xa885('0xd7'));if(ut[_0xa885('0x9d')](_0x5cc2cf)>=_0x59ae23[_0xa885('0xa1')]){_0x3ce170=ut[_0xa885('0xa2')](_0x5cc2cf,0x14,_0xa885('0xd4'));rpcDb[_0xa885('0xba')](_0x3ce170,_0xa885('0xd8'));}else{if(_0x5cc2cf['countagentrejectretry']>=_0x59ae23[_0xa885('0xd9')]){rpcDb[_0xa885('0xba')](_0x5cc2cf,_0xa885('0xd8'));}else{rpcDb[_0xa885('0xa6')](ut['scheduledAt'](_0x5cc2cf,_0xa885('0xd3'),_0x59ae23[_0xa885('0xda')]),_0x5cc2cf['unlockAgent'],_0x5cc2cf['activeContact']);}}break;case _0xa885('0xdb'):_0x59ae23[_0xa885('0x3e')]+=0x1;_0x5cc2cf[_0xa885('0xdc')]+=0x1;_0x5cc2cf[_0xa885('0x9c')]=ut[_0xa885('0x9d')](_0x5cc2cf);ut[_0xa885('0x8d')](_0x5cc2cf,0xb,_0xa885('0xdd'));rpcDb[_0xa885('0x91')](_0x5cc2cf,'[callProgressDetectingCustomer][logAbandoned]');if(ut[_0xa885('0x9d')](_0x5cc2cf)>=_0x59ae23['dialGlobalMaxRetry']){_0x3ce170=ut[_0xa885('0xa2')](_0x5cc2cf,0xf,_0xa885('0xd0'));rpcDb[_0xa885('0xba')](_0x3ce170,_0xa885('0xde'));}else{if(_0x5cc2cf['countabandonedetry']>=_0x59ae23[_0xa885('0xdf')]){rpcDb[_0xa885('0xba')](_0x5cc2cf,_0xa885('0xde'));}else{rpcDb[_0xa885('0xa6')](ut['scheduledAt'](_0x5cc2cf,_0xa885('0xdc'),_0x59ae23['dialAbandonedRetryFrequency']),_0x5cc2cf[_0xa885('0xa8')],_0x5cc2cf['activeContact']);}}break;case'18':_0x59ae23[_0xa885('0xe0')]+=0x1;_0x5cc2cf[_0xa885('0xe1')]+=0x1;_0x5cc2cf[_0xa885('0x9c')]=ut['totalGlobal'](_0x5cc2cf);ut[_0xa885('0x8d')](_0x5cc2cf,0x12,_0x32e7ff[_0xa885('0xe2')]||_0x32e7ff[_0xa885('0xe3')]);ami[_0xa885('0x25')](_0xa885('0xe4'),ut[_0xa885('0x9f')](_0x5cc2cf,_0xa885('0xe5')));rpcDb[_0xa885('0x91')](_0x5cc2cf,_0xa885('0xe6'));if(ut[_0xa885('0x9d')](_0x5cc2cf)>=_0x59ae23[_0xa885('0xa1')]){_0x3ce170=ut[_0xa885('0xa2')](_0x5cc2cf,0xf,_0xa885('0xd0'));rpcDb[_0xa885('0xba')](_0x3ce170,'[callProgressDetectingCustomer][hangupInAMD]');}else{rpcDb[_0xa885('0xba')](_0x5cc2cf,_0xa885('0xe6'));}delete this[_0xa885('0x16')][_0x32e7ff[_0xa885('0xaa')]];break;case'19':_0x59ae23['outboundUnknownCallsDay']+=0x1;_0x5cc2cf[_0xa885('0x9c')]=ut[_0xa885('0x9d')](_0x5cc2cf);ut[_0xa885('0x8d')](_0x5cc2cf,0x13,_0x32e7ff[_0xa885('0xe2')]||_0x32e7ff[_0xa885('0xe3')]);ami[_0xa885('0x25')](_0xa885('0xe4'),ut[_0xa885('0x9f')](_0x5cc2cf,_0xa885('0xe5')));rpcDb['createCustomerHistory'](_0x5cc2cf,'[callProgressDetectingCustomer][machine]');if(ut[_0xa885('0x9d')](_0x5cc2cf)>=_0x59ae23[_0xa885('0xa1')]){_0x3ce170=ut[_0xa885('0xa2')](_0x5cc2cf,0xf,_0xa885('0xd0'));rpcDb[_0xa885('0xba')](_0x3ce170,_0xa885('0xe7'));}else{rpcDb[_0xa885('0xba')](_0x5cc2cf,_0xa885('0xe7'));}delete this[_0xa885('0x16')][_0x32e7ff[_0xa885('0xaa')]];break;default:if(_0x5cc2cf[_0xa885('0x79')]){ut['decrementTalkink'](_0x59ae23,_0xa885('0xe8'));ut[_0xa885('0x7b')](_0xa885('0xe9')+_0x59ae23[_0xa885('0x4d')],_0x32e7ff);}_0x59ae23[_0xa885('0xe0')]+=0x1;_0x5cc2cf['countglobal']=ut[_0xa885('0x9d')](_0x5cc2cf);ut[_0xa885('0x8d')](_0x5cc2cf,0xc,_0x32e7ff[_0xa885('0xe2')]||_0x32e7ff['dialstatus']);rpcDb[_0xa885('0x91')](_0x5cc2cf,_0xa885('0xea'));if(ut[_0xa885('0x9d')](_0x5cc2cf)>=_0x59ae23[_0xa885('0xa1')]){_0x3ce170=ut[_0xa885('0xa2')](_0x5cc2cf,0xf,_0xa885('0xd0'));rpcDb[_0xa885('0xba')](_0x3ce170,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0xa885('0xba')](_0x5cc2cf,_0xa885('0xeb'));}delete this[_0xa885('0x16')][_0x32e7ff[_0xa885('0xaa')]];}if(!(_0x5cc2cf['dialAnswer']&&_0x3a0794==='16')){ut['updateOriginated'](_0x59ae23,_0xa885('0xec'));logger[_0xa885('0x6a')](_0xa885('0xed'),_0x5cc2cf[_0xa885('0xaf')],_0xa885('0xb0'),_0x59ae23['name'],_0xa885('0xee'),_0x59ae23[_0xa885('0x47')]);}if(_0x3a0794!==_0xa885('0xab')){delete this[_0xa885('0x16')][_0x32e7ff[_0xa885('0xaa')]];delete this[_0xa885('0x16')][_0x32e7ff['destlinkedid']];}}};Preview[_0xa885('0xf')]['callProgressDetectingAgent']=function(_0x5102f8,_0x20b6bd,_0x557f12){if(_[_0xa885('0xef')](_0x20b6bd)&&'object'!==typeof _0x20b6bd){return;}if(_[_0xa885('0xef')](_0x557f12)&&_0xa885('0xf0')!==typeof _0x557f12){return;}switch(_0x557f12[_0xa885('0xf1')]){case'0':ut[_0xa885('0xf2')](_0x5102f8,0x0,_0xa885('0xf3'));rpcDb[_0xa885('0xf4')](_0x5102f8,_0xa885('0xf5'));break;case'3':ut[_0xa885('0xf2')](_0x5102f8,0x3,_0xa885('0xc5'));rpcDb[_0xa885('0xf4')](_0x5102f8,_0xa885('0xf6'));break;case'5':ut['logAgent'](_0x5102f8,0x5,_0xa885('0xbf'));rpcDb[_0xa885('0xf4')](_0x5102f8,_0xa885('0xf7'));break;case'8':ut['logAgent'](_0x5102f8,0x8,_0xa885('0xf8'));rpcDb[_0xa885('0xf4')](_0x5102f8,_0xa885('0xf9'));break;case'22':ut[_0xa885('0xf2')](_0x5102f8,0x16,_0xa885('0xfa'));rpcDb[_0xa885('0xf4')](_0x5102f8,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut[_0xa885('0xf2')](_0x5102f8,0xc,_0x557f12[_0xa885('0xf1')]);rpcDb[_0xa885('0xf4')](_0x5102f8,_0xa885('0xf9'));}ut['updateOriginated'](_0x20b6bd,'[callProgressDetectingAgent]');logger[_0xa885('0x6a')](_0xa885('0xfb'),_0x5102f8[_0xa885('0xaf')],'\x20Queue',_0x20b6bd['name'],_0xa885('0xee'),_0x20b6bd[_0xa885('0x47')]);delete this[_0xa885('0x16')][_0x5102f8[_0xa885('0xaf')]];};Preview['prototype'][_0xa885('0xfc')]=function(_0x2f2a64,_0x5c68f7,_0x5cf609,_0x1fe18b,_0x41c077){var _0x4ae384=this;return new BPromise(function(_0xc9b253,_0x3e9888){if(_[_0xa885('0x69')](_0x5c68f7)||_[_0xa885('0x69')](_0x5c68f7[_0xa885('0xfd')])||_['isNil'](_0x5c68f7['Contact'][_0xa885('0xfe')])||_[_0xa885('0x69')](_0x5c68f7['VoiceQueueId'])){_0x3e9888(ut[_0xa885('0x46')](_0xa885('0xff'),_0x1fe18b,_0x41c077));return;}var _0x49f02a=uuid['v4']();var _0x453494=_0x4ae384[_0xa885('0x13')][_0x5c68f7[_0xa885('0x6b')]['name']];var _0x2dcf1a=_0x5cf609?_0x4ae384[_0xa885('0x17')][_0x5cf609]['id']:undefined;_0x4ae384[_0xa885('0x16')][_0x49f02a]=new Action(_0x5c68f7,_0x453494,_0x49f02a,_0x5cf609,_0x2dcf1a);var _0x4dd4ac=_0x4ae384[_0xa885('0x16')][_0x49f02a];_0x4dd4ac[_0xa885('0xa8')]=_0x1fe18b;_0x4dd4ac[_0xa885('0xa9')]=_0x41c077;_0x4dd4ac['lookAgent']=_0x5cf609;if(_[_0xa885('0x100')](_0x2f2a64)){_0x4ae384[_0xa885('0x101')](_0x4dd4ac,_0x453494,_0x5c68f7,_0x5cf609)[_0xa885('0x81')](function(_0x3e36c4){logger['info']('[Preview][execCall][success]',_0xa885('0x102')+_0x4dd4ac[_0xa885('0x6c')]+_0xa885('0x103')+_0x4dd4ac['idContact'],JSON[_0xa885('0x50')](_0x3e36c4));ami[_0xa885('0x25')]('custom:agentcalled',ut[_0xa885('0x9f')](_0x4dd4ac,_0xa885('0x104'),_0x4ae384[_0xa885('0x13')][_0x4dd4ac[_0xa885('0x6c')]]));_0xc9b253(ut[_0xa885('0x46')](_0xa885('0x105')));})[_0xa885('0x75')](function(_0x33bd83){ut[_0xa885('0x5c')](_0xa885('0x106'),_0x33bd83);_0x3e9888(ut['message'](_0xa885('0x107'),_0x1fe18b,_0x41c077));});}else{_0x453494[_0xa885('0x108')]+=0x1;ut['logBlacklist'](_0x4dd4ac);rpcDb['createHistory'](_0x4dd4ac,'[Blacklist][error]');delete _0x4ae384[_0xa885('0x16')][_0x49f02a];_0x3e9888(ut[_0xa885('0x46')](_0xa885('0x109'),_0x1fe18b,_0x41c077));}});};Preview[_0xa885('0xf')][_0xa885('0x97')]=function(_0x5b4ae6){return!_[_0xa885('0x69')](_0x5b4ae6)&&!_[_0xa885('0x69')](_0x5b4ae6[_0xa885('0x4d')])&&!_[_0xa885('0x69')](_0x5b4ae6[_0xa885('0x4e')])&&_0x5b4ae6[_0xa885('0x4e')]&&!_['isNil'](this[_0xa885('0x15')][util[_0xa885('0x52')](_0xa885('0x10a'),_0x5b4ae6[_0xa885('0x4d')])])&&!_['isNil'](this[_0xa885('0x15')][util[_0xa885('0x52')](_0xa885('0x10a'),_0x5b4ae6[_0xa885('0x4d')])][_0xa885('0x73')])&&(this['trunks'][util['format'](_0xa885('0x10a'),_0x5b4ae6[_0xa885('0x4d')])][_0xa885('0x73')]==='reachable'||this[_0xa885('0x15')][util[_0xa885('0x52')]('SIP/%s',_0x5b4ae6[_0xa885('0x4d')])]['status']===_0xa885('0x10b'));};Preview[_0xa885('0xf')][_0xa885('0x87')]=function(_0x4bf9f5,_0x5906f1){var _0x5556c9=this;return new BPromise(function(_0x3037ad,_0x10034f){_0x5556c9[_0xa885('0x10c')](_0x4bf9f5,_0x5906f1)['then'](function(_0x583b70){_0x3037ad(_[_0xa885('0x10d')](_0x583b70,[_0xa885('0x46')]));})['catch'](function(_0x57df36){if(_0x57df36[_0xa885('0x10e')]){rpcDb[_0xa885('0x10f')](_0x4bf9f5);}if(_0x57df36[_0xa885('0x4e')]){rpcDb[_0xa885('0x89')](_0x4bf9f5);}_0x10034f(_[_0xa885('0x10d')](_0x57df36,['message']));});});};Preview[_0xa885('0xf')]['execRun']=function(_0x35c9d2,_0x2141aa){var _0xe5797=this;return new BPromise(function(_0x64da56,_0x3d0e0a){var _0x363329,_0xc9665e;rpcDb[_0xa885('0x110')](_0x35c9d2)[_0xa885('0x81')](function(_0x3347a3){if(!_['isNil'](_0x3347a3[0x0])){_0xc9665e=_0x3347a3[0x0][_0xa885('0x111')]?![]:!![];_0x363329=_0x3347a3[0x0][_0xa885('0x111')]?!![]:![];_0x363329=_0x2141aa?!![]:_0x363329;}var _0x469497=_0xe5797[_0xa885('0x112')](_0x3347a3);if(_0x469497[_0xa885('0x113')]){rpcDb['checkIsBlackList'](_[_0xa885('0x10d')](_0x3347a3[0x0],[_0xa885('0x70'),'Contact.phone']))['then'](function(_0x17019f){_0xe5797['checkInBlack'](_0x17019f,_0x3347a3[0x0],_0x2141aa,_0xc9665e,_0x363329)[_0xa885('0x81')](function(_0x2d55f4){_0x64da56(_0x2d55f4);})[_0xa885('0x75')](function(_0x4ba8a7){_0x3d0e0a(_0x4ba8a7);});})[_0xa885('0x75')](function(_0x288795){ut[_0xa885('0x5c')]('[Preview][checkIsBlackList]',_0x288795);_0x3d0e0a(ut[_0xa885('0x46')](_0xa885('0x114'),_0xc9665e,_0x363329));});}else{_0x3d0e0a(ut['message'](_0x469497['message'],_0xc9665e,_0x363329));}})[_0xa885('0x75')](function(_0x1d32c8){ut[_0xa885('0x5c')]('[Preview][getContactPreview]',_0x1d32c8);_0x3d0e0a(ut[_0xa885('0x46')]('Call\x20unsuccessful',![],!![]));});});};Preview['prototype'][_0xa885('0x112')]=function(_0x1d5f01){if(_[_0xa885('0x69')](_0x1d5f01)||_[_0xa885('0x100')](_0x1d5f01)||!_[_0xa885('0x69')](_0x1d5f01[0x0]['Agent'])&&_['isNil'](_0x1d5f01[0x0][_0xa885('0x85')]['name'])){ut[_0xa885('0x5c')](_0xa885('0x115'),_0x1d5f01);return{'isValid':![],'message':_0xa885('0x116')};}var _0xf9497c=this[_0xa885('0x13')][_0x1d5f01[0x0]['Queue'][_0xa885('0x4d')]];_0xf9497c[_0xa885('0x46')]='ACTIVE';if(_[_0xa885('0x69')](_0xf9497c)){ut[_0xa885('0x5c')](_0xa885('0x117'),_0xf9497c);return{'isValid':![],'message':'Empty\x20Campaign'};}if(!this[_0xa885('0x97')](_0xf9497c[_0xa885('0x4c')])){ut[_0xa885('0x5c')](_0xa885('0x118'),_0xa885('0x119')+_0xf9497c[_0xa885('0x4d')]+_0xa885('0x11a'));if(!this['isTrunkReachable'](_0xf9497c[_0xa885('0x98')])){ut[_0xa885('0x5c')](_0xa885('0x118'),_0xf9497c[_0xa885('0x4d')]+_0xa885('0x11b'));return{'isValid':![],'message':_0xa885('0x11c')};}}if(!ut[_0xa885('0x96')](_0xf9497c['dialActive'])){ut[_0xa885('0x5c')](_0xa885('0x11d'),_0xf9497c[_0xa885('0x4d')]+_0xa885('0x11e'));return{'isValid':![],'message':_0xa885('0x119')+_0xf9497c[_0xa885('0x4d')]+_0xa885('0x11e')};}return{'isValid':!![],'message':_0xa885('0x11f')};};Preview[_0xa885('0xf')][_0xa885('0x101')]=function(_0x4adab9,_0x2a0788,_0x571953,_0x4716ef){var _0xebf906=this;return new BPromise(function(_0x177803,_0x5a9bf0){var _0x595cb4=_0x4adab9[_0xa885('0xaf')];var _0x29d231=_0xebf906[_0xa885('0x97')](_0x2a0788['Trunk'])?util[_0xa885('0x52')](_0xa885('0x120'),_0x2a0788['Trunk'][_0xa885('0x4d')],_[_0xa885('0x69')](_0x2a0788[_0xa885('0x35')])?'':_0x2a0788[_0xa885('0x35')][_0xa885('0x121')]()||'',_0x2a0788[_0xa885('0x122')]>0x0?_0x571953[_0xa885('0xfd')][_0xa885('0xfe')][_0xa885('0x123')](_0x2a0788[_0xa885('0x122')]):_0x571953[_0xa885('0xfd')]['phone']):util[_0xa885('0x52')](_0xa885('0x120'),_['isNil'](_0x2a0788[_0xa885('0x98')])?_0x2a0788[_0xa885('0x4c')][_0xa885('0x4d')]:_0x2a0788['TrunkBackup']['name'],_[_0xa885('0x69')](_0x2a0788[_0xa885('0x35')])?'':_0x2a0788[_0xa885('0x35')][_0xa885('0x121')]()||'',_0x2a0788[_0xa885('0x122')]>0x0?_0x571953['Contact']['phone'][_0xa885('0x123')](_0x2a0788[_0xa885('0x122')]):_0x571953[_0xa885('0xfd')]['phone']);var _0x273488=_0xebf906[_0xa885('0x97')](_0x2a0788[_0xa885('0x4c')])?ut['getCallerId'](_0x2a0788[_0xa885('0x4c')][_0xa885('0x124')],_0x2a0788[_0xa885('0x32')],_0x2a0788['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0xa885('0x125')](_0x2a0788[_0xa885('0x33')],_0x2a0788[_0xa885('0x126')]):_0x2a0788['dialOriginateCallerIdNumber']):ut[_0xa885('0x127')](_[_0xa885('0x69')](_0x2a0788[_0xa885('0x98')])?_0x2a0788[_0xa885('0x4c')][_0xa885('0x124')]:_0x2a0788[_0xa885('0x98')][_0xa885('0x124')],_0x2a0788[_0xa885('0x32')],_0x2a0788['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0xa885('0x125')](_0x2a0788[_0xa885('0x33')],_0x2a0788[_0xa885('0x126')]):_0x2a0788[_0xa885('0x33')]);if(_0x273488){_0x4adab9['originatecalleridname']=ut[_0xa885('0x128')](_0x273488);_0x4adab9[_0xa885('0x129')]=ut[_0xa885('0x12a')](_0x273488);}var _0x2494c5=ut['addVariables'](_0x2a0788,_0x571953,_0x29d231,_0x273488,_0x595cb4,_0x4adab9);_[_0xa885('0x12b')](_0x4adab9,ut[_0xa885('0x12c')](_0x2494c5));_0x4adab9[_0xa885('0x8a')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');ami[_0xa885('0x72')](ut[_0xa885('0x12d')](_0x4adab9,_0x2a0788,_0x2494c5,_0x4adab9['activeContact'],_0x4716ef))['then'](function(_0x13f115){_0x2a0788[_0xa885('0x47')]+=0x1;logger[_0xa885('0x6a')](_0xa885('0x12e'),_0x595cb4,_0xa885('0xb0'),_0x2a0788[_0xa885('0x4d')],_0xa885('0xee'),_0x2a0788['originated']);_0x177803(_0x13f115);})[_0xa885('0x75')](function(_0x2025e2){ut[_0xa885('0xf2')](_0x4adab9,0xe,_0xa885('0x12f'));rpcDb[_0xa885('0xf4')](_0x4adab9,_0xa885('0x130'));_0x5a9bf0(_0x2025e2);});});};Preview[_0xa885('0xf')][_0xa885('0x1f')]=function(_0x23742d){if(this[_0xa885('0x16')][_0x23742d['linkedid']]){this[_0xa885('0x16')][_0x23742d[_0xa885('0xaa')]][_0xa885('0x74')]=_0x23742d['channel'];}};Preview[_0xa885('0xf')]['syncOriginateResponse']=function(_0x2f88e6){var _0x4f14db=this;var _0x1585ba=this['actions'][_0x2f88e6[_0xa885('0x131')]];if(_0x1585ba){if(_0x1585ba[_0xa885('0x132')]&&this[_0xa885('0x17')][_0x1585ba[_0xa885('0x132')]]){ut[_0xa885('0x133')](_0x1585ba,this[_0xa885('0x17')][_0x1585ba[_0xa885('0x132')]]['name'],this[_0xa885('0x17')][_0x1585ba[_0xa885('0x132')]]['id']);}var _0x5b9dfe=_['clone'](_0x1585ba);_0x5b9dfe[_0xa885('0xac')]=moment()[_0xa885('0x52')]('YYYY-MM-DD\x20HH:mm:ss');var _0x56c5c9=_0x4f14db[_0xa885('0x13')][_0x1585ba[_0xa885('0x6c')]];if(ut['isFailure'](_0x2f88e6[_0xa885('0x134')])){if(_0x1585ba[_0xa885('0xa8')]){rpcDb[_0xa885('0x10f')](_0x1585ba['idContact']);}if(_0x1585ba['activeContact']){rpcDb['disableContact'](_0x1585ba[_0xa885('0x135')]);}ami[_0xa885('0x25')](_0xa885('0x136'),ut[_0xa885('0x9f')](_0x1585ba,'rejected',this[_0xa885('0x13')][_0x1585ba[_0xa885('0x6c')]]));this[_0xa885('0x137')](_0x5b9dfe,_0x56c5c9,_0x2f88e6);}else{_0x1585ba[_0xa885('0x8a')]=moment()[_0xa885('0x52')]('YYYY-MM-DD\x20HH:mm:ss');ut[_0xa885('0xf2')](_0x5b9dfe,0x4,_0xa885('0xb8'));rpcDb[_0xa885('0xf4')](_0x5b9dfe,'[callProgressDetectingAgent][logAnswer]');}}};Preview[_0xa885('0xf')][_0xa885('0x1c')]=function(_0x97042f){var _0x33f7d3=this;var _0x4830aa=this['actions'][_0x97042f[_0xa885('0xaa')]];var _0x6a66bc;if(_0x4830aa){_0x6a66bc=this[_0xa885('0x13')][_0x4830aa[_0xa885('0x6c')]];logger[_0xa885('0x6a')](_0xa885('0x138'),_0x97042f[_0xa885('0xaa')],_0xa885('0xb0'),_0x6a66bc['name'],_0xa885('0x6d'),_0x6a66bc[_0xa885('0x2a')]);}if(this['actions'][_0x97042f[_0xa885('0xaa')]]&&_0x97042f[_0xa885('0xaa')]!==_0x97042f[_0xa885('0xaf')]){if(_0x97042f['cause']==='16'&&this[_0xa885('0x16')][_0x97042f[_0xa885('0xaa')]][_0xa885('0x79')]){this['callProgressDetectingCustomer'](_0x97042f,_0x97042f[_0xa885('0xaa')],_0x97042f['cause']);}else if(this['actions'][_0x97042f[_0xa885('0xaa')]][_0xa885('0x79')]){logger[_0xa885('0x6a')](_0xa885('0x139'),_0x97042f[_0xa885('0xaa')],_0x97042f[_0xa885('0x13a')],_0xa885('0xb0'),_0x6a66bc[_0xa885('0x4d')],_0xa885('0x6d'),_0x6a66bc['pTalking']);this[_0xa885('0x9b')](_0x97042f,_0x97042f[_0xa885('0xaa')],_0x97042f['cause']);}}else if(_0x4830aa&&_[_0xa885('0x69')](_0x4830aa[_0xa885('0x13b')])&&_0x6a66bc[_0xa885('0x13c')]&&_0x97042f[_0xa885('0xaa')]===_0x97042f[_0xa885('0xaf')]&&_[_0xa885('0x69')](_0x97042f['reason'])&&_0x97042f[_0xa885('0x13a')]==='16'&&_0x97042f[_0xa885('0x13d')]==='6'&&_['isUndefined'](_0x4830aa['transfer'])){if(_0x4830aa[_0xa885('0xa8')]){rpcDb[_0xa885('0x10f')](_0x4830aa['idContact']);}if(_0x4830aa['activeContact']){rpcDb[_0xa885('0x89')](_0x4830aa['idContact']);}_0x97042f[_0xa885('0xf1')]='22';this[_0xa885('0x137')](_0x4830aa,_0x6a66bc,_0x97042f);}else if(_0x4830aa&&_0x4830aa[_0xa885('0x13e')]){if(_0x97042f[_0xa885('0x13a')]==='16'&&this[_0xa885('0x16')][_0x97042f[_0xa885('0xaa')]][_0xa885('0x79')]){logger[_0xa885('0x6a')](_0xa885('0x13f'),_0x97042f[_0xa885('0xaa')],_0x97042f[_0xa885('0x13a')],_0xa885('0xb0'),_0x6a66bc[_0xa885('0x4d')],_0xa885('0x6d'),_0x6a66bc[_0xa885('0x2a')]);this[_0xa885('0x9b')](_0x97042f,_0x97042f[_0xa885('0xaa')],_0x97042f[_0xa885('0x13a')]);}else if(this[_0xa885('0x16')][_0x97042f[_0xa885('0xaa')]][_0xa885('0x79')]){logger['info'](_0xa885('0x139'),_0x97042f['linkedid'],_0x97042f[_0xa885('0x13a')],_0xa885('0xb0'),_0x6a66bc[_0xa885('0x4d')],'pTalking:\x20',_0x6a66bc[_0xa885('0x2a')]);this[_0xa885('0x9b')](_0x97042f,_0x97042f[_0xa885('0xaa')],_0x97042f[_0xa885('0x13a')]);}}};Preview[_0xa885('0xf')][_0xa885('0x1e')]=function(_0x157513){if(this['actions'][_0x157513[_0xa885('0x140')]]&&_0x157513[_0xa885('0x140')]!==_0x157513[_0xa885('0x141')]){this['callProgressDetectingCustomer'](_0x157513,_0x157513[_0xa885('0x140')],_0x157513[_0xa885('0xe3')]);}};Preview['prototype'][_0xa885('0x1d')]=function(_0x5ecf53){if(this[_0xa885('0x16')][_0x5ecf53[_0xa885('0xaa')]]&&_0x5ecf53[_0xa885('0xaa')]!==_0x5ecf53[_0xa885('0xaf')]&&!this[_0xa885('0x16')][_0x5ecf53[_0xa885('0xaa')]][_0xa885('0x79')]){if(_0x5ecf53[_0xa885('0x13a')]==='1'){this['callProgressDetectingCustomer'](_0x5ecf53,_0x5ecf53[_0xa885('0xaa')],_0x5ecf53[_0xa885('0x13a')]);}}};Preview['prototype'][_0xa885('0x142')]=function(_0x324b77,_0x52a3c7,_0xcad242){if(this[_0xa885('0x16')][_0x324b77]){if(_['isNil'](this[_0xa885('0x16')][_0x324b77][_0xa885('0x143')])){this[_0xa885('0x16')][_0x324b77][_0xa885('0x143')]={};}this[_0xa885('0x16')][_0x324b77]['variables'][_0x52a3c7]=_0xcad242;}};Preview[_0xa885('0xf')]['syncVarSet']=function(_0x2a2aac){try{if(!_[_0xa885('0x69')](_0x2a2aac)){if(ut[_0xa885('0x144')](_[_0xa885('0x145')](_0x2a2aac[_0xa885('0x146')])[0x0])){this['addVariable'](_0x2a2aac[_0xa885('0xaf')],_[_0xa885('0x145')](_0x2a2aac[_0xa885('0x146')])[0x0],_0x2a2aac[_0xa885('0x147')]);}}}catch(_0x3efa79){logger[_0xa885('0x148')](_0xa885('0x149'),util[_0xa885('0x14a')](_0x3efa79,{'showHidden':![],'depth':null}));}};Preview[_0xa885('0xf')]['syncAttendedTransfer']=function(_0x211e42){if(_0x211e42){if(this['actions'][_0x211e42[_0xa885('0x14b')]]){this[_0xa885('0x16')][_0x211e42[_0xa885('0x14b')]][_0xa885('0x13e')]=!![];}}};Preview[_0xa885('0xf')][_0xa885('0x24')]=function(_0x55d509){if(_0x55d509){if(this['actions'][_0x55d509[_0xa885('0x14c')]]){this[_0xa885('0x16')][_0x55d509[_0xa885('0x14c')]][_0xa885('0x13e')]=!![];}}};module[_0xa885('0x14d')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 4fb636a..39338e9 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 _0x3b80=['unlockContact','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','answertime','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','context','from-sip','exten','xcally-motion-preview','holdtime','lastAssignedTo','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','preview','lodash','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','createHistory','catch','[createHistory]\x20','resolve','then','checkIsBlackList','[checkIsBlackList]\x20','[getContactPreview]\x20','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20'];(function(_0x5db313,_0x3c8f0c){var _0x36d503=function(_0x5d1ff6){while(--_0x5d1ff6){_0x5db313['push'](_0x5db313['shift']());}};_0x36d503(++_0x3c8f0c);}(_0x3b80,0xc5));var _0x03b8=function(_0x106a93,_0x5e8fd0){_0x106a93=_0x106a93-0x0;var _0x197296=_0x3b80[_0x106a93];return _0x197296;};'use strict';var util=require(_0x03b8('0x0'));var BPromise=require(_0x03b8('0x1'));var logger=require(_0x03b8('0x2'))(_0x03b8('0x3'));var _=require(_0x03b8('0x4'));var cmHopper=require('../rpc/cmHopper');var cmHopperFinal=require(_0x03b8('0x5'));var cmHopperHistory=require(_0x03b8('0x6'));var cmHopperBlack=require(_0x03b8('0x7'));var voiceQueueRt=require(_0x03b8('0x8'));var agentReportPreview=require(_0x03b8('0x9'));var voiceQueueReport=require(_0x03b8('0xa'));function loggerCatch(_0x4d5bf9){return function(_0x1f2b0c){logger[_0x03b8('0xb')](_0x4d5bf9,util[_0x03b8('0xc')](_0x1f2b0c,{'showHidden':![],'depth':null}));};}function create(_0x19fa2e){return BPromise['resolve']()['then'](cmHopperHistory[_0x03b8('0xd')](_0x19fa2e))[_0x03b8('0xe')](loggerCatch(_0x03b8('0xf')));}function createAgent(_0x1f3920){return BPromise[_0x03b8('0x10')]()[_0x03b8('0x11')](agentReportPreview['createHistory'](_0x1f3920))[_0x03b8('0xe')](loggerCatch(_0x03b8('0xf')));}function moveContact(_0x52b502){return BPromise[_0x03b8('0x10')]()[_0x03b8('0x11')](cmHopper['moveContactManagedDialer'](_0x52b502,!![]))['catch'](loggerCatch('[moveContactManagedDialer]\x20'));}exports[_0x03b8('0x12')]=function(_0x57a452){return BPromise[_0x03b8('0x10')]()['then'](cmHopperBlack[_0x03b8('0x12')](_0x57a452))[_0x03b8('0xe')](loggerCatch(_0x03b8('0x13')));};exports['getContactPreview']=function(_0xceea82){return BPromise[_0x03b8('0x10')]()[_0x03b8('0x11')](cmHopper['getContactPreview'](_0xceea82))['catch'](loggerCatch(_0x03b8('0x14')));};exports[_0x03b8('0xd')]=function(_0x5ae4f2,_0x2006f9){create(_0x5ae4f2)[_0x03b8('0xe')](loggerCatch(_0x2006f9));moveContact(_0x5ae4f2)['catch'](loggerCatch(_0x2006f9));};exports['createAgentHistory']=function(_0x1d3c0f,_0x28bec6){createAgent(_0x1d3c0f)[_0x03b8('0xe')](loggerCatch(_0x28bec6));};exports['createCustomerHistory']=function(_0x4d2b7a,_0x13f06c){create(_0x4d2b7a)[_0x03b8('0xe')](loggerCatch(_0x13f06c));};exports['createCustomerFinal']=function(_0x2bffdf,_0x31ce6c){moveContact(_0x2bffdf)[_0x03b8('0xe')](loggerCatch(_0x31ce6c));};exports[_0x03b8('0x15')]=function(_0x4d34b3,_0x1efce8,_0x3ead90){if(_0x1efce8){_0x4d34b3[_0x03b8('0x16')]=null;}if(_0x3ead90){_0x4d34b3[_0x03b8('0x17')]=![];}return BPromise[_0x03b8('0x10')]()[_0x03b8('0x11')](cmHopper[_0x03b8('0x15')](_0x4d34b3))[_0x03b8('0xe')](loggerCatch(_0x03b8('0x18')));};exports[_0x03b8('0x19')]=function(_0xcdb2d){return BPromise[_0x03b8('0x10')]()['then'](cmHopper[_0x03b8('0x19')](_0xcdb2d))[_0x03b8('0xe')](loggerCatch(_0x03b8('0x1a')));};exports[_0x03b8('0x1b')]=function(_0x3ca37c){return BPromise[_0x03b8('0x10')]()['then'](cmHopper['unlockContact']({'UserId':null},_0x3ca37c,0x1))[_0x03b8('0xe')](loggerCatch('[unlockContact]\x20'));};exports[_0x03b8('0x1c')]=function(_0x3f76a3){return BPromise[_0x03b8('0x10')]()['then'](cmHopper['unlockContact']({'active':![]},_0x3f76a3,0x1))[_0x03b8('0xe')](loggerCatch(_0x03b8('0x1d')));};exports[_0x03b8('0x1e')]=function(_0x5ef927){var _0x14f708={};_0x14f708[_0x03b8('0x1f')]=_0x5ef927['type'];_0x14f708['uniqueid']=_0x5ef927[_0x03b8('0x20')];_0x14f708[_0x03b8('0x21')]=_0x5ef927[_0x03b8('0x21')];_0x14f708[_0x03b8('0x22')]=_0x5ef927[_0x03b8('0x22')];_0x14f708[_0x03b8('0x23')]=_0x5ef927[_0x03b8('0x23')];_0x14f708[_0x03b8('0x24')]=_0x5ef927['answertime'];_0x14f708[_0x03b8('0x25')]=_0x5ef927[_0x03b8('0x26')];_0x14f708[_0x03b8('0x27')]=0x1;_0x14f708[_0x03b8('0x28')]=_0x5ef927[_0x03b8('0x29')];_0x14f708[_0x03b8('0x2a')]=_0x5ef927[_0x03b8('0x2b')];_0x14f708[_0x03b8('0x2c')]=_0x03b8('0x2d');_0x14f708[_0x03b8('0x2e')]=_0x03b8('0x2f');_0x14f708[_0x03b8('0x30')]=0x0;_0x14f708['assigned']=0x1;_0x14f708[_0x03b8('0x31')]=_0x5ef927[_0x03b8('0x2b')];_0x14f708['queuecallerexitreason']=_0x03b8('0x32');return BPromise[_0x03b8('0x10')]()[_0x03b8('0x11')](voiceQueueReport[_0x03b8('0x33')](_0x14f708))[_0x03b8('0xe')](loggerCatch(_0x03b8('0x34')));};exports[_0x03b8('0x35')]=function(_0x4c2bd6,_0x21a9a5){return BPromise[_0x03b8('0x10')]()['then'](cmHopper[_0x03b8('0x35')](_0x4c2bd6,_0x21a9a5))[_0x03b8('0xe')](loggerCatch('[GetContactRecallMe]\x20'));};exports[_0x03b8('0x36')]=function(_0x415ae8){return BPromise[_0x03b8('0x10')]()['then'](cmHopper[_0x03b8('0x15')](_0x415ae8,!![],!![]))['catch'](loggerCatch(_0x03b8('0x37')));}; \ No newline at end of file +var _0xb092=['../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/voiceQueueReport','error','inspect','resolve','then','createHistory','catch','[createHistory]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','active','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerleaveAt','answertime','connectedlinename','context','from-sip','xcally-motion-preview','holdtime','lastAssignedTo','membername','COMPLETED','create','getContactRecallMe','[GetContactRecallMe]\x20','[rescheduleContactInQueue]\x20','util','bluebird','preview','lodash'];(function(_0x39e153,_0x9e8365){var _0x342760=function(_0x51bbaa){while(--_0x51bbaa){_0x39e153['push'](_0x39e153['shift']());}};_0x342760(++_0x9e8365);}(_0xb092,0x10f));var _0x2b09=function(_0x480d55,_0x5ca468){_0x480d55=_0x480d55-0x0;var _0x496d5e=_0xb092[_0x480d55];return _0x496d5e;};'use strict';var util=require(_0x2b09('0x0'));var BPromise=require(_0x2b09('0x1'));var logger=require('../../../config/logger')(_0x2b09('0x2'));var _=require(_0x2b09('0x3'));var cmHopper=require(_0x2b09('0x4'));var cmHopperFinal=require(_0x2b09('0x5'));var cmHopperHistory=require(_0x2b09('0x6'));var cmHopperBlack=require(_0x2b09('0x7'));var voiceQueueRt=require(_0x2b09('0x8'));var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require(_0x2b09('0x9'));function loggerCatch(_0x4f9836){return function(_0xcbcd83){logger[_0x2b09('0xa')](_0x4f9836,util[_0x2b09('0xb')](_0xcbcd83,{'showHidden':![],'depth':null}));};}function create(_0x478a12){return BPromise[_0x2b09('0xc')]()[_0x2b09('0xd')](cmHopperHistory[_0x2b09('0xe')](_0x478a12))[_0x2b09('0xf')](loggerCatch(_0x2b09('0x10')));}function createAgent(_0x3dd9ce){return BPromise[_0x2b09('0xc')]()['then'](agentReportPreview[_0x2b09('0xe')](_0x3dd9ce))[_0x2b09('0xf')](loggerCatch('[createHistory]\x20'));}function moveContact(_0x233ffc){return BPromise[_0x2b09('0xc')]()[_0x2b09('0xd')](cmHopper[_0x2b09('0x11')](_0x233ffc,!![]))[_0x2b09('0xf')](loggerCatch(_0x2b09('0x12')));}exports['checkIsBlackList']=function(_0xcee1e6){return BPromise[_0x2b09('0xc')]()[_0x2b09('0xd')](cmHopperBlack[_0x2b09('0x13')](_0xcee1e6))['catch'](loggerCatch(_0x2b09('0x14')));};exports[_0x2b09('0x15')]=function(_0xba2299){return BPromise[_0x2b09('0xc')]()[_0x2b09('0xd')](cmHopper[_0x2b09('0x15')](_0xba2299))[_0x2b09('0xf')](loggerCatch(_0x2b09('0x16')));};exports['createHistory']=function(_0x4edcf4,_0xdebf24){create(_0x4edcf4)['catch'](loggerCatch(_0xdebf24));moveContact(_0x4edcf4)['catch'](loggerCatch(_0xdebf24));};exports[_0x2b09('0x17')]=function(_0x4ec731,_0x4dfb4e){createAgent(_0x4ec731)[_0x2b09('0xf')](loggerCatch(_0x4dfb4e));};exports[_0x2b09('0x18')]=function(_0x47adbd,_0x2d8e5b){create(_0x47adbd)[_0x2b09('0xf')](loggerCatch(_0x2d8e5b));};exports[_0x2b09('0x19')]=function(_0x174f8a,_0x5b0943){moveContact(_0x174f8a)[_0x2b09('0xf')](loggerCatch(_0x5b0943));};exports[_0x2b09('0x1a')]=function(_0x68cac9,_0x9ca8e1,_0x3e4863){if(_0x9ca8e1){_0x68cac9[_0x2b09('0x1b')]=null;}if(_0x3e4863){_0x68cac9[_0x2b09('0x1c')]=![];}return BPromise[_0x2b09('0xc')]()[_0x2b09('0xd')](cmHopper[_0x2b09('0x1a')](_0x68cac9))[_0x2b09('0xf')](loggerCatch('[rescheduleContact]\x20'));};exports[_0x2b09('0x1d')]=function(_0x8dc32c){return BPromise[_0x2b09('0xc')]()[_0x2b09('0xd')](cmHopper[_0x2b09('0x1d')](_0x8dc32c))[_0x2b09('0xf')](loggerCatch(_0x2b09('0x1e')));};exports[_0x2b09('0x1f')]=function(_0x3bcb10){return BPromise[_0x2b09('0xc')]()[_0x2b09('0xd')](cmHopper['unlockContact']({'UserId':null},_0x3bcb10,0x1))[_0x2b09('0xf')](loggerCatch(_0x2b09('0x20')));};exports[_0x2b09('0x21')]=function(_0x1ac94b){return BPromise[_0x2b09('0xc')]()[_0x2b09('0xd')](cmHopper[_0x2b09('0x1f')]({'active':![]},_0x1ac94b,0x1))[_0x2b09('0xf')](loggerCatch(_0x2b09('0x22')));};exports[_0x2b09('0x23')]=function(_0x42a801){var _0x2c9604={};_0x2c9604[_0x2b09('0x24')]=_0x42a801[_0x2b09('0x24')];_0x2c9604[_0x2b09('0x25')]=_0x42a801[_0x2b09('0x25')];_0x2c9604[_0x2b09('0x26')]=_0x42a801[_0x2b09('0x26')];_0x2c9604['calleridname']=_0x42a801[_0x2b09('0x27')];_0x2c9604[_0x2b09('0x28')]=_0x42a801[_0x2b09('0x28')];_0x2c9604['queuecallerjoinAt']=_0x42a801['answertime'];_0x2c9604[_0x2b09('0x29')]=_0x42a801[_0x2b09('0x2a')];_0x2c9604['queuecallercomplete']=0x1;_0x2c9604['queuecallercompleteAt']=_0x42a801['endtime'];_0x2c9604[_0x2b09('0x2b')]=_0x42a801['membername'];_0x2c9604[_0x2b09('0x2c')]=_0x2b09('0x2d');_0x2c9604['exten']=_0x2b09('0x2e');_0x2c9604[_0x2b09('0x2f')]=0x0;_0x2c9604['assigned']=0x1;_0x2c9604[_0x2b09('0x30')]=_0x42a801[_0x2b09('0x31')];_0x2c9604['queuecallerexitreason']=_0x2b09('0x32');return BPromise[_0x2b09('0xc')]()['then'](voiceQueueReport[_0x2b09('0x33')](_0x2c9604))[_0x2b09('0xf')](loggerCatch('[voiceQueueReport]\x20'));};exports[_0x2b09('0x34')]=function(_0x2a3125,_0x1950f2){return BPromise[_0x2b09('0xc')]()[_0x2b09('0xd')](cmHopper[_0x2b09('0x34')](_0x2a3125,_0x1950f2))[_0x2b09('0xf')](loggerCatch(_0x2b09('0x35')));};exports['rescheduleContactInQueue']=function(_0x4c5b73){return BPromise[_0x2b09('0xc')]()['then'](cmHopper[_0x2b09('0x1a')](_0x4c5b73,!![],!![]))[_0x2b09('0xf')](loggerCatch(_0x2b09('0x36')));}; \ 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 1d34c43..e96e2b9 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 _0xe09b=['rtpaudioqosjitter','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','random','match','extractCalleridNumber','util','moment','preview','env','XCALLY_IP_AGI','127.0.0.1','milliseconds','seconds','loggerCatch','logger','info','inspect','error','logger2','message','getCallerId','isUndefined','string','isEmpty','\x22%s\x22\x20<%s>','format','\x22\x22\x20<>','isActive','isNil','Queue','name','calleridname','calleridnum','ContactId','dialer','dialOriginateTimeout','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_UNIQUEID','Contact','tags','createdAt','updatedAt','%s%s','XMD-','toUpper','toLowerVariables','toLower','updateOriginated','hasOwnProperty','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','logBlacklist','statedesc','Blacklist','logAgent','YYYY-MM-DD\x20HH:mm:ss','responsetime','starttime','logLookAgent','membername','UserId','logCustomer','endtime','ringtime','talktime','answertime','Failure','variablesAction','BOOKED','channelAgent','from-sip','timeout','uniqueid','countagentrejectretry','countnosuchnumberretry','cloneAction','state','Global','scheduledAt','active','scheduledat','add','ListId','VoiceQueueId','pTalking','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','queue','interface','motionChannel','voice','mandatoryDisposition','status','reachable','push','diff','CampaignId','filterKey','idContact','type','campaigntype','dialAnswer','countbusyretry','countnoanswerretry','countglobal','callback','callbackuniqueid','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-callerid','xmd-agiafter','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqos'];(function(_0x2a695c,_0x5e563c){var _0x5a97e0=function(_0x4ee24b){while(--_0x4ee24b){_0x2a695c['push'](_0x2a695c['shift']());}};_0x5a97e0(++_0x5e563c);}(_0xe09b,0x97));var _0xbe09=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe09b[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0xbe09('0x0'));var _=require('lodash');var moment=require(_0xbe09('0x1'));var logger=require('../../../../config/logger')(_0xbe09('0x2'));var ipAgi=process[_0xbe09('0x3')][_0xbe09('0x4')]||_0xbe09('0x5');function getSeconds(_0x285b15,_0xcf4ff2){var _0x56020e=moment(_0x285b15)['milliseconds'](0x0);var _0x34bea4=moment(_0xcf4ff2)[_0xbe09('0x6')](0x0);return _0x56020e['diff'](_0x34bea4,_0xbe09('0x7'));}exports[_0xbe09('0x8')]=function(_0x2fa68f){return function(_0xb01ab7){logger['error'](_0x2fa68f,util['inspect'](_0xb01ab7,{'showHidden':![],'depth':null}));};};exports[_0xbe09('0x9')]=function(_0x13e415,_0x41c654){logger[_0xbe09('0xa')](_0x13e415,util[_0xbe09('0xb')](_0x41c654,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x40659f,_0x197826){logger[_0xbe09('0xc')](_0x40659f,util[_0xbe09('0xb')](_0x197826,{'showHidden':![],'depth':null}));};exports[_0xbe09('0xd')]=function(_0xe20df){return function(_0x4000a7){logger['info'](_0xe20df,util[_0xbe09('0xb')](_0x4000a7,{'showHidden':![],'depth':null}));};};exports[_0xbe09('0xe')]=function(_0x44748b,_0x61a709,_0x2ced72){return{'message':_0x44748b,'unlock':_0x61a709,'active':_0x2ced72};};exports[_0xbe09('0xf')]=function(_0x2eb81d,_0x2663aa,_0x5a9d04){if(!_[_0xbe09('0x10')](_0x5a9d04)&&_0xbe09('0x11')===typeof _0x5a9d04&&!_[_0xbe09('0x12')](_0x5a9d04)){if(!_['isUndefined'](_0x2663aa)&&_0xbe09('0x11')===typeof _0x2663aa&&!_[_0xbe09('0x12')](_0x2663aa)){return util['format'](_0xbe09('0x13'),_0x2663aa,_0x5a9d04);}return util[_0xbe09('0x14')](_0xbe09('0x13'),_0x5a9d04,_0x5a9d04);}if(!_['isUndefined'](_0x2eb81d)&&_0xbe09('0x11')===typeof _0x2eb81d&&!_[_0xbe09('0x12')](_0x2eb81d)){return _0x2eb81d;}return _0xbe09('0x15');};exports[_0xbe09('0x16')]=function(_0x1f03a6){if(_[_0xbe09('0x17')](_0x1f03a6)){return![];}return _0x1f03a6;};exports['addVariables']=function(_0x93e0f0,_0x11361e,_0x1cc474,_0x55369d,_0x1ae6d6,_0x1a5ed6){var _0x2b2deb={'XMD-QUEUE':_0x11361e[_0xbe09('0x18')]?_0x11361e[_0xbe09('0x18')][_0xbe09('0x19')]:'','XMD-CALLERID':_0x55369d,'XMD-CALLERID-PREVIEW':_0x1a5ed6?util['format']('\x22%s\x22\x20<%s>',_0x1a5ed6[_0xbe09('0x1a')],_0x1a5ed6[_0xbe09('0x1b')]):_0x55369d,'XMD-DIALID':_0x1ae6d6,'XMD-CONTACTID':_0x11361e[_0xbe09('0x1c')],'XMD-CDRTYPE':_0xbe09('0x1d'),'CALLERID(all)':_0x55369d,'XMD-VOICEQUEUEID':_0x11361e['VoiceQueueId'],'XMD-DIALCHANNEL':_0x1cc474,'XMD-DIALTIMEOUT':_0x93e0f0[_0xbe09('0x1e')]||0x1e,'XMD-DIALOPTIONS':util[_0xbe09('0x14')]('\x22rtTxX%s%s\x22',_0x93e0f0[_0xbe09('0x1f')]?'g':'',_[_0xbe09('0x12')](_0x93e0f0[_0xbe09('0x20')])?'':_0xbe09('0x21')),'XMD-DIALURL':_0x93e0f0[_0xbe09('0x22')]||'','XMD-AGI':_0x93e0f0[_0xbe09('0x23')]?util[_0xbe09('0x14')](_0xbe09('0x24'),ipAgi,_0x93e0f0[_0xbe09('0x23')]):_0xbe09('0x25'),'XMD-AGIAFTER':_0x93e0f0[_0xbe09('0x1f')]?util[_0xbe09('0x14')](_0xbe09('0x24'),ipAgi,_0x93e0f0[_0xbe09('0x1f')]):_0xbe09('0x25'),'XMD-ORIGINATECALLERIDNUM':_0x1a5ed6?_0x1a5ed6[_0xbe09('0x26')]:'','XMD-ORIGINATECALLERIDNAME':_0x1a5ed6?_0x1a5ed6['originatecalleridname']:'','XMD-DESTINATION':_0xbe09('0x27'),'SIPADDHEADER':_0xbe09('0x28')};if(!_[_0xbe09('0x12')](_0x93e0f0['monitor_format'])){_0x2b2deb[util['format']('%s','_XCALLY_MIXMONITOR_FORMAT')]=_0x93e0f0[_0xbe09('0x20')];_0x2b2deb[util[_0xbe09('0x14')]('%s',_0xbe09('0x29'))]=_0x1ae6d6;}if(_0x11361e&&_0x11361e[_0xbe09('0x2a')]){for(var _0x30994a in _0x11361e[_0xbe09('0x2a')]){if(_0x11361e['Contact']['hasOwnProperty'](_0x30994a)){if(!_[_0xbe09('0x17')](_0x11361e[_0xbe09('0x2a')][_0x30994a])&&_0x30994a!=='id'&&_0x30994a!==_0xbe09('0x2b')&&_0x30994a!==_0xbe09('0x2c')&&_0x30994a!==_0xbe09('0x2d')){_0x2b2deb[util['format'](_0xbe09('0x2e'),_0xbe09('0x2f'),_[_0xbe09('0x30')](_0x30994a))]=_0x11361e[_0xbe09('0x2a')][_0x30994a];}}}}return _0x2b2deb;};exports[_0xbe09('0x31')]=function(_0x10c3a3){var _0x5e57ff={};for(var _0x15aebb in _0x10c3a3){if(_0x10c3a3['hasOwnProperty'](_0x15aebb)){_0x5e57ff[util[_0xbe09('0x14')]('%s',_[_0xbe09('0x32')](_0x15aebb))]=_0x10c3a3[_0x15aebb];}}return{'variables':_0x5e57ff};};exports[_0xbe09('0x33')]=function(_0x288e7a,_0x236f9f){if(!_[_0xbe09('0x17')](_0x288e7a)){if(_0x288e7a[_0xbe09('0x34')]('originated')){if(_0x288e7a[_0xbe09('0x35')]>0x0){_0x288e7a[_0xbe09('0x35')]-=0x1;}else{logger[_0xbe09('0xc')](_0xbe09('0x36'),_0x236f9f);}}}else{logger['error']('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x236f9f);}};exports[_0xbe09('0x37')]=function(_0x3f75a9){var _0x1d81ff=moment()[_0xbe09('0x14')]('YYYY-MM-DD\x20HH:mm:ss');_0x3f75a9['state']=0xd;_0x3f75a9[_0xbe09('0x38')]=_0xbe09('0x39');_0x3f75a9['starttime']=_0x1d81ff;_0x3f75a9['responsetime']=_0x1d81ff;_0x3f75a9['endtime']=_0x1d81ff;};exports[_0xbe09('0x3a')]=function(_0x27bf29,_0x5cadff,_0xb4adc4){var _0x25c007=moment()[_0xbe09('0x14')](_0xbe09('0x3b'));_0x27bf29['state']=_0x5cadff;_0x27bf29[_0xbe09('0x38')]=_0xb4adc4;_0x27bf29['responsetime']=_0x25c007;_0x27bf29['ringtime']=getSeconds(_0x27bf29[_0xbe09('0x3c')],_0x27bf29[_0xbe09('0x3d')]);};exports[_0xbe09('0x3e')]=function(_0x29483c,_0x101c41,_0x37e01e){_0x29483c[_0xbe09('0x3f')]=_0x101c41;_0x29483c[_0xbe09('0x40')]=_0x37e01e;};exports[_0xbe09('0x41')]=function(_0x3718fe,_0x16fd60,_0x54cd85){var _0x3da98a=moment()['format'](_0xbe09('0x3b'));_0x3718fe['state']=_0x16fd60;_0x3718fe[_0xbe09('0x38')]=_0x54cd85;_0x3718fe['responsetime']=_0x3718fe[_0xbe09('0x3c')]?_0x3718fe[_0xbe09('0x3c')]:_0x3da98a;_0x3718fe[_0xbe09('0x42')]=_0x3718fe[_0xbe09('0x42')]?_0x3718fe[_0xbe09('0x42')]:_0x3da98a;_0x3718fe[_0xbe09('0x43')]=getSeconds(_0x3718fe[_0xbe09('0x3c')]||0x0,_0x3718fe['starttime']||0x0);_0x3718fe[_0xbe09('0x44')]=_0x3718fe[_0xbe09('0x45')]?getSeconds(_0x3718fe[_0xbe09('0x42')],_0x3718fe[_0xbe09('0x45')]):0x0;};exports['isFailure']=function(_0x8e5bfb){return _0x8e5bfb===_0xbe09('0x46');};exports[_0xbe09('0x47')]=function(_0x5a047b,_0x275a5e,_0x582177,_0x40b2d3,_0x4629de){var _0xc3cba5=_0x40b2d3?'RECALL':_0x5a047b['calleridname'];_0xc3cba5=_0x4629de?_0xbe09('0x48'):_0xc3cba5;return{'actionid':_0x5a047b['uniqueid'],'action':'originate','channel':_0x5a047b[_0xbe09('0x49')],'callerid':util[_0xbe09('0x14')](_0xbe09('0x13'),_0xc3cba5,_0x5a047b[_0xbe09('0x1b')]),'Exten':'xcally-motion-preview','Context':_0xbe09('0x4a'),'Priority':'1','variable':_0x582177,'timeout':(_0x275a5e[_0xbe09('0x4b')]||0x1e)*0x3e8,'async':!![],'channelid':_0x5a047b[_0xbe09('0x4c')]};};exports['totalGlobal']=function(_0x35337c){return _0x35337c['countbusyretry']+_0x35337c['countcongestionretry']+_0x35337c['countnoanswerretry']+_0x35337c[_0xbe09('0x4d')]+_0x35337c[_0xbe09('0x4e')];};exports[_0xbe09('0x4f')]=function(_0x2a7592){var _0x1a9391=_['clone'](_0x2a7592);_0x1a9391[_0xbe09('0x50')]=0xf;_0x1a9391['statedesc']=_0xbe09('0x51');return _0x1a9391;};exports[_0xbe09('0x52')]=function(_0x4a4a50,_0x2e4cc8,_0x1090f8){var _0x3dfd70={};_0x3dfd70[_0x2e4cc8]=_0x4a4a50[_0x2e4cc8];_0x3dfd70[_0xbe09('0x53')]=![];_0x3dfd70[_0xbe09('0x54')]=moment()[_0xbe09('0x55')](_0x1090f8,'minutes')[_0xbe09('0x14')](_0xbe09('0x3b'));_0x3dfd70[_0xbe09('0x1c')]=_0x4a4a50[_0xbe09('0x1c')];_0x3dfd70[_0xbe09('0x56')]=_0x4a4a50['ListId'];_0x3dfd70[_0xbe09('0x57')]=_0x4a4a50[_0xbe09('0x57')]||undefined;return _0x3dfd70;};exports['decrementTalkink']=function(_0x1e33f7,_0x1c6ce2){if(!_['isNil'](_0x1e33f7)){if(_0x1e33f7[_0xbe09('0x58')]>0x0){_0x1e33f7[_0xbe09('0x58')]-=0x1;}else{logger[_0xbe09('0xc')](_0x1c6ce2,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger[_0xbe09('0xc')](_0x1c6ce2,_0xbe09('0x59'));}};exports[_0xbe09('0x5a')]=function(_0x352fdc){if(_0x352fdc<=0x0){return!![];}return![];};exports[_0xbe09('0x5b')]=function(_0x1b7f4c,_0x356b09,_0x15fd03){_0x1b7f4c['lastevent']=_0x356b09;_0x1b7f4c[_0xbe09('0x19')]=_0x1b7f4c[_0xbe09('0x5c')];_0x1b7f4c[_0xbe09('0x5d')]=_0x1b7f4c[_0xbe09('0x49')];_0x1b7f4c[_0xbe09('0x5e')]=_0xbe09('0x5f');if(_0x15fd03){_0x1b7f4c[_0xbe09('0x60')]=_0x15fd03[_0xbe09('0x60')];}return _0x1b7f4c;};exports['buildAcw']=function(_0x159703){var _0x23493f={};_0x23493f['queue']=_0x159703[_0xbe09('0x5c')];_0x23493f[_0xbe09('0x5d')]=_0x159703[_0xbe09('0x49')];_0x23493f[_0xbe09('0x4c')]=_0x159703[_0xbe09('0x4c')];return _0x23493f;};exports['agentReadyId']=function(_0x4b0394){var _0x55761a=[];for(var _0x570851 in _0x4b0394){if(_0x4b0394['hasOwnProperty'](_0x570851)){if(!_[_0xbe09('0x17')](_0x4b0394[_0x570851])&&_0x4b0394[_0x570851][_0xbe09('0x50')]==='not_inuse'&&_0x4b0394[_0x570851][_0xbe09('0x61')]===_0xbe09('0x62')){_0x55761a[_0xbe09('0x63')](_0x4b0394[_0x570851]['id']);}}}return _0x55761a;};exports['getDiff']=function(_0x108ba5){var _0x2c2f66=moment()['milliseconds'](0x0);var _0x24e708=moment(_0x108ba5)[_0xbe09('0x6')](0x0);return _0x2c2f66[_0xbe09('0x64')](_0x24e708,_0xbe09('0x7'));};exports['createBody']=function(_0x1c02e7){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x1c02e7[_0xbe09('0x1c')],'ListId':_0x1c02e7[_0xbe09('0x56')],'VoiceQueueId':_0x1c02e7[_0xbe09('0x57')]||undefined,'CampaignId':_0x1c02e7[_0xbe09('0x65')]||undefined};};exports[_0xbe09('0x66')]=function(_0x127afb){if(_0x127afb===_0xbe09('0x4c')||_0x127afb===_0xbe09('0x67')||_0x127afb===_0xbe09('0x5c')||_0x127afb===_0xbe09('0x68')||_0x127afb===_0xbe09('0x69')||_0x127afb===_0xbe09('0x6a')||_0x127afb==='membername'||_0x127afb===_0xbe09('0x49')||_0x127afb===_0xbe09('0x1a')||_0x127afb==='active'||_0x127afb===_0xbe09('0x1b')||_0x127afb==='scheduledat'||_0x127afb===_0xbe09('0x6b')||_0x127afb==='countcongestionretry'||_0x127afb===_0xbe09('0x6c')||_0x127afb===_0xbe09('0x6d')||_0x127afb===_0xbe09('0x6e')||_0x127afb===_0xbe09('0x6f')||_0x127afb==='callbackat'||_0x127afb==='recallme'||_0x127afb==='ContactId'||_0x127afb===_0xbe09('0x56')||_0x127afb===_0xbe09('0x40')||_0x127afb===_0xbe09('0x57')||_0x127afb===_0xbe09('0x70')||_0x127afb===_0xbe09('0x71')||_0x127afb===_0xbe09('0x72')||_0x127afb===_0xbe09('0x73')||_0x127afb==='xmd-listid'||_0x127afb===_0xbe09('0x74')||_0x127afb===_0xbe09('0x75')||_0x127afb===_0xbe09('0x76')||_0x127afb===_0xbe09('0x77')||_0x127afb===_0xbe09('0x78')||_0x127afb===_0xbe09('0x79')||_0x127afb==='xmd-cdrtype'||_0x127afb===_0xbe09('0x7a')||_0x127afb===_0xbe09('0x7b')||_0x127afb==='xmd-agi'||_0x127afb==='rtpaudioqos'||_0x127afb===_0xbe09('0x7c')||_0x127afb==='rtpaudioqosjitter'||_0x127afb===_0xbe09('0x7d')||_0x127afb===_0xbe09('0x7e')||_0x127afb===_0xbe09('0x7f')||_0x127afb===_0xbe09('0x80')||_0x127afb===_0xbe09('0x81')||_0x127afb===_0xbe09('0x82')||_0x127afb===_0xbe09('0x7c')||_0x127afb===_0xbe09('0x83')||_0x127afb===_0xbe09('0x7d')||_0x127afb===_0xbe09('0x7e')||_0x127afb==='rtpaudioqoslossbridged'||_0x127afb===_0xbe09('0x80')||_0x127afb===_0xbe09('0x81')||_0x127afb===_0xbe09('0x84')||_0x127afb===_0xbe09('0x85')||_0x127afb===_0xbe09('0x50')||_0x127afb==='statedesc'){return![];}return!![];};exports[_0xbe09('0x86')]=function(_0x329f42,_0x223f44){var _0x4f577d,_0x480c08,_0x30f37d;if(_0x223f44<=0x0){_0x223f44=0x1;}_0x4f577d=new RegExp(_0xbe09('0x87')+_0x223f44+'}$');_0x480c08=Math[_0xbe09('0x88')](0xa,_0x223f44-0x1);_0x30f37d=Math['pow'](0xa,_0x223f44)-0x1;return util[_0xbe09('0x14')]('%s',_[_0xbe09('0x89')](_0x329f42,_0x4f577d,_[_0xbe09('0x8a')](_0x480c08,_0x30f37d)));};exports['extractCalleridName']=function(_0x457b81){var _0x4dac9c=_0x457b81[_0xbe09('0x8b')](/"(.*?)"/);return _0x4dac9c?_0x4dac9c[0x1]:_0x457b81;};exports[_0xbe09('0x8c')]=function(_0x29e979){var _0x4a6763=_0x29e979[_0xbe09('0x8b')](/<(.*?)>/);return _0x4a6763?_0x4a6763[0x1]:_0x29e979;}; \ No newline at end of file +var _0xb39b=['util','lodash','moment','preview','127.0.0.1','milliseconds','loggerCatch','error','inspect','logger','info','logger2','message','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','addVariables','Queue','name','calleridname','calleridnum','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','isNil','tags','createdAt','updatedAt','%s%s','XMD-','toUpper','toLowerVariables','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','starttime','responsetime','endtime','logAgent','ringtime','logCustomer','talktime','answertime','isFailure','Failure','RECALL','BOOKED','uniqueid','originate','channelAgent','xcally-motion-preview','from-sip','timeout','countbusyretry','countcongestionretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','scheduledAt','active','scheduledat','add','minutes','ContactId','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','lastevent','interface','motionChannel','voice','mandatoryDisposition','buildAcw','queue','agentReadyId','not_inuse','status','push','getDiff','diff','seconds','createBody','CampaignId','idContact','type','membername','countnoanswerretry','countglobal','callback','callbackat','recallme','UserId','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','replace','match','extractCalleridNumber'];(function(_0x4226d6,_0x3864ca){var _0x19655b=function(_0x1d43a1){while(--_0x1d43a1){_0x4226d6['push'](_0x4226d6['shift']());}};_0x19655b(++_0x3864ca);}(_0xb39b,0x95));var _0xbb39=function(_0x4acb13,_0x237923){_0x4acb13=_0x4acb13-0x0;var _0x4f4025=_0xb39b[_0x4acb13];return _0x4f4025;};'use strict';var util=require(_0xbb39('0x0'));var _=require(_0xbb39('0x1'));var moment=require(_0xbb39('0x2'));var logger=require('../../../../config/logger')(_0xbb39('0x3'));var ipAgi=process['env']['XCALLY_IP_AGI']||_0xbb39('0x4');function getSeconds(_0x18f615,_0x3bc983){var _0x218d7c=moment(_0x18f615)[_0xbb39('0x5')](0x0);var _0x428883=moment(_0x3bc983)[_0xbb39('0x5')](0x0);return _0x218d7c['diff'](_0x428883,'seconds');}exports[_0xbb39('0x6')]=function(_0x57da5a){return function(_0x3c6491){logger[_0xbb39('0x7')](_0x57da5a,util[_0xbb39('0x8')](_0x3c6491,{'showHidden':![],'depth':null}));};};exports[_0xbb39('0x9')]=function(_0x4f009e,_0x50f8d4){logger[_0xbb39('0xa')](_0x4f009e,util[_0xbb39('0x8')](_0x50f8d4,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x3f324e,_0x1dfb24){logger['error'](_0x3f324e,util[_0xbb39('0x8')](_0x1dfb24,{'showHidden':![],'depth':null}));};exports[_0xbb39('0xb')]=function(_0x2f432e){return function(_0x1a56da){logger[_0xbb39('0xa')](_0x2f432e,util[_0xbb39('0x8')](_0x1a56da,{'showHidden':![],'depth':null}));};};exports[_0xbb39('0xc')]=function(_0x3b39cf,_0x73c127,_0x301b9f){return{'message':_0x3b39cf,'unlock':_0x73c127,'active':_0x301b9f};};exports[_0xbb39('0xd')]=function(_0x34e08e,_0x450533,_0x1f06f4){if(!_[_0xbb39('0xe')](_0x1f06f4)&&_0xbb39('0xf')===typeof _0x1f06f4&&!_[_0xbb39('0x10')](_0x1f06f4)){if(!_[_0xbb39('0xe')](_0x450533)&&_0xbb39('0xf')===typeof _0x450533&&!_[_0xbb39('0x10')](_0x450533)){return util[_0xbb39('0x11')]('\x22%s\x22\x20<%s>',_0x450533,_0x1f06f4);}return util['format'](_0xbb39('0x12'),_0x1f06f4,_0x1f06f4);}if(!_['isUndefined'](_0x34e08e)&&_0xbb39('0xf')===typeof _0x34e08e&&!_[_0xbb39('0x10')](_0x34e08e)){return _0x34e08e;}return _0xbb39('0x13');};exports[_0xbb39('0x14')]=function(_0x40e1fc){if(_['isNil'](_0x40e1fc)){return![];}return _0x40e1fc;};exports[_0xbb39('0x15')]=function(_0x52aa43,_0x5511f8,_0x2f7adf,_0x4da8a8,_0x39b999,_0x3e81f2){var _0x3ccb92={'XMD-QUEUE':_0x5511f8[_0xbb39('0x16')]?_0x5511f8[_0xbb39('0x16')][_0xbb39('0x17')]:'','XMD-CALLERID':_0x4da8a8,'XMD-CALLERID-PREVIEW':_0x3e81f2?util[_0xbb39('0x11')]('\x22%s\x22\x20<%s>',_0x3e81f2[_0xbb39('0x18')],_0x3e81f2[_0xbb39('0x19')]):_0x4da8a8,'XMD-DIALID':_0x39b999,'XMD-CONTACTID':_0x5511f8['ContactId'],'XMD-CDRTYPE':_0xbb39('0x1a'),'CALLERID(all)':_0x4da8a8,'XMD-VOICEQUEUEID':_0x5511f8[_0xbb39('0x1b')],'XMD-DIALCHANNEL':_0x2f7adf,'XMD-DIALTIMEOUT':_0x52aa43[_0xbb39('0x1c')]||0x1e,'XMD-DIALOPTIONS':util[_0xbb39('0x11')](_0xbb39('0x1d'),_0x52aa43[_0xbb39('0x1e')]?'g':'',_[_0xbb39('0x10')](_0x52aa43[_0xbb39('0x1f')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x52aa43[_0xbb39('0x20')]||'','XMD-AGI':_0x52aa43[_0xbb39('0x21')]?util['format'](_0xbb39('0x22'),ipAgi,_0x52aa43['dialQueueProject']):_0xbb39('0x23'),'XMD-AGIAFTER':_0x52aa43[_0xbb39('0x1e')]?util[_0xbb39('0x11')](_0xbb39('0x22'),ipAgi,_0x52aa43[_0xbb39('0x1e')]):_0xbb39('0x23'),'XMD-ORIGINATECALLERIDNUM':_0x3e81f2?_0x3e81f2[_0xbb39('0x24')]:'','XMD-ORIGINATECALLERIDNAME':_0x3e81f2?_0x3e81f2[_0xbb39('0x25')]:'','XMD-DESTINATION':'xcally-motion-preview','SIPADDHEADER':'Call-Type:\x20PREVIEW'};if(!_[_0xbb39('0x10')](_0x52aa43['monitor_format'])){_0x3ccb92[util[_0xbb39('0x11')]('%s',_0xbb39('0x26'))]=_0x52aa43[_0xbb39('0x1f')];_0x3ccb92[util['format']('%s',_0xbb39('0x27'))]=_0x39b999;}if(_0x5511f8&&_0x5511f8[_0xbb39('0x28')]){for(var _0x497c10 in _0x5511f8[_0xbb39('0x28')]){if(_0x5511f8[_0xbb39('0x28')][_0xbb39('0x29')](_0x497c10)){if(!_[_0xbb39('0x2a')](_0x5511f8[_0xbb39('0x28')][_0x497c10])&&_0x497c10!=='id'&&_0x497c10!==_0xbb39('0x2b')&&_0x497c10!==_0xbb39('0x2c')&&_0x497c10!==_0xbb39('0x2d')){_0x3ccb92[util[_0xbb39('0x11')](_0xbb39('0x2e'),_0xbb39('0x2f'),_[_0xbb39('0x30')](_0x497c10))]=_0x5511f8[_0xbb39('0x28')][_0x497c10];}}}}return _0x3ccb92;};exports[_0xbb39('0x31')]=function(_0x15e200){var _0x48a41d={};for(var _0x401d9f in _0x15e200){if(_0x15e200[_0xbb39('0x29')](_0x401d9f)){_0x48a41d[util[_0xbb39('0x11')]('%s',_[_0xbb39('0x32')](_0x401d9f))]=_0x15e200[_0x401d9f];}}return{'variables':_0x48a41d};};exports[_0xbb39('0x33')]=function(_0x52d020,_0x50afa5){if(!_[_0xbb39('0x2a')](_0x52d020)){if(_0x52d020[_0xbb39('0x29')](_0xbb39('0x34'))){if(_0x52d020[_0xbb39('0x34')]>0x0){_0x52d020[_0xbb39('0x34')]-=0x1;}else{logger[_0xbb39('0x7')](_0xbb39('0x35'),_0x50afa5);}}}else{logger['error'](_0xbb39('0x36'),_0x50afa5);}};exports[_0xbb39('0x37')]=function(_0x46bd94){var _0x279215=moment()[_0xbb39('0x11')](_0xbb39('0x38'));_0x46bd94[_0xbb39('0x39')]=0xd;_0x46bd94[_0xbb39('0x3a')]=_0xbb39('0x3b');_0x46bd94[_0xbb39('0x3c')]=_0x279215;_0x46bd94[_0xbb39('0x3d')]=_0x279215;_0x46bd94[_0xbb39('0x3e')]=_0x279215;};exports[_0xbb39('0x3f')]=function(_0x2f2d81,_0x394c6d,_0x10d4cf){var _0x2709e2=moment()[_0xbb39('0x11')](_0xbb39('0x38'));_0x2f2d81[_0xbb39('0x39')]=_0x394c6d;_0x2f2d81[_0xbb39('0x3a')]=_0x10d4cf;_0x2f2d81[_0xbb39('0x3d')]=_0x2709e2;_0x2f2d81[_0xbb39('0x40')]=getSeconds(_0x2f2d81['responsetime'],_0x2f2d81[_0xbb39('0x3c')]);};exports['logLookAgent']=function(_0x104ce8,_0x45afdd,_0x5e8066){_0x104ce8['membername']=_0x45afdd;_0x104ce8['UserId']=_0x5e8066;};exports[_0xbb39('0x41')]=function(_0x566981,_0x4331b7,_0x29cd37){var _0x2f5f56=moment()[_0xbb39('0x11')](_0xbb39('0x38'));_0x566981[_0xbb39('0x39')]=_0x4331b7;_0x566981['statedesc']=_0x29cd37;_0x566981['responsetime']=_0x566981[_0xbb39('0x3d')]?_0x566981['responsetime']:_0x2f5f56;_0x566981[_0xbb39('0x3e')]=_0x566981[_0xbb39('0x3e')]?_0x566981[_0xbb39('0x3e')]:_0x2f5f56;_0x566981[_0xbb39('0x40')]=getSeconds(_0x566981[_0xbb39('0x3d')]||0x0,_0x566981[_0xbb39('0x3c')]||0x0);_0x566981[_0xbb39('0x42')]=_0x566981['answertime']?getSeconds(_0x566981[_0xbb39('0x3e')],_0x566981[_0xbb39('0x43')]):0x0;};exports[_0xbb39('0x44')]=function(_0x52cbf5){return _0x52cbf5===_0xbb39('0x45');};exports['variablesAction']=function(_0xc271ae,_0x36e1f5,_0x1bf136,_0x3e9abd,_0x1695dc){var _0x193689=_0x3e9abd?_0xbb39('0x46'):_0xc271ae[_0xbb39('0x18')];_0x193689=_0x1695dc?_0xbb39('0x47'):_0x193689;return{'actionid':_0xc271ae[_0xbb39('0x48')],'action':_0xbb39('0x49'),'channel':_0xc271ae[_0xbb39('0x4a')],'callerid':util[_0xbb39('0x11')](_0xbb39('0x12'),_0x193689,_0xc271ae['calleridnum']),'Exten':_0xbb39('0x4b'),'Context':_0xbb39('0x4c'),'Priority':'1','variable':_0x1bf136,'timeout':(_0x36e1f5[_0xbb39('0x4d')]||0x1e)*0x3e8,'async':!![],'channelid':_0xc271ae['uniqueid']};};exports['totalGlobal']=function(_0x426ac4){return _0x426ac4[_0xbb39('0x4e')]+_0x426ac4[_0xbb39('0x4f')]+_0x426ac4['countnoanswerretry']+_0x426ac4[_0xbb39('0x50')]+_0x426ac4[_0xbb39('0x51')];};exports[_0xbb39('0x52')]=function(_0x36140e){var _0x31761a=_[_0xbb39('0x53')](_0x36140e);_0x31761a[_0xbb39('0x39')]=0xf;_0x31761a[_0xbb39('0x3a')]='Global';return _0x31761a;};exports[_0xbb39('0x54')]=function(_0x138297,_0x448fe7,_0x58dbfd){var _0x19bcdb={};_0x19bcdb[_0x448fe7]=_0x138297[_0x448fe7];_0x19bcdb[_0xbb39('0x55')]=![];_0x19bcdb[_0xbb39('0x56')]=moment()[_0xbb39('0x57')](_0x58dbfd,_0xbb39('0x58'))[_0xbb39('0x11')](_0xbb39('0x38'));_0x19bcdb[_0xbb39('0x59')]=_0x138297[_0xbb39('0x59')];_0x19bcdb[_0xbb39('0x5a')]=_0x138297[_0xbb39('0x5a')];_0x19bcdb['VoiceQueueId']=_0x138297['VoiceQueueId']||undefined;return _0x19bcdb;};exports[_0xbb39('0x5b')]=function(_0x1bca4e,_0x582653){if(!_[_0xbb39('0x2a')](_0x1bca4e)){if(_0x1bca4e[_0xbb39('0x5c')]>0x0){_0x1bca4e['pTalking']-=0x1;}else{logger['error'](_0x582653,_0xbb39('0x5d'));}}else{logger['error'](_0x582653,_0xbb39('0x5e'));}};exports[_0xbb39('0x5f')]=function(_0x339789){if(_0x339789<=0x0){return!![];}return![];};exports['buildObj']=function(_0xfa2e9b,_0x304089,_0x43e600){_0xfa2e9b[_0xbb39('0x60')]=_0x304089;_0xfa2e9b[_0xbb39('0x17')]=_0xfa2e9b['queue'];_0xfa2e9b[_0xbb39('0x61')]=_0xfa2e9b['channelAgent'];_0xfa2e9b[_0xbb39('0x62')]=_0xbb39('0x63');if(_0x43e600){_0xfa2e9b[_0xbb39('0x64')]=_0x43e600['mandatoryDisposition'];}return _0xfa2e9b;};exports[_0xbb39('0x65')]=function(_0x4b82b0){var _0x4fdf18={};_0x4fdf18[_0xbb39('0x66')]=_0x4b82b0['queue'];_0x4fdf18[_0xbb39('0x61')]=_0x4b82b0[_0xbb39('0x4a')];_0x4fdf18[_0xbb39('0x48')]=_0x4b82b0[_0xbb39('0x48')];return _0x4fdf18;};exports[_0xbb39('0x67')]=function(_0x110429){var _0x40e71f=[];for(var _0x5c5aa0 in _0x110429){if(_0x110429[_0xbb39('0x29')](_0x5c5aa0)){if(!_[_0xbb39('0x2a')](_0x110429[_0x5c5aa0])&&_0x110429[_0x5c5aa0]['state']===_0xbb39('0x68')&&_0x110429[_0x5c5aa0][_0xbb39('0x69')]==='reachable'){_0x40e71f[_0xbb39('0x6a')](_0x110429[_0x5c5aa0]['id']);}}}return _0x40e71f;};exports[_0xbb39('0x6b')]=function(_0x47d8c0){var _0x402b19=moment()[_0xbb39('0x5')](0x0);var _0x5b8f6a=moment(_0x47d8c0)[_0xbb39('0x5')](0x0);return _0x402b19[_0xbb39('0x6c')](_0x5b8f6a,_0xbb39('0x6d'));};exports[_0xbb39('0x6e')]=function(_0x34113d){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x34113d[_0xbb39('0x59')],'ListId':_0x34113d[_0xbb39('0x5a')],'VoiceQueueId':_0x34113d[_0xbb39('0x1b')]||undefined,'CampaignId':_0x34113d[_0xbb39('0x6f')]||undefined};};exports['filterKey']=function(_0x267517){if(_0x267517===_0xbb39('0x48')||_0x267517===_0xbb39('0x70')||_0x267517===_0xbb39('0x66')||_0x267517===_0xbb39('0x71')||_0x267517==='campaigntype'||_0x267517==='dialAnswer'||_0x267517===_0xbb39('0x72')||_0x267517===_0xbb39('0x4a')||_0x267517===_0xbb39('0x18')||_0x267517===_0xbb39('0x55')||_0x267517===_0xbb39('0x19')||_0x267517==='scheduledat'||_0x267517===_0xbb39('0x4e')||_0x267517===_0xbb39('0x4f')||_0x267517===_0xbb39('0x73')||_0x267517===_0xbb39('0x74')||_0x267517===_0xbb39('0x75')||_0x267517==='callbackuniqueid'||_0x267517===_0xbb39('0x76')||_0x267517===_0xbb39('0x77')||_0x267517===_0xbb39('0x59')||_0x267517===_0xbb39('0x5a')||_0x267517===_0xbb39('0x78')||_0x267517===_0xbb39('0x1b')||_0x267517===_0xbb39('0x79')||_0x267517===_0xbb39('0x7a')||_0x267517===_0xbb39('0x7b')||_0x267517===_0xbb39('0x7c')||_0x267517===_0xbb39('0x7d')||_0x267517==='xmd-dialurl'||_0x267517===_0xbb39('0x7e')||_0x267517===_0xbb39('0x7f')||_0x267517===_0xbb39('0x80')||_0x267517===_0xbb39('0x81')||_0x267517===_0xbb39('0x82')||_0x267517===_0xbb39('0x83')||_0x267517===_0xbb39('0x84')||_0x267517===_0xbb39('0x85')||_0x267517===_0xbb39('0x86')||_0x267517===_0xbb39('0x87')||_0x267517===_0xbb39('0x88')||_0x267517===_0xbb39('0x89')||_0x267517===_0xbb39('0x8a')||_0x267517===_0xbb39('0x8b')||_0x267517===_0xbb39('0x8c')||_0x267517===_0xbb39('0x8d')||_0x267517===_0xbb39('0x8e')||_0x267517===_0xbb39('0x87')||_0x267517==='rtpaudioqosbridged'||_0x267517===_0xbb39('0x89')||_0x267517==='rtpaudioqosjitterbridged'||_0x267517==='rtpaudioqosloss'||_0x267517===_0xbb39('0x8c')||_0x267517===_0xbb39('0x8d')||_0x267517===_0xbb39('0x8e')||_0x267517==='bridgepeer'||_0x267517===_0xbb39('0x8f')||_0x267517===_0xbb39('0x39')||_0x267517==='statedesc'){return![];}return!![];};exports[_0xbb39('0x90')]=function(_0x9bf35d,_0x33f270){var _0x1f6cd7,_0x422049,_0x5d1060;if(_0x33f270<=0x0){_0x33f270=0x1;}_0x1f6cd7=new RegExp(_0xbb39('0x91')+_0x33f270+'}$');_0x422049=Math['pow'](0xa,_0x33f270-0x1);_0x5d1060=Math['pow'](0xa,_0x33f270)-0x1;return util[_0xbb39('0x11')]('%s',_[_0xbb39('0x92')](_0x9bf35d,_0x1f6cd7,_['random'](_0x422049,_0x5d1060)));};exports['extractCalleridName']=function(_0x28c789){var _0x437e77=_0x28c789[_0xbb39('0x93')](/"(.*?)"/);return _0x437e77?_0x437e77[0x1]:_0x28c789;};exports[_0xbb39('0x94')]=function(_0x49f4b3){var _0x516c0d=_0x49f4b3[_0xbb39('0x93')](/<(.*?)>/);return _0x516c0d?_0x516c0d[0x1]:_0x49f4b3;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 63278ab..dd23ba0 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 _0x6ed3=['voicequeuechannelredirect','queueadd','string','number','queueremove','queuepause','boolean','reload','voicequeuechannel','voicechannel'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6ed3,0x155));var _0x36ed=function(_0x20a089,_0x158776){_0x20a089=_0x20a089-0x0;var _0x4521e9=_0x6ed3[_0x20a089];return _0x4521e9;};'use strict';exports[_0x36ed('0x0')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0x36ed('0x1'),'required':!![]},'membername':{'type':_0x36ed('0x1'),'required':!![]},'penalty':{'type':_0x36ed('0x2'),'required':![]},'paused':{'type':'boolean','required':![]}};exports[_0x36ed('0x3')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0x36ed('0x1'),'required':!![]}};exports[_0x36ed('0x4')]={'interface':{'type':_0x36ed('0x1'),'required':!![]},'paused':{'type':_0x36ed('0x5')},'reason':{'type':_0x36ed('0x1'),'required':![]}};exports[_0x36ed('0x6')]={'module':{'type':_0x36ed('0x1'),'required':![]}};exports[_0x36ed('0x7')]={'uniqueid':{'type':'string','required':!![]}};exports[_0x36ed('0x8')]={'uniqueid':{'type':_0x36ed('0x1'),'required':!![]},'filename':{'type':_0x36ed('0x1')},'format':{'type':_0x36ed('0x1')},'mixmonitorid':{'type':_0x36ed('0x1')}};exports['voicequeuechannelhangup']={'uniqueid':{'type':_0x36ed('0x1'),'required':!![]}};exports[_0x36ed('0x9')]={'uniqueid':{'type':_0x36ed('0x1'),'required':!![]},'exten':{'type':_0x36ed('0x1'),'required':!![]},'context':{'type':'string'}}; \ No newline at end of file +var _0x7b3d=['boolean','queuepause','voicequeuechannel','voicechannel','voicequeuechannelhangup','queueadd','string','number'];(function(_0x493720,_0x2e7724){var _0x3cfc8e=function(_0x1ceb74){while(--_0x1ceb74){_0x493720['push'](_0x493720['shift']());}};_0x3cfc8e(++_0x2e7724);}(_0x7b3d,0x135));var _0xd7b3=function(_0x1e0b32,_0x33bf0e){_0x1e0b32=_0x1e0b32-0x0;var _0x880682=_0x7b3d[_0x1e0b32];return _0x880682;};'use strict';exports[_0xd7b3('0x0')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0xd7b3('0x1'),'required':!![]},'membername':{'type':'string','required':!![]},'penalty':{'type':_0xd7b3('0x2'),'required':![]},'paused':{'type':_0xd7b3('0x3'),'required':![]}};exports['queueremove']={'queue':{'type':_0xd7b3('0x1'),'required':!![]},'interface':{'type':'string','required':!![]}};exports[_0xd7b3('0x4')]={'interface':{'type':_0xd7b3('0x1'),'required':!![]},'paused':{'type':_0xd7b3('0x3')},'reason':{'type':_0xd7b3('0x1'),'required':![]}};exports['reload']={'module':{'type':_0xd7b3('0x1'),'required':![]}};exports[_0xd7b3('0x5')]={'uniqueid':{'type':_0xd7b3('0x1'),'required':!![]}};exports[_0xd7b3('0x6')]={'uniqueid':{'type':'string','required':!![]},'filename':{'type':'string'},'format':{'type':_0xd7b3('0x1')},'mixmonitorid':{'type':_0xd7b3('0x1')}};exports[_0xd7b3('0x7')]={'uniqueid':{'type':_0xd7b3('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0xd7b3('0x1'),'required':!![]},'exten':{'type':_0xd7b3('0x1'),'required':!![]},'context':{'type':_0xd7b3('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 9469f6f..2dce7b0 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 _0x7a49=['format','SIP/%s','name','isNil','interface','total','answered','sumHoldTime','sumDuration','ivrTotalCallsDays','isEmpty','abandoned','sumBillable','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','initAgents','isUndefined','initTelephones','length','initTrunks','initVoiceQueues','voiceQueues','initTriggers','initTemplates','initZendeskAccounts','initSalesforceAccounts','initZohoAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','servicenowAccounts','initDynamics365Accounts','dynamics365Accounts','initFreshsalesAccounts','merge','initVoiceQueueReports','groupBy','unmanaged','queuecallerabandon','queuecallerjoinAt','queuecallercompleteAt','queuecallerexitAt','seconds','queuecallercomplete','queuecallerleaveAt','initVoiceCallReports','duration','disposition','ANSWERED','billableseconds','initCampaigns','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','initFaxAccounts','exports','util','lodash','moment','../model/agent','../model/trunk','../model/trigger','../model/template','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/dynamics365Account','../model/faxAccount','agents','telephones','trunks','triggers','campaigns','templates','outbound','voiceExtensions','channels','queueChannels','settings','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7a49,0xaf));var _0x97a4=function(_0x4b3716,_0x4d4700){_0x4b3716=_0x4b3716-0x0;var _0x20a06a=_0x7a49[_0x4b3716];return _0x20a06a;};'use strict';var BPromise=require('bluebird');var util=require(_0x97a4('0x0'));var _=require(_0x97a4('0x1'));var moment=require(_0x97a4('0x2'));var Agent=require(_0x97a4('0x3'));var Telephone=require('../model/telephone');var Trunk=require(_0x97a4('0x4'));var VoiceQueue=require('../model/voiceQueue');var Trigger=require(_0x97a4('0x5'));var Template=require(_0x97a4('0x6'));var Campaign=require('../model/campaign');var VoiceExtension=require(_0x97a4('0x7'));var ZendeskAccount=require(_0x97a4('0x8'));var SalesforceAccount=require(_0x97a4('0x9'));var FreshdeskAccount=require(_0x97a4('0xa'));var SugarcrmAccount=require(_0x97a4('0xb'));var ZohoAccount=require(_0x97a4('0xc'));var DeskAccount=require(_0x97a4('0xd'));var VtigerAccount=require(_0x97a4('0xe'));var ServicenowAccount=require('../model/servicenowAccount');var Dynamics365Account=require(_0x97a4('0xf'));var FreshsalesAccount=require('../model/freshsalesAccount');var FaxAccount=require(_0x97a4('0x10'));var Realtime=function(){this[_0x97a4('0x11')]={};this[_0x97a4('0x12')]={};this[_0x97a4('0x13')]={};this['voiceQueues']={};this[_0x97a4('0x14')]={};this[_0x97a4('0x15')]={};this[_0x97a4('0x16')]={};this[_0x97a4('0x17')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x97a4('0x18')]={};this[_0x97a4('0x19')]={};this[_0x97a4('0x1a')]={};this['outboundChannels']={};this['timers']={};this[_0x97a4('0x1b')]={};this[_0x97a4('0x1c')]={};this[_0x97a4('0x1d')]={};this[_0x97a4('0x1e')]={};this[_0x97a4('0x1f')]={};this[_0x97a4('0x20')]={};this[_0x97a4('0x21')]={};this[_0x97a4('0x22')]={};this['servicenowAccounts']={};this['dynamics365Accounts']={};this[_0x97a4('0x23')]={};this[_0x97a4('0x24')]={};};function freeIsNotKey(_0x2987b2,_0x1b4ffe,_0x1f950c){var _0x4091b3=_[_0x97a4('0x25')](_0x2987b2,function(_0x52d4e2,_0x14d98b){return _0x52d4e2[_0x1f950c];});for(var _0x2c2abc in _0x1b4ffe){if(_0x1b4ffe[_0x97a4('0x26')](_0x2c2abc)){if(!_0x4091b3[_0x2c2abc]){delete _0x1b4ffe[_0x2c2abc];}}}}function freeIsNotKeySip(_0x15740e,_0x521b72){var _0x185f07=_[_0x97a4('0x25')](_0x15740e,function(_0x3ba88f,_0x370a51){return util[_0x97a4('0x27')](_0x97a4('0x28'),_0x3ba88f[_0x97a4('0x29')]);});for(var _0x247124 in _0x521b72){if(_0x521b72[_0x97a4('0x26')](_0x247124)){if(!_0x185f07[_0x247124]){delete _0x521b72[_0x247124];}}}}function freeIsNotKeyAgent(_0x4a6c52,_0x90d7a){var _0x245f42=_[_0x97a4('0x25')](_0x4a6c52,function(_0x386f94,_0x35c784){var _0x1c2f88=_[_0x97a4('0x2a')](_0x386f94[_0x97a4('0x2b')])?util[_0x97a4('0x27')](_0x97a4('0x28'),_0x386f94[_0x97a4('0x29')]):_0x386f94[_0x97a4('0x2b')];return _0x1c2f88;});for(var _0x536a08 in _0x90d7a){if(_0x90d7a[_0x97a4('0x26')](_0x536a08)){if(!_0x245f42[_0x536a08]){delete _0x90d7a[_0x536a08];}}}}function clearVoiceCallReports(_0x4fcb3c){_0x4fcb3c[_0x97a4('0x2c')]=0x0;_0x4fcb3c[_0x97a4('0x2d')]=0x0;_0x4fcb3c[_0x97a4('0x2e')]=0x0;_0x4fcb3c[_0x97a4('0x2f')]=0x0;_0x4fcb3c['sumBillable']=0x0;}function clearCampaigns(_0x11c1be){if(!_['isEmpty'](_0x11c1be)){for(var _0x227083 in _0x11c1be){if(_0x11c1be[_0x97a4('0x26')](_0x227083)){_0x11c1be[_0x227083][_0x97a4('0x30')]=0x0;_0x11c1be[_0x227083]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0x5e0895){if(!_[_0x97a4('0x31')](_0x5e0895)){for(var _0x35d028 in _0x5e0895){if(_0x5e0895[_0x97a4('0x26')](_0x35d028)){_0x5e0895[_0x35d028][_0x97a4('0x2c')]=0x0;_0x5e0895[_0x35d028][_0x97a4('0x2d')]=0x0;_0x5e0895[_0x35d028]['unmanaged']=0x0;_0x5e0895[_0x35d028][_0x97a4('0x32')]=0x0;_0x5e0895[_0x35d028]['sumHoldTime']=0x0;_0x5e0895[_0x35d028][_0x97a4('0x2f')]=0x0;_0x5e0895[_0x35d028][_0x97a4('0x33')]=0x0;_0x5e0895[_0x35d028][_0x97a4('0x34')]=0x0;_0x5e0895[_0x35d028][_0x97a4('0x35')]=0x0;_0x5e0895[_0x35d028]['outboundBusyCallsDay']=0x0;_0x5e0895[_0x35d028][_0x97a4('0x36')]=0x0;_0x5e0895[_0x35d028][_0x97a4('0x37')]=0x0;_0x5e0895[_0x35d028][_0x97a4('0x38')]=0x0;_0x5e0895[_0x35d028]['outboundDropCallsDayTimeout']=0x0;_0x5e0895[_0x35d028][_0x97a4('0x39')]=0x0;_0x5e0895[_0x35d028][_0x97a4('0x3a')]=0x0;_0x5e0895[_0x35d028][_0x97a4('0x3b')]=0x0;_0x5e0895[_0x35d028][_0x97a4('0x3c')]=0x0;_0x5e0895[_0x35d028]['outboundReCallsDay']=0x0;_0x5e0895[_0x35d028][_0x97a4('0x34')]=0x0;_0x5e0895[_0x35d028][_0x97a4('0x3d')]=0x0;_0x5e0895[_0x35d028][_0x97a4('0x3e')]=!![];}}}}Realtime[_0x97a4('0x3f')][_0x97a4('0x40')]=function(_0x197b83,_0x1b9cb3){for(var _0x569327 in _0x1b9cb3){if(_0x197b83[_0x97a4('0x26')](_0x569327)){_0x197b83[_0x569327]=_0x1b9cb3[_0x569327];}}};Realtime['prototype'][_0x97a4('0x41')]=function(){var _0x2d1323=this;return function(_0x5899d7){if(_0x5899d7){freeIsNotKeyAgent(_0x5899d7,_0x2d1323[_0x97a4('0x11')]);for(var _0x24d9b1=0x0,_0x39a3fc={},_0x5e18df={};_0x24d9b1<_0x5899d7['length'];_0x24d9b1+=0x1){_0x39a3fc=_0x5899d7[_0x24d9b1];var _0x21b2a8=_['isNil'](_0x39a3fc[_0x97a4('0x2b')])?util[_0x97a4('0x27')](_0x97a4('0x28'),_0x39a3fc['name']):_0x39a3fc[_0x97a4('0x2b')];if(_[_0x97a4('0x42')](_0x2d1323[_0x97a4('0x11')][_0x21b2a8])){_0x2d1323['agents'][_0x21b2a8]=new Agent(_0x39a3fc);}else{_0x2d1323[_0x97a4('0x40')](_0x2d1323[_0x97a4('0x11')][_0x21b2a8],_0x39a3fc);}}}return _0x2d1323[_0x97a4('0x11')];};};Realtime[_0x97a4('0x3f')][_0x97a4('0x43')]=function(){var _0x156e5e=this;return function(_0x4e42b){if(_0x4e42b){freeIsNotKeySip(_0x4e42b,_0x156e5e[_0x97a4('0x12')]);for(var _0x1dc0f8=0x0,_0x5b3d6f={},_0x4e71be={};_0x1dc0f8<_0x4e42b[_0x97a4('0x44')];_0x1dc0f8+=0x1){_0x5b3d6f=_0x4e42b[_0x1dc0f8];if(_[_0x97a4('0x42')](_0x156e5e[_0x97a4('0x12')][util['format'](_0x97a4('0x28'),_0x5b3d6f[_0x97a4('0x29')])])){_0x156e5e[_0x97a4('0x12')][util[_0x97a4('0x27')](_0x97a4('0x28'),_0x5b3d6f[_0x97a4('0x29')])]=new Telephone(_0x5b3d6f);}else{_0x156e5e['mergeFromDatabase'](_0x156e5e[_0x97a4('0x12')][util['format'](_0x97a4('0x28'),_0x5b3d6f[_0x97a4('0x29')])],_0x5b3d6f);}}}return _0x156e5e[_0x97a4('0x12')];};};Realtime[_0x97a4('0x3f')][_0x97a4('0x45')]=function(){var _0x1ee9fb=this;return function(_0x24d1c3){if(_0x24d1c3){freeIsNotKeySip(_0x24d1c3,_0x1ee9fb[_0x97a4('0x13')]);for(var _0xbe1cc0=0x0,_0x1136a7={},_0x1fe536={};_0xbe1cc0<_0x24d1c3['length'];_0xbe1cc0+=0x1){_0x1136a7=_0x24d1c3[_0xbe1cc0];if(_[_0x97a4('0x42')](_0x1ee9fb[_0x97a4('0x13')][util[_0x97a4('0x27')](_0x97a4('0x28'),_0x1136a7[_0x97a4('0x29')])])){_0x1ee9fb['trunks'][util[_0x97a4('0x27')]('SIP/%s',_0x1136a7['name'])]=new Trunk(_0x1136a7);}else{_0x1ee9fb[_0x97a4('0x40')](_0x1ee9fb['trunks'][util[_0x97a4('0x27')](_0x97a4('0x28'),_0x1136a7[_0x97a4('0x29')])],_0x1136a7);}}}return _0x1ee9fb[_0x97a4('0x13')];};};Realtime[_0x97a4('0x3f')][_0x97a4('0x46')]=function(){var _0x4f0d56=this;return function(_0x1b6f78){if(_0x1b6f78){freeIsNotKey(_0x1b6f78,_0x4f0d56['voiceQueues'],_0x97a4('0x29'));for(var _0x483176=0x0,_0x53e270={},_0x6ca10={};_0x483176<_0x1b6f78['length'];_0x483176+=0x1){_0x53e270=_0x1b6f78[_0x483176];if(_[_0x97a4('0x42')](_0x4f0d56[_0x97a4('0x47')][_0x53e270[_0x97a4('0x29')]])){_0x4f0d56[_0x97a4('0x47')][_0x53e270[_0x97a4('0x29')]]=new VoiceQueue(_0x53e270);}else{_0x4f0d56[_0x97a4('0x40')](_0x4f0d56['voiceQueues'][_0x53e270['name']],_0x53e270);}}}return _0x4f0d56['voiceQueues'];};};Realtime['prototype'][_0x97a4('0x48')]=function(){var _0x2fce7e=this;return function(_0x227460){if(_0x227460){freeIsNotKey(_0x227460,_0x2fce7e[_0x97a4('0x14')],'id');for(var _0x2f25dd=0x0,_0x2de58b={},_0x5386aa={};_0x2f25dd<_0x227460['length'];_0x2f25dd+=0x1){_0x2de58b=_0x227460[_0x2f25dd];if(_['isUndefined'](_0x2fce7e[_0x97a4('0x14')][_0x2de58b['id']])){_0x2fce7e[_0x97a4('0x14')][_0x2de58b['id']]=new Trigger(_0x2de58b);}else{_0x2fce7e[_0x97a4('0x40')](_0x2fce7e[_0x97a4('0x14')][_0x2de58b['id']],_0x2de58b);}}}return _0x2fce7e[_0x97a4('0x14')];};};Realtime[_0x97a4('0x3f')][_0x97a4('0x49')]=function(){var _0x1a82e8=this;return function(_0x86fff1){if(_0x86fff1){freeIsNotKey(_0x86fff1,_0x1a82e8['templates'],'id');for(var _0x5e34ee=0x0,_0x4ae751={},_0x164e3b={};_0x5e34ee<_0x86fff1['length'];_0x5e34ee+=0x1){_0x4ae751=_0x86fff1[_0x5e34ee];if(_[_0x97a4('0x42')](_0x1a82e8[_0x97a4('0x16')][_0x4ae751['id']])){_0x1a82e8[_0x97a4('0x16')][_0x4ae751['id']]=new Template(_0x4ae751);}else{_0x1a82e8[_0x97a4('0x40')](_0x1a82e8[_0x97a4('0x16')][_0x4ae751['id']],_0x4ae751);}}}return _0x1a82e8[_0x97a4('0x16')];};};Realtime[_0x97a4('0x3f')][_0x97a4('0x4a')]=function(){var _0x1a795b=this;return function(_0x460f25){if(_0x460f25){freeIsNotKey(_0x460f25,_0x1a795b[_0x97a4('0x1c')],'id');for(var _0x32be15=0x0,_0x20283e={},_0x58f286={};_0x32be15<_0x460f25[_0x97a4('0x44')];_0x32be15+=0x1){_0x20283e=_0x460f25[_0x32be15];if(_['isUndefined'](_0x1a795b[_0x97a4('0x1c')][_0x20283e['id']])){_0x1a795b[_0x97a4('0x1c')][_0x20283e['id']]=new ZendeskAccount(_0x20283e);}else{_0x1a795b[_0x97a4('0x40')](_0x1a795b['zendeskAccounts'][_0x20283e['id']],_0x20283e);}}}return _0x1a795b[_0x97a4('0x1c')];};};Realtime['prototype'][_0x97a4('0x4b')]=function(){var _0x30db61=this;return function(_0x448d2a){if(_0x448d2a){freeIsNotKey(_0x448d2a,_0x30db61[_0x97a4('0x1d')],'id');for(var _0x34ed91=0x0,_0x12da0b={},_0x75c6f1={};_0x34ed91<_0x448d2a[_0x97a4('0x44')];_0x34ed91+=0x1){_0x12da0b=_0x448d2a[_0x34ed91];if(_['isUndefined'](_0x30db61['salesforceAccounts'][_0x12da0b['id']])){_0x30db61[_0x97a4('0x1d')][_0x12da0b['id']]=new SalesforceAccount(_0x12da0b);}else{_0x30db61[_0x97a4('0x40')](_0x30db61['salesforceAccounts'][_0x12da0b['id']],_0x12da0b);}}}return _0x30db61[_0x97a4('0x1d')];};};Realtime['prototype']['initFreshdeskAccounts']=function(){var _0x45bd1e=this;return function(_0xdb676a){if(_0xdb676a){freeIsNotKey(_0xdb676a,_0x45bd1e['freshdeskAccounts'],'id');for(var _0x5351c3=0x0,_0x391dea={},_0x24a831={};_0x5351c3<_0xdb676a['length'];_0x5351c3+=0x1){_0x391dea=_0xdb676a[_0x5351c3];if(_[_0x97a4('0x42')](_0x45bd1e['freshdeskAccounts'][_0x391dea['id']])){_0x45bd1e['freshdeskAccounts'][_0x391dea['id']]=new FreshdeskAccount(_0x391dea);}else{_0x45bd1e[_0x97a4('0x40')](_0x45bd1e[_0x97a4('0x1f')][_0x391dea['id']],_0x391dea);}}}return _0x45bd1e['freshdeskAccounts'];};};Realtime['prototype'][_0x97a4('0x4c')]=function(){var _0x3e3fd2=this;return function(_0x581ee6){if(_0x581ee6){freeIsNotKey(_0x581ee6,_0x3e3fd2[_0x97a4('0x20')],'id');for(var _0x16d67d=0x0,_0x2d3d3e={},_0x5c49bb={};_0x16d67d<_0x581ee6[_0x97a4('0x44')];_0x16d67d+=0x1){_0x2d3d3e=_0x581ee6[_0x16d67d];if(_[_0x97a4('0x42')](_0x3e3fd2[_0x97a4('0x20')][_0x2d3d3e['id']])){_0x3e3fd2[_0x97a4('0x20')][_0x2d3d3e['id']]=new ZohoAccount(_0x2d3d3e);}else{_0x3e3fd2[_0x97a4('0x40')](_0x3e3fd2[_0x97a4('0x20')][_0x2d3d3e['id']],_0x2d3d3e);}}}return _0x3e3fd2[_0x97a4('0x20')];};};Realtime[_0x97a4('0x3f')]['initDeskAccounts']=function(){var _0x10c6c4=this;return function(_0x231db7){if(_0x231db7){freeIsNotKey(_0x231db7,_0x10c6c4[_0x97a4('0x21')],'id');for(var _0x17f9d6=0x0,_0x4f0365={},_0x530347={};_0x17f9d6<_0x231db7[_0x97a4('0x44')];_0x17f9d6+=0x1){_0x4f0365=_0x231db7[_0x17f9d6];if(_['isUndefined'](_0x10c6c4[_0x97a4('0x21')][_0x4f0365['id']])){_0x10c6c4[_0x97a4('0x21')][_0x4f0365['id']]=new DeskAccount(_0x4f0365);}else{_0x10c6c4[_0x97a4('0x40')](_0x10c6c4[_0x97a4('0x21')][_0x4f0365['id']],_0x4f0365);}}}return _0x10c6c4[_0x97a4('0x21')];};};Realtime[_0x97a4('0x3f')][_0x97a4('0x4d')]=function(){var _0x3aa52d=this;return function(_0x4c9211){if(_0x4c9211){freeIsNotKey(_0x4c9211,_0x3aa52d[_0x97a4('0x1e')],'id');for(var _0x2cd5bb=0x0,_0x20c4bf={},_0x3f52c9={};_0x2cd5bb<_0x4c9211[_0x97a4('0x44')];_0x2cd5bb+=0x1){_0x20c4bf=_0x4c9211[_0x2cd5bb];if(_[_0x97a4('0x42')](_0x3aa52d[_0x97a4('0x1e')][_0x20c4bf['id']])){_0x3aa52d['sugarcrmAccounts'][_0x20c4bf['id']]=new SugarcrmAccount(_0x20c4bf);}else{_0x3aa52d[_0x97a4('0x40')](_0x3aa52d['sugarcrmAccounts'][_0x20c4bf['id']],_0x20c4bf);}}}return _0x3aa52d['sugarcrmAccounts'];};};Realtime['prototype'][_0x97a4('0x4e')]=function(){var _0x3da3ef=this;return function(_0x552ca8){if(_0x552ca8){freeIsNotKey(_0x552ca8,_0x3da3ef[_0x97a4('0x22')],'id');for(var _0x33fb26=0x0,_0x444d49={},_0xac67d={};_0x33fb26<_0x552ca8[_0x97a4('0x44')];_0x33fb26+=0x1){_0x444d49=_0x552ca8[_0x33fb26];if(_[_0x97a4('0x42')](_0x3da3ef[_0x97a4('0x22')][_0x444d49['id']])){_0x3da3ef[_0x97a4('0x22')][_0x444d49['id']]=new VtigerAccount(_0x444d49);}else{_0x3da3ef[_0x97a4('0x40')](_0x3da3ef[_0x97a4('0x22')][_0x444d49['id']],_0x444d49);}}}return _0x3da3ef['vtigerAccounts'];};};Realtime[_0x97a4('0x3f')][_0x97a4('0x4f')]=function(){var _0x52f4f0=this;return function(_0x3ac2e7){if(_0x3ac2e7){freeIsNotKey(_0x3ac2e7,_0x52f4f0['servicenowAccounts'],'id');for(var _0x539922=0x0,_0x2c2629={},_0x4addfb={};_0x539922<_0x3ac2e7[_0x97a4('0x44')];_0x539922+=0x1){_0x2c2629=_0x3ac2e7[_0x539922];if(_['isUndefined'](_0x52f4f0[_0x97a4('0x50')][_0x2c2629['id']])){_0x52f4f0['servicenowAccounts'][_0x2c2629['id']]=new ServicenowAccount(_0x2c2629);}else{_0x52f4f0[_0x97a4('0x40')](_0x52f4f0[_0x97a4('0x50')][_0x2c2629['id']],_0x2c2629);}}}return _0x52f4f0[_0x97a4('0x50')];};};Realtime[_0x97a4('0x3f')][_0x97a4('0x51')]=function(){var _0x1c70ce=this;return function(_0x686b7e){if(_0x686b7e){freeIsNotKey(_0x686b7e,_0x1c70ce[_0x97a4('0x52')],'id');for(var _0xbcd24f=0x0,_0x5a0a72={},_0x21a328={};_0xbcd24f<_0x686b7e['length'];_0xbcd24f+=0x1){_0x5a0a72=_0x686b7e[_0xbcd24f];if(_[_0x97a4('0x42')](_0x1c70ce[_0x97a4('0x52')][_0x5a0a72['id']])){_0x1c70ce['dynamics365Accounts'][_0x5a0a72['id']]=new Dynamics365Account(_0x5a0a72);}else{_0x1c70ce[_0x97a4('0x40')](_0x1c70ce[_0x97a4('0x52')][_0x5a0a72['id']],_0x5a0a72);}}}return _0x1c70ce[_0x97a4('0x52')];};};Realtime[_0x97a4('0x3f')][_0x97a4('0x53')]=function(){var _0x2a30cf=this;return function(_0x495ffc){if(_0x495ffc){freeIsNotKey(_0x495ffc,_0x2a30cf[_0x97a4('0x23')],'id');for(var _0x40001b=0x0,_0x51f37e={},_0x4450c3={};_0x40001b<_0x495ffc[_0x97a4('0x44')];_0x40001b+=0x1){_0x51f37e=_0x495ffc[_0x40001b];if(_[_0x97a4('0x42')](_0x2a30cf[_0x97a4('0x23')][_0x51f37e['id']])){_0x2a30cf['freshsalesAccounts'][_0x51f37e['id']]=new FreshsalesAccount(_0x51f37e);}else{_0x2a30cf[_0x97a4('0x40')](_0x2a30cf[_0x97a4('0x23')][_0x51f37e['id']],_0x51f37e);}}}return _0x2a30cf[_0x97a4('0x23')];};};Realtime[_0x97a4('0x3f')]['initVoiceQueueHopperHistory']=function(){var _0x1c8031=this;return function(_0x24dc24){for(var _0x5f0fce=0x0;_0x5f0fce<_0x24dc24['length'];_0x5f0fce+=0x1){_[_0x97a4('0x54')](_0x1c8031['voiceQueues'][_0x24dc24[_0x5f0fce][_0x97a4('0x29')]],_0x24dc24[_0x5f0fce]);}return _0x1c8031[_0x97a4('0x47')];};};Realtime[_0x97a4('0x3f')][_0x97a4('0x55')]=function(){var _0x31fa27=this;return function(_0x3011a6){clearVoiceQueues(_0x31fa27[_0x97a4('0x47')]);if(_0x3011a6){_0x3011a6=_[_0x97a4('0x56')](_0x3011a6,'uniqueid');for(var _0x211429 in _0x3011a6){if(_0x3011a6[_0x97a4('0x26')](_0x211429)){var _0x30ff12={};for(var _0x5d4a03=0x0;_0x5d4a03<_0x3011a6[_0x211429]['length'];_0x5d4a03+=0x1){var _0x59b569=_0x3011a6[_0x211429][_0x5d4a03]['queue'];if(_0x31fa27[_0x97a4('0x47')][_0x59b569]){if(_0x3011a6[_0x211429][_0x5d4a03]['queuecallerexit']){_0x31fa27[_0x97a4('0x47')][_0x59b569][_0x97a4('0x57')]+=0x1;}if(_0x3011a6[_0x211429][_0x5d4a03][_0x97a4('0x58')]){_0x31fa27['voiceQueues'][_0x59b569][_0x97a4('0x32')]+=0x1;}_0x31fa27[_0x97a4('0x47')][_0x59b569][_0x97a4('0x2e')]+=moment(_0x3011a6[_0x211429][_0x5d4a03]['queuecallerleaveAt'])['diff'](moment(_0x3011a6[_0x211429][_0x5d4a03][_0x97a4('0x59')]),'seconds')||0x0;if(_0x5d4a03===_0x3011a6[_0x211429][_0x97a4('0x44')]-0x1){_0x31fa27[_0x97a4('0x47')][_0x59b569][_0x97a4('0x2f')]+=moment(_0x3011a6[_0x211429][_0x5d4a03][_0x97a4('0x5a')]||_0x3011a6[_0x211429][_0x5d4a03]['queuecallerabandonAt']||_0x3011a6[_0x211429][_0x5d4a03][_0x97a4('0x5b')])['diff'](moment(_0x3011a6[_0x211429][_0x5d4a03][_0x97a4('0x59')]),_0x97a4('0x5c'))||0x0;_0x31fa27['voiceQueues'][_0x59b569][_0x97a4('0x2c')]+=0x1;if(_0x3011a6[_0x211429][_0x5d4a03][_0x97a4('0x5d')]){_0x31fa27['voiceQueues'][_0x59b569][_0x97a4('0x2d')]+=0x1;_0x31fa27[_0x97a4('0x47')][_0x59b569]['sumBillable']+=moment(_0x3011a6[_0x211429][_0x5d4a03][_0x97a4('0x5a')])['diff'](moment(_0x3011a6[_0x211429][_0x5d4a03][_0x97a4('0x5e')]),_0x97a4('0x5c'))||0x0;}}else{_0x31fa27[_0x97a4('0x47')][_0x59b569][_0x97a4('0x2f')]+=_0x31fa27[_0x97a4('0x47')][_0x59b569]['sumHoldTime']||0x0;}}}}}}return _0x31fa27[_0x97a4('0x47')];};};Realtime['prototype'][_0x97a4('0x5f')]=function(){var _0x47ec7d=this;return function(_0x48dae9){clearVoiceCallReports(_0x47ec7d['outbound']);if(_0x48dae9){for(var _0x4c08c2=0x0;_0x4c08c2<_0x48dae9['length'];_0x4c08c2+=0x1){_0x47ec7d[_0x97a4('0x17')][_0x97a4('0x2c')]+=0x1;_0x47ec7d[_0x97a4('0x17')][_0x97a4('0x2f')]+=_0x48dae9[_0x4c08c2][_0x97a4('0x60')];if(_0x48dae9[_0x4c08c2][_0x97a4('0x61')]===_0x97a4('0x62')){_0x47ec7d[_0x97a4('0x17')][_0x97a4('0x2d')]+=0x1;_0x47ec7d[_0x97a4('0x17')][_0x97a4('0x2e')]+=_0x48dae9[_0x4c08c2][_0x97a4('0x60')]-_0x48dae9[_0x4c08c2]['billableseconds']||0x0;_0x47ec7d[_0x97a4('0x17')][_0x97a4('0x33')]+=_0x48dae9[_0x4c08c2][_0x97a4('0x63')];}}}return _0x47ec7d[_0x97a4('0x17')];};};Realtime['prototype'][_0x97a4('0x64')]=function(){var _0x86a9f6=this;return function(_0x3dcec8){if(_0x3dcec8){freeIsNotKey(_0x3dcec8,_0x86a9f6[_0x97a4('0x15')],_0x97a4('0x29'));for(var _0x8a2aca=0x0,_0x1fd308={};_0x8a2aca<_0x3dcec8['length'];_0x8a2aca+=0x1){_0x1fd308=_0x3dcec8[_0x8a2aca];if(_[_0x97a4('0x42')](_0x86a9f6[_0x97a4('0x15')][_0x1fd308[_0x97a4('0x29')]])){_0x86a9f6[_0x97a4('0x15')][_0x1fd308[_0x97a4('0x29')]]=new Campaign(_0x1fd308);}else{_0x86a9f6[_0x97a4('0x40')](_0x86a9f6[_0x97a4('0x15')][_0x1fd308[_0x97a4('0x29')]],_0x1fd308);_0x86a9f6[_0x97a4('0x15')][_0x1fd308[_0x97a4('0x29')]][_0x97a4('0x65')]=_0x1fd308['SquareProject']?_0x1fd308[_0x97a4('0x66')][_0x97a4('0x29')]:undefined;}}}return _0x86a9f6[_0x97a4('0x15')];};};Realtime[_0x97a4('0x3f')][_0x97a4('0x67')]=function(){var _0x56d61b=this;return function(_0x5ac730){if(_0x5ac730){freeIsNotKey(_0x5ac730,_0x56d61b[_0x97a4('0x18')],'id');for(var _0xf2f2c9=0x0,_0x22bc71={};_0xf2f2c9<_0x5ac730[_0x97a4('0x44')];_0xf2f2c9+=0x1){_0x22bc71=_0x5ac730[_0xf2f2c9];if(_['isUndefined'](_0x56d61b[_0x97a4('0x18')][_0x22bc71['id']])){_0x56d61b['voiceExtensions'][_0x22bc71['id']]=new VoiceExtension(_0x22bc71);}else{_0x56d61b[_0x97a4('0x40')](_0x56d61b[_0x97a4('0x18')][_0x22bc71['id']],_0x22bc71);}}}return _0x56d61b['voiceExtensions'];};};Realtime[_0x97a4('0x3f')][_0x97a4('0x68')]=function(){var _0x4bb423=this;return function(_0x1d7d73){clearCampaigns(_0x4bb423[_0x97a4('0x15')]);for(var _0x1ad36e=0x0;_0x1ad36e<_0x1d7d73[_0x97a4('0x44')];_0x1ad36e+=0x1){_[_0x97a4('0x54')](_0x4bb423[_0x97a4('0x15')][_0x1d7d73[_0x1ad36e]['name']],_0x1d7d73[_0x1ad36e]);}return _0x4bb423[_0x97a4('0x15')];};};Realtime[_0x97a4('0x3f')][_0x97a4('0x69')]=function(){var _0x31ffab=this;return function(_0x128185){if(_0x128185){freeIsNotKey(_0x128185,_0x31ffab[_0x97a4('0x24')],'id');for(var _0x546951=0x0,_0x222300={},_0x52b6fe={};_0x546951<_0x128185[_0x97a4('0x44')];_0x546951+=0x1){_0x222300=_0x128185[_0x546951];if(_['isUndefined'](_0x31ffab['faxAccounts'][_0x222300['id']])){_0x31ffab['faxAccounts'][_0x222300['id']]=new FaxAccount(_0x222300);}else{_0x31ffab[_0x97a4('0x40')](_0x31ffab[_0x97a4('0x24')][_0x222300['id']],_0x222300);}}}return _0x31ffab['faxAccounts'];};};module[_0x97a4('0x6a')]=Realtime; \ No newline at end of file +var _0x34ab=['agents','mergeFromDatabase','initTelephones','initTrunks','initVoiceQueues','initTriggers','triggers','initTemplates','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initZohoAccounts','initDeskAccounts','deskAccounts','sugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','servicenowAccounts','initDynamics365Accounts','freshsalesAccounts','initVoiceQueueHopperHistory','initVoiceQueueReports','groupBy','uniqueid','queue','queuecallerexit','unmanaged','queuecallerabandon','queuecallerleaveAt','diff','queuecallerjoinAt','seconds','queuecallerabandonAt','queuecallerexitAt','queuecallercomplete','outbound','disposition','ANSWERED','duration','billableseconds','campaigns','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','initFaxAccounts','exports','bluebird','util','moment','../model/agent','../model/telephone','../model/voiceQueue','../model/trigger','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/faxAccount','telephones','trunks','voiceQueues','templates','voiceExtensions','channels','queueChannels','outboundChannels','timers','settings','zendeskAccounts','salesforceAccounts','freshdeskAccounts','zohoAccounts','vtigerAccounts','dynamics365Accounts','faxAccounts','mapKeys','format','SIP/%s','hasOwnProperty','isNil','interface','total','answered','sumDuration','sumBillable','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','abandoned','sumHoldTime','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','prototype','length','name','isUndefined'];(function(_0x2f4b36,_0x4d6d72){var _0x39cd5f=function(_0x47a1d7){while(--_0x47a1d7){_0x2f4b36['push'](_0x2f4b36['shift']());}};_0x39cd5f(++_0x4d6d72);}(_0x34ab,0x10d));var _0xb34a=function(_0x1b92a6,_0x14444b){_0x1b92a6=_0x1b92a6-0x0;var _0x24be5b=_0x34ab[_0x1b92a6];return _0x24be5b;};'use strict';var BPromise=require(_0xb34a('0x0'));var util=require(_0xb34a('0x1'));var _=require('lodash');var moment=require(_0xb34a('0x2'));var Agent=require(_0xb34a('0x3'));var Telephone=require(_0xb34a('0x4'));var Trunk=require('../model/trunk');var VoiceQueue=require(_0xb34a('0x5'));var Trigger=require(_0xb34a('0x6'));var Template=require('../model/template');var Campaign=require(_0xb34a('0x7'));var VoiceExtension=require(_0xb34a('0x8'));var ZendeskAccount=require(_0xb34a('0x9'));var SalesforceAccount=require(_0xb34a('0xa'));var FreshdeskAccount=require(_0xb34a('0xb'));var SugarcrmAccount=require(_0xb34a('0xc'));var ZohoAccount=require(_0xb34a('0xd'));var DeskAccount=require(_0xb34a('0xe'));var VtigerAccount=require(_0xb34a('0xf'));var ServicenowAccount=require(_0xb34a('0x10'));var Dynamics365Account=require('../model/dynamics365Account');var FreshsalesAccount=require('../model/freshsalesAccount');var FaxAccount=require(_0xb34a('0x11'));var Realtime=function(){this['agents']={};this[_0xb34a('0x12')]={};this[_0xb34a('0x13')]={};this[_0xb34a('0x14')]={};this['triggers']={};this['campaigns']={};this[_0xb34a('0x15')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xb34a('0x16')]={};this[_0xb34a('0x17')]={};this[_0xb34a('0x18')]={};this[_0xb34a('0x19')]={};this[_0xb34a('0x1a')]={};this[_0xb34a('0x1b')]={};this[_0xb34a('0x1c')]={};this[_0xb34a('0x1d')]={};this['sugarcrmAccounts']={};this[_0xb34a('0x1e')]={};this[_0xb34a('0x1f')]={};this['deskAccounts']={};this[_0xb34a('0x20')]={};this['servicenowAccounts']={};this[_0xb34a('0x21')]={};this['freshsalesAccounts']={};this[_0xb34a('0x22')]={};};function freeIsNotKey(_0x383a28,_0x610a35,_0x465533){var _0x4187d4=_[_0xb34a('0x23')](_0x383a28,function(_0x460187,_0x36b271){return _0x460187[_0x465533];});for(var _0x290a8f in _0x610a35){if(_0x610a35['hasOwnProperty'](_0x290a8f)){if(!_0x4187d4[_0x290a8f]){delete _0x610a35[_0x290a8f];}}}}function freeIsNotKeySip(_0x38db8a,_0x247f27){var _0xbc1317=_[_0xb34a('0x23')](_0x38db8a,function(_0x3fb674,_0x6ca6da){return util[_0xb34a('0x24')](_0xb34a('0x25'),_0x3fb674['name']);});for(var _0x5632ed in _0x247f27){if(_0x247f27[_0xb34a('0x26')](_0x5632ed)){if(!_0xbc1317[_0x5632ed]){delete _0x247f27[_0x5632ed];}}}}function freeIsNotKeyAgent(_0x116da7,_0x1e760e){var _0x4bdfa7=_[_0xb34a('0x23')](_0x116da7,function(_0x3172d3,_0x1723c3){var _0x3d2f57=_[_0xb34a('0x27')](_0x3172d3[_0xb34a('0x28')])?util[_0xb34a('0x24')]('SIP/%s',_0x3172d3['name']):_0x3172d3['interface'];return _0x3d2f57;});for(var _0x3b7839 in _0x1e760e){if(_0x1e760e[_0xb34a('0x26')](_0x3b7839)){if(!_0x4bdfa7[_0x3b7839]){delete _0x1e760e[_0x3b7839];}}}}function clearVoiceCallReports(_0x47adb2){_0x47adb2[_0xb34a('0x29')]=0x0;_0x47adb2[_0xb34a('0x2a')]=0x0;_0x47adb2['sumHoldTime']=0x0;_0x47adb2[_0xb34a('0x2b')]=0x0;_0x47adb2[_0xb34a('0x2c')]=0x0;}function clearCampaigns(_0x244848){if(!_[_0xb34a('0x2d')](_0x244848)){for(var _0x171a71 in _0x244848){if(_0x244848[_0xb34a('0x26')](_0x171a71)){_0x244848[_0x171a71][_0xb34a('0x2e')]=0x0;_0x244848[_0x171a71][_0xb34a('0x2f')]=0x0;}}}}function clearVoiceQueues(_0x128c5c){if(!_[_0xb34a('0x2d')](_0x128c5c)){for(var _0x28dcb7 in _0x128c5c){if(_0x128c5c[_0xb34a('0x26')](_0x28dcb7)){_0x128c5c[_0x28dcb7][_0xb34a('0x29')]=0x0;_0x128c5c[_0x28dcb7][_0xb34a('0x2a')]=0x0;_0x128c5c[_0x28dcb7]['unmanaged']=0x0;_0x128c5c[_0x28dcb7][_0xb34a('0x30')]=0x0;_0x128c5c[_0x28dcb7][_0xb34a('0x31')]=0x0;_0x128c5c[_0x28dcb7][_0xb34a('0x2b')]=0x0;_0x128c5c[_0x28dcb7][_0xb34a('0x2c')]=0x0;_0x128c5c[_0x28dcb7][_0xb34a('0x32')]=0x0;_0x128c5c[_0x28dcb7][_0xb34a('0x33')]=0x0;_0x128c5c[_0x28dcb7][_0xb34a('0x34')]=0x0;_0x128c5c[_0x28dcb7]['outboundCongestionCallsDay']=0x0;_0x128c5c[_0x28dcb7]['outboundNoSuchCallsDay']=0x0;_0x128c5c[_0x28dcb7][_0xb34a('0x35')]=0x0;_0x128c5c[_0x28dcb7][_0xb34a('0x36')]=0x0;_0x128c5c[_0x28dcb7][_0xb34a('0x37')]=0x0;_0x128c5c[_0x28dcb7]['outboundBlacklistCallsDay']=0x0;_0x128c5c[_0x28dcb7][_0xb34a('0x38')]=0x0;_0x128c5c[_0x28dcb7][_0xb34a('0x39')]=0x0;_0x128c5c[_0x28dcb7][_0xb34a('0x3a')]=0x0;_0x128c5c[_0x28dcb7][_0xb34a('0x32')]=0x0;_0x128c5c[_0x28dcb7][_0xb34a('0x3b')]=0x0;_0x128c5c[_0x28dcb7]['queueStatusComplete']=!![];}}}}Realtime['prototype']['mergeFromDatabase']=function(_0x1c0dfe,_0x3fdba8){for(var _0x5e89df in _0x3fdba8){if(_0x1c0dfe[_0xb34a('0x26')](_0x5e89df)){_0x1c0dfe[_0x5e89df]=_0x3fdba8[_0x5e89df];}}};Realtime[_0xb34a('0x3c')]['initAgents']=function(){var _0x5ccb1a=this;return function(_0x391358){if(_0x391358){freeIsNotKeyAgent(_0x391358,_0x5ccb1a['agents']);for(var _0x5de64f=0x0,_0x369f7d={},_0x22b597={};_0x5de64f<_0x391358[_0xb34a('0x3d')];_0x5de64f+=0x1){_0x369f7d=_0x391358[_0x5de64f];var _0x215122=_['isNil'](_0x369f7d['interface'])?util[_0xb34a('0x24')](_0xb34a('0x25'),_0x369f7d[_0xb34a('0x3e')]):_0x369f7d[_0xb34a('0x28')];if(_[_0xb34a('0x3f')](_0x5ccb1a[_0xb34a('0x40')][_0x215122])){_0x5ccb1a[_0xb34a('0x40')][_0x215122]=new Agent(_0x369f7d);}else{_0x5ccb1a[_0xb34a('0x41')](_0x5ccb1a[_0xb34a('0x40')][_0x215122],_0x369f7d);}}}return _0x5ccb1a[_0xb34a('0x40')];};};Realtime[_0xb34a('0x3c')][_0xb34a('0x42')]=function(){var _0x489730=this;return function(_0x9c76f){if(_0x9c76f){freeIsNotKeySip(_0x9c76f,_0x489730[_0xb34a('0x12')]);for(var _0x232058=0x0,_0x378f30={},_0x17c194={};_0x232058<_0x9c76f[_0xb34a('0x3d')];_0x232058+=0x1){_0x378f30=_0x9c76f[_0x232058];if(_[_0xb34a('0x3f')](_0x489730[_0xb34a('0x12')][util[_0xb34a('0x24')](_0xb34a('0x25'),_0x378f30[_0xb34a('0x3e')])])){_0x489730[_0xb34a('0x12')][util[_0xb34a('0x24')]('SIP/%s',_0x378f30['name'])]=new Telephone(_0x378f30);}else{_0x489730['mergeFromDatabase'](_0x489730['telephones'][util[_0xb34a('0x24')](_0xb34a('0x25'),_0x378f30['name'])],_0x378f30);}}}return _0x489730[_0xb34a('0x12')];};};Realtime['prototype'][_0xb34a('0x43')]=function(){var _0x38db85=this;return function(_0x1800ba){if(_0x1800ba){freeIsNotKeySip(_0x1800ba,_0x38db85['trunks']);for(var _0x48554b=0x0,_0x26c65c={},_0x551459={};_0x48554b<_0x1800ba['length'];_0x48554b+=0x1){_0x26c65c=_0x1800ba[_0x48554b];if(_[_0xb34a('0x3f')](_0x38db85[_0xb34a('0x13')][util[_0xb34a('0x24')]('SIP/%s',_0x26c65c['name'])])){_0x38db85[_0xb34a('0x13')][util[_0xb34a('0x24')](_0xb34a('0x25'),_0x26c65c[_0xb34a('0x3e')])]=new Trunk(_0x26c65c);}else{_0x38db85[_0xb34a('0x41')](_0x38db85[_0xb34a('0x13')][util[_0xb34a('0x24')](_0xb34a('0x25'),_0x26c65c[_0xb34a('0x3e')])],_0x26c65c);}}}return _0x38db85[_0xb34a('0x13')];};};Realtime[_0xb34a('0x3c')][_0xb34a('0x44')]=function(){var _0x3c5d90=this;return function(_0x1ee2af){if(_0x1ee2af){freeIsNotKey(_0x1ee2af,_0x3c5d90['voiceQueues'],_0xb34a('0x3e'));for(var _0x481438=0x0,_0x2f5e61={},_0x50b184={};_0x481438<_0x1ee2af[_0xb34a('0x3d')];_0x481438+=0x1){_0x2f5e61=_0x1ee2af[_0x481438];if(_['isUndefined'](_0x3c5d90['voiceQueues'][_0x2f5e61[_0xb34a('0x3e')]])){_0x3c5d90['voiceQueues'][_0x2f5e61[_0xb34a('0x3e')]]=new VoiceQueue(_0x2f5e61);}else{_0x3c5d90[_0xb34a('0x41')](_0x3c5d90[_0xb34a('0x14')][_0x2f5e61[_0xb34a('0x3e')]],_0x2f5e61);}}}return _0x3c5d90[_0xb34a('0x14')];};};Realtime[_0xb34a('0x3c')][_0xb34a('0x45')]=function(){var _0x56c563=this;return function(_0x50f110){if(_0x50f110){freeIsNotKey(_0x50f110,_0x56c563[_0xb34a('0x46')],'id');for(var _0x5d4b63=0x0,_0x918230={},_0xa5e847={};_0x5d4b63<_0x50f110[_0xb34a('0x3d')];_0x5d4b63+=0x1){_0x918230=_0x50f110[_0x5d4b63];if(_[_0xb34a('0x3f')](_0x56c563['triggers'][_0x918230['id']])){_0x56c563[_0xb34a('0x46')][_0x918230['id']]=new Trigger(_0x918230);}else{_0x56c563[_0xb34a('0x41')](_0x56c563['triggers'][_0x918230['id']],_0x918230);}}}return _0x56c563[_0xb34a('0x46')];};};Realtime[_0xb34a('0x3c')][_0xb34a('0x47')]=function(){var _0x407ad9=this;return function(_0x27e467){if(_0x27e467){freeIsNotKey(_0x27e467,_0x407ad9[_0xb34a('0x15')],'id');for(var _0x1a38f9=0x0,_0x5a0d2c={},_0x5d84cb={};_0x1a38f9<_0x27e467[_0xb34a('0x3d')];_0x1a38f9+=0x1){_0x5a0d2c=_0x27e467[_0x1a38f9];if(_[_0xb34a('0x3f')](_0x407ad9['templates'][_0x5a0d2c['id']])){_0x407ad9[_0xb34a('0x15')][_0x5a0d2c['id']]=new Template(_0x5a0d2c);}else{_0x407ad9[_0xb34a('0x41')](_0x407ad9[_0xb34a('0x15')][_0x5a0d2c['id']],_0x5a0d2c);}}}return _0x407ad9[_0xb34a('0x15')];};};Realtime['prototype'][_0xb34a('0x48')]=function(){var _0x81ba42=this;return function(_0x52bbcd){if(_0x52bbcd){freeIsNotKey(_0x52bbcd,_0x81ba42[_0xb34a('0x1c')],'id');for(var _0x1300ca=0x0,_0x445641={},_0x3e6bdf={};_0x1300ca<_0x52bbcd[_0xb34a('0x3d')];_0x1300ca+=0x1){_0x445641=_0x52bbcd[_0x1300ca];if(_['isUndefined'](_0x81ba42[_0xb34a('0x1c')][_0x445641['id']])){_0x81ba42[_0xb34a('0x1c')][_0x445641['id']]=new ZendeskAccount(_0x445641);}else{_0x81ba42[_0xb34a('0x41')](_0x81ba42[_0xb34a('0x1c')][_0x445641['id']],_0x445641);}}}return _0x81ba42['zendeskAccounts'];};};Realtime[_0xb34a('0x3c')][_0xb34a('0x49')]=function(){var _0x300792=this;return function(_0xa35914){if(_0xa35914){freeIsNotKey(_0xa35914,_0x300792['salesforceAccounts'],'id');for(var _0x5486b4=0x0,_0x5cc0e8={},_0x584624={};_0x5486b4<_0xa35914[_0xb34a('0x3d')];_0x5486b4+=0x1){_0x5cc0e8=_0xa35914[_0x5486b4];if(_[_0xb34a('0x3f')](_0x300792[_0xb34a('0x1d')][_0x5cc0e8['id']])){_0x300792[_0xb34a('0x1d')][_0x5cc0e8['id']]=new SalesforceAccount(_0x5cc0e8);}else{_0x300792[_0xb34a('0x41')](_0x300792['salesforceAccounts'][_0x5cc0e8['id']],_0x5cc0e8);}}}return _0x300792[_0xb34a('0x1d')];};};Realtime[_0xb34a('0x3c')][_0xb34a('0x4a')]=function(){var _0x399ea7=this;return function(_0x39df3b){if(_0x39df3b){freeIsNotKey(_0x39df3b,_0x399ea7[_0xb34a('0x1e')],'id');for(var _0x1561c1=0x0,_0x227022={},_0x42d34b={};_0x1561c1<_0x39df3b[_0xb34a('0x3d')];_0x1561c1+=0x1){_0x227022=_0x39df3b[_0x1561c1];if(_['isUndefined'](_0x399ea7[_0xb34a('0x1e')][_0x227022['id']])){_0x399ea7[_0xb34a('0x1e')][_0x227022['id']]=new FreshdeskAccount(_0x227022);}else{_0x399ea7[_0xb34a('0x41')](_0x399ea7['freshdeskAccounts'][_0x227022['id']],_0x227022);}}}return _0x399ea7[_0xb34a('0x1e')];};};Realtime[_0xb34a('0x3c')][_0xb34a('0x4b')]=function(){var _0x42ac46=this;return function(_0x471fdc){if(_0x471fdc){freeIsNotKey(_0x471fdc,_0x42ac46[_0xb34a('0x1f')],'id');for(var _0x109ea1=0x0,_0x3aeeba={},_0x16b6de={};_0x109ea1<_0x471fdc[_0xb34a('0x3d')];_0x109ea1+=0x1){_0x3aeeba=_0x471fdc[_0x109ea1];if(_['isUndefined'](_0x42ac46[_0xb34a('0x1f')][_0x3aeeba['id']])){_0x42ac46[_0xb34a('0x1f')][_0x3aeeba['id']]=new ZohoAccount(_0x3aeeba);}else{_0x42ac46[_0xb34a('0x41')](_0x42ac46['zohoAccounts'][_0x3aeeba['id']],_0x3aeeba);}}}return _0x42ac46[_0xb34a('0x1f')];};};Realtime[_0xb34a('0x3c')][_0xb34a('0x4c')]=function(){var _0x5744f8=this;return function(_0x34264e){if(_0x34264e){freeIsNotKey(_0x34264e,_0x5744f8[_0xb34a('0x4d')],'id');for(var _0x55f0ae=0x0,_0x1e373f={},_0x45f7d0={};_0x55f0ae<_0x34264e[_0xb34a('0x3d')];_0x55f0ae+=0x1){_0x1e373f=_0x34264e[_0x55f0ae];if(_[_0xb34a('0x3f')](_0x5744f8[_0xb34a('0x4d')][_0x1e373f['id']])){_0x5744f8['deskAccounts'][_0x1e373f['id']]=new DeskAccount(_0x1e373f);}else{_0x5744f8[_0xb34a('0x41')](_0x5744f8[_0xb34a('0x4d')][_0x1e373f['id']],_0x1e373f);}}}return _0x5744f8[_0xb34a('0x4d')];};};Realtime[_0xb34a('0x3c')]['initSugarcrmAccounts']=function(){var _0x1a59ff=this;return function(_0x339acf){if(_0x339acf){freeIsNotKey(_0x339acf,_0x1a59ff[_0xb34a('0x4e')],'id');for(var _0x5d3244=0x0,_0x196727={},_0x15500e={};_0x5d3244<_0x339acf[_0xb34a('0x3d')];_0x5d3244+=0x1){_0x196727=_0x339acf[_0x5d3244];if(_[_0xb34a('0x3f')](_0x1a59ff[_0xb34a('0x4e')][_0x196727['id']])){_0x1a59ff[_0xb34a('0x4e')][_0x196727['id']]=new SugarcrmAccount(_0x196727);}else{_0x1a59ff[_0xb34a('0x41')](_0x1a59ff['sugarcrmAccounts'][_0x196727['id']],_0x196727);}}}return _0x1a59ff['sugarcrmAccounts'];};};Realtime[_0xb34a('0x3c')][_0xb34a('0x4f')]=function(){var _0x3bfbcd=this;return function(_0x1146e9){if(_0x1146e9){freeIsNotKey(_0x1146e9,_0x3bfbcd[_0xb34a('0x20')],'id');for(var _0x41e722=0x0,_0x2272d8={},_0x38a701={};_0x41e722<_0x1146e9[_0xb34a('0x3d')];_0x41e722+=0x1){_0x2272d8=_0x1146e9[_0x41e722];if(_[_0xb34a('0x3f')](_0x3bfbcd[_0xb34a('0x20')][_0x2272d8['id']])){_0x3bfbcd['vtigerAccounts'][_0x2272d8['id']]=new VtigerAccount(_0x2272d8);}else{_0x3bfbcd[_0xb34a('0x41')](_0x3bfbcd[_0xb34a('0x20')][_0x2272d8['id']],_0x2272d8);}}}return _0x3bfbcd[_0xb34a('0x20')];};};Realtime[_0xb34a('0x3c')][_0xb34a('0x50')]=function(){var _0x5df5fb=this;return function(_0x46b235){if(_0x46b235){freeIsNotKey(_0x46b235,_0x5df5fb['servicenowAccounts'],'id');for(var _0x38f5cb=0x0,_0x1081c2={},_0x5c4b0c={};_0x38f5cb<_0x46b235[_0xb34a('0x3d')];_0x38f5cb+=0x1){_0x1081c2=_0x46b235[_0x38f5cb];if(_[_0xb34a('0x3f')](_0x5df5fb['servicenowAccounts'][_0x1081c2['id']])){_0x5df5fb[_0xb34a('0x51')][_0x1081c2['id']]=new ServicenowAccount(_0x1081c2);}else{_0x5df5fb[_0xb34a('0x41')](_0x5df5fb['servicenowAccounts'][_0x1081c2['id']],_0x1081c2);}}}return _0x5df5fb[_0xb34a('0x51')];};};Realtime[_0xb34a('0x3c')][_0xb34a('0x52')]=function(){var _0x15af33=this;return function(_0x10422f){if(_0x10422f){freeIsNotKey(_0x10422f,_0x15af33[_0xb34a('0x21')],'id');for(var _0xc1a735=0x0,_0x2867d={},_0x484032={};_0xc1a735<_0x10422f['length'];_0xc1a735+=0x1){_0x2867d=_0x10422f[_0xc1a735];if(_[_0xb34a('0x3f')](_0x15af33[_0xb34a('0x21')][_0x2867d['id']])){_0x15af33['dynamics365Accounts'][_0x2867d['id']]=new Dynamics365Account(_0x2867d);}else{_0x15af33[_0xb34a('0x41')](_0x15af33['dynamics365Accounts'][_0x2867d['id']],_0x2867d);}}}return _0x15af33[_0xb34a('0x21')];};};Realtime['prototype']['initFreshsalesAccounts']=function(){var _0x12ec01=this;return function(_0x1c8581){if(_0x1c8581){freeIsNotKey(_0x1c8581,_0x12ec01[_0xb34a('0x53')],'id');for(var _0x2cfeba=0x0,_0x2abc45={},_0xe2393e={};_0x2cfeba<_0x1c8581[_0xb34a('0x3d')];_0x2cfeba+=0x1){_0x2abc45=_0x1c8581[_0x2cfeba];if(_[_0xb34a('0x3f')](_0x12ec01[_0xb34a('0x53')][_0x2abc45['id']])){_0x12ec01['freshsalesAccounts'][_0x2abc45['id']]=new FreshsalesAccount(_0x2abc45);}else{_0x12ec01[_0xb34a('0x41')](_0x12ec01['freshsalesAccounts'][_0x2abc45['id']],_0x2abc45);}}}return _0x12ec01[_0xb34a('0x53')];};};Realtime['prototype'][_0xb34a('0x54')]=function(){var _0x18da84=this;return function(_0x56b1ef){for(var _0x17e25c=0x0;_0x17e25c<_0x56b1ef[_0xb34a('0x3d')];_0x17e25c+=0x1){_['merge'](_0x18da84['voiceQueues'][_0x56b1ef[_0x17e25c]['name']],_0x56b1ef[_0x17e25c]);}return _0x18da84['voiceQueues'];};};Realtime[_0xb34a('0x3c')][_0xb34a('0x55')]=function(){var _0x5193c6=this;return function(_0x39cc17){clearVoiceQueues(_0x5193c6[_0xb34a('0x14')]);if(_0x39cc17){_0x39cc17=_[_0xb34a('0x56')](_0x39cc17,_0xb34a('0x57'));for(var _0x1c4f88 in _0x39cc17){if(_0x39cc17[_0xb34a('0x26')](_0x1c4f88)){var _0x30c03d={};for(var _0x19151c=0x0;_0x19151c<_0x39cc17[_0x1c4f88][_0xb34a('0x3d')];_0x19151c+=0x1){var _0x3a99a0=_0x39cc17[_0x1c4f88][_0x19151c][_0xb34a('0x58')];if(_0x5193c6['voiceQueues'][_0x3a99a0]){if(_0x39cc17[_0x1c4f88][_0x19151c][_0xb34a('0x59')]){_0x5193c6[_0xb34a('0x14')][_0x3a99a0][_0xb34a('0x5a')]+=0x1;}if(_0x39cc17[_0x1c4f88][_0x19151c][_0xb34a('0x5b')]){_0x5193c6[_0xb34a('0x14')][_0x3a99a0][_0xb34a('0x30')]+=0x1;}_0x5193c6['voiceQueues'][_0x3a99a0][_0xb34a('0x31')]+=moment(_0x39cc17[_0x1c4f88][_0x19151c][_0xb34a('0x5c')])[_0xb34a('0x5d')](moment(_0x39cc17[_0x1c4f88][_0x19151c][_0xb34a('0x5e')]),_0xb34a('0x5f'))||0x0;if(_0x19151c===_0x39cc17[_0x1c4f88][_0xb34a('0x3d')]-0x1){_0x5193c6[_0xb34a('0x14')][_0x3a99a0][_0xb34a('0x2b')]+=moment(_0x39cc17[_0x1c4f88][_0x19151c]['queuecallercompleteAt']||_0x39cc17[_0x1c4f88][_0x19151c][_0xb34a('0x60')]||_0x39cc17[_0x1c4f88][_0x19151c][_0xb34a('0x61')])[_0xb34a('0x5d')](moment(_0x39cc17[_0x1c4f88][_0x19151c][_0xb34a('0x5e')]),_0xb34a('0x5f'))||0x0;_0x5193c6[_0xb34a('0x14')][_0x3a99a0][_0xb34a('0x29')]+=0x1;if(_0x39cc17[_0x1c4f88][_0x19151c][_0xb34a('0x62')]){_0x5193c6['voiceQueues'][_0x3a99a0][_0xb34a('0x2a')]+=0x1;_0x5193c6[_0xb34a('0x14')][_0x3a99a0][_0xb34a('0x2c')]+=moment(_0x39cc17[_0x1c4f88][_0x19151c]['queuecallercompleteAt'])[_0xb34a('0x5d')](moment(_0x39cc17[_0x1c4f88][_0x19151c][_0xb34a('0x5c')]),_0xb34a('0x5f'))||0x0;}}else{_0x5193c6[_0xb34a('0x14')][_0x3a99a0][_0xb34a('0x2b')]+=_0x5193c6[_0xb34a('0x14')][_0x3a99a0]['sumHoldTime']||0x0;}}}}}}return _0x5193c6[_0xb34a('0x14')];};};Realtime[_0xb34a('0x3c')]['initVoiceCallReports']=function(){var _0x5521e1=this;return function(_0x15d7e5){clearVoiceCallReports(_0x5521e1['outbound']);if(_0x15d7e5){for(var _0x1b23ba=0x0;_0x1b23ba<_0x15d7e5[_0xb34a('0x3d')];_0x1b23ba+=0x1){_0x5521e1[_0xb34a('0x63')][_0xb34a('0x29')]+=0x1;_0x5521e1[_0xb34a('0x63')][_0xb34a('0x2b')]+=_0x15d7e5[_0x1b23ba]['duration'];if(_0x15d7e5[_0x1b23ba][_0xb34a('0x64')]===_0xb34a('0x65')){_0x5521e1[_0xb34a('0x63')][_0xb34a('0x2a')]+=0x1;_0x5521e1[_0xb34a('0x63')]['sumHoldTime']+=_0x15d7e5[_0x1b23ba][_0xb34a('0x66')]-_0x15d7e5[_0x1b23ba][_0xb34a('0x67')]||0x0;_0x5521e1['outbound'][_0xb34a('0x2c')]+=_0x15d7e5[_0x1b23ba][_0xb34a('0x67')];}}}return _0x5521e1[_0xb34a('0x63')];};};Realtime[_0xb34a('0x3c')]['initCampaigns']=function(){var _0x80b5b3=this;return function(_0x30b02e){if(_0x30b02e){freeIsNotKey(_0x30b02e,_0x80b5b3[_0xb34a('0x68')],_0xb34a('0x3e'));for(var _0x28c079=0x0,_0x34eefa={};_0x28c079<_0x30b02e[_0xb34a('0x3d')];_0x28c079+=0x1){_0x34eefa=_0x30b02e[_0x28c079];if(_['isUndefined'](_0x80b5b3['campaigns'][_0x34eefa['name']])){_0x80b5b3[_0xb34a('0x68')][_0x34eefa[_0xb34a('0x3e')]]=new Campaign(_0x34eefa);}else{_0x80b5b3[_0xb34a('0x41')](_0x80b5b3[_0xb34a('0x68')][_0x34eefa[_0xb34a('0x3e')]],_0x34eefa);_0x80b5b3[_0xb34a('0x68')][_0x34eefa[_0xb34a('0x3e')]][_0xb34a('0x69')]=_0x34eefa[_0xb34a('0x6a')]?_0x34eefa[_0xb34a('0x6a')][_0xb34a('0x3e')]:undefined;}}}return _0x80b5b3[_0xb34a('0x68')];};};Realtime[_0xb34a('0x3c')][_0xb34a('0x6b')]=function(){var _0x35837b=this;return function(_0x565dc2){if(_0x565dc2){freeIsNotKey(_0x565dc2,_0x35837b[_0xb34a('0x16')],'id');for(var _0x5acd61=0x0,_0x24f81b={};_0x5acd61<_0x565dc2[_0xb34a('0x3d')];_0x5acd61+=0x1){_0x24f81b=_0x565dc2[_0x5acd61];if(_[_0xb34a('0x3f')](_0x35837b[_0xb34a('0x16')][_0x24f81b['id']])){_0x35837b['voiceExtensions'][_0x24f81b['id']]=new VoiceExtension(_0x24f81b);}else{_0x35837b[_0xb34a('0x41')](_0x35837b[_0xb34a('0x16')][_0x24f81b['id']],_0x24f81b);}}}return _0x35837b['voiceExtensions'];};};Realtime['prototype'][_0xb34a('0x6c')]=function(){var _0x8e6bf0=this;return function(_0x478a09){clearCampaigns(_0x8e6bf0[_0xb34a('0x68')]);for(var _0x2ca2cf=0x0;_0x2ca2cf<_0x478a09['length'];_0x2ca2cf+=0x1){_['merge'](_0x8e6bf0['campaigns'][_0x478a09[_0x2ca2cf][_0xb34a('0x3e')]],_0x478a09[_0x2ca2cf]);}return _0x8e6bf0[_0xb34a('0x68')];};};Realtime[_0xb34a('0x3c')][_0xb34a('0x6d')]=function(){var _0xa9640c=this;return function(_0xc16eed){if(_0xc16eed){freeIsNotKey(_0xc16eed,_0xa9640c[_0xb34a('0x22')],'id');for(var _0x126d77=0x0,_0x4d35ca={},_0x550450={};_0x126d77<_0xc16eed[_0xb34a('0x3d')];_0x126d77+=0x1){_0x4d35ca=_0xc16eed[_0x126d77];if(_[_0xb34a('0x3f')](_0xa9640c[_0xb34a('0x22')][_0x4d35ca['id']])){_0xa9640c[_0xb34a('0x22')][_0x4d35ca['id']]=new FaxAccount(_0x4d35ca);}else{_0xa9640c[_0xb34a('0x41')](_0xa9640c[_0xb34a('0x22')][_0x4d35ca['id']],_0x4d35ca);}}}return _0xa9640c[_0xb34a('0x22')];};};module[_0xb34a('0x6e')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 443ae4a..c54a087 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 _0xb7d9=['channel','split','calleridnum','outbound','internal','destination','exten','dialer','lastapplication','lastdata','queue','context','callerid','from-sip','xcally-motion-preview','calleridpreview','originatecalleridnum','destinationchannel','disposition','ANSWERED','connectedlinenum','\x22%s\x22\x20<%s>','calleridname','transfers','linkedid','transfereelinkedid','blindTransfer','type','UserId','membername','monitor','monitorFilename','monitors','createdAt','connectedlinename','xcally-motion-dialer','startsWith','Local','substring','indexOf','mobile','phone','transfererlinkedid','lodash','util','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceCallReport','./voiceDialReport','./userReport','agents','telephones','prototype','sync','realtime','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','voiceAgentReport','voiceDialReport','blindtransfer','attendedtransfer','attendedTransfer','findAgent','find','accountcode','name','isNil','interface','SIP/%s','length','lastAssignedTo','format','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','YYYY-MM-DD\x20HH:mm:ss','create','match','getAgentByInternal','keys','getCallType'];(function(_0x28e71a,_0x4405bd){var _0x268fed=function(_0x404197){while(--_0x404197){_0x28e71a['push'](_0x28e71a['shift']());}};_0x268fed(++_0x4405bd);}(_0xb7d9,0x85));var _0x9b7d=function(_0x37cb86,_0x456e6d){_0x37cb86=_0x37cb86-0x0;var _0x5d1aa8=_0xb7d9[_0x37cb86];return _0x5d1aa8;};'use strict';var _=require(_0x9b7d('0x0'));var moment=require('moment');var util=require(_0x9b7d('0x1'));var config=require('../../../config/environment');var ami=require('../ami');var RpcVoiceAgentReport=require(_0x9b7d('0x2'));var RpcVoiceCallReport=require(_0x9b7d('0x3'));var RpcVoiceDialReport=require(_0x9b7d('0x4'));var RpcMemberReport=require(_0x9b7d('0x5'));var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require(_0x9b7d('0x6'));var RpcVoiceTransferReport=require(_0x9b7d('0x7'));var VoiceQueueReport=require('./voiceQueueReport');var VoiceCallReport=require(_0x9b7d('0x8'));var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require(_0x9b7d('0x9'));var UserReport=require(_0x9b7d('0xa'));function Report(_0x3d3f4f){this['realtime']=_0x3d3f4f;this[_0x9b7d('0xb')]=_0x3d3f4f[_0x9b7d('0xb')];this['telephones']=_0x3d3f4f[_0x9b7d('0xc')];}Report[_0x9b7d('0xd')][_0x9b7d('0xe')]=function(_0x4fa5f5){var _0x36b8df=new VoiceQueueReport(this[_0x9b7d('0xf')]);var _0x15728d=new VoiceAgentReport(this['realtime']);var _0x3a5623=new VoiceDialReport(this[_0x9b7d('0xf')]);var _0x3f1900=new VoiceCallReport(this[_0x9b7d('0xf')]);var _0x56ad3a=new UserReport(this[_0x9b7d('0xf')]);if(config[_0x9b7d('0x10')]&&config['xdr'][_0x9b7d('0x11')]){ami['on'](_0x9b7d('0x12'),this[_0x9b7d('0x13')][_0x9b7d('0x14')](this));ami['on'](_0x9b7d('0x15'),this[_0x9b7d('0x16')][_0x9b7d('0x14')](this));ami['on']('custom:voiceAgentReport',this[_0x9b7d('0x17')][_0x9b7d('0x14')](this));ami['on']('custom:voiceDialReport',this[_0x9b7d('0x18')][_0x9b7d('0x14')](this));ami['on'](_0x9b7d('0x19'),this['blindTransfer'][_0x9b7d('0x14')](this));ami['on'](_0x9b7d('0x1a'),this[_0x9b7d('0x1b')]['bind'](this));}};Report[_0x9b7d('0xd')][_0x9b7d('0x1c')]=function(_0x36df00){var _0x114ccf;_0x114ccf=_[_0x9b7d('0x1d')](this['agents'],function(_0x599d80){return _0x599d80[_0x9b7d('0x1e')]==_0x36df00||_0x599d80[_0x9b7d('0x1f')]==_0x36df00;});if(_[_0x9b7d('0x20')](_0x114ccf)){var _0x54b169=_['find'](this[_0x9b7d('0xc')],function(_0xb08432){return _0xb08432[_0x9b7d('0x1e')]==_0x36df00||_0xb08432[_0x9b7d('0x1f')]==_0x36df00;});if(_0x54b169){_0x114ccf=_['find'](this[_0x9b7d('0xb')],function(_0x3166a2){return _0x3166a2[_0x9b7d('0x21')]==util['format'](_0x9b7d('0x22'),_0x54b169[_0x9b7d('0x1f')]);});}}return _0x114ccf;};Report[_0x9b7d('0xd')][_0x9b7d('0x13')]=function(_0x56b77d){for(var _0xbc6ca8=0x0;_0xbc6ca8<_0x56b77d[_0x9b7d('0x23')];_0xbc6ca8+=0x1){var _0x2c0afd=this[_0x9b7d('0x1c')](_0x56b77d[_0xbc6ca8]['connectedlinenum']);if(_0x2c0afd){_0x56b77d[_0xbc6ca8][_0x9b7d('0x1e')]=_0x2c0afd[_0x9b7d('0x1e')];_0x56b77d[_0xbc6ca8]['assigned']=!![];_0x56b77d[_0xbc6ca8][_0x9b7d('0x24')]=_0x2c0afd[_0x9b7d('0x1f')];_0x56b77d[_0xbc6ca8]['interface']=_['isNil'](_0x2c0afd['interface'])?util[_0x9b7d('0x25')](_0x9b7d('0x22'),_0x2c0afd[_0x9b7d('0x1f')]):_0x2c0afd[_0x9b7d('0x21')];if(_0x56b77d[_0xbc6ca8]['queuecallercomplete']){_0x56b77d[_0xbc6ca8][_0x9b7d('0x26')]=moment()[_0x9b7d('0x25')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x56b77d[_0xbc6ca8][_0x9b7d('0x27')]){_0x56b77d[_0xbc6ca8][_0x9b7d('0x28')]=moment()['format'](_0x9b7d('0x29'));}RpcMemberReport[_0x9b7d('0x13')](_0x56b77d[_0xbc6ca8]);}RpcVoiceQueueReport[_0x9b7d('0x2a')](_0x56b77d[_0xbc6ca8]);}};function extractCalleridNumber(_0xcb88a7){var _0x10783f=_0xcb88a7[_0x9b7d('0x2b')](/<(.*?)>/);return _0x10783f?_0x10783f[0x1]:_0xcb88a7;}Report['prototype'][_0x9b7d('0x2c')]=function(_0x27fd68){for(var _0x33c12e=0x0;_0x33c12e','calleridname','linkedid','transfers','transfereelinkedid','uniqueid','UserId','membername','monitor','monitors','monitorFilename','filename','createdAt','xcally-motion-preview','connectedlinename','xcally-motion-dialer','isArray','Local','substring','indexOf','mobile','phone','lastIndexOf','blindTransfer','transfererlinkedid','exports','lodash','moment','util','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','sync','xdr','disabled','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport'];(function(_0x2f0972,_0x42ddf5){var _0x27aeb7=function(_0x516737){while(--_0x516737){_0x2f0972['push'](_0x2f0972['shift']());}};_0x27aeb7(++_0x42ddf5);}(_0xc6fa,0xab));var _0xac6f=function(_0x3132e8,_0x499a0e){_0x3132e8=_0x3132e8-0x0;var _0x43eb8c=_0xc6fa[_0x3132e8];return _0x43eb8c;};'use strict';var _=require(_0xac6f('0x0'));var moment=require(_0xac6f('0x1'));var util=require(_0xac6f('0x2'));var config=require('../../../config/environment');var ami=require(_0xac6f('0x3'));var RpcVoiceAgentReport=require(_0xac6f('0x4'));var RpcVoiceCallReport=require(_0xac6f('0x5'));var RpcVoiceDialReport=require(_0xac6f('0x6'));var RpcMemberReport=require(_0xac6f('0x7'));var RpcVoiceQueueReport=require(_0xac6f('0x8'));var RpcVoiceRecording=require(_0xac6f('0x9'));var RpcVoiceTransferReport=require(_0xac6f('0xa'));var VoiceQueueReport=require(_0xac6f('0xb'));var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require(_0xac6f('0xc'));var VoiceDialReport=require(_0xac6f('0xd'));var UserReport=require(_0xac6f('0xe'));function Report(_0x4e5594){this[_0xac6f('0xf')]=_0x4e5594;this[_0xac6f('0x10')]=_0x4e5594[_0xac6f('0x10')];this['telephones']=_0x4e5594[_0xac6f('0x11')];}Report['prototype'][_0xac6f('0x12')]=function(_0xc3f20d){var _0x19120d=new VoiceQueueReport(this['realtime']);var _0x35a84d=new VoiceAgentReport(this[_0xac6f('0xf')]);var _0x47d3ca=new VoiceDialReport(this['realtime']);var _0x1f9bde=new VoiceCallReport(this['realtime']);var _0x4e9203=new UserReport(this[_0xac6f('0xf')]);if(config['xdr']&&config[_0xac6f('0x13')][_0xac6f('0x14')]){ami['on']('custom:voiceQueueReport',this[_0xac6f('0x15')][_0xac6f('0x16')](this));ami['on'](_0xac6f('0x17'),this[_0xac6f('0x18')][_0xac6f('0x16')](this));ami['on']('custom:voiceAgentReport',this[_0xac6f('0x19')][_0xac6f('0x16')](this));ami['on'](_0xac6f('0x1a'),this[_0xac6f('0x1b')]['bind'](this));ami['on'](_0xac6f('0x1c'),this['blindTransfer'][_0xac6f('0x16')](this));ami['on'](_0xac6f('0x1d'),this[_0xac6f('0x1e')][_0xac6f('0x16')](this));}};Report[_0xac6f('0x1f')][_0xac6f('0x20')]=function(_0x4a61de){var _0x2f0f79;_0x2f0f79=_[_0xac6f('0x21')](this[_0xac6f('0x10')],function(_0x9b1654){return _0x9b1654[_0xac6f('0x22')]==_0x4a61de||_0x9b1654[_0xac6f('0x23')]==_0x4a61de;});if(_[_0xac6f('0x24')](_0x2f0f79)){var _0x6fc23e=_[_0xac6f('0x21')](this['telephones'],function(_0x1474d2){return _0x1474d2['accountcode']==_0x4a61de||_0x1474d2[_0xac6f('0x23')]==_0x4a61de;});if(_0x6fc23e){_0x2f0f79=_[_0xac6f('0x21')](this[_0xac6f('0x10')],function(_0x212ec3){return _0x212ec3[_0xac6f('0x25')]==util[_0xac6f('0x26')](_0xac6f('0x27'),_0x6fc23e[_0xac6f('0x23')]);});}}return _0x2f0f79;};Report[_0xac6f('0x1f')][_0xac6f('0x15')]=function(_0x5dca01){for(var _0x1bfdae=0x0;_0x1bfdae<_0x5dca01[_0xac6f('0x28')];_0x1bfdae+=0x1){var _0x589136=this[_0xac6f('0x20')](_0x5dca01[_0x1bfdae]['connectedlinenum']);if(_0x589136){_0x5dca01[_0x1bfdae][_0xac6f('0x22')]=_0x589136['accountcode'];_0x5dca01[_0x1bfdae][_0xac6f('0x29')]=!![];_0x5dca01[_0x1bfdae]['lastAssignedTo']=_0x589136[_0xac6f('0x23')];_0x5dca01[_0x1bfdae][_0xac6f('0x25')]=_[_0xac6f('0x24')](_0x589136[_0xac6f('0x25')])?util[_0xac6f('0x26')]('SIP/%s',_0x589136[_0xac6f('0x23')]):_0x589136[_0xac6f('0x25')];if(_0x5dca01[_0x1bfdae]['queuecallercomplete']){_0x5dca01[_0x1bfdae][_0xac6f('0x2a')]=moment()['format'](_0xac6f('0x2b'));}if(_0x5dca01[_0x1bfdae][_0xac6f('0x2c')]){_0x5dca01[_0x1bfdae][_0xac6f('0x2d')]=moment()[_0xac6f('0x26')]('YYYY-MM-DD\x20HH:mm:ss');}RpcMemberReport[_0xac6f('0x15')](_0x5dca01[_0x1bfdae]);}RpcVoiceQueueReport[_0xac6f('0x2e')](_0x5dca01[_0x1bfdae]);}};function extractCalleridNumber(_0x499297){var _0x404ba4=_0x499297[_0xac6f('0x2f')](/<(.*?)>/);return _0x404ba4?_0x404ba4[0x1]:_0x499297;}Report[_0xac6f('0x1f')][_0xac6f('0x30')]=function(_0x33e57e){for(var _0x4d2abc=0x0;_0x4d2abc0x0?_0x209284:0x0;this['voiceQueues'][_0x13f853[_0x374d('0x6c')]][_0x374d('0x30')]=this[_0x374d('0x13')][_0x13f853[_0x374d('0x6c')]][_0x374d('0x30')]>_[_0x374d('0x71')](_0x13f853['loggedin'])?_['toNumber'](_0x13f853[_0x374d('0x73')]):this[_0x374d('0x13')][_0x13f853[_0x374d('0x6c')]][_0x374d('0x30')];this['emitVoiceQueueSummary'](this[_0x374d('0x13')][_0x13f853[_0x374d('0x6c')]],_0x374d('0x17'));}logger[_0x374d('0x61')]('[voiceQueueReport][queuesummary]\x20sending\x20queuesummary\x20event:',util[_0x374d('0x3f')](this[_0x374d('0x13')][_0x13f853[_0x374d('0x6c')]],{'showHidden':![],'depth':null}));ami[_0x374d('0x45')](_0x374d('0x74'),this[_0x374d('0x13')][_0x13f853[_0x374d('0x6c')]]);}}}catch(_0x4e1a42){logger[_0x374d('0x3d')](_0x374d('0x6a'),util[_0x374d('0x3f')](_0x4e1a42,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x374d('0xd')]['syncQueueSummaryComplete']=function(_0x16b028){logger['debug']('[voiceQueueReport][queuesummarycomplete]\x20event:',util[_0x374d('0x3f')](_0x16b028,{'showHidden':![],'depth':null}));this[_0x374d('0x14')]=!![];};VoiceQueueReport['prototype']['syncQueueCallerJoin']=function(_0x4e00ab){try{if(this['isNotNull'](_0x4e00ab)){logger[_0x374d('0x61')](_0x374d('0x75'),_0x4e00ab['uniqueid'],util[_0x374d('0x3f')](_0x4e00ab,{'showHidden':![],'depth':null}));if(_['isUndefined'](this['queueReports'][_0x4e00ab[_0x374d('0x76')]]))this[_0x374d('0x11')][_0x4e00ab[_0x374d('0x76')]]=[];if(_[_0x374d('0x64')](this[_0x374d('0x34')][_0x4e00ab['uniqueid']]))this[_0x374d('0x34')][_0x4e00ab['uniqueid']]={};var _0x6fc4bf=new QueueReport();_0x6fc4bf[_0x374d('0x4a')]=_0x4e00ab['queue'];_0x6fc4bf[_0x374d('0x59')]=this[_0x374d('0x13')][_0x6fc4bf['name']]&&this[_0x374d('0x13')][_0x6fc4bf[_0x374d('0x4a')]][_0x374d('0x59')]?this[_0x374d('0x13')][_0x6fc4bf[_0x374d('0x4a')]]['type']||_0x374d('0x52'):'inbound';_0x6fc4bf[_0x374d('0x6c')]=_0x4e00ab[_0x374d('0x6c')];_0x6fc4bf[_0x374d('0x77')]=moment()['format'](_0x374d('0x78'));_0x6fc4bf[_0x374d('0x79')]=_0x4e00ab[_0x374d('0x79')];_0x6fc4bf[_0x374d('0x7a')]=_0x4e00ab[_0x374d('0x7a')];_0x6fc4bf[_0x374d('0x76')]=_0x4e00ab['uniqueid'];_0x6fc4bf['routealias']=this[_0x374d('0x34')][_0x4e00ab[_0x374d('0x76')]][_0x374d('0x7b')];logger[_0x374d('0x6e')](_0x374d('0x7c'),_0x6fc4bf[_0x374d('0x4a')],_0x6fc4bf['type']);_[_0x374d('0x7d')](_0x6fc4bf,_[_0x374d('0x7e')](_0x4e00ab,_[_0x374d('0x7f')](_0x6fc4bf)));this[_0x374d('0x11')][_0x4e00ab[_0x374d('0x76')]]['push'](_0x6fc4bf);this['channels'][_0x4e00ab[_0x374d('0x76')]]=_0x6fc4bf;this[_0x374d('0x46')](_0x6fc4bf,_0x374d('0x80'));}}catch(_0x4e09b7){logger['error'](_0x374d('0x75'),_0x4e00ab['uniqueid'],util[_0x374d('0x3f')](_0x4e09b7,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x374d('0x1c')]=function(_0xc17e4e){try{if(this[_0x374d('0x6b')](_0xc17e4e)){logger[_0x374d('0x61')](_0x374d('0x81'),_0xc17e4e['uniqueid'],util[_0x374d('0x3f')](_0xc17e4e,{'showHidden':![],'depth':null}));if(this[_0x374d('0x11')][_0xc17e4e['uniqueid']]){var _0x7cc9b=_[_0x374d('0x82')](this[_0x374d('0x11')][_0xc17e4e[_0x374d('0x76')]]);_0x7cc9b[_0x374d('0x83')]=![];_0x7cc9b[_0x374d('0x84')]=null;_0x7cc9b[_0x374d('0x85')]=_0xc17e4e[_0x374d('0x85')];_0x7cc9b[_0x374d('0x86')]=_0xc17e4e['originalposition'];_0x7cc9b[_0x374d('0x1b')]=!![];_0x7cc9b[_0x374d('0x87')]=moment()[_0x374d('0x4e')](_0x374d('0x78'));_0x7cc9b['queuecallerexitreason']=_0x374d('0x88');_0x7cc9b[_0x374d('0x89')]=null;logger[_0x374d('0x6e')]('[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s',_0x7cc9b['name'],_0x7cc9b['type']);this['channels'][_0xc17e4e[_0x374d('0x76')]]=_0x7cc9b;this[_0x374d('0x44')](_0x7cc9b,_0x374d('0x1b'));}}}catch(_0x226f16){logger[_0x374d('0x3d')]('[%s][voiceQueueReport][queuecallerabandon]',_0xc17e4e[_0x374d('0x76')],util['inspect'](_0x226f16,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x374d('0xd')]['syncQueueCallerLeave']=function(_0x3c193d){try{if(this[_0x374d('0x6b')](_0x3c193d)){logger[_0x374d('0x61')]('[%s][voiceQueueReport][queuecallerleave]',_0x3c193d[_0x374d('0x76')],util[_0x374d('0x3f')](_0x3c193d,{'showHidden':![],'depth':null}));if(this[_0x374d('0x11')][_0x3c193d[_0x374d('0x76')]]){var _0x5b7b20=_[_0x374d('0x82')](this[_0x374d('0x11')][_0x3c193d[_0x374d('0x76')]]);_0x5b7b20[_0x374d('0x8a')]=moment()[_0x374d('0x4e')](_0x374d('0x78'));_0x5b7b20[_0x374d('0x8b')]=_0x3c193d[_0x374d('0x8b')];_0x5b7b20[_0x374d('0x8c')]=_0x3c193d[_0x374d('0x8c')];logger[_0x374d('0x6e')](_0x374d('0x8d'),_0x5b7b20[_0x374d('0x4a')],_0x5b7b20['type'],_0x3c193d['connectedlinenum'],_0x3c193d[_0x374d('0x8c')]);this[_0x374d('0x34')][_0x3c193d[_0x374d('0x76')]]=_0x5b7b20;this[_0x374d('0x46')](_0x5b7b20,'queuecallerleave');}}}catch(_0x542e5b){logger[_0x374d('0x3d')](_0x374d('0x8e'),_0x3c193d[_0x374d('0x76')],util[_0x374d('0x3f')](_0x542e5b,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x374d('0xd')][_0x374d('0x21')]=function(_0x1d29c8){try{if(this[_0x374d('0x6b')](_0x1d29c8)){logger[_0x374d('0x61')]('[%s][voiceQueueReport][agentconnect]',_0x1d29c8[_0x374d('0x76')],util['inspect'](_0x1d29c8,{'showHidden':![],'depth':null}));if(this[_0x374d('0x11')][_0x1d29c8[_0x374d('0x76')]]){var _0x34730d=_[_0x374d('0x82')](this[_0x374d('0x11')][_0x1d29c8['uniqueid']]);_0x34730d[_0x374d('0x83')]=!![];_0x34730d[_0x374d('0x4c')]='COMPLETEDBYAGENT';logger[_0x374d('0x6e')](_0x374d('0x8f'),_0x34730d[_0x374d('0x4a')],_0x34730d['type']);}}}catch(_0x415cb1){logger[_0x374d('0x3d')](_0x374d('0x90'),_0x1d29c8[_0x374d('0x76')],util['inspect'](_0x415cb1,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x374d('0xd')]['syncAgentComplete']=function(_0x11f869){try{if(this[_0x374d('0x6b')](_0x11f869)){logger['debug'](_0x374d('0x91'),_0x11f869['uniqueid'],util[_0x374d('0x3f')](_0x11f869,{'showHidden':![],'depth':null}));if(this[_0x374d('0x11')][_0x11f869['uniqueid']]){var _0xabd2c7=_[_0x374d('0x82')](this[_0x374d('0x11')][_0x11f869[_0x374d('0x76')]]);_0xabd2c7[_0x374d('0x1b')]=![];_0xabd2c7[_0x374d('0x87')]=null;_0xabd2c7[_0x374d('0x92')]=!![];_0xabd2c7[_0x374d('0x89')]=_0x11f869[_0x374d('0x93')];_0xabd2c7[_0x374d('0x85')]=_0x11f869[_0x374d('0x85')];_0xabd2c7[_0x374d('0x83')]=!![];_0xabd2c7['queuecallerexit']=![];_0xabd2c7['queuecallerexitAt']=null;if(!_0xabd2c7[_0x374d('0x94')]){if(_0x11f869[_0x374d('0x95')]=='transfer'){_0xabd2c7[_0x374d('0x4c')]=_0x374d('0x96');logger[_0x374d('0x6e')](_0x374d('0x97'),_0xabd2c7[_0x374d('0x4a')],_0xabd2c7[_0x374d('0x59')]);}else{if(_[_0x374d('0x98')](_0x11f869['channel'][_0x374d('0x99')](),_0x374d('0x9a'))){if(this[_0x374d('0x11')][_0x11f869[_0x374d('0x9b')]]){var _0x18bd45=_[_0x374d('0x82')](this[_0x374d('0x11')][_0x11f869[_0x374d('0x9b')]]);_0x18bd45['queuecallercomplete']=![];_0x18bd45['queuecallerexit']=!![];_0x18bd45[_0x374d('0x9c')]=moment(_0xabd2c7['queuecallerjoinAt'])['add'](_0x11f869[_0x374d('0x85')],_0x374d('0x9d'))[_0x374d('0x4e')](_0x374d('0x78'));_0x18bd45['queuecallerexitreason']=_0x374d('0x9e');_0x18bd45[_0x374d('0x94')]=!![];_0x18bd45[_0x374d('0x9f')]=_0x374d('0xa0');_0x18bd45[_0x374d('0xa1')]=_0x11f869[_0x374d('0xa2')];_0x18bd45[_0x374d('0xa3')]=_0x11f869['uniqueid'];logger[_0x374d('0x6e')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER',_0x18bd45[_0x374d('0x4a')],_0x18bd45[_0x374d('0x59')]);var _0x5484dc=this[_0x374d('0x11')][_0x11f869[_0x374d('0x9b')]];this[_0x374d('0x11')][_0x11f869[_0x374d('0x9b')]]=this[_0x374d('0x11')][_0x11f869[_0x374d('0x76')]];this['queueReports'][_0x11f869[_0x374d('0x76')]]=_0x5484dc;}}else{_0xabd2c7[_0x374d('0x4c')]='COMPLETEDBY'+_0x11f869[_0x374d('0x95')][_0x374d('0xa4')]();logger[_0x374d('0x6e')](_0x374d('0xa5'),_0xabd2c7[_0x374d('0x4a')],_0xabd2c7[_0x374d('0x59')],_0xabd2c7[_0x374d('0x4c')]);}}}this['channels'][_0x11f869['uniqueid']]=_0xabd2c7;this['emitVoiceQueueChannelRemove'](_0xabd2c7,_0x374d('0x1e'));}}}catch(_0x3d66fd){logger[_0x374d('0x3d')](_0x374d('0x91'),_0x11f869[_0x374d('0x76')],util[_0x374d('0x3f')](_0x3d66fd,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x374d('0xa6')]=function(_0x319788){try{if(this['isNotNull'](_0x319788)){logger[_0x374d('0x61')](_0x374d('0xa7'),_0x319788['uniqueid'],util[_0x374d('0x3f')](_0x319788,{'showHidden':![],'depth':null}));this['addVariable'](_0x319788[_0x374d('0x76')],_['keys'](_0x319788[_0x374d('0xa8')])[0x0],_0x319788['value']);if(this[_0x374d('0x11')][_0x319788[_0x374d('0x76')]]){var _0x8634a1=_[_0x374d('0x82')](this[_0x374d('0x11')][_0x319788[_0x374d('0x76')]]);if(_0x8634a1){if(this[_0x374d('0x6b')](_0x319788['variable'])&&this['isNotNull'](_0x319788[_0x374d('0xa8')]['queuestatus'])){switch(_0x319788[_0x374d('0xa9')]){case _0x374d('0xaa'):_0x8634a1[_0x374d('0xab')]=![];_0x8634a1[_0x374d('0x9c')]=null;break;case _0x374d('0xac'):_0x8634a1[_0x374d('0xad')]=_0x374d('0xae');_0x8634a1[_0x374d('0xab')]=!![];_0x8634a1['queuecallerexitAt']=moment()[_0x374d('0x4e')](_0x374d('0x78'));_0x8634a1[_0x374d('0x8a')]=moment()[_0x374d('0x4e')]('YYYY-MM-DD\x20HH:mm:ss');logger[_0x374d('0x61')](_0x374d('0xaf'),_0x319788[_0x374d('0x76')],util[_0x374d('0x3f')](_0x8634a1,{'showHidden':![],'depth':null}));ami[_0x374d('0x45')](_0x374d('0xb0'),_0x8634a1);break;default:_0x8634a1['queuecallerexit']=!![];_0x8634a1[_0x374d('0x9c')]=moment()[_0x374d('0x4e')](_0x374d('0x78'));_0x8634a1['queuecallerleaveAt']=moment()['format'](_0x374d('0x78'));}_0x8634a1['queuecallerabandon']=![];_0x8634a1[_0x374d('0x87')]=null;_0x8634a1[_0x374d('0x4c')]=_0x319788['value'];this[_0x374d('0x34')][_0x319788[_0x374d('0x76')]]=_0x8634a1;this[_0x374d('0x44')](_0x8634a1,'varset');}else if(this['isNotNull'](_0x319788['variable'])&&this[_0x374d('0x6b')](_0x319788[_0x374d('0xa8')]['queueposition'])){if(!_0x8634a1['queuecallerabandon']){_0x8634a1[_0x374d('0xab')]=!![];_0x8634a1[_0x374d('0x9c')]=moment()[_0x374d('0x4e')](_0x374d('0x78'));_0x8634a1['queuecallerexitreason']=_0x374d('0xb1');_0x8634a1[_0x374d('0x8a')]=moment()[_0x374d('0x4e')](_0x374d('0x78'));this[_0x374d('0x34')][_0x319788['uniqueid']]=_0x8634a1;}}logger[_0x374d('0x6e')](_0x374d('0xb2'),_0x319788['uniqueid'],_0x8634a1[_0x374d('0x4a')],_0x8634a1[_0x374d('0x59')],_[_0x374d('0x7f')](_0x319788['variable'])[0x0],_0x319788['value']);_0x8634a1[_0x374d('0x16')]=this[_0x374d('0x16')][_0x319788[_0x374d('0x76')]];}}}}catch(_0x2e5879){logger[_0x374d('0x3d')](_0x374d('0xa7'),_0x319788[_0x374d('0x76')],util[_0x374d('0x3f')](_0x2e5879,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x374d('0xd')][_0x374d('0xb3')]=function(_0x4a7d73,_0x189ca6,_0x7fc2a2){var _0x57c477=[_0x374d('0xb4'),_0x374d('0xb5'),'rtpaudioqosjitter',_0x374d('0xb6'),'rtpaudioqosloss',_0x374d('0xb7'),'rtpaudioqosrtt',_0x374d('0xb8'),_0x374d('0xb9'),_0x374d('0xba'),_0x374d('0xbb'),_0x374d('0xbc'),_0x374d('0xbd'),_0x374d('0xbe'),_0x374d('0xbf'),_0x374d('0xc0'),_0x374d('0x93'),_0x374d('0xc1'),_0x374d('0xc2')];if(!_[_0x374d('0x37')](_0x189ca6)&&!_['includes'](_0x57c477,_0x189ca6)){if(_[_0x374d('0x64')](this[_0x374d('0x16')][_0x4a7d73])){this['variables'][_0x4a7d73]={};}this['variables'][_0x4a7d73][_0x189ca6]=_0x7fc2a2;}};VoiceQueueReport[_0x374d('0xd')][_0x374d('0x23')]=function(_0x31f8d2){try{if(this[_0x374d('0x6b')](_0x31f8d2)){logger['debug'](_0x374d('0xc3'),_0x31f8d2[_0x374d('0x76')],util[_0x374d('0x3f')](_0x31f8d2,{'showHidden':![],'depth':null}));if(this[_0x374d('0x11')][_0x31f8d2[_0x374d('0x76')]]){for(var _0x184016=0x0,_0x200410={};_0x1840160x0?_0x33e7a5:0x0;this[_0x6d35('0x44')][_0x275a0a['queue']][_0x6d35('0x5c')]=this[_0x6d35('0x44')][_0x275a0a[_0x6d35('0x6f')]][_0x6d35('0x5c')]>_[_0x6d35('0x74')](_0x275a0a[_0x6d35('0x76')])?_[_0x6d35('0x74')](_0x275a0a[_0x6d35('0x76')]):this['voiceQueues'][_0x275a0a[_0x6d35('0x6f')]][_0x6d35('0x5c')];this['emitVoiceQueueSummary'](this[_0x6d35('0x44')][_0x275a0a[_0x6d35('0x6f')]],_0x6d35('0x18'));}logger[_0x6d35('0x51')]('[voiceQueueReport][queuesummary]\x20sending\x20queuesummary\x20event:',util[_0x6d35('0x40')](this[_0x6d35('0x44')][_0x275a0a['queue']],{'showHidden':![],'depth':null}));ami[_0x6d35('0x47')](_0x6d35('0x77'),this[_0x6d35('0x44')][_0x275a0a[_0x6d35('0x6f')]]);}}}catch(_0x2b8ab0){logger[_0x6d35('0x3f')](_0x6d35('0x6e'),util[_0x6d35('0x40')](_0x2b8ab0,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6d35('0xe')][_0x6d35('0x1a')]=function(_0x21f3ea){logger[_0x6d35('0x51')](_0x6d35('0x78'),util['inspect'](_0x21f3ea,{'showHidden':![],'depth':null}));this[_0x6d35('0x6c')]=!![];};VoiceQueueReport[_0x6d35('0xe')][_0x6d35('0x79')]=function(_0x455a26){try{if(this[_0x6d35('0x68')](_0x455a26)){logger[_0x6d35('0x51')](_0x6d35('0x7a'),_0x455a26[_0x6d35('0x4b')],util['inspect'](_0x455a26,{'showHidden':![],'depth':null}));if(_[_0x6d35('0x69')](this['queueReports'][_0x455a26[_0x6d35('0x4b')]]))this[_0x6d35('0x12')][_0x455a26['uniqueid']]=[];if(_['isUndefined'](this['channels'][_0x455a26[_0x6d35('0x4b')]]))this[_0x6d35('0x14')][_0x455a26['uniqueid']]={};var _0x23b990=new QueueReport();_0x23b990['name']=_0x455a26[_0x6d35('0x6f')];_0x23b990['type']=this[_0x6d35('0x44')][_0x23b990[_0x6d35('0x4e')]]&&this['voiceQueues'][_0x23b990[_0x6d35('0x4e')]][_0x6d35('0x5e')]?this[_0x6d35('0x44')][_0x23b990[_0x6d35('0x4e')]][_0x6d35('0x5e')]||_0x6d35('0x58'):_0x6d35('0x58');_0x23b990['queue']=_0x455a26[_0x6d35('0x6f')];_0x23b990[_0x6d35('0x7b')]=moment()['format'](_0x6d35('0x7c'));_0x23b990[_0x6d35('0x7d')]=_0x455a26[_0x6d35('0x7d')];_0x23b990['count']=_0x455a26[_0x6d35('0x7e')];_0x23b990[_0x6d35('0x4b')]=_0x455a26[_0x6d35('0x4b')];_0x23b990[_0x6d35('0x7f')]=this[_0x6d35('0x14')][_0x455a26[_0x6d35('0x4b')]][_0x6d35('0x7f')];logger[_0x6d35('0x70')](_0x6d35('0x80'),_0x23b990['name'],_0x23b990['type']);_[_0x6d35('0x81')](_0x23b990,_['pick'](_0x455a26,_[_0x6d35('0x82')](_0x23b990)));this[_0x6d35('0x12')][_0x455a26['uniqueid']][_0x6d35('0x83')](_0x23b990);this[_0x6d35('0x14')][_0x455a26[_0x6d35('0x4b')]]=_0x23b990;this['emitVoiceQueueChannelSave'](_0x23b990,'queuecallerjoin');}}catch(_0x4ceca7){logger[_0x6d35('0x3f')]('[%s][voiceQueueReport][queuecallerjoin]',_0x455a26[_0x6d35('0x4b')],util[_0x6d35('0x40')](_0x4ceca7,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6d35('0xe')][_0x6d35('0x1e')]=function(_0x89e421){try{if(this['isNotNull'](_0x89e421)){logger[_0x6d35('0x51')](_0x6d35('0x84'),_0x89e421[_0x6d35('0x4b')],util['inspect'](_0x89e421,{'showHidden':![],'depth':null}));if(this[_0x6d35('0x12')][_0x89e421[_0x6d35('0x4b')]]){var _0x587d0c=_[_0x6d35('0x85')](this[_0x6d35('0x12')][_0x89e421[_0x6d35('0x4b')]]);_0x587d0c[_0x6d35('0x86')]=![];_0x587d0c['queuecallercompleteAt']=null;_0x587d0c['holdtime']=_0x89e421[_0x6d35('0x87')];_0x587d0c['originalposition']=_0x89e421[_0x6d35('0x88')];_0x587d0c[_0x6d35('0x1d')]=!![];_0x587d0c['queuecallerabandonAt']=moment()[_0x6d35('0x4c')]('YYYY-MM-DD\x20HH:mm:ss');_0x587d0c['queuecallerexitreason']=_0x6d35('0x89');_0x587d0c[_0x6d35('0x8a')]=null;logger['info'](_0x6d35('0x8b'),_0x587d0c[_0x6d35('0x4e')],_0x587d0c['type']);this['channels'][_0x89e421[_0x6d35('0x4b')]]=_0x587d0c;this[_0x6d35('0x45')](_0x587d0c,'queuecallerabandon');}}}catch(_0xbf8a25){logger['error'](_0x6d35('0x84'),_0x89e421[_0x6d35('0x4b')],util[_0x6d35('0x40')](_0xbf8a25,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6d35('0xe')][_0x6d35('0x20')]=function(_0x5aa04e){try{if(this[_0x6d35('0x68')](_0x5aa04e)){logger['debug'](_0x6d35('0x8c'),_0x5aa04e[_0x6d35('0x4b')],util['inspect'](_0x5aa04e,{'showHidden':![],'depth':null}));if(this[_0x6d35('0x12')][_0x5aa04e[_0x6d35('0x4b')]]){var _0x27ed37=_[_0x6d35('0x85')](this[_0x6d35('0x12')][_0x5aa04e['uniqueid']]);_0x27ed37[_0x6d35('0x8d')]=moment()[_0x6d35('0x4c')](_0x6d35('0x7c'));_0x27ed37[_0x6d35('0x8e')]=_0x5aa04e['connectedlinenum'];_0x27ed37['connectedlinename']=_0x5aa04e[_0x6d35('0x8f')];logger[_0x6d35('0x70')](_0x6d35('0x90'),_0x27ed37[_0x6d35('0x4e')],_0x27ed37[_0x6d35('0x5e')],_0x5aa04e[_0x6d35('0x8e')],_0x5aa04e[_0x6d35('0x8f')]);this[_0x6d35('0x14')][_0x5aa04e[_0x6d35('0x4b')]]=_0x27ed37;this[_0x6d35('0x48')](_0x27ed37,'queuecallerleave');}}}catch(_0xb7a34d){logger[_0x6d35('0x3f')](_0x6d35('0x8c'),_0x5aa04e[_0x6d35('0x4b')],util[_0x6d35('0x40')](_0xb7a34d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6d35('0xe')][_0x6d35('0x23')]=function(_0x1f4dc3){try{if(this['isNotNull'](_0x1f4dc3)){logger['debug'](_0x6d35('0x91'),_0x1f4dc3[_0x6d35('0x4b')],util[_0x6d35('0x40')](_0x1f4dc3,{'showHidden':![],'depth':null}));if(this[_0x6d35('0x12')][_0x1f4dc3[_0x6d35('0x4b')]]){var _0x2f2127=_[_0x6d35('0x85')](this[_0x6d35('0x12')][_0x1f4dc3[_0x6d35('0x4b')]]);_0x2f2127['queuecallercomplete']=!![];_0x2f2127[_0x6d35('0x53')]=_0x6d35('0x92');logger['info']('[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT',_0x2f2127['name'],_0x2f2127[_0x6d35('0x5e')]);}}}catch(_0xe5b6b8){logger['error'](_0x6d35('0x91'),_0x1f4dc3['uniqueid'],util[_0x6d35('0x40')](_0xe5b6b8,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncAgentComplete']=function(_0x1b889f){try{if(this['isNotNull'](_0x1b889f)){logger[_0x6d35('0x51')](_0x6d35('0x93'),_0x1b889f['uniqueid'],util[_0x6d35('0x40')](_0x1b889f,{'showHidden':![],'depth':null}));if(this[_0x6d35('0x12')][_0x1b889f[_0x6d35('0x4b')]]){var _0x3cbbee=_[_0x6d35('0x85')](this['queueReports'][_0x1b889f[_0x6d35('0x4b')]]);_0x3cbbee[_0x6d35('0x1d')]=![];_0x3cbbee[_0x6d35('0x94')]=null;_0x3cbbee[_0x6d35('0x95')]=!![];_0x3cbbee[_0x6d35('0x8a')]=_0x1b889f[_0x6d35('0x96')];_0x3cbbee['holdtime']=_0x1b889f[_0x6d35('0x87')];_0x3cbbee[_0x6d35('0x86')]=!![];_0x3cbbee['queuecallerexit']=![];_0x3cbbee['queuecallerexitAt']=null;if(!_0x3cbbee[_0x6d35('0x97')]){if(_0x1b889f['reason']=='transfer'){_0x3cbbee[_0x6d35('0x53')]='COMPLETED';logger[_0x6d35('0x70')](_0x6d35('0x98'),_0x3cbbee['name'],_0x3cbbee[_0x6d35('0x5e')]);}else{if(_[_0x6d35('0x99')](_0x1b889f[_0x6d35('0x3c')][_0x6d35('0x9a')](),_0x6d35('0x9b'))){if(this[_0x6d35('0x12')][_0x1b889f['linkedid']]){var _0xa6225a=_[_0x6d35('0x85')](this[_0x6d35('0x12')][_0x1b889f[_0x6d35('0x9c')]]);_0xa6225a[_0x6d35('0x86')]=![];_0xa6225a[_0x6d35('0x9d')]=!![];_0xa6225a['queuecallerexitAt']=moment(_0x3cbbee[_0x6d35('0x7b')])['add'](_0x1b889f[_0x6d35('0x87')],_0x6d35('0x9e'))[_0x6d35('0x4c')](_0x6d35('0x7c'));_0xa6225a[_0x6d35('0x53')]='FORWARDTRANSFER';_0xa6225a[_0x6d35('0x97')]=!![];_0xa6225a[_0x6d35('0x9f')]=_0x6d35('0xa0');_0xa6225a[_0x6d35('0xa1')]=_0x1b889f[_0x6d35('0xa2')];_0xa6225a['transferuniqueid']=_0x1b889f[_0x6d35('0x4b')];logger[_0x6d35('0x70')](_0x6d35('0xa3'),_0xa6225a['name'],_0xa6225a[_0x6d35('0x5e')]);var _0x306e3b=this['queueReports'][_0x1b889f[_0x6d35('0x9c')]];this[_0x6d35('0x12')][_0x1b889f[_0x6d35('0x9c')]]=this[_0x6d35('0x12')][_0x1b889f[_0x6d35('0x4b')]];this['queueReports'][_0x1b889f[_0x6d35('0x4b')]]=_0x306e3b;}}else{_0x3cbbee['queuecallerexitreason']=_0x6d35('0xa4')+_0x1b889f[_0x6d35('0xa5')][_0x6d35('0xa6')]();logger[_0x6d35('0x70')](_0x6d35('0xa7'),_0x3cbbee[_0x6d35('0x4e')],_0x3cbbee[_0x6d35('0x5e')],_0x3cbbee[_0x6d35('0x53')]);}}}this[_0x6d35('0x14')][_0x1b889f['uniqueid']]=_0x3cbbee;this[_0x6d35('0x45')](_0x3cbbee,'agentcomplete');}}}catch(_0x7ce6b8){logger['error'](_0x6d35('0x93'),_0x1b889f[_0x6d35('0x4b')],util[_0x6d35('0x40')](_0x7ce6b8,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6d35('0xe')]['syncVarSet']=function(_0xe7c47d){try{if(this['isNotNull'](_0xe7c47d)){logger[_0x6d35('0x51')]('[%s][voiceQueueReport][varset]',_0xe7c47d['uniqueid'],util[_0x6d35('0x40')](_0xe7c47d,{'showHidden':![],'depth':null}));this[_0x6d35('0xa8')](_0xe7c47d['uniqueid'],_[_0x6d35('0x82')](_0xe7c47d['variable'])[0x0],_0xe7c47d[_0x6d35('0xa9')]);if(this[_0x6d35('0x12')][_0xe7c47d['uniqueid']]){var _0x4a0879=_[_0x6d35('0x85')](this['queueReports'][_0xe7c47d['uniqueid']]);if(_0x4a0879){if(this[_0x6d35('0x68')](_0xe7c47d[_0x6d35('0xaa')])&&this[_0x6d35('0x68')](_0xe7c47d[_0x6d35('0xaa')][_0x6d35('0xab')])){switch(_0xe7c47d[_0x6d35('0xa9')]){case _0x6d35('0xac'):_0x4a0879[_0x6d35('0x9d')]=![];_0x4a0879[_0x6d35('0xad')]=null;break;case'TIMEOUT':_0x4a0879[_0x6d35('0xae')]=_0x6d35('0xaf');_0x4a0879[_0x6d35('0x9d')]=!![];_0x4a0879['queuecallerexitAt']=moment()[_0x6d35('0x4c')]('YYYY-MM-DD\x20HH:mm:ss');_0x4a0879[_0x6d35('0x8d')]=moment()['format'](_0x6d35('0x7c'));logger[_0x6d35('0x51')](_0x6d35('0xb0'),_0xe7c47d[_0x6d35('0x4b')],util['inspect'](_0x4a0879,{'showHidden':![],'depth':null}));ami[_0x6d35('0x47')](_0x6d35('0xb1'),_0x4a0879);break;default:_0x4a0879[_0x6d35('0x9d')]=!![];_0x4a0879[_0x6d35('0xad')]=moment()['format'](_0x6d35('0x7c'));_0x4a0879[_0x6d35('0x8d')]=moment()[_0x6d35('0x4c')](_0x6d35('0x7c'));}_0x4a0879[_0x6d35('0x1d')]=![];_0x4a0879[_0x6d35('0x94')]=null;_0x4a0879[_0x6d35('0x53')]=_0xe7c47d[_0x6d35('0xa9')];this['channels'][_0xe7c47d['uniqueid']]=_0x4a0879;this[_0x6d35('0x45')](_0x4a0879,'varset');}else if(this[_0x6d35('0x68')](_0xe7c47d[_0x6d35('0xaa')])&&this['isNotNull'](_0xe7c47d[_0x6d35('0xaa')][_0x6d35('0xb2')])){if(!_0x4a0879['queuecallerabandon']){_0x4a0879[_0x6d35('0x9d')]=!![];_0x4a0879[_0x6d35('0xad')]=moment()[_0x6d35('0x4c')](_0x6d35('0x7c'));_0x4a0879[_0x6d35('0x53')]=_0x6d35('0xb3');_0x4a0879['queuecallerleaveAt']=moment()['format'](_0x6d35('0x7c'));this[_0x6d35('0x14')][_0xe7c47d[_0x6d35('0x4b')]]=_0x4a0879;}}logger[_0x6d35('0x70')](_0x6d35('0xb4'),_0xe7c47d[_0x6d35('0x4b')],_0x4a0879[_0x6d35('0x4e')],_0x4a0879[_0x6d35('0x5e')],_[_0x6d35('0x82')](_0xe7c47d[_0x6d35('0xaa')])[0x0],_0xe7c47d['value']);_0x4a0879[_0x6d35('0x17')]=this[_0x6d35('0x17')][_0xe7c47d[_0x6d35('0x4b')]];}}}}catch(_0x14889e){logger[_0x6d35('0x3f')](_0x6d35('0xb5'),_0xe7c47d[_0x6d35('0x4b')],util[_0x6d35('0x40')](_0x14889e,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6d35('0xe')][_0x6d35('0xa8')]=function(_0x35fbfc,_0x417b6d,_0x5d6127){var _0x193837=[_0x6d35('0xb6'),_0x6d35('0xb7'),_0x6d35('0xb8'),_0x6d35('0xb9'),_0x6d35('0xba'),_0x6d35('0xbb'),_0x6d35('0xbc'),_0x6d35('0xbd'),_0x6d35('0xbe'),'sipuri',_0x6d35('0xbf'),_0x6d35('0xc0'),_0x6d35('0xc1'),_0x6d35('0xc2'),'memberinterface','memberlastcall',_0x6d35('0x96'),_0x6d35('0xc3'),'memberrealtime'];if(!_['isNil'](_0x417b6d)&&!_[_0x6d35('0xc4')](_0x193837,_0x417b6d)){if(_[_0x6d35('0x69')](this[_0x6d35('0x17')][_0x35fbfc])){this[_0x6d35('0x17')][_0x35fbfc]={};}this[_0x6d35('0x17')][_0x35fbfc][_0x417b6d]=_0x5d6127;}};VoiceQueueReport[_0x6d35('0xe')]['syncHangup']=function(_0x84e8da){try{if(this[_0x6d35('0x68')](_0x84e8da)){logger[_0x6d35('0x51')](_0x6d35('0xc5'),_0x84e8da[_0x6d35('0x4b')],util['inspect'](_0x84e8da,{'showHidden':![],'depth':null}));if(this[_0x6d35('0x12')][_0x84e8da[_0x6d35('0x4b')]]){for(var _0x2d914f=0x0,_0x3168fe={};_0x2d914f=0x0?moment(_0x5a245a[_0x5cb4('0x18')])[_0x5cb4('0x19')](_0x5a245a['starttime'],_0x5cb4('0xd')):null,'data1':_0x5cb4('0x1a'),'data2':_0x5a245a[_0x5cb4('0x12')],'data3':_0x5a245a['exten'],'data4':_0x5a245a[_0x5cb4('0x1b')]||null,'role':_0x5cb4('0x1c'),'internal':_0x5a245a[_0x5cb4('0x12')]?_[_0x5cb4('0x13')](_0x5a245a[_0x5cb4('0x12')]):undefined,'uniqueid':_0x5a245a['uniqueid']},'log':_0x5cb4('0x5')});}; \ No newline at end of file +var _0x4ecb=['queue','agent','accountcode','toNumber','uniqueid','TALKING','starttime','endtime','outbound','dialstring','lodash','util','../client','voiceQueueReport','queuecallercompleteAt','queuecallerexitAt','Request','CreateMemberReport','lastAssignedTo','isNil','interface','format','queuecallerleaveAt','diff','seconds','inbound','calleridnum','exten'];(function(_0x38441d,_0x12e5f5){var _0x23c0a0=function(_0xa360c8){while(--_0xa360c8){_0x38441d['push'](_0x38441d['shift']());}};_0x23c0a0(++_0x12e5f5);}(_0x4ecb,0x1e6));var _0xb4ec=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0x4ecb[_0x3c4737];return _0x2bb926;};'use strict';var moment=require('moment');var _=require(_0xb4ec('0x0'));var util=require(_0xb4ec('0x1'));var client=require(_0xb4ec('0x2'));exports[_0xb4ec('0x3')]=function(_0x497349){var _0x3d19bc=_0x497349[_0xb4ec('0x4')]||_0x497349[_0xb4ec('0x5')];return client[_0xb4ec('0x6')](_0xb4ec('0x7'),{'body':{'channel':'voice','membername':_0x497349[_0xb4ec('0x8')],'interface':_[_0xb4ec('0x9')](_0x497349[_0xb4ec('0xa')])?util[_0xb4ec('0xb')]('SIP/%s',_0x497349[_0xb4ec('0x8')]):_0x497349[_0xb4ec('0xa')],'type':'TALKING','enterAt':_0x497349[_0xb4ec('0xc')],'exitAt':_0x3d19bc,'duration':moment(_0x3d19bc)[_0xb4ec('0xd')](_0x497349[_0xb4ec('0xc')],_0xb4ec('0xe')),'data1':_0xb4ec('0xf'),'data2':_0x497349[_0xb4ec('0x10')],'data3':_0x497349[_0xb4ec('0x11')],'data4':null,'data5':_0x497349[_0xb4ec('0x12')],'role':_0xb4ec('0x13'),'internal':_0x497349[_0xb4ec('0x14')]?_[_0xb4ec('0x15')](_0x497349[_0xb4ec('0x14')]):undefined,'uniqueid':_0x497349[_0xb4ec('0x16')]},'log':_0xb4ec('0x7')});};exports['voiceDialReport']=function(_0x3af91a){return client['Request'](_0xb4ec('0x7'),{'body':{'channel':'voice','membername':_0x3af91a['membername'],'interface':_0x3af91a[_0xb4ec('0xa')],'type':_0xb4ec('0x17'),'enterAt':_0x3af91a[_0xb4ec('0x18')],'exitAt':_0x3af91a[_0xb4ec('0x19')],'duration':moment(_0x3af91a[_0xb4ec('0x19')])[_0xb4ec('0xd')](_0x3af91a['starttime'],_0xb4ec('0xe'))>=0x0?moment(_0x3af91a[_0xb4ec('0x19')])[_0xb4ec('0xd')](_0x3af91a['starttime'],_0xb4ec('0xe')):null,'data1':_0xb4ec('0x1a'),'data2':_0x3af91a['accountcode'],'data3':_0x3af91a[_0xb4ec('0x11')],'data4':_0x3af91a[_0xb4ec('0x1b')]||null,'role':_0xb4ec('0x13'),'internal':_0x3af91a[_0xb4ec('0x14')]?_[_0xb4ec('0x15')](_0x3af91a['accountcode']):undefined,'uniqueid':_0x3af91a[_0xb4ec('0x16')]},'log':_0xb4ec('0x7')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index 977ba1a..08b9314 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 _0xcc9b=['previewRecallmeReminderInterval','GetSettings','getSettings','ShowSetting','stopRecordingOnTransfer'];(function(_0xfde255,_0x3df282){var _0x39ac78=function(_0x42b713){while(--_0x42b713){_0xfde255['push'](_0xfde255['shift']());}};_0x39ac78(++_0x3df282);}(_0xcc9b,0x12e));var _0xbcc9=function(_0x5ecf1d,_0x435af0){_0x5ecf1d=_0x5ecf1d-0x0;var _0x3df787=_0xcc9b[_0x5ecf1d];return _0x3df787;};'use strict';var client=require('../client');exports[_0xbcc9('0x0')]=function(){return client['Request'](_0xbcc9('0x1'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xbcc9('0x2'),_0xbcc9('0x3')]},'log':_0xbcc9('0x4')});}; \ No newline at end of file +var _0x9d5b=['ShowSetting','stopRecordingOnTransfer','previewRecallmeReminderInterval','getSettings','Request'];(function(_0x1dda19,_0x3483d7){var _0x3cea59=function(_0x44a66b){while(--_0x44a66b){_0x1dda19['push'](_0x1dda19['shift']());}};_0x3cea59(++_0x3483d7);}(_0x9d5b,0x14d));var _0xb9d5=function(_0x10eaa6,_0x5f4f5b){_0x10eaa6=_0x10eaa6-0x0;var _0x8a52d6=_0x9d5b[_0x10eaa6];return _0x8a52d6;};'use strict';var client=require('../client');exports[_0xb9d5('0x0')]=function(){return client[_0xb9d5('0x1')](_0xb9d5('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xb9d5('0x3'),_0xb9d5('0x4')]},'log':'GetSettings'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 3a02c57..94c8406 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 _0x5cd1=['Request','GetTemplate','name','../client','getTemplates'];(function(_0x3039e2,_0x57e99f){var _0x473070=function(_0x5b469c){while(--_0x5b469c){_0x3039e2['push'](_0x3039e2['shift']());}};_0x473070(++_0x57e99f);}(_0x5cd1,0x1cf));var _0x15cd=function(_0x2b93bb,_0xf2b2ad){_0x2b93bb=_0x2b93bb-0x0;var _0xe01da5=_0x5cd1[_0x2b93bb];return _0xe01da5;};'use strict';var client=require(_0x15cd('0x0'));exports[_0x15cd('0x1')]=function(_0x496b2c){return function(_0x4ee8a2){return client[_0x15cd('0x2')](_0x15cd('0x3'),{'options':{'raw':!![],'attributes':['id',_0x15cd('0x4'),'html']},'log':'GetTemplate'});};}; \ No newline at end of file +var _0xe354=['html','GetTemplate'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0xe354,0x187));var _0x4e35=function(_0x4a2aed,_0x2a4c3d){_0x4a2aed=_0x4a2aed-0x0;var _0x2e5c36=_0xe354[_0x4a2aed];return _0x2e5c36;};'use strict';var client=require('../client');exports['getTemplates']=function(_0x298132){return function(_0x2877c2){return client['Request'](_0x4e35('0x0'),{'options':{'raw':!![],'attributes':['id','name',_0x4e35('0x1')]},'log':_0x4e35('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index d3167e0..1cab320 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 _0xdb40=['data4','data5','data7','../client','Request','GetTrigger','name','channel','Condition','AllConditions','field','operator','value','AnyConditions','Actions','data1','data3'];(function(_0x4cbf20,_0x22a782){var _0x28f032=function(_0x5d7b5c){while(--_0x5d7b5c){_0x4cbf20['push'](_0x4cbf20['shift']());}};_0x28f032(++_0x22a782);}(_0xdb40,0x146));var _0x0db4=function(_0x2a498e,_0x47bcfc){_0x2a498e=_0x2a498e-0x0;var _0x487794=_0xdb40[_0x2a498e];return _0x487794;};'use strict';var client=require(_0x0db4('0x0'));exports['getTriggers']=function(_0xbaf2b9){return function(_0x56c091){return client[_0x0db4('0x1')](_0x0db4('0x2'),{'options':{'raw':![],'attributes':['id',_0x0db4('0x3'),_0x0db4('0x4'),'status'],'include':[{'model':_0x0db4('0x5'),'as':_0x0db4('0x6'),'attributes':['id',_0x0db4('0x7'),_0x0db4('0x8'),_0x0db4('0x9')]},{'model':_0x0db4('0x5'),'as':_0x0db4('0xa'),'attributes':['id',_0x0db4('0x7'),_0x0db4('0x8'),_0x0db4('0x9')]},{'model':'Action','as':_0x0db4('0xb'),'attributes':['id','action',_0x0db4('0xc'),'data2',_0x0db4('0xd'),_0x0db4('0xe'),_0x0db4('0xf'),'data6',_0x0db4('0x10')]}]},'log':_0x0db4('0x2')});};}; \ No newline at end of file +var _0xbaca=['Condition','AnyConditions','field','operator','Action','Actions','action','data1','data3','data4','data5','data6','data7','../client','Request','GetTrigger','status','AllConditions','value'];(function(_0x5a3cf0,_0x160a68){var _0x5a64ee=function(_0x34cd1d){while(--_0x34cd1d){_0x5a3cf0['push'](_0x5a3cf0['shift']());}};_0x5a64ee(++_0x160a68);}(_0xbaca,0x189));var _0xabac=function(_0xfb42e6,_0x5f5d4b){_0xfb42e6=_0xfb42e6-0x0;var _0x27265b=_0xbaca[_0xfb42e6];return _0x27265b;};'use strict';var client=require(_0xabac('0x0'));exports['getTriggers']=function(_0xfc7f5){return function(_0x29f17a){return client[_0xabac('0x1')](_0xabac('0x2'),{'options':{'raw':![],'attributes':['id','name','channel',_0xabac('0x3')],'include':[{'model':'Condition','as':_0xabac('0x4'),'attributes':['id','field','operator',_0xabac('0x5')]},{'model':_0xabac('0x6'),'as':_0xabac('0x7'),'attributes':['id',_0xabac('0x8'),_0xabac('0x9'),_0xabac('0x5')]},{'model':_0xabac('0xa'),'as':_0xabac('0xb'),'attributes':['id',_0xabac('0xc'),_0xabac('0xd'),'data2',_0xabac('0xe'),_0xabac('0xf'),_0xabac('0x10'),_0xabac('0x11'),_0xabac('0x12')]}]},'log':_0xabac('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index b863884..130bf67 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 _0xc651=['Request','GetTrunk','name','registry','defaultuser','../client','getTrunks'];(function(_0x1762b4,_0x33d836){var _0x29beda=function(_0x31c2fa){while(--_0x31c2fa){_0x1762b4['push'](_0x1762b4['shift']());}};_0x29beda(++_0x33d836);}(_0xc651,0x16a));var _0x1c65=function(_0x54fe5e,_0x219172){_0x54fe5e=_0x54fe5e-0x0;var _0x4b8c46=_0xc651[_0x54fe5e];return _0x4b8c46;};'use strict';var client=require(_0x1c65('0x0'));exports[_0x1c65('0x1')]=function(_0x9421e7){return function(_0x3e2eb4){return client[_0x1c65('0x2')](_0x1c65('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x1c65('0x4'),_0x1c65('0x5'),_0x1c65('0x6')]},'log':_0x1c65('0x3')});};}; \ No newline at end of file +var _0x430e=['registry','getTrunks','Request','GetTrunk','name'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x430e,0x105));var _0xe430=function(_0x13fdb3,_0x493557){_0x13fdb3=_0x13fdb3-0x0;var _0x212e46=_0x430e[_0x13fdb3];return _0x212e46;};'use strict';var client=require('../client');exports[_0xe430('0x0')]=function(_0x2984a5){return function(_0x4eaa9b){return client[_0xe430('0x1')](_0xe430('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xe430('0x3'),_0xe430('0x4'),'defaultuser']},'log':_0xe430('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 6f904da..5f6b035 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 _0x0713=['getAgent','Request','GetUser','agent','name','email','fullname','online','lastLoginAt','pauseType','lastPauseAt','voicePause','phone','mobile','interface','getAgents','getTelephones','accountcode','internal','savePause','PauseUser'];(function(_0x4e2c29,_0x268b8c){var _0x2544b0=function(_0x407d8d){while(--_0x407d8d){_0x4e2c29['push'](_0x4e2c29['shift']());}};_0x2544b0(++_0x268b8c);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client[_0x3071('0x0')](_0x3071('0x1'),{'options':{'raw':![],'where':{'role':_0x3071('0x2')},'attributes':['id',_0x3071('0x3'),_0x3071('0x4'),'accountcode',_0x3071('0x5'),_0x3071('0x6'),_0x3071('0x7'),_0x3071('0x8'),_0x3071('0x9'),_0x3071('0xa'),_0x3071('0xb'),_0x3071('0xc'),_0x3071('0xd')]},'log':_0x3071('0xe')});};};exports[_0x3071('0xf')]=function(){return function(){return client[_0x3071('0x0')](_0x3071('0x1'),{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x3071('0x3'),_0x3071('0x10'),_0x3071('0x11')]},'log':_0x3071('0xf')});};};exports[_0x3071('0x12')]=function(_0x4a470a,_0x2ace21,_0x11a7ee){return client[_0x3071('0x0')](_0x3071('0x13'),{'body':{'type':_0x2ace21,'uniqueid':_0x11a7ee},'options':{'where':{'id':_0x4a470a['id']}},'log':_0x3071('0x12')});};exports['saveUnpause']=function(_0x5330a8){return client[_0x3071('0x0')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x5330a8['id']}},'log':_0x3071('0x12')});};exports[_0x3071('0x14')]=function(_0x5d4883){return client[_0x3071('0x0')]('ShowUser',{'options':{'raw':![],'where':{'role':_0x3071('0x2'),'id':_0x5d4883},'attributes':['id',_0x3071('0x3'),_0x3071('0x4'),_0x3071('0x10'),_0x3071('0x5'),_0x3071('0x6'),_0x3071('0x7'),_0x3071('0x8'),_0x3071('0x9'),_0x3071('0xa'),'interface']},'log':_0x3071('0x14')});}; \ No newline at end of file +var _0x0713=['getAgent','Request','GetUser','agent','name','email','fullname','online','lastLoginAt','pauseType','lastPauseAt','voicePause','phone','mobile','interface','getAgents','getTelephones','accountcode','internal','savePause','PauseUser'];(function(_0x4f1878,_0x219cf7){var _0x4a6753=function(_0x5bcca6){while(--_0x5bcca6){_0x4f1878['push'](_0x4f1878['shift']());}};_0x4a6753(++_0x219cf7);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client[_0x3071('0x0')](_0x3071('0x1'),{'options':{'raw':![],'where':{'role':_0x3071('0x2')},'attributes':['id',_0x3071('0x3'),_0x3071('0x4'),'accountcode',_0x3071('0x5'),_0x3071('0x6'),_0x3071('0x7'),_0x3071('0x8'),_0x3071('0x9'),_0x3071('0xa'),_0x3071('0xb'),_0x3071('0xc'),_0x3071('0xd')]},'log':_0x3071('0xe')});};};exports[_0x3071('0xf')]=function(){return function(){return client[_0x3071('0x0')](_0x3071('0x1'),{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x3071('0x3'),_0x3071('0x10'),_0x3071('0x11')]},'log':_0x3071('0xf')});};};exports[_0x3071('0x12')]=function(_0x4a470a,_0x2ace21,_0x11a7ee){return client[_0x3071('0x0')](_0x3071('0x13'),{'body':{'type':_0x2ace21,'uniqueid':_0x11a7ee},'options':{'where':{'id':_0x4a470a['id']}},'log':_0x3071('0x12')});};exports['saveUnpause']=function(_0x5330a8){return client[_0x3071('0x0')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x5330a8['id']}},'log':_0x3071('0x12')});};exports[_0x3071('0x14')]=function(_0x5d4883){return client[_0x3071('0x0')]('ShowUser',{'options':{'raw':![],'where':{'role':_0x3071('0x2'),'id':_0x5d4883},'attributes':['id',_0x3071('0x3'),_0x3071('0x4'),_0x3071('0x10'),_0x3071('0x5'),_0x3071('0x6'),_0x3071('0x7'),_0x3071('0x8'),_0x3071('0x9'),_0x3071('0xa'),'interface']},'log':_0x3071('0x14')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index beca88f..c01c679 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 _0x0da1=['Request','CreateVoiceAgentReport','UpdateVoiceAgentReport','../client','create'];(function(_0x1c5a9e,_0x5b0fae){var _0x2c014=function(_0x1869b8){while(--_0x1869b8){_0x1c5a9e['push'](_0x1c5a9e['shift']());}};_0x2c014(++_0x5b0fae);}(_0x0da1,0x1de));var _0x10da=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0x0da1[_0x4c12ec];return _0x3ae42c;};'use strict';var client=require(_0x10da('0x0'));exports[_0x10da('0x1')]=function(_0x27af6a){return client[_0x10da('0x2')](_0x10da('0x3'),{'body':_0x27af6a,'log':'CreateVoiceAgentReport'});};exports['update']=function(_0xc4e1d8,_0x1c5652,_0x3e0002){return client[_0x10da('0x2')](_0x10da('0x4'),{'body':_0xc4e1d8,'options':{'where':{'uniqueid':_0x1c5652,'interface':_0x3e0002,'agentcomplete':!![]}},'log':_0x10da('0x4')});}; \ No newline at end of file +var _0x193d=['update','Request','UpdateVoiceAgentReport','../client','create'];(function(_0x307ca8,_0x38cbb6){var _0x5cdcc9=function(_0x16f546){while(--_0x16f546){_0x307ca8['push'](_0x307ca8['shift']());}};_0x5cdcc9(++_0x38cbb6);}(_0x193d,0x76));var _0xd193=function(_0xdbe2de,_0x3bdc5a){_0xdbe2de=_0xdbe2de-0x0;var _0x2facd7=_0x193d[_0xdbe2de];return _0x2facd7;};'use strict';var client=require(_0xd193('0x0'));exports[_0xd193('0x1')]=function(_0x30c0a1){return client['Request']('CreateVoiceAgentReport',{'body':_0x30c0a1,'log':'CreateVoiceAgentReport'});};exports[_0xd193('0x2')]=function(_0x5c4a83,_0x5d7f71,_0x13400c){return client[_0xd193('0x3')](_0xd193('0x4'),{'body':_0x5c4a83,'options':{'where':{'uniqueid':_0x5d7f71,'interface':_0x13400c,'agentcomplete':!![]}},'log':_0xd193('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index b056df1..a6b3f5a 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 _0x76c7=['DOCUMENTATION','getVoiceCallReports','outbound','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','type','disposition','duration','billableseconds','GetVoiceCallReports','util','lodash','../client','Request','CreateVoiceCallReport','merge','calleridnum','callerid'];(function(_0x14064a,_0xdc7bf0){var _0x4f993e=function(_0x5e9e3f){while(--_0x5e9e3f){_0x14064a['push'](_0x14064a['shift']());}};_0x4f993e(++_0xdc7bf0);}(_0x76c7,0x110));var _0x776c=function(_0x8227bd,_0x32d6f3){_0x8227bd=_0x8227bd-0x0;var _0x1456c9=_0x76c7[_0x8227bd];return _0x1456c9;};'use strict';var moment=require('moment');var util=require(_0x776c('0x0'));var _=require(_0x776c('0x1'));var client=require(_0x776c('0x2'));exports['create']=function(_0x111fc5){return client[_0x776c('0x3')](_0x776c('0x4'),{'body':_[_0x776c('0x5')](_0x111fc5,{'source':_0x111fc5[_0x776c('0x6')],'destinationcontext':_0x111fc5['context'],'callerid':_0x111fc5[_0x776c('0x7')],'amaflags':_0x776c('0x8')}),'log':_0x776c('0x4')});};exports[_0x776c('0x9')]=function(){return function(){return client[_0x776c('0x3')]('GetVoiceCallReport',{'options':{'where':{'type':[_0x776c('0xa')],'createdAt':{'$between':[moment()['startOf'](_0x776c('0xb'))[_0x776c('0xc')](_0x776c('0xd')),moment()[_0x776c('0xe')](_0x776c('0xb'))[_0x776c('0xc')](_0x776c('0xd'))]}},'attributes':[_0x776c('0xf'),_0x776c('0x10'),_0x776c('0x11'),_0x776c('0x12')]},'log':_0x776c('0x13')});};}; \ No newline at end of file +var _0xe911=['disposition','duration','billableseconds','GetVoiceCallReports','util','create','Request','CreateVoiceCallReport','merge','calleridnum','context','callerid','getVoiceCallReports','GetVoiceCallReport','format','YYYY-MM-DD\x20HH:mm:ss','day','type'];(function(_0xdfe674,_0x32e0d0){var _0x4e97f5=function(_0xb154b6){while(--_0xb154b6){_0xdfe674['push'](_0xdfe674['shift']());}};_0x4e97f5(++_0x32e0d0);}(_0xe911,0x70));var _0x1e91=function(_0x40a0a3,_0x1c63df){_0x40a0a3=_0x40a0a3-0x0;var _0x9e1931=_0xe911[_0x40a0a3];return _0x9e1931;};'use strict';var moment=require('moment');var util=require(_0x1e91('0x0'));var _=require('lodash');var client=require('../client');exports[_0x1e91('0x1')]=function(_0x4e5ee6){return client[_0x1e91('0x2')](_0x1e91('0x3'),{'body':_[_0x1e91('0x4')](_0x4e5ee6,{'source':_0x4e5ee6[_0x1e91('0x5')],'destinationcontext':_0x4e5ee6[_0x1e91('0x6')],'callerid':_0x4e5ee6[_0x1e91('0x7')],'amaflags':'DOCUMENTATION'}),'log':'CreateVoiceCallReport'});};exports[_0x1e91('0x8')]=function(){return function(){return client[_0x1e91('0x2')](_0x1e91('0x9'),{'options':{'where':{'type':['outbound'],'createdAt':{'$between':[moment()['startOf']('day')[_0x1e91('0xa')](_0x1e91('0xb')),moment()['endOf'](_0x1e91('0xc'))[_0x1e91('0xa')](_0x1e91('0xb'))]}},'attributes':[_0x1e91('0xd'),_0x1e91('0xe'),_0x1e91('0xf'),_0x1e91('0x10')]},'log':_0x1e91('0x11')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 8bf42b3..70a5652 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 _0x4fcc=['../client','Request','CreateVoiceDialReport'];(function(_0x19d9a9,_0x3b277f){var _0x263aa9=function(_0x49d9ac){while(--_0x49d9ac){_0x19d9a9['push'](_0x19d9a9['shift']());}};_0x263aa9(++_0x3b277f);}(_0x4fcc,0x7e));var _0xc4fc=function(_0x3a8931,_0x36e7a7){_0x3a8931=_0x3a8931-0x0;var _0x34dd86=_0x4fcc[_0x3a8931];return _0x34dd86;};'use strict';var client=require(_0xc4fc('0x0'));exports['create']=function(_0x557df1){return client[_0xc4fc('0x1')](_0xc4fc('0x2'),{'body':_0x557df1,'log':_0xc4fc('0x2')});}; \ No newline at end of file +var _0x788e=['CreateVoiceDialReport','../client','create','Request'];(function(_0x125ff8,_0x41925f){var _0x2d9ef=function(_0x4ef34c){while(--_0x4ef34c){_0x125ff8['push'](_0x125ff8['shift']());}};_0x2d9ef(++_0x41925f);}(_0x788e,0x1d1));var _0xe788=function(_0x37347a,_0x45f7c3){_0x37347a=_0x37347a-0x0;var _0x44ab9b=_0x788e[_0x37347a];return _0x44ab9b;};'use strict';var client=require(_0xe788('0x0'));exports[_0xe788('0x1')]=function(_0x2f3f21){return client[_0xe788('0x2')]('CreateVoiceDialReport',{'body':_0x2f3f21,'log':_0xe788('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index bb6acd3..dfca2da 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 _0xc112=['recordingFormat','../client','getVoiceExtensions','Request','exten'];(function(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0xc112,0xec));var _0x2c11=function(_0x276f5a,_0x2e91fb){_0x276f5a=_0x276f5a-0x0;var _0x2836e=_0xc112[_0x276f5a];return _0x2836e;};'use strict';var client=require(_0x2c11('0x0'));exports[_0x2c11('0x1')]=function(){return function(){return client[_0x2c11('0x2')]('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id',_0x2c11('0x3'),_0x2c11('0x4')],'where':{'VoiceExtensionId':null}},'log':_0x2c11('0x1')});};}; \ No newline at end of file +var _0x4a47=['exten','../client','getVoiceExtensions','Request','GetVoiceExtension'];(function(_0x594f3f,_0x3c719a){var _0x87783d=function(_0x37a5d0){while(--_0x37a5d0){_0x594f3f['push'](_0x594f3f['shift']());}};_0x87783d(++_0x3c719a);}(_0x4a47,0xb5));var _0x74a4=function(_0x451980,_0x2ad060){_0x451980=_0x451980-0x0;var _0x3a66cf=_0x4a47[_0x451980];return _0x3a66cf;};'use strict';var client=require(_0x74a4('0x0'));exports[_0x74a4('0x1')]=function(){return function(){return client[_0x74a4('0x2')](_0x74a4('0x3'),{'options':{'raw':!![],'attributes':['id',_0x74a4('0x4'),'recordingFormat'],'where':{'VoiceExtensionId':null}},'log':_0x74a4('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 5fca6fc..f520d0f 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 _0xa49f=['GetVoiceQueue','name','autopause','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialQueueOptions','dialQueueProject','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialAMDInitialSilence','dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDMaximumNumberOfWords','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','monitor_format','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','active','Pause','mandatoryDispositionPause','TrunkBackup','callerid','Interval','Intervals','interval','getVoiceQueues','../client','Request'];(function(_0x5ab932,_0x23b79d){var _0x101295=function(_0x399e32){while(--_0x399e32){_0x5ab932['push'](_0x5ab932['shift']());}};_0x101295(++_0x23b79d);}(_0xa49f,0xb2));var _0xfa49=function(_0x35da42,_0x5c2610){_0x35da42=_0x35da42-0x0;var _0x370035=_0xa49f[_0x35da42];return _0x370035;};'use strict';var client=require(_0xfa49('0x0'));exports['getVoiceQueues']=function(){return function(){return client[_0xfa49('0x1')](_0xfa49('0x2'),{'options':{'raw':![],'attributes':['id',_0xfa49('0x3'),'acw','acwTimeout',_0xfa49('0x4'),'monitor_format','type',_0xfa49('0x5'),_0xfa49('0x6'),_0xfa49('0x7'),_0xfa49('0x8'),_0xfa49('0x9'),'dialPredictiveOptimization',_0xfa49('0xa'),_0xfa49('0xb'),_0xfa49('0xc'),'dialOriginateCallerIdNumber','dialOriginateTimeout',_0xfa49('0xd'),'dialQueueTimeout',_0xfa49('0xe'),'dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry',_0xfa49('0xf'),_0xfa49('0x10'),_0xfa49('0x11'),_0xfa49('0x12'),_0xfa49('0x13'),_0xfa49('0x14'),_0xfa49('0x15'),'dialCheckDuplicateType','dialAMDActive',_0xfa49('0x16'),_0xfa49('0x17'),'dialAMDAfterGreetingSilence',_0xfa49('0x18'),_0xfa49('0x19'),'dialAMDBetweenWordsSilence',_0xfa49('0x1a'),'dialAMDSilenceThreshold',_0xfa49('0x1b'),_0xfa49('0x1c'),_0xfa49('0x1d'),_0xfa49('0x1e'),_0xfa49('0x1f'),_0xfa49('0x20'),_0xfa49('0x21'),_0xfa49('0x22'),_0xfa49('0x23'),'strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit',_0xfa49('0x24'),_0xfa49('0x25'),_0xfa49('0x26'),_0xfa49('0x27'),_0xfa49('0x28'),_0xfa49('0x29'),_0xfa49('0x2a'),_0xfa49('0x2b'),_0xfa49('0x2c'),_0xfa49('0x2d'),'mandatoryDisposition',_0xfa49('0x2e'),_0xfa49('0x2f'),_0xfa49('0x30'),_0xfa49('0x31')],'include':[{'model':_0xfa49('0x32'),'as':_0xfa49('0x32'),'attributes':['id',_0xfa49('0x3'),'callerid',_0xfa49('0x33')]},{'model':_0xfa49('0x34'),'as':_0xfa49('0x35'),'attributes':['id',_0xfa49('0x3')]},{'model':_0xfa49('0x32'),'as':_0xfa49('0x36'),'attributes':['id',_0xfa49('0x3'),_0xfa49('0x37'),_0xfa49('0x33')]},{'model':_0xfa49('0x38'),'as':_0xfa49('0x38'),'attributes':['id',_0xfa49('0x3')],'include':[{'model':_0xfa49('0x38'),'as':_0xfa49('0x39'),'attributes':['id',_0xfa49('0x3'),_0xfa49('0x3a')]}]}]},'log':_0xfa49('0x3b')});};}; \ No newline at end of file +var _0xb555=['dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','dialAMDMaximumWordLength','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewRecallmeReminder','Trunk','name','callerid','Pause','TrunkBackup','Interval','Intervals','../client','getVoiceQueues','Request','GetVoiceQueue','acw','acwTimeout','autopause','monitor_format','type','dialActive','dialMethod','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix'];(function(_0x204fc1,_0x18363d){var _0x462db4=function(_0x821cdf){while(--_0x821cdf){_0x204fc1['push'](_0x204fc1['shift']());}};_0x462db4(++_0x18363d);}(_0xb555,0xe5));var _0x5b55=function(_0x37102a,_0x46bec6){_0x37102a=_0x37102a-0x0;var _0x39137b=_0xb555[_0x37102a];return _0x39137b;};'use strict';var client=require(_0x5b55('0x0'));exports[_0x5b55('0x1')]=function(){return function(){return client[_0x5b55('0x2')](_0x5b55('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x5b55('0x4'),_0x5b55('0x5'),_0x5b55('0x6'),_0x5b55('0x7'),_0x5b55('0x8'),_0x5b55('0x9'),_0x5b55('0xa'),'dialLimitChannel',_0x5b55('0xb'),_0x5b55('0xc'),_0x5b55('0xd'),_0x5b55('0xe'),_0x5b55('0xf'),_0x5b55('0x10'),_0x5b55('0x11'),_0x5b55('0x12'),_0x5b55('0x13'),'dialQueueTimeout',_0x5b55('0x14'),_0x5b55('0x15'),_0x5b55('0x16'),_0x5b55('0x17'),_0x5b55('0x18'),_0x5b55('0x19'),_0x5b55('0x1a'),_0x5b55('0x1b'),_0x5b55('0x1c'),_0x5b55('0x1d'),_0x5b55('0x1e'),_0x5b55('0x1f'),_0x5b55('0x20'),_0x5b55('0x21'),_0x5b55('0x22'),_0x5b55('0x23'),_0x5b55('0x24'),_0x5b55('0x25'),_0x5b55('0x26'),'dialAMDMaximumNumberOfWords',_0x5b55('0x27'),_0x5b55('0x28'),'timeout',_0x5b55('0x29'),_0x5b55('0x2a'),_0x5b55('0x2b'),'dialAgiAfterHangupAgent',_0x5b55('0x2c'),_0x5b55('0x2d'),_0x5b55('0x7'),_0x5b55('0x2e'),_0x5b55('0x2f'),_0x5b55('0x30'),'dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency',_0x5b55('0x31'),_0x5b55('0x32'),'dialAbandonedMaxRetry',_0x5b55('0x33'),'dialMachineMaxRetry',_0x5b55('0x34'),'dialAgentRejectMaxRetry',_0x5b55('0x35'),_0x5b55('0x36'),_0x5b55('0x37'),_0x5b55('0x38'),'dialPreviewAutoRecallMe',_0x5b55('0x39')],'include':[{'model':'Trunk','as':_0x5b55('0x3a'),'attributes':['id',_0x5b55('0x3b'),_0x5b55('0x3c'),'active']},{'model':_0x5b55('0x3d'),'as':'mandatoryDispositionPause','attributes':['id',_0x5b55('0x3b')]},{'model':_0x5b55('0x3a'),'as':_0x5b55('0x3e'),'attributes':['id',_0x5b55('0x3b'),_0x5b55('0x3c'),'active']},{'model':_0x5b55('0x3f'),'as':_0x5b55('0x3f'),'attributes':['id',_0x5b55('0x3b')],'include':[{'model':_0x5b55('0x3f'),'as':_0x5b55('0x40'),'attributes':['id',_0x5b55('0x3b'),'interval']}]}]},'log':_0x5b55('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index b3708c5..28b6a63 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(_0x30e399,_0x349c3f){var _0x12b5eb=function(_0x2f3efd){while(--_0x2f3efd){_0x30e399['push'](_0x30e399['shift']());}};_0x12b5eb(++_0x349c3f);}(_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 +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(_0x13ec0f,_0x57e222){var _0xaa680f=function(_0x10a686){while(--_0x10a686){_0x13ec0f['push'](_0x13ec0f['shift']());}};_0xaa680f(++_0x57e222);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xa9e0[_0x47e7cb];return _0x2a8874;};'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 628635a..699f4f2 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 _0x2b87=['GetVoiceQueueRtPauses','../client','getVoiceQueueRtPauses','Request'];(function(_0x56d0a3,_0xbb47b2){var _0x60e629=function(_0x3a3fdb){while(--_0x3a3fdb){_0x56d0a3['push'](_0x56d0a3['shift']());}};_0x60e629(++_0xbb47b2);}(_0x2b87,0x16d));var _0x72b8=function(_0x35d358,_0x736a83){_0x35d358=_0x35d358-0x0;var _0x3d74e1=_0x2b87[_0x35d358];return _0x3d74e1;};'use strict';var client=require(_0x72b8('0x0'));exports[_0x72b8('0x1')]=function(_0x333d09){return function(){return client[_0x72b8('0x2')](_0x72b8('0x3'),{'options':{'where':{'VoiceQueueId':_0x333d09,'paused':!![]},'raw':!![]},'log':'getVoiceQueueRtPauses'});};}; \ No newline at end of file +var _0xb57f=['getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses','../client'];(function(_0x36bff5,_0x3156cb){var _0x80ade5=function(_0x5eee65){while(--_0x5eee65){_0x36bff5['push'](_0x36bff5['shift']());}};_0x80ade5(++_0x3156cb);}(_0xb57f,0x157));var _0xfb57=function(_0x145f74,_0x346ce8){_0x145f74=_0x145f74-0x0;var _0x13ec90=_0xb57f[_0x145f74];return _0x13ec90;};'use strict';var client=require(_0xfb57('0x0'));exports[_0xfb57('0x1')]=function(_0x11b5ec){return function(){return client[_0xfb57('0x2')](_0xfb57('0x3'),{'options':{'where':{'VoiceQueueId':_0x11b5ec,'paused':!![]},'raw':!![]},'log':_0xfb57('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 0a06eb5..9deb6d1 100644 --- a/server/services/ami/rpc/voiceRecording.js +++ b/server/services/ami/rpc/voiceRecording.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x3b5736,_0x405711){var _0x457622=function(_0x35ca50){while(--_0x35ca50){_0x3b5736['push'](_0x3b5736['shift']());}};_0x457622(++_0x405711);}(_0x7a54,0x106));var _0x47a5=function(_0x33f48c,_0x57b116){_0x33f48c=_0x33f48c-0x0;var _0x53a51b=_0x7a54[_0x33f48c];return _0x53a51b;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file +var _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0x567616,_0x2a1cc3){var _0x4f8bbf=function(_0x15bbbe){while(--_0x15bbbe){_0x567616['push'](_0x567616['shift']());}};_0x4f8bbf(++_0x2a1cc3);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x7995('0x0'));var client=require(_0x7995('0x1'));exports[_0x7995('0x2')]=function(_0x10a05d){return client['Request'](_0x7995('0x3'),{'body':_[_0x7995('0x4')](_0x10a05d,{'value':_0x10a05d[_0x7995('0x5')]}),'log':_0x7995('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index 9623c7f..bc5a632 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 _0xb650=['origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransfererexten','transfertargetchannel','transfertargetcalleridnum','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','Request','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','context','extension','blind','CreateVoiceTransferReport','origtransfererchannel'];(function(_0x1b3132,_0x210ad8){var _0x31d71f=function(_0x25fdd5){while(--_0x25fdd5){_0x1b3132['push'](_0x1b3132['shift']());}};_0x31d71f(++_0x210ad8);}(_0xb650,0x101));var _0x0b65=function(_0x31924e,_0x1bd0c7){_0x31924e=_0x31924e-0x0;var _0x533f44=_0xb650[_0x31924e];return _0x533f44;};'use strict';var client=require('../client');exports['transfers']={};exports['blindTransfer']=function(_0x4b233b){return client[_0x0b65('0x0')]('CreateVoiceTransferReport',{'body':{'result':_0x4b233b[_0x0b65('0x1')],'transfererchannel':_0x4b233b[_0x0b65('0x2')],'transferercalleridnum':_0x4b233b[_0x0b65('0x3')],'transferercalleridname':_0x4b233b[_0x0b65('0x4')],'transfererconnectedlinenum':_0x4b233b['transfererconnectedlinenum'],'transfererconnectedlinename':_0x4b233b[_0x0b65('0x5')],'transfereraccountcode':_0x4b233b[_0x0b65('0x6')],'transferercontext':_0x4b233b[_0x0b65('0x7')],'transfererexten':_0x4b233b[_0x0b65('0x8')],'transfererlinkedid':_0x4b233b[_0x0b65('0x9')],'transfereechannel':_0x4b233b[_0x0b65('0xa')],'transfereecalleridnum':_0x4b233b[_0x0b65('0xb')],'transfereecalleridname':_0x4b233b[_0x0b65('0xc')],'transfereeconnectedlinenum':_0x4b233b[_0x0b65('0xd')],'transfereeconnectedlinename':_0x4b233b[_0x0b65('0xe')],'transfereeaccountcode':_0x4b233b[_0x0b65('0xf')],'transfereecontext':_0x4b233b[_0x0b65('0x10')],'transfereeexten':_0x4b233b[_0x0b65('0x11')],'transfereelinkedid':_0x4b233b['transfereelinkedid'],'isexternal':_0x4b233b['isexternal'],'context':_0x4b233b[_0x0b65('0x12')],'extension':_0x4b233b[_0x0b65('0x13')],'type':_0x0b65('0x14')},'log':_0x0b65('0x15')});};exports['attendedTransfer']=function(_0x55c597){return client[_0x0b65('0x0')]('CreateVoiceTransferReport',{'body':{'result':_0x55c597[_0x0b65('0x1')],'transfererchannel':_0x55c597[_0x0b65('0x16')],'transferercalleridnum':_0x55c597[_0x0b65('0x17')],'transferercalleridname':_0x55c597[_0x0b65('0x18')],'transfererconnectedlinenum':_0x55c597[_0x0b65('0x19')],'transfererconnectedlinename':_0x55c597[_0x0b65('0x1a')],'transfereraccountcode':_0x55c597[_0x0b65('0x1b')],'transferercontext':_0x55c597['secondtransferercontext'],'transfererexten':_0x55c597[_0x0b65('0x1c')],'transfererlinkedid':_0x55c597['origtransfererlinkedid'],'transfereechannel':_0x55c597[_0x0b65('0x1d')],'transfereecalleridnum':_0x55c597[_0x0b65('0x1e')],'transfereecalleridname':_0x55c597['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x55c597[_0x0b65('0x1f')],'transfereeconnectedlinename':_0x55c597[_0x0b65('0x20')],'transfereeaccountcode':_0x55c597[_0x0b65('0x21')],'transfereecontext':_0x55c597[_0x0b65('0x22')],'transfereeexten':_0x55c597[_0x0b65('0x23')],'transfereelinkedid':_0x55c597[_0x0b65('0x24')],'isexternal':_0x55c597['isexternal'],'context':_0x55c597[_0x0b65('0x25')],'extension':_0x55c597[_0x0b65('0x26')],'type':_0x0b65('0x27')},'log':_0x0b65('0x15')});}; \ No newline at end of file +var _0x1fe0=['CreateVoiceTransferReport','origtransfererchannel','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','origtransferercontext','attended','../client','blindTransfer','Request','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','isexternal','context','extension','blind'];(function(_0x2e9ba3,_0x49161b){var _0x3c1d8a=function(_0x321ac6){while(--_0x321ac6){_0x2e9ba3['push'](_0x2e9ba3['shift']());}};_0x3c1d8a(++_0x49161b);}(_0x1fe0,0x183));var _0x01fe=function(_0x1c34e7,_0x33f9a8){_0x1c34e7=_0x1c34e7-0x0;var _0x378cb1=_0x1fe0[_0x1c34e7];return _0x378cb1;};'use strict';var client=require(_0x01fe('0x0'));exports['transfers']={};exports[_0x01fe('0x1')]=function(_0x4c28e4){return client[_0x01fe('0x2')]('CreateVoiceTransferReport',{'body':{'result':_0x4c28e4[_0x01fe('0x3')],'transfererchannel':_0x4c28e4[_0x01fe('0x4')],'transferercalleridnum':_0x4c28e4[_0x01fe('0x5')],'transferercalleridname':_0x4c28e4[_0x01fe('0x6')],'transfererconnectedlinenum':_0x4c28e4[_0x01fe('0x7')],'transfererconnectedlinename':_0x4c28e4[_0x01fe('0x8')],'transfereraccountcode':_0x4c28e4[_0x01fe('0x9')],'transferercontext':_0x4c28e4[_0x01fe('0xa')],'transfererexten':_0x4c28e4[_0x01fe('0xb')],'transfererlinkedid':_0x4c28e4[_0x01fe('0xc')],'transfereechannel':_0x4c28e4[_0x01fe('0xd')],'transfereecalleridnum':_0x4c28e4[_0x01fe('0xe')],'transfereecalleridname':_0x4c28e4['transfereecalleridname'],'transfereeconnectedlinenum':_0x4c28e4['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0x4c28e4[_0x01fe('0xf')],'transfereeaccountcode':_0x4c28e4[_0x01fe('0x10')],'transfereecontext':_0x4c28e4[_0x01fe('0x11')],'transfereeexten':_0x4c28e4[_0x01fe('0x12')],'transfereelinkedid':_0x4c28e4['transfereelinkedid'],'isexternal':_0x4c28e4[_0x01fe('0x13')],'context':_0x4c28e4[_0x01fe('0x14')],'extension':_0x4c28e4[_0x01fe('0x15')],'type':_0x01fe('0x16')},'log':_0x01fe('0x17')});};exports['attendedTransfer']=function(_0x3e9ea6){return client[_0x01fe('0x2')](_0x01fe('0x17'),{'body':{'result':_0x3e9ea6[_0x01fe('0x3')],'transfererchannel':_0x3e9ea6[_0x01fe('0x18')],'transferercalleridnum':_0x3e9ea6['origtransferercalleridnum'],'transferercalleridname':_0x3e9ea6[_0x01fe('0x19')],'transfererconnectedlinenum':_0x3e9ea6[_0x01fe('0x1a')],'transfererconnectedlinename':_0x3e9ea6[_0x01fe('0x1b')],'transfereraccountcode':_0x3e9ea6[_0x01fe('0x1c')],'transferercontext':_0x3e9ea6['secondtransferercontext'],'transfererexten':_0x3e9ea6[_0x01fe('0x1d')],'transfererlinkedid':_0x3e9ea6[_0x01fe('0x1e')],'transfereechannel':_0x3e9ea6[_0x01fe('0x1f')],'transfereecalleridnum':_0x3e9ea6[_0x01fe('0x20')],'transfereecalleridname':_0x3e9ea6[_0x01fe('0x21')],'transfereeconnectedlinenum':_0x3e9ea6[_0x01fe('0x22')],'transfereeconnectedlinename':_0x3e9ea6[_0x01fe('0x23')],'transfereeaccountcode':_0x3e9ea6[_0x01fe('0x24')],'transfereecontext':_0x3e9ea6[_0x01fe('0x25')],'transfereeexten':_0x3e9ea6[_0x01fe('0x26')],'transfereelinkedid':_0x3e9ea6['transfertargetlinkedid'],'isexternal':_0x3e9ea6[_0x01fe('0x13')],'context':_0x3e9ea6[_0x01fe('0x27')],'extension':_0x3e9ea6['origtransfererexten'],'type':_0x01fe('0x28')},'log':_0x01fe('0x17')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 1a2efc6..9667a5c 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 _0xb145=['Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','stop','StopMixMonitor\x20Success','queueChannels','voicequeuechannel','voicequeuechannelhangup','voicequeuechannelredirect','Redirect','exten','context','trunks','campaigns','event','Event\x20name\x20mandatory','custom:','faxAccounts','send','checkAfterSend','server','http','listen','127.0.0.1','log','util','jayson/promise','validate','bluebird','moment','../../../config/environment','../properties','../ami','%s/%s','SIP','timers','timer','agents','updateStatusRealtime','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','keys','module','action','Reload','then','message','command','Action','content','voiceQueues','hasOwnProperty','name','strategy','answered','available','loggedIn','pTalking','sumBillable','sumHoldTime','talking','unmanaged','abandoned','type','dialActive','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','Interval','push','length','find','omit','values','channels','voicechannel','map','channel','format','filename','uniqueid','wav','MixMonitor','monitors','/var/spool/asterisk/monitor/','toLowerCase','isNil','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','status','rec','MixMonitor\x20Success','catch'];(function(_0x4f5f1c,_0x404440){var _0x411db9=function(_0x56a735){while(--_0x56a735){_0x4f5f1c['push'](_0x4f5f1c['shift']());}};_0x411db9(++_0x404440);}(_0xb145,0xa3));var _0x5b14=function(_0x844c7b,_0x234842){_0x844c7b=_0x844c7b-0x0;var _0x33fecf=_0xb145[_0x844c7b];return _0x33fecf;};'use strict';var _=require('lodash');var util=require(_0x5b14('0x0'));var jayson=require(_0x5b14('0x1'));var schema=require(_0x5b14('0x2'));var BPromise=require(_0x5b14('0x3'));var moment=require(_0x5b14('0x4'));var config=require(_0x5b14('0x5'));var properties=require(_0x5b14('0x6'));var ami=require(_0x5b14('0x7'));exports['listen']=function(_0x1e0b5b,_0x15490e,_0x392425){return new BPromise(function(_0x4d82ad,_0x50fd91){var _0x1d12ed={'QueuePause':function(_0x2a3921){return new Promise(function(_0x34530a,_0x62cdcd){var _0x473cfe=util['format'](_0x5b14('0x8'),_0x5b14('0x9'),_0x2a3921['name']);if(_0x1e0b5b[_0x5b14('0xa')]&&_0x1e0b5b[_0x5b14('0xa')][_0x473cfe]&&_0x1e0b5b[_0x5b14('0xa')][_0x473cfe][_0x5b14('0xb')]){_0x1e0b5b[_0x5b14('0xa')][_0x473cfe]['updateAcw']();}if(_0x1e0b5b[_0x5b14('0xc')][_0x473cfe]){_0x1e0b5b['agents'][_0x473cfe][_0x5b14('0xd')]({'statePause':_0x2a3921[_0x5b14('0xe')]?!![]:![]});}_0x34530a({'code':0xc8,'message':_0x5b14('0xf')});});},'Reload':function(_0x1cb56b){var _0x18b267=this;return new Promise(function(_0x40577a,_0x52ffa9){if(ami[_0x5b14('0x10')]()==![]){return _0x52ffa9(_0x18b267[_0x5b14('0x11')](0x1f4,[config[_0x5b14('0x12')]['ip'],config[_0x5b14('0x12')][_0x5b14('0x13')],_0x5b14('0x14')][_0x5b14('0x15')]('\x20')));}_0x1cb56b=_[_0x5b14('0x16')](_0x1cb56b,_[_0x5b14('0x17')](properties[_0x5b14('0x18')]));_0x1cb56b[_0x5b14('0x19')]=_0x5b14('0x1a');return ami['Action'](_0x1cb56b)[_0x5b14('0x1b')](function(_0x50866a){_0x40577a({'code':0xc8,'message':_0x50866a['message']});})['catch'](function(_0x3f397d){_0x52ffa9(_0x18b267[_0x5b14('0x11')](0x1f5,_0x3f397d[_0x5b14('0x1c')]));});});},'Command':function(_0x89b7a0){var _0x3786f7=this;return new Promise(function(_0x16fba5,_0x19e6f8){if(ami['isConnected']()==![]){return _0x19e6f8(_0x3786f7['error'](0x1f4,[config['asterisk']['ip'],config[_0x5b14('0x12')][_0x5b14('0x13')],_0x5b14('0x14')][_0x5b14('0x15')]('\x20')));}_0x89b7a0=_['pick'](_0x89b7a0,_0x5b14('0x1d'));_0x89b7a0[_0x5b14('0x19')]='Command';return ami[_0x5b14('0x1e')](_0x89b7a0)[_0x5b14('0x1b')](function(_0x50951f){_0x16fba5({'code':0xc8,'message':_0x50951f[_0x5b14('0x1f')]});})['catch'](function(_0x59282c){_0x19e6f8(_0x3786f7['error'](0x1f5,_0x59282c['message']));});});},'VoiceQueues':function(_0x2d62d1){return new Promise(function(_0x2d5f56,_0x153a25){var _0x5da505=[];for(var _0x46f86a in _0x1e0b5b[_0x5b14('0x20')]){if(_0x1e0b5b[_0x5b14('0x20')][_0x5b14('0x21')](_0x46f86a)){var _0xe6851b=_0x1e0b5b[_0x5b14('0x20')][_0x46f86a];var _0x422d22={'id':_0xe6851b['id'],'name':_0xe6851b[_0x5b14('0x22')],'strategy':_0xe6851b[_0x5b14('0x23')],'answered':_0xe6851b[_0x5b14('0x24')],'available':_0xe6851b[_0x5b14('0x25')],'loggedIn':_0xe6851b[_0x5b14('0x26')],'pTalking':_0xe6851b[_0x5b14('0x27')],'sumBillable':_0xe6851b[_0x5b14('0x28')],'sumDuration':_0xe6851b['sumDuration'],'sumHoldTime':_0xe6851b[_0x5b14('0x29')]||0x0,'talking':_0xe6851b[_0x5b14('0x2a')],'total':_0xe6851b['total'],'type':_0xe6851b['type'],'unmanaged':_0xe6851b[_0x5b14('0x2b')],'abandoned':_0xe6851b[_0x5b14('0x2c')],'waiting':_0xe6851b['waiting'],'loggedInDb':_0xe6851b['loggedInDb']};if(_0xe6851b[_0x5b14('0x2d')]==='outbound'){_0x422d22[_0x5b14('0x2e')]=_0xe6851b[_0x5b14('0x2e')];_0x422d22['dialMethod']=_0xe6851b['dialMethod'];_0x422d22[_0x5b14('0x2f')]=_0xe6851b[_0x5b14('0x2f')];_0x422d22[_0x5b14('0x30')]=_0xe6851b['dialOriginateCallerIdNumber'];_0x422d22[_0x5b14('0x31')]=_0xe6851b['dialOriginateTimeout'];_0x422d22[_0x5b14('0x32')]=_0xe6851b[_0x5b14('0x32')];_0x422d22[_0x5b14('0x33')]=_0xe6851b[_0x5b14('0x33')];_0x422d22['outboundAnswerAgiCallsDay']=_0xe6851b[_0x5b14('0x34')];_0x422d22[_0x5b14('0x35')]=_0xe6851b[_0x5b14('0x35')];_0x422d22[_0x5b14('0x36')]=_0xe6851b['outboundBlacklistCallsDay'];_0x422d22[_0x5b14('0x37')]=_0xe6851b[_0x5b14('0x37')];_0x422d22[_0x5b14('0x38')]=_0xe6851b['outboundCongestionCallsDay'];_0x422d22[_0x5b14('0x39')]=_0xe6851b['outboundDropCallsDayACS'];_0x422d22[_0x5b14('0x3a')]=_0xe6851b[_0x5b14('0x3a')];_0x422d22['outboundDropCallsDayTimeout']=_0xe6851b[_0x5b14('0x3b')];_0x422d22[_0x5b14('0x3c')]=_0xe6851b['outboundNoAnswerCallsDay'];_0x422d22[_0x5b14('0x3d')]=_0xe6851b['outboundNoSuchCallsDay'];_0x422d22[_0x5b14('0x3e')]=_0xe6851b[_0x5b14('0x3e')];_0x422d22[_0x5b14('0x3f')]=_0xe6851b[_0x5b14('0x3f')];_0x422d22['outboundRejectCallsDay']=_0xe6851b[_0x5b14('0x40')];_0x422d22[_0x5b14('0x41')]=_0xe6851b[_0x5b14('0x41')];_0x422d22[_0x5b14('0x42')]=_0xe6851b[_0x5b14('0x42')];_0x422d22[_0x5b14('0x43')]=_0xe6851b[_0x5b14('0x43')];_0x422d22[_0x5b14('0x44')]=_0xe6851b[_0x5b14('0x44')];_0x422d22[_0x5b14('0x45')]=_0xe6851b[_0x5b14('0x45')];_0x422d22[_0x5b14('0x46')]=_0xe6851b[_0x5b14('0x46')];_0x422d22[_0x5b14('0x47')]=_0xe6851b[_0x5b14('0x47')];_0x422d22[_0x5b14('0x48')]=_0xe6851b['predictiveIntervalErlangCallsDroppedCalls'];_0x422d22[_0x5b14('0x49')]=_0xe6851b['predictiveIntervalHitRate'];_0x422d22[_0x5b14('0x4a')]=_0xe6851b[_0x5b14('0x4a')];_0x422d22['predictiveIntervalPauses']=_0xe6851b['predictiveIntervalPauses'];_0x422d22['predictiveIntervalAvailable']=_0xe6851b[_0x5b14('0x4b')];_0x422d22[_0x5b14('0x4c')]=_0xe6851b['predictiveIntervalTotalCalls'];_0x422d22[_0x5b14('0x1c')]=_0xe6851b[_0x5b14('0x1c')];_0x422d22[_0x5b14('0x4d')]=_0xe6851b[_0x5b14('0x4d')];_0x422d22[_0x5b14('0x4e')]=_0xe6851b['erlangCalls'];_0x422d22[_0x5b14('0x4f')]=_0xe6851b[_0x5b14('0x4f')];_0x422d22['erlangAbandonmentRate']=_0xe6851b[_0x5b14('0x50')];_0x422d22[_0x5b14('0x51')]=_0xe6851b[_0x5b14('0x51')];_0x422d22[_0x5b14('0x52')]=_0xe6851b['startPredictive'];_0x422d22[_0x5b14('0x53')]=_0xe6851b[_0x5b14('0x53')];}if(_0xe6851b[_0x5b14('0x54')]){_0x422d22[_0x5b14('0x54')]={'id':_0xe6851b['Trunk']['id'],'name':_0xe6851b[_0x5b14('0x54')][_0x5b14('0x22')],'active':_0xe6851b[_0x5b14('0x54')][_0x5b14('0x55')],'callerid':_0xe6851b['Trunk']['callerid']};}if(_0xe6851b[_0x5b14('0x56')]){_0x422d22[_0x5b14('0x56')]={'id':_0xe6851b['Interval']['id'],'name':_0xe6851b[_0x5b14('0x56')]['name']};}_0x5da505[_0x5b14('0x57')](_0x422d22);}}_0x2d5f56({'count':_0x5da505[_0x5b14('0x58')],'rows':_0x5da505});});},'UpdateVoiceQueue':function(_0x2df4fa){return new Promise(function(_0x3bf048,_0x30d8d4){var _0x557ff4=_[_0x5b14('0x59')](_0x1e0b5b[_0x5b14('0x20')],{'id':parseInt(_0x2df4fa['id'])});var _0x285881=_[_0x5b14('0x5a')](_0x2df4fa,['id']);if(_0x557ff4){for(var _0x46e8ba in _0x285881){if(typeof _0x285881[_0x46e8ba]!=='undefined'&&typeof _0x557ff4[_0x46e8ba]!=='undefined'){_0x557ff4[_0x46e8ba]=_0x285881[_0x46e8ba];}}_0x3bf048(_0x557ff4);}else{_0x30d8d4();}});},'VoiceChannels':function(_0x370f19){return new Promise(function(_0x51af0f,_0x4a93e9){var _0x4825b4=_[_0x5b14('0x5b')](_0x1e0b5b[_0x5b14('0x5c')]);_0x51af0f({'count':_0x4825b4[_0x5b14('0x58')],'rows':_0x4825b4});});},'VoiceChannelMixMonitor':function(_0x16af6f){var _0x3740bb=this;return new Promise(function(_0x3eb335,_0x1d550f){if(ami['isConnected']()==![]){return _0x1d550f(_0x3740bb['error'](0x1f4,[config['asterisk']['ip'],config['asterisk']['username'],_0x5b14('0x14')][_0x5b14('0x15')]('\x20')));}var _0x31b527=schema(properties[_0x5b14('0x5d')])[_0x5b14('0x2')](_0x16af6f);if(_0x31b527['length']>0x0){return _0x1d550f(_0x3740bb['error'](0x1f4,_[_0x5b14('0x5e')](_0x31b527,_0x5b14('0x1c'))['join'](',\x20')));}var _0x286879=_[_0x5b14('0x59')](_0x1e0b5b['channels'],{'uniqueid':_0x16af6f['uniqueid']});if(_0x286879&&_0x286879[_0x5b14('0x5f')]){var _0x1d6fdc=util[_0x5b14('0x60')]('%s.%s',_0x16af6f[_0x5b14('0x61')]||_0x16af6f[_0x5b14('0x62')],_0x16af6f[_0x5b14('0x60')]||_0x5b14('0x63'));return ami[_0x5b14('0x1e')]({'action':_0x5b14('0x64'),'channel':_0x286879[_0x5b14('0x5f')],'file':_0x1d6fdc,'options':'ai(mixmonitorid)'})[_0x5b14('0x1b')](function(_0x5e99a4){var _0x44e625=_[_0x5b14('0x59')](_0x286879[_0x5b14('0x65')],{'filename':_0x5b14('0x66')+_0x1d6fdc[_0x5b14('0x67')]()});if(_[_0x5b14('0x68')](_0x44e625)){_0x286879[_0x5b14('0x65')][_0x5b14('0x57')]({'filename':_0x5b14('0x66')+_0x1d6fdc[_0x5b14('0x67')](),'createdAt':moment()[_0x5b14('0x60')](_0x5b14('0x69')),'mixmonitorid':_0x5e99a4['mixmonitorid'],'status':'rec'});}else{_0x44e625['mixmonitorid']=_0x5e99a4[_0x5b14('0x6a')];_0x44e625[_0x5b14('0x6b')]=_0x5b14('0x6c');}_0x3eb335({'code':0xc8,'message':[_0x16af6f[_0x5b14('0x62')],_0x5b14('0x6d'),_0x5e99a4[_0x5b14('0x6a')]][_0x5b14('0x15')]('\x20'),'mixmonitorid':_0x5e99a4['mixmonitorid']});})[_0x5b14('0x6e')](function(_0x19e88a){_0x1d550f(_0x3740bb['error'](0x1f5,[_0x16af6f['uniqueid'],_0x19e88a[_0x5b14('0x1c')][_0x5b14('0x67')]()][_0x5b14('0x15')]('\x20')));});}else{return _0x1d550f(_0x3740bb[_0x5b14('0x11')](0x1f5,_0x5b14('0x6f')));}});},'VoiceChannelStopMixMonitor':function(_0x1009e5){var _0x5a21af=this;return new Promise(function(_0x2629ad,_0x48ffb3){if(ami[_0x5b14('0x10')]()==![]){return _0x48ffb3(_0x5a21af['error'](0x1f4,[config[_0x5b14('0x12')]['ip'],config[_0x5b14('0x12')][_0x5b14('0x13')],'ami\x20disconnected'][_0x5b14('0x15')]('\x20')));}var _0x566063=schema(properties[_0x5b14('0x5d')])[_0x5b14('0x2')](_0x1009e5);if(_0x566063[_0x5b14('0x58')]>0x0){return _0x48ffb3(_0x5a21af['error'](0x1f4,_[_0x5b14('0x5e')](_0x566063,_0x5b14('0x1c'))[_0x5b14('0x15')](',\x20')));}var _0x2e5bd4=_['find'](_0x1e0b5b[_0x5b14('0x5c')],{'uniqueid':_0x1009e5['uniqueid']});if(_0x2e5bd4){return BPromise[_0x5b14('0x70')]()[_0x5b14('0x1b')](function(){if(_0x2e5bd4['channel']){return ami['Action']({'action':_0x5b14('0x71'),'channel':_0x2e5bd4[_0x5b14('0x5f')],'mixmonitorid':_0x1009e5[_0x5b14('0x6a')]})['catch'](function(_0x474999){});}})[_0x5b14('0x1b')](function(){if(_0x2e5bd4['destinationchannel']){return ami[_0x5b14('0x1e')]({'action':_0x5b14('0x71'),'channel':_0x2e5bd4[_0x5b14('0x72')],'mixmonitorid':_0x1009e5[_0x5b14('0x6a')]})[_0x5b14('0x6e')](function(_0x49af2e){});}})[_0x5b14('0x1b')](function(_0x465907){var _0x521513=_['find'](_0x2e5bd4[_0x5b14('0x65')],{'mixmonitorid':_0x1009e5[_0x5b14('0x6a')]});if(_0x521513){_0x521513['status']='stop';}})[_0x5b14('0x1b')](function(){var _0x3824e6=util[_0x5b14('0x60')]('%s.%s',_0x1009e5[_0x5b14('0x61')]||_0x1009e5[_0x5b14('0x62')],_0x1009e5[_0x5b14('0x60')]||'wav');var _0x453e4b=_[_0x5b14('0x59')](_0x2e5bd4[_0x5b14('0x65')],{'filename':'/var/spool/asterisk/monitor/'+_0x3824e6[_0x5b14('0x67')]()});if(_0x453e4b){_0x453e4b[_0x5b14('0x6b')]=_0x5b14('0x73');}})[_0x5b14('0x1b')](function(){_0x2629ad({'code':0xc8,'message':[_0x1009e5[_0x5b14('0x62')],_0x5b14('0x74')][_0x5b14('0x15')]('\x20')});})['catch'](function(_0x5ac604){_0x48ffb3(_0x5a21af['error'](0x1f5,[_0x1009e5['uniqueid'],_0x5ac604[_0x5b14('0x1c')][_0x5b14('0x67')]()][_0x5b14('0x15')]('\x20')));});}else{return _0x48ffb3(_0x5a21af[_0x5b14('0x11')](0x1f5,_0x5b14('0x6f')));}});},'VoiceQueuesChannels':function(_0x58f544){return new Promise(function(_0x56f20e,_0x1df8b2){var _0x5d9348=_[_0x5b14('0x5b')](_0x1e0b5b[_0x5b14('0x75')]);_0x56f20e({'count':_0x5d9348[_0x5b14('0x58')],'rows':_0x5d9348});});},'VoiceQueuesChannel':function(_0x4870f9){var _0x540f81=this;return new Promise(function(_0x1dded6,_0x1b76a0){var _0x160a4f=schema(properties[_0x5b14('0x76')])[_0x5b14('0x2')](_0x4870f9);if(_0x160a4f[_0x5b14('0x58')]>0x0){return _0x1b76a0(_0x540f81[_0x5b14('0x11')](0x1f4,_[_0x5b14('0x5e')](_0x160a4f,_0x5b14('0x1c'))['join'](',\x20')));}var _0x18960b=_['find'](_0x1e0b5b[_0x5b14('0x75')],{'uniqueid':_0x4870f9[_0x5b14('0x62')]});if(_0x18960b){_0x1dded6(_0x18960b);}else{return _0x1b76a0(_0x540f81[_0x5b14('0x11')](0x1f5,_0x5b14('0x6f')));}});},'VoiceQueuesChannelHangup':function(_0x4665d7){var _0x223faa=this;return new Promise(function(_0x2b8286,_0x4f9e57){if(ami['isConnected']()==![]){return _0x4f9e57(_0x223faa[_0x5b14('0x11')](0x1f4,[config[_0x5b14('0x12')]['ip'],config[_0x5b14('0x12')][_0x5b14('0x13')],_0x5b14('0x14')]['join']('\x20')));}var _0x1310a5=schema(properties[_0x5b14('0x77')])[_0x5b14('0x2')](_0x4665d7);if(_0x1310a5[_0x5b14('0x58')]>0x0){return _0x4f9e57(_0x223faa[_0x5b14('0x11')](0x1f4,_[_0x5b14('0x5e')](_0x1310a5,_0x5b14('0x1c'))[_0x5b14('0x15')](',\x20')));}var _0x44c3a2=_[_0x5b14('0x59')](_0x1e0b5b['queueChannels'],{'uniqueid':_0x4665d7['uniqueid']});if(_0x44c3a2&&_0x44c3a2[_0x5b14('0x5f')]){return ami[_0x5b14('0x1e')]({'action':'Hangup','channel':_0x44c3a2[_0x5b14('0x5f')]})[_0x5b14('0x1b')](function(_0x2c24cb){_0x2b8286({'code':0xc8,'message':[_0x4665d7[_0x5b14('0x62')],_0x2c24cb['message'][_0x5b14('0x67')]()][_0x5b14('0x15')]('\x20')});})[_0x5b14('0x6e')](function(_0x35f241){_0x4f9e57(_0x223faa[_0x5b14('0x11')](0x1f5,[_0x4665d7[_0x5b14('0x62')],_0x35f241[_0x5b14('0x1c')]['toLowerCase']()]['join']('\x20')));});}else{return _0x4f9e57(_0x223faa['error'](0x1f5,_0x5b14('0x6f')));}});},'VoiceQueuesChannelRedirect':function(_0x23c285){var _0xaf4676=this;return new Promise(function(_0x7541a1,_0x3449df){if(ami[_0x5b14('0x10')]()==![]){return _0x3449df(_0xaf4676[_0x5b14('0x11')](0x1f4,[config[_0x5b14('0x12')]['ip'],config[_0x5b14('0x12')][_0x5b14('0x13')],_0x5b14('0x14')]['join']('\x20')));}var _0xd28c0d=schema(properties[_0x5b14('0x78')])[_0x5b14('0x2')](_0x23c285);if(_0xd28c0d[_0x5b14('0x58')]>0x0){return _0x3449df(_0xaf4676['error'](0x1f4,_[_0x5b14('0x5e')](_0xd28c0d,_0x5b14('0x1c'))[_0x5b14('0x15')](',\x20')));}var _0xc16146=_[_0x5b14('0x59')](_0x1e0b5b[_0x5b14('0x75')],{'uniqueid':_0x23c285[_0x5b14('0x62')]});if(_0xc16146&&_0xc16146[_0x5b14('0x5f')]){return ami[_0x5b14('0x1e')]({'action':_0x5b14('0x79'),'channel':_0xc16146[_0x5b14('0x5f')],'exten':_0x23c285[_0x5b14('0x7a')],'context':_0x23c285[_0x5b14('0x7b')]||_0xc16146[_0x5b14('0x7b')],'priority':0x1})[_0x5b14('0x1b')](function(_0x49fbbc){_0x7541a1({'code':0xc8,'message':[_0x23c285[_0x5b14('0x62')],_0x49fbbc[_0x5b14('0x1c')][_0x5b14('0x67')]()][_0x5b14('0x15')]('\x20')});})[_0x5b14('0x6e')](function(_0x5939ae){_0x3449df(_0xaf4676['error'](0x1f5,[_0x23c285[_0x5b14('0x62')],_0x5939ae['message'][_0x5b14('0x67')]()][_0x5b14('0x15')]('\x20')));});}else{return _0x3449df(_0xaf4676[_0x5b14('0x11')](0x1f5,_0x5b14('0x6f')));}});},'Agents':function(_0x1af04d){return new Promise(function(_0x1eebf1,_0x4f09d5){var _0x1f08e3=_['values'](_0x1e0b5b['agents']);_0x1eebf1({'count':_0x1f08e3[_0x5b14('0x58')],'rows':_0x1f08e3});});},'Telephones':function(_0x3c79bb){return new Promise(function(_0x110968,_0x5ef4aa){var _0x5b8e11=_['values'](_0x1e0b5b['telephones']);_0x110968({'count':_0x5b8e11[_0x5b14('0x58')],'rows':_0x5b8e11});});},'Trunks':function(_0x1f7304){return new Promise(function(_0x30ad09,_0x47e418){var _0x5761cf=_[_0x5b14('0x5b')](_0x1e0b5b[_0x5b14('0x7c')]);_0x30ad09({'count':_0x5761cf['length'],'rows':_0x5761cf});});},'OutboundChannels':function(_0x293016){return new Promise(function(_0x16931d,_0x4bead1){var _0x4e7109=_['values'](_0x1e0b5b['outboundChannels']);_0x16931d({'count':_0x4e7109[_0x5b14('0x58')],'rows':_0x4e7109});});},'Outbound':function(_0x4b8775){return new Promise(function(_0x30d043,_0x7de41b){_0x30d043(_0x1e0b5b['outbound']);});},'Campaigns':function(_0x1fc726){return new Promise(function(_0x5ce32a,_0x908c23){var _0x57ba59=_[_0x5b14('0x5b')](_0x1e0b5b[_0x5b14('0x7d')]);_0x5ce32a({'count':_0x57ba59['length'],'rows':_0x57ba59});});},'VoiceQueuesPreview':function(_0x1c2ebf){var _0x14b2e9=this;return new Promise(function(_0x21161b,_0x2a3a92){_0x15490e['run'](_0x1c2ebf['id'])[_0x5b14('0x1b')](function(_0x2b6397){_0x21161b({'code':0xc8,'message':_0x2b6397['message']});})[_0x5b14('0x6e')](function(_0x4042ec){_0x2a3a92(_0x14b2e9[_0x5b14('0x11')](0x1f4,_0x4042ec['message']));});});},'EventManager':function(_0x22eef3){var _0x3e22b9=this;return new Promise(function(_0xe32822,_0x4eb5d7){if(!_0x22eef3[_0x5b14('0x7e')]){return _0x4eb5d7(_0x3e22b9['error'](0x1f4,_0x5b14('0x7f')));}ami['emit'](_0x5b14('0x80')+_0x22eef3[_0x5b14('0x7e')],_0x22eef3['message']);_0xe32822({'code':0xc8,'message':_0x22eef3});});},'FaxAccounts':function(_0x389410){return new Promise(function(_0x49381f,_0x253054){var _0x891dee=_[_0x5b14('0x5b')](_0x1e0b5b[_0x5b14('0x81')]);_0x49381f({'count':_0x891dee[_0x5b14('0x58')],'rows':_0x891dee});});},'SendFax':function(_0x55c0e2){var _0x56a634=this;return new Promise(function(_0x343fe3,_0x5c5f1c){_0x392425[_0x5b14('0x82')](_0x55c0e2)[_0x5b14('0x1b')](function(_0x3b9788){_0x343fe3({'code':0xc8,'message':_0x3b9788[_0x5b14('0x1c')]});})['catch'](function(_0x4221bc){_0x5c5f1c(_0x56a634[_0x5b14('0x11')](0x1f4,_0x4221bc[_0x5b14('0x1c')]));});});},'CheckAfterSend':function(_0x89d622){var _0x16d778=this;return new Promise(function(_0xd637cb,_0x869232){_0x392425[_0x5b14('0x83')](_0x89d622)[_0x5b14('0x1b')](function(_0x61a051){_0xd637cb({'code':0xc8,'message':_0x61a051['message']});})['catch'](function(_0x54911b){_0x869232(_0x16d778['error'](0x1f4,_0x54911b['message']));});});}};var _0x43c239=jayson[_0x5b14('0x84')](_0x1d12ed)[_0x5b14('0x85')]();_0x43c239['on'](_0x5b14('0x11'),function(_0x57021a){return _0x50fd91(_0x57021a);});_0x43c239[_0x5b14('0x86')](0x232a,_0x5b14('0x87'),function(){console[_0x5b14('0x88')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x4d82ad('RPC\x20listening\x20on\x20port:'+0x232a);});});}; \ No newline at end of file +var _0x8c46=['ami\x20disconnected','pick','command','Command','content','voiceQueues','strategy','answered','available','pTalking','sumDuration','sumHoldTime','total','type','abandoned','waiting','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','Interval','length','find','omit','undefined','values','channels','voicechannel','uniqueid','format','%s.%s','MixMonitor','channel','ai(mixmonitorid)','then','monitors','toLowerCase','/var/spool/asterisk/monitor/','mixmonitorid','rec','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','map','resolve','StopMixMonitor','destinationchannel','status','stop','filename','wav','StopMixMonitor\x20Success','queueChannels','voicequeuechannel','voicequeuechannelhangup','Hangup','Redirect','exten','context','trunks','outboundChannels','campaigns','event','emit','custom:','faxAccounts','send','checkAfterSend','http','127.0.0.1','RPC\x20listening\x20on\x20port:','lodash','validate','../../../config/environment','../properties','../ami','listen','%s/%s','SIP','name','timers','timer','agents','updateStatusRealtime','QueuePause','isConnected','error','asterisk','username','join','keys','Reload','Action','message','catch'];(function(_0x3fae22,_0x315beb){var _0x11499c=function(_0x31ee12){while(--_0x31ee12){_0x3fae22['push'](_0x3fae22['shift']());}};_0x11499c(++_0x315beb);}(_0x8c46,0x171));var _0x68c4=function(_0x212095,_0x3d442c){_0x212095=_0x212095-0x0;var _0x18a161=_0x8c46[_0x212095];return _0x18a161;};'use strict';var _=require(_0x68c4('0x0'));var util=require('util');var jayson=require('jayson/promise');var schema=require(_0x68c4('0x1'));var BPromise=require('bluebird');var moment=require('moment');var config=require(_0x68c4('0x2'));var properties=require(_0x68c4('0x3'));var ami=require(_0x68c4('0x4'));exports[_0x68c4('0x5')]=function(_0x287adb,_0x1243c6,_0x40ce21){return new BPromise(function(_0x1516cf,_0x3da9c3){var _0x458a2b={'QueuePause':function(_0x5e57ce){return new Promise(function(_0x1754d7,_0x1d40a3){var _0x2d3a88=util['format'](_0x68c4('0x6'),_0x68c4('0x7'),_0x5e57ce[_0x68c4('0x8')]);if(_0x287adb['timers']&&_0x287adb['timers'][_0x2d3a88]&&_0x287adb[_0x68c4('0x9')][_0x2d3a88][_0x68c4('0xa')]){_0x287adb['timers'][_0x2d3a88]['updateAcw']();}if(_0x287adb[_0x68c4('0xb')][_0x2d3a88]){_0x287adb[_0x68c4('0xb')][_0x2d3a88][_0x68c4('0xc')]({'statePause':_0x5e57ce['pause']?!![]:![]});}_0x1754d7({'code':0xc8,'message':_0x68c4('0xd')});});},'Reload':function(_0x1f5f42){var _0x200623=this;return new Promise(function(_0x56e361,_0x11eb66){if(ami[_0x68c4('0xe')]()==![]){return _0x11eb66(_0x200623[_0x68c4('0xf')](0x1f4,[config['asterisk']['ip'],config[_0x68c4('0x10')][_0x68c4('0x11')],'ami\x20disconnected'][_0x68c4('0x12')]('\x20')));}_0x1f5f42=_['pick'](_0x1f5f42,_[_0x68c4('0x13')](properties['module']));_0x1f5f42['action']=_0x68c4('0x14');return ami[_0x68c4('0x15')](_0x1f5f42)['then'](function(_0x2d6c1b){_0x56e361({'code':0xc8,'message':_0x2d6c1b[_0x68c4('0x16')]});})[_0x68c4('0x17')](function(_0x33c5c5){_0x11eb66(_0x200623[_0x68c4('0xf')](0x1f5,_0x33c5c5[_0x68c4('0x16')]));});});},'Command':function(_0x334e40){var _0x415ef2=this;return new Promise(function(_0x1ee182,_0x3befda){if(ami[_0x68c4('0xe')]()==![]){return _0x3befda(_0x415ef2['error'](0x1f4,[config[_0x68c4('0x10')]['ip'],config['asterisk']['username'],_0x68c4('0x18')][_0x68c4('0x12')]('\x20')));}_0x334e40=_[_0x68c4('0x19')](_0x334e40,_0x68c4('0x1a'));_0x334e40['action']=_0x68c4('0x1b');return ami[_0x68c4('0x15')](_0x334e40)['then'](function(_0x201742){_0x1ee182({'code':0xc8,'message':_0x201742[_0x68c4('0x1c')]});})[_0x68c4('0x17')](function(_0x10278e){_0x3befda(_0x415ef2[_0x68c4('0xf')](0x1f5,_0x10278e[_0x68c4('0x16')]));});});},'VoiceQueues':function(_0x37e9a9){return new Promise(function(_0x505db4,_0x2ff4a5){var _0x55355d=[];for(var _0xf16a78 in _0x287adb[_0x68c4('0x1d')]){if(_0x287adb[_0x68c4('0x1d')]['hasOwnProperty'](_0xf16a78)){var _0x1e14db=_0x287adb[_0x68c4('0x1d')][_0xf16a78];var _0x496f4d={'id':_0x1e14db['id'],'name':_0x1e14db[_0x68c4('0x8')],'strategy':_0x1e14db[_0x68c4('0x1e')],'answered':_0x1e14db[_0x68c4('0x1f')],'available':_0x1e14db[_0x68c4('0x20')],'loggedIn':_0x1e14db['loggedIn'],'pTalking':_0x1e14db[_0x68c4('0x21')],'sumBillable':_0x1e14db['sumBillable'],'sumDuration':_0x1e14db[_0x68c4('0x22')],'sumHoldTime':_0x1e14db[_0x68c4('0x23')]||0x0,'talking':_0x1e14db['talking'],'total':_0x1e14db[_0x68c4('0x24')],'type':_0x1e14db[_0x68c4('0x25')],'unmanaged':_0x1e14db['unmanaged'],'abandoned':_0x1e14db[_0x68c4('0x26')],'waiting':_0x1e14db[_0x68c4('0x27')],'loggedInDb':_0x1e14db[_0x68c4('0x28')]};if(_0x1e14db[_0x68c4('0x25')]===_0x68c4('0x29')){_0x496f4d[_0x68c4('0x2a')]=_0x1e14db[_0x68c4('0x2a')];_0x496f4d[_0x68c4('0x2b')]=_0x1e14db[_0x68c4('0x2b')];_0x496f4d[_0x68c4('0x2c')]=_0x1e14db[_0x68c4('0x2c')];_0x496f4d[_0x68c4('0x2d')]=_0x1e14db[_0x68c4('0x2d')];_0x496f4d[_0x68c4('0x2e')]=_0x1e14db[_0x68c4('0x2e')];_0x496f4d[_0x68c4('0x2f')]=_0x1e14db[_0x68c4('0x2f')];_0x496f4d[_0x68c4('0x30')]=_0x1e14db['temp'];_0x496f4d[_0x68c4('0x31')]=_0x1e14db[_0x68c4('0x31')];_0x496f4d[_0x68c4('0x32')]=_0x1e14db[_0x68c4('0x32')];_0x496f4d[_0x68c4('0x33')]=_0x1e14db['outboundBlacklistCallsDay'];_0x496f4d[_0x68c4('0x34')]=_0x1e14db['outboundBusyCallsDay'];_0x496f4d['outboundCongestionCallsDay']=_0x1e14db['outboundCongestionCallsDay'];_0x496f4d[_0x68c4('0x35')]=_0x1e14db[_0x68c4('0x35')];_0x496f4d[_0x68c4('0x36')]=_0x1e14db[_0x68c4('0x36')];_0x496f4d['outboundDropCallsDayTimeout']=_0x1e14db[_0x68c4('0x37')];_0x496f4d[_0x68c4('0x38')]=_0x1e14db[_0x68c4('0x38')];_0x496f4d['outboundNoSuchCallsDay']=_0x1e14db[_0x68c4('0x39')];_0x496f4d[_0x68c4('0x3a')]=_0x1e14db[_0x68c4('0x3a')];_0x496f4d[_0x68c4('0x3b')]=_0x1e14db[_0x68c4('0x3b')];_0x496f4d[_0x68c4('0x3c')]=_0x1e14db[_0x68c4('0x3c')];_0x496f4d[_0x68c4('0x3d')]=_0x1e14db[_0x68c4('0x3d')];_0x496f4d[_0x68c4('0x3e')]=_0x1e14db['predictiveIntervalAnsweredCalls'];_0x496f4d['predictiveIntervalAvgHoldtime']=_0x1e14db[_0x68c4('0x3f')];_0x496f4d[_0x68c4('0x40')]=_0x1e14db[_0x68c4('0x40')];_0x496f4d[_0x68c4('0x41')]=_0x1e14db[_0x68c4('0x41')];_0x496f4d[_0x68c4('0x42')]=_0x1e14db[_0x68c4('0x42')];_0x496f4d[_0x68c4('0x43')]=_0x1e14db[_0x68c4('0x43')];_0x496f4d[_0x68c4('0x44')]=_0x1e14db[_0x68c4('0x44')];_0x496f4d[_0x68c4('0x45')]=_0x1e14db[_0x68c4('0x45')];_0x496f4d['predictiveIntervalMultiplicativeFactor']=_0x1e14db['predictiveIntervalMultiplicativeFactor'];_0x496f4d[_0x68c4('0x46')]=_0x1e14db[_0x68c4('0x46')];_0x496f4d[_0x68c4('0x47')]=_0x1e14db[_0x68c4('0x47')];_0x496f4d['predictiveIntervalTotalCalls']=_0x1e14db[_0x68c4('0x48')];_0x496f4d[_0x68c4('0x16')]=_0x1e14db['message'];_0x496f4d['originated']=_0x1e14db['originated'];_0x496f4d[_0x68c4('0x49')]=_0x1e14db['erlangCalls'];_0x496f4d[_0x68c4('0x4a')]=_0x1e14db['erlangCallToSecond'];_0x496f4d[_0x68c4('0x4b')]=_0x1e14db[_0x68c4('0x4b')];_0x496f4d[_0x68c4('0x4c')]=_0x1e14db[_0x68c4('0x4c')];_0x496f4d['startPredictive']=_0x1e14db[_0x68c4('0x4d')];_0x496f4d[_0x68c4('0x4e')]=_0x1e14db[_0x68c4('0x4e')];}if(_0x1e14db[_0x68c4('0x4f')]){_0x496f4d['Trunk']={'id':_0x1e14db[_0x68c4('0x4f')]['id'],'name':_0x1e14db[_0x68c4('0x4f')][_0x68c4('0x8')],'active':_0x1e14db[_0x68c4('0x4f')][_0x68c4('0x50')],'callerid':_0x1e14db['Trunk']['callerid']};}if(_0x1e14db['Interval']){_0x496f4d[_0x68c4('0x51')]={'id':_0x1e14db[_0x68c4('0x51')]['id'],'name':_0x1e14db[_0x68c4('0x51')][_0x68c4('0x8')]};}_0x55355d['push'](_0x496f4d);}}_0x505db4({'count':_0x55355d[_0x68c4('0x52')],'rows':_0x55355d});});},'UpdateVoiceQueue':function(_0x2169af){return new Promise(function(_0x3fc17e,_0x4159e7){var _0x25be7a=_[_0x68c4('0x53')](_0x287adb[_0x68c4('0x1d')],{'id':parseInt(_0x2169af['id'])});var _0x5b8209=_[_0x68c4('0x54')](_0x2169af,['id']);if(_0x25be7a){for(var _0x9d03e6 in _0x5b8209){if(typeof _0x5b8209[_0x9d03e6]!==_0x68c4('0x55')&&typeof _0x25be7a[_0x9d03e6]!=='undefined'){_0x25be7a[_0x9d03e6]=_0x5b8209[_0x9d03e6];}}_0x3fc17e(_0x25be7a);}else{_0x4159e7();}});},'VoiceChannels':function(_0x1c5206){return new Promise(function(_0x4e796c,_0x3a5a43){var _0x44e3c9=_[_0x68c4('0x56')](_0x287adb[_0x68c4('0x57')]);_0x4e796c({'count':_0x44e3c9['length'],'rows':_0x44e3c9});});},'VoiceChannelMixMonitor':function(_0x44a068){var _0x47d6b5=this;return new Promise(function(_0x202f59,_0x391143){if(ami['isConnected']()==![]){return _0x391143(_0x47d6b5[_0x68c4('0xf')](0x1f4,[config[_0x68c4('0x10')]['ip'],config[_0x68c4('0x10')][_0x68c4('0x11')],_0x68c4('0x18')][_0x68c4('0x12')]('\x20')));}var _0x519ddb=schema(properties[_0x68c4('0x58')])[_0x68c4('0x1')](_0x44a068);if(_0x519ddb[_0x68c4('0x52')]>0x0){return _0x391143(_0x47d6b5[_0x68c4('0xf')](0x1f4,_['map'](_0x519ddb,_0x68c4('0x16'))[_0x68c4('0x12')](',\x20')));}var _0x1b15c4=_[_0x68c4('0x53')](_0x287adb[_0x68c4('0x57')],{'uniqueid':_0x44a068[_0x68c4('0x59')]});if(_0x1b15c4&&_0x1b15c4['channel']){var _0x102fc=util[_0x68c4('0x5a')](_0x68c4('0x5b'),_0x44a068['filename']||_0x44a068[_0x68c4('0x59')],_0x44a068[_0x68c4('0x5a')]||'wav');return ami['Action']({'action':_0x68c4('0x5c'),'channel':_0x1b15c4[_0x68c4('0x5d')],'file':_0x102fc,'options':_0x68c4('0x5e')})[_0x68c4('0x5f')](function(_0x395f29){var _0x91c18e=_[_0x68c4('0x53')](_0x1b15c4[_0x68c4('0x60')],{'filename':'/var/spool/asterisk/monitor/'+_0x102fc[_0x68c4('0x61')]()});if(_['isNil'](_0x91c18e)){_0x1b15c4['monitors']['push']({'filename':_0x68c4('0x62')+_0x102fc[_0x68c4('0x61')](),'createdAt':moment()[_0x68c4('0x5a')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x395f29[_0x68c4('0x63')],'status':_0x68c4('0x64')});}else{_0x91c18e['mixmonitorid']=_0x395f29[_0x68c4('0x63')];_0x91c18e['status']=_0x68c4('0x64');}_0x202f59({'code':0xc8,'message':[_0x44a068['uniqueid'],_0x68c4('0x65'),_0x395f29[_0x68c4('0x63')]]['join']('\x20'),'mixmonitorid':_0x395f29[_0x68c4('0x63')]});})[_0x68c4('0x17')](function(_0x57d009){_0x391143(_0x47d6b5[_0x68c4('0xf')](0x1f5,[_0x44a068[_0x68c4('0x59')],_0x57d009['message'][_0x68c4('0x61')]()][_0x68c4('0x12')]('\x20')));});}else{return _0x391143(_0x47d6b5[_0x68c4('0xf')](0x1f5,_0x68c4('0x66')));}});},'VoiceChannelStopMixMonitor':function(_0x2d50c8){var _0x159f8b=this;return new Promise(function(_0x1a2ede,_0x22424b){if(ami[_0x68c4('0xe')]()==![]){return _0x22424b(_0x159f8b['error'](0x1f4,[config[_0x68c4('0x10')]['ip'],config[_0x68c4('0x10')][_0x68c4('0x11')],_0x68c4('0x18')][_0x68c4('0x12')]('\x20')));}var _0x120345=schema(properties[_0x68c4('0x58')])['validate'](_0x2d50c8);if(_0x120345['length']>0x0){return _0x22424b(_0x159f8b[_0x68c4('0xf')](0x1f4,_[_0x68c4('0x67')](_0x120345,'message')[_0x68c4('0x12')](',\x20')));}var _0x91e7b6=_[_0x68c4('0x53')](_0x287adb[_0x68c4('0x57')],{'uniqueid':_0x2d50c8[_0x68c4('0x59')]});if(_0x91e7b6){return BPromise[_0x68c4('0x68')]()['then'](function(){if(_0x91e7b6[_0x68c4('0x5d')]){return ami[_0x68c4('0x15')]({'action':_0x68c4('0x69'),'channel':_0x91e7b6[_0x68c4('0x5d')],'mixmonitorid':_0x2d50c8[_0x68c4('0x63')]})['catch'](function(_0x4bb60c){});}})[_0x68c4('0x5f')](function(){if(_0x91e7b6[_0x68c4('0x6a')]){return ami[_0x68c4('0x15')]({'action':_0x68c4('0x69'),'channel':_0x91e7b6[_0x68c4('0x6a')],'mixmonitorid':_0x2d50c8['mixmonitorid']})[_0x68c4('0x17')](function(_0x43db7f){});}})[_0x68c4('0x5f')](function(_0x231e7f){var _0x3d098a=_[_0x68c4('0x53')](_0x91e7b6[_0x68c4('0x60')],{'mixmonitorid':_0x2d50c8[_0x68c4('0x63')]});if(_0x3d098a){_0x3d098a[_0x68c4('0x6b')]=_0x68c4('0x6c');}})['then'](function(){var _0x418647=util['format'](_0x68c4('0x5b'),_0x2d50c8[_0x68c4('0x6d')]||_0x2d50c8[_0x68c4('0x59')],_0x2d50c8['format']||_0x68c4('0x6e'));var _0x4fa64d=_[_0x68c4('0x53')](_0x91e7b6[_0x68c4('0x60')],{'filename':_0x68c4('0x62')+_0x418647[_0x68c4('0x61')]()});if(_0x4fa64d){_0x4fa64d[_0x68c4('0x6b')]='stop';}})[_0x68c4('0x5f')](function(){_0x1a2ede({'code':0xc8,'message':[_0x2d50c8[_0x68c4('0x59')],_0x68c4('0x6f')][_0x68c4('0x12')]('\x20')});})[_0x68c4('0x17')](function(_0x5811bb){_0x22424b(_0x159f8b[_0x68c4('0xf')](0x1f5,[_0x2d50c8[_0x68c4('0x59')],_0x5811bb[_0x68c4('0x16')]['toLowerCase']()][_0x68c4('0x12')]('\x20')));});}else{return _0x22424b(_0x159f8b[_0x68c4('0xf')](0x1f5,_0x68c4('0x66')));}});},'VoiceQueuesChannels':function(_0x4ab929){return new Promise(function(_0x2defc0,_0x5f019b){var _0x49a162=_[_0x68c4('0x56')](_0x287adb[_0x68c4('0x70')]);_0x2defc0({'count':_0x49a162[_0x68c4('0x52')],'rows':_0x49a162});});},'VoiceQueuesChannel':function(_0x508581){var _0x5b5353=this;return new Promise(function(_0x2395b1,_0x1ead72){var _0x4b0788=schema(properties[_0x68c4('0x71')])[_0x68c4('0x1')](_0x508581);if(_0x4b0788['length']>0x0){return _0x1ead72(_0x5b5353['error'](0x1f4,_[_0x68c4('0x67')](_0x4b0788,_0x68c4('0x16'))[_0x68c4('0x12')](',\x20')));}var _0x1e95ac=_['find'](_0x287adb[_0x68c4('0x70')],{'uniqueid':_0x508581['uniqueid']});if(_0x1e95ac){_0x2395b1(_0x1e95ac);}else{return _0x1ead72(_0x5b5353[_0x68c4('0xf')](0x1f5,_0x68c4('0x66')));}});},'VoiceQueuesChannelHangup':function(_0x2b81d8){var _0x3984d6=this;return new Promise(function(_0x284783,_0x6d38b0){if(ami[_0x68c4('0xe')]()==![]){return _0x6d38b0(_0x3984d6[_0x68c4('0xf')](0x1f4,[config['asterisk']['ip'],config[_0x68c4('0x10')]['username'],_0x68c4('0x18')][_0x68c4('0x12')]('\x20')));}var _0xce0b25=schema(properties[_0x68c4('0x72')])[_0x68c4('0x1')](_0x2b81d8);if(_0xce0b25[_0x68c4('0x52')]>0x0){return _0x6d38b0(_0x3984d6[_0x68c4('0xf')](0x1f4,_[_0x68c4('0x67')](_0xce0b25,_0x68c4('0x16'))[_0x68c4('0x12')](',\x20')));}var _0x3ec119=_[_0x68c4('0x53')](_0x287adb[_0x68c4('0x70')],{'uniqueid':_0x2b81d8[_0x68c4('0x59')]});if(_0x3ec119&&_0x3ec119[_0x68c4('0x5d')]){return ami[_0x68c4('0x15')]({'action':_0x68c4('0x73'),'channel':_0x3ec119[_0x68c4('0x5d')]})[_0x68c4('0x5f')](function(_0x289dd1){_0x284783({'code':0xc8,'message':[_0x2b81d8[_0x68c4('0x59')],_0x289dd1[_0x68c4('0x16')][_0x68c4('0x61')]()][_0x68c4('0x12')]('\x20')});})[_0x68c4('0x17')](function(_0x5c75cd){_0x6d38b0(_0x3984d6[_0x68c4('0xf')](0x1f5,[_0x2b81d8[_0x68c4('0x59')],_0x5c75cd['message'][_0x68c4('0x61')]()][_0x68c4('0x12')]('\x20')));});}else{return _0x6d38b0(_0x3984d6['error'](0x1f5,_0x68c4('0x66')));}});},'VoiceQueuesChannelRedirect':function(_0x1b704d){var _0x42d077=this;return new Promise(function(_0x920b1c,_0x350708){if(ami[_0x68c4('0xe')]()==![]){return _0x350708(_0x42d077[_0x68c4('0xf')](0x1f4,[config['asterisk']['ip'],config[_0x68c4('0x10')][_0x68c4('0x11')],_0x68c4('0x18')][_0x68c4('0x12')]('\x20')));}var _0x2377fc=schema(properties['voicequeuechannelredirect'])['validate'](_0x1b704d);if(_0x2377fc[_0x68c4('0x52')]>0x0){return _0x350708(_0x42d077[_0x68c4('0xf')](0x1f4,_[_0x68c4('0x67')](_0x2377fc,_0x68c4('0x16'))[_0x68c4('0x12')](',\x20')));}var _0x7c1578=_['find'](_0x287adb[_0x68c4('0x70')],{'uniqueid':_0x1b704d[_0x68c4('0x59')]});if(_0x7c1578&&_0x7c1578['channel']){return ami[_0x68c4('0x15')]({'action':_0x68c4('0x74'),'channel':_0x7c1578[_0x68c4('0x5d')],'exten':_0x1b704d[_0x68c4('0x75')],'context':_0x1b704d[_0x68c4('0x76')]||_0x7c1578[_0x68c4('0x76')],'priority':0x1})[_0x68c4('0x5f')](function(_0x10eea2){_0x920b1c({'code':0xc8,'message':[_0x1b704d[_0x68c4('0x59')],_0x10eea2[_0x68c4('0x16')][_0x68c4('0x61')]()][_0x68c4('0x12')]('\x20')});})[_0x68c4('0x17')](function(_0x2c372e){_0x350708(_0x42d077[_0x68c4('0xf')](0x1f5,[_0x1b704d['uniqueid'],_0x2c372e[_0x68c4('0x16')][_0x68c4('0x61')]()][_0x68c4('0x12')]('\x20')));});}else{return _0x350708(_0x42d077['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x16e8b1){return new Promise(function(_0x2ec0af,_0x5a4e83){var _0x2cf842=_[_0x68c4('0x56')](_0x287adb[_0x68c4('0xb')]);_0x2ec0af({'count':_0x2cf842[_0x68c4('0x52')],'rows':_0x2cf842});});},'Telephones':function(_0x59f44a){return new Promise(function(_0x2a5570,_0x3172dd){var _0x281a26=_[_0x68c4('0x56')](_0x287adb['telephones']);_0x2a5570({'count':_0x281a26[_0x68c4('0x52')],'rows':_0x281a26});});},'Trunks':function(_0x1c7475){return new Promise(function(_0x1a1141,_0x18a7d6){var _0x2cbfad=_[_0x68c4('0x56')](_0x287adb[_0x68c4('0x77')]);_0x1a1141({'count':_0x2cbfad[_0x68c4('0x52')],'rows':_0x2cbfad});});},'OutboundChannels':function(_0x5dbe25){return new Promise(function(_0x5cbe63,_0x6c8572){var _0x4f4a29=_[_0x68c4('0x56')](_0x287adb[_0x68c4('0x78')]);_0x5cbe63({'count':_0x4f4a29[_0x68c4('0x52')],'rows':_0x4f4a29});});},'Outbound':function(_0x89532b){return new Promise(function(_0x7e6405,_0x18d162){_0x7e6405(_0x287adb[_0x68c4('0x29')]);});},'Campaigns':function(_0xa7aee4){return new Promise(function(_0x4e44ea,_0x17731b){var _0x13b970=_['values'](_0x287adb[_0x68c4('0x79')]);_0x4e44ea({'count':_0x13b970[_0x68c4('0x52')],'rows':_0x13b970});});},'VoiceQueuesPreview':function(_0x3e7529){var _0x4a208e=this;return new Promise(function(_0x14c66c,_0x25d366){_0x1243c6['run'](_0x3e7529['id'])[_0x68c4('0x5f')](function(_0x2660f5){_0x14c66c({'code':0xc8,'message':_0x2660f5[_0x68c4('0x16')]});})[_0x68c4('0x17')](function(_0x3b626c){_0x25d366(_0x4a208e[_0x68c4('0xf')](0x1f4,_0x3b626c[_0x68c4('0x16')]));});});},'EventManager':function(_0x582c11){var _0x20e9cd=this;return new Promise(function(_0x4f980a,_0x464ff2){if(!_0x582c11[_0x68c4('0x7a')]){return _0x464ff2(_0x20e9cd[_0x68c4('0xf')](0x1f4,'Event\x20name\x20mandatory'));}ami[_0x68c4('0x7b')](_0x68c4('0x7c')+_0x582c11['event'],_0x582c11[_0x68c4('0x16')]);_0x4f980a({'code':0xc8,'message':_0x582c11});});},'FaxAccounts':function(_0x443ea0){return new Promise(function(_0x2a33f2,_0x22860f){var _0x6cd79a=_['values'](_0x287adb[_0x68c4('0x7d')]);_0x2a33f2({'count':_0x6cd79a[_0x68c4('0x52')],'rows':_0x6cd79a});});},'SendFax':function(_0x580c01){var _0x27f038=this;return new Promise(function(_0x298a4c,_0x219d9b){_0x40ce21[_0x68c4('0x7e')](_0x580c01)[_0x68c4('0x5f')](function(_0x5a938a){_0x298a4c({'code':0xc8,'message':_0x5a938a[_0x68c4('0x16')]});})[_0x68c4('0x17')](function(_0x1c8c17){_0x219d9b(_0x27f038[_0x68c4('0xf')](0x1f4,_0x1c8c17[_0x68c4('0x16')]));});});},'CheckAfterSend':function(_0x5d2d19){var _0x4d8333=this;return new Promise(function(_0x4ddc78,_0x5c247f){_0x40ce21[_0x68c4('0x7f')](_0x5d2d19)[_0x68c4('0x5f')](function(_0x34e3a2){_0x4ddc78({'code':0xc8,'message':_0x34e3a2[_0x68c4('0x16')]});})[_0x68c4('0x17')](function(_0x1c5275){_0x5c247f(_0x4d8333[_0x68c4('0xf')](0x1f4,_0x1c5275[_0x68c4('0x16')]));});});}};var _0x2f671c=jayson['server'](_0x458a2b)[_0x68c4('0x80')]();_0x2f671c['on'](_0x68c4('0xf'),function(_0x33c4fb){return _0x3da9c3(_0x33c4fb);});_0x2f671c[_0x68c4('0x5')](0x232a,_0x68c4('0x81'),function(){console['log']('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x1516cf(_0x68c4('0x82')+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 ecc84fa..cb828dd 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 _0xac31=['mobile','fax','ListId','createdAt','union','resolve','then','getContacts','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','info','[CM][%s][%s]\x20Contact\x20not\x20found','routeId','calleridname','','Unknown','destcalleridname','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','format','user:%s','name','trigger:%s','action','toLowerCase','lodash','bluebird','ioredis','util','../../../../config/environment','../../../../config/logger','trigger','redis','defaults','socket.io-emitter','[CM][%s][%s]','stringify','emit','data1','data2','isNil','data5','xmd-contactid','data3','phone','$or','map','destcalleridnum','calleridnum','firstName','lastName'];(function(_0x38b75c,_0xd912d3){var _0x12d29a=function(_0x52be94){while(--_0x52be94){_0x38b75c['push'](_0x38b75c['shift']());}};_0x12d29a(++_0xd912d3);}(_0xac31,0xca));var _0x1ac3=function(_0x9d2f02,_0x3a17be){_0x9d2f02=_0x9d2f02-0x0;var _0x3865ed=_0xac31[_0x9d2f02];return _0x3865ed;};'use strict';var _=require(_0x1ac3('0x0'));var BPromise=require(_0x1ac3('0x1'));var Redis=require(_0x1ac3('0x2'));var util=require(_0x1ac3('0x3'));var config=require(_0x1ac3('0x4'));var logger=require(_0x1ac3('0x5'))(_0x1ac3('0x6'));var cmContactRpc=require('../../rpc/cmContact');config[_0x1ac3('0x7')]=_[_0x1ac3('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x1ac3('0x9'))(new Redis(config[_0x1ac3('0x7')]));function emit(_0x2bf9b1,_0x1be223,_0x157604,_0x57893c,_0x2d17de){logger['info'](_0x1ac3('0xa'),_0x2bf9b1,_0x1be223['id'],_0x157604,_0x57893c,JSON[_0x1ac3('0xb')](_0x2d17de));io['to'](_0x157604)[_0x1ac3('0xc')](_0x57893c,_0x2d17de);}exports['exec']=function(_0xa26c88,_0x1e2642,_0x3e835b,_0x24f0d2){var _0x2a8dc7,_0x422d19;var _0x4b5c92={};var _0x3b38fc=Number(_0x3e835b[_0x1ac3('0xd')]);var _0x2eeabf=_0x3e835b[_0x1ac3('0xe')]?Boolean(Number(_0x3e835b['data2'])):![];var _0x88ed7c;var _0x37d426=![];if(!_[_0x1ac3('0xf')](_0x3e835b[_0x1ac3('0x10')])){if(_0x3e835b['data5']=='1')_0x37d426=!![];}if(!_0x37d426){if(_0x24f0d2[_0x1ac3('0x11')]){_0x4b5c92['id']=_0x24f0d2[_0x1ac3('0x11')];}}if(!_0x4b5c92['id']){_0x4b5c92['ListId']=_0x3b38fc;_0x88ed7c=_0x3e835b[_0x1ac3('0x12')]&&_0x3e835b[_0x1ac3('0x12')]!=='0'?_0x3e835b[_0x1ac3('0x12')]['split'](','):[_0x1ac3('0x13')];_0x4b5c92[_0x1ac3('0x14')]=_[_0x1ac3('0x15')](_0x88ed7c,function(_0x541744){var _0x195683={};_0x195683[_0x541744]=_0x24f0d2['routeId']?_0x24f0d2[_0x1ac3('0x16')]:_0x24f0d2[_0x1ac3('0x17')];return _0x195683;});}var _0x20091d=['id',_0x1ac3('0x18'),_0x1ac3('0x19'),'phone',_0x1ac3('0x1a'),_0x1ac3('0x1b'),_0x1ac3('0x1c'),_0x1ac3('0x1d'),'scheduledAt','updatedAt'];var _0x2879d8=_[_0x1ac3('0x1e')](_0x20091d,_0x88ed7c);BPromise[_0x1ac3('0x1f')]()[_0x1ac3('0x20')](cmContactRpc[_0x1ac3('0x21')]({'attributes':_0x2879d8,'where':_0x4b5c92}))[_0x1ac3('0x20')](function(_0x23b767){_0x422d19=_0x23b767;if(!_[_0x1ac3('0x22')](_0x422d19)){if(_0x422d19[_0x1ac3('0x23')]===0x1){_0x2a8dc7=_0x422d19[0x0];logger['info'](_0x1ac3('0x24'),_0x24f0d2[_0x1ac3('0x25')],_0x1e2642['id'],_0x2a8dc7['id']);}else{logger['info'](_0x1ac3('0x26'),_0x24f0d2[_0x1ac3('0x25')],_0x1e2642['id'],_['map'](_0x422d19,'id')[_0x1ac3('0x27')](','));}return;}else{logger[_0x1ac3('0x28')](_0x1ac3('0x29'),_0x24f0d2[_0x1ac3('0x25')],_0x1e2642['id']);var _0x10db3d={'ListId':_0x3b38fc};var _0x565a0f=_0x3e835b['data4']&&_0x3e835b['data4']!=='0'?_0x3e835b['data4']:'phone';if(_0x2eeabf){logger[_0x1ac3('0x28')]('[CM][%s][%s]\x20Autocreate\x20enabled',_0x24f0d2[_0x1ac3('0x25')],_0x1e2642['id']);_0x10db3d[_0x565a0f]=_[_0x1ac3('0xf')](_0x24f0d2[_0x1ac3('0x2a')])?_0x24f0d2[_0x1ac3('0x17')]:_0x24f0d2['destcalleridnum'];if(_[_0x1ac3('0xf')](_0x24f0d2['routeId'])){_0x10db3d[_0x1ac3('0x18')]=_0x24f0d2[_0x1ac3('0x2b')]&&_0x24f0d2[_0x1ac3('0x2b')]!==_0x1ac3('0x2c')?_0x24f0d2[_0x1ac3('0x2b')]:_0x1ac3('0x2d');}else{_0x10db3d[_0x1ac3('0x18')]=_0x24f0d2['destcalleridname']&&_0x24f0d2[_0x1ac3('0x2e')]!==_0x1ac3('0x2c')?_0x24f0d2[_0x1ac3('0x2e')]:_0x1ac3('0x2d');}return BPromise['resolve']()[_0x1ac3('0x20')](cmContactRpc[_0x1ac3('0x2f')](_0x10db3d))[_0x1ac3('0x20')](function(_0x294513){_0x2a8dc7=_0x294513;_0x422d19[_0x1ac3('0x30')](_0x294513);if(_0x2a8dc7){logger['info'](_0x1ac3('0x31'),_0x24f0d2[_0x1ac3('0x25')],_0x1e2642['id'],_0x2a8dc7['id']);}return;});}else{logger[_0x1ac3('0x28')](_0x1ac3('0x32'),_0x24f0d2[_0x1ac3('0x25')],_0x1e2642['id']);_0x10db3d[_0x565a0f]=_[_0x1ac3('0xf')](_0x24f0d2['routeId'])?_0x24f0d2[_0x1ac3('0x17')]:_0x24f0d2[_0x1ac3('0x16')];if(_[_0x1ac3('0xf')](_0x24f0d2[_0x1ac3('0x2a')])){_0x10db3d['firstName']=_0x24f0d2[_0x1ac3('0x2b')]&&_0x24f0d2[_0x1ac3('0x2b')]!==_0x1ac3('0x2c')?_0x24f0d2[_0x1ac3('0x2b')]:_0x1ac3('0x2d');}else{_0x10db3d[_0x1ac3('0x18')]=_0x24f0d2[_0x1ac3('0x2e')]&&_0x24f0d2[_0x1ac3('0x2e')]!==_0x1ac3('0x2c')?_0x24f0d2['destcalleridname']:_0x1ac3('0x2d');}_0x2a8dc7=_0x10db3d;_0x422d19[_0x1ac3('0x30')](_0x10db3d);return;}}})['then'](function(){if(_0xa26c88){emit(_0x24f0d2[_0x1ac3('0x25')],_0x1e2642,util[_0x1ac3('0x33')](_0x1ac3('0x34'),_0xa26c88[_0x1ac3('0x35')]),util[_0x1ac3('0x33')](_0x1ac3('0x36'),_0x3e835b[_0x1ac3('0x37')][_0x1ac3('0x38')]()),{'evt':_['merge'](_0x24f0d2,{'autoCreate':_0x2eeabf}),'contact':_0x2a8dc7===undefined?{}:_0x2a8dc7,'contacts':_0x422d19[_0x1ac3('0x23')]===0x0?undefined:_0x422d19});}});}; \ No newline at end of file +var _0x2dae=['uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','phone','[CM][%s][%s]\x20Autocreate\x20enabled','routeId','calleridname','Unknown','destcalleridname','','then','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','format','name','trigger:%s','action','toLowerCase','lodash','ioredis','util','../../../../config/environment','../../../../config/logger','trigger','redis','defaults','localhost','info','[CM][%s][%s]','stringify','exec','data1','data2','isNil','data5','xmd-contactid','data3','split','$or','map','destcalleridnum','calleridnum','firstName','lastName','mobile','fax','createdAt','scheduledAt','updatedAt','union','resolve','getContacts','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s'];(function(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0x2dae,0xc3));var _0xe2da=function(_0x33a694,_0x9b6640){_0x33a694=_0x33a694-0x0;var _0x41ff01=_0x2dae[_0x33a694];return _0x41ff01;};'use strict';var _=require(_0xe2da('0x0'));var BPromise=require('bluebird');var Redis=require(_0xe2da('0x1'));var util=require(_0xe2da('0x2'));var config=require(_0xe2da('0x3'));var logger=require(_0xe2da('0x4'))(_0xe2da('0x5'));var cmContactRpc=require('../../rpc/cmContact');config[_0xe2da('0x6')]=_[_0xe2da('0x7')](config[_0xe2da('0x6')],{'host':_0xe2da('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xe2da('0x6')]));function emit(_0x89c70b,_0x34cc98,_0x2efbd8,_0x238da3,_0x1c71ea){logger[_0xe2da('0x9')](_0xe2da('0xa'),_0x89c70b,_0x34cc98['id'],_0x2efbd8,_0x238da3,JSON[_0xe2da('0xb')](_0x1c71ea));io['to'](_0x2efbd8)['emit'](_0x238da3,_0x1c71ea);}exports[_0xe2da('0xc')]=function(_0x3baaa8,_0x104fb3,_0x17086c,_0x3c1309){var _0x44ec3e,_0x1a29b9;var _0x173244={};var _0x5aab71=Number(_0x17086c[_0xe2da('0xd')]);var _0x5200b1=_0x17086c[_0xe2da('0xe')]?Boolean(Number(_0x17086c[_0xe2da('0xe')])):![];var _0x37064e;var _0x411b9f=![];if(!_[_0xe2da('0xf')](_0x17086c[_0xe2da('0x10')])){if(_0x17086c[_0xe2da('0x10')]=='1')_0x411b9f=!![];}if(!_0x411b9f){if(_0x3c1309['xmd-contactid']){_0x173244['id']=_0x3c1309[_0xe2da('0x11')];}}if(!_0x173244['id']){_0x173244['ListId']=_0x5aab71;_0x37064e=_0x17086c['data3']&&_0x17086c[_0xe2da('0x12')]!=='0'?_0x17086c[_0xe2da('0x12')][_0xe2da('0x13')](','):['phone'];_0x173244[_0xe2da('0x14')]=_[_0xe2da('0x15')](_0x37064e,function(_0x2ea60e){var _0x33568f={};_0x33568f[_0x2ea60e]=_0x3c1309['routeId']?_0x3c1309[_0xe2da('0x16')]:_0x3c1309[_0xe2da('0x17')];return _0x33568f;});}var _0x417363=['id',_0xe2da('0x18'),_0xe2da('0x19'),'phone',_0xe2da('0x1a'),_0xe2da('0x1b'),'ListId',_0xe2da('0x1c'),_0xe2da('0x1d'),_0xe2da('0x1e')];var _0x203d36=_[_0xe2da('0x1f')](_0x417363,_0x37064e);BPromise[_0xe2da('0x20')]()['then'](cmContactRpc[_0xe2da('0x21')]({'attributes':_0x203d36,'where':_0x173244}))['then'](function(_0x30efdc){_0x1a29b9=_0x30efdc;if(!_[_0xe2da('0x22')](_0x1a29b9)){if(_0x1a29b9[_0xe2da('0x23')]===0x1){_0x44ec3e=_0x1a29b9[0x0];logger[_0xe2da('0x9')](_0xe2da('0x24'),_0x3c1309[_0xe2da('0x25')],_0x104fb3['id'],_0x44ec3e['id']);}else{logger[_0xe2da('0x9')](_0xe2da('0x26'),_0x3c1309['uniqueid'],_0x104fb3['id'],_[_0xe2da('0x15')](_0x1a29b9,'id')[_0xe2da('0x27')](','));}return;}else{logger[_0xe2da('0x9')](_0xe2da('0x28'),_0x3c1309[_0xe2da('0x25')],_0x104fb3['id']);var _0x230fb8={'ListId':_0x5aab71};var _0x124d93=_0x17086c['data4']&&_0x17086c[_0xe2da('0x29')]!=='0'?_0x17086c[_0xe2da('0x29')]:_0xe2da('0x2a');if(_0x5200b1){logger[_0xe2da('0x9')](_0xe2da('0x2b'),_0x3c1309[_0xe2da('0x25')],_0x104fb3['id']);_0x230fb8[_0x124d93]=_[_0xe2da('0xf')](_0x3c1309[_0xe2da('0x2c')])?_0x3c1309['calleridnum']:_0x3c1309['destcalleridnum'];if(_['isNil'](_0x3c1309[_0xe2da('0x2c')])){_0x230fb8[_0xe2da('0x18')]=_0x3c1309[_0xe2da('0x2d')]&&_0x3c1309[_0xe2da('0x2d')]!==''?_0x3c1309['calleridname']:_0xe2da('0x2e');}else{_0x230fb8[_0xe2da('0x18')]=_0x3c1309[_0xe2da('0x2f')]&&_0x3c1309[_0xe2da('0x2f')]!==_0xe2da('0x30')?_0x3c1309[_0xe2da('0x2f')]:_0xe2da('0x2e');}return BPromise[_0xe2da('0x20')]()[_0xe2da('0x31')](cmContactRpc['createContact'](_0x230fb8))['then'](function(_0x672767){_0x44ec3e=_0x672767;_0x1a29b9[_0xe2da('0x32')](_0x672767);if(_0x44ec3e){logger[_0xe2da('0x9')](_0xe2da('0x33'),_0x3c1309[_0xe2da('0x25')],_0x104fb3['id'],_0x44ec3e['id']);}return;});}else{logger[_0xe2da('0x9')](_0xe2da('0x34'),_0x3c1309[_0xe2da('0x25')],_0x104fb3['id']);_0x230fb8[_0x124d93]=_[_0xe2da('0xf')](_0x3c1309[_0xe2da('0x2c')])?_0x3c1309[_0xe2da('0x17')]:_0x3c1309[_0xe2da('0x16')];if(_[_0xe2da('0xf')](_0x3c1309[_0xe2da('0x2c')])){_0x230fb8[_0xe2da('0x18')]=_0x3c1309[_0xe2da('0x2d')]&&_0x3c1309[_0xe2da('0x2d')]!==_0xe2da('0x30')?_0x3c1309['calleridname']:_0xe2da('0x2e');}else{_0x230fb8[_0xe2da('0x18')]=_0x3c1309[_0xe2da('0x2f')]&&_0x3c1309['destcalleridname']!==_0xe2da('0x30')?_0x3c1309[_0xe2da('0x2f')]:_0xe2da('0x2e');}_0x44ec3e=_0x230fb8;_0x1a29b9['push'](_0x230fb8);return;}}})['then'](function(){if(_0x3baaa8){emit(_0x3c1309[_0xe2da('0x25')],_0x104fb3,util[_0xe2da('0x35')]('user:%s',_0x3baaa8[_0xe2da('0x36')]),util[_0xe2da('0x35')](_0xe2da('0x37'),_0x17086c[_0xe2da('0x38')][_0xe2da('0x39')]()),{'evt':_['merge'](_0x3c1309,{'autoCreate':_0x5200b1}),'contact':_0x44ec3e===undefined?{}:_0x44ec3e,'contacts':_0x1a29b9[_0xe2da('0x23')]===0x0?undefined:_0x1a29b9});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 66660d5..fa2e7bd 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 _0x33ac=['voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','custom:agentcalled','syncCustomEvent','custom:agentconnect','bind','custom:agentringnoanswer','custom:agentcomplete','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentbusy','custom:agentcongestion','custom:agentreject','custom:amd','custom:queuecallerabandon','custom:dialbegin','custom:dialconnect','syncAgentDial','custom:dialend','custom:newinteraction','custom:substatus','custom:incomingmessage','custom:acceptmessage','custom:rejectmessage','custom:offlineMessage','prototype','info','emit','clone','undefined','voice','checkTriggers','agents','interface','hasOwnProperty','status','checkTrigger','merge','Actions','length','contactmanager','motionbar','browser','data1','TemplateId','data2','html','template\x20not\x20found','uri','isNil','data3','data4','location','uriLocation','windowWidth','data5','800','windowHeight','data6','600','render','winArguments','format','user:%s','name','action','toLowerCase','jscripty','trigger:%s','exec','integration','queue','routeId','urlforward','script','parse','query','search','replace','channel','motionChannel','AllConditions','AnyConditions','some','checkConditions','field','ChatWebsiteId','operator','upperFirst','AccountId','value','interaction','message','event','membername','lastevent','mailSubstatus','null','substatus','created','exports','lodash','ioredis','./urlforward','./integration','./cmContact','./script','../../../config/environment','../../../config/logger','trigger','../ami','redis','localhost','popup','url','winapp','triggers','voiceQueues','templates'];(function(_0x2b9e10,_0x47329f){var _0x12fea6=function(_0x369ae7){while(--_0x369ae7){_0x2b9e10['push'](_0x2b9e10['shift']());}};_0x12fea6(++_0x47329f);}(_0x33ac,0x1f2));var _0xc33a=function(_0x18a643,_0x12db06){_0x18a643=_0x18a643-0x0;var _0x3500c8=_0x33ac[_0x18a643];return _0x3500c8;};'use strict';var util=require('util');var _=require(_0xc33a('0x0'));var url=require('url');var Mustache=require('mustache');var Redis=require(_0xc33a('0x1'));var urlforward=require(_0xc33a('0x2'));var integration=require(_0xc33a('0x3'));var cmContact=require(_0xc33a('0x4'));var script=require(_0xc33a('0x5'));var config=require(_0xc33a('0x6'));var logger=require(_0xc33a('0x7'))(_0xc33a('0x8'));var ami=require(_0xc33a('0x9'));config['redis']=_['defaults'](config[_0xc33a('0xa')],{'host':_0xc33a('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xc33a('0xa')]));var operators={'equals':function(_0x5d55b8,_0x3a598a){return _0x5d55b8==_0x3a598a;},'not_equals':function(_0x2dc672,_0x288e87){return _0x2dc672!=_0x288e87;}};var barAndWebActions=[_0xc33a('0xc'),_0xc33a('0xd'),_0xc33a('0xe')];function Trigger(_0x2a6228){this[_0xc33a('0xf')]=_0x2a6228[_0xc33a('0xf')];this['agents']=_0x2a6228['agents'];this[_0xc33a('0x10')]=_0x2a6228['voiceQueues'];this['templates']=_0x2a6228[_0xc33a('0x11')];this[_0xc33a('0x12')]=_0x2a6228[_0xc33a('0x12')];this[_0xc33a('0x13')]=_0x2a6228[_0xc33a('0x13')];this[_0xc33a('0x14')]=_0x2a6228['freshdeskAccounts'];this[_0xc33a('0x15')]=_0x2a6228[_0xc33a('0x15')];this[_0xc33a('0x16')]=_0x2a6228['sugarcrmAccounts'];this[_0xc33a('0x17')]=_0x2a6228['zohoAccounts'];this[_0xc33a('0x18')]=_0x2a6228[_0xc33a('0x18')];this[_0xc33a('0x19')]=_0x2a6228[_0xc33a('0x19')];this[_0xc33a('0x1a')]=_0x2a6228['servicenowAccounts'];this['dynamics365Accounts']=_0x2a6228[_0xc33a('0x1b')];this[_0xc33a('0x1c')]=_0x2a6228[_0xc33a('0x1c')];this[_0xc33a('0x1d')]={'zendesk':this[_0xc33a('0x13')],'salesforce':this[_0xc33a('0x15')],'freshdesk':this[_0xc33a('0x14')],'sugarcrm':this[_0xc33a('0x16')],'zoho':this['zohoAccounts'],'desk':this[_0xc33a('0x18')],'vtiger':this[_0xc33a('0x19')],'dynamics365':this[_0xc33a('0x1b')],'freshsales':this[_0xc33a('0x1c')],'servicenow':this['servicenowAccounts']};ami['on'](_0xc33a('0x1e'),this[_0xc33a('0x1f')]['bind'](this));ami['on'](_0xc33a('0x20'),this[_0xc33a('0x1f')][_0xc33a('0x21')](this));ami['on'](_0xc33a('0x22'),this[_0xc33a('0x1f')][_0xc33a('0x21')](this));ami['on'](_0xc33a('0x23'),this[_0xc33a('0x1f')][_0xc33a('0x21')](this));ami['on'](_0xc33a('0x24'),this[_0xc33a('0x1f')][_0xc33a('0x21')](this));ami['on'](_0xc33a('0x25'),this[_0xc33a('0x1f')][_0xc33a('0x21')](this));ami['on'](_0xc33a('0x26'),this[_0xc33a('0x1f')][_0xc33a('0x21')](this));ami['on'](_0xc33a('0x27'),this['syncCustomEvent'][_0xc33a('0x21')](this));ami['on'](_0xc33a('0x28'),this[_0xc33a('0x1f')]['bind'](this));ami['on'](_0xc33a('0x29'),this[_0xc33a('0x1f')][_0xc33a('0x21')](this));ami['on'](_0xc33a('0x2a'),this[_0xc33a('0x1f')][_0xc33a('0x21')](this));ami['on']('custom:timeout',this[_0xc33a('0x1f')][_0xc33a('0x21')](this));ami['on'](_0xc33a('0x2b'),this['syncAgentDial']['bind'](this));ami['on'](_0xc33a('0x2c'),this[_0xc33a('0x2d')][_0xc33a('0x21')](this));ami['on'](_0xc33a('0x2e'),this[_0xc33a('0x2d')][_0xc33a('0x21')](this));ami['on'](_0xc33a('0x2f'),this[_0xc33a('0x1f')][_0xc33a('0x21')](this));ami['on']('custom:closedinteraction',this['syncCustomEvent']['bind'](this));ami['on'](_0xc33a('0x30'),this[_0xc33a('0x1f')][_0xc33a('0x21')](this));ami['on'](_0xc33a('0x31'),this[_0xc33a('0x1f')][_0xc33a('0x21')](this));ami['on']('custom:outgoingmessage',this[_0xc33a('0x1f')][_0xc33a('0x21')](this));ami['on'](_0xc33a('0x32'),this[_0xc33a('0x1f')][_0xc33a('0x21')](this));ami['on'](_0xc33a('0x33'),this[_0xc33a('0x1f')][_0xc33a('0x21')](this));ami['on'](_0xc33a('0x34'),this[_0xc33a('0x1f')][_0xc33a('0x21')](this));}Trigger[_0xc33a('0x35')]['emit']=function(_0x254de4,_0x583bae,_0x58965a){logger[_0xc33a('0x36')](_0x254de4,_0x583bae,JSON['stringify'](_0x58965a));io['to'](_0x254de4)[_0xc33a('0x37')](_0x583bae,_0x58965a);};Trigger[_0xc33a('0x35')][_0xc33a('0x1f')]=function(_0x2bfc2f){var _0x14db10=_[_0xc33a('0x38')](_0x2bfc2f);if(typeof _0x14db10['motionChannel']===_0xc33a('0x39')){_0x14db10['motionChannel']=_0xc33a('0x3a');}this[_0xc33a('0x3b')](_0x14db10);};Trigger[_0xc33a('0x35')][_0xc33a('0x2d')]=function(_0x424b44){if(this[_0xc33a('0x3c')][_0x424b44[_0xc33a('0x3d')]]){this[_0xc33a('0x1f')](_0x424b44);}};Trigger[_0xc33a('0x35')][_0xc33a('0x3b')]=function(_0x4a68c2){var _0xc0b878;for(var _0x3c16bf in this[_0xc33a('0xf')]){if(this['triggers'][_0xc33a('0x3e')](_0x3c16bf)){if(this[_0xc33a('0xf')][_0x3c16bf][_0xc33a('0x3f')]){_0xc0b878=this[_0xc33a('0x40')](this['triggers'][_0x3c16bf],_0x4a68c2);if(_0xc0b878){_[_0xc33a('0x41')](_0x4a68c2,_0x4a68c2['variables']);for(var _0x573f88=0x0,_0x103a1c,_0x31e94f,_0x3586e1;_0x573f880x0){_0x3565cf=_['map'](_0x2dd5f,_0x40dc8f);}return _0x3565cf;}function getCustomFields(_0x33a1a5,_0x4690a6){var _0x45b675=[];var _0x50f9f5={'custom_fields':{}};if(_0x33a1a5[_0x43e7('0x28')]>0x0){_[_0x43e7('0x29')](_0x33a1a5,function(_0x2b85a5){if(_[_0x43e7('0x2a')]([_0x43e7('0x2b'),_0x43e7('0x2c')],_0x2b85a5[_0x43e7('0x2d')])&&_0x2b85a5[_0x43e7('0x2e')]&&!_0x2b85a5[_0x43e7('0x2f')]){_0x50f9f5[_0x2b85a5[_0x43e7('0x2e')]['toLowerCase']()]=_0x2b85a5[_0x43e7('0x30')][_0x43e7('0x21')]();}else if(_[_0x43e7('0x2a')]([_0x43e7('0x2b'),_0x43e7('0x2c')],_0x2b85a5['type'])&&_0x2b85a5[_0x43e7('0x31')]&&_0x2b85a5[_0x43e7('0x2f')]){_0x50f9f5[_0x43e7('0x32')][_0x2b85a5[_0x43e7('0x31')]]=_0x2b85a5['content']['toString']();}else if(_0x2b85a5['type']===_0x43e7('0x33')&&_0x2b85a5[_0x43e7('0x34')]&&_0x2b85a5[_0x43e7('0x31')]&&_0x2b85a5[_0x43e7('0x2f')]){_0x4690a6[_0x2b85a5[_0x43e7('0x34')]]&&(_0x50f9f5[_0x43e7('0x32')][_0x2b85a5['idField']]=_0x4690a6[_0x2b85a5['variableName']]['toString']());}else if(_0x2b85a5['type']==='customVariable'&&_0x2b85a5['Variable']&&_0x2b85a5['Variable'][_0x43e7('0x35')]&&_0x2b85a5['idField']&&_0x2b85a5[_0x43e7('0x2f')]){_0x4690a6[_0x2b85a5[_0x43e7('0x36')][_0x43e7('0x35')][_0x43e7('0x37')]()]&&(_0x50f9f5[_0x43e7('0x32')][_0x2b85a5[_0x43e7('0x31')]]=_0x4690a6[_0x2b85a5[_0x43e7('0x36')]['name']['toLowerCase']()]['toString']());}});}if(_0x50f9f5[_0x43e7('0x38')]){_0x50f9f5[_0x43e7('0x38')]=Number(_0x50f9f5[_0x43e7('0x38')]);}return _0x50f9f5;}function getTicket(_0x16cdba,_0x1b1440,_0x1ed538,_0x1d4589,_0x2ffd43){logger['info'](_0x43e7('0x39'));var _0x2b0ffe=_['merge']({'subject':intUtil[_0x43e7('0x3a')](_0x1d4589['Subjects'],_0x2ffd43,'\x20'),'type':_0x43e7('0x3b'),'status':_0x43e7('0x3c'),'labels':[_0x43e7('0x3d'),_0x43e7('0x3e'),_0x43e7('0x3f')][_0x43e7('0x40')](getTags(_0x1d4589['Tags'],'name')),'description':intUtil[_0x43e7('0x3a')](_0x1d4589[_0x43e7('0x41')],_0x2ffd43,'\x0a'),'_links':{'assigned_user':{'href':util[_0x43e7('0x16')](_0x43e7('0x42'),_0x1b1440['id']),'class':_0x43e7('0x43')}},'message':{'direction':'in','body':intUtil['getString'](_0x1d4589[_0x43e7('0x41')],_0x2ffd43,'\x0a')}},getCustomFields(_0x1d4589[_0x43e7('0x44')],_0x2ffd43));return request({'uri':util['format'](_0x43e7('0x45'),_0x16cdba['remoteUri'],_0x1ed538['id']),'method':_0x43e7('0x27'),'body':_0x2b0ffe});}exports['queue']=function(_0x3d81ae,_0x3b4235,_0x3a5807,_0x1c2c6b,_0x49b866,_0x47d6a1){var _0x103393,_0x40c509;_0x47d6a1[_0x43e7('0x14')]=intUtil[_0x43e7('0x46')](_0x47d6a1['remoteUri']);_0x47d6a1['serverUrl']=intUtil['stripTrailingSlash'](_0x47d6a1[_0x43e7('0x47')]);if(_0x49b866&&_0x49b866['monitor_format']){logger[_0x43e7('0xb')]('[QUEUE]','Recording\x20is\x20enabled!');_0x3b4235[_0x43e7('0x48')]=util['format'](_0x43e7('0x49'),_0x47d6a1[_0x43e7('0x47')],_0x3b4235[_0x43e7('0x4a')],md5(_0x3b4235[_0x43e7('0x4a')]));}else{_0x3b4235['recordingURL']='';}headers[_0x43e7('0x4b')]=getAuth(_0x47d6a1);return getUser(_0x47d6a1,_0x1c2c6b[_0x43e7('0x4c')])[_0x43e7('0xe')](function(_0x1fd277){_0x103393=_0x1fd277;logger[_0x43e7('0xb')](_0x43e7('0x4d'),_0x103393['id']);return getEndUser(_0x47d6a1,_0x3b4235['calleridname'],_0x3b4235['calleridnum']);})[_0x43e7('0xe')](function(_0x36a09e){_0x40c509=_0x36a09e;logger[_0x43e7('0xb')]('The\x20Enduser\x20ID\x20is:',_0x40c509['id']);return getTicket(_0x47d6a1,_0x103393,_0x40c509,_0x3a5807,_0x3b4235);})['then'](function(_0x56489b){if(_0x56489b){logger[_0x43e7('0xb')](_0x43e7('0x4e'));logger['info'](_0x43e7('0x4f'),_0x56489b['id']);switch(_0x47d6a1[_0x43e7('0x2d')]){case _0x43e7('0x50'):logger['info']('[QUEUE]','Displaying\x20ticket\x20to\x20agent...');emit(util['format'](_0x43e7('0x51'),_0x1c2c6b[_0x43e7('0x35')]),'trigger:desk:display',{'recordId':_0x56489b['id']});break;case _0x43e7('0x52'):logger[_0x43e7('0xb')](_0x43e7('0x53'),_0x43e7('0x54'));emit(util['format'](_0x43e7('0x51'),_0x1c2c6b['name']),'trigger:browser:url',{'uri':util[_0x43e7('0x16')](_0x43e7('0x55'),_0x56489b['id'])});break;default:logger[_0x43e7('0x56')](_0x43e7('0x53'),_0x43e7('0x57'));}}})[_0x43e7('0x58')](function(_0x1cd87c){console[_0x43e7('0x56')](_0x1cd87c);logger[_0x43e7('0x56')](_0x43e7('0x53'),JSON['stringify'](_0x1cd87c));});};exports[_0x43e7('0x59')]=function(_0x46c910,_0x499c03,_0x39e3ca,_0x4e6f6d,_0x35b799,_0x520857,_0x34e2ec){var _0x1f561f,_0xfe13fa;_0x520857['remoteUri']=intUtil['stripTrailingSlash'](_0x520857[_0x43e7('0x14')]);_0x520857[_0x43e7('0x47')]=intUtil[_0x43e7('0x46')](_0x520857[_0x43e7('0x47')]);if(_0x34e2ec&&_0x34e2ec[_0x43e7('0x5a')]&&_0x34e2ec[_0x43e7('0x5a')]!==_0x43e7('0x5b')){logger[_0x43e7('0xb')](_0x43e7('0x5c'),_0x43e7('0x5d'));_0x499c03[_0x43e7('0x48')]=util['format'](_0x43e7('0x49'),_0x520857[_0x43e7('0x47')],_0x499c03['uniqueid'],md5(_0x499c03[_0x43e7('0x4a')]));}headers[_0x43e7('0x4b')]=getAuth(_0x520857);return getUser(_0x520857,_0x4e6f6d[_0x43e7('0x4c')])['then'](function(_0x5d63c6){_0x1f561f=_0x5d63c6;logger[_0x43e7('0xb')](_0x43e7('0x4d'),_0x1f561f['id']);return getEndUser(_0x520857,_0x499c03['destcalleridname'],_0x499c03[_0x43e7('0x5e')]);})['then'](function(_0x49a6ce){_0xfe13fa=_0x49a6ce;logger[_0x43e7('0xb')](_0x43e7('0x5f'),_0xfe13fa['id']);return getTicket(_0x520857,_0x1f561f,_0xfe13fa,_0x39e3ca,_0x499c03);})[_0x43e7('0xe')](function(_0x40155c){if(_0x40155c){logger[_0x43e7('0xb')]('Ticket\x20created!');logger[_0x43e7('0xb')](_0x43e7('0x4f'),_0x40155c['id']);switch(_0x520857['type']){case _0x43e7('0x50'):logger[_0x43e7('0xb')](_0x43e7('0x53'),'Displaying\x20ticket\x20to\x20agent...');emit(util['format']('user:%s',_0x4e6f6d[_0x43e7('0x35')]),_0x43e7('0x60'),{'recordId':_0x40155c['id']});break;case _0x43e7('0x52'):logger[_0x43e7('0xb')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x43e7('0x16')](_0x43e7('0x51'),_0x4e6f6d[_0x43e7('0x35')]),_0x43e7('0x61'),{'uri':util['format'](_0x43e7('0x62'),_0x520857[_0x43e7('0x14')],_0x40155c['id'])});break;default:logger[_0x43e7('0x56')](_0x43e7('0x5c'),_0x43e7('0x57'));}}})[_0x43e7('0x58')](function(_0x4665db){logger[_0x43e7('0x56')](_0x43e7('0x5c'),JSON[_0x43e7('0x63')](_0x4665db));});};exports[_0x43e7('0x64')]=function(_0x57fdfe,_0x5f3824,_0x2b0711,_0x58a3a8,_0x501616,_0x50edb2){var _0xb3e981,_0xe666b0;_0x50edb2['remoteUri']=intUtil[_0x43e7('0x46')](_0x50edb2[_0x43e7('0x14')]);_0x50edb2[_0x43e7('0x47')]=intUtil['stripTrailingSlash'](_0x50edb2[_0x43e7('0x47')]);if(_0x501616&&_0x501616[_0x43e7('0x65')]){logger[_0x43e7('0xb')]('['+_0x5f3824[_0x43e7('0x66')][_0x43e7('0x67')]()+']',_0x43e7('0x5d'));_0x5f3824[_0x43e7('0x48')]=util['format'](_0x43e7('0x49'),_0x50edb2[_0x43e7('0x47')],_0x5f3824[_0x43e7('0x4a')],md5(_0x5f3824['uniqueid']));}else{_0x5f3824['recordingURL']='';}headers[_0x43e7('0x4b')]=getAuth(_0x50edb2);return getUser(_0x50edb2)['then'](function(_0x5cb26e){_0xb3e981=_0x5cb26e;logger[_0x43e7('0xb')](_0x43e7('0x4d'),_0xb3e981['id']);return getEndUser(_0x50edb2,_0x5f3824['calleridname'],_0x5f3824[_0x43e7('0x68')]);})[_0x43e7('0xe')](function(_0x1e2fed){_0xe666b0=_0x1e2fed;logger[_0x43e7('0xb')](_0x43e7('0x5f'),_0xe666b0['id']);return getTicket(_0x50edb2,_0xb3e981,_0xe666b0,_0x2b0711,_0x5f3824);})[_0x43e7('0xe')](function(_0x398a78){if(_0x398a78){logger['info'](_0x43e7('0x4e'));logger[_0x43e7('0xb')]('The\x20Ticket\x20ID\x20is:',_0x398a78['id']);}})[_0x43e7('0x58')](function(_0x5c2c5f){logger[_0x43e7('0x56')]('['+_0x5f3824[_0x43e7('0x66')][_0x43e7('0x67')]()+']',JSON[_0x43e7('0x63')](_0x5c2c5f));});}; \ No newline at end of file +var _0x9957=['Motion','CTI','concat','Tags','/api/v2/users/%d','Descriptions','%s/customers/%d/cases','serverUrl','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','Displaying\x20ticket\x20to\x20agent...','user:%s','trigger:desk:display','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','Desk\x20account\x20type\x20not\x20recognized','error','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','integrationTab','newTab','%s/agent/tickets/%s','catch','unmanaged','monitor_format','lastevent','The\x20Ticket\x20ID\x20is:','toUpperCase','lodash','request-promise','md5','util','./util','../../../../config/environment','../../../../config/logger','desk','defaults','redis','localhost','socket.io-emitter','emit','application/json','validateEmail','info','Getting\x20agent\x20with\x20email','format','remoteUri','then','total_entries','find','_embedded','entries','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','[HTTP]','stringify','GET','password','authType','token','Basic\x20%s','toString','base64','Searching\x20enduser\x20with\x20phone','%s/customers/search','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/customers','POST','work','map','includes','string','picklist','type','nameField','customField','content','idField','custom_fields','variable','variableName','customVariable','name','Variable','toLowerCase','priority','Creating\x20new\x20ticket...','merge','getString','Subjects','phone','new','xCALLY'];(function(_0x3e1eec,_0x384dfb){var _0x379d8a=function(_0x1d0d96){while(--_0x1d0d96){_0x3e1eec['push'](_0x3e1eec['shift']());}};_0x379d8a(++_0x384dfb);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x7995('0x0'));var rp=require(_0x7995('0x1'));var md5=require(_0x7995('0x2'));var util=require(_0x7995('0x3'));var Redis=require('ioredis');var intUtil=require(_0x7995('0x4'));var config=require(_0x7995('0x5'));var logger=require(_0x7995('0x6'))(_0x7995('0x7'));config['redis']=_[_0x7995('0x8')](config[_0x7995('0x9')],{'host':_0x7995('0xa'),'port':0x18eb});var io=require(_0x7995('0xb'))(new Redis(config[_0x7995('0x9')]));function emit(_0x326741,_0x4996ca,_0x465276){io['to'](_0x326741)[_0x7995('0xc')](_0x4996ca,_0x465276);}var headers={'Content-Type':'application/json','Accept':_0x7995('0xd')};function getUser(_0x3116fb,_0x18c8a3){if(intUtil[_0x7995('0xe')](_0x18c8a3)===!![]){logger[_0x7995('0xf')](_0x7995('0x10'),_0x18c8a3);return request({'uri':util[_0x7995('0x11')]('%s/users',_0x3116fb[_0x7995('0x12')])})[_0x7995('0x13')](function(_0x581f22){if(_0x581f22[_0x7995('0x14')]){return _[_0x7995('0x15')](_0x581f22[_0x7995('0x16')][_0x7995('0x17')],{'email':_0x18c8a3});}})[_0x7995('0x13')](function(_0x23999f){if(_0x23999f){logger[_0x7995('0xf')]('Agent\x20found!');return _0x23999f;}else{logger['info'](_0x7995('0x18'));return request({'uri':util[_0x7995('0x11')](_0x7995('0x19'),_0x3116fb[_0x7995('0x12')])});}});}else{logger[_0x7995('0xf')](_0x7995('0x1a'));return request({'uri':util[_0x7995('0x11')](_0x7995('0x19'),_0x3116fb['remoteUri'])});}}function request(_0x2eeacc){logger['debug'](_0x7995('0x1b'),JSON[_0x7995('0x1c')](_0x2eeacc));return rp(_[_0x7995('0x8')](_0x2eeacc,{'method':_0x7995('0x1d'),'headers':headers,'json':!![]}));}function getAuth(_0x1e1415){var _0x37a7d4;if(_0x1e1415['authType']==='basic'){_0x37a7d4=util[_0x7995('0x11')]('%s:%s',_0x1e1415['username'],_0x1e1415[_0x7995('0x1e')]);}else if(_0x1e1415[_0x7995('0x1f')]==='token'){_0x37a7d4=util[_0x7995('0x11')]('%s/token:%s',_0x1e1415['username'],_0x1e1415[_0x7995('0x20')]);}return util[_0x7995('0x11')](_0x7995('0x21'),new Buffer(_0x37a7d4)[_0x7995('0x22')](_0x7995('0x23')));}function getEndUser(_0x1c278a,_0x5d40ae,_0x32a09a){logger[_0x7995('0xf')](_0x7995('0x24'),_0x32a09a);return request({'uri':util[_0x7995('0x11')](_0x7995('0x25'),_0x1c278a[_0x7995('0x12')]),'qs':{'phone':_0x32a09a}})[_0x7995('0x13')](function(_0x472195){if(_0x472195['total_entries']){logger[_0x7995('0xf')](_0x7995('0x26'));return _0x472195[_0x7995('0x16')][_0x7995('0x17')][0x0];}else{logger[_0x7995('0xf')](_0x7995('0x27'));return request({'uri':util['format'](_0x7995('0x28'),_0x1c278a['remoteUri']),'method':_0x7995('0x29'),'body':{'first_name':_0x5d40ae,'title':_0x5d40ae,'phone_numbers':[{'type':_0x7995('0x2a'),'value':_0x32a09a}]}});}});}function getTags(_0xf16cc2,_0x132a42){var _0x11c1eb=[];if(_0xf16cc2&&_0xf16cc2['length']>0x0){_0x11c1eb=_[_0x7995('0x2b')](_0xf16cc2,_0x132a42);}return _0x11c1eb;}function getCustomFields(_0x514445,_0x456a28){var _0x3250e0=[];var _0x4253e5={'custom_fields':{}};if(_0x514445['length']>0x0){_['forEach'](_0x514445,function(_0x48e573){if(_[_0x7995('0x2c')]([_0x7995('0x2d'),_0x7995('0x2e')],_0x48e573[_0x7995('0x2f')])&&_0x48e573[_0x7995('0x30')]&&!_0x48e573[_0x7995('0x31')]){_0x4253e5[_0x48e573['nameField']['toLowerCase']()]=_0x48e573[_0x7995('0x32')]['toString']();}else if(_[_0x7995('0x2c')]([_0x7995('0x2d'),_0x7995('0x2e')],_0x48e573[_0x7995('0x2f')])&&_0x48e573[_0x7995('0x33')]&&_0x48e573['customField']){_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x48e573['content']['toString']();}else if(_0x48e573['type']===_0x7995('0x35')&&_0x48e573[_0x7995('0x36')]&&_0x48e573['idField']&&_0x48e573[_0x7995('0x31')]){_0x456a28[_0x48e573['variableName']]&&(_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x456a28[_0x48e573[_0x7995('0x36')]]['toString']());}else if(_0x48e573['type']===_0x7995('0x37')&&_0x48e573['Variable']&&_0x48e573['Variable'][_0x7995('0x38')]&&_0x48e573[_0x7995('0x33')]&&_0x48e573['customField']){_0x456a28[_0x48e573[_0x7995('0x39')][_0x7995('0x38')][_0x7995('0x3a')]()]&&(_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x456a28[_0x48e573['Variable'][_0x7995('0x38')][_0x7995('0x3a')]()][_0x7995('0x22')]());}});}if(_0x4253e5[_0x7995('0x3b')]){_0x4253e5['priority']=Number(_0x4253e5[_0x7995('0x3b')]);}return _0x4253e5;}function getTicket(_0x235df7,_0x3eb04f,_0xe5ea43,_0x1f5bee,_0x1035dc){logger['info'](_0x7995('0x3c'));var _0x3be298=_[_0x7995('0x3d')]({'subject':intUtil[_0x7995('0x3e')](_0x1f5bee[_0x7995('0x3f')],_0x1035dc,'\x20'),'type':_0x7995('0x40'),'status':_0x7995('0x41'),'labels':[_0x7995('0x42'),_0x7995('0x43'),_0x7995('0x44')][_0x7995('0x45')](getTags(_0x1f5bee[_0x7995('0x46')],_0x7995('0x38'))),'description':intUtil['getString'](_0x1f5bee['Descriptions'],_0x1035dc,'\x0a'),'_links':{'assigned_user':{'href':util[_0x7995('0x11')](_0x7995('0x47'),_0x3eb04f['id']),'class':'user'}},'message':{'direction':'in','body':intUtil['getString'](_0x1f5bee[_0x7995('0x48')],_0x1035dc,'\x0a')}},getCustomFields(_0x1f5bee['Fields'],_0x1035dc));return request({'uri':util['format'](_0x7995('0x49'),_0x235df7[_0x7995('0x12')],_0xe5ea43['id']),'method':_0x7995('0x29'),'body':_0x3be298});}exports['queue']=function(_0x46ac4f,_0x5e85b9,_0x3993b5,_0x5a8881,_0x493066,_0x39c5b8){var _0x403f54,_0xc04e5;_0x39c5b8[_0x7995('0x12')]=intUtil['stripTrailingSlash'](_0x39c5b8[_0x7995('0x12')]);_0x39c5b8[_0x7995('0x4a')]=intUtil[_0x7995('0x4b')](_0x39c5b8[_0x7995('0x4a')]);if(_0x493066&&_0x493066['monitor_format']){logger['info'](_0x7995('0x4c'),'Recording\x20is\x20enabled!');_0x5e85b9[_0x7995('0x4d')]=util['format'](_0x7995('0x4e'),_0x39c5b8['serverUrl'],_0x5e85b9[_0x7995('0x4f')],md5(_0x5e85b9[_0x7995('0x4f')]));}else{_0x5e85b9['recordingURL']='';}headers[_0x7995('0x50')]=getAuth(_0x39c5b8);return getUser(_0x39c5b8,_0x5a8881[_0x7995('0x51')])[_0x7995('0x13')](function(_0xb70a51){_0x403f54=_0xb70a51;logger['info'](_0x7995('0x52'),_0x403f54['id']);return getEndUser(_0x39c5b8,_0x5e85b9[_0x7995('0x53')],_0x5e85b9[_0x7995('0x54')]);})['then'](function(_0xe228a5){_0xc04e5=_0xe228a5;logger[_0x7995('0xf')](_0x7995('0x55'),_0xc04e5['id']);return getTicket(_0x39c5b8,_0x403f54,_0xc04e5,_0x3993b5,_0x5e85b9);})[_0x7995('0x13')](function(_0x255313){if(_0x255313){logger['info'](_0x7995('0x56'));logger[_0x7995('0xf')]('The\x20Ticket\x20ID\x20is:',_0x255313['id']);switch(_0x39c5b8[_0x7995('0x2f')]){case'integrationTab':logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x57'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x5a8881[_0x7995('0x38')]),_0x7995('0x59'),{'recordId':_0x255313['id']});break;case'newTab':logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x5a'));emit(util['format'](_0x7995('0x58'),_0x5a8881[_0x7995('0x38')]),_0x7995('0x5b'),{'uri':util['format']('https://xcally.desk.com/web/agent/case/%d',_0x255313['id'])});break;default:logger['error'](_0x7995('0x4c'),_0x7995('0x5c'));}}})['catch'](function(_0x1cd85){console[_0x7995('0x5d')](_0x1cd85);logger[_0x7995('0x5d')](_0x7995('0x4c'),JSON[_0x7995('0x1c')](_0x1cd85));});};exports['outbound']=function(_0x29ee32,_0x4ab09f,_0x14fe7f,_0x33c801,_0x206d2a,_0x50c7b5,_0x5e1f34){var _0x54e2b1,_0x563f8e;_0x50c7b5[_0x7995('0x12')]=intUtil[_0x7995('0x4b')](_0x50c7b5[_0x7995('0x12')]);_0x50c7b5[_0x7995('0x4a')]=intUtil[_0x7995('0x4b')](_0x50c7b5[_0x7995('0x4a')]);if(_0x5e1f34&&_0x5e1f34[_0x7995('0x5e')]&&_0x5e1f34[_0x7995('0x5e')]!==_0x7995('0x5f')){logger[_0x7995('0xf')](_0x7995('0x60'),_0x7995('0x61'));_0x4ab09f[_0x7995('0x4d')]=util[_0x7995('0x11')](_0x7995('0x4e'),_0x50c7b5[_0x7995('0x4a')],_0x4ab09f[_0x7995('0x4f')],md5(_0x4ab09f[_0x7995('0x4f')]));}headers[_0x7995('0x50')]=getAuth(_0x50c7b5);return getUser(_0x50c7b5,_0x33c801['email'])[_0x7995('0x13')](function(_0x630737){_0x54e2b1=_0x630737;logger[_0x7995('0xf')](_0x7995('0x52'),_0x54e2b1['id']);return getEndUser(_0x50c7b5,_0x4ab09f['destcalleridname'],_0x4ab09f['destcalleridnum']);})[_0x7995('0x13')](function(_0x197b52){_0x563f8e=_0x197b52;logger[_0x7995('0xf')](_0x7995('0x55'),_0x563f8e['id']);return getTicket(_0x50c7b5,_0x54e2b1,_0x563f8e,_0x14fe7f,_0x4ab09f);})['then'](function(_0x13cd7b){if(_0x13cd7b){logger[_0x7995('0xf')](_0x7995('0x56'));logger[_0x7995('0xf')]('The\x20Ticket\x20ID\x20is:',_0x13cd7b['id']);switch(_0x50c7b5['type']){case _0x7995('0x62'):logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x57'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x33c801[_0x7995('0x38')]),_0x7995('0x59'),{'recordId':_0x13cd7b['id']});break;case _0x7995('0x63'):logger['info'](_0x7995('0x4c'),_0x7995('0x5a'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x33c801['name']),'trigger:browser:url',{'uri':util[_0x7995('0x11')](_0x7995('0x64'),_0x50c7b5['remoteUri'],_0x13cd7b['id'])});break;default:logger[_0x7995('0x5d')](_0x7995('0x60'),_0x7995('0x5c'));}}})[_0x7995('0x65')](function(_0x32cb04){logger['error'](_0x7995('0x60'),JSON['stringify'](_0x32cb04));});};exports[_0x7995('0x66')]=function(_0xe31dcb,_0x1722e2,_0x25b534,_0x4388c1,_0xeb8920,_0x2b3c1d){var _0x44372a,_0x10f012;_0x2b3c1d[_0x7995('0x12')]=intUtil[_0x7995('0x4b')](_0x2b3c1d[_0x7995('0x12')]);_0x2b3c1d['serverUrl']=intUtil[_0x7995('0x4b')](_0x2b3c1d[_0x7995('0x4a')]);if(_0xeb8920&&_0xeb8920[_0x7995('0x67')]){logger[_0x7995('0xf')]('['+_0x1722e2[_0x7995('0x68')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x1722e2[_0x7995('0x4d')]=util[_0x7995('0x11')](_0x7995('0x4e'),_0x2b3c1d[_0x7995('0x4a')],_0x1722e2['uniqueid'],md5(_0x1722e2[_0x7995('0x4f')]));}else{_0x1722e2['recordingURL']='';}headers['Authorization']=getAuth(_0x2b3c1d);return getUser(_0x2b3c1d)[_0x7995('0x13')](function(_0x36d27d){_0x44372a=_0x36d27d;logger[_0x7995('0xf')](_0x7995('0x52'),_0x44372a['id']);return getEndUser(_0x2b3c1d,_0x1722e2[_0x7995('0x53')],_0x1722e2[_0x7995('0x54')]);})[_0x7995('0x13')](function(_0x13dc73){_0x10f012=_0x13dc73;logger[_0x7995('0xf')](_0x7995('0x55'),_0x10f012['id']);return getTicket(_0x2b3c1d,_0x44372a,_0x10f012,_0x25b534,_0x1722e2);})['then'](function(_0x2dc1f7){if(_0x2dc1f7){logger[_0x7995('0xf')](_0x7995('0x56'));logger['info'](_0x7995('0x69'),_0x2dc1f7['id']);}})[_0x7995('0x65')](function(_0x705f0){logger[_0x7995('0x5d')]('['+_0x1722e2[_0x7995('0x68')][_0x7995('0x6a')]()+']',JSON[_0x7995('0x1c')](_0x705f0));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/dynamics365.js b/server/services/ami/trigger/integration/dynamics365.js index e757573..8a080cf 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 _0x4d3d=['then','catch','error','toUpperCase',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','value','isNil','validateEmail','email','userEmail','length','internalemailaddress','isdisabled','info',']\x20Agent\x20found\x20','systemuserid','userId','username','toLowerCase','outbound','destcalleridnum','contacts','4.0','headers','substring','lastIndexOf','enduserId','contacts?$select=telephone1&$filter=telephone1\x20eq\x20\x27','replace','%2b','telephone1','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','forEach','includes','string','picklist','nameField','customField','idField','indexOf','content','ticketType','incident','incidents','assign','getString','/contacts(','Fields','phonecall','/systemusers(','callDirection','queue','phonecalls','Subjects','calleridnum','ticketId','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','format','user:%s','emit','trigger:browser:url','stripTrailingSlash','serverUrl','https://login.microsoftonline.com/%s/oauth2/token','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]',']\x20The\x20User\x20email\x20is:','moduleCreate',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','util','./util','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','localhost','socket.io-emitter','redis','modernAuthentication','remoteUri','data7','tenantId','CloudProvider','resolve','data5','POST','password','clientSecret'];(function(_0x21e0a9,_0x5edd42){var _0x2a12f5=function(_0x3c53a4){while(--_0x3c53a4){_0x21e0a9['push'](_0x21e0a9['shift']());}};_0x2a12f5(++_0x5edd42);}(_0x4d3d,0xc4));var _0xd4d3=function(_0x333ffb,_0x1c2367){_0x333ffb=_0x333ffb-0x0;var _0x13add9=_0x4d3d[_0x333ffb];return _0x13add9;};'use strict';var _=require(_0xd4d3('0x0'));var rp=require(_0xd4d3('0x1'));var util=require(_0xd4d3('0x2'));var intUtil=require(_0xd4d3('0x3'));var md5=require(_0xd4d3('0x4'));var Redis=require(_0xd4d3('0x5'));var logger=require(_0xd4d3('0x6'))(_0xd4d3('0x7'));var config=require(_0xd4d3('0x8'));config['redis']=_['defaults'](config['redis'],{'host':_0xd4d3('0x9'),'port':0x18eb});var io=require(_0xd4d3('0xa'))(new Redis(config[_0xd4d3('0xb')]));function getAuthToken(_0x117789,_0x4d500c,_0x31c13a){if(_0x117789[_0xd4d3('0xc')]){_0x117789[_0xd4d3('0xd')]=_0x117789['CloudProvider'][_0xd4d3('0xe')];_0x117789[_0xd4d3('0xf')]=_0x117789[_0xd4d3('0x10')]['data2'];return Promise[_0xd4d3('0x11')](_0x117789['CloudProvider'][_0xd4d3('0x12')]);}var _0x386ee7={'method':_0xd4d3('0x13'),'uri':_0x4d500c,'form':{'client_id':_0x117789['clientId'],'resource':_0x117789[_0xd4d3('0xd')],'username':_0x117789['username'],'password':_0x117789[_0xd4d3('0x14')],'grant_type':_0xd4d3('0x14'),'client_secret':_0x117789[_0xd4d3('0x15')]},'json':!![]};return rp(_0x386ee7)[_0xd4d3('0x16')](function(_0x2c27f5){return _0x2c27f5['access_token'];})[_0xd4d3('0x17')](function(_0x291f0b){logger[_0xd4d3('0x18')]('['+[_0x31c13a[_0xd4d3('0x19')]()]+_0xd4d3('0x1a'));return _0x291f0b[_0xd4d3('0x1b')];});}function getUser(_0x3165dd,_0x4cecc4,_0x3fe28c,_0x12567c,_0x21a8c5,_0xb5c829){return new Promise(function(_0x445ed0,_0x545252){return getAuthToken(_0x4cecc4,_0x12567c,_0xb5c829)[_0xd4d3('0x16')](function(_0x406a71){var _0x1222bc={'method':_0xd4d3('0x1c'),'uri':_0x21a8c5+_0xd4d3('0x1d'),'headers':{'Authorization':_0xd4d3('0x1e')+_0x406a71,'OData-Version':'4.0'},'json':!![]};return rp(_0x1222bc);})['then'](function(_0x111281){var _0x42739d=_0x111281[_0xd4d3('0x1f')];var _0x218af2=![];var _0x78550c=null;if(!_[_0xd4d3('0x20')](_0x3fe28c)){if(intUtil[_0xd4d3('0x21')](_0x3fe28c[_0xd4d3('0x22')])){_0x3165dd[_0xd4d3('0x23')]=_0x3fe28c['email'];for(_0x78550c=0x0;_0x78550c<_0x42739d[_0xd4d3('0x24')];_0x78550c++){if(_0x42739d[_0x78550c][_0xd4d3('0x25')]===_0x3fe28c[_0xd4d3('0x22')]&&!_0x42739d[_0x78550c][_0xd4d3('0x26')]){_0x218af2=!![];logger[_0xd4d3('0x27')]('['+[_0xb5c829['toUpperCase']()]+_0xd4d3('0x28')+_0x42739d[_0x78550c][_0xd4d3('0x29')]+'!');_0x3165dd[_0xd4d3('0x2a')]=_0x42739d[_0x78550c][_0xd4d3('0x29')];}}}}if(!_0x218af2){logger[_0xd4d3('0x27')]('['+[_0xb5c829['toUpperCase']()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0x3165dd[_0xd4d3('0x23')]=_0x4cecc4['username'];for(_0x78550c=0x0;_0x78550c<_0x42739d['length'];_0x78550c++){if(_0x42739d[_0x78550c][_0xd4d3('0x25')]===_0x4cecc4[_0xd4d3('0x2b')]){_0x3165dd[_0xd4d3('0x2a')]=_0x42739d[_0x78550c][_0xd4d3('0x29')];}}}_0x445ed0(_0x3165dd);})[_0xd4d3('0x17')](function(_0x1c4a55){_0x545252(_0x1c4a55['message']);});});}function createEndUser(_0x34827d,_0x17f3e1,_0x1076e7,_0x53839c,_0x3da602,_0x1da667){return new Promise(function(_0x5c72ac,_0xf86e52){return getAuthToken(_0x17f3e1,_0x1076e7,_0x1da667)['then'](function(_0x32559f){var _0x55fe1a=_0x1da667[_0xd4d3('0x2c')]()===_0xd4d3('0x2d')?_0x3da602[_0xd4d3('0x2e')]:_0x3da602['calleridnum'];var _0x65ad57={'method':_0xd4d3('0x13'),'uri':_0x53839c+_0xd4d3('0x2f'),'body':{'telephone1':_0x55fe1a,'fullname':_0x55fe1a,'firstname':_0x55fe1a,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0x34827d[_0xd4d3('0x2a')]+')'},'headers':{'Authorization':_0xd4d3('0x1e')+_0x32559f,'OData-Version':_0xd4d3('0x30')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x65ad57);})['then'](function(_0x283ee5){var _0x14f869=_0x283ee5[_0xd4d3('0x31')]['odata-entityid'];var _0xe11d71=_0x14f869[_0xd4d3('0x32')](_0x14f869[_0xd4d3('0x33')]('(')+0x1,_0x14f869[_0xd4d3('0x33')](')'));_0x34827d[_0xd4d3('0x34')]=_0xe11d71;_0x5c72ac(_0x34827d);})['catch'](function(_0x21edca){_0xf86e52(_0x21edca[_0xd4d3('0x1b')]);});});}function getEndUser(_0x115555,_0xe1e019,_0x311443,_0x1789b9,_0x29042e,_0x122ca3,_0x3698ab){var _0x139c28=_0x122ca3['toLowerCase']()===_0xd4d3('0x2d')?_0x29042e['destcalleridnum']:_0x29042e['calleridnum'];return getAuthToken(_0xe1e019,_0x311443,_0x122ca3)[_0xd4d3('0x16')](function(_0x5766a1){var _0x3c1499={'method':_0xd4d3('0x1c'),'uri':_0x1789b9+_0xd4d3('0x35')+_0x139c28[_0xd4d3('0x36')]('+',_0xd4d3('0x37'))+'\x27','headers':{'Authorization':_0xd4d3('0x1e')+_0x5766a1,'If-None-Match':null,'OData-Version':_0xd4d3('0x30')},'json':!![]};return rp(_0x3c1499);})[_0xd4d3('0x16')](function(_0x57f60b){var _0x5c494f=![];if(!_0x57f60b)return _0x5c494f;var _0x117b1b=_0x57f60b[_0xd4d3('0x1f')];for(var _0x5dbeae=0x0;_0x5dbeae<_0x117b1b[_0xd4d3('0x24')];_0x5dbeae++){if(_0x117b1b[_0x5dbeae][_0xd4d3('0x38')]===_0x139c28){_0x5c494f=!![];_0x115555[_0xd4d3('0x34')]=_0x117b1b[_0x5dbeae]['contactid'];}}return _0x5c494f;})[_0xd4d3('0x16')](function(_0x5dd847){if(_0x5dd847)return _0x115555;if(_0x3698ab===_0xd4d3('0x39')){logger[_0xd4d3('0x27')]('['+[_0x122ca3['toUpperCase']()]+_0xd4d3('0x3a'));return _0x115555;}return createEndUser(_0x115555,_0xe1e019,_0x311443,_0x1789b9,_0x29042e,_0x122ca3)[_0xd4d3('0x16')](function(_0x2e843b){logger[_0xd4d3('0x27')]('['+[_0x122ca3['toUpperCase']()]+_0xd4d3('0x3b'),_0x2e843b['enduserId']);return _0x2e843b;});});}function getCustomFields(_0x30c7b4,_0x4bcc60,_0x25d64e){var _0xdb9df1={};if(_0x30c7b4[_0xd4d3('0x24')]>0x0){_[_0xd4d3('0x3c')](_0x30c7b4,function(_0x22a5ac){if(_[_0xd4d3('0x3d')]([_0xd4d3('0x3e'),_0xd4d3('0x3f')],_0x22a5ac['type'])&&_0x22a5ac[_0xd4d3('0x40')]&&!_0x22a5ac[_0xd4d3('0x41')]){var _0xd5296d=_0x22a5ac[_0xd4d3('0x42')][_0xd4d3('0x2c')]();var _0x1c07e4=_0xd5296d[_0xd4d3('0x32')](0x0,_0xd5296d[_0xd4d3('0x43')]('_'));var _0x293721=_0xd5296d[_0xd4d3('0x32')](_0xd5296d[_0xd4d3('0x43')]('_')+0x1);if(_0x1c07e4===_0x25d64e){_0xdb9df1[_0x293721]=_0x22a5ac[_0xd4d3('0x44')];}}});}return _0xdb9df1;}function getTicket(_0x11a31e,_0x3ae357,_0x358035,_0x169d4e,_0x1dd059,_0x5a5b0c,_0x41558a){return new Promise(function(_0x550dab,_0xadc802){var _0x51e3f4;return getAuthToken(_0x3ae357,_0x358035,_0x41558a)['then'](function(_0x442e9d){if(_0x5a5b0c[_0xd4d3('0x45')]===_0xd4d3('0x46')){_0x51e3f4={'method':'POST','uri':_0x169d4e+_0xd4d3('0x47'),'body':Object[_0xd4d3('0x48')]({},{'title':intUtil[_0xd4d3('0x49')](_0x5a5b0c['Subjects'],_0x1dd059,'\x20'),'description':intUtil['getString'](_0x5a5b0c['Descriptions'],_0x1dd059,'\x0a'),'customerid_contact@odata.bind':_0x11a31e[_0xd4d3('0x34')]?_0xd4d3('0x4a')+_0x11a31e[_0xd4d3('0x34')]+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x11a31e['userId']+')','caseorigincode':'1'},getCustomFields(_0x5a5b0c[_0xd4d3('0x4b')],_0x1dd059,_0x5a5b0c[_0xd4d3('0x45')])),'headers':{'Authorization':_0xd4d3('0x1e')+_0x442e9d,'OData-Version':_0xd4d3('0x30')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x5a5b0c[_0xd4d3('0x45')]===_0xd4d3('0x4c')){var _0x33ad60=_0x11a31e['enduserId']?[{'partyid_systemuser@odata.bind':_0xd4d3('0x4d')+_0x11a31e[_0xd4d3('0x2a')]+')','participationtypemask':_0x11a31e[_0xd4d3('0x4e')]===_0xd4d3('0x4f')?0x2:0x1},{'partyid_contact@odata.bind':'/contacts('+_0x11a31e['enduserId']+')','participationtypemask':_0x11a31e['callDirection']===_0xd4d3('0x4f')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0xd4d3('0x4d')+_0x11a31e[_0xd4d3('0x2a')]+')','participationtypemask':_0x11a31e[_0xd4d3('0x4e')]==='queue'?0x2:0x1}];_0x51e3f4={'method':'POST','uri':_0x169d4e+_0xd4d3('0x50'),'body':Object[_0xd4d3('0x48')]({},{'subject':intUtil['getString'](_0x5a5b0c[_0xd4d3('0x51')],_0x1dd059,'\x20'),'phonenumber':String(_0x1dd059[_0xd4d3('0x52')]),'description':intUtil[_0xd4d3('0x49')](_0x5a5b0c['Descriptions'],_0x1dd059,'\x0a'),'regardingobjectid_contact@odata.bind':_0x11a31e[_0xd4d3('0x34')]?'/contacts('+_0x11a31e[_0xd4d3('0x34')]+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x11a31e['userId']+')','directioncode':_0x11a31e[_0xd4d3('0x4e')]===_0xd4d3('0x4f')?![]:!![],'phonecall_activity_parties':_0x33ad60},getCustomFields(_0x5a5b0c[_0xd4d3('0x4b')],_0x1dd059,_0x5a5b0c[_0xd4d3('0x45')])),'headers':{'Authorization':_0xd4d3('0x1e')+_0x442e9d,'OData-Version':_0xd4d3('0x30')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x51e3f4);})[_0xd4d3('0x16')](function(_0x420f46){var _0x5da04d=_0x420f46['headers']['odata-entityid'];var _0x1e2a7c=_0x5da04d[_0xd4d3('0x32')](_0x5da04d['lastIndexOf']('(')+0x1,_0x5da04d['lastIndexOf'](')'));_0x11a31e[_0xd4d3('0x53')]=_0x1e2a7c;_0x550dab(_0x11a31e);})[_0xd4d3('0x17')](function(_0x28aded){_0xadc802(_0x28aded[_0xd4d3('0x1b')]);});});}function emit(_0x1f9bf9,_0x2787a5,_0x4b85df,_0x47e499){var _0x54a88d={'uri':util['format'](_0xd4d3('0x54'),_0x1f9bf9,_0x4b85df,_0x47e499)};io['to'](util[_0xd4d3('0x55')](_0xd4d3('0x56'),_0x2787a5))[_0xd4d3('0x57')](_0xd4d3('0x58'),_0x54a88d);}exports['cs']=function(_0xff4cb,_0x556967,_0x1f7567,_0x562229,_0x3e0366,_0xea912,_0x18995f,_0x7961b6){var _0x1eb658={};_0xea912['remoteUri']=_0xea912[_0xd4d3('0xc')]?intUtil[_0xd4d3('0x59')](_0xea912[_0xd4d3('0x10')][_0xd4d3('0xe')]):intUtil[_0xd4d3('0x59')](_0xea912[_0xd4d3('0xd')]);_0xea912['serverUrl']=intUtil['stripTrailingSlash'](_0xea912[_0xd4d3('0x5a')]);_0x1eb658['callDirection']=_0x7961b6===_0xd4d3('0x4f')||_0x7961b6==='unmanaged'?_0xd4d3('0x4f'):'outbound';var _0x223c0c=_0xea912['modernAuthentication']?util[_0xd4d3('0x55')]('%s/api/data/v9.0/',_0xea912[_0xd4d3('0x10')][_0xd4d3('0xe')]):util['format']('%s/api/data/v9.0/',_0xea912[_0xd4d3('0xd')]);var _0xdb56dc=util['format'](_0xd4d3('0x5b'),_0xea912['tenantId']);var _0x4d5cde=util[_0xd4d3('0x55')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xea912['serverUrl'],_0x556967[_0xd4d3('0x5c')],md5(_0x556967[_0xd4d3('0x5c')]));if(_0x3e0366&&_0x3e0366[_0xd4d3('0x5d')]){logger['info'](_0xd4d3('0x5e'),_0xd4d3('0x5f'));_0x556967[_0xd4d3('0x60')]=_0x4d5cde;}else if(_0x18995f&&_0x18995f[_0xd4d3('0x61')]&&_0x18995f[_0xd4d3('0x61')]!=='none'){logger[_0xd4d3('0x27')](_0xd4d3('0x62'),'Recording\x20is\x20enabled!');_0x556967[_0xd4d3('0x60')]=_0x4d5cde;}else{_0x556967[_0xd4d3('0x60')]='';}return getUser(_0x1eb658,_0xea912,_0x562229,_0xdb56dc,_0x223c0c,_0x7961b6)[_0xd4d3('0x16')](function(_0x3cfb7b){logger['info']('['+_0x7961b6[_0xd4d3('0x19')]()+']\x20The\x20User\x20ID\x20is:',_0x3cfb7b[_0xd4d3('0x2a')]);logger[_0xd4d3('0x27')]('['+_0x7961b6[_0xd4d3('0x19')]()+_0xd4d3('0x63'),_0x3cfb7b[_0xd4d3('0x23')]);return getEndUser(_0x3cfb7b,_0xea912,_0xdb56dc,_0x223c0c,_0x556967,_0x7961b6,_0x1f7567[_0xd4d3('0x64')]);})['then'](function(_0x5a35b2){logger[_0xd4d3('0x27')]('['+_0x7961b6[_0xd4d3('0x19')]()+_0xd4d3('0x65'),_0x5a35b2[_0xd4d3('0x34')]);logger[_0xd4d3('0x27')]('['+_0x7961b6[_0xd4d3('0x19')]()+_0xd4d3('0x66'),_0x556967['calleridnum']);return getTicket(_0x5a35b2,_0xea912,_0xdb56dc,_0x223c0c,_0x556967,_0x1f7567,_0x7961b6);})['then'](function(_0x5bfb16){logger[_0xd4d3('0x27')](util[_0xd4d3('0x55')]('['+_0x7961b6[_0xd4d3('0x19')]()+_0xd4d3('0x67'),_0x1f7567[_0xd4d3('0x45')],_0x5bfb16[_0xd4d3('0x53')]));logger[_0xd4d3('0x27')](util['format']('['+_0x7961b6['toUpperCase']()+_0xd4d3('0x68'),_0x7961b6));if(_0x7961b6!==_0xd4d3('0x69')){logger[_0xd4d3('0x27')]('['+_0x7961b6[_0xd4d3('0x19')]()+']',_0xd4d3('0x6a'));emit(_0xea912['remoteUri'],_0x562229[_0xd4d3('0x6b')],_0x1f7567[_0xd4d3('0x45')],_0x5bfb16[_0xd4d3('0x53')]);}})['catch'](function(_0xeaea0b){logger[_0xd4d3('0x18')]('['+_0x7961b6[_0xd4d3('0x19')]()+_0xd4d3('0x6c'),_0xeaea0b[_0xd4d3('0x1b')]);});}; \ No newline at end of file +var _0x0ddb=['indexOf','ticketType','incident','incidents','assign','getString','Subjects','Descriptions','/contacts(','Fields','phonecall','callDirection','queue','phonecalls','ticketId','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','format','emit','modernAuthentication','stripTrailingSlash','serverUrl','unmanaged','outbound','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20email\x20is:','moduleCreate',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','lodash','util','./util','md5','ioredis','dynamics365','../../../../config/environment','localhost','socket.io-emitter','remoteUri','CloudProvider','data7','tenantId','data5','POST','clientId','username','password','clientSecret','then','access_token','error','toUpperCase',']\x20Wrong\x20credentials!','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','value','validateEmail','email','userEmail','length','internalemailaddress','info',']\x20Agent\x20found\x20','systemuserid','userId','catch','message','toLowerCase','destcalleridnum','/systemusers(','Bearer\x20','4.0','headers','odata-entityid','lastIndexOf','enduserId','calleridnum','contacts?$select=telephone1&$filter=telephone1\x20eq\x20\x27','replace','telephone1','contactid','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','forEach','string','type','customField','idField','substring'];(function(_0x2962d5,_0x38deda){var _0x273406=function(_0x3e0775){while(--_0x3e0775){_0x2962d5['push'](_0x2962d5['shift']());}};_0x273406(++_0x38deda);}(_0x0ddb,0x157));var _0xb0dd=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0ddb[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xb0dd('0x0'));var rp=require('request-promise');var util=require(_0xb0dd('0x1'));var intUtil=require(_0xb0dd('0x2'));var md5=require(_0xb0dd('0x3'));var Redis=require(_0xb0dd('0x4'));var logger=require('../../../../config/logger')(_0xb0dd('0x5'));var config=require(_0xb0dd('0x6'));config['redis']=_['defaults'](config['redis'],{'host':_0xb0dd('0x7'),'port':0x18eb});var io=require(_0xb0dd('0x8'))(new Redis(config['redis']));function getAuthToken(_0x1da70b,_0x439ae9,_0xe43079){if(_0x1da70b['modernAuthentication']){_0x1da70b[_0xb0dd('0x9')]=_0x1da70b[_0xb0dd('0xa')][_0xb0dd('0xb')];_0x1da70b[_0xb0dd('0xc')]=_0x1da70b[_0xb0dd('0xa')]['data2'];return Promise['resolve'](_0x1da70b['CloudProvider'][_0xb0dd('0xd')]);}var _0x1b6f05={'method':_0xb0dd('0xe'),'uri':_0x439ae9,'form':{'client_id':_0x1da70b[_0xb0dd('0xf')],'resource':_0x1da70b[_0xb0dd('0x9')],'username':_0x1da70b[_0xb0dd('0x10')],'password':_0x1da70b[_0xb0dd('0x11')],'grant_type':_0xb0dd('0x11'),'client_secret':_0x1da70b[_0xb0dd('0x12')]},'json':!![]};return rp(_0x1b6f05)[_0xb0dd('0x13')](function(_0x14f27b){return _0x14f27b[_0xb0dd('0x14')];})['catch'](function(_0x15e569){logger[_0xb0dd('0x15')]('['+[_0xe43079[_0xb0dd('0x16')]()]+_0xb0dd('0x17'));return _0x15e569['message'];});}function getUser(_0x3683ae,_0x4f84ad,_0x94be10,_0x5892db,_0x27ba39,_0x40cb8a){return new Promise(function(_0x8f6103,_0x58b387){return getAuthToken(_0x4f84ad,_0x5892db,_0x40cb8a)[_0xb0dd('0x13')](function(_0x916a59){var _0x5caaa5={'method':_0xb0dd('0x18'),'uri':_0x27ba39+_0xb0dd('0x19'),'headers':{'Authorization':'Bearer\x20'+_0x916a59,'OData-Version':'4.0'},'json':!![]};return rp(_0x5caaa5);})[_0xb0dd('0x13')](function(_0x3a0f13){var _0x3b1b0f=_0x3a0f13[_0xb0dd('0x1a')];var _0x55e043=![];var _0x3d7192=null;if(!_['isNil'](_0x94be10)){if(intUtil[_0xb0dd('0x1b')](_0x94be10[_0xb0dd('0x1c')])){_0x3683ae[_0xb0dd('0x1d')]=_0x94be10[_0xb0dd('0x1c')];for(_0x3d7192=0x0;_0x3d7192<_0x3b1b0f[_0xb0dd('0x1e')];_0x3d7192++){if(_0x3b1b0f[_0x3d7192][_0xb0dd('0x1f')]===_0x94be10[_0xb0dd('0x1c')]&&!_0x3b1b0f[_0x3d7192]['isdisabled']){_0x55e043=!![];logger[_0xb0dd('0x20')]('['+[_0x40cb8a['toUpperCase']()]+_0xb0dd('0x21')+_0x3b1b0f[_0x3d7192][_0xb0dd('0x22')]+'!');_0x3683ae[_0xb0dd('0x23')]=_0x3b1b0f[_0x3d7192]['systemuserid'];}}}}if(!_0x55e043){logger['info']('['+[_0x40cb8a['toUpperCase']()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0x3683ae['userEmail']=_0x4f84ad['username'];for(_0x3d7192=0x0;_0x3d7192<_0x3b1b0f[_0xb0dd('0x1e')];_0x3d7192++){if(_0x3b1b0f[_0x3d7192][_0xb0dd('0x1f')]===_0x4f84ad[_0xb0dd('0x10')]){_0x3683ae['userId']=_0x3b1b0f[_0x3d7192][_0xb0dd('0x22')];}}}_0x8f6103(_0x3683ae);})[_0xb0dd('0x24')](function(_0x2ea89c){_0x58b387(_0x2ea89c[_0xb0dd('0x25')]);});});}function createEndUser(_0x11adbe,_0x5420dd,_0x3c645c,_0x5f42f7,_0x324f6d,_0x46b65a){return new Promise(function(_0x139337,_0x48dfa5){return getAuthToken(_0x5420dd,_0x3c645c,_0x46b65a)[_0xb0dd('0x13')](function(_0x552aba){var _0x134ef6=_0x46b65a[_0xb0dd('0x26')]()==='outbound'?_0x324f6d[_0xb0dd('0x27')]:_0x324f6d['calleridnum'];var _0x6d508a={'method':'POST','uri':_0x5f42f7+'contacts','body':{'telephone1':_0x134ef6,'fullname':_0x134ef6,'firstname':_0x134ef6,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0xb0dd('0x28')+_0x11adbe[_0xb0dd('0x23')]+')'},'headers':{'Authorization':_0xb0dd('0x29')+_0x552aba,'OData-Version':_0xb0dd('0x2a')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x6d508a);})[_0xb0dd('0x13')](function(_0x5ee011){var _0x3e422c=_0x5ee011[_0xb0dd('0x2b')][_0xb0dd('0x2c')];var _0x28cada=_0x3e422c['substring'](_0x3e422c[_0xb0dd('0x2d')]('(')+0x1,_0x3e422c[_0xb0dd('0x2d')](')'));_0x11adbe[_0xb0dd('0x2e')]=_0x28cada;_0x139337(_0x11adbe);})['catch'](function(_0x4b0e9d){_0x48dfa5(_0x4b0e9d['message']);});});}function getEndUser(_0x3db9b7,_0x360f75,_0x51adce,_0x76f9a1,_0x120b9d,_0x345c1,_0x502021){var _0x4b7715=_0x345c1[_0xb0dd('0x26')]()==='outbound'?_0x120b9d[_0xb0dd('0x27')]:_0x120b9d[_0xb0dd('0x2f')];return getAuthToken(_0x360f75,_0x51adce,_0x345c1)[_0xb0dd('0x13')](function(_0xb1f02b){var _0x4d98cd={'method':_0xb0dd('0x18'),'uri':_0x76f9a1+_0xb0dd('0x30')+_0x4b7715[_0xb0dd('0x31')]('+','%2b')+'\x27','headers':{'Authorization':_0xb0dd('0x29')+_0xb1f02b,'If-None-Match':null,'OData-Version':_0xb0dd('0x2a')},'json':!![]};return rp(_0x4d98cd);})[_0xb0dd('0x13')](function(_0x1ac0e0){var _0x284ec4=![];if(!_0x1ac0e0)return _0x284ec4;var _0x584c1a=_0x1ac0e0[_0xb0dd('0x1a')];for(var _0x300d4e=0x0;_0x300d4e<_0x584c1a[_0xb0dd('0x1e')];_0x300d4e++){if(_0x584c1a[_0x300d4e][_0xb0dd('0x32')]===_0x4b7715){_0x284ec4=!![];_0x3db9b7['enduserId']=_0x584c1a[_0x300d4e][_0xb0dd('0x33')];}}return _0x284ec4;})[_0xb0dd('0x13')](function(_0x43785d){if(_0x43785d)return _0x3db9b7;if(_0x502021===_0xb0dd('0x34')){logger[_0xb0dd('0x20')]('['+[_0x345c1['toUpperCase']()]+_0xb0dd('0x35'));return _0x3db9b7;}return createEndUser(_0x3db9b7,_0x360f75,_0x51adce,_0x76f9a1,_0x120b9d,_0x345c1)[_0xb0dd('0x13')](function(_0x5eedad){logger['info']('['+[_0x345c1[_0xb0dd('0x16')]()]+_0xb0dd('0x36'),_0x5eedad[_0xb0dd('0x2e')]);return _0x5eedad;});});}function getCustomFields(_0x30c626,_0x1e967f,_0x2d478e){var _0x4a0e96={};if(_0x30c626[_0xb0dd('0x1e')]>0x0){_[_0xb0dd('0x37')](_0x30c626,function(_0x4bd209){if(_['includes']([_0xb0dd('0x38'),'picklist'],_0x4bd209[_0xb0dd('0x39')])&&_0x4bd209['nameField']&&!_0x4bd209[_0xb0dd('0x3a')]){var _0x242832=_0x4bd209[_0xb0dd('0x3b')]['toLowerCase']();var _0x77d1d5=_0x242832[_0xb0dd('0x3c')](0x0,_0x242832[_0xb0dd('0x3d')]('_'));var _0x106039=_0x242832['substring'](_0x242832['indexOf']('_')+0x1);if(_0x77d1d5===_0x2d478e){_0x4a0e96[_0x106039]=_0x4bd209['content'];}}});}return _0x4a0e96;}function getTicket(_0x2f8efe,_0x575e3c,_0x599c9c,_0x170d6b,_0x14fdda,_0x48646a,_0xe4e231){return new Promise(function(_0x5cd3f5,_0x34d8a6){var _0x427a9b;return getAuthToken(_0x575e3c,_0x599c9c,_0xe4e231)[_0xb0dd('0x13')](function(_0x4dbb35){if(_0x48646a[_0xb0dd('0x3e')]===_0xb0dd('0x3f')){_0x427a9b={'method':_0xb0dd('0xe'),'uri':_0x170d6b+_0xb0dd('0x40'),'body':Object[_0xb0dd('0x41')]({},{'title':intUtil[_0xb0dd('0x42')](_0x48646a[_0xb0dd('0x43')],_0x14fdda,'\x20'),'description':intUtil[_0xb0dd('0x42')](_0x48646a[_0xb0dd('0x44')],_0x14fdda,'\x0a'),'customerid_contact@odata.bind':_0x2f8efe['enduserId']?_0xb0dd('0x45')+_0x2f8efe[_0xb0dd('0x2e')]+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x2f8efe[_0xb0dd('0x23')]+')','caseorigincode':'1'},getCustomFields(_0x48646a[_0xb0dd('0x46')],_0x14fdda,_0x48646a[_0xb0dd('0x3e')])),'headers':{'Authorization':_0xb0dd('0x29')+_0x4dbb35,'OData-Version':_0xb0dd('0x2a')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x48646a[_0xb0dd('0x3e')]===_0xb0dd('0x47')){var _0x32c06a=_0x2f8efe[_0xb0dd('0x2e')]?[{'partyid_systemuser@odata.bind':'/systemusers('+_0x2f8efe[_0xb0dd('0x23')]+')','participationtypemask':_0x2f8efe[_0xb0dd('0x48')]===_0xb0dd('0x49')?0x2:0x1},{'partyid_contact@odata.bind':_0xb0dd('0x45')+_0x2f8efe[_0xb0dd('0x2e')]+')','participationtypemask':_0x2f8efe[_0xb0dd('0x48')]==='queue'?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0xb0dd('0x28')+_0x2f8efe['userId']+')','participationtypemask':_0x2f8efe[_0xb0dd('0x48')]==='queue'?0x2:0x1}];_0x427a9b={'method':'POST','uri':_0x170d6b+_0xb0dd('0x4a'),'body':Object[_0xb0dd('0x41')]({},{'subject':intUtil[_0xb0dd('0x42')](_0x48646a[_0xb0dd('0x43')],_0x14fdda,'\x20'),'phonenumber':String(_0x14fdda[_0xb0dd('0x2f')]),'description':intUtil['getString'](_0x48646a['Descriptions'],_0x14fdda,'\x0a'),'regardingobjectid_contact@odata.bind':_0x2f8efe[_0xb0dd('0x2e')]?_0xb0dd('0x45')+_0x2f8efe[_0xb0dd('0x2e')]+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x2f8efe['userId']+')','directioncode':_0x2f8efe[_0xb0dd('0x48')]===_0xb0dd('0x49')?![]:!![],'phonecall_activity_parties':_0x32c06a},getCustomFields(_0x48646a[_0xb0dd('0x46')],_0x14fdda,_0x48646a[_0xb0dd('0x3e')])),'headers':{'Authorization':_0xb0dd('0x29')+_0x4dbb35,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x427a9b);})[_0xb0dd('0x13')](function(_0xf67e94){var _0x2859ce=_0xf67e94[_0xb0dd('0x2b')]['odata-entityid'];var _0x1a5a16=_0x2859ce[_0xb0dd('0x3c')](_0x2859ce[_0xb0dd('0x2d')]('(')+0x1,_0x2859ce['lastIndexOf'](')'));_0x2f8efe[_0xb0dd('0x4b')]=_0x1a5a16;_0x5cd3f5(_0x2f8efe);})[_0xb0dd('0x24')](function(_0x5cafa7){_0x34d8a6(_0x5cafa7[_0xb0dd('0x25')]);});});}function emit(_0x30271d,_0x15abd5,_0x12cd16,_0x180877){var _0x40dec7={'uri':util['format'](_0xb0dd('0x4c'),_0x30271d,_0x12cd16,_0x180877)};io['to'](util[_0xb0dd('0x4d')]('user:%s',_0x15abd5))[_0xb0dd('0x4e')]('trigger:browser:url',_0x40dec7);}exports['cs']=function(_0x14fe1b,_0x1ef9e4,_0x208317,_0x5030d2,_0x3cb3d8,_0x4c3abd,_0x3f348e,_0x182fed){var _0x4ece39={};_0x4c3abd[_0xb0dd('0x9')]=_0x4c3abd[_0xb0dd('0x4f')]?intUtil['stripTrailingSlash'](_0x4c3abd[_0xb0dd('0xa')][_0xb0dd('0xb')]):intUtil[_0xb0dd('0x50')](_0x4c3abd['remoteUri']);_0x4c3abd[_0xb0dd('0x51')]=intUtil[_0xb0dd('0x50')](_0x4c3abd[_0xb0dd('0x51')]);_0x4ece39[_0xb0dd('0x48')]=_0x182fed===_0xb0dd('0x49')||_0x182fed===_0xb0dd('0x52')?_0xb0dd('0x49'):_0xb0dd('0x53');var _0x45a626=_0x4c3abd[_0xb0dd('0x4f')]?util[_0xb0dd('0x4d')](_0xb0dd('0x54'),_0x4c3abd['CloudProvider'][_0xb0dd('0xb')]):util[_0xb0dd('0x4d')](_0xb0dd('0x54'),_0x4c3abd[_0xb0dd('0x9')]);var _0x3d1188=util['format'](_0xb0dd('0x55'),_0x4c3abd['tenantId']);var _0x2a98a7=util[_0xb0dd('0x4d')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4c3abd[_0xb0dd('0x51')],_0x1ef9e4[_0xb0dd('0x56')],md5(_0x1ef9e4[_0xb0dd('0x56')]));if(_0x3cb3d8&&_0x3cb3d8[_0xb0dd('0x57')]){logger['info'](_0xb0dd('0x58'),_0xb0dd('0x59'));_0x1ef9e4[_0xb0dd('0x5a')]=_0x2a98a7;}else if(_0x3f348e&&_0x3f348e[_0xb0dd('0x5b')]&&_0x3f348e['recordingFormat']!==_0xb0dd('0x5c')){logger['info'](_0xb0dd('0x5d'),_0xb0dd('0x59'));_0x1ef9e4[_0xb0dd('0x5a')]=_0x2a98a7;}else{_0x1ef9e4[_0xb0dd('0x5a')]='';}return getUser(_0x4ece39,_0x4c3abd,_0x5030d2,_0x3d1188,_0x45a626,_0x182fed)['then'](function(_0x4bc66a){logger[_0xb0dd('0x20')]('['+_0x182fed[_0xb0dd('0x16')]()+']\x20The\x20User\x20ID\x20is:',_0x4bc66a[_0xb0dd('0x23')]);logger[_0xb0dd('0x20')]('['+_0x182fed[_0xb0dd('0x16')]()+_0xb0dd('0x5e'),_0x4bc66a[_0xb0dd('0x1d')]);return getEndUser(_0x4bc66a,_0x4c3abd,_0x3d1188,_0x45a626,_0x1ef9e4,_0x182fed,_0x208317[_0xb0dd('0x5f')]);})['then'](function(_0x387973){logger['info']('['+_0x182fed[_0xb0dd('0x16')]()+']\x20The\x20Enduser\x20ID\x20is:',_0x387973['enduserId']);logger[_0xb0dd('0x20')]('['+_0x182fed[_0xb0dd('0x16')]()+_0xb0dd('0x60'),_0x1ef9e4[_0xb0dd('0x2f')]);return getTicket(_0x387973,_0x4c3abd,_0x3d1188,_0x45a626,_0x1ef9e4,_0x208317,_0x182fed);})[_0xb0dd('0x13')](function(_0x520568){logger['info'](util[_0xb0dd('0x4d')]('['+_0x182fed['toUpperCase']()+_0xb0dd('0x61'),_0x208317[_0xb0dd('0x3e')],_0x520568[_0xb0dd('0x4b')]));logger[_0xb0dd('0x20')](util['format']('['+_0x182fed['toUpperCase']()+']\x20Call\x20direction:\x20%s',_0x182fed));if(_0x182fed!=='unmanaged'){logger['info']('['+_0x182fed[_0xb0dd('0x16')]()+']',_0xb0dd('0x62'));emit(_0x4c3abd[_0xb0dd('0x9')],_0x5030d2[_0xb0dd('0x63')],_0x208317[_0xb0dd('0x3e')],_0x520568[_0xb0dd('0x4b')]);}})[_0xb0dd('0x24')](function(_0x29e8da){logger[_0xb0dd('0x15')]('['+_0x182fed[_0xb0dd('0x16')]()+_0xb0dd('0x64'),_0x29e8da[_0xb0dd('0x25')]);});}; \ 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 2ede8e1..31dbb78 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 _0xedda=['toLowerCase','queue','serverUrl','stripTrailingSlash','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','stringify','unmanaged','monitor_format','lastevent','The\x20Enduser\x20ID\x20is:','toUpperCase','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis','socket.io-emitter','application/json','info','merge','format','Caller\x20-\x20%s','calleridname','calleridnum','getString','
','Tags','name','Fields','custom_fields','mapValues','keyBy','value','%s/api/v2/tickets','remoteUri','POST','%s/api/v2/agents','length','Agent\x20found!','find','contact','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','then','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','Enduser\x20found!','%s/api/v2/contacts','Enduser\x20created.','Basic\x20%s','apiKey','toString','base64','debug','[HTTP]','defaults','map','forEach','includes','string','type','nameField','customField','picklist','idField','push','content','variableName','customVariable','Variable'];(function(_0x242166,_0x5e5cff){var _0x4788c4=function(_0x95e7b1){while(--_0x95e7b1){_0x242166['push'](_0x242166['shift']());}};_0x4788c4(++_0x5e5cff);}(_0xedda,0x7d));var _0xaedd=function(_0x149c89,_0x5a4857){_0x149c89=_0x149c89-0x0;var _0x3bea59=_0xedda[_0x149c89];return _0x3bea59;};'use strict';var _=require(_0xaedd('0x0'));var rp=require(_0xaedd('0x1'));var md5=require(_0xaedd('0x2'));var util=require(_0xaedd('0x3'));var Redis=require(_0xaedd('0x4'));var intUtil=require(_0xaedd('0x5'));var config=require(_0xaedd('0x6'));var logger=require(_0xaedd('0x7'))(_0xaedd('0x8'));config[_0xaedd('0x9')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xaedd('0xa'))(new Redis(config[_0xaedd('0x9')]));var headers={'Content-Type':_0xaedd('0xb'),'Accept':'application/json'};function emit(_0x18d269,_0x64c796,_0x35fd45){io['to'](_0x18d269)['emit'](_0x64c796,_0x35fd45);}function getTicket(_0x349161,_0x87f34e,_0x3d3392,_0x73a3f3,_0x4355c9){logger[_0xaedd('0xc')]('Creating\x20new\x20ticket...');var _0x307459=_[_0xaedd('0xd')]({'responder_id':_0x87f34e['id'],'requester_id':_0x3d3392['id'],'name':util[_0xaedd('0xe')](_0xaedd('0xf'),_0x4355c9[_0xaedd('0x10')]),'phone':_0x4355c9[_0xaedd('0x11')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xaedd('0x12')](_0x73a3f3['Subjects'],_0x4355c9,'\x20'),'description':intUtil[_0xaedd('0x12')](_0x73a3f3['Descriptions'],_0x4355c9,_0xaedd('0x13')),'tags':getTags(_0x73a3f3[_0xaedd('0x14')],_0xaedd('0x15'))},getCustomFields(_0x73a3f3[_0xaedd('0x16')],_0x4355c9));_0x307459[_0xaedd('0x17')]=_[_0xaedd('0x18')](_[_0xaedd('0x19')](_0x307459[_0xaedd('0x17')],'id'),_0xaedd('0x1a'));return request({'uri':util[_0xaedd('0xe')](_0xaedd('0x1b'),_0x349161[_0xaedd('0x1c')]),'method':_0xaedd('0x1d'),'body':_0x307459})['then'](function(_0x2b4c3f){logger[_0xaedd('0xc')]('Ticket\x20created!');return _0x2b4c3f;});}function getUser(_0x249a55,_0x3b089a){if(intUtil['validateEmail'](_0x3b089a)){return request({'uri':util[_0xaedd('0xe')](_0xaedd('0x1e'),_0x249a55[_0xaedd('0x1c')]),'qs':{'email':_0x3b089a}})['then'](function(_0x5bd075){if(_0x5bd075[_0xaedd('0x1f')]){logger[_0xaedd('0xc')](_0xaedd('0x20'));return _[_0xaedd('0x21')](_0x5bd075,function(_0x5015bd){return _0x5015bd[_0xaedd('0x22')]['email']===_0x3b089a;});}else{logger[_0xaedd('0xc')](_0xaedd('0x23'));return request({'uri':util['format']('%s/api/v2/agents/me',_0x249a55[_0xaedd('0x1c')])})[_0xaedd('0x24')](function(_0x5a4562){logger['info'](_0xaedd('0x25'));return _0x5a4562;});}});}else{logger[_0xaedd('0xc')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xaedd('0xe')]('%s/api/v2/agents/me',_0x249a55[_0xaedd('0x1c')])})[_0xaedd('0x24')](function(_0x320a63){logger['info'](_0xaedd('0x25'));return _0x320a63;});}}function getEndUser(_0x543cc6,_0x51204f,_0x3d9fe6){logger['info'](_0xaedd('0x26'),_0x3d9fe6);return request({'uri':util[_0xaedd('0xe')]('%s/api/v2/contacts',_0x543cc6[_0xaedd('0x1c')]),'qs':{'phone':_0x3d9fe6}})[_0xaedd('0x24')](function(_0x526403){if(_0x526403[_0xaedd('0x1f')]){logger['info'](_0xaedd('0x27'));return _[_0xaedd('0x21')](_0x526403,{'phone':_0x3d9fe6});}else{logger[_0xaedd('0xc')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util['format'](_0xaedd('0x28'),_0x543cc6[_0xaedd('0x1c')]),'method':_0xaedd('0x1d'),'body':{'name':_0x51204f,'phone':_0x3d9fe6}})[_0xaedd('0x24')](function(_0x3d814d){logger[_0xaedd('0xc')](_0xaedd('0x29'));return _0x3d814d;});}});}function getAuth(_0x5699da){return util[_0xaedd('0xe')](_0xaedd('0x2a'),new Buffer(_0x5699da[_0xaedd('0x2b')]+':X')[_0xaedd('0x2c')](_0xaedd('0x2d')));}function request(_0x35b70){logger[_0xaedd('0x2e')](_0xaedd('0x2f'),JSON['stringify'](_0x35b70));return rp(_[_0xaedd('0x30')](_0x35b70,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x51c8ed,_0x1f94af){var _0x3b345c=[];if(_0x51c8ed&&_0x51c8ed[_0xaedd('0x1f')]>0x0){_0x3b345c=_[_0xaedd('0x31')](_0x51c8ed,_0x1f94af);}return _0x3b345c;}function getCustomFields(_0x3839b3,_0x2a3a92){var _0x4773b1=[];var _0x92df7b={'custom_fields':[]};if(_0x3839b3[_0xaedd('0x1f')]>0x0){_[_0xaedd('0x32')](_0x3839b3,function(_0x298d55){if(_[_0xaedd('0x33')]([_0xaedd('0x34'),'picklist'],_0x298d55[_0xaedd('0x35')])&&_0x298d55[_0xaedd('0x36')]&&!_0x298d55[_0xaedd('0x37')]){_0x92df7b[_0x298d55[_0xaedd('0x36')]['toLowerCase']()]=_0x298d55['content'][_0xaedd('0x2c')]();}else if(_['includes'](['string',_0xaedd('0x38')],_0x298d55['type'])&&_0x298d55[_0xaedd('0x39')]&&_0x298d55['customField']){_0x92df7b[_0xaedd('0x17')][_0xaedd('0x3a')]({'id':_0x298d55[_0xaedd('0x39')],'value':_0x298d55[_0xaedd('0x3b')]['toString']()});}else if(_0x298d55['type']==='variable'&&_0x298d55[_0xaedd('0x3c')]&&_0x298d55[_0xaedd('0x39')]&&_0x298d55[_0xaedd('0x37')]){_0x2a3a92[_0x298d55[_0xaedd('0x3c')]]&&_0x92df7b[_0xaedd('0x17')]['push']({'id':_0x298d55['idField'],'value':_0x2a3a92[_0x298d55['variableName']]['toString']()});}else if(_0x298d55[_0xaedd('0x35')]===_0xaedd('0x3d')&&_0x298d55['Variable']&&_0x298d55[_0xaedd('0x3e')][_0xaedd('0x15')]&&_0x298d55['idField']&&_0x298d55['customField']){_0x2a3a92[_0x298d55[_0xaedd('0x3e')]['name'][_0xaedd('0x3f')]()]&&_0x92df7b['custom_fields'][_0xaedd('0x3a')]({'id':_0x298d55[_0xaedd('0x39')],'value':_0x2a3a92[_0x298d55[_0xaedd('0x3e')]['name']['toLowerCase']()][_0xaedd('0x2c')]()});}});}return _0x92df7b;}exports[_0xaedd('0x40')]=function(_0x4dbbe0,_0x4b4180,_0x192250,_0x479ee2,_0x5f50bc,_0x1aecd6){var _0x353606,_0x1d3186;_0x1aecd6[_0xaedd('0x1c')]=intUtil['stripTrailingSlash'](_0x1aecd6[_0xaedd('0x1c')]);_0x1aecd6[_0xaedd('0x41')]=intUtil[_0xaedd('0x42')](_0x1aecd6[_0xaedd('0x41')]);if(_0x5f50bc&&_0x5f50bc['monitor_format']){logger['info'](_0xaedd('0x43'),_0xaedd('0x44'));_0x4b4180[_0xaedd('0x45')]=util[_0xaedd('0xe')](_0xaedd('0x46'),_0x1aecd6['serverUrl'],_0x4b4180[_0xaedd('0x47')],md5(_0x4b4180[_0xaedd('0x47')]));}else{_0x4b4180[_0xaedd('0x45')]='';}headers[_0xaedd('0x48')]=getAuth(_0x1aecd6);return getUser(_0x1aecd6,_0x479ee2[_0xaedd('0x49')])[_0xaedd('0x24')](function(_0x527745){_0x353606=_0x527745;logger[_0xaedd('0xc')](_0xaedd('0x4a'),_0x353606['id']);return getEndUser(_0x1aecd6,_0x4b4180[_0xaedd('0x10')],_0x4b4180[_0xaedd('0x11')]);})[_0xaedd('0x24')](function(_0x4e9c85){_0x1d3186=_0x4e9c85;logger[_0xaedd('0xc')]('The\x20Enduser\x20ID\x20is:',_0x1d3186['id']);return getTicket(_0x1aecd6,_0x353606,_0x1d3186,_0x192250,_0x4b4180);})[_0xaedd('0x24')](function(_0x52bf23){if(_0x52bf23&&_0x52bf23['id']){logger[_0xaedd('0xc')]('Ticket\x20created!');logger[_0xaedd('0xc')]('The\x20Ticket\x20ID\x20is:',_0x52bf23['id']);logger[_0xaedd('0xc')](_0xaedd('0x43'),_0xaedd('0x4b'));emit(util[_0xaedd('0xe')](_0xaedd('0x4c'),_0x479ee2[_0xaedd('0x15')]),_0xaedd('0x4d'),{'uri':util[_0xaedd('0xe')](_0xaedd('0x4e'),_0x1aecd6[_0xaedd('0x1c')],_0x52bf23['id'])});}})[_0xaedd('0x4f')](function(_0x971718){logger[_0xaedd('0x50')](_0xaedd('0x43'),JSON['stringify'](_0x971718));});};exports['outbound']=function(_0x3951c6,_0x4c596b,_0x4b2423,_0x534410,_0x538182,_0x189880,_0x597847){var _0xedae5e,_0x4404a0;_0x189880['remoteUri']=intUtil[_0xaedd('0x42')](_0x189880['remoteUri']);_0x189880[_0xaedd('0x41')]=intUtil[_0xaedd('0x42')](_0x189880[_0xaedd('0x41')]);if(_0x597847&&_0x597847[_0xaedd('0x51')]&&_0x597847[_0xaedd('0x51')]!==_0xaedd('0x52')){logger[_0xaedd('0xc')](_0xaedd('0x53'),_0xaedd('0x44'));_0x4c596b[_0xaedd('0x45')]=util[_0xaedd('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x189880['serverUrl'],_0x4c596b['uniqueid'],md5(_0x4c596b['uniqueid']));}headers[_0xaedd('0x48')]=getAuth(_0x189880);return getUser(_0x189880,_0x534410[_0xaedd('0x49')])['then'](function(_0x1afc6b){_0xedae5e=_0x1afc6b;logger[_0xaedd('0xc')](_0xaedd('0x4a'),_0xedae5e['id']);return getEndUser(_0x189880,_0x4c596b[_0xaedd('0x54')],_0x4c596b[_0xaedd('0x55')]);})[_0xaedd('0x24')](function(_0x3cc06d){_0x4404a0=_0x3cc06d;logger[_0xaedd('0xc')]('The\x20Enduser\x20ID\x20is:',_0x4404a0['id']);return getTicket(_0x189880,_0xedae5e,_0x4404a0,_0x4b2423,_0x4c596b);})[_0xaedd('0x24')](function(_0x237051){if(_0x237051&&_0x237051['id']){logger['info'](_0xaedd('0x56'));logger[_0xaedd('0xc')](_0xaedd('0x57'),_0x237051['id']);logger[_0xaedd('0xc')](_0xaedd('0x53'),_0xaedd('0x4b'));emit(util[_0xaedd('0xe')](_0xaedd('0x4c'),_0x534410[_0xaedd('0x15')]),'trigger:browser:url',{'uri':util[_0xaedd('0xe')](_0xaedd('0x4e'),_0x189880[_0xaedd('0x1c')],_0x237051['id'])});}})['catch'](function(_0xf95c8e){logger[_0xaedd('0x50')](_0xaedd('0x53'),JSON[_0xaedd('0x58')](_0xf95c8e));});};exports[_0xaedd('0x59')]=function(_0xb44b53,_0x4443dc,_0x7e4db7,_0x4a25b2,_0x263b95,_0x33e80d){var _0x1484c1,_0x2edaf8;_0x33e80d[_0xaedd('0x1c')]=intUtil[_0xaedd('0x42')](_0x33e80d[_0xaedd('0x1c')]);_0x33e80d[_0xaedd('0x41')]=intUtil[_0xaedd('0x42')](_0x33e80d[_0xaedd('0x41')]);if(_0x263b95&&_0x263b95[_0xaedd('0x5a')]){logger[_0xaedd('0xc')]('['+_0x4443dc[_0xaedd('0x5b')]['toUpperCase']()+']',_0xaedd('0x44'));_0x4443dc[_0xaedd('0x45')]=util[_0xaedd('0xe')](_0xaedd('0x46'),_0x33e80d[_0xaedd('0x41')],_0x4443dc[_0xaedd('0x47')],md5(_0x4443dc[_0xaedd('0x47')]));}else{_0x4443dc[_0xaedd('0x45')]='';}headers[_0xaedd('0x48')]=getAuth(_0x33e80d);return getUser(_0x33e80d,'')['then'](function(_0xcecfd6){_0x1484c1=_0xcecfd6;logger['info']('The\x20User\x20ID\x20is:',_0x1484c1['id']);return getEndUser(_0x33e80d,_0x4443dc[_0xaedd('0x10')],_0x4443dc[_0xaedd('0x11')]);})['then'](function(_0x3799e6){_0x2edaf8=_0x3799e6;logger['info'](_0xaedd('0x5c'),_0x2edaf8['id']);return getTicket(_0x33e80d,_0x1484c1,_0x2edaf8,_0x7e4db7,_0x4443dc);})[_0xaedd('0x24')](function(_0x11044b){if(_0x11044b){logger['info']('Ticket\x20created!');logger['info']('The\x20Ticket\x20ID\x20is:',_0x11044b['id']);}})[_0xaedd('0x4f')](function(_0x246fa1){logger['error']('['+_0x4443dc[_0xaedd('0x5b')][_0xaedd('0x5d')]()+']',JSON[_0xaedd('0x58')](_0x246fa1));});}; \ No newline at end of file +var _0xf970=['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','error','[QUEUE]','outbound','recordingFormat','[OUTBOUND]','destcalleridname','destcalleridnum','unmanaged','lastevent','toUpperCase','request-promise','util','ioredis','../../../../config/environment','../../../../config/logger','redis','localhost','socket.io-emitter','application/json','emit','Creating\x20new\x20ticket...','format','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','Descriptions','
','Tags','name','custom_fields','mapValues','keyBy','%s/api/v2/tickets','remoteUri','POST','then','info','Ticket\x20created!','validateEmail','%s/api/v2/agents','length','Agent\x20found!','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','find','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','apiKey','base64','debug','[HTTP]','stringify','GET','map','includes','string','picklist','customField','nameField','toLowerCase','content','toString','type','idField','variable','variableName','push','customVariable','Variable','serverUrl','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','Authorization'];(function(_0x1e92f9,_0x286900){var _0x5950ed=function(_0x30941c){while(--_0x30941c){_0x1e92f9['push'](_0x1e92f9['shift']());}};_0x5950ed(++_0x286900);}(_0xf970,0x185));var _0x0f97=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf970[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var rp=require(_0x0f97('0x0'));var md5=require('md5');var util=require(_0x0f97('0x1'));var Redis=require(_0x0f97('0x2'));var intUtil=require('./util');var config=require(_0x0f97('0x3'));var logger=require(_0x0f97('0x4'))('freshdesk');config[_0x0f97('0x5')]=_['defaults'](config[_0x0f97('0x5')],{'host':_0x0f97('0x6'),'port':0x18eb});var io=require(_0x0f97('0x7'))(new Redis(config[_0x0f97('0x5')]));var headers={'Content-Type':_0x0f97('0x8'),'Accept':'application/json'};function emit(_0x535e42,_0x5cfd46,_0x227cb8){io['to'](_0x535e42)[_0x0f97('0x9')](_0x5cfd46,_0x227cb8);}function getTicket(_0x3c7752,_0x28e25a,_0x21c444,_0x1941a7,_0x13ef41){logger['info'](_0x0f97('0xa'));var _0x2a1389=_['merge']({'responder_id':_0x28e25a['id'],'requester_id':_0x21c444['id'],'name':util[_0x0f97('0xb')](_0x0f97('0xc'),_0x13ef41[_0x0f97('0xd')]),'phone':_0x13ef41[_0x0f97('0xe')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x0f97('0xf')](_0x1941a7[_0x0f97('0x10')],_0x13ef41,'\x20'),'description':intUtil[_0x0f97('0xf')](_0x1941a7[_0x0f97('0x11')],_0x13ef41,_0x0f97('0x12')),'tags':getTags(_0x1941a7[_0x0f97('0x13')],_0x0f97('0x14'))},getCustomFields(_0x1941a7['Fields'],_0x13ef41));_0x2a1389[_0x0f97('0x15')]=_[_0x0f97('0x16')](_[_0x0f97('0x17')](_0x2a1389[_0x0f97('0x15')],'id'),'value');return request({'uri':util[_0x0f97('0xb')](_0x0f97('0x18'),_0x3c7752[_0x0f97('0x19')]),'method':_0x0f97('0x1a'),'body':_0x2a1389})[_0x0f97('0x1b')](function(_0x2b8115){logger[_0x0f97('0x1c')](_0x0f97('0x1d'));return _0x2b8115;});}function getUser(_0x3cbdea,_0x566a75){if(intUtil[_0x0f97('0x1e')](_0x566a75)){return request({'uri':util[_0x0f97('0xb')](_0x0f97('0x1f'),_0x3cbdea[_0x0f97('0x19')]),'qs':{'email':_0x566a75}})['then'](function(_0x471625){if(_0x471625[_0x0f97('0x20')]){logger[_0x0f97('0x1c')](_0x0f97('0x21'));return _['find'](_0x471625,function(_0x7cfe41){return _0x7cfe41['contact'][_0x0f97('0x22')]===_0x566a75;});}else{logger[_0x0f97('0x1c')](_0x0f97('0x23'));return request({'uri':util[_0x0f97('0xb')]('%s/api/v2/agents/me',_0x3cbdea[_0x0f97('0x19')])})['then'](function(_0x2c2798){logger[_0x0f97('0x1c')](_0x0f97('0x24'));return _0x2c2798;});}});}else{logger[_0x0f97('0x1c')](_0x0f97('0x25'));return request({'uri':util[_0x0f97('0xb')](_0x0f97('0x26'),_0x3cbdea[_0x0f97('0x19')])})['then'](function(_0x52f26f){logger[_0x0f97('0x1c')]('Admin\x20account\x20selected.');return _0x52f26f;});}}function getEndUser(_0x454871,_0x3ff1f8,_0x5c5176){logger['info'](_0x0f97('0x27'),_0x5c5176);return request({'uri':util[_0x0f97('0xb')](_0x0f97('0x28'),_0x454871[_0x0f97('0x19')]),'qs':{'phone':_0x5c5176}})[_0x0f97('0x1b')](function(_0x36c8c2){if(_0x36c8c2[_0x0f97('0x20')]){logger[_0x0f97('0x1c')](_0x0f97('0x29'));return _[_0x0f97('0x2a')](_0x36c8c2,{'phone':_0x5c5176});}else{logger[_0x0f97('0x1c')](_0x0f97('0x2b'));return request({'uri':util['format'](_0x0f97('0x28'),_0x454871[_0x0f97('0x19')]),'method':'POST','body':{'name':_0x3ff1f8,'phone':_0x5c5176}})[_0x0f97('0x1b')](function(_0xc6872){logger['info'](_0x0f97('0x2c'));return _0xc6872;});}});}function getAuth(_0x28dfd7){return util[_0x0f97('0xb')](_0x0f97('0x2d'),new Buffer(_0x28dfd7[_0x0f97('0x2e')]+':X')['toString'](_0x0f97('0x2f')));}function request(_0x2d5dee){logger[_0x0f97('0x30')](_0x0f97('0x31'),JSON[_0x0f97('0x32')](_0x2d5dee));return rp(_['defaults'](_0x2d5dee,{'method':_0x0f97('0x33'),'headers':headers,'json':!![]}));}function getTags(_0x50a1db,_0x410a4b){var _0x158fef=[];if(_0x50a1db&&_0x50a1db[_0x0f97('0x20')]>0x0){_0x158fef=_[_0x0f97('0x34')](_0x50a1db,_0x410a4b);}return _0x158fef;}function getCustomFields(_0x259320,_0x4dc5b2){var _0x3cb44d=[];var _0x575231={'custom_fields':[]};if(_0x259320[_0x0f97('0x20')]>0x0){_['forEach'](_0x259320,function(_0x4fa4e5){if(_[_0x0f97('0x35')]([_0x0f97('0x36'),_0x0f97('0x37')],_0x4fa4e5['type'])&&_0x4fa4e5['nameField']&&!_0x4fa4e5[_0x0f97('0x38')]){_0x575231[_0x4fa4e5[_0x0f97('0x39')][_0x0f97('0x3a')]()]=_0x4fa4e5[_0x0f97('0x3b')][_0x0f97('0x3c')]();}else if(_['includes']([_0x0f97('0x36'),_0x0f97('0x37')],_0x4fa4e5[_0x0f97('0x3d')])&&_0x4fa4e5[_0x0f97('0x3e')]&&_0x4fa4e5[_0x0f97('0x38')]){_0x575231[_0x0f97('0x15')]['push']({'id':_0x4fa4e5['idField'],'value':_0x4fa4e5[_0x0f97('0x3b')][_0x0f97('0x3c')]()});}else if(_0x4fa4e5[_0x0f97('0x3d')]===_0x0f97('0x3f')&&_0x4fa4e5[_0x0f97('0x40')]&&_0x4fa4e5[_0x0f97('0x3e')]&&_0x4fa4e5[_0x0f97('0x38')]){_0x4dc5b2[_0x4fa4e5['variableName']]&&_0x575231[_0x0f97('0x15')][_0x0f97('0x41')]({'id':_0x4fa4e5['idField'],'value':_0x4dc5b2[_0x4fa4e5[_0x0f97('0x40')]][_0x0f97('0x3c')]()});}else if(_0x4fa4e5['type']===_0x0f97('0x42')&&_0x4fa4e5['Variable']&&_0x4fa4e5[_0x0f97('0x43')]['name']&&_0x4fa4e5['idField']&&_0x4fa4e5[_0x0f97('0x38')]){_0x4dc5b2[_0x4fa4e5['Variable'][_0x0f97('0x14')][_0x0f97('0x3a')]()]&&_0x575231[_0x0f97('0x15')][_0x0f97('0x41')]({'id':_0x4fa4e5[_0x0f97('0x3e')],'value':_0x4dc5b2[_0x4fa4e5[_0x0f97('0x43')][_0x0f97('0x14')]['toLowerCase']()][_0x0f97('0x3c')]()});}});}return _0x575231;}exports['queue']=function(_0x4b2527,_0x339cbd,_0x56e7e2,_0x3dc1e3,_0x1a01b4,_0x4520c6){var _0xc1c9a3,_0x39234d;_0x4520c6[_0x0f97('0x19')]=intUtil['stripTrailingSlash'](_0x4520c6['remoteUri']);_0x4520c6[_0x0f97('0x44')]=intUtil[_0x0f97('0x45')](_0x4520c6[_0x0f97('0x44')]);if(_0x1a01b4&&_0x1a01b4[_0x0f97('0x46')]){logger['info']('[QUEUE]',_0x0f97('0x47'));_0x339cbd['recordingURL']=util['format'](_0x0f97('0x48'),_0x4520c6[_0x0f97('0x44')],_0x339cbd[_0x0f97('0x49')],md5(_0x339cbd['uniqueid']));}else{_0x339cbd[_0x0f97('0x4a')]='';}headers[_0x0f97('0x4b')]=getAuth(_0x4520c6);return getUser(_0x4520c6,_0x3dc1e3['email'])[_0x0f97('0x1b')](function(_0x396957){_0xc1c9a3=_0x396957;logger[_0x0f97('0x1c')](_0x0f97('0x4c'),_0xc1c9a3['id']);return getEndUser(_0x4520c6,_0x339cbd[_0x0f97('0xd')],_0x339cbd[_0x0f97('0xe')]);})[_0x0f97('0x1b')](function(_0x10016c){_0x39234d=_0x10016c;logger[_0x0f97('0x1c')](_0x0f97('0x4d'),_0x39234d['id']);return getTicket(_0x4520c6,_0xc1c9a3,_0x39234d,_0x56e7e2,_0x339cbd);})[_0x0f97('0x1b')](function(_0x1534e5){if(_0x1534e5&&_0x1534e5['id']){logger[_0x0f97('0x1c')](_0x0f97('0x1d'));logger[_0x0f97('0x1c')](_0x0f97('0x4e'),_0x1534e5['id']);logger[_0x0f97('0x1c')]('[QUEUE]',_0x0f97('0x4f'));emit(util[_0x0f97('0xb')](_0x0f97('0x50'),_0x3dc1e3[_0x0f97('0x14')]),_0x0f97('0x51'),{'uri':util[_0x0f97('0xb')]('%s/helpdesk/tickets/%d',_0x4520c6[_0x0f97('0x19')],_0x1534e5['id'])});}})[_0x0f97('0x52')](function(_0x3b433e){logger[_0x0f97('0x53')](_0x0f97('0x54'),JSON['stringify'](_0x3b433e));});};exports[_0x0f97('0x55')]=function(_0x97cb0e,_0x53420b,_0x1dc86f,_0x33f192,_0x37a029,_0x144260,_0x1f229e){var _0x458a80,_0x3b9f20;_0x144260[_0x0f97('0x19')]=intUtil[_0x0f97('0x45')](_0x144260[_0x0f97('0x19')]);_0x144260[_0x0f97('0x44')]=intUtil[_0x0f97('0x45')](_0x144260[_0x0f97('0x44')]);if(_0x1f229e&&_0x1f229e['recordingFormat']&&_0x1f229e[_0x0f97('0x56')]!=='none'){logger[_0x0f97('0x1c')](_0x0f97('0x57'),'Recording\x20is\x20enabled!');_0x53420b['recordingURL']=util[_0x0f97('0xb')](_0x0f97('0x48'),_0x144260['serverUrl'],_0x53420b[_0x0f97('0x49')],md5(_0x53420b[_0x0f97('0x49')]));}headers[_0x0f97('0x4b')]=getAuth(_0x144260);return getUser(_0x144260,_0x33f192[_0x0f97('0x22')])[_0x0f97('0x1b')](function(_0xc3bc1a){_0x458a80=_0xc3bc1a;logger['info'](_0x0f97('0x4c'),_0x458a80['id']);return getEndUser(_0x144260,_0x53420b[_0x0f97('0x58')],_0x53420b[_0x0f97('0x59')]);})[_0x0f97('0x1b')](function(_0x137df4){_0x3b9f20=_0x137df4;logger['info'](_0x0f97('0x4d'),_0x3b9f20['id']);return getTicket(_0x144260,_0x458a80,_0x3b9f20,_0x1dc86f,_0x53420b);})[_0x0f97('0x1b')](function(_0x56c407){if(_0x56c407&&_0x56c407['id']){logger[_0x0f97('0x1c')](_0x0f97('0x1d'));logger[_0x0f97('0x1c')](_0x0f97('0x4e'),_0x56c407['id']);logger[_0x0f97('0x1c')]('[OUTBOUND]',_0x0f97('0x4f'));emit(util[_0x0f97('0xb')](_0x0f97('0x50'),_0x33f192[_0x0f97('0x14')]),_0x0f97('0x51'),{'uri':util[_0x0f97('0xb')]('%s/helpdesk/tickets/%d',_0x144260[_0x0f97('0x19')],_0x56c407['id'])});}})[_0x0f97('0x52')](function(_0x14c9ed){logger['error'](_0x0f97('0x57'),JSON['stringify'](_0x14c9ed));});};exports[_0x0f97('0x5a')]=function(_0x320307,_0xa1d347,_0x53bbfa,_0x302004,_0x14c3f7,_0x4ed016){var _0x910200,_0x1e848c;_0x4ed016[_0x0f97('0x19')]=intUtil[_0x0f97('0x45')](_0x4ed016['remoteUri']);_0x4ed016[_0x0f97('0x44')]=intUtil['stripTrailingSlash'](_0x4ed016[_0x0f97('0x44')]);if(_0x14c3f7&&_0x14c3f7[_0x0f97('0x46')]){logger[_0x0f97('0x1c')]('['+_0xa1d347[_0x0f97('0x5b')][_0x0f97('0x5c')]()+']','Recording\x20is\x20enabled!');_0xa1d347[_0x0f97('0x4a')]=util[_0x0f97('0xb')](_0x0f97('0x48'),_0x4ed016[_0x0f97('0x44')],_0xa1d347[_0x0f97('0x49')],md5(_0xa1d347[_0x0f97('0x49')]));}else{_0xa1d347[_0x0f97('0x4a')]='';}headers[_0x0f97('0x4b')]=getAuth(_0x4ed016);return getUser(_0x4ed016,'')[_0x0f97('0x1b')](function(_0x24a70e){_0x910200=_0x24a70e;logger[_0x0f97('0x1c')](_0x0f97('0x4c'),_0x910200['id']);return getEndUser(_0x4ed016,_0xa1d347['calleridname'],_0xa1d347[_0x0f97('0xe')]);})['then'](function(_0x11f58a){_0x1e848c=_0x11f58a;logger[_0x0f97('0x1c')]('The\x20Enduser\x20ID\x20is:',_0x1e848c['id']);return getTicket(_0x4ed016,_0x910200,_0x1e848c,_0x53bbfa,_0xa1d347);})[_0x0f97('0x1b')](function(_0xa54219){if(_0xa54219){logger['info'](_0x0f97('0x1d'));logger[_0x0f97('0x1c')]('The\x20Ticket\x20ID\x20is:',_0xa54219['id']);}})['catch'](function(_0x2ef3bc){logger[_0x0f97('0x53')]('['+_0xa1d347[_0x0f97('0x5b')][_0x0f97('0x5c')]()+']',JSON[_0x0f97('0x32')](_0x2ef3bc));});}; \ 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 3f2814a..f3f93fb 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 _0x9b51=['Contact\x20found\x20mobile_number:','work_number','POST','/api/contacts','format','contact','toUpperCase','Creating\x20new\x20task','/api/tasks','getString','Subjects','Descriptions','YYYY-MM-DDTHH:mm:ss','add','ticketId','task','/contacts/','user:%s','emit','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','destcalleridnum','calleridnum','callDirection','queue','outbound','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','unmanaged','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','md5','util','bluebird','ioredis','./util','freshsales','redis','localhost','socket.io-emitter','GET','/api/selector/owners','headers','info','Getting\x20admin\x20information','then','users','email','adminEmail','Admin\x20found:','adminId','Requested\x20Resource\x20not\x20Found','catch','error','Getting\x20user\x20list','Getting\x20user\x20with\x20email','agentEmail','userId','User\x20found:','message','&f=','&entities=contact','find','contacts','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId'];(function(_0xf340de,_0x16d2af){var _0x324415=function(_0x5b5a40){while(--_0x5b5a40){_0xf340de['push'](_0xf340de['shift']());}};_0x324415(++_0x16d2af);}(_0x9b51,0x1c5));var _0x19b5=function(_0x1d95e1,_0x2dac2f){_0x1d95e1=_0x1d95e1-0x0;var _0x542fa0=_0x9b51[_0x1d95e1];return _0x542fa0;};'use strict';var _=require(_0x19b5('0x0'));var rp=require(_0x19b5('0x1'));var md5=require(_0x19b5('0x2'));var util=require(_0x19b5('0x3'));var moment=require('moment');var Promise=require(_0x19b5('0x4'));var Redis=require(_0x19b5('0x5'));var intUtil=require(_0x19b5('0x6'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x19b5('0x7'));config[_0x19b5('0x8')]=_['defaults'](config[_0x19b5('0x8')],{'host':_0x19b5('0x9'),'port':0x18eb});var io=require(_0x19b5('0xa'))(new Redis(config[_0x19b5('0x8')]));function getAdminId(_0x135b2f,_0x8f7c89,_0x2a2e3a,_0x50a002){return new Promise(function(_0x533f05,_0xccd675){var _0x1b5831=![];var _0x39e25c={'method':_0x19b5('0xb'),'uri':_0x50a002+_0x19b5('0xc'),'json':!![]};_0x39e25c[_0x19b5('0xd')]=_0x2a2e3a;logger[_0x19b5('0xe')](_0x19b5('0xf'));return rp(_0x39e25c)[_0x19b5('0x10')](function(_0x344d0e){if(_0x344d0e){var _0x1345c8=_0x344d0e[_0x19b5('0x11')];var _0x2d03d5=null;for(_0x2d03d5=0x0;_0x2d03d5<_0x1345c8['length'];_0x2d03d5++){if(_0x1345c8[_0x2d03d5][_0x19b5('0x12')]===_0x135b2f[_0x19b5('0x13')]){_0x135b2f['adminId']=_0x1345c8[_0x2d03d5]['id'];_0x1b5831=!![];}}if(_0x1b5831){logger[_0x19b5('0xe')](_0x19b5('0x14'),_0x135b2f[_0x19b5('0x15')]);_0x533f05(_0x135b2f);}else{_0xccd675({'statusCode':0x194,'message':_0x19b5('0x16')});}}else{_0xccd675({'statusCode':0x194,'message':_0x19b5('0x16')});}})[_0x19b5('0x17')](function(_0x3b0520){logger[_0x19b5('0x18')]('['+[_0x8f7c89['toUpperCase']()]+']',_0x3b0520['message']);_0xccd675(_0x3b0520);});});}function getUser(_0x178afd,_0x3fa2d9,_0x1425a3){return function(_0x45ebf7){return new Promise(function(_0x29ff03,_0x14318f){var _0x29ef2f={'method':_0x19b5('0xb'),'uri':_0x1425a3+_0x19b5('0xc'),'json':!![]};_0x29ef2f['headers']=_0x3fa2d9;logger[_0x19b5('0xe')](_0x19b5('0x19'));return rp(_0x29ef2f)[_0x19b5('0x10')](function(_0x323cfb){if(_0x323cfb){var _0x41271a=_0x323cfb[_0x19b5('0x11')];var _0x26cbd4=![];var _0x565b68=null;if(_0x45ebf7['agentEmail']!==null){logger[_0x19b5('0xe')](_0x19b5('0x1a'),_0x45ebf7[_0x19b5('0x1b')]);_0x45ebf7['userEmail']=_0x45ebf7[_0x19b5('0x1b')];for(_0x565b68=0x0;_0x565b68<_0x41271a['length'];_0x565b68++){if(_0x41271a[_0x565b68][_0x19b5('0x12')]===_0x45ebf7[_0x19b5('0x1b')]){_0x26cbd4=!![];_0x45ebf7[_0x19b5('0x1c')]=_0x41271a[_0x565b68]['id'];logger[_0x19b5('0xe')](_0x19b5('0x1d'),_0x45ebf7[_0x19b5('0x1c')]);}}}if(!_0x26cbd4){logger[_0x19b5('0xe')]('Admin\x20selected');_0x45ebf7['userEmail']=_0x45ebf7[_0x19b5('0x13')];_0x45ebf7['userId']=_0x45ebf7[_0x19b5('0x15')];_0x26cbd4=!![];}if(_0x26cbd4){_0x29ff03(_0x45ebf7);}else{_0x14318f({'statusCode':0x194,'message':_0x19b5('0x16')});}}else{_0x14318f({'statusCode':0x194,'message':_0x19b5('0x16')});}})[_0x19b5('0x17')](function(_0x545b80){logger[_0x19b5('0x18')]('['+[_0x178afd['toUpperCase']()]+']',_0x545b80[_0x19b5('0x1e')]);_0x14318f(_0x545b80);});});};}function searchContact(_0x2dcf7c,_0x3b639f,_0x38a654,_0x5a3420){return new Promise(function(_0x3eda21,_0xcaf5bd){var _0x1b8ba0={'method':_0x19b5('0xb'),'headers':_0x3b639f,'uri':_0x2dcf7c+'/api/lookup?q='+_0x5a3420+_0x19b5('0x1f')+_0x38a654+_0x19b5('0x20'),'json':!![]};rp(_0x1b8ba0)[_0x19b5('0x10')](function(_0xd8c779){var _0x39c6e6=_[_0x19b5('0x21')](_0xd8c779[_0x19b5('0x22')]['contacts'],[_0x38a654,_0x5a3420]);_0x3eda21(_0x39c6e6);})['catch'](function(_0xa47f6){_0xcaf5bd(_0xa47f6);});});}function getEndUser(_0x19aa30,_0x4ff698,_0x32941f){return function(_0x18783d){return new Promise(function(_0x3c7a61,_0x1798b7){logger[_0x19b5('0xe')](util['format'](_0x19b5('0x23'),_0x18783d[_0x19b5('0x24')]));searchContact(_0x32941f,_0x4ff698,_0x19b5('0x25'),_0x18783d[_0x19b5('0x24')])[_0x19b5('0x10')](function(_0xd8a932){if(_0xd8a932){_0x18783d[_0x19b5('0x26')]=_0xd8a932['id'];logger[_0x19b5('0xe')](_0x19b5('0x27'),_0x18783d[_0x19b5('0x26')]);return _0x3c7a61(_0x18783d);}searchContact(_0x32941f,_0x4ff698,_0x19b5('0x28'),_0x18783d[_0x19b5('0x24')])[_0x19b5('0x10')](function(_0x37d8f6){if(_0x37d8f6){_0x18783d[_0x19b5('0x26')]=_0x37d8f6['id'];logger[_0x19b5('0xe')]('Contact\x20found\x20work_number:',_0x18783d['endUserId']);return _0x3c7a61(_0x18783d);}createEndUser(_0x18783d,_0x19aa30,_0x4ff698,_0x32941f)[_0x19b5('0x10')](function(_0x30a77d){logger['info']('Contact\x20created:',_0x30a77d[_0x19b5('0x26')]);return _0x3c7a61(_0x30a77d);});});})['catch'](function(_0x5e96eb){_0x1798b7(_0x5e96eb);});});};}function createEndUser(_0x4b45b5,_0x472dbe,_0x3d903d,_0x216eeb){return new Promise(function(_0x190fa1,_0x3edb82){var _0x415d72=moment();var _0x203b51={'method':_0x19b5('0x29'),'uri':_0x216eeb+_0x19b5('0x2a'),'body':{'contact':{'last_name':_0x4b45b5['contactNumber'],'work_number':_0x4b45b5[_0x19b5('0x24')],'mobile_number':_0x4b45b5[_0x19b5('0x24')],'owner_id':_0x4b45b5['userId'],'created_at':_0x415d72[_0x19b5('0x2b')]('YYYY-MM-DDTHH:mm:ss')}},'json':!![]};_0x203b51[_0x19b5('0xd')]=_0x3d903d;logger[_0x19b5('0xe')]('Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact');return rp(_0x203b51)['then'](function(_0x5b7c07){_0x4b45b5['endUserId']=_0x5b7c07[_0x19b5('0x2c')]['id'];_0x190fa1(_0x4b45b5);})['catch'](function(_0x4b02cc){logger[_0x19b5('0x18')]('['+[_0x472dbe[_0x19b5('0x2d')]()]+']',_0x4b02cc['message']);_0x3edb82(_0x4b02cc['message']);});});}function getTicket(_0x117f52,_0x3a4e5e,_0x3c33b1,_0x12575f,_0xe9942c){return function(_0x3aa785){logger[_0x19b5('0xe')](_0x19b5('0x2e'));return new Promise(function(_0x4ac391,_0x28f352){var _0x32ecf7=moment();var _0x39e7cc={'method':_0x19b5('0x29'),'uri':_0x3c33b1+_0x19b5('0x2f'),'body':{'title':intUtil[_0x19b5('0x30')](_0x12575f[_0x19b5('0x31')],_0xe9942c,'\x20'),'description':intUtil[_0x19b5('0x30')](_0x12575f[_0x19b5('0x32')],_0xe9942c,'\x0a'),'owner_id':_0x3aa785['userId'],'creater_id':_0x3aa785['adminId'],'targetable_id':_0x3aa785[_0x19b5('0x26')],'targetable_type':'Contact','created_at':_0x32ecf7['format'](_0x19b5('0x33')),'due_date':_0x32ecf7[_0x19b5('0x34')](0x1e,'m')['format'](_0x19b5('0x33'))},'json':!![]};_0x39e7cc[_0x19b5('0xd')]=_0x3a4e5e;return rp(_0x39e7cc)['then'](function(_0x204227){_0x3aa785[_0x19b5('0x35')]=_0x204227[_0x19b5('0x36')]['id'];logger[_0x19b5('0xe')]('Task\x20created:',_0x3aa785['ticketId']);_0x4ac391(_0x3aa785);})['catch'](function(_0x1647e6){logger[_0x19b5('0x18')]('['+[_0x117f52[_0x19b5('0x2d')]()]+']',_0x1647e6['message']);_0x28f352(_0x1647e6[_0x19b5('0x1e')]);});});};}function emit(_0x44cef8,_0x5e916d,_0x2c192c){var _0x142139={'uri':_0x44cef8+_0x19b5('0x37')+_0x2c192c};io['to'](util['format'](_0x19b5('0x38'),_0x5e916d))[_0x19b5('0x39')]('trigger:browser:url',_0x142139);}exports['cs']=function(_0x5e5977,_0x79b6cc,_0x306550,_0x46bf13,_0x1000cc,_0x514035,_0x46262b,_0x308b3d){var _0x39f5d5={};var _0x2c551d={'Authorization':_0x19b5('0x3a')+_0x514035[_0x19b5('0x3b')]};_0x514035[_0x19b5('0x3c')]=intUtil[_0x19b5('0x3d')](_0x514035[_0x19b5('0x3c')]);_0x514035['serverUrl']=intUtil[_0x19b5('0x3d')](_0x514035[_0x19b5('0x3e')]);var _0x439853=_0x514035[_0x19b5('0x3c')];_0x39f5d5['adminEmail']=_0x514035[_0x19b5('0x3f')];_0x39f5d5[_0x19b5('0x24')]=_0x308b3d[_0x19b5('0x40')]()==='outbound'?_0x79b6cc[_0x19b5('0x41')]:_0x79b6cc[_0x19b5('0x42')];_0x39f5d5[_0x19b5('0x43')]=_0x308b3d===_0x19b5('0x44')||_0x308b3d==='unmanaged'?_0x19b5('0x44'):_0x19b5('0x45');if(_0x46bf13){_0x39f5d5['agentEmail']=_0x46bf13[_0x19b5('0x12')];}var _0x2e9086=util[_0x19b5('0x2b')](_0x19b5('0x46'),_0x514035[_0x19b5('0x3e')],_0x79b6cc[_0x19b5('0x47')],md5(_0x79b6cc['uniqueid']));if(_0x1000cc&&_0x1000cc[_0x19b5('0x48')]){logger[_0x19b5('0xe')](_0x19b5('0x49'),_0x19b5('0x4a'));_0x79b6cc[_0x19b5('0x4b')]=_0x2e9086;}else if(_0x46262b&&_0x46262b['recordingFormat']&&_0x46262b[_0x19b5('0x4c')]!=='none'){logger[_0x19b5('0xe')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x79b6cc[_0x19b5('0x4b')]=_0x2e9086;}else{_0x79b6cc[_0x19b5('0x4b')]='';}return getAdminId(_0x39f5d5,_0x308b3d,_0x2c551d,_0x439853)[_0x19b5('0x10')](getUser(_0x308b3d,_0x2c551d,_0x439853))[_0x19b5('0x10')](getEndUser(_0x308b3d,_0x2c551d,_0x439853))['then'](getTicket(_0x308b3d,_0x2c551d,_0x439853,_0x306550,_0x79b6cc))['then'](function(_0x204020){logger[_0x19b5('0xe')](util[_0x19b5('0x2b')]('The\x20ticket\x20ID\x20is:\x20%s',_0x204020[_0x19b5('0x35')]));if(_0x308b3d!==_0x19b5('0x4d')){logger['info']('['+[_0x308b3d[_0x19b5('0x2d')]()]+']',_0x19b5('0x4e'));emit(_0x439853,_0x46bf13[_0x19b5('0x4f')],_0x204020[_0x19b5('0x26')]);}})[_0x19b5('0x17')](function(_0x3e9eee){logger['error']('['+[_0x308b3d[_0x19b5('0x2d')]()]+_0x19b5('0x50'),util[_0x19b5('0x51')](_0x3e9eee,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x2836=['GET','info','Getting\x20admin\x20information','then','users','email','adminEmail','adminId','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','/api/selector/owners','headers','Getting\x20user\x20list','Getting\x20user\x20with\x20email','agentEmail','userEmail','length','userId','User\x20found:','Admin\x20selected','&f=','&entities=contact','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','Contact\x20created:','POST','contactNumber','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','/api/tasks','Subjects','getString','Descriptions','Contact','ticketId','/contacts/','user:%s','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','serverUrl','username','toLowerCase','calleridnum','callDirection','queue','unmanaged','outbound','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','lodash','request-promise','md5','util','moment','ioredis','./util','../../../../config/logger','freshsales','redis','defaults','localhost','socket.io-emitter'];(function(_0x1c6129,_0x3466d6){var _0x4ca692=function(_0x37ddc1){while(--_0x37ddc1){_0x1c6129['push'](_0x1c6129['shift']());}};_0x4ca692(++_0x3466d6);}(_0x2836,0x147));var _0x6283=function(_0x908ad1,_0x6ae5e9){_0x908ad1=_0x908ad1-0x0;var _0x50195c=_0x2836[_0x908ad1];return _0x50195c;};'use strict';var _=require(_0x6283('0x0'));var rp=require(_0x6283('0x1'));var md5=require(_0x6283('0x2'));var util=require(_0x6283('0x3'));var moment=require(_0x6283('0x4'));var Promise=require('bluebird');var Redis=require(_0x6283('0x5'));var intUtil=require(_0x6283('0x6'));var config=require('../../../../config/environment');var logger=require(_0x6283('0x7'))(_0x6283('0x8'));config[_0x6283('0x9')]=_[_0x6283('0xa')](config[_0x6283('0x9')],{'host':_0x6283('0xb'),'port':0x18eb});var io=require(_0x6283('0xc'))(new Redis(config[_0x6283('0x9')]));function getAdminId(_0x2cce56,_0x4f179d,_0x16a849,_0x459a59){return new Promise(function(_0x129476,_0x186836){var _0x6d6ea9=![];var _0x1e8671={'method':_0x6283('0xd'),'uri':_0x459a59+'/api/selector/owners','json':!![]};_0x1e8671['headers']=_0x16a849;logger[_0x6283('0xe')](_0x6283('0xf'));return rp(_0x1e8671)[_0x6283('0x10')](function(_0x2d5ef0){if(_0x2d5ef0){var _0x5efb1b=_0x2d5ef0[_0x6283('0x11')];var _0x237f0a=null;for(_0x237f0a=0x0;_0x237f0a<_0x5efb1b['length'];_0x237f0a++){if(_0x5efb1b[_0x237f0a][_0x6283('0x12')]===_0x2cce56[_0x6283('0x13')]){_0x2cce56[_0x6283('0x14')]=_0x5efb1b[_0x237f0a]['id'];_0x6d6ea9=!![];}}if(_0x6d6ea9){logger[_0x6283('0xe')]('Admin\x20found:',_0x2cce56[_0x6283('0x14')]);_0x129476(_0x2cce56);}else{_0x186836({'statusCode':0x194,'message':_0x6283('0x15')});}}else{_0x186836({'statusCode':0x194,'message':_0x6283('0x15')});}})[_0x6283('0x16')](function(_0x5ca37c){logger[_0x6283('0x17')]('['+[_0x4f179d[_0x6283('0x18')]()]+']',_0x5ca37c[_0x6283('0x19')]);_0x186836(_0x5ca37c);});});}function getUser(_0x493b0b,_0x25c6eb,_0x11d7ef){return function(_0x85637f){return new Promise(function(_0x5cb870,_0x4df9c9){var _0x1a2bd8={'method':_0x6283('0xd'),'uri':_0x11d7ef+_0x6283('0x1a'),'json':!![]};_0x1a2bd8[_0x6283('0x1b')]=_0x25c6eb;logger['info'](_0x6283('0x1c'));return rp(_0x1a2bd8)[_0x6283('0x10')](function(_0x58caea){if(_0x58caea){var _0x1021d7=_0x58caea[_0x6283('0x11')];var _0x40b410=![];var _0x7f356e=null;if(_0x85637f['agentEmail']!==null){logger[_0x6283('0xe')](_0x6283('0x1d'),_0x85637f[_0x6283('0x1e')]);_0x85637f[_0x6283('0x1f')]=_0x85637f[_0x6283('0x1e')];for(_0x7f356e=0x0;_0x7f356e<_0x1021d7[_0x6283('0x20')];_0x7f356e++){if(_0x1021d7[_0x7f356e][_0x6283('0x12')]===_0x85637f[_0x6283('0x1e')]){_0x40b410=!![];_0x85637f[_0x6283('0x21')]=_0x1021d7[_0x7f356e]['id'];logger['info'](_0x6283('0x22'),_0x85637f['userId']);}}}if(!_0x40b410){logger[_0x6283('0xe')](_0x6283('0x23'));_0x85637f[_0x6283('0x1f')]=_0x85637f[_0x6283('0x13')];_0x85637f[_0x6283('0x21')]=_0x85637f['adminId'];_0x40b410=!![];}if(_0x40b410){_0x5cb870(_0x85637f);}else{_0x4df9c9({'statusCode':0x194,'message':_0x6283('0x15')});}}else{_0x4df9c9({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0x6283('0x16')](function(_0x3eae6){logger[_0x6283('0x17')]('['+[_0x493b0b[_0x6283('0x18')]()]+']',_0x3eae6[_0x6283('0x19')]);_0x4df9c9(_0x3eae6);});});};}function searchContact(_0x157bef,_0x530dae,_0x241771,_0x3d829e){return new Promise(function(_0x3ad97d,_0x4d6c84){var _0x545049={'method':_0x6283('0xd'),'headers':_0x530dae,'uri':_0x157bef+'/api/lookup?q='+_0x3d829e+_0x6283('0x24')+_0x241771+_0x6283('0x25'),'json':!![]};rp(_0x545049)[_0x6283('0x10')](function(_0x4c1234){var _0x559dbf=_[_0x6283('0x26')](_0x4c1234['contacts'][_0x6283('0x27')],[_0x241771,_0x3d829e]);_0x3ad97d(_0x559dbf);})[_0x6283('0x16')](function(_0x53af92){_0x4d6c84(_0x53af92);});});}function getEndUser(_0x290add,_0x1aebf2,_0x45f75c){return function(_0x4a1ec4){return new Promise(function(_0x36634c,_0x1ac374){logger['info'](util[_0x6283('0x28')](_0x6283('0x29'),_0x4a1ec4['contactNumber']));searchContact(_0x45f75c,_0x1aebf2,'mobile_number',_0x4a1ec4['contactNumber'])['then'](function(_0xd745e){if(_0xd745e){_0x4a1ec4[_0x6283('0x2a')]=_0xd745e['id'];logger[_0x6283('0xe')](_0x6283('0x2b'),_0x4a1ec4[_0x6283('0x2a')]);return _0x36634c(_0x4a1ec4);}searchContact(_0x45f75c,_0x1aebf2,_0x6283('0x2c'),_0x4a1ec4['contactNumber'])[_0x6283('0x10')](function(_0x37e8d9){if(_0x37e8d9){_0x4a1ec4[_0x6283('0x2a')]=_0x37e8d9['id'];logger[_0x6283('0xe')](_0x6283('0x2d'),_0x4a1ec4[_0x6283('0x2a')]);return _0x36634c(_0x4a1ec4);}createEndUser(_0x4a1ec4,_0x290add,_0x1aebf2,_0x45f75c)[_0x6283('0x10')](function(_0x1b5c22){logger[_0x6283('0xe')](_0x6283('0x2e'),_0x1b5c22[_0x6283('0x2a')]);return _0x36634c(_0x1b5c22);});});})[_0x6283('0x16')](function(_0xb06bab){_0x1ac374(_0xb06bab);});});};}function createEndUser(_0x4eb87b,_0x5c5114,_0xc0faad,_0x4aa1fb){return new Promise(function(_0x21affc,_0x5bcb69){var _0x481e27=moment();var _0xe2ccb8={'method':_0x6283('0x2f'),'uri':_0x4aa1fb+'/api/contacts','body':{'contact':{'last_name':_0x4eb87b[_0x6283('0x30')],'work_number':_0x4eb87b[_0x6283('0x30')],'mobile_number':_0x4eb87b['contactNumber'],'owner_id':_0x4eb87b[_0x6283('0x21')],'created_at':_0x481e27[_0x6283('0x28')](_0x6283('0x31'))}},'json':!![]};_0xe2ccb8['headers']=_0xc0faad;logger[_0x6283('0xe')](_0x6283('0x32'));return rp(_0xe2ccb8)[_0x6283('0x10')](function(_0x3887d3){_0x4eb87b[_0x6283('0x2a')]=_0x3887d3[_0x6283('0x33')]['id'];_0x21affc(_0x4eb87b);})[_0x6283('0x16')](function(_0xcc9fae){logger[_0x6283('0x17')]('['+[_0x5c5114[_0x6283('0x18')]()]+']',_0xcc9fae['message']);_0x5bcb69(_0xcc9fae[_0x6283('0x19')]);});});}function getTicket(_0x5f6d2a,_0x4bac91,_0x4fe97b,_0x2713a9,_0x5d64ca){return function(_0x29e092){logger[_0x6283('0xe')](_0x6283('0x34'));return new Promise(function(_0x1938d8,_0x2c8882){var _0x23d544=moment();var _0x45b0dc={'method':_0x6283('0x2f'),'uri':_0x4fe97b+_0x6283('0x35'),'body':{'title':intUtil['getString'](_0x2713a9[_0x6283('0x36')],_0x5d64ca,'\x20'),'description':intUtil[_0x6283('0x37')](_0x2713a9[_0x6283('0x38')],_0x5d64ca,'\x0a'),'owner_id':_0x29e092[_0x6283('0x21')],'creater_id':_0x29e092['adminId'],'targetable_id':_0x29e092[_0x6283('0x2a')],'targetable_type':_0x6283('0x39'),'created_at':_0x23d544[_0x6283('0x28')](_0x6283('0x31')),'due_date':_0x23d544['add'](0x1e,'m')[_0x6283('0x28')](_0x6283('0x31'))},'json':!![]};_0x45b0dc[_0x6283('0x1b')]=_0x4bac91;return rp(_0x45b0dc)[_0x6283('0x10')](function(_0x5c1545){_0x29e092[_0x6283('0x3a')]=_0x5c1545['task']['id'];logger[_0x6283('0xe')]('Task\x20created:',_0x29e092[_0x6283('0x3a')]);_0x1938d8(_0x29e092);})[_0x6283('0x16')](function(_0x48a098){logger['error']('['+[_0x5f6d2a['toUpperCase']()]+']',_0x48a098[_0x6283('0x19')]);_0x2c8882(_0x48a098[_0x6283('0x19')]);});});};}function emit(_0x175b57,_0x3bae03,_0x1a2824){var _0x517340={'uri':_0x175b57+_0x6283('0x3b')+_0x1a2824};io['to'](util[_0x6283('0x28')](_0x6283('0x3c'),_0x3bae03))[_0x6283('0x3d')](_0x6283('0x3e'),_0x517340);}exports['cs']=function(_0x3ddf28,_0x434e71,_0x7bca56,_0x3aca53,_0xa93d52,_0x567e55,_0x4bae91,_0x106adf){var _0x325829={};var _0x53b66c={'Authorization':_0x6283('0x3f')+_0x567e55[_0x6283('0x40')]};_0x567e55[_0x6283('0x41')]=intUtil['stripTrailingSlash'](_0x567e55['remoteUri']);_0x567e55[_0x6283('0x42')]=intUtil['stripTrailingSlash'](_0x567e55[_0x6283('0x42')]);var _0x9b9aa8=_0x567e55[_0x6283('0x41')];_0x325829[_0x6283('0x13')]=_0x567e55[_0x6283('0x43')];_0x325829[_0x6283('0x30')]=_0x106adf[_0x6283('0x44')]()==='outbound'?_0x434e71['destcalleridnum']:_0x434e71[_0x6283('0x45')];_0x325829[_0x6283('0x46')]=_0x106adf===_0x6283('0x47')||_0x106adf===_0x6283('0x48')?_0x6283('0x47'):_0x6283('0x49');if(_0x3aca53){_0x325829['agentEmail']=_0x3aca53[_0x6283('0x12')];}var _0x59d767=util[_0x6283('0x28')](_0x6283('0x4a'),_0x567e55[_0x6283('0x42')],_0x434e71[_0x6283('0x4b')],md5(_0x434e71[_0x6283('0x4b')]));if(_0xa93d52&&_0xa93d52['monitor_format']){logger[_0x6283('0xe')]('[QUEUE]','Recording\x20is\x20enabled!');_0x434e71[_0x6283('0x4c')]=_0x59d767;}else if(_0x4bae91&&_0x4bae91[_0x6283('0x4d')]&&_0x4bae91[_0x6283('0x4d')]!==_0x6283('0x4e')){logger[_0x6283('0xe')](_0x6283('0x4f'),_0x6283('0x50'));_0x434e71[_0x6283('0x4c')]=_0x59d767;}else{_0x434e71['recordingURL']='';}return getAdminId(_0x325829,_0x106adf,_0x53b66c,_0x9b9aa8)[_0x6283('0x10')](getUser(_0x106adf,_0x53b66c,_0x9b9aa8))[_0x6283('0x10')](getEndUser(_0x106adf,_0x53b66c,_0x9b9aa8))[_0x6283('0x10')](getTicket(_0x106adf,_0x53b66c,_0x9b9aa8,_0x7bca56,_0x434e71))[_0x6283('0x10')](function(_0xca8f58){logger[_0x6283('0xe')](util[_0x6283('0x28')](_0x6283('0x51'),_0xca8f58[_0x6283('0x3a')]));if(_0x106adf!==_0x6283('0x48')){logger[_0x6283('0xe')]('['+[_0x106adf['toUpperCase']()]+']',_0x6283('0x52'));emit(_0x9b9aa8,_0x3aca53[_0x6283('0x53')],_0xca8f58['endUserId']);}})[_0x6283('0x16')](function(_0x537804){logger[_0x6283('0x17')]('['+[_0x106adf[_0x6283('0x18')]()]+_0x6283('0x54'),util['inspect'](_0x537804,{'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 31e7e11..96c0aec 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 _0xd599=['toLowerCase','find','Configurations','routeId','outbound','log','EVENT\x20UNKNOWN','unmanaged','freshsales','unknown\x20integration','../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','data3','%s\x20account\x20#%s\x20not\x20found','data2','lodash','./zendesk','./salesforce','./freshdesk','./zoho','./desk','./vtiger','./freshsales','zendesk','salesforce','sugarcrm','freshdesk','desk','vtiger','dynamics365','servicenow','exec','data1'];(function(_0x265aa2,_0x220072){var _0x447a3a=function(_0x1512cc){while(--_0x1512cc){_0x265aa2['push'](_0x265aa2['shift']());}};_0x447a3a(++_0x220072);}(_0xd599,0xc6));var _0x9d59=function(_0x335589,_0x1aa3fb){_0x335589=_0x335589-0x0;var _0x843e05=_0xd599[_0x335589];return _0x843e05;};'use strict';var _=require(_0x9d59('0x0'));var util=require('util');var zendesk=require(_0x9d59('0x1'));var salesforce=require(_0x9d59('0x2'));var sugarcrm=require('./sugarcrm');var freshdesk=require(_0x9d59('0x3'));var zoho=require(_0x9d59('0x4'));var desk=require(_0x9d59('0x5'));var vtiger=require(_0x9d59('0x6'));var servicenow=require('./servicenow');var dynamics365=require('./dynamics365');var freshsales=require(_0x9d59('0x7'));var integrations=[_0x9d59('0x8'),_0x9d59('0x9'),_0x9d59('0xa'),_0x9d59('0xb'),'zoho',_0x9d59('0xc'),_0x9d59('0xd'),_0x9d59('0xe'),'freshsales',_0x9d59('0xf')];exports[_0x9d59('0x10')]=function(_0x2e3a5c,_0xaf5c5e,_0xacf687,_0x2c7278,_0x1fee18,_0x8f7905){if(_0xacf687){if(_['includes'](integrations,_0x2e3a5c[_0x9d59('0x11')][_0x9d59('0x12')]())){try{var _0x198157=null;var _0x494629='';var _0x23a96c=_0xacf687[_0x2e3a5c['data1']['toLowerCase']()];if(_0x23a96c){var _0x405e52=_0x23a96c[_0x2e3a5c['data2']];if(_0x405e52){var _0xf415a6=_[_0x9d59('0x13')](_0x405e52[_0x9d59('0x14')],{'id':parseInt(_0x2e3a5c['data3'],0xa)});if(_0xf415a6){if(_0x2c7278){if(_0x1fee18&&_0xaf5c5e['queue']){_0x494629='queue';}else if(_0xaf5c5e[_0x9d59('0x15')]){_0x494629=_0x9d59('0x16');}else{console[_0x9d59('0x17')](_0x9d59('0x18'),_0xaf5c5e);}}else{_0x494629=_0x9d59('0x19');}switch(_0x2e3a5c[_0x9d59('0x11')][_0x9d59('0x12')]()){case _0x9d59('0x8'):zendesk[_0x494629](_0x2e3a5c,_0xaf5c5e,_0xf415a6,_0x2c7278,_0x1fee18,_0x405e52,_0x8f7905);break;case'salesforce':salesforce[_0x494629](_0x2e3a5c,_0xaf5c5e,_0xf415a6,_0x2c7278,_0x1fee18,_0x405e52,_0x8f7905);break;case _0x9d59('0xa'):sugarcrm[_0x494629](_0x2e3a5c,_0xaf5c5e,_0xf415a6,_0x2c7278,_0x1fee18,_0x405e52,_0x8f7905);break;case _0x9d59('0xb'):freshdesk[_0x494629](_0x2e3a5c,_0xaf5c5e,_0xf415a6,_0x2c7278,_0x1fee18,_0x405e52,_0x8f7905);break;case'zoho':zoho[_0x494629](_0x2e3a5c,_0xaf5c5e,_0xf415a6,_0x2c7278,_0x1fee18,_0x405e52,_0x8f7905);break;case'desk':desk[_0x494629](_0x2e3a5c,_0xaf5c5e,_0xf415a6,_0x2c7278,_0x1fee18,_0x405e52,_0x8f7905);break;case _0x9d59('0xd'):vtiger[_0x494629](_0x2e3a5c,_0xaf5c5e,_0xf415a6,_0x2c7278,_0x1fee18,_0x405e52,_0x8f7905);break;case _0x9d59('0x1a'):freshsales['cs'](_0x2e3a5c,_0xaf5c5e,_0xf415a6,_0x2c7278,_0x1fee18,_0x405e52,_0x8f7905,_0x494629);break;case'servicenow':servicenow['cs'](_0x2e3a5c,_0xaf5c5e,_0xf415a6,_0x2c7278,_0x1fee18,_0x405e52,_0x8f7905,_0x494629);break;case _0x9d59('0xe'):dynamics365['cs'](_0x2e3a5c,_0xaf5c5e,_0xf415a6,_0x2c7278,_0x1fee18,_0x405e52,_0x8f7905,_0x494629);break;default:console['log'](_0x9d59('0x1b'));}}else{_0x198157=require(_0x9d59('0x1c'))(_0x2e3a5c[_0x9d59('0x11')][_0x9d59('0x12')]());_0x198157[_0x9d59('0x1d')](_0x9d59('0x1e'),util[_0x9d59('0x1f')](_0x9d59('0x20'),_0x2e3a5c[_0x9d59('0x11')]['toLowerCase'](),_0x2e3a5c[_0x9d59('0x21')]));}}else{_0x198157=require(_0x9d59('0x1c'))(_0x2e3a5c[_0x9d59('0x11')][_0x9d59('0x12')]());_0x198157[_0x9d59('0x1d')]('[EXEC]',util[_0x9d59('0x1f')](_0x9d59('0x22'),_0x2e3a5c['data1']['toLowerCase'](),_0x2e3a5c[_0x9d59('0x23')]));}}else{}}catch(_0x212578){console['error'](_0x212578);}}}}; \ No newline at end of file +var _0x6150=['outbound','log','EVENT\x20UNKNOWN','unmanaged','data1','zoho','../../../../config/logger','[EXEC]','%s\x20configuration\x20#%s\x20not\x20found','format','%s\x20account\x20#%s\x20not\x20found','lodash','util','./zendesk','./salesforce','./sugarcrm','./zoho','./desk','./vtiger','./servicenow','zendesk','salesforce','sugarcrm','freshdesk','desk','vtiger','dynamics365','freshsales','servicenow','exec','toLowerCase','data2','Configurations','data3','queue','routeId'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6150,0x1df));var _0x0615=function(_0x263211,_0x52e7c3){_0x263211=_0x263211-0x0;var _0x56239c=_0x6150[_0x263211];return _0x56239c;};'use strict';var _=require(_0x0615('0x0'));var util=require(_0x0615('0x1'));var zendesk=require(_0x0615('0x2'));var salesforce=require(_0x0615('0x3'));var sugarcrm=require(_0x0615('0x4'));var freshdesk=require('./freshdesk');var zoho=require(_0x0615('0x5'));var desk=require(_0x0615('0x6'));var vtiger=require(_0x0615('0x7'));var servicenow=require(_0x0615('0x8'));var dynamics365=require('./dynamics365');var freshsales=require('./freshsales');var integrations=[_0x0615('0x9'),_0x0615('0xa'),_0x0615('0xb'),_0x0615('0xc'),'zoho',_0x0615('0xd'),_0x0615('0xe'),_0x0615('0xf'),_0x0615('0x10'),_0x0615('0x11')];exports[_0x0615('0x12')]=function(_0x55f88f,_0x412e17,_0x4eae60,_0x1b6d15,_0x4a3844,_0x6e03bb){if(_0x4eae60){if(_['includes'](integrations,_0x55f88f['data1'][_0x0615('0x13')]())){try{var _0xf7848=null;var _0x4ac88f='';var _0x286f16=_0x4eae60[_0x55f88f['data1']['toLowerCase']()];if(_0x286f16){var _0x12f063=_0x286f16[_0x55f88f[_0x0615('0x14')]];if(_0x12f063){var _0x3f8fa6=_['find'](_0x12f063[_0x0615('0x15')],{'id':parseInt(_0x55f88f[_0x0615('0x16')],0xa)});if(_0x3f8fa6){if(_0x1b6d15){if(_0x4a3844&&_0x412e17[_0x0615('0x17')]){_0x4ac88f=_0x0615('0x17');}else if(_0x412e17[_0x0615('0x18')]){_0x4ac88f=_0x0615('0x19');}else{console[_0x0615('0x1a')](_0x0615('0x1b'),_0x412e17);}}else{_0x4ac88f=_0x0615('0x1c');}switch(_0x55f88f[_0x0615('0x1d')]['toLowerCase']()){case _0x0615('0x9'):zendesk[_0x4ac88f](_0x55f88f,_0x412e17,_0x3f8fa6,_0x1b6d15,_0x4a3844,_0x12f063,_0x6e03bb);break;case _0x0615('0xa'):salesforce[_0x4ac88f](_0x55f88f,_0x412e17,_0x3f8fa6,_0x1b6d15,_0x4a3844,_0x12f063,_0x6e03bb);break;case'sugarcrm':sugarcrm[_0x4ac88f](_0x55f88f,_0x412e17,_0x3f8fa6,_0x1b6d15,_0x4a3844,_0x12f063,_0x6e03bb);break;case _0x0615('0xc'):freshdesk[_0x4ac88f](_0x55f88f,_0x412e17,_0x3f8fa6,_0x1b6d15,_0x4a3844,_0x12f063,_0x6e03bb);break;case _0x0615('0x1e'):zoho[_0x4ac88f](_0x55f88f,_0x412e17,_0x3f8fa6,_0x1b6d15,_0x4a3844,_0x12f063,_0x6e03bb);break;case'desk':desk[_0x4ac88f](_0x55f88f,_0x412e17,_0x3f8fa6,_0x1b6d15,_0x4a3844,_0x12f063,_0x6e03bb);break;case _0x0615('0xe'):vtiger[_0x4ac88f](_0x55f88f,_0x412e17,_0x3f8fa6,_0x1b6d15,_0x4a3844,_0x12f063,_0x6e03bb);break;case'freshsales':freshsales['cs'](_0x55f88f,_0x412e17,_0x3f8fa6,_0x1b6d15,_0x4a3844,_0x12f063,_0x6e03bb,_0x4ac88f);break;case'servicenow':servicenow['cs'](_0x55f88f,_0x412e17,_0x3f8fa6,_0x1b6d15,_0x4a3844,_0x12f063,_0x6e03bb,_0x4ac88f);break;case _0x0615('0xf'):dynamics365['cs'](_0x55f88f,_0x412e17,_0x3f8fa6,_0x1b6d15,_0x4a3844,_0x12f063,_0x6e03bb,_0x4ac88f);break;default:console[_0x0615('0x1a')]('unknown\x20integration');}}else{_0xf7848=require(_0x0615('0x1f'))(_0x55f88f['data1'][_0x0615('0x13')]());_0xf7848['error'](_0x0615('0x20'),util['format'](_0x0615('0x21'),_0x55f88f[_0x0615('0x1d')]['toLowerCase'](),_0x55f88f[_0x0615('0x16')]));}}else{_0xf7848=require('../../../../config/logger')(_0x55f88f['data1'][_0x0615('0x13')]());_0xf7848['error'](_0x0615('0x20'),util[_0x0615('0x22')](_0x0615('0x23'),_0x55f88f[_0x0615('0x1d')][_0x0615('0x13')](),_0x55f88f[_0x0615('0x14')]));}}else{}}catch(_0x4a1bec){console['error'](_0x4a1bec);}}}}; \ 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 12aa430..0e9e1bc 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 _0x6406=['ticketType','ActivityDate','utc','IsReminderSet','IsRecurrence','endUserType','lead','WhoId','account','Case','ContactId','AccountId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','isNil','validateEmail','User','find','then','length','Email','Agent\x20%s\x20found.','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','user_id','display_name','identity','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','execute','additionalSearchLead','Lead','additionalSearchAccount','$or','Account','Contact','contact','first','Phone','attributes','type','toLowerCase','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','format','Caller\x20-\x20%s','Company','No\x20Company','upperFirst','create','forEach','includes','string','picklist','idField','content','toString','variable','variableName','Variable','name','password','concat','securityToken','remoteUri','https://login.salesforce.com','login','username','serverUrl','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','uniqueid','recordingURL','email','calleridname','calleridnum','queue','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','newTab','%s/%s/e','instanceUrl','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','error','[QUEUE]','recordingFormat','none','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','Fields','outbound','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','trigger:browser:url','[OUTBOUND]','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','lastevent','toUpperCase',']\x20Integration\x20account\x20type\x20%s.','request-promise','moment','md5','jsforce','util','ioredis','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','emit','assign','Subjects','getString','Descriptions'];(function(_0x19e45c,_0x35a205){var _0x5c2f09=function(_0x379aa0){while(--_0x379aa0){_0x19e45c['push'](_0x19e45c['shift']());}};_0x5c2f09(++_0x35a205);}(_0x6406,0xf2));var _0x6640=function(_0x5d2f39,_0x11e2f4){_0x5d2f39=_0x5d2f39-0x0;var _0x3df8f6=_0x6406[_0x5d2f39];return _0x3df8f6;};'use strict';var _=require('lodash');var rp=require(_0x6640('0x0'));var moment=require(_0x6640('0x1'));var BPromise=require('bluebird');var md5=require(_0x6640('0x2'));var jsforce=require(_0x6640('0x3'));var util=require(_0x6640('0x4'));var Redis=require(_0x6640('0x5'));var intUtil=require('./util');var config=require(_0x6640('0x6'));var logger=require(_0x6640('0x7'))('salesforce');config[_0x6640('0x8')]=_[_0x6640('0x9')](config['redis'],{'host':_0x6640('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x6640('0x8')]));function emit(_0x2e45bd,_0x5629ab,_0x589b09){io['to'](_0x2e45bd)[_0x6640('0xb')](_0x5629ab,_0x589b09);}function getTicket(_0x498f42,_0x59c6bf,_0x2d8b59,_0x5a50d7,_0xabbd94,_0x3dc209,_0xdb0db8,_0x166134){var _0x2bbd22=Object[_0x6640('0xc')]({},{'OwnerId':_0x59c6bf['id'],'Subject':intUtil['getString'](_0x5a50d7[_0x6640('0xd')],_0xabbd94,'\x20'),'Description':intUtil[_0x6640('0xe')](_0x5a50d7[_0x6640('0xf')],_0xabbd94,'\x0a')},getCustomFields(_0x3dc209,_0xabbd94));if(_0x2d8b59){if(_0x5a50d7[_0x6640('0x10')]==='Task'){_0x2bbd22[_0x6640('0x11')]=moment[_0x6640('0x12')]();_0x2bbd22[_0x6640('0x13')]=![];_0x2bbd22[_0x6640('0x14')]=![];if(_0x2d8b59[_0x6640('0x15')]==='contact'||_0x2d8b59[_0x6640('0x15')]===_0x6640('0x16')){_0x2bbd22[_0x6640('0x17')]=_0x2d8b59['id'];}else if(_0x2d8b59[_0x6640('0x15')]===_0x6640('0x18')){_0x2bbd22['WhatId']=_0x2d8b59['id'];}}else if(_0x5a50d7[_0x6640('0x10')]===_0x6640('0x19')){if(_0x2d8b59[_0x6640('0x15')]==='contact'){_0x2bbd22[_0x6640('0x1a')]=_0x2d8b59['id'];}else if(_0x2d8b59[_0x6640('0x15')]==='account'){_0x2bbd22[_0x6640('0x1b')]=_0x2d8b59['id'];}else if(_0x2d8b59[_0x6640('0x15')]==='lead'&&_0x5a50d7['leadId']){_0x2bbd22[_0x5a50d7['leadId']]=_0x2d8b59['id'];}else{logger[_0x6640('0x1c')](_0x6640('0x1d'));}}}return _0xdb0db8[_0x6640('0x1e')](_0x5a50d7[_0x6640('0x10')])['create'](_0x2bbd22);}function getUser(_0x46f96b,_0x1bf214,_0x2640f9){if(!_[_0x6640('0x1f')](_0x1bf214)&&intUtil[_0x6640('0x20')](_0x1bf214)){var _0x3d4e75={'Email':_0x1bf214};var _0x1452f0={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x2640f9[_0x6640('0x1e')](_0x6640('0x21'))[_0x6640('0x22')](_0x3d4e75,_0x1452f0)['execute']()[_0x6640('0x23')](function(_0x1f1c82){if(_0x1f1c82[_0x6640('0x24')]){var _0x50ece3=_[_0x6640('0x22')](_0x1f1c82,function(_0x34262c){return _0x34262c[_0x6640('0x25')]===_0x1bf214;});if(_0x50ece3){logger[_0x6640('0x1c')](_0x6640('0x26'),_0x1bf214);return BPromise[_0x6640('0x27')]({'id':_0x50ece3['Id'],'name':_0x50ece3[_0x6640('0x28')]});}}else{logger[_0x6640('0x1c')](_0x6640('0x29'),_0x1bf214);return _0x2640f9['identity']()[_0x6640('0x23')](function(_0x42bbb4){return BPromise['resolve']({'id':_0x42bbb4[_0x6640('0x2a')],'name':_0x42bbb4[_0x6640('0x2b')]});});}});}else{logger[_0x6640('0x1c')](_0x6640('0x29'),_0x1bf214);return _0x2640f9[_0x6640('0x2c')]()['then'](function(_0x286a90){return BPromise[_0x6640('0x27')]({'id':_0x286a90[_0x6640('0x2a')],'name':_0x286a90['display_name']});});}}function getEndUser(_0x3506d3,_0x57980f,_0xe6b53c,_0x4c2fe4,_0xf1bfe1){var _0x10d6d1={'$or':{'Phone':_0x4c2fe4}};var _0x1b7e76={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x6640('0x27')]()[_0x6640('0x23')](function(){logger[_0x6640('0x1c')](_0x6640('0x2d'),_0x4c2fe4,_0x57980f[_0x6640('0x2e')]);switch(_0x57980f[_0x6640('0x2e')]){case _0x6640('0x2f'):var _0x4941b2=_[_0x6640('0x30')](_0x10d6d1);if(_0x57980f[_0x6640('0x31')]){var _0x249b90={};_0x249b90[_0x57980f[_0x6640('0x31')]]=_0x4c2fe4;_[_0x6640('0x32')](_0x4941b2['$or'],_0x249b90);}return _0xf1bfe1[_0x6640('0x1e')]('Contact')[_0x6640('0x22')](_0x4941b2,_0x1b7e76)[_0x6640('0x33')]()[_0x6640('0x23')](function(_0x1f599a){if(_0x1f599a&&_0x1f599a[_0x6640('0x24')]){return _0x1f599a;}else{var _0x5a5b0c=_[_0x6640('0x30')](_0x10d6d1);if(_0x57980f['additionalSearchLead']){var _0x495e10={};_0x495e10[_0x57980f[_0x6640('0x34')]]=_0x4c2fe4;_[_0x6640('0x32')](_0x5a5b0c['$or'],_0x495e10);}return _0xf1bfe1['sobject'](_0x6640('0x35'))[_0x6640('0x22')](_0x5a5b0c,_0x1b7e76);}});case'account_contact_lead':var _0x443ea4=_[_0x6640('0x30')](_0x10d6d1);if(_0x57980f[_0x6640('0x36')]){var _0x249b90={};_0x249b90[_0x57980f['additionalSearchAccount']]=_0x4c2fe4;_[_0x6640('0x32')](_0x443ea4[_0x6640('0x37')],_0x249b90);}return _0xf1bfe1[_0x6640('0x1e')](_0x6640('0x38'))[_0x6640('0x22')](_0x443ea4,_0x1b7e76)[_0x6640('0x33')]()['then'](function(_0x3757b8){if(_0x3757b8&&_0x3757b8['length']){return _0x3757b8;}else{var _0x2bbc79=_['cloneDeep'](_0x10d6d1);if(_0x57980f[_0x6640('0x31')]){var _0x185082={};_0x185082[_0x57980f[_0x6640('0x31')]]=_0x4c2fe4;_[_0x6640('0x32')](_0x2bbc79['$or'],_0x185082);}return _0xf1bfe1['sobject'](_0x6640('0x39'))[_0x6640('0x22')](_0x2bbc79,_0x1b7e76)[_0x6640('0x23')](function(_0x4ae320){if(_0x4ae320&&_0x4ae320[_0x6640('0x24')]){return _0x4ae320;}else{var _0x2734cb=_['cloneDeep'](_0x10d6d1);if(_0x57980f['additionalSearchLead']){var _0x44139b={};_0x44139b[_0x57980f[_0x6640('0x34')]]=_0x4c2fe4;_[_0x6640('0x32')](_0x2734cb[_0x6640('0x37')],_0x44139b);}return _0xf1bfe1['sobject'](_0x6640('0x35'))['find'](_0x2734cb,_0x1b7e76);}});}});case _0x6640('0x3a'):var _0x4941b2=_[_0x6640('0x30')](_0x10d6d1);if(_0x57980f[_0x6640('0x31')]){var _0x249b90={};_0x249b90[_0x57980f[_0x6640('0x31')]]=_0x4c2fe4;_[_0x6640('0x32')](_0x4941b2[_0x6640('0x37')],_0x249b90);}return _0xf1bfe1['sobject'](_0x6640('0x39'))[_0x6640('0x22')](_0x4941b2,_0x1b7e76)[_0x6640('0x33')]();case _0x6640('0x16'):var _0x214bae=_[_0x6640('0x30')](_0x10d6d1);if(_0x57980f[_0x6640('0x34')]){var _0x249b90={};_0x249b90[_0x57980f['additionalSearchLead']]=_0x4c2fe4;_[_0x6640('0x32')](_0x214bae[_0x6640('0x37')],_0x249b90);}return _0xf1bfe1[_0x6640('0x1e')](_0x6640('0x35'))[_0x6640('0x22')](_0x214bae,_0x1b7e76);case'account':var _0x443ea4=_[_0x6640('0x30')](_0x10d6d1);if(_0x57980f[_0x6640('0x36')]){var _0x249b90={};_0x249b90[_0x57980f['additionalSearchAccount']]=_0x4c2fe4;_['merge'](_0x443ea4[_0x6640('0x37')],_0x249b90);}return _0xf1bfe1['sobject']('Account')[_0x6640('0x22')](_0x443ea4,_0x1b7e76);default:return null;}})[_0x6640('0x23')](function(_0x19dbfa){if(_0x19dbfa&&_0x19dbfa[_0x6640('0x24')]){var _0x17980a=_[_0x6640('0x3b')](_0x19dbfa);if(_0x17980a){return BPromise[_0x6640('0x27')]({'id':_0x17980a['Id'],'name':_0x17980a[_0x6640('0x28')],'phone':_0x17980a[_0x6640('0x3c')],'endUserType':_0x17980a[_0x6640('0x3d')][_0x6640('0x3e')][_0x6640('0x3f')]()});}}})[_0x6640('0x23')](function(_0x247a16){if(_0x247a16){logger['info']('Enduser\x20(%s)\x20with\x20phone\x20%s\x20found',_0x247a16[_0x6640('0x15')],_0x4c2fe4);return BPromise[_0x6640('0x27')](_0x247a16);}else{logger[_0x6640('0x1c')]('Enduser\x20with\x20phone\x20%s\x20not\x20found',_0x4c2fe4);var _0x5bcbf5={'Phone':_0x4c2fe4};if(_0x57980f[_0x6640('0x40')]){if(_0x57980f[_0x6640('0x40')]==='contact'){logger[_0x6640('0x1c')](_0x6640('0x41'),_0x4c2fe4,_0x57980f[_0x6640('0x40')]);_0x5bcbf5[_0x6640('0x42')]=_0xe6b53c!==_0x6640('0x43')?_0xe6b53c:util[_0x6640('0x44')]('Caller\x20-\x20%s',_0x4c2fe4);}else if(_0x57980f[_0x6640('0x40')]===_0x6640('0x16')){logger[_0x6640('0x1c')](_0x6640('0x41'),_0x4c2fe4,_0x57980f['moduleCreate']);_0x5bcbf5[_0x6640('0x42')]=_0xe6b53c!==_0x6640('0x43')?_0xe6b53c:util[_0x6640('0x44')](_0x6640('0x45'),_0x4c2fe4);_0x5bcbf5[_0x6640('0x46')]=_0x6640('0x47');}else if(_0x57980f['moduleCreate']===_0x6640('0x18')){logger['info'](_0x6640('0x41'),_0x4c2fe4,_0x57980f[_0x6640('0x40')]);_0x5bcbf5[_0x6640('0x28')]=_0xe6b53c!==''?_0xe6b53c:util['format'](_0x6640('0x45'),_0x4c2fe4);}else{return null;}}return _0xf1bfe1[_0x6640('0x1e')](_[_0x6640('0x48')](_0x57980f['moduleCreate']))[_0x6640('0x49')](_0x5bcbf5)[_0x6640('0x23')](function(_0x259e4c){return BPromise[_0x6640('0x27')]({'id':_0x259e4c['id'],'endUserType':_0x57980f[_0x6640('0x40')]});});}});}function getCustomFields(_0x5bb8a3,_0x49cb6f){var _0x1dcfe5={};if(_0x5bb8a3[_0x6640('0x24')]>0x0){_[_0x6640('0x4a')](_0x5bb8a3,function(_0x4c9bc0){if(_[_0x6640('0x4b')]([_0x6640('0x4c'),_0x6640('0x4d')],_0x4c9bc0['type'])&&_0x4c9bc0[_0x6640('0x4e')]){_0x1dcfe5[_0x4c9bc0[_0x6640('0x4e')]]=_0x4c9bc0[_0x6640('0x4f')][_0x6640('0x50')]();}else if(_0x4c9bc0[_0x6640('0x3e')]===_0x6640('0x51')&&_0x4c9bc0[_0x6640('0x52')]&&_0x4c9bc0[_0x6640('0x4e')]){_0x49cb6f[_0x4c9bc0[_0x6640('0x52')]]&&(_0x1dcfe5[_0x4c9bc0[_0x6640('0x4e')]]=_0x49cb6f[_0x4c9bc0[_0x6640('0x52')]][_0x6640('0x50')]());}else if(_0x4c9bc0['type']==='customVariable'&&_0x4c9bc0[_0x6640('0x53')]&&_0x4c9bc0[_0x6640('0x53')][_0x6640('0x54')]&&_0x4c9bc0[_0x6640('0x4e')]){_0x49cb6f[_0x4c9bc0[_0x6640('0x53')][_0x6640('0x54')][_0x6640('0x3f')]()]&&(_0x1dcfe5[_0x4c9bc0[_0x6640('0x4e')]]=_0x49cb6f[_0x4c9bc0[_0x6640('0x53')]['name']['toLowerCase']()][_0x6640('0x50')]());}});}return _0x1dcfe5;}function getConnection(_0x2e873a){var _0x54d500=_0x2e873a[_0x6640('0x55')][_0x6640('0x56')](_0x2e873a[_0x6640('0x57')]);var _0x4a1096=new jsforce['Connection']({'oauth2':{'loginUrl':_0x2e873a[_0x6640('0x58')]||_0x6640('0x59'),'clientId':_0x2e873a['clientId'],'clientSecret':_0x2e873a['clientSecret']}});return _0x4a1096[_0x6640('0x5a')](_0x2e873a[_0x6640('0x5b')],_0x54d500)[_0x6640('0x23')](function(){logger['info']('Connection\x20established.');return _0x4a1096;});}exports['queue']=function(_0x2a2126,_0x50bf6b,_0x419afd,_0x447993,_0x57513b,_0x3d24fd){var _0x4bd4b3,_0x5c7d1e,_0x3814db,_0x530c21;_0x3d24fd[_0x6640('0x5c')]=intUtil[_0x6640('0x5d')](_0x3d24fd[_0x6640('0x5c')]);_0x3d24fd[_0x6640('0x58')]=intUtil[_0x6640('0x5d')](_0x3d24fd[_0x6640('0x58')]);if(_0x57513b&&_0x57513b[_0x6640('0x5e')]){logger[_0x6640('0x1c')]('[QUEUE]',_0x6640('0x5f'));_0x50bf6b['recordingURL']=util[_0x6640('0x44')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3d24fd['serverUrl'],_0x50bf6b[_0x6640('0x60')],md5(_0x50bf6b[_0x6640('0x60')]));}else{_0x50bf6b[_0x6640('0x61')]='';}return getConnection(_0x3d24fd)['then'](function(_0x595f76){_0x530c21=_0x595f76;return getUser(_0x3d24fd,_0x447993[_0x6640('0x62')],_0x530c21);})[_0x6640('0x23')](function(_0x39497d){_0x4bd4b3=_0x39497d;return getEndUser(_0x3d24fd,_0x419afd,_0x50bf6b[_0x6640('0x63')],_0x50bf6b[_0x6640('0x64')],_0x530c21);})[_0x6640('0x23')](function(_0x5e4cee){_0x5c7d1e=_0x5e4cee;return getTicket(_0x3d24fd,_0x4bd4b3,_0x5c7d1e,_0x419afd,_0x50bf6b,_0x419afd['Fields'],_0x530c21,_0x6640('0x65'));})['then'](function(_0x389dc7){_0x3814db=_0x389dc7;logger[_0x6640('0x1c')](_0x6640('0x66'),_0x3814db['id']);logger[_0x6640('0x1c')](_0x6640('0x67'),_0x3814db['id'],_0x447993[_0x6640('0x54')],_0x3d24fd[_0x6640('0x3e')]);switch(_0x3d24fd[_0x6640('0x3e')]){case _0x6640('0x68'):emit(util[_0x6640('0x44')](_0x6640('0x69'),_0x447993[_0x6640('0x54')]),_0x6640('0x6a'),{'recordId':_0x3814db['id']});break;case _0x6640('0x6b'):emit(util[_0x6640('0x44')](_0x6640('0x69'),_0x447993[_0x6640('0x54')]),'trigger:browser:url',{'uri':util['format'](_0x6640('0x6c'),_0x530c21[_0x6640('0x6d')],_0x3814db['id'])});break;default:logger['error'](_0x6640('0x6e'));}})[_0x6640('0x6f')](function(_0x130044){logger[_0x6640('0x70')](_0x6640('0x71'),_0x130044);});};exports['outbound']=function(_0x1e9938,_0x3d6dc7,_0x5a50e9,_0x4da46e,_0x55e7ab,_0x2aba83,_0x2a5a21){var _0x5cbfc7,_0x1db535,_0xe48393,_0x57c54a;_0x2aba83[_0x6640('0x5c')]=intUtil[_0x6640('0x5d')](_0x2aba83[_0x6640('0x5c')]);_0x2aba83[_0x6640('0x58')]=intUtil[_0x6640('0x5d')](_0x2aba83[_0x6640('0x58')]);if(_0x2a5a21&&_0x2a5a21[_0x6640('0x72')]&&_0x2a5a21[_0x6640('0x72')]!==_0x6640('0x73')){logger[_0x6640('0x1c')]('[OUTBOUND]',_0x6640('0x5f'));_0x3d6dc7[_0x6640('0x61')]=util['format'](_0x6640('0x74'),_0x2aba83[_0x6640('0x5c')],_0x3d6dc7[_0x6640('0x60')],md5(_0x3d6dc7[_0x6640('0x60')]));}return getConnection(_0x2aba83)[_0x6640('0x23')](function(_0x18db3e){_0x57c54a=_0x18db3e;return getUser(_0x2aba83,_0x4da46e[_0x6640('0x62')],_0x57c54a);})[_0x6640('0x23')](function(_0x274158){_0x5cbfc7=_0x274158;return getEndUser(_0x2aba83,_0x5a50e9,_0x3d6dc7[_0x6640('0x75')],_0x3d6dc7[_0x6640('0x76')],_0x57c54a);})[_0x6640('0x23')](function(_0x4da221){_0x1db535=_0x4da221;return getTicket(_0x2aba83,_0x5cbfc7,_0x1db535,_0x5a50e9,_0x3d6dc7,_0x5a50e9[_0x6640('0x77')],_0x57c54a,_0x6640('0x78'));})[_0x6640('0x23')](function(_0x57d360){_0xe48393=_0x57d360;logger[_0x6640('0x1c')]('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0xe48393['id']);logger[_0x6640('0x1c')](_0x6640('0x79'),_0xe48393['id'],_0x4da46e[_0x6640('0x54')],_0x2aba83[_0x6640('0x3e')]);switch(_0x2aba83[_0x6640('0x3e')]){case _0x6640('0x68'):emit(util[_0x6640('0x44')](_0x6640('0x69'),_0x4da46e[_0x6640('0x54')]),_0x6640('0x6a'),{'recordId':_0xe48393['id']});break;case _0x6640('0x6b'):emit(util[_0x6640('0x44')](_0x6640('0x69'),_0x4da46e[_0x6640('0x54')]),_0x6640('0x7a'),{'uri':util[_0x6640('0x44')](_0x6640('0x6c'),_0x57c54a[_0x6640('0x6d')],_0xe48393['id'])});break;default:logger['error'](_0x6640('0x7b'),_0x6640('0x7c'));}})['catch'](function(_0x362e9c){logger[_0x6640('0x70')]('[OUTBOUND]',_0x362e9c);});};exports[_0x6640('0x7d')]=function(_0x5e1627,_0x4f2a03,_0x2160af,_0x5f5636,_0x1e3249,_0x26df9a){var _0x28df23,_0x58471b,_0x1e1709,_0x916f2c;_0x26df9a[_0x6640('0x5c')]=intUtil[_0x6640('0x5d')](_0x26df9a['serverUrl']);_0x26df9a[_0x6640('0x58')]=intUtil['stripTrailingSlash'](_0x26df9a['remoteUri']);if(_0x1e3249&&_0x1e3249[_0x6640('0x5e')]){logger[_0x6640('0x1c')]('['+_0x4f2a03[_0x6640('0x7e')]['toUpperCase']()+']',_0x6640('0x5f'));_0x4f2a03[_0x6640('0x61')]=util[_0x6640('0x44')](_0x6640('0x74'),_0x26df9a[_0x6640('0x5c')],_0x4f2a03['uniqueid'],md5(_0x4f2a03[_0x6640('0x60')]));}else{_0x4f2a03['recordingURL']='';}return getConnection(_0x26df9a)[_0x6640('0x23')](function(_0x591f2c){_0x916f2c=_0x591f2c;if(!_[_0x6640('0x1f')](_0x5f5636)){return getUser(_0x26df9a,_0x5f5636['name'],_0x916f2c);}else{return getUser(_0x26df9a,null,_0x916f2c);}})['then'](function(_0x2ad6e3){_0x28df23=_0x2ad6e3;return getEndUser(_0x26df9a,_0x2160af,_0x4f2a03[_0x6640('0x63')],_0x4f2a03['calleridnum'],_0x916f2c);})[_0x6640('0x23')](function(_0x5008f5){_0x58471b=_0x5008f5;return getTicket(_0x26df9a,_0x28df23,_0x58471b,_0x2160af,_0x4f2a03,_0x2160af['Fields'],_0x916f2c);})['then'](function(_0x2805e){_0x1e1709=_0x2805e;logger[_0x6640('0x1c')]('['+_0x4f2a03[_0x6640('0x7e')][_0x6640('0x7f')]()+']\x20Ticket\x20%s\x20created.',_0x1e1709['id']);logger[_0x6640('0x1c')]('['+_0x4f2a03[_0x6640('0x7e')][_0x6640('0x7f')]()+_0x6640('0x80'),_0x26df9a[_0x6640('0x3e')]);})[_0x6640('0x6f')](function(_0x309a58){logger['error']('['+_0x4f2a03['lastevent']['toUpperCase']()+']',_0x309a58);});}; \ No newline at end of file +var _0xacbb=['toUpperCase','lodash','request-promise','bluebird','jsforce','util','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','localhost','socket.io-emitter','emit','getString','Descriptions','Task','ActivityDate','utc','IsReminderSet','IsRecurrence','endUserType','lead','WhoId','account','ticketType','contact','ContactId','leadId','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','validateEmail','User','then','find','Email','info','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','Contact','length','additionalSearchLead','merge','$or','account_contact_lead','additionalSearchAccount','Account','Lead','execute','first','Phone','attributes','type','toLowerCase','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','','Caller\x20-\x20%s','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','format','Company','No\x20Company','upperFirst','forEach','string','picklist','idField','content','toString','variable','variableName','Variable','name','concat','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','clientSecret','username','Connection\x20established.','serverUrl','stripTrailingSlash','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridnum','Fields','queue','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','newTab','%s/%s/e','error','catch','outbound','recordingFormat','none','[OUTBOUND]','email','destcalleridname','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','trigger:browser:url','instanceUrl','unmanaged','monitor_format','lastevent'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0xacbb,0x17e));var _0xbacb=function(_0x459b17,_0x1109a5){_0x459b17=_0x459b17-0x0;var _0x1cac77=_0xacbb[_0x459b17];return _0x1cac77;};'use strict';var _=require(_0xbacb('0x0'));var rp=require(_0xbacb('0x1'));var moment=require('moment');var BPromise=require(_0xbacb('0x2'));var md5=require('md5');var jsforce=require(_0xbacb('0x3'));var util=require(_0xbacb('0x4'));var Redis=require(_0xbacb('0x5'));var intUtil=require(_0xbacb('0x6'));var config=require(_0xbacb('0x7'));var logger=require(_0xbacb('0x8'))(_0xbacb('0x9'));config[_0xbacb('0xa')]=_[_0xbacb('0xb')](config[_0xbacb('0xa')],{'host':_0xbacb('0xc'),'port':0x18eb});var io=require(_0xbacb('0xd'))(new Redis(config[_0xbacb('0xa')]));function emit(_0x4ee2f3,_0x336db8,_0xcd9147){io['to'](_0x4ee2f3)[_0xbacb('0xe')](_0x336db8,_0xcd9147);}function getTicket(_0x597db4,_0x1d560d,_0x4ef6cc,_0x3f6f90,_0xfb970b,_0xad30ce,_0x4e68e9,_0xeac0d6){var _0x895103=Object['assign']({},{'OwnerId':_0x1d560d['id'],'Subject':intUtil['getString'](_0x3f6f90['Subjects'],_0xfb970b,'\x20'),'Description':intUtil[_0xbacb('0xf')](_0x3f6f90[_0xbacb('0x10')],_0xfb970b,'\x0a')},getCustomFields(_0xad30ce,_0xfb970b));if(_0x4ef6cc){if(_0x3f6f90['ticketType']===_0xbacb('0x11')){_0x895103[_0xbacb('0x12')]=moment[_0xbacb('0x13')]();_0x895103[_0xbacb('0x14')]=![];_0x895103[_0xbacb('0x15')]=![];if(_0x4ef6cc['endUserType']==='contact'||_0x4ef6cc[_0xbacb('0x16')]===_0xbacb('0x17')){_0x895103[_0xbacb('0x18')]=_0x4ef6cc['id'];}else if(_0x4ef6cc['endUserType']===_0xbacb('0x19')){_0x895103['WhatId']=_0x4ef6cc['id'];}}else if(_0x3f6f90[_0xbacb('0x1a')]==='Case'){if(_0x4ef6cc[_0xbacb('0x16')]===_0xbacb('0x1b')){_0x895103[_0xbacb('0x1c')]=_0x4ef6cc['id'];}else if(_0x4ef6cc[_0xbacb('0x16')]===_0xbacb('0x19')){_0x895103['AccountId']=_0x4ef6cc['id'];}else if(_0x4ef6cc[_0xbacb('0x16')]===_0xbacb('0x17')&&_0x3f6f90[_0xbacb('0x1d')]){_0x895103[_0x3f6f90[_0xbacb('0x1d')]]=_0x4ef6cc['id'];}else{logger['info'](_0xbacb('0x1e'));}}}return _0x4e68e9[_0xbacb('0x1f')](_0x3f6f90['ticketType'])[_0xbacb('0x20')](_0x895103);}function getUser(_0x48914e,_0x232e91,_0x2ff636){if(!_[_0xbacb('0x21')](_0x232e91)&&intUtil[_0xbacb('0x22')](_0x232e91)){var _0x3d8b15={'Email':_0x232e91};var _0x4bb7d5={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x2ff636[_0xbacb('0x1f')](_0xbacb('0x23'))['find'](_0x3d8b15,_0x4bb7d5)['execute']()[_0xbacb('0x24')](function(_0x351288){if(_0x351288['length']){var _0x408500=_[_0xbacb('0x25')](_0x351288,function(_0x1aba42){return _0x1aba42[_0xbacb('0x26')]===_0x232e91;});if(_0x408500){logger[_0xbacb('0x27')](_0xbacb('0x28'),_0x232e91);return BPromise[_0xbacb('0x29')]({'id':_0x408500['Id'],'name':_0x408500[_0xbacb('0x2a')]});}}else{logger['info'](_0xbacb('0x2b'),_0x232e91);return _0x2ff636[_0xbacb('0x2c')]()['then'](function(_0x11b47d){return BPromise['resolve']({'id':_0x11b47d[_0xbacb('0x2d')],'name':_0x11b47d['display_name']});});}});}else{logger[_0xbacb('0x27')](_0xbacb('0x2b'),_0x232e91);return _0x2ff636[_0xbacb('0x2c')]()[_0xbacb('0x24')](function(_0x3a8907){return BPromise[_0xbacb('0x29')]({'id':_0x3a8907[_0xbacb('0x2d')],'name':_0x3a8907[_0xbacb('0x2e')]});});}}function getEndUser(_0x175a78,_0xd5e476,_0x3b3a5d,_0x479399,_0x411bd9){var _0x26ce7d={'$or':{'Phone':_0x479399}};var _0x576f20={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()[_0xbacb('0x24')](function(){logger['info']('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x479399,_0xd5e476[_0xbacb('0x2f')]);switch(_0xd5e476[_0xbacb('0x2f')]){case _0xbacb('0x30'):var _0x40b2f4=_[_0xbacb('0x31')](_0x26ce7d);if(_0xd5e476[_0xbacb('0x32')]){var _0xca98cb={};_0xca98cb[_0xd5e476[_0xbacb('0x32')]]=_0x479399;_['merge'](_0x40b2f4['$or'],_0xca98cb);}return _0x411bd9[_0xbacb('0x1f')](_0xbacb('0x33'))[_0xbacb('0x25')](_0x40b2f4,_0x576f20)['execute']()[_0xbacb('0x24')](function(_0x2ab42e){if(_0x2ab42e&&_0x2ab42e[_0xbacb('0x34')]){return _0x2ab42e;}else{var _0xdd082b=_[_0xbacb('0x31')](_0x26ce7d);if(_0xd5e476[_0xbacb('0x35')]){var _0x8a3ef7={};_0x8a3ef7[_0xd5e476['additionalSearchLead']]=_0x479399;_[_0xbacb('0x36')](_0xdd082b[_0xbacb('0x37')],_0x8a3ef7);}return _0x411bd9[_0xbacb('0x1f')]('Lead')[_0xbacb('0x25')](_0xdd082b,_0x576f20);}});case _0xbacb('0x38'):var _0x556090=_[_0xbacb('0x31')](_0x26ce7d);if(_0xd5e476[_0xbacb('0x39')]){var _0xca98cb={};_0xca98cb[_0xd5e476[_0xbacb('0x39')]]=_0x479399;_[_0xbacb('0x36')](_0x556090[_0xbacb('0x37')],_0xca98cb);}return _0x411bd9[_0xbacb('0x1f')](_0xbacb('0x3a'))['find'](_0x556090,_0x576f20)['execute']()[_0xbacb('0x24')](function(_0x24b002){if(_0x24b002&&_0x24b002[_0xbacb('0x34')]){return _0x24b002;}else{var _0xb2aac9=_[_0xbacb('0x31')](_0x26ce7d);if(_0xd5e476[_0xbacb('0x32')]){var _0x4e79ba={};_0x4e79ba[_0xd5e476[_0xbacb('0x32')]]=_0x479399;_[_0xbacb('0x36')](_0xb2aac9[_0xbacb('0x37')],_0x4e79ba);}return _0x411bd9[_0xbacb('0x1f')](_0xbacb('0x33'))['find'](_0xb2aac9,_0x576f20)[_0xbacb('0x24')](function(_0xc92343){if(_0xc92343&&_0xc92343[_0xbacb('0x34')]){return _0xc92343;}else{var _0x2dd382=_[_0xbacb('0x31')](_0x26ce7d);if(_0xd5e476[_0xbacb('0x35')]){var _0x490628={};_0x490628[_0xd5e476['additionalSearchLead']]=_0x479399;_['merge'](_0x2dd382[_0xbacb('0x37')],_0x490628);}return _0x411bd9[_0xbacb('0x1f')](_0xbacb('0x3b'))[_0xbacb('0x25')](_0x2dd382,_0x576f20);}});}});case _0xbacb('0x1b'):var _0x40b2f4=_[_0xbacb('0x31')](_0x26ce7d);if(_0xd5e476[_0xbacb('0x32')]){var _0xca98cb={};_0xca98cb[_0xd5e476['additionalSearchContact']]=_0x479399;_[_0xbacb('0x36')](_0x40b2f4[_0xbacb('0x37')],_0xca98cb);}return _0x411bd9['sobject']('Contact')[_0xbacb('0x25')](_0x40b2f4,_0x576f20)[_0xbacb('0x3c')]();case'lead':var _0x1abdd4=_[_0xbacb('0x31')](_0x26ce7d);if(_0xd5e476[_0xbacb('0x35')]){var _0xca98cb={};_0xca98cb[_0xd5e476['additionalSearchLead']]=_0x479399;_[_0xbacb('0x36')](_0x1abdd4[_0xbacb('0x37')],_0xca98cb);}return _0x411bd9[_0xbacb('0x1f')](_0xbacb('0x3b'))[_0xbacb('0x25')](_0x1abdd4,_0x576f20);case _0xbacb('0x19'):var _0x556090=_[_0xbacb('0x31')](_0x26ce7d);if(_0xd5e476['additionalSearchAccount']){var _0xca98cb={};_0xca98cb[_0xd5e476[_0xbacb('0x39')]]=_0x479399;_[_0xbacb('0x36')](_0x556090[_0xbacb('0x37')],_0xca98cb);}return _0x411bd9[_0xbacb('0x1f')](_0xbacb('0x3a'))['find'](_0x556090,_0x576f20);default:return null;}})['then'](function(_0x1be7d4){if(_0x1be7d4&&_0x1be7d4[_0xbacb('0x34')]){var _0x48992e=_[_0xbacb('0x3d')](_0x1be7d4);if(_0x48992e){return BPromise[_0xbacb('0x29')]({'id':_0x48992e['Id'],'name':_0x48992e[_0xbacb('0x2a')],'phone':_0x48992e[_0xbacb('0x3e')],'endUserType':_0x48992e[_0xbacb('0x3f')][_0xbacb('0x40')][_0xbacb('0x41')]()});}}})[_0xbacb('0x24')](function(_0x1ae676){if(_0x1ae676){logger['info']('Enduser\x20(%s)\x20with\x20phone\x20%s\x20found',_0x1ae676['endUserType'],_0x479399);return BPromise['resolve'](_0x1ae676);}else{logger[_0xbacb('0x27')](_0xbacb('0x42'),_0x479399);var _0x5d63af={'Phone':_0x479399};if(_0xd5e476[_0xbacb('0x43')]){if(_0xd5e476['moduleCreate']===_0xbacb('0x1b')){logger[_0xbacb('0x27')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x479399,_0xd5e476[_0xbacb('0x43')]);_0x5d63af['LastName']=_0x3b3a5d!==_0xbacb('0x44')?_0x3b3a5d:util['format'](_0xbacb('0x45'),_0x479399);}else if(_0xd5e476['moduleCreate']==='lead'){logger['info'](_0xbacb('0x46'),_0x479399,_0xd5e476['moduleCreate']);_0x5d63af['LastName']=_0x3b3a5d!==''?_0x3b3a5d:util[_0xbacb('0x47')](_0xbacb('0x45'),_0x479399);_0x5d63af[_0xbacb('0x48')]=_0xbacb('0x49');}else if(_0xd5e476[_0xbacb('0x43')]===_0xbacb('0x19')){logger[_0xbacb('0x27')](_0xbacb('0x46'),_0x479399,_0xd5e476[_0xbacb('0x43')]);_0x5d63af[_0xbacb('0x2a')]=_0x3b3a5d!==_0xbacb('0x44')?_0x3b3a5d:util[_0xbacb('0x47')](_0xbacb('0x45'),_0x479399);}else{return null;}}return _0x411bd9[_0xbacb('0x1f')](_[_0xbacb('0x4a')](_0xd5e476['moduleCreate']))[_0xbacb('0x20')](_0x5d63af)[_0xbacb('0x24')](function(_0x12800a){return BPromise['resolve']({'id':_0x12800a['id'],'endUserType':_0xd5e476[_0xbacb('0x43')]});});}});}function getCustomFields(_0x3f58dd,_0x2f2229){var _0x51b5df={};if(_0x3f58dd[_0xbacb('0x34')]>0x0){_[_0xbacb('0x4b')](_0x3f58dd,function(_0x30d2d9){if(_['includes']([_0xbacb('0x4c'),_0xbacb('0x4d')],_0x30d2d9['type'])&&_0x30d2d9['idField']){_0x51b5df[_0x30d2d9[_0xbacb('0x4e')]]=_0x30d2d9[_0xbacb('0x4f')][_0xbacb('0x50')]();}else if(_0x30d2d9[_0xbacb('0x40')]===_0xbacb('0x51')&&_0x30d2d9[_0xbacb('0x52')]&&_0x30d2d9[_0xbacb('0x4e')]){_0x2f2229[_0x30d2d9[_0xbacb('0x52')]]&&(_0x51b5df[_0x30d2d9[_0xbacb('0x4e')]]=_0x2f2229[_0x30d2d9[_0xbacb('0x52')]][_0xbacb('0x50')]());}else if(_0x30d2d9[_0xbacb('0x40')]==='customVariable'&&_0x30d2d9[_0xbacb('0x53')]&&_0x30d2d9[_0xbacb('0x53')][_0xbacb('0x54')]&&_0x30d2d9[_0xbacb('0x4e')]){_0x2f2229[_0x30d2d9[_0xbacb('0x53')][_0xbacb('0x54')][_0xbacb('0x41')]()]&&(_0x51b5df[_0x30d2d9[_0xbacb('0x4e')]]=_0x2f2229[_0x30d2d9[_0xbacb('0x53')][_0xbacb('0x54')]['toLowerCase']()]['toString']());}});}return _0x51b5df;}function getConnection(_0x4989b6){var _0x13192d=_0x4989b6['password'][_0xbacb('0x55')](_0x4989b6[_0xbacb('0x56')]);var _0x567046=new jsforce[(_0xbacb('0x57'))]({'oauth2':{'loginUrl':_0x4989b6[_0xbacb('0x58')]||_0xbacb('0x59'),'clientId':_0x4989b6[_0xbacb('0x5a')],'clientSecret':_0x4989b6[_0xbacb('0x5b')]}});return _0x567046['login'](_0x4989b6[_0xbacb('0x5c')],_0x13192d)['then'](function(){logger[_0xbacb('0x27')](_0xbacb('0x5d'));return _0x567046;});}exports['queue']=function(_0x2846c9,_0x361c1c,_0x2c73af,_0x1209bb,_0x11bea7,_0x118448){var _0xa54c57,_0x431f55,_0xa13e7c,_0x3de29d;_0x118448[_0xbacb('0x5e')]=intUtil[_0xbacb('0x5f')](_0x118448['serverUrl']);_0x118448[_0xbacb('0x58')]=intUtil[_0xbacb('0x5f')](_0x118448[_0xbacb('0x58')]);if(_0x11bea7&&_0x11bea7['monitor_format']){logger[_0xbacb('0x27')](_0xbacb('0x60'),_0xbacb('0x61'));_0x361c1c[_0xbacb('0x62')]=util[_0xbacb('0x47')](_0xbacb('0x63'),_0x118448[_0xbacb('0x5e')],_0x361c1c[_0xbacb('0x64')],md5(_0x361c1c[_0xbacb('0x64')]));}else{_0x361c1c[_0xbacb('0x62')]='';}return getConnection(_0x118448)[_0xbacb('0x24')](function(_0x28b9db){_0x3de29d=_0x28b9db;return getUser(_0x118448,_0x1209bb['email'],_0x3de29d);})[_0xbacb('0x24')](function(_0xe0df9f){_0xa54c57=_0xe0df9f;return getEndUser(_0x118448,_0x2c73af,_0x361c1c['calleridname'],_0x361c1c[_0xbacb('0x65')],_0x3de29d);})['then'](function(_0x2eefb3){_0x431f55=_0x2eefb3;return getTicket(_0x118448,_0xa54c57,_0x431f55,_0x2c73af,_0x361c1c,_0x2c73af[_0xbacb('0x66')],_0x3de29d,_0xbacb('0x67'));})[_0xbacb('0x24')](function(_0x41bbcd){_0xa13e7c=_0x41bbcd;logger[_0xbacb('0x27')](_0xbacb('0x68'),_0xa13e7c['id']);logger['info'](_0xbacb('0x69'),_0xa13e7c['id'],_0x1209bb[_0xbacb('0x54')],_0x118448['type']);switch(_0x118448[_0xbacb('0x40')]){case _0xbacb('0x6a'):emit(util['format'](_0xbacb('0x6b'),_0x1209bb[_0xbacb('0x54')]),_0xbacb('0x6c'),{'recordId':_0xa13e7c['id']});break;case _0xbacb('0x6d'):emit(util['format'](_0xbacb('0x6b'),_0x1209bb['name']),'trigger:browser:url',{'uri':util[_0xbacb('0x47')](_0xbacb('0x6e'),_0x3de29d['instanceUrl'],_0xa13e7c['id'])});break;default:logger[_0xbacb('0x6f')]('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})[_0xbacb('0x70')](function(_0xb29a4d){logger[_0xbacb('0x6f')](_0xbacb('0x60'),_0xb29a4d);});};exports[_0xbacb('0x71')]=function(_0x5ad711,_0x372ea9,_0x222060,_0x4b859b,_0x1d5725,_0x2634f9,_0x532b99){var _0x39f265,_0x1fd272,_0x2a3340,_0x55c808;_0x2634f9[_0xbacb('0x5e')]=intUtil[_0xbacb('0x5f')](_0x2634f9[_0xbacb('0x5e')]);_0x2634f9[_0xbacb('0x58')]=intUtil[_0xbacb('0x5f')](_0x2634f9[_0xbacb('0x58')]);if(_0x532b99&&_0x532b99[_0xbacb('0x72')]&&_0x532b99[_0xbacb('0x72')]!==_0xbacb('0x73')){logger[_0xbacb('0x27')](_0xbacb('0x74'),'Recording\x20is\x20enabled!');_0x372ea9[_0xbacb('0x62')]=util['format'](_0xbacb('0x63'),_0x2634f9[_0xbacb('0x5e')],_0x372ea9[_0xbacb('0x64')],md5(_0x372ea9[_0xbacb('0x64')]));}return getConnection(_0x2634f9)[_0xbacb('0x24')](function(_0x293aa6){_0x55c808=_0x293aa6;return getUser(_0x2634f9,_0x4b859b[_0xbacb('0x75')],_0x55c808);})[_0xbacb('0x24')](function(_0x513d90){_0x39f265=_0x513d90;return getEndUser(_0x2634f9,_0x222060,_0x372ea9[_0xbacb('0x76')],_0x372ea9['destcalleridnum'],_0x55c808);})[_0xbacb('0x24')](function(_0x695cc){_0x1fd272=_0x695cc;return getTicket(_0x2634f9,_0x39f265,_0x1fd272,_0x222060,_0x372ea9,_0x222060[_0xbacb('0x66')],_0x55c808,_0xbacb('0x71'));})[_0xbacb('0x24')](function(_0x34dfdf){_0x2a3340=_0x34dfdf;logger['info'](_0xbacb('0x77'),_0x2a3340['id']);logger[_0xbacb('0x27')](_0xbacb('0x78'),_0x2a3340['id'],_0x4b859b[_0xbacb('0x54')],_0x2634f9[_0xbacb('0x40')]);switch(_0x2634f9[_0xbacb('0x40')]){case _0xbacb('0x6a'):emit(util['format'](_0xbacb('0x6b'),_0x4b859b['name']),_0xbacb('0x6c'),{'recordId':_0x2a3340['id']});break;case _0xbacb('0x6d'):emit(util['format'](_0xbacb('0x6b'),_0x4b859b[_0xbacb('0x54')]),_0xbacb('0x79'),{'uri':util['format'](_0xbacb('0x6e'),_0x55c808[_0xbacb('0x7a')],_0x2a3340['id'])});break;default:logger[_0xbacb('0x6f')]('[OUTBOUND]','Salesforce\x20account\x20type\x20not\x20recognized');}})[_0xbacb('0x70')](function(_0x572001){logger[_0xbacb('0x6f')](_0xbacb('0x74'),_0x572001);});};exports[_0xbacb('0x7b')]=function(_0x8fae72,_0x313967,_0x220fdf,_0xc4faab,_0x37c9ff,_0x1d40a7){var _0x1f044a,_0x8cd030,_0x3ffbef,_0x3e55af;_0x1d40a7['serverUrl']=intUtil[_0xbacb('0x5f')](_0x1d40a7['serverUrl']);_0x1d40a7[_0xbacb('0x58')]=intUtil[_0xbacb('0x5f')](_0x1d40a7[_0xbacb('0x58')]);if(_0x37c9ff&&_0x37c9ff[_0xbacb('0x7c')]){logger[_0xbacb('0x27')]('['+_0x313967[_0xbacb('0x7d')]['toUpperCase']()+']',_0xbacb('0x61'));_0x313967[_0xbacb('0x62')]=util[_0xbacb('0x47')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1d40a7[_0xbacb('0x5e')],_0x313967[_0xbacb('0x64')],md5(_0x313967[_0xbacb('0x64')]));}else{_0x313967[_0xbacb('0x62')]='';}return getConnection(_0x1d40a7)[_0xbacb('0x24')](function(_0x1f94e8){_0x3e55af=_0x1f94e8;if(!_[_0xbacb('0x21')](_0xc4faab)){return getUser(_0x1d40a7,_0xc4faab[_0xbacb('0x54')],_0x3e55af);}else{return getUser(_0x1d40a7,null,_0x3e55af);}})['then'](function(_0x294105){_0x1f044a=_0x294105;return getEndUser(_0x1d40a7,_0x220fdf,_0x313967['calleridname'],_0x313967[_0xbacb('0x65')],_0x3e55af);})[_0xbacb('0x24')](function(_0x52bdae){_0x8cd030=_0x52bdae;return getTicket(_0x1d40a7,_0x1f044a,_0x8cd030,_0x220fdf,_0x313967,_0x220fdf[_0xbacb('0x66')],_0x3e55af);})[_0xbacb('0x24')](function(_0x2b5516){_0x3ffbef=_0x2b5516;logger[_0xbacb('0x27')]('['+_0x313967['lastevent'][_0xbacb('0x7e')]()+']\x20Ticket\x20%s\x20created.',_0x3ffbef['id']);logger[_0xbacb('0x27')]('['+_0x313967[_0xbacb('0x7d')]['toUpperCase']()+']\x20Integration\x20account\x20type\x20%s.',_0x1d40a7[_0xbacb('0x40')]);})[_0xbacb('0x70')](function(_0x3de05e){logger[_0xbacb('0x6f')]('['+_0x313967['lastevent'][_0xbacb('0x7e')]()+']',_0x3de05e);});}; \ 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 3c91f20..eb413cf 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 _0xbfaa=['variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','getString','Subjects','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketNumber','label','?sysparm_query=name%3D','label_entry','incident','Incident','Incident\x20-\x20','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','forEach','push','Tags','map','%26sysparm_record_target%3Dincident','%255EORDERBYDESCnumber','format','user:%s','emit','username','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','isNil','email','destcalleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','recordingURL','Recording\x20is\x20enabled!','The\x20ticket\x20ID\x20is:\x20%s','ticketId','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','util','md5','ioredis','./util','../../../../config/environment','servicenow','redis','localhost','socket.io-emitter','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','adminId','toUpperCase','catch','error','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','GET','sys_user?sysparm_query=email%3D','info','],\x20getUser\x20rp\x20obj','active','true','userId','sys_id','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','endUserNumber','user','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','string','picklist','type','nameField','customField','toLowerCase','content','toString','includes','idField'];(function(_0x2f74b0,_0x5a7c8c){var _0x1ad5ed=function(_0x3e9485){while(--_0x3e9485){_0x2f74b0['push'](_0x2f74b0['shift']());}};_0x1ad5ed(++_0x5a7c8c);}(_0xbfaa,0x1de));var _0xabfa=function(_0x1c673a,_0x4eaa6e){_0x1c673a=_0x1c673a-0x0;var _0xca51=_0xbfaa[_0x1c673a];return _0xca51;};'use strict';var _=require(_0xabfa('0x0'));var Promise=require(_0xabfa('0x1'));var rp=require('request-promise');var util=require(_0xabfa('0x2'));var md5=require(_0xabfa('0x3'));var Redis=require(_0xabfa('0x4'));var intUtil=require(_0xabfa('0x5'));var config=require(_0xabfa('0x6'));var logger=require('../../../../config/logger')(_0xabfa('0x7'));config[_0xabfa('0x8')]=_['defaults'](config[_0xabfa('0x8')],{'host':_0xabfa('0x9'),'port':0x18eb});var io=require(_0xabfa('0xa'))(new Redis(config[_0xabfa('0x8')]));function getAdminUser(_0x5f3a23,_0x13fbc6,_0x54aaa2,_0x39a842,_0x12d4ff,_0x3143c3){return new Promise(function(_0x5f4e67,_0x209e5b){var _0x493c4c={'method':'GET','uri':_0x39a842+_0xabfa('0xb')+'&'+_0x12d4ff+'&'+_0x3143c3,'auth':_0x13fbc6,'json':!![]};return rp(_0x493c4c)[_0xabfa('0xc')](function(_0x8101d8){if(_0x8101d8[_0xabfa('0xd')][_0xabfa('0xe')]>0x0){_0x54aaa2[_0xabfa('0xf')]=_0x8101d8[_0xabfa('0xd')][0x0]['sys_id'];}logger['info']('['+[_0x5f3a23[_0xabfa('0x10')]()]+'],\x20getAdminUser\x20crm',_0x54aaa2);_0x5f4e67(_0x54aaa2);})[_0xabfa('0x11')](function(_0x2d62b0){logger[_0xabfa('0x12')]('['+[_0x5f3a23[_0xabfa('0x10')]()]+']',_0x2d62b0[_0xabfa('0x13')]);_0x209e5b(_0x2d62b0[_0xabfa('0x13')]);});});}function getUser(_0x11fbad,_0x55250f,_0x56cdcc,_0x5eb8b1,_0x151ca6){return function(_0x3f25f2){logger['info']('['+[_0x11fbad[_0xabfa('0x10')]()]+_0xabfa('0x14'),_0x3f25f2);return new Promise(function(_0x36363c,_0x270c0a){if(intUtil[_0xabfa('0x15')](_0x3f25f2[_0xabfa('0x16')])){var _0x12041a={'method':_0xabfa('0x17'),'uri':_0x56cdcc+_0xabfa('0x18')+_0x3f25f2[_0xabfa('0x16')]+'&'+_0x5eb8b1+'&'+_0x151ca6,'auth':_0x55250f,'json':!![]};logger[_0xabfa('0x19')]('['+[_0x11fbad[_0xabfa('0x10')]()]+_0xabfa('0x1a'),_0x12041a);return rp(_0x12041a)[_0xabfa('0xc')](function(_0x1c8247){logger[_0xabfa('0x19')]('['+[_0x11fbad[_0xabfa('0x10')]()]+'],\x20getUser\x20entity',_0x1c8247);if(_0x1c8247['result'][_0xabfa('0xe')]>0x0&&String(_0x1c8247['result'][0x0][_0xabfa('0x1b')])===_0xabfa('0x1c')){_0x3f25f2[_0xabfa('0x1d')]=_0x1c8247['result'][0x0][_0xabfa('0x1e')];}else{_0x3f25f2['userId']=_0x3f25f2[_0xabfa('0xf')];_0x3f25f2['userEmail']=_0x3f25f2[_0xabfa('0x1f')];}logger['info']('['+[_0x11fbad['toUpperCase']()]+_0xabfa('0x20'),_0x3f25f2);_0x36363c(_0x3f25f2);})[_0xabfa('0x11')](function(_0x342a56){logger[_0xabfa('0x12')]('['+[_0x11fbad[_0xabfa('0x10')]()]+']',_0x342a56[_0xabfa('0x13')]);_0x270c0a(_0x342a56['message']);});}else{logger[_0xabfa('0x19')]('['+[_0x11fbad['toUpperCase']()]+_0xabfa('0x21'));_0x3f25f2[_0xabfa('0x1d')]=_0x3f25f2['adminId'];_0x3f25f2['userEmail']=_0x3f25f2['adminEmail'];_0x36363c(_0x3f25f2);}});};}function createEndUser(_0x367193,_0x402ecb,_0x5d2ad2,_0x2cb925,_0x2ffccb){logger[_0xabfa('0x19')]('['+[_0x367193[_0xabfa('0x10')]()]+_0xabfa('0x22'),_0x5d2ad2);return new Promise(function(_0x3961d6,_0x8b19cc){var _0x2039f3={'method':_0xabfa('0x23'),'uri':_0x2cb925+'sys_user?'+_0x2ffccb,'body':{'user_name':_0x5d2ad2[_0xabfa('0x24')],'roles':_0xabfa('0x25'),'first_name':_0x5d2ad2[_0xabfa('0x24')],'active':_0xabfa('0x1c'),'date_format':'System','phone':_0x5d2ad2[_0xabfa('0x24')]},'auth':_0x402ecb,'json':!![]};return rp(_0x2039f3)[_0xabfa('0xc')](function(_0x11ce81){logger['info']('['+[_0x367193[_0xabfa('0x10')]()]+'],\x20EndUser\x20schema',_0x11ce81[_0xabfa('0xd')]);_0x5d2ad2[_0xabfa('0x26')]=_0x11ce81[_0xabfa('0xd')][_0xabfa('0x1e')];_0x3961d6(_0x5d2ad2);})[_0xabfa('0x11')](function(_0x23d2b9){logger['error']('['+[_0x367193[_0xabfa('0x10')]()]+']',_0x23d2b9[_0xabfa('0x13')]);_0x8b19cc(_0x23d2b9[_0xabfa('0x13')]);});});}function getEndUser(_0x59ce9f,_0x169739,_0x12f10f,_0x5cba0a,_0x22214b){return function(_0x2d1c5b){logger[_0xabfa('0x19')]('['+[_0x59ce9f[_0xabfa('0x10')]()]+_0xabfa('0x27'),_0x2d1c5b);return new Promise(function(_0xc11f09,_0xe6fe68){var _0x27f6d2={'method':_0xabfa('0x17'),'uri':_0x12f10f+_0xabfa('0x28')+_0x2d1c5b[_0xabfa('0x24')]+'&'+_0x5cba0a+'&'+_0x22214b,'auth':_0x169739,'json':!![]};return rp(_0x27f6d2)[_0xabfa('0xc')](function(_0x5c9ea5){if(_0x5c9ea5[_0xabfa('0xd')][_0xabfa('0xe')]>0x0){_0x2d1c5b[_0xabfa('0x26')]=_0x5c9ea5[_0xabfa('0xd')][0x0][_0xabfa('0x1e')];logger['info']('['+[_0x59ce9f['toUpperCase']()]+_0xabfa('0x29'),_0x2d1c5b);_0xc11f09(_0x2d1c5b);}else{return createEndUser(_0x59ce9f,_0x169739,_0x2d1c5b,_0x12f10f,_0x5cba0a)['then'](function(_0x3ac5e1){logger['info']('['+[_0x59ce9f[_0xabfa('0x10')]()]+'],\x20createEndUser\x20crm',_0x3ac5e1);_0xc11f09(_0x3ac5e1);});}})[_0xabfa('0x11')](function(_0x42d9d9){logger['error']('['+[_0x59ce9f['toUpperCase']()]+']',_0x42d9d9[_0xabfa('0x13')]);_0xe6fe68(_0x42d9d9[_0xabfa('0x13')]);});});};}function getCustomFields(_0x50f4ae,_0x4d6f43){var _0x3cdb07={};if(_0x50f4ae['length']>0x0){_['forEach'](_0x50f4ae,function(_0x2f33ae){if(_['includes']([_0xabfa('0x2a'),_0xabfa('0x2b')],_0x2f33ae[_0xabfa('0x2c')])&&_0x2f33ae[_0xabfa('0x2d')]&&!_0x2f33ae[_0xabfa('0x2e')]){_0x3cdb07[_0x2f33ae[_0xabfa('0x2d')][_0xabfa('0x2f')]()]=_0x2f33ae[_0xabfa('0x30')][_0xabfa('0x31')]();}else if(_[_0xabfa('0x32')]([_0xabfa('0x2a'),_0xabfa('0x2b')],_0x2f33ae[_0xabfa('0x2c')])&&_0x2f33ae[_0xabfa('0x33')]&&_0x2f33ae[_0xabfa('0x2e')]){_0x3cdb07[_0x2f33ae[_0xabfa('0x33')]['toLowerCase']()]=_0x2f33ae['content']['toString']();}else if(_0x2f33ae[_0xabfa('0x2c')]===_0xabfa('0x34')&&_0x2f33ae[_0xabfa('0x35')]&&_0x2f33ae['idField']&&_0x2f33ae[_0xabfa('0x2e')]){_0x3cdb07[_0x2f33ae['idField'][_0xabfa('0x2f')]()]=_0x4d6f43[_0x2f33ae[_0xabfa('0x35')]][_0xabfa('0x31')]();}else if(_0x2f33ae[_0xabfa('0x2c')]===_0xabfa('0x36')&&_0x2f33ae['Variable']&&_0x2f33ae[_0xabfa('0x37')][_0xabfa('0x38')]&&_0x2f33ae[_0xabfa('0x33')]&&_0x2f33ae[_0xabfa('0x2e')]){_0x3cdb07[_0x2f33ae[_0xabfa('0x33')][_0xabfa('0x2f')]()]=_0x4d6f43[_0x2f33ae[_0xabfa('0x37')][_0xabfa('0x38')][_0xabfa('0x2f')]()][_0xabfa('0x31')]();}});}return _0x3cdb07;}function getTicket(_0x1c15d8,_0x11488e,_0xd09c3f,_0x33b69a,_0x727d4b,_0x466b04){return function(_0x3563a9){logger[_0xabfa('0x19')]('['+[_0x1c15d8[_0xabfa('0x10')]()]+_0xabfa('0x39'),_0x3563a9);return new Promise(function(_0x34399f,_0x6ccca){var _0x130fb5=_0x1c15d8[_0xabfa('0x2f')]()===_0xabfa('0x3a')?_0x3563a9[_0xabfa('0x1d')]:_0x3563a9[_0xabfa('0x26')];var _0x13c614={'method':_0xabfa('0x23'),'uri':_0xd09c3f+'incident'+'?'+_0x466b04,'body':Object['assign']({},{'active':_0xabfa('0x1c'),'caller_id':_0x130fb5,'assigned_to':_0x3563a9[_0xabfa('0x1d')],'short_description':intUtil[_0xabfa('0x3b')](_0x33b69a[_0xabfa('0x3c')],_0x727d4b,'\x20'),'description':intUtil[_0xabfa('0x3b')](_0x33b69a['Descriptions'],_0x727d4b,'\x0a')},getCustomFields(_0x33b69a[_0xabfa('0x3d')],_0x727d4b)),'auth':_0x11488e,'json':!![]};return rp(_0x13c614)[_0xabfa('0xc')](function(_0x562ca6){logger[_0xabfa('0x19')]('['+[_0x1c15d8['toUpperCase']()]+_0xabfa('0x3e'),_0x562ca6['result']);_0x3563a9['ticketId']=_0x562ca6[_0xabfa('0xd')][_0xabfa('0x1e')];_0x3563a9[_0xabfa('0x3f')]=_0x562ca6['result']['number'];logger[_0xabfa('0x19')]('['+[_0x1c15d8['toUpperCase']()]+']\x20getTicket\x20crm',_0x3563a9);_0x34399f(_0x3563a9);})[_0xabfa('0x11')](function(_0x379aab){logger[_0xabfa('0x12')]('['+[_0x1c15d8[_0xabfa('0x10')]()]+']',_0x379aab[_0xabfa('0x13')]);_0x6ccca(_0x379aab['message']);});});};}function createRemoteTag(_0x4dbc01,_0x5c9bbc,_0x3c849e,_0x451441){return new Promise(function(_0x2a5176,_0x4a9db0){var _0x744ab8={'method':_0xabfa('0x23'),'uri':_0x3c849e+_0xabfa('0x40')+'?'+_0x451441,'body':{'short_description':_0x4dbc01,'global':!![],'active':!![],'name':_0x4dbc01},'auth':_0x5c9bbc,'json':!![]};return rp(_0x744ab8)[_0xabfa('0xc')](function(_0x291528){var _0x1bb54c=_0x291528[_0xabfa('0xd')][_0xabfa('0x1e')];_0x2a5176(_0x1bb54c);});});}function getRemoteTag(_0x509e81,_0x447789,_0x856785,_0x2ed565,_0x3527b9){return new Promise(function(_0x39b48b,_0x5c9cad){var _0x2bcff8={'method':'GET','uri':_0x856785+_0xabfa('0x40')+_0xabfa('0x41')+_0x509e81+'&'+_0x2ed565,'auth':_0x447789,'json':!![]};return rp(_0x2bcff8)['then'](function(_0x5b23db){if(_0x5b23db['result']['length']>0x0){var _0x3eb2e1=_0x5b23db['result'][0x0][_0xabfa('0x1e')];_0x39b48b(_0x3eb2e1);}else{return createRemoteTag(_0x509e81,_0x447789,_0x856785,_0x2ed565)['then'](function(_0x40d5ac){_0x39b48b(_0x40d5ac);});}});});}function assignTagToIncident(_0x1e7864,_0x2a9dc2,_0x5642bf,_0x44fd16,_0x23a764){return new Promise(function(_0x20efa8,_0x97bba8){var _0x5275b7={'method':_0xabfa('0x23'),'uri':_0x5642bf+_0xabfa('0x42')+'?'+_0x23a764,'body':{'label':_0x1e7864,'table':_0xabfa('0x43'),'id_type':_0xabfa('0x44'),'table_key':_0x44fd16['ticketId'],'title':_0xabfa('0x45')+_0x44fd16[_0xabfa('0x3f')],'id_display':_0x44fd16[_0xabfa('0x3f')]},'auth':_0x2a9dc2,'json':!![]};return rp(_0x5275b7)[_0xabfa('0xc')](function(_0x2b806e){_0x20efa8();})[_0xabfa('0x11')](function(){_0x20efa8();});});}function manageTags(_0x53acf7,_0x3c03d5,_0x2a74cc,_0x151c03,_0xdd1acf,_0x5d6fae,_0x177cc6){return new Promise(function(_0x47345e,_0x5ea5c1){var _0x226e4d=[];_0x3c03d5['forEach'](function(_0x18681f){_0x226e4d['push'](getRemoteTag(_0x18681f,_0x2a74cc,_0x151c03,_0x5d6fae,_0x177cc6));});return Promise[_0xabfa('0x46')](_0x226e4d)[_0xabfa('0xc')](function(_0x4f0f4b){if(_0x4f0f4b['length']){logger['info']('['+[_0x53acf7['toUpperCase']()]+_0xabfa('0x47'),_0x4f0f4b);var _0x51d3de=[];_0x4f0f4b[_0xabfa('0x48')](function(_0x5913e1){_0x51d3de[_0xabfa('0x49')](assignTagToIncident(_0x5913e1,_0x2a74cc,_0x151c03,_0xdd1acf,_0x5d6fae));});return Promise[_0xabfa('0x46')](_0x51d3de)[_0xabfa('0xc')](function(){_0x47345e();})[_0xabfa('0x11')](function(){_0x47345e();});}else{_0x47345e();}});});}function getTags(_0x4254ac,_0x7339d,_0x4ca266,_0x5f39e1,_0x5319b9,_0x50d8f1){return function(_0x4fc3e1){return new Promise(function(_0x2cafae,_0x548647){var _0x33a7d7=[];var _0x3e9c45=_0x5f39e1[_0xabfa('0x4a')];if(_0x3e9c45&&_0x3e9c45['length']>0x0){_0x33a7d7=_[_0xabfa('0x4b')](_0x3e9c45,_0xabfa('0x38'));}if(_0x33a7d7[_0xabfa('0xe')]>0x0){return manageTags(_0x4254ac,_0x33a7d7,_0x7339d,_0x4ca266,_0x4fc3e1,_0x5319b9,_0x50d8f1)[_0xabfa('0xc')](function(){_0x2cafae(_0x4fc3e1);});}else{_0x2cafae(_0x4fc3e1);}});};}function emit(_0x1124ed,_0x5d2f57,_0x2f385c){var _0x213521=_0xabfa('0x4c')+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+'%26sysparm_record_list%3Dactive%253Dtrue'+_0xabfa('0x4d');var _0x4cbb3d={'uri':_0x1124ed+'/nav_to.do?uri=incident.do?sys_id%3D'+_0x2f385c+_0x213521};io['to'](util[_0xabfa('0x4e')](_0xabfa('0x4f'),_0x5d2f57))[_0xabfa('0x50')]('trigger:browser:url',_0x4cbb3d);}exports['cs']=function(_0x57683a,_0x57c4bc,_0x1fdca9,_0x14ded9,_0x64fd8a,_0x13dbe6,_0xd9f4c2,_0x2877a){var _0x550dd4={};var _0x157942={'user':_0x13dbe6[_0xabfa('0x51')],'pass':_0x13dbe6[_0xabfa('0x52')]};var _0x4023a4=_0xabfa('0x53');var _0x1b643c=_0xabfa('0x54');_0x13dbe6[_0xabfa('0x55')]=intUtil[_0xabfa('0x56')](_0x13dbe6[_0xabfa('0x55')]);_0x13dbe6[_0xabfa('0x57')]=intUtil['stripTrailingSlash'](_0x13dbe6[_0xabfa('0x57')]);var _0x34568a=util['format'](_0xabfa('0x58'),_0x13dbe6['remoteUri']);_0x550dd4['userEmail']=!_[_0xabfa('0x59')](_0x14ded9)?_0x14ded9['email']:null;_0x550dd4['adminEmail']=_0x13dbe6[_0xabfa('0x5a')];_0x550dd4[_0xabfa('0x24')]=_0x2877a['toLowerCase']()===_0xabfa('0x3a')?_0x57c4bc[_0xabfa('0x5b')]:_0x57c4bc['calleridnum'];_0x550dd4[_0xabfa('0x5c')]=_0x2877a===_0xabfa('0x5d')||_0x2877a===_0xabfa('0x5e')?_0xabfa('0x5d'):_0xabfa('0x3a');var _0x214954=util[_0xabfa('0x4e')](_0xabfa('0x5f'),_0x13dbe6[_0xabfa('0x57')],_0x57c4bc['uniqueid'],md5(_0x57c4bc[_0xabfa('0x60')]));if(_0x64fd8a&&_0x64fd8a[_0xabfa('0x61')]){logger['info']('[QUEUE]','Recording\x20is\x20enabled!');_0x57c4bc[_0xabfa('0x62')]=_0x214954;}else if(_0xd9f4c2&&_0xd9f4c2['recordingFormat']&&_0xd9f4c2['recordingFormat']!=='none'){logger[_0xabfa('0x19')]('[OUTBOUND]',_0xabfa('0x63'));_0x57c4bc[_0xabfa('0x62')]=_0x214954;}else{_0x57c4bc[_0xabfa('0x62')]='';}return getAdminUser(_0x2877a,_0x157942,_0x550dd4,_0x34568a,_0x1b643c,_0x4023a4)[_0xabfa('0xc')](getUser(_0x2877a,_0x157942,_0x34568a,_0x1b643c,_0x4023a4))[_0xabfa('0xc')](getEndUser(_0x2877a,_0x157942,_0x34568a,_0x1b643c,_0x4023a4))[_0xabfa('0xc')](getTicket(_0x2877a,_0x157942,_0x34568a,_0x1fdca9,_0x57c4bc,_0x1b643c))['then'](function(_0x52f28a){logger[_0xabfa('0x19')](util['format'](_0xabfa('0x64'),_0x52f28a[_0xabfa('0x65')]));logger[_0xabfa('0x19')](util[_0xabfa('0x4e')](_0xabfa('0x66'),_0x2877a));if(_0x2877a!==_0xabfa('0x5e')){logger[_0xabfa('0x19')]('['+[_0x2877a['toUpperCase']()]+']',_0xabfa('0x67'));emit(_0x13dbe6['remoteUri'],_0x14ded9[_0xabfa('0x38')],_0x52f28a[_0xabfa('0x65')]);}})[_0xabfa('0x11')](function(_0x270056){logger['error']('['+[_0x2877a['toUpperCase']()]+_0xabfa('0x68'),util[_0xabfa('0x69')](_0x270056,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xf6b8=['%255EORDERBYDESCnumber','format','user:%s','emit','trigger:browser:url','username','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','isNil','email','destcalleridnum','calleridnum','callDirection','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL','call\x20direction:\x20%s','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','bluebird','request-promise','util','md5','ioredis','./util','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','adminId','sys_id','info','],\x20getAdminUser\x20crm','catch','toUpperCase','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','GET','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','active','true','userId','adminEmail','],\x20getUser\x20crm','error',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','sys_user?','endUserNumber','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','forEach','includes','string','nameField','customField','toLowerCase','content','toString','picklist','idField','type','variable','variableName','customVariable','name','Variable',']\x20getTicket\x20input\x20crm','outbound','POST','incident','assign','getString','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','Incident','Incident\x20-\x20','all','push','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue'];(function(_0x18edef,_0x1af64e){var _0x3a4726=function(_0x406468){while(--_0x406468){_0x18edef['push'](_0x18edef['shift']());}};_0x3a4726(++_0x1af64e);}(_0xf6b8,0x93));var _0x8f6b=function(_0x541116,_0x182fbb){_0x541116=_0x541116-0x0;var _0xbe29bb=_0xf6b8[_0x541116];return _0xbe29bb;};'use strict';var _=require('lodash');var Promise=require(_0x8f6b('0x0'));var rp=require(_0x8f6b('0x1'));var util=require(_0x8f6b('0x2'));var md5=require(_0x8f6b('0x3'));var Redis=require(_0x8f6b('0x4'));var intUtil=require(_0x8f6b('0x5'));var config=require(_0x8f6b('0x6'));var logger=require('../../../../config/logger')('servicenow');config[_0x8f6b('0x7')]=_[_0x8f6b('0x8')](config[_0x8f6b('0x7')],{'host':_0x8f6b('0x9'),'port':0x18eb});var io=require(_0x8f6b('0xa'))(new Redis(config['redis']));function getAdminUser(_0x25ea65,_0x5911e5,_0x192a29,_0x372a55,_0x462f2d,_0x1cb315){return new Promise(function(_0x3dc576,_0x25b2b2){var _0x1a1666={'method':'GET','uri':_0x372a55+_0x8f6b('0xb')+'&'+_0x462f2d+'&'+_0x1cb315,'auth':_0x5911e5,'json':!![]};return rp(_0x1a1666)[_0x8f6b('0xc')](function(_0x440cc0){if(_0x440cc0[_0x8f6b('0xd')][_0x8f6b('0xe')]>0x0){_0x192a29[_0x8f6b('0xf')]=_0x440cc0[_0x8f6b('0xd')][0x0][_0x8f6b('0x10')];}logger[_0x8f6b('0x11')]('['+[_0x25ea65['toUpperCase']()]+_0x8f6b('0x12'),_0x192a29);_0x3dc576(_0x192a29);})[_0x8f6b('0x13')](function(_0x31ed52){logger['error']('['+[_0x25ea65[_0x8f6b('0x14')]()]+']',_0x31ed52[_0x8f6b('0x15')]);_0x25b2b2(_0x31ed52[_0x8f6b('0x15')]);});});}function getUser(_0x3f453b,_0x37fd48,_0x40da21,_0x4eab68,_0x542a7a){return function(_0x55bfa9){logger[_0x8f6b('0x11')]('['+[_0x3f453b['toUpperCase']()]+_0x8f6b('0x16'),_0x55bfa9);return new Promise(function(_0x3de223,_0x14fa04){if(intUtil[_0x8f6b('0x17')](_0x55bfa9[_0x8f6b('0x18')])){var _0x5dec15={'method':_0x8f6b('0x19'),'uri':_0x40da21+_0x8f6b('0x1a')+_0x55bfa9['userEmail']+'&'+_0x4eab68+'&'+_0x542a7a,'auth':_0x37fd48,'json':!![]};logger[_0x8f6b('0x11')]('['+[_0x3f453b[_0x8f6b('0x14')]()]+_0x8f6b('0x1b'),_0x5dec15);return rp(_0x5dec15)['then'](function(_0x282361){logger[_0x8f6b('0x11')]('['+[_0x3f453b[_0x8f6b('0x14')]()]+_0x8f6b('0x1c'),_0x282361);if(_0x282361[_0x8f6b('0xd')][_0x8f6b('0xe')]>0x0&&String(_0x282361[_0x8f6b('0xd')][0x0][_0x8f6b('0x1d')])===_0x8f6b('0x1e')){_0x55bfa9['userId']=_0x282361['result'][0x0][_0x8f6b('0x10')];}else{_0x55bfa9[_0x8f6b('0x1f')]=_0x55bfa9[_0x8f6b('0xf')];_0x55bfa9[_0x8f6b('0x18')]=_0x55bfa9[_0x8f6b('0x20')];}logger[_0x8f6b('0x11')]('['+[_0x3f453b[_0x8f6b('0x14')]()]+_0x8f6b('0x21'),_0x55bfa9);_0x3de223(_0x55bfa9);})['catch'](function(_0xccb8c9){logger[_0x8f6b('0x22')]('['+[_0x3f453b[_0x8f6b('0x14')]()]+']',_0xccb8c9[_0x8f6b('0x15')]);_0x14fa04(_0xccb8c9['message']);});}else{logger[_0x8f6b('0x11')]('['+[_0x3f453b[_0x8f6b('0x14')]()]+_0x8f6b('0x23'));_0x55bfa9[_0x8f6b('0x1f')]=_0x55bfa9[_0x8f6b('0xf')];_0x55bfa9[_0x8f6b('0x18')]=_0x55bfa9[_0x8f6b('0x20')];_0x3de223(_0x55bfa9);}});};}function createEndUser(_0x54dd1e,_0x576c5d,_0x4549a5,_0xd37218,_0x3c0150){logger[_0x8f6b('0x11')]('['+[_0x54dd1e[_0x8f6b('0x14')]()]+_0x8f6b('0x24'),_0x4549a5);return new Promise(function(_0x85c3,_0x7cd0ee){var _0x563828={'method':'POST','uri':_0xd37218+_0x8f6b('0x25')+_0x3c0150,'body':{'user_name':_0x4549a5[_0x8f6b('0x26')],'roles':'user','first_name':_0x4549a5[_0x8f6b('0x26')],'active':_0x8f6b('0x1e'),'date_format':'System','phone':_0x4549a5[_0x8f6b('0x26')]},'auth':_0x576c5d,'json':!![]};return rp(_0x563828)['then'](function(_0x5d2546){logger[_0x8f6b('0x11')]('['+[_0x54dd1e[_0x8f6b('0x14')]()]+_0x8f6b('0x27'),_0x5d2546[_0x8f6b('0xd')]);_0x4549a5[_0x8f6b('0x28')]=_0x5d2546[_0x8f6b('0xd')][_0x8f6b('0x10')];_0x85c3(_0x4549a5);})[_0x8f6b('0x13')](function(_0x5595f2){logger[_0x8f6b('0x22')]('['+[_0x54dd1e['toUpperCase']()]+']',_0x5595f2['message']);_0x7cd0ee(_0x5595f2['message']);});});}function getEndUser(_0x47afb5,_0x37914c,_0x148123,_0x271f30,_0x193ca8){return function(_0x543f2a){logger['info']('['+[_0x47afb5[_0x8f6b('0x14')]()]+_0x8f6b('0x29'),_0x543f2a);return new Promise(function(_0x2477ba,_0x2d66b5){var _0x233b1d={'method':_0x8f6b('0x19'),'uri':_0x148123+_0x8f6b('0x2a')+_0x543f2a[_0x8f6b('0x26')]+'&'+_0x271f30+'&'+_0x193ca8,'auth':_0x37914c,'json':!![]};return rp(_0x233b1d)[_0x8f6b('0xc')](function(_0x4eaa73){if(_0x4eaa73[_0x8f6b('0xd')][_0x8f6b('0xe')]>0x0){_0x543f2a[_0x8f6b('0x28')]=_0x4eaa73[_0x8f6b('0xd')][0x0][_0x8f6b('0x10')];logger[_0x8f6b('0x11')]('['+[_0x47afb5[_0x8f6b('0x14')]()]+_0x8f6b('0x2b'),_0x543f2a);_0x2477ba(_0x543f2a);}else{return createEndUser(_0x47afb5,_0x37914c,_0x543f2a,_0x148123,_0x271f30)[_0x8f6b('0xc')](function(_0x4d0739){logger['info']('['+[_0x47afb5[_0x8f6b('0x14')]()]+'],\x20createEndUser\x20crm',_0x4d0739);_0x2477ba(_0x4d0739);});}})[_0x8f6b('0x13')](function(_0x819fc3){logger[_0x8f6b('0x22')]('['+[_0x47afb5[_0x8f6b('0x14')]()]+']',_0x819fc3[_0x8f6b('0x15')]);_0x2d66b5(_0x819fc3[_0x8f6b('0x15')]);});});};}function getCustomFields(_0x2b7f92,_0x1d9f19){var _0x38840e={};if(_0x2b7f92[_0x8f6b('0xe')]>0x0){_[_0x8f6b('0x2c')](_0x2b7f92,function(_0x266219){if(_[_0x8f6b('0x2d')]([_0x8f6b('0x2e'),'picklist'],_0x266219['type'])&&_0x266219[_0x8f6b('0x2f')]&&!_0x266219[_0x8f6b('0x30')]){_0x38840e[_0x266219[_0x8f6b('0x2f')][_0x8f6b('0x31')]()]=_0x266219[_0x8f6b('0x32')][_0x8f6b('0x33')]();}else if(_[_0x8f6b('0x2d')]([_0x8f6b('0x2e'),_0x8f6b('0x34')],_0x266219['type'])&&_0x266219[_0x8f6b('0x35')]&&_0x266219['customField']){_0x38840e[_0x266219[_0x8f6b('0x35')][_0x8f6b('0x31')]()]=_0x266219[_0x8f6b('0x32')]['toString']();}else if(_0x266219[_0x8f6b('0x36')]===_0x8f6b('0x37')&&_0x266219[_0x8f6b('0x38')]&&_0x266219[_0x8f6b('0x35')]&&_0x266219[_0x8f6b('0x30')]){_0x38840e[_0x266219[_0x8f6b('0x35')][_0x8f6b('0x31')]()]=_0x1d9f19[_0x266219['variableName']]['toString']();}else if(_0x266219[_0x8f6b('0x36')]===_0x8f6b('0x39')&&_0x266219['Variable']&&_0x266219['Variable'][_0x8f6b('0x3a')]&&_0x266219[_0x8f6b('0x35')]&&_0x266219[_0x8f6b('0x30')]){_0x38840e[_0x266219[_0x8f6b('0x35')]['toLowerCase']()]=_0x1d9f19[_0x266219[_0x8f6b('0x3b')][_0x8f6b('0x3a')][_0x8f6b('0x31')]()]['toString']();}});}return _0x38840e;}function getTicket(_0x1af9f3,_0xe200dc,_0x379fc6,_0x1dabb4,_0x33211d,_0x20d5fc){return function(_0x3d0df4){logger[_0x8f6b('0x11')]('['+[_0x1af9f3[_0x8f6b('0x14')]()]+_0x8f6b('0x3c'),_0x3d0df4);return new Promise(function(_0x5dfb2d,_0x2a9292){var _0x160655=_0x1af9f3[_0x8f6b('0x31')]()===_0x8f6b('0x3d')?_0x3d0df4[_0x8f6b('0x1f')]:_0x3d0df4[_0x8f6b('0x28')];var _0x319279={'method':_0x8f6b('0x3e'),'uri':_0x379fc6+_0x8f6b('0x3f')+'?'+_0x20d5fc,'body':Object[_0x8f6b('0x40')]({},{'active':'true','caller_id':_0x160655,'assigned_to':_0x3d0df4['userId'],'short_description':intUtil[_0x8f6b('0x41')](_0x1dabb4[_0x8f6b('0x42')],_0x33211d,'\x20'),'description':intUtil[_0x8f6b('0x41')](_0x1dabb4[_0x8f6b('0x43')],_0x33211d,'\x0a')},getCustomFields(_0x1dabb4[_0x8f6b('0x44')],_0x33211d)),'auth':_0xe200dc,'json':!![]};return rp(_0x319279)['then'](function(_0xa5dd5f){logger[_0x8f6b('0x11')]('['+[_0x1af9f3[_0x8f6b('0x14')]()]+_0x8f6b('0x45'),_0xa5dd5f[_0x8f6b('0xd')]);_0x3d0df4[_0x8f6b('0x46')]=_0xa5dd5f[_0x8f6b('0xd')]['sys_id'];_0x3d0df4[_0x8f6b('0x47')]=_0xa5dd5f[_0x8f6b('0xd')]['number'];logger[_0x8f6b('0x11')]('['+[_0x1af9f3['toUpperCase']()]+_0x8f6b('0x48'),_0x3d0df4);_0x5dfb2d(_0x3d0df4);})[_0x8f6b('0x13')](function(_0x41e91b){logger[_0x8f6b('0x22')]('['+[_0x1af9f3['toUpperCase']()]+']',_0x41e91b['message']);_0x2a9292(_0x41e91b[_0x8f6b('0x15')]);});});};}function createRemoteTag(_0x1afd39,_0x1e6d1d,_0x198576,_0x2aa7a3){return new Promise(function(_0x417b63,_0x5a4029){var _0x4c0f29={'method':_0x8f6b('0x3e'),'uri':_0x198576+'label'+'?'+_0x2aa7a3,'body':{'short_description':_0x1afd39,'global':!![],'active':!![],'name':_0x1afd39},'auth':_0x1e6d1d,'json':!![]};return rp(_0x4c0f29)[_0x8f6b('0xc')](function(_0x4008ff){var _0x268a4e=_0x4008ff[_0x8f6b('0xd')][_0x8f6b('0x10')];_0x417b63(_0x268a4e);});});}function getRemoteTag(_0x759eff,_0x1b2bfc,_0x497853,_0x55557f,_0x106808){return new Promise(function(_0xfba426,_0x4ff1f7){var _0x4d2c3e={'method':_0x8f6b('0x19'),'uri':_0x497853+_0x8f6b('0x49')+_0x8f6b('0x4a')+_0x759eff+'&'+_0x55557f,'auth':_0x1b2bfc,'json':!![]};return rp(_0x4d2c3e)['then'](function(_0x3023e8){if(_0x3023e8[_0x8f6b('0xd')][_0x8f6b('0xe')]>0x0){var _0x37c906=_0x3023e8[_0x8f6b('0xd')][0x0][_0x8f6b('0x10')];_0xfba426(_0x37c906);}else{return createRemoteTag(_0x759eff,_0x1b2bfc,_0x497853,_0x55557f)['then'](function(_0x2b2c8b){_0xfba426(_0x2b2c8b);});}});});}function assignTagToIncident(_0x31dc03,_0x90e6a6,_0x235fcb,_0x129a65,_0x590e72){return new Promise(function(_0x494146,_0x57ef35){var _0x31f93c={'method':_0x8f6b('0x3e'),'uri':_0x235fcb+_0x8f6b('0x4b')+'?'+_0x590e72,'body':{'label':_0x31dc03,'table':_0x8f6b('0x3f'),'id_type':_0x8f6b('0x4c'),'table_key':_0x129a65[_0x8f6b('0x46')],'title':_0x8f6b('0x4d')+_0x129a65[_0x8f6b('0x47')],'id_display':_0x129a65[_0x8f6b('0x47')]},'auth':_0x90e6a6,'json':!![]};return rp(_0x31f93c)[_0x8f6b('0xc')](function(_0x133883){_0x494146();})[_0x8f6b('0x13')](function(){_0x494146();});});}function manageTags(_0x3a1c9f,_0x3695b4,_0x389187,_0x5ef4dd,_0x2513fd,_0xa08492,_0x3239d3){return new Promise(function(_0x40a97b,_0xa0595){var _0x53ab64=[];_0x3695b4['forEach'](function(_0x198eef){_0x53ab64['push'](getRemoteTag(_0x198eef,_0x389187,_0x5ef4dd,_0xa08492,_0x3239d3));});return Promise[_0x8f6b('0x4e')](_0x53ab64)['then'](function(_0x7f6224){if(_0x7f6224['length']){logger[_0x8f6b('0x11')]('['+[_0x3a1c9f['toUpperCase']()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x7f6224);var _0x30abd5=[];_0x7f6224[_0x8f6b('0x2c')](function(_0x1d57a5){_0x30abd5[_0x8f6b('0x4f')](assignTagToIncident(_0x1d57a5,_0x389187,_0x5ef4dd,_0x2513fd,_0xa08492));});return Promise[_0x8f6b('0x4e')](_0x30abd5)['then'](function(){_0x40a97b();})[_0x8f6b('0x13')](function(){_0x40a97b();});}else{_0x40a97b();}});});}function getTags(_0x989a89,_0x2831e7,_0x3f23d9,_0x3023f5,_0x4a43ce,_0x460eca){return function(_0x6f60b5){return new Promise(function(_0x1915f3,_0x1bbb78){var _0x1c6fe4=[];var _0x2ccc57=_0x3023f5[_0x8f6b('0x50')];if(_0x2ccc57&&_0x2ccc57[_0x8f6b('0xe')]>0x0){_0x1c6fe4=_[_0x8f6b('0x51')](_0x2ccc57,'name');}if(_0x1c6fe4[_0x8f6b('0xe')]>0x0){return manageTags(_0x989a89,_0x1c6fe4,_0x2831e7,_0x3f23d9,_0x6f60b5,_0x4a43ce,_0x460eca)[_0x8f6b('0xc')](function(){_0x1915f3(_0x6f60b5);});}else{_0x1915f3(_0x6f60b5);}});};}function emit(_0x2bfc4d,_0x22ea6c,_0x1f0db2){var _0x15f57e=_0x8f6b('0x52')+_0x8f6b('0x53')+_0x8f6b('0x54')+_0x8f6b('0x55');var _0x54b4f6={'uri':_0x2bfc4d+'/nav_to.do?uri=incident.do?sys_id%3D'+_0x1f0db2+_0x15f57e};io['to'](util[_0x8f6b('0x56')](_0x8f6b('0x57'),_0x22ea6c))[_0x8f6b('0x58')](_0x8f6b('0x59'),_0x54b4f6);}exports['cs']=function(_0x151121,_0x323905,_0x1831c9,_0x177d6c,_0x131b9a,_0x5de224,_0x41dca2,_0x139a33){var _0x1a1360={};var _0x27515d={'user':_0x5de224[_0x8f6b('0x5a')],'pass':_0x5de224[_0x8f6b('0x5b')]};var _0x4bf47b=_0x8f6b('0x5c');var _0x4478f0=_0x8f6b('0x5d');_0x5de224[_0x8f6b('0x5e')]=intUtil[_0x8f6b('0x5f')](_0x5de224[_0x8f6b('0x5e')]);_0x5de224[_0x8f6b('0x60')]=intUtil[_0x8f6b('0x5f')](_0x5de224[_0x8f6b('0x60')]);var _0x34e3bc=util['format']('%s/api/now/table/',_0x5de224['remoteUri']);_0x1a1360[_0x8f6b('0x18')]=!_[_0x8f6b('0x61')](_0x177d6c)?_0x177d6c['email']:null;_0x1a1360[_0x8f6b('0x20')]=_0x5de224[_0x8f6b('0x62')];_0x1a1360[_0x8f6b('0x26')]=_0x139a33[_0x8f6b('0x31')]()===_0x8f6b('0x3d')?_0x323905[_0x8f6b('0x63')]:_0x323905[_0x8f6b('0x64')];_0x1a1360[_0x8f6b('0x65')]=_0x139a33===_0x8f6b('0x66')||_0x139a33==='unmanaged'?_0x8f6b('0x66'):_0x8f6b('0x3d');var _0x1acc37=util[_0x8f6b('0x56')](_0x8f6b('0x67'),_0x5de224[_0x8f6b('0x60')],_0x323905[_0x8f6b('0x68')],md5(_0x323905['uniqueid']));if(_0x131b9a&&_0x131b9a[_0x8f6b('0x69')]){logger[_0x8f6b('0x11')]('[QUEUE]',_0x8f6b('0x6a'));_0x323905['recordingURL']=_0x1acc37;}else if(_0x41dca2&&_0x41dca2[_0x8f6b('0x6b')]&&_0x41dca2['recordingFormat']!==_0x8f6b('0x6c')){logger[_0x8f6b('0x11')](_0x8f6b('0x6d'),_0x8f6b('0x6a'));_0x323905[_0x8f6b('0x6e')]=_0x1acc37;}else{_0x323905[_0x8f6b('0x6e')]='';}return getAdminUser(_0x139a33,_0x27515d,_0x1a1360,_0x34e3bc,_0x4478f0,_0x4bf47b)[_0x8f6b('0xc')](getUser(_0x139a33,_0x27515d,_0x34e3bc,_0x4478f0,_0x4bf47b))['then'](getEndUser(_0x139a33,_0x27515d,_0x34e3bc,_0x4478f0,_0x4bf47b))[_0x8f6b('0xc')](getTicket(_0x139a33,_0x27515d,_0x34e3bc,_0x1831c9,_0x323905,_0x4478f0))[_0x8f6b('0xc')](function(_0x587060){logger[_0x8f6b('0x11')](util[_0x8f6b('0x56')]('The\x20ticket\x20ID\x20is:\x20%s',_0x587060['ticketId']));logger['info'](util[_0x8f6b('0x56')](_0x8f6b('0x6f'),_0x139a33));if(_0x139a33!==_0x8f6b('0x70')){logger[_0x8f6b('0x11')]('['+[_0x139a33[_0x8f6b('0x14')]()]+']',_0x8f6b('0x71'));emit(_0x5de224[_0x8f6b('0x5e')],_0x177d6c['name'],_0x587060[_0x8f6b('0x46')]);}})[_0x8f6b('0x13')](function(_0x504391){logger['error']('['+[_0x139a33['toUpperCase']()]+_0x8f6b('0x72'),util[_0x8f6b('0x73')](_0x504391,{'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 ec18fa7..c274999 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 _0x4db1=['ioredis','../../../../config/logger','sugarcrm','redis','defaults','localhost','POST','emit','info','name','Subjects','created_by','Descriptions','date_start','toISOString','slice','replace','duration_hours','duration_minutes','parent_id','Contacts','direction','forEach','variableName','push','idField','set_entry','JSON','Calls','format','Basic\x20%s','get_server_info','stringify','isNil','Getting\x20agent\x20with\x20name','user_name','then','entry_list','length','name_value_list','Agent\x20found!','resolve','value','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','get_entry_list','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','find','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','','Caller\x20-\x20%s','Enduser\x20created.','debug','[HTTP]','map','type','string','nameField','customField','toLowerCase','toString','custom_fields','content','variable','customVariable','Variable','login','username','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','remoteUri','stripTrailingSlash','serverUrl','%s/service/v4_1/rest.php','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','contacts','version','charAt','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','trigger:browser:url','[QUEUE]','outbound','uri','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Outbound','The\x20Ticket\x20ID\x20is:','users','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','unmanaged','monitor_format','lastevent','calleridname','catch','error','toUpperCase','request-promise','md5'];(function(_0x54aaf1,_0x2061cb){var _0x4c7562=function(_0xae20e7){while(--_0xae20e7){_0x54aaf1['push'](_0x54aaf1['shift']());}};_0x4c7562(++_0x2061cb);}(_0x4db1,0x1ce));var _0x14db=function(_0x33fcbb,_0x291d0f){_0x33fcbb=_0x33fcbb-0x0;var _0x2efe40=_0x4db1[_0x33fcbb];return _0x2efe40;};'use strict';var _=require('lodash');var rp=require(_0x14db('0x0'));var BPromise=require('bluebird');var md5=require(_0x14db('0x1'));var util=require('util');var Redis=require(_0x14db('0x2'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0x14db('0x3'))(_0x14db('0x4'));config[_0x14db('0x5')]=_[_0x14db('0x6')](config[_0x14db('0x5')],{'host':_0x14db('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var def={'method':_0x14db('0x8'),'json':!![]};function emit(_0x3b7bc0,_0x1789a0,_0x1a4f9c){io['to'](_0x3b7bc0)[_0x14db('0x9')](_0x1789a0,_0x1a4f9c);}function getTicket(_0x141c2e,_0x1bd290,_0x582a3f,_0x3b6d48,_0x40218a,_0x40cf74,_0x1cf3dc,_0x320d54){logger[_0x14db('0xa')]('Creating\x20new\x20ticket...');var _0x3e5bf6=new Date();var _0x315a6c=[{'name':_0x14db('0xb'),'value':intUtil['getString'](_0x3b6d48[_0x14db('0xc')],_0x40218a,'\x20')},{'name':'assigned_user_id','value':_0x1bd290['id']},{'name':_0x14db('0xd'),'value':_0x1bd290['id']},{'name':'description','value':intUtil['getString'](_0x3b6d48[_0x14db('0xe')],_0x40218a,'\x0a')},{'name':_0x14db('0xf'),'value':_0x3e5bf6[_0x14db('0x10')]()[_0x14db('0x11')](0x0,0x13)[_0x14db('0x12')]('T','\x20')},{'name':_0x14db('0x13'),'value':'0'},{'name':_0x14db('0x14'),'value':'15'},{'name':_0x14db('0x15'),'value':_0x582a3f['id']},{'name':'parent_type','value':_0x14db('0x16')},{'name':'parent_name','value':_0x582a3f[_0x14db('0xb')]},{'name':_0x14db('0x17'),'value':_0x320d54}];if(_0x40cf74['length']){_[_0x14db('0x18')](_0x40cf74,function(_0x33b531){if(_0x40218a[_0x33b531[_0x14db('0x19')]]){_0x315a6c[_0x14db('0x1a')]({'name':_0x33b531[_0x14db('0x1b')],'value':_0x40218a[_0x33b531['variableName']]});}});}return request({'form':{'method':_0x14db('0x1c'),'input_type':_0x14db('0x1d'),'response_type':_0x14db('0x1d'),'rest_data':JSON['stringify']({'session':_0x1cf3dc['id'],'module_name':_0x14db('0x1e'),'name_value_list':_0x315a6c})}});}function getAuth(_0x4bc993){return util[_0x14db('0x1f')](_0x14db('0x20'),new Buffer(_0x4bc993['apiKey']+':X')['toString']('base64'));}function getServerInfo(_0x5e6a8f){return request({'form':{'method':_0x14db('0x21'),'input_type':_0x14db('0x1d'),'response_type':_0x14db('0x1d'),'rest_data':JSON[_0x14db('0x22')]({'session':_0x5e6a8f['id']})}});}function getUser(_0x5e4827,_0x491e3b,_0x5d013a){if(!_[_0x14db('0x23')](_0x491e3b)){logger['info'](_0x14db('0x24'),_0x491e3b);return request({'form':{'method':'get_entry_list','input_type':_0x14db('0x1d'),'response_type':_0x14db('0x1d'),'rest_data':JSON[_0x14db('0x22')]({'session':_0x5d013a['id'],'module_name':'Employees','query':util[_0x14db('0x1f')]('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0x491e3b),'order_by':'','offset':'0','select_fields':['id',_0x14db('0xb'),_0x14db('0x25')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x14db('0x26')](function(_0x3617cc){if(_0x3617cc[_0x14db('0x27')][_0x14db('0x28')]){var _0x2a0b6f=_['find'](_0x3617cc[_0x14db('0x27')],function(_0x43f091){return _0x43f091[_0x14db('0x29')]['user_name']['value']===_0x491e3b;});if(_0x2a0b6f){logger[_0x14db('0xa')](_0x14db('0x2a'));return BPromise[_0x14db('0x2b')]({'id':_0x2a0b6f[_0x14db('0x29')]['id'][_0x14db('0x2c')],'name':_0x2a0b6f[_0x14db('0x29')][_0x14db('0xb')][_0x14db('0x2c')]});}}logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x14db('0x2b')]({'id':_0x5d013a['name_value_list'][_0x14db('0x2d')][_0x14db('0x2c')],'name':_0x5d013a[_0x14db('0x29')][_0x14db('0x25')][_0x14db('0x2c')]});});}else{logger['info'](_0x14db('0x2e'));return BPromise[_0x14db('0x2b')]({'id':_0x5d013a[_0x14db('0x29')][_0x14db('0x2d')]['value'],'name':_0x5d013a[_0x14db('0x29')][_0x14db('0x25')][_0x14db('0x2c')]});}}function getEndUser(_0x115318,_0x504f26,_0x59bf30,_0x2a20b4){logger[_0x14db('0xa')](_0x14db('0x2f'),_0x59bf30);return request({'form':{'method':_0x14db('0x30'),'input_type':_0x14db('0x1d'),'response_type':_0x14db('0x1d'),'rest_data':JSON['stringify']({'session':_0x2a20b4['id'],'module_name':'Contacts','query':util['format'](_0x14db('0x31'),_0x59bf30),'order_by':'','offset':'0','select_fields':['id','name',_0x14db('0x32')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x14db('0x26')](function(_0x3d69ab){if(_0x3d69ab[_0x14db('0x27')][_0x14db('0x28')]){var _0x160fc0=_[_0x14db('0x33')](_0x3d69ab['entry_list'],function(_0xfdd4b7){return _0xfdd4b7[_0x14db('0x29')][_0x14db('0x32')][_0x14db('0x2c')]===_0x59bf30;});if(_0x160fc0){logger[_0x14db('0xa')]('Enduser\x20found!');return BPromise[_0x14db('0x2b')]({'id':_0x160fc0[_0x14db('0x29')]['id'][_0x14db('0x2c')],'name':_0x160fc0[_0x14db('0x29')]['name']['value'],'phone':_0x160fc0[_0x14db('0x29')][_0x14db('0x32')][_0x14db('0x2c')]});}}else{logger[_0x14db('0xa')](_0x14db('0x34'));return request({'form':{'method':_0x14db('0x1c'),'input_type':'JSON','response_type':_0x14db('0x1d'),'rest_data':JSON[_0x14db('0x22')]({'session':_0x2a20b4['id'],'module_name':_0x14db('0x16'),'name_value_list':[{'name':'first_name','value':_0x504f26!==_0x14db('0x35')?_0x504f26:util['format'](_0x14db('0x36'),_0x59bf30)},{'name':_0x14db('0x32'),'value':_0x59bf30}]})}})[_0x14db('0x26')](function(_0x3dc5d1){logger[_0x14db('0xa')](_0x14db('0x37'));return BPromise[_0x14db('0x2b')]({'id':_0x3dc5d1['id'],'name':_0x3dc5d1[_0x14db('0x27')]['first_name']['value'],'phone':_0x3dc5d1[_0x14db('0x27')][_0x14db('0x32')][_0x14db('0x2c')]});});}});}function request(_0x14feef){logger[_0x14db('0x38')](_0x14db('0x39'),JSON[_0x14db('0x22')](_0x14feef));return rp(_['merge'](def,_0x14feef));}function getTags(_0x1b817e,_0x70852c){var _0x4c5c00=[];if(_0x1b817e&&_0x1b817e[_0x14db('0x28')]>0x0){_0x4c5c00=_[_0x14db('0x3a')](_0x1b817e,_0x70852c);}return _0x4c5c00;}function getCustomFields(_0x211c10,_0xd296dd){var _0x55ebaf=[];var _0x838be7={'custom_fields':[]};if(_0x211c10[_0x14db('0x28')]>0x0){_[_0x14db('0x18')](_0x211c10,function(_0x4680ac){if(_0x4680ac[_0x14db('0x3b')]===_0x14db('0x3c')&&_0x4680ac[_0x14db('0x3d')]&&!_0x4680ac[_0x14db('0x3e')]){_0x838be7[_0x4680ac['nameField'][_0x14db('0x3f')]()]=_0x4680ac['content'][_0x14db('0x40')]();}else if(_0x4680ac['type']==='string'&&_0x4680ac[_0x14db('0x1b')]&&_0x4680ac[_0x14db('0x3e')]){_0x838be7[_0x14db('0x41')][_0x14db('0x1a')]({'id':_0x4680ac[_0x14db('0x1b')],'value':_0x4680ac[_0x14db('0x42')][_0x14db('0x40')]()});}else if(_0x4680ac['type']===_0x14db('0x43')&&_0x4680ac[_0x14db('0x19')]&&_0x4680ac[_0x14db('0x1b')]&&_0x4680ac[_0x14db('0x3e')]){_0xd296dd[_0x4680ac[_0x14db('0x19')]]&&_0x838be7[_0x14db('0x41')][_0x14db('0x1a')]({'id':_0x4680ac[_0x14db('0x1b')],'value':_0xd296dd[_0x4680ac[_0x14db('0x19')]][_0x14db('0x40')]()});}else if(_0x4680ac['type']===_0x14db('0x44')&&_0x4680ac[_0x14db('0x45')]&&_0x4680ac[_0x14db('0x45')]['name']&&_0x4680ac['idField']&&_0x4680ac[_0x14db('0x3e')]){_0xd296dd[_0x4680ac['Variable']['name'][_0x14db('0x3f')]()]&&_0x838be7[_0x14db('0x41')]['push']({'id':_0x4680ac[_0x14db('0x1b')],'value':_0xd296dd[_0x4680ac[_0x14db('0x45')][_0x14db('0xb')][_0x14db('0x3f')]()][_0x14db('0x40')]()});}});}return _0x838be7;}function getConnection(_0x889b6e){return request({'method':_0x14db('0x8'),'form':{'method':_0x14db('0x46'),'input_type':'JSON','response_type':_0x14db('0x1d'),'rest_data':JSON[_0x14db('0x22')]({'user_auth':{'user_name':_0x889b6e[_0x14db('0x47')],'password':_0x889b6e['password'],'encryption':_0x14db('0x48')},'application':_0x14db('0x49')})}})[_0x14db('0x26')](function(_0x5a9241){var _0xd674ea=_0x5a9241;if(_0xd674ea['id']){def[_0x14db('0x4a')]=_0xd674ea['id'];return BPromise[_0x14db('0x2b')](_0xd674ea);}else{throw new Error(util[_0x14db('0x1f')](_0x14db('0x4b'),_0x889b6e['id']));}});}function setRelationship(_0x12b8e8,_0x510ac1,_0x43ed9c,_0x37abf4){return request({'form':{'method':_0x14db('0x4c'),'input_type':_0x14db('0x1d'),'response_type':_0x14db('0x1d'),'rest_data':JSON[_0x14db('0x22')]({'session':_0x12b8e8['id'],'module_name':_0x14db('0x1e'),'module_id':_0x43ed9c['id'],'link_field_name':_0x37abf4,'related_ids':[_0x510ac1['id']],'name_value_list':[],'delete':0x0})}});}exports['queue']=function(_0x32997e,_0x5c6c74,_0x20fa45,_0x4c09dd,_0x33d2dc,_0x3f9f85){var _0x5b4400,_0x393c17,_0x498a58,_0x351d38;_0x3f9f85[_0x14db('0x4d')]=intUtil[_0x14db('0x4e')](_0x3f9f85['remoteUri']);_0x3f9f85['serverUrl']=intUtil[_0x14db('0x4e')](_0x3f9f85[_0x14db('0x4f')]);def['uri']=util[_0x14db('0x1f')](_0x14db('0x50'),_0x3f9f85[_0x14db('0x4d')]);if(_0x33d2dc&&_0x33d2dc['monitor_format']){logger[_0x14db('0xa')]('[QUEUE]','Recording\x20is\x20enabled!');_0x5c6c74[_0x14db('0x51')]=util[_0x14db('0x1f')](_0x14db('0x52'),_0x3f9f85[_0x14db('0x4f')],_0x5c6c74[_0x14db('0x53')],md5(_0x5c6c74[_0x14db('0x53')]));}else{_0x5c6c74['recordingURL']='';}return getConnection(_0x3f9f85)[_0x14db('0x26')](function(_0x1fe2e7){_0x351d38=_0x1fe2e7;return getUser(_0x3f9f85,_0x4c09dd[_0x14db('0xb')],_0x351d38);})[_0x14db('0x26')](function(_0x509131){_0x5b4400=_0x509131;logger[_0x14db('0xa')](_0x14db('0x54'),_0x5b4400['id']);return getEndUser(_0x3f9f85,_0x5c6c74['calleridname'],_0x5c6c74[_0x14db('0x55')],_0x351d38);})[_0x14db('0x26')](function(_0x4d046b){_0x393c17=_0x4d046b;logger['info'](_0x14db('0x56'),_0x393c17['id']);return getTicket(_0x3f9f85,_0x5b4400,_0x393c17,_0x20fa45,_0x5c6c74,_0x20fa45[_0x14db('0x57')],_0x351d38,_0x14db('0x58'));})['then'](function(_0x549703){_0x498a58=_0x549703;logger['info'](_0x14db('0x59'));logger[_0x14db('0xa')]('The\x20Ticket\x20ID\x20is:',_0x498a58['id']);return setRelationship(_0x351d38,_0x5b4400,_0x498a58,'users');})[_0x14db('0x26')](function(){return setRelationship(_0x351d38,_0x393c17,_0x498a58,_0x14db('0x5a'));})[_0x14db('0x26')](function(){return getServerInfo(_0x351d38);})[_0x14db('0x26')](function(_0x50359e){var _0x523471=parseInt(_0x50359e[_0x14db('0x5b')][_0x14db('0x5c')](0x0));var _0x467b32=util[_0x14db('0x1f')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x3f9f85[_0x14db('0x4d')],_0x498a58['id']);if(_0x523471>0x6){_0x467b32=util[_0x14db('0x1f')](_0x14db('0x5d'),_0x3f9f85['remoteUri'],_0x498a58['id']);}logger[_0x14db('0xa')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x14db('0x1f')]('user:%s',_0x4c09dd['name']),_0x14db('0x5e'),{'uri':_0x467b32});})['catch'](function(_0x3b53ac){logger['error'](_0x14db('0x5f'),JSON[_0x14db('0x22')](_0x3b53ac));});};exports[_0x14db('0x60')]=function(_0x424ab0,_0x57cefa,_0x412dc0,_0x210c2d,_0x57f587,_0x180d74,_0x10f52c){var _0x18f018,_0x5868df,_0x42bec8,_0x7e1713;_0x180d74[_0x14db('0x4d')]=intUtil['stripTrailingSlash'](_0x180d74[_0x14db('0x4d')]);_0x180d74[_0x14db('0x4f')]=intUtil[_0x14db('0x4e')](_0x180d74[_0x14db('0x4f')]);def[_0x14db('0x61')]=util[_0x14db('0x1f')]('%s/service/v4_1/rest.php',_0x180d74[_0x14db('0x4d')]);if(_0x10f52c&&_0x10f52c['recordingFormat']&&_0x10f52c[_0x14db('0x62')]!==_0x14db('0x63')){logger['info'](_0x14db('0x64'),_0x14db('0x65'));_0x57cefa[_0x14db('0x51')]=util['format'](_0x14db('0x52'),_0x180d74[_0x14db('0x4f')],_0x57cefa['uniqueid'],md5(_0x57cefa[_0x14db('0x53')]));}return getConnection(_0x180d74)[_0x14db('0x26')](function(_0x5599b4){_0x7e1713=_0x5599b4;return getUser(_0x180d74,_0x210c2d[_0x14db('0xb')],_0x7e1713);})[_0x14db('0x26')](function(_0x2a5ad2){_0x18f018=_0x2a5ad2;logger[_0x14db('0xa')](_0x14db('0x54'),_0x18f018['id']);return getEndUser(_0x180d74,_0x57cefa[_0x14db('0x66')],_0x57cefa[_0x14db('0x67')],_0x7e1713);})[_0x14db('0x26')](function(_0x52e1eb){_0x5868df=_0x52e1eb;logger['info'](_0x14db('0x56'),_0x5868df['id']);return getTicket(_0x180d74,_0x18f018,_0x5868df,_0x412dc0,_0x57cefa,_0x412dc0[_0x14db('0x57')],_0x7e1713,_0x14db('0x68'));})[_0x14db('0x26')](function(_0x274c1e){_0x42bec8=_0x274c1e;logger[_0x14db('0xa')](_0x14db('0x59'));logger[_0x14db('0xa')](_0x14db('0x69'),_0x42bec8['id']);return setRelationship(_0x7e1713,_0x18f018,_0x42bec8,_0x14db('0x6a'));})[_0x14db('0x26')](function(){return setRelationship(_0x7e1713,_0x5868df,_0x42bec8,_0x14db('0x5a'));})[_0x14db('0x26')](function(){return getServerInfo(_0x7e1713);})[_0x14db('0x26')](function(_0x176168){var _0x13292b=parseInt(_0x176168['version']['charAt'](0x0));var _0x2f26a9=util['format'](_0x14db('0x6b'),_0x180d74[_0x14db('0x4d')],_0x42bec8['id']);if(_0x13292b>0x6){_0x2f26a9=util['format'](_0x14db('0x5d'),_0x180d74[_0x14db('0x4d')],_0x42bec8['id']);}logger[_0x14db('0xa')](_0x14db('0x64'),_0x14db('0x6c'));emit(util[_0x14db('0x1f')]('user:%s',_0x210c2d['name']),'trigger:browser:url',{'uri':_0x2f26a9});})['catch'](function(_0x2cd3c3){logger['error'](_0x14db('0x64'),JSON[_0x14db('0x22')](_0x2cd3c3));});};exports[_0x14db('0x6d')]=function(_0x339c58,_0x34fd86,_0x3e4bd1,_0x5977ae,_0x9e9bd2,_0x3cddcc){var _0x22ae0d,_0x5f0469,_0x5b71e7,_0x116070;_0x3cddcc[_0x14db('0x4d')]=intUtil[_0x14db('0x4e')](_0x3cddcc[_0x14db('0x4d')]);_0x3cddcc['serverUrl']=intUtil[_0x14db('0x4e')](_0x3cddcc[_0x14db('0x4f')]);def['uri']=util[_0x14db('0x1f')](_0x14db('0x50'),_0x3cddcc['remoteUri']);if(_0x9e9bd2&&_0x9e9bd2[_0x14db('0x6e')]){logger[_0x14db('0xa')]('['+_0x34fd86[_0x14db('0x6f')]['toUpperCase']()+']',_0x14db('0x65'));_0x34fd86[_0x14db('0x51')]=util[_0x14db('0x1f')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3cddcc[_0x14db('0x4f')],_0x34fd86[_0x14db('0x53')],md5(_0x34fd86[_0x14db('0x53')]));}else{_0x34fd86[_0x14db('0x51')]='';}return getConnection(_0x3cddcc)[_0x14db('0x26')](function(_0xfe1799){_0x116070=_0xfe1799;if(!_[_0x14db('0x23')](_0x5977ae)){return getUser(_0x3cddcc,_0x5977ae['name'],_0x116070);}else{return getUser(_0x3cddcc,null,_0x116070);}})[_0x14db('0x26')](function(_0x31b58f){_0x22ae0d=_0x31b58f;logger['info'](_0x14db('0x54'),_0x22ae0d['id']);return getEndUser(_0x3cddcc,_0x34fd86[_0x14db('0x70')],_0x34fd86[_0x14db('0x55')],_0x116070);})['then'](function(_0x273869){_0x5f0469=_0x273869;logger['info'](_0x14db('0x56'),_0x5f0469['id']);return getTicket(_0x3cddcc,_0x22ae0d,_0x5f0469,_0x3e4bd1,_0x34fd86,_0x3e4bd1[_0x14db('0x57')],_0x116070,_0x14db('0x58'));})['then'](function(_0x23fba3){_0x5b71e7=_0x23fba3;logger[_0x14db('0xa')](_0x14db('0x59'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x5b71e7['id']);return setRelationship(_0x116070,_0x22ae0d,_0x5b71e7,_0x14db('0x6a'));})[_0x14db('0x26')](function(){return setRelationship(_0x116070,_0x5f0469,_0x5b71e7,_0x14db('0x5a'));})[_0x14db('0x26')](function(){return getServerInfo(_0x116070);})[_0x14db('0x71')](function(_0x44b1d0){logger[_0x14db('0x72')]('['+_0x34fd86['lastevent'][_0x14db('0x73')]()+']',JSON[_0x14db('0x22')](_0x44b1d0));});}; \ No newline at end of file +var _0x874e=['Fields','contacts','bluebird','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','POST','info','getString','assigned_user_id','created_by','Descriptions','replace','duration_hours','parent_id','parent_type','Contacts','parent_name','direction','length','forEach','variableName','idField','set_entry','JSON','stringify','Calls','format','apiKey','toString','base64','get_server_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!','resolve','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','name','','first_name','debug','[HTTP]','merge','string','nameField','customField','toLowerCase','content','push','type','variable','custom_fields','customVariable','Variable','login','username','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','queue','remoteUri','serverUrl','stripTrailingSlash','uri','%s/service/v4_1/rest.php','Recording\x20is\x20enabled!','recordingURL','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','Ticket\x20created!','version','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','[QUEUE]','user:%s','catch','error','outbound','recordingFormat','none','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','Outbound','The\x20Ticket\x20ID\x20is:','users','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','[OUTBOUND]','unmanaged','monitor_format','lastevent','toUpperCase'];(function(_0x3325a5,_0x1a57b9){var _0x15c006=function(_0x4ccce9){while(--_0x4ccce9){_0x3325a5['push'](_0x3325a5['shift']());}};_0x15c006(++_0x1a57b9);}(_0x874e,0x75));var _0xe874=function(_0xa8883,_0x1f107f){_0xa8883=_0xa8883-0x0;var _0x479426=_0x874e[_0xa8883];return _0x479426;};'use strict';var _=require('lodash');var rp=require('request-promise');var BPromise=require(_0xe874('0x0'));var md5=require(_0xe874('0x1'));var util=require(_0xe874('0x2'));var Redis=require(_0xe874('0x3'));var intUtil=require(_0xe874('0x4'));var config=require(_0xe874('0x5'));var logger=require(_0xe874('0x6'))('sugarcrm');config[_0xe874('0x7')]=_[_0xe874('0x8')](config[_0xe874('0x7')],{'host':_0xe874('0x9'),'port':0x18eb});var io=require(_0xe874('0xa'))(new Redis(config[_0xe874('0x7')]));var def={'method':_0xe874('0xb'),'json':!![]};function emit(_0x4be725,_0x3cdd41,_0x160fb2){io['to'](_0x4be725)['emit'](_0x3cdd41,_0x160fb2);}function getTicket(_0x4f6b3a,_0x187d1d,_0x519b2c,_0x204b1c,_0x5f5ece,_0x202cb5,_0x35699b,_0x437b08){logger[_0xe874('0xc')]('Creating\x20new\x20ticket...');var _0x1e18b6=new Date();var _0x3f2970=[{'name':'name','value':intUtil[_0xe874('0xd')](_0x204b1c['Subjects'],_0x5f5ece,'\x20')},{'name':_0xe874('0xe'),'value':_0x187d1d['id']},{'name':_0xe874('0xf'),'value':_0x187d1d['id']},{'name':'description','value':intUtil['getString'](_0x204b1c[_0xe874('0x10')],_0x5f5ece,'\x0a')},{'name':'date_start','value':_0x1e18b6['toISOString']()['slice'](0x0,0x13)[_0xe874('0x11')]('T','\x20')},{'name':_0xe874('0x12'),'value':'0'},{'name':'duration_minutes','value':'15'},{'name':_0xe874('0x13'),'value':_0x519b2c['id']},{'name':_0xe874('0x14'),'value':_0xe874('0x15')},{'name':_0xe874('0x16'),'value':_0x519b2c['name']},{'name':_0xe874('0x17'),'value':_0x437b08}];if(_0x202cb5[_0xe874('0x18')]){_[_0xe874('0x19')](_0x202cb5,function(_0x219b1e){if(_0x5f5ece[_0x219b1e[_0xe874('0x1a')]]){_0x3f2970['push']({'name':_0x219b1e[_0xe874('0x1b')],'value':_0x5f5ece[_0x219b1e['variableName']]});}});}return request({'form':{'method':_0xe874('0x1c'),'input_type':'JSON','response_type':_0xe874('0x1d'),'rest_data':JSON[_0xe874('0x1e')]({'session':_0x35699b['id'],'module_name':_0xe874('0x1f'),'name_value_list':_0x3f2970})}});}function getAuth(_0x116bea){return util[_0xe874('0x20')]('Basic\x20%s',new Buffer(_0x116bea[_0xe874('0x21')]+':X')[_0xe874('0x22')](_0xe874('0x23')));}function getServerInfo(_0x557b28){return request({'form':{'method':_0xe874('0x24'),'input_type':_0xe874('0x1d'),'response_type':'JSON','rest_data':JSON[_0xe874('0x1e')]({'session':_0x557b28['id']})}});}function getUser(_0x2ca349,_0x518f7c,_0x13c86d){if(!_['isNil'](_0x518f7c)){logger[_0xe874('0xc')](_0xe874('0x25'),_0x518f7c);return request({'form':{'method':_0xe874('0x26'),'input_type':_0xe874('0x1d'),'response_type':_0xe874('0x1d'),'rest_data':JSON['stringify']({'session':_0x13c86d['id'],'module_name':_0xe874('0x27'),'query':util[_0xe874('0x20')](_0xe874('0x28'),_0x518f7c),'order_by':'','offset':'0','select_fields':['id','name',_0xe874('0x29')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xe874('0x2a')](function(_0x270862){if(_0x270862[_0xe874('0x2b')][_0xe874('0x18')]){var _0xab0888=_[_0xe874('0x2c')](_0x270862[_0xe874('0x2b')],function(_0x3bd4e6){return _0x3bd4e6[_0xe874('0x2d')]['user_name'][_0xe874('0x2e')]===_0x518f7c;});if(_0xab0888){logger[_0xe874('0xc')](_0xe874('0x2f'));return BPromise[_0xe874('0x30')]({'id':_0xab0888[_0xe874('0x2d')]['id'][_0xe874('0x2e')],'name':_0xab0888[_0xe874('0x2d')]['name'][_0xe874('0x2e')]});}}logger[_0xe874('0xc')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0xe874('0x30')]({'id':_0x13c86d['name_value_list'][_0xe874('0x31')][_0xe874('0x2e')],'name':_0x13c86d['name_value_list'][_0xe874('0x29')][_0xe874('0x2e')]});});}else{logger['info'](_0xe874('0x32'));return BPromise['resolve']({'id':_0x13c86d[_0xe874('0x2d')][_0xe874('0x31')][_0xe874('0x2e')],'name':_0x13c86d['name_value_list'][_0xe874('0x29')][_0xe874('0x2e')]});}}function getEndUser(_0x30ff33,_0x443097,_0xbba5ee,_0x676ad1){logger[_0xe874('0xc')](_0xe874('0x33'),_0xbba5ee);return request({'form':{'method':_0xe874('0x26'),'input_type':_0xe874('0x1d'),'response_type':_0xe874('0x1d'),'rest_data':JSON[_0xe874('0x1e')]({'session':_0x676ad1['id'],'module_name':_0xe874('0x15'),'query':util['format'](_0xe874('0x34'),_0xbba5ee),'order_by':'','offset':'0','select_fields':['id','name',_0xe874('0x35')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xe874('0x2a')](function(_0x5743b3){if(_0x5743b3[_0xe874('0x2b')][_0xe874('0x18')]){var _0x401633=_[_0xe874('0x2c')](_0x5743b3[_0xe874('0x2b')],function(_0x1e41a0){return _0x1e41a0[_0xe874('0x2d')][_0xe874('0x35')][_0xe874('0x2e')]===_0xbba5ee;});if(_0x401633){logger['info']('Enduser\x20found!');return BPromise[_0xe874('0x30')]({'id':_0x401633[_0xe874('0x2d')]['id']['value'],'name':_0x401633['name_value_list'][_0xe874('0x36')][_0xe874('0x2e')],'phone':_0x401633[_0xe874('0x2d')][_0xe874('0x35')][_0xe874('0x2e')]});}}else{logger[_0xe874('0xc')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':_0xe874('0x1c'),'input_type':_0xe874('0x1d'),'response_type':'JSON','rest_data':JSON[_0xe874('0x1e')]({'session':_0x676ad1['id'],'module_name':_0xe874('0x15'),'name_value_list':[{'name':'first_name','value':_0x443097!==_0xe874('0x37')?_0x443097:util[_0xe874('0x20')]('Caller\x20-\x20%s',_0xbba5ee)},{'name':_0xe874('0x35'),'value':_0xbba5ee}]})}})[_0xe874('0x2a')](function(_0x4e94f5){logger[_0xe874('0xc')]('Enduser\x20created.');return BPromise[_0xe874('0x30')]({'id':_0x4e94f5['id'],'name':_0x4e94f5[_0xe874('0x2b')][_0xe874('0x38')][_0xe874('0x2e')],'phone':_0x4e94f5[_0xe874('0x2b')][_0xe874('0x35')][_0xe874('0x2e')]});});}});}function request(_0x271815){logger[_0xe874('0x39')](_0xe874('0x3a'),JSON[_0xe874('0x1e')](_0x271815));return rp(_[_0xe874('0x3b')](def,_0x271815));}function getTags(_0x38b737,_0x15fbe2){var _0x1df84e=[];if(_0x38b737&&_0x38b737[_0xe874('0x18')]>0x0){_0x1df84e=_['map'](_0x38b737,_0x15fbe2);}return _0x1df84e;}function getCustomFields(_0x4e6c03,_0x397307){var _0x106372=[];var _0x653c3b={'custom_fields':[]};if(_0x4e6c03['length']>0x0){_[_0xe874('0x19')](_0x4e6c03,function(_0x30f1c7){if(_0x30f1c7['type']===_0xe874('0x3c')&&_0x30f1c7[_0xe874('0x3d')]&&!_0x30f1c7[_0xe874('0x3e')]){_0x653c3b[_0x30f1c7[_0xe874('0x3d')][_0xe874('0x3f')]()]=_0x30f1c7[_0xe874('0x40')][_0xe874('0x22')]();}else if(_0x30f1c7['type']===_0xe874('0x3c')&&_0x30f1c7[_0xe874('0x1b')]&&_0x30f1c7[_0xe874('0x3e')]){_0x653c3b['custom_fields'][_0xe874('0x41')]({'id':_0x30f1c7[_0xe874('0x1b')],'value':_0x30f1c7[_0xe874('0x40')]['toString']()});}else if(_0x30f1c7[_0xe874('0x42')]===_0xe874('0x43')&&_0x30f1c7['variableName']&&_0x30f1c7['idField']&&_0x30f1c7[_0xe874('0x3e')]){_0x397307[_0x30f1c7['variableName']]&&_0x653c3b[_0xe874('0x44')][_0xe874('0x41')]({'id':_0x30f1c7[_0xe874('0x1b')],'value':_0x397307[_0x30f1c7['variableName']][_0xe874('0x22')]()});}else if(_0x30f1c7['type']===_0xe874('0x45')&&_0x30f1c7[_0xe874('0x46')]&&_0x30f1c7[_0xe874('0x46')]['name']&&_0x30f1c7[_0xe874('0x1b')]&&_0x30f1c7[_0xe874('0x3e')]){_0x397307[_0x30f1c7[_0xe874('0x46')][_0xe874('0x36')]['toLowerCase']()]&&_0x653c3b[_0xe874('0x44')][_0xe874('0x41')]({'id':_0x30f1c7[_0xe874('0x1b')],'value':_0x397307[_0x30f1c7[_0xe874('0x46')][_0xe874('0x36')][_0xe874('0x3f')]()][_0xe874('0x22')]()});}});}return _0x653c3b;}function getConnection(_0xe80a13){return request({'method':_0xe874('0xb'),'form':{'method':_0xe874('0x47'),'input_type':'JSON','response_type':_0xe874('0x1d'),'rest_data':JSON[_0xe874('0x1e')]({'user_auth':{'user_name':_0xe80a13[_0xe874('0x48')],'password':_0xe80a13[_0xe874('0x49')],'encryption':_0xe874('0x4a')},'application':_0xe874('0x4b')})}})[_0xe874('0x2a')](function(_0x28330b){var _0x570153=_0x28330b;if(_0x570153['id']){def[_0xe874('0x4c')]=_0x570153['id'];return BPromise[_0xe874('0x30')](_0x570153);}else{throw new Error(util[_0xe874('0x20')]('Account\x20%d\x20is\x20not\x20valid',_0xe80a13['id']));}});}function setRelationship(_0x1a30d5,_0x47dc43,_0x2f1637,_0x52f4c2){return request({'form':{'method':'set_relationship','input_type':_0xe874('0x1d'),'response_type':_0xe874('0x1d'),'rest_data':JSON['stringify']({'session':_0x1a30d5['id'],'module_name':_0xe874('0x1f'),'module_id':_0x2f1637['id'],'link_field_name':_0x52f4c2,'related_ids':[_0x47dc43['id']],'name_value_list':[],'delete':0x0})}});}exports[_0xe874('0x4d')]=function(_0x4739eb,_0x2f3583,_0x521b92,_0x516203,_0x222021,_0x52c399){var _0x2610a5,_0x4a88e4,_0x4908f6,_0x2a27fb;_0x52c399[_0xe874('0x4e')]=intUtil['stripTrailingSlash'](_0x52c399[_0xe874('0x4e')]);_0x52c399[_0xe874('0x4f')]=intUtil[_0xe874('0x50')](_0x52c399[_0xe874('0x4f')]);def[_0xe874('0x51')]=util[_0xe874('0x20')](_0xe874('0x52'),_0x52c399[_0xe874('0x4e')]);if(_0x222021&&_0x222021['monitor_format']){logger['info']('[QUEUE]',_0xe874('0x53'));_0x2f3583[_0xe874('0x54')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x52c399[_0xe874('0x4f')],_0x2f3583[_0xe874('0x55')],md5(_0x2f3583[_0xe874('0x55')]));}else{_0x2f3583['recordingURL']='';}return getConnection(_0x52c399)['then'](function(_0x2cb666){_0x2a27fb=_0x2cb666;return getUser(_0x52c399,_0x516203[_0xe874('0x36')],_0x2a27fb);})[_0xe874('0x2a')](function(_0x478046){_0x2610a5=_0x478046;logger[_0xe874('0xc')](_0xe874('0x56'),_0x2610a5['id']);return getEndUser(_0x52c399,_0x2f3583[_0xe874('0x57')],_0x2f3583[_0xe874('0x58')],_0x2a27fb);})['then'](function(_0x118a9d){_0x4a88e4=_0x118a9d;logger['info']('The\x20Enduser\x20ID\x20is:',_0x4a88e4['id']);return getTicket(_0x52c399,_0x2610a5,_0x4a88e4,_0x521b92,_0x2f3583,_0x521b92['Fields'],_0x2a27fb,'Inbound');})[_0xe874('0x2a')](function(_0x349641){_0x4908f6=_0x349641;logger[_0xe874('0xc')](_0xe874('0x59'));logger[_0xe874('0xc')]('The\x20Ticket\x20ID\x20is:',_0x4908f6['id']);return setRelationship(_0x2a27fb,_0x2610a5,_0x4908f6,'users');})[_0xe874('0x2a')](function(){return setRelationship(_0x2a27fb,_0x4a88e4,_0x4908f6,'contacts');})['then'](function(){return getServerInfo(_0x2a27fb);})[_0xe874('0x2a')](function(_0x175657){var _0x1411ed=parseInt(_0x175657[_0xe874('0x5a')]['charAt'](0x0));var _0x5bd427=util[_0xe874('0x20')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x52c399[_0xe874('0x4e')],_0x4908f6['id']);if(_0x1411ed>0x6){_0x5bd427=util[_0xe874('0x20')](_0xe874('0x5b'),_0x52c399[_0xe874('0x4e')],_0x4908f6['id']);}logger['info'](_0xe874('0x5c'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xe874('0x20')](_0xe874('0x5d'),_0x516203['name']),'trigger:browser:url',{'uri':_0x5bd427});})[_0xe874('0x5e')](function(_0x1a2d72){logger[_0xe874('0x5f')](_0xe874('0x5c'),JSON['stringify'](_0x1a2d72));});};exports[_0xe874('0x60')]=function(_0x390c19,_0x3edc15,_0x14be84,_0x3cd27b,_0x2665ee,_0x3a3b88,_0x91e526){var _0x5700de,_0x499db1,_0x5e886a,_0x38ce75;_0x3a3b88[_0xe874('0x4e')]=intUtil['stripTrailingSlash'](_0x3a3b88[_0xe874('0x4e')]);_0x3a3b88[_0xe874('0x4f')]=intUtil['stripTrailingSlash'](_0x3a3b88[_0xe874('0x4f')]);def[_0xe874('0x51')]=util[_0xe874('0x20')]('%s/service/v4_1/rest.php',_0x3a3b88[_0xe874('0x4e')]);if(_0x91e526&&_0x91e526[_0xe874('0x61')]&&_0x91e526['recordingFormat']!==_0xe874('0x62')){logger[_0xe874('0xc')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x3edc15[_0xe874('0x54')]=util['format'](_0xe874('0x63'),_0x3a3b88['serverUrl'],_0x3edc15[_0xe874('0x55')],md5(_0x3edc15['uniqueid']));}return getConnection(_0x3a3b88)[_0xe874('0x2a')](function(_0x459237){_0x38ce75=_0x459237;return getUser(_0x3a3b88,_0x3cd27b[_0xe874('0x36')],_0x38ce75);})[_0xe874('0x2a')](function(_0x30a515){_0x5700de=_0x30a515;logger['info'](_0xe874('0x56'),_0x5700de['id']);return getEndUser(_0x3a3b88,_0x3edc15[_0xe874('0x64')],_0x3edc15[_0xe874('0x65')],_0x38ce75);})[_0xe874('0x2a')](function(_0x4c0227){_0x499db1=_0x4c0227;logger[_0xe874('0xc')](_0xe874('0x66'),_0x499db1['id']);return getTicket(_0x3a3b88,_0x5700de,_0x499db1,_0x14be84,_0x3edc15,_0x14be84['Fields'],_0x38ce75,_0xe874('0x67'));})[_0xe874('0x2a')](function(_0x4406fa){_0x5e886a=_0x4406fa;logger[_0xe874('0xc')](_0xe874('0x59'));logger[_0xe874('0xc')](_0xe874('0x68'),_0x5e886a['id']);return setRelationship(_0x38ce75,_0x5700de,_0x5e886a,_0xe874('0x69'));})[_0xe874('0x2a')](function(){return setRelationship(_0x38ce75,_0x499db1,_0x5e886a,'contacts');})[_0xe874('0x2a')](function(){return getServerInfo(_0x38ce75);})[_0xe874('0x2a')](function(_0x21f679){var _0x41a281=parseInt(_0x21f679['version'][_0xe874('0x6a')](0x0));var _0x450c5b=util[_0xe874('0x20')](_0xe874('0x6b'),_0x3a3b88[_0xe874('0x4e')],_0x5e886a['id']);if(_0x41a281>0x6){_0x450c5b=util[_0xe874('0x20')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x3a3b88[_0xe874('0x4e')],_0x5e886a['id']);}logger[_0xe874('0xc')](_0xe874('0x6c'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xe874('0x20')](_0xe874('0x5d'),_0x3cd27b[_0xe874('0x36')]),'trigger:browser:url',{'uri':_0x450c5b});})['catch'](function(_0x597979){logger[_0xe874('0x5f')](_0xe874('0x6c'),JSON[_0xe874('0x1e')](_0x597979));});};exports[_0xe874('0x6d')]=function(_0x42f402,_0x19e138,_0x12a542,_0xf3fe88,_0x2de944,_0x3f4f6d){var _0x38b197,_0x38e24e,_0x289575,_0x584bd3;_0x3f4f6d[_0xe874('0x4e')]=intUtil[_0xe874('0x50')](_0x3f4f6d['remoteUri']);_0x3f4f6d[_0xe874('0x4f')]=intUtil[_0xe874('0x50')](_0x3f4f6d['serverUrl']);def[_0xe874('0x51')]=util[_0xe874('0x20')]('%s/service/v4_1/rest.php',_0x3f4f6d[_0xe874('0x4e')]);if(_0x2de944&&_0x2de944[_0xe874('0x6e')]){logger['info']('['+_0x19e138[_0xe874('0x6f')][_0xe874('0x70')]()+']',_0xe874('0x53'));_0x19e138[_0xe874('0x54')]=util[_0xe874('0x20')](_0xe874('0x63'),_0x3f4f6d['serverUrl'],_0x19e138[_0xe874('0x55')],md5(_0x19e138[_0xe874('0x55')]));}else{_0x19e138[_0xe874('0x54')]='';}return getConnection(_0x3f4f6d)[_0xe874('0x2a')](function(_0x4a2e1b){_0x584bd3=_0x4a2e1b;if(!_['isNil'](_0xf3fe88)){return getUser(_0x3f4f6d,_0xf3fe88[_0xe874('0x36')],_0x584bd3);}else{return getUser(_0x3f4f6d,null,_0x584bd3);}})[_0xe874('0x2a')](function(_0x5073cc){_0x38b197=_0x5073cc;logger[_0xe874('0xc')](_0xe874('0x56'),_0x38b197['id']);return getEndUser(_0x3f4f6d,_0x19e138[_0xe874('0x57')],_0x19e138[_0xe874('0x58')],_0x584bd3);})['then'](function(_0x1d02d6){_0x38e24e=_0x1d02d6;logger['info'](_0xe874('0x66'),_0x38e24e['id']);return getTicket(_0x3f4f6d,_0x38b197,_0x38e24e,_0x12a542,_0x19e138,_0x12a542[_0xe874('0x71')],_0x584bd3,'Inbound');})[_0xe874('0x2a')](function(_0x2828c7){_0x289575=_0x2828c7;logger['info']('Ticket\x20created!');logger[_0xe874('0xc')]('The\x20Ticket\x20ID\x20is:',_0x289575['id']);return setRelationship(_0x584bd3,_0x38b197,_0x289575,_0xe874('0x69'));})['then'](function(){return setRelationship(_0x584bd3,_0x38e24e,_0x289575,_0xe874('0x72'));})[_0xe874('0x2a')](function(){return getServerInfo(_0x584bd3);})[_0xe874('0x5e')](function(_0x5d70ff){logger[_0xe874('0x5f')]('['+_0x19e138[_0xe874('0x6f')]['toUpperCase']()+']',JSON[_0xe874('0x1e')](_0x5d70ff));});}; \ 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 e83e8fe..7adcaf6 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 _0x82d2=['keyType','key','format','%s:\x20%s','slice','substring','lastIndexOf','validateEmail','isNil','test','lodash','util','getString','length','sortBy','type','string','push','content','variableName','toString','customVariable','Variable','name','toLowerCase','keyValue'];(function(_0xccf22,_0x128718){var _0x229229=function(_0x2ef7ae){while(--_0x2ef7ae){_0xccf22['push'](_0xccf22['shift']());}};_0x229229(++_0x128718);}(_0x82d2,0x8c));var _0x282d=function(_0x281bd7,_0x11a709){_0x281bd7=_0x281bd7-0x0;var _0x3d05c2=_0x82d2[_0x281bd7];return _0x3d05c2;};'use strict';var _=require(_0x282d('0x0'));var util=require(_0x282d('0x1'));exports[_0x282d('0x2')]=function(_0x2a0ee7,_0x4e890b,_0x454882){var _0x215996=[];if(_0x2a0ee7[_0x282d('0x3')]>0x0){var _0x4ec9c6=_[_0x282d('0x4')](_0x2a0ee7,['id']);for(var _0x3a0822=0x0;_0x3a0822<_0x4ec9c6['length'];_0x3a0822++){var _0x5e6d5b=_0x4ec9c6[_0x3a0822];if(_0x5e6d5b[_0x282d('0x5')]===_0x282d('0x6')){_0x215996[_0x282d('0x7')](_0x5e6d5b[_0x282d('0x8')]);}else if(_0x5e6d5b[_0x282d('0x5')]==='variable'&&_0x5e6d5b['variableName']){_0x4e890b[_0x5e6d5b['variableName']]&&_0x215996['push'](_0x4e890b[_0x5e6d5b[_0x282d('0x9')]][_0x282d('0xa')]());}else if(_0x5e6d5b[_0x282d('0x5')]===_0x282d('0xb')&&_0x5e6d5b[_0x282d('0xc')]&&_0x5e6d5b[_0x282d('0xc')]['name']){_0x4e890b[_0x5e6d5b['Variable'][_0x282d('0xd')][_0x282d('0xe')]()]&&_0x215996['push'](_0x4e890b[_0x5e6d5b[_0x282d('0xc')]['name']['toLowerCase']()]['toString']());}else if(_0x5e6d5b[_0x282d('0x5')]===_0x282d('0xf')){if(_0x5e6d5b[_0x282d('0x10')]===_0x282d('0x6')&&_0x5e6d5b[_0x282d('0x11')]){_0x215996[_0x282d('0x7')](util[_0x282d('0x12')](_0x282d('0x13'),_0x5e6d5b[_0x282d('0x11')],_0x5e6d5b['keyContent']));}else if(_0x5e6d5b[_0x282d('0x10')]==='variable'&&_0x5e6d5b[_0x282d('0x9')]&&_0x5e6d5b[_0x282d('0x11')]){_0x4e890b[_0x5e6d5b[_0x282d('0x9')]]&&_0x215996['push'](util[_0x282d('0x12')](_0x282d('0x13'),_0x5e6d5b['key'],_0x4e890b[_0x5e6d5b[_0x282d('0x9')]]));}else if(_0x5e6d5b[_0x282d('0x10')]==='customVariable'&&_0x5e6d5b[_0x282d('0xc')]&&_0x5e6d5b['Variable'][_0x282d('0xd')]&&_0x5e6d5b[_0x282d('0x11')]){_0x4e890b[_0x5e6d5b[_0x282d('0xc')][_0x282d('0xd')][_0x282d('0xe')]()]&&_0x215996['push'](util[_0x282d('0x12')](_0x282d('0x13'),_0x5e6d5b['key'],_0x4e890b[_0x5e6d5b['Variable'][_0x282d('0xd')]['toLowerCase']()]));}}}}return _0x215996['join'](_0x454882);};exports['stripTrailingSlash']=function(_0x261678){var _0x34c998=_0x261678[_0x282d('0x14')](-0x1);if(_0x34c998==='/'){_0x261678=_0x261678[_0x282d('0x15')](0x0,_0x261678[_0x282d('0x16')](_0x34c998));}return _0x261678;};exports[_0x282d('0x17')]=function(_0x44efa9){if(!_[_0x282d('0x18')](_0x44efa9)&&_0x44efa9!==''){var _0x4d5209=/^(([^<>()\[\]\\.,;:\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 _0x4d5209[_0x282d('0x19')](String(_0x44efa9)[_0x282d('0xe')]());}else{return![];}}; \ No newline at end of file +var _0xe58a=['keyType','join','stripTrailingSlash','slice','lastIndexOf','validateEmail','test','lodash','util','getString','sortBy','type','push','content','variable','variableName','customVariable','Variable','name','toLowerCase','string','key','format','%s:\x20%s','keyContent'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe58a,0x133));var _0xae58=function(_0x1b3d2f,_0x3ed224){_0x1b3d2f=_0x1b3d2f-0x0;var _0x11db0b=_0xe58a[_0x1b3d2f];return _0x11db0b;};'use strict';var _=require(_0xae58('0x0'));var util=require(_0xae58('0x1'));exports[_0xae58('0x2')]=function(_0x3ee3e5,_0x4f51cc,_0x118ff7){var _0x23b28a=[];if(_0x3ee3e5['length']>0x0){var _0x1f7e82=_[_0xae58('0x3')](_0x3ee3e5,['id']);for(var _0xc714b2=0x0;_0xc714b2<_0x1f7e82['length'];_0xc714b2++){var _0x259b8c=_0x1f7e82[_0xc714b2];if(_0x259b8c[_0xae58('0x4')]==='string'){_0x23b28a[_0xae58('0x5')](_0x259b8c[_0xae58('0x6')]);}else if(_0x259b8c['type']===_0xae58('0x7')&&_0x259b8c[_0xae58('0x8')]){_0x4f51cc[_0x259b8c[_0xae58('0x8')]]&&_0x23b28a[_0xae58('0x5')](_0x4f51cc[_0x259b8c[_0xae58('0x8')]]['toString']());}else if(_0x259b8c[_0xae58('0x4')]===_0xae58('0x9')&&_0x259b8c['Variable']&&_0x259b8c[_0xae58('0xa')]['name']){_0x4f51cc[_0x259b8c[_0xae58('0xa')][_0xae58('0xb')][_0xae58('0xc')]()]&&_0x23b28a[_0xae58('0x5')](_0x4f51cc[_0x259b8c[_0xae58('0xa')][_0xae58('0xb')]['toLowerCase']()]['toString']());}else if(_0x259b8c[_0xae58('0x4')]==='keyValue'){if(_0x259b8c['keyType']===_0xae58('0xd')&&_0x259b8c[_0xae58('0xe')]){_0x23b28a[_0xae58('0x5')](util[_0xae58('0xf')](_0xae58('0x10'),_0x259b8c['key'],_0x259b8c[_0xae58('0x11')]));}else if(_0x259b8c[_0xae58('0x12')]===_0xae58('0x7')&&_0x259b8c[_0xae58('0x8')]&&_0x259b8c[_0xae58('0xe')]){_0x4f51cc[_0x259b8c[_0xae58('0x8')]]&&_0x23b28a['push'](util[_0xae58('0xf')](_0xae58('0x10'),_0x259b8c['key'],_0x4f51cc[_0x259b8c[_0xae58('0x8')]]));}else if(_0x259b8c[_0xae58('0x12')]===_0xae58('0x9')&&_0x259b8c['Variable']&&_0x259b8c['Variable'][_0xae58('0xb')]&&_0x259b8c[_0xae58('0xe')]){_0x4f51cc[_0x259b8c['Variable'][_0xae58('0xb')][_0xae58('0xc')]()]&&_0x23b28a[_0xae58('0x5')](util['format'](_0xae58('0x10'),_0x259b8c[_0xae58('0xe')],_0x4f51cc[_0x259b8c[_0xae58('0xa')][_0xae58('0xb')]['toLowerCase']()]));}}}}return _0x23b28a[_0xae58('0x13')](_0x118ff7);};exports[_0xae58('0x14')]=function(_0x29c81a){var _0x285124=_0x29c81a[_0xae58('0x15')](-0x1);if(_0x285124==='/'){_0x29c81a=_0x29c81a['substring'](0x0,_0x29c81a[_0xae58('0x16')](_0x285124));}return _0x29c81a;};exports[_0xae58('0x17')]=function(_0x34eadc){if(!_['isNil'](_0x34eadc)&&_0x34eadc!==''){var _0x3583a9=/^(([^<>()\[\]\\.,;:\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 _0x3583a9[_0xae58('0x18')](String(_0x34eadc)[_0xae58('0xc')]());}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 d3ad4fc..ac5e497 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 _0x9c44=['stringify','validateEmail','Getting\x20agent\x20with\x20email','GET','%s/webservice.php','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','length','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','getUser','admin','Searching\x20end\x20user\x20with\x20phone','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','login','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','stripTrailingSlash','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','recordingURL','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Fields','The\x20Ticket\x20ID\x20is:','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridnum','lastevent','bluebird','md5','util','ioredis','./util','../../../../config/environment','redis','localhost','socket.io-emitter','emit','forEach','string','picklist','idField','content','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','getString','Subjects','POST','remoteUri','create','username','sessionName','then','resolve','result','format','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s'];(function(_0x4e5918,_0x57150b){var _0x154990=function(_0x19b730){while(--_0x19b730){_0x4e5918['push'](_0x4e5918['shift']());}};_0x154990(++_0x57150b);}(_0x9c44,0x178));var _0x49c4=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0x9c44[_0x2d2c16];return _0x53f2fb;};'use strict';var _=require('lodash');var rp=require('request-promise');var BPromise=require(_0x49c4('0x0'));var md5=require(_0x49c4('0x1'));var util=require(_0x49c4('0x2'));var Redis=require(_0x49c4('0x3'));var intUtil=require(_0x49c4('0x4'));var config=require(_0x49c4('0x5'));var logger=require('../../../../config/logger')('vTiger');config[_0x49c4('0x6')]=_['defaults'](config[_0x49c4('0x6')],{'host':_0x49c4('0x7'),'port':0x18eb});var io=require(_0x49c4('0x8'))(new Redis(config[_0x49c4('0x6')]));function emit(_0x436234,_0x511d53,_0x11c586){io['to'](_0x436234)[_0x49c4('0x9')](_0x511d53,_0x11c586);}function getCustomFields(_0x1d13fb,_0x4487ca){var _0x4c7d3a={};if(_0x1d13fb['length']>0x0){_[_0x49c4('0xa')](_0x1d13fb,function(_0x313e73){if(_['includes']([_0x49c4('0xb'),_0x49c4('0xc')],_0x313e73['type'])&&_0x313e73['idField']){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x313e73[_0x49c4('0xe')]['toString']();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x10')&&_0x313e73['variableName']&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x11')]]){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x4487ca[_0x313e73[_0x49c4('0x11')]][_0x49c4('0x12')]();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x13')&&_0x313e73[_0x49c4('0x14')]&&_0x313e73['Variable'][_0x49c4('0x15')]&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')][_0x49c4('0x16')]()]){_0x4c7d3a[_0x313e73['idField']]=_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')]['toLowerCase']()]['toString']();}});}return _0x4c7d3a;}function createTicket(_0x3c782d,_0x2f82d5,_0x3addb2,_0x59f29b,_0x24856d,_0x50b151,_0x2cbd50){logger[_0x49c4('0x17')](_0x49c4('0x18'));var _0x291526=_[_0x49c4('0x19')]({'parent_id':'','assigned_user_id':_0x2f82d5['id'],'ticketpriorities':_0x49c4('0x1a'),'ticketstatus':_0x49c4('0x1b'),'ticket_title':intUtil[_0x49c4('0x1c')](_0x59f29b[_0x49c4('0x1d')],_0x24856d,'\x20'),'description':intUtil['getString'](_0x59f29b['Descriptions'],_0x24856d,'\x0a'),'contact_id':_0x3addb2['id']},getCustomFields(_0x50b151,_0x24856d));var _0x57f502={'method':_0x49c4('0x1e'),'uri':util['format']('%s/webservice.php',_0x3c782d[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x20'),'username':_0x3c782d[_0x49c4('0x21')],'sessionName':_0x2cbd50[_0x49c4('0x22')],'elementType':'HelpDesk','element':JSON['stringify'](_0x291526)},'json':!![]};return request(_0x57f502)[_0x49c4('0x23')](function(_0x9cb797){if(_0x9cb797['success']){return BPromise[_0x49c4('0x24')]({'id':_0x9cb797[_0x49c4('0x25')]['id']});}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x27'),JSON['stringify'](_0x9cb797['error'])));}})[_0x49c4('0x28')](function(_0x53c199){var _0x3800b7=_0x53c199[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'createTicket',_0x3800b7,JSON[_0x49c4('0x2c')](_0x53c199));});}function getUser(_0x2b2793,_0x46e04d,_0x4f28a2){if(intUtil[_0x49c4('0x2d')](_0x46e04d)){logger[_0x49c4('0x17')](_0x49c4('0x2e'),_0x46e04d);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2b2793[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x2b2793['username'],'sessionName':_0x4f28a2['sessionName'],'query':util[_0x49c4('0x26')](_0x49c4('0x31'),_0x46e04d)},'json':!![]})[_0x49c4('0x23')](function(_0x27e467){if(_0x27e467[_0x49c4('0x32')]&&_0x27e467['result'][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x34'));return BPromise[_0x49c4('0x24')]({'id':_0x27e467['result'][0x0]['id'],'email':_0x27e467['result'][0x0][_0x49c4('0x35')],'name':_0x27e467[_0x49c4('0x25')][0x0][_0x49c4('0x36')]+'\x20'+_0x27e467[_0x49c4('0x25')][_0x49c4('0x37')]});}else{logger['info'](_0x49c4('0x38'));return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2[_0x49c4('0x39')],'email':_0x2b2793['username'],'name':'admin'});}})[_0x49c4('0x28')](function(_0x1991e9){var _0x3bec0a=_0x1991e9[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x3a'),_0x3bec0a,JSON[_0x49c4('0x2c')](_0x1991e9));});}else{logger[_0x49c4('0x17')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2['userId'],'email':_0x2b2793[_0x49c4('0x21')],'name':_0x49c4('0x3b')})[_0x49c4('0x28')](function(_0x1c2830){var _0x4ed4f8=_0x1c2830[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'getUser',_0x4ed4f8,JSON[_0x49c4('0x2c')](_0x1c2830));});}}function getEndUser(_0x21d8c7,_0x178987,_0x5e5366,_0x1ba7a0){logger[_0x49c4('0x17')](_0x49c4('0x3c'),_0x5e5366);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x21d8c7[_0x49c4('0x21')],'sessionName':_0x1ba7a0[_0x49c4('0x22')],'query':util[_0x49c4('0x26')](_0x49c4('0x3d'),_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366)},'json':!![]})[_0x49c4('0x23')](function(_0x29dd5d){if(_0x29dd5d[_0x49c4('0x32')]&&_0x29dd5d[_0x49c4('0x25')][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x3e'));return BPromise[_0x49c4('0x24')]({'id':_0x29dd5d[_0x49c4('0x25')][0x0]['id'],'name':_0x29dd5d['result'][0x0][_0x49c4('0x3f')]+'\x20'+_0x29dd5d['result'][0x0][_0x49c4('0x40')],'phone':_0x5e5366});}else{logger[_0x49c4('0x17')](_0x49c4('0x41'));return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7['remoteUri']),'form':{'operation':'create','sessionName':_0x1ba7a0[_0x49c4('0x22')],'elementType':_0x49c4('0x42'),'element':JSON[_0x49c4('0x2c')]({'lastname':_0x178987,'phone':_0x5e5366,'assigned_user_id':'\x20'})},'json':!![]})[_0x49c4('0x23')](function(_0x490823){logger[_0x49c4('0x17')](_0x49c4('0x43'));return BPromise[_0x49c4('0x24')]({'id':_0x490823[_0x49c4('0x25')]['id'],'name':_0x490823[_0x49c4('0x25')][_0x49c4('0x40')],'phone':_0x490823[_0x49c4('0x25')][_0x49c4('0x44')]});})[_0x49c4('0x28')](function(_0x5640d3){var _0x2ad771=_0x5640d3['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x45'),_0x2ad771,JSON[_0x49c4('0x2c')](_0x5640d3));});}});}function getConnection(_0x2d93d8){var _0x5b296d=_0x2d93d8[_0x49c4('0x21')];var _0x15b674=_0x2d93d8[_0x49c4('0x46')];return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'qs':{'operation':'getchallenge','username':_0x5b296d},'json':!![]})[_0x49c4('0x23')](function(_0x5cfff9){if(_0x5cfff9[_0x49c4('0x32')]){return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x47'),'username':_0x5b296d,'accessKey':md5(_0x5cfff9[_0x49c4('0x25')]['token']+_0x15b674)},'json':!![]});}})[_0x49c4('0x23')](function(_0x3feaf0){if(_0x3feaf0['success']){return BPromise[_0x49c4('0x24')](_0x3feaf0[_0x49c4('0x25')]);}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x48'),_0x2d93d8['id']));}})['catch'](function(_0x5d8bf0){var _0x144fd2=_0x5d8bf0['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x49'),_0x144fd2,JSON[_0x49c4('0x2c')](_0x5d8bf0));});}function request(_0x240c20){logger[_0x49c4('0x17')](_0x49c4('0x4a'),JSON['stringify'](_0x240c20));return rp(_0x240c20);}exports[_0x49c4('0x4b')]=function(_0x1550ce,_0x3936d3,_0x3d944c,_0x17ef75,_0x2644c0,_0x156748){var _0x25d174,_0x1e0b4f,_0x1856be,_0x5b822f;_0x156748['remoteUri']=intUtil[_0x49c4('0x4c')](_0x156748[_0x49c4('0x1f')]);if(_0x2644c0&&_0x2644c0['monitor_format']){logger['info'](_0x49c4('0x4d'),'Recording\x20is\x20enabled!');_0x3936d3['recordingURL']=util[_0x49c4('0x26')](_0x49c4('0x4e'),_0x156748[_0x49c4('0x4f')],_0x3936d3[_0x49c4('0x50')],md5(_0x3936d3[_0x49c4('0x50')]));}else{_0x3936d3[_0x49c4('0x51')]='';}return getConnection(_0x156748)[_0x49c4('0x23')](function(_0x50798e){_0x5b822f=_0x50798e;return getUser(_0x156748,_0x17ef75[_0x49c4('0x52')],_0x5b822f);})[_0x49c4('0x23')](function(_0x207572){_0x25d174=_0x207572;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x25d174['id']);return getEndUser(_0x156748,_0x3936d3[_0x49c4('0x54')],_0x3936d3['calleridnum'],_0x5b822f);})['then'](function(_0x1ef0c1){_0x1e0b4f=_0x1ef0c1;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0x1e0b4f['id']);return createTicket(_0x156748,_0x25d174,_0x1e0b4f,_0x3d944c,_0x3936d3,_0x3d944c[_0x49c4('0x56')],_0x5b822f);})[_0x49c4('0x23')](function(_0x6b2592){_0x1856be=_0x6b2592;logger[_0x49c4('0x17')]('Ticket\x20created!');logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x1856be['id']);var _0x4ba4eb=util[_0x49c4('0x26')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x156748[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x1856be['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x4d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x17ef75[_0x49c4('0x15')]),'trigger:browser:url',{'uri':_0x4ba4eb});})[_0x49c4('0x28')](function(_0x27b9c2){logger['error'](_0x49c4('0x4d'),JSON[_0x49c4('0x2c')](_0x27b9c2));});};exports['outbound']=function(_0x39c455,_0x42e0e6,_0x4f50bf,_0x4dc54d,_0x589484,_0x513879,_0xc43386){var _0x54947d,_0xb20a5d,_0x32f344,_0x515240;_0x513879[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x513879['remoteUri']);_0x513879[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x513879[_0x49c4('0x4f')]);if(_0xc43386&&_0xc43386[_0x49c4('0x5b')]&&_0xc43386['recordingFormat']!==_0x49c4('0x5c')){logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x5e'));_0x42e0e6['recordingURL']=util[_0x49c4('0x26')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x513879['serverUrl'],_0x42e0e6['uniqueid'],md5(_0x42e0e6['uniqueid']));}return getConnection(_0x513879)[_0x49c4('0x23')](function(_0x32eaef){_0x515240=_0x32eaef;return getUser(_0x513879,_0x4dc54d[_0x49c4('0x52')],_0x515240);})[_0x49c4('0x23')](function(_0x5b056e){_0x54947d=_0x5b056e;logger['info'](_0x49c4('0x53'),_0x54947d['id']);return getEndUser(_0x513879,_0x42e0e6[_0x49c4('0x5f')],_0x42e0e6[_0x49c4('0x60')],_0x515240);})[_0x49c4('0x23')](function(_0x102c15){_0xb20a5d=_0x102c15;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0xb20a5d['id']);return createTicket(_0x513879,_0x54947d,_0xb20a5d,_0x4f50bf,_0x42e0e6,_0x4f50bf[_0x49c4('0x56')],_0x515240);})['then'](function(_0x2276db){_0x32f344=_0x2276db;logger['info'](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x32f344['id']);var _0x1ea1b4=util[_0x49c4('0x26')](_0x49c4('0x62'),_0x513879[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x32f344['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x4dc54d[_0x49c4('0x15')]),_0x49c4('0x63'),{'uri':_0x1ea1b4});})[_0x49c4('0x28')](function(_0x371e49){logger[_0x49c4('0x2a')]('[OUTBOUND]',JSON['stringify'](_0x371e49));});};exports[_0x49c4('0x64')]=function(_0x16b3e8,_0x4af680,_0x1a15f3,_0x38ad50,_0x2939fd,_0x16e7b1){var _0x4d6aaa,_0x5a14a5,_0x4a85d4,_0x2e90d8;_0x16e7b1[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x1f')]);_0x16e7b1[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x4f')]);if(_0x2939fd&&_0x2939fd[_0x49c4('0x65')]){logger[_0x49c4('0x17')]('['+_0x4af680['lastevent'][_0x49c4('0x66')]()+']',_0x49c4('0x5e'));_0x4af680[_0x49c4('0x51')]=util['format'](_0x49c4('0x4e'),_0x16e7b1[_0x49c4('0x4f')],_0x4af680[_0x49c4('0x50')],md5(_0x4af680[_0x49c4('0x50')]));}else{_0x4af680[_0x49c4('0x51')]='';}return getConnection(_0x16e7b1)[_0x49c4('0x23')](function(_0x35fa39){_0x2e90d8=_0x35fa39;return getUser(_0x16e7b1,'',_0x2e90d8);})[_0x49c4('0x23')](function(_0x4ba198){_0x4d6aaa=_0x4ba198;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x4d6aaa['id']);return getEndUser(_0x16e7b1,_0x4af680[_0x49c4('0x54')],_0x4af680[_0x49c4('0x67')],_0x2e90d8);})[_0x49c4('0x23')](function(_0x4a204d){_0x5a14a5=_0x4a204d;logger['info'](_0x49c4('0x55'),_0x5a14a5['id']);return createTicket(_0x16e7b1,_0x4d6aaa,_0x5a14a5,_0x1a15f3,_0x4af680,_0x1a15f3['Fields'],_0x2e90d8);})[_0x49c4('0x23')](function(_0x558880){_0x4a85d4=_0x558880;logger[_0x49c4('0x17')](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x4a85d4['id']);})['catch'](function(_0x123060){logger[_0x49c4('0x2a')]('['+_0x4af680[_0x49c4('0x68')][_0x49c4('0x66')]()+']',JSON[_0x49c4('0x2c')](_0x123060));});}; \ 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(_0x14fa6c,_0x4d0dc5){var _0x286e55=function(_0x4e03d0){while(--_0x4e03d0){_0x14fa6c['push'](_0x14fa6c['shift']());}};_0x286e55(++_0x4d0dc5);}(_0xe706,0xa3));var _0x6e70=function(_0x243e12,_0x2d7bc5){_0x243e12=_0x243e12-0x0;var _0x3fddfc=_0xe706[_0x243e12];return _0x3fddfc;};'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 c5fdd5d..da6d6a8 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 _0xbbc5=['length','filter','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','authType','password','%s:%s','username','token','Basic\x20%s','base64','debug','[HTTP]','stringify','defaults','GET','map','forEach','includes','string','picklist','type','customField','nameField','toLowerCase','content','toString','idField','custom_fields','push','variable','variableName','Variable','name','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','%s/agent/tickets/%s','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','recordingFormat','none','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','Authorization','destcalleridname','[OUTBOUND]','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','trigger:browser:url','replace','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','lodash','md5','util','ioredis','./util','../../../../config/logger','zendesk','redis','localhost','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','%s/tickets.json','remoteUri','POST','Tags','getString','Subjects','Fields','Ticket\x20created!','ticket','validateEmail','format','%s/search.json','count','Agent\x20found!','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','then','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone'];(function(_0x284f2c,_0x17233e){var _0x48ced1=function(_0x38cdda){while(--_0x38cdda){_0x284f2c['push'](_0x284f2c['shift']());}};_0x48ced1(++_0x17233e);}(_0xbbc5,0x137));var _0x5bbc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbbc5[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x5bbc('0x0'));var rp=require('request-promise');var md5=require(_0x5bbc('0x1'));var util=require(_0x5bbc('0x2'));var Redis=require(_0x5bbc('0x3'));var intUtil=require(_0x5bbc('0x4'));var config=require('../../../../config/environment');var logger=require(_0x5bbc('0x5'))(_0x5bbc('0x6'));config[_0x5bbc('0x7')]=_['defaults'](config['redis'],{'host':_0x5bbc('0x8'),'port':0x18eb});var io=require(_0x5bbc('0x9'))(new Redis(config[_0x5bbc('0x7')]));function emit(_0x2f45a9,_0xfefd27,_0x24ee14){io['to'](_0x2f45a9)[_0x5bbc('0xa')](_0xfefd27,_0x24ee14);}var headers={'Content-Type':_0x5bbc('0xb'),'Accept':_0x5bbc('0xb')};function getTicket(_0x16bbb4,_0x54bcfa,_0x1a29c9,_0x3c2e54,_0x600f73){logger[_0x5bbc('0xc')](_0x5bbc('0xd'));return request({'uri':util['format'](_0x5bbc('0xe'),_0x16bbb4[_0x5bbc('0xf')]),'method':_0x5bbc('0x10'),'body':{'ticket':_['merge']({'requester_id':_0x1a29c9['id'],'submitter_id':_0x54bcfa?_0x54bcfa['id']:undefined,'assignee_id':_0x54bcfa?_0x54bcfa['id']:undefined,'tags':getTags(_0x3c2e54[_0x5bbc('0x11')],'name'),'subject':intUtil[_0x5bbc('0x12')](_0x3c2e54[_0x5bbc('0x13')],_0x600f73,'\x20'),'description':intUtil['getString'](_0x3c2e54['Descriptions'],_0x600f73,'\x0a'),'comment':{'public':![],'body':intUtil[_0x5bbc('0x12')](_0x3c2e54['Descriptions'],_0x600f73,'\x0a')}},getCustomFields(_0x3c2e54[_0x5bbc('0x14')],_0x600f73))}})['then'](function(_0x26f16a){logger[_0x5bbc('0xc')](_0x5bbc('0x15'));return _0x26f16a[_0x5bbc('0x16')];});}function getUser(_0x155620,_0x3f3841){if(intUtil[_0x5bbc('0x17')](_0x3f3841)){logger[_0x5bbc('0xc')]('Getting\x20agent\x20with\x20email',_0x3f3841);return request({'uri':util[_0x5bbc('0x18')](_0x5bbc('0x19'),_0x155620[_0x5bbc('0xf')]),'qs':{'query':util[_0x5bbc('0x18')]('type:user\x20role:agent\x20email:%s',_0x3f3841)}})['then'](function(_0x523b4e){if(_0x523b4e[_0x5bbc('0x1a')]){logger[_0x5bbc('0xc')](_0x5bbc('0x1b'));return _[_0x5bbc('0x1c')](_0x523b4e[_0x5bbc('0x1d')],{'email':_0x3f3841,'role':_0x5bbc('0x1e')});}else{logger['info'](_0x5bbc('0x1f'));return request({'uri':util[_0x5bbc('0x18')](_0x5bbc('0x20'),_0x155620[_0x5bbc('0xf')])})[_0x5bbc('0x21')](function(_0x3dcbb5){logger[_0x5bbc('0xc')](_0x5bbc('0x22'));return _0x3dcbb5[_0x5bbc('0x23')];});}});}else{logger[_0x5bbc('0xc')](_0x5bbc('0x1f'));return request({'uri':util[_0x5bbc('0x18')]('%s/users/me.json',_0x155620[_0x5bbc('0xf')])})[_0x5bbc('0x21')](function(_0x4279c8){logger[_0x5bbc('0xc')](_0x5bbc('0x22'));return _0x4279c8[_0x5bbc('0x23')];});}}function getEndUser(_0x26e4ff,_0x5cb808,_0x548597){logger[_0x5bbc('0xc')](_0x5bbc('0x24'),_0x548597);return request({'uri':util[_0x5bbc('0x18')](_0x5bbc('0x19'),_0x26e4ff[_0x5bbc('0xf')]),'qs':{'query':util[_0x5bbc('0x18')]('type:user\x20role:end-user\x20phone:%s',_0x548597)}})[_0x5bbc('0x21')](function(_0x36b682){var _0x18ab82;if(_0x36b682[_0x5bbc('0x1d')][_0x5bbc('0x25')]){_0x36b682['results']=_[_0x5bbc('0x26')](_0x36b682['results'],{'suspended':![],'role':_0x5bbc('0x27')});if(_0x36b682[_0x5bbc('0x1d')][_0x5bbc('0x25')]){_0x18ab82=_[_0x5bbc('0x28')](_0x36b682[_0x5bbc('0x1d')]);}}if(_0x18ab82){logger[_0x5bbc('0xc')](_0x5bbc('0x29'));return _0x18ab82;}else{logger[_0x5bbc('0xc')](_0x5bbc('0x2a'));return request({'uri':util['format'](_0x5bbc('0x2b'),_0x26e4ff['remoteUri']),'method':_0x5bbc('0x10'),'body':{'user':{'role':_0x5bbc('0x27'),'name':util[_0x5bbc('0x18')](_0x5bbc('0x2c'),_0x5cb808||_0x548597),'phone':_0x548597}}})['then'](function(_0x4c4708){logger['info'](_0x5bbc('0x2d'));return _0x4c4708[_0x5bbc('0x23')];});}});}function getAuth(_0x569a1e){var _0x55e790;if(_0x569a1e[_0x5bbc('0x2e')]===_0x5bbc('0x2f')){_0x55e790=util[_0x5bbc('0x18')](_0x5bbc('0x30'),_0x569a1e[_0x5bbc('0x31')],_0x569a1e[_0x5bbc('0x2f')]);}else if(_0x569a1e[_0x5bbc('0x2e')]===_0x5bbc('0x32')){_0x55e790=util['format']('%s/token:%s',_0x569a1e[_0x5bbc('0x31')],_0x569a1e[_0x5bbc('0x32')]);}return util['format'](_0x5bbc('0x33'),new Buffer(_0x55e790)['toString'](_0x5bbc('0x34')));}function request(_0x337698){logger[_0x5bbc('0x35')](_0x5bbc('0x36'),JSON[_0x5bbc('0x37')](_0x337698));return rp(_[_0x5bbc('0x38')](_0x337698,{'method':_0x5bbc('0x39'),'headers':headers,'json':!![]}));}function getTags(_0x658661,_0x24cd6b){var _0x3a7c15=[];if(_0x658661&&_0x658661['length']>0x0){_0x3a7c15=_[_0x5bbc('0x3a')](_0x658661,_0x24cd6b);}return _0x3a7c15;}function getCustomFields(_0x33045e,_0x287757){var _0x3a084f=[];var _0x24f700={'custom_fields':[]};if(_0x33045e['length']>0x0){_[_0x5bbc('0x3b')](_0x33045e,function(_0x3cfe33){if(_[_0x5bbc('0x3c')]([_0x5bbc('0x3d'),_0x5bbc('0x3e')],_0x3cfe33[_0x5bbc('0x3f')])&&_0x3cfe33['nameField']&&!_0x3cfe33[_0x5bbc('0x40')]){_0x24f700[_0x3cfe33[_0x5bbc('0x41')][_0x5bbc('0x42')]()]=_0x3cfe33[_0x5bbc('0x43')][_0x5bbc('0x44')]();}else if(_['includes']([_0x5bbc('0x3d'),'picklist'],_0x3cfe33[_0x5bbc('0x3f')])&&_0x3cfe33[_0x5bbc('0x45')]&&_0x3cfe33[_0x5bbc('0x40')]){_0x24f700[_0x5bbc('0x46')][_0x5bbc('0x47')]({'id':_0x3cfe33[_0x5bbc('0x45')],'value':_0x3cfe33['content']['toString']()});}else if(_0x3cfe33[_0x5bbc('0x3f')]===_0x5bbc('0x48')&&_0x3cfe33[_0x5bbc('0x49')]&&_0x3cfe33[_0x5bbc('0x45')]&&_0x3cfe33[_0x5bbc('0x40')]){_0x287757[_0x3cfe33[_0x5bbc('0x49')]]&&_0x24f700[_0x5bbc('0x46')][_0x5bbc('0x47')]({'id':_0x3cfe33[_0x5bbc('0x45')],'value':_0x287757[_0x3cfe33['variableName']]['toString']()});}else if(_0x3cfe33['type']==='customVariable'&&_0x3cfe33[_0x5bbc('0x4a')]&&_0x3cfe33[_0x5bbc('0x4a')][_0x5bbc('0x4b')]&&_0x3cfe33[_0x5bbc('0x45')]&&_0x3cfe33[_0x5bbc('0x40')]){_0x287757[_0x3cfe33['Variable'][_0x5bbc('0x4b')]['toLowerCase']()]&&_0x24f700[_0x5bbc('0x46')][_0x5bbc('0x47')]({'id':_0x3cfe33['idField'],'value':_0x287757[_0x3cfe33['Variable'][_0x5bbc('0x4b')]['toLowerCase']()]['toString']()});}});}return _0x24f700;}exports[_0x5bbc('0x4c')]=function(_0x4cb299,_0x284f3e,_0x4c2867,_0x39a142,_0x12c7c3,_0x2f61c4){var _0x1ac5f8,_0x218a52;_0x2f61c4[_0x5bbc('0xf')]=intUtil['stripTrailingSlash'](_0x2f61c4['remoteUri']);_0x2f61c4[_0x5bbc('0x4d')]=intUtil[_0x5bbc('0x4e')](_0x2f61c4[_0x5bbc('0x4d')]);if(_0x12c7c3&&_0x12c7c3[_0x5bbc('0x4f')]){logger['info'](_0x5bbc('0x50'),_0x5bbc('0x51'));_0x284f3e[_0x5bbc('0x52')]=util[_0x5bbc('0x18')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2f61c4[_0x5bbc('0x4d')],_0x284f3e[_0x5bbc('0x53')],md5(_0x284f3e[_0x5bbc('0x53')]));}else{_0x284f3e[_0x5bbc('0x52')]='';}headers['Authorization']=getAuth(_0x2f61c4);return getUser(_0x2f61c4,_0x39a142[_0x5bbc('0x54')])[_0x5bbc('0x21')](function(_0x4320b8){_0x1ac5f8=_0x4320b8;logger[_0x5bbc('0xc')](_0x5bbc('0x55'),_0x1ac5f8['id']);return getEndUser(_0x2f61c4,_0x284f3e[_0x5bbc('0x56')],_0x284f3e[_0x5bbc('0x57')]);})[_0x5bbc('0x21')](function(_0x5cea18){_0x218a52=_0x5cea18;logger[_0x5bbc('0xc')](_0x5bbc('0x58'),_0x218a52['id']);return getTicket(_0x2f61c4,_0x1ac5f8,_0x218a52,_0x4c2867,_0x284f3e);})[_0x5bbc('0x21')](function(_0x157dac){if(_0x157dac){logger[_0x5bbc('0xc')](_0x5bbc('0x59'),_0x157dac['id']);switch(_0x2f61c4[_0x5bbc('0x3f')]){case _0x5bbc('0x5a'):logger[_0x5bbc('0xc')](_0x5bbc('0x50'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util['format']('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x2f61c4['remoteUri'],_0x1ac5f8['id'],_0x157dac['id']),'method':_0x5bbc('0x10')});case _0x5bbc('0x5b'):logger[_0x5bbc('0xc')](_0x5bbc('0x50'),_0x5bbc('0x5c'));emit(util[_0x5bbc('0x18')](_0x5bbc('0x5d'),_0x39a142[_0x5bbc('0x4b')]),'trigger:browser:url',{'uri':util[_0x5bbc('0x18')](_0x5bbc('0x5e'),_0x2f61c4['remoteUri']['replace'](_0x5bbc('0x5f'),''),_0x157dac['id'])});break;default:logger[_0x5bbc('0x60')]('[QUEUE]',_0x5bbc('0x61'));}}})[_0x5bbc('0x62')](function(_0x3a4d4a){logger[_0x5bbc('0x60')](_0x5bbc('0x63'),util[_0x5bbc('0x64')](_0x3a4d4a,{'showHidden':!![],'depth':null}));});};exports['outbound']=function(_0x4390d1,_0x59643c,_0x346c0e,_0x1cc79a,_0x2b57f6,_0x3fd822,_0x47de30){var _0x42fd21,_0x274604;_0x3fd822[_0x5bbc('0xf')]=intUtil[_0x5bbc('0x4e')](_0x3fd822[_0x5bbc('0xf')]);_0x3fd822[_0x5bbc('0x4d')]=intUtil[_0x5bbc('0x4e')](_0x3fd822[_0x5bbc('0x4d')]);if(_0x47de30&&_0x47de30[_0x5bbc('0x65')]&&_0x47de30[_0x5bbc('0x65')]!==_0x5bbc('0x66')){logger[_0x5bbc('0xc')]('[OUTBOUND]',_0x5bbc('0x51'));_0x59643c[_0x5bbc('0x52')]=util[_0x5bbc('0x18')](_0x5bbc('0x67'),_0x3fd822[_0x5bbc('0x4d')],_0x59643c[_0x5bbc('0x53')],md5(_0x59643c[_0x5bbc('0x53')]));}headers[_0x5bbc('0x68')]=getAuth(_0x3fd822);return getUser(_0x3fd822,_0x1cc79a['email'])['then'](function(_0x19c574){_0x42fd21=_0x19c574;logger[_0x5bbc('0xc')]('The\x20User\x20ID\x20is:',_0x42fd21['id']);return getEndUser(_0x3fd822,_0x59643c[_0x5bbc('0x69')],_0x59643c['destcalleridnum']);})[_0x5bbc('0x21')](function(_0x5f0eeb){_0x274604=_0x5f0eeb;logger[_0x5bbc('0xc')](_0x5bbc('0x58'),_0x274604['id']);return getTicket(_0x3fd822,_0x42fd21,_0x274604,_0x346c0e,_0x59643c);})[_0x5bbc('0x21')](function(_0x439a8e){if(_0x439a8e){logger['info']('The\x20Ticket\x20ID\x20is:',_0x439a8e['id']);switch(_0x3fd822[_0x5bbc('0x3f')]){case _0x5bbc('0x5a'):logger[_0x5bbc('0xc')](_0x5bbc('0x6a'),_0x5bbc('0x6b'));return request({'uri':util[_0x5bbc('0x18')](_0x5bbc('0x6c'),_0x3fd822['remoteUri'],_0x42fd21['id'],_0x439a8e['id']),'method':_0x5bbc('0x10')});case _0x5bbc('0x5b'):logger[_0x5bbc('0xc')](_0x5bbc('0x6a'),_0x5bbc('0x5c'));emit(util[_0x5bbc('0x18')](_0x5bbc('0x5d'),_0x1cc79a[_0x5bbc('0x4b')]),_0x5bbc('0x6d'),{'uri':util[_0x5bbc('0x18')](_0x5bbc('0x5e'),_0x3fd822['remoteUri'][_0x5bbc('0x6e')]('/api/v2',''),_0x439a8e['id'])});break;default:logger[_0x5bbc('0x60')](_0x5bbc('0x6a'),_0x5bbc('0x61'));}}})[_0x5bbc('0x62')](function(_0x40f9f0){logger[_0x5bbc('0x60')](_0x5bbc('0x6f'),util[_0x5bbc('0x64')](_0x40f9f0,{'showHidden':!![],'depth':null}));});};exports[_0x5bbc('0x70')]=function(_0x2ff5d6,_0x3ab71d,_0x4c8bf0,_0x52bf9f,_0x131905,_0x5c7073){var _0x465f97,_0x158d64;_0x5c7073[_0x5bbc('0xf')]=intUtil[_0x5bbc('0x4e')](_0x5c7073[_0x5bbc('0xf')]);_0x5c7073[_0x5bbc('0x4d')]=intUtil[_0x5bbc('0x4e')](_0x5c7073['serverUrl']);if(_0x131905&&_0x131905[_0x5bbc('0x4f')]){logger[_0x5bbc('0xc')]('['+_0x3ab71d[_0x5bbc('0x71')][_0x5bbc('0x72')]()+']',_0x5bbc('0x51'));_0x3ab71d[_0x5bbc('0x52')]=util['format'](_0x5bbc('0x67'),_0x5c7073['serverUrl'],_0x3ab71d[_0x5bbc('0x53')],md5(_0x3ab71d[_0x5bbc('0x53')]));}else{_0x3ab71d[_0x5bbc('0x52')]='';}headers['Authorization']=getAuth(_0x5c7073);return getUser(_0x5c7073)[_0x5bbc('0x21')](function(_0x463cf9){_0x465f97=_0x463cf9;logger['info'](_0x5bbc('0x55'),_0x465f97['id']);return getEndUser(_0x5c7073,_0x3ab71d[_0x5bbc('0x56')],_0x3ab71d['calleridnum']);})[_0x5bbc('0x21')](function(_0x3cf11a){_0x158d64=_0x3cf11a;logger[_0x5bbc('0xc')](_0x5bbc('0x58'),_0x158d64['id']);return getTicket(_0x5c7073,_0x465f97,_0x158d64,_0x4c8bf0,_0x3ab71d);})[_0x5bbc('0x21')](function(_0x36d38f){if(_0x36d38f){logger[_0x5bbc('0xc')](_0x5bbc('0x59'),_0x36d38f['id']);}})[_0x5bbc('0x62')](function(_0x3cae89){logger[_0x5bbc('0x60')]('['+_0x3ab71d[_0x5bbc('0x71')]['toUpperCase']()+']'+_0x5bbc('0x73'),util['inspect'](_0x3cae89,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x8af8=['../../../../config/logger','zendesk','localhost','socket.io-emitter','redis','emit','application/json','info','format','%s/tickets.json','remoteUri','merge','name','getString','Descriptions','Fields','then','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','Agent\x20found!','find','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','user','%s/users/me.json','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','results','length','filter','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','POST','Caller\x20-\x20%s','Enduser\x20created.','authType','%s:%s','username','password','token','%s/token:%s','toString','base64','debug','[HTTP]','stringify','defaults','GET','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','idField','custom_fields','push','content','variable','variableName','customVariable','Variable','queue','serverUrl','stripTrailingSlash','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Ticket\x20ID\x20is:','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','%s/agent/tickets/%s','replace','error','Zendesk\x20account\x20type\x20not\x20recognized','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','user:%s','/api/v2','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','monitor_format','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','lodash','md5','util','ioredis','./util','../../../../config/environment'];(function(_0x3fd445,_0x4281db){var _0x5db205=function(_0x4d294b){while(--_0x4d294b){_0x3fd445['push'](_0x3fd445['shift']());}};_0x5db205(++_0x4281db);}(_0x8af8,0x153));var _0x88af=function(_0x43455d,_0x29444a){_0x43455d=_0x43455d-0x0;var _0x127d79=_0x8af8[_0x43455d];return _0x127d79;};'use strict';var _=require(_0x88af('0x0'));var rp=require('request-promise');var md5=require(_0x88af('0x1'));var util=require(_0x88af('0x2'));var Redis=require(_0x88af('0x3'));var intUtil=require(_0x88af('0x4'));var config=require(_0x88af('0x5'));var logger=require(_0x88af('0x6'))(_0x88af('0x7'));config['redis']=_['defaults'](config['redis'],{'host':_0x88af('0x8'),'port':0x18eb});var io=require(_0x88af('0x9'))(new Redis(config[_0x88af('0xa')]));function emit(_0x15ad85,_0x427927,_0x2d141b){io['to'](_0x15ad85)[_0x88af('0xb')](_0x427927,_0x2d141b);}var headers={'Content-Type':_0x88af('0xc'),'Accept':_0x88af('0xc')};function getTicket(_0x496989,_0x521e37,_0x4096f1,_0x166935,_0x575516){logger[_0x88af('0xd')]('Creating\x20new\x20ticket...');return request({'uri':util[_0x88af('0xe')](_0x88af('0xf'),_0x496989[_0x88af('0x10')]),'method':'POST','body':{'ticket':_[_0x88af('0x11')]({'requester_id':_0x4096f1['id'],'submitter_id':_0x521e37?_0x521e37['id']:undefined,'assignee_id':_0x521e37?_0x521e37['id']:undefined,'tags':getTags(_0x166935['Tags'],_0x88af('0x12')),'subject':intUtil['getString'](_0x166935['Subjects'],_0x575516,'\x20'),'description':intUtil[_0x88af('0x13')](_0x166935[_0x88af('0x14')],_0x575516,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x166935[_0x88af('0x14')],_0x575516,'\x0a')}},getCustomFields(_0x166935[_0x88af('0x15')],_0x575516))}})[_0x88af('0x16')](function(_0x232e9f){logger[_0x88af('0xd')](_0x88af('0x17'));return _0x232e9f[_0x88af('0x18')];});}function getUser(_0x5f0b31,_0x1e9e7d){if(intUtil[_0x88af('0x19')](_0x1e9e7d)){logger[_0x88af('0xd')](_0x88af('0x1a'),_0x1e9e7d);return request({'uri':util[_0x88af('0xe')](_0x88af('0x1b'),_0x5f0b31[_0x88af('0x10')]),'qs':{'query':util[_0x88af('0xe')]('type:user\x20role:agent\x20email:%s',_0x1e9e7d)}})['then'](function(_0x10fb65){if(_0x10fb65['count']){logger[_0x88af('0xd')](_0x88af('0x1c'));return _[_0x88af('0x1d')](_0x10fb65['results'],{'email':_0x1e9e7d,'role':'agent'});}else{logger['info'](_0x88af('0x1e'));return request({'uri':util[_0x88af('0xe')]('%s/users/me.json',_0x5f0b31['remoteUri'])})['then'](function(_0x509c68){logger['info'](_0x88af('0x1f'));return _0x509c68[_0x88af('0x20')];});}});}else{logger[_0x88af('0xd')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x88af('0xe')](_0x88af('0x21'),_0x5f0b31['remoteUri'])})[_0x88af('0x16')](function(_0xb81a93){logger[_0x88af('0xd')]('Admin\x20account\x20selected.');return _0xb81a93[_0x88af('0x20')];});}}function getEndUser(_0x371e96,_0x2d10ae,_0x374d65){logger[_0x88af('0xd')](_0x88af('0x22'),_0x374d65);return request({'uri':util[_0x88af('0xe')](_0x88af('0x1b'),_0x371e96[_0x88af('0x10')]),'qs':{'query':util[_0x88af('0xe')](_0x88af('0x23'),_0x374d65)}})[_0x88af('0x16')](function(_0x4015e3){var _0x436e3e;if(_0x4015e3[_0x88af('0x24')][_0x88af('0x25')]){_0x4015e3['results']=_[_0x88af('0x26')](_0x4015e3[_0x88af('0x24')],{'suspended':![],'role':_0x88af('0x27')});if(_0x4015e3['results'][_0x88af('0x25')]){_0x436e3e=_[_0x88af('0x28')](_0x4015e3[_0x88af('0x24')]);}}if(_0x436e3e){logger[_0x88af('0xd')](_0x88af('0x29'));return _0x436e3e;}else{logger[_0x88af('0xd')](_0x88af('0x2a'));return request({'uri':util['format'](_0x88af('0x2b'),_0x371e96[_0x88af('0x10')]),'method':_0x88af('0x2c'),'body':{'user':{'role':_0x88af('0x27'),'name':util[_0x88af('0xe')](_0x88af('0x2d'),_0x2d10ae||_0x374d65),'phone':_0x374d65}}})[_0x88af('0x16')](function(_0x4469c9){logger['info'](_0x88af('0x2e'));return _0x4469c9[_0x88af('0x20')];});}});}function getAuth(_0x4e35dc){var _0x41da07;if(_0x4e35dc[_0x88af('0x2f')]==='password'){_0x41da07=util[_0x88af('0xe')](_0x88af('0x30'),_0x4e35dc[_0x88af('0x31')],_0x4e35dc[_0x88af('0x32')]);}else if(_0x4e35dc[_0x88af('0x2f')]===_0x88af('0x33')){_0x41da07=util[_0x88af('0xe')](_0x88af('0x34'),_0x4e35dc[_0x88af('0x31')],_0x4e35dc[_0x88af('0x33')]);}return util[_0x88af('0xe')]('Basic\x20%s',new Buffer(_0x41da07)[_0x88af('0x35')](_0x88af('0x36')));}function request(_0x3e2eac){logger[_0x88af('0x37')](_0x88af('0x38'),JSON[_0x88af('0x39')](_0x3e2eac));return rp(_[_0x88af('0x3a')](_0x3e2eac,{'method':_0x88af('0x3b'),'headers':headers,'json':!![]}));}function getTags(_0xa9cde,_0x348aa4){var _0x478e06=[];if(_0xa9cde&&_0xa9cde[_0x88af('0x25')]>0x0){_0x478e06=_['map'](_0xa9cde,_0x348aa4);}return _0x478e06;}function getCustomFields(_0x3f40d9,_0xd6dcf9){var _0x1f084d=[];var _0x17afe7={'custom_fields':[]};if(_0x3f40d9['length']>0x0){_[_0x88af('0x3c')](_0x3f40d9,function(_0x4e9b14){if(_[_0x88af('0x3d')]([_0x88af('0x3e'),_0x88af('0x3f')],_0x4e9b14[_0x88af('0x40')])&&_0x4e9b14[_0x88af('0x41')]&&!_0x4e9b14[_0x88af('0x42')]){_0x17afe7[_0x4e9b14[_0x88af('0x41')][_0x88af('0x43')]()]=_0x4e9b14['content'][_0x88af('0x35')]();}else if(_[_0x88af('0x3d')]([_0x88af('0x3e'),_0x88af('0x3f')],_0x4e9b14[_0x88af('0x40')])&&_0x4e9b14[_0x88af('0x44')]&&_0x4e9b14[_0x88af('0x42')]){_0x17afe7[_0x88af('0x45')][_0x88af('0x46')]({'id':_0x4e9b14[_0x88af('0x44')],'value':_0x4e9b14[_0x88af('0x47')][_0x88af('0x35')]()});}else if(_0x4e9b14[_0x88af('0x40')]===_0x88af('0x48')&&_0x4e9b14[_0x88af('0x49')]&&_0x4e9b14[_0x88af('0x44')]&&_0x4e9b14[_0x88af('0x42')]){_0xd6dcf9[_0x4e9b14[_0x88af('0x49')]]&&_0x17afe7['custom_fields'][_0x88af('0x46')]({'id':_0x4e9b14[_0x88af('0x44')],'value':_0xd6dcf9[_0x4e9b14[_0x88af('0x49')]][_0x88af('0x35')]()});}else if(_0x4e9b14[_0x88af('0x40')]===_0x88af('0x4a')&&_0x4e9b14[_0x88af('0x4b')]&&_0x4e9b14['Variable'][_0x88af('0x12')]&&_0x4e9b14['idField']&&_0x4e9b14[_0x88af('0x42')]){_0xd6dcf9[_0x4e9b14[_0x88af('0x4b')][_0x88af('0x12')][_0x88af('0x43')]()]&&_0x17afe7['custom_fields'][_0x88af('0x46')]({'id':_0x4e9b14[_0x88af('0x44')],'value':_0xd6dcf9[_0x4e9b14['Variable'][_0x88af('0x12')][_0x88af('0x43')]()]['toString']()});}});}return _0x17afe7;}exports[_0x88af('0x4c')]=function(_0x300277,_0x57b70f,_0x5ea80d,_0x21508a,_0x3ebd5f,_0x24d6c1){var _0x36af6d,_0x5178dd;_0x24d6c1['remoteUri']=intUtil['stripTrailingSlash'](_0x24d6c1[_0x88af('0x10')]);_0x24d6c1[_0x88af('0x4d')]=intUtil[_0x88af('0x4e')](_0x24d6c1[_0x88af('0x4d')]);if(_0x3ebd5f&&_0x3ebd5f['monitor_format']){logger[_0x88af('0xd')](_0x88af('0x4f'),_0x88af('0x50'));_0x57b70f[_0x88af('0x51')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x24d6c1['serverUrl'],_0x57b70f[_0x88af('0x52')],md5(_0x57b70f[_0x88af('0x52')]));}else{_0x57b70f[_0x88af('0x51')]='';}headers['Authorization']=getAuth(_0x24d6c1);return getUser(_0x24d6c1,_0x21508a[_0x88af('0x53')])[_0x88af('0x16')](function(_0x5f42bf){_0x36af6d=_0x5f42bf;logger[_0x88af('0xd')](_0x88af('0x54'),_0x36af6d['id']);return getEndUser(_0x24d6c1,_0x57b70f[_0x88af('0x55')],_0x57b70f[_0x88af('0x56')]);})[_0x88af('0x16')](function(_0x2c3913){_0x5178dd=_0x2c3913;logger['info']('The\x20Enduser\x20ID\x20is:',_0x5178dd['id']);return getTicket(_0x24d6c1,_0x36af6d,_0x5178dd,_0x5ea80d,_0x57b70f);})['then'](function(_0xa1d5e2){if(_0xa1d5e2){logger['info'](_0x88af('0x57'),_0xa1d5e2['id']);switch(_0x24d6c1[_0x88af('0x40')]){case'integrationTab':logger[_0x88af('0xd')](_0x88af('0x4f'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0x88af('0xe')](_0x88af('0x58'),_0x24d6c1[_0x88af('0x10')],_0x36af6d['id'],_0xa1d5e2['id']),'method':_0x88af('0x2c')});case _0x88af('0x59'):logger['info'](_0x88af('0x4f'),_0x88af('0x5a'));emit(util['format']('user:%s',_0x21508a[_0x88af('0x12')]),_0x88af('0x5b'),{'uri':util[_0x88af('0xe')](_0x88af('0x5c'),_0x24d6c1[_0x88af('0x10')][_0x88af('0x5d')]('/api/v2',''),_0xa1d5e2['id'])});break;default:logger[_0x88af('0x5e')](_0x88af('0x4f'),_0x88af('0x5f'));}}})['catch'](function(_0x21543b){logger['error'](_0x88af('0x60'),util[_0x88af('0x61')](_0x21543b,{'showHidden':!![],'depth':null}));});};exports['outbound']=function(_0x48a349,_0x1896a2,_0x2f733a,_0x430061,_0x1036d9,_0x5d6d60,_0x323ed3){var _0x32572e,_0x32d1fd;_0x5d6d60[_0x88af('0x10')]=intUtil[_0x88af('0x4e')](_0x5d6d60[_0x88af('0x10')]);_0x5d6d60[_0x88af('0x4d')]=intUtil['stripTrailingSlash'](_0x5d6d60[_0x88af('0x4d')]);if(_0x323ed3&&_0x323ed3[_0x88af('0x62')]&&_0x323ed3[_0x88af('0x62')]!==_0x88af('0x63')){logger[_0x88af('0xd')](_0x88af('0x64'),_0x88af('0x50'));_0x1896a2[_0x88af('0x51')]=util[_0x88af('0xe')](_0x88af('0x65'),_0x5d6d60[_0x88af('0x4d')],_0x1896a2[_0x88af('0x52')],md5(_0x1896a2[_0x88af('0x52')]));}headers['Authorization']=getAuth(_0x5d6d60);return getUser(_0x5d6d60,_0x430061[_0x88af('0x53')])[_0x88af('0x16')](function(_0xc694d5){_0x32572e=_0xc694d5;logger[_0x88af('0xd')](_0x88af('0x54'),_0x32572e['id']);return getEndUser(_0x5d6d60,_0x1896a2[_0x88af('0x66')],_0x1896a2[_0x88af('0x67')]);})[_0x88af('0x16')](function(_0x5d035b){_0x32d1fd=_0x5d035b;logger[_0x88af('0xd')](_0x88af('0x68'),_0x32d1fd['id']);return getTicket(_0x5d6d60,_0x32572e,_0x32d1fd,_0x2f733a,_0x1896a2);})[_0x88af('0x16')](function(_0xe9a50e){if(_0xe9a50e){logger[_0x88af('0xd')](_0x88af('0x57'),_0xe9a50e['id']);switch(_0x5d6d60['type']){case _0x88af('0x69'):logger[_0x88af('0xd')](_0x88af('0x64'),_0x88af('0x6a'));return request({'uri':util[_0x88af('0xe')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x5d6d60['remoteUri'],_0x32572e['id'],_0xe9a50e['id']),'method':'POST'});case _0x88af('0x59'):logger[_0x88af('0xd')](_0x88af('0x64'),_0x88af('0x5a'));emit(util[_0x88af('0xe')](_0x88af('0x6b'),_0x430061[_0x88af('0x12')]),_0x88af('0x5b'),{'uri':util[_0x88af('0xe')]('%s/agent/tickets/%s',_0x5d6d60[_0x88af('0x10')][_0x88af('0x5d')](_0x88af('0x6c'),''),_0xe9a50e['id'])});break;default:logger[_0x88af('0x5e')](_0x88af('0x64'),_0x88af('0x5f'));}}})['catch'](function(_0x299b92){logger['error'](_0x88af('0x6d'),util[_0x88af('0x61')](_0x299b92,{'showHidden':!![],'depth':null}));});};exports[_0x88af('0x6e')]=function(_0x5a4183,_0x19b9a3,_0x5f154a,_0xb921d5,_0x419e09,_0x30207f){var _0x521d4d,_0x1e8b7d;_0x30207f[_0x88af('0x10')]=intUtil[_0x88af('0x4e')](_0x30207f['remoteUri']);_0x30207f[_0x88af('0x4d')]=intUtil[_0x88af('0x4e')](_0x30207f['serverUrl']);if(_0x419e09&&_0x419e09[_0x88af('0x6f')]){logger[_0x88af('0xd')]('['+_0x19b9a3[_0x88af('0x70')][_0x88af('0x71')]()+']',_0x88af('0x50'));_0x19b9a3[_0x88af('0x51')]=util[_0x88af('0xe')](_0x88af('0x65'),_0x30207f[_0x88af('0x4d')],_0x19b9a3[_0x88af('0x52')],md5(_0x19b9a3[_0x88af('0x52')]));}else{_0x19b9a3[_0x88af('0x51')]='';}headers['Authorization']=getAuth(_0x30207f);return getUser(_0x30207f)[_0x88af('0x16')](function(_0x584ae){_0x521d4d=_0x584ae;logger[_0x88af('0xd')]('The\x20User\x20ID\x20is:',_0x521d4d['id']);return getEndUser(_0x30207f,_0x19b9a3[_0x88af('0x55')],_0x19b9a3[_0x88af('0x56')]);})[_0x88af('0x16')](function(_0x31f43e){_0x1e8b7d=_0x31f43e;logger['info'](_0x88af('0x68'),_0x1e8b7d['id']);return getTicket(_0x30207f,_0x521d4d,_0x1e8b7d,_0x5f154a,_0x19b9a3);})['then'](function(_0x258215){if(_0x258215){logger['info'](_0x88af('0x57'),_0x258215['id']);}})['catch'](function(_0x28553c){logger[_0x88af('0x5e')]('['+_0x19b9a3[_0x88af('0x70')][_0x88af('0x71')]()+']'+_0x88af('0x72'),util['inspect'](_0x28553c,{'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 9c189a5..daca6f4 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 _0xa90d=['content','toString','variable','variableName','idField','type','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','access_token','expires_in','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','add','seconds','Failing\x20creating\x20the\x20access_token','info','Search\x20user','https://www.zohoapis.%s/crm/v2/users','then','users','findIndex','email','Agent\x20found!','profile','Administrator','Using\x20the\x20admin\x20account!','user','error','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','catch','data','enduserType','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','SUCCESS','details','Error:\x20','log','Zoho-oauthtoken\x20','moduleSearch','contact_lead','uri','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','/crm/v2/Contacts/search?criteria=((Phone:equals:','lead','Creating\x20new\x20call...','Owner','administrator','getString','Subjects','Descriptions','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','utc','format','answertime','endtime','Call_Duration','diff','starttime','YYYY-MM-DDTHH:mm:ss','mm:ss','lastevent','called','Call_Result','Called','complete','Answered','rejected','Rejected','abandoned','Abandoned','Timeout','Call_Start_Time','Call_Type','merge','Fields','POST','code','Call\x20created!','err','stack','host','serverUrl','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','The\x20User\x20ID\x20is:','Inbound','[QUEUE]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','https://crm.','/crm/EntityInfo.do?module=Calls&id=','outbound','recordingFormat','[OUTBOUND]','recordingURL','destcalleridname','Outbound','The\x20Call\x20ID\x20is:','unmanaged','toUpperCase','calleridnum','request-promise','md5','util','./util','moment','ioredis','bluebird','../../../../config/environment','../../../../config/logger','zoho','redis','localhost','emit','debug','stringify','length','picklist'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0xa90d,0x1b1));var _0xda90=function(_0x39ae82,_0x3893d6){_0x39ae82=_0x39ae82-0x0;var _0x2c4f77=_0xa90d[_0x39ae82];return _0x2c4f77;};'use strict';var _=require('lodash');var rp=require(_0xda90('0x0'));var md5=require(_0xda90('0x1'));var util=require(_0xda90('0x2'));var intUtil=require(_0xda90('0x3'));var moment=require(_0xda90('0x4'));var Redis=require(_0xda90('0x5'));var BPromise=require(_0xda90('0x6'));var config=require(_0xda90('0x7'));var logger=require(_0xda90('0x8'))(_0xda90('0x9'));config[_0xda90('0xa')]=_['defaults'](config['redis'],{'host':_0xda90('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xda90('0xa')]));function emit(_0x507ad6,_0x17cc8e,_0x486b20){io['to'](_0x507ad6)[_0xda90('0xc')](_0x17cc8e,_0x486b20);}function request(_0x4f330b){logger[_0xda90('0xd')]('[HTTP]',JSON[_0xda90('0xe')](_0x4f330b));return rp(_0x4f330b);}function getCustomFields(_0x3e2fca,_0x51cfbd){var _0x2493bd={};if(_0x3e2fca[_0xda90('0xf')]>0x0){_['forEach'](_0x3e2fca,function(_0x352201){if(_['includes'](['string',_0xda90('0x10')],_0x352201['type'])&&_0x352201['idField']){_0x2493bd[_0x352201['idField']]=_0x352201[_0xda90('0x11')][_0xda90('0x12')]();}else if(_0x352201['type']===_0xda90('0x13')&&_0x352201[_0xda90('0x14')]&&_0x352201['idField']&&_0x51cfbd[_0x352201['variableName']]){_0x2493bd[_0x352201[_0xda90('0x15')]]=_0x51cfbd[_0x352201[_0xda90('0x14')]]['toString']();}else if(_0x352201[_0xda90('0x16')]===_0xda90('0x17')&&_0x352201[_0xda90('0x18')]&&_0x352201[_0xda90('0x18')][_0xda90('0x19')]&&_0x352201[_0xda90('0x15')]&&_0x51cfbd[_0x352201[_0xda90('0x18')]['name'][_0xda90('0x1a')]()]){_0x2493bd[_0x352201[_0xda90('0x15')]]=_0x51cfbd[_0x352201['Variable']['name'][_0xda90('0x1a')]()][_0xda90('0x12')]();}});}return _0x2493bd;}function getName(_0xda189d){if(_0xda189d[_0xda90('0x1b')]('\x20')>0x0){var _0x41cb71=_0xda189d[_0xda90('0x1c')](/ (.+)/);if(_0x41cb71[0x1]){return _0x41cb71;}}return[_0xda189d,_0xda189d];}var accountsTokens={};function getAccessToken(_0x7265c4){return new Promise(function(_0x55a864,_0x41cbf0){if(!_[_0xda90('0x1d')](accountsTokens[_0x7265c4['id']])&&!_[_0xda90('0x1d')](accountsTokens[_0x7265c4['id']][_0xda90('0x1e')])){if(moment()['isBefore'](accountsTokens[_0x7265c4['id']][_0xda90('0x1f')])){_0x55a864(accountsTokens[_0x7265c4['id']][_0xda90('0x1e')]);}}var _0x5adfd4;switch(_0x7265c4['zone']){case'US':_0x5adfd4=_0xda90('0x20');break;case'AU':_0x5adfd4=_0xda90('0x21');break;case'EU':_0x5adfd4=_0xda90('0x22');break;case'IN':_0x5adfd4=_0xda90('0x23');break;case'CN':_0x5adfd4='https://accounts.zoho.com.cn';break;default:_0x5adfd4='https://accounts.zoho.eu';break;}var _0x3544ba={'method':'POST','uri':_0x5adfd4+_0xda90('0x24'),'qs':{'refresh_token':_0x7265c4[_0xda90('0x25')],'client_id':_0x7265c4[_0xda90('0x26')],'client_secret':_0x7265c4[_0xda90('0x27')],'grant_type':_0xda90('0x28')},'json':!![]};return rp(_0x3544ba)['then'](function(_0x586aae){accountsTokens[_0x7265c4['id']]={'access_token':_0x586aae[_0xda90('0x1e')],'expires_in':moment()[_0xda90('0x29')](_0x586aae[_0xda90('0x1f')],_0xda90('0x2a'))};_0x55a864(_0x586aae[_0xda90('0x1e')]);})['catch'](function(_0x46f3f1){logger['error'](_0xda90('0x2b'),_0x46f3f1['stack']);_0x41cbf0(_0x46f3f1);});});}function getUser(_0x4f1da5,_0x3edadd,_0x1ac488,_0x2254af){logger[_0xda90('0x2c')](_0xda90('0x2d'));return request({'method':'GET','uri':util['format'](_0xda90('0x2e'),_0x3edadd),'qs':{'type':'ActiveUsers'},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x4f1da5},'json':!![]})[_0xda90('0x2f')](function(_0x260c58){if(_0x260c58['users']){var _0x35391b=-0x1;if(_['isArrayLikeObject'](_0x260c58[_0xda90('0x30')])){if(!_[_0xda90('0x1d')](_0x2254af)){_0x35391b=_[_0xda90('0x31')](_0x260c58[_0xda90('0x30')],function(_0x58556c){return _0x58556c[_0xda90('0x32')]===_0x2254af;});}if(_0x35391b>=0x0){logger[_0xda90('0x2c')](_0xda90('0x33'));}else{logger[_0xda90('0x2c')]('Using\x20the\x20admin\x20account!');_0x35391b=_[_0xda90('0x31')](_0x260c58[_0xda90('0x30')],function(_0x41cfa4){return _0x41cfa4[_0xda90('0x34')][_0xda90('0x19')]===_0xda90('0x35');});}return _0x260c58[_0xda90('0x30')][_0x35391b];}else{if(_0x260c58['user'][_0xda90('0x34')]['name']===_0xda90('0x35')){logger[_0xda90('0x2c')](_0xda90('0x36'));user=_0x260c58[_0xda90('0x37')];return user;}else{logger[_0xda90('0x38')](_0xda90('0x39'),JSON[_0xda90('0xe')](_0x260c58));throw new Error(_0xda90('0x3a')+JSON[_0xda90('0xe')](_0x260c58));}}}else{logger[_0xda90('0x38')]('The\x20failing\x20result\x20is',JSON['stringify'](_0x260c58));throw new Error(_0xda90('0x3a')+JSON[_0xda90('0xe')](_0x260c58));}})[_0xda90('0x3b')](function(_0x663f7c){console[_0xda90('0x38')](_0x663f7c);});}function getZohoUser(_0x296990,_0x3e2b18){return new BPromise(function(_0x422bcb,_0x3ca652){request(_0x296990)['then'](function(_0x1eb293){var _0x28b2b3=null;if(_0x1eb293){_0x28b2b3=_0x1eb293[_0xda90('0x3c')][0x0];_0x28b2b3[_0xda90('0x3d')]=_0x3e2b18;}_0x422bcb(_0x28b2b3);})[_0xda90('0x3b')](function(_0x502b14){_0x3ca652(_0x502b14);});});}function createEndUser(_0x3f6fd3,_0x4aa05c,_0x2ee67c,_0x2f86d3,_0x2d2191,_0xfa5d0a){var _0x2ee67c=getName(_0x2ee67c);return request({'method':'POST','uri':_0xda90('0x3e')+_0x4aa05c+_0xda90('0x3f')+_[_0xda90('0x40')](_0xfa5d0a[_0xda90('0x41')])+'s','body':{'data':[{'Last_Name':_0x2ee67c[0x1],'First_Name':_0x2ee67c[0x0],'Phone':_0x2f86d3,'Owner':{'name':!_[_0xda90('0x1d')](_0x2d2191[_0xda90('0x42')][_0xda90('0x19')])?_0x2d2191[_0xda90('0x42')][_0xda90('0x19')]:!_[_0xda90('0x1d')](_0x2d2191[_0xda90('0x43')])?_0x2d2191[_0xda90('0x43')]+'\x20'+_0x2d2191[_0xda90('0x44')]:_0x2d2191[_0xda90('0x44')],'id':_0x2d2191['id']}}]},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x3f6fd3},'json':!![]})[_0xda90('0x2f')](function(_0x50745d){if(_0x50745d&&_0x50745d[_0xda90('0x3c')][0x0]['code']===_0xda90('0x45')){var _0x548992=_0x50745d[_0xda90('0x3c')][0x0][_0xda90('0x46')];_0x548992[_0xda90('0x3d')]=_[_0xda90('0x40')](_0xfa5d0a[_0xda90('0x41')])+'s';return _0x548992;}logger['error'](_0xda90('0x39'),JSON[_0xda90('0xe')](data));throw new Error(_0xda90('0x47')+JSON[_0xda90('0xe')](data));})[_0xda90('0x3b')](function(_0x52fec7){console[_0xda90('0x48')]('CREATE\x20ERROR',_0x52fec7);});}function getEndUser(_0x51d29d,_0x29e284,_0x40d478,_0x338808,_0x343188,_0x53e709,_0x2f2e19){var _0x270671={'method':'GET','uri':'','headers':{'Authorization':_0xda90('0x49')+_0x51d29d},'json':!![]};switch(_0x2f2e19[_0xda90('0x4a')]){case _0xda90('0x4b'):_0x270671[_0xda90('0x4c')]=_0xda90('0x3e')+_0x29e284+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x343188+'))';return getZohoUser(_0x270671,_0xda90('0x4d'))['then'](function(_0x100c67){if(_0x100c67)return _0x100c67;_0x270671[_0xda90('0x4c')]=_0xda90('0x3e')+_0x29e284+_0xda90('0x4e')+_0x343188+'))';return getZohoUser(_0x270671,_0xda90('0x4f'))[_0xda90('0x2f')](function(_0xe817cc){if(_0xe817cc)return _0xe817cc;if(_0x2f2e19[_0xda90('0x41')]!=_0xda90('0x50')){return createEndUser(_0x51d29d,_0x29e284,_0x338808,_0x343188,_0x53e709,_0x2f2e19);}else{return{};}});});break;case'contact':_0x270671[_0xda90('0x4c')]=_0xda90('0x3e')+_0x29e284+_0xda90('0x51')+_0x343188+'))';return getZohoUser(_0x270671,_0xda90('0x4d'))[_0xda90('0x2f')](function(_0x53c47b){if(_0x53c47b)return _0x53c47b;if(_0x2f2e19[_0xda90('0x41')]!='nothing'){return createEndUser(_0x51d29d,_0x29e284,_0x338808,_0x343188,_0x53e709,_0x2f2e19);}else{return{};}});break;case _0xda90('0x52'):_0x270671[_0xda90('0x4c')]='https://www.zohoapis.'+_0x29e284+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x343188+'))';return getZohoUser(_0x270671,_0xda90('0x4f'))[_0xda90('0x2f')](function(_0x5f293e){if(_0x5f293e)return _0x5f293e;if(_0x2f2e19[_0xda90('0x41')]!=_0xda90('0x50')){return createEndUser(_0x51d29d,_0x29e284,_0x338808,_0x343188,_0x53e709,_0x2f2e19);}else{return{};}});break;}}function getCall(_0x50de4d,_0x253486,_0x3075d9,_0x39ae81,_0x363561,_0x2f45a8,_0x9f1269,_0x35cafb){logger[_0xda90('0x2c')](_0xda90('0x53'));var _0x2f3187={};_0x2f3187[_0xda90('0x54')]={'name':!_[_0xda90('0x1d')](_0x39ae81[_0xda90('0x42')][_0xda90('0x19')])&&!_[_0xda90('0x1d')](_0x39ae81[_0xda90('0x34')][_0xda90('0x19')])&&_0x39ae81['profile'][_0xda90('0x19')]===_0xda90('0x55')?_0x39ae81['role'][_0xda90('0x19')]:!_['isNil'](_0x39ae81['first_name'])?_0x39ae81[_0xda90('0x43')]+'\x20'+_0x39ae81['last_name']:_0x39ae81[_0xda90('0x44')],'id':_0x39ae81['id']};_0x2f3187['Subject']=intUtil[_0xda90('0x56')](_0x2f45a8[_0xda90('0x57')],_0x9f1269,'\x20');_0x2f3187['Description']=intUtil[_0xda90('0x56')](_0x2f45a8[_0xda90('0x58')],_0x9f1269,'\x0a');if(_0x363561['enduserType']==='Contacts'){_0x2f3187['Who_Id']={'name':!_['isNil'](_0x363561[_0xda90('0x59')])?_0x363561[_0xda90('0x59')]:!_[_0xda90('0x1d')](_0x363561[_0xda90('0x5a')])?_0x363561[_0xda90('0x5a')]+'\x20'+_0x363561[_0xda90('0x5b')]:_0x363561[_0xda90('0x5b')],'id':_0x363561['id']};}if(_0x363561[_0xda90('0x3d')]===_0xda90('0x4f')){_0x2f3187[_0xda90('0x5c')]={'name':!_[_0xda90('0x1d')](_0x363561[_0xda90('0x59')])?_0x363561[_0xda90('0x59')]:!_[_0xda90('0x1d')](_0x363561[_0xda90('0x5a')])?_0x363561[_0xda90('0x5a')]+'\x20'+_0x363561[_0xda90('0x5b')]:_0x363561['Last_Name'],'id':_0x363561['id']};_0x2f3187[_0xda90('0x5d')]=_['startCase'](_0x363561[_0xda90('0x3d')]);}if(_0x9f1269[_0xda90('0x5e')]){_0x2f3187['Call_Duration']=moment[_0xda90('0x5f')](parseInt(_0x9f1269[_0xda90('0x5e')])*0x3e8)[_0xda90('0x60')]('mm:ss');}else if(_0x9f1269[_0xda90('0x61')]&&_0x9f1269[_0xda90('0x62')]){_0x2f3187[_0xda90('0x63')]=moment[_0xda90('0x5f')](moment(_0x9f1269[_0xda90('0x62')],'YYYY-MM-DDTHH:mm:ss')[_0xda90('0x64')](moment(_0x9f1269[_0xda90('0x65')],_0xda90('0x66'))))['format'](_0xda90('0x67'));}switch(_0x9f1269[_0xda90('0x68')]){case _0xda90('0x69'):_0x2f3187[_0xda90('0x6a')]=_0xda90('0x6b');break;case _0xda90('0x6c'):case'connect':_0x2f3187[_0xda90('0x6a')]=_0xda90('0x6d');break;case _0xda90('0x6e'):_0x2f3187[_0xda90('0x6a')]=_0xda90('0x6f');break;case _0xda90('0x70'):_0x2f3187[_0xda90('0x6a')]=_0xda90('0x71');break;case'timeout':_0x2f3187[_0xda90('0x6a')]=_0xda90('0x72');default:}_0x2f3187[_0xda90('0x73')]=(_0x35cafb==='outbound'?moment(_0x9f1269[_0xda90('0x65')])[_0xda90('0x60')](_0xda90('0x66')):moment(_0x9f1269['agentcalledAt'])['format'](_0xda90('0x66')))||moment()[_0xda90('0x60')](_0xda90('0x66'));_0x2f3187[_0xda90('0x74')]=_0x35cafb||'Inbound';_0x2f3187=_[_0xda90('0x75')](_0x2f3187,getCustomFields(_0x2f45a8[_0xda90('0x76')],_0x9f1269));return request({'method':_0xda90('0x77'),'uri':'https://www.zohoapis.'+_0x253486+'/crm/v2/Calls','headers':{'Authorization':_0xda90('0x49')+_0x50de4d},'body':{'data':[_0x2f3187]},'json':!![]})[_0xda90('0x2f')](function(_0x38d32c){if(_0x38d32c&&_0x38d32c['data'][0x0][_0xda90('0x78')]===_0xda90('0x45')){logger[_0xda90('0x2c')](_0xda90('0x79'));return{'id':_0x38d32c['data'][0x0][_0xda90('0x46')]['id']};}})['catch'](function(_0x20bccb){logger[_0xda90('0x2c')](_0xda90('0x7a'),_0x20bccb[_0xda90('0x7b')]);console[_0xda90('0x48')](_0xda90('0x7a'),_0x20bccb);});}exports['queue']=function(_0x31d9b6,_0x2b92fc,_0x39d242,_0x29fec4,_0x29e692,_0x41656f){var _0x52b6d9,_0x37d97f,_0x421464;_0x41656f[_0xda90('0x7c')]=intUtil['stripTrailingSlash'](_0x41656f[_0xda90('0x7c')]);_0x41656f[_0xda90('0x7d')]=intUtil[_0xda90('0x7e')](_0x41656f[_0xda90('0x7d')]);if(_0x29e692&&_0x29e692[_0xda90('0x7f')]){logger[_0xda90('0x2c')]('[QUEUE]',_0xda90('0x80'));_0x2b92fc['recordingURL']=_0x41656f[_0xda90('0x7d')]+_0xda90('0x81')+_0x2b92fc[_0xda90('0x82')]+_0xda90('0x83')+md5(_0x2b92fc[_0xda90('0x82')]);}else{_0x2b92fc['recordingURL']='';}var _0x3e0b76=_0x41656f[_0xda90('0x7c')]===_0xda90('0x84')?'eu':'com';return getAccessToken(_0x41656f)[_0xda90('0x2f')](function(_0x106926){_0x421464=_0x106926;return getUser(_0x421464,_0x3e0b76,_0x41656f,_0x29fec4[_0xda90('0x32')]);})[_0xda90('0x2f')](function(_0xb9340b){_0x52b6d9=_0xb9340b;logger[_0xda90('0x2c')](_0xda90('0x85'),_0x52b6d9['id']);return getEndUser(_0x421464,_0x3e0b76,_0x41656f,_0x2b92fc['calleridname'],_0x2b92fc['calleridnum'],_0x52b6d9,_0x39d242);})[_0xda90('0x2f')](function(_0x50c0f4){_0x37d97f=_0x50c0f4;return getCall(_0x421464,_0x3e0b76,_0x41656f,_0x52b6d9,_0x37d97f,_0x39d242,_0x2b92fc,_0xda90('0x86'));})[_0xda90('0x2f')](function(_0x438ea0){if(_0x438ea0){logger[_0xda90('0x2c')]('The\x20Call\x20ID\x20is:',_0x438ea0['id']);logger[_0xda90('0x2c')](_0xda90('0x87'),_0xda90('0x88'));emit(util['format'](_0xda90('0x89'),_0x29fec4[_0xda90('0x19')]),'trigger:browser:url',{'uri':_0xda90('0x8a')+_0x41656f['host']+_0xda90('0x8b')+_0x438ea0['id']});}})[_0xda90('0x3b')](function(_0x1972c9){logger[_0xda90('0x38')](_0xda90('0x87'),JSON['stringify'](_0x1972c9));});};exports[_0xda90('0x8c')]=function(_0x55e1a9,_0x18bff9,_0x150ee7,_0x30d12c,_0xb298e,_0x4e4291,_0x1228ce){var _0x2393c7,_0x25a00b,_0x477cd5;_0x4e4291[_0xda90('0x7c')]=intUtil['stripTrailingSlash'](_0x4e4291[_0xda90('0x7c')]);_0x4e4291[_0xda90('0x7d')]=intUtil[_0xda90('0x7e')](_0x4e4291[_0xda90('0x7d')]);if(_0x1228ce&&_0x1228ce[_0xda90('0x8d')]&&_0x1228ce['recordingFormat']!=='none'){logger['info'](_0xda90('0x8e'),_0xda90('0x80'));_0x18bff9[_0xda90('0x8f')]=_0x4e4291[_0xda90('0x7d')]+_0xda90('0x81')+_0x18bff9['uniqueid']+'/downloads?type=uniqueid&token='+md5(_0x18bff9[_0xda90('0x82')]);}var _0x31ca58=_0x4e4291[_0xda90('0x7c')]==='zoho.eu'?'eu':'com';return getAccessToken(_0x4e4291)[_0xda90('0x2f')](function(_0x17c5e4){_0x477cd5=_0x17c5e4;return getUser(_0x477cd5,_0x31ca58,_0x4e4291,_0x30d12c[_0xda90('0x32')]);})[_0xda90('0x2f')](function(_0x342dc8){_0x2393c7=_0x342dc8;logger[_0xda90('0x2c')]('The\x20User\x20ID\x20is:',_0x2393c7['id']);return getEndUser(_0x477cd5,_0x31ca58,_0x4e4291,_0x18bff9[_0xda90('0x90')],_0x18bff9['destcalleridnum'],_0x2393c7,_0x150ee7);})['then'](function(_0x59fc60){_0x25a00b=_0x59fc60;return getCall(_0x477cd5,_0x31ca58,_0x4e4291,_0x2393c7,_0x25a00b,_0x150ee7,_0x18bff9,_0xda90('0x91'));})[_0xda90('0x2f')](function(_0x18de32){if(_0x18de32){logger[_0xda90('0x2c')](_0xda90('0x92'),_0x18de32['id']);logger['info'](_0xda90('0x8e'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format']('user:%s',_0x30d12c[_0xda90('0x19')]),'trigger:browser:url',{'uri':_0xda90('0x8a')+_0x4e4291[_0xda90('0x7c')]+_0xda90('0x8b')+_0x18de32['id']});}})[_0xda90('0x3b')](function(_0x744d1b){logger[_0xda90('0x38')](_0xda90('0x8e'),JSON['stringify'](_0x744d1b));});};exports[_0xda90('0x93')]=function(_0x51e05c,_0x1d78c9,_0x4a2653,_0x371fe9,_0x131f54,_0x94abde){var _0x1ef71f,_0x5859dc,_0x5b46de;_0x94abde[_0xda90('0x7c')]=intUtil[_0xda90('0x7e')](_0x94abde[_0xda90('0x7c')]);_0x94abde['serverUrl']=intUtil[_0xda90('0x7e')](_0x94abde[_0xda90('0x7d')]);if(_0x131f54&&_0x131f54['monitor_format']){logger[_0xda90('0x2c')]('['+_0x1d78c9['lastevent'][_0xda90('0x94')]()+']',_0xda90('0x80'));_0x1d78c9[_0xda90('0x8f')]=_0x94abde['serverUrl']+_0xda90('0x81')+_0x1d78c9[_0xda90('0x82')]+'/downloads?type=uniqueid&token='+md5(_0x1d78c9['uniqueid']);}else{_0x1d78c9[_0xda90('0x8f')]='';}var _0x2f3203=_0x94abde['host']===_0xda90('0x84')?'eu':'com';return getAccessToken(_0x94abde)[_0xda90('0x2f')](function(_0x17a3e2){_0x5b46de=_0x17a3e2;return getUser(_0x5b46de,_0x2f3203,_0x94abde);})[_0xda90('0x2f')](function(_0x518d72){_0x1ef71f=_0x518d72;logger[_0xda90('0x2c')](_0xda90('0x85'),_0x1ef71f['id']);return getEndUser(_0x5b46de,_0x2f3203,_0x94abde,_0x1d78c9['calleridname'],_0x1d78c9[_0xda90('0x95')],_0x1ef71f,_0x4a2653);})[_0xda90('0x2f')](function(_0x4be0bf){_0x5859dc=_0x4be0bf;return getCall(_0x5b46de,_0x2f3203,_0x94abde,_0x1ef71f,_0x5859dc,_0x4a2653,_0x1d78c9,_0xda90('0x86'));})[_0xda90('0x2f')](function(_0x22236e){if(_0x22236e){logger[_0xda90('0x2c')](_0xda90('0x92'),_0x22236e['id']);}})[_0xda90('0x3b')](function(_0x15500c){logger[_0xda90('0x38')]('['+_0x1d78c9[_0xda90('0x68')][_0xda90('0x94')]()+']',JSON[_0xda90('0xe')](_0x15500c));});}; \ No newline at end of file +var _0xfe3f=['data','enduserType','https://www.zohoapis.','startCase','moduleCreate','role','first_name','last_name','SUCCESS','details','Error:\x20','CREATE\x20ERROR','moduleSearch','uri','contact','Contacts','nothing','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','Creating\x20new\x20call...','administrator','Subject','getString','Subjects','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','Call_Duration','utc','mm:ss','answertime','endtime','diff','starttime','lastevent','Call_Result','Called','complete','connect','Answered','Rejected','abandoned','Abandoned','timeout','Timeout','Call_Start_Time','outbound','YYYY-MM-DDTHH:mm:ss','agentcalledAt','Call_Type','Inbound','merge','/crm/v2/Calls','code','Call\x20created!','err','queue','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','recordingFormat','none','[OUTBOUND]','/api/voice/recordings/','com','destcalleridnum','Outbound','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','toUpperCase','lodash','request-promise','moment','ioredis','bluebird','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','localhost','socket.io-emitter','debug','[HTTP]','stringify','length','includes','string','picklist','type','idField','toString','variable','variableName','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','access_token','isBefore','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','add','seconds','catch','error','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','user','Administrator','The\x20failing\x20result\x20is','then'];(function(_0x16dbcd,_0x274516){var _0x34706e=function(_0x43433d){while(--_0x43433d){_0x16dbcd['push'](_0x16dbcd['shift']());}};_0x34706e(++_0x274516);}(_0xfe3f,0x194));var _0xffe3=function(_0x570370,_0x20e3c6){_0x570370=_0x570370-0x0;var _0x4f520e=_0xfe3f[_0x570370];return _0x4f520e;};'use strict';var _=require(_0xffe3('0x0'));var rp=require(_0xffe3('0x1'));var md5=require('md5');var util=require('util');var intUtil=require('./util');var moment=require(_0xffe3('0x2'));var Redis=require(_0xffe3('0x3'));var BPromise=require(_0xffe3('0x4'));var config=require(_0xffe3('0x5'));var logger=require(_0xffe3('0x6'))(_0xffe3('0x7'));config[_0xffe3('0x8')]=_[_0xffe3('0x9')](config[_0xffe3('0x8')],{'host':_0xffe3('0xa'),'port':0x18eb});var io=require(_0xffe3('0xb'))(new Redis(config['redis']));function emit(_0x1da8e9,_0x190163,_0x58d884){io['to'](_0x1da8e9)['emit'](_0x190163,_0x58d884);}function request(_0x5d34fb){logger[_0xffe3('0xc')](_0xffe3('0xd'),JSON[_0xffe3('0xe')](_0x5d34fb));return rp(_0x5d34fb);}function getCustomFields(_0x37e2a2,_0x5c52e2){var _0x569b44={};if(_0x37e2a2[_0xffe3('0xf')]>0x0){_['forEach'](_0x37e2a2,function(_0x4092b9){if(_[_0xffe3('0x10')]([_0xffe3('0x11'),_0xffe3('0x12')],_0x4092b9[_0xffe3('0x13')])&&_0x4092b9[_0xffe3('0x14')]){_0x569b44[_0x4092b9[_0xffe3('0x14')]]=_0x4092b9['content'][_0xffe3('0x15')]();}else if(_0x4092b9[_0xffe3('0x13')]===_0xffe3('0x16')&&_0x4092b9[_0xffe3('0x17')]&&_0x4092b9[_0xffe3('0x14')]&&_0x5c52e2[_0x4092b9[_0xffe3('0x17')]]){_0x569b44[_0x4092b9[_0xffe3('0x14')]]=_0x5c52e2[_0x4092b9[_0xffe3('0x17')]][_0xffe3('0x15')]();}else if(_0x4092b9[_0xffe3('0x13')]===_0xffe3('0x18')&&_0x4092b9[_0xffe3('0x19')]&&_0x4092b9[_0xffe3('0x19')][_0xffe3('0x1a')]&&_0x4092b9[_0xffe3('0x14')]&&_0x5c52e2[_0x4092b9[_0xffe3('0x19')]['name'][_0xffe3('0x1b')]()]){_0x569b44[_0x4092b9[_0xffe3('0x14')]]=_0x5c52e2[_0x4092b9[_0xffe3('0x19')][_0xffe3('0x1a')][_0xffe3('0x1b')]()]['toString']();}});}return _0x569b44;}function getName(_0x27acbf){if(_0x27acbf[_0xffe3('0x1c')]('\x20')>0x0){var _0x4096f6=_0x27acbf[_0xffe3('0x1d')](/ (.+)/);if(_0x4096f6[0x1]){return _0x4096f6;}}return[_0x27acbf,_0x27acbf];}var accountsTokens={};function getAccessToken(_0x13e105){return new Promise(function(_0x259195,_0x3f7acb){if(!_[_0xffe3('0x1e')](accountsTokens[_0x13e105['id']])&&!_[_0xffe3('0x1e')](accountsTokens[_0x13e105['id']][_0xffe3('0x1f')])){if(moment()[_0xffe3('0x20')](accountsTokens[_0x13e105['id']][_0xffe3('0x21')])){_0x259195(accountsTokens[_0x13e105['id']][_0xffe3('0x1f')]);}}var _0xe0e618;switch(_0x13e105[_0xffe3('0x22')]){case'US':_0xe0e618=_0xffe3('0x23');break;case'AU':_0xe0e618=_0xffe3('0x24');break;case'EU':_0xe0e618=_0xffe3('0x25');break;case'IN':_0xe0e618='https://accounts.zoho.in';break;case'CN':_0xe0e618=_0xffe3('0x26');break;default:_0xe0e618='https://accounts.zoho.eu';break;}var _0x27470a={'method':_0xffe3('0x27'),'uri':_0xe0e618+_0xffe3('0x28'),'qs':{'refresh_token':_0x13e105[_0xffe3('0x29')],'client_id':_0x13e105[_0xffe3('0x2a')],'client_secret':_0x13e105[_0xffe3('0x2b')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x27470a)['then'](function(_0x28bb9b){accountsTokens[_0x13e105['id']]={'access_token':_0x28bb9b[_0xffe3('0x1f')],'expires_in':moment()[_0xffe3('0x2c')](_0x28bb9b[_0xffe3('0x21')],_0xffe3('0x2d'))};_0x259195(_0x28bb9b[_0xffe3('0x1f')]);})[_0xffe3('0x2e')](function(_0x41079d){logger[_0xffe3('0x2f')](_0xffe3('0x30'),_0x41079d[_0xffe3('0x31')]);_0x3f7acb(_0x41079d);});});}function getUser(_0x425539,_0x5278f0,_0x1ee280,_0x1c7886){logger[_0xffe3('0x32')](_0xffe3('0x33'));return request({'method':_0xffe3('0x34'),'uri':util[_0xffe3('0x35')](_0xffe3('0x36'),_0x5278f0),'qs':{'type':_0xffe3('0x37')},'headers':{'Authorization':_0xffe3('0x38')+_0x425539},'json':!![]})['then'](function(_0x363e7f){if(_0x363e7f[_0xffe3('0x39')]){var _0x575c14=-0x1;if(_[_0xffe3('0x3a')](_0x363e7f[_0xffe3('0x39')])){if(!_[_0xffe3('0x1e')](_0x1c7886)){_0x575c14=_[_0xffe3('0x3b')](_0x363e7f['users'],function(_0x12c104){return _0x12c104['email']===_0x1c7886;});}if(_0x575c14>=0x0){logger['info'](_0xffe3('0x3c'));}else{logger[_0xffe3('0x32')](_0xffe3('0x3d'));_0x575c14=_['findIndex'](_0x363e7f[_0xffe3('0x39')],function(_0x5972eb){return _0x5972eb[_0xffe3('0x3e')][_0xffe3('0x1a')]==='Administrator';});}return _0x363e7f['users'][_0x575c14];}else{if(_0x363e7f[_0xffe3('0x3f')][_0xffe3('0x3e')][_0xffe3('0x1a')]===_0xffe3('0x40')){logger[_0xffe3('0x32')]('Using\x20the\x20admin\x20account!');user=_0x363e7f[_0xffe3('0x3f')];return user;}else{logger[_0xffe3('0x2f')](_0xffe3('0x41'),JSON[_0xffe3('0xe')](_0x363e7f));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0xffe3('0xe')](_0x363e7f));}}}else{logger[_0xffe3('0x2f')](_0xffe3('0x41'),JSON[_0xffe3('0xe')](_0x363e7f));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0xffe3('0xe')](_0x363e7f));}})[_0xffe3('0x2e')](function(_0x390e66){console['error'](_0x390e66);});}function getZohoUser(_0x3455c0,_0x23601a){return new BPromise(function(_0x1744e0,_0x2f821b){request(_0x3455c0)[_0xffe3('0x42')](function(_0x181732){var _0x1e31f5=null;if(_0x181732){_0x1e31f5=_0x181732[_0xffe3('0x43')][0x0];_0x1e31f5[_0xffe3('0x44')]=_0x23601a;}_0x1744e0(_0x1e31f5);})['catch'](function(_0x32ab34){_0x2f821b(_0x32ab34);});});}function createEndUser(_0x4536fd,_0x1c5fe3,_0x55b9d3,_0x5f749d,_0x3d87fb,_0x37773d){var _0x55b9d3=getName(_0x55b9d3);return request({'method':_0xffe3('0x27'),'uri':_0xffe3('0x45')+_0x1c5fe3+'/crm/v2/'+_[_0xffe3('0x46')](_0x37773d[_0xffe3('0x47')])+'s','body':{'data':[{'Last_Name':_0x55b9d3[0x1],'First_Name':_0x55b9d3[0x0],'Phone':_0x5f749d,'Owner':{'name':!_[_0xffe3('0x1e')](_0x3d87fb['role'][_0xffe3('0x1a')])?_0x3d87fb[_0xffe3('0x48')][_0xffe3('0x1a')]:!_[_0xffe3('0x1e')](_0x3d87fb['first_name'])?_0x3d87fb[_0xffe3('0x49')]+'\x20'+_0x3d87fb['last_name']:_0x3d87fb[_0xffe3('0x4a')],'id':_0x3d87fb['id']}}]},'headers':{'Authorization':_0xffe3('0x38')+_0x4536fd},'json':!![]})[_0xffe3('0x42')](function(_0x3ff2f7){if(_0x3ff2f7&&_0x3ff2f7['data'][0x0]['code']===_0xffe3('0x4b')){var _0x3a3028=_0x3ff2f7[_0xffe3('0x43')][0x0][_0xffe3('0x4c')];_0x3a3028[_0xffe3('0x44')]=_['startCase'](_0x37773d[_0xffe3('0x47')])+'s';return _0x3a3028;}logger[_0xffe3('0x2f')](_0xffe3('0x41'),JSON[_0xffe3('0xe')](data));throw new Error(_0xffe3('0x4d')+JSON['stringify'](data));})[_0xffe3('0x2e')](function(_0x385860){console['log'](_0xffe3('0x4e'),_0x385860);});}function getEndUser(_0x718dd2,_0x3404e8,_0x5868c5,_0x279ac9,_0x5245e9,_0x361b5d,_0x1bfc02){var _0x268245={'method':_0xffe3('0x34'),'uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x718dd2},'json':!![]};switch(_0x1bfc02[_0xffe3('0x4f')]){case'contact_lead':_0x268245[_0xffe3('0x50')]=_0xffe3('0x45')+_0x3404e8+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x5245e9+'))';return getZohoUser(_0x268245,'Contacts')[_0xffe3('0x42')](function(_0x44e449){if(_0x44e449)return _0x44e449;_0x268245['uri']=_0xffe3('0x45')+_0x3404e8+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x5245e9+'))';return getZohoUser(_0x268245,'Leads')['then'](function(_0x68d299){if(_0x68d299)return _0x68d299;if(_0x1bfc02[_0xffe3('0x47')]!='nothing'){return createEndUser(_0x718dd2,_0x3404e8,_0x279ac9,_0x5245e9,_0x361b5d,_0x1bfc02);}else{return{};}});});break;case _0xffe3('0x51'):_0x268245[_0xffe3('0x50')]=_0xffe3('0x45')+_0x3404e8+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x5245e9+'))';return getZohoUser(_0x268245,_0xffe3('0x52'))[_0xffe3('0x42')](function(_0x570369){if(_0x570369)return _0x570369;if(_0x1bfc02[_0xffe3('0x47')]!=_0xffe3('0x53')){return createEndUser(_0x718dd2,_0x3404e8,_0x279ac9,_0x5245e9,_0x361b5d,_0x1bfc02);}else{return{};}});break;case'lead':_0x268245[_0xffe3('0x50')]=_0xffe3('0x45')+_0x3404e8+_0xffe3('0x54')+_0x5245e9+'))';return getZohoUser(_0x268245,_0xffe3('0x55'))[_0xffe3('0x42')](function(_0x443758){if(_0x443758)return _0x443758;if(_0x1bfc02['moduleCreate']!=_0xffe3('0x53')){return createEndUser(_0x718dd2,_0x3404e8,_0x279ac9,_0x5245e9,_0x361b5d,_0x1bfc02);}else{return{};}});break;}}function getCall(_0x2dd373,_0x41d6ac,_0x2b597a,_0x4713e3,_0x5e1b19,_0x29a9fd,_0x43d088,_0x12390d){logger[_0xffe3('0x32')](_0xffe3('0x56'));var _0x38b0df={};_0x38b0df['Owner']={'name':!_[_0xffe3('0x1e')](_0x4713e3[_0xffe3('0x48')][_0xffe3('0x1a')])&&!_[_0xffe3('0x1e')](_0x4713e3['profile'][_0xffe3('0x1a')])&&_0x4713e3[_0xffe3('0x3e')][_0xffe3('0x1a')]===_0xffe3('0x57')?_0x4713e3[_0xffe3('0x48')][_0xffe3('0x1a')]:!_[_0xffe3('0x1e')](_0x4713e3['first_name'])?_0x4713e3[_0xffe3('0x49')]+'\x20'+_0x4713e3['last_name']:_0x4713e3['last_name'],'id':_0x4713e3['id']};_0x38b0df[_0xffe3('0x58')]=intUtil[_0xffe3('0x59')](_0x29a9fd[_0xffe3('0x5a')],_0x43d088,'\x20');_0x38b0df['Description']=intUtil[_0xffe3('0x59')](_0x29a9fd[_0xffe3('0x5b')],_0x43d088,'\x0a');if(_0x5e1b19[_0xffe3('0x44')]===_0xffe3('0x52')){_0x38b0df[_0xffe3('0x5c')]={'name':!_[_0xffe3('0x1e')](_0x5e1b19['Full_Name'])?_0x5e1b19[_0xffe3('0x5d')]:!_[_0xffe3('0x1e')](_0x5e1b19[_0xffe3('0x5e')])?_0x5e1b19['First_Name']+'\x20'+_0x5e1b19[_0xffe3('0x5f')]:_0x5e1b19[_0xffe3('0x5f')],'id':_0x5e1b19['id']};}if(_0x5e1b19[_0xffe3('0x44')]==='Leads'){_0x38b0df[_0xffe3('0x60')]={'name':!_[_0xffe3('0x1e')](_0x5e1b19[_0xffe3('0x5d')])?_0x5e1b19[_0xffe3('0x5d')]:!_[_0xffe3('0x1e')](_0x5e1b19[_0xffe3('0x5e')])?_0x5e1b19[_0xffe3('0x5e')]+'\x20'+_0x5e1b19[_0xffe3('0x5f')]:_0x5e1b19['Last_Name'],'id':_0x5e1b19['id']};_0x38b0df[_0xffe3('0x61')]=_['startCase'](_0x5e1b19[_0xffe3('0x44')]);}if(_0x43d088[_0xffe3('0x62')]){_0x38b0df[_0xffe3('0x63')]=moment[_0xffe3('0x64')](parseInt(_0x43d088[_0xffe3('0x62')])*0x3e8)[_0xffe3('0x35')](_0xffe3('0x65'));}else if(_0x43d088[_0xffe3('0x66')]&&_0x43d088[_0xffe3('0x67')]){_0x38b0df['Call_Duration']=moment[_0xffe3('0x64')](moment(_0x43d088[_0xffe3('0x67')],'YYYY-MM-DDTHH:mm:ss')[_0xffe3('0x68')](moment(_0x43d088[_0xffe3('0x69')],'YYYY-MM-DDTHH:mm:ss')))[_0xffe3('0x35')](_0xffe3('0x65'));}switch(_0x43d088[_0xffe3('0x6a')]){case'called':_0x38b0df[_0xffe3('0x6b')]=_0xffe3('0x6c');break;case _0xffe3('0x6d'):case _0xffe3('0x6e'):_0x38b0df['Call_Result']=_0xffe3('0x6f');break;case'rejected':_0x38b0df[_0xffe3('0x6b')]=_0xffe3('0x70');break;case _0xffe3('0x71'):_0x38b0df[_0xffe3('0x6b')]=_0xffe3('0x72');break;case _0xffe3('0x73'):_0x38b0df[_0xffe3('0x6b')]=_0xffe3('0x74');default:}_0x38b0df[_0xffe3('0x75')]=(_0x12390d===_0xffe3('0x76')?moment(_0x43d088['starttime'])[_0xffe3('0x35')](_0xffe3('0x77')):moment(_0x43d088[_0xffe3('0x78')])[_0xffe3('0x35')](_0xffe3('0x77')))||moment()['format'](_0xffe3('0x77'));_0x38b0df[_0xffe3('0x79')]=_0x12390d||_0xffe3('0x7a');_0x38b0df=_[_0xffe3('0x7b')](_0x38b0df,getCustomFields(_0x29a9fd['Fields'],_0x43d088));return request({'method':_0xffe3('0x27'),'uri':_0xffe3('0x45')+_0x41d6ac+_0xffe3('0x7c'),'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x2dd373},'body':{'data':[_0x38b0df]},'json':!![]})[_0xffe3('0x42')](function(_0x6704f6){if(_0x6704f6&&_0x6704f6[_0xffe3('0x43')][0x0][_0xffe3('0x7d')]===_0xffe3('0x4b')){logger[_0xffe3('0x32')](_0xffe3('0x7e'));return{'id':_0x6704f6[_0xffe3('0x43')][0x0][_0xffe3('0x4c')]['id']};}})['catch'](function(_0x246766){logger[_0xffe3('0x32')](_0xffe3('0x7f'),_0x246766[_0xffe3('0x31')]);console['log'](_0xffe3('0x7f'),_0x246766);});}exports[_0xffe3('0x80')]=function(_0x1869eb,_0x19c1c7,_0x50e9fd,_0x48180e,_0x5a1fba,_0x204ebe){var _0x48203b,_0x3f3670,_0x2a1b64;_0x204ebe[_0xffe3('0x81')]=intUtil[_0xffe3('0x82')](_0x204ebe['host']);_0x204ebe[_0xffe3('0x83')]=intUtil[_0xffe3('0x82')](_0x204ebe[_0xffe3('0x83')]);if(_0x5a1fba&&_0x5a1fba[_0xffe3('0x84')]){logger[_0xffe3('0x32')](_0xffe3('0x85'),_0xffe3('0x86'));_0x19c1c7[_0xffe3('0x87')]=_0x204ebe['serverUrl']+'/api/voice/recordings/'+_0x19c1c7[_0xffe3('0x88')]+_0xffe3('0x89')+md5(_0x19c1c7['uniqueid']);}else{_0x19c1c7[_0xffe3('0x87')]='';}var _0x37536a=_0x204ebe[_0xffe3('0x81')]===_0xffe3('0x8a')?'eu':'com';return getAccessToken(_0x204ebe)[_0xffe3('0x42')](function(_0xe4c16c){_0x2a1b64=_0xe4c16c;return getUser(_0x2a1b64,_0x37536a,_0x204ebe,_0x48180e[_0xffe3('0x8b')]);})[_0xffe3('0x42')](function(_0x2a422a){_0x48203b=_0x2a422a;logger['info'](_0xffe3('0x8c'),_0x48203b['id']);return getEndUser(_0x2a1b64,_0x37536a,_0x204ebe,_0x19c1c7[_0xffe3('0x8d')],_0x19c1c7[_0xffe3('0x8e')],_0x48203b,_0x50e9fd);})['then'](function(_0x465e97){_0x3f3670=_0x465e97;return getCall(_0x2a1b64,_0x37536a,_0x204ebe,_0x48203b,_0x3f3670,_0x50e9fd,_0x19c1c7,'Inbound');})['then'](function(_0x1a4087){if(_0x1a4087){logger[_0xffe3('0x32')](_0xffe3('0x8f'),_0x1a4087['id']);logger[_0xffe3('0x32')]('[QUEUE]',_0xffe3('0x90'));emit(util['format'](_0xffe3('0x91'),_0x48180e[_0xffe3('0x1a')]),'trigger:browser:url',{'uri':'https://crm.'+_0x204ebe[_0xffe3('0x81')]+'/crm/EntityInfo.do?module=Calls&id='+_0x1a4087['id']});}})['catch'](function(_0x1b9059){logger[_0xffe3('0x2f')](_0xffe3('0x85'),JSON[_0xffe3('0xe')](_0x1b9059));});};exports[_0xffe3('0x76')]=function(_0x43b4ac,_0x427de3,_0x3b7cab,_0x18bde5,_0x3a6cc5,_0x4958e3,_0x52f691){var _0x355e29,_0x56f3ce,_0x2662c8;_0x4958e3[_0xffe3('0x81')]=intUtil['stripTrailingSlash'](_0x4958e3['host']);_0x4958e3[_0xffe3('0x83')]=intUtil['stripTrailingSlash'](_0x4958e3[_0xffe3('0x83')]);if(_0x52f691&&_0x52f691['recordingFormat']&&_0x52f691[_0xffe3('0x92')]!==_0xffe3('0x93')){logger[_0xffe3('0x32')](_0xffe3('0x94'),_0xffe3('0x86'));_0x427de3['recordingURL']=_0x4958e3['serverUrl']+_0xffe3('0x95')+_0x427de3[_0xffe3('0x88')]+_0xffe3('0x89')+md5(_0x427de3[_0xffe3('0x88')]);}var _0x406f4c=_0x4958e3[_0xffe3('0x81')]===_0xffe3('0x8a')?'eu':_0xffe3('0x96');return getAccessToken(_0x4958e3)['then'](function(_0x53ef53){_0x2662c8=_0x53ef53;return getUser(_0x2662c8,_0x406f4c,_0x4958e3,_0x18bde5['email']);})[_0xffe3('0x42')](function(_0x15e137){_0x355e29=_0x15e137;logger['info'](_0xffe3('0x8c'),_0x355e29['id']);return getEndUser(_0x2662c8,_0x406f4c,_0x4958e3,_0x427de3['destcalleridname'],_0x427de3[_0xffe3('0x97')],_0x355e29,_0x3b7cab);})[_0xffe3('0x42')](function(_0x4ed43a){_0x56f3ce=_0x4ed43a;return getCall(_0x2662c8,_0x406f4c,_0x4958e3,_0x355e29,_0x56f3ce,_0x3b7cab,_0x427de3,_0xffe3('0x98'));})['then'](function(_0x4583a7){if(_0x4583a7){logger['info']('The\x20Call\x20ID\x20is:',_0x4583a7['id']);logger[_0xffe3('0x32')](_0xffe3('0x94'),_0xffe3('0x90'));emit(util['format'](_0xffe3('0x91'),_0x18bde5['name']),_0xffe3('0x99'),{'uri':_0xffe3('0x9a')+_0x4958e3[_0xffe3('0x81')]+_0xffe3('0x9b')+_0x4583a7['id']});}})[_0xffe3('0x2e')](function(_0x2df44c){logger[_0xffe3('0x2f')](_0xffe3('0x94'),JSON[_0xffe3('0xe')](_0x2df44c));});};exports['unmanaged']=function(_0x4c16ee,_0x26b414,_0x1ab058,_0x3dcb25,_0x2d2d84,_0x5567a4){var _0x1c4a71,_0x411479,_0x2b34a8;_0x5567a4[_0xffe3('0x81')]=intUtil['stripTrailingSlash'](_0x5567a4[_0xffe3('0x81')]);_0x5567a4[_0xffe3('0x83')]=intUtil[_0xffe3('0x82')](_0x5567a4['serverUrl']);if(_0x2d2d84&&_0x2d2d84['monitor_format']){logger[_0xffe3('0x32')]('['+_0x26b414['lastevent'][_0xffe3('0x9c')]()+']',_0xffe3('0x86'));_0x26b414['recordingURL']=_0x5567a4[_0xffe3('0x83')]+_0xffe3('0x95')+_0x26b414[_0xffe3('0x88')]+_0xffe3('0x89')+md5(_0x26b414['uniqueid']);}else{_0x26b414[_0xffe3('0x87')]='';}var _0x2674ee=_0x5567a4[_0xffe3('0x81')]===_0xffe3('0x8a')?'eu':_0xffe3('0x96');return getAccessToken(_0x5567a4)[_0xffe3('0x42')](function(_0x5bc1b6){_0x2b34a8=_0x5bc1b6;return getUser(_0x2b34a8,_0x2674ee,_0x5567a4);})[_0xffe3('0x42')](function(_0x5c8de0){_0x1c4a71=_0x5c8de0;logger[_0xffe3('0x32')](_0xffe3('0x8c'),_0x1c4a71['id']);return getEndUser(_0x2b34a8,_0x2674ee,_0x5567a4,_0x26b414[_0xffe3('0x8d')],_0x26b414[_0xffe3('0x8e')],_0x1c4a71,_0x1ab058);})[_0xffe3('0x42')](function(_0xe0f766){_0x411479=_0xe0f766;return getCall(_0x2b34a8,_0x2674ee,_0x5567a4,_0x1c4a71,_0x411479,_0x1ab058,_0x26b414,_0xffe3('0x7a'));})[_0xffe3('0x42')](function(_0x138d35){if(_0x138d35){logger[_0xffe3('0x32')](_0xffe3('0x8f'),_0x138d35['id']);}})[_0xffe3('0x2e')](function(_0x820d33){logger['error']('['+_0x26b414[_0xffe3('0x6a')][_0xffe3('0x9c')]()+']',JSON[_0xffe3('0xe')](_0x820d33));});}; \ 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 c91377c..2470c8e 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 _0xbf2d=['%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs','mustache','../../../../config/logger','trigger','exec','data2','Script','render','data3','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s'];(function(_0x4c8f23,_0x152081){var _0x418f8d=function(_0x478d7c){while(--_0x478d7c){_0x4c8f23['push'](_0x4c8f23['shift']());}};_0x418f8d(++_0x152081);}(_0xbf2d,0xcd));var _0xdbf2=function(_0x1ffe30,_0x1ab73a){_0x1ffe30=_0x1ffe30-0x0;var _0x28a0f4=_0xbf2d[_0x1ffe30];return _0x28a0f4;};'use strict';var util=require(_0xdbf2('0x0'));var sh=require(_0xdbf2('0x1'));var Mustache=require(_0xdbf2('0x2'));var logger=require(_0xdbf2('0x3'))(_0xdbf2('0x4'));exports[_0xdbf2('0x5')]=function(_0x3fd7cb,_0x442fad){var _0x114d03=_0x3fd7cb[_0xdbf2('0x6')]?_0x3fd7cb['data2']:_0xdbf2('0x7');var _0x14220f=_0x3fd7cb['data3']?Mustache[_0xdbf2('0x8')](_0x3fd7cb[_0xdbf2('0x9')],_0x442fad):_0x442fad;sh[_0xdbf2('0x5')](_0x14220f,function(_0x213806,_0x1cd1fc,_0x22104e){if(_0x213806!==0x0){logger['error'](util['format'](_0xdbf2('0xa'),_0x114d03,_0x14220f,_0x213806,_0x22104e));}else{logger['info'](util['format'](_0xdbf2('0xb'),_0x114d03,_0x14220f,_0x1cd1fc));}});}; \ No newline at end of file +var _0x8062=['exec','data2','Script','render','error','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs','../../../../config/logger','trigger'];(function(_0x504df1,_0x289598){var _0x1063b5=function(_0x627abd){while(--_0x627abd){_0x504df1['push'](_0x504df1['shift']());}};_0x1063b5(++_0x289598);}(_0x8062,0x74));var _0x2806=function(_0x46ddd3,_0x2f4887){_0x46ddd3=_0x46ddd3-0x0;var _0x3f7c8c=_0x8062[_0x46ddd3];return _0x3f7c8c;};'use strict';var util=require(_0x2806('0x0'));var sh=require(_0x2806('0x1'));var Mustache=require('mustache');var logger=require(_0x2806('0x2'))(_0x2806('0x3'));exports[_0x2806('0x4')]=function(_0x3fafd9,_0x3bbc3e){var _0x38a88a=_0x3fafd9['data2']?_0x3fafd9[_0x2806('0x5')]:_0x2806('0x6');var _0xab6da4=_0x3fafd9['data3']?Mustache[_0x2806('0x7')](_0x3fafd9['data3'],_0x3bbc3e):_0x3bbc3e;sh[_0x2806('0x4')](_0xab6da4,function(_0x2c31bb,_0x59ccf5,_0x32f7f7){if(_0x2c31bb!==0x0){logger[_0x2806('0x8')](util[_0x2806('0x9')](_0x2806('0xa'),_0x38a88a,_0xab6da4,_0x2c31bb,_0x32f7f7));}else{logger['info'](util['format'](_0x2806('0xb'),_0x38a88a,_0xab6da4,_0x59ccf5));}});}; \ 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 3b8efb0..b3cc21c 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 _0xc6a3=[',\x20request\x20body:\x20','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','lodash','mustache','../../../../config/logger','trigger','exec','render','data2','data5','headers','data6','parse','error','toUpperCase','PUT','data7','body','stack','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','data1','stringify','then','isNil'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc6a3,0x150));var _0x3c6a=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xc6a3[_0x501510];return _0x1e6ee5;};'use strict';var rp=require('request-promise');var util=require('util');var _=require(_0x3c6a('0x0'));var Mustache=require(_0x3c6a('0x1'));var logger=require(_0x3c6a('0x2'))(_0x3c6a('0x3'));exports[_0x3c6a('0x4')]=function(_0x27cf14,_0x4246d5){var _0x354151,_0x40abab;var _0x122fb6={'method':_0x27cf14['data1']['toUpperCase'](),'uri':Mustache[_0x3c6a('0x5')](_0x27cf14[_0x3c6a('0x6')],_0x4246d5),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x27cf14[_0x3c6a('0x7')])==='number'&&parseInt(_0x27cf14[_0x3c6a('0x7')])>=0x1&&parseInt(_0x27cf14[_0x3c6a('0x7')])<=0xa?parseInt(_0x27cf14[_0x3c6a('0x7')])*0x3e8:0x5*0x3e8};try{_0x122fb6[_0x3c6a('0x8')]=_0x27cf14[_0x3c6a('0x9')]?JSON[_0x3c6a('0xa')](Mustache['render'](_0x27cf14['data6'],_0x4246d5)):{};}catch(_0x1fb420){logger[_0x3c6a('0xb')](_0x1fb420['stack']);}switch(_0x27cf14['data1'][_0x3c6a('0xc')]()){case'GET':case'DELETE':_0x354151=null;_0x122fb6['qs']=_0x4246d5;break;case'POST':case _0x3c6a('0xd'):if(_0x27cf14[_0x3c6a('0xe')]){try{_0x354151=JSON['parse'](Mustache[_0x3c6a('0x5')](_0x27cf14[_0x3c6a('0xe')],_0x4246d5));_0x122fb6[_0x3c6a('0xf')]=_0x354151;}catch(_0xea96cc){logger['error'](_0xea96cc[_0x3c6a('0x10')]);logger[_0x3c6a('0xb')](_0x3c6a('0x11'));}}else{_0x354151=_0x4246d5;_0x122fb6[_0x3c6a('0xf')]=_0x354151;}break;}logger[_0x3c6a('0x12')](util['format'](_0x3c6a('0x13'),_0x27cf14[_0x3c6a('0x14')],_0x27cf14[_0x3c6a('0x6')],JSON[_0x3c6a('0x15')](_0x122fb6)));rp(_0x122fb6)[_0x3c6a('0x16')](function(_0x33bfa4){_0x354151=!_[_0x3c6a('0x17')](_0x354151)?_0x3c6a('0x18')+_0x354151:'';_0x40abab=typeof _0x33bfa4['body']==='object'?JSON[_0x3c6a('0x15')](_0x33bfa4[_0x3c6a('0xf')]):_0x33bfa4[_0x3c6a('0xf')];logger[_0x3c6a('0x12')](util['format'](_0x3c6a('0x19'),_0x27cf14['data1'],_0x27cf14[_0x3c6a('0x6')],_0x33bfa4['statusCode'],_0x40abab));})[_0x3c6a('0x1a')](function(_0x11eb4c){logger['error'](util['format'](_0x3c6a('0x1b'),_0x27cf14['data1'],_0x27cf14[_0x3c6a('0x6')],_0x11eb4c['statusCode'],_0x11eb4c[_0x3c6a('0x1c')],_0x11eb4c[_0x3c6a('0x1d')]));});}; \ No newline at end of file +var _0xaf43=['error','GET','POST','PUT','data7','body','stack','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then',',\x20request\x20body:\x20','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','name','request-promise','util','mustache','../../../../config/logger','exec','data1','toUpperCase','render','data2','data5','number','headers','data6'];(function(_0x5e365e,_0x8ed4f1){var _0x1d9deb=function(_0x434d04){while(--_0x434d04){_0x5e365e['push'](_0x5e365e['shift']());}};_0x1d9deb(++_0x8ed4f1);}(_0xaf43,0x89));var _0x3af4=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xaf43[_0x57b54c];return _0x59cc19;};'use strict';var rp=require(_0x3af4('0x0'));var util=require(_0x3af4('0x1'));var _=require('lodash');var Mustache=require(_0x3af4('0x2'));var logger=require(_0x3af4('0x3'))('trigger');exports[_0x3af4('0x4')]=function(_0x39f0af,_0x562996){var _0xde834c,_0x42316d;var _0x441e09={'method':_0x39f0af[_0x3af4('0x5')][_0x3af4('0x6')](),'uri':Mustache[_0x3af4('0x7')](_0x39f0af[_0x3af4('0x8')],_0x562996),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x39f0af[_0x3af4('0x9')])===_0x3af4('0xa')&&parseInt(_0x39f0af['data5'])>=0x1&&parseInt(_0x39f0af[_0x3af4('0x9')])<=0xa?parseInt(_0x39f0af[_0x3af4('0x9')])*0x3e8:0x5*0x3e8};try{_0x441e09[_0x3af4('0xb')]=_0x39f0af[_0x3af4('0xc')]?JSON['parse'](Mustache['render'](_0x39f0af[_0x3af4('0xc')],_0x562996)):{};}catch(_0x5d5ab2){logger[_0x3af4('0xd')](_0x5d5ab2['stack']);}switch(_0x39f0af[_0x3af4('0x5')][_0x3af4('0x6')]()){case _0x3af4('0xe'):case'DELETE':_0xde834c=null;_0x441e09['qs']=_0x562996;break;case _0x3af4('0xf'):case _0x3af4('0x10'):if(_0x39f0af[_0x3af4('0x11')]){try{_0xde834c=JSON['parse'](Mustache[_0x3af4('0x7')](_0x39f0af[_0x3af4('0x11')],_0x562996));_0x441e09[_0x3af4('0x12')]=_0xde834c;}catch(_0xd749b5){logger[_0x3af4('0xd')](_0xd749b5[_0x3af4('0x13')]);logger['error']('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0xde834c=_0x562996;_0x441e09[_0x3af4('0x12')]=_0xde834c;}break;}logger[_0x3af4('0x14')](util[_0x3af4('0x15')](_0x3af4('0x16'),_0x39f0af['data1'],_0x39f0af[_0x3af4('0x8')],JSON[_0x3af4('0x17')](_0x441e09)));rp(_0x441e09)[_0x3af4('0x18')](function(_0x3b9530){_0xde834c=!_['isNil'](_0xde834c)?_0x3af4('0x19')+_0xde834c:'';_0x42316d=typeof _0x3b9530[_0x3af4('0x12')]==='object'?JSON[_0x3af4('0x17')](_0x3b9530[_0x3af4('0x12')]):_0x3b9530[_0x3af4('0x12')];logger[_0x3af4('0x14')](util[_0x3af4('0x15')](_0x3af4('0x1a'),_0x39f0af[_0x3af4('0x5')],_0x39f0af['data2'],_0x3b9530[_0x3af4('0x1b')],_0x42316d));})[_0x3af4('0x1c')](function(_0x5c2de7){logger[_0x3af4('0xd')](util[_0x3af4('0x15')]('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x39f0af[_0x3af4('0x5')],_0x39f0af[_0x3af4('0x8')],_0x5c2de7[_0x3af4('0x1b')],_0x5c2de7[_0x3af4('0x1d')],_0x5c2de7['message']));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 9bb0a1d..55d04d3 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 _0x77eb=['result','catch','exports','../../config/logger','routing','http','Request','request','then','debug','error','message'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x77eb,0xc3));var _0xb77e=function(_0x515afd,_0x1a1e91){_0x515afd=_0x515afd-0x0;var _0x536d53=_0x77eb[_0x515afd];return _0x536d53;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0xb77e('0x0'))(_0xb77e('0x1'));var client=jayson['client'][_0xb77e('0x2')]({'port':0x2329});client[_0xb77e('0x3')]=function(_0x2fd656,_0x5757cd){return new BPromise(function(_0x1379a7,_0xe6a2be){return client[_0xb77e('0x4')](_0x2fd656,_0x5757cd)[_0xb77e('0x5')](function(_0x20eb6f){logger[_0xb77e('0x6')]('rpc',_0xb77e('0x1'),_0x2fd656,_0x5757cd,_0x20eb6f);if(_0x20eb6f[_0xb77e('0x7')]){logger[_0xb77e('0x7')]('rpc',_0xb77e('0x1'),_0x2fd656,_0x20eb6f[_0xb77e('0x7')][_0xb77e('0x8')],_0x5757cd);return _0xe6a2be(_0x20eb6f['error']['message']);}else{return _0x1379a7(_0x20eb6f[_0xb77e('0x9')]);}})[_0xb77e('0xa')](function(_0x1b1d6f){logger[_0xb77e('0x7')]('rpc',_0xb77e('0x1'),_0x2fd656,_0x1b1d6f,_0x5757cd);return _0xe6a2be(_0x1b1d6f);});});};module[_0xb77e('0xb')]=client; \ No newline at end of file +var _0x3912=['../../config/logger','routing','client','http','Request','request','then','debug','rpc','error','message','catch','exports','jayson/promise','bluebird'];(function(_0xc62928,_0xc0d407){var _0x25c9d8=function(_0x1b7672){while(--_0x1b7672){_0xc62928['push'](_0xc62928['shift']());}};_0x25c9d8(++_0xc0d407);}(_0x3912,0x139));var _0x2391=function(_0x348d90,_0x3dab1d){_0x348d90=_0x348d90-0x0;var _0x21ce28=_0x3912[_0x348d90];return _0x21ce28;};'use strict';var jayson=require(_0x2391('0x0'));var BPromise=require(_0x2391('0x1'));var logger=require(_0x2391('0x2'))(_0x2391('0x3'));var client=jayson[_0x2391('0x4')][_0x2391('0x5')]({'port':0x2329});client[_0x2391('0x6')]=function(_0x35eb05,_0x4f50ca){return new BPromise(function(_0x122c90,_0x264b22){return client[_0x2391('0x7')](_0x35eb05,_0x4f50ca)[_0x2391('0x8')](function(_0x995f74){logger[_0x2391('0x9')](_0x2391('0xa'),_0x2391('0x3'),_0x35eb05,_0x4f50ca,_0x995f74);if(_0x995f74[_0x2391('0xb')]){logger[_0x2391('0xb')](_0x2391('0xa'),_0x2391('0x3'),_0x35eb05,_0x995f74[_0x2391('0xb')][_0x2391('0xc')],_0x4f50ca);return _0x264b22(_0x995f74['error']['message']);}else{return _0x122c90(_0x995f74['result']);}})[_0x2391('0xd')](function(_0x14872a){logger[_0x2391('0xb')](_0x2391('0xa'),_0x2391('0x3'),_0x35eb05,_0x14872a,_0x4f50ca);return _0x264b22(_0x14872a);});});};module[_0x2391('0xe')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index d74e057..625ce3d 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 _0xb84e=['then','getMailAccounts','initMailAccounts','refresh','mailAccounts','listen','getSettings','loginMailFrequency','catch','error','Email\x20service\x20initialization','./server','./lib/email','../../config/logger','email','resolve'];(function(_0x431054,_0x6ad732){var _0x5adc9b=function(_0x591daa){while(--_0x591daa){_0x431054['push'](_0x431054['shift']());}};_0x5adc9b(++_0x6ad732);}(_0xb84e,0x16b));var _0xeb84=function(_0x25a42a,_0x3d489b){_0x25a42a=_0x25a42a-0x0;var _0x1129b1=_0xb84e[_0x25a42a];return _0x1129b1;};'use strict';var server=require(_0xeb84('0x0'));var Realtime=require('./realtime');var EmailChannel=require(_0xeb84('0x1'));var mailAccount=require('./rpc/mailAccount');var setting=require('./rpc/setting');var logger=require(_0xeb84('0x2'))(_0xeb84('0x3'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0xeb84('0x4')]()[_0xeb84('0x5')](mailAccount[_0xeb84('0x6')]())[_0xeb84('0x5')](realtime[_0xeb84('0x7')]())[_0xeb84('0x5')](function(){email[_0xeb84('0x8')](realtime[_0xeb84('0x9')]);return realtime;});}function main(){return server[_0xeb84('0xa')](realtime,email)[_0xeb84('0x5')](function(){return initRealtime();})[_0xeb84('0x5')](function(){return setting[_0xeb84('0xb')]();})[_0xeb84('0x5')](function(_0x1d8e8c){return setInterval(initRealtime,_0x1d8e8c[_0xeb84('0xc')]*0x3e8);})[_0xeb84('0xd')](function(_0x41c231){logger[_0xeb84('0xe')](_0xeb84('0xf'),_0x41c231);});}main(); \ No newline at end of file +var _0x7582=['then','refresh','listen','getSettings','loginMailFrequency','Email\x20service\x20initialization','./lib/email','./rpc/mailAccount','../../config/logger','email','resolve'];(function(_0x2158a8,_0x335f85){var _0x4b1071=function(_0x2b9124){while(--_0x2b9124){_0x2158a8['push'](_0x2158a8['shift']());}};_0x4b1071(++_0x335f85);}(_0x7582,0xd7));var _0x2758=function(_0x15af0f,_0x5454ce){_0x15af0f=_0x15af0f-0x0;var _0x2bd1cb=_0x7582[_0x15af0f];return _0x2bd1cb;};'use strict';var server=require('./server');var Realtime=require('./realtime');var EmailChannel=require(_0x2758('0x0'));var mailAccount=require(_0x2758('0x1'));var setting=require('./rpc/setting');var logger=require(_0x2758('0x2'))(_0x2758('0x3'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x2758('0x4')]()[_0x2758('0x5')](mailAccount['getMailAccounts']())[_0x2758('0x5')](realtime['initMailAccounts']())[_0x2758('0x5')](function(){email[_0x2758('0x6')](realtime['mailAccounts']);return realtime;});}function main(){return server[_0x2758('0x7')](realtime,email)['then'](function(){return initRealtime();})[_0x2758('0x5')](function(){return setting[_0x2758('0x8')]();})['then'](function(_0x54f42b){return setInterval(initRealtime,_0x54f42b[_0x2758('0x9')]*0x3e8);})['catch'](function(_0x5dff51){logger['error'](_0x2758('0xa'),_0x5dff51);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 8e2deb6..b4776b0 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 _0x1dae=['messageStatus','isNil','mailAccount:update','refresh','hasOwnProperty','service','handleImapBox','bind','handleImapEmail','end','handleImapEnd','error','handleImapError','disabled','connected','total','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','lastName','notify','then','catch','sendMail','send','verifySmtp','Smtp','lastSync','verify','lodash','bluebird','md5','ioredis','../../../config/environment','../../../config/logger','redis','defaults','localhost','socket.io-emitter','./imap','./smtp','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','emit','name','key','active','Imap','status'];(function(_0x2e7aa8,_0x2c6c40){var _0x13ec84=function(_0x30d511){while(--_0x30d511){_0x2e7aa8['push'](_0x2e7aa8['shift']());}};_0x13ec84(++_0x2c6c40);}(_0x1dae,0x14d));var _0xe1da=function(_0xa9acb3,_0xf5bf1d){_0xa9acb3=_0xa9acb3-0x0;var _0x829049=_0x1dae[_0xa9acb3];return _0x829049;};'use strict';var _=require(_0xe1da('0x0'));var moment=require('moment');var BPromise=require(_0xe1da('0x1'));var md5=require(_0xe1da('0x2'));var Redis=require(_0xe1da('0x3'));var config=require(_0xe1da('0x4'));var logger=require(_0xe1da('0x5'))('email');config[_0xe1da('0x6')]=_[_0xe1da('0x7')](config['redis'],{'host':_0xe1da('0x8'),'port':0x18eb});var io=require(_0xe1da('0x9'))(new Redis(config[_0xe1da('0x6')]));var EmailImap=require(_0xe1da('0xa'));var EmailSmtp=require(_0xe1da('0xb'));var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x59898a){logger[_0xe1da('0xc')](_0xe1da('0xd'));this[_0xe1da('0xe')]=_0x59898a['mailAccounts'];this[_0xe1da('0xf')]={};this[_0xe1da('0x10')]=new EmailSmtp();}EmailChannel[_0xe1da('0x11')][_0xe1da('0x12')]=function(_0x219585){var _0x32040f=this[_0xe1da('0xe')][_0x219585];var _0x3d9618={'id':_0x32040f['id'],'name':_0x32040f[_0xe1da('0x13')],'key':_0x32040f[_0xe1da('0x14')],'active':_0x32040f[_0xe1da('0x15')],'Imap':{'status':_0x32040f[_0xe1da('0x16')][_0xe1da('0x17')],'messageStatus':_0x32040f[_0xe1da('0x16')][_0xe1da('0x18')],'total':_0x32040f[_0xe1da('0x16')]['total']}};if(_[_0xe1da('0x19')](md5Accounts[_0x219585])){md5Accounts[_0x219585]={};}var _0x2b0c20=md5(JSON['stringify'](_0x3d9618));if(md5Accounts[_0x219585][_0xe1da('0x2')]!==_0x2b0c20){md5Accounts[_0x219585][_0xe1da('0x2')]=_0x2b0c20;io[_0xe1da('0x12')](_0xe1da('0x1a'),_0x3d9618);}};EmailChannel[_0xe1da('0x11')][_0xe1da('0x1b')]=function(_0x45c409){for(var _0x9d2608 in _0x45c409){if(_0x45c409[_0xe1da('0x1c')](_0x9d2608)){if(_0x45c409[_0x9d2608][_0xe1da('0x16')]&&_0x45c409[_0x9d2608][_0xe1da('0x15')]){var _0x4d059e=_0x45c409[_0x9d2608][_0xe1da('0x16')];if(!_0x4d059e[_0xe1da('0x1d')]&&_0x45c409[_0x9d2608]['provider']!=='custom')_0x4d059e['service']=_0x45c409[_0x9d2608]['provider'];if(!this[_0xe1da('0xf')][_0xe1da('0x1c')](_0x4d059e['id'])){this['imapAccounts'][_0x4d059e['id']]=new EmailImap(_0x4d059e,_0x45c409[_0x9d2608]['email']);this[_0xe1da('0xf')][_0x4d059e['id']]['on']('box',this[_0xe1da('0x1e')][_0xe1da('0x1f')](this,_0x9d2608));this[_0xe1da('0xf')][_0x4d059e['id']]['on']('email',this[_0xe1da('0x20')][_0xe1da('0x1f')](this,_0x9d2608));this[_0xe1da('0xf')][_0x4d059e['id']]['on'](_0xe1da('0x21'),this[_0xe1da('0x22')]['bind'](this,_0x9d2608));this[_0xe1da('0xf')][_0x4d059e['id']]['on'](_0xe1da('0x23'),this[_0xe1da('0x24')][_0xe1da('0x1f')](this,_0x9d2608));}}else{if(_['isNil'](this[_0xe1da('0xe')][_0x9d2608]['Imap'])){this[_0xe1da('0xe')][_0x9d2608][_0xe1da('0x16')]={};}this[_0xe1da('0xe')][_0x9d2608][_0xe1da('0x16')][_0xe1da('0x17')]=_0xe1da('0x25');this['mailAccounts'][_0x9d2608]['Imap'][_0xe1da('0x18')]='';this[_0xe1da('0x12')](_0x9d2608);}}}};EmailChannel[_0xe1da('0x11')][_0xe1da('0x1e')]=function(_0x1a1db8,_0x231d2c){if(this[_0xe1da('0xe')][_0x1a1db8]){this[_0xe1da('0xe')][_0x1a1db8][_0xe1da('0x16')]['status']=_0xe1da('0x26');this[_0xe1da('0xe')][_0x1a1db8][_0xe1da('0x16')][_0xe1da('0x18')]=_0x231d2c[_0xe1da('0x13')];if(_0x231d2c['messages']){this[_0xe1da('0xe')][_0x1a1db8][_0xe1da('0x16')][_0xe1da('0x27')]=_0x231d2c['messages'][_0xe1da('0x27')];}return this[_0xe1da('0x12')](_0x1a1db8);}};EmailChannel[_0xe1da('0x11')][_0xe1da('0x20')]=function(_0x1811b5,_0x558bc2){logger[_0xe1da('0xc')](_0xe1da('0x28'),_0x558bc2['firstName'],_0x558bc2[_0xe1da('0x29')],_0x558bc2['from'],_0x1811b5);if(this['mailAccounts'][_0x1811b5]){return mailAccount[_0xe1da('0x2a')](_0x1811b5,_0x558bc2)[_0xe1da('0x2b')](function(_0x2ccd88){if(_0x2ccd88){logger['info']('Mail\x20accepted\x20from\x20routing');}})[_0xe1da('0x2c')](function(_0x97b08b){logger[_0xe1da('0x23')]('Mail\x20not\x20accepted\x20from\x20routing\x20%s',JSON['stringify'](_0x97b08b));});}};EmailChannel[_0xe1da('0x11')][_0xe1da('0x22')]=function(_0x400f8f){if(this[_0xe1da('0xe')][_0x400f8f]&&this['mailAccounts'][_0x400f8f]['Imap']){if(this[_0xe1da('0xf')][this[_0xe1da('0xe')][_0x400f8f]['Imap']['id']]){delete this['imapAccounts'][this[_0xe1da('0xe')][_0x400f8f][_0xe1da('0x16')]['id']];}this[_0xe1da('0xe')][_0x400f8f][_0xe1da('0x16')]['lastSync']=moment();this[_0xe1da('0x12')](_0x400f8f);}};EmailChannel['prototype'][_0xe1da('0x24')]=function(_0x4b0f6d,_0x530c1f){if(this[_0xe1da('0xe')][_0x4b0f6d]){this['mailAccounts'][_0x4b0f6d][_0xe1da('0x16')][_0xe1da('0x17')]=_0xe1da('0x23');this[_0xe1da('0xe')][_0x4b0f6d]['Imap']['messageStatus']=_0x530c1f;return this[_0xe1da('0x12')](_0x4b0f6d);}};EmailChannel[_0xe1da('0x11')][_0xe1da('0x2d')]=function(_0x114b01,_0x916bd6){return this[_0xe1da('0x10')][_0xe1da('0x2e')](_0x114b01,_0x916bd6);};EmailChannel[_0xe1da('0x11')][_0xe1da('0x2f')]=function(_0x58e066){var _0x583395=this;if(this[_0xe1da('0xe')][_0x58e066['id']]){if(_[_0xe1da('0x19')](this[_0xe1da('0xe')][_0x58e066['id']]['Smtp'])){this[_0xe1da('0xe')][_0x58e066['id']][_0xe1da('0x30')]={};}this[_0xe1da('0xe')][_0x58e066['id']][_0xe1da('0x30')][_0xe1da('0x31')]=moment();return new BPromise(function(_0x143fbe,_0x400b19){return _0x583395['smtp']['verify'](_0x58e066)[_0xe1da('0x2b')](function(_0x4dcb7f){_0x583395[_0xe1da('0xe')][_0x58e066['id']]['Smtp'][_0xe1da('0x17')]='verified';_0x583395[_0xe1da('0xe')][_0x58e066['id']][_0xe1da('0x30')]['messageStatus']='';_0x583395['emit'](_0x58e066['id']);_0x143fbe(_0x4dcb7f);})[_0xe1da('0x2c')](function(_0x256ef4){_0x583395[_0xe1da('0xe')][_0x58e066['id']][_0xe1da('0x30')]['status']=_0xe1da('0x23');_0x583395[_0xe1da('0xe')][_0x58e066['id']][_0xe1da('0x30')][_0xe1da('0x18')]=_0x256ef4;_0x583395[_0xe1da('0x12')](_0x58e066['id']);_0x400b19(_0x256ef4);});});}return this['smtp'][_0xe1da('0x32')](_0x58e066);};module['exports']=EmailChannel; \ No newline at end of file +var _0x4e3c=['bluebird','md5','../../../config/environment','email','redis','defaults','localhost','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','smtp','prototype','emit','key','active','Imap','status','messageStatus','isNil','stringify','mailAccount:update','refresh','hasOwnProperty','service','provider','imapAccounts','bind','handleImapEmail','handleImapEnd','error','handleImapError','handleImapBox','connected','total','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','lastName','from','notify','then','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','send','verifySmtp','Smtp','verified','verify'];(function(_0x27dce9,_0x10d2f8){var _0x1fec31=function(_0x6e3a9a){while(--_0x6e3a9a){_0x27dce9['push'](_0x27dce9['shift']());}};_0x1fec31(++_0x10d2f8);}(_0x4e3c,0x1a8));var _0xc4e3=function(_0x42276c,_0x141d47){_0x42276c=_0x42276c-0x0;var _0x1b5009=_0x4e3c[_0x42276c];return _0x1b5009;};'use strict';var _=require('lodash');var moment=require('moment');var BPromise=require(_0xc4e3('0x0'));var md5=require(_0xc4e3('0x1'));var Redis=require('ioredis');var config=require(_0xc4e3('0x2'));var logger=require('../../../config/logger')(_0xc4e3('0x3'));config[_0xc4e3('0x4')]=_[_0xc4e3('0x5')](config[_0xc4e3('0x4')],{'host':_0xc4e3('0x6'),'port':0x18eb});var io=require(_0xc4e3('0x7'))(new Redis(config[_0xc4e3('0x4')]));var EmailImap=require(_0xc4e3('0x8'));var EmailSmtp=require(_0xc4e3('0x9'));var mailAccount=require(_0xc4e3('0xa'));var md5Accounts={};function EmailChannel(_0x3ac65a){logger[_0xc4e3('0xb')](_0xc4e3('0xc'));this['mailAccounts']=_0x3ac65a[_0xc4e3('0xd')];this['imapAccounts']={};this[_0xc4e3('0xe')]=new EmailSmtp();}EmailChannel[_0xc4e3('0xf')][_0xc4e3('0x10')]=function(_0xaba0d6){var _0x5c6cb5=this[_0xc4e3('0xd')][_0xaba0d6];var _0x3cd6e5={'id':_0x5c6cb5['id'],'name':_0x5c6cb5['name'],'key':_0x5c6cb5[_0xc4e3('0x11')],'active':_0x5c6cb5[_0xc4e3('0x12')],'Imap':{'status':_0x5c6cb5[_0xc4e3('0x13')][_0xc4e3('0x14')],'messageStatus':_0x5c6cb5[_0xc4e3('0x13')][_0xc4e3('0x15')],'total':_0x5c6cb5['Imap']['total']}};if(_[_0xc4e3('0x16')](md5Accounts[_0xaba0d6])){md5Accounts[_0xaba0d6]={};}var _0x32d175=md5(JSON[_0xc4e3('0x17')](_0x3cd6e5));if(md5Accounts[_0xaba0d6][_0xc4e3('0x1')]!==_0x32d175){md5Accounts[_0xaba0d6][_0xc4e3('0x1')]=_0x32d175;io[_0xc4e3('0x10')](_0xc4e3('0x18'),_0x3cd6e5);}};EmailChannel[_0xc4e3('0xf')][_0xc4e3('0x19')]=function(_0x4d769d){for(var _0x1b214a in _0x4d769d){if(_0x4d769d[_0xc4e3('0x1a')](_0x1b214a)){if(_0x4d769d[_0x1b214a][_0xc4e3('0x13')]&&_0x4d769d[_0x1b214a][_0xc4e3('0x12')]){var _0x297fd5=_0x4d769d[_0x1b214a]['Imap'];if(!_0x297fd5[_0xc4e3('0x1b')]&&_0x4d769d[_0x1b214a]['provider']!=='custom')_0x297fd5[_0xc4e3('0x1b')]=_0x4d769d[_0x1b214a][_0xc4e3('0x1c')];if(!this[_0xc4e3('0x1d')][_0xc4e3('0x1a')](_0x297fd5['id'])){this[_0xc4e3('0x1d')][_0x297fd5['id']]=new EmailImap(_0x297fd5,_0x4d769d[_0x1b214a][_0xc4e3('0x3')]);this[_0xc4e3('0x1d')][_0x297fd5['id']]['on']('box',this['handleImapBox'][_0xc4e3('0x1e')](this,_0x1b214a));this[_0xc4e3('0x1d')][_0x297fd5['id']]['on'](_0xc4e3('0x3'),this[_0xc4e3('0x1f')][_0xc4e3('0x1e')](this,_0x1b214a));this[_0xc4e3('0x1d')][_0x297fd5['id']]['on']('end',this[_0xc4e3('0x20')][_0xc4e3('0x1e')](this,_0x1b214a));this[_0xc4e3('0x1d')][_0x297fd5['id']]['on'](_0xc4e3('0x21'),this[_0xc4e3('0x22')]['bind'](this,_0x1b214a));}}else{if(_['isNil'](this[_0xc4e3('0xd')][_0x1b214a]['Imap'])){this[_0xc4e3('0xd')][_0x1b214a][_0xc4e3('0x13')]={};}this[_0xc4e3('0xd')][_0x1b214a][_0xc4e3('0x13')][_0xc4e3('0x14')]='disabled';this[_0xc4e3('0xd')][_0x1b214a][_0xc4e3('0x13')][_0xc4e3('0x15')]='';this[_0xc4e3('0x10')](_0x1b214a);}}}};EmailChannel['prototype'][_0xc4e3('0x23')]=function(_0x2288ca,_0x4587c1){if(this[_0xc4e3('0xd')][_0x2288ca]){this[_0xc4e3('0xd')][_0x2288ca][_0xc4e3('0x13')][_0xc4e3('0x14')]=_0xc4e3('0x24');this[_0xc4e3('0xd')][_0x2288ca][_0xc4e3('0x13')][_0xc4e3('0x15')]=_0x4587c1['name'];if(_0x4587c1['messages']){this['mailAccounts'][_0x2288ca][_0xc4e3('0x13')][_0xc4e3('0x25')]=_0x4587c1[_0xc4e3('0x26')][_0xc4e3('0x25')];}return this[_0xc4e3('0x10')](_0x2288ca);}};EmailChannel[_0xc4e3('0xf')][_0xc4e3('0x1f')]=function(_0x5d1933,_0x537640){logger[_0xc4e3('0xb')](_0xc4e3('0x27'),_0x537640['firstName'],_0x537640[_0xc4e3('0x28')],_0x537640[_0xc4e3('0x29')],_0x5d1933);if(this[_0xc4e3('0xd')][_0x5d1933]){return mailAccount[_0xc4e3('0x2a')](_0x5d1933,_0x537640)[_0xc4e3('0x2b')](function(_0x30bb49){if(_0x30bb49){logger[_0xc4e3('0xb')](_0xc4e3('0x2c'));}})[_0xc4e3('0x2d')](function(_0xa22d2c){logger[_0xc4e3('0x21')](_0xc4e3('0x2e'),JSON['stringify'](_0xa22d2c));});}};EmailChannel[_0xc4e3('0xf')][_0xc4e3('0x20')]=function(_0x3e15e8){if(this['mailAccounts'][_0x3e15e8]&&this['mailAccounts'][_0x3e15e8]['Imap']){if(this[_0xc4e3('0x1d')][this['mailAccounts'][_0x3e15e8][_0xc4e3('0x13')]['id']]){delete this[_0xc4e3('0x1d')][this[_0xc4e3('0xd')][_0x3e15e8][_0xc4e3('0x13')]['id']];}this[_0xc4e3('0xd')][_0x3e15e8][_0xc4e3('0x13')][_0xc4e3('0x2f')]=moment();this['emit'](_0x3e15e8);}};EmailChannel[_0xc4e3('0xf')][_0xc4e3('0x22')]=function(_0x3921ab,_0x1f0b91){if(this[_0xc4e3('0xd')][_0x3921ab]){this[_0xc4e3('0xd')][_0x3921ab][_0xc4e3('0x13')][_0xc4e3('0x14')]=_0xc4e3('0x21');this[_0xc4e3('0xd')][_0x3921ab][_0xc4e3('0x13')][_0xc4e3('0x15')]=_0x1f0b91;return this[_0xc4e3('0x10')](_0x3921ab);}};EmailChannel[_0xc4e3('0xf')]['sendMail']=function(_0x8c34ac,_0x355c6b){return this[_0xc4e3('0xe')][_0xc4e3('0x30')](_0x8c34ac,_0x355c6b);};EmailChannel[_0xc4e3('0xf')][_0xc4e3('0x31')]=function(_0x42ff7b){var _0x5d9a31=this;if(this[_0xc4e3('0xd')][_0x42ff7b['id']]){if(_['isNil'](this[_0xc4e3('0xd')][_0x42ff7b['id']]['Smtp'])){this[_0xc4e3('0xd')][_0x42ff7b['id']][_0xc4e3('0x32')]={};}this[_0xc4e3('0xd')][_0x42ff7b['id']][_0xc4e3('0x32')][_0xc4e3('0x2f')]=moment();return new BPromise(function(_0x4893ba,_0x26f5d9){return _0x5d9a31[_0xc4e3('0xe')]['verify'](_0x42ff7b)[_0xc4e3('0x2b')](function(_0x27634c){_0x5d9a31[_0xc4e3('0xd')][_0x42ff7b['id']][_0xc4e3('0x32')][_0xc4e3('0x14')]=_0xc4e3('0x33');_0x5d9a31['mailAccounts'][_0x42ff7b['id']][_0xc4e3('0x32')][_0xc4e3('0x15')]='';_0x5d9a31[_0xc4e3('0x10')](_0x42ff7b['id']);_0x4893ba(_0x27634c);})[_0xc4e3('0x2d')](function(_0x403c20){_0x5d9a31[_0xc4e3('0xd')][_0x42ff7b['id']][_0xc4e3('0x32')]['status']=_0xc4e3('0x21');_0x5d9a31[_0xc4e3('0xd')][_0x42ff7b['id']][_0xc4e3('0x32')]['messageStatus']=_0x403c20;_0x5d9a31[_0xc4e3('0x10')](_0x42ff7b['id']);_0x26f5d9(_0x403c20);});});}return this[_0xc4e3('0xe')][_0xc4e3('0x34')](_0x42ff7b);};module['exports']=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index aa2b456..4892eef 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 _0xe2fe=['handleMessageAttributes','handleMessageEnd','parser','stringify','textCode','hasOwnProperty','upperFirst','exports','lodash','mailparser','iconv','Iconv','events','EventEmitter','./utils','email','mailbox','INBOX','getAccount','account','imap','ready','handleReady','handleEnd','handleError','bind','connect','inherits','prototype','connTimeout','authTimeout','service','user','modernAuthentication','xoauth2','data5','password','authentication','host','tls','autotls','required','openBox','handleOpenBox','emit','box','readUnseen','handleCloseBox','end','search','UNSEEN','handleReadUnseen','length','fetch','error','handleFetchError','once','closeBox','handleFetchMessage','body','attributes','handleMessageBody','handleSimpleParser'];(function(_0x640509,_0x288391){var _0x4734bf=function(_0x5656d4){while(--_0x5656d4){_0x640509['push'](_0x640509['shift']());}};_0x4734bf(++_0x288391);}(_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 Imap=require('imap');var simpleParser=require(_0xee2f('0x1'))['simpleParser'];var Iconv=require(_0xee2f('0x2'))[_0xee2f('0x3')];var EventEmitter=require(_0xee2f('0x4'))[_0xee2f('0x5')];var utils=require(_0xee2f('0x6'));var logger=require('../../../config/logger')(_0xee2f('0x7'));function EmailImap(_0x2b7e7c,_0x49926b){this[_0xee2f('0x8')]=_0xee2f('0x9');this['account']=this[_0xee2f('0xa')](_0x2b7e7c,_0x49926b);this['imap']=new Imap(this[_0xee2f('0xb')]);this[_0xee2f('0xc')]['once'](_0xee2f('0xd'),this[_0xee2f('0xe')]['bind'](this));this['imap']['once']('end',this[_0xee2f('0xf')]['bind'](this));this['imap']['on']('error',this[_0xee2f('0x10')][_0xee2f('0x11')](this));this[_0xee2f('0xc')][_0xee2f('0x12')]();}util[_0xee2f('0x13')](EmailImap,EventEmitter);EmailImap[_0xee2f('0x14')]['getAccount']=function(_0x3861e6,_0x531c3a){var _0x36db10={'connTimeout':_0x3861e6[_0xee2f('0x15')]?_0x3861e6['connTimeout']*0x3e8:0x2710,'authTimeout':_0x3861e6[_0xee2f('0x16')]?_0x3861e6[_0xee2f('0x16')]*0x3e8:0x1388};if(_0x3861e6[_0xee2f('0x17')]){_0x36db10[_0xee2f('0x18')]=_0x3861e6[_0xee2f('0x18')];_0x36db10['email']=_0x531c3a||_0x3861e6[_0xee2f('0x18')]||'anonymous@xcally.com';if(_0x3861e6[_0xee2f('0x19')]){_0x36db10[_0xee2f('0x1a')]=utils['generateXOAuth2Token'](_0x3861e6['CloudProvider'][_0xee2f('0x1b')],_0x3861e6['user']);}else{_0x36db10[_0xee2f('0x1c')]=_0x3861e6[_0xee2f('0x1c')];}}else{if(_0x3861e6[_0xee2f('0x1d')]){_0x36db10['user']=_0x3861e6[_0xee2f('0x18')];_0x36db10[_0xee2f('0x1c')]=_0x3861e6[_0xee2f('0x1c')];}}_0x36db10[_0xee2f('0x1e')]=_0x3861e6[_0xee2f('0x1e')];_0x36db10['port']=_0x3861e6['port']||0x3e1;if(_0x3861e6[_0xee2f('0x1f')]){_0x36db10[_0xee2f('0x1f')]=!![];}else{_0x36db10[_0xee2f('0x1f')]=![];_0x36db10[_0xee2f('0x20')]=_0xee2f('0x21');}return _0x36db10;};EmailImap[_0xee2f('0x14')][_0xee2f('0xe')]=function(){this['imap'][_0xee2f('0x22')](this[_0xee2f('0x8')],![],this[_0xee2f('0x23')][_0xee2f('0x11')](this));};EmailImap[_0xee2f('0x14')][_0xee2f('0x23')]=function(_0x15a1b1,_0x13013f){if(_0x15a1b1){this[_0xee2f('0x10')](_0x15a1b1,!![]);}else{this[_0xee2f('0x24')](_0xee2f('0x25'),_0x13013f);this[_0xee2f('0x26')]();}};EmailImap[_0xee2f('0x14')][_0xee2f('0x27')]=function(_0x53f6ed){if(_0x53f6ed){this['handleError'](_0x53f6ed,!![]);}else{this['imap'][_0xee2f('0x28')]();}};EmailImap[_0xee2f('0x14')][_0xee2f('0x26')]=function(){this[_0xee2f('0xc')][_0xee2f('0x29')]([_0xee2f('0x2a')],this['handleReadUnseen'][_0xee2f('0x11')](this));};EmailImap['prototype'][_0xee2f('0x2b')]=function(_0x180429,_0x25ee9c){if(_0x180429){this[_0xee2f('0x10')](_0x180429,!![]);}else{if(_0x25ee9c[_0xee2f('0x2c')]){try{var _0x47d5a6=this[_0xee2f('0xc')][_0xee2f('0x2d')](_0x25ee9c,{'bodies':'','markSeen':!![]});_0x47d5a6['on']('message',this['handleFetchMessage'][_0xee2f('0x11')](this));_0x47d5a6['once'](_0xee2f('0x2e'),this[_0xee2f('0x2f')]['bind'](this));_0x47d5a6[_0xee2f('0x30')]('end',this['handleFetchEnd']['bind'](this));}catch(_0x3f1fe8){logger[_0xee2f('0x2e')](_0x3f1fe8);}}else{this['imap'][_0xee2f('0x31')](!![],this[_0xee2f('0x27')][_0xee2f('0x11')](this));}}};EmailImap[_0xee2f('0x14')][_0xee2f('0x32')]=function(_0x4e682d){_0x4e682d['on'](_0xee2f('0x33'),this['handleMessageBody'][_0xee2f('0x11')](this));_0x4e682d[_0xee2f('0x30')](_0xee2f('0x34'),this['handleMessageAttributes'][_0xee2f('0x11')](this));_0x4e682d['once'](_0xee2f('0x28'),this['handleMessageEnd'][_0xee2f('0x11')](this));};EmailImap[_0xee2f('0x14')][_0xee2f('0x35')]=function(_0x1fb2cd){simpleParser(_0x1fb2cd,{'Iconv':Iconv},this[_0xee2f('0x36')][_0xee2f('0x11')](this));};EmailImap[_0xee2f('0x14')][_0xee2f('0x37')]=function(){};EmailImap[_0xee2f('0x14')][_0xee2f('0x38')]=function(){};EmailImap[_0xee2f('0x14')]['handleSimpleParser']=function(_0x4584b8,_0x47e54b){if(_0x4584b8){logger[_0xee2f('0x2e')](_0x4584b8);}else{var _0x3cbc01=this;utils[_0xee2f('0x39')](this[_0xee2f('0xb')],_0x47e54b,function(_0xaddf3b){_0x3cbc01[_0xee2f('0x24')](_0xee2f('0x7'),_0xaddf3b);});}};EmailImap[_0xee2f('0x14')]['handleFetchEnd']=function(){this['imap']['closeBox'](!![],this[_0xee2f('0x27')]['bind'](this));};EmailImap[_0xee2f('0x14')]['handleFetchError']=function(_0x558aa3){this['handleError'](_0x558aa3);this['imap'][_0xee2f('0x31')](!![],this[_0xee2f('0x27')][_0xee2f('0x11')](this));};EmailImap[_0xee2f('0x14')]['handleEnd']=function(){this['emit'](_0xee2f('0x28'));};EmailImap['prototype']['handleError']=function(_0x8204dc,_0x61d1c){logger[_0xee2f('0x2e')]('handleError',this[_0xee2f('0xb')][_0xee2f('0x7')],JSON[_0xee2f('0x3a')](_0x8204dc));var _0x4cb3fd='';if(_0x8204dc){if(_0x8204dc['textCode']){_0x4cb3fd=_0x8204dc[_0xee2f('0x3b')];}else{for(var _0xc40338 in _0x8204dc){if(_0x8204dc[_0xee2f('0x3c')](_0xc40338)){_0x4cb3fd+=_[_0xee2f('0x3d')](_0xc40338)+':\x20'+_0x8204dc[_0xc40338]+'\x0a';}}}}if(_0x61d1c){this['imap'][_0xee2f('0x28')]();}else{this[_0xee2f('0x24')](_0xee2f('0x2e'),_0x4cb3fd);this[_0xee2f('0x24')](_0xee2f('0x28'));}};module[_0xee2f('0x3e')]=EmailImap; \ No newline at end of file +var _0x57ca=['handleFetchError','handleFetchEnd','closeBox','handleFetchMessage','body','attributes','handleMessageAttributes','handleMessageEnd','handleMessageBody','handleSimpleParser','parser','handleEnd','stringify','textCode','upperFirst','exports','util','imap','simpleParser','iconv','Iconv','events','EventEmitter','../../../config/logger','email','mailbox','INBOX','account','getAccount','once','ready','bind','end','error','handleError','connect','prototype','connTimeout','authTimeout','user','anonymous@xcally.com','xoauth2','generateXOAuth2Token','CloudProvider','data5','password','authentication','host','port','tls','autotls','required','handleReady','openBox','handleOpenBox','emit','box','readUnseen','handleCloseBox','handleReadUnseen','length','message'];(function(_0x700b87,_0xefdcfa){var _0x1aa811=function(_0x331221){while(--_0x331221){_0x700b87['push'](_0x700b87['shift']());}};_0x1aa811(++_0xefdcfa);}(_0x57ca,0x108));var _0xa57c=function(_0x3bfedb,_0x574e2d){_0x3bfedb=_0x3bfedb-0x0;var _0x3fde7f=_0x57ca[_0x3bfedb];return _0x3fde7f;};'use strict';var _=require('lodash');var util=require(_0xa57c('0x0'));var Imap=require(_0xa57c('0x1'));var simpleParser=require('mailparser')[_0xa57c('0x2')];var Iconv=require(_0xa57c('0x3'))[_0xa57c('0x4')];var EventEmitter=require(_0xa57c('0x5'))[_0xa57c('0x6')];var utils=require('./utils');var logger=require(_0xa57c('0x7'))(_0xa57c('0x8'));function EmailImap(_0x113dcf,_0x19473f){this[_0xa57c('0x9')]=_0xa57c('0xa');this[_0xa57c('0xb')]=this[_0xa57c('0xc')](_0x113dcf,_0x19473f);this['imap']=new Imap(this[_0xa57c('0xb')]);this['imap'][_0xa57c('0xd')](_0xa57c('0xe'),this['handleReady'][_0xa57c('0xf')](this));this['imap'][_0xa57c('0xd')](_0xa57c('0x10'),this['handleEnd'][_0xa57c('0xf')](this));this['imap']['on'](_0xa57c('0x11'),this[_0xa57c('0x12')][_0xa57c('0xf')](this));this[_0xa57c('0x1')][_0xa57c('0x13')]();}util['inherits'](EmailImap,EventEmitter);EmailImap[_0xa57c('0x14')]['getAccount']=function(_0x30d23d,_0x3d5995){var _0x30940d={'connTimeout':_0x30d23d[_0xa57c('0x15')]?_0x30d23d[_0xa57c('0x15')]*0x3e8:0x2710,'authTimeout':_0x30d23d[_0xa57c('0x16')]?_0x30d23d[_0xa57c('0x16')]*0x3e8:0x1388};if(_0x30d23d['service']){_0x30940d[_0xa57c('0x17')]=_0x30d23d[_0xa57c('0x17')];_0x30940d[_0xa57c('0x8')]=_0x3d5995||_0x30d23d['user']||_0xa57c('0x18');if(_0x30d23d['modernAuthentication']){_0x30940d[_0xa57c('0x19')]=utils[_0xa57c('0x1a')](_0x30d23d[_0xa57c('0x1b')][_0xa57c('0x1c')],_0x30d23d[_0xa57c('0x17')]);}else{_0x30940d[_0xa57c('0x1d')]=_0x30d23d[_0xa57c('0x1d')];}}else{if(_0x30d23d[_0xa57c('0x1e')]){_0x30940d['user']=_0x30d23d[_0xa57c('0x17')];_0x30940d['password']=_0x30d23d['password'];}}_0x30940d[_0xa57c('0x1f')]=_0x30d23d[_0xa57c('0x1f')];_0x30940d[_0xa57c('0x20')]=_0x30d23d[_0xa57c('0x20')]||0x3e1;if(_0x30d23d['tls']){_0x30940d[_0xa57c('0x21')]=!![];}else{_0x30940d[_0xa57c('0x21')]=![];_0x30940d[_0xa57c('0x22')]=_0xa57c('0x23');}return _0x30940d;};EmailImap[_0xa57c('0x14')][_0xa57c('0x24')]=function(){this[_0xa57c('0x1')][_0xa57c('0x25')](this[_0xa57c('0x9')],![],this[_0xa57c('0x26')][_0xa57c('0xf')](this));};EmailImap[_0xa57c('0x14')][_0xa57c('0x26')]=function(_0x10a33d,_0x431bec){if(_0x10a33d){this['handleError'](_0x10a33d,!![]);}else{this[_0xa57c('0x27')](_0xa57c('0x28'),_0x431bec);this[_0xa57c('0x29')]();}};EmailImap[_0xa57c('0x14')][_0xa57c('0x2a')]=function(_0x1e8e45){if(_0x1e8e45){this[_0xa57c('0x12')](_0x1e8e45,!![]);}else{this[_0xa57c('0x1')][_0xa57c('0x10')]();}};EmailImap[_0xa57c('0x14')]['readUnseen']=function(){this[_0xa57c('0x1')]['search'](['UNSEEN'],this[_0xa57c('0x2b')][_0xa57c('0xf')](this));};EmailImap['prototype'][_0xa57c('0x2b')]=function(_0x1ef331,_0x3eb9e9){if(_0x1ef331){this['handleError'](_0x1ef331,!![]);}else{if(_0x3eb9e9[_0xa57c('0x2c')]){try{var _0x58d46f=this[_0xa57c('0x1')]['fetch'](_0x3eb9e9,{'bodies':'','markSeen':!![]});_0x58d46f['on'](_0xa57c('0x2d'),this['handleFetchMessage'][_0xa57c('0xf')](this));_0x58d46f['once'](_0xa57c('0x11'),this[_0xa57c('0x2e')][_0xa57c('0xf')](this));_0x58d46f[_0xa57c('0xd')](_0xa57c('0x10'),this[_0xa57c('0x2f')][_0xa57c('0xf')](this));}catch(_0x5aa91e){logger[_0xa57c('0x11')](_0x5aa91e);}}else{this['imap'][_0xa57c('0x30')](!![],this[_0xa57c('0x2a')][_0xa57c('0xf')](this));}}};EmailImap['prototype'][_0xa57c('0x31')]=function(_0x4901a8){_0x4901a8['on'](_0xa57c('0x32'),this['handleMessageBody'][_0xa57c('0xf')](this));_0x4901a8['once'](_0xa57c('0x33'),this[_0xa57c('0x34')]['bind'](this));_0x4901a8[_0xa57c('0xd')]('end',this[_0xa57c('0x35')]['bind'](this));};EmailImap[_0xa57c('0x14')][_0xa57c('0x36')]=function(_0x205ee5){simpleParser(_0x205ee5,{'Iconv':Iconv},this[_0xa57c('0x37')][_0xa57c('0xf')](this));};EmailImap[_0xa57c('0x14')]['handleMessageAttributes']=function(){};EmailImap['prototype'][_0xa57c('0x35')]=function(){};EmailImap[_0xa57c('0x14')][_0xa57c('0x37')]=function(_0x570f6c,_0x12b644){if(_0x570f6c){logger['error'](_0x570f6c);}else{var _0x203228=this;utils[_0xa57c('0x38')](this['account'],_0x12b644,function(_0x558cf7){_0x203228['emit'](_0xa57c('0x8'),_0x558cf7);});}};EmailImap[_0xa57c('0x14')][_0xa57c('0x2f')]=function(){this[_0xa57c('0x1')][_0xa57c('0x30')](!![],this[_0xa57c('0x2a')]['bind'](this));};EmailImap[_0xa57c('0x14')][_0xa57c('0x2e')]=function(_0x5a5490){this['handleError'](_0x5a5490);this[_0xa57c('0x1')][_0xa57c('0x30')](!![],this['handleCloseBox'][_0xa57c('0xf')](this));};EmailImap[_0xa57c('0x14')][_0xa57c('0x39')]=function(){this[_0xa57c('0x27')](_0xa57c('0x10'));};EmailImap[_0xa57c('0x14')]['handleError']=function(_0xa7b441,_0x527c0f){logger['error']('handleError',this['account']['email'],JSON[_0xa57c('0x3a')](_0xa7b441));var _0x32ed25='';if(_0xa7b441){if(_0xa7b441[_0xa57c('0x3b')]){_0x32ed25=_0xa7b441['textCode'];}else{for(var _0x4cd045 in _0xa7b441){if(_0xa7b441['hasOwnProperty'](_0x4cd045)){_0x32ed25+=_[_0xa57c('0x3c')](_0x4cd045)+':\x20'+_0xa7b441[_0x4cd045]+'\x0a';}}}}if(_0x527c0f){this[_0xa57c('0x1')][_0xa57c('0x10')]();}else{this[_0xa57c('0x27')](_0xa57c('0x11'),_0x32ed25);this[_0xa57c('0x27')]('end');}};module[_0xa57c('0x3d')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 3015cd4..d964f0f 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 _0x6940=['use','compile','sendMail','toString','prototype','verify','createTransport','nodemailer','nodemailer-plugin-inline-base64','send'];(function(_0x475b6c,_0x35cb61){var _0x67b8a6=function(_0x509a2b){while(--_0x509a2b){_0x475b6c['push'](_0x475b6c['shift']());}};_0x67b8a6(++_0x35cb61);}(_0x6940,0x197));var _0x0694=function(_0x23d245,_0x23bf63){_0x23d245=_0x23d245-0x0;var _0x4c70e6=_0x6940[_0x23d245];return _0x4c70e6;};'use strict';var nodemailer=require(_0x0694('0x0'));var inlineBase64=require(_0x0694('0x1'));function EmailSmtp(){}EmailSmtp['prototype'][_0x0694('0x2')]=function(_0x134b3c,_0x53a76c){return new Promise(function(_0x45a91f,_0x5e20f5){var _0x11398c=nodemailer['createTransport'](_0x134b3c);_0x11398c[_0x0694('0x3')](_0x0694('0x4'),inlineBase64());_0x11398c[_0x0694('0x5')](_0x53a76c,function(_0x4a2ddb,_0x531020){if(_0x4a2ddb){_0x5e20f5(_0x4a2ddb[_0x0694('0x6')]());}else{_0x45a91f(_0x531020);}});});};EmailSmtp[_0x0694('0x7')][_0x0694('0x8')]=function(_0x2fd40e){return new Promise(function(_0x598174,_0xaa89f4){var _0x37bb4b=nodemailer[_0x0694('0x9')](_0x2fd40e);_0x37bb4b[_0x0694('0x8')](function(_0x9b190b,_0x27e669){if(_0x9b190b){_0xaa89f4(_0x9b190b[_0x0694('0x6')]());}else{if(_0x27e669){_0x598174(_0x27e669);}else{_0xaa89f4('Not\x20verifired');}}});});};module['exports']=EmailSmtp; \ No newline at end of file +var _0xb3e7=['sendMail','toString','verify','Not\x20verifired','exports','nodemailer-plugin-inline-base64','prototype','send','createTransport','use','compile'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb3e7,0x118));var _0x7b3e=function(_0x2df507,_0x553862){_0x2df507=_0x2df507-0x0;var _0x1f7167=_0xb3e7[_0x2df507];return _0x1f7167;};'use strict';var nodemailer=require('nodemailer');var inlineBase64=require(_0x7b3e('0x0'));function EmailSmtp(){}EmailSmtp[_0x7b3e('0x1')][_0x7b3e('0x2')]=function(_0x5f4320,_0x597795){return new Promise(function(_0x43c734,_0x1acf19){var _0x4fe4b9=nodemailer[_0x7b3e('0x3')](_0x5f4320);_0x4fe4b9[_0x7b3e('0x4')](_0x7b3e('0x5'),inlineBase64());_0x4fe4b9[_0x7b3e('0x6')](_0x597795,function(_0x4a7cf3,_0x5ce0f4){if(_0x4a7cf3){_0x1acf19(_0x4a7cf3[_0x7b3e('0x7')]());}else{_0x43c734(_0x5ce0f4);}});});};EmailSmtp['prototype'][_0x7b3e('0x8')]=function(_0x2ab5fc){return new Promise(function(_0x57b5a0,_0x45af86){var _0x2b093b=nodemailer[_0x7b3e('0x3')](_0x2ab5fc);_0x2b093b['verify'](function(_0x503f15,_0x53038c){if(_0x503f15){_0x45af86(_0x503f15[_0x7b3e('0x7')]());}else{if(_0x53038c){_0x57b5a0(_0x53038c);}else{_0x45af86(_0x7b3e('0x9'));}}});});};module[_0x7b3e('0xa')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 02d431b..564877d 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 _0x7f24=['message','originTo','isEmpty','originCc','email','bcc','attach','type','attachment','attachment-','format','%s-%s','root','server/files/attachments/','writeFileSync','content','contentType','headerLines','X-Auto-Response-Suppress:\x20All','line','isAutoreply','parser','from','subject','messageId','inReplyTo','date','YYYY-MM-DD\x20HH:mm:ss','textAsHtml','filter','application/ms-tnef','info','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','parseBuffer','first','BodyHTML','

Empty\x20message

','Attachments','Title','Data','generateXOAuth2Token','user=','auth=Bearer\x20','utf-8','toString','base64','lodash','randomstring','path','util','../../../config/logger','../../../config/environment','head','value','address','anonymous','generate','name','length','slice','join','Anonymous','split','pop','@xcally.com','test','html','replace','includes','attachments','forEach','push','filename','_SRC','_IMG','\x20[Attachment:\x20','\x20]','body','0x1?_0x152d63[_0x47f2('0xd')](0x0,-0x1)[_0x47f2('0xe')]('\x20'):_0xef83e7[_0x47f2('0xb')];}return _0x47f2('0xf');}function getLastName(_0x288571){var _0x10f348=_['head'](_0x288571[_0x47f2('0x7')]);if(_0x10f348&&_0x10f348[_0x47f2('0xb')]){var _0x3af49b=_0x10f348['name'][_0x47f2('0x10')](/\s+/);return _0x3af49b['length']>0x1?_0x3af49b[_0x47f2('0x11')]():'';}return'';}function getMails(_0x13e927,_0x3febe1){var _0x22c569='';for(var _0x231001=0x0;_0x231001<_0x3febe1['value'][_0x47f2('0xc')];_0x231001+=0x1){if(_0x3febe1[_0x47f2('0x7')][_0x231001][_0x47f2('0x8')]!==_0x13e927){if(!_['isEmpty'](_0x22c569)){_0x22c569+=',';}_0x22c569+=_0x3febe1['value'][_0x231001][_0x47f2('0xb')]||_0x3febe1[_0x47f2('0x7')][_0x231001][_0x47f2('0x8')]||'';_0x22c569+='\x20<';_0x22c569+=_0x3febe1[_0x47f2('0x7')][_0x231001][_0x47f2('0x8')]?_0x3febe1[_0x47f2('0x7')][_0x231001][_0x47f2('0x8')]:'anonymous'+random[_0x47f2('0xa')](0x6)+_0x47f2('0x12');_0x22c569+='>';}}return _0x22c569;}function parseEmail(_0x1f2b68,_0x108990,_0x659940){if(_0x108990['html']){var _0x3ba212=/)<[^<]*)*<\/script>/gi;while(_0x3ba212[_0x47f2('0x13')](_0x108990[_0x47f2('0x14')])){_0x108990[_0x47f2('0x14')]=_0x108990['html'][_0x47f2('0x15')](_0x3ba212,'');}if(_0x108990[_0x47f2('0x14')][_0x47f2('0x16')]('{_0x39c5ea[_0x47f2('0x19')](_0x339267[_0x47f2('0x1a')]);});var _0x5ed30c=/]+>/g;var _0x490412=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x229bb3=_0x108990[_0x47f2('0x14')][_0x47f2('0x15')](_0x490412,_0x47f2('0x1b'));var _0x437696=_0x229bb3[_0x47f2('0x15')](_0x5ed30c,'_IMG');for(let _0x31acd6=0x0;_0x31acd6<_0x39c5ea[_0x47f2('0xc')];_0x31acd6++){var _0x29dc79=_0x437696[_0x47f2('0x15')](_0x47f2('0x1c'),_0x47f2('0x1d')+_0x39c5ea[_0x31acd6]+_0x47f2('0x1e'));_0x437696=_0x29dc79;}_0x108990[_0x47f2('0x14')]=_0x437696;}_0x659940[_0x47f2('0x1f')]=_0x108990['html'];}else{_0x659940[_0x47f2('0x1f')]=_0x108990['textAsHtml'];}if(_0x659940['body']){_0x659940[_0x47f2('0x1f')]=_0x659940[_0x47f2('0x1f')]['replace'](/0x0){var _0x4e23cd=['Auto-Submitted:\x20auto-replied',_0x47f2('0x33'),'Precedence:\x20auto_reply'];for(var _0x11f6b7=0x0;_0x11f6b7<_0x108990['headerLines']['length'];_0x11f6b7++){var _0x5bdebe=_['indexOf'](_0x4e23cd,_0x108990[_0x47f2('0x32')][_0x11f6b7][_0x47f2('0x34')]);if(_0x5bdebe>=0x0){_0x659940[_0x47f2('0x35')]=!![];}}}return _0x659940;}exports[_0x47f2('0x36')]=function(_0x4b37f9,_0x5ac995,_0x5b747e){var _0x39f479={'from':getAddress(_0x5ac995[_0x47f2('0x37')]),'firstName':getFirstName(_0x5ac995['from']),'lastName':getLastName(_0x5ac995[_0x47f2('0x37')]),'mapKey':'email','message':{'from':getMails(_0x4b37f9[_0x47f2('0x25')],_0x5ac995['from']),'to':_0x4b37f9[_0x47f2('0x25')],'cc':'','subject':_0x5ac995[_0x47f2('0x38')]||'','messageId':_0x5ac995[_0x47f2('0x39')],'inReplyTo':_0x5ac995[_0x47f2('0x3a')],'sentAt':moment(_0x5ac995[_0x47f2('0x3b')])['format'](_0x47f2('0x3c')),'attach':![],'attachments':[]}};if(!_0x5ac995[_0x47f2('0x14')]&&!_0x5ac995[_0x47f2('0x3d')]){var _0x2895d5=_[_0x47f2('0x3e')](_0x5ac995[_0x47f2('0x17')],{'contentType':_0x47f2('0x3f')});if(_0x2895d5[_0x47f2('0xc')]){logger[_0x47f2('0x40')](util[_0x47f2('0x2b')](_0x47f2('0x41'),_0x5ac995['messageId']));tnef[_0x47f2('0x42')](_[_0x47f2('0x43')](_0x2895d5)[_0x47f2('0x30')],function(_0x5b4e56,_0x207422){if(_0x207422){_0x5ac995[_0x47f2('0x14')]=_0x207422[_0x47f2('0x44')]||_0x47f2('0x45');if(_0x207422[_0x47f2('0x46')]){for(var _0x99866e=0x0;_0x99866e<_0x207422[_0x47f2('0x46')][_0x47f2('0xc')];_0x99866e++){var _0x2dc425=_0x207422[_0x47f2('0x46')][_0x99866e];_0x39f479[_0x47f2('0x21')]['attachments'][_0x47f2('0x19')]({'filename':_0x2dc425[_0x47f2('0x47')],'content':Buffer[_0x47f2('0x37')](_0x2dc425[_0x47f2('0x48')])});}}}_0x5b747e(parseEmail(_0x4b37f9,_0x5ac995,_0x39f479));});}else{_0x5ac995['html']=_0x47f2('0x45');_0x5b747e(parseEmail(_0x4b37f9,_0x5ac995,_0x39f479));}}else{_0x5b747e(parseEmail(_0x4b37f9,_0x5ac995,_0x39f479));}};exports[_0x47f2('0x49')]=function(_0x228811,_0x40fde6){var _0x2d2936=[_0x47f2('0x4a')+(_0x40fde6||''),_0x47f2('0x4b')+_0x228811,'',''];return Buffer['from'](_0x2d2936[_0x47f2('0xe')](''),_0x47f2('0x4c'))[_0x47f2('0x4d')](_0x47f2('0x4e'));}; \ No newline at end of file +var _0xfadf=['utf-8','toString','lodash','path','util','node-tnef','../../../config/logger','email','head','address','anonymous','generate','@xcally.com','value','name','split','length','slice','join','Anonymous','pop','isEmpty','html','test','replace','includes','\x20[Attachment:\x20','\x20]','body','Empty\x20message

','Attachments','Title','Data','generateXOAuth2Token','user=','auth=Bearer\x20'];(function(_0x40fc07,_0x2627f4){var _0x30bded=function(_0x5b87fa){while(--_0x5b87fa){_0x40fc07['push'](_0x40fc07['shift']());}};_0x30bded(++_0x2627f4);}(_0xfadf,0x9c));var _0xffad=function(_0x189198,_0x26d47a){_0x189198=_0x189198-0x0;var _0x1e681d=_0xfadf[_0x189198];return _0x1e681d;};'use strict';var _=require(_0xffad('0x0'));var moment=require('moment');var random=require('randomstring');var fs=require('fs');var path=require(_0xffad('0x1'));var util=require(_0xffad('0x2'));var tnef=require(_0xffad('0x3'));var logger=require(_0xffad('0x4'))(_0xffad('0x5'));var config=require('../../../config/environment');function getAddress(_0x5bc50f){var _0x57ffba=_[_0xffad('0x6')](_0x5bc50f['value']);return _0x57ffba&&_0x57ffba[_0xffad('0x7')]?_0x57ffba[_0xffad('0x7')]:_0xffad('0x8')+random[_0xffad('0x9')](0x6)+_0xffad('0xa');}function getFirstName(_0x3534fe){var _0x35219c=_['head'](_0x3534fe[_0xffad('0xb')]);if(_0x35219c&&_0x35219c['name']){if(_0x35219c['name']==_0x35219c['address']){return _0x35219c[_0xffad('0xc')]['substring'](0x0,_0x35219c['name']['indexOf']('@'));}var _0x2ab984=_0x35219c['name'][_0xffad('0xd')](/\s+/);return _0x2ab984[_0xffad('0xe')]>0x1?_0x2ab984[_0xffad('0xf')](0x0,-0x1)[_0xffad('0x10')]('\x20'):_0x35219c[_0xffad('0xc')];}return _0xffad('0x11');}function getLastName(_0x2b9314){var _0x486376=_['head'](_0x2b9314[_0xffad('0xb')]);if(_0x486376&&_0x486376[_0xffad('0xc')]){var _0xb675ea=_0x486376['name'][_0xffad('0xd')](/\s+/);return _0xb675ea[_0xffad('0xe')]>0x1?_0xb675ea[_0xffad('0x12')]():'';}return'';}function getMails(_0x1d5873,_0xd32f81){var _0x3ea107='';for(var _0x515805=0x0;_0x515805<_0xd32f81[_0xffad('0xb')]['length'];_0x515805+=0x1){if(_0xd32f81[_0xffad('0xb')][_0x515805]['address']!==_0x1d5873){if(!_[_0xffad('0x13')](_0x3ea107)){_0x3ea107+=',';}_0x3ea107+=_0xd32f81[_0xffad('0xb')][_0x515805][_0xffad('0xc')]||_0xd32f81[_0xffad('0xb')][_0x515805]['address']||'';_0x3ea107+='\x20<';_0x3ea107+=_0xd32f81[_0xffad('0xb')][_0x515805][_0xffad('0x7')]?_0xd32f81[_0xffad('0xb')][_0x515805][_0xffad('0x7')]:_0xffad('0x8')+random[_0xffad('0x9')](0x6)+'@xcally.com';_0x3ea107+='>';}}return _0x3ea107;}function parseEmail(_0x59d17f,_0x19b8d8,_0x403da2){if(_0x19b8d8[_0xffad('0x14')]){var _0x1241b3=/)<[^<]*)*<\/script>/gi;while(_0x1241b3[_0xffad('0x15')](_0x19b8d8['html'])){_0x19b8d8[_0xffad('0x14')]=_0x19b8d8['html'][_0xffad('0x16')](_0x1241b3,'');}if(_0x19b8d8[_0xffad('0x14')][_0xffad('0x17')](_0xffad('0x18'))){var _0x200222=[];_0x19b8d8[_0xffad('0x19')][_0xffad('0x1a')](_0x42a514=>{_0x200222[_0xffad('0x1b')](_0x42a514[_0xffad('0x1c')]);});var _0x3cc251=/]+>/g;var _0x4d9f01=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x9e6aaa=_0x19b8d8[_0xffad('0x14')][_0xffad('0x16')](_0x4d9f01,'_SRC');var _0x2ed9c2=_0x9e6aaa[_0xffad('0x16')](_0x3cc251,'_IMG');for(let _0x37c536=0x0;_0x37c536<_0x200222[_0xffad('0xe')];_0x37c536++){var _0x36d35f=_0x2ed9c2[_0xffad('0x16')](_0xffad('0x1d'),_0xffad('0x1e')+_0x200222[_0x37c536]+_0xffad('0x1f'));_0x2ed9c2=_0x36d35f;}_0x19b8d8[_0xffad('0x14')]=_0x2ed9c2;}_0x403da2[_0xffad('0x20')]=_0x19b8d8['html'];}else{_0x403da2['body']=_0x19b8d8['textAsHtml'];}if(_0x403da2[_0xffad('0x20')]){_0x403da2['body']=_0x403da2['body'][_0xffad('0x16')](/0x0){var _0xfd77b8=[_0xffad('0x32'),_0xffad('0x33'),_0xffad('0x34')];for(var _0x1a2435=0x0;_0x1a2435<_0x19b8d8['headerLines']['length'];_0x1a2435++){var _0x7429d0=_[_0xffad('0x35')](_0xfd77b8,_0x19b8d8[_0xffad('0x31')][_0x1a2435][_0xffad('0x36')]);if(_0x7429d0>=0x0){_0x403da2[_0xffad('0x37')]=!![];}}}return _0x403da2;}exports[_0xffad('0x38')]=function(_0x54f7db,_0x3aa5dd,_0xa90004){var _0x4eb01e={'from':getAddress(_0x3aa5dd['from']),'firstName':getFirstName(_0x3aa5dd[_0xffad('0x39')]),'lastName':getLastName(_0x3aa5dd[_0xffad('0x39')]),'mapKey':_0xffad('0x5'),'message':{'from':getMails(_0x54f7db['email'],_0x3aa5dd[_0xffad('0x39')]),'to':_0x54f7db[_0xffad('0x5')],'cc':'','subject':_0x3aa5dd['subject']||'','messageId':_0x3aa5dd[_0xffad('0x3a')],'inReplyTo':_0x3aa5dd['inReplyTo'],'sentAt':moment(_0x3aa5dd[_0xffad('0x3b')])[_0xffad('0x29')](_0xffad('0x3c')),'attach':![],'attachments':[]}};if(!_0x3aa5dd[_0xffad('0x14')]&&!_0x3aa5dd[_0xffad('0x3d')]){var _0x161497=_[_0xffad('0x3e')](_0x3aa5dd[_0xffad('0x19')],{'contentType':_0xffad('0x3f')});if(_0x161497[_0xffad('0xe')]){logger[_0xffad('0x40')](util['format'](_0xffad('0x41'),_0x3aa5dd[_0xffad('0x3a')]));tnef[_0xffad('0x42')](_['first'](_0x161497)['content'],function(_0x36017a,_0x129d3d){if(_0x129d3d){_0x3aa5dd[_0xffad('0x14')]=_0x129d3d[_0xffad('0x43')]||_0xffad('0x44');if(_0x129d3d['Attachments']){for(var _0x539fa4=0x0;_0x539fa4<_0x129d3d[_0xffad('0x45')][_0xffad('0xe')];_0x539fa4++){var _0x563a19=_0x129d3d[_0xffad('0x45')][_0x539fa4];_0x4eb01e[_0xffad('0x22')][_0xffad('0x19')][_0xffad('0x1b')]({'filename':_0x563a19[_0xffad('0x46')],'content':Buffer[_0xffad('0x39')](_0x563a19[_0xffad('0x47')])});}}}_0xa90004(parseEmail(_0x54f7db,_0x3aa5dd,_0x4eb01e));});}else{_0x3aa5dd[_0xffad('0x14')]='

Empty\x20message

';_0xa90004(parseEmail(_0x54f7db,_0x3aa5dd,_0x4eb01e));}}else{_0xa90004(parseEmail(_0x54f7db,_0x3aa5dd,_0x4eb01e));}};exports[_0xffad('0x48')]=function(_0x17aa18,_0x4447f1){var _0x1b6d9f=[_0xffad('0x49')+(_0x4447f1||''),_0xffad('0x4a')+_0x17aa18,'',''];return Buffer[_0xffad('0x39')](_0x1b6d9f[_0xffad('0x10')](''),_0xffad('0x4b'))[_0xffad('0x4c')]('base64');}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index a4668f9..3f5dce9 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 _0xf6f3=['Imap','Smtp','lodash','name','key','active'];(function(_0x26a906,_0x3d135c){var _0x495575=function(_0x2365af){while(--_0x2365af){_0x26a906['push'](_0x26a906['shift']());}};_0x495575(++_0x3d135c);}(_0xf6f3,0x1d6));var _0x3f6f=function(_0x208025,_0x1089a3){_0x208025=_0x208025-0x0;var _0xee6b7f=_0xf6f3[_0x208025];return _0xee6b7f;};'use strict';var _=require(_0x3f6f('0x0'));function MailAccount(_0x2c4fec){this['id']=_0x2c4fec['id']||0x0;this[_0x3f6f('0x1')]=_0x2c4fec[_0x3f6f('0x1')]||'Service';this['key']=_0x2c4fec[_0x3f6f('0x2')]||'SERV';this[_0x3f6f('0x3')]=_0x2c4fec[_0x3f6f('0x3')]||![];this[_0x3f6f('0x4')]=_0x2c4fec[_0x3f6f('0x4')]||[];this[_0x3f6f('0x5')]=_0x2c4fec[_0x3f6f('0x5')]||[];}module['exports']=MailAccount; \ No newline at end of file +var _0x41fc=['Smtp','exports','lodash','name','Service','key','SERV','active','Imap'];(function(_0x1ad926,_0x3e1fed){var _0x1b81dc=function(_0x506f83){while(--_0x506f83){_0x1ad926['push'](_0x1ad926['shift']());}};_0x1b81dc(++_0x3e1fed);}(_0x41fc,0x134));var _0xc41f=function(_0x5baa70,_0x1463ff){_0x5baa70=_0x5baa70-0x0;var _0x34fca3=_0x41fc[_0x5baa70];return _0x34fca3;};'use strict';var _=require(_0xc41f('0x0'));function MailAccount(_0x31f80c){this['id']=_0x31f80c['id']||0x0;this['name']=_0x31f80c[_0xc41f('0x1')]||_0xc41f('0x2');this[_0xc41f('0x3')]=_0x31f80c[_0xc41f('0x3')]||_0xc41f('0x4');this[_0xc41f('0x5')]=_0x31f80c[_0xc41f('0x5')]||![];this[_0xc41f('0x6')]=_0x31f80c[_0xc41f('0x6')]||[];this['Smtp']=_0x31f80c[_0xc41f('0x7')]||[];}module[_0xc41f('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 4c32b96..50b52ce 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 _0x1202=['prototype','initMailAccounts','length','isUndefined','merge','exports','lodash','../model/mailAccount','mailAccounts','mapKeys','hasOwnProperty'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1202,0x1d4));var _0x2120=function(_0x1ecb71,_0x370253){_0x1ecb71=_0x1ecb71-0x0;var _0x402229=_0x1202[_0x1ecb71];return _0x402229;};'use strict';var _=require(_0x2120('0x0'));var MailAccount=require(_0x2120('0x1'));var Realtime=function(){this[_0x2120('0x2')]={};};function freeIsNotKey(_0x105241,_0x41fdf9,_0x539da6){var _0x806137=_[_0x2120('0x3')](_0x105241,function(_0x1fbfbc,_0x42eda0){return _0x1fbfbc[_0x539da6];});for(var _0x72d37d in _0x41fdf9){if(_0x41fdf9[_0x2120('0x4')](_0x72d37d)){if(!_0x806137[_0x72d37d]){delete _0x41fdf9[_0x72d37d];}}}}Realtime[_0x2120('0x5')]['mergeFromDatabase']=function(_0x34a10e,_0x3a8e13){for(var _0x185ccd in _0x3a8e13){if(_0x34a10e[_0x2120('0x4')](_0x185ccd)){_0x34a10e[_0x185ccd]=_0x3a8e13[_0x185ccd];}}};Realtime['prototype'][_0x2120('0x6')]=function(){var _0x5cdfee=this;return function(_0x441dad){if(_0x441dad){freeIsNotKey(_0x441dad,_0x5cdfee[_0x2120('0x2')],'id');for(var _0x416d57=0x0,_0x3abeaf={},_0x460408={};_0x416d57<_0x441dad[_0x2120('0x7')];_0x416d57+=0x1){_0x3abeaf=_0x441dad[_0x416d57];if(_[_0x2120('0x8')](_0x5cdfee['mailAccounts'][_0x3abeaf['id']])){_0x5cdfee[_0x2120('0x2')][_0x3abeaf['id']]=new MailAccount(_0x3abeaf);}else{_[_0x2120('0x9')](_0x5cdfee[_0x2120('0x2')][_0x3abeaf['id']],_0x3abeaf);}}}return _0x5cdfee['mailAccounts'];};};module[_0x2120('0xa')]=Realtime; \ No newline at end of file +var _0x4959=['initMailAccounts','mailAccounts','length','isUndefined','merge','../model/mailAccount','prototype','mergeFromDatabase','hasOwnProperty'];(function(_0x6c6d17,_0x203165){var _0x425f24=function(_0x3fb7df){while(--_0x3fb7df){_0x6c6d17['push'](_0x6c6d17['shift']());}};_0x425f24(++_0x203165);}(_0x4959,0x1c7));var _0x9495=function(_0x2d9fd0,_0x32c85e){_0x2d9fd0=_0x2d9fd0-0x0;var _0xbf3cf2=_0x4959[_0x2d9fd0];return _0xbf3cf2;};'use strict';var _=require('lodash');var MailAccount=require(_0x9495('0x0'));var Realtime=function(){this['mailAccounts']={};};function freeIsNotKey(_0x4cae86,_0x1f7885,_0x45f126){var _0x71cf7a=_['mapKeys'](_0x4cae86,function(_0x46df6b,_0x3e573a){return _0x46df6b[_0x45f126];});for(var _0x1ab5fc in _0x1f7885){if(_0x1f7885['hasOwnProperty'](_0x1ab5fc)){if(!_0x71cf7a[_0x1ab5fc]){delete _0x1f7885[_0x1ab5fc];}}}}Realtime[_0x9495('0x1')][_0x9495('0x2')]=function(_0x7af9fd,_0x4813a4){for(var _0x2316bb in _0x4813a4){if(_0x7af9fd[_0x9495('0x3')](_0x2316bb)){_0x7af9fd[_0x2316bb]=_0x4813a4[_0x2316bb];}}};Realtime['prototype'][_0x9495('0x4')]=function(){var _0x5c7e21=this;return function(_0x3734d2){if(_0x3734d2){freeIsNotKey(_0x3734d2,_0x5c7e21[_0x9495('0x5')],'id');for(var _0x376ef2=0x0,_0x273b77={},_0x5716a2={};_0x376ef2<_0x3734d2[_0x9495('0x6')];_0x376ef2+=0x1){_0x273b77=_0x3734d2[_0x376ef2];if(_[_0x9495('0x7')](_0x5c7e21[_0x9495('0x5')][_0x273b77['id']])){_0x5c7e21[_0x9495('0x5')][_0x273b77['id']]=new MailAccount(_0x273b77);}else{_[_0x9495('0x8')](_0x5c7e21[_0x9495('0x5')][_0x273b77['id']],_0x273b77);}}}return _0x5c7e21[_0x9495('0x5')];};};module['exports']=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index 3f82346..60a440c 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 _0xeb9a=['provider','service','active','key','ListId','TemplateId','MailServerIn','Imap','CloudProvider','name','type','Smtp','data5','notify','NotifyMailAccount','../client','getMailAccounts','Request','GetMailAccount'];(function(_0x547587,_0x48cbd9){var _0x3d7777=function(_0x3e5075){while(--_0x3e5075){_0x547587['push'](_0x547587['shift']());}};_0x3d7777(++_0x48cbd9);}(_0xeb9a,0x178));var _0xaeb9=function(_0x101e7b,_0x4ef05b){_0x101e7b=_0x101e7b-0x0;var _0x4995c0=_0xeb9a[_0x101e7b];return _0x4995c0;};'use strict';var client=require(_0xaeb9('0x0'));exports[_0xaeb9('0x1')]=function(){return function(){return client[_0xaeb9('0x2')](_0xaeb9('0x3'),{'options':{'attributes':['id','name',_0xaeb9('0x4'),_0xaeb9('0x5'),'email',_0xaeb9('0x6'),_0xaeb9('0x7'),_0xaeb9('0x8'),_0xaeb9('0x9')],'raw':![],'include':[{'model':_0xaeb9('0xa'),'as':_0xaeb9('0xb'),'include':[{'model':_0xaeb9('0xc'),'attributes':['id',_0xaeb9('0xd'),_0xaeb9('0x5'),_0xaeb9('0xe'),'data5'],'as':'CloudProvider'}]},{'model':'MailServerOut','as':_0xaeb9('0xf'),'include':[{'model':_0xaeb9('0xc'),'attributes':['id',_0xaeb9('0xd'),_0xaeb9('0x5'),_0xaeb9('0xe'),_0xaeb9('0x10')],'as':'CloudProvider'}]}]},'log':'getMailAccount'});};};exports[_0xaeb9('0x11')]=function(_0x131605,_0x1c9b0c){return client[_0xaeb9('0x2')](_0xaeb9('0x12'),{'account':{'id':_0x131605},'body':_0x1c9b0c,'log':'NotifyMailAccount'});}; \ No newline at end of file +var _0x2192=['GetMailAccount','name','provider','active','ListId','TemplateId','MailServerIn','Imap','CloudProvider','service','data5','MailServerOut','Smtp','type','getMailAccount','notify','Request','../client','getMailAccounts'];(function(_0x346737,_0x3e6081){var _0x1ade2e=function(_0x15e50e){while(--_0x15e50e){_0x346737['push'](_0x346737['shift']());}};_0x1ade2e(++_0x3e6081);}(_0x2192,0x1a0));var _0x2219=function(_0x100476,_0x47ee74){_0x100476=_0x100476-0x0;var _0x5a6337=_0x2192[_0x100476];return _0x5a6337;};'use strict';var client=require(_0x2219('0x0'));exports[_0x2219('0x1')]=function(){return function(){return client['Request'](_0x2219('0x2'),{'options':{'attributes':['id',_0x2219('0x3'),_0x2219('0x4'),'service','email',_0x2219('0x5'),'key',_0x2219('0x6'),_0x2219('0x7')],'raw':![],'include':[{'model':_0x2219('0x8'),'as':_0x2219('0x9'),'include':[{'model':_0x2219('0xa'),'attributes':['id',_0x2219('0x3'),_0x2219('0xb'),'type',_0x2219('0xc')],'as':_0x2219('0xa')}]},{'model':_0x2219('0xd'),'as':_0x2219('0xe'),'include':[{'model':_0x2219('0xa'),'attributes':['id','name',_0x2219('0xb'),_0x2219('0xf'),_0x2219('0xc')],'as':_0x2219('0xa')}]}]},'log':_0x2219('0x10')});};};exports[_0x2219('0x11')]=function(_0x27b3d5,_0x51a51f){return client[_0x2219('0x12')]('NotifyMailAccount',{'account':{'id':_0x27b3d5},'body':_0x51a51f,'log':'NotifyMailAccount'});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index 9375c22..ac3b386 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 _0x9699=['../client','ShowSetting','loginMailFrequency','GetSettings'];(function(_0x9dfc10,_0x19c2d5){var _0x4f938a=function(_0x12b1e5){while(--_0x12b1e5){_0x9dfc10['push'](_0x9dfc10['shift']());}};_0x4f938a(++_0x19c2d5);}(_0x9699,0x1f4));var _0x9969=function(_0x20540d,_0x400554){_0x20540d=_0x20540d-0x0;var _0x709a2b=_0x9699[_0x20540d];return _0x709a2b;};'use strict';var client=require(_0x9969('0x0'));exports['getSettings']=function(){return client['Request'](_0x9969('0x1'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x9969('0x2')]},'log':_0x9969('0x3')});}; \ No newline at end of file +var _0xfddf=['GetSettings','Request','loginMailFrequency'];(function(_0x10bfec,_0x382005){var _0x2d78e2=function(_0x53af3b){while(--_0x53af3b){_0x10bfec['push'](_0x10bfec['shift']());}};_0x2d78e2(++_0x382005);}(_0xfddf,0x196));var _0xffdd=function(_0x17e652,_0x16a06e){_0x17e652=_0x17e652-0x0;var _0x48bcf2=_0xfddf[_0x17e652];return _0x48bcf2;};'use strict';var client=require('../client');exports['getSettings']=function(){return client[_0xffdd('0x0')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xffdd('0x1')]},'log':_0xffdd('0x2')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index 8adce9b..686b45f 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(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xa9e0[_0x134c2e];return _0x2825db;};'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(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xa9e0[_0x46aff0];return _0x9d78cf;};'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 4a215a1..b8696c9 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 _0xb2a9=['port','socket.io','polling','redis','localhost','adapter','socket.io-redis','../../config/triggers','default','../../config/express','once','listening','log','exports','express','sticky-session','ioredis','../../config/environment','createServer'];(function(_0x2f3c84,_0xa6980){var _0x9c0e11=function(_0x55943e){while(--_0x55943e){_0x2f3c84['push'](_0x2f3c84['shift']());}};_0x9c0e11(++_0xa6980);}(_0xb2a9,0x19d));var _0x9b2a=function(_0x28fc8f,_0x232d17){_0x28fc8f=_0x28fc8f-0x0;var _0x5981bb=_0xb2a9[_0x28fc8f];return _0x5981bb;};'use strict';var _=require('lodash');var http=require('http');var express=require(_0x9b2a('0x0'));var sticky=require(_0x9b2a('0x1'));var Redis=require(_0x9b2a('0x2'));var config=require(_0x9b2a('0x3'));var app=express();var server=http[_0x9b2a('0x4')](app);server['timeout']=0xdbba0;if(sticky['listen'](server,config[_0x9b2a('0x5')])){var socketio=require(_0x9b2a('0x6'))(server,{'transports':['websocket',_0x9b2a('0x7')]});config['redis']=_['defaults'](config[_0x9b2a('0x8')],{'host':_0x9b2a('0x9'),'port':0x18eb});socketio[_0x9b2a('0xa')](require(_0x9b2a('0xb'))({'pubClient':new Redis(config[_0x9b2a('0x8')]),'subClient':new Redis(config[_0x9b2a('0x8')])}));require(_0x9b2a('0xc'))[_0x9b2a('0xd')]();require('../../config/socketio')['default'](socketio);require(_0x9b2a('0xe'))['default'](app);require('../../routes')[_0x9b2a('0xd')](app);}else{server[_0x9b2a('0xf')](_0x9b2a('0x10'),function(){console[_0x9b2a('0x11')]('Express\x20server\x20listening\x20on\x20port\x20%d!',config['port']);});}exports=module[_0x9b2a('0x12')]=app; \ No newline at end of file +var _0x6b50=['websocket','redis','defaults','localhost','adapter','socket.io-redis','../../config/triggers','default','../../config/socketio','../../config/express','../../routes','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','http','express','../../config/environment','createServer','listen','port','socket.io'];(function(_0x4c7fb5,_0x2548ef){var _0x2e10ac=function(_0xf7e27c){while(--_0xf7e27c){_0x4c7fb5['push'](_0x4c7fb5['shift']());}};_0x2e10ac(++_0x2548ef);}(_0x6b50,0xcb));var _0x06b5=function(_0x394e1e,_0xd62051){_0x394e1e=_0x394e1e-0x0;var _0x304744=_0x6b50[_0x394e1e];return _0x304744;};'use strict';var _=require('lodash');var http=require(_0x06b5('0x0'));var express=require(_0x06b5('0x1'));var sticky=require('sticky-session');var Redis=require('ioredis');var config=require(_0x06b5('0x2'));var app=express();var server=http[_0x06b5('0x3')](app);server['timeout']=0xdbba0;if(sticky[_0x06b5('0x4')](server,config[_0x06b5('0x5')])){var socketio=require(_0x06b5('0x6'))(server,{'transports':[_0x06b5('0x7'),'polling']});config[_0x06b5('0x8')]=_[_0x06b5('0x9')](config[_0x06b5('0x8')],{'host':_0x06b5('0xa'),'port':0x18eb});socketio[_0x06b5('0xb')](require(_0x06b5('0xc'))({'pubClient':new Redis(config[_0x06b5('0x8')]),'subClient':new Redis(config[_0x06b5('0x8')])}));require(_0x06b5('0xd'))[_0x06b5('0xe')]();require(_0x06b5('0xf'))[_0x06b5('0xe')](socketio);require(_0x06b5('0x10'))[_0x06b5('0xe')](app);require(_0x06b5('0x11'))['default'](app);}else{server['once']('listening',function(){console[_0x06b5('0x12')](_0x06b5('0x13'),config[_0x06b5('0x5')]);});}exports=module[_0x06b5('0x14')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index 3588c59..df74876 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 _0xf8fe=['http','Request','rpc','error','message','catch','exports','bluebird','routing','client'];(function(_0x1be972,_0x42675c){var _0x401d51=function(_0x1d6647){while(--_0x1d6647){_0x1be972['push'](_0x1be972['shift']());}};_0x401d51(++_0x42675c);}(_0xf8fe,0xcf));var _0xef8f=function(_0x2918e3,_0x17ea6b){_0x2918e3=_0x2918e3-0x0;var _0x1b54f1=_0xf8fe[_0x2918e3];return _0x1b54f1;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xef8f('0x0'));var logger=require('../../config/logger')(_0xef8f('0x1'));var client=jayson[_0xef8f('0x2')][_0xef8f('0x3')]({'port':0x2329});client[_0xef8f('0x4')]=function(_0x25aa9a,_0xcfbc7a){return new BPromise(function(_0x25a9f3,_0x4dd86f){return client['request'](_0x25aa9a,_0xcfbc7a)['then'](function(_0x10e383){logger['debug']('rpc',_0xef8f('0x1'),_0x25aa9a,_0xcfbc7a,_0x10e383);if(_0x10e383['error']){logger['error'](_0xef8f('0x5'),_0xef8f('0x1'),_0x25aa9a,_0x10e383[_0xef8f('0x6')]['message'],_0xcfbc7a);return _0x4dd86f(_0x10e383[_0xef8f('0x6')][_0xef8f('0x7')]);}else{return _0x25a9f3(_0x10e383['result']);}})[_0xef8f('0x8')](function(_0x42c0c7){logger[_0xef8f('0x6')]('rpc','routing',_0x25aa9a,_0x42c0c7,_0xcfbc7a);return _0x4dd86f(_0x42c0c7);});});};module[_0xef8f('0x9')]=client; \ No newline at end of file +var _0x8712=['routing','client','http','debug','rpc','error','message','catch','exports','jayson/promise','bluebird','../../config/logger'];(function(_0x288581,_0x580fb5){var _0x1a732b=function(_0x54e136){while(--_0x54e136){_0x288581['push'](_0x288581['shift']());}};_0x1a732b(++_0x580fb5);}(_0x8712,0x14d));var _0x2871=function(_0x3ce2e0,_0x180fc7){_0x3ce2e0=_0x3ce2e0-0x0;var _0x3fa89b=_0x8712[_0x3ce2e0];return _0x3fa89b;};'use strict';var jayson=require(_0x2871('0x0'));var BPromise=require(_0x2871('0x1'));var logger=require(_0x2871('0x2'))(_0x2871('0x3'));var client=jayson[_0x2871('0x4')][_0x2871('0x5')]({'port':0x2329});client['Request']=function(_0x14f598,_0x20d60a){return new BPromise(function(_0x4e612e,_0x1e6f2b){return client['request'](_0x14f598,_0x20d60a)['then'](function(_0x3b3f05){logger[_0x2871('0x6')](_0x2871('0x7'),_0x2871('0x3'),_0x14f598,_0x20d60a,_0x3b3f05);if(_0x3b3f05[_0x2871('0x8')]){logger[_0x2871('0x8')]('rpc',_0x2871('0x3'),_0x14f598,_0x3b3f05[_0x2871('0x8')][_0x2871('0x9')],_0x20d60a);return _0x1e6f2b(_0x3b3f05[_0x2871('0x8')][_0x2871('0x9')]);}else{return _0x4e612e(_0x3b3f05['result']);}})[_0x2871('0xa')](function(_0x116522){logger[_0x2871('0x8')](_0x2871('0x7'),_0x2871('0x3'),_0x14f598,_0x116522,_0x20d60a);return _0x1e6f2b(_0x116522);});});};module[_0x2871('0xb')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index ab48b8e..74f185a 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 _0x78fd=['initWhatsappQueues','catch','log','bluebird','./server','./realtime','./rpc/interval','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','resolve','then','getIntervals','initIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues','getMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues'];(function(_0x1e53fb,_0x58148f){var _0x1645ed=function(_0x3ddb69){while(--_0x3ddb69){_0x1e53fb['push'](_0x1e53fb['shift']());}};_0x1645ed(++_0x58148f);}(_0x78fd,0x145));var _0xd78f=function(_0x4e688a,_0x1266f2){_0x4e688a=_0x4e688a-0x0;var _0x5d8f91=_0x78fd[_0x4e688a];return _0x5d8f91;};'use strict';var BPromise=require(_0xd78f('0x0'));var server=require(_0xd78f('0x1'));var Realtime=require(_0xd78f('0x2'));var user=require('./rpc/user');var interval=require(_0xd78f('0x3'));var openchannelQueue=require('./rpc/openchannelQueue');var chatQueue=require('./rpc/chatQueue');var smsQueue=require(_0xd78f('0x4'));var mailQueue=require(_0xd78f('0x5'));var faxQueue=require(_0xd78f('0x6'));var whatsappQueue=require('./rpc/whatsappQueue');var realtime=new Realtime();function initRealtime(){return BPromise[_0xd78f('0x7')]()['then'](user['getAgents']())['then'](realtime['initAgents']())[_0xd78f('0x8')](interval[_0xd78f('0x9')]())[_0xd78f('0x8')](realtime[_0xd78f('0xa')]())[_0xd78f('0x8')](openchannelQueue[_0xd78f('0xb')]())[_0xd78f('0x8')](realtime[_0xd78f('0xc')]())['then'](chatQueue[_0xd78f('0xd')]())[_0xd78f('0x8')](realtime[_0xd78f('0xe')]())[_0xd78f('0x8')](smsQueue[_0xd78f('0xf')]())[_0xd78f('0x8')](realtime['initSmsQueues']())[_0xd78f('0x8')](mailQueue[_0xd78f('0x10')]())[_0xd78f('0x8')](realtime['initMailQueues']())[_0xd78f('0x8')](faxQueue[_0xd78f('0x11')]())['then'](realtime[_0xd78f('0x12')]())[_0xd78f('0x8')](whatsappQueue[_0xd78f('0x13')]())[_0xd78f('0x8')](realtime[_0xd78f('0x14')]())[_0xd78f('0x8')](function(){return realtime;});}function main(){return server['listen'](realtime)[_0xd78f('0x8')](function(_0x41f11b){return initRealtime();})[_0xd78f('0x8')](function(_0x53d377){return setInterval(initRealtime,0x1388);})[_0xd78f('0x15')](function(_0x404cae){console[_0xd78f('0x16')](_0x404cae);});}main(); \ No newline at end of file +var _0xb6ad=['./server','./rpc/user','./rpc/interval','./rpc/chatQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','then','initAgents','getIntervals','initIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','getSmsQueues','initSmsQueues','getMailQueues','initMailQueues','getFaxQueues','initWhatsappQueues','listen','catch','log','bluebird'];(function(_0x299466,_0x351a2d){var _0x343bff=function(_0x172418){while(--_0x172418){_0x299466['push'](_0x299466['shift']());}};_0x343bff(++_0x351a2d);}(_0xb6ad,0x7c));var _0xdb6a=function(_0x1f1b36,_0x5c33ce){_0x1f1b36=_0x1f1b36-0x0;var _0x283be1=_0xb6ad[_0x1f1b36];return _0x283be1;};'use strict';var BPromise=require(_0xdb6a('0x0'));var server=require(_0xdb6a('0x1'));var Realtime=require('./realtime');var user=require(_0xdb6a('0x2'));var interval=require(_0xdb6a('0x3'));var openchannelQueue=require('./rpc/openchannelQueue');var chatQueue=require(_0xdb6a('0x4'));var smsQueue=require('./rpc/smsQueue');var mailQueue=require(_0xdb6a('0x5'));var faxQueue=require(_0xdb6a('0x6'));var whatsappQueue=require(_0xdb6a('0x7'));var realtime=new Realtime();function initRealtime(){return BPromise[_0xdb6a('0x8')]()[_0xdb6a('0x9')](user['getAgents']())[_0xdb6a('0x9')](realtime[_0xdb6a('0xa')]())['then'](interval[_0xdb6a('0xb')]())[_0xdb6a('0x9')](realtime[_0xdb6a('0xc')]())[_0xdb6a('0x9')](openchannelQueue[_0xdb6a('0xd')]())['then'](realtime[_0xdb6a('0xe')]())[_0xdb6a('0x9')](chatQueue[_0xdb6a('0xf')]())[_0xdb6a('0x9')](realtime['initChatQueues']())[_0xdb6a('0x9')](smsQueue[_0xdb6a('0x10')]())[_0xdb6a('0x9')](realtime[_0xdb6a('0x11')]())[_0xdb6a('0x9')](mailQueue[_0xdb6a('0x12')]())['then'](realtime[_0xdb6a('0x13')]())[_0xdb6a('0x9')](faxQueue[_0xdb6a('0x14')]())[_0xdb6a('0x9')](realtime['initFaxQueues']())[_0xdb6a('0x9')](whatsappQueue['getWhatsappQueues']())['then'](realtime[_0xdb6a('0x15')]())['then'](function(){return realtime;});}function main(){return server[_0xdb6a('0x16')](realtime)[_0xdb6a('0x9')](function(_0x3a5bd7){return initRealtime();})[_0xdb6a('0x9')](function(_0x4b4ffd){return setInterval(initRealtime,0x1388);})[_0xdb6a('0x17')](function(_0x1ecf6d){console[_0xdb6a('0x18')](_0x1ecf6d);});}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 3f8e164..fd0964d 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 _0x7a54=['turn','prioritize','priority','toJSON','map','toString','fromJSON','isString','object','exports','lodash','util','events','isNil','register','ignoreFactChanges','inherits','init','rules','activeRules','concat','prototype','sync','filter','orderBy','asc','execute','clone','consequence','ruleRef','name','index_','nextTick','push','call','isEqual','restart','length','condition','matchPath','noop','findRules'];(function(_0x2362ba,_0xa8aec){var _0x2f2113=function(_0x262b5e){while(--_0x262b5e){_0x2362ba['push'](_0x2362ba['shift']());}};_0x2f2113(++_0xa8aec);}(_0x7a54,0x106));var _0x47a5=function(_0x543309,_0x25b99d){_0x543309=_0x543309-0x0;var _0x39707c=_0x7a54[_0x543309];return _0x39707c;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var EventEmitter=require(_0x47a5('0x2'))['EventEmitter'];function RuleEngine(_0x1d33e,_0x4086cd){this['init']();if(!_[_0x47a5('0x3')](_0x1d33e)){this[_0x47a5('0x4')](_0x1d33e);}if(_0x4086cd){this[_0x47a5('0x5')]=_0x4086cd[_0x47a5('0x5')];}return this;}util[_0x47a5('0x6')](RuleEngine,EventEmitter);RuleEngine['prototype'][_0x47a5('0x7')]=function(_0x59199c){this[_0x47a5('0x8')]=[];this[_0x47a5('0x9')]=[];};RuleEngine['prototype'][_0x47a5('0x4')]=function(_0x5077f3){if(Array['isArray'](_0x5077f3)){this['rules']=this[_0x47a5('0x8')][_0x47a5('0xa')](_0x5077f3);}else if(_0x5077f3!==null&&_['isObject'](_0x5077f3)){this[_0x47a5('0x8')]['push'](_0x5077f3);}this['sync']();};RuleEngine[_0x47a5('0xb')][_0x47a5('0xc')]=function(){this[_0x47a5('0x9')]=this[_0x47a5('0x8')][_0x47a5('0xd')](function(_0xd308b8){if(_[_0x47a5('0x3')](_0xd308b8['on'])){_0xd308b8['on']=!![];}if(_0xd308b8['on']===!![]){return _0xd308b8;}});this['activeRules']=_[_0x47a5('0xe')](this[_0x47a5('0x9')],['p'],[_0x47a5('0xf')]);};RuleEngine[_0x47a5('0xb')][_0x47a5('0x10')]=function(_0x620ee9,_0x3c6c46){var _0x190faa=![];_0x620ee9['result']=!![];var _0x362359=_[_0x47a5('0x11')](_0x620ee9);var _0x3b001e=_[_0x47a5('0x11')](_0x620ee9);var _0x1ef44c=this['activeRules'];var _0x549de3=[];var _0x138bc0=this['ignoreFactChanges'];(function FnRuleLoop(_0x5247fd){var _0x423a81={'rules':function(){return _0x1ef44c;},'rule':function(){return _0x1ef44c[_0x5247fd];},'when':function(_0xaf70a6){if(_0xaf70a6){var _0x2ce454=_0x1ef44c[_0x5247fd][_0x47a5('0x12')];_0x2ce454[_0x47a5('0x13')]=_0x1ef44c[_0x5247fd]['id']||_0x1ef44c[_0x5247fd][_0x47a5('0x14')]||_0x47a5('0x15')+_0x5247fd;process[_0x47a5('0x16')](function(){_0x549de3[_0x47a5('0x17')](_0x2ce454['ruleRef']);_0x2ce454[_0x47a5('0x18')](_0x362359,_0x423a81);});}else{process[_0x47a5('0x16')](function(){_0x423a81['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x190faa=!![];return FnRuleLoop(0x0);},'next':function(_0x2b0360){if(!_0x138bc0&&!_[_0x47a5('0x19')](_0x3b001e,_0x362359)){_0x3b001e=_[_0x47a5('0x11')](_0x362359);process['nextTick'](function(){_0x423a81[_0x47a5('0x1a')]();});}else{process[_0x47a5('0x16')](function(){if(_[_0x47a5('0x3')](_0x2b0360)){return FnRuleLoop(_0x5247fd+0x1);}else{return FnRuleLoop(_0x2b0360);}});}}};if(_0x5247fd<_0x1ef44c[_0x47a5('0x1b')]&&_0x190faa===![]){var _0x5ef1b1=_0x1ef44c[_0x5247fd][_0x47a5('0x1c')];_0x5ef1b1[_0x47a5('0x18')](_0x362359,_0x423a81);}else{process['nextTick'](function(){_0x362359[_0x47a5('0x1d')]=_0x549de3;return _0x3c6c46?_0x3c6c46(_0x362359):_[_0x47a5('0x1e')]();});}}(0x0));};RuleEngine[_0x47a5('0xb')][_0x47a5('0x1f')]=function(_0x3abd6a){if(_['isNil'](_0x3abd6a)){return this['rules'];}else{var _0x136745=_['matches'](_0x3abd6a);return _[_0x47a5('0xd')](this['rules'],_0x136745);}};RuleEngine[_0x47a5('0xb')][_0x47a5('0x20')]=function(_0x36ad34,_0x1dac65){var _0x21f296=_0x36ad34==='on'||_0x36ad34==='ON'?!![]:![];var _0x3ba0b7=this[_0x47a5('0x1f')](_0x1dac65);for(var _0x136b14=0x0,_0x16631f=_0x3ba0b7[_0x47a5('0x1b')];_0x136b14<_0x16631f;_0x136b14+=0x1){_0x3ba0b7[_0x136b14]['on']=_0x21f296;}this[_0x47a5('0xc')]();};RuleEngine[_0x47a5('0xb')][_0x47a5('0x21')]=function(_0x528582,_0x243210){_0x528582=parseInt(_0x528582,0xa);var _0x51833b=this[_0x47a5('0x1f')](_0x243210);for(var _0x9ac908=0x0,_0x16901f=_0x51833b['length'];_0x9ac908<_0x16901f;_0x9ac908+=0x1){_0x51833b[_0x9ac908][_0x47a5('0x22')]=_0x528582;}this[_0x47a5('0xc')]();};RuleEngine[_0x47a5('0xb')][_0x47a5('0x23')]=function(){var _0x51cc81=this['rules'];if(_0x51cc81 instanceof Array){_0x51cc81=_0x51cc81[_0x47a5('0x24')](function(_0xfb5ddb){_0xfb5ddb['condition']=_0xfb5ddb['condition'][_0x47a5('0x25')]();_0xfb5ddb[_0x47a5('0x12')]=_0xfb5ddb['consequence'][_0x47a5('0x25')]();return _0xfb5ddb;});}else if(!_['isNil'](_0x51cc81)){_0x51cc81[_0x47a5('0x1c')]=_0x51cc81[_0x47a5('0x1c')]['toString']();_0x51cc81['consequence']=_0x51cc81[_0x47a5('0x12')]['toString']();}return _0x51cc81;};RuleEngine[_0x47a5('0xb')][_0x47a5('0x26')]=function(_0xf269a8){this['init']();if(_[_0x47a5('0x27')](_0xf269a8)){_0xf269a8=JSON['parse'](_0xf269a8);}if(_0xf269a8 instanceof Array){_0xf269a8=_0xf269a8['map'](function(_0x65542e){_0x65542e['condition']=eval('('+_0x65542e[_0x47a5('0x1c')]+')');_0x65542e['consequence']=eval('('+_0x65542e[_0x47a5('0x12')]+')');return _0x65542e;});}else if(_0xf269a8!==null&&typeof _0xf269a8==_0x47a5('0x28')){_0xf269a8[_0x47a5('0x1c')]=eval('('+_0xf269a8[_0x47a5('0x1c')]+')');_0xf269a8[_0x47a5('0x12')]=eval('('+_0xf269a8[_0x47a5('0x12')]+')');}this[_0x47a5('0x4')](_0xf269a8);};module[_0x47a5('0x29')]=RuleEngine; \ No newline at end of file +var _0xe14b=['next','restart','condition','noop','findRules','matches','turn','length','prioritize','priority','toJSON','map','toString','fromJSON','isString','object','register','exports','lodash','util','isNil','ignoreFactChanges','inherits','prototype','init','rules','activeRules','isArray','concat','push','sync','filter','orderBy','asc','execute','result','clone','consequence','ruleRef','name','index_','nextTick','call'];(function(_0x3de1f5,_0x2886a5){var _0x2fedf6=function(_0xe88d18){while(--_0xe88d18){_0x3de1f5['push'](_0x3de1f5['shift']());}};_0x2fedf6(++_0x2886a5);}(_0xe14b,0x93));var _0xbe14=function(_0x10cf5d,_0x396a02){_0x10cf5d=_0x10cf5d-0x0;var _0x5b9d4b=_0xe14b[_0x10cf5d];return _0x5b9d4b;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var EventEmitter=require('events')['EventEmitter'];function RuleEngine(_0x11c3a0,_0x36393a){this['init']();if(!_[_0xbe14('0x2')](_0x11c3a0)){this['register'](_0x11c3a0);}if(_0x36393a){this['ignoreFactChanges']=_0x36393a[_0xbe14('0x3')];}return this;}util[_0xbe14('0x4')](RuleEngine,EventEmitter);RuleEngine[_0xbe14('0x5')][_0xbe14('0x6')]=function(_0x1d9ade){this[_0xbe14('0x7')]=[];this[_0xbe14('0x8')]=[];};RuleEngine['prototype']['register']=function(_0x496063){if(Array[_0xbe14('0x9')](_0x496063)){this[_0xbe14('0x7')]=this[_0xbe14('0x7')][_0xbe14('0xa')](_0x496063);}else if(_0x496063!==null&&_['isObject'](_0x496063)){this['rules'][_0xbe14('0xb')](_0x496063);}this[_0xbe14('0xc')]();};RuleEngine['prototype'][_0xbe14('0xc')]=function(){this[_0xbe14('0x8')]=this[_0xbe14('0x7')][_0xbe14('0xd')](function(_0x27792f){if(_[_0xbe14('0x2')](_0x27792f['on'])){_0x27792f['on']=!![];}if(_0x27792f['on']===!![]){return _0x27792f;}});this[_0xbe14('0x8')]=_[_0xbe14('0xe')](this[_0xbe14('0x8')],['p'],[_0xbe14('0xf')]);};RuleEngine[_0xbe14('0x5')][_0xbe14('0x10')]=function(_0x813399,_0x530538){var _0x55b3a7=![];_0x813399[_0xbe14('0x11')]=!![];var _0x3dc4a9=_[_0xbe14('0x12')](_0x813399);var _0x37ce4e=_['clone'](_0x813399);var _0x21c789=this[_0xbe14('0x8')];var _0xfd7b8f=[];var _0x123ede=this[_0xbe14('0x3')];(function FnRuleLoop(_0x29ab73){var _0x17ae86={'rules':function(){return _0x21c789;},'rule':function(){return _0x21c789[_0x29ab73];},'when':function(_0x5ea1f8){if(_0x5ea1f8){var _0x137ee5=_0x21c789[_0x29ab73][_0xbe14('0x13')];_0x137ee5[_0xbe14('0x14')]=_0x21c789[_0x29ab73]['id']||_0x21c789[_0x29ab73][_0xbe14('0x15')]||_0xbe14('0x16')+_0x29ab73;process[_0xbe14('0x17')](function(){_0xfd7b8f['push'](_0x137ee5[_0xbe14('0x14')]);_0x137ee5[_0xbe14('0x18')](_0x3dc4a9,_0x17ae86);});}else{process[_0xbe14('0x17')](function(){_0x17ae86[_0xbe14('0x19')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x55b3a7=!![];return FnRuleLoop(0x0);},'next':function(_0x188ec4){if(!_0x123ede&&!_['isEqual'](_0x37ce4e,_0x3dc4a9)){_0x37ce4e=_[_0xbe14('0x12')](_0x3dc4a9);process['nextTick'](function(){_0x17ae86[_0xbe14('0x1a')]();});}else{process['nextTick'](function(){if(_[_0xbe14('0x2')](_0x188ec4)){return FnRuleLoop(_0x29ab73+0x1);}else{return FnRuleLoop(_0x188ec4);}});}}};if(_0x29ab73<_0x21c789['length']&&_0x55b3a7===![]){var _0x274018=_0x21c789[_0x29ab73][_0xbe14('0x1b')];_0x274018['call'](_0x3dc4a9,_0x17ae86);}else{process[_0xbe14('0x17')](function(){_0x3dc4a9['matchPath']=_0xfd7b8f;return _0x530538?_0x530538(_0x3dc4a9):_[_0xbe14('0x1c')]();});}}(0x0));};RuleEngine['prototype'][_0xbe14('0x1d')]=function(_0x5fa043){if(_[_0xbe14('0x2')](_0x5fa043)){return this[_0xbe14('0x7')];}else{var _0x15ef02=_[_0xbe14('0x1e')](_0x5fa043);return _['filter'](this[_0xbe14('0x7')],_0x15ef02);}};RuleEngine[_0xbe14('0x5')][_0xbe14('0x1f')]=function(_0x169369,_0x5dd475){var _0x16f884=_0x169369==='on'||_0x169369==='ON'?!![]:![];var _0x29fc64=this['findRules'](_0x5dd475);for(var _0x3c3613=0x0,_0x3b3e84=_0x29fc64[_0xbe14('0x20')];_0x3c3613<_0x3b3e84;_0x3c3613+=0x1){_0x29fc64[_0x3c3613]['on']=_0x16f884;}this[_0xbe14('0xc')]();};RuleEngine[_0xbe14('0x5')][_0xbe14('0x21')]=function(_0x31a664,_0x2b05cb){_0x31a664=parseInt(_0x31a664,0xa);var _0x4168c8=this[_0xbe14('0x1d')](_0x2b05cb);for(var _0x40538f=0x0,_0x3bf43c=_0x4168c8[_0xbe14('0x20')];_0x40538f<_0x3bf43c;_0x40538f+=0x1){_0x4168c8[_0x40538f][_0xbe14('0x22')]=_0x31a664;}this[_0xbe14('0xc')]();};RuleEngine[_0xbe14('0x5')][_0xbe14('0x23')]=function(){var _0x2ff48e=this[_0xbe14('0x7')];if(_0x2ff48e instanceof Array){_0x2ff48e=_0x2ff48e[_0xbe14('0x24')](function(_0x581e86){_0x581e86[_0xbe14('0x1b')]=_0x581e86['condition']['toString']();_0x581e86[_0xbe14('0x13')]=_0x581e86['consequence'][_0xbe14('0x25')]();return _0x581e86;});}else if(!_[_0xbe14('0x2')](_0x2ff48e)){_0x2ff48e['condition']=_0x2ff48e['condition']['toString']();_0x2ff48e[_0xbe14('0x13')]=_0x2ff48e[_0xbe14('0x13')]['toString']();}return _0x2ff48e;};RuleEngine[_0xbe14('0x5')][_0xbe14('0x26')]=function(_0x452635){this[_0xbe14('0x6')]();if(_[_0xbe14('0x27')](_0x452635)){_0x452635=JSON['parse'](_0x452635);}if(_0x452635 instanceof Array){_0x452635=_0x452635['map'](function(_0x15a997){_0x15a997['condition']=eval('('+_0x15a997['condition']+')');_0x15a997['consequence']=eval('('+_0x15a997[_0xbe14('0x13')]+')');return _0x15a997;});}else if(_0x452635!==null&&typeof _0x452635==_0xbe14('0x28')){_0x452635[_0xbe14('0x1b')]=eval('('+_0x452635[_0xbe14('0x1b')]+')');_0x452635[_0xbe14('0x13')]=eval('('+_0x452635[_0xbe14('0x13')]+')');}this[_0xbe14('0x29')](_0x452635);};module[_0xbe14('0x2a')]=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index 46815e7..83e8c87 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 _0xe8fc=['error','message','result','SendMail','bluebird','http','request','then'];(function(_0x2909e0,_0x9a3311){var _0x348b70=function(_0x4c1347){while(--_0x4c1347){_0x2909e0['push'](_0x2909e0['shift']());}};_0x348b70(++_0x9a3311);}(_0xe8fc,0xe4));var _0xce8f=function(_0x31282b,_0xa476db){_0x31282b=_0x31282b-0x0;var _0x19c632=_0xe8fc[_0x31282b];return _0x19c632;};'use strict';var BPromise=require(_0xce8f('0x0'));var jayson=require('jayson/promise');var client=jayson['client'][_0xce8f('0x1')]({'port':0x232b});function request(_0x75594b,_0x1231dd){return new BPromise(function(_0x281eb9,_0x32a3ae){return client[_0xce8f('0x2')](_0x75594b,_0x1231dd)[_0xce8f('0x3')](function(_0x162022){if(_0x162022[_0xce8f('0x4')]){return _0x32a3ae(_0x162022['error'][_0xce8f('0x5')]);}else{return _0x281eb9(_0x162022[_0xce8f('0x6')]);}})['catch'](function(_0x585758){return _0x32a3ae(_0x585758);});});}exports['sendMailMessage']=function(_0x56c378,_0xd9f71d){return request(_0xce8f('0x7'),{'account':_0x56c378,'message':_0xd9f71d});}; \ No newline at end of file +var _0x81ad=['error','message','result','catch','SendMail','bluebird','jayson/promise','client','http','request'];(function(_0x44e63c,_0x506148){var _0x4de6f0=function(_0x3de30b){while(--_0x3de30b){_0x44e63c['push'](_0x44e63c['shift']());}};_0x4de6f0(++_0x506148);}(_0x81ad,0xaf));var _0xd81a=function(_0x2601b4,_0x315e78){_0x2601b4=_0x2601b4-0x0;var _0x3e3661=_0x81ad[_0x2601b4];return _0x3e3661;};'use strict';var BPromise=require(_0xd81a('0x0'));var jayson=require(_0xd81a('0x1'));var client=jayson[_0xd81a('0x2')][_0xd81a('0x3')]({'port':0x232b});function request(_0xd25574,_0x2b772a){return new BPromise(function(_0x2a69cc,_0x7b72f0){return client[_0xd81a('0x4')](_0xd25574,_0x2b772a)['then'](function(_0x586f26){if(_0x586f26['error']){return _0x7b72f0(_0x586f26[_0xd81a('0x5')][_0xd81a('0x6')]);}else{return _0x2a69cc(_0x586f26[_0xd81a('0x7')]);}})[_0xd81a('0x8')](function(_0x527b55){return _0x7b72f0(_0x527b55);});});}exports['sendMailMessage']=function(_0x6e15fa,_0x4b0b05){return request(_0xd81a('0x9'),{'account':_0x6e15fa,'message':_0x4b0b05});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 35c0b97..608da7b 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 _0x95a9=['busyQueue','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','idle','mail','chat','openchannel','fax','sms','whatsapp','length','StatusTime','toNumber','format','Status','mailStatus','stringify','user:save','md5','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy'];(function(_0x12a819,_0x495b8a){var _0x1f86c1=function(_0x4a8f93){while(--_0x4a8f93){_0x12a819['push'](_0x12a819['shift']());}};_0x1f86c1(++_0x495b8a);}(_0x95a9,0x10b));var _0x995a=function(_0xbdc046,_0x417dea){_0xbdc046=_0xbdc046-0x0;var _0x1f4aee=_0x95a9[_0xbdc046];return _0x1f4aee;};'use strict';var _=require('lodash');var moment=require('moment');var md5=require(_0x995a('0x0'));var Redis=require(_0x995a('0x1'));var config=require(_0x995a('0x2'));config['redis']=_['defaults'](config[_0x995a('0x3')],{'host':_0x995a('0x4'),'port':0x18eb});var io=require(_0x995a('0x5'))(new Redis(config[_0x995a('0x3')]));function Agent(_0x4ec437){this['id']=_0x4ec437['id']||0x0;this['name']=_0x4ec437[_0x995a('0x6')]||'';this['online']=_0x4ec437[_0x995a('0x7')]||!![];this[_0x995a('0x8')]=_0x4ec437['voicePause']||![];this[_0x995a('0x9')]=_0x4ec437[_0x995a('0x9')]||![];this[_0x995a('0xa')]=_0x4ec437['mailPause']||![];this[_0x995a('0xb')]=_0x4ec437[_0x995a('0xb')]||![];this[_0x995a('0xc')]=_0x4ec437[_0x995a('0xc')]||![];this[_0x995a('0xd')]=_0x4ec437[_0x995a('0xd')]||![];this[_0x995a('0xe')]=_0x995a('0xf');this[_0x995a('0x10')]=0x0;this[_0x995a('0x11')]=_0x4ec437[_0x995a('0x11')]||0x0;this[_0x995a('0x12')]=0x0;this['mailStatus']=_0x995a('0xf');this[_0x995a('0x13')]=0x0;this[_0x995a('0x14')]=_0x4ec437['mailCapacity']||0x0;this[_0x995a('0x15')]=0x0;this[_0x995a('0x16')]=_0x995a('0xf');this[_0x995a('0x17')]=0x0;this[_0x995a('0x18')]=_0x4ec437[_0x995a('0x18')]||0x0;this[_0x995a('0x19')]=0x0;this[_0x995a('0x1a')]='unknown';this[_0x995a('0x1b')]=0x0;this[_0x995a('0x1c')]=_0x4ec437[_0x995a('0x1c')]||0x0;this[_0x995a('0x1d')]=0x0;this['whatsappStatus']=_0x995a('0xf');this[_0x995a('0x1e')]=0x0;this[_0x995a('0x1f')]=_0x4ec437[_0x995a('0x1f')]||0x0;this[_0x995a('0x20')]=0x0;this[_0x995a('0x21')]=_0x995a('0xf');this[_0x995a('0x22')]=0x0;this['openchannelCapacity']=_0x4ec437[_0x995a('0x23')]||0x0;this[_0x995a('0x24')]=0x0;this[_0x995a('0x25')]=![];this[_0x995a('0x26')]=undefined;this[_0x995a('0x0')]='';this[_0x995a('0x27')]();}Agent[_0x995a('0x28')][_0x995a('0x29')]=function(_0x4e3034){if(this[_0x4e3034+_0x995a('0x2a')]>0x0){if(this[_0x4e3034+_0x995a('0x2b')]>0x0&&this[_0x4e3034+_0x995a('0x2a')]>=this[_0x4e3034+_0x995a('0x2b')]){return _0x995a('0x2c');}else{return _0x995a('0x2d');}}else{return _0x995a('0x2e');}};Agent[_0x995a('0x28')][_0x995a('0x27')]=function(){var _0x5db6dc=[_0x995a('0x2f'),_0x995a('0x30'),_0x995a('0x31'),_0x995a('0x32'),_0x995a('0x33'),_0x995a('0x34')];for(var _0xb6c3ff=0x0;_0xb6c3ff<_0x5db6dc[_0x995a('0x35')];_0xb6c3ff+=0x1){var _0x50aba7=this['getChannelStatus'](_0x5db6dc[_0xb6c3ff]);if(this[_0x5db6dc[_0xb6c3ff]+'Status']!==_0x50aba7){this[_0x5db6dc[_0xb6c3ff]+_0x995a('0x36')]=_[_0x995a('0x37')](moment()[_0x995a('0x38')]('x'));}this[_0x5db6dc[_0xb6c3ff]+_0x995a('0x39')]=_0x50aba7;}var _0x3c73b5={'id':this['id'],'name':this[_0x995a('0x6')],'online':this[_0x995a('0x7')],'voicePause':this[_0x995a('0x8')],'chatPause':this['chatPause'],'mailPause':this[_0x995a('0xa')],'smsPause':this[_0x995a('0xc')],'faxPause':this['faxPause'],'openchannelPause':this['openchannelPause'],'chatStatus':this[_0x995a('0xe')],'chatStatusTime':this[_0x995a('0x10')],'chatCapacity':this[_0x995a('0x11')],'chatCurrentCapacity':this[_0x995a('0x12')],'mailStatus':this[_0x995a('0x3a')],'mailStatusTime':this[_0x995a('0x13')],'mailCapacity':this[_0x995a('0x14')],'mailCurrentCapacity':this[_0x995a('0x15')],'faxStatus':this[_0x995a('0x16')],'faxStatusTime':this[_0x995a('0x17')],'faxCapacity':this[_0x995a('0x18')],'faxCurrentCapacity':this['faxCurrentCapacity'],'smsStatus':this[_0x995a('0x1a')],'smsStatusTime':this[_0x995a('0x1b')],'smsCapacity':this[_0x995a('0x1c')],'smsCurrentCapacity':this[_0x995a('0x1d')],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this['whatsappStatusTime'],'whatsappCapacity':this[_0x995a('0x1f')],'whatsappCurrentCapacity':this[_0x995a('0x20')],'openchannelStatus':this[_0x995a('0x21')],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this[_0x995a('0x23')],'openchannelCurrentCapacity':this[_0x995a('0x24')],'busy':this[_0x995a('0x25')],'busyQueue':this[_0x995a('0x26')]};var _0x5c633f=md5(JSON[_0x995a('0x3b')](_0x3c73b5));if(this[_0x995a('0x0')]!==_0x5c633f){this[_0x995a('0x0')]=_0x5c633f;io['emit'](_0x995a('0x3c'),_0x3c73b5);}};module['exports']=Agent; \ No newline at end of file +var _0x23a2=['openchannelCurrentCapacity','busy','busyQueue','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','idle','openchannel','fax','sms','whatsapp','length','Status','StatusTime','format','chatStatusTime','mailStatusTime','openchannelStatus','openchannelStatusTime','emit','user:save','exports','lodash','md5','ioredis','../../../config/environment','redis','socket.io-emitter','name','online','voicePause','chatPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatCapacity','chatCurrentCapacity','mailStatus','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelCapacity'];(function(_0xc0f3d0,_0x4cfe98){var _0x1798ba=function(_0xa3446d){while(--_0xa3446d){_0xc0f3d0['push'](_0xc0f3d0['shift']());}};_0x1798ba(++_0x4cfe98);}(_0x23a2,0xcb));var _0x223a=function(_0x1508af,_0x1a2d9d){_0x1508af=_0x1508af-0x0;var _0xfe50d8=_0x23a2[_0x1508af];return _0xfe50d8;};'use strict';var _=require(_0x223a('0x0'));var moment=require('moment');var md5=require(_0x223a('0x1'));var Redis=require(_0x223a('0x2'));var config=require(_0x223a('0x3'));config['redis']=_['defaults'](config[_0x223a('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x223a('0x5'))(new Redis(config[_0x223a('0x4')]));function Agent(_0x23ce93){this['id']=_0x23ce93['id']||0x0;this['name']=_0x23ce93[_0x223a('0x6')]||'';this[_0x223a('0x7')]=_0x23ce93[_0x223a('0x7')]||!![];this[_0x223a('0x8')]=_0x23ce93[_0x223a('0x8')]||![];this[_0x223a('0x9')]=_0x23ce93[_0x223a('0x9')]||![];this['mailPause']=_0x23ce93['mailPause']||![];this[_0x223a('0xa')]=_0x23ce93['faxPause']||![];this['smsPause']=_0x23ce93[_0x223a('0xb')]||![];this[_0x223a('0xc')]=_0x23ce93[_0x223a('0xc')]||![];this[_0x223a('0xd')]=_0x223a('0xe');this['chatStatusTime']=0x0;this[_0x223a('0xf')]=_0x23ce93[_0x223a('0xf')]||0x0;this[_0x223a('0x10')]=0x0;this[_0x223a('0x11')]=_0x223a('0xe');this['mailStatusTime']=0x0;this[_0x223a('0x12')]=_0x23ce93[_0x223a('0x12')]||0x0;this[_0x223a('0x13')]=0x0;this[_0x223a('0x14')]=_0x223a('0xe');this[_0x223a('0x15')]=0x0;this[_0x223a('0x16')]=_0x23ce93['faxCapacity']||0x0;this[_0x223a('0x17')]=0x0;this[_0x223a('0x18')]='unknown';this[_0x223a('0x19')]=0x0;this[_0x223a('0x1a')]=_0x23ce93[_0x223a('0x1a')]||0x0;this[_0x223a('0x1b')]=0x0;this[_0x223a('0x1c')]='unknown';this[_0x223a('0x1d')]=0x0;this['whatsappCapacity']=_0x23ce93[_0x223a('0x1e')]||0x0;this[_0x223a('0x1f')]=0x0;this['openchannelStatus']='unknown';this['openchannelStatusTime']=0x0;this[_0x223a('0x20')]=_0x23ce93[_0x223a('0x20')]||0x0;this[_0x223a('0x21')]=0x0;this[_0x223a('0x22')]=![];this[_0x223a('0x23')]=undefined;this[_0x223a('0x1')]='';this[_0x223a('0x24')]();}Agent[_0x223a('0x25')][_0x223a('0x26')]=function(_0x1ee498){if(this[_0x1ee498+_0x223a('0x27')]>0x0){if(this[_0x1ee498+_0x223a('0x28')]>0x0&&this[_0x1ee498+'CurrentCapacity']>=this[_0x1ee498+_0x223a('0x28')]){return _0x223a('0x29');}else{return _0x223a('0x2a');}}else{return _0x223a('0x2b');}};Agent[_0x223a('0x25')][_0x223a('0x24')]=function(){var _0x1e5e92=['mail','chat',_0x223a('0x2c'),_0x223a('0x2d'),_0x223a('0x2e'),_0x223a('0x2f')];for(var _0x3545e6=0x0;_0x3545e6<_0x1e5e92[_0x223a('0x30')];_0x3545e6+=0x1){var _0x42bbf5=this[_0x223a('0x26')](_0x1e5e92[_0x3545e6]);if(this[_0x1e5e92[_0x3545e6]+_0x223a('0x31')]!==_0x42bbf5){this[_0x1e5e92[_0x3545e6]+_0x223a('0x32')]=_['toNumber'](moment()[_0x223a('0x33')]('x'));}this[_0x1e5e92[_0x3545e6]+_0x223a('0x31')]=_0x42bbf5;}var _0x140114={'id':this['id'],'name':this[_0x223a('0x6')],'online':this[_0x223a('0x7')],'voicePause':this[_0x223a('0x8')],'chatPause':this['chatPause'],'mailPause':this['mailPause'],'smsPause':this[_0x223a('0xb')],'faxPause':this[_0x223a('0xa')],'openchannelPause':this[_0x223a('0xc')],'chatStatus':this['chatStatus'],'chatStatusTime':this[_0x223a('0x34')],'chatCapacity':this[_0x223a('0xf')],'chatCurrentCapacity':this[_0x223a('0x10')],'mailStatus':this[_0x223a('0x11')],'mailStatusTime':this[_0x223a('0x35')],'mailCapacity':this[_0x223a('0x12')],'mailCurrentCapacity':this[_0x223a('0x13')],'faxStatus':this[_0x223a('0x14')],'faxStatusTime':this[_0x223a('0x15')],'faxCapacity':this[_0x223a('0x16')],'faxCurrentCapacity':this[_0x223a('0x17')],'smsStatus':this[_0x223a('0x18')],'smsStatusTime':this[_0x223a('0x19')],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this[_0x223a('0x1b')],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this[_0x223a('0x1d')],'whatsappCapacity':this[_0x223a('0x1e')],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this[_0x223a('0x36')],'openchannelStatusTime':this[_0x223a('0x37')],'openchannelCapacity':this[_0x223a('0x20')],'openchannelCurrentCapacity':this[_0x223a('0x21')],'busy':this[_0x223a('0x22')],'busyQueue':this[_0x223a('0x23')]};var _0x3b6291=md5(JSON['stringify'](_0x140114));if(this['md5']!==_0x3b6291){this[_0x223a('0x1')]=_0x3b6291;io[_0x223a('0x38')](_0x223a('0x39'),_0x140114);}};module[_0x223a('0x3a')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 0685c2d..ac84cdb 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 _0x11a1=['online','chatPause','available','format','chat:queue:%s','exports','md5','util','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRealtime','prototype','mapAgentsId','map','_rr','loggedIn','paused','length'];(function(_0x4d7a70,_0x2d3bfa){var _0x3aafbb=function(_0x43fbf2){while(--_0x43fbf2){_0x4d7a70['push'](_0x4d7a70['shift']());}};_0x3aafbb(++_0x2d3bfa);}(_0x11a1,0x180));var _0x111a=function(_0x2e200d,_0x7ad9aa){_0x2e200d=_0x2e200d-0x0;var _0x42d35f=_0x11a1[_0x2e200d];return _0x42d35f;};'use strict';var _=require('lodash');var md5=require(_0x111a('0x0'));var util=require(_0x111a('0x1'));var Redis=require(_0x111a('0x2'));var config=require(_0x111a('0x3'));config[_0x111a('0x4')]=_[_0x111a('0x5')](config[_0x111a('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x111a('0x6'))(new Redis(config[_0x111a('0x4')]));function ChatQueue(_0x3e7d8){this['id']=_0x3e7d8['id']||0x0;this[_0x111a('0x7')]=_0x3e7d8['name']||'';this[_0x111a('0x8')]=_0x3e7d8[_0x111a('0x8')]||0xa;this[_0x111a('0x9')]=_0x3e7d8[_0x111a('0x9')]||_0x111a('0xa');this[_0x111a('0xb')]=_0x3e7d8['Agents'];this['mapAgentsId']={};this[_0x111a('0xc')]=0x0;this[_0x111a('0x0')]='';this['updateRouting']();this[_0x111a('0xd')]();}ChatQueue[_0x111a('0xe')]['updateRouting']=function(){var _0x222d50=this[_0x111a('0xf')]['_rr'];this['mapAgentsId']=_[_0x111a('0x10')](this[_0x111a('0xb')],'id');this[_0x111a('0xf')][_0x111a('0x11')]=_0x222d50;};ChatQueue[_0x111a('0xe')][_0x111a('0xd')]=function(){this[_0x111a('0x12')]=0x0;this[_0x111a('0x13')]=0x0;for(var _0x5b88fe=0x0;_0x5b88fe=0x0?this[_0x111a('0x17')]:0x0;var _0x59b8e8={'id':this['id'],'available':this[_0x111a('0x17')],'loggedIn':this[_0x111a('0x12')],'name':this[_0x111a('0x7')],'paused':this['paused'],'waiting':this[_0x111a('0xc')]};var _0x3cb04d=md5(JSON['stringify'](_0x59b8e8));if(this[_0x111a('0x0')]!==_0x3cb04d){this[_0x111a('0x0')]=_0x3cb04d;io['to'](util[_0x111a('0x18')](_0x111a('0x19'),_0x59b8e8[_0x111a('0x7')]))['emit']('chat_queue:save',_0x59b8e8);}};module[_0x111a('0x1a')]=ChatQueue; \ No newline at end of file +var _0x1e99=['updateRouting','updateRealtime','_rr','map','prototype','paused','length','online','loggedIn','chatPause','available','chat:queue:%s','emit','chat_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting'];(function(_0x12a554,_0x3d7ef8){var _0x244ba0=function(_0x5eb5ff){while(--_0x5eb5ff){_0x12a554['push'](_0x12a554['shift']());}};_0x244ba0(++_0x3d7ef8);}(_0x1e99,0xaa));var _0x91e9=function(_0x389967,_0xe8c5ed){_0x389967=_0x389967-0x0;var _0xa24a4a=_0x1e99[_0x389967];return _0xa24a4a;};'use strict';var _=require(_0x91e9('0x0'));var md5=require(_0x91e9('0x1'));var util=require(_0x91e9('0x2'));var Redis=require(_0x91e9('0x3'));var config=require(_0x91e9('0x4'));config[_0x91e9('0x5')]=_[_0x91e9('0x6')](config[_0x91e9('0x5')],{'host':_0x91e9('0x7'),'port':0x18eb});var io=require(_0x91e9('0x8'))(new Redis(config[_0x91e9('0x5')]));function ChatQueue(_0x25d1d8){this['id']=_0x25d1d8['id']||0x0;this[_0x91e9('0x9')]=_0x25d1d8[_0x91e9('0x9')]||'';this['timeout']=_0x25d1d8[_0x91e9('0xa')]||0xa;this['strategy']=_0x25d1d8[_0x91e9('0xb')]||_0x91e9('0xc');this[_0x91e9('0xd')]=_0x25d1d8[_0x91e9('0xd')];this[_0x91e9('0xe')]={};this[_0x91e9('0xf')]=0x0;this[_0x91e9('0x1')]='';this[_0x91e9('0x10')]();this[_0x91e9('0x11')]();}ChatQueue['prototype']['updateRouting']=function(){var _0x4b01b6=this[_0x91e9('0xe')][_0x91e9('0x12')];this[_0x91e9('0xe')]=_[_0x91e9('0x13')](this['Agents'],'id');this[_0x91e9('0xe')][_0x91e9('0x12')]=_0x4b01b6;};ChatQueue[_0x91e9('0x14')]['updateRealtime']=function(){this['loggedIn']=0x0;this[_0x91e9('0x15')]=0x0;for(var _0x2259c8=0x0;_0x2259c8=0x0?this[_0x91e9('0x1a')]:0x0;var _0x2b54ec={'id':this['id'],'available':this[_0x91e9('0x1a')],'loggedIn':this[_0x91e9('0x18')],'name':this['name'],'paused':this[_0x91e9('0x15')],'waiting':this['waiting']};var _0x24d7a1=md5(JSON['stringify'](_0x2b54ec));if(this[_0x91e9('0x1')]!==_0x24d7a1){this['md5']=_0x24d7a1;io['to'](util['format'](_0x91e9('0x1b'),_0x2b54ec[_0x91e9('0x9')]))[_0x91e9('0x1c')](_0x91e9('0x1d'),_0x2b54ec);}};module[_0x91e9('0x1e')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 8a0537d..d870523 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 _0x503e=['timeout','strategy','beepall','Agents','mapAgentsId','waiting','prototype','map','_rr','updateRealtime','loggedIn','paused','length','online','available','stringify','format','fax:queue:%s','emit','fax_queue:save','exports','lodash','md5','util','defaults','redis','localhost','socket.io-emitter','name'];(function(_0x22491d,_0x3bad40){var _0x431173=function(_0x4fba3f){while(--_0x4fba3f){_0x22491d['push'](_0x22491d['shift']());}};_0x431173(++_0x3bad40);}(_0x503e,0x1e5));var _0xe503=function(_0x1beef3,_0x57c4b8){_0x1beef3=_0x1beef3-0x0;var _0x5af964=_0x503e[_0x1beef3];return _0x5af964;};'use strict';var _=require(_0xe503('0x0'));var md5=require(_0xe503('0x1'));var util=require(_0xe503('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config['redis']=_[_0xe503('0x3')](config[_0xe503('0x4')],{'host':_0xe503('0x5'),'port':0x18eb});var io=require(_0xe503('0x6'))(new Redis(config[_0xe503('0x4')]));function FaxQueue(_0x2e38c0){this['id']=_0x2e38c0['id']||0x0;this['name']=_0x2e38c0[_0xe503('0x7')]||'';this[_0xe503('0x8')]=_0x2e38c0[_0xe503('0x8')]||0xa;this[_0xe503('0x9')]=_0x2e38c0[_0xe503('0x9')]||_0xe503('0xa');this[_0xe503('0xb')]=_0x2e38c0[_0xe503('0xb')];this[_0xe503('0xc')]={};this[_0xe503('0xd')]=0x0;this[_0xe503('0x1')]='';this['updateRouting']();this['updateRealtime']();}FaxQueue[_0xe503('0xe')]['updateRouting']=function(){var _0x3afecd=this[_0xe503('0xc')]['_rr'];this[_0xe503('0xc')]=_[_0xe503('0xf')](this[_0xe503('0xb')],'id');this[_0xe503('0xc')][_0xe503('0x10')]=_0x3afecd;};FaxQueue[_0xe503('0xe')][_0xe503('0x11')]=function(){this[_0xe503('0x12')]=0x0;this[_0xe503('0x13')]=0x0;for(var _0x15aecb=0x0;_0x15aecb=0x0?this[_0xe503('0x16')]:0x0;var _0x56e203={'id':this['id'],'available':this[_0xe503('0x16')],'loggedIn':this[_0xe503('0x12')],'name':this[_0xe503('0x7')],'paused':this[_0xe503('0x13')],'waiting':this['waiting']};var _0x76a2d5=md5(JSON[_0xe503('0x17')](_0x56e203));if(this[_0xe503('0x1')]!==_0x76a2d5){this[_0xe503('0x1')]=_0x76a2d5;io['to'](util[_0xe503('0x18')](_0xe503('0x19'),_0x56e203['name']))[_0xe503('0x1a')](_0xe503('0x1b'),_0x56e203);}};module[_0xe503('0x1c')]=FaxQueue; \ No newline at end of file +var _0x171f=['redis','defaults','localhost','name','timeout','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','loggedIn','length','online','faxPause','paused','available','fax:queue:%s','emit','fax_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment'];(function(_0x28d1cd,_0x192371){var _0xdcb892=function(_0x145f6e){while(--_0x145f6e){_0x28d1cd['push'](_0x28d1cd['shift']());}};_0xdcb892(++_0x192371);}(_0x171f,0xb8));var _0xf171=function(_0x5a6de2,_0x5c8b10){_0x5a6de2=_0x5a6de2-0x0;var _0x2c0525=_0x171f[_0x5a6de2];return _0x2c0525;};'use strict';var _=require(_0xf171('0x0'));var md5=require(_0xf171('0x1'));var util=require(_0xf171('0x2'));var Redis=require(_0xf171('0x3'));var config=require(_0xf171('0x4'));config[_0xf171('0x5')]=_[_0xf171('0x6')](config[_0xf171('0x5')],{'host':_0xf171('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xf171('0x5')]));function FaxQueue(_0x1f37d7){this['id']=_0x1f37d7['id']||0x0;this[_0xf171('0x8')]=_0x1f37d7[_0xf171('0x8')]||'';this[_0xf171('0x9')]=_0x1f37d7[_0xf171('0x9')]||0xa;this['strategy']=_0x1f37d7['strategy']||'beepall';this[_0xf171('0xa')]=_0x1f37d7[_0xf171('0xa')];this[_0xf171('0xb')]={};this[_0xf171('0xc')]=0x0;this[_0xf171('0x1')]='';this[_0xf171('0xd')]();this[_0xf171('0xe')]();}FaxQueue[_0xf171('0xf')]['updateRouting']=function(){var _0xc3324=this[_0xf171('0xb')][_0xf171('0x10')];this[_0xf171('0xb')]=_['map'](this[_0xf171('0xa')],'id');this[_0xf171('0xb')]['_rr']=_0xc3324;};FaxQueue[_0xf171('0xf')][_0xf171('0xe')]=function(){this[_0xf171('0x11')]=0x0;this['paused']=0x0;for(var _0x294824=0x0;_0x294824=0x0?this[_0xf171('0x16')]:0x0;var _0x598aa4={'id':this['id'],'available':this['available'],'loggedIn':this[_0xf171('0x11')],'name':this['name'],'paused':this[_0xf171('0x15')],'waiting':this['waiting']};var _0x1d5832=md5(JSON['stringify'](_0x598aa4));if(this[_0xf171('0x1')]!==_0x1d5832){this[_0xf171('0x1')]=_0x1d5832;io['to'](util['format'](_0xf171('0x17'),_0x598aa4['name']))[_0xf171('0x18')](_0xf171('0x19'),_0x598aa4);}};module[_0xf171('0x1a')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index b6729ef..e65c6cb 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 _0x228a=['Intervals','name'];(function(_0x180649,_0x178829){var _0x53f90b=function(_0x18f201){while(--_0x18f201){_0x180649['push'](_0x180649['shift']());}};_0x53f90b(++_0x178829);}(_0x228a,0x14b));var _0xa228=function(_0x526afe,_0x5937c3){_0x526afe=_0x526afe-0x0;var _0x402df7=_0x228a[_0x526afe];return _0x402df7;};'use strict';function Interval(_0x41fab7){this['id']=_0x41fab7['id']||0x0;this['name']=_0x41fab7[_0xa228('0x0')]||'';this['Intervals']=_0x41fab7[_0xa228('0x1')]||{};}module['exports']=Interval; \ No newline at end of file +var _0xbaa8=['name','Intervals','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xbaa8,0x7e));var _0x8baa=function(_0xa2cd73,_0xb33f91){_0xa2cd73=_0xa2cd73-0x0;var _0x5b1db0=_0xbaa8[_0xa2cd73];return _0x5b1db0;};'use strict';function Interval(_0x44eac0){this['id']=_0x44eac0['id']||0x0;this[_0x8baa('0x0')]=_0x44eac0[_0x8baa('0x0')]||'';this[_0x8baa('0x1')]=_0x44eac0['Intervals']||{};}module[_0x8baa('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 3ab5070..636fd4e 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 _0x97f6=['waiting','stringify','format','mail:queue:%s','emit','mail_queue:save','exports','lodash','util','ioredis','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','md5','updateRealtime','prototype','updateRouting','mapAgentsId','_rr','map','loggedIn','paused','online','mailPause','available'];(function(_0x390b72,_0x2cef44){var _0x3574b9=function(_0xa11e0d){while(--_0xa11e0d){_0x390b72['push'](_0x390b72['shift']());}};_0x3574b9(++_0x2cef44);}(_0x97f6,0xa2));var _0x697f=function(_0x1fb6d6,_0xf6860f){_0x1fb6d6=_0x1fb6d6-0x0;var _0xc865e8=_0x97f6[_0x1fb6d6];return _0xc865e8;};'use strict';var _=require(_0x697f('0x0'));var md5=require('md5');var util=require(_0x697f('0x1'));var Redis=require(_0x697f('0x2'));var config=require('../../../config/environment');config[_0x697f('0x3')]=_[_0x697f('0x4')](config[_0x697f('0x3')],{'host':_0x697f('0x5'),'port':0x18eb});var io=require(_0x697f('0x6'))(new Redis(config[_0x697f('0x3')]));function MailQueue(_0x277e18){this['id']=_0x277e18['id']||0x0;this[_0x697f('0x7')]=_0x277e18[_0x697f('0x7')]||'';this[_0x697f('0x8')]=_0x277e18['timeout']||0xa;this[_0x697f('0x9')]=_0x277e18['strategy']||_0x697f('0xa');this['Agents']=_0x277e18[_0x697f('0xb')];this['mapAgentsId']={};this['waiting']=0x0;this[_0x697f('0xc')]='';this['updateRouting']();this[_0x697f('0xd')]();}MailQueue[_0x697f('0xe')][_0x697f('0xf')]=function(){var _0x321495=this[_0x697f('0x10')][_0x697f('0x11')];this[_0x697f('0x10')]=_[_0x697f('0x12')](this[_0x697f('0xb')],'id');this[_0x697f('0x10')][_0x697f('0x11')]=_0x321495;};MailQueue[_0x697f('0xe')][_0x697f('0xd')]=function(){this[_0x697f('0x13')]=0x0;this[_0x697f('0x14')]=0x0;for(var _0x4cb4a1=0x0;_0x4cb4a1=0x0?this[_0x697f('0x17')]:0x0;var _0x327eb8={'id':this['id'],'available':this[_0x697f('0x17')],'loggedIn':this[_0x697f('0x13')],'name':this[_0x697f('0x7')],'paused':this[_0x697f('0x14')],'waiting':this[_0x697f('0x18')]};var _0x58bb5e=md5(JSON[_0x697f('0x19')](_0x327eb8));if(this[_0x697f('0xc')]!==_0x58bb5e){this['md5']=_0x58bb5e;io['to'](util[_0x697f('0x1a')](_0x697f('0x1b'),_0x327eb8[_0x697f('0x7')]))[_0x697f('0x1c')](_0x697f('0x1d'),_0x327eb8);}};module[_0x697f('0x1e')]=MailQueue; \ No newline at end of file +var _0x3148=['paused','length','online','mailPause','available','stringify','emit','exports','lodash','md5','util','ioredis','../../../config/environment','defaults','redis','localhost','name','timeout','strategy','Agents','waiting','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','map','loggedIn'];(function(_0x5b21b2,_0x4fc5e7){var _0x5b8602=function(_0x17ab14){while(--_0x17ab14){_0x5b21b2['push'](_0x5b21b2['shift']());}};_0x5b8602(++_0x4fc5e7);}(_0x3148,0xb0));var _0x8314=function(_0x507af7,_0x5cfb83){_0x507af7=_0x507af7-0x0;var _0x496d57=_0x3148[_0x507af7];return _0x496d57;};'use strict';var _=require(_0x8314('0x0'));var md5=require(_0x8314('0x1'));var util=require(_0x8314('0x2'));var Redis=require(_0x8314('0x3'));var config=require(_0x8314('0x4'));config['redis']=_[_0x8314('0x5')](config[_0x8314('0x6')],{'host':_0x8314('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x8314('0x6')]));function MailQueue(_0x15389f){this['id']=_0x15389f['id']||0x0;this[_0x8314('0x8')]=_0x15389f['name']||'';this[_0x8314('0x9')]=_0x15389f['timeout']||0xa;this[_0x8314('0xa')]=_0x15389f[_0x8314('0xa')]||'beepall';this[_0x8314('0xb')]=_0x15389f[_0x8314('0xb')];this['mapAgentsId']={};this[_0x8314('0xc')]=0x0;this['md5']='';this[_0x8314('0xd')]();this[_0x8314('0xe')]();}MailQueue[_0x8314('0xf')][_0x8314('0xd')]=function(){var _0x53d0bb=this[_0x8314('0x10')][_0x8314('0x11')];this[_0x8314('0x10')]=_[_0x8314('0x12')](this[_0x8314('0xb')],'id');this[_0x8314('0x10')][_0x8314('0x11')]=_0x53d0bb;};MailQueue[_0x8314('0xf')]['updateRealtime']=function(){this[_0x8314('0x13')]=0x0;this[_0x8314('0x14')]=0x0;for(var _0x4446a9=0x0;_0x4446a9=0x0?this[_0x8314('0x18')]:0x0;var _0x47c9c3={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0x8314('0x8')],'paused':this['paused'],'waiting':this[_0x8314('0xc')]};var _0x381beb=md5(JSON[_0x8314('0x19')](_0x47c9c3));if(this[_0x8314('0x1')]!==_0x381beb){this['md5']=_0x381beb;io['to'](util['format']('mail:queue:%s',_0x47c9c3['name']))[_0x8314('0x1a')]('mail_queue:save',_0x47c9c3);}};module[_0x8314('0x1b')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 9232d86..01d92b3 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 _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(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0xc4aa[_0x3511d3];return _0x5d6321;};'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 +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(_0x32b542,_0x4512fa){var _0x554d54=function(_0x35cdfc){while(--_0x35cdfc){_0x32b542['push'](_0x32b542['shift']());}};_0x554d54(++_0x4512fa);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0xc4aa[_0x1caf6a];return _0x1bf493;};'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 63d44e8..a482b52 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 _0x85b5=['paused','length','available','stringify','sms:queue:%s','sms_queue:save','exports','lodash','md5','ioredis','redis','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','loggedIn'];(function(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0x85b5,0x7f));var _0x585b=function(_0x3ce40c,_0x28e2be){_0x3ce40c=_0x3ce40c-0x0;var _0x4526ac=_0x85b5[_0x3ce40c];return _0x4526ac;};'use strict';var _=require(_0x585b('0x0'));var md5=require(_0x585b('0x1'));var util=require('util');var Redis=require(_0x585b('0x2'));var config=require('../../../config/environment');config[_0x585b('0x3')]=_['defaults'](config['redis'],{'host':_0x585b('0x4'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x585b('0x3')]));function SmsQueue(_0x26ccfb){this['id']=_0x26ccfb['id']||0x0;this[_0x585b('0x5')]=_0x26ccfb['name']||'';this[_0x585b('0x6')]=_0x26ccfb['timeout']||0xa;this[_0x585b('0x7')]=_0x26ccfb[_0x585b('0x7')]||_0x585b('0x8');this[_0x585b('0x9')]=_0x26ccfb['Agents'];this[_0x585b('0xa')]={};this[_0x585b('0xb')]=0x0;this[_0x585b('0x1')]='';this[_0x585b('0xc')]();this[_0x585b('0xd')]();}SmsQueue[_0x585b('0xe')][_0x585b('0xc')]=function(){var _0x5dda1f=this[_0x585b('0xa')]['_rr'];this[_0x585b('0xa')]=_['map'](this[_0x585b('0x9')],'id');this[_0x585b('0xa')][_0x585b('0xf')]=_0x5dda1f;};SmsQueue['prototype'][_0x585b('0xd')]=function(){this[_0x585b('0x10')]=0x0;this[_0x585b('0x11')]=0x0;for(var _0x299ee4=0x0;_0x299ee4=0x0?this[_0x585b('0x13')]:0x0;var _0x510921={'id':this['id'],'available':this[_0x585b('0x13')],'loggedIn':this[_0x585b('0x10')],'name':this[_0x585b('0x5')],'paused':this[_0x585b('0x11')],'waiting':this['waiting']};var _0xec725d=md5(JSON[_0x585b('0x14')](_0x510921));if(this[_0x585b('0x1')]!==_0xec725d){this['md5']=_0xec725d;io['to'](util['format'](_0x585b('0x15'),_0x510921['name']))['emit'](_0x585b('0x16'),_0x510921);}};module[_0x585b('0x17')]=SmsQueue; \ No newline at end of file +var _0xcabc=['map','prototype','paused','length','online','smsPause','available','loggedIn','format','sms_queue:save','exports','md5','util','ioredis','../../../config/environment','redis','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr'];(function(_0x1bfca0,_0x19b167){var _0xa8b88e=function(_0x922b98){while(--_0x922b98){_0x1bfca0['push'](_0x1bfca0['shift']());}};_0xa8b88e(++_0x19b167);}(_0xcabc,0x16a));var _0xccab=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xcabc[_0x2641f9];return _0x585741;};'use strict';var _=require('lodash');var md5=require(_0xccab('0x0'));var util=require(_0xccab('0x1'));var Redis=require(_0xccab('0x2'));var config=require(_0xccab('0x3'));config[_0xccab('0x4')]=_['defaults'](config[_0xccab('0x4')],{'host':_0xccab('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xccab('0x4')]));function SmsQueue(_0x316f83){this['id']=_0x316f83['id']||0x0;this[_0xccab('0x6')]=_0x316f83['name']||'';this[_0xccab('0x7')]=_0x316f83[_0xccab('0x7')]||0xa;this[_0xccab('0x8')]=_0x316f83['strategy']||_0xccab('0x9');this[_0xccab('0xa')]=_0x316f83['Agents'];this[_0xccab('0xb')]={};this[_0xccab('0xc')]=0x0;this[_0xccab('0x0')]='';this[_0xccab('0xd')]();this[_0xccab('0xe')]();}SmsQueue['prototype']['updateRouting']=function(){var _0x17b729=this[_0xccab('0xb')][_0xccab('0xf')];this[_0xccab('0xb')]=_[_0xccab('0x10')](this[_0xccab('0xa')],'id');this[_0xccab('0xb')]['_rr']=_0x17b729;};SmsQueue[_0xccab('0x11')][_0xccab('0xe')]=function(){this['loggedIn']=0x0;this[_0xccab('0x12')]=0x0;for(var _0x4f0643=0x0;_0x4f0643=0x0?this['available']:0x0;var _0x4ba1c2={'id':this['id'],'available':this[_0xccab('0x16')],'loggedIn':this['loggedIn'],'name':this[_0xccab('0x6')],'paused':this[_0xccab('0x12')],'waiting':this[_0xccab('0xc')]};var _0x4ab126=md5(JSON['stringify'](_0x4ba1c2));if(this[_0xccab('0x0')]!==_0x4ab126){this[_0xccab('0x0')]=_0x4ab126;io['to'](util[_0xccab('0x18')]('sms:queue:%s',_0x4ba1c2[_0xccab('0x6')]))['emit'](_0xccab('0x19'),_0x4ba1c2);}};module[_0xccab('0x1a')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 4db34ae..c40b0c9 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 _0xcab6=['updateRealtime','prototype','_rr','map','paused','length','online','loggedIn','available','waiting','stringify','format','emit','whatsapp_queue:save','exports','lodash','md5','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting'];(function(_0x277563,_0x566184){var _0xc114d5=function(_0x58ae70){while(--_0x58ae70){_0x277563['push'](_0x277563['shift']());}};_0xc114d5(++_0x566184);}(_0xcab6,0xe7));var _0x6cab=function(_0x2ac1b6,_0x19a542){_0x2ac1b6=_0x2ac1b6-0x0;var _0x278b3a=_0xcab6[_0x2ac1b6];return _0x278b3a;};'use strict';var _=require(_0x6cab('0x0'));var md5=require(_0x6cab('0x1'));var util=require('util');var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x6cab('0x2')]=_[_0x6cab('0x3')](config[_0x6cab('0x2')],{'host':'localhost','port':0x18eb});var io=require(_0x6cab('0x4'))(new Redis(config[_0x6cab('0x2')]));function WhatsappQueue(_0x2ed049){this['id']=_0x2ed049['id']||0x0;this[_0x6cab('0x5')]=_0x2ed049[_0x6cab('0x5')]||'';this[_0x6cab('0x6')]=_0x2ed049[_0x6cab('0x6')]||0xa;this[_0x6cab('0x7')]=_0x2ed049[_0x6cab('0x7')]||_0x6cab('0x8');this[_0x6cab('0x9')]=_0x2ed049['Agents'];this[_0x6cab('0xa')]={};this['waiting']=0x0;this[_0x6cab('0x1')]='';this[_0x6cab('0xb')]();this[_0x6cab('0xc')]();}WhatsappQueue[_0x6cab('0xd')]['updateRouting']=function(){var _0x4d66ad=this[_0x6cab('0xa')][_0x6cab('0xe')];this[_0x6cab('0xa')]=_[_0x6cab('0xf')](this[_0x6cab('0x9')],'id');this[_0x6cab('0xa')]['_rr']=_0x4d66ad;};WhatsappQueue[_0x6cab('0xd')][_0x6cab('0xc')]=function(){this['loggedIn']=0x0;this[_0x6cab('0x10')]=0x0;for(var _0xe4642=0x0;_0xe4642=0x0?this['available']:0x0;var _0x35cc44={'id':this['id'],'available':this[_0x6cab('0x14')],'loggedIn':this[_0x6cab('0x13')],'name':this['name'],'paused':this[_0x6cab('0x10')],'waiting':this[_0x6cab('0x15')]};var _0x1cc1f6=md5(JSON[_0x6cab('0x16')](_0x35cc44));if(this['md5']!==_0x1cc1f6){this[_0x6cab('0x1')]=_0x1cc1f6;io['to'](util[_0x6cab('0x17')]('whatsapp:queue:%s',_0x35cc44['name']))[_0x6cab('0x18')](_0x6cab('0x19'),_0x35cc44);}};module[_0x6cab('0x1a')]=WhatsappQueue; \ No newline at end of file +var _0xfe21=['whatsapp:queue:%s','emit','whatsapp_queue:save','md5','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','loggedIn','paused','length','online','whatsappPause','available','format'];(function(_0x53d71c,_0x1a3859){var _0x555efb=function(_0x32ef67){while(--_0x32ef67){_0x53d71c['push'](_0x53d71c['shift']());}};_0x555efb(++_0x1a3859);}(_0xfe21,0x1bd));var _0x1fe2=function(_0x3fd5e9,_0x1baba4){_0x3fd5e9=_0x3fd5e9-0x0;var _0x408fed=_0xfe21[_0x3fd5e9];return _0x408fed;};'use strict';var _=require('lodash');var md5=require(_0x1fe2('0x0'));var util=require('util');var Redis=require(_0x1fe2('0x1'));var config=require(_0x1fe2('0x2'));config[_0x1fe2('0x3')]=_['defaults'](config[_0x1fe2('0x3')],{'host':_0x1fe2('0x4'),'port':0x18eb});var io=require(_0x1fe2('0x5'))(new Redis(config[_0x1fe2('0x3')]));function WhatsappQueue(_0x49ecde){this['id']=_0x49ecde['id']||0x0;this[_0x1fe2('0x6')]=_0x49ecde[_0x1fe2('0x6')]||'';this[_0x1fe2('0x7')]=_0x49ecde[_0x1fe2('0x7')]||0xa;this['strategy']=_0x49ecde['strategy']||_0x1fe2('0x8');this[_0x1fe2('0x9')]=_0x49ecde[_0x1fe2('0x9')];this[_0x1fe2('0xa')]={};this[_0x1fe2('0xb')]=0x0;this['md5']='';this[_0x1fe2('0xc')]();this[_0x1fe2('0xd')]();}WhatsappQueue[_0x1fe2('0xe')]['updateRouting']=function(){var _0x5d603c=this['mapAgentsId'][_0x1fe2('0xf')];this[_0x1fe2('0xa')]=_['map'](this[_0x1fe2('0x9')],'id');this[_0x1fe2('0xa')]['_rr']=_0x5d603c;};WhatsappQueue['prototype'][_0x1fe2('0xd')]=function(){this[_0x1fe2('0x10')]=0x0;this[_0x1fe2('0x11')]=0x0;for(var _0x1f804e=0x0;_0x1f804e=0x0?this[_0x1fe2('0x15')]:0x0;var _0xfdc504={'id':this['id'],'available':this[_0x1fe2('0x15')],'loggedIn':this[_0x1fe2('0x10')],'name':this[_0x1fe2('0x6')],'paused':this['paused'],'waiting':this['waiting']};var _0x190e37=md5(JSON['stringify'](_0xfdc504));if(this['md5']!==_0x190e37){this['md5']=_0x190e37;io['to'](util[_0x1fe2('0x16')](_0x1fe2('0x17'),_0xfdc504[_0x1fe2('0x6')]))[_0x1fe2('0x18')](_0x1fe2('0x19'),_0xfdc504);}};module['exports']=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 28d7719..75f57aa 100644 --- a/server/services/routing/realtime/index.js +++ b/server/services/routing/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','isUndefined','initIntervals','length','initOpenchannelQueues','updateRealtime','initChatQueues','chatQueues','initSmsQueues','updateRouting','initMailQueues','initFaxQueues','initWhatsappQueues','exports','bluebird','lodash','moment','../model/agent','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','smsQueues','mailQueues'];(function(_0x160c6e,_0x5ccb8e){var _0x5a8805=function(_0x4efefa){while(--_0x4efefa){_0x160c6e['push'](_0x160c6e['shift']());}};_0x5a8805(++_0x5ccb8e);}(_0xb10b,0x12a));var _0xbb10=function(_0x265c81,_0x4d539a){_0x265c81=_0x265c81-0x0;var _0x3e63d1=_0xb10b[_0x265c81];return _0x3e63d1;};'use strict';var BPromise=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var moment=require(_0xbb10('0x2'));var Agent=require(_0xbb10('0x3'));var Interval=require('../model/interval');var OpenchannelQueue=require(_0xbb10('0x4'));var ChatQueue=require(_0xbb10('0x5'));var SmsQueue=require(_0xbb10('0x6'));var MailQueue=require(_0xbb10('0x7'));var FaxQueue=require(_0xbb10('0x8'));var WhatsappQueue=require(_0xbb10('0x9'));var Realtime=function(){this['agents']={};this[_0xbb10('0xa')]={};this[_0xbb10('0xb')]={};this['chatQueues']={};this[_0xbb10('0xc')]={};this[_0xbb10('0xd')]={};this[_0xbb10('0xe')]={};this[_0xbb10('0xf')]={};this[_0xbb10('0x10')]={};this[_0xbb10('0x11')]={};this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['faxQueuesWaitingInteractions']={};this['whatsappQueuesWaitingInteractions']={};};function freeIsNotKey(_0x20bd61,_0x118a74,_0xce64f3){var _0x5e136d=_[_0xbb10('0x14')](_0x20bd61,function(_0x5be7e0,_0x44fb19){return _0x5be7e0[_0xce64f3];});for(var _0x916a32 in _0x118a74){if(_0x118a74[_0xbb10('0x15')](_0x916a32)){if(!_0x5e136d[_0x916a32]){delete _0x118a74[_0x916a32];}}}}Realtime[_0xbb10('0x16')][_0xbb10('0x17')]=function(_0x147230,_0x58a612){for(var _0x26e021 in _0x58a612){if(_0x147230[_0xbb10('0x15')](_0x26e021)){_0x147230[_0x26e021]=_0x58a612[_0x26e021];}}};Realtime[_0xbb10('0x16')][_0xbb10('0x18')]=function(){var _0x3df17b=this;return function(_0x2f2ebf){if(_0x2f2ebf){freeIsNotKey(_0x2f2ebf,_0x3df17b[_0xbb10('0x19')],'id');for(var _0x36b5e8=0x0,_0x3e26f4={},_0x2b184e={};_0x36b5e8<_0x2f2ebf['length'];_0x36b5e8+=0x1){_0x3e26f4=_0x2f2ebf[_0x36b5e8];if(_[_0xbb10('0x1a')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']])){_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']]=new Agent(_0x3e26f4);}else{_0x3df17b[_0xbb10('0x17')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']],_0x3e26f4);}}}return _0x3df17b[_0xbb10('0x19')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x1b')]=function(){var _0xbf2906=this;return function(_0xe1c665){if(_0xe1c665){freeIsNotKey(_0xe1c665,_0xbf2906['intervals'],'id');for(var _0x5ff0cf=0x0,_0x19f48d={},_0x388fab={};_0x5ff0cf<_0xe1c665[_0xbb10('0x1c')];_0x5ff0cf+=0x1){_0x19f48d=_0xe1c665[_0x5ff0cf];if(_[_0xbb10('0x1a')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']])){_0xbf2906['intervals'][_0x19f48d['id']]=new Interval(_0x19f48d);}else{_0xbf2906[_0xbb10('0x17')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']],_0x19f48d);}}}return _0xbf2906['intervals'];};};Realtime['prototype'][_0xbb10('0x1d')]=function(){var _0x311abe=this;return function(_0x2e911d){if(_0x2e911d){freeIsNotKey(_0x2e911d,_0x311abe[_0xbb10('0xb')],'id');for(var _0x445761=0x0,_0x1824b7={},_0x407cb4={};_0x445761<_0x2e911d[_0xbb10('0x1c')];_0x445761+=0x1){_0x1824b7=_0x2e911d[_0x445761];if(_[_0xbb10('0x1a')](_0x311abe[_0xbb10('0xb')][_0x1824b7['id']])){_0x311abe[_0xbb10('0xb')][_0x1824b7['id']]=new OpenchannelQueue(_0x1824b7);}else{_0x311abe[_0xbb10('0x17')](_0x311abe['openchannelQueues'][_0x1824b7['id']],_0x1824b7);}_0x311abe['openchannelQueues'][_0x1824b7['id']]['updateRouting']();_0x311abe[_0xbb10('0xb')][_0x1824b7['id']][_0xbb10('0x1e')]();}}return _0x311abe[_0xbb10('0xb')];};};Realtime['prototype'][_0xbb10('0x1f')]=function(){var _0x24d586=this;return function(_0x6ed43b){if(_0x6ed43b){freeIsNotKey(_0x6ed43b,_0x24d586[_0xbb10('0x20')],'id');for(var _0x1acce9=0x0,_0x20d946={},_0x2a0e8b={};_0x1acce9<_0x6ed43b['length'];_0x1acce9+=0x1){_0x20d946=_0x6ed43b[_0x1acce9];if(_[_0xbb10('0x1a')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']])){_0x24d586[_0xbb10('0x20')][_0x20d946['id']]=new ChatQueue(_0x20d946);}else{_0x24d586[_0xbb10('0x17')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']],_0x20d946);}_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRouting']();_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRealtime']();}}return _0x24d586[_0xbb10('0x20')];};};Realtime['prototype'][_0xbb10('0x21')]=function(){var _0x1dcc9c=this;return function(_0x1b59f9){if(_0x1b59f9){freeIsNotKey(_0x1b59f9,_0x1dcc9c['smsQueues'],'id');for(var _0x518d47=0x0,_0x4c3744={},_0x34f65e={};_0x518d47<_0x1b59f9['length'];_0x518d47+=0x1){_0x4c3744=_0x1b59f9[_0x518d47];if(_[_0xbb10('0x1a')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']])){_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']]=new SmsQueue(_0x4c3744);}else{_0x1dcc9c[_0xbb10('0x17')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']],_0x4c3744);}_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']][_0xbb10('0x22')]();_0x1dcc9c['smsQueues'][_0x4c3744['id']][_0xbb10('0x1e')]();}}return _0x1dcc9c[_0xbb10('0xc')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x23')]=function(){var _0xfb2c5e=this;return function(_0x9de708){if(_0x9de708){freeIsNotKey(_0x9de708,_0xfb2c5e[_0xbb10('0xd')],'id');for(var _0x10202c=0x0,_0x3c8d7d={},_0x56943c={};_0x10202c<_0x9de708[_0xbb10('0x1c')];_0x10202c+=0x1){_0x3c8d7d=_0x9de708[_0x10202c];if(_[_0xbb10('0x1a')](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']])){_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']]=new MailQueue(_0x3c8d7d);}else{_0xfb2c5e['mergeFromDatabase'](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']],_0x3c8d7d);}_0xfb2c5e['mailQueues'][_0x3c8d7d['id']]['updateRouting']();_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']][_0xbb10('0x1e')]();}}return _0xfb2c5e[_0xbb10('0xd')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x24')]=function(){var _0x29d11a=this;return function(_0x547062){if(_0x547062){freeIsNotKey(_0x547062,_0x29d11a[_0xbb10('0xe')],'id');for(var _0x25d72f=0x0,_0x52de31={},_0x5e3fbd={};_0x25d72f<_0x547062['length'];_0x25d72f+=0x1){_0x52de31=_0x547062[_0x25d72f];if(_[_0xbb10('0x1a')](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']])){_0x29d11a[_0xbb10('0xe')][_0x52de31['id']]=new FaxQueue(_0x52de31);}else{_0x29d11a['mergeFromDatabase'](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']],_0x52de31);}_0x29d11a[_0xbb10('0xe')][_0x52de31['id']][_0xbb10('0x22')]();_0x29d11a['faxQueues'][_0x52de31['id']][_0xbb10('0x1e')]();}}return _0x29d11a[_0xbb10('0xe')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x25')]=function(){var _0x4f1cdd=this;return function(_0xd238e9){if(_0xd238e9){freeIsNotKey(_0xd238e9,_0x4f1cdd[_0xbb10('0xf')],'id');for(var _0x5835fd=0x0,_0xe2040f={},_0x2e3214={};_0x5835fd<_0xd238e9[_0xbb10('0x1c')];_0x5835fd+=0x1){_0xe2040f=_0xd238e9[_0x5835fd];if(_[_0xbb10('0x1a')](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']])){_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]=new WhatsappQueue(_0xe2040f);}else{_0x4f1cdd['mergeFromDatabase'](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']],_0xe2040f);}_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']][_0xbb10('0x22')]();_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]['updateRealtime']();}}return _0x4f1cdd[_0xbb10('0xf')];};};module[_0xbb10('0x26')]=Realtime; \ No newline at end of file +var _0xb10b=['faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','isUndefined','initIntervals','length','initOpenchannelQueues','updateRealtime','initChatQueues','chatQueues','initSmsQueues','updateRouting','initMailQueues','initFaxQueues','initWhatsappQueues','exports','bluebird','lodash','moment','../model/agent','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','smsQueues','mailQueues'];(function(_0x1d1eac,_0x5208b4){var _0x40ad6e=function(_0x469d8c){while(--_0x469d8c){_0x1d1eac['push'](_0x1d1eac['shift']());}};_0x40ad6e(++_0x5208b4);}(_0xb10b,0x12a));var _0xbb10=function(_0x24502f,_0x134350){_0x24502f=_0x24502f-0x0;var _0x402fd9=_0xb10b[_0x24502f];return _0x402fd9;};'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 7be8660..6b84e1f 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 _0x91c7=['Request','UpdateChatInteraction','updateChatInteraction','addTags','AddTagsToChatInteraction','addTagsToChatInteraction','../client','update'];(function(_0x36f797,_0x351603){var _0x44ba30=function(_0x32eb10){while(--_0x32eb10){_0x36f797['push'](_0x36f797['shift']());}};_0x44ba30(++_0x351603);}(_0x91c7,0x96));var _0x791c=function(_0x3e6d5d,_0x264c7a){_0x3e6d5d=_0x3e6d5d-0x0;var _0x238923=_0x91c7[_0x3e6d5d];return _0x238923;};'use strict';var client=require(_0x791c('0x0'));exports[_0x791c('0x1')]=function(_0x22b2d7,_0x544d87){return client[_0x791c('0x2')](_0x791c('0x3'),{'body':_0x544d87,'options':{'where':{'id':_0x22b2d7}},'log':_0x791c('0x4')});};exports[_0x791c('0x5')]=function(_0x324831,_0x3f11e8){return client[_0x791c('0x2')](_0x791c('0x6'),{'body':_0x3f11e8,'options':{'where':{'id':_0x324831}},'log':_0x791c('0x7')});}; \ No newline at end of file +var _0x17da=['../client','update','Request','AddTagsToChatInteraction','addTagsToChatInteraction'];(function(_0x39e8f5,_0xb151a6){var _0x346526=function(_0xc00cf5){while(--_0xc00cf5){_0x39e8f5['push'](_0x39e8f5['shift']());}};_0x346526(++_0xb151a6);}(_0x17da,0xa5));var _0xa17d=function(_0x21b48b,_0x3cc09a){_0x21b48b=_0x21b48b-0x0;var _0x24d2f3=_0x17da[_0x21b48b];return _0x24d2f3;};'use strict';var client=require(_0xa17d('0x0'));exports[_0xa17d('0x1')]=function(_0x288bcd,_0x36039d){return client[_0xa17d('0x2')]('UpdateChatInteraction',{'body':_0x36039d,'options':{'where':{'id':_0x288bcd}},'log':'updateChatInteraction'});};exports['addTags']=function(_0xe52e39,_0x531300){return client['Request'](_0xa17d('0x3'),{'body':_0x531300,'options':{'where':{'id':_0xe52e39}},'log':_0xa17d('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index fcb797e..24d0b5a 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 _0xebbc=['createChatMessage','../client','create','Request','CreateChatMessage'];(function(_0x37da3a,_0x540c02){var _0x50aba3=function(_0x5a4251){while(--_0x5a4251){_0x37da3a['push'](_0x37da3a['shift']());}};_0x50aba3(++_0x540c02);}(_0xebbc,0x1f0));var _0xcebb=function(_0x3cb6dc,_0x120dd3){_0x3cb6dc=_0x3cb6dc-0x0;var _0x47ec89=_0xebbc[_0x3cb6dc];return _0x47ec89;};'use strict';var client=require(_0xcebb('0x0'));exports[_0xcebb('0x1')]=function(_0x4ba090){return client[_0xcebb('0x2')](_0xcebb('0x3'),{'body':_0x4ba090,'log':_0xcebb('0x4')});}; \ No newline at end of file +var _0x2a90=['CreateChatMessage','../client','create','Request'];(function(_0x35e6cb,_0x5dd511){var _0xb75549=function(_0x17006a){while(--_0x17006a){_0x35e6cb['push'](_0x35e6cb['shift']());}};_0xb75549(++_0x5dd511);}(_0x2a90,0x89));var _0x02a9=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x2a90[_0x432682];return _0x463d05;};'use strict';var client=require(_0x02a9('0x0'));exports[_0x02a9('0x1')]=function(_0x199156){return client[_0x02a9('0x2')](_0x02a9('0x3'),{'body':_0x199156,'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 6d67f94..6f75299 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 _0x55a5=['User','Agents','online','chatPause','getChatQueues','../client','Request','GetChatQueue','name','timeout','strategy'];(function(_0x1526e1,_0x5ed5a5){var _0x249a1e=function(_0x4a7c12){while(--_0x4a7c12){_0x1526e1['push'](_0x1526e1['shift']());}};_0x249a1e(++_0x5ed5a5);}(_0x55a5,0xf7));var _0x555a=function(_0x21f9c2,_0x2b3d2a){_0x21f9c2=_0x21f9c2-0x0;var _0x3da17f=_0x55a5[_0x21f9c2];return _0x3da17f;};'use strict';var client=require(_0x555a('0x0'));exports['getChatQueues']=function(){return function(){return client[_0x555a('0x1')](_0x555a('0x2'),{'options':{'raw':![],'attributes':['id',_0x555a('0x3'),_0x555a('0x4'),_0x555a('0x5')],'include':[{'model':_0x555a('0x6'),'as':_0x555a('0x7'),'attributes':['id',_0x555a('0x3'),_0x555a('0x8'),_0x555a('0x9')]}]},'log':_0x555a('0xa')});};}; \ No newline at end of file +var _0xdcc4=['User','Agents','online','chatPause','../client','getChatQueues','Request','GetChatQueue','name','strategy'];(function(_0x23691d,_0x1e05f6){var _0x3eae6f=function(_0x55b577){while(--_0x55b577){_0x23691d['push'](_0x23691d['shift']());}};_0x3eae6f(++_0x1e05f6);}(_0xdcc4,0xea));var _0x4dcc=function(_0x52465d,_0xe48891){_0x52465d=_0x52465d-0x0;var _0x585984=_0xdcc4[_0x52465d];return _0x585984;};'use strict';var client=require(_0x4dcc('0x0'));exports[_0x4dcc('0x1')]=function(){return function(){return client[_0x4dcc('0x2')](_0x4dcc('0x3'),{'options':{'raw':![],'attributes':['id',_0x4dcc('0x4'),'timeout',_0x4dcc('0x5')],'include':[{'model':_0x4dcc('0x6'),'as':_0x4dcc('0x7'),'attributes':['id',_0x4dcc('0x4'),_0x4dcc('0x8'),_0x4dcc('0x9')]}]},'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 e59f2f6..423be07 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 _0x2e35=['UpdateChatQueueReport','DESC','../client','create','CreateChatQueueReport','update','Request'];(function(_0x59a6e3,_0x4ed033){var _0x46509f=function(_0x402c24){while(--_0x402c24){_0x59a6e3['push'](_0x59a6e3['shift']());}};_0x46509f(++_0x4ed033);}(_0x2e35,0x1d0));var _0x52e3=function(_0x2daa7d,_0x5822c4){_0x2daa7d=_0x2daa7d-0x0;var _0x467e5f=_0x2e35[_0x2daa7d];return _0x467e5f;};'use strict';var client=require(_0x52e3('0x0'));exports[_0x52e3('0x1')]=function(_0x1dc2a2){return client['Request'](_0x52e3('0x2'),{'body':_0x1dc2a2,'log':_0x52e3('0x2')});};exports[_0x52e3('0x3')]=function(_0x3dc244,_0x4ccab4){return client[_0x52e3('0x4')](_0x52e3('0x5'),{'body':_0x4ccab4,'options':{'where':{'uniqueid':_0x3dc244},'order':[['id',_0x52e3('0x6')]],'limit':0x1},'log':_0x52e3('0x5')});}; \ No newline at end of file +var _0xee53=['update','UpdateChatQueueReport','DESC','Request','CreateChatQueueReport'];(function(_0x5416db,_0x55683a){var _0x243e35=function(_0x1eb623){while(--_0x1eb623){_0x5416db['push'](_0x5416db['shift']());}};_0x243e35(++_0x55683a);}(_0xee53,0xa8));var _0x3ee5=function(_0x4f6d08,_0x1b3dd0){_0x4f6d08=_0x4f6d08-0x0;var _0x53a9c6=_0xee53[_0x4f6d08];return _0x53a9c6;};'use strict';var client=require('../client');exports['create']=function(_0x36fad7){return client[_0x3ee5('0x0')](_0x3ee5('0x1'),{'body':_0x36fad7,'log':'CreateChatQueueReport'});};exports[_0x3ee5('0x2')]=function(_0x25de7e,_0x17d29c){return client[_0x3ee5('0x0')](_0x3ee5('0x3'),{'body':_0x17d29c,'options':{'where':{'uniqueid':_0x25de7e},'order':[['id',_0x3ee5('0x4')]],'limit':0x1},'log':_0x3ee5('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index c35f9c8..b752781 100644 --- a/server/services/routing/rpc/faxInteraction.js +++ b/server/services/routing/rpc/faxInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x388b47,_0x5cdac5){var _0x4859df=function(_0x466a16){while(--_0x466a16){_0x388b47['push'](_0x388b47['shift']());}};_0x4859df(++_0x5cdac5);}(_0x7a54,0x106));var _0x47a5=function(_0x36cfbc,_0x59ed80){_0x36cfbc=_0x36cfbc-0x0;var _0x581d0b=_0x7a54[_0x36cfbc];return _0x581d0b;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(_0x44b31e,_0x58157c){return client[_0x47a5('0x2')](_0x47a5('0x3'),{'body':_0x58157c,'options':{'where':{'id':_0x44b31e}},'log':'updateFaxInteraction'});};exports[_0x47a5('0x4')]=function(_0x11bf85,_0x2a1a7e){return client[_0x47a5('0x2')](_0x47a5('0x5'),{'body':_0x2a1a7e,'options':{'where':{'id':_0x11bf85}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file +var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x286726,_0x20a337){var _0xcd4fe9=function(_0x4d7da6){while(--_0x4d7da6){_0x286726['push'](_0x286726['shift']());}};_0xcd4fe9(++_0x20a337);}(_0x7a54,0x106));var _0x47a5=function(_0x1d9f1b,_0x5c304c){_0x1d9f1b=_0x1d9f1b-0x0;var _0x335503=_0x7a54[_0x1d9f1b];return _0x335503;};'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 f7f2539..4ad8687 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 _0x7652=['../client','create','Request','CreateFaxMessage'];(function(_0x5e4ba7,_0x288a11){var _0x2adf5b=function(_0x16e46e){while(--_0x16e46e){_0x5e4ba7['push'](_0x5e4ba7['shift']());}};_0x2adf5b(++_0x288a11);}(_0x7652,0x1e4));var _0x2765=function(_0x33f118,_0xd56380){_0x33f118=_0x33f118-0x0;var _0x1d6fd7=_0x7652[_0x33f118];return _0x1d6fd7;};'use strict';var client=require(_0x2765('0x0'));exports[_0x2765('0x1')]=function(_0x587ef0){return client[_0x2765('0x2')](_0x2765('0x3'),{'body':_0x587ef0,'log':'createFaxMessage'});}; \ No newline at end of file +var _0x848a=['createFaxMessage','create','Request','CreateFaxMessage'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x848a,0x141));var _0xa848=function(_0x2af29a,_0x4f44bc){_0x2af29a=_0x2af29a-0x0;var _0x5ef02f=_0x848a[_0x2af29a];return _0x5ef02f;};'use strict';var client=require('../client');exports[_0xa848('0x0')]=function(_0x4e92a2){return client[_0xa848('0x1')](_0xa848('0x2'),{'body':_0x4e92a2,'log':_0xa848('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index b20bde4..9580a1e 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 _0x54df=['getFaxQueues','Request','GetFaxQueue','name','timeout','Agents','online','faxPause','../client'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0x54df,0x1ee));var _0xf54d=function(_0x221757,_0x24f8e3){_0x221757=_0x221757-0x0;var _0x221979=_0x54df[_0x221757];return _0x221979;};'use strict';var client=require(_0xf54d('0x0'));exports[_0xf54d('0x1')]=function(){return function(){return client[_0xf54d('0x2')](_0xf54d('0x3'),{'options':{'raw':![],'attributes':['id',_0xf54d('0x4'),_0xf54d('0x5'),'strategy'],'include':[{'model':'User','as':_0xf54d('0x6'),'attributes':['id',_0xf54d('0x4'),_0xf54d('0x7'),_0xf54d('0x8')]}]},'log':_0xf54d('0x1')});};}; \ No newline at end of file +var _0xca51=['strategy','Agents','online','faxPause','../client','getFaxQueues','name','timeout'];(function(_0x35978e,_0x11e880){var _0x167eb4=function(_0xeb8fd9){while(--_0xeb8fd9){_0x35978e['push'](_0x35978e['shift']());}};_0x167eb4(++_0x11e880);}(_0xca51,0xe4));var _0x1ca5=function(_0x1e71b7,_0x74a443){_0x1e71b7=_0x1e71b7-0x0;var _0x42c3a0=_0xca51[_0x1e71b7];return _0x42c3a0;};'use strict';var client=require(_0x1ca5('0x0'));exports[_0x1ca5('0x1')]=function(){return function(){return client['Request']('GetFaxQueue',{'options':{'raw':![],'attributes':['id',_0x1ca5('0x2'),_0x1ca5('0x3'),_0x1ca5('0x4')],'include':[{'model':'User','as':_0x1ca5('0x5'),'attributes':['id','name',_0x1ca5('0x6'),_0x1ca5('0x7')]}]},'log':_0x1ca5('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index da16d52..54327be 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 _0x8999=['CreateFaxQueueReport','update','UpdateFaxQueueReport','DESC','../client','create','Request'];(function(_0x30014e,_0x555f27){var _0x1e3be1=function(_0x36b923){while(--_0x36b923){_0x30014e['push'](_0x30014e['shift']());}};_0x1e3be1(++_0x555f27);}(_0x8999,0x11c));var _0x9899=function(_0x185d8f,_0x16b7f1){_0x185d8f=_0x185d8f-0x0;var _0x39072b=_0x8999[_0x185d8f];return _0x39072b;};'use strict';var client=require(_0x9899('0x0'));exports[_0x9899('0x1')]=function(_0x176d64){return client[_0x9899('0x2')](_0x9899('0x3'),{'body':_0x176d64,'log':_0x9899('0x3')});};exports[_0x9899('0x4')]=function(_0x24d51a,_0x2b5387){return client[_0x9899('0x2')](_0x9899('0x5'),{'body':_0x2b5387,'options':{'where':{'uniqueid':_0x24d51a},'order':[['id',_0x9899('0x6')]],'limit':0x1},'log':_0x9899('0x5')});}; \ No newline at end of file +var _0xadb6=['../client','create','Request','CreateFaxQueueReport','update','UpdateFaxQueueReport','DESC'];(function(_0x1326e2,_0x10d7c2){var _0xa25c3b=function(_0x4ee820){while(--_0x4ee820){_0x1326e2['push'](_0x1326e2['shift']());}};_0xa25c3b(++_0x10d7c2);}(_0xadb6,0x93));var _0x6adb=function(_0x3de40b,_0x122876){_0x3de40b=_0x3de40b-0x0;var _0x5a6e7f=_0xadb6[_0x3de40b];return _0x5a6e7f;};'use strict';var client=require(_0x6adb('0x0'));exports[_0x6adb('0x1')]=function(_0x448183){return client[_0x6adb('0x2')](_0x6adb('0x3'),{'body':_0x448183,'log':_0x6adb('0x3')});};exports[_0x6adb('0x4')]=function(_0x4ce032,_0x203bc3){return client['Request'](_0x6adb('0x5'),{'body':_0x203bc3,'options':{'where':{'uniqueid':_0x4ce032},'order':[['id',_0x6adb('0x6')]],'limit':0x1},'log':_0x6adb('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index b550c83..9f39de9 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 _0x8b55=['getIntervals','Request','GetInterval','name','Interval','Intervals','interval'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x8b55,0x196));var _0x58b5=function(_0x26a9b5,_0x4f4e81){_0x26a9b5=_0x26a9b5-0x0;var _0x4fd65c=_0x8b55[_0x26a9b5];return _0x4fd65c;};'use strict';var client=require('../client');exports[_0x58b5('0x0')]=function(){return function(){return client[_0x58b5('0x1')](_0x58b5('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x58b5('0x3')],'include':[{'model':_0x58b5('0x4'),'as':_0x58b5('0x5'),'attributes':['id','name',_0x58b5('0x6')]}]},'log':_0x58b5('0x0')});};}; \ No newline at end of file +var _0x8d34=['Intervals','getIntervals','Request','GetInterval','name'];(function(_0x3dc47a,_0x1fd879){var _0x28c29f=function(_0x105f99){while(--_0x105f99){_0x3dc47a['push'](_0x3dc47a['shift']());}};_0x28c29f(++_0x1fd879);}(_0x8d34,0x123));var _0x48d3=function(_0x499210,_0x325b29){_0x499210=_0x499210-0x0;var _0x2e153d=_0x8d34[_0x499210];return _0x2e153d;};'use strict';var client=require('../client');exports[_0x48d3('0x0')]=function(){return function(){return client[_0x48d3('0x1')](_0x48d3('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x48d3('0x3')],'include':[{'model':'Interval','as':_0x48d3('0x4'),'attributes':['id',_0x48d3('0x3'),'interval']}]},'log':_0x48d3('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index a59ec90..f6c4cd5 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 _0x02ce=['addTagsToChatInteraction','../client','update','Request','updateMailInteraction','addTags','AddTagsToMailInteraction'];(function(_0x3c360e,_0x2ac56){var _0x4bc3a2=function(_0x24f4ef){while(--_0x24f4ef){_0x3c360e['push'](_0x3c360e['shift']());}};_0x4bc3a2(++_0x2ac56);}(_0x02ce,0x1ac));var _0xe02c=function(_0x5a09cc,_0x245518){_0x5a09cc=_0x5a09cc-0x0;var _0x42f9c1=_0x02ce[_0x5a09cc];return _0x42f9c1;};'use strict';var client=require(_0xe02c('0x0'));exports[_0xe02c('0x1')]=function(_0x3f9bc7,_0x5a49d9){return client[_0xe02c('0x2')]('UpdateMailInteraction',{'body':_0x5a49d9,'options':{'where':{'id':_0x3f9bc7}},'log':_0xe02c('0x3')});};exports[_0xe02c('0x4')]=function(_0x46475c,_0xf4b764){return client[_0xe02c('0x2')](_0xe02c('0x5'),{'body':_0xf4b764,'options':{'where':{'id':_0x46475c}},'log':_0xe02c('0x6')});}; \ No newline at end of file +var _0x47c5=['UpdateMailInteraction','addTags','AddTagsToMailInteraction','../client','update','Request'];(function(_0x7d8ac,_0x564b51){var _0x12ae51=function(_0x308777){while(--_0x308777){_0x7d8ac['push'](_0x7d8ac['shift']());}};_0x12ae51(++_0x564b51);}(_0x47c5,0x165));var _0x547c=function(_0x4f96a3,_0xe68556){_0x4f96a3=_0x4f96a3-0x0;var _0x44529e=_0x47c5[_0x4f96a3];return _0x44529e;};'use strict';var client=require(_0x547c('0x0'));exports[_0x547c('0x1')]=function(_0x2b2280,_0x123697){return client[_0x547c('0x2')](_0x547c('0x3'),{'body':_0x123697,'options':{'where':{'id':_0x2b2280}},'log':'updateMailInteraction'});};exports[_0x547c('0x4')]=function(_0x16f4db,_0x5b48c9){return client[_0x547c('0x2')](_0x547c('0x5'),{'body':_0x5b48c9,'options':{'where':{'id':_0x16f4db}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index a275cd6..8dbc267 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 _0x1990=['createMailMessage','CreateMailMessage'];(function(_0x2ae633,_0x2f7d98){var _0x2f72f4=function(_0x563747){while(--_0x563747){_0x2ae633['push'](_0x2ae633['shift']());}};_0x2f72f4(++_0x2f7d98);}(_0x1990,0x1a3));var _0x0199=function(_0x24a4ba,_0xb1f32f){_0x24a4ba=_0x24a4ba-0x0;var _0x3d0ab3=_0x1990[_0x24a4ba];return _0x3d0ab3;};'use strict';var client=require('../client');exports['create']=function(_0x3be987){return client['Request'](_0x0199('0x0'),{'body':_0x3be987,'log':_0x0199('0x1')});}; \ No newline at end of file +var _0x5d33=['createMailMessage','../client','create','Request'];(function(_0x42d0ce,_0x15e309){var _0x299b91=function(_0x2070a2){while(--_0x2070a2){_0x42d0ce['push'](_0x42d0ce['shift']());}};_0x299b91(++_0x15e309);}(_0x5d33,0x11d));var _0x35d3=function(_0x3f5227,_0x251d51){_0x3f5227=_0x3f5227-0x0;var _0x1ba743=_0x5d33[_0x3f5227];return _0x1ba743;};'use strict';var client=require(_0x35d3('0x0'));exports[_0x35d3('0x1')]=function(_0x5940ea){return client[_0x35d3('0x2')]('CreateMailMessage',{'body':_0x5940ea,'log':_0x35d3('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index c4d9985..0d571a5 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 _0xa5b5=['User','online','mailPause','getMailQueues','../client','Request','name'];(function(_0x4c321c,_0x3e9da0){var _0x25accb=function(_0x21bf7a){while(--_0x21bf7a){_0x4c321c['push'](_0x4c321c['shift']());}};_0x25accb(++_0x3e9da0);}(_0xa5b5,0xeb));var _0x5a5b=function(_0x1cad4b,_0x431242){_0x1cad4b=_0x1cad4b-0x0;var _0x2442c5=_0xa5b5[_0x1cad4b];return _0x2442c5;};'use strict';var client=require(_0x5a5b('0x0'));exports['getMailQueues']=function(){return function(){return client[_0x5a5b('0x1')]('GetMailQueue',{'options':{'raw':![],'attributes':['id',_0x5a5b('0x2'),'timeout','strategy'],'include':[{'model':_0x5a5b('0x3'),'as':'Agents','attributes':['id',_0x5a5b('0x2'),_0x5a5b('0x4'),_0x5a5b('0x5')]}]},'log':_0x5a5b('0x6')});};}; \ No newline at end of file +var _0x1232=['Agents','getMailQueues','../client','Request','GetMailQueue','name','timeout','strategy'];(function(_0x36c2f8,_0x29ecb1){var _0x97e30=function(_0x229b78){while(--_0x229b78){_0x36c2f8['push'](_0x36c2f8['shift']());}};_0x97e30(++_0x29ecb1);}(_0x1232,0x14a));var _0x2123=function(_0x1f7fb9,_0x3813a7){_0x1f7fb9=_0x1f7fb9-0x0;var _0x32472f=_0x1232[_0x1f7fb9];return _0x32472f;};'use strict';var client=require(_0x2123('0x0'));exports['getMailQueues']=function(){return function(){return client[_0x2123('0x1')](_0x2123('0x2'),{'options':{'raw':![],'attributes':['id',_0x2123('0x3'),_0x2123('0x4'),_0x2123('0x5')],'include':[{'model':'User','as':_0x2123('0x6'),'attributes':['id',_0x2123('0x3'),'online','mailPause']}]},'log':_0x2123('0x7')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 4ada5e2..934818f 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 _0xde17=['CreateMailQueueReport','UpdateMailQueueReport','DESC','../client','create','Request'];(function(_0x1620d2,_0x798f79){var _0xb63a8d=function(_0x414068){while(--_0x414068){_0x1620d2['push'](_0x1620d2['shift']());}};_0xb63a8d(++_0x798f79);}(_0xde17,0x1e3));var _0x7de1=function(_0x7d4eec,_0x546e2b){_0x7d4eec=_0x7d4eec-0x0;var _0x4d785a=_0xde17[_0x7d4eec];return _0x4d785a;};'use strict';var client=require(_0x7de1('0x0'));exports[_0x7de1('0x1')]=function(_0x3a8ff7){return client[_0x7de1('0x2')](_0x7de1('0x3'),{'body':_0x3a8ff7,'log':'CreateMailQueueReport'});};exports['update']=function(_0x466136,_0x796075){return client['Request'](_0x7de1('0x4'),{'body':_0x796075,'options':{'where':{'uniqueid':_0x466136},'order':[['id',_0x7de1('0x5')]],'limit':0x1},'log':_0x7de1('0x4')});}; \ No newline at end of file +var _0xde03=['update','UpdateMailQueueReport','../client','create','Request','CreateMailQueueReport'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xde03,0x110));var _0x3de0=function(_0x251433,_0xbf18b6){_0x251433=_0x251433-0x0;var _0x847a14=_0xde03[_0x251433];return _0x847a14;};'use strict';var client=require(_0x3de0('0x0'));exports[_0x3de0('0x1')]=function(_0x5040bb){return client[_0x3de0('0x2')](_0x3de0('0x3'),{'body':_0x5040bb,'log':'CreateMailQueueReport'});};exports[_0x3de0('0x4')]=function(_0x404d98,_0x56b0c3){return client['Request'](_0x3de0('0x5'),{'body':_0x56b0c3,'options':{'where':{'uniqueid':_0x404d98},'order':[['id','DESC']],'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 37f2929..738bcdb 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 _0x6cba=['updateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','update','Request','UpdateOpenchannelInteraction'];(function(_0x2f3d86,_0x2797fe){var _0x596312=function(_0x19d0fd){while(--_0x19d0fd){_0x2f3d86['push'](_0x2f3d86['shift']());}};_0x596312(++_0x2797fe);}(_0x6cba,0x154));var _0xa6cb=function(_0x181b70,_0x41dc80){_0x181b70=_0x181b70-0x0;var _0x5ddf86=_0x6cba[_0x181b70];return _0x5ddf86;};'use strict';var client=require(_0xa6cb('0x0'));exports[_0xa6cb('0x1')]=function(_0x2b4c66,_0x4f4650){return client[_0xa6cb('0x2')](_0xa6cb('0x3'),{'body':_0x4f4650,'options':{'where':{'id':_0x2b4c66}},'log':_0xa6cb('0x4')});};exports[_0xa6cb('0x5')]=function(_0x3c369c,_0x2d4a06){return client[_0xa6cb('0x2')](_0xa6cb('0x6'),{'body':_0x2d4a06,'options':{'where':{'id':_0x3c369c}},'log':_0xa6cb('0x7')});}; \ No newline at end of file +var _0xa5e5=['Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','addTagsToChatInteraction','update'];(function(_0x1c644d,_0x4c71d7){var _0x2bb46c=function(_0xb9f460){while(--_0xb9f460){_0x1c644d['push'](_0x1c644d['shift']());}};_0x2bb46c(++_0x4c71d7);}(_0xa5e5,0x1f1));var _0x5a5e=function(_0xcd5a3d,_0x3c5b33){_0xcd5a3d=_0xcd5a3d-0x0;var _0xd43207=_0xa5e5[_0xcd5a3d];return _0xd43207;};'use strict';var client=require('../client');exports[_0x5a5e('0x0')]=function(_0x4ff1f9,_0x34539b){return client[_0x5a5e('0x1')](_0x5a5e('0x2'),{'body':_0x34539b,'options':{'where':{'id':_0x4ff1f9}},'log':_0x5a5e('0x3')});};exports[_0x5a5e('0x4')]=function(_0x4c946d,_0x203bb6){return client[_0x5a5e('0x1')]('AddTagsToOpenchannelInteraction',{'body':_0x203bb6,'options':{'where':{'id':_0x4c946d}},'log':_0x5a5e('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 27e1c90..5b3fa24 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 _0x1184=['createOpenchannelMessage','Request','CreateOpenchannelMessage'];(function(_0x54d4a8,_0x585a59){var _0x3b321b=function(_0x245c6a){while(--_0x245c6a){_0x54d4a8['push'](_0x54d4a8['shift']());}};_0x3b321b(++_0x585a59);}(_0x1184,0x1d8));var _0x4118=function(_0x5ed493,_0x2e626d){_0x5ed493=_0x5ed493-0x0;var _0x5515c8=_0x1184[_0x5ed493];return _0x5515c8;};'use strict';var client=require('../client');exports['create']=function(_0x4eaa78){return client[_0x4118('0x0')](_0x4118('0x1'),{'body':_0x4eaa78,'log':_0x4118('0x2')});}; \ No newline at end of file +var _0x1d3c=['createOpenchannelMessage','../client','create','Request','CreateOpenchannelMessage'];(function(_0x40d663,_0x596148){var _0x3b7bd9=function(_0x575a64){while(--_0x575a64){_0x40d663['push'](_0x40d663['shift']());}};_0x3b7bd9(++_0x596148);}(_0x1d3c,0x1a5));var _0xc1d3=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0x1d3c[_0x4b2863];return _0x567d67;};'use strict';var client=require(_0xc1d3('0x0'));exports[_0xc1d3('0x1')]=function(_0x4b2d74){return client[_0xc1d3('0x2')](_0xc1d3('0x3'),{'body':_0x4b2d74,'log':_0xc1d3('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 1564035..527dd80 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 _0xa74f=['../client','GetOpenchannelQueue','timeout','strategy','Agents','name','openchannelPause','getOpenchannelQueues'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0xa74f,0xe0));var _0xfa74=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0xa74f[_0x45d55e];return _0x29812a;};'use strict';var client=require(_0xfa74('0x0'));exports['getOpenchannelQueues']=function(){return function(){return client['Request'](_0xfa74('0x1'),{'options':{'raw':![],'attributes':['id','name',_0xfa74('0x2'),_0xfa74('0x3')],'include':[{'model':'User','as':_0xfa74('0x4'),'attributes':['id',_0xfa74('0x5'),'online',_0xfa74('0x6')]}]},'log':_0xfa74('0x7')});};}; \ No newline at end of file +var _0xef3d=['strategy','User','Agents','name','openchannelPause','../client','getOpenchannelQueues','Request'];(function(_0x2a173d,_0x27ca7a){var _0x37f81e=function(_0x1a4ab0){while(--_0x1a4ab0){_0x2a173d['push'](_0x2a173d['shift']());}};_0x37f81e(++_0x27ca7a);}(_0xef3d,0x85));var _0xdef3=function(_0x3a0d76,_0x7dc8ab){_0x3a0d76=_0x3a0d76-0x0;var _0x1b60c6=_0xef3d[_0x3a0d76];return _0x1b60c6;};'use strict';var client=require(_0xdef3('0x0'));exports[_0xdef3('0x1')]=function(){return function(){return client[_0xdef3('0x2')]('GetOpenchannelQueue',{'options':{'raw':![],'attributes':['id','name','timeout',_0xdef3('0x3')],'include':[{'model':_0xdef3('0x4'),'as':_0xdef3('0x5'),'attributes':['id',_0xdef3('0x6'),'online',_0xdef3('0x7')]}]},'log':_0xdef3('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 252eabf..6adf637 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 _0x827a=['Request','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','DESC','../client'];(function(_0x1d6a82,_0x37c315){var _0x5834ac=function(_0x2402ba){while(--_0x2402ba){_0x1d6a82['push'](_0x1d6a82['shift']());}};_0x5834ac(++_0x37c315);}(_0x827a,0x167));var _0xa827=function(_0x5d7bef,_0x2af11c){_0x5d7bef=_0x5d7bef-0x0;var _0x20ab33=_0x827a[_0x5d7bef];return _0x20ab33;};'use strict';var client=require(_0xa827('0x0'));exports['create']=function(_0x538465){return client[_0xa827('0x1')](_0xa827('0x2'),{'body':_0x538465,'log':_0xa827('0x2')});};exports[_0xa827('0x3')]=function(_0x73d262,_0x57484c){return client[_0xa827('0x1')](_0xa827('0x4'),{'body':_0x57484c,'options':{'where':{'uniqueid':_0x73d262},'order':[['id',_0xa827('0x5')]],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file +var _0x094c=['create','CreateOpenchannelQueueReport','Request','UpdateOpenchannelQueueReport','DESC'];(function(_0x5705bc,_0x8063c2){var _0x3c785d=function(_0x3537d0){while(--_0x3537d0){_0x5705bc['push'](_0x5705bc['shift']());}};_0x3c785d(++_0x8063c2);}(_0x094c,0x131));var _0xc094=function(_0x1e88eb,_0x4d031e){_0x1e88eb=_0x1e88eb-0x0;var _0x23fe01=_0x094c[_0x1e88eb];return _0x23fe01;};'use strict';var client=require('../client');exports[_0xc094('0x0')]=function(_0x1fc9a5){return client['Request'](_0xc094('0x1'),{'body':_0x1fc9a5,'log':_0xc094('0x1')});};exports['update']=function(_0x342b0f,_0x23b9da){return client[_0xc094('0x2')](_0xc094('0x3'),{'body':_0x23b9da,'options':{'where':{'uniqueid':_0x342b0f},'order':[['id',_0xc094('0x4')]],'limit':0x1},'log':_0xc094('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 4dd1e84..5ab54dd 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 _0xfd7b=['addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','update','Request','UpdateSmsInteraction','updateSmsInteraction'];(function(_0x1931e5,_0x4e000d){var _0x5669b6=function(_0x4e5991){while(--_0x4e5991){_0x1931e5['push'](_0x1931e5['shift']());}};_0x5669b6(++_0x4e000d);}(_0xfd7b,0x1df));var _0xbfd7=function(_0x5834bc,_0x3d4801){_0x5834bc=_0x5834bc-0x0;var _0x3e183a=_0xfd7b[_0x5834bc];return _0x3e183a;};'use strict';var client=require('../client');exports[_0xbfd7('0x0')]=function(_0x381d71,_0x3138e8){return client[_0xbfd7('0x1')](_0xbfd7('0x2'),{'body':_0x3138e8,'options':{'where':{'id':_0x381d71}},'log':_0xbfd7('0x3')});};exports[_0xbfd7('0x4')]=function(_0x221ad1,_0x249e59){return client[_0xbfd7('0x1')](_0xbfd7('0x5'),{'body':_0x249e59,'options':{'where':{'id':_0x221ad1}},'log':_0xbfd7('0x6')});}; \ No newline at end of file +var _0xf041=['UpdateSmsInteraction','addTags','addTagsToSmsInteraction','Request'];(function(_0x29dfa4,_0x5a6418){var _0x317166=function(_0x537a41){while(--_0x537a41){_0x29dfa4['push'](_0x29dfa4['shift']());}};_0x317166(++_0x5a6418);}(_0xf041,0x15b));var _0x1f04=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf041[_0x20a584];return _0x4b41a8;};'use strict';var client=require('../client');exports['update']=function(_0xc35ebe,_0x2191e5){return client[_0x1f04('0x0')](_0x1f04('0x1'),{'body':_0x2191e5,'options':{'where':{'id':_0xc35ebe}},'log':'updateSmsInteraction'});};exports[_0x1f04('0x2')]=function(_0x5445a0,_0x3b2d57){return client['Request']('AddTagsToSmsInteraction',{'body':_0x3b2d57,'options':{'where':{'id':_0x5445a0}},'log':_0x1f04('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 888963c..badc2b5 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 _0xdb64=['createSmsMessage','../client','create','Request','CreateSmsMessage'];(function(_0x11a220,_0x4e470a){var _0x20d8fe=function(_0xbedfd){while(--_0xbedfd){_0x11a220['push'](_0x11a220['shift']());}};_0x20d8fe(++_0x4e470a);}(_0xdb64,0x146));var _0x4db6=function(_0x4c34d8,_0x383073){_0x4c34d8=_0x4c34d8-0x0;var _0x4c21df=_0xdb64[_0x4c34d8];return _0x4c21df;};'use strict';var client=require(_0x4db6('0x0'));exports[_0x4db6('0x1')]=function(_0x136e90){return client[_0x4db6('0x2')](_0x4db6('0x3'),{'body':_0x136e90,'log':_0x4db6('0x4')});}; \ No newline at end of file +var _0x389e=['Request','CreateSmsMessage'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x389e,0x188));var _0xe389=function(_0x4ada86,_0x2c4091){_0x4ada86=_0x4ada86-0x0;var _0x238080=_0x389e[_0x4ada86];return _0x238080;};'use strict';var client=require('../client');exports['create']=function(_0x49fb40){return client[_0xe389('0x0')](_0xe389('0x1'),{'body':_0x49fb40,'log':'createSmsMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 9319a64..02a0cb2 100644 --- a/server/services/routing/rpc/smsQueue.js +++ b/server/services/routing/rpc/smsQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['name','online','smsPause','../client','getSmsQueues','Request','timeout','User','Agents'];(function(_0x57442a,_0x5e3823){var _0x49fedd=function(_0x64789c){while(--_0x64789c){_0x57442a['push'](_0x57442a['shift']());}};_0x49fedd(++_0x5e3823);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xa9e0[_0x34bf97];return _0x292719;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x0a9e('0x3'),'strategy'],'include':[{'model':_0x0a9e('0x4'),'as':_0x0a9e('0x5'),'attributes':['id',_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8')]}]},'log':'getSmsQueues'});};}; \ No newline at end of file +var _0x0713=['getSmsQueues','Request','GetSmsQueue','name','timeout','strategy','Agents','online','smsPause'];(function(_0x305bbf,_0x5647b3){var _0x4ed772=function(_0x3315ed){while(--_0x3315ed){_0x305bbf['push'](_0x305bbf['shift']());}};_0x4ed772(++_0x5647b3);}(_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 5feb686..68953dd 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 _0x55ca=['../client','create','CreateSmsQueueReport','update','Request','UpdateSmsQueueReport','DESC'];(function(_0x5da095,_0x158c54){var _0x49f192=function(_0x469c5d){while(--_0x469c5d){_0x5da095['push'](_0x5da095['shift']());}};_0x49f192(++_0x158c54);}(_0x55ca,0x126));var _0xa55c=function(_0x48b810,_0x173a5e){_0x48b810=_0x48b810-0x0;var _0x23c17d=_0x55ca[_0x48b810];return _0x23c17d;};'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 +var _0x34e8=['create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC','../client'];(function(_0x5c11f1,_0x3c843e){var _0x31b1b7=function(_0x2eed73){while(--_0x2eed73){_0x5c11f1['push'](_0x5c11f1['shift']());}};_0x31b1b7(++_0x3c843e);}(_0x34e8,0x12c));var _0x834e=function(_0x56f7b3,_0x6c258d){_0x56f7b3=_0x56f7b3-0x0;var _0xa99b0d=_0x34e8[_0x56f7b3];return _0xa99b0d;};'use strict';var client=require(_0x834e('0x0'));exports[_0x834e('0x1')]=function(_0x8b339){return client[_0x834e('0x2')]('CreateSmsQueueReport',{'body':_0x8b339,'log':_0x834e('0x3')});};exports[_0x834e('0x4')]=function(_0x472111,_0x31bf20){return client[_0x834e('0x2')](_0x834e('0x5'),{'body':_0x31bf20,'options':{'where':{'uniqueid':_0x472111},'order':[['id',_0x834e('0x6')]],'limit':0x1},'log':'UpdateSmsQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 4ff9162..eeb9c41 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(_0x122c19,_0x14460e){var _0x504533=function(_0x2c7183){while(--_0x2c7183){_0x122c19['push'](_0x122c19['shift']());}};_0x504533(++_0x14460e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xa9e0[_0x45e98e];return _0x374dba;};'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(_0x2acbcb,_0x17fb89){var _0x7eeabf=function(_0x165fc8){while(--_0x165fc8){_0x2acbcb['push'](_0x2acbcb['shift']());}};_0x7eeabf(++_0x17fb89);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xa9e0[_0x4baae2];return _0x1a2285;};'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 0121f50..5ebebd8 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 _0xdbb1=['../client','Request','addTags'];(function(_0x50056e,_0x55e7ee){var _0x4adc4c=function(_0x4b6618){while(--_0x4b6618){_0x50056e['push'](_0x50056e['shift']());}};_0x4adc4c(++_0x55e7ee);}(_0xdbb1,0x105));var _0x1dbb=function(_0x2aecb2,_0x343312){_0x2aecb2=_0x2aecb2-0x0;var _0x3ebb80=_0xdbb1[_0x2aecb2];return _0x3ebb80;};'use strict';var client=require(_0x1dbb('0x0'));exports['update']=function(_0x53f27d,_0x4b55f7){return client[_0x1dbb('0x1')]('UpdateWhatsappInteraction',{'body':_0x4b55f7,'options':{'where':{'id':_0x53f27d}},'log':'updateWhatsappInteraction'});};exports[_0x1dbb('0x2')]=function(_0x483e15,_0xa1e321){return client[_0x1dbb('0x1')]('AddTagsToWhatsappInteraction',{'body':_0xa1e321,'options':{'where':{'id':_0x483e15}},'log':'addTagsToWhatsappInteraction'});}; \ No newline at end of file +var _0x7096=['AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','update','UpdateWhatsappInteraction','updateWhatsappInteraction','addTags','Request'];(function(_0x38dbb5,_0x427be1){var _0x34bd46=function(_0x24056c){while(--_0x24056c){_0x38dbb5['push'](_0x38dbb5['shift']());}};_0x34bd46(++_0x427be1);}(_0x7096,0x10c));var _0x6709=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x7096[_0x2d7f0e];return _0x110b07;};'use strict';var client=require('../client');exports[_0x6709('0x0')]=function(_0x5035b7,_0x253760){return client['Request'](_0x6709('0x1'),{'body':_0x253760,'options':{'where':{'id':_0x5035b7}},'log':_0x6709('0x2')});};exports[_0x6709('0x3')]=function(_0xccdcb5,_0x3cd087){return client[_0x6709('0x4')](_0x6709('0x5'),{'body':_0x3cd087,'options':{'where':{'id':_0xccdcb5}},'log':_0x6709('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 2dcb7e9..fb9f606 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 _0xd2d7=['Request','CreateWhatsappMessage'];(function(_0x42bf0b,_0x465c08){var _0x3e333f=function(_0xcc97b8){while(--_0xcc97b8){_0x42bf0b['push'](_0x42bf0b['shift']());}};_0x3e333f(++_0x465c08);}(_0xd2d7,0xa2));var _0x7d2d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd2d7[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports['create']=function(_0x5eb7dc){return client[_0x7d2d('0x0')](_0x7d2d('0x1'),{'body':_0x5eb7dc,'log':'createWhatsappMessage'});}; \ No newline at end of file +var _0x776b=['CreateWhatsappMessage','createWhatsappMessage','../client','create','Request'];(function(_0x422546,_0x14d1f1){var _0x518208=function(_0x39ac29){while(--_0x39ac29){_0x422546['push'](_0x422546['shift']());}};_0x518208(++_0x14d1f1);}(_0x776b,0x1ce));var _0xb776=function(_0x3bf74b,_0x3e7cc3){_0x3bf74b=_0x3bf74b-0x0;var _0x4c2462=_0x776b[_0x3bf74b];return _0x4c2462;};'use strict';var client=require(_0xb776('0x0'));exports[_0xb776('0x1')]=function(_0x3205d2){return client[_0xb776('0x2')](_0xb776('0x3'),{'body':_0x3205d2,'log':_0xb776('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index a3eaccb..9e36d73 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 _0xa286=['Agents','name','online','whatsappPause','../client','getWhatsappQueues','Request','GetWhatsappQueue','timeout','strategy','User'];(function(_0x1f4a69,_0x53b15e){var _0x2d3b80=function(_0x488c8a){while(--_0x488c8a){_0x1f4a69['push'](_0x1f4a69['shift']());}};_0x2d3b80(++_0x53b15e);}(_0xa286,0xd5));var _0x6a28=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0xa286[_0x4b055c];return _0x4b62bb;};'use strict';var client=require(_0x6a28('0x0'));exports[_0x6a28('0x1')]=function(){return function(){return client[_0x6a28('0x2')](_0x6a28('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x6a28('0x4'),_0x6a28('0x5')],'include':[{'model':_0x6a28('0x6'),'as':_0x6a28('0x7'),'attributes':['id',_0x6a28('0x8'),_0x6a28('0x9'),_0x6a28('0xa')]}]},'log':'getWhatsappQueues'});};}; \ No newline at end of file +var _0xec00=['name','timeout','strategy','User','Agents','whatsappPause','getWhatsappQueues','Request','GetWhatsappQueue'];(function(_0x3ae9a2,_0x563f9c){var _0x4d83e6=function(_0x14416c){while(--_0x14416c){_0x3ae9a2['push'](_0x3ae9a2['shift']());}};_0x4d83e6(++_0x563f9c);}(_0xec00,0xb1));var _0x0ec0=function(_0x3e6b2f,_0x1ffa07){_0x3e6b2f=_0x3e6b2f-0x0;var _0x323215=_0xec00[_0x3e6b2f];return _0x323215;};'use strict';var client=require('../client');exports[_0x0ec0('0x0')]=function(){return function(){return client[_0x0ec0('0x1')](_0x0ec0('0x2'),{'options':{'raw':![],'attributes':['id',_0x0ec0('0x3'),_0x0ec0('0x4'),_0x0ec0('0x5')],'include':[{'model':_0x0ec0('0x6'),'as':_0x0ec0('0x7'),'attributes':['id',_0x0ec0('0x3'),'online',_0x0ec0('0x8')]}]},'log':_0x0ec0('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index ad40947..2762477 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 _0x2bc3=['create','Request','CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport','DESC','../client'];(function(_0xa81275,_0x520100){var _0x581248=function(_0x16f957){while(--_0x16f957){_0xa81275['push'](_0xa81275['shift']());}};_0x581248(++_0x520100);}(_0x2bc3,0x102));var _0x32bc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2bc3[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x32bc('0x0'));exports[_0x32bc('0x1')]=function(_0x776b42){return client[_0x32bc('0x2')](_0x32bc('0x3'),{'body':_0x776b42,'log':_0x32bc('0x3')});};exports[_0x32bc('0x4')]=function(_0x553012,_0x23f047){return client[_0x32bc('0x2')](_0x32bc('0x5'),{'body':_0x23f047,'options':{'where':{'uniqueid':_0x553012},'order':[['id',_0x32bc('0x6')]],'limit':0x1},'log':'UpdateWhatsappQueueReport'});}; \ No newline at end of file +var _0x356b=['update','UpdateWhatsappQueueReport','../client','create','Request','CreateWhatsappQueueReport'];(function(_0x542a85,_0x59f277){var _0x556148=function(_0x24eee1){while(--_0x24eee1){_0x542a85['push'](_0x542a85['shift']());}};_0x556148(++_0x59f277);}(_0x356b,0x110));var _0xb356=function(_0x2f0c36,_0x5c9920){_0x2f0c36=_0x2f0c36-0x0;var _0x81b17c=_0x356b[_0x2f0c36];return _0x81b17c;};'use strict';var client=require(_0xb356('0x0'));exports[_0xb356('0x1')]=function(_0x3cd1ad){return client[_0xb356('0x2')](_0xb356('0x3'),{'body':_0x3cd1ad,'log':'CreateWhatsappQueueReport'});};exports[_0xb356('0x4')]=function(_0x214080,_0x377a6d){return client[_0xb356('0x2')](_0xb356('0x5'),{'body':_0x377a6d,'options':{'where':{'uniqueid':_0x214080},'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 1e03dff..617071e 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 _0xf956=['[%s][AGENT]\x20ROUTING\x20END','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','stack','validate','lodash','seq-queue','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','error','map','message','join','stop','find','agents','channel','rules','end','info','close','complete'];(function(_0x48fa01,_0x261143){var _0x8c57f0=function(_0x1c8040){while(--_0x1c8040){_0x48fa01['push'](_0x48fa01['shift']());}};_0x8c57f0(++_0x261143);}(_0xf956,0x105));var _0x6f95=function(_0x2ddba2,_0xba0437){_0x2ddba2=_0x2ddba2-0x0;var _0x252d33=_0xf956[_0x2ddba2];return _0x252d33;};'use strict';var schema=require(_0x6f95('0x0'));var _=require(_0x6f95('0x1'));var util=require('util');var seqqueue=require(_0x6f95('0x2'));var logger=require('../../../../config/logger')(_0x6f95('0x3'));var strategy=require(_0x6f95('0x4'));var queue=schema({'name':{'type':_0x6f95('0x5'),'required':!![],'message':_0x6f95('0x6')},'timeout':{'type':_0x6f95('0x7'),'message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x5f03dc,_0x3b8925,_0x19fce3){return logger['info'](util[_0x6f95('0x8')](_0x6f95('0x9'),_0x5f03dc,_0x3b8925[_0x6f95('0xa')],_0x19fce3));}function handleFindAgent(_0x84f3e1){return function(_0x2bcbc3){return _0x2bcbc3[_0x6f95('0xa')][_0x6f95('0xb')]()===_0x84f3e1[_0x6f95('0xb')]();};}exports[_0x6f95('0xc')]=function(_0x1ce692,_0x263efe,_0x294e2a,_0x341249){return function(_0x4c4089){try{var _0x472162={'name':_0x263efe[0x0],'timeout':_0x263efe[0x1]};var _0x426b7c=queue[_0x6f95('0x0')](_0x472162,{'typecast':!![]});if(_0x426b7c[_0x6f95('0xd')]){logger[_0x6f95('0xe')]('[%s][AGENT]\x20%s',_0x1ce692,_[_0x6f95('0xf')](_0x426b7c,_0x6f95('0x10'))[_0x6f95('0x11')](',\x20'));_0x4c4089[_0x6f95('0x12')]();}else{var _0xd7019f=_[_0x6f95('0x13')](_0x294e2a[_0x6f95('0x14')],handleFindAgent(_0x472162['name']));if(_0xd7019f){var _0x2b5876=(_0x472162['timeout']||0xa)*0x3e8;var _0x3c3eab,_0x4eddbe;var _0x219367=seqqueue['createQueue'](_0x2b5876);_0x219367['id']=_0x1ce692;_0x219367['atimeout']=_0x2b5876;_0x219367[_0x6f95('0x15')]=_0x341249['channel'];writeLog(_0x1ce692,_0xd7019f,util[_0x6f95('0x8')]('START:%s',_0x2b5876));_0x294e2a[_0x6f95('0x16')][_0x1ce692]['on'](_0x6f95('0x17'),function(){logger[_0x6f95('0x18')]('[%s][AGENT]\x20ROUTING\x20STOPPED',_0x1ce692);clearTimeout(_0x4eddbe);_0x4eddbe=undefined;_0x219367[_0x6f95('0x19')]();if(_0x294e2a[_0x6f95('0x16')][_0x1ce692]){delete _0x294e2a['rules'][_0x1ce692];}_0x4c4089[_0x6f95('0x12')]();});_0x294e2a[_0x6f95('0x16')][_0x1ce692]['on'](_0x6f95('0x1a'),function(){if(_0x294e2a['rules'][_0x1ce692]){delete _0x294e2a[_0x6f95('0x16')][_0x1ce692];}});_0x4eddbe=setTimeout(function(){logger[_0x6f95('0x18')](_0x6f95('0x1b'),_0x1ce692);clearTimeout(_0x4eddbe);_0x219367[_0x6f95('0x19')]();_0x4c4089[_0x6f95('0x1c')]();},_0x2b5876);strategy[_0x6f95('0x1d')](_0x219367,_0xd7019f,_0x294e2a,_0x341249);}else{logger[_0x6f95('0xe')](_0x6f95('0x1e'),_0x1ce692,_0x472162[_0x6f95('0xa')]);_0x4c4089[_0x6f95('0x12')]();}}}catch(_0x5acc29){console['log'](_0x5acc29);logger[_0x6f95('0xe')]('[%s][QUEUE]\x20%s',_0x1ce692,_0x5acc29[_0x6f95('0x1f')]);_0x4c4089[_0x6f95('0x12')]();}};}; \ No newline at end of file +var _0x322d=['stop','agents','timeout','createQueue','channel','START:%s','rules','end','info','[%s][AGENT]\x20ROUTING\x20STOPPED','close','[%s][AGENT]\x20ROUTING\x20END','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','stack','validate','util','../../../../config/logger','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','error','[%s][AGENT]\x20%s','message'];(function(_0x53b55f,_0x7980d0){var _0x71d9fa=function(_0x1c30c2){while(--_0x1c30c2){_0x53b55f['push'](_0x53b55f['shift']());}};_0x71d9fa(++_0x7980d0);}(_0x322d,0x121));var _0xd322=function(_0x2f0510,_0x193e90){_0x2f0510=_0x2f0510-0x0;var _0x2ef5b8=_0x322d[_0x2f0510];return _0x2ef5b8;};'use strict';var schema=require(_0xd322('0x0'));var _=require('lodash');var util=require(_0xd322('0x1'));var seqqueue=require('seq-queue');var logger=require(_0xd322('0x2'))(_0xd322('0x3'));var strategy=require(_0xd322('0x4'));var queue=schema({'name':{'type':_0xd322('0x5'),'required':!![],'message':_0xd322('0x6')},'timeout':{'type':_0xd322('0x7'),'message':_0xd322('0x8')}});function writeLog(_0x406c2f,_0x582a6d,_0x11c722){return logger['info'](util[_0xd322('0x9')](_0xd322('0xa'),_0x406c2f,_0x582a6d[_0xd322('0xb')],_0x11c722));}function handleFindAgent(_0x2d108c){return function(_0x43dc4e){return _0x43dc4e['name']['toLowerCase']()===_0x2d108c[_0xd322('0xc')]();};}exports[_0xd322('0xd')]=function(_0x4ad8cf,_0x4dec09,_0x297f60,_0x5d62ac){return function(_0x254a45){try{var _0xec6bde={'name':_0x4dec09[0x0],'timeout':_0x4dec09[0x1]};var _0x3b59cb=queue['validate'](_0xec6bde,{'typecast':!![]});if(_0x3b59cb['length']){logger[_0xd322('0xe')](_0xd322('0xf'),_0x4ad8cf,_['map'](_0x3b59cb,_0xd322('0x10'))['join'](',\x20'));_0x254a45[_0xd322('0x11')]();}else{var _0x111066=_['find'](_0x297f60[_0xd322('0x12')],handleFindAgent(_0xec6bde[_0xd322('0xb')]));if(_0x111066){var _0x429309=(_0xec6bde[_0xd322('0x13')]||0xa)*0x3e8;var _0x2c2887,_0x1ac2fd;var _0x31d801=seqqueue[_0xd322('0x14')](_0x429309);_0x31d801['id']=_0x4ad8cf;_0x31d801['atimeout']=_0x429309;_0x31d801[_0xd322('0x15')]=_0x5d62ac[_0xd322('0x15')];writeLog(_0x4ad8cf,_0x111066,util['format'](_0xd322('0x16'),_0x429309));_0x297f60[_0xd322('0x17')][_0x4ad8cf]['on'](_0xd322('0x18'),function(){logger[_0xd322('0x19')](_0xd322('0x1a'),_0x4ad8cf);clearTimeout(_0x1ac2fd);_0x1ac2fd=undefined;_0x31d801[_0xd322('0x1b')]();if(_0x297f60[_0xd322('0x17')][_0x4ad8cf]){delete _0x297f60[_0xd322('0x17')][_0x4ad8cf];}_0x254a45['stop']();});_0x297f60[_0xd322('0x17')][_0x4ad8cf]['on']('complete',function(){if(_0x297f60[_0xd322('0x17')][_0x4ad8cf]){delete _0x297f60[_0xd322('0x17')][_0x4ad8cf];}});_0x1ac2fd=setTimeout(function(){logger['info'](_0xd322('0x1c'),_0x4ad8cf);clearTimeout(_0x1ac2fd);_0x31d801['close']();_0x254a45[_0xd322('0x1d')]();},_0x429309);strategy[_0xd322('0x1e')](_0x31d801,_0x111066,_0x297f60,_0x5d62ac);}else{logger[_0xd322('0xe')](_0xd322('0x1f'),_0x4ad8cf,_0xec6bde[_0xd322('0xb')]);_0x254a45[_0xd322('0x11')]();}}}catch(_0x50d35d){console[_0xd322('0x20')](_0x50d35d);logger['error']('[%s][QUEUE]\x20%s',_0x4ad8cf,_0x50d35d[_0xd322('0x21')]);_0x254a45['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 a054a34..6bba838 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 _0xfd27=['[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','LexRuntime','$LATEST','toString','message','amazonlex','then','dialogState','lodash','moment','aws-sdk','./utils','routing','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','isNil','interaction','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','channel','sms','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','isEmpty','body','getMustacheRender','Message','create','info','[%s][AMAZONLEX]\x20%s','catch','error','stringify'];(function(_0x282ed6,_0x1244f6){var _0x1f85ca=function(_0x2083b6){while(--_0x2083b6){_0x282ed6['push'](_0x282ed6['shift']());}};_0x1f85ca(++_0x1244f6);}(_0xfd27,0xbe));var _0x7fd2=function(_0x547496,_0x31d82d){_0x547496=_0x547496-0x0;var _0x440b97=_0xfd27[_0x547496];return _0x440b97;};'use strict';var _=require(_0x7fd2('0x0'));var moment=require(_0x7fd2('0x1'));var AWS=require(_0x7fd2('0x2'));var utils=require(_0x7fd2('0x3'));var logger=require('../../../../config/logger')(_0x7fd2('0x4'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x7fd2('0x5')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x7fd2('0x6')),'faxMessage':require(_0x7fd2('0x7')),'whatsappMessage':require(_0x7fd2('0x8'))};exports['consequence']=function(_0x16e111,_0x22ccde){return function(_0x468c2a){try{if(!_[_0x7fd2('0x9')](this[_0x7fd2('0xa')][_0x7fd2('0xb')])){logger['info']('[%s][AMAZONLEX]\x20%s',_0x16e111,_0x7fd2('0xc'));return _0x468c2a[_0x7fd2('0xd')]();}var _0x41e5b0={'ContactId':this[_0x7fd2('0xe')]['id'],'sentAt':moment()[_0x7fd2('0xf')](_0x7fd2('0x10')),'direction':'out'};if(this[_0x7fd2('0x11')]===_0x7fd2('0x12')||this[_0x7fd2('0x11')]==='whatsapp'){_0x41e5b0[_0x7fd2('0x13')]=this[_0x7fd2('0xa')][_0x7fd2('0x13')];}var _0xee614=this[_0x7fd2('0x11')];if(_0xee614===_0x7fd2('0x14')){_0x41e5b0[_0x7fd2('0x15')]=this[_0x7fd2('0x16')]['id'];}else{_0x41e5b0[_[_0x7fd2('0x17')](_0xee614)+_0x7fd2('0x18')]=this[_0x7fd2('0x16')]['id'];}_0x41e5b0[_[_0x7fd2('0x17')](_0xee614)+'InteractionId']=this[_0x7fd2('0xa')]['id'];if(this[_0x7fd2('0xa')]['created']){var _0x1e2275=_0x22ccde[0x4];if(!_[_0x7fd2('0x19')](_0x1e2275)){_0x41e5b0[_0x7fd2('0x1a')]=utils[_0x7fd2('0x1b')](_0x1e2275,this);return rpc[_0xee614+_0x7fd2('0x1c')][_0x7fd2('0x1d')](_0x41e5b0)['then'](function(_0x2166b5){logger[_0x7fd2('0x1e')](_0x7fd2('0x1f'),_0x16e111,_0x41e5b0[_0x7fd2('0x1a')]);})[_0x7fd2('0x20')](function(_0x50aae8){logger[_0x7fd2('0x21')](_0x7fd2('0x1f'),_0x16e111,JSON[_0x7fd2('0x22')](_0x50aae8));})['finally'](function(){logger[_0x7fd2('0x1e')](_0x7fd2('0x23'),_0x16e111);_0x468c2a['stop']();});}else{logger['info'](_0x7fd2('0x24'),_0x16e111);_0x468c2a[_0x7fd2('0x25')]();}}else{var _0x626067=this;var _0x4b13ba=new AWS[(_0x7fd2('0x26'))]({'accessKeyId':_0x22ccde[0x0],'secretAccessKey':_0x22ccde[0x1],'region':_0x22ccde[0x2]});var _0xa21a27={'botAlias':_0x7fd2('0x27'),'botName':_0x22ccde[0x3],'inputText':this['message'][_0x7fd2('0x1a')],'userId':this[_0x7fd2('0x11')]+':'+this[_0x7fd2('0xa')]['id'][_0x7fd2('0x28')]()};_0x4b13ba['postText'](_0xa21a27,function(_0x360ffa,_0x3590de){if(_0x360ffa){logger[_0x7fd2('0x21')]('[%s][AMAZONLEX]\x20%s',_0x16e111,_0x360ffa[_0x7fd2('0x29')]);_0x468c2a[_0x7fd2('0xd')]();}else if(_0x3590de&&_0x3590de['message']){_0x626067['body'][_0x7fd2('0x2a')]=_0x3590de;_0x41e5b0['body']=_0x3590de[_0x7fd2('0x29')];_0x41e5b0['providerName']='amazonlex';_0x41e5b0['providerResponse']=JSON[_0x7fd2('0x22')](_0x3590de);return rpc[_0xee614+_0x7fd2('0x1c')][_0x7fd2('0x1d')](_0x41e5b0)[_0x7fd2('0x2b')](function(_0x48ccc0){logger['info'](_0x7fd2('0x1f'),_0x16e111,_0x41e5b0[_0x7fd2('0x1a')]);if(_0x3590de[_0x7fd2('0x2c')]=='Failed'){_0x468c2a['next']();}else{_0x468c2a['stop']();}})[_0x7fd2('0x20')](function(_0x2c66e2){logger[_0x7fd2('0x21')](_0x7fd2('0x1f'),_0x16e111,JSON[_0x7fd2('0x22')](_0x2c66e2));_0x468c2a[_0x7fd2('0xd')]();});}else{_0x468c2a[_0x7fd2('0xd')]();}});}}catch(_0x1fb1a0){logger[_0x7fd2('0x21')](_0x7fd2('0x1f'),_0x16e111,JSON[_0x7fd2('0x22')](_0x1fb1a0));_0x468c2a[_0x7fd2('0x25')]();}};}; \ No newline at end of file +var _0x9196=['then','body','catch','error','stringify','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','message','toString','amazonlex','providerResponse','create','dialogState','Failed','lodash','moment','aws-sdk','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','isNil','interaction','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','format','YYYY-MM-DD\x20HH:mm:ss','out','sms','channel','phone','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','isEmpty','Message'];(function(_0x45dd9e,_0xad4da0){var _0x35a357=function(_0x32a1d0){while(--_0x32a1d0){_0x45dd9e['push'](_0x45dd9e['shift']());}};_0x35a357(++_0xad4da0);}(_0x9196,0x152));var _0x6919=function(_0x23e6bb,_0x5c2d69){_0x23e6bb=_0x23e6bb-0x0;var _0x1e3b4c=_0x9196[_0x23e6bb];return _0x1e3b4c;};'use strict';var _=require(_0x6919('0x0'));var moment=require(_0x6919('0x1'));var AWS=require(_0x6919('0x2'));var utils=require('./utils');var logger=require(_0x6919('0x3'))(_0x6919('0x4'));var rpc={'chatMessage':require(_0x6919('0x5')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x6919('0x6')),'smsMessage':require(_0x6919('0x7')),'faxMessage':require(_0x6919('0x8')),'whatsappMessage':require(_0x6919('0x9'))};exports['consequence']=function(_0x558c89,_0x594a7e){return function(_0x23df19){try{if(!_[_0x6919('0xa')](this[_0x6919('0xb')]['UserId'])){logger[_0x6919('0xc')](_0x6919('0xd'),_0x558c89,_0x6919('0xe'));return _0x23df19[_0x6919('0xf')]();}var _0x256e44={'ContactId':this['contact']['id'],'sentAt':moment()[_0x6919('0x10')](_0x6919('0x11')),'direction':_0x6919('0x12')};if(this['channel']===_0x6919('0x13')||this[_0x6919('0x14')]==='whatsapp'){_0x256e44[_0x6919('0x15')]=this[_0x6919('0xb')]['phone'];}var _0x5358ec=this[_0x6919('0x14')];if(_0x5358ec==='chat'){_0x256e44[_0x6919('0x16')]=this[_0x6919('0x17')]['id'];}else{_0x256e44[_[_0x6919('0x18')](_0x5358ec)+_0x6919('0x19')]=this[_0x6919('0x17')]['id'];}_0x256e44[_['upperFirst'](_0x5358ec)+_0x6919('0x1a')]=this['interaction']['id'];if(this[_0x6919('0xb')][_0x6919('0x1b')]){var _0x55dfb9=_0x594a7e[0x4];if(!_[_0x6919('0x1c')](_0x55dfb9)){_0x256e44['body']=utils['getMustacheRender'](_0x55dfb9,this);return rpc[_0x5358ec+_0x6919('0x1d')]['create'](_0x256e44)[_0x6919('0x1e')](function(_0x140666){logger['info'](_0x6919('0xd'),_0x558c89,_0x256e44[_0x6919('0x1f')]);})[_0x6919('0x20')](function(_0x36489f){logger[_0x6919('0x21')](_0x6919('0xd'),_0x558c89,JSON[_0x6919('0x22')](_0x36489f));})['finally'](function(){logger[_0x6919('0xc')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x558c89);_0x23df19[_0x6919('0x23')]();});}else{logger['info'](_0x6919('0x24'),_0x558c89);_0x23df19['stop']();}}else{var _0x44a4f1=this;var _0x5d1e67=new AWS[(_0x6919('0x25'))]({'accessKeyId':_0x594a7e[0x0],'secretAccessKey':_0x594a7e[0x1],'region':_0x594a7e[0x2]});var _0x10494a={'botAlias':_0x6919('0x26'),'botName':_0x594a7e[0x3],'inputText':this[_0x6919('0x27')][_0x6919('0x1f')],'userId':this[_0x6919('0x14')]+':'+this[_0x6919('0xb')]['id'][_0x6919('0x28')]()};_0x5d1e67['postText'](_0x10494a,function(_0x35042a,_0x21085c){if(_0x35042a){logger[_0x6919('0x21')](_0x6919('0xd'),_0x558c89,_0x35042a[_0x6919('0x27')]);_0x23df19[_0x6919('0xf')]();}else if(_0x21085c&&_0x21085c['message']){_0x44a4f1[_0x6919('0x1f')][_0x6919('0x29')]=_0x21085c;_0x256e44[_0x6919('0x1f')]=_0x21085c[_0x6919('0x27')];_0x256e44['providerName']='amazonlex';_0x256e44[_0x6919('0x2a')]=JSON['stringify'](_0x21085c);return rpc[_0x5358ec+_0x6919('0x1d')][_0x6919('0x2b')](_0x256e44)[_0x6919('0x1e')](function(_0x1444c6){logger[_0x6919('0xc')](_0x6919('0xd'),_0x558c89,_0x256e44[_0x6919('0x1f')]);if(_0x21085c[_0x6919('0x2c')]==_0x6919('0x2d')){_0x23df19[_0x6919('0xf')]();}else{_0x23df19[_0x6919('0x23')]();}})[_0x6919('0x20')](function(_0x24ba9d){logger[_0x6919('0x21')](_0x6919('0xd'),_0x558c89,JSON[_0x6919('0x22')](_0x24ba9d));_0x23df19['next']();});}else{_0x23df19['next']();}});}}catch(_0x474e7a){logger[_0x6919('0x21')](_0x6919('0xd'),_0x558c89,JSON[_0x6919('0x22')](_0x474e7a));_0x23df19[_0x6919('0x23')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/autoreply.js b/server/services/routing/server/applications/autoreply.js index 443f159..7df8c44 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 _0xa400=['startsWith','Re:','chat','ChatWebsiteId','account','upperFirst','AccountId','Message','inReplyTo','messageId','','replace','';_0x5ebd60[_0x0a40('0x2d')]={'Auto-Submitted':_0x0a40('0x2e'),'X-Auto-Response-Suppress':_0x0a40('0x2f'),'Precedence':_0x0a40('0x30')};return mailRpc[_0x0a40('0x31')](this['account'][_0x0a40('0x32')],_0x5ebd60)[_0x0a40('0x33')](function(_0x396694){logger['info'](_0x0a40('0x34'),_0x4be5fd);_0x5ebd60['messageId']=_0x396694['message']['messageId'];return rpc[_0x123734+'Message'][_0x0a40('0x35')](_0x5ebd60);})[_0x0a40('0x33')](function(_0x372b46){logger[_0x0a40('0x10')](_0x0a40('0x11'),_0x4be5fd,JSON[_0x0a40('0x36')](_0x372b46));})[_0x0a40('0x37')](function(_0x250496){logger[_0x0a40('0x38')](_0x0a40('0x39'),_0x4be5fd,JSON[_0x0a40('0x36')](_0x250496));})[_0x0a40('0x3a')](function(){Promise[_0x0a40('0x3b')]()[_0x0a40('0x33')](function(){if(_0x1ffed4[0x0]!=='2'||_0x2d9157[_0x0a40('0x3c')])return;return rpc[_0x123734+_0x0a40('0x3d')][_0x0a40('0x3e')](_0x2d9157['id'],{'autoreplyExecuted':!![]})[_0x0a40('0x33')](function(_0x68fdfa){logger['info'](_0x0a40('0x3f'),_0x4be5fd,JSON[_0x0a40('0x36')](_0x68fdfa));})[_0x0a40('0x37')](function(_0x35b609){logger[_0x0a40('0x38')](_0x0a40('0x40'),_0x4be5fd,JSON[_0x0a40('0x36')](_0x35b609));});})[_0x0a40('0x33')](function(){_0x10a34d[_0x0a40('0x16')]();});});}else{return rpc[this['channel']+_0x0a40('0x27')][_0x0a40('0x35')](_0x5ebd60)[_0x0a40('0x33')](function(){logger[_0x0a40('0x10')](_0x0a40('0x11'),_0x4be5fd,_0x5ebd60[_0x0a40('0xe')]);})[_0x0a40('0x37')](function(_0x2a8e28){logger[_0x0a40('0x38')]('[%s][AUTOREPLY]\x20%s',_0x4be5fd,JSON[_0x0a40('0x36')](_0x2a8e28));})['finally'](function(){Promise['resolve']()['then'](function(){if(_0x1ffed4[0x0]!=='2'||_0x2d9157[_0x0a40('0x3c')])return;return rpc[_0x123734+_0x0a40('0x3d')]['update'](_0x2d9157['id'],{'autoreplyExecuted':!![]})[_0x0a40('0x33')](function(_0x467b52){logger[_0x0a40('0x10')](_0x0a40('0x3f'),_0x4be5fd,JSON[_0x0a40('0x36')](_0x467b52));})['catch'](function(_0x2857ab){logger['error'](_0x0a40('0x40'),_0x4be5fd,JSON[_0x0a40('0x36')](_0x2857ab));});})[_0x0a40('0x33')](function(){_0x10a34d[_0x0a40('0x16')]();});});}}}catch(_0x504b5b){logger['error'](_0x0a40('0x11'),_0x4be5fd,JSON[_0x0a40('0x36')](_0x504b5b));_0x10a34d[_0x0a40('0x41')]();}};}; \ No newline at end of file +var _0x6605=['account','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','create','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s','finally','resolve','autoreplyExecuted','update','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','Interaction','stop','moment','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','mail','isAutoreply','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','isNil','interaction','created','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','body','getMustacheRender','from','message','phone','subject','startsWith','Re:\x20','upperFirst','Message','inReplyTo','messageId','html','','','headers','auto-replied','All','auto_reply','sendMailMessage'];(function(_0x176d79,_0x4a2312){var _0x2ed8f6=function(_0x1ad096){while(--_0x1ad096){_0x176d79['push'](_0x176d79['shift']());}};_0x2ed8f6(++_0x4a2312);}(_0x6605,0x127));var _0x5660=function(_0x4855ec,_0x479ac0){_0x4855ec=_0x4855ec-0x0;var _0x37e324=_0x6605[_0x4855ec];return _0x37e324;};'use strict';var _=require('lodash');var moment=require(_0x5660('0x0'));var utils=require(_0x5660('0x1'));var logger=require(_0x5660('0x2'))(_0x5660('0x3'));var rpc={'chatMessage':require(_0x5660('0x4')),'openchannelMessage':require(_0x5660('0x5')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x5660('0x6')),'faxMessage':require(_0x5660('0x7')),'whatsappMessage':require(_0x5660('0x8')),'chatInteraction':require(_0x5660('0x9')),'openchannelInteraction':require(_0x5660('0xa')),'mailInteraction':require(_0x5660('0xb')),'smsInteraction':require(_0x5660('0xc')),'faxInteraction':require(_0x5660('0xd')),'whatsappInteraction':require(_0x5660('0xe'))};var mailRpc=require(_0x5660('0xf'));exports[_0x5660('0x10')]=function(_0x2b726b,_0x5eed6e,_0x127f44,_0x5c7b8c){return function(_0x139fc9){try{var _0x468bd5=this['channel'];if(_0x468bd5===_0x5660('0x11')&&_0x5c7b8c['body'][_0x5660('0x12')]){logger[_0x5660('0x13')](_0x5660('0x14'),_0x2b726b,_0x5660('0x15'));return _0x139fc9[_0x5660('0x16')]();}if(_0x5eed6e[0x0]==='1'&&(_[_0x5660('0x17')](this[_0x5660('0x18')][_0x5660('0x19')])||!this[_0x5660('0x18')][_0x5660('0x19')])){logger[_0x5660('0x13')]('[%s][AUTOREPLY]\x20%s',_0x2b726b,'Autoreply\x20already\x20sent');return _0x139fc9['next']();}if(_0x5eed6e[0x0]==='2'&&this[_0x5660('0x18')]['autoreplyExecuted']){logger['info'](_0x5660('0x1a'),_0x2b726b,_0x5660('0x1b'));return _0x139fc9[_0x5660('0x16')]();}var _0x1fb212={'ContactId':this[_0x5660('0x1c')]['id'],'sentAt':moment()[_0x5660('0x1d')](_0x5660('0x1e')),'direction':_0x5660('0x1f')};if(this[_0x5660('0x20')]===_0x5660('0x11')){_0x1fb212[_0x5660('0x21')]=utils['getMustacheRender'](_0x5eed6e[0x2],this);}else{_0x1fb212['body']=utils[_0x5660('0x22')](_0x5eed6e[0x1],this);}if(this['message']){_0x1fb212['to']=this['message'][_0x5660('0x23')]||'';if(this[_0x5660('0x20')]==='mail'&&_0x5eed6e[0x1]==='1'){_0x1fb212['cc']=this[_0x5660('0x24')]['cc']||'';}_0x1fb212[_0x5660('0x23')]=this['message']['to']||'';_0x1fb212[_0x5660('0x25')]=this['message'][_0x5660('0x25')]||'';_0x1fb212['read']=!![];if(this[_0x5660('0x24')][_0x5660('0x26')]){_0x1fb212[_0x5660('0x26')]='';_0x1fb212[_0x5660('0x26')]+=_[_0x5660('0x27')](this[_0x5660('0x24')]['subject'],'Re:')?'':_0x5660('0x28');_0x1fb212[_0x5660('0x26')]+=this[_0x5660('0x24')][_0x5660('0x26')];}}if(this[_0x5660('0x20')]==='chat'){_0x1fb212['ChatWebsiteId']=this['account']['id'];}else{_0x1fb212[_['upperFirst'](this[_0x5660('0x20')])+'AccountId']=this['account']['id'];}_0x1fb212[_[_0x5660('0x29')](this[_0x5660('0x20')])+'InteractionId']=this[_0x5660('0x18')]['id'];var _0x136ebc=this[_0x5660('0x18')];if(rpc[this[_0x5660('0x20')]+_0x5660('0x2a')]){if(this[_0x5660('0x20')]===_0x5660('0x11')){_0x1fb212[_0x5660('0x2b')]=this[_0x5660('0x24')][_0x5660('0x2c')];_0x1fb212[_0x5660('0x2d')]=_0x5660('0x2e')+_['replace'](_0x1fb212[_0x5660('0x21')],_0x5660('0x2f'),_0x5660('0x30'))+_0x5660('0x31');_0x1fb212[_0x5660('0x32')]={'Auto-Submitted':_0x5660('0x33'),'X-Auto-Response-Suppress':_0x5660('0x34'),'Precedence':_0x5660('0x35')};return mailRpc[_0x5660('0x36')](this[_0x5660('0x37')]['smtpOptions'],_0x1fb212)[_0x5660('0x38')](function(_0x2dfa66){logger[_0x5660('0x13')](_0x5660('0x39'),_0x2b726b);_0x1fb212['messageId']=_0x2dfa66[_0x5660('0x24')][_0x5660('0x2c')];return rpc[_0x468bd5+_0x5660('0x2a')][_0x5660('0x3a')](_0x1fb212);})['then'](function(_0x1473be){logger[_0x5660('0x13')](_0x5660('0x14'),_0x2b726b,JSON[_0x5660('0x3b')](_0x1473be));})[_0x5660('0x3c')](function(_0x4c6603){logger[_0x5660('0x3d')](_0x5660('0x3e'),_0x2b726b,JSON[_0x5660('0x3b')](_0x4c6603));})[_0x5660('0x3f')](function(){Promise[_0x5660('0x40')]()[_0x5660('0x38')](function(){if(_0x5eed6e[0x0]!=='2'||_0x136ebc[_0x5660('0x41')])return;return rpc[_0x468bd5+'Interaction'][_0x5660('0x42')](_0x136ebc['id'],{'autoreplyExecuted':!![]})['then'](function(_0x422ef4){logger[_0x5660('0x13')](_0x5660('0x1a'),_0x2b726b,JSON[_0x5660('0x3b')](_0x422ef4));})[_0x5660('0x3c')](function(_0x349138){logger['error'](_0x5660('0x43'),_0x2b726b,JSON['stringify'](_0x349138));});})[_0x5660('0x38')](function(){_0x139fc9[_0x5660('0x16')]();});});}else{return rpc[this[_0x5660('0x20')]+_0x5660('0x2a')][_0x5660('0x3a')](_0x1fb212)[_0x5660('0x38')](function(){logger['info'](_0x5660('0x14'),_0x2b726b,_0x1fb212['body']);})[_0x5660('0x3c')](function(_0x29901b){logger[_0x5660('0x3d')](_0x5660('0x14'),_0x2b726b,JSON[_0x5660('0x3b')](_0x29901b));})[_0x5660('0x3f')](function(){Promise[_0x5660('0x40')]()[_0x5660('0x38')](function(){if(_0x5eed6e[0x0]!=='2'||_0x136ebc[_0x5660('0x41')])return;return rpc[_0x468bd5+_0x5660('0x44')][_0x5660('0x42')](_0x136ebc['id'],{'autoreplyExecuted':!![]})[_0x5660('0x38')](function(_0xdd56ab){logger[_0x5660('0x13')](_0x5660('0x1a'),_0x2b726b,JSON[_0x5660('0x3b')](_0xdd56ab));})[_0x5660('0x3c')](function(_0x32d2aa){logger[_0x5660('0x3d')]('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x2b726b,JSON[_0x5660('0x3b')](_0x32d2aa));});})[_0x5660('0x38')](function(){_0x139fc9[_0x5660('0x16')]();});});}}}catch(_0x3b5393){logger[_0x5660('0x3d')](_0x5660('0x14'),_0x2b726b,JSON[_0x5660('0x3b')](_0x3b5393));_0x139fc9[_0x5660('0x45')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/close.js b/server/services/routing/server/applications/close.js index 74b60c3..32c6cc6 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 _0x3d48=['routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','info','[%s][CLOSE]\x20reason\x20%s','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'];(function(_0x212a37,_0xf35b2e){var _0x5d0bf9=function(_0x51850f){while(--_0x51850f){_0x212a37['push'](_0x212a37['shift']());}};_0x5d0bf9(++_0xf35b2e);}(_0x3d48,0x106));var _0x83d4=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x3d48[_0x4565bf];return _0x5610ba;};'use strict';var moment=require(_0x83d4('0x0'));var logger=require(_0x83d4('0x1'))(_0x83d4('0x2'));var rpc={'chatInteraction':require(_0x83d4('0x3')),'openchannelInteraction':require(_0x83d4('0x4')),'smsInteraction':require(_0x83d4('0x5')),'mailInteraction':require(_0x83d4('0x6')),'faxInteraction':require(_0x83d4('0x7')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};exports['consequence']=function(_0x2961b5,_0x120926,_0xcc3f5d,_0x448707){return function(_0x40d510){try{logger[_0x83d4('0x8')](_0x83d4('0x9'),_0x2961b5,_0x120926[0x0]);var _0x12f7d7={'closed':0x1,'closedAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'closeReason':'system','disposition':_0x120926[0x0]};if(rpc[_0x448707[_0x83d4('0xa')]+'Interaction']){rpc[_0x448707[_0x83d4('0xa')]+_0x83d4('0xb')][_0x83d4('0xc')](_0x448707[_0x83d4('0xd')]['id'],_0x12f7d7)[_0x83d4('0xe')](function(_0x4b991e){logger[_0x83d4('0x8')](_0x83d4('0xf'),_0x2961b5,_0x448707[_0x83d4('0xd')]['id']);})[_0x83d4('0x10')](function(_0x27a7f3){logger[_0x83d4('0x11')](_0x83d4('0x12'),_0x2961b5,JSON[_0x83d4('0x13')](_0x27a7f3));})[_0x83d4('0x14')](function(){_0x40d510['stop']();});}}catch(_0x21a912){logger['error'](_0x83d4('0x12'),_0x2961b5,JSON['stringify'](_0x21a912));_0x40d510[_0x83d4('0x15')]();}};}; \ No newline at end of file +var _0x906a=['routing','../../rpc/chatInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction','consequence','info','Interaction','interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','error','[%s][CLOSE]\x20%s','stringify','finally','stop','moment'];(function(_0x30968c,_0x2e5071){var _0x517b57=function(_0x1a938f){while(--_0x1a938f){_0x30968c['push'](_0x30968c['shift']());}};_0x517b57(++_0x2e5071);}(_0x906a,0xd7));var _0xa906=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x906a[_0xa464c9];return _0x3d73c4;};'use strict';var moment=require(_0xa906('0x0'));var logger=require('../../../../config/logger')(_0xa906('0x1'));var rpc={'chatInteraction':require(_0xa906('0x2')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0xa906('0x3')),'mailInteraction':require(_0xa906('0x4')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0xa906('0x5'))};exports[_0xa906('0x6')]=function(_0x4edc4d,_0xcc486b,_0x2ecbf9,_0x249487){return function(_0x1cbde0){try{logger[_0xa906('0x7')]('[%s][CLOSE]\x20reason\x20%s',_0x4edc4d,_0xcc486b[0x0]);var _0x5cd61c={'closed':0x1,'closedAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'closeReason':'system','disposition':_0xcc486b[0x0]};if(rpc[_0x249487['channel']+_0xa906('0x8')]){rpc[_0x249487['channel']+'Interaction']['update'](_0x249487[_0xa906('0x9')]['id'],_0x5cd61c)[_0xa906('0xa')](function(_0x4df85e){logger[_0xa906('0x7')](_0xa906('0xb'),_0x4edc4d,_0x249487[_0xa906('0x9')]['id']);})[_0xa906('0xc')](function(_0xf91680){logger[_0xa906('0xd')](_0xa906('0xe'),_0x4edc4d,JSON[_0xa906('0xf')](_0xf91680));})[_0xa906('0x10')](function(){_0x1cbde0[_0xa906('0x11')]();});}}catch(_0x400429){logger[_0xa906('0xd')]('[%s][CLOSE]\x20%s',_0x4edc4d,JSON[_0xa906('0xf')](_0x400429));_0x1cbde0[_0xa906('0x11')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflow.js b/server/services/routing/server/applications/dialogflow.js index c04bb7d..71d0381 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 _0x9d5c=['error','stringify','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','dialogflow','result','fulfillment','speech','providerResponse','Message','metadata','endConversation','next','catch','lodash','apiai-promise','md5','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','[%s][DIALOGFLOW]\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','chat','ChatWebsiteId','upperFirst','AccountId','InteractionId','created','isEmpty','getMustacheRender','create','then','body'];(function(_0x320689,_0x33823b){var _0x3b1a32=function(_0x2db06d){while(--_0x2db06d){_0x320689['push'](_0x320689['shift']());}};_0x3b1a32(++_0x33823b);}(_0x9d5c,0x98));var _0xc9d5=function(_0xba81b4,_0x3f3f6c){_0xba81b4=_0xba81b4-0x0;var _0x4deabd=_0x9d5c[_0xba81b4];return _0x4deabd;};'use strict';var _=require(_0xc9d5('0x0'));var moment=require('moment');var apiai=require(_0xc9d5('0x1'));var md5=require(_0xc9d5('0x2'));var utils=require('./utils');var logger=require(_0xc9d5('0x3'))(_0xc9d5('0x4'));var rpc={'chatMessage':require(_0xc9d5('0x5')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xc9d5('0x6')),'smsMessage':require(_0xc9d5('0x7')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xc9d5('0x8'))};exports[_0xc9d5('0x9')]=function(_0x1a91f5,_0x955d2d){return function(_0x2edfbc){try{if(!_[_0xc9d5('0xa')](this[_0xc9d5('0xb')][_0xc9d5('0xc')])){logger[_0xc9d5('0xd')](_0xc9d5('0xe'),_0x1a91f5,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x2edfbc['next']();}var _0x53816b={'ContactId':this['contact']['id'],'sentAt':moment()[_0xc9d5('0xf')](_0xc9d5('0x10')),'direction':_0xc9d5('0x11')};if(this[_0xc9d5('0x12')]===_0xc9d5('0x13')||this[_0xc9d5('0x12')]===_0xc9d5('0x14')){_0x53816b['phone']=this['interaction']['phone'];}var _0x2c40c2=this[_0xc9d5('0x12')];if(_0x2c40c2===_0xc9d5('0x15')){_0x53816b[_0xc9d5('0x16')]=this['account']['id'];}else{_0x53816b[_[_0xc9d5('0x17')](_0x2c40c2)+_0xc9d5('0x18')]=this['account']['id'];}_0x53816b[_[_0xc9d5('0x17')](_0x2c40c2)+_0xc9d5('0x19')]=this['interaction']['id'];if(this['interaction'][_0xc9d5('0x1a')]){var _0x7d5471=_0x955d2d[0x2];if(!_[_0xc9d5('0x1b')](_0x7d5471)){_0x53816b['body']=utils[_0xc9d5('0x1c')](_0x7d5471,this);return rpc[_0x2c40c2+'Message'][_0xc9d5('0x1d')](_0x53816b)[_0xc9d5('0x1e')](function(_0x3105d2){logger[_0xc9d5('0xd')]('[%s][DIALOGFLOW]\x20%s',_0x1a91f5,_0x53816b[_0xc9d5('0x1f')]);})['catch'](function(_0x4431d2){logger[_0xc9d5('0x20')](_0xc9d5('0xe'),_0x1a91f5,JSON[_0xc9d5('0x21')](_0x4431d2));})['finally'](function(){logger[_0xc9d5('0xd')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x1a91f5);_0x2edfbc['stop']();});}else{logger[_0xc9d5('0xd')](_0xc9d5('0x22'),_0x1a91f5);_0x2edfbc[_0xc9d5('0x23')]();}}else{var _0x7ce117=this;var _0x1447c9=apiai(_0x955d2d[0x0],{'language':_0x955d2d[0x1]||'en'});return _0x1447c9['textRequest'](this['message'][_0xc9d5('0x1f')],{'sessionId':md5(this[_0xc9d5('0xb')]['id'])})[_0xc9d5('0x1e')](function(_0x1424c9){_0x7ce117[_0xc9d5('0x1f')][_0xc9d5('0x24')]=_0x1424c9;_0x53816b[_0xc9d5('0x1f')]=_0x1424c9[_0xc9d5('0x25')][_0xc9d5('0x26')][_0xc9d5('0x27')];_0x53816b['providerName']=_0xc9d5('0x24');_0x53816b[_0xc9d5('0x28')]=JSON[_0xc9d5('0x21')](_0x1424c9);return rpc[_0x2c40c2+_0xc9d5('0x29')][_0xc9d5('0x1d')](_0x53816b)[_0xc9d5('0x1e')](function(_0x41a5d7){logger['info'](_0xc9d5('0xe'),_0x1a91f5,_0x53816b[_0xc9d5('0x1f')]);if(_0x1424c9['result'][_0xc9d5('0x2a')][_0xc9d5('0x2b')]){_0x2edfbc[_0xc9d5('0x2c')]();}else{_0x2edfbc[_0xc9d5('0x23')]();}})[_0xc9d5('0x2d')](function(_0x3ab4bc){logger[_0xc9d5('0x20')](_0xc9d5('0xe'),_0x1a91f5,JSON[_0xc9d5('0x21')](_0x3ab4bc));_0x2edfbc['next']();});})[_0xc9d5('0x2d')](function(_0x41d217){logger[_0xc9d5('0x20')]('[%s][DIALOGFLOW]\x20%s',_0x1a91f5,_0x41d217['message']);_0x2edfbc['next']();});}}catch(_0x58991f){logger[_0xc9d5('0x20')](_0xc9d5('0xe'),_0x1a91f5,JSON[_0xc9d5('0x21')](_0x58991f));_0x2edfbc[_0xc9d5('0x23')]();}};}; \ No newline at end of file +var _0x0a6b=['whatsapp','phone','interaction','chat','account','AccountId','upperFirst','created','body','getMustacheRender','Message','create','then','catch','error','finally','info','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','dialogflow','result','fulfillment','speech','providerName','stringify','metadata','endConversation','message','lodash','./utils','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','isNil','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','format','YYYY-MM-DD\x20HH:mm:ss','channel','sms'];(function(_0x22fed1,_0x49d271){var _0x263f8b=function(_0x1a67f9){while(--_0x1a67f9){_0x22fed1['push'](_0x22fed1['shift']());}};_0x263f8b(++_0x49d271);}(_0x0a6b,0x18e));var _0xb0a6=function(_0x371187,_0xe7b303){_0x371187=_0x371187-0x0;var _0x37eaae=_0x0a6b[_0x371187];return _0x37eaae;};'use strict';var _=require(_0xb0a6('0x0'));var moment=require('moment');var apiai=require('apiai-promise');var md5=require('md5');var utils=require(_0xb0a6('0x1'));var logger=require('../../../../config/logger')(_0xb0a6('0x2'));var rpc={'chatMessage':require(_0xb0a6('0x3')),'openchannelMessage':require(_0xb0a6('0x4')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xb0a6('0x5')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xb0a6('0x6'))};exports[_0xb0a6('0x7')]=function(_0x5e2d2d,_0x11cd5b){return function(_0x24515c){try{if(!_[_0xb0a6('0x8')](this['interaction']['UserId'])){logger['info'](_0xb0a6('0x9'),_0x5e2d2d,_0xb0a6('0xa'));return _0x24515c[_0xb0a6('0xb')]();}var _0xda225c={'ContactId':this['contact']['id'],'sentAt':moment()[_0xb0a6('0xc')](_0xb0a6('0xd')),'direction':'out'};if(this[_0xb0a6('0xe')]===_0xb0a6('0xf')||this[_0xb0a6('0xe')]===_0xb0a6('0x10')){_0xda225c[_0xb0a6('0x11')]=this[_0xb0a6('0x12')][_0xb0a6('0x11')];}var _0x425b97=this[_0xb0a6('0xe')];if(_0x425b97===_0xb0a6('0x13')){_0xda225c['ChatWebsiteId']=this[_0xb0a6('0x14')]['id'];}else{_0xda225c[_['upperFirst'](_0x425b97)+_0xb0a6('0x15')]=this['account']['id'];}_0xda225c[_[_0xb0a6('0x16')](_0x425b97)+'InteractionId']=this[_0xb0a6('0x12')]['id'];if(this[_0xb0a6('0x12')][_0xb0a6('0x17')]){var _0x5673ad=_0x11cd5b[0x2];if(!_['isEmpty'](_0x5673ad)){_0xda225c[_0xb0a6('0x18')]=utils[_0xb0a6('0x19')](_0x5673ad,this);return rpc[_0x425b97+_0xb0a6('0x1a')][_0xb0a6('0x1b')](_0xda225c)[_0xb0a6('0x1c')](function(_0x13a1c8){logger['info'](_0xb0a6('0x9'),_0x5e2d2d,_0xda225c[_0xb0a6('0x18')]);})[_0xb0a6('0x1d')](function(_0xdc5de1){logger[_0xb0a6('0x1e')](_0xb0a6('0x9'),_0x5e2d2d,JSON['stringify'](_0xdc5de1));})[_0xb0a6('0x1f')](function(){logger[_0xb0a6('0x20')](_0xb0a6('0x21'),_0x5e2d2d);_0x24515c[_0xb0a6('0x22')]();});}else{logger[_0xb0a6('0x20')](_0xb0a6('0x23'),_0x5e2d2d);_0x24515c[_0xb0a6('0x22')]();}}else{var _0x16e053=this;var _0x4b9a6c=apiai(_0x11cd5b[0x0],{'language':_0x11cd5b[0x1]||'en'});return _0x4b9a6c[_0xb0a6('0x24')](this['message'][_0xb0a6('0x18')],{'sessionId':md5(this[_0xb0a6('0x12')]['id'])})['then'](function(_0x4aa68d){_0x16e053[_0xb0a6('0x18')][_0xb0a6('0x25')]=_0x4aa68d;_0xda225c['body']=_0x4aa68d[_0xb0a6('0x26')][_0xb0a6('0x27')][_0xb0a6('0x28')];_0xda225c[_0xb0a6('0x29')]='dialogflow';_0xda225c['providerResponse']=JSON[_0xb0a6('0x2a')](_0x4aa68d);return rpc[_0x425b97+_0xb0a6('0x1a')][_0xb0a6('0x1b')](_0xda225c)['then'](function(_0x23bec3){logger[_0xb0a6('0x20')](_0xb0a6('0x9'),_0x5e2d2d,_0xda225c[_0xb0a6('0x18')]);if(_0x4aa68d[_0xb0a6('0x26')][_0xb0a6('0x2b')][_0xb0a6('0x2c')]){_0x24515c[_0xb0a6('0xb')]();}else{_0x24515c[_0xb0a6('0x22')]();}})['catch'](function(_0x12d683){logger[_0xb0a6('0x1e')](_0xb0a6('0x9'),_0x5e2d2d,JSON['stringify'](_0x12d683));_0x24515c[_0xb0a6('0xb')]();});})['catch'](function(_0x131e46){logger[_0xb0a6('0x1e')](_0xb0a6('0x9'),_0x5e2d2d,_0x131e46[_0xb0a6('0x2d')]);_0x24515c[_0xb0a6('0xb')]();});}}catch(_0x2584ce){logger[_0xb0a6('0x1e')](_0xb0a6('0x9'),_0x5e2d2d,JSON[_0xb0a6('0x2a')](_0x2584ce));_0x24515c[_0xb0a6('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 7dd6946..d935fb5 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 _0x3572=['next','YYYY-MM-DD\x20HH:mm:ss','out','sms','channel','whatsapp','phone','interaction','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','isEmpty','getMustacheRender','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','replace','SessionsClient','sessionPath','detectIntent','dialogflowV2','queryResult','diagnosticInfo','fields','boolValue','DIALOGFLOWV2_ACTION','action','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','end_conversation','DIALOGFLOWV2_INTENTNAME','intent','name','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','DIALOGFLOWV2_LANGUAGECODE','DIALOGFLOWV2_QUERYTEXT','queryText','intentDetectionConfidence','providerName','providerResponse','length','fulfillmentText','push','message','md5','moment','bluebird','routing','./utils','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','clone','Message','create','then','info','[%s][DIALOGFLOWV2]\x20%s','body','catch','error','stringify','consequence','isNil','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.'];(function(_0x24dcaf,_0x2a7481){var _0x14fb38=function(_0x88dabd){while(--_0x88dabd){_0x24dcaf['push'](_0x24dcaf['shift']());}};_0x14fb38(++_0x2a7481);}(_0x3572,0x15b));var _0x2357=function(_0x403722,_0x519475){_0x403722=_0x403722-0x0;var _0x244231=_0x3572[_0x403722];return _0x244231;};'use strict';var _=require('lodash');var dialogflow=require('dialogflow');var md5=require(_0x2357('0x0'));var moment=require(_0x2357('0x1'));var Promise=require(_0x2357('0x2'));var logger=require('../../../../config/logger')(_0x2357('0x3'));var utils=require(_0x2357('0x4'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x2357('0x5')),'mailMessage':require(_0x2357('0x6')),'smsMessage':require(_0x2357('0x7')),'faxMessage':require(_0x2357('0x8')),'whatsappMessage':require('../../rpc/whatsappMessage')};function createMessage(_0x14863d,_0x15b051,_0x15f239,_0x1e8071){return new Promise(function(_0x3208b,_0x2c0275){var _0x599f59=_[_0x2357('0x9')](_0x15f239);_0x599f59['body']=_0x1e8071;return rpc[_0x15b051+_0x2357('0xa')][_0x2357('0xb')](_0x599f59)[_0x2357('0xc')](function(){logger[_0x2357('0xd')](_0x2357('0xe'),_0x14863d,_0x599f59[_0x2357('0xf')]);_0x3208b();})[_0x2357('0x10')](function(_0x236ed9){logger[_0x2357('0x11')]('[%s][DIALOGFLOWV2]\x20%s',_0x14863d,JSON[_0x2357('0x12')](_0x236ed9));_0x2c0275(_0x236ed9);});});}exports[_0x2357('0x13')]=function(_0x12582b,_0xe0ae56){return function(_0x498505){try{if(!_[_0x2357('0x14')](this['interaction'][_0x2357('0x15')])){logger[_0x2357('0xd')](_0x2357('0xe'),_0x12582b,_0x2357('0x16'));return _0x498505[_0x2357('0x17')]();}var _0x5d6cf4={'ContactId':this['contact']['id'],'sentAt':moment()['format'](_0x2357('0x18')),'direction':_0x2357('0x19')};if(this['channel']===_0x2357('0x1a')||this[_0x2357('0x1b')]===_0x2357('0x1c')){_0x5d6cf4[_0x2357('0x1d')]=this[_0x2357('0x1e')][_0x2357('0x1d')];}var _0x456abf=this[_0x2357('0x1b')];if(_0x456abf==='chat'){_0x5d6cf4[_0x2357('0x1f')]=this[_0x2357('0x20')]['id'];}else{_0x5d6cf4[_[_0x2357('0x21')](_0x456abf)+_0x2357('0x22')]=this[_0x2357('0x20')]['id'];}_0x5d6cf4[_['upperFirst'](_0x456abf)+_0x2357('0x23')]=this[_0x2357('0x1e')]['id'];if(this['interaction'][_0x2357('0x24')]){var _0x57c839=_0xe0ae56[0x4];if(!_[_0x2357('0x25')](_0x57c839)){_0x5d6cf4['body']=utils[_0x2357('0x26')](_0x57c839,this);return rpc[_0x456abf+_0x2357('0xa')][_0x2357('0xb')](_0x5d6cf4)[_0x2357('0xc')](function(_0x4a0627){logger[_0x2357('0xd')](_0x2357('0xe'),_0x12582b,_0x5d6cf4[_0x2357('0xf')]);})[_0x2357('0x10')](function(_0x4e2da8){logger[_0x2357('0x11')](_0x2357('0xe'),_0x12582b,JSON['stringify'](_0x4e2da8));})[_0x2357('0x27')](function(){logger[_0x2357('0xd')](_0x2357('0x28'),_0x12582b);_0x498505[_0x2357('0x29')]();});}else{logger[_0x2357('0xd')](_0x2357('0x2a'),_0x12582b);_0x498505[_0x2357('0x29')]();}}else{var _0x477975=this;var _0x5ee83c=_0xe0ae56[0x2][_0x2357('0x2b')](/\\n/g,'\x0a');var _0x2b81d2={'credentials':{'private_key':_0x5ee83c,'client_email':_0xe0ae56[0x1]}};var _0x8298aa=new dialogflow[(_0x2357('0x2c'))](_0x2b81d2);var _0x2d0881=_0x8298aa[_0x2357('0x2d')](_0xe0ae56[0x0],md5(_0x477975['interaction']['id']));var _0x3dded5={'session':_0x2d0881,'queryInput':{'text':{'text':_0x477975['message']['body'],'languageCode':_0xe0ae56[0x3]||'en'}}};return _0x8298aa[_0x2357('0x2e')](_0x3dded5)[_0x2357('0xc')](function(_0x211ffe){if(_0x211ffe&&_0x211ffe['length']){_0x477975['body'][_0x2357('0x2f')]=_0x211ffe;var _0x2b5df8=_0x211ffe[0x0];var _0x2db319=_0x2b5df8[_0x2357('0x30')][_0x2357('0x31')]&&_0x2b5df8[_0x2357('0x30')]['diagnosticInfo']['fields']?_0x2b5df8[_0x2357('0x30')][_0x2357('0x31')][_0x2357('0x32')]['end_conversation'][_0x2357('0x33')]:![];_0x477975[_0x2357('0xf')][_0x2357('0x34')]=_0x2b5df8[_0x2357('0x30')][_0x2357('0x35')];_0x477975[_0x2357('0xf')]['DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT']=_0x2b5df8[_0x2357('0x30')][_0x2357('0x36')];_0x477975[_0x2357('0xf')][_0x2357('0x37')]=_0x2b5df8[_0x2357('0x30')]['diagnosticInfo']&&_0x2b5df8[_0x2357('0x30')][_0x2357('0x31')][_0x2357('0x32')]?_0x2b5df8[_0x2357('0x30')][_0x2357('0x31')]['fields'][_0x2357('0x38')][_0x2357('0x33')]:![];_0x477975[_0x2357('0xf')][_0x2357('0x39')]=_0x2b5df8[_0x2357('0x30')][_0x2357('0x3a')][_0x2357('0x3b')];_0x477975[_0x2357('0xf')][_0x2357('0x3c')]=_0x2b5df8[_0x2357('0x30')][_0x2357('0x3a')][_0x2357('0x3d')];_0x477975['body'][_0x2357('0x3e')]=_0x2b5df8[_0x2357('0x30')][_0x2357('0x3a')][_0x2357('0x3f')];_0x477975[_0x2357('0xf')][_0x2357('0x40')]=_0x2b5df8['queryResult']['languageCode'];_0x477975[_0x2357('0xf')][_0x2357('0x41')]=_0x2b5df8[_0x2357('0x30')][_0x2357('0x42')];_0x477975['body']['DIALOGFLOWV2_SCORE']=_0x2b5df8[_0x2357('0x30')][_0x2357('0x43')];_0x5d6cf4[_0x2357('0x44')]=_0x2357('0x2f');_0x5d6cf4[_0x2357('0x45')]=JSON[_0x2357('0x12')](_0x211ffe);var _0x55b22e=[];for(var _0x13487d=0x0;_0x13487d<_0x211ffe[_0x2357('0x46')];_0x13487d++){var _0x365981=_0x211ffe[_0x13487d];if(_0x365981&&_0x365981[_0x2357('0x30')]&&_0x365981[_0x2357('0x30')][_0x2357('0x47')]){_0x55b22e[_0x2357('0x48')](createMessage(_0x12582b,_0x456abf,_0x5d6cf4,_0x365981[_0x2357('0x30')][_0x2357('0x47')]));}}return Promise['all'](_0x55b22e)[_0x2357('0xc')](function(){if(_0x2db319){_0x498505[_0x2357('0x17')]();}else{_0x498505[_0x2357('0x29')]();}})[_0x2357('0x10')](function(_0x54ebfa){logger[_0x2357('0x11')](_0x2357('0xe'),_0x12582b,JSON['stringify'](_0x54ebfa));_0x498505[_0x2357('0x17')]();});}})[_0x2357('0x10')](function(_0x1e599e){logger[_0x2357('0x11')](_0x2357('0xe'),_0x12582b,_0x1e599e[_0x2357('0x49')]);_0x498505['next']();});}}catch(_0x456fb5){logger['error'](_0x2357('0xe'),_0x12582b,JSON[_0x2357('0x12')](_0x456fb5));_0x498505[_0x2357('0x29')]();}};}; \ No newline at end of file +var _0x12cc=['catch','error','stringify','consequence','isNil','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','out','channel','whatsapp','phone','interaction','chat','ChatWebsiteId','upperFirst','AccountId','created','isEmpty','getMustacheRender','then','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','replace','SessionsClient','sessionPath','message','length','dialogflowV2','queryResult','diagnosticInfo','fields','end_conversation','DIALOGFLOWV2_ACTION','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','boolValue','DIALOGFLOWV2_INTENTNAME','intent','name','DIALOGFLOWV2_INTENTDISPLAYNAME','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerName','providerResponse','push','fulfillmentText','all','next','dialogflow','md5','moment','bluebird','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/whatsappMessage','body','Message','create','info','[%s][DIALOGFLOWV2]\x20%s'];(function(_0x5617a2,_0x36f76a){var _0x2a8abe=function(_0x183c48){while(--_0x183c48){_0x5617a2['push'](_0x5617a2['shift']());}};_0x2a8abe(++_0x36f76a);}(_0x12cc,0xc2));var _0xc12c=function(_0x4ef8a3,_0x22a7bc){_0x4ef8a3=_0x4ef8a3-0x0;var _0x363e9f=_0x12cc[_0x4ef8a3];return _0x363e9f;};'use strict';var _=require('lodash');var dialogflow=require(_0xc12c('0x0'));var md5=require(_0xc12c('0x1'));var moment=require(_0xc12c('0x2'));var Promise=require(_0xc12c('0x3'));var logger=require(_0xc12c('0x4'))('routing');var utils=require('./utils');var rpc={'chatMessage':require(_0xc12c('0x5')),'openchannelMessage':require(_0xc12c('0x6')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xc12c('0x7'))};function createMessage(_0x1c0435,_0xe572e1,_0x52017f,_0x488940){return new Promise(function(_0x2f11ba,_0x39f62c){var _0x40e297=_['clone'](_0x52017f);_0x40e297[_0xc12c('0x8')]=_0x488940;return rpc[_0xe572e1+_0xc12c('0x9')][_0xc12c('0xa')](_0x40e297)['then'](function(){logger[_0xc12c('0xb')](_0xc12c('0xc'),_0x1c0435,_0x40e297[_0xc12c('0x8')]);_0x2f11ba();})[_0xc12c('0xd')](function(_0x3944aa){logger[_0xc12c('0xe')]('[%s][DIALOGFLOWV2]\x20%s',_0x1c0435,JSON[_0xc12c('0xf')](_0x3944aa));_0x39f62c(_0x3944aa);});});}exports[_0xc12c('0x10')]=function(_0x126a25,_0x54aa3e){return function(_0x57bbf4){try{if(!_[_0xc12c('0x11')](this['interaction'][_0xc12c('0x12')])){logger[_0xc12c('0xb')]('[%s][DIALOGFLOWV2]\x20%s',_0x126a25,_0xc12c('0x13'));return _0x57bbf4['next']();}var _0x40c7a1={'ContactId':this[_0xc12c('0x14')]['id'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0xc12c('0x15')};if(this[_0xc12c('0x16')]==='sms'||this[_0xc12c('0x16')]===_0xc12c('0x17')){_0x40c7a1[_0xc12c('0x18')]=this[_0xc12c('0x19')][_0xc12c('0x18')];}var _0x5ef398=this[_0xc12c('0x16')];if(_0x5ef398===_0xc12c('0x1a')){_0x40c7a1[_0xc12c('0x1b')]=this['account']['id'];}else{_0x40c7a1[_[_0xc12c('0x1c')](_0x5ef398)+_0xc12c('0x1d')]=this['account']['id'];}_0x40c7a1[_['upperFirst'](_0x5ef398)+'InteractionId']=this[_0xc12c('0x19')]['id'];if(this[_0xc12c('0x19')][_0xc12c('0x1e')]){var _0x2c718d=_0x54aa3e[0x4];if(!_[_0xc12c('0x1f')](_0x2c718d)){_0x40c7a1[_0xc12c('0x8')]=utils[_0xc12c('0x20')](_0x2c718d,this);return rpc[_0x5ef398+'Message'][_0xc12c('0xa')](_0x40c7a1)[_0xc12c('0x21')](function(_0x26cef4){logger[_0xc12c('0xb')](_0xc12c('0xc'),_0x126a25,_0x40c7a1[_0xc12c('0x8')]);})[_0xc12c('0xd')](function(_0x3af86d){logger[_0xc12c('0xe')](_0xc12c('0xc'),_0x126a25,JSON[_0xc12c('0xf')](_0x3af86d));})[_0xc12c('0x22')](function(){logger[_0xc12c('0xb')](_0xc12c('0x23'),_0x126a25);_0x57bbf4[_0xc12c('0x24')]();});}else{logger['info']('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x126a25);_0x57bbf4[_0xc12c('0x24')]();}}else{var _0x1d8c5d=this;var _0x5b2e7e=_0x54aa3e[0x2][_0xc12c('0x25')](/\\n/g,'\x0a');var _0x39a976={'credentials':{'private_key':_0x5b2e7e,'client_email':_0x54aa3e[0x1]}};var _0x45e6eb=new dialogflow[(_0xc12c('0x26'))](_0x39a976);var _0x4e0c48=_0x45e6eb[_0xc12c('0x27')](_0x54aa3e[0x0],md5(_0x1d8c5d[_0xc12c('0x19')]['id']));var _0x1ed467={'session':_0x4e0c48,'queryInput':{'text':{'text':_0x1d8c5d[_0xc12c('0x28')]['body'],'languageCode':_0x54aa3e[0x3]||'en'}}};return _0x45e6eb['detectIntent'](_0x1ed467)['then'](function(_0x31a70e){if(_0x31a70e&&_0x31a70e[_0xc12c('0x29')]){_0x1d8c5d[_0xc12c('0x8')][_0xc12c('0x2a')]=_0x31a70e;var _0x550fc6=_0x31a70e[0x0];var _0x15367a=_0x550fc6[_0xc12c('0x2b')][_0xc12c('0x2c')]&&_0x550fc6[_0xc12c('0x2b')]['diagnosticInfo'][_0xc12c('0x2d')]?_0x550fc6['queryResult'][_0xc12c('0x2c')][_0xc12c('0x2d')][_0xc12c('0x2e')]['boolValue']:![];_0x1d8c5d[_0xc12c('0x8')][_0xc12c('0x2f')]=_0x550fc6[_0xc12c('0x2b')]['action'];_0x1d8c5d[_0xc12c('0x8')][_0xc12c('0x30')]=_0x550fc6['queryResult'][_0xc12c('0x31')];_0x1d8c5d[_0xc12c('0x8')]['DIALOGFLOWV2_ENDCONVERSATION']=_0x550fc6[_0xc12c('0x2b')]['diagnosticInfo']&&_0x550fc6['queryResult'][_0xc12c('0x2c')]['fields']?_0x550fc6[_0xc12c('0x2b')]['diagnosticInfo'][_0xc12c('0x2d')][_0xc12c('0x2e')][_0xc12c('0x32')]:![];_0x1d8c5d[_0xc12c('0x8')][_0xc12c('0x33')]=_0x550fc6[_0xc12c('0x2b')][_0xc12c('0x34')][_0xc12c('0x35')];_0x1d8c5d['body'][_0xc12c('0x36')]=_0x550fc6['queryResult'][_0xc12c('0x34')]['displayName'];_0x1d8c5d['body'][_0xc12c('0x37')]=_0x550fc6[_0xc12c('0x2b')][_0xc12c('0x34')][_0xc12c('0x38')];_0x1d8c5d[_0xc12c('0x8')][_0xc12c('0x39')]=_0x550fc6[_0xc12c('0x2b')][_0xc12c('0x3a')];_0x1d8c5d['body'][_0xc12c('0x3b')]=_0x550fc6['queryResult'][_0xc12c('0x3c')];_0x1d8c5d[_0xc12c('0x8')][_0xc12c('0x3d')]=_0x550fc6[_0xc12c('0x2b')][_0xc12c('0x3e')];_0x40c7a1[_0xc12c('0x3f')]=_0xc12c('0x2a');_0x40c7a1[_0xc12c('0x40')]=JSON['stringify'](_0x31a70e);var _0x5019b6=[];for(var _0x3e713e=0x0;_0x3e713e<_0x31a70e[_0xc12c('0x29')];_0x3e713e++){var _0x318233=_0x31a70e[_0x3e713e];if(_0x318233&&_0x318233[_0xc12c('0x2b')]&&_0x318233[_0xc12c('0x2b')]['fulfillmentText']){_0x5019b6[_0xc12c('0x41')](createMessage(_0x126a25,_0x5ef398,_0x40c7a1,_0x318233['queryResult'][_0xc12c('0x42')]));}}return Promise[_0xc12c('0x43')](_0x5019b6)[_0xc12c('0x21')](function(){if(_0x15367a){_0x57bbf4['next']();}else{_0x57bbf4[_0xc12c('0x24')]();}})[_0xc12c('0xd')](function(_0x26b119){logger['error'](_0xc12c('0xc'),_0x126a25,JSON[_0xc12c('0xf')](_0x26b119));_0x57bbf4[_0xc12c('0x44')]();});}})[_0xc12c('0xd')](function(_0x5aef80){logger[_0xc12c('0xe')](_0xc12c('0xc'),_0x126a25,_0x5aef80[_0xc12c('0x28')]);_0x57bbf4['next']();});}}catch(_0xb2583a){logger['error'](_0xc12c('0xc'),_0x126a25,JSON[_0xc12c('0xf')](_0xb2583a));_0x57bbf4[_0xc12c('0x24')]();}};}; \ 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 748b46d..dcf7312 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 _0xe9db=['./utils','routing','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','fromString','replace','error','map','message','join','stop','condition','priorityTrue','priorityFalse','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','findIndex','info','next','[%s][GOTOIF]\x20eval\x20error:\x20%s','[%s][GOTOIF]\x20%s','stringify','validate','lodash','html-to-text'];(function(_0x3c32d6,_0x346f90){var _0x25c93c=function(_0x205f40){while(--_0x205f40){_0x3c32d6['push'](_0x3c32d6['shift']());}};_0x25c93c(++_0x346f90);}(_0xe9db,0x141));var _0xbe9d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe9db[_0x3dd15e];return _0x231fd0;};'use strict';var schema=require(_0xbe9d('0x0'));var _=require(_0xbe9d('0x1'));var htmlToText=require(_0xbe9d('0x2'));var utils=require(_0xbe9d('0x3'));var logger=require('../../../../config/logger')(_0xbe9d('0x4'));var gotoif=schema({'condition':{'type':'string','required':!![],'message':_0xbe9d('0x5')},'priorityTrue':{'type':_0xbe9d('0x6'),'message':_0xbe9d('0x7')},'priorityFalse':{'type':_0xbe9d('0x6'),'message':_0xbe9d('0x8')}});exports[_0xbe9d('0x9')]=function(_0x2ed9af,_0x16c8d3){return function(_0x21b117){try{var _0x509e07={'condition':htmlToText[_0xbe9d('0xa')](utils['getMustacheRender'](_0x16c8d3[0x0],this),{'wordwrap':![]})[_0xbe9d('0xb')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x16c8d3[0x1],'priorityFalse':_0x16c8d3[0x2]};var _0x9a5495=gotoif[_0xbe9d('0x0')](_0x509e07,{'typecast':!![]});if(_0x9a5495['length']){logger[_0xbe9d('0xc')]('[%s][GOTOIF]\x20%s',_0x2ed9af,_[_0xbe9d('0xd')](_0x9a5495,_0xbe9d('0xe'))[_0xbe9d('0xf')](',\x20'));_0x21b117[_0xbe9d('0x10')]();}else{try{var _0x5f3e40=eval('('+_0x509e07[_0xbe9d('0x11')]+')');var _0xa38f4=_0x5f3e40?_0x509e07[_0xbe9d('0x12')]:_0x509e07[_0xbe9d('0x13')];logger['info'](_0xbe9d('0x14'),_0x2ed9af,_0x509e07['condition'],_0x5f3e40,_0xa38f4||'next');if(_0xa38f4){var _0x372980=_[_0xbe9d('0x15')](_0x21b117['rules'](),{'p':_0xa38f4});if(_0x372980>=0x0){logger[_0xbe9d('0x16')]('[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x2ed9af,_0xa38f4||_0xbe9d('0x17'),_0x372980);_0x21b117[_0xbe9d('0x17')](_0x372980);}else{logger[_0xbe9d('0x16')]('[%s][GOTOIF]\x20priority\x20%s\x20not\x20found',_0x2ed9af,_0xa38f4||_0xbe9d('0x17'));_0x21b117['stop']();}}else{_0x21b117[_0xbe9d('0x17')]();}}catch(_0x466478){logger[_0xbe9d('0xc')](_0xbe9d('0x18'),_0x2ed9af,_0x466478[_0xbe9d('0xe')]);_0x21b117[_0xbe9d('0x10')]();}}}catch(_0x11a528){logger[_0xbe9d('0xc')](_0xbe9d('0x19'),_0x2ed9af,JSON[_0xbe9d('0x1a')](_0x11a528));_0x21b117[_0xbe9d('0x10')]();}};}; \ No newline at end of file +var _0x1dd8=['consequence','fromString','getMustacheRender','replace','error','[%s][GOTOIF]\x20%s','map','message','stop','condition','priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify','validate','lodash','html-to-text','./utils','../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number'];(function(_0xe69da0,_0x45a6a8){var _0x386b5e=function(_0x16abf2){while(--_0x16abf2){_0xe69da0['push'](_0xe69da0['shift']());}};_0x386b5e(++_0x45a6a8);}(_0x1dd8,0xa9));var _0x81dd=function(_0x45fbf8,_0x305eac){_0x45fbf8=_0x45fbf8-0x0;var _0x21986c=_0x1dd8[_0x45fbf8];return _0x21986c;};'use strict';var schema=require(_0x81dd('0x0'));var _=require(_0x81dd('0x1'));var htmlToText=require(_0x81dd('0x2'));var utils=require(_0x81dd('0x3'));var logger=require(_0x81dd('0x4'))(_0x81dd('0x5'));var gotoif=schema({'condition':{'type':_0x81dd('0x6'),'required':!![],'message':_0x81dd('0x7')},'priorityTrue':{'type':_0x81dd('0x8'),'message':_0x81dd('0x9')},'priorityFalse':{'type':_0x81dd('0x8'),'message':_0x81dd('0xa')}});exports[_0x81dd('0xb')]=function(_0x2dffc7,_0x106c88){return function(_0x3d6cf2){try{var _0x3f47dd={'condition':htmlToText[_0x81dd('0xc')](utils[_0x81dd('0xd')](_0x106c88[0x0],this),{'wordwrap':![]})[_0x81dd('0xe')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x106c88[0x1],'priorityFalse':_0x106c88[0x2]};var _0x32f21e=gotoif['validate'](_0x3f47dd,{'typecast':!![]});if(_0x32f21e['length']){logger[_0x81dd('0xf')](_0x81dd('0x10'),_0x2dffc7,_[_0x81dd('0x11')](_0x32f21e,_0x81dd('0x12'))['join'](',\x20'));_0x3d6cf2[_0x81dd('0x13')]();}else{try{var _0x29aabc=eval('('+_0x3f47dd[_0x81dd('0x14')]+')');var _0x3ffabb=_0x29aabc?_0x3f47dd[_0x81dd('0x15')]:_0x3f47dd[_0x81dd('0x16')];logger[_0x81dd('0x17')](_0x81dd('0x18'),_0x2dffc7,_0x3f47dd['condition'],_0x29aabc,_0x3ffabb||_0x81dd('0x19'));if(_0x3ffabb){var _0x5d75b9=_[_0x81dd('0x1a')](_0x3d6cf2['rules'](),{'p':_0x3ffabb});if(_0x5d75b9>=0x0){logger[_0x81dd('0x17')]('[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x2dffc7,_0x3ffabb||_0x81dd('0x19'),_0x5d75b9);_0x3d6cf2[_0x81dd('0x19')](_0x5d75b9);}else{logger[_0x81dd('0x17')](_0x81dd('0x1b'),_0x2dffc7,_0x3ffabb||_0x81dd('0x19'));_0x3d6cf2[_0x81dd('0x13')]();}}else{_0x3d6cf2[_0x81dd('0x19')]();}}catch(_0x175b21){logger[_0x81dd('0xf')](_0x81dd('0x1c'),_0x2dffc7,_0x175b21[_0x81dd('0x12')]);_0x3d6cf2[_0x81dd('0x13')]();}}}catch(_0x1b5ff3){logger[_0x81dd('0xf')](_0x81dd('0x10'),_0x2dffc7,JSON[_0x81dd('0x1d')](_0x1b5ff3));_0x3d6cf2[_0x81dd('0x13')]();}};}; \ 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 461fc6d..e4d6b95 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 _0x844d=['priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','[%s][GOTOP]\x20%s','stringify','lodash','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','validate','length','error','map','message','join','stop','info','[%s][GOTOP]\x20priority\x20%s'];(function(_0x113d17,_0x1ebbdd){var _0x5576ab=function(_0x2257b7){while(--_0x2257b7){_0x113d17['push'](_0x113d17['shift']());}};_0x5576ab(++_0x1ebbdd);}(_0x844d,0xc0));var _0xd844=function(_0x333767,_0x3e6f9c){_0x333767=_0x333767-0x0;var _0x51661b=_0x844d[_0x333767];return _0x51661b;};'use strict';var schema=require('validate');var _=require(_0xd844('0x0'));var logger=require(_0xd844('0x1'))(_0xd844('0x2'));var gotop=schema({'priority':{'type':_0xd844('0x3'),'required':!![],'message':_0xd844('0x4')}});exports[_0xd844('0x5')]=function(_0xa9cca3,_0x5a75fc){return function(_0x49f50f){try{var _0x5a5f9c={'priority':_0x5a75fc[0x0]};var _0x2913fd=gotop[_0xd844('0x6')](_0x5a5f9c,{'typecast':!![]});if(_0x2913fd[_0xd844('0x7')]){logger[_0xd844('0x8')]('[%s][GOTOP]\x20%s',_0xa9cca3,_[_0xd844('0x9')](_0x2913fd,_0xd844('0xa'))[_0xd844('0xb')](',\x20'));_0x49f50f[_0xd844('0xc')]();}else{logger[_0xd844('0xd')](_0xd844('0xe'),_0xa9cca3,_0x5a5f9c['priority']);if(_0x5a5f9c[_0xd844('0xf')]){var _0x55c03f=_[_0xd844('0x10')](_0x49f50f[_0xd844('0x11')](),{'p':_0x5a5f9c[_0xd844('0xf')]});if(_0x55c03f>=0x0){logger[_0xd844('0xd')](_0xd844('0x12'),_0xa9cca3,_0x5a5f9c[_0xd844('0xf')]||_0xd844('0x13'),_0x55c03f);_0x49f50f[_0xd844('0x13')](_0x55c03f);}else{logger[_0xd844('0xd')](_0xd844('0x14'),_0xa9cca3,_0x5a5f9c['priority']||_0xd844('0x13'));_0x49f50f[_0xd844('0xc')]();}}else{_0x49f50f['next']();}}}catch(_0x3b73da){logger[_0xd844('0x8')](_0xd844('0x15'),_0xa9cca3,JSON[_0xd844('0x16')](_0x3b73da));_0x49f50f[_0xd844('0xc')]();}};}; \ No newline at end of file +var _0x2a5a=['number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','length','[%s][GOTOP]\x20%s','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','error','stringify','../../../../config/logger','routing'];(function(_0x480275,_0x54045c){var _0x1372d4=function(_0x7073a5){while(--_0x7073a5){_0x480275['push'](_0x480275['shift']());}};_0x1372d4(++_0x54045c);}(_0x2a5a,0x8e));var _0xa2a5=function(_0x1301e7,_0xbfc8e7){_0x1301e7=_0x1301e7-0x0;var _0x2dce2b=_0x2a5a[_0x1301e7];return _0x2dce2b;};'use strict';var schema=require('validate');var _=require('lodash');var logger=require(_0xa2a5('0x0'))(_0xa2a5('0x1'));var gotop=schema({'priority':{'type':_0xa2a5('0x2'),'required':!![],'message':_0xa2a5('0x3')}});exports['consequence']=function(_0x588ffb,_0x2bbdb4){return function(_0x48d3d0){try{var _0x470527={'priority':_0x2bbdb4[0x0]};var _0x4e7ffa=gotop['validate'](_0x470527,{'typecast':!![]});if(_0x4e7ffa[_0xa2a5('0x4')]){logger['error'](_0xa2a5('0x5'),_0x588ffb,_['map'](_0x4e7ffa,'message')['join'](',\x20'));_0x48d3d0[_0xa2a5('0x6')]();}else{logger[_0xa2a5('0x7')](_0xa2a5('0x8'),_0x588ffb,_0x470527[_0xa2a5('0x9')]);if(_0x470527[_0xa2a5('0x9')]){var _0x2cc60f=_[_0xa2a5('0xa')](_0x48d3d0['rules'](),{'p':_0x470527[_0xa2a5('0x9')]});if(_0x2cc60f>=0x0){logger[_0xa2a5('0x7')](_0xa2a5('0xb'),_0x588ffb,_0x470527[_0xa2a5('0x9')]||'next',_0x2cc60f);_0x48d3d0[_0xa2a5('0xc')](_0x2cc60f);}else{logger['info'](_0xa2a5('0xd'),_0x588ffb,_0x470527[_0xa2a5('0x9')]||_0xa2a5('0xc'));_0x48d3d0[_0xa2a5('0x6')]();}}else{_0x48d3d0[_0xa2a5('0xc')]();}}}catch(_0x257b2b){logger[_0xa2a5('0xe')]('[%s][GOTOP]\x20%s',_0x588ffb,JSON[_0xa2a5('0xf')](_0x257b2b));_0x48d3d0[_0xa2a5('0x6')]();}};}; \ 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 9d344a4..c362961 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 _0xcd5e=['[%s][MESSAGE]\x20%s','stringify','stop','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact','channel','chat','ChatWebsiteId','account','AccountId','upperFirst','Message','create','then','next','catch','error'];(function(_0x687ce7,_0x39db4f){var _0x8bb835=function(_0x1fe8f7){while(--_0x1fe8f7){_0x687ce7['push'](_0x687ce7['shift']());}};_0x8bb835(++_0x39db4f);}(_0xcd5e,0xb3));var _0xecd5=function(_0x12ef8b,_0x444084){_0x12ef8b=_0x12ef8b-0x0;var _0x16b255=_0xcd5e[_0x12ef8b];return _0x16b255;};'use strict';var _=require('lodash');var utils=require('./utils');var logger=require('../../../../config/logger')('routing');var rpc={'chatMessage':require(_0xecd5('0x0')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xecd5('0x1')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xecd5('0x2')),'whatsappMessage':require(_0xecd5('0x3'))};exports[_0xecd5('0x4')]=function(_0x109e9e,_0x53a12b){return function(_0x3002a2){try{var _0x555904={'body':utils[_0xecd5('0x5')](_0x53a12b[0x0],this),'ContactId':this[_0xecd5('0x6')]['id']};if(this[_0xecd5('0x7')]===_0xecd5('0x8')){_0x555904[_0xecd5('0x9')]=this[_0xecd5('0xa')]['id'];}else{_0x555904[_['upperFirst'](this['channel'])+_0xecd5('0xb')]=this[_0xecd5('0xa')]['id'];}_0x555904[_[_0xecd5('0xc')](this[_0xecd5('0x7')])+'InteractionId']=this['interaction']['id'];if(rpc[this['channel']+_0xecd5('0xd')]){return rpc[this[_0xecd5('0x7')]+_0xecd5('0xd')][_0xecd5('0xe')](_0x555904)[_0xecd5('0xf')](function(_0x4784c2){logger['info']('[%s][MESSAGE]\x20%s',_0x109e9e,_0x555904['body']);_0x3002a2[_0xecd5('0x10')]();})[_0xecd5('0x11')](function(_0x397cc1){logger[_0xecd5('0x12')](_0xecd5('0x13'),_0x109e9e,JSON[_0xecd5('0x14')](_0x397cc1));_0x3002a2[_0xecd5('0x15')]();});}}catch(_0x3dc588){logger[_0xecd5('0x12')](_0xecd5('0x13'),_0x109e9e,JSON[_0xecd5('0x14')](_0x3dc588));_0x3002a2[_0xecd5('0x15')]();}};}; \ No newline at end of file +var _0xc4dd=['../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','getMustacheRender','channel','chat','ChatWebsiteId','account','upperFirst','AccountId','interaction','Message','then','info','body','next','catch','error','stop','[%s][MESSAGE]\x20%s','lodash','./utils'];(function(_0x364cc3,_0x20fe9b){var _0x141152=function(_0x514ba8){while(--_0x514ba8){_0x364cc3['push'](_0x364cc3['shift']());}};_0x141152(++_0x20fe9b);}(_0xc4dd,0xad));var _0xdc4d=function(_0x1c3b50,_0x3bc478){_0x1c3b50=_0x1c3b50-0x0;var _0x486aa8=_0xc4dd[_0x1c3b50];return _0x486aa8;};'use strict';var _=require(_0xdc4d('0x0'));var utils=require(_0xdc4d('0x1'));var logger=require(_0xdc4d('0x2'))('routing');var rpc={'chatMessage':require(_0xdc4d('0x3')),'openchannelMessage':require(_0xdc4d('0x4')),'mailMessage':require(_0xdc4d('0x5')),'smsMessage':require(_0xdc4d('0x6')),'faxMessage':require(_0xdc4d('0x7')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports['consequence']=function(_0x27d6a9,_0x1696e3){return function(_0x5d4933){try{var _0x3c4ce7={'body':utils[_0xdc4d('0x8')](_0x1696e3[0x0],this),'ContactId':this['contact']['id']};if(this[_0xdc4d('0x9')]===_0xdc4d('0xa')){_0x3c4ce7[_0xdc4d('0xb')]=this[_0xdc4d('0xc')]['id'];}else{_0x3c4ce7[_[_0xdc4d('0xd')](this[_0xdc4d('0x9')])+_0xdc4d('0xe')]=this['account']['id'];}_0x3c4ce7[_[_0xdc4d('0xd')](this[_0xdc4d('0x9')])+'InteractionId']=this[_0xdc4d('0xf')]['id'];if(rpc[this['channel']+_0xdc4d('0x10')]){return rpc[this['channel']+'Message']['create'](_0x3c4ce7)[_0xdc4d('0x11')](function(_0xc63ead){logger[_0xdc4d('0x12')]('[%s][MESSAGE]\x20%s',_0x27d6a9,_0x3c4ce7[_0xdc4d('0x13')]);_0x5d4933[_0xdc4d('0x14')]();})[_0xdc4d('0x15')](function(_0x586e74){logger[_0xdc4d('0x16')]('[%s][MESSAGE]\x20%s',_0x27d6a9,JSON['stringify'](_0x586e74));_0x5d4933[_0xdc4d('0x17')]();});}}catch(_0xff4e3){logger[_0xdc4d('0x16')](_0xdc4d('0x18'),_0x27d6a9,JSON['stringify'](_0xff4e3));_0x5d4933[_0xdc4d('0x17')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/noop.js b/server/services/routing/server/applications/noop.js index 317bc4d..cc6f4be 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 _0xb540=['./utils','../../../../config/logger','routing','consequence','info','[%s][NOOP]\x20%s','getMustacheRender','next','error'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb540,0x171));var _0x0b54=function(_0x271828,_0x82203e){_0x271828=_0x271828-0x0;var _0x3e4bf0=_0xb540[_0x271828];return _0x3e4bf0;};'use strict';var utils=require(_0x0b54('0x0'));var logger=require(_0x0b54('0x1'))(_0x0b54('0x2'));exports[_0x0b54('0x3')]=function(_0x23f5a6,_0x382ff9){return function(_0x4743b4){try{logger[_0x0b54('0x4')](_0x0b54('0x5'),_0x23f5a6,utils[_0x0b54('0x6')](_0x382ff9[0x0],this));_0x4743b4[_0x0b54('0x7')]();}catch(_0x4297e4){logger[_0x0b54('0x8')](_0x0b54('0x5'),_0x23f5a6,JSON['stringify'](_0x4297e4));_0x4743b4['stop']();}};}; \ No newline at end of file +var _0xaa93=['stop','./utils','../../../../config/logger','routing','info','getMustacheRender','error','stringify'];(function(_0x18bc36,_0x26f234){var _0x182db0=function(_0x7bef20){while(--_0x7bef20){_0x18bc36['push'](_0x18bc36['shift']());}};_0x182db0(++_0x26f234);}(_0xaa93,0xd9));var _0x3aa9=function(_0x18507b,_0x3036b3){_0x18507b=_0x18507b-0x0;var _0xd2753=_0xaa93[_0x18507b];return _0xd2753;};'use strict';var utils=require(_0x3aa9('0x0'));var logger=require(_0x3aa9('0x1'))(_0x3aa9('0x2'));exports['consequence']=function(_0x92cd4e,_0x4790ec){return function(_0x49feff){try{logger[_0x3aa9('0x3')]('[%s][NOOP]\x20%s',_0x92cd4e,utils[_0x3aa9('0x4')](_0x4790ec[0x0],this));_0x49feff['next']();}catch(_0x4c455b){logger[_0x3aa9('0x5')]('[%s][NOOP]\x20%s',_0x92cd4e,JSON[_0x3aa9('0x6')](_0x4c455b));_0x49feff[_0x3aa9('0x7')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index db91048..7faaf70 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 _0x75ea=['number','timeout\x20is\x20a\x20number','body','contact','list','upperFirst','channel','QueueId','InteractionId','interaction','MessageId','message','chat','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','error','create\x20queue\x20report','waiting','YYYY-MM-DD\x20HH:mm:ss','accepted','[%s][STOP:QUEUE][NAME:%s]','update','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','length','map','join','stop','Queues','createQueue','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','[%s][QUEUE]\x20APPLICATION\x20END','close','strategy','rrmemory','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','[%s][QUEUE]\x20%s','stack','validate','lodash','seq-queue','moment','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','localhost','socket.io-emitter','queue_id','account','queue','clone','format','pick','%sQueuesWaitingInteractions','%s_queue_waiting_interaction:%s','save','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string'];(function(_0x507b3b,_0x30c190){var _0xe1e48e=function(_0x1865ed){while(--_0x1865ed){_0x507b3b['push'](_0x507b3b['shift']());}};_0xe1e48e(++_0x30c190);}(_0x75ea,0x7d));var _0xa75e=function(_0x9fb220,_0x2f2974){_0x9fb220=_0x9fb220-0x0;var _0x5c4dc9=_0x75ea[_0x9fb220];return _0x5c4dc9;};'use strict';var schema=require(_0xa75e('0x0'));var _=require(_0xa75e('0x1'));var util=require('util');var seqqueue=require(_0xa75e('0x2'));var moment=require(_0xa75e('0x3'));var Redis=require('ioredis');var config=require(_0xa75e('0x4'));var logger=require(_0xa75e('0x5'))(_0xa75e('0x6'));var strategy=require(_0xa75e('0x7'));config[_0xa75e('0x8')]=_['defaults'](config[_0xa75e('0x8')],{'host':_0xa75e('0x9'),'port':0x18eb});var io=require(_0xa75e('0xa'))(new Redis(config[_0xa75e('0x8')]));var attributes=['id',_0xa75e('0xb'),_0xa75e('0xc'),_0xa75e('0xd'),'from','joinAt'];function emit(_0x560baa,_0x5c2c35,_0x39aab0){io['to'](_0x560baa)['emit'](_0x5c2c35,_0x39aab0);}function emitChannelQueueInteraction(_0x245dd2,_0x495157,_0x34ec67,_0xad9407,_0x58c4fd,_0x20b79b,_0x259e8c,_0x38dce8){var _0x35c81b=_[_0xa75e('0xe')](_0x34ec67);_0x35c81b[_0xa75e('0xb')]=_0x38dce8;_0x35c81b[_0xa75e('0xd')]=_0x495157;_0x35c81b[_0xa75e('0xc')]=_0xad9407;_0x35c81b['id']=_0x58c4fd;if(_0x20b79b){_0x259e8c[util[_0xa75e('0xf')]('%sQueuesWaitingInteractions',_0x245dd2)][_0x58c4fd]=_[_0xa75e('0x10')](_0x35c81b,attributes);}else{delete _0x259e8c[util['format'](_0xa75e('0x11'),_0x245dd2)][_0x58c4fd];}emit(util[_0xa75e('0xf')]('%s:queue:%s',_0x245dd2,_0x495157),util[_0xa75e('0xf')](_0xa75e('0x12'),_0x245dd2,_0x20b79b?_0xa75e('0x13'):'remove'),_[_0xa75e('0x10')](_0x35c81b,attributes));}var rpc={'openchannelQueueReport':require(_0xa75e('0x14')),'mailQueueReport':require(_0xa75e('0x15')),'chatQueueReport':require(_0xa75e('0x16')),'smsQueueReport':require(_0xa75e('0x17')),'faxQueueReport':require(_0xa75e('0x18')),'whatsappQueueReport':require(_0xa75e('0x19'))};var queue=schema({'name':{'type':_0xa75e('0x1a'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0xa75e('0x1b'),'message':_0xa75e('0x1c')}});function startRouting(_0x149647,_0x4e0fea,_0x5d22ca,_0x42f1d6){if(_0x149647&&_0x4e0fea&&_0x5d22ca){_0x4e0fea['waiting']+=0x1;var _0x47b19c={'uniqueid':_0x149647,'from':_0x5d22ca['body']?_0x5d22ca[_0xa75e('0x1d')]['from']:'','joinAt':moment()[_0xa75e('0xf')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x5d22ca[_0xa75e('0x1e')]?_0x5d22ca[_0xa75e('0x1e')]['id']:null,'ListId':_0x5d22ca[_0xa75e('0x1f')]?_0x5d22ca['list']['id']:null};_0x47b19c[_[_0xa75e('0x20')](_0x5d22ca[_0xa75e('0x21')])+_0xa75e('0x22')]=_0x4e0fea['id']||null;_0x47b19c[_['upperFirst'](_0x5d22ca[_0xa75e('0x21')])+_0xa75e('0x23')]=_0x5d22ca[_0xa75e('0x24')]?_0x5d22ca[_0xa75e('0x24')]['id']:null;_0x47b19c[_[_0xa75e('0x20')](_0x5d22ca[_0xa75e('0x21')])+_0xa75e('0x25')]=_0x5d22ca[_0xa75e('0x26')]?_0x5d22ca[_0xa75e('0x26')]['id']:null;_0x47b19c[_['upperFirst'](_0x5d22ca['channel'])+(_0x5d22ca[_0xa75e('0x21')]!==_0xa75e('0x27')?'AccountId':_0xa75e('0x28'))]=_0x5d22ca[_0xa75e('0xc')]?_0x5d22ca[_0xa75e('0xc')]['id']:null;logger[_0xa75e('0x29')](util[_0xa75e('0xf')](_0xa75e('0x2a'),_0x149647,_0x4e0fea['name']));emitChannelQueueInteraction(_0x5d22ca[_0xa75e('0x21')],_0x4e0fea[_0xa75e('0x2b')],_0x47b19c,_0x5d22ca[_0xa75e('0xc')][_0xa75e('0x2b')],_0x5d22ca[_0xa75e('0x26')]['id'],!![],_0x42f1d6,_0x4e0fea['id']);if(rpc[_0x5d22ca['channel']+_0xa75e('0x2c')]){return rpc[_0x5d22ca['channel']+'QueueReport'][_0xa75e('0x2d')](_0x47b19c)[_0xa75e('0x2e')](function(_0x207be3){logger[_0xa75e('0x2f')](_0xa75e('0x30'));});}}}function stopRouting(_0xf091d7,_0x1fccbb,_0x1df3ec,_0x3f7fc5){if(_0xf091d7&&_0x1fccbb){_0x1fccbb[_0xa75e('0x31')]-=0x1;var _0x30a7e5={'leaveAt':moment()[_0xa75e('0xf')](_0xa75e('0x32')),'acceptAt':moment()['format'](_0xa75e('0x32')),'reason':_0xa75e('0x33')};logger[_0xa75e('0x29')](util[_0xa75e('0xf')](_0xa75e('0x34'),_0xf091d7,_0x1fccbb[_0xa75e('0x2b')]));emitChannelQueueInteraction(_0x1df3ec['channel'],_0x1fccbb['name'],_0x1df3ec['body'],_0x1df3ec[_0xa75e('0xc')]['name'],_0x1df3ec['message']['id'],![],_0x3f7fc5,_0x1fccbb['id']);if(rpc[_0x1df3ec[_0xa75e('0x21')]+'QueueReport']){return rpc[_0x1df3ec[_0xa75e('0x21')]+_0xa75e('0x2c')][_0xa75e('0x35')](_0xf091d7,_0x30a7e5)[_0xa75e('0x2e')](function(_0x4a9356){logger[_0xa75e('0x2f')](_0xa75e('0x36'));});}}}function endRouting(_0x1679d1,_0x5f3d8f,_0x5b6044,_0x376ac1){if(_0x1679d1&&_0x5f3d8f){_0x5f3d8f[_0xa75e('0x31')]-=0x1;var _0x544783={'leaveAt':moment()[_0xa75e('0xf')](_0xa75e('0x32')),'exitAt':moment()['format'](_0xa75e('0x32')),'reason':_0xa75e('0x37')};logger['info'](util[_0xa75e('0xf')](_0xa75e('0x38'),_0x1679d1,_0x5f3d8f[_0xa75e('0x2b')]));emitChannelQueueInteraction(_0x5b6044['channel'],_0x5f3d8f[_0xa75e('0x2b')],_0x5b6044[_0xa75e('0x1d')],_0x5b6044[_0xa75e('0xc')][_0xa75e('0x2b')],_0x5b6044[_0xa75e('0x26')]['id'],![],_0x376ac1);if(rpc[_0x5b6044['channel']+_0xa75e('0x2c')]){return rpc[_0x5b6044['channel']+_0xa75e('0x2c')][_0xa75e('0x35')](_0x1679d1,_0x544783)[_0xa75e('0x2e')](function(_0xbfdd50){logger[_0xa75e('0x2f')]('update\x20queue\x20report');});}}}function handleFindQueue(_0x1400c1){return function(_0x38650a){return _0x38650a[_0xa75e('0x2b')]['toLowerCase']()===_0x1400c1[_0xa75e('0x39')]();};}exports[_0xa75e('0x3a')]=function(_0x5988b7,_0x153d2f,_0x24d54a,_0x554179){return function(_0x3ad6a0){try{var _0x17964e={'name':_0x153d2f[0x0],'timeout':_0x153d2f[0x1]};var _0x222b88=queue[_0xa75e('0x0')](_0x17964e,{'typecast':!![]});if(_0x222b88[_0xa75e('0x3b')]){logger[_0xa75e('0x2f')]('[%s][QUEUE]\x20%s',_0x5988b7,_[_0xa75e('0x3c')](_0x222b88,_0xa75e('0x26'))[_0xa75e('0x3d')](',\x20'));_0x3ad6a0[_0xa75e('0x3e')]();}else{var _0x51318d=_['find'](_0x24d54a[_0x554179['channel']+_0xa75e('0x3f')],handleFindQueue(_0x17964e[_0xa75e('0x2b')]));if(_0x51318d){startRouting(_0x5988b7,_0x51318d,_0x554179,_0x24d54a);var _0x12ac1d=(_0x51318d[_0xa75e('0x37')]||0xa)*0x3e8;var _0x55a338=(_0x17964e[_0xa75e('0x37')]||0x14)*0x3e8;var _0x4d0ff9,_0x465e22;if(_0x12ac1d>_0x55a338){_0x55a338=_0x12ac1d;}var _0x3c8ba3=seqqueue[_0xa75e('0x40')](_0x12ac1d);_0x3c8ba3['id']=_0x5988b7;_0x3c8ba3['atimeout']=_0x12ac1d;_0x3c8ba3[_0xa75e('0x41')]=_0x55a338;_0x3c8ba3[_0xa75e('0x21')]=_0x554179['channel'];_0x24d54a[_0xa75e('0x42')][_0x5988b7]['on'](_0xa75e('0x43'),function(){logger[_0xa75e('0x29')](_0xa75e('0x44'),_0x5988b7);stopRouting(_0x5988b7,_0x51318d,_0x554179,_0x24d54a);clearTimeout(_0x4d0ff9);_0x4d0ff9=undefined;_0x3c8ba3['close'](!![]);if(_0x24d54a[_0xa75e('0x42')][_0x5988b7]){delete _0x24d54a[_0xa75e('0x42')][_0x5988b7];}_0x3ad6a0[_0xa75e('0x3e')]();});_0x24d54a[_0xa75e('0x42')][_0x5988b7]['on']('complete',function(){if(_0x24d54a[_0xa75e('0x42')][_0x5988b7]){delete _0x24d54a['rules'][_0x5988b7];}});_0x4d0ff9=setTimeout(function(){logger[_0xa75e('0x29')](_0xa75e('0x45'),_0x5988b7);endRouting(_0x5988b7,_0x51318d,_0x554179,_0x24d54a);clearTimeout(_0x4d0ff9);_0x3c8ba3[_0xa75e('0x46')](!![]);_0x3ad6a0['next']();},_0x55a338);switch(_0x51318d[_0xa75e('0x47')]){case _0xa75e('0x48'):strategy[_0xa75e('0x48')](_0x3c8ba3,_0x51318d,_0x24d54a,_0x554179);break;default:strategy['beepall'](_0x3c8ba3,_0x51318d,_0x24d54a,_0x554179);}}else{logger[_0xa75e('0x2f')](_0xa75e('0x49'),_0x5988b7,_0x17964e[_0xa75e('0x2b')]);_0x3ad6a0['stop']();}}}catch(_0x24dd7a){console['log'](_0x24dd7a);logger[_0xa75e('0x2f')](_0xa75e('0x4a'),_0x5988b7,_0x24dd7a[_0xa75e('0x4b')]);_0x3ad6a0['stop']();}};}; \ No newline at end of file +var _0x1cab=['find','createQueue','atimeout','qtimeout','rules','end','complete','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','beepall','stack','validate','lodash','util','seq-queue','moment','ioredis','../../../../config/environment','../../../../config/logger','./strategy','redis','defaults','localhost','queue_id','queue','from','joinAt','emit','clone','%sQueuesWaitingInteractions','pick','format','%s:queue:%s','%s_queue_waiting_interaction:%s','remove','../../rpc/openchannelQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','number','timeout\x20is\x20a\x20number','body','YYYY-MM-DD\x20HH:mm:ss','contact','channel','InteractionId','interaction','upperFirst','MessageId','message','chat','AccountId','WebsiteId','account','info','name','QueueReport','create','catch','create\x20queue\x20report','waiting','[%s][STOP:QUEUE][NAME:%s]','update','error','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','join','stop'];(function(_0x2573f8,_0x10e6ac){var _0x45ea40=function(_0x45fdb8){while(--_0x45fdb8){_0x2573f8['push'](_0x2573f8['shift']());}};_0x45ea40(++_0x10e6ac);}(_0x1cab,0x18e));var _0xb1ca=function(_0x56bc96,_0x1239c1){_0x56bc96=_0x56bc96-0x0;var _0x28090f=_0x1cab[_0x56bc96];return _0x28090f;};'use strict';var schema=require(_0xb1ca('0x0'));var _=require(_0xb1ca('0x1'));var util=require(_0xb1ca('0x2'));var seqqueue=require(_0xb1ca('0x3'));var moment=require(_0xb1ca('0x4'));var Redis=require(_0xb1ca('0x5'));var config=require(_0xb1ca('0x6'));var logger=require(_0xb1ca('0x7'))('routing');var strategy=require(_0xb1ca('0x8'));config[_0xb1ca('0x9')]=_[_0xb1ca('0xa')](config[_0xb1ca('0x9')],{'host':_0xb1ca('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xb1ca('0x9')]));var attributes=['id',_0xb1ca('0xc'),'account',_0xb1ca('0xd'),_0xb1ca('0xe'),_0xb1ca('0xf')];function emit(_0x4a6c3c,_0x4e99ea,_0x168b08){io['to'](_0x4a6c3c)[_0xb1ca('0x10')](_0x4e99ea,_0x168b08);}function emitChannelQueueInteraction(_0xb67e3e,_0x1be511,_0x2b7808,_0x219f77,_0x4da7ca,_0x636d97,_0x48a203,_0x260209){var _0x406b17=_[_0xb1ca('0x11')](_0x2b7808);_0x406b17[_0xb1ca('0xc')]=_0x260209;_0x406b17[_0xb1ca('0xd')]=_0x1be511;_0x406b17['account']=_0x219f77;_0x406b17['id']=_0x4da7ca;if(_0x636d97){_0x48a203[util['format'](_0xb1ca('0x12'),_0xb67e3e)][_0x4da7ca]=_[_0xb1ca('0x13')](_0x406b17,attributes);}else{delete _0x48a203[util[_0xb1ca('0x14')]('%sQueuesWaitingInteractions',_0xb67e3e)][_0x4da7ca];}emit(util[_0xb1ca('0x14')](_0xb1ca('0x15'),_0xb67e3e,_0x1be511),util['format'](_0xb1ca('0x16'),_0xb67e3e,_0x636d97?'save':_0xb1ca('0x17')),_[_0xb1ca('0x13')](_0x406b17,attributes));}var rpc={'openchannelQueueReport':require(_0xb1ca('0x18')),'mailQueueReport':require('../../rpc/mailQueueReport'),'chatQueueReport':require(_0xb1ca('0x19')),'smsQueueReport':require(_0xb1ca('0x1a')),'faxQueueReport':require(_0xb1ca('0x1b')),'whatsappQueueReport':require(_0xb1ca('0x1c'))};var queue=schema({'name':{'type':_0xb1ca('0x1d'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0xb1ca('0x1e'),'message':_0xb1ca('0x1f')}});function startRouting(_0x564389,_0x3ad6ed,_0x4f7602,_0x4e846b){if(_0x564389&&_0x3ad6ed&&_0x4f7602){_0x3ad6ed['waiting']+=0x1;var _0x376757={'uniqueid':_0x564389,'from':_0x4f7602[_0xb1ca('0x20')]?_0x4f7602['body']['from']:'','joinAt':moment()[_0xb1ca('0x14')](_0xb1ca('0x21')),'ContactId':_0x4f7602[_0xb1ca('0x22')]?_0x4f7602[_0xb1ca('0x22')]['id']:null,'ListId':_0x4f7602['list']?_0x4f7602['list']['id']:null};_0x376757[_['upperFirst'](_0x4f7602[_0xb1ca('0x23')])+'QueueId']=_0x3ad6ed['id']||null;_0x376757[_['upperFirst'](_0x4f7602[_0xb1ca('0x23')])+_0xb1ca('0x24')]=_0x4f7602[_0xb1ca('0x25')]?_0x4f7602[_0xb1ca('0x25')]['id']:null;_0x376757[_[_0xb1ca('0x26')](_0x4f7602[_0xb1ca('0x23')])+_0xb1ca('0x27')]=_0x4f7602['message']?_0x4f7602[_0xb1ca('0x28')]['id']:null;_0x376757[_[_0xb1ca('0x26')](_0x4f7602[_0xb1ca('0x23')])+(_0x4f7602[_0xb1ca('0x23')]!==_0xb1ca('0x29')?_0xb1ca('0x2a'):_0xb1ca('0x2b'))]=_0x4f7602[_0xb1ca('0x2c')]?_0x4f7602[_0xb1ca('0x2c')]['id']:null;logger[_0xb1ca('0x2d')](util['format']('[%s][START:QUEUE][NAME:%s]',_0x564389,_0x3ad6ed[_0xb1ca('0x2e')]));emitChannelQueueInteraction(_0x4f7602[_0xb1ca('0x23')],_0x3ad6ed[_0xb1ca('0x2e')],_0x376757,_0x4f7602[_0xb1ca('0x2c')][_0xb1ca('0x2e')],_0x4f7602[_0xb1ca('0x28')]['id'],!![],_0x4e846b,_0x3ad6ed['id']);if(rpc[_0x4f7602[_0xb1ca('0x23')]+_0xb1ca('0x2f')]){return rpc[_0x4f7602['channel']+_0xb1ca('0x2f')][_0xb1ca('0x30')](_0x376757)[_0xb1ca('0x31')](function(_0x1360bb){logger['error'](_0xb1ca('0x32'));});}}}function stopRouting(_0x2da394,_0x26c542,_0xcdadba,_0xecab90){if(_0x2da394&&_0x26c542){_0x26c542[_0xb1ca('0x33')]-=0x1;var _0x7eb719={'leaveAt':moment()[_0xb1ca('0x14')]('YYYY-MM-DD\x20HH:mm:ss'),'acceptAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'reason':'accepted'};logger['info'](util['format'](_0xb1ca('0x34'),_0x2da394,_0x26c542['name']));emitChannelQueueInteraction(_0xcdadba[_0xb1ca('0x23')],_0x26c542[_0xb1ca('0x2e')],_0xcdadba[_0xb1ca('0x20')],_0xcdadba['account']['name'],_0xcdadba[_0xb1ca('0x28')]['id'],![],_0xecab90,_0x26c542['id']);if(rpc[_0xcdadba['channel']+_0xb1ca('0x2f')]){return rpc[_0xcdadba[_0xb1ca('0x23')]+_0xb1ca('0x2f')][_0xb1ca('0x35')](_0x2da394,_0x7eb719)[_0xb1ca('0x31')](function(_0x265d49){logger[_0xb1ca('0x36')](_0xb1ca('0x37'));});}}}function endRouting(_0x2727ab,_0x14afb3,_0x58c609,_0x1fd2ed){if(_0x2727ab&&_0x14afb3){_0x14afb3[_0xb1ca('0x33')]-=0x1;var _0x5dac5d={'leaveAt':moment()[_0xb1ca('0x14')](_0xb1ca('0x21')),'exitAt':moment()[_0xb1ca('0x14')](_0xb1ca('0x21')),'reason':_0xb1ca('0x38')};logger['info'](util[_0xb1ca('0x14')](_0xb1ca('0x39'),_0x2727ab,_0x14afb3[_0xb1ca('0x2e')]));emitChannelQueueInteraction(_0x58c609[_0xb1ca('0x23')],_0x14afb3[_0xb1ca('0x2e')],_0x58c609[_0xb1ca('0x20')],_0x58c609[_0xb1ca('0x2c')][_0xb1ca('0x2e')],_0x58c609[_0xb1ca('0x28')]['id'],![],_0x1fd2ed);if(rpc[_0x58c609[_0xb1ca('0x23')]+_0xb1ca('0x2f')]){return rpc[_0x58c609[_0xb1ca('0x23')]+_0xb1ca('0x2f')]['update'](_0x2727ab,_0x5dac5d)['catch'](function(_0xa26d75){logger[_0xb1ca('0x36')](_0xb1ca('0x37'));});}}}function handleFindQueue(_0x50b434){return function(_0x4f7351){return _0x4f7351[_0xb1ca('0x2e')]['toLowerCase']()===_0x50b434[_0xb1ca('0x3a')]();};}exports[_0xb1ca('0x3b')]=function(_0x37b600,_0x528768,_0x54eb27,_0x77c628){return function(_0x737819){try{var _0x67cb55={'name':_0x528768[0x0],'timeout':_0x528768[0x1]};var _0x138101=queue[_0xb1ca('0x0')](_0x67cb55,{'typecast':!![]});if(_0x138101[_0xb1ca('0x3c')]){logger[_0xb1ca('0x36')](_0xb1ca('0x3d'),_0x37b600,_['map'](_0x138101,_0xb1ca('0x28'))[_0xb1ca('0x3e')](',\x20'));_0x737819[_0xb1ca('0x3f')]();}else{var _0x3b9ba2=_[_0xb1ca('0x40')](_0x54eb27[_0x77c628[_0xb1ca('0x23')]+'Queues'],handleFindQueue(_0x67cb55[_0xb1ca('0x2e')]));if(_0x3b9ba2){startRouting(_0x37b600,_0x3b9ba2,_0x77c628,_0x54eb27);var _0x40435d=(_0x3b9ba2[_0xb1ca('0x38')]||0xa)*0x3e8;var _0x495aff=(_0x67cb55['timeout']||0x14)*0x3e8;var _0x513f74,_0x38cab0;if(_0x40435d>_0x495aff){_0x495aff=_0x40435d;}var _0x40f46a=seqqueue[_0xb1ca('0x41')](_0x40435d);_0x40f46a['id']=_0x37b600;_0x40f46a[_0xb1ca('0x42')]=_0x40435d;_0x40f46a[_0xb1ca('0x43')]=_0x495aff;_0x40f46a[_0xb1ca('0x23')]=_0x77c628[_0xb1ca('0x23')];_0x54eb27[_0xb1ca('0x44')][_0x37b600]['on'](_0xb1ca('0x45'),function(){logger[_0xb1ca('0x2d')]('[%s][QUEUE]\x20ROUTING\x20STOPPED',_0x37b600);stopRouting(_0x37b600,_0x3b9ba2,_0x77c628,_0x54eb27);clearTimeout(_0x513f74);_0x513f74=undefined;_0x40f46a['close'](!![]);if(_0x54eb27[_0xb1ca('0x44')][_0x37b600]){delete _0x54eb27['rules'][_0x37b600];}_0x737819['stop']();});_0x54eb27[_0xb1ca('0x44')][_0x37b600]['on'](_0xb1ca('0x46'),function(){if(_0x54eb27[_0xb1ca('0x44')][_0x37b600]){delete _0x54eb27[_0xb1ca('0x44')][_0x37b600];}});_0x513f74=setTimeout(function(){logger[_0xb1ca('0x2d')](_0xb1ca('0x47'),_0x37b600);endRouting(_0x37b600,_0x3b9ba2,_0x77c628,_0x54eb27);clearTimeout(_0x513f74);_0x40f46a['close'](!![]);_0x737819[_0xb1ca('0x48')]();},_0x495aff);switch(_0x3b9ba2[_0xb1ca('0x49')]){case _0xb1ca('0x4a'):strategy[_0xb1ca('0x4a')](_0x40f46a,_0x3b9ba2,_0x54eb27,_0x77c628);break;default:strategy[_0xb1ca('0x4b')](_0x40f46a,_0x3b9ba2,_0x54eb27,_0x77c628);}}else{logger[_0xb1ca('0x36')]('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0x37b600,_0x67cb55['name']);_0x737819[_0xb1ca('0x3f')]();}}}catch(_0x5a633c){console['log'](_0x5a633c);logger['error'](_0xb1ca('0x3d'),_0x37b600,_0x5a633c[_0xb1ca('0x4c')]);_0x737819[_0xb1ca('0x3f')]();}};}; \ 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 4bdc288..ec84331 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 _0x0e77=['TIMEOUT','exports','lodash','uuid','notificationId','squeue','agent','realtime','push','handleRun','handleTimeout','bind','timeout','drained','handleDrained','prototype','info','[%s][AGENT]\x20try\x20with\x20%s','isNil','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','agents','channel','busyQueue','routing','RINGING','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','busy','writeLog','STOP'];(function(_0x4b43e1,_0x506077){var _0x531e5e=function(_0x40019f){while(--_0x40019f){_0x4b43e1['push'](_0x4b43e1['shift']());}};_0x531e5e(++_0x506077);}(_0x0e77,0xc8));var _0x70e7=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x0e77[_0x46698a];return _0x356db0;};'use strict';var _=require(_0x70e7('0x0'));var uuid=require(_0x70e7('0x1'));var util=require('./util');var logger=require('../../../../../config/logger')('routing');var Agent=function(_0x321cb1,_0x1763cc,_0x49ca5d,_0x194409){this[_0x70e7('0x2')]=uuid['v4']();this[_0x70e7('0x3')]=_0x321cb1;this[_0x70e7('0x4')]=_0x1763cc;this[_0x70e7('0x5')]=_0x49ca5d;this['routing']=_0x194409;this[_0x70e7('0x3')][_0x70e7('0x6')](this[_0x70e7('0x7')]['bind'](this),this[_0x70e7('0x8')][_0x70e7('0x9')](this));this['squeue']['on'](_0x70e7('0xa'),this['handleTimeout']['bind'](this));this[_0x70e7('0x3')]['on'](_0x70e7('0xb'),this[_0x70e7('0xc')][_0x70e7('0x9')](this));};Agent[_0x70e7('0xd')][_0x70e7('0x6')]=function(){this[_0x70e7('0x3')][_0x70e7('0x6')](this[_0x70e7('0x7')][_0x70e7('0x9')](this),this['handleTimeout']['bind'](this));};Agent[_0x70e7('0xd')]['handleDrained']=function(){this[_0x70e7('0x8')](!![]);};Agent[_0x70e7('0xd')]['handleRun']=function(_0xd95a50){logger[_0x70e7('0xe')](_0x70e7('0xf'),this['squeue']['id'],this[_0x70e7('0x4')]['id']);if(_[_0x70e7('0x10')](this['realtime']['agents'][this[_0x70e7('0x4')]['id']])){logger['info'](_0x70e7('0x11'),this[_0x70e7('0x3')]['id'],this[_0x70e7('0x4')]['id']);setTimeout(this[_0x70e7('0x6')]['bind'](this),0x3e8);}else{if(this['routing'][_0x70e7('0x12')]||util[_0x70e7('0x13')](this[_0x70e7('0x3')]['id'],this[_0x70e7('0x5')][_0x70e7('0x14')][this[_0x70e7('0x4')]['id']],this[_0x70e7('0x3')][_0x70e7('0x15')],![])){this[_0x70e7('0x5')]['agents'][this['agent']['id']]['busy']=!![];this[_0x70e7('0x5')][_0x70e7('0x14')][this[_0x70e7('0x4')]['id']][_0x70e7('0x16')]=undefined;util['showNotification'](this[_0x70e7('0x2')],this['squeue']['id'],this[_0x70e7('0x5')][_0x70e7('0x14')][this[_0x70e7('0x4')]['id']],null,this[_0x70e7('0x17')]);util['writeLog'](this['squeue']['id'],this[_0x70e7('0x5')]['agents'][this[_0x70e7('0x4')]['id']],_0x70e7('0x18')+(this[_0x70e7('0x17')]['forcedOwnership']?':FORCED':''));}else{logger[_0x70e7('0xe')](_0x70e7('0x19'),this[_0x70e7('0x3')]['id'],this['agent']['id']);setTimeout(this[_0x70e7('0x6')][_0x70e7('0x9')](this),0x3e8);}}};Agent[_0x70e7('0xd')]['handleTimeout']=function(_0x7bc667){if(_[_0x70e7('0x10')](this[_0x70e7('0x5')]['agents'][this[_0x70e7('0x4')]['id']])){return logger[_0x70e7('0xe')](_0x70e7('0x11'),this[_0x70e7('0x3')]['id'],this[_0x70e7('0x4')]['id']);}else{logger[_0x70e7('0xe')](_0x70e7('0x1a'),this['squeue']['id'],this[_0x70e7('0x4')]['id']);util[_0x70e7('0x1b')](this[_0x70e7('0x2')],this[_0x70e7('0x3')]['id'],this[_0x70e7('0x5')][_0x70e7('0x14')][this['agent']['id']],null,this[_0x70e7('0x17')]);this[_0x70e7('0x5')]['agents'][this['agent']['id']][_0x70e7('0x1c')]=![];this[_0x70e7('0x5')]['agents'][this[_0x70e7('0x4')]['id']][_0x70e7('0x16')]=undefined;util[_0x70e7('0x1d')](this[_0x70e7('0x3')]['id'],this[_0x70e7('0x5')][_0x70e7('0x14')][this[_0x70e7('0x4')]['id']],_0x7bc667?_0x70e7('0x1e'):_0x70e7('0x1f'));}if(!_0x7bc667){setTimeout(this[_0x70e7('0x6')][_0x70e7('0x9')](this),0x3e8);}};function agent(_0x3a9562,_0x2f95c8,_0x4fea55,_0x2bf18a){return new Agent(_0x3a9562,_0x2f95c8,_0x4fea55,_0x2bf18a);}module[_0x70e7('0x20')]=agent; \ No newline at end of file +var _0xf00e=['forcedOwnership',':FORCED','isNil','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','busyQueue','TIMEOUT','lodash','uuid','./util','../../../../../config/logger','routing','squeue','agent','realtime','push','handleRun','timeout','bind','drained','handleDrained','handleTimeout','prototype','[%s][AGENT]\x20try\x20with\x20%s','agents','info','isAgentAvailable','channel','busy','notificationId','writeLog','RINGING'];(function(_0x51bbb3,_0x324911){var _0x18bf9c=function(_0x19145a){while(--_0x19145a){_0x51bbb3['push'](_0x51bbb3['shift']());}};_0x18bf9c(++_0x324911);}(_0xf00e,0x1e7));var _0xef00=function(_0x2b33a2,_0x57d7d0){_0x2b33a2=_0x2b33a2-0x0;var _0x357314=_0xf00e[_0x2b33a2];return _0x357314;};'use strict';var _=require(_0xef00('0x0'));var uuid=require(_0xef00('0x1'));var util=require(_0xef00('0x2'));var logger=require(_0xef00('0x3'))(_0xef00('0x4'));var Agent=function(_0x25ec5d,_0x376d66,_0x4e63da,_0x4a6306){this['notificationId']=uuid['v4']();this[_0xef00('0x5')]=_0x25ec5d;this[_0xef00('0x6')]=_0x376d66;this[_0xef00('0x7')]=_0x4e63da;this[_0xef00('0x4')]=_0x4a6306;this[_0xef00('0x5')][_0xef00('0x8')](this[_0xef00('0x9')]['bind'](this),this['handleTimeout']['bind'](this));this['squeue']['on'](_0xef00('0xa'),this['handleTimeout'][_0xef00('0xb')](this));this[_0xef00('0x5')]['on'](_0xef00('0xc'),this[_0xef00('0xd')][_0xef00('0xb')](this));};Agent['prototype']['push']=function(){this['squeue'][_0xef00('0x8')](this[_0xef00('0x9')][_0xef00('0xb')](this),this[_0xef00('0xe')][_0xef00('0xb')](this));};Agent[_0xef00('0xf')][_0xef00('0xd')]=function(){this[_0xef00('0xe')](!![]);};Agent[_0xef00('0xf')][_0xef00('0x9')]=function(_0x556a2f){logger['info'](_0xef00('0x10'),this['squeue']['id'],this[_0xef00('0x6')]['id']);if(_['isNil'](this[_0xef00('0x7')][_0xef00('0x11')][this['agent']['id']])){logger[_0xef00('0x12')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0xef00('0x5')]['id'],this[_0xef00('0x6')]['id']);setTimeout(this['push']['bind'](this),0x3e8);}else{if(this['routing']['forcedOwnership']||util[_0xef00('0x13')](this[_0xef00('0x5')]['id'],this[_0xef00('0x7')][_0xef00('0x11')][this[_0xef00('0x6')]['id']],this['squeue'][_0xef00('0x14')],![])){this[_0xef00('0x7')]['agents'][this['agent']['id']][_0xef00('0x15')]=!![];this[_0xef00('0x7')][_0xef00('0x11')][this[_0xef00('0x6')]['id']]['busyQueue']=undefined;util['showNotification'](this[_0xef00('0x16')],this[_0xef00('0x5')]['id'],this[_0xef00('0x7')][_0xef00('0x11')][this['agent']['id']],null,this[_0xef00('0x4')]);util[_0xef00('0x17')](this[_0xef00('0x5')]['id'],this['realtime'][_0xef00('0x11')][this['agent']['id']],_0xef00('0x18')+(this[_0xef00('0x4')][_0xef00('0x19')]?_0xef00('0x1a'):''));}else{logger[_0xef00('0x12')]('[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available',this['squeue']['id'],this['agent']['id']);setTimeout(this[_0xef00('0x8')][_0xef00('0xb')](this),0x3e8);}}};Agent[_0xef00('0xf')][_0xef00('0xe')]=function(_0x4ed3b3){if(_[_0xef00('0x1b')](this[_0xef00('0x7')][_0xef00('0x11')][this['agent']['id']])){return logger[_0xef00('0x12')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0xef00('0x5')]['id'],this[_0xef00('0x6')]['id']);}else{logger['info'](_0xef00('0x1c'),this['squeue']['id'],this[_0xef00('0x6')]['id']);util[_0xef00('0x1d')](this['notificationId'],this[_0xef00('0x5')]['id'],this[_0xef00('0x7')][_0xef00('0x11')][this[_0xef00('0x6')]['id']],null,this[_0xef00('0x4')]);this[_0xef00('0x7')][_0xef00('0x11')][this['agent']['id']][_0xef00('0x15')]=![];this['realtime'][_0xef00('0x11')][this[_0xef00('0x6')]['id']][_0xef00('0x1e')]=undefined;util[_0xef00('0x17')](this[_0xef00('0x5')]['id'],this['realtime'][_0xef00('0x11')][this[_0xef00('0x6')]['id']],_0x4ed3b3?'STOP':_0xef00('0x1f'));}if(!_0x4ed3b3){setTimeout(this[_0xef00('0x8')][_0xef00('0xb')](this),0x3e8);}};function agent(_0x16e80b,_0x1a1d06,_0x5cc8a9,_0x112b05){return new Agent(_0x16e80b,_0x1a1d06,_0x5cc8a9,_0x112b05);}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 504e1cd..b13603d 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 _0x3fc6=['handleRun','bind','timeout','handleTimeout','drained','handleDrained','prototype','push','isNil','queue','Agents','length','agents','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','channel','writeLog','RINGING','busyQueue','name','info','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','hideNotification','STOP','busy','lodash','uuid','./util','routing','notificationId','realtime','squeue'];(function(_0xaf9d09,_0xdf106b){var _0x10428e=function(_0x63199f){while(--_0x63199f){_0xaf9d09['push'](_0xaf9d09['shift']());}};_0x10428e(++_0xdf106b);}(_0x3fc6,0x159));var _0x63fc=function(_0x2162fa,_0x416219){_0x2162fa=_0x2162fa-0x0;var _0x460581=_0x3fc6[_0x2162fa];return _0x460581;};'use strict';var _=require(_0x63fc('0x0'));var uuid=require(_0x63fc('0x1'));var util=require(_0x63fc('0x2'));var logger=require('../../../../../config/logger')(_0x63fc('0x3'));var Beepall=function(_0x378b62,_0x2a31b2,_0x133695,_0x155db7){this[_0x63fc('0x4')]=uuid['v4']();this['squeue']=_0x378b62;this['queue']=_0x2a31b2;this[_0x63fc('0x5')]=_0x133695;this[_0x63fc('0x3')]=_0x155db7;this[_0x63fc('0x6')]['push'](this[_0x63fc('0x7')][_0x63fc('0x8')](this),this['handleTimeout'][_0x63fc('0x8')](this));this[_0x63fc('0x6')]['on'](_0x63fc('0x9'),this[_0x63fc('0xa')][_0x63fc('0x8')](this));this[_0x63fc('0x6')]['on'](_0x63fc('0xb'),this[_0x63fc('0xc')][_0x63fc('0x8')](this));};Beepall[_0x63fc('0xd')]['push']=function(){this[_0x63fc('0x6')][_0x63fc('0xe')](this[_0x63fc('0x7')]['bind'](this),this['handleTimeout'][_0x63fc('0x8')](this));};Beepall[_0x63fc('0xd')][_0x63fc('0xc')]=function(_0x13c445){this[_0x63fc('0xa')](!![]);};Beepall[_0x63fc('0xd')]['handleRun']=function(_0x3c3da1){var _0x1b0260=!![];if(!_[_0x63fc('0xf')](this[_0x63fc('0x10')])&&!_['isNil'](this[_0x63fc('0x10')]['Agents'])&&this[_0x63fc('0x10')][_0x63fc('0x11')][_0x63fc('0x12')]>0x0){for(var _0x42ef5e=0x0,_0x1071d9;_0x42ef5e0x0){for(var _0x24f4b0=0x0,_0x586371;_0x24f4b00x0&&_0x18af5c[_0x30e1b0+_0x0fcf('0x29')]>=_0x18af5c[_0x30e1b0+_0x0fcf('0x28')]){writeLog(_0x41b20b,_0x18af5c,_0x30e1b0[_0x0fcf('0x2a')]()+_0x0fcf('0x2b'));return![];}}return!![];};exports[_0x0fcf('0x2c')]=function(_0x2730b0,_0x527d43,_0x137e10,_0xbaa4d8,_0x200517){return sendNotification(!![],_0x2730b0,_0x527d43,_0x137e10,_0xbaa4d8,_0x200517);};exports[_0x0fcf('0x2d')]=function(_0x49fd0e,_0x5d9bcd,_0x4af80d,_0x428194,_0x50b7df){return sendNotification(![],_0x49fd0e,_0x5d9bcd,_0x4af80d,_0x428194,_0x50b7df);};exports[_0x0fcf('0x2e')]=writeLog; \ No newline at end of file +var _0x7096=['notification:%s','remove','info','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','busy','BUSY','online','Pause','PAUSE','hasOwnProperty','Capacity','CurrentCapacity','toUpperCase','showNotification','hideNotification','util','mustache','../../../../../config/environment','../../../../../config/logger','routing','redis','defaults','localhost','socket.io-emitter','emit','format','user:%s','user:save','split','\x20interaction','name','account','notificationShake','body','queue','msg','getMustacheRender','I\x20can\x27t\x20render\x20your\x20template','error','[%s][QUEUE]\x20%s','message'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7096,0x10c));var _0x6709=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0x7096[_0x2b10c6];return _0x3789d2;};'use strict';var _=require('lodash');var util=require(_0x6709('0x0'));var utils=require('../utils');var Mustache=require(_0x6709('0x1'));var Redis=require('ioredis');var config=require(_0x6709('0x2'));var logger=require(_0x6709('0x3'))(_0x6709('0x4'));config[_0x6709('0x5')]=_[_0x6709('0x6')](config[_0x6709('0x5')],{'host':_0x6709('0x7'),'port':0x18eb});var io=require(_0x6709('0x8'))(new Redis(config[_0x6709('0x5')]));function emit(_0x3e2223,_0x11ad23,_0x985814){io['to'](_0x3e2223)[_0x6709('0x9')](_0x11ad23,_0x985814);}function sendNotification(_0x513ab6,_0x5af380,_0x2c07b1,_0x2d8c0b,_0xbcb47,_0x1aa476){io['to'](util[_0x6709('0xa')](_0x6709('0xb'),_0x2d8c0b['name']))['emit'](_0x6709('0xc'),_0x2d8c0b);var _0x262261=_0x1aa476||{};var _0x275dd3=_0x2c07b1[_0x6709('0xd')]('.');var _0x31ac88={'uniqueid':_0x5af380,'channel':_0x275dd3[0x0],'id':_0x275dd3[0x1],'title':_0x275dd3[0x0]+_0x6709('0xe'),'interactionId':_0x275dd3[0x2],'queue':_0xbcb47?_0xbcb47[_0x6709('0xf')]:null,'sound':_0x262261[_0x6709('0x10')]['notificationSound'],'shake':_0x262261[_0x6709('0x10')][_0x6709('0x11')]};try{if(!_0x262261[_0x6709('0x12')]){_0x262261[_0x6709('0x12')]={};}if(_0xbcb47){_0x262261['body'][_0x6709('0x13')]=_0xbcb47;}else if(_0x262261['body'][_0x6709('0x13')]){delete _0x262261['body'][_0x6709('0x13')];}_0x31ac88[_0x6709('0x14')]=utils[_0x6709('0x15')](_0x262261[_0x6709('0x10')]['notificationTemplate'],_0x262261);}catch(_0x52e342){_0x31ac88['msg']=_0x6709('0x16');logger[_0x6709('0x17')](util['format'](_0x6709('0x18'),_0x5af380,_0x52e342[_0x6709('0x19')]));}io['to'](util[_0x6709('0xa')]('user:%s',_0x2d8c0b[_0x6709('0xf')]))[_0x6709('0x9')](util[_0x6709('0xa')](_0x6709('0x1a'),_0x513ab6?'save':_0x6709('0x1b')),_0x31ac88);}function writeLog(_0x1edac3,_0x373047,_0x3cf882){return logger[_0x6709('0x1c')](util[_0x6709('0xa')](_0x6709('0x1d'),_0x1edac3,_0x373047[_0x6709('0xf')],_0x3cf882));}exports[_0x6709('0x1e')]=function(_0x1c5153,_0x2f3415,_0xa36371,_0x5cf48b){if(_0x2f3415[_0x6709('0x1f')]){writeLog(_0x1c5153,_0x2f3415,_0x6709('0x20'));return![];}if(!_0x2f3415[_0x6709('0x21')]){writeLog(_0x1c5153,_0x2f3415,'OFFLINE');return![];}if(_0x2f3415[_0xa36371+_0x6709('0x22')]){writeLog(_0x1c5153,_0x2f3415,_0x6709('0x23'));return![];}if(_0x5cf48b&&_0x2f3415[_0x6709('0x24')](_0xa36371+_0x6709('0x25'))&&_0x2f3415['hasOwnProperty'](_0xa36371+_0x6709('0x26'))){if(_0x2f3415[_0xa36371+_0x6709('0x25')]>0x0&&_0x2f3415[_0xa36371+'CurrentCapacity']>=_0x2f3415[_0xa36371+_0x6709('0x25')]){writeLog(_0x1c5153,_0x2f3415,_0xa36371[_0x6709('0x27')]()+'\x20MAXCAPACITY');return![];}}return!![];};exports[_0x6709('0x28')]=function(_0x2499a2,_0x50ada6,_0x271098,_0x5b5201,_0x46a325){return sendNotification(!![],_0x2499a2,_0x50ada6,_0x271098,_0x5b5201,_0x46a325);};exports[_0x6709('0x29')]=function(_0x5b6906,_0x137137,_0x4e6989,_0xe066d8,_0x388aee){return sendNotification(![],_0x5b6906,_0x137137,_0x4e6989,_0xe066d8,_0x388aee);};exports['writeLog']=writeLog; \ No newline at end of file diff --git a/server/services/routing/server/applications/system.js b/server/services/routing/server/applications/system.js index 77279aa..18aacb0 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 _0x1261=['map','message','join','info','next','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','validate','shelljs','./utils','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','error','[%s][SYSTEM]\x20%s'];(function(_0x4792c8,_0x5158a1){var _0x35edb1=function(_0x2472d3){while(--_0x2472d3){_0x4792c8['push'](_0x4792c8['shift']());}};_0x35edb1(++_0x5158a1);}(_0x1261,0x1a8));var _0x1126=function(_0x803ae0,_0x5c5f30){_0x803ae0=_0x803ae0-0x0;var _0x3c38b1=_0x1261[_0x803ae0];return _0x3c38b1;};'use strict';var schema=require(_0x1126('0x0'));var sh=require(_0x1126('0x1'));var _=require('lodash');var utils=require(_0x1126('0x2'));var logger=require('../../../../config/logger')(_0x1126('0x3'));var system=schema({'command':{'type':_0x1126('0x4'),'required':!![],'message':_0x1126('0x5')}});exports['consequence']=function(_0x2409b5,_0x79a0c4){return function(_0x94c8c0){try{var _0x56c2fb={'command':_0x79a0c4[0x0]};var _0x5efc88=system[_0x1126('0x0')](_0x56c2fb,{'typecast':!![]});if(_0x5efc88['length']){logger[_0x1126('0x6')](_0x1126('0x7'),_0x2409b5,_[_0x1126('0x8')](_0x5efc88,_0x1126('0x9'))[_0x1126('0xa')](',\x20'));logger[_0x1126('0xb')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x2409b5);_0x94c8c0[_0x1126('0xc')]();}else{var _0x3a68fc=this;var _0x1d661f=utils['getMustacheRender'](_0x79a0c4[0x0],this);logger[_0x1126('0xb')](_0x1126('0xd'),_0x2409b5,_0x1d661f);sh[_0x1126('0xe')](_[_0x1126('0xf')](_0x1d661f),function(_0x1ca8c,_0x38bd5e){logger[_0x1126('0xb')](_0x1126('0x10'),_0x2409b5,_0x1ca8c);if(_0x1ca8c==0x0){var _0x4e9f8d=_0x38bd5e[_0x1126('0x11')](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0x79a0c4[0x1])||_[_0x1126('0x12')](_0x79a0c4[0x1])){logger[_0x1126('0xb')](_0x1126('0x13'),_0x2409b5);_0x3a68fc[_0x1126('0x14')][_0x79a0c4[0x1]]=_0x4e9f8d;}else{logger[_0x1126('0xb')](_0x1126('0x15'),_0x2409b5,_0x79a0c4[0x1],_0x4e9f8d);_0x3a68fc['body'][_0x79a0c4[0x1]]=_0x4e9f8d;}}_0x94c8c0['next']();});}}catch(_0x21e2e1){logger[_0x1126('0x6')](_0x1126('0x7'),_0x2409b5,_[_0x1126('0x16')](_0x21e2e1)?JSON['stringify'](_0x21e2e1):_0x21e2e1);logger[_0x1126('0xb')](_0x1126('0x17'),_0x2409b5);_0x94c8c0['next']();}};}; \ No newline at end of file +var _0xdf0a=['trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','validate','shelljs','lodash','./utils','../../../../config/logger','string','length','error','[%s][SYSTEM]\x20%s','map','message','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec'];(function(_0x44e0af,_0x1dfeb1){var _0x545d50=function(_0xd40dc6){while(--_0xd40dc6){_0x44e0af['push'](_0x44e0af['shift']());}};_0x545d50(++_0x1dfeb1);}(_0xdf0a,0x1a9));var _0xadf0=function(_0x411bcb,_0x4803c1){_0x411bcb=_0x411bcb-0x0;var _0x1ed5c8=_0xdf0a[_0x411bcb];return _0x1ed5c8;};'use strict';var schema=require(_0xadf0('0x0'));var sh=require(_0xadf0('0x1'));var _=require(_0xadf0('0x2'));var utils=require(_0xadf0('0x3'));var logger=require(_0xadf0('0x4'))('routing');var system=schema({'command':{'type':_0xadf0('0x5'),'required':!![],'message':'command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports['consequence']=function(_0x183ad1,_0x1c5842){return function(_0x4b2e77){try{var _0x2bb29c={'command':_0x1c5842[0x0]};var _0x41b3f1=system[_0xadf0('0x0')](_0x2bb29c,{'typecast':!![]});if(_0x41b3f1[_0xadf0('0x6')]){logger[_0xadf0('0x7')](_0xadf0('0x8'),_0x183ad1,_[_0xadf0('0x9')](_0x41b3f1,_0xadf0('0xa'))['join'](',\x20'));logger[_0xadf0('0xb')](_0xadf0('0xc'),_0x183ad1);_0x4b2e77[_0xadf0('0xd')]();}else{var _0x238fc9=this;var _0x4ca714=utils[_0xadf0('0xe')](_0x1c5842[0x0],this);logger[_0xadf0('0xb')](_0xadf0('0xf'),_0x183ad1,_0x4ca714);sh[_0xadf0('0x10')](_[_0xadf0('0x11')](_0x4ca714),function(_0x579993,_0x137847){logger[_0xadf0('0xb')](_0xadf0('0x12'),_0x183ad1,_0x579993);if(_0x579993==0x0){var _0x1fcefa=_0x137847[_0xadf0('0x13')](/(\r\n|\n|\r)/gm,'');if(_[_0xadf0('0x14')](_0x1c5842[0x1])||_[_0xadf0('0x15')](_0x1c5842[0x1])){logger['info'](_0xadf0('0x16'),_0x183ad1);_0x238fc9[_0xadf0('0x17')][_0x1c5842[0x1]]=_0x1fcefa;}else{logger[_0xadf0('0xb')](_0xadf0('0x18'),_0x183ad1,_0x1c5842[0x1],_0x1fcefa);_0x238fc9[_0xadf0('0x17')][_0x1c5842[0x1]]=_0x1fcefa;}}_0x4b2e77[_0xadf0('0xd')]();});}}catch(_0x329420){logger[_0xadf0('0x7')](_0xadf0('0x8'),_0x183ad1,_[_0xadf0('0x19')](_0x329420)?JSON['stringify'](_0x329420):_0x329420);logger[_0xadf0('0xb')](_0xadf0('0xc'),_0x183ad1);_0x4b2e77[_0xadf0('0xd')]();}};}; \ 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 9d70972..acc3208 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 _0xb401=['[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','[%s][TAG]\x20%s','stringify','../../rpc/chatInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','routing','number','consequence','validate','length','error','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','addTags','interaction','then'];(function(_0x3a2414,_0x39aeaf){var _0x3c8c04=function(_0x2fa4e6){while(--_0x2fa4e6){_0x3a2414['push'](_0x3a2414['shift']());}};_0x3c8c04(++_0x39aeaf);}(_0xb401,0x14e));var _0x1b40=function(_0x8c9608,_0x1aac60){_0x8c9608=_0x8c9608-0x0;var _0x5b3815=_0xb401[_0x8c9608];return _0x5b3815;};'use strict';var schema=require('validate');var _=require('lodash');var rpc={'chatInteraction':require(_0x1b40('0x0')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x1b40('0x1')),'mailInteraction':require(_0x1b40('0x2')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require('../../../../config/logger')(_0x1b40('0x3'));var tag=schema({'tag':{'type':_0x1b40('0x4'),'required':!![],'message':'TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0x1b40('0x5')]=function(_0x18b9c1,_0x66de92,_0x345375,_0xedf997){return function(_0x12d084){try{var _0x6718ef={'tag':_0x66de92[0x0]};var _0x425033=tag[_0x1b40('0x6')](_0x6718ef,{'typecast':!![]});if(_0x425033[_0x1b40('0x7')]){logger[_0x1b40('0x8')]('[%s][TAG]\x20%s',_0x18b9c1,_['map'](_0x425033,'message')[_0x1b40('0x9')](',\x20'));logger[_0x1b40('0xa')](_0x1b40('0xb'),_0x18b9c1);_0x12d084[_0x1b40('0xc')]();}else{var _0x914851={'ids':[_0x66de92[0x0]]};if(rpc[_0xedf997[_0x1b40('0xd')]+_0x1b40('0xe')]){rpc[_0xedf997[_0x1b40('0xd')]+_0x1b40('0xe')][_0x1b40('0xf')](_0xedf997[_0x1b40('0x10')]['id'],_0x914851)[_0x1b40('0x11')](function(_0x25b091){logger[_0x1b40('0xa')](_0x1b40('0x12'),_0x18b9c1,_0x66de92[0x1],_0xedf997[_0x1b40('0xd')],_0xedf997[_0x1b40('0x10')]['id']);})[_0x1b40('0x13')](function(_0x3524c0){logger[_0x1b40('0x8')](_0x1b40('0x14'),_0x18b9c1,JSON[_0x1b40('0x15')](_0x3524c0));logger[_0x1b40('0xa')](_0x1b40('0xb'),_0x18b9c1);})['finally'](function(){_0x12d084['next']();});}}}catch(_0x2aa14a){logger[_0x1b40('0x8')](_0x1b40('0x14'),_0x18b9c1,_['isObject'](_0x2aa14a)?JSON['stringify'](_0x2aa14a):_0x2aa14a);logger[_0x1b40('0xa')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x18b9c1);_0x12d084[_0x1b40('0xc')]();}};}; \ No newline at end of file +var _0xdfa2=['catch','finally','isObject','stringify','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','error','[%s][TAG]\x20%s','map','message','join','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','interaction','info'];(function(_0x529185,_0x5f5ef5){var _0x541314=function(_0x2c64cf){while(--_0x2c64cf){_0x529185['push'](_0x529185['shift']());}};_0x541314(++_0x5f5ef5);}(_0xdfa2,0x156));var _0x2dfa=function(_0x282be0,_0xb879f0){_0x282be0=_0x282be0-0x0;var _0x11399b=_0xdfa2[_0x282be0];return _0x11399b;};'use strict';var schema=require(_0x2dfa('0x0'));var _=require(_0x2dfa('0x1'));var rpc={'chatInteraction':require(_0x2dfa('0x2')),'openchannelInteraction':require(_0x2dfa('0x3')),'smsInteraction':require(_0x2dfa('0x4')),'mailInteraction':require(_0x2dfa('0x5')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x2dfa('0x6'))};var logger=require(_0x2dfa('0x7'))(_0x2dfa('0x8'));var tag=schema({'tag':{'type':_0x2dfa('0x9'),'required':!![],'message':_0x2dfa('0xa')}});exports['consequence']=function(_0x21eeff,_0x469503,_0x4c3825,_0x5751d6){return function(_0x292fe5){try{var _0x59c10d={'tag':_0x469503[0x0]};var _0x287c59=tag[_0x2dfa('0x0')](_0x59c10d,{'typecast':!![]});if(_0x287c59['length']){logger[_0x2dfa('0xb')](_0x2dfa('0xc'),_0x21eeff,_[_0x2dfa('0xd')](_0x287c59,_0x2dfa('0xe'))[_0x2dfa('0xf')](',\x20'));logger['info'](_0x2dfa('0x10'),_0x21eeff);_0x292fe5[_0x2dfa('0x11')]();}else{var _0x5d6630={'ids':[_0x469503[0x0]]};if(rpc[_0x5751d6[_0x2dfa('0x12')]+_0x2dfa('0x13')]){rpc[_0x5751d6['channel']+_0x2dfa('0x13')]['addTags'](_0x5751d6[_0x2dfa('0x14')]['id'],_0x5d6630)['then'](function(_0x225a38){logger[_0x2dfa('0x15')]('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0x21eeff,_0x469503[0x1],_0x5751d6[_0x2dfa('0x12')],_0x5751d6['interaction']['id']);})[_0x2dfa('0x16')](function(_0x1cdf4c){logger[_0x2dfa('0xb')](_0x2dfa('0xc'),_0x21eeff,JSON['stringify'](_0x1cdf4c));logger[_0x2dfa('0x15')](_0x2dfa('0x10'),_0x21eeff);})[_0x2dfa('0x17')](function(){_0x292fe5['next']();});}}}catch(_0x159ae2){logger['error'](_0x2dfa('0xc'),_0x21eeff,_[_0x2dfa('0x18')](_0x159ae2)?JSON[_0x2dfa('0x19')](_0x159ae2):_0x159ae2);logger['info']('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x21eeff);_0x292fe5[_0x2dfa('0x11')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tvox.js b/server/services/routing/server/applications/tvox.js index fb2cd8b..107d18d 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 _0x3b42=['routing','lodash','\x20-\x20','replace','includes','push','urlOnAnswer','urlOnRing','?params=','title','jsonrpc','method','login','stringify','utf8','POST','application/json-rpc','then','parse','logged','&serviceId=','&sessionId=','&data=','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','catch','[%s][TVOX]\x20%s','isObject','info','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','request-promise','../../../../config/logger'];(function(_0x26d386,_0x1660c0){var _0x4ef9a8=function(_0x55e2d3){while(--_0x55e2d3){_0x26d386['push'](_0x26d386['shift']());}};_0x4ef9a8(++_0x1660c0);}(_0x3b42,0x106));var _0x23b4=function(_0x23b157,_0x459781){_0x23b157=_0x23b157-0x0;var _0x4dbbcb=_0x3b42[_0x23b157];return _0x4dbbcb;};'use strict';var rp=require(_0x23b4('0x0'));var logger=require(_0x23b4('0x1'))(_0x23b4('0x2'));var _=require(_0x23b4('0x3'));var arr=[];exports['consequence']=function(_0x1c0b46,_0x53c50d){return function(_0x17faae){var _0x442267=_0x53c50d[0xa];var _0x313cbe=_0x53c50d[0xb];var _0x2be24f=_0x53c50d[0xc];var _0x18e810=_0x53c50d[0xd];var _0x106205=_0x53c50d[0xe];var _0x4d6251=_0x53c50d[0xf]['replace'](/\n/g,_0x23b4('0x4'));var _0x522200=_0x53c50d[0x10][_0x23b4('0x5')](/\n/g,'\x20');if(!arr[_0x23b4('0x6')](_0x313cbe)){arr[_0x23b4('0x7')](_0x313cbe);var _0x3737ce=_0x53c50d[0x3];var _0x5ac044=_0x53c50d[0x4];var _0x81bd71=_0x53c50d[0x1];var _0x240a96=_0x53c50d[0x0];var _0x3f6cf0={};_0x3f6cf0[_0x23b4('0x8')]=_0x53c50d[0x8]+'?params='+_0x2be24f+'|'+_0x442267+'|'+_0x18e810+'|'+_0x313cbe+'|'+_0x106205;_0x3f6cf0[_0x23b4('0x9')]=_0x53c50d[0x7]+_0x23b4('0xa')+_0x2be24f+'|'+_0x442267+'|'+_0x18e810+'|'+_0x313cbe+'|'+_0x106205+'|'+_0x4d6251+'|'+_0x522200;_0x3f6cf0[_0x23b4('0xb')]=_0x53c50d[0x9];var _0x111ded={};_0x111ded[_0x23b4('0xc')]='2.0';_0x111ded[_0x23b4('0xd')]=_0x23b4('0xe');var _0x3bedc2=[];_0x3bedc2[_0x23b4('0x7')](_0x53c50d[0x2]);_0x3bedc2['push'](_0x53c50d[0x5]);_0x3bedc2['push'](_0x53c50d[0x6]);_0x111ded['params']=_0x3bedc2;_0x111ded['id']=0x1;var _0x525c27=JSON[_0x23b4('0xf')](_0x111ded);var _0x58c477={'encoding':_0x23b4('0x10'),'method':_0x23b4('0x11'),'timeout':0x2710,'url':_0x3737ce,'headers':{'Content-Type':_0x23b4('0x12')},'body':_0x525c27};return rp(_0x58c477)[_0x23b4('0x13')](function(_0x3ff494){const _0x3d6fc0=JSON[_0x23b4('0x14')](_0x3ff494);if(!_0x3d6fc0['result'][_0x23b4('0x15')]){throw new Error('Unable\x20to\x20login\x20with\x20TVox\x20application');}var _0x47215c=_0x313cbe;var _0xf3f134='channelId='+_0x81bd71+_0x23b4('0x16')+_0x240a96+_0x23b4('0x17')+_0x47215c+_0x23b4('0x18')+JSON[_0x23b4('0xf')](_0x3f6cf0);var _0x378baa=_0x5ac044+'?'+_0xf3f134;return rp(_0x378baa);})[_0x23b4('0x13')](function(_0xc71ed9){logger['info'](_0x23b4('0x19'),_0x1c0b46,_0xc71ed9);_0x17faae[_0x23b4('0x1a')]();})[_0x23b4('0x1b')](function(_0x32a2c2){logger['error'](_0x23b4('0x1c'),_0x1c0b46,_[_0x23b4('0x1d')](_0x32a2c2)?JSON[_0x23b4('0xf')](_0x32a2c2):_0x32a2c2);_0x17faae[_0x23b4('0x1a')]();});}else{logger[_0x23b4('0x1e')](_0x23b4('0x1f'),_0x1c0b46);_0x17faae[_0x23b4('0x20')]();}};}; \ No newline at end of file +var _0x7901=['parse','result','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId=','&data=','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','catch','error','isObject','stop','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','request-promise','routing','lodash','consequence','replace','\x20-\x20','includes','push','urlOnAnswer','?params=','urlOnRing','title','jsonrpc','2.0','login','params','stringify','utf8','POST','then'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7901,0xb8));var _0x1790=function(_0x27aba4,_0x2b1ded){_0x27aba4=_0x27aba4-0x0;var _0x46020b=_0x7901[_0x27aba4];return _0x46020b;};'use strict';var rp=require(_0x1790('0x0'));var logger=require('../../../../config/logger')(_0x1790('0x1'));var _=require(_0x1790('0x2'));var arr=[];exports[_0x1790('0x3')]=function(_0x2185be,_0x4e1c1b){return function(_0x4bf00d){var _0x479e24=_0x4e1c1b[0xa];var _0x5cadbf=_0x4e1c1b[0xb];var _0x4d40dc=_0x4e1c1b[0xc];var _0x2a7b4a=_0x4e1c1b[0xd];var _0xaf6c1b=_0x4e1c1b[0xe];var _0x20fffb=_0x4e1c1b[0xf][_0x1790('0x4')](/\n/g,_0x1790('0x5'));var _0x45aa5f=_0x4e1c1b[0x10][_0x1790('0x4')](/\n/g,'\x20');if(!arr[_0x1790('0x6')](_0x5cadbf)){arr[_0x1790('0x7')](_0x5cadbf);var _0x2c64a4=_0x4e1c1b[0x3];var _0x2839fa=_0x4e1c1b[0x4];var _0x272858=_0x4e1c1b[0x1];var _0x46fc45=_0x4e1c1b[0x0];var _0x436b04={};_0x436b04[_0x1790('0x8')]=_0x4e1c1b[0x8]+_0x1790('0x9')+_0x4d40dc+'|'+_0x479e24+'|'+_0x2a7b4a+'|'+_0x5cadbf+'|'+_0xaf6c1b;_0x436b04[_0x1790('0xa')]=_0x4e1c1b[0x7]+_0x1790('0x9')+_0x4d40dc+'|'+_0x479e24+'|'+_0x2a7b4a+'|'+_0x5cadbf+'|'+_0xaf6c1b+'|'+_0x20fffb+'|'+_0x45aa5f;_0x436b04[_0x1790('0xb')]=_0x4e1c1b[0x9];var _0xfeffdb={};_0xfeffdb[_0x1790('0xc')]=_0x1790('0xd');_0xfeffdb['method']=_0x1790('0xe');var _0x23996b=[];_0x23996b[_0x1790('0x7')](_0x4e1c1b[0x2]);_0x23996b['push'](_0x4e1c1b[0x5]);_0x23996b[_0x1790('0x7')](_0x4e1c1b[0x6]);_0xfeffdb[_0x1790('0xf')]=_0x23996b;_0xfeffdb['id']=0x1;var _0x4ddfa1=JSON[_0x1790('0x10')](_0xfeffdb);var _0x310954={'encoding':_0x1790('0x11'),'method':_0x1790('0x12'),'timeout':0x2710,'url':_0x2c64a4,'headers':{'Content-Type':'application/json-rpc'},'body':_0x4ddfa1};return rp(_0x310954)[_0x1790('0x13')](function(_0x1691fa){const _0x1a3439=JSON[_0x1790('0x14')](_0x1691fa);if(!_0x1a3439[_0x1790('0x15')]['logged']){throw new Error(_0x1790('0x16'));}var _0x235208=_0x5cadbf;var _0x404959=_0x1790('0x17')+_0x272858+_0x1790('0x18')+_0x46fc45+'&sessionId='+_0x235208+_0x1790('0x19')+JSON[_0x1790('0x10')](_0x436b04);var _0x182d4a=_0x2839fa+'?'+_0x404959;return rp(_0x182d4a);})[_0x1790('0x13')](function(_0x7b6daf){logger[_0x1790('0x1a')](_0x1790('0x1b'),_0x2185be,_0x7b6daf);_0x4bf00d['stop']();})[_0x1790('0x1c')](function(_0x48039f){logger[_0x1790('0x1d')]('[%s][TVOX]\x20%s',_0x2185be,_[_0x1790('0x1e')](_0x48039f)?JSON[_0x1790('0x10')](_0x48039f):_0x48039f);_0x4bf00d[_0x1790('0x1f')]();});}else{logger[_0x1790('0x1a')](_0x1790('0x20'),_0x2185be);_0x4bf00d[_0x1790('0x21')]();}};}; \ 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 9c02f3b..b5bd39f 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(_0xf8f120,_0x1901f1){var _0x2e7a89=function(_0x3e9a53){while(--_0x3e9a53){_0xf8f120['push'](_0xf8f120['shift']());}};_0x2e7a89(++_0x1901f1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0xa9e0[_0x4e1d03];return _0x362d4b;};'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 _0x9c44=['merge','body','account','list','exports','render'];(function(_0x3dd0ad,_0x50643f){var _0x122a02=function(_0x431da3){while(--_0x431da3){_0x3dd0ad['push'](_0x3dd0ad['shift']());}};_0x122a02(++_0x50643f);}(_0x9c44,0x178));var _0x49c4=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0x9c44[_0x68c979];return _0x4f0001;};'use strict';var Mustache=require('mustache');var _=require('lodash');module[_0x49c4('0x0')]={'getMustacheRender':function(_0x18bf2d,_0x26844b){return Mustache[_0x49c4('0x1')](_0x18bf2d,_[_0x49c4('0x2')](_0x26844b[_0x49c4('0x3')],{'contact':_0x26844b['contact'],'message':_0x26844b['message'],'account':_0x26844b[_0x49c4('0x4')],'interaction':_0x26844b['interaction'],'list':_0x26844b[_0x49c4('0x5')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 24d6553..858c8dc 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 _0x0fd9=['amazonlex','tag','TagId','tvox','getMustacheRender','account','notificationTemplate','ChatWebsiteId','ContactId','body','format','%s:%s:%s','./interval','intervals','./applications/','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','execute','Applications\x20executed','stringify','matchPath','emit','complete','routing\x20is\x20empty','agent','agents','busyQueue','end','QueueReport','update','UserId','stack','message\x20is\x20empty','busy','capacity','hasOwnProperty','CurrentCapacity','updateRealtime','chatQueues','available','name','paused','waiting','mailQueues','loggedIn','openchannelQueues','smsQueues','faxQueues','whatsappQueues','values','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','util','path','jayson/promise','bluebird','../../../config/environment','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/whatsappQueueReport','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','rules','message','interaction','applications','isArray','length','existsSync','join','app','.js','toLowerCase','autoreply','appdata','split','channel','mail','push','slice','dialogflow','dialogflowv2'];(function(_0x3a40a2,_0x2aa75f){var _0x127963=function(_0x3fc03b){while(--_0x3fc03b){_0x3a40a2['push'](_0x3a40a2['shift']());}};_0x127963(++_0x2aa75f);}(_0x0fd9,0xa3));var _0x90fd=function(_0x403c8d,_0x5e3825){_0x403c8d=_0x403c8d-0x0;var _0x4ca60d=_0x0fd9[_0x403c8d];return _0x4ca60d;};'use strict';var _=require('lodash');var util=require(_0x90fd('0x0'));var path=require(_0x90fd('0x1'));var fs=require('fs');var jayson=require(_0x90fd('0x2'));var BPromise=require(_0x90fd('0x3'));var uuid=require('uuid');var utils=require('./applications/utils');var config=require(_0x90fd('0x4'));var logger=require(_0x90fd('0x5'))(_0x90fd('0x6'));var rpc={'openchannelQueueReport':require(_0x90fd('0x7')),'mailQueueReport':require(_0x90fd('0x8')),'chatQueueReport':require(_0x90fd('0x9')),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require('../rpc/faxQueueReport'),'whatsappQueueReport':require(_0x90fd('0xa'))};var RuleEngine=require('../lib/rule-engine');function getId(_0x5a604a,_0x2acef7,_0x1becf2){return util['format'](_0x90fd('0xb'),_0x5a604a,_0x2acef7||0x0,_0x1becf2||0x0);}function getIntervals(_0x464236,_0x3c0592){var _0x3262f6=[];if(!_[_0x90fd('0xc')](_0x3c0592[_0x90fd('0xd')])&&!_[_0x90fd('0xc')](_0x464236[_0x3c0592[_0x90fd('0xd')]])&&!_[_0x90fd('0xc')](_0x464236[_0x3c0592['IntervalId']][_0x90fd('0xe')])){_0x3262f6=_[_0x90fd('0xf')](_0x464236[_0x3c0592['IntervalId']][_0x90fd('0xe')],_0x90fd('0x10'));}else if(!_[_0x90fd('0xc')](_0x3c0592['interval'])){_0x3262f6=[_0x3c0592[_0x90fd('0x10')]];}return _0x3262f6;}exports['listen']=function(_0x1cae40){_0x1cae40[_0x90fd('0x11')]={};return new BPromise(function(_0x18bdb6,_0x1b3f3b){var _0x3c5da8={'Start':function(_0x442a19){var _0x296a64=this;return new Promise(function(_0x4eb953,_0x4f6b7b){if(_0x442a19){try{var _0x1e1cea=[];var _0x43d804=getId(_0x442a19['channel'],_0x442a19[_0x90fd('0x12')]?_0x442a19[_0x90fd('0x12')]['id']:0x0,_0x442a19[_0x90fd('0x13')]?_0x442a19['interaction']['id']:0x0);if(_0x442a19[_0x90fd('0x14')]&&_[_0x90fd('0x15')](_0x442a19[_0x90fd('0x14')])&&_0x442a19[_0x90fd('0x14')][_0x90fd('0x16')]){for(var _0x58866f=0x0;_0x58866f<_0x442a19[_0x90fd('0x14')][_0x90fd('0x16')];_0x58866f+=0x1){var _0x187cf1=_0x442a19[_0x90fd('0x14')][_0x58866f];if(fs[_0x90fd('0x17')](path[_0x90fd('0x18')](__dirname,_0x90fd('0x14'),_0x187cf1[_0x90fd('0x19')]+_0x90fd('0x1a')))){var _0x493c26=[];switch(_0x187cf1[_0x90fd('0x19')][_0x90fd('0x1b')]()){case _0x90fd('0x1c'):var _0x1b47e5=_0x187cf1[_0x90fd('0x1d')][_0x90fd('0x1e')](',');if(_0x442a19[_0x90fd('0x1f')]===_0x90fd('0x20')){_0x493c26['push'](_0x1b47e5[0x0]);_0x493c26[_0x90fd('0x21')](_0x1b47e5[0x1]);_0x493c26['push'](_0x1b47e5[_0x90fd('0x22')](0x2,_0x1b47e5[_0x90fd('0x16')])[_0x90fd('0x18')](','));}else{_0x493c26[_0x90fd('0x21')](_0x1b47e5[0x0]);_0x493c26[_0x90fd('0x21')](_0x1b47e5['slice'](0x1,_0x1b47e5[_0x90fd('0x16')])[_0x90fd('0x18')](','));}break;case _0x90fd('0x23'):var _0x1cdc38=_0x187cf1[_0x90fd('0x1d')][_0x90fd('0x1e')](',');_0x493c26['push'](_0x1cdc38[0x0]);_0x493c26['push'](_0x1cdc38[0x1]);_0x493c26[_0x90fd('0x21')](_0x1cdc38[_0x90fd('0x22')](0x2,_0x1cdc38[_0x90fd('0x16')])[_0x90fd('0x18')](','));break;case _0x90fd('0x24'):var _0x59b3e8=_0x187cf1['appdata'][_0x90fd('0x1e')](',');_0x493c26[_0x90fd('0x21')](_0x59b3e8[0x0]);_0x493c26[_0x90fd('0x21')](_0x59b3e8[0x1]);_0x493c26[_0x90fd('0x21')](_0x59b3e8[0x2]);_0x493c26['push'](_0x59b3e8[0x3]);_0x493c26['push'](_0x59b3e8[_0x90fd('0x22')](0x4,_0x59b3e8[_0x90fd('0x16')])[_0x90fd('0x18')](','));break;case _0x90fd('0x25'):var _0x5b64ec=_0x187cf1[_0x90fd('0x1d')][_0x90fd('0x1e')](',');_0x493c26[_0x90fd('0x21')](_0x5b64ec[0x0]);_0x493c26[_0x90fd('0x21')](_0x5b64ec[0x1]);_0x493c26[_0x90fd('0x21')](_0x5b64ec[0x2]);_0x493c26[_0x90fd('0x21')](_0x5b64ec[0x3]);_0x493c26[_0x90fd('0x21')](_0x5b64ec[_0x90fd('0x22')](0x4,_0x5b64ec[_0x90fd('0x16')])[_0x90fd('0x18')](','));break;case _0x90fd('0x12'):_0x493c26[_0x90fd('0x21')](_0x187cf1[_0x90fd('0x1d')]);break;case _0x90fd('0x26'):_0x493c26[_0x90fd('0x21')](_0x187cf1[_0x90fd('0x27')]);_0x493c26['push'](_0x187cf1[_0x90fd('0x1d')]);break;case _0x90fd('0x28'):var _0x8b5ddc=utils[_0x90fd('0x29')](_0x442a19[_0x90fd('0x2a')][_0x90fd('0x2b')],_0x442a19);var _0x35eae2=_0x187cf1[_0x90fd('0x1d')][_0x90fd('0x1e')](',');_0x493c26[_0x90fd('0x21')](_0x35eae2[0x0]);_0x493c26[_0x90fd('0x21')](_0x35eae2[0x1]);_0x493c26[_0x90fd('0x21')](_0x35eae2[0x2]);_0x493c26[_0x90fd('0x21')](_0x35eae2[0x3]);_0x493c26['push'](_0x35eae2[0x4]);_0x493c26[_0x90fd('0x21')](_0x35eae2[0x5]);_0x493c26[_0x90fd('0x21')](_0x35eae2[0x6]);_0x493c26[_0x90fd('0x21')](_0x35eae2[0x7]);_0x493c26[_0x90fd('0x21')](_0x35eae2[0x8]);_0x493c26['push'](_0x35eae2[0x9]);_0x493c26[_0x90fd('0x21')](_0x35eae2[0xa]);_0x493c26[_0x90fd('0x21')](_0x442a19[_0x90fd('0x13')]['id']);_0x493c26['push'](_0x442a19['message']['id']);_0x493c26[_0x90fd('0x21')](_0x187cf1[_0x90fd('0x2c')]);_0x493c26[_0x90fd('0x21')](_0x442a19[_0x90fd('0x13')][_0x90fd('0x2d')]);_0x493c26[_0x90fd('0x21')](_0x442a19[_0x90fd('0x2e')][_0x90fd('0x2e')]);_0x493c26[_0x90fd('0x21')](_0x8b5ddc);break;default:_0x493c26=_[_0x90fd('0xc')](_0x187cf1[_0x90fd('0x1d')])?[]:_0x187cf1[_0x90fd('0x1d')][_0x90fd('0x1e')](',');}var _0x47856d={'id':util[_0x90fd('0x2f')](_0x90fd('0x30'),_0x43d804,_0x187cf1['id'],_0x187cf1[_0x90fd('0x19')]),'condition':require(_0x90fd('0x31'))['condition'](_0x43d804,getIntervals(_0x1cae40[_0x90fd('0x32')],_0x187cf1),_0x1cae40),'consequence':require(_0x90fd('0x33')+_0x187cf1[_0x90fd('0x19')])['consequence'](_0x43d804,_0x493c26,_0x1cae40,_0x442a19),'p':_0x187cf1['priority']||0x0};logger['info'](_0x90fd('0x34'),_0x47856d['id'],_0x90fd('0x35'),getIntervals(_0x1cae40[_0x90fd('0x32')],_0x187cf1)[_0x90fd('0x18')](_0x90fd('0x36')));_0x1e1cea[_0x90fd('0x21')](_0x47856d);}else{logger[_0x90fd('0x37')](_0x90fd('0x38'),path[_0x90fd('0x18')](__dirname,_0x90fd('0x14'),_0x187cf1[_0x90fd('0x19')]+_0x90fd('0x1a')));}}_0x1cae40[_0x90fd('0x11')][_0x43d804]=new RuleEngine(_0x1e1cea);_0x1cae40[_0x90fd('0x11')][_0x43d804][_0x90fd('0x39')](_0x442a19,function(_0x50b722){logger['info'](_0x90fd('0x3a'),JSON[_0x90fd('0x3b')](_0x50b722[_0x90fd('0x3c')]));if(_0x1cae40['rules'][_0x43d804]){_0x1cae40['rules'][_0x43d804][_0x90fd('0x3d')](_0x90fd('0x3e'));}});return _0x4eb953({'code':0xc8,'message':_0x442a19});}else{logger['info']('No\x20applications\x20to\x20execute');return _0x4eb953({'code':0xc8,'message':_0x442a19});}}catch(_0x3f2769){logger[_0x90fd('0x37')](_0x3f2769['stack']);return _0x4f6b7b(_0x296a64['error'](0x1f4,_0x3f2769));}}return _0x4f6b7b(_0x90fd('0x3f'));});},'AcceptMessage':function(_0x24c640){var _0x169832=this;return new Promise(function(_0x5de9af,_0x1b0e03){if(_0x24c640[_0x90fd('0x40')]&&_0x24c640['agent']['id']){if(_0x1cae40['agents'][_0x24c640['agent']['id']]){_0x1cae40[_0x90fd('0x41')][_0x24c640[_0x90fd('0x40')]['id']]['busy']=![];_0x1cae40[_0x90fd('0x41')][_0x24c640[_0x90fd('0x40')]['id']][_0x90fd('0x42')]=undefined;}}if(_0x24c640[_0x90fd('0x12')]&&_0x24c640[_0x90fd('0x12')]['id']){try{var _0x493973=getId(_0x24c640['channel'],_0x24c640[_0x90fd('0x12')]?_0x24c640[_0x90fd('0x12')]['id']:0x0,_0x24c640[_0x90fd('0x13')]?_0x24c640[_0x90fd('0x13')]['id']:0x0);if(_0x1cae40[_0x90fd('0x11')][_0x493973]){_0x1cae40[_0x90fd('0x11')][_0x493973][_0x90fd('0x3d')](_0x90fd('0x43'));if(rpc[_0x24c640[_0x90fd('0x1f')]+_0x90fd('0x44')]){rpc[_0x24c640['channel']+_0x90fd('0x44')][_0x90fd('0x45')](_0x493973,{'UserId':_0x24c640[_0x90fd('0x12')][_0x90fd('0x46')]})['catch'](function(_0x4cf061){logger[_0x90fd('0x37')]('error\x20update\x20queue\x20report');});}}return _0x5de9af({'code':0xc8,'message':_0x24c640});}catch(_0x491daa){logger[_0x90fd('0x37')](_0x491daa[_0x90fd('0x47')]);return _0x1b0e03(_0x169832[_0x90fd('0x37')](0x1f4,_0x491daa));}}logger[_0x90fd('0x37')](_0x90fd('0x48'));return _0x1b0e03(_0x169832[_0x90fd('0x37')](0x1f4,_0x90fd('0x48')));});},'RejectMessage':function(_0x5502f2){var _0x55653c=this;return new Promise(function(_0x1b81dc,_0x43d076){if(_0x5502f2[_0x90fd('0x40')]&&_0x5502f2['agent']['id']){try{if(_0x1cae40[_0x90fd('0x41')][_0x5502f2[_0x90fd('0x40')]['id']]){_0x1cae40[_0x90fd('0x41')][_0x5502f2[_0x90fd('0x40')]['id']][_0x90fd('0x49')]=![];_0x1cae40[_0x90fd('0x41')][_0x5502f2[_0x90fd('0x40')]['id']][_0x90fd('0x42')]=undefined;}return _0x1b81dc({'code':0xc8,'message':_0x5502f2});}catch(_0x4ec476){logger['error'](_0x4ec476[_0x90fd('0x47')]);return _0x43d076(_0x55653c[_0x90fd('0x37')](0x1f4,_0x4ec476));}}logger[_0x90fd('0x37')]('message\x20is\x20empty');return _0x43d076(_0x55653c[_0x90fd('0x37')](0x1f4,_0x90fd('0x48')));});},'AbandonInteraction':function(_0x29b880){var _0x24229f=this;return new Promise(function(_0x43f75a,_0x408e8d){if(_0x29b880['channel']&&_0x29b880[_0x90fd('0x13')]&&_0x29b880['interaction']['id']){try{var _0x33e017=getId(_0x29b880['channel'],_0x29b880[_0x90fd('0x12')]?_0x29b880[_0x90fd('0x12')]['id']:0x0,_0x29b880[_0x90fd('0x13')]?_0x29b880[_0x90fd('0x13')]['id']:0x0);if(_0x1cae40['rules'][_0x33e017]){_0x1cae40[_0x90fd('0x11')][_0x33e017][_0x90fd('0x3d')](_0x90fd('0x43'));}return _0x43f75a({'code':0xc8,'message':_0x29b880});}catch(_0x40fea3){logger[_0x90fd('0x37')](_0x40fea3[_0x90fd('0x47')]);return _0x408e8d(_0x24229f['error'](0x1f4,_0x40fea3));}}logger['error']('message\x20is\x20empty');return _0x408e8d(_0x24229f['error'](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0x375fc8){var _0x3b98e2=this;return new Promise(function(_0x278db5,_0x161522){if(_0x1cae40[_0x90fd('0x41')]['hasOwnProperty'](_0x375fc8['id'])){for(var _0x54d55d in _0x375fc8['capacity']){if(_0x375fc8[_0x90fd('0x4a')][_0x90fd('0x4b')](_0x54d55d)){if(_0x1cae40['agents'][_0x375fc8['id']][_0x90fd('0x4b')](_0x54d55d+_0x90fd('0x4c'))){_0x1cae40[_0x90fd('0x41')][_0x375fc8['id']][_0x54d55d+_0x90fd('0x4c')]=parseInt(_0x375fc8[_0x90fd('0x4a')][_0x54d55d],0xa);}}}_0x1cae40[_0x90fd('0x41')][_0x375fc8['id']][_0x90fd('0x4d')]();return _0x278db5({'code':0xc8,'message':_0x1cae40[_0x90fd('0x41')][_0x375fc8['id']]});}else{return _0x161522(_0x3b98e2[_0x90fd('0x37')](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0x3aaa50){return new Promise(function(_0xcebc5c,_0x1e7111){var _0x53e2bb=_['values'](_0x1cae40[_0x90fd('0x41')]);_0xcebc5c({'count':_0x53e2bb[_0x90fd('0x16')],'rows':_0x53e2bb});});},'ChatQueues':function(_0x479c8c){return new Promise(function(_0x5f4645,_0x4d761c){var _0x49533a=[];for(var _0x249331 in _0x1cae40[_0x90fd('0x4e')]){if(_0x1cae40[_0x90fd('0x4e')][_0x90fd('0x4b')](_0x249331)){var _0x2e6e95=_0x1cae40[_0x90fd('0x4e')][_0x249331];var _0x321cfb={'id':_0x2e6e95['id'],'available':_0x2e6e95[_0x90fd('0x4f')],'loggedIn':_0x2e6e95['loggedIn'],'name':_0x2e6e95[_0x90fd('0x50')],'paused':_0x2e6e95[_0x90fd('0x51')],'waiting':_0x2e6e95[_0x90fd('0x52')]};_0x49533a['push'](_0x321cfb);}}_0x5f4645({'count':_0x49533a[_0x90fd('0x16')],'rows':_0x49533a});});},'MailQueues':function(_0x4636d5){return new Promise(function(_0x52c920,_0x5cb475){var _0x1a4d3f=[];for(var _0x333c8d in _0x1cae40[_0x90fd('0x53')]){if(_0x1cae40['mailQueues'][_0x90fd('0x4b')](_0x333c8d)){var _0x497953=_0x1cae40['mailQueues'][_0x333c8d];var _0x206526={'id':_0x497953['id'],'available':_0x497953['available'],'loggedIn':_0x497953[_0x90fd('0x54')],'name':_0x497953[_0x90fd('0x50')],'paused':_0x497953['paused'],'waiting':_0x497953[_0x90fd('0x52')]};_0x1a4d3f[_0x90fd('0x21')](_0x206526);}}_0x52c920({'count':_0x1a4d3f[_0x90fd('0x16')],'rows':_0x1a4d3f});});},'OpenchannelQueues':function(_0x454201){return new Promise(function(_0x6a7a62,_0xd1ecc){var _0x4d2436=[];for(var _0x4c5fd3 in _0x1cae40['openchannelQueues']){if(_0x1cae40['openchannelQueues'][_0x90fd('0x4b')](_0x4c5fd3)){var _0x3d55d1=_0x1cae40[_0x90fd('0x55')][_0x4c5fd3];var _0x576a55={'id':_0x3d55d1['id'],'available':_0x3d55d1[_0x90fd('0x4f')],'loggedIn':_0x3d55d1[_0x90fd('0x54')],'name':_0x3d55d1['name'],'paused':_0x3d55d1[_0x90fd('0x51')],'waiting':_0x3d55d1[_0x90fd('0x52')]};_0x4d2436[_0x90fd('0x21')](_0x576a55);}}_0x6a7a62({'count':_0x4d2436[_0x90fd('0x16')],'rows':_0x4d2436});});},'SmsQueues':function(_0x5acecb){return new Promise(function(_0x42cdec,_0x3c4e9e){var _0x5d08e9=[];for(var _0x4a841e in _0x1cae40['smsQueues']){if(_0x1cae40[_0x90fd('0x56')]['hasOwnProperty'](_0x4a841e)){var _0x4ad10e=_0x1cae40[_0x90fd('0x56')][_0x4a841e];var _0x5a8445={'id':_0x4ad10e['id'],'available':_0x4ad10e[_0x90fd('0x4f')],'loggedIn':_0x4ad10e[_0x90fd('0x54')],'name':_0x4ad10e[_0x90fd('0x50')],'paused':_0x4ad10e[_0x90fd('0x51')],'waiting':_0x4ad10e[_0x90fd('0x52')]};_0x5d08e9[_0x90fd('0x21')](_0x5a8445);}}_0x42cdec({'count':_0x5d08e9['length'],'rows':_0x5d08e9});});},'FaxQueues':function(_0x37e8b3){return new Promise(function(_0x469898,_0x41a6fe){var _0x4e25f4=[];for(var _0x5b16a5 in _0x1cae40[_0x90fd('0x57')]){if(_0x1cae40[_0x90fd('0x57')][_0x90fd('0x4b')](_0x5b16a5)){var _0x2789d1=_0x1cae40[_0x90fd('0x57')][_0x5b16a5];var _0x278bcf={'id':_0x2789d1['id'],'available':_0x2789d1[_0x90fd('0x4f')],'loggedIn':_0x2789d1[_0x90fd('0x54')],'name':_0x2789d1[_0x90fd('0x50')],'paused':_0x2789d1[_0x90fd('0x51')],'waiting':_0x2789d1[_0x90fd('0x52')]};_0x4e25f4[_0x90fd('0x21')](_0x278bcf);}}_0x469898({'count':_0x4e25f4[_0x90fd('0x16')],'rows':_0x4e25f4});});},'WhatsappQueues':function(_0x34a33a){return new Promise(function(_0x37215e,_0x1b1f41){var _0x3b07fe=[];for(var _0x4f4eeb in _0x1cae40[_0x90fd('0x58')]){if(_0x1cae40[_0x90fd('0x58')][_0x90fd('0x4b')](_0x4f4eeb)){var _0xd14edf=_0x1cae40[_0x90fd('0x58')][_0x4f4eeb];var _0x3d0aba={'id':_0xd14edf['id'],'available':_0xd14edf[_0x90fd('0x4f')],'loggedIn':_0xd14edf['loggedIn'],'name':_0xd14edf[_0x90fd('0x50')],'paused':_0xd14edf[_0x90fd('0x51')],'waiting':_0xd14edf[_0x90fd('0x52')]};_0x3b07fe[_0x90fd('0x21')](_0x3d0aba);}}_0x37215e({'count':_0x3b07fe['length'],'rows':_0x3b07fe});});},'ChatQueuesWaitingInteractions':function(_0x57919c){return new Promise(function(_0x250c46,_0x16ffbc){var _0x696861=_[_0x90fd('0x59')](_0x1cae40['chatQueuesWaitingInteractions']);_0x250c46({'count':_0x696861['length'],'rows':_0x696861});});},'MailQueuesWaitingInteractions':function(_0x21b79c){return new Promise(function(_0x3f1086,_0x2397fd){var _0x2df466=_[_0x90fd('0x59')](_0x1cae40[_0x90fd('0x5a')]);_0x3f1086({'count':_0x2df466['length'],'rows':_0x2df466});});},'OpenchannelQueuesWaitingInteractions':function(_0x4135b1){return new Promise(function(_0xa74b83,_0x246b22){var _0x185056=_[_0x90fd('0x59')](_0x1cae40[_0x90fd('0x5b')]);_0xa74b83({'count':_0x185056[_0x90fd('0x16')],'rows':_0x185056});});},'SmsQueuesWaitingInteractions':function(_0x397474){return new Promise(function(_0x360ccd,_0x4b883f){var _0x1adcc2=_[_0x90fd('0x59')](_0x1cae40[_0x90fd('0x5c')]);_0x360ccd({'count':_0x1adcc2[_0x90fd('0x16')],'rows':_0x1adcc2});});},'FaxQueuesWaitingInteractions':function(_0x65459c){return new Promise(function(_0x43e37f,_0x47bb7a){var _0x1ee663=_[_0x90fd('0x59')](_0x1cae40[_0x90fd('0x5d')]);_0x43e37f({'count':_0x1ee663[_0x90fd('0x16')],'rows':_0x1ee663});});},'WhatsappQueuesWaitingInteractions':function(_0x140b49){return new Promise(function(_0x56bb7f,_0x1316e6){var _0x3b5f3b=_[_0x90fd('0x59')](_0x1cae40[_0x90fd('0x5e')]);_0x56bb7f({'count':_0x3b5f3b[_0x90fd('0x16')],'rows':_0x3b5f3b});});}};var _0x432ebd=jayson[_0x90fd('0x5f')](_0x3c5da8)[_0x90fd('0x60')]();_0x432ebd['on'](_0x90fd('0x37'),function(_0x3fc7c0){logger['error'](JSON[_0x90fd('0x3b')](_0x3fc7c0));return _0x1b3f3b(_0x3fc7c0);});_0x432ebd['listen'](0x232c,'127.0.0.1',function(){console[_0x90fd('0x61')](_0x90fd('0x62'),0x232c);return _0x18bdb6(_0x90fd('0x63')+0x232c);});});}; \ No newline at end of file +var _0x3a25=['end','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','stack','message\x20is\x20empty','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','values','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','http','listen','127.0.0.1','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','path','jayson/promise','bluebird','uuid','./applications/utils','../../../config/environment','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','Intervals','interval','rules','message','interaction','applications','isArray','existsSync','join','app','.js','toLowerCase','autoreply','appdata','mail','push','slice','length','dialogflow','split','dialogflowv2','amazonlex','tag','TagId','tvox','getMustacheRender','notificationTemplate','ChatWebsiteId','body','./interval','intervals','./applications/','consequence','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','execute','Applications\x20executed','stringify','matchPath','complete','routing\x20is\x20empty','agents','agent','busy','busyQueue','channel','emit'];(function(_0x2b71ac,_0x5aeeb5){var _0xe9c88f=function(_0x12ef1f){while(--_0x12ef1f){_0x2b71ac['push'](_0x2b71ac['shift']());}};_0xe9c88f(++_0x5aeeb5);}(_0x3a25,0x15d));var _0x53a2=function(_0x5497b7,_0x3d9b7b){_0x5497b7=_0x5497b7-0x0;var _0x422098=_0x3a25[_0x5497b7];return _0x422098;};'use strict';var _=require(_0x53a2('0x0'));var util=require(_0x53a2('0x1'));var path=require(_0x53a2('0x2'));var fs=require('fs');var jayson=require(_0x53a2('0x3'));var BPromise=require(_0x53a2('0x4'));var uuid=require(_0x53a2('0x5'));var utils=require(_0x53a2('0x6'));var config=require(_0x53a2('0x7'));var logger=require(_0x53a2('0x8'))(_0x53a2('0x9'));var rpc={'openchannelQueueReport':require(_0x53a2('0xa')),'mailQueueReport':require(_0x53a2('0xb')),'chatQueueReport':require(_0x53a2('0xc')),'smsQueueReport':require(_0x53a2('0xd')),'faxQueueReport':require(_0x53a2('0xe')),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require(_0x53a2('0xf'));function getId(_0x5dc70e,_0x17aa09,_0x1f4de7){return util[_0x53a2('0x10')](_0x53a2('0x11'),_0x5dc70e,_0x17aa09||0x0,_0x1f4de7||0x0);}function getIntervals(_0x13550a,_0x45f0c4){var _0x42f093=[];if(!_[_0x53a2('0x12')](_0x45f0c4[_0x53a2('0x13')])&&!_[_0x53a2('0x12')](_0x13550a[_0x45f0c4['IntervalId']])&&!_['isNil'](_0x13550a[_0x45f0c4[_0x53a2('0x13')]][_0x53a2('0x14')])){_0x42f093=_['map'](_0x13550a[_0x45f0c4['IntervalId']]['Intervals'],_0x53a2('0x15'));}else if(!_[_0x53a2('0x12')](_0x45f0c4[_0x53a2('0x15')])){_0x42f093=[_0x45f0c4['interval']];}return _0x42f093;}exports['listen']=function(_0x4e2228){_0x4e2228[_0x53a2('0x16')]={};return new BPromise(function(_0x39be1b,_0x411186){var _0xf9b589={'Start':function(_0x4d3a40){var _0x1779ef=this;return new Promise(function(_0x3343d3,_0x4401b7){if(_0x4d3a40){try{var _0x42db86=[];var _0x34c7de=getId(_0x4d3a40['channel'],_0x4d3a40['message']?_0x4d3a40[_0x53a2('0x17')]['id']:0x0,_0x4d3a40[_0x53a2('0x18')]?_0x4d3a40[_0x53a2('0x18')]['id']:0x0);if(_0x4d3a40[_0x53a2('0x19')]&&_[_0x53a2('0x1a')](_0x4d3a40[_0x53a2('0x19')])&&_0x4d3a40['applications']['length']){for(var _0x3446c2=0x0;_0x3446c2<_0x4d3a40[_0x53a2('0x19')]['length'];_0x3446c2+=0x1){var _0x2b7059=_0x4d3a40[_0x53a2('0x19')][_0x3446c2];if(fs[_0x53a2('0x1b')](path[_0x53a2('0x1c')](__dirname,'applications',_0x2b7059[_0x53a2('0x1d')]+_0x53a2('0x1e')))){var _0xd9693c=[];switch(_0x2b7059[_0x53a2('0x1d')][_0x53a2('0x1f')]()){case _0x53a2('0x20'):var _0x236487=_0x2b7059[_0x53a2('0x21')]['split'](',');if(_0x4d3a40['channel']===_0x53a2('0x22')){_0xd9693c[_0x53a2('0x23')](_0x236487[0x0]);_0xd9693c[_0x53a2('0x23')](_0x236487[0x1]);_0xd9693c[_0x53a2('0x23')](_0x236487[_0x53a2('0x24')](0x2,_0x236487[_0x53a2('0x25')])['join'](','));}else{_0xd9693c[_0x53a2('0x23')](_0x236487[0x0]);_0xd9693c[_0x53a2('0x23')](_0x236487[_0x53a2('0x24')](0x1,_0x236487[_0x53a2('0x25')])[_0x53a2('0x1c')](','));}break;case _0x53a2('0x26'):var _0x21325d=_0x2b7059[_0x53a2('0x21')][_0x53a2('0x27')](',');_0xd9693c[_0x53a2('0x23')](_0x21325d[0x0]);_0xd9693c[_0x53a2('0x23')](_0x21325d[0x1]);_0xd9693c[_0x53a2('0x23')](_0x21325d[_0x53a2('0x24')](0x2,_0x21325d[_0x53a2('0x25')])[_0x53a2('0x1c')](','));break;case _0x53a2('0x28'):var _0x437916=_0x2b7059['appdata'][_0x53a2('0x27')](',');_0xd9693c[_0x53a2('0x23')](_0x437916[0x0]);_0xd9693c[_0x53a2('0x23')](_0x437916[0x1]);_0xd9693c[_0x53a2('0x23')](_0x437916[0x2]);_0xd9693c[_0x53a2('0x23')](_0x437916[0x3]);_0xd9693c[_0x53a2('0x23')](_0x437916[_0x53a2('0x24')](0x4,_0x437916[_0x53a2('0x25')])[_0x53a2('0x1c')](','));break;case _0x53a2('0x29'):var _0x21d943=_0x2b7059['appdata'][_0x53a2('0x27')](',');_0xd9693c[_0x53a2('0x23')](_0x21d943[0x0]);_0xd9693c[_0x53a2('0x23')](_0x21d943[0x1]);_0xd9693c[_0x53a2('0x23')](_0x21d943[0x2]);_0xd9693c[_0x53a2('0x23')](_0x21d943[0x3]);_0xd9693c[_0x53a2('0x23')](_0x21d943[_0x53a2('0x24')](0x4,_0x21d943[_0x53a2('0x25')])['join'](','));break;case _0x53a2('0x17'):_0xd9693c[_0x53a2('0x23')](_0x2b7059[_0x53a2('0x21')]);break;case _0x53a2('0x2a'):_0xd9693c['push'](_0x2b7059[_0x53a2('0x2b')]);_0xd9693c[_0x53a2('0x23')](_0x2b7059[_0x53a2('0x21')]);break;case _0x53a2('0x2c'):var _0x218956=utils[_0x53a2('0x2d')](_0x4d3a40['account'][_0x53a2('0x2e')],_0x4d3a40);var _0x14f236=_0x2b7059[_0x53a2('0x21')]['split'](',');_0xd9693c[_0x53a2('0x23')](_0x14f236[0x0]);_0xd9693c['push'](_0x14f236[0x1]);_0xd9693c[_0x53a2('0x23')](_0x14f236[0x2]);_0xd9693c[_0x53a2('0x23')](_0x14f236[0x3]);_0xd9693c[_0x53a2('0x23')](_0x14f236[0x4]);_0xd9693c['push'](_0x14f236[0x5]);_0xd9693c['push'](_0x14f236[0x6]);_0xd9693c[_0x53a2('0x23')](_0x14f236[0x7]);_0xd9693c['push'](_0x14f236[0x8]);_0xd9693c[_0x53a2('0x23')](_0x14f236[0x9]);_0xd9693c[_0x53a2('0x23')](_0x14f236[0xa]);_0xd9693c[_0x53a2('0x23')](_0x4d3a40[_0x53a2('0x18')]['id']);_0xd9693c[_0x53a2('0x23')](_0x4d3a40[_0x53a2('0x17')]['id']);_0xd9693c['push'](_0x2b7059[_0x53a2('0x2f')]);_0xd9693c[_0x53a2('0x23')](_0x4d3a40['interaction']['ContactId']);_0xd9693c[_0x53a2('0x23')](_0x4d3a40['body'][_0x53a2('0x30')]);_0xd9693c[_0x53a2('0x23')](_0x218956);break;default:_0xd9693c=_['isNil'](_0x2b7059[_0x53a2('0x21')])?[]:_0x2b7059[_0x53a2('0x21')][_0x53a2('0x27')](',');}var _0x1aa50d={'id':util[_0x53a2('0x10')]('%s:%s:%s',_0x34c7de,_0x2b7059['id'],_0x2b7059[_0x53a2('0x1d')]),'condition':require(_0x53a2('0x31'))['condition'](_0x34c7de,getIntervals(_0x4e2228[_0x53a2('0x32')],_0x2b7059),_0x4e2228),'consequence':require(_0x53a2('0x33')+_0x2b7059['app'])[_0x53a2('0x34')](_0x34c7de,_0xd9693c,_0x4e2228,_0x4d3a40),'p':_0x2b7059['priority']||0x0};logger[_0x53a2('0x35')](_0x53a2('0x36'),_0x1aa50d['id'],_0x53a2('0x37'),getIntervals(_0x4e2228[_0x53a2('0x32')],_0x2b7059)[_0x53a2('0x1c')](_0x53a2('0x38')));_0x42db86['push'](_0x1aa50d);}else{logger[_0x53a2('0x39')](_0x53a2('0x3a'),path[_0x53a2('0x1c')](__dirname,_0x53a2('0x19'),_0x2b7059[_0x53a2('0x1d')]+_0x53a2('0x1e')));}}_0x4e2228[_0x53a2('0x16')][_0x34c7de]=new RuleEngine(_0x42db86);_0x4e2228[_0x53a2('0x16')][_0x34c7de][_0x53a2('0x3b')](_0x4d3a40,function(_0x1b5fbe){logger[_0x53a2('0x35')](_0x53a2('0x3c'),JSON[_0x53a2('0x3d')](_0x1b5fbe[_0x53a2('0x3e')]));if(_0x4e2228[_0x53a2('0x16')][_0x34c7de]){_0x4e2228[_0x53a2('0x16')][_0x34c7de]['emit'](_0x53a2('0x3f'));}});return _0x3343d3({'code':0xc8,'message':_0x4d3a40});}else{logger[_0x53a2('0x35')]('No\x20applications\x20to\x20execute');return _0x3343d3({'code':0xc8,'message':_0x4d3a40});}}catch(_0x52e69d){logger[_0x53a2('0x39')](_0x52e69d['stack']);return _0x4401b7(_0x1779ef['error'](0x1f4,_0x52e69d));}}return _0x4401b7(_0x53a2('0x40'));});},'AcceptMessage':function(_0x22b324){var _0x37432a=this;return new Promise(function(_0x3001e2,_0x47ff27){if(_0x22b324['agent']&&_0x22b324['agent']['id']){if(_0x4e2228[_0x53a2('0x41')][_0x22b324['agent']['id']]){_0x4e2228['agents'][_0x22b324[_0x53a2('0x42')]['id']][_0x53a2('0x43')]=![];_0x4e2228[_0x53a2('0x41')][_0x22b324[_0x53a2('0x42')]['id']][_0x53a2('0x44')]=undefined;}}if(_0x22b324['message']&&_0x22b324[_0x53a2('0x17')]['id']){try{var _0x5d8f65=getId(_0x22b324[_0x53a2('0x45')],_0x22b324[_0x53a2('0x17')]?_0x22b324['message']['id']:0x0,_0x22b324[_0x53a2('0x18')]?_0x22b324[_0x53a2('0x18')]['id']:0x0);if(_0x4e2228[_0x53a2('0x16')][_0x5d8f65]){_0x4e2228[_0x53a2('0x16')][_0x5d8f65][_0x53a2('0x46')](_0x53a2('0x47'));if(rpc[_0x22b324[_0x53a2('0x45')]+'QueueReport']){rpc[_0x22b324[_0x53a2('0x45')]+_0x53a2('0x48')][_0x53a2('0x49')](_0x5d8f65,{'UserId':_0x22b324['message'][_0x53a2('0x4a')]})[_0x53a2('0x4b')](function(_0x42238f){logger[_0x53a2('0x39')](_0x53a2('0x4c'));});}}return _0x3001e2({'code':0xc8,'message':_0x22b324});}catch(_0x567fce){logger['error'](_0x567fce[_0x53a2('0x4d')]);return _0x47ff27(_0x37432a['error'](0x1f4,_0x567fce));}}logger[_0x53a2('0x39')](_0x53a2('0x4e'));return _0x47ff27(_0x37432a['error'](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0xea7cbd){var _0x382eba=this;return new Promise(function(_0x3b1b43,_0x5eae3e){if(_0xea7cbd['agent']&&_0xea7cbd[_0x53a2('0x42')]['id']){try{if(_0x4e2228[_0x53a2('0x41')][_0xea7cbd[_0x53a2('0x42')]['id']]){_0x4e2228[_0x53a2('0x41')][_0xea7cbd[_0x53a2('0x42')]['id']]['busy']=![];_0x4e2228[_0x53a2('0x41')][_0xea7cbd[_0x53a2('0x42')]['id']][_0x53a2('0x44')]=undefined;}return _0x3b1b43({'code':0xc8,'message':_0xea7cbd});}catch(_0x35ed40){logger[_0x53a2('0x39')](_0x35ed40[_0x53a2('0x4d')]);return _0x5eae3e(_0x382eba[_0x53a2('0x39')](0x1f4,_0x35ed40));}}logger['error'](_0x53a2('0x4e'));return _0x5eae3e(_0x382eba['error'](0x1f4,_0x53a2('0x4e')));});},'AbandonInteraction':function(_0x867db6){var _0x3b91eb=this;return new Promise(function(_0x3fdc94,_0x54a1c4){if(_0x867db6[_0x53a2('0x45')]&&_0x867db6[_0x53a2('0x18')]&&_0x867db6[_0x53a2('0x18')]['id']){try{var _0x2b6ab8=getId(_0x867db6[_0x53a2('0x45')],_0x867db6[_0x53a2('0x17')]?_0x867db6['message']['id']:0x0,_0x867db6[_0x53a2('0x18')]?_0x867db6[_0x53a2('0x18')]['id']:0x0);if(_0x4e2228[_0x53a2('0x16')][_0x2b6ab8]){_0x4e2228[_0x53a2('0x16')][_0x2b6ab8][_0x53a2('0x46')](_0x53a2('0x47'));}return _0x3fdc94({'code':0xc8,'message':_0x867db6});}catch(_0x22f40d){logger['error'](_0x22f40d[_0x53a2('0x4d')]);return _0x54a1c4(_0x3b91eb['error'](0x1f4,_0x22f40d));}}logger[_0x53a2('0x39')](_0x53a2('0x4e'));return _0x54a1c4(_0x3b91eb[_0x53a2('0x39')](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0x303f04){var _0xd44b05=this;return new Promise(function(_0x560fc1,_0x1be4ee){if(_0x4e2228['agents'][_0x53a2('0x4f')](_0x303f04['id'])){for(var _0x3aed8d in _0x303f04[_0x53a2('0x50')]){if(_0x303f04[_0x53a2('0x50')]['hasOwnProperty'](_0x3aed8d)){if(_0x4e2228[_0x53a2('0x41')][_0x303f04['id']][_0x53a2('0x4f')](_0x3aed8d+_0x53a2('0x51'))){_0x4e2228[_0x53a2('0x41')][_0x303f04['id']][_0x3aed8d+_0x53a2('0x51')]=parseInt(_0x303f04[_0x53a2('0x50')][_0x3aed8d],0xa);}}}_0x4e2228[_0x53a2('0x41')][_0x303f04['id']][_0x53a2('0x52')]();return _0x560fc1({'code':0xc8,'message':_0x4e2228[_0x53a2('0x41')][_0x303f04['id']]});}else{return _0x1be4ee(_0xd44b05[_0x53a2('0x39')](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0xdd35f){return new Promise(function(_0x5a76f8,_0x4a4dd9){var _0x3bc128=_[_0x53a2('0x53')](_0x4e2228['agents']);_0x5a76f8({'count':_0x3bc128['length'],'rows':_0x3bc128});});},'ChatQueues':function(_0xc9229e){return new Promise(function(_0x129c73,_0x3ba714){var _0x3e6374=[];for(var _0x5b5309 in _0x4e2228[_0x53a2('0x54')]){if(_0x4e2228['chatQueues'][_0x53a2('0x4f')](_0x5b5309)){var _0x1dad4e=_0x4e2228[_0x53a2('0x54')][_0x5b5309];var _0x52930e={'id':_0x1dad4e['id'],'available':_0x1dad4e[_0x53a2('0x55')],'loggedIn':_0x1dad4e[_0x53a2('0x56')],'name':_0x1dad4e[_0x53a2('0x57')],'paused':_0x1dad4e[_0x53a2('0x58')],'waiting':_0x1dad4e[_0x53a2('0x59')]};_0x3e6374[_0x53a2('0x23')](_0x52930e);}}_0x129c73({'count':_0x3e6374[_0x53a2('0x25')],'rows':_0x3e6374});});},'MailQueues':function(_0x34cd6a){return new Promise(function(_0x825085,_0x18b7c6){var _0x2368d3=[];for(var _0x1c8d3a in _0x4e2228[_0x53a2('0x5a')]){if(_0x4e2228[_0x53a2('0x5a')][_0x53a2('0x4f')](_0x1c8d3a)){var _0x321b2e=_0x4e2228['mailQueues'][_0x1c8d3a];var _0x319a21={'id':_0x321b2e['id'],'available':_0x321b2e['available'],'loggedIn':_0x321b2e[_0x53a2('0x56')],'name':_0x321b2e[_0x53a2('0x57')],'paused':_0x321b2e[_0x53a2('0x58')],'waiting':_0x321b2e[_0x53a2('0x59')]};_0x2368d3[_0x53a2('0x23')](_0x319a21);}}_0x825085({'count':_0x2368d3[_0x53a2('0x25')],'rows':_0x2368d3});});},'OpenchannelQueues':function(_0x10ee58){return new Promise(function(_0x1dd5fd,_0x29c7b2){var _0x27cc5c=[];for(var _0x537e95 in _0x4e2228[_0x53a2('0x5b')]){if(_0x4e2228[_0x53a2('0x5b')][_0x53a2('0x4f')](_0x537e95)){var _0x5a0c99=_0x4e2228[_0x53a2('0x5b')][_0x537e95];var _0x245c5e={'id':_0x5a0c99['id'],'available':_0x5a0c99['available'],'loggedIn':_0x5a0c99['loggedIn'],'name':_0x5a0c99[_0x53a2('0x57')],'paused':_0x5a0c99[_0x53a2('0x58')],'waiting':_0x5a0c99[_0x53a2('0x59')]};_0x27cc5c[_0x53a2('0x23')](_0x245c5e);}}_0x1dd5fd({'count':_0x27cc5c[_0x53a2('0x25')],'rows':_0x27cc5c});});},'SmsQueues':function(_0x4c6734){return new Promise(function(_0x29b4e1,_0x2069ce){var _0x1626f6=[];for(var _0x1589a8 in _0x4e2228[_0x53a2('0x5c')]){if(_0x4e2228[_0x53a2('0x5c')][_0x53a2('0x4f')](_0x1589a8)){var _0x26888a=_0x4e2228[_0x53a2('0x5c')][_0x1589a8];var _0x54aa95={'id':_0x26888a['id'],'available':_0x26888a[_0x53a2('0x55')],'loggedIn':_0x26888a[_0x53a2('0x56')],'name':_0x26888a[_0x53a2('0x57')],'paused':_0x26888a[_0x53a2('0x58')],'waiting':_0x26888a[_0x53a2('0x59')]};_0x1626f6[_0x53a2('0x23')](_0x54aa95);}}_0x29b4e1({'count':_0x1626f6[_0x53a2('0x25')],'rows':_0x1626f6});});},'FaxQueues':function(_0x23dff3){return new Promise(function(_0x2815ab,_0xed760a){var _0x23f04b=[];for(var _0x42fea7 in _0x4e2228[_0x53a2('0x5d')]){if(_0x4e2228[_0x53a2('0x5d')][_0x53a2('0x4f')](_0x42fea7)){var _0x2f3375=_0x4e2228['faxQueues'][_0x42fea7];var _0x4faa54={'id':_0x2f3375['id'],'available':_0x2f3375[_0x53a2('0x55')],'loggedIn':_0x2f3375['loggedIn'],'name':_0x2f3375[_0x53a2('0x57')],'paused':_0x2f3375[_0x53a2('0x58')],'waiting':_0x2f3375['waiting']};_0x23f04b[_0x53a2('0x23')](_0x4faa54);}}_0x2815ab({'count':_0x23f04b[_0x53a2('0x25')],'rows':_0x23f04b});});},'WhatsappQueues':function(_0x4757ef){return new Promise(function(_0x212d94,_0x5d386c){var _0x4ddff8=[];for(var _0x57d8cc in _0x4e2228[_0x53a2('0x5e')]){if(_0x4e2228[_0x53a2('0x5e')][_0x53a2('0x4f')](_0x57d8cc)){var _0x777a51=_0x4e2228[_0x53a2('0x5e')][_0x57d8cc];var _0x40309d={'id':_0x777a51['id'],'available':_0x777a51[_0x53a2('0x55')],'loggedIn':_0x777a51[_0x53a2('0x56')],'name':_0x777a51['name'],'paused':_0x777a51[_0x53a2('0x58')],'waiting':_0x777a51[_0x53a2('0x59')]};_0x4ddff8[_0x53a2('0x23')](_0x40309d);}}_0x212d94({'count':_0x4ddff8[_0x53a2('0x25')],'rows':_0x4ddff8});});},'ChatQueuesWaitingInteractions':function(_0x581764){return new Promise(function(_0x1f7a86,_0x2cf305){var _0xa65858=_['values'](_0x4e2228[_0x53a2('0x5f')]);_0x1f7a86({'count':_0xa65858[_0x53a2('0x25')],'rows':_0xa65858});});},'MailQueuesWaitingInteractions':function(_0x3d288e){return new Promise(function(_0x4783ad,_0x4a0a99){var _0x464157=_[_0x53a2('0x53')](_0x4e2228[_0x53a2('0x60')]);_0x4783ad({'count':_0x464157['length'],'rows':_0x464157});});},'OpenchannelQueuesWaitingInteractions':function(_0x1d4a99){return new Promise(function(_0x395c51,_0x59dae1){var _0x24cb49=_['values'](_0x4e2228[_0x53a2('0x61')]);_0x395c51({'count':_0x24cb49[_0x53a2('0x25')],'rows':_0x24cb49});});},'SmsQueuesWaitingInteractions':function(_0x5de009){return new Promise(function(_0x56b958,_0x4cb2b5){var _0xcdbb78=_['values'](_0x4e2228['smsQueuesWaitingInteractions']);_0x56b958({'count':_0xcdbb78['length'],'rows':_0xcdbb78});});},'FaxQueuesWaitingInteractions':function(_0x1c30bb){return new Promise(function(_0x68a73c,_0x5d675d){var _0x386914=_[_0x53a2('0x53')](_0x4e2228[_0x53a2('0x62')]);_0x68a73c({'count':_0x386914[_0x53a2('0x25')],'rows':_0x386914});});},'WhatsappQueuesWaitingInteractions':function(_0x38a08a){return new Promise(function(_0x5b6679,_0x1ebe6c){var _0x5389bd=_[_0x53a2('0x53')](_0x4e2228[_0x53a2('0x63')]);_0x5b6679({'count':_0x5389bd[_0x53a2('0x25')],'rows':_0x5389bd});});}};var _0xd7d5d8=jayson['server'](_0xf9b589)[_0x53a2('0x64')]();_0xd7d5d8['on'](_0x53a2('0x39'),function(_0x2cc02c){logger[_0x53a2('0x39')](JSON['stringify'](_0x2cc02c));return _0x411186(_0x2cc02c);});_0xd7d5d8[_0x53a2('0x65')](0x232c,_0x53a2('0x66'),function(){console['log'](_0x53a2('0x67'),0x232c);return _0x39be1b(_0x53a2('0x68')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 9523e5c..d871212 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 _0x4cd1=['Command','format','true','[%s][INTERVAL]\x20%s','all','[%s][INTERVAL]\x20%s\x20%s','join','when','log','\x20|\x20','stack','util','lodash','../../../config/logger','client','then','error','message','catch','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','push'];(function(_0x5c365f,_0x3b40ed){var _0x295e1b=function(_0x226683){while(--_0x226683){_0x5c365f['push'](_0x5c365f['shift']());}};_0x295e1b(++_0x3b40ed);}(_0x4cd1,0x1bb));var _0x14cd=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x4cd1[_0x3b380d];return _0x54502b;};'use strict';var util=require(_0x14cd('0x0'));var BPromise=require('bluebird');var jayson=require('jayson/promise');var _=require(_0x14cd('0x1'));var logger=require(_0x14cd('0x2'))('routing');var client=jayson[_0x14cd('0x3')]['http']({'port':0x232a});function request(_0x12f0ba,_0x3d762e){return new BPromise(function(_0x41b13a,_0x426924){return client['request'](_0x12f0ba,_0x3d762e)[_0x14cd('0x4')](function(_0x24d09b){if(_0x24d09b[_0x14cd('0x5')]){return _0x426924(_0x24d09b[_0x14cd('0x5')][_0x14cd('0x6')]);}else{return _0x41b13a(_0x24d09b['result']);}})[_0x14cd('0x7')](function(_0x52b067){return _0x426924(_0x52b067);});});}exports['condition']=function(_0x55ead6,_0x5e0b28,_0x32bbf1){return function(_0x7ac301){if(_0x32bbf1[_0x14cd('0x8')]&&!_0x32bbf1[_0x14cd('0x8')][_0x55ead6]){logger[_0x14cd('0x9')](_0x14cd('0xa'),_0x55ead6);return _0x7ac301[_0x14cd('0xb')]();}var _0x4439bd=[];for(var _0xb3e184=0x0;_0xb3e184<_0x5e0b28['length'];_0xb3e184+=0x1){_0x4439bd[_0x14cd('0xc')](request(_0x14cd('0xd'),{'command':util[_0x14cd('0xe')]('iftime\x20%s',_0x5e0b28[_0xb3e184])})[_0x14cd('0x4')](function(_0x3fd745){return _0x3fd745&&_0x3fd745[_0x14cd('0x6')]&&_0x3fd745[_0x14cd('0x6')]['indexOf'](_0x14cd('0xf'))>=0x0?!![]:![];})[_0x14cd('0x7')](function(_0x331cae){logger[_0x14cd('0x5')](_0x14cd('0x10'),_0x55ead6,_0x5e0b28[_0xb3e184]);}));}BPromise[_0x14cd('0x11')](_0x4439bd)[_0x14cd('0x4')](function(_0x576667){var _0x54a02f=_['some'](_0x576667);logger[_0x14cd('0x9')](_0x14cd('0x12'),_0x55ead6,_0x5e0b28[_0x14cd('0x13')]('\x20|\x20'),_0x54a02f);_0x7ac301[_0x14cd('0x14')](_0x54a02f);})[_0x14cd('0x7')](function(_0x5f4ec8){console[_0x14cd('0x15')](_0x5f4ec8);logger['error']('[%s][INTERVAL]\x20%s\x20%s',_0x55ead6,_0x5e0b28[_0x14cd('0x13')](_0x14cd('0x16')),_0x5f4ec8[_0x14cd('0x17')]);_0x7ac301[_0x14cd('0xb')]();});};}; \ No newline at end of file +var _0x803b=['lodash','../../../config/logger','routing','request','then','error','catch','condition','rules','stop','push','Command','format','iftime\x20%s','message','indexOf','true','[%s][INTERVAL]\x20%s','all','some','info','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','log','stack'];(function(_0x24f41e,_0xd46989){var _0x1b6211=function(_0x1b6cb4){while(--_0x1b6cb4){_0x24f41e['push'](_0x24f41e['shift']());}};_0x1b6211(++_0xd46989);}(_0x803b,0xb6));var _0xb803=function(_0x4d6ea0,_0x4b52a5){_0x4d6ea0=_0x4d6ea0-0x0;var _0x1d1c0c=_0x803b[_0x4d6ea0];return _0x1d1c0c;};'use strict';var util=require('util');var BPromise=require('bluebird');var jayson=require('jayson/promise');var _=require(_0xb803('0x0'));var logger=require(_0xb803('0x1'))(_0xb803('0x2'));var client=jayson['client']['http']({'port':0x232a});function request(_0x12d399,_0x4b6dae){return new BPromise(function(_0x2b9818,_0x5558b9){return client[_0xb803('0x3')](_0x12d399,_0x4b6dae)[_0xb803('0x4')](function(_0x128866){if(_0x128866[_0xb803('0x5')]){return _0x5558b9(_0x128866[_0xb803('0x5')]['message']);}else{return _0x2b9818(_0x128866['result']);}})[_0xb803('0x6')](function(_0x2e76e6){return _0x5558b9(_0x2e76e6);});});}exports[_0xb803('0x7')]=function(_0x4291ed,_0x4596b3,_0x476dd6){return function(_0x4971c4){if(_0x476dd6['rules']&&!_0x476dd6[_0xb803('0x8')][_0x4291ed]){logger['info']('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0x4291ed);return _0x4971c4[_0xb803('0x9')]();}var _0x53d2d3=[];for(var _0x336280=0x0;_0x336280<_0x4596b3['length'];_0x336280+=0x1){_0x53d2d3[_0xb803('0xa')](request(_0xb803('0xb'),{'command':util[_0xb803('0xc')](_0xb803('0xd'),_0x4596b3[_0x336280])})[_0xb803('0x4')](function(_0x112767){return _0x112767&&_0x112767[_0xb803('0xe')]&&_0x112767[_0xb803('0xe')][_0xb803('0xf')](_0xb803('0x10'))>=0x0?!![]:![];})['catch'](function(_0xdc6325){logger[_0xb803('0x5')](_0xb803('0x11'),_0x4291ed,_0x4596b3[_0x336280]);}));}BPromise[_0xb803('0x12')](_0x53d2d3)[_0xb803('0x4')](function(_0x2dfc70){var _0x3db257=_[_0xb803('0x13')](_0x2dfc70);logger[_0xb803('0x14')](_0xb803('0x15'),_0x4291ed,_0x4596b3[_0xb803('0x16')](_0xb803('0x17')),_0x3db257);_0x4971c4['when'](_0x3db257);})[_0xb803('0x6')](function(_0xa949b1){console[_0xb803('0x18')](_0xa949b1);logger[_0xb803('0x5')](_0xb803('0x15'),_0x4291ed,_0x4596b3['join'](_0xb803('0x17')),_0xa949b1[_0xb803('0x19')]);_0x4971c4['stop']();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 47d0d50..ed2ef00 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 _0x0565=['agentacw','agentcomplete','acwtime','acwTimeout','request','agentcalled','debug','[%s][agents][agentcalled]','destuniqueid','agentcalledAt','now','lastevent','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','agentringnoanswer','isNil','agentringnoanswerAt','timeout','holdtime','ringtime','talktime','push','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','connect','forIn','answered_elsewhere','reason','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','blindtransfer','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfereruniqueid','transfer','transfertype','blind','transferexten','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','ATTENDED','transfereeuniqueid','agententerreason','calleridname','secondtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfererexten','transfertargetuniqueid','hangup','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','diffTime','agent','[%s][agents][hangup]','lodash','util','./utils','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','membername','interface','calleridnum','connectedlinenum','getVoiceQueueByName','queue','then','type'];(function(_0x2f2cbe,_0x15dea7){var _0x4f6b3d=function(_0x5e2d58){while(--_0x5e2d58){_0x2f2cbe['push'](_0x2f2cbe['shift']());}};_0x4f6b3d(++_0x15dea7);}(_0x0565,0xf2));var _0x5056=function(_0x411017,_0x4a8117){_0x411017=_0x411017-0x0;var _0x2adeea=_0x0565[_0x411017];return _0x2adeea;};'use strict';var _=require(_0x5056('0x0'));var util=require(_0x5056('0x1'));var utils=require(_0x5056('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x2e0694,_0x354d5d){utils[_0x5056('0x3')](util[_0x5056('0x4')](_0x5056('0x5'),_0x2e0694[_0x5056('0x6')],_0x2e0694[_0x5056('0x7')],_0x2e0694['queue'],_0x2e0694[_0x5056('0x8')],_0x2e0694[_0x5056('0x9')],_0x2e0694[_0x5056('0xa')],_0x2e0694[_0x5056('0xb')],_0x2e0694['lastevent']));if(_0x2e0694['queue']){utils[_0x5056('0xc')](_0x2e0694[_0x5056('0xd')])[_0x5056('0xe')](function(_0x2e6f18){if(_0x2e6f18){_0x2e0694[_0x5056('0xf')]=_0x2e6f18[_0x5056('0xf')];_0x2e0694[_0x5056('0x10')]=_0x2e0694[_0x5056('0x11')]?_0x2e6f18['acw']:![];_0x2e0694[_0x5056('0x12')]=_0x2e0694[_0x5056('0x10')]?_0x2e6f18[_0x5056('0x13')]:0x0;}utils['request']('CreateVoiceAgentReport',_0x2e0694);});}else{utils[_0x5056('0x14')]('CreateVoiceAgentReport',_0x2e0694);}if(_0x354d5d){delete transfers[_0x2e0694['uniqueid']];}else{delete agents[_0x2e0694['destuniqueid']];}}exports[_0x5056('0x15')]=function(_0x4b183a){try{utils[_0x5056('0x16')](util[_0x5056('0x4')](_0x5056('0x17'),_0x4b183a['uniqueid']),_0x4b183a);agents[_0x4b183a[_0x5056('0x18')]]=_0x4b183a;agents[_0x4b183a[_0x5056('0x18')]][_0x5056('0x19')]=utils[_0x5056('0x1a')]();agents[_0x4b183a[_0x5056('0x18')]][_0x5056('0x1b')]='called';agents[_0x4b183a[_0x5056('0x18')]]['connectedlinenum']=null;agents[_0x4b183a[_0x5056('0x18')]][_0x5056('0x1c')]=null;utils[_0x5056('0x3')](util[_0x5056('0x4')](_0x5056('0x1d'),_0x4b183a['uniqueid'],agents[_0x4b183a[_0x5056('0x18')]][_0x5056('0x8')],_0x4b183a['destuniqueid']));}catch(_0x5c1cec){utils[_0x5056('0x1e')](util[_0x5056('0x4')](_0x5056('0x17'),_0x4b183a[_0x5056('0x6')]),_0x5c1cec);}};exports[_0x5056('0x1f')]=function(_0xf04e08){try{if(!_[_0x5056('0x20')](agents[_0xf04e08['destuniqueid']])){utils[_0x5056('0x16')](util[_0x5056('0x4')]('[%s][agents][agentringnoanswer]',_0xf04e08[_0x5056('0x6')]),_0xf04e08);utils[_0x5056('0x3')](util[_0x5056('0x4')]('[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout',_0xf04e08[_0x5056('0x6')],agents[_0xf04e08[_0x5056('0x18')]]['membername'],_0xf04e08['destuniqueid']));agents[_0xf04e08[_0x5056('0x18')]][_0x5056('0x1f')]=!![];agents[_0xf04e08[_0x5056('0x18')]][_0x5056('0x21')]=utils['now']();agents[_0xf04e08[_0x5056('0x18')]][_0x5056('0x1b')]='timeout';agents[_0xf04e08[_0x5056('0x18')]]['reason']=_0x5056('0x22');agents[_0xf04e08[_0x5056('0x18')]][_0x5056('0x23')]=_0xf04e08[_0x5056('0x24')]?parseInt(_0xf04e08[_0x5056('0x24')])/0x3e8:0x0;agents[_0xf04e08['destuniqueid']][_0x5056('0x25')]=0x0;unanswered[_0x5056('0x26')](_0xf04e08[_0x5056('0x18')]);}}catch(_0x2ac79a){utils['error'](util[_0x5056('0x4')]('[%s][agents][agentringnoanswer]',_0xf04e08[_0x5056('0x6')]),_0x2ac79a);}};exports['queuecallerabandon']=function(_0x56ccba){try{_['forIn'](agents,function(_0x113be0,_0x252f75){if(_0x113be0['uniqueid']==_0x56ccba[_0x5056('0x6')]&&!_[_0x5056('0x27')](unanswered,_0x113be0[_0x5056('0x18')])){utils[_0x5056('0x16')](util[_0x5056('0x4')](_0x5056('0x28'),_0x56ccba[_0x5056('0x6')]),_0x56ccba);utils[_0x5056('0x3')](util[_0x5056('0x4')](_0x5056('0x29'),_0x56ccba[_0x5056('0x6')],_0x113be0['membername'],_0x113be0['destuniqueid']));_0x113be0[_0x5056('0x1f')]=!![];_0x113be0[_0x5056('0x21')]=utils['now']();_0x113be0[_0x5056('0x1b')]=_0x5056('0x2a');_0x113be0['reason']=_0x5056('0x2a');_0x113be0[_0x5056('0x23')]=_0x56ccba[_0x5056('0x23')];_0x113be0[_0x5056('0x25')]=0x0;writeDB(_0x113be0);}});}catch(_0x33edfb){utils[_0x5056('0x1e')](util[_0x5056('0x4')](_0x5056('0x28'),_0x56ccba[_0x5056('0x6')]),_0x33edfb);}};exports[_0x5056('0x2b')]=function(_0x199129){try{if(agents[_0x199129[_0x5056('0x18')]]){utils[_0x5056('0x16')](util[_0x5056('0x4')](_0x5056('0x2c'),_0x199129['uniqueid']),_0x199129);utils[_0x5056('0x3')](util['format'](_0x5056('0x2d'),_0x199129[_0x5056('0x6')],agents[_0x199129[_0x5056('0x18')]][_0x5056('0x8')],_0x199129['destuniqueid']));agents[_0x199129[_0x5056('0x18')]][_0x5056('0x2e')]=utils['now']();agents[_0x199129[_0x5056('0x18')]]['connectedlinenum']=_0x199129[_0x5056('0xb')];agents[_0x199129[_0x5056('0x18')]][_0x5056('0x1c')]=_0x199129['connectedlinename'];agents[_0x199129[_0x5056('0x18')]][_0x5056('0x23')]=_0x199129[_0x5056('0x24')];agents[_0x199129[_0x5056('0x18')]][_0x5056('0x1b')]=_0x5056('0x2f');_[_0x5056('0x30')](agents,function(_0x21aa75,_0x15553e){if(_0x21aa75[_0x5056('0x18')]!=_0x199129[_0x5056('0x18')]&&_0x21aa75[_0x5056('0x6')]==_0x199129[_0x5056('0x6')]){_0x21aa75[_0x5056('0x25')]=0x0;_0x21aa75[_0x5056('0x23')]=_0x199129[_0x5056('0x24')];_0x21aa75['agentringnoanswer']=!![];_0x21aa75['agentringnoanswerAt']=utils[_0x5056('0x1a')]();_0x21aa75[_0x5056('0x1b')]=_0x5056('0x31');_0x21aa75[_0x5056('0x32')]=_0x5056('0x31');_0x21aa75[_0x5056('0x33')]=_0x199129[_0x5056('0x18')];_0x21aa75[_0x5056('0x34')]=_0x199129['membername'];writeDB(_0x21aa75);}});}}catch(_0x58f12f){utils[_0x5056('0x1e')](util[_0x5056('0x4')](_0x5056('0x2c'),_0x199129['uniqueid']),_0x58f12f);}};exports[_0x5056('0x11')]=function(_0x5b99e9){try{if(!_[_0x5056('0x20')](agents[_0x5b99e9[_0x5056('0x18')]])){utils[_0x5056('0x16')](util[_0x5056('0x4')](_0x5056('0x35'),_0x5b99e9[_0x5056('0x6')]),_0x5b99e9);utils['info'](util[_0x5056('0x4')](_0x5056('0x36'),_0x5b99e9[_0x5056('0x6')],agents[_0x5b99e9['destuniqueid']]['membername'],_0x5b99e9['destuniqueid']));agents[_0x5b99e9['destuniqueid']][_0x5056('0x11')]=!![];agents[_0x5b99e9[_0x5056('0x18')]][_0x5056('0x37')]=utils[_0x5056('0x1a')]();agents[_0x5b99e9[_0x5056('0x18')]]['talktime']=utils['diffTime'](agents[_0x5b99e9[_0x5056('0x18')]][_0x5056('0x37')],agents[_0x5b99e9[_0x5056('0x18')]][_0x5056('0x2e')]);agents[_0x5b99e9[_0x5056('0x18')]][_0x5056('0x32')]=_0x5b99e9[_0x5056('0x32')];agents[_0x5b99e9['destuniqueid']]['lastevent']=_0x5056('0x38');writeDB(agents[_0x5b99e9[_0x5056('0x18')]]);}}catch(_0x5a2f73){utils[_0x5056('0x1e')](util[_0x5056('0x4')]('[%s][agents][agentcomplete]',_0x5b99e9['uniqueid']),_0x5a2f73);}};exports[_0x5056('0x39')]=function(_0x1ab1a9){try{if(!_['isNil'](agents[_0x1ab1a9['transfereruniqueid']])){utils[_0x5056('0x16')](util[_0x5056('0x4')]('[%s][agents][blindtransfer]',_0x1ab1a9['uniqueid']),_0x1ab1a9);utils[_0x5056('0x3')](util[_0x5056('0x4')](_0x5056('0x3a'),_0x1ab1a9[_0x5056('0x6')],agents[_0x1ab1a9[_0x5056('0x3b')]][_0x5056('0x8')],agents[_0x1ab1a9[_0x5056('0x3b')]][_0x5056('0x6')]));agents[_0x1ab1a9[_0x5056('0x3b')]][_0x5056('0x3c')]=!![];agents[_0x1ab1a9[_0x5056('0x3b')]][_0x5056('0x3d')]=_0x5056('0x3e');agents[_0x1ab1a9[_0x5056('0x3b')]][_0x5056('0x3f')]=_0x1ab1a9['extension'];agents[_0x1ab1a9['transfereruniqueid']][_0x5056('0x40')]=agents[_0x1ab1a9[_0x5056('0x3b')]][_0x5056('0x6')];}}catch(_0x1c84b1){utils[_0x5056('0x1e')](util[_0x5056('0x4')]('[%s][agents][blindtransfer]',_0x1ab1a9[_0x5056('0x6')]),_0x1c84b1);}};exports[_0x5056('0x41')]=function(_0x41dba4){try{utils[_0x5056('0x16')](util[_0x5056('0x4')](_0x5056('0x42'),_0x41dba4[_0x5056('0x43')]),_0x41dba4);if(_0x41dba4[_0x5056('0x43')]==_0x41dba4[_0x5056('0x44')]){if(!_[_0x5056('0x20')](agents[_0x41dba4[_0x5056('0x45')]])){utils[_0x5056('0x3')](util[_0x5056('0x4')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x41dba4[_0x5056('0x43')],agents[_0x41dba4[_0x5056('0x45')]][_0x5056('0x8')]));agents[_0x41dba4['secondtransfereruniqueid']][_0x5056('0x3c')]=!![];agents[_0x41dba4[_0x5056('0x45')]][_0x5056('0x3d')]=_0x5056('0x46');agents[_0x41dba4['secondtransfereruniqueid']]['transferexten']=_0x41dba4['origtransfererexten'];agents[_0x41dba4[_0x5056('0x45')]]['transferuniqueid']=_0x41dba4[_0x5056('0x43')];}if(_0x41dba4[_0x5056('0x47')]&&agents[_0x41dba4[_0x5056('0x47')]]){agents[_0x41dba4[_0x5056('0x47')]][_0x5056('0x48')]=0x1;transfers[_0x41dba4[_0x5056('0x47')]]=_['clone'](agents[_0x41dba4['transfereeuniqueid']]);transfers[_0x41dba4[_0x5056('0x47')]][_0x5056('0xa')]=agents[_0x41dba4['secondtransfereruniqueid']][_0x5056('0xa')];transfers[_0x41dba4[_0x5056('0x47')]][_0x5056('0x49')]=agents[_0x41dba4[_0x5056('0x45')]][_0x5056('0x49')];transfers[_0x41dba4['transfereeuniqueid']][_0x5056('0x19')]=utils[_0x5056('0x1a')]();transfers[_0x41dba4['transfereeuniqueid']][_0x5056('0x2e')]=utils[_0x5056('0x1a')]();transfers[_0x41dba4[_0x5056('0x47')]][_0x5056('0x23')]=0x0;transfers[_0x41dba4[_0x5056('0x47')]][_0x5056('0x48')]=0x2;}}else if(_0x41dba4[_0x5056('0x45')]==_0x41dba4[_0x5056('0x4a')]){if(!_[_0x5056('0x20')](agents[_0x41dba4[_0x5056('0x43')]])){utils[_0x5056('0x3')](util[_0x5056('0x4')](_0x5056('0x4b'),_0x41dba4['origtransfereruniqueid'],agents[_0x41dba4[_0x5056('0x43')]][_0x5056('0x8')]));agents[_0x41dba4[_0x5056('0x43')]][_0x5056('0x3c')]=!![];agents[_0x41dba4[_0x5056('0x43')]][_0x5056('0x3d')]='ATTENDED';agents[_0x41dba4[_0x5056('0x43')]]['transferexten']=_0x41dba4[_0x5056('0x4c')];agents[_0x41dba4[_0x5056('0x43')]]['transferuniqueid']=_0x41dba4['secondtransfereruniqueid'];}if(_0x41dba4[_0x5056('0x4d')]&&agents[_0x41dba4[_0x5056('0x4d')]]){agents[_0x41dba4[_0x5056('0x4d')]][_0x5056('0x48')]=0x1;transfers[_0x41dba4['transfertargetuniqueid']]=_['clone'](agents[_0x41dba4[_0x5056('0x4d')]]);transfers[_0x41dba4[_0x5056('0x4d')]][_0x5056('0xa')]=agents[_0x41dba4['origtransfereruniqueid']][_0x5056('0xa')];transfers[_0x41dba4['transfertargetuniqueid']][_0x5056('0x49')]=agents[_0x41dba4[_0x5056('0x43')]][_0x5056('0x49')];transfers[_0x41dba4['transfertargetuniqueid']][_0x5056('0x19')]=utils[_0x5056('0x1a')]();transfers[_0x41dba4[_0x5056('0x4d')]][_0x5056('0x2e')]=utils[_0x5056('0x1a')]();transfers[_0x41dba4[_0x5056('0x4d')]][_0x5056('0x23')]=0x0;transfers[_0x41dba4['transfertargetuniqueid']][_0x5056('0x48')]=0x2;}}}catch(_0x17131c){utils[_0x5056('0x1e')](util['format'](_0x5056('0x42'),_0x41dba4['origtransfereruniqueid']),_0x17131c);}};exports[_0x5056('0x4e')]=function(_0x5468d6){try{utils[_0x5056('0x16')](util[_0x5056('0x4')]('[%s][agents][hangup]',_0x5468d6[_0x5056('0x6')]),_0x5468d6);if(agents[_0x5468d6[_0x5056('0x6')]]&&agents[_0x5468d6['uniqueid']][_0x5056('0x32')]==='timeout'){if(_0x5468d6['cause']==='21'){agents[_0x5468d6[_0x5056('0x6')]][_0x5056('0x32')]=_0x5056('0x4f');agents[_0x5468d6[_0x5056('0x6')]][_0x5056('0x1b')]=_0x5056('0x4f');}utils[_0x5056('0x3')](util[_0x5056('0x4')](_0x5056('0x50'),_0x5468d6[_0x5056('0x6')],agents[_0x5468d6[_0x5056('0x6')]][_0x5056('0x8')],agents[_0x5468d6['uniqueid']][_0x5056('0x32')],agents[_0x5468d6['uniqueid']][_0x5056('0x1b')]));writeDB(agents[_0x5468d6[_0x5056('0x6')]]);var _0x53816f=unanswered[_0x5056('0x51')](_0x5468d6[_0x5056('0x6')]);if(_0x53816f>-0x1){unanswered[_0x5056('0x52')](_0x53816f,0x1);}}if(transfers[_0x5468d6[_0x5056('0x6')]]){transfers[_0x5468d6[_0x5056('0x6')]][_0x5056('0x11')]=!![];transfers[_0x5468d6[_0x5056('0x6')]][_0x5056('0x37')]=utils['now']();transfers[_0x5468d6[_0x5056('0x6')]][_0x5056('0x25')]=utils[_0x5056('0x53')](transfers[_0x5468d6[_0x5056('0x6')]][_0x5056('0x37')],transfers[_0x5468d6['uniqueid']][_0x5056('0x2e')]);transfers[_0x5468d6['uniqueid']][_0x5056('0x32')]=_0x5056('0x54');transfers[_0x5468d6[_0x5056('0x6')]][_0x5056('0x1b')]=_0x5056('0x38');utils[_0x5056('0x3')](util[_0x5056('0x4')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x5468d6[_0x5056('0x6')],transfers[_0x5468d6[_0x5056('0x6')]][_0x5056('0x8')],transfers[_0x5468d6[_0x5056('0x6')]][_0x5056('0x32')],transfers[_0x5468d6[_0x5056('0x6')]][_0x5056('0x1b')]));writeDB(transfers[_0x5468d6['uniqueid']],!![]);}if(agents[_0x5468d6['uniqueid']]&&agents[_0x5468d6['uniqueid']][_0x5056('0x2e')]){agents[_0x5468d6['uniqueid']][_0x5056('0x11')]=!![];agents[_0x5468d6[_0x5056('0x6')]][_0x5056('0x37')]=utils['now']();agents[_0x5468d6[_0x5056('0x6')]]['talktime']=utils[_0x5056('0x53')](agents[_0x5468d6[_0x5056('0x6')]][_0x5056('0x37')],agents[_0x5468d6['uniqueid']][_0x5056('0x2e')]);agents[_0x5468d6['uniqueid']]['reason']=agents[_0x5468d6[_0x5056('0x6')]][_0x5056('0x3c')]?'transfer':_0x5056('0x54');agents[_0x5468d6['uniqueid']][_0x5056('0x1b')]=_0x5056('0x38');utils[_0x5056('0x3')](util[_0x5056('0x4')](_0x5056('0x50'),_0x5468d6[_0x5056('0x6')],agents[_0x5468d6['uniqueid']][_0x5056('0x8')],agents[_0x5468d6[_0x5056('0x6')]][_0x5056('0x32')],agents[_0x5468d6[_0x5056('0x6')]][_0x5056('0x1b')]));writeDB(agents[_0x5468d6[_0x5056('0x6')]]);}}catch(_0x5d5c93){utils[_0x5056('0x1e')](util['format'](_0x5056('0x55'),_0x5468d6[_0x5056('0x6')]),_0x5d5c93);}}; \ No newline at end of file +var _0x5c00=['queuecallerabandon','forIn','includes','agentringnoanswer','now','abandoned','[%s][agents][queuecallerabandon]','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connect','agentringnoanswerAt','answered_elsewhere','answeredelsewheremembername','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diffTime','agentcompleteAt','complete','[%s][agents][agentcomplete]','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','blind','transferexten','extension','transferuniqueid','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','transfer','transfertype','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererexten','transfertargetuniqueid','hangup','[%s][agents][hangup]','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','agent','lodash','util','./utils','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','membername','interface','calleridnum','connectedlinenum','queue','getVoiceQueueByName','type','agentacw','agentcomplete','acw','acwTimeout','CreateVoiceAgentReport','request','destuniqueid','debug','[%s][agents][agentcalled]','agentcalledAt','lastevent','called','connectedlinename','info','error','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','timeout','reason','holdtime','ringtime','talktime','push'];(function(_0xa6a23e,_0x8b657a){var _0x210e65=function(_0x58b4b8){while(--_0x58b4b8){_0xa6a23e['push'](_0xa6a23e['shift']());}};_0x210e65(++_0x8b657a);}(_0x5c00,0x17e));var _0x05c0=function(_0x8e4e90,_0x6d7185){_0x8e4e90=_0x8e4e90-0x0;var _0x1d9d2b=_0x5c00[_0x8e4e90];return _0x1d9d2b;};'use strict';var _=require(_0x05c0('0x0'));var util=require(_0x05c0('0x1'));var utils=require(_0x05c0('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x4e54ec,_0x1e76da){utils['info'](util[_0x05c0('0x3')](_0x05c0('0x4'),_0x4e54ec[_0x05c0('0x5')],_0x4e54ec[_0x05c0('0x6')],_0x4e54ec['queue'],_0x4e54ec[_0x05c0('0x7')],_0x4e54ec[_0x05c0('0x8')],_0x4e54ec[_0x05c0('0x9')],_0x4e54ec[_0x05c0('0xa')],_0x4e54ec['lastevent']));if(_0x4e54ec[_0x05c0('0xb')]){utils[_0x05c0('0xc')](_0x4e54ec[_0x05c0('0xb')])['then'](function(_0x32a795){if(_0x32a795){_0x4e54ec[_0x05c0('0xd')]=_0x32a795[_0x05c0('0xd')];_0x4e54ec[_0x05c0('0xe')]=_0x4e54ec[_0x05c0('0xf')]?_0x32a795[_0x05c0('0x10')]:![];_0x4e54ec['acwtime']=_0x4e54ec['agentacw']?_0x32a795[_0x05c0('0x11')]:0x0;}utils['request'](_0x05c0('0x12'),_0x4e54ec);});}else{utils[_0x05c0('0x13')](_0x05c0('0x12'),_0x4e54ec);}if(_0x1e76da){delete transfers[_0x4e54ec['uniqueid']];}else{delete agents[_0x4e54ec[_0x05c0('0x14')]];}}exports['agentcalled']=function(_0x16a290){try{utils[_0x05c0('0x15')](util[_0x05c0('0x3')](_0x05c0('0x16'),_0x16a290[_0x05c0('0x5')]),_0x16a290);agents[_0x16a290[_0x05c0('0x14')]]=_0x16a290;agents[_0x16a290[_0x05c0('0x14')]][_0x05c0('0x17')]=utils['now']();agents[_0x16a290[_0x05c0('0x14')]][_0x05c0('0x18')]=_0x05c0('0x19');agents[_0x16a290[_0x05c0('0x14')]][_0x05c0('0xa')]=null;agents[_0x16a290[_0x05c0('0x14')]][_0x05c0('0x1a')]=null;utils[_0x05c0('0x1b')](util[_0x05c0('0x3')]('[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x16a290[_0x05c0('0x5')],agents[_0x16a290[_0x05c0('0x14')]][_0x05c0('0x7')],_0x16a290['destuniqueid']));}catch(_0x40d905){utils[_0x05c0('0x1c')](util[_0x05c0('0x3')](_0x05c0('0x16'),_0x16a290[_0x05c0('0x5')]),_0x40d905);}};exports['agentringnoanswer']=function(_0x407c1f){try{if(!_[_0x05c0('0x1d')](agents[_0x407c1f['destuniqueid']])){utils['debug'](util['format'](_0x05c0('0x1e'),_0x407c1f[_0x05c0('0x5')]),_0x407c1f);utils[_0x05c0('0x1b')](util[_0x05c0('0x3')](_0x05c0('0x1f'),_0x407c1f[_0x05c0('0x5')],agents[_0x407c1f[_0x05c0('0x14')]]['membername'],_0x407c1f[_0x05c0('0x14')]));agents[_0x407c1f[_0x05c0('0x14')]]['agentringnoanswer']=!![];agents[_0x407c1f['destuniqueid']]['agentringnoanswerAt']=utils['now']();agents[_0x407c1f['destuniqueid']][_0x05c0('0x18')]=_0x05c0('0x20');agents[_0x407c1f['destuniqueid']][_0x05c0('0x21')]=_0x05c0('0x20');agents[_0x407c1f[_0x05c0('0x14')]][_0x05c0('0x22')]=_0x407c1f['ringtime']?parseInt(_0x407c1f[_0x05c0('0x23')])/0x3e8:0x0;agents[_0x407c1f[_0x05c0('0x14')]][_0x05c0('0x24')]=0x0;unanswered[_0x05c0('0x25')](_0x407c1f[_0x05c0('0x14')]);}}catch(_0x5d12e0){utils['error'](util['format'](_0x05c0('0x1e'),_0x407c1f[_0x05c0('0x5')]),_0x5d12e0);}};exports[_0x05c0('0x26')]=function(_0xd6574e){try{_[_0x05c0('0x27')](agents,function(_0x1e00c5,_0x1c4c8f){if(_0x1e00c5[_0x05c0('0x5')]==_0xd6574e[_0x05c0('0x5')]&&!_[_0x05c0('0x28')](unanswered,_0x1e00c5[_0x05c0('0x14')])){utils[_0x05c0('0x15')](util['format']('[%s][agents][queuecallerabandon]',_0xd6574e[_0x05c0('0x5')]),_0xd6574e);utils[_0x05c0('0x1b')](util[_0x05c0('0x3')]('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0xd6574e[_0x05c0('0x5')],_0x1e00c5[_0x05c0('0x7')],_0x1e00c5['destuniqueid']));_0x1e00c5[_0x05c0('0x29')]=!![];_0x1e00c5['agentringnoanswerAt']=utils[_0x05c0('0x2a')]();_0x1e00c5[_0x05c0('0x18')]=_0x05c0('0x2b');_0x1e00c5[_0x05c0('0x21')]=_0x05c0('0x2b');_0x1e00c5[_0x05c0('0x22')]=_0xd6574e[_0x05c0('0x22')];_0x1e00c5[_0x05c0('0x24')]=0x0;writeDB(_0x1e00c5);}});}catch(_0x3d8d76){utils[_0x05c0('0x1c')](util[_0x05c0('0x3')](_0x05c0('0x2c'),_0xd6574e[_0x05c0('0x5')]),_0x3d8d76);}};exports[_0x05c0('0x2d')]=function(_0x185d05){try{if(agents[_0x185d05[_0x05c0('0x14')]]){utils[_0x05c0('0x15')](util[_0x05c0('0x3')](_0x05c0('0x2e'),_0x185d05[_0x05c0('0x5')]),_0x185d05);utils[_0x05c0('0x1b')](util[_0x05c0('0x3')](_0x05c0('0x2f'),_0x185d05[_0x05c0('0x5')],agents[_0x185d05[_0x05c0('0x14')]][_0x05c0('0x7')],_0x185d05[_0x05c0('0x14')]));agents[_0x185d05[_0x05c0('0x14')]][_0x05c0('0x30')]=utils[_0x05c0('0x2a')]();agents[_0x185d05[_0x05c0('0x14')]][_0x05c0('0xa')]=_0x185d05[_0x05c0('0xa')];agents[_0x185d05['destuniqueid']][_0x05c0('0x1a')]=_0x185d05[_0x05c0('0x1a')];agents[_0x185d05[_0x05c0('0x14')]][_0x05c0('0x22')]=_0x185d05['ringtime'];agents[_0x185d05['destuniqueid']][_0x05c0('0x18')]=_0x05c0('0x31');_[_0x05c0('0x27')](agents,function(_0x4ced8e,_0x29dc87){if(_0x4ced8e[_0x05c0('0x14')]!=_0x185d05[_0x05c0('0x14')]&&_0x4ced8e[_0x05c0('0x5')]==_0x185d05['uniqueid']){_0x4ced8e[_0x05c0('0x24')]=0x0;_0x4ced8e[_0x05c0('0x22')]=_0x185d05['ringtime'];_0x4ced8e[_0x05c0('0x29')]=!![];_0x4ced8e[_0x05c0('0x32')]=utils[_0x05c0('0x2a')]();_0x4ced8e[_0x05c0('0x18')]=_0x05c0('0x33');_0x4ced8e[_0x05c0('0x21')]=_0x05c0('0x33');_0x4ced8e['answeredelsewheredestinationuniqueid']=_0x185d05['destuniqueid'];_0x4ced8e[_0x05c0('0x34')]=_0x185d05[_0x05c0('0x7')];writeDB(_0x4ced8e);}});}}catch(_0xaa5d53){utils[_0x05c0('0x1c')](util[_0x05c0('0x3')]('[%s][agents][agentconnect]',_0x185d05[_0x05c0('0x5')]),_0xaa5d53);}};exports[_0x05c0('0xf')]=function(_0x2fdfe8){try{if(!_[_0x05c0('0x1d')](agents[_0x2fdfe8[_0x05c0('0x14')]])){utils[_0x05c0('0x15')](util[_0x05c0('0x3')]('[%s][agents][agentcomplete]',_0x2fdfe8[_0x05c0('0x5')]),_0x2fdfe8);utils[_0x05c0('0x1b')](util[_0x05c0('0x3')](_0x05c0('0x35'),_0x2fdfe8[_0x05c0('0x5')],agents[_0x2fdfe8[_0x05c0('0x14')]][_0x05c0('0x7')],_0x2fdfe8[_0x05c0('0x14')]));agents[_0x2fdfe8[_0x05c0('0x14')]][_0x05c0('0xf')]=!![];agents[_0x2fdfe8[_0x05c0('0x14')]]['agentcompleteAt']=utils['now']();agents[_0x2fdfe8[_0x05c0('0x14')]][_0x05c0('0x24')]=utils[_0x05c0('0x36')](agents[_0x2fdfe8[_0x05c0('0x14')]][_0x05c0('0x37')],agents[_0x2fdfe8[_0x05c0('0x14')]]['agentconnectAt']);agents[_0x2fdfe8[_0x05c0('0x14')]][_0x05c0('0x21')]=_0x2fdfe8[_0x05c0('0x21')];agents[_0x2fdfe8[_0x05c0('0x14')]]['lastevent']=_0x05c0('0x38');writeDB(agents[_0x2fdfe8[_0x05c0('0x14')]]);}}catch(_0x3ec0bf){utils[_0x05c0('0x1c')](util['format'](_0x05c0('0x39'),_0x2fdfe8[_0x05c0('0x5')]),_0x3ec0bf);}};exports[_0x05c0('0x3a')]=function(_0x9b521b){try{if(!_['isNil'](agents[_0x9b521b[_0x05c0('0x3b')]])){utils[_0x05c0('0x15')](util['format'](_0x05c0('0x3c'),_0x9b521b['uniqueid']),_0x9b521b);utils['info'](util[_0x05c0('0x3')]('[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s',_0x9b521b[_0x05c0('0x5')],agents[_0x9b521b[_0x05c0('0x3b')]][_0x05c0('0x7')],agents[_0x9b521b[_0x05c0('0x3b')]][_0x05c0('0x5')]));agents[_0x9b521b[_0x05c0('0x3b')]]['transfer']=!![];agents[_0x9b521b[_0x05c0('0x3b')]]['transfertype']=_0x05c0('0x3d');agents[_0x9b521b[_0x05c0('0x3b')]][_0x05c0('0x3e')]=_0x9b521b[_0x05c0('0x3f')];agents[_0x9b521b[_0x05c0('0x3b')]][_0x05c0('0x40')]=agents[_0x9b521b[_0x05c0('0x3b')]]['uniqueid'];}}catch(_0x5215b4){utils['error'](util[_0x05c0('0x3')](_0x05c0('0x3c'),_0x9b521b['uniqueid']),_0x5215b4);}};exports['attendedtransfer']=function(_0xbfb9cb){try{utils[_0x05c0('0x15')](util[_0x05c0('0x3')](_0x05c0('0x41'),_0xbfb9cb[_0x05c0('0x42')]),_0xbfb9cb);if(_0xbfb9cb[_0x05c0('0x42')]==_0xbfb9cb[_0x05c0('0x43')]){if(!_['isNil'](agents[_0xbfb9cb[_0x05c0('0x44')]])){utils[_0x05c0('0x1b')](util[_0x05c0('0x3')](_0x05c0('0x45'),_0xbfb9cb['origtransfereruniqueid'],agents[_0xbfb9cb[_0x05c0('0x44')]]['membername']));agents[_0xbfb9cb[_0x05c0('0x44')]][_0x05c0('0x46')]=!![];agents[_0xbfb9cb['secondtransfereruniqueid']][_0x05c0('0x47')]='ATTENDED';agents[_0xbfb9cb[_0x05c0('0x44')]][_0x05c0('0x3e')]=_0xbfb9cb[_0x05c0('0x48')];agents[_0xbfb9cb[_0x05c0('0x44')]][_0x05c0('0x40')]=_0xbfb9cb[_0x05c0('0x42')];}if(_0xbfb9cb['transfereeuniqueid']&&agents[_0xbfb9cb[_0x05c0('0x49')]]){agents[_0xbfb9cb[_0x05c0('0x49')]][_0x05c0('0x4a')]=0x1;transfers[_0xbfb9cb[_0x05c0('0x49')]]=_[_0x05c0('0x4b')](agents[_0xbfb9cb[_0x05c0('0x49')]]);transfers[_0xbfb9cb['transfereeuniqueid']][_0x05c0('0x9')]=agents[_0xbfb9cb[_0x05c0('0x44')]][_0x05c0('0x9')];transfers[_0xbfb9cb[_0x05c0('0x49')]][_0x05c0('0x4c')]=agents[_0xbfb9cb[_0x05c0('0x44')]][_0x05c0('0x4c')];transfers[_0xbfb9cb[_0x05c0('0x49')]][_0x05c0('0x17')]=utils[_0x05c0('0x2a')]();transfers[_0xbfb9cb[_0x05c0('0x49')]][_0x05c0('0x30')]=utils['now']();transfers[_0xbfb9cb['transfereeuniqueid']]['holdtime']=0x0;transfers[_0xbfb9cb[_0x05c0('0x49')]][_0x05c0('0x4a')]=0x2;}}else if(_0xbfb9cb[_0x05c0('0x44')]==_0xbfb9cb['secondtransfererlinkedid']){if(!_[_0x05c0('0x1d')](agents[_0xbfb9cb[_0x05c0('0x42')]])){utils[_0x05c0('0x1b')](util[_0x05c0('0x3')](_0x05c0('0x45'),_0xbfb9cb[_0x05c0('0x42')],agents[_0xbfb9cb[_0x05c0('0x42')]]['membername']));agents[_0xbfb9cb[_0x05c0('0x42')]][_0x05c0('0x46')]=!![];agents[_0xbfb9cb[_0x05c0('0x42')]][_0x05c0('0x47')]='ATTENDED';agents[_0xbfb9cb['origtransfereruniqueid']]['transferexten']=_0xbfb9cb[_0x05c0('0x4d')];agents[_0xbfb9cb[_0x05c0('0x42')]][_0x05c0('0x40')]=_0xbfb9cb[_0x05c0('0x44')];}if(_0xbfb9cb[_0x05c0('0x4e')]&&agents[_0xbfb9cb[_0x05c0('0x4e')]]){agents[_0xbfb9cb[_0x05c0('0x4e')]]['agententerreason']=0x1;transfers[_0xbfb9cb[_0x05c0('0x4e')]]=_[_0x05c0('0x4b')](agents[_0xbfb9cb[_0x05c0('0x4e')]]);transfers[_0xbfb9cb[_0x05c0('0x4e')]][_0x05c0('0x9')]=agents[_0xbfb9cb['origtransfereruniqueid']]['calleridnum'];transfers[_0xbfb9cb[_0x05c0('0x4e')]][_0x05c0('0x4c')]=agents[_0xbfb9cb['origtransfereruniqueid']][_0x05c0('0x4c')];transfers[_0xbfb9cb['transfertargetuniqueid']]['agentcalledAt']=utils[_0x05c0('0x2a')]();transfers[_0xbfb9cb[_0x05c0('0x4e')]][_0x05c0('0x30')]=utils['now']();transfers[_0xbfb9cb['transfertargetuniqueid']][_0x05c0('0x22')]=0x0;transfers[_0xbfb9cb[_0x05c0('0x4e')]][_0x05c0('0x4a')]=0x2;}}}catch(_0x5b39cb){utils['error'](util['format']('[%s][agents][attendedtransfer]',_0xbfb9cb['origtransfereruniqueid']),_0x5b39cb);}};exports[_0x05c0('0x4f')]=function(_0x4f43ae){try{utils['debug'](util['format'](_0x05c0('0x50'),_0x4f43ae[_0x05c0('0x5')]),_0x4f43ae);if(agents[_0x4f43ae[_0x05c0('0x5')]]&&agents[_0x4f43ae['uniqueid']][_0x05c0('0x21')]===_0x05c0('0x20')){if(_0x4f43ae['cause']==='21'){agents[_0x4f43ae[_0x05c0('0x5')]][_0x05c0('0x21')]=_0x05c0('0x51');agents[_0x4f43ae[_0x05c0('0x5')]]['lastevent']=_0x05c0('0x51');}utils[_0x05c0('0x1b')](util[_0x05c0('0x3')](_0x05c0('0x52'),_0x4f43ae[_0x05c0('0x5')],agents[_0x4f43ae['uniqueid']]['membername'],agents[_0x4f43ae[_0x05c0('0x5')]]['reason'],agents[_0x4f43ae[_0x05c0('0x5')]][_0x05c0('0x18')]));writeDB(agents[_0x4f43ae['uniqueid']]);var _0x3135bd=unanswered['indexOf'](_0x4f43ae['uniqueid']);if(_0x3135bd>-0x1){unanswered['splice'](_0x3135bd,0x1);}}if(transfers[_0x4f43ae['uniqueid']]){transfers[_0x4f43ae[_0x05c0('0x5')]][_0x05c0('0xf')]=!![];transfers[_0x4f43ae[_0x05c0('0x5')]][_0x05c0('0x37')]=utils['now']();transfers[_0x4f43ae[_0x05c0('0x5')]][_0x05c0('0x24')]=utils[_0x05c0('0x36')](transfers[_0x4f43ae[_0x05c0('0x5')]][_0x05c0('0x37')],transfers[_0x4f43ae['uniqueid']][_0x05c0('0x30')]);transfers[_0x4f43ae['uniqueid']]['reason']=_0x05c0('0x53');transfers[_0x4f43ae[_0x05c0('0x5')]][_0x05c0('0x18')]=_0x05c0('0x38');utils[_0x05c0('0x1b')](util[_0x05c0('0x3')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x4f43ae['uniqueid'],transfers[_0x4f43ae[_0x05c0('0x5')]][_0x05c0('0x7')],transfers[_0x4f43ae[_0x05c0('0x5')]]['reason'],transfers[_0x4f43ae[_0x05c0('0x5')]][_0x05c0('0x18')]));writeDB(transfers[_0x4f43ae[_0x05c0('0x5')]],!![]);}if(agents[_0x4f43ae[_0x05c0('0x5')]]&&agents[_0x4f43ae[_0x05c0('0x5')]][_0x05c0('0x30')]){agents[_0x4f43ae['uniqueid']][_0x05c0('0xf')]=!![];agents[_0x4f43ae[_0x05c0('0x5')]]['agentcompleteAt']=utils[_0x05c0('0x2a')]();agents[_0x4f43ae[_0x05c0('0x5')]]['talktime']=utils[_0x05c0('0x36')](agents[_0x4f43ae[_0x05c0('0x5')]][_0x05c0('0x37')],agents[_0x4f43ae[_0x05c0('0x5')]][_0x05c0('0x30')]);agents[_0x4f43ae[_0x05c0('0x5')]]['reason']=agents[_0x4f43ae[_0x05c0('0x5')]]['transfer']?_0x05c0('0x46'):_0x05c0('0x53');agents[_0x4f43ae[_0x05c0('0x5')]][_0x05c0('0x18')]=_0x05c0('0x38');utils[_0x05c0('0x1b')](util[_0x05c0('0x3')](_0x05c0('0x52'),_0x4f43ae[_0x05c0('0x5')],agents[_0x4f43ae[_0x05c0('0x5')]]['membername'],agents[_0x4f43ae[_0x05c0('0x5')]]['reason'],agents[_0x4f43ae[_0x05c0('0x5')]]['lastevent']));writeDB(agents[_0x4f43ae[_0x05c0('0x5')]]);}}catch(_0x36f82a){utils[_0x05c0('0x1c')](util[_0x05c0('0x3')](_0x05c0('0x50'),_0x4f43ae[_0x05c0('0x5')]),_0x36f82a);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index d672d58..a4df456 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 _0x4da5=['startsWith','cdr','split','substring','lastIndexOf','includes','hangup','noop','execif','gotoif','lastdata','util','./utils','./transfers.controller','FAILED','NO\x20ANSWER','ANSWERED','blinds','uniqueid','info','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','accountcode','getUserByInternal','then','request','CreateVoiceCallReport','recording','newchannel','format','[%s][calls][newchannel]','linkedid','[%s][calls][newchannel]\x20context:%s\x20exten:%s','exten','context','now','error','newstate','debug','[%s][calls][newstate]','isNil','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','channelstate','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','toNumber','[%s][calls][hangup]','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','callerid','cause-txt','endtime','duration','diffTime','starttime','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','transfertargetchannel','origtransfererchannel','userfield','_attended','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','[%s][calls][varset]','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','variable','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','lastapplication','Queue','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x4da5,0x1b7));var _0x54da=function(_0x1fcdeb,_0xe8ce8f){_0x1fcdeb=_0x1fcdeb-0x0;var _0x54c11a=_0x4da5[_0x1fcdeb];return _0x54c11a;};'use strict';var _=require('lodash');var util=require(_0x54da('0x0'));var utils=require(_0x54da('0x1'));var transfers=require(_0x54da('0x2'));var dispositions=['NO\x20ANSWER',_0x54da('0x3'),'FAILED',_0x54da('0x4'),_0x54da('0x4'),_0x54da('0x4'),_0x54da('0x5'),'BUSY',_0x54da('0x3'),_0x54da('0x3'),_0x54da('0x3')];var channels={};function writeDB(_0x1b2b5c){var _0x2fe7cc;if(transfers[_0x54da('0x6')][_0x1b2b5c[_0x54da('0x7')]]){_0x2fe7cc=_0x1b2b5c['uniqueid'];_0x1b2b5c[_0x54da('0x7')]=transfers[_0x54da('0x6')][_0x1b2b5c[_0x54da('0x7')]]['transfereeuniqueid'];}utils[_0x54da('0x8')](util['format']('[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x1b2b5c[_0x54da('0x7')],_0x1b2b5c[_0x54da('0x9')],_0x1b2b5c[_0x54da('0xa')],_0x1b2b5c[_0x54da('0xb')],_0x1b2b5c[_0x54da('0xc')],_0x1b2b5c[_0x54da('0xd')],_0x1b2b5c[_0x54da('0xe')],_0x1b2b5c[_0x54da('0xf')]));if(_0x1b2b5c[_0x54da('0x10')]){utils[_0x54da('0x11')](_0x1b2b5c[_0x54da('0x10')])[_0x54da('0x12')](function(_0x425756){if(_0x425756){_0x1b2b5c['UserId']=_0x425756['id'];}utils[_0x54da('0x13')](_0x54da('0x14'),_0x1b2b5c);});}else{utils[_0x54da('0x13')](_0x54da('0x14'),_0x1b2b5c);}if(channels[_0x1b2b5c['uniqueid']]){delete channels[_0x1b2b5c[_0x54da('0x7')]];}else if(_0x2fe7cc&&channels[_0x2fe7cc]){if(!transfers[_0x54da('0x6')][_0x2fe7cc][_0x54da('0x15')])delete transfers[_0x54da('0x6')][_0x2fe7cc];delete channels[_0x2fe7cc];}}exports[_0x54da('0x16')]=function(_0xf7bc1f){try{utils['debug'](util[_0x54da('0x17')](_0x54da('0x18'),_0xf7bc1f['uniqueid']),_0xf7bc1f);if(_0xf7bc1f[_0x54da('0x7')]==_0xf7bc1f[_0x54da('0x19')]&&_0xf7bc1f['channel']!='OutgoingSpoolFailed'){utils[_0x54da('0x8')](util['format'](_0x54da('0x1a'),_0xf7bc1f[_0x54da('0x7')],_0xf7bc1f['context'],_0xf7bc1f[_0x54da('0x1b')]));channels[_0xf7bc1f[_0x54da('0x7')]]={'uniqueid':_0xf7bc1f[_0x54da('0x7')],'accountcode':_0xf7bc1f[_0x54da('0x10')],'source':_0xf7bc1f[_0x54da('0xd')],'destination':_0xf7bc1f[_0x54da('0x1b')],'destinationcontext':_0xf7bc1f[_0x54da('0x1c')],'channel':_0xf7bc1f[_0x54da('0x9')],'starttime':utils[_0x54da('0x1d')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x54da('0x4'),'amaflags':'DOCUMENTATION'};}}catch(_0x17dfb8){utils[_0x54da('0x1e')](util[_0x54da('0x17')](_0x54da('0x18'),_0xf7bc1f[_0x54da('0x7')]),_0x17dfb8);}};exports[_0x54da('0x1f')]=function(_0x5839fc){try{utils[_0x54da('0x20')](util[_0x54da('0x17')](_0x54da('0x21'),_0x5839fc[_0x54da('0x7')]),_0x5839fc);if(!_[_0x54da('0x22')](channels[_0x5839fc[_0x54da('0x7')]])&&_0x5839fc['channelstate']==0x6){utils[_0x54da('0x8')](util['format'](_0x54da('0x23'),_0x5839fc[_0x54da('0x7')],_0x5839fc[_0x54da('0x1c')],_0x5839fc['channel']));if(_['isNil'](channels[_0x5839fc[_0x54da('0x7')]][_0x54da('0x24')])){channels[_0x5839fc[_0x54da('0x7')]]['systemanswertime']=utils[_0x54da('0x1d')]();}}else if(!_[_0x54da('0x22')](channels[_0x5839fc['linkedid']])&&_0x5839fc[_0x54da('0x25')]==0x6&&_0x5839fc[_0x54da('0x1c')]!=_0x54da('0x26')){utils['info'](util['format'](_0x54da('0x27'),_0x5839fc['uniqueid'],_0x5839fc[_0x54da('0x19')],_0x5839fc[_0x54da('0x1c')],_0x5839fc[_0x54da('0x9')]));channels[_0x5839fc[_0x54da('0x19')]][_0x54da('0x10')]=_0x5839fc[_0x54da('0x10')];channels[_0x5839fc[_0x54da('0x19')]][_0x54da('0x28')]=_0x5839fc['channel'];if(_[_0x54da('0x22')](channels[_0x5839fc[_0x54da('0x19')]]['answertime'])){channels[_0x5839fc['linkedid']][_0x54da('0x29')]=utils[_0x54da('0x1d')]();}channels[_0x5839fc[_0x54da('0x19')]][_0x54da('0x2a')]=dispositions[_[_0x54da('0x2b')](_0x5839fc[_0x54da('0x25')])]||_0x54da('0x5');}}catch(_0x4e0808){utils[_0x54da('0x1e')](util[_0x54da('0x17')](_0x54da('0x21'),_0x5839fc[_0x54da('0x7')]),_0x4e0808);}};exports['hangup']=function(_0x2d1fe8){try{if(!_[_0x54da('0x22')](channels[_0x2d1fe8['uniqueid']])){utils[_0x54da('0x20')](util[_0x54da('0x17')](_0x54da('0x2c'),_0x2d1fe8[_0x54da('0x7')]),_0x2d1fe8);if(_[_0x54da('0x22')](channels[_0x2d1fe8['uniqueid']]['callerid'])){channels[_0x2d1fe8[_0x54da('0x7')]]['callerid']=_0x2d1fe8['calleridname']+'\x20<'+_0x2d1fe8['calleridnum']+'>';}utils[_0x54da('0x8')](util[_0x54da('0x17')](_0x54da('0x2d'),_0x2d1fe8[_0x54da('0x7')],channels[_0x2d1fe8[_0x54da('0x7')]][_0x54da('0x2e')],_0x2d1fe8[_0x54da('0x2f')]));channels[_0x2d1fe8[_0x54da('0x7')]][_0x54da('0x30')]=utils[_0x54da('0x1d')]();channels[_0x2d1fe8[_0x54da('0x7')]][_0x54da('0x31')]=utils[_0x54da('0x32')](channels[_0x2d1fe8[_0x54da('0x7')]][_0x54da('0x30')],channels[_0x2d1fe8[_0x54da('0x7')]][_0x54da('0x33')]);channels[_0x2d1fe8[_0x54da('0x7')]]['billableseconds']=channels[_0x2d1fe8[_0x54da('0x7')]]['answertime']?utils[_0x54da('0x32')](channels[_0x2d1fe8['uniqueid']][_0x54da('0x30')],channels[_0x2d1fe8[_0x54da('0x7')]][_0x54da('0x29')]):0x0;writeDB(channels[_0x2d1fe8['uniqueid']]);}}catch(_0x2ea9eb){utils['error'](util[_0x54da('0x17')](_0x54da('0x2c'),_0x2d1fe8[_0x54da('0x7')]),_0x2ea9eb);}};exports['attendedtransfer']=function(_0x31678f){try{if(!_[_0x54da('0x22')](channels[_0x31678f[_0x54da('0x34')]])){utils[_0x54da('0x20')](util[_0x54da('0x17')](_0x54da('0x35'),_0x31678f[_0x54da('0x36')]),_0x31678f);if(channels[_0x31678f[_0x54da('0x34')]][_0x54da('0x9')]==_0x31678f['transfereechannel']){utils[_0x54da('0x8')](util[_0x54da('0x17')](_0x54da('0x37'),_0x31678f['origtransfereruniqueid'],_0x31678f[_0x54da('0x34')],_0x31678f['secondtransfererchannel']));channels[_0x31678f[_0x54da('0x34')]][_0x54da('0x28')]=_0x31678f['secondtransfererchannel'];channels[_0x31678f[_0x54da('0x34')]]['userfield']='_attended';}else if(channels[_0x31678f[_0x54da('0x34')]]['channel']=_0x31678f[_0x54da('0x38')]){utils['info'](util['format'](_0x54da('0x37'),_0x31678f[_0x54da('0x36')],_0x31678f[_0x54da('0x34')],_0x31678f[_0x54da('0x39')]));channels[_0x31678f[_0x54da('0x34')]]['destinationchannel']=_0x31678f[_0x54da('0x39')];channels[_0x31678f[_0x54da('0x34')]][_0x54da('0x3a')]=_0x54da('0x3b');}}}catch(_0x6c9741){utils[_0x54da('0x1e')](util['format'](_0x54da('0x35'),_0x31678f[_0x54da('0x36')]),_0x6c9741);}};exports[_0x54da('0x3c')]=function(_0x53ab6a){try{if(!_[_0x54da('0x22')](channels[_0x53ab6a['uniqueid']])){utils[_0x54da('0x20')](util[_0x54da('0x17')](_0x54da('0x3d'),_0x53ab6a['uniqueid']),_0x53ab6a);channels[_0x53ab6a[_0x54da('0x7')]][_0x54da('0x3e')]=utils[_0x54da('0x1d')]();utils[_0x54da('0x8')](util[_0x54da('0x17')](_0x54da('0x3f'),_0x53ab6a[_0x54da('0x7')],channels[_0x53ab6a['uniqueid']][_0x54da('0x3e')]));}}catch(_0xfd856d){utils[_0x54da('0x1e')](util[_0x54da('0x17')]('[%s][calls][musiconholdstart]',_0x53ab6a['uniqueid']),_0xfd856d);}};exports[_0x54da('0x40')]=function(_0x59aa1e){try{if(!_[_0x54da('0x22')](channels[_0x59aa1e['uniqueid']])){utils[_0x54da('0x20')](util['format'](_0x54da('0x41'),_0x59aa1e[_0x54da('0x7')]),_0x59aa1e);if(!_['isNil'](channels[_0x59aa1e[_0x54da('0x7')]][_0x54da('0x3e')])){channels[_0x59aa1e['uniqueid']]['mohtime']+=utils[_0x54da('0x32')](utils[_0x54da('0x1d')](),channels[_0x59aa1e[_0x54da('0x7')]][_0x54da('0x3e')]);utils[_0x54da('0x8')](util[_0x54da('0x17')](_0x54da('0x42'),_0x59aa1e['uniqueid'],channels[_0x59aa1e[_0x54da('0x7')]]['mohtime']));delete channels[_0x59aa1e[_0x54da('0x7')]][_0x54da('0x3e')];}}}catch(_0x201df3){utils[_0x54da('0x1e')](util[_0x54da('0x17')](_0x54da('0x41'),_0x59aa1e[_0x54da('0x7')]),_0x201df3);}};exports[_0x54da('0x43')]=function(_0x5f5af5){try{if(!_[_0x54da('0x22')](channels[_0x5f5af5[_0x54da('0x7')]])){utils[_0x54da('0x20')](util[_0x54da('0x17')](_0x54da('0x44'),_0x5f5af5[_0x54da('0x7')]),_0x5f5af5);if(!_['isNil'](_0x5f5af5['variable'][_0x54da('0x45')])){utils['info'](util[_0x54da('0x17')](_0x54da('0x46'),_0x5f5af5[_0x54da('0x7')],_0x5f5af5[_0x54da('0x47')]));channels[_0x5f5af5['uniqueid']][_0x54da('0x48')]=_0x5f5af5[_0x54da('0x47')];}if(!_[_0x54da('0x22')](_0x5f5af5[_0x54da('0x49')][_0x54da('0x4a')])){utils[_0x54da('0x8')](util[_0x54da('0x17')](_0x54da('0x4b'),_0x5f5af5[_0x54da('0x7')],_0x5f5af5['value']));channels[_0x5f5af5[_0x54da('0x7')]]['destination']=_0x5f5af5[_0x54da('0x47')];channels[_0x5f5af5[_0x54da('0x7')]][_0x54da('0x2e')]='\x22'+_0x5f5af5['value']+'\x22\x20<'+_0x5f5af5['value']+'>';}if(!_[_0x54da('0x22')](_0x5f5af5[_0x54da('0x49')][_0x54da('0x4c')])||!_[_0x54da('0x22')](_0x5f5af5['variable'][_0x54da('0x4d')])){utils['info'](util[_0x54da('0x17')](_0x54da('0x4e'),_0x5f5af5[_0x54da('0x7')],!_[_0x54da('0x22')](_0x5f5af5[_0x54da('0x49')]['xmd-callerid-preview'])?_0x54da('0x4c'):_0x54da('0x4d'),_0x5f5af5[_0x54da('0x47')]));channels[_0x5f5af5[_0x54da('0x7')]][_0x54da('0x2e')]=_0x5f5af5[_0x54da('0x47')];}if(!_[_0x54da('0x22')](_0x5f5af5[_0x54da('0x49')][_0x54da('0x4f')])||!_[_0x54da('0x22')](_0x5f5af5[_0x54da('0x49')][_0x54da('0x50')])){utils[_0x54da('0x8')](util[_0x54da('0x17')](_0x54da('0x4e'),_0x5f5af5[_0x54da('0x7')],!_['isNil'](_0x5f5af5[_0x54da('0x49')][_0x54da('0x4f')])?_0x54da('0x4f'):_0x54da('0x50'),_0x5f5af5['value']));channels[_0x5f5af5[_0x54da('0x7')]][_0x54da('0x51')]=_0x54da('0x52');channels[_0x5f5af5['uniqueid']]['lastdata']=_0x5f5af5['value'];channels[_0x5f5af5['uniqueid']]['queue']=!![];}if(!_['isNil'](_0x5f5af5[_0x54da('0x49')]['xmd-contactid'])){utils[_0x54da('0x8')](util[_0x54da('0x17')](_0x54da('0x53'),_0x5f5af5['uniqueid'],_0x5f5af5[_0x54da('0x47')]));channels[_0x5f5af5[_0x54da('0x7')]][_0x54da('0x54')]=_0x5f5af5[_0x54da('0x47')];}if(!_[_0x54da('0x22')](_0x5f5af5[_0x54da('0x49')][_0x54da('0x55')])){utils[_0x54da('0x8')](util[_0x54da('0x17')](_0x54da('0x56'),_0x5f5af5[_0x54da('0x7')],_0x5f5af5[_0x54da('0x47')]));channels[_0x5f5af5[_0x54da('0x7')]]['type']=_0x5f5af5[_0x54da('0x47')];}if(!_[_0x54da('0x22')](_0x5f5af5[_0x54da('0x49')]['outboundrouteid'])){utils[_0x54da('0x8')](util[_0x54da('0x17')]('[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s',_0x5f5af5[_0x54da('0x7')],_0x5f5af5['value']));channels[_0x5f5af5['uniqueid']]['routeid']=_0x5f5af5['value'];}if(!_[_0x54da('0x22')](_0x5f5af5[_0x54da('0x49')][_0x54da('0x57')])){utils[_0x54da('0x8')](util['format'](_0x54da('0x58'),_0x5f5af5[_0x54da('0x7')],_0x5f5af5[_0x54da('0x47')]));channels[_0x5f5af5[_0x54da('0x7')]]['sipcallid']=_0x5f5af5[_0x54da('0x47')];}}}catch(_0x30e79e){utils[_0x54da('0x1e')](util[_0x54da('0x17')](_0x54da('0x44'),_0x5f5af5[_0x54da('0x7')]),_0x30e79e);}};exports[_0x54da('0x59')]=function(_0x562583){try{if(!_['isNil'](channels[_0x562583[_0x54da('0x7')]])){utils[_0x54da('0x20')](util[_0x54da('0x17')](_0x54da('0x5a'),_0x562583[_0x54da('0x7')]),_0x562583);utils[_0x54da('0x8')](util[_0x54da('0x17')](_0x54da('0x5b'),_0x562583[_0x54da('0x7')],_0x562583[_0x54da('0x5c')],_0x562583[_0x54da('0x5d')]));if(_0x562583[_0x54da('0x5c')][_0x54da('0x5e')]()==_0x54da('0x5f')&&_[_0x54da('0x60')](_0x562583['appdata']['toLowerCase'](),_0x54da('0x61'))){var _0x4a19eb=_0x562583[_0x54da('0x5d')][_0x54da('0x62')]('=');var _0x2ad4a2=_0x4a19eb[0x0][_0x54da('0x63')](_0x4a19eb[0x0][_0x54da('0x64')]('(')+0x1,_0x4a19eb[0x0]['lastIndexOf'](')'));var _0x299abc=_0x4a19eb[0x1];channels[_0x562583['uniqueid']][_0x2ad4a2]=_0x299abc;}if(!_[_0x54da('0x65')]([_0x54da('0x66'),_0x54da('0x67'),_0x54da('0x68'),_0x54da('0x5f'),_0x54da('0x69')],_0x562583[_0x54da('0x5c')]['toLowerCase']())){channels[_0x562583[_0x54da('0x7')]][_0x54da('0x51')]=_0x562583[_0x54da('0x5c')];channels[_0x562583[_0x54da('0x7')]][_0x54da('0x6a')]=_0x562583[_0x54da('0x5d')];}}}catch(_0x1f6b06){utils[_0x54da('0x1e')](util[_0x54da('0x17')](_0x54da('0x5a'),_0x562583[_0x54da('0x7')]),_0x1f6b06);}}; \ No newline at end of file +var _0xb58d=['BUSY','uniqueid','transfereeuniqueid','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername','calleridnum','connectedlinenum','lastevent','accountcode','getUserByInternal','then','UserId','CreateVoiceCallReport','request','blinds','recording','debug','[%s][calls][newchannel]','linkedid','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','now','DOCUMENTATION','newstate','[%s][calls][newstate]','isNil','channelstate','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','error','hangup','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','diffTime','starttime','billableseconds','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','[%s][calls][musiconholdstart]','musiconholdstartAt','musiconholdstop','[%s][calls][musiconholdstop]','[%s][calls][musiconholdstop]\x20mohtime:%s','mohtime','varset','[%s][calls][varset]','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid','xmd-queue','xmcs-queue','lastapplication','lastdata','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','[%s][calls][newexten]','application','appdata','toLowerCase','set','startsWith','cdr','split','substring','lastIndexOf','includes','noop','execif','lodash','util','./utils','FAILED','NO\x20ANSWER','ANSWERED'];(function(_0x38ec25,_0x13728f){var _0x4d3243=function(_0x4fbfc2){while(--_0x4fbfc2){_0x38ec25['push'](_0x38ec25['shift']());}};_0x4d3243(++_0x13728f);}(_0xb58d,0x141));var _0xdb58=function(_0xe6d5ab,_0x1eb12a){_0xe6d5ab=_0xe6d5ab-0x0;var _0x236170=_0xb58d[_0xe6d5ab];return _0x236170;};'use strict';var _=require(_0xdb58('0x0'));var util=require(_0xdb58('0x1'));var utils=require(_0xdb58('0x2'));var transfers=require('./transfers.controller');var dispositions=['NO\x20ANSWER',_0xdb58('0x3'),'FAILED',_0xdb58('0x4'),'NO\x20ANSWER',_0xdb58('0x4'),_0xdb58('0x5'),_0xdb58('0x6'),_0xdb58('0x3'),'FAILED',_0xdb58('0x3')];var channels={};function writeDB(_0x540c0a){var _0x52a8f0;if(transfers['blinds'][_0x540c0a['uniqueid']]){_0x52a8f0=_0x540c0a[_0xdb58('0x7')];_0x540c0a[_0xdb58('0x7')]=transfers['blinds'][_0x540c0a[_0xdb58('0x7')]][_0xdb58('0x8')];}utils[_0xdb58('0x9')](util[_0xdb58('0xa')](_0xdb58('0xb'),_0x540c0a[_0xdb58('0x7')],_0x540c0a[_0xdb58('0xc')],_0x540c0a[_0xdb58('0xd')],_0x540c0a[_0xdb58('0xe')],_0x540c0a['interface'],_0x540c0a[_0xdb58('0xf')],_0x540c0a[_0xdb58('0x10')],_0x540c0a[_0xdb58('0x11')]));if(_0x540c0a[_0xdb58('0x12')]){utils[_0xdb58('0x13')](_0x540c0a[_0xdb58('0x12')])[_0xdb58('0x14')](function(_0x42ef06){if(_0x42ef06){_0x540c0a[_0xdb58('0x15')]=_0x42ef06['id'];}utils['request'](_0xdb58('0x16'),_0x540c0a);});}else{utils[_0xdb58('0x17')]('CreateVoiceCallReport',_0x540c0a);}if(channels[_0x540c0a['uniqueid']]){delete channels[_0x540c0a[_0xdb58('0x7')]];}else if(_0x52a8f0&&channels[_0x52a8f0]){if(!transfers[_0xdb58('0x18')][_0x52a8f0][_0xdb58('0x19')])delete transfers[_0xdb58('0x18')][_0x52a8f0];delete channels[_0x52a8f0];}}exports['newchannel']=function(_0x3bc697){try{utils[_0xdb58('0x1a')](util['format'](_0xdb58('0x1b'),_0x3bc697[_0xdb58('0x7')]),_0x3bc697);if(_0x3bc697[_0xdb58('0x7')]==_0x3bc697[_0xdb58('0x1c')]&&_0x3bc697[_0xdb58('0xc')]!='OutgoingSpoolFailed'){utils['info'](util[_0xdb58('0xa')](_0xdb58('0x1d'),_0x3bc697['uniqueid'],_0x3bc697[_0xdb58('0x1e')],_0x3bc697[_0xdb58('0x1f')]));channels[_0x3bc697[_0xdb58('0x7')]]={'uniqueid':_0x3bc697['uniqueid'],'accountcode':_0x3bc697[_0xdb58('0x12')],'source':_0x3bc697[_0xdb58('0xf')],'destination':_0x3bc697['exten'],'destinationcontext':_0x3bc697[_0xdb58('0x1e')],'channel':_0x3bc697[_0xdb58('0xc')],'starttime':utils[_0xdb58('0x20')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xdb58('0x4'),'amaflags':_0xdb58('0x21')};}}catch(_0x1707c4){utils['error'](util['format']('[%s][calls][newchannel]',_0x3bc697[_0xdb58('0x7')]),_0x1707c4);}};exports[_0xdb58('0x22')]=function(_0xe5be08){try{utils['debug'](util['format'](_0xdb58('0x23'),_0xe5be08['uniqueid']),_0xe5be08);if(!_[_0xdb58('0x24')](channels[_0xe5be08['uniqueid']])&&_0xe5be08[_0xdb58('0x25')]==0x6){utils['info'](util[_0xdb58('0xa')]('[%s][calls][newstate]\x20context:%s\x20channel:%s',_0xe5be08[_0xdb58('0x7')],_0xe5be08['context'],_0xe5be08['channel']));if(_[_0xdb58('0x24')](channels[_0xe5be08[_0xdb58('0x7')]][_0xdb58('0x26')])){channels[_0xe5be08[_0xdb58('0x7')]][_0xdb58('0x26')]=utils['now']();}}else if(!_[_0xdb58('0x24')](channels[_0xe5be08[_0xdb58('0x1c')]])&&_0xe5be08[_0xdb58('0x25')]==0x6&&_0xe5be08[_0xdb58('0x1e')]!=_0xdb58('0x27')){utils[_0xdb58('0x9')](util['format'](_0xdb58('0x28'),_0xe5be08['uniqueid'],_0xe5be08['linkedid'],_0xe5be08['context'],_0xe5be08[_0xdb58('0xc')]));channels[_0xe5be08['linkedid']][_0xdb58('0x12')]=_0xe5be08['accountcode'];channels[_0xe5be08['linkedid']][_0xdb58('0x29')]=_0xe5be08[_0xdb58('0xc')];if(_[_0xdb58('0x24')](channels[_0xe5be08[_0xdb58('0x1c')]][_0xdb58('0x2a')])){channels[_0xe5be08[_0xdb58('0x1c')]]['answertime']=utils[_0xdb58('0x20')]();}channels[_0xe5be08[_0xdb58('0x1c')]][_0xdb58('0x2b')]=dispositions[_['toNumber'](_0xe5be08[_0xdb58('0x25')])]||'ANSWERED';}}catch(_0x1c3246){utils[_0xdb58('0x2c')](util[_0xdb58('0xa')](_0xdb58('0x23'),_0xe5be08[_0xdb58('0x7')]),_0x1c3246);}};exports[_0xdb58('0x2d')]=function(_0x3ab7cc){try{if(!_['isNil'](channels[_0x3ab7cc[_0xdb58('0x7')]])){utils[_0xdb58('0x1a')](util[_0xdb58('0xa')](_0xdb58('0x2e'),_0x3ab7cc['uniqueid']),_0x3ab7cc);if(_[_0xdb58('0x24')](channels[_0x3ab7cc[_0xdb58('0x7')]][_0xdb58('0x2f')])){channels[_0x3ab7cc[_0xdb58('0x7')]]['callerid']=_0x3ab7cc[_0xdb58('0x30')]+'\x20<'+_0x3ab7cc[_0xdb58('0xf')]+'>';}utils['info'](util[_0xdb58('0xa')](_0xdb58('0x31'),_0x3ab7cc[_0xdb58('0x7')],channels[_0x3ab7cc[_0xdb58('0x7')]][_0xdb58('0x2f')],_0x3ab7cc[_0xdb58('0x32')]));channels[_0x3ab7cc['uniqueid']][_0xdb58('0x33')]=utils[_0xdb58('0x20')]();channels[_0x3ab7cc[_0xdb58('0x7')]]['duration']=utils[_0xdb58('0x34')](channels[_0x3ab7cc[_0xdb58('0x7')]][_0xdb58('0x33')],channels[_0x3ab7cc[_0xdb58('0x7')]][_0xdb58('0x35')]);channels[_0x3ab7cc[_0xdb58('0x7')]][_0xdb58('0x36')]=channels[_0x3ab7cc[_0xdb58('0x7')]]['answertime']?utils[_0xdb58('0x34')](channels[_0x3ab7cc[_0xdb58('0x7')]][_0xdb58('0x33')],channels[_0x3ab7cc[_0xdb58('0x7')]][_0xdb58('0x2a')]):0x0;writeDB(channels[_0x3ab7cc['uniqueid']]);}}catch(_0x1b7b0f){utils[_0xdb58('0x2c')](util[_0xdb58('0xa')]('[%s][calls][hangup]',_0x3ab7cc['uniqueid']),_0x1b7b0f);}};exports[_0xdb58('0x37')]=function(_0x18d18c){try{if(!_[_0xdb58('0x24')](channels[_0x18d18c[_0xdb58('0x38')]])){utils[_0xdb58('0x1a')](util['format'](_0xdb58('0x39'),_0x18d18c[_0xdb58('0x3a')]),_0x18d18c);if(channels[_0x18d18c['localtwolinkedid']][_0xdb58('0xc')]==_0x18d18c[_0xdb58('0x3b')]){utils['info'](util['format'](_0xdb58('0x3c'),_0x18d18c[_0xdb58('0x3a')],_0x18d18c['localtwolinkedid'],_0x18d18c[_0xdb58('0x3d')]));channels[_0x18d18c[_0xdb58('0x38')]]['destinationchannel']=_0x18d18c['secondtransfererchannel'];channels[_0x18d18c[_0xdb58('0x38')]][_0xdb58('0x3e')]=_0xdb58('0x3f');}else if(channels[_0x18d18c['localtwolinkedid']]['channel']=_0x18d18c[_0xdb58('0x40')]){utils[_0xdb58('0x9')](util[_0xdb58('0xa')](_0xdb58('0x3c'),_0x18d18c[_0xdb58('0x3a')],_0x18d18c['localtwolinkedid'],_0x18d18c[_0xdb58('0x41')]));channels[_0x18d18c[_0xdb58('0x38')]][_0xdb58('0x29')]=_0x18d18c[_0xdb58('0x41')];channels[_0x18d18c[_0xdb58('0x38')]][_0xdb58('0x3e')]=_0xdb58('0x3f');}}}catch(_0x2443a4){utils[_0xdb58('0x2c')](util[_0xdb58('0xa')](_0xdb58('0x39'),_0x18d18c[_0xdb58('0x3a')]),_0x2443a4);}};exports['musiconholdstart']=function(_0x125259){try{if(!_[_0xdb58('0x24')](channels[_0x125259['uniqueid']])){utils['debug'](util[_0xdb58('0xa')](_0xdb58('0x42'),_0x125259[_0xdb58('0x7')]),_0x125259);channels[_0x125259[_0xdb58('0x7')]][_0xdb58('0x43')]=utils['now']();utils[_0xdb58('0x9')](util[_0xdb58('0xa')]('[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s',_0x125259[_0xdb58('0x7')],channels[_0x125259[_0xdb58('0x7')]][_0xdb58('0x43')]));}}catch(_0x14664b){utils[_0xdb58('0x2c')](util['format']('[%s][calls][musiconholdstart]',_0x125259[_0xdb58('0x7')]),_0x14664b);}};exports[_0xdb58('0x44')]=function(_0x52d67b){try{if(!_[_0xdb58('0x24')](channels[_0x52d67b[_0xdb58('0x7')]])){utils[_0xdb58('0x1a')](util['format'](_0xdb58('0x45'),_0x52d67b[_0xdb58('0x7')]),_0x52d67b);if(!_[_0xdb58('0x24')](channels[_0x52d67b['uniqueid']]['musiconholdstartAt'])){channels[_0x52d67b[_0xdb58('0x7')]]['mohtime']+=utils['diffTime'](utils['now'](),channels[_0x52d67b['uniqueid']][_0xdb58('0x43')]);utils['info'](util['format'](_0xdb58('0x46'),_0x52d67b[_0xdb58('0x7')],channels[_0x52d67b[_0xdb58('0x7')]][_0xdb58('0x47')]));delete channels[_0x52d67b[_0xdb58('0x7')]][_0xdb58('0x43')];}}}catch(_0x46b78c){utils[_0xdb58('0x2c')](util[_0xdb58('0xa')]('[%s][calls][musiconholdstop]',_0x52d67b[_0xdb58('0x7')]),_0x46b78c);}};exports[_0xdb58('0x48')]=function(_0x4e0e00){try{if(!_[_0xdb58('0x24')](channels[_0x4e0e00[_0xdb58('0x7')]])){utils[_0xdb58('0x1a')](util[_0xdb58('0xa')](_0xdb58('0x49'),_0x4e0e00[_0xdb58('0x7')]),_0x4e0e00);if(!_[_0xdb58('0x24')](_0x4e0e00[_0xdb58('0x4a')][_0xdb58('0x4b')])){utils[_0xdb58('0x9')](util[_0xdb58('0xa')](_0xdb58('0x4c'),_0x4e0e00['uniqueid'],_0x4e0e00[_0xdb58('0x4d')]));channels[_0x4e0e00[_0xdb58('0x7')]][_0xdb58('0x4e')]=_0x4e0e00[_0xdb58('0x4d')];}if(!_['isNil'](_0x4e0e00[_0xdb58('0x4a')][_0xdb58('0x4f')])){utils[_0xdb58('0x9')](util[_0xdb58('0xa')](_0xdb58('0x50'),_0x4e0e00['uniqueid'],_0x4e0e00['value']));channels[_0x4e0e00[_0xdb58('0x7')]][_0xdb58('0x51')]=_0x4e0e00[_0xdb58('0x4d')];channels[_0x4e0e00['uniqueid']][_0xdb58('0x2f')]='\x22'+_0x4e0e00[_0xdb58('0x4d')]+_0xdb58('0x52')+_0x4e0e00[_0xdb58('0x4d')]+'>';}if(!_[_0xdb58('0x24')](_0x4e0e00[_0xdb58('0x4a')]['xmd-callerid-preview'])||!_[_0xdb58('0x24')](_0x4e0e00[_0xdb58('0x4a')]['xmd-callerid'])){utils['info'](util[_0xdb58('0xa')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x4e0e00[_0xdb58('0x7')],!_[_0xdb58('0x24')](_0x4e0e00[_0xdb58('0x4a')]['xmd-callerid-preview'])?'xmd-callerid-preview':_0xdb58('0x53'),_0x4e0e00['value']));channels[_0x4e0e00['uniqueid']]['callerid']=_0x4e0e00[_0xdb58('0x4d')];}if(!_[_0xdb58('0x24')](_0x4e0e00[_0xdb58('0x4a')]['xmd-queue'])||!_[_0xdb58('0x24')](_0x4e0e00[_0xdb58('0x4a')]['xmcs-queue'])){utils['info'](util['format']('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x4e0e00[_0xdb58('0x7')],!_[_0xdb58('0x24')](_0x4e0e00['variable'][_0xdb58('0x54')])?_0xdb58('0x54'):_0xdb58('0x55'),_0x4e0e00[_0xdb58('0x4d')]));channels[_0x4e0e00[_0xdb58('0x7')]][_0xdb58('0x56')]='Queue';channels[_0x4e0e00['uniqueid']][_0xdb58('0x57')]=_0x4e0e00[_0xdb58('0x4d')];channels[_0x4e0e00[_0xdb58('0x7')]][_0xdb58('0xd')]=!![];}if(!_[_0xdb58('0x24')](_0x4e0e00[_0xdb58('0x4a')]['xmd-contactid'])){utils[_0xdb58('0x9')](util['format'](_0xdb58('0x58'),_0x4e0e00[_0xdb58('0x7')],_0x4e0e00[_0xdb58('0x4d')]));channels[_0x4e0e00['uniqueid']][_0xdb58('0x59')]=_0x4e0e00[_0xdb58('0x4d')];}if(!_[_0xdb58('0x24')](_0x4e0e00[_0xdb58('0x4a')][_0xdb58('0x5a')])){utils[_0xdb58('0x9')](util['format'](_0xdb58('0x5b'),_0x4e0e00[_0xdb58('0x7')],_0x4e0e00[_0xdb58('0x4d')]));channels[_0x4e0e00[_0xdb58('0x7')]][_0xdb58('0x5c')]=_0x4e0e00[_0xdb58('0x4d')];}if(!_[_0xdb58('0x24')](_0x4e0e00[_0xdb58('0x4a')]['outboundrouteid'])){utils[_0xdb58('0x9')](util[_0xdb58('0xa')](_0xdb58('0x5d'),_0x4e0e00[_0xdb58('0x7')],_0x4e0e00[_0xdb58('0x4d')]));channels[_0x4e0e00['uniqueid']]['routeid']=_0x4e0e00[_0xdb58('0x4d')];}if(!_[_0xdb58('0x24')](_0x4e0e00[_0xdb58('0x4a')][_0xdb58('0x5e')])){utils['info'](util['format'](_0xdb58('0x5f'),_0x4e0e00['uniqueid'],_0x4e0e00[_0xdb58('0x4d')]));channels[_0x4e0e00[_0xdb58('0x7')]][_0xdb58('0x5e')]=_0x4e0e00[_0xdb58('0x4d')];}}}catch(_0x9fa3ce){utils[_0xdb58('0x2c')](util[_0xdb58('0xa')](_0xdb58('0x49'),_0x4e0e00[_0xdb58('0x7')]),_0x9fa3ce);}};exports['newexten']=function(_0x38e135){try{if(!_[_0xdb58('0x24')](channels[_0x38e135['uniqueid']])){utils[_0xdb58('0x1a')](util[_0xdb58('0xa')](_0xdb58('0x60'),_0x38e135[_0xdb58('0x7')]),_0x38e135);utils[_0xdb58('0x9')](util[_0xdb58('0xa')]('[%s][calls][newexten]\x20application:%s\x20appdata:%s',_0x38e135[_0xdb58('0x7')],_0x38e135[_0xdb58('0x61')],_0x38e135[_0xdb58('0x62')]));if(_0x38e135[_0xdb58('0x61')][_0xdb58('0x63')]()==_0xdb58('0x64')&&_[_0xdb58('0x65')](_0x38e135[_0xdb58('0x62')][_0xdb58('0x63')](),_0xdb58('0x66'))){var _0x41bca3=_0x38e135[_0xdb58('0x62')][_0xdb58('0x67')]('=');var _0x13eecc=_0x41bca3[0x0][_0xdb58('0x68')](_0x41bca3[0x0][_0xdb58('0x69')]('(')+0x1,_0x41bca3[0x0][_0xdb58('0x69')](')'));var _0x4c9012=_0x41bca3[0x1];channels[_0x38e135[_0xdb58('0x7')]][_0x13eecc]=_0x4c9012;}if(!_[_0xdb58('0x6a')](['hangup',_0xdb58('0x6b'),_0xdb58('0x6c'),'set','gotoif'],_0x38e135[_0xdb58('0x61')][_0xdb58('0x63')]())){channels[_0x38e135[_0xdb58('0x7')]][_0xdb58('0x56')]=_0x38e135['application'];channels[_0x38e135[_0xdb58('0x7')]][_0xdb58('0x57')]=_0x38e135['appdata'];}}}catch(_0x3a2abf){utils['error'](util['format']('[%s][calls][newexten]',_0x38e135[_0xdb58('0x7')]),_0x3a2abf);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 441ee46..d6c5c32 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 _0xd866=['fullybooted','[core]\x20fullybooted','error','close','[core]\x20close','managerevent','connect','[core]\x20connected','info','[core]\x20shutdown'];(function(_0x54f33a,_0x4ddf56){var _0x55c3a5=function(_0x112bec){while(--_0x112bec){_0x54f33a['push'](_0x54f33a['shift']());}};_0x55c3a5(++_0x4ddf56);}(_0xd866,0x1d2));var _0x6d86=function(_0x770f7,_0x3af003){_0x770f7=_0x770f7-0x0;var _0xe797c6=_0xd866[_0x770f7];return _0xe797c6;};'use strict';var utils=require('./utils');exports[_0x6d86('0x0')]=function(){utils['info'](_0x6d86('0x1'));};exports['shutdown']=function(){utils[_0x6d86('0x2')](_0x6d86('0x3'));};exports[_0x6d86('0x4')]=function(){utils[_0x6d86('0x2')](_0x6d86('0x5'));};exports[_0x6d86('0x6')]=function(_0x4f982f){utils[_0x6d86('0x6')]('[core]\x20error',_0x4f982f);};exports[_0x6d86('0x7')]=function(){utils[_0x6d86('0x2')](_0x6d86('0x8'));};exports[_0x6d86('0x9')]=function(_0x234d79){}; \ No newline at end of file +var _0xf925=['close','[core]\x20close','managerevent','./utils','connect','info','[core]\x20connected','shutdown','[core]\x20shutdown','fullybooted'];(function(_0x174e6b,_0x124a26){var _0x10ab0e=function(_0x704225){while(--_0x704225){_0x174e6b['push'](_0x174e6b['shift']());}};_0x10ab0e(++_0x124a26);}(_0xf925,0x157));var _0x5f92=function(_0x26394d,_0x547eea){_0x26394d=_0x26394d-0x0;var _0x5c7861=_0xf925[_0x26394d];return _0x5c7861;};'use strict';var utils=require(_0x5f92('0x0'));exports[_0x5f92('0x1')]=function(){utils[_0x5f92('0x2')](_0x5f92('0x3'));};exports[_0x5f92('0x4')]=function(){utils[_0x5f92('0x2')](_0x5f92('0x5'));};exports[_0x5f92('0x6')]=function(){utils[_0x5f92('0x2')]('[core]\x20fullybooted');};exports['error']=function(_0xb95ab7){utils['error']('[core]\x20error',_0xb95ab7);};exports[_0x5f92('0x7')]=function(){utils[_0x5f92('0x2')](_0x5f92('0x8'));};exports[_0x5f92('0x9')]=function(_0x250a98){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index ede766c..49620a3 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 _0x4183=['now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','[%s][dials][dialend]','ANSWER','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]','calleridname','cause-txt','assign','complete','duration','diffTime','endtime','billableseconds','util','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring','calleridnum','connectedlinenum','dialstatus','newexten','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','toLowerCase','set','startsWith','cdr(routeid)','appdata','split','error','debug','[%s][dials][varset]','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','[%s][dials][dialbegin]','starttime'];(function(_0x20cf8a,_0x44cd6b){var _0x54e165=function(_0xcce1d0){while(--_0xcce1d0){_0x20cf8a['push'](_0x20cf8a['shift']());}};_0x54e165(++_0x44cd6b);}(_0x4183,0x77));var _0x3418=function(_0x2707f4,_0x4c8b90){_0x2707f4=_0x2707f4-0x0;var _0x10122d=_0x4183[_0x2707f4];return _0x10122d;};'use strict';var _=require('lodash');var util=require(_0x3418('0x0'));var utils=require('./utils');var dials={};function writeDB(_0x5e8972){utils[_0x3418('0x1')](util[_0x3418('0x2')](_0x3418('0x3'),_0x5e8972[_0x3418('0x4')],_0x5e8972[_0x3418('0x5')],_0x5e8972[_0x3418('0x6')],_0x5e8972[_0x3418('0x7')],_0x5e8972[_0x3418('0x8')],_0x5e8972[_0x3418('0x9')]));utils['request']('CreateVoiceDialReport',_0x5e8972);delete dials[_0x5e8972[_0x3418('0x4')]];}exports[_0x3418('0xa')]=function(_0x291b05){try{utils['debug'](util['format'](_0x3418('0xb'),_0x291b05[_0x3418('0x4')]),_0x291b05);utils[_0x3418('0x1')](util[_0x3418('0x2')](_0x3418('0xc'),_0x291b05[_0x3418('0x4')],_0x291b05['application'],_0x291b05['appdata']));if(_0x291b05['application'][_0x3418('0xd')]()==_0x3418('0xe')&&_[_0x3418('0xf')](_0x291b05['appdata'][_0x3418('0xd')](),_0x3418('0x10'))){var _0x20f744=_0x291b05[_0x3418('0x11')][_0x3418('0x12')]('=');dials[_0x291b05['uniqueid']]={'routeId':_0x20f744[0x1]};}}catch(_0x1cca4c){utils[_0x3418('0x13')](util[_0x3418('0x2')](_0x3418('0xb'),_0x291b05['uniqueid']),_0x1cca4c);}};exports['varset']=function(_0x58b9c2){try{utils[_0x3418('0x14')](util[_0x3418('0x2')](_0x3418('0x15'),_0x58b9c2['uniqueid']),_0x58b9c2);if(!_[_0x3418('0x16')](_0x58b9c2[_0x3418('0x17')][_0x3418('0x18')])){utils['info'](util[_0x3418('0x2')](_0x3418('0x19'),_0x58b9c2[_0x3418('0x4')],_0x58b9c2['value']));dials[_0x58b9c2[_0x3418('0x4')]]={'routeId':_0x58b9c2['value']};}}catch(_0x32484b){utils[_0x3418('0x13')](util[_0x3418('0x2')](_0x3418('0x15'),_0x58b9c2[_0x3418('0x4')]),_0x32484b);}};exports['dialbegin']=function(_0x323ea0){try{if(!_['isNil'](dials[_0x323ea0[_0x3418('0x4')]])){utils[_0x3418('0x14')](util[_0x3418('0x2')](_0x3418('0x1a'),_0x323ea0[_0x3418('0x4')]),_0x323ea0);dials[_0x323ea0[_0x3418('0x4')]]=_['assign'](dials[_0x323ea0[_0x3418('0x4')]],_0x323ea0);dials[_0x323ea0[_0x3418('0x4')]][_0x3418('0x1b')]=utils[_0x3418('0x1c')]();dials[_0x323ea0[_0x3418('0x4')]][_0x3418('0x1d')]=_0x3418('0x1e');utils[_0x3418('0x1')](util['format'](_0x3418('0x1f'),_0x323ea0[_0x3418('0x4')],dials[_0x323ea0['uniqueid']][_0x3418('0x1b')]));}}catch(_0x5a7596){utils['error'](util['format'](_0x3418('0x1a'),_0x323ea0[_0x3418('0x4')]),_0x5a7596);}};exports[_0x3418('0x20')]=function(_0x519d67){try{if(!_[_0x3418('0x16')](dials[_0x519d67[_0x3418('0x4')]])){utils[_0x3418('0x14')](util['format'](_0x3418('0x21'),_0x519d67[_0x3418('0x4')]),_0x519d67);dials[_0x519d67['uniqueid']]['dialstatus']=_0x519d67[_0x3418('0x9')];if(_0x519d67[_0x3418('0x9')]==_0x3418('0x22')){dials[_0x519d67['uniqueid']]=_['assign'](dials[_0x519d67[_0x3418('0x4')]],_0x519d67);dials[_0x519d67[_0x3418('0x4')]][_0x3418('0x23')]=utils['now']();dials[_0x519d67['uniqueid']][_0x3418('0x1d')]=_0x3418('0x24');utils[_0x3418('0x1')](util[_0x3418('0x2')](_0x3418('0x25'),_0x519d67[_0x3418('0x4')],_0x519d67[_0x3418('0x9')],dials[_0x519d67['uniqueid']][_0x3418('0x23')]));}else{utils[_0x3418('0x1')](util[_0x3418('0x2')](_0x3418('0x26'),_0x519d67[_0x3418('0x4')],_0x519d67['dialstatus']));}}}catch(_0x4b4486){utils[_0x3418('0x13')](util[_0x3418('0x2')]('[%s][dials][dialend]',_0x519d67[_0x3418('0x4')]),_0x4b4486);}};exports[_0x3418('0x27')]=function(_0x59b572){try{if(!_[_0x3418('0x16')](dials[_0x59b572[_0x3418('0x4')]])){utils[_0x3418('0x14')](util[_0x3418('0x2')](_0x3418('0x28'),_0x59b572[_0x3418('0x4')]),_0x59b572);utils[_0x3418('0x1')](util[_0x3418('0x2')]('[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s',_0x59b572[_0x3418('0x4')],_0x59b572[_0x3418('0x7')],_0x59b572[_0x3418('0x29')],_0x59b572[_0x3418('0x2a')]));dials[_0x59b572[_0x3418('0x4')]]=_[_0x3418('0x2b')](dials[_0x59b572['uniqueid']],{'endtime':utils[_0x3418('0x1c')](),'lastevent':_0x3418('0x2c')});dials[_0x59b572[_0x3418('0x4')]][_0x3418('0x2d')]=utils[_0x3418('0x2e')](dials[_0x59b572[_0x3418('0x4')]]['endtime'],dials[_0x59b572[_0x3418('0x4')]][_0x3418('0x1b')]);dials[_0x59b572[_0x3418('0x4')]]['holdtime']=utils[_0x3418('0x2e')](dials[_0x59b572['uniqueid']][_0x3418('0x23')]||dials[_0x59b572[_0x3418('0x4')]][_0x3418('0x2f')],dials[_0x59b572['uniqueid']]['starttime']);dials[_0x59b572[_0x3418('0x4')]][_0x3418('0x30')]=dials[_0x59b572[_0x3418('0x4')]]['answertime']?utils[_0x3418('0x2e')](dials[_0x59b572[_0x3418('0x4')]][_0x3418('0x2f')],dials[_0x59b572[_0x3418('0x4')]][_0x3418('0x23')]):0x0;writeDB(dials[_0x59b572[_0x3418('0x4')]]);}}catch(_0x211dfa){utils[_0x3418('0x13')](util[_0x3418('0x2')]('[%s][dials][hangup]',_0x59b572[_0x3418('0x4')]),_0x211dfa);}}; \ No newline at end of file +var _0x413f=['now','lastevent','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','starttime','[%s][dials][dialbegin]','dialend','ANSWER','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','[%s][dials][dialend]','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','complete','duration','diffTime','endtime','billableseconds','lodash','util','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','dialstring','calleridnum','connectedlinenum','dialstatus','request','newexten','debug','[%s][dials][newexten]','uniqueid','[%s][dials][newexten]\x20application:%s\x20appdata:%s','appdata','application','toLowerCase','set','startsWith','cdr(routeid)','split','error','varset','isNil','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','dialbegin','assign'];(function(_0x9307ea,_0x38968a){var _0x295554=function(_0x342dcf){while(--_0x342dcf){_0x9307ea['push'](_0x9307ea['shift']());}};_0x295554(++_0x38968a);}(_0x413f,0x115));var _0xf413=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x413f[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0xf413('0x0'));var util=require(_0xf413('0x1'));var utils=require('./utils');var dials={};function writeDB(_0x25b3a9){utils[_0xf413('0x2')](util[_0xf413('0x3')](_0xf413('0x4'),_0x25b3a9['uniqueid'],_0x25b3a9['channel'],_0x25b3a9[_0xf413('0x5')],_0x25b3a9[_0xf413('0x6')],_0x25b3a9[_0xf413('0x7')],_0x25b3a9[_0xf413('0x8')]));utils[_0xf413('0x9')]('CreateVoiceDialReport',_0x25b3a9);delete dials[_0x25b3a9['uniqueid']];}exports[_0xf413('0xa')]=function(_0x3032e4){try{utils[_0xf413('0xb')](util[_0xf413('0x3')](_0xf413('0xc'),_0x3032e4[_0xf413('0xd')]),_0x3032e4);utils[_0xf413('0x2')](util[_0xf413('0x3')](_0xf413('0xe'),_0x3032e4[_0xf413('0xd')],_0x3032e4['application'],_0x3032e4[_0xf413('0xf')]));if(_0x3032e4[_0xf413('0x10')][_0xf413('0x11')]()==_0xf413('0x12')&&_[_0xf413('0x13')](_0x3032e4['appdata'][_0xf413('0x11')](),_0xf413('0x14'))){var _0x306efd=_0x3032e4['appdata'][_0xf413('0x15')]('=');dials[_0x3032e4[_0xf413('0xd')]]={'routeId':_0x306efd[0x1]};}}catch(_0x8df710){utils[_0xf413('0x16')](util[_0xf413('0x3')](_0xf413('0xc'),_0x3032e4[_0xf413('0xd')]),_0x8df710);}};exports[_0xf413('0x17')]=function(_0x422e75){try{utils[_0xf413('0xb')](util[_0xf413('0x3')]('[%s][dials][varset]',_0x422e75[_0xf413('0xd')]),_0x422e75);if(!_[_0xf413('0x18')](_0x422e75['variable'][_0xf413('0x19')])){utils[_0xf413('0x2')](util[_0xf413('0x3')](_0xf413('0x1a'),_0x422e75[_0xf413('0xd')],_0x422e75['value']));dials[_0x422e75[_0xf413('0xd')]]={'routeId':_0x422e75['value']};}}catch(_0x37ee13){utils['error'](util['format']('[%s][dials][varset]',_0x422e75[_0xf413('0xd')]),_0x37ee13);}};exports[_0xf413('0x1b')]=function(_0x409354){try{if(!_[_0xf413('0x18')](dials[_0x409354[_0xf413('0xd')]])){utils[_0xf413('0xb')](util['format']('[%s][dials][dialbegin]',_0x409354[_0xf413('0xd')]),_0x409354);dials[_0x409354[_0xf413('0xd')]]=_[_0xf413('0x1c')](dials[_0x409354[_0xf413('0xd')]],_0x409354);dials[_0x409354[_0xf413('0xd')]]['starttime']=utils[_0xf413('0x1d')]();dials[_0x409354['uniqueid']][_0xf413('0x1e')]='called';utils[_0xf413('0x2')](util[_0xf413('0x3')](_0xf413('0x1f'),_0x409354[_0xf413('0xd')],dials[_0x409354[_0xf413('0xd')]][_0xf413('0x20')]));}}catch(_0x53c87d){utils[_0xf413('0x16')](util[_0xf413('0x3')](_0xf413('0x21'),_0x409354[_0xf413('0xd')]),_0x53c87d);}};exports[_0xf413('0x22')]=function(_0x39b4f7){try{if(!_[_0xf413('0x18')](dials[_0x39b4f7['uniqueid']])){utils['debug'](util[_0xf413('0x3')]('[%s][dials][dialend]',_0x39b4f7['uniqueid']),_0x39b4f7);dials[_0x39b4f7[_0xf413('0xd')]][_0xf413('0x8')]=_0x39b4f7[_0xf413('0x8')];if(_0x39b4f7['dialstatus']==_0xf413('0x23')){dials[_0x39b4f7[_0xf413('0xd')]]=_[_0xf413('0x1c')](dials[_0x39b4f7[_0xf413('0xd')]],_0x39b4f7);dials[_0x39b4f7['uniqueid']][_0xf413('0x24')]=utils['now']();dials[_0x39b4f7[_0xf413('0xd')]]['lastevent']=_0xf413('0x25');utils[_0xf413('0x2')](util[_0xf413('0x3')](_0xf413('0x26'),_0x39b4f7['uniqueid'],_0x39b4f7['dialstatus'],dials[_0x39b4f7[_0xf413('0xd')]][_0xf413('0x24')]));}else{utils[_0xf413('0x2')](util[_0xf413('0x3')](_0xf413('0x27'),_0x39b4f7[_0xf413('0xd')],_0x39b4f7[_0xf413('0x8')]));}}}catch(_0x2ef23c){utils[_0xf413('0x16')](util[_0xf413('0x3')](_0xf413('0x28'),_0x39b4f7['uniqueid']),_0x2ef23c);}};exports[_0xf413('0x29')]=function(_0x202174){try{if(!_['isNil'](dials[_0x202174[_0xf413('0xd')]])){utils[_0xf413('0xb')](util[_0xf413('0x3')](_0xf413('0x2a'),_0x202174[_0xf413('0xd')]),_0x202174);utils[_0xf413('0x2')](util[_0xf413('0x3')](_0xf413('0x2b'),_0x202174[_0xf413('0xd')],_0x202174[_0xf413('0x6')],_0x202174[_0xf413('0x2c')],_0x202174[_0xf413('0x2d')]));dials[_0x202174[_0xf413('0xd')]]=_['assign'](dials[_0x202174[_0xf413('0xd')]],{'endtime':utils[_0xf413('0x1d')](),'lastevent':_0xf413('0x2e')});dials[_0x202174[_0xf413('0xd')]][_0xf413('0x2f')]=utils[_0xf413('0x30')](dials[_0x202174[_0xf413('0xd')]][_0xf413('0x31')],dials[_0x202174[_0xf413('0xd')]][_0xf413('0x20')]);dials[_0x202174[_0xf413('0xd')]]['holdtime']=utils['diffTime'](dials[_0x202174[_0xf413('0xd')]]['answertime']||dials[_0x202174['uniqueid']][_0xf413('0x31')],dials[_0x202174[_0xf413('0xd')]]['starttime']);dials[_0x202174['uniqueid']][_0xf413('0x32')]=dials[_0x202174['uniqueid']][_0xf413('0x24')]?utils['diffTime'](dials[_0x202174[_0xf413('0xd')]][_0xf413('0x31')],dials[_0x202174['uniqueid']][_0xf413('0x24')]):0x0;writeDB(dials[_0x202174[_0xf413('0xd')]]);}}catch(_0x398a5d){utils[_0xf413('0x16')](util[_0xf413('0x3')]('[%s][dials][hangup]',_0x202174['uniqueid']),_0x398a5d);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 4e9ed7d..811ca48 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 _0xf3fd=['[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','[%s][index][musiconholdstart]','musiconholdstart','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','xdr','disabled','production','local','port','asterisk','username','password','keepConnected','info','XDR\x20DISABLED','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./dials.controller','./transfers.controller','connect','fullybooted','error','close','managerevent','devicestatechange','format','[%s][index][devicestatechange]','device','agentcalled','[%s][index][agentcalled]','uniqueid','agentringnoanswer','debug'];(function(_0x6f050b,_0xdd2d31){var _0x771d46=function(_0x35d806){while(--_0x35d806){_0x6f050b['push'](_0x6f050b['shift']());}};_0x771d46(++_0xdd2d31);}(_0xf3fd,0x1c0));var _0xdf3f=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xf3fd[_0x5ddb1c];return _0x354adc;};var AsteriskManager=require(_0xdf3f('0x0'));var config=require(_0xdf3f('0x1'));var utils=require(_0xdf3f('0x2'));var util=require('util');var isXDREnabled=config[_0xdf3f('0x3')]&&config[_0xdf3f('0x3')][_0xdf3f('0x4')]?!config[_0xdf3f('0x3')][_0xdf3f('0x4')]:!![];var isProduction=config['env']===_0xdf3f('0x5')||![];var isLocalAsterisk=config[_0xdf3f('0x3')]&&config[_0xdf3f('0x3')][_0xdf3f('0x6')]===!![]||![];var ami=new AsteriskManager(config['asterisk'][_0xdf3f('0x7')],config[_0xdf3f('0x8')]['ip'],config['asterisk'][_0xdf3f('0x9')],config[_0xdf3f('0x8')][_0xdf3f('0xa')],!![]);ami[_0xdf3f('0xb')]();if(!isXDREnabled){utils[_0xdf3f('0xc')](_0xdf3f('0xd'));}else if(!isProduction&&!isLocalAsterisk){utils[_0xdf3f('0xc')](_0xdf3f('0xe'));}else{var agents=require(_0xdf3f('0xf'));var calls=require(_0xdf3f('0x10'));var queues=require(_0xdf3f('0x11'));var recordings=require(_0xdf3f('0x12'));var members=require('./members.controller');var dials=require(_0xdf3f('0x13'));var transfers=require(_0xdf3f('0x14'));var core=require('./core.controller');ami['on'](_0xdf3f('0x15'),core[_0xdf3f('0x15')]);ami['on']('shutdown',core['shutdown']);ami['on'](_0xdf3f('0x16'),core[_0xdf3f('0x16')]);ami['on'](_0xdf3f('0x17'),core['error']);ami['on'](_0xdf3f('0x18'),core[_0xdf3f('0x18')]);ami['on'](_0xdf3f('0x19'),core['managerevent']);ami['on'](_0xdf3f('0x1a'),function(_0x28b655){try{utils['debug'](util[_0xdf3f('0x1b')](_0xdf3f('0x1c'),_0x28b655[_0xdf3f('0x1d')]),_0x28b655);members[_0xdf3f('0x1a')](_0x28b655);}catch(_0x3ee2a2){utils[_0xdf3f('0x17')](util['format'](_0xdf3f('0x1c'),_0x28b655[_0xdf3f('0x1d')]),_0x3ee2a2);}});ami['on'](_0xdf3f('0x1e'),function(_0x3ca530){try{utils['debug'](util['format'](_0xdf3f('0x1f'),_0x3ca530[_0xdf3f('0x20')]),_0x3ca530);agents[_0xdf3f('0x1e')](_0x3ca530);}catch(_0x1f1e34){utils[_0xdf3f('0x17')](util['format'](_0xdf3f('0x1f'),_0x3ca530[_0xdf3f('0x20')]),_0x1f1e34);}});ami['on'](_0xdf3f('0x21'),function(_0x131810){try{utils[_0xdf3f('0x22')](util[_0xdf3f('0x1b')]('[%s][index][agentringnoanswer]',_0x131810[_0xdf3f('0x20')]),_0x131810);agents['agentringnoanswer'](_0x131810);}catch(_0x5f3266){utils[_0xdf3f('0x17')](util['format'](_0xdf3f('0x23'),_0x131810[_0xdf3f('0x20')]),_0x5f3266);}});ami['on'](_0xdf3f('0x24'),function(_0x214120){try{utils[_0xdf3f('0x22')](util[_0xdf3f('0x1b')](_0xdf3f('0x25'),_0x214120['uniqueid']),_0x214120);agents['agentconnect'](_0x214120);queues[_0xdf3f('0x24')](_0x214120);}catch(_0x2ecab7){utils[_0xdf3f('0x17')](util[_0xdf3f('0x1b')](_0xdf3f('0x25'),_0x214120['uniqueid']),_0x2ecab7);}});ami['on'](_0xdf3f('0x26'),function(_0x2c03e8){try{utils[_0xdf3f('0x22')](util[_0xdf3f('0x1b')](_0xdf3f('0x27'),_0x2c03e8[_0xdf3f('0x20')]),_0x2c03e8);agents[_0xdf3f('0x26')](_0x2c03e8);queues['agentcomplete'](_0x2c03e8);members['agentcomplete'](_0x2c03e8);}catch(_0xdc9a33){utils[_0xdf3f('0x17')](util['format'](_0xdf3f('0x27'),_0x2c03e8[_0xdf3f('0x20')]),_0xdc9a33);}});ami['on'](_0xdf3f('0x28'),function(_0x4549a2){try{utils[_0xdf3f('0x22')](util['format'](_0xdf3f('0x29'),_0x4549a2[_0xdf3f('0x20')]),_0x4549a2);agents[_0xdf3f('0x28')](_0x4549a2);queues[_0xdf3f('0x28')](_0x4549a2);}catch(_0x286e5c){utils[_0xdf3f('0x17')](util[_0xdf3f('0x1b')](_0xdf3f('0x29'),_0x4549a2['uniqueid']),_0x286e5c);}});ami['on'](_0xdf3f('0x2a'),function(_0x5e1f2b){try{utils[_0xdf3f('0x22')](util[_0xdf3f('0x1b')](_0xdf3f('0x2b'),_0x5e1f2b[_0xdf3f('0x20')]),_0x5e1f2b);queues['queuecallerjoin'](_0x5e1f2b);recordings[_0xdf3f('0x2a')](_0x5e1f2b);}catch(_0xd8805f){utils[_0xdf3f('0x17')](util[_0xdf3f('0x1b')](_0xdf3f('0x2b'),_0x5e1f2b['uniqueid']),_0xd8805f);}});ami['on'](_0xdf3f('0x2c'),function(_0x591410){try{utils[_0xdf3f('0x22')](util[_0xdf3f('0x1b')](_0xdf3f('0x2d'),_0x591410[_0xdf3f('0x20')]),_0x591410);queues[_0xdf3f('0x2c')](_0x591410);}catch(_0x291091){utils['error'](util['format'](_0xdf3f('0x2d'),_0x591410[_0xdf3f('0x20')]),_0x291091);}});ami['on']('musiconholdstart',function(_0x191dbe){try{utils[_0xdf3f('0x22')](util[_0xdf3f('0x1b')](_0xdf3f('0x2e'),_0x191dbe[_0xdf3f('0x20')]),_0x191dbe);queues[_0xdf3f('0x2f')](_0x191dbe);calls[_0xdf3f('0x2f')](_0x191dbe);}catch(_0x3098fd){utils[_0xdf3f('0x17')](util[_0xdf3f('0x1b')]('[%s][index][musiconholdstart]',_0x191dbe[_0xdf3f('0x20')]),_0x3098fd);}});ami['on'](_0xdf3f('0x30'),function(_0x4fedf9){try{utils['debug'](util[_0xdf3f('0x1b')](_0xdf3f('0x31'),_0x4fedf9[_0xdf3f('0x20')]),_0x4fedf9);queues[_0xdf3f('0x30')](_0x4fedf9);calls[_0xdf3f('0x30')](_0x4fedf9);}catch(_0x4a9d90){utils[_0xdf3f('0x17')](util[_0xdf3f('0x1b')](_0xdf3f('0x31'),_0x4fedf9[_0xdf3f('0x20')]),_0x4a9d90);}});ami['on'](_0xdf3f('0x32'),function(_0xfedd56){try{utils['debug'](util[_0xdf3f('0x1b')](_0xdf3f('0x33'),_0xfedd56[_0xdf3f('0x20')]),_0xfedd56);calls[_0xdf3f('0x32')](_0xfedd56);recordings['newstate'](_0xfedd56);}catch(_0x372669){utils[_0xdf3f('0x17')](util['format']('[%s][index][newstate]',_0xfedd56[_0xdf3f('0x20')]),_0x372669);}});ami['on'](_0xdf3f('0x34'),function(_0x497718){try{utils['debug'](util[_0xdf3f('0x1b')]('[%s][index][hangup]',_0x497718[_0xdf3f('0x20')]),_0x497718);calls[_0xdf3f('0x34')](_0x497718);recordings[_0xdf3f('0x34')](_0x497718);dials[_0xdf3f('0x34')](_0x497718);agents[_0xdf3f('0x34')](_0x497718);queues[_0xdf3f('0x34')](_0x497718);}catch(_0x171ebf){utils[_0xdf3f('0x17')](util[_0xdf3f('0x1b')](_0xdf3f('0x35'),_0x497718[_0xdf3f('0x20')]),_0x171ebf);}});ami['on'](_0xdf3f('0x36'),function(_0x2625cb){try{utils[_0xdf3f('0x22')](util[_0xdf3f('0x1b')](_0xdf3f('0x37'),_0x2625cb['uniqueid']),_0x2625cb);members[_0xdf3f('0x36')](_0x2625cb);}catch(_0x2b347c){utils[_0xdf3f('0x17')](util[_0xdf3f('0x1b')](_0xdf3f('0x37'),_0x2625cb[_0xdf3f('0x20')]),_0x2b347c);}});ami['on'](_0xdf3f('0x38'),function(_0x4c2ca4){try{utils[_0xdf3f('0x22')](util[_0xdf3f('0x1b')](_0xdf3f('0x39'),_0x4c2ca4['uniqueid']),_0x4c2ca4);queues['blindtransfer'](_0x4c2ca4);agents[_0xdf3f('0x38')](_0x4c2ca4);transfers[_0xdf3f('0x38')](_0x4c2ca4);recordings[_0xdf3f('0x38')](_0x4c2ca4);}catch(_0x5e32a9){utils[_0xdf3f('0x17')](util[_0xdf3f('0x1b')](_0xdf3f('0x39'),_0x4c2ca4[_0xdf3f('0x20')]),_0x5e32a9);}});ami['on'](_0xdf3f('0x3a'),function(_0x480d7c){try{utils['debug'](util[_0xdf3f('0x1b')]('[%s][index][attendedtransfer]',_0x480d7c['origtransfereruniqueid']),_0x480d7c);queues[_0xdf3f('0x3a')](_0x480d7c);transfers[_0xdf3f('0x3a')](_0x480d7c);agents[_0xdf3f('0x3a')](_0x480d7c);calls['attendedtransfer'](_0x480d7c);}catch(_0x460d75){utils[_0xdf3f('0x17')](util['format'](_0xdf3f('0x3b'),_0x480d7c[_0xdf3f('0x3c')]),_0x460d75);}});ami['on'](_0xdf3f('0x3d'),function(_0x238d6f){try{utils[_0xdf3f('0x22')](util[_0xdf3f('0x1b')]('[%s][index][varset]',_0x238d6f['uniqueid']),_0x238d6f);queues[_0xdf3f('0x3d')](_0x238d6f);recordings[_0xdf3f('0x3d')](_0x238d6f);calls[_0xdf3f('0x3d')](_0x238d6f);dials[_0xdf3f('0x3d')](_0x238d6f);}catch(_0x17d274){utils[_0xdf3f('0x17')](util['format']('[%s][index][varset]',_0x238d6f[_0xdf3f('0x20')]),_0x17d274);}});ami['on'](_0xdf3f('0x3e'),function(_0xa192f9){try{utils['debug'](util['format'](_0xdf3f('0x3f'),_0xa192f9[_0xdf3f('0x20')]),_0xa192f9);calls['newexten'](_0xa192f9);recordings[_0xdf3f('0x3e')](_0xa192f9);dials[_0xdf3f('0x3e')](_0xa192f9);}catch(_0x16a336){utils[_0xdf3f('0x17')](util[_0xdf3f('0x1b')](_0xdf3f('0x3f'),_0xa192f9['uniqueid']),_0x16a336);}});ami['on'](_0xdf3f('0x40'),function(_0x5bb35f){try{utils[_0xdf3f('0x22')](util[_0xdf3f('0x1b')](_0xdf3f('0x41'),_0x5bb35f[_0xdf3f('0x20')]),_0x5bb35f);calls['newchannel'](_0x5bb35f);recordings['newchannel'](_0x5bb35f);}catch(_0x3a51ff){utils[_0xdf3f('0x17')](util['format'](_0xdf3f('0x41'),_0x5bb35f[_0xdf3f('0x20')]),_0x3a51ff);}});ami['on'](_0xdf3f('0x42'),function(_0x4ae188){try{utils[_0xdf3f('0x22')](util[_0xdf3f('0x1b')]('[%s][index][dialbegin]',_0x4ae188[_0xdf3f('0x20')]),_0x4ae188);dials[_0xdf3f('0x42')](_0x4ae188);}catch(_0x58cdee){utils['error'](util[_0xdf3f('0x1b')]('[%s]dialbegin',_0x4ae188[_0xdf3f('0x20')]),_0x58cdee);}});ami['on'](_0xdf3f('0x43'),function(_0x58adab){try{utils['debug'](util['format'](_0xdf3f('0x44'),_0x58adab[_0xdf3f('0x20')]),_0x58adab);dials['dialend'](_0x58adab);}catch(_0x1fc1cd){utils[_0xdf3f('0x17')](util[_0xdf3f('0x1b')]('[%s][index][dialend]',_0x58adab[_0xdf3f('0x20')]),_0x1fc1cd);}});} \ No newline at end of file +var _0xfd19=['[%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','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','./utils','util','xdr','disabled','env','production','local','port','asterisk','username','password','keepConnected','info','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./transfers.controller','./core.controller','connect','shutdown','error','close','devicestatechange','debug','format','[%s][index][devicestatechange]','device','[%s][index][agentcalled]','agentcalled','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','[%s][index][agentconnect]','agentconnect','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0xfd19,0x178));var _0x9fd1=function(_0x54bdc1,_0x58f472){_0x54bdc1=_0x54bdc1-0x0;var _0x4e4df8=_0xfd19[_0x54bdc1];return _0x4e4df8;};var AsteriskManager=require('asterisk-manager');var config=require('../../config/environment');var utils=require(_0x9fd1('0x0'));var util=require(_0x9fd1('0x1'));var isXDREnabled=config['xdr']&&config[_0x9fd1('0x2')][_0x9fd1('0x3')]?!config[_0x9fd1('0x2')][_0x9fd1('0x3')]:!![];var isProduction=config[_0x9fd1('0x4')]===_0x9fd1('0x5')||![];var isLocalAsterisk=config[_0x9fd1('0x2')]&&config[_0x9fd1('0x2')][_0x9fd1('0x6')]===!![]||![];var ami=new AsteriskManager(config['asterisk'][_0x9fd1('0x7')],config[_0x9fd1('0x8')]['ip'],config[_0x9fd1('0x8')][_0x9fd1('0x9')],config[_0x9fd1('0x8')][_0x9fd1('0xa')],!![]);ami[_0x9fd1('0xb')]();if(!isXDREnabled){utils[_0x9fd1('0xc')]('XDR\x20DISABLED');}else if(!isProduction&&!isLocalAsterisk){utils[_0x9fd1('0xc')](_0x9fd1('0xd'));}else{var agents=require(_0x9fd1('0xe'));var calls=require(_0x9fd1('0xf'));var queues=require(_0x9fd1('0x10'));var recordings=require(_0x9fd1('0x11'));var members=require(_0x9fd1('0x12'));var dials=require('./dials.controller');var transfers=require(_0x9fd1('0x13'));var core=require(_0x9fd1('0x14'));ami['on'](_0x9fd1('0x15'),core['connect']);ami['on'](_0x9fd1('0x16'),core['shutdown']);ami['on']('fullybooted',core['fullybooted']);ami['on'](_0x9fd1('0x17'),core[_0x9fd1('0x17')]);ami['on'](_0x9fd1('0x18'),core['close']);ami['on']('managerevent',core['managerevent']);ami['on'](_0x9fd1('0x19'),function(_0x5bf722){try{utils[_0x9fd1('0x1a')](util[_0x9fd1('0x1b')](_0x9fd1('0x1c'),_0x5bf722[_0x9fd1('0x1d')]),_0x5bf722);members['devicestatechange'](_0x5bf722);}catch(_0x905ec5){utils['error'](util[_0x9fd1('0x1b')](_0x9fd1('0x1c'),_0x5bf722[_0x9fd1('0x1d')]),_0x905ec5);}});ami['on']('agentcalled',function(_0x2699cf){try{utils[_0x9fd1('0x1a')](util['format'](_0x9fd1('0x1e'),_0x2699cf['uniqueid']),_0x2699cf);agents[_0x9fd1('0x1f')](_0x2699cf);}catch(_0x513012){utils['error'](util['format']('[%s][index][agentcalled]',_0x2699cf[_0x9fd1('0x20')]),_0x513012);}});ami['on'](_0x9fd1('0x21'),function(_0x1d0812){try{utils['debug'](util['format']('[%s][index][agentringnoanswer]',_0x1d0812[_0x9fd1('0x20')]),_0x1d0812);agents['agentringnoanswer'](_0x1d0812);}catch(_0x7930c5){utils[_0x9fd1('0x17')](util[_0x9fd1('0x1b')](_0x9fd1('0x22'),_0x1d0812[_0x9fd1('0x20')]),_0x7930c5);}});ami['on']('agentconnect',function(_0x5169d2){try{utils[_0x9fd1('0x1a')](util[_0x9fd1('0x1b')](_0x9fd1('0x23'),_0x5169d2[_0x9fd1('0x20')]),_0x5169d2);agents['agentconnect'](_0x5169d2);queues[_0x9fd1('0x24')](_0x5169d2);}catch(_0x5d0901){utils[_0x9fd1('0x17')](util[_0x9fd1('0x1b')]('[%s][index][agentconnect]',_0x5169d2['uniqueid']),_0x5d0901);}});ami['on'](_0x9fd1('0x25'),function(_0x3f5d76){try{utils[_0x9fd1('0x1a')](util[_0x9fd1('0x1b')](_0x9fd1('0x26'),_0x3f5d76[_0x9fd1('0x20')]),_0x3f5d76);agents[_0x9fd1('0x25')](_0x3f5d76);queues[_0x9fd1('0x25')](_0x3f5d76);members[_0x9fd1('0x25')](_0x3f5d76);}catch(_0x55baf3){utils[_0x9fd1('0x17')](util['format'](_0x9fd1('0x26'),_0x3f5d76['uniqueid']),_0x55baf3);}});ami['on'](_0x9fd1('0x27'),function(_0x25631c){try{utils['debug'](util[_0x9fd1('0x1b')]('[%s][index][queuecallerabandon]',_0x25631c[_0x9fd1('0x20')]),_0x25631c);agents[_0x9fd1('0x27')](_0x25631c);queues['queuecallerabandon'](_0x25631c);}catch(_0x2dea52){utils['error'](util[_0x9fd1('0x1b')](_0x9fd1('0x28'),_0x25631c[_0x9fd1('0x20')]),_0x2dea52);}});ami['on']('queuecallerjoin',function(_0x1144ec){try{utils[_0x9fd1('0x1a')](util[_0x9fd1('0x1b')]('[%s][index][queuecallerjoin]',_0x1144ec[_0x9fd1('0x20')]),_0x1144ec);queues[_0x9fd1('0x29')](_0x1144ec);recordings['queuecallerjoin'](_0x1144ec);}catch(_0x1cbe42){utils[_0x9fd1('0x17')](util['format'](_0x9fd1('0x2a'),_0x1144ec[_0x9fd1('0x20')]),_0x1cbe42);}});ami['on'](_0x9fd1('0x2b'),function(_0x271024){try{utils['debug'](util[_0x9fd1('0x1b')](_0x9fd1('0x2c'),_0x271024[_0x9fd1('0x20')]),_0x271024);queues['queuecallerleave'](_0x271024);}catch(_0xb37af1){utils[_0x9fd1('0x17')](util[_0x9fd1('0x1b')](_0x9fd1('0x2c'),_0x271024[_0x9fd1('0x20')]),_0xb37af1);}});ami['on'](_0x9fd1('0x2d'),function(_0x50a60a){try{utils['debug'](util[_0x9fd1('0x1b')](_0x9fd1('0x2e'),_0x50a60a[_0x9fd1('0x20')]),_0x50a60a);queues[_0x9fd1('0x2d')](_0x50a60a);calls[_0x9fd1('0x2d')](_0x50a60a);}catch(_0x877071){utils[_0x9fd1('0x17')](util[_0x9fd1('0x1b')]('[%s][index][musiconholdstart]',_0x50a60a[_0x9fd1('0x20')]),_0x877071);}});ami['on'](_0x9fd1('0x2f'),function(_0x20c444){try{utils['debug'](util[_0x9fd1('0x1b')](_0x9fd1('0x30'),_0x20c444[_0x9fd1('0x20')]),_0x20c444);queues[_0x9fd1('0x2f')](_0x20c444);calls['musiconholdstop'](_0x20c444);}catch(_0x344caa){utils[_0x9fd1('0x17')](util[_0x9fd1('0x1b')](_0x9fd1('0x30'),_0x20c444[_0x9fd1('0x20')]),_0x344caa);}});ami['on']('newstate',function(_0x373a6b){try{utils['debug'](util[_0x9fd1('0x1b')]('[%s][index][newstate]',_0x373a6b[_0x9fd1('0x20')]),_0x373a6b);calls[_0x9fd1('0x31')](_0x373a6b);recordings[_0x9fd1('0x31')](_0x373a6b);}catch(_0x5db96d){utils['error'](util[_0x9fd1('0x1b')](_0x9fd1('0x32'),_0x373a6b['uniqueid']),_0x5db96d);}});ami['on'](_0x9fd1('0x33'),function(_0x11fd38){try{utils[_0x9fd1('0x1a')](util[_0x9fd1('0x1b')]('[%s][index][hangup]',_0x11fd38[_0x9fd1('0x20')]),_0x11fd38);calls[_0x9fd1('0x33')](_0x11fd38);recordings['hangup'](_0x11fd38);dials[_0x9fd1('0x33')](_0x11fd38);agents[_0x9fd1('0x33')](_0x11fd38);queues[_0x9fd1('0x33')](_0x11fd38);}catch(_0x4a0e25){utils[_0x9fd1('0x17')](util['format'](_0x9fd1('0x34'),_0x11fd38[_0x9fd1('0x20')]),_0x4a0e25);}});ami['on'](_0x9fd1('0x35'),function(_0x1f154f){try{utils['debug'](util[_0x9fd1('0x1b')](_0x9fd1('0x36'),_0x1f154f[_0x9fd1('0x20')]),_0x1f154f);members['cdr'](_0x1f154f);}catch(_0x235520){utils[_0x9fd1('0x17')](util['format'](_0x9fd1('0x36'),_0x1f154f['uniqueid']),_0x235520);}});ami['on']('blindtransfer',function(_0x1d2633){try{utils['debug'](util[_0x9fd1('0x1b')](_0x9fd1('0x37'),_0x1d2633['uniqueid']),_0x1d2633);queues[_0x9fd1('0x38')](_0x1d2633);agents[_0x9fd1('0x38')](_0x1d2633);transfers[_0x9fd1('0x38')](_0x1d2633);recordings[_0x9fd1('0x38')](_0x1d2633);}catch(_0x36bcff){utils['error'](util[_0x9fd1('0x1b')](_0x9fd1('0x37'),_0x1d2633[_0x9fd1('0x20')]),_0x36bcff);}});ami['on'](_0x9fd1('0x39'),function(_0x4c18ed){try{utils[_0x9fd1('0x1a')](util[_0x9fd1('0x1b')](_0x9fd1('0x3a'),_0x4c18ed[_0x9fd1('0x3b')]),_0x4c18ed);queues['attendedtransfer'](_0x4c18ed);transfers['attendedtransfer'](_0x4c18ed);agents['attendedtransfer'](_0x4c18ed);calls[_0x9fd1('0x39')](_0x4c18ed);}catch(_0x2a0022){utils['error'](util[_0x9fd1('0x1b')](_0x9fd1('0x3a'),_0x4c18ed[_0x9fd1('0x3b')]),_0x2a0022);}});ami['on'](_0x9fd1('0x3c'),function(_0x202ce1){try{utils['debug'](util[_0x9fd1('0x1b')]('[%s][index][varset]',_0x202ce1[_0x9fd1('0x20')]),_0x202ce1);queues[_0x9fd1('0x3c')](_0x202ce1);recordings[_0x9fd1('0x3c')](_0x202ce1);calls[_0x9fd1('0x3c')](_0x202ce1);dials[_0x9fd1('0x3c')](_0x202ce1);}catch(_0x570dd4){utils[_0x9fd1('0x17')](util[_0x9fd1('0x1b')]('[%s][index][varset]',_0x202ce1[_0x9fd1('0x20')]),_0x570dd4);}});ami['on'](_0x9fd1('0x3d'),function(_0x5b8d42){try{utils['debug'](util[_0x9fd1('0x1b')](_0x9fd1('0x3e'),_0x5b8d42[_0x9fd1('0x20')]),_0x5b8d42);calls[_0x9fd1('0x3d')](_0x5b8d42);recordings[_0x9fd1('0x3d')](_0x5b8d42);dials[_0x9fd1('0x3d')](_0x5b8d42);}catch(_0x38eeb1){utils[_0x9fd1('0x17')](util['format'](_0x9fd1('0x3e'),_0x5b8d42[_0x9fd1('0x20')]),_0x38eeb1);}});ami['on'](_0x9fd1('0x3f'),function(_0x293948){try{utils[_0x9fd1('0x1a')](util['format'](_0x9fd1('0x40'),_0x293948[_0x9fd1('0x20')]),_0x293948);calls['newchannel'](_0x293948);recordings[_0x9fd1('0x3f')](_0x293948);}catch(_0x1877b0){utils['error'](util[_0x9fd1('0x1b')]('[%s][index][newchannel]',_0x293948[_0x9fd1('0x20')]),_0x1877b0);}});ami['on'](_0x9fd1('0x41'),function(_0x4e6192){try{utils[_0x9fd1('0x1a')](util[_0x9fd1('0x1b')](_0x9fd1('0x42'),_0x4e6192[_0x9fd1('0x20')]),_0x4e6192);dials['dialbegin'](_0x4e6192);}catch(_0x25467a){utils['error'](util[_0x9fd1('0x1b')](_0x9fd1('0x43'),_0x4e6192[_0x9fd1('0x20')]),_0x25467a);}});ami['on'](_0x9fd1('0x44'),function(_0x2fdf77){try{utils[_0x9fd1('0x1a')](util[_0x9fd1('0x1b')](_0x9fd1('0x45'),_0x2fdf77[_0x9fd1('0x20')]),_0x2fdf77);dials[_0x9fd1('0x44')](_0x2fdf77);}catch(_0x5e980b){utils['error'](util['format'](_0x9fd1('0x45'),_0x2fdf77[_0x9fd1('0x20')]),_0x5e980b);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index bcb4318..457567e 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 _0x119c=['source','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','data3','destinationchannel','assign','lodash','./utils','Local/_attended@transfer','Queue:','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','type','getUserByInterface','then','membername','name','internal','request','CreateMemberReport','split','catch','[%s][members][writeDB]','startsWith','devicestatechange','debug','device','info','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','voice','TALKING','now','NOT_INUSE','exitAt','diffTime','enterAt','error','[%s][members][devicestatechange]','agentcomplete','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','cdr','[%s][members][cdr]','isNil','data1','data2'];(function(_0x4b416c,_0x53ef9e){var _0x2037fa=function(_0x5d9816){while(--_0x5d9816){_0x4b416c['push'](_0x4b416c['shift']());}};_0x2037fa(++_0x53ef9e);}(_0x119c,0xa5));var _0xc119=function(_0x432fca,_0xb0b1b5){_0x432fca=_0x432fca-0x0;var _0x3adba4=_0x119c[_0x432fca];return _0x3adba4;};'use strict';var _=require(_0xc119('0x0'));var util=require('util');var utils=require(_0xc119('0x1'));var members={};var exclude=[_0xc119('0x2'),_0xc119('0x3')];function writeDB(_0x4c5016){utils['info'](util[_0xc119('0x4')](_0xc119('0x5'),_0x4c5016[_0xc119('0x6')],_0x4c5016[_0xc119('0x7')],_0x4c5016[_0xc119('0x8')],_0x4c5016['data2'],_0x4c5016['membername'],_0x4c5016[_0xc119('0x9')]));if(_0x4c5016['interface']){utils[_0xc119('0xa')](_0x4c5016[_0xc119('0x7')])[_0xc119('0xb')](function(_0x3034b3){if(_0x3034b3){_0x4c5016[_0xc119('0xc')]=_0x3034b3[_0xc119('0xd')];_0x4c5016[_0xc119('0xe')]=_0x3034b3[_0xc119('0xe')];utils[_0xc119('0xf')](_0xc119('0x10'),_0x4c5016);}else{utils['getUserByName'](_0x4c5016[_0xc119('0x7')][_0xc119('0x11')]('/')[0x1])['then'](function(_0x2ab680){if(_0x2ab680){_0x4c5016[_0xc119('0xc')]=_0x2ab680[_0xc119('0xd')];_0x4c5016[_0xc119('0xe')]=_0x2ab680[_0xc119('0xe')];utils[_0xc119('0xf')](_0xc119('0x10'),_0x4c5016);}});}})[_0xc119('0x12')](function(_0x523f7b){utils['error'](util[_0xc119('0x4')](_0xc119('0x13'),_0x4c5016['uniqueid']),_0x523f7b);});}delete members[_0x4c5016[_0xc119('0x7')]];}function startsWith(_0x230fb2,_0x4d5e43){return _['some'](_0x230fb2,function(_0x2ab3b2){return _[_0xc119('0x14')](_0x4d5e43,_0x2ab3b2);});}exports[_0xc119('0x15')]=function(_0x49246a){try{utils[_0xc119('0x16')](util[_0xc119('0x4')]('[%s][members][devicestatechange]',members[_0x49246a[_0xc119('0x17')]]?members[_0x49246a['device']][_0xc119('0x6')]:_0x49246a['device']),_0x49246a);utils[_0xc119('0x18')](util[_0xc119('0x4')](_0xc119('0x19'),members[_0x49246a[_0xc119('0x17')]]?members[_0x49246a[_0xc119('0x17')]][_0xc119('0x6')]:_0x49246a['device'],_0x49246a[_0xc119('0x1a')],_0x49246a[_0xc119('0x17')]));switch(_0x49246a[_0xc119('0x1a')]){case _0xc119('0x1b'):case _0xc119('0x1c'):if(!startsWith(exclude,_0x49246a['device'])){members[_0x49246a[_0xc119('0x17')]]={'channel':_0xc119('0x1d'),'interface':_0x49246a[_0xc119('0x17')],'type':_0xc119('0x1e'),'enterAt':utils[_0xc119('0x1f')](),'role':'agent'};}break;case _0xc119('0x20'):if(!_['isNil'](members[_0x49246a[_0xc119('0x17')]])){members[_0x49246a[_0xc119('0x17')]][_0xc119('0x21')]=utils[_0xc119('0x1f')]();members[_0x49246a[_0xc119('0x17')]]['duration']=utils[_0xc119('0x22')](members[_0x49246a[_0xc119('0x17')]][_0xc119('0x21')],members[_0x49246a[_0xc119('0x17')]][_0xc119('0x23')]);if(members[_0x49246a[_0xc119('0x17')]][_0xc119('0x6')]){writeDB(members[_0x49246a['device']]);}}break;default:break;}}catch(_0x1eddb5){utils[_0xc119('0x24')](util[_0xc119('0x4')](_0xc119('0x25'),members[_0x49246a['device']]?members[_0x49246a[_0xc119('0x17')]][_0xc119('0x6')]:_0x49246a[_0xc119('0x17')]),_0x1eddb5);}};exports[_0xc119('0x26')]=function(_0x50bfbd){try{if(!_['isNil'](members[_0x50bfbd[_0xc119('0x7')]])){utils[_0xc119('0x16')](util['format'](_0xc119('0x27'),_0x50bfbd[_0xc119('0x6')]),_0x50bfbd);utils[_0xc119('0x18')](util[_0xc119('0x4')](_0xc119('0x28'),_0x50bfbd[_0xc119('0x6')],_0x50bfbd['interface'],_0x50bfbd[_0xc119('0x29')]));members[_0x50bfbd[_0xc119('0x7')]]=_['assign'](members[_0x50bfbd[_0xc119('0x7')]],{'data4':_0x50bfbd[_0xc119('0x29')],'uniqueid':_0x50bfbd['uniqueid']});}}catch(_0x1c87e0){utils['error'](util[_0xc119('0x4')]('[%s][members][agentcomplete]',_0x50bfbd[_0xc119('0x6')]),_0x1c87e0);}};exports[_0xc119('0x2a')]=function(_0x504a02){try{utils[_0xc119('0x16')](util[_0xc119('0x4')](_0xc119('0x2b'),_0x504a02['uniqueid']),_0x504a02);if(_0x504a02['channel']){var _0x1f435d=_0x504a02[_0xc119('0x8')][_0xc119('0x11')]('-')[0x0];if(!_[_0xc119('0x2c')](members[_0x1f435d])){members[_0x1f435d]=_['assign'](members[_0x1f435d],{'data1':members[_0x1f435d][_0xc119('0x2d')]||_0x504a02[_0xc119('0x9')],'data2':members[_0x1f435d][_0xc119('0x2e')]||_0x504a02[_0xc119('0x2f')],'data3':members[_0x1f435d]['data3']||_0x504a02[_0xc119('0x30')],'uniqueid':members[_0x1f435d][_0xc119('0x6')]||_0x504a02[_0xc119('0x6')]});utils[_0xc119('0x18')](util['format'](_0xc119('0x31'),_0x504a02[_0xc119('0x6')],members[_0x1f435d][_0xc119('0x2d')],members[_0x1f435d][_0xc119('0x2e')],members[_0x1f435d][_0xc119('0x32')]));if(members[_0x1f435d][_0xc119('0x21')]){writeDB(members[_0x1f435d]);}}}if(_0x504a02[_0xc119('0x33')]){var _0x3aee8f=_0x504a02[_0xc119('0x33')][_0xc119('0x11')]('-')[0x0];if(!_[_0xc119('0x2c')](members[_0x3aee8f])){members[_0x3aee8f]=_[_0xc119('0x34')](members[_0x3aee8f],{'data1':members[_0x3aee8f][_0xc119('0x2d')]||_0x504a02[_0xc119('0x9')],'data2':members[_0x3aee8f][_0xc119('0x2e')]||_0x504a02[_0xc119('0x2f')],'data3':members[_0x3aee8f][_0xc119('0x32')]||_0x504a02[_0xc119('0x30')],'uniqueid':members[_0x3aee8f][_0xc119('0x6')]||_0x504a02[_0xc119('0x6')]});utils[_0xc119('0x18')](util[_0xc119('0x4')](_0xc119('0x31'),_0x504a02[_0xc119('0x6')],members[_0x3aee8f]['data1'],members[_0x3aee8f][_0xc119('0x2e')],members[_0x3aee8f][_0xc119('0x32')]));if(members[_0x3aee8f]['exitAt']){writeDB(members[_0x3aee8f]);}}}}catch(_0x151f31){utils[_0xc119('0x24')](util[_0xc119('0x4')](_0xc119('0x2b'),_0x504a02[_0xc119('0x6')]),_0x151f31);}}; \ No newline at end of file +var _0xbb6b=['state','INUSE','BUSY','voice','now','agent','NOT_INUSE','diffTime','exitAt','enterAt','[%s][members][devicestatechange]','agentcomplete','isNil','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','cdr','[%s][members][cdr]','data1','source','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','data3','destinationchannel','util','info','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','channel','data2','membername','type','getUserByInterface','then','name','internal','request','CreateMemberReport','getUserByName','interface','split','catch','error','format','[%s][members][writeDB]','uniqueid','startsWith','devicestatechange','debug','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s'];(function(_0x8bb4c1,_0x2d6e53){var _0x67a6e1=function(_0x1155e5){while(--_0x1155e5){_0x8bb4c1['push'](_0x8bb4c1['shift']());}};_0x67a6e1(++_0x2d6e53);}(_0xbb6b,0x17e));var _0xbbb6=function(_0x2f050f,_0x5f3b10){_0x2f050f=_0x2f050f-0x0;var _0x26c1df=_0xbb6b[_0x2f050f];return _0x26c1df;};'use strict';var _=require('lodash');var util=require(_0xbbb6('0x0'));var utils=require('./utils');var members={};var exclude=['Local/_attended@transfer','Queue:'];function writeDB(_0x2d6406){utils[_0xbbb6('0x1')](util['format'](_0xbbb6('0x2'),_0x2d6406['uniqueid'],_0x2d6406['interface'],_0x2d6406[_0xbbb6('0x3')],_0x2d6406[_0xbbb6('0x4')],_0x2d6406[_0xbbb6('0x5')],_0x2d6406[_0xbbb6('0x6')]));if(_0x2d6406['interface']){utils[_0xbbb6('0x7')](_0x2d6406['interface'])[_0xbbb6('0x8')](function(_0x4745fc){if(_0x4745fc){_0x2d6406[_0xbbb6('0x5')]=_0x4745fc[_0xbbb6('0x9')];_0x2d6406[_0xbbb6('0xa')]=_0x4745fc[_0xbbb6('0xa')];utils[_0xbbb6('0xb')](_0xbbb6('0xc'),_0x2d6406);}else{utils[_0xbbb6('0xd')](_0x2d6406[_0xbbb6('0xe')][_0xbbb6('0xf')]('/')[0x1])[_0xbbb6('0x8')](function(_0x2fc7a4){if(_0x2fc7a4){_0x2d6406[_0xbbb6('0x5')]=_0x2fc7a4[_0xbbb6('0x9')];_0x2d6406[_0xbbb6('0xa')]=_0x2fc7a4[_0xbbb6('0xa')];utils['request'](_0xbbb6('0xc'),_0x2d6406);}});}})[_0xbbb6('0x10')](function(_0x1a2171){utils[_0xbbb6('0x11')](util[_0xbbb6('0x12')](_0xbbb6('0x13'),_0x2d6406[_0xbbb6('0x14')]),_0x1a2171);});}delete members[_0x2d6406[_0xbbb6('0xe')]];}function startsWith(_0x89f666,_0x3b36a5){return _['some'](_0x89f666,function(_0x3eea0b){return _[_0xbbb6('0x15')](_0x3b36a5,_0x3eea0b);});}exports[_0xbbb6('0x16')]=function(_0x5b069e){try{utils[_0xbbb6('0x17')](util['format']('[%s][members][devicestatechange]',members[_0x5b069e[_0xbbb6('0x18')]]?members[_0x5b069e[_0xbbb6('0x18')]][_0xbbb6('0x14')]:_0x5b069e['device']),_0x5b069e);utils[_0xbbb6('0x1')](util[_0xbbb6('0x12')](_0xbbb6('0x19'),members[_0x5b069e[_0xbbb6('0x18')]]?members[_0x5b069e['device']]['uniqueid']:_0x5b069e[_0xbbb6('0x18')],_0x5b069e[_0xbbb6('0x1a')],_0x5b069e['device']));switch(_0x5b069e['state']){case _0xbbb6('0x1b'):case _0xbbb6('0x1c'):if(!startsWith(exclude,_0x5b069e[_0xbbb6('0x18')])){members[_0x5b069e['device']]={'channel':_0xbbb6('0x1d'),'interface':_0x5b069e[_0xbbb6('0x18')],'type':'TALKING','enterAt':utils[_0xbbb6('0x1e')](),'role':_0xbbb6('0x1f')};}break;case _0xbbb6('0x20'):if(!_['isNil'](members[_0x5b069e[_0xbbb6('0x18')]])){members[_0x5b069e['device']]['exitAt']=utils['now']();members[_0x5b069e[_0xbbb6('0x18')]]['duration']=utils[_0xbbb6('0x21')](members[_0x5b069e[_0xbbb6('0x18')]][_0xbbb6('0x22')],members[_0x5b069e[_0xbbb6('0x18')]][_0xbbb6('0x23')]);if(members[_0x5b069e[_0xbbb6('0x18')]]['uniqueid']){writeDB(members[_0x5b069e[_0xbbb6('0x18')]]);}}break;default:break;}}catch(_0x5abd83){utils[_0xbbb6('0x11')](util[_0xbbb6('0x12')](_0xbbb6('0x24'),members[_0x5b069e[_0xbbb6('0x18')]]?members[_0x5b069e[_0xbbb6('0x18')]][_0xbbb6('0x14')]:_0x5b069e['device']),_0x5abd83);}};exports[_0xbbb6('0x25')]=function(_0xff31a4){try{if(!_[_0xbbb6('0x26')](members[_0xff31a4[_0xbbb6('0xe')]])){utils[_0xbbb6('0x17')](util['format'](_0xbbb6('0x27'),_0xff31a4[_0xbbb6('0x14')]),_0xff31a4);utils[_0xbbb6('0x1')](util[_0xbbb6('0x12')](_0xbbb6('0x28'),_0xff31a4[_0xbbb6('0x14')],_0xff31a4[_0xbbb6('0xe')],_0xff31a4[_0xbbb6('0x29')]));members[_0xff31a4[_0xbbb6('0xe')]]=_[_0xbbb6('0x2a')](members[_0xff31a4['interface']],{'data4':_0xff31a4[_0xbbb6('0x29')],'uniqueid':_0xff31a4[_0xbbb6('0x14')]});}}catch(_0x108bcb){utils[_0xbbb6('0x11')](util[_0xbbb6('0x12')]('[%s][members][agentcomplete]',_0xff31a4[_0xbbb6('0x14')]),_0x108bcb);}};exports[_0xbbb6('0x2b')]=function(_0x4bbe05){try{utils[_0xbbb6('0x17')](util[_0xbbb6('0x12')](_0xbbb6('0x2c'),_0x4bbe05[_0xbbb6('0x14')]),_0x4bbe05);if(_0x4bbe05['channel']){var _0x394213=_0x4bbe05['channel']['split']('-')[0x0];if(!_['isNil'](members[_0x394213])){members[_0x394213]=_[_0xbbb6('0x2a')](members[_0x394213],{'data1':members[_0x394213][_0xbbb6('0x2d')]||_0x4bbe05[_0xbbb6('0x6')],'data2':members[_0x394213][_0xbbb6('0x4')]||_0x4bbe05[_0xbbb6('0x2e')],'data3':members[_0x394213]['data3']||_0x4bbe05[_0xbbb6('0x2f')],'uniqueid':members[_0x394213][_0xbbb6('0x14')]||_0x4bbe05[_0xbbb6('0x14')]});utils['info'](util[_0xbbb6('0x12')](_0xbbb6('0x30'),_0x4bbe05[_0xbbb6('0x14')],members[_0x394213]['data1'],members[_0x394213][_0xbbb6('0x4')],members[_0x394213][_0xbbb6('0x31')]));if(members[_0x394213][_0xbbb6('0x22')]){writeDB(members[_0x394213]);}}}if(_0x4bbe05[_0xbbb6('0x32')]){var _0x29f327=_0x4bbe05[_0xbbb6('0x32')][_0xbbb6('0xf')]('-')[0x0];if(!_[_0xbbb6('0x26')](members[_0x29f327])){members[_0x29f327]=_[_0xbbb6('0x2a')](members[_0x29f327],{'data1':members[_0x29f327][_0xbbb6('0x2d')]||_0x4bbe05['type'],'data2':members[_0x29f327]['data2']||_0x4bbe05[_0xbbb6('0x2e')],'data3':members[_0x29f327]['data3']||_0x4bbe05[_0xbbb6('0x2f')],'uniqueid':members[_0x29f327][_0xbbb6('0x14')]||_0x4bbe05[_0xbbb6('0x14')]});utils['info'](util['format']('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x4bbe05['uniqueid'],members[_0x29f327]['data1'],members[_0x29f327][_0xbbb6('0x4')],members[_0x29f327]['data3']));if(members[_0x29f327]['exitAt']){writeDB(members[_0x29f327]);}}}}catch(_0x7cc19d){utils[_0xbbb6('0x11')](util[_0xbbb6('0x12')]('[%s][members][cdr]',_0x4bbe05[_0xbbb6('0x14')]),_0x7cc19d);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index f856759..50b0294 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 _0xabb2=['ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','queuecallerleaveAt','holdtime','diffTime','queuecallerjoinAt','position','count','agentconnect','membername','assigned','[%s][queues][agentconnect]','agentcomplete','[%s][queues][agentcomplete]','reason','transfer','TRANSFER','COMPLETEDBY','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','transferexten','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','ATTENDED','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','[%s][queues][musiconholdstart]','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstartAt','[%s][queues][musiconholdstop]','lodash','./utils','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','queue','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','info','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','assign','error','isNil','[%s][queues][hangup]','queuecallerabandon','queuecallercomplete','queuecallercompleteAt','queuecallerenterreason','varset','variable','queuestatus','value','toUpperCase','queuecallerabandonAt','queuecallerexit','queuecallerexitAt','now','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','name','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][varset]'];(function(_0x65af97,_0x2a0ec1){var _0x57b0f8=function(_0x37cfcc){while(--_0x37cfcc){_0x65af97['push'](_0x65af97['shift']());}};_0x57b0f8(++_0x2a0ec1);}(_0xabb2,0x169));var _0x2abb=function(_0x102ff9,_0x907658){_0x102ff9=_0x102ff9-0x0;var _0x24fa97=_0xabb2[_0x102ff9];return _0x24fa97;};'use strict';var _=require(_0x2abb('0x0'));var util=require('util');var utils=require(_0x2abb('0x1'));var queues={};function writeDB(_0x4edafc){utils['info'](util[_0x2abb('0x2')](_0x2abb('0x3'),_0x4edafc[_0x2abb('0x4')],_0x4edafc['channel'],_0x4edafc[_0x2abb('0x5')],_0x4edafc[_0x2abb('0x6')],_0x4edafc[_0x2abb('0x7')],_0x4edafc[_0x2abb('0x8')],_0x4edafc[_0x2abb('0x9')]));if(_0x4edafc['queue']){utils[_0x2abb('0xa')](_0x4edafc[_0x2abb('0x5')])[_0x2abb('0xb')](function(_0x34371a){if(_0x34371a){_0x4edafc[_0x2abb('0xc')]=_0x34371a[_0x2abb('0xc')];}utils[_0x2abb('0xd')](_0x2abb('0xe'),_0x4edafc);});}else{utils['request'](_0x2abb('0xe'),_0x4edafc);}if(_0x4edafc[_0x2abb('0xf')]){delete queues[_0x4edafc['transfereduniqueid']];}else{delete queues[_0x4edafc[_0x2abb('0x4')]];}}exports[_0x2abb('0x10')]=function(_0x43568a){try{utils[_0x2abb('0x11')](util['format'](_0x2abb('0x12'),_0x43568a['uniqueid']),_0x43568a);utils[_0x2abb('0x13')](util[_0x2abb('0x2')](_0x2abb('0x14'),_0x43568a[_0x2abb('0x4')],_0x43568a[_0x2abb('0x5')],_0x43568a['position']));queues[_0x43568a[_0x2abb('0x4')]]=_[_0x2abb('0x15')](_0x43568a,{'originalposition':_0x43568a['position'],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});}catch(_0x5916bb){utils[_0x2abb('0x16')](util[_0x2abb('0x2')](_0x2abb('0x12'),_0x43568a[_0x2abb('0x4')]),_0x5916bb);}};exports['hangup']=function(_0x234e1a){try{if(!_[_0x2abb('0x17')](queues[_0x234e1a[_0x2abb('0x4')]])){utils[_0x2abb('0x11')](util[_0x2abb('0x2')](_0x2abb('0x18'),_0x234e1a[_0x2abb('0x4')]),_0x234e1a);if(queues[_0x234e1a[_0x2abb('0x4')]]['queuecallerleaveAt']){if(!queues[_0x234e1a[_0x2abb('0x4')]][_0x2abb('0x19')]&&!queues[_0x234e1a['uniqueid']]['queuecallerexit']){queues[_0x234e1a[_0x2abb('0x4')]][_0x2abb('0x1a')]=!![];queues[_0x234e1a[_0x2abb('0x4')]][_0x2abb('0x1b')]=utils['now']();queues[_0x234e1a[_0x2abb('0x4')]][_0x2abb('0x9')]='COMPLETEDBYAGENT';}utils[_0x2abb('0x13')](util[_0x2abb('0x2')]('[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s',_0x234e1a[_0x2abb('0x4')],queues[_0x234e1a[_0x2abb('0x4')]]['name'],queues[_0x234e1a[_0x2abb('0x4')]][_0x2abb('0x9')]));writeDB(queues[_0x234e1a[_0x2abb('0x4')]]);}else if(queues[_0x234e1a[_0x2abb('0x4')]][_0x2abb('0xf')]){utils['info'](util['format']('[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s',_0x234e1a[_0x2abb('0x4')],queues[_0x234e1a[_0x2abb('0x4')]]['name'],queues[_0x234e1a[_0x2abb('0x4')]][_0x2abb('0xf')]));queues[queues[_0x234e1a[_0x2abb('0x4')]][_0x2abb('0xf')]]=queues[_0x234e1a[_0x2abb('0x4')]];queues[queues[_0x234e1a['uniqueid']][_0x2abb('0xf')]][_0x2abb('0x1c')]=0x2;delete queues[_0x234e1a['uniqueid']];}}}catch(_0x318050){utils['error'](util[_0x2abb('0x2')](_0x2abb('0x18'),_0x234e1a[_0x2abb('0x4')]),_0x318050);}};exports[_0x2abb('0x1d')]=function(_0x3101c0){try{utils[_0x2abb('0x11')](util['format']('[%s][queues][varset]',_0x3101c0[_0x2abb('0x4')]),_0x3101c0);if(!_['isNil'](_0x3101c0[_0x2abb('0x1e')][_0x2abb('0x1f')])&&_0x3101c0[_0x2abb('0x20')][_0x2abb('0x21')]()!=='CONTINUE'){if(!_[_0x2abb('0x17')](queues[_0x3101c0['uniqueid']])){queues[_0x3101c0[_0x2abb('0x4')]]['queuecallerabandon']=![];queues[_0x3101c0['uniqueid']][_0x2abb('0x22')]=null;queues[_0x3101c0[_0x2abb('0x4')]][_0x2abb('0x23')]=!![];queues[_0x3101c0[_0x2abb('0x4')]][_0x2abb('0x24')]=utils[_0x2abb('0x25')]();queues[_0x3101c0[_0x2abb('0x4')]][_0x2abb('0x9')]=_0x3101c0[_0x2abb('0x20')]['toUpperCase']();utils[_0x2abb('0x13')](util[_0x2abb('0x2')](_0x2abb('0x26'),_0x3101c0[_0x2abb('0x4')],queues[_0x3101c0[_0x2abb('0x4')]][_0x2abb('0x27')],_0x3101c0[_0x2abb('0x20')],queues[_0x3101c0['uniqueid']][_0x2abb('0x9')]));writeDB(queues[_0x3101c0[_0x2abb('0x4')]]);}}else if(!_[_0x2abb('0x17')](_0x3101c0[_0x2abb('0x1e')]['queueposition'])){if(!_[_0x2abb('0x17')](queues[_0x3101c0[_0x2abb('0x4')]])&&!queues[_0x3101c0['uniqueid']]['queuecallerabandon']){queues[_0x3101c0[_0x2abb('0x4')]][_0x2abb('0x19')]=![];queues[_0x3101c0[_0x2abb('0x4')]][_0x2abb('0x22')]=null;queues[_0x3101c0[_0x2abb('0x4')]][_0x2abb('0x23')]=!![];queues[_0x3101c0[_0x2abb('0x4')]][_0x2abb('0x24')]=utils[_0x2abb('0x25')]();queues[_0x3101c0[_0x2abb('0x4')]][_0x2abb('0x9')]=_0x2abb('0x28');utils['info'](util['format'](_0x2abb('0x29'),_0x3101c0['uniqueid'],queues[_0x3101c0['uniqueid']][_0x2abb('0x27')],_0x3101c0[_0x2abb('0x20')],queues[_0x3101c0[_0x2abb('0x4')]][_0x2abb('0x9')]));}}}catch(_0x17b786){utils[_0x2abb('0x16')](util[_0x2abb('0x2')](_0x2abb('0x2a'),_0x3101c0['uniqueid']),_0x17b786);}};exports[_0x2abb('0x19')]=function(_0x51c0e8){try{if(!_[_0x2abb('0x17')](queues[_0x51c0e8[_0x2abb('0x4')]])){utils[_0x2abb('0x11')](util[_0x2abb('0x2')]('[%s][queues][queuecallerabandon]',_0x51c0e8[_0x2abb('0x4')]),_0x51c0e8);queues[_0x51c0e8[_0x2abb('0x4')]][_0x2abb('0x23')]=![];queues[_0x51c0e8[_0x2abb('0x4')]]['queuecallerexitAt']=null;queues[_0x51c0e8[_0x2abb('0x4')]][_0x2abb('0x19')]=!![];queues[_0x51c0e8[_0x2abb('0x4')]][_0x2abb('0x22')]=utils[_0x2abb('0x25')]();queues[_0x51c0e8[_0x2abb('0x4')]][_0x2abb('0x9')]=_0x2abb('0x2b');utils[_0x2abb('0x13')](util[_0x2abb('0x2')](_0x2abb('0x2c'),_0x51c0e8[_0x2abb('0x4')],queues[_0x51c0e8['uniqueid']][_0x2abb('0x27')],queues[_0x51c0e8['uniqueid']][_0x2abb('0x9')]));}}catch(_0x2900c0){utils[_0x2abb('0x16')](util[_0x2abb('0x2')](_0x2abb('0x2d'),_0x51c0e8[_0x2abb('0x4')]),_0x2900c0);}};exports[_0x2abb('0x2e')]=function(_0x5485cd){try{if(!_[_0x2abb('0x17')](queues[_0x5485cd[_0x2abb('0x4')]])){utils[_0x2abb('0x11')](util[_0x2abb('0x2')](_0x2abb('0x2f'),_0x5485cd[_0x2abb('0x4')]),_0x5485cd);utils[_0x2abb('0x13')](util[_0x2abb('0x2')](_0x2abb('0x30'),_0x5485cd[_0x2abb('0x4')],queues[_0x5485cd[_0x2abb('0x4')]][_0x2abb('0x27')],_0x5485cd[_0x2abb('0x31')],_0x5485cd[_0x2abb('0x32')]));queues[_0x5485cd[_0x2abb('0x4')]]['queuecallerleave']=!![];queues[_0x5485cd[_0x2abb('0x4')]][_0x2abb('0x33')]=utils[_0x2abb('0x25')]();queues[_0x5485cd['uniqueid']][_0x2abb('0x34')]=utils[_0x2abb('0x35')](queues[_0x5485cd[_0x2abb('0x4')]]['queuecallerleaveAt'],queues[_0x5485cd[_0x2abb('0x4')]][_0x2abb('0x36')]);queues[_0x5485cd[_0x2abb('0x4')]]['position']=_0x5485cd[_0x2abb('0x37')];queues[_0x5485cd[_0x2abb('0x4')]]['count']=_0x5485cd[_0x2abb('0x38')];queues[_0x5485cd['uniqueid']][_0x2abb('0x31')]=_0x5485cd['connectedlinenum'];queues[_0x5485cd['uniqueid']][_0x2abb('0x32')]=_0x5485cd[_0x2abb('0x32')];}}catch(_0x4bef57){utils[_0x2abb('0x16')](util[_0x2abb('0x2')](_0x2abb('0x2f'),_0x5485cd[_0x2abb('0x4')]),_0x4bef57);}};exports[_0x2abb('0x39')]=function(_0xa41b93){try{if(!_[_0x2abb('0x17')](queues[_0xa41b93[_0x2abb('0x4')]])){utils['debug'](util[_0x2abb('0x2')]('[%s][queues][agentconnect]',_0xa41b93[_0x2abb('0x4')]),_0xa41b93);utils[_0x2abb('0x13')](util[_0x2abb('0x2')]('[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s',_0xa41b93[_0x2abb('0x4')],queues[_0xa41b93[_0x2abb('0x4')]][_0x2abb('0x27')],_0xa41b93[_0x2abb('0x3a')],_0xa41b93['destaccountcode']));queues[_0xa41b93[_0x2abb('0x4')]][_0x2abb('0x19')]=![];queues[_0xa41b93[_0x2abb('0x4')]]['queuecallerabandon']=![];queues[_0xa41b93[_0x2abb('0x4')]][_0x2abb('0x22')]=null;queues[_0xa41b93['uniqueid']][_0x2abb('0x23')]=![];queues[_0xa41b93[_0x2abb('0x4')]][_0x2abb('0x9')]=null;queues[_0xa41b93[_0x2abb('0x4')]]['queuecallerexitAt']=null;queues[_0xa41b93['uniqueid']][_0x2abb('0x3b')]=!![];queues[_0xa41b93[_0x2abb('0x4')]][_0x2abb('0x8')]=_0xa41b93['destaccountcode'];queues[_0xa41b93[_0x2abb('0x4')]]['lastAssignedTo']=_0xa41b93[_0x2abb('0x3a')];}}catch(_0x506a28){utils['error'](util[_0x2abb('0x2')](_0x2abb('0x3c'),_0xa41b93[_0x2abb('0x4')]),_0x506a28);}};exports[_0x2abb('0x3d')]=function(_0x294d90){try{if(!_['isNil'](queues[_0x294d90[_0x2abb('0x4')]])){if(queues[_0x294d90[_0x2abb('0x4')]]['queuecallerleaveAt']){utils['debug'](util['format'](_0x2abb('0x3e'),_0x294d90[_0x2abb('0x4')]),_0x294d90);queues[_0x294d90[_0x2abb('0x4')]][_0x2abb('0x19')]=![];queues[_0x294d90[_0x2abb('0x4')]][_0x2abb('0x19')]=![];queues[_0x294d90[_0x2abb('0x4')]]['queuecallerabandonAt']=null;queues[_0x294d90['uniqueid']][_0x2abb('0x23')]=![];queues[_0x294d90[_0x2abb('0x4')]][_0x2abb('0x24')]=null;queues[_0x294d90['uniqueid']][_0x2abb('0x3b')]=!![];queues[_0x294d90[_0x2abb('0x4')]][_0x2abb('0x6')]=_0x294d90[_0x2abb('0x3a')];queues[_0x294d90[_0x2abb('0x4')]][_0x2abb('0x1a')]=!![];queues[_0x294d90['uniqueid']][_0x2abb('0x1b')]=utils[_0x2abb('0x25')]();if(_0x294d90[_0x2abb('0x3f')]==_0x2abb('0x40')){if(!queues[_0x294d90[_0x2abb('0x4')]][_0x2abb('0x40')]){queues[_0x294d90['uniqueid']][_0x2abb('0x9')]=_0x2abb('0x41');}}else{queues[_0x294d90[_0x2abb('0x4')]][_0x2abb('0x9')]=_0x2abb('0x42')+_0x294d90[_0x2abb('0x3f')][_0x2abb('0x21')]();}utils[_0x2abb('0x13')](util['format']('[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s',_0x294d90['uniqueid'],queues[_0x294d90[_0x2abb('0x4')]][_0x2abb('0x27')],_0x294d90[_0x2abb('0x3a')],queues[_0x294d90[_0x2abb('0x4')]][_0x2abb('0x9')]));writeDB(queues[_0x294d90[_0x2abb('0x4')]]);}}}catch(_0x1b0500){utils[_0x2abb('0x16')](util[_0x2abb('0x2')](_0x2abb('0x3e'),_0x294d90[_0x2abb('0x4')]),_0x1b0500);}};exports[_0x2abb('0x43')]=function(_0x5d06fc){try{if(!_['isNil'](queues[_0x5d06fc[_0x2abb('0x44')]])){utils[_0x2abb('0x11')](util[_0x2abb('0x2')](_0x2abb('0x45'),_0x5d06fc['uniqueid']),_0x5d06fc);queues[_0x5d06fc[_0x2abb('0x44')]][_0x2abb('0x40')]=!![];queues[_0x5d06fc[_0x2abb('0x44')]][_0x2abb('0x46')]='BLIND';queues[_0x5d06fc[_0x2abb('0x44')]][_0x2abb('0x47')]=_0x5d06fc[_0x2abb('0x48')];queues[_0x5d06fc[_0x2abb('0x44')]][_0x2abb('0x49')]=_0x5d06fc[_0x2abb('0x44')];queues[_0x5d06fc[_0x2abb('0x44')]][_0x2abb('0x9')]=_0x2abb('0x4a');utils[_0x2abb('0x13')](util['format'](_0x2abb('0x4b'),_0x5d06fc[_0x2abb('0x4')],queues[_0x5d06fc[_0x2abb('0x44')]]['name'],_0x5d06fc['transfereeuniqueid'],_0x5d06fc[_0x2abb('0x48')]));}}catch(_0xadd9ef){utils[_0x2abb('0x16')](util[_0x2abb('0x2')](_0x2abb('0x45'),_0x5d06fc[_0x2abb('0x4')]),_0xadd9ef);}};exports[_0x2abb('0x4c')]=function(_0x33cdd5){try{utils[_0x2abb('0x11')](util[_0x2abb('0x2')](_0x2abb('0x4d'),_0x33cdd5[_0x2abb('0x4e')]),_0x33cdd5);if(_0x33cdd5[_0x2abb('0x4e')]==_0x33cdd5[_0x2abb('0x4f')]){if(!_[_0x2abb('0x17')](queues[_0x33cdd5[_0x2abb('0x50')]])){utils[_0x2abb('0x13')](util['format'](_0x2abb('0x51'),_0x33cdd5[_0x2abb('0x4e')],queues[_0x33cdd5[_0x2abb('0x50')]][_0x2abb('0x27')],_0x33cdd5[_0x2abb('0x52')]));queues[_0x33cdd5[_0x2abb('0x50')]][_0x2abb('0x40')]=!![];queues[_0x33cdd5[_0x2abb('0x50')]][_0x2abb('0x46')]=_0x2abb('0x53');queues[_0x33cdd5['secondtransfererlinkedid']][_0x2abb('0x47')]=_0x33cdd5[_0x2abb('0x52')];queues[_0x33cdd5[_0x2abb('0x50')]][_0x2abb('0x49')]=_0x33cdd5[_0x2abb('0x4e')];queues[_0x33cdd5['secondtransfererlinkedid']]['queuecallerexitreason']=_0x2abb('0x54');}if(!_[_0x2abb('0x17')](queues[_0x33cdd5[_0x2abb('0x4f')]])){if(_0x33cdd5[_0x2abb('0x55')]&&queues[_0x33cdd5[_0x2abb('0x55')]]){queues[_0x33cdd5[_0x2abb('0x55')]][_0x2abb('0x1c')]=0x1;queues[_0x33cdd5[_0x2abb('0x44')]]=_[_0x2abb('0x56')](queues[_0x33cdd5[_0x2abb('0x55')]]);queues[_0x33cdd5[_0x2abb('0x44')]][_0x2abb('0xf')]=_0x33cdd5[_0x2abb('0x57')];queues[_0x33cdd5[_0x2abb('0x44')]][_0x2abb('0x1c')]=0x2;queues[_0x33cdd5[_0x2abb('0x44')]][_0x2abb('0x7')]=queues[_0x33cdd5[_0x2abb('0x50')]][_0x2abb('0x7')];queues[_0x33cdd5[_0x2abb('0x44')]]['calleridname']=queues[_0x33cdd5[_0x2abb('0x50')]][_0x2abb('0x58')];queues[_0x33cdd5['transfereeuniqueid']][_0x2abb('0x36')]=utils[_0x2abb('0x25')]();queues[_0x33cdd5[_0x2abb('0x44')]][_0x2abb('0x33')]=utils[_0x2abb('0x25')]();queues[_0x33cdd5[_0x2abb('0x44')]][_0x2abb('0x34')]=0x0;queues[_0x33cdd5[_0x2abb('0x44')]][_0x2abb('0x59')]=0x0;utils[_0x2abb('0x13')](util[_0x2abb('0x2')](_0x2abb('0x5a'),_0x33cdd5['origtransfereruniqueid'],queues[_0x33cdd5[_0x2abb('0x44')]][_0x2abb('0x27')],queues[_0x33cdd5[_0x2abb('0x44')]][_0x2abb('0x7')],queues[_0x33cdd5[_0x2abb('0x44')]][_0x2abb('0x58')]));}else{utils[_0x2abb('0x13')](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x33cdd5[_0x2abb('0x4e')],queues[_0x33cdd5[_0x2abb('0x4f')]]['name'],_0x33cdd5[_0x2abb('0x50')]));queues[_0x33cdd5[_0x2abb('0x4f')]]['transfereduniqueid']=_0x33cdd5['secondtransfererlinkedid'];}}}else if(_0x33cdd5[_0x2abb('0x5b')]==_0x33cdd5[_0x2abb('0x50')]){if(!_[_0x2abb('0x17')](queues[_0x33cdd5[_0x2abb('0x4f')]])){utils[_0x2abb('0x13')](util[_0x2abb('0x2')](_0x2abb('0x5c'),_0x33cdd5['origtransfereruniqueid'],queues[_0x33cdd5[_0x2abb('0x4f')]][_0x2abb('0x27')],_0x33cdd5[_0x2abb('0x5b')],_0x33cdd5[_0x2abb('0x5d')]));queues[_0x33cdd5['origtransfererlinkedid']][_0x2abb('0x40')]=!![];queues[_0x33cdd5[_0x2abb('0x4f')]][_0x2abb('0x46')]=_0x2abb('0x53');queues[_0x33cdd5[_0x2abb('0x4f')]][_0x2abb('0x47')]=_0x33cdd5[_0x2abb('0x5d')];queues[_0x33cdd5[_0x2abb('0x4f')]][_0x2abb('0x49')]=_0x33cdd5['secondtransfereruniqueid'];queues[_0x33cdd5[_0x2abb('0x4f')]][_0x2abb('0x9')]=_0x2abb('0x54');}if(!_['isNil'](queues[_0x33cdd5['secondtransfererlinkedid']])){if(_0x33cdd5[_0x2abb('0x5e')]&&queues[_0x33cdd5['transfertargetlinkedid']]){queues[_0x33cdd5[_0x2abb('0x5e')]][_0x2abb('0x1c')]=0x1;queues[_0x33cdd5[_0x2abb('0x57')]]=_['clone'](queues[_0x33cdd5[_0x2abb('0x5e')]]);queues[_0x33cdd5['transfertargetuniqueid']][_0x2abb('0xf')]=_0x33cdd5[_0x2abb('0x57')];queues[_0x33cdd5[_0x2abb('0x57')]][_0x2abb('0x1c')]=0x2;queues[_0x33cdd5[_0x2abb('0x57')]]['calleridnum']=queues[_0x33cdd5['origtransfererlinkedid']][_0x2abb('0x7')];queues[_0x33cdd5[_0x2abb('0x57')]]['calleridname']=queues[_0x33cdd5[_0x2abb('0x4f')]]['calleridname'];queues[_0x33cdd5[_0x2abb('0x57')]][_0x2abb('0x36')]=utils[_0x2abb('0x25')]();queues[_0x33cdd5[_0x2abb('0x57')]][_0x2abb('0x33')]=utils[_0x2abb('0x25')]();queues[_0x33cdd5['transfertargetuniqueid']][_0x2abb('0x34')]=0x0;queues[_0x33cdd5['transfertargetuniqueid']]['mohtime']=0x0;utils[_0x2abb('0x13')](util[_0x2abb('0x2')](_0x2abb('0x5f'),_0x33cdd5[_0x2abb('0x4e')],queues[_0x33cdd5[_0x2abb('0x57')]][_0x2abb('0x27')],queues[_0x33cdd5[_0x2abb('0x57')]][_0x2abb('0xf')],queues[_0x33cdd5[_0x2abb('0x57')]][_0x2abb('0x7')],queues[_0x33cdd5[_0x2abb('0x57')]][_0x2abb('0x58')]));}else{utils[_0x2abb('0x13')](util['format'](_0x2abb('0x60'),_0x33cdd5['origtransfereruniqueid'],queues[_0x33cdd5[_0x2abb('0x50')]]['name'],_0x33cdd5[_0x2abb('0x4f')]));queues[_0x33cdd5[_0x2abb('0x50')]]['transfereduniqueid']=_0x33cdd5[_0x2abb('0x4f')];}}}}catch(_0x2a3aeb){utils[_0x2abb('0x16')](util[_0x2abb('0x2')](_0x2abb('0x4d'),_0x33cdd5[_0x2abb('0x4e')]),_0x2a3aeb);}};exports['musiconholdstart']=function(_0xc088b9){try{if(!_[_0x2abb('0x17')](queues[_0xc088b9[_0x2abb('0x4')]])){utils[_0x2abb('0x11')](util['format'](_0x2abb('0x61'),_0xc088b9['uniqueid']),_0xc088b9);queues[_0xc088b9[_0x2abb('0x4')]]['musiconholdstartAt']=utils[_0x2abb('0x25')]();utils[_0x2abb('0x13')](util['format'](_0x2abb('0x62'),_0xc088b9[_0x2abb('0x4')],queues[_0xc088b9[_0x2abb('0x4')]][_0x2abb('0x27')],queues[_0xc088b9[_0x2abb('0x4')]][_0x2abb('0x63')]));}}catch(_0x3617ce){utils[_0x2abb('0x16')](util[_0x2abb('0x2')](_0x2abb('0x61'),_0xc088b9[_0x2abb('0x4')]),_0x3617ce);}};exports['musiconholdstop']=function(_0x58e441){try{if(!_[_0x2abb('0x17')](queues[_0x58e441['uniqueid']])){if(!_[_0x2abb('0x17')](queues[_0x58e441[_0x2abb('0x4')]][_0x2abb('0x63')])){utils[_0x2abb('0x11')](util[_0x2abb('0x2')](_0x2abb('0x64'),_0x58e441[_0x2abb('0x4')]),_0x58e441);queues[_0x58e441[_0x2abb('0x4')]][_0x2abb('0x59')]+=utils[_0x2abb('0x35')](utils[_0x2abb('0x25')](),queues[_0x58e441[_0x2abb('0x4')]][_0x2abb('0x63')]);utils[_0x2abb('0x13')](util[_0x2abb('0x2')]('[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s',_0x58e441['uniqueid'],queues[_0x58e441['uniqueid']][_0x2abb('0x27')],queues[_0x58e441[_0x2abb('0x4')]][_0x2abb('0x59')]));delete queues[_0x58e441[_0x2abb('0x4')]][_0x2abb('0x63')];}}}catch(_0x32e16f){utils[_0x2abb('0x16')](util[_0x2abb('0x2')]('[%s][queues][musiconholdstop]',_0x58e441[_0x2abb('0x4')]),_0x32e16f);}}; \ No newline at end of file +var _0x24f0=['musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','./utils','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','lastAssignedTo','calleridnum','accountcode','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','debug','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','now','hangup','isNil','[%s][queues][hangup]','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','queuecallerexitreason','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','varset','[%s][queues][varset]','queuestatus','toUpperCase','queuecallerabandonAt','queuecallerexitAt','value','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','variable','queueposition','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','error','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','queuecallerleaveAt','holdtime','diffTime','queuecallerjoinAt','count','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','destaccountcode','assigned','[%s][queues][agentcomplete]','membername','reason','transfer','COMPLETEDBY','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','BLIND','transferexten','extension','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','origtransfererexten','transfertype','ATTENDED','ATTENDEDTRANSFER','transfereelinkedid','queuecallerenterreason','clone','transfertargetuniqueid','calleridname','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transferuniqueid','transfertargetlinkedid','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s'];(function(_0x46770b,_0x4cfd1e){var _0x20f7c2=function(_0x319a86){while(--_0x319a86){_0x46770b['push'](_0x46770b['shift']());}};_0x20f7c2(++_0x4cfd1e);}(_0x24f0,0xd1));var _0x024f=function(_0x5f0027,_0x276f5e){_0x5f0027=_0x5f0027-0x0;var _0x4329e8=_0x24f0[_0x5f0027];return _0x4329e8;};'use strict';var _=require(_0x024f('0x0'));var util=require('util');var utils=require(_0x024f('0x1'));var queues={};function writeDB(_0x239538){utils[_0x024f('0x2')](util[_0x024f('0x3')](_0x024f('0x4'),_0x239538[_0x024f('0x5')],_0x239538[_0x024f('0x6')],_0x239538[_0x024f('0x7')],_0x239538[_0x024f('0x8')],_0x239538[_0x024f('0x9')],_0x239538[_0x024f('0xa')],_0x239538['queuecallerexitreason']));if(_0x239538['queue']){utils[_0x024f('0xb')](_0x239538[_0x024f('0x7')])[_0x024f('0xc')](function(_0x57473f){if(_0x57473f){_0x239538[_0x024f('0xd')]=_0x57473f[_0x024f('0xd')];}utils[_0x024f('0xe')](_0x024f('0xf'),_0x239538);});}else{utils['request'](_0x024f('0xf'),_0x239538);}if(_0x239538[_0x024f('0x10')]){delete queues[_0x239538[_0x024f('0x10')]];}else{delete queues[_0x239538[_0x024f('0x5')]];}}exports['queuecallerjoin']=function(_0x14a056){try{utils[_0x024f('0x11')](util[_0x024f('0x3')](_0x024f('0x12'),_0x14a056[_0x024f('0x5')]),_0x14a056);utils['info'](util[_0x024f('0x3')](_0x024f('0x13'),_0x14a056[_0x024f('0x5')],_0x14a056[_0x024f('0x7')],_0x14a056[_0x024f('0x14')]));queues[_0x14a056['uniqueid']]=_['assign'](_0x14a056,{'originalposition':_0x14a056[_0x024f('0x14')],'queuecallerjoinAt':utils[_0x024f('0x15')](),'mohtime':0x0});}catch(_0xa5926b){utils['error'](util[_0x024f('0x3')](_0x024f('0x12'),_0x14a056['uniqueid']),_0xa5926b);}};exports[_0x024f('0x16')]=function(_0x1a29f5){try{if(!_[_0x024f('0x17')](queues[_0x1a29f5[_0x024f('0x5')]])){utils[_0x024f('0x11')](util[_0x024f('0x3')](_0x024f('0x18'),_0x1a29f5[_0x024f('0x5')]),_0x1a29f5);if(queues[_0x1a29f5['uniqueid']]['queuecallerleaveAt']){if(!queues[_0x1a29f5[_0x024f('0x5')]][_0x024f('0x19')]&&!queues[_0x1a29f5['uniqueid']][_0x024f('0x1a')]){queues[_0x1a29f5['uniqueid']][_0x024f('0x1b')]=!![];queues[_0x1a29f5[_0x024f('0x5')]][_0x024f('0x1c')]=utils[_0x024f('0x15')]();queues[_0x1a29f5['uniqueid']][_0x024f('0x1d')]='COMPLETEDBYAGENT';}utils[_0x024f('0x2')](util[_0x024f('0x3')](_0x024f('0x1e'),_0x1a29f5[_0x024f('0x5')],queues[_0x1a29f5[_0x024f('0x5')]][_0x024f('0x1f')],queues[_0x1a29f5['uniqueid']][_0x024f('0x1d')]));writeDB(queues[_0x1a29f5[_0x024f('0x5')]]);}else if(queues[_0x1a29f5[_0x024f('0x5')]][_0x024f('0x10')]){utils[_0x024f('0x2')](util[_0x024f('0x3')]('[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s',_0x1a29f5[_0x024f('0x5')],queues[_0x1a29f5['uniqueid']]['name'],queues[_0x1a29f5[_0x024f('0x5')]][_0x024f('0x10')]));queues[queues[_0x1a29f5['uniqueid']][_0x024f('0x10')]]=queues[_0x1a29f5[_0x024f('0x5')]];queues[queues[_0x1a29f5[_0x024f('0x5')]][_0x024f('0x10')]]['queuecallerenterreason']=0x2;delete queues[_0x1a29f5[_0x024f('0x5')]];}}}catch(_0x37d8a3){utils['error'](util[_0x024f('0x3')](_0x024f('0x18'),_0x1a29f5['uniqueid']),_0x37d8a3);}};exports[_0x024f('0x20')]=function(_0x23f94e){try{utils[_0x024f('0x11')](util[_0x024f('0x3')](_0x024f('0x21'),_0x23f94e[_0x024f('0x5')]),_0x23f94e);if(!_[_0x024f('0x17')](_0x23f94e['variable'][_0x024f('0x22')])&&_0x23f94e['value'][_0x024f('0x23')]()!=='CONTINUE'){if(!_['isNil'](queues[_0x23f94e[_0x024f('0x5')]])){queues[_0x23f94e[_0x024f('0x5')]][_0x024f('0x19')]=![];queues[_0x23f94e['uniqueid']][_0x024f('0x24')]=null;queues[_0x23f94e[_0x024f('0x5')]][_0x024f('0x1a')]=!![];queues[_0x23f94e[_0x024f('0x5')]][_0x024f('0x25')]=utils[_0x024f('0x15')]();queues[_0x23f94e[_0x024f('0x5')]][_0x024f('0x1d')]=_0x23f94e[_0x024f('0x26')][_0x024f('0x23')]();utils['info'](util[_0x024f('0x3')](_0x024f('0x27'),_0x23f94e[_0x024f('0x5')],queues[_0x23f94e[_0x024f('0x5')]][_0x024f('0x1f')],_0x23f94e[_0x024f('0x26')],queues[_0x23f94e[_0x024f('0x5')]]['queuecallerexitreason']));writeDB(queues[_0x23f94e[_0x024f('0x5')]]);}}else if(!_[_0x024f('0x17')](_0x23f94e[_0x024f('0x28')][_0x024f('0x29')])){if(!_[_0x024f('0x17')](queues[_0x23f94e[_0x024f('0x5')]])&&!queues[_0x23f94e['uniqueid']]['queuecallerabandon']){queues[_0x23f94e['uniqueid']][_0x024f('0x19')]=![];queues[_0x23f94e[_0x024f('0x5')]][_0x024f('0x24')]=null;queues[_0x23f94e[_0x024f('0x5')]][_0x024f('0x1a')]=!![];queues[_0x23f94e['uniqueid']][_0x024f('0x25')]=utils[_0x024f('0x15')]();queues[_0x23f94e[_0x024f('0x5')]]['queuecallerexitreason']='EXITWITHKEY';utils['info'](util[_0x024f('0x3')](_0x024f('0x2a'),_0x23f94e[_0x024f('0x5')],queues[_0x23f94e[_0x024f('0x5')]][_0x024f('0x1f')],_0x23f94e[_0x024f('0x26')],queues[_0x23f94e[_0x024f('0x5')]][_0x024f('0x1d')]));}}}catch(_0x1fb21d){utils[_0x024f('0x2b')](util[_0x024f('0x3')](_0x024f('0x21'),_0x23f94e[_0x024f('0x5')]),_0x1fb21d);}};exports[_0x024f('0x19')]=function(_0x499c7e){try{if(!_['isNil'](queues[_0x499c7e['uniqueid']])){utils[_0x024f('0x11')](util[_0x024f('0x3')](_0x024f('0x2c'),_0x499c7e[_0x024f('0x5')]),_0x499c7e);queues[_0x499c7e[_0x024f('0x5')]][_0x024f('0x1a')]=![];queues[_0x499c7e[_0x024f('0x5')]][_0x024f('0x25')]=null;queues[_0x499c7e[_0x024f('0x5')]][_0x024f('0x19')]=!![];queues[_0x499c7e[_0x024f('0x5')]][_0x024f('0x24')]=utils['now']();queues[_0x499c7e[_0x024f('0x5')]]['queuecallerexitreason']=_0x024f('0x2d');utils['info'](util[_0x024f('0x3')](_0x024f('0x2e'),_0x499c7e[_0x024f('0x5')],queues[_0x499c7e['uniqueid']][_0x024f('0x1f')],queues[_0x499c7e[_0x024f('0x5')]]['queuecallerexitreason']));}}catch(_0x24a60c){utils[_0x024f('0x2b')](util[_0x024f('0x3')](_0x024f('0x2c'),_0x499c7e[_0x024f('0x5')]),_0x24a60c);}};exports[_0x024f('0x2f')]=function(_0x62daf8){try{if(!_[_0x024f('0x17')](queues[_0x62daf8[_0x024f('0x5')]])){utils['debug'](util[_0x024f('0x3')](_0x024f('0x30'),_0x62daf8['uniqueid']),_0x62daf8);utils[_0x024f('0x2')](util['format'](_0x024f('0x31'),_0x62daf8[_0x024f('0x5')],queues[_0x62daf8['uniqueid']][_0x024f('0x1f')],_0x62daf8[_0x024f('0x32')],_0x62daf8[_0x024f('0x33')]));queues[_0x62daf8['uniqueid']][_0x024f('0x2f')]=!![];queues[_0x62daf8[_0x024f('0x5')]][_0x024f('0x34')]=utils[_0x024f('0x15')]();queues[_0x62daf8[_0x024f('0x5')]][_0x024f('0x35')]=utils[_0x024f('0x36')](queues[_0x62daf8[_0x024f('0x5')]][_0x024f('0x34')],queues[_0x62daf8[_0x024f('0x5')]][_0x024f('0x37')]);queues[_0x62daf8['uniqueid']][_0x024f('0x14')]=_0x62daf8[_0x024f('0x14')];queues[_0x62daf8[_0x024f('0x5')]][_0x024f('0x38')]=_0x62daf8[_0x024f('0x38')];queues[_0x62daf8[_0x024f('0x5')]]['connectedlinenum']=_0x62daf8['connectedlinenum'];queues[_0x62daf8[_0x024f('0x5')]][_0x024f('0x33')]=_0x62daf8['connectedlinename'];}}catch(_0x482c29){utils[_0x024f('0x2b')](util[_0x024f('0x3')](_0x024f('0x30'),_0x62daf8[_0x024f('0x5')]),_0x482c29);}};exports[_0x024f('0x39')]=function(_0x181416){try{if(!_[_0x024f('0x17')](queues[_0x181416[_0x024f('0x5')]])){utils[_0x024f('0x11')](util[_0x024f('0x3')](_0x024f('0x3a'),_0x181416['uniqueid']),_0x181416);utils[_0x024f('0x2')](util[_0x024f('0x3')](_0x024f('0x3b'),_0x181416[_0x024f('0x5')],queues[_0x181416[_0x024f('0x5')]][_0x024f('0x1f')],_0x181416['membername'],_0x181416[_0x024f('0x3c')]));queues[_0x181416[_0x024f('0x5')]][_0x024f('0x19')]=![];queues[_0x181416[_0x024f('0x5')]]['queuecallerabandon']=![];queues[_0x181416['uniqueid']][_0x024f('0x24')]=null;queues[_0x181416['uniqueid']]['queuecallerexit']=![];queues[_0x181416[_0x024f('0x5')]][_0x024f('0x1d')]=null;queues[_0x181416['uniqueid']][_0x024f('0x25')]=null;queues[_0x181416[_0x024f('0x5')]][_0x024f('0x3d')]=!![];queues[_0x181416[_0x024f('0x5')]][_0x024f('0xa')]=_0x181416[_0x024f('0x3c')];queues[_0x181416[_0x024f('0x5')]]['lastAssignedTo']=_0x181416['membername'];}}catch(_0x35952b){utils[_0x024f('0x2b')](util[_0x024f('0x3')](_0x024f('0x3a'),_0x181416[_0x024f('0x5')]),_0x35952b);}};exports['agentcomplete']=function(_0x2a5e99){try{if(!_[_0x024f('0x17')](queues[_0x2a5e99[_0x024f('0x5')]])){if(queues[_0x2a5e99[_0x024f('0x5')]][_0x024f('0x34')]){utils[_0x024f('0x11')](util['format'](_0x024f('0x3e'),_0x2a5e99[_0x024f('0x5')]),_0x2a5e99);queues[_0x2a5e99[_0x024f('0x5')]][_0x024f('0x19')]=![];queues[_0x2a5e99[_0x024f('0x5')]][_0x024f('0x19')]=![];queues[_0x2a5e99[_0x024f('0x5')]][_0x024f('0x24')]=null;queues[_0x2a5e99[_0x024f('0x5')]][_0x024f('0x1a')]=![];queues[_0x2a5e99[_0x024f('0x5')]][_0x024f('0x25')]=null;queues[_0x2a5e99['uniqueid']][_0x024f('0x3d')]=!![];queues[_0x2a5e99[_0x024f('0x5')]]['lastAssignedTo']=_0x2a5e99[_0x024f('0x3f')];queues[_0x2a5e99[_0x024f('0x5')]][_0x024f('0x1b')]=!![];queues[_0x2a5e99['uniqueid']][_0x024f('0x1c')]=utils[_0x024f('0x15')]();if(_0x2a5e99[_0x024f('0x40')]==_0x024f('0x41')){if(!queues[_0x2a5e99[_0x024f('0x5')]]['transfer']){queues[_0x2a5e99[_0x024f('0x5')]][_0x024f('0x1d')]='TRANSFER';}}else{queues[_0x2a5e99[_0x024f('0x5')]]['queuecallerexitreason']=_0x024f('0x42')+_0x2a5e99[_0x024f('0x40')][_0x024f('0x23')]();}utils[_0x024f('0x2')](util[_0x024f('0x3')]('[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s',_0x2a5e99[_0x024f('0x5')],queues[_0x2a5e99['uniqueid']][_0x024f('0x1f')],_0x2a5e99[_0x024f('0x3f')],queues[_0x2a5e99[_0x024f('0x5')]][_0x024f('0x1d')]));writeDB(queues[_0x2a5e99[_0x024f('0x5')]]);}}}catch(_0x2535d6){utils['error'](util['format']('[%s][queues][agentcomplete]',_0x2a5e99[_0x024f('0x5')]),_0x2535d6);}};exports[_0x024f('0x43')]=function(_0x23c317){try{if(!_[_0x024f('0x17')](queues[_0x23c317[_0x024f('0x44')]])){utils[_0x024f('0x11')](util[_0x024f('0x3')](_0x024f('0x45'),_0x23c317[_0x024f('0x5')]),_0x23c317);queues[_0x23c317[_0x024f('0x44')]][_0x024f('0x41')]=!![];queues[_0x23c317[_0x024f('0x44')]]['transfertype']=_0x024f('0x46');queues[_0x23c317[_0x024f('0x44')]][_0x024f('0x47')]=_0x23c317[_0x024f('0x48')];queues[_0x23c317[_0x024f('0x44')]]['transferuniqueid']=_0x23c317[_0x024f('0x44')];queues[_0x23c317[_0x024f('0x44')]][_0x024f('0x1d')]=_0x024f('0x49');utils['info'](util[_0x024f('0x3')](_0x024f('0x4a'),_0x23c317[_0x024f('0x5')],queues[_0x23c317[_0x024f('0x44')]][_0x024f('0x1f')],_0x23c317[_0x024f('0x44')],_0x23c317[_0x024f('0x48')]));}}catch(_0x23364a){utils['error'](util['format'](_0x024f('0x45'),_0x23c317[_0x024f('0x5')]),_0x23364a);}};exports['attendedtransfer']=function(_0x4fac27){try{utils['debug'](util[_0x024f('0x3')]('[%s][queues][attendedtransfer]',_0x4fac27[_0x024f('0x4b')]),_0x4fac27);if(_0x4fac27[_0x024f('0x4b')]==_0x4fac27[_0x024f('0x4c')]){if(!_[_0x024f('0x17')](queues[_0x4fac27[_0x024f('0x4d')]])){utils[_0x024f('0x2')](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x4fac27[_0x024f('0x4b')],queues[_0x4fac27[_0x024f('0x4d')]][_0x024f('0x1f')],_0x4fac27[_0x024f('0x4e')]));queues[_0x4fac27[_0x024f('0x4d')]][_0x024f('0x41')]=!![];queues[_0x4fac27[_0x024f('0x4d')]][_0x024f('0x4f')]=_0x024f('0x50');queues[_0x4fac27[_0x024f('0x4d')]][_0x024f('0x47')]=_0x4fac27[_0x024f('0x4e')];queues[_0x4fac27[_0x024f('0x4d')]]['transferuniqueid']=_0x4fac27['origtransfereruniqueid'];queues[_0x4fac27[_0x024f('0x4d')]]['queuecallerexitreason']=_0x024f('0x51');}if(!_[_0x024f('0x17')](queues[_0x4fac27[_0x024f('0x4c')]])){if(_0x4fac27[_0x024f('0x52')]&&queues[_0x4fac27[_0x024f('0x52')]]){queues[_0x4fac27[_0x024f('0x52')]][_0x024f('0x53')]=0x1;queues[_0x4fac27[_0x024f('0x44')]]=_[_0x024f('0x54')](queues[_0x4fac27[_0x024f('0x52')]]);queues[_0x4fac27[_0x024f('0x44')]]['transfereduniqueid']=_0x4fac27[_0x024f('0x55')];queues[_0x4fac27[_0x024f('0x44')]][_0x024f('0x53')]=0x2;queues[_0x4fac27[_0x024f('0x44')]][_0x024f('0x9')]=queues[_0x4fac27[_0x024f('0x4d')]][_0x024f('0x9')];queues[_0x4fac27[_0x024f('0x44')]][_0x024f('0x56')]=queues[_0x4fac27[_0x024f('0x4d')]]['calleridname'];queues[_0x4fac27[_0x024f('0x44')]][_0x024f('0x37')]=utils['now']();queues[_0x4fac27[_0x024f('0x44')]][_0x024f('0x34')]=utils['now']();queues[_0x4fac27[_0x024f('0x44')]][_0x024f('0x35')]=0x0;queues[_0x4fac27[_0x024f('0x44')]]['mohtime']=0x0;utils['info'](util[_0x024f('0x3')](_0x024f('0x57'),_0x4fac27[_0x024f('0x4b')],queues[_0x4fac27[_0x024f('0x44')]][_0x024f('0x1f')],queues[_0x4fac27[_0x024f('0x44')]]['calleridnum'],queues[_0x4fac27[_0x024f('0x44')]]['calleridname']));}else{utils[_0x024f('0x2')](util['format'](_0x024f('0x58'),_0x4fac27[_0x024f('0x4b')],queues[_0x4fac27[_0x024f('0x4c')]][_0x024f('0x1f')],_0x4fac27[_0x024f('0x4d')]));queues[_0x4fac27[_0x024f('0x4c')]][_0x024f('0x10')]=_0x4fac27[_0x024f('0x4d')];}}}else if(_0x4fac27[_0x024f('0x59')]==_0x4fac27[_0x024f('0x4d')]){if(!_['isNil'](queues[_0x4fac27['origtransfererlinkedid']])){utils['info'](util['format'](_0x024f('0x5a'),_0x4fac27['origtransfereruniqueid'],queues[_0x4fac27['origtransfererlinkedid']][_0x024f('0x1f')],_0x4fac27[_0x024f('0x59')],_0x4fac27[_0x024f('0x5b')]));queues[_0x4fac27[_0x024f('0x4c')]][_0x024f('0x41')]=!![];queues[_0x4fac27[_0x024f('0x4c')]][_0x024f('0x4f')]=_0x024f('0x50');queues[_0x4fac27[_0x024f('0x4c')]]['transferexten']=_0x4fac27[_0x024f('0x5b')];queues[_0x4fac27[_0x024f('0x4c')]][_0x024f('0x5c')]=_0x4fac27[_0x024f('0x59')];queues[_0x4fac27['origtransfererlinkedid']][_0x024f('0x1d')]=_0x024f('0x51');}if(!_[_0x024f('0x17')](queues[_0x4fac27[_0x024f('0x4d')]])){if(_0x4fac27[_0x024f('0x5d')]&&queues[_0x4fac27['transfertargetlinkedid']]){queues[_0x4fac27[_0x024f('0x5d')]][_0x024f('0x53')]=0x1;queues[_0x4fac27[_0x024f('0x55')]]=_[_0x024f('0x54')](queues[_0x4fac27['transfertargetlinkedid']]);queues[_0x4fac27[_0x024f('0x55')]][_0x024f('0x10')]=_0x4fac27[_0x024f('0x55')];queues[_0x4fac27['transfertargetuniqueid']][_0x024f('0x53')]=0x2;queues[_0x4fac27[_0x024f('0x55')]][_0x024f('0x9')]=queues[_0x4fac27[_0x024f('0x4c')]][_0x024f('0x9')];queues[_0x4fac27[_0x024f('0x55')]][_0x024f('0x56')]=queues[_0x4fac27[_0x024f('0x4c')]]['calleridname'];queues[_0x4fac27[_0x024f('0x55')]]['queuecallerjoinAt']=utils[_0x024f('0x15')]();queues[_0x4fac27[_0x024f('0x55')]][_0x024f('0x34')]=utils[_0x024f('0x15')]();queues[_0x4fac27['transfertargetuniqueid']][_0x024f('0x35')]=0x0;queues[_0x4fac27[_0x024f('0x55')]][_0x024f('0x5e')]=0x0;utils[_0x024f('0x2')](util['format'](_0x024f('0x5f'),_0x4fac27[_0x024f('0x4b')],queues[_0x4fac27[_0x024f('0x55')]]['name'],queues[_0x4fac27['transfertargetuniqueid']][_0x024f('0x10')],queues[_0x4fac27[_0x024f('0x55')]][_0x024f('0x9')],queues[_0x4fac27[_0x024f('0x55')]]['calleridname']));}else{utils[_0x024f('0x2')](util[_0x024f('0x3')](_0x024f('0x58'),_0x4fac27[_0x024f('0x4b')],queues[_0x4fac27[_0x024f('0x4d')]][_0x024f('0x1f')],_0x4fac27[_0x024f('0x4c')]));queues[_0x4fac27[_0x024f('0x4d')]]['transfereduniqueid']=_0x4fac27[_0x024f('0x4c')];}}}}catch(_0x244a2f){utils[_0x024f('0x2b')](util[_0x024f('0x3')]('[%s][queues][attendedtransfer]',_0x4fac27[_0x024f('0x4b')]),_0x244a2f);}};exports[_0x024f('0x60')]=function(_0x3304bf){try{if(!_[_0x024f('0x17')](queues[_0x3304bf[_0x024f('0x5')]])){utils[_0x024f('0x11')](util[_0x024f('0x3')](_0x024f('0x61'),_0x3304bf[_0x024f('0x5')]),_0x3304bf);queues[_0x3304bf[_0x024f('0x5')]][_0x024f('0x62')]=utils[_0x024f('0x15')]();utils[_0x024f('0x2')](util[_0x024f('0x3')](_0x024f('0x63'),_0x3304bf[_0x024f('0x5')],queues[_0x3304bf[_0x024f('0x5')]][_0x024f('0x1f')],queues[_0x3304bf['uniqueid']][_0x024f('0x62')]));}}catch(_0x47d0a2){utils[_0x024f('0x2b')](util[_0x024f('0x3')](_0x024f('0x61'),_0x3304bf['uniqueid']),_0x47d0a2);}};exports[_0x024f('0x64')]=function(_0x5b9875){try{if(!_[_0x024f('0x17')](queues[_0x5b9875['uniqueid']])){if(!_[_0x024f('0x17')](queues[_0x5b9875[_0x024f('0x5')]][_0x024f('0x62')])){utils[_0x024f('0x11')](util[_0x024f('0x3')](_0x024f('0x65'),_0x5b9875[_0x024f('0x5')]),_0x5b9875);queues[_0x5b9875['uniqueid']][_0x024f('0x5e')]+=utils[_0x024f('0x36')](utils[_0x024f('0x15')](),queues[_0x5b9875['uniqueid']][_0x024f('0x62')]);utils[_0x024f('0x2')](util['format'](_0x024f('0x66'),_0x5b9875[_0x024f('0x5')],queues[_0x5b9875[_0x024f('0x5')]]['name'],queues[_0x5b9875[_0x024f('0x5')]][_0x024f('0x5e')]));delete queues[_0x5b9875[_0x024f('0x5')]][_0x024f('0x62')];}}}catch(_0x1a4af7){utils[_0x024f('0x2b')](util[_0x024f('0x3')](_0x024f('0x65'),_0x5b9875[_0x024f('0x5')]),_0x1a4af7);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index aebd5a7..dd605e9 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 _0xf48d=['then','membername','name','UserId','request','CreateVoiceRecording','blinds','newchannel','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','error','[%s][recordings][newchannel]','newstate','debug','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','transfer','varset','variable','[%s][recordings][varset]\x20variable:%s\x20value:%s','endsWith','value','.wav49','.WAV','find','monitors','push','[%s][recordings][varset]','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridname','cause-txt','calleridnum','connectedlinenum','connectedlinename','type','outbound','forEach','clone','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','appdata','application','toLowerCase','set','startsWith','cdr','split','substring','lastIndexOf','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','blindtransfer','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','transfereruniqueid','recording','[%s][recordings][blindtransfer]','lodash','./utils','./transfers.controller','info','format','[%s][recordings][writeDB]','uniqueid','accountcode'];(function(_0x3cd2ea,_0xf3bf4d){var _0x1acc13=function(_0x42e499){while(--_0x42e499){_0x3cd2ea['push'](_0x3cd2ea['shift']());}};_0x1acc13(++_0xf3bf4d);}(_0xf48d,0x174));var _0xdf48=function(_0x968411,_0x151619){_0x968411=_0x968411-0x0;var _0x46e3e5=_0xf48d[_0x968411];return _0x46e3e5;};'use strict';var _=require(_0xdf48('0x0'));var util=require('util');var utils=require(_0xdf48('0x1'));var transfers=require(_0xdf48('0x2'));var recordings={};function writeDB(_0x17fa9e){var _0x5d9414;utils[_0xdf48('0x3')](util[_0xdf48('0x4')](_0xdf48('0x5'),_0x17fa9e['uniqueid']));if(transfers['blinds'][_0x17fa9e[_0xdf48('0x6')]]){_0x5d9414=_0x17fa9e['uniqueid'];_0x17fa9e[_0xdf48('0x6')]=transfers['blinds'][_0x17fa9e[_0xdf48('0x6')]]['transfereeuniqueid'];}if(_0x17fa9e[_0xdf48('0x7')]){utils['getUserByInternal'](_0x17fa9e[_0xdf48('0x7')])[_0xdf48('0x8')](function(_0x3b6308){if(_0x3b6308){_0x17fa9e[_0xdf48('0x9')]=_0x3b6308[_0xdf48('0xa')];_0x17fa9e[_0xdf48('0xb')]=_0x3b6308['id'];}utils[_0xdf48('0xc')]('CreateVoiceRecording',_0x17fa9e);});}else{utils[_0xdf48('0xc')](_0xdf48('0xd'),_0x17fa9e);}if(_0x5d9414)delete transfers[_0xdf48('0xe')][_0x5d9414];}exports[_0xdf48('0xf')]=function(_0x1eea4f){try{utils['debug'](util['format']('[%s][recordings][newchannel]',_0x1eea4f[_0xdf48('0x6')]),_0x1eea4f);if(_0x1eea4f[_0xdf48('0x6')]==_0x1eea4f[_0xdf48('0x10')]){utils[_0xdf48('0x3')](util[_0xdf48('0x4')](_0xdf48('0x11'),_0x1eea4f['uniqueid'],_0x1eea4f[_0xdf48('0x12')],_0x1eea4f['exten']));recordings[_0x1eea4f['uniqueid']]={'uniqueid':_0x1eea4f[_0xdf48('0x6')],'accountcode':_0x1eea4f[_0xdf48('0x7')],'exten':_0x1eea4f[_0xdf48('0x13')],'context':_0x1eea4f['context'],'channel':_0x1eea4f[_0xdf48('0x14')],'monitors':[]};}}catch(_0x41e538){utils[_0xdf48('0x15')](util[_0xdf48('0x4')](_0xdf48('0x16'),_0x1eea4f[_0xdf48('0x6')]),_0x41e538);}};exports[_0xdf48('0x17')]=function(_0x487c1a){try{utils[_0xdf48('0x18')](util['format'](_0xdf48('0x19'),_0x487c1a[_0xdf48('0x6')]),_0x487c1a);if(!_[_0xdf48('0x1a')](recordings[_0x487c1a[_0xdf48('0x6')]])&&_0x487c1a[_0xdf48('0x1b')]==0x6){utils[_0xdf48('0x3')](util[_0xdf48('0x4')](_0xdf48('0x1c'),_0x487c1a['uniqueid'],_0x487c1a[_0xdf48('0x12')],_0x487c1a[_0xdf48('0x14')]));}else if(!_[_0xdf48('0x1a')](recordings[_0x487c1a['linkedid']])&&_0x487c1a['channelstate']==0x6&&_0x487c1a[_0xdf48('0x12')]!=_0xdf48('0x1d')){utils[_0xdf48('0x3')](util[_0xdf48('0x4')]('[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x487c1a['uniqueid'],_0x487c1a[_0xdf48('0x10')],_0x487c1a[_0xdf48('0x12')],_0x487c1a[_0xdf48('0x14')]));recordings[_0x487c1a['linkedid']][_0xdf48('0x7')]=_0x487c1a['accountcode'];}}catch(_0x9e50b7){utils[_0xdf48('0x15')](util['format'](_0xdf48('0x19'),_0x487c1a[_0xdf48('0x6')]),_0x9e50b7);}};exports[_0xdf48('0x1e')]=function(_0x53fb39){try{if(!_['isNil'](_0x53fb39[_0xdf48('0x1f')])&&!_['isNil'](_0x53fb39[_0xdf48('0x1f')]['mixmonitor_filename'])){utils[_0xdf48('0x18')](util[_0xdf48('0x4')]('[%s][recordings][varset]',_0x53fb39['uniqueid']),_0x53fb39);utils[_0xdf48('0x3')](util[_0xdf48('0x4')](_0xdf48('0x20'),_0x53fb39[_0xdf48('0x6')],_0x53fb39['variable'],_0x53fb39['value']));if(_[_0xdf48('0x21')](_0x53fb39[_0xdf48('0x22')],_0xdf48('0x23'))){_0x53fb39[_0xdf48('0x22')]=_0x53fb39[_0xdf48('0x22')]['replace'](_0xdf48('0x23'),_0xdf48('0x24'));}if(recordings[_0x53fb39[_0xdf48('0x10')]]){var _0xe6234=_[_0xdf48('0x25')](recordings[_0x53fb39[_0xdf48('0x10')]][_0xdf48('0x26')],{'value':_0x53fb39[_0xdf48('0x22')]});if(_[_0xdf48('0x1a')](_0xe6234)){recordings[_0x53fb39['linkedid']][_0xdf48('0x26')][_0xdf48('0x27')]({'value':_0x53fb39['value']});}}}}catch(_0x527558){utils[_0xdf48('0x15')](util[_0xdf48('0x4')](_0xdf48('0x28'),_0x53fb39['uniqueid']),_0x527558);}};exports[_0xdf48('0x29')]=function(_0x251cf3){try{if(!_[_0xdf48('0x1a')](recordings[_0x251cf3['uniqueid']])){utils[_0xdf48('0x18')](util['format'](_0xdf48('0x2a'),_0x251cf3[_0xdf48('0x6')]),_0x251cf3);utils['info'](util[_0xdf48('0x4')](_0xdf48('0x2b'),_0x251cf3[_0xdf48('0x6')],_0x251cf3['calleridnum'],_0x251cf3[_0xdf48('0x2c')],_0x251cf3[_0xdf48('0x2d')]));recordings[_0x251cf3['uniqueid']][_0xdf48('0x2e')]=_0x251cf3[_0xdf48('0x2e')];recordings[_0x251cf3[_0xdf48('0x6')]]['calleridname']=_0x251cf3['calleridname'];recordings[_0x251cf3[_0xdf48('0x6')]]['connectedlinenum']=_0x251cf3[_0xdf48('0x2f')];recordings[_0x251cf3['uniqueid']][_0xdf48('0x30')]=_0x251cf3[_0xdf48('0x30')];if(recordings[_0x251cf3[_0xdf48('0x6')]][_0xdf48('0x31')]==_0xdf48('0x32')&&recordings[_0x251cf3[_0xdf48('0x6')]][_0xdf48('0x7')]){recordings[_0x251cf3[_0xdf48('0x6')]]['connectedlinenum']=recordings[_0x251cf3[_0xdf48('0x6')]]['accountcode'];recordings[_0x251cf3[_0xdf48('0x6')]][_0xdf48('0x30')]='';}recordings[_0x251cf3[_0xdf48('0x6')]]['monitors'][_0xdf48('0x33')](function(_0x513452){var _0xcac92f=_[_0xdf48('0x34')](recordings[_0x251cf3[_0xdf48('0x6')]]);_0xcac92f[_0xdf48('0x22')]=_0x513452[_0xdf48('0x22')];writeDB(_0xcac92f);});delete recordings[_0x251cf3['uniqueid']];}}catch(_0x404871){utils['error'](util['format'](_0xdf48('0x2a'),_0x251cf3[_0xdf48('0x6')]),_0x404871);}};exports[_0xdf48('0x35')]=function(_0x32358e){try{if(!_['isNil'](recordings[_0x32358e['uniqueid']])){utils['debug'](util[_0xdf48('0x4')](_0xdf48('0x36'),_0x32358e[_0xdf48('0x6')]),_0x32358e);utils[_0xdf48('0x3')](util[_0xdf48('0x4')](_0xdf48('0x37'),_0x32358e[_0xdf48('0x6')],_0x32358e['application'],_0x32358e[_0xdf48('0x38')]));if(_0x32358e[_0xdf48('0x39')][_0xdf48('0x3a')]()==_0xdf48('0x3b')&&_[_0xdf48('0x3c')](_0x32358e[_0xdf48('0x38')][_0xdf48('0x3a')](),_0xdf48('0x3d'))){var _0xc6ed82=_0x32358e[_0xdf48('0x38')][_0xdf48('0x3e')]('=');var _0x2d5583=_0xc6ed82[0x0][_0xdf48('0x3f')](_0xc6ed82[0x0][_0xdf48('0x40')]('(')+0x1,_0xc6ed82[0x0][_0xdf48('0x40')](')'));var _0x122fd5=_0xc6ed82[0x1];recordings[_0x32358e[_0xdf48('0x6')]][_0x2d5583]=_0x122fd5;}}}catch(_0xfb939c){utils[_0xdf48('0x15')](util[_0xdf48('0x4')](_0xdf48('0x36'),_0x32358e[_0xdf48('0x6')]),_0xfb939c);}};exports['queuecallerjoin']=function(_0x5d9b00){try{if(!_[_0xdf48('0x1a')](recordings[_0x5d9b00[_0xdf48('0x6')]])){utils[_0xdf48('0x18')](util[_0xdf48('0x4')](_0xdf48('0x41'),_0x5d9b00[_0xdf48('0x6')]),_0x5d9b00);utils['info'](util[_0xdf48('0x4')](_0xdf48('0x42'),_0x5d9b00[_0xdf48('0x6')],_0x5d9b00['queue']));recordings[_0x5d9b00['uniqueid']][_0xdf48('0x43')]=_0x5d9b00['queue'];}}catch(_0x465e51){utils[_0xdf48('0x15')](util['format'](_0xdf48('0x41'),_0x5d9b00[_0xdf48('0x6')]),_0x465e51);}};exports[_0xdf48('0x44')]=function(_0x469036){try{utils[_0xdf48('0x18')](util[_0xdf48('0x4')]('[%s][recordings][blindtransfer]',_0x469036[_0xdf48('0x6')]),_0x469036);utils[_0xdf48('0x3')](util['format']('[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x469036['uniqueid'],_0x469036[_0xdf48('0x45')],_0x469036[_0xdf48('0x46')],_0x469036[_0xdf48('0x47')],_0x469036[_0xdf48('0x48')]));if(recordings[_0x469036[_0xdf48('0x49')]]&&transfers[_0xdf48('0xe')][_0x469036[_0xdf48('0x49')]]){transfers[_0xdf48('0xe')][_0x469036[_0xdf48('0x49')]][_0xdf48('0x4a')]=!![];}}catch(_0x1c22e4){utils[_0xdf48('0x15')](util[_0xdf48('0x4')](_0xdf48('0x4b'),_0x469036['uniqueid']),_0x1c22e4);}}; \ No newline at end of file +var _0xe4ad=['recording','lodash','util','./utils','./transfers.controller','info','format','[%s][recordings][writeDB]','blinds','uniqueid','transfereeuniqueid','accountcode','getUserByInternal','then','name','UserId','request','newchannel','debug','[%s][recordings][newchannel]','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','error','newstate','[%s][recordings][newstate]','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','channel','isNil','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','variable','mixmonitor_filename','[%s][recordings][varset]','value','endsWith','.wav49','replace','monitors','push','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','connectedlinenum','connectedlinename','type','outbound','clone','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr','split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','blindtransfer','[%s][recordings][blindtransfer]','transfereecalleridnum','transfereecalleridname','transfereruniqueid'];(function(_0xb99421,_0xaab133){var _0x4b3ec7=function(_0x591d1a){while(--_0x591d1a){_0xb99421['push'](_0xb99421['shift']());}};_0x4b3ec7(++_0xaab133);}(_0xe4ad,0x8d));var _0xde4a=function(_0x717c52,_0x4ffd52){_0x717c52=_0x717c52-0x0;var _0x2d4678=_0xe4ad[_0x717c52];return _0x2d4678;};'use strict';var _=require(_0xde4a('0x0'));var util=require(_0xde4a('0x1'));var utils=require(_0xde4a('0x2'));var transfers=require(_0xde4a('0x3'));var recordings={};function writeDB(_0x1143a2){var _0x2b2348;utils[_0xde4a('0x4')](util[_0xde4a('0x5')](_0xde4a('0x6'),_0x1143a2['uniqueid']));if(transfers[_0xde4a('0x7')][_0x1143a2['uniqueid']]){_0x2b2348=_0x1143a2[_0xde4a('0x8')];_0x1143a2[_0xde4a('0x8')]=transfers[_0xde4a('0x7')][_0x1143a2[_0xde4a('0x8')]][_0xde4a('0x9')];}if(_0x1143a2[_0xde4a('0xa')]){utils[_0xde4a('0xb')](_0x1143a2[_0xde4a('0xa')])[_0xde4a('0xc')](function(_0x1118bb){if(_0x1118bb){_0x1143a2['membername']=_0x1118bb[_0xde4a('0xd')];_0x1143a2[_0xde4a('0xe')]=_0x1118bb['id'];}utils[_0xde4a('0xf')]('CreateVoiceRecording',_0x1143a2);});}else{utils['request']('CreateVoiceRecording',_0x1143a2);}if(_0x2b2348)delete transfers['blinds'][_0x2b2348];}exports[_0xde4a('0x10')]=function(_0x406196){try{utils[_0xde4a('0x11')](util[_0xde4a('0x5')](_0xde4a('0x12'),_0x406196[_0xde4a('0x8')]),_0x406196);if(_0x406196['uniqueid']==_0x406196[_0xde4a('0x13')]){utils[_0xde4a('0x4')](util[_0xde4a('0x5')](_0xde4a('0x14'),_0x406196['uniqueid'],_0x406196[_0xde4a('0x15')],_0x406196[_0xde4a('0x16')]));recordings[_0x406196[_0xde4a('0x8')]]={'uniqueid':_0x406196[_0xde4a('0x8')],'accountcode':_0x406196[_0xde4a('0xa')],'exten':_0x406196[_0xde4a('0x16')],'context':_0x406196[_0xde4a('0x15')],'channel':_0x406196['channel'],'monitors':[]};}}catch(_0x11e3e6){utils[_0xde4a('0x17')](util['format'](_0xde4a('0x12'),_0x406196[_0xde4a('0x8')]),_0x11e3e6);}};exports[_0xde4a('0x18')]=function(_0x44da13){try{utils[_0xde4a('0x11')](util[_0xde4a('0x5')](_0xde4a('0x19'),_0x44da13[_0xde4a('0x8')]),_0x44da13);if(!_['isNil'](recordings[_0x44da13[_0xde4a('0x8')]])&&_0x44da13[_0xde4a('0x1a')]==0x6){utils['info'](util[_0xde4a('0x5')](_0xde4a('0x1b'),_0x44da13[_0xde4a('0x8')],_0x44da13['context'],_0x44da13[_0xde4a('0x1c')]));}else if(!_[_0xde4a('0x1d')](recordings[_0x44da13[_0xde4a('0x13')]])&&_0x44da13[_0xde4a('0x1a')]==0x6&&_0x44da13[_0xde4a('0x15')]!=_0xde4a('0x1e')){utils[_0xde4a('0x4')](util['format'](_0xde4a('0x1f'),_0x44da13['uniqueid'],_0x44da13['linkedid'],_0x44da13[_0xde4a('0x15')],_0x44da13[_0xde4a('0x1c')]));recordings[_0x44da13[_0xde4a('0x13')]][_0xde4a('0xa')]=_0x44da13[_0xde4a('0xa')];}}catch(_0xafbf9c){utils[_0xde4a('0x17')](util[_0xde4a('0x5')](_0xde4a('0x19'),_0x44da13[_0xde4a('0x8')]),_0xafbf9c);}};exports['varset']=function(_0x4c9b0f){try{if(!_[_0xde4a('0x1d')](_0x4c9b0f[_0xde4a('0x20')])&&!_[_0xde4a('0x1d')](_0x4c9b0f[_0xde4a('0x20')][_0xde4a('0x21')])){utils[_0xde4a('0x11')](util['format'](_0xde4a('0x22'),_0x4c9b0f['uniqueid']),_0x4c9b0f);utils[_0xde4a('0x4')](util[_0xde4a('0x5')]('[%s][recordings][varset]\x20variable:%s\x20value:%s',_0x4c9b0f[_0xde4a('0x8')],_0x4c9b0f['variable'],_0x4c9b0f[_0xde4a('0x23')]));if(_[_0xde4a('0x24')](_0x4c9b0f[_0xde4a('0x23')],_0xde4a('0x25'))){_0x4c9b0f['value']=_0x4c9b0f[_0xde4a('0x23')][_0xde4a('0x26')](_0xde4a('0x25'),'.WAV');}if(recordings[_0x4c9b0f[_0xde4a('0x13')]]){var _0x4bdac1=_['find'](recordings[_0x4c9b0f['linkedid']][_0xde4a('0x27')],{'value':_0x4c9b0f[_0xde4a('0x23')]});if(_[_0xde4a('0x1d')](_0x4bdac1)){recordings[_0x4c9b0f['linkedid']]['monitors'][_0xde4a('0x28')]({'value':_0x4c9b0f[_0xde4a('0x23')]});}}}}catch(_0x201b19){utils[_0xde4a('0x17')](util[_0xde4a('0x5')](_0xde4a('0x22'),_0x4c9b0f[_0xde4a('0x8')]),_0x201b19);}};exports['hangup']=function(_0x3e32e6){try{if(!_[_0xde4a('0x1d')](recordings[_0x3e32e6[_0xde4a('0x8')]])){utils['debug'](util[_0xde4a('0x5')](_0xde4a('0x29'),_0x3e32e6[_0xde4a('0x8')]),_0x3e32e6);utils[_0xde4a('0x4')](util[_0xde4a('0x5')](_0xde4a('0x2a'),_0x3e32e6[_0xde4a('0x8')],_0x3e32e6['calleridnum'],_0x3e32e6['calleridname'],_0x3e32e6['cause-txt']));recordings[_0x3e32e6[_0xde4a('0x8')]][_0xde4a('0x2b')]=_0x3e32e6[_0xde4a('0x2b')];recordings[_0x3e32e6[_0xde4a('0x8')]][_0xde4a('0x2c')]=_0x3e32e6['calleridname'];recordings[_0x3e32e6[_0xde4a('0x8')]]['connectedlinenum']=_0x3e32e6[_0xde4a('0x2d')];recordings[_0x3e32e6['uniqueid']]['connectedlinename']=_0x3e32e6[_0xde4a('0x2e')];if(recordings[_0x3e32e6['uniqueid']][_0xde4a('0x2f')]==_0xde4a('0x30')&&recordings[_0x3e32e6[_0xde4a('0x8')]][_0xde4a('0xa')]){recordings[_0x3e32e6['uniqueid']]['connectedlinenum']=recordings[_0x3e32e6[_0xde4a('0x8')]][_0xde4a('0xa')];recordings[_0x3e32e6[_0xde4a('0x8')]][_0xde4a('0x2e')]='';}recordings[_0x3e32e6[_0xde4a('0x8')]][_0xde4a('0x27')]['forEach'](function(_0x1e72c3){var _0x11f4c0=_[_0xde4a('0x31')](recordings[_0x3e32e6[_0xde4a('0x8')]]);_0x11f4c0['value']=_0x1e72c3[_0xde4a('0x23')];writeDB(_0x11f4c0);});delete recordings[_0x3e32e6['uniqueid']];}}catch(_0x14ba67){utils[_0xde4a('0x17')](util[_0xde4a('0x5')](_0xde4a('0x29'),_0x3e32e6[_0xde4a('0x8')]),_0x14ba67);}};exports['newexten']=function(_0x52cf5f){try{if(!_[_0xde4a('0x1d')](recordings[_0x52cf5f['uniqueid']])){utils[_0xde4a('0x11')](util[_0xde4a('0x5')](_0xde4a('0x32'),_0x52cf5f[_0xde4a('0x8')]),_0x52cf5f);utils[_0xde4a('0x4')](util['format'](_0xde4a('0x33'),_0x52cf5f['uniqueid'],_0x52cf5f[_0xde4a('0x34')],_0x52cf5f[_0xde4a('0x35')]));if(_0x52cf5f[_0xde4a('0x34')][_0xde4a('0x36')]()==_0xde4a('0x37')&&_[_0xde4a('0x38')](_0x52cf5f[_0xde4a('0x35')][_0xde4a('0x36')](),_0xde4a('0x39'))){var _0x32e467=_0x52cf5f[_0xde4a('0x35')][_0xde4a('0x3a')]('=');var _0x541760=_0x32e467[0x0][_0xde4a('0x3b')](_0x32e467[0x0][_0xde4a('0x3c')]('(')+0x1,_0x32e467[0x0][_0xde4a('0x3c')](')'));var _0x567925=_0x32e467[0x1];recordings[_0x52cf5f[_0xde4a('0x8')]][_0x541760]=_0x567925;}}}catch(_0x24c325){utils[_0xde4a('0x17')](util[_0xde4a('0x5')](_0xde4a('0x32'),_0x52cf5f[_0xde4a('0x8')]),_0x24c325);}};exports[_0xde4a('0x3d')]=function(_0x2cbb37){try{if(!_[_0xde4a('0x1d')](recordings[_0x2cbb37[_0xde4a('0x8')]])){utils[_0xde4a('0x11')](util[_0xde4a('0x5')](_0xde4a('0x3e'),_0x2cbb37[_0xde4a('0x8')]),_0x2cbb37);utils[_0xde4a('0x4')](util[_0xde4a('0x5')](_0xde4a('0x3f'),_0x2cbb37[_0xde4a('0x8')],_0x2cbb37['queue']));recordings[_0x2cbb37['uniqueid']]['queue']=_0x2cbb37['queue'];}}catch(_0x20c209){utils['error'](util[_0xde4a('0x5')](_0xde4a('0x3e'),_0x2cbb37['uniqueid']),_0x20c209);}};exports[_0xde4a('0x40')]=function(_0x3cbf81){try{utils[_0xde4a('0x11')](util[_0xde4a('0x5')](_0xde4a('0x41'),_0x3cbf81[_0xde4a('0x8')]),_0x3cbf81);utils[_0xde4a('0x4')](util[_0xde4a('0x5')]('[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x3cbf81[_0xde4a('0x8')],_0x3cbf81['transferercalleridnum'],_0x3cbf81['transferercalleridname'],_0x3cbf81[_0xde4a('0x42')],_0x3cbf81[_0xde4a('0x43')]));if(recordings[_0x3cbf81[_0xde4a('0x44')]]&&transfers[_0xde4a('0x7')][_0x3cbf81[_0xde4a('0x44')]]){transfers[_0xde4a('0x7')][_0x3cbf81[_0xde4a('0x44')]][_0xde4a('0x45')]=!![];}}catch(_0x528844){utils['error'](util[_0xde4a('0x5')]('[%s][recordings][blindtransfer]',_0x3cbf81[_0xde4a('0x8')]),_0x528844);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 40b49f8..2900b73 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 _0xcd05=['uniqueid','type','request','CreateVoiceTransferReport','blinds','blindtransfer','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transfereecalleridname','blind','transfereruniqueid','error','attendedtransfer','debug','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','origtransfererchannel','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','origtransfererlinkedid','origtransferercontext','origtransfererexten','assign','transfertargetchannel','transfertargetconnectedlinenum','transfertargetlinkedid','[%s][transfers][attendedtransfer]','lodash','util','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','attended','origtransfereruniqueid'];(function(_0x4de586,_0x183427){var _0x46baf5=function(_0x1157f0){while(--_0x1157f0){_0x4de586['push'](_0x4de586['shift']());}};_0x46baf5(++_0x183427);}(_0xcd05,0x1b0));var _0x5cd0=function(_0x2f5a22,_0x5e9f03){_0x2f5a22=_0x2f5a22-0x0;var _0x326b70=_0xcd05[_0x2f5a22];return _0x326b70;};'use strict';var _=require(_0x5cd0('0x0'));var util=require(_0x5cd0('0x1'));var utils=require(_0x5cd0('0x2'));function writeDB(_0x733cde){utils[_0x5cd0('0x3')](util[_0x5cd0('0x4')](_0x5cd0('0x5'),_0x733cde['type']===_0x5cd0('0x6')?_0x733cde[_0x5cd0('0x7')]:_0x733cde[_0x5cd0('0x8')],_0x733cde[_0x5cd0('0x9')]));utils[_0x5cd0('0xa')](_0x5cd0('0xb'),_0x733cde);}exports[_0x5cd0('0xc')]={};exports[_0x5cd0('0xd')]=function(_0x5df623){try{utils['debug'](util[_0x5cd0('0x4')](_0x5cd0('0xe'),_0x5df623[_0x5cd0('0x8')]),_0x5df623);utils['info'](util[_0x5cd0('0x4')](_0x5cd0('0xf'),_0x5df623['uniqueid'],_0x5df623[_0x5cd0('0x10')],_0x5df623['transferercalleridname'],_0x5df623['transfereecalleridnum'],_0x5df623[_0x5cd0('0x11')]));_0x5df623[_0x5cd0('0x9')]=_0x5cd0('0x12');exports['blinds'][_0x5df623[_0x5cd0('0x13')]]=_0x5df623;writeDB(_0x5df623);}catch(_0x2bde52){utils[_0x5cd0('0x14')](util[_0x5cd0('0x4')](_0x5cd0('0xe'),_0x5df623['uniqueid']),_0x2bde52);}};exports[_0x5cd0('0x15')]=function(_0x33227b){try{utils[_0x5cd0('0x16')](util[_0x5cd0('0x4')]('[%s][transfers][attendedtransfer]',_0x33227b[_0x5cd0('0x7')]),_0x33227b);utils[_0x5cd0('0x3')](util['format'](_0x5cd0('0x17'),_0x33227b[_0x5cd0('0x7')],_0x33227b[_0x5cd0('0x18')],_0x33227b[_0x5cd0('0x19')],_0x33227b[_0x5cd0('0x1a')],_0x33227b[_0x5cd0('0x1b')]));_0x33227b=_['assign'](_0x33227b,{'transfererchannel':_0x33227b[_0x5cd0('0x1c')],'transferercalleridnum':_0x33227b[_0x5cd0('0x18')],'transferercalleridname':_0x33227b[_0x5cd0('0x19')],'transfererconnectedlinenum':_0x33227b['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x33227b[_0x5cd0('0x1d')],'transfereraccountcode':_0x33227b[_0x5cd0('0x1e')],'transferercontext':_0x33227b[_0x5cd0('0x1f')],'transfererexten':_0x33227b['secondtransfererexten'],'transfererlinkedid':_0x33227b[_0x5cd0('0x20')],'context':_0x33227b[_0x5cd0('0x21')],'extension':_0x33227b[_0x5cd0('0x22')],'type':_0x5cd0('0x6')});if(_['isNil'](_0x33227b['transfereechannel'])){_0x33227b=_[_0x5cd0('0x23')](_0x33227b,{'transfereechannel':_0x33227b[_0x5cd0('0x24')],'transfereecalleridnum':_0x33227b[_0x5cd0('0x1a')],'transfereecalleridname':_0x33227b[_0x5cd0('0x1b')],'transfereeconnectedlinenum':_0x33227b[_0x5cd0('0x25')],'transfereeconnectedlinename':_0x33227b['transfertargetconnectedlinename'],'transfereeaccountcode':_0x33227b['transfertargetaccountcode'],'transfereecontext':_0x33227b['transfertargetcontext'],'transfereeexten':_0x33227b['transfertargetexten'],'transfereelinkedid':_0x33227b[_0x5cd0('0x26')]});}writeDB(_0x33227b);}catch(_0x3ab52f){utils[_0x5cd0('0x14')](util[_0x5cd0('0x4')](_0x5cd0('0x27'),_0x33227b[_0x5cd0('0x7')]),_0x3ab52f);}}; \ No newline at end of file +var _0xbeac=['origtransferercalleridnum','assign','origtransfererchannel','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','isNil','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetlinkedid','lodash','util','./utils','info','format','type','attended','origtransfereruniqueid','uniqueid','request','CreateVoiceTransferReport','blinds','blindtransfer','debug','transferercalleridnum','transferercalleridname','transfereecalleridname','blind','transfereruniqueid','error','[%s][transfers][blindtransfer]','attendedtransfer','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s'];(function(_0x2ef6ff,_0x4db2bf){var _0x17880a=function(_0x25ef03){while(--_0x25ef03){_0x2ef6ff['push'](_0x2ef6ff['shift']());}};_0x17880a(++_0x4db2bf);}(_0xbeac,0x183));var _0xcbea=function(_0x4e240c,_0x5691c4){_0x4e240c=_0x4e240c-0x0;var _0x5b1f46=_0xbeac[_0x4e240c];return _0x5b1f46;};'use strict';var _=require(_0xcbea('0x0'));var util=require(_0xcbea('0x1'));var utils=require(_0xcbea('0x2'));function writeDB(_0x3d5f84){utils[_0xcbea('0x3')](util[_0xcbea('0x4')]('[%s][transfers][writeDB]\x20type:%s',_0x3d5f84[_0xcbea('0x5')]===_0xcbea('0x6')?_0x3d5f84[_0xcbea('0x7')]:_0x3d5f84[_0xcbea('0x8')],_0x3d5f84['type']));utils[_0xcbea('0x9')](_0xcbea('0xa'),_0x3d5f84);}exports[_0xcbea('0xb')]={};exports[_0xcbea('0xc')]=function(_0x497248){try{utils[_0xcbea('0xd')](util[_0xcbea('0x4')]('[%s][transfers][blindtransfer]',_0x497248[_0xcbea('0x8')]),_0x497248);utils[_0xcbea('0x3')](util['format']('[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x497248[_0xcbea('0x8')],_0x497248[_0xcbea('0xe')],_0x497248[_0xcbea('0xf')],_0x497248['transfereecalleridnum'],_0x497248[_0xcbea('0x10')]));_0x497248[_0xcbea('0x5')]=_0xcbea('0x11');exports['blinds'][_0x497248[_0xcbea('0x12')]]=_0x497248;writeDB(_0x497248);}catch(_0x295599){utils[_0xcbea('0x13')](util['format'](_0xcbea('0x14'),_0x497248['uniqueid']),_0x295599);}};exports[_0xcbea('0x15')]=function(_0x3b1b0a){try{utils[_0xcbea('0xd')](util[_0xcbea('0x4')]('[%s][transfers][attendedtransfer]',_0x3b1b0a[_0xcbea('0x7')]),_0x3b1b0a);utils[_0xcbea('0x3')](util[_0xcbea('0x4')](_0xcbea('0x16'),_0x3b1b0a[_0xcbea('0x7')],_0x3b1b0a[_0xcbea('0x17')],_0x3b1b0a['origtransferercalleridname'],_0x3b1b0a['transfertargetcalleridnum'],_0x3b1b0a['transfertargetcalleridname']));_0x3b1b0a=_[_0xcbea('0x18')](_0x3b1b0a,{'transfererchannel':_0x3b1b0a[_0xcbea('0x19')],'transferercalleridnum':_0x3b1b0a[_0xcbea('0x17')],'transferercalleridname':_0x3b1b0a[_0xcbea('0x1a')],'transfererconnectedlinenum':_0x3b1b0a[_0xcbea('0x1b')],'transfererconnectedlinename':_0x3b1b0a[_0xcbea('0x1c')],'transfereraccountcode':_0x3b1b0a['origtransfereraccountcode'],'transferercontext':_0x3b1b0a[_0xcbea('0x1d')],'transfererexten':_0x3b1b0a[_0xcbea('0x1e')],'transfererlinkedid':_0x3b1b0a[_0xcbea('0x1f')],'context':_0x3b1b0a[_0xcbea('0x20')],'extension':_0x3b1b0a['origtransfererexten'],'type':_0xcbea('0x6')});if(_[_0xcbea('0x21')](_0x3b1b0a['transfereechannel'])){_0x3b1b0a=_[_0xcbea('0x18')](_0x3b1b0a,{'transfereechannel':_0x3b1b0a['transfertargetchannel'],'transfereecalleridnum':_0x3b1b0a[_0xcbea('0x22')],'transfereecalleridname':_0x3b1b0a[_0xcbea('0x23')],'transfereeconnectedlinenum':_0x3b1b0a[_0xcbea('0x24')],'transfereeconnectedlinename':_0x3b1b0a[_0xcbea('0x25')],'transfereeaccountcode':_0x3b1b0a[_0xcbea('0x26')],'transfereecontext':_0x3b1b0a[_0xcbea('0x27')],'transfereeexten':_0x3b1b0a['transfertargetexten'],'transfereelinkedid':_0x3b1b0a[_0xcbea('0x28')]});}writeDB(_0x3b1b0a);}catch(_0xc62560){utils[_0xcbea('0x13')](util['format']('[%s][transfers][attendedtransfer]',_0x3b1b0a[_0xcbea('0x7')]),_0xc62560);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index e0bb6a7..b8a1acb 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 _0x708c=['isBefore','bluebird','jayson/promise','moment','client','http','../../config/logger','xdr','info','inspect','debug','error','request','then','[utils][request]\x20name:%s','GetUser','name','stringify','result','length','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','notfound','catch','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','type','acw','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]','addTime','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','diffTime','diff','now','isAfter'];(function(_0x2dea24,_0x2fc021){var _0x309d58=function(_0x2eb89f){while(--_0x2eb89f){_0x2dea24['push'](_0x2dea24['shift']());}};_0x309d58(++_0x2fc021);}(_0x708c,0x8b));var _0xc708=function(_0xe1868e,_0x330bc3){_0xe1868e=_0xe1868e-0x0;var _0x139e77=_0x708c[_0xe1868e];return _0x139e77;};'use strict';var BPromise=require(_0xc708('0x0'));var jayson=require(_0xc708('0x1'));var moment=require(_0xc708('0x2'));var util=require('util');var client=jayson[_0xc708('0x3')][_0xc708('0x4')]({'port':0x2329});var logger=require(_0xc708('0x5'))(_0xc708('0x6'));exports[_0xc708('0x7')]=function(_0x46d3b4,_0x56b4f3){logger[_0xc708('0x7')](_0x46d3b4,_0x56b4f3?util[_0xc708('0x8')](_0x56b4f3,{'showHidden':![],'depth':null}):'');};exports[_0xc708('0x9')]=function(_0x486de8,_0x1de7c6){logger[_0xc708('0x9')](_0x486de8,_0x1de7c6?util[_0xc708('0x8')](_0x1de7c6,{'showHidden':![],'depth':null}):'');};exports[_0xc708('0xa')]=function(_0x397b36,_0x27c9f9){logger[_0xc708('0xa')](_0x397b36,_0x27c9f9?util[_0xc708('0x8')](_0x27c9f9,{'showHidden':![],'depth':null}):'');};exports[_0xc708('0xb')]=function(_0x27d4c2,_0x458905){return client[_0xc708('0xb')](_0x27d4c2,{'body':_0x458905})[_0xc708('0xc')](function(_0x514e9a){logger[_0xc708('0x9')](_0xc708('0xd'),_0x27d4c2,_0x514e9a?util[_0xc708('0x8')](_0x514e9a,{'showHidden':![],'depth':null}):'');})['catch'](function(_0x1425c2){logger['error']('[utils][request]\x20name:%s',_0x27d4c2,_0x1425c2?util[_0xc708('0x8')](_0x1425c2,{'showHidden':![],'depth':null}):'');});};function getUser(_0x545c64){return client[_0xc708('0xb')](_0xc708('0xe'),{'options':{'raw':!![],'attributes':['id','internal',_0xc708('0xf'),'interface'],'where':_0x545c64,'limit':0x1}})['then'](function(_0x1814ff){logger[_0xc708('0x9')]('[utils][getUser]\x20where:%s',JSON[_0xc708('0x10')](_0x545c64),_0x1814ff?util[_0xc708('0x8')](_0x1814ff,{'showHidden':![],'depth':null}):'');return _0x1814ff[_0xc708('0x11')][_0xc708('0x12')]?_0x1814ff[_0xc708('0x11')][0x0]:null;});}exports[_0xc708('0x13')]=function(_0x3341fc){return new BPromise(function(_0x5b11d4,_0xed720b){if(_0x3341fc){return getUser({'internal':_0x3341fc})[_0xc708('0xc')](function(_0x1c8388){logger[_0xc708('0x7')](_0xc708('0x14'),_0x3341fc,_0x1c8388?_0xc708('0x15'):'notfound');return _0x5b11d4(_0x1c8388);})['catch'](function(_0x354cd3){logger['error'](_0xc708('0x16'),_0x354cd3?util[_0xc708('0x8')](_0x354cd3,{'showHidden':![],'depth':null}):'');return _0x5b11d4(null);});}return _0x5b11d4(null);});};exports[_0xc708('0x17')]=function(_0x58910f){return new BPromise(function(_0x2df3d8,_0x41f5fa){if(_0x58910f){return getUser({'interface':_0x58910f})[_0xc708('0xc')](function(_0x5eff2f){logger[_0xc708('0x7')](_0xc708('0x18'),_0x58910f,_0x5eff2f?_0xc708('0x15'):_0xc708('0x19'));return _0x2df3d8(_0x5eff2f);})[_0xc708('0x1a')](function(_0x47191f){logger['error']('[utils][getUserByInterface]',_0x47191f?util[_0xc708('0x8')](_0x47191f,{'showHidden':![],'depth':null}):'');return _0x2df3d8(null);});}return _0x2df3d8(null);});};exports[_0xc708('0x1b')]=function(_0x28b7f5){return new BPromise(function(_0x33a611,_0x1b25ba){if(_0x28b7f5){return getUser({'name':_0x28b7f5})['then'](function(_0x360410){logger['info'](_0xc708('0x1c'),_0x28b7f5,_0x360410?_0xc708('0x15'):'notfound');return _0x33a611(_0x360410);})[_0xc708('0x1a')](function(_0x463d47){logger[_0xc708('0xa')](_0xc708('0x1d'),_0x463d47?util[_0xc708('0x8')](_0x463d47,{'showHidden':![],'depth':null}):'');return _0x33a611(null);});}return _0x33a611(null);});};exports[_0xc708('0x1e')]=function(_0x1142db){return new BPromise(function(_0x4cff56,_0x160543){if(_0x1142db){return client[_0xc708('0xb')](_0xc708('0x1f'),{'options':{'raw':!![],'attributes':['id','name',_0xc708('0x20'),_0xc708('0x21'),'acwTimeout'],'where':{'name':_0x1142db},'limit':0x1}})[_0xc708('0xc')](function(_0x754bc2){logger[_0xc708('0x9')](_0xc708('0x22'),_0x1142db,_0x754bc2?util['inspect'](_0x754bc2,{'showHidden':![],'depth':null}):'');logger[_0xc708('0x7')]('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0x1142db,_0x754bc2?_0xc708('0x15'):_0xc708('0x19'));return _0x4cff56(_0x754bc2['result']['length']?_0x754bc2[_0xc708('0x11')][0x0]:null);})[_0xc708('0x1a')](function(_0x3e8c14){logger[_0xc708('0xa')](_0xc708('0x23'),_0x3e8c14?util[_0xc708('0x8')](_0x3e8c14,{'showHidden':![],'depth':null}):'');return _0x4cff56(null);});}return _0x4cff56(null);});};exports[_0xc708('0x24')]=function(_0x356ed8,_0x74ff9e){return moment(_0x356ed8)['add'](_0x74ff9e,_0xc708('0x25'))[_0xc708('0x26')](_0xc708('0x27'));};exports[_0xc708('0x28')]=function(_0x38643e,_0x554b43){return moment(_0x38643e)['subtract'](_0x554b43,_0xc708('0x25'))[_0xc708('0x26')](_0xc708('0x27'));};exports[_0xc708('0x29')]=function(_0x51a715,_0x23c005){return moment(_0x51a715)[_0xc708('0x2a')](moment(_0x23c005),_0xc708('0x25'));};exports['sumTime']=function(_0x537429,_0x1fe8c7){return parseInt(_0x537429,0xa)+parseInt(_0x1fe8c7,0xa);};exports[_0xc708('0x2b')]=function(){return moment()[_0xc708('0x26')](_0xc708('0x27'));};exports[_0xc708('0x2c')]=function(_0x6714f3,_0x1dc328){if(_0x1dc328){return moment(_0x6714f3)['isAfter'](_0x1dc328);}return!![];};exports[_0xc708('0x2d')]=function(_0x176f00,_0x2df3bd){if(_0x2df3bd){return moment(_0x176f00)[_0xc708('0x2d')](_0x2df3bd);}else if(_0x176f00){return!![];}return![];}; \ No newline at end of file +var _0xf9fb=['acw','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','length','[utils][getVoiceQueueByName]','seconds','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diff','sumTime','now','format','isAfter','isBefore','bluebird','jayson/promise','moment','util','client','../../config/logger','xdr','info','debug','error','inspect','request','then','[utils][request]\x20name:%s','catch','internal','name','interface','[utils][getUser]\x20where:%s','stringify','result','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue'];(function(_0x123eb8,_0x861f20){var _0x3cbb46=function(_0x4e2b92){while(--_0x4e2b92){_0x123eb8['push'](_0x123eb8['shift']());}};_0x3cbb46(++_0x861f20);}(_0xf9fb,0x177));var _0xbf9f=function(_0x11a261,_0x2587cc){_0x11a261=_0x11a261-0x0;var _0x4b998b=_0xf9fb[_0x11a261];return _0x4b998b;};'use strict';var BPromise=require(_0xbf9f('0x0'));var jayson=require(_0xbf9f('0x1'));var moment=require(_0xbf9f('0x2'));var util=require(_0xbf9f('0x3'));var client=jayson[_0xbf9f('0x4')]['http']({'port':0x2329});var logger=require(_0xbf9f('0x5'))(_0xbf9f('0x6'));exports[_0xbf9f('0x7')]=function(_0x293cfa,_0x621ab){logger[_0xbf9f('0x7')](_0x293cfa,_0x621ab?util['inspect'](_0x621ab,{'showHidden':![],'depth':null}):'');};exports[_0xbf9f('0x8')]=function(_0x5a2877,_0x54fedc){logger['debug'](_0x5a2877,_0x54fedc?util['inspect'](_0x54fedc,{'showHidden':![],'depth':null}):'');};exports[_0xbf9f('0x9')]=function(_0xd85f44,_0x5f2b4a){logger[_0xbf9f('0x9')](_0xd85f44,_0x5f2b4a?util[_0xbf9f('0xa')](_0x5f2b4a,{'showHidden':![],'depth':null}):'');};exports[_0xbf9f('0xb')]=function(_0x59b4fd,_0x470fac){return client[_0xbf9f('0xb')](_0x59b4fd,{'body':_0x470fac})[_0xbf9f('0xc')](function(_0x5ea8cd){logger[_0xbf9f('0x8')](_0xbf9f('0xd'),_0x59b4fd,_0x5ea8cd?util['inspect'](_0x5ea8cd,{'showHidden':![],'depth':null}):'');})[_0xbf9f('0xe')](function(_0x52efb8){logger[_0xbf9f('0x9')](_0xbf9f('0xd'),_0x59b4fd,_0x52efb8?util[_0xbf9f('0xa')](_0x52efb8,{'showHidden':![],'depth':null}):'');});};function getUser(_0x42e650){return client[_0xbf9f('0xb')]('GetUser',{'options':{'raw':!![],'attributes':['id',_0xbf9f('0xf'),_0xbf9f('0x10'),_0xbf9f('0x11')],'where':_0x42e650,'limit':0x1}})[_0xbf9f('0xc')](function(_0x24f9bc){logger[_0xbf9f('0x8')](_0xbf9f('0x12'),JSON[_0xbf9f('0x13')](_0x42e650),_0x24f9bc?util[_0xbf9f('0xa')](_0x24f9bc,{'showHidden':![],'depth':null}):'');return _0x24f9bc[_0xbf9f('0x14')]['length']?_0x24f9bc['result'][0x0]:null;});}exports['getUserByInternal']=function(_0x39b256){return new BPromise(function(_0x49f5d3,_0x2c06a5){if(_0x39b256){return getUser({'internal':_0x39b256})['then'](function(_0x1f2920){logger[_0xbf9f('0x7')](_0xbf9f('0x15'),_0x39b256,_0x1f2920?_0xbf9f('0x16'):_0xbf9f('0x17'));return _0x49f5d3(_0x1f2920);})[_0xbf9f('0xe')](function(_0x40852a){logger[_0xbf9f('0x9')]('[utils][getUserByInternal]',_0x40852a?util[_0xbf9f('0xa')](_0x40852a,{'showHidden':![],'depth':null}):'');return _0x49f5d3(null);});}return _0x49f5d3(null);});};exports['getUserByInterface']=function(_0x274ea6){return new BPromise(function(_0x72ccdb,_0x3dc016){if(_0x274ea6){return getUser({'interface':_0x274ea6})['then'](function(_0x3d001f){logger['info'](_0xbf9f('0x18'),_0x274ea6,_0x3d001f?'found':'notfound');return _0x72ccdb(_0x3d001f);})['catch'](function(_0x1caf6a){logger[_0xbf9f('0x9')](_0xbf9f('0x19'),_0x1caf6a?util[_0xbf9f('0xa')](_0x1caf6a,{'showHidden':![],'depth':null}):'');return _0x72ccdb(null);});}return _0x72ccdb(null);});};exports['getUserByName']=function(_0x2f6fb0){return new BPromise(function(_0x19451c,_0x336786){if(_0x2f6fb0){return getUser({'name':_0x2f6fb0})[_0xbf9f('0xc')](function(_0x489584){logger[_0xbf9f('0x7')](_0xbf9f('0x1a'),_0x2f6fb0,_0x489584?_0xbf9f('0x16'):_0xbf9f('0x17'));return _0x19451c(_0x489584);})[_0xbf9f('0xe')](function(_0x4f4a84){logger[_0xbf9f('0x9')](_0xbf9f('0x1b'),_0x4f4a84?util[_0xbf9f('0xa')](_0x4f4a84,{'showHidden':![],'depth':null}):'');return _0x19451c(null);});}return _0x19451c(null);});};exports[_0xbf9f('0x1c')]=function(_0x3e152e){return new BPromise(function(_0x5bdd12,_0x1b2839){if(_0x3e152e){return client[_0xbf9f('0xb')](_0xbf9f('0x1d'),{'options':{'raw':!![],'attributes':['id',_0xbf9f('0x10'),'type',_0xbf9f('0x1e'),'acwTimeout'],'where':{'name':_0x3e152e},'limit':0x1}})[_0xbf9f('0xc')](function(_0xdd8bbf){logger[_0xbf9f('0x8')](_0xbf9f('0x1f'),_0x3e152e,_0xdd8bbf?util['inspect'](_0xdd8bbf,{'showHidden':![],'depth':null}):'');logger['info'](_0xbf9f('0x20'),_0x3e152e,_0xdd8bbf?_0xbf9f('0x16'):_0xbf9f('0x17'));return _0x5bdd12(_0xdd8bbf['result'][_0xbf9f('0x21')]?_0xdd8bbf[_0xbf9f('0x14')][0x0]:null);})[_0xbf9f('0xe')](function(_0x240a30){logger[_0xbf9f('0x9')](_0xbf9f('0x22'),_0x240a30?util[_0xbf9f('0xa')](_0x240a30,{'showHidden':![],'depth':null}):'');return _0x5bdd12(null);});}return _0x5bdd12(null);});};exports['addTime']=function(_0x30ca72,_0x2c49f7){return moment(_0x30ca72)['add'](_0x2c49f7,_0xbf9f('0x23'))['format'](_0xbf9f('0x24'));};exports[_0xbf9f('0x25')]=function(_0x518478,_0x1ffe38){return moment(_0x518478)[_0xbf9f('0x26')](_0x1ffe38,_0xbf9f('0x23'))['format'](_0xbf9f('0x24'));};exports['diffTime']=function(_0xca5ebd,_0x5a6cbe){return moment(_0xca5ebd)[_0xbf9f('0x27')](moment(_0x5a6cbe),'seconds');};exports[_0xbf9f('0x28')]=function(_0x22761c,_0x53e257){return parseInt(_0x22761c,0xa)+parseInt(_0x53e257,0xa);};exports[_0xbf9f('0x29')]=function(){return moment()[_0xbf9f('0x2a')](_0xbf9f('0x24'));};exports[_0xbf9f('0x2b')]=function(_0x30ddc5,_0x3dd940){if(_0x3dd940){return moment(_0x30ddc5)[_0xbf9f('0x2b')](_0x3dd940);}return!![];};exports[_0xbf9f('0x2c')]=function(_0xf7da64,_0x4ffacf){if(_0x4ffacf){return moment(_0xf7da64)[_0xbf9f('0x2c')](_0x4ffacf);}else if(_0xf7da64){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 39db8bc..3865424 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 _0x8a35=['agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','statusCode','other','agent_name','test','setupLoggers','fs-extra','express-winston','path','util','./loggers','fileLogger','./mask-sensitive-data','join','/var','log','xcally','client','name','then','catch','user','no-user','timestamp','api','auth','set','client-side-logger','use','logger','isEmpty','\x20body=%s','body','format','method','headers','x-forwarded-for','remoteAddress','url','responseTime','role','device'];(function(_0x4f4c2a,_0x5f5a28){var _0xd15be6=function(_0x1bc725){while(--_0x1bc725){_0x4f4c2a['push'](_0x4f4c2a['shift']());}};_0xd15be6(++_0x5f5a28);}(_0x8a35,0x134));var _0x58a3=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x8a35[_0x167cc1];return _0x10bc4b;};var fs=require(_0x58a3('0x0'));var _=require('lodash');var ewinston=require(_0x58a3('0x1'));var path=require(_0x58a3('0x2'));var util=require(_0x58a3('0x3'));var fileLogger=require(_0x58a3('0x4'))[_0x58a3('0x5')];var safeTemplate=require('./safe-template')['safeTemplate'];var maskSensitiveData=require(_0x58a3('0x6'))['maskSensitiveData'];function ClientSideLogger(){function _0xdfb0cc(_0x4ff96a){var _0x1b7d6d=path[_0x58a3('0x7')](_0x58a3('0x8'),_0x58a3('0x9'),_0x58a3('0xa'));var _0x52a6af=path[_0x58a3('0x7')](_0x58a3('0xb'),_0x4ff96a['role']+'-'+_0x4ff96a[_0x58a3('0xc')]);return fs['ensureDir'](path['join'](_0x1b7d6d,_0x52a6af))[_0x58a3('0xd')](function(){var _0x190778=fileLogger('client',path['join'](_0x1b7d6d,_0x52a6af));return _0x190778;})[_0x58a3('0xe')](function(_0x3551f8){throw _0x3551f8;});}this[_0x58a3('0x9')]=function(_0x2d5b7e,_0x5e3f37,_0x36860f,_0x290e2c){return _0xdfb0cc(_0x2d5b7e[_0x58a3('0xf')])[_0x58a3('0xd')](function(_0x18ae9a){var _0x57dd71=_0x18ae9a[_0x5e3f37];return _0x57dd71;})[_0x58a3('0xd')](function(_0x313295){var _0xb58dd4=_0x2d5b7e[_0x58a3('0xf')]?_0x2d5b7e[_0x58a3('0xf')]['id']:_0x58a3('0x10');var _0x35334b=_0x290e2c['data'];var _0x193e4e=_0x290e2c[_0x58a3('0x11')];var _0x34dd3a=new Date(Number(_0x193e4e));return _0x313295(_0xb58dd4,_0x34dd3a,_0x36860f,_0x35334b);})['catch'](function(_0x493513){fileLogger(_0x58a3('0xb'))['error'](_0x493513);});};}function setupLoggers(_0x5ae2b3){return new Promise(function(_0x41faf6){var _0xff2944=new ClientSideLogger();var _0x4bd0d6=fileLogger(_0x58a3('0x12'));var _0x96c58a=fileLogger(_0x58a3('0x13'));_0x5ae2b3[_0x58a3('0x14')](_0x58a3('0x15'),_0xff2944);_0x5ae2b3[_0x58a3('0x16')](ewinston[_0x58a3('0x17')]({'winstonInstance':_0x4bd0d6,'meta':![],'statusLevels':!![],'msg':function(_0x13f598,_0x5dd146){var _0xb9baf8='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s';if(!_[_0x58a3('0x18')](_0x13f598['body'])){_0xb9baf8+=_0x58a3('0x19');var _0x515b57=_0x13f598[_0x58a3('0x1a')];maskSensitiveData(_0x515b57);}return safeTemplate(util[_0x58a3('0x1b')](_0xb9baf8,_0x13f598[_0x58a3('0x1c')],_0x13f598[_0x58a3('0x1d')][_0x58a3('0x1e')]?_0x13f598[_0x58a3('0x1d')][_0x58a3('0x1e')]:_0x13f598['connection'][_0x58a3('0x1f')]||_0x13f598['ip'],_0x13f598[_0x58a3('0x20')],_0x5dd146['statusCode'],_0x5dd146[_0x58a3('0x21')],_0x13f598['user']?_0x13f598[_0x58a3('0xf')]['id']:null,_0x13f598['user']?_0x13f598[_0x58a3('0xf')][_0x58a3('0xc')]:null,_0x13f598[_0x58a3('0xf')]?_0x13f598['user'][_0x58a3('0x22')]:null,_0x515b57?util['inspect'](_0x515b57,![],null):''));}}));_0x5ae2b3[_0x58a3('0x16')](ewinston['logger']({'winstonInstance':_0x96c58a,'meta':![],'statusLevels':!![],'msg':function(_0x1ec543,_0x2dac45){var _0x57bc24='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s';if(_0x1ec543['body']&&_0x1ec543[_0x58a3('0x1a')][_0x58a3('0x23')]&&_0x1ec543[_0x58a3('0x1a')][_0x58a3('0x24')]){_0x57bc24=_0x58a3('0x25');}return util[_0x58a3('0x1b')](_0x57bc24,_0x1ec543['method'],_0x1ec543[_0x58a3('0x1d')][_0x58a3('0x1e')]?_0x1ec543[_0x58a3('0x1d')][_0x58a3('0x1e')]:_0x1ec543['connection']['remoteAddress']||_0x1ec543['ip'],_0x1ec543[_0x58a3('0x20')],_0x2dac45[_0x58a3('0x26')],_0x2dac45[_0x58a3('0x21')],_0x1ec543[_0x58a3('0xf')]?_0x1ec543[_0x58a3('0xf')]['id']:null,_0x1ec543[_0x58a3('0xf')]?_0x1ec543['user']['name']:null,_0x1ec543['user']?_0x1ec543[_0x58a3('0xf')]['role']:null,_0x1ec543[_0x58a3('0x1a')]&&_0x1ec543[_0x58a3('0x1a')][_0x58a3('0x23')]?_0x1ec543['body'][_0x58a3('0x23')]:_0x58a3('0x27'),_0x1ec543[_0x58a3('0x1a')]&&_0x1ec543[_0x58a3('0x1a')][_0x58a3('0x24')]?_0x1ec543[_0x58a3('0x1a')][_0x58a3('0x24')]:'',_0x1ec543[_0x58a3('0x1a')]&&_0x1ec543[_0x58a3('0x1a')][_0x58a3('0x28')]?_0x1ec543[_0x58a3('0x1a')]['agent_name']:'');},'ignoreRoute':function(_0x28aacb){var _0x5c723e=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x5c723e[_0x58a3('0x29')](_0x28aacb[_0x58a3('0x20')]);}}));return _0x41faf6();});}exports[_0x58a3('0x2a')]=setupLoggers; \ No newline at end of file +var _0x15f8=['api','auth','set','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','method','headers','x-forwarded-for','connection','inspect','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','format','statusCode','responseTime','other','agent_name','url','setupLoggers','fs-extra','lodash','path','util','fileLogger','./safe-template','safeTemplate','join','log','xcally','role','name','then','user','no-user','timestamp','catch','error'];(function(_0x3e7691,_0xb42f02){var _0x3ec82b=function(_0x54f16f){while(--_0x54f16f){_0x3e7691['push'](_0x3e7691['shift']());}};_0x3ec82b(++_0xb42f02);}(_0x15f8,0xc0));var _0x815f=function(_0x295b70,_0x442203){_0x295b70=_0x295b70-0x0;var _0x28dd6d=_0x15f8[_0x295b70];return _0x28dd6d;};var fs=require(_0x815f('0x0'));var _=require(_0x815f('0x1'));var ewinston=require('express-winston');var path=require(_0x815f('0x2'));var util=require(_0x815f('0x3'));var fileLogger=require('./loggers')[_0x815f('0x4')];var safeTemplate=require(_0x815f('0x5'))[_0x815f('0x6')];var maskSensitiveData=require('./mask-sensitive-data')['maskSensitiveData'];function ClientSideLogger(){function _0x3da44a(_0x39df28){var _0xbc04f9=path[_0x815f('0x7')]('/var',_0x815f('0x8'),_0x815f('0x9'));var _0x2d191b=path[_0x815f('0x7')]('client',_0x39df28[_0x815f('0xa')]+'-'+_0x39df28[_0x815f('0xb')]);return fs['ensureDir'](path[_0x815f('0x7')](_0xbc04f9,_0x2d191b))[_0x815f('0xc')](function(){var _0x385652=fileLogger('client',path[_0x815f('0x7')](_0xbc04f9,_0x2d191b));return _0x385652;})['catch'](function(_0x4e223b){throw _0x4e223b;});}this['log']=function(_0x2a073a,_0x7595ce,_0x6d96f3,_0x52da97){return _0x3da44a(_0x2a073a[_0x815f('0xd')])['then'](function(_0x3936b5){var _0x4b2333=_0x3936b5[_0x7595ce];return _0x4b2333;})['then'](function(_0x3ee532){var _0x4bcbfd=_0x2a073a[_0x815f('0xd')]?_0x2a073a[_0x815f('0xd')]['id']:_0x815f('0xe');var _0x430e17=_0x52da97['data'];var _0xe2b23=_0x52da97[_0x815f('0xf')];var _0x41b8f4=new Date(Number(_0xe2b23));return _0x3ee532(_0x4bcbfd,_0x41b8f4,_0x6d96f3,_0x430e17);})[_0x815f('0x10')](function(_0xb8d389){fileLogger('client')[_0x815f('0x11')](_0xb8d389);});};}function setupLoggers(_0x588862){return new Promise(function(_0x42605c){var _0x68706b=new ClientSideLogger();var _0x57ea37=fileLogger(_0x815f('0x12'));var _0x520082=fileLogger(_0x815f('0x13'));_0x588862[_0x815f('0x14')]('client-side-logger',_0x68706b);_0x588862['use'](ewinston['logger']({'winstonInstance':_0x57ea37,'meta':![],'statusLevels':!![],'msg':function(_0x4663f5,_0xabda3c){var _0x35b2be=_0x815f('0x15');if(!_[_0x815f('0x16')](_0x4663f5[_0x815f('0x17')])){_0x35b2be+=_0x815f('0x18');var _0x37c6dd=_0x4663f5['body'];maskSensitiveData(_0x37c6dd);}return safeTemplate(util['format'](_0x35b2be,_0x4663f5[_0x815f('0x19')],_0x4663f5[_0x815f('0x1a')]['x-forwarded-for']?_0x4663f5[_0x815f('0x1a')][_0x815f('0x1b')]:_0x4663f5[_0x815f('0x1c')]['remoteAddress']||_0x4663f5['ip'],_0x4663f5['url'],_0xabda3c['statusCode'],_0xabda3c['responseTime'],_0x4663f5['user']?_0x4663f5[_0x815f('0xd')]['id']:null,_0x4663f5['user']?_0x4663f5['user']['name']:null,_0x4663f5[_0x815f('0xd')]?_0x4663f5[_0x815f('0xd')][_0x815f('0xa')]:null,_0x37c6dd?util[_0x815f('0x1d')](_0x37c6dd,![],null):''));}}));_0x588862[_0x815f('0x1e')](ewinston[_0x815f('0x1f')]({'winstonInstance':_0x520082,'meta':![],'statusLevels':!![],'msg':function(_0x792c1b,_0x5240e4){var _0x118f11=_0x815f('0x20');if(_0x792c1b[_0x815f('0x17')]&&_0x792c1b[_0x815f('0x17')][_0x815f('0x21')]&&_0x792c1b['body'][_0x815f('0x22')]){_0x118f11='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util[_0x815f('0x23')](_0x118f11,_0x792c1b[_0x815f('0x19')],_0x792c1b[_0x815f('0x1a')][_0x815f('0x1b')]?_0x792c1b['headers'][_0x815f('0x1b')]:_0x792c1b[_0x815f('0x1c')]['remoteAddress']||_0x792c1b['ip'],_0x792c1b['url'],_0x5240e4[_0x815f('0x24')],_0x5240e4[_0x815f('0x25')],_0x792c1b[_0x815f('0xd')]?_0x792c1b[_0x815f('0xd')]['id']:null,_0x792c1b['user']?_0x792c1b['user']['name']:null,_0x792c1b[_0x815f('0xd')]?_0x792c1b['user']['role']:null,_0x792c1b[_0x815f('0x17')]&&_0x792c1b['body'][_0x815f('0x21')]?_0x792c1b['body']['device']:_0x815f('0x26'),_0x792c1b[_0x815f('0x17')]&&_0x792c1b['body'][_0x815f('0x22')]?_0x792c1b[_0x815f('0x17')]['agent_id']:'',_0x792c1b[_0x815f('0x17')]&&_0x792c1b['body'][_0x815f('0x27')]?_0x792c1b['body'][_0x815f('0x27')]:'');},'ignoreRoute':function(_0xf21a22){var _0xd8d569=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0xd8d569['test'](_0xf21a22[_0x815f('0x28')]);}}));return _0x42605c();});}exports[_0x815f('0x29')]=setupLoggers; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index 7d1a403..9720bb9 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfbc2=['meta','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','Logger','Console','warn','File','%s-%s','error','transports','path','util','winston','../config/environment','debugLevel','toLowerCase','info','redBG\x20white','red','bold\x20yellow','white','bold\x20green','gray','bold\x20blue','/var/log/xcally','join','format','%s-%s.log','message','replace','{{{','}}}','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','keys'];(function(_0x57f243,_0x157b0a){var _0x3c2ac0=function(_0x2c49f4){while(--_0x2c49f4){_0x57f243['push'](_0x57f243['shift']());}};_0x3c2ac0(++_0x157b0a);}(_0xfbc2,0x18a));var _0x2fbc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfbc2[_0x3dd15e];return _0x231fd0;};'use strict';var path=require(_0x2fbc('0x0'));var util=require(_0x2fbc('0x1'));var moment=require('moment');var winston=require(_0x2fbc('0x2'));var config=require(_0x2fbc('0x3'));var debugLevel=config['debugLevel']?config[_0x2fbc('0x4')][_0x2fbc('0x5')]():_0x2fbc('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':_0x2fbc('0x7'),'error':_0x2fbc('0x8'),'warn':_0x2fbc('0x9'),'info':_0x2fbc('0xa'),'print':'bold\x20white','success':_0x2fbc('0xb'),'http':_0x2fbc('0xc'),'verbose':'bold\x20magenta','debug':_0x2fbc('0xd'),'silly':'bold\x20cyan'};winston['addColors'](XC_LOG_COLORS);function getLogFileName(_0x35d2bb,_0x255ec3,_0x5188e){var _0x520dcf=_0x35d2bb||_0x2fbc('0xe');return path[_0x2fbc('0xf')](_0x520dcf,util[_0x2fbc('0x10')](_0x2fbc('0x11'),_0x255ec3,_0x5188e));}function formatter(_0x4ccea8,_0x5ac34d){_0x5ac34d[_0x2fbc('0x12')]=_0x5ac34d[_0x2fbc('0x12')][_0x2fbc('0x13')](/@@{/g,_0x2fbc('0x14'))[_0x2fbc('0x13')](/}@@/g,_0x2fbc('0x15'))[_0x2fbc('0x13')](/@{/g,'{{')[_0x2fbc('0x13')](/}@/g,'}}');return util[_0x2fbc('0x10')]('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()[_0x2fbc('0x10')](_0x2fbc('0x16')),_0x5ac34d[_0x2fbc('0x17')][_0x2fbc('0x18')](),_0x4ccea8,_0x5ac34d[_0x2fbc('0x12')]);}function fileFormat(_0x5a2ead,_0x4bff54){_0x4bff54[_0x2fbc('0x12')]=_0x4bff54['message']['replace'](/@@{/g,_0x2fbc('0x14'))['replace'](/}@@/g,_0x2fbc('0x15'))[_0x2fbc('0x13')](/@{/g,'{{')[_0x2fbc('0x13')](/}@/g,'}}');var _0x4dc081=_0x4bff54['meta']&&Object[_0x2fbc('0x19')](_0x4bff54[_0x2fbc('0x1a')])['length']?'\x0a\x09'+JSON['stringify'](_0x4bff54['meta']):'';return util[_0x2fbc('0x10')](_0x2fbc('0x1b'),moment()[_0x2fbc('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),_0x4bff54[_0x2fbc('0x17')][_0x2fbc('0x18')](),_0x5a2ead,_0x4bff54[_0x2fbc('0x12')],_0x4dc081);}function consoleLogger(){var _0x31f559=new winston[(_0x2fbc('0x1c'))]({'levels':XC_LOG_LEVELS,'transports':[new winston['transports'][(_0x2fbc('0x1d'))]({'level':_0x2fbc('0x1e'),'json':![],'formatter':function(_0x10c5be){return formatter('',_0x10c5be);}})]});return _0x31f559;}function fileLogger(_0x247862,_0x1ff087){var _0x1c4861=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston['transports'][(_0x2fbc('0x1f'))]({'name':util[_0x2fbc('0x10')](_0x2fbc('0x20'),_0x247862,'error'),'filename':getLogFileName(_0x1ff087,_0x247862,_0x2fbc('0x21')),'level':_0x2fbc('0x21'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x47384d){return fileFormat(_0x247862,_0x47384d);}}),new winston[(_0x2fbc('0x22'))][(_0x2fbc('0x1f'))]({'name':util['format'](_0x2fbc('0x20'),_0x247862,debugLevel),'filename':getLogFileName(_0x1ff087,_0x247862,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x18d1ab){return fileFormat(_0x247862,_0x18d1ab);}}),new winston[(_0x2fbc('0x22'))][(_0x2fbc('0x1d'))]({'level':_0x2fbc('0x1e'),'json':![],'formatter':function(_0x33204c){return fileFormat(_0x247862,_0x33204c);}})]});return _0x1c4861;}exports['consoleLogger']=consoleLogger;exports['fileLogger']=fileLogger; \ No newline at end of file +var _0x6468=['bold\x20yellow','white','bold\x20white','bold\x20green','gray','addColors','join','%s-%s.log','message','{{{','replace','}}}','format','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','meta','keys','length','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','Logger','transports','warn','%s-%s','error','File','Console','consoleLogger','winston','../config/environment','debugLevel','toLowerCase','redBG\x20white','red'];(function(_0x471273,_0x1587f1){var _0x56c63e=function(_0x4464f0){while(--_0x4464f0){_0x471273['push'](_0x471273['shift']());}};_0x56c63e(++_0x1587f1);}(_0x6468,0xf6));var _0x8646=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0x6468[_0x4dbaad];return _0x226c72;};'use strict';var path=require('path');var util=require('util');var moment=require('moment');var winston=require(_0x8646('0x0'));var config=require(_0x8646('0x1'));var debugLevel=config[_0x8646('0x2')]?config[_0x8646('0x2')][_0x8646('0x3')]():'info';var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':_0x8646('0x4'),'error':_0x8646('0x5'),'warn':_0x8646('0x6'),'info':_0x8646('0x7'),'print':_0x8646('0x8'),'success':_0x8646('0x9'),'http':_0x8646('0xa'),'verbose':'bold\x20magenta','debug':'bold\x20blue','silly':'bold\x20cyan'};winston[_0x8646('0xb')](XC_LOG_COLORS);function getLogFileName(_0x933fb7,_0xdba4b6,_0x1e9df6){var _0xf4fb85=_0x933fb7||'/var/log/xcally';return path[_0x8646('0xc')](_0xf4fb85,util['format'](_0x8646('0xd'),_0xdba4b6,_0x1e9df6));}function formatter(_0x2f97e6,_0x5eb568){_0x5eb568[_0x8646('0xe')]=_0x5eb568[_0x8646('0xe')]['replace'](/@@{/g,_0x8646('0xf'))[_0x8646('0x10')](/}@@/g,_0x8646('0x11'))[_0x8646('0x10')](/@{/g,'{{')[_0x8646('0x10')](/}@/g,'}}');return util[_0x8646('0x12')](_0x8646('0x13'),moment()[_0x8646('0x12')](_0x8646('0x14')),_0x5eb568[_0x8646('0x15')][_0x8646('0x16')](),_0x2f97e6,_0x5eb568[_0x8646('0xe')]);}function fileFormat(_0x159233,_0x1ff08c){_0x1ff08c[_0x8646('0xe')]=_0x1ff08c[_0x8646('0xe')][_0x8646('0x10')](/@@{/g,'{{{')[_0x8646('0x10')](/}@@/g,_0x8646('0x11'))[_0x8646('0x10')](/@{/g,'{{')['replace'](/}@/g,'}}');var _0x56d204=_0x1ff08c[_0x8646('0x17')]&&Object[_0x8646('0x18')](_0x1ff08c['meta'])[_0x8646('0x19')]?'\x0a\x09'+JSON[_0x8646('0x1a')](_0x1ff08c[_0x8646('0x17')]):'';return util[_0x8646('0x12')](_0x8646('0x1b'),moment()[_0x8646('0x12')]('YYYY-MM-DD\x20HH:mm:ss'),_0x1ff08c['level'][_0x8646('0x16')](),_0x159233,_0x1ff08c[_0x8646('0xe')],_0x56d204);}function consoleLogger(){var _0x181a0b=new winston[(_0x8646('0x1c'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x8646('0x1d'))]['Console']({'level':_0x8646('0x1e'),'json':![],'formatter':function(_0x589030){return formatter('',_0x589030);}})]});return _0x181a0b;}function fileLogger(_0x32bdd2,_0x1af6ba){var _0x1a9356=new winston[(_0x8646('0x1c'))]({'levels':XC_LOG_LEVELS,'transports':[new winston['transports']['File']({'name':util[_0x8646('0x12')](_0x8646('0x1f'),_0x32bdd2,_0x8646('0x20')),'filename':getLogFileName(_0x1af6ba,_0x32bdd2,_0x8646('0x20')),'level':'error','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x4b1612){return fileFormat(_0x32bdd2,_0x4b1612);}}),new winston[(_0x8646('0x1d'))][(_0x8646('0x21'))]({'name':util['format'](_0x8646('0x1f'),_0x32bdd2,debugLevel),'filename':getLogFileName(_0x1af6ba,_0x32bdd2,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x521738){return fileFormat(_0x32bdd2,_0x521738);}}),new winston[(_0x8646('0x1d'))][(_0x8646('0x22'))]({'level':'warn','json':![],'formatter':function(_0xbf938b){return fileFormat(_0x32bdd2,_0xbf938b);}})]});return _0x1a9356;}exports[_0x8646('0x23')]=consoleLogger;exports['fileLogger']=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index 851ceba..8dcead5 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 _0x1261=['fax','clientSecret','securityToken','accessKey','tenantId','token','channelSecret','accessToken','authToken','consumerKey','consumerSecret','calleridname','vidaooApiKey','privateKey','accesskeyid','secretaccesskey','key','user','pass','accountSid','localstationid','dsn','oldPassword','length','isPlainObject','replace','@@{','exports','username','password','newPassword','apiKey','firstName','lastName','street','phone','mobile'];(function(_0xd4cd29,_0x54f4ae){var _0x79e8f5=function(_0x533ebf){while(--_0x533ebf){_0xd4cd29['push'](_0xd4cd29['shift']());}};_0x79e8f5(++_0x54f4ae);}(_0x1261,0x144));var _0x1126=function(_0x5d6448,_0x53522f){_0x5d6448=_0x5d6448-0x0;var _0x58c195=_0x1261[_0x5d6448];return _0x58c195;};var _=require('lodash');var sensitiveFields=[_0x1126('0x0'),_0x1126('0x1'),_0x1126('0x2'),_0x1126('0x3'),_0x1126('0x4'),_0x1126('0x5'),_0x1126('0x6'),_0x1126('0x7'),_0x1126('0x8'),_0x1126('0x9'),'email','clientId',_0x1126('0xa'),_0x1126('0xb'),'code',_0x1126('0xc'),_0x1126('0xd'),_0x1126('0xe'),_0x1126('0xf'),_0x1126('0x10'),'accessTokenSecret',_0x1126('0x11'),_0x1126('0x12'),_0x1126('0x13'),'membername',_0x1126('0x14'),'calleridnum','exten',_0x1126('0x15'),'clientEmail',_0x1126('0x16'),_0x1126('0x17'),_0x1126('0x18'),_0x1126('0x19'),_0x1126('0x1a'),_0x1126('0x1b'),_0x1126('0x1c'),_0x1126('0x1d'),_0x1126('0x1e'),'secret','registry',_0x1126('0x1f')];function maskSensitiveData(_0x154e20){const _0x279455=/(?!^)[\s\S](?!$)/g;if(_['isPlainObject'](_0x154e20)){for(const _0x45149c in _0x154e20){if(_['isArray'](_0x154e20[_0x45149c])){for(let _0x35fe9f=0x0;_0x35fe9f<_0x154e20[_0x45149c][_0x1126('0x20')];_0x35fe9f++){maskSensitiveData(_0x154e20[_0x45149c][_0x35fe9f]);}}else if(_[_0x1126('0x21')](_0x154e20[_0x45149c])){maskSensitiveData(_0x154e20[_0x45149c]);}else if(_['isString'](_0x154e20[_0x45149c])){_0x154e20[_0x45149c]=_0x154e20[_0x45149c][_0x1126('0x22')](/{{{/g,_0x1126('0x23'))['replace'](/}}}/g,'}@@')[_0x1126('0x22')](/{{/g,'@{')[_0x1126('0x22')](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x45149c)){_0x154e20[_0x45149c]=_0x154e20[_0x45149c]['replace'](_0x279455,'*');}}}}}module[_0x1126('0x24')]['maskSensitiveData']=maskSensitiveData; \ No newline at end of file +var _0x1967=['secret','registry','isPlainObject','isArray','length','isString','replace','@@{','}@@','includes','exports','username','password','newPassword','apiKey','firstName','lastName','street','phone','mobile','fax','clientId','clientSecret','securityToken','code','accessKey','tenantId','channelSecret','accessToken','accessTokenSecret','authToken','consumerKey','calleridname','calleridnum','exten','vidaooApiKey','clientEmail','privateKey','accesskeyid','secretaccesskey','key','user','pass','localstationid','dsn'];(function(_0x3de8a4,_0x289a5c){var _0x4635cf=function(_0x2bddb8){while(--_0x2bddb8){_0x3de8a4['push'](_0x3de8a4['shift']());}};_0x4635cf(++_0x289a5c);}(_0x1967,0x173));var _0x7196=function(_0x23ea73,_0xc51ae0){_0x23ea73=_0x23ea73-0x0;var _0x54f054=_0x1967[_0x23ea73];return _0x54f054;};var _=require('lodash');var sensitiveFields=[_0x7196('0x0'),_0x7196('0x1'),_0x7196('0x2'),_0x7196('0x3'),_0x7196('0x4'),_0x7196('0x5'),_0x7196('0x6'),_0x7196('0x7'),_0x7196('0x8'),_0x7196('0x9'),'email',_0x7196('0xa'),_0x7196('0xb'),_0x7196('0xc'),_0x7196('0xd'),_0x7196('0xe'),_0x7196('0xf'),'token',_0x7196('0x10'),_0x7196('0x11'),_0x7196('0x12'),_0x7196('0x13'),_0x7196('0x14'),'consumerSecret','membername',_0x7196('0x15'),_0x7196('0x16'),_0x7196('0x17'),_0x7196('0x18'),_0x7196('0x19'),_0x7196('0x1a'),_0x7196('0x1b'),_0x7196('0x1c'),_0x7196('0x1d'),_0x7196('0x1e'),_0x7196('0x1f'),'accountSid',_0x7196('0x20'),_0x7196('0x21'),_0x7196('0x22'),_0x7196('0x23'),'oldPassword'];function maskSensitiveData(_0x31c778){const _0x539414=/(?!^)[\s\S](?!$)/g;if(_[_0x7196('0x24')](_0x31c778)){for(const _0x2590a6 in _0x31c778){if(_[_0x7196('0x25')](_0x31c778[_0x2590a6])){for(let _0x3ed1ad=0x0;_0x3ed1ad<_0x31c778[_0x2590a6][_0x7196('0x26')];_0x3ed1ad++){maskSensitiveData(_0x31c778[_0x2590a6][_0x3ed1ad]);}}else if(_[_0x7196('0x24')](_0x31c778[_0x2590a6])){maskSensitiveData(_0x31c778[_0x2590a6]);}else if(_[_0x7196('0x27')](_0x31c778[_0x2590a6])){_0x31c778[_0x2590a6]=_0x31c778[_0x2590a6][_0x7196('0x28')](/{{{/g,_0x7196('0x29'))[_0x7196('0x28')](/}}}/g,_0x7196('0x2a'))['replace'](/{{/g,'@{')['replace'](/}}/g,'}@');if(_[_0x7196('0x2b')](sensitiveFields,_0x2590a6)){_0x31c778[_0x2590a6]=_0x31c778[_0x2590a6][_0x7196('0x28')](_0x539414,'*');}}}}}module[_0x7196('0x2c')]['maskSensitiveData']=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index ea1ce74..b65e384 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 _0x2032=['isArray','map','isPlainObject','keys','reduce','exports','safeTemplate','{\x20{\x20','\x20}\x20}','string'];(function(_0x49ca18,_0x5e6d05){var _0x145d54=function(_0x30b9be){while(--_0x30b9be){_0x49ca18['push'](_0x49ca18['shift']());}};_0x145d54(++_0x5e6d05);}(_0x2032,0xd9));var _0x2203=function(_0x251b6c,_0xf1a210){_0x251b6c=_0x251b6c-0x0;var _0x1781fb=_0x2032[_0x251b6c];return _0x1781fb;};var _=require('lodash');var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x2c2259){return _0x2c2259==='{{'?_0x2203('0x0'):_0x2203('0x1');}function safeTemplate(_0x4c28da){var _0x486390=_0x4c28da;if(typeof _0x4c28da===_0x2203('0x2')){_0x486390=_0x4c28da['replace'](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x2203('0x3')](_0x4c28da)){_0x486390=_0x4c28da[_0x2203('0x4')](function(_0x44ccfd){return safeTemplate(_0x44ccfd);});}else if(_[_0x2203('0x5')](_0x4c28da)){_0x486390=Object[_0x2203('0x6')](_0x4c28da)[_0x2203('0x7')](function(_0x2e0f63,_0x2676aa){_0x2e0f63[_0x2676aa]=safeTemplate(_0x4c28da[_0x2676aa]);return _0x2e0f63;},{});}return _0x486390;}module[_0x2203('0x8')][_0x2203('0x9')]=safeTemplate; \ No newline at end of file +var _0xb7e7=['reduce','safeTemplate','lodash','{\x20{\x20','string','isArray','map'];(function(_0x47d1c6,_0x2c8a12){var _0x352e99=function(_0x34a92e){while(--_0x34a92e){_0x47d1c6['push'](_0x47d1c6['shift']());}};_0x352e99(++_0x2c8a12);}(_0xb7e7,0x121));var _0x7b7e=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xb7e7[_0x38a7ac];return _0x53061a;};var _=require(_0x7b7e('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x545d7d){return _0x545d7d==='{{'?_0x7b7e('0x1'):'\x20}\x20}';}function safeTemplate(_0x1b7cc7){var _0x54a37f=_0x1b7cc7;if(typeof _0x1b7cc7===_0x7b7e('0x2')){_0x54a37f=_0x1b7cc7['replace'](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x7b7e('0x3')](_0x1b7cc7)){_0x54a37f=_0x1b7cc7[_0x7b7e('0x4')](function(_0x1d9384){return safeTemplate(_0x1d9384);});}else if(_['isPlainObject'](_0x1b7cc7)){_0x54a37f=Object['keys'](_0x1b7cc7)[_0x7b7e('0x5')](function(_0x372bde,_0x7f87e0){_0x372bde[_0x7f87e0]=safeTemplate(_0x1b7cc7[_0x7f87e0]);return _0x372bde;},{});}return _0x54a37f;}module['exports'][_0x7b7e('0x6')]=safeTemplate; \ No newline at end of file